From: Andrea Amorese Date: Mon, 22 Nov 2021 15:30:32 +0000 (+0100) Subject: Built motion from commit 64323aab.|2.5.38 X-Git-Url: http://repos.xcallymotion.com/base//%22api/fax/attachments/%7B%7BfaxAttachment.id%7D%7D/%22?a=commitdiff_plain;h=c7e6214048509eedba02439c58b599051c123b85;p=motion2.git Built motion from commit 64323aab.|2.5.38 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 613fdc8..8062675 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-11-22T14:40:59.053Z", + "time": "2021-11-22T15:12:30.616Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index bcd5528..9a6ec57 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-11-22T14:40:59.053Z", + "time": "2021-11-22T15:12:30.616Z", "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 15cfe05..6902ebe 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 _0x6764=['Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','STRING','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[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','VIRTUAL','action','contactManager','integration','motionbar','jscripty','urlForward','browser','bot','script'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x6764,0x74));var _0x4676=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x6764[_0x3bf83f];return _0x22c4a9;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x4676('0x0')],'get':function(_0xe281d8){return this['getDataValue'](_0x4676('0x1'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0x4676('0x2'),_0x4676('0x3'),_0x4676('0x4'),_0x4676('0x5'),_0x4676('0x6'),_0x4676('0x7'),_0x4676('0x8'),_0x4676('0x9')]],'msg':_0x4676('0xa')}},'comment':_0x4676('0xa')},'data1':{'type':Sequelize[_0x4676('0xb')](0x1000),'comment':_0x4676('0xc')},'data2':{'type':Sequelize[_0x4676('0xb')](0x1000),'comment':_0x4676('0xd')},'data3':{'type':Sequelize[_0x4676('0xb')](0x1000),'comment':_0x4676('0xe')},'data4':{'type':Sequelize[_0x4676('0xb')](0x1000),'comments':'browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'},'data5':{'type':Sequelize['STRING'](0x1000),'comments':_0x4676('0xf')},'data6':{'type':Sequelize[_0x4676('0xb')],'comments':_0x4676('0x10')},'data7':{'type':Sequelize[_0x4676('0x11')],'comments':'urlForward[body]'}}; \ No newline at end of file +var _0xfbfe=['urlForward[body]','sequelize','exports','VIRTUAL','STRING','contactManager','integration','jscripty','urlForward','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[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT'];(function(_0x2790e7,_0x40bbe4){var _0x1ee42f=function(_0xd1a357){while(--_0xd1a357){_0x2790e7['push'](_0x2790e7['shift']());}};_0x1ee42f(++_0x40bbe4);}(_0xfbfe,0x99));var _0xefbf=function(_0x99c9e8,_0x190b23){_0x99c9e8=_0x99c9e8-0x0;var _0x1d4ac2=_0xfbfe[_0x99c9e8];return _0x1d4ac2;};'use strict';var Sequelize=require(_0xefbf('0x0'));module[_0xefbf('0x1')]={'name':{'type':Sequelize[_0xefbf('0x2')],'get':function(_0x152324){return this['getDataValue']('action');}},'action':{'type':Sequelize[_0xefbf('0x3')],'allowNull':![],'validate':{'isIn':{'args':[[_0xefbf('0x4'),_0xefbf('0x5'),'motionbar',_0xefbf('0x6'),_0xefbf('0x7'),'browser',_0xefbf('0x8'),_0xefbf('0x9')]],'msg':_0xefbf('0xa')}},'comment':_0xefbf('0xa')},'data1':{'type':Sequelize[_0xefbf('0x3')](0x1000),'comment':_0xefbf('0xb')},'data2':{'type':Sequelize[_0xefbf('0x3')](0x1000),'comment':_0xefbf('0xc')},'data3':{'type':Sequelize[_0xefbf('0x3')](0x1000),'comment':_0xefbf('0xd')},'data4':{'type':Sequelize[_0xefbf('0x3')](0x1000),'comments':_0xefbf('0xe')},'data5':{'type':Sequelize['STRING'](0x1000),'comments':_0xefbf('0xf')},'data6':{'type':Sequelize[_0xefbf('0x3')],'comments':_0xefbf('0x10')},'data7':{'type':Sequelize[_0xefbf('0x11')],'comments':_0xefbf('0x12')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 4b9d422..83b072a 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 _0x00d9=['save','destroy','then','error','stack','name','update','body','find','catch','params','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','apply','reject'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x00d9,0xec));var _0x900d=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x00d9[_0x3ab9ee];return _0x82ee88;};'use strict';var emlformat=require(_0x900d('0x0'));var rimraf=require(_0x900d('0x1'));var zipdir=require(_0x900d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x900d('0x3'));var moment=require(_0x900d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x900d('0x5'));var util=require(_0x900d('0x6'));var path=require(_0x900d('0x7'));var sox=require(_0x900d('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x900d('0x9'));var _=require(_0x900d('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x900d('0xb'));var deskjs=require(_0x900d('0xc'));var toCsv=require(_0x900d('0xd'));var querystring=require(_0x900d('0xe'));var Papa=require(_0x900d('0xf'));var Redis=require('ioredis');var authService=require(_0x900d('0x10'));var qs=require(_0x900d('0x11'));var as=require(_0x900d('0x12'));var hardwareService=require(_0x900d('0x13'));var logger=require('../../config/logger')(_0x900d('0x14'));var utils=require(_0x900d('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x900d('0x16'));var db=require(_0x900d('0x17'))['db'];function respondWithStatusCode(_0x509cff,_0x25c71f){_0x25c71f=_0x25c71f||0xcc;return function(_0x37b402){if(_0x37b402){return _0x509cff['sendStatus'](_0x25c71f);}return _0x509cff[_0x900d('0x18')](_0x25c71f)[_0x900d('0x19')]();};}function respondWithResult(_0x1da2e,_0x2ff701){_0x2ff701=_0x2ff701||0xc8;return function(_0x3c44e2){if(_0x3c44e2){return _0x1da2e[_0x900d('0x18')](_0x2ff701)[_0x900d('0x1a')](_0x3c44e2);}};}function respondWithFilteredResult(_0x2df02b,_0x57cf30){return function(_0x30ab22){if(_0x30ab22){var _0x20e05f=typeof _0x57cf30[_0x900d('0x1b')]==='undefined'&&typeof _0x57cf30[_0x900d('0x1c')]===_0x900d('0x1d');var _0x2cd4ff=_0x30ab22[_0x900d('0x1e')];var _0x3a658b=_0x20e05f?0x0:_0x57cf30['offset'];var _0xec882d=_0x20e05f?_0x30ab22[_0x900d('0x1e')]:_0x57cf30[_0x900d('0x1b')]+_0x57cf30[_0x900d('0x1c')];var _0x4eb6e5;if(_0xec882d>=_0x2cd4ff){_0xec882d=_0x2cd4ff;_0x4eb6e5=0xc8;}else{_0x4eb6e5=0xce;}_0x2df02b[_0x900d('0x18')](_0x4eb6e5);return _0x2df02b[_0x900d('0x1f')]('Content-Range',_0x3a658b+'-'+_0xec882d+'/'+_0x2cd4ff)[_0x900d('0x1a')](_0x30ab22);}return null;};}function patchUpdates(_0x2b5b3a){return function(_0x32d67a){try{jsonpatch[_0x900d('0x20')](_0x32d67a,_0x2b5b3a,!![]);}catch(_0x42fa8a){return BPromise[_0x900d('0x21')](_0x42fa8a);}return _0x32d67a[_0x900d('0x22')]();};}function saveUpdates(_0x3a0421,_0x21cf0c){return function(_0x16c537){if(_0x16c537){return _0x16c537['update'](_0x3a0421)['then'](function(_0x26474a){return _0x26474a;});}return null;};}function removeEntity(_0x296ba8,_0x4baa7b){return function(_0x534c37){if(_0x534c37){return _0x534c37[_0x900d('0x23')]()[_0x900d('0x24')](function(){_0x296ba8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x178012,_0x1fbff5){return function(_0x2caec0){if(!_0x2caec0){_0x178012['sendStatus'](0x194);}return _0x2caec0;};}function handleError(_0x1a9fad,_0x3be641){_0x3be641=_0x3be641||0x1f4;return function(_0xb7a450){logger[_0x900d('0x25')](_0xb7a450[_0x900d('0x26')]);if(_0xb7a450['name']){delete _0xb7a450[_0x900d('0x27')];}_0x1a9fad[_0x900d('0x18')](_0x3be641)['send'](_0xb7a450);};}exports[_0x900d('0x28')]=function(_0x3b966f,_0x41947d){if(_0x3b966f[_0x900d('0x29')]['id']){delete _0x3b966f['body']['id'];}return db['Action'][_0x900d('0x2a')]({'where':{'id':_0x3b966f['params']['id']}})[_0x900d('0x24')](handleEntityNotFound(_0x41947d,null))[_0x900d('0x24')](saveUpdates(_0x3b966f['body'],null))[_0x900d('0x24')](respondWithResult(_0x41947d,null))[_0x900d('0x2b')](handleError(_0x41947d,null));};exports['destroy']=function(_0xd1ecf1,_0x4ff75d){return db['Action'][_0x900d('0x2a')]({'where':{'id':_0xd1ecf1[_0x900d('0x2c')]['id']}})['then'](handleEntityNotFound(_0x4ff75d,null))['then'](removeEntity(_0x4ff75d,null))[_0x900d('0x2b')](handleError(_0x4ff75d,null));}; \ No newline at end of file +var _0x5ea8=['undefined','limit','count','Content-Range','json','apply','reject','then','error','stack','name','send','update','body','Action','params','catch','destroy','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset'];(function(_0x5e250e,_0x50c4eb){var _0x26affe=function(_0x2329e2){while(--_0x2329e2){_0x5e250e['push'](_0x5e250e['shift']());}};_0x26affe(++_0x50c4eb);}(_0x5ea8,0x1f3));var _0x85ea=function(_0x104b6b,_0x298cd6){_0x104b6b=_0x104b6b-0x0;var _0x348e0a=_0x5ea8[_0x104b6b];return _0x348e0a;};'use strict';var emlformat=require(_0x85ea('0x0'));var rimraf=require(_0x85ea('0x1'));var zipdir=require(_0x85ea('0x2'));var jsonpatch=require(_0x85ea('0x3'));var rp=require(_0x85ea('0x4'));var moment=require(_0x85ea('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x85ea('0x6'));var sox=require(_0x85ea('0x7'));var csv=require(_0x85ea('0x8'));var ejs=require(_0x85ea('0x9'));var fs=require('fs');var fs_extra=require(_0x85ea('0xa'));var _=require(_0x85ea('0xb'));var squel=require(_0x85ea('0xc'));var crypto=require('crypto');var jsforce=require(_0x85ea('0xd'));var deskjs=require(_0x85ea('0xe'));var toCsv=require(_0x85ea('0x8'));var querystring=require(_0x85ea('0xf'));var Papa=require(_0x85ea('0x10'));var Redis=require(_0x85ea('0x11'));var authService=require(_0x85ea('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x85ea('0x13'));var hardwareService=require(_0x85ea('0x14'));var logger=require('../../config/logger')(_0x85ea('0x15'));var utils=require(_0x85ea('0x16'));var config=require(_0x85ea('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x85ea('0x18'))['db'];function respondWithStatusCode(_0x18ae83,_0x4cd4a0){_0x4cd4a0=_0x4cd4a0||0xcc;return function(_0x101bb9){if(_0x101bb9){return _0x18ae83[_0x85ea('0x19')](_0x4cd4a0);}return _0x18ae83[_0x85ea('0x1a')](_0x4cd4a0)[_0x85ea('0x1b')]();};}function respondWithResult(_0x495f96,_0x2d451c){_0x2d451c=_0x2d451c||0xc8;return function(_0x5cc3a1){if(_0x5cc3a1){return _0x495f96[_0x85ea('0x1a')](_0x2d451c)['json'](_0x5cc3a1);}};}function respondWithFilteredResult(_0x440dc6,_0x4b0db0){return function(_0x5ac586){if(_0x5ac586){var _0x4e79fc=typeof _0x4b0db0[_0x85ea('0x1c')]===_0x85ea('0x1d')&&typeof _0x4b0db0[_0x85ea('0x1e')]===_0x85ea('0x1d');var _0x4eec05=_0x5ac586['count'];var _0x38311b=_0x4e79fc?0x0:_0x4b0db0['offset'];var _0x4e4a6b=_0x4e79fc?_0x5ac586[_0x85ea('0x1f')]:_0x4b0db0[_0x85ea('0x1c')]+_0x4b0db0['limit'];var _0x538de3;if(_0x4e4a6b>=_0x4eec05){_0x4e4a6b=_0x4eec05;_0x538de3=0xc8;}else{_0x538de3=0xce;}_0x440dc6['status'](_0x538de3);return _0x440dc6['set'](_0x85ea('0x20'),_0x38311b+'-'+_0x4e4a6b+'/'+_0x4eec05)[_0x85ea('0x21')](_0x5ac586);}return null;};}function patchUpdates(_0x45b08d){return function(_0xa71efd){try{jsonpatch[_0x85ea('0x22')](_0xa71efd,_0x45b08d,!![]);}catch(_0x4e89ae){return BPromise[_0x85ea('0x23')](_0x4e89ae);}return _0xa71efd['save']();};}function saveUpdates(_0x3adf2a,_0x48f5dc){return function(_0x4b2022){if(_0x4b2022){return _0x4b2022['update'](_0x3adf2a)[_0x85ea('0x24')](function(_0x514360){return _0x514360;});}return null;};}function removeEntity(_0xedede6,_0x2387d0){return function(_0x3bdcca){if(_0x3bdcca){return _0x3bdcca['destroy']()['then'](function(){_0xedede6[_0x85ea('0x1a')](0xcc)[_0x85ea('0x1b')]();});}};}function handleEntityNotFound(_0x1005c0,_0x47ef53){return function(_0x2767ed){if(!_0x2767ed){_0x1005c0[_0x85ea('0x19')](0x194);}return _0x2767ed;};}function handleError(_0x56882b,_0x2b05f4){_0x2b05f4=_0x2b05f4||0x1f4;return function(_0x360a1f){logger[_0x85ea('0x25')](_0x360a1f[_0x85ea('0x26')]);if(_0x360a1f['name']){delete _0x360a1f[_0x85ea('0x27')];}_0x56882b[_0x85ea('0x1a')](_0x2b05f4)[_0x85ea('0x28')](_0x360a1f);};}exports[_0x85ea('0x29')]=function(_0x4fb495,_0x4a24c8){if(_0x4fb495[_0x85ea('0x2a')]['id']){delete _0x4fb495[_0x85ea('0x2a')]['id'];}return db[_0x85ea('0x2b')]['find']({'where':{'id':_0x4fb495[_0x85ea('0x2c')]['id']}})[_0x85ea('0x24')](handleEntityNotFound(_0x4a24c8,null))[_0x85ea('0x24')](saveUpdates(_0x4fb495['body'],null))[_0x85ea('0x24')](respondWithResult(_0x4a24c8,null))[_0x85ea('0x2d')](handleError(_0x4a24c8,null));};exports[_0x85ea('0x2e')]=function(_0x3f36a2,_0x324961){return db[_0x85ea('0x2b')][_0x85ea('0x2f')]({'where':{'id':_0x3f36a2[_0x85ea('0x2c')]['id']}})[_0x85ea('0x24')](handleEntityNotFound(_0x324961,null))['then'](removeEntity(_0x324961,null))[_0x85ea('0x2d')](handleError(_0x324961,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index c140ac3..1ad1900 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 _0x74f6=['../../config/environment','./action.attributes','define','Action','tools_actions','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x4b8f4a,_0x30d9f6){var _0x3d84db=function(_0x231607){while(--_0x231607){_0x4b8f4a['push'](_0x4b8f4a['shift']());}};_0x3d84db(++_0x30d9f6);}(_0x74f6,0x1e6));var _0x674f=function(_0x56a4dd,_0x317486){_0x56a4dd=_0x56a4dd-0x0;var _0x40e651=_0x74f6[_0x56a4dd];return _0x40e651;};'use strict';var _=require(_0x674f('0x0'));var util=require('util');var logger=require(_0x674f('0x1'))(_0x674f('0x2'));var moment=require(_0x674f('0x3'));var BPromise=require(_0x674f('0x4'));var rp=require(_0x674f('0x5'));var fs=require('fs');var path=require(_0x674f('0x6'));var rimraf=require(_0x674f('0x7'));var config=require(_0x674f('0x8'));var attributes=require(_0x674f('0x9'));module['exports']=function(_0x2aba7d,_0x502a30){return _0x2aba7d[_0x674f('0xa')](_0x674f('0xb'),attributes,{'tableName':_0x674f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc361=['bluebird','path','../../config/environment','./action.attributes','exports','define','Action','lodash','util','../../config/logger'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0xc361,0x151));var _0x1c36=function(_0x260dd2,_0xa0cfd4){_0x260dd2=_0x260dd2-0x0;var _0x2e9866=_0xc361[_0x260dd2];return _0x2e9866;};'use strict';var _=require(_0x1c36('0x0'));var util=require(_0x1c36('0x1'));var logger=require(_0x1c36('0x2'))('api');var moment=require('moment');var BPromise=require(_0x1c36('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1c36('0x4'));var rimraf=require('rimraf');var config=require(_0x1c36('0x5'));var attributes=require(_0x1c36('0x6'));module[_0x1c36('0x7')]=function(_0xc765e6,_0x3d661e){return _0xc765e6[_0x1c36('0x8')](_0x1c36('0x9'),attributes,{'tableName':'tools_actions','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 c7a778e..bd67c26 100644 --- a/server/api/action/action.rpc.js +++ b/server/api/action/action.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xabce=['util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','client','then','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash'];(function(_0x30ec2d,_0x4b8a82){var _0xc29ed8=function(_0x2ef772){while(--_0x2ef772){_0x30ec2d['push'](_0x30ec2d['shift']());}};_0xc29ed8(++_0x4b8a82);}(_0xabce,0x103));var _0xeabc=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0xabce[_0x55e08b];return _0xd1a7ff;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var moment=require(_0xeabc('0x2'));var BPromise=require(_0xeabc('0x3'));var rs=require(_0xeabc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xeabc('0x5'));var logger=require(_0xeabc('0x6'))(_0xeabc('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xeabc('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x229ba4,_0x52ede8,_0x3bdc29){return new BPromise(function(_0x9417af,_0x8434c5){return client['request'](_0x229ba4,_0x3bdc29)[_0xeabc('0x9')](function(_0x341f16){logger[_0xeabc('0xa')](_0xeabc('0xb'),_0x52ede8,_0xeabc('0xc'));logger[_0xeabc('0xd')](_0xeabc('0xe'),_0x52ede8,_0xeabc('0xc'),JSON[_0xeabc('0xf')](_0x341f16));if(_0x341f16[_0xeabc('0x10')]){if(_0x341f16[_0xeabc('0x10')][_0xeabc('0x11')]===0x1f4){logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);return _0x8434c5(_0x341f16['error'][_0xeabc('0x12')]);}logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16['error']['message']);return _0x9417af(_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);}else{logger[_0xeabc('0xa')]('Action,\x20%s,\x20%s',_0x52ede8,_0xeabc('0xc'));_0x9417af(_0x341f16[_0xeabc('0x13')]['message']);}})['catch'](function(_0x10fa8e){logger['error'](_0xeabc('0xb'),_0x52ede8,_0x10fa8e);_0x8434c5(_0x10fa8e);});});} \ No newline at end of file +var _0x53ec=['error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','request','then','info','Action,\x20%s,\x20%s','request\x20sent','debug','stringify','code'];(function(_0x3305de,_0x16582f){var _0x3b5a84=function(_0x57d7e1){while(--_0x57d7e1){_0x3305de['push'](_0x3305de['shift']());}};_0x3b5a84(++_0x16582f);}(_0x53ec,0x192));var _0xc53e=function(_0x54b907,_0x29ff96){_0x54b907=_0x54b907-0x0;var _0x363d89=_0x53ec[_0x54b907];return _0x363d89;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var moment=require(_0xc53e('0x2'));var BPromise=require(_0xc53e('0x3'));var rs=require(_0xc53e('0x4'));var fs=require('fs');var Redis=require(_0xc53e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc53e('0x6'));var logger=require('../../config/logger')(_0xc53e('0x7'));var config=require(_0xc53e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc53e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41a9e8,_0x2de88b,_0x5d3b28){return new BPromise(function(_0x1616ac,_0x1ac6c0){return client[_0xc53e('0xa')](_0x41a9e8,_0x5d3b28)[_0xc53e('0xb')](function(_0xd9612){logger[_0xc53e('0xc')](_0xc53e('0xd'),_0x2de88b,_0xc53e('0xe'));logger[_0xc53e('0xf')]('Action,\x20%s,\x20%s,\x20%s',_0x2de88b,'request\x20sent',JSON[_0xc53e('0x10')](_0xd9612));if(_0xd9612['error']){if(_0xd9612['error'][_0xc53e('0x11')]===0x1f4){logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0xd9612[_0xc53e('0x12')]['message']);return _0x1ac6c0(_0xd9612['error'][_0xc53e('0x13')]);}logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0xd9612[_0xc53e('0x12')][_0xc53e('0x13')]);return _0x1616ac(_0xd9612[_0xc53e('0x12')][_0xc53e('0x13')]);}else{logger[_0xc53e('0xc')](_0xc53e('0xd'),_0x2de88b,_0xc53e('0xe'));_0x1616ac(_0xd9612['result'][_0xc53e('0x13')]);}})[_0xc53e('0x14')](function(_0x535cd4){logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0x535cd4);_0x1ac6c0(_0x535cd4);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index f6dadfc..6e37ae7 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 _0xd58b=['fs-extra','../../components/interaction/service','./action.controller','put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x2b90dc,_0x10b832){var _0x4794a6=function(_0x3720ca){while(--_0x3720ca){_0x2b90dc['push'](_0x2b90dc['shift']());}};_0x4794a6(++_0x10b832);}(_0xd58b,0x144));var _0xbd58=function(_0x344a3f,_0x579a22){_0x344a3f=_0x344a3f-0x0;var _0x264712=_0xd58b[_0x344a3f];return _0x264712;};'use strict';var multer=require(_0xbd58('0x0'));var util=require(_0xbd58('0x1'));var path=require(_0xbd58('0x2'));var timeout=require(_0xbd58('0x3'));var express=require(_0xbd58('0x4'));var router=express[_0xbd58('0x5')]();var fs_extra=require(_0xbd58('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xbd58('0x7'));var config=require('../../config/environment');var controller=require(_0xbd58('0x8'));router[_0xbd58('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xbd58('0xa')]);router[_0xbd58('0xb')](_0xbd58('0xc'),auth['isAuthenticated'](),controller[_0xbd58('0xd')]);module[_0xbd58('0xe')]=router; \ No newline at end of file +var _0xbf48=['../../config/environment','./action.controller','put','isAuthenticated','update','/:id','destroy','multer','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0xbf48,0x1e8));var _0x8bf4=function(_0x585a03,_0xba98b2){_0x585a03=_0x585a03-0x0;var _0x5d8f66=_0xbf48[_0x585a03];return _0x5d8f66;};'use strict';var multer=require(_0x8bf4('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x8bf4('0x1'));var express=require(_0x8bf4('0x2'));var router=express[_0x8bf4('0x3')]();var fs_extra=require(_0x8bf4('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x8bf4('0x5'));var config=require(_0x8bf4('0x6'));var controller=require(_0x8bf4('0x7'));router[_0x8bf4('0x8')]('/:id',auth[_0x8bf4('0x9')](),controller[_0x8bf4('0xa')]);router['delete'](_0x8bf4('0xb'),auth[_0x8bf4('0x9')](),controller[_0x8bf4('0xc')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 4d9370a..8f3bbfd 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 _0x814b=['STRING','TEXT','sequelize','exports'];(function(_0x3c5cc8,_0x336027){var _0x44675c=function(_0xf9543e){while(--_0xf9543e){_0x3c5cc8['push'](_0x3c5cc8['shift']());}};_0x44675c(++_0x336027);}(_0x814b,0x1a2));var _0xb814=function(_0x525af9,_0x4edd23){_0x525af9=_0x525af9-0x0;var _0x129fbf=_0x814b[_0x525af9];return _0x129fbf;};'use strict';var Sequelize=require(_0xb814('0x0'));module[_0xb814('0x1')]={'name':{'type':Sequelize[_0xb814('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xb814('0x2')]},'parent':{'type':Sequelize[_0xb814('0x2')]},'table':{'type':Sequelize[_0xb814('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xb814('0x3')]}}; \ No newline at end of file +var _0xbd51=['sequelize','STRING'];(function(_0x22656e,_0x1163dc){var _0x3e4255=function(_0x200a38){while(--_0x200a38){_0x22656e['push'](_0x22656e['shift']());}};_0x3e4255(++_0x1163dc);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x1883e3,_0x410049){_0x1883e3=_0x1883e3-0x0;var _0x59b980=_0xbd51[_0x1883e3];return _0x59b980;};'use strict';var Sequelize=require(_0x1bd5('0x0'));module['exports']={'name':{'type':Sequelize[_0x1bd5('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x1bd5('0x1')]},'parent':{'type':Sequelize[_0x1bd5('0x1')]},'table':{'type':Sequelize[_0x1bd5('0x1')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 9d2d4d2..cb54cfe 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 _0xb3a3=['../../mysqldb','dbH','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','CustomReports','UserProfileResource','destroy','sendStatus','error','name','send','index','map','AnalyticCustomReport','rawAttributes','type','key','keys','intersection','model','query','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filters','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','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)','SEC_TO_TIME(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','format','replace','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','toString','sequelize','SELECT','join','COUNT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','getFields','Sequelize','groupBy','includes','output','web','%s-%s.%s','randomstring','generate','csv','custom','cdr','startDate','info','child_process','fork','../../components/export/','../../files/reports','countTable','COUNT(*)','count','QueryTypes','run','runReport','ROUND(%s)','IS\x20NULL','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','ejs','fs-extra','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'];(function(_0x61a318,_0x2c4216){var _0x1ba549=function(_0x2329f0){while(--_0x2329f0){_0x61a318['push'](_0x61a318['shift']());}};_0x1ba549(++_0x2c4216);}(_0xb3a3,0x90));var _0x3b3a=function(_0x2dee3b,_0x2e6193){_0x2dee3b=_0x2dee3b-0x0;var _0x13fd41=_0xb3a3[_0x2dee3b];return _0x13fd41;};'use strict';var emlformat=require(_0x3b3a('0x0'));var rimraf=require(_0x3b3a('0x1'));var zipdir=require(_0x3b3a('0x2'));var jsonpatch=require(_0x3b3a('0x3'));var rp=require('request-promise');var moment=require(_0x3b3a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3b3a('0x5'));var util=require(_0x3b3a('0x6'));var path=require(_0x3b3a('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3b3a('0x8'));var fs=require('fs');var fs_extra=require(_0x3b3a('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x3b3a('0xa'));var jsforce=require(_0x3b3a('0xb'));var deskjs=require(_0x3b3a('0xc'));var toCsv=require('to-csv');var querystring=require(_0x3b3a('0xd'));var Papa=require(_0x3b3a('0xe'));var Redis=require(_0x3b3a('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x3b3a('0x10'));var as=require(_0x3b3a('0x11'));var hardwareService=require(_0x3b3a('0x12'));var logger=require(_0x3b3a('0x13'))(_0x3b3a('0x14'));var utils=require(_0x3b3a('0x15'));var config=require(_0x3b3a('0x16'));var licenseUtil=require(_0x3b3a('0x17'));var db=require(_0x3b3a('0x18'))['db'];var dbH=require(_0x3b3a('0x18'))[_0x3b3a('0x19')];function respondWithStatusCode(_0x2f9c00,_0x1832b3){_0x1832b3=_0x1832b3||0xcc;return function(_0x12b432){if(_0x12b432){return _0x2f9c00['sendStatus'](_0x1832b3);}return _0x2f9c00[_0x3b3a('0x1a')](_0x1832b3)[_0x3b3a('0x1b')]();};}function respondWithResult(_0x341301,_0x3ceee8){_0x3ceee8=_0x3ceee8||0xc8;return function(_0x3fc2ce){if(_0x3fc2ce){return _0x341301[_0x3b3a('0x1a')](_0x3ceee8)[_0x3b3a('0x1c')](_0x3fc2ce);}};}function respondWithFilteredResult(_0x16c062,_0x5e4dee){return function(_0x3dbafd){if(_0x3dbafd){var _0x3c818c=typeof _0x5e4dee[_0x3b3a('0x1d')]===_0x3b3a('0x1e')&&typeof _0x5e4dee[_0x3b3a('0x1f')]==='undefined';var _0x468ae5=_0x3dbafd['count'];var _0x6e98b2=_0x3c818c?0x0:_0x5e4dee[_0x3b3a('0x1d')];var _0x33a4ff=_0x3c818c?_0x3dbafd['count']:_0x5e4dee[_0x3b3a('0x1d')]+_0x5e4dee['limit'];var _0x53b591;if(_0x33a4ff>=_0x468ae5){_0x33a4ff=_0x468ae5;_0x53b591=0xc8;}else{_0x53b591=0xce;}_0x16c062[_0x3b3a('0x1a')](_0x53b591);return _0x16c062[_0x3b3a('0x20')](_0x3b3a('0x21'),_0x6e98b2+'-'+_0x33a4ff+'/'+_0x468ae5)['json'](_0x3dbafd);}return null;};}function patchUpdates(_0x3f5988){return function(_0x5e3d43){try{jsonpatch[_0x3b3a('0x22')](_0x5e3d43,_0x3f5988,!![]);}catch(_0x577357){return BPromise[_0x3b3a('0x23')](_0x577357);}return _0x5e3d43[_0x3b3a('0x24')]();};}function saveUpdates(_0x142bd5,_0x5f2f14){return function(_0xa820dd){if(_0xa820dd){return _0xa820dd[_0x3b3a('0x25')](_0x142bd5)[_0x3b3a('0x26')](function(_0x3657a8){return _0x3657a8;});}return null;};}function removeEntity(_0x142326,_0x4d809e){return function(_0x47e99b){if(_0x47e99b){return _0x47e99b['destroy']()[_0x3b3a('0x26')](function(){var _0x1d1760=_0x47e99b['get']({'plain':!![]});var _0x2739a5=_0x3b3a('0x27');return db[_0x3b3a('0x28')][_0x3b3a('0x29')]({'where':{'type':_0x2739a5,'resourceId':_0x1d1760['id']}})[_0x3b3a('0x26')](function(){return _0x47e99b;});})[_0x3b3a('0x26')](function(){_0x142326[_0x3b3a('0x1a')](0xcc)[_0x3b3a('0x1b')]();});}};}function handleEntityNotFound(_0x1c4ee0,_0x36a983){return function(_0x561e38){if(!_0x561e38){_0x1c4ee0[_0x3b3a('0x2a')](0x194);}return _0x561e38;};}function handleError(_0x22a96b,_0x5e2cdc){_0x5e2cdc=_0x5e2cdc||0x1f4;return function(_0x4b5375){logger[_0x3b3a('0x2b')](_0x4b5375['stack']);if(_0x4b5375[_0x3b3a('0x2c')]){delete _0x4b5375[_0x3b3a('0x2c')];}_0x22a96b['status'](_0x5e2cdc)[_0x3b3a('0x2d')](_0x4b5375);};}exports[_0x3b3a('0x2e')]=function(_0x2a6799,_0x5d2aee){var _0x1ea597={},_0xbfc1cc={},_0x16d70a={'count':0x0,'rows':[]};var _0x1d639c=_[_0x3b3a('0x2f')](db[_0x3b3a('0x30')][_0x3b3a('0x31')],function(_0x442313){return{'name':_0x442313['fieldName'],'type':_0x442313[_0x3b3a('0x32')][_0x3b3a('0x33')]};});_0xbfc1cc['model']=_[_0x3b3a('0x2f')](_0x1d639c,_0x3b3a('0x2c'));_0xbfc1cc['query']=_[_0x3b3a('0x34')](_0x2a6799['query']);_0xbfc1cc['filters']=_[_0x3b3a('0x35')](_0xbfc1cc[_0x3b3a('0x36')],_0xbfc1cc[_0x3b3a('0x37')]);_0x1ea597[_0x3b3a('0x38')]=_['intersection'](_0xbfc1cc[_0x3b3a('0x36')],qs[_0x3b3a('0x39')](_0x2a6799['query']['fields']));_0x1ea597[_0x3b3a('0x38')]=_0x1ea597[_0x3b3a('0x38')][_0x3b3a('0x3a')]?_0x1ea597[_0x3b3a('0x38')]:_0xbfc1cc[_0x3b3a('0x36')];if(!_0x2a6799[_0x3b3a('0x37')][_0x3b3a('0x3b')]('nolimit')){_0x1ea597['limit']=qs[_0x3b3a('0x1f')](_0x2a6799['query'][_0x3b3a('0x1f')]);_0x1ea597[_0x3b3a('0x1d')]=qs['offset'](_0x2a6799['query'][_0x3b3a('0x1d')]);}_0x1ea597[_0x3b3a('0x3c')]=qs[_0x3b3a('0x3d')](_0x2a6799['query'][_0x3b3a('0x3d')]);_0x1ea597[_0x3b3a('0x3e')]=qs['filters'](_[_0x3b3a('0x3f')](_0x2a6799[_0x3b3a('0x37')],_0xbfc1cc[_0x3b3a('0x40')]),_0x1d639c);if(_0x2a6799[_0x3b3a('0x37')][_0x3b3a('0x41')]){_0x1ea597[_0x3b3a('0x3e')]=_[_0x3b3a('0x42')](_0x1ea597[_0x3b3a('0x3e')],{'$or':_[_0x3b3a('0x2f')](_0x1d639c,function(_0x3e32f0){if(_0x3e32f0[_0x3b3a('0x32')]!==_0x3b3a('0x43')){var _0x5d4e14={};_0x5d4e14[_0x3e32f0['name']]={'$like':'%'+_0x2a6799['query'][_0x3b3a('0x41')]+'%'};return _0x5d4e14;}})});}_0x1ea597=_[_0x3b3a('0x42')]({},_0x1ea597,_0x2a6799['options']);var _0x5f35d2={'where':_0x1ea597['where']};return db[_0x3b3a('0x30')]['count'](_0x5f35d2)['then'](function(_0x4e4c92){_0x16d70a['count']=_0x4e4c92;if(_0x2a6799[_0x3b3a('0x37')][_0x3b3a('0x44')]){_0x1ea597[_0x3b3a('0x45')]=[{'all':!![]}];}return db[_0x3b3a('0x30')]['findAll'](_0x1ea597);})['then'](function(_0x2af71c){_0x16d70a[_0x3b3a('0x46')]=_0x2af71c;return _0x16d70a;})[_0x3b3a('0x26')](respondWithFilteredResult(_0x5d2aee,_0x1ea597))[_0x3b3a('0x47')](handleError(_0x5d2aee,null));};exports[_0x3b3a('0x48')]=function(_0x18ff71,_0x1c962f){var _0x574d3c={'raw':![],'where':{'id':_0x18ff71['params']['id']}},_0x12f67e={};_0x12f67e['model']=_['keys'](db['AnalyticCustomReport']['rawAttributes']);_0x12f67e['query']=_[_0x3b3a('0x34')](_0x18ff71[_0x3b3a('0x37')]);_0x12f67e['filters']=_[_0x3b3a('0x35')](_0x12f67e[_0x3b3a('0x36')],_0x12f67e[_0x3b3a('0x37')]);_0x574d3c[_0x3b3a('0x38')]=_[_0x3b3a('0x35')](_0x12f67e[_0x3b3a('0x36')],qs[_0x3b3a('0x39')](_0x18ff71[_0x3b3a('0x37')]['fields']));_0x574d3c[_0x3b3a('0x38')]=_0x574d3c['attributes']['length']?_0x574d3c['attributes']:_0x12f67e[_0x3b3a('0x36')];if(_0x18ff71[_0x3b3a('0x37')]['includeAll']){_0x574d3c[_0x3b3a('0x45')]=[{'all':!![]}];}_0x574d3c=_[_0x3b3a('0x42')]({},_0x574d3c,_0x18ff71[_0x3b3a('0x49')]);return db[_0x3b3a('0x30')][_0x3b3a('0x4a')](_0x574d3c)[_0x3b3a('0x26')](handleEntityNotFound(_0x1c962f,null))[_0x3b3a('0x26')](respondWithResult(_0x1c962f,null))[_0x3b3a('0x47')](handleError(_0x1c962f,null));};exports[_0x3b3a('0x4b')]=function(_0x3492c0,_0x4dde4){return db['AnalyticCustomReport'][_0x3b3a('0x4b')](_0x3492c0[_0x3b3a('0x4c')],{})['then'](function(_0x16e1cd){var _0x25e0c0=_0x3492c0[_0x3b3a('0x4d')][_0x3b3a('0x4e')]({'plain':!![]});if(!_0x25e0c0)throw new Error(_0x3b3a('0x4f'));if(_0x25e0c0[_0x3b3a('0x50')]===_0x3b3a('0x4d')){var _0x36af6e=_0x16e1cd[_0x3b3a('0x4e')]({'plain':!![]});var _0x1e2bce=_0x3b3a('0x51');return db[_0x3b3a('0x52')][_0x3b3a('0x4a')]({'where':{'name':_0x1e2bce,'userProfileId':_0x25e0c0[_0x3b3a('0x53')]},'raw':!![]})[_0x3b3a('0x26')](function(_0x229a33){if(_0x229a33&&_0x229a33[_0x3b3a('0x54')]===0x0){return db['UserProfileResource']['create']({'name':_0x36af6e[_0x3b3a('0x2c')],'resourceId':_0x36af6e['id'],'type':_0x3b3a('0x27'),'sectionId':_0x229a33['id']},{})[_0x3b3a('0x26')](function(){return _0x16e1cd;});}else{return _0x16e1cd;}})[_0x3b3a('0x47')](function(_0x481c97){logger[_0x3b3a('0x2b')](_0x3b3a('0x55'),_0x481c97);throw _0x481c97;});}return _0x16e1cd;})[_0x3b3a('0x26')](respondWithResult(_0x4dde4,0xc9))[_0x3b3a('0x47')](handleError(_0x4dde4,null));};exports[_0x3b3a('0x25')]=function(_0x44e440,_0x4a0533){if(_0x44e440[_0x3b3a('0x4c')]['id']){delete _0x44e440['body']['id'];}return db[_0x3b3a('0x30')][_0x3b3a('0x4a')]({'where':{'id':_0x44e440['params']['id']}})[_0x3b3a('0x26')](handleEntityNotFound(_0x4a0533,null))[_0x3b3a('0x26')](saveUpdates(_0x44e440[_0x3b3a('0x4c')],null))[_0x3b3a('0x26')](respondWithResult(_0x4a0533,null))[_0x3b3a('0x47')](handleError(_0x4a0533,null));};exports[_0x3b3a('0x29')]=function(_0x46e8a9,_0x730600){return db['AnalyticCustomReport'][_0x3b3a('0x4a')]({'where':{'id':_0x46e8a9[_0x3b3a('0x56')]['id']}})[_0x3b3a('0x26')](handleEntityNotFound(_0x730600,null))['then'](removeEntity(_0x730600,null))[_0x3b3a('0x47')](handleError(_0x730600,null));};exports[_0x3b3a('0x57')]=function(_0x334dd0,_0x3100d3){var _0x236d5a=0xa;var _0x5ae89a=['join',_0x3b3a('0x58'),_0x3b3a('0x59'),_0x3b3a('0x5a')];var _0x240388={'SUM':_0x3b3a('0x5b'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x3b3a('0x5c'),'MAX':_0x3b3a('0x5d'),'MIN':_0x3b3a('0x5e'),'AVG':_0x3b3a('0x5f'),'GROUP_CONCAT':_0x3b3a('0x60'),'GROUP_CONCAT ASC':_0x3b3a('0x61'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0xd5615d={'SEC_TO_TIME':_0x3b3a('0x62'),'DATE':'DATE(%s)','HOUR':_0x3b3a('0x63'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x3b3a('0x64')};var _0x4fa402=function(_0x13990c){return!_['includes'](['IS\x20NULL',_0x3b3a('0x65'),_0x3b3a('0x66'),_0x3b3a('0x67')],_0x13990c);};var _0x1f6d89=function(_0x1a16e8){if(!_0x1a16e8||!_0x1a16e8['rules'][_0x3b3a('0x3a')]){return'';}for(var _0x3391e1='(',_0x1c04f5=0x0;_0x1c04f5<_0x1a16e8[_0x3b3a('0x68')][_0x3b3a('0x3a')];_0x1c04f5+=0x1){_0x1c04f5>0x0&&(_0x3391e1+='\x20'+_0x1a16e8[_0x3b3a('0x69')]+'\x20');_0x3391e1+=_0x1a16e8['rules'][_0x1c04f5][_0x3b3a('0x6a')]?_0x1f6d89(_0x1a16e8[_0x3b3a('0x68')][_0x1c04f5][_0x3b3a('0x6a')]):_0x1a16e8[_0x3b3a('0x68')][_0x1c04f5][_0x3b3a('0x6b')]+'\x20'+_0x1a16e8[_0x3b3a('0x68')][_0x1c04f5][_0x3b3a('0x6c')]+(_0x4fa402(_0x1a16e8[_0x3b3a('0x68')][_0x1c04f5]['condition'])?'\x20'+_0x1a16e8[_0x3b3a('0x68')][_0x1c04f5][_0x3b3a('0x6d')]:'');}return _0x3391e1+')';};var _0x2be713={'where':{'id':_0x334dd0[_0x3b3a('0x56')]['id']}},_0x454611,_0x4dc428,_0x47b8e5,_0x2185ac,_0x2392b0;_0x2be713=_[_0x3b3a('0x42')]({},_0x2be713,_0x334dd0[_0x3b3a('0x49')]);return db['AnalyticCustomReport'][_0x3b3a('0x4a')](_0x2be713)['then'](function(_0x2d99ce){if(_0x2d99ce){_0x454611=_0x2d99ce;return _0x2d99ce['getFields']();}return null;})['then'](function(_0x36b2e2){if(_0x36b2e2){if(!_0x36b2e2[_0x3b3a('0x3a')]){throw new db['Sequelize'][(_0x3b3a('0x6e'))](_0x3b3a('0x6f'),0x193);}_0x4dc428=_0x36b2e2;return db[_0x3b3a('0x70')]['findAll']({'raw':!![]});}return null;})[_0x3b3a('0x26')](function(_0x2aa671){if(_0x2aa671){_0x47b8e5=_[_0x3b3a('0x71')](_0x2aa671,'id');var _0x17c5f0;var _0xe235e1=squel[_0x3b3a('0x72')]();_0xe235e1[_0x3b3a('0x73')](_0x454611[_0x3b3a('0x74')]);for(var _0x9b9b81=0x0;_0x9b9b81<_0x4dc428[_0x3b3a('0x3a')];_0x9b9b81+=0x1){_0x17c5f0=_0x4dc428[_0x9b9b81][_0x3b3a('0x75')]?_0x47b8e5[_0x4dc428[_0x9b9b81][_0x3b3a('0x75')]][_0x3b3a('0x76')]:_0x4dc428[_0x9b9b81][_0x3b3a('0x6b')];_0x17c5f0=_0x4dc428[_0x9b9b81]['function']?_['replace'](_0x240388[_0x4dc428[_0x9b9b81][_0x3b3a('0x77')]],'%s',_0x17c5f0):_0x17c5f0;_0x17c5f0=_0x4dc428[_0x9b9b81][_0x3b3a('0x78')]?_[_0x3b3a('0x79')](_0xd5615d[_0x4dc428[_0x9b9b81][_0x3b3a('0x78')]],'%s',_0x17c5f0):_0x17c5f0;if(_0x4dc428[_0x9b9b81]['groupBy']){_0xe235e1[_0x3b3a('0x6a')](_0x17c5f0);}_0x4dc428[_0x9b9b81]['orderBy']&&_0xe235e1[_0x3b3a('0x3c')](_0x17c5f0,_0x4dc428[_0x9b9b81][_0x3b3a('0x7a')]===_0x3b3a('0x7b')?![]:!![]);_0xe235e1[_0x3b3a('0x6b')](_0x17c5f0,_0x4dc428[_0x9b9b81][_0x3b3a('0x7c')]||_0x17c5f0);}if(_0x454611[_0x3b3a('0x7d')]){_0x454611[_0x3b3a('0x7d')]=JSON[_0x3b3a('0x7e')](_0x454611[_0x3b3a('0x7d')]);for(var _0xfa89de=0x0;_0xfa89de<_0x454611['joins'][_0x3b3a('0x3a')];_0xfa89de+=0x1){if(_0x454611[_0x3b3a('0x7d')][_0xfa89de][_0x3b3a('0x32')]&&_['includes'](_0x5ae89a,_0x454611['joins'][_0xfa89de][_0x3b3a('0x32')])&&_0x454611[_0x3b3a('0x7d')][_0xfa89de][_0x3b3a('0x7f')]&&_0x454611[_0x3b3a('0x7d')][_0xfa89de][_0x3b3a('0x80')]&&_0x454611['joins'][_0xfa89de][_0x3b3a('0x81')]){_0xe235e1[_0x454611[_0x3b3a('0x7d')][_0xfa89de][_0x3b3a('0x32')]](_0x454611[_0x3b3a('0x7d')][_0xfa89de][_0x3b3a('0x80')],null,util[_0x3b3a('0x78')](_0x3b3a('0x82'),_0x454611[_0x3b3a('0x74')],_0x454611[_0x3b3a('0x7d')][_0xfa89de]['parentKey'],_0x454611['joins'][_0xfa89de]['foreignTable'],_0x454611[_0x3b3a('0x7d')][_0xfa89de][_0x3b3a('0x81')]));}}}if(_0x454611[_0x3b3a('0x83')]){_0x454611[_0x3b3a('0x83')]=JSON[_0x3b3a('0x7e')](_0x454611[_0x3b3a('0x83')]);_0xe235e1['where'](_0x1f6d89(_0x454611['conditions'][_0x3b3a('0x6a')]));}_0x2392b0=_0xe235e1[_0x3b3a('0x84')]();_0xe235e1['limit'](_0x236d5a);_0xe235e1[_0x3b3a('0x1d')](0x0);logger[_0x3b3a('0x85')](_0x3b3a('0x86'),_0xe235e1[_0x3b3a('0x87')]());return dbH[_0x3b3a('0x88')][_0x3b3a('0x37')](_0xe235e1[_0x3b3a('0x87')](),{'type':dbH[_0x3b3a('0x88')]['QueryTypes'][_0x3b3a('0x89')]});}})[_0x3b3a('0x26')](respondWithResult(_0x3100d3,null))[_0x3b3a('0x47')](handleError(_0x3100d3,null));};function runReport(_0xa0f7,_0x253bdb,_0x24a03e){var _0x216b96=_0x253bdb['name'];var _0x10c6f7=0xa;var _0xf90379=[_0x3b3a('0x8a'),'left_join','right_join',_0x3b3a('0x5a')];var _0x29ef03={'SUM':_0x3b3a('0x5b'),'COUNT':_0x3b3a('0x8b'),'COUNT DISTINCT':_0x3b3a('0x5c'),'MAX':_0x3b3a('0x5d'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x3b3a('0x60'),'GROUP_CONCAT ASC':_0x3b3a('0x61'),'GROUP_CONCAT DESC':_0x3b3a('0x8c')};var _0x11712b={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x3b3a('0x8d'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x3b3a('0x64')};var _0x43c94f=function(_0x1c038b){return!_['includes'](['IS\x20NULL',_0x3b3a('0x65'),_0x3b3a('0x66'),_0x3b3a('0x67')],_0x1c038b);};var _0x546449=function(_0x1fecef){if(!_0x1fecef||!_0x1fecef[_0x3b3a('0x68')][_0x3b3a('0x3a')]){return'';}for(var _0xcc519d='(',_0x18d578=0x0;_0x18d578<_0x1fecef['rules'][_0x3b3a('0x3a')];_0x18d578+=0x1){_0x18d578>0x0&&(_0xcc519d+='\x20'+_0x1fecef[_0x3b3a('0x69')]+'\x20');_0xcc519d+=_0x1fecef[_0x3b3a('0x68')][_0x18d578][_0x3b3a('0x6a')]?_0x546449(_0x1fecef[_0x3b3a('0x68')][_0x18d578][_0x3b3a('0x6a')]):_0x1fecef['rules'][_0x18d578][_0x3b3a('0x6b')]+'\x20'+_0x1fecef[_0x3b3a('0x68')][_0x18d578]['condition']+(_0x43c94f(_0x1fecef[_0x3b3a('0x68')][_0x18d578]['condition'])?'\x20'+_0x1fecef[_0x3b3a('0x68')][_0x18d578]['value']:'');}return _0xcc519d+')';};var _0x15cb32={'where':{'id':_0xa0f7['id']}},_0x5c0974,_0x114a7d,_0x3a41f0,_0x23a26b,_0x5e8ebd;_0x15cb32=_[_0x3b3a('0x42')]({},_0x15cb32,_0x24a03e);return db[_0x3b3a('0x30')][_0x3b3a('0x4a')](_0x15cb32)[_0x3b3a('0x26')](function(_0x482a33){if(_0x482a33){_0x5c0974=_0x482a33;return _0x482a33[_0x3b3a('0x8e')]();}return null;})[_0x3b3a('0x26')](function(_0x2b1045){if(_0x2b1045){if(!_0x2b1045['length']){throw new db[(_0x3b3a('0x8f'))][(_0x3b3a('0x6e'))](_0x3b3a('0x6f'),0x193);}_0x114a7d=_0x2b1045;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0x3b3a('0x26')](function(_0x480cb8){if(_0x480cb8){_0x3a41f0=_[_0x3b3a('0x71')](_0x480cb8,'id');var _0x3e02d5;var _0x126751=squel[_0x3b3a('0x72')]();_0x126751[_0x3b3a('0x73')](_0x5c0974[_0x3b3a('0x74')]);for(var _0x51bf8b=0x0;_0x51bf8b<_0x114a7d[_0x3b3a('0x3a')];_0x51bf8b+=0x1){_0x3e02d5=_0x114a7d[_0x51bf8b][_0x3b3a('0x75')]?_0x3a41f0[_0x114a7d[_0x51bf8b][_0x3b3a('0x75')]]['metric']:_0x114a7d[_0x51bf8b][_0x3b3a('0x6b')];_0x3e02d5=_0x114a7d[_0x51bf8b][_0x3b3a('0x77')]?_['replace'](_0x29ef03[_0x114a7d[_0x51bf8b][_0x3b3a('0x77')]],'%s',_0x3e02d5):_0x3e02d5;_0x3e02d5=_0x114a7d[_0x51bf8b][_0x3b3a('0x78')]?_[_0x3b3a('0x79')](_0x11712b[_0x114a7d[_0x51bf8b][_0x3b3a('0x78')]],'%s',_0x3e02d5):_0x3e02d5;if(_0x114a7d[_0x51bf8b][_0x3b3a('0x90')]){_0x126751[_0x3b3a('0x6a')](_0x3e02d5);}_0x114a7d[_0x51bf8b]['orderBy']&&_0x126751[_0x3b3a('0x3c')](_0x3e02d5,_0x114a7d[_0x51bf8b]['orderBy']===_0x3b3a('0x7b')?![]:!![]);_0x126751['field'](_0x3e02d5,_0x114a7d[_0x51bf8b][_0x3b3a('0x7c')]||_0x3e02d5);}if(_0x5c0974[_0x3b3a('0x7d')]){_0x5c0974[_0x3b3a('0x7d')]=JSON[_0x3b3a('0x7e')](_0x5c0974[_0x3b3a('0x7d')]);for(var _0x2d59b7=0x0;_0x2d59b7<_0x5c0974[_0x3b3a('0x7d')]['length'];_0x2d59b7+=0x1){if(_0x5c0974[_0x3b3a('0x7d')][_0x2d59b7][_0x3b3a('0x32')]&&_[_0x3b3a('0x91')](_0xf90379,_0x5c0974[_0x3b3a('0x7d')][_0x2d59b7][_0x3b3a('0x32')])&&_0x5c0974[_0x3b3a('0x7d')][_0x2d59b7][_0x3b3a('0x7f')]&&_0x5c0974['joins'][_0x2d59b7][_0x3b3a('0x80')]&&_0x5c0974[_0x3b3a('0x7d')][_0x2d59b7][_0x3b3a('0x81')]){_0x126751[_0x5c0974['joins'][_0x2d59b7][_0x3b3a('0x32')]](_0x5c0974[_0x3b3a('0x7d')][_0x2d59b7][_0x3b3a('0x80')],null,util[_0x3b3a('0x78')](_0x3b3a('0x82'),_0x5c0974['table'],_0x5c0974['joins'][_0x2d59b7][_0x3b3a('0x7f')],_0x5c0974[_0x3b3a('0x7d')][_0x2d59b7][_0x3b3a('0x80')],_0x5c0974[_0x3b3a('0x7d')][_0x2d59b7][_0x3b3a('0x81')]));}}}if(_0x5c0974[_0x3b3a('0x83')]){_0x5c0974[_0x3b3a('0x83')]=JSON[_0x3b3a('0x7e')](_0x5c0974[_0x3b3a('0x83')]);_0x126751[_0x3b3a('0x3e')](_0x546449(_0x5c0974[_0x3b3a('0x83')][_0x3b3a('0x6a')]));}_0x5e8ebd=_0x126751['clone']();_0x126751[_0x3b3a('0x1f')](_0x10c6f7);_0x126751[_0x3b3a('0x1d')](0x0);return;}})[_0x3b3a('0x26')](function(){if(_0x253bdb[_0x3b3a('0x92')]===_0x3b3a('0x93')){return null;}var _0x5bb037=_[_0x3b3a('0x42')](_0x253bdb,{'name':_0x253bdb['fullPath']||_0x253bdb[_0x3b3a('0x2c')]||_0x5c0974[_0x3b3a('0x2c')],'basename':_0x216b96,'savename':util[_0x3b3a('0x78')](_0x3b3a('0x94'),_0x253bdb[_0x3b3a('0x2c')]||_0x5c0974[_0x3b3a('0x2c')],require(_0x3b3a('0x95'))[_0x3b3a('0x96')](0x4),_0x253bdb['output']||_0x3b3a('0x97')),'reportId':_0x5c0974['id'],'reportType':_0x3b3a('0x98')});return db['AnalyticExtractedReport'][_0x3b3a('0x4b')](_0x5bb037,{'raw':!![]});})[_0x3b3a('0x26')](function(_0x4274f8){if(_0x5c0974['table']===_0x3b3a('0x99')){_0x5e8ebd[_0x3b3a('0x3e')](_0x5c0974[_0x3b3a('0x74')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x253bdb['startDate'],_0x253bdb['endDate']);}else{_0x5e8ebd[_0x3b3a('0x3e')](_0x5c0974[_0x3b3a('0x74')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x253bdb[_0x3b3a('0x9a')],_0x253bdb['endDate']);}if(_0x4274f8){logger[_0x3b3a('0x9b')]('Run\x20Query:',_0x5e8ebd[_0x3b3a('0x87')]());require(_0x3b3a('0x9c'))[_0x3b3a('0x9d')](path[_0x3b3a('0x8a')](__dirname,_0x3b3a('0x9e'),_0x4274f8[_0x3b3a('0x92')]),[_0x4274f8['id'],_0x5e8ebd['toString'](),path[_0x3b3a('0x8a')](__dirname,_0x3b3a('0x9f'),_0x4274f8['savename']),_0x216b96]);return _0x4274f8;}else{var _0x11fec5=squel[_0x3b3a('0x72')]();_0x11fec5[_0x3b3a('0x73')]('('+_0x5e8ebd[_0x3b3a('0x87')]()+')',_0x3b3a('0xa0'));_0x11fec5[_0x3b3a('0x6b')](_0x3b3a('0xa1'),_0x3b3a('0xa2'));_0x5e8ebd['limit'](_0x253bdb[_0x3b3a('0x1f')]||_0x10c6f7);_0x5e8ebd[_0x3b3a('0x1d')](_0x253bdb[_0x3b3a('0x1d')]||0x0);return dbH[_0x3b3a('0x88')][_0x3b3a('0x37')](_0x11fec5[_0x3b3a('0x87')](),{'type':dbH[_0x3b3a('0x88')][_0x3b3a('0xa3')][_0x3b3a('0x89')]})['then'](function(_0x4bfb03){if(!_0x4bfb03[_0x3b3a('0x3a')]){_0x23a26b=0x0;}else{_0x23a26b=_0x4bfb03[0x0][_0x3b3a('0xa2')]||0x0;}return dbH[_0x3b3a('0x88')][_0x3b3a('0x37')](_0x5e8ebd['toString'](),{'type':dbH[_0x3b3a('0x88')][_0x3b3a('0xa3')][_0x3b3a('0x89')]});})['then'](function(_0x1b6391){return{'rows':_0x1b6391||[],'count':_0x23a26b};});}});}exports[_0x3b3a('0xa4')]=function(_0x12541c,_0x58a147){return runReport(_0x12541c[_0x3b3a('0x56')],_0x12541c[_0x3b3a('0x37')],_0x12541c[_0x3b3a('0x49')])[_0x3b3a('0x26')](respondWithResult(_0x58a147,null))[_0x3b3a('0x47')](handleError(_0x58a147,null));};exports[_0x3b3a('0xa5')]=runReport;exports['query']=function(_0x9d69d9,_0x4296ed){var _0x452f8a=0xa;var _0x357b77=[_0x3b3a('0x8a'),_0x3b3a('0x58'),'right_join',_0x3b3a('0x5a')];var _0x25d8fe={'SUM':'SUM(%s)','COUNT':_0x3b3a('0x8b'),'COUNT DISTINCT':_0x3b3a('0x5c'),'MAX':'MAX(%s)','MIN':_0x3b3a('0x5e'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x3b3a('0x60'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x3b3a('0x8c')};var _0x5c7f60={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0x3b3a('0x63'),'ROUND':_0x3b3a('0xa6'),'UNIX_TIMESTAMP':_0x3b3a('0x64')};var _0x42ecf6=function(_0x4df31d){return!_[_0x3b3a('0x91')]([_0x3b3a('0xa7'),'IS\x20NOT\x20NULL',_0x3b3a('0x66'),'IS\x20NOT\x20EMPTY'],_0x4df31d);};var _0x3f8781=function(_0x56ab0d){if(!_0x56ab0d||!_0x56ab0d['rules'][_0x3b3a('0x3a')]){return'';}for(var _0x2583d1='(',_0x6dbd56=0x0;_0x6dbd56<_0x56ab0d[_0x3b3a('0x68')][_0x3b3a('0x3a')];_0x6dbd56+=0x1){_0x6dbd56>0x0&&(_0x2583d1+='\x20'+_0x56ab0d[_0x3b3a('0x69')]+'\x20');_0x2583d1+=_0x56ab0d[_0x3b3a('0x68')][_0x6dbd56][_0x3b3a('0x6a')]?_0x3f8781(_0x56ab0d[_0x3b3a('0x68')][_0x6dbd56][_0x3b3a('0x6a')]):_0x56ab0d[_0x3b3a('0x68')][_0x6dbd56]['field']+'\x20'+_0x56ab0d['rules'][_0x6dbd56][_0x3b3a('0x6c')]+(_0x42ecf6(_0x56ab0d['rules'][_0x6dbd56]['condition'])?'\x20'+_0x56ab0d['rules'][_0x6dbd56][_0x3b3a('0x6d')]:'');}return _0x2583d1+')';};var _0x100171={'where':{'id':_0x9d69d9[_0x3b3a('0x56')]['id']}},_0x52b5a0,_0x577cbc,_0x4fbd0c,_0x5234a0,_0x18e75e;_0x100171=_[_0x3b3a('0x42')]({},_0x100171,_0x9d69d9[_0x3b3a('0x49')]);return db[_0x3b3a('0x30')][_0x3b3a('0x4a')](_0x100171)[_0x3b3a('0x26')](function(_0x4ddd96){if(_0x4ddd96){_0x52b5a0=_0x4ddd96;return _0x4ddd96[_0x3b3a('0x8e')]();}return null;})[_0x3b3a('0x26')](function(_0xa3e995){if(_0xa3e995){if(!_0xa3e995[_0x3b3a('0x3a')]){throw new db['Sequelize'][(_0x3b3a('0x6e'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x577cbc=_0xa3e995;return db[_0x3b3a('0x70')]['findAll']({'raw':!![]});}return null;})[_0x3b3a('0x26')](function(_0x9fe53){if(_0x9fe53){_0x4fbd0c=_[_0x3b3a('0x71')](_0x9fe53,'id');var _0x52f1c1;var _0x23118a=squel[_0x3b3a('0x72')]();_0x23118a['from'](_0x52b5a0[_0x3b3a('0x74')]);for(var _0x27e4b9=0x0;_0x27e4b9<_0x577cbc[_0x3b3a('0x3a')];_0x27e4b9+=0x1){_0x52f1c1=_0x577cbc[_0x27e4b9][_0x3b3a('0x75')]?_0x4fbd0c[_0x577cbc[_0x27e4b9]['MetricId']][_0x3b3a('0x76')]:_0x577cbc[_0x27e4b9]['field'];_0x52f1c1=_0x577cbc[_0x27e4b9][_0x3b3a('0x77')]?_['replace'](_0x25d8fe[_0x577cbc[_0x27e4b9][_0x3b3a('0x77')]],'%s',_0x52f1c1):_0x52f1c1;_0x52f1c1=_0x577cbc[_0x27e4b9]['format']?_[_0x3b3a('0x79')](_0x5c7f60[_0x577cbc[_0x27e4b9][_0x3b3a('0x78')]],'%s',_0x52f1c1):_0x52f1c1;if(_0x577cbc[_0x27e4b9][_0x3b3a('0x90')]){_0x23118a[_0x3b3a('0x6a')](_0x52f1c1);}_0x577cbc[_0x27e4b9]['orderBy']&&_0x23118a[_0x3b3a('0x3c')](_0x52f1c1,_0x577cbc[_0x27e4b9][_0x3b3a('0x7a')]===_0x3b3a('0x7b')?![]:!![]);_0x23118a[_0x3b3a('0x6b')](_0x52f1c1,_0x577cbc[_0x27e4b9][_0x3b3a('0x7c')]||_0x52f1c1);}if(_0x52b5a0['joins']){_0x52b5a0[_0x3b3a('0x7d')]=JSON['parse'](_0x52b5a0['joins']);for(var _0x58ba62=0x0;_0x58ba62<_0x52b5a0[_0x3b3a('0x7d')][_0x3b3a('0x3a')];_0x58ba62+=0x1){if(_0x52b5a0['joins'][_0x58ba62]['type']&&_[_0x3b3a('0x91')](_0x357b77,_0x52b5a0[_0x3b3a('0x7d')][_0x58ba62][_0x3b3a('0x32')])&&_0x52b5a0[_0x3b3a('0x7d')][_0x58ba62]['parentKey']&&_0x52b5a0[_0x3b3a('0x7d')][_0x58ba62][_0x3b3a('0x80')]&&_0x52b5a0[_0x3b3a('0x7d')][_0x58ba62][_0x3b3a('0x81')]){_0x23118a[_0x52b5a0[_0x3b3a('0x7d')][_0x58ba62][_0x3b3a('0x32')]](_0x52b5a0[_0x3b3a('0x7d')][_0x58ba62][_0x3b3a('0x80')],null,util[_0x3b3a('0x78')](_0x3b3a('0x82'),_0x52b5a0['table'],_0x52b5a0[_0x3b3a('0x7d')][_0x58ba62][_0x3b3a('0x7f')],_0x52b5a0[_0x3b3a('0x7d')][_0x58ba62][_0x3b3a('0x80')],_0x52b5a0[_0x3b3a('0x7d')][_0x58ba62][_0x3b3a('0x81')]));}}}if(_0x52b5a0['conditions']){_0x52b5a0[_0x3b3a('0x83')]=JSON[_0x3b3a('0x7e')](_0x52b5a0[_0x3b3a('0x83')]);_0x23118a['where'](_0x3f8781(_0x52b5a0[_0x3b3a('0x83')]['group']));}_0x18e75e=_0x23118a[_0x3b3a('0x84')]();_0x23118a[_0x3b3a('0x1f')](_0x452f8a);_0x23118a['offset'](0x0);logger[_0x3b3a('0x85')](_0x3b3a('0x86'),_0x23118a['toString']());return dbH['sequelize'][_0x3b3a('0x37')](_0x23118a[_0x3b3a('0x87')](),{'type':dbH[_0x3b3a('0x88')]['QueryTypes'][_0x3b3a('0x89')]});}})['then'](function(){return{'sql':_0x18e75e[_0x3b3a('0x87')]()};})[_0x3b3a('0x26')](respondWithResult(_0x4296ed,null))[_0x3b3a('0x47')](handleError(_0x4296ed,null));}; \ No newline at end of file +var _0x3905=['cross_join','ROUND(%s)','IS\x20NULL','foreignTable','%s.%s\x20=\x20%s.%s','clone','output','web','fullPath','randomstring','generate','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','startDate','info','Run\x20Query:','child_process','fork','../../files/reports','savename','countTable','COUNT(*)','count','run','runReport','COUNT(DISTINCT\x20%s)','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','Content-Range','apply','save','update','then','get','CustomReports','error','stack','name','map','AnalyticCustomReport','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','type','VIRTUAL','options','findAll','rows','catch','show','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','destroy','join','left_join','right_join','SUM(%s)','COUNT(%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','replace','function','format','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignKey','conditions','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT'];(function(_0x2eb33c,_0x355ff4){var _0x1b4938=function(_0x5d0fe2){while(--_0x5d0fe2){_0x2eb33c['push'](_0x2eb33c['shift']());}};_0x1b4938(++_0x355ff4);}(_0x3905,0xc3));var _0x5390=function(_0x2134b2,_0x5a82aa){_0x2134b2=_0x2134b2-0x0;var _0x4e4bc8=_0x3905[_0x2134b2];return _0x4e4bc8;};'use strict';var emlformat=require(_0x5390('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5390('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5390('0x2'));var moment=require(_0x5390('0x3'));var BPromise=require(_0x5390('0x4'));var Mustache=require(_0x5390('0x5'));var util=require(_0x5390('0x6'));var path=require(_0x5390('0x7'));var sox=require(_0x5390('0x8'));var csv=require(_0x5390('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5390('0xa'));var _=require(_0x5390('0xb'));var squel=require(_0x5390('0xc'));var crypto=require('crypto');var jsforce=require(_0x5390('0xd'));var deskjs=require(_0x5390('0xe'));var toCsv=require('to-csv');var querystring=require(_0x5390('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x5390('0x10'));var qs=require(_0x5390('0x11'));var as=require(_0x5390('0x12'));var hardwareService=require(_0x5390('0x13'));var logger=require(_0x5390('0x14'))(_0x5390('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5390('0x16'));var db=require(_0x5390('0x17'))['db'];var dbH=require(_0x5390('0x17'))['dbH'];function respondWithStatusCode(_0x1d412e,_0x2469e5){_0x2469e5=_0x2469e5||0xcc;return function(_0x450415){if(_0x450415){return _0x1d412e[_0x5390('0x18')](_0x2469e5);}return _0x1d412e[_0x5390('0x19')](_0x2469e5)[_0x5390('0x1a')]();};}function respondWithResult(_0x49b612,_0x4ff29e){_0x4ff29e=_0x4ff29e||0xc8;return function(_0x1cb882){if(_0x1cb882){return _0x49b612[_0x5390('0x19')](_0x4ff29e)[_0x5390('0x1b')](_0x1cb882);}};}function respondWithFilteredResult(_0xfcdcaf,_0x46b1be){return function(_0x16be47){if(_0x16be47){var _0x3d762c=typeof _0x46b1be[_0x5390('0x1c')]===_0x5390('0x1d')&&typeof _0x46b1be[_0x5390('0x1e')]==='undefined';var _0x1354d4=_0x16be47['count'];var _0x476c8b=_0x3d762c?0x0:_0x46b1be[_0x5390('0x1c')];var _0x2d79bc=_0x3d762c?_0x16be47['count']:_0x46b1be[_0x5390('0x1c')]+_0x46b1be['limit'];var _0x47dc98;if(_0x2d79bc>=_0x1354d4){_0x2d79bc=_0x1354d4;_0x47dc98=0xc8;}else{_0x47dc98=0xce;}_0xfcdcaf[_0x5390('0x19')](_0x47dc98);return _0xfcdcaf['set'](_0x5390('0x1f'),_0x476c8b+'-'+_0x2d79bc+'/'+_0x1354d4)['json'](_0x16be47);}return null;};}function patchUpdates(_0x4c38f4){return function(_0x14ce70){try{jsonpatch[_0x5390('0x20')](_0x14ce70,_0x4c38f4,!![]);}catch(_0x952325){return BPromise['reject'](_0x952325);}return _0x14ce70[_0x5390('0x21')]();};}function saveUpdates(_0x31f45b,_0xf6bc56){return function(_0x53a0cd){if(_0x53a0cd){return _0x53a0cd[_0x5390('0x22')](_0x31f45b)[_0x5390('0x23')](function(_0x3b8541){return _0x3b8541;});}return null;};}function removeEntity(_0x59cc9e,_0x491918){return function(_0x19a4e0){if(_0x19a4e0){return _0x19a4e0['destroy']()[_0x5390('0x23')](function(){var _0x4869d5=_0x19a4e0[_0x5390('0x24')]({'plain':!![]});var _0x5232cb=_0x5390('0x25');return db['UserProfileResource']['destroy']({'where':{'type':_0x5232cb,'resourceId':_0x4869d5['id']}})[_0x5390('0x23')](function(){return _0x19a4e0;});})[_0x5390('0x23')](function(){_0x59cc9e[_0x5390('0x19')](0xcc)[_0x5390('0x1a')]();});}};}function handleEntityNotFound(_0x13ca55,_0x7f7034){return function(_0x3c3ab8){if(!_0x3c3ab8){_0x13ca55['sendStatus'](0x194);}return _0x3c3ab8;};}function handleError(_0x27b3dc,_0x201a13){_0x201a13=_0x201a13||0x1f4;return function(_0x3254cb){logger[_0x5390('0x26')](_0x3254cb[_0x5390('0x27')]);if(_0x3254cb[_0x5390('0x28')]){delete _0x3254cb[_0x5390('0x28')];}_0x27b3dc[_0x5390('0x19')](_0x201a13)['send'](_0x3254cb);};}exports['index']=function(_0x4b3219,_0x364fcd){var _0x3a244b={},_0x426e98={},_0x43f1b4={'count':0x0,'rows':[]};var _0x5da6d0=_[_0x5390('0x29')](db[_0x5390('0x2a')][_0x5390('0x2b')],function(_0x6064c6){return{'name':_0x6064c6[_0x5390('0x2c')],'type':_0x6064c6['type'][_0x5390('0x2d')]};});_0x426e98[_0x5390('0x2e')]=_[_0x5390('0x29')](_0x5da6d0,_0x5390('0x28'));_0x426e98['query']=_[_0x5390('0x2f')](_0x4b3219[_0x5390('0x30')]);_0x426e98[_0x5390('0x31')]=_[_0x5390('0x32')](_0x426e98[_0x5390('0x2e')],_0x426e98[_0x5390('0x30')]);_0x3a244b[_0x5390('0x33')]=_[_0x5390('0x32')](_0x426e98[_0x5390('0x2e')],qs[_0x5390('0x34')](_0x4b3219[_0x5390('0x30')][_0x5390('0x34')]));_0x3a244b[_0x5390('0x33')]=_0x3a244b['attributes'][_0x5390('0x35')]?_0x3a244b[_0x5390('0x33')]:_0x426e98[_0x5390('0x2e')];if(!_0x4b3219[_0x5390('0x30')]['hasOwnProperty']('nolimit')){_0x3a244b[_0x5390('0x1e')]=qs[_0x5390('0x1e')](_0x4b3219[_0x5390('0x30')][_0x5390('0x1e')]);_0x3a244b[_0x5390('0x1c')]=qs['offset'](_0x4b3219[_0x5390('0x30')][_0x5390('0x1c')]);}_0x3a244b[_0x5390('0x36')]=qs[_0x5390('0x37')](_0x4b3219[_0x5390('0x30')][_0x5390('0x37')]);_0x3a244b[_0x5390('0x38')]=qs['filters'](_[_0x5390('0x39')](_0x4b3219['query'],_0x426e98['filters']),_0x5da6d0);if(_0x4b3219[_0x5390('0x30')][_0x5390('0x3a')]){_0x3a244b[_0x5390('0x38')]=_[_0x5390('0x3b')](_0x3a244b[_0x5390('0x38')],{'$or':_[_0x5390('0x29')](_0x5da6d0,function(_0x530d23){if(_0x530d23[_0x5390('0x3c')]!==_0x5390('0x3d')){var _0xc93132={};_0xc93132[_0x530d23[_0x5390('0x28')]]={'$like':'%'+_0x4b3219['query']['filter']+'%'};return _0xc93132;}})});}_0x3a244b=_['merge']({},_0x3a244b,_0x4b3219[_0x5390('0x3e')]);var _0xd1e8af={'where':_0x3a244b['where']};return db[_0x5390('0x2a')]['count'](_0xd1e8af)[_0x5390('0x23')](function(_0x47bba1){_0x43f1b4['count']=_0x47bba1;if(_0x4b3219[_0x5390('0x30')]['includeAll']){_0x3a244b['include']=[{'all':!![]}];}return db[_0x5390('0x2a')][_0x5390('0x3f')](_0x3a244b);})['then'](function(_0xfe44fe){_0x43f1b4[_0x5390('0x40')]=_0xfe44fe;return _0x43f1b4;})['then'](respondWithFilteredResult(_0x364fcd,_0x3a244b))[_0x5390('0x41')](handleError(_0x364fcd,null));};exports[_0x5390('0x42')]=function(_0x1b4e71,_0x3f7c46){var _0x3abd62={'raw':![],'where':{'id':_0x1b4e71['params']['id']}},_0x45cd32={};_0x45cd32[_0x5390('0x2e')]=_[_0x5390('0x2f')](db[_0x5390('0x2a')]['rawAttributes']);_0x45cd32['query']=_['keys'](_0x1b4e71[_0x5390('0x30')]);_0x45cd32[_0x5390('0x31')]=_['intersection'](_0x45cd32[_0x5390('0x2e')],_0x45cd32['query']);_0x3abd62['attributes']=_[_0x5390('0x32')](_0x45cd32[_0x5390('0x2e')],qs['fields'](_0x1b4e71[_0x5390('0x30')][_0x5390('0x34')]));_0x3abd62[_0x5390('0x33')]=_0x3abd62['attributes'][_0x5390('0x35')]?_0x3abd62[_0x5390('0x33')]:_0x45cd32[_0x5390('0x2e')];if(_0x1b4e71[_0x5390('0x30')][_0x5390('0x43')]){_0x3abd62['include']=[{'all':!![]}];}_0x3abd62=_[_0x5390('0x3b')]({},_0x3abd62,_0x1b4e71[_0x5390('0x3e')]);return db[_0x5390('0x2a')][_0x5390('0x44')](_0x3abd62)[_0x5390('0x23')](handleEntityNotFound(_0x3f7c46,null))[_0x5390('0x23')](respondWithResult(_0x3f7c46,null))[_0x5390('0x41')](handleError(_0x3f7c46,null));};exports[_0x5390('0x45')]=function(_0x7ce1b4,_0x45207a){return db['AnalyticCustomReport'][_0x5390('0x45')](_0x7ce1b4[_0x5390('0x46')],{})['then'](function(_0x49e237){var _0x2413a7=_0x7ce1b4[_0x5390('0x47')]['get']({'plain':!![]});if(!_0x2413a7)throw new Error(_0x5390('0x48'));if(_0x2413a7['role']===_0x5390('0x47')){var _0xcf9abd=_0x49e237[_0x5390('0x24')]({'plain':!![]});var _0x1a0cd6=_0x5390('0x49');return db[_0x5390('0x4a')][_0x5390('0x44')]({'where':{'name':_0x1a0cd6,'userProfileId':_0x2413a7[_0x5390('0x4b')]},'raw':!![]})['then'](function(_0x2f12e0){if(_0x2f12e0&&_0x2f12e0[_0x5390('0x4c')]===0x0){return db[_0x5390('0x4d')][_0x5390('0x45')]({'name':_0xcf9abd['name'],'resourceId':_0xcf9abd['id'],'type':_0x5390('0x25'),'sectionId':_0x2f12e0['id']},{})[_0x5390('0x23')](function(){return _0x49e237;});}else{return _0x49e237;}})[_0x5390('0x41')](function(_0x4c73a2){logger[_0x5390('0x26')](_0x5390('0x4e'),_0x4c73a2);throw _0x4c73a2;});}return _0x49e237;})[_0x5390('0x23')](respondWithResult(_0x45207a,0xc9))[_0x5390('0x41')](handleError(_0x45207a,null));};exports[_0x5390('0x22')]=function(_0x30f7d6,_0x1c155a){if(_0x30f7d6[_0x5390('0x46')]['id']){delete _0x30f7d6['body']['id'];}return db[_0x5390('0x2a')][_0x5390('0x44')]({'where':{'id':_0x30f7d6[_0x5390('0x4f')]['id']}})[_0x5390('0x23')](handleEntityNotFound(_0x1c155a,null))[_0x5390('0x23')](saveUpdates(_0x30f7d6['body'],null))[_0x5390('0x23')](respondWithResult(_0x1c155a,null))['catch'](handleError(_0x1c155a,null));};exports[_0x5390('0x50')]=function(_0x43ee0f,_0x416903){return db[_0x5390('0x2a')][_0x5390('0x44')]({'where':{'id':_0x43ee0f['params']['id']}})[_0x5390('0x23')](handleEntityNotFound(_0x416903,null))[_0x5390('0x23')](removeEntity(_0x416903,null))[_0x5390('0x41')](handleError(_0x416903,null));};exports['preview']=function(_0x5b82fb,_0x171d82){var _0x253f98=0xa;var _0x5dcd10=[_0x5390('0x51'),_0x5390('0x52'),_0x5390('0x53'),'cross_join'];var _0x30e494={'SUM':_0x5390('0x54'),'COUNT':_0x5390('0x55'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x5390('0x56'),'MIN':_0x5390('0x57'),'AVG':_0x5390('0x58'),'GROUP_CONCAT':_0x5390('0x59'),'GROUP_CONCAT ASC':_0x5390('0x5a'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x3bd223={'SEC_TO_TIME':_0x5390('0x5b'),'DATE':_0x5390('0x5c'),'HOUR':_0x5390('0x5d'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x5390('0x5e')};var _0x3610aa=function(_0x25336d){return!_[_0x5390('0x5f')](['IS\x20NULL',_0x5390('0x60'),_0x5390('0x61'),_0x5390('0x62')],_0x25336d);};var _0xbf541=function(_0x1f9a7e){if(!_0x1f9a7e||!_0x1f9a7e[_0x5390('0x63')][_0x5390('0x35')]){return'';}for(var _0x698a9f='(',_0x2e1a36=0x0;_0x2e1a36<_0x1f9a7e[_0x5390('0x63')][_0x5390('0x35')];_0x2e1a36+=0x1){_0x2e1a36>0x0&&(_0x698a9f+='\x20'+_0x1f9a7e[_0x5390('0x64')]+'\x20');_0x698a9f+=_0x1f9a7e[_0x5390('0x63')][_0x2e1a36][_0x5390('0x65')]?_0xbf541(_0x1f9a7e[_0x5390('0x63')][_0x2e1a36][_0x5390('0x65')]):_0x1f9a7e[_0x5390('0x63')][_0x2e1a36][_0x5390('0x66')]+'\x20'+_0x1f9a7e['rules'][_0x2e1a36]['condition']+(_0x3610aa(_0x1f9a7e[_0x5390('0x63')][_0x2e1a36][_0x5390('0x67')])?'\x20'+_0x1f9a7e[_0x5390('0x63')][_0x2e1a36][_0x5390('0x68')]:'');}return _0x698a9f+')';};var _0x1f3196={'where':{'id':_0x5b82fb[_0x5390('0x4f')]['id']}},_0x10248c,_0x59d3da,_0x5a5b29,_0x53e753,_0x44aa59;_0x1f3196=_[_0x5390('0x3b')]({},_0x1f3196,_0x5b82fb[_0x5390('0x3e')]);return db[_0x5390('0x2a')][_0x5390('0x44')](_0x1f3196)[_0x5390('0x23')](function(_0x31ef7d){if(_0x31ef7d){_0x10248c=_0x31ef7d;return _0x31ef7d[_0x5390('0x69')]();}return null;})[_0x5390('0x23')](function(_0x5912e0){if(_0x5912e0){if(!_0x5912e0[_0x5390('0x35')]){throw new db[(_0x5390('0x6a'))][(_0x5390('0x6b'))](_0x5390('0x6c'),0x193);}_0x59d3da=_0x5912e0;return db[_0x5390('0x6d')][_0x5390('0x3f')]({'raw':!![]});}return null;})['then'](function(_0x106b17){if(_0x106b17){_0x5a5b29=_[_0x5390('0x6e')](_0x106b17,'id');var _0x29e993;var _0x528622=squel[_0x5390('0x6f')]();_0x528622[_0x5390('0x70')](_0x10248c[_0x5390('0x71')]);for(var _0x283e24=0x0;_0x283e24<_0x59d3da['length'];_0x283e24+=0x1){_0x29e993=_0x59d3da[_0x283e24]['MetricId']?_0x5a5b29[_0x59d3da[_0x283e24][_0x5390('0x72')]][_0x5390('0x73')]:_0x59d3da[_0x283e24][_0x5390('0x66')];_0x29e993=_0x59d3da[_0x283e24]['function']?_[_0x5390('0x74')](_0x30e494[_0x59d3da[_0x283e24][_0x5390('0x75')]],'%s',_0x29e993):_0x29e993;_0x29e993=_0x59d3da[_0x283e24][_0x5390('0x76')]?_[_0x5390('0x74')](_0x3bd223[_0x59d3da[_0x283e24][_0x5390('0x76')]],'%s',_0x29e993):_0x29e993;if(_0x59d3da[_0x283e24][_0x5390('0x77')]){_0x528622['group'](_0x29e993);}_0x59d3da[_0x283e24][_0x5390('0x78')]&&_0x528622[_0x5390('0x36')](_0x29e993,_0x59d3da[_0x283e24][_0x5390('0x78')]===_0x5390('0x79')?![]:!![]);_0x528622[_0x5390('0x66')](_0x29e993,_0x59d3da[_0x283e24][_0x5390('0x7a')]||_0x29e993);}if(_0x10248c['joins']){_0x10248c[_0x5390('0x7b')]=JSON[_0x5390('0x7c')](_0x10248c[_0x5390('0x7b')]);for(var _0x43191f=0x0;_0x43191f<_0x10248c[_0x5390('0x7b')][_0x5390('0x35')];_0x43191f+=0x1){if(_0x10248c[_0x5390('0x7b')][_0x43191f][_0x5390('0x3c')]&&_[_0x5390('0x5f')](_0x5dcd10,_0x10248c[_0x5390('0x7b')][_0x43191f][_0x5390('0x3c')])&&_0x10248c[_0x5390('0x7b')][_0x43191f]['parentKey']&&_0x10248c[_0x5390('0x7b')][_0x43191f]['foreignTable']&&_0x10248c[_0x5390('0x7b')][_0x43191f]['foreignKey']){_0x528622[_0x10248c[_0x5390('0x7b')][_0x43191f][_0x5390('0x3c')]](_0x10248c[_0x5390('0x7b')][_0x43191f]['foreignTable'],null,util[_0x5390('0x76')]('%s.%s\x20=\x20%s.%s',_0x10248c[_0x5390('0x71')],_0x10248c[_0x5390('0x7b')][_0x43191f][_0x5390('0x7d')],_0x10248c[_0x5390('0x7b')][_0x43191f]['foreignTable'],_0x10248c[_0x5390('0x7b')][_0x43191f][_0x5390('0x7e')]));}}}if(_0x10248c[_0x5390('0x7f')]){_0x10248c[_0x5390('0x7f')]=JSON['parse'](_0x10248c[_0x5390('0x7f')]);_0x528622['where'](_0xbf541(_0x10248c['conditions'][_0x5390('0x65')]));}_0x44aa59=_0x528622['clone']();_0x528622[_0x5390('0x1e')](_0x253f98);_0x528622[_0x5390('0x1c')](0x0);logger['debug'](_0x5390('0x80'),_0x528622[_0x5390('0x81')]());return dbH[_0x5390('0x82')][_0x5390('0x30')](_0x528622[_0x5390('0x81')](),{'type':dbH[_0x5390('0x82')][_0x5390('0x83')][_0x5390('0x84')]});}})[_0x5390('0x23')](respondWithResult(_0x171d82,null))['catch'](handleError(_0x171d82,null));};function runReport(_0x49306c,_0x396b86,_0xd889b7){var _0x6121d7=_0x396b86[_0x5390('0x28')];var _0x1feccd=0xa;var _0x39f033=[_0x5390('0x51'),_0x5390('0x52'),'right_join',_0x5390('0x85')];var _0x345916={'SUM':_0x5390('0x54'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x5390('0x56'),'MIN':_0x5390('0x57'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x5390('0x59'),'GROUP_CONCAT ASC':_0x5390('0x5a'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x52481b={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x5390('0x5c'),'HOUR':_0x5390('0x5d'),'ROUND':_0x5390('0x86'),'UNIX_TIMESTAMP':_0x5390('0x5e')};var _0x157b55=function(_0x269655){return!_[_0x5390('0x5f')]([_0x5390('0x87'),'IS\x20NOT\x20NULL',_0x5390('0x61'),_0x5390('0x62')],_0x269655);};var _0x4ab6d5=function(_0x2a51eb){if(!_0x2a51eb||!_0x2a51eb[_0x5390('0x63')][_0x5390('0x35')]){return'';}for(var _0x283401='(',_0x215dff=0x0;_0x215dff<_0x2a51eb[_0x5390('0x63')]['length'];_0x215dff+=0x1){_0x215dff>0x0&&(_0x283401+='\x20'+_0x2a51eb[_0x5390('0x64')]+'\x20');_0x283401+=_0x2a51eb[_0x5390('0x63')][_0x215dff][_0x5390('0x65')]?_0x4ab6d5(_0x2a51eb[_0x5390('0x63')][_0x215dff]['group']):_0x2a51eb[_0x5390('0x63')][_0x215dff][_0x5390('0x66')]+'\x20'+_0x2a51eb['rules'][_0x215dff][_0x5390('0x67')]+(_0x157b55(_0x2a51eb[_0x5390('0x63')][_0x215dff][_0x5390('0x67')])?'\x20'+_0x2a51eb[_0x5390('0x63')][_0x215dff][_0x5390('0x68')]:'');}return _0x283401+')';};var _0x11c494={'where':{'id':_0x49306c['id']}},_0x72437f,_0x4752a3,_0xc7e4fc,_0x23a5c8,_0x27604f;_0x11c494=_[_0x5390('0x3b')]({},_0x11c494,_0xd889b7);return db[_0x5390('0x2a')][_0x5390('0x44')](_0x11c494)[_0x5390('0x23')](function(_0x1a4381){if(_0x1a4381){_0x72437f=_0x1a4381;return _0x1a4381['getFields']();}return null;})[_0x5390('0x23')](function(_0x44ab48){if(_0x44ab48){if(!_0x44ab48[_0x5390('0x35')]){throw new db[(_0x5390('0x6a'))][(_0x5390('0x6b'))](_0x5390('0x6c'),0x193);}_0x4752a3=_0x44ab48;return db['AnalyticMetric'][_0x5390('0x3f')]({'raw':!![]});}return null;})['then'](function(_0x3886b1){if(_0x3886b1){_0xc7e4fc=_[_0x5390('0x6e')](_0x3886b1,'id');var _0xd0224a;var _0x5d9164=squel[_0x5390('0x6f')]();_0x5d9164['from'](_0x72437f[_0x5390('0x71')]);for(var _0x1ce41e=0x0;_0x1ce41e<_0x4752a3[_0x5390('0x35')];_0x1ce41e+=0x1){_0xd0224a=_0x4752a3[_0x1ce41e][_0x5390('0x72')]?_0xc7e4fc[_0x4752a3[_0x1ce41e][_0x5390('0x72')]][_0x5390('0x73')]:_0x4752a3[_0x1ce41e][_0x5390('0x66')];_0xd0224a=_0x4752a3[_0x1ce41e]['function']?_[_0x5390('0x74')](_0x345916[_0x4752a3[_0x1ce41e]['function']],'%s',_0xd0224a):_0xd0224a;_0xd0224a=_0x4752a3[_0x1ce41e][_0x5390('0x76')]?_[_0x5390('0x74')](_0x52481b[_0x4752a3[_0x1ce41e][_0x5390('0x76')]],'%s',_0xd0224a):_0xd0224a;if(_0x4752a3[_0x1ce41e]['groupBy']){_0x5d9164[_0x5390('0x65')](_0xd0224a);}_0x4752a3[_0x1ce41e][_0x5390('0x78')]&&_0x5d9164[_0x5390('0x36')](_0xd0224a,_0x4752a3[_0x1ce41e][_0x5390('0x78')]===_0x5390('0x79')?![]:!![]);_0x5d9164[_0x5390('0x66')](_0xd0224a,_0x4752a3[_0x1ce41e][_0x5390('0x7a')]||_0xd0224a);}if(_0x72437f[_0x5390('0x7b')]){_0x72437f['joins']=JSON[_0x5390('0x7c')](_0x72437f[_0x5390('0x7b')]);for(var _0x50648c=0x0;_0x50648c<_0x72437f[_0x5390('0x7b')][_0x5390('0x35')];_0x50648c+=0x1){if(_0x72437f[_0x5390('0x7b')][_0x50648c][_0x5390('0x3c')]&&_[_0x5390('0x5f')](_0x39f033,_0x72437f['joins'][_0x50648c][_0x5390('0x3c')])&&_0x72437f['joins'][_0x50648c][_0x5390('0x7d')]&&_0x72437f[_0x5390('0x7b')][_0x50648c]['foreignTable']&&_0x72437f[_0x5390('0x7b')][_0x50648c]['foreignKey']){_0x5d9164[_0x72437f[_0x5390('0x7b')][_0x50648c][_0x5390('0x3c')]](_0x72437f[_0x5390('0x7b')][_0x50648c][_0x5390('0x88')],null,util[_0x5390('0x76')](_0x5390('0x89'),_0x72437f[_0x5390('0x71')],_0x72437f[_0x5390('0x7b')][_0x50648c][_0x5390('0x7d')],_0x72437f[_0x5390('0x7b')][_0x50648c][_0x5390('0x88')],_0x72437f['joins'][_0x50648c]['foreignKey']));}}}if(_0x72437f[_0x5390('0x7f')]){_0x72437f[_0x5390('0x7f')]=JSON[_0x5390('0x7c')](_0x72437f[_0x5390('0x7f')]);_0x5d9164[_0x5390('0x38')](_0x4ab6d5(_0x72437f[_0x5390('0x7f')][_0x5390('0x65')]));}_0x27604f=_0x5d9164[_0x5390('0x8a')]();_0x5d9164['limit'](_0x1feccd);_0x5d9164[_0x5390('0x1c')](0x0);return;}})[_0x5390('0x23')](function(){if(_0x396b86[_0x5390('0x8b')]===_0x5390('0x8c')){return null;}var _0x131879=_[_0x5390('0x3b')](_0x396b86,{'name':_0x396b86[_0x5390('0x8d')]||_0x396b86[_0x5390('0x28')]||_0x72437f[_0x5390('0x28')],'basename':_0x6121d7,'savename':util[_0x5390('0x76')]('%s-%s.%s',_0x396b86[_0x5390('0x28')]||_0x72437f[_0x5390('0x28')],require(_0x5390('0x8e'))[_0x5390('0x8f')](0x4),_0x396b86[_0x5390('0x8b')]||_0x5390('0x90')),'reportId':_0x72437f['id'],'reportType':_0x5390('0x91')});return db[_0x5390('0x92')][_0x5390('0x45')](_0x131879,{'raw':!![]});})[_0x5390('0x23')](function(_0x3234e1){if(_0x72437f[_0x5390('0x71')]===_0x5390('0x93')){_0x27604f[_0x5390('0x38')](_0x72437f[_0x5390('0x71')]+_0x5390('0x94'),_0x396b86['startDate'],_0x396b86[_0x5390('0x95')]);}else{_0x27604f[_0x5390('0x38')](_0x72437f[_0x5390('0x71')]+_0x5390('0x96'),_0x396b86[_0x5390('0x97')],_0x396b86[_0x5390('0x95')]);}if(_0x3234e1){logger[_0x5390('0x98')](_0x5390('0x99'),_0x27604f[_0x5390('0x81')]());require(_0x5390('0x9a'))[_0x5390('0x9b')](path[_0x5390('0x51')](__dirname,'../../components/export/',_0x3234e1[_0x5390('0x8b')]),[_0x3234e1['id'],_0x27604f['toString'](),path['join'](__dirname,_0x5390('0x9c'),_0x3234e1[_0x5390('0x9d')]),_0x6121d7]);return _0x3234e1;}else{var _0xc046ec=squel['select']();_0xc046ec['from']('('+_0x27604f['toString']()+')',_0x5390('0x9e'));_0xc046ec[_0x5390('0x66')](_0x5390('0x9f'),_0x5390('0xa0'));_0x27604f[_0x5390('0x1e')](_0x396b86['limit']||_0x1feccd);_0x27604f['offset'](_0x396b86[_0x5390('0x1c')]||0x0);return dbH[_0x5390('0x82')]['query'](_0xc046ec[_0x5390('0x81')](),{'type':dbH['sequelize'][_0x5390('0x83')]['SELECT']})[_0x5390('0x23')](function(_0x5b59a2){if(!_0x5b59a2[_0x5390('0x35')]){_0x23a5c8=0x0;}else{_0x23a5c8=_0x5b59a2[0x0]['count']||0x0;}return dbH[_0x5390('0x82')][_0x5390('0x30')](_0x27604f[_0x5390('0x81')](),{'type':dbH[_0x5390('0x82')][_0x5390('0x83')][_0x5390('0x84')]});})['then'](function(_0x53fd44){return{'rows':_0x53fd44||[],'count':_0x23a5c8};});}});}exports[_0x5390('0xa1')]=function(_0x5d84bf,_0x363cf0){return runReport(_0x5d84bf[_0x5390('0x4f')],_0x5d84bf['query'],_0x5d84bf[_0x5390('0x3e')])[_0x5390('0x23')](respondWithResult(_0x363cf0,null))[_0x5390('0x41')](handleError(_0x363cf0,null));};exports[_0x5390('0xa2')]=runReport;exports[_0x5390('0x30')]=function(_0x4c4e8c,_0x5af5b2){var _0x115362=0xa;var _0x5c568b=[_0x5390('0x51'),_0x5390('0x52'),'right_join',_0x5390('0x85')];var _0x428183={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x5390('0xa3'),'MAX':'MAX(%s)','MIN':_0x5390('0x57'),'AVG':_0x5390('0x58'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x5390('0x5a'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x5664eb={'SEC_TO_TIME':_0x5390('0x5b'),'DATE':'DATE(%s)','HOUR':_0x5390('0x5d'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x5390('0x5e')};var _0x51b7dc=function(_0x2565f8){return!_['includes']([_0x5390('0x87'),'IS\x20NOT\x20NULL','IS\x20EMPTY',_0x5390('0x62')],_0x2565f8);};var _0x5be9ac=function(_0x530fee){if(!_0x530fee||!_0x530fee['rules'][_0x5390('0x35')]){return'';}for(var _0x597853='(',_0x351130=0x0;_0x351130<_0x530fee[_0x5390('0x63')][_0x5390('0x35')];_0x351130+=0x1){_0x351130>0x0&&(_0x597853+='\x20'+_0x530fee['operator']+'\x20');_0x597853+=_0x530fee[_0x5390('0x63')][_0x351130][_0x5390('0x65')]?_0x5be9ac(_0x530fee[_0x5390('0x63')][_0x351130][_0x5390('0x65')]):_0x530fee['rules'][_0x351130][_0x5390('0x66')]+'\x20'+_0x530fee[_0x5390('0x63')][_0x351130][_0x5390('0x67')]+(_0x51b7dc(_0x530fee['rules'][_0x351130][_0x5390('0x67')])?'\x20'+_0x530fee['rules'][_0x351130][_0x5390('0x68')]:'');}return _0x597853+')';};var _0x40c65a={'where':{'id':_0x4c4e8c[_0x5390('0x4f')]['id']}},_0x4e4689,_0x16e259,_0x24aa5a,_0xdb9081,_0xdcc5f5;_0x40c65a=_[_0x5390('0x3b')]({},_0x40c65a,_0x4c4e8c[_0x5390('0x3e')]);return db[_0x5390('0x2a')][_0x5390('0x44')](_0x40c65a)['then'](function(_0xfa3c70){if(_0xfa3c70){_0x4e4689=_0xfa3c70;return _0xfa3c70[_0x5390('0x69')]();}return null;})['then'](function(_0x58818c){if(_0x58818c){if(!_0x58818c['length']){throw new db[(_0x5390('0x6a'))][(_0x5390('0x6b'))](_0x5390('0x6c'),0x193);}_0x16e259=_0x58818c;return db[_0x5390('0x6d')][_0x5390('0x3f')]({'raw':!![]});}return null;})[_0x5390('0x23')](function(_0x24666c){if(_0x24666c){_0x24aa5a=_[_0x5390('0x6e')](_0x24666c,'id');var _0x4d9291;var _0x187ae9=squel[_0x5390('0x6f')]();_0x187ae9[_0x5390('0x70')](_0x4e4689[_0x5390('0x71')]);for(var _0x5de78c=0x0;_0x5de78c<_0x16e259[_0x5390('0x35')];_0x5de78c+=0x1){_0x4d9291=_0x16e259[_0x5de78c][_0x5390('0x72')]?_0x24aa5a[_0x16e259[_0x5de78c][_0x5390('0x72')]]['metric']:_0x16e259[_0x5de78c][_0x5390('0x66')];_0x4d9291=_0x16e259[_0x5de78c][_0x5390('0x75')]?_[_0x5390('0x74')](_0x428183[_0x16e259[_0x5de78c][_0x5390('0x75')]],'%s',_0x4d9291):_0x4d9291;_0x4d9291=_0x16e259[_0x5de78c][_0x5390('0x76')]?_[_0x5390('0x74')](_0x5664eb[_0x16e259[_0x5de78c]['format']],'%s',_0x4d9291):_0x4d9291;if(_0x16e259[_0x5de78c][_0x5390('0x77')]){_0x187ae9[_0x5390('0x65')](_0x4d9291);}_0x16e259[_0x5de78c]['orderBy']&&_0x187ae9[_0x5390('0x36')](_0x4d9291,_0x16e259[_0x5de78c][_0x5390('0x78')]===_0x5390('0x79')?![]:!![]);_0x187ae9[_0x5390('0x66')](_0x4d9291,_0x16e259[_0x5de78c][_0x5390('0x7a')]||_0x4d9291);}if(_0x4e4689['joins']){_0x4e4689[_0x5390('0x7b')]=JSON['parse'](_0x4e4689[_0x5390('0x7b')]);for(var _0x69a1d8=0x0;_0x69a1d8<_0x4e4689[_0x5390('0x7b')][_0x5390('0x35')];_0x69a1d8+=0x1){if(_0x4e4689[_0x5390('0x7b')][_0x69a1d8][_0x5390('0x3c')]&&_[_0x5390('0x5f')](_0x5c568b,_0x4e4689[_0x5390('0x7b')][_0x69a1d8][_0x5390('0x3c')])&&_0x4e4689['joins'][_0x69a1d8]['parentKey']&&_0x4e4689[_0x5390('0x7b')][_0x69a1d8][_0x5390('0x88')]&&_0x4e4689[_0x5390('0x7b')][_0x69a1d8]['foreignKey']){_0x187ae9[_0x4e4689[_0x5390('0x7b')][_0x69a1d8][_0x5390('0x3c')]](_0x4e4689[_0x5390('0x7b')][_0x69a1d8]['foreignTable'],null,util['format'](_0x5390('0x89'),_0x4e4689[_0x5390('0x71')],_0x4e4689[_0x5390('0x7b')][_0x69a1d8][_0x5390('0x7d')],_0x4e4689['joins'][_0x69a1d8][_0x5390('0x88')],_0x4e4689['joins'][_0x69a1d8][_0x5390('0x7e')]));}}}if(_0x4e4689['conditions']){_0x4e4689[_0x5390('0x7f')]=JSON[_0x5390('0x7c')](_0x4e4689[_0x5390('0x7f')]);_0x187ae9[_0x5390('0x38')](_0x5be9ac(_0x4e4689['conditions'][_0x5390('0x65')]));}_0xdcc5f5=_0x187ae9['clone']();_0x187ae9[_0x5390('0x1e')](_0x115362);_0x187ae9[_0x5390('0x1c')](0x0);logger['debug']('Limited\x20Query:',_0x187ae9[_0x5390('0x81')]());return dbH[_0x5390('0x82')][_0x5390('0x30')](_0x187ae9['toString'](),{'type':dbH['sequelize'][_0x5390('0x83')][_0x5390('0x84')]});}})[_0x5390('0x23')](function(){return{'sql':_0xdcc5f5[_0x5390('0x81')]()};})['then'](respondWithResult(_0x5af5b2,null))[_0x5390('0x41')](handleError(_0x5af5b2,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 5835dbe..2d0d87b 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 _0xc5bc=['define','analytics_custom_reports','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment'];(function(_0x2b4659,_0x4655d7){var _0x35badd=function(_0x29d3a5){while(--_0x29d3a5){_0x2b4659['push'](_0x2b4659['shift']());}};_0x35badd(++_0x4655d7);}(_0xc5bc,0xc0));var _0xcc5b=function(_0x12ca4f,_0x469017){_0x12ca4f=_0x12ca4f-0x0;var _0x3d746a=_0xc5bc[_0x12ca4f];return _0x3d746a;};'use strict';var _=require(_0xcc5b('0x0'));var util=require(_0xcc5b('0x1'));var logger=require(_0xcc5b('0x2'))(_0xcc5b('0x3'));var moment=require('moment');var BPromise=require(_0xcc5b('0x4'));var rp=require(_0xcc5b('0x5'));var fs=require('fs');var path=require(_0xcc5b('0x6'));var rimraf=require('rimraf');var config=require(_0xcc5b('0x7'));var attributes=require('./analyticCustomReport.attributes');module['exports']=function(_0x25d1bb,_0x14962d){return _0x25d1bb[_0xcc5b('0x8')]('AnalyticCustomReport',attributes,{'tableName':_0xcc5b('0x9'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0391=['path','../../config/environment','exports','define','AnalyticCustomReport','analytics_custom_reports','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0x0391,0x96));var _0x1039=function(_0x2c4e1d,_0x416d64){_0x2c4e1d=_0x2c4e1d-0x0;var _0x32d4e4=_0x0391[_0x2c4e1d];return _0x32d4e4;};'use strict';var _=require(_0x1039('0x0'));var util=require(_0x1039('0x1'));var logger=require(_0x1039('0x2'))(_0x1039('0x3'));var moment=require('moment');var BPromise=require(_0x1039('0x4'));var rp=require(_0x1039('0x5'));var fs=require('fs');var path=require(_0x1039('0x6'));var rimraf=require('rimraf');var config=require(_0x1039('0x7'));var attributes=require('./analyticCustomReport.attributes');module[_0x1039('0x8')]=function(_0x44da83,_0x21a23e){return _0x44da83[_0x1039('0x9')](_0x1039('0xa'),attributes,{'tableName':_0x1039('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.rpc.js b/server/api/analyticCustomReport/analyticCustomReport.rpc.js index 9566a51..665e104 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 _0x8387=['http','request','then','AnalyticCustomReport,\x20%s,\x20%s','debug','stringify','error','message','info','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x196e1b,_0x55fa06){var _0x5e1f18=function(_0x3bdb41){while(--_0x3bdb41){_0x196e1b['push'](_0x196e1b['shift']());}};_0x5e1f18(++_0x55fa06);}(_0x8387,0x6c));var _0x7838=function(_0x226198,_0x4bb033){_0x226198=_0x226198-0x0;var _0x57c1c8=_0x8387[_0x226198];return _0x57c1c8;};'use strict';var _=require(_0x7838('0x0'));var util=require(_0x7838('0x1'));var moment=require(_0x7838('0x2'));var BPromise=require(_0x7838('0x3'));var rs=require(_0x7838('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7838('0x5'))['db'];var utils=require(_0x7838('0x6'));var logger=require(_0x7838('0x7'))(_0x7838('0x8'));var config=require(_0x7838('0x9'));var jayson=require(_0x7838('0xa'));var client=jayson[_0x7838('0xb')][_0x7838('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2c8ad3,_0x36faad,_0x3e9351){return new BPromise(function(_0x26dde6,_0x516115){return client[_0x7838('0xd')](_0x2c8ad3,_0x3e9351)[_0x7838('0xe')](function(_0x199c8c){logger['info'](_0x7838('0xf'),_0x36faad,'request\x20sent');logger[_0x7838('0x10')]('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x36faad,'request\x20sent',JSON[_0x7838('0x11')](_0x199c8c));if(_0x199c8c['error']){if(_0x199c8c['error']['code']===0x1f4){logger[_0x7838('0x12')](_0x7838('0xf'),_0x36faad,_0x199c8c[_0x7838('0x12')]['message']);return _0x516115(_0x199c8c[_0x7838('0x12')][_0x7838('0x13')]);}logger['error']('AnalyticCustomReport,\x20%s,\x20%s',_0x36faad,_0x199c8c[_0x7838('0x12')][_0x7838('0x13')]);return _0x26dde6(_0x199c8c[_0x7838('0x12')]['message']);}else{logger[_0x7838('0x14')](_0x7838('0xf'),_0x36faad,_0x7838('0x15'));_0x26dde6(_0x199c8c[_0x7838('0x16')]['message']);}})[_0x7838('0x17')](function(_0x1d37fc){logger['error'](_0x7838('0xf'),_0x36faad,_0x1d37fc);_0x516115(_0x1d37fc);});});} \ No newline at end of file +var _0x661e=['then','AnalyticCustomReport,\x20%s,\x20%s','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request'];(function(_0x356033,_0x324f0d){var _0x54ce60=function(_0xc3ec8d){while(--_0xc3ec8d){_0x356033['push'](_0x356033['shift']());}};_0x54ce60(++_0x324f0d);}(_0x661e,0xf1));var _0xe661=function(_0x2df523,_0x481c11){_0x2df523=_0x2df523-0x0;var _0x4bd083=_0x661e[_0x2df523];return _0x4bd083;};'use strict';var _=require(_0xe661('0x0'));var util=require(_0xe661('0x1'));var moment=require(_0xe661('0x2'));var BPromise=require(_0xe661('0x3'));var rs=require(_0xe661('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe661('0x5'))['db'];var utils=require(_0xe661('0x6'));var logger=require('../../config/logger')(_0xe661('0x7'));var config=require(_0xe661('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xe661('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a3bca,_0x3bca97,_0x214756){return new BPromise(function(_0x435f6c,_0x4ab31c){return client[_0xe661('0xa')](_0x5a3bca,_0x214756)[_0xe661('0xb')](function(_0x430f04){logger['info'](_0xe661('0xc'),_0x3bca97,'request\x20sent');logger['debug'](_0xe661('0xd'),_0x3bca97,_0xe661('0xe'),JSON['stringify'](_0x430f04));if(_0x430f04[_0xe661('0xf')]){if(_0x430f04[_0xe661('0xf')][_0xe661('0x10')]===0x1f4){logger['error'](_0xe661('0xc'),_0x3bca97,_0x430f04['error'][_0xe661('0x11')]);return _0x4ab31c(_0x430f04[_0xe661('0xf')][_0xe661('0x11')]);}logger[_0xe661('0xf')](_0xe661('0xc'),_0x3bca97,_0x430f04[_0xe661('0xf')][_0xe661('0x11')]);return _0x435f6c(_0x430f04[_0xe661('0xf')][_0xe661('0x11')]);}else{logger[_0xe661('0x12')]('AnalyticCustomReport,\x20%s,\x20%s',_0x3bca97,_0xe661('0xe'));_0x435f6c(_0x430f04[_0xe661('0x13')][_0xe661('0x11')]);}})[_0xe661('0x14')](function(_0x1f3f82){logger[_0xe661('0xf')](_0xe661('0xc'),_0x3bca97,_0x1f3f82);_0x4ab31c(_0x1f3f82);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 8c18c8c..bd253fd 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 _0x1f93=['/:id/query','post','create','/:id','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id/preview','run'];(function(_0xcbc227,_0x17401c){var _0x518978=function(_0x3f1116){while(--_0x3f1116){_0xcbc227['push'](_0xcbc227['shift']());}};_0x518978(++_0x17401c);}(_0x1f93,0x148));var _0x31f9=function(_0x566a5b,_0x1322b5){_0x566a5b=_0x566a5b-0x0;var _0x47f9e7=_0x1f93[_0x566a5b];return _0x47f9e7;};'use strict';var multer=require(_0x31f9('0x0'));var util=require(_0x31f9('0x1'));var path=require(_0x31f9('0x2'));var timeout=require(_0x31f9('0x3'));var express=require(_0x31f9('0x4'));var router=express[_0x31f9('0x5')]();var fs_extra=require(_0x31f9('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x31f9('0x7'));var config=require(_0x31f9('0x8'));var controller=require('./analyticCustomReport.controller');router[_0x31f9('0x9')]('/',auth[_0x31f9('0xa')](),controller[_0x31f9('0xb')]);router[_0x31f9('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0x31f9('0xc'),auth[_0x31f9('0xa')](),controller['preview']);router['get']('/:id/run',auth[_0x31f9('0xa')](),controller[_0x31f9('0xd')]);router[_0x31f9('0x9')](_0x31f9('0xe'),auth[_0x31f9('0xa')](),controller['query']);router[_0x31f9('0xf')]('/',auth['isAuthenticated'](),controller[_0x31f9('0x10')]);router['put'](_0x31f9('0x11'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x31f9('0x11'),auth[_0x31f9('0xa')](),controller['destroy']);module[_0x31f9('0x12')]=router; \ No newline at end of file +var _0xa01d=['/:id','update','delete','destroy','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','show','/:id/preview','preview','/:id/run','run','query','post'];(function(_0x16ef39,_0x5d3f7a){var _0x733cef=function(_0x3de7ea){while(--_0x3de7ea){_0x16ef39['push'](_0x16ef39['shift']());}};_0x733cef(++_0x5d3f7a);}(_0xa01d,0x180));var _0xda01=function(_0x58dbf1,_0x2d2f16){_0x58dbf1=_0x58dbf1-0x0;var _0x4f4acc=_0xa01d[_0x58dbf1];return _0x4f4acc;};'use strict';var multer=require('multer');var util=require(_0xda01('0x0'));var path=require(_0xda01('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xda01('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xda01('0x3'));var interaction=require(_0xda01('0x4'));var config=require(_0xda01('0x5'));var controller=require(_0xda01('0x6'));router[_0xda01('0x7')]('/',auth[_0xda01('0x8')](),controller['index']);router[_0xda01('0x7')]('/:id',auth[_0xda01('0x8')](),controller[_0xda01('0x9')]);router[_0xda01('0x7')](_0xda01('0xa'),auth[_0xda01('0x8')](),controller[_0xda01('0xb')]);router[_0xda01('0x7')](_0xda01('0xc'),auth[_0xda01('0x8')](),controller[_0xda01('0xd')]);router[_0xda01('0x7')]('/:id/query',auth[_0xda01('0x8')](),controller[_0xda01('0xe')]);router[_0xda01('0xf')]('/',auth[_0xda01('0x8')](),controller['create']);router['put'](_0xda01('0x10'),auth[_0xda01('0x8')](),controller[_0xda01('0x11')]);router[_0xda01('0x12')](_0xda01('0x10'),auth[_0xda01('0x8')](),controller[_0xda01('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 6c2d6c2..8e98344 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 _0xdbf5=['exports','STRING','TEXT'];(function(_0x2c4383,_0x285fc4){var _0x4741c0=function(_0x5d486b){while(--_0x5d486b){_0x2c4383['push'](_0x2c4383['shift']());}};_0x4741c0(++_0x285fc4);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x48a403,_0x3a408a){_0x48a403=_0x48a403-0x0;var _0x22a8b1=_0xdbf5[_0x48a403];return _0x22a8b1;};'use strict';var Sequelize=require('sequelize');module[_0x5dbf('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x5dbf('0x1')]},'table':{'type':Sequelize[_0x5dbf('0x1')]},'conditions':{'type':Sequelize[_0x5dbf('0x2')]},'joins':{'type':Sequelize[_0x5dbf('0x2')]}}; \ No newline at end of file +var _0x7dfd=['STRING','TEXT','sequelize','exports'];(function(_0x5717a9,_0x4ca0f7){var _0x3577e9=function(_0x5ac3d9){while(--_0x5ac3d9){_0x5717a9['push'](_0x5717a9['shift']());}};_0x3577e9(++_0x4ca0f7);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xd7df('0x0'));module[_0xd7df('0x1')]={'name':{'type':Sequelize[_0xd7df('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xd7df('0x2')]},'parent':{'type':Sequelize[_0xd7df('0x2')]},'table':{'type':Sequelize[_0xd7df('0x2')]},'conditions':{'type':Sequelize[_0xd7df('0x3')]},'joins':{'type':Sequelize[_0xd7df('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index a0e5d33..c006862 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 _0x7a54=['options','AnalyticDefaultReport','includeAll','include','show','keys','attributes','create','body','user','role','get','Reports','UserProfileSection','userProfileId','UserProfileResource','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','params','right_join','cross_join','SUM(%s)','COUNT(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','DATE(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','group','condition','value','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','keyBy','select','from','MetricId','metric','field','function','replace','format','orderBy','DESC','joins','parse','type','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','table','conditions','debug','toString','sequelize','QueryTypes','SELECT','join','left_join','COUNT(DISTINCT\x20%s)','MAX(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','IS\x20EMPTY','operator','groupBy','alias','output','web','fullPath','%s-%s.%s','generate','default','AnalyticExtractedReport','cdr','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','info','Run\x20Query:','child_process','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','getFields','clone','Limited\x20Query:','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','dbH','sendStatus','status','end','json','limit','count','offset','Content-Range','apply','save','then','destroy','DefaultReports','error','stack','name','index','map','fieldName','model','query','filters','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge'];(function(_0x4489cd,_0x83d7ee){var _0x3d202c=function(_0x134751){while(--_0x134751){_0x4489cd['push'](_0x4489cd['shift']());}};_0x3d202c(++_0x83d7ee);}(_0x7a54,0x106));var _0x47a5=function(_0x38a6c7,_0x3ffe7b){_0x38a6c7=_0x38a6c7-0x0;var _0x41f6f6=_0x7a54[_0x38a6c7];return _0x41f6f6;};'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'];var dbH=require(_0x47a5('0x15'))[_0x47a5('0x16')];function respondWithStatusCode(_0x5beb89,_0x44bd3e){_0x44bd3e=_0x44bd3e||0xcc;return function(_0x221b54){if(_0x221b54){return _0x5beb89[_0x47a5('0x17')](_0x44bd3e);}return _0x5beb89[_0x47a5('0x18')](_0x44bd3e)[_0x47a5('0x19')]();};}function respondWithResult(_0x620ee9,_0x3c6c46){_0x3c6c46=_0x3c6c46||0xc8;return function(_0x190faa){if(_0x190faa){return _0x620ee9['status'](_0x3c6c46)[_0x47a5('0x1a')](_0x190faa);}};}function respondWithFilteredResult(_0x11faf5,_0x3b001e){return function(_0x2a2cbb){if(_0x2a2cbb){var _0x1ef44c=typeof _0x3b001e['offset']==='undefined'&&typeof _0x3b001e[_0x47a5('0x1b')]==='undefined';var _0x5247fd=_0x2a2cbb[_0x47a5('0x1c')];var _0xaf70a6=_0x1ef44c?0x0:_0x3b001e[_0x47a5('0x1d')];var _0x1ef371=_0x1ef44c?_0x2a2cbb[_0x47a5('0x1c')]:_0x3b001e[_0x47a5('0x1d')]+_0x3b001e[_0x47a5('0x1b')];var _0xe3c618;if(_0x1ef371>=_0x5247fd){_0x1ef371=_0x5247fd;_0xe3c618=0xc8;}else{_0xe3c618=0xce;}_0x11faf5[_0x47a5('0x18')](_0xe3c618);return _0x11faf5['set'](_0x47a5('0x1e'),_0xaf70a6+'-'+_0x1ef371+'/'+_0x5247fd)[_0x47a5('0x1a')](_0x2a2cbb);}return null;};}function patchUpdates(_0x47cf3c){return function(_0x2b0360){try{jsonpatch[_0x47a5('0x1f')](_0x2b0360,_0x47cf3c,!![]);}catch(_0x36874d){return BPromise['reject'](_0x36874d);}return _0x2b0360[_0x47a5('0x20')]();};}function saveUpdates(_0x2f142b,_0x23db32){return function(_0x7a9f9e){if(_0x7a9f9e){return _0x7a9f9e['update'](_0x2f142b)[_0x47a5('0x21')](function(_0x385687){return _0x385687;});}return null;};}function removeEntity(_0x513981,_0x28747d){return function(_0xc4cd63){if(_0xc4cd63){return _0xc4cd63[_0x47a5('0x22')]()[_0x47a5('0x21')](function(){var _0x3abd6a=_0xc4cd63['get']({'plain':!![]});var _0x53078a=_0x47a5('0x23');return db['UserProfileResource'][_0x47a5('0x22')]({'where':{'type':_0x53078a,'resourceId':_0x3abd6a['id']}})['then'](function(){return _0xc4cd63;});})[_0x47a5('0x21')](function(){_0x513981[_0x47a5('0x18')](0xcc)[_0x47a5('0x19')]();});}};}function handleEntityNotFound(_0x1dac65,_0x21f296){return function(_0x3ba0b7){if(!_0x3ba0b7){_0x1dac65[_0x47a5('0x17')](0x194);}return _0x3ba0b7;};}function handleError(_0x136b14,_0x16631f){_0x16631f=_0x16631f||0x1f4;return function(_0x361bfa){logger[_0x47a5('0x24')](_0x361bfa[_0x47a5('0x25')]);if(_0x361bfa[_0x47a5('0x26')]){delete _0x361bfa['name'];}_0x136b14[_0x47a5('0x18')](_0x16631f)['send'](_0x361bfa);};}exports[_0x47a5('0x27')]=function(_0x9ac908,_0x16901f){var _0x4d6b57={},_0x256650={},_0x625952={'count':0x0,'rows':[]};var _0x39b50b=_[_0x47a5('0x28')](db['AnalyticDefaultReport']['rawAttributes'],function(_0x6f9a12){return{'name':_0x6f9a12[_0x47a5('0x29')],'type':_0x6f9a12['type']['key']};});_0x256650[_0x47a5('0x2a')]=_[_0x47a5('0x28')](_0x39b50b,'name');_0x256650[_0x47a5('0x2b')]=_['keys'](_0x9ac908[_0x47a5('0x2b')]);_0x256650[_0x47a5('0x2c')]=_['intersection'](_0x256650['model'],_0x256650[_0x47a5('0x2b')]);_0x4d6b57['attributes']=_[_0x47a5('0x2d')](_0x256650[_0x47a5('0x2a')],qs[_0x47a5('0x2e')](_0x9ac908['query'][_0x47a5('0x2e')]));_0x4d6b57['attributes']=_0x4d6b57['attributes'][_0x47a5('0x2f')]?_0x4d6b57['attributes']:_0x256650[_0x47a5('0x2a')];if(!_0x9ac908['query'][_0x47a5('0x30')](_0x47a5('0x31'))){_0x4d6b57[_0x47a5('0x1b')]=qs[_0x47a5('0x1b')](_0x9ac908[_0x47a5('0x2b')][_0x47a5('0x1b')]);_0x4d6b57[_0x47a5('0x1d')]=qs[_0x47a5('0x1d')](_0x9ac908[_0x47a5('0x2b')]['offset']);}_0x4d6b57[_0x47a5('0x32')]=qs[_0x47a5('0x33')](_0x9ac908['query'][_0x47a5('0x33')]);_0x4d6b57[_0x47a5('0x34')]=qs[_0x47a5('0x2c')](_['pick'](_0x9ac908[_0x47a5('0x2b')],_0x256650[_0x47a5('0x2c')]),_0x39b50b);if(_0x9ac908['query'][_0x47a5('0x35')]){_0x4d6b57[_0x47a5('0x34')]=_['merge'](_0x4d6b57['where'],{'$or':_['map'](_0x39b50b,function(_0x12d9f2){if(_0x12d9f2['type']!==_0x47a5('0x36')){var _0x1f9631={};_0x1f9631[_0x12d9f2[_0x47a5('0x26')]]={'$like':'%'+_0x9ac908[_0x47a5('0x2b')][_0x47a5('0x35')]+'%'};return _0x1f9631;}})});}_0x4d6b57=_[_0x47a5('0x37')]({},_0x4d6b57,_0x9ac908[_0x47a5('0x38')]);var _0x1f3d01={'where':_0x4d6b57[_0x47a5('0x34')]};return db[_0x47a5('0x39')][_0x47a5('0x1c')](_0x1f3d01)[_0x47a5('0x21')](function(_0x23d6d8){_0x625952['count']=_0x23d6d8;if(_0x9ac908[_0x47a5('0x2b')][_0x47a5('0x3a')]){_0x4d6b57[_0x47a5('0x3b')]=[{'all':!![]}];}return db[_0x47a5('0x39')]['findAll'](_0x4d6b57);})[_0x47a5('0x21')](function(_0x528ef3){_0x625952['rows']=_0x528ef3;return _0x625952;})['then'](respondWithFilteredResult(_0x16901f,_0x4d6b57))['catch'](handleError(_0x16901f,null));};exports[_0x47a5('0x3c')]=function(_0x5ec4e5,_0x2bb502){var _0x3a740b={'raw':!![],'where':{'id':_0x5ec4e5['params']['id']}},_0x448610={};_0x448610[_0x47a5('0x2a')]=_[_0x47a5('0x3d')](db['AnalyticDefaultReport']['rawAttributes']);_0x448610[_0x47a5('0x2b')]=_['keys'](_0x5ec4e5[_0x47a5('0x2b')]);_0x448610[_0x47a5('0x2c')]=_[_0x47a5('0x2d')](_0x448610[_0x47a5('0x2a')],_0x448610[_0x47a5('0x2b')]);_0x3a740b[_0x47a5('0x3e')]=_[_0x47a5('0x2d')](_0x448610[_0x47a5('0x2a')],qs[_0x47a5('0x2e')](_0x5ec4e5[_0x47a5('0x2b')][_0x47a5('0x2e')]));_0x3a740b[_0x47a5('0x3e')]=_0x3a740b[_0x47a5('0x3e')][_0x47a5('0x2f')]?_0x3a740b[_0x47a5('0x3e')]:_0x448610[_0x47a5('0x2a')];if(_0x5ec4e5['query'][_0x47a5('0x3a')]){_0x3a740b[_0x47a5('0x3b')]=[{'all':!![]}];}_0x3a740b=_['merge']({},_0x3a740b,_0x5ec4e5['options']);return db[_0x47a5('0x39')]['find'](_0x3a740b)[_0x47a5('0x21')](handleEntityNotFound(_0x2bb502,null))[_0x47a5('0x21')](respondWithResult(_0x2bb502,null))['catch'](handleError(_0x2bb502,null));};exports['create']=function(_0x3d85cc,_0x52d409){return db[_0x47a5('0x39')][_0x47a5('0x3f')](_0x3d85cc[_0x47a5('0x40')],{})[_0x47a5('0x21')](function(_0x44fe8a){var _0x26acd2=_0x3d85cc[_0x47a5('0x41')]['get']({'plain':!![]});if(!_0x26acd2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x26acd2[_0x47a5('0x42')]===_0x47a5('0x41')){var _0x1163e3=_0x44fe8a[_0x47a5('0x43')]({'plain':!![]});var _0x2c7020=_0x47a5('0x44');return db[_0x47a5('0x45')]['find']({'where':{'name':_0x2c7020,'userProfileId':_0x26acd2[_0x47a5('0x46')]},'raw':!![]})[_0x47a5('0x21')](function(_0x5f6a){if(_0x5f6a&&_0x5f6a['autoAssociation']===0x0){return db[_0x47a5('0x47')]['create']({'name':_0x1163e3[_0x47a5('0x26')],'resourceId':_0x1163e3['id'],'type':_0x47a5('0x23'),'sectionId':_0x5f6a['id']},{})[_0x47a5('0x21')](function(){return _0x44fe8a;});}else{return _0x44fe8a;}})[_0x47a5('0x48')](function(_0x588551){logger[_0x47a5('0x24')](_0x47a5('0x49'),_0x588551);throw _0x588551;});}return _0x44fe8a;})[_0x47a5('0x21')](respondWithResult(_0x52d409,0xc9))[_0x47a5('0x48')](handleError(_0x52d409,null));};exports[_0x47a5('0x4a')]=function(_0x6a53b3,_0x24e9f4){if(_0x6a53b3['body']['id']){delete _0x6a53b3[_0x47a5('0x40')]['id'];}return db[_0x47a5('0x39')][_0x47a5('0x4b')]({'where':{'id':_0x6a53b3[_0x47a5('0x4c')]['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x24e9f4,null))[_0x47a5('0x21')](saveUpdates(_0x6a53b3['body'],null))[_0x47a5('0x21')](respondWithResult(_0x24e9f4,null))[_0x47a5('0x48')](handleError(_0x24e9f4,null));};exports[_0x47a5('0x22')]=function(_0x53871e,_0x4c5ed){return db[_0x47a5('0x39')][_0x47a5('0x4b')]({'where':{'id':_0x53871e['params']['id']}})['then'](handleEntityNotFound(_0x4c5ed,null))[_0x47a5('0x21')](removeEntity(_0x4c5ed,null))[_0x47a5('0x48')](handleError(_0x4c5ed,null));};exports['preview']=function(_0x4cf792,_0x6d6b2b){var _0x4d6a82=0xa;var _0x16bb8a=['join','left_join',_0x47a5('0x4d'),_0x47a5('0x4e')];var _0x53eedf={'SUM':_0x47a5('0x4f'),'COUNT':_0x47a5('0x50'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0x47a5('0x51'),'AVG':_0x47a5('0x52'),'GROUP_CONCAT':_0x47a5('0x53'),'GROUP_CONCAT ASC':_0x47a5('0x54'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x199621={'SEC_TO_TIME':_0x47a5('0x55'),'DATE':_0x47a5('0x56'),'HOUR':'HOUR(%s)','ROUND':_0x47a5('0x57'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x485e3c=function(_0x470da6){return!_[_0x47a5('0x58')]([_0x47a5('0x59'),_0x47a5('0x5a'),'IS\x20EMPTY',_0x47a5('0x5b')],_0x470da6);};var _0x5d1550=function(_0x5cbe97){if(!_0x5cbe97||!_0x5cbe97['rules']['length']){return'';}for(var _0x212d92='(',_0x6cd4ea=0x0;_0x6cd4ea<_0x5cbe97[_0x47a5('0x5c')]['length'];_0x6cd4ea+=0x1){_0x6cd4ea>0x0&&(_0x212d92+='\x20'+_0x5cbe97['operator']+'\x20');_0x212d92+=_0x5cbe97[_0x47a5('0x5c')][_0x6cd4ea][_0x47a5('0x5d')]?_0x5d1550(_0x5cbe97[_0x47a5('0x5c')][_0x6cd4ea][_0x47a5('0x5d')]):_0x5cbe97[_0x47a5('0x5c')][_0x6cd4ea]['field']+'\x20'+_0x5cbe97[_0x47a5('0x5c')][_0x6cd4ea]['condition']+(_0x485e3c(_0x5cbe97[_0x47a5('0x5c')][_0x6cd4ea][_0x47a5('0x5e')])?'\x20'+_0x5cbe97['rules'][_0x6cd4ea][_0x47a5('0x5f')]:'');}return _0x212d92+')';};var _0x345104={'where':{'id':_0x4cf792[_0x47a5('0x4c')]['id']}},_0x132854,_0x3e8274,_0x2d6494,_0x215634,_0x35cca8;_0x345104=_['merge']({},_0x345104,_0x4cf792[_0x47a5('0x38')]);return db[_0x47a5('0x39')][_0x47a5('0x4b')](_0x345104)[_0x47a5('0x21')](function(_0x396cb0){if(_0x396cb0){_0x132854=_0x396cb0;return _0x396cb0['getFields']();}return null;})[_0x47a5('0x21')](function(_0xdfcecc){if(_0xdfcecc){if(!_0xdfcecc[_0x47a5('0x2f')]){throw new db[(_0x47a5('0x60'))][(_0x47a5('0x61'))](_0x47a5('0x62'),0x193);}_0x3e8274=_0xdfcecc;return db[_0x47a5('0x63')][_0x47a5('0x64')]({'raw':!![]});}return null;})[_0x47a5('0x21')](function(_0x44cb90){if(_0x44cb90){_0x2d6494=_[_0x47a5('0x65')](_0x44cb90,'id');var _0x44fda9;var _0x3c0006=squel[_0x47a5('0x66')]();_0x3c0006[_0x47a5('0x67')](_0x132854['table']);for(var _0x42dd7d=0x0;_0x42dd7d<_0x3e8274[_0x47a5('0x2f')];_0x42dd7d+=0x1){_0x44fda9=_0x3e8274[_0x42dd7d][_0x47a5('0x68')]?_0x2d6494[_0x3e8274[_0x42dd7d]['MetricId']][_0x47a5('0x69')]:_0x3e8274[_0x42dd7d][_0x47a5('0x6a')];_0x44fda9=_0x3e8274[_0x42dd7d][_0x47a5('0x6b')]?_[_0x47a5('0x6c')](_0x53eedf[_0x3e8274[_0x42dd7d]['function']],'%s',_0x44fda9):_0x44fda9;_0x44fda9=_0x3e8274[_0x42dd7d][_0x47a5('0x6d')]?_['replace'](_0x199621[_0x3e8274[_0x42dd7d][_0x47a5('0x6d')]],'%s',_0x44fda9):_0x44fda9;if(_0x3e8274[_0x42dd7d]['groupBy']){_0x3c0006[_0x47a5('0x5d')](_0x44fda9);}_0x3e8274[_0x42dd7d]['orderBy']&&_0x3c0006[_0x47a5('0x32')](_0x44fda9,_0x3e8274[_0x42dd7d][_0x47a5('0x6e')]===_0x47a5('0x6f')?![]:!![]);_0x3c0006['field'](_0x44fda9,_0x3e8274[_0x42dd7d]['alias']||_0x44fda9);}if(_0x132854['joins']){_0x132854[_0x47a5('0x70')]=JSON[_0x47a5('0x71')](_0x132854[_0x47a5('0x70')]);for(var _0x117510=0x0;_0x117510<_0x132854['joins'][_0x47a5('0x2f')];_0x117510+=0x1){if(_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x72')]&&_[_0x47a5('0x58')](_0x16bb8a,_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x72')])&&_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x73')]&&_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x74')]&&_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x75')]){_0x3c0006[_0x132854['joins'][_0x117510][_0x47a5('0x72')]](_0x132854['joins'][_0x117510][_0x47a5('0x74')],null,util[_0x47a5('0x6d')](_0x47a5('0x76'),_0x132854[_0x47a5('0x77')],_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x73')],_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x74')],_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x75')]));}}}if(_0x132854[_0x47a5('0x78')]){_0x132854[_0x47a5('0x78')]=JSON[_0x47a5('0x71')](_0x132854[_0x47a5('0x78')]);_0x3c0006[_0x47a5('0x34')](_0x5d1550(_0x132854['conditions']['group']));}_0x35cca8=_0x3c0006['clone']();_0x3c0006['limit'](_0x4d6a82);_0x3c0006[_0x47a5('0x1d')](0x0);logger[_0x47a5('0x79')]('Limited\x20Query:',_0x3c0006[_0x47a5('0x7a')]());return dbH[_0x47a5('0x7b')][_0x47a5('0x2b')](_0x3c0006[_0x47a5('0x7a')](),{'type':dbH[_0x47a5('0x7b')][_0x47a5('0x7c')][_0x47a5('0x7d')]});}})[_0x47a5('0x21')](respondWithResult(_0x6d6b2b,null))[_0x47a5('0x48')](handleError(_0x6d6b2b,null));};function runReport(_0x1ffe3c,_0x24a6c1,_0x5e5f16){var _0x18fa31=_0x24a6c1[_0x47a5('0x26')];var _0x420671=0xa;var _0x4f35ff=[_0x47a5('0x7e'),_0x47a5('0x7f'),_0x47a5('0x4d'),'cross_join'];var _0x19dc8c={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x47a5('0x80'),'MAX':_0x47a5('0x81'),'MIN':_0x47a5('0x51'),'AVG':_0x47a5('0x52'),'GROUP_CONCAT':_0x47a5('0x53'),'GROUP_CONCAT ASC':_0x47a5('0x54'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x592322={'SEC_TO_TIME':_0x47a5('0x55'),'DATE':'DATE(%s)','HOUR':_0x47a5('0x82'),'ROUND':_0x47a5('0x57'),'UNIX_TIMESTAMP':_0x47a5('0x83')};var _0xb16bdd=function(_0x53ea2b){return!_[_0x47a5('0x58')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x47a5('0x84'),_0x47a5('0x5b')],_0x53ea2b);};var _0x5b91f7=function(_0x1926bd){if(!_0x1926bd||!_0x1926bd[_0x47a5('0x5c')][_0x47a5('0x2f')]){return'';}for(var _0x4c25ec='(',_0x280372=0x0;_0x280372<_0x1926bd['rules'][_0x47a5('0x2f')];_0x280372+=0x1){_0x280372>0x0&&(_0x4c25ec+='\x20'+_0x1926bd[_0x47a5('0x85')]+'\x20');_0x4c25ec+=_0x1926bd[_0x47a5('0x5c')][_0x280372]['group']?_0x5b91f7(_0x1926bd[_0x47a5('0x5c')][_0x280372][_0x47a5('0x5d')]):_0x1926bd[_0x47a5('0x5c')][_0x280372]['field']+'\x20'+_0x1926bd[_0x47a5('0x5c')][_0x280372]['condition']+(_0xb16bdd(_0x1926bd[_0x47a5('0x5c')][_0x280372]['condition'])?'\x20'+_0x1926bd[_0x47a5('0x5c')][_0x280372][_0x47a5('0x5f')]:'');}return _0x4c25ec+')';};var _0x20a742={'where':{'id':_0x1ffe3c['id']}},_0x211fbf,_0x51738b,_0x42fcce,_0x2ae130,_0x23c393;_0x20a742=_[_0x47a5('0x37')]({},_0x20a742,_0x5e5f16);return db[_0x47a5('0x39')]['find'](_0x20a742)['then'](function(_0x569550){if(_0x569550){_0x211fbf=_0x569550;return _0x569550['getFields']();}return null;})[_0x47a5('0x21')](function(_0xa8809a){if(_0xa8809a){if(!_0xa8809a[_0x47a5('0x2f')]){throw new db['Sequelize'][(_0x47a5('0x61'))](_0x47a5('0x62'),0x193);}_0x51738b=_0xa8809a;return db['AnalyticMetric'][_0x47a5('0x64')]({'raw':!![]});}return null;})[_0x47a5('0x21')](function(_0x19acfa){if(_0x19acfa){_0x42fcce=_[_0x47a5('0x65')](_0x19acfa,'id');var _0x58dacd;var _0x4b5353=squel[_0x47a5('0x66')]();_0x4b5353[_0x47a5('0x67')](_0x211fbf['table']);for(var _0x27d422=0x0;_0x27d422<_0x51738b[_0x47a5('0x2f')];_0x27d422+=0x1){_0x58dacd=_0x51738b[_0x27d422]['MetricId']?_0x42fcce[_0x51738b[_0x27d422][_0x47a5('0x68')]][_0x47a5('0x69')]:_0x51738b[_0x27d422][_0x47a5('0x6a')];_0x58dacd=_0x51738b[_0x27d422]['function']?_[_0x47a5('0x6c')](_0x19dc8c[_0x51738b[_0x27d422]['function']],'%s',_0x58dacd):_0x58dacd;_0x58dacd=_0x51738b[_0x27d422][_0x47a5('0x6d')]?_['replace'](_0x592322[_0x51738b[_0x27d422][_0x47a5('0x6d')]],'%s',_0x58dacd):_0x58dacd;if(_0x51738b[_0x27d422][_0x47a5('0x86')]){_0x4b5353['group'](_0x58dacd);}_0x51738b[_0x27d422][_0x47a5('0x6e')]&&_0x4b5353['order'](_0x58dacd,_0x51738b[_0x27d422][_0x47a5('0x6e')]===_0x47a5('0x6f')?![]:!![]);_0x4b5353[_0x47a5('0x6a')](_0x58dacd,_0x51738b[_0x27d422][_0x47a5('0x87')]||_0x58dacd);}if(_0x211fbf['joins']){_0x211fbf[_0x47a5('0x70')]=JSON['parse'](_0x211fbf['joins']);for(var _0x2bb2df=0x0;_0x2bb2df<_0x211fbf[_0x47a5('0x70')][_0x47a5('0x2f')];_0x2bb2df+=0x1){if(_0x211fbf[_0x47a5('0x70')][_0x2bb2df][_0x47a5('0x72')]&&_['includes'](_0x4f35ff,_0x211fbf[_0x47a5('0x70')][_0x2bb2df][_0x47a5('0x72')])&&_0x211fbf[_0x47a5('0x70')][_0x2bb2df][_0x47a5('0x73')]&&_0x211fbf['joins'][_0x2bb2df][_0x47a5('0x74')]&&_0x211fbf['joins'][_0x2bb2df][_0x47a5('0x75')]){_0x4b5353[_0x211fbf[_0x47a5('0x70')][_0x2bb2df][_0x47a5('0x72')]](_0x211fbf[_0x47a5('0x70')][_0x2bb2df][_0x47a5('0x74')],null,util[_0x47a5('0x6d')](_0x47a5('0x76'),_0x211fbf[_0x47a5('0x77')],_0x211fbf[_0x47a5('0x70')][_0x2bb2df]['parentKey'],_0x211fbf[_0x47a5('0x70')][_0x2bb2df][_0x47a5('0x74')],_0x211fbf['joins'][_0x2bb2df][_0x47a5('0x75')]));}}}if(_0x211fbf[_0x47a5('0x78')]){_0x211fbf[_0x47a5('0x78')]=JSON['parse'](_0x211fbf['conditions']);_0x4b5353[_0x47a5('0x34')](_0x5b91f7(_0x211fbf[_0x47a5('0x78')]['group']));}_0x23c393=_0x4b5353['clone']();_0x4b5353[_0x47a5('0x1b')](_0x420671);_0x4b5353[_0x47a5('0x1d')](0x0);return;}})['then'](function(){if(_0x24a6c1[_0x47a5('0x88')]===_0x47a5('0x89')){return null;}var _0x4c9e6a=_[_0x47a5('0x37')](_0x24a6c1,{'name':_0x24a6c1[_0x47a5('0x8a')]||_0x24a6c1[_0x47a5('0x26')]||_0x211fbf[_0x47a5('0x26')],'basename':_0x18fa31,'savename':util[_0x47a5('0x6d')](_0x47a5('0x8b'),_0x24a6c1['name']||_0x211fbf['name'],require('randomstring')[_0x47a5('0x8c')](0x4),_0x24a6c1[_0x47a5('0x88')]||'csv'),'reportId':_0x211fbf['id'],'reportType':_0x47a5('0x8d')});return db[_0x47a5('0x8e')][_0x47a5('0x3f')](_0x4c9e6a,{'raw':!![]});})[_0x47a5('0x21')](function(_0xcdbfd7){if(_0x211fbf['table']===_0x47a5('0x8f')){_0x23c393['where'](_0x211fbf['table']+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x24a6c1[_0x47a5('0x90')],_0x24a6c1['endDate']);}else{_0x23c393[_0x47a5('0x34')](_0x211fbf[_0x47a5('0x77')]+_0x47a5('0x91'),_0x24a6c1['startDate'],_0x24a6c1[_0x47a5('0x92')]);}if(_0xcdbfd7){logger[_0x47a5('0x93')](_0x47a5('0x94'),_0x23c393[_0x47a5('0x7a')]());require(_0x47a5('0x95'))['fork'](path[_0x47a5('0x7e')](__dirname,_0x47a5('0x96'),_0xcdbfd7['output']),[_0xcdbfd7['id'],_0x23c393[_0x47a5('0x7a')](),path[_0x47a5('0x7e')](__dirname,_0x47a5('0x97'),_0xcdbfd7[_0x47a5('0x98')]),_0x18fa31]);return _0xcdbfd7;}else{var _0x3c117a=squel[_0x47a5('0x66')]();_0x3c117a['from']('('+_0x23c393[_0x47a5('0x7a')]()+')',_0x47a5('0x99'));_0x3c117a['field'](_0x47a5('0x9a'),_0x47a5('0x1c'));_0x23c393[_0x47a5('0x1b')](_0x24a6c1[_0x47a5('0x1b')]||_0x420671);_0x23c393['offset'](_0x24a6c1['offset']||0x0);return dbH['sequelize']['query'](_0x3c117a[_0x47a5('0x7a')](),{'type':dbH[_0x47a5('0x7b')][_0x47a5('0x7c')][_0x47a5('0x7d')]})[_0x47a5('0x21')](function(_0x6bc37b){if(!_0x6bc37b[_0x47a5('0x2f')]){_0x2ae130=0x0;}else{_0x2ae130=_0x6bc37b[0x0][_0x47a5('0x1c')]||0x0;}return dbH['sequelize'][_0x47a5('0x2b')](_0x23c393[_0x47a5('0x7a')](),{'type':dbH[_0x47a5('0x7b')][_0x47a5('0x7c')]['SELECT']});})['then'](function(_0x3770ae){return{'rows':_0x3770ae||[],'count':_0x2ae130};});}});}exports['run']=function(_0x4cb8e4,_0x1b6a5c){return runReport(_0x4cb8e4[_0x47a5('0x4c')],_0x4cb8e4['query'],_0x4cb8e4[_0x47a5('0x38')])[_0x47a5('0x21')](respondWithResult(_0x1b6a5c,null))[_0x47a5('0x48')](handleError(_0x1b6a5c,null));};exports['runReport']=runReport;exports[_0x47a5('0x2b')]=function(_0xee23c7,_0x48a491){var _0x1172fd=0xa;var _0x280b7b=[_0x47a5('0x7e'),_0x47a5('0x7f'),_0x47a5('0x4d'),_0x47a5('0x4e')];var _0x482c87={'SUM':_0x47a5('0x4f'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x47a5('0x80'),'MAX':_0x47a5('0x81'),'MIN':_0x47a5('0x51'),'AVG':_0x47a5('0x52'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x47a5('0x54'),'GROUP_CONCAT DESC':_0x47a5('0x9b')};var _0x151540={'SEC_TO_TIME':_0x47a5('0x55'),'DATE':_0x47a5('0x56'),'HOUR':_0x47a5('0x82'),'ROUND':_0x47a5('0x57'),'UNIX_TIMESTAMP':_0x47a5('0x83')};var _0x1b3e82=function(_0xa2045c){return!_[_0x47a5('0x58')]([_0x47a5('0x59'),'IS\x20NOT\x20NULL',_0x47a5('0x84'),_0x47a5('0x5b')],_0xa2045c);};var _0x591bde=function(_0x55d955){if(!_0x55d955||!_0x55d955[_0x47a5('0x5c')][_0x47a5('0x2f')]){return'';}for(var _0x2ccf21='(',_0x2ff467=0x0;_0x2ff467<_0x55d955['rules'][_0x47a5('0x2f')];_0x2ff467+=0x1){_0x2ff467>0x0&&(_0x2ccf21+='\x20'+_0x55d955[_0x47a5('0x85')]+'\x20');_0x2ccf21+=_0x55d955[_0x47a5('0x5c')][_0x2ff467][_0x47a5('0x5d')]?_0x591bde(_0x55d955[_0x47a5('0x5c')][_0x2ff467][_0x47a5('0x5d')]):_0x55d955[_0x47a5('0x5c')][_0x2ff467]['field']+'\x20'+_0x55d955['rules'][_0x2ff467][_0x47a5('0x5e')]+(_0x1b3e82(_0x55d955['rules'][_0x2ff467][_0x47a5('0x5e')])?'\x20'+_0x55d955['rules'][_0x2ff467][_0x47a5('0x5f')]:'');}return _0x2ccf21+')';};var _0x8b4354={'where':{'id':_0xee23c7[_0x47a5('0x4c')]['id']}},_0x134c1a,_0x2bc7ae,_0x49cb8c,_0x220557,_0x11f07b;_0x8b4354=_['merge']({},_0x8b4354,_0xee23c7['options']);return db[_0x47a5('0x39')][_0x47a5('0x4b')](_0x8b4354)[_0x47a5('0x21')](function(_0xfccf9c){if(_0xfccf9c){_0x134c1a=_0xfccf9c;return _0xfccf9c[_0x47a5('0x9c')]();}return null;})[_0x47a5('0x21')](function(_0x1c0323){if(_0x1c0323){if(!_0x1c0323[_0x47a5('0x2f')]){throw new db['Sequelize'][(_0x47a5('0x61'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x2bc7ae=_0x1c0323;return db[_0x47a5('0x63')][_0x47a5('0x64')]({'raw':!![]});}return null;})['then'](function(_0x48d4cf){if(_0x48d4cf){_0x49cb8c=_[_0x47a5('0x65')](_0x48d4cf,'id');var _0x41d2da;var _0x530387=squel[_0x47a5('0x66')]();_0x530387[_0x47a5('0x67')](_0x134c1a[_0x47a5('0x77')]);for(var _0x44567e=0x0;_0x44567e<_0x2bc7ae['length'];_0x44567e+=0x1){_0x41d2da=_0x2bc7ae[_0x44567e][_0x47a5('0x68')]?_0x49cb8c[_0x2bc7ae[_0x44567e]['MetricId']]['metric']:_0x2bc7ae[_0x44567e]['field'];_0x41d2da=_0x2bc7ae[_0x44567e][_0x47a5('0x6b')]?_['replace'](_0x482c87[_0x2bc7ae[_0x44567e][_0x47a5('0x6b')]],'%s',_0x41d2da):_0x41d2da;_0x41d2da=_0x2bc7ae[_0x44567e][_0x47a5('0x6d')]?_[_0x47a5('0x6c')](_0x151540[_0x2bc7ae[_0x44567e][_0x47a5('0x6d')]],'%s',_0x41d2da):_0x41d2da;if(_0x2bc7ae[_0x44567e][_0x47a5('0x86')]){_0x530387[_0x47a5('0x5d')](_0x41d2da);}_0x2bc7ae[_0x44567e][_0x47a5('0x6e')]&&_0x530387[_0x47a5('0x32')](_0x41d2da,_0x2bc7ae[_0x44567e][_0x47a5('0x6e')]===_0x47a5('0x6f')?![]:!![]);_0x530387[_0x47a5('0x6a')](_0x41d2da,_0x2bc7ae[_0x44567e][_0x47a5('0x87')]||_0x41d2da);}if(_0x134c1a[_0x47a5('0x70')]){_0x134c1a[_0x47a5('0x70')]=JSON[_0x47a5('0x71')](_0x134c1a['joins']);for(var _0xdd95c8=0x0;_0xdd95c8<_0x134c1a[_0x47a5('0x70')][_0x47a5('0x2f')];_0xdd95c8+=0x1){if(_0x134c1a[_0x47a5('0x70')][_0xdd95c8]['type']&&_[_0x47a5('0x58')](_0x280b7b,_0x134c1a['joins'][_0xdd95c8][_0x47a5('0x72')])&&_0x134c1a['joins'][_0xdd95c8][_0x47a5('0x73')]&&_0x134c1a[_0x47a5('0x70')][_0xdd95c8][_0x47a5('0x74')]&&_0x134c1a['joins'][_0xdd95c8][_0x47a5('0x75')]){_0x530387[_0x134c1a[_0x47a5('0x70')][_0xdd95c8][_0x47a5('0x72')]](_0x134c1a['joins'][_0xdd95c8]['foreignTable'],null,util[_0x47a5('0x6d')](_0x47a5('0x76'),_0x134c1a[_0x47a5('0x77')],_0x134c1a[_0x47a5('0x70')][_0xdd95c8][_0x47a5('0x73')],_0x134c1a['joins'][_0xdd95c8][_0x47a5('0x74')],_0x134c1a['joins'][_0xdd95c8][_0x47a5('0x75')]));}}}if(_0x134c1a[_0x47a5('0x78')]){_0x134c1a[_0x47a5('0x78')]=JSON[_0x47a5('0x71')](_0x134c1a['conditions']);_0x530387['where'](_0x591bde(_0x134c1a[_0x47a5('0x78')][_0x47a5('0x5d')]));}_0x11f07b=_0x530387[_0x47a5('0x9d')]();_0x530387[_0x47a5('0x1b')](_0x1172fd);_0x530387[_0x47a5('0x1d')](0x0);logger[_0x47a5('0x79')](_0x47a5('0x9e'),_0x530387[_0x47a5('0x7a')]());return dbH[_0x47a5('0x7b')]['query'](_0x530387['toString'](),{'type':dbH[_0x47a5('0x7b')]['QueryTypes'][_0x47a5('0x7d')]});}})[_0x47a5('0x21')](function(){return{'sql':_0x11f07b[_0x47a5('0x7a')]()};})['then'](respondWithResult(_0x48a491,null))[_0x47a5('0x48')](handleError(_0x48a491,null));}; \ No newline at end of file +var _0x687b=['util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','get','DefaultReports','UserProfileResource','destroy','sendStatus','error','name','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','order','sort','where','pick','VIRTUAL','filter','options','findAll','catch','params','intersection','includeAll','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Reports','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','left_join','right_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','merge','getFields','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','alias','joins','parse','foreignTable','foreignKey','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SUM(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ValidationErrorItem','DESC','parentKey','web','fullPath','%s-%s.%s','output','csv','default','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','Run\x20Query:','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','SELECT','run','runReport','cross_join','%s.%s\x20=\x20%s.%s','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x687b,0x14a));var _0xb687=function(_0x2ffcb1,_0x559b0d){_0x2ffcb1=_0x2ffcb1-0x0;var _0x333da2=_0x687b[_0x2ffcb1];return _0x333da2;};'use strict';var emlformat=require(_0xb687('0x0'));var rimraf=require(_0xb687('0x1'));var zipdir=require(_0xb687('0x2'));var jsonpatch=require(_0xb687('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb687('0x4'));var Mustache=require(_0xb687('0x5'));var util=require(_0xb687('0x6'));var path=require(_0xb687('0x7'));var sox=require(_0xb687('0x8'));var csv=require(_0xb687('0x9'));var ejs=require(_0xb687('0xa'));var fs=require('fs');var fs_extra=require(_0xb687('0xb'));var _=require(_0xb687('0xc'));var squel=require(_0xb687('0xd'));var crypto=require('crypto');var jsforce=require(_0xb687('0xe'));var deskjs=require(_0xb687('0xf'));var toCsv=require('to-csv');var querystring=require(_0xb687('0x10'));var Papa=require(_0xb687('0x11'));var Redis=require(_0xb687('0x12'));var authService=require(_0xb687('0x13'));var qs=require(_0xb687('0x14'));var as=require(_0xb687('0x15'));var hardwareService=require(_0xb687('0x16'));var logger=require(_0xb687('0x17'))(_0xb687('0x18'));var utils=require('../../config/utils');var config=require(_0xb687('0x19'));var licenseUtil=require(_0xb687('0x1a'));var db=require(_0xb687('0x1b'))['db'];var dbH=require(_0xb687('0x1b'))['dbH'];function respondWithStatusCode(_0x4c97ed,_0x3e85b3){_0x3e85b3=_0x3e85b3||0xcc;return function(_0x155ebe){if(_0x155ebe){return _0x4c97ed['sendStatus'](_0x3e85b3);}return _0x4c97ed[_0xb687('0x1c')](_0x3e85b3)[_0xb687('0x1d')]();};}function respondWithResult(_0x1f1f35,_0x30d502){_0x30d502=_0x30d502||0xc8;return function(_0x838dd4){if(_0x838dd4){return _0x1f1f35[_0xb687('0x1c')](_0x30d502)[_0xb687('0x1e')](_0x838dd4);}};}function respondWithFilteredResult(_0x141375,_0x263085){return function(_0x2c7a18){if(_0x2c7a18){var _0x25124a=typeof _0x263085[_0xb687('0x1f')]==='undefined'&&typeof _0x263085[_0xb687('0x20')]===_0xb687('0x21');var _0x30d370=_0x2c7a18['count'];var _0x48958d=_0x25124a?0x0:_0x263085[_0xb687('0x1f')];var _0x3a10ef=_0x25124a?_0x2c7a18[_0xb687('0x22')]:_0x263085['offset']+_0x263085[_0xb687('0x20')];var _0x481f1d;if(_0x3a10ef>=_0x30d370){_0x3a10ef=_0x30d370;_0x481f1d=0xc8;}else{_0x481f1d=0xce;}_0x141375[_0xb687('0x1c')](_0x481f1d);return _0x141375[_0xb687('0x23')](_0xb687('0x24'),_0x48958d+'-'+_0x3a10ef+'/'+_0x30d370)[_0xb687('0x1e')](_0x2c7a18);}return null;};}function patchUpdates(_0x49d5a1){return function(_0x3a73d5){try{jsonpatch['apply'](_0x3a73d5,_0x49d5a1,!![]);}catch(_0x335541){return BPromise[_0xb687('0x25')](_0x335541);}return _0x3a73d5[_0xb687('0x26')]();};}function saveUpdates(_0x546fde,_0x1dc06b){return function(_0x491623){if(_0x491623){return _0x491623[_0xb687('0x27')](_0x546fde)[_0xb687('0x28')](function(_0xbf6c58){return _0xbf6c58;});}return null;};}function removeEntity(_0x38866c,_0xf48ba4){return function(_0x2f0a0a){if(_0x2f0a0a){return _0x2f0a0a['destroy']()[_0xb687('0x28')](function(){var _0x129347=_0x2f0a0a[_0xb687('0x29')]({'plain':!![]});var _0x1a0261=_0xb687('0x2a');return db[_0xb687('0x2b')][_0xb687('0x2c')]({'where':{'type':_0x1a0261,'resourceId':_0x129347['id']}})[_0xb687('0x28')](function(){return _0x2f0a0a;});})[_0xb687('0x28')](function(){_0x38866c[_0xb687('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3712cf,_0x192966){return function(_0x392721){if(!_0x392721){_0x3712cf[_0xb687('0x2d')](0x194);}return _0x392721;};}function handleError(_0x2e5c8d,_0x173c58){_0x173c58=_0x173c58||0x1f4;return function(_0x4e9a06){logger[_0xb687('0x2e')](_0x4e9a06['stack']);if(_0x4e9a06[_0xb687('0x2f')]){delete _0x4e9a06[_0xb687('0x2f')];}_0x2e5c8d[_0xb687('0x1c')](_0x173c58)[_0xb687('0x30')](_0x4e9a06);};}exports[_0xb687('0x31')]=function(_0x43d20d,_0xf1f0dd){var _0x556815={},_0x3da2be={},_0xe3428f={'count':0x0,'rows':[]};var _0x3c08ab=_[_0xb687('0x32')](db[_0xb687('0x33')][_0xb687('0x34')],function(_0x44be88){return{'name':_0x44be88[_0xb687('0x35')],'type':_0x44be88[_0xb687('0x36')][_0xb687('0x37')]};});_0x3da2be[_0xb687('0x38')]=_['map'](_0x3c08ab,'name');_0x3da2be[_0xb687('0x39')]=_[_0xb687('0x3a')](_0x43d20d[_0xb687('0x39')]);_0x3da2be[_0xb687('0x3b')]=_['intersection'](_0x3da2be['model'],_0x3da2be[_0xb687('0x39')]);_0x556815[_0xb687('0x3c')]=_['intersection'](_0x3da2be[_0xb687('0x38')],qs[_0xb687('0x3d')](_0x43d20d['query'][_0xb687('0x3d')]));_0x556815['attributes']=_0x556815[_0xb687('0x3c')][_0xb687('0x3e')]?_0x556815[_0xb687('0x3c')]:_0x3da2be[_0xb687('0x38')];if(!_0x43d20d[_0xb687('0x39')][_0xb687('0x3f')]('nolimit')){_0x556815[_0xb687('0x20')]=qs[_0xb687('0x20')](_0x43d20d[_0xb687('0x39')][_0xb687('0x20')]);_0x556815['offset']=qs[_0xb687('0x1f')](_0x43d20d[_0xb687('0x39')][_0xb687('0x1f')]);}_0x556815[_0xb687('0x40')]=qs[_0xb687('0x41')](_0x43d20d['query'][_0xb687('0x41')]);_0x556815[_0xb687('0x42')]=qs[_0xb687('0x3b')](_[_0xb687('0x43')](_0x43d20d[_0xb687('0x39')],_0x3da2be[_0xb687('0x3b')]),_0x3c08ab);if(_0x43d20d['query']['filter']){_0x556815[_0xb687('0x42')]=_['merge'](_0x556815[_0xb687('0x42')],{'$or':_[_0xb687('0x32')](_0x3c08ab,function(_0x48d3b1){if(_0x48d3b1[_0xb687('0x36')]!==_0xb687('0x44')){var _0x57776b={};_0x57776b[_0x48d3b1[_0xb687('0x2f')]]={'$like':'%'+_0x43d20d[_0xb687('0x39')][_0xb687('0x45')]+'%'};return _0x57776b;}})});}_0x556815=_['merge']({},_0x556815,_0x43d20d[_0xb687('0x46')]);var _0x9cffb2={'where':_0x556815[_0xb687('0x42')]};return db[_0xb687('0x33')][_0xb687('0x22')](_0x9cffb2)[_0xb687('0x28')](function(_0x21b9ef){_0xe3428f['count']=_0x21b9ef;if(_0x43d20d[_0xb687('0x39')]['includeAll']){_0x556815['include']=[{'all':!![]}];}return db[_0xb687('0x33')][_0xb687('0x47')](_0x556815);})['then'](function(_0x19a21c){_0xe3428f['rows']=_0x19a21c;return _0xe3428f;})[_0xb687('0x28')](respondWithFilteredResult(_0xf1f0dd,_0x556815))[_0xb687('0x48')](handleError(_0xf1f0dd,null));};exports['show']=function(_0x4cb7a0,_0x3a8509){var _0x5d9cb0={'raw':!![],'where':{'id':_0x4cb7a0[_0xb687('0x49')]['id']}},_0x247c67={};_0x247c67[_0xb687('0x38')]=_[_0xb687('0x3a')](db[_0xb687('0x33')][_0xb687('0x34')]);_0x247c67[_0xb687('0x39')]=_[_0xb687('0x3a')](_0x4cb7a0[_0xb687('0x39')]);_0x247c67[_0xb687('0x3b')]=_[_0xb687('0x4a')](_0x247c67[_0xb687('0x38')],_0x247c67['query']);_0x5d9cb0[_0xb687('0x3c')]=_['intersection'](_0x247c67[_0xb687('0x38')],qs[_0xb687('0x3d')](_0x4cb7a0[_0xb687('0x39')][_0xb687('0x3d')]));_0x5d9cb0[_0xb687('0x3c')]=_0x5d9cb0[_0xb687('0x3c')]['length']?_0x5d9cb0['attributes']:_0x247c67[_0xb687('0x38')];if(_0x4cb7a0[_0xb687('0x39')][_0xb687('0x4b')]){_0x5d9cb0[_0xb687('0x4c')]=[{'all':!![]}];}_0x5d9cb0=_['merge']({},_0x5d9cb0,_0x4cb7a0[_0xb687('0x46')]);return db[_0xb687('0x33')][_0xb687('0x4d')](_0x5d9cb0)[_0xb687('0x28')](handleEntityNotFound(_0x3a8509,null))['then'](respondWithResult(_0x3a8509,null))[_0xb687('0x48')](handleError(_0x3a8509,null));};exports[_0xb687('0x4e')]=function(_0x162b19,_0x401b99){return db['AnalyticDefaultReport']['create'](_0x162b19[_0xb687('0x4f')],{})[_0xb687('0x28')](function(_0x42b61a){var _0x508862=_0x162b19['user'][_0xb687('0x29')]({'plain':!![]});if(!_0x508862)throw new Error(_0xb687('0x50'));if(_0x508862[_0xb687('0x51')]===_0xb687('0x52')){var _0x34205d=_0x42b61a[_0xb687('0x29')]({'plain':!![]});var _0x602864=_0xb687('0x53');return db['UserProfileSection'][_0xb687('0x4d')]({'where':{'name':_0x602864,'userProfileId':_0x508862[_0xb687('0x54')]},'raw':!![]})[_0xb687('0x28')](function(_0x4f5784){if(_0x4f5784&&_0x4f5784['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x34205d[_0xb687('0x2f')],'resourceId':_0x34205d['id'],'type':_0xb687('0x2a'),'sectionId':_0x4f5784['id']},{})[_0xb687('0x28')](function(){return _0x42b61a;});}else{return _0x42b61a;}})[_0xb687('0x48')](function(_0x1ddfd4){logger[_0xb687('0x2e')](_0xb687('0x55'),_0x1ddfd4);throw _0x1ddfd4;});}return _0x42b61a;})[_0xb687('0x28')](respondWithResult(_0x401b99,0xc9))[_0xb687('0x48')](handleError(_0x401b99,null));};exports[_0xb687('0x27')]=function(_0x128264,_0x166900){if(_0x128264[_0xb687('0x4f')]['id']){delete _0x128264[_0xb687('0x4f')]['id'];}return db[_0xb687('0x33')][_0xb687('0x4d')]({'where':{'id':_0x128264[_0xb687('0x49')]['id']}})['then'](handleEntityNotFound(_0x166900,null))['then'](saveUpdates(_0x128264[_0xb687('0x4f')],null))[_0xb687('0x28')](respondWithResult(_0x166900,null))[_0xb687('0x48')](handleError(_0x166900,null));};exports[_0xb687('0x2c')]=function(_0x4e5642,_0xfa8790){return db[_0xb687('0x33')]['find']({'where':{'id':_0x4e5642[_0xb687('0x49')]['id']}})['then'](handleEntityNotFound(_0xfa8790,null))[_0xb687('0x28')](removeEntity(_0xfa8790,null))[_0xb687('0x48')](handleError(_0xfa8790,null));};exports['preview']=function(_0x4fb188,_0x13ad6a){var _0x4ab9c5=0xa;var _0x5ea8fd=[_0xb687('0x56'),_0xb687('0x57'),_0xb687('0x58'),'cross_join'];var _0x25e140={'SUM':'SUM(%s)','COUNT':_0xb687('0x59'),'COUNT DISTINCT':_0xb687('0x5a'),'MAX':_0xb687('0x5b'),'MIN':_0xb687('0x5c'),'AVG':_0xb687('0x5d'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xb687('0x5e')};var _0x58ec8b={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0xb687('0x5f'),'UNIX_TIMESTAMP':_0xb687('0x60')};var _0xbc3a94=function(_0x4bc18f){return!_[_0xb687('0x61')]([_0xb687('0x62'),_0xb687('0x63'),_0xb687('0x64'),_0xb687('0x65')],_0x4bc18f);};var _0x17505c=function(_0x132e3a){if(!_0x132e3a||!_0x132e3a['rules']['length']){return'';}for(var _0x2714c6='(',_0x4906df=0x0;_0x4906df<_0x132e3a[_0xb687('0x66')][_0xb687('0x3e')];_0x4906df+=0x1){_0x4906df>0x0&&(_0x2714c6+='\x20'+_0x132e3a[_0xb687('0x67')]+'\x20');_0x2714c6+=_0x132e3a[_0xb687('0x66')][_0x4906df][_0xb687('0x68')]?_0x17505c(_0x132e3a['rules'][_0x4906df][_0xb687('0x68')]):_0x132e3a['rules'][_0x4906df][_0xb687('0x69')]+'\x20'+_0x132e3a[_0xb687('0x66')][_0x4906df][_0xb687('0x6a')]+(_0xbc3a94(_0x132e3a[_0xb687('0x66')][_0x4906df][_0xb687('0x6a')])?'\x20'+_0x132e3a[_0xb687('0x66')][_0x4906df][_0xb687('0x6b')]:'');}return _0x2714c6+')';};var _0x5deb7a={'where':{'id':_0x4fb188['params']['id']}},_0x28a6aa,_0x31ed20,_0x8942b7,_0x36bb4b,_0x258caf;_0x5deb7a=_[_0xb687('0x6c')]({},_0x5deb7a,_0x4fb188[_0xb687('0x46')]);return db[_0xb687('0x33')][_0xb687('0x4d')](_0x5deb7a)[_0xb687('0x28')](function(_0x15ef44){if(_0x15ef44){_0x28a6aa=_0x15ef44;return _0x15ef44[_0xb687('0x6d')]();}return null;})[_0xb687('0x28')](function(_0x177ea4){if(_0x177ea4){if(!_0x177ea4[_0xb687('0x3e')]){throw new db[(_0xb687('0x6e'))]['ValidationErrorItem'](_0xb687('0x6f'),0x193);}_0x31ed20=_0x177ea4;return db[_0xb687('0x70')][_0xb687('0x47')]({'raw':!![]});}return null;})[_0xb687('0x28')](function(_0x505f7a){if(_0x505f7a){_0x8942b7=_[_0xb687('0x71')](_0x505f7a,'id');var _0x1a6075;var _0x53b00a=squel[_0xb687('0x72')]();_0x53b00a[_0xb687('0x73')](_0x28a6aa[_0xb687('0x74')]);for(var _0x5eeb75=0x0;_0x5eeb75<_0x31ed20[_0xb687('0x3e')];_0x5eeb75+=0x1){_0x1a6075=_0x31ed20[_0x5eeb75][_0xb687('0x75')]?_0x8942b7[_0x31ed20[_0x5eeb75]['MetricId']][_0xb687('0x76')]:_0x31ed20[_0x5eeb75][_0xb687('0x69')];_0x1a6075=_0x31ed20[_0x5eeb75][_0xb687('0x77')]?_[_0xb687('0x78')](_0x25e140[_0x31ed20[_0x5eeb75]['function']],'%s',_0x1a6075):_0x1a6075;_0x1a6075=_0x31ed20[_0x5eeb75][_0xb687('0x79')]?_[_0xb687('0x78')](_0x58ec8b[_0x31ed20[_0x5eeb75]['format']],'%s',_0x1a6075):_0x1a6075;if(_0x31ed20[_0x5eeb75][_0xb687('0x7a')]){_0x53b00a[_0xb687('0x68')](_0x1a6075);}_0x31ed20[_0x5eeb75]['orderBy']&&_0x53b00a['order'](_0x1a6075,_0x31ed20[_0x5eeb75][_0xb687('0x7b')]==='DESC'?![]:!![]);_0x53b00a[_0xb687('0x69')](_0x1a6075,_0x31ed20[_0x5eeb75][_0xb687('0x7c')]||_0x1a6075);}if(_0x28a6aa[_0xb687('0x7d')]){_0x28a6aa[_0xb687('0x7d')]=JSON[_0xb687('0x7e')](_0x28a6aa[_0xb687('0x7d')]);for(var _0x229bc4=0x0;_0x229bc4<_0x28a6aa[_0xb687('0x7d')]['length'];_0x229bc4+=0x1){if(_0x28a6aa[_0xb687('0x7d')][_0x229bc4][_0xb687('0x36')]&&_[_0xb687('0x61')](_0x5ea8fd,_0x28a6aa[_0xb687('0x7d')][_0x229bc4][_0xb687('0x36')])&&_0x28a6aa[_0xb687('0x7d')][_0x229bc4]['parentKey']&&_0x28a6aa[_0xb687('0x7d')][_0x229bc4][_0xb687('0x7f')]&&_0x28a6aa['joins'][_0x229bc4][_0xb687('0x80')]){_0x53b00a[_0x28a6aa[_0xb687('0x7d')][_0x229bc4][_0xb687('0x36')]](_0x28a6aa[_0xb687('0x7d')][_0x229bc4]['foreignTable'],null,util[_0xb687('0x79')]('%s.%s\x20=\x20%s.%s',_0x28a6aa['table'],_0x28a6aa[_0xb687('0x7d')][_0x229bc4]['parentKey'],_0x28a6aa['joins'][_0x229bc4][_0xb687('0x7f')],_0x28a6aa['joins'][_0x229bc4][_0xb687('0x80')]));}}}if(_0x28a6aa[_0xb687('0x81')]){_0x28a6aa['conditions']=JSON[_0xb687('0x7e')](_0x28a6aa[_0xb687('0x81')]);_0x53b00a['where'](_0x17505c(_0x28a6aa[_0xb687('0x81')][_0xb687('0x68')]));}_0x258caf=_0x53b00a[_0xb687('0x82')]();_0x53b00a[_0xb687('0x20')](_0x4ab9c5);_0x53b00a[_0xb687('0x1f')](0x0);logger[_0xb687('0x83')](_0xb687('0x84'),_0x53b00a[_0xb687('0x85')]());return dbH[_0xb687('0x86')][_0xb687('0x39')](_0x53b00a[_0xb687('0x85')](),{'type':dbH['sequelize'][_0xb687('0x87')]['SELECT']});}})['then'](respondWithResult(_0x13ad6a,null))[_0xb687('0x48')](handleError(_0x13ad6a,null));};function runReport(_0x29e830,_0x22ebca,_0xfecb8d){var _0x3a7339=_0x22ebca['name'];var _0x59c94b=0xa;var _0x29e27e=[_0xb687('0x56'),_0xb687('0x57'),_0xb687('0x58'),'cross_join'];var _0x448d59={'SUM':_0xb687('0x88'),'COUNT':_0xb687('0x59'),'COUNT DISTINCT':_0xb687('0x5a'),'MAX':_0xb687('0x5b'),'MIN':_0xb687('0x5c'),'AVG':_0xb687('0x5d'),'GROUP_CONCAT':_0xb687('0x89'),'GROUP_CONCAT ASC':_0xb687('0x8a'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x25f5c3={'SEC_TO_TIME':_0xb687('0x8b'),'DATE':_0xb687('0x8c'),'HOUR':_0xb687('0x8d'),'ROUND':_0xb687('0x5f'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x1037b1=function(_0x3bf480){return!_['includes']([_0xb687('0x62'),'IS\x20NOT\x20NULL',_0xb687('0x64'),_0xb687('0x65')],_0x3bf480);};var _0x5ec5f6=function(_0x1c683e){if(!_0x1c683e||!_0x1c683e[_0xb687('0x66')]['length']){return'';}for(var _0x231caa='(',_0x3479c5=0x0;_0x3479c5<_0x1c683e[_0xb687('0x66')][_0xb687('0x3e')];_0x3479c5+=0x1){_0x3479c5>0x0&&(_0x231caa+='\x20'+_0x1c683e[_0xb687('0x67')]+'\x20');_0x231caa+=_0x1c683e[_0xb687('0x66')][_0x3479c5]['group']?_0x5ec5f6(_0x1c683e[_0xb687('0x66')][_0x3479c5][_0xb687('0x68')]):_0x1c683e[_0xb687('0x66')][_0x3479c5][_0xb687('0x69')]+'\x20'+_0x1c683e[_0xb687('0x66')][_0x3479c5][_0xb687('0x6a')]+(_0x1037b1(_0x1c683e[_0xb687('0x66')][_0x3479c5][_0xb687('0x6a')])?'\x20'+_0x1c683e[_0xb687('0x66')][_0x3479c5][_0xb687('0x6b')]:'');}return _0x231caa+')';};var _0x290ddf={'where':{'id':_0x29e830['id']}},_0x5ee585,_0x10fb0,_0x5be566,_0x3d98e2,_0x3aa1c8;_0x290ddf=_['merge']({},_0x290ddf,_0xfecb8d);return db['AnalyticDefaultReport'][_0xb687('0x4d')](_0x290ddf)[_0xb687('0x28')](function(_0x3b4acf){if(_0x3b4acf){_0x5ee585=_0x3b4acf;return _0x3b4acf[_0xb687('0x6d')]();}return null;})[_0xb687('0x28')](function(_0x1c3de0){if(_0x1c3de0){if(!_0x1c3de0[_0xb687('0x3e')]){throw new db[(_0xb687('0x6e'))][(_0xb687('0x8e'))](_0xb687('0x6f'),0x193);}_0x10fb0=_0x1c3de0;return db[_0xb687('0x70')][_0xb687('0x47')]({'raw':!![]});}return null;})[_0xb687('0x28')](function(_0x1ea6fd){if(_0x1ea6fd){_0x5be566=_[_0xb687('0x71')](_0x1ea6fd,'id');var _0x3f45b7;var _0x508550=squel['select']();_0x508550[_0xb687('0x73')](_0x5ee585['table']);for(var _0x5f2557=0x0;_0x5f2557<_0x10fb0[_0xb687('0x3e')];_0x5f2557+=0x1){_0x3f45b7=_0x10fb0[_0x5f2557][_0xb687('0x75')]?_0x5be566[_0x10fb0[_0x5f2557]['MetricId']][_0xb687('0x76')]:_0x10fb0[_0x5f2557][_0xb687('0x69')];_0x3f45b7=_0x10fb0[_0x5f2557]['function']?_[_0xb687('0x78')](_0x448d59[_0x10fb0[_0x5f2557][_0xb687('0x77')]],'%s',_0x3f45b7):_0x3f45b7;_0x3f45b7=_0x10fb0[_0x5f2557][_0xb687('0x79')]?_[_0xb687('0x78')](_0x25f5c3[_0x10fb0[_0x5f2557][_0xb687('0x79')]],'%s',_0x3f45b7):_0x3f45b7;if(_0x10fb0[_0x5f2557][_0xb687('0x7a')]){_0x508550[_0xb687('0x68')](_0x3f45b7);}_0x10fb0[_0x5f2557][_0xb687('0x7b')]&&_0x508550[_0xb687('0x40')](_0x3f45b7,_0x10fb0[_0x5f2557]['orderBy']===_0xb687('0x8f')?![]:!![]);_0x508550[_0xb687('0x69')](_0x3f45b7,_0x10fb0[_0x5f2557]['alias']||_0x3f45b7);}if(_0x5ee585[_0xb687('0x7d')]){_0x5ee585['joins']=JSON[_0xb687('0x7e')](_0x5ee585[_0xb687('0x7d')]);for(var _0x59166c=0x0;_0x59166c<_0x5ee585[_0xb687('0x7d')][_0xb687('0x3e')];_0x59166c+=0x1){if(_0x5ee585[_0xb687('0x7d')][_0x59166c][_0xb687('0x36')]&&_[_0xb687('0x61')](_0x29e27e,_0x5ee585[_0xb687('0x7d')][_0x59166c][_0xb687('0x36')])&&_0x5ee585['joins'][_0x59166c]['parentKey']&&_0x5ee585[_0xb687('0x7d')][_0x59166c]['foreignTable']&&_0x5ee585[_0xb687('0x7d')][_0x59166c][_0xb687('0x80')]){_0x508550[_0x5ee585[_0xb687('0x7d')][_0x59166c][_0xb687('0x36')]](_0x5ee585['joins'][_0x59166c][_0xb687('0x7f')],null,util[_0xb687('0x79')]('%s.%s\x20=\x20%s.%s',_0x5ee585[_0xb687('0x74')],_0x5ee585[_0xb687('0x7d')][_0x59166c][_0xb687('0x90')],_0x5ee585[_0xb687('0x7d')][_0x59166c][_0xb687('0x7f')],_0x5ee585[_0xb687('0x7d')][_0x59166c]['foreignKey']));}}}if(_0x5ee585[_0xb687('0x81')]){_0x5ee585[_0xb687('0x81')]=JSON[_0xb687('0x7e')](_0x5ee585[_0xb687('0x81')]);_0x508550[_0xb687('0x42')](_0x5ec5f6(_0x5ee585[_0xb687('0x81')][_0xb687('0x68')]));}_0x3aa1c8=_0x508550[_0xb687('0x82')]();_0x508550[_0xb687('0x20')](_0x59c94b);_0x508550[_0xb687('0x1f')](0x0);return;}})['then'](function(){if(_0x22ebca['output']===_0xb687('0x91')){return null;}var _0x1a7cd8=_[_0xb687('0x6c')](_0x22ebca,{'name':_0x22ebca[_0xb687('0x92')]||_0x22ebca[_0xb687('0x2f')]||_0x5ee585[_0xb687('0x2f')],'basename':_0x3a7339,'savename':util[_0xb687('0x79')](_0xb687('0x93'),_0x22ebca[_0xb687('0x2f')]||_0x5ee585['name'],require('randomstring')['generate'](0x4),_0x22ebca[_0xb687('0x94')]||_0xb687('0x95')),'reportId':_0x5ee585['id'],'reportType':_0xb687('0x96')});return db[_0xb687('0x97')][_0xb687('0x4e')](_0x1a7cd8,{'raw':!![]});})[_0xb687('0x28')](function(_0x473130){if(_0x5ee585[_0xb687('0x74')]==='cdr'){_0x3aa1c8[_0xb687('0x42')](_0x5ee585[_0xb687('0x74')]+_0xb687('0x98'),_0x22ebca[_0xb687('0x99')],_0x22ebca[_0xb687('0x9a')]);}else{_0x3aa1c8[_0xb687('0x42')](_0x5ee585[_0xb687('0x74')]+_0xb687('0x9b'),_0x22ebca['startDate'],_0x22ebca[_0xb687('0x9a')]);}if(_0x473130){logger['info'](_0xb687('0x9c'),_0x3aa1c8[_0xb687('0x85')]());require('child_process')[_0xb687('0x9d')](path[_0xb687('0x56')](__dirname,_0xb687('0x9e'),_0x473130['output']),[_0x473130['id'],_0x3aa1c8[_0xb687('0x85')](),path[_0xb687('0x56')](__dirname,_0xb687('0x9f'),_0x473130[_0xb687('0xa0')]),_0x3a7339]);return _0x473130;}else{var _0x3d4596=squel[_0xb687('0x72')]();_0x3d4596[_0xb687('0x73')]('('+_0x3aa1c8['toString']()+')',_0xb687('0xa1'));_0x3d4596[_0xb687('0x69')](_0xb687('0xa2'),_0xb687('0x22'));_0x3aa1c8[_0xb687('0x20')](_0x22ebca['limit']||_0x59c94b);_0x3aa1c8[_0xb687('0x1f')](_0x22ebca[_0xb687('0x1f')]||0x0);return dbH[_0xb687('0x86')]['query'](_0x3d4596[_0xb687('0x85')](),{'type':dbH['sequelize'][_0xb687('0x87')][_0xb687('0xa3')]})['then'](function(_0x3dbbd6){if(!_0x3dbbd6[_0xb687('0x3e')]){_0x3d98e2=0x0;}else{_0x3d98e2=_0x3dbbd6[0x0][_0xb687('0x22')]||0x0;}return dbH['sequelize'][_0xb687('0x39')](_0x3aa1c8[_0xb687('0x85')](),{'type':dbH[_0xb687('0x86')][_0xb687('0x87')][_0xb687('0xa3')]});})[_0xb687('0x28')](function(_0x15e599){return{'rows':_0x15e599||[],'count':_0x3d98e2};});}});}exports[_0xb687('0xa4')]=function(_0x8f6ba0,_0x568aca){return runReport(_0x8f6ba0[_0xb687('0x49')],_0x8f6ba0[_0xb687('0x39')],_0x8f6ba0[_0xb687('0x46')])['then'](respondWithResult(_0x568aca,null))['catch'](handleError(_0x568aca,null));};exports[_0xb687('0xa5')]=runReport;exports['query']=function(_0x187810,_0x1d21ef){var _0x386d12=0xa;var _0x4dd8f4=['join',_0xb687('0x57'),_0xb687('0x58'),_0xb687('0xa6')];var _0x295795={'SUM':_0xb687('0x88'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xb687('0x5a'),'MAX':_0xb687('0x5b'),'MIN':'MIN(%s)','AVG':_0xb687('0x5d'),'GROUP_CONCAT':_0xb687('0x89'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xb687('0x5e')};var _0xe7056c={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xb687('0x8c'),'HOUR':_0xb687('0x8d'),'ROUND':_0xb687('0x5f'),'UNIX_TIMESTAMP':_0xb687('0x60')};var _0x1b1cf5=function(_0x46283c){return!_[_0xb687('0x61')](['IS\x20NULL',_0xb687('0x63'),'IS\x20EMPTY',_0xb687('0x65')],_0x46283c);};var _0x394ed6=function(_0x875169){if(!_0x875169||!_0x875169[_0xb687('0x66')]['length']){return'';}for(var _0x1ec485='(',_0x55a919=0x0;_0x55a919<_0x875169['rules'][_0xb687('0x3e')];_0x55a919+=0x1){_0x55a919>0x0&&(_0x1ec485+='\x20'+_0x875169[_0xb687('0x67')]+'\x20');_0x1ec485+=_0x875169[_0xb687('0x66')][_0x55a919]['group']?_0x394ed6(_0x875169[_0xb687('0x66')][_0x55a919][_0xb687('0x68')]):_0x875169['rules'][_0x55a919][_0xb687('0x69')]+'\x20'+_0x875169['rules'][_0x55a919][_0xb687('0x6a')]+(_0x1b1cf5(_0x875169[_0xb687('0x66')][_0x55a919]['condition'])?'\x20'+_0x875169[_0xb687('0x66')][_0x55a919]['value']:'');}return _0x1ec485+')';};var _0x2aecd5={'where':{'id':_0x187810[_0xb687('0x49')]['id']}},_0x58955e,_0x488a2a,_0x303738,_0x3904a3,_0x581338;_0x2aecd5=_['merge']({},_0x2aecd5,_0x187810[_0xb687('0x46')]);return db[_0xb687('0x33')][_0xb687('0x4d')](_0x2aecd5)['then'](function(_0xc29834){if(_0xc29834){_0x58955e=_0xc29834;return _0xc29834[_0xb687('0x6d')]();}return null;})[_0xb687('0x28')](function(_0x1f2f2b){if(_0x1f2f2b){if(!_0x1f2f2b[_0xb687('0x3e')]){throw new db[(_0xb687('0x6e'))]['ValidationErrorItem'](_0xb687('0x6f'),0x193);}_0x488a2a=_0x1f2f2b;return db[_0xb687('0x70')][_0xb687('0x47')]({'raw':!![]});}return null;})[_0xb687('0x28')](function(_0x3591e2){if(_0x3591e2){_0x303738=_['keyBy'](_0x3591e2,'id');var _0x4d0c14;var _0x200b55=squel[_0xb687('0x72')]();_0x200b55[_0xb687('0x73')](_0x58955e[_0xb687('0x74')]);for(var _0x33f4de=0x0;_0x33f4de<_0x488a2a[_0xb687('0x3e')];_0x33f4de+=0x1){_0x4d0c14=_0x488a2a[_0x33f4de][_0xb687('0x75')]?_0x303738[_0x488a2a[_0x33f4de]['MetricId']][_0xb687('0x76')]:_0x488a2a[_0x33f4de][_0xb687('0x69')];_0x4d0c14=_0x488a2a[_0x33f4de][_0xb687('0x77')]?_['replace'](_0x295795[_0x488a2a[_0x33f4de][_0xb687('0x77')]],'%s',_0x4d0c14):_0x4d0c14;_0x4d0c14=_0x488a2a[_0x33f4de][_0xb687('0x79')]?_[_0xb687('0x78')](_0xe7056c[_0x488a2a[_0x33f4de]['format']],'%s',_0x4d0c14):_0x4d0c14;if(_0x488a2a[_0x33f4de][_0xb687('0x7a')]){_0x200b55[_0xb687('0x68')](_0x4d0c14);}_0x488a2a[_0x33f4de]['orderBy']&&_0x200b55[_0xb687('0x40')](_0x4d0c14,_0x488a2a[_0x33f4de][_0xb687('0x7b')]===_0xb687('0x8f')?![]:!![]);_0x200b55[_0xb687('0x69')](_0x4d0c14,_0x488a2a[_0x33f4de]['alias']||_0x4d0c14);}if(_0x58955e[_0xb687('0x7d')]){_0x58955e[_0xb687('0x7d')]=JSON[_0xb687('0x7e')](_0x58955e[_0xb687('0x7d')]);for(var _0xcff220=0x0;_0xcff220<_0x58955e['joins'][_0xb687('0x3e')];_0xcff220+=0x1){if(_0x58955e[_0xb687('0x7d')][_0xcff220]['type']&&_[_0xb687('0x61')](_0x4dd8f4,_0x58955e[_0xb687('0x7d')][_0xcff220]['type'])&&_0x58955e[_0xb687('0x7d')][_0xcff220][_0xb687('0x90')]&&_0x58955e[_0xb687('0x7d')][_0xcff220]['foreignTable']&&_0x58955e[_0xb687('0x7d')][_0xcff220][_0xb687('0x80')]){_0x200b55[_0x58955e['joins'][_0xcff220]['type']](_0x58955e['joins'][_0xcff220][_0xb687('0x7f')],null,util['format'](_0xb687('0xa7'),_0x58955e[_0xb687('0x74')],_0x58955e[_0xb687('0x7d')][_0xcff220][_0xb687('0x90')],_0x58955e[_0xb687('0x7d')][_0xcff220]['foreignTable'],_0x58955e['joins'][_0xcff220][_0xb687('0x80')]));}}}if(_0x58955e[_0xb687('0x81')]){_0x58955e[_0xb687('0x81')]=JSON[_0xb687('0x7e')](_0x58955e[_0xb687('0x81')]);_0x200b55[_0xb687('0x42')](_0x394ed6(_0x58955e[_0xb687('0x81')]['group']));}_0x581338=_0x200b55['clone']();_0x200b55['limit'](_0x386d12);_0x200b55[_0xb687('0x1f')](0x0);logger[_0xb687('0x83')](_0xb687('0x84'),_0x200b55['toString']());return dbH['sequelize']['query'](_0x200b55[_0xb687('0x85')](),{'type':dbH['sequelize'][_0xb687('0x87')][_0xb687('0xa3')]});}})[_0xb687('0x28')](function(){return{'sql':_0x581338[_0xb687('0x85')]()};})[_0xb687('0x28')](respondWithResult(_0x1d21ef,null))[_0xb687('0x48')](handleError(_0x1d21ef,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index f7e10ce..3487b57 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 _0x21eb=['analytics_default_reports','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','AnalyticDefaultReport'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x21eb,0x17d));var _0xb21e=function(_0x5a15a2,_0x4b9dd7){_0x5a15a2=_0x5a15a2-0x0;var _0x5affbb=_0x21eb[_0x5a15a2];return _0x5affbb;};'use strict';var _=require(_0xb21e('0x0'));var util=require('util');var logger=require(_0xb21e('0x1'))(_0xb21e('0x2'));var moment=require(_0xb21e('0x3'));var BPromise=require(_0xb21e('0x4'));var rp=require(_0xb21e('0x5'));var fs=require('fs');var path=require(_0xb21e('0x6'));var rimraf=require('rimraf');var config=require(_0xb21e('0x7'));var attributes=require('./analyticDefaultReport.attributes');module['exports']=function(_0x15a75d,_0x200106){return _0x15a75d['define'](_0xb21e('0x8'),attributes,{'tableName':_0xb21e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb5e0=['api','bluebird','request-promise','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','define','analytics_default_reports','util'];(function(_0x5b9875,_0x590bb7){var _0x325246=function(_0x3b6328){while(--_0x3b6328){_0x5b9875['push'](_0x5b9875['shift']());}};_0x325246(++_0x590bb7);}(_0xb5e0,0x185));var _0x0b5e=function(_0x20447d,_0x47372e){_0x20447d=_0x20447d-0x0;var _0x3bcb23=_0xb5e0[_0x20447d];return _0x3bcb23;};'use strict';var _=require('lodash');var util=require(_0x0b5e('0x0'));var logger=require('../../config/logger')(_0x0b5e('0x1'));var moment=require('moment');var BPromise=require(_0x0b5e('0x2'));var rp=require(_0x0b5e('0x3'));var fs=require('fs');var path=require(_0x0b5e('0x4'));var rimraf=require(_0x0b5e('0x5'));var config=require(_0x0b5e('0x6'));var attributes=require(_0x0b5e('0x7'));module['exports']=function(_0x3a75e2,_0x1cbddd){return _0x3a75e2[_0x0b5e('0x8')]('AnalyticDefaultReport',attributes,{'tableName':_0x0b5e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index fe7f47f..22d6de9 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 _0x088f=['request\x20sent','debug','stringify','error','AnalyticDefaultReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info'];(function(_0x57a620,_0x1d4059){var _0x51e715=function(_0x123c83){while(--_0x123c83){_0x57a620['push'](_0x57a620['shift']());}};_0x51e715(++_0x1d4059);}(_0x088f,0x9b));var _0xf088=function(_0x4e4d02,_0x282a72){_0x4e4d02=_0x4e4d02-0x0;var _0x559bd0=_0x088f[_0x4e4d02];return _0x559bd0;};'use strict';var _=require(_0xf088('0x0'));var util=require(_0xf088('0x1'));var moment=require(_0xf088('0x2'));var BPromise=require(_0xf088('0x3'));var rs=require(_0xf088('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf088('0x5'));var logger=require(_0xf088('0x6'))(_0xf088('0x7'));var config=require(_0xf088('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf088('0x9')][_0xf088('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1af5eb,_0x637d98,_0x340f3c){return new BPromise(function(_0x415089,_0x586ef2){return client['request'](_0x1af5eb,_0x340f3c)[_0xf088('0xb')](function(_0x3caa2a){logger[_0xf088('0xc')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x637d98,_0xf088('0xd'));logger[_0xf088('0xe')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x637d98,'request\x20sent',JSON[_0xf088('0xf')](_0x3caa2a));if(_0x3caa2a[_0xf088('0x10')]){if(_0x3caa2a['error']['code']===0x1f4){logger[_0xf088('0x10')](_0xf088('0x11'),_0x637d98,_0x3caa2a[_0xf088('0x10')][_0xf088('0x12')]);return _0x586ef2(_0x3caa2a['error'][_0xf088('0x12')]);}logger[_0xf088('0x10')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x637d98,_0x3caa2a[_0xf088('0x10')][_0xf088('0x12')]);return _0x415089(_0x3caa2a[_0xf088('0x10')][_0xf088('0x12')]);}else{logger['info']('AnalyticDefaultReport,\x20%s,\x20%s',_0x637d98,_0xf088('0xd'));_0x415089(_0x3caa2a[_0xf088('0x13')][_0xf088('0x12')]);}})[_0xf088('0x14')](function(_0x1fea8a){logger['error'](_0xf088('0x11'),_0x637d98,_0x1fea8a);_0x586ef2(_0x1fea8a);});});} \ No newline at end of file +var _0x71c9=['../../config/logger','../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','error','code','AnalyticDefaultReport,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x220bcc,_0x1d20cb){var _0x431c3f=function(_0x1c77f1){while(--_0x1c77f1){_0x220bcc['push'](_0x220bcc['shift']());}};_0x431c3f(++_0x1d20cb);}(_0x71c9,0xfe));var _0x971c=function(_0x1db6d8,_0x35530f){_0x1db6d8=_0x1db6d8-0x0;var _0x22044a=_0x71c9[_0x1db6d8];return _0x22044a;};'use strict';var _=require('lodash');var util=require(_0x971c('0x0'));var moment=require(_0x971c('0x1'));var BPromise=require(_0x971c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x971c('0x3'));var db=require(_0x971c('0x4'))['db'];var utils=require(_0x971c('0x5'));var logger=require(_0x971c('0x6'))('rpc');var config=require(_0x971c('0x7'));var jayson=require(_0x971c('0x8'));var client=jayson[_0x971c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x37f41d,_0x12c469,_0x46441b){return new BPromise(function(_0xc8b296,_0x10473c){return client[_0x971c('0xa')](_0x37f41d,_0x46441b)[_0x971c('0xb')](function(_0x24f490){logger['info']('AnalyticDefaultReport,\x20%s,\x20%s',_0x12c469,_0x971c('0xc'));logger[_0x971c('0xd')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x12c469,_0x971c('0xc'),JSON['stringify'](_0x24f490));if(_0x24f490[_0x971c('0xe')]){if(_0x24f490[_0x971c('0xe')][_0x971c('0xf')]===0x1f4){logger[_0x971c('0xe')](_0x971c('0x10'),_0x12c469,_0x24f490[_0x971c('0xe')][_0x971c('0x11')]);return _0x10473c(_0x24f490[_0x971c('0xe')][_0x971c('0x11')]);}logger[_0x971c('0xe')](_0x971c('0x10'),_0x12c469,_0x24f490['error'][_0x971c('0x11')]);return _0xc8b296(_0x24f490[_0x971c('0xe')][_0x971c('0x11')]);}else{logger['info'](_0x971c('0x10'),_0x12c469,'request\x20sent');_0xc8b296(_0x24f490[_0x971c('0x12')][_0x971c('0x11')]);}})[_0x971c('0x13')](function(_0x14a66c){logger[_0x971c('0xe')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x12c469,_0x14a66c);_0x10473c(_0x14a66c);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 56ee123..9a6f2f0 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 _0x45a4=['delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/:id','show','get','/:id/preview','/:id/run','run','/:id/query','query','create','put'];(function(_0x3e0b8f,_0x1cddeb){var _0x22f742=function(_0xacb1bc){while(--_0xacb1bc){_0x3e0b8f['push'](_0x3e0b8f['shift']());}};_0x22f742(++_0x1cddeb);}(_0x45a4,0xc3));var _0x445a=function(_0x33c444,_0x4507c4){_0x33c444=_0x33c444-0x0;var _0x4149d1=_0x45a4[_0x33c444];return _0x4149d1;};'use strict';var multer=require('multer');var util=require(_0x445a('0x0'));var path=require(_0x445a('0x1'));var timeout=require(_0x445a('0x2'));var express=require(_0x445a('0x3'));var router=express[_0x445a('0x4')]();var fs_extra=require(_0x445a('0x5'));var auth=require(_0x445a('0x6'));var interaction=require(_0x445a('0x7'));var config=require(_0x445a('0x8'));var controller=require('./analyticDefaultReport.controller');router['get']('/',auth[_0x445a('0x9')](),controller[_0x445a('0xa')]);router['get'](_0x445a('0xb'),auth[_0x445a('0x9')](),controller[_0x445a('0xc')]);router[_0x445a('0xd')](_0x445a('0xe'),auth['isAuthenticated'](),controller['preview']);router[_0x445a('0xd')](_0x445a('0xf'),auth[_0x445a('0x9')](),controller[_0x445a('0x10')]);router[_0x445a('0xd')](_0x445a('0x11'),auth[_0x445a('0x9')](),controller[_0x445a('0x12')]);router['post']('/',auth['isAuthenticated'](),controller[_0x445a('0x13')]);router[_0x445a('0x14')](_0x445a('0xb'),auth[_0x445a('0x9')](),controller['update']);router[_0x445a('0x15')](_0x445a('0xb'),auth[_0x445a('0x9')](),controller[_0x445a('0x16')]);module[_0x445a('0x17')]=router; \ No newline at end of file +var _0x4e99=['post','create','/:id','update','destroy','exports','multer','util','connect-timeout','fs-extra','../../components/interaction/service','get','index','isAuthenticated','/:id/preview','preview','/:id/run','run','query'];(function(_0x2fe989,_0x370c54){var _0x22d5d8=function(_0x2beb9d){while(--_0x2beb9d){_0x2fe989['push'](_0x2fe989['shift']());}};_0x22d5d8(++_0x370c54);}(_0x4e99,0x110));var _0x94e9=function(_0x51513a,_0x334d08){_0x51513a=_0x51513a-0x0;var _0x11accb=_0x4e99[_0x51513a];return _0x11accb;};'use strict';var multer=require(_0x94e9('0x0'));var util=require(_0x94e9('0x1'));var path=require('path');var timeout=require(_0x94e9('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x94e9('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x94e9('0x4'));var config=require('../../config/environment');var controller=require('./analyticDefaultReport.controller');router[_0x94e9('0x5')]('/',auth['isAuthenticated'](),controller[_0x94e9('0x6')]);router[_0x94e9('0x5')]('/:id',auth[_0x94e9('0x7')](),controller['show']);router[_0x94e9('0x5')](_0x94e9('0x8'),auth[_0x94e9('0x7')](),controller[_0x94e9('0x9')]);router[_0x94e9('0x5')](_0x94e9('0xa'),auth[_0x94e9('0x7')](),controller[_0x94e9('0xb')]);router['get']('/:id/query',auth[_0x94e9('0x7')](),controller[_0x94e9('0xc')]);router[_0x94e9('0xd')]('/',auth['isAuthenticated'](),controller[_0x94e9('0xe')]);router['put'](_0x94e9('0xf'),auth[_0x94e9('0x7')](),controller[_0x94e9('0x10')]);router['delete']('/:id',auth[_0x94e9('0x7')](),controller[_0x94e9('0x11')]);module[_0x94e9('0x12')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index afb8dd1..42c69fc 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 _0xef7a=['sequelize','moment','exports','STRING','ENUM','csv','DATE','Loading','manual','scheduled','INTEGER','UNSIGNED'];(function(_0x223deb,_0x3da12c){var _0x4ee672=function(_0xf4368a){while(--_0xf4368a){_0x223deb['push'](_0x223deb['shift']());}};_0x4ee672(++_0x3da12c);}(_0xef7a,0x114));var _0xaef7=function(_0x285376,_0x5e7d62){_0x285376=_0x285376-0x0;var _0x76d003=_0xef7a[_0x285376];return _0x76d003;};'use strict';var Sequelize=require(_0xaef7('0x0'));var moment=require(_0xaef7('0x1'));module[_0xaef7('0x2')]={'name':{'type':Sequelize[_0xaef7('0x3')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize[_0xaef7('0x4')](_0xaef7('0x5'),'pdf','xlsx'),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize[_0xaef7('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0xaef7('0x6')]},'endDate':{'type':Sequelize[_0xaef7('0x6')]},'status':{'type':Sequelize['STRING'],'defaultValue':_0xaef7('0x7')},'type':{'type':Sequelize[_0xaef7('0x4')](_0xaef7('0x8'),_0xaef7('0x9')),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize[_0xaef7('0xa')](0xb)[_0xaef7('0xb')]},'reportType':{'type':Sequelize[_0xaef7('0x3')]}}; \ No newline at end of file +var _0xd572=['xlsx','DATE','Loading','manual','UNSIGNED','sequelize','moment','STRING','ENUM','pdf'];(function(_0x1dac7a,_0x1828ce){var _0x4cb363=function(_0x80f6de){while(--_0x80f6de){_0x1dac7a['push'](_0x1dac7a['shift']());}};_0x4cb363(++_0x1828ce);}(_0xd572,0x13b));var _0x2d57=function(_0x5b7f11,_0x4092c9){_0x5b7f11=_0x5b7f11-0x0;var _0x4c7e17=_0xd572[_0x5b7f11];return _0x4c7e17;};'use strict';var Sequelize=require(_0x2d57('0x0'));var moment=require(_0x2d57('0x1'));module['exports']={'name':{'type':Sequelize[_0x2d57('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0x2d57('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0x2d57('0x3')]('csv',_0x2d57('0x4'),_0x2d57('0x5')),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0x2d57('0x6')]},'status':{'type':Sequelize[_0x2d57('0x2')],'defaultValue':_0x2d57('0x7')},'type':{'type':Sequelize[_0x2d57('0x3')](_0x2d57('0x8'),'scheduled'),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0x2d57('0x9')]},'reportType':{'type':Sequelize[_0x2d57('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 6381f31..3844f8b 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 _0x2b7e=['catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','ExtractedReports','UserProfileSection','autoAssociation','body','download','savename','existsSync','join','root','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','%s.%s','basename','output','toLowerCase','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','UserProfileResource','error','stack','name','index','map','AnalyticExtractedReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','include','find'];(function(_0x41c88c,_0x381f8d){var _0x2c97ea=function(_0x35fd44){while(--_0x35fd44){_0x41c88c['push'](_0x41c88c['shift']());}};_0x2c97ea(++_0x381f8d);}(_0x2b7e,0xe1));var _0xe2b7=function(_0x1b12bc,_0x21df0b){_0x1b12bc=_0x1b12bc-0x0;var _0x2da7ee=_0x2b7e[_0x1b12bc];return _0x2da7ee;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe2b7('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe2b7('0x1'));var rp=require(_0xe2b7('0x2'));var moment=require(_0xe2b7('0x3'));var BPromise=require(_0xe2b7('0x4'));var Mustache=require('mustache');var util=require(_0xe2b7('0x5'));var path=require(_0xe2b7('0x6'));var sox=require(_0xe2b7('0x7'));var csv=require('to-csv');var ejs=require(_0xe2b7('0x8'));var fs=require('fs');var fs_extra=require(_0xe2b7('0x9'));var _=require(_0xe2b7('0xa'));var squel=require(_0xe2b7('0xb'));var crypto=require(_0xe2b7('0xc'));var jsforce=require(_0xe2b7('0xd'));var deskjs=require(_0xe2b7('0xe'));var toCsv=require(_0xe2b7('0xf'));var querystring=require(_0xe2b7('0x10'));var Papa=require(_0xe2b7('0x11'));var Redis=require('ioredis');var authService=require(_0xe2b7('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xe2b7('0x13'));var hardwareService=require(_0xe2b7('0x14'));var logger=require(_0xe2b7('0x15'))(_0xe2b7('0x16'));var utils=require(_0xe2b7('0x17'));var config=require(_0xe2b7('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xe2b7('0x19'))['db'];function respondWithStatusCode(_0x56cfa1,_0x50ae52){_0x50ae52=_0x50ae52||0xcc;return function(_0x43e8cc){if(_0x43e8cc){return _0x56cfa1[_0xe2b7('0x1a')](_0x50ae52);}return _0x56cfa1[_0xe2b7('0x1b')](_0x50ae52)[_0xe2b7('0x1c')]();};}function respondWithResult(_0x1ac2cf,_0x10e1a6){_0x10e1a6=_0x10e1a6||0xc8;return function(_0xbe52dd){if(_0xbe52dd){return _0x1ac2cf[_0xe2b7('0x1b')](_0x10e1a6)[_0xe2b7('0x1d')](_0xbe52dd);}};}function respondWithFilteredResult(_0x4ce593,_0x23531e){return function(_0x66c62e){if(_0x66c62e){var _0x4b4002=typeof _0x23531e['offset']===_0xe2b7('0x1e')&&typeof _0x23531e[_0xe2b7('0x1f')]===_0xe2b7('0x1e');var _0x240add=_0x66c62e[_0xe2b7('0x20')];var _0x480b75=_0x4b4002?0x0:_0x23531e[_0xe2b7('0x21')];var _0x41610c=_0x4b4002?_0x66c62e['count']:_0x23531e[_0xe2b7('0x21')]+_0x23531e[_0xe2b7('0x1f')];var _0x2c084c;if(_0x41610c>=_0x240add){_0x41610c=_0x240add;_0x2c084c=0xc8;}else{_0x2c084c=0xce;}_0x4ce593[_0xe2b7('0x1b')](_0x2c084c);return _0x4ce593[_0xe2b7('0x22')](_0xe2b7('0x23'),_0x480b75+'-'+_0x41610c+'/'+_0x240add)['json'](_0x66c62e);}return null;};}function patchUpdates(_0x190094){return function(_0x32f810){try{jsonpatch[_0xe2b7('0x24')](_0x32f810,_0x190094,!![]);}catch(_0x227fec){return BPromise[_0xe2b7('0x25')](_0x227fec);}return _0x32f810[_0xe2b7('0x26')]();};}function saveUpdates(_0x47d176,_0x48f328){return function(_0x522f6d){if(_0x522f6d){return _0x522f6d[_0xe2b7('0x27')](_0x47d176)[_0xe2b7('0x28')](function(_0x52447c){return _0x52447c;});}return null;};}function removeEntity(_0x1a16e0,_0x11b05e){return function(_0x250bb0){if(_0x250bb0){return _0x250bb0[_0xe2b7('0x29')]()[_0xe2b7('0x28')](function(){var _0x52de80=_0x250bb0['get']({'plain':!![]});var _0x4970d2='ExtractedReports';return db[_0xe2b7('0x2a')][_0xe2b7('0x29')]({'where':{'type':_0x4970d2,'resourceId':_0x52de80['id']}})[_0xe2b7('0x28')](function(){return _0x250bb0;});})[_0xe2b7('0x28')](function(){_0x1a16e0['status'](0xcc)[_0xe2b7('0x1c')]();});}};}function handleEntityNotFound(_0x1f7f67,_0x933c8e){return function(_0x2f7a43){if(!_0x2f7a43){_0x1f7f67[_0xe2b7('0x1a')](0x194);}return _0x2f7a43;};}function handleError(_0x526c87,_0x5d65bd){_0x5d65bd=_0x5d65bd||0x1f4;return function(_0x2a3175){logger[_0xe2b7('0x2b')](_0x2a3175[_0xe2b7('0x2c')]);if(_0x2a3175[_0xe2b7('0x2d')]){delete _0x2a3175['name'];}_0x526c87[_0xe2b7('0x1b')](_0x5d65bd)['send'](_0x2a3175);};}exports[_0xe2b7('0x2e')]=function(_0x589ab7,_0x429ada){var _0xe952e1={},_0x2beca8={},_0x4fc24c={'count':0x0,'rows':[]};var _0x5749fb=_[_0xe2b7('0x2f')](db[_0xe2b7('0x30')][_0xe2b7('0x31')],function(_0x248a52){return{'name':_0x248a52[_0xe2b7('0x32')],'type':_0x248a52[_0xe2b7('0x33')][_0xe2b7('0x34')]};});_0x2beca8[_0xe2b7('0x35')]=_['map'](_0x5749fb,_0xe2b7('0x2d'));_0x2beca8[_0xe2b7('0x36')]=_[_0xe2b7('0x37')](_0x589ab7[_0xe2b7('0x36')]);_0x2beca8[_0xe2b7('0x38')]=_[_0xe2b7('0x39')](_0x2beca8[_0xe2b7('0x35')],_0x2beca8['query']);_0xe952e1['attributes']=_['intersection'](_0x2beca8['model'],qs[_0xe2b7('0x3a')](_0x589ab7[_0xe2b7('0x36')][_0xe2b7('0x3a')]));_0xe952e1[_0xe2b7('0x3b')]=_0xe952e1[_0xe2b7('0x3b')][_0xe2b7('0x3c')]?_0xe952e1[_0xe2b7('0x3b')]:_0x2beca8[_0xe2b7('0x35')];if(!_0x589ab7['query'][_0xe2b7('0x3d')](_0xe2b7('0x3e'))){_0xe952e1[_0xe2b7('0x1f')]=qs[_0xe2b7('0x1f')](_0x589ab7[_0xe2b7('0x36')][_0xe2b7('0x1f')]);_0xe952e1[_0xe2b7('0x21')]=qs[_0xe2b7('0x21')](_0x589ab7[_0xe2b7('0x36')][_0xe2b7('0x21')]);}_0xe952e1[_0xe2b7('0x3f')]=qs[_0xe2b7('0x40')](_0x589ab7[_0xe2b7('0x36')]['sort']);_0xe952e1[_0xe2b7('0x41')]=qs[_0xe2b7('0x38')](_[_0xe2b7('0x42')](_0x589ab7[_0xe2b7('0x36')],_0x2beca8[_0xe2b7('0x38')]),_0x5749fb);if(_0x589ab7[_0xe2b7('0x36')][_0xe2b7('0x43')]){_0xe952e1[_0xe2b7('0x41')]=_[_0xe2b7('0x44')](_0xe952e1[_0xe2b7('0x41')],{'$or':_[_0xe2b7('0x2f')](_0x5749fb,function(_0xc4999c){if(_0xc4999c[_0xe2b7('0x33')]!==_0xe2b7('0x45')){var _0x3affeb={};_0x3affeb[_0xc4999c['name']]={'$like':'%'+_0x589ab7['query']['filter']+'%'};return _0x3affeb;}})});}_0xe952e1=_['merge']({},_0xe952e1,_0x589ab7[_0xe2b7('0x46')]);var _0x39de21={'where':_0xe952e1['where']};return db['AnalyticExtractedReport'][_0xe2b7('0x20')](_0x39de21)[_0xe2b7('0x28')](function(_0x4c2812){_0x4fc24c[_0xe2b7('0x20')]=_0x4c2812;if(_0x589ab7[_0xe2b7('0x36')][_0xe2b7('0x47')]){_0xe952e1['include']=[{'all':!![]}];}return db[_0xe2b7('0x30')][_0xe2b7('0x48')](_0xe952e1);})['then'](function(_0x3e264a){_0x4fc24c[_0xe2b7('0x49')]=_0x3e264a;return _0x4fc24c;})[_0xe2b7('0x28')](respondWithFilteredResult(_0x429ada,_0xe952e1))['catch'](handleError(_0x429ada,null));};exports[_0xe2b7('0x4a')]=function(_0x18b09a,_0x44fdc9){var _0x3ff30b={'raw':!![],'where':{'id':_0x18b09a[_0xe2b7('0x4b')]['id']}},_0x656a10={};_0x656a10['model']=_['keys'](db[_0xe2b7('0x30')][_0xe2b7('0x31')]);_0x656a10['query']=_[_0xe2b7('0x37')](_0x18b09a[_0xe2b7('0x36')]);_0x656a10[_0xe2b7('0x38')]=_['intersection'](_0x656a10[_0xe2b7('0x35')],_0x656a10['query']);_0x3ff30b[_0xe2b7('0x3b')]=_[_0xe2b7('0x39')](_0x656a10[_0xe2b7('0x35')],qs[_0xe2b7('0x3a')](_0x18b09a[_0xe2b7('0x36')][_0xe2b7('0x3a')]));_0x3ff30b[_0xe2b7('0x3b')]=_0x3ff30b['attributes'][_0xe2b7('0x3c')]?_0x3ff30b['attributes']:_0x656a10[_0xe2b7('0x35')];if(_0x18b09a[_0xe2b7('0x36')][_0xe2b7('0x47')]){_0x3ff30b[_0xe2b7('0x4c')]=[{'all':!![]}];}_0x3ff30b=_['merge']({},_0x3ff30b,_0x18b09a[_0xe2b7('0x46')]);return db[_0xe2b7('0x30')][_0xe2b7('0x4d')](_0x3ff30b)[_0xe2b7('0x28')](handleEntityNotFound(_0x44fdc9,null))[_0xe2b7('0x28')](respondWithResult(_0x44fdc9,null))[_0xe2b7('0x4e')](handleError(_0x44fdc9,null));};exports[_0xe2b7('0x4f')]=function(_0x38fd2c,_0x3223c5){return db['AnalyticExtractedReport'][_0xe2b7('0x4f')](_0x38fd2c['body'],{})[_0xe2b7('0x28')](function(_0x1419f9){var _0xb14a93=_0x38fd2c['user']['get']({'plain':!![]});if(!_0xb14a93)throw new Error(_0xe2b7('0x50'));if(_0xb14a93['role']===_0xe2b7('0x51')){var _0x5d97a0=_0x1419f9[_0xe2b7('0x52')]({'plain':!![]});var _0x4a753c=_0xe2b7('0x53');return db[_0xe2b7('0x54')][_0xe2b7('0x4d')]({'where':{'name':_0x4a753c,'userProfileId':_0xb14a93['userProfileId']},'raw':!![]})[_0xe2b7('0x28')](function(_0x42c83a){if(_0x42c83a&&_0x42c83a[_0xe2b7('0x55')]===0x0){return db[_0xe2b7('0x2a')]['create']({'name':_0x5d97a0['name'],'resourceId':_0x5d97a0['id'],'type':_0x42c83a[_0xe2b7('0x2d')],'sectionId':_0x42c83a['id']},{})[_0xe2b7('0x28')](function(){return _0x1419f9;});}else{return _0x1419f9;}})[_0xe2b7('0x4e')](function(_0x30f19d){logger[_0xe2b7('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x30f19d);throw _0x30f19d;});}return _0x1419f9;})[_0xe2b7('0x28')](respondWithResult(_0x3223c5,0xc9))[_0xe2b7('0x4e')](handleError(_0x3223c5,null));};exports[_0xe2b7('0x27')]=function(_0x4de5dd,_0x344ead){if(_0x4de5dd[_0xe2b7('0x56')]['id']){delete _0x4de5dd[_0xe2b7('0x56')]['id'];}return db[_0xe2b7('0x30')][_0xe2b7('0x4d')]({'where':{'id':_0x4de5dd['params']['id']}})[_0xe2b7('0x28')](handleEntityNotFound(_0x344ead,null))[_0xe2b7('0x28')](saveUpdates(_0x4de5dd[_0xe2b7('0x56')],null))[_0xe2b7('0x28')](respondWithResult(_0x344ead,null))[_0xe2b7('0x4e')](handleError(_0x344ead,null));};exports[_0xe2b7('0x29')]=function(_0x568fc0,_0xb2e4bd){return db[_0xe2b7('0x30')][_0xe2b7('0x4d')]({'where':{'id':_0x568fc0[_0xe2b7('0x4b')]['id']}})[_0xe2b7('0x28')](handleEntityNotFound(_0xb2e4bd,null))[_0xe2b7('0x28')](removeEntity(_0xb2e4bd,null))[_0xe2b7('0x4e')](handleError(_0xb2e4bd,null));};exports[_0xe2b7('0x57')]=function(_0x414e51,_0x31d722,_0x21ca03){return db['AnalyticExtractedReport'][_0xe2b7('0x4d')]({'where':{'id':_0x414e51['params']['id']},'attributes':[_0xe2b7('0x2d'),'basename',_0xe2b7('0x58'),'output'],'raw':!![]})[_0xe2b7('0x28')](handleEntityNotFound(_0x31d722,null))[_0xe2b7('0x28')](function(_0x470d6a){if(_0x470d6a){if(!fs[_0xe2b7('0x59')](path[_0xe2b7('0x5a')](config[_0xe2b7('0x5b')],_0xe2b7('0x5c'),_0x470d6a[_0xe2b7('0x58')]))){throw new db[(_0xe2b7('0x5d'))][(_0xe2b7('0x5e'))](_0xe2b7('0x5f'));}if(_0x414e51[_0xe2b7('0x36')][_0xe2b7('0x60')]){return _0x31d722[_0xe2b7('0x1a')](0xc8);}return _0x31d722[_0xe2b7('0x57')](path[_0xe2b7('0x5a')](config[_0xe2b7('0x5b')],_0xe2b7('0x5c'),_0x470d6a[_0xe2b7('0x58')]),util['format'](_0xe2b7('0x61'),_0x470d6a[_0xe2b7('0x62')]||_0x470d6a[_0xe2b7('0x2d')],_0x470d6a[_0xe2b7('0x63')][_0xe2b7('0x64')]()));}})[_0xe2b7('0x4e')](handleError(_0x31d722,null));}; \ No newline at end of file +var _0x4bf8=['userProfileId','params','download','basename','savename','output','existsSync','join','root','server/files/reports','Sequelize','exists','format','%s.%s','toLowerCase','eml-format','rimraf','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','end','limit','undefined','count','offset','set','Content-Range','json','apply','update','then','ExtractedReports','UserProfileResource','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','AnalyticExtractedReport','includeAll','include','rows','show','keys','options','find','catch','create','body','user','get','role'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0x4bf8,0x1e0));var _0x84bf=function(_0x12fb78,_0x57d782){_0x12fb78=_0x12fb78-0x0;var _0x41f4b7=_0x4bf8[_0x12fb78];return _0x41f4b7;};'use strict';var emlformat=require(_0x84bf('0x0'));var rimraf=require(_0x84bf('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x84bf('0x2'));var Mustache=require(_0x84bf('0x3'));var util=require(_0x84bf('0x4'));var path=require(_0x84bf('0x5'));var sox=require('sox');var csv=require(_0x84bf('0x6'));var ejs=require(_0x84bf('0x7'));var fs=require('fs');var fs_extra=require(_0x84bf('0x8'));var _=require(_0x84bf('0x9'));var squel=require(_0x84bf('0xa'));var crypto=require(_0x84bf('0xb'));var jsforce=require(_0x84bf('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x84bf('0x6'));var querystring=require(_0x84bf('0xd'));var Papa=require(_0x84bf('0xe'));var Redis=require(_0x84bf('0xf'));var authService=require(_0x84bf('0x10'));var qs=require(_0x84bf('0x11'));var as=require(_0x84bf('0x12'));var hardwareService=require(_0x84bf('0x13'));var logger=require(_0x84bf('0x14'))('api');var utils=require(_0x84bf('0x15'));var config=require(_0x84bf('0x16'));var licenseUtil=require(_0x84bf('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x184334,_0x28bfec){_0x28bfec=_0x28bfec||0xcc;return function(_0x500bab){if(_0x500bab){return _0x184334['sendStatus'](_0x28bfec);}return _0x184334[_0x84bf('0x18')](_0x28bfec)[_0x84bf('0x19')]();};}function respondWithResult(_0x1cc5ae,_0x559440){_0x559440=_0x559440||0xc8;return function(_0x1baa08){if(_0x1baa08){return _0x1cc5ae['status'](_0x559440)['json'](_0x1baa08);}};}function respondWithFilteredResult(_0x24f9d9,_0x3b8c2a){return function(_0xdc8bc7){if(_0xdc8bc7){var _0x12b857=typeof _0x3b8c2a['offset']==='undefined'&&typeof _0x3b8c2a[_0x84bf('0x1a')]===_0x84bf('0x1b');var _0x1cb774=_0xdc8bc7[_0x84bf('0x1c')];var _0x5ea721=_0x12b857?0x0:_0x3b8c2a[_0x84bf('0x1d')];var _0x595170=_0x12b857?_0xdc8bc7[_0x84bf('0x1c')]:_0x3b8c2a[_0x84bf('0x1d')]+_0x3b8c2a[_0x84bf('0x1a')];var _0x39e3b2;if(_0x595170>=_0x1cb774){_0x595170=_0x1cb774;_0x39e3b2=0xc8;}else{_0x39e3b2=0xce;}_0x24f9d9[_0x84bf('0x18')](_0x39e3b2);return _0x24f9d9[_0x84bf('0x1e')](_0x84bf('0x1f'),_0x5ea721+'-'+_0x595170+'/'+_0x1cb774)[_0x84bf('0x20')](_0xdc8bc7);}return null;};}function patchUpdates(_0x1aa8e2){return function(_0x100347){try{jsonpatch[_0x84bf('0x21')](_0x100347,_0x1aa8e2,!![]);}catch(_0x34451e){return BPromise['reject'](_0x34451e);}return _0x100347['save']();};}function saveUpdates(_0x53680e,_0x2d8b07){return function(_0x22bfcb){if(_0x22bfcb){return _0x22bfcb[_0x84bf('0x22')](_0x53680e)[_0x84bf('0x23')](function(_0x5976be){return _0x5976be;});}return null;};}function removeEntity(_0x5d8ada,_0x465692){return function(_0x428858){if(_0x428858){return _0x428858['destroy']()['then'](function(){var _0x4569af=_0x428858['get']({'plain':!![]});var _0x3ed653=_0x84bf('0x24');return db[_0x84bf('0x25')][_0x84bf('0x26')]({'where':{'type':_0x3ed653,'resourceId':_0x4569af['id']}})[_0x84bf('0x23')](function(){return _0x428858;});})['then'](function(){_0x5d8ada[_0x84bf('0x18')](0xcc)[_0x84bf('0x19')]();});}};}function handleEntityNotFound(_0x23d63d,_0x12c23e){return function(_0x17e33b){if(!_0x17e33b){_0x23d63d[_0x84bf('0x27')](0x194);}return _0x17e33b;};}function handleError(_0x2c18d1,_0x180c29){_0x180c29=_0x180c29||0x1f4;return function(_0x588428){logger[_0x84bf('0x28')](_0x588428[_0x84bf('0x29')]);if(_0x588428['name']){delete _0x588428[_0x84bf('0x2a')];}_0x2c18d1[_0x84bf('0x18')](_0x180c29)[_0x84bf('0x2b')](_0x588428);};}exports[_0x84bf('0x2c')]=function(_0xc7fb80,_0x1a0a07){var _0xef6574={},_0x4401ea={},_0x571ad1={'count':0x0,'rows':[]};var _0x4d9d7b=_[_0x84bf('0x2d')](db['AnalyticExtractedReport'][_0x84bf('0x2e')],function(_0x37f1d6){return{'name':_0x37f1d6['fieldName'],'type':_0x37f1d6[_0x84bf('0x2f')][_0x84bf('0x30')]};});_0x4401ea['model']=_[_0x84bf('0x2d')](_0x4d9d7b,_0x84bf('0x2a'));_0x4401ea[_0x84bf('0x31')]=_['keys'](_0xc7fb80[_0x84bf('0x31')]);_0x4401ea[_0x84bf('0x32')]=_[_0x84bf('0x33')](_0x4401ea[_0x84bf('0x34')],_0x4401ea[_0x84bf('0x31')]);_0xef6574[_0x84bf('0x35')]=_[_0x84bf('0x33')](_0x4401ea[_0x84bf('0x34')],qs[_0x84bf('0x36')](_0xc7fb80[_0x84bf('0x31')][_0x84bf('0x36')]));_0xef6574[_0x84bf('0x35')]=_0xef6574['attributes'][_0x84bf('0x37')]?_0xef6574[_0x84bf('0x35')]:_0x4401ea[_0x84bf('0x34')];if(!_0xc7fb80[_0x84bf('0x31')][_0x84bf('0x38')](_0x84bf('0x39'))){_0xef6574['limit']=qs[_0x84bf('0x1a')](_0xc7fb80[_0x84bf('0x31')]['limit']);_0xef6574[_0x84bf('0x1d')]=qs[_0x84bf('0x1d')](_0xc7fb80[_0x84bf('0x31')][_0x84bf('0x1d')]);}_0xef6574[_0x84bf('0x3a')]=qs[_0x84bf('0x3b')](_0xc7fb80[_0x84bf('0x31')]['sort']);_0xef6574[_0x84bf('0x3c')]=qs[_0x84bf('0x32')](_['pick'](_0xc7fb80['query'],_0x4401ea[_0x84bf('0x32')]),_0x4d9d7b);if(_0xc7fb80['query'][_0x84bf('0x3d')]){_0xef6574['where']=_[_0x84bf('0x3e')](_0xef6574['where'],{'$or':_[_0x84bf('0x2d')](_0x4d9d7b,function(_0x3f8d29){if(_0x3f8d29[_0x84bf('0x2f')]!==_0x84bf('0x3f')){var _0x1ba104={};_0x1ba104[_0x3f8d29[_0x84bf('0x2a')]]={'$like':'%'+_0xc7fb80[_0x84bf('0x31')]['filter']+'%'};return _0x1ba104;}})});}_0xef6574=_[_0x84bf('0x3e')]({},_0xef6574,_0xc7fb80['options']);var _0x9679da={'where':_0xef6574[_0x84bf('0x3c')]};return db[_0x84bf('0x40')][_0x84bf('0x1c')](_0x9679da)[_0x84bf('0x23')](function(_0x295d4d){_0x571ad1[_0x84bf('0x1c')]=_0x295d4d;if(_0xc7fb80[_0x84bf('0x31')][_0x84bf('0x41')]){_0xef6574[_0x84bf('0x42')]=[{'all':!![]}];}return db[_0x84bf('0x40')]['findAll'](_0xef6574);})['then'](function(_0x51299f){_0x571ad1[_0x84bf('0x43')]=_0x51299f;return _0x571ad1;})[_0x84bf('0x23')](respondWithFilteredResult(_0x1a0a07,_0xef6574))['catch'](handleError(_0x1a0a07,null));};exports[_0x84bf('0x44')]=function(_0x23985a,_0x372b66){var _0x1f371d={'raw':!![],'where':{'id':_0x23985a['params']['id']}},_0x1e3b98={};_0x1e3b98['model']=_['keys'](db['AnalyticExtractedReport']['rawAttributes']);_0x1e3b98[_0x84bf('0x31')]=_[_0x84bf('0x45')](_0x23985a[_0x84bf('0x31')]);_0x1e3b98['filters']=_['intersection'](_0x1e3b98[_0x84bf('0x34')],_0x1e3b98['query']);_0x1f371d[_0x84bf('0x35')]=_[_0x84bf('0x33')](_0x1e3b98['model'],qs[_0x84bf('0x36')](_0x23985a[_0x84bf('0x31')][_0x84bf('0x36')]));_0x1f371d['attributes']=_0x1f371d['attributes']['length']?_0x1f371d['attributes']:_0x1e3b98[_0x84bf('0x34')];if(_0x23985a[_0x84bf('0x31')][_0x84bf('0x41')]){_0x1f371d['include']=[{'all':!![]}];}_0x1f371d=_[_0x84bf('0x3e')]({},_0x1f371d,_0x23985a[_0x84bf('0x46')]);return db['AnalyticExtractedReport'][_0x84bf('0x47')](_0x1f371d)[_0x84bf('0x23')](handleEntityNotFound(_0x372b66,null))[_0x84bf('0x23')](respondWithResult(_0x372b66,null))[_0x84bf('0x48')](handleError(_0x372b66,null));};exports['create']=function(_0x3ae653,_0x52b347){return db[_0x84bf('0x40')][_0x84bf('0x49')](_0x3ae653[_0x84bf('0x4a')],{})[_0x84bf('0x23')](function(_0x2bc0e2){var _0x114dd8=_0x3ae653[_0x84bf('0x4b')][_0x84bf('0x4c')]({'plain':!![]});if(!_0x114dd8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x114dd8[_0x84bf('0x4d')]===_0x84bf('0x4b')){var _0x523054=_0x2bc0e2['get']({'plain':!![]});var _0x229b27=_0x84bf('0x24');return db['UserProfileSection'][_0x84bf('0x47')]({'where':{'name':_0x229b27,'userProfileId':_0x114dd8[_0x84bf('0x4e')]},'raw':!![]})[_0x84bf('0x23')](function(_0x5a68bd){if(_0x5a68bd&&_0x5a68bd['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x523054[_0x84bf('0x2a')],'resourceId':_0x523054['id'],'type':_0x5a68bd[_0x84bf('0x2a')],'sectionId':_0x5a68bd['id']},{})[_0x84bf('0x23')](function(){return _0x2bc0e2;});}else{return _0x2bc0e2;}})[_0x84bf('0x48')](function(_0x57905c){logger[_0x84bf('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x57905c);throw _0x57905c;});}return _0x2bc0e2;})[_0x84bf('0x23')](respondWithResult(_0x52b347,0xc9))[_0x84bf('0x48')](handleError(_0x52b347,null));};exports[_0x84bf('0x22')]=function(_0x511894,_0x4baf90){if(_0x511894[_0x84bf('0x4a')]['id']){delete _0x511894[_0x84bf('0x4a')]['id'];}return db[_0x84bf('0x40')]['find']({'where':{'id':_0x511894[_0x84bf('0x4f')]['id']}})[_0x84bf('0x23')](handleEntityNotFound(_0x4baf90,null))[_0x84bf('0x23')](saveUpdates(_0x511894[_0x84bf('0x4a')],null))[_0x84bf('0x23')](respondWithResult(_0x4baf90,null))[_0x84bf('0x48')](handleError(_0x4baf90,null));};exports[_0x84bf('0x26')]=function(_0x3e00d1,_0x28f7f2){return db['AnalyticExtractedReport'][_0x84bf('0x47')]({'where':{'id':_0x3e00d1[_0x84bf('0x4f')]['id']}})[_0x84bf('0x23')](handleEntityNotFound(_0x28f7f2,null))[_0x84bf('0x23')](removeEntity(_0x28f7f2,null))[_0x84bf('0x48')](handleError(_0x28f7f2,null));};exports[_0x84bf('0x50')]=function(_0x3607b5,_0x296ae7,_0x3e8a80){return db[_0x84bf('0x40')][_0x84bf('0x47')]({'where':{'id':_0x3607b5[_0x84bf('0x4f')]['id']},'attributes':['name',_0x84bf('0x51'),_0x84bf('0x52'),_0x84bf('0x53')],'raw':!![]})['then'](handleEntityNotFound(_0x296ae7,null))[_0x84bf('0x23')](function(_0x2edb43){if(_0x2edb43){if(!fs[_0x84bf('0x54')](path[_0x84bf('0x55')](config[_0x84bf('0x56')],_0x84bf('0x57'),_0x2edb43[_0x84bf('0x52')]))){throw new db[(_0x84bf('0x58'))]['ValidationError']('Report\x20not\x20found\x20or\x20empty');}if(_0x3607b5[_0x84bf('0x31')][_0x84bf('0x59')]){return _0x296ae7[_0x84bf('0x27')](0xc8);}return _0x296ae7[_0x84bf('0x50')](path[_0x84bf('0x55')](config[_0x84bf('0x56')],_0x84bf('0x57'),_0x2edb43['savename']),util[_0x84bf('0x5a')](_0x84bf('0x5b'),_0x2edb43[_0x84bf('0x51')]||_0x2edb43[_0x84bf('0x2a')],_0x2edb43['output'][_0x84bf('0x5c')]()));}})[_0x84bf('0x48')](handleError(_0x296ae7,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 0e90c8f..559df16 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 _0x890f=['exports','define','AnalyticExtractedReport','analytics_extracted_reports','lodash','util','api','moment','bluebird','path','rimraf','./analyticExtractedReport.attributes'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0x890f,0xac));var _0xf890=function(_0x41249e,_0x275d84){_0x41249e=_0x41249e-0x0;var _0x2bff48=_0x890f[_0x41249e];return _0x2bff48;};'use strict';var _=require(_0xf890('0x0'));var util=require(_0xf890('0x1'));var logger=require('../../config/logger')(_0xf890('0x2'));var moment=require(_0xf890('0x3'));var BPromise=require(_0xf890('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf890('0x5'));var rimraf=require(_0xf890('0x6'));var config=require('../../config/environment');var attributes=require(_0xf890('0x7'));module[_0xf890('0x8')]=function(_0x240e28,_0xa4b21){return _0x240e28[_0xf890('0x9')](_0xf890('0xa'),attributes,{'tableName':_0xf890('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdb70=['path','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','moment','bluebird','request-promise'];(function(_0x2a8860,_0x2da926){var _0x2f47a4=function(_0x3b7f54){while(--_0x3b7f54){_0x2a8860['push'](_0x2a8860['shift']());}};_0x2f47a4(++_0x2da926);}(_0xdb70,0x129));var _0x0db7=function(_0x19b3f0,_0x4b18e2){_0x19b3f0=_0x19b3f0-0x0;var _0x1dfd43=_0xdb70[_0x19b3f0];return _0x1dfd43;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x0db7('0x0'));var BPromise=require(_0x0db7('0x1'));var rp=require(_0x0db7('0x2'));var fs=require('fs');var path=require(_0x0db7('0x3'));var rimraf=require(_0x0db7('0x4'));var config=require(_0x0db7('0x5'));var attributes=require(_0x0db7('0x6'));module[_0x0db7('0x7')]=function(_0x543ee3,_0x479215){return _0x543ee3[_0x0db7('0x8')](_0x0db7('0x9'),attributes,{'tableName':'analytics_extracted_reports','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 5b4bc00..2ac5ef4 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 _0x5044=['AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','info'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x5044,0x7c));var _0x4504=function(_0x3932eb,_0x43b210){_0x3932eb=_0x3932eb-0x0;var _0x5316e5=_0x5044[_0x3932eb];return _0x5316e5;};'use strict';var _=require(_0x4504('0x0'));var util=require(_0x4504('0x1'));var moment=require(_0x4504('0x2'));var BPromise=require(_0x4504('0x3'));var rs=require(_0x4504('0x4'));var fs=require('fs');var Redis=require(_0x4504('0x5'));var db=require(_0x4504('0x6'))['db'];var utils=require(_0x4504('0x7'));var logger=require(_0x4504('0x8'))('rpc');var config=require(_0x4504('0x9'));var jayson=require(_0x4504('0xa'));var client=jayson[_0x4504('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x9b1a26,_0x14785e,_0x5c72e0){return new BPromise(function(_0x50b2d1,_0x20157c){return client['request'](_0x9b1a26,_0x5c72e0)[_0x4504('0xc')](function(_0x160b65){logger[_0x4504('0xd')](_0x4504('0xe'),_0x14785e,_0x4504('0xf'));logger['debug'](_0x4504('0x10'),_0x14785e,'request\x20sent',JSON[_0x4504('0x11')](_0x160b65));if(_0x160b65[_0x4504('0x12')]){if(_0x160b65['error'][_0x4504('0x13')]===0x1f4){logger[_0x4504('0x12')](_0x4504('0xe'),_0x14785e,_0x160b65['error']['message']);return _0x20157c(_0x160b65[_0x4504('0x12')][_0x4504('0x14')]);}logger[_0x4504('0x12')](_0x4504('0xe'),_0x14785e,_0x160b65[_0x4504('0x12')][_0x4504('0x14')]);return _0x50b2d1(_0x160b65[_0x4504('0x12')][_0x4504('0x14')]);}else{logger[_0x4504('0xd')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x14785e,'request\x20sent');_0x50b2d1(_0x160b65[_0x4504('0x15')]['message']);}})[_0x4504('0x16')](function(_0xdd2460){logger[_0x4504('0x12')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x14785e,_0xdd2460);_0x20157c(_0xdd2460);});});} \ No newline at end of file +var _0xf9ae=['result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xf9ae,0x85));var _0xef9a=function(_0x79406b,_0x3cba72){_0x79406b=_0x79406b-0x0;var _0x26959f=_0xf9ae[_0x79406b];return _0x26959f;};'use strict';var _=require(_0xef9a('0x0'));var util=require(_0xef9a('0x1'));var moment=require('moment');var BPromise=require(_0xef9a('0x2'));var rs=require(_0xef9a('0x3'));var fs=require('fs');var Redis=require(_0xef9a('0x4'));var db=require(_0xef9a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xef9a('0x6'))(_0xef9a('0x7'));var config=require('../../config/environment');var jayson=require(_0xef9a('0x8'));var client=jayson[_0xef9a('0x9')][_0xef9a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5d72d2,_0x3e1435,_0x387dd0){return new BPromise(function(_0x40afbc,_0x50025e){return client[_0xef9a('0xb')](_0x5d72d2,_0x387dd0)[_0xef9a('0xc')](function(_0x4c5623){logger[_0xef9a('0xd')](_0xef9a('0xe'),_0x3e1435,_0xef9a('0xf'));logger['debug'](_0xef9a('0x10'),_0x3e1435,'request\x20sent',JSON[_0xef9a('0x11')](_0x4c5623));if(_0x4c5623[_0xef9a('0x12')]){if(_0x4c5623[_0xef9a('0x12')][_0xef9a('0x13')]===0x1f4){logger['error'](_0xef9a('0xe'),_0x3e1435,_0x4c5623['error'][_0xef9a('0x14')]);return _0x50025e(_0x4c5623['error'][_0xef9a('0x14')]);}logger[_0xef9a('0x12')](_0xef9a('0xe'),_0x3e1435,_0x4c5623[_0xef9a('0x12')]['message']);return _0x40afbc(_0x4c5623[_0xef9a('0x12')][_0xef9a('0x14')]);}else{logger[_0xef9a('0xd')](_0xef9a('0xe'),_0x3e1435,_0xef9a('0xf'));_0x40afbc(_0x4c5623[_0xef9a('0x15')][_0xef9a('0x14')]);}})['catch'](function(_0x8b79f8){logger[_0xef9a('0x12')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x3e1435,_0x8b79f8);_0x50025e(_0x8b79f8);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 5d1b22e..a73ad8b 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 _0x61a5=['util','connect-timeout','Router','fs-extra','../../components/interaction/service','./analyticExtractedReport.controller','get','isAuthenticated','index','/:id','/:id/download','download','post','create','put','update','delete','destroy','exports','multer'];(function(_0x4752ca,_0x29f3e4){var _0x6df077=function(_0x14f15e){while(--_0x14f15e){_0x4752ca['push'](_0x4752ca['shift']());}};_0x6df077(++_0x29f3e4);}(_0x61a5,0x13f));var _0x561a=function(_0x425716,_0x3e9d1c){_0x425716=_0x425716-0x0;var _0x2d39af=_0x61a5[_0x425716];return _0x2d39af;};'use strict';var multer=require(_0x561a('0x0'));var util=require(_0x561a('0x1'));var path=require('path');var timeout=require(_0x561a('0x2'));var express=require('express');var router=express[_0x561a('0x3')]();var fs_extra=require(_0x561a('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x561a('0x5'));var config=require('../../config/environment');var controller=require(_0x561a('0x6'));router[_0x561a('0x7')]('/',auth[_0x561a('0x8')](),controller[_0x561a('0x9')]);router[_0x561a('0x7')](_0x561a('0xa'),auth[_0x561a('0x8')](),controller['show']);router[_0x561a('0x7')](_0x561a('0xb'),auth[_0x561a('0x8')](),controller[_0x561a('0xc')]);router[_0x561a('0xd')]('/',auth[_0x561a('0x8')](),controller[_0x561a('0xe')]);router[_0x561a('0xf')]('/:id',auth[_0x561a('0x8')](),controller[_0x561a('0x10')]);router[_0x561a('0x11')](_0x561a('0xa'),auth[_0x561a('0x8')](),controller[_0x561a('0x12')]);module[_0x561a('0x13')]=router; \ No newline at end of file +var _0xa3fe=['index','/:id','show','/:id/download','download','post','create','put','delete','exports','multer','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated'];(function(_0xf9e76,_0x2e6b9a){var _0x119a9b=function(_0x146396){while(--_0x146396){_0xf9e76['push'](_0xf9e76['shift']());}};_0x119a9b(++_0x2e6b9a);}(_0xa3fe,0xbe));var _0xea3f=function(_0x2d5e3d,_0x37aa85){_0x2d5e3d=_0x2d5e3d-0x0;var _0x57975a=_0xa3fe[_0x2d5e3d];return _0x57975a;};'use strict';var multer=require(_0xea3f('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xea3f('0x1'));var router=express[_0xea3f('0x2')]();var fs_extra=require(_0xea3f('0x3'));var auth=require(_0xea3f('0x4'));var interaction=require(_0xea3f('0x5'));var config=require(_0xea3f('0x6'));var controller=require(_0xea3f('0x7'));router[_0xea3f('0x8')]('/',auth[_0xea3f('0x9')](),controller[_0xea3f('0xa')]);router[_0xea3f('0x8')](_0xea3f('0xb'),auth[_0xea3f('0x9')](),controller[_0xea3f('0xc')]);router[_0xea3f('0x8')](_0xea3f('0xd'),auth[_0xea3f('0x9')](),controller[_0xea3f('0xe')]);router[_0xea3f('0xf')]('/',auth[_0xea3f('0x9')](),controller[_0xea3f('0x10')]);router[_0xea3f('0x11')]('/:id',auth[_0xea3f('0x9')](),controller['update']);router[_0xea3f('0x12')](_0xea3f('0xb'),auth[_0xea3f('0x9')](),controller['destroy']);module[_0xea3f('0x13')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 41693ef..f6793dc 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 _0xab00=['STRING','BOOLEAN','sequelize','TEXT'];(function(_0x31f687,_0x51a1a7){var _0x3876a7=function(_0x37c67c){while(--_0x37c67c){_0x31f687['push'](_0x31f687['shift']());}};_0x3876a7(++_0x51a1a7);}(_0xab00,0x1a6));var _0x0ab0=function(_0x1fac03,_0x28df42){_0x1fac03=_0x1fac03-0x0;var _0x596904=_0xab00[_0x1fac03];return _0x596904;};'use strict';var Sequelize=require(_0x0ab0('0x0'));module['exports']={'field':{'type':Sequelize[_0x0ab0('0x1')]},'alias':{'type':Sequelize[_0x0ab0('0x2')]},'function':{'type':Sequelize[_0x0ab0('0x2')]},'format':{'type':Sequelize['STRING']},'groupBy':{'type':Sequelize[_0x0ab0('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x0ab0('0x2')]},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xe036=['exports','TEXT','STRING','BOOLEAN'];(function(_0x155c64,_0x26ff95){var _0x1f154a=function(_0xbc46e4){while(--_0xbc46e4){_0x155c64['push'](_0x155c64['shift']());}};_0x1f154a(++_0x26ff95);}(_0xe036,0xd8));var _0x6e03=function(_0x4f0074,_0x4db3b8){_0x4f0074=_0x4f0074-0x0;var _0x49abc0=_0xe036[_0x4f0074];return _0x49abc0;};'use strict';var Sequelize=require('sequelize');module[_0x6e03('0x0')]={'field':{'type':Sequelize[_0x6e03('0x1')]},'alias':{'type':Sequelize[_0x6e03('0x2')]},'function':{'type':Sequelize[_0x6e03('0x2')]},'format':{'type':Sequelize[_0x6e03('0x2')]},'groupBy':{'type':Sequelize[_0x6e03('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x6e03('0x2')]},'custom':{'type':Sequelize[_0x6e03('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 3e6841f..bb40901 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 _0x12d0=['then','destroy','stack','name','send','AnalyticFieldReport','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','count','includeAll','findAll','rows','catch','show','params','keys','include','find','create','body','bulkCreate','bulkDestroy','ids','addFields','sequelize','transaction','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','end','status','json','offset','limit','undefined','set','Content-Range','save','update'];(function(_0x472e3b,_0x555bde){var _0x3b8e33=function(_0x431cb7){while(--_0x431cb7){_0x472e3b['push'](_0x472e3b['shift']());}};_0x3b8e33(++_0x555bde);}(_0x12d0,0x1d2));var _0x012d=function(_0x3414d2,_0x47039f){_0x3414d2=_0x3414d2-0x0;var _0xe0e8b7=_0x12d0[_0x3414d2];return _0xe0e8b7;};'use strict';var emlformat=require(_0x012d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x012d('0x1'));var jsonpatch=require(_0x012d('0x2'));var rp=require(_0x012d('0x3'));var moment=require(_0x012d('0x4'));var BPromise=require(_0x012d('0x5'));var Mustache=require(_0x012d('0x6'));var util=require('util');var path=require(_0x012d('0x7'));var sox=require(_0x012d('0x8'));var csv=require(_0x012d('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x012d('0xa'));var _=require(_0x012d('0xb'));var squel=require(_0x012d('0xc'));var crypto=require(_0x012d('0xd'));var jsforce=require(_0x012d('0xe'));var deskjs=require(_0x012d('0xf'));var toCsv=require(_0x012d('0x9'));var querystring=require(_0x012d('0x10'));var Papa=require(_0x012d('0x11'));var Redis=require(_0x012d('0x12'));var authService=require(_0x012d('0x13'));var qs=require(_0x012d('0x14'));var as=require(_0x012d('0x15'));var hardwareService=require(_0x012d('0x16'));var logger=require(_0x012d('0x17'))(_0x012d('0x18'));var utils=require(_0x012d('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x012d('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a11c6,_0x57fd12){_0x57fd12=_0x57fd12||0xcc;return function(_0x5455e7){if(_0x5455e7){return _0x2a11c6[_0x012d('0x1b')](_0x57fd12);}return _0x2a11c6['status'](_0x57fd12)[_0x012d('0x1c')]();};}function respondWithResult(_0x4ed34e,_0x3acc08){_0x3acc08=_0x3acc08||0xc8;return function(_0x15f2f6){if(_0x15f2f6){return _0x4ed34e[_0x012d('0x1d')](_0x3acc08)[_0x012d('0x1e')](_0x15f2f6);}};}function respondWithFilteredResult(_0xf4cbda,_0xca266b){return function(_0x3972e2){if(_0x3972e2){var _0x1a147a=typeof _0xca266b[_0x012d('0x1f')]==='undefined'&&typeof _0xca266b[_0x012d('0x20')]===_0x012d('0x21');var _0x6d0f2a=_0x3972e2['count'];var _0x3f547c=_0x1a147a?0x0:_0xca266b[_0x012d('0x1f')];var _0x580160=_0x1a147a?_0x3972e2['count']:_0xca266b[_0x012d('0x1f')]+_0xca266b['limit'];var _0x152408;if(_0x580160>=_0x6d0f2a){_0x580160=_0x6d0f2a;_0x152408=0xc8;}else{_0x152408=0xce;}_0xf4cbda[_0x012d('0x1d')](_0x152408);return _0xf4cbda[_0x012d('0x22')](_0x012d('0x23'),_0x3f547c+'-'+_0x580160+'/'+_0x6d0f2a)[_0x012d('0x1e')](_0x3972e2);}return null;};}function patchUpdates(_0x18a1e8){return function(_0x2a05fc){try{jsonpatch['apply'](_0x2a05fc,_0x18a1e8,!![]);}catch(_0x1d69f8){return BPromise['reject'](_0x1d69f8);}return _0x2a05fc[_0x012d('0x24')]();};}function saveUpdates(_0x298fc7,_0x24fd76){return function(_0x35d8d4){if(_0x35d8d4){return _0x35d8d4[_0x012d('0x25')](_0x298fc7)[_0x012d('0x26')](function(_0x34ad77){return _0x34ad77;});}return null;};}function removeEntity(_0x5703ad,_0x1da525){return function(_0x2196f7){if(_0x2196f7){return _0x2196f7[_0x012d('0x27')]()[_0x012d('0x26')](function(){_0x5703ad[_0x012d('0x1d')](0xcc)[_0x012d('0x1c')]();});}};}function handleEntityNotFound(_0x238cb0,_0x380f8){return function(_0x3b77a1){if(!_0x3b77a1){_0x238cb0['sendStatus'](0x194);}return _0x3b77a1;};}function handleError(_0x11d69b,_0xf8d92f){_0xf8d92f=_0xf8d92f||0x1f4;return function(_0x41854b){logger['error'](_0x41854b[_0x012d('0x28')]);if(_0x41854b[_0x012d('0x29')]){delete _0x41854b[_0x012d('0x29')];}_0x11d69b[_0x012d('0x1d')](_0xf8d92f)[_0x012d('0x2a')](_0x41854b);};}exports['index']=function(_0x475d90,_0x2c0ead){var _0x1708a9={},_0x5e4e67={},_0x19f680={'count':0x0,'rows':[]};var _0x2ade1e=_['map'](db[_0x012d('0x2b')][_0x012d('0x2c')],function(_0x3f61ab){return{'name':_0x3f61ab[_0x012d('0x2d')],'type':_0x3f61ab['type'][_0x012d('0x2e')]};});_0x5e4e67[_0x012d('0x2f')]=_[_0x012d('0x30')](_0x2ade1e,'name');_0x5e4e67[_0x012d('0x31')]=_['keys'](_0x475d90[_0x012d('0x31')]);_0x5e4e67[_0x012d('0x32')]=_[_0x012d('0x33')](_0x5e4e67[_0x012d('0x2f')],_0x5e4e67[_0x012d('0x31')]);_0x1708a9[_0x012d('0x34')]=_['intersection'](_0x5e4e67[_0x012d('0x2f')],qs[_0x012d('0x35')](_0x475d90[_0x012d('0x31')][_0x012d('0x35')]));_0x1708a9[_0x012d('0x34')]=_0x1708a9[_0x012d('0x34')][_0x012d('0x36')]?_0x1708a9[_0x012d('0x34')]:_0x5e4e67[_0x012d('0x2f')];if(!_0x475d90[_0x012d('0x31')][_0x012d('0x37')](_0x012d('0x38'))){_0x1708a9['limit']=qs[_0x012d('0x20')](_0x475d90[_0x012d('0x31')][_0x012d('0x20')]);_0x1708a9[_0x012d('0x1f')]=qs[_0x012d('0x1f')](_0x475d90['query']['offset']);}_0x1708a9[_0x012d('0x39')]=qs[_0x012d('0x3a')](_0x475d90[_0x012d('0x31')][_0x012d('0x3a')]);_0x1708a9[_0x012d('0x3b')]=qs[_0x012d('0x32')](_[_0x012d('0x3c')](_0x475d90[_0x012d('0x31')],_0x5e4e67[_0x012d('0x32')]),_0x2ade1e);if(_0x475d90[_0x012d('0x31')][_0x012d('0x3d')]){_0x1708a9[_0x012d('0x3b')]=_[_0x012d('0x3e')](_0x1708a9['where'],{'$or':_[_0x012d('0x30')](_0x2ade1e,function(_0x734659){if(_0x734659[_0x012d('0x3f')]!==_0x012d('0x40')){var _0x210fb7={};_0x210fb7[_0x734659[_0x012d('0x29')]]={'$like':'%'+_0x475d90[_0x012d('0x31')]['filter']+'%'};return _0x210fb7;}})});}_0x1708a9=_[_0x012d('0x3e')]({},_0x1708a9,_0x475d90[_0x012d('0x41')]);var _0x2b34e9={'where':_0x1708a9[_0x012d('0x3b')]};return db[_0x012d('0x2b')][_0x012d('0x42')](_0x2b34e9)[_0x012d('0x26')](function(_0x21f85b){_0x19f680[_0x012d('0x42')]=_0x21f85b;if(_0x475d90[_0x012d('0x31')][_0x012d('0x43')]){_0x1708a9['include']=[{'all':!![]}];}return db[_0x012d('0x2b')][_0x012d('0x44')](_0x1708a9);})[_0x012d('0x26')](function(_0x16413d){_0x19f680[_0x012d('0x45')]=_0x16413d;return _0x19f680;})['then'](respondWithFilteredResult(_0x2c0ead,_0x1708a9))[_0x012d('0x46')](handleError(_0x2c0ead,null));};exports[_0x012d('0x47')]=function(_0x228440,_0x464286){var _0x371df0={'raw':![],'where':{'id':_0x228440[_0x012d('0x48')]['id']}},_0x4294f4={};_0x4294f4[_0x012d('0x2f')]=_[_0x012d('0x49')](db[_0x012d('0x2b')][_0x012d('0x2c')]);_0x4294f4[_0x012d('0x31')]=_[_0x012d('0x49')](_0x228440['query']);_0x4294f4['filters']=_[_0x012d('0x33')](_0x4294f4[_0x012d('0x2f')],_0x4294f4[_0x012d('0x31')]);_0x371df0[_0x012d('0x34')]=_[_0x012d('0x33')](_0x4294f4[_0x012d('0x2f')],qs['fields'](_0x228440[_0x012d('0x31')][_0x012d('0x35')]));_0x371df0[_0x012d('0x34')]=_0x371df0[_0x012d('0x34')][_0x012d('0x36')]?_0x371df0[_0x012d('0x34')]:_0x4294f4[_0x012d('0x2f')];if(_0x228440[_0x012d('0x31')]['includeAll']){_0x371df0[_0x012d('0x4a')]=[{'all':!![]}];}_0x371df0=_[_0x012d('0x3e')]({},_0x371df0,_0x228440[_0x012d('0x41')]);return db[_0x012d('0x2b')][_0x012d('0x4b')](_0x371df0)[_0x012d('0x26')](handleEntityNotFound(_0x464286,null))[_0x012d('0x26')](respondWithResult(_0x464286,null))[_0x012d('0x46')](handleError(_0x464286,null));};exports[_0x012d('0x4c')]=function(_0x2373f3,_0x418dd0){return db[_0x012d('0x2b')][_0x012d('0x4c')](_0x2373f3[_0x012d('0x4d')],{})[_0x012d('0x26')](respondWithResult(_0x418dd0,0xc9))[_0x012d('0x46')](handleError(_0x418dd0,null));};exports[_0x012d('0x4e')]=function(_0x4e9007,_0x34f283){return db[_0x012d('0x2b')][_0x012d('0x4e')](_0x4e9007[_0x012d('0x4d')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x34f283,0xc9))[_0x012d('0x46')](handleError(_0x34f283,null));};exports[_0x012d('0x25')]=function(_0x22276a,_0x4aae3e){if(_0x22276a[_0x012d('0x4d')]['id']){delete _0x22276a[_0x012d('0x4d')]['id'];}return db[_0x012d('0x2b')]['find']({'where':{'id':_0x22276a['params']['id']}})[_0x012d('0x26')](handleEntityNotFound(_0x4aae3e,null))[_0x012d('0x26')](saveUpdates(_0x22276a['body'],null))[_0x012d('0x26')](respondWithResult(_0x4aae3e,null))[_0x012d('0x46')](handleError(_0x4aae3e,null));};exports[_0x012d('0x27')]=function(_0x2aeb9f,_0x3bf1cc){return db[_0x012d('0x2b')][_0x012d('0x4b')]({'where':{'id':_0x2aeb9f[_0x012d('0x48')]['id']}})[_0x012d('0x26')](handleEntityNotFound(_0x3bf1cc,null))[_0x012d('0x26')](removeEntity(_0x3bf1cc,null))[_0x012d('0x46')](handleError(_0x3bf1cc,null));};exports[_0x012d('0x4f')]=function(_0x3c09aa,_0x120b9d){return db['AnalyticFieldReport'][_0x012d('0x27')]({'where':{'id':_0x3c09aa[_0x012d('0x31')][_0x012d('0x50')]||[]},'raw':![],'individualHooks':!![]})[_0x012d('0x26')](respondWithResult(_0x120b9d,0xcc))[_0x012d('0x46')](handleError(_0x120b9d,null));};exports[_0x012d('0x51')]=function(_0x158fe5,_0x5db9b9,_0x14633d){return db['AnalyticCustomReport']['findOne']({'where':{'id':_0x158fe5[_0x012d('0x48')]['id']}})[_0x012d('0x26')](handleEntityNotFound(_0x5db9b9,null))[_0x012d('0x26')](function(_0x314271){if(_0x314271){return db[_0x012d('0x52')][_0x012d('0x53')](function(_0x47829b){return db[_0x012d('0x2b')][_0x012d('0x27')]({'where':{'CustomReportId':_0x158fe5['params']['id']},'transaction':_0x47829b})[_0x012d('0x26')](function(_0x3aadab){var _0x38cb5b=_[_0x012d('0x30')](_0x158fe5['body'],function(_0x41b876){delete _0x41b876['id'];_0x41b876['CustomReportId']=_0x158fe5[_0x012d('0x48')]['id'];return _0x41b876;});return db['AnalyticFieldReport'][_0x012d('0x4e')](_0x38cb5b,{'transaction':_0x47829b});});})[_0x012d('0x26')](function(){return db['AnalyticFieldReport']['findAll']({'where':{'CustomReportId':_0x158fe5[_0x012d('0x48')]['id']}});});}})[_0x012d('0x26')](respondWithResult(_0x5db9b9,null))['catch'](handleError(_0x5db9b9,null));}; \ No newline at end of file +var _0x209e=['sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','end','error','stack','name','send','index','map','AnalyticFieldReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','options','includeAll','include','rows','catch','show','params','length','merge','create','body','bulkCreate','find','ids','addFields','AnalyticCustomReport','findOne','sequelize','transaction','destroy','CustomReportId','findAll','rimraf','zip-dir','moment','bluebird','mustache','util','path'];(function(_0x25662e,_0x4cec68){var _0x59b7bc=function(_0xafb159){while(--_0xafb159){_0x25662e['push'](_0x25662e['shift']());}};_0x59b7bc(++_0x4cec68);}(_0x209e,0x1eb));var _0xe209=function(_0x230414,_0x2a8a1b){_0x230414=_0x230414-0x0;var _0x14ae0e=_0x209e[_0x230414];return _0x14ae0e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe209('0x0'));var zipdir=require(_0xe209('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe209('0x2'));var BPromise=require(_0xe209('0x3'));var Mustache=require(_0xe209('0x4'));var util=require(_0xe209('0x5'));var path=require(_0xe209('0x6'));var sox=require(_0xe209('0x7'));var csv=require(_0xe209('0x8'));var ejs=require(_0xe209('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe209('0xa'));var squel=require(_0xe209('0xb'));var crypto=require(_0xe209('0xc'));var jsforce=require(_0xe209('0xd'));var deskjs=require(_0xe209('0xe'));var toCsv=require(_0xe209('0x8'));var querystring=require(_0xe209('0xf'));var Papa=require(_0xe209('0x10'));var Redis=require('ioredis');var authService=require(_0xe209('0x11'));var qs=require(_0xe209('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe209('0x13'));var logger=require('../../config/logger')(_0xe209('0x14'));var utils=require(_0xe209('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xe209('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5a0df9,_0xc15150){_0xc15150=_0xc15150||0xcc;return function(_0x4a9c0b){if(_0x4a9c0b){return _0x5a0df9[_0xe209('0x17')](_0xc15150);}return _0x5a0df9[_0xe209('0x18')](_0xc15150)['end']();};}function respondWithResult(_0x183761,_0x3a15c9){_0x3a15c9=_0x3a15c9||0xc8;return function(_0x470423){if(_0x470423){return _0x183761['status'](_0x3a15c9)['json'](_0x470423);}};}function respondWithFilteredResult(_0xe5a279,_0x4293ff){return function(_0x1e860a){if(_0x1e860a){var _0x1a2c8e=typeof _0x4293ff[_0xe209('0x19')]===_0xe209('0x1a')&&typeof _0x4293ff[_0xe209('0x1b')]===_0xe209('0x1a');var _0xe07aff=_0x1e860a[_0xe209('0x1c')];var _0x2f9dc3=_0x1a2c8e?0x0:_0x4293ff['offset'];var _0x32452b=_0x1a2c8e?_0x1e860a[_0xe209('0x1c')]:_0x4293ff[_0xe209('0x19')]+_0x4293ff['limit'];var _0x5c8c9e;if(_0x32452b>=_0xe07aff){_0x32452b=_0xe07aff;_0x5c8c9e=0xc8;}else{_0x5c8c9e=0xce;}_0xe5a279[_0xe209('0x18')](_0x5c8c9e);return _0xe5a279[_0xe209('0x1d')](_0xe209('0x1e'),_0x2f9dc3+'-'+_0x32452b+'/'+_0xe07aff)['json'](_0x1e860a);}return null;};}function patchUpdates(_0x78eee3){return function(_0x3621e2){try{jsonpatch[_0xe209('0x1f')](_0x3621e2,_0x78eee3,!![]);}catch(_0x55bae7){return BPromise[_0xe209('0x20')](_0x55bae7);}return _0x3621e2[_0xe209('0x21')]();};}function saveUpdates(_0x255da1,_0x3cc543){return function(_0x2bbbcf){if(_0x2bbbcf){return _0x2bbbcf[_0xe209('0x22')](_0x255da1)[_0xe209('0x23')](function(_0x146ab7){return _0x146ab7;});}return null;};}function removeEntity(_0x14881e,_0x25b79b){return function(_0x53eff1){if(_0x53eff1){return _0x53eff1['destroy']()[_0xe209('0x23')](function(){_0x14881e['status'](0xcc)[_0xe209('0x24')]();});}};}function handleEntityNotFound(_0x462393,_0x547b00){return function(_0x5b9abd){if(!_0x5b9abd){_0x462393[_0xe209('0x17')](0x194);}return _0x5b9abd;};}function handleError(_0x314e0a,_0x5936e6){_0x5936e6=_0x5936e6||0x1f4;return function(_0x21ddfd){logger[_0xe209('0x25')](_0x21ddfd[_0xe209('0x26')]);if(_0x21ddfd[_0xe209('0x27')]){delete _0x21ddfd['name'];}_0x314e0a[_0xe209('0x18')](_0x5936e6)[_0xe209('0x28')](_0x21ddfd);};}exports[_0xe209('0x29')]=function(_0x403d91,_0x3f5fd3){var _0x565a8c={},_0x12d171={},_0x1a31fe={'count':0x0,'rows':[]};var _0x466e21=_[_0xe209('0x2a')](db[_0xe209('0x2b')][_0xe209('0x2c')],function(_0x3e6243){return{'name':_0x3e6243[_0xe209('0x2d')],'type':_0x3e6243[_0xe209('0x2e')][_0xe209('0x2f')]};});_0x12d171['model']=_['map'](_0x466e21,'name');_0x12d171[_0xe209('0x30')]=_[_0xe209('0x31')](_0x403d91['query']);_0x12d171[_0xe209('0x32')]=_[_0xe209('0x33')](_0x12d171[_0xe209('0x34')],_0x12d171[_0xe209('0x30')]);_0x565a8c['attributes']=_[_0xe209('0x33')](_0x12d171[_0xe209('0x34')],qs[_0xe209('0x35')](_0x403d91[_0xe209('0x30')][_0xe209('0x35')]));_0x565a8c[_0xe209('0x36')]=_0x565a8c[_0xe209('0x36')]['length']?_0x565a8c[_0xe209('0x36')]:_0x12d171['model'];if(!_0x403d91[_0xe209('0x30')][_0xe209('0x37')](_0xe209('0x38'))){_0x565a8c[_0xe209('0x1b')]=qs[_0xe209('0x1b')](_0x403d91[_0xe209('0x30')][_0xe209('0x1b')]);_0x565a8c[_0xe209('0x19')]=qs[_0xe209('0x19')](_0x403d91[_0xe209('0x30')][_0xe209('0x19')]);}_0x565a8c['order']=qs[_0xe209('0x39')](_0x403d91[_0xe209('0x30')][_0xe209('0x39')]);_0x565a8c[_0xe209('0x3a')]=qs[_0xe209('0x32')](_['pick'](_0x403d91[_0xe209('0x30')],_0x12d171[_0xe209('0x32')]),_0x466e21);if(_0x403d91[_0xe209('0x30')][_0xe209('0x3b')]){_0x565a8c[_0xe209('0x3a')]=_['merge'](_0x565a8c[_0xe209('0x3a')],{'$or':_['map'](_0x466e21,function(_0x3016df){if(_0x3016df[_0xe209('0x2e')]!==_0xe209('0x3c')){var _0x3d499f={};_0x3d499f[_0x3016df[_0xe209('0x27')]]={'$like':'%'+_0x403d91[_0xe209('0x30')][_0xe209('0x3b')]+'%'};return _0x3d499f;}})});}_0x565a8c=_['merge']({},_0x565a8c,_0x403d91[_0xe209('0x3d')]);var _0x5835b3={'where':_0x565a8c[_0xe209('0x3a')]};return db['AnalyticFieldReport'][_0xe209('0x1c')](_0x5835b3)[_0xe209('0x23')](function(_0x1e0c98){_0x1a31fe[_0xe209('0x1c')]=_0x1e0c98;if(_0x403d91[_0xe209('0x30')][_0xe209('0x3e')]){_0x565a8c[_0xe209('0x3f')]=[{'all':!![]}];}return db[_0xe209('0x2b')]['findAll'](_0x565a8c);})[_0xe209('0x23')](function(_0x17d52f){_0x1a31fe[_0xe209('0x40')]=_0x17d52f;return _0x1a31fe;})[_0xe209('0x23')](respondWithFilteredResult(_0x3f5fd3,_0x565a8c))[_0xe209('0x41')](handleError(_0x3f5fd3,null));};exports[_0xe209('0x42')]=function(_0x4c8665,_0x5586ae){var _0x52f166={'raw':![],'where':{'id':_0x4c8665[_0xe209('0x43')]['id']}},_0x41808a={};_0x41808a[_0xe209('0x34')]=_[_0xe209('0x31')](db[_0xe209('0x2b')][_0xe209('0x2c')]);_0x41808a[_0xe209('0x30')]=_[_0xe209('0x31')](_0x4c8665['query']);_0x41808a['filters']=_[_0xe209('0x33')](_0x41808a[_0xe209('0x34')],_0x41808a[_0xe209('0x30')]);_0x52f166[_0xe209('0x36')]=_[_0xe209('0x33')](_0x41808a[_0xe209('0x34')],qs[_0xe209('0x35')](_0x4c8665[_0xe209('0x30')][_0xe209('0x35')]));_0x52f166[_0xe209('0x36')]=_0x52f166[_0xe209('0x36')][_0xe209('0x44')]?_0x52f166[_0xe209('0x36')]:_0x41808a[_0xe209('0x34')];if(_0x4c8665[_0xe209('0x30')][_0xe209('0x3e')]){_0x52f166[_0xe209('0x3f')]=[{'all':!![]}];}_0x52f166=_[_0xe209('0x45')]({},_0x52f166,_0x4c8665['options']);return db[_0xe209('0x2b')]['find'](_0x52f166)[_0xe209('0x23')](handleEntityNotFound(_0x5586ae,null))[_0xe209('0x23')](respondWithResult(_0x5586ae,null))['catch'](handleError(_0x5586ae,null));};exports[_0xe209('0x46')]=function(_0x55f0ba,_0x9a3187){return db[_0xe209('0x2b')][_0xe209('0x46')](_0x55f0ba[_0xe209('0x47')],{})[_0xe209('0x23')](respondWithResult(_0x9a3187,0xc9))[_0xe209('0x41')](handleError(_0x9a3187,null));};exports[_0xe209('0x48')]=function(_0x137906,_0x2db9ff){return db[_0xe209('0x2b')][_0xe209('0x48')](_0x137906[_0xe209('0x47')],{'raw':![],'individualHooks':!![]})[_0xe209('0x23')](respondWithResult(_0x2db9ff,0xc9))[_0xe209('0x41')](handleError(_0x2db9ff,null));};exports[_0xe209('0x22')]=function(_0x5d36ae,_0x4e5306){if(_0x5d36ae['body']['id']){delete _0x5d36ae[_0xe209('0x47')]['id'];}return db[_0xe209('0x2b')]['find']({'where':{'id':_0x5d36ae[_0xe209('0x43')]['id']}})[_0xe209('0x23')](handleEntityNotFound(_0x4e5306,null))[_0xe209('0x23')](saveUpdates(_0x5d36ae[_0xe209('0x47')],null))[_0xe209('0x23')](respondWithResult(_0x4e5306,null))[_0xe209('0x41')](handleError(_0x4e5306,null));};exports['destroy']=function(_0x2b0e51,_0x40ff17){return db[_0xe209('0x2b')][_0xe209('0x49')]({'where':{'id':_0x2b0e51[_0xe209('0x43')]['id']}})[_0xe209('0x23')](handleEntityNotFound(_0x40ff17,null))[_0xe209('0x23')](removeEntity(_0x40ff17,null))[_0xe209('0x41')](handleError(_0x40ff17,null));};exports['bulkDestroy']=function(_0x353bcf,_0x1613bb){return db[_0xe209('0x2b')]['destroy']({'where':{'id':_0x353bcf[_0xe209('0x30')][_0xe209('0x4a')]||[]},'raw':![],'individualHooks':!![]})[_0xe209('0x23')](respondWithResult(_0x1613bb,0xcc))[_0xe209('0x41')](handleError(_0x1613bb,null));};exports[_0xe209('0x4b')]=function(_0x5c62ac,_0x11f20a,_0xd6c18b){return db[_0xe209('0x4c')][_0xe209('0x4d')]({'where':{'id':_0x5c62ac[_0xe209('0x43')]['id']}})[_0xe209('0x23')](handleEntityNotFound(_0x11f20a,null))[_0xe209('0x23')](function(_0x5da6e7){if(_0x5da6e7){return db[_0xe209('0x4e')][_0xe209('0x4f')](function(_0x410fcc){return db[_0xe209('0x2b')][_0xe209('0x50')]({'where':{'CustomReportId':_0x5c62ac[_0xe209('0x43')]['id']},'transaction':_0x410fcc})['then'](function(_0x13fc4e){var _0x9c9089=_['map'](_0x5c62ac[_0xe209('0x47')],function(_0x2ad522){delete _0x2ad522['id'];_0x2ad522[_0xe209('0x51')]=_0x5c62ac[_0xe209('0x43')]['id'];return _0x2ad522;});return db[_0xe209('0x2b')][_0xe209('0x48')](_0x9c9089,{'transaction':_0x410fcc});});})[_0xe209('0x23')](function(){return db[_0xe209('0x2b')][_0xe209('0x52')]({'where':{'CustomReportId':_0x5c62ac['params']['id']}});});}})[_0xe209('0x23')](respondWithResult(_0x11f20a,null))[_0xe209('0x41')](handleError(_0x11f20a,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 54ae1c3..ea83134 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 _0x2097=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./analyticFieldReport.attributes','exports','define'];(function(_0x2998f6,_0x29904e){var _0xf1ebac=function(_0x5352ca){while(--_0x5352ca){_0x2998f6['push'](_0x2998f6['shift']());}};_0xf1ebac(++_0x29904e);}(_0x2097,0x168));var _0x7209=function(_0x399060,_0xda4676){_0x399060=_0x399060-0x0;var _0x303936=_0x2097[_0x399060];return _0x303936;};'use strict';var _=require(_0x7209('0x0'));var util=require(_0x7209('0x1'));var logger=require(_0x7209('0x2'))(_0x7209('0x3'));var moment=require(_0x7209('0x4'));var BPromise=require(_0x7209('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7209('0x6'));var rimraf=require(_0x7209('0x7'));var config=require(_0x7209('0x8'));var attributes=require(_0x7209('0x9'));module[_0x7209('0xa')]=function(_0x1af421,_0x5139bf){return _0x1af421[_0x7209('0xb')]('AnalyticFieldReport',attributes,{'tableName':'analytics_report_fields','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xce41=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./analyticFieldReport.attributes','define','analytics_report_fields'];(function(_0x21f1dd,_0x4a4aab){var _0x281ae1=function(_0x5efd2e){while(--_0x5efd2e){_0x21f1dd['push'](_0x21f1dd['shift']());}};_0x281ae1(++_0x4a4aab);}(_0xce41,0x114));var _0x1ce4=function(_0x1cc961,_0x2c42ee){_0x1cc961=_0x1cc961-0x0;var _0x471d86=_0xce41[_0x1cc961];return _0x471d86;};'use strict';var _=require(_0x1ce4('0x0'));var util=require(_0x1ce4('0x1'));var logger=require(_0x1ce4('0x2'))(_0x1ce4('0x3'));var moment=require(_0x1ce4('0x4'));var BPromise=require(_0x1ce4('0x5'));var rp=require(_0x1ce4('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1ce4('0x7'));var config=require(_0x1ce4('0x8'));var attributes=require(_0x1ce4('0x9'));module['exports']=function(_0x23cb00,_0x5aa95d){return _0x23cb00[_0x1ce4('0xa')]('AnalyticFieldReport',attributes,{'tableName':_0x1ce4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.rpc.js b/server/api/analyticFieldReport/analyticFieldReport.rpc.js index 42170bb..982df11 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 _0xd791=['moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x38c37d,_0xbf2594){var _0x358127=function(_0x27686a){while(--_0x27686a){_0x38c37d['push'](_0x38c37d['shift']());}};_0x358127(++_0xbf2594);}(_0xd791,0xa8));var _0x1d79=function(_0xc7f23c,_0x2be758){_0xc7f23c=_0xc7f23c-0x0;var _0x4b4def=_0xd791[_0xc7f23c];return _0x4b4def;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1d79('0x0'));var BPromise=require(_0x1d79('0x1'));var rs=require(_0x1d79('0x2'));var fs=require('fs');var Redis=require(_0x1d79('0x3'));var db=require(_0x1d79('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1d79('0x5'));var config=require(_0x1d79('0x6'));var jayson=require(_0x1d79('0x7'));var client=jayson[_0x1d79('0x8')][_0x1d79('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2f1f1c,_0x3e1f0b,_0x253814){return new BPromise(function(_0x58adb6,_0x155401){return client[_0x1d79('0xa')](_0x2f1f1c,_0x253814)[_0x1d79('0xb')](function(_0x1648b9){logger[_0x1d79('0xc')](_0x1d79('0xd'),_0x3e1f0b,_0x1d79('0xe'));logger['debug']('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x3e1f0b,_0x1d79('0xe'),JSON[_0x1d79('0xf')](_0x1648b9));if(_0x1648b9[_0x1d79('0x10')]){if(_0x1648b9[_0x1d79('0x10')][_0x1d79('0x11')]===0x1f4){logger['error']('AnalyticFieldReport,\x20%s,\x20%s',_0x3e1f0b,_0x1648b9[_0x1d79('0x10')][_0x1d79('0x12')]);return _0x155401(_0x1648b9[_0x1d79('0x10')][_0x1d79('0x12')]);}logger[_0x1d79('0x10')](_0x1d79('0xd'),_0x3e1f0b,_0x1648b9[_0x1d79('0x10')]['message']);return _0x58adb6(_0x1648b9[_0x1d79('0x10')]['message']);}else{logger[_0x1d79('0xc')](_0x1d79('0xd'),_0x3e1f0b,_0x1d79('0xe'));_0x58adb6(_0x1648b9[_0x1d79('0x13')]['message']);}})[_0x1d79('0x14')](function(_0x3af881){logger[_0x1d79('0x10')](_0x1d79('0xd'),_0x3e1f0b,_0x3af881);_0x155401(_0x3af881);});});} \ No newline at end of file +var _0x1fc3=['../../config/utils','../../config/logger','rpc','../../config/environment','client','request','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','bluebird','ioredis'];(function(_0x29f617,_0x2fa3ec){var _0xdce0b5=function(_0x61d5b2){while(--_0x61d5b2){_0x29f617['push'](_0x29f617['shift']());}};_0xdce0b5(++_0x2fa3ec);}(_0x1fc3,0x9d));var _0x31fc=function(_0x8834f2,_0x455276){_0x8834f2=_0x8834f2-0x0;var _0x34540c=_0x1fc3[_0x8834f2];return _0x34540c;};'use strict';var _=require(_0x31fc('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x31fc('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x31fc('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x31fc('0x3'));var logger=require(_0x31fc('0x4'))(_0x31fc('0x5'));var config=require(_0x31fc('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x31fc('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3a7f63,_0x94fa69,_0x54a34d){return new BPromise(function(_0x31fcd5,_0x124d7c){return client[_0x31fc('0x8')](_0x3a7f63,_0x54a34d)['then'](function(_0x472949){logger[_0x31fc('0x9')](_0x31fc('0xa'),_0x94fa69,_0x31fc('0xb'));logger[_0x31fc('0xc')](_0x31fc('0xd'),_0x94fa69,'request\x20sent',JSON[_0x31fc('0xe')](_0x472949));if(_0x472949[_0x31fc('0xf')]){if(_0x472949['error'][_0x31fc('0x10')]===0x1f4){logger['error'](_0x31fc('0xa'),_0x94fa69,_0x472949[_0x31fc('0xf')][_0x31fc('0x11')]);return _0x124d7c(_0x472949[_0x31fc('0xf')][_0x31fc('0x11')]);}logger[_0x31fc('0xf')](_0x31fc('0xa'),_0x94fa69,_0x472949[_0x31fc('0xf')]['message']);return _0x31fcd5(_0x472949[_0x31fc('0xf')]['message']);}else{logger[_0x31fc('0x9')](_0x31fc('0xa'),_0x94fa69,'request\x20sent');_0x31fcd5(_0x472949[_0x31fc('0x12')][_0x31fc('0x11')]);}})[_0x31fc('0x13')](function(_0x52877c){logger[_0x31fc('0xf')](_0x31fc('0xa'),_0x94fa69,_0x52877c);_0x124d7c(_0x52877c);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index d9e5dc2..9541064 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(_0x3beb24,_0x56be4d){var _0x72e855=function(_0xaa8297){while(--_0xaa8297){_0x3beb24['push'](_0x3beb24['shift']());}};_0x72e855(++_0x56be4d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'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(_0x5cb414,_0x242417){var _0x24a5ac=function(_0x391144){while(--_0x391144){_0x5cb414['push'](_0x5cb414['shift']());}};_0x24a5ac(++_0x242417);}(_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['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 95ffca7..4c6bc75 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 _0x9993=['name','sequelize','STRING'];(function(_0x36d203,_0x3653f3){var _0x2f9e62=function(_0x461a77){while(--_0x461a77){_0x36d203['push'](_0x36d203['shift']());}};_0x2f9e62(++_0x3653f3);}(_0x9993,0x109));var _0x3999=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x9993[_0x2c91e9];return _0x13f0ff;};'use strict';var Sequelize=require(_0x3999('0x0'));module['exports']={'name':{'type':Sequelize[_0x3999('0x1')],'allowNull':![],'unique':_0x3999('0x2')},'table':{'type':Sequelize[_0x3999('0x1')]},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize[_0x3999('0x1')]}}; \ No newline at end of file +var _0x0cfa=['exports','STRING','name','sequelize'];(function(_0x361e5d,_0x15e1a4){var _0x4c303d=function(_0x504f9f){while(--_0x504f9f){_0x361e5d['push'](_0x361e5d['shift']());}};_0x4c303d(++_0x15e1a4);}(_0x0cfa,0x18f));var _0xa0cf=function(_0x2fef77,_0x53d26b){_0x2fef77=_0x2fef77-0x0;var _0x50e33c=_0x0cfa[_0x2fef77];return _0x50e33c;};'use strict';var Sequelize=require(_0xa0cf('0x0'));module[_0xa0cf('0x1')]={'name':{'type':Sequelize[_0xa0cf('0x2')],'allowNull':![],'unique':_0xa0cf('0x3')},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index c701538..01a1b56 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(_0x43aae9,_0x5354c9){var _0x296627=function(_0x43a85b){while(--_0x43a85b){_0x43aae9['push'](_0x43aae9['shift']());}};_0x296627(++_0x5354c9);}(_0x7217,0x19e));var _0x7721=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0x7217[_0x2bf141];return _0x48277b;};'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 _0xdc97=['mustache','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','update','then','get','destroy','sendStatus','error','stack','name','send','AnalyticMetric','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','length','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','includeAll','findAll','rows','catch','params','keys','fields','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Metrics','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','eml-format','rimraf','zip-dir','request-promise','bluebird'];(function(_0x474279,_0x100b57){var _0x35124a=function(_0x1d2f95){while(--_0x1d2f95){_0x474279['push'](_0x474279['shift']());}};_0x35124a(++_0x100b57);}(_0xdc97,0x13b));var _0x7dc9=function(_0x2ae54d,_0x117cc3){_0x2ae54d=_0x2ae54d-0x0;var _0x53f178=_0xdc97[_0x2ae54d];return _0x53f178;};'use strict';var emlformat=require(_0x7dc9('0x0'));var rimraf=require(_0x7dc9('0x1'));var zipdir=require(_0x7dc9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7dc9('0x3'));var moment=require('moment');var BPromise=require(_0x7dc9('0x4'));var Mustache=require(_0x7dc9('0x5'));var util=require('util');var path=require(_0x7dc9('0x6'));var sox=require(_0x7dc9('0x7'));var csv=require(_0x7dc9('0x8'));var ejs=require(_0x7dc9('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7dc9('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7dc9('0xb'));var deskjs=require(_0x7dc9('0xc'));var toCsv=require(_0x7dc9('0x8'));var querystring=require(_0x7dc9('0xd'));var Papa=require(_0x7dc9('0xe'));var Redis=require('ioredis');var authService=require(_0x7dc9('0xf'));var qs=require(_0x7dc9('0x10'));var as=require(_0x7dc9('0x11'));var hardwareService=require(_0x7dc9('0x12'));var logger=require(_0x7dc9('0x13'))(_0x7dc9('0x14'));var utils=require(_0x7dc9('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x599ef1,_0x94c75a){_0x94c75a=_0x94c75a||0xcc;return function(_0x14e5db){if(_0x14e5db){return _0x599ef1['sendStatus'](_0x94c75a);}return _0x599ef1[_0x7dc9('0x16')](_0x94c75a)[_0x7dc9('0x17')]();};}function respondWithResult(_0xaadf2,_0xf37bc7){_0xf37bc7=_0xf37bc7||0xc8;return function(_0x31d43d){if(_0x31d43d){return _0xaadf2[_0x7dc9('0x16')](_0xf37bc7)['json'](_0x31d43d);}};}function respondWithFilteredResult(_0x3a54f2,_0x278191){return function(_0x1b0aa1){if(_0x1b0aa1){var _0x442819=typeof _0x278191[_0x7dc9('0x18')]===_0x7dc9('0x19')&&typeof _0x278191[_0x7dc9('0x1a')]===_0x7dc9('0x19');var _0x4778d5=_0x1b0aa1['count'];var _0x22577e=_0x442819?0x0:_0x278191['offset'];var _0x1f5906=_0x442819?_0x1b0aa1[_0x7dc9('0x1b')]:_0x278191['offset']+_0x278191[_0x7dc9('0x1a')];var _0x3b738a;if(_0x1f5906>=_0x4778d5){_0x1f5906=_0x4778d5;_0x3b738a=0xc8;}else{_0x3b738a=0xce;}_0x3a54f2[_0x7dc9('0x16')](_0x3b738a);return _0x3a54f2[_0x7dc9('0x1c')](_0x7dc9('0x1d'),_0x22577e+'-'+_0x1f5906+'/'+_0x4778d5)[_0x7dc9('0x1e')](_0x1b0aa1);}return null;};}function patchUpdates(_0x2dad65){return function(_0x2895f5){try{jsonpatch[_0x7dc9('0x1f')](_0x2895f5,_0x2dad65,!![]);}catch(_0x2b38d6){return BPromise['reject'](_0x2b38d6);}return _0x2895f5['save']();};}function saveUpdates(_0x12954f,_0x5981e2){return function(_0x596e0f){if(_0x596e0f){return _0x596e0f[_0x7dc9('0x20')](_0x12954f)[_0x7dc9('0x21')](function(_0x5e9525){return _0x5e9525;});}return null;};}function removeEntity(_0xffc080,_0x43d31f){return function(_0x41110a){if(_0x41110a){return _0x41110a['destroy']()[_0x7dc9('0x21')](function(){var _0x1e3a8d=_0x41110a[_0x7dc9('0x22')]({'plain':!![]});var _0x55a482='Metrics';return db['UserProfileResource'][_0x7dc9('0x23')]({'where':{'type':_0x55a482,'resourceId':_0x1e3a8d['id']}})[_0x7dc9('0x21')](function(){return _0x41110a;});})['then'](function(){_0xffc080['status'](0xcc)[_0x7dc9('0x17')]();});}};}function handleEntityNotFound(_0x5afb7d,_0x2d22eb){return function(_0x1c690b){if(!_0x1c690b){_0x5afb7d[_0x7dc9('0x24')](0x194);}return _0x1c690b;};}function handleError(_0x3e4102,_0xa2aaa9){_0xa2aaa9=_0xa2aaa9||0x1f4;return function(_0x450124){logger[_0x7dc9('0x25')](_0x450124[_0x7dc9('0x26')]);if(_0x450124[_0x7dc9('0x27')]){delete _0x450124[_0x7dc9('0x27')];}_0x3e4102[_0x7dc9('0x16')](_0xa2aaa9)[_0x7dc9('0x28')](_0x450124);};}exports['index']=function(_0x4e929c,_0x513dd6){var _0x49a4a5={},_0x4a68f0={},_0x553a03={'count':0x0,'rows':[]};var _0x58c4e8=_['map'](db[_0x7dc9('0x29')][_0x7dc9('0x2a')],function(_0x29dcef){return{'name':_0x29dcef[_0x7dc9('0x2b')],'type':_0x29dcef[_0x7dc9('0x2c')][_0x7dc9('0x2d')]};});_0x4a68f0['model']=_['map'](_0x58c4e8,'name');_0x4a68f0[_0x7dc9('0x2e')]=_['keys'](_0x4e929c[_0x7dc9('0x2e')]);_0x4a68f0[_0x7dc9('0x2f')]=_[_0x7dc9('0x30')](_0x4a68f0[_0x7dc9('0x31')],_0x4a68f0[_0x7dc9('0x2e')]);_0x49a4a5[_0x7dc9('0x32')]=_[_0x7dc9('0x30')](_0x4a68f0[_0x7dc9('0x31')],qs['fields'](_0x4e929c[_0x7dc9('0x2e')]['fields']));_0x49a4a5[_0x7dc9('0x32')]=_0x49a4a5[_0x7dc9('0x32')][_0x7dc9('0x33')]?_0x49a4a5[_0x7dc9('0x32')]:_0x4a68f0['model'];if(!_0x4e929c[_0x7dc9('0x2e')]['hasOwnProperty'](_0x7dc9('0x34'))){_0x49a4a5['limit']=qs['limit'](_0x4e929c[_0x7dc9('0x2e')][_0x7dc9('0x1a')]);_0x49a4a5[_0x7dc9('0x18')]=qs[_0x7dc9('0x18')](_0x4e929c['query'][_0x7dc9('0x18')]);}_0x49a4a5[_0x7dc9('0x35')]=qs[_0x7dc9('0x36')](_0x4e929c[_0x7dc9('0x2e')][_0x7dc9('0x36')]);_0x49a4a5[_0x7dc9('0x37')]=qs[_0x7dc9('0x2f')](_[_0x7dc9('0x38')](_0x4e929c[_0x7dc9('0x2e')],_0x4a68f0[_0x7dc9('0x2f')]),_0x58c4e8);if(_0x4e929c[_0x7dc9('0x2e')][_0x7dc9('0x39')]){_0x49a4a5['where']=_[_0x7dc9('0x3a')](_0x49a4a5[_0x7dc9('0x37')],{'$or':_[_0x7dc9('0x3b')](_0x58c4e8,function(_0xfd2612){if(_0xfd2612['type']!==_0x7dc9('0x3c')){var _0x89db0e={};_0x89db0e[_0xfd2612[_0x7dc9('0x27')]]={'$like':'%'+_0x4e929c[_0x7dc9('0x2e')][_0x7dc9('0x39')]+'%'};return _0x89db0e;}})});}_0x49a4a5=_[_0x7dc9('0x3a')]({},_0x49a4a5,_0x4e929c['options']);var _0x553230={'where':_0x49a4a5[_0x7dc9('0x37')]};return db[_0x7dc9('0x29')]['count'](_0x553230)[_0x7dc9('0x21')](function(_0x4a37ec){_0x553a03[_0x7dc9('0x1b')]=_0x4a37ec;if(_0x4e929c[_0x7dc9('0x2e')][_0x7dc9('0x3d')]){_0x49a4a5['include']=[{'all':!![]}];}return db[_0x7dc9('0x29')][_0x7dc9('0x3e')](_0x49a4a5);})[_0x7dc9('0x21')](function(_0x95513c){_0x553a03[_0x7dc9('0x3f')]=_0x95513c;return _0x553a03;})[_0x7dc9('0x21')](respondWithFilteredResult(_0x513dd6,_0x49a4a5))[_0x7dc9('0x40')](handleError(_0x513dd6,null));};exports['show']=function(_0x187aa6,_0x4f29b2){var _0x52d883={'raw':!![],'where':{'id':_0x187aa6[_0x7dc9('0x41')]['id']}},_0xcced6c={};_0xcced6c[_0x7dc9('0x31')]=_[_0x7dc9('0x42')](db[_0x7dc9('0x29')][_0x7dc9('0x2a')]);_0xcced6c[_0x7dc9('0x2e')]=_[_0x7dc9('0x42')](_0x187aa6[_0x7dc9('0x2e')]);_0xcced6c['filters']=_[_0x7dc9('0x30')](_0xcced6c[_0x7dc9('0x31')],_0xcced6c[_0x7dc9('0x2e')]);_0x52d883[_0x7dc9('0x32')]=_[_0x7dc9('0x30')](_0xcced6c[_0x7dc9('0x31')],qs['fields'](_0x187aa6[_0x7dc9('0x2e')][_0x7dc9('0x43')]));_0x52d883['attributes']=_0x52d883[_0x7dc9('0x32')][_0x7dc9('0x33')]?_0x52d883[_0x7dc9('0x32')]:_0xcced6c['model'];if(_0x187aa6[_0x7dc9('0x2e')]['includeAll']){_0x52d883['include']=[{'all':!![]}];}_0x52d883=_[_0x7dc9('0x3a')]({},_0x52d883,_0x187aa6[_0x7dc9('0x44')]);return db[_0x7dc9('0x29')]['find'](_0x52d883)['then'](handleEntityNotFound(_0x4f29b2,null))[_0x7dc9('0x21')](respondWithResult(_0x4f29b2,null))['catch'](handleError(_0x4f29b2,null));};exports[_0x7dc9('0x45')]=function(_0x4ab558,_0x5e2d59){return db[_0x7dc9('0x29')][_0x7dc9('0x45')](_0x4ab558[_0x7dc9('0x46')],{})[_0x7dc9('0x21')](function(_0x414bf4){var _0x113087=_0x4ab558[_0x7dc9('0x47')][_0x7dc9('0x22')]({'plain':!![]});if(!_0x113087)throw new Error(_0x7dc9('0x48'));if(_0x113087[_0x7dc9('0x49')]===_0x7dc9('0x47')){var _0x13580b=_0x414bf4[_0x7dc9('0x22')]({'plain':!![]});var _0x59be9b=_0x7dc9('0x4a');return db['UserProfileSection']['find']({'where':{'name':_0x59be9b,'userProfileId':_0x113087[_0x7dc9('0x4b')]},'raw':!![]})[_0x7dc9('0x21')](function(_0x40e382){if(_0x40e382&&_0x40e382[_0x7dc9('0x4c')]===0x0){return db[_0x7dc9('0x4d')]['create']({'name':_0x13580b[_0x7dc9('0x27')],'resourceId':_0x13580b['id'],'type':_0x40e382[_0x7dc9('0x27')],'sectionId':_0x40e382['id']},{})[_0x7dc9('0x21')](function(){return _0x414bf4;});}else{return _0x414bf4;}})['catch'](function(_0x341909){logger[_0x7dc9('0x25')](_0x7dc9('0x4e'),_0x341909);throw _0x341909;});}return _0x414bf4;})[_0x7dc9('0x21')](respondWithResult(_0x5e2d59,0xc9))[_0x7dc9('0x40')](handleError(_0x5e2d59,null));};exports[_0x7dc9('0x20')]=function(_0x593132,_0x366b8b){if(_0x593132[_0x7dc9('0x46')]['id']){delete _0x593132[_0x7dc9('0x46')]['id'];}return db[_0x7dc9('0x29')][_0x7dc9('0x4f')]({'where':{'id':_0x593132[_0x7dc9('0x41')]['id']}})[_0x7dc9('0x21')](handleEntityNotFound(_0x366b8b,null))[_0x7dc9('0x21')](saveUpdates(_0x593132[_0x7dc9('0x46')],null))[_0x7dc9('0x21')](respondWithResult(_0x366b8b,null))[_0x7dc9('0x40')](handleError(_0x366b8b,null));};exports[_0x7dc9('0x23')]=function(_0x4fec6e,_0x1767b6){return db[_0x7dc9('0x29')][_0x7dc9('0x4f')]({'where':{'id':_0x4fec6e[_0x7dc9('0x41')]['id']}})[_0x7dc9('0x21')](handleEntityNotFound(_0x1767b6,null))['then'](removeEntity(_0x1767b6,null))[_0x7dc9('0x40')](handleError(_0x1767b6,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 04a3012..f5d4a5d 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 _0x5024=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./analyticMetric.attributes','exports','define','analytics_metrics'];(function(_0x5ed7ec,_0x30f880){var _0x1fa889=function(_0x5105f7){while(--_0x5105f7){_0x5ed7ec['push'](_0x5ed7ec['shift']());}};_0x1fa889(++_0x30f880);}(_0x5024,0xf7));var _0x4502=function(_0x31893a,_0x15cf6f){_0x31893a=_0x31893a-0x0;var _0x18d55d=_0x5024[_0x31893a];return _0x18d55d;};'use strict';var _=require(_0x4502('0x0'));var util=require(_0x4502('0x1'));var logger=require(_0x4502('0x2'))(_0x4502('0x3'));var moment=require('moment');var BPromise=require(_0x4502('0x4'));var rp=require(_0x4502('0x5'));var fs=require('fs');var path=require(_0x4502('0x6'));var rimraf=require(_0x4502('0x7'));var config=require(_0x4502('0x8'));var attributes=require(_0x4502('0x9'));module[_0x4502('0xa')]=function(_0x5eddab,_0x548459){return _0x5eddab[_0x4502('0xb')]('AnalyticMetric',attributes,{'tableName':_0x4502('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbf4e=['moment','bluebird','path','./analyticMetric.attributes','exports','define','AnalyticMetric','lodash','util','../../config/logger','api'];(function(_0x241645,_0x59dd28){var _0x587a20=function(_0xe6fced){while(--_0xe6fced){_0x241645['push'](_0x241645['shift']());}};_0x587a20(++_0x59dd28);}(_0xbf4e,0x172));var _0xebf4=function(_0x5df2a2,_0x13729b){_0x5df2a2=_0x5df2a2-0x0;var _0x4bc263=_0xbf4e[_0x5df2a2];return _0x4bc263;};'use strict';var _=require(_0xebf4('0x0'));var util=require(_0xebf4('0x1'));var logger=require(_0xebf4('0x2'))(_0xebf4('0x3'));var moment=require(_0xebf4('0x4'));var BPromise=require(_0xebf4('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xebf4('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xebf4('0x7'));module[_0xebf4('0x8')]=function(_0x5adea8,_0x412bbe){return _0x5adea8[_0xebf4('0x9')](_0xebf4('0xa'),attributes,{'tableName':'analytics_metrics','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index 709b7f7..e9a91c2 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 _0x6e9d=['message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','error','code','AnalyticMetric,\x20%s,\x20%s'];(function(_0x10e446,_0x15023e){var _0x3243a6=function(_0x5d01d3){while(--_0x5d01d3){_0x10e446['push'](_0x10e446['shift']());}};_0x3243a6(++_0x15023e);}(_0x6e9d,0x87));var _0xd6e9=function(_0xe0a0f,_0x157fc9){_0xe0a0f=_0xe0a0f-0x0;var _0x24f0a6=_0x6e9d[_0xe0a0f];return _0x24f0a6;};'use strict';var _=require(_0xd6e9('0x0'));var util=require('util');var moment=require(_0xd6e9('0x1'));var BPromise=require(_0xd6e9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd6e9('0x3'));var db=require(_0xd6e9('0x4'))['db'];var utils=require(_0xd6e9('0x5'));var logger=require('../../config/logger')(_0xd6e9('0x6'));var config=require(_0xd6e9('0x7'));var jayson=require(_0xd6e9('0x8'));var client=jayson['client'][_0xd6e9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x17ef26,_0x160a5f,_0x2552e8){return new BPromise(function(_0x151c47,_0x190739){return client[_0xd6e9('0xa')](_0x17ef26,_0x2552e8)[_0xd6e9('0xb')](function(_0x4f6c31){logger[_0xd6e9('0xc')]('AnalyticMetric,\x20%s,\x20%s',_0x160a5f,_0xd6e9('0xd'));logger[_0xd6e9('0xe')](_0xd6e9('0xf'),_0x160a5f,_0xd6e9('0xd'),JSON['stringify'](_0x4f6c31));if(_0x4f6c31['error']){if(_0x4f6c31[_0xd6e9('0x10')][_0xd6e9('0x11')]===0x1f4){logger[_0xd6e9('0x10')](_0xd6e9('0x12'),_0x160a5f,_0x4f6c31[_0xd6e9('0x10')][_0xd6e9('0x13')]);return _0x190739(_0x4f6c31[_0xd6e9('0x10')][_0xd6e9('0x13')]);}logger[_0xd6e9('0x10')]('AnalyticMetric,\x20%s,\x20%s',_0x160a5f,_0x4f6c31[_0xd6e9('0x10')][_0xd6e9('0x13')]);return _0x151c47(_0x4f6c31['error'][_0xd6e9('0x13')]);}else{logger['info'](_0xd6e9('0x12'),_0x160a5f,'request\x20sent');_0x151c47(_0x4f6c31[_0xd6e9('0x14')][_0xd6e9('0x13')]);}})[_0xd6e9('0x15')](function(_0xad12fd){logger[_0xd6e9('0x10')](_0xd6e9('0x12'),_0x160a5f,_0xad12fd);_0x190739(_0xad12fd);});});} \ No newline at end of file +var _0x67bb=['request','then','info','debug','request\x20sent','stringify','error','code','AnalyticMetric,\x20%s,\x20%s','message','result','catch','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client'];(function(_0x2f3dd6,_0x1bf689){var _0x5cb301=function(_0x2e39c5){while(--_0x2e39c5){_0x2f3dd6['push'](_0x2f3dd6['shift']());}};_0x5cb301(++_0x1bf689);}(_0x67bb,0x84));var _0xb67b=function(_0x4303cc,_0x4a75fc){_0x4303cc=_0x4303cc-0x0;var _0x6d9fd2=_0x67bb[_0x4303cc];return _0x6d9fd2;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb67b('0x0'));var BPromise=require('bluebird');var rs=require(_0xb67b('0x1'));var fs=require('fs');var Redis=require(_0xb67b('0x2'));var db=require(_0xb67b('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xb67b('0x4'))(_0xb67b('0x5'));var config=require('../../config/environment');var jayson=require(_0xb67b('0x6'));var client=jayson[_0xb67b('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x30f213,_0x39f2d4,_0x582302){return new BPromise(function(_0x3dcb02,_0x3b6226){return client[_0xb67b('0x8')](_0x30f213,_0x582302)[_0xb67b('0x9')](function(_0x30e2e5){logger[_0xb67b('0xa')]('AnalyticMetric,\x20%s,\x20%s',_0x39f2d4,'request\x20sent');logger[_0xb67b('0xb')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x39f2d4,_0xb67b('0xc'),JSON[_0xb67b('0xd')](_0x30e2e5));if(_0x30e2e5[_0xb67b('0xe')]){if(_0x30e2e5[_0xb67b('0xe')][_0xb67b('0xf')]===0x1f4){logger['error'](_0xb67b('0x10'),_0x39f2d4,_0x30e2e5['error'][_0xb67b('0x11')]);return _0x3b6226(_0x30e2e5['error'][_0xb67b('0x11')]);}logger[_0xb67b('0xe')]('AnalyticMetric,\x20%s,\x20%s',_0x39f2d4,_0x30e2e5[_0xb67b('0xe')][_0xb67b('0x11')]);return _0x3dcb02(_0x30e2e5[_0xb67b('0xe')][_0xb67b('0x11')]);}else{logger[_0xb67b('0xa')](_0xb67b('0x10'),_0x39f2d4,_0xb67b('0xc'));_0x3dcb02(_0x30e2e5[_0xb67b('0x12')][_0xb67b('0x11')]);}})[_0xb67b('0x13')](function(_0x3271bb){logger['error'](_0xb67b('0x10'),_0x39f2d4,_0x3271bb);_0x3b6226(_0x3271bb);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 5b6c127..75e93be 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 _0xbd18=['post','put','update','destroy','exports','multer','util','path','express','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show'];(function(_0x259fe7,_0x2fc1fb){var _0x45f849=function(_0x454654){while(--_0x454654){_0x259fe7['push'](_0x259fe7['shift']());}};_0x45f849(++_0x2fc1fb);}(_0xbd18,0x195));var _0x8bd1=function(_0x25f715,_0x14a766){_0x25f715=_0x25f715-0x0;var _0x351068=_0xbd18[_0x25f715];return _0x351068;};'use strict';var multer=require(_0x8bd1('0x0'));var util=require(_0x8bd1('0x1'));var path=require(_0x8bd1('0x2'));var timeout=require('connect-timeout');var express=require(_0x8bd1('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8bd1('0x4'));var config=require(_0x8bd1('0x5'));var controller=require('./analyticMetric.controller');router['get']('/',auth[_0x8bd1('0x6')](),controller[_0x8bd1('0x7')]);router[_0x8bd1('0x8')](_0x8bd1('0x9'),auth['isAuthenticated'](),controller[_0x8bd1('0xa')]);router[_0x8bd1('0xb')]('/',auth[_0x8bd1('0x6')](),controller['create']);router[_0x8bd1('0xc')](_0x8bd1('0x9'),auth[_0x8bd1('0x6')](),controller[_0x8bd1('0xd')]);router['delete'](_0x8bd1('0x9'),auth['isAuthenticated'](),controller[_0x8bd1('0xe')]);module[_0x8bd1('0xf')]=router; \ No newline at end of file +var _0x41f2=['fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','update','delete','destroy','multer','util','connect-timeout','express','Router'];(function(_0x4e2adf,_0x2c273){var _0x113d4f=function(_0x43c686){while(--_0x43c686){_0x4e2adf['push'](_0x4e2adf['shift']());}};_0x113d4f(++_0x2c273);}(_0x41f2,0x14f));var _0x241f=function(_0xb8c66b,_0x2ed005){_0xb8c66b=_0xb8c66b-0x0;var _0x3ed460=_0x41f2[_0xb8c66b];return _0x3ed460;};'use strict';var multer=require(_0x241f('0x0'));var util=require(_0x241f('0x1'));var path=require('path');var timeout=require(_0x241f('0x2'));var express=require(_0x241f('0x3'));var router=express[_0x241f('0x4')]();var fs_extra=require(_0x241f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x241f('0x6'));var config=require(_0x241f('0x7'));var controller=require('./analyticMetric.controller');router[_0x241f('0x8')]('/',auth[_0x241f('0x9')](),controller[_0x241f('0xa')]);router[_0x241f('0x8')](_0x241f('0xb'),auth['isAuthenticated'](),controller[_0x241f('0xc')]);router[_0x241f('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x241f('0xb'),auth['isAuthenticated'](),controller[_0x241f('0xe')]);router[_0x241f('0xf')](_0x241f('0xb'),auth['isAuthenticated'](),controller[_0x241f('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 3d1f44b..47fe9b3 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 _0xb253=['exports','TEXT','sequelize'];(function(_0x4222a3,_0x3cbcb3){var _0x2aabf6=function(_0x59a37c){while(--_0x59a37c){_0x4222a3['push'](_0x4222a3['shift']());}};_0x2aabf6(++_0x3cbcb3);}(_0xb253,0x15b));var _0x3b25=function(_0x1f973c,_0x3c309e){_0x1f973c=_0x1f973c-0x0;var _0x66ad61=_0xb253[_0x1f973c];return _0x66ad61;};'use strict';var Sequelize=require(_0x3b25('0x0'));module[_0x3b25('0x1')]={'tree':{'type':Sequelize[_0x3b25('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xcea2=['sequelize','TEXT'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0xcea2,0x15a));var _0x2cea=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0xcea2[_0x4c12ec];return _0x3ae42c;};'use strict';var Sequelize=require(_0x2cea('0x0'));module['exports']={'tree':{'type':Sequelize[_0x2cea('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 54be0da..8c77382 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 _0xe7db=['VIRTUAL','options','findAll','rows','catch','show','params','keys','includeAll','find','create','body','eml-format','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','then','error','name','send','index','map','AnalyticTreeReport','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge'];(function(_0x265ce5,_0x3ca145){var _0x22b666=function(_0x54b5a1){while(--_0x54b5a1){_0x265ce5['push'](_0x265ce5['shift']());}};_0x22b666(++_0x3ca145);}(_0xe7db,0x96));var _0xbe7d=function(_0xd050c6,_0x58ffb4){_0xd050c6=_0xd050c6-0x0;var _0x7278a=_0xe7db[_0xd050c6];return _0x7278a;};'use strict';var emlformat=require(_0xbe7d('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xbe7d('0x1'));var rp=require(_0xbe7d('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xbe7d('0x3'));var util=require(_0xbe7d('0x4'));var path=require(_0xbe7d('0x5'));var sox=require(_0xbe7d('0x6'));var csv=require(_0xbe7d('0x7'));var ejs=require(_0xbe7d('0x8'));var fs=require('fs');var fs_extra=require(_0xbe7d('0x9'));var _=require(_0xbe7d('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xbe7d('0xb'));var deskjs=require(_0xbe7d('0xc'));var toCsv=require(_0xbe7d('0x7'));var querystring=require(_0xbe7d('0xd'));var Papa=require('papaparse');var Redis=require(_0xbe7d('0xe'));var authService=require(_0xbe7d('0xf'));var qs=require(_0xbe7d('0x10'));var as=require(_0xbe7d('0x11'));var hardwareService=require(_0xbe7d('0x12'));var logger=require('../../config/logger')(_0xbe7d('0x13'));var utils=require('../../config/utils');var config=require(_0xbe7d('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x263338,_0x217f34){_0x217f34=_0x217f34||0xcc;return function(_0x1abf80){if(_0x1abf80){return _0x263338[_0xbe7d('0x15')](_0x217f34);}return _0x263338[_0xbe7d('0x16')](_0x217f34)[_0xbe7d('0x17')]();};}function respondWithResult(_0x5c8154,_0x1758af){_0x1758af=_0x1758af||0xc8;return function(_0x51a683){if(_0x51a683){return _0x5c8154[_0xbe7d('0x16')](_0x1758af)[_0xbe7d('0x18')](_0x51a683);}};}function respondWithFilteredResult(_0x4b6de2,_0x248270){return function(_0x90a2e6){if(_0x90a2e6){var _0x3c8930=typeof _0x248270[_0xbe7d('0x19')]===_0xbe7d('0x1a')&&typeof _0x248270['limit']===_0xbe7d('0x1a');var _0x14683c=_0x90a2e6[_0xbe7d('0x1b')];var _0x464eef=_0x3c8930?0x0:_0x248270[_0xbe7d('0x19')];var _0x2b76e6=_0x3c8930?_0x90a2e6[_0xbe7d('0x1b')]:_0x248270[_0xbe7d('0x19')]+_0x248270[_0xbe7d('0x1c')];var _0x4d0134;if(_0x2b76e6>=_0x14683c){_0x2b76e6=_0x14683c;_0x4d0134=0xc8;}else{_0x4d0134=0xce;}_0x4b6de2[_0xbe7d('0x16')](_0x4d0134);return _0x4b6de2[_0xbe7d('0x1d')]('Content-Range',_0x464eef+'-'+_0x2b76e6+'/'+_0x14683c)['json'](_0x90a2e6);}return null;};}function patchUpdates(_0x18a6e8){return function(_0x11f9a2){try{jsonpatch[_0xbe7d('0x1e')](_0x11f9a2,_0x18a6e8,!![]);}catch(_0x10c8e9){return BPromise[_0xbe7d('0x1f')](_0x10c8e9);}return _0x11f9a2[_0xbe7d('0x20')]();};}function saveUpdates(_0x49625c,_0x111bd6){return function(_0x23a682){if(_0x23a682){return _0x23a682[_0xbe7d('0x21')](_0x49625c)[_0xbe7d('0x22')](function(_0x982f41){return _0x982f41;});}return null;};}function removeEntity(_0x50ac7a,_0x2a2c53){return function(_0x204063){if(_0x204063){return _0x204063['destroy']()[_0xbe7d('0x22')](function(){_0x50ac7a[_0xbe7d('0x16')](0xcc)[_0xbe7d('0x17')]();});}};}function handleEntityNotFound(_0x1007e5,_0x5d30d3){return function(_0x44819e){if(!_0x44819e){_0x1007e5[_0xbe7d('0x15')](0x194);}return _0x44819e;};}function handleError(_0x2b5b7d,_0x3256de){_0x3256de=_0x3256de||0x1f4;return function(_0x70cd38){logger[_0xbe7d('0x23')](_0x70cd38['stack']);if(_0x70cd38[_0xbe7d('0x24')]){delete _0x70cd38[_0xbe7d('0x24')];}_0x2b5b7d['status'](_0x3256de)[_0xbe7d('0x25')](_0x70cd38);};}exports[_0xbe7d('0x26')]=function(_0x573bb2,_0x59a8e8){var _0x54deac={},_0xdc7464={},_0x21a3c3={'count':0x0,'rows':[]};var _0x197a79=_[_0xbe7d('0x27')](db[_0xbe7d('0x28')][_0xbe7d('0x29')],function(_0x258e4d){return{'name':_0x258e4d['fieldName'],'type':_0x258e4d[_0xbe7d('0x2a')][_0xbe7d('0x2b')]};});_0xdc7464[_0xbe7d('0x2c')]=_['map'](_0x197a79,_0xbe7d('0x24'));_0xdc7464[_0xbe7d('0x2d')]=_['keys'](_0x573bb2[_0xbe7d('0x2d')]);_0xdc7464[_0xbe7d('0x2e')]=_[_0xbe7d('0x2f')](_0xdc7464['model'],_0xdc7464[_0xbe7d('0x2d')]);_0x54deac[_0xbe7d('0x30')]=_[_0xbe7d('0x2f')](_0xdc7464[_0xbe7d('0x2c')],qs[_0xbe7d('0x31')](_0x573bb2[_0xbe7d('0x2d')]['fields']));_0x54deac[_0xbe7d('0x30')]=_0x54deac[_0xbe7d('0x30')][_0xbe7d('0x32')]?_0x54deac['attributes']:_0xdc7464[_0xbe7d('0x2c')];if(!_0x573bb2[_0xbe7d('0x2d')]['hasOwnProperty'](_0xbe7d('0x33'))){_0x54deac[_0xbe7d('0x1c')]=qs[_0xbe7d('0x1c')](_0x573bb2[_0xbe7d('0x2d')][_0xbe7d('0x1c')]);_0x54deac['offset']=qs[_0xbe7d('0x19')](_0x573bb2[_0xbe7d('0x2d')]['offset']);}_0x54deac['order']=qs[_0xbe7d('0x34')](_0x573bb2['query']['sort']);_0x54deac[_0xbe7d('0x35')]=qs[_0xbe7d('0x2e')](_[_0xbe7d('0x36')](_0x573bb2[_0xbe7d('0x2d')],_0xdc7464[_0xbe7d('0x2e')]),_0x197a79);if(_0x573bb2[_0xbe7d('0x2d')][_0xbe7d('0x37')]){_0x54deac['where']=_[_0xbe7d('0x38')](_0x54deac[_0xbe7d('0x35')],{'$or':_['map'](_0x197a79,function(_0x348e82){if(_0x348e82[_0xbe7d('0x2a')]!==_0xbe7d('0x39')){var _0x302464={};_0x302464[_0x348e82[_0xbe7d('0x24')]]={'$like':'%'+_0x573bb2[_0xbe7d('0x2d')][_0xbe7d('0x37')]+'%'};return _0x302464;}})});}_0x54deac=_[_0xbe7d('0x38')]({},_0x54deac,_0x573bb2[_0xbe7d('0x3a')]);var _0xc2f01b={'where':_0x54deac[_0xbe7d('0x35')]};return db[_0xbe7d('0x28')][_0xbe7d('0x1b')](_0xc2f01b)[_0xbe7d('0x22')](function(_0x4fbfdf){_0x21a3c3[_0xbe7d('0x1b')]=_0x4fbfdf;if(_0x573bb2[_0xbe7d('0x2d')]['includeAll']){_0x54deac['include']=[{'all':!![]}];}return db[_0xbe7d('0x28')][_0xbe7d('0x3b')](_0x54deac);})[_0xbe7d('0x22')](function(_0x5a79f3){_0x21a3c3[_0xbe7d('0x3c')]=_0x5a79f3;return _0x21a3c3;})[_0xbe7d('0x22')](respondWithFilteredResult(_0x59a8e8,_0x54deac))[_0xbe7d('0x3d')](handleError(_0x59a8e8,null));};exports[_0xbe7d('0x3e')]=function(_0x2f2704,_0x3bce20){var _0x5f2b7c={'raw':!![],'where':{'id':_0x2f2704[_0xbe7d('0x3f')]['id']}},_0x5a508e={};_0x5a508e[_0xbe7d('0x2c')]=_['keys'](db[_0xbe7d('0x28')][_0xbe7d('0x29')]);_0x5a508e[_0xbe7d('0x2d')]=_[_0xbe7d('0x40')](_0x2f2704[_0xbe7d('0x2d')]);_0x5a508e[_0xbe7d('0x2e')]=_[_0xbe7d('0x2f')](_0x5a508e[_0xbe7d('0x2c')],_0x5a508e[_0xbe7d('0x2d')]);_0x5f2b7c[_0xbe7d('0x30')]=_['intersection'](_0x5a508e[_0xbe7d('0x2c')],qs[_0xbe7d('0x31')](_0x2f2704[_0xbe7d('0x2d')][_0xbe7d('0x31')]));_0x5f2b7c['attributes']=_0x5f2b7c[_0xbe7d('0x30')][_0xbe7d('0x32')]?_0x5f2b7c[_0xbe7d('0x30')]:_0x5a508e['model'];if(_0x2f2704[_0xbe7d('0x2d')][_0xbe7d('0x41')]){_0x5f2b7c['include']=[{'all':!![]}];}_0x5f2b7c=_[_0xbe7d('0x38')]({},_0x5f2b7c,_0x2f2704[_0xbe7d('0x3a')]);return db[_0xbe7d('0x28')][_0xbe7d('0x42')](_0x5f2b7c)[_0xbe7d('0x22')](handleEntityNotFound(_0x3bce20,null))[_0xbe7d('0x22')](respondWithResult(_0x3bce20,null))[_0xbe7d('0x3d')](handleError(_0x3bce20,null));};exports[_0xbe7d('0x43')]=function(_0xb00c28,_0x4b30ba){return db[_0xbe7d('0x28')][_0xbe7d('0x43')](_0xb00c28[_0xbe7d('0x44')],{})[_0xbe7d('0x22')](respondWithResult(_0x4b30ba,0xc9))[_0xbe7d('0x3d')](handleError(_0x4b30ba,null));};exports[_0xbe7d('0x21')]=function(_0x3f5f05,_0x11d18c){if(_0x3f5f05[_0xbe7d('0x44')]['id']){delete _0x3f5f05[_0xbe7d('0x44')]['id'];}return db[_0xbe7d('0x28')][_0xbe7d('0x42')]({'where':{'id':_0x3f5f05['params']['id']}})[_0xbe7d('0x22')](handleEntityNotFound(_0x11d18c,null))['then'](saveUpdates(_0x3f5f05['body'],null))[_0xbe7d('0x22')](respondWithResult(_0x11d18c,null))[_0xbe7d('0x3d')](handleError(_0x11d18c,null));};exports['destroy']=function(_0x39ce42,_0x5bc17a){return db[_0xbe7d('0x28')][_0xbe7d('0x42')]({'where':{'id':_0x39ce42[_0xbe7d('0x3f')]['id']}})[_0xbe7d('0x22')](handleEntityNotFound(_0x5bc17a,null))[_0xbe7d('0x22')](removeEntity(_0x5bc17a,null))[_0xbe7d('0x3d')](handleError(_0x5bc17a,null));}; \ No newline at end of file +var _0xdd66=['body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','undefined','count','offset','limit','Content-Range','json','apply','save','update','destroy','then','end','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','AnalyticTreeReport','includeAll','include','findAll','rows','catch','params','options','find','create'];(function(_0x37b849,_0x207727){var _0x4f6b6f=function(_0x10a9fe){while(--_0x10a9fe){_0x37b849['push'](_0x37b849['shift']());}};_0x4f6b6f(++_0x207727);}(_0xdd66,0x1cf));var _0x6dd6=function(_0x25410b,_0x130c55){_0x25410b=_0x25410b-0x0;var _0x5d2982=_0xdd66[_0x25410b];return _0x5d2982;};'use strict';var emlformat=require(_0x6dd6('0x0'));var rimraf=require(_0x6dd6('0x1'));var zipdir=require(_0x6dd6('0x2'));var jsonpatch=require(_0x6dd6('0x3'));var rp=require(_0x6dd6('0x4'));var moment=require(_0x6dd6('0x5'));var BPromise=require(_0x6dd6('0x6'));var Mustache=require('mustache');var util=require(_0x6dd6('0x7'));var path=require(_0x6dd6('0x8'));var sox=require(_0x6dd6('0x9'));var csv=require('to-csv');var ejs=require(_0x6dd6('0xa'));var fs=require('fs');var fs_extra=require(_0x6dd6('0xb'));var _=require(_0x6dd6('0xc'));var squel=require(_0x6dd6('0xd'));var crypto=require(_0x6dd6('0xe'));var jsforce=require(_0x6dd6('0xf'));var deskjs=require(_0x6dd6('0x10'));var toCsv=require(_0x6dd6('0x11'));var querystring=require(_0x6dd6('0x12'));var Papa=require(_0x6dd6('0x13'));var Redis=require(_0x6dd6('0x14'));var authService=require(_0x6dd6('0x15'));var qs=require(_0x6dd6('0x16'));var as=require(_0x6dd6('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6dd6('0x18'))(_0x6dd6('0x19'));var utils=require(_0x6dd6('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0x6dd6('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5b5eb2,_0x54e080){_0x54e080=_0x54e080||0xcc;return function(_0x190b59){if(_0x190b59){return _0x5b5eb2[_0x6dd6('0x1c')](_0x54e080);}return _0x5b5eb2['status'](_0x54e080)['end']();};}function respondWithResult(_0x54dd0d,_0x39124b){_0x39124b=_0x39124b||0xc8;return function(_0x2c0df7){if(_0x2c0df7){return _0x54dd0d[_0x6dd6('0x1d')](_0x39124b)['json'](_0x2c0df7);}};}function respondWithFilteredResult(_0x25400e,_0x1507e2){return function(_0x1f93da){if(_0x1f93da){var _0x473813=typeof _0x1507e2['offset']==='undefined'&&typeof _0x1507e2['limit']===_0x6dd6('0x1e');var _0x571dbe=_0x1f93da[_0x6dd6('0x1f')];var _0x102c46=_0x473813?0x0:_0x1507e2[_0x6dd6('0x20')];var _0x547a00=_0x473813?_0x1f93da['count']:_0x1507e2[_0x6dd6('0x20')]+_0x1507e2[_0x6dd6('0x21')];var _0x58f1de;if(_0x547a00>=_0x571dbe){_0x547a00=_0x571dbe;_0x58f1de=0xc8;}else{_0x58f1de=0xce;}_0x25400e[_0x6dd6('0x1d')](_0x58f1de);return _0x25400e['set'](_0x6dd6('0x22'),_0x102c46+'-'+_0x547a00+'/'+_0x571dbe)[_0x6dd6('0x23')](_0x1f93da);}return null;};}function patchUpdates(_0x484eac){return function(_0x35ae4e){try{jsonpatch[_0x6dd6('0x24')](_0x35ae4e,_0x484eac,!![]);}catch(_0x59b2ae){return BPromise['reject'](_0x59b2ae);}return _0x35ae4e[_0x6dd6('0x25')]();};}function saveUpdates(_0x4eab9e,_0x559f7a){return function(_0x5c8aee){if(_0x5c8aee){return _0x5c8aee[_0x6dd6('0x26')](_0x4eab9e)['then'](function(_0x2632ae){return _0x2632ae;});}return null;};}function removeEntity(_0x5f29c8,_0x5d4ca3){return function(_0xe833fb){if(_0xe833fb){return _0xe833fb[_0x6dd6('0x27')]()[_0x6dd6('0x28')](function(){_0x5f29c8['status'](0xcc)[_0x6dd6('0x29')]();});}};}function handleEntityNotFound(_0x40d0db,_0x34c8ec){return function(_0x2120b5){if(!_0x2120b5){_0x40d0db[_0x6dd6('0x1c')](0x194);}return _0x2120b5;};}function handleError(_0x26d1fd,_0x243d1a){_0x243d1a=_0x243d1a||0x1f4;return function(_0x341906){logger['error'](_0x341906[_0x6dd6('0x2a')]);if(_0x341906[_0x6dd6('0x2b')]){delete _0x341906['name'];}_0x26d1fd[_0x6dd6('0x1d')](_0x243d1a)[_0x6dd6('0x2c')](_0x341906);};}exports[_0x6dd6('0x2d')]=function(_0x34d542,_0xa4fb02){var _0x5cf2a9={},_0x4f6eba={},_0x242df1={'count':0x0,'rows':[]};var _0x2f789c=_[_0x6dd6('0x2e')](db['AnalyticTreeReport'][_0x6dd6('0x2f')],function(_0x24443e){return{'name':_0x24443e[_0x6dd6('0x30')],'type':_0x24443e[_0x6dd6('0x31')][_0x6dd6('0x32')]};});_0x4f6eba['model']=_[_0x6dd6('0x2e')](_0x2f789c,_0x6dd6('0x2b'));_0x4f6eba[_0x6dd6('0x33')]=_[_0x6dd6('0x34')](_0x34d542[_0x6dd6('0x33')]);_0x4f6eba['filters']=_[_0x6dd6('0x35')](_0x4f6eba[_0x6dd6('0x36')],_0x4f6eba[_0x6dd6('0x33')]);_0x5cf2a9[_0x6dd6('0x37')]=_[_0x6dd6('0x35')](_0x4f6eba['model'],qs[_0x6dd6('0x38')](_0x34d542[_0x6dd6('0x33')][_0x6dd6('0x38')]));_0x5cf2a9[_0x6dd6('0x37')]=_0x5cf2a9[_0x6dd6('0x37')]['length']?_0x5cf2a9[_0x6dd6('0x37')]:_0x4f6eba[_0x6dd6('0x36')];if(!_0x34d542[_0x6dd6('0x33')][_0x6dd6('0x39')](_0x6dd6('0x3a'))){_0x5cf2a9['limit']=qs[_0x6dd6('0x21')](_0x34d542[_0x6dd6('0x33')]['limit']);_0x5cf2a9[_0x6dd6('0x20')]=qs['offset'](_0x34d542[_0x6dd6('0x33')][_0x6dd6('0x20')]);}_0x5cf2a9[_0x6dd6('0x3b')]=qs[_0x6dd6('0x3c')](_0x34d542[_0x6dd6('0x33')][_0x6dd6('0x3c')]);_0x5cf2a9[_0x6dd6('0x3d')]=qs['filters'](_[_0x6dd6('0x3e')](_0x34d542['query'],_0x4f6eba[_0x6dd6('0x3f')]),_0x2f789c);if(_0x34d542[_0x6dd6('0x33')][_0x6dd6('0x40')]){_0x5cf2a9[_0x6dd6('0x3d')]=_[_0x6dd6('0x41')](_0x5cf2a9[_0x6dd6('0x3d')],{'$or':_[_0x6dd6('0x2e')](_0x2f789c,function(_0xecd8){if(_0xecd8['type']!=='VIRTUAL'){var _0x45e79a={};_0x45e79a[_0xecd8['name']]={'$like':'%'+_0x34d542[_0x6dd6('0x33')][_0x6dd6('0x40')]+'%'};return _0x45e79a;}})});}_0x5cf2a9=_['merge']({},_0x5cf2a9,_0x34d542['options']);var _0x26f6fc={'where':_0x5cf2a9[_0x6dd6('0x3d')]};return db[_0x6dd6('0x42')]['count'](_0x26f6fc)[_0x6dd6('0x28')](function(_0x1a30e1){_0x242df1[_0x6dd6('0x1f')]=_0x1a30e1;if(_0x34d542[_0x6dd6('0x33')][_0x6dd6('0x43')]){_0x5cf2a9[_0x6dd6('0x44')]=[{'all':!![]}];}return db['AnalyticTreeReport'][_0x6dd6('0x45')](_0x5cf2a9);})[_0x6dd6('0x28')](function(_0x32b011){_0x242df1[_0x6dd6('0x46')]=_0x32b011;return _0x242df1;})[_0x6dd6('0x28')](respondWithFilteredResult(_0xa4fb02,_0x5cf2a9))[_0x6dd6('0x47')](handleError(_0xa4fb02,null));};exports['show']=function(_0x3163e2,_0x3a055c){var _0x45e87f={'raw':!![],'where':{'id':_0x3163e2[_0x6dd6('0x48')]['id']}},_0x578d82={};_0x578d82[_0x6dd6('0x36')]=_[_0x6dd6('0x34')](db['AnalyticTreeReport'][_0x6dd6('0x2f')]);_0x578d82[_0x6dd6('0x33')]=_['keys'](_0x3163e2[_0x6dd6('0x33')]);_0x578d82[_0x6dd6('0x3f')]=_[_0x6dd6('0x35')](_0x578d82[_0x6dd6('0x36')],_0x578d82[_0x6dd6('0x33')]);_0x45e87f[_0x6dd6('0x37')]=_['intersection'](_0x578d82[_0x6dd6('0x36')],qs['fields'](_0x3163e2[_0x6dd6('0x33')][_0x6dd6('0x38')]));_0x45e87f[_0x6dd6('0x37')]=_0x45e87f[_0x6dd6('0x37')]['length']?_0x45e87f['attributes']:_0x578d82[_0x6dd6('0x36')];if(_0x3163e2[_0x6dd6('0x33')][_0x6dd6('0x43')]){_0x45e87f[_0x6dd6('0x44')]=[{'all':!![]}];}_0x45e87f=_['merge']({},_0x45e87f,_0x3163e2[_0x6dd6('0x49')]);return db[_0x6dd6('0x42')][_0x6dd6('0x4a')](_0x45e87f)[_0x6dd6('0x28')](handleEntityNotFound(_0x3a055c,null))[_0x6dd6('0x28')](respondWithResult(_0x3a055c,null))[_0x6dd6('0x47')](handleError(_0x3a055c,null));};exports[_0x6dd6('0x4b')]=function(_0x1b5f52,_0x3edf00){return db[_0x6dd6('0x42')][_0x6dd6('0x4b')](_0x1b5f52[_0x6dd6('0x4c')],{})[_0x6dd6('0x28')](respondWithResult(_0x3edf00,0xc9))[_0x6dd6('0x47')](handleError(_0x3edf00,null));};exports['update']=function(_0x390274,_0x1c5975){if(_0x390274[_0x6dd6('0x4c')]['id']){delete _0x390274[_0x6dd6('0x4c')]['id'];}return db['AnalyticTreeReport'][_0x6dd6('0x4a')]({'where':{'id':_0x390274[_0x6dd6('0x48')]['id']}})[_0x6dd6('0x28')](handleEntityNotFound(_0x1c5975,null))[_0x6dd6('0x28')](saveUpdates(_0x390274[_0x6dd6('0x4c')],null))[_0x6dd6('0x28')](respondWithResult(_0x1c5975,null))[_0x6dd6('0x47')](handleError(_0x1c5975,null));};exports[_0x6dd6('0x27')]=function(_0x548b14,_0x493d3f){return db[_0x6dd6('0x42')][_0x6dd6('0x4a')]({'where':{'id':_0x548b14[_0x6dd6('0x48')]['id']}})[_0x6dd6('0x28')](handleEntityNotFound(_0x493d3f,null))['then'](removeEntity(_0x493d3f,null))[_0x6dd6('0x47')](handleError(_0x493d3f,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 90b8c41..e5bc793 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 _0x52bf=['exports','define','AnalyticTreeReport','analytics_report_trees','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./analyticTreeReport.attributes'];(function(_0x36feb2,_0x53abef){var _0x292b43=function(_0x52a460){while(--_0x52a460){_0x36feb2['push'](_0x36feb2['shift']());}};_0x292b43(++_0x53abef);}(_0x52bf,0x9e));var _0xf52b=function(_0x40e63c,_0x78b7d0){_0x40e63c=_0x40e63c-0x0;var _0x52a142=_0x52bf[_0x40e63c];return _0x52a142;};'use strict';var _=require(_0xf52b('0x0'));var util=require(_0xf52b('0x1'));var logger=require(_0xf52b('0x2'))(_0xf52b('0x3'));var moment=require('moment');var BPromise=require(_0xf52b('0x4'));var rp=require(_0xf52b('0x5'));var fs=require('fs');var path=require(_0xf52b('0x6'));var rimraf=require(_0xf52b('0x7'));var config=require(_0xf52b('0x8'));var attributes=require(_0xf52b('0x9'));module[_0xf52b('0xa')]=function(_0x107920,_0x21abb9){return _0x107920[_0xf52b('0xb')](_0xf52b('0xc'),attributes,{'tableName':_0xf52b('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf271=['analytics_report_trees','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','exports','AnalyticTreeReport'];(function(_0x51ac51,_0x20776f){var _0x28d84b=function(_0x1f39b7){while(--_0x1f39b7){_0x51ac51['push'](_0x51ac51['shift']());}};_0x28d84b(++_0x20776f);}(_0xf271,0x16c));var _0x1f27=function(_0x2a214b,_0x53faeb){_0x2a214b=_0x2a214b-0x0;var _0x359f25=_0xf271[_0x2a214b];return _0x359f25;};'use strict';var _=require(_0x1f27('0x0'));var util=require(_0x1f27('0x1'));var logger=require(_0x1f27('0x2'))(_0x1f27('0x3'));var moment=require(_0x1f27('0x4'));var BPromise=require(_0x1f27('0x5'));var rp=require(_0x1f27('0x6'));var fs=require('fs');var path=require(_0x1f27('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./analyticTreeReport.attributes');module[_0x1f27('0x8')]=function(_0x40ea8b,_0x36367c){return _0x40ea8b['define'](_0x1f27('0x9'),attributes,{'tableName':_0x1f27('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index 8ddbc40..d85c5d8 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 _0x1261=['then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x31bd57,_0x3415ae){var _0x377c04=function(_0x243e3a){while(--_0x243e3a){_0x31bd57['push'](_0x31bd57['shift']());}};_0x377c04(++_0x3415ae);}(_0x1261,0x144));var _0x1126=function(_0x36147b,_0x57f40b){_0x36147b=_0x36147b-0x0;var _0x141351=_0x1261[_0x36147b];return _0x141351;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('AnalyticTreeReport,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file +var _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','AnalyticTreeReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x22e533,_0x5de7c0){var _0x42db03=function(_0xde5218){while(--_0xde5218){_0x22e533['push'](_0x22e533['shift']());}};_0x42db03(++_0x5de7c0);}(_0x5f2f,0x73));var _0xf5f2=function(_0x16957f,_0x33143b){_0x16957f=_0x16957f-0x0;var _0x155bf0=_0x5f2f[_0x16957f];return _0x155bf0;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 804b2c4..77983ee 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 _0xf479=['Router','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','index','/:id','create','put','update','delete','multer','path','connect-timeout','express'];(function(_0x5d8778,_0x3c2f0e){var _0x133e42=function(_0x2c23aa){while(--_0x2c23aa){_0x5d8778['push'](_0x5d8778['shift']());}};_0x133e42(++_0x3c2f0e);}(_0xf479,0xfb));var _0x9f47=function(_0x523898,_0x3c69e6){_0x523898=_0x523898-0x0;var _0x38ce96=_0xf479[_0x523898];return _0x38ce96;};'use strict';var multer=require(_0x9f47('0x0'));var util=require('util');var path=require(_0x9f47('0x1'));var timeout=require(_0x9f47('0x2'));var express=require(_0x9f47('0x3'));var router=express[_0x9f47('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9f47('0x5'));var controller=require(_0x9f47('0x6'));router[_0x9f47('0x7')]('/',auth[_0x9f47('0x8')](),controller[_0x9f47('0x9')]);router[_0x9f47('0x7')](_0x9f47('0xa'),auth[_0x9f47('0x8')](),controller['show']);router['post']('/',auth[_0x9f47('0x8')](),controller[_0x9f47('0xb')]);router[_0x9f47('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x9f47('0xd')]);router[_0x9f47('0xe')](_0x9f47('0xa'),auth[_0x9f47('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xb505=['path','connect-timeout','express','Router','fs-extra','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','index','/:id','show','post','put','update','multer','util'];(function(_0x285824,_0x3da647){var _0x311d7e=function(_0x2f3de0){while(--_0x2f3de0){_0x285824['push'](_0x285824['shift']());}};_0x311d7e(++_0x3da647);}(_0xb505,0x196));var _0x5b50=function(_0x1d08fb,_0x246483){_0x1d08fb=_0x1d08fb-0x0;var _0x4a9a75=_0xb505[_0x1d08fb];return _0x4a9a75;};'use strict';var multer=require(_0x5b50('0x0'));var util=require(_0x5b50('0x1'));var path=require(_0x5b50('0x2'));var timeout=require(_0x5b50('0x3'));var express=require(_0x5b50('0x4'));var router=express[_0x5b50('0x5')]();var fs_extra=require(_0x5b50('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5b50('0x7'));var controller=require(_0x5b50('0x8'));router[_0x5b50('0x9')]('/',auth[_0x5b50('0xa')](),controller[_0x5b50('0xb')]);router['get'](_0x5b50('0xc'),auth[_0x5b50('0xa')](),controller[_0x5b50('0xd')]);router[_0x5b50('0xe')]('/',auth[_0x5b50('0xa')](),controller['create']);router[_0x5b50('0xf')]('/:id',auth[_0x5b50('0xa')](),controller[_0x5b50('0x10')]);router['delete']('/:id',auth[_0x5b50('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 8e6ca19..3c66014 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 _0x0c6d=['STRING','exports'];(function(_0x250db5,_0x77171d){var _0x5e21c1=function(_0x41c1b4){while(--_0x41c1b4){_0x250db5['push'](_0x250db5['shift']());}};_0x5e21c1(++_0x77171d);}(_0x0c6d,0xf7));var _0xd0c6=function(_0x249d27,_0x1c50d7){_0x249d27=_0x249d27-0x0;var _0x3dda1e=_0x0c6d[_0x249d27];return _0x3dda1e;};'use strict';var Sequelize=require('sequelize');module[_0xd0c6('0x0')]={'name':{'type':Sequelize[_0xd0c6('0x1')]},'basename':{'type':Sequelize[_0xd0c6('0x1')]},'type':{'type':Sequelize[_0xd0c6('0x1')]}}; \ No newline at end of file +var _0x8b7c=['exports','STRING','sequelize'];(function(_0x97dd27,_0x537d93){var _0xf73d5b=function(_0x484753){while(--_0x484753){_0x97dd27['push'](_0x97dd27['shift']());}};_0xf73d5b(++_0x537d93);}(_0x8b7c,0x119));var _0xc8b7=function(_0x1dd4de,_0x189290){_0x1dd4de=_0x1dd4de-0x0;var _0xf23408=_0x8b7c[_0x1dd4de];return _0xf23408;};'use strict';var Sequelize=require(_0xc8b7('0x0'));module[_0xc8b7('0x1')]={'name':{'type':Sequelize[_0xc8b7('0x2')]},'basename':{'type':Sequelize[_0xc8b7('0x2')]},'type':{'type':Sequelize[_0xc8b7('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 0068101..8cbad43 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 _0xa5d6=['rawAttributes','intersection','clone','params','length','includeAll','get','createdAt','body','omit','updatedAt','find','create','file','originalname','filename','mimetype','findOne','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','basename','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','fs-extra','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','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','type','model','query','keys','filters','fields','attributes','nolimit','sort','where','filter','merge','VIRTUAL','options','Attachment','findAll','catch'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0xa5d6,0xc9));var _0x6a5d=function(_0x3971cc,_0x2d73d7){_0x3971cc=_0x3971cc-0x0;var _0x3434c3=_0xa5d6[_0x3971cc];return _0x3434c3;};'use strict';var emlformat=require(_0x6a5d('0x0'));var rimraf=require(_0x6a5d('0x1'));var zipdir=require(_0x6a5d('0x2'));var jsonpatch=require(_0x6a5d('0x3'));var rp=require(_0x6a5d('0x4'));var moment=require(_0x6a5d('0x5'));var BPromise=require(_0x6a5d('0x6'));var Mustache=require(_0x6a5d('0x7'));var util=require('util');var path=require('path');var sox=require(_0x6a5d('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6a5d('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x6a5d('0xa'));var jsforce=require(_0x6a5d('0xb'));var deskjs=require(_0x6a5d('0xc'));var toCsv=require(_0x6a5d('0xd'));var querystring=require(_0x6a5d('0xe'));var Papa=require(_0x6a5d('0xf'));var Redis=require(_0x6a5d('0x10'));var authService=require(_0x6a5d('0x11'));var qs=require(_0x6a5d('0x12'));var as=require(_0x6a5d('0x13'));var hardwareService=require(_0x6a5d('0x14'));var logger=require(_0x6a5d('0x15'))(_0x6a5d('0x16'));var utils=require(_0x6a5d('0x17'));var config=require(_0x6a5d('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x14d26a,_0x1138db){_0x1138db=_0x1138db||0xcc;return function(_0x13f241){if(_0x13f241){return _0x14d26a[_0x6a5d('0x19')](_0x1138db);}return _0x14d26a[_0x6a5d('0x1a')](_0x1138db)[_0x6a5d('0x1b')]();};}function respondWithResult(_0x2578ad,_0x2a02b3){_0x2a02b3=_0x2a02b3||0xc8;return function(_0x347d81){if(_0x347d81){return _0x2578ad[_0x6a5d('0x1a')](_0x2a02b3)[_0x6a5d('0x1c')](_0x347d81);}};}function respondWithFilteredResult(_0x507abf,_0x45363b){return function(_0x3791a6){if(_0x3791a6){var _0x1b598e=typeof _0x45363b['offset']==='undefined'&&typeof _0x45363b[_0x6a5d('0x1d')]===_0x6a5d('0x1e');var _0x3abde5=_0x3791a6[_0x6a5d('0x1f')];var _0x11d716=_0x1b598e?0x0:_0x45363b[_0x6a5d('0x20')];var _0x57f0de=_0x1b598e?_0x3791a6[_0x6a5d('0x1f')]:_0x45363b[_0x6a5d('0x20')]+_0x45363b[_0x6a5d('0x1d')];var _0x10486e;if(_0x57f0de>=_0x3abde5){_0x57f0de=_0x3abde5;_0x10486e=0xc8;}else{_0x10486e=0xce;}_0x507abf['status'](_0x10486e);return _0x507abf[_0x6a5d('0x21')](_0x6a5d('0x22'),_0x11d716+'-'+_0x57f0de+'/'+_0x3abde5)[_0x6a5d('0x1c')](_0x3791a6);}return null;};}function patchUpdates(_0x4c8d75){return function(_0x4856dc){try{jsonpatch[_0x6a5d('0x23')](_0x4856dc,_0x4c8d75,!![]);}catch(_0x2bfb89){return BPromise[_0x6a5d('0x24')](_0x2bfb89);}return _0x4856dc[_0x6a5d('0x25')]();};}function saveUpdates(_0x4594c4,_0x275015){return function(_0x17a53d){if(_0x17a53d){return _0x17a53d[_0x6a5d('0x26')](_0x4594c4)[_0x6a5d('0x27')](function(_0xb26dd5){return _0xb26dd5;});}return null;};}function removeEntity(_0x4e8ff9,_0xddab36){return function(_0x10ed3b){if(_0x10ed3b){return _0x10ed3b[_0x6a5d('0x28')]()[_0x6a5d('0x27')](function(){_0x4e8ff9[_0x6a5d('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1504ba,_0x2b4636){return function(_0x44d5f7){if(!_0x44d5f7){_0x1504ba[_0x6a5d('0x19')](0x194);}return _0x44d5f7;};}function handleError(_0x5459d3,_0x96b93b){_0x96b93b=_0x96b93b||0x1f4;return function(_0x23009e){logger['error'](_0x23009e[_0x6a5d('0x29')]);if(_0x23009e[_0x6a5d('0x2a')]){delete _0x23009e[_0x6a5d('0x2a')];}_0x5459d3[_0x6a5d('0x1a')](_0x96b93b)[_0x6a5d('0x2b')](_0x23009e);};}exports[_0x6a5d('0x2c')]=function(_0xf513b3,_0x2d8b44){var _0x4ed51c={},_0x4e1a4a={},_0x2f8300={'count':0x0,'rows':[]};var _0x2487d1=_[_0x6a5d('0x2d')](db['Attachment']['rawAttributes'],function(_0x2d899d){return{'name':_0x2d899d['fieldName'],'type':_0x2d899d[_0x6a5d('0x2e')]['key']};});_0x4e1a4a[_0x6a5d('0x2f')]=_[_0x6a5d('0x2d')](_0x2487d1,'name');_0x4e1a4a[_0x6a5d('0x30')]=_[_0x6a5d('0x31')](_0xf513b3[_0x6a5d('0x30')]);_0x4e1a4a[_0x6a5d('0x32')]=_['intersection'](_0x4e1a4a['model'],_0x4e1a4a['query']);_0x4ed51c['attributes']=_['intersection'](_0x4e1a4a['model'],qs[_0x6a5d('0x33')](_0xf513b3[_0x6a5d('0x30')]['fields']));_0x4ed51c['attributes']=_0x4ed51c[_0x6a5d('0x34')]['length']?_0x4ed51c[_0x6a5d('0x34')]:_0x4e1a4a[_0x6a5d('0x2f')];if(!_0xf513b3[_0x6a5d('0x30')]['hasOwnProperty'](_0x6a5d('0x35'))){_0x4ed51c[_0x6a5d('0x1d')]=qs['limit'](_0xf513b3['query'][_0x6a5d('0x1d')]);_0x4ed51c[_0x6a5d('0x20')]=qs['offset'](_0xf513b3['query'][_0x6a5d('0x20')]);}_0x4ed51c['order']=qs[_0x6a5d('0x36')](_0xf513b3[_0x6a5d('0x30')][_0x6a5d('0x36')]);_0x4ed51c[_0x6a5d('0x37')]=qs[_0x6a5d('0x32')](_['pick'](_0xf513b3['query'],_0x4e1a4a[_0x6a5d('0x32')]),_0x2487d1);if(_0xf513b3[_0x6a5d('0x30')][_0x6a5d('0x38')]){_0x4ed51c['where']=_[_0x6a5d('0x39')](_0x4ed51c[_0x6a5d('0x37')],{'$or':_['map'](_0x2487d1,function(_0x4cd869){if(_0x4cd869[_0x6a5d('0x2e')]!==_0x6a5d('0x3a')){var _0x21b898={};_0x21b898[_0x4cd869[_0x6a5d('0x2a')]]={'$like':'%'+_0xf513b3['query'][_0x6a5d('0x38')]+'%'};return _0x21b898;}})});}_0x4ed51c=_['merge']({},_0x4ed51c,_0xf513b3[_0x6a5d('0x3b')]);var _0x3da7a={'where':_0x4ed51c[_0x6a5d('0x37')]};return db[_0x6a5d('0x3c')][_0x6a5d('0x1f')](_0x3da7a)[_0x6a5d('0x27')](function(_0x23553c){_0x2f8300[_0x6a5d('0x1f')]=_0x23553c;if(_0xf513b3[_0x6a5d('0x30')]['includeAll']){_0x4ed51c['include']=[{'all':!![]}];}return db['Attachment'][_0x6a5d('0x3d')](_0x4ed51c);})['then'](function(_0x13e69b){_0x2f8300['rows']=_0x13e69b;return _0x2f8300;})[_0x6a5d('0x27')](respondWithFilteredResult(_0x2d8b44,_0x4ed51c))[_0x6a5d('0x3e')](handleError(_0x2d8b44,null));};exports['show']=function(_0x3ede71,_0xed82d8){var _0x2a3bc5={'raw':!![],'where':{'id':_0x3ede71['params']['id']}},_0x2b8159={};_0x2b8159[_0x6a5d('0x2f')]=_[_0x6a5d('0x31')](db[_0x6a5d('0x3c')][_0x6a5d('0x3f')]);_0x2b8159[_0x6a5d('0x30')]=_[_0x6a5d('0x31')](_0x3ede71['query']);_0x2b8159[_0x6a5d('0x32')]=_[_0x6a5d('0x40')](_0x2b8159[_0x6a5d('0x2f')],_0x2b8159['query']);_0x2a3bc5[_0x6a5d('0x34')]=_['intersection'](_0x2b8159[_0x6a5d('0x2f')],qs[_0x6a5d('0x33')](_0x3ede71[_0x6a5d('0x30')]['fields']));_0x2a3bc5[_0x6a5d('0x34')]=_0x2a3bc5[_0x6a5d('0x34')]['length']?_0x2a3bc5[_0x6a5d('0x34')]:_0x2b8159[_0x6a5d('0x2f')];if(_0x3ede71['query']['includeAll']){_0x2a3bc5['include']=[{'all':!![]}];}_0x2a3bc5=_[_0x6a5d('0x39')]({},_0x2a3bc5,_0x3ede71['options']);return db[_0x6a5d('0x3c')]['find'](_0x2a3bc5)[_0x6a5d('0x27')](handleEntityNotFound(_0xed82d8,null))[_0x6a5d('0x27')](respondWithResult(_0xed82d8,null))[_0x6a5d('0x3e')](handleError(_0xed82d8,null));};exports[_0x6a5d('0x41')]=function(_0x2f40c7,_0x1a28c7){var _0x46f25f={'where':{'id':_0x2f40c7[_0x6a5d('0x42')]['id']}},_0x465942={};_0x465942[_0x6a5d('0x2f')]=_[_0x6a5d('0x31')](db['Attachment'][_0x6a5d('0x3f')]);_0x46f25f[_0x6a5d('0x34')]=_[_0x6a5d('0x40')](_0x465942['model'],qs[_0x6a5d('0x33')](_0x2f40c7[_0x6a5d('0x30')]['fields']));_0x46f25f['attributes']=_0x46f25f[_0x6a5d('0x34')][_0x6a5d('0x43')]?_0x46f25f[_0x6a5d('0x34')]:_0x465942[_0x6a5d('0x2f')];if(_0x2f40c7['query'][_0x6a5d('0x44')]){_0x46f25f['include']=[{'all':!![]}];}_0x46f25f=_['merge']({},_0x46f25f,_0x2f40c7[_0x6a5d('0x3b')]);return db['Attachment']['find'](_0x46f25f)[_0x6a5d('0x27')](handleEntityNotFound(_0x1a28c7,null))['then'](function(_0x914dd4){if(_0x914dd4){var _0x39a6d2=_0x914dd4[_0x6a5d('0x45')]({'plain':!![]});_0x39a6d2=qs['omit'](_0x39a6d2,['id',_0x6a5d('0x46'),'updatedAt']);_0x2f40c7[_0x6a5d('0x47')]=_[_0x6a5d('0x48')](_0x2f40c7['body'],['id','createdAt',_0x6a5d('0x49')]);return db['Attachment']['create'](_['merge'](_0x39a6d2,_0x2f40c7[_0x6a5d('0x47')]),{'include':_0x2f40c7[_0x6a5d('0x30')][_0x6a5d('0x44')]?[{'all':!![]}]:undefined});}})[_0x6a5d('0x27')](respondWithResult(_0x1a28c7,0xc9))[_0x6a5d('0x3e')](handleError(_0x1a28c7,null));};exports['update']=function(_0x53c54,_0x1138aa){if(_0x53c54[_0x6a5d('0x47')]['id']){delete _0x53c54[_0x6a5d('0x47')]['id'];}return db['Attachment'][_0x6a5d('0x4a')]({'where':{'id':_0x53c54[_0x6a5d('0x42')]['id']}})['then'](handleEntityNotFound(_0x1138aa,null))['then'](saveUpdates(_0x53c54[_0x6a5d('0x47')],null))[_0x6a5d('0x27')](respondWithResult(_0x1138aa,null))[_0x6a5d('0x3e')](handleError(_0x1138aa,null));};exports[_0x6a5d('0x28')]=function(_0x47d68d,_0x55ca0d){return db[_0x6a5d('0x3c')][_0x6a5d('0x4a')]({'where':{'id':_0x47d68d[_0x6a5d('0x42')]['id']}})[_0x6a5d('0x27')](handleEntityNotFound(_0x55ca0d,null))['then'](removeEntity(_0x55ca0d,null))['catch'](handleError(_0x55ca0d,null));};exports[_0x6a5d('0x4b')]=function(_0x3f203a,_0x1c6873,_0x90581f){_0x3f203a[_0x6a5d('0x47')][_0x6a5d('0x2a')]=_0x3f203a[_0x6a5d('0x4c')][_0x6a5d('0x4d')];_0x3f203a[_0x6a5d('0x47')]['basename']=_0x3f203a['file'][_0x6a5d('0x4e')];_0x3f203a[_0x6a5d('0x47')]['type']=_0x3f203a[_0x6a5d('0x4c')][_0x6a5d('0x4f')];return db[_0x6a5d('0x3c')][_0x6a5d('0x4b')](_0x3f203a[_0x6a5d('0x47')])['then'](respondWithResult(_0x1c6873,0xc9))[_0x6a5d('0x3e')](handleError(_0x1c6873,null));};exports['download']=function(_0x4e075e,_0x49b576,_0x34896b){return db[_0x6a5d('0x3c')][_0x6a5d('0x50')]({'where':{'id':_0x4e075e[_0x6a5d('0x42')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x49b576,null))[_0x6a5d('0x27')](function(_0x1598b3){if(_0x1598b3){var _0x27c14c=_0x1598b3[_0x6a5d('0x51')]!==null;var _0x348558=path[_0x6a5d('0x52')](config[_0x6a5d('0x53')],_0x6a5d('0x54'));if(_0x27c14c){_0x348558=path['join'](_0x348558,_0x6a5d('0x55'));}var _0x531e46=path['join'](_0x348558,_0x1598b3[_0x6a5d('0x56')]);return _0x49b576[_0x6a5d('0x57')](_0x531e46);}})['catch'](handleError(_0x49b576,null));}; \ No newline at end of file +var _0x278c=['merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','get','omit','updatedAt','body','createdAt','create','destroy','originalname','basename','filename','file','mimetype','download','findOne','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','then','sendStatus','error','stack','name','map','Attachment','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','sort','where','pick','filter'];(function(_0x5174a7,_0x5cbada){var _0x39a78b=function(_0x57cba5){while(--_0x57cba5){_0x5174a7['push'](_0x5174a7['shift']());}};_0x39a78b(++_0x5cbada);}(_0x278c,0x78));var _0xc278=function(_0x35007a,_0x58a0d4){_0x35007a=_0x35007a-0x0;var _0x574f68=_0x278c[_0x35007a];return _0x574f68;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc278('0x0'));var jsonpatch=require(_0xc278('0x1'));var rp=require(_0xc278('0x2'));var moment=require(_0xc278('0x3'));var BPromise=require(_0xc278('0x4'));var Mustache=require(_0xc278('0x5'));var util=require('util');var path=require('path');var sox=require(_0xc278('0x6'));var csv=require(_0xc278('0x7'));var ejs=require(_0xc278('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc278('0x9'));var squel=require('squel');var crypto=require(_0xc278('0xa'));var jsforce=require(_0xc278('0xb'));var deskjs=require(_0xc278('0xc'));var toCsv=require('to-csv');var querystring=require(_0xc278('0xd'));var Papa=require(_0xc278('0xe'));var Redis=require(_0xc278('0xf'));var authService=require(_0xc278('0x10'));var qs=require(_0xc278('0x11'));var as=require(_0xc278('0x12'));var hardwareService=require(_0xc278('0x13'));var logger=require(_0xc278('0x14'))(_0xc278('0x15'));var utils=require(_0xc278('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xc278('0x17'));var db=require(_0xc278('0x18'))['db'];function respondWithStatusCode(_0x3b01a8,_0x20370b){_0x20370b=_0x20370b||0xcc;return function(_0x1c36fc){if(_0x1c36fc){return _0x3b01a8['sendStatus'](_0x20370b);}return _0x3b01a8[_0xc278('0x19')](_0x20370b)[_0xc278('0x1a')]();};}function respondWithResult(_0x5c99f4,_0x59461d){_0x59461d=_0x59461d||0xc8;return function(_0x513427){if(_0x513427){return _0x5c99f4['status'](_0x59461d)['json'](_0x513427);}};}function respondWithFilteredResult(_0x5f4ae9,_0x5460b1){return function(_0x91351a){if(_0x91351a){var _0x4286e9=typeof _0x5460b1[_0xc278('0x1b')]===_0xc278('0x1c')&&typeof _0x5460b1[_0xc278('0x1d')]===_0xc278('0x1c');var _0x533420=_0x91351a[_0xc278('0x1e')];var _0x332390=_0x4286e9?0x0:_0x5460b1[_0xc278('0x1b')];var _0x15b4b7=_0x4286e9?_0x91351a[_0xc278('0x1e')]:_0x5460b1[_0xc278('0x1b')]+_0x5460b1[_0xc278('0x1d')];var _0x29938c;if(_0x15b4b7>=_0x533420){_0x15b4b7=_0x533420;_0x29938c=0xc8;}else{_0x29938c=0xce;}_0x5f4ae9[_0xc278('0x19')](_0x29938c);return _0x5f4ae9[_0xc278('0x1f')]('Content-Range',_0x332390+'-'+_0x15b4b7+'/'+_0x533420)[_0xc278('0x20')](_0x91351a);}return null;};}function patchUpdates(_0x30dfc7){return function(_0x265107){try{jsonpatch[_0xc278('0x21')](_0x265107,_0x30dfc7,!![]);}catch(_0x157893){return BPromise[_0xc278('0x22')](_0x157893);}return _0x265107[_0xc278('0x23')]();};}function saveUpdates(_0xb00a4a,_0x3125ea){return function(_0x15adeb){if(_0x15adeb){return _0x15adeb[_0xc278('0x24')](_0xb00a4a)['then'](function(_0x6f7892){return _0x6f7892;});}return null;};}function removeEntity(_0x28559c,_0x40146e){return function(_0x2d7948){if(_0x2d7948){return _0x2d7948['destroy']()[_0xc278('0x25')](function(){_0x28559c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x311134,_0x5e002e){return function(_0x44c8dd){if(!_0x44c8dd){_0x311134[_0xc278('0x26')](0x194);}return _0x44c8dd;};}function handleError(_0x353c09,_0x3b8e42){_0x3b8e42=_0x3b8e42||0x1f4;return function(_0x1a4f82){logger[_0xc278('0x27')](_0x1a4f82[_0xc278('0x28')]);if(_0x1a4f82[_0xc278('0x29')]){delete _0x1a4f82[_0xc278('0x29')];}_0x353c09[_0xc278('0x19')](_0x3b8e42)['send'](_0x1a4f82);};}exports['index']=function(_0x42823b,_0x25f288){var _0x247e01={},_0x496df9={},_0xfaa4a3={'count':0x0,'rows':[]};var _0x45af2f=_[_0xc278('0x2a')](db[_0xc278('0x2b')][_0xc278('0x2c')],function(_0x388a68){return{'name':_0x388a68[_0xc278('0x2d')],'type':_0x388a68['type']['key']};});_0x496df9[_0xc278('0x2e')]=_[_0xc278('0x2a')](_0x45af2f,_0xc278('0x29'));_0x496df9[_0xc278('0x2f')]=_[_0xc278('0x30')](_0x42823b[_0xc278('0x2f')]);_0x496df9[_0xc278('0x31')]=_[_0xc278('0x32')](_0x496df9['model'],_0x496df9[_0xc278('0x2f')]);_0x247e01[_0xc278('0x33')]=_[_0xc278('0x32')](_0x496df9[_0xc278('0x2e')],qs[_0xc278('0x34')](_0x42823b[_0xc278('0x2f')][_0xc278('0x34')]));_0x247e01['attributes']=_0x247e01[_0xc278('0x33')][_0xc278('0x35')]?_0x247e01[_0xc278('0x33')]:_0x496df9['model'];if(!_0x42823b[_0xc278('0x2f')]['hasOwnProperty']('nolimit')){_0x247e01[_0xc278('0x1d')]=qs[_0xc278('0x1d')](_0x42823b[_0xc278('0x2f')][_0xc278('0x1d')]);_0x247e01[_0xc278('0x1b')]=qs[_0xc278('0x1b')](_0x42823b['query'][_0xc278('0x1b')]);}_0x247e01['order']=qs[_0xc278('0x36')](_0x42823b['query'][_0xc278('0x36')]);_0x247e01[_0xc278('0x37')]=qs[_0xc278('0x31')](_[_0xc278('0x38')](_0x42823b['query'],_0x496df9[_0xc278('0x31')]),_0x45af2f);if(_0x42823b['query'][_0xc278('0x39')]){_0x247e01[_0xc278('0x37')]=_[_0xc278('0x3a')](_0x247e01[_0xc278('0x37')],{'$or':_['map'](_0x45af2f,function(_0x4d3a20){if(_0x4d3a20[_0xc278('0x3b')]!==_0xc278('0x3c')){var _0x3aaf7a={};_0x3aaf7a[_0x4d3a20[_0xc278('0x29')]]={'$like':'%'+_0x42823b[_0xc278('0x2f')][_0xc278('0x39')]+'%'};return _0x3aaf7a;}})});}_0x247e01=_['merge']({},_0x247e01,_0x42823b[_0xc278('0x3d')]);var _0x7a67e={'where':_0x247e01[_0xc278('0x37')]};return db[_0xc278('0x2b')][_0xc278('0x1e')](_0x7a67e)[_0xc278('0x25')](function(_0x2ca409){_0xfaa4a3[_0xc278('0x1e')]=_0x2ca409;if(_0x42823b[_0xc278('0x2f')][_0xc278('0x3e')]){_0x247e01[_0xc278('0x3f')]=[{'all':!![]}];}return db[_0xc278('0x2b')][_0xc278('0x40')](_0x247e01);})[_0xc278('0x25')](function(_0x59c865){_0xfaa4a3[_0xc278('0x41')]=_0x59c865;return _0xfaa4a3;})[_0xc278('0x25')](respondWithFilteredResult(_0x25f288,_0x247e01))['catch'](handleError(_0x25f288,null));};exports[_0xc278('0x42')]=function(_0x3c6e65,_0x49dd97){var _0x2cd04c={'raw':!![],'where':{'id':_0x3c6e65[_0xc278('0x43')]['id']}},_0x2a62d9={};_0x2a62d9[_0xc278('0x2e')]=_[_0xc278('0x30')](db[_0xc278('0x2b')][_0xc278('0x2c')]);_0x2a62d9[_0xc278('0x2f')]=_['keys'](_0x3c6e65[_0xc278('0x2f')]);_0x2a62d9[_0xc278('0x31')]=_[_0xc278('0x32')](_0x2a62d9['model'],_0x2a62d9[_0xc278('0x2f')]);_0x2cd04c[_0xc278('0x33')]=_[_0xc278('0x32')](_0x2a62d9[_0xc278('0x2e')],qs[_0xc278('0x34')](_0x3c6e65[_0xc278('0x2f')][_0xc278('0x34')]));_0x2cd04c[_0xc278('0x33')]=_0x2cd04c['attributes']['length']?_0x2cd04c[_0xc278('0x33')]:_0x2a62d9[_0xc278('0x2e')];if(_0x3c6e65[_0xc278('0x2f')][_0xc278('0x3e')]){_0x2cd04c['include']=[{'all':!![]}];}_0x2cd04c=_[_0xc278('0x3a')]({},_0x2cd04c,_0x3c6e65[_0xc278('0x3d')]);return db[_0xc278('0x2b')][_0xc278('0x44')](_0x2cd04c)[_0xc278('0x25')](handleEntityNotFound(_0x49dd97,null))[_0xc278('0x25')](respondWithResult(_0x49dd97,null))[_0xc278('0x45')](handleError(_0x49dd97,null));};exports['clone']=function(_0x3b655a,_0xe30c63){var _0x546568={'where':{'id':_0x3b655a['params']['id']}},_0x27601c={};_0x27601c[_0xc278('0x2e')]=_[_0xc278('0x30')](db[_0xc278('0x2b')]['rawAttributes']);_0x546568[_0xc278('0x33')]=_[_0xc278('0x32')](_0x27601c[_0xc278('0x2e')],qs[_0xc278('0x34')](_0x3b655a[_0xc278('0x2f')]['fields']));_0x546568['attributes']=_0x546568[_0xc278('0x33')][_0xc278('0x35')]?_0x546568['attributes']:_0x27601c[_0xc278('0x2e')];if(_0x3b655a[_0xc278('0x2f')][_0xc278('0x3e')]){_0x546568[_0xc278('0x3f')]=[{'all':!![]}];}_0x546568=_[_0xc278('0x3a')]({},_0x546568,_0x3b655a['options']);return db['Attachment']['find'](_0x546568)[_0xc278('0x25')](handleEntityNotFound(_0xe30c63,null))[_0xc278('0x25')](function(_0x379217){if(_0x379217){var _0xb46ade=_0x379217[_0xc278('0x46')]({'plain':!![]});_0xb46ade=qs[_0xc278('0x47')](_0xb46ade,['id','createdAt',_0xc278('0x48')]);_0x3b655a[_0xc278('0x49')]=_[_0xc278('0x47')](_0x3b655a['body'],['id',_0xc278('0x4a'),_0xc278('0x48')]);return db[_0xc278('0x2b')][_0xc278('0x4b')](_[_0xc278('0x3a')](_0xb46ade,_0x3b655a[_0xc278('0x49')]),{'include':_0x3b655a[_0xc278('0x2f')][_0xc278('0x3e')]?[{'all':!![]}]:undefined});}})[_0xc278('0x25')](respondWithResult(_0xe30c63,0xc9))['catch'](handleError(_0xe30c63,null));};exports[_0xc278('0x24')]=function(_0x3edaad,_0x47756f){if(_0x3edaad[_0xc278('0x49')]['id']){delete _0x3edaad[_0xc278('0x49')]['id'];}return db[_0xc278('0x2b')][_0xc278('0x44')]({'where':{'id':_0x3edaad[_0xc278('0x43')]['id']}})[_0xc278('0x25')](handleEntityNotFound(_0x47756f,null))[_0xc278('0x25')](saveUpdates(_0x3edaad[_0xc278('0x49')],null))[_0xc278('0x25')](respondWithResult(_0x47756f,null))[_0xc278('0x45')](handleError(_0x47756f,null));};exports[_0xc278('0x4c')]=function(_0x45f24a,_0x405313){return db['Attachment'][_0xc278('0x44')]({'where':{'id':_0x45f24a[_0xc278('0x43')]['id']}})[_0xc278('0x25')](handleEntityNotFound(_0x405313,null))[_0xc278('0x25')](removeEntity(_0x405313,null))[_0xc278('0x45')](handleError(_0x405313,null));};exports['create']=function(_0x205754,_0x300c0e,_0x4eb4af){_0x205754['body'][_0xc278('0x29')]=_0x205754['file'][_0xc278('0x4d')];_0x205754[_0xc278('0x49')][_0xc278('0x4e')]=_0x205754['file'][_0xc278('0x4f')];_0x205754[_0xc278('0x49')][_0xc278('0x3b')]=_0x205754[_0xc278('0x50')][_0xc278('0x51')];return db[_0xc278('0x2b')]['create'](_0x205754['body'])[_0xc278('0x25')](respondWithResult(_0x300c0e,0xc9))['catch'](handleError(_0x300c0e,null));};exports[_0xc278('0x52')]=function(_0x3092ca,_0x27c3c9,_0x627cc){return db['Attachment'][_0xc278('0x53')]({'where':{'id':_0x3092ca[_0xc278('0x43')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x27c3c9,null))['then'](function(_0xa22067){if(_0xa22067){var _0x2824ba=_0xa22067[_0xc278('0x54')]!==null;var _0x5aacb5=path[_0xc278('0x55')](config[_0xc278('0x56')],_0xc278('0x57'));if(_0x2824ba){_0x5aacb5=path[_0xc278('0x55')](_0x5aacb5,_0xc278('0x58'));}var _0x525d9e=path[_0xc278('0x55')](_0x5aacb5,_0xa22067[_0xc278('0x4e')]);return _0x27c3c9[_0xc278('0x52')](_0x525d9e);}})[_0xc278('0x45')](handleError(_0x27c3c9,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 6580f51..628fc96 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 _0xef40=['exports','define','Attachment','lodash','util','api','request-promise','path','rimraf','../../config/environment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xef40,0x19d));var _0x0ef4=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xef40[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x0ef4('0x0'));var util=require(_0x0ef4('0x1'));var logger=require('../../config/logger')(_0x0ef4('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0ef4('0x3'));var fs=require('fs');var path=require(_0x0ef4('0x4'));var rimraf=require(_0x0ef4('0x5'));var config=require(_0x0ef4('0x6'));var attributes=require('./attachment.attributes');module[_0x0ef4('0x7')]=function(_0x29498b,_0x127e92){return _0x29498b[_0x0ef4('0x8')](_0x0ef4('0x9'),attributes,{'tableName':'attachments','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2b00=['Attachment','attachments','util','api','moment','bluebird','request-promise','path','../../config/environment','./attachment.attributes','exports'];(function(_0x39c7dd,_0xdc3c88){var _0x50de07=function(_0x2f0f3b){while(--_0x2f0f3b){_0x39c7dd['push'](_0x39c7dd['shift']());}};_0x50de07(++_0xdc3c88);}(_0x2b00,0x14c));var _0x02b0=function(_0x5341d8,_0x11f185){_0x5341d8=_0x5341d8-0x0;var _0x15ee61=_0x2b00[_0x5341d8];return _0x15ee61;};'use strict';var _=require('lodash');var util=require(_0x02b0('0x0'));var logger=require('../../config/logger')(_0x02b0('0x1'));var moment=require(_0x02b0('0x2'));var BPromise=require(_0x02b0('0x3'));var rp=require(_0x02b0('0x4'));var fs=require('fs');var path=require(_0x02b0('0x5'));var rimraf=require('rimraf');var config=require(_0x02b0('0x6'));var attributes=require(_0x02b0('0x7'));module[_0x02b0('0x8')]=function(_0xaac2a9,_0x4dd11b){return _0xaac2a9['define'](_0x02b0('0x9'),attributes,{'tableName':_0x02b0('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 09ee901..bc2a1ca 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 _0x0f9f=['debug','stringify','error','code','message','info','result','catch','body','options','raw','CreateAttachment','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Attachment,\x20%s,\x20%s','request\x20sent'];(function(_0x3f8e83,_0x457fd5){var _0x1a1b44=function(_0x40f473){while(--_0x40f473){_0x3f8e83['push'](_0x3f8e83['shift']());}};_0x1a1b44(++_0x457fd5);}(_0x0f9f,0x1cc));var _0xf0f9=function(_0xf1081a,_0xfe4f04){_0xf1081a=_0xf1081a-0x0;var _0x311841=_0x0f9f[_0xf1081a];return _0x311841;};'use strict';var _=require('lodash');var util=require(_0xf0f9('0x0'));var moment=require(_0xf0f9('0x1'));var BPromise=require(_0xf0f9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf0f9('0x3'));var db=require(_0xf0f9('0x4'))['db'];var utils=require(_0xf0f9('0x5'));var logger=require(_0xf0f9('0x6'))(_0xf0f9('0x7'));var config=require(_0xf0f9('0x8'));var jayson=require(_0xf0f9('0x9'));var client=jayson[_0xf0f9('0xa')][_0xf0f9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x45694e,_0x51a0ed,_0x448cf5){return new BPromise(function(_0x294b42,_0x5d1753){return client[_0xf0f9('0xc')](_0x45694e,_0x448cf5)[_0xf0f9('0xd')](function(_0x2d72c9){logger['info'](_0xf0f9('0xe'),_0x51a0ed,_0xf0f9('0xf'));logger[_0xf0f9('0x10')]('Attachment,\x20%s,\x20%s,\x20%s',_0x51a0ed,'request\x20sent',JSON[_0xf0f9('0x11')](_0x2d72c9));if(_0x2d72c9[_0xf0f9('0x12')]){if(_0x2d72c9[_0xf0f9('0x12')][_0xf0f9('0x13')]===0x1f4){logger[_0xf0f9('0x12')](_0xf0f9('0xe'),_0x51a0ed,_0x2d72c9[_0xf0f9('0x12')]['message']);return _0x5d1753(_0x2d72c9[_0xf0f9('0x12')][_0xf0f9('0x14')]);}logger[_0xf0f9('0x12')](_0xf0f9('0xe'),_0x51a0ed,_0x2d72c9[_0xf0f9('0x12')]['message']);return _0x294b42(_0x2d72c9[_0xf0f9('0x12')][_0xf0f9('0x14')]);}else{logger[_0xf0f9('0x15')](_0xf0f9('0xe'),_0x51a0ed,_0xf0f9('0xf'));_0x294b42(_0x2d72c9[_0xf0f9('0x16')][_0xf0f9('0x14')]);}})[_0xf0f9('0x17')](function(_0x677b32){logger[_0xf0f9('0x12')]('Attachment,\x20%s,\x20%s',_0x51a0ed,_0x677b32);_0x5d1753(_0x677b32);});});}exports['CreateAttachment']=function(_0x350a48){var _0x3227cf=this;return new Promise(function(_0x4c4e17,_0x178e16){return db['Attachment']['create'](_0x350a48[_0xf0f9('0x18')],{'raw':_0x350a48[_0xf0f9('0x19')]?_0x350a48[_0xf0f9('0x19')][_0xf0f9('0x1a')]===undefined?!![]:![]:!![]})[_0xf0f9('0xd')](function(_0x4ed9ff){logger['info']('CreateAttachment',_0x350a48);logger[_0xf0f9('0x10')](_0xf0f9('0x1b'),_0x350a48,JSON[_0xf0f9('0x11')](_0x4ed9ff));_0x4c4e17(_0x4ed9ff);})['catch'](function(_0x4a8726){logger[_0xf0f9('0x12')]('CreateAttachment',_0x4a8726[_0xf0f9('0x14')],_0x350a48);_0x178e16(_0x3227cf[_0xf0f9('0x12')](0x1f4,_0x4a8726[_0xf0f9('0x14')]));});});}; \ No newline at end of file +var _0xfb3f=['error','message','info','catch','CreateAttachment','Attachment','body','options','raw','lodash','util','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xfb3f,0xd9));var _0xffb3=function(_0x568412,_0x354c4c){_0x568412=_0x568412-0x0;var _0x55c799=_0xfb3f[_0x568412];return _0x55c799;};'use strict';var _=require(_0xffb3('0x0'));var util=require(_0xffb3('0x1'));var moment=require('moment');var BPromise=require(_0xffb3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xffb3('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xffb3('0x4'))(_0xffb3('0x5'));var config=require(_0xffb3('0x6'));var jayson=require(_0xffb3('0x7'));var client=jayson[_0xffb3('0x8')][_0xffb3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3868a6,_0x146133,_0x5177aa){return new BPromise(function(_0x2e9697,_0x250f0f){return client[_0xffb3('0xa')](_0x3868a6,_0x5177aa)[_0xffb3('0xb')](function(_0x39c7eb){logger['info'](_0xffb3('0xc'),_0x146133,_0xffb3('0xd'));logger[_0xffb3('0xe')](_0xffb3('0xf'),_0x146133,_0xffb3('0xd'),JSON[_0xffb3('0x10')](_0x39c7eb));if(_0x39c7eb[_0xffb3('0x11')]){if(_0x39c7eb[_0xffb3('0x11')]['code']===0x1f4){logger[_0xffb3('0x11')](_0xffb3('0xc'),_0x146133,_0x39c7eb['error'][_0xffb3('0x12')]);return _0x250f0f(_0x39c7eb[_0xffb3('0x11')][_0xffb3('0x12')]);}logger[_0xffb3('0x11')](_0xffb3('0xc'),_0x146133,_0x39c7eb[_0xffb3('0x11')][_0xffb3('0x12')]);return _0x2e9697(_0x39c7eb[_0xffb3('0x11')][_0xffb3('0x12')]);}else{logger[_0xffb3('0x13')](_0xffb3('0xc'),_0x146133,_0xffb3('0xd'));_0x2e9697(_0x39c7eb['result'][_0xffb3('0x12')]);}})[_0xffb3('0x14')](function(_0x42b807){logger['error']('Attachment,\x20%s,\x20%s',_0x146133,_0x42b807);_0x250f0f(_0x42b807);});});}exports[_0xffb3('0x15')]=function(_0x167ed7){var _0x57d096=this;return new Promise(function(_0x3b35de,_0x30f403){return db[_0xffb3('0x16')]['create'](_0x167ed7[_0xffb3('0x17')],{'raw':_0x167ed7[_0xffb3('0x18')]?_0x167ed7['options'][_0xffb3('0x19')]===undefined?!![]:![]:!![]})[_0xffb3('0xb')](function(_0x223ad5){logger[_0xffb3('0x13')](_0xffb3('0x15'),_0x167ed7);logger[_0xffb3('0xe')](_0xffb3('0x15'),_0x167ed7,JSON['stringify'](_0x223ad5));_0x3b35de(_0x223ad5);})[_0xffb3('0x14')](function(_0xe4c60e){logger['error'](_0xffb3('0x15'),_0xe4c60e['message'],_0x167ed7);_0x30f403(_0x57d096['error'](0x1f4,_0xe4c60e[_0xffb3('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index ffe3c26..c554bc7 100644 --- a/server/api/attachment/index.js +++ b/server/api/attachment/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2032=['./attachment.controller','get','isAuthenticated','index','/:id','show','download','/:id/clone','clone','root','server/files/attachments/','now','post','single','file','create','put','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x433e19,_0x3646a7){var _0x275d17=function(_0x44a7ca){while(--_0x44a7ca){_0x433e19['push'](_0x433e19['shift']());}};_0x275d17(++_0x3646a7);}(_0x2032,0xd9));var _0x2203=function(_0x4600a1,_0x548ca8){_0x4600a1=_0x4600a1-0x0;var _0x23750b=_0x2032[_0x4600a1];return _0x23750b;};'use strict';var multer=require('multer');var util=require(_0x2203('0x0'));var path=require(_0x2203('0x1'));var timeout=require(_0x2203('0x2'));var express=require('express');var router=express[_0x2203('0x3')]();var fs_extra=require(_0x2203('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var controller=require(_0x2203('0x7'));router[_0x2203('0x8')]('/',auth[_0x2203('0x9')](),controller[_0x2203('0xa')]);router[_0x2203('0x8')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0xc')]);router[_0x2203('0x8')]('/:id/download',auth['isAuthenticated'](),controller[_0x2203('0xd')]);router['post'](_0x2203('0xe'),auth[_0x2203('0x9')](),controller[_0x2203('0xf')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x849049,_0x4a6832,_0x3f690a){_0x3f690a(null,path['join'](config[_0x2203('0x10')],_0x2203('0x11')));},'filename':function(_0x4b9376,_0x583bc7,_0x585c76){_0x585c76(null,util['format']('%s-%s',Date[_0x2203('0x12')](),_0x583bc7['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x2203('0x13')]('/',upload[_0x2203('0x14')](_0x2203('0x15')),controller[_0x2203('0x16')]);router[_0x2203('0x17')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0x18')]);router[_0x2203('0x19')](_0x2203('0xb'),auth['isAuthenticated'](),controller[_0x2203('0x1a')]);module[_0x2203('0x1b')]=router; \ No newline at end of file +var _0xadb5=['root','format','%s-%s','originalname','replace','file','put','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/download','download','post','/:id/clone'];(function(_0x525a46,_0x59e6d1){var _0x59ad72=function(_0x1208da){while(--_0x1208da){_0x525a46['push'](_0x525a46['shift']());}};_0x59ad72(++_0x59e6d1);}(_0xadb5,0xad));var _0x5adb=function(_0x40fb3b,_0x363dc2){_0x40fb3b=_0x40fb3b-0x0;var _0x749a8a=_0xadb5[_0x40fb3b];return _0x749a8a;};'use strict';var multer=require('multer');var util=require(_0x5adb('0x0'));var path=require('path');var timeout=require(_0x5adb('0x1'));var express=require(_0x5adb('0x2'));var router=express[_0x5adb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5adb('0x4'));var interaction=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var controller=require('./attachment.controller');router[_0x5adb('0x7')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0x9')]);router[_0x5adb('0x7')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xb')]);router[_0x5adb('0x7')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xd')]);router[_0x5adb('0xe')](_0x5adb('0xf'),auth[_0x5adb('0x8')](),controller['clone']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1a8f66,_0x1ea238,_0x82e67e){_0x82e67e(null,path['join'](config[_0x5adb('0x10')],'server/files/attachments/'));},'filename':function(_0x2a0b70,_0x5433bf,_0x8cfcc6){_0x8cfcc6(null,util[_0x5adb('0x11')](_0x5adb('0x12'),Date['now'](),_0x5433bf[_0x5adb('0x13')][_0x5adb('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x5adb('0xe')]('/',upload['single'](_0x5adb('0x15')),controller['create']);router[_0x5adb('0x16')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x17')]);router[_0x5adb('0x18')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x19')]);module[_0x5adb('0x1a')]=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index a6c219f..a1e54d5 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 _0xa9e0=['salt','role','disabled','blocked','admin','user','then','minutes','clearBlockUser','getLicense','catch','status','message','login','authenticate','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','json','online','use','User','passport','passport-local','Strategy','bluebird','../../mysqldb','../../components/auth/service','../../config/utils','../../config/environment','../../config/logger','activedirectory','baseDN','domain','error','Error\x20authenticate\x20%s:\x20%s','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','blockDuration','adSsoEnabled','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password'];(function(_0x1f36bb,_0x8af718){var _0xaf97fa=function(_0xeca489){while(--_0xeca489){_0x1f36bb['push'](_0x1f36bb['shift']());}};_0xaf97fa(++_0x8af718);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xa9e0[_0x4e1d03];return _0x362d4b;};'use strict';var passport=require(_0x0a9e('0x0'));var LocalStrategy=require(_0x0a9e('0x1'))[_0x0a9e('0x2')];var moment=require('moment');var ActiveDirectory=require('activedirectory2');var BPromise=require(_0x0a9e('0x3'));var util=require('util');var db=require(_0x0a9e('0x4'))['db'];var authService=require(_0x0a9e('0x5'));var utils=require(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var logger=require(_0x0a9e('0x8'))('api');function isActiveDirectoryConfigured(_0x219af0){var _0x441e3a=![];if(typeof _0x219af0[_0x0a9e('0x9')]!=='undefined'){_0x441e3a=_0x219af0['activedirectory'][_0x0a9e('0xa')]&&_0x219af0['activedirectory']['url']&&_0x219af0[_0x0a9e('0x9')][_0x0a9e('0xb')];}return _0x441e3a;}function adAuthenticate(_0x307b3e,_0x3ab53f,_0xfeb75b){return new BPromise(function(_0xbd1168,_0x4a4c56){try{var _0x50dfb2=new ActiveDirectory(_0x307b3e);_0x50dfb2['authenticate'](_0x3ab53f,_0xfeb75b,function(_0x4cfe67,_0x273d4d){if(_0x4cfe67){logger[_0x0a9e('0xc')](_0x0a9e('0xd'),_0x3ab53f,util[_0x0a9e('0xe')](_0x4cfe67,{'showHidden':![],'depth':null}));_0x4a4c56(_0x0a9e('0xf'));}else if(!_0x273d4d){logger[_0x0a9e('0xc')]('Error\x20authenticate\x20%s:\x20Wrong\x20credentials',_0x3ab53f);_0x4a4c56(_0x0a9e('0xf'));}else{_0xbd1168(_0x273d4d);}});}catch(_0x239b12){_0x4a4c56(_0x239b12);}});}function ActiveDirectoryAuthenticate(_0x2b4227,_0x281129,_0x44dcfd,_0x4d5611){var _0x52a03d,_0x22dccb;if(!isActiveDirectoryConfigured(config)){logger['error'](_0x0a9e('0x10'),_0x281129);return _0x4d5611(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}return db[_0x0a9e('0x11')][_0x0a9e('0x12')]({'where':{'id':0x1},'attributes':['adSsoEnabled',_0x0a9e('0x13')],'raw':!![]})['then'](function(_0x459eb1){_0x52a03d=_0x459eb1;if(!_0x52a03d[_0x0a9e('0x14')]){logger[_0x0a9e('0xc')](_0x0a9e('0x15'),_0x281129);throw new Error(_0x0a9e('0xf'));}return _0x2b4227[_0x0a9e('0x12')]({'logging':!![],'attributes':['id',_0x0a9e('0x16'),_0x0a9e('0x17'),_0x0a9e('0x18'),_0x0a9e('0x19'),_0x0a9e('0x1a'),_0x0a9e('0x1b'),'blockedAt'],'where':{'name':_0x281129,'role':{'$or':[_0x0a9e('0x1c'),_0x0a9e('0x1d'),'agent']},'adSsoEnabled':!![]}});})[_0x0a9e('0x1e')](function(_0x5a09ef){if(!_0x5a09ef||_0x5a09ef&&_0x5a09ef['name']!==_0x281129){throw new Error(_0x0a9e('0xf'));}_0x22dccb=_0x5a09ef;var _0x432e56=_0x22dccb[_0x0a9e('0x16')]+'@'+config[_0x0a9e('0x9')]['domain'];return adAuthenticate(config[_0x0a9e('0x9')],_0x432e56,_0x44dcfd);})[_0x0a9e('0x1e')](function(_0x3b45bc){if(_0x22dccb[_0x0a9e('0x1a')]){throw new Error(_0x0a9e('0xf'));}if(_0x52a03d[_0x0a9e('0x13')]>0x0){if(_0x22dccb[_0x0a9e('0x1b')]){if(moment(_0x22dccb['blockedAt'])['add'](_0x52a03d[_0x0a9e('0x13')],_0x0a9e('0x1f'))>moment()){throw new Error(_0x0a9e('0xf'));}return utils[_0x0a9e('0x20')](_0x22dccb,0x0,![],null)['then'](function(){return utils[_0x0a9e('0x21')](_0x22dccb);})['then'](function(){return _0x4d5611(null,_0x22dccb);});}else{return utils[_0x0a9e('0x21')](_0x22dccb)['then'](function(){return _0x4d5611(null,_0x22dccb);});}}else{return utils[_0x0a9e('0x21')](_0x22dccb)[_0x0a9e('0x1e')](function(){return _0x4d5611(null,_0x22dccb);});}})[_0x0a9e('0x22')](function(_0x14433c){return _0x4d5611(null,![],_0x14433c);});}function handleError(_0x140511,_0x1538a4,_0x11c3b6){return _0x140511[_0x0a9e('0x23')](_0x1538a4||0x1f4)['send']({'message':_0x11c3b6?_0x11c3b6[_0x0a9e('0x24')]||_0x11c3b6:''});}exports[_0x0a9e('0x25')]=function(_0x2b1f27,_0x2ec755,_0x5c877d){passport[_0x0a9e('0x26')](_0x0a9e('0x27'),function(_0x1843b2,_0x824a4f,_0x58b06f){var _0x563b45=_0x1843b2||_0x58b06f;if(_0x563b45){return handleError(_0x2ec755,0x191,_0x563b45);}if(!_0x824a4f){return handleError(_0x2ec755,0x194,{'message':_0x0a9e('0x28')});}else{var _0x2e8759={'payload':{'id':_0x824a4f['id'],'role':_0x824a4f[_0x0a9e('0x19')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x2e8759)[_0x0a9e('0x1e')](function(_0x5d1e0e){_0x2ec755[_0x0a9e('0x29')]({'id':_0x824a4f['id'],'token':_0x5d1e0e,'statusCall':'','isAlreadyLogged':_0x824a4f[_0x0a9e('0x2a')]});});}})(_0x2b1f27,_0x2ec755,_0x5c877d);};passport[_0x0a9e('0x2b')](_0x0a9e('0x27'),new LocalStrategy({'usernameField':_0x0a9e('0x16'),'passwordField':'password'},function(_0x66c1d2,_0x46f0a5,_0x40cb85){return ActiveDirectoryAuthenticate(db[_0x0a9e('0x2c')],_0x66c1d2,_0x46f0a5,_0x40cb85);})); \ No newline at end of file +var _0xa9e0=['salt','role','disabled','blocked','admin','user','then','minutes','clearBlockUser','getLicense','catch','status','message','login','authenticate','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','json','online','use','User','passport','passport-local','Strategy','bluebird','../../mysqldb','../../components/auth/service','../../config/utils','../../config/environment','../../config/logger','activedirectory','baseDN','domain','error','Error\x20authenticate\x20%s:\x20%s','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','blockDuration','adSsoEnabled','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'use strict';var passport=require(_0x0a9e('0x0'));var LocalStrategy=require(_0x0a9e('0x1'))[_0x0a9e('0x2')];var moment=require('moment');var ActiveDirectory=require('activedirectory2');var BPromise=require(_0x0a9e('0x3'));var util=require('util');var db=require(_0x0a9e('0x4'))['db'];var authService=require(_0x0a9e('0x5'));var utils=require(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var logger=require(_0x0a9e('0x8'))('api');function isActiveDirectoryConfigured(_0x219af0){var _0x441e3a=![];if(typeof _0x219af0[_0x0a9e('0x9')]!=='undefined'){_0x441e3a=_0x219af0['activedirectory'][_0x0a9e('0xa')]&&_0x219af0['activedirectory']['url']&&_0x219af0[_0x0a9e('0x9')][_0x0a9e('0xb')];}return _0x441e3a;}function adAuthenticate(_0x307b3e,_0x3ab53f,_0xfeb75b){return new BPromise(function(_0xbd1168,_0x4a4c56){try{var _0x50dfb2=new ActiveDirectory(_0x307b3e);_0x50dfb2['authenticate'](_0x3ab53f,_0xfeb75b,function(_0x4cfe67,_0x273d4d){if(_0x4cfe67){logger[_0x0a9e('0xc')](_0x0a9e('0xd'),_0x3ab53f,util[_0x0a9e('0xe')](_0x4cfe67,{'showHidden':![],'depth':null}));_0x4a4c56(_0x0a9e('0xf'));}else if(!_0x273d4d){logger[_0x0a9e('0xc')]('Error\x20authenticate\x20%s:\x20Wrong\x20credentials',_0x3ab53f);_0x4a4c56(_0x0a9e('0xf'));}else{_0xbd1168(_0x273d4d);}});}catch(_0x239b12){_0x4a4c56(_0x239b12);}});}function ActiveDirectoryAuthenticate(_0x2b4227,_0x281129,_0x44dcfd,_0x4d5611){var _0x52a03d,_0x22dccb;if(!isActiveDirectoryConfigured(config)){logger['error'](_0x0a9e('0x10'),_0x281129);return _0x4d5611(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}return db[_0x0a9e('0x11')][_0x0a9e('0x12')]({'where':{'id':0x1},'attributes':['adSsoEnabled',_0x0a9e('0x13')],'raw':!![]})['then'](function(_0x459eb1){_0x52a03d=_0x459eb1;if(!_0x52a03d[_0x0a9e('0x14')]){logger[_0x0a9e('0xc')](_0x0a9e('0x15'),_0x281129);throw new Error(_0x0a9e('0xf'));}return _0x2b4227[_0x0a9e('0x12')]({'logging':!![],'attributes':['id',_0x0a9e('0x16'),_0x0a9e('0x17'),_0x0a9e('0x18'),_0x0a9e('0x19'),_0x0a9e('0x1a'),_0x0a9e('0x1b'),'blockedAt'],'where':{'name':_0x281129,'role':{'$or':[_0x0a9e('0x1c'),_0x0a9e('0x1d'),'agent']},'adSsoEnabled':!![]}});})[_0x0a9e('0x1e')](function(_0x5a09ef){if(!_0x5a09ef||_0x5a09ef&&_0x5a09ef['name']!==_0x281129){throw new Error(_0x0a9e('0xf'));}_0x22dccb=_0x5a09ef;var _0x432e56=_0x22dccb[_0x0a9e('0x16')]+'@'+config[_0x0a9e('0x9')]['domain'];return adAuthenticate(config[_0x0a9e('0x9')],_0x432e56,_0x44dcfd);})[_0x0a9e('0x1e')](function(_0x3b45bc){if(_0x22dccb[_0x0a9e('0x1a')]){throw new Error(_0x0a9e('0xf'));}if(_0x52a03d[_0x0a9e('0x13')]>0x0){if(_0x22dccb[_0x0a9e('0x1b')]){if(moment(_0x22dccb['blockedAt'])['add'](_0x52a03d[_0x0a9e('0x13')],_0x0a9e('0x1f'))>moment()){throw new Error(_0x0a9e('0xf'));}return utils[_0x0a9e('0x20')](_0x22dccb,0x0,![],null)['then'](function(){return utils[_0x0a9e('0x21')](_0x22dccb);})['then'](function(){return _0x4d5611(null,_0x22dccb);});}else{return utils[_0x0a9e('0x21')](_0x22dccb)['then'](function(){return _0x4d5611(null,_0x22dccb);});}}else{return utils[_0x0a9e('0x21')](_0x22dccb)[_0x0a9e('0x1e')](function(){return _0x4d5611(null,_0x22dccb);});}})[_0x0a9e('0x22')](function(_0x14433c){return _0x4d5611(null,![],_0x14433c);});}function handleError(_0x140511,_0x1538a4,_0x11c3b6){return _0x140511[_0x0a9e('0x23')](_0x1538a4||0x1f4)['send']({'message':_0x11c3b6?_0x11c3b6[_0x0a9e('0x24')]||_0x11c3b6:''});}exports[_0x0a9e('0x25')]=function(_0x2b1f27,_0x2ec755,_0x5c877d){passport[_0x0a9e('0x26')](_0x0a9e('0x27'),function(_0x1843b2,_0x824a4f,_0x58b06f){var _0x563b45=_0x1843b2||_0x58b06f;if(_0x563b45){return handleError(_0x2ec755,0x191,_0x563b45);}if(!_0x824a4f){return handleError(_0x2ec755,0x194,{'message':_0x0a9e('0x28')});}else{var _0x2e8759={'payload':{'id':_0x824a4f['id'],'role':_0x824a4f[_0x0a9e('0x19')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x2e8759)[_0x0a9e('0x1e')](function(_0x5d1e0e){_0x2ec755[_0x0a9e('0x29')]({'id':_0x824a4f['id'],'token':_0x5d1e0e,'statusCall':'','isAlreadyLogged':_0x824a4f[_0x0a9e('0x2a')]});});}})(_0x2b1f27,_0x2ec755,_0x5c877d);};passport[_0x0a9e('0x2b')](_0x0a9e('0x27'),new LocalStrategy({'usernameField':_0x0a9e('0x16'),'passwordField':'password'},function(_0x66c1d2,_0x46f0a5,_0x40cb85){return ActiveDirectoryAuthenticate(db[_0x0a9e('0x2c')],_0x66c1d2,_0x46f0a5,_0x40cb85);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index e297995..b34d0e9 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 _0xd368=['post','login','express','Router','./authActiveDirectory.controller'];(function(_0x39e5e5,_0x5e4a84){var _0x13c529=function(_0x401534){while(--_0x401534){_0x39e5e5['push'](_0x39e5e5['shift']());}};_0x13c529(++_0x5e4a84);}(_0xd368,0x1e7));var _0x8d36=function(_0x8ec947,_0x444fa2){_0x8ec947=_0x8ec947-0x0;var _0x115d2b=_0xd368[_0x8ec947];return _0x115d2b;};'use strict';var express=require(_0x8d36('0x0'));var router=express[_0x8d36('0x1')]();var controller=require(_0x8d36('0x2'));router[_0x8d36('0x3')]('/',controller[_0x8d36('0x4')]);module['exports']=router; \ No newline at end of file +var _0xa1f0=['exports','express','./authActiveDirectory.controller','login'];(function(_0x42235f,_0x57039c){var _0x1a0b01=function(_0x3759e0){while(--_0x3759e0){_0x42235f['push'](_0x42235f['shift']());}};_0x1a0b01(++_0x57039c);}(_0xa1f0,0x179));var _0x0a1f=function(_0x3d9ebb,_0x3dcec5){_0x3d9ebb=_0x3d9ebb-0x0;var _0xfabebf=_0xa1f0[_0x3d9ebb];return _0xfabebf;};'use strict';var express=require(_0x0a1f('0x0'));var router=express['Router']();var controller=require(_0x0a1f('0x1'));router['post']('/',controller[_0x0a1f('0x2')]);module[_0x0a1f('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 6f49ca7..3adef34 100644 --- a/server/api/authGoogle/authGoogle.controller.js +++ b/server/api/authGoogle/authGoogle.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['../../config/environment','../../config/utils','login','google','/login','profile','email','callback','authenticate','use','clientID','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','User','find','map','emails','value','admin','user','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','blockedAt','add','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb'];(function(_0x3ef70c,_0x73d40e){var _0x36e5a8=function(_0x4020fe){while(--_0x4020fe){_0x3ef70c['push'](_0x3ef70c['shift']());}};_0x36e5a8(++_0x73d40e);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x7995('0x0'));var passport=require(_0x7995('0x1'));var GoogleStrategy=require(_0x7995('0x2'))[_0x7995('0x3')];var moment=require('moment');var db=require(_0x7995('0x4'))['db'];var config=require(_0x7995('0x5'));var utils=require(_0x7995('0x6'));exports[_0x7995('0x7')]=passport['authenticate'](_0x7995('0x8'),{'failureRedirect':_0x7995('0x9'),'scope':[_0x7995('0xa'),_0x7995('0xb')],'session':![]});exports[_0x7995('0xc')]=passport[_0x7995('0xd')]('google',{'failureRedirect':_0x7995('0x9'),'session':![]});passport[_0x7995('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0x7995('0x8')][_0x7995('0xf')]:'id','clientSecret':config[_0x7995('0x8')]?config[_0x7995('0x8')][_0x7995('0x10')]:_0x7995('0x11'),'callbackURL':config[_0x7995('0x8')]?config['google'][_0x7995('0x12')]:''},function(_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e,_0x385f00;return db[_0x7995('0x13')][_0x7995('0x14')]({'where':{'id':0x1},'attributes':[_0x7995('0x15'),'blockDuration'],'raw':!![]})['then'](function(_0x2b4e94){_0x19a27e=_0x2b4e94;return db[_0x7995('0x16')][_0x7995('0x17')]({'where':{'email':_[_0x7995('0x18')](_0xb0c872[_0x7995('0x19')],_0x7995('0x1a')),'role':{'$or':[_0x7995('0x1b'),_0x7995('0x1c'),'agent']}}});})[_0x7995('0x1d')](function(_0x565d97){_0x385f00=_0x565d97;if(_0x385f00){if(_0x385f00[_0x7995('0x1e')]){return _0x2cb37a(_0x7995('0x1f'));}else if(_0x19a27e[_0x7995('0x20')]>0x0){if(_0x385f00[_0x7995('0x21')]){if(moment(_0x385f00[_0x7995('0x22')])[_0x7995('0x23')](_0x19a27e['blockDuration'],'minutes')>moment()){return _0x2cb37a(_0x7995('0x1f'));}else{return utils['clearBlockUser'](_0x385f00,0x0,![],null)['then'](function(){return utils[_0x7995('0x24')](_0x385f00);})[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)['then'](function(){return _0x2cb37a(null,_0x385f00);});}}return _0x2cb37a(_0x7995('0x1f'));})[_0x7995('0x25')](function(_0x350fd9){_0x2cb37a(_0x350fd9);});})); \ No newline at end of file +var _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x1e3c16,_0x372caa){var _0x47a0c9=function(_0x47f81d){while(--_0x47f81d){_0x1e3c16['push'](_0x1e3c16['shift']());}};_0x47a0c9(++_0x372caa);}(_0x7a54,0x106));var _0x47a5=function(_0x176ca9,_0x311763){_0x176ca9=_0x176ca9-0x0;var _0x56c27a=_0x7a54[_0x176ca9];return _0x56c27a;};'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 57abcb6..51f558e 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 _0x9dfe=['setTokenCookie','exports','passport','Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get','/callback','isMiddleware'];(function(_0x152df4,_0xd2a8f6){var _0x54f4c2=function(_0x42e4cf){while(--_0x42e4cf){_0x152df4['push'](_0x152df4['shift']());}};_0x54f4c2(++_0xd2a8f6);}(_0x9dfe,0xc0));var _0xe9df=function(_0x27669b,_0x306a2c){_0x27669b=_0x27669b-0x0;var _0x31ed6e=_0x9dfe[_0x27669b];return _0x31ed6e;};'use strict';var express=require('express');var passport=require(_0xe9df('0x0'));var router=express[_0xe9df('0x1')]();var controller=require(_0xe9df('0x2'));var userController=require(_0xe9df('0x3'));var authService=require(_0xe9df('0x4'));router[_0xe9df('0x5')]('/',controller['login']);router[_0xe9df('0x5')](_0xe9df('0x6'),controller['callback'],authService[_0xe9df('0x7')],userController['login'],authService[_0xe9df('0x8')]);module[_0xe9df('0x9')]=router; \ No newline at end of file +var _0x19ff=['Router','./authGoogle.controller','../user/user.controller.js','login','/callback','callback','setTokenCookie','exports','express','passport'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x19ff,0xbc));var _0xf19f=function(_0x43cb3d,_0x4efe7e){_0x43cb3d=_0x43cb3d-0x0;var _0x13511a=_0x19ff[_0x43cb3d];return _0x13511a;};'use strict';var express=require(_0xf19f('0x0'));var passport=require(_0xf19f('0x1'));var router=express[_0xf19f('0x2')]();var controller=require(_0xf19f('0x3'));var userController=require(_0xf19f('0x4'));var authService=require('../../components/auth/service');router['get']('/',controller[_0xf19f('0x5')]);router['get'](_0xf19f('0x6'),controller[_0xf19f('0x7')],authService['isMiddleware'],userController[_0xf19f('0x5')],authService[_0xf19f('0x8')]);module[_0xf19f('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 f3613f0..efac118 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 _0xded0=['Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','online','forgot','body','generate','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','previousPasswords','validatePasswordHistory','Password\x20reset!','use','passport-local','lodash','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','Setting','findOne','allowedLoginAttempts','then','password','role','disabled','blockedAt','loginAttempts','admin','user','name','authenticate','blocked','add','blockDuration','minutes','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','clearBlockUser','getLicense','catch','MailAccount','find','email','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','auth','pass','merge','format','request','SendMail','error','message','stringify','status','send','local-login'];(function(_0xcd3fd1,_0x1a2ffc){var _0x29a9d3=function(_0x567df6){while(--_0x567df6){_0xcd3fd1['push'](_0xcd3fd1['shift']());}};_0x29a9d3(++_0x1a2ffc);}(_0xded0,0xc2));var _0x0ded=function(_0x46a23a,_0x2a0663){_0x46a23a=_0x46a23a-0x0;var _0x3397f9=_0xded0[_0x46a23a];return _0x3397f9;};'use strict';var util=require('util');var passport=require('passport');var LocalStrategy=require(_0x0ded('0x0'))['Strategy'];var jayson=require('jayson/promise');var _=require(_0x0ded('0x1'));var rs=require('randomstring');var moment=require(_0x0ded('0x2'));var db=require(_0x0ded('0x3'))['db'];var authService=require(_0x0ded('0x4'));var utils=require(_0x0ded('0x5'));var client=jayson[_0x0ded('0x6')]['http']({'port':0x232b});function localAuthenticate(_0x49a015,_0x308dca,_0x58ba15,_0xd4464c){var _0xd68cca,_0x16f242;return db[_0x0ded('0x7')][_0x0ded('0x8')]({'where':{'id':0x1},'attributes':[_0x0ded('0x9'),'blockDuration'],'raw':!![]})[_0x0ded('0xa')](function(_0x37f7ed){_0xd68cca=_0x37f7ed;return _0x49a015['findOne']({'attributes':['id','name',_0x0ded('0xb'),'salt',_0x0ded('0xc'),_0x0ded('0xd'),'blocked',_0x0ded('0xe'),_0x0ded('0xf')],'where':{'name':_0x308dca,'role':{'$or':[_0x0ded('0x10'),_0x0ded('0x11'),'agent']}}});})[_0x0ded('0xa')](function(_0x57ef09){if(!_0x57ef09||_0x57ef09&&_0x57ef09[_0x0ded('0x12')]!==_0x308dca){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x16f242=_0x57ef09;return _0x16f242;}})[_0x0ded('0xa')](function(){_0x16f242[_0x0ded('0x13')](_0x58ba15,function(_0x58d9ef,_0x3e0170){var _0x442882=_0x16f242['loginAttempts']+0x1;if(_0x58d9ef){return _0xd4464c(_0x58d9ef);}else if(!_0x3e0170){if(_0x16f242['disabled']){return _0xd4464c(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0xd68cca[_0x0ded('0x9')]>0x0){if(_0x16f242[_0x0ded('0x14')]){if(_0xd68cca['blockDuration']>0x0){if(moment(_0x16f242[_0x0ded('0xe')])[_0x0ded('0x15')](_0xd68cca[_0x0ded('0x16')],_0x0ded('0x17'))>moment()){return _0xd4464c(null,![],{'message':_0x0ded('0x18')});}else{return utils[_0x0ded('0x19')](_0x16f242,_0x442882,![],null)['then'](function(){return _0xd4464c(null,![],{'message':_0x0ded('0x18')});});}}else{return _0xd4464c(null,![],{'message':_0x0ded('0x18')});}}else{if(_0x442882>=_0xd68cca[_0x0ded('0x9')]){return utils[_0x0ded('0x19')](_0x16f242,0x0,!![],moment())[_0x0ded('0xa')](function(){return _0xd4464c(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils[_0x0ded('0x19')](_0x16f242,_0x442882,![],null)[_0x0ded('0xa')](function(){return _0xd4464c(null,![],{'message':_0x0ded('0x18')});});}}}else{return _0xd4464c(null,![],{'message':_0x0ded('0x18')});}}else{if(_0x16f242[_0x0ded('0xd')]){return _0xd4464c(null,![],{'message':_0x0ded('0x18')});}else if(_0xd68cca[_0x0ded('0x9')]>0x0){if(_0x16f242[_0x0ded('0x14')]){if(_0xd68cca[_0x0ded('0x16')]>0x0){if(moment(_0x16f242[_0x0ded('0xe')])[_0x0ded('0x15')](_0xd68cca[_0x0ded('0x16')],'minutes')>moment()){return _0xd4464c(null,![],{'message':_0x0ded('0x18')});}else{return utils[_0x0ded('0x19')](_0x16f242,0x0,![],null)[_0x0ded('0xa')](function(){return utils['getLicense'](_0x16f242);})['then'](function(){return _0xd4464c(null,_0x16f242);});}}else{return _0xd4464c(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils[_0x0ded('0x19')](_0x16f242,0x0,![],null)[_0x0ded('0xa')](function(){return utils[_0x0ded('0x1a')](_0x16f242);})['then'](function(){return _0xd4464c(null,_0x16f242);})[_0x0ded('0x1b')](function(_0x4e99d2){return _0xd4464c(null,![],_0x4e99d2);});}}else{if(_0x16f242[_0x0ded('0x14')]){return _0xd4464c(null,![],{'message':_0x0ded('0x18')});}else{return utils[_0x0ded('0x1a')](_0x16f242)['then'](function(){return _0xd4464c(null,_0x16f242);});}}}});})['catch'](function(_0x467a0f){return _0xd4464c(null,![],_0x467a0f);});}function sendServiceMail(_0x4b299c){return db[_0x0ded('0x1c')][_0x0ded('0x1d')]({'where':{'service':!![]},'attributes':['id',_0x0ded('0x12'),_0x0ded('0x1e')],'include':[{'model':db['MailServerOut'],'as':_0x0ded('0x1f')}]})['then'](function(_0x2eaab5){if(!_0x2eaab5){throw new Error(_0x0ded('0x20'));}var _0xfb3fd7={'tls':{'rejectUnauthorized':![]}};if(_0x2eaab5[_0x0ded('0x1f')][_0x0ded('0x21')]){_0xfb3fd7[_0x0ded('0x21')]=_0x2eaab5[_0x0ded('0x1f')][_0x0ded('0x21')];}else{_0xfb3fd7['host']=_0x2eaab5[_0x0ded('0x1f')][_0x0ded('0x22')];_0xfb3fd7[_0x0ded('0x23')]=_0x2eaab5[_0x0ded('0x1f')][_0x0ded('0x23')];_0xfb3fd7['secure']=_0x2eaab5[_0x0ded('0x1f')][_0x0ded('0x24')];}if(_0x2eaab5[_0x0ded('0x1f')]['authentication']){_0xfb3fd7[_0x0ded('0x25')]={'user':_0x2eaab5['Smtp']['user'],'pass':_0x2eaab5['Smtp'][_0x0ded('0x26')]};}var _0x42c4b1={'account':_0xfb3fd7,'message':_[_0x0ded('0x27')]({'from':util[_0x0ded('0x28')]('\x22%s\x22\x20<%s>',_0x2eaab5[_0x0ded('0x12')],_0x2eaab5[_0x0ded('0x1e')]||_0x2eaab5[_0x0ded('0x1f')]['user'])},_0x4b299c)};return client[_0x0ded('0x29')](_0x0ded('0x2a'),_0x42c4b1);})[_0x0ded('0xa')](function(_0xc40847){if(_0xc40847[_0x0ded('0x2b')]){throw new Error(util[_0x0ded('0x28')]('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0xc40847[_0x0ded('0x2b')][_0x0ded('0x2c')]||JSON[_0x0ded('0x2d')](_0xc40847[_0x0ded('0x2b')])));}return!![];});}function handleError(_0x5b6666,_0x9343a0,_0x350174){return _0x5b6666[_0x0ded('0x2e')](_0x9343a0||0x1f4)[_0x0ded('0x2f')]({'message':_0x350174?_0x350174[_0x0ded('0x2c')]||_0x350174:''});}exports['login']=function(_0x5da0e3,_0x8a3e82,_0x213150){passport['authenticate'](_0x0ded('0x30'),function(_0x18ae89,_0x1fd047,_0x8d9e06){var _0x1c782a=_0x18ae89||_0x8d9e06;if(_0x1c782a){return handleError(_0x8a3e82,0x191,_0x1c782a);}if(!_0x1fd047){return handleError(_0x8a3e82,0x194,{'message':_0x0ded('0x31')});}else{var _0x1424ec={'payload':{'id':_0x1fd047['id'],'role':_0x1fd047[_0x0ded('0xc')]},'options':{'expiresIn':0x15180}};return authService[_0x0ded('0x32')](_0x1424ec)['then'](function(_0x2bb678){_0x8a3e82['json']({'id':_0x1fd047['id'],'token':_0x2bb678,'statusCall':'','isAlreadyLogged':_0x1fd047[_0x0ded('0x33')]});});}})(_0x5da0e3,_0x8a3e82,_0x213150);};exports[_0x0ded('0x34')]=function(_0x444eec,_0x1877d1,_0x1254bb){if(!_0x444eec[_0x0ded('0x35')][_0x0ded('0x1e')]){return handleError(_0x1877d1,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x47231e=rs[_0x0ded('0x36')]();_0x444eec['body']['email']=_0x444eec['body'][_0x0ded('0x1e')]['trim']()[_0x0ded('0x37')]();var _0x4a380d;return db[_0x0ded('0x7')]['findOne']({'where':{'id':0x1},'attributes':[_0x0ded('0x9'),_0x0ded('0x16')],'raw':!![]})['then'](function(_0xd681af){_0x4a380d=_0xd681af;return db[_0x0ded('0x38')]['find']({'where':{'email':_0x444eec[_0x0ded('0x35')]['email']}});})[_0x0ded('0xa')](function(_0xdddb2c){if(!_0xdddb2c){throw new Error(_0x0ded('0x39'));}if(_0xdddb2c[_0x0ded('0xd')]){throw new Error(_0x0ded('0x3a'));}if(_0xdddb2c['blocked']){if(moment(_0xdddb2c[_0x0ded('0xe')])['add'](_0x4a380d[_0x0ded('0x16')],_0x0ded('0x17'))>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0xdddb2c['blocked']=![];_0xdddb2c[_0x0ded('0xe')]=null;}}_0xdddb2c[_0x0ded('0x3b')]=_0x47231e;_0xdddb2c[_0x0ded('0x3c')]=Date[_0x0ded('0x3d')]()+0x36ee80;return _0xdddb2c[_0x0ded('0x3e')]();})['then'](function(){return sendServiceMail({'to':_0x444eec[_0x0ded('0x35')][_0x0ded('0x1e')],'subject':_0x0ded('0x3f'),'text':_0x0ded('0x40')+_0x0ded('0x41')+_0x0ded('0x42')+_0x444eec[_0x0ded('0x43')]['host']+_0x0ded('0x44')+_0x47231e+'\x0a\x0a'+_0x0ded('0x45')});})[_0x0ded('0xa')](function(){_0x1877d1[_0x0ded('0x2e')](0xc8)[_0x0ded('0x2f')]({'message':_0x0ded('0x46')});})[_0x0ded('0x1b')](function(_0xd20375){return handleError(_0x1877d1,0x1f4,_0xd20375);});};exports[_0x0ded('0x47')]=function(_0x19b838,_0x2856a7,_0x5debc1){return db['User'][_0x0ded('0x1d')]({'where':{'resetPasswordToken':_0x19b838[_0x0ded('0x48')][_0x0ded('0x49')],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0x0ded('0xa')](function(_0x445d0d){if(!_0x445d0d){throw new Error(_0x0ded('0x4a'));}return db[_0x0ded('0x7')][_0x0ded('0x8')]({'attributes':['id',_0x0ded('0x4b'),_0x0ded('0x4c'),'passwordHistoryLimit']})['then'](function(_0x33f09d){if(_0x33f09d[_0x0ded('0x4b')])authService['validatePasswordPattern'](_0x19b838['body'][_0x0ded('0xb')]);if(!_0x33f09d[_0x0ded('0x4c')]||!_0x445d0d[_0x0ded('0x4d')])return _0x445d0d;authService[_0x0ded('0x4e')](_0x19b838[_0x0ded('0x35')][_0x0ded('0xb')],_0x445d0d[_0x0ded('0x4d')],_0x33f09d['passwordHistoryLimit']);return _0x445d0d;})[_0x0ded('0xa')](function(){_0x445d0d[_0x0ded('0xb')]=_0x19b838[_0x0ded('0x35')][_0x0ded('0xb')];_0x445d0d[_0x0ded('0x3b')]=null;_0x445d0d[_0x0ded('0x3c')]=null;return _0x445d0d[_0x0ded('0x3e')]();});})[_0x0ded('0xa')](function(){_0x2856a7['status'](0xc8)[_0x0ded('0x2f')]({'message':_0x0ded('0x4f')});})[_0x0ded('0x1b')](function(_0x69653b){return handleError(_0x2856a7,0x1f4,_0x69653b);});};passport[_0x0ded('0x50')](_0x0ded('0x30'),new LocalStrategy({'usernameField':_0x0ded('0x12'),'passwordField':_0x0ded('0xb')},function(_0x37877b,_0x5ed389,_0x4f7078){return localAuthenticate(db[_0x0ded('0x38')],_0x37877b,_0x5ed389,_0x4f7078);})); \ No newline at end of file +var _0xa627=['stringify','status','send','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','forgot','body','generate','toLowerCase','find','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','User','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','validatePasswordHistory','Password\x20reset!','use','util','passport','passport-local','randomstring','moment','../../mysqldb','../../config/utils','client','http','Setting','findOne','then','password','role','disabled','blocked','blockedAt','loginAttempts','admin','agent','name','authenticate','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','allowedLoginAttempts','blockDuration','add','clearBlockUser','minutes','getLicense','catch','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','authentication','auth','user','pass','merge','format','\x22%s\x22\x20<%s>','email','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message'];(function(_0x12efa0,_0x579590){var _0x158c02=function(_0x311422){while(--_0x311422){_0x12efa0['push'](_0x12efa0['shift']());}};_0x158c02(++_0x579590);}(_0xa627,0xcf));var _0x7a62=function(_0x4b89bc,_0x1b31ba){_0x4b89bc=_0x4b89bc-0x0;var _0x62df7c=_0xa627[_0x4b89bc];return _0x62df7c;};'use strict';var util=require(_0x7a62('0x0'));var passport=require(_0x7a62('0x1'));var LocalStrategy=require(_0x7a62('0x2'))['Strategy'];var jayson=require('jayson/promise');var _=require('lodash');var rs=require(_0x7a62('0x3'));var moment=require(_0x7a62('0x4'));var db=require(_0x7a62('0x5'))['db'];var authService=require('../../components/auth/service');var utils=require(_0x7a62('0x6'));var client=jayson[_0x7a62('0x7')][_0x7a62('0x8')]({'port':0x232b});function localAuthenticate(_0x578e6e,_0x3e8c19,_0x2db8af,_0x191364){var _0x1a87bf,_0x6f17bf;return db[_0x7a62('0x9')][_0x7a62('0xa')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts','blockDuration'],'raw':!![]})[_0x7a62('0xb')](function(_0x2b3e6a){_0x1a87bf=_0x2b3e6a;return _0x578e6e['findOne']({'attributes':['id','name',_0x7a62('0xc'),'salt',_0x7a62('0xd'),_0x7a62('0xe'),_0x7a62('0xf'),_0x7a62('0x10'),_0x7a62('0x11')],'where':{'name':_0x3e8c19,'role':{'$or':[_0x7a62('0x12'),'user',_0x7a62('0x13')]}}});})[_0x7a62('0xb')](function(_0x22c438){if(!_0x22c438||_0x22c438&&_0x22c438[_0x7a62('0x14')]!==_0x3e8c19){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x6f17bf=_0x22c438;return _0x6f17bf;}})[_0x7a62('0xb')](function(){_0x6f17bf[_0x7a62('0x15')](_0x2db8af,function(_0x98d9fb,_0x1b320f){var _0x172402=_0x6f17bf[_0x7a62('0x11')]+0x1;if(_0x98d9fb){return _0x191364(_0x98d9fb);}else if(!_0x1b320f){if(_0x6f17bf[_0x7a62('0xe')]){return _0x191364(null,![],{'message':_0x7a62('0x16')});}else if(_0x1a87bf[_0x7a62('0x17')]>0x0){if(_0x6f17bf[_0x7a62('0xf')]){if(_0x1a87bf[_0x7a62('0x18')]>0x0){if(moment(_0x6f17bf[_0x7a62('0x10')])[_0x7a62('0x19')](_0x1a87bf[_0x7a62('0x18')],'minutes')>moment()){return _0x191364(null,![],{'message':_0x7a62('0x16')});}else{return utils[_0x7a62('0x1a')](_0x6f17bf,_0x172402,![],null)[_0x7a62('0xb')](function(){return _0x191364(null,![],{'message':_0x7a62('0x16')});});}}else{return _0x191364(null,![],{'message':_0x7a62('0x16')});}}else{if(_0x172402>=_0x1a87bf[_0x7a62('0x17')]){return utils[_0x7a62('0x1a')](_0x6f17bf,0x0,!![],moment())[_0x7a62('0xb')](function(){return _0x191364(null,![],{'message':_0x7a62('0x16')});});}else{return utils['clearBlockUser'](_0x6f17bf,_0x172402,![],null)['then'](function(){return _0x191364(null,![],{'message':_0x7a62('0x16')});});}}}else{return _0x191364(null,![],{'message':_0x7a62('0x16')});}}else{if(_0x6f17bf[_0x7a62('0xe')]){return _0x191364(null,![],{'message':_0x7a62('0x16')});}else if(_0x1a87bf[_0x7a62('0x17')]>0x0){if(_0x6f17bf[_0x7a62('0xf')]){if(_0x1a87bf[_0x7a62('0x18')]>0x0){if(moment(_0x6f17bf[_0x7a62('0x10')])[_0x7a62('0x19')](_0x1a87bf[_0x7a62('0x18')],_0x7a62('0x1b'))>moment()){return _0x191364(null,![],{'message':_0x7a62('0x16')});}else{return utils[_0x7a62('0x1a')](_0x6f17bf,0x0,![],null)['then'](function(){return utils[_0x7a62('0x1c')](_0x6f17bf);})[_0x7a62('0xb')](function(){return _0x191364(null,_0x6f17bf);});}}else{return _0x191364(null,![],{'message':_0x7a62('0x16')});}}else{return utils[_0x7a62('0x1a')](_0x6f17bf,0x0,![],null)[_0x7a62('0xb')](function(){return utils['getLicense'](_0x6f17bf);})[_0x7a62('0xb')](function(){return _0x191364(null,_0x6f17bf);})[_0x7a62('0x1d')](function(_0x1314a5){return _0x191364(null,![],_0x1314a5);});}}else{if(_0x6f17bf[_0x7a62('0xf')]){return _0x191364(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils['getLicense'](_0x6f17bf)[_0x7a62('0xb')](function(){return _0x191364(null,_0x6f17bf);});}}}});})[_0x7a62('0x1d')](function(_0xa4b858){return _0x191364(null,![],_0xa4b858);});}function sendServiceMail(_0x4a913e){return db['MailAccount']['find']({'where':{'service':!![]},'attributes':['id',_0x7a62('0x14'),'email'],'include':[{'model':db['MailServerOut'],'as':_0x7a62('0x1e')}]})[_0x7a62('0xb')](function(_0x451784){if(!_0x451784){throw new Error(_0x7a62('0x1f'));}var _0x441bc0={'tls':{'rejectUnauthorized':![]}};if(_0x451784['Smtp'][_0x7a62('0x20')]){_0x441bc0[_0x7a62('0x20')]=_0x451784[_0x7a62('0x1e')]['service'];}else{_0x441bc0[_0x7a62('0x21')]=_0x451784[_0x7a62('0x1e')][_0x7a62('0x21')];_0x441bc0[_0x7a62('0x22')]=_0x451784[_0x7a62('0x1e')][_0x7a62('0x22')];_0x441bc0['secure']=_0x451784[_0x7a62('0x1e')][_0x7a62('0x23')];}if(_0x451784['Smtp'][_0x7a62('0x24')]){_0x441bc0[_0x7a62('0x25')]={'user':_0x451784['Smtp'][_0x7a62('0x26')],'pass':_0x451784[_0x7a62('0x1e')][_0x7a62('0x27')]};}var _0xb409be={'account':_0x441bc0,'message':_[_0x7a62('0x28')]({'from':util[_0x7a62('0x29')](_0x7a62('0x2a'),_0x451784[_0x7a62('0x14')],_0x451784[_0x7a62('0x2b')]||_0x451784[_0x7a62('0x1e')][_0x7a62('0x26')])},_0x4a913e)};return client['request'](_0x7a62('0x2c'),_0xb409be);})['then'](function(_0x20a06a){if(_0x20a06a[_0x7a62('0x2d')]){throw new Error(util[_0x7a62('0x29')](_0x7a62('0x2e'),_0x20a06a['error'][_0x7a62('0x2f')]||JSON[_0x7a62('0x30')](_0x20a06a[_0x7a62('0x2d')])));}return!![];});}function handleError(_0x2e1cfb,_0x303cfc,_0x199902){return _0x2e1cfb[_0x7a62('0x31')](_0x303cfc||0x1f4)[_0x7a62('0x32')]({'message':_0x199902?_0x199902['message']||_0x199902:''});}exports[_0x7a62('0x33')]=function(_0x474a7d,_0x3840fa,_0x23db26){passport['authenticate'](_0x7a62('0x34'),function(_0x33af69,_0x35cf31,_0x490cdd){var _0x59acdb=_0x33af69||_0x490cdd;if(_0x59acdb){return handleError(_0x3840fa,0x191,_0x59acdb);}if(!_0x35cf31){return handleError(_0x3840fa,0x194,{'message':_0x7a62('0x35')});}else{var _0x4572a6={'payload':{'id':_0x35cf31['id'],'role':_0x35cf31['role']},'options':{'expiresIn':0x15180}};return authService[_0x7a62('0x36')](_0x4572a6)[_0x7a62('0xb')](function(_0x1dd6d0){_0x3840fa[_0x7a62('0x37')]({'id':_0x35cf31['id'],'token':_0x1dd6d0,'statusCall':'','isAlreadyLogged':_0x35cf31['online']});});}})(_0x474a7d,_0x3840fa,_0x23db26);};exports[_0x7a62('0x38')]=function(_0x132011,_0x38c1c5,_0x44de2d){if(!_0x132011[_0x7a62('0x39')][_0x7a62('0x2b')]){return handleError(_0x38c1c5,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x47bdf7=rs[_0x7a62('0x3a')]();_0x132011['body'][_0x7a62('0x2b')]=_0x132011[_0x7a62('0x39')][_0x7a62('0x2b')]['trim']()[_0x7a62('0x3b')]();var _0x59d1c3;return db[_0x7a62('0x9')][_0x7a62('0xa')]({'where':{'id':0x1},'attributes':[_0x7a62('0x17'),'blockDuration'],'raw':!![]})[_0x7a62('0xb')](function(_0x18c9ce){_0x59d1c3=_0x18c9ce;return db['User'][_0x7a62('0x3c')]({'where':{'email':_0x132011[_0x7a62('0x39')][_0x7a62('0x2b')]}});})[_0x7a62('0xb')](function(_0x53e44a){if(!_0x53e44a){throw new Error(_0x7a62('0x3d'));}if(_0x53e44a['disabled']){throw new Error(_0x7a62('0x3e'));}if(_0x53e44a[_0x7a62('0xf')]){if(moment(_0x53e44a[_0x7a62('0x10')])[_0x7a62('0x19')](_0x59d1c3[_0x7a62('0x18')],_0x7a62('0x1b'))>moment()){throw new Error(_0x7a62('0x3f'));}else{_0x53e44a['blocked']=![];_0x53e44a[_0x7a62('0x10')]=null;}}_0x53e44a[_0x7a62('0x40')]=_0x47bdf7;_0x53e44a[_0x7a62('0x41')]=Date[_0x7a62('0x42')]()+0x36ee80;return _0x53e44a['save']();})[_0x7a62('0xb')](function(){return sendServiceMail({'to':_0x132011[_0x7a62('0x39')][_0x7a62('0x2b')],'subject':'xCally\x20Motion\x20Password\x20Reset','text':_0x7a62('0x43')+_0x7a62('0x44')+_0x7a62('0x45')+_0x132011[_0x7a62('0x46')]['host']+_0x7a62('0x47')+_0x47bdf7+'\x0a\x0a'+_0x7a62('0x48')});})[_0x7a62('0xb')](function(){_0x38c1c5[_0x7a62('0x31')](0xc8)[_0x7a62('0x32')]({'message':_0x7a62('0x49')});})['catch'](function(_0xae6133){return handleError(_0x38c1c5,0x1f4,_0xae6133);});};exports['reset']=function(_0x199744,_0x5cd152,_0x18ad24){return db[_0x7a62('0x4a')][_0x7a62('0x3c')]({'where':{'resetPasswordToken':_0x199744[_0x7a62('0x4b')][_0x7a62('0x4c')],'resetPasswordExpires':{'$gt':Date['now']()}}})['then'](function(_0x4f5a05){if(!_0x4f5a05){throw new Error(_0x7a62('0x4d'));}return db['Setting'][_0x7a62('0xa')]({'attributes':['id',_0x7a62('0x4e'),_0x7a62('0x4f'),_0x7a62('0x50')]})['then'](function(_0x316206){if(_0x316206[_0x7a62('0x4e')])authService[_0x7a62('0x51')](_0x199744[_0x7a62('0x39')][_0x7a62('0xc')]);if(!_0x316206['enforcePasswordHistory']||!_0x4f5a05['previousPasswords'])return _0x4f5a05;authService[_0x7a62('0x52')](_0x199744[_0x7a62('0x39')][_0x7a62('0xc')],_0x4f5a05['previousPasswords'],_0x316206['passwordHistoryLimit']);return _0x4f5a05;})['then'](function(){_0x4f5a05[_0x7a62('0xc')]=_0x199744[_0x7a62('0x39')][_0x7a62('0xc')];_0x4f5a05['resetPasswordToken']=null;_0x4f5a05[_0x7a62('0x41')]=null;return _0x4f5a05['save']();});})[_0x7a62('0xb')](function(){_0x5cd152[_0x7a62('0x31')](0xc8)[_0x7a62('0x32')]({'message':_0x7a62('0x53')});})[_0x7a62('0x1d')](function(_0x363cc7){return handleError(_0x5cd152,0x1f4,_0x363cc7);});};passport[_0x7a62('0x54')](_0x7a62('0x34'),new LocalStrategy({'usernameField':'name','passwordField':'password'},function(_0x43e503,_0x220358,_0x16a92b){return localAuthenticate(db[_0x7a62('0x4a')],_0x43e503,_0x220358,_0x16a92b);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 0eeb8f2..1adb5ed 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 _0x48e1=['forgot','/reset/:token','exports','express','Router','./authLocal.controller','login','post','/forgot'];(function(_0x5e6bec,_0x1eb54d){var _0x5dc5cf=function(_0x59429a){while(--_0x59429a){_0x5e6bec['push'](_0x5e6bec['shift']());}};_0x5dc5cf(++_0x1eb54d);}(_0x48e1,0x174));var _0x148e=function(_0x394289,_0x2dba3e){_0x394289=_0x394289-0x0;var _0x8a8c3b=_0x48e1[_0x394289];return _0x8a8c3b;};'use strict';var express=require(_0x148e('0x0'));var router=express[_0x148e('0x1')]();var controller=require(_0x148e('0x2'));router['post']('/',controller[_0x148e('0x3')]);router[_0x148e('0x4')](_0x148e('0x5'),controller[_0x148e('0x6')]);router[_0x148e('0x4')](_0x148e('0x7'),controller['reset']);module[_0x148e('0x8')]=router; \ No newline at end of file +var _0x3b88=['/forgot','forgot','exports','express','Router','./authLocal.controller','post','login'];(function(_0x7c4840,_0x43dc5c){var _0x1a19a5=function(_0x17165d){while(--_0x17165d){_0x7c4840['push'](_0x7c4840['shift']());}};_0x1a19a5(++_0x43dc5c);}(_0x3b88,0xbb));var _0x83b8=function(_0x63f40d,_0x55e1e7){_0x63f40d=_0x63f40d-0x0;var _0x5082d3=_0x3b88[_0x63f40d];return _0x5082d3;};'use strict';var express=require(_0x83b8('0x0'));var router=express[_0x83b8('0x1')]();var controller=require(_0x83b8('0x2'));router[_0x83b8('0x3')]('/',controller[_0x83b8('0x4')]);router['post'](_0x83b8('0x5'),controller[_0x83b8('0x6')]);router[_0x83b8('0x3')]('/reset/:token',controller['reset']);module[_0x83b8('0x7')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 66fabb5..ae4ac2d 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 _0xb699=['BOOLEAN','INTEGER','exports','STRING'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xb699,0x1f2));var _0x9b69=function(_0x432a19,_0x3fc4c1){_0x432a19=_0x432a19-0x0;var _0xa1bc6=_0xb699[_0x432a19];return _0xa1bc6;};'use strict';var Sequelize=require('sequelize');module[_0x9b69('0x0')]={'name':{'type':Sequelize[_0x9b69('0x1')],'allowNull':![]},'channel':{'type':Sequelize[_0x9b69('0x1')]},'description':{'type':Sequelize[_0x9b69('0x1')]},'status':{'type':Sequelize[_0x9b69('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x9b69('0x3')],'defaultValue':0xa}}; \ No newline at end of file +var _0x2885=['exports','STRING','INTEGER','sequelize'];(function(_0x474f19,_0x63ff68){var _0x14919a=function(_0x26de38){while(--_0x26de38){_0x474f19['push'](_0x474f19['shift']());}};_0x14919a(++_0x63ff68);}(_0x2885,0x19b));var _0x5288=function(_0x2aa0e7,_0x4e5145){_0x2aa0e7=_0x2aa0e7-0x0;var _0x1472c0=_0x2885[_0x2aa0e7];return _0x1472c0;};'use strict';var Sequelize=require(_0x5288('0x0'));module[_0x5288('0x1')]={'name':{'type':Sequelize[_0x5288('0x2')],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0x5288('0x3')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index 9212095..4c13a6a 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 _0x52fb=['create','body','params','addConditions','Condition','ids','omit','getConditions','findOne','addActions','getActions','Action','rawAttributes','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','squel','crypto','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','json','offset','undefined','count','set','apply','reject','save','update','then','destroy','end','name','send','index','map','Automation','type','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','keys','include','find'];(function(_0xbb9cb0,_0x4c1858){var _0x5cfd58=function(_0x28b75c){while(--_0x28b75c){_0xbb9cb0['push'](_0xbb9cb0['shift']());}};_0x5cfd58(++_0x4c1858);}(_0x52fb,0x159));var _0xb52f=function(_0x3c34a7,_0xa6350f){_0x3c34a7=_0x3c34a7-0x0;var _0xd7007e=_0x52fb[_0x3c34a7];return _0xd7007e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb52f('0x0'));var zipdir=require(_0xb52f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb52f('0x2'));var moment=require(_0xb52f('0x3'));var BPromise=require(_0xb52f('0x4'));var Mustache=require(_0xb52f('0x5'));var util=require(_0xb52f('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xb52f('0x7'));var ejs=require(_0xb52f('0x8'));var fs=require('fs');var fs_extra=require(_0xb52f('0x9'));var _=require('lodash');var squel=require(_0xb52f('0xa'));var crypto=require(_0xb52f('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb52f('0x7'));var querystring=require(_0xb52f('0xc'));var Papa=require(_0xb52f('0xd'));var Redis=require(_0xb52f('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xb52f('0xf'));var as=require(_0xb52f('0x10'));var hardwareService=require(_0xb52f('0x11'));var logger=require(_0xb52f('0x12'))(_0xb52f('0x13'));var utils=require(_0xb52f('0x14'));var config=require(_0xb52f('0x15'));var licenseUtil=require(_0xb52f('0x16'));var db=require(_0xb52f('0x17'))['db'];function respondWithStatusCode(_0x268108,_0x3715d8){_0x3715d8=_0x3715d8||0xcc;return function(_0x3bec6e){if(_0x3bec6e){return _0x268108[_0xb52f('0x18')](_0x3715d8);}return _0x268108[_0xb52f('0x19')](_0x3715d8)['end']();};}function respondWithResult(_0x129732,_0x32ea6d){_0x32ea6d=_0x32ea6d||0xc8;return function(_0x2446b3){if(_0x2446b3){return _0x129732[_0xb52f('0x19')](_0x32ea6d)[_0xb52f('0x1a')](_0x2446b3);}};}function respondWithFilteredResult(_0x516331,_0xb4df1c){return function(_0x22da4e){if(_0x22da4e){var _0x33cc8d=typeof _0xb4df1c[_0xb52f('0x1b')]===_0xb52f('0x1c')&&typeof _0xb4df1c['limit']===_0xb52f('0x1c');var _0x3dfb76=_0x22da4e[_0xb52f('0x1d')];var _0x2755e3=_0x33cc8d?0x0:_0xb4df1c[_0xb52f('0x1b')];var _0x12ea19=_0x33cc8d?_0x22da4e[_0xb52f('0x1d')]:_0xb4df1c[_0xb52f('0x1b')]+_0xb4df1c['limit'];var _0x8d9eee;if(_0x12ea19>=_0x3dfb76){_0x12ea19=_0x3dfb76;_0x8d9eee=0xc8;}else{_0x8d9eee=0xce;}_0x516331[_0xb52f('0x19')](_0x8d9eee);return _0x516331[_0xb52f('0x1e')]('Content-Range',_0x2755e3+'-'+_0x12ea19+'/'+_0x3dfb76)[_0xb52f('0x1a')](_0x22da4e);}return null;};}function patchUpdates(_0x1e15d3){return function(_0x2efafb){try{jsonpatch[_0xb52f('0x1f')](_0x2efafb,_0x1e15d3,!![]);}catch(_0x35b36c){return BPromise[_0xb52f('0x20')](_0x35b36c);}return _0x2efafb[_0xb52f('0x21')]();};}function saveUpdates(_0x1470e6,_0xb13a0){return function(_0x2bf43f){if(_0x2bf43f){return _0x2bf43f[_0xb52f('0x22')](_0x1470e6)[_0xb52f('0x23')](function(_0x580094){return _0x580094;});}return null;};}function removeEntity(_0x5ac2e3,_0x103b2d){return function(_0x1b5500){if(_0x1b5500){return _0x1b5500[_0xb52f('0x24')]()[_0xb52f('0x23')](function(){_0x5ac2e3[_0xb52f('0x19')](0xcc)[_0xb52f('0x25')]();});}};}function handleEntityNotFound(_0x4594ee,_0x33e947){return function(_0x123e11){if(!_0x123e11){_0x4594ee[_0xb52f('0x18')](0x194);}return _0x123e11;};}function handleError(_0x42b28a,_0x4f05f5){_0x4f05f5=_0x4f05f5||0x1f4;return function(_0x373842){logger['error'](_0x373842['stack']);if(_0x373842[_0xb52f('0x26')]){delete _0x373842['name'];}_0x42b28a[_0xb52f('0x19')](_0x4f05f5)[_0xb52f('0x27')](_0x373842);};}exports[_0xb52f('0x28')]=function(_0x993833,_0xe48dee){var _0x1a299f={},_0x25467a={},_0x33f0f2={'count':0x0,'rows':[]};var _0x262d30=_[_0xb52f('0x29')](db[_0xb52f('0x2a')]['rawAttributes'],function(_0x371a5f){return{'name':_0x371a5f['fieldName'],'type':_0x371a5f[_0xb52f('0x2b')]['key']};});_0x25467a[_0xb52f('0x2c')]=_['map'](_0x262d30,_0xb52f('0x26'));_0x25467a[_0xb52f('0x2d')]=_['keys'](_0x993833[_0xb52f('0x2d')]);_0x25467a['filters']=_[_0xb52f('0x2e')](_0x25467a[_0xb52f('0x2c')],_0x25467a[_0xb52f('0x2d')]);_0x1a299f[_0xb52f('0x2f')]=_[_0xb52f('0x2e')](_0x25467a[_0xb52f('0x2c')],qs[_0xb52f('0x30')](_0x993833['query'][_0xb52f('0x30')]));_0x1a299f[_0xb52f('0x2f')]=_0x1a299f['attributes'][_0xb52f('0x31')]?_0x1a299f['attributes']:_0x25467a[_0xb52f('0x2c')];if(!_0x993833[_0xb52f('0x2d')][_0xb52f('0x32')](_0xb52f('0x33'))){_0x1a299f[_0xb52f('0x34')]=qs[_0xb52f('0x34')](_0x993833['query']['limit']);_0x1a299f['offset']=qs['offset'](_0x993833['query'][_0xb52f('0x1b')]);}_0x1a299f[_0xb52f('0x35')]=qs[_0xb52f('0x36')](_0x993833['query'][_0xb52f('0x36')]);_0x1a299f[_0xb52f('0x37')]=qs[_0xb52f('0x38')](_[_0xb52f('0x39')](_0x993833[_0xb52f('0x2d')],_0x25467a['filters']),_0x262d30);if(_0x993833[_0xb52f('0x2d')][_0xb52f('0x3a')]){_0x1a299f[_0xb52f('0x37')]=_[_0xb52f('0x3b')](_0x1a299f['where'],{'$or':_[_0xb52f('0x29')](_0x262d30,function(_0x1840c7){if(_0x1840c7['type']!==_0xb52f('0x3c')){var _0x32dbf1={};_0x32dbf1[_0x1840c7['name']]={'$like':'%'+_0x993833['query'][_0xb52f('0x3a')]+'%'};return _0x32dbf1;}})});}_0x1a299f=_['merge']({},_0x1a299f,_0x993833[_0xb52f('0x3d')]);var _0x58b762={'where':_0x1a299f[_0xb52f('0x37')]};return db['Automation'][_0xb52f('0x1d')](_0x58b762)['then'](function(_0x45a504){_0x33f0f2['count']=_0x45a504;if(_0x993833['query'][_0xb52f('0x3e')]){_0x1a299f['include']=[{'all':!![]}];}return db['Automation'][_0xb52f('0x3f')](_0x1a299f);})[_0xb52f('0x23')](function(_0x55d527){_0x33f0f2[_0xb52f('0x40')]=_0x55d527;return _0x33f0f2;})[_0xb52f('0x23')](respondWithFilteredResult(_0xe48dee,_0x1a299f))[_0xb52f('0x41')](handleError(_0xe48dee,null));};exports[_0xb52f('0x42')]=function(_0x223107,_0x325a3b){var _0x287067={'raw':![],'where':{'id':_0x223107['params']['id']}},_0x171b40={};_0x171b40[_0xb52f('0x2c')]=_[_0xb52f('0x43')](db[_0xb52f('0x2a')]['rawAttributes']);_0x171b40['query']=_[_0xb52f('0x43')](_0x223107[_0xb52f('0x2d')]);_0x171b40['filters']=_[_0xb52f('0x2e')](_0x171b40[_0xb52f('0x2c')],_0x171b40['query']);_0x287067[_0xb52f('0x2f')]=_[_0xb52f('0x2e')](_0x171b40[_0xb52f('0x2c')],qs[_0xb52f('0x30')](_0x223107[_0xb52f('0x2d')][_0xb52f('0x30')]));_0x287067[_0xb52f('0x2f')]=_0x287067[_0xb52f('0x2f')][_0xb52f('0x31')]?_0x287067[_0xb52f('0x2f')]:_0x171b40['model'];if(_0x223107[_0xb52f('0x2d')][_0xb52f('0x3e')]){_0x287067[_0xb52f('0x44')]=[{'all':!![]}];}_0x287067=_[_0xb52f('0x3b')]({},_0x287067,_0x223107[_0xb52f('0x3d')]);return db[_0xb52f('0x2a')][_0xb52f('0x45')](_0x287067)[_0xb52f('0x23')](handleEntityNotFound(_0x325a3b,null))[_0xb52f('0x23')](respondWithResult(_0x325a3b,null))[_0xb52f('0x41')](handleError(_0x325a3b,null));};exports[_0xb52f('0x46')]=function(_0xf96b24,_0x1f609d){return db[_0xb52f('0x2a')]['create'](_0xf96b24[_0xb52f('0x47')],{})[_0xb52f('0x23')](respondWithResult(_0x1f609d,0xc9))[_0xb52f('0x41')](handleError(_0x1f609d,null));};exports[_0xb52f('0x22')]=function(_0x50ff24,_0x53207e){if(_0x50ff24[_0xb52f('0x47')]['id']){delete _0x50ff24[_0xb52f('0x47')]['id'];}return db[_0xb52f('0x2a')][_0xb52f('0x45')]({'where':{'id':_0x50ff24[_0xb52f('0x48')]['id']}})['then'](handleEntityNotFound(_0x53207e,null))[_0xb52f('0x23')](saveUpdates(_0x50ff24[_0xb52f('0x47')],null))[_0xb52f('0x23')](respondWithResult(_0x53207e,null))[_0xb52f('0x41')](handleError(_0x53207e,null));};exports['destroy']=function(_0x21358c,_0x5c0dc4){return db[_0xb52f('0x2a')]['find']({'where':{'id':_0x21358c[_0xb52f('0x48')]['id']}})[_0xb52f('0x23')](handleEntityNotFound(_0x5c0dc4,null))[_0xb52f('0x23')](removeEntity(_0x5c0dc4,null))['catch'](handleError(_0x5c0dc4,null));};exports[_0xb52f('0x49')]=function(_0xea4c,_0x3d2190,_0x4d1f44){return db[_0xb52f('0x4a')][_0xb52f('0x45')]({'where':{'id':_0xea4c[_0xb52f('0x48')]['id']}})[_0xb52f('0x23')](handleEntityNotFound(_0x3d2190,null))['then'](function(_0x4e1780){if(_0x4e1780){return _0x4e1780[_0xb52f('0x49')](_0xea4c[_0xb52f('0x47')][_0xb52f('0x4b')],_[_0xb52f('0x4c')](_0xea4c[_0xb52f('0x47')],[_0xb52f('0x4b'),'id'])||{});}})[_0xb52f('0x23')](respondWithResult(_0x3d2190,null))[_0xb52f('0x41')](handleError(_0x3d2190,null));};exports[_0xb52f('0x4d')]=function(_0xd85fe4,_0x375fc6,_0x54ce4b){var _0x41abe2={};var _0x3c9c18={};var _0x4d053d;var _0x1e9a16;return db[_0xb52f('0x2a')][_0xb52f('0x4e')]({'where':{'id':_0xd85fe4[_0xb52f('0x48')]['id']}})[_0xb52f('0x23')](handleEntityNotFound(_0x375fc6,null))[_0xb52f('0x23')](function(_0x5c4580){if(_0x5c4580){_0x4d053d=_0x5c4580;_0x3c9c18['model']=_[_0xb52f('0x43')](db[_0xb52f('0x4a')]['rawAttributes']);_0x3c9c18[_0xb52f('0x2d')]=_[_0xb52f('0x43')](_0xd85fe4[_0xb52f('0x2d')]);_0x3c9c18[_0xb52f('0x38')]=_['intersection'](_0x3c9c18[_0xb52f('0x2c')],_0x3c9c18['query']);_0x41abe2[_0xb52f('0x2f')]=_[_0xb52f('0x2e')](_0x3c9c18[_0xb52f('0x2c')],qs[_0xb52f('0x30')](_0xd85fe4[_0xb52f('0x2d')][_0xb52f('0x30')]));_0x41abe2[_0xb52f('0x2f')]=_0x41abe2[_0xb52f('0x2f')][_0xb52f('0x31')]?_0x41abe2[_0xb52f('0x2f')]:_0x3c9c18[_0xb52f('0x2c')];_0x41abe2[_0xb52f('0x35')]=qs[_0xb52f('0x36')](_0xd85fe4[_0xb52f('0x2d')][_0xb52f('0x36')]);_0x41abe2['where']=qs['filters'](_['pick'](_0xd85fe4[_0xb52f('0x2d')],_0x3c9c18[_0xb52f('0x38')]));if(_0xd85fe4[_0xb52f('0x2d')][_0xb52f('0x3a')]){_0x41abe2[_0xb52f('0x37')]=_[_0xb52f('0x3b')](_0x41abe2[_0xb52f('0x37')],{'$or':_[_0xb52f('0x29')](_0x41abe2[_0xb52f('0x2f')],function(_0x1a3b7a){var _0x2cfdc1={};_0x2cfdc1[_0x1a3b7a]={'$like':'%'+_0xd85fe4['query'][_0xb52f('0x3a')]+'%'};return _0x2cfdc1;})});}_0x41abe2=_[_0xb52f('0x3b')]({},_0x41abe2,_0xd85fe4[_0xb52f('0x3d')]);return _0x4d053d[_0xb52f('0x4d')](_0x41abe2);}})[_0xb52f('0x23')](function(_0x26826e){if(_0x26826e){_0x1e9a16=_0x26826e[_0xb52f('0x31')];if(!_0xd85fe4['query'][_0xb52f('0x32')](_0xb52f('0x33'))){_0x41abe2[_0xb52f('0x34')]=qs['limit'](_0xd85fe4[_0xb52f('0x2d')]['limit']);_0x41abe2[_0xb52f('0x1b')]=qs[_0xb52f('0x1b')](_0xd85fe4['query'][_0xb52f('0x1b')]);}return _0x4d053d[_0xb52f('0x4d')](_0x41abe2);}})[_0xb52f('0x23')](function(_0x1b3f52){if(_0x1b3f52){return _0x1b3f52?{'count':_0x1e9a16,'rows':_0x1b3f52}:null;}})[_0xb52f('0x23')](respondWithResult(_0x375fc6,null))['catch'](handleError(_0x375fc6,null));};exports[_0xb52f('0x4f')]=function(_0xec0167,_0x3d598b,_0x395879){return db['Action'][_0xb52f('0x45')]({'where':{'id':_0xec0167['params']['id']}})[_0xb52f('0x23')](handleEntityNotFound(_0x3d598b,null))[_0xb52f('0x23')](function(_0x58f0c9){if(_0x58f0c9){return _0x58f0c9[_0xb52f('0x4f')](_0xec0167[_0xb52f('0x47')][_0xb52f('0x4b')],_[_0xb52f('0x4c')](_0xec0167[_0xb52f('0x47')],[_0xb52f('0x4b'),'id'])||{});}})[_0xb52f('0x23')](respondWithResult(_0x3d598b,null))[_0xb52f('0x41')](handleError(_0x3d598b,null));};exports[_0xb52f('0x50')]=function(_0x312db0,_0xbde5dd,_0x227ddd){var _0x128812={};var _0x422e3e={};var _0x32173f;var _0x19fa8b;return db[_0xb52f('0x2a')]['findOne']({'where':{'id':_0x312db0['params']['id']}})[_0xb52f('0x23')](handleEntityNotFound(_0xbde5dd,null))[_0xb52f('0x23')](function(_0x28f431){if(_0x28f431){_0x32173f=_0x28f431;_0x422e3e['model']=_[_0xb52f('0x43')](db[_0xb52f('0x51')][_0xb52f('0x52')]);_0x422e3e['query']=_[_0xb52f('0x43')](_0x312db0[_0xb52f('0x2d')]);_0x422e3e[_0xb52f('0x38')]=_[_0xb52f('0x2e')](_0x422e3e[_0xb52f('0x2c')],_0x422e3e[_0xb52f('0x2d')]);_0x128812['attributes']=_[_0xb52f('0x2e')](_0x422e3e['model'],qs[_0xb52f('0x30')](_0x312db0[_0xb52f('0x2d')][_0xb52f('0x30')]));_0x128812[_0xb52f('0x2f')]=_0x128812[_0xb52f('0x2f')][_0xb52f('0x31')]?_0x128812[_0xb52f('0x2f')]:_0x422e3e[_0xb52f('0x2c')];_0x128812[_0xb52f('0x35')]=qs['sort'](_0x312db0[_0xb52f('0x2d')]['sort']);_0x128812[_0xb52f('0x37')]=qs[_0xb52f('0x38')](_['pick'](_0x312db0[_0xb52f('0x2d')],_0x422e3e[_0xb52f('0x38')]));if(_0x312db0[_0xb52f('0x2d')][_0xb52f('0x3a')]){_0x128812[_0xb52f('0x37')]=_[_0xb52f('0x3b')](_0x128812[_0xb52f('0x37')],{'$or':_['map'](_0x128812[_0xb52f('0x2f')],function(_0x15b9d6){var _0x1d0d40={};_0x1d0d40[_0x15b9d6]={'$like':'%'+_0x312db0['query'][_0xb52f('0x3a')]+'%'};return _0x1d0d40;})});}_0x128812=_[_0xb52f('0x3b')]({},_0x128812,_0x312db0[_0xb52f('0x3d')]);return _0x32173f[_0xb52f('0x50')](_0x128812);}})[_0xb52f('0x23')](function(_0x545b3e){if(_0x545b3e){_0x19fa8b=_0x545b3e[_0xb52f('0x31')];if(!_0x312db0[_0xb52f('0x2d')][_0xb52f('0x32')]('nolimit')){_0x128812['limit']=qs[_0xb52f('0x34')](_0x312db0[_0xb52f('0x2d')][_0xb52f('0x34')]);_0x128812[_0xb52f('0x1b')]=qs['offset'](_0x312db0[_0xb52f('0x2d')][_0xb52f('0x1b')]);}return _0x32173f['getActions'](_0x128812);}})['then'](function(_0x51acaf){if(_0x51acaf){return _0x51acaf?{'count':_0x19fa8b,'rows':_0x51acaf}:null;}})[_0xb52f('0x23')](respondWithResult(_0xbde5dd,null))['catch'](handleError(_0xbde5dd,null));}; \ No newline at end of file +var _0xf612=['update','destroy','then','sendStatus','error','name','send','Automation','rawAttributes','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','params','length','includeAll','find','create','body','addConditions','Condition','omit','ids','getConditions','findOne','addActions','getActions','Action','nolimit','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','undefined','limit','count','set','Content-Range','reject','save'];(function(_0x4af9a0,_0x3b0ee0){var _0x2a6ece=function(_0x3e7629){while(--_0x3e7629){_0x4af9a0['push'](_0x4af9a0['shift']());}};_0x2a6ece(++_0x3b0ee0);}(_0xf612,0x83));var _0x2f61=function(_0x1334ce,_0x5c16ab){_0x1334ce=_0x1334ce-0x0;var _0x582912=_0xf612[_0x1334ce];return _0x582912;};'use strict';var emlformat=require(_0x2f61('0x0'));var rimraf=require(_0x2f61('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2f61('0x2'));var moment=require(_0x2f61('0x3'));var BPromise=require(_0x2f61('0x4'));var Mustache=require(_0x2f61('0x5'));var util=require('util');var path=require(_0x2f61('0x6'));var sox=require('sox');var csv=require(_0x2f61('0x7'));var ejs=require(_0x2f61('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2f61('0x9'));var squel=require(_0x2f61('0xa'));var crypto=require(_0x2f61('0xb'));var jsforce=require(_0x2f61('0xc'));var deskjs=require(_0x2f61('0xd'));var toCsv=require('to-csv');var querystring=require(_0x2f61('0xe'));var Papa=require(_0x2f61('0xf'));var Redis=require(_0x2f61('0x10'));var authService=require(_0x2f61('0x11'));var qs=require(_0x2f61('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2f61('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x2f61('0x14'));var config=require(_0x2f61('0x15'));var licenseUtil=require(_0x2f61('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xb9539e,_0x16df80){_0x16df80=_0x16df80||0xcc;return function(_0x5be134){if(_0x5be134){return _0xb9539e['sendStatus'](_0x16df80);}return _0xb9539e[_0x2f61('0x17')](_0x16df80)['end']();};}function respondWithResult(_0x3753a7,_0x559476){_0x559476=_0x559476||0xc8;return function(_0x5b745a){if(_0x5b745a){return _0x3753a7[_0x2f61('0x17')](_0x559476)[_0x2f61('0x18')](_0x5b745a);}};}function respondWithFilteredResult(_0x280d2b,_0x14c527){return function(_0x4cd456){if(_0x4cd456){var _0x4416ac=typeof _0x14c527[_0x2f61('0x19')]===_0x2f61('0x1a')&&typeof _0x14c527[_0x2f61('0x1b')]==='undefined';var _0x12d3e9=_0x4cd456[_0x2f61('0x1c')];var _0x589a99=_0x4416ac?0x0:_0x14c527['offset'];var _0x44073b=_0x4416ac?_0x4cd456[_0x2f61('0x1c')]:_0x14c527[_0x2f61('0x19')]+_0x14c527[_0x2f61('0x1b')];var _0x32ac22;if(_0x44073b>=_0x12d3e9){_0x44073b=_0x12d3e9;_0x32ac22=0xc8;}else{_0x32ac22=0xce;}_0x280d2b[_0x2f61('0x17')](_0x32ac22);return _0x280d2b[_0x2f61('0x1d')](_0x2f61('0x1e'),_0x589a99+'-'+_0x44073b+'/'+_0x12d3e9)[_0x2f61('0x18')](_0x4cd456);}return null;};}function patchUpdates(_0x5b0e3d){return function(_0x352393){try{jsonpatch['apply'](_0x352393,_0x5b0e3d,!![]);}catch(_0x19d904){return BPromise[_0x2f61('0x1f')](_0x19d904);}return _0x352393[_0x2f61('0x20')]();};}function saveUpdates(_0x3bdf7b,_0xdf75a6){return function(_0x4f21a6){if(_0x4f21a6){return _0x4f21a6[_0x2f61('0x21')](_0x3bdf7b)['then'](function(_0x24db36){return _0x24db36;});}return null;};}function removeEntity(_0x2aac66,_0x22ef25){return function(_0x595623){if(_0x595623){return _0x595623[_0x2f61('0x22')]()[_0x2f61('0x23')](function(){_0x2aac66[_0x2f61('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5abf1d,_0x57c170){return function(_0x14dd63){if(!_0x14dd63){_0x5abf1d[_0x2f61('0x24')](0x194);}return _0x14dd63;};}function handleError(_0x27273f,_0x190324){_0x190324=_0x190324||0x1f4;return function(_0x20289a){logger[_0x2f61('0x25')](_0x20289a['stack']);if(_0x20289a[_0x2f61('0x26')]){delete _0x20289a[_0x2f61('0x26')];}_0x27273f[_0x2f61('0x17')](_0x190324)[_0x2f61('0x27')](_0x20289a);};}exports['index']=function(_0x46ab64,_0x5358b0){var _0x4a114c={},_0x3a0a64={},_0x9e6381={'count':0x0,'rows':[]};var _0x118371=_['map'](db[_0x2f61('0x28')][_0x2f61('0x29')],function(_0x357a71){return{'name':_0x357a71[_0x2f61('0x2a')],'type':_0x357a71[_0x2f61('0x2b')][_0x2f61('0x2c')]};});_0x3a0a64[_0x2f61('0x2d')]=_[_0x2f61('0x2e')](_0x118371,_0x2f61('0x26'));_0x3a0a64['query']=_[_0x2f61('0x2f')](_0x46ab64['query']);_0x3a0a64[_0x2f61('0x30')]=_[_0x2f61('0x31')](_0x3a0a64[_0x2f61('0x2d')],_0x3a0a64[_0x2f61('0x32')]);_0x4a114c[_0x2f61('0x33')]=_[_0x2f61('0x31')](_0x3a0a64[_0x2f61('0x2d')],qs['fields'](_0x46ab64[_0x2f61('0x32')][_0x2f61('0x34')]));_0x4a114c['attributes']=_0x4a114c[_0x2f61('0x33')]['length']?_0x4a114c['attributes']:_0x3a0a64[_0x2f61('0x2d')];if(!_0x46ab64[_0x2f61('0x32')][_0x2f61('0x35')]('nolimit')){_0x4a114c[_0x2f61('0x1b')]=qs[_0x2f61('0x1b')](_0x46ab64[_0x2f61('0x32')][_0x2f61('0x1b')]);_0x4a114c['offset']=qs['offset'](_0x46ab64[_0x2f61('0x32')][_0x2f61('0x19')]);}_0x4a114c[_0x2f61('0x36')]=qs[_0x2f61('0x37')](_0x46ab64[_0x2f61('0x32')][_0x2f61('0x37')]);_0x4a114c[_0x2f61('0x38')]=qs[_0x2f61('0x30')](_[_0x2f61('0x39')](_0x46ab64[_0x2f61('0x32')],_0x3a0a64[_0x2f61('0x30')]),_0x118371);if(_0x46ab64[_0x2f61('0x32')][_0x2f61('0x3a')]){_0x4a114c[_0x2f61('0x38')]=_[_0x2f61('0x3b')](_0x4a114c[_0x2f61('0x38')],{'$or':_[_0x2f61('0x2e')](_0x118371,function(_0x32a91f){if(_0x32a91f[_0x2f61('0x2b')]!==_0x2f61('0x3c')){var _0x44c9f3={};_0x44c9f3[_0x32a91f['name']]={'$like':'%'+_0x46ab64[_0x2f61('0x32')]['filter']+'%'};return _0x44c9f3;}})});}_0x4a114c=_[_0x2f61('0x3b')]({},_0x4a114c,_0x46ab64[_0x2f61('0x3d')]);var _0x97f9e={'where':_0x4a114c['where']};return db['Automation']['count'](_0x97f9e)[_0x2f61('0x23')](function(_0x584beb){_0x9e6381[_0x2f61('0x1c')]=_0x584beb;if(_0x46ab64['query']['includeAll']){_0x4a114c[_0x2f61('0x3e')]=[{'all':!![]}];}return db['Automation'][_0x2f61('0x3f')](_0x4a114c);})['then'](function(_0x2b7ce6){_0x9e6381[_0x2f61('0x40')]=_0x2b7ce6;return _0x9e6381;})[_0x2f61('0x23')](respondWithFilteredResult(_0x5358b0,_0x4a114c))[_0x2f61('0x41')](handleError(_0x5358b0,null));};exports['show']=function(_0x5ba2ad,_0x531900){var _0x43bec3={'raw':![],'where':{'id':_0x5ba2ad[_0x2f61('0x42')]['id']}},_0x4760a5={};_0x4760a5[_0x2f61('0x2d')]=_[_0x2f61('0x2f')](db['Automation'][_0x2f61('0x29')]);_0x4760a5[_0x2f61('0x32')]=_[_0x2f61('0x2f')](_0x5ba2ad[_0x2f61('0x32')]);_0x4760a5[_0x2f61('0x30')]=_['intersection'](_0x4760a5['model'],_0x4760a5['query']);_0x43bec3[_0x2f61('0x33')]=_['intersection'](_0x4760a5[_0x2f61('0x2d')],qs[_0x2f61('0x34')](_0x5ba2ad[_0x2f61('0x32')][_0x2f61('0x34')]));_0x43bec3['attributes']=_0x43bec3[_0x2f61('0x33')][_0x2f61('0x43')]?_0x43bec3['attributes']:_0x4760a5[_0x2f61('0x2d')];if(_0x5ba2ad[_0x2f61('0x32')][_0x2f61('0x44')]){_0x43bec3[_0x2f61('0x3e')]=[{'all':!![]}];}_0x43bec3=_[_0x2f61('0x3b')]({},_0x43bec3,_0x5ba2ad[_0x2f61('0x3d')]);return db[_0x2f61('0x28')][_0x2f61('0x45')](_0x43bec3)[_0x2f61('0x23')](handleEntityNotFound(_0x531900,null))[_0x2f61('0x23')](respondWithResult(_0x531900,null))[_0x2f61('0x41')](handleError(_0x531900,null));};exports[_0x2f61('0x46')]=function(_0x2e6d45,_0xb819f8){return db[_0x2f61('0x28')][_0x2f61('0x46')](_0x2e6d45[_0x2f61('0x47')],{})[_0x2f61('0x23')](respondWithResult(_0xb819f8,0xc9))[_0x2f61('0x41')](handleError(_0xb819f8,null));};exports[_0x2f61('0x21')]=function(_0x18c789,_0x58ac34){if(_0x18c789[_0x2f61('0x47')]['id']){delete _0x18c789[_0x2f61('0x47')]['id'];}return db[_0x2f61('0x28')][_0x2f61('0x45')]({'where':{'id':_0x18c789['params']['id']}})[_0x2f61('0x23')](handleEntityNotFound(_0x58ac34,null))[_0x2f61('0x23')](saveUpdates(_0x18c789[_0x2f61('0x47')],null))['then'](respondWithResult(_0x58ac34,null))[_0x2f61('0x41')](handleError(_0x58ac34,null));};exports['destroy']=function(_0x2a48ae,_0x29b413){return db[_0x2f61('0x28')][_0x2f61('0x45')]({'where':{'id':_0x2a48ae[_0x2f61('0x42')]['id']}})[_0x2f61('0x23')](handleEntityNotFound(_0x29b413,null))['then'](removeEntity(_0x29b413,null))[_0x2f61('0x41')](handleError(_0x29b413,null));};exports[_0x2f61('0x48')]=function(_0x204e8a,_0x310fef,_0x300553){return db[_0x2f61('0x49')][_0x2f61('0x45')]({'where':{'id':_0x204e8a[_0x2f61('0x42')]['id']}})['then'](handleEntityNotFound(_0x310fef,null))[_0x2f61('0x23')](function(_0x188394){if(_0x188394){return _0x188394['addConditions'](_0x204e8a[_0x2f61('0x47')]['ids'],_[_0x2f61('0x4a')](_0x204e8a[_0x2f61('0x47')],[_0x2f61('0x4b'),'id'])||{});}})[_0x2f61('0x23')](respondWithResult(_0x310fef,null))[_0x2f61('0x41')](handleError(_0x310fef,null));};exports[_0x2f61('0x4c')]=function(_0x5b53e4,_0x33a622,_0x4c61e4){var _0x47274a={};var _0x19fa9a={};var _0xee0d83;var _0x22f33c;return db[_0x2f61('0x28')][_0x2f61('0x4d')]({'where':{'id':_0x5b53e4[_0x2f61('0x42')]['id']}})['then'](handleEntityNotFound(_0x33a622,null))[_0x2f61('0x23')](function(_0x5f2d65){if(_0x5f2d65){_0xee0d83=_0x5f2d65;_0x19fa9a[_0x2f61('0x2d')]=_[_0x2f61('0x2f')](db[_0x2f61('0x49')][_0x2f61('0x29')]);_0x19fa9a[_0x2f61('0x32')]=_['keys'](_0x5b53e4[_0x2f61('0x32')]);_0x19fa9a[_0x2f61('0x30')]=_['intersection'](_0x19fa9a[_0x2f61('0x2d')],_0x19fa9a[_0x2f61('0x32')]);_0x47274a[_0x2f61('0x33')]=_[_0x2f61('0x31')](_0x19fa9a[_0x2f61('0x2d')],qs[_0x2f61('0x34')](_0x5b53e4[_0x2f61('0x32')][_0x2f61('0x34')]));_0x47274a[_0x2f61('0x33')]=_0x47274a[_0x2f61('0x33')][_0x2f61('0x43')]?_0x47274a[_0x2f61('0x33')]:_0x19fa9a[_0x2f61('0x2d')];_0x47274a[_0x2f61('0x36')]=qs[_0x2f61('0x37')](_0x5b53e4['query'][_0x2f61('0x37')]);_0x47274a[_0x2f61('0x38')]=qs[_0x2f61('0x30')](_[_0x2f61('0x39')](_0x5b53e4[_0x2f61('0x32')],_0x19fa9a['filters']));if(_0x5b53e4['query'][_0x2f61('0x3a')]){_0x47274a[_0x2f61('0x38')]=_[_0x2f61('0x3b')](_0x47274a[_0x2f61('0x38')],{'$or':_[_0x2f61('0x2e')](_0x47274a[_0x2f61('0x33')],function(_0x1543c5){var _0x2f0959={};_0x2f0959[_0x1543c5]={'$like':'%'+_0x5b53e4[_0x2f61('0x32')][_0x2f61('0x3a')]+'%'};return _0x2f0959;})});}_0x47274a=_['merge']({},_0x47274a,_0x5b53e4[_0x2f61('0x3d')]);return _0xee0d83[_0x2f61('0x4c')](_0x47274a);}})[_0x2f61('0x23')](function(_0x460e7e){if(_0x460e7e){_0x22f33c=_0x460e7e[_0x2f61('0x43')];if(!_0x5b53e4[_0x2f61('0x32')]['hasOwnProperty']('nolimit')){_0x47274a['limit']=qs[_0x2f61('0x1b')](_0x5b53e4[_0x2f61('0x32')][_0x2f61('0x1b')]);_0x47274a[_0x2f61('0x19')]=qs[_0x2f61('0x19')](_0x5b53e4[_0x2f61('0x32')][_0x2f61('0x19')]);}return _0xee0d83[_0x2f61('0x4c')](_0x47274a);}})['then'](function(_0x2ffa8a){if(_0x2ffa8a){return _0x2ffa8a?{'count':_0x22f33c,'rows':_0x2ffa8a}:null;}})[_0x2f61('0x23')](respondWithResult(_0x33a622,null))['catch'](handleError(_0x33a622,null));};exports[_0x2f61('0x4e')]=function(_0x954303,_0x52f18b,_0x3a3cd5){return db['Action'][_0x2f61('0x45')]({'where':{'id':_0x954303[_0x2f61('0x42')]['id']}})[_0x2f61('0x23')](handleEntityNotFound(_0x52f18b,null))[_0x2f61('0x23')](function(_0x540fad){if(_0x540fad){return _0x540fad[_0x2f61('0x4e')](_0x954303[_0x2f61('0x47')][_0x2f61('0x4b')],_[_0x2f61('0x4a')](_0x954303['body'],[_0x2f61('0x4b'),'id'])||{});}})[_0x2f61('0x23')](respondWithResult(_0x52f18b,null))['catch'](handleError(_0x52f18b,null));};exports[_0x2f61('0x4f')]=function(_0x1c90ad,_0x44c8b0,_0x22fe08){var _0x3accc5={};var _0x3d0ff4={};var _0x553b8f;var _0x5e508d;return db['Automation'][_0x2f61('0x4d')]({'where':{'id':_0x1c90ad['params']['id']}})[_0x2f61('0x23')](handleEntityNotFound(_0x44c8b0,null))[_0x2f61('0x23')](function(_0x54f988){if(_0x54f988){_0x553b8f=_0x54f988;_0x3d0ff4[_0x2f61('0x2d')]=_[_0x2f61('0x2f')](db[_0x2f61('0x50')][_0x2f61('0x29')]);_0x3d0ff4[_0x2f61('0x32')]=_[_0x2f61('0x2f')](_0x1c90ad[_0x2f61('0x32')]);_0x3d0ff4[_0x2f61('0x30')]=_['intersection'](_0x3d0ff4['model'],_0x3d0ff4[_0x2f61('0x32')]);_0x3accc5[_0x2f61('0x33')]=_[_0x2f61('0x31')](_0x3d0ff4['model'],qs[_0x2f61('0x34')](_0x1c90ad[_0x2f61('0x32')][_0x2f61('0x34')]));_0x3accc5[_0x2f61('0x33')]=_0x3accc5[_0x2f61('0x33')]['length']?_0x3accc5[_0x2f61('0x33')]:_0x3d0ff4[_0x2f61('0x2d')];_0x3accc5[_0x2f61('0x36')]=qs[_0x2f61('0x37')](_0x1c90ad[_0x2f61('0x32')]['sort']);_0x3accc5[_0x2f61('0x38')]=qs[_0x2f61('0x30')](_[_0x2f61('0x39')](_0x1c90ad[_0x2f61('0x32')],_0x3d0ff4[_0x2f61('0x30')]));if(_0x1c90ad[_0x2f61('0x32')][_0x2f61('0x3a')]){_0x3accc5[_0x2f61('0x38')]=_[_0x2f61('0x3b')](_0x3accc5[_0x2f61('0x38')],{'$or':_[_0x2f61('0x2e')](_0x3accc5['attributes'],function(_0x1fa810){var _0x1fd4af={};_0x1fd4af[_0x1fa810]={'$like':'%'+_0x1c90ad[_0x2f61('0x32')]['filter']+'%'};return _0x1fd4af;})});}_0x3accc5=_['merge']({},_0x3accc5,_0x1c90ad[_0x2f61('0x3d')]);return _0x553b8f[_0x2f61('0x4f')](_0x3accc5);}})['then'](function(_0x1c35b7){if(_0x1c35b7){_0x5e508d=_0x1c35b7[_0x2f61('0x43')];if(!_0x1c90ad['query']['hasOwnProperty'](_0x2f61('0x51'))){_0x3accc5[_0x2f61('0x1b')]=qs['limit'](_0x1c90ad[_0x2f61('0x32')]['limit']);_0x3accc5[_0x2f61('0x19')]=qs[_0x2f61('0x19')](_0x1c90ad['query'][_0x2f61('0x19')]);}return _0x553b8f['getActions'](_0x3accc5);}})[_0x2f61('0x23')](function(_0x59b354){if(_0x59b354){return _0x59b354?{'count':_0x5e508d,'rows':_0x59b354}:null;}})[_0x2f61('0x23')](respondWithResult(_0x44c8b0,null))['catch'](handleError(_0x44c8b0,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 2b2f072..b46135a 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 _0x039a=['lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','Automation','tools_automations'];(function(_0x4e8286,_0x4eaeb4){var _0x44a440=function(_0x5e0907){while(--_0x5e0907){_0x4e8286['push'](_0x4e8286['shift']());}};_0x44a440(++_0x4eaeb4);}(_0x039a,0x1bc));var _0xa039=function(_0x3073b1,_0x349ef5){_0x3073b1=_0x3073b1-0x0;var _0x58d884=_0x039a[_0x3073b1];return _0x58d884;};'use strict';var _=require(_0xa039('0x0'));var util=require(_0xa039('0x1'));var logger=require('../../config/logger')(_0xa039('0x2'));var moment=require(_0xa039('0x3'));var BPromise=require(_0xa039('0x4'));var rp=require(_0xa039('0x5'));var fs=require('fs');var path=require(_0xa039('0x6'));var rimraf=require('rimraf');var config=require(_0xa039('0x7'));var attributes=require('./automation.attributes');module[_0xa039('0x8')]=function(_0x1f2ab5,_0x55641c){return _0x1f2ab5[_0xa039('0x9')](_0xa039('0xa'),attributes,{'tableName':_0xa039('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6377=['path','rimraf','./automation.attributes','exports','define','Automation','tools_automations','lodash','util','../../config/logger','api','request-promise'];(function(_0x290cea,_0x56e739){var _0x3fea33=function(_0x5d0fa6){while(--_0x5d0fa6){_0x290cea['push'](_0x290cea['shift']());}};_0x3fea33(++_0x56e739);}(_0x6377,0xa3));var _0x7637=function(_0x50ac92,_0x11c4c8){_0x50ac92=_0x50ac92-0x0;var _0x28c342=_0x6377[_0x50ac92];return _0x28c342;};'use strict';var _=require(_0x7637('0x0'));var util=require(_0x7637('0x1'));var logger=require(_0x7637('0x2'))(_0x7637('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7637('0x4'));var fs=require('fs');var path=require(_0x7637('0x5'));var rimraf=require(_0x7637('0x6'));var config=require('../../config/environment');var attributes=require(_0x7637('0x7'));module[_0x7637('0x8')]=function(_0x3eaa55,_0x3db943){return _0x3eaa55[_0x7637('0x9')](_0x7637('0xa'),attributes,{'tableName':_0x7637('0xb'),'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 6d50a27..10c46bf 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 _0xa5dd=['request','then','request\x20sent','stringify','error','code','message','Automation,\x20%s,\x20%s','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x405632,_0x4a20ff){var _0x6f30d5=function(_0x215301){while(--_0x215301){_0x405632['push'](_0x405632['shift']());}};_0x6f30d5(++_0x4a20ff);}(_0xa5dd,0x101));var _0xda5d=function(_0x4ae5dd,_0x5543e1){_0x4ae5dd=_0x4ae5dd-0x0;var _0x1d215d=_0xa5dd[_0x4ae5dd];return _0x1d215d;};'use strict';var _=require(_0xda5d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xda5d('0x1'));var rs=require(_0xda5d('0x2'));var fs=require('fs');var Redis=require(_0xda5d('0x3'));var db=require(_0xda5d('0x4'))['db'];var utils=require(_0xda5d('0x5'));var logger=require('../../config/logger')(_0xda5d('0x6'));var config=require(_0xda5d('0x7'));var jayson=require(_0xda5d('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x461283,_0x91cf4e,_0x432097){return new BPromise(function(_0x402aa8,_0x1c1e2d){return client[_0xda5d('0x9')](_0x461283,_0x432097)[_0xda5d('0xa')](function(_0x3d5c69){logger['info']('Automation,\x20%s,\x20%s',_0x91cf4e,_0xda5d('0xb'));logger['debug']('Automation,\x20%s,\x20%s,\x20%s',_0x91cf4e,_0xda5d('0xb'),JSON[_0xda5d('0xc')](_0x3d5c69));if(_0x3d5c69['error']){if(_0x3d5c69[_0xda5d('0xd')][_0xda5d('0xe')]===0x1f4){logger[_0xda5d('0xd')]('Automation,\x20%s,\x20%s',_0x91cf4e,_0x3d5c69['error'][_0xda5d('0xf')]);return _0x1c1e2d(_0x3d5c69[_0xda5d('0xd')][_0xda5d('0xf')]);}logger[_0xda5d('0xd')](_0xda5d('0x10'),_0x91cf4e,_0x3d5c69[_0xda5d('0xd')][_0xda5d('0xf')]);return _0x402aa8(_0x3d5c69['error']['message']);}else{logger['info']('Automation,\x20%s,\x20%s',_0x91cf4e,'request\x20sent');_0x402aa8(_0x3d5c69[_0xda5d('0x11')][_0xda5d('0xf')]);}})[_0xda5d('0x12')](function(_0x388f40){logger[_0xda5d('0xd')](_0xda5d('0x10'),_0x91cf4e,_0x388f40);_0x1c1e2d(_0x388f40);});});} \ No newline at end of file +var _0xb03e=['debug','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','Automation,\x20%s,\x20%s'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb03e,0x1eb));var _0xeb03=function(_0x4cb70f,_0x4aef14){_0x4cb70f=_0x4cb70f-0x0;var _0xf1e5be=_0xb03e[_0x4cb70f];return _0xf1e5be;};'use strict';var _=require('lodash');var util=require(_0xeb03('0x0'));var moment=require(_0xeb03('0x1'));var BPromise=require(_0xeb03('0x2'));var rs=require(_0xeb03('0x3'));var fs=require('fs');var Redis=require(_0xeb03('0x4'));var db=require(_0xeb03('0x5'))['db'];var utils=require(_0xeb03('0x6'));var logger=require(_0xeb03('0x7'))(_0xeb03('0x8'));var config=require(_0xeb03('0x9'));var jayson=require(_0xeb03('0xa'));var client=jayson[_0xeb03('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b58a2,_0x3d3322,_0x3a6e31){return new BPromise(function(_0x246c6e,_0x3f2c74){return client[_0xeb03('0xc')](_0x3b58a2,_0x3a6e31)['then'](function(_0x403b77){logger[_0xeb03('0xd')](_0xeb03('0xe'),_0x3d3322,'request\x20sent');logger[_0xeb03('0xf')]('Automation,\x20%s,\x20%s,\x20%s',_0x3d3322,_0xeb03('0x10'),JSON[_0xeb03('0x11')](_0x403b77));if(_0x403b77[_0xeb03('0x12')]){if(_0x403b77[_0xeb03('0x12')][_0xeb03('0x13')]===0x1f4){logger[_0xeb03('0x12')](_0xeb03('0xe'),_0x3d3322,_0x403b77[_0xeb03('0x12')][_0xeb03('0x14')]);return _0x3f2c74(_0x403b77[_0xeb03('0x12')][_0xeb03('0x14')]);}logger[_0xeb03('0x12')]('Automation,\x20%s,\x20%s',_0x3d3322,_0x403b77[_0xeb03('0x12')][_0xeb03('0x14')]);return _0x246c6e(_0x403b77[_0xeb03('0x12')][_0xeb03('0x14')]);}else{logger['info'](_0xeb03('0xe'),_0x3d3322,_0xeb03('0x10'));_0x246c6e(_0x403b77[_0xeb03('0x15')]['message']);}})[_0xeb03('0x16')](function(_0x46dd1b){logger[_0xeb03('0x12')](_0xeb03('0xe'),_0x3d3322,_0x46dd1b);_0x3f2c74(_0x46dd1b);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 22f5d02..0c05b37 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 _0xba2d=['update','delete','destroy','util','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','index','/:id/conditions','getConditions','/:id/actions','getActions','post','addConditions','addActions','put','/:id'];(function(_0x58e8fc,_0x5afae5){var _0x4ebec7=function(_0x13159c){while(--_0x13159c){_0x58e8fc['push'](_0x58e8fc['shift']());}};_0x4ebec7(++_0x5afae5);}(_0xba2d,0xa3));var _0xdba2=function(_0x5bdad7,_0x231d70){_0x5bdad7=_0x5bdad7-0x0;var _0x35fb88=_0xba2d[_0x5bdad7];return _0x35fb88;};'use strict';var multer=require('multer');var util=require(_0xdba2('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xdba2('0x1'));var interaction=require(_0xdba2('0x2'));var config=require(_0xdba2('0x3'));var controller=require(_0xdba2('0x4'));router[_0xdba2('0x5')]('/',auth[_0xdba2('0x6')](),controller[_0xdba2('0x7')]);router[_0xdba2('0x5')]('/:id',auth[_0xdba2('0x6')](),controller['show']);router[_0xdba2('0x5')](_0xdba2('0x8'),auth[_0xdba2('0x6')](),controller[_0xdba2('0x9')]);router[_0xdba2('0x5')](_0xdba2('0xa'),auth['isAuthenticated'](),controller[_0xdba2('0xb')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xdba2('0xc')](_0xdba2('0x8'),auth[_0xdba2('0x6')](),controller[_0xdba2('0xd')]);router[_0xdba2('0xc')](_0xdba2('0xa'),auth[_0xdba2('0x6')](),controller[_0xdba2('0xe')]);router[_0xdba2('0xf')](_0xdba2('0x10'),auth[_0xdba2('0x6')](),controller[_0xdba2('0x11')]);router[_0xdba2('0x12')](_0xdba2('0x10'),auth[_0xdba2('0x6')](),controller[_0xdba2('0x13')]);module['exports']=router; \ No newline at end of file +var _0x0d6a=['./automation.controller','get','isAuthenticated','/:id','show','post','create','/:id/conditions','/:id/actions','put','update','delete','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x460dae,_0x3a907f){var _0x36e6d0=function(_0x447057){while(--_0x447057){_0x460dae['push'](_0x460dae['shift']());}};_0x36e6d0(++_0x3a907f);}(_0x0d6a,0xc9));var _0xa0d6=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x0d6a[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require(_0xa0d6('0x0'));var util=require(_0xa0d6('0x1'));var path=require('path');var timeout=require(_0xa0d6('0x2'));var express=require(_0xa0d6('0x3'));var router=express[_0xa0d6('0x4')]();var fs_extra=require(_0xa0d6('0x5'));var auth=require(_0xa0d6('0x6'));var interaction=require(_0xa0d6('0x7'));var config=require(_0xa0d6('0x8'));var controller=require(_0xa0d6('0x9'));router[_0xa0d6('0xa')]('/',auth[_0xa0d6('0xb')](),controller['index']);router[_0xa0d6('0xa')](_0xa0d6('0xc'),auth[_0xa0d6('0xb')](),controller[_0xa0d6('0xd')]);router[_0xa0d6('0xa')]('/:id/conditions',auth[_0xa0d6('0xb')](),controller['getConditions']);router[_0xa0d6('0xa')]('/:id/actions',auth[_0xa0d6('0xb')](),controller['getActions']);router[_0xa0d6('0xe')]('/',auth[_0xa0d6('0xb')](),controller[_0xa0d6('0xf')]);router[_0xa0d6('0xe')](_0xa0d6('0x10'),auth[_0xa0d6('0xb')](),controller['addConditions']);router[_0xa0d6('0xe')](_0xa0d6('0x11'),auth[_0xa0d6('0xb')](),controller['addActions']);router[_0xa0d6('0x12')](_0xa0d6('0xc'),auth[_0xa0d6('0xb')](),controller[_0xa0d6('0x13')]);router[_0xa0d6('0x14')](_0xa0d6('0xc'),auth[_0xa0d6('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index df24cc9..1c63038 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 _0x0249=['ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','sequelize','exports','STRING','ENUM','ivr','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','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,*,*,*','never','onlyIfOpen','BOOLEAN','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC'];(function(_0x2e29b9,_0x443f78){var _0x32424d=function(_0x333023){while(--_0x333023){_0x2e29b9['push'](_0x2e29b9['shift']());}};_0x32424d(++_0x443f78);}(_0x0249,0x86));var _0x9024=function(_0x2fce6d,_0x4896ed){_0x2fce6d=_0x2fce6d-0x0;var _0x563d42=_0x0249[_0x2fce6d];return _0x563d42;};'use strict';var Sequelize=require(_0x9024('0x0'));module[_0x9024('0x1')]={'name':{'type':Sequelize[_0x9024('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x9024('0x3')](_0x9024('0x4')),'allowNull':![],'defaultValue':_0x9024('0x4')},'description':{'type':Sequelize[_0x9024('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x9024('0x5')},'limitCalls':{'type':Sequelize[_0x9024('0x6')](0x4)[_0x9024('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x9024('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x9024('0x6')](0x3)[_0x9024('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9024('0x8')},'dialCongestionMaxRetry':{'type':Sequelize[_0x9024('0x6')](0x3)[_0x9024('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9024('0x9')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x9024('0x6')](0x5)[_0x9024('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9024('0xa')},'dialBusyMaxRetry':{'type':Sequelize[_0x9024('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9024('0xb')},'dialBusyRetryFrequency':{'type':Sequelize[_0x9024('0x6')](0x5)[_0x9024('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9024('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x9024('0x7')],'defaultValue':0x3,'comment':_0x9024('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x9024('0x6')](0x5)[_0x9024('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9024('0xe')},'dialGlobalMaxRetry':{'type':Sequelize[_0x9024('0x6')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x9024('0xf')},'dialTimezone':{'type':Sequelize[_0x9024('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x9024('0x2')],'defaultValue':_0x9024('0x10')},'dialCheckDuplicateType':{'type':Sequelize[_0x9024('0x3')]('always',_0x9024('0x11'),_0x9024('0x12')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x9024('0x13')],'defaultValue':0x0,'comment':_0x9024('0x14')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x9024('0x15')},'dialAMDGreeting':{'type':Sequelize[_0x9024('0x6')](0x9)[_0x9024('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x9024('0x16')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x9024('0x6')](0x9)[_0x9024('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x9024('0x17')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x9024('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x9024('0x6')](0x9)[_0x9024('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x9024('0x18')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x9024('0x6')](0x9)[_0x9024('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x9024('0x19')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x9024('0x6')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x9024('0x1a')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x9024('0x6')](0x5)[_0x9024('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x9024('0x1b')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x9024('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x9024('0x1c')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0x9024('0x1d'),_0x9024('0x1e')),'defaultValue':_0x9024('0x1d')},'dialPrefix':{'type':Sequelize[_0x9024('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x9024('0x6')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x9024('0x1f')},'dialCutDigit':{'type':Sequelize[_0x9024('0x6')](0x3)[_0x9024('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x9024('0x6')](0x3)[_0x9024('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9024('0x20')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x9024('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9024('0x21')},'dialDropMaxRetry':{'type':Sequelize[_0x9024('0x6')](0x3)[_0x9024('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9024('0x22')},'dialDropRetryFrequency':{'type':Sequelize[_0x9024('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9024('0x23')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x9024('0x6')](0x3)[_0x9024('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9024('0x24')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x9024('0x6')](0x5)[_0x9024('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9024('0x25')},'dialMachineMaxRetry':{'type':Sequelize[_0x9024('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9024('0x26')},'dialMachineRetryFrequency':{'type':Sequelize[_0x9024('0x6')](0x5)[_0x9024('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9024('0x27')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x9024('0x6')](0x3)[_0x9024('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9024('0x28')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x9024('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'}}; \ No newline at end of file +var _0x209e=['Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','BOOLEAN','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','DESC','ASC','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','exports','STRING','ivr'];(function(_0x20e80d,_0x56e90c){var _0x54e09e=function(_0x3cbabd){while(--_0x3cbabd){_0x20e80d['push'](_0x20e80d['shift']());}};_0x54e09e(++_0x56e90c);}(_0x209e,0x89));var _0xe209=function(_0x20c4a4,_0xe3867a){_0x20c4a4=_0x20c4a4-0x0;var _0x152499=_0x209e[_0x20c4a4];return _0x152499;};'use strict';var Sequelize=require('sequelize');module[_0xe209('0x0')]={'name':{'type':Sequelize[_0xe209('0x1')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM']('ivr'),'allowNull':![],'defaultValue':_0xe209('0x2')},'description':{'type':Sequelize[_0xe209('0x1')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xe209('0x3')},'limitCalls':{'type':Sequelize[_0xe209('0x4')](0x4)[_0xe209('0x5')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xe209('0x6')},'dialOriginateCallerIdName':{'type':Sequelize[_0xe209('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0xe209('0x4')](0x3)[_0xe209('0x5')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe209('0x7')},'dialCongestionMaxRetry':{'type':Sequelize[_0xe209('0x4')](0x3)[_0xe209('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0xe209('0x4')](0x5)[_0xe209('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xe209('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe209('0x8')},'dialBusyRetryFrequency':{'type':Sequelize[_0xe209('0x4')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe209('0x9')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xe209('0x4')](0x3)[_0xe209('0x5')],'defaultValue':0x3,'comment':_0xe209('0xa')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xe209('0x4')](0x5)[_0xe209('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe209('0xb')},'dialGlobalMaxRetry':{'type':Sequelize[_0xe209('0x4')](0x3)[_0xe209('0x5')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xe209('0xc')},'dialTimezone':{'type':Sequelize[_0xe209('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xe209('0x1')],'defaultValue':_0xe209('0xd')},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0xe209('0xe'),_0xe209('0xf'),_0xe209('0x10')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0xe209('0x11')],'defaultValue':0x0,'comment':_0xe209('0x12')},'dialAMDInitialSilence':{'type':Sequelize[_0xe209('0x4')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0xe209('0x4')](0x9)[_0xe209('0x5')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xe209('0x13')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0xe209('0x5')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xe209('0x14')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xe209('0x4')](0x9)[_0xe209('0x5')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xe209('0x15')},'dialAMDMinWordLength':{'type':Sequelize[_0xe209('0x4')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xe209('0x16')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0xe209('0x5')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xe209('0x17')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0xe209('0x5')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0xe209('0x4')](0x5)[_0xe209('0x5')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xe209('0x18')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xe209('0x4')](0x9)[_0xe209('0x5')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0xe209('0x19'),_0xe209('0x1a')),'defaultValue':_0xe209('0x19')},'dialPrefix':{'type':Sequelize[_0xe209('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xe209('0x4')](0x3)[_0xe209('0x5')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0xe209('0x4')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xe209('0x1b')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xe209('0x4')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe209('0x1c')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xe209('0x4')](0x5)[_0xe209('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe209('0x1d')},'dialDropMaxRetry':{'type':Sequelize[_0xe209('0x4')](0x3)[_0xe209('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe209('0x1e')},'dialDropRetryFrequency':{'type':Sequelize[_0xe209('0x4')](0x5)[_0xe209('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe209('0x1f')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xe209('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0xe209('0x4')](0x3)[_0xe209('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe209('0x20')},'dialMachineRetryFrequency':{'type':Sequelize[_0xe209('0x4')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe209('0x21')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xe209('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe209('0x22')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xe209('0x4')](0x5)[_0xe209('0x5')],'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 c2499dc..bd338ab 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 _0x084a=['filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','Campaign','findAll','rows','catch','rawAttributes','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','updatedAt','body','createdAt','getHoppers','CmHopper','CampaignId','getHopperHistories','findOne','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','always','into','cm_hopper','fromQuery','phone','ContactId','ListId','select','field','NOW()','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','insert','scheduledAt','ListId\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','IvrCampaigns','UserProfileResource','end','error','stack','name','send','index','map','fieldName','type','key','model','keys','query'];(function(_0x5849ff,_0x535d62){var _0xde61a2=function(_0x399749){while(--_0x399749){_0x5849ff['push'](_0x5849ff['shift']());}};_0xde61a2(++_0x535d62);}(_0x084a,0xde));var _0xa084=function(_0x35069b,_0x30f989){_0x35069b=_0x35069b-0x0;var _0x4ead49=_0x084a[_0x35069b];return _0x4ead49;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa084('0x0'));var jsonpatch=require(_0xa084('0x1'));var rp=require(_0xa084('0x2'));var moment=require('moment');var BPromise=require(_0xa084('0x3'));var Mustache=require(_0xa084('0x4'));var util=require('util');var path=require(_0xa084('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa084('0x6'));var fs=require('fs');var fs_extra=require(_0xa084('0x7'));var _=require(_0xa084('0x8'));var squel=require(_0xa084('0x9'));var crypto=require(_0xa084('0xa'));var jsforce=require(_0xa084('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa084('0xc'));var Papa=require('papaparse');var Redis=require(_0xa084('0xd'));var authService=require(_0xa084('0xe'));var qs=require(_0xa084('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa084('0x10'));var logger=require(_0xa084('0x11'))(_0xa084('0x12'));var utils=require(_0xa084('0x13'));var config=require(_0xa084('0x14'));var licenseUtil=require(_0xa084('0x15'));var db=require(_0xa084('0x16'))['db'];function respondWithStatusCode(_0x3423cf,_0x152e8a){_0x152e8a=_0x152e8a||0xcc;return function(_0x3eef38){if(_0x3eef38){return _0x3423cf[_0xa084('0x17')](_0x152e8a);}return _0x3423cf[_0xa084('0x18')](_0x152e8a)['end']();};}function respondWithResult(_0x272c62,_0x1e789c){_0x1e789c=_0x1e789c||0xc8;return function(_0x585073){if(_0x585073){return _0x272c62[_0xa084('0x18')](_0x1e789c)[_0xa084('0x19')](_0x585073);}};}function respondWithFilteredResult(_0x1c0874,_0x5eb327){return function(_0x48ff9c){if(_0x48ff9c){var _0x152da1=typeof _0x5eb327[_0xa084('0x1a')]===_0xa084('0x1b')&&typeof _0x5eb327['limit']===_0xa084('0x1b');var _0x38acdc=_0x48ff9c[_0xa084('0x1c')];var _0x4fa92=_0x152da1?0x0:_0x5eb327['offset'];var _0xf1b3e9=_0x152da1?_0x48ff9c['count']:_0x5eb327[_0xa084('0x1a')]+_0x5eb327[_0xa084('0x1d')];var _0x5266aa;if(_0xf1b3e9>=_0x38acdc){_0xf1b3e9=_0x38acdc;_0x5266aa=0xc8;}else{_0x5266aa=0xce;}_0x1c0874[_0xa084('0x18')](_0x5266aa);return _0x1c0874[_0xa084('0x1e')](_0xa084('0x1f'),_0x4fa92+'-'+_0xf1b3e9+'/'+_0x38acdc)['json'](_0x48ff9c);}return null;};}function patchUpdates(_0x141e8a){return function(_0x4d243e){try{jsonpatch[_0xa084('0x20')](_0x4d243e,_0x141e8a,!![]);}catch(_0x3aaf94){return BPromise[_0xa084('0x21')](_0x3aaf94);}return _0x4d243e[_0xa084('0x22')]();};}function saveUpdates(_0x424418,_0x45c096){return function(_0x48ec77){if(_0x48ec77){return _0x48ec77[_0xa084('0x23')](_0x424418)[_0xa084('0x24')](function(_0x17efe5){return _0x17efe5;});}return null;};}function removeEntity(_0x14eb5a,_0x1ca95f){return function(_0x16432d){if(_0x16432d){return _0x16432d[_0xa084('0x25')]()[_0xa084('0x24')](function(){var _0x24c868=_0x16432d[_0xa084('0x26')]({'plain':!![]});var _0x7b87d1=_0xa084('0x27');return db[_0xa084('0x28')]['destroy']({'where':{'type':_0x7b87d1,'resourceId':_0x24c868['id']}})[_0xa084('0x24')](function(){return _0x16432d;});})[_0xa084('0x24')](function(){_0x14eb5a[_0xa084('0x18')](0xcc)[_0xa084('0x29')]();});}};}function handleEntityNotFound(_0x5bea1a,_0x1d9942){return function(_0x2231b4){if(!_0x2231b4){_0x5bea1a[_0xa084('0x17')](0x194);}return _0x2231b4;};}function handleError(_0x11b30a,_0x1c7f53){_0x1c7f53=_0x1c7f53||0x1f4;return function(_0x228f17){logger[_0xa084('0x2a')](_0x228f17[_0xa084('0x2b')]);if(_0x228f17[_0xa084('0x2c')]){delete _0x228f17[_0xa084('0x2c')];}_0x11b30a[_0xa084('0x18')](_0x1c7f53)[_0xa084('0x2d')](_0x228f17);};}exports[_0xa084('0x2e')]=function(_0x316cf9,_0x9a9b23){var _0x75b032={},_0x168218={},_0x50299b={'count':0x0,'rows':[]};var _0xfe26ab=_[_0xa084('0x2f')](db['Campaign']['rawAttributes'],function(_0x31ea35){return{'name':_0x31ea35[_0xa084('0x30')],'type':_0x31ea35[_0xa084('0x31')][_0xa084('0x32')]};});_0x168218[_0xa084('0x33')]=_[_0xa084('0x2f')](_0xfe26ab,_0xa084('0x2c'));_0x168218['query']=_[_0xa084('0x34')](_0x316cf9[_0xa084('0x35')]);_0x168218[_0xa084('0x36')]=_['intersection'](_0x168218['model'],_0x168218['query']);_0x75b032[_0xa084('0x37')]=_[_0xa084('0x38')](_0x168218[_0xa084('0x33')],qs[_0xa084('0x39')](_0x316cf9['query'][_0xa084('0x39')]));_0x75b032[_0xa084('0x37')]=_0x75b032[_0xa084('0x37')][_0xa084('0x3a')]?_0x75b032[_0xa084('0x37')]:_0x168218['model'];if(!_0x316cf9[_0xa084('0x35')][_0xa084('0x3b')](_0xa084('0x3c'))){_0x75b032['limit']=qs[_0xa084('0x1d')](_0x316cf9[_0xa084('0x35')][_0xa084('0x1d')]);_0x75b032[_0xa084('0x1a')]=qs[_0xa084('0x1a')](_0x316cf9[_0xa084('0x35')][_0xa084('0x1a')]);}_0x75b032[_0xa084('0x3d')]=qs[_0xa084('0x3e')](_0x316cf9['query'][_0xa084('0x3e')]);_0x75b032[_0xa084('0x3f')]=qs[_0xa084('0x36')](_[_0xa084('0x40')](_0x316cf9[_0xa084('0x35')],_0x168218[_0xa084('0x36')]),_0xfe26ab);if(_0x316cf9[_0xa084('0x35')][_0xa084('0x41')]){_0x75b032['where']=_['merge'](_0x75b032[_0xa084('0x3f')],{'$or':_[_0xa084('0x2f')](_0xfe26ab,function(_0x5a504c){if(_0x5a504c[_0xa084('0x31')]!=='VIRTUAL'){var _0x4e3212={};_0x4e3212[_0x5a504c[_0xa084('0x2c')]]={'$like':'%'+_0x316cf9[_0xa084('0x35')][_0xa084('0x41')]+'%'};return _0x4e3212;}})});}_0x75b032=_[_0xa084('0x42')]({},_0x75b032,_0x316cf9[_0xa084('0x43')]);var _0x4b9129={'where':_0x75b032['where']};return db['Campaign']['count'](_0x4b9129)['then'](function(_0x2dc0bb){_0x50299b['count']=_0x2dc0bb;if(_0x316cf9[_0xa084('0x35')][_0xa084('0x44')]){_0x75b032[_0xa084('0x45')]=[{'all':!![]}];}return db[_0xa084('0x46')][_0xa084('0x47')](_0x75b032);})[_0xa084('0x24')](function(_0x2e2cbd){_0x50299b[_0xa084('0x48')]=_0x2e2cbd;return _0x50299b;})[_0xa084('0x24')](respondWithFilteredResult(_0x9a9b23,_0x75b032))[_0xa084('0x49')](handleError(_0x9a9b23,null));};exports['show']=function(_0x305d4d,_0x42395d){var _0x3a1103={'raw':![],'where':{'id':_0x305d4d['params']['id']}},_0x360d95={};_0x360d95[_0xa084('0x33')]=_[_0xa084('0x34')](db[_0xa084('0x46')][_0xa084('0x4a')]);_0x360d95[_0xa084('0x35')]=_[_0xa084('0x34')](_0x305d4d[_0xa084('0x35')]);_0x360d95[_0xa084('0x36')]=_[_0xa084('0x38')](_0x360d95['model'],_0x360d95[_0xa084('0x35')]);_0x3a1103[_0xa084('0x37')]=_[_0xa084('0x38')](_0x360d95['model'],qs[_0xa084('0x39')](_0x305d4d[_0xa084('0x35')][_0xa084('0x39')]));_0x3a1103[_0xa084('0x37')]=_0x3a1103['attributes']['length']?_0x3a1103[_0xa084('0x37')]:_0x360d95[_0xa084('0x33')];if(_0x305d4d[_0xa084('0x35')]['includeAll']){_0x3a1103[_0xa084('0x45')]=[{'all':!![]}];}_0x3a1103=_[_0xa084('0x42')]({},_0x3a1103,_0x305d4d['options']);return db[_0xa084('0x46')][_0xa084('0x4b')](_0x3a1103)['then'](handleEntityNotFound(_0x42395d,null))[_0xa084('0x24')](respondWithResult(_0x42395d,null))[_0xa084('0x49')](handleError(_0x42395d,null));};exports['create']=function(_0xeba23f,_0x1498f0){return db['Campaign'][_0xa084('0x4c')](_0xeba23f['body'],{})[_0xa084('0x24')](function(_0x425659){var _0x47006d=_0xeba23f['user']['get']({'plain':!![]});if(!_0x47006d)throw new Error(_0xa084('0x4d'));if(_0x47006d[_0xa084('0x4e')]===_0xa084('0x4f')){var _0x3a89cf=_0x425659[_0xa084('0x26')]({'plain':!![]});var _0x406146=_0xa084('0x27');return db[_0xa084('0x50')]['find']({'where':{'name':_0x406146,'userProfileId':_0x47006d[_0xa084('0x51')]},'raw':!![]})[_0xa084('0x24')](function(_0x39addf){if(_0x39addf&&_0x39addf[_0xa084('0x52')]===0x0){return db[_0xa084('0x28')]['create']({'name':_0x3a89cf['name'],'resourceId':_0x3a89cf['id'],'type':_0x39addf[_0xa084('0x2c')],'sectionId':_0x39addf['id']},{})[_0xa084('0x24')](function(){return _0x425659;});}else{return _0x425659;}})['catch'](function(_0x3dbebd){logger[_0xa084('0x2a')](_0xa084('0x53'),_0x3dbebd);throw _0x3dbebd;});}return _0x425659;})[_0xa084('0x24')](respondWithResult(_0x1498f0,0xc9))[_0xa084('0x49')](handleError(_0x1498f0,null));};exports[_0xa084('0x54')]=function(_0x26b348,_0x3d3d0f){var _0x4c5b9b={'where':{'id':_0x26b348[_0xa084('0x55')]['id']}},_0x460f04={};_0x460f04['model']=_[_0xa084('0x34')](db[_0xa084('0x46')][_0xa084('0x4a')]);_0x4c5b9b[_0xa084('0x37')]=_[_0xa084('0x38')](_0x460f04[_0xa084('0x33')],qs[_0xa084('0x39')](_0x26b348[_0xa084('0x35')][_0xa084('0x39')]));_0x4c5b9b[_0xa084('0x37')]=_0x4c5b9b[_0xa084('0x37')][_0xa084('0x3a')]?_0x4c5b9b[_0xa084('0x37')]:_0x460f04[_0xa084('0x33')];if(_0x26b348[_0xa084('0x35')][_0xa084('0x44')]){_0x4c5b9b[_0xa084('0x45')]=[{'all':!![]}];}_0x4c5b9b=_[_0xa084('0x42')]({},_0x4c5b9b,_0x26b348[_0xa084('0x43')]);return db[_0xa084('0x46')][_0xa084('0x4b')](_0x4c5b9b)['then'](handleEntityNotFound(_0x3d3d0f,null))[_0xa084('0x24')](function(_0x2b2f11){if(_0x2b2f11){var _0xa8dd28=_0x2b2f11[_0xa084('0x26')]({'plain':!![]});_0xa8dd28=qs[_0xa084('0x56')](_0xa8dd28,['id','createdAt',_0xa084('0x57')]);_0x26b348['body']=_[_0xa084('0x56')](_0x26b348[_0xa084('0x58')],['id',_0xa084('0x59'),_0xa084('0x57')]);return db['Campaign']['create'](_[_0xa084('0x42')](_0xa8dd28,_0x26b348[_0xa084('0x58')]),{'include':_0x26b348[_0xa084('0x35')][_0xa084('0x44')]?[{'all':!![]}]:undefined})[_0xa084('0x24')](function(_0x1c6737){var _0x46fea4=_0x26b348['user'][_0xa084('0x26')]({'plain':!![]});if(!_0x46fea4)throw new Error(_0xa084('0x4d'));if(_0x46fea4[_0xa084('0x4e')]==='user'){var _0x2dba53=_0x1c6737[_0xa084('0x26')]({'plain':!![]});var _0x33d034=_0xa084('0x27');return db[_0xa084('0x50')][_0xa084('0x4b')]({'where':{'name':_0x33d034,'userProfileId':_0x46fea4['userProfileId']},'raw':!![]})[_0xa084('0x24')](function(_0x321acc){if(_0x321acc&&_0x321acc[_0xa084('0x52')]===0x0){return db[_0xa084('0x28')]['create']({'name':_0x2dba53[_0xa084('0x2c')],'resourceId':_0x2dba53['id'],'type':_0x321acc['name'],'sectionId':_0x321acc['id']},{})['then'](function(){return _0x1c6737;});}else{return _0x1c6737;}})[_0xa084('0x49')](function(_0x2e4a25){logger[_0xa084('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2e4a25);throw _0x2e4a25;});}return _0x1c6737;});}})[_0xa084('0x24')](respondWithResult(_0x3d3d0f,0xc9))[_0xa084('0x49')](handleError(_0x3d3d0f,null));};exports['update']=function(_0x2f7979,_0x43efd9){if(_0x2f7979[_0xa084('0x58')]['id']){delete _0x2f7979[_0xa084('0x58')]['id'];}return db['Campaign'][_0xa084('0x4b')]({'where':{'id':_0x2f7979['params']['id']}})[_0xa084('0x24')](handleEntityNotFound(_0x43efd9,null))[_0xa084('0x24')](saveUpdates(_0x2f7979[_0xa084('0x58')],null))[_0xa084('0x24')](respondWithResult(_0x43efd9,null))[_0xa084('0x49')](handleError(_0x43efd9,null));};exports[_0xa084('0x25')]=function(_0x2cb22b,_0x56179c){return db['Campaign'][_0xa084('0x4b')]({'where':{'id':_0x2cb22b[_0xa084('0x55')]['id']}})['then'](handleEntityNotFound(_0x56179c,null))['then'](removeEntity(_0x56179c,null))['catch'](handleError(_0x56179c,null));};exports[_0xa084('0x5a')]=function(_0x10c937,_0xfc29f3,_0xbba817){var _0x6bf83a={'raw':!![],'where':{}};var _0x42c44c={};var _0x3e8f77={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x10c937[_0xa084('0x55')]['id']}})[_0xa084('0x24')](handleEntityNotFound(_0xfc29f3,null))[_0xa084('0x24')](function(_0x18b0c2){if(_0x18b0c2){_0x42c44c[_0xa084('0x33')]=_[_0xa084('0x34')](db[_0xa084('0x5b')][_0xa084('0x4a')]);_0x42c44c[_0xa084('0x35')]=_[_0xa084('0x34')](_0x10c937[_0xa084('0x35')]);_0x42c44c[_0xa084('0x36')]=_[_0xa084('0x38')](_0x42c44c['model'],_0x42c44c['query']);_0x6bf83a[_0xa084('0x37')]=_['intersection'](_0x42c44c[_0xa084('0x33')],qs[_0xa084('0x39')](_0x10c937[_0xa084('0x35')][_0xa084('0x39')]));_0x6bf83a['attributes']=_0x6bf83a[_0xa084('0x37')][_0xa084('0x3a')]?_0x6bf83a[_0xa084('0x37')]:_0x42c44c['model'];if(!_0x10c937[_0xa084('0x35')]['hasOwnProperty']('nolimit')){_0x6bf83a[_0xa084('0x1d')]=qs[_0xa084('0x1d')](_0x10c937['query'][_0xa084('0x1d')]);_0x6bf83a[_0xa084('0x1a')]=qs[_0xa084('0x1a')](_0x10c937[_0xa084('0x35')]['offset']);}_0x6bf83a[_0xa084('0x3d')]=qs[_0xa084('0x3e')](_0x10c937[_0xa084('0x35')]['sort']);_0x6bf83a[_0xa084('0x3f')]=qs['filters'](_[_0xa084('0x40')](_0x10c937[_0xa084('0x35')],_0x42c44c[_0xa084('0x36')]));_0x6bf83a[_0xa084('0x3f')][_0xa084('0x5c')]=_0x18b0c2['id'];if(_0x10c937['query'][_0xa084('0x41')]){_0x6bf83a[_0xa084('0x3f')]=_[_0xa084('0x42')](_0x6bf83a[_0xa084('0x3f')],{'$or':_[_0xa084('0x2f')](_0x6bf83a[_0xa084('0x37')],function(_0x287cb7){var _0x32bfe5={};_0x32bfe5[_0x287cb7]={'$like':'%'+_0x10c937[_0xa084('0x35')][_0xa084('0x41')]+'%'};return _0x32bfe5;})});}_0x6bf83a=_[_0xa084('0x42')]({},_0x6bf83a,_0x10c937[_0xa084('0x43')]);return db[_0xa084('0x5b')][_0xa084('0x1c')]({'where':_0x6bf83a[_0xa084('0x3f')]})[_0xa084('0x24')](function(_0x1d1959){_0x3e8f77['count']=_0x1d1959;if(_0x10c937['query'][_0xa084('0x44')]){_0x6bf83a['include']=[{'all':!![]}];}return db[_0xa084('0x5b')][_0xa084('0x47')](_0x6bf83a);})[_0xa084('0x24')](function(_0x3dd27c){_0x3e8f77[_0xa084('0x48')]=_0x3dd27c;return _0x3e8f77;});}})[_0xa084('0x24')](respondWithFilteredResult(_0xfc29f3,_0x6bf83a))[_0xa084('0x49')](handleError(_0xfc29f3,null));};exports[_0xa084('0x5d')]=function(_0x4714ee,_0x5073dd,_0x370edd){var _0x384e9b={'raw':!![],'where':{}};var _0x33ae6d={};var _0x11231b={'count':0x0,'rows':[]};return db[_0xa084('0x46')][_0xa084('0x5e')]({'where':{'id':_0x4714ee['params']['id']}})[_0xa084('0x24')](handleEntityNotFound(_0x5073dd,null))[_0xa084('0x24')](function(_0x43ec68){if(_0x43ec68){_0x33ae6d[_0xa084('0x33')]=_[_0xa084('0x34')](db[_0xa084('0x5f')]['rawAttributes']);_0x33ae6d[_0xa084('0x35')]=_[_0xa084('0x34')](_0x4714ee[_0xa084('0x35')]);_0x33ae6d[_0xa084('0x36')]=_[_0xa084('0x38')](_0x33ae6d[_0xa084('0x33')],_0x33ae6d[_0xa084('0x35')]);_0x384e9b[_0xa084('0x37')]=_[_0xa084('0x38')](_0x33ae6d['model'],qs[_0xa084('0x39')](_0x4714ee[_0xa084('0x35')][_0xa084('0x39')]));_0x384e9b[_0xa084('0x37')]=_0x384e9b[_0xa084('0x37')][_0xa084('0x3a')]?_0x384e9b[_0xa084('0x37')]:_0x33ae6d[_0xa084('0x33')];if(!_0x4714ee['query']['hasOwnProperty'](_0xa084('0x3c'))){_0x384e9b[_0xa084('0x1d')]=qs[_0xa084('0x1d')](_0x4714ee[_0xa084('0x35')][_0xa084('0x1d')]);_0x384e9b['offset']=qs[_0xa084('0x1a')](_0x4714ee[_0xa084('0x35')][_0xa084('0x1a')]);}_0x384e9b[_0xa084('0x3d')]=qs[_0xa084('0x3e')](_0x4714ee[_0xa084('0x35')][_0xa084('0x3e')]);_0x384e9b[_0xa084('0x3f')]=qs[_0xa084('0x36')](_[_0xa084('0x40')](_0x4714ee['query'],_0x33ae6d[_0xa084('0x36')]));_0x384e9b['where'][_0xa084('0x5c')]=_0x43ec68['id'];if(_0x4714ee[_0xa084('0x35')][_0xa084('0x41')]){_0x384e9b['where']=_[_0xa084('0x42')](_0x384e9b['where'],{'$or':_[_0xa084('0x2f')](_0x384e9b[_0xa084('0x37')],function(_0x5a8506){var _0x1f37ca={};_0x1f37ca[_0x5a8506]={'$like':'%'+_0x4714ee[_0xa084('0x35')]['filter']+'%'};return _0x1f37ca;})});}_0x384e9b=_[_0xa084('0x42')]({},_0x384e9b,_0x4714ee[_0xa084('0x43')]);return db[_0xa084('0x5f')]['count']({'where':_0x384e9b[_0xa084('0x3f')]})[_0xa084('0x24')](function(_0x43cfb0){_0x11231b[_0xa084('0x1c')]=_0x43cfb0;if(_0x4714ee['query'][_0xa084('0x44')]){_0x384e9b[_0xa084('0x45')]=[{'all':!![]}];}return db['CmHopperHistory'][_0xa084('0x47')](_0x384e9b);})[_0xa084('0x24')](function(_0x1af0d5){_0x11231b[_0xa084('0x48')]=_0x1af0d5;return _0x11231b;});}})['then'](respondWithFilteredResult(_0x5073dd,_0x384e9b))[_0xa084('0x49')](handleError(_0x5073dd,null));};exports[_0xa084('0x60')]=function(_0x2ba3f9,_0x160dd5,_0x5d9d32){var _0x3269b0={'raw':!![],'where':{}};var _0x2006a7={};var _0x2568af={'count':0x0,'rows':[]};return db[_0xa084('0x46')][_0xa084('0x5e')]({'where':{'id':_0x2ba3f9['params']['id']}})['then'](handleEntityNotFound(_0x160dd5,null))['then'](function(_0x477025){if(_0x477025){_0x2006a7[_0xa084('0x33')]=_['keys'](db[_0xa084('0x61')][_0xa084('0x4a')]);_0x2006a7['query']=_[_0xa084('0x34')](_0x2ba3f9['query']);_0x2006a7[_0xa084('0x36')]=_['intersection'](_0x2006a7[_0xa084('0x33')],_0x2006a7[_0xa084('0x35')]);_0x3269b0[_0xa084('0x37')]=_[_0xa084('0x38')](_0x2006a7['model'],qs[_0xa084('0x39')](_0x2ba3f9[_0xa084('0x35')][_0xa084('0x39')]));_0x3269b0[_0xa084('0x37')]=_0x3269b0[_0xa084('0x37')][_0xa084('0x3a')]?_0x3269b0['attributes']:_0x2006a7['model'];if(!_0x2ba3f9[_0xa084('0x35')][_0xa084('0x3b')]('nolimit')){_0x3269b0[_0xa084('0x1d')]=qs[_0xa084('0x1d')](_0x2ba3f9['query'][_0xa084('0x1d')]);_0x3269b0[_0xa084('0x1a')]=qs['offset'](_0x2ba3f9[_0xa084('0x35')]['offset']);}_0x3269b0[_0xa084('0x3d')]=qs['sort'](_0x2ba3f9[_0xa084('0x35')][_0xa084('0x3e')]);_0x3269b0[_0xa084('0x3f')]=qs[_0xa084('0x36')](_[_0xa084('0x40')](_0x2ba3f9['query'],_0x2006a7[_0xa084('0x36')]));_0x3269b0['where'][_0xa084('0x5c')]=_0x477025['id'];if(_0x2ba3f9[_0xa084('0x35')][_0xa084('0x41')]){_0x3269b0[_0xa084('0x3f')]=_[_0xa084('0x42')](_0x3269b0['where'],{'$or':_[_0xa084('0x2f')](_0x3269b0[_0xa084('0x37')],function(_0x410ee8){var _0x3914e8={};_0x3914e8[_0x410ee8]={'$like':'%'+_0x2ba3f9[_0xa084('0x35')][_0xa084('0x41')]+'%'};return _0x3914e8;})});}_0x3269b0=_[_0xa084('0x42')]({},_0x3269b0,_0x2ba3f9[_0xa084('0x43')]);return db['CmHopperFinal'][_0xa084('0x1c')]({'where':_0x3269b0['where']})[_0xa084('0x24')](function(_0x41d21d){_0x2568af[_0xa084('0x1c')]=_0x41d21d;if(_0x2ba3f9[_0xa084('0x35')][_0xa084('0x44')]){_0x3269b0[_0xa084('0x45')]=[{'all':!![]}];}return db[_0xa084('0x61')][_0xa084('0x47')](_0x3269b0);})[_0xa084('0x24')](function(_0x4bd849){_0x2568af[_0xa084('0x48')]=_0x4bd849;return _0x2568af;});}})[_0xa084('0x24')](respondWithFilteredResult(_0x160dd5,_0x3269b0))['catch'](handleError(_0x160dd5,null));};exports[_0xa084('0x62')]=function(_0x41de15,_0x112ed7,_0x11f942){var _0x4da827={'raw':!![],'where':{}};var _0x424e9b={};var _0x23ff1c={'count':0x0,'rows':[]};return db[_0xa084('0x46')][_0xa084('0x5e')]({'where':{'id':_0x41de15[_0xa084('0x55')]['id']}})[_0xa084('0x24')](handleEntityNotFound(_0x112ed7,null))[_0xa084('0x24')](function(_0x7eeda4){if(_0x7eeda4){_0x424e9b[_0xa084('0x33')]=_[_0xa084('0x34')](db[_0xa084('0x63')]['rawAttributes']);_0x424e9b['query']=_[_0xa084('0x34')](_0x41de15[_0xa084('0x35')]);_0x424e9b['filters']=_[_0xa084('0x38')](_0x424e9b[_0xa084('0x33')],_0x424e9b[_0xa084('0x35')]);_0x4da827['attributes']=_[_0xa084('0x38')](_0x424e9b['model'],qs['fields'](_0x41de15[_0xa084('0x35')][_0xa084('0x39')]));_0x4da827['attributes']=_0x4da827[_0xa084('0x37')][_0xa084('0x3a')]?_0x4da827[_0xa084('0x37')]:_0x424e9b[_0xa084('0x33')];if(!_0x41de15[_0xa084('0x35')][_0xa084('0x3b')](_0xa084('0x3c'))){_0x4da827[_0xa084('0x1d')]=qs[_0xa084('0x1d')](_0x41de15['query'][_0xa084('0x1d')]);_0x4da827[_0xa084('0x1a')]=qs['offset'](_0x41de15['query'][_0xa084('0x1a')]);}_0x4da827[_0xa084('0x3d')]=qs[_0xa084('0x3e')](_0x41de15[_0xa084('0x35')]['sort']);_0x4da827[_0xa084('0x3f')]=qs['filters'](_[_0xa084('0x40')](_0x41de15[_0xa084('0x35')],_0x424e9b['filters']));_0x4da827[_0xa084('0x3f')][_0xa084('0x5c')]=_0x7eeda4['id'];if(_0x41de15['query'][_0xa084('0x41')]){_0x4da827[_0xa084('0x3f')]=_['merge'](_0x4da827[_0xa084('0x3f')],{'$or':_[_0xa084('0x2f')](_0x4da827['attributes'],function(_0x118ac8){var _0x340180={};_0x340180[_0x118ac8]={'$like':'%'+_0x41de15[_0xa084('0x35')]['filter']+'%'};return _0x340180;})});}_0x4da827=_[_0xa084('0x42')]({},_0x4da827,_0x41de15[_0xa084('0x43')]);return db[_0xa084('0x63')][_0xa084('0x1c')]({'where':_0x4da827['where']})[_0xa084('0x24')](function(_0x226e76){_0x23ff1c[_0xa084('0x1c')]=_0x226e76;if(_0x41de15['query'][_0xa084('0x44')]){_0x4da827[_0xa084('0x45')]=[{'all':!![]}];}return db[_0xa084('0x63')][_0xa084('0x47')](_0x4da827);})[_0xa084('0x24')](function(_0x167910){_0x23ff1c[_0xa084('0x48')]=_0x167910;return _0x23ff1c;});}})[_0xa084('0x24')](respondWithFilteredResult(_0x112ed7,_0x4da827))['catch'](handleError(_0x112ed7,null));};exports[_0xa084('0x64')]=function(_0x22f051,_0x481a6d,_0x34324c){var _0x2d718b={};var _0x3657d8={};var _0x243d1c;var _0x3b62e4;return db[_0xa084('0x46')]['findOne']({'where':{'id':_0x22f051[_0xa084('0x55')]['id']}})[_0xa084('0x24')](handleEntityNotFound(_0x481a6d,null))[_0xa084('0x24')](function(_0x153620){if(_0x153620){_0x243d1c=_0x153620;_0x3657d8['model']=_[_0xa084('0x34')](db[_0xa084('0x65')][_0xa084('0x4a')]);_0x3657d8[_0xa084('0x35')]=_[_0xa084('0x34')](_0x22f051[_0xa084('0x35')]);_0x3657d8[_0xa084('0x36')]=_['intersection'](_0x3657d8[_0xa084('0x33')],_0x3657d8[_0xa084('0x35')]);_0x2d718b[_0xa084('0x37')]=_[_0xa084('0x38')](_0x3657d8[_0xa084('0x33')],qs['fields'](_0x22f051[_0xa084('0x35')]['fields']));_0x2d718b['attributes']=_0x2d718b[_0xa084('0x37')]['length']?_0x2d718b[_0xa084('0x37')]:_0x3657d8[_0xa084('0x33')];_0x2d718b[_0xa084('0x3d')]=qs[_0xa084('0x3e')](_0x22f051[_0xa084('0x35')][_0xa084('0x3e')]);_0x2d718b['where']=qs[_0xa084('0x36')](_['pick'](_0x22f051[_0xa084('0x35')],_0x3657d8[_0xa084('0x36')]));if(_0x22f051['query'][_0xa084('0x41')]){_0x2d718b[_0xa084('0x3f')]=_['merge'](_0x2d718b[_0xa084('0x3f')],{'$or':_[_0xa084('0x2f')](_0x2d718b['attributes'],function(_0x4166e0){var _0x1571ea={};_0x1571ea[_0x4166e0]={'$like':'%'+_0x22f051[_0xa084('0x35')][_0xa084('0x41')]+'%'};return _0x1571ea;})});}_0x2d718b=_[_0xa084('0x42')]({},_0x2d718b,_0x22f051[_0xa084('0x43')]);return _0x243d1c[_0xa084('0x64')](_0x2d718b);}})['then'](function(_0x29952b){if(_0x29952b){_0x3b62e4=_0x29952b['length'];if(!_0x22f051[_0xa084('0x35')][_0xa084('0x3b')]('nolimit')){_0x2d718b[_0xa084('0x1d')]=qs['limit'](_0x22f051[_0xa084('0x35')][_0xa084('0x1d')]);_0x2d718b['offset']=qs[_0xa084('0x1a')](_0x22f051[_0xa084('0x35')][_0xa084('0x1a')]);}return _0x243d1c[_0xa084('0x64')](_0x2d718b);}})[_0xa084('0x24')](function(_0x5dcb0c){if(_0x5dcb0c){return _0x5dcb0c?{'count':_0x3b62e4,'rows':_0x5dcb0c}:null;}})[_0xa084('0x24')](respondWithResult(_0x481a6d,null))[_0xa084('0x49')](handleError(_0x481a6d,null));};exports[_0xa084('0x66')]=function(_0x3d430e,_0x40f4e7,_0x1ed56f){var _0x4d23f1,_0x246906;return db[_0xa084('0x46')][_0xa084('0x4b')]({'where':{'id':_0x3d430e[_0xa084('0x55')]['id']}})[_0xa084('0x24')](handleEntityNotFound(_0x40f4e7,null))[_0xa084('0x24')](function(_0x2eb877){if(_0x2eb877){_0x246906=_0x2eb877;return _0x2eb877[_0xa084('0x66')](_0x3d430e[_0xa084('0x58')][_0xa084('0x67')],_[_0xa084('0x56')](_0x3d430e['body'],[_0xa084('0x67'),'id'])||{});}return null;})[_0xa084('0x68')](function(_0x17fe32){var _0x2992c9;_0x4d23f1=_0x17fe32||[];var _0x2be775=[];if(_0x17fe32){for(var _0x4a7559=0x0;_0x4a7559<_0x17fe32[_0xa084('0x3a')];_0x4a7559+=0x1){var _0x50bf6b=_0x17fe32[_0x4a7559][_0xa084('0x26')]({'plain':!![]});_0x246906[_0xa084('0x69')]=_0x3d430e[_0xa084('0x58')][_0xa084('0x69')]?_0x3d430e[_0xa084('0x58')][_0xa084('0x69')]:_0x246906[_0xa084('0x69')];switch(_0x246906[_0xa084('0x69')]){case _0xa084('0x6a'):_0x2992c9=squel['insert']()[_0xa084('0x6b')](_0xa084('0x6c'))[_0xa084('0x6d')]([_0xa084('0x6e'),'scheduledAt',_0xa084('0x6f'),_0xa084('0x70'),'CampaignId','createdAt',_0xa084('0x57')],squel[_0xa084('0x71')]()['field'](_0xa084('0x6e'),_0xa084('0x6e'))[_0xa084('0x72')](_0xa084('0x73'),'scheduledAt')[_0xa084('0x72')]('id',_0xa084('0x6f'))['field'](_0x50bf6b[_0xa084('0x74')][_0xa084('0x75')](),_0xa084('0x70'))[_0xa084('0x72')](_0x3d430e[_0xa084('0x55')]['id'][_0xa084('0x75')](),'CampaignId')[_0xa084('0x72')](_0xa084('0x73'),'createdAt')['field']('NOW()','updatedAt')[_0xa084('0x76')](_0xa084('0x77'))['where'](_0xa084('0x78'))[_0xa084('0x3f')]('ListId\x20=\x20?',_0x50bf6b['CmListId'][_0xa084('0x75')]())[_0xa084('0x3f')](_0xa084('0x79'))[_0xa084('0x3f')](_0xa084('0x7a'),squel[_0xa084('0x71')]()[_0xa084('0x72')](_0xa084('0x7b'))[_0xa084('0x76')](_0xa084('0x7c'))[_0xa084('0x3f')](_0xa084('0x7d'),_0x3d430e[_0xa084('0x55')]['id']['toString']()))['where'](_0xa084('0x7a'),squel['select']()[_0xa084('0x72')](_0xa084('0x7e'))[_0xa084('0x76')]('cm_hopper')['where']('CampaignId\x20=\x20?',_0x3d430e[_0xa084('0x55')]['id'][_0xa084('0x75')]())))[_0xa084('0x75')]();break;case'onlyIfOpen':_0x2992c9=squel[_0xa084('0x7f')]()[_0xa084('0x6b')]('cm_hopper')[_0xa084('0x6d')]([_0xa084('0x6e'),'scheduledAt',_0xa084('0x6f'),_0xa084('0x70'),'CampaignId',_0xa084('0x59'),_0xa084('0x57')],squel[_0xa084('0x71')]()[_0xa084('0x72')](_0xa084('0x6e'),'phone')['field'](_0xa084('0x73'),_0xa084('0x80'))[_0xa084('0x72')]('id',_0xa084('0x6f'))[_0xa084('0x72')](_0x50bf6b[_0xa084('0x74')][_0xa084('0x75')](),'ListId')[_0xa084('0x72')](_0x3d430e[_0xa084('0x55')]['id']['toString'](),_0xa084('0x5c'))[_0xa084('0x72')](_0xa084('0x73'),_0xa084('0x59'))['field'](_0xa084('0x73'),_0xa084('0x57'))[_0xa084('0x76')](_0xa084('0x77'))[_0xa084('0x3f')](_0xa084('0x78'))['where'](_0xa084('0x81'),_0x50bf6b[_0xa084('0x74')][_0xa084('0x75')]())[_0xa084('0x3f')]('phone\x20IS\x20NOT\x20NULL')[_0xa084('0x3f')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0xa084('0x72')](_0xa084('0x7e'))[_0xa084('0x76')](_0xa084('0x6c'))[_0xa084('0x3f')](_0xa084('0x7d'),_0x3d430e['params']['id'][_0xa084('0x75')]())))[_0xa084('0x75')]();break;default:_0x2992c9=squel['insert']()[_0xa084('0x6b')](_0xa084('0x6c'))[_0xa084('0x6d')]([_0xa084('0x6e'),_0xa084('0x80'),'ContactId',_0xa084('0x70'),'CampaignId',_0xa084('0x59'),_0xa084('0x57')],squel['select']()['field'](_0xa084('0x6e'),_0xa084('0x6e'))['field'](_0xa084('0x73'),'scheduledAt')[_0xa084('0x72')]('id','ContactId')[_0xa084('0x72')](_0x50bf6b[_0xa084('0x74')]['toString'](),_0xa084('0x70'))[_0xa084('0x72')](_0x3d430e[_0xa084('0x55')]['id'][_0xa084('0x75')](),'CampaignId')[_0xa084('0x72')](_0xa084('0x73'),_0xa084('0x59'))[_0xa084('0x72')]('NOW()','updatedAt')[_0xa084('0x76')]('cm_contacts')['where'](_0xa084('0x78'))[_0xa084('0x3f')](_0xa084('0x81'),_0x50bf6b[_0xa084('0x74')][_0xa084('0x75')]())[_0xa084('0x3f')]('phone\x20IS\x20NOT\x20NULL'))['toString']();}_0x2be775[_0xa084('0x82')](db[_0xa084('0x83')]['query'](_0x2992c9));}return BPromise[_0xa084('0x84')](_0x2be775);}})[_0xa084('0x24')](function(){return _0x4d23f1;})[_0xa084('0x24')](respondWithResult(_0x40f4e7,null))[_0xa084('0x49')](handleError(_0x40f4e7,null));};exports[_0xa084('0x85')]=function(_0x1071bd,_0x59f543,_0x58290f){return db[_0xa084('0x46')][_0xa084('0x4b')]({'where':{'id':_0x1071bd[_0xa084('0x55')]['id']}})[_0xa084('0x24')](handleEntityNotFound(_0x59f543,null))['then'](function(_0x243a1c){if(_0x243a1c){return _0x243a1c[_0xa084('0x85')](_0x1071bd[_0xa084('0x35')][_0xa084('0x67')]);}})[_0xa084('0x24')](function(_0x4caa05){if(_0x4caa05){return db[_0xa084('0x5b')][_0xa084('0x25')]({'where':{'ListId':_0x1071bd[_0xa084('0x35')][_0xa084('0x67')],'CampaignId':_0x1071bd[_0xa084('0x55')]['id']}})[_0xa084('0x24')](function(){return _0x4caa05;});}})['then'](respondWithStatusCode(_0x59f543,null))[_0xa084('0x49')](handleError(_0x59f543,null));};exports[_0xa084('0x86')]=function(_0x668ab1,_0x4751f9,_0x45d907){var _0x46c78f={};var _0x497a07={};var _0x36e2fa;var _0xf4efdb;return db[_0xa084('0x46')][_0xa084('0x5e')]({'where':{'id':_0x668ab1[_0xa084('0x55')]['id']}})['then'](handleEntityNotFound(_0x4751f9,null))[_0xa084('0x24')](function(_0x534392){if(_0x534392){_0x36e2fa=_0x534392;_0x497a07[_0xa084('0x33')]=_[_0xa084('0x34')](db[_0xa084('0x65')]['rawAttributes']);_0x497a07[_0xa084('0x35')]=_[_0xa084('0x34')](_0x668ab1[_0xa084('0x35')]);_0x497a07[_0xa084('0x36')]=_['intersection'](_0x497a07[_0xa084('0x33')],_0x497a07['query']);_0x46c78f[_0xa084('0x37')]=_[_0xa084('0x38')](_0x497a07[_0xa084('0x33')],qs[_0xa084('0x39')](_0x668ab1[_0xa084('0x35')][_0xa084('0x39')]));_0x46c78f[_0xa084('0x37')]=_0x46c78f[_0xa084('0x37')][_0xa084('0x3a')]?_0x46c78f['attributes']:_0x497a07[_0xa084('0x33')];_0x46c78f['order']=qs['sort'](_0x668ab1[_0xa084('0x35')][_0xa084('0x3e')]);_0x46c78f['where']=qs['filters'](_[_0xa084('0x40')](_0x668ab1[_0xa084('0x35')],_0x497a07[_0xa084('0x36')]));if(_0x668ab1[_0xa084('0x35')]['filter']){_0x46c78f['where']=_[_0xa084('0x42')](_0x46c78f[_0xa084('0x3f')],{'$or':_[_0xa084('0x2f')](_0x46c78f['attributes'],function(_0x2b3518){var _0x232d74={};_0x232d74[_0x2b3518]={'$like':'%'+_0x668ab1[_0xa084('0x35')][_0xa084('0x41')]+'%'};return _0x232d74;})});}_0x46c78f=_[_0xa084('0x42')]({},_0x46c78f,_0x668ab1['options']);return _0x36e2fa[_0xa084('0x86')](_0x46c78f);}})[_0xa084('0x24')](function(_0x189702){if(_0x189702){_0xf4efdb=_0x189702[_0xa084('0x3a')];if(!_0x668ab1[_0xa084('0x35')][_0xa084('0x3b')](_0xa084('0x3c'))){_0x46c78f[_0xa084('0x1d')]=qs[_0xa084('0x1d')](_0x668ab1[_0xa084('0x35')][_0xa084('0x1d')]);_0x46c78f['offset']=qs['offset'](_0x668ab1[_0xa084('0x35')]['offset']);}return _0x36e2fa[_0xa084('0x86')](_0x46c78f);}})[_0xa084('0x24')](function(_0x317f38){if(_0x317f38){return _0x317f38?{'count':_0xf4efdb,'rows':_0x317f38}:null;}})[_0xa084('0x24')](respondWithResult(_0x4751f9,null))[_0xa084('0x49')](handleError(_0x4751f9,null));};exports[_0xa084('0x87')]=function(_0x3de364,_0x47f1c4,_0x1b38ce){var _0x58082a,_0x4ad041;return db['Campaign'][_0xa084('0x4b')]({'where':{'id':_0x3de364[_0xa084('0x55')]['id']}})[_0xa084('0x24')](handleEntityNotFound(_0x47f1c4,null))[_0xa084('0x24')](function(_0x59dbdf){if(_0x59dbdf){_0x4ad041=_0x59dbdf;return _0x59dbdf[_0xa084('0x87')](_0x3de364[_0xa084('0x58')]['ids'],_[_0xa084('0x56')](_0x3de364[_0xa084('0x58')],[_0xa084('0x67'),'id'])||{});}return null;})['spread'](function(_0x361862){var _0x102c4d;_0x58082a=_0x361862||[];var _0x3cf8da=[];if(_0x361862){for(var _0x41dd23=0x0;_0x41dd23<_0x361862[_0xa084('0x3a')];_0x41dd23+=0x1){var _0x193329=_0x361862[_0x41dd23][_0xa084('0x26')]({'plain':!![]});_0x102c4d=squel[_0xa084('0x7f')]()[_0xa084('0x6b')](_0xa084('0x88'))['fromQuery']([_0xa084('0x6e'),_0xa084('0x6f'),'ListId',_0xa084('0x5c'),'createdAt',_0xa084('0x57')],squel['select']()['field'](_0xa084('0x6e'),_0xa084('0x6e'))[_0xa084('0x72')]('id',_0xa084('0x6f'))[_0xa084('0x72')](_0x193329[_0xa084('0x74')][_0xa084('0x75')](),_0xa084('0x70'))[_0xa084('0x72')](_0x3de364['params']['id'][_0xa084('0x75')](),_0xa084('0x5c'))[_0xa084('0x72')](_0xa084('0x73'),_0xa084('0x59'))[_0xa084('0x72')](_0xa084('0x73'),_0xa084('0x57'))[_0xa084('0x76')](_0xa084('0x77'))['where'](_0xa084('0x78'))['where'](_0xa084('0x81'),_0x193329[_0xa084('0x74')][_0xa084('0x75')]())[_0xa084('0x3f')]('phone\x20IS\x20NOT\x20NULL'))['toString']();_0x3cf8da['push'](db[_0xa084('0x83')][_0xa084('0x35')](_0x102c4d));}return BPromise['all'](_0x3cf8da);}})[_0xa084('0x24')](function(){return _0x58082a;})['then'](respondWithResult(_0x47f1c4,null))['catch'](handleError(_0x47f1c4,null));};exports['removeBlackLists']=function(_0x264c3e,_0xcf7002,_0x463b70){return db[_0xa084('0x46')][_0xa084('0x4b')]({'where':{'id':_0x264c3e[_0xa084('0x55')]['id']}})['then'](handleEntityNotFound(_0xcf7002,null))[_0xa084('0x24')](function(_0x180a9c){if(_0x180a9c){return _0x180a9c[_0xa084('0x89')](_0x264c3e[_0xa084('0x35')]['ids']);}})[_0xa084('0x24')](function(_0xa32ed4){if(_0xa32ed4){return db[_0xa084('0x63')]['destroy']({'where':{'ListId':_0x264c3e[_0xa084('0x35')]['ids'],'CampaignId':_0x264c3e[_0xa084('0x55')]['id']}})[_0xa084('0x24')](function(){return _0xa32ed4;});}})[_0xa084('0x24')](respondWithStatusCode(_0xcf7002,null))[_0xa084('0x49')](handleError(_0xcf7002,null));}; \ No newline at end of file +var _0xdcd4=['filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','length','options','find','create','body','user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','getHoppers','CmHopper','order','CampaignId','getHopperHistories','findOne','CmHopperHistory','CmHopperFinal','rawAttributes','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','ids','dialCheckDuplicateType','always','insert','phone','scheduledAt','select','field','NOW()','CmListId','toString','ListId','from','cm_contacts','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','cm_hopper','onlyIfOpen','fromQuery','ContactId','phone\x20IS\x20NOT\x20NULL','into','deletedAt\x20IS\x20NULL','push','all','removeLists','getBlackLists','spread','cm_hopper_black','sequelize','removeBlackLists','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','limit','undefined','count','set','apply','reject','update','then','destroy','get','IvrCampaigns','UserProfileResource','end','error','stack','name','map','Campaign','key','model','query','keys'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0xdcd4,0x15a));var _0x4dcd=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xdcd4[_0x3b380d];return _0x54502b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4dcd('0x0'));var zipdir=require(_0x4dcd('0x1'));var jsonpatch=require(_0x4dcd('0x2'));var rp=require(_0x4dcd('0x3'));var moment=require(_0x4dcd('0x4'));var BPromise=require(_0x4dcd('0x5'));var Mustache=require(_0x4dcd('0x6'));var util=require(_0x4dcd('0x7'));var path=require('path');var sox=require(_0x4dcd('0x8'));var csv=require('to-csv');var ejs=require(_0x4dcd('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4dcd('0xa'));var deskjs=require(_0x4dcd('0xb'));var toCsv=require(_0x4dcd('0xc'));var querystring=require(_0x4dcd('0xd'));var Papa=require('papaparse');var Redis=require(_0x4dcd('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4dcd('0xf'));var hardwareService=require(_0x4dcd('0x10'));var logger=require(_0x4dcd('0x11'))('api');var utils=require(_0x4dcd('0x12'));var config=require(_0x4dcd('0x13'));var licenseUtil=require(_0x4dcd('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x51ccaf,_0x470db6){_0x470db6=_0x470db6||0xcc;return function(_0x12cb3c){if(_0x12cb3c){return _0x51ccaf[_0x4dcd('0x15')](_0x470db6);}return _0x51ccaf['status'](_0x470db6)['end']();};}function respondWithResult(_0x57d8c4,_0x14ef38){_0x14ef38=_0x14ef38||0xc8;return function(_0x4c888a){if(_0x4c888a){return _0x57d8c4[_0x4dcd('0x16')](_0x14ef38)[_0x4dcd('0x17')](_0x4c888a);}};}function respondWithFilteredResult(_0x4a208f,_0x2b20b6){return function(_0x22de04){if(_0x22de04){var _0xf5a137=typeof _0x2b20b6[_0x4dcd('0x18')]==='undefined'&&typeof _0x2b20b6[_0x4dcd('0x19')]===_0x4dcd('0x1a');var _0xee91a6=_0x22de04[_0x4dcd('0x1b')];var _0x5709e9=_0xf5a137?0x0:_0x2b20b6[_0x4dcd('0x18')];var _0x376507=_0xf5a137?_0x22de04[_0x4dcd('0x1b')]:_0x2b20b6[_0x4dcd('0x18')]+_0x2b20b6[_0x4dcd('0x19')];var _0x3852c9;if(_0x376507>=_0xee91a6){_0x376507=_0xee91a6;_0x3852c9=0xc8;}else{_0x3852c9=0xce;}_0x4a208f[_0x4dcd('0x16')](_0x3852c9);return _0x4a208f[_0x4dcd('0x1c')]('Content-Range',_0x5709e9+'-'+_0x376507+'/'+_0xee91a6)[_0x4dcd('0x17')](_0x22de04);}return null;};}function patchUpdates(_0x5619d1){return function(_0x284686){try{jsonpatch[_0x4dcd('0x1d')](_0x284686,_0x5619d1,!![]);}catch(_0x412dc1){return BPromise[_0x4dcd('0x1e')](_0x412dc1);}return _0x284686['save']();};}function saveUpdates(_0x14c5e0,_0x2fc79f){return function(_0x2cad0f){if(_0x2cad0f){return _0x2cad0f[_0x4dcd('0x1f')](_0x14c5e0)[_0x4dcd('0x20')](function(_0x3b4de1){return _0x3b4de1;});}return null;};}function removeEntity(_0x145fc4,_0x1deb06){return function(_0x5bda90){if(_0x5bda90){return _0x5bda90[_0x4dcd('0x21')]()[_0x4dcd('0x20')](function(){var _0x203ba2=_0x5bda90[_0x4dcd('0x22')]({'plain':!![]});var _0x3a6b6a=_0x4dcd('0x23');return db[_0x4dcd('0x24')][_0x4dcd('0x21')]({'where':{'type':_0x3a6b6a,'resourceId':_0x203ba2['id']}})[_0x4dcd('0x20')](function(){return _0x5bda90;});})[_0x4dcd('0x20')](function(){_0x145fc4[_0x4dcd('0x16')](0xcc)[_0x4dcd('0x25')]();});}};}function handleEntityNotFound(_0xdd46ab,_0x48534d){return function(_0x3f3557){if(!_0x3f3557){_0xdd46ab[_0x4dcd('0x15')](0x194);}return _0x3f3557;};}function handleError(_0x30e183,_0x4e4aaa){_0x4e4aaa=_0x4e4aaa||0x1f4;return function(_0x5117c1){logger[_0x4dcd('0x26')](_0x5117c1[_0x4dcd('0x27')]);if(_0x5117c1[_0x4dcd('0x28')]){delete _0x5117c1[_0x4dcd('0x28')];}_0x30e183[_0x4dcd('0x16')](_0x4e4aaa)['send'](_0x5117c1);};}exports['index']=function(_0x39d971,_0x17d24f){var _0x556180={},_0x1e1142={},_0x438ba6={'count':0x0,'rows':[]};var _0x59f202=_[_0x4dcd('0x29')](db[_0x4dcd('0x2a')]['rawAttributes'],function(_0x1da80e){return{'name':_0x1da80e['fieldName'],'type':_0x1da80e['type'][_0x4dcd('0x2b')]};});_0x1e1142[_0x4dcd('0x2c')]=_[_0x4dcd('0x29')](_0x59f202,_0x4dcd('0x28'));_0x1e1142[_0x4dcd('0x2d')]=_[_0x4dcd('0x2e')](_0x39d971[_0x4dcd('0x2d')]);_0x1e1142[_0x4dcd('0x2f')]=_[_0x4dcd('0x30')](_0x1e1142[_0x4dcd('0x2c')],_0x1e1142[_0x4dcd('0x2d')]);_0x556180['attributes']=_[_0x4dcd('0x30')](_0x1e1142[_0x4dcd('0x2c')],qs['fields'](_0x39d971[_0x4dcd('0x2d')][_0x4dcd('0x31')]));_0x556180['attributes']=_0x556180['attributes']['length']?_0x556180[_0x4dcd('0x32')]:_0x1e1142[_0x4dcd('0x2c')];if(!_0x39d971[_0x4dcd('0x2d')][_0x4dcd('0x33')](_0x4dcd('0x34'))){_0x556180['limit']=qs[_0x4dcd('0x19')](_0x39d971[_0x4dcd('0x2d')][_0x4dcd('0x19')]);_0x556180[_0x4dcd('0x18')]=qs['offset'](_0x39d971['query'][_0x4dcd('0x18')]);}_0x556180['order']=qs[_0x4dcd('0x35')](_0x39d971['query'][_0x4dcd('0x35')]);_0x556180['where']=qs['filters'](_[_0x4dcd('0x36')](_0x39d971[_0x4dcd('0x2d')],_0x1e1142[_0x4dcd('0x2f')]),_0x59f202);if(_0x39d971[_0x4dcd('0x2d')][_0x4dcd('0x37')]){_0x556180[_0x4dcd('0x38')]=_[_0x4dcd('0x39')](_0x556180[_0x4dcd('0x38')],{'$or':_[_0x4dcd('0x29')](_0x59f202,function(_0x3d003c){if(_0x3d003c['type']!==_0x4dcd('0x3a')){var _0x559c98={};_0x559c98[_0x3d003c[_0x4dcd('0x28')]]={'$like':'%'+_0x39d971[_0x4dcd('0x2d')][_0x4dcd('0x37')]+'%'};return _0x559c98;}})});}_0x556180=_[_0x4dcd('0x39')]({},_0x556180,_0x39d971['options']);var _0x5867df={'where':_0x556180[_0x4dcd('0x38')]};return db[_0x4dcd('0x2a')]['count'](_0x5867df)['then'](function(_0x33ad99){_0x438ba6[_0x4dcd('0x1b')]=_0x33ad99;if(_0x39d971['query'][_0x4dcd('0x3b')]){_0x556180[_0x4dcd('0x3c')]=[{'all':!![]}];}return db['Campaign'][_0x4dcd('0x3d')](_0x556180);})[_0x4dcd('0x20')](function(_0x20b23b){_0x438ba6[_0x4dcd('0x3e')]=_0x20b23b;return _0x438ba6;})[_0x4dcd('0x20')](respondWithFilteredResult(_0x17d24f,_0x556180))[_0x4dcd('0x3f')](handleError(_0x17d24f,null));};exports[_0x4dcd('0x40')]=function(_0x1692e7,_0x49c7e8){var _0x3e31c9={'raw':![],'where':{'id':_0x1692e7[_0x4dcd('0x41')]['id']}},_0x44f298={};_0x44f298[_0x4dcd('0x2c')]=_[_0x4dcd('0x2e')](db[_0x4dcd('0x2a')]['rawAttributes']);_0x44f298[_0x4dcd('0x2d')]=_[_0x4dcd('0x2e')](_0x1692e7['query']);_0x44f298[_0x4dcd('0x2f')]=_['intersection'](_0x44f298[_0x4dcd('0x2c')],_0x44f298[_0x4dcd('0x2d')]);_0x3e31c9[_0x4dcd('0x32')]=_[_0x4dcd('0x30')](_0x44f298[_0x4dcd('0x2c')],qs[_0x4dcd('0x31')](_0x1692e7['query']['fields']));_0x3e31c9[_0x4dcd('0x32')]=_0x3e31c9['attributes'][_0x4dcd('0x42')]?_0x3e31c9[_0x4dcd('0x32')]:_0x44f298[_0x4dcd('0x2c')];if(_0x1692e7[_0x4dcd('0x2d')][_0x4dcd('0x3b')]){_0x3e31c9[_0x4dcd('0x3c')]=[{'all':!![]}];}_0x3e31c9=_['merge']({},_0x3e31c9,_0x1692e7[_0x4dcd('0x43')]);return db[_0x4dcd('0x2a')][_0x4dcd('0x44')](_0x3e31c9)[_0x4dcd('0x20')](handleEntityNotFound(_0x49c7e8,null))[_0x4dcd('0x20')](respondWithResult(_0x49c7e8,null))[_0x4dcd('0x3f')](handleError(_0x49c7e8,null));};exports[_0x4dcd('0x45')]=function(_0x4e886c,_0x56bea1){return db[_0x4dcd('0x2a')]['create'](_0x4e886c[_0x4dcd('0x46')],{})['then'](function(_0x5074f8){var _0x541c4e=_0x4e886c[_0x4dcd('0x47')][_0x4dcd('0x22')]({'plain':!![]});if(!_0x541c4e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x541c4e[_0x4dcd('0x48')]===_0x4dcd('0x47')){var _0x45b693=_0x5074f8['get']({'plain':!![]});var _0x3da14a=_0x4dcd('0x23');return db[_0x4dcd('0x49')][_0x4dcd('0x44')]({'where':{'name':_0x3da14a,'userProfileId':_0x541c4e[_0x4dcd('0x4a')]},'raw':!![]})[_0x4dcd('0x20')](function(_0x38400d){if(_0x38400d&&_0x38400d['autoAssociation']===0x0){return db[_0x4dcd('0x24')][_0x4dcd('0x45')]({'name':_0x45b693[_0x4dcd('0x28')],'resourceId':_0x45b693['id'],'type':_0x38400d['name'],'sectionId':_0x38400d['id']},{})[_0x4dcd('0x20')](function(){return _0x5074f8;});}else{return _0x5074f8;}})[_0x4dcd('0x3f')](function(_0x5cfd35){logger[_0x4dcd('0x26')](_0x4dcd('0x4b'),_0x5cfd35);throw _0x5cfd35;});}return _0x5074f8;})[_0x4dcd('0x20')](respondWithResult(_0x56bea1,0xc9))[_0x4dcd('0x3f')](handleError(_0x56bea1,null));};exports[_0x4dcd('0x4c')]=function(_0x3d9944,_0x3dcc7a){var _0x4fd117={'where':{'id':_0x3d9944[_0x4dcd('0x41')]['id']}},_0x250406={};_0x250406[_0x4dcd('0x2c')]=_[_0x4dcd('0x2e')](db[_0x4dcd('0x2a')]['rawAttributes']);_0x4fd117[_0x4dcd('0x32')]=_[_0x4dcd('0x30')](_0x250406['model'],qs['fields'](_0x3d9944[_0x4dcd('0x2d')][_0x4dcd('0x31')]));_0x4fd117[_0x4dcd('0x32')]=_0x4fd117['attributes'][_0x4dcd('0x42')]?_0x4fd117[_0x4dcd('0x32')]:_0x250406[_0x4dcd('0x2c')];if(_0x3d9944[_0x4dcd('0x2d')][_0x4dcd('0x3b')]){_0x4fd117[_0x4dcd('0x3c')]=[{'all':!![]}];}_0x4fd117=_[_0x4dcd('0x39')]({},_0x4fd117,_0x3d9944[_0x4dcd('0x43')]);return db[_0x4dcd('0x2a')][_0x4dcd('0x44')](_0x4fd117)[_0x4dcd('0x20')](handleEntityNotFound(_0x3dcc7a,null))[_0x4dcd('0x20')](function(_0x284ce1){if(_0x284ce1){var _0x3004a5=_0x284ce1[_0x4dcd('0x22')]({'plain':!![]});_0x3004a5=qs[_0x4dcd('0x4d')](_0x3004a5,['id',_0x4dcd('0x4e'),'updatedAt']);_0x3d9944[_0x4dcd('0x46')]=_['omit'](_0x3d9944['body'],['id','createdAt',_0x4dcd('0x4f')]);return db[_0x4dcd('0x2a')][_0x4dcd('0x45')](_[_0x4dcd('0x39')](_0x3004a5,_0x3d9944[_0x4dcd('0x46')]),{'include':_0x3d9944[_0x4dcd('0x2d')][_0x4dcd('0x3b')]?[{'all':!![]}]:undefined})['then'](function(_0xdb84b9){var _0x452b3a=_0x3d9944['user'][_0x4dcd('0x22')]({'plain':!![]});if(!_0x452b3a)throw new Error(_0x4dcd('0x50'));if(_0x452b3a['role']===_0x4dcd('0x47')){var _0x108f8d=_0xdb84b9[_0x4dcd('0x22')]({'plain':!![]});var _0x75fc50=_0x4dcd('0x23');return db[_0x4dcd('0x49')][_0x4dcd('0x44')]({'where':{'name':_0x75fc50,'userProfileId':_0x452b3a[_0x4dcd('0x4a')]},'raw':!![]})[_0x4dcd('0x20')](function(_0xcf64b0){if(_0xcf64b0&&_0xcf64b0[_0x4dcd('0x51')]===0x0){return db['UserProfileResource']['create']({'name':_0x108f8d[_0x4dcd('0x28')],'resourceId':_0x108f8d['id'],'type':_0xcf64b0[_0x4dcd('0x28')],'sectionId':_0xcf64b0['id']},{})[_0x4dcd('0x20')](function(){return _0xdb84b9;});}else{return _0xdb84b9;}})[_0x4dcd('0x3f')](function(_0x4568b7){logger[_0x4dcd('0x26')](_0x4dcd('0x4b'),_0x4568b7);throw _0x4568b7;});}return _0xdb84b9;});}})[_0x4dcd('0x20')](respondWithResult(_0x3dcc7a,0xc9))[_0x4dcd('0x3f')](handleError(_0x3dcc7a,null));};exports[_0x4dcd('0x1f')]=function(_0x2777ca,_0x508099){if(_0x2777ca['body']['id']){delete _0x2777ca[_0x4dcd('0x46')]['id'];}return db[_0x4dcd('0x2a')]['find']({'where':{'id':_0x2777ca[_0x4dcd('0x41')]['id']}})['then'](handleEntityNotFound(_0x508099,null))['then'](saveUpdates(_0x2777ca[_0x4dcd('0x46')],null))[_0x4dcd('0x20')](respondWithResult(_0x508099,null))[_0x4dcd('0x3f')](handleError(_0x508099,null));};exports[_0x4dcd('0x21')]=function(_0xa2950e,_0x5c1471){return db[_0x4dcd('0x2a')][_0x4dcd('0x44')]({'where':{'id':_0xa2950e[_0x4dcd('0x41')]['id']}})[_0x4dcd('0x20')](handleEntityNotFound(_0x5c1471,null))[_0x4dcd('0x20')](removeEntity(_0x5c1471,null))[_0x4dcd('0x3f')](handleError(_0x5c1471,null));};exports[_0x4dcd('0x52')]=function(_0x37ccdb,_0x213e8a,_0x4303ae){var _0x591c5d={'raw':!![],'where':{}};var _0x466c14={};var _0x23bf86={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x37ccdb['params']['id']}})['then'](handleEntityNotFound(_0x213e8a,null))[_0x4dcd('0x20')](function(_0x751fba){if(_0x751fba){_0x466c14[_0x4dcd('0x2c')]=_[_0x4dcd('0x2e')](db[_0x4dcd('0x53')]['rawAttributes']);_0x466c14[_0x4dcd('0x2d')]=_[_0x4dcd('0x2e')](_0x37ccdb[_0x4dcd('0x2d')]);_0x466c14[_0x4dcd('0x2f')]=_[_0x4dcd('0x30')](_0x466c14[_0x4dcd('0x2c')],_0x466c14['query']);_0x591c5d[_0x4dcd('0x32')]=_[_0x4dcd('0x30')](_0x466c14['model'],qs[_0x4dcd('0x31')](_0x37ccdb['query'][_0x4dcd('0x31')]));_0x591c5d[_0x4dcd('0x32')]=_0x591c5d[_0x4dcd('0x32')]['length']?_0x591c5d['attributes']:_0x466c14[_0x4dcd('0x2c')];if(!_0x37ccdb[_0x4dcd('0x2d')][_0x4dcd('0x33')](_0x4dcd('0x34'))){_0x591c5d[_0x4dcd('0x19')]=qs['limit'](_0x37ccdb[_0x4dcd('0x2d')][_0x4dcd('0x19')]);_0x591c5d['offset']=qs['offset'](_0x37ccdb[_0x4dcd('0x2d')][_0x4dcd('0x18')]);}_0x591c5d[_0x4dcd('0x54')]=qs[_0x4dcd('0x35')](_0x37ccdb[_0x4dcd('0x2d')][_0x4dcd('0x35')]);_0x591c5d[_0x4dcd('0x38')]=qs[_0x4dcd('0x2f')](_['pick'](_0x37ccdb[_0x4dcd('0x2d')],_0x466c14[_0x4dcd('0x2f')]));_0x591c5d['where'][_0x4dcd('0x55')]=_0x751fba['id'];if(_0x37ccdb[_0x4dcd('0x2d')][_0x4dcd('0x37')]){_0x591c5d['where']=_[_0x4dcd('0x39')](_0x591c5d[_0x4dcd('0x38')],{'$or':_[_0x4dcd('0x29')](_0x591c5d[_0x4dcd('0x32')],function(_0x4ae56c){var _0x95cf6c={};_0x95cf6c[_0x4ae56c]={'$like':'%'+_0x37ccdb['query']['filter']+'%'};return _0x95cf6c;})});}_0x591c5d=_[_0x4dcd('0x39')]({},_0x591c5d,_0x37ccdb['options']);return db[_0x4dcd('0x53')][_0x4dcd('0x1b')]({'where':_0x591c5d[_0x4dcd('0x38')]})[_0x4dcd('0x20')](function(_0x5a857d){_0x23bf86[_0x4dcd('0x1b')]=_0x5a857d;if(_0x37ccdb[_0x4dcd('0x2d')][_0x4dcd('0x3b')]){_0x591c5d[_0x4dcd('0x3c')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x591c5d);})['then'](function(_0x4b7f3e){_0x23bf86['rows']=_0x4b7f3e;return _0x23bf86;});}})[_0x4dcd('0x20')](respondWithFilteredResult(_0x213e8a,_0x591c5d))[_0x4dcd('0x3f')](handleError(_0x213e8a,null));};exports[_0x4dcd('0x56')]=function(_0x401fe3,_0x2aa65a,_0x4948e7){var _0x329418={'raw':!![],'where':{}};var _0x195a6f={};var _0x5a12be={'count':0x0,'rows':[]};return db['Campaign'][_0x4dcd('0x57')]({'where':{'id':_0x401fe3['params']['id']}})[_0x4dcd('0x20')](handleEntityNotFound(_0x2aa65a,null))[_0x4dcd('0x20')](function(_0x44ab52){if(_0x44ab52){_0x195a6f[_0x4dcd('0x2c')]=_[_0x4dcd('0x2e')](db[_0x4dcd('0x58')]['rawAttributes']);_0x195a6f[_0x4dcd('0x2d')]=_[_0x4dcd('0x2e')](_0x401fe3[_0x4dcd('0x2d')]);_0x195a6f[_0x4dcd('0x2f')]=_[_0x4dcd('0x30')](_0x195a6f[_0x4dcd('0x2c')],_0x195a6f[_0x4dcd('0x2d')]);_0x329418[_0x4dcd('0x32')]=_[_0x4dcd('0x30')](_0x195a6f['model'],qs[_0x4dcd('0x31')](_0x401fe3['query']['fields']));_0x329418[_0x4dcd('0x32')]=_0x329418[_0x4dcd('0x32')][_0x4dcd('0x42')]?_0x329418[_0x4dcd('0x32')]:_0x195a6f['model'];if(!_0x401fe3[_0x4dcd('0x2d')]['hasOwnProperty'](_0x4dcd('0x34'))){_0x329418['limit']=qs[_0x4dcd('0x19')](_0x401fe3[_0x4dcd('0x2d')][_0x4dcd('0x19')]);_0x329418[_0x4dcd('0x18')]=qs['offset'](_0x401fe3['query'][_0x4dcd('0x18')]);}_0x329418[_0x4dcd('0x54')]=qs['sort'](_0x401fe3[_0x4dcd('0x2d')][_0x4dcd('0x35')]);_0x329418[_0x4dcd('0x38')]=qs[_0x4dcd('0x2f')](_['pick'](_0x401fe3['query'],_0x195a6f[_0x4dcd('0x2f')]));_0x329418[_0x4dcd('0x38')][_0x4dcd('0x55')]=_0x44ab52['id'];if(_0x401fe3[_0x4dcd('0x2d')][_0x4dcd('0x37')]){_0x329418[_0x4dcd('0x38')]=_[_0x4dcd('0x39')](_0x329418[_0x4dcd('0x38')],{'$or':_[_0x4dcd('0x29')](_0x329418[_0x4dcd('0x32')],function(_0x54e8a2){var _0x37979b={};_0x37979b[_0x54e8a2]={'$like':'%'+_0x401fe3['query'][_0x4dcd('0x37')]+'%'};return _0x37979b;})});}_0x329418=_[_0x4dcd('0x39')]({},_0x329418,_0x401fe3['options']);return db['CmHopperHistory'][_0x4dcd('0x1b')]({'where':_0x329418[_0x4dcd('0x38')]})['then'](function(_0xfc8376){_0x5a12be[_0x4dcd('0x1b')]=_0xfc8376;if(_0x401fe3[_0x4dcd('0x2d')][_0x4dcd('0x3b')]){_0x329418[_0x4dcd('0x3c')]=[{'all':!![]}];}return db[_0x4dcd('0x58')][_0x4dcd('0x3d')](_0x329418);})[_0x4dcd('0x20')](function(_0x2cdbb8){_0x5a12be[_0x4dcd('0x3e')]=_0x2cdbb8;return _0x5a12be;});}})[_0x4dcd('0x20')](respondWithFilteredResult(_0x2aa65a,_0x329418))[_0x4dcd('0x3f')](handleError(_0x2aa65a,null));};exports['getHopperFinals']=function(_0xc56429,_0x20ce72,_0x301e3e){var _0x319955={'raw':!![],'where':{}};var _0x5e0d6e={};var _0x2916ad={'count':0x0,'rows':[]};return db[_0x4dcd('0x2a')][_0x4dcd('0x57')]({'where':{'id':_0xc56429[_0x4dcd('0x41')]['id']}})[_0x4dcd('0x20')](handleEntityNotFound(_0x20ce72,null))[_0x4dcd('0x20')](function(_0x34ed20){if(_0x34ed20){_0x5e0d6e[_0x4dcd('0x2c')]=_[_0x4dcd('0x2e')](db[_0x4dcd('0x59')][_0x4dcd('0x5a')]);_0x5e0d6e[_0x4dcd('0x2d')]=_[_0x4dcd('0x2e')](_0xc56429[_0x4dcd('0x2d')]);_0x5e0d6e['filters']=_[_0x4dcd('0x30')](_0x5e0d6e[_0x4dcd('0x2c')],_0x5e0d6e['query']);_0x319955['attributes']=_[_0x4dcd('0x30')](_0x5e0d6e['model'],qs['fields'](_0xc56429[_0x4dcd('0x2d')][_0x4dcd('0x31')]));_0x319955[_0x4dcd('0x32')]=_0x319955[_0x4dcd('0x32')][_0x4dcd('0x42')]?_0x319955[_0x4dcd('0x32')]:_0x5e0d6e[_0x4dcd('0x2c')];if(!_0xc56429[_0x4dcd('0x2d')][_0x4dcd('0x33')]('nolimit')){_0x319955['limit']=qs[_0x4dcd('0x19')](_0xc56429[_0x4dcd('0x2d')][_0x4dcd('0x19')]);_0x319955[_0x4dcd('0x18')]=qs[_0x4dcd('0x18')](_0xc56429[_0x4dcd('0x2d')][_0x4dcd('0x18')]);}_0x319955[_0x4dcd('0x54')]=qs[_0x4dcd('0x35')](_0xc56429[_0x4dcd('0x2d')]['sort']);_0x319955[_0x4dcd('0x38')]=qs[_0x4dcd('0x2f')](_[_0x4dcd('0x36')](_0xc56429[_0x4dcd('0x2d')],_0x5e0d6e[_0x4dcd('0x2f')]));_0x319955['where'][_0x4dcd('0x55')]=_0x34ed20['id'];if(_0xc56429[_0x4dcd('0x2d')][_0x4dcd('0x37')]){_0x319955['where']=_['merge'](_0x319955[_0x4dcd('0x38')],{'$or':_[_0x4dcd('0x29')](_0x319955['attributes'],function(_0x3c2482){var _0x295064={};_0x295064[_0x3c2482]={'$like':'%'+_0xc56429[_0x4dcd('0x2d')]['filter']+'%'};return _0x295064;})});}_0x319955=_[_0x4dcd('0x39')]({},_0x319955,_0xc56429[_0x4dcd('0x43')]);return db[_0x4dcd('0x59')][_0x4dcd('0x1b')]({'where':_0x319955[_0x4dcd('0x38')]})['then'](function(_0x35c7d8){_0x2916ad['count']=_0x35c7d8;if(_0xc56429['query']['includeAll']){_0x319955[_0x4dcd('0x3c')]=[{'all':!![]}];}return db[_0x4dcd('0x59')][_0x4dcd('0x3d')](_0x319955);})['then'](function(_0xf9dd77){_0x2916ad[_0x4dcd('0x3e')]=_0xf9dd77;return _0x2916ad;});}})[_0x4dcd('0x20')](respondWithFilteredResult(_0x20ce72,_0x319955))[_0x4dcd('0x3f')](handleError(_0x20ce72,null));};exports[_0x4dcd('0x5b')]=function(_0x348f0f,_0x3b6655,_0x3b7962){var _0x3400ec={'raw':!![],'where':{}};var _0x42a68c={};var _0x1aae41={'count':0x0,'rows':[]};return db[_0x4dcd('0x2a')][_0x4dcd('0x57')]({'where':{'id':_0x348f0f[_0x4dcd('0x41')]['id']}})[_0x4dcd('0x20')](handleEntityNotFound(_0x3b6655,null))[_0x4dcd('0x20')](function(_0x2d0fd9){if(_0x2d0fd9){_0x42a68c[_0x4dcd('0x2c')]=_[_0x4dcd('0x2e')](db[_0x4dcd('0x5c')][_0x4dcd('0x5a')]);_0x42a68c['query']=_[_0x4dcd('0x2e')](_0x348f0f['query']);_0x42a68c[_0x4dcd('0x2f')]=_['intersection'](_0x42a68c[_0x4dcd('0x2c')],_0x42a68c['query']);_0x3400ec[_0x4dcd('0x32')]=_[_0x4dcd('0x30')](_0x42a68c[_0x4dcd('0x2c')],qs[_0x4dcd('0x31')](_0x348f0f['query'][_0x4dcd('0x31')]));_0x3400ec['attributes']=_0x3400ec[_0x4dcd('0x32')][_0x4dcd('0x42')]?_0x3400ec[_0x4dcd('0x32')]:_0x42a68c[_0x4dcd('0x2c')];if(!_0x348f0f[_0x4dcd('0x2d')]['hasOwnProperty'](_0x4dcd('0x34'))){_0x3400ec['limit']=qs['limit'](_0x348f0f[_0x4dcd('0x2d')]['limit']);_0x3400ec[_0x4dcd('0x18')]=qs['offset'](_0x348f0f[_0x4dcd('0x2d')][_0x4dcd('0x18')]);}_0x3400ec['order']=qs[_0x4dcd('0x35')](_0x348f0f['query'][_0x4dcd('0x35')]);_0x3400ec[_0x4dcd('0x38')]=qs[_0x4dcd('0x2f')](_['pick'](_0x348f0f[_0x4dcd('0x2d')],_0x42a68c[_0x4dcd('0x2f')]));_0x3400ec[_0x4dcd('0x38')][_0x4dcd('0x55')]=_0x2d0fd9['id'];if(_0x348f0f[_0x4dcd('0x2d')][_0x4dcd('0x37')]){_0x3400ec[_0x4dcd('0x38')]=_[_0x4dcd('0x39')](_0x3400ec[_0x4dcd('0x38')],{'$or':_[_0x4dcd('0x29')](_0x3400ec[_0x4dcd('0x32')],function(_0x26f995){var _0x4f641c={};_0x4f641c[_0x26f995]={'$like':'%'+_0x348f0f[_0x4dcd('0x2d')][_0x4dcd('0x37')]+'%'};return _0x4f641c;})});}_0x3400ec=_['merge']({},_0x3400ec,_0x348f0f[_0x4dcd('0x43')]);return db[_0x4dcd('0x5c')][_0x4dcd('0x1b')]({'where':_0x3400ec[_0x4dcd('0x38')]})[_0x4dcd('0x20')](function(_0x1b656d){_0x1aae41[_0x4dcd('0x1b')]=_0x1b656d;if(_0x348f0f[_0x4dcd('0x2d')][_0x4dcd('0x3b')]){_0x3400ec['include']=[{'all':!![]}];}return db[_0x4dcd('0x5c')][_0x4dcd('0x3d')](_0x3400ec);})[_0x4dcd('0x20')](function(_0x5980fa){_0x1aae41[_0x4dcd('0x3e')]=_0x5980fa;return _0x1aae41;});}})[_0x4dcd('0x20')](respondWithFilteredResult(_0x3b6655,_0x3400ec))[_0x4dcd('0x3f')](handleError(_0x3b6655,null));};exports[_0x4dcd('0x5d')]=function(_0x23d047,_0x20dd42,_0x218a29){var _0x458972={};var _0x1015fb={};var _0x9d61e4;var _0x4e3780;return db[_0x4dcd('0x2a')][_0x4dcd('0x57')]({'where':{'id':_0x23d047[_0x4dcd('0x41')]['id']}})['then'](handleEntityNotFound(_0x20dd42,null))[_0x4dcd('0x20')](function(_0x56ed58){if(_0x56ed58){_0x9d61e4=_0x56ed58;_0x1015fb[_0x4dcd('0x2c')]=_[_0x4dcd('0x2e')](db[_0x4dcd('0x5e')][_0x4dcd('0x5a')]);_0x1015fb[_0x4dcd('0x2d')]=_['keys'](_0x23d047[_0x4dcd('0x2d')]);_0x1015fb[_0x4dcd('0x2f')]=_['intersection'](_0x1015fb[_0x4dcd('0x2c')],_0x1015fb['query']);_0x458972[_0x4dcd('0x32')]=_['intersection'](_0x1015fb[_0x4dcd('0x2c')],qs['fields'](_0x23d047['query'][_0x4dcd('0x31')]));_0x458972[_0x4dcd('0x32')]=_0x458972[_0x4dcd('0x32')]['length']?_0x458972[_0x4dcd('0x32')]:_0x1015fb['model'];_0x458972[_0x4dcd('0x54')]=qs[_0x4dcd('0x35')](_0x23d047[_0x4dcd('0x2d')][_0x4dcd('0x35')]);_0x458972[_0x4dcd('0x38')]=qs[_0x4dcd('0x2f')](_[_0x4dcd('0x36')](_0x23d047[_0x4dcd('0x2d')],_0x1015fb[_0x4dcd('0x2f')]));if(_0x23d047[_0x4dcd('0x2d')][_0x4dcd('0x37')]){_0x458972[_0x4dcd('0x38')]=_['merge'](_0x458972['where'],{'$or':_['map'](_0x458972[_0x4dcd('0x32')],function(_0x5e6574){var _0x4456df={};_0x4456df[_0x5e6574]={'$like':'%'+_0x23d047['query'][_0x4dcd('0x37')]+'%'};return _0x4456df;})});}_0x458972=_[_0x4dcd('0x39')]({},_0x458972,_0x23d047[_0x4dcd('0x43')]);return _0x9d61e4[_0x4dcd('0x5d')](_0x458972);}})[_0x4dcd('0x20')](function(_0xae9bfd){if(_0xae9bfd){_0x4e3780=_0xae9bfd[_0x4dcd('0x42')];if(!_0x23d047['query']['hasOwnProperty'](_0x4dcd('0x34'))){_0x458972[_0x4dcd('0x19')]=qs[_0x4dcd('0x19')](_0x23d047[_0x4dcd('0x2d')][_0x4dcd('0x19')]);_0x458972[_0x4dcd('0x18')]=qs[_0x4dcd('0x18')](_0x23d047['query'][_0x4dcd('0x18')]);}return _0x9d61e4[_0x4dcd('0x5d')](_0x458972);}})[_0x4dcd('0x20')](function(_0x41d6e0){if(_0x41d6e0){return _0x41d6e0?{'count':_0x4e3780,'rows':_0x41d6e0}:null;}})[_0x4dcd('0x20')](respondWithResult(_0x20dd42,null))['catch'](handleError(_0x20dd42,null));};exports[_0x4dcd('0x5f')]=function(_0xcf5812,_0x5ea946,_0x4cb2a0){var _0x21a030,_0x5f0903;return db[_0x4dcd('0x2a')][_0x4dcd('0x44')]({'where':{'id':_0xcf5812['params']['id']}})['then'](handleEntityNotFound(_0x5ea946,null))[_0x4dcd('0x20')](function(_0x2883f3){if(_0x2883f3){_0x5f0903=_0x2883f3;return _0x2883f3[_0x4dcd('0x5f')](_0xcf5812[_0x4dcd('0x46')][_0x4dcd('0x60')],_[_0x4dcd('0x4d')](_0xcf5812[_0x4dcd('0x46')],[_0x4dcd('0x60'),'id'])||{});}return null;})['spread'](function(_0x2c712b){var _0x381d34;_0x21a030=_0x2c712b||[];var _0x265f9d=[];if(_0x2c712b){for(var _0x202313=0x0;_0x202313<_0x2c712b[_0x4dcd('0x42')];_0x202313+=0x1){var _0x16593f=_0x2c712b[_0x202313][_0x4dcd('0x22')]({'plain':!![]});_0x5f0903[_0x4dcd('0x61')]=_0xcf5812[_0x4dcd('0x46')][_0x4dcd('0x61')]?_0xcf5812[_0x4dcd('0x46')][_0x4dcd('0x61')]:_0x5f0903['dialCheckDuplicateType'];switch(_0x5f0903[_0x4dcd('0x61')]){case _0x4dcd('0x62'):_0x381d34=squel[_0x4dcd('0x63')]()['into']('cm_hopper')['fromQuery']([_0x4dcd('0x64'),_0x4dcd('0x65'),'ContactId','ListId',_0x4dcd('0x55'),_0x4dcd('0x4e'),_0x4dcd('0x4f')],squel[_0x4dcd('0x66')]()[_0x4dcd('0x67')](_0x4dcd('0x64'),_0x4dcd('0x64'))[_0x4dcd('0x67')](_0x4dcd('0x68'),_0x4dcd('0x65'))[_0x4dcd('0x67')]('id','ContactId')[_0x4dcd('0x67')](_0x16593f[_0x4dcd('0x69')][_0x4dcd('0x6a')](),_0x4dcd('0x6b'))[_0x4dcd('0x67')](_0xcf5812[_0x4dcd('0x41')]['id'][_0x4dcd('0x6a')](),_0x4dcd('0x55'))['field'](_0x4dcd('0x68'),_0x4dcd('0x4e'))[_0x4dcd('0x67')](_0x4dcd('0x68'),'updatedAt')[_0x4dcd('0x6c')](_0x4dcd('0x6d'))['where']('deletedAt\x20IS\x20NULL')[_0x4dcd('0x38')](_0x4dcd('0x6e'),_0x16593f[_0x4dcd('0x69')][_0x4dcd('0x6a')]())[_0x4dcd('0x38')]('phone\x20IS\x20NOT\x20NULL')[_0x4dcd('0x38')](_0x4dcd('0x6f'),squel[_0x4dcd('0x66')]()[_0x4dcd('0x67')](_0x4dcd('0x70'))['from'](_0x4dcd('0x71'))['where'](_0x4dcd('0x72'),_0xcf5812['params']['id']['toString']()))[_0x4dcd('0x38')](_0x4dcd('0x6f'),squel[_0x4dcd('0x66')]()[_0x4dcd('0x67')](_0x4dcd('0x73'))[_0x4dcd('0x6c')](_0x4dcd('0x74'))[_0x4dcd('0x38')](_0x4dcd('0x72'),_0xcf5812[_0x4dcd('0x41')]['id']['toString']())))[_0x4dcd('0x6a')]();break;case _0x4dcd('0x75'):_0x381d34=squel[_0x4dcd('0x63')]()['into'](_0x4dcd('0x74'))[_0x4dcd('0x76')]([_0x4dcd('0x64'),_0x4dcd('0x65'),_0x4dcd('0x77'),'ListId',_0x4dcd('0x55'),_0x4dcd('0x4e'),_0x4dcd('0x4f')],squel['select']()[_0x4dcd('0x67')](_0x4dcd('0x64'),'phone')[_0x4dcd('0x67')]('NOW()',_0x4dcd('0x65'))['field']('id','ContactId')[_0x4dcd('0x67')](_0x16593f[_0x4dcd('0x69')]['toString'](),_0x4dcd('0x6b'))[_0x4dcd('0x67')](_0xcf5812[_0x4dcd('0x41')]['id'][_0x4dcd('0x6a')](),_0x4dcd('0x55'))[_0x4dcd('0x67')](_0x4dcd('0x68'),'createdAt')[_0x4dcd('0x67')](_0x4dcd('0x68'),_0x4dcd('0x4f'))[_0x4dcd('0x6c')](_0x4dcd('0x6d'))[_0x4dcd('0x38')]('deletedAt\x20IS\x20NULL')[_0x4dcd('0x38')](_0x4dcd('0x6e'),_0x16593f[_0x4dcd('0x69')]['toString']())[_0x4dcd('0x38')](_0x4dcd('0x78'))[_0x4dcd('0x38')](_0x4dcd('0x6f'),squel[_0x4dcd('0x66')]()['field'](_0x4dcd('0x73'))[_0x4dcd('0x6c')]('cm_hopper')[_0x4dcd('0x38')](_0x4dcd('0x72'),_0xcf5812[_0x4dcd('0x41')]['id'][_0x4dcd('0x6a')]())))[_0x4dcd('0x6a')]();break;default:_0x381d34=squel[_0x4dcd('0x63')]()[_0x4dcd('0x79')](_0x4dcd('0x74'))['fromQuery']([_0x4dcd('0x64'),'scheduledAt',_0x4dcd('0x77'),'ListId',_0x4dcd('0x55'),_0x4dcd('0x4e'),'updatedAt'],squel[_0x4dcd('0x66')]()[_0x4dcd('0x67')]('phone',_0x4dcd('0x64'))['field']('NOW()',_0x4dcd('0x65'))[_0x4dcd('0x67')]('id',_0x4dcd('0x77'))['field'](_0x16593f[_0x4dcd('0x69')][_0x4dcd('0x6a')](),_0x4dcd('0x6b'))['field'](_0xcf5812['params']['id'][_0x4dcd('0x6a')](),_0x4dcd('0x55'))[_0x4dcd('0x67')](_0x4dcd('0x68'),_0x4dcd('0x4e'))['field']('NOW()',_0x4dcd('0x4f'))[_0x4dcd('0x6c')]('cm_contacts')[_0x4dcd('0x38')](_0x4dcd('0x7a'))['where'](_0x4dcd('0x6e'),_0x16593f[_0x4dcd('0x69')]['toString']())[_0x4dcd('0x38')](_0x4dcd('0x78')))['toString']();}_0x265f9d[_0x4dcd('0x7b')](db['sequelize']['query'](_0x381d34));}return BPromise[_0x4dcd('0x7c')](_0x265f9d);}})[_0x4dcd('0x20')](function(){return _0x21a030;})[_0x4dcd('0x20')](respondWithResult(_0x5ea946,null))['catch'](handleError(_0x5ea946,null));};exports[_0x4dcd('0x7d')]=function(_0x22dbf7,_0x4faf02,_0x2af10c){return db[_0x4dcd('0x2a')][_0x4dcd('0x44')]({'where':{'id':_0x22dbf7['params']['id']}})[_0x4dcd('0x20')](handleEntityNotFound(_0x4faf02,null))[_0x4dcd('0x20')](function(_0x40e090){if(_0x40e090){return _0x40e090[_0x4dcd('0x7d')](_0x22dbf7[_0x4dcd('0x2d')]['ids']);}})[_0x4dcd('0x20')](function(_0x2a71e6){if(_0x2a71e6){return db[_0x4dcd('0x53')][_0x4dcd('0x21')]({'where':{'ListId':_0x22dbf7[_0x4dcd('0x2d')]['ids'],'CampaignId':_0x22dbf7[_0x4dcd('0x41')]['id']}})[_0x4dcd('0x20')](function(){return _0x2a71e6;});}})[_0x4dcd('0x20')](respondWithStatusCode(_0x4faf02,null))[_0x4dcd('0x3f')](handleError(_0x4faf02,null));};exports['getBlackLists']=function(_0x1eea94,_0x275464,_0x94c35c){var _0x2be662={};var _0x57fbc1={};var _0x14eac2;var _0x2462d4;return db[_0x4dcd('0x2a')][_0x4dcd('0x57')]({'where':{'id':_0x1eea94['params']['id']}})[_0x4dcd('0x20')](handleEntityNotFound(_0x275464,null))[_0x4dcd('0x20')](function(_0x572ccd){if(_0x572ccd){_0x14eac2=_0x572ccd;_0x57fbc1[_0x4dcd('0x2c')]=_[_0x4dcd('0x2e')](db['CmList'][_0x4dcd('0x5a')]);_0x57fbc1[_0x4dcd('0x2d')]=_['keys'](_0x1eea94[_0x4dcd('0x2d')]);_0x57fbc1['filters']=_['intersection'](_0x57fbc1[_0x4dcd('0x2c')],_0x57fbc1['query']);_0x2be662['attributes']=_[_0x4dcd('0x30')](_0x57fbc1[_0x4dcd('0x2c')],qs[_0x4dcd('0x31')](_0x1eea94[_0x4dcd('0x2d')][_0x4dcd('0x31')]));_0x2be662[_0x4dcd('0x32')]=_0x2be662[_0x4dcd('0x32')][_0x4dcd('0x42')]?_0x2be662[_0x4dcd('0x32')]:_0x57fbc1['model'];_0x2be662[_0x4dcd('0x54')]=qs['sort'](_0x1eea94[_0x4dcd('0x2d')][_0x4dcd('0x35')]);_0x2be662[_0x4dcd('0x38')]=qs[_0x4dcd('0x2f')](_[_0x4dcd('0x36')](_0x1eea94[_0x4dcd('0x2d')],_0x57fbc1[_0x4dcd('0x2f')]));if(_0x1eea94['query'][_0x4dcd('0x37')]){_0x2be662[_0x4dcd('0x38')]=_[_0x4dcd('0x39')](_0x2be662['where'],{'$or':_['map'](_0x2be662['attributes'],function(_0x29c96e){var _0x37b791={};_0x37b791[_0x29c96e]={'$like':'%'+_0x1eea94[_0x4dcd('0x2d')][_0x4dcd('0x37')]+'%'};return _0x37b791;})});}_0x2be662=_[_0x4dcd('0x39')]({},_0x2be662,_0x1eea94[_0x4dcd('0x43')]);return _0x14eac2[_0x4dcd('0x7e')](_0x2be662);}})[_0x4dcd('0x20')](function(_0x4cd70d){if(_0x4cd70d){_0x2462d4=_0x4cd70d[_0x4dcd('0x42')];if(!_0x1eea94['query'][_0x4dcd('0x33')](_0x4dcd('0x34'))){_0x2be662[_0x4dcd('0x19')]=qs[_0x4dcd('0x19')](_0x1eea94[_0x4dcd('0x2d')]['limit']);_0x2be662[_0x4dcd('0x18')]=qs['offset'](_0x1eea94['query'][_0x4dcd('0x18')]);}return _0x14eac2[_0x4dcd('0x7e')](_0x2be662);}})[_0x4dcd('0x20')](function(_0xfcdf6b){if(_0xfcdf6b){return _0xfcdf6b?{'count':_0x2462d4,'rows':_0xfcdf6b}:null;}})[_0x4dcd('0x20')](respondWithResult(_0x275464,null))[_0x4dcd('0x3f')](handleError(_0x275464,null));};exports['addBlackLists']=function(_0x393ef3,_0x4ad537,_0x4dd12b){var _0x29e0f9,_0x50e275;return db[_0x4dcd('0x2a')][_0x4dcd('0x44')]({'where':{'id':_0x393ef3['params']['id']}})[_0x4dcd('0x20')](handleEntityNotFound(_0x4ad537,null))[_0x4dcd('0x20')](function(_0x4c7e2f){if(_0x4c7e2f){_0x50e275=_0x4c7e2f;return _0x4c7e2f['addBlackLists'](_0x393ef3['body'][_0x4dcd('0x60')],_[_0x4dcd('0x4d')](_0x393ef3[_0x4dcd('0x46')],[_0x4dcd('0x60'),'id'])||{});}return null;})[_0x4dcd('0x7f')](function(_0x6eeda2){var _0x291bf3;_0x29e0f9=_0x6eeda2||[];var _0x5b15ef=[];if(_0x6eeda2){for(var _0x818d77=0x0;_0x818d77<_0x6eeda2[_0x4dcd('0x42')];_0x818d77+=0x1){var _0x2e33b3=_0x6eeda2[_0x818d77]['get']({'plain':!![]});_0x291bf3=squel[_0x4dcd('0x63')]()['into'](_0x4dcd('0x80'))[_0x4dcd('0x76')]([_0x4dcd('0x64'),_0x4dcd('0x77'),_0x4dcd('0x6b'),_0x4dcd('0x55'),'createdAt',_0x4dcd('0x4f')],squel[_0x4dcd('0x66')]()['field'](_0x4dcd('0x64'),_0x4dcd('0x64'))['field']('id',_0x4dcd('0x77'))[_0x4dcd('0x67')](_0x2e33b3[_0x4dcd('0x69')][_0x4dcd('0x6a')](),_0x4dcd('0x6b'))[_0x4dcd('0x67')](_0x393ef3[_0x4dcd('0x41')]['id'][_0x4dcd('0x6a')](),'CampaignId')['field']('NOW()',_0x4dcd('0x4e'))[_0x4dcd('0x67')]('NOW()',_0x4dcd('0x4f'))[_0x4dcd('0x6c')]('cm_contacts')[_0x4dcd('0x38')](_0x4dcd('0x7a'))[_0x4dcd('0x38')](_0x4dcd('0x6e'),_0x2e33b3[_0x4dcd('0x69')][_0x4dcd('0x6a')]())[_0x4dcd('0x38')](_0x4dcd('0x78')))[_0x4dcd('0x6a')]();_0x5b15ef[_0x4dcd('0x7b')](db[_0x4dcd('0x81')][_0x4dcd('0x2d')](_0x291bf3));}return BPromise['all'](_0x5b15ef);}})[_0x4dcd('0x20')](function(){return _0x29e0f9;})[_0x4dcd('0x20')](respondWithResult(_0x4ad537,null))[_0x4dcd('0x3f')](handleError(_0x4ad537,null));};exports[_0x4dcd('0x82')]=function(_0x352b04,_0x109141,_0x25553f){return db[_0x4dcd('0x2a')][_0x4dcd('0x44')]({'where':{'id':_0x352b04['params']['id']}})[_0x4dcd('0x20')](handleEntityNotFound(_0x109141,null))[_0x4dcd('0x20')](function(_0x43ceb2){if(_0x43ceb2){return _0x43ceb2['removeBlackLists'](_0x352b04['query']['ids']);}})[_0x4dcd('0x20')](function(_0x2f9969){if(_0x2f9969){return db[_0x4dcd('0x5c')]['destroy']({'where':{'ListId':_0x352b04[_0x4dcd('0x2d')][_0x4dcd('0x60')],'CampaignId':_0x352b04[_0x4dcd('0x41')]['id']}})[_0x4dcd('0x20')](function(){return _0x2f9969;});}})[_0x4dcd('0x20')](respondWithStatusCode(_0x109141,null))[_0x4dcd('0x3f')](handleError(_0x109141,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 4105ee6..dbcaeec 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(_0x1a9204,_0x1c9e00){var _0x17ca68=function(_0x1f4399){while(--_0x1f4399){_0x1a9204['push'](_0x1a9204['shift']());}};_0x17ca68(++_0x1c9e00);}(_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':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x1966ad,_0x43f2f3){var _0x5d7637=function(_0x24b943){while(--_0x24b943){_0x1966ad['push'](_0x1966ad['shift']());}};_0x5d7637(++_0x43f2f3);}(_0x7a54,0x106));var _0x47a5=function(_0x183c50,_0x328ef5){_0x183c50=_0x183c50-0x0;var _0x5811d8=_0x7a54[_0x183c50];return _0x5811d8;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index 3700aae..900bab1 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 _0x2fda=['lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','request','then','info','Campaign,\x20%s,\x20%s','request\x20sent','error','message','result','GetCampaign','Campaign','findAll','options','raw','where','attributes','limit','include','map','model','debug','stringify','catch'];(function(_0x4a09b6,_0x364dbc){var _0x15629b=function(_0x59b493){while(--_0x59b493){_0x4a09b6['push'](_0x4a09b6['shift']());}};_0x15629b(++_0x364dbc);}(_0x2fda,0x186));var _0xa2fd=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0x2fda[_0x47a7d0];return _0xb9bd08;};'use strict';var _=require(_0xa2fd('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa2fd('0x1'));var rs=require(_0xa2fd('0x2'));var fs=require('fs');var Redis=require(_0xa2fd('0x3'));var db=require(_0xa2fd('0x4'))['db'];var utils=require(_0xa2fd('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xa2fd('0x6'));var client=jayson[_0xa2fd('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x11994b,_0x2058d3,_0x290063){return new BPromise(function(_0x4abb3a,_0x213134){return client[_0xa2fd('0x8')](_0x11994b,_0x290063)[_0xa2fd('0x9')](function(_0x2683fc){logger[_0xa2fd('0xa')](_0xa2fd('0xb'),_0x2058d3,'request\x20sent');logger['debug']('Campaign,\x20%s,\x20%s,\x20%s',_0x2058d3,_0xa2fd('0xc'),JSON['stringify'](_0x2683fc));if(_0x2683fc[_0xa2fd('0xd')]){if(_0x2683fc[_0xa2fd('0xd')]['code']===0x1f4){logger['error'](_0xa2fd('0xb'),_0x2058d3,_0x2683fc[_0xa2fd('0xd')][_0xa2fd('0xe')]);return _0x213134(_0x2683fc[_0xa2fd('0xd')][_0xa2fd('0xe')]);}logger[_0xa2fd('0xd')]('Campaign,\x20%s,\x20%s',_0x2058d3,_0x2683fc['error'][_0xa2fd('0xe')]);return _0x4abb3a(_0x2683fc['error'][_0xa2fd('0xe')]);}else{logger['info'](_0xa2fd('0xb'),_0x2058d3,_0xa2fd('0xc'));_0x4abb3a(_0x2683fc[_0xa2fd('0xf')][_0xa2fd('0xe')]);}})['catch'](function(_0x1a64a4){logger[_0xa2fd('0xd')](_0xa2fd('0xb'),_0x2058d3,_0x1a64a4);_0x213134(_0x1a64a4);});});}exports[_0xa2fd('0x10')]=function(_0x39f7b2){var _0x5c0697=this;return new Promise(function(_0x466df1,_0x22a3aa){return db[_0xa2fd('0x11')][_0xa2fd('0x12')]({'raw':_0x39f7b2[_0xa2fd('0x13')]?_0x39f7b2[_0xa2fd('0x13')][_0xa2fd('0x14')]===undefined?!![]:![]:!![],'where':_0x39f7b2[_0xa2fd('0x13')]?_0x39f7b2[_0xa2fd('0x13')][_0xa2fd('0x15')]||null:null,'attributes':_0x39f7b2[_0xa2fd('0x13')]?_0x39f7b2['options'][_0xa2fd('0x16')]||null:null,'limit':_0x39f7b2[_0xa2fd('0x13')]?_0x39f7b2[_0xa2fd('0x13')][_0xa2fd('0x17')]||null:null,'include':_0x39f7b2[_0xa2fd('0x13')]?_0x39f7b2['options'][_0xa2fd('0x18')]?_[_0xa2fd('0x19')](_0x39f7b2[_0xa2fd('0x13')][_0xa2fd('0x18')],function(_0x3e2110){return{'model':db[_0x3e2110[_0xa2fd('0x1a')]],'as':_0x3e2110['as'],'attributes':_0x3e2110[_0xa2fd('0x16')],'include':_0x3e2110[_0xa2fd('0x18')]?_[_0xa2fd('0x19')](_0x3e2110['include'],function(_0x3c551d){return{'model':db[_0x3c551d[_0xa2fd('0x1a')]],'as':_0x3c551d['as'],'attributes':_0x3c551d[_0xa2fd('0x16')],'include':_0x3c551d['include']?_['map'](_0x3c551d[_0xa2fd('0x18')],function(_0x113739){return{'model':db[_0x113739[_0xa2fd('0x1a')]],'as':_0x113739['as'],'attributes':_0x113739[_0xa2fd('0x16')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4b700b){logger[_0xa2fd('0xa')](_0xa2fd('0x10'),_0x39f7b2);logger[_0xa2fd('0x1b')](_0xa2fd('0x10'),_0x39f7b2,JSON[_0xa2fd('0x1c')](_0x4b700b));_0x466df1(_0x4b700b);})[_0xa2fd('0x1d')](function(_0x583a19){logger[_0xa2fd('0xd')](_0xa2fd('0x10'),_0x583a19[_0xa2fd('0xe')],_0x39f7b2);_0x22a3aa(_0x5c0697[_0xa2fd('0xd')](0x1f4,_0x583a19[_0xa2fd('0xe')]));});});}; \ No newline at end of file +var _0x22a4=['limit','include','map','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','Campaign,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','Campaign,\x20%s,\x20%s','message','result','catch','GetCampaign','Campaign','options','raw','where','attributes'];(function(_0x562c8a,_0x548e22){var _0x34d8ca=function(_0xa6ce55){while(--_0xa6ce55){_0x562c8a['push'](_0x562c8a['shift']());}};_0x34d8ca(++_0x548e22);}(_0x22a4,0x1cb));var _0x422a=function(_0x4944dd,_0x5a8677){_0x4944dd=_0x4944dd-0x0;var _0x58ebba=_0x22a4[_0x4944dd];return _0x58ebba;};'use strict';var _=require(_0x422a('0x0'));var util=require(_0x422a('0x1'));var moment=require(_0x422a('0x2'));var BPromise=require(_0x422a('0x3'));var rs=require(_0x422a('0x4'));var fs=require('fs');var Redis=require(_0x422a('0x5'));var db=require(_0x422a('0x6'))['db'];var utils=require(_0x422a('0x7'));var logger=require('../../config/logger')(_0x422a('0x8'));var config=require(_0x422a('0x9'));var jayson=require(_0x422a('0xa'));var client=jayson[_0x422a('0xb')][_0x422a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5e8fe2,_0x3b5c92,_0x1b4b08){return new BPromise(function(_0x23b1b0,_0x392224){return client[_0x422a('0xd')](_0x5e8fe2,_0x1b4b08)[_0x422a('0xe')](function(_0x317466){logger[_0x422a('0xf')]('Campaign,\x20%s,\x20%s',_0x3b5c92,'request\x20sent');logger[_0x422a('0x10')](_0x422a('0x11'),_0x3b5c92,_0x422a('0x12'),JSON[_0x422a('0x13')](_0x317466));if(_0x317466[_0x422a('0x14')]){if(_0x317466[_0x422a('0x14')]['code']===0x1f4){logger['error'](_0x422a('0x15'),_0x3b5c92,_0x317466['error']['message']);return _0x392224(_0x317466['error'][_0x422a('0x16')]);}logger[_0x422a('0x14')](_0x422a('0x15'),_0x3b5c92,_0x317466[_0x422a('0x14')][_0x422a('0x16')]);return _0x23b1b0(_0x317466[_0x422a('0x14')][_0x422a('0x16')]);}else{logger[_0x422a('0xf')](_0x422a('0x15'),_0x3b5c92,_0x422a('0x12'));_0x23b1b0(_0x317466[_0x422a('0x17')][_0x422a('0x16')]);}})[_0x422a('0x18')](function(_0x3d5033){logger[_0x422a('0x14')](_0x422a('0x15'),_0x3b5c92,_0x3d5033);_0x392224(_0x3d5033);});});}exports[_0x422a('0x19')]=function(_0x5e2507){var _0x30847a=this;return new Promise(function(_0x3c5d86,_0x5b29fc){return db[_0x422a('0x1a')]['findAll']({'raw':_0x5e2507['options']?_0x5e2507[_0x422a('0x1b')][_0x422a('0x1c')]===undefined?!![]:![]:!![],'where':_0x5e2507[_0x422a('0x1b')]?_0x5e2507[_0x422a('0x1b')][_0x422a('0x1d')]||null:null,'attributes':_0x5e2507[_0x422a('0x1b')]?_0x5e2507[_0x422a('0x1b')][_0x422a('0x1e')]||null:null,'limit':_0x5e2507['options']?_0x5e2507[_0x422a('0x1b')][_0x422a('0x1f')]||null:null,'include':_0x5e2507[_0x422a('0x1b')]?_0x5e2507[_0x422a('0x1b')][_0x422a('0x20')]?_['map'](_0x5e2507[_0x422a('0x1b')][_0x422a('0x20')],function(_0x6e209d){return{'model':db[_0x6e209d['model']],'as':_0x6e209d['as'],'attributes':_0x6e209d[_0x422a('0x1e')],'include':_0x6e209d[_0x422a('0x20')]?_[_0x422a('0x21')](_0x6e209d[_0x422a('0x20')],function(_0xfc8699){return{'model':db[_0xfc8699[_0x422a('0x22')]],'as':_0xfc8699['as'],'attributes':_0xfc8699[_0x422a('0x1e')],'include':_0xfc8699[_0x422a('0x20')]?_['map'](_0xfc8699[_0x422a('0x20')],function(_0x15d2ab){return{'model':db[_0x15d2ab['model']],'as':_0x15d2ab['as'],'attributes':_0x15d2ab[_0x422a('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1b88ae){logger[_0x422a('0xf')](_0x422a('0x19'),_0x5e2507);logger[_0x422a('0x10')]('GetCampaign',_0x5e2507,JSON[_0x422a('0x13')](_0x1b88ae));_0x3c5d86(_0x1b88ae);})[_0x422a('0x18')](function(_0x50cc29){logger['error'](_0x422a('0x19'),_0x50cc29[_0x422a('0x16')],_0x5e2507);_0x5b29fc(_0x30847a['error'](0x1f4,_0x50cc29['message']));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 58740b6..b0aba33 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 _0x7e1b=['getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','/:id/clone','addLists','addBlackLists','put','/:id','delete','destroy','removeLists','removeBlackLists','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','isAuthenticated','index','show','/:id/hoppers','getHoppers','/:id/hopper_histories'];(function(_0x52e740,_0x2c3ccc){var _0x55236e=function(_0x19c2a5){while(--_0x19c2a5){_0x52e740['push'](_0x52e740['shift']());}};_0x55236e(++_0x2c3ccc);}(_0x7e1b,0x79));var _0xb7e1=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0x7e1b[_0x2c7618];return _0x5ce3f0;};'use strict';var multer=require('multer');var util=require(_0xb7e1('0x0'));var path=require('path');var timeout=require(_0xb7e1('0x1'));var express=require(_0xb7e1('0x2'));var router=express[_0xb7e1('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb7e1('0x4'));var interaction=require(_0xb7e1('0x5'));var config=require(_0xb7e1('0x6'));var controller=require(_0xb7e1('0x7'));router[_0xb7e1('0x8')]('/',auth[_0xb7e1('0x9')](),controller[_0xb7e1('0xa')]);router['get']('/:id',auth[_0xb7e1('0x9')](),controller[_0xb7e1('0xb')]);router['get'](_0xb7e1('0xc'),auth[_0xb7e1('0x9')](),controller[_0xb7e1('0xd')]);router['get'](_0xb7e1('0xe'),auth[_0xb7e1('0x9')](),controller[_0xb7e1('0xf')]);router['get'](_0xb7e1('0x10'),auth['isAuthenticated'](),controller[_0xb7e1('0x11')]);router[_0xb7e1('0x8')](_0xb7e1('0x12'),auth[_0xb7e1('0x9')](),controller['getHopperBlacks']);router[_0xb7e1('0x8')](_0xb7e1('0x13'),auth[_0xb7e1('0x9')](),controller[_0xb7e1('0x14')]);router['get'](_0xb7e1('0x15'),auth[_0xb7e1('0x9')](),controller[_0xb7e1('0x16')]);router[_0xb7e1('0x17')]('/',auth['isAuthenticated'](),controller['create']);router[_0xb7e1('0x17')](_0xb7e1('0x18'),auth[_0xb7e1('0x9')](),controller['clone']);router[_0xb7e1('0x17')]('/:id/lists',auth['isAuthenticated'](),controller[_0xb7e1('0x19')]);router['post'](_0xb7e1('0x15'),auth[_0xb7e1('0x9')](),controller[_0xb7e1('0x1a')]);router[_0xb7e1('0x1b')](_0xb7e1('0x1c'),auth[_0xb7e1('0x9')](),controller['update']);router[_0xb7e1('0x1d')](_0xb7e1('0x1c'),auth[_0xb7e1('0x9')](),controller[_0xb7e1('0x1e')]);router[_0xb7e1('0x1d')](_0xb7e1('0x13'),auth[_0xb7e1('0x9')](),controller[_0xb7e1('0x1f')]);router[_0xb7e1('0x1d')](_0xb7e1('0x15'),auth['isAuthenticated'](),controller[_0xb7e1('0x20')]);module[_0xb7e1('0x21')]=router; \ No newline at end of file +var _0xd609=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','create','addBlackLists','put','/:id','update','delete','removeLists','removeBlackLists','exports','path','Router','fs-extra'];(function(_0xce76ac,_0x1b65ad){var _0x5dd7eb=function(_0x44616d){while(--_0x44616d){_0xce76ac['push'](_0xce76ac['shift']());}};_0x5dd7eb(++_0x1b65ad);}(_0xd609,0x10b));var _0x9d60=function(_0x5da2ae,_0x11ea35){_0x5da2ae=_0x5da2ae-0x0;var _0x495714=_0xd609[_0x5da2ae];return _0x495714;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9d60('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9d60('0x1')]();var fs_extra=require(_0x9d60('0x2'));var auth=require(_0x9d60('0x3'));var interaction=require(_0x9d60('0x4'));var config=require(_0x9d60('0x5'));var controller=require('./campaign.controller');router[_0x9d60('0x6')]('/',auth[_0x9d60('0x7')](),controller[_0x9d60('0x8')]);router[_0x9d60('0x6')]('/:id',auth[_0x9d60('0x7')](),controller[_0x9d60('0x9')]);router['get'](_0x9d60('0xa'),auth[_0x9d60('0x7')](),controller[_0x9d60('0xb')]);router[_0x9d60('0x6')](_0x9d60('0xc'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0x9d60('0x6')]('/:id/hopper_finals',auth[_0x9d60('0x7')](),controller[_0x9d60('0xd')]);router['get'](_0x9d60('0xe'),auth[_0x9d60('0x7')](),controller[_0x9d60('0xf')]);router[_0x9d60('0x6')](_0x9d60('0x10'),auth[_0x9d60('0x7')](),controller[_0x9d60('0x11')]);router[_0x9d60('0x6')](_0x9d60('0x12'),auth['isAuthenticated'](),controller[_0x9d60('0x13')]);router[_0x9d60('0x14')]('/',auth[_0x9d60('0x7')](),controller[_0x9d60('0x15')]);router['post']('/:id/clone',auth[_0x9d60('0x7')](),controller['clone']);router[_0x9d60('0x14')](_0x9d60('0x10'),auth[_0x9d60('0x7')](),controller['addLists']);router['post'](_0x9d60('0x12'),auth[_0x9d60('0x7')](),controller[_0x9d60('0x16')]);router[_0x9d60('0x17')](_0x9d60('0x18'),auth[_0x9d60('0x7')](),controller[_0x9d60('0x19')]);router['delete'](_0x9d60('0x18'),auth['isAuthenticated'](),controller['destroy']);router[_0x9d60('0x1a')](_0x9d60('0x10'),auth[_0x9d60('0x7')](),controller[_0x9d60('0x1b')]);router[_0x9d60('0x1a')](_0x9d60('0x12'),auth[_0x9d60('0x7')](),controller[_0x9d60('0x1c')]);module[_0x9d60('0x1d')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 73a1f03..23ca8d0 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 _0xf5be=['exports','TEXT','STRING','getDataValue','key','sequelize'];(function(_0x176317,_0x4897b3){var _0xef2759=function(_0x581e2b){while(--_0x581e2b){_0x176317['push'](_0x176317['shift']());}};_0xef2759(++_0x4897b3);}(_0xf5be,0x173));var _0xef5b=function(_0x31a1f3,_0x423331){_0x31a1f3=_0x31a1f3-0x0;var _0x3d8fd3=_0xf5be[_0x31a1f3];return _0x3d8fd3;};'use strict';var Sequelize=require(_0xef5b('0x0'));module[_0xef5b('0x1')]={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0xef5b('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xef5b('0x3')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xef5b('0x4')](_0xef5b('0x5'));}}}; \ No newline at end of file +var _0x4471=['getDataValue','key','sequelize','exports','STRING','VIRTUAL'];(function(_0x131947,_0x5f0705){var _0x12acd6=function(_0x25a93e){while(--_0x25a93e){_0x131947['push'](_0x131947['shift']());}};_0x12acd6(++_0x5f0705);}(_0x4471,0x104));var _0x1447=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4471[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x1447('0x0'));module[_0x1447('0x1')]={'key':{'type':Sequelize[_0x1447('0x2')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize[_0x1447('0x2')]},'name':{'type':Sequelize[_0x1447('0x3')],'get':function(){return this[_0x1447('0x4')](_0x1447('0x5'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 508af55..161d63f 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 _0x0555=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','save','then','get','CannedAnswers','UserProfileResource','destroy','error','stack','name','index','map','CannedAnswer','rawAttributes','fieldName','type','key','keys','query','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','includeAll','findAll','rows','params','include','find','catch','update','body','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','create','user','role','UserProfileSection','userProfileId','autoAssociation'];(function(_0x11262d,_0x3f6d72){var _0xf8af7f=function(_0x34c0f6){while(--_0x34c0f6){_0x11262d['push'](_0x11262d['shift']());}};_0xf8af7f(++_0x3f6d72);}(_0x0555,0x1c8));var _0x5055=function(_0x25ac39,_0x3f5d68){_0x25ac39=_0x25ac39-0x0;var _0x227924=_0x0555[_0x25ac39];return _0x227924;};'use strict';var emlformat=require(_0x5055('0x0'));var rimraf=require(_0x5055('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5055('0x2'));var moment=require(_0x5055('0x3'));var BPromise=require(_0x5055('0x4'));var Mustache=require(_0x5055('0x5'));var util=require('util');var path=require(_0x5055('0x6'));var sox=require(_0x5055('0x7'));var csv=require(_0x5055('0x8'));var ejs=require(_0x5055('0x9'));var fs=require('fs');var fs_extra=require(_0x5055('0xa'));var _=require(_0x5055('0xb'));var squel=require(_0x5055('0xc'));var crypto=require(_0x5055('0xd'));var jsforce=require(_0x5055('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5055('0x8'));var querystring=require(_0x5055('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x5055('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x5055('0x11'));var hardwareService=require(_0x5055('0x12'));var logger=require(_0x5055('0x13'))(_0x5055('0x14'));var utils=require(_0x5055('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x5055('0x16'));var db=require(_0x5055('0x17'))['db'];function respondWithStatusCode(_0x5ce69f,_0x430f6e){_0x430f6e=_0x430f6e||0xcc;return function(_0x1ccfc7){if(_0x1ccfc7){return _0x5ce69f[_0x5055('0x18')](_0x430f6e);}return _0x5ce69f[_0x5055('0x19')](_0x430f6e)[_0x5055('0x1a')]();};}function respondWithResult(_0x134cb8,_0x424f15){_0x424f15=_0x424f15||0xc8;return function(_0x15324b){if(_0x15324b){return _0x134cb8[_0x5055('0x19')](_0x424f15)['json'](_0x15324b);}};}function respondWithFilteredResult(_0x367a7c,_0x5100f0){return function(_0x4c0287){if(_0x4c0287){var _0x1b7c4=typeof _0x5100f0[_0x5055('0x1b')]===_0x5055('0x1c')&&typeof _0x5100f0['limit']===_0x5055('0x1c');var _0x4df4a0=_0x4c0287[_0x5055('0x1d')];var _0x24b6bd=_0x1b7c4?0x0:_0x5100f0[_0x5055('0x1b')];var _0x216943=_0x1b7c4?_0x4c0287[_0x5055('0x1d')]:_0x5100f0[_0x5055('0x1b')]+_0x5100f0[_0x5055('0x1e')];var _0x5e150c;if(_0x216943>=_0x4df4a0){_0x216943=_0x4df4a0;_0x5e150c=0xc8;}else{_0x5e150c=0xce;}_0x367a7c[_0x5055('0x19')](_0x5e150c);return _0x367a7c[_0x5055('0x1f')](_0x5055('0x20'),_0x24b6bd+'-'+_0x216943+'/'+_0x4df4a0)[_0x5055('0x21')](_0x4c0287);}return null;};}function patchUpdates(_0x4f43f2){return function(_0x23c371){try{jsonpatch[_0x5055('0x22')](_0x23c371,_0x4f43f2,!![]);}catch(_0x33ca9b){return BPromise['reject'](_0x33ca9b);}return _0x23c371[_0x5055('0x23')]();};}function saveUpdates(_0x5119a3,_0x439ca7){return function(_0x286b15){if(_0x286b15){return _0x286b15['update'](_0x5119a3)['then'](function(_0x59fbd1){return _0x59fbd1;});}return null;};}function removeEntity(_0x6db46c,_0x42dfd1){return function(_0x4f9e74){if(_0x4f9e74){return _0x4f9e74['destroy']()[_0x5055('0x24')](function(){var _0x4332f6=_0x4f9e74[_0x5055('0x25')]({'plain':!![]});var _0x41ef30=_0x5055('0x26');return db[_0x5055('0x27')][_0x5055('0x28')]({'where':{'type':_0x41ef30,'resourceId':_0x4332f6['id']}})[_0x5055('0x24')](function(){return _0x4f9e74;});})[_0x5055('0x24')](function(){_0x6db46c[_0x5055('0x19')](0xcc)[_0x5055('0x1a')]();});}};}function handleEntityNotFound(_0x23afbc,_0x537444){return function(_0x906479){if(!_0x906479){_0x23afbc[_0x5055('0x18')](0x194);}return _0x906479;};}function handleError(_0x49c095,_0x408ed9){_0x408ed9=_0x408ed9||0x1f4;return function(_0xeb9d03){logger[_0x5055('0x29')](_0xeb9d03[_0x5055('0x2a')]);if(_0xeb9d03[_0x5055('0x2b')]){delete _0xeb9d03[_0x5055('0x2b')];}_0x49c095[_0x5055('0x19')](_0x408ed9)['send'](_0xeb9d03);};}exports[_0x5055('0x2c')]=function(_0x7ac5f0,_0x2431d7){var _0x34f080={},_0xb1a49={},_0x3f185c={'count':0x0,'rows':[]};var _0xe270b9=_[_0x5055('0x2d')](db[_0x5055('0x2e')][_0x5055('0x2f')],function(_0x417c57){return{'name':_0x417c57[_0x5055('0x30')],'type':_0x417c57[_0x5055('0x31')][_0x5055('0x32')]};});_0xb1a49['model']=_['map'](_0xe270b9,_0x5055('0x2b'));_0xb1a49['query']=_[_0x5055('0x33')](_0x7ac5f0[_0x5055('0x34')]);_0xb1a49[_0x5055('0x35')]=_[_0x5055('0x36')](_0xb1a49['model'],_0xb1a49['query']);_0x34f080[_0x5055('0x37')]=_[_0x5055('0x36')](_0xb1a49['model'],qs[_0x5055('0x38')](_0x7ac5f0[_0x5055('0x34')][_0x5055('0x38')]));_0x34f080[_0x5055('0x37')]=_0x34f080[_0x5055('0x37')][_0x5055('0x39')]?_0x34f080['attributes']:_0xb1a49[_0x5055('0x3a')];if(!_0x7ac5f0['query'][_0x5055('0x3b')](_0x5055('0x3c'))){_0x34f080[_0x5055('0x1e')]=qs['limit'](_0x7ac5f0[_0x5055('0x34')][_0x5055('0x1e')]);_0x34f080['offset']=qs[_0x5055('0x1b')](_0x7ac5f0['query'][_0x5055('0x1b')]);}_0x34f080[_0x5055('0x3d')]=qs['sort'](_0x7ac5f0[_0x5055('0x34')][_0x5055('0x3e')]);_0x34f080[_0x5055('0x3f')]=qs[_0x5055('0x35')](_[_0x5055('0x40')](_0x7ac5f0['query'],_0xb1a49[_0x5055('0x35')]),_0xe270b9);if(_0x7ac5f0[_0x5055('0x34')]['filter']){_0x34f080[_0x5055('0x3f')]=_[_0x5055('0x41')](_0x34f080['where'],{'$or':[{'key':{'$like':'%'+_0x7ac5f0[_0x5055('0x34')]['filter']+'%'}},{'value':{'$like':'%'+_0x7ac5f0[_0x5055('0x34')][_0x5055('0x42')]+'%'}}]});}_0x34f080=_[_0x5055('0x41')]({},_0x34f080,_0x7ac5f0[_0x5055('0x43')]);var _0x1c75e4={'where':_0x34f080['where']};return db[_0x5055('0x2e')]['count'](_0x1c75e4)[_0x5055('0x24')](function(_0x5e9448){_0x3f185c[_0x5055('0x1d')]=_0x5e9448;if(_0x7ac5f0[_0x5055('0x34')][_0x5055('0x44')]){_0x34f080['include']=[{'all':!![]}];}return db['CannedAnswer'][_0x5055('0x45')](_0x34f080);})[_0x5055('0x24')](function(_0x3954c6){_0x3f185c[_0x5055('0x46')]=_0x3954c6;return _0x3f185c;})['then'](respondWithFilteredResult(_0x2431d7,_0x34f080))['catch'](handleError(_0x2431d7,null));};exports['show']=function(_0xe6ffd2,_0xe33bde){var _0x330eb4={'raw':!![],'where':{'id':_0xe6ffd2[_0x5055('0x47')]['id']}},_0xec2085={};_0xec2085[_0x5055('0x3a')]=_[_0x5055('0x33')](db[_0x5055('0x2e')][_0x5055('0x2f')]);_0xec2085['query']=_[_0x5055('0x33')](_0xe6ffd2[_0x5055('0x34')]);_0xec2085[_0x5055('0x35')]=_['intersection'](_0xec2085[_0x5055('0x3a')],_0xec2085[_0x5055('0x34')]);_0x330eb4['attributes']=_[_0x5055('0x36')](_0xec2085[_0x5055('0x3a')],qs['fields'](_0xe6ffd2[_0x5055('0x34')][_0x5055('0x38')]));_0x330eb4['attributes']=_0x330eb4['attributes'][_0x5055('0x39')]?_0x330eb4['attributes']:_0xec2085[_0x5055('0x3a')];if(_0xe6ffd2['query'][_0x5055('0x44')]){_0x330eb4[_0x5055('0x48')]=[{'all':!![]}];}_0x330eb4=_['merge']({},_0x330eb4,_0xe6ffd2[_0x5055('0x43')]);return db['CannedAnswer'][_0x5055('0x49')](_0x330eb4)[_0x5055('0x24')](handleEntityNotFound(_0xe33bde,null))[_0x5055('0x24')](respondWithResult(_0xe33bde,null))[_0x5055('0x4a')](handleError(_0xe33bde,null));};exports[_0x5055('0x4b')]=function(_0x56a02b,_0x582de4){if(_0x56a02b['body']['id']){delete _0x56a02b[_0x5055('0x4c')]['id'];}return db[_0x5055('0x2e')][_0x5055('0x49')]({'where':{'id':_0x56a02b[_0x5055('0x47')]['id']}})[_0x5055('0x24')](handleEntityNotFound(_0x582de4,null))[_0x5055('0x24')](saveUpdates(_0x56a02b['body'],null))[_0x5055('0x24')](respondWithResult(_0x582de4,null))[_0x5055('0x4a')](handleError(_0x582de4,null));};exports[_0x5055('0x28')]=function(_0x10dc92,_0x4502aa){return db['CannedAnswer'][_0x5055('0x49')]({'where':{'id':_0x10dc92['params']['id']}})[_0x5055('0x24')](handleEntityNotFound(_0x4502aa,null))[_0x5055('0x24')](removeEntity(_0x4502aa,null))[_0x5055('0x4a')](handleError(_0x4502aa,null));};exports['create']=function(_0x3fe4c3,_0x42e1f9){var _0x1ed07d={'key':_0x3fe4c3['body'][_0x5055('0x32')]};if(_0x3fe4c3[_0x5055('0x4c')][_0x5055('0x4d')]){_0x1ed07d[_0x5055('0x4d')]=_0x3fe4c3['body'][_0x5055('0x4d')];}else if(_0x3fe4c3['body'][_0x5055('0x4e')]){_0x1ed07d[_0x5055('0x4e')]=_0x3fe4c3[_0x5055('0x4c')][_0x5055('0x4e')];}else if(_0x3fe4c3[_0x5055('0x4c')][_0x5055('0x4f')]){_0x1ed07d[_0x5055('0x4f')]=_0x3fe4c3[_0x5055('0x4c')][_0x5055('0x4f')];}else if(_0x3fe4c3['body'][_0x5055('0x50')]){_0x1ed07d[_0x5055('0x50')]=_0x3fe4c3[_0x5055('0x4c')]['ChatWebsiteId'];}return db['CannedAnswer'][_0x5055('0x49')]({'where':_0x1ed07d})[_0x5055('0x24')](function(_0x34af52){if(_0x34af52){throw new db[(_0x5055('0x51'))][(_0x5055('0x52'))](_0x5055('0x53'));}return db['CannedAnswer'][_0x5055('0x54')](_0x3fe4c3[_0x5055('0x4c')]);})[_0x5055('0x24')](function(_0x3a1e54){var _0x313d7d=_0x3fe4c3[_0x5055('0x55')][_0x5055('0x25')]({'plain':!![]});if(!_0x313d7d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x313d7d[_0x5055('0x56')]==='user'){var _0x41f5d2=_0x3a1e54[_0x5055('0x25')]({'plain':!![]});return db[_0x5055('0x57')][_0x5055('0x49')]({'where':{'name':'CannedAnswers','userProfileId':_0x313d7d[_0x5055('0x58')]},'raw':!![]})[_0x5055('0x24')](function(_0x1a955d){if(_0x1a955d&&_0x1a955d[_0x5055('0x59')]===0x0){return db[_0x5055('0x27')][_0x5055('0x54')]({'name':_0x41f5d2[_0x5055('0x2b')],'resourceId':_0x41f5d2['id'],'type':_0x1a955d['name'],'sectionId':_0x1a955d['id']},{})[_0x5055('0x24')](function(){return _0x3a1e54;});}else{return _0x3a1e54;}})['catch'](function(_0x17d0b6){logger[_0x5055('0x29')](_0x5055('0x5a'),_0x17d0b6);throw _0x17d0b6;});}return _0x3a1e54;})[_0x5055('0x24')](respondWithResult(_0x42e1f9,0xc9))['catch'](handleError(_0x42e1f9,null));}; \ No newline at end of file +var _0xe1f5=['intersection','includeAll','body','find','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','ValidationError','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','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','count','set','Content-Range','apply','save','update','destroy','then','get','CannedAnswers','stack','name','index','map','CannedAnswer','type','key','model','query','filters','fields','attributes','length','hasOwnProperty','limit','sort','where','filter','merge','options','include','rows','catch','params','keys'];(function(_0x4eed8d,_0x2ae215){var _0x5257a9=function(_0x452b0b){while(--_0x452b0b){_0x4eed8d['push'](_0x4eed8d['shift']());}};_0x5257a9(++_0x2ae215);}(_0xe1f5,0x66));var _0x5e1f=function(_0x36c9f2,_0x2a032f){_0x36c9f2=_0x36c9f2-0x0;var _0x3a9284=_0xe1f5[_0x36c9f2];return _0x3a9284;};'use strict';var emlformat=require(_0x5e1f('0x0'));var rimraf=require(_0x5e1f('0x1'));var zipdir=require(_0x5e1f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5e1f('0x3'));var BPromise=require(_0x5e1f('0x4'));var Mustache=require(_0x5e1f('0x5'));var util=require('util');var path=require(_0x5e1f('0x6'));var sox=require(_0x5e1f('0x7'));var csv=require('to-csv');var ejs=require(_0x5e1f('0x8'));var fs=require('fs');var fs_extra=require(_0x5e1f('0x9'));var _=require(_0x5e1f('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5e1f('0xb'));var deskjs=require(_0x5e1f('0xc'));var toCsv=require(_0x5e1f('0xd'));var querystring=require(_0x5e1f('0xe'));var Papa=require(_0x5e1f('0xf'));var Redis=require(_0x5e1f('0x10'));var authService=require(_0x5e1f('0x11'));var qs=require(_0x5e1f('0x12'));var as=require(_0x5e1f('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5e1f('0x14'))(_0x5e1f('0x15'));var utils=require(_0x5e1f('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5e1f('0x17'));var db=require(_0x5e1f('0x18'))['db'];function respondWithStatusCode(_0x44435a,_0x4d66be){_0x4d66be=_0x4d66be||0xcc;return function(_0xc9bf6c){if(_0xc9bf6c){return _0x44435a[_0x5e1f('0x19')](_0x4d66be);}return _0x44435a[_0x5e1f('0x1a')](_0x4d66be)[_0x5e1f('0x1b')]();};}function respondWithResult(_0x4f90c5,_0x1e2107){_0x1e2107=_0x1e2107||0xc8;return function(_0x6dd172){if(_0x6dd172){return _0x4f90c5[_0x5e1f('0x1a')](_0x1e2107)[_0x5e1f('0x1c')](_0x6dd172);}};}function respondWithFilteredResult(_0xe2a65e,_0x8d44ee){return function(_0x4000f2){if(_0x4000f2){var _0x1831c3=typeof _0x8d44ee[_0x5e1f('0x1d')]===_0x5e1f('0x1e')&&typeof _0x8d44ee['limit']===_0x5e1f('0x1e');var _0x2d5c23=_0x4000f2[_0x5e1f('0x1f')];var _0x509b3f=_0x1831c3?0x0:_0x8d44ee[_0x5e1f('0x1d')];var _0x31981b=_0x1831c3?_0x4000f2[_0x5e1f('0x1f')]:_0x8d44ee[_0x5e1f('0x1d')]+_0x8d44ee['limit'];var _0x2fdd46;if(_0x31981b>=_0x2d5c23){_0x31981b=_0x2d5c23;_0x2fdd46=0xc8;}else{_0x2fdd46=0xce;}_0xe2a65e['status'](_0x2fdd46);return _0xe2a65e[_0x5e1f('0x20')](_0x5e1f('0x21'),_0x509b3f+'-'+_0x31981b+'/'+_0x2d5c23)[_0x5e1f('0x1c')](_0x4000f2);}return null;};}function patchUpdates(_0x45c740){return function(_0x13c128){try{jsonpatch[_0x5e1f('0x22')](_0x13c128,_0x45c740,!![]);}catch(_0x2df292){return BPromise['reject'](_0x2df292);}return _0x13c128[_0x5e1f('0x23')]();};}function saveUpdates(_0x45c908,_0x12827b){return function(_0x1cf911){if(_0x1cf911){return _0x1cf911[_0x5e1f('0x24')](_0x45c908)['then'](function(_0x34df99){return _0x34df99;});}return null;};}function removeEntity(_0xf7cf90,_0x309ed8){return function(_0x3fe060){if(_0x3fe060){return _0x3fe060[_0x5e1f('0x25')]()[_0x5e1f('0x26')](function(){var _0x2a152b=_0x3fe060[_0x5e1f('0x27')]({'plain':!![]});var _0x443d0c=_0x5e1f('0x28');return db['UserProfileResource'][_0x5e1f('0x25')]({'where':{'type':_0x443d0c,'resourceId':_0x2a152b['id']}})['then'](function(){return _0x3fe060;});})[_0x5e1f('0x26')](function(){_0xf7cf90[_0x5e1f('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3aec16,_0x44bb19){return function(_0x109250){if(!_0x109250){_0x3aec16[_0x5e1f('0x19')](0x194);}return _0x109250;};}function handleError(_0x214ab0,_0x2c128d){_0x2c128d=_0x2c128d||0x1f4;return function(_0x1d8d8e){logger['error'](_0x1d8d8e[_0x5e1f('0x29')]);if(_0x1d8d8e[_0x5e1f('0x2a')]){delete _0x1d8d8e[_0x5e1f('0x2a')];}_0x214ab0['status'](_0x2c128d)['send'](_0x1d8d8e);};}exports[_0x5e1f('0x2b')]=function(_0x2489d1,_0x70e415){var _0x4a5e6e={},_0x5b9f1f={},_0x6bae48={'count':0x0,'rows':[]};var _0x32ef91=_[_0x5e1f('0x2c')](db[_0x5e1f('0x2d')]['rawAttributes'],function(_0xa65efc){return{'name':_0xa65efc['fieldName'],'type':_0xa65efc[_0x5e1f('0x2e')][_0x5e1f('0x2f')]};});_0x5b9f1f[_0x5e1f('0x30')]=_[_0x5e1f('0x2c')](_0x32ef91,_0x5e1f('0x2a'));_0x5b9f1f[_0x5e1f('0x31')]=_['keys'](_0x2489d1['query']);_0x5b9f1f[_0x5e1f('0x32')]=_['intersection'](_0x5b9f1f['model'],_0x5b9f1f[_0x5e1f('0x31')]);_0x4a5e6e['attributes']=_['intersection'](_0x5b9f1f[_0x5e1f('0x30')],qs[_0x5e1f('0x33')](_0x2489d1[_0x5e1f('0x31')][_0x5e1f('0x33')]));_0x4a5e6e['attributes']=_0x4a5e6e[_0x5e1f('0x34')][_0x5e1f('0x35')]?_0x4a5e6e[_0x5e1f('0x34')]:_0x5b9f1f[_0x5e1f('0x30')];if(!_0x2489d1[_0x5e1f('0x31')][_0x5e1f('0x36')]('nolimit')){_0x4a5e6e[_0x5e1f('0x37')]=qs[_0x5e1f('0x37')](_0x2489d1[_0x5e1f('0x31')][_0x5e1f('0x37')]);_0x4a5e6e['offset']=qs[_0x5e1f('0x1d')](_0x2489d1[_0x5e1f('0x31')]['offset']);}_0x4a5e6e['order']=qs[_0x5e1f('0x38')](_0x2489d1[_0x5e1f('0x31')][_0x5e1f('0x38')]);_0x4a5e6e[_0x5e1f('0x39')]=qs['filters'](_['pick'](_0x2489d1[_0x5e1f('0x31')],_0x5b9f1f[_0x5e1f('0x32')]),_0x32ef91);if(_0x2489d1[_0x5e1f('0x31')]['filter']){_0x4a5e6e[_0x5e1f('0x39')]=_['merge'](_0x4a5e6e[_0x5e1f('0x39')],{'$or':[{'key':{'$like':'%'+_0x2489d1[_0x5e1f('0x31')][_0x5e1f('0x3a')]+'%'}},{'value':{'$like':'%'+_0x2489d1['query'][_0x5e1f('0x3a')]+'%'}}]});}_0x4a5e6e=_[_0x5e1f('0x3b')]({},_0x4a5e6e,_0x2489d1[_0x5e1f('0x3c')]);var _0x47fbe4={'where':_0x4a5e6e[_0x5e1f('0x39')]};return db[_0x5e1f('0x2d')]['count'](_0x47fbe4)['then'](function(_0x121ca7){_0x6bae48[_0x5e1f('0x1f')]=_0x121ca7;if(_0x2489d1[_0x5e1f('0x31')]['includeAll']){_0x4a5e6e[_0x5e1f('0x3d')]=[{'all':!![]}];}return db[_0x5e1f('0x2d')]['findAll'](_0x4a5e6e);})[_0x5e1f('0x26')](function(_0x2fb567){_0x6bae48[_0x5e1f('0x3e')]=_0x2fb567;return _0x6bae48;})['then'](respondWithFilteredResult(_0x70e415,_0x4a5e6e))[_0x5e1f('0x3f')](handleError(_0x70e415,null));};exports['show']=function(_0x50ef5e,_0x2ddb73){var _0x53e822={'raw':!![],'where':{'id':_0x50ef5e[_0x5e1f('0x40')]['id']}},_0x343552={};_0x343552[_0x5e1f('0x30')]=_[_0x5e1f('0x41')](db[_0x5e1f('0x2d')]['rawAttributes']);_0x343552[_0x5e1f('0x31')]=_[_0x5e1f('0x41')](_0x50ef5e[_0x5e1f('0x31')]);_0x343552[_0x5e1f('0x32')]=_[_0x5e1f('0x42')](_0x343552[_0x5e1f('0x30')],_0x343552['query']);_0x53e822[_0x5e1f('0x34')]=_[_0x5e1f('0x42')](_0x343552['model'],qs[_0x5e1f('0x33')](_0x50ef5e[_0x5e1f('0x31')][_0x5e1f('0x33')]));_0x53e822[_0x5e1f('0x34')]=_0x53e822[_0x5e1f('0x34')][_0x5e1f('0x35')]?_0x53e822[_0x5e1f('0x34')]:_0x343552['model'];if(_0x50ef5e[_0x5e1f('0x31')][_0x5e1f('0x43')]){_0x53e822['include']=[{'all':!![]}];}_0x53e822=_[_0x5e1f('0x3b')]({},_0x53e822,_0x50ef5e[_0x5e1f('0x3c')]);return db[_0x5e1f('0x2d')]['find'](_0x53e822)[_0x5e1f('0x26')](handleEntityNotFound(_0x2ddb73,null))['then'](respondWithResult(_0x2ddb73,null))[_0x5e1f('0x3f')](handleError(_0x2ddb73,null));};exports['update']=function(_0x52c643,_0x22064e){if(_0x52c643[_0x5e1f('0x44')]['id']){delete _0x52c643[_0x5e1f('0x44')]['id'];}return db[_0x5e1f('0x2d')]['find']({'where':{'id':_0x52c643[_0x5e1f('0x40')]['id']}})['then'](handleEntityNotFound(_0x22064e,null))[_0x5e1f('0x26')](saveUpdates(_0x52c643['body'],null))['then'](respondWithResult(_0x22064e,null))['catch'](handleError(_0x22064e,null));};exports[_0x5e1f('0x25')]=function(_0x8d434a,_0x4c4c70){return db[_0x5e1f('0x2d')][_0x5e1f('0x45')]({'where':{'id':_0x8d434a[_0x5e1f('0x40')]['id']}})['then'](handleEntityNotFound(_0x4c4c70,null))[_0x5e1f('0x26')](removeEntity(_0x4c4c70,null))[_0x5e1f('0x3f')](handleError(_0x4c4c70,null));};exports[_0x5e1f('0x46')]=function(_0x55f07d,_0x4b3db9){var _0x2111fe={'key':_0x55f07d[_0x5e1f('0x44')]['key']};if(_0x55f07d[_0x5e1f('0x44')][_0x5e1f('0x47')]){_0x2111fe[_0x5e1f('0x47')]=_0x55f07d[_0x5e1f('0x44')][_0x5e1f('0x47')];}else if(_0x55f07d[_0x5e1f('0x44')][_0x5e1f('0x48')]){_0x2111fe[_0x5e1f('0x48')]=_0x55f07d[_0x5e1f('0x44')]['SmsAccountId'];}else if(_0x55f07d[_0x5e1f('0x44')][_0x5e1f('0x49')]){_0x2111fe[_0x5e1f('0x49')]=_0x55f07d[_0x5e1f('0x44')][_0x5e1f('0x49')];}else if(_0x55f07d[_0x5e1f('0x44')]['ChatWebsiteId']){_0x2111fe[_0x5e1f('0x4a')]=_0x55f07d[_0x5e1f('0x44')]['ChatWebsiteId'];}return db['CannedAnswer'][_0x5e1f('0x45')]({'where':_0x2111fe})[_0x5e1f('0x26')](function(_0x1eed13){if(_0x1eed13){throw new db['Sequelize'][(_0x5e1f('0x4b'))]('The\x20inserted\x20key\x20already\x20exists.');}return db['CannedAnswer'][_0x5e1f('0x46')](_0x55f07d['body']);})['then'](function(_0x14f0fa){var _0x5e466c=_0x55f07d['user'][_0x5e1f('0x27')]({'plain':!![]});if(!_0x5e466c)throw new Error(_0x5e1f('0x4c'));if(_0x5e466c[_0x5e1f('0x4d')]===_0x5e1f('0x4e')){var _0x393c29=_0x14f0fa[_0x5e1f('0x27')]({'plain':!![]});return db[_0x5e1f('0x4f')]['find']({'where':{'name':'CannedAnswers','userProfileId':_0x5e466c[_0x5e1f('0x50')]},'raw':!![]})['then'](function(_0x30f9a5){if(_0x30f9a5&&_0x30f9a5[_0x5e1f('0x51')]===0x0){return db[_0x5e1f('0x52')][_0x5e1f('0x46')]({'name':_0x393c29['name'],'resourceId':_0x393c29['id'],'type':_0x30f9a5[_0x5e1f('0x2a')],'sectionId':_0x30f9a5['id']},{})[_0x5e1f('0x26')](function(){return _0x14f0fa;});}else{return _0x14f0fa;}})[_0x5e1f('0x3f')](function(_0x3b4aa6){logger[_0x5e1f('0x53')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3b4aa6);throw _0x3b4aa6;});}return _0x14f0fa;})[_0x5e1f('0x26')](respondWithResult(_0x4b3db9,0xc9))['catch'](handleError(_0x4b3db9,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 062520c..572ce03 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 _0x1371=['request-promise','path','rimraf','../../config/environment','./cannedAnswer.attributes','exports','CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird'];(function(_0x4e8df1,_0x3c655d){var _0x51f50e=function(_0x26f3ab){while(--_0x26f3ab){_0x4e8df1['push'](_0x4e8df1['shift']());}};_0x51f50e(++_0x3c655d);}(_0x1371,0x91));var _0x1137=function(_0x2e23dd,_0xf137d0){_0x2e23dd=_0x2e23dd-0x0;var _0x4bd4c1=_0x1371[_0x2e23dd];return _0x4bd4c1;};'use strict';var _=require(_0x1137('0x0'));var util=require(_0x1137('0x1'));var logger=require(_0x1137('0x2'))('api');var moment=require(_0x1137('0x3'));var BPromise=require(_0x1137('0x4'));var rp=require(_0x1137('0x5'));var fs=require('fs');var path=require(_0x1137('0x6'));var rimraf=require(_0x1137('0x7'));var config=require(_0x1137('0x8'));var attributes=require(_0x1137('0x9'));module[_0x1137('0xa')]=function(_0x5d9cf0,_0x1933a8){return _0x5d9cf0['define'](_0x1137('0xb'),attributes,{'tableName':_0x1137('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1137('0xd'),'collate':_0x1137('0xe')});}; \ No newline at end of file +var _0x4be8=['../../config/logger','api','request-promise','path','rimraf','../../config/environment','./cannedAnswer.attributes','exports','define','CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x354aa6,_0x14f5b2){var _0x3c7c0f=function(_0x38fc10){while(--_0x38fc10){_0x354aa6['push'](_0x354aa6['shift']());}};_0x3c7c0f(++_0x14f5b2);}(_0x4be8,0x12a));var _0x84be=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0x4be8[_0x3511d3];return _0x5d6321;};'use strict';var _=require(_0x84be('0x0'));var util=require(_0x84be('0x1'));var logger=require(_0x84be('0x2'))(_0x84be('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x84be('0x4'));var fs=require('fs');var path=require(_0x84be('0x5'));var rimraf=require(_0x84be('0x6'));var config=require(_0x84be('0x7'));var attributes=require(_0x84be('0x8'));module[_0x84be('0x9')]=function(_0x38d233,_0x59ac51){return _0x38d233[_0x84be('0xa')](_0x84be('0xb'),attributes,{'tableName':_0x84be('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x84be('0xd'),'collate':_0x84be('0xe')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 37ace00..2c4d420 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(_0x4f78b0,_0x5cbf1e){var _0x5acca2=function(_0x3179da){while(--_0x3179da){_0x4f78b0['push'](_0x4f78b0['shift']());}};_0x5acca2(++_0x5cbf1e);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xa9e0[_0xf0bcac];return _0x4e4c65;};'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(_0xe3cc08,_0x4be703){var _0x108fe4=function(_0x4bbb69){while(--_0x4bbb69){_0xe3cc08['push'](_0xe3cc08['shift']());}};_0x108fe4(++_0x4be703);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa9e0[_0x1facfa];return _0x9ec701;};'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 3089647..2d13614 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 _0x633b=['fs-extra','../../config/environment','get','isAuthenticated','post','create','put','/:id','update','exports','multer','util','path','connect-timeout','express','Router'];(function(_0xe16fcf,_0x2b5918){var _0x5981e9=function(_0x494df2){while(--_0x494df2){_0xe16fcf['push'](_0xe16fcf['shift']());}};_0x5981e9(++_0x2b5918);}(_0x633b,0x8a));var _0xb633=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x633b[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xb633('0x0'));var util=require(_0xb633('0x1'));var path=require(_0xb633('0x2'));var timeout=require(_0xb633('0x3'));var express=require(_0xb633('0x4'));var router=express[_0xb633('0x5')]();var fs_extra=require(_0xb633('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb633('0x7'));var controller=require('./cannedAnswer.controller');router[_0xb633('0x8')]('/',auth[_0xb633('0x9')](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0xb633('0xa')]('/',auth[_0xb633('0x9')](),controller[_0xb633('0xb')]);router[_0xb633('0xc')](_0xb633('0xd'),auth[_0xb633('0x9')](),controller[_0xb633('0xe')]);router['delete'](_0xb633('0xd'),auth[_0xb633('0x9')](),controller['destroy']);module[_0xb633('0xf')]=router; \ No newline at end of file +var _0xe8a0=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','exports','multer','util','path'];(function(_0x551735,_0x5d4a6e){var _0x4aaf38=function(_0x3fa8cd){while(--_0x3fa8cd){_0x551735['push'](_0x551735['shift']());}};_0x4aaf38(++_0x5d4a6e);}(_0xe8a0,0x13d));var _0x0e8a=function(_0x5262d7,_0x5e9b39){_0x5262d7=_0x5262d7-0x0;var _0x49623f=_0xe8a0[_0x5262d7];return _0x49623f;};'use strict';var multer=require(_0x0e8a('0x0'));var util=require(_0x0e8a('0x1'));var path=require(_0x0e8a('0x2'));var timeout=require(_0x0e8a('0x3'));var express=require(_0x0e8a('0x4'));var router=express[_0x0e8a('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x0e8a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x0e8a('0x7'));var controller=require(_0x0e8a('0x8'));router[_0x0e8a('0x9')]('/',auth[_0x0e8a('0xa')](),controller[_0x0e8a('0xb')]);router[_0x0e8a('0x9')](_0x0e8a('0xc'),auth[_0x0e8a('0xa')](),controller[_0x0e8a('0xd')]);router[_0x0e8a('0xe')]('/',auth[_0x0e8a('0xa')](),controller[_0x0e8a('0xf')]);router[_0x0e8a('0x10')](_0x0e8a('0xc'),auth[_0x0e8a('0xa')](),controller[_0x0e8a('0x11')]);router[_0x0e8a('0x12')]('/:id',auth[_0x0e8a('0xa')](),controller['destroy']);module[_0x0e8a('0x13')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 432b57d..a238eee 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 _0x16e4=['INTEGER','sequelize','exports','DATE','1970-01-01\x2000:00:01','STRING'];(function(_0x257a53,_0x45f592){var _0x2601bc=function(_0x1e3692){while(--_0x1e3692){_0x257a53['push'](_0x257a53['shift']());}};_0x2601bc(++_0x45f592);}(_0x16e4,0x97));var _0x416e=function(_0x4e375e,_0x18a335){_0x4e375e=_0x4e375e-0x0;var _0xdad840=_0x16e4[_0x4e375e];return _0xdad840;};'use strict';var Sequelize=require(_0x416e('0x0'));module[_0x416e('0x1')]={'calldate':{'type':Sequelize[_0x416e('0x2')],'allowNull':![],'defaultValue':_0x416e('0x3')},'clid':{'type':Sequelize[_0x416e('0x4')]},'src':{'type':Sequelize[_0x416e('0x4')]},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize[_0x416e('0x4')]},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize[_0x416e('0x4')]},'lastapp':{'type':Sequelize[_0x416e('0x4')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0x416e('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x416e('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x416e('0x4')]},'amaflags':{'type':Sequelize[_0x416e('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x416e('0x4')]},'userfield':{'type':Sequelize[_0x416e('0x4')]},'uniqueid':{'type':Sequelize[_0x416e('0x4')]},'linkedid':{'type':Sequelize[_0x416e('0x4')]},'sequence':{'type':Sequelize[_0x416e('0x4')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x416e('0x4')]},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2f38=['1970-01-01\x2000:00:01','STRING','INTEGER','exports'];(function(_0xa1208b,_0x12254a){var _0x35cb85=function(_0x21d10b){while(--_0x21d10b){_0xa1208b['push'](_0xa1208b['shift']());}};_0x35cb85(++_0x12254a);}(_0x2f38,0x1a7));var _0x82f3=function(_0x54e24b,_0x45751d){_0x54e24b=_0x54e24b-0x0;var _0x1c444f=_0x2f38[_0x54e24b];return _0x1c444f;};'use strict';var Sequelize=require('sequelize');module[_0x82f3('0x0')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0x82f3('0x1')},'clid':{'type':Sequelize[_0x82f3('0x2')]},'src':{'type':Sequelize[_0x82f3('0x2')]},'dst':{'type':Sequelize[_0x82f3('0x2')]},'dcontext':{'type':Sequelize[_0x82f3('0x2')]},'channel':{'type':Sequelize[_0x82f3('0x2')]},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize[_0x82f3('0x2')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x82f3('0x3')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x82f3('0x2')]},'amaflags':{'type':Sequelize[_0x82f3('0x3')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x82f3('0x2')]},'userfield':{'type':Sequelize[_0x82f3('0x2')]},'uniqueid':{'type':Sequelize[_0x82f3('0x2')]},'linkedid':{'type':Sequelize[_0x82f3('0x2')]},'sequence':{'type':Sequelize[_0x82f3('0x2')]},'peeraccount':{'type':Sequelize[_0x82f3('0x2')]},'type':{'type':Sequelize[_0x82f3('0x2')]},'tag':{'type':Sequelize[_0x82f3('0x2')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 046110e..762f197 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 _0x6aa7=['includeAll','find','create','body','catch','describe','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','Cdr','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','length','attributes','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','show'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0x6aa7,0x178));var _0x76aa=function(_0x31ced3,_0x4f06de){_0x31ced3=_0x31ced3-0x0;var _0x3d69d3=_0x6aa7[_0x31ced3];return _0x3d69d3;};'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('0x2d')](_0x1e90b9,_0x76aa('0x2b'));_0x365ff8[_0x76aa('0x33')]=_[_0x76aa('0x34')](_0x3fcb7f[_0x76aa('0x33')]);_0x365ff8[_0x76aa('0x35')]=_['intersection'](_0x365ff8[_0x76aa('0x32')],_0x365ff8[_0x76aa('0x33')]);_0x994550['attributes']=_[_0x76aa('0x36')](_0x365ff8['model'],qs[_0x76aa('0x37')](_0x3fcb7f['query'][_0x76aa('0x37')]));_0x994550['attributes']=_0x994550['attributes'][_0x76aa('0x38')]?_0x994550[_0x76aa('0x39')]:_0x365ff8[_0x76aa('0x32')];if(!_0x3fcb7f[_0x76aa('0x33')]['hasOwnProperty']('nolimit')){_0x994550[_0x76aa('0x1f')]=qs[_0x76aa('0x1f')](_0x3fcb7f[_0x76aa('0x33')][_0x76aa('0x1f')]);_0x994550[_0x76aa('0x1e')]=qs['offset'](_0x3fcb7f[_0x76aa('0x33')]['offset']);}_0x994550['order']=qs[_0x76aa('0x3a')](_0x3fcb7f[_0x76aa('0x33')][_0x76aa('0x3a')]);_0x994550[_0x76aa('0x3b')]=qs['filters'](_[_0x76aa('0x3c')](_0x3fcb7f[_0x76aa('0x33')],_0x365ff8[_0x76aa('0x35')]),_0x1e90b9);if(_0x3fcb7f['query'][_0x76aa('0x3d')]){_0x994550[_0x76aa('0x3b')]=_[_0x76aa('0x3e')](_0x994550[_0x76aa('0x3b')],{'$or':_[_0x76aa('0x2d')](_0x1e90b9,function(_0x982e62){if(_0x982e62[_0x76aa('0x31')]!==_0x76aa('0x3f')){var _0x283179={};_0x283179[_0x982e62['name']]={'$like':'%'+_0x3fcb7f[_0x76aa('0x33')][_0x76aa('0x3d')]+'%'};return _0x283179;}})});}_0x994550=_[_0x76aa('0x3e')]({},_0x994550,_0x3fcb7f[_0x76aa('0x40')]);var _0x64612e={'where':_0x994550[_0x76aa('0x3b')]};return db['Cdr']['count'](_0x64612e)[_0x76aa('0x27')](function(_0x262906){_0x2dec94[_0x76aa('0x1d')]=_0x262906;if(_0x3fcb7f[_0x76aa('0x33')]['includeAll']){_0x994550[_0x76aa('0x41')]=[{'all':!![]}];}return db[_0x76aa('0x2e')][_0x76aa('0x42')](_0x994550);})[_0x76aa('0x27')](function(_0x1138b5){_0x2dec94['rows']=_0x1138b5;return _0x2dec94;})[_0x76aa('0x27')](respondWithFilteredResult(_0x5a8030,_0x994550))['catch'](handleError(_0x5a8030,null));};exports[_0x76aa('0x43')]=function(_0x54b8fd,_0x496304){var _0x4f7f3a={'raw':!![],'where':{'id':_0x54b8fd['params']['id']}},_0x144f0a={};_0x144f0a['model']=_['keys'](db[_0x76aa('0x2e')][_0x76aa('0x2f')]);_0x144f0a[_0x76aa('0x33')]=_[_0x76aa('0x34')](_0x54b8fd[_0x76aa('0x33')]);_0x144f0a['filters']=_[_0x76aa('0x36')](_0x144f0a[_0x76aa('0x32')],_0x144f0a[_0x76aa('0x33')]);_0x4f7f3a[_0x76aa('0x39')]=_[_0x76aa('0x36')](_0x144f0a['model'],qs[_0x76aa('0x37')](_0x54b8fd[_0x76aa('0x33')]['fields']));_0x4f7f3a[_0x76aa('0x39')]=_0x4f7f3a['attributes'][_0x76aa('0x38')]?_0x4f7f3a[_0x76aa('0x39')]:_0x144f0a[_0x76aa('0x32')];if(_0x54b8fd[_0x76aa('0x33')][_0x76aa('0x44')]){_0x4f7f3a[_0x76aa('0x41')]=[{'all':!![]}];}_0x4f7f3a=_[_0x76aa('0x3e')]({},_0x4f7f3a,_0x54b8fd[_0x76aa('0x40')]);return db[_0x76aa('0x2e')][_0x76aa('0x45')](_0x4f7f3a)['then'](handleEntityNotFound(_0x496304,null))[_0x76aa('0x27')](respondWithResult(_0x496304,null))['catch'](handleError(_0x496304,null));};exports[_0x76aa('0x46')]=function(_0x3d3332,_0x5e95f5){return db[_0x76aa('0x2e')]['create'](_0x3d3332['body'],{})[_0x76aa('0x27')](respondWithResult(_0x5e95f5,0xc9))['catch'](handleError(_0x5e95f5,null));};exports[_0x76aa('0x26')]=function(_0x302a0c,_0x4315b3){if(_0x302a0c[_0x76aa('0x47')]['id']){delete _0x302a0c[_0x76aa('0x47')]['id'];}return db[_0x76aa('0x2e')]['find']({'where':{'id':_0x302a0c['params']['id']}})[_0x76aa('0x27')](handleEntityNotFound(_0x4315b3,null))[_0x76aa('0x27')](saveUpdates(_0x302a0c[_0x76aa('0x47')],null))[_0x76aa('0x27')](respondWithResult(_0x4315b3,null))[_0x76aa('0x48')](handleError(_0x4315b3,null));};exports[_0x76aa('0x28')]=function(_0x4c52d5,_0x95b7c5){return db[_0x76aa('0x2e')][_0x76aa('0x45')]({'where':{'id':_0x4c52d5['params']['id']}})[_0x76aa('0x27')](handleEntityNotFound(_0x95b7c5,null))['then'](removeEntity(_0x95b7c5,null))[_0x76aa('0x48')](handleError(_0x95b7c5,null));};exports['describe']=function(_0x339b0d,_0x4449c1){return db[_0x76aa('0x2e')][_0x76aa('0x49')]()[_0x76aa('0x27')](respondWithResult(_0x4449c1,null))[_0x76aa('0x48')](handleError(_0x4449c1,null));}; \ No newline at end of file +var _0xe5d5=['status','end','offset','limit','undefined','count','set','Content-Range','json','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','Cdr','rawAttributes','type','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','length','find','create','body','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x23f5cd,_0x3d6ba5){var _0x4265e7=function(_0xdc08c1){while(--_0xdc08c1){_0x23f5cd['push'](_0x23f5cd['shift']());}};_0x4265e7(++_0x3d6ba5);}(_0xe5d5,0x156));var _0x5e5d=function(_0x41c618,_0x1ba347){_0x41c618=_0x41c618-0x0;var _0x3fbd2=_0xe5d5[_0x41c618];return _0x3fbd2;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x5e5d('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5e5d('0x1'));var moment=require('moment');var BPromise=require(_0x5e5d('0x2'));var Mustache=require('mustache');var util=require(_0x5e5d('0x3'));var path=require(_0x5e5d('0x4'));var sox=require(_0x5e5d('0x5'));var csv=require(_0x5e5d('0x6'));var ejs=require(_0x5e5d('0x7'));var fs=require('fs');var fs_extra=require(_0x5e5d('0x8'));var _=require(_0x5e5d('0x9'));var squel=require(_0x5e5d('0xa'));var crypto=require(_0x5e5d('0xb'));var jsforce=require(_0x5e5d('0xc'));var deskjs=require(_0x5e5d('0xd'));var toCsv=require(_0x5e5d('0x6'));var querystring=require(_0x5e5d('0xe'));var Papa=require(_0x5e5d('0xf'));var Redis=require('ioredis');var authService=require(_0x5e5d('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x5e5d('0x11'));var hardwareService=require(_0x5e5d('0x12'));var logger=require('../../config/logger')(_0x5e5d('0x13'));var utils=require(_0x5e5d('0x14'));var config=require(_0x5e5d('0x15'));var licenseUtil=require(_0x5e5d('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4ff045,_0x442aed){_0x442aed=_0x442aed||0xcc;return function(_0x1e9be5){if(_0x1e9be5){return _0x4ff045['sendStatus'](_0x442aed);}return _0x4ff045[_0x5e5d('0x17')](_0x442aed)[_0x5e5d('0x18')]();};}function respondWithResult(_0x5a4474,_0x42f1f8){_0x42f1f8=_0x42f1f8||0xc8;return function(_0x3402cf){if(_0x3402cf){return _0x5a4474['status'](_0x42f1f8)['json'](_0x3402cf);}};}function respondWithFilteredResult(_0x5bf617,_0x1a3e5c){return function(_0x3dfb7e){if(_0x3dfb7e){var _0x79e8c1=typeof _0x1a3e5c[_0x5e5d('0x19')]==='undefined'&&typeof _0x1a3e5c[_0x5e5d('0x1a')]===_0x5e5d('0x1b');var _0x39964a=_0x3dfb7e[_0x5e5d('0x1c')];var _0x46b129=_0x79e8c1?0x0:_0x1a3e5c[_0x5e5d('0x19')];var _0x3b655b=_0x79e8c1?_0x3dfb7e[_0x5e5d('0x1c')]:_0x1a3e5c['offset']+_0x1a3e5c[_0x5e5d('0x1a')];var _0x1ceea7;if(_0x3b655b>=_0x39964a){_0x3b655b=_0x39964a;_0x1ceea7=0xc8;}else{_0x1ceea7=0xce;}_0x5bf617[_0x5e5d('0x17')](_0x1ceea7);return _0x5bf617[_0x5e5d('0x1d')](_0x5e5d('0x1e'),_0x46b129+'-'+_0x3b655b+'/'+_0x39964a)[_0x5e5d('0x1f')](_0x3dfb7e);}return null;};}function patchUpdates(_0x517b89){return function(_0x186fa6){try{jsonpatch['apply'](_0x186fa6,_0x517b89,!![]);}catch(_0x968d4b){return BPromise[_0x5e5d('0x20')](_0x968d4b);}return _0x186fa6[_0x5e5d('0x21')]();};}function saveUpdates(_0x4c9973,_0xbacdcb){return function(_0x488a49){if(_0x488a49){return _0x488a49[_0x5e5d('0x22')](_0x4c9973)[_0x5e5d('0x23')](function(_0x3e8a1d){return _0x3e8a1d;});}return null;};}function removeEntity(_0x49a558,_0x49d2e5){return function(_0x271af4){if(_0x271af4){return _0x271af4[_0x5e5d('0x24')]()['then'](function(){_0x49a558['status'](0xcc)[_0x5e5d('0x18')]();});}};}function handleEntityNotFound(_0x4063d5,_0xd466f7){return function(_0x479a1a){if(!_0x479a1a){_0x4063d5[_0x5e5d('0x25')](0x194);}return _0x479a1a;};}function handleError(_0x4de26a,_0x477d54){_0x477d54=_0x477d54||0x1f4;return function(_0x4ed6e5){logger[_0x5e5d('0x26')](_0x4ed6e5[_0x5e5d('0x27')]);if(_0x4ed6e5[_0x5e5d('0x28')]){delete _0x4ed6e5[_0x5e5d('0x28')];}_0x4de26a[_0x5e5d('0x17')](_0x477d54)[_0x5e5d('0x29')](_0x4ed6e5);};}exports[_0x5e5d('0x2a')]=function(_0x56b166,_0x3e407f){var _0x29a123={},_0x3442c1={},_0x4511cd={'count':0x0,'rows':[]};var _0x1f8484=_[_0x5e5d('0x2b')](db[_0x5e5d('0x2c')][_0x5e5d('0x2d')],function(_0x4fe915){return{'name':_0x4fe915['fieldName'],'type':_0x4fe915[_0x5e5d('0x2e')]['key']};});_0x3442c1['model']=_[_0x5e5d('0x2b')](_0x1f8484,_0x5e5d('0x28'));_0x3442c1[_0x5e5d('0x2f')]=_[_0x5e5d('0x30')](_0x56b166[_0x5e5d('0x2f')]);_0x3442c1['filters']=_[_0x5e5d('0x31')](_0x3442c1[_0x5e5d('0x32')],_0x3442c1[_0x5e5d('0x2f')]);_0x29a123[_0x5e5d('0x33')]=_[_0x5e5d('0x31')](_0x3442c1[_0x5e5d('0x32')],qs[_0x5e5d('0x34')](_0x56b166['query'][_0x5e5d('0x34')]));_0x29a123[_0x5e5d('0x33')]=_0x29a123['attributes']['length']?_0x29a123[_0x5e5d('0x33')]:_0x3442c1[_0x5e5d('0x32')];if(!_0x56b166[_0x5e5d('0x2f')][_0x5e5d('0x35')](_0x5e5d('0x36'))){_0x29a123[_0x5e5d('0x1a')]=qs['limit'](_0x56b166[_0x5e5d('0x2f')]['limit']);_0x29a123[_0x5e5d('0x19')]=qs[_0x5e5d('0x19')](_0x56b166[_0x5e5d('0x2f')][_0x5e5d('0x19')]);}_0x29a123[_0x5e5d('0x37')]=qs['sort'](_0x56b166[_0x5e5d('0x2f')][_0x5e5d('0x38')]);_0x29a123['where']=qs[_0x5e5d('0x39')](_['pick'](_0x56b166[_0x5e5d('0x2f')],_0x3442c1[_0x5e5d('0x39')]),_0x1f8484);if(_0x56b166[_0x5e5d('0x2f')][_0x5e5d('0x3a')]){_0x29a123[_0x5e5d('0x3b')]=_[_0x5e5d('0x3c')](_0x29a123[_0x5e5d('0x3b')],{'$or':_[_0x5e5d('0x2b')](_0x1f8484,function(_0xa51e05){if(_0xa51e05[_0x5e5d('0x2e')]!==_0x5e5d('0x3d')){var _0x1e3106={};_0x1e3106[_0xa51e05['name']]={'$like':'%'+_0x56b166[_0x5e5d('0x2f')][_0x5e5d('0x3a')]+'%'};return _0x1e3106;}})});}_0x29a123=_[_0x5e5d('0x3c')]({},_0x29a123,_0x56b166[_0x5e5d('0x3e')]);var _0x225ad5={'where':_0x29a123[_0x5e5d('0x3b')]};return db['Cdr'][_0x5e5d('0x1c')](_0x225ad5)[_0x5e5d('0x23')](function(_0x4c2667){_0x4511cd[_0x5e5d('0x1c')]=_0x4c2667;if(_0x56b166[_0x5e5d('0x2f')][_0x5e5d('0x3f')]){_0x29a123[_0x5e5d('0x40')]=[{'all':!![]}];}return db[_0x5e5d('0x2c')][_0x5e5d('0x41')](_0x29a123);})['then'](function(_0x502aac){_0x4511cd[_0x5e5d('0x42')]=_0x502aac;return _0x4511cd;})['then'](respondWithFilteredResult(_0x3e407f,_0x29a123))[_0x5e5d('0x43')](handleError(_0x3e407f,null));};exports['show']=function(_0x53d75c,_0x2d12cd){var _0x52648c={'raw':!![],'where':{'id':_0x53d75c[_0x5e5d('0x44')]['id']}},_0x550d7a={};_0x550d7a[_0x5e5d('0x32')]=_[_0x5e5d('0x30')](db[_0x5e5d('0x2c')][_0x5e5d('0x2d')]);_0x550d7a[_0x5e5d('0x2f')]=_['keys'](_0x53d75c['query']);_0x550d7a['filters']=_[_0x5e5d('0x31')](_0x550d7a['model'],_0x550d7a[_0x5e5d('0x2f')]);_0x52648c[_0x5e5d('0x33')]=_['intersection'](_0x550d7a[_0x5e5d('0x32')],qs[_0x5e5d('0x34')](_0x53d75c['query'][_0x5e5d('0x34')]));_0x52648c[_0x5e5d('0x33')]=_0x52648c[_0x5e5d('0x33')][_0x5e5d('0x45')]?_0x52648c[_0x5e5d('0x33')]:_0x550d7a['model'];if(_0x53d75c[_0x5e5d('0x2f')][_0x5e5d('0x3f')]){_0x52648c[_0x5e5d('0x40')]=[{'all':!![]}];}_0x52648c=_[_0x5e5d('0x3c')]({},_0x52648c,_0x53d75c[_0x5e5d('0x3e')]);return db[_0x5e5d('0x2c')][_0x5e5d('0x46')](_0x52648c)[_0x5e5d('0x23')](handleEntityNotFound(_0x2d12cd,null))['then'](respondWithResult(_0x2d12cd,null))[_0x5e5d('0x43')](handleError(_0x2d12cd,null));};exports[_0x5e5d('0x47')]=function(_0x1824ec,_0x5d6369){return db[_0x5e5d('0x2c')][_0x5e5d('0x47')](_0x1824ec['body'],{})[_0x5e5d('0x23')](respondWithResult(_0x5d6369,0xc9))[_0x5e5d('0x43')](handleError(_0x5d6369,null));};exports[_0x5e5d('0x22')]=function(_0x56e0ac,_0x3df625){if(_0x56e0ac[_0x5e5d('0x48')]['id']){delete _0x56e0ac[_0x5e5d('0x48')]['id'];}return db[_0x5e5d('0x2c')][_0x5e5d('0x46')]({'where':{'id':_0x56e0ac['params']['id']}})[_0x5e5d('0x23')](handleEntityNotFound(_0x3df625,null))['then'](saveUpdates(_0x56e0ac['body'],null))[_0x5e5d('0x23')](respondWithResult(_0x3df625,null))['catch'](handleError(_0x3df625,null));};exports[_0x5e5d('0x24')]=function(_0x41c3a0,_0x5b3149){return db[_0x5e5d('0x2c')][_0x5e5d('0x46')]({'where':{'id':_0x41c3a0['params']['id']}})['then'](handleEntityNotFound(_0x5b3149,null))[_0x5e5d('0x23')](removeEntity(_0x5b3149,null))[_0x5e5d('0x43')](handleError(_0x5b3149,null));};exports['describe']=function(_0x25065c,_0x46ff94){return db[_0x5e5d('0x2c')]['describe']()[_0x5e5d('0x23')](respondWithResult(_0x46ff94,null))[_0x5e5d('0x43')](handleError(_0x46ff94,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index d7ab7f9..60bda7f 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(_0x1ed99e,_0x2f17ea){var _0x662a9b=function(_0x2c36ec){while(--_0x2c36ec){_0x1ed99e['push'](_0x1ed99e['shift']());}};_0x662a9b(++_0x2f17ea);}(_0x7a54,0x106));var _0x47a5=function(_0x30c7a1,_0x261243){_0x30c7a1=_0x30c7a1-0x0;var _0x17ac9c=_0x7a54[_0x30c7a1];return _0x17ac9c;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file +var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x567b75,_0x4cc83f){var _0xcd3ce3=function(_0x942845){while(--_0x942845){_0x567b75['push'](_0x567b75['shift']());}};_0xcd3ce3(++_0x4cc83f);}(_0x7a54,0x106));var _0x47a5=function(_0x4e5839,_0x410fae){_0x4e5839=_0x4e5839-0x0;var _0x352bf3=_0x7a54[_0x4e5839];return _0x352bf3;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 8c08882..55cfac5 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 _0x0c8d=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','then','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','code','error','Cdr,\x20%s,\x20%s','message','info','result','catch','lodash','util','bluebird'];(function(_0x523bbd,_0x55b38c){var _0x3685e5=function(_0x5dd4b3){while(--_0x5dd4b3){_0x523bbd['push'](_0x523bbd['shift']());}};_0x3685e5(++_0x55b38c);}(_0x0c8d,0x179));var _0xd0c8=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0x0c8d[_0x5f309e];return _0x487b5e;};'use strict';var _=require(_0xd0c8('0x0'));var util=require(_0xd0c8('0x1'));var moment=require('moment');var BPromise=require(_0xd0c8('0x2'));var rs=require(_0xd0c8('0x3'));var fs=require('fs');var Redis=require(_0xd0c8('0x4'));var db=require(_0xd0c8('0x5'))['db'];var utils=require(_0xd0c8('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xd0c8('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xd0c8('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x517694,_0x4d8782,_0x4e46e8){return new BPromise(function(_0x1b38ba,_0x3ea477){return client['request'](_0x517694,_0x4e46e8)[_0xd0c8('0x9')](function(_0xbfbf6b){logger['info']('Cdr,\x20%s,\x20%s',_0x4d8782,_0xd0c8('0xa'));logger[_0xd0c8('0xb')](_0xd0c8('0xc'),_0x4d8782,_0xd0c8('0xa'),JSON['stringify'](_0xbfbf6b));if(_0xbfbf6b['error']){if(_0xbfbf6b['error'][_0xd0c8('0xd')]===0x1f4){logger[_0xd0c8('0xe')](_0xd0c8('0xf'),_0x4d8782,_0xbfbf6b[_0xd0c8('0xe')]['message']);return _0x3ea477(_0xbfbf6b[_0xd0c8('0xe')][_0xd0c8('0x10')]);}logger[_0xd0c8('0xe')](_0xd0c8('0xf'),_0x4d8782,_0xbfbf6b[_0xd0c8('0xe')][_0xd0c8('0x10')]);return _0x1b38ba(_0xbfbf6b[_0xd0c8('0xe')][_0xd0c8('0x10')]);}else{logger[_0xd0c8('0x11')](_0xd0c8('0xf'),_0x4d8782,_0xd0c8('0xa'));_0x1b38ba(_0xbfbf6b[_0xd0c8('0x12')][_0xd0c8('0x10')]);}})[_0xd0c8('0x13')](function(_0x4bf1d6){logger[_0xd0c8('0xe')](_0xd0c8('0xf'),_0x4d8782,_0x4bf1d6);_0x3ea477(_0x4bf1d6);});});} \ No newline at end of file +var _0xbcc0=['then','info','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','Cdr,\x20%s,\x20%s','message','result','catch','util','moment','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','request'];(function(_0x41c188,_0x45f248){var _0x53de15=function(_0x1fa054){while(--_0x1fa054){_0x41c188['push'](_0x41c188['shift']());}};_0x53de15(++_0x45f248);}(_0xbcc0,0x1eb));var _0x0bcc=function(_0x19b7a1,_0x467981){_0x19b7a1=_0x19b7a1-0x0;var _0x2ab86b=_0xbcc0[_0x19b7a1];return _0x2ab86b;};'use strict';var _=require('lodash');var util=require(_0x0bcc('0x0'));var moment=require(_0x0bcc('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0bcc('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x0bcc('0x3'));var logger=require(_0x0bcc('0x4'))('rpc');var config=require(_0x0bcc('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x0bcc('0x6')][_0x0bcc('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x460de4,_0x33bad7,_0x2a16fc){return new BPromise(function(_0x154ea4,_0x28fb71){return client[_0x0bcc('0x8')](_0x460de4,_0x2a16fc)[_0x0bcc('0x9')](function(_0x15fcf9){logger[_0x0bcc('0xa')]('Cdr,\x20%s,\x20%s',_0x33bad7,_0x0bcc('0xb'));logger[_0x0bcc('0xc')](_0x0bcc('0xd'),_0x33bad7,_0x0bcc('0xb'),JSON[_0x0bcc('0xe')](_0x15fcf9));if(_0x15fcf9[_0x0bcc('0xf')]){if(_0x15fcf9[_0x0bcc('0xf')]['code']===0x1f4){logger[_0x0bcc('0xf')](_0x0bcc('0x10'),_0x33bad7,_0x15fcf9[_0x0bcc('0xf')][_0x0bcc('0x11')]);return _0x28fb71(_0x15fcf9['error'][_0x0bcc('0x11')]);}logger[_0x0bcc('0xf')](_0x0bcc('0x10'),_0x33bad7,_0x15fcf9[_0x0bcc('0xf')]['message']);return _0x154ea4(_0x15fcf9[_0x0bcc('0xf')][_0x0bcc('0x11')]);}else{logger[_0x0bcc('0xa')](_0x0bcc('0x10'),_0x33bad7,_0x0bcc('0xb'));_0x154ea4(_0x15fcf9[_0x0bcc('0x12')]['message']);}})[_0x0bcc('0x13')](function(_0x2c8002){logger[_0x0bcc('0xf')](_0x0bcc('0x10'),_0x33bad7,_0x2c8002);_0x28fb71(_0x2c8002);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 33d4d48..935b14c 100644 --- a/server/api/cdr/index.js +++ b/server/api/cdr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x508767,_0x369e53){var _0x2480fe=function(_0x25957e){while(--_0x25957e){_0x508767['push'](_0x508767['shift']());}};_0x2480fe(++_0x369e53);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +var _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(_0x40d8d7,_0x30dd5e){var _0x3454cc=function(_0x512c1b){while(--_0x512c1b){_0x40d8d7['push'](_0x40d8d7['shift']());}};_0x3454cc(++_0x30dd5e);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 998fbc9..4b18154 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 _0x28b9=['exports','INTEGER','STRING','sequelize'];(function(_0x22868f,_0x450f48){var _0x97bc75=function(_0x447cb4){while(--_0x447cb4){_0x22868f['push'](_0x22868f['shift']());}};_0x97bc75(++_0x450f48);}(_0x28b9,0x153));var _0x928b=function(_0x1db562,_0x290e26){_0x1db562=_0x1db562-0x0;var _0xa58473=_0x28b9[_0x1db562];return _0xa58473;};'use strict';var Sequelize=require(_0x928b('0x0'));module[_0x928b('0x1')]={'priority':{'type':Sequelize[_0x928b('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x928b('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x928b('0x3')]},'interval':{'type':Sequelize[_0x928b('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x0313=['sequelize','exports','INTEGER','STRING','noop','*,*,*,*'];(function(_0xaf4e3b,_0x3527ac){var _0x37a1e1=function(_0x49dc7f){while(--_0x49dc7f){_0xaf4e3b['push'](_0xaf4e3b['shift']());}};_0x37a1e1(++_0x3527ac);}(_0x0313,0x90));var _0x3031=function(_0x2d76b2,_0x244860){_0x2d76b2=_0x2d76b2-0x0;var _0x11e968=_0x0313[_0x2d76b2];return _0x11e968;};'use strict';var Sequelize=require(_0x3031('0x0'));module[_0x3031('0x1')]={'priority':{'type':Sequelize[_0x3031('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x3031('0x3')],'allowNull':![],'defaultValue':_0x3031('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x3031('0x3')]},'interval':{'type':Sequelize[_0x3031('0x3')],'defaultValue':_0x3031('0x5')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index be058a8..c6979c8 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 _0xd66c=['error','stack','name','send','show','params','model','keys','ChatApplication','rawAttributes','query','filters','intersection','attributes','fields','length','include','merge','options','find','body','catch','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','end','json','offset','limit','count','status','set','Content-Range','reject','save','update','then','destroy','sendStatus'];(function(_0x2d899d,_0x50a985){var _0xa77840=function(_0x569e6a){while(--_0x569e6a){_0x2d899d['push'](_0x2d899d['shift']());}};_0xa77840(++_0x50a985);}(_0xd66c,0x106));var _0xcd66=function(_0x37e7f6,_0x26a83f){_0x37e7f6=_0x37e7f6-0x0;var _0x12cba3=_0xd66c[_0x37e7f6];return _0x12cba3;};'use strict';var emlformat=require(_0xcd66('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcd66('0x1'));var jsonpatch=require(_0xcd66('0x2'));var rp=require(_0xcd66('0x3'));var moment=require(_0xcd66('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xcd66('0x5'));var util=require(_0xcd66('0x6'));var path=require(_0xcd66('0x7'));var sox=require(_0xcd66('0x8'));var csv=require(_0xcd66('0x9'));var ejs=require(_0xcd66('0xa'));var fs=require('fs');var fs_extra=require(_0xcd66('0xb'));var _=require(_0xcd66('0xc'));var squel=require('squel');var crypto=require(_0xcd66('0xd'));var jsforce=require(_0xcd66('0xe'));var deskjs=require(_0xcd66('0xf'));var toCsv=require(_0xcd66('0x9'));var querystring=require(_0xcd66('0x10'));var Papa=require(_0xcd66('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xcd66('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcd66('0x13'));var logger=require(_0xcd66('0x14'))('api');var utils=require(_0xcd66('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xcd66('0x16'));var db=require(_0xcd66('0x17'))['db'];function respondWithStatusCode(_0x1cb4a9,_0x3e4e92){_0x3e4e92=_0x3e4e92||0xcc;return function(_0x35479d){if(_0x35479d){return _0x1cb4a9['sendStatus'](_0x3e4e92);}return _0x1cb4a9['status'](_0x3e4e92)[_0xcd66('0x18')]();};}function respondWithResult(_0x5d9bb4,_0x28ae0c){_0x28ae0c=_0x28ae0c||0xc8;return function(_0x588b46){if(_0x588b46){return _0x5d9bb4['status'](_0x28ae0c)[_0xcd66('0x19')](_0x588b46);}};}function respondWithFilteredResult(_0x1fafad,_0x4df4df){return function(_0x3178a7){if(_0x3178a7){var _0x3ed659=typeof _0x4df4df[_0xcd66('0x1a')]==='undefined'&&typeof _0x4df4df[_0xcd66('0x1b')]==='undefined';var _0x1268db=_0x3178a7[_0xcd66('0x1c')];var _0x191f8e=_0x3ed659?0x0:_0x4df4df[_0xcd66('0x1a')];var _0x35d431=_0x3ed659?_0x3178a7[_0xcd66('0x1c')]:_0x4df4df[_0xcd66('0x1a')]+_0x4df4df[_0xcd66('0x1b')];var _0x417907;if(_0x35d431>=_0x1268db){_0x35d431=_0x1268db;_0x417907=0xc8;}else{_0x417907=0xce;}_0x1fafad[_0xcd66('0x1d')](_0x417907);return _0x1fafad[_0xcd66('0x1e')](_0xcd66('0x1f'),_0x191f8e+'-'+_0x35d431+'/'+_0x1268db)[_0xcd66('0x19')](_0x3178a7);}return null;};}function patchUpdates(_0x2d3819){return function(_0x842033){try{jsonpatch['apply'](_0x842033,_0x2d3819,!![]);}catch(_0x3e3bea){return BPromise[_0xcd66('0x20')](_0x3e3bea);}return _0x842033[_0xcd66('0x21')]();};}function saveUpdates(_0x11c75c,_0x1cc184){return function(_0x1f8a04){if(_0x1f8a04){return _0x1f8a04[_0xcd66('0x22')](_0x11c75c)[_0xcd66('0x23')](function(_0x64424a){return _0x64424a;});}return null;};}function removeEntity(_0x35e19e,_0x5ec2d5){return function(_0x2ab69e){if(_0x2ab69e){return _0x2ab69e[_0xcd66('0x24')]()['then'](function(){_0x35e19e[_0xcd66('0x1d')](0xcc)[_0xcd66('0x18')]();});}};}function handleEntityNotFound(_0xb37e77,_0x526e13){return function(_0x141a64){if(!_0x141a64){_0xb37e77[_0xcd66('0x25')](0x194);}return _0x141a64;};}function handleError(_0x3de898,_0x54ac81){_0x54ac81=_0x54ac81||0x1f4;return function(_0x12891d){logger[_0xcd66('0x26')](_0x12891d[_0xcd66('0x27')]);if(_0x12891d[_0xcd66('0x28')]){delete _0x12891d[_0xcd66('0x28')];}_0x3de898[_0xcd66('0x1d')](_0x54ac81)[_0xcd66('0x29')](_0x12891d);};}exports[_0xcd66('0x2a')]=function(_0x51201f,_0xb6d828){var _0x51a7f6={'raw':!![],'where':{'id':_0x51201f[_0xcd66('0x2b')]['id']}},_0x2506d3={};_0x2506d3[_0xcd66('0x2c')]=_[_0xcd66('0x2d')](db[_0xcd66('0x2e')][_0xcd66('0x2f')]);_0x2506d3['query']=_[_0xcd66('0x2d')](_0x51201f[_0xcd66('0x30')]);_0x2506d3[_0xcd66('0x31')]=_[_0xcd66('0x32')](_0x2506d3['model'],_0x2506d3[_0xcd66('0x30')]);_0x51a7f6[_0xcd66('0x33')]=_[_0xcd66('0x32')](_0x2506d3[_0xcd66('0x2c')],qs[_0xcd66('0x34')](_0x51201f['query'][_0xcd66('0x34')]));_0x51a7f6[_0xcd66('0x33')]=_0x51a7f6[_0xcd66('0x33')][_0xcd66('0x35')]?_0x51a7f6['attributes']:_0x2506d3['model'];if(_0x51201f[_0xcd66('0x30')]['includeAll']){_0x51a7f6[_0xcd66('0x36')]=[{'all':!![]}];}_0x51a7f6=_[_0xcd66('0x37')]({},_0x51a7f6,_0x51201f[_0xcd66('0x38')]);return db[_0xcd66('0x2e')][_0xcd66('0x39')](_0x51a7f6)[_0xcd66('0x23')](handleEntityNotFound(_0xb6d828,null))[_0xcd66('0x23')](respondWithResult(_0xb6d828,null))['catch'](handleError(_0xb6d828,null));};exports[_0xcd66('0x22')]=function(_0x366fb2,_0x37f17a){if(_0x366fb2[_0xcd66('0x3a')]['id']){delete _0x366fb2['body']['id'];}return db[_0xcd66('0x2e')][_0xcd66('0x39')]({'where':{'id':_0x366fb2[_0xcd66('0x2b')]['id']}})[_0xcd66('0x23')](handleEntityNotFound(_0x37f17a,null))[_0xcd66('0x23')](saveUpdates(_0x366fb2[_0xcd66('0x3a')],null))[_0xcd66('0x23')](respondWithResult(_0x37f17a,null))[_0xcd66('0x3b')](handleError(_0x37f17a,null));};exports[_0xcd66('0x24')]=function(_0x1f3821,_0x218b7d){return db[_0xcd66('0x2e')][_0xcd66('0x39')]({'where':{'id':_0x1f3821[_0xcd66('0x2b')]['id']}})[_0xcd66('0x23')](handleEntityNotFound(_0x218b7d,null))[_0xcd66('0x23')](removeEntity(_0x218b7d,null))[_0xcd66('0x3b')](handleError(_0x218b7d,null));}; \ No newline at end of file +var _0xac7f=['reject','save','update','then','destroy','error','stack','name','send','show','model','ChatApplication','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','find','body','params','catch','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','apply'];(function(_0x2c1a0e,_0x58b1a2){var _0xaf8d07=function(_0x52fa58){while(--_0x52fa58){_0x2c1a0e['push'](_0x2c1a0e['shift']());}};_0xaf8d07(++_0x58b1a2);}(_0xac7f,0x1e2));var _0xfac7=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0xac7f[_0x2ec461];return _0x28603d;};'use strict';var emlformat=require(_0xfac7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfac7('0x1'));var jsonpatch=require(_0xfac7('0x2'));var rp=require(_0xfac7('0x3'));var moment=require('moment');var BPromise=require(_0xfac7('0x4'));var Mustache=require(_0xfac7('0x5'));var util=require(_0xfac7('0x6'));var path=require(_0xfac7('0x7'));var sox=require(_0xfac7('0x8'));var csv=require(_0xfac7('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfac7('0xa'));var _=require('lodash');var squel=require(_0xfac7('0xb'));var crypto=require(_0xfac7('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xfac7('0xd'));var toCsv=require(_0xfac7('0x9'));var querystring=require(_0xfac7('0xe'));var Papa=require('papaparse');var Redis=require(_0xfac7('0xf'));var authService=require(_0xfac7('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfac7('0x11'));var logger=require(_0xfac7('0x12'))(_0xfac7('0x13'));var utils=require(_0xfac7('0x14'));var config=require(_0xfac7('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xfac7('0x16'))['db'];function respondWithStatusCode(_0x56f7a1,_0x4111dd){_0x4111dd=_0x4111dd||0xcc;return function(_0x15da5d){if(_0x15da5d){return _0x56f7a1[_0xfac7('0x17')](_0x4111dd);}return _0x56f7a1[_0xfac7('0x18')](_0x4111dd)['end']();};}function respondWithResult(_0x582a03,_0x11a5fd){_0x11a5fd=_0x11a5fd||0xc8;return function(_0x5a3a06){if(_0x5a3a06){return _0x582a03[_0xfac7('0x18')](_0x11a5fd)[_0xfac7('0x19')](_0x5a3a06);}};}function respondWithFilteredResult(_0x54d738,_0x1ff0f4){return function(_0xc7a913){if(_0xc7a913){var _0x4b7479=typeof _0x1ff0f4[_0xfac7('0x1a')]===_0xfac7('0x1b')&&typeof _0x1ff0f4[_0xfac7('0x1c')]===_0xfac7('0x1b');var _0x5c6b1a=_0xc7a913[_0xfac7('0x1d')];var _0x15e3d7=_0x4b7479?0x0:_0x1ff0f4[_0xfac7('0x1a')];var _0x282636=_0x4b7479?_0xc7a913[_0xfac7('0x1d')]:_0x1ff0f4[_0xfac7('0x1a')]+_0x1ff0f4[_0xfac7('0x1c')];var _0x3f5d51;if(_0x282636>=_0x5c6b1a){_0x282636=_0x5c6b1a;_0x3f5d51=0xc8;}else{_0x3f5d51=0xce;}_0x54d738[_0xfac7('0x18')](_0x3f5d51);return _0x54d738['set']('Content-Range',_0x15e3d7+'-'+_0x282636+'/'+_0x5c6b1a)[_0xfac7('0x19')](_0xc7a913);}return null;};}function patchUpdates(_0x2207b7){return function(_0x48d266){try{jsonpatch[_0xfac7('0x1e')](_0x48d266,_0x2207b7,!![]);}catch(_0x122e9c){return BPromise[_0xfac7('0x1f')](_0x122e9c);}return _0x48d266[_0xfac7('0x20')]();};}function saveUpdates(_0x2c70dd,_0x147c3c){return function(_0x2e8f11){if(_0x2e8f11){return _0x2e8f11[_0xfac7('0x21')](_0x2c70dd)[_0xfac7('0x22')](function(_0x46e150){return _0x46e150;});}return null;};}function removeEntity(_0x57958f,_0x83785e){return function(_0x20c33c){if(_0x20c33c){return _0x20c33c[_0xfac7('0x23')]()[_0xfac7('0x22')](function(){_0x57958f[_0xfac7('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x325158,_0xdf60cc){return function(_0x2aa0a0){if(!_0x2aa0a0){_0x325158[_0xfac7('0x17')](0x194);}return _0x2aa0a0;};}function handleError(_0x2e413c,_0x195c13){_0x195c13=_0x195c13||0x1f4;return function(_0x4ab1ed){logger[_0xfac7('0x24')](_0x4ab1ed[_0xfac7('0x25')]);if(_0x4ab1ed['name']){delete _0x4ab1ed[_0xfac7('0x26')];}_0x2e413c[_0xfac7('0x18')](_0x195c13)[_0xfac7('0x27')](_0x4ab1ed);};}exports[_0xfac7('0x28')]=function(_0xe354b9,_0x27c494){var _0x4af388={'raw':!![],'where':{'id':_0xe354b9['params']['id']}},_0x3f9c66={};_0x3f9c66[_0xfac7('0x29')]=_['keys'](db[_0xfac7('0x2a')][_0xfac7('0x2b')]);_0x3f9c66[_0xfac7('0x2c')]=_['keys'](_0xe354b9[_0xfac7('0x2c')]);_0x3f9c66[_0xfac7('0x2d')]=_[_0xfac7('0x2e')](_0x3f9c66[_0xfac7('0x29')],_0x3f9c66[_0xfac7('0x2c')]);_0x4af388[_0xfac7('0x2f')]=_[_0xfac7('0x2e')](_0x3f9c66[_0xfac7('0x29')],qs[_0xfac7('0x30')](_0xe354b9['query'][_0xfac7('0x30')]));_0x4af388[_0xfac7('0x2f')]=_0x4af388['attributes'][_0xfac7('0x31')]?_0x4af388[_0xfac7('0x2f')]:_0x3f9c66[_0xfac7('0x29')];if(_0xe354b9[_0xfac7('0x2c')][_0xfac7('0x32')]){_0x4af388[_0xfac7('0x33')]=[{'all':!![]}];}_0x4af388=_[_0xfac7('0x34')]({},_0x4af388,_0xe354b9['options']);return db['ChatApplication'][_0xfac7('0x35')](_0x4af388)['then'](handleEntityNotFound(_0x27c494,null))['then'](respondWithResult(_0x27c494,null))['catch'](handleError(_0x27c494,null));};exports[_0xfac7('0x21')]=function(_0x130228,_0x153bca){if(_0x130228[_0xfac7('0x36')]['id']){delete _0x130228[_0xfac7('0x36')]['id'];}return db['ChatApplication'][_0xfac7('0x35')]({'where':{'id':_0x130228[_0xfac7('0x37')]['id']}})[_0xfac7('0x22')](handleEntityNotFound(_0x153bca,null))['then'](saveUpdates(_0x130228[_0xfac7('0x36')],null))['then'](respondWithResult(_0x153bca,null))[_0xfac7('0x38')](handleError(_0x153bca,null));};exports[_0xfac7('0x23')]=function(_0x72a460,_0x62e354){return db[_0xfac7('0x2a')][_0xfac7('0x35')]({'where':{'id':_0x72a460[_0xfac7('0x37')]['id']}})[_0xfac7('0x22')](handleEntityNotFound(_0x62e354,null))[_0xfac7('0x22')](removeEntity(_0x62e354,null))[_0xfac7('0x38')](handleError(_0x62e354,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 1544f14..9144416 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 _0xb4b6=['api','moment','request-promise','rimraf','./chatApplication.attributes','exports','define','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x1faaa1,_0x1568dd){var _0x994ec=function(_0x298ef4){while(--_0x298ef4){_0x1faaa1['push'](_0x1faaa1['shift']());}};_0x994ec(++_0x1568dd);}(_0xb4b6,0x115));var _0x6b4b=function(_0x5324c9,_0x1cdc42){_0x5324c9=_0x5324c9-0x0;var _0x137b3b=_0xb4b6[_0x5324c9];return _0x137b3b;};'use strict';var _=require(_0x6b4b('0x0'));var util=require(_0x6b4b('0x1'));var logger=require(_0x6b4b('0x2'))(_0x6b4b('0x3'));var moment=require(_0x6b4b('0x4'));var BPromise=require('bluebird');var rp=require(_0x6b4b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6b4b('0x6'));var config=require('../../config/environment');var attributes=require(_0x6b4b('0x7'));module[_0x6b4b('0x8')]=function(_0x4fa770,_0x372308){return _0x4fa770[_0x6b4b('0x9')](_0x6b4b('0xa'),attributes,{'tableName':_0x6b4b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6b4b('0xc'),'collate':_0x6b4b('0xd')});}; \ No newline at end of file +var _0xfe17=['./chatApplication.attributes','exports','define','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0xd29287,_0x1c6230){var _0x5636e8=function(_0x53d11c){while(--_0x53d11c){_0xd29287['push'](_0xd29287['shift']());}};_0x5636e8(++_0x1c6230);}(_0xfe17,0x147));var _0x7fe1=function(_0x101217,_0xc6b170){_0x101217=_0x101217-0x0;var _0x4184bb=_0xfe17[_0x101217];return _0x4184bb;};'use strict';var _=require(_0x7fe1('0x0'));var util=require(_0x7fe1('0x1'));var logger=require(_0x7fe1('0x2'))(_0x7fe1('0x3'));var moment=require(_0x7fe1('0x4'));var BPromise=require(_0x7fe1('0x5'));var rp=require(_0x7fe1('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7fe1('0x7'));var config=require(_0x7fe1('0x8'));var attributes=require(_0x7fe1('0x9'));module[_0x7fe1('0xa')]=function(_0x3bd37c,_0x5e63d2){return _0x3bd37c[_0x7fe1('0xb')](_0x7fe1('0xc'),attributes,{'tableName':_0x7fe1('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7fe1('0xe'),'collate':_0x7fe1('0xf')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 38b0927..0b53a0b 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 _0x8cb7=['../../mysqldb','../../config/logger','jayson/promise','client','http','then','ChatApplication,\x20%s,\x20%s','request\x20sent','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','ioredis'];(function(_0x12c1f1,_0x7829e2){var _0x42efaf=function(_0x4b7152){while(--_0x4b7152){_0x12c1f1['push'](_0x12c1f1['shift']());}};_0x42efaf(++_0x7829e2);}(_0x8cb7,0x164));var _0x78cb=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x8cb7[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x78cb('0x0'));var util=require(_0x78cb('0x1'));var moment=require(_0x78cb('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x78cb('0x3'));var db=require(_0x78cb('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x78cb('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x78cb('0x6'));var client=jayson[_0x78cb('0x7')][_0x78cb('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1f1de8,_0x4b2259,_0x59a652){return new BPromise(function(_0x4ba636,_0x22dc1a){return client['request'](_0x1f1de8,_0x59a652)[_0x78cb('0x9')](function(_0xc9306e){logger['info'](_0x78cb('0xa'),_0x4b2259,_0x78cb('0xb'));logger['debug'](_0x78cb('0xc'),_0x4b2259,_0x78cb('0xb'),JSON[_0x78cb('0xd')](_0xc9306e));if(_0xc9306e[_0x78cb('0xe')]){if(_0xc9306e[_0x78cb('0xe')][_0x78cb('0xf')]===0x1f4){logger[_0x78cb('0xe')](_0x78cb('0xa'),_0x4b2259,_0xc9306e[_0x78cb('0xe')][_0x78cb('0x10')]);return _0x22dc1a(_0xc9306e[_0x78cb('0xe')][_0x78cb('0x10')]);}logger[_0x78cb('0xe')](_0x78cb('0xa'),_0x4b2259,_0xc9306e[_0x78cb('0xe')]['message']);return _0x4ba636(_0xc9306e[_0x78cb('0xe')][_0x78cb('0x10')]);}else{logger[_0x78cb('0x11')]('ChatApplication,\x20%s,\x20%s',_0x4b2259,'request\x20sent');_0x4ba636(_0xc9306e[_0x78cb('0x12')][_0x78cb('0x10')]);}})[_0x78cb('0x13')](function(_0x44afab){logger['error'](_0x78cb('0xa'),_0x4b2259,_0x44afab);_0x22dc1a(_0x44afab);});});} \ No newline at end of file +var _0x1e11=['moment','bluebird','randomstring','../../config/logger','../../config/environment','jayson/promise','client','request','then','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x24b9d3,_0x27fbab){var _0x492b52=function(_0x4af66f){while(--_0x4af66f){_0x24b9d3['push'](_0x24b9d3['shift']());}};_0x492b52(++_0x27fbab);}(_0x1e11,0x156));var _0x11e1=function(_0x3419e5,_0x1cdada){_0x3419e5=_0x3419e5-0x0;var _0x85f9bf=_0x1e11[_0x3419e5];return _0x85f9bf;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x11e1('0x0'));var BPromise=require(_0x11e1('0x1'));var rs=require(_0x11e1('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x11e1('0x3'))('rpc');var config=require(_0x11e1('0x4'));var jayson=require(_0x11e1('0x5'));var client=jayson[_0x11e1('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2b6b5e,_0x358223,_0x728168){return new BPromise(function(_0xec9b02,_0x200f47){return client[_0x11e1('0x7')](_0x2b6b5e,_0x728168)[_0x11e1('0x8')](function(_0x1fb064){logger['info'](_0x11e1('0x9'),_0x358223,_0x11e1('0xa'));logger[_0x11e1('0xb')](_0x11e1('0xc'),_0x358223,_0x11e1('0xa'),JSON[_0x11e1('0xd')](_0x1fb064));if(_0x1fb064['error']){if(_0x1fb064[_0x11e1('0xe')][_0x11e1('0xf')]===0x1f4){logger[_0x11e1('0xe')](_0x11e1('0x9'),_0x358223,_0x1fb064[_0x11e1('0xe')][_0x11e1('0x10')]);return _0x200f47(_0x1fb064[_0x11e1('0xe')][_0x11e1('0x10')]);}logger[_0x11e1('0xe')](_0x11e1('0x9'),_0x358223,_0x1fb064[_0x11e1('0xe')][_0x11e1('0x10')]);return _0xec9b02(_0x1fb064['error'][_0x11e1('0x10')]);}else{logger[_0x11e1('0x11')](_0x11e1('0x9'),_0x358223,_0x11e1('0xa'));_0xec9b02(_0x1fb064['result'][_0x11e1('0x10')]);}})['catch'](function(_0x26769d){logger['error']('ChatApplication,\x20%s,\x20%s',_0x358223,_0x26769d);_0x200f47(_0x26769d);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index f7164ed..7a6023f 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 _0x0bd1=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatApplication.controller','get','/:id','isAuthenticated','show','put','update','delete','destroy','exports','multer','util'];(function(_0x32e649,_0x228649){var _0x14d386=function(_0x3fb3ed){while(--_0x3fb3ed){_0x32e649['push'](_0x32e649['shift']());}};_0x14d386(++_0x228649);}(_0x0bd1,0xbc));var _0x10bd=function(_0x36fa31,_0x33ddeb){_0x36fa31=_0x36fa31-0x0;var _0x191e7d=_0x0bd1[_0x36fa31];return _0x191e7d;};'use strict';var multer=require(_0x10bd('0x0'));var util=require(_0x10bd('0x1'));var path=require(_0x10bd('0x2'));var timeout=require(_0x10bd('0x3'));var express=require(_0x10bd('0x4'));var router=express[_0x10bd('0x5')]();var fs_extra=require(_0x10bd('0x6'));var auth=require(_0x10bd('0x7'));var interaction=require(_0x10bd('0x8'));var config=require('../../config/environment');var controller=require(_0x10bd('0x9'));router[_0x10bd('0xa')](_0x10bd('0xb'),auth[_0x10bd('0xc')](),controller[_0x10bd('0xd')]);router[_0x10bd('0xe')](_0x10bd('0xb'),auth[_0x10bd('0xc')](),controller[_0x10bd('0xf')]);router[_0x10bd('0x10')](_0x10bd('0xb'),auth[_0x10bd('0xc')](),controller[_0x10bd('0x11')]);module[_0x10bd('0x12')]=router; \ No newline at end of file +var _0xacc6=['../../components/interaction/service','../../config/environment','./chatApplication.controller','get','/:id','isAuthenticated','put','update','delete','destroy','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0xacc6,0x19f));var _0x6acc=function(_0x240261,_0x4fe66c){_0x240261=_0x240261-0x0;var _0x45c332=_0xacc6[_0x240261];return _0x45c332;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6acc('0x0'));var timeout=require('connect-timeout');var express=require(_0x6acc('0x1'));var router=express[_0x6acc('0x2')]();var fs_extra=require(_0x6acc('0x3'));var auth=require(_0x6acc('0x4'));var interaction=require(_0x6acc('0x5'));var config=require(_0x6acc('0x6'));var controller=require(_0x6acc('0x7'));router[_0x6acc('0x8')](_0x6acc('0x9'),auth[_0x6acc('0xa')](),controller['show']);router[_0x6acc('0xb')](_0x6acc('0x9'),auth[_0x6acc('0xa')](),controller[_0x6acc('0xc')]);router[_0x6acc('0xd')](_0x6acc('0x9'),auth['isAuthenticated'](),controller[_0x6acc('0xe')]);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 d1ccc2a..7b1d1da 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 _0x6219=['sequelize','exports','STRING','BOOLEAN'];(function(_0x10636a,_0x385890){var _0x59820b=function(_0x2724a6){while(--_0x2724a6){_0x10636a['push'](_0x10636a['shift']());}};_0x59820b(++_0x385890);}(_0x6219,0xc4));var _0x9621=function(_0x1663ae,_0x10484a){_0x1663ae=_0x1663ae-0x0;var _0x30ffb8=_0x6219[_0x1663ae];return _0x30ffb8;};'use strict';var Sequelize=require(_0x9621('0x0'));module[_0x9621('0x1')]={'name':{'type':Sequelize[_0x9621('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x9621('0x2')]},'write':{'type':Sequelize[_0x9621('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0xc137=['exports','STRING','BOOLEAN','sequelize'];(function(_0x4345c8,_0x89a741){var _0x1b9031=function(_0x108f86){while(--_0x108f86){_0x4345c8['push'](_0x4345c8['shift']());}};_0x1b9031(++_0x89a741);}(_0xc137,0xff));var _0x7c13=function(_0x509a3e,_0x2f65ff){_0x509a3e=_0x509a3e-0x0;var _0x3ac9e6=_0xc137[_0x509a3e];return _0x3ac9e6;};'use strict';var Sequelize=require(_0x7c13('0x0'));module[_0x7c13('0x1')]={'name':{'type':Sequelize[_0x7c13('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x7c13('0x2')]},'write':{'type':Sequelize[_0x7c13('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index c72d008..beba898 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 _0xec2d=['pick','filter','merge','VIRTUAL','options','ChatGroup','includeAll','include','findAll','catch','show','params','fields','length','find','create','body','describe','getUnread','ChatInternalMessage','user','addMembers','ids','omit','getMembers','findOne','User','order','addMessage','ChatGroupId','getMessages','$gte','split','format','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','./chatGroup.socket','sendStatus','status','end','json','limit','offset','count','set','Content-Range','apply','reject','update','then','destroy','error','name','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','sort','where'];(function(_0x3c9b74,_0x22decf){var _0x1c5906=function(_0x470d4f){while(--_0x470d4f){_0x3c9b74['push'](_0x3c9b74['shift']());}};_0x1c5906(++_0x22decf);}(_0xec2d,0x81));var _0xdec2=function(_0xbc1d37,_0x7ed97b){_0xbc1d37=_0xbc1d37-0x0;var _0x24544a=_0xec2d[_0xbc1d37];return _0x24544a;};'use strict';var emlformat=require(_0xdec2('0x0'));var rimraf=require(_0xdec2('0x1'));var zipdir=require(_0xdec2('0x2'));var jsonpatch=require(_0xdec2('0x3'));var rp=require(_0xdec2('0x4'));var moment=require('moment');var BPromise=require(_0xdec2('0x5'));var Mustache=require(_0xdec2('0x6'));var util=require(_0xdec2('0x7'));var path=require(_0xdec2('0x8'));var sox=require(_0xdec2('0x9'));var csv=require('to-csv');var ejs=require(_0xdec2('0xa'));var fs=require('fs');var fs_extra=require(_0xdec2('0xb'));var _=require(_0xdec2('0xc'));var squel=require(_0xdec2('0xd'));var crypto=require(_0xdec2('0xe'));var jsforce=require(_0xdec2('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xdec2('0x10'));var querystring=require(_0xdec2('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xdec2('0x12'));var qs=require(_0xdec2('0x13'));var as=require(_0xdec2('0x14'));var hardwareService=require(_0xdec2('0x15'));var logger=require(_0xdec2('0x16'))('api');var utils=require(_0xdec2('0x17'));var config=require(_0xdec2('0x18'));var licenseUtil=require(_0xdec2('0x19'));var db=require('../../mysqldb')['db'];config[_0xdec2('0x1a')]=_[_0xdec2('0x1b')](config[_0xdec2('0x1a')],{'host':_0xdec2('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdec2('0x1a')]));require(_0xdec2('0x1d'))['register'](socket);function respondWithStatusCode(_0x59ac06,_0x2490af){_0x2490af=_0x2490af||0xcc;return function(_0xfd524d){if(_0xfd524d){return _0x59ac06[_0xdec2('0x1e')](_0x2490af);}return _0x59ac06[_0xdec2('0x1f')](_0x2490af)[_0xdec2('0x20')]();};}function respondWithResult(_0x4eeeb2,_0x28640e){_0x28640e=_0x28640e||0xc8;return function(_0x2a40a8){if(_0x2a40a8){return _0x4eeeb2[_0xdec2('0x1f')](_0x28640e)[_0xdec2('0x21')](_0x2a40a8);}};}function respondWithFilteredResult(_0x50fae1,_0xa1b645){return function(_0x1de964){if(_0x1de964){var _0x243699=typeof _0xa1b645['offset']==='undefined'&&typeof _0xa1b645[_0xdec2('0x22')]==='undefined';var _0x40a4ce=_0x1de964['count'];var _0x5501b8=_0x243699?0x0:_0xa1b645[_0xdec2('0x23')];var _0x3746b2=_0x243699?_0x1de964[_0xdec2('0x24')]:_0xa1b645['offset']+_0xa1b645[_0xdec2('0x22')];var _0x23747d;if(_0x3746b2>=_0x40a4ce){_0x3746b2=_0x40a4ce;_0x23747d=0xc8;}else{_0x23747d=0xce;}_0x50fae1[_0xdec2('0x1f')](_0x23747d);return _0x50fae1[_0xdec2('0x25')](_0xdec2('0x26'),_0x5501b8+'-'+_0x3746b2+'/'+_0x40a4ce)[_0xdec2('0x21')](_0x1de964);}return null;};}function patchUpdates(_0x5a1825){return function(_0x424383){try{jsonpatch[_0xdec2('0x27')](_0x424383,_0x5a1825,!![]);}catch(_0x47e7a1){return BPromise[_0xdec2('0x28')](_0x47e7a1);}return _0x424383['save']();};}function saveUpdates(_0x1dec1b,_0x5e0aae){return function(_0x37267f){if(_0x37267f){return _0x37267f[_0xdec2('0x29')](_0x1dec1b)[_0xdec2('0x2a')](function(_0x44bebb){return _0x44bebb;});}return null;};}function removeEntity(_0x33af42,_0x32c20b){return function(_0x2e0291){if(_0x2e0291){return _0x2e0291[_0xdec2('0x2b')]()[_0xdec2('0x2a')](function(){_0x33af42[_0xdec2('0x1f')](0xcc)[_0xdec2('0x20')]();});}};}function handleEntityNotFound(_0x60c2cc,_0x18687c){return function(_0x2abbbd){if(!_0x2abbbd){_0x60c2cc[_0xdec2('0x1e')](0x194);}return _0x2abbbd;};}function handleError(_0x435ee3,_0x2c0275){_0x2c0275=_0x2c0275||0x1f4;return function(_0x304b45){logger[_0xdec2('0x2c')](_0x304b45['stack']);if(_0x304b45[_0xdec2('0x2d')]){delete _0x304b45[_0xdec2('0x2d')];}_0x435ee3[_0xdec2('0x1f')](_0x2c0275)['send'](_0x304b45);};}exports['index']=function(_0x5e154c,_0x173dfe){var _0x2b1974={},_0x32a22f={},_0x4d3ff0={'count':0x0,'rows':[]};var _0x4045c3=_[_0xdec2('0x2e')](db['ChatGroup'][_0xdec2('0x2f')],function(_0x1625b2){return{'name':_0x1625b2[_0xdec2('0x30')],'type':_0x1625b2[_0xdec2('0x31')][_0xdec2('0x32')]};});_0x32a22f[_0xdec2('0x33')]=_[_0xdec2('0x2e')](_0x4045c3,_0xdec2('0x2d'));_0x32a22f[_0xdec2('0x34')]=_[_0xdec2('0x35')](_0x5e154c[_0xdec2('0x34')]);_0x32a22f[_0xdec2('0x36')]=_[_0xdec2('0x37')](_0x32a22f[_0xdec2('0x33')],_0x32a22f[_0xdec2('0x34')]);_0x2b1974[_0xdec2('0x38')]=_[_0xdec2('0x37')](_0x32a22f[_0xdec2('0x33')],qs['fields'](_0x5e154c[_0xdec2('0x34')]['fields']));_0x2b1974['attributes']=_0x2b1974[_0xdec2('0x38')]['length']?_0x2b1974[_0xdec2('0x38')]:_0x32a22f[_0xdec2('0x33')];if(!_0x5e154c[_0xdec2('0x34')][_0xdec2('0x39')](_0xdec2('0x3a'))){_0x2b1974[_0xdec2('0x22')]=qs[_0xdec2('0x22')](_0x5e154c[_0xdec2('0x34')][_0xdec2('0x22')]);_0x2b1974[_0xdec2('0x23')]=qs['offset'](_0x5e154c[_0xdec2('0x34')][_0xdec2('0x23')]);}_0x2b1974['order']=qs[_0xdec2('0x3b')](_0x5e154c[_0xdec2('0x34')][_0xdec2('0x3b')]);_0x2b1974[_0xdec2('0x3c')]=qs[_0xdec2('0x36')](_[_0xdec2('0x3d')](_0x5e154c[_0xdec2('0x34')],_0x32a22f[_0xdec2('0x36')]),_0x4045c3);if(_0x5e154c[_0xdec2('0x34')][_0xdec2('0x3e')]){_0x2b1974['where']=_[_0xdec2('0x3f')](_0x2b1974['where'],{'$or':_[_0xdec2('0x2e')](_0x4045c3,function(_0x37a2f0){if(_0x37a2f0[_0xdec2('0x31')]!==_0xdec2('0x40')){var _0x16a54c={};_0x16a54c[_0x37a2f0['name']]={'$like':'%'+_0x5e154c[_0xdec2('0x34')][_0xdec2('0x3e')]+'%'};return _0x16a54c;}})});}_0x2b1974=_[_0xdec2('0x3f')]({},_0x2b1974,_0x5e154c[_0xdec2('0x41')]);var _0x50c23a={'where':_0x2b1974['where']};return db[_0xdec2('0x42')][_0xdec2('0x24')](_0x50c23a)[_0xdec2('0x2a')](function(_0x5e1105){_0x4d3ff0[_0xdec2('0x24')]=_0x5e1105;if(_0x5e154c['query'][_0xdec2('0x43')]){_0x2b1974[_0xdec2('0x44')]=[{'all':!![]}];}return db[_0xdec2('0x42')][_0xdec2('0x45')](_0x2b1974);})[_0xdec2('0x2a')](function(_0x1564ce){_0x4d3ff0['rows']=_0x1564ce;return _0x4d3ff0;})[_0xdec2('0x2a')](respondWithFilteredResult(_0x173dfe,_0x2b1974))[_0xdec2('0x46')](handleError(_0x173dfe,null));};exports[_0xdec2('0x47')]=function(_0x4dcf7a,_0x22c887){var _0x2e3f7f={'raw':!![],'where':{'id':_0x4dcf7a[_0xdec2('0x48')]['id']}},_0x258946={};_0x258946[_0xdec2('0x33')]=_[_0xdec2('0x35')](db[_0xdec2('0x42')]['rawAttributes']);_0x258946[_0xdec2('0x34')]=_[_0xdec2('0x35')](_0x4dcf7a['query']);_0x258946['filters']=_[_0xdec2('0x37')](_0x258946['model'],_0x258946[_0xdec2('0x34')]);_0x2e3f7f[_0xdec2('0x38')]=_[_0xdec2('0x37')](_0x258946[_0xdec2('0x33')],qs[_0xdec2('0x49')](_0x4dcf7a['query'][_0xdec2('0x49')]));_0x2e3f7f[_0xdec2('0x38')]=_0x2e3f7f[_0xdec2('0x38')][_0xdec2('0x4a')]?_0x2e3f7f[_0xdec2('0x38')]:_0x258946[_0xdec2('0x33')];if(_0x4dcf7a[_0xdec2('0x34')]['includeAll']){_0x2e3f7f[_0xdec2('0x44')]=[{'all':!![]}];}_0x2e3f7f=_[_0xdec2('0x3f')]({},_0x2e3f7f,_0x4dcf7a[_0xdec2('0x41')]);return db[_0xdec2('0x42')][_0xdec2('0x4b')](_0x2e3f7f)[_0xdec2('0x2a')](handleEntityNotFound(_0x22c887,null))['then'](respondWithResult(_0x22c887,null))[_0xdec2('0x46')](handleError(_0x22c887,null));};exports[_0xdec2('0x4c')]=function(_0x56d8ab,_0x5e3018){return db[_0xdec2('0x42')][_0xdec2('0x4c')](_0x56d8ab[_0xdec2('0x4d')],{})['then'](respondWithResult(_0x5e3018,0xc9))[_0xdec2('0x46')](handleError(_0x5e3018,null));};exports[_0xdec2('0x29')]=function(_0x14e341,_0x5de5a1){if(_0x14e341[_0xdec2('0x4d')]['id']){delete _0x14e341[_0xdec2('0x4d')]['id'];}return db[_0xdec2('0x42')][_0xdec2('0x4b')]({'where':{'id':_0x14e341['params']['id']}})[_0xdec2('0x2a')](handleEntityNotFound(_0x5de5a1,null))['then'](saveUpdates(_0x14e341['body'],null))[_0xdec2('0x2a')](respondWithResult(_0x5de5a1,null))[_0xdec2('0x46')](handleError(_0x5de5a1,null));};exports[_0xdec2('0x2b')]=function(_0x46596e,_0x1a04d5){return db[_0xdec2('0x42')]['find']({'where':{'id':_0x46596e[_0xdec2('0x48')]['id']}})[_0xdec2('0x2a')](handleEntityNotFound(_0x1a04d5,null))[_0xdec2('0x2a')](removeEntity(_0x1a04d5,null))[_0xdec2('0x46')](handleError(_0x1a04d5,null));};exports[_0xdec2('0x4e')]=function(_0x4ebe9e,_0x4b1f72){return db[_0xdec2('0x42')]['describe']()['then'](respondWithResult(_0x4b1f72,null))[_0xdec2('0x46')](handleError(_0x4b1f72,null));};exports[_0xdec2('0x4f')]=function(_0x16f340,_0x5ad074,_0x594315){return db[_0xdec2('0x50')][_0xdec2('0x24')]({'where':{'ChatGroupId':_0x16f340[_0xdec2('0x48')]['id'],'ToId':_0x16f340[_0xdec2('0x51')]['id'],'read':![]}})[_0xdec2('0x2a')](function(_0xb4edb8){return{'id':_['toInteger'](_0x16f340[_0xdec2('0x48')]['id']),'count':_0xb4edb8};})[_0xdec2('0x2a')](respondWithResult(_0x5ad074,null))[_0xdec2('0x46')](handleError(_0x5ad074,null));};exports['addMembers']=function(_0x1b6baa,_0x391fbd,_0x4827e0){return db['ChatGroup'][_0xdec2('0x4b')]({'where':{'id':_0x1b6baa[_0xdec2('0x48')]['id']}})[_0xdec2('0x2a')](handleEntityNotFound(_0x391fbd,null))[_0xdec2('0x2a')](function(_0x415f23){if(_0x415f23){return _0x415f23[_0xdec2('0x52')](_0x1b6baa[_0xdec2('0x4d')][_0xdec2('0x53')],_[_0xdec2('0x54')](_0x1b6baa['body'],[_0xdec2('0x53'),'id'])||{});}})[_0xdec2('0x2a')](respondWithResult(_0x391fbd,null))['catch'](handleError(_0x391fbd,null));};exports[_0xdec2('0x55')]=function(_0x53e53c,_0x170b04,_0x2b560c){var _0x13fb45={};var _0x48f4a3={};var _0x2e1c0a;var _0x336e1a;return db[_0xdec2('0x42')][_0xdec2('0x56')]({'where':{'id':_0x53e53c[_0xdec2('0x48')]['id']}})[_0xdec2('0x2a')](handleEntityNotFound(_0x170b04,null))['then'](function(_0x420cbb){if(_0x420cbb){_0x2e1c0a=_0x420cbb;_0x48f4a3[_0xdec2('0x33')]=_[_0xdec2('0x35')](db[_0xdec2('0x57')][_0xdec2('0x2f')]);_0x48f4a3['query']=_['keys'](_0x53e53c[_0xdec2('0x34')]);_0x48f4a3[_0xdec2('0x36')]=_[_0xdec2('0x37')](_0x48f4a3[_0xdec2('0x33')],_0x48f4a3[_0xdec2('0x34')]);_0x13fb45[_0xdec2('0x38')]=_[_0xdec2('0x37')](_0x48f4a3[_0xdec2('0x33')],qs[_0xdec2('0x49')](_0x53e53c['query'][_0xdec2('0x49')]));_0x13fb45[_0xdec2('0x38')]=_0x13fb45[_0xdec2('0x38')][_0xdec2('0x4a')]?_0x13fb45[_0xdec2('0x38')]:_0x48f4a3[_0xdec2('0x33')];_0x13fb45[_0xdec2('0x58')]=qs['sort'](_0x53e53c[_0xdec2('0x34')][_0xdec2('0x3b')]);_0x13fb45[_0xdec2('0x3c')]=qs[_0xdec2('0x36')](_[_0xdec2('0x3d')](_0x53e53c[_0xdec2('0x34')],_0x48f4a3[_0xdec2('0x36')]));if(_0x53e53c[_0xdec2('0x34')][_0xdec2('0x3e')]){_0x13fb45[_0xdec2('0x3c')]=_[_0xdec2('0x3f')](_0x13fb45['where'],{'$or':_[_0xdec2('0x2e')](_0x13fb45[_0xdec2('0x38')],function(_0x5d5344){var _0x38a351={};_0x38a351[_0x5d5344]={'$like':'%'+_0x53e53c[_0xdec2('0x34')][_0xdec2('0x3e')]+'%'};return _0x38a351;})});}_0x13fb45=_['merge']({},_0x13fb45,_0x53e53c[_0xdec2('0x41')]);return _0x2e1c0a['getMembers'](_0x13fb45);}})[_0xdec2('0x2a')](function(_0x18fa9d){if(_0x18fa9d){_0x336e1a=_0x18fa9d[_0xdec2('0x4a')];if(!_0x53e53c[_0xdec2('0x34')][_0xdec2('0x39')](_0xdec2('0x3a'))){_0x13fb45[_0xdec2('0x22')]=qs[_0xdec2('0x22')](_0x53e53c[_0xdec2('0x34')][_0xdec2('0x22')]);_0x13fb45['offset']=qs[_0xdec2('0x23')](_0x53e53c[_0xdec2('0x34')][_0xdec2('0x23')]);}return _0x2e1c0a[_0xdec2('0x55')](_0x13fb45);}})[_0xdec2('0x2a')](function(_0x15d995){if(_0x15d995){return _0x15d995?{'count':_0x336e1a,'rows':_0x15d995}:null;}})[_0xdec2('0x2a')](respondWithResult(_0x170b04,null))[_0xdec2('0x46')](handleError(_0x170b04,null));};exports['removeMembers']=function(_0x948adb,_0x3f915e,_0x49cd22){return db[_0xdec2('0x42')][_0xdec2('0x4b')]({'where':{'id':_0x948adb[_0xdec2('0x48')]['id']}})['then'](handleEntityNotFound(_0x3f915e,null))[_0xdec2('0x2a')](function(_0x2f61c9){if(_0x2f61c9){return _0x2f61c9['removeMembers'](_0x948adb[_0xdec2('0x34')][_0xdec2('0x53')]);}})['then'](respondWithStatusCode(_0x3f915e,null))[_0xdec2('0x46')](handleError(_0x3f915e,null));};exports[_0xdec2('0x59')]=function(_0x228cfc,_0x1c467f,_0x35a097){if(_0x228cfc[_0xdec2('0x4d')]['id']){delete _0x228cfc[_0xdec2('0x4d')]['id'];}return db['ChatGroup'][_0xdec2('0x4b')]({'where':{'id':_0x228cfc[_0xdec2('0x48')]['id']}})[_0xdec2('0x2a')](handleEntityNotFound(_0x1c467f,null))['then'](function(_0x1c4046){if(_0x1c4046){_0x228cfc[_0xdec2('0x4d')][_0xdec2('0x5a')]=_0x1c4046['id'];return db[_0xdec2('0x50')][_0xdec2('0x4c')](_0x228cfc[_0xdec2('0x4d')]);}})['then'](respondWithResult(_0x1c467f,null))[_0xdec2('0x46')](handleError(_0x1c467f,null));};exports[_0xdec2('0x5b')]=function(_0x34ff9a,_0x6d89c0,_0x5696bb){var _0x1a714d={};var _0x3e110e={};var _0x3c7689;var _0x4dc249;return db['ChatGroup']['findOne']({'where':{'id':_0x34ff9a[_0xdec2('0x48')]['id']}})[_0xdec2('0x2a')](handleEntityNotFound(_0x6d89c0,null))['then'](function(_0x2f9948){if(_0x2f9948){_0x3c7689=_0x2f9948;_0x3e110e[_0xdec2('0x33')]=_[_0xdec2('0x35')](db[_0xdec2('0x50')][_0xdec2('0x2f')]);_0x3e110e[_0xdec2('0x34')]=_[_0xdec2('0x35')](_0x34ff9a[_0xdec2('0x34')]);_0x3e110e['filters']=_[_0xdec2('0x37')](_0x3e110e[_0xdec2('0x33')],_0x3e110e[_0xdec2('0x34')]);_0x1a714d[_0xdec2('0x38')]=_[_0xdec2('0x37')](_0x3e110e[_0xdec2('0x33')],qs[_0xdec2('0x49')](_0x34ff9a['query']['fields']));_0x1a714d['attributes']=_0x1a714d[_0xdec2('0x38')][_0xdec2('0x4a')]?_0x1a714d[_0xdec2('0x38')]:_0x3e110e[_0xdec2('0x33')];_0x1a714d[_0xdec2('0x58')]=qs[_0xdec2('0x3b')](_0x34ff9a[_0xdec2('0x34')][_0xdec2('0x3b')]);_0x1a714d[_0xdec2('0x3c')]=qs['filters'](_['pick'](_0x34ff9a[_0xdec2('0x34')],_0x3e110e[_0xdec2('0x36')]));if(_0x34ff9a['query']['filter']){_0x1a714d['where']=_['merge'](_0x1a714d[_0xdec2('0x3c')],{'$or':_[_0xdec2('0x2e')](_0x1a714d[_0xdec2('0x38')],function(_0x58e32c){var _0x2e4bf9={};_0x2e4bf9[_0x58e32c]={'$like':'%'+_0x34ff9a[_0xdec2('0x34')][_0xdec2('0x3e')]+'%'};return _0x2e4bf9;})});}if(_0x34ff9a[_0xdec2('0x34')][_0xdec2('0x5c')]){var _0x515587=_0x34ff9a[_0xdec2('0x34')][_0xdec2('0x5c')][_0xdec2('0x5d')](',');var _0x55716e={};_0x55716e[_0x515587[0x0]]={'$gte':moment(_0x515587[0x1])[_0xdec2('0x5e')]('YYYY-MM-DD\x20HH:mm:ss')};_0x1a714d[_0xdec2('0x3c')]=_[_0xdec2('0x3f')](_0x1a714d['where'],_0x55716e);}_0x1a714d=_['merge']({},_0x1a714d,_0x34ff9a[_0xdec2('0x41')]);return _0x3c7689[_0xdec2('0x5b')](_0x1a714d);}})['then'](function(_0x13249a){if(_0x13249a){_0x4dc249=_0x13249a[_0xdec2('0x4a')];if(!_0x34ff9a[_0xdec2('0x34')][_0xdec2('0x39')]('nolimit')){_0x1a714d[_0xdec2('0x22')]=qs[_0xdec2('0x22')](_0x34ff9a[_0xdec2('0x34')][_0xdec2('0x22')]);_0x1a714d[_0xdec2('0x23')]=qs[_0xdec2('0x23')](_0x34ff9a[_0xdec2('0x34')][_0xdec2('0x23')]);}return _0x3c7689[_0xdec2('0x5b')](_0x1a714d);}})[_0xdec2('0x2a')](function(_0x389346){if(_0x389346){return _0x389346?{'count':_0x4dc249,'rows':_0x389346}:null;}})['then'](respondWithResult(_0x6d89c0,null))[_0xdec2('0x46')](handleError(_0x6d89c0,null));}; \ No newline at end of file +var _0x53cd=['eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','end','status','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','ChatGroup','key','model','map','query','attributes','intersection','fields','length','hasOwnProperty','order','sort','filters','pick','filter','where','merge','type','options','includeAll','include','catch','show','params','keys','rawAttributes','find','create','body','describe','getUnread','ChatInternalMessage','user','addMembers','ids','omit','getMembers','findOne','User','nolimit','removeMembers','addMessage','ChatGroupId','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x232802,_0x4f521d){var _0x4f80c7=function(_0x3cc45d){while(--_0x3cc45d){_0x232802['push'](_0x232802['shift']());}};_0x4f80c7(++_0x4f521d);}(_0x53cd,0x17c));var _0xd53c=function(_0x3819cb,_0x30572a){_0x3819cb=_0x3819cb-0x0;var _0x31cacc=_0x53cd[_0x3819cb];return _0x31cacc;};'use strict';var emlformat=require(_0xd53c('0x0'));var rimraf=require(_0xd53c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd53c('0x2'));var rp=require(_0xd53c('0x3'));var moment=require('moment');var BPromise=require(_0xd53c('0x4'));var Mustache=require(_0xd53c('0x5'));var util=require(_0xd53c('0x6'));var path=require(_0xd53c('0x7'));var sox=require('sox');var csv=require(_0xd53c('0x8'));var ejs=require(_0xd53c('0x9'));var fs=require('fs');var fs_extra=require(_0xd53c('0xa'));var _=require(_0xd53c('0xb'));var squel=require(_0xd53c('0xc'));var crypto=require('crypto');var jsforce=require(_0xd53c('0xd'));var deskjs=require(_0xd53c('0xe'));var toCsv=require(_0xd53c('0x8'));var querystring=require(_0xd53c('0xf'));var Papa=require(_0xd53c('0x10'));var Redis=require(_0xd53c('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd53c('0x12'));var logger=require('../../config/logger')(_0xd53c('0x13'));var utils=require('../../config/utils');var config=require(_0xd53c('0x14'));var licenseUtil=require(_0xd53c('0x15'));var db=require('../../mysqldb')['db'];config[_0xd53c('0x16')]=_[_0xd53c('0x17')](config[_0xd53c('0x16')],{'host':_0xd53c('0x18'),'port':0x18eb});var socket=require(_0xd53c('0x19'))(new Redis(config[_0xd53c('0x16')]));require(_0xd53c('0x1a'))[_0xd53c('0x1b')](socket);function respondWithStatusCode(_0x3dde0b,_0x95432c){_0x95432c=_0x95432c||0xcc;return function(_0x205a72){if(_0x205a72){return _0x3dde0b['sendStatus'](_0x95432c);}return _0x3dde0b['status'](_0x95432c)[_0xd53c('0x1c')]();};}function respondWithResult(_0x318910,_0x2fc80e){_0x2fc80e=_0x2fc80e||0xc8;return function(_0xa4c3d2){if(_0xa4c3d2){return _0x318910[_0xd53c('0x1d')](_0x2fc80e)[_0xd53c('0x1e')](_0xa4c3d2);}};}function respondWithFilteredResult(_0x41c2d9,_0x3a9e7a){return function(_0x3d9ddf){if(_0x3d9ddf){var _0x54743a=typeof _0x3a9e7a[_0xd53c('0x1f')]===_0xd53c('0x20')&&typeof _0x3a9e7a[_0xd53c('0x21')]===_0xd53c('0x20');var _0x2d9015=_0x3d9ddf[_0xd53c('0x22')];var _0x5b3fca=_0x54743a?0x0:_0x3a9e7a['offset'];var _0x482df2=_0x54743a?_0x3d9ddf[_0xd53c('0x22')]:_0x3a9e7a[_0xd53c('0x1f')]+_0x3a9e7a[_0xd53c('0x21')];var _0x2e6275;if(_0x482df2>=_0x2d9015){_0x482df2=_0x2d9015;_0x2e6275=0xc8;}else{_0x2e6275=0xce;}_0x41c2d9[_0xd53c('0x1d')](_0x2e6275);return _0x41c2d9['set'](_0xd53c('0x23'),_0x5b3fca+'-'+_0x482df2+'/'+_0x2d9015)['json'](_0x3d9ddf);}return null;};}function patchUpdates(_0x351f26){return function(_0x5e1737){try{jsonpatch['apply'](_0x5e1737,_0x351f26,!![]);}catch(_0x1200db){return BPromise[_0xd53c('0x24')](_0x1200db);}return _0x5e1737[_0xd53c('0x25')]();};}function saveUpdates(_0x8723b6,_0x4c2e8b){return function(_0x3516fe){if(_0x3516fe){return _0x3516fe[_0xd53c('0x26')](_0x8723b6)[_0xd53c('0x27')](function(_0x2eb02e){return _0x2eb02e;});}return null;};}function removeEntity(_0x5669d5,_0x3cbced){return function(_0x1d4ad9){if(_0x1d4ad9){return _0x1d4ad9[_0xd53c('0x28')]()[_0xd53c('0x27')](function(){_0x5669d5['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b504e,_0x3e6ad0){return function(_0xc5606c){if(!_0xc5606c){_0x2b504e[_0xd53c('0x29')](0x194);}return _0xc5606c;};}function handleError(_0x3c4913,_0x396786){_0x396786=_0x396786||0x1f4;return function(_0x2669a9){logger[_0xd53c('0x2a')](_0x2669a9[_0xd53c('0x2b')]);if(_0x2669a9[_0xd53c('0x2c')]){delete _0x2669a9['name'];}_0x3c4913[_0xd53c('0x1d')](_0x396786)[_0xd53c('0x2d')](_0x2669a9);};}exports[_0xd53c('0x2e')]=function(_0x500570,_0x17d8d2){var _0x3754c6={},_0x2a0d7e={},_0x4d6332={'count':0x0,'rows':[]};var _0x3254de=_['map'](db[_0xd53c('0x2f')]['rawAttributes'],function(_0x2b7f71){return{'name':_0x2b7f71['fieldName'],'type':_0x2b7f71['type'][_0xd53c('0x30')]};});_0x2a0d7e[_0xd53c('0x31')]=_[_0xd53c('0x32')](_0x3254de,'name');_0x2a0d7e[_0xd53c('0x33')]=_['keys'](_0x500570[_0xd53c('0x33')]);_0x2a0d7e['filters']=_['intersection'](_0x2a0d7e[_0xd53c('0x31')],_0x2a0d7e[_0xd53c('0x33')]);_0x3754c6[_0xd53c('0x34')]=_[_0xd53c('0x35')](_0x2a0d7e[_0xd53c('0x31')],qs[_0xd53c('0x36')](_0x500570[_0xd53c('0x33')][_0xd53c('0x36')]));_0x3754c6['attributes']=_0x3754c6['attributes'][_0xd53c('0x37')]?_0x3754c6[_0xd53c('0x34')]:_0x2a0d7e['model'];if(!_0x500570['query'][_0xd53c('0x38')]('nolimit')){_0x3754c6[_0xd53c('0x21')]=qs[_0xd53c('0x21')](_0x500570[_0xd53c('0x33')][_0xd53c('0x21')]);_0x3754c6[_0xd53c('0x1f')]=qs['offset'](_0x500570['query'][_0xd53c('0x1f')]);}_0x3754c6[_0xd53c('0x39')]=qs[_0xd53c('0x3a')](_0x500570[_0xd53c('0x33')]['sort']);_0x3754c6['where']=qs[_0xd53c('0x3b')](_[_0xd53c('0x3c')](_0x500570['query'],_0x2a0d7e[_0xd53c('0x3b')]),_0x3254de);if(_0x500570[_0xd53c('0x33')][_0xd53c('0x3d')]){_0x3754c6[_0xd53c('0x3e')]=_[_0xd53c('0x3f')](_0x3754c6['where'],{'$or':_[_0xd53c('0x32')](_0x3254de,function(_0x49b905){if(_0x49b905[_0xd53c('0x40')]!=='VIRTUAL'){var _0x5e542f={};_0x5e542f[_0x49b905[_0xd53c('0x2c')]]={'$like':'%'+_0x500570[_0xd53c('0x33')]['filter']+'%'};return _0x5e542f;}})});}_0x3754c6=_[_0xd53c('0x3f')]({},_0x3754c6,_0x500570[_0xd53c('0x41')]);var _0x117dc6={'where':_0x3754c6[_0xd53c('0x3e')]};return db[_0xd53c('0x2f')][_0xd53c('0x22')](_0x117dc6)['then'](function(_0x390589){_0x4d6332[_0xd53c('0x22')]=_0x390589;if(_0x500570[_0xd53c('0x33')][_0xd53c('0x42')]){_0x3754c6[_0xd53c('0x43')]=[{'all':!![]}];}return db[_0xd53c('0x2f')]['findAll'](_0x3754c6);})[_0xd53c('0x27')](function(_0x4179fd){_0x4d6332['rows']=_0x4179fd;return _0x4d6332;})[_0xd53c('0x27')](respondWithFilteredResult(_0x17d8d2,_0x3754c6))[_0xd53c('0x44')](handleError(_0x17d8d2,null));};exports[_0xd53c('0x45')]=function(_0x46d8d7,_0x52642f){var _0x2b5b07={'raw':!![],'where':{'id':_0x46d8d7[_0xd53c('0x46')]['id']}},_0x50be84={};_0x50be84['model']=_[_0xd53c('0x47')](db[_0xd53c('0x2f')][_0xd53c('0x48')]);_0x50be84[_0xd53c('0x33')]=_[_0xd53c('0x47')](_0x46d8d7[_0xd53c('0x33')]);_0x50be84[_0xd53c('0x3b')]=_[_0xd53c('0x35')](_0x50be84[_0xd53c('0x31')],_0x50be84[_0xd53c('0x33')]);_0x2b5b07['attributes']=_[_0xd53c('0x35')](_0x50be84[_0xd53c('0x31')],qs[_0xd53c('0x36')](_0x46d8d7['query'][_0xd53c('0x36')]));_0x2b5b07[_0xd53c('0x34')]=_0x2b5b07[_0xd53c('0x34')]['length']?_0x2b5b07[_0xd53c('0x34')]:_0x50be84[_0xd53c('0x31')];if(_0x46d8d7[_0xd53c('0x33')][_0xd53c('0x42')]){_0x2b5b07[_0xd53c('0x43')]=[{'all':!![]}];}_0x2b5b07=_[_0xd53c('0x3f')]({},_0x2b5b07,_0x46d8d7['options']);return db[_0xd53c('0x2f')][_0xd53c('0x49')](_0x2b5b07)[_0xd53c('0x27')](handleEntityNotFound(_0x52642f,null))[_0xd53c('0x27')](respondWithResult(_0x52642f,null))[_0xd53c('0x44')](handleError(_0x52642f,null));};exports[_0xd53c('0x4a')]=function(_0x445949,_0x503cc5){return db[_0xd53c('0x2f')][_0xd53c('0x4a')](_0x445949[_0xd53c('0x4b')],{})[_0xd53c('0x27')](respondWithResult(_0x503cc5,0xc9))[_0xd53c('0x44')](handleError(_0x503cc5,null));};exports['update']=function(_0x5d0fe9,_0x1ab1b9){if(_0x5d0fe9[_0xd53c('0x4b')]['id']){delete _0x5d0fe9[_0xd53c('0x4b')]['id'];}return db['ChatGroup'][_0xd53c('0x49')]({'where':{'id':_0x5d0fe9['params']['id']}})[_0xd53c('0x27')](handleEntityNotFound(_0x1ab1b9,null))[_0xd53c('0x27')](saveUpdates(_0x5d0fe9['body'],null))['then'](respondWithResult(_0x1ab1b9,null))[_0xd53c('0x44')](handleError(_0x1ab1b9,null));};exports[_0xd53c('0x28')]=function(_0x2c0310,_0x2a8357){return db[_0xd53c('0x2f')][_0xd53c('0x49')]({'where':{'id':_0x2c0310[_0xd53c('0x46')]['id']}})['then'](handleEntityNotFound(_0x2a8357,null))['then'](removeEntity(_0x2a8357,null))[_0xd53c('0x44')](handleError(_0x2a8357,null));};exports[_0xd53c('0x4c')]=function(_0x12cdc2,_0x4820da){return db[_0xd53c('0x2f')][_0xd53c('0x4c')]()[_0xd53c('0x27')](respondWithResult(_0x4820da,null))[_0xd53c('0x44')](handleError(_0x4820da,null));};exports[_0xd53c('0x4d')]=function(_0x2d4a09,_0x47fd67,_0x581de1){return db[_0xd53c('0x4e')]['count']({'where':{'ChatGroupId':_0x2d4a09['params']['id'],'ToId':_0x2d4a09[_0xd53c('0x4f')]['id'],'read':![]}})[_0xd53c('0x27')](function(_0x170f4d){return{'id':_['toInteger'](_0x2d4a09[_0xd53c('0x46')]['id']),'count':_0x170f4d};})[_0xd53c('0x27')](respondWithResult(_0x47fd67,null))['catch'](handleError(_0x47fd67,null));};exports[_0xd53c('0x50')]=function(_0x8fc1ac,_0x474437,_0x39890f){return db[_0xd53c('0x2f')][_0xd53c('0x49')]({'where':{'id':_0x8fc1ac[_0xd53c('0x46')]['id']}})[_0xd53c('0x27')](handleEntityNotFound(_0x474437,null))[_0xd53c('0x27')](function(_0x4b3911){if(_0x4b3911){return _0x4b3911[_0xd53c('0x50')](_0x8fc1ac[_0xd53c('0x4b')][_0xd53c('0x51')],_[_0xd53c('0x52')](_0x8fc1ac[_0xd53c('0x4b')],[_0xd53c('0x51'),'id'])||{});}})[_0xd53c('0x27')](respondWithResult(_0x474437,null))['catch'](handleError(_0x474437,null));};exports[_0xd53c('0x53')]=function(_0x3e91cb,_0x5b58ab,_0x199d28){var _0x2a9ffc={};var _0x3430f9={};var _0x381d67;var _0x3636c8;return db[_0xd53c('0x2f')][_0xd53c('0x54')]({'where':{'id':_0x3e91cb['params']['id']}})[_0xd53c('0x27')](handleEntityNotFound(_0x5b58ab,null))[_0xd53c('0x27')](function(_0x3a2550){if(_0x3a2550){_0x381d67=_0x3a2550;_0x3430f9[_0xd53c('0x31')]=_[_0xd53c('0x47')](db[_0xd53c('0x55')][_0xd53c('0x48')]);_0x3430f9[_0xd53c('0x33')]=_[_0xd53c('0x47')](_0x3e91cb['query']);_0x3430f9['filters']=_[_0xd53c('0x35')](_0x3430f9[_0xd53c('0x31')],_0x3430f9[_0xd53c('0x33')]);_0x2a9ffc[_0xd53c('0x34')]=_[_0xd53c('0x35')](_0x3430f9[_0xd53c('0x31')],qs[_0xd53c('0x36')](_0x3e91cb[_0xd53c('0x33')][_0xd53c('0x36')]));_0x2a9ffc[_0xd53c('0x34')]=_0x2a9ffc[_0xd53c('0x34')][_0xd53c('0x37')]?_0x2a9ffc[_0xd53c('0x34')]:_0x3430f9[_0xd53c('0x31')];_0x2a9ffc['order']=qs[_0xd53c('0x3a')](_0x3e91cb['query'][_0xd53c('0x3a')]);_0x2a9ffc[_0xd53c('0x3e')]=qs[_0xd53c('0x3b')](_[_0xd53c('0x3c')](_0x3e91cb[_0xd53c('0x33')],_0x3430f9[_0xd53c('0x3b')]));if(_0x3e91cb[_0xd53c('0x33')]['filter']){_0x2a9ffc['where']=_[_0xd53c('0x3f')](_0x2a9ffc['where'],{'$or':_[_0xd53c('0x32')](_0x2a9ffc[_0xd53c('0x34')],function(_0xf2d54d){var _0x5b22a5={};_0x5b22a5[_0xf2d54d]={'$like':'%'+_0x3e91cb[_0xd53c('0x33')][_0xd53c('0x3d')]+'%'};return _0x5b22a5;})});}_0x2a9ffc=_[_0xd53c('0x3f')]({},_0x2a9ffc,_0x3e91cb[_0xd53c('0x41')]);return _0x381d67[_0xd53c('0x53')](_0x2a9ffc);}})[_0xd53c('0x27')](function(_0x128aab){if(_0x128aab){_0x3636c8=_0x128aab[_0xd53c('0x37')];if(!_0x3e91cb['query']['hasOwnProperty'](_0xd53c('0x56'))){_0x2a9ffc[_0xd53c('0x21')]=qs[_0xd53c('0x21')](_0x3e91cb[_0xd53c('0x33')]['limit']);_0x2a9ffc[_0xd53c('0x1f')]=qs[_0xd53c('0x1f')](_0x3e91cb[_0xd53c('0x33')][_0xd53c('0x1f')]);}return _0x381d67[_0xd53c('0x53')](_0x2a9ffc);}})[_0xd53c('0x27')](function(_0x52c842){if(_0x52c842){return _0x52c842?{'count':_0x3636c8,'rows':_0x52c842}:null;}})['then'](respondWithResult(_0x5b58ab,null))[_0xd53c('0x44')](handleError(_0x5b58ab,null));};exports[_0xd53c('0x57')]=function(_0x3c162e,_0x5659e0,_0x500ce7){return db[_0xd53c('0x2f')][_0xd53c('0x49')]({'where':{'id':_0x3c162e[_0xd53c('0x46')]['id']}})['then'](handleEntityNotFound(_0x5659e0,null))[_0xd53c('0x27')](function(_0x3a2909){if(_0x3a2909){return _0x3a2909[_0xd53c('0x57')](_0x3c162e[_0xd53c('0x33')]['ids']);}})['then'](respondWithStatusCode(_0x5659e0,null))[_0xd53c('0x44')](handleError(_0x5659e0,null));};exports[_0xd53c('0x58')]=function(_0x1b54cf,_0x4546df,_0x334ef5){if(_0x1b54cf[_0xd53c('0x4b')]['id']){delete _0x1b54cf[_0xd53c('0x4b')]['id'];}return db[_0xd53c('0x2f')]['find']({'where':{'id':_0x1b54cf[_0xd53c('0x46')]['id']}})['then'](handleEntityNotFound(_0x4546df,null))['then'](function(_0x147ba5){if(_0x147ba5){_0x1b54cf[_0xd53c('0x4b')][_0xd53c('0x59')]=_0x147ba5['id'];return db[_0xd53c('0x4e')][_0xd53c('0x4a')](_0x1b54cf[_0xd53c('0x4b')]);}})[_0xd53c('0x27')](respondWithResult(_0x4546df,null))[_0xd53c('0x44')](handleError(_0x4546df,null));};exports[_0xd53c('0x5a')]=function(_0x25c830,_0x10970d,_0x40462b){var _0x912ac4={};var _0x271397={};var _0x2a9729;var _0x52e36b;return db[_0xd53c('0x2f')][_0xd53c('0x54')]({'where':{'id':_0x25c830['params']['id']}})[_0xd53c('0x27')](handleEntityNotFound(_0x10970d,null))[_0xd53c('0x27')](function(_0x23f785){if(_0x23f785){_0x2a9729=_0x23f785;_0x271397[_0xd53c('0x31')]=_['keys'](db['ChatInternalMessage'][_0xd53c('0x48')]);_0x271397[_0xd53c('0x33')]=_[_0xd53c('0x47')](_0x25c830[_0xd53c('0x33')]);_0x271397[_0xd53c('0x3b')]=_[_0xd53c('0x35')](_0x271397[_0xd53c('0x31')],_0x271397[_0xd53c('0x33')]);_0x912ac4['attributes']=_[_0xd53c('0x35')](_0x271397[_0xd53c('0x31')],qs[_0xd53c('0x36')](_0x25c830[_0xd53c('0x33')][_0xd53c('0x36')]));_0x912ac4['attributes']=_0x912ac4[_0xd53c('0x34')][_0xd53c('0x37')]?_0x912ac4[_0xd53c('0x34')]:_0x271397[_0xd53c('0x31')];_0x912ac4['order']=qs[_0xd53c('0x3a')](_0x25c830[_0xd53c('0x33')][_0xd53c('0x3a')]);_0x912ac4[_0xd53c('0x3e')]=qs[_0xd53c('0x3b')](_[_0xd53c('0x3c')](_0x25c830[_0xd53c('0x33')],_0x271397[_0xd53c('0x3b')]));if(_0x25c830[_0xd53c('0x33')][_0xd53c('0x3d')]){_0x912ac4['where']=_[_0xd53c('0x3f')](_0x912ac4[_0xd53c('0x3e')],{'$or':_[_0xd53c('0x32')](_0x912ac4[_0xd53c('0x34')],function(_0xa70df5){var _0xd8cbd5={};_0xd8cbd5[_0xa70df5]={'$like':'%'+_0x25c830['query'][_0xd53c('0x3d')]+'%'};return _0xd8cbd5;})});}if(_0x25c830[_0xd53c('0x33')]['$gte']){var _0x31c2fa=_0x25c830[_0xd53c('0x33')][_0xd53c('0x5b')][_0xd53c('0x5c')](',');var _0x50707a={};_0x50707a[_0x31c2fa[0x0]]={'$gte':moment(_0x31c2fa[0x1])[_0xd53c('0x5d')](_0xd53c('0x5e'))};_0x912ac4[_0xd53c('0x3e')]=_['merge'](_0x912ac4[_0xd53c('0x3e')],_0x50707a);}_0x912ac4=_['merge']({},_0x912ac4,_0x25c830[_0xd53c('0x41')]);return _0x2a9729[_0xd53c('0x5a')](_0x912ac4);}})[_0xd53c('0x27')](function(_0x27a367){if(_0x27a367){_0x52e36b=_0x27a367[_0xd53c('0x37')];if(!_0x25c830[_0xd53c('0x33')]['hasOwnProperty'](_0xd53c('0x56'))){_0x912ac4[_0xd53c('0x21')]=qs[_0xd53c('0x21')](_0x25c830['query']['limit']);_0x912ac4[_0xd53c('0x1f')]=qs[_0xd53c('0x1f')](_0x25c830[_0xd53c('0x33')][_0xd53c('0x1f')]);}return _0x2a9729[_0xd53c('0x5a')](_0x912ac4);}})[_0xd53c('0x27')](function(_0x1bb6ab){if(_0x1bb6ab){return _0x1bb6ab?{'count':_0x52e36b,'rows':_0x1bb6ab}:null;}})['then'](respondWithResult(_0x10970d,null))[_0xd53c('0x44')](handleError(_0x10970d,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 6359a8d..f08c58a 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 _0xe6b0=['emit','hasOwnProperty','hook','events','../../mysqldb','ChatGroup','setMaxListeners','save'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xe6b0,0x18b));var _0x0e6b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe6b0[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x0e6b('0x0'));var ChatGroup=require(_0x0e6b('0x1'))['db'][_0x0e6b('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x0e6b('0x3')](0x0);var events={'afterCreate':_0x0e6b('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4fa974){return function(_0x39deaa,_0xa6dbed,_0x4c0861){ChatGroupEvents[_0x0e6b('0x5')](_0x4fa974+':'+_0x39deaa['id'],_0x39deaa);ChatGroupEvents[_0x0e6b('0x5')](_0x4fa974,_0x39deaa);_0x4c0861(null);};}for(var e in events){if(events[_0x0e6b('0x6')](e)){var event=events[e];ChatGroup[_0x0e6b('0x7')](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file +var _0xb44f=['setMaxListeners','save','update','remove','emit','hook','exports','events','../../mysqldb','ChatGroup'];(function(_0x4a2008,_0x3372b3){var _0x1dc0be=function(_0x47fb57){while(--_0x47fb57){_0x4a2008['push'](_0x4a2008['shift']());}};_0x1dc0be(++_0x3372b3);}(_0xb44f,0x165));var _0xfb44=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xb44f[_0x1facfa];return _0x9ec701;};'use strict';var EventEmitter=require(_0xfb44('0x0'));var ChatGroup=require(_0xfb44('0x1'))['db'][_0xfb44('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xfb44('0x3')](0x0);var events={'afterCreate':_0xfb44('0x4'),'afterUpdate':_0xfb44('0x5'),'afterDestroy':_0xfb44('0x6')};function emitEvent(_0x179ac2){return function(_0x3969c4,_0x1b61bb,_0x2925d2){ChatGroupEvents['emit'](_0x179ac2+':'+_0x3969c4['id'],_0x3969c4);ChatGroupEvents[_0xfb44('0x7')](_0x179ac2,_0x3969c4);_0x2925d2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup[_0xfb44('0x8')](e,emitEvent(event));}}module[_0xfb44('0x9')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index ed812e4..fc1d7ff 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 _0x6433=['api','moment','bluebird','rimraf','./chatGroup.attributes','exports','define','ChatGroup','chat_groups','lodash','../../config/logger'];(function(_0x1a257c,_0x2d62af){var _0x483407=function(_0x32302b){while(--_0x32302b){_0x1a257c['push'](_0x1a257c['shift']());}};_0x483407(++_0x2d62af);}(_0x6433,0x1d7));var _0x3643=function(_0x523d74,_0x154dde){_0x523d74=_0x523d74-0x0;var _0x5b6d02=_0x6433[_0x523d74];return _0x5b6d02;};'use strict';var _=require(_0x3643('0x0'));var util=require('util');var logger=require(_0x3643('0x1'))(_0x3643('0x2'));var moment=require(_0x3643('0x3'));var BPromise=require(_0x3643('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3643('0x5'));var config=require('../../config/environment');var attributes=require(_0x3643('0x6'));module[_0x3643('0x7')]=function(_0x37e595,_0x49ba61){return _0x37e595[_0x3643('0x8')](_0x3643('0x9'),attributes,{'tableName':_0x3643('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc447=['define','chat_groups','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','./chatGroup.attributes','exports'];(function(_0x3d95c2,_0x294b6d){var _0x2b583f=function(_0x4180bf){while(--_0x4180bf){_0x3d95c2['push'](_0x3d95c2['shift']());}};_0x2b583f(++_0x294b6d);}(_0xc447,0x199));var _0x7c44=function(_0x56da04,_0x8d0462){_0x56da04=_0x56da04-0x0;var _0x98f87b=_0xc447[_0x56da04];return _0x98f87b;};'use strict';var _=require(_0x7c44('0x0'));var util=require(_0x7c44('0x1'));var logger=require(_0x7c44('0x2'))('api');var moment=require(_0x7c44('0x3'));var BPromise=require(_0x7c44('0x4'));var rp=require(_0x7c44('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7c44('0x6'));var config=require('../../config/environment');var attributes=require(_0x7c44('0x7'));module[_0x7c44('0x8')]=function(_0x2ed329,_0xbe47b7){return _0x2ed329[_0x7c44('0x9')]('ChatGroup',attributes,{'tableName':_0x7c44('0xa'),'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 9333373..b16a32d 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 _0xf61e=['client','http','defaults','localhost','socket.io-emitter','redis','./chatGroup.socket','register','request','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x43bce1,_0x194db3){var _0x23be45=function(_0x40096b){while(--_0x40096b){_0x43bce1['push'](_0x43bce1['shift']());}};_0x23be45(++_0x194db3);}(_0xf61e,0x82));var _0xef61=function(_0x3d708d,_0x194365){_0x3d708d=_0x3d708d-0x0;var _0x405952=_0xf61e[_0x3d708d];return _0x405952;};'use strict';var _=require(_0xef61('0x0'));var util=require(_0xef61('0x1'));var moment=require(_0xef61('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xef61('0x3'));var db=require(_0xef61('0x4'))['db'];var utils=require(_0xef61('0x5'));var logger=require(_0xef61('0x6'))(_0xef61('0x7'));var config=require(_0xef61('0x8'));var jayson=require(_0xef61('0x9'));var client=jayson[_0xef61('0xa')][_0xef61('0xb')]({'port':0x232a});config['redis']=_[_0xef61('0xc')](config['redis'],{'host':_0xef61('0xd'),'port':0x18eb});var socket=require(_0xef61('0xe'))(new Redis(config[_0xef61('0xf')]));require(_0xef61('0x10'))[_0xef61('0x11')](socket);function respondWithRpcPromise(_0x5b68e9,_0x4bb153,_0x4e1f45){return new BPromise(function(_0x1721b4,_0x1e10c0){return client[_0xef61('0x12')](_0x5b68e9,_0x4e1f45)['then'](function(_0x1bfd11){logger['info'](_0xef61('0x13'),_0x4bb153,_0xef61('0x14'));logger[_0xef61('0x15')](_0xef61('0x16'),_0x4bb153,'request\x20sent',JSON[_0xef61('0x17')](_0x1bfd11));if(_0x1bfd11['error']){if(_0x1bfd11[_0xef61('0x18')][_0xef61('0x19')]===0x1f4){logger[_0xef61('0x18')](_0xef61('0x13'),_0x4bb153,_0x1bfd11[_0xef61('0x18')][_0xef61('0x1a')]);return _0x1e10c0(_0x1bfd11[_0xef61('0x18')]['message']);}logger[_0xef61('0x18')]('ChatGroup,\x20%s,\x20%s',_0x4bb153,_0x1bfd11[_0xef61('0x18')][_0xef61('0x1a')]);return _0x1721b4(_0x1bfd11[_0xef61('0x18')][_0xef61('0x1a')]);}else{logger[_0xef61('0x1b')]('ChatGroup,\x20%s,\x20%s',_0x4bb153,_0xef61('0x14'));_0x1721b4(_0x1bfd11['result'][_0xef61('0x1a')]);}})['catch'](function(_0x2368b3){logger[_0xef61('0x18')]('ChatGroup,\x20%s,\x20%s',_0x4bb153,_0x2368b3);_0x1e10c0(_0x2368b3);});});} \ No newline at end of file +var _0x4fd7=['stringify','error','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','jayson/promise','http','redis','localhost','./chatGroup.socket','register','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s'];(function(_0x100598,_0x1a1e80){var _0x959d17=function(_0x1b685d){while(--_0x1b685d){_0x100598['push'](_0x100598['shift']());}};_0x959d17(++_0x1a1e80);}(_0x4fd7,0xe6));var _0x74fd=function(_0xb1b82d,_0x5413cd){_0xb1b82d=_0xb1b82d-0x0;var _0x4b1d37=_0x4fd7[_0xb1b82d];return _0x4b1d37;};'use strict';var _=require(_0x74fd('0x0'));var util=require(_0x74fd('0x1'));var moment=require(_0x74fd('0x2'));var BPromise=require(_0x74fd('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x74fd('0x4'))['db'];var utils=require(_0x74fd('0x5'));var logger=require('../../config/logger')(_0x74fd('0x6'));var config=require('../../config/environment');var jayson=require(_0x74fd('0x7'));var client=jayson['client'][_0x74fd('0x8')]({'port':0x232a});config[_0x74fd('0x9')]=_['defaults'](config[_0x74fd('0x9')],{'host':_0x74fd('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x74fd('0x9')]));require(_0x74fd('0xb'))[_0x74fd('0xc')](socket);function respondWithRpcPromise(_0x826d2b,_0x4106e3,_0x32ee2b){return new BPromise(function(_0x83925f,_0x2b2c64){return client[_0x74fd('0xd')](_0x826d2b,_0x32ee2b)[_0x74fd('0xe')](function(_0x321921){logger[_0x74fd('0xf')](_0x74fd('0x10'),_0x4106e3,_0x74fd('0x11'));logger[_0x74fd('0x12')](_0x74fd('0x13'),_0x4106e3,'request\x20sent',JSON[_0x74fd('0x14')](_0x321921));if(_0x321921[_0x74fd('0x15')]){if(_0x321921['error']['code']===0x1f4){logger[_0x74fd('0x15')](_0x74fd('0x10'),_0x4106e3,_0x321921[_0x74fd('0x15')][_0x74fd('0x16')]);return _0x2b2c64(_0x321921[_0x74fd('0x15')][_0x74fd('0x16')]);}logger[_0x74fd('0x15')](_0x74fd('0x10'),_0x4106e3,_0x321921[_0x74fd('0x15')][_0x74fd('0x16')]);return _0x83925f(_0x321921[_0x74fd('0x15')]['message']);}else{logger[_0x74fd('0xf')](_0x74fd('0x10'),_0x4106e3,'request\x20sent');_0x83925f(_0x321921[_0x74fd('0x17')][_0x74fd('0x16')]);}})[_0x74fd('0x18')](function(_0x11e554){logger[_0x74fd('0x15')](_0x74fd('0x10'),_0x4106e3,_0x11e554);_0x2b2c64(_0x11e554);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 57b97c9..6242b23 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 _0x2fd3=['emit','removeListener','register','./chatGroup.events','save','update'];(function(_0x4cc62c,_0xde61c1){var _0x13be8d=function(_0x5c13f8){while(--_0x5c13f8){_0x4cc62c['push'](_0x4cc62c['shift']());}};_0x13be8d(++_0xde61c1);}(_0x2fd3,0x183));var _0x32fd=function(_0x28b3a4,_0x8f16ab){_0x28b3a4=_0x28b3a4-0x0;var _0x355fb8=_0x2fd3[_0x28b3a4];return _0x355fb8;};'use strict';var ChatGroupEvents=require(_0x32fd('0x0'));var events=[_0x32fd('0x1'),'remove',_0x32fd('0x2')];function createListener(_0x36d4cd,_0x4b4983){return function(_0x47f1c7){_0x4b4983[_0x32fd('0x3')](_0x36d4cd,_0x47f1c7);};}function removeListener(_0x3975c0,_0x5731a4){return function(){ChatGroupEvents[_0x32fd('0x4')](_0x3975c0,_0x5731a4);};}exports[_0x32fd('0x5')]=function(_0x202e2b){for(var _0x5d4fb9=0x0,_0x54e1a3=events['length'];_0x5d4fb9<_0x54e1a3;_0x5d4fb9++){var _0x332d90=events[_0x5d4fb9];var _0x12c53d=createListener('chatGroup:'+_0x332d90,_0x202e2b);ChatGroupEvents['on'](_0x332d90,_0x12c53d);}}; \ No newline at end of file +var _0x5ca4=['removeListener','register','length','chatGroup:','save','update','emit'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5ca4,0x89));var _0x45ca=function(_0x547b6f,_0x1d5090){_0x547b6f=_0x547b6f-0x0;var _0x3aaa26=_0x5ca4[_0x547b6f];return _0x3aaa26;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=[_0x45ca('0x0'),'remove',_0x45ca('0x1')];function createListener(_0x959a2c,_0x5e7994){return function(_0x1d6392){_0x5e7994[_0x45ca('0x2')](_0x959a2c,_0x1d6392);};}function removeListener(_0x1398ef,_0xd4745e){return function(){ChatGroupEvents[_0x45ca('0x3')](_0x1398ef,_0xd4745e);};}exports[_0x45ca('0x4')]=function(_0x1c487f){for(var _0x1bfa27=0x0,_0x457682=events[_0x45ca('0x5')];_0x1bfa27<_0x457682;_0x1bfa27++){var _0x533f61=events[_0x1bfa27];var _0x3f3c84=createListener(_0x45ca('0x6')+_0x533f61,_0x1c487f);ChatGroupEvents['on'](_0x533f61,_0x3f3c84);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 0a07e18..98ba33d 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 _0x3980=['/:id/unread','/:id/members','/:id/messages','post','create','addMembers','addMessage','delete','destroy','removeMembers','exports','util','express','Router','fs-extra','../../components/auth/service','./chatGroup.controller','get','isAuthenticated','index','/describe','/:id','show'];(function(_0x12ca72,_0x12cdfe){var _0x218945=function(_0x53af8e){while(--_0x53af8e){_0x12ca72['push'](_0x12ca72['shift']());}};_0x218945(++_0x12cdfe);}(_0x3980,0x108));var _0x0398=function(_0x184032,_0x454721){_0x184032=_0x184032-0x0;var _0x2e9c34=_0x3980[_0x184032];return _0x2e9c34;};'use strict';var multer=require('multer');var util=require(_0x0398('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0398('0x1'));var router=express[_0x0398('0x2')]();var fs_extra=require(_0x0398('0x3'));var auth=require(_0x0398('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x0398('0x5'));router[_0x0398('0x6')]('/',auth[_0x0398('0x7')](),controller[_0x0398('0x8')]);router[_0x0398('0x6')](_0x0398('0x9'),auth[_0x0398('0x7')](),controller['describe']);router[_0x0398('0x6')](_0x0398('0xa'),auth[_0x0398('0x7')](),controller[_0x0398('0xb')]);router[_0x0398('0x6')](_0x0398('0xc'),auth[_0x0398('0x7')](),controller['getUnread']);router['get'](_0x0398('0xd'),auth['isAuthenticated'](),controller['getMembers']);router[_0x0398('0x6')](_0x0398('0xe'),auth[_0x0398('0x7')](),controller['getMessages']);router[_0x0398('0xf')]('/',auth[_0x0398('0x7')](),controller[_0x0398('0x10')]);router[_0x0398('0xf')]('/:id/members',auth[_0x0398('0x7')](),controller[_0x0398('0x11')]);router[_0x0398('0xf')](_0x0398('0xe'),auth[_0x0398('0x7')](),controller[_0x0398('0x12')]);router['put'](_0x0398('0xa'),auth[_0x0398('0x7')](),controller['update']);router[_0x0398('0x13')](_0x0398('0xa'),auth[_0x0398('0x7')](),controller[_0x0398('0x14')]);router[_0x0398('0x13')](_0x0398('0xd'),auth[_0x0398('0x7')](),controller[_0x0398('0x15')]);module[_0x0398('0x16')]=router; \ No newline at end of file +var _0xf895=['put','update','destroy','delete','removeMembers','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatGroup.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/members','/:id/messages','post','create','addMessage'];(function(_0x19691f,_0x159737){var _0x5677b6=function(_0x41a9b2){while(--_0x41a9b2){_0x19691f['push'](_0x19691f['shift']());}};_0x5677b6(++_0x159737);}(_0xf895,0x14a));var _0x5f89=function(_0x4f6976,_0x68991b){_0x4f6976=_0x4f6976-0x0;var _0x466ac5=_0xf895[_0x4f6976];return _0x466ac5;};'use strict';var multer=require(_0x5f89('0x0'));var util=require(_0x5f89('0x1'));var path=require(_0x5f89('0x2'));var timeout=require('connect-timeout');var express=require(_0x5f89('0x3'));var router=express[_0x5f89('0x4')]();var fs_extra=require(_0x5f89('0x5'));var auth=require(_0x5f89('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5f89('0x7'));var controller=require(_0x5f89('0x8'));router[_0x5f89('0x9')]('/',auth['isAuthenticated'](),controller[_0x5f89('0xa')]);router[_0x5f89('0x9')](_0x5f89('0xb'),auth[_0x5f89('0xc')](),controller[_0x5f89('0xd')]);router[_0x5f89('0x9')](_0x5f89('0xe'),auth[_0x5f89('0xc')](),controller[_0x5f89('0xf')]);router[_0x5f89('0x9')]('/:id/unread',auth[_0x5f89('0xc')](),controller['getUnread']);router[_0x5f89('0x9')](_0x5f89('0x10'),auth[_0x5f89('0xc')](),controller['getMembers']);router[_0x5f89('0x9')](_0x5f89('0x11'),auth['isAuthenticated'](),controller['getMessages']);router[_0x5f89('0x12')]('/',auth[_0x5f89('0xc')](),controller[_0x5f89('0x13')]);router[_0x5f89('0x12')](_0x5f89('0x10'),auth[_0x5f89('0xc')](),controller['addMembers']);router['post'](_0x5f89('0x11'),auth[_0x5f89('0xc')](),controller[_0x5f89('0x14')]);router[_0x5f89('0x15')](_0x5f89('0xe'),auth[_0x5f89('0xc')](),controller[_0x5f89('0x16')]);router['delete'](_0x5f89('0xe'),auth['isAuthenticated'](),controller[_0x5f89('0x17')]);router[_0x5f89('0x18')]('/:id/members',auth['isAuthenticated'](),controller[_0x5f89('0x19')]);module[_0x5f89('0x1a')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 1f38bbe..d88ebb8 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(_0xa140a1,_0x496424){var _0x2fbf18=function(_0x3809ab){while(--_0x3809ab){_0xa140a1['push'](_0xa140a1['shift']());}};_0x2fbf18(++_0x496424);}(_0x6b20,0xd1));var _0x06b2=function(_0x55e04e,_0x35ab25){_0x55e04e=_0x55e04e-0x0;var _0x5db651=_0x6b20[_0x55e04e];return _0x5db651;};'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 _0x282b=['TEXT','STRING','DATE','long','out','sequelize','exports','BOOLEAN','INTEGER','ENUM','star'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0x282b,0xec));var _0xb282=function(_0x246b13,_0x1e05e4){_0x246b13=_0x246b13-0x0;var _0x54257a=_0x282b[_0x246b13];return _0x54257a;};'use strict';var Sequelize=require(_0xb282('0x0'));module[_0xb282('0x1')]={'closed':{'type':Sequelize[_0xb282('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xb282('0x3')]},'ratingType':{'type':Sequelize[_0xb282('0x4')]('star','thumb'),'defaultValue':_0xb282('0x5')},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0xb282('0x6')]},'mailTranscript':{'type':Sequelize[_0xb282('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xb282('0x8')]},'disposition':{'type':Sequelize[_0xb282('0x7')]},'secondDisposition':{'type':Sequelize[_0xb282('0x7')]},'thirdDisposition':{'type':Sequelize[_0xb282('0x7')]},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize[_0xb282('0x7')]},'osName':{'type':Sequelize[_0xb282('0x7')]},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize[_0xb282('0x7')]},'deviceVendor':{'type':Sequelize[_0xb282('0x7')]},'deviceType':{'type':Sequelize[_0xb282('0x7')]},'referer':{'type':Sequelize[_0xb282('0x6')]},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize['TEXT'](_0xb282('0x9'))},'read1stAt':{'type':Sequelize[_0xb282('0x8')]},'lastMsgAt':{'type':Sequelize[_0xb282('0x8')]},'lastMsgDirection':{'type':Sequelize[_0xb282('0x4')]('in',_0xb282('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize[_0xb282('0x6')]},'autoreplyExecuted':{'type':Sequelize[_0xb282('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 182cc2d..047332f 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 _0x003c=['i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','merge','ChatInteraction','a.key','Account.key','a.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.firstName','Contact.firstName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','groupBy','show','fields','include','options','create','params','describe','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooMetadata','email','account','POST','vidaooNote','follow','isNull','metadata','Error\x20in\x20conversion\x20vidaooMetadata','ValidationError','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','customUpdate','CmContact','abandon','entity\x20not\x20found','AbandonInteraction','attachmentUpload','file','originalname','filename','Unauthorized','Attachment','ChatOfflineMessageId','server/files/attachments/','join','offline-chat/','basename','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','Messages','%s%d','System','customer','agentIdentifier','website_alias','agentAlias','agent_alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','MailServerOut','Smtp','service','host','port','secure','authentication','auth','pass','SendMail','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','getMessages','nolimit','ChatInteractionId','YYYY-MM-DD\x20HH:mm:ss','includeAll','rows','getMyMessages','includeAgent','addTags','setTags','omit','spread','emit','chatInteractionTags:save','removeTags','download','root','files','tmp','server','attachments','transcript-%d-%s.zip','Owner','get','mkdirSync','Chat','Account','N.A.','closedAt','browserName','osName','referer','customerIp','customerPort','existsSync','createReadStream','createWriteStream','firstName','lastName','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','ioredis','../../components/export/pdf','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','client','http','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','end','status','offset','limit','undefined','count','set','Content-Range','json','apply','reject','update','destroy','stack','name','render','contact','agent','interaction','Users','map','fullname','TagIds','Tags','forEach','push','waiting','talking','answered','unmanaged','abandoned','closed','UserId','disposition','total','index','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','hasOwnProperty','order','sort','where','pick','field','color','tools_tags','select','u.id','ui.ChatInteractionId','user_has_chat_interactions','left_join','users','u.id\x20=\x20ui.UserId','chat_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.ChatWebsiteId','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','length','find','unreadMessages','having','`\x20=\x200','Contact','operator','$substring','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','value','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','body','compact','isEmpty','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','$gte','parse','$lte'];(function(_0x59de2a,_0x264f62){var _0x1d18d2=function(_0x5c1a5a){while(--_0x5c1a5a){_0x59de2a['push'](_0x59de2a['shift']());}};_0x1d18d2(++_0x264f62);}(_0x003c,0x1ef));var _0xc003=function(_0x502ded,_0x1a6f19){_0x502ded=_0x502ded-0x0;var _0x37e8c3=_0x003c[_0x502ded];return _0x37e8c3;};'use strict';var emlformat=require(_0xc003('0x0'));var rimraf=require(_0xc003('0x1'));var zipdir=require(_0xc003('0x2'));var jsonpatch=require(_0xc003('0x3'));var rp=require(_0xc003('0x4'));var moment=require(_0xc003('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc003('0x6'));var util=require(_0xc003('0x7'));var path=require(_0xc003('0x8'));var sox=require(_0xc003('0x9'));var csv=require(_0xc003('0xa'));var ejs=require(_0xc003('0xb'));var fs=require('fs');var fs_extra=require(_0xc003('0xc'));var _=require(_0xc003('0xd'));var squel=require(_0xc003('0xe'));var crypto=require(_0xc003('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xc003('0x10'));var toCsv=require(_0xc003('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc003('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var pdf=require(_0xc003('0x12'));var hardwareService=require(_0xc003('0x13'));var logger=require(_0xc003('0x14'))('api');var utils=require(_0xc003('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xc003('0x16'));var db=require(_0xc003('0x17'))['db'];config[_0xc003('0x18')]=_[_0xc003('0x19')](config[_0xc003('0x18')],{'host':_0xc003('0x1a'),'port':0x18eb});var socket=require(_0xc003('0x1b'))(new Redis(config['redis']));require(_0xc003('0x1c'))[_0xc003('0x1d')](socket);var jayson=require(_0xc003('0x1e'));var client=jayson[_0xc003('0x1f')][_0xc003('0x20')]({'port':0x232b});var client9004=jayson[_0xc003('0x1f')][_0xc003('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x3a3648,_0x2c9677,_0x4ee9a7,_0x45c53d){return new BPromise(function(_0x5eee41,_0x4e61da){var _0xb208eb=_0x45c53d||client;return _0xb208eb['request'](_0x3a3648,_0x4ee9a7)[_0xc003('0x21')](function(_0x35760b){logger[_0xc003('0x22')](_0xc003('0x23'),_0x2c9677,_0xc003('0x24'));logger[_0xc003('0x25')](_0xc003('0x26'),_0x2c9677,'request\x20sent',JSON['stringify'](_0x35760b));if(_0x35760b[_0xc003('0x27')]){if(_0x35760b[_0xc003('0x27')][_0xc003('0x28')]===0x1f4){logger['error'](_0xc003('0x23'),_0x2c9677,_0x35760b[_0xc003('0x27')][_0xc003('0x29')]);return _0x4e61da(_0x35760b[_0xc003('0x27')][_0xc003('0x29')]);}logger['error'](_0xc003('0x23'),_0x2c9677,_0x35760b['error']['message']);return _0x5eee41(_0x35760b[_0xc003('0x27')][_0xc003('0x29')]);}else{logger[_0xc003('0x22')](_0xc003('0x23'),_0x2c9677,_0xc003('0x24'));_0x5eee41(_0x35760b[_0xc003('0x2a')][_0xc003('0x29')]);}})[_0xc003('0x2b')](function(_0x24e127){logger['error'](_0xc003('0x23'),_0x2c9677,_0x24e127);_0x4e61da(_0x24e127);});});}function respondWithStatusCode(_0x546327,_0xddabf9){_0xddabf9=_0xddabf9||0xcc;return function(_0x5b2cc1){if(_0x5b2cc1){return _0x546327[_0xc003('0x2c')](_0xddabf9);}return _0x546327['status'](_0xddabf9)[_0xc003('0x2d')]();};}function respondWithResult(_0x156cd9,_0x2ec34f){_0x2ec34f=_0x2ec34f||0xc8;return function(_0xc9ba37){if(_0xc9ba37){return _0x156cd9[_0xc003('0x2e')](_0x2ec34f)['json'](_0xc9ba37);}};}function respondWithFilteredResult(_0x52a89a,_0x327ff3){return function(_0x26f9c3){if(_0x26f9c3){var _0x30bb2a=typeof _0x327ff3[_0xc003('0x2f')]==='undefined'&&typeof _0x327ff3[_0xc003('0x30')]===_0xc003('0x31');var _0x320998=_0x26f9c3[_0xc003('0x32')];var _0xbc8342=_0x30bb2a?0x0:_0x327ff3[_0xc003('0x2f')];var _0x560c44=_0x30bb2a?_0x26f9c3[_0xc003('0x32')]:_0x327ff3['offset']+_0x327ff3[_0xc003('0x30')];var _0x33df9c;if(_0x560c44>=_0x320998){_0x560c44=_0x320998;_0x33df9c=0xc8;}else{_0x33df9c=0xce;}_0x52a89a[_0xc003('0x2e')](_0x33df9c);return _0x52a89a[_0xc003('0x33')](_0xc003('0x34'),_0xbc8342+'-'+_0x560c44+'/'+_0x320998)[_0xc003('0x35')](_0x26f9c3);}return null;};}function patchUpdates(_0x45b498){return function(_0x431eb1){try{jsonpatch[_0xc003('0x36')](_0x431eb1,_0x45b498,!![]);}catch(_0x5e3c65){return BPromise[_0xc003('0x37')](_0x5e3c65);}return _0x431eb1['save']();};}function saveUpdates(_0x51fc12,_0xf9cdf7){return function(_0x257f6a){if(_0x257f6a){return _0x257f6a[_0xc003('0x38')](_0x51fc12)['then'](function(_0x53726b){return _0x53726b;});}return null;};}function removeEntity(_0x4827fa,_0x2183ae){return function(_0x48e0f6){if(_0x48e0f6){return _0x48e0f6[_0xc003('0x39')]()[_0xc003('0x21')](function(){_0x4827fa['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4bbff5,_0x15c643){return function(_0x49f80b){if(!_0x49f80b){_0x4bbff5[_0xc003('0x2c')](0x194);}return _0x49f80b;};}function handleError(_0x55671b,_0x4d3dc8){_0x4d3dc8=_0x4d3dc8||0x1f4;return function(_0x35aef0){logger['error'](_0x35aef0[_0xc003('0x3a')]);if(_0x35aef0[_0xc003('0x3b')]){delete _0x35aef0[_0xc003('0x3b')];}_0x55671b['status'](_0x4d3dc8)['send'](_0x35aef0);};}function getMustacheRender(_0x3cfad9,_0x42d62b){return Mustache[_0xc003('0x3c')](_0x3cfad9,_['merge'](_0x42d62b['body'],{'contact':_0x42d62b[_0xc003('0x3d')],'message':_0x42d62b[_0xc003('0x29')],'agent':_0x42d62b[_0xc003('0x3e')],'interaction':_0x42d62b[_0xc003('0x3f')],'account':_0x42d62b['account']}))||'';}function getInteractionUsers(_0x9f5ce0,_0x3afabe){return new BPromise(function(_0x5d1e80,_0x5d2a8e){try{if(_0x3afabe[_0x9f5ce0['id']]){_0x9f5ce0[_0xc003('0x40')]=_[_0xc003('0x41')](_0x3afabe[_0x9f5ce0['id']],function(_0x41ba41){return{'id':_0x41ba41['id'],'fullname':_0x41ba41[_0xc003('0x42')]};});}}catch(_0x2aeeaf){_0x5d2a8e(_0x2aeeaf);}_0x5d1e80(_0x9f5ce0);});}function getInteractionTags(_0x2252d1,_0x2a58ec){return new BPromise(function(_0x3b5a7e,_0x2ca890){try{if(_0x2252d1[_0xc003('0x43')]){_0x2252d1[_0xc003('0x44')]=[];_0x2252d1[_0xc003('0x43')]['split'](',')[_0xc003('0x45')](function(_0x1d04cb){_0x2252d1[_0xc003('0x44')][_0xc003('0x46')](_0x2a58ec[_0x1d04cb]);});}delete _0x2252d1[_0xc003('0x43')];}catch(_0x301258){_0x2ca890(_0x301258);}_0x3b5a7e(_0x2252d1);});}function updateChatInteraction(_0x4d0d54,_0x22f8ef,_0x5c9a40){return new BPromise(function(_0x3e29b5,_0x1236a9){return getInteractionUsers(_0x4d0d54,_0x5c9a40)['then'](function(_0x457510){return getInteractionTags(_0x457510,_0x22f8ef);})[_0xc003('0x21')](function(_0x19fade){return getStateInteraction(_0x19fade);})['then'](function(_0x4de729){_0x3e29b5(_0x4de729);})[_0xc003('0x2b')](function(_0x54fdeb){_0x1236a9(_0x54fdeb);});});}function getStateInteraction(_0x59396f){return new BPromise(function(_0x3154e5){_0x59396f[_0xc003('0x47')]=0x0;_0x59396f[_0xc003('0x48')]=0x0;_0x59396f[_0xc003('0x49')]=0x0;_0x59396f[_0xc003('0x4a')]=0x0;_0x59396f[_0xc003('0x4b')]=0x0;_0x59396f['total']=0x0;if(!_0x59396f[_0xc003('0x4c')]&&!_0x59396f[_0xc003('0x4d')]){_0x59396f['waiting']+=0x1;}if(!_0x59396f[_0xc003('0x4c')]&&_0x59396f['UserId']){_0x59396f[_0xc003('0x48')]+=0x1;if(_0x59396f[_0xc003('0x47')]){_0x59396f[_0xc003('0x47')]-=0x1;}}if(_0x59396f[_0xc003('0x4c')]&&_0x59396f[_0xc003('0x4e')]===_0xc003('0x4b')){_0x59396f[_0xc003('0x4b')]+=0x1;if(_0x59396f[_0xc003('0x47')]){_0x59396f[_0xc003('0x47')]-=0x1;}}else if(_0x59396f[_0xc003('0x4c')]&&!_0x59396f[_0xc003('0x4d')]&&_0x59396f[_0xc003('0x4e')]){_0x59396f['unmanaged']+=0x1;if(_0x59396f[_0xc003('0x47')]){_0x59396f[_0xc003('0x47')]-=0x1;}}else if(_0x59396f[_0xc003('0x4c')]&&_0x59396f[_0xc003('0x4d')]){_0x59396f[_0xc003('0x49')]+=0x1;if(_0x59396f[_0xc003('0x48')]){_0x59396f[_0xc003('0x48')]-=0x1;}}_0x59396f[_0xc003('0x4f')]+=0x1;_0x3154e5(_0x59396f);});}exports[_0xc003('0x50')]=function(_0x8437ae,_0x53f58d){var _0x1fb1d2={},_0x2985cf={},_0x54fb07={'count':0x0,'rows':[]};var _0x9299c4=_['map'](db['ChatInteraction'][_0xc003('0x51')],function(_0x49ff1a){return{'name':_0x49ff1a[_0xc003('0x52')],'type':_0x49ff1a[_0xc003('0x53')]['key']};});_0x2985cf[_0xc003('0x54')]=_[_0xc003('0x41')](_0x9299c4,_0xc003('0x3b'));_0x2985cf[_0xc003('0x55')]=_[_0xc003('0x56')](_0x8437ae['query']);_0x2985cf[_0xc003('0x57')]=_[_0xc003('0x58')](_0x2985cf[_0xc003('0x54')],_0x2985cf[_0xc003('0x55')]);_0x1fb1d2[_0xc003('0x59')]=_['intersection'](_0x2985cf[_0xc003('0x54')],qs['fields'](_0x8437ae[_0xc003('0x55')]['fields']));_0x1fb1d2['attributes']=_0x1fb1d2['attributes']['length']?_0x1fb1d2[_0xc003('0x59')]:_0x2985cf[_0xc003('0x54')];if(!_0x8437ae[_0xc003('0x55')][_0xc003('0x5a')]('nolimit')){_0x1fb1d2[_0xc003('0x30')]=qs[_0xc003('0x30')](_0x8437ae['query'][_0xc003('0x30')]);_0x1fb1d2['offset']=qs[_0xc003('0x2f')](_0x8437ae[_0xc003('0x55')]['offset']);}_0x1fb1d2[_0xc003('0x5b')]=qs[_0xc003('0x5c')](_0x8437ae[_0xc003('0x55')][_0xc003('0x5c')]);_0x1fb1d2[_0xc003('0x5d')]=qs[_0xc003('0x57')](_[_0xc003('0x5e')](_0x8437ae[_0xc003('0x55')],_0x2985cf[_0xc003('0x57')]),_0x9299c4);var _0x5dcd46=[];var _0x40f2f7=squel['select']()[_0xc003('0x5f')]('id')['field'](_0xc003('0x3b'))['field'](_0xc003('0x60'))['from'](_0xc003('0x61'));var _0x87ff76=squel[_0xc003('0x62')]()['field'](_0xc003('0x63'))['field']('u.fullname')[_0xc003('0x5f')](_0xc003('0x64'))['from'](_0xc003('0x65'),'ui')[_0xc003('0x66')](_0xc003('0x67'),'u',_0xc003('0x68'));var _0x35826c=squel[_0xc003('0x62')]()['from'](_0xc003('0x69'),'i')[_0xc003('0x66')](_0xc003('0x6a'),'c',_0xc003('0x6b'))[_0xc003('0x66')](_0xc003('0x67'),'o',_0xc003('0x6c'))[_0xc003('0x66')]('chat_websites','a',_0xc003('0x6d'))[_0xc003('0x66')]('chat_messages','me',_0xc003('0x6e'))['left_join'](_0xc003('0x6f'),'it','it.ChatInteractionId\x20=\x20i.id')[_0xc003('0x66')](_0xc003('0x61'),'t',_0xc003('0x70'));var _0x1fedd4=squel[_0xc003('0x71')]();var _0x107bac=[];var _0x208899=squel[_0xc003('0x71')]();var _0x292932;if(_0x8437ae['query'][_0xc003('0x72')]){_0x292932=as[_0xc003('0x73')](_0x8437ae[_0xc003('0x55')][_0xc003('0x72')]);var _0x9849aa=_0x292932[_0xc003('0x74')];for(var _0x1e5452=0x0;_0x1e5452<_0x292932[_0xc003('0x75')][_0xc003('0x76')];_0x1e5452++){var _0x6420ee=_0x292932[_0xc003('0x75')][_0x1e5452];var _0x774913='i';var _0x3e5bdc=_[_0xc003('0x77')](_0x9299c4,[_0xc003('0x3b'),_0x6420ee[_0xc003('0x5f')]]);if(!_0x3e5bdc){switch(_0x6420ee[_0xc003('0x5f')]){case _0xc003('0x78'):if(_0x6420ee['value']==0x1){_0x35826c[_0xc003('0x79')]('`'+_0x6420ee[_0xc003('0x5f')]+_0xc003('0x7a'));}else{_0x35826c[_0xc003('0x79')]('`'+_0x6420ee['field']+'`\x20>\x200');}break;case _0xc003('0x7b'):if(_0x6420ee[_0xc003('0x7c')]===_0xc003('0x7d')){if(_0x6420ee['value'][_0xc003('0x7e')]('\x20')[_0xc003('0x76')]>0x1){_0x1fedd4[_0x9849aa](_0xc003('0x7f'),qs[_0xc003('0x80')](_0x6420ee['value']),null);}else{var _0x73b4a8='%'+_0x6420ee[_0xc003('0x81')]+'%';_0x1fedd4[_0x9849aa]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x73b4a8,_0x73b4a8,_0x73b4a8);}}else{_0x3e5bdc=_[_0xc003('0x77')](_0x9299c4,[_0xc003('0x3b'),_0xc003('0x82')]);_0x6420ee[_0xc003('0x5f')]=_0xc003('0x82');_0x5921ee=as[_0xc003('0x83')](_0x774913,_0x3e5bdc['type'],_0x6420ee);_0x1fedd4[_0x9849aa](_0x5921ee[_0xc003('0x84')],_0x5921ee[_0xc003('0x81')][_0xc003('0x85')],_0x5921ee[_0xc003('0x81')]['end']);}break;case _0xc003('0x86'):var _0x45844a=_0x6420ee[_0xc003('0x81')]['split'](',')[_0xc003('0x41')](function(_0x1287c8){return Number(_0x1287c8);});_0x45844a['forEach'](function(_0x52b899){_0x208899['or'](_0xc003('0x87'),'%,'+_0x52b899+',%');});_0x107bac=_[_0xc003('0x88')](_0x107bac,_0x45844a);break;case _0xc003('0x89'):if(_0x6420ee[_0xc003('0x7c')]===_0xc003('0x7d')){_0x1fedd4[_0x9849aa](_0xc003('0x8a'),'%'+_0x6420ee[_0xc003('0x81')]+'%',null);}else{_0x3e5bdc=_['find'](_0x9299c4,['name',_0xc003('0x4d')]);_0x6420ee[_0xc003('0x5f')]=_0xc003('0x4d');_0x5921ee=as[_0xc003('0x83')](_0x774913,_0x3e5bdc['type'],_0x6420ee);_0x1fedd4[_0x9849aa](_0x5921ee[_0xc003('0x84')],_0x5921ee[_0xc003('0x81')]['start'],_0x5921ee[_0xc003('0x81')][_0xc003('0x2d')]);}break;case _0xc003('0x8b'):_0x5921ee=as[_0xc003('0x83')]('me',null,_0x6420ee);_0x1fedd4[_0x9849aa](_0x5921ee[_0xc003('0x84')],_0x5921ee[_0xc003('0x81')][_0xc003('0x85')],_0x5921ee[_0xc003('0x81')]['end']);break;}}else{var _0x5921ee=as[_0xc003('0x83')](_0x774913,_0x3e5bdc['type'],_0x6420ee);_0x1fedd4[_0x9849aa](_0x5921ee['text'],_0x5921ee['value'][_0xc003('0x85')],_0x5921ee[_0xc003('0x81')]['end']);}}}else{var _0x2f8b9d=_(_0x8437ae[_0xc003('0x55')])[_0xc003('0x56')]()[_0xc003('0x41')](function(_0x5b4330){return _['some'](_0x9299c4,[_0xc003('0x3b'),_0x5b4330])?_0x5b4330:undefined;})[_0xc003('0x8c')]()[_0xc003('0x81')]();if(!_[_0xc003('0x8d')](_0x2f8b9d)){_0x2f8b9d[_0xc003('0x45')](function(_0x1daa9f){if(_0x1daa9f===_0xc003('0x8e')){_0x35826c['where'](_0xc003('0x8f'),[][_0xc003('0x90')](_0x8437ae[_0xc003('0x55')][_0x1daa9f]));}else if(_0x1daa9f===_0xc003('0x91')){var _0x425a7a=JSON['parse'](_0x8437ae[_0xc003('0x55')][_0x1daa9f])[_0xc003('0x92')];var _0x1ef572=JSON[_0xc003('0x93')](_0x8437ae[_0xc003('0x55')][_0x1daa9f])[_0xc003('0x94')];_0x35826c[_0xc003('0x5d')](_0xc003('0x95'),_0x425a7a,_0x1ef572);}else{if(_0x8437ae['query'][_0x1daa9f]===_0xc003('0x96')){_0x35826c[_0xc003('0x5d')]('i.'+_0x1daa9f+'\x20IS\x20NULL');}else{_0x35826c[_0xc003('0x5d')]('i.'+_0x1daa9f+_0xc003('0x97'),_0x8437ae[_0xc003('0x55')][_0x1daa9f]);}}});}if(_0x8437ae['query'][_0xc003('0x98')]){if(_0x8437ae[_0xc003('0x55')][_0xc003('0x98')]==0x1){_0x35826c[_0xc003('0x79')](_0xc003('0x99'));}else{_0x35826c[_0xc003('0x79')](_0xc003('0x9a'));}}if(_0x8437ae[_0xc003('0x55')][_0xc003('0x9b')]){_0x107bac=_['isArray'](_0x8437ae[_0xc003('0x55')][_0xc003('0x9b')])?_0x8437ae[_0xc003('0x55')][_0xc003('0x9b')]:new Array(_0x8437ae[_0xc003('0x55')][_0xc003('0x9b')]);_0x107bac[_0xc003('0x45')](function(_0x35650d){_0x208899['or'](_0xc003('0x87'),'%,'+_0x35650d+',%');});}if(_0x8437ae[_0xc003('0x55')][_0xc003('0x9c')]){var _0x37961a=_0x8437ae[_0xc003('0x55')][_0xc003('0x9c')][_0xc003('0x9d')]('\x5c','\x5c\x5c')[_0xc003('0x9d')](/'/g,'\x27\x27');if(qs[_0xc003('0x9e')](_0x37961a)){_0x1fedd4['or'](_0xc003('0x9f'),_0x37961a+'%');}else{_0x1fedd4['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xc003('0x80')](_0x37961a))['or'](_0xc003('0xa0'),_0x37961a+'%');}}}_0x35826c['where'](_0x1fedd4);_0x35826c[_0xc003('0xa1')](_0xc003('0xa2'));var _0x57326e={'type':db[_0xc003('0xa3')][_0xc003('0xa4')][_0xc003('0xa5')],'raw':!![]};var _0x57cc44=_0x35826c[_0xc003('0xa6')]();_0x57cc44[_0xc003('0x5f')](_0xc003('0xa2'));_0x57cc44[_0xc003('0x5f')](_0xc003('0xa7'),_0xc003('0x78'));if(_0x1fb1d2['order']){_0x1fb1d2[_0xc003('0x5b')][_0xc003('0x45')](function(_0xc6bc2d){var _0x5691d7=_0xc6bc2d[0x0]===_0xc003('0xa8')?_0xc6bc2d[0x0]:'i.'+_0xc6bc2d[0x0];_0x35826c[_0xc003('0x5b')](_0x5691d7,_0xc6bc2d[0x1]===_0xc003('0xa9')?![]:!![]);});}if(!_['isEmpty'](_0x107bac)){_0x35826c[_0xc003('0x79')](_0x208899);_0x57cc44[_0xc003('0x5d')](_0xc003('0xaa'),_0x107bac);}BPromise[_0xc003('0xab')]()[_0xc003('0x21')](function(){if(!_0x292932){if(_0x8437ae[_0xc003('0x55')]['ChatWebsiteId'])return;_0x57cc44['where'](_0xc003('0xac'));_0x35826c[_0xc003('0x5d')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');return;}if(_0x8437ae[_0xc003('0xad')][_0xc003('0xae')]!=='agent')return;return _0x8437ae[_0xc003('0xad')]['getChatWebsites']({'attributes':['id'],'raw':!![]})['then'](function(_0x4a7f2e){if(_[_0xc003('0x8d')](_0x4a7f2e)){_0x57cc44[_0xc003('0x5d')](_0xc003('0xaf'));_0x35826c[_0xc003('0x5d')](_0xc003('0xaf'));}else{_0x57cc44[_0xc003('0x5d')](_0xc003('0x8f'),_['map'](_0x4a7f2e,'id'));_0x35826c[_0xc003('0x5d')](_0xc003('0x8f'),_[_0xc003('0x41')](_0x4a7f2e,'id'));}});})['then'](function(){if(_0x8437ae[_0xc003('0xad')][_0xc003('0xae')]===_0xc003('0x3e')&&!_0x292932&&!_0x8437ae[_0xc003('0x55')][_0xc003('0x8e')])return[];return db[_0xc003('0xb0')][_0xc003('0x55')](_0x57cc44[_0xc003('0xb1')](),_0x57326e);})[_0xc003('0x21')](function(_0x59b2f5){_0x54fb07[_0xc003('0x32')]=_0x59b2f5[_0xc003('0x76')];if(_0x54fb07[_0xc003('0x32')]===0x0)return[];return db[_0xc003('0xb0')][_0xc003('0x55')](_0x40f2f7[_0xc003('0xb1')](),_0x57326e)[_0xc003('0x21')](function(_0x1366a3){_0x5dcd46=_['keyBy'](_0x1366a3,'id');_0x57326e=_[_0xc003('0xb2')](_0x57326e,{'model':db[_0xc003('0xb3')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x8437ae[_0xc003('0x55')]['fields']){_0x1fb1d2[_0xc003('0x59')][_0xc003('0x45')](function(_0x20eba0){_0x35826c[_0xc003('0x5f')]('i.'+_0x20eba0);});}else{_0x35826c[_0xc003('0x5f')](_0xc003('0xa7'),_0xc003('0x78'));_0x35826c['field'](_0xc003('0xb4'),_0xc003('0xb5'));_0x35826c[_0xc003('0x5f')](_0xc003('0xb6'),'Account.mandatoryDisposition');_0x35826c[_0xc003('0x5f')](_0xc003('0xb7'),_0xc003('0xa8'));_0x35826c[_0xc003('0x5f')]('i.*');_0x35826c[_0xc003('0x5f')](_0xc003('0xb8'),_0xc003('0xb9'));_0x35826c[_0xc003('0x5f')]('c.lastName','Contact.lastName');_0x35826c[_0xc003('0x5f')](_0xc003('0xba'),_0xc003('0xbb'));_0x35826c[_0xc003('0x5f')](_0xc003('0xbc'),_0xc003('0xbd'));_0x35826c[_0xc003('0x5f')](_0xc003('0xbe'),_0xc003('0xbf'));_0x35826c[_0xc003('0x5f')]('c.fax',_0xc003('0xc0'));_0x35826c[_0xc003('0x5f')](_0xc003('0xc1'),_0xc003('0xc2'));_0x35826c[_0xc003('0x5f')]('o.internal',_0xc003('0xc3'));_0x35826c['field'](_0xc003('0xc4'),_0xc003('0x43'));}if(_0x1fb1d2['limit'])_0x35826c[_0xc003('0x30')](_0x1fb1d2[_0xc003('0x30')]);if(_0x1fb1d2[_0xc003('0x2f')])_0x35826c[_0xc003('0x2f')](_0x1fb1d2[_0xc003('0x2f')]);return db[_0xc003('0xb0')][_0xc003('0x55')](_0x35826c[_0xc003('0xb1')](),_0x57326e);})['then'](function(_0x4970d7){if(_0x4970d7[_0xc003('0x76')]>0x0)_0x87ff76[_0xc003('0x5d')](_0xc003('0xc5'),_[_0xc003('0x41')](_0x4970d7,'id'));return db[_0xc003('0xb0')][_0xc003('0x55')](_0x87ff76[_0xc003('0xb1')](),_0x57326e)[_0xc003('0x21')](function(_0xe8fad4){var _0x5ebdef=_[_0xc003('0xc6')](_0xe8fad4,'ChatInteractionId');var _0x3f93cf=[];_0x4970d7[_0xc003('0x45')](function(_0x246f14){_0x3f93cf[_0xc003('0x46')](updateChatInteraction(_0x246f14,_0x5dcd46,_0x5ebdef));});return BPromise['all'](_0x3f93cf);});});})[_0xc003('0x21')](function(_0x3dff0c){_0x54fb07['rows']=_0x3dff0c;return _0x54fb07;})[_0xc003('0x21')](respondWithFilteredResult(_0x53f58d,_0x1fb1d2))[_0xc003('0x2b')](handleError(_0x53f58d,null));};exports[_0xc003('0xc7')]=function(_0x2dfdd0,_0x461b73){var _0x352000={'raw':![],'where':{'id':_0x2dfdd0['params']['id']}},_0x277dc8={};_0x277dc8['model']=_[_0xc003('0x56')](db[_0xc003('0xb3')][_0xc003('0x51')]);_0x277dc8[_0xc003('0x55')]=_[_0xc003('0x56')](_0x2dfdd0[_0xc003('0x55')]);_0x277dc8[_0xc003('0x57')]=_[_0xc003('0x58')](_0x277dc8[_0xc003('0x54')],_0x277dc8[_0xc003('0x55')]);_0x352000[_0xc003('0x59')]=_[_0xc003('0x58')](_0x277dc8['model'],qs[_0xc003('0xc8')](_0x2dfdd0[_0xc003('0x55')][_0xc003('0xc8')]));_0x352000[_0xc003('0x59')]=_0x352000[_0xc003('0x59')]['length']?_0x352000[_0xc003('0x59')]:_0x277dc8[_0xc003('0x54')];if(_0x2dfdd0[_0xc003('0x55')]['includeAll']){_0x352000[_0xc003('0xc9')]=[{'all':!![]}];}_0x352000=_['merge']({},_0x352000,_0x2dfdd0[_0xc003('0xca')]);return db[_0xc003('0xb3')][_0xc003('0x77')](_0x352000)[_0xc003('0x21')](handleEntityNotFound(_0x461b73,null))[_0xc003('0x21')](respondWithResult(_0x461b73,null))[_0xc003('0x2b')](handleError(_0x461b73,null));};exports[_0xc003('0xcb')]=function(_0x2dced2,_0x71848){return db[_0xc003('0xb3')][_0xc003('0xcb')](_0x2dced2[_0xc003('0x8b')],{})[_0xc003('0x21')](respondWithResult(_0x71848,0xc9))[_0xc003('0x2b')](handleError(_0x71848,null));};exports[_0xc003('0x38')]=function(_0x5038a8,_0x5327ce){if(_0x5038a8['body']['id']){delete _0x5038a8[_0xc003('0x8b')]['id'];}return db[_0xc003('0xb3')]['find']({'where':{'id':_0x5038a8['params']['id']}})[_0xc003('0x21')](handleEntityNotFound(_0x5327ce,null))['then'](saveUpdates(_0x5038a8[_0xc003('0x8b')],null))['then'](respondWithResult(_0x5327ce,null))[_0xc003('0x2b')](handleError(_0x5327ce,null));};exports[_0xc003('0x39')]=function(_0x4fb943,_0x2d8076){return db['ChatInteraction'][_0xc003('0x77')]({'where':{'id':_0x4fb943[_0xc003('0xcc')]['id']}})['then'](handleEntityNotFound(_0x2d8076,null))['then'](removeEntity(_0x2d8076,null))[_0xc003('0x2b')](handleError(_0x2d8076,null));};exports[_0xc003('0xcd')]=function(_0x3faabe,_0x5c4956){return db[_0xc003('0xb3')][_0xc003('0xcd')]()[_0xc003('0x21')](respondWithResult(_0x5c4956,null))[_0xc003('0x2b')](handleError(_0x5c4956,null));};exports['createVidaooSession']=function(_0x1fb25f,_0x1ba3a8){var _0x5e9169=_0x1fb25f[_0xc003('0xcc')]['id'];var _0x52668a;var _0x4af4cc;var _0x2b7d04;return db['ChatInteraction'][_0xc003('0xce')]({'where':{'id':_0x5e9169}})['then'](function(_0x19d062){_0x52668a=_0x19d062;return db[_0xc003('0xcf')][_0xc003('0xce')]({'where':{'id':_0x19d062['ChatWebsiteId']},'attributes':['id',_0xc003('0xd0'),_0xc003('0xd1'),_0xc003('0xd2'),'vidaooNote',_0xc003('0xd3')],'raw':!![]});})[_0xc003('0x21')](function(_0x4940ca){if(_0x4940ca&&_0x4940ca['vidaooApiKey']&&_0x4940ca[_0xc003('0xd1')]){_0x4af4cc=_0x4940ca;var _0x463422={'interaction':{'id':_0x5e9169},'agent':{'id':_0x1fb25f[_0xc003('0xad')]['id'],'name':_0x1fb25f[_0xc003('0xad')][_0xc003('0x3b')],'fullname':_0x1fb25f[_0xc003('0xad')][_0xc003('0x42')],'email':_0x1fb25f[_0xc003('0xad')][_0xc003('0xd4')]},'contact':_0x1fb25f[_0xc003('0x8b')][_0xc003('0x3d')],'account':_0x1fb25f[_0xc003('0x8b')][_0xc003('0xd5')]};var _0x34714e={'rejectUnauthorized':![],'method':_0xc003('0xd6'),'url':'https://api-vidaoo.xcally.com/api/v1/meetings','headers':{'X-APIKEY':_0x4940ca['vidaooApiKey']},'body':{'duration':null,'scheduledAt':null,'participants':[_0x1fb25f['user'][_0xc003('0xd4')]],'buttons':null,'topic':_0x4af4cc[_0xc003('0xd2')],'note':_['isNull'](_0x4af4cc[_0xc003('0xd7')])?null:getMustacheRender(_0x4af4cc['vidaooNote'],_0x463422),'metadata':null},'redirect':_0xc003('0xd8'),'json':!![]};try{if(!_[_0xc003('0xd9')](_0x4af4cc[_0xc003('0xd3')])){var _0x48f66a=getMustacheRender(_0x4af4cc['vidaooMetadata'],_0x463422);var _0x159231=JSON[_0xc003('0x93')](_0x48f66a);_0x34714e[_0xc003('0x8b')][_0xc003('0xda')]=_0x159231;}}catch(_0x253ee3){throw new db[(_0xc003('0xa3'))]['ValidationError'](_0xc003('0xdb'));}return rp(_0x34714e);}else{throw new db[(_0xc003('0xa3'))][(_0xc003('0xdc'))]('Error\x20in\x20Vidaoo\x20configuration');}})['then'](function(_0x2be8f8){_0x2b7d04=_0x2be8f8;if(_0x2b7d04['id']){var _0x50376e={'body':_0x2b7d04[_0xc003('0xdd')],'ChatWebsiteId':_0x4af4cc['id'],'ChatInteractionId':_0x52668a['id'],'direction':_0xc003('0xde'),'UserId':_0x1fb25f['user']['id']};return db[_0xc003('0xdf')][_0xc003('0xcb')](_0x50376e,{});}else{throw new db[(_0xc003('0xa3'))][(_0xc003('0xdc'))](_0xc003('0xe0'));}})[_0xc003('0x21')](function(){return _0x52668a['updateAttributes']({'vidaooSessionId':_0x2b7d04['id']});})[_0xc003('0x21')](respondWithResult(_0x1ba3a8,null))[_0xc003('0x2b')](handleError(_0x1ba3a8,null));};exports[_0xc003('0xe1')]=function(_0x191034,_0x2796c0){if(_0x191034['body']['id']){delete _0x191034[_0xc003('0x8b')]['id'];}return db[_0xc003('0xb3')][_0xc003('0x77')]({'where':{'id':_0x191034[_0xc003('0xcc')]['id']},'include':[{'model':db[_0xc003('0xe2')],'as':_0xc003('0x7b')}]})[_0xc003('0x21')](handleEntityNotFound(_0x2796c0,null))[_0xc003('0x21')](saveUpdates(_0x191034[_0xc003('0x8b')],null))[_0xc003('0x21')](respondWithResult(_0x2796c0,null))[_0xc003('0x2b')](handleError(_0x2796c0,null));};exports[_0xc003('0xe3')]=function(_0x258eed,_0x3f4d5e,_0x398bbc){if(_0x258eed[_0xc003('0x8b')]['id']){delete _0x258eed[_0xc003('0x8b')]['id'];}return db[_0xc003('0xb3')]['find']({'where':{'id':_0x258eed['params']['id']}})[_0xc003('0x21')](function(_0x500fa1){if(!_0x500fa1){logger[_0xc003('0x27')]('abandonInteraction,\x20%s,\x20%s,\x20%s','abandon',0x194,_0xc003('0xe4'));_0x3f4d5e['sendStatus'](0x194);}else{if(_0x500fa1[_0xc003('0x4d')]){throw new db[(_0xc003('0xa3'))][(_0xc003('0xdc'))]('Interaction\x20already\x20assigned');}}return _0x500fa1;})[_0xc003('0x21')](function(_0x4cd821){if(_0x4cd821){return _0x4cd821['update']({'closed':_0x258eed['body'][_0xc003('0x4c')],'disposition':_0x258eed[_0xc003('0x8b')]['disposition']})[_0xc003('0x21')](function(_0x330aec){return _0x330aec;});}})[_0xc003('0x21')](function(_0x4941be){return respondWithRpcPromise(_0xc003('0xe5'),_0xc003('0xe3'),_0x258eed[_0xc003('0x8b')],client9004);})[_0xc003('0x21')](respondWithResult(_0x3f4d5e,null))[_0xc003('0x2b')](handleError(_0x3f4d5e,null));};exports[_0xc003('0xe6')]=function(_0x11b81b,_0x2e4b10,_0x4e1dcb){_0x11b81b['body'][_0xc003('0x3b')]=_0x11b81b[_0xc003('0xe7')][_0xc003('0xe8')];_0x11b81b[_0xc003('0x8b')]['basename']=_0x11b81b[_0xc003('0xe7')][_0xc003('0xe9')];_0x11b81b[_0xc003('0x8b')][_0xc003('0x53')]=_0x11b81b[_0xc003('0xe7')]['mimetype'];return db['Attachment'][_0xc003('0xcb')](_0x11b81b[_0xc003('0x8b')])['then'](respondWithResult(_0x2e4b10,0xc9))[_0xc003('0x2b')](handleError(_0x2e4b10,null));};exports['attachmentDownload']=function(_0x386f6e,_0x4f85db,_0x541171){return db['ChatInteraction']['findOne']({'where':{'id':_0x386f6e[_0xc003('0xcc')]['id']},'raw':!![]})[_0xc003('0x21')](handleEntityNotFound(_0x4f85db,null))[_0xc003('0x21')](function(_0x343311){if(_0x343311){if(_0x343311[_0xc003('0x4c')]){return _0x4f85db[_0xc003('0x2e')](0x193)['json']({'status':0x193,'message':_0xc003('0xea')});}return db[_0xc003('0xeb')]['findOne']({'where':{'id':_0x386f6e[_0xc003('0x55')]['attachId']},'raw':!![]})[_0xc003('0x21')](handleEntityNotFound(_0x4f85db,null));}})[_0xc003('0x21')](function(_0x5416b1){if(_0x5416b1){var _0x522d41=_0x5416b1[_0xc003('0xec')]!==null;var _0x6e846b=path['join'](config['root'],_0xc003('0xed'));if(_0x522d41){_0x6e846b=path[_0xc003('0xee')](_0x6e846b,_0xc003('0xef'));}var _0xa74d2a=path[_0xc003('0xee')](_0x6e846b,_0x5416b1[_0xc003('0xf0')]);return _0x4f85db['download'](_0xa74d2a);}})['catch'](handleError(_0x4f85db,null));};exports['close']=function(_0xf5090e,_0x51234d){var _0x2d1e20=null;var _0x17f8de=null;var _0x463afb=null;var _0x354647=null;if(_0xf5090e[_0xc003('0x8b')]['id']){delete _0xf5090e[_0xc003('0x8b')]['id'];}if(_0xf5090e[_0xc003('0x8b')][_0xc003('0xf1')]){_0x354647=path['join'](config['root'],_0xc003('0xf2'),util[_0xc003('0xf3')](_0xc003('0xf4'),Date[_0xc003('0xf5')]()));_0xf5090e[_0xc003('0x8b')][_0xc003('0xf6')]=_0x354647;}return db['ChatInteraction'][_0xc003('0x77')]({'where':{'id':_0xf5090e[_0xc003('0xcc')]['id']},'include':[{'model':db['ChatMessage'],'as':'Messages','include':[{'model':db[_0xc003('0x89')],'as':_0xc003('0x89')}]}]})[_0xc003('0x21')](handleEntityNotFound(_0x51234d,null))['then'](saveUpdates(_0xf5090e[_0xc003('0x8b')],null))[_0xc003('0x21')](function(_0x516bdf){if(_0x516bdf){_0x2d1e20=_0x516bdf;return db[_0xc003('0xcf')][_0xc003('0x77')]({'where':{'id':_0x2d1e20[_0xc003('0x8e')]}});}})[_0xc003('0x21')](function(_0x4721d4){if(_0x4721d4){_0x463afb=_0x4721d4;return db[_0xc003('0xe2')][_0xc003('0x77')]({'where':{'id':_0x2d1e20[_0xc003('0x82')]}});}})[_0xc003('0x21')](function(_0x27b5ac){if(_0x27b5ac){_0x17f8de=_0x27b5ac;if(_0x354647){var _0x258264=null;for(var _0x47b967=0x1;_0x47b967<_0x2d1e20[_0xc003('0xf7')]['length'];++_0x47b967){_0x258264=_0x2d1e20[_0xc003('0xf7')][_0x47b967];var _0x3c5c3c=_0x258264[_0xc003('0x4d')]?util[_0xc003('0xf3')](_0xc003('0xf8'),_0x463afb['agentAlias'],_0x258264[_0xc003('0x4d')]):_0xc003('0xf9');var _0x490467=_0xf5090e[_0xc003('0x8b')][_0xc003('0xfa')]||util['format'](_0xc003('0xf8'),'Visitor',_0x258264[_0xc003('0x82')]);switch(_0x463afb[_0xc003('0xfb')]){case _0xc003('0xfc'):_0x3c5c3c=_0x258264['UserId']?util[_0xc003('0xf3')](_0xc003('0xf8'),_0x463afb[_0xc003('0xfd')],_0x258264[_0xc003('0x4d')]):'System';break;case _0xc003('0xfe'):_0x3c5c3c=_0x258264[_0xc003('0x4d')]?_0x258264[_0xc003('0x89')]['alias']||_0x258264[_0xc003('0x89')]['fullname']:_0xc003('0xf9');break;case _0xc003('0xff'):_0x3c5c3c=_0x258264[_0xc003('0x4d')]?_0x258264[_0xc003('0x89')][_0xc003('0x42')]:_0xc003('0xf9');break;default:_0x3c5c3c=_0x258264[_0xc003('0x4d')]?util[_0xc003('0xf3')](_0xc003('0xf8'),_0x463afb[_0xc003('0xfd')],_0x258264['UserId']):_0xc003('0xf9');}var _0x2437f3=util[_0xc003('0xf3')](_0xc003('0x100'),moment(_0x258264['createdAt'])[_0xc003('0xf3')](_0xc003('0x101')),_0x258264[_0xc003('0x102')]==='in'?_0x490467:_0x3c5c3c,_0x258264[_0xc003('0x8b')]);if(!_0x258264[_0xc003('0x103')]){fs[_0xc003('0x104')](_0x354647,_0x2437f3);}}return db[_0xc003('0x105')][_0xc003('0xce')]({'where':{'service':!![]},'include':[{'model':db[_0xc003('0x106')],'as':_0xc003('0x107'),'raw':!![]}]});}}})[_0xc003('0x21')](function(_0xc1a5e9){if(_0xc1a5e9&&_0xc1a5e9[_0xc003('0x107')]&&_0xf5090e[_0xc003('0x8b')]){var _0x50cf1d={'tls':{'rejectUnauthorized':![]}};if(_0xc1a5e9[_0xc003('0x107')][_0xc003('0x108')]){_0x50cf1d[_0xc003('0x108')]=_0xc1a5e9[_0xc003('0x107')]['service'];}else{_0x50cf1d[_0xc003('0x109')]=_0xc1a5e9[_0xc003('0x107')][_0xc003('0x109')];_0x50cf1d[_0xc003('0x10a')]=_0xc1a5e9[_0xc003('0x107')][_0xc003('0x10a')];_0x50cf1d[_0xc003('0x10b')]=_0xc1a5e9[_0xc003('0x107')][_0xc003('0x10b')];}if(_0xc1a5e9[_0xc003('0x107')][_0xc003('0x10c')]){_0x50cf1d[_0xc003('0x10d')]={'user':_0xc1a5e9['Smtp'][_0xc003('0xad')],'pass':_0xc1a5e9[_0xc003('0x107')][_0xc003('0x10e')]};}return respondWithRpcPromise(_0xc003('0x10f'),'sendMail',{'account':_0x50cf1d,'message':{'from':util[_0xc003('0xf3')]('\x22%s\x22\x20<%s>',_0xc1a5e9['name'],_0xc1a5e9[_0xc003('0xd4')]||_0xc1a5e9['Smtp'][_0xc003('0xad')]),'to':_0xf5090e[_0xc003('0x8b')][_0xc003('0xf1')],'subject':'Mail\x20Transcript','text':util[_0xc003('0xf3')](_0xc003('0x110'),_0xf5090e[_0xc003('0x8b')]['mailTranscript']),'attachments':[{'path':_0x354647}]}})[_0xc003('0x21')](function(){return _0x2d1e20;})[_0xc003('0x2b')](function(_0x30d032){console['error'](_0x30d032);});}else{return _0x2d1e20;}})[_0xc003('0x21')](respondWithStatusCode(_0x51234d,0xc8))[_0xc003('0x2b')](handleError(_0x51234d,null));};exports[_0xc003('0x111')]=function(_0x915e8,_0x4b2b0b,_0x5955ce){return db[_0xc003('0xdf')]['find']({'where':{'id':_0x915e8['params']['id']}})[_0xc003('0x21')](handleEntityNotFound(_0x4b2b0b,null))[_0xc003('0x21')](function(_0x52f0a6){if(_0x52f0a6){return _0x52f0a6[_0xc003('0x111')](_0x915e8[_0xc003('0x8b')][_0xc003('0x112')],_['omit'](_0x915e8[_0xc003('0x8b')],[_0xc003('0x112'),'id'])||{});}})['then'](respondWithResult(_0x4b2b0b,null))[_0xc003('0x2b')](handleError(_0x4b2b0b,null));};exports[_0xc003('0x113')]=function(_0x39584a,_0x28ec1c,_0x39fe73){var _0x52a40e={'raw':![],'where':{}};var _0x7f102e={};var _0x27572d={'count':0x0,'rows':[]};return db[_0xc003('0xb3')]['findOne']({'where':{'id':_0x39584a[_0xc003('0xcc')]['id']}})['then'](handleEntityNotFound(_0x28ec1c,null))['then'](function(_0xac75b9){if(_0xac75b9){_0x7f102e[_0xc003('0x54')]=_[_0xc003('0x56')](db[_0xc003('0xdf')]['rawAttributes']);_0x7f102e['query']=_[_0xc003('0x56')](_0x39584a[_0xc003('0x55')]);_0x7f102e[_0xc003('0x57')]=_[_0xc003('0x58')](_0x7f102e[_0xc003('0x54')],_0x7f102e[_0xc003('0x55')]);_0x52a40e['attributes']=_[_0xc003('0x58')](_0x7f102e[_0xc003('0x54')],qs[_0xc003('0xc8')](_0x39584a[_0xc003('0x55')]['fields']));_0x52a40e[_0xc003('0x59')]=_0x52a40e[_0xc003('0x59')][_0xc003('0x76')]?_0x52a40e[_0xc003('0x59')]:_0x7f102e[_0xc003('0x54')];if(!_0x39584a[_0xc003('0x55')][_0xc003('0x5a')](_0xc003('0x114'))){_0x52a40e[_0xc003('0x30')]=qs['limit'](_0x39584a[_0xc003('0x55')]['limit']);_0x52a40e[_0xc003('0x2f')]=qs[_0xc003('0x2f')](_0x39584a[_0xc003('0x55')][_0xc003('0x2f')]);}_0x52a40e[_0xc003('0x5b')]=qs['sort'](_0x39584a[_0xc003('0x55')][_0xc003('0x5c')]);_0x52a40e[_0xc003('0x5d')]=qs[_0xc003('0x57')](_['pick'](_0x39584a[_0xc003('0x55')],_0x7f102e[_0xc003('0x57')]));_0x52a40e['where'][_0xc003('0x115')]=_0xac75b9['id'];if(_0x39584a[_0xc003('0x55')][_0xc003('0x9c')]){_0x52a40e['where']=_['merge'](_0x52a40e[_0xc003('0x5d')],{'$or':_[_0xc003('0x41')](_0x52a40e[_0xc003('0x59')],function(_0x5bb837){var _0x4431d2={};_0x4431d2[_0x5bb837]={'$like':'%'+_0x39584a[_0xc003('0x55')]['filter']+'%'};return _0x4431d2;})});}if(_0x39584a[_0xc003('0x55')][_0xc003('0x92')]){var _0x5be806=_0x39584a[_0xc003('0x55')][_0xc003('0x92')]['split'](',');var _0x1784b3={};_0x1784b3[_0x5be806[0x0]]={'$gte':moment(_0x5be806[0x1])[_0xc003('0xf3')](_0xc003('0x116'))};_0x52a40e['where']=_[_0xc003('0xb2')](_0x52a40e[_0xc003('0x5d')],_0x1784b3);}_0x52a40e=_[_0xc003('0xb2')]({},_0x52a40e,_0x39584a[_0xc003('0xca')]);return db['ChatMessage'][_0xc003('0x32')]({'where':_0x52a40e[_0xc003('0x5d')]})[_0xc003('0x21')](function(_0x29df7e){_0x27572d['count']=_0x29df7e;if(_0x39584a[_0xc003('0x55')][_0xc003('0x117')]){_0x52a40e[_0xc003('0xc9')]=[{'all':!![]}];}return db[_0xc003('0xdf')]['findAll'](_0x52a40e);})['then'](function(_0x37a1b6){_0x27572d[_0xc003('0x118')]=_0x37a1b6;return _0x27572d;});}})[_0xc003('0x21')](respondWithFilteredResult(_0x28ec1c,_0x52a40e))[_0xc003('0x2b')](handleError(_0x28ec1c,null));};exports[_0xc003('0x119')]=function(_0x2d2e94,_0x5a79d3,_0x5199ed){var _0x125d1b={'where':{}},_0x196b7c={},_0x355377={'count':0x0,'rows':[]};return db[_0xc003('0xb3')][_0xc003('0xce')]({'where':{'id':_0x2d2e94[_0xc003('0xcc')]['id']}})[_0xc003('0x21')](handleEntityNotFound(_0x5a79d3,null))[_0xc003('0x21')](function(_0x25cdaa){if(_0x25cdaa){_0x196b7c[_0xc003('0x54')]=_[_0xc003('0x56')](db[_0xc003('0xdf')]['rawAttributes']);_0x196b7c[_0xc003('0x55')]=_[_0xc003('0x56')](_0x2d2e94[_0xc003('0x55')]);_0x196b7c['filters']=_['intersection'](_0x196b7c[_0xc003('0x54')],_0x196b7c[_0xc003('0x55')]);_0x125d1b['attributes']=_['intersection'](_0x196b7c[_0xc003('0x54')],qs[_0xc003('0xc8')](_0x2d2e94['query'][_0xc003('0xc8')]));_0x125d1b[_0xc003('0x59')]=_0x125d1b[_0xc003('0x59')]['length']?_0x125d1b[_0xc003('0x59')]:_0x196b7c[_0xc003('0x54')];if(!_0x2d2e94[_0xc003('0x55')][_0xc003('0x5a')]('nolimit')){_0x125d1b[_0xc003('0x30')]=qs[_0xc003('0x30')](_0x2d2e94[_0xc003('0x55')][_0xc003('0x30')]);_0x125d1b[_0xc003('0x2f')]=qs[_0xc003('0x2f')](_0x2d2e94[_0xc003('0x55')][_0xc003('0x2f')]);}_0x125d1b[_0xc003('0x5b')]=qs[_0xc003('0x5c')](_0x2d2e94['query'][_0xc003('0x5c')]);_0x125d1b[_0xc003('0x5d')]=qs[_0xc003('0x57')](_[_0xc003('0x5e')](_0x2d2e94['query'],_0x196b7c[_0xc003('0x57')]));_0x125d1b[_0xc003('0x5d')][_0xc003('0x115')]=_0x25cdaa['id'];if(_0x2d2e94['query'][_0xc003('0x9c')]){_0x125d1b[_0xc003('0x5d')]=_[_0xc003('0xb2')](_0x125d1b[_0xc003('0x5d')],{'$or':_[_0xc003('0x41')](_0x125d1b[_0xc003('0x59')],function(_0x355934){var _0x3e578b={};_0x3e578b[_0x355934]={'$like':'%'+_0x2d2e94[_0xc003('0x55')]['filter']+'%'};return _0x3e578b;})});}_0x125d1b[_0xc003('0x5d')][_0xc003('0x103')]=![];if(_0x2d2e94[_0xc003('0x55')]['id']){_0x125d1b[_0xc003('0x5d')]['id']={'$gt':_0x2d2e94[_0xc003('0x55')]['id']};}_0x125d1b=_[_0xc003('0xb2')]({},_0x125d1b,_0x2d2e94[_0xc003('0xca')]);return db['ChatMessage']['count']({'where':_0x125d1b[_0xc003('0x5d')]})['then'](function(_0x4c7451){_0x355377[_0xc003('0x32')]=_0x4c7451;_0x125d1b[_0xc003('0xc9')]=[];if(_0x2d2e94[_0xc003('0x55')][_0xc003('0x11a')]){_0x125d1b[_0xc003('0xc9')][_0xc003('0x46')]({'model':db[_0xc003('0x89')],'as':_0xc003('0x89'),'attributes':['id',_0xc003('0x42'),'alias']});}if(_0x2d2e94['query'][_0xc003('0x117')]){_0x125d1b['include']=[{'all':!![]}];}return db['ChatMessage']['findAll'](_0x125d1b);})[_0xc003('0x21')](function(_0x4ffb80){_0x355377[_0xc003('0x118')]=_0x4ffb80;return _0x355377;});}})['then'](respondWithFilteredResult(_0x5a79d3,_0x125d1b))[_0xc003('0x2b')](handleError(_0x5a79d3,null));};exports[_0xc003('0x11b')]=function(_0x54288e,_0x2b0255,_0x674ae9){return db['ChatInteraction'][_0xc003('0x77')]({'where':{'id':_0x54288e['params']['id']}})[_0xc003('0x21')](handleEntityNotFound(_0x2b0255,null))['then'](function(_0x2b4fe2){if(_0x2b4fe2){return _0x2b4fe2[_0xc003('0x11c')](_0x54288e[_0xc003('0x8b')][_0xc003('0x112')],_[_0xc003('0x11d')](_0x54288e[_0xc003('0x8b')],[_0xc003('0x112'),'id'])||{})[_0xc003('0x11e')](function(){return db['Tag']['findAll']({'attributes':['id','name',_0xc003('0x60')],'where':{'id':_0x54288e[_0xc003('0x8b')][_0xc003('0x112')]}});})[_0xc003('0x21')](function(_0x490f49){socket[_0xc003('0x11f')](_0xc003('0x120'),{'id':Number(_0x54288e[_0xc003('0xcc')]['id']),'tags':_0x490f49||[]});return{'id':Number(_0x54288e[_0xc003('0xcc')]['id']),'tags':_0x490f49||[]};});}})[_0xc003('0x21')](respondWithResult(_0x2b0255,null))[_0xc003('0x2b')](handleError(_0x2b0255,null));};exports[_0xc003('0x121')]=function(_0x443ca2,_0x54b902,_0x5c2ca3){return db[_0xc003('0xb3')][_0xc003('0x77')]({'where':{'id':_0x443ca2[_0xc003('0xcc')]['id']}})['then'](handleEntityNotFound(_0x54b902,null))[_0xc003('0x21')](function(_0x3c4f37){if(_0x3c4f37){return _0x3c4f37[_0xc003('0x121')](_0x443ca2[_0xc003('0x55')][_0xc003('0x112')]);}})[_0xc003('0x21')](respondWithStatusCode(_0x54b902,null))[_0xc003('0x2b')](handleError(_0x54b902,null));};exports[_0xc003('0x122')]=function(_0x5ceeba,_0x1d11ee){var _0x4734cf=moment()['unix']()[_0xc003('0xb1')]();var _0x1886c1=path['join'](config[_0xc003('0x123')],'server',_0xc003('0x124'),_0xc003('0x125'));var _0x440131=path[_0xc003('0xee')](config[_0xc003('0x123')],_0xc003('0x126'),'files',_0xc003('0x127'));var _0x11fc9c=path[_0xc003('0xee')](_0x1886c1,_0x4734cf);var _0x3f856b=util[_0xc003('0xf3')](_0xc003('0x128'),_0x5ceeba[_0xc003('0xcc')]['id'],_0x4734cf);var _0x577f77=path[_0xc003('0xee')](_0x1886c1,_0x3f856b);var _0x41e50c=[];_0x41e50c['push']({'model':db[_0xc003('0x89')],'as':'User','attributes':['id',_0xc003('0x42')],'raw':!![]});_0x41e50c['push']({'model':db['CmContact'],'as':'Contact','attributes':['id','firstName','lastName'],'raw':!![]});if(_0x5ceeba[_0xc003('0x55')][_0xc003('0x127')]){_0x41e50c[_0xc003('0x46')]({'model':db['Attachment'],'as':'Attachment','raw':!![]});}var _0x7c64df=[{'model':db[_0xc003('0xdf')],'as':_0xc003('0xf7'),'attributes':['id','body',_0xc003('0x91'),'direction',_0xc003('0x103'),_0xc003('0x98')],'include':_0x41e50c}];_0x7c64df[_0xc003('0x46')]({'model':db[_0xc003('0xcf')],'as':'Account','attributes':['id',_0xc003('0x3b')]});_0x7c64df[_0xc003('0x46')]({'model':db[_0xc003('0x89')],'as':_0xc003('0x129'),'attributes':['id','fullname']});return db[_0xc003('0xb3')][_0xc003('0x77')]({'where':{'id':_0x5ceeba[_0xc003('0xcc')]['id']},'include':_0x7c64df})[_0xc003('0x21')](handleEntityNotFound(_0x1d11ee,null))['then'](function(_0x176166){if(_0x176166){var _0x5f2c0e=_0x176166[_0xc003('0x12a')]({'plain':!![]});fs[_0xc003('0x12b')](_0x11fc9c);var _0x1f68d5={'channel':_0xc003('0x12c'),'account':_0x5f2c0e[_0xc003('0x12d')][_0xc003('0x3b')],'agent':_0x5f2c0e[_0xc003('0x129')]?_0x5f2c0e['Owner'][_0xc003('0x42')]:_0xc003('0x12e'),'createdAt':moment(_0x5f2c0e[_0xc003('0x91')])[_0xc003('0xf3')](_0xc003('0x116'))[_0xc003('0xb1')](),'closedAt':_0x5f2c0e[_0xc003('0x4c')]?moment(_0x5f2c0e[_0xc003('0x12f')])['format'](_0xc003('0x116'))['toString']():'','disposition':_0x5f2c0e[_0xc003('0x4e')],'chatInfo':{'browser':_0x5f2c0e[_0xc003('0x130')],'os':_0x5f2c0e[_0xc003('0x131')],'referer':_0x5f2c0e[_0xc003('0x132')],'customerIp':_0x5f2c0e[_0xc003('0x133')],'customerPort':_0x5f2c0e[_0xc003('0x134')]?_0x5f2c0e['customerPort']:_0xc003('0x12e')},'messages':_(_0x5f2c0e['Messages'])['tail']()['filter']({'secret':![]})[_0xc003('0x41')](function(_0x13e140){if(_0x13e140[_0xc003('0xeb')]){var _0x110b6c=path['join'](_0x440131,_0x13e140[_0xc003('0xeb')][_0xc003('0xf0')]);if(fs[_0xc003('0x135')](_0x110b6c)){fs[_0xc003('0x136')](_0x110b6c)['pipe'](fs[_0xc003('0x137')](path['join'](_0x11fc9c,_0x13e140[_0xc003('0xeb')][_0xc003('0xf0')])));}}return{'date':moment(_0x13e140[_0xc003('0x91')])[_0xc003('0xf3')](_0xc003('0x116'))['toString'](),'sender':_0x13e140['direction']===_0xc003('0xde')?_0x13e140[_0xc003('0x89')]?_0x13e140[_0xc003('0x89')][_0xc003('0x42')]:_0xc003('0xf9'):_0x13e140[_0xc003('0x7b')][_0xc003('0x138')]+(_0x13e140[_0xc003('0x7b')][_0xc003('0x139')]?'\x20'+_0x13e140[_0xc003('0x7b')]['lastName']:''),'body':_0x13e140[_0xc003('0xeb')]?_0x13e140[_0xc003('0xeb')][_0xc003('0xf0')]:_0x13e140['body'],'direction':_0x13e140[_0xc003('0x102')]===_0xc003('0xde')?'A':'C','secret':_0x13e140['secret'],'read':_0x13e140[_0xc003('0x98')],'attachment':_0x13e140[_0xc003('0xeb')]};})[_0xc003('0x81')]()};return ejs['renderFile'](path[_0xc003('0xee')](config['root'],_0xc003('0x126'),_0xc003('0x13a'),_0xc003('0x13b')),{'interaction':_0x1f68d5})[_0xc003('0x21')](function(_0x563ece){var _0x5dd07d=path['join'](_0x11fc9c,_0xc003('0x13c')+_0x5f2c0e['id']+'-'+_0x4734cf+_0xc003('0x13d'));var _0x5a659b={'path':_0x5dd07d,'channel':_0xc003('0x12c'),'interactionId':_0x5f2c0e['id']};return pdf[_0xc003('0x13e')](_0x563ece,_0x5a659b);})['then'](function(){return new BPromise(function(_0x799720,_0x5c6ed7){zipdir(_0x11fc9c,{'saveTo':_0x577f77},function(_0x1ceb2b,_0x435603){if(_0x1ceb2b)return _0x5c6ed7(_0x1ceb2b);return _0x799720(_0x435603);});})['then'](function(){return new BPromise(function(_0x4da8aa,_0x93546b){rimraf(_0x11fc9c,function(_0x385acb){if(_0x385acb)_0x93546b(_0x385acb);return _0x4da8aa();});});})[_0xc003('0x21')](function(){return _0x1d11ee[_0xc003('0x122')](_0x577f77,_0x3f856b,function(_0x446ce9){if(_0x446ce9){console[_0xc003('0x13f')](_0xc003('0x140'),_0x446ce9);}else{fs[_0xc003('0x141')](_0x577f77);}});});});}else{return _0x1d11ee[_0xc003('0x2c')](0xc8);}})[_0xc003('0x2b')](handleError(_0x1d11ee,null));}; \ No newline at end of file +var _0x1af2=['keyBy','ChatInteraction','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','push','all','rows','show','params','include','create','catch','destroy','describe','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooMetadata','email','account','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','vidaooNote','follow','metadata','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','customUpdate','CmContact','Contact','abandon','Interaction\x20already\x20assigned','attachmentUpload','filename','mimetype','Attachment','attachmentDownload','Unauthorized','attachId','ChatOfflineMessageId','root','server/files/attachments/','offline-chat/','join','close','server/files/chat/upload/','transcript-%s.txt','now','pathTranscript','Messages','format','%s%d','agentAlias','System','customer','website_alias','agent_alias','alias','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','Smtp','service','host','port','secure','pass','SendMail','\x22%s\x22\x20<%s>','mailTranscript','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','includeAll','findAll','getMyMessages','addTags','setTags','spread','color','emit','chatInteractionTags:save','removeTags','unix','files','tmp','transcript-%d-%s.zip','firstName','lastName','attachments','Account','Owner','get','mkdirSync','Chat','YYYY-MM-DD\x20HH:mm:ss','closedAt','browserName','osName','customerIp','customerPort','tail','basename','pipe','createWriteStream','renderFile','server','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','download','err','unlinkSync','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./chatInteraction.socket','jayson/promise','http','client','request','then','info','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','code','error','message','ChatInteraction,\x20%s,\x20%s','result','status','json','offset','limit','count','Content-Range','apply','save','update','sendStatus','name','send','render','merge','body','contact','agent','interaction','Users','map','fullname','Tags','split','forEach','TagIds','waiting','talking','answered','unmanaged','abandoned','closed','UserId','disposition','total','index','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','select','field','from','tools_tags','u.id','u.fullname','ui.ChatInteractionId','user_has_chat_interactions','u.id\x20=\x20ui.UserId','chat_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','left_join','a.id\x20=\x20i.ChatWebsiteId','me.ChatInteractionId\x20=\x20i.id','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','find','unreadMessages','value','`\x20=\x200','having','`\x20>\x200','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','start','end','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','buildExpression','some','compact','isEmpty','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','read','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','QueryTypes','SELECT','clone','contactName','t.id\x20IN\x20?','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString'];(function(_0x33469a,_0x422d46){var _0x26d642=function(_0x415c49){while(--_0x415c49){_0x33469a['push'](_0x33469a['shift']());}};_0x26d642(++_0x422d46);}(_0x1af2,0x93));var _0x21af=function(_0x53b0f8,_0x459130){_0x53b0f8=_0x53b0f8-0x0;var _0x133415=_0x1af2[_0x53b0f8];return _0x133415;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x21af('0x0'));var zipdir=require(_0x21af('0x1'));var jsonpatch=require(_0x21af('0x2'));var rp=require(_0x21af('0x3'));var moment=require(_0x21af('0x4'));var BPromise=require(_0x21af('0x5'));var Mustache=require(_0x21af('0x6'));var util=require(_0x21af('0x7'));var path=require(_0x21af('0x8'));var sox=require(_0x21af('0x9'));var csv=require(_0x21af('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x21af('0xb'));var squel=require(_0x21af('0xc'));var crypto=require(_0x21af('0xd'));var jsforce=require(_0x21af('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x21af('0xa'));var querystring=require('querystring');var Papa=require(_0x21af('0xf'));var Redis=require('ioredis');var authService=require(_0x21af('0x10'));var qs=require(_0x21af('0x11'));var as=require(_0x21af('0x12'));var pdf=require(_0x21af('0x13'));var hardwareService=require(_0x21af('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x21af('0x15'));var config=require(_0x21af('0x16'));var licenseUtil=require(_0x21af('0x17'));var db=require(_0x21af('0x18'))['db'];config[_0x21af('0x19')]=_[_0x21af('0x1a')](config[_0x21af('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x21af('0x1b'))(new Redis(config[_0x21af('0x19')]));require(_0x21af('0x1c'))['register'](socket);var jayson=require(_0x21af('0x1d'));var client=jayson['client'][_0x21af('0x1e')]({'port':0x232b});var client9004=jayson[_0x21af('0x1f')][_0x21af('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x49c68c,_0x46bc82,_0x3c551c,_0x1e2688){return new BPromise(function(_0x9cee5a,_0x3b5464){var _0x29bd1a=_0x1e2688||client;return _0x29bd1a[_0x21af('0x20')](_0x49c68c,_0x3c551c)[_0x21af('0x21')](function(_0x8de218){logger[_0x21af('0x22')]('ChatInteraction,\x20%s,\x20%s',_0x46bc82,_0x21af('0x23'));logger[_0x21af('0x24')](_0x21af('0x25'),_0x46bc82,_0x21af('0x23'),JSON[_0x21af('0x26')](_0x8de218));if(_0x8de218['error']){if(_0x8de218['error'][_0x21af('0x27')]===0x1f4){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x46bc82,_0x8de218[_0x21af('0x28')][_0x21af('0x29')]);return _0x3b5464(_0x8de218['error'][_0x21af('0x29')]);}logger[_0x21af('0x28')](_0x21af('0x2a'),_0x46bc82,_0x8de218['error']['message']);return _0x9cee5a(_0x8de218['error'][_0x21af('0x29')]);}else{logger[_0x21af('0x22')](_0x21af('0x2a'),_0x46bc82,'request\x20sent');_0x9cee5a(_0x8de218[_0x21af('0x2b')]['message']);}})['catch'](function(_0xa20968){logger[_0x21af('0x28')]('ChatInteraction,\x20%s,\x20%s',_0x46bc82,_0xa20968);_0x3b5464(_0xa20968);});});}function respondWithStatusCode(_0x4915b6,_0x49c027){_0x49c027=_0x49c027||0xcc;return function(_0x3eb97f){if(_0x3eb97f){return _0x4915b6['sendStatus'](_0x49c027);}return _0x4915b6[_0x21af('0x2c')](_0x49c027)['end']();};}function respondWithResult(_0x4c9bde,_0xd8a829){_0xd8a829=_0xd8a829||0xc8;return function(_0x280c14){if(_0x280c14){return _0x4c9bde[_0x21af('0x2c')](_0xd8a829)[_0x21af('0x2d')](_0x280c14);}};}function respondWithFilteredResult(_0x3e58d2,_0x274a50){return function(_0x3250a5){if(_0x3250a5){var _0x2f1866=typeof _0x274a50[_0x21af('0x2e')]==='undefined'&&typeof _0x274a50[_0x21af('0x2f')]==='undefined';var _0x104cad=_0x3250a5[_0x21af('0x30')];var _0x444381=_0x2f1866?0x0:_0x274a50[_0x21af('0x2e')];var _0x175727=_0x2f1866?_0x3250a5[_0x21af('0x30')]:_0x274a50[_0x21af('0x2e')]+_0x274a50[_0x21af('0x2f')];var _0x39118a;if(_0x175727>=_0x104cad){_0x175727=_0x104cad;_0x39118a=0xc8;}else{_0x39118a=0xce;}_0x3e58d2[_0x21af('0x2c')](_0x39118a);return _0x3e58d2['set'](_0x21af('0x31'),_0x444381+'-'+_0x175727+'/'+_0x104cad)[_0x21af('0x2d')](_0x3250a5);}return null;};}function patchUpdates(_0x235a5c){return function(_0x5e3cbb){try{jsonpatch[_0x21af('0x32')](_0x5e3cbb,_0x235a5c,!![]);}catch(_0x1be446){return BPromise['reject'](_0x1be446);}return _0x5e3cbb[_0x21af('0x33')]();};}function saveUpdates(_0x1a8c75,_0xec66d6){return function(_0x496045){if(_0x496045){return _0x496045[_0x21af('0x34')](_0x1a8c75)['then'](function(_0x532421){return _0x532421;});}return null;};}function removeEntity(_0x54b7ce,_0x117634){return function(_0x176681){if(_0x176681){return _0x176681['destroy']()['then'](function(){_0x54b7ce['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xa1c1c0,_0x17f97b){return function(_0x4237e4){if(!_0x4237e4){_0xa1c1c0[_0x21af('0x35')](0x194);}return _0x4237e4;};}function handleError(_0x2b9780,_0xf018d8){_0xf018d8=_0xf018d8||0x1f4;return function(_0x31d50f){logger['error'](_0x31d50f['stack']);if(_0x31d50f[_0x21af('0x36')]){delete _0x31d50f[_0x21af('0x36')];}_0x2b9780[_0x21af('0x2c')](_0xf018d8)[_0x21af('0x37')](_0x31d50f);};}function getMustacheRender(_0x53e3a6,_0x594981){return Mustache[_0x21af('0x38')](_0x53e3a6,_[_0x21af('0x39')](_0x594981[_0x21af('0x3a')],{'contact':_0x594981[_0x21af('0x3b')],'message':_0x594981[_0x21af('0x29')],'agent':_0x594981[_0x21af('0x3c')],'interaction':_0x594981[_0x21af('0x3d')],'account':_0x594981['account']}))||'';}function getInteractionUsers(_0x2d3941,_0x29ed3b){return new BPromise(function(_0x183fc0,_0x4db6f3){try{if(_0x29ed3b[_0x2d3941['id']]){_0x2d3941[_0x21af('0x3e')]=_[_0x21af('0x3f')](_0x29ed3b[_0x2d3941['id']],function(_0x2b2ce2){return{'id':_0x2b2ce2['id'],'fullname':_0x2b2ce2[_0x21af('0x40')]};});}}catch(_0x36f53b){_0x4db6f3(_0x36f53b);}_0x183fc0(_0x2d3941);});}function getInteractionTags(_0x57b1a2,_0x19fd99){return new BPromise(function(_0x23f81d,_0x1be655){try{if(_0x57b1a2['TagIds']){_0x57b1a2[_0x21af('0x41')]=[];_0x57b1a2['TagIds'][_0x21af('0x42')](',')[_0x21af('0x43')](function(_0x59c9b8){_0x57b1a2[_0x21af('0x41')]['push'](_0x19fd99[_0x59c9b8]);});}delete _0x57b1a2[_0x21af('0x44')];}catch(_0x2c3d96){_0x1be655(_0x2c3d96);}_0x23f81d(_0x57b1a2);});}function updateChatInteraction(_0xc2db60,_0x40053e,_0x3f2291){return new BPromise(function(_0x575dac,_0x465de6){return getInteractionUsers(_0xc2db60,_0x3f2291)[_0x21af('0x21')](function(_0x14fed0){return getInteractionTags(_0x14fed0,_0x40053e);})[_0x21af('0x21')](function(_0x2e6749){return getStateInteraction(_0x2e6749);})[_0x21af('0x21')](function(_0x4a0963){_0x575dac(_0x4a0963);})['catch'](function(_0x58b6b8){_0x465de6(_0x58b6b8);});});}function getStateInteraction(_0x4e75e5){return new BPromise(function(_0xffaab1){_0x4e75e5[_0x21af('0x45')]=0x0;_0x4e75e5[_0x21af('0x46')]=0x0;_0x4e75e5[_0x21af('0x47')]=0x0;_0x4e75e5[_0x21af('0x48')]=0x0;_0x4e75e5[_0x21af('0x49')]=0x0;_0x4e75e5['total']=0x0;if(!_0x4e75e5[_0x21af('0x4a')]&&!_0x4e75e5[_0x21af('0x4b')]){_0x4e75e5[_0x21af('0x45')]+=0x1;}if(!_0x4e75e5['closed']&&_0x4e75e5[_0x21af('0x4b')]){_0x4e75e5['talking']+=0x1;if(_0x4e75e5[_0x21af('0x45')]){_0x4e75e5[_0x21af('0x45')]-=0x1;}}if(_0x4e75e5['closed']&&_0x4e75e5[_0x21af('0x4c')]===_0x21af('0x49')){_0x4e75e5[_0x21af('0x49')]+=0x1;if(_0x4e75e5[_0x21af('0x45')]){_0x4e75e5[_0x21af('0x45')]-=0x1;}}else if(_0x4e75e5[_0x21af('0x4a')]&&!_0x4e75e5[_0x21af('0x4b')]&&_0x4e75e5[_0x21af('0x4c')]){_0x4e75e5[_0x21af('0x48')]+=0x1;if(_0x4e75e5[_0x21af('0x45')]){_0x4e75e5['waiting']-=0x1;}}else if(_0x4e75e5[_0x21af('0x4a')]&&_0x4e75e5['UserId']){_0x4e75e5['answered']+=0x1;if(_0x4e75e5[_0x21af('0x46')]){_0x4e75e5[_0x21af('0x46')]-=0x1;}}_0x4e75e5[_0x21af('0x4d')]+=0x1;_0xffaab1(_0x4e75e5);});}exports[_0x21af('0x4e')]=function(_0x28dbbb,_0x5c3eb3){var _0xddfa0b={},_0x344750={},_0xdd35c={'count':0x0,'rows':[]};var _0x24a6be=_[_0x21af('0x3f')](db['ChatInteraction'][_0x21af('0x4f')],function(_0x1541e0){return{'name':_0x1541e0[_0x21af('0x50')],'type':_0x1541e0[_0x21af('0x51')][_0x21af('0x52')]};});_0x344750[_0x21af('0x53')]=_[_0x21af('0x3f')](_0x24a6be,_0x21af('0x36'));_0x344750[_0x21af('0x54')]=_[_0x21af('0x55')](_0x28dbbb[_0x21af('0x54')]);_0x344750['filters']=_[_0x21af('0x56')](_0x344750['model'],_0x344750[_0x21af('0x54')]);_0xddfa0b[_0x21af('0x57')]=_[_0x21af('0x56')](_0x344750[_0x21af('0x53')],qs[_0x21af('0x58')](_0x28dbbb[_0x21af('0x54')][_0x21af('0x58')]));_0xddfa0b[_0x21af('0x57')]=_0xddfa0b['attributes'][_0x21af('0x59')]?_0xddfa0b[_0x21af('0x57')]:_0x344750['model'];if(!_0x28dbbb[_0x21af('0x54')][_0x21af('0x5a')](_0x21af('0x5b'))){_0xddfa0b[_0x21af('0x2f')]=qs['limit'](_0x28dbbb[_0x21af('0x54')]['limit']);_0xddfa0b[_0x21af('0x2e')]=qs[_0x21af('0x2e')](_0x28dbbb[_0x21af('0x54')][_0x21af('0x2e')]);}_0xddfa0b[_0x21af('0x5c')]=qs[_0x21af('0x5d')](_0x28dbbb['query']['sort']);_0xddfa0b[_0x21af('0x5e')]=qs['filters'](_[_0x21af('0x5f')](_0x28dbbb[_0x21af('0x54')],_0x344750[_0x21af('0x60')]),_0x24a6be);var _0x43b6c2=[];var _0x41dd08=squel[_0x21af('0x61')]()['field']('id')[_0x21af('0x62')](_0x21af('0x36'))[_0x21af('0x62')]('color')[_0x21af('0x63')](_0x21af('0x64'));var _0x43c433=squel[_0x21af('0x61')]()[_0x21af('0x62')](_0x21af('0x65'))['field'](_0x21af('0x66'))[_0x21af('0x62')](_0x21af('0x67'))[_0x21af('0x63')](_0x21af('0x68'),'ui')['left_join']('users','u',_0x21af('0x69'));var _0x44abe6=squel[_0x21af('0x61')]()[_0x21af('0x63')](_0x21af('0x6a'),'i')['left_join']('cm_contacts','c',_0x21af('0x6b'))[_0x21af('0x6c')]('users','o','o.id\x20=\x20i.UserId')['left_join']('chat_websites','a',_0x21af('0x6d'))[_0x21af('0x6c')]('chat_messages','me',_0x21af('0x6e'))[_0x21af('0x6c')]('chat_interaction_has_tags','it',_0x21af('0x6f'))['left_join']('tools_tags','t',_0x21af('0x70'));var _0x4c6eb5=squel[_0x21af('0x71')]();var _0x315711=[];var _0x5a8b18=squel[_0x21af('0x71')]();var _0x4cee54;if(_0x28dbbb[_0x21af('0x54')]['search']){_0x4cee54=as['parseSearch'](_0x28dbbb[_0x21af('0x54')][_0x21af('0x72')]);var _0x30c269=_0x4cee54[_0x21af('0x73')];for(var _0x50dbd3=0x0;_0x50dbd3<_0x4cee54[_0x21af('0x74')]['length'];_0x50dbd3++){var _0x46f682=_0x4cee54[_0x21af('0x74')][_0x50dbd3];var _0xa8e4bb='i';var _0x15a8d8=_[_0x21af('0x75')](_0x24a6be,[_0x21af('0x36'),_0x46f682[_0x21af('0x62')]]);if(!_0x15a8d8){switch(_0x46f682[_0x21af('0x62')]){case _0x21af('0x76'):if(_0x46f682[_0x21af('0x77')]==0x1){_0x44abe6['having']('`'+_0x46f682[_0x21af('0x62')]+_0x21af('0x78'));}else{_0x44abe6[_0x21af('0x79')]('`'+_0x46f682[_0x21af('0x62')]+_0x21af('0x7a'));}break;case'Contact':if(_0x46f682[_0x21af('0x7b')]===_0x21af('0x7c')){if(_0x46f682[_0x21af('0x77')][_0x21af('0x42')]('\x20')[_0x21af('0x59')]>0x1){_0x4c6eb5[_0x30c269](_0x21af('0x7d'),qs['getFullTextValue'](_0x46f682[_0x21af('0x77')]),null);}else{var _0x4d3f91='%'+_0x46f682[_0x21af('0x77')]+'%';_0x4c6eb5[_0x30c269](_0x21af('0x7e'),_0x4d3f91,_0x4d3f91,_0x4d3f91);}}else{_0x15a8d8=_['find'](_0x24a6be,[_0x21af('0x36'),_0x21af('0x7f')]);_0x46f682[_0x21af('0x62')]='ContactId';_0x3e26b6=as['buildExpression'](_0xa8e4bb,_0x15a8d8[_0x21af('0x51')],_0x46f682);_0x4c6eb5[_0x30c269](_0x3e26b6[_0x21af('0x80')],_0x3e26b6['value'][_0x21af('0x81')],_0x3e26b6[_0x21af('0x77')][_0x21af('0x82')]);}break;case _0x21af('0x83'):var _0x51ef55=_0x46f682[_0x21af('0x77')][_0x21af('0x42')](',')[_0x21af('0x3f')](function(_0x45a4db){return Number(_0x45a4db);});_0x51ef55[_0x21af('0x43')](function(_0x26a797){_0x5a8b18['or'](_0x21af('0x84'),'%,'+_0x26a797+',%');});_0x315711=_[_0x21af('0x85')](_0x315711,_0x51ef55);break;case _0x21af('0x86'):if(_0x46f682[_0x21af('0x7b')]===_0x21af('0x7c')){_0x4c6eb5[_0x30c269](_0x21af('0x87'),'%'+_0x46f682[_0x21af('0x77')]+'%',null);}else{_0x15a8d8=_[_0x21af('0x75')](_0x24a6be,[_0x21af('0x36'),_0x21af('0x4b')]);_0x46f682['field']='UserId';_0x3e26b6=as[_0x21af('0x88')](_0xa8e4bb,_0x15a8d8['type'],_0x46f682);_0x4c6eb5[_0x30c269](_0x3e26b6[_0x21af('0x80')],_0x3e26b6[_0x21af('0x77')][_0x21af('0x81')],_0x3e26b6[_0x21af('0x77')][_0x21af('0x82')]);}break;case _0x21af('0x3a'):_0x3e26b6=as[_0x21af('0x88')]('me',null,_0x46f682);_0x4c6eb5[_0x30c269](_0x3e26b6[_0x21af('0x80')],_0x3e26b6[_0x21af('0x77')]['start'],_0x3e26b6[_0x21af('0x77')]['end']);break;}}else{var _0x3e26b6=as[_0x21af('0x88')](_0xa8e4bb,_0x15a8d8['type'],_0x46f682);_0x4c6eb5[_0x30c269](_0x3e26b6[_0x21af('0x80')],_0x3e26b6[_0x21af('0x77')][_0x21af('0x81')],_0x3e26b6['value'][_0x21af('0x82')]);}}}else{var _0x189723=_(_0x28dbbb[_0x21af('0x54')])[_0x21af('0x55')]()[_0x21af('0x3f')](function(_0xc91eb1){return _[_0x21af('0x89')](_0x24a6be,['name',_0xc91eb1])?_0xc91eb1:undefined;})[_0x21af('0x8a')]()['value']();if(!_[_0x21af('0x8b')](_0x189723)){_0x189723[_0x21af('0x43')](function(_0x50da4b){if(_0x50da4b===_0x21af('0x8c')){_0x44abe6[_0x21af('0x5e')](_0x21af('0x8d'),[][_0x21af('0x8e')](_0x28dbbb['query'][_0x50da4b]));}else if(_0x50da4b===_0x21af('0x8f')){var _0x227578=JSON[_0x21af('0x90')](_0x28dbbb[_0x21af('0x54')][_0x50da4b])[_0x21af('0x91')];var _0x4474e4=JSON[_0x21af('0x90')](_0x28dbbb[_0x21af('0x54')][_0x50da4b])[_0x21af('0x92')];_0x44abe6['where'](_0x21af('0x93'),_0x227578,_0x4474e4);}else{if(_0x28dbbb[_0x21af('0x54')][_0x50da4b]==='null'){_0x44abe6[_0x21af('0x5e')]('i.'+_0x50da4b+_0x21af('0x94'));}else{_0x44abe6[_0x21af('0x5e')]('i.'+_0x50da4b+'\x20=\x20?',_0x28dbbb[_0x21af('0x54')][_0x50da4b]);}}});}if(_0x28dbbb[_0x21af('0x54')]['read']){if(_0x28dbbb[_0x21af('0x54')][_0x21af('0x95')]==0x1){_0x44abe6[_0x21af('0x79')]('`unreadMessages`\x20=\x200');}else{_0x44abe6[_0x21af('0x79')](_0x21af('0x96'));}}if(_0x28dbbb[_0x21af('0x54')]['tag']){_0x315711=_[_0x21af('0x97')](_0x28dbbb[_0x21af('0x54')][_0x21af('0x98')])?_0x28dbbb[_0x21af('0x54')][_0x21af('0x98')]:new Array(_0x28dbbb['query'][_0x21af('0x98')]);_0x315711['forEach'](function(_0x30e9d5){_0x5a8b18['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x30e9d5+',%');});}if(_0x28dbbb[_0x21af('0x54')][_0x21af('0x99')]){var _0x2901c2=_0x28dbbb[_0x21af('0x54')][_0x21af('0x99')][_0x21af('0x9a')]('\x5c','\x5c\x5c')[_0x21af('0x9a')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x2901c2)){_0x4c6eb5['or'](_0x21af('0x9b'),_0x2901c2+'%');}else{_0x4c6eb5['or'](_0x21af('0x9c'),qs['getFullTextValue'](_0x2901c2))['or'](_0x21af('0x9d'),_0x2901c2+'%');}}}_0x44abe6['where'](_0x4c6eb5);_0x44abe6['group'](_0x21af('0x9e'));var _0x2b4eb1={'type':db[_0x21af('0x9f')][_0x21af('0xa0')][_0x21af('0xa1')],'raw':!![]};var _0x4c16da=_0x44abe6[_0x21af('0xa2')]();_0x4c16da[_0x21af('0x62')](_0x21af('0x9e'));_0x4c16da[_0x21af('0x62')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x21af('0x76'));if(_0xddfa0b[_0x21af('0x5c')]){_0xddfa0b[_0x21af('0x5c')][_0x21af('0x43')](function(_0x494095){var _0x4ff54c=_0x494095[0x0]===_0x21af('0xa3')?_0x494095[0x0]:'i.'+_0x494095[0x0];_0x44abe6[_0x21af('0x5c')](_0x4ff54c,_0x494095[0x1]==='DESC'?![]:!![]);});}if(!_[_0x21af('0x8b')](_0x315711)){_0x44abe6['having'](_0x5a8b18);_0x4c16da['where'](_0x21af('0xa4'),_0x315711);}BPromise['resolve']()[_0x21af('0x21')](function(){if(!_0x4cee54){if(_0x28dbbb[_0x21af('0x54')][_0x21af('0x8c')])return;_0x4c16da[_0x21af('0x5e')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');_0x44abe6[_0x21af('0x5e')](_0x21af('0xa5'));return;}if(_0x28dbbb[_0x21af('0xa6')][_0x21af('0xa7')]!==_0x21af('0x3c'))return;return _0x28dbbb[_0x21af('0xa6')]['getChatWebsites']({'attributes':['id'],'raw':!![]})[_0x21af('0x21')](function(_0x25e0ec){if(_['isEmpty'](_0x25e0ec)){_0x4c16da[_0x21af('0x5e')](_0x21af('0xa8'));_0x44abe6[_0x21af('0x5e')](_0x21af('0xa8'));}else{_0x4c16da[_0x21af('0x5e')](_0x21af('0x8d'),_[_0x21af('0x3f')](_0x25e0ec,'id'));_0x44abe6['where'](_0x21af('0x8d'),_['map'](_0x25e0ec,'id'));}});})['then'](function(){if(_0x28dbbb[_0x21af('0xa6')]['role']===_0x21af('0x3c')&&!_0x4cee54&&!_0x28dbbb[_0x21af('0x54')][_0x21af('0x8c')])return[];return db[_0x21af('0xa9')][_0x21af('0x54')](_0x4c16da[_0x21af('0xaa')](),_0x2b4eb1);})[_0x21af('0x21')](function(_0x3193e6){_0xdd35c[_0x21af('0x30')]=_0x3193e6[_0x21af('0x59')];if(_0xdd35c[_0x21af('0x30')]===0x0)return[];return db[_0x21af('0xa9')][_0x21af('0x54')](_0x41dd08['toString'](),_0x2b4eb1)['then'](function(_0x2ff3a1){_0x43b6c2=_[_0x21af('0xab')](_0x2ff3a1,'id');_0x2b4eb1=_[_0x21af('0x39')](_0x2b4eb1,{'model':db[_0x21af('0xac')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x28dbbb[_0x21af('0x54')][_0x21af('0x58')]){_0xddfa0b[_0x21af('0x57')][_0x21af('0x43')](function(_0x5531d4){_0x44abe6[_0x21af('0x62')]('i.'+_0x5531d4);});}else{_0x44abe6[_0x21af('0x62')](_0x21af('0xad'),'unreadMessages');_0x44abe6[_0x21af('0x62')](_0x21af('0xae'),_0x21af('0xaf'));_0x44abe6[_0x21af('0x62')]('a.mandatoryDisposition','Account.mandatoryDisposition');_0x44abe6['field'](_0x21af('0xb0'),_0x21af('0xa3'));_0x44abe6['field'](_0x21af('0xb1'));_0x44abe6[_0x21af('0x62')]('c.firstName',_0x21af('0xb2'));_0x44abe6[_0x21af('0x62')](_0x21af('0xb3'),_0x21af('0xb4'));_0x44abe6[_0x21af('0x62')](_0x21af('0xb5'),_0x21af('0xb6'));_0x44abe6['field'](_0x21af('0xb7'),'Contact.phone');_0x44abe6[_0x21af('0x62')]('c.mobile',_0x21af('0xb8'));_0x44abe6[_0x21af('0x62')](_0x21af('0xb9'),'Contact.fax');_0x44abe6[_0x21af('0x62')](_0x21af('0xba'),_0x21af('0xbb'));_0x44abe6['field'](_0x21af('0xbc'),_0x21af('0xbd'));_0x44abe6[_0x21af('0x62')](_0x21af('0xbe'),'TagIds');}if(_0xddfa0b[_0x21af('0x2f')])_0x44abe6[_0x21af('0x2f')](_0xddfa0b[_0x21af('0x2f')]);if(_0xddfa0b[_0x21af('0x2e')])_0x44abe6[_0x21af('0x2e')](_0xddfa0b[_0x21af('0x2e')]);return db[_0x21af('0xa9')][_0x21af('0x54')](_0x44abe6['toString'](),_0x2b4eb1);})[_0x21af('0x21')](function(_0x4ca2a6){if(_0x4ca2a6['length']>0x0)_0x43c433['where'](_0x21af('0xbf'),_[_0x21af('0x3f')](_0x4ca2a6,'id'));return db[_0x21af('0xa9')][_0x21af('0x54')](_0x43c433['toString'](),_0x2b4eb1)[_0x21af('0x21')](function(_0x5e38b1){var _0x201976=_[_0x21af('0xc0')](_0x5e38b1,_0x21af('0xc1'));var _0x4d4982=[];_0x4ca2a6['forEach'](function(_0xf82e92){_0x4d4982[_0x21af('0xc2')](updateChatInteraction(_0xf82e92,_0x43b6c2,_0x201976));});return BPromise[_0x21af('0xc3')](_0x4d4982);});});})[_0x21af('0x21')](function(_0x1bee95){_0xdd35c[_0x21af('0xc4')]=_0x1bee95;return _0xdd35c;})['then'](respondWithFilteredResult(_0x5c3eb3,_0xddfa0b))['catch'](handleError(_0x5c3eb3,null));};exports[_0x21af('0xc5')]=function(_0x2ab859,_0x553393){var _0x1fe901={'raw':![],'where':{'id':_0x2ab859[_0x21af('0xc6')]['id']}},_0x3b63af={};_0x3b63af[_0x21af('0x53')]=_[_0x21af('0x55')](db[_0x21af('0xac')][_0x21af('0x4f')]);_0x3b63af[_0x21af('0x54')]=_[_0x21af('0x55')](_0x2ab859['query']);_0x3b63af[_0x21af('0x60')]=_[_0x21af('0x56')](_0x3b63af[_0x21af('0x53')],_0x3b63af[_0x21af('0x54')]);_0x1fe901[_0x21af('0x57')]=_[_0x21af('0x56')](_0x3b63af[_0x21af('0x53')],qs[_0x21af('0x58')](_0x2ab859['query']['fields']));_0x1fe901[_0x21af('0x57')]=_0x1fe901[_0x21af('0x57')][_0x21af('0x59')]?_0x1fe901[_0x21af('0x57')]:_0x3b63af[_0x21af('0x53')];if(_0x2ab859[_0x21af('0x54')]['includeAll']){_0x1fe901[_0x21af('0xc7')]=[{'all':!![]}];}_0x1fe901=_[_0x21af('0x39')]({},_0x1fe901,_0x2ab859['options']);return db['ChatInteraction'][_0x21af('0x75')](_0x1fe901)[_0x21af('0x21')](handleEntityNotFound(_0x553393,null))[_0x21af('0x21')](respondWithResult(_0x553393,null))['catch'](handleError(_0x553393,null));};exports['create']=function(_0x56d1f9,_0x895e22){return db[_0x21af('0xac')][_0x21af('0xc8')](_0x56d1f9[_0x21af('0x3a')],{})[_0x21af('0x21')](respondWithResult(_0x895e22,0xc9))[_0x21af('0xc9')](handleError(_0x895e22,null));};exports[_0x21af('0x34')]=function(_0x450a44,_0x2c6d89){if(_0x450a44[_0x21af('0x3a')]['id']){delete _0x450a44[_0x21af('0x3a')]['id'];}return db[_0x21af('0xac')][_0x21af('0x75')]({'where':{'id':_0x450a44[_0x21af('0xc6')]['id']}})['then'](handleEntityNotFound(_0x2c6d89,null))[_0x21af('0x21')](saveUpdates(_0x450a44['body'],null))[_0x21af('0x21')](respondWithResult(_0x2c6d89,null))[_0x21af('0xc9')](handleError(_0x2c6d89,null));};exports[_0x21af('0xca')]=function(_0x295918,_0x4f5068){return db['ChatInteraction'][_0x21af('0x75')]({'where':{'id':_0x295918[_0x21af('0xc6')]['id']}})[_0x21af('0x21')](handleEntityNotFound(_0x4f5068,null))[_0x21af('0x21')](removeEntity(_0x4f5068,null))[_0x21af('0xc9')](handleError(_0x4f5068,null));};exports[_0x21af('0xcb')]=function(_0x130007,_0x35cd77){return db[_0x21af('0xac')]['describe']()['then'](respondWithResult(_0x35cd77,null))['catch'](handleError(_0x35cd77,null));};exports['createVidaooSession']=function(_0x480983,_0x198171){var _0x3b9102=_0x480983[_0x21af('0xc6')]['id'];var _0x46aa4d;var _0x340910;var _0x1c3110;return db[_0x21af('0xac')][_0x21af('0xcc')]({'where':{'id':_0x3b9102}})[_0x21af('0x21')](function(_0x310dd6){_0x46aa4d=_0x310dd6;return db[_0x21af('0xcd')][_0x21af('0xcc')]({'where':{'id':_0x310dd6[_0x21af('0x8c')]},'attributes':['id',_0x21af('0xce'),_0x21af('0xcf'),_0x21af('0xd0'),'vidaooNote',_0x21af('0xd1')],'raw':!![]});})[_0x21af('0x21')](function(_0x487cf7){if(_0x487cf7&&_0x487cf7[_0x21af('0xce')]&&_0x487cf7[_0x21af('0xcf')]){_0x340910=_0x487cf7;var _0x559391={'interaction':{'id':_0x3b9102},'agent':{'id':_0x480983[_0x21af('0xa6')]['id'],'name':_0x480983[_0x21af('0xa6')][_0x21af('0x36')],'fullname':_0x480983['user'][_0x21af('0x40')],'email':_0x480983[_0x21af('0xa6')][_0x21af('0xd2')]},'contact':_0x480983['body'][_0x21af('0x3b')],'account':_0x480983['body'][_0x21af('0xd3')]};var _0x22da2d={'rejectUnauthorized':![],'method':_0x21af('0xd4'),'url':_0x21af('0xd5'),'headers':{'X-APIKEY':_0x487cf7[_0x21af('0xce')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x480983['user'][_0x21af('0xd2')]],'buttons':null,'topic':_0x340910['vidaooTopic'],'note':_[_0x21af('0xd6')](_0x340910[_0x21af('0xd7')])?null:getMustacheRender(_0x340910[_0x21af('0xd7')],_0x559391),'metadata':null},'redirect':_0x21af('0xd8'),'json':!![]};try{if(!_['isNull'](_0x340910[_0x21af('0xd1')])){var _0x40dbe3=getMustacheRender(_0x340910[_0x21af('0xd1')],_0x559391);var _0x5f4104=JSON['parse'](_0x40dbe3);_0x22da2d[_0x21af('0x3a')][_0x21af('0xd9')]=_0x5f4104;}}catch(_0x56d2ca){throw new db[(_0x21af('0x9f'))]['ValidationError']('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0x22da2d);}else{throw new db['Sequelize'][(_0x21af('0xda'))](_0x21af('0xdb'));}})[_0x21af('0x21')](function(_0x2fceda){_0x1c3110=_0x2fceda;if(_0x1c3110['id']){var _0x3d2ed2={'body':_0x1c3110[_0x21af('0xdc')],'ChatWebsiteId':_0x340910['id'],'ChatInteractionId':_0x46aa4d['id'],'direction':_0x21af('0xdd'),'UserId':_0x480983['user']['id']};return db[_0x21af('0xde')][_0x21af('0xc8')](_0x3d2ed2,{});}else{throw new db[(_0x21af('0x9f'))][(_0x21af('0xda'))](_0x21af('0xdf'));}})['then'](function(){return _0x46aa4d['updateAttributes']({'vidaooSessionId':_0x1c3110['id']});})[_0x21af('0x21')](respondWithResult(_0x198171,null))['catch'](handleError(_0x198171,null));};exports[_0x21af('0xe0')]=function(_0x1dccec,_0x3979fe){if(_0x1dccec[_0x21af('0x3a')]['id']){delete _0x1dccec[_0x21af('0x3a')]['id'];}return db['ChatInteraction']['find']({'where':{'id':_0x1dccec[_0x21af('0xc6')]['id']},'include':[{'model':db[_0x21af('0xe1')],'as':_0x21af('0xe2')}]})[_0x21af('0x21')](handleEntityNotFound(_0x3979fe,null))[_0x21af('0x21')](saveUpdates(_0x1dccec[_0x21af('0x3a')],null))[_0x21af('0x21')](respondWithResult(_0x3979fe,null))[_0x21af('0xc9')](handleError(_0x3979fe,null));};exports['abandon']=function(_0x8f3a83,_0x1c7054,_0x55f0fc){if(_0x8f3a83[_0x21af('0x3a')]['id']){delete _0x8f3a83['body']['id'];}return db[_0x21af('0xac')][_0x21af('0x75')]({'where':{'id':_0x8f3a83['params']['id']}})[_0x21af('0x21')](function(_0x333db2){if(!_0x333db2){logger[_0x21af('0x28')]('abandonInteraction,\x20%s,\x20%s,\x20%s',_0x21af('0xe3'),0x194,'entity\x20not\x20found');_0x1c7054['sendStatus'](0x194);}else{if(_0x333db2[_0x21af('0x4b')]){throw new db[(_0x21af('0x9f'))][(_0x21af('0xda'))](_0x21af('0xe4'));}}return _0x333db2;})[_0x21af('0x21')](function(_0x1209bd){if(_0x1209bd){return _0x1209bd[_0x21af('0x34')]({'closed':_0x8f3a83['body'][_0x21af('0x4a')],'disposition':_0x8f3a83[_0x21af('0x3a')]['disposition']})[_0x21af('0x21')](function(_0x9e71ff){return _0x9e71ff;});}})[_0x21af('0x21')](function(_0x4c0202){return respondWithRpcPromise('AbandonInteraction',_0x21af('0xe3'),_0x8f3a83['body'],client9004);})[_0x21af('0x21')](respondWithResult(_0x1c7054,null))['catch'](handleError(_0x1c7054,null));};exports[_0x21af('0xe5')]=function(_0x1dd943,_0x271dc2,_0x3ecba6){_0x1dd943[_0x21af('0x3a')]['name']=_0x1dd943['file']['originalname'];_0x1dd943[_0x21af('0x3a')]['basename']=_0x1dd943['file'][_0x21af('0xe6')];_0x1dd943[_0x21af('0x3a')][_0x21af('0x51')]=_0x1dd943['file'][_0x21af('0xe7')];return db[_0x21af('0xe8')][_0x21af('0xc8')](_0x1dd943[_0x21af('0x3a')])[_0x21af('0x21')](respondWithResult(_0x271dc2,0xc9))['catch'](handleError(_0x271dc2,null));};exports[_0x21af('0xe9')]=function(_0x4db5c1,_0x4b17d7,_0x1dfc54){return db[_0x21af('0xac')]['findOne']({'where':{'id':_0x4db5c1['params']['id']},'raw':!![]})['then'](handleEntityNotFound(_0x4b17d7,null))['then'](function(_0x3292f9){if(_0x3292f9){if(_0x3292f9['closed']){return _0x4b17d7[_0x21af('0x2c')](0x193)[_0x21af('0x2d')]({'status':0x193,'message':_0x21af('0xea')});}return db[_0x21af('0xe8')][_0x21af('0xcc')]({'where':{'id':_0x4db5c1[_0x21af('0x54')][_0x21af('0xeb')]},'raw':!![]})[_0x21af('0x21')](handleEntityNotFound(_0x4b17d7,null));}})[_0x21af('0x21')](function(_0x1c269a){if(_0x1c269a){var _0x4db6ff=_0x1c269a[_0x21af('0xec')]!==null;var _0x5c8503=path['join'](config[_0x21af('0xed')],_0x21af('0xee'));if(_0x4db6ff){_0x5c8503=path['join'](_0x5c8503,_0x21af('0xef'));}var _0xf93226=path[_0x21af('0xf0')](_0x5c8503,_0x1c269a['basename']);return _0x4b17d7['download'](_0xf93226);}})[_0x21af('0xc9')](handleError(_0x4b17d7,null));};exports[_0x21af('0xf1')]=function(_0x46cd36,_0x3fc93b){var _0x597e50=null;var _0x569140=null;var _0x4c486e=null;var _0x1dc1d6=null;if(_0x46cd36[_0x21af('0x3a')]['id']){delete _0x46cd36[_0x21af('0x3a')]['id'];}if(_0x46cd36[_0x21af('0x3a')]['mailTranscript']){_0x1dc1d6=path[_0x21af('0xf0')](config[_0x21af('0xed')],_0x21af('0xf2'),util['format'](_0x21af('0xf3'),Date[_0x21af('0xf4')]()));_0x46cd36[_0x21af('0x3a')][_0x21af('0xf5')]=_0x1dc1d6;}return db[_0x21af('0xac')][_0x21af('0x75')]({'where':{'id':_0x46cd36[_0x21af('0xc6')]['id']},'include':[{'model':db[_0x21af('0xde')],'as':_0x21af('0xf6'),'include':[{'model':db[_0x21af('0x86')],'as':_0x21af('0x86')}]}]})[_0x21af('0x21')](handleEntityNotFound(_0x3fc93b,null))['then'](saveUpdates(_0x46cd36[_0x21af('0x3a')],null))[_0x21af('0x21')](function(_0x233a26){if(_0x233a26){_0x597e50=_0x233a26;return db[_0x21af('0xcd')][_0x21af('0x75')]({'where':{'id':_0x597e50[_0x21af('0x8c')]}});}})['then'](function(_0x73c7cb){if(_0x73c7cb){_0x4c486e=_0x73c7cb;return db[_0x21af('0xe1')][_0x21af('0x75')]({'where':{'id':_0x597e50[_0x21af('0x7f')]}});}})[_0x21af('0x21')](function(_0xc6da6d){if(_0xc6da6d){_0x569140=_0xc6da6d;if(_0x1dc1d6){var _0x4571bb=null;for(var _0x559afb=0x1;_0x559afb<_0x597e50[_0x21af('0xf6')][_0x21af('0x59')];++_0x559afb){_0x4571bb=_0x597e50['Messages'][_0x559afb];var _0x4381e5=_0x4571bb[_0x21af('0x4b')]?util[_0x21af('0xf7')](_0x21af('0xf8'),_0x4c486e[_0x21af('0xf9')],_0x4571bb[_0x21af('0x4b')]):_0x21af('0xfa');var _0x660ee3=_0x46cd36[_0x21af('0x3a')][_0x21af('0xfb')]||util[_0x21af('0xf7')]('%s%d','Visitor',_0x4571bb[_0x21af('0x7f')]);switch(_0x4c486e['agentIdentifier']){case _0x21af('0xfc'):_0x4381e5=_0x4571bb[_0x21af('0x4b')]?util[_0x21af('0xf7')](_0x21af('0xf8'),_0x4c486e[_0x21af('0xf9')],_0x4571bb['UserId']):_0x21af('0xfa');break;case _0x21af('0xfd'):_0x4381e5=_0x4571bb['UserId']?_0x4571bb[_0x21af('0x86')][_0x21af('0xfe')]||_0x4571bb[_0x21af('0x86')][_0x21af('0x40')]:_0x21af('0xfa');break;case'agent_fullname':_0x4381e5=_0x4571bb[_0x21af('0x4b')]?_0x4571bb[_0x21af('0x86')]['fullname']:_0x21af('0xfa');break;default:_0x4381e5=_0x4571bb[_0x21af('0x4b')]?util['format'](_0x21af('0xf8'),_0x4c486e['agentAlias'],_0x4571bb[_0x21af('0x4b')]):'System';}var _0x4f40ea=util['format'](_0x21af('0xff'),moment(_0x4571bb[_0x21af('0x8f')])[_0x21af('0xf7')](_0x21af('0x100')),_0x4571bb[_0x21af('0x101')]==='in'?_0x660ee3:_0x4381e5,_0x4571bb[_0x21af('0x3a')]);if(!_0x4571bb[_0x21af('0x102')]){fs[_0x21af('0x103')](_0x1dc1d6,_0x4f40ea);}}return db[_0x21af('0x104')][_0x21af('0xcc')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0x21af('0x105'),'raw':!![]}]});}}})[_0x21af('0x21')](function(_0x40fab4){if(_0x40fab4&&_0x40fab4[_0x21af('0x105')]&&_0x46cd36[_0x21af('0x3a')]){var _0x1dae9d={'tls':{'rejectUnauthorized':![]}};if(_0x40fab4[_0x21af('0x105')][_0x21af('0x106')]){_0x1dae9d[_0x21af('0x106')]=_0x40fab4[_0x21af('0x105')][_0x21af('0x106')];}else{_0x1dae9d['host']=_0x40fab4['Smtp'][_0x21af('0x107')];_0x1dae9d[_0x21af('0x108')]=_0x40fab4[_0x21af('0x105')][_0x21af('0x108')];_0x1dae9d[_0x21af('0x109')]=_0x40fab4[_0x21af('0x105')][_0x21af('0x109')];}if(_0x40fab4[_0x21af('0x105')]['authentication']){_0x1dae9d['auth']={'user':_0x40fab4[_0x21af('0x105')][_0x21af('0xa6')],'pass':_0x40fab4[_0x21af('0x105')][_0x21af('0x10a')]};}return respondWithRpcPromise(_0x21af('0x10b'),'sendMail',{'account':_0x1dae9d,'message':{'from':util[_0x21af('0xf7')](_0x21af('0x10c'),_0x40fab4[_0x21af('0x36')],_0x40fab4[_0x21af('0xd2')]||_0x40fab4[_0x21af('0x105')][_0x21af('0xa6')]),'to':_0x46cd36[_0x21af('0x3a')][_0x21af('0x10d')],'subject':_0x21af('0x10e'),'text':util[_0x21af('0xf7')](_0x21af('0x10f'),_0x46cd36['body'][_0x21af('0x10d')]),'attachments':[{'path':_0x1dc1d6}]}})[_0x21af('0x21')](function(){return _0x597e50;})[_0x21af('0xc9')](function(_0x281447){console[_0x21af('0x28')](_0x281447);});}else{return _0x597e50;}})[_0x21af('0x21')](respondWithStatusCode(_0x3fc93b,0xc8))['catch'](handleError(_0x3fc93b,null));};exports[_0x21af('0x110')]=function(_0x32a3b5,_0x33973c,_0x2b61fe){return db[_0x21af('0xde')][_0x21af('0x75')]({'where':{'id':_0x32a3b5[_0x21af('0xc6')]['id']}})['then'](handleEntityNotFound(_0x33973c,null))[_0x21af('0x21')](function(_0x37e2d3){if(_0x37e2d3){return _0x37e2d3[_0x21af('0x110')](_0x32a3b5[_0x21af('0x3a')][_0x21af('0x111')],_[_0x21af('0x112')](_0x32a3b5['body'],[_0x21af('0x111'),'id'])||{});}})[_0x21af('0x21')](respondWithResult(_0x33973c,null))[_0x21af('0xc9')](handleError(_0x33973c,null));};exports[_0x21af('0x113')]=function(_0x18357a,_0x2579c3,_0x5b5e25){var _0x31e816={'raw':![],'where':{}};var _0x410548={};var _0x14e5dc={'count':0x0,'rows':[]};return db['ChatInteraction']['findOne']({'where':{'id':_0x18357a['params']['id']}})[_0x21af('0x21')](handleEntityNotFound(_0x2579c3,null))[_0x21af('0x21')](function(_0x2ef164){if(_0x2ef164){_0x410548[_0x21af('0x53')]=_['keys'](db[_0x21af('0xde')][_0x21af('0x4f')]);_0x410548[_0x21af('0x54')]=_[_0x21af('0x55')](_0x18357a['query']);_0x410548[_0x21af('0x60')]=_[_0x21af('0x56')](_0x410548['model'],_0x410548[_0x21af('0x54')]);_0x31e816[_0x21af('0x57')]=_[_0x21af('0x56')](_0x410548[_0x21af('0x53')],qs['fields'](_0x18357a[_0x21af('0x54')][_0x21af('0x58')]));_0x31e816['attributes']=_0x31e816[_0x21af('0x57')][_0x21af('0x59')]?_0x31e816[_0x21af('0x57')]:_0x410548[_0x21af('0x53')];if(!_0x18357a[_0x21af('0x54')]['hasOwnProperty'](_0x21af('0x5b'))){_0x31e816['limit']=qs[_0x21af('0x2f')](_0x18357a[_0x21af('0x54')][_0x21af('0x2f')]);_0x31e816['offset']=qs[_0x21af('0x2e')](_0x18357a[_0x21af('0x54')]['offset']);}_0x31e816['order']=qs[_0x21af('0x5d')](_0x18357a[_0x21af('0x54')]['sort']);_0x31e816[_0x21af('0x5e')]=qs['filters'](_[_0x21af('0x5f')](_0x18357a['query'],_0x410548['filters']));_0x31e816[_0x21af('0x5e')][_0x21af('0xc1')]=_0x2ef164['id'];if(_0x18357a[_0x21af('0x54')][_0x21af('0x99')]){_0x31e816[_0x21af('0x5e')]=_[_0x21af('0x39')](_0x31e816[_0x21af('0x5e')],{'$or':_[_0x21af('0x3f')](_0x31e816['attributes'],function(_0x1361c2){var _0x36dc34={};_0x36dc34[_0x1361c2]={'$like':'%'+_0x18357a['query'][_0x21af('0x99')]+'%'};return _0x36dc34;})});}if(_0x18357a[_0x21af('0x54')][_0x21af('0x91')]){var _0x3ed5aa=_0x18357a[_0x21af('0x54')][_0x21af('0x91')][_0x21af('0x42')](',');var _0x38a8b9={};_0x38a8b9[_0x3ed5aa[0x0]]={'$gte':moment(_0x3ed5aa[0x1])[_0x21af('0xf7')]('YYYY-MM-DD\x20HH:mm:ss')};_0x31e816[_0x21af('0x5e')]=_['merge'](_0x31e816['where'],_0x38a8b9);}_0x31e816=_[_0x21af('0x39')]({},_0x31e816,_0x18357a['options']);return db['ChatMessage'][_0x21af('0x30')]({'where':_0x31e816[_0x21af('0x5e')]})['then'](function(_0x223ea5){_0x14e5dc[_0x21af('0x30')]=_0x223ea5;if(_0x18357a[_0x21af('0x54')][_0x21af('0x114')]){_0x31e816[_0x21af('0xc7')]=[{'all':!![]}];}return db[_0x21af('0xde')][_0x21af('0x115')](_0x31e816);})['then'](function(_0x5e1de0){_0x14e5dc[_0x21af('0xc4')]=_0x5e1de0;return _0x14e5dc;});}})['then'](respondWithFilteredResult(_0x2579c3,_0x31e816))['catch'](handleError(_0x2579c3,null));};exports[_0x21af('0x116')]=function(_0x2092ca,_0x33dfd2,_0x4e39d1){var _0x5f2dc5={'where':{}},_0x15e58a={},_0x241e6b={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x21af('0xcc')]({'where':{'id':_0x2092ca[_0x21af('0xc6')]['id']}})[_0x21af('0x21')](handleEntityNotFound(_0x33dfd2,null))[_0x21af('0x21')](function(_0x1244c5){if(_0x1244c5){_0x15e58a['model']=_[_0x21af('0x55')](db[_0x21af('0xde')][_0x21af('0x4f')]);_0x15e58a[_0x21af('0x54')]=_[_0x21af('0x55')](_0x2092ca[_0x21af('0x54')]);_0x15e58a[_0x21af('0x60')]=_[_0x21af('0x56')](_0x15e58a[_0x21af('0x53')],_0x15e58a[_0x21af('0x54')]);_0x5f2dc5[_0x21af('0x57')]=_[_0x21af('0x56')](_0x15e58a[_0x21af('0x53')],qs[_0x21af('0x58')](_0x2092ca[_0x21af('0x54')][_0x21af('0x58')]));_0x5f2dc5[_0x21af('0x57')]=_0x5f2dc5['attributes'][_0x21af('0x59')]?_0x5f2dc5[_0x21af('0x57')]:_0x15e58a[_0x21af('0x53')];if(!_0x2092ca['query'][_0x21af('0x5a')](_0x21af('0x5b'))){_0x5f2dc5[_0x21af('0x2f')]=qs[_0x21af('0x2f')](_0x2092ca[_0x21af('0x54')][_0x21af('0x2f')]);_0x5f2dc5['offset']=qs[_0x21af('0x2e')](_0x2092ca[_0x21af('0x54')][_0x21af('0x2e')]);}_0x5f2dc5['order']=qs['sort'](_0x2092ca[_0x21af('0x54')][_0x21af('0x5d')]);_0x5f2dc5[_0x21af('0x5e')]=qs['filters'](_[_0x21af('0x5f')](_0x2092ca[_0x21af('0x54')],_0x15e58a[_0x21af('0x60')]));_0x5f2dc5[_0x21af('0x5e')][_0x21af('0xc1')]=_0x1244c5['id'];if(_0x2092ca['query'][_0x21af('0x99')]){_0x5f2dc5['where']=_['merge'](_0x5f2dc5[_0x21af('0x5e')],{'$or':_[_0x21af('0x3f')](_0x5f2dc5[_0x21af('0x57')],function(_0x2fde67){var _0x4f3969={};_0x4f3969[_0x2fde67]={'$like':'%'+_0x2092ca[_0x21af('0x54')][_0x21af('0x99')]+'%'};return _0x4f3969;})});}_0x5f2dc5[_0x21af('0x5e')][_0x21af('0x102')]=![];if(_0x2092ca[_0x21af('0x54')]['id']){_0x5f2dc5['where']['id']={'$gt':_0x2092ca[_0x21af('0x54')]['id']};}_0x5f2dc5=_[_0x21af('0x39')]({},_0x5f2dc5,_0x2092ca['options']);return db['ChatMessage'][_0x21af('0x30')]({'where':_0x5f2dc5[_0x21af('0x5e')]})[_0x21af('0x21')](function(_0x1e2aea){_0x241e6b['count']=_0x1e2aea;_0x5f2dc5[_0x21af('0xc7')]=[];if(_0x2092ca[_0x21af('0x54')]['includeAgent']){_0x5f2dc5[_0x21af('0xc7')][_0x21af('0xc2')]({'model':db[_0x21af('0x86')],'as':_0x21af('0x86'),'attributes':['id',_0x21af('0x40'),'alias']});}if(_0x2092ca['query']['includeAll']){_0x5f2dc5['include']=[{'all':!![]}];}return db[_0x21af('0xde')][_0x21af('0x115')](_0x5f2dc5);})[_0x21af('0x21')](function(_0x24c162){_0x241e6b[_0x21af('0xc4')]=_0x24c162;return _0x241e6b;});}})[_0x21af('0x21')](respondWithFilteredResult(_0x33dfd2,_0x5f2dc5))[_0x21af('0xc9')](handleError(_0x33dfd2,null));};exports[_0x21af('0x117')]=function(_0x1fbd84,_0x104d58,_0x2092f8){return db['ChatInteraction'][_0x21af('0x75')]({'where':{'id':_0x1fbd84[_0x21af('0xc6')]['id']}})['then'](handleEntityNotFound(_0x104d58,null))[_0x21af('0x21')](function(_0x50c54c){if(_0x50c54c){return _0x50c54c[_0x21af('0x118')](_0x1fbd84[_0x21af('0x3a')][_0x21af('0x111')],_[_0x21af('0x112')](_0x1fbd84[_0x21af('0x3a')],[_0x21af('0x111'),'id'])||{})[_0x21af('0x119')](function(){return db['Tag'][_0x21af('0x115')]({'attributes':['id',_0x21af('0x36'),_0x21af('0x11a')],'where':{'id':_0x1fbd84[_0x21af('0x3a')][_0x21af('0x111')]}});})[_0x21af('0x21')](function(_0x3b0e7a){socket[_0x21af('0x11b')](_0x21af('0x11c'),{'id':Number(_0x1fbd84['params']['id']),'tags':_0x3b0e7a||[]});return{'id':Number(_0x1fbd84[_0x21af('0xc6')]['id']),'tags':_0x3b0e7a||[]};});}})['then'](respondWithResult(_0x104d58,null))[_0x21af('0xc9')](handleError(_0x104d58,null));};exports[_0x21af('0x11d')]=function(_0x1ebb18,_0x2cf41a,_0x507449){return db[_0x21af('0xac')][_0x21af('0x75')]({'where':{'id':_0x1ebb18[_0x21af('0xc6')]['id']}})['then'](handleEntityNotFound(_0x2cf41a,null))[_0x21af('0x21')](function(_0x3ca023){if(_0x3ca023){return _0x3ca023[_0x21af('0x11d')](_0x1ebb18[_0x21af('0x54')]['ids']);}})[_0x21af('0x21')](respondWithStatusCode(_0x2cf41a,null))[_0x21af('0xc9')](handleError(_0x2cf41a,null));};exports['download']=function(_0x247dcc,_0x4cfe65){var _0x5b47a7=moment()[_0x21af('0x11e')]()['toString']();var _0x2de511=path['join'](config[_0x21af('0xed')],'server',_0x21af('0x11f'),_0x21af('0x120'));var _0x26fde7=path[_0x21af('0xf0')](config[_0x21af('0xed')],'server',_0x21af('0x11f'),'attachments');var _0x426955=path[_0x21af('0xf0')](_0x2de511,_0x5b47a7);var _0x2c15b3=util['format'](_0x21af('0x121'),_0x247dcc[_0x21af('0xc6')]['id'],_0x5b47a7);var _0x33ea44=path[_0x21af('0xf0')](_0x2de511,_0x2c15b3);var _0x4ce9a7=[];_0x4ce9a7[_0x21af('0xc2')]({'model':db[_0x21af('0x86')],'as':'User','attributes':['id',_0x21af('0x40')],'raw':!![]});_0x4ce9a7['push']({'model':db[_0x21af('0xe1')],'as':'Contact','attributes':['id',_0x21af('0x122'),_0x21af('0x123')],'raw':!![]});if(_0x247dcc[_0x21af('0x54')][_0x21af('0x124')]){_0x4ce9a7[_0x21af('0xc2')]({'model':db['Attachment'],'as':_0x21af('0xe8'),'raw':!![]});}var _0x1c56e6=[{'model':db[_0x21af('0xde')],'as':_0x21af('0xf6'),'attributes':['id',_0x21af('0x3a'),'createdAt','direction',_0x21af('0x102'),_0x21af('0x95')],'include':_0x4ce9a7}];_0x1c56e6[_0x21af('0xc2')]({'model':db[_0x21af('0xcd')],'as':_0x21af('0x125'),'attributes':['id',_0x21af('0x36')]});_0x1c56e6['push']({'model':db[_0x21af('0x86')],'as':_0x21af('0x126'),'attributes':['id','fullname']});return db['ChatInteraction'][_0x21af('0x75')]({'where':{'id':_0x247dcc['params']['id']},'include':_0x1c56e6})[_0x21af('0x21')](handleEntityNotFound(_0x4cfe65,null))[_0x21af('0x21')](function(_0x3178f4){if(_0x3178f4){var _0x14338e=_0x3178f4[_0x21af('0x127')]({'plain':!![]});fs[_0x21af('0x128')](_0x426955);var _0x937317={'channel':_0x21af('0x129'),'account':_0x14338e[_0x21af('0x125')][_0x21af('0x36')],'agent':_0x14338e[_0x21af('0x126')]?_0x14338e[_0x21af('0x126')][_0x21af('0x40')]:'N.A.','createdAt':moment(_0x14338e[_0x21af('0x8f')])['format'](_0x21af('0x12a'))[_0x21af('0xaa')](),'closedAt':_0x14338e[_0x21af('0x4a')]?moment(_0x14338e[_0x21af('0x12b')])[_0x21af('0xf7')](_0x21af('0x12a'))[_0x21af('0xaa')]():'','disposition':_0x14338e[_0x21af('0x4c')],'chatInfo':{'browser':_0x14338e[_0x21af('0x12c')],'os':_0x14338e[_0x21af('0x12d')],'referer':_0x14338e['referer'],'customerIp':_0x14338e[_0x21af('0x12e')],'customerPort':_0x14338e[_0x21af('0x12f')]?_0x14338e[_0x21af('0x12f')]:'N.A.'},'messages':_(_0x14338e[_0x21af('0xf6')])[_0x21af('0x130')]()[_0x21af('0x99')]({'secret':![]})['map'](function(_0x4f80eb){if(_0x4f80eb[_0x21af('0xe8')]){var _0x290559=path[_0x21af('0xf0')](_0x26fde7,_0x4f80eb[_0x21af('0xe8')][_0x21af('0x131')]);if(fs['existsSync'](_0x290559)){fs['createReadStream'](_0x290559)[_0x21af('0x132')](fs[_0x21af('0x133')](path[_0x21af('0xf0')](_0x426955,_0x4f80eb[_0x21af('0xe8')]['basename'])));}}return{'date':moment(_0x4f80eb['createdAt'])[_0x21af('0xf7')]('YYYY-MM-DD\x20HH:mm:ss')[_0x21af('0xaa')](),'sender':_0x4f80eb['direction']===_0x21af('0xdd')?_0x4f80eb[_0x21af('0x86')]?_0x4f80eb[_0x21af('0x86')]['fullname']:_0x21af('0xfa'):_0x4f80eb[_0x21af('0xe2')]['firstName']+(_0x4f80eb['Contact'][_0x21af('0x123')]?'\x20'+_0x4f80eb[_0x21af('0xe2')]['lastName']:''),'body':_0x4f80eb[_0x21af('0xe8')]?_0x4f80eb[_0x21af('0xe8')]['basename']:_0x4f80eb[_0x21af('0x3a')],'direction':_0x4f80eb[_0x21af('0x101')]===_0x21af('0xdd')?'A':'C','secret':_0x4f80eb[_0x21af('0x102')],'read':_0x4f80eb[_0x21af('0x95')],'attachment':_0x4f80eb[_0x21af('0xe8')]};})[_0x21af('0x77')]()};return ejs[_0x21af('0x134')](path[_0x21af('0xf0')](config['root'],_0x21af('0x135'),_0x21af('0x136'),_0x21af('0x137')),{'interaction':_0x937317})[_0x21af('0x21')](function(_0x198010){var _0x3878e8=path[_0x21af('0xf0')](_0x426955,_0x21af('0x138')+_0x14338e['id']+'-'+_0x5b47a7+_0x21af('0x139'));var _0x17dc9a={'path':_0x3878e8,'channel':'Chat','interactionId':_0x14338e['id']};return pdf[_0x21af('0x13a')](_0x198010,_0x17dc9a);})[_0x21af('0x21')](function(){return new BPromise(function(_0x1abdc4,_0x3b5f3c){zipdir(_0x426955,{'saveTo':_0x33ea44},function(_0x50cc4a,_0x17a16e){if(_0x50cc4a)return _0x3b5f3c(_0x50cc4a);return _0x1abdc4(_0x17a16e);});})[_0x21af('0x21')](function(){return new BPromise(function(_0x1d9807,_0x28c5bd){rimraf(_0x426955,function(_0x5783a1){if(_0x5783a1)_0x28c5bd(_0x5783a1);return _0x1d9807();});});})[_0x21af('0x21')](function(){return _0x4cfe65[_0x21af('0x13b')](_0x33ea44,_0x2c15b3,function(_0x3f826b){if(_0x3f826b){console['log'](_0x21af('0x13c'),_0x3f826b);}else{fs[_0x21af('0x13d')](_0x33ea44);}});});});}else{return _0x4cfe65[_0x21af('0x35')](0xc8);}})[_0x21af('0xc9')](handleError(_0x4cfe65,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index cacc5f8..3816797 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 _0x0a6c=['emit','catch','hook','exports','../../mysqldb','ChatInteraction','ChatMessage','save','update','remove','getUsers','then','setDataValue','unreadMessages','length'];(function(_0x2d4661,_0x2da65c){var _0x42ed1e=function(_0x263c50){while(--_0x263c50){_0x2d4661['push'](_0x2d4661['shift']());}};_0x42ed1e(++_0x2da65c);}(_0x0a6c,0x7c));var _0xc0a6=function(_0x24d98d,_0x27db31){_0x24d98d=_0x24d98d-0x0;var _0x1a8c12=_0x0a6c[_0x24d98d];return _0x1a8c12;};'use strict';var EventEmitter=require('events');var ChatInteraction=require(_0xc0a6('0x0'))['db'][_0xc0a6('0x1')];var ChatMessage=require(_0xc0a6('0x0'))['db'][_0xc0a6('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc0a6('0x3'),'afterUpdate':_0xc0a6('0x4'),'afterDestroy':_0xc0a6('0x5')};function emitEvent(_0x483937){return function(_0x48f3db,_0x548f2e,_0x2dbd7e){_0x48f3db[_0xc0a6('0x6')]({'attributes':['id'],'raw':!![]})[_0xc0a6('0x7')](function(_0xdca02b){_0x48f3db[_0xc0a6('0x8')]('Users',_0xdca02b['map'](function(_0x54a97a){return{'id':_0x54a97a['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x48f3db['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc0a6('0x7')](function(_0x742587){_0x48f3db['setDataValue'](_0xc0a6('0x9'),_0x742587[_0xc0a6('0xa')]);ChatInteractionEvents['emit'](_0x483937+':'+_0x48f3db['id'],_0x48f3db);ChatInteractionEvents[_0xc0a6('0xb')](_0x483937,_0x48f3db);_0x2dbd7e(null);})[_0xc0a6('0xc')](_0x2dbd7e(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction[_0xc0a6('0xd')](e,emitEvent(event));}}module[_0xc0a6('0xe')]=ChatInteractionEvents; \ No newline at end of file +var _0xd1a7=['unreadMessages','length','catch','hasOwnProperty','hook','exports','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','save','update','remove','getUsers','setDataValue','Users','map','findAll','then'];(function(_0x8ae1c9,_0x1c61ab){var _0x18b221=function(_0x264532){while(--_0x264532){_0x8ae1c9['push'](_0x8ae1c9['shift']());}};_0x18b221(++_0x1c61ab);}(_0xd1a7,0x65));var _0x7d1a=function(_0x1139c9,_0x17fee8){_0x1139c9=_0x1139c9-0x0;var _0x5ba3af=_0xd1a7[_0x1139c9];return _0x5ba3af;};'use strict';var EventEmitter=require('events');var ChatInteraction=require(_0x7d1a('0x0'))['db'][_0x7d1a('0x1')];var ChatMessage=require(_0x7d1a('0x0'))['db'][_0x7d1a('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x7d1a('0x3')](0x0);var events={'afterCreate':_0x7d1a('0x4'),'afterUpdate':_0x7d1a('0x5'),'afterDestroy':_0x7d1a('0x6')};function emitEvent(_0x19f3fc){return function(_0x42cac6,_0xc6142,_0x553e6a){_0x42cac6[_0x7d1a('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x437a9d){_0x42cac6[_0x7d1a('0x8')](_0x7d1a('0x9'),_0x437a9d[_0x7d1a('0xa')](function(_0x311348){return{'id':_0x311348['id']};}));return ChatMessage[_0x7d1a('0xb')]({'where':{'ChatInteractionId':_0x42cac6['id'],'direction':'in','read':![]},'raw':!![]});})[_0x7d1a('0xc')](function(_0x2b9831){_0x42cac6[_0x7d1a('0x8')](_0x7d1a('0xd'),_0x2b9831[_0x7d1a('0xe')]);ChatInteractionEvents['emit'](_0x19f3fc+':'+_0x42cac6['id'],_0x42cac6);ChatInteractionEvents['emit'](_0x19f3fc,_0x42cac6);_0x553e6a(null);})[_0x7d1a('0xf')](_0x553e6a(null));};}for(var e in events){if(events[_0x7d1a('0x10')](e)){var event=events[e];ChatInteraction[_0x7d1a('0x11')](e,emitEvent(event));}}module[_0x7d1a('0x12')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 4edc087..b1f7ad4 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 _0xa844=['path','../../config/environment','./chatInteraction.attributes','exports','ChatInteraction','chat_interactions','closed','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','util','api','moment','bluebird'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xa844,0x155));var _0x4a84=function(_0x2c0d39,_0x5dbacc){_0x2c0d39=_0x2c0d39-0x0;var _0x562e1f=_0xa844[_0x2c0d39];return _0x562e1f;};'use strict';var _=require('lodash');var util=require(_0x4a84('0x0'));var logger=require('../../config/logger')(_0x4a84('0x1'));var moment=require(_0x4a84('0x2'));var BPromise=require(_0x4a84('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4a84('0x4'));var rimraf=require('rimraf');var config=require(_0x4a84('0x5'));var attributes=require(_0x4a84('0x6'));module[_0x4a84('0x7')]=function(_0x346a69,_0x1e2659){return _0x346a69['define'](_0x4a84('0x8'),attributes,{'tableName':_0x4a84('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x522336,_0xb15855,_0x907dfc){if(_0x522336['changed'](_0x4a84('0xa'))){_0x522336['closedAt']=moment()[_0x4a84('0xb')](_0x4a84('0xc'));}_0x907dfc(null,_0x522336);}},'charset':_0x4a84('0xd'),'collate':_0x4a84('0xe')});}; \ No newline at end of file +var _0x3b5d=['YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','rimraf','../../config/environment','./chatInteraction.attributes','exports','changed','closedAt','format'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x3b5d,0x78));var _0xd3b5=function(_0x14e3d1,_0x5e37a5){_0x14e3d1=_0x14e3d1-0x0;var _0x5baa3b=_0x3b5d[_0x14e3d1];return _0x5baa3b;};'use strict';var _=require('lodash');var util=require(_0xd3b5('0x0'));var logger=require(_0xd3b5('0x1'))(_0xd3b5('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd3b5('0x3'));var config=require(_0xd3b5('0x4'));var attributes=require(_0xd3b5('0x5'));module[_0xd3b5('0x6')]=function(_0x423610,_0x259830){return _0x423610['define']('ChatInteraction',attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4c3b22,_0x27db0c,_0x147bb1){if(_0x4c3b22[_0xd3b5('0x7')]('closed')){_0x4c3b22[_0xd3b5('0x8')]=moment()[_0xd3b5('0x9')](_0xd3b5('0xa'));}_0x147bb1(null,_0x4c3b22);}},'charset':_0xd3b5('0xb'),'collate':_0xd3b5('0xc')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index cd986a2..482fea1 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 _0x54e6=['../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./chatInteraction.socket','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','UpdateChatInteraction','ChatInteraction','update','options','raw','where','attributes','limit','catch','AddTagsToChatInteraction','addTags','body','omit','ids','spread','AddTags','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x3079fe,_0x201497){var _0x4e4df4=function(_0x4efe3a){while(--_0x4efe3a){_0x3079fe['push'](_0x3079fe['shift']());}};_0x4e4df4(++_0x201497);}(_0x54e6,0x180));var _0x654e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x54e6[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x654e('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x654e('0x1'));var fs=require('fs');var Redis=require(_0x654e('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x654e('0x3'));var logger=require(_0x654e('0x4'))(_0x654e('0x5'));var config=require(_0x654e('0x6'));var jayson=require(_0x654e('0x7'));var client=jayson[_0x654e('0x8')][_0x654e('0x9')]({'port':0x232a});config[_0x654e('0xa')]=_['defaults'](config[_0x654e('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x654e('0xb'))(new Redis(config[_0x654e('0xa')]));require(_0x654e('0xc'))['register'](socket);function respondWithRpcPromise(_0x4d9090,_0x59b1a2,_0x386526){return new BPromise(function(_0x4ccf05,_0x4dc2d4){return client[_0x654e('0xd')](_0x4d9090,_0x386526)[_0x654e('0xe')](function(_0x4e5519){logger[_0x654e('0xf')](_0x654e('0x10'),_0x59b1a2,_0x654e('0x11'));logger[_0x654e('0x12')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x59b1a2,_0x654e('0x11'),JSON[_0x654e('0x13')](_0x4e5519));if(_0x4e5519[_0x654e('0x14')]){if(_0x4e5519[_0x654e('0x14')][_0x654e('0x15')]===0x1f4){logger[_0x654e('0x14')](_0x654e('0x10'),_0x59b1a2,_0x4e5519[_0x654e('0x14')][_0x654e('0x16')]);return _0x4dc2d4(_0x4e5519['error'][_0x654e('0x16')]);}logger[_0x654e('0x14')]('ChatInteraction,\x20%s,\x20%s',_0x59b1a2,_0x4e5519[_0x654e('0x14')][_0x654e('0x16')]);return _0x4ccf05(_0x4e5519[_0x654e('0x14')][_0x654e('0x16')]);}else{logger['info'](_0x654e('0x10'),_0x59b1a2,_0x654e('0x11'));_0x4ccf05(_0x4e5519['result'][_0x654e('0x16')]);}})['catch'](function(_0x5f2c5e){logger['error'](_0x654e('0x10'),_0x59b1a2,_0x5f2c5e);_0x4dc2d4(_0x5f2c5e);});});}exports[_0x654e('0x17')]=function(_0x30335b){var _0x1abd05=this;return new Promise(function(_0x2ad9c6,_0x2e3e76){return db[_0x654e('0x18')][_0x654e('0x19')](_0x30335b['body'],{'raw':_0x30335b[_0x654e('0x1a')]?_0x30335b[_0x654e('0x1a')][_0x654e('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x30335b['options']?_0x30335b[_0x654e('0x1a')][_0x654e('0x1c')]||null:null,'attributes':_0x30335b[_0x654e('0x1a')]?_0x30335b['options'][_0x654e('0x1d')]||null:null,'limit':_0x30335b['options']?_0x30335b[_0x654e('0x1a')][_0x654e('0x1e')]||null:null})[_0x654e('0xe')](function(_0x4b3780){logger['info'](_0x654e('0x17'),_0x30335b);logger[_0x654e('0x12')](_0x654e('0x17'),_0x30335b,JSON[_0x654e('0x13')](_0x4b3780));_0x2ad9c6(_0x4b3780);})[_0x654e('0x1f')](function(_0x4b1fa6){logger[_0x654e('0x14')](_0x654e('0x17'),_0x4b1fa6[_0x654e('0x16')],_0x30335b);_0x2e3e76(_0x1abd05[_0x654e('0x14')](0x1f4,_0x4b1fa6[_0x654e('0x16')]));});});};exports[_0x654e('0x20')]=function(_0x456b6f){return new Promise(function(_0x564552,_0x71fea3){return db['ChatInteraction']['find']({'where':_0x456b6f['options']?_0x456b6f['options']['where']||null:null})['then'](function(_0x481ae1){if(_0x481ae1){return _0x481ae1[_0x654e('0x21')](_0x456b6f[_0x654e('0x22')]['ids'],_[_0x654e('0x23')](_0x456b6f[_0x654e('0x22')],[_0x654e('0x24'),'id'])||{});}})[_0x654e('0x25')](function(_0x1f4bba){logger['info'](_0x654e('0x26'),_0x456b6f);logger['debug']('AddTags',_0x456b6f,JSON[_0x654e('0x13')](_0x1f4bba));_0x564552(_0x1f4bba);})[_0x654e('0x1f')](function(_0x39c4ce){logger[_0x654e('0x14')](_0x654e('0x26'),_0x39c4ce[_0x654e('0x16')],_0x456b6f);_0x71fea3(_this[_0x654e('0x14')](0x1f4,_0x39c4ce[_0x654e('0x16')]));});});}; \ No newline at end of file +var _0x7188=['client','http','redis','defaults','localhost','socket.io-emitter','register','request','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','ChatInteraction','update','raw','options','where','attributes','then','UpdateChatInteraction','debug','AddTagsToChatInteraction','find','addTags','body','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x474844,_0x55708c){var _0x337851=function(_0x52350d){while(--_0x52350d){_0x474844['push'](_0x474844['shift']());}};_0x337851(++_0x55708c);}(_0x7188,0x7c));var _0x8718=function(_0x1a2049,_0x28b774){_0x1a2049=_0x1a2049-0x0;var _0x5a2d07=_0x7188[_0x1a2049];return _0x5a2d07;};'use strict';var _=require(_0x8718('0x0'));var util=require(_0x8718('0x1'));var moment=require(_0x8718('0x2'));var BPromise=require(_0x8718('0x3'));var rs=require(_0x8718('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8718('0x5'))['db'];var utils=require(_0x8718('0x6'));var logger=require(_0x8718('0x7'))(_0x8718('0x8'));var config=require(_0x8718('0x9'));var jayson=require(_0x8718('0xa'));var client=jayson[_0x8718('0xb')][_0x8718('0xc')]({'port':0x232a});config[_0x8718('0xd')]=_[_0x8718('0xe')](config['redis'],{'host':_0x8718('0xf'),'port':0x18eb});var socket=require(_0x8718('0x10'))(new Redis(config[_0x8718('0xd')]));require('./chatInteraction.socket')[_0x8718('0x11')](socket);function respondWithRpcPromise(_0xcd9a10,_0x1860a3,_0xc4a09){return new BPromise(function(_0x55b158,_0x57b3b8){return client[_0x8718('0x12')](_0xcd9a10,_0xc4a09)['then'](function(_0x391bd0){logger[_0x8718('0x13')](_0x8718('0x14'),_0x1860a3,_0x8718('0x15'));logger['debug'](_0x8718('0x16'),_0x1860a3,_0x8718('0x15'),JSON[_0x8718('0x17')](_0x391bd0));if(_0x391bd0[_0x8718('0x18')]){if(_0x391bd0[_0x8718('0x18')][_0x8718('0x19')]===0x1f4){logger[_0x8718('0x18')](_0x8718('0x14'),_0x1860a3,_0x391bd0['error']['message']);return _0x57b3b8(_0x391bd0['error'][_0x8718('0x1a')]);}logger['error']('ChatInteraction,\x20%s,\x20%s',_0x1860a3,_0x391bd0[_0x8718('0x18')][_0x8718('0x1a')]);return _0x55b158(_0x391bd0['error']['message']);}else{logger[_0x8718('0x13')](_0x8718('0x14'),_0x1860a3,'request\x20sent');_0x55b158(_0x391bd0['result'][_0x8718('0x1a')]);}})[_0x8718('0x1b')](function(_0x6f5d66){logger[_0x8718('0x18')](_0x8718('0x14'),_0x1860a3,_0x6f5d66);_0x57b3b8(_0x6f5d66);});});}exports['UpdateChatInteraction']=function(_0x3418a4){var _0x4fa849=this;return new Promise(function(_0x1d2315,_0x2235ce){return db[_0x8718('0x1c')][_0x8718('0x1d')](_0x3418a4['body'],{'raw':_0x3418a4['options']?_0x3418a4['options'][_0x8718('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3418a4[_0x8718('0x1f')]?_0x3418a4[_0x8718('0x1f')][_0x8718('0x20')]||null:null,'attributes':_0x3418a4[_0x8718('0x1f')]?_0x3418a4[_0x8718('0x1f')][_0x8718('0x21')]||null:null,'limit':_0x3418a4[_0x8718('0x1f')]?_0x3418a4['options']['limit']||null:null})[_0x8718('0x22')](function(_0x32d682){logger[_0x8718('0x13')](_0x8718('0x23'),_0x3418a4);logger[_0x8718('0x24')]('UpdateChatInteraction',_0x3418a4,JSON[_0x8718('0x17')](_0x32d682));_0x1d2315(_0x32d682);})[_0x8718('0x1b')](function(_0x487837){logger[_0x8718('0x18')](_0x8718('0x23'),_0x487837[_0x8718('0x1a')],_0x3418a4);_0x2235ce(_0x4fa849[_0x8718('0x18')](0x1f4,_0x487837[_0x8718('0x1a')]));});});};exports[_0x8718('0x25')]=function(_0x35212f){return new Promise(function(_0x348d78,_0xb1591e){return db[_0x8718('0x1c')][_0x8718('0x26')]({'where':_0x35212f[_0x8718('0x1f')]?_0x35212f['options'][_0x8718('0x20')]||null:null})[_0x8718('0x22')](function(_0xf516a5){if(_0xf516a5){return _0xf516a5[_0x8718('0x27')](_0x35212f[_0x8718('0x28')][_0x8718('0x29')],_[_0x8718('0x2a')](_0x35212f[_0x8718('0x28')],[_0x8718('0x29'),'id'])||{});}})[_0x8718('0x2b')](function(_0x22ae44){logger['info'](_0x8718('0x2c'),_0x35212f);logger[_0x8718('0x24')](_0x8718('0x2c'),_0x35212f,JSON[_0x8718('0x17')](_0x22ae44));_0x348d78(_0x22ae44);})[_0x8718('0x1b')](function(_0x3c41bc){logger['error']('AddTags',_0x3c41bc['message'],_0x35212f);_0xb1591e(_this['error'](0x1f4,_0x3c41bc[_0x8718('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index cf0494b..81df40f 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 _0x7dfc=['update','emit','removeListener','length','chatInteraction:','./chatInteraction.events','save'];(function(_0x68ee8b,_0x3cc6c5){var _0x5148f7=function(_0x5dcbd5){while(--_0x5dcbd5){_0x68ee8b['push'](_0x68ee8b['shift']());}};_0x5148f7(++_0x3cc6c5);}(_0x7dfc,0x19b));var _0xc7df=function(_0x148dff,_0x559310){_0x148dff=_0x148dff-0x0;var _0x13b7c4=_0x7dfc[_0x148dff];return _0x13b7c4;};'use strict';var ChatInteractionEvents=require(_0xc7df('0x0'));var events=[_0xc7df('0x1'),'remove',_0xc7df('0x2')];function createListener(_0x431fb9,_0xefdddd){return function(_0x153122){_0xefdddd[_0xc7df('0x3')](_0x431fb9,_0x153122);};}function removeListener(_0x1855c8,_0x17e6bc){return function(){ChatInteractionEvents[_0xc7df('0x4')](_0x1855c8,_0x17e6bc);};}exports['register']=function(_0x3ba6d3){for(var _0x343fb0=0x0,_0x288e4e=events[_0xc7df('0x5')];_0x343fb0<_0x288e4e;_0x343fb0++){var _0x2fbf63=events[_0x343fb0];var _0x491233=createListener(_0xc7df('0x6')+_0x2fbf63,_0x3ba6d3);ChatInteractionEvents['on'](_0x2fbf63,_0x491233);}}; \ No newline at end of file +var _0x91c0=['update','emit','register','length','chatInteraction:','./chatInteraction.events','save','remove'];(function(_0x46bc65,_0x566039){var _0x122852=function(_0x13fa53){while(--_0x13fa53){_0x46bc65['push'](_0x46bc65['shift']());}};_0x122852(++_0x566039);}(_0x91c0,0xdd));var _0x091c=function(_0x1d0076,_0x569412){_0x1d0076=_0x1d0076-0x0;var _0x1771fd=_0x91c0[_0x1d0076];return _0x1771fd;};'use strict';var ChatInteractionEvents=require(_0x091c('0x0'));var events=[_0x091c('0x1'),_0x091c('0x2'),_0x091c('0x3')];function createListener(_0x24300a,_0x3d4954){return function(_0xb8094f){_0x3d4954[_0x091c('0x4')](_0x24300a,_0xb8094f);};}function removeListener(_0x261995,_0x1e796a){return function(){ChatInteractionEvents['removeListener'](_0x261995,_0x1e796a);};}exports[_0x091c('0x5')]=function(_0x1201d0){for(var _0x15b06a=0x0,_0x13aad4=events[_0x091c('0x6')];_0x15b06a<_0x13aad4;_0x15b06a++){var _0x300ac3=events[_0x15b06a];var _0x37ba90=createListener(_0x091c('0x7')+_0x300ac3,_0x1201d0);ChatInteractionEvents['on'](_0x300ac3,_0x37ba90);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 84602d9..c1d5f76 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 _0x6680=['multer','util','path','connect-timeout','Router','fs-extra','../../config/environment','./chatInteraction.controller','get','isAuthenticated','/describe','describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','/:id/messages','getMessages','getMyMessages','/:id/download','post','create','createVidaooSession','diskStorage','root','format','%s-%s','now','originalname','replace','/:id/attachment_upload','single','attachmentUpload','tracked','chat','addTags','put','chatinteraction:update','update','/:id/abandon','abandon','/:id/close','close','delete','chatinteraction:destroy','destroy','removeTags','exports'];(function(_0x47017a,_0x415c09){var _0x5d4a0c=function(_0x5df187){while(--_0x5df187){_0x47017a['push'](_0x47017a['shift']());}};_0x5d4a0c(++_0x415c09);}(_0x6680,0xc0));var _0x0668=function(_0x50521f,_0x4375b3){_0x50521f=_0x50521f-0x0;var _0x29b4be=_0x6680[_0x50521f];return _0x29b4be;};'use strict';var multer=require(_0x0668('0x0'));var util=require(_0x0668('0x1'));var path=require(_0x0668('0x2'));var timeout=require(_0x0668('0x3'));var express=require('express');var router=express[_0x0668('0x4')]();var fs_extra=require(_0x0668('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0668('0x6'));var controller=require(_0x0668('0x7'));router[_0x0668('0x8')]('/',auth[_0x0668('0x9')](),controller['index']);router[_0x0668('0x8')](_0x0668('0xa'),auth['isAuthenticated'](),controller[_0x0668('0xb')]);router[_0x0668('0x8')](_0x0668('0xc'),auth[_0x0668('0xd')](),controller[_0x0668('0xe')]);router[_0x0668('0x8')](_0x0668('0xf'),auth['isChatInteractionAuthorized'](),controller['attachmentDownload']);router['get'](_0x0668('0x10'),auth[_0x0668('0x9')](),controller[_0x0668('0x11')]);router[_0x0668('0x8')]('/:id/my_messages',auth['isChatInteractionAuthorized'](),controller[_0x0668('0x12')]);router[_0x0668('0x8')](_0x0668('0x13'),auth[_0x0668('0x9')](),controller['download']);router[_0x0668('0x14')]('/',auth['isAuthenticated'](),controller[_0x0668('0x15')]);router['post']('/:id/vidaoo',auth[_0x0668('0x9')](),controller[_0x0668('0x16')]);var upload=multer({'storage':multer[_0x0668('0x17')]({'destination':function(_0x365a9a,_0x27b40b,_0x24f85d){_0x24f85d(null,path['join'](config[_0x0668('0x18')],'server/files/attachments/'));},'filename':function(_0x94f189,_0x41239d,_0x547751){_0x547751(null,util[_0x0668('0x19')](_0x0668('0x1a'),Date[_0x0668('0x1b')](),_0x41239d[_0x0668('0x1c')][_0x0668('0x1d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0x0668('0x1e'),upload[_0x0668('0x1f')]('file'),controller[_0x0668('0x20')]);router[_0x0668('0x14')](_0x0668('0x10'),auth[_0x0668('0xd')](),controller['addMessage']);router[_0x0668('0x14')]('/:id/tags',auth[_0x0668('0x9')](),interaction[_0x0668('0x21')](_0x0668('0x22'),'chatinteraction:addtags'),controller[_0x0668('0x23')]);router[_0x0668('0x24')](_0x0668('0xc'),auth[_0x0668('0x9')](),interaction[_0x0668('0x21')](_0x0668('0x22'),_0x0668('0x25')),controller[_0x0668('0x26')]);router[_0x0668('0x24')]('/:id/custom_update',controller['customUpdate']);router[_0x0668('0x24')](_0x0668('0x27'),auth[_0x0668('0xd')](),controller[_0x0668('0x28')]);router['put'](_0x0668('0x29'),controller[_0x0668('0x2a')]);router[_0x0668('0x2b')](_0x0668('0xc'),auth[_0x0668('0x9')](),interaction[_0x0668('0x21')]('chat',_0x0668('0x2c')),controller[_0x0668('0x2d')]);router[_0x0668('0x2b')]('/:id/tags',auth[_0x0668('0x9')](),controller[_0x0668('0x2e')]);module[_0x0668('0x2f')]=router; \ No newline at end of file +var _0x2910=['destroy','removeTags','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','isAuthenticated','index','get','describe','/:id','isChatInteractionAuthorized','show','attachmentDownload','getMessages','getMyMessages','create','post','/:id/vidaoo','createVidaooSession','diskStorage','join','root','format','now','originalname','replace','/:id/attachment_upload','single','file','attachmentUpload','addMessage','chat','chatinteraction:addtags','put','chatinteraction:update','update','customUpdate','abandon','/:id/close','close','delete','tracked','chatinteraction:destroy'];(function(_0xfb2c6b,_0x3860bd){var _0x3643f0=function(_0xf84863){while(--_0xf84863){_0xfb2c6b['push'](_0xfb2c6b['shift']());}};_0x3643f0(++_0x3860bd);}(_0x2910,0xc6));var _0x0291=function(_0x35344a,_0x1790b6){_0x35344a=_0x35344a-0x0;var _0x285085=_0x2910[_0x35344a];return _0x285085;};'use strict';var multer=require(_0x0291('0x0'));var util=require(_0x0291('0x1'));var path=require('path');var timeout=require(_0x0291('0x2'));var express=require(_0x0291('0x3'));var router=express['Router']();var fs_extra=require(_0x0291('0x4'));var auth=require(_0x0291('0x5'));var interaction=require(_0x0291('0x6'));var config=require(_0x0291('0x7'));var controller=require(_0x0291('0x8'));router['get']('/',auth[_0x0291('0x9')](),controller[_0x0291('0xa')]);router[_0x0291('0xb')]('/describe',auth[_0x0291('0x9')](),controller[_0x0291('0xc')]);router[_0x0291('0xb')](_0x0291('0xd'),auth[_0x0291('0xe')](),controller[_0x0291('0xf')]);router['get']('/:id/attachment_download',auth[_0x0291('0xe')](),controller[_0x0291('0x10')]);router[_0x0291('0xb')]('/:id/messages',auth['isAuthenticated'](),controller[_0x0291('0x11')]);router[_0x0291('0xb')]('/:id/my_messages',auth['isChatInteractionAuthorized'](),controller[_0x0291('0x12')]);router[_0x0291('0xb')]('/:id/download',auth[_0x0291('0x9')](),controller['download']);router['post']('/',auth[_0x0291('0x9')](),controller[_0x0291('0x13')]);router[_0x0291('0x14')](_0x0291('0x15'),auth[_0x0291('0x9')](),controller[_0x0291('0x16')]);var upload=multer({'storage':multer[_0x0291('0x17')]({'destination':function(_0x14ec35,_0x4e9986,_0x31dfa9){_0x31dfa9(null,path[_0x0291('0x18')](config[_0x0291('0x19')],'server/files/attachments/'));},'filename':function(_0x286d6e,_0x263d1b,_0x5ad59e){_0x5ad59e(null,util[_0x0291('0x1a')]('%s-%s',Date[_0x0291('0x1b')](),_0x263d1b[_0x0291('0x1c')][_0x0291('0x1d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0x0291('0x1e'),upload[_0x0291('0x1f')](_0x0291('0x20')),controller[_0x0291('0x21')]);router[_0x0291('0x14')]('/:id/messages',auth[_0x0291('0xe')](),controller[_0x0291('0x22')]);router['post']('/:id/tags',auth[_0x0291('0x9')](),interaction['tracked'](_0x0291('0x23'),_0x0291('0x24')),controller['addTags']);router[_0x0291('0x25')](_0x0291('0xd'),auth[_0x0291('0x9')](),interaction['tracked'](_0x0291('0x23'),_0x0291('0x26')),controller[_0x0291('0x27')]);router[_0x0291('0x25')]('/:id/custom_update',controller[_0x0291('0x28')]);router[_0x0291('0x25')]('/:id/abandon',auth[_0x0291('0xe')](),controller[_0x0291('0x29')]);router[_0x0291('0x25')](_0x0291('0x2a'),controller[_0x0291('0x2b')]);router[_0x0291('0x2c')](_0x0291('0xd'),auth[_0x0291('0x9')](),interaction[_0x0291('0x2d')](_0x0291('0x23'),_0x0291('0x2e')),controller[_0x0291('0x2f')]);router['delete']('/:id/tags',auth['isAuthenticated'](),controller[_0x0291('0x30')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index a7a2c16..6ac660b 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 _0xe738=['exports','TEXT','BOOLEAN','INTEGER','sequelize'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xe738,0x1a8));var _0x8e73=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0xe738[_0xaa1b3e];return _0x454d7d;};'use strict';var Sequelize=require(_0x8e73('0x0'));module[_0x8e73('0x1')]={'body':{'type':Sequelize[_0x8e73('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x8e73('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x8e73('0x4')]}}; \ No newline at end of file +var _0x7e17=['TEXT','medium','BOOLEAN','INTEGER','sequelize','exports'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x7e17,0xd0));var _0x77e1=function(_0x38af13,_0x3949a1){_0x38af13=_0x38af13-0x0;var _0x56a221=_0x7e17[_0x38af13];return _0x56a221;};'use strict';var Sequelize=require(_0x77e1('0x0'));module[_0x77e1('0x1')]={'body':{'type':Sequelize[_0x77e1('0x2')](_0x77e1('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x77e1('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x77e1('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 83b7c71..3e3b77c 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 _0xf6b9=['ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','offset','limit','undefined','count','status','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','fieldName','type','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','ChatInternalMessage','includeAll','include','rows','catch','show','params','rawAttributes','merge','find','create','body','describe','get','messages','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','findAll','agent','admin','user','fullname','role','userpic','online','lastLoginAt','showWebBar','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','autoAssociation','UserProfileResource','isEmpty','resourceId','push','FromId','ToId','read','-createdAt','all','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','jsforce','desk.js','querystring'];(function(_0x182c0b,_0x42fdcc){var _0x21e6e8=function(_0x1069b8){while(--_0x1069b8){_0x182c0b['push'](_0x182c0b['shift']());}};_0x21e6e8(++_0x42fdcc);}(_0xf6b9,0xd7));var _0x9f6b=function(_0x3d8291,_0x560e85){_0x3d8291=_0x3d8291-0x0;var _0x2bad5c=_0xf6b9[_0x3d8291];return _0x2bad5c;};'use strict';var emlformat=require(_0x9f6b('0x0'));var rimraf=require(_0x9f6b('0x1'));var zipdir=require(_0x9f6b('0x2'));var jsonpatch=require(_0x9f6b('0x3'));var rp=require(_0x9f6b('0x4'));var moment=require('moment');var BPromise=require(_0x9f6b('0x5'));var Mustache=require(_0x9f6b('0x6'));var util=require(_0x9f6b('0x7'));var path=require(_0x9f6b('0x8'));var sox=require(_0x9f6b('0x9'));var csv=require('to-csv');var ejs=require(_0x9f6b('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9f6b('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9f6b('0xc'));var deskjs=require(_0x9f6b('0xd'));var toCsv=require('to-csv');var querystring=require(_0x9f6b('0xe'));var Papa=require('papaparse');var Redis=require(_0x9f6b('0xf'));var authService=require(_0x9f6b('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x9f6b('0x11'));var hardwareService=require(_0x9f6b('0x12'));var logger=require(_0x9f6b('0x13'))(_0x9f6b('0x14'));var utils=require(_0x9f6b('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x9f6b('0x16'));var db=require(_0x9f6b('0x17'))['db'];config[_0x9f6b('0x18')]=_[_0x9f6b('0x19')](config[_0x9f6b('0x18')],{'host':_0x9f6b('0x1a'),'port':0x18eb});var socket=require(_0x9f6b('0x1b'))(new Redis(config['redis']));require('./chatInternalMessage.socket')[_0x9f6b('0x1c')](socket);function respondWithStatusCode(_0x3b2190,_0x400fe2){_0x400fe2=_0x400fe2||0xcc;return function(_0x2f62ec){if(_0x2f62ec){return _0x3b2190[_0x9f6b('0x1d')](_0x400fe2);}return _0x3b2190['status'](_0x400fe2)[_0x9f6b('0x1e')]();};}function respondWithResult(_0x4c7187,_0x3c4c09){_0x3c4c09=_0x3c4c09||0xc8;return function(_0x53f7fc){if(_0x53f7fc){return _0x4c7187['status'](_0x3c4c09)['json'](_0x53f7fc);}};}function respondWithFilteredResult(_0x4ea2a6,_0xe3c9a0){return function(_0x3757d9){if(_0x3757d9){var _0x1e93ed=typeof _0xe3c9a0[_0x9f6b('0x1f')]==='undefined'&&typeof _0xe3c9a0[_0x9f6b('0x20')]===_0x9f6b('0x21');var _0x508e44=_0x3757d9[_0x9f6b('0x22')];var _0x1a92ca=_0x1e93ed?0x0:_0xe3c9a0[_0x9f6b('0x1f')];var _0x2dcf4c=_0x1e93ed?_0x3757d9[_0x9f6b('0x22')]:_0xe3c9a0[_0x9f6b('0x1f')]+_0xe3c9a0[_0x9f6b('0x20')];var _0x47860f;if(_0x2dcf4c>=_0x508e44){_0x2dcf4c=_0x508e44;_0x47860f=0xc8;}else{_0x47860f=0xce;}_0x4ea2a6[_0x9f6b('0x23')](_0x47860f);return _0x4ea2a6[_0x9f6b('0x24')](_0x9f6b('0x25'),_0x1a92ca+'-'+_0x2dcf4c+'/'+_0x508e44)['json'](_0x3757d9);}return null;};}function patchUpdates(_0x56c60d){return function(_0x2a05ab){try{jsonpatch[_0x9f6b('0x26')](_0x2a05ab,_0x56c60d,!![]);}catch(_0xb432a9){return BPromise[_0x9f6b('0x27')](_0xb432a9);}return _0x2a05ab[_0x9f6b('0x28')]();};}function saveUpdates(_0x106194,_0x4d1a6a){return function(_0x735768){if(_0x735768){return _0x735768[_0x9f6b('0x29')](_0x106194)[_0x9f6b('0x2a')](function(_0x53904c){return _0x53904c;});}return null;};}function removeEntity(_0x514dab,_0x3d8eb4){return function(_0x45ebc1){if(_0x45ebc1){return _0x45ebc1[_0x9f6b('0x2b')]()[_0x9f6b('0x2a')](function(){_0x514dab['status'](0xcc)[_0x9f6b('0x1e')]();});}};}function handleEntityNotFound(_0x39cc6c,_0xd2471a){return function(_0x264a55){if(!_0x264a55){_0x39cc6c[_0x9f6b('0x1d')](0x194);}return _0x264a55;};}function handleError(_0x28734e,_0x491625){_0x491625=_0x491625||0x1f4;return function(_0x3eae10){logger[_0x9f6b('0x2c')](_0x3eae10[_0x9f6b('0x2d')]);if(_0x3eae10['name']){delete _0x3eae10[_0x9f6b('0x2e')];}_0x28734e[_0x9f6b('0x23')](_0x491625)[_0x9f6b('0x2f')](_0x3eae10);};}exports[_0x9f6b('0x30')]=function(_0x14e615,_0x4c8545){var _0x2ab7e6={},_0x2c5674={},_0x21f07d={'count':0x0,'rows':[]};var _0x103c30=_[_0x9f6b('0x31')](db['ChatInternalMessage']['rawAttributes'],function(_0x36ac8a){return{'name':_0x36ac8a[_0x9f6b('0x32')],'type':_0x36ac8a[_0x9f6b('0x33')]['key']};});_0x2c5674[_0x9f6b('0x34')]=_[_0x9f6b('0x31')](_0x103c30,_0x9f6b('0x2e'));_0x2c5674['query']=_[_0x9f6b('0x35')](_0x14e615[_0x9f6b('0x36')]);_0x2c5674[_0x9f6b('0x37')]=_['intersection'](_0x2c5674[_0x9f6b('0x34')],_0x2c5674[_0x9f6b('0x36')]);_0x2ab7e6[_0x9f6b('0x38')]=_[_0x9f6b('0x39')](_0x2c5674[_0x9f6b('0x34')],qs[_0x9f6b('0x3a')](_0x14e615[_0x9f6b('0x36')][_0x9f6b('0x3a')]));_0x2ab7e6[_0x9f6b('0x38')]=_0x2ab7e6[_0x9f6b('0x38')][_0x9f6b('0x3b')]?_0x2ab7e6[_0x9f6b('0x38')]:_0x2c5674[_0x9f6b('0x34')];if(!_0x14e615[_0x9f6b('0x36')][_0x9f6b('0x3c')](_0x9f6b('0x3d'))){_0x2ab7e6['limit']=qs[_0x9f6b('0x20')](_0x14e615['query'][_0x9f6b('0x20')]);_0x2ab7e6[_0x9f6b('0x1f')]=qs['offset'](_0x14e615['query'][_0x9f6b('0x1f')]);}_0x2ab7e6[_0x9f6b('0x3e')]=qs[_0x9f6b('0x3f')](_0x14e615[_0x9f6b('0x36')][_0x9f6b('0x3f')]);_0x2ab7e6[_0x9f6b('0x40')]=qs[_0x9f6b('0x37')](_[_0x9f6b('0x41')](_0x14e615['query'],_0x2c5674[_0x9f6b('0x37')]),_0x103c30);if(_0x14e615[_0x9f6b('0x36')][_0x9f6b('0x42')]){_0x2ab7e6[_0x9f6b('0x40')]=_['merge'](_0x2ab7e6['where'],{'$or':_[_0x9f6b('0x31')](_0x103c30,function(_0x583a6f){if(_0x583a6f[_0x9f6b('0x33')]!==_0x9f6b('0x43')){var _0x262cde={};_0x262cde[_0x583a6f[_0x9f6b('0x2e')]]={'$like':'%'+_0x14e615[_0x9f6b('0x36')][_0x9f6b('0x42')]+'%'};return _0x262cde;}})});}_0x2ab7e6=_['merge']({},_0x2ab7e6,_0x14e615[_0x9f6b('0x44')]);var _0x24844b={'where':_0x2ab7e6[_0x9f6b('0x40')]};return db[_0x9f6b('0x45')][_0x9f6b('0x22')](_0x24844b)[_0x9f6b('0x2a')](function(_0x4a034c){_0x21f07d['count']=_0x4a034c;if(_0x14e615[_0x9f6b('0x36')][_0x9f6b('0x46')]){_0x2ab7e6[_0x9f6b('0x47')]=[{'all':!![]}];}return db[_0x9f6b('0x45')]['findAll'](_0x2ab7e6);})[_0x9f6b('0x2a')](function(_0x3090c5){_0x21f07d[_0x9f6b('0x48')]=_0x3090c5;return _0x21f07d;})['then'](respondWithFilteredResult(_0x4c8545,_0x2ab7e6))[_0x9f6b('0x49')](handleError(_0x4c8545,null));};exports[_0x9f6b('0x4a')]=function(_0x4b41bb,_0x190893){var _0x265158={'raw':!![],'where':{'id':_0x4b41bb[_0x9f6b('0x4b')]['id']}},_0x167b7e={};_0x167b7e[_0x9f6b('0x34')]=_[_0x9f6b('0x35')](db['ChatInternalMessage'][_0x9f6b('0x4c')]);_0x167b7e[_0x9f6b('0x36')]=_[_0x9f6b('0x35')](_0x4b41bb[_0x9f6b('0x36')]);_0x167b7e[_0x9f6b('0x37')]=_['intersection'](_0x167b7e['model'],_0x167b7e['query']);_0x265158[_0x9f6b('0x38')]=_[_0x9f6b('0x39')](_0x167b7e[_0x9f6b('0x34')],qs['fields'](_0x4b41bb[_0x9f6b('0x36')]['fields']));_0x265158[_0x9f6b('0x38')]=_0x265158[_0x9f6b('0x38')][_0x9f6b('0x3b')]?_0x265158[_0x9f6b('0x38')]:_0x167b7e[_0x9f6b('0x34')];if(_0x4b41bb[_0x9f6b('0x36')][_0x9f6b('0x46')]){_0x265158[_0x9f6b('0x47')]=[{'all':!![]}];}_0x265158=_[_0x9f6b('0x4d')]({},_0x265158,_0x4b41bb[_0x9f6b('0x44')]);return db[_0x9f6b('0x45')][_0x9f6b('0x4e')](_0x265158)['then'](handleEntityNotFound(_0x190893,null))[_0x9f6b('0x2a')](respondWithResult(_0x190893,null))[_0x9f6b('0x49')](handleError(_0x190893,null));};exports[_0x9f6b('0x4f')]=function(_0x55e5bd,_0x3f39bb){return db[_0x9f6b('0x45')][_0x9f6b('0x4f')](_0x55e5bd['body'],{})['then'](respondWithResult(_0x3f39bb,0xc9))[_0x9f6b('0x49')](handleError(_0x3f39bb,null));};exports['update']=function(_0xf1b59,_0x58754b){if(_0xf1b59[_0x9f6b('0x50')]['id']){delete _0xf1b59[_0x9f6b('0x50')]['id'];}return db['ChatInternalMessage'][_0x9f6b('0x4e')]({'where':{'id':_0xf1b59['params']['id']}})[_0x9f6b('0x2a')](handleEntityNotFound(_0x58754b,null))[_0x9f6b('0x2a')](saveUpdates(_0xf1b59['body'],null))['then'](respondWithResult(_0x58754b,null))[_0x9f6b('0x49')](handleError(_0x58754b,null));};exports[_0x9f6b('0x2b')]=function(_0x3468c7,_0x413f8e){return db[_0x9f6b('0x45')]['find']({'where':{'id':_0x3468c7['params']['id']}})[_0x9f6b('0x2a')](handleEntityNotFound(_0x413f8e,null))[_0x9f6b('0x2a')](removeEntity(_0x413f8e,null))[_0x9f6b('0x49')](handleError(_0x413f8e,null));};exports['describe']=function(_0x3086bd,_0x3fb2d6){return db[_0x9f6b('0x45')][_0x9f6b('0x51')]()[_0x9f6b('0x2a')](respondWithResult(_0x3fb2d6,null))['catch'](handleError(_0x3fb2d6,null));};function wrapUser(_0x505f8c){return function(_0x57a516){var _0x589d48=_0x505f8c[_0x9f6b('0x52')]({'plain':!![]});_0x589d48[_0x9f6b('0x53')]=[];if(_0x57a516){_0x589d48['lastMessageAt']=_0x57a516[_0x9f6b('0x54')];_0x589d48[_0x9f6b('0x55')]=_0x57a516;}else{_0x589d48['lastMessageAt']=moment(0x0)[_0x9f6b('0x56')](_0x9f6b('0x57'));_0x589d48[_0x9f6b('0x55')]={};}return _0x589d48;};}exports[_0x9f6b('0x58')]=function(_0x4dd7cd,_0x4203cf,_0x48b86f){var _0x118f6f=[];return db[_0x9f6b('0x59')][_0x9f6b('0x5a')]({'where':{'role':[_0x9f6b('0x5b'),_0x9f6b('0x5c'),_0x9f6b('0x5d')]},'attributes':['id',_0x9f6b('0x5e'),'name',_0x9f6b('0x5f'),_0x9f6b('0x60'),'internal',_0x9f6b('0x61'),_0x9f6b('0x62'),'allowmessenger',_0x9f6b('0x63')],'order':qs[_0x9f6b('0x3f')]('-online'),'include':[{'model':db[_0x9f6b('0x64')],'as':_0x9f6b('0x65'),'attributes':['id',_0x9f6b('0x2e'),_0x9f6b('0x33')],'through':{'attributes':[]}}]})[_0x9f6b('0x2a')](function(_0x50c92d){if(_0x50c92d){var _0x361c06=_0x4dd7cd[_0x9f6b('0x5d')][_0x9f6b('0x52')]({'plain':!![]});if(!_0x361c06)throw new Error(_0x9f6b('0x66'));if(_0x361c06[_0x9f6b('0x5f')]==='user'){return db[_0x9f6b('0x67')][_0x9f6b('0x4e')]({'where':{'name':_0x9f6b('0x68'),'userProfileId':_0x361c06['userProfileId']},'raw':!![]})[_0x9f6b('0x2a')](function(_0x2d7c4b){if(_0x2d7c4b){if(_0x2d7c4b[_0x9f6b('0x69')]===0x0){return db[_0x9f6b('0x6a')]['findAll']({'where':{'sectionId':_0x2d7c4b['id']},'raw':!![]})[_0x9f6b('0x2a')](function(_0x25740c){var _0x2dd64c=[];if(_[_0x9f6b('0x6b')](_0x25740c)){_0x2dd64c=_['filter'](_0x50c92d,function(_0x2034b1){if(_0x2034b1[_0x9f6b('0x5f')]!==_0x9f6b('0x5b')){return _0x2034b1;}});return _0x2dd64c;}else{for(var _0x25d44a=0x0;_0x25d44a<_0x50c92d[_0x9f6b('0x3b')];_0x25d44a++){var _0x4dfe1f=_0x50c92d[_0x25d44a];if(_0x4dfe1f[_0x9f6b('0x5f')]===_0x9f6b('0x5b')){var _0xb5e46a=_[_0x9f6b('0x4e')](_0x25740c,function(_0x40b2e7){return _0x40b2e7[_0x9f6b('0x6c')]===_0x4dfe1f['id'];});if(_0xb5e46a)_0x2dd64c['push'](_0x4dfe1f);}else{_0x2dd64c[_0x9f6b('0x6d')](_0x4dfe1f);}}return _0x2dd64c;}});}else{return _0x50c92d;}}else{var _0x3f06de=_[_0x9f6b('0x42')](_0x50c92d,function(_0x2f438c){if(_0x2f438c[_0x9f6b('0x5f')]!==_0x9f6b('0x5b')){return _0x2f438c;}});return _0x3f06de;}});}else{return _0x50c92d;}}})[_0x9f6b('0x2a')](function(_0x1c32e0){var _0x189593=[];if(_0x1c32e0){_0x118f6f=_0x1c32e0;for(var _0x175092=0x0;_0x175092<_0x1c32e0[_0x9f6b('0x3b')];_0x175092+=0x1){_0x118f6f[_0x175092][_0x9f6b('0x53')]=[];_0x189593[_0x9f6b('0x6d')](db[_0x9f6b('0x45')][_0x9f6b('0x4e')]({'where':{'FromId':[_0x4dd7cd['user']['id'],_0x1c32e0[_0x175092]['id']],'ToId':[_0x4dd7cd[_0x9f6b('0x5d')]['id'],_0x1c32e0[_0x175092]['id']],'ChatGroupId':null},'attributes':['id','createdAt',_0x9f6b('0x6e'),_0x9f6b('0x6f'),_0x9f6b('0x70'),_0x9f6b('0x50')],'order':qs[_0x9f6b('0x3f')](_0x9f6b('0x71')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x9f6b('0x2a')](wrapUser(_0x1c32e0[_0x175092])));}return BPromise[_0x9f6b('0x72')](_0x189593);}return[];})[_0x9f6b('0x2a')](function(_0x19b5b3){return{'rows':_0x19b5b3,'count':_0x19b5b3[_0x9f6b('0x3b')]};})[_0x9f6b('0x2a')](respondWithResult(_0x4203cf,null))[_0x9f6b('0x49')](handleError(_0x4203cf,null));}; \ No newline at end of file +var _0x058f=['fs-extra','lodash','desk.js','querystring','../../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','./chatInternalMessage.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','query','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','options','ChatInternalMessage','includeAll','include','findAll','catch','show','params','keys','create','body','find','describe','get','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','agent','user','fullname','role','userpic','online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueues','UserProfileSection','autoAssociation','UserProfileResource','isEmpty','resourceId','push','messages','ToId','read','all','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','to-csv','ejs'];(function(_0x294e81,_0x6d4abe){var _0x5a3370=function(_0x66d337){while(--_0x66d337){_0x294e81['push'](_0x294e81['shift']());}};_0x5a3370(++_0x6d4abe);}(_0x058f,0x1a2));var _0xf058=function(_0x4b7cfb,_0x11d2b8){_0x4b7cfb=_0x4b7cfb-0x0;var _0x54b50a=_0x058f[_0x4b7cfb];return _0x54b50a;};'use strict';var emlformat=require(_0xf058('0x0'));var rimraf=require(_0xf058('0x1'));var zipdir=require(_0xf058('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf058('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf058('0x4'));var util=require(_0xf058('0x5'));var path=require(_0xf058('0x6'));var sox=require(_0xf058('0x7'));var csv=require(_0xf058('0x8'));var ejs=require(_0xf058('0x9'));var fs=require('fs');var fs_extra=require(_0xf058('0xa'));var _=require(_0xf058('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf058('0xc'));var toCsv=require(_0xf058('0x8'));var querystring=require(_0xf058('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xf058('0xe'));var as=require(_0xf058('0xf'));var hardwareService=require(_0xf058('0x10'));var logger=require(_0xf058('0x11'))('api');var utils=require(_0xf058('0x12'));var config=require(_0xf058('0x13'));var licenseUtil=require(_0xf058('0x14'));var db=require(_0xf058('0x15'))['db'];config[_0xf058('0x16')]=_[_0xf058('0x17')](config[_0xf058('0x16')],{'host':_0xf058('0x18'),'port':0x18eb});var socket=require(_0xf058('0x19'))(new Redis(config['redis']));require(_0xf058('0x1a'))[_0xf058('0x1b')](socket);function respondWithStatusCode(_0x51d469,_0xdaa896){_0xdaa896=_0xdaa896||0xcc;return function(_0x639cdc){if(_0x639cdc){return _0x51d469[_0xf058('0x1c')](_0xdaa896);}return _0x51d469[_0xf058('0x1d')](_0xdaa896)[_0xf058('0x1e')]();};}function respondWithResult(_0x162812,_0x233d0a){_0x233d0a=_0x233d0a||0xc8;return function(_0x1ebc78){if(_0x1ebc78){return _0x162812[_0xf058('0x1d')](_0x233d0a)[_0xf058('0x1f')](_0x1ebc78);}};}function respondWithFilteredResult(_0xbe10e7,_0x2f5f0e){return function(_0x37d3f7){if(_0x37d3f7){var _0x104d88=typeof _0x2f5f0e[_0xf058('0x20')]===_0xf058('0x21')&&typeof _0x2f5f0e[_0xf058('0x22')]===_0xf058('0x21');var _0x5e402a=_0x37d3f7[_0xf058('0x23')];var _0x28d78d=_0x104d88?0x0:_0x2f5f0e[_0xf058('0x20')];var _0x25fa19=_0x104d88?_0x37d3f7[_0xf058('0x23')]:_0x2f5f0e['offset']+_0x2f5f0e[_0xf058('0x22')];var _0x1336bb;if(_0x25fa19>=_0x5e402a){_0x25fa19=_0x5e402a;_0x1336bb=0xc8;}else{_0x1336bb=0xce;}_0xbe10e7[_0xf058('0x1d')](_0x1336bb);return _0xbe10e7[_0xf058('0x24')](_0xf058('0x25'),_0x28d78d+'-'+_0x25fa19+'/'+_0x5e402a)[_0xf058('0x1f')](_0x37d3f7);}return null;};}function patchUpdates(_0x307740){return function(_0x5c9b1d){try{jsonpatch[_0xf058('0x26')](_0x5c9b1d,_0x307740,!![]);}catch(_0x357806){return BPromise['reject'](_0x357806);}return _0x5c9b1d[_0xf058('0x27')]();};}function saveUpdates(_0x45fa44,_0x589f07){return function(_0x33f16c){if(_0x33f16c){return _0x33f16c[_0xf058('0x28')](_0x45fa44)[_0xf058('0x29')](function(_0x2060b8){return _0x2060b8;});}return null;};}function removeEntity(_0x5428a9,_0x1bd3d9){return function(_0x57764e){if(_0x57764e){return _0x57764e[_0xf058('0x2a')]()[_0xf058('0x29')](function(){_0x5428a9[_0xf058('0x1d')](0xcc)[_0xf058('0x1e')]();});}};}function handleEntityNotFound(_0x5d53fc,_0x412828){return function(_0x3ae52b){if(!_0x3ae52b){_0x5d53fc[_0xf058('0x1c')](0x194);}return _0x3ae52b;};}function handleError(_0x91c16f,_0x19fa61){_0x19fa61=_0x19fa61||0x1f4;return function(_0x14cf7e){logger[_0xf058('0x2b')](_0x14cf7e[_0xf058('0x2c')]);if(_0x14cf7e[_0xf058('0x2d')]){delete _0x14cf7e[_0xf058('0x2d')];}_0x91c16f[_0xf058('0x1d')](_0x19fa61)[_0xf058('0x2e')](_0x14cf7e);};}exports['index']=function(_0x188a85,_0x551124){var _0x44177c={},_0xe3e846={},_0x21866d={'count':0x0,'rows':[]};var _0x1cff53=_[_0xf058('0x2f')](db['ChatInternalMessage'][_0xf058('0x30')],function(_0x272ab7){return{'name':_0x272ab7[_0xf058('0x31')],'type':_0x272ab7[_0xf058('0x32')][_0xf058('0x33')]};});_0xe3e846['model']=_[_0xf058('0x2f')](_0x1cff53,_0xf058('0x2d'));_0xe3e846[_0xf058('0x34')]=_['keys'](_0x188a85[_0xf058('0x34')]);_0xe3e846['filters']=_[_0xf058('0x35')](_0xe3e846[_0xf058('0x36')],_0xe3e846[_0xf058('0x34')]);_0x44177c[_0xf058('0x37')]=_[_0xf058('0x35')](_0xe3e846['model'],qs[_0xf058('0x38')](_0x188a85['query'][_0xf058('0x38')]));_0x44177c[_0xf058('0x37')]=_0x44177c[_0xf058('0x37')][_0xf058('0x39')]?_0x44177c[_0xf058('0x37')]:_0xe3e846[_0xf058('0x36')];if(!_0x188a85[_0xf058('0x34')][_0xf058('0x3a')]('nolimit')){_0x44177c[_0xf058('0x22')]=qs[_0xf058('0x22')](_0x188a85[_0xf058('0x34')][_0xf058('0x22')]);_0x44177c[_0xf058('0x20')]=qs[_0xf058('0x20')](_0x188a85[_0xf058('0x34')][_0xf058('0x20')]);}_0x44177c[_0xf058('0x3b')]=qs[_0xf058('0x3c')](_0x188a85['query'][_0xf058('0x3c')]);_0x44177c[_0xf058('0x3d')]=qs[_0xf058('0x3e')](_[_0xf058('0x3f')](_0x188a85['query'],_0xe3e846[_0xf058('0x3e')]),_0x1cff53);if(_0x188a85[_0xf058('0x34')][_0xf058('0x40')]){_0x44177c[_0xf058('0x3d')]=_[_0xf058('0x41')](_0x44177c['where'],{'$or':_['map'](_0x1cff53,function(_0x287b8f){if(_0x287b8f[_0xf058('0x32')]!=='VIRTUAL'){var _0x290989={};_0x290989[_0x287b8f[_0xf058('0x2d')]]={'$like':'%'+_0x188a85[_0xf058('0x34')][_0xf058('0x40')]+'%'};return _0x290989;}})});}_0x44177c=_[_0xf058('0x41')]({},_0x44177c,_0x188a85[_0xf058('0x42')]);var _0x4d7b6a={'where':_0x44177c[_0xf058('0x3d')]};return db[_0xf058('0x43')][_0xf058('0x23')](_0x4d7b6a)[_0xf058('0x29')](function(_0x12dde8){_0x21866d[_0xf058('0x23')]=_0x12dde8;if(_0x188a85[_0xf058('0x34')][_0xf058('0x44')]){_0x44177c[_0xf058('0x45')]=[{'all':!![]}];}return db[_0xf058('0x43')][_0xf058('0x46')](_0x44177c);})[_0xf058('0x29')](function(_0x101665){_0x21866d['rows']=_0x101665;return _0x21866d;})[_0xf058('0x29')](respondWithFilteredResult(_0x551124,_0x44177c))[_0xf058('0x47')](handleError(_0x551124,null));};exports[_0xf058('0x48')]=function(_0x187847,_0x3f6755){var _0x4c3b9b={'raw':!![],'where':{'id':_0x187847[_0xf058('0x49')]['id']}},_0x54fb69={};_0x54fb69[_0xf058('0x36')]=_[_0xf058('0x4a')](db[_0xf058('0x43')][_0xf058('0x30')]);_0x54fb69[_0xf058('0x34')]=_[_0xf058('0x4a')](_0x187847['query']);_0x54fb69['filters']=_['intersection'](_0x54fb69[_0xf058('0x36')],_0x54fb69[_0xf058('0x34')]);_0x4c3b9b[_0xf058('0x37')]=_['intersection'](_0x54fb69['model'],qs[_0xf058('0x38')](_0x187847[_0xf058('0x34')][_0xf058('0x38')]));_0x4c3b9b[_0xf058('0x37')]=_0x4c3b9b[_0xf058('0x37')][_0xf058('0x39')]?_0x4c3b9b[_0xf058('0x37')]:_0x54fb69[_0xf058('0x36')];if(_0x187847[_0xf058('0x34')][_0xf058('0x44')]){_0x4c3b9b[_0xf058('0x45')]=[{'all':!![]}];}_0x4c3b9b=_[_0xf058('0x41')]({},_0x4c3b9b,_0x187847[_0xf058('0x42')]);return db[_0xf058('0x43')]['find'](_0x4c3b9b)[_0xf058('0x29')](handleEntityNotFound(_0x3f6755,null))[_0xf058('0x29')](respondWithResult(_0x3f6755,null))[_0xf058('0x47')](handleError(_0x3f6755,null));};exports['create']=function(_0x37889b,_0xff3591){return db[_0xf058('0x43')][_0xf058('0x4b')](_0x37889b[_0xf058('0x4c')],{})[_0xf058('0x29')](respondWithResult(_0xff3591,0xc9))['catch'](handleError(_0xff3591,null));};exports[_0xf058('0x28')]=function(_0x21147c,_0x7d4601){if(_0x21147c[_0xf058('0x4c')]['id']){delete _0x21147c[_0xf058('0x4c')]['id'];}return db[_0xf058('0x43')][_0xf058('0x4d')]({'where':{'id':_0x21147c[_0xf058('0x49')]['id']}})[_0xf058('0x29')](handleEntityNotFound(_0x7d4601,null))[_0xf058('0x29')](saveUpdates(_0x21147c[_0xf058('0x4c')],null))[_0xf058('0x29')](respondWithResult(_0x7d4601,null))[_0xf058('0x47')](handleError(_0x7d4601,null));};exports['destroy']=function(_0x132450,_0x2c9a75){return db[_0xf058('0x43')][_0xf058('0x4d')]({'where':{'id':_0x132450['params']['id']}})[_0xf058('0x29')](handleEntityNotFound(_0x2c9a75,null))['then'](removeEntity(_0x2c9a75,null))[_0xf058('0x47')](handleError(_0x2c9a75,null));};exports[_0xf058('0x4e')]=function(_0x9f2d6e,_0x3bd827){return db[_0xf058('0x43')]['describe']()[_0xf058('0x29')](respondWithResult(_0x3bd827,null))['catch'](handleError(_0x3bd827,null));};function wrapUser(_0x1aaa68){return function(_0x2529a3){var _0x34e3d3=_0x1aaa68[_0xf058('0x4f')]({'plain':!![]});_0x34e3d3['messages']=[];if(_0x2529a3){_0x34e3d3[_0xf058('0x50')]=_0x2529a3[_0xf058('0x51')];_0x34e3d3[_0xf058('0x52')]=_0x2529a3;}else{_0x34e3d3[_0xf058('0x50')]=moment(0x0)[_0xf058('0x53')](_0xf058('0x54'));_0x34e3d3['lastMessage']={};}return _0x34e3d3;};}exports[_0xf058('0x55')]=function(_0x261270,_0xddd8a7,_0x1767d4){var _0x184952=[];return db['User']['findAll']({'where':{'role':[_0xf058('0x56'),'admin',_0xf058('0x57')]},'attributes':['id',_0xf058('0x58'),_0xf058('0x2d'),_0xf058('0x59'),_0xf058('0x5a'),'internal',_0xf058('0x5b'),_0xf058('0x5c'),_0xf058('0x5d'),_0xf058('0x5e')],'order':qs[_0xf058('0x3c')](_0xf058('0x5f')),'include':[{'model':db['VoiceQueue'],'as':_0xf058('0x60'),'attributes':['id',_0xf058('0x2d'),'type'],'through':{'attributes':[]}}]})[_0xf058('0x29')](function(_0x544ac8){if(_0x544ac8){var _0x1075d2=_0x261270[_0xf058('0x57')]['get']({'plain':!![]});if(!_0x1075d2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1075d2[_0xf058('0x59')]==='user'){return db[_0xf058('0x61')]['find']({'where':{'name':'Agents','userProfileId':_0x1075d2['userProfileId']},'raw':!![]})[_0xf058('0x29')](function(_0x246f58){if(_0x246f58){if(_0x246f58[_0xf058('0x62')]===0x0){return db[_0xf058('0x63')][_0xf058('0x46')]({'where':{'sectionId':_0x246f58['id']},'raw':!![]})[_0xf058('0x29')](function(_0x5e21a7){var _0x995527=[];if(_[_0xf058('0x64')](_0x5e21a7)){_0x995527=_[_0xf058('0x40')](_0x544ac8,function(_0x2defba){if(_0x2defba[_0xf058('0x59')]!==_0xf058('0x56')){return _0x2defba;}});return _0x995527;}else{for(var _0x3cc820=0x0;_0x3cc820<_0x544ac8[_0xf058('0x39')];_0x3cc820++){var _0x143014=_0x544ac8[_0x3cc820];if(_0x143014[_0xf058('0x59')]===_0xf058('0x56')){var _0x1394e3=_['find'](_0x5e21a7,function(_0xc31bb7){return _0xc31bb7[_0xf058('0x65')]===_0x143014['id'];});if(_0x1394e3)_0x995527[_0xf058('0x66')](_0x143014);}else{_0x995527['push'](_0x143014);}}return _0x995527;}});}else{return _0x544ac8;}}else{var _0x24e96e=_[_0xf058('0x40')](_0x544ac8,function(_0x49f812){if(_0x49f812[_0xf058('0x59')]!==_0xf058('0x56')){return _0x49f812;}});return _0x24e96e;}});}else{return _0x544ac8;}}})[_0xf058('0x29')](function(_0x120e29){var _0x349460=[];if(_0x120e29){_0x184952=_0x120e29;for(var _0xe3c238=0x0;_0xe3c238<_0x120e29['length'];_0xe3c238+=0x1){_0x184952[_0xe3c238][_0xf058('0x67')]=[];_0x349460['push'](db[_0xf058('0x43')][_0xf058('0x4d')]({'where':{'FromId':[_0x261270[_0xf058('0x57')]['id'],_0x120e29[_0xe3c238]['id']],'ToId':[_0x261270[_0xf058('0x57')]['id'],_0x120e29[_0xe3c238]['id']],'ChatGroupId':null},'attributes':['id',_0xf058('0x51'),'FromId',_0xf058('0x68'),_0xf058('0x69'),_0xf058('0x4c')],'order':qs['sort']('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x120e29[_0xe3c238])));}return BPromise[_0xf058('0x6a')](_0x349460);}return[];})[_0xf058('0x29')](function(_0x391c85){return{'rows':_0x391c85,'count':_0x391c85[_0xf058('0x39')]};})[_0xf058('0x29')](respondWithResult(_0xddd8a7,null))[_0xf058('0x47')](handleError(_0xddd8a7,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 81cd1bb..2a51e45 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 _0x5dcd=['setMaxListeners','save','update','remove','emit','hook','exports','events','../../mysqldb','ChatInternalMessage'];(function(_0x472689,_0x27ce2f){var _0x776f29=function(_0x41d86b){while(--_0x41d86b){_0x472689['push'](_0x472689['shift']());}};_0x776f29(++_0x27ce2f);}(_0x5dcd,0xbb));var _0xd5dc=function(_0x4da093,_0x44abef){_0x4da093=_0x4da093-0x0;var _0x1b7237=_0x5dcd[_0x4da093];return _0x1b7237;};'use strict';var EventEmitter=require(_0xd5dc('0x0'));var ChatInternalMessage=require(_0xd5dc('0x1'))['db'][_0xd5dc('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xd5dc('0x3')](0x0);var events={'afterCreate':_0xd5dc('0x4'),'afterUpdate':_0xd5dc('0x5'),'afterDestroy':_0xd5dc('0x6')};function emitEvent(_0x4e9983){return function(_0x4ec320,_0x563ede,_0x28e67d){ChatInternalMessageEvents[_0xd5dc('0x7')](_0x4e9983+':'+_0x4ec320['id'],_0x4ec320);ChatInternalMessageEvents[_0xd5dc('0x7')](_0x4e9983,_0x4ec320);_0x28e67d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage[_0xd5dc('0x8')](e,emitEvent(event));}}module[_0xd5dc('0x9')]=ChatInternalMessageEvents; \ No newline at end of file +var _0xd2f9=['save','update','remove','hook','events','../../mysqldb'];(function(_0x42160c,_0x30e856){var _0xdba9cb=function(_0x3b1f82){while(--_0x3b1f82){_0x42160c['push'](_0x42160c['shift']());}};_0xdba9cb(++_0x30e856);}(_0xd2f9,0x88));var _0x9d2f=function(_0x238671,_0x34aea0){_0x238671=_0x238671-0x0;var _0x474844=_0xd2f9[_0x238671];return _0x474844;};'use strict';var EventEmitter=require(_0x9d2f('0x0'));var ChatInternalMessage=require(_0x9d2f('0x1'))['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9d2f('0x2'),'afterUpdate':_0x9d2f('0x3'),'afterDestroy':_0x9d2f('0x4')};function emitEvent(_0x54fc25){return function(_0x39d633,_0x312df4,_0x1e5703){ChatInternalMessageEvents['emit'](_0x54fc25+':'+_0x39d633['id'],_0x39d633);ChatInternalMessageEvents['emit'](_0x54fc25,_0x39d633);_0x1e5703(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage[_0x9d2f('0x5')](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 4610682..d727fe3 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 _0xc9ec=['chat_internal_messages','utf8mb4_unicode_ci','lodash','util','request-promise','../../config/environment','./chatInternalMessage.attributes','exports','define','ChatInternalMessage'];(function(_0x3ff818,_0x5d9e54){var _0x2cae16=function(_0x36f40e){while(--_0x36f40e){_0x3ff818['push'](_0x3ff818['shift']());}};_0x2cae16(++_0x5d9e54);}(_0xc9ec,0x174));var _0xcc9e=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xc9ec[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0xcc9e('0x0'));var util=require(_0xcc9e('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xcc9e('0x2'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xcc9e('0x3'));var attributes=require(_0xcc9e('0x4'));module[_0xcc9e('0x5')]=function(_0x3b4cf3,_0x149811){return _0x3b4cf3[_0xcc9e('0x6')](_0xcc9e('0x7'),attributes,{'tableName':_0xcc9e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xcc9e('0x9')});}; \ No newline at end of file +var _0x5882=['../../config/environment','./chatInternalMessage.attributes','exports','define','ChatInternalMessage','chat_internal_messages','utf8mb4_unicode_ci','lodash','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x5be795,_0x1cb1b8){var _0x4e8a3b=function(_0x5584ef){while(--_0x5584ef){_0x5be795['push'](_0x5be795['shift']());}};_0x4e8a3b(++_0x1cb1b8);}(_0x5882,0x181));var _0x2588=function(_0x5b2637,_0x5a96d1){_0x5b2637=_0x5b2637-0x0;var _0x56ec8b=_0x5882[_0x5b2637];return _0x56ec8b;};'use strict';var _=require(_0x2588('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2588('0x1'));var moment=require(_0x2588('0x2'));var BPromise=require(_0x2588('0x3'));var rp=require(_0x2588('0x4'));var fs=require('fs');var path=require(_0x2588('0x5'));var rimraf=require(_0x2588('0x6'));var config=require(_0x2588('0x7'));var attributes=require(_0x2588('0x8'));module[_0x2588('0x9')]=function(_0x96242f,_0x115326){return _0x96242f[_0x2588('0xa')](_0x2588('0xb'),attributes,{'tableName':_0x2588('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x2588('0xd')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index bce1271..0259918 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 _0x8f2f=['redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http'];(function(_0x9f721,_0x14bcc5){var _0x20052d=function(_0xba8047){while(--_0xba8047){_0x9f721['push'](_0x9f721['shift']());}};_0x20052d(++_0x14bcc5);}(_0x8f2f,0x1b6));var _0xf8f2=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x8f2f[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0xf8f2('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf8f2('0x1'));var rs=require(_0xf8f2('0x2'));var fs=require('fs');var Redis=require(_0xf8f2('0x3'));var db=require(_0xf8f2('0x4'))['db'];var utils=require(_0xf8f2('0x5'));var logger=require('../../config/logger')(_0xf8f2('0x6'));var config=require('../../config/environment');var jayson=require(_0xf8f2('0x7'));var client=jayson[_0xf8f2('0x8')][_0xf8f2('0x9')]({'port':0x232a});config[_0xf8f2('0xa')]=_['defaults'](config[_0xf8f2('0xa')],{'host':_0xf8f2('0xb'),'port':0x18eb});var socket=require(_0xf8f2('0xc'))(new Redis(config['redis']));require(_0xf8f2('0xd'))[_0xf8f2('0xe')](socket);function respondWithRpcPromise(_0x3fdc5f,_0x3035fd,_0x52715d){return new BPromise(function(_0x4bbde8,_0x1ab536){return client[_0xf8f2('0xf')](_0x3fdc5f,_0x52715d)[_0xf8f2('0x10')](function(_0x210131){logger[_0xf8f2('0x11')](_0xf8f2('0x12'),_0x3035fd,_0xf8f2('0x13'));logger[_0xf8f2('0x14')](_0xf8f2('0x15'),_0x3035fd,'request\x20sent',JSON[_0xf8f2('0x16')](_0x210131));if(_0x210131[_0xf8f2('0x17')]){if(_0x210131[_0xf8f2('0x17')][_0xf8f2('0x18')]===0x1f4){logger['error'](_0xf8f2('0x12'),_0x3035fd,_0x210131[_0xf8f2('0x17')][_0xf8f2('0x19')]);return _0x1ab536(_0x210131[_0xf8f2('0x17')][_0xf8f2('0x19')]);}logger[_0xf8f2('0x17')]('ChatInternalMessage,\x20%s,\x20%s',_0x3035fd,_0x210131[_0xf8f2('0x17')][_0xf8f2('0x19')]);return _0x4bbde8(_0x210131[_0xf8f2('0x17')][_0xf8f2('0x19')]);}else{logger[_0xf8f2('0x11')](_0xf8f2('0x12'),_0x3035fd,_0xf8f2('0x13'));_0x4bbde8(_0x210131[_0xf8f2('0x1a')][_0xf8f2('0x19')]);}})[_0xf8f2('0x1b')](function(_0x278e70){logger[_0xf8f2('0x17')](_0xf8f2('0x12'),_0x3035fd,_0x278e70);_0x1ab536(_0x278e70);});});} \ No newline at end of file +var _0x18db=['rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x19aae9,_0xecb6b){var _0x28412e=function(_0x357c80){while(--_0x357c80){_0x19aae9['push'](_0x19aae9['shift']());}};_0x28412e(++_0xecb6b);}(_0x18db,0x6e));var _0xb18d=function(_0x92529f,_0xfb32eb){_0x92529f=_0x92529f-0x0;var _0x2c7718=_0x18db[_0x92529f];return _0x2c7718;};'use strict';var _=require(_0xb18d('0x0'));var util=require('util');var moment=require(_0xb18d('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb18d('0x2'));var db=require(_0xb18d('0x3'))['db'];var utils=require(_0xb18d('0x4'));var logger=require(_0xb18d('0x5'))(_0xb18d('0x6'));var config=require(_0xb18d('0x7'));var jayson=require(_0xb18d('0x8'));var client=jayson[_0xb18d('0x9')][_0xb18d('0xa')]({'port':0x232a});config['redis']=_[_0xb18d('0xb')](config['redis'],{'host':_0xb18d('0xc'),'port':0x18eb});var socket=require(_0xb18d('0xd'))(new Redis(config['redis']));require(_0xb18d('0xe'))[_0xb18d('0xf')](socket);function respondWithRpcPromise(_0x3d53df,_0x346dee,_0x5e94c7){return new BPromise(function(_0x2345ce,_0x110369){return client[_0xb18d('0x10')](_0x3d53df,_0x5e94c7)[_0xb18d('0x11')](function(_0x41e527){logger[_0xb18d('0x12')](_0xb18d('0x13'),_0x346dee,'request\x20sent');logger[_0xb18d('0x14')](_0xb18d('0x15'),_0x346dee,_0xb18d('0x16'),JSON[_0xb18d('0x17')](_0x41e527));if(_0x41e527[_0xb18d('0x18')]){if(_0x41e527[_0xb18d('0x18')][_0xb18d('0x19')]===0x1f4){logger[_0xb18d('0x18')](_0xb18d('0x13'),_0x346dee,_0x41e527['error'][_0xb18d('0x1a')]);return _0x110369(_0x41e527['error'][_0xb18d('0x1a')]);}logger['error'](_0xb18d('0x13'),_0x346dee,_0x41e527[_0xb18d('0x18')][_0xb18d('0x1a')]);return _0x2345ce(_0x41e527[_0xb18d('0x18')][_0xb18d('0x1a')]);}else{logger[_0xb18d('0x12')](_0xb18d('0x13'),_0x346dee,'request\x20sent');_0x2345ce(_0x41e527[_0xb18d('0x1b')][_0xb18d('0x1a')]);}})[_0xb18d('0x1c')](function(_0x2706cc){logger[_0xb18d('0x18')](_0xb18d('0x13'),_0x346dee,_0x2706cc);_0x110369(_0x2706cc);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 6e01b31..c2d927c 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 _0x0eed=['save','update','removeListener','register','length','chatInternalMessage:','./chatInternalMessage.events'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0x0eed,0x76));var _0xd0ee=function(_0x58658d,_0x33cff4){_0x58658d=_0x58658d-0x0;var _0x487a2f=_0x0eed[_0x58658d];return _0x487a2f;};'use strict';var ChatInternalMessageEvents=require(_0xd0ee('0x0'));var events=[_0xd0ee('0x1'),'remove',_0xd0ee('0x2')];function createListener(_0x427193,_0x430d7c){return function(_0x340fc4){_0x430d7c['emit'](_0x427193,_0x340fc4);};}function removeListener(_0x42fae6,_0x4d6ed7){return function(){ChatInternalMessageEvents[_0xd0ee('0x3')](_0x42fae6,_0x4d6ed7);};}exports[_0xd0ee('0x4')]=function(_0x19a2cf){for(var _0x14aed3=0x0,_0x50eb82=events[_0xd0ee('0x5')];_0x14aed3<_0x50eb82;_0x14aed3++){var _0x46715f=events[_0x14aed3];var _0x859c74=createListener(_0xd0ee('0x6')+_0x46715f,_0x19a2cf);ChatInternalMessageEvents['on'](_0x46715f,_0x859c74);}}; \ No newline at end of file +var _0x79c6=['register','length','chatInternalMessage:','save','remove','update','emit','removeListener'];(function(_0x53bc3d,_0xb9e9bb){var _0x3d64bd=function(_0x5e6b99){while(--_0x5e6b99){_0x53bc3d['push'](_0x53bc3d['shift']());}};_0x3d64bd(++_0xb9e9bb);}(_0x79c6,0x19b));var _0x679c=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x79c6[_0x40a045];return _0x1a687c;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0x679c('0x0'),_0x679c('0x1'),_0x679c('0x2')];function createListener(_0x29dfa1,_0x4c0312){return function(_0x5d3297){_0x4c0312[_0x679c('0x3')](_0x29dfa1,_0x5d3297);};}function removeListener(_0x147a89,_0x3e3a73){return function(){ChatInternalMessageEvents[_0x679c('0x4')](_0x147a89,_0x3e3a73);};}exports[_0x679c('0x5')]=function(_0x4da110){for(var _0x15301f=0x0,_0x493bf1=events[_0x679c('0x6')];_0x15301f<_0x493bf1;_0x15301f++){var _0x477995=events[_0x15301f];var _0x355185=createListener(_0x679c('0x7')+_0x477995,_0x4da110);ChatInternalMessageEvents['on'](_0x477995,_0x355185);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index f6ec395..c150187 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 _0x666e=['describe','/users','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','isAuthenticated','index','get','/describe'];(function(_0x54f1a5,_0x5b2734){var _0x3778c7=function(_0x845c46){while(--_0x845c46){_0x54f1a5['push'](_0x54f1a5['shift']());}};_0x3778c7(++_0x5b2734);}(_0x666e,0x17b));var _0xe666=function(_0x1232ec,_0x2df4b1){_0x1232ec=_0x1232ec-0x0;var _0x4483b4=_0x666e[_0x1232ec];return _0x4483b4;};'use strict';var multer=require(_0xe666('0x0'));var util=require(_0xe666('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe666('0x2'));var router=express[_0xe666('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xe666('0x4'));var interaction=require(_0xe666('0x5'));var config=require(_0xe666('0x6'));var controller=require(_0xe666('0x7'));router['get']('/',auth[_0xe666('0x8')](),controller[_0xe666('0x9')]);router[_0xe666('0xa')](_0xe666('0xb'),auth[_0xe666('0x8')](),controller[_0xe666('0xc')]);router['get'](_0xe666('0xd'),auth[_0xe666('0x8')](),controller['getUsers']);router[_0xe666('0xa')](_0xe666('0xe'),auth[_0xe666('0x8')](),controller[_0xe666('0xf')]);router[_0xe666('0x10')]('/',auth['isAuthenticated'](),controller[_0xe666('0x11')]);router[_0xe666('0x12')]('/:id',controller[_0xe666('0x13')]);router[_0xe666('0x14')](_0xe666('0xe'),auth[_0xe666('0x8')](),controller[_0xe666('0x15')]);module[_0xe666('0x16')]=router; \ No newline at end of file +var _0x685a=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index','/describe','describe','/users','getUsers','show','post','create','/:id','update','delete','destroy','exports','multer','util','path'];(function(_0x1c25d8,_0x16d972){var _0x537518=function(_0x52982f){while(--_0x52982f){_0x1c25d8['push'](_0x1c25d8['shift']());}};_0x537518(++_0x16d972);}(_0x685a,0x7f));var _0xa685=function(_0x3aa03f,_0x1a719d){_0x3aa03f=_0x3aa03f-0x0;var _0x18475b=_0x685a[_0x3aa03f];return _0x18475b;};'use strict';var multer=require(_0xa685('0x0'));var util=require(_0xa685('0x1'));var path=require(_0xa685('0x2'));var timeout=require(_0xa685('0x3'));var express=require(_0xa685('0x4'));var router=express[_0xa685('0x5')]();var fs_extra=require(_0xa685('0x6'));var auth=require(_0xa685('0x7'));var interaction=require(_0xa685('0x8'));var config=require(_0xa685('0x9'));var controller=require(_0xa685('0xa'));router[_0xa685('0xb')]('/',auth[_0xa685('0xc')](),controller[_0xa685('0xd')]);router[_0xa685('0xb')](_0xa685('0xe'),auth[_0xa685('0xc')](),controller[_0xa685('0xf')]);router[_0xa685('0xb')](_0xa685('0x10'),auth['isAuthenticated'](),controller[_0xa685('0x11')]);router[_0xa685('0xb')]('/:id',auth[_0xa685('0xc')](),controller[_0xa685('0x12')]);router[_0xa685('0x13')]('/',auth[_0xa685('0xc')](),controller[_0xa685('0x14')]);router['put'](_0xa685('0x15'),controller[_0xa685('0x16')]);router[_0xa685('0x17')](_0xa685('0x15'),auth['isAuthenticated'](),controller[_0xa685('0x18')]);module[_0xa685('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 89c8a0c..f69549d 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 _0xe511=['medium','BOOLEAN','ENUM','out','DATE','STRING','TEXT','sequelize','exports'];(function(_0x37545c,_0x9906f5){var _0x4cd312=function(_0x21536b){while(--_0x21536b){_0x37545c['push'](_0x37545c['shift']());}};_0x4cd312(++_0x9906f5);}(_0xe511,0x16f));var _0x1e51=function(_0x1ac77b,_0x10ee7a){_0x1ac77b=_0x1ac77b-0x0;var _0x161584=_0xe511[_0x1ac77b];return _0x161584;};'use strict';var Sequelize=require(_0x1e51('0x0'));module[_0x1e51('0x1')]={'body':{'type':Sequelize['TEXT'](_0x1e51('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x1e51('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x1e51('0x4')]('in','out'),'defaultValue':_0x1e51('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x1e51('0x6')]},'providerName':{'type':Sequelize[_0x1e51('0x7')]},'providerResponse':{'type':Sequelize[_0x1e51('0x8')]}}; \ No newline at end of file +var _0xea28=['exports','TEXT','medium','BOOLEAN','ENUM','out','DATE','STRING','sequelize'];(function(_0x3746ff,_0x5dfa8f){var _0x353055=function(_0x11eae1){while(--_0x11eae1){_0x3746ff['push'](_0x3746ff['shift']());}};_0x353055(++_0x5dfa8f);}(_0xea28,0x13a));var _0x8ea2=function(_0x2b7c97,_0x4392f3){_0x2b7c97=_0x2b7c97-0x0;var _0x45cdad=_0xea28[_0x2b7c97];return _0x45cdad;};'use strict';var Sequelize=require(_0x8ea2('0x0'));module[_0x8ea2('0x1')]={'body':{'type':Sequelize[_0x8ea2('0x2')](_0x8ea2('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x8ea2('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x8ea2('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x8ea2('0x5')]('in',_0x8ea2('0x6')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x8ea2('0x7')]},'providerName':{'type':Sequelize[_0x8ea2('0x8')]},'providerResponse':{'type':Sequelize[_0x8ea2('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index eae61b6..c46003e 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 _0x4bf4=['jayson/promise','client','http','request','then','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','code','message','ChatMessage,\x20%s,\x20%s','info','catch','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','save','update','destroy','stack','name','send','index','map','ChatMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','find','create','body','params','chat-interactions','chat','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','ChatInteractionId','isNil','format','interaction','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','contact','User','agent','fullname','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','parse','formData','get','ChatInteraction','role','RejectMessage','SELECT','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','ejs','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','./chatMessage.socket'];(function(_0x252455,_0x4ce56a){var _0xb217d7=function(_0x37e201){while(--_0x37e201){_0x252455['push'](_0x252455['shift']());}};_0xb217d7(++_0x4ce56a);}(_0x4bf4,0xe3));var _0x44bf=function(_0x2e848c,_0x754fee){_0x2e848c=_0x2e848c-0x0;var _0x3de087=_0x4bf4[_0x2e848c];return _0x3de087;};'use strict';var emlformat=require(_0x44bf('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x44bf('0x1'));var rp=require('request-promise');var moment=require(_0x44bf('0x2'));var BPromise=require(_0x44bf('0x3'));var Mustache=require(_0x44bf('0x4'));var util=require(_0x44bf('0x5'));var path=require(_0x44bf('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x44bf('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x44bf('0x8'));var crypto=require(_0x44bf('0x9'));var jsforce=require(_0x44bf('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x44bf('0xb'));var querystring=require(_0x44bf('0xc'));var Papa=require(_0x44bf('0xd'));var Redis=require(_0x44bf('0xe'));var authService=require(_0x44bf('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x44bf('0x10'));var logger=require(_0x44bf('0x11'))('api');var utils=require(_0x44bf('0x12'));var config=require(_0x44bf('0x13'));var licenseUtil=require(_0x44bf('0x14'));var db=require('../../mysqldb')['db'];config[_0x44bf('0x15')]=_[_0x44bf('0x16')](config[_0x44bf('0x15')],{'host':_0x44bf('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x44bf('0x15')]));require(_0x44bf('0x18'))['register'](socket);var jayson=require(_0x44bf('0x19'));var client=jayson[_0x44bf('0x1a')][_0x44bf('0x1b')]({'port':0x232c});var client9002=jayson['client'][_0x44bf('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x2944fe,_0x3d7e1f,_0x1abc66,_0x56dc52){return new BPromise(function(_0x2e4f52,_0x5b497d){var _0x5a77c5=_0x56dc52||client;return _0x5a77c5[_0x44bf('0x1c')](_0x2944fe,_0x1abc66)[_0x44bf('0x1d')](function(_0x5cfc2d){logger['info']('ChatMessage,\x20%s,\x20%s',_0x3d7e1f,_0x44bf('0x1e'));logger[_0x44bf('0x1f')](_0x44bf('0x20'),_0x3d7e1f,_0x44bf('0x1e'),JSON['stringify'](_0x5cfc2d));if(_0x5cfc2d[_0x44bf('0x21')]){if(_0x5cfc2d[_0x44bf('0x21')][_0x44bf('0x22')]===0x1f4){logger[_0x44bf('0x21')]('ChatMessage,\x20%s,\x20%s',_0x3d7e1f,_0x5cfc2d['error'][_0x44bf('0x23')]);return _0x5b497d(_0x5cfc2d['error'][_0x44bf('0x23')]);}logger[_0x44bf('0x21')](_0x44bf('0x24'),_0x3d7e1f,_0x5cfc2d['error']['message']);return _0x2e4f52(_0x5cfc2d['error']['message']);}else{logger[_0x44bf('0x25')](_0x44bf('0x24'),_0x3d7e1f,_0x44bf('0x1e'));_0x2e4f52(_0x5cfc2d['result']['message']);}})[_0x44bf('0x26')](function(_0x5d4da1){logger[_0x44bf('0x21')](_0x44bf('0x24'),_0x3d7e1f,_0x5d4da1);_0x5b497d(_0x5d4da1);});});}function respondWithStatusCode(_0x1ae596,_0x53bdc7){_0x53bdc7=_0x53bdc7||0xcc;return function(_0x32f7e0){if(_0x32f7e0){return _0x1ae596[_0x44bf('0x27')](_0x53bdc7);}return _0x1ae596[_0x44bf('0x28')](_0x53bdc7)[_0x44bf('0x29')]();};}function respondWithResult(_0x4f2f9e,_0x47c470){_0x47c470=_0x47c470||0xc8;return function(_0x13d346){if(_0x13d346){return _0x4f2f9e['status'](_0x47c470)['json'](_0x13d346);}};}function respondWithFilteredResult(_0x6bff20,_0x25d770){return function(_0xc74f0d){if(_0xc74f0d){var _0x534971=typeof _0x25d770['offset']===_0x44bf('0x2a')&&typeof _0x25d770[_0x44bf('0x2b')]===_0x44bf('0x2a');var _0xa7d722=_0xc74f0d[_0x44bf('0x2c')];var _0x290586=_0x534971?0x0:_0x25d770[_0x44bf('0x2d')];var _0x6e9f23=_0x534971?_0xc74f0d[_0x44bf('0x2c')]:_0x25d770[_0x44bf('0x2d')]+_0x25d770[_0x44bf('0x2b')];var _0x461717;if(_0x6e9f23>=_0xa7d722){_0x6e9f23=_0xa7d722;_0x461717=0xc8;}else{_0x461717=0xce;}_0x6bff20['status'](_0x461717);return _0x6bff20[_0x44bf('0x2e')](_0x44bf('0x2f'),_0x290586+'-'+_0x6e9f23+'/'+_0xa7d722)[_0x44bf('0x30')](_0xc74f0d);}return null;};}function patchUpdates(_0x298487){return function(_0x4fd367){try{jsonpatch[_0x44bf('0x31')](_0x4fd367,_0x298487,!![]);}catch(_0x5802b5){return BPromise['reject'](_0x5802b5);}return _0x4fd367[_0x44bf('0x32')]();};}function saveUpdates(_0x38b337,_0x33c7d2){return function(_0xe78724){if(_0xe78724){return _0xe78724[_0x44bf('0x33')](_0x38b337)['then'](function(_0x942801){return _0x942801;});}return null;};}function removeEntity(_0x223804,_0x241a49){return function(_0x45640e){if(_0x45640e){return _0x45640e[_0x44bf('0x34')]()[_0x44bf('0x1d')](function(){_0x223804['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1620d8,_0x36ffed){return function(_0x18d378){if(!_0x18d378){_0x1620d8['sendStatus'](0x194);}return _0x18d378;};}function handleError(_0x5ef8b9,_0x2661b9){_0x2661b9=_0x2661b9||0x1f4;return function(_0x5f0580){logger[_0x44bf('0x21')](_0x5f0580[_0x44bf('0x35')]);if(_0x5f0580[_0x44bf('0x36')]){delete _0x5f0580[_0x44bf('0x36')];}_0x5ef8b9[_0x44bf('0x28')](_0x2661b9)[_0x44bf('0x37')](_0x5f0580);};}exports[_0x44bf('0x38')]=function(_0x40ae5f,_0x30e92a){var _0x50ee08={},_0xb7e4ac={},_0x3399a1={'count':0x0,'rows':[]};var _0x5ca1ec=_[_0x44bf('0x39')](db[_0x44bf('0x3a')][_0x44bf('0x3b')],function(_0x490b79){return{'name':_0x490b79[_0x44bf('0x3c')],'type':_0x490b79[_0x44bf('0x3d')][_0x44bf('0x3e')]};});_0xb7e4ac[_0x44bf('0x3f')]=_['map'](_0x5ca1ec,'name');_0xb7e4ac[_0x44bf('0x40')]=_[_0x44bf('0x41')](_0x40ae5f[_0x44bf('0x40')]);_0xb7e4ac[_0x44bf('0x42')]=_[_0x44bf('0x43')](_0xb7e4ac[_0x44bf('0x3f')],_0xb7e4ac[_0x44bf('0x40')]);_0x50ee08[_0x44bf('0x44')]=_[_0x44bf('0x43')](_0xb7e4ac[_0x44bf('0x3f')],qs[_0x44bf('0x45')](_0x40ae5f[_0x44bf('0x40')][_0x44bf('0x45')]));_0x50ee08['attributes']=_0x50ee08[_0x44bf('0x44')][_0x44bf('0x46')]?_0x50ee08[_0x44bf('0x44')]:_0xb7e4ac['model'];if(!_0x40ae5f[_0x44bf('0x40')]['hasOwnProperty'](_0x44bf('0x47'))){_0x50ee08[_0x44bf('0x2b')]=qs['limit'](_0x40ae5f[_0x44bf('0x40')][_0x44bf('0x2b')]);_0x50ee08[_0x44bf('0x2d')]=qs[_0x44bf('0x2d')](_0x40ae5f[_0x44bf('0x40')][_0x44bf('0x2d')]);}_0x50ee08[_0x44bf('0x48')]=qs[_0x44bf('0x49')](_0x40ae5f[_0x44bf('0x40')][_0x44bf('0x49')]);_0x50ee08[_0x44bf('0x4a')]=qs['filters'](_['pick'](_0x40ae5f['query'],_0xb7e4ac['filters']),_0x5ca1ec);if(_0x40ae5f['query']['filter']){_0x50ee08[_0x44bf('0x4a')]=_[_0x44bf('0x4b')](_0x50ee08['where'],{'$or':_[_0x44bf('0x39')](_0x5ca1ec,function(_0x38389e){if(_0x38389e['type']!==_0x44bf('0x4c')){var _0x11f5e6={};_0x11f5e6[_0x38389e[_0x44bf('0x36')]]={'$like':'%'+_0x40ae5f[_0x44bf('0x40')][_0x44bf('0x4d')]+'%'};return _0x11f5e6;}})});}_0x50ee08=_[_0x44bf('0x4b')]({},_0x50ee08,_0x40ae5f[_0x44bf('0x4e')]);var _0x211760={'where':_0x50ee08['where']};return db[_0x44bf('0x3a')]['count'](_0x211760)['then'](function(_0x56e9f2){_0x3399a1[_0x44bf('0x2c')]=_0x56e9f2;if(_0x40ae5f[_0x44bf('0x40')][_0x44bf('0x4f')]){_0x50ee08[_0x44bf('0x50')]=[{'all':!![]}];}return db['ChatMessage'][_0x44bf('0x51')](_0x50ee08);})[_0x44bf('0x1d')](function(_0x5a7036){_0x3399a1[_0x44bf('0x52')]=_0x5a7036;return _0x3399a1;})[_0x44bf('0x1d')](respondWithFilteredResult(_0x30e92a,_0x50ee08))[_0x44bf('0x26')](handleError(_0x30e92a,null));};exports[_0x44bf('0x53')]=function(_0x17518a,_0x4eabc8){var _0x56a45e={'raw':!![],'where':{'id':_0x17518a['params']['id']}},_0x17ef40={};_0x17ef40[_0x44bf('0x3f')]=_[_0x44bf('0x41')](db[_0x44bf('0x3a')]['rawAttributes']);_0x17ef40[_0x44bf('0x40')]=_['keys'](_0x17518a[_0x44bf('0x40')]);_0x17ef40[_0x44bf('0x42')]=_['intersection'](_0x17ef40[_0x44bf('0x3f')],_0x17ef40[_0x44bf('0x40')]);_0x56a45e[_0x44bf('0x44')]=_[_0x44bf('0x43')](_0x17ef40[_0x44bf('0x3f')],qs[_0x44bf('0x45')](_0x17518a[_0x44bf('0x40')]['fields']));_0x56a45e['attributes']=_0x56a45e[_0x44bf('0x44')][_0x44bf('0x46')]?_0x56a45e[_0x44bf('0x44')]:_0x17ef40['model'];if(_0x17518a[_0x44bf('0x40')]['includeAll']){_0x56a45e['include']=[{'all':!![]}];}_0x56a45e=_[_0x44bf('0x4b')]({},_0x56a45e,_0x17518a[_0x44bf('0x4e')]);return db[_0x44bf('0x3a')][_0x44bf('0x54')](_0x56a45e)[_0x44bf('0x1d')](handleEntityNotFound(_0x4eabc8,null))[_0x44bf('0x1d')](respondWithResult(_0x4eabc8,null))['catch'](handleError(_0x4eabc8,null));};exports[_0x44bf('0x55')]=function(_0x30e99f,_0x35fe29){return db['ChatMessage'][_0x44bf('0x55')](_0x30e99f['body'],{})[_0x44bf('0x1d')](respondWithResult(_0x35fe29,0xc9))[_0x44bf('0x26')](handleError(_0x35fe29,null));};exports['update']=function(_0x2caeff,_0x1bc5e9){if(_0x2caeff[_0x44bf('0x56')]['id']){delete _0x2caeff['body']['id'];}return db[_0x44bf('0x3a')][_0x44bf('0x54')]({'where':{'id':_0x2caeff[_0x44bf('0x57')]['id']}})[_0x44bf('0x1d')](handleEntityNotFound(_0x1bc5e9,null))['then'](saveUpdates(_0x2caeff[_0x44bf('0x56')],null))[_0x44bf('0x1d')](respondWithResult(_0x1bc5e9,null))[_0x44bf('0x26')](handleError(_0x1bc5e9,null));};exports['destroy']=function(_0x295b8d,_0x58e83c){return db[_0x44bf('0x3a')]['find']({'where':{'id':_0x295b8d['params']['id']}})[_0x44bf('0x1d')](handleEntityNotFound(_0x58e83c,null))[_0x44bf('0x1d')](removeEntity(_0x58e83c,null))[_0x44bf('0x26')](handleError(_0x58e83c,null));};exports['describe']=function(_0x5594b0,_0x56de0c){return db[_0x44bf('0x3a')]['describe']()[_0x44bf('0x1d')](respondWithResult(_0x56de0c,null))[_0x44bf('0x26')](handleError(_0x56de0c,null));};var interaction_log=require('../../config/logger')(_0x44bf('0x58'));exports['accept']=function(_0x30dfed,_0x3ecb02,_0x45634c){var _0x510b9a={'agent':{},'channel':_0x44bf('0x59')};if(_0x30dfed[_0x44bf('0x56')]['id']){delete _0x30dfed[_0x44bf('0x56')]['id'];}_0x30dfed[_0x44bf('0x56')][_0x44bf('0x5a')]=!![];_0x30dfed[_0x44bf('0x56')][_0x44bf('0x5b')]=moment()['format'](_0x44bf('0x5c'));_0x30dfed[_0x44bf('0x56')]['UserId']=_0x30dfed[_0x44bf('0x56')][_0x44bf('0x5d')]||_0x30dfed[_0x44bf('0x5e')]['id'];_0x510b9a['agent']['id']=_0x30dfed['body'][_0x44bf('0x5d')];return db['ChatMessage'][_0x44bf('0x54')]({'where':{'id':_0x30dfed['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3ecb02,null))[_0x44bf('0x1d')](saveUpdates(_0x30dfed[_0x44bf('0x56')],null))[_0x44bf('0x1d')](function(_0x2d2b7c){if(_0x2d2b7c){_0x510b9a[_0x44bf('0x23')]=_0x2d2b7c['get']({'plain':!![]});return db['ChatInteraction']['find']({'where':{'id':_0x2d2b7c[_0x44bf('0x5f')]}});}return null;})[_0x44bf('0x1d')](handleEntityNotFound(_0x3ecb02,null))[_0x44bf('0x1d')](function(_0x38f1a1){if(_0x38f1a1){return _0x38f1a1['update']({'UserId':_0x30dfed['body'][_0x44bf('0x5d')],'read1stAt':_[_0x44bf('0x60')](_0x38f1a1['read1stAt'])?moment()[_0x44bf('0x61')](_0x44bf('0x5c')):undefined});}return null;})[_0x44bf('0x1d')](function(_0x38e29a){if(_0x38e29a){_0x510b9a[_0x44bf('0x62')]=_0x38e29a['get']({'plain':!![]});interaction_log[_0x44bf('0x25')]('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x30dfed[_0x44bf('0x5e')]['id'],_0x30dfed[_0x44bf('0x5e')][_0x44bf('0x36')],_0x30dfed[_0x44bf('0x5e')]['role'],_0x510b9a[_0x44bf('0x62')]['id'],_0x30dfed[_0x44bf('0x56')]?JSON['stringify'](_0x30dfed[_0x44bf('0x56')]):_0x44bf('0x63'));return respondWithRpcPromise(_0x44bf('0x64'),'acceptMessage',_0x510b9a);}return null;})[_0x44bf('0x1d')](function(_0x175c47){var _0x3dd35a=_0x44bf('0x65')+_0x175c47[_0x44bf('0x23')][_0x44bf('0x66')];return db[_0x44bf('0x67')][_0x44bf('0x40')](_0x3dd35a,{'type':db[_0x44bf('0x68')][_0x44bf('0x69')]['SELECT'],'raw':!![]})[_0x44bf('0x1d')](function(_0x4173f6){return _0x4173f6;});})[_0x44bf('0x1d')](function(_0x5ab418){if(_0x5ab418){_0x510b9a[_0x44bf('0x23')][_0x44bf('0x6a')]=_0x5ab418[0x0];if(!_0x30dfed[_0x44bf('0x56')][_0x44bf('0x5d')])return;return db[_0x44bf('0x6b')][_0x44bf('0x54')]({'where':{'id':_0x30dfed[_0x44bf('0x56')][_0x44bf('0x5d')],'role':_0x44bf('0x6c')},'attributes':['id',_0x44bf('0x36'),_0x44bf('0x6d'),'email',_0x44bf('0x6e')],'raw':!![]});}return null;})[_0x44bf('0x1d')](function(_0x1af585){if(!_0x1af585)return null;_0x510b9a[_0x44bf('0x23')][_0x44bf('0x6c')]=_0x1af585;return _0x510b9a;})[_0x44bf('0x1d')](function(_0x18a14c){if(_0x18a14c){if(_0x30dfed[_0x44bf('0x56')][_0x44bf('0x6f')]){_0x510b9a[_0x44bf('0x23')][_0x44bf('0x70')]=util['format'](_0x44bf('0x71'),_0x30dfed[_0x44bf('0x5e')]['name']);_0x510b9a[_0x44bf('0x23')][_0x44bf('0x72')]=_0x510b9a[_0x44bf('0x72')];_0x510b9a['message'][_0x44bf('0x73')]=_0x510b9a['channel'];_0x510b9a[_0x44bf('0x23')][_0x44bf('0x74')]='accept';return respondWithRpcPromise(_0x44bf('0x75'),_0x44bf('0x75'),{'event':_0x44bf('0x76'),'message':_[_0x44bf('0x4b')](_0x510b9a[_0x44bf('0x23')],JSON[_0x44bf('0x77')](_0x510b9a[_0x44bf('0x62')][_0x44bf('0x78')]))},client9002)[_0x44bf('0x1d')](function(){return _0x510b9a;});}return _0x510b9a;}return null;})[_0x44bf('0x1d')](respondWithResult(_0x3ecb02,null))[_0x44bf('0x26')](handleError(_0x3ecb02,null));};var interaction_log=require(_0x44bf('0x11'))(_0x44bf('0x58'));exports['reject']=function(_0x48bd84,_0x3ba45f,_0x1d938d){var _0x17c08c={'agent':{},'channel':_0x44bf('0x59')};if(_0x48bd84[_0x44bf('0x56')]['id']){delete _0x48bd84[_0x44bf('0x56')]['id'];}_0x48bd84['body'][_0x44bf('0x5d')]=_0x48bd84[_0x44bf('0x56')][_0x44bf('0x5d')]||_0x48bd84[_0x44bf('0x5e')]['id'];_0x17c08c[_0x44bf('0x6c')]['id']=_0x48bd84[_0x44bf('0x56')][_0x44bf('0x5d')];return db[_0x44bf('0x3a')][_0x44bf('0x54')]({'where':{'id':_0x48bd84[_0x44bf('0x57')]['id'],'UserId':null}})[_0x44bf('0x1d')](handleEntityNotFound(_0x3ba45f,null))[_0x44bf('0x1d')](function(_0x2a3f94){if(_0x2a3f94){_0x17c08c['message']=_0x2a3f94[_0x44bf('0x79')]({'plain':!![]});return db[_0x44bf('0x7a')]['find']({'where':{'id':_0x2a3f94[_0x44bf('0x5f')]}});}return null;})[_0x44bf('0x1d')](handleEntityNotFound(_0x3ba45f,null))['then'](function(_0x886778){if(_0x886778){_0x17c08c[_0x44bf('0x62')]=_0x886778[_0x44bf('0x79')]({'plain':!![]});interaction_log['info']('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x48bd84[_0x44bf('0x5e')]['id'],_0x48bd84[_0x44bf('0x5e')][_0x44bf('0x36')],_0x48bd84['user'][_0x44bf('0x7b')],_0x17c08c[_0x44bf('0x62')]['id'],_0x48bd84[_0x44bf('0x56')]?JSON['stringify'](_0x48bd84['body']):_0x44bf('0x63'));return respondWithRpcPromise(_0x44bf('0x7c'),'rejectMessage',_0x17c08c);}return null;})[_0x44bf('0x1d')](function(_0x5c8da7){var _0x560341=_0x44bf('0x65')+_0x5c8da7[_0x44bf('0x23')]['ContactId'];return db[_0x44bf('0x67')][_0x44bf('0x40')](_0x560341,{'type':db[_0x44bf('0x68')]['QueryTypes'][_0x44bf('0x7d')],'raw':!![]})[_0x44bf('0x1d')](function(_0x164e4e){return _0x164e4e;});})[_0x44bf('0x1d')](function(_0x158577){if(_0x158577){_0x17c08c['message'][_0x44bf('0x6a')]=_0x158577[0x0];if(!_0x48bd84[_0x44bf('0x56')][_0x44bf('0x5d')])return;return db[_0x44bf('0x6b')][_0x44bf('0x54')]({'where':{'id':_0x48bd84['body'][_0x44bf('0x5d')],'role':'agent'},'attributes':['id',_0x44bf('0x36'),_0x44bf('0x6d'),'email',_0x44bf('0x6e')],'raw':!![]});}return null;})[_0x44bf('0x1d')](function(_0x2913ca){if(!_0x2913ca)return null;_0x17c08c[_0x44bf('0x23')][_0x44bf('0x6c')]=_0x2913ca;return _0x17c08c;})['then'](function(_0x3450a3){if(_0x3450a3){_0x3450a3[_0x44bf('0x23')][_0x44bf('0x70')]=util['format'](_0x44bf('0x71'),_0x48bd84[_0x44bf('0x5e')][_0x44bf('0x36')]);_0x3450a3['message'][_0x44bf('0x72')]=_0x17c08c['channel'];_0x3450a3[_0x44bf('0x23')][_0x44bf('0x73')]=_0x17c08c['channel'];_0x3450a3[_0x44bf('0x23')][_0x44bf('0x74')]='reject';respondWithRpcPromise(_0x44bf('0x75'),'EventManager',{'event':'rejectmessage','message':_[_0x44bf('0x4b')](_0x17c08c[_0x44bf('0x23')],JSON[_0x44bf('0x77')](_0x17c08c[_0x44bf('0x62')][_0x44bf('0x78')]))},client9002);return _0x17c08c;}return null;})[_0x44bf('0x1d')](respondWithResult(_0x3ba45f,null))[_0x44bf('0x26')](handleError(_0x3ba45f,null));}; \ No newline at end of file +var _0xad3a=['result','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','save','update','destroy','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','ChatMessage','includeAll','include','findAll','rows','catch','show','keys','find','create','body','params','describe','read','readAt','format','UserId','agent','ChatInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','get','user','role','interaction','stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','User','fullname','internal','manual','interface','SIP/%s','channel','motionChannel','event','accept','EventManager','acceptmessage','parse','formData','chat-interactions','chat','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','ContactId','contact','email','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','message','ChatMessage,\x20%s,\x20%s'];(function(_0x142d3e,_0x353e86){var _0x493084=function(_0x14aa15){while(--_0x14aa15){_0x142d3e['push'](_0x142d3e['shift']());}};_0x493084(++_0x353e86);}(_0xad3a,0xea));var _0xaad3=function(_0x26b8b5,_0xf5c2c1){_0x26b8b5=_0x26b8b5-0x0;var _0x2150a9=_0xad3a[_0x26b8b5];return _0x2150a9;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xaad3('0x0'));var jsonpatch=require(_0xaad3('0x1'));var rp=require('request-promise');var moment=require(_0xaad3('0x2'));var BPromise=require(_0xaad3('0x3'));var Mustache=require(_0xaad3('0x4'));var util=require(_0xaad3('0x5'));var path=require('path');var sox=require(_0xaad3('0x6'));var csv=require('to-csv');var ejs=require(_0xaad3('0x7'));var fs=require('fs');var fs_extra=require(_0xaad3('0x8'));var _=require(_0xaad3('0x9'));var squel=require(_0xaad3('0xa'));var crypto=require('crypto');var jsforce=require(_0xaad3('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xaad3('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xaad3('0xd'));var qs=require(_0xaad3('0xe'));var as=require(_0xaad3('0xf'));var hardwareService=require(_0xaad3('0x10'));var logger=require(_0xaad3('0x11'))('api');var utils=require(_0xaad3('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xaad3('0x13'));var db=require(_0xaad3('0x14'))['db'];config[_0xaad3('0x15')]=_['defaults'](config[_0xaad3('0x15')],{'host':_0xaad3('0x16'),'port':0x18eb});var socket=require(_0xaad3('0x17'))(new Redis(config['redis']));require(_0xaad3('0x18'))[_0xaad3('0x19')](socket);var jayson=require(_0xaad3('0x1a'));var client=jayson[_0xaad3('0x1b')][_0xaad3('0x1c')]({'port':0x232c});var client9002=jayson['client'][_0xaad3('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x2b13f8,_0x46fd33,_0x5a05b2,_0x2b52a8){return new BPromise(function(_0x5cd833,_0x5a7a02){var _0x506629=_0x2b52a8||client;return _0x506629[_0xaad3('0x1d')](_0x2b13f8,_0x5a05b2)[_0xaad3('0x1e')](function(_0x445438){logger[_0xaad3('0x1f')]('ChatMessage,\x20%s,\x20%s',_0x46fd33,_0xaad3('0x20'));logger[_0xaad3('0x21')](_0xaad3('0x22'),_0x46fd33,_0xaad3('0x20'),JSON['stringify'](_0x445438));if(_0x445438['error']){if(_0x445438[_0xaad3('0x23')]['code']===0x1f4){logger[_0xaad3('0x23')]('ChatMessage,\x20%s,\x20%s',_0x46fd33,_0x445438[_0xaad3('0x23')][_0xaad3('0x24')]);return _0x5a7a02(_0x445438[_0xaad3('0x23')]['message']);}logger[_0xaad3('0x23')](_0xaad3('0x25'),_0x46fd33,_0x445438['error'][_0xaad3('0x24')]);return _0x5cd833(_0x445438[_0xaad3('0x23')]['message']);}else{logger[_0xaad3('0x1f')](_0xaad3('0x25'),_0x46fd33,'request\x20sent');_0x5cd833(_0x445438[_0xaad3('0x26')]['message']);}})['catch'](function(_0x3838b6){logger[_0xaad3('0x23')](_0xaad3('0x25'),_0x46fd33,_0x3838b6);_0x5a7a02(_0x3838b6);});});}function respondWithStatusCode(_0x4dbec7,_0x3d5c03){_0x3d5c03=_0x3d5c03||0xcc;return function(_0x39d8f0){if(_0x39d8f0){return _0x4dbec7[_0xaad3('0x27')](_0x3d5c03);}return _0x4dbec7[_0xaad3('0x28')](_0x3d5c03)[_0xaad3('0x29')]();};}function respondWithResult(_0x30acd5,_0x230f5e){_0x230f5e=_0x230f5e||0xc8;return function(_0x5f5b67){if(_0x5f5b67){return _0x30acd5[_0xaad3('0x28')](_0x230f5e)[_0xaad3('0x2a')](_0x5f5b67);}};}function respondWithFilteredResult(_0x1e4a35,_0x3831cd){return function(_0x582b19){if(_0x582b19){var _0x56b49d=typeof _0x3831cd['offset']===_0xaad3('0x2b')&&typeof _0x3831cd[_0xaad3('0x2c')]==='undefined';var _0x54664d=_0x582b19[_0xaad3('0x2d')];var _0x29cda6=_0x56b49d?0x0:_0x3831cd[_0xaad3('0x2e')];var _0x1751db=_0x56b49d?_0x582b19['count']:_0x3831cd[_0xaad3('0x2e')]+_0x3831cd[_0xaad3('0x2c')];var _0x13eca6;if(_0x1751db>=_0x54664d){_0x1751db=_0x54664d;_0x13eca6=0xc8;}else{_0x13eca6=0xce;}_0x1e4a35[_0xaad3('0x28')](_0x13eca6);return _0x1e4a35[_0xaad3('0x2f')]('Content-Range',_0x29cda6+'-'+_0x1751db+'/'+_0x54664d)['json'](_0x582b19);}return null;};}function patchUpdates(_0x581dd8){return function(_0x5483b4){try{jsonpatch[_0xaad3('0x30')](_0x5483b4,_0x581dd8,!![]);}catch(_0x516db3){return BPromise[_0xaad3('0x31')](_0x516db3);}return _0x5483b4[_0xaad3('0x32')]();};}function saveUpdates(_0x35e43c,_0x5c279b){return function(_0x4247b0){if(_0x4247b0){return _0x4247b0[_0xaad3('0x33')](_0x35e43c)[_0xaad3('0x1e')](function(_0x4d8887){return _0x4d8887;});}return null;};}function removeEntity(_0x5c0d28,_0x507b91){return function(_0x3bc7a7){if(_0x3bc7a7){return _0x3bc7a7[_0xaad3('0x34')]()[_0xaad3('0x1e')](function(){_0x5c0d28[_0xaad3('0x28')](0xcc)[_0xaad3('0x29')]();});}};}function handleEntityNotFound(_0x4e5146,_0x3d78dd){return function(_0x3e2608){if(!_0x3e2608){_0x4e5146[_0xaad3('0x27')](0x194);}return _0x3e2608;};}function handleError(_0x302e66,_0x228544){_0x228544=_0x228544||0x1f4;return function(_0x43bb4d){logger[_0xaad3('0x23')](_0x43bb4d[_0xaad3('0x35')]);if(_0x43bb4d[_0xaad3('0x36')]){delete _0x43bb4d[_0xaad3('0x36')];}_0x302e66['status'](_0x228544)[_0xaad3('0x37')](_0x43bb4d);};}exports[_0xaad3('0x38')]=function(_0x4694fd,_0x3fb186){var _0x2bd564={},_0x54b335={},_0x571a39={'count':0x0,'rows':[]};var _0x1962b5=_['map'](db['ChatMessage'][_0xaad3('0x39')],function(_0x38651c){return{'name':_0x38651c[_0xaad3('0x3a')],'type':_0x38651c[_0xaad3('0x3b')][_0xaad3('0x3c')]};});_0x54b335[_0xaad3('0x3d')]=_[_0xaad3('0x3e')](_0x1962b5,_0xaad3('0x36'));_0x54b335[_0xaad3('0x3f')]=_['keys'](_0x4694fd[_0xaad3('0x3f')]);_0x54b335[_0xaad3('0x40')]=_[_0xaad3('0x41')](_0x54b335['model'],_0x54b335[_0xaad3('0x3f')]);_0x2bd564['attributes']=_[_0xaad3('0x41')](_0x54b335[_0xaad3('0x3d')],qs[_0xaad3('0x42')](_0x4694fd[_0xaad3('0x3f')][_0xaad3('0x42')]));_0x2bd564[_0xaad3('0x43')]=_0x2bd564[_0xaad3('0x43')][_0xaad3('0x44')]?_0x2bd564[_0xaad3('0x43')]:_0x54b335['model'];if(!_0x4694fd[_0xaad3('0x3f')][_0xaad3('0x45')](_0xaad3('0x46'))){_0x2bd564[_0xaad3('0x2c')]=qs['limit'](_0x4694fd[_0xaad3('0x3f')][_0xaad3('0x2c')]);_0x2bd564[_0xaad3('0x2e')]=qs[_0xaad3('0x2e')](_0x4694fd[_0xaad3('0x3f')]['offset']);}_0x2bd564[_0xaad3('0x47')]=qs['sort'](_0x4694fd[_0xaad3('0x3f')][_0xaad3('0x48')]);_0x2bd564[_0xaad3('0x49')]=qs[_0xaad3('0x40')](_[_0xaad3('0x4a')](_0x4694fd['query'],_0x54b335[_0xaad3('0x40')]),_0x1962b5);if(_0x4694fd[_0xaad3('0x3f')][_0xaad3('0x4b')]){_0x2bd564[_0xaad3('0x49')]=_[_0xaad3('0x4c')](_0x2bd564[_0xaad3('0x49')],{'$or':_[_0xaad3('0x3e')](_0x1962b5,function(_0x316760){if(_0x316760[_0xaad3('0x3b')]!==_0xaad3('0x4d')){var _0xcb6f1f={};_0xcb6f1f[_0x316760['name']]={'$like':'%'+_0x4694fd['query']['filter']+'%'};return _0xcb6f1f;}})});}_0x2bd564=_[_0xaad3('0x4c')]({},_0x2bd564,_0x4694fd[_0xaad3('0x4e')]);var _0x4bba02={'where':_0x2bd564[_0xaad3('0x49')]};return db[_0xaad3('0x4f')][_0xaad3('0x2d')](_0x4bba02)[_0xaad3('0x1e')](function(_0x283792){_0x571a39[_0xaad3('0x2d')]=_0x283792;if(_0x4694fd[_0xaad3('0x3f')][_0xaad3('0x50')]){_0x2bd564[_0xaad3('0x51')]=[{'all':!![]}];}return db[_0xaad3('0x4f')][_0xaad3('0x52')](_0x2bd564);})[_0xaad3('0x1e')](function(_0x4bcd04){_0x571a39[_0xaad3('0x53')]=_0x4bcd04;return _0x571a39;})[_0xaad3('0x1e')](respondWithFilteredResult(_0x3fb186,_0x2bd564))[_0xaad3('0x54')](handleError(_0x3fb186,null));};exports[_0xaad3('0x55')]=function(_0x367239,_0x19f8ba){var _0x5b5ea3={'raw':!![],'where':{'id':_0x367239['params']['id']}},_0x30168b={};_0x30168b[_0xaad3('0x3d')]=_[_0xaad3('0x56')](db[_0xaad3('0x4f')][_0xaad3('0x39')]);_0x30168b[_0xaad3('0x3f')]=_[_0xaad3('0x56')](_0x367239['query']);_0x30168b[_0xaad3('0x40')]=_[_0xaad3('0x41')](_0x30168b['model'],_0x30168b[_0xaad3('0x3f')]);_0x5b5ea3['attributes']=_[_0xaad3('0x41')](_0x30168b['model'],qs[_0xaad3('0x42')](_0x367239[_0xaad3('0x3f')][_0xaad3('0x42')]));_0x5b5ea3[_0xaad3('0x43')]=_0x5b5ea3[_0xaad3('0x43')]['length']?_0x5b5ea3['attributes']:_0x30168b['model'];if(_0x367239['query'][_0xaad3('0x50')]){_0x5b5ea3[_0xaad3('0x51')]=[{'all':!![]}];}_0x5b5ea3=_[_0xaad3('0x4c')]({},_0x5b5ea3,_0x367239[_0xaad3('0x4e')]);return db[_0xaad3('0x4f')][_0xaad3('0x57')](_0x5b5ea3)[_0xaad3('0x1e')](handleEntityNotFound(_0x19f8ba,null))[_0xaad3('0x1e')](respondWithResult(_0x19f8ba,null))[_0xaad3('0x54')](handleError(_0x19f8ba,null));};exports[_0xaad3('0x58')]=function(_0x33b4ad,_0x45570a){return db[_0xaad3('0x4f')][_0xaad3('0x58')](_0x33b4ad[_0xaad3('0x59')],{})['then'](respondWithResult(_0x45570a,0xc9))['catch'](handleError(_0x45570a,null));};exports[_0xaad3('0x33')]=function(_0x398d65,_0x3600d1){if(_0x398d65[_0xaad3('0x59')]['id']){delete _0x398d65[_0xaad3('0x59')]['id'];}return db['ChatMessage'][_0xaad3('0x57')]({'where':{'id':_0x398d65[_0xaad3('0x5a')]['id']}})[_0xaad3('0x1e')](handleEntityNotFound(_0x3600d1,null))[_0xaad3('0x1e')](saveUpdates(_0x398d65['body'],null))[_0xaad3('0x1e')](respondWithResult(_0x3600d1,null))[_0xaad3('0x54')](handleError(_0x3600d1,null));};exports[_0xaad3('0x34')]=function(_0xcca0e3,_0x15d9ff){return db[_0xaad3('0x4f')]['find']({'where':{'id':_0xcca0e3[_0xaad3('0x5a')]['id']}})[_0xaad3('0x1e')](handleEntityNotFound(_0x15d9ff,null))[_0xaad3('0x1e')](removeEntity(_0x15d9ff,null))[_0xaad3('0x54')](handleError(_0x15d9ff,null));};exports[_0xaad3('0x5b')]=function(_0x470c19,_0x376caa){return db[_0xaad3('0x4f')][_0xaad3('0x5b')]()[_0xaad3('0x1e')](respondWithResult(_0x376caa,null))[_0xaad3('0x54')](handleError(_0x376caa,null));};var interaction_log=require(_0xaad3('0x11'))('chat-interactions');exports['accept']=function(_0x5a6e99,_0x38660e,_0x228784){var _0x20f0ef={'agent':{},'channel':'chat'};if(_0x5a6e99[_0xaad3('0x59')]['id']){delete _0x5a6e99['body']['id'];}_0x5a6e99[_0xaad3('0x59')][_0xaad3('0x5c')]=!![];_0x5a6e99[_0xaad3('0x59')][_0xaad3('0x5d')]=moment()[_0xaad3('0x5e')]('YYYY-MM-DD\x20HH:mm:ss');_0x5a6e99['body'][_0xaad3('0x5f')]=_0x5a6e99[_0xaad3('0x59')]['UserId']||_0x5a6e99['user']['id'];_0x20f0ef[_0xaad3('0x60')]['id']=_0x5a6e99[_0xaad3('0x59')][_0xaad3('0x5f')];return db[_0xaad3('0x4f')][_0xaad3('0x57')]({'where':{'id':_0x5a6e99[_0xaad3('0x5a')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x38660e,null))['then'](saveUpdates(_0x5a6e99[_0xaad3('0x59')],null))[_0xaad3('0x1e')](function(_0x38a1f7){if(_0x38a1f7){_0x20f0ef[_0xaad3('0x24')]=_0x38a1f7['get']({'plain':!![]});return db['ChatInteraction'][_0xaad3('0x57')]({'where':{'id':_0x38a1f7[_0xaad3('0x61')]}});}return null;})[_0xaad3('0x1e')](handleEntityNotFound(_0x38660e,null))[_0xaad3('0x1e')](function(_0x56ed40){if(_0x56ed40){return _0x56ed40['update']({'UserId':_0x5a6e99[_0xaad3('0x59')]['UserId'],'read1stAt':_[_0xaad3('0x62')](_0x56ed40[_0xaad3('0x63')])?moment()['format'](_0xaad3('0x64')):undefined});}return null;})[_0xaad3('0x1e')](function(_0x1a60da){if(_0x1a60da){_0x20f0ef['interaction']=_0x1a60da[_0xaad3('0x65')]({'plain':!![]});interaction_log['info']('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x5a6e99['user']['id'],_0x5a6e99['user'][_0xaad3('0x36')],_0x5a6e99[_0xaad3('0x66')][_0xaad3('0x67')],_0x20f0ef[_0xaad3('0x68')]['id'],_0x5a6e99[_0xaad3('0x59')]?JSON[_0xaad3('0x69')](_0x5a6e99[_0xaad3('0x59')]):_0xaad3('0x6a'));return respondWithRpcPromise(_0xaad3('0x6b'),_0xaad3('0x6c'),_0x20f0ef);}return null;})[_0xaad3('0x1e')](function(_0x478d9f){var _0x1eaee7=_0xaad3('0x6d')+_0x478d9f[_0xaad3('0x24')]['ContactId'];return db[_0xaad3('0x6e')][_0xaad3('0x3f')](_0x1eaee7,{'type':db[_0xaad3('0x6f')][_0xaad3('0x70')][_0xaad3('0x71')],'raw':!![]})[_0xaad3('0x1e')](function(_0x40c0ce){return _0x40c0ce;});})[_0xaad3('0x1e')](function(_0x1ef910){if(_0x1ef910){_0x20f0ef[_0xaad3('0x24')]['contact']=_0x1ef910[0x0];if(!_0x5a6e99[_0xaad3('0x59')][_0xaad3('0x5f')])return;return db[_0xaad3('0x72')][_0xaad3('0x57')]({'where':{'id':_0x5a6e99[_0xaad3('0x59')][_0xaad3('0x5f')],'role':_0xaad3('0x60')},'attributes':['id',_0xaad3('0x36'),_0xaad3('0x73'),'email',_0xaad3('0x74')],'raw':!![]});}return null;})[_0xaad3('0x1e')](function(_0x169044){if(!_0x169044)return null;_0x20f0ef['message'][_0xaad3('0x60')]=_0x169044;return _0x20f0ef;})[_0xaad3('0x1e')](function(_0x22db85){if(_0x22db85){if(_0x5a6e99[_0xaad3('0x59')][_0xaad3('0x75')]){_0x20f0ef[_0xaad3('0x24')][_0xaad3('0x76')]=util['format'](_0xaad3('0x77'),_0x5a6e99[_0xaad3('0x66')]['name']);_0x20f0ef[_0xaad3('0x24')][_0xaad3('0x78')]=_0x20f0ef[_0xaad3('0x78')];_0x20f0ef['message'][_0xaad3('0x79')]=_0x20f0ef[_0xaad3('0x78')];_0x20f0ef[_0xaad3('0x24')][_0xaad3('0x7a')]=_0xaad3('0x7b');return respondWithRpcPromise(_0xaad3('0x7c'),_0xaad3('0x7c'),{'event':_0xaad3('0x7d'),'message':_[_0xaad3('0x4c')](_0x20f0ef['message'],JSON[_0xaad3('0x7e')](_0x20f0ef[_0xaad3('0x68')][_0xaad3('0x7f')]))},client9002)[_0xaad3('0x1e')](function(){return _0x20f0ef;});}return _0x20f0ef;}return null;})['then'](respondWithResult(_0x38660e,null))[_0xaad3('0x54')](handleError(_0x38660e,null));};var interaction_log=require(_0xaad3('0x11'))(_0xaad3('0x80'));exports[_0xaad3('0x31')]=function(_0x13bb85,_0x268dc5,_0x1f6e10){var _0x374b65={'agent':{},'channel':_0xaad3('0x81')};if(_0x13bb85[_0xaad3('0x59')]['id']){delete _0x13bb85[_0xaad3('0x59')]['id'];}_0x13bb85['body'][_0xaad3('0x5f')]=_0x13bb85[_0xaad3('0x59')][_0xaad3('0x5f')]||_0x13bb85[_0xaad3('0x66')]['id'];_0x374b65[_0xaad3('0x60')]['id']=_0x13bb85[_0xaad3('0x59')][_0xaad3('0x5f')];return db['ChatMessage'][_0xaad3('0x57')]({'where':{'id':_0x13bb85[_0xaad3('0x5a')]['id'],'UserId':null}})[_0xaad3('0x1e')](handleEntityNotFound(_0x268dc5,null))['then'](function(_0x4b43bd){if(_0x4b43bd){_0x374b65['message']=_0x4b43bd[_0xaad3('0x65')]({'plain':!![]});return db['ChatInteraction'][_0xaad3('0x57')]({'where':{'id':_0x4b43bd[_0xaad3('0x61')]}});}return null;})[_0xaad3('0x1e')](handleEntityNotFound(_0x268dc5,null))[_0xaad3('0x1e')](function(_0x1844c1){if(_0x1844c1){_0x374b65['interaction']=_0x1844c1[_0xaad3('0x65')]({'plain':!![]});interaction_log[_0xaad3('0x1f')](_0xaad3('0x82'),_0x13bb85[_0xaad3('0x66')]['id'],_0x13bb85[_0xaad3('0x66')][_0xaad3('0x36')],_0x13bb85[_0xaad3('0x66')]['role'],_0x374b65[_0xaad3('0x68')]['id'],_0x13bb85['body']?JSON['stringify'](_0x13bb85[_0xaad3('0x59')]):'null');return respondWithRpcPromise(_0xaad3('0x83'),_0xaad3('0x84'),_0x374b65);}return null;})['then'](function(_0x41c709){var _0x244ce1=_0xaad3('0x6d')+_0x41c709[_0xaad3('0x24')][_0xaad3('0x85')];return db['sequelize'][_0xaad3('0x3f')](_0x244ce1,{'type':db[_0xaad3('0x6f')][_0xaad3('0x70')]['SELECT'],'raw':!![]})[_0xaad3('0x1e')](function(_0x10ed0c){return _0x10ed0c;});})[_0xaad3('0x1e')](function(_0x667d9c){if(_0x667d9c){_0x374b65[_0xaad3('0x24')][_0xaad3('0x86')]=_0x667d9c[0x0];if(!_0x13bb85[_0xaad3('0x59')][_0xaad3('0x5f')])return;return db[_0xaad3('0x72')][_0xaad3('0x57')]({'where':{'id':_0x13bb85[_0xaad3('0x59')][_0xaad3('0x5f')],'role':_0xaad3('0x60')},'attributes':['id',_0xaad3('0x36'),_0xaad3('0x73'),_0xaad3('0x87'),_0xaad3('0x74')],'raw':!![]});}return null;})['then'](function(_0x35c787){if(!_0x35c787)return null;_0x374b65[_0xaad3('0x24')][_0xaad3('0x60')]=_0x35c787;return _0x374b65;})['then'](function(_0x23a4e0){if(_0x23a4e0){_0x23a4e0[_0xaad3('0x24')][_0xaad3('0x76')]=util[_0xaad3('0x5e')](_0xaad3('0x77'),_0x13bb85[_0xaad3('0x66')][_0xaad3('0x36')]);_0x23a4e0[_0xaad3('0x24')]['channel']=_0x374b65[_0xaad3('0x78')];_0x23a4e0[_0xaad3('0x24')][_0xaad3('0x79')]=_0x374b65[_0xaad3('0x78')];_0x23a4e0['message'][_0xaad3('0x7a')]=_0xaad3('0x31');respondWithRpcPromise(_0xaad3('0x7c'),_0xaad3('0x7c'),{'event':'rejectmessage','message':_[_0xaad3('0x4c')](_0x374b65[_0xaad3('0x24')],JSON[_0xaad3('0x7e')](_0x374b65[_0xaad3('0x68')][_0xaad3('0x7f')]))},client9002);return _0x374b65;}return null;})[_0xaad3('0x1e')](respondWithResult(_0x268dc5,null))[_0xaad3('0x54')](handleError(_0x268dc5,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index c0384a3..1b9c540 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 _0x3835=['save','update','emit','exports','events','../../mysqldb','ChatMessage','setMaxListeners'];(function(_0x4f68b2,_0x4a69da){var _0x653390=function(_0x3ad880){while(--_0x3ad880){_0x4f68b2['push'](_0x4f68b2['shift']());}};_0x653390(++_0x4a69da);}(_0x3835,0x144));var _0x5383=function(_0x1715a2,_0x13d1d3){_0x1715a2=_0x1715a2-0x0;var _0x447fc1=_0x3835[_0x1715a2];return _0x447fc1;};'use strict';var EventEmitter=require(_0x5383('0x0'));var ChatMessage=require(_0x5383('0x1'))['db'][_0x5383('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x5383('0x3')](0x0);var events={'afterCreate':_0x5383('0x4'),'afterUpdate':_0x5383('0x5'),'afterDestroy':'remove'};function emitEvent(_0x185e80){return function(_0x430d49,_0x4ec59b,_0x5bbe49){ChatMessageEvents[_0x5383('0x6')](_0x185e80+':'+_0x430d49['id'],_0x430d49);ChatMessageEvents[_0x5383('0x6')](_0x185e80,_0x430d49);_0x5bbe49(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module[_0x5383('0x7')]=ChatMessageEvents; \ No newline at end of file +var _0x8969=['../../mysqldb','ChatMessage','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x516733,_0x5c2ba5){var _0x1c8e77=function(_0x36cb9e){while(--_0x36cb9e){_0x516733['push'](_0x516733['shift']());}};_0x1c8e77(++_0x5c2ba5);}(_0x8969,0xdb));var _0x9896=function(_0xcc4d8,_0x5ac5d7){_0xcc4d8=_0xcc4d8-0x0;var _0x1d4234=_0x8969[_0xcc4d8];return _0x1d4234;};'use strict';var EventEmitter=require(_0x9896('0x0'));var ChatMessage=require(_0x9896('0x1'))['db'][_0x9896('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x9896('0x3')](0x0);var events={'afterCreate':_0x9896('0x4'),'afterUpdate':_0x9896('0x5'),'afterDestroy':'remove'};function emitEvent(_0x101d63){return function(_0x3e724f,_0x2e108f,_0xba6612){ChatMessageEvents['emit'](_0x101d63+':'+_0x3e724f['id'],_0x3e724f);ChatMessageEvents[_0x9896('0x6')](_0x101d63,_0x3e724f);_0xba6612(null);};}for(var e in events){if(events[_0x9896('0x7')](e)){var event=events[e];ChatMessage[_0x9896('0x8')](e,emitEvent(event));}}module[_0x9896('0x9')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 5c74b96..8fcfcdf 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 _0xfb7b=['catch','error','utf8mb4','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','fti_chat_messages','body','FULLTEXT','toLowerCase','direction','out','isNil','ChatInteraction','findOne','ChatInteractionId','then','update','createdAt'];(function(_0xf1a5d8,_0xaa4f2e){var _0xf496f6=function(_0x474772){while(--_0x474772){_0xf1a5d8['push'](_0xf1a5d8['shift']());}};_0xf496f6(++_0xaa4f2e);}(_0xfb7b,0x1c3));var _0xbfb7=function(_0x530ea2,_0x19db07){_0x530ea2=_0x530ea2-0x0;var _0x221ead=_0xfb7b[_0x530ea2];return _0x221ead;};'use strict';var _=require(_0xbfb7('0x0'));var util=require('util');var logger=require(_0xbfb7('0x1'))(_0xbfb7('0x2'));var moment=require('moment');var BPromise=require(_0xbfb7('0x3'));var rp=require(_0xbfb7('0x4'));var fs=require('fs');var path=require(_0xbfb7('0x5'));var rimraf=require(_0xbfb7('0x6'));var config=require(_0xbfb7('0x7'));var attributes=require(_0xbfb7('0x8'));module[_0xbfb7('0x9')]=function(_0x398c78,_0x383b7d){return _0x398c78[_0xbfb7('0xa')](_0xbfb7('0xb'),attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[{'name':_0xbfb7('0xc'),'fields':[_0xbfb7('0xd')],'type':_0xbfb7('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xee2a84,_0x49cd81,_0x3027c4){var _0x1cf5ee=_0x398c78['models'];var _0x50f36f=_0xee2a84['get']({'plain':!![]});if(_0x50f36f['direction'][_0xbfb7('0xf')]()==='in'||_0x50f36f[_0xbfb7('0x10')][_0xbfb7('0xf')]()===_0xbfb7('0x11')&&!_0x50f36f['secret']&&!_[_0xbfb7('0x12')](_0x50f36f['UserId'])){_0x1cf5ee[_0xbfb7('0x13')][_0xbfb7('0x14')]({'where':{'id':_0x50f36f[_0xbfb7('0x15')]}})[_0xbfb7('0x16')](function(_0x10c1a5){if(_0x10c1a5){_0x10c1a5[_0xbfb7('0x17')]({'lastMsgAt':_0x50f36f[_0xbfb7('0x18')],'lastMsgDirection':_0x50f36f[_0xbfb7('0x10')][_0xbfb7('0xf')]()});}})[_0xbfb7('0x19')](function(_0x5f12bf){console[_0xbfb7('0x1a')](_0x5f12bf);});}_0x3027c4();}},'charset':_0xbfb7('0x1b'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x7488=['update','catch','error','utf8mb4_unicode_ci','lodash','util','moment','bluebird','request-promise','path','../../config/environment','./chatMessage.attributes','exports','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','models','get','direction','out','secret','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','then'];(function(_0x2da93f,_0x343e5e){var _0x37af83=function(_0x216d78){while(--_0x216d78){_0x2da93f['push'](_0x2da93f['shift']());}};_0x37af83(++_0x343e5e);}(_0x7488,0x19a));var _0x8748=function(_0xecb029,_0x343bf0){_0xecb029=_0xecb029-0x0;var _0x2538c1=_0x7488[_0xecb029];return _0x2538c1;};'use strict';var _=require(_0x8748('0x0'));var util=require(_0x8748('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8748('0x2'));var BPromise=require(_0x8748('0x3'));var rp=require(_0x8748('0x4'));var fs=require('fs');var path=require(_0x8748('0x5'));var rimraf=require('rimraf');var config=require(_0x8748('0x6'));var attributes=require(_0x8748('0x7'));module[_0x8748('0x8')]=function(_0x15aa95,_0x23502a){return _0x15aa95['define'](_0x8748('0x9'),attributes,{'tableName':_0x8748('0xa'),'paranoid':![],'indexes':[{'name':_0x8748('0xb'),'fields':[_0x8748('0xc')],'type':_0x8748('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4af94d,_0x5bb1d8,_0x907b6c){var _0x2906fc=_0x15aa95[_0x8748('0xe')];var _0x34fb60=_0x4af94d[_0x8748('0xf')]({'plain':!![]});if(_0x34fb60[_0x8748('0x10')]['toLowerCase']()==='in'||_0x34fb60[_0x8748('0x10')]['toLowerCase']()===_0x8748('0x11')&&!_0x34fb60[_0x8748('0x12')]&&!_[_0x8748('0x13')](_0x34fb60[_0x8748('0x14')])){_0x2906fc[_0x8748('0x15')][_0x8748('0x16')]({'where':{'id':_0x34fb60[_0x8748('0x17')]}})[_0x8748('0x18')](function(_0x41d6aa){if(_0x41d6aa){_0x41d6aa[_0x8748('0x19')]({'lastMsgAt':_0x34fb60['createdAt'],'lastMsgDirection':_0x34fb60['direction']['toLowerCase']()});}})[_0x8748('0x1a')](function(_0x1d7186){console[_0x8748('0x1b')](_0x1d7186);});}_0x907b6c();}},'charset':'utf8mb4','collate':_0x8748('0x1c')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 6fb4d97..51dc17a 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 _0xfc46=['../../config/logger','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./chatMessage.socket','register','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateChatMessage','create','body','raw','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0xdc7042,_0x4d6d08){var _0x1c314e=function(_0x538d19){while(--_0x538d19){_0xdc7042['push'](_0xdc7042['shift']());}};_0x1c314e(++_0x4d6d08);}(_0xfc46,0x9a));var _0x6fc4=function(_0x39a2d6,_0x477459){_0x39a2d6=_0x39a2d6-0x0;var _0x23af66=_0xfc46[_0x39a2d6];return _0x23af66;};'use strict';var _=require(_0x6fc4('0x0'));var util=require('util');var moment=require(_0x6fc4('0x1'));var BPromise=require(_0x6fc4('0x2'));var rs=require(_0x6fc4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6fc4('0x4'))['db'];var utils=require(_0x6fc4('0x5'));var logger=require(_0x6fc4('0x6'))(_0x6fc4('0x7'));var config=require('../../config/environment');var jayson=require(_0x6fc4('0x8'));var client=jayson[_0x6fc4('0x9')][_0x6fc4('0xa')]({'port':0x232a});config[_0x6fc4('0xb')]=_[_0x6fc4('0xc')](config[_0x6fc4('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x6fc4('0xd'))(new Redis(config['redis']));require(_0x6fc4('0xe'))[_0x6fc4('0xf')](socket);function respondWithRpcPromise(_0x57dd8c,_0x2c573b,_0x19dc5b){return new BPromise(function(_0x3a8f51,_0x16072b){return client[_0x6fc4('0x10')](_0x57dd8c,_0x19dc5b)[_0x6fc4('0x11')](function(_0x15a009){logger[_0x6fc4('0x12')](_0x6fc4('0x13'),_0x2c573b,_0x6fc4('0x14'));logger[_0x6fc4('0x15')](_0x6fc4('0x16'),_0x2c573b,_0x6fc4('0x14'),JSON[_0x6fc4('0x17')](_0x15a009));if(_0x15a009[_0x6fc4('0x18')]){if(_0x15a009[_0x6fc4('0x18')][_0x6fc4('0x19')]===0x1f4){logger['error']('ChatMessage,\x20%s,\x20%s',_0x2c573b,_0x15a009[_0x6fc4('0x18')][_0x6fc4('0x1a')]);return _0x16072b(_0x15a009[_0x6fc4('0x18')][_0x6fc4('0x1a')]);}logger[_0x6fc4('0x18')](_0x6fc4('0x13'),_0x2c573b,_0x15a009[_0x6fc4('0x18')][_0x6fc4('0x1a')]);return _0x3a8f51(_0x15a009[_0x6fc4('0x18')]['message']);}else{logger[_0x6fc4('0x12')](_0x6fc4('0x13'),_0x2c573b,'request\x20sent');_0x3a8f51(_0x15a009['result'][_0x6fc4('0x1a')]);}})[_0x6fc4('0x1b')](function(_0x4f49d1){logger[_0x6fc4('0x18')](_0x6fc4('0x13'),_0x2c573b,_0x4f49d1);_0x16072b(_0x4f49d1);});});}exports[_0x6fc4('0x1c')]=function(_0x4edb51){var _0x176d12=this;return new Promise(function(_0xd2f0e0,_0x3a3842){return db['ChatMessage'][_0x6fc4('0x1d')](_0x4edb51[_0x6fc4('0x1e')],{'raw':_0x4edb51['options']?_0x4edb51['options'][_0x6fc4('0x1f')]===undefined?!![]:![]:!![]})['then'](function(_0x53e5fb){logger['info'](_0x6fc4('0x1c'),_0x4edb51);logger[_0x6fc4('0x15')](_0x6fc4('0x1c'),_0x4edb51,JSON['stringify'](_0x53e5fb));_0xd2f0e0(_0x53e5fb);})[_0x6fc4('0x1b')](function(_0x38f60c){logger['error'](_0x6fc4('0x1c'),_0x38f60c[_0x6fc4('0x1a')],_0x4edb51);_0x3a3842(_0x176d12[_0x6fc4('0x18')](0x1f4,_0x38f60c[_0x6fc4('0x1a')]));});});}; \ No newline at end of file +var _0x485e=['result','catch','CreateChatMessage','ChatMessage','create','body','options','raw','info','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./chatMessage.socket','register','request','then','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x5b61b3,_0x5eb0d8){var _0xfa0854=function(_0x4e1c93){while(--_0x4e1c93){_0x5b61b3['push'](_0x5b61b3['shift']());}};_0xfa0854(++_0x5eb0d8);}(_0x485e,0x1f3));var _0xe485=function(_0x397cfb,_0xb8f317){_0x397cfb=_0x397cfb-0x0;var _0x15fed9=_0x485e[_0x397cfb];return _0x15fed9;};'use strict';var _=require(_0xe485('0x0'));var util=require(_0xe485('0x1'));var moment=require('moment');var BPromise=require(_0xe485('0x2'));var rs=require(_0xe485('0x3'));var fs=require('fs');var Redis=require(_0xe485('0x4'));var db=require(_0xe485('0x5'))['db'];var utils=require(_0xe485('0x6'));var logger=require('../../config/logger')(_0xe485('0x7'));var config=require(_0xe485('0x8'));var jayson=require(_0xe485('0x9'));var client=jayson[_0xe485('0xa')][_0xe485('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0xe485('0xc')],{'host':_0xe485('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe485('0xc')]));require(_0xe485('0xe'))[_0xe485('0xf')](socket);function respondWithRpcPromise(_0x1bb949,_0x18ffe9,_0x23ea1f){return new BPromise(function(_0x37d82a,_0x6442f9){return client[_0xe485('0x10')](_0x1bb949,_0x23ea1f)[_0xe485('0x11')](function(_0x582409){logger['info'](_0xe485('0x12'),_0x18ffe9,_0xe485('0x13'));logger[_0xe485('0x14')](_0xe485('0x15'),_0x18ffe9,_0xe485('0x13'),JSON[_0xe485('0x16')](_0x582409));if(_0x582409[_0xe485('0x17')]){if(_0x582409['error'][_0xe485('0x18')]===0x1f4){logger[_0xe485('0x17')](_0xe485('0x12'),_0x18ffe9,_0x582409[_0xe485('0x17')][_0xe485('0x19')]);return _0x6442f9(_0x582409[_0xe485('0x17')][_0xe485('0x19')]);}logger['error'](_0xe485('0x12'),_0x18ffe9,_0x582409['error']['message']);return _0x37d82a(_0x582409[_0xe485('0x17')][_0xe485('0x19')]);}else{logger['info'](_0xe485('0x12'),_0x18ffe9,_0xe485('0x13'));_0x37d82a(_0x582409[_0xe485('0x1a')][_0xe485('0x19')]);}})[_0xe485('0x1b')](function(_0x10a555){logger[_0xe485('0x17')](_0xe485('0x12'),_0x18ffe9,_0x10a555);_0x6442f9(_0x10a555);});});}exports[_0xe485('0x1c')]=function(_0x5e2b94){var _0x3af5f9=this;return new Promise(function(_0x4ee563,_0x2f5e1d){return db[_0xe485('0x1d')][_0xe485('0x1e')](_0x5e2b94[_0xe485('0x1f')],{'raw':_0x5e2b94[_0xe485('0x20')]?_0x5e2b94[_0xe485('0x20')][_0xe485('0x21')]===undefined?!![]:![]:!![]})['then'](function(_0x2dfad1){logger[_0xe485('0x22')]('CreateChatMessage',_0x5e2b94);logger[_0xe485('0x14')](_0xe485('0x1c'),_0x5e2b94,JSON['stringify'](_0x2dfad1));_0x4ee563(_0x2dfad1);})[_0xe485('0x1b')](function(_0x9ac361){logger[_0xe485('0x17')](_0xe485('0x1c'),_0x9ac361[_0xe485('0x19')],_0x5e2b94);_0x2f5e1d(_0x3af5f9[_0xe485('0x17')](0x1f4,_0x9ac361[_0xe485('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index af8dae7..7589948 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 _0xaba6=['emit','removeListener','./chatMessage.events','save'];(function(_0x2ceb8e,_0x19ba8e){var _0xe283bb=function(_0x104094){while(--_0x104094){_0x2ceb8e['push'](_0x2ceb8e['shift']());}};_0xe283bb(++_0x19ba8e);}(_0xaba6,0xe2));var _0x6aba=function(_0x153dba,_0x2fc9d9){_0x153dba=_0x153dba-0x0;var _0x4d3654=_0xaba6[_0x153dba];return _0x4d3654;};'use strict';var ChatMessageEvents=require(_0x6aba('0x0'));var events=[_0x6aba('0x1'),'remove','update'];function createListener(_0x5140ee,_0x596c18){return function(_0x42fd1f){_0x596c18[_0x6aba('0x2')](_0x5140ee,_0x42fd1f);};}function removeListener(_0x58d8a8,_0x1e32a1){return function(){ChatMessageEvents[_0x6aba('0x3')](_0x58d8a8,_0x1e32a1);};}exports['register']=function(_0x4e929a){for(var _0x5ae14c=0x0,_0x39c32a=events['length'];_0x5ae14c<_0x39c32a;_0x5ae14c++){var _0x3766d4=events[_0x5ae14c];var _0x1a4fbc=createListener('chatMessage:'+_0x3766d4,_0x4e929a);ChatMessageEvents['on'](_0x3766d4,_0x1a4fbc);}}; \ No newline at end of file +var _0x3f27=['emit','register','length','chatMessage:','./chatMessage.events','save','remove','update'];(function(_0x36d687,_0x10f230){var _0x446b6d=function(_0x1bb436){while(--_0x1bb436){_0x36d687['push'](_0x36d687['shift']());}};_0x446b6d(++_0x10f230);}(_0x3f27,0x1f4));var _0x73f2=function(_0x38e703,_0x33c9bc){_0x38e703=_0x38e703-0x0;var _0x44cd62=_0x3f27[_0x38e703];return _0x44cd62;};'use strict';var ChatMessageEvents=require(_0x73f2('0x0'));var events=[_0x73f2('0x1'),_0x73f2('0x2'),_0x73f2('0x3')];function createListener(_0x329305,_0x5d59c0){return function(_0x22480a){_0x5d59c0[_0x73f2('0x4')](_0x329305,_0x22480a);};}function removeListener(_0x5b0f16,_0x56d5f3){return function(){ChatMessageEvents['removeListener'](_0x5b0f16,_0x56d5f3);};}exports[_0x73f2('0x5')]=function(_0x54631b){for(var _0x17f054=0x0,_0x4aa8ec=events[_0x73f2('0x6')];_0x17f054<_0x4aa8ec;_0x17f054++){var _0x5efe60=events[_0x17f054];var _0x521fc9=createListener(_0x73f2('0x7')+_0x5efe60,_0x54631b);ChatMessageEvents['on'](_0x5efe60,_0x521fc9);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index fb25d5d..defd9c1 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 _0xaa7d=['create','put','update','accept','/:id/reject','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','index','/describe','isAuthenticated','describe','/:id','post','tracked','chat','chatmessage:create'];(function(_0x14bdc6,_0x27db25){var _0x3e187e=function(_0x5c7350){while(--_0x5c7350){_0x14bdc6['push'](_0x14bdc6['shift']());}};_0x3e187e(++_0x27db25);}(_0xaa7d,0x120));var _0xdaa7=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0xaa7d[_0x68c979];return _0x4f0001;};'use strict';var multer=require(_0xdaa7('0x0'));var util=require(_0xdaa7('0x1'));var path=require(_0xdaa7('0x2'));var timeout=require('connect-timeout');var express=require(_0xdaa7('0x3'));var router=express[_0xdaa7('0x4')]();var fs_extra=require(_0xdaa7('0x5'));var auth=require(_0xdaa7('0x6'));var interaction=require(_0xdaa7('0x7'));var config=require(_0xdaa7('0x8'));var controller=require(_0xdaa7('0x9'));router[_0xdaa7('0xa')]('/',auth['isAuthenticated'](),controller[_0xdaa7('0xb')]);router['get'](_0xdaa7('0xc'),auth[_0xdaa7('0xd')](),controller[_0xdaa7('0xe')]);router[_0xdaa7('0xa')](_0xdaa7('0xf'),auth[_0xdaa7('0xd')](),controller['show']);router[_0xdaa7('0x10')]('/',auth[_0xdaa7('0xd')](),interaction[_0xdaa7('0x11')](_0xdaa7('0x12'),_0xdaa7('0x13')),controller[_0xdaa7('0x14')]);router[_0xdaa7('0x15')]('/:id',controller[_0xdaa7('0x16')]);router[_0xdaa7('0x15')]('/:id/accept',auth[_0xdaa7('0xd')](),controller[_0xdaa7('0x17')]);router[_0xdaa7('0x15')](_0xdaa7('0x18'),auth[_0xdaa7('0xd')](),controller['reject']);router[_0xdaa7('0x19')](_0xdaa7('0xf'),auth['isAuthenticated'](),controller[_0xdaa7('0x1a')]);module[_0xdaa7('0x1b')]=router; \ No newline at end of file +var _0x4aa6=['../../config/environment','./chatMessage.controller','get','isAuthenticated','index','/:id','show','post','tracked','chatmessage:create','create','put','update','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x4aa6,0x7a));var _0x64aa=function(_0x549c,_0x216e88){_0x549c=_0x549c-0x0;var _0x1b490e=_0x4aa6[_0x549c];return _0x1b490e;};'use strict';var multer=require(_0x64aa('0x0'));var util=require(_0x64aa('0x1'));var path=require(_0x64aa('0x2'));var timeout=require(_0x64aa('0x3'));var express=require(_0x64aa('0x4'));var router=express['Router']();var fs_extra=require(_0x64aa('0x5'));var auth=require(_0x64aa('0x6'));var interaction=require(_0x64aa('0x7'));var config=require(_0x64aa('0x8'));var controller=require(_0x64aa('0x9'));router[_0x64aa('0xa')]('/',auth[_0x64aa('0xb')](),controller[_0x64aa('0xc')]);router[_0x64aa('0xa')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x64aa('0xa')](_0x64aa('0xd'),auth[_0x64aa('0xb')](),controller[_0x64aa('0xe')]);router[_0x64aa('0xf')]('/',auth[_0x64aa('0xb')](),interaction[_0x64aa('0x10')]('chat',_0x64aa('0x11')),controller[_0x64aa('0x12')]);router[_0x64aa('0x13')](_0x64aa('0xd'),controller[_0x64aa('0x14')]);router[_0x64aa('0x13')]('/:id/accept',auth[_0x64aa('0xb')](),controller['accept']);router[_0x64aa('0x13')](_0x64aa('0x15'),auth['isAuthenticated'](),controller[_0x64aa('0x16')]);router[_0x64aa('0x17')](_0x64aa('0xd'),auth[_0x64aa('0xb')](),controller[_0x64aa('0x18')]);module[_0x64aa('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 722e458..332afbd 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 _0xd980=['TEXT','medium','sequelize'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd980,0x8f));var _0x0d98=function(_0x2326a2,_0x53042e){_0x2326a2=_0x2326a2-0x0;var _0x2d960b=_0xd980[_0x2326a2];return _0x2d960b;};'use strict';var Sequelize=require(_0x0d98('0x0'));module['exports']={'body':{'type':Sequelize[_0x0d98('0x1')](_0x0d98('0x2')),'allowNull':![]}}; \ No newline at end of file +var _0x030d=['medium','sequelize','exports','TEXT'];(function(_0xe7f153,_0xe07497){var _0x5b452b=function(_0x119164){while(--_0x119164){_0xe7f153['push'](_0xe7f153['shift']());}};_0x5b452b(++_0xe07497);}(_0x030d,0x1c9));var _0xd030=function(_0x41a7d4,_0x409980){_0x41a7d4=_0x41a7d4-0x0;var _0x496a94=_0x030d[_0x41a7d4];return _0x496a94;};'use strict';var Sequelize=require(_0xd030('0x0'));module[_0xd030('0x1')]={'body':{'type':Sequelize[_0xd030('0x2')](_0xd030('0x3')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 58e2741..e9ccaaf 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(_0x12d033,_0x25fa2f){var _0x3b4e80=function(_0x46c1f4){while(--_0x46c1f4){_0x12d033['push'](_0x12d033['shift']());}};_0x3b4e80(++_0x25fa2f);}(_0x7a54,0x106));var _0x47a5=function(_0x2db284,_0x324644){_0x2db284=_0x2db284-0x0;var _0x1bedeb=_0x7a54[_0x2db284];return _0x1bedeb;};'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(_0x3e6430,_0x5abd9d){var _0x7623b1=function(_0x30725f){while(--_0x30725f){_0x3e6430['push'](_0x3e6430['shift']());}};_0x7623b1(++_0x5abd9d);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){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.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 696475d..05f3e03 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 _0xb0a5=['ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./chatOfflineMessage.attributes','define'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb0a5,0x103));var _0x5b0a=function(_0x49ccaa,_0x5944f2){_0x49ccaa=_0x49ccaa-0x0;var _0x2c1ae1=_0xb0a5[_0x49ccaa];return _0x2c1ae1;};'use strict';var _=require(_0x5b0a('0x0'));var util=require(_0x5b0a('0x1'));var logger=require(_0x5b0a('0x2'))(_0x5b0a('0x3'));var moment=require(_0x5b0a('0x4'));var BPromise=require(_0x5b0a('0x5'));var rp=require(_0x5b0a('0x6'));var fs=require('fs');var path=require(_0x5b0a('0x7'));var rimraf=require(_0x5b0a('0x8'));var config=require('../../config/environment');var attributes=require(_0x5b0a('0x9'));module['exports']=function(_0x395676,_0x39b123){return _0x395676[_0x5b0a('0xa')](_0x5b0a('0xb'),attributes,{'tableName':_0x5b0a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5b0a('0xd'),'collate':_0x5b0a('0xe')});}; \ No newline at end of file +var _0x1c20=['./chatOfflineMessage.attributes','define','ChatOfflineMessage','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3e7796,_0x51cf0e){var _0x542b81=function(_0x467cfc){while(--_0x467cfc){_0x3e7796['push'](_0x3e7796['shift']());}};_0x542b81(++_0x51cf0e);}(_0x1c20,0x1b4));var _0x01c2=function(_0x4b174a,_0x33a017){_0x4b174a=_0x4b174a-0x0;var _0x3cd7bf=_0x1c20[_0x4b174a];return _0x3cd7bf;};'use strict';var _=require(_0x01c2('0x0'));var util=require(_0x01c2('0x1'));var logger=require(_0x01c2('0x2'))(_0x01c2('0x3'));var moment=require(_0x01c2('0x4'));var BPromise=require(_0x01c2('0x5'));var rp=require(_0x01c2('0x6'));var fs=require('fs');var path=require(_0x01c2('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x01c2('0x8'));module['exports']=function(_0x2a2c5c,_0x503d36){return _0x2a2c5c[_0x01c2('0x9')](_0x01c2('0xa'),attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x01c2('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 2020208..ffd010f 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 _0xba54=['../../config/logger','rpc','jayson/promise','client','http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','error','code','message','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x51e1d5,_0x399588){var _0x105666=function(_0x325128){while(--_0x325128){_0x51e1d5['push'](_0x51e1d5['shift']());}};_0x105666(++_0x399588);}(_0xba54,0x176));var _0x4ba5=function(_0x4ae13b,_0x517a31){_0x4ae13b=_0x4ae13b-0x0;var _0x4f733c=_0xba54[_0x4ae13b];return _0x4f733c;};'use strict';var _=require('lodash');var util=require(_0x4ba5('0x0'));var moment=require(_0x4ba5('0x1'));var BPromise=require('bluebird');var rs=require(_0x4ba5('0x2'));var fs=require('fs');var Redis=require(_0x4ba5('0x3'));var db=require(_0x4ba5('0x4'))['db'];var utils=require(_0x4ba5('0x5'));var logger=require(_0x4ba5('0x6'))(_0x4ba5('0x7'));var config=require('../../config/environment');var jayson=require(_0x4ba5('0x8'));var client=jayson[_0x4ba5('0x9')][_0x4ba5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4db699,_0x431c26,_0x11f933){return new BPromise(function(_0x437113,_0x1617f6){return client[_0x4ba5('0xb')](_0x4db699,_0x11f933)[_0x4ba5('0xc')](function(_0x5f07b4){logger[_0x4ba5('0xd')](_0x4ba5('0xe'),_0x431c26,_0x4ba5('0xf'));logger['debug']('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x431c26,_0x4ba5('0xf'),JSON['stringify'](_0x5f07b4));if(_0x5f07b4['error']){if(_0x5f07b4[_0x4ba5('0x10')][_0x4ba5('0x11')]===0x1f4){logger[_0x4ba5('0x10')](_0x4ba5('0xe'),_0x431c26,_0x5f07b4[_0x4ba5('0x10')]['message']);return _0x1617f6(_0x5f07b4['error']['message']);}logger[_0x4ba5('0x10')](_0x4ba5('0xe'),_0x431c26,_0x5f07b4['error'][_0x4ba5('0x12')]);return _0x437113(_0x5f07b4[_0x4ba5('0x10')][_0x4ba5('0x12')]);}else{logger[_0x4ba5('0xd')](_0x4ba5('0xe'),_0x431c26,_0x4ba5('0xf'));_0x437113(_0x5f07b4['result'][_0x4ba5('0x12')]);}})['catch'](function(_0x5498c8){logger[_0x4ba5('0x10')](_0x4ba5('0xe'),_0x431c26,_0x5498c8);_0x1617f6(_0x5498c8);});});} \ No newline at end of file +var _0xca99=['then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x161cd7,_0x3fc7d8){var _0x245df0=function(_0x340c61){while(--_0x340c61){_0x161cd7['push'](_0x161cd7['shift']());}};_0x245df0(++_0x3fc7d8);}(_0xca99,0x186));var _0x9ca9=function(_0x3572cb,_0x4149d3){_0x3572cb=_0x3572cb-0x0;var _0x33a398=_0xca99[_0x3572cb];return _0x33a398;};'use strict';var _=require(_0x9ca9('0x0'));var util=require(_0x9ca9('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9ca9('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9ca9('0x3'));var logger=require(_0x9ca9('0x4'))(_0x9ca9('0x5'));var config=require(_0x9ca9('0x6'));var jayson=require(_0x9ca9('0x7'));var client=jayson['client'][_0x9ca9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x94ecd6,_0x32f8a7,_0x209e48){return new BPromise(function(_0xd5de20,_0x4a3653){return client['request'](_0x94ecd6,_0x209e48)[_0x9ca9('0x9')](function(_0x27d7de){logger[_0x9ca9('0xa')](_0x9ca9('0xb'),_0x32f8a7,_0x9ca9('0xc'));logger[_0x9ca9('0xd')](_0x9ca9('0xe'),_0x32f8a7,_0x9ca9('0xc'),JSON[_0x9ca9('0xf')](_0x27d7de));if(_0x27d7de[_0x9ca9('0x10')]){if(_0x27d7de['error'][_0x9ca9('0x11')]===0x1f4){logger[_0x9ca9('0x10')](_0x9ca9('0xb'),_0x32f8a7,_0x27d7de[_0x9ca9('0x10')]['message']);return _0x4a3653(_0x27d7de[_0x9ca9('0x10')][_0x9ca9('0x12')]);}logger['error'](_0x9ca9('0xb'),_0x32f8a7,_0x27d7de[_0x9ca9('0x10')][_0x9ca9('0x12')]);return _0xd5de20(_0x27d7de['error'][_0x9ca9('0x12')]);}else{logger[_0x9ca9('0xa')](_0x9ca9('0xb'),_0x32f8a7,_0x9ca9('0xc'));_0xd5de20(_0x27d7de[_0x9ca9('0x13')][_0x9ca9('0x12')]);}})[_0x9ca9('0x14')](function(_0x493085){logger[_0x9ca9('0x10')]('ChatOfflineMessage,\x20%s,\x20%s',_0x32f8a7,_0x493085);_0x4a3653(_0x493085);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index e28305d..415f9b1 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 _0x594d=['describe','show','post','create','put','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatOfflineMessage.controller','get','isAuthenticated','index','/describe'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0x594d,0x168));var _0xd594=function(_0x428c43,_0x1d9dd3){_0x428c43=_0x428c43-0x0;var _0x2d3674=_0x594d[_0x428c43];return _0x2d3674;};'use strict';var multer=require(_0xd594('0x0'));var util=require(_0xd594('0x1'));var path=require(_0xd594('0x2'));var timeout=require(_0xd594('0x3'));var express=require(_0xd594('0x4'));var router=express[_0xd594('0x5')]();var fs_extra=require(_0xd594('0x6'));var auth=require(_0xd594('0x7'));var interaction=require(_0xd594('0x8'));var config=require('../../config/environment');var controller=require(_0xd594('0x9'));router[_0xd594('0xa')]('/',auth[_0xd594('0xb')](),controller[_0xd594('0xc')]);router[_0xd594('0xa')](_0xd594('0xd'),auth[_0xd594('0xb')](),controller[_0xd594('0xe')]);router['get']('/:id',auth[_0xd594('0xb')](),controller[_0xd594('0xf')]);router[_0xd594('0x10')]('/',auth[_0xd594('0xb')](),controller[_0xd594('0x11')]);router[_0xd594('0x12')](_0xd594('0x13'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xd594('0x13'),auth[_0xd594('0xb')](),controller[_0xd594('0x14')]);module[_0xd594('0x15')]=router; \ No newline at end of file +var _0x4535=['destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','describe','/:id','show','post','create','update','delete'];(function(_0x56138f,_0x1e9ebb){var _0x1acaf7=function(_0x48690d){while(--_0x48690d){_0x56138f['push'](_0x56138f['shift']());}};_0x1acaf7(++_0x1e9ebb);}(_0x4535,0xc8));var _0x5453=function(_0x3672b0,_0x2aa048){_0x3672b0=_0x3672b0-0x0;var _0x166311=_0x4535[_0x3672b0];return _0x166311;};'use strict';var multer=require('multer');var util=require(_0x5453('0x0'));var path=require(_0x5453('0x1'));var timeout=require(_0x5453('0x2'));var express=require(_0x5453('0x3'));var router=express[_0x5453('0x4')]();var fs_extra=require(_0x5453('0x5'));var auth=require(_0x5453('0x6'));var interaction=require(_0x5453('0x7'));var config=require(_0x5453('0x8'));var controller=require(_0x5453('0x9'));router[_0x5453('0xa')]('/',auth[_0x5453('0xb')](),controller[_0x5453('0xc')]);router['get']('/describe',auth[_0x5453('0xb')](),controller[_0x5453('0xd')]);router[_0x5453('0xa')](_0x5453('0xe'),auth[_0x5453('0xb')](),controller[_0x5453('0xf')]);router[_0x5453('0x10')]('/',auth[_0x5453('0xb')](),controller[_0x5453('0x11')]);router['put'](_0x5453('0xe'),auth['isAuthenticated'](),controller[_0x5453('0x12')]);router[_0x5453('0x13')](_0x5453('0xe'),auth[_0x5453('0xb')](),controller[_0x5453('0x14')]);module[_0x5453('0x15')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 750aef5..326fc73 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 _0x08e7=['STRING','ENUM','mouseOver','exports'];(function(_0x458295,_0x519262){var _0xf90669=function(_0x2bec05){while(--_0x2bec05){_0x458295['push'](_0x458295['shift']());}};_0xf90669(++_0x519262);}(_0x08e7,0x1d3));var _0x708e=function(_0x388315,_0x16d4f3){_0x388315=_0x388315-0x0;var _0x1538fd=_0x08e7[_0x388315];return _0x1538fd;};'use strict';var Sequelize=require('sequelize');module[_0x708e('0x0')]={'name':{'type':Sequelize[_0x708e('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x708e('0x2')](_0x708e('0x3'),'timeout'),'defaultValue':_0x708e('0x3')},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xa46f=['STRING','exports','mouseOver'];(function(_0x2ae6e9,_0x12fa0d){var _0x4174e0=function(_0x438626){while(--_0x438626){_0x2ae6e9['push'](_0x2ae6e9['shift']());}};_0x4174e0(++_0x12fa0d);}(_0xa46f,0x19f));var _0xfa46=function(_0x172948,_0x4262cc){_0x172948=_0x172948-0x0;var _0x4aeaa9=_0xa46f[_0x172948];return _0x4aeaa9;};'use strict';var Sequelize=require('sequelize');module[_0xfa46('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xfa46('0x1'),'timeout'),'defaultValue':_0xfa46('0x1')},'selector':{'type':Sequelize[_0xfa46('0x2')]},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index e9ca2a3..2283706 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 _0x3e74=['jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','json','undefined','limit','offset','count','status','set','Content-Range','apply','save','update','then','destroy','sendStatus','name','send','show','params','model','keys','ChatProactiveAction','rawAttributes','query','filters','intersection','fields','attributes','length','merge','options','find','body','catch','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0x3e74,0x175));var _0x43e7=function(_0x122548,_0x4287cd){_0x122548=_0x122548-0x0;var _0x7e9ea6=_0x3e74[_0x122548];return _0x7e9ea6;};'use strict';var emlformat=require(_0x43e7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x43e7('0x1'));var jsonpatch=require(_0x43e7('0x2'));var rp=require(_0x43e7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x43e7('0x4'));var util=require('util');var path=require(_0x43e7('0x5'));var sox=require(_0x43e7('0x6'));var csv=require(_0x43e7('0x7'));var ejs=require(_0x43e7('0x8'));var fs=require('fs');var fs_extra=require(_0x43e7('0x9'));var _=require('lodash');var squel=require(_0x43e7('0xa'));var crypto=require(_0x43e7('0xb'));var jsforce=require(_0x43e7('0xc'));var deskjs=require(_0x43e7('0xd'));var toCsv=require(_0x43e7('0x7'));var querystring=require('querystring');var Papa=require(_0x43e7('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x43e7('0xf'));var as=require(_0x43e7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x43e7('0x11'))('api');var utils=require(_0x43e7('0x12'));var config=require(_0x43e7('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x43e7('0x14'))['db'];function respondWithStatusCode(_0xc960ea,_0x2718d3){_0x2718d3=_0x2718d3||0xcc;return function(_0x3bb83f){if(_0x3bb83f){return _0xc960ea['sendStatus'](_0x2718d3);}return _0xc960ea['status'](_0x2718d3)[_0x43e7('0x15')]();};}function respondWithResult(_0x21fdd3,_0x44b0bd){_0x44b0bd=_0x44b0bd||0xc8;return function(_0x51b974){if(_0x51b974){return _0x21fdd3['status'](_0x44b0bd)[_0x43e7('0x16')](_0x51b974);}};}function respondWithFilteredResult(_0x14c146,_0x203378){return function(_0x328445){if(_0x328445){var _0x4de324=typeof _0x203378['offset']===_0x43e7('0x17')&&typeof _0x203378[_0x43e7('0x18')]===_0x43e7('0x17');var _0x5d346f=_0x328445['count'];var _0x446986=_0x4de324?0x0:_0x203378[_0x43e7('0x19')];var _0x9037d3=_0x4de324?_0x328445[_0x43e7('0x1a')]:_0x203378[_0x43e7('0x19')]+_0x203378[_0x43e7('0x18')];var _0x619236;if(_0x9037d3>=_0x5d346f){_0x9037d3=_0x5d346f;_0x619236=0xc8;}else{_0x619236=0xce;}_0x14c146[_0x43e7('0x1b')](_0x619236);return _0x14c146[_0x43e7('0x1c')](_0x43e7('0x1d'),_0x446986+'-'+_0x9037d3+'/'+_0x5d346f)[_0x43e7('0x16')](_0x328445);}return null;};}function patchUpdates(_0x177ee1){return function(_0x4b5d64){try{jsonpatch[_0x43e7('0x1e')](_0x4b5d64,_0x177ee1,!![]);}catch(_0x3c6625){return BPromise['reject'](_0x3c6625);}return _0x4b5d64[_0x43e7('0x1f')]();};}function saveUpdates(_0x3e281e,_0x3945bb){return function(_0x28aacc){if(_0x28aacc){return _0x28aacc[_0x43e7('0x20')](_0x3e281e)[_0x43e7('0x21')](function(_0x54a9e7){return _0x54a9e7;});}return null;};}function removeEntity(_0x454359,_0x4eea52){return function(_0x4c9df3){if(_0x4c9df3){return _0x4c9df3[_0x43e7('0x22')]()[_0x43e7('0x21')](function(){_0x454359['status'](0xcc)[_0x43e7('0x15')]();});}};}function handleEntityNotFound(_0x4ca5cf,_0x326dab){return function(_0x5c5e67){if(!_0x5c5e67){_0x4ca5cf[_0x43e7('0x23')](0x194);}return _0x5c5e67;};}function handleError(_0x1b5f50,_0x20888b){_0x20888b=_0x20888b||0x1f4;return function(_0x405f85){logger['error'](_0x405f85['stack']);if(_0x405f85[_0x43e7('0x24')]){delete _0x405f85['name'];}_0x1b5f50[_0x43e7('0x1b')](_0x20888b)[_0x43e7('0x25')](_0x405f85);};}exports[_0x43e7('0x26')]=function(_0xb1fc63,_0x5087d7){var _0x33a1a5={'raw':!![],'where':{'id':_0xb1fc63[_0x43e7('0x27')]['id']}},_0x4690a6={};_0x4690a6[_0x43e7('0x28')]=_[_0x43e7('0x29')](db[_0x43e7('0x2a')][_0x43e7('0x2b')]);_0x4690a6[_0x43e7('0x2c')]=_[_0x43e7('0x29')](_0xb1fc63[_0x43e7('0x2c')]);_0x4690a6[_0x43e7('0x2d')]=_[_0x43e7('0x2e')](_0x4690a6[_0x43e7('0x28')],_0x4690a6[_0x43e7('0x2c')]);_0x33a1a5['attributes']=_[_0x43e7('0x2e')](_0x4690a6[_0x43e7('0x28')],qs[_0x43e7('0x2f')](_0xb1fc63[_0x43e7('0x2c')][_0x43e7('0x2f')]));_0x33a1a5['attributes']=_0x33a1a5[_0x43e7('0x30')][_0x43e7('0x31')]?_0x33a1a5[_0x43e7('0x30')]:_0x4690a6[_0x43e7('0x28')];if(_0xb1fc63['query']['includeAll']){_0x33a1a5['include']=[{'all':!![]}];}_0x33a1a5=_[_0x43e7('0x32')]({},_0x33a1a5,_0xb1fc63[_0x43e7('0x33')]);return db[_0x43e7('0x2a')][_0x43e7('0x34')](_0x33a1a5)[_0x43e7('0x21')](handleEntityNotFound(_0x5087d7,null))[_0x43e7('0x21')](respondWithResult(_0x5087d7,null))['catch'](handleError(_0x5087d7,null));};exports['create']=function(_0x4ac23d,_0x59e5b2){return db['ChatProactiveAction']['create'](_0x4ac23d['body'],{})[_0x43e7('0x21')](respondWithResult(_0x59e5b2,0xc9))['catch'](handleError(_0x59e5b2,null));};exports[_0x43e7('0x20')]=function(_0x8e9f40,_0x31bc78){if(_0x8e9f40[_0x43e7('0x35')]['id']){delete _0x8e9f40[_0x43e7('0x35')]['id'];}return db[_0x43e7('0x2a')][_0x43e7('0x34')]({'where':{'id':_0x8e9f40['params']['id']}})['then'](handleEntityNotFound(_0x31bc78,null))['then'](saveUpdates(_0x8e9f40[_0x43e7('0x35')],null))[_0x43e7('0x21')](respondWithResult(_0x31bc78,null))[_0x43e7('0x36')](handleError(_0x31bc78,null));};exports[_0x43e7('0x22')]=function(_0x1b1440,_0x1ed538){return db[_0x43e7('0x2a')][_0x43e7('0x34')]({'where':{'id':_0x1b1440['params']['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x1ed538,null))[_0x43e7('0x21')](removeEntity(_0x1ed538,null))['catch'](handleError(_0x1ed538,null));}; \ No newline at end of file +var _0x861c=['reject','save','update','then','destroy','sendStatus','error','send','show','params','keys','ChatProactiveAction','rawAttributes','filters','intersection','model','query','fields','attributes','length','include','merge','options','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','status','offset','undefined','set','Content-Range','json','apply'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x861c,0xdb));var _0xc861=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x861c[_0x432682];return _0x463d05;};'use strict';var emlformat=require(_0xc861('0x0'));var rimraf=require(_0xc861('0x1'));var zipdir=require(_0xc861('0x2'));var jsonpatch=require(_0xc861('0x3'));var rp=require(_0xc861('0x4'));var moment=require(_0xc861('0x5'));var BPromise=require(_0xc861('0x6'));var Mustache=require(_0xc861('0x7'));var util=require(_0xc861('0x8'));var path=require(_0xc861('0x9'));var sox=require(_0xc861('0xa'));var csv=require(_0xc861('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc861('0xc'));var _=require(_0xc861('0xd'));var squel=require(_0xc861('0xe'));var crypto=require(_0xc861('0xf'));var jsforce=require(_0xc861('0x10'));var deskjs=require(_0xc861('0x11'));var toCsv=require(_0xc861('0xb'));var querystring=require(_0xc861('0x12'));var Papa=require(_0xc861('0x13'));var Redis=require(_0xc861('0x14'));var authService=require(_0xc861('0x15'));var qs=require(_0xc861('0x16'));var as=require(_0xc861('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc861('0x18'))(_0xc861('0x19'));var utils=require(_0xc861('0x1a'));var config=require(_0xc861('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0xc861('0x1c'))['db'];function respondWithStatusCode(_0x2404f6,_0x1f4dcb){_0x1f4dcb=_0x1f4dcb||0xcc;return function(_0x145b5f){if(_0x145b5f){return _0x2404f6['sendStatus'](_0x1f4dcb);}return _0x2404f6['status'](_0x1f4dcb)[_0xc861('0x1d')]();};}function respondWithResult(_0x289a68,_0x5f3c1a){_0x5f3c1a=_0x5f3c1a||0xc8;return function(_0x190fab){if(_0x190fab){return _0x289a68[_0xc861('0x1e')](_0x5f3c1a)['json'](_0x190fab);}};}function respondWithFilteredResult(_0x21941e,_0x3ca46d){return function(_0x2e2b94){if(_0x2e2b94){var _0xd8e34a=typeof _0x3ca46d[_0xc861('0x1f')]===_0xc861('0x20')&&typeof _0x3ca46d['limit']==='undefined';var _0x44a1fb=_0x2e2b94['count'];var _0x5a2ecd=_0xd8e34a?0x0:_0x3ca46d[_0xc861('0x1f')];var _0x42d2b9=_0xd8e34a?_0x2e2b94['count']:_0x3ca46d[_0xc861('0x1f')]+_0x3ca46d['limit'];var _0x1613ee;if(_0x42d2b9>=_0x44a1fb){_0x42d2b9=_0x44a1fb;_0x1613ee=0xc8;}else{_0x1613ee=0xce;}_0x21941e[_0xc861('0x1e')](_0x1613ee);return _0x21941e[_0xc861('0x21')](_0xc861('0x22'),_0x5a2ecd+'-'+_0x42d2b9+'/'+_0x44a1fb)[_0xc861('0x23')](_0x2e2b94);}return null;};}function patchUpdates(_0x331516){return function(_0x30ebe4){try{jsonpatch[_0xc861('0x24')](_0x30ebe4,_0x331516,!![]);}catch(_0x3cbd2d){return BPromise[_0xc861('0x25')](_0x3cbd2d);}return _0x30ebe4[_0xc861('0x26')]();};}function saveUpdates(_0x6b9d80,_0x5c4c35){return function(_0xa9d8bc){if(_0xa9d8bc){return _0xa9d8bc[_0xc861('0x27')](_0x6b9d80)[_0xc861('0x28')](function(_0x4cfd43){return _0x4cfd43;});}return null;};}function removeEntity(_0x2cab96,_0xd1b342){return function(_0x172b90){if(_0x172b90){return _0x172b90[_0xc861('0x29')]()[_0xc861('0x28')](function(){_0x2cab96[_0xc861('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x11abae,_0x1bd814){return function(_0x9dc3){if(!_0x9dc3){_0x11abae[_0xc861('0x2a')](0x194);}return _0x9dc3;};}function handleError(_0x38a737,_0x1cefa7){_0x1cefa7=_0x1cefa7||0x1f4;return function(_0x48cf94){logger[_0xc861('0x2b')](_0x48cf94['stack']);if(_0x48cf94['name']){delete _0x48cf94['name'];}_0x38a737[_0xc861('0x1e')](_0x1cefa7)[_0xc861('0x2c')](_0x48cf94);};}exports[_0xc861('0x2d')]=function(_0x30b9f4,_0x2f3790){var _0xff9c32={'raw':!![],'where':{'id':_0x30b9f4[_0xc861('0x2e')]['id']}},_0x431695={};_0x431695['model']=_[_0xc861('0x2f')](db[_0xc861('0x30')][_0xc861('0x31')]);_0x431695['query']=_[_0xc861('0x2f')](_0x30b9f4['query']);_0x431695[_0xc861('0x32')]=_[_0xc861('0x33')](_0x431695[_0xc861('0x34')],_0x431695[_0xc861('0x35')]);_0xff9c32['attributes']=_[_0xc861('0x33')](_0x431695[_0xc861('0x34')],qs[_0xc861('0x36')](_0x30b9f4[_0xc861('0x35')][_0xc861('0x36')]));_0xff9c32[_0xc861('0x37')]=_0xff9c32[_0xc861('0x37')][_0xc861('0x38')]?_0xff9c32[_0xc861('0x37')]:_0x431695['model'];if(_0x30b9f4[_0xc861('0x35')]['includeAll']){_0xff9c32[_0xc861('0x39')]=[{'all':!![]}];}_0xff9c32=_[_0xc861('0x3a')]({},_0xff9c32,_0x30b9f4[_0xc861('0x3b')]);return db[_0xc861('0x30')][_0xc861('0x3c')](_0xff9c32)[_0xc861('0x28')](handleEntityNotFound(_0x2f3790,null))[_0xc861('0x28')](respondWithResult(_0x2f3790,null))[_0xc861('0x3d')](handleError(_0x2f3790,null));};exports[_0xc861('0x3e')]=function(_0xae9e69,_0x26d9a3){return db[_0xc861('0x30')]['create'](_0xae9e69[_0xc861('0x3f')],{})[_0xc861('0x28')](respondWithResult(_0x26d9a3,0xc9))[_0xc861('0x3d')](handleError(_0x26d9a3,null));};exports[_0xc861('0x27')]=function(_0x43e5e9,_0x34c287){if(_0x43e5e9[_0xc861('0x3f')]['id']){delete _0x43e5e9[_0xc861('0x3f')]['id'];}return db[_0xc861('0x30')][_0xc861('0x3c')]({'where':{'id':_0x43e5e9['params']['id']}})[_0xc861('0x28')](handleEntityNotFound(_0x34c287,null))['then'](saveUpdates(_0x43e5e9[_0xc861('0x3f')],null))[_0xc861('0x28')](respondWithResult(_0x34c287,null))[_0xc861('0x3d')](handleError(_0x34c287,null));};exports[_0xc861('0x29')]=function(_0x4b409c,_0x5aa93e){return db[_0xc861('0x30')]['find']({'where':{'id':_0x4b409c[_0xc861('0x2e')]['id']}})[_0xc861('0x28')](handleEntityNotFound(_0x5aa93e,null))[_0xc861('0x28')](removeEntity(_0x5aa93e,null))['catch'](handleError(_0x5aa93e,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 0bd2571..f3344f5 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 _0x0d0d=['path','rimraf','../../config/environment','./chatProactiveAction.attributes','exports','define','ChatProactiveAction','chat_proactive_actions','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x1f069b,_0x4709b5){var _0x1eae54=function(_0x5eabd6){while(--_0x5eabd6){_0x1f069b['push'](_0x1f069b['shift']());}};_0x1eae54(++_0x4709b5);}(_0x0d0d,0x158));var _0xd0d0=function(_0x286114,_0x4bf1ae){_0x286114=_0x286114-0x0;var _0x3496cb=_0x0d0d[_0x286114];return _0x3496cb;};'use strict';var _=require(_0xd0d0('0x0'));var util=require(_0xd0d0('0x1'));var logger=require(_0xd0d0('0x2'))(_0xd0d0('0x3'));var moment=require(_0xd0d0('0x4'));var BPromise=require(_0xd0d0('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd0d0('0x6'));var rimraf=require(_0xd0d0('0x7'));var config=require(_0xd0d0('0x8'));var attributes=require(_0xd0d0('0x9'));module[_0xd0d0('0xa')]=function(_0x59b44b,_0x4dbd48){return _0x59b44b[_0xd0d0('0xb')](_0xd0d0('0xc'),attributes,{'tableName':_0xd0d0('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4505=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatProactiveAction.attributes','exports','define','ChatProactiveAction','chat_proactive_actions','lodash','util','../../config/logger'];(function(_0x133798,_0x3810b4){var _0x591178=function(_0x455b20){while(--_0x455b20){_0x133798['push'](_0x133798['shift']());}};_0x591178(++_0x3810b4);}(_0x4505,0xfc));var _0x5450=function(_0x28d18d,_0x55896b){_0x28d18d=_0x28d18d-0x0;var _0x470640=_0x4505[_0x28d18d];return _0x470640;};'use strict';var _=require(_0x5450('0x0'));var util=require(_0x5450('0x1'));var logger=require(_0x5450('0x2'))(_0x5450('0x3'));var moment=require(_0x5450('0x4'));var BPromise=require(_0x5450('0x5'));var rp=require(_0x5450('0x6'));var fs=require('fs');var path=require(_0x5450('0x7'));var rimraf=require(_0x5450('0x8'));var config=require(_0x5450('0x9'));var attributes=require(_0x5450('0xa'));module[_0x5450('0xb')]=function(_0x4fa62e,_0x393680){return _0x4fa62e[_0x5450('0xc')](_0x5450('0xd'),attributes,{'tableName':_0x5450('0xe'),'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 428ba4d..12ea554 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 _0x3187=['ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','request','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1445ff,_0x3edc98){var _0x2c2eb1=function(_0x152a04){while(--_0x152a04){_0x1445ff['push'](_0x1445ff['shift']());}};_0x2c2eb1(++_0x3edc98);}(_0x3187,0x1bf));var _0x7318=function(_0x10a872,_0x1f4ebd){_0x10a872=_0x10a872-0x0;var _0x52a39f=_0x3187[_0x10a872];return _0x52a39f;};'use strict';var _=require(_0x7318('0x0'));var util=require('util');var moment=require(_0x7318('0x1'));var BPromise=require(_0x7318('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7318('0x3'));var db=require(_0x7318('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7318('0x5'))('rpc');var config=require(_0x7318('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x7318('0x7')][_0x7318('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x225f69,_0x91ea41,_0x4c0391){return new BPromise(function(_0x5ecd68,_0x3eac14){return client[_0x7318('0x9')](_0x225f69,_0x4c0391)[_0x7318('0xa')](function(_0x47b603){logger[_0x7318('0xb')](_0x7318('0xc'),_0x91ea41,_0x7318('0xd'));logger[_0x7318('0xe')](_0x7318('0xf'),_0x91ea41,'request\x20sent',JSON[_0x7318('0x10')](_0x47b603));if(_0x47b603[_0x7318('0x11')]){if(_0x47b603['error'][_0x7318('0x12')]===0x1f4){logger[_0x7318('0x11')](_0x7318('0xc'),_0x91ea41,_0x47b603['error'][_0x7318('0x13')]);return _0x3eac14(_0x47b603[_0x7318('0x11')]['message']);}logger['error'](_0x7318('0xc'),_0x91ea41,_0x47b603[_0x7318('0x11')][_0x7318('0x13')]);return _0x5ecd68(_0x47b603[_0x7318('0x11')][_0x7318('0x13')]);}else{logger[_0x7318('0xb')](_0x7318('0xc'),_0x91ea41,'request\x20sent');_0x5ecd68(_0x47b603[_0x7318('0x14')][_0x7318('0x13')]);}})[_0x7318('0x15')](function(_0x1838c3){logger[_0x7318('0x11')](_0x7318('0xc'),_0x91ea41,_0x1838c3);_0x3eac14(_0x1838c3);});});} \ No newline at end of file +var _0x86e3=['../../config/environment','client','http','request','then','info','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','error','ChatProactiveAction,\x20%s,\x20%s','message','result','catch','lodash','bluebird','../../config/logger','rpc'];(function(_0x130fab,_0x3f5f1e){var _0x29cb73=function(_0x22b1b5){while(--_0x22b1b5){_0x130fab['push'](_0x130fab['shift']());}};_0x29cb73(++_0x3f5f1e);}(_0x86e3,0x1ac));var _0x386e=function(_0x484bf4,_0x2b975c){_0x484bf4=_0x484bf4-0x0;var _0x31c683=_0x86e3[_0x484bf4];return _0x31c683;};'use strict';var _=require(_0x386e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x386e('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x386e('0x2'))(_0x386e('0x3'));var config=require(_0x386e('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x386e('0x5')][_0x386e('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x2a0c95,_0x15e00f,_0x222f61){return new BPromise(function(_0x3d3edf,_0x144e81){return client[_0x386e('0x7')](_0x2a0c95,_0x222f61)[_0x386e('0x8')](function(_0x4bf3d3){logger[_0x386e('0x9')]('ChatProactiveAction,\x20%s,\x20%s',_0x15e00f,_0x386e('0xa'));logger[_0x386e('0xb')](_0x386e('0xc'),_0x15e00f,_0x386e('0xa'),JSON['stringify'](_0x4bf3d3));if(_0x4bf3d3['error']){if(_0x4bf3d3[_0x386e('0xd')]['code']===0x1f4){logger[_0x386e('0xd')](_0x386e('0xe'),_0x15e00f,_0x4bf3d3['error'][_0x386e('0xf')]);return _0x144e81(_0x4bf3d3[_0x386e('0xd')]['message']);}logger['error'](_0x386e('0xe'),_0x15e00f,_0x4bf3d3[_0x386e('0xd')][_0x386e('0xf')]);return _0x3d3edf(_0x4bf3d3['error']['message']);}else{logger[_0x386e('0x9')](_0x386e('0xe'),_0x15e00f,_0x386e('0xa'));_0x3d3edf(_0x4bf3d3[_0x386e('0x10')][_0x386e('0xf')]);}})[_0x386e('0x11')](function(_0x171a13){logger[_0x386e('0xd')](_0x386e('0xe'),_0x15e00f,_0x171a13);_0x144e81(_0x171a13);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 0bda552..adb6376 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 _0x98a8=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','show','isAuthenticated','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x3a9635,_0x1ab817){var _0x10d08c=function(_0x222242){while(--_0x222242){_0x3a9635['push'](_0x3a9635['shift']());}};_0x10d08c(++_0x1ab817);}(_0x98a8,0x12c));var _0x898a=function(_0x2452c4,_0xc173ab){_0x2452c4=_0x2452c4-0x0;var _0x38b11d=_0x98a8[_0x2452c4];return _0x38b11d;};'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')](_0x898a('0xb'),auth['isAuthenticated'](),controller[_0x898a('0xc')]);router['post']('/',auth[_0x898a('0xd')](),controller['create']);router[_0x898a('0xe')](_0x898a('0xb'),auth[_0x898a('0xd')](),controller[_0x898a('0xf')]);router[_0x898a('0x10')](_0x898a('0xb'),auth[_0x898a('0xd')](),controller[_0x898a('0x11')]);module[_0x898a('0x12')]=router; \ No newline at end of file +var _0xdbf5=['post','put','update','delete','destroy','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated','show'];(function(_0x2c8ace,_0x1f5ba0){var _0x4ec4ec=function(_0x1e0535){while(--_0x1e0535){_0x2c8ace['push'](_0x2c8ace['shift']());}};_0x4ec4ec(++_0x1f5ba0);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x3c13ff,_0x2792ed){_0x3c13ff=_0x3c13ff-0x0;var _0x1b3880=_0xdbf5[_0x3c13ff];return _0x1b3880;};'use strict';var multer=require('multer');var util=require(_0x5dbf('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5dbf('0x1'));var router=express[_0x5dbf('0x2')]();var fs_extra=require(_0x5dbf('0x3'));var auth=require(_0x5dbf('0x4'));var interaction=require(_0x5dbf('0x5'));var config=require(_0x5dbf('0x6'));var controller=require(_0x5dbf('0x7'));router[_0x5dbf('0x8')](_0x5dbf('0x9'),auth[_0x5dbf('0xa')](),controller[_0x5dbf('0xb')]);router[_0x5dbf('0xc')]('/',auth[_0x5dbf('0xa')](),controller['create']);router[_0x5dbf('0xd')]('/:id',auth[_0x5dbf('0xa')](),controller[_0x5dbf('0xe')]);router[_0x5dbf('0xf')](_0x5dbf('0x9'),auth['isAuthenticated'](),controller[_0x5dbf('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 99726b5..4f99abe 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 _0x774b=['name','STRING','INTEGER','ENUM','rrmemory','beepall','sequelize','exports'];(function(_0x49d41c,_0x2bdc35){var _0xb64c5f=function(_0x28f535){while(--_0x28f535){_0x49d41c['push'](_0x49d41c['shift']());}};_0xb64c5f(++_0x2bdc35);}(_0x774b,0x15e));var _0xb774=function(_0x2d31bf,_0x5b6bc0){_0x2d31bf=_0x2d31bf-0x0;var _0x525086=_0x774b[_0x2d31bf];return _0x525086;};'use strict';var Sequelize=require(_0xb774('0x0'));module[_0xb774('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xb774('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xb774('0x3')]},'timeout':{'type':Sequelize[_0xb774('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xb774('0x5')](_0xb774('0x6'),_0xb774('0x7'),'roundrobin')}}; \ No newline at end of file +var _0x3a7f=['roundrobin','sequelize','STRING','INTEGER','ENUM','rrmemory'];(function(_0x4fbdc0,_0x5bf025){var _0x2ed5b4=function(_0x1d87f0){while(--_0x1d87f0){_0x4fbdc0['push'](_0x4fbdc0['shift']());}};_0x2ed5b4(++_0x5bf025);}(_0x3a7f,0x133));var _0xf3a7=function(_0x4f2644,_0x174864){_0x4f2644=_0x4f2644-0x0;var _0x43ffa1=_0x3a7f[_0x4f2644];return _0x43ffa1;};'use strict';var Sequelize=require(_0xf3a7('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xf3a7('0x1')]},'timeout':{'type':Sequelize[_0xf3a7('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xf3a7('0x3')](_0xf3a7('0x4'),'beepall',_0xf3a7('0x5'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 0830fac..fed4637 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 _0xd488=['removeAgents','userChatQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','socket.io-emitter','redis','./chatQueue.socket','register','client','http','then','ChatQueue,\x20%s,\x20%s','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','undefined','limit','count','Content-Range','apply','reject','update','destroy','get','ChatQueues','end','stack','name','send','index','ChatQueue','rawAttributes','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','merge','type','VIRTUAL','filter','options','include','findAll','rows','show','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserChatQueue','ChatQueueId','User','UserId','updatedAt','createdAt','getTeams','Team','pick','map','addTeams','Agents','online','interface','flatMap','transaction','each','forEach','emit','userChatQueue:save','ids','field','tq.TeamId','from','join','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','sequelize','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','removeTeams','isEmpty'];(function(_0x27b2f6,_0x38347d){var _0xd3d82f=function(_0x463ed6){while(--_0x463ed6){_0x27b2f6['push'](_0x27b2f6['shift']());}};_0xd3d82f(++_0x38347d);}(_0xd488,0x9d));var _0x8d48=function(_0x332edd,_0x30528b){_0x332edd=_0x332edd-0x0;var _0x310417=_0xd488[_0x332edd];return _0x310417;};'use strict';var emlformat=require(_0x8d48('0x0'));var rimraf=require(_0x8d48('0x1'));var zipdir=require(_0x8d48('0x2'));var jsonpatch=require(_0x8d48('0x3'));var rp=require(_0x8d48('0x4'));var moment=require('moment');var BPromise=require(_0x8d48('0x5'));var Mustache=require(_0x8d48('0x6'));var util=require(_0x8d48('0x7'));var path=require(_0x8d48('0x8'));var sox=require(_0x8d48('0x9'));var csv=require(_0x8d48('0xa'));var ejs=require(_0x8d48('0xb'));var fs=require('fs');var fs_extra=require(_0x8d48('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x8d48('0xd'));var jsforce=require(_0x8d48('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x8d48('0xa'));var querystring=require(_0x8d48('0xf'));var Papa=require(_0x8d48('0x10'));var Redis=require(_0x8d48('0x11'));var authService=require(_0x8d48('0x12'));var qs=require(_0x8d48('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8d48('0x14'));var logger=require(_0x8d48('0x15'))(_0x8d48('0x16'));var utils=require(_0x8d48('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x8d48('0x18'));var db=require(_0x8d48('0x19'))['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x8d48('0x1a'))(new Redis(config[_0x8d48('0x1b')]));require(_0x8d48('0x1c'))[_0x8d48('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0x8d48('0x1e')][_0x8d48('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x32bb74,_0x4959b3,_0x40baa6,_0x21d1f7){return new BPromise(function(_0x345f8b,_0x1be4af){var _0x303028=_0x21d1f7||client;return _0x303028['request'](_0x32bb74,_0x40baa6)[_0x8d48('0x20')](function(_0x4c0082){logger['info'](_0x8d48('0x21'),_0x4959b3,_0x8d48('0x22'));logger['debug'](_0x8d48('0x23'),_0x4959b3,_0x8d48('0x22'),JSON[_0x8d48('0x24')](_0x4c0082));if(_0x4c0082['error']){if(_0x4c0082[_0x8d48('0x25')][_0x8d48('0x26')]===0x1f4){logger['error'](_0x8d48('0x21'),_0x4959b3,_0x4c0082['error'][_0x8d48('0x27')]);return _0x1be4af(_0x4c0082[_0x8d48('0x25')][_0x8d48('0x27')]);}logger[_0x8d48('0x25')]('ChatQueue,\x20%s,\x20%s',_0x4959b3,_0x4c0082[_0x8d48('0x25')]['message']);return _0x345f8b(_0x4c0082['error'][_0x8d48('0x27')]);}else{logger[_0x8d48('0x28')](_0x8d48('0x21'),_0x4959b3,_0x8d48('0x22'));_0x345f8b(_0x4c0082[_0x8d48('0x29')][_0x8d48('0x27')]);}})[_0x8d48('0x2a')](function(_0x346f3a){logger[_0x8d48('0x25')](_0x8d48('0x21'),_0x4959b3,_0x346f3a);_0x1be4af(_0x346f3a);});});}function respondWithStatusCode(_0x9ecc6d,_0x4383e0){_0x4383e0=_0x4383e0||0xcc;return function(_0x12295f){if(_0x12295f){return _0x9ecc6d[_0x8d48('0x2b')](_0x4383e0);}return _0x9ecc6d[_0x8d48('0x2c')](_0x4383e0)['end']();};}function respondWithResult(_0xbb86d,_0x4ea756){_0x4ea756=_0x4ea756||0xc8;return function(_0x5a9a42){if(_0x5a9a42){return _0xbb86d[_0x8d48('0x2c')](_0x4ea756)['json'](_0x5a9a42);}};}function respondWithFilteredResult(_0x28b2c0,_0x4a63a6){return function(_0x43a9cc){if(_0x43a9cc){var _0x79f8a0=typeof _0x4a63a6['offset']===_0x8d48('0x2d')&&typeof _0x4a63a6[_0x8d48('0x2e')]===_0x8d48('0x2d');var _0x54c80f=_0x43a9cc[_0x8d48('0x2f')];var _0x3a392d=_0x79f8a0?0x0:_0x4a63a6['offset'];var _0x29a66c=_0x79f8a0?_0x43a9cc['count']:_0x4a63a6['offset']+_0x4a63a6[_0x8d48('0x2e')];var _0x16371a;if(_0x29a66c>=_0x54c80f){_0x29a66c=_0x54c80f;_0x16371a=0xc8;}else{_0x16371a=0xce;}_0x28b2c0['status'](_0x16371a);return _0x28b2c0['set'](_0x8d48('0x30'),_0x3a392d+'-'+_0x29a66c+'/'+_0x54c80f)['json'](_0x43a9cc);}return null;};}function patchUpdates(_0x390c7e){return function(_0x24a324){try{jsonpatch[_0x8d48('0x31')](_0x24a324,_0x390c7e,!![]);}catch(_0x216279){return BPromise[_0x8d48('0x32')](_0x216279);}return _0x24a324['save']();};}function saveUpdates(_0x3143c3,_0x3e9177){return function(_0xa874f7){if(_0xa874f7){return _0xa874f7[_0x8d48('0x33')](_0x3143c3)['then'](function(_0x3909da){return _0x3909da;});}return null;};}function removeEntity(_0x81fe4a,_0x1f50bd){return function(_0x2588fc){if(_0x2588fc){return _0x2588fc[_0x8d48('0x34')]()[_0x8d48('0x20')](function(){var _0x4a1f6b=_0x2588fc[_0x8d48('0x35')]({'plain':!![]});var _0xc5108f=_0x8d48('0x36');return db['UserProfileResource']['destroy']({'where':{'type':_0xc5108f,'resourceId':_0x4a1f6b['id']}})['then'](function(){return _0x2588fc;});})[_0x8d48('0x20')](function(){_0x81fe4a[_0x8d48('0x2c')](0xcc)[_0x8d48('0x37')]();});}};}function handleEntityNotFound(_0x196329,_0x3db33e){return function(_0x2139de){if(!_0x2139de){_0x196329[_0x8d48('0x2b')](0x194);}return _0x2139de;};}function handleError(_0x46035d,_0x21c843){_0x21c843=_0x21c843||0x1f4;return function(_0x343a35){logger[_0x8d48('0x25')](_0x343a35[_0x8d48('0x38')]);if(_0x343a35['name']){delete _0x343a35[_0x8d48('0x39')];}_0x46035d[_0x8d48('0x2c')](_0x21c843)[_0x8d48('0x3a')](_0x343a35);};}exports[_0x8d48('0x3b')]=function(_0xd277f6,_0x5126c5){var _0x15f500={},_0xe39bfc={},_0x50cbd5={'count':0x0,'rows':[]};var _0x55e480=_['map'](db[_0x8d48('0x3c')][_0x8d48('0x3d')],function(_0x442f70){return{'name':_0x442f70['fieldName'],'type':_0x442f70['type'][_0x8d48('0x3e')]};});_0xe39bfc['model']=_['map'](_0x55e480,_0x8d48('0x39'));_0xe39bfc[_0x8d48('0x3f')]=_[_0x8d48('0x40')](_0xd277f6['query']);_0xe39bfc[_0x8d48('0x41')]=_['intersection'](_0xe39bfc[_0x8d48('0x42')],_0xe39bfc[_0x8d48('0x3f')]);_0x15f500[_0x8d48('0x43')]=_[_0x8d48('0x44')](_0xe39bfc['model'],qs[_0x8d48('0x45')](_0xd277f6[_0x8d48('0x3f')][_0x8d48('0x45')]));_0x15f500['attributes']=_0x15f500[_0x8d48('0x43')][_0x8d48('0x46')]?_0x15f500[_0x8d48('0x43')]:_0xe39bfc['model'];if(!_0xd277f6[_0x8d48('0x3f')][_0x8d48('0x47')](_0x8d48('0x48'))){_0x15f500[_0x8d48('0x2e')]=qs[_0x8d48('0x2e')](_0xd277f6['query'][_0x8d48('0x2e')]);_0x15f500[_0x8d48('0x49')]=qs[_0x8d48('0x49')](_0xd277f6['query'][_0x8d48('0x49')]);}_0x15f500[_0x8d48('0x4a')]=qs[_0x8d48('0x4b')](_0xd277f6[_0x8d48('0x3f')][_0x8d48('0x4b')]);_0x15f500['where']=qs[_0x8d48('0x41')](_['pick'](_0xd277f6[_0x8d48('0x3f')],_0xe39bfc[_0x8d48('0x41')]),_0x55e480);if(_0xd277f6[_0x8d48('0x3f')]['filter']){_0x15f500[_0x8d48('0x4c')]=_[_0x8d48('0x4d')](_0x15f500[_0x8d48('0x4c')],{'$or':_['map'](_0x55e480,function(_0x17da96){if(_0x17da96[_0x8d48('0x4e')]!==_0x8d48('0x4f')){var _0x4f7922={};_0x4f7922[_0x17da96[_0x8d48('0x39')]]={'$like':'%'+_0xd277f6['query'][_0x8d48('0x50')]+'%'};return _0x4f7922;}})});}_0x15f500=_[_0x8d48('0x4d')]({},_0x15f500,_0xd277f6[_0x8d48('0x51')]);var _0x336c62={'where':_0x15f500[_0x8d48('0x4c')]};return db[_0x8d48('0x3c')]['count'](_0x336c62)['then'](function(_0x102a9b){_0x50cbd5[_0x8d48('0x2f')]=_0x102a9b;if(_0xd277f6[_0x8d48('0x3f')]['includeAll']){_0x15f500[_0x8d48('0x52')]=[{'all':!![]}];}return db['ChatQueue'][_0x8d48('0x53')](_0x15f500);})[_0x8d48('0x20')](function(_0x217867){_0x50cbd5[_0x8d48('0x54')]=_0x217867;return _0x50cbd5;})[_0x8d48('0x20')](respondWithFilteredResult(_0x5126c5,_0x15f500))['catch'](handleError(_0x5126c5,null));};exports[_0x8d48('0x55')]=function(_0x33adce,_0x44ed3a){var _0x7013c4={'raw':!![],'where':{'id':_0x33adce[_0x8d48('0x56')]['id']}},_0x48c760={};_0x48c760[_0x8d48('0x42')]=_['keys'](db[_0x8d48('0x3c')][_0x8d48('0x3d')]);_0x48c760[_0x8d48('0x3f')]=_['keys'](_0x33adce[_0x8d48('0x3f')]);_0x48c760[_0x8d48('0x41')]=_[_0x8d48('0x44')](_0x48c760[_0x8d48('0x42')],_0x48c760[_0x8d48('0x3f')]);_0x7013c4['attributes']=_[_0x8d48('0x44')](_0x48c760['model'],qs['fields'](_0x33adce[_0x8d48('0x3f')][_0x8d48('0x45')]));_0x7013c4[_0x8d48('0x43')]=_0x7013c4[_0x8d48('0x43')]['length']?_0x7013c4[_0x8d48('0x43')]:_0x48c760['model'];if(_0x33adce[_0x8d48('0x3f')][_0x8d48('0x57')]){_0x7013c4['include']=[{'all':!![]}];}_0x7013c4=_['merge']({},_0x7013c4,_0x33adce['options']);return db[_0x8d48('0x3c')][_0x8d48('0x58')](_0x7013c4)[_0x8d48('0x20')](handleEntityNotFound(_0x44ed3a,null))[_0x8d48('0x20')](respondWithResult(_0x44ed3a,null))['catch'](handleError(_0x44ed3a,null));};exports[_0x8d48('0x59')]=function(_0x1f4c0f,_0x13db10){return db[_0x8d48('0x3c')][_0x8d48('0x59')](_0x1f4c0f[_0x8d48('0x5a')],{})[_0x8d48('0x20')](function(_0x45626e){var _0x23ca7d=_0x1f4c0f[_0x8d48('0x5b')][_0x8d48('0x35')]({'plain':!![]});if(!_0x23ca7d)throw new Error(_0x8d48('0x5c'));if(_0x23ca7d[_0x8d48('0x5d')]===_0x8d48('0x5b')){var _0x295802=_0x45626e[_0x8d48('0x35')]({'plain':!![]});var _0x108050=_0x8d48('0x36');return db[_0x8d48('0x5e')][_0x8d48('0x58')]({'where':{'name':_0x108050,'userProfileId':_0x23ca7d[_0x8d48('0x5f')]},'raw':!![]})['then'](function(_0x4293ae){if(_0x4293ae&&_0x4293ae[_0x8d48('0x60')]===0x0){return db[_0x8d48('0x61')][_0x8d48('0x59')]({'name':_0x295802[_0x8d48('0x39')],'resourceId':_0x295802['id'],'type':_0x4293ae[_0x8d48('0x39')],'sectionId':_0x4293ae['id']},{})['then'](function(){return _0x45626e;});}else{return _0x45626e;}})[_0x8d48('0x2a')](function(_0x57dc25){logger[_0x8d48('0x25')](_0x8d48('0x62'),_0x57dc25);throw _0x57dc25;});}return _0x45626e;})[_0x8d48('0x20')](respondWithResult(_0x13db10,0xc9))[_0x8d48('0x2a')](handleError(_0x13db10,null));};exports[_0x8d48('0x33')]=function(_0xf07e35,_0x2ee9ef){if(_0xf07e35[_0x8d48('0x5a')]['id']){delete _0xf07e35[_0x8d48('0x5a')]['id'];}return db['ChatQueue'][_0x8d48('0x58')]({'where':{'id':_0xf07e35['params']['id']}})[_0x8d48('0x20')](handleEntityNotFound(_0x2ee9ef,null))[_0x8d48('0x20')](saveUpdates(_0xf07e35[_0x8d48('0x5a')],null))[_0x8d48('0x20')](respondWithResult(_0x2ee9ef,null))[_0x8d48('0x2a')](handleError(_0x2ee9ef,null));};exports[_0x8d48('0x34')]=function(_0x2b033a,_0x390b3a){return db[_0x8d48('0x3c')]['find']({'where':{'id':_0x2b033a[_0x8d48('0x56')]['id']}})[_0x8d48('0x20')](handleEntityNotFound(_0x390b3a,null))[_0x8d48('0x20')](removeEntity(_0x390b3a,null))[_0x8d48('0x2a')](handleError(_0x390b3a,null));};exports[_0x8d48('0x63')]=function(_0x4cb962,_0xe2167a){return db['ChatQueue'][_0x8d48('0x63')]()['then'](respondWithResult(_0xe2167a,null))[_0x8d48('0x2a')](handleError(_0xe2167a,null));};exports[_0x8d48('0x64')]=function(_0x19a534,_0x6eee28,_0x426cd5){var _0x27caef={'raw':!![],'where':{}},_0x5aa5d8={},_0x26ce51;return db[_0x8d48('0x3c')][_0x8d48('0x65')]({'where':{'id':_0x19a534[_0x8d48('0x56')]['id']}})[_0x8d48('0x20')](handleEntityNotFound(_0x6eee28,null))[_0x8d48('0x20')](function(_0x1f31cc){if(_0x1f31cc){_0x26ce51=_0x1f31cc[_0x8d48('0x35')]({'plain':!![]});_0x5aa5d8[_0x8d48('0x42')]=_[_0x8d48('0x40')](db[_0x8d48('0x66')]['rawAttributes']);_0x5aa5d8[_0x8d48('0x3f')]=_[_0x8d48('0x40')](_0x19a534[_0x8d48('0x3f')]);_0x5aa5d8['filters']=_[_0x8d48('0x44')](_0x5aa5d8[_0x8d48('0x42')],_0x5aa5d8[_0x8d48('0x3f')]);_0x27caef[_0x8d48('0x43')]=_['intersection'](_0x5aa5d8['model'],qs[_0x8d48('0x45')](_0x19a534[_0x8d48('0x3f')][_0x8d48('0x45')]));_0x27caef[_0x8d48('0x43')]=_0x27caef['attributes']['length']?_0x27caef[_0x8d48('0x43')]:_0x5aa5d8[_0x8d48('0x42')];if(!_0x19a534[_0x8d48('0x3f')][_0x8d48('0x47')](_0x8d48('0x48'))){_0x27caef['limit']=qs[_0x8d48('0x2e')](_0x19a534[_0x8d48('0x3f')][_0x8d48('0x2e')]);_0x27caef[_0x8d48('0x49')]=qs['offset'](_0x19a534[_0x8d48('0x3f')][_0x8d48('0x49')]);}_0x27caef[_0x8d48('0x4a')]=qs['sort'](_0x19a534[_0x8d48('0x3f')][_0x8d48('0x4b')]);_0x27caef['where']=qs['filters'](_['pick'](_0x19a534[_0x8d48('0x3f')],_0x5aa5d8[_0x8d48('0x41')]));_0x27caef['where'][_0x8d48('0x67')]=_0x1f31cc['id'];if(_0x19a534[_0x8d48('0x3f')][_0x8d48('0x50')]){_0x27caef[_0x8d48('0x4c')]=_[_0x8d48('0x4d')](_0x27caef[_0x8d48('0x4c')],{'$or':_['map'](_0x27caef[_0x8d48('0x43')],function(_0x3ead0b){var _0x515ec3={};_0x515ec3[_0x3ead0b]={'$like':'%'+_0x19a534['query'][_0x8d48('0x50')]+'%'};return _0x515ec3;})});}_0x27caef=_[_0x8d48('0x4d')]({},_0x27caef,_0x19a534[_0x8d48('0x51')]);return db[_0x8d48('0x66')][_0x8d48('0x53')](_0x27caef);}})[_0x8d48('0x20')](function(_0x397259){if(_0x397259){return db[_0x8d48('0x68')]['findAndCountAll']({'where':{'id':_['map'](_0x397259,_0x8d48('0x69')),'role':'agent'},'attributes':['id',_0x8d48('0x39'),'chatPause',_0x8d48('0x6a'),_0x8d48('0x6b')]});}})[_0x8d48('0x20')](function(_0x275657){if(_0x275657){return{'count':_0x275657[_0x8d48('0x2f')],'rows':_['map'](_0x275657[_0x8d48('0x54')],function(_0x43fe2d){return{'membername':_0x43fe2d[_0x8d48('0x39')],'UserId':_0x43fe2d['id'],'queue_name':_0x26ce51['name'],'ChatQueueId':_0x26ce51['id'],'interface':util['format']('%s/%s','SIP',_0x43fe2d[_0x8d48('0x39')]),'penalty':0x0,'paused':_0x43fe2d['chatPause'],'createdAt':_0x43fe2d['createdAt'],'updatedAt':_0x43fe2d[_0x8d48('0x6a')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x8d48('0x20')](respondWithFilteredResult(_0x6eee28,_0x27caef))[_0x8d48('0x2a')](handleError(_0x6eee28,null));};exports[_0x8d48('0x6c')]=function(_0x20e78f,_0x37295c,_0x271e26){var _0x532142={};var _0x3647ce={};var _0x22fad2;var _0x4c5e07;return db[_0x8d48('0x3c')]['findOne']({'where':{'id':_0x20e78f[_0x8d48('0x56')]['id']}})[_0x8d48('0x20')](handleEntityNotFound(_0x37295c,null))['then'](function(_0x29d9a5){if(_0x29d9a5){_0x22fad2=_0x29d9a5;_0x3647ce[_0x8d48('0x42')]=_[_0x8d48('0x40')](db[_0x8d48('0x6d')][_0x8d48('0x3d')]);_0x3647ce[_0x8d48('0x3f')]=_['keys'](_0x20e78f[_0x8d48('0x3f')]);_0x3647ce[_0x8d48('0x41')]=_['intersection'](_0x3647ce[_0x8d48('0x42')],_0x3647ce[_0x8d48('0x3f')]);_0x532142['attributes']=_['intersection'](_0x3647ce[_0x8d48('0x42')],qs[_0x8d48('0x45')](_0x20e78f[_0x8d48('0x3f')][_0x8d48('0x45')]));_0x532142['attributes']=_0x532142[_0x8d48('0x43')][_0x8d48('0x46')]?_0x532142['attributes']:_0x3647ce['model'];_0x532142[_0x8d48('0x4a')]=qs[_0x8d48('0x4b')](_0x20e78f[_0x8d48('0x3f')]['sort']);_0x532142[_0x8d48('0x4c')]=qs[_0x8d48('0x41')](_[_0x8d48('0x6e')](_0x20e78f[_0x8d48('0x3f')],_0x3647ce[_0x8d48('0x41')]));if(_0x20e78f[_0x8d48('0x3f')][_0x8d48('0x50')]){_0x532142[_0x8d48('0x4c')]=_[_0x8d48('0x4d')](_0x532142[_0x8d48('0x4c')],{'$or':_[_0x8d48('0x6f')](_0x532142['attributes'],function(_0x3fd5ae){var _0x4c80ce={};_0x4c80ce[_0x3fd5ae]={'$like':'%'+_0x20e78f[_0x8d48('0x3f')]['filter']+'%'};return _0x4c80ce;})});}_0x532142=_['merge']({},_0x532142,_0x20e78f[_0x8d48('0x51')]);return _0x22fad2[_0x8d48('0x6c')](_0x532142);}})[_0x8d48('0x20')](function(_0xedf96c){if(_0xedf96c){_0x4c5e07=_0xedf96c[_0x8d48('0x46')];if(!_0x20e78f[_0x8d48('0x3f')]['hasOwnProperty']('nolimit')){_0x532142[_0x8d48('0x2e')]=qs[_0x8d48('0x2e')](_0x20e78f[_0x8d48('0x3f')][_0x8d48('0x2e')]);_0x532142[_0x8d48('0x49')]=qs[_0x8d48('0x49')](_0x20e78f[_0x8d48('0x3f')][_0x8d48('0x49')]);}return _0x22fad2[_0x8d48('0x6c')](_0x532142);}})[_0x8d48('0x20')](function(_0x26d066){if(_0x26d066){return _0x26d066?{'count':_0x4c5e07,'rows':_0x26d066}:null;}})[_0x8d48('0x20')](respondWithResult(_0x37295c,null))[_0x8d48('0x2a')](handleError(_0x37295c,null));};exports[_0x8d48('0x70')]=function(_0x124e87,_0x54ba91,_0xe11b25){var _0x1062fb=_0x124e87[_0x8d48('0x5a')]['ids'];return db[_0x8d48('0x6d')]['findAll']({'where':{'id':_0x1062fb},'attributes':['id'],'include':[{'model':db[_0x8d48('0x68')],'as':_0x8d48('0x71'),'attributes':['id','name',_0x8d48('0x72'),'voicePause',_0x8d48('0x73')],'raw':!![]}]})[_0x8d48('0x20')](function(_0x46885c){if(_0x46885c){var _0x4b6103=_[_0x8d48('0x74')](_0x46885c,function(_0x55189c){var _0x1fb3bd=_0x55189c[_0x8d48('0x35')]({'plain':!![]});return _0x1fb3bd[_0x8d48('0x71')];});return db['ChatQueue'][_0x8d48('0x58')]({'where':{'id':_0x124e87['params']['id']}})[_0x8d48('0x20')](function(_0x106044){return db['sequelize'][_0x8d48('0x75')](function(_0x404489){return _0x106044[_0x8d48('0x70')](_0x1062fb,{'transaction':_0x404489})['then'](function(){return BPromise[_0x8d48('0x76')](_0x4b6103,function(_0x57c032){return db[_0x8d48('0x66')]['findOrCreate']({'where':{'UserId':_0x57c032['id'],'ChatQueueId':_0x124e87['params']['id']},'transaction':_0x404489});});})[_0x8d48('0x20')](function(){_0x4b6103[_0x8d48('0x77')](function(_0x475cc2){socket[_0x8d48('0x78')](_0x8d48('0x79'),{'UserId':_0x475cc2['id'],'ChatQueueId':_0x106044['id']});});});});});}})[_0x8d48('0x20')](respondWithStatusCode(_0x54ba91,null))[_0x8d48('0x2a')](handleError(_0x54ba91,null));};exports['removeTeams']=function(_0x4d675a,_0x46a49f,_0x3f332b){return db[_0x8d48('0x6d')]['findAll']({'where':{'id':_0x4d675a['query'][_0x8d48('0x7a')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x8d48('0x71'),'attributes':['id'],'raw':!![]}]})[_0x8d48('0x20')](handleEntityNotFound(_0x46a49f,null))[_0x8d48('0x20')](function(_0x16e5c8){var _0x130753=_[_0x8d48('0x6f')](_0x16e5c8,'id');var _0x44d2c3=[];var _0x3743d5=[];var _0x18e946=squel['select']();_0x18e946[_0x8d48('0x7b')](_0x8d48('0x7c'))[_0x8d48('0x7d')]('team_has_chat_queues','tq')[_0x8d48('0x7e')]('user_has_teams','ut',_0x8d48('0x7f'))[_0x8d48('0x4c')](_0x8d48('0x80'),_0x4d675a['params']['id']);for(var _0x4df696=0x0;_0x4df696<_0x16e5c8['length'];_0x4df696+=0x1){let _0x2bfb60=_0x16e5c8[_0x4df696];for(var _0x4de26a=0x0;_0x4de26a<_0x2bfb60['Agents'][_0x8d48('0x46')];_0x4de26a+=0x1){let _0xdec739=_0x2bfb60[_0x8d48('0x71')][_0x4de26a];var _0x34aeb6=_0x18e946['clone']();_0x34aeb6[_0x8d48('0x4c')](_0x8d48('0x81'),_0xdec739['id']);_0x3743d5[_0x8d48('0x82')](db['sequelize'][_0x8d48('0x3f')](_0x34aeb6['toString'](),{'type':db[_0x8d48('0x83')][_0x8d48('0x84')][_0x8d48('0x85')]})[_0x8d48('0x20')](function(_0x5c67ee){if(_0x5c67ee[_0x8d48('0x46')]===0x1){return _0xdec739['id'];}else{var _0x24ef09=_[_0x8d48('0x86')](_[_0x8d48('0x6f')](_0x5c67ee,_0x8d48('0x87')),function(_0x4bd624){return _[_0x8d48('0x88')](_0x130753,_0x4bd624);});if(_0x24ef09){return _0xdec739['id'];}}}));}}return BPromise[_0x8d48('0x89')](_0x3743d5)[_0x8d48('0x20')](function(_0x187334){_0x44d2c3=_(_0x44d2c3)[_0x8d48('0x8a')](_0x187334)[_0x8d48('0x8b')]()[_0x8d48('0x8c')]();return db[_0x8d48('0x3c')][_0x8d48('0x58')]({'where':{'id':_0x4d675a[_0x8d48('0x56')]['id']}})[_0x8d48('0x20')](function(_0x1dc4b9){return db[_0x8d48('0x83')][_0x8d48('0x75')](function(_0x5e291f){return _0x1dc4b9[_0x8d48('0x8d')](_0x4d675a['query'][_0x8d48('0x7a')],{'transaction':_0x5e291f})[_0x8d48('0x20')](function(){if(!_[_0x8d48('0x8e')](_0x44d2c3)){return _0x1dc4b9[_0x8d48('0x8f')](_0x44d2c3,{'transaction':_0x5e291f});}})[_0x8d48('0x20')](function(){_0x44d2c3[_0x8d48('0x77')](function(_0x4e8752){socket['emit'](_0x8d48('0x90'),{'UserId':_0x4e8752,'ChatQueueId':_0x1dc4b9['id']});});});});});});})['then'](respondWithStatusCode(_0x46a49f,null))[_0x8d48('0x2a')](handleError(_0x46a49f,null));};exports['addAgents']=function(_0xb70bdd,_0x2004b6,_0x33c7f9){return db[_0x8d48('0x3c')][_0x8d48('0x58')]({'where':{'id':_0xb70bdd[_0x8d48('0x56')]['id']}})[_0x8d48('0x20')](handleEntityNotFound(_0x2004b6,null))[_0x8d48('0x20')](function(_0x1a1de3){if(_0x1a1de3){return _0x1a1de3[_0x8d48('0x91')](_0xb70bdd[_0x8d48('0x5a')][_0x8d48('0x7a')],_[_0x8d48('0x92')](_0xb70bdd[_0x8d48('0x5a')],[_0x8d48('0x7a'),'id'])||{})[_0x8d48('0x93')](function(_0x217ddf){for(var _0x41d059=0x0;_0x41d059<_0xb70bdd[_0x8d48('0x5a')]['ids']['length'];_0x41d059+=0x1){socket[_0x8d48('0x78')](_0x8d48('0x79'),{'UserId':Number(_0xb70bdd[_0x8d48('0x5a')]['ids'][_0x41d059]),'ChatQueueId':Number(_0xb70bdd['params']['id'])});}return _0x217ddf;});}})[_0x8d48('0x20')](respondWithResult(_0x2004b6,null))[_0x8d48('0x2a')](handleError(_0x2004b6,null));};exports[_0x8d48('0x8f')]=function(_0x352d38,_0x1155bf,_0x23f8d6){return db[_0x8d48('0x3c')][_0x8d48('0x58')]({'where':{'id':_0x352d38[_0x8d48('0x56')]['id']}})[_0x8d48('0x20')](handleEntityNotFound(_0x1155bf,null))[_0x8d48('0x20')](function(_0x567677){if(_0x567677){return _0x567677[_0x8d48('0x8f')](_0x352d38[_0x8d48('0x3f')]['ids'])['then'](function(){if(_[_0x8d48('0x94')](_0x352d38[_0x8d48('0x3f')][_0x8d48('0x7a')])){for(var _0x4e914f=0x0;_0x4e914f<_0x352d38[_0x8d48('0x3f')]['ids']['length'];_0x4e914f+=0x1){socket[_0x8d48('0x78')]('userChatQueue:remove',{'UserId':Number(_0x352d38[_0x8d48('0x3f')][_0x8d48('0x7a')][_0x4e914f]),'ChatQueueId':Number(_0x352d38[_0x8d48('0x56')]['id'])});}}else{socket['emit']('userChatQueue:remove',{'UserId':Number(_0x352d38[_0x8d48('0x3f')][_0x8d48('0x7a')]),'ChatQueueId':Number(_0x352d38[_0x8d48('0x56')]['id'])});}});}})[_0x8d48('0x20')](respondWithStatusCode(_0x1155bf,null))[_0x8d48('0x2a')](handleError(_0x1155bf,null));};exports[_0x8d48('0x95')]=function(_0x221d92,_0x4deff1,_0x4cb2a1){var _0x393bd3={};var _0x433411={};var _0x2ad39a;var _0x23e963;return db[_0x8d48('0x3c')]['findOne']({'where':{'id':_0x221d92[_0x8d48('0x56')]['id']}})[_0x8d48('0x20')](handleEntityNotFound(_0x4deff1,null))[_0x8d48('0x20')](function(_0x4e7357){if(_0x4e7357){_0x2ad39a=_0x4e7357;_0x433411[_0x8d48('0x42')]=_[_0x8d48('0x40')](db[_0x8d48('0x68')][_0x8d48('0x3d')]);_0x433411[_0x8d48('0x3f')]=_[_0x8d48('0x40')](_0x221d92[_0x8d48('0x3f')]);_0x433411[_0x8d48('0x41')]=_[_0x8d48('0x44')](_0x433411[_0x8d48('0x42')],_0x433411[_0x8d48('0x3f')]);_0x393bd3[_0x8d48('0x43')]=_[_0x8d48('0x44')](_0x433411[_0x8d48('0x42')],qs['fields'](_0x221d92[_0x8d48('0x3f')][_0x8d48('0x45')]));_0x393bd3['attributes']=_0x393bd3['attributes'][_0x8d48('0x46')]?_0x393bd3[_0x8d48('0x43')]:_0x433411['model'];_0x393bd3['order']=qs[_0x8d48('0x4b')](_0x221d92[_0x8d48('0x3f')]['sort']);_0x393bd3[_0x8d48('0x4c')]=qs[_0x8d48('0x41')](_[_0x8d48('0x6e')](_0x221d92[_0x8d48('0x3f')],_0x433411[_0x8d48('0x41')]));if(_0x221d92[_0x8d48('0x3f')][_0x8d48('0x50')]){_0x393bd3[_0x8d48('0x4c')]=_[_0x8d48('0x4d')](_0x393bd3[_0x8d48('0x4c')],{'$or':_[_0x8d48('0x6f')](_0x393bd3[_0x8d48('0x43')],function(_0x57aaa9){var _0x2477e5={};_0x2477e5[_0x57aaa9]={'$like':'%'+_0x221d92['query'][_0x8d48('0x50')]+'%'};return _0x2477e5;})});}_0x393bd3=_[_0x8d48('0x4d')]({},_0x393bd3,_0x221d92[_0x8d48('0x51')]);return _0x2ad39a[_0x8d48('0x95')](_0x393bd3);}})[_0x8d48('0x20')](function(_0x167275){if(_0x167275){_0x23e963=_0x167275[_0x8d48('0x46')];if(!_0x221d92[_0x8d48('0x3f')][_0x8d48('0x47')](_0x8d48('0x48'))){_0x393bd3[_0x8d48('0x2e')]=qs[_0x8d48('0x2e')](_0x221d92[_0x8d48('0x3f')][_0x8d48('0x2e')]);_0x393bd3[_0x8d48('0x49')]=qs[_0x8d48('0x49')](_0x221d92[_0x8d48('0x3f')]['offset']);}return _0x2ad39a[_0x8d48('0x95')](_0x393bd3);}})[_0x8d48('0x20')](function(_0x38380f){if(_0x38380f){return _0x38380f?{'count':_0x23e963,'rows':_0x38380f}:null;}})[_0x8d48('0x20')](respondWithResult(_0x4deff1,null))[_0x8d48('0x2a')](handleError(_0x4deff1,null));}; \ No newline at end of file +var _0x82aa=['addAgents','spread','userChatQueue:save','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','ChatQueue,\x20%s,\x20%s','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','sendStatus','status','json','offset','undefined','count','limit','apply','reject','save','get','UserProfileResource','destroy','end','stack','name','send','index','map','ChatQueue','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','show','params','rawAttributes','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMembers','findOne','UserChatQueue','pick','ChatQueueId','User','findAndCountAll','UserId','agent','updatedAt','createdAt','rows','%s/%s','SIP','chatPause','Team','getTeams','Agents','online','voicePause','interface','flatMap','transaction','each','forEach','emit','removeTeams','ids','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','sequelize','QueryTypes','SELECT','every','TeamId','includes','all','compact','value','isEmpty','removeAgents','userChatQueue:remove'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0x82aa,0x1ca));var _0xa82a=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x82aa[_0x21a9d9];return _0x46adce;};'use strict';var emlformat=require(_0xa82a('0x0'));var rimraf=require(_0xa82a('0x1'));var zipdir=require(_0xa82a('0x2'));var jsonpatch=require(_0xa82a('0x3'));var rp=require(_0xa82a('0x4'));var moment=require(_0xa82a('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa82a('0x6'));var path=require(_0xa82a('0x7'));var sox=require(_0xa82a('0x8'));var csv=require(_0xa82a('0x9'));var ejs=require(_0xa82a('0xa'));var fs=require('fs');var fs_extra=require(_0xa82a('0xb'));var _=require(_0xa82a('0xc'));var squel=require('squel');var crypto=require(_0xa82a('0xd'));var jsforce=require(_0xa82a('0xe'));var deskjs=require(_0xa82a('0xf'));var toCsv=require(_0xa82a('0x9'));var querystring=require(_0xa82a('0x10'));var Papa=require(_0xa82a('0x11'));var Redis=require('ioredis');var authService=require(_0xa82a('0x12'));var qs=require(_0xa82a('0x13'));var as=require(_0xa82a('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa82a('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xa82a('0x16'));var licenseUtil=require(_0xa82a('0x17'));var db=require('../../mysqldb')['db'];config[_0xa82a('0x18')]=_['defaults'](config[_0xa82a('0x18')],{'host':_0xa82a('0x19'),'port':0x18eb});var socket=require(_0xa82a('0x1a'))(new Redis(config['redis']));require('./chatQueue.socket')[_0xa82a('0x1b')](socket);var jayson=require(_0xa82a('0x1c'));var client=jayson[_0xa82a('0x1d')][_0xa82a('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x88914d,_0x132e01,_0xc3ba88,_0x4f1386){return new BPromise(function(_0x4be3b1,_0x17a67f){var _0x858894=_0x4f1386||client;return _0x858894[_0xa82a('0x1f')](_0x88914d,_0xc3ba88)[_0xa82a('0x20')](function(_0x4dcf62){logger['info'](_0xa82a('0x21'),_0x132e01,_0xa82a('0x22'));logger['debug'](_0xa82a('0x23'),_0x132e01,_0xa82a('0x22'),JSON['stringify'](_0x4dcf62));if(_0x4dcf62['error']){if(_0x4dcf62[_0xa82a('0x24')][_0xa82a('0x25')]===0x1f4){logger['error'](_0xa82a('0x21'),_0x132e01,_0x4dcf62[_0xa82a('0x24')][_0xa82a('0x26')]);return _0x17a67f(_0x4dcf62[_0xa82a('0x24')][_0xa82a('0x26')]);}logger[_0xa82a('0x24')](_0xa82a('0x21'),_0x132e01,_0x4dcf62[_0xa82a('0x24')][_0xa82a('0x26')]);return _0x4be3b1(_0x4dcf62['error']['message']);}else{logger[_0xa82a('0x27')](_0xa82a('0x21'),_0x132e01,_0xa82a('0x22'));_0x4be3b1(_0x4dcf62[_0xa82a('0x28')][_0xa82a('0x26')]);}})[_0xa82a('0x29')](function(_0x276705){logger[_0xa82a('0x24')](_0xa82a('0x21'),_0x132e01,_0x276705);_0x17a67f(_0x276705);});});}function respondWithStatusCode(_0x46d923,_0xcab852){_0xcab852=_0xcab852||0xcc;return function(_0x30c6d4){if(_0x30c6d4){return _0x46d923[_0xa82a('0x2a')](_0xcab852);}return _0x46d923[_0xa82a('0x2b')](_0xcab852)['end']();};}function respondWithResult(_0x127a37,_0x33cdd8){_0x33cdd8=_0x33cdd8||0xc8;return function(_0x205123){if(_0x205123){return _0x127a37[_0xa82a('0x2b')](_0x33cdd8)[_0xa82a('0x2c')](_0x205123);}};}function respondWithFilteredResult(_0x58e95b,_0x2b7f2f){return function(_0x34b69d){if(_0x34b69d){var _0x3ec8c6=typeof _0x2b7f2f[_0xa82a('0x2d')]===_0xa82a('0x2e')&&typeof _0x2b7f2f['limit']===_0xa82a('0x2e');var _0x451589=_0x34b69d[_0xa82a('0x2f')];var _0x3df699=_0x3ec8c6?0x0:_0x2b7f2f[_0xa82a('0x2d')];var _0x418c92=_0x3ec8c6?_0x34b69d[_0xa82a('0x2f')]:_0x2b7f2f[_0xa82a('0x2d')]+_0x2b7f2f[_0xa82a('0x30')];var _0x4ecdba;if(_0x418c92>=_0x451589){_0x418c92=_0x451589;_0x4ecdba=0xc8;}else{_0x4ecdba=0xce;}_0x58e95b[_0xa82a('0x2b')](_0x4ecdba);return _0x58e95b['set']('Content-Range',_0x3df699+'-'+_0x418c92+'/'+_0x451589)[_0xa82a('0x2c')](_0x34b69d);}return null;};}function patchUpdates(_0x4145ed){return function(_0x49136c){try{jsonpatch[_0xa82a('0x31')](_0x49136c,_0x4145ed,!![]);}catch(_0x32a385){return BPromise[_0xa82a('0x32')](_0x32a385);}return _0x49136c[_0xa82a('0x33')]();};}function saveUpdates(_0x3c2bad,_0x25c588){return function(_0x376e71){if(_0x376e71){return _0x376e71['update'](_0x3c2bad)[_0xa82a('0x20')](function(_0x52b0ab){return _0x52b0ab;});}return null;};}function removeEntity(_0x410cc4,_0x2539e1){return function(_0xfa3870){if(_0xfa3870){return _0xfa3870['destroy']()['then'](function(){var _0xe9e05=_0xfa3870[_0xa82a('0x34')]({'plain':!![]});var _0x414641='ChatQueues';return db[_0xa82a('0x35')][_0xa82a('0x36')]({'where':{'type':_0x414641,'resourceId':_0xe9e05['id']}})[_0xa82a('0x20')](function(){return _0xfa3870;});})[_0xa82a('0x20')](function(){_0x410cc4[_0xa82a('0x2b')](0xcc)[_0xa82a('0x37')]();});}};}function handleEntityNotFound(_0x5c7108,_0x3d3335){return function(_0x3a59cd){if(!_0x3a59cd){_0x5c7108[_0xa82a('0x2a')](0x194);}return _0x3a59cd;};}function handleError(_0x20d8a8,_0x4627d3){_0x4627d3=_0x4627d3||0x1f4;return function(_0x5155ef){logger[_0xa82a('0x24')](_0x5155ef[_0xa82a('0x38')]);if(_0x5155ef['name']){delete _0x5155ef[_0xa82a('0x39')];}_0x20d8a8['status'](_0x4627d3)[_0xa82a('0x3a')](_0x5155ef);};}exports[_0xa82a('0x3b')]=function(_0x46ce85,_0x40a310){var _0x451a7e={},_0x1aec42={},_0x4921a2={'count':0x0,'rows':[]};var _0x4082ee=_[_0xa82a('0x3c')](db[_0xa82a('0x3d')]['rawAttributes'],function(_0x500fef){return{'name':_0x500fef['fieldName'],'type':_0x500fef['type']['key']};});_0x1aec42[_0xa82a('0x3e')]=_[_0xa82a('0x3c')](_0x4082ee,_0xa82a('0x39'));_0x1aec42[_0xa82a('0x3f')]=_[_0xa82a('0x40')](_0x46ce85[_0xa82a('0x3f')]);_0x1aec42[_0xa82a('0x41')]=_[_0xa82a('0x42')](_0x1aec42[_0xa82a('0x3e')],_0x1aec42[_0xa82a('0x3f')]);_0x451a7e[_0xa82a('0x43')]=_[_0xa82a('0x42')](_0x1aec42[_0xa82a('0x3e')],qs[_0xa82a('0x44')](_0x46ce85[_0xa82a('0x3f')][_0xa82a('0x44')]));_0x451a7e['attributes']=_0x451a7e[_0xa82a('0x43')][_0xa82a('0x45')]?_0x451a7e[_0xa82a('0x43')]:_0x1aec42['model'];if(!_0x46ce85[_0xa82a('0x3f')][_0xa82a('0x46')](_0xa82a('0x47'))){_0x451a7e[_0xa82a('0x30')]=qs[_0xa82a('0x30')](_0x46ce85[_0xa82a('0x3f')][_0xa82a('0x30')]);_0x451a7e['offset']=qs[_0xa82a('0x2d')](_0x46ce85[_0xa82a('0x3f')][_0xa82a('0x2d')]);}_0x451a7e[_0xa82a('0x48')]=qs[_0xa82a('0x49')](_0x46ce85[_0xa82a('0x3f')]['sort']);_0x451a7e[_0xa82a('0x4a')]=qs[_0xa82a('0x41')](_['pick'](_0x46ce85[_0xa82a('0x3f')],_0x1aec42[_0xa82a('0x41')]),_0x4082ee);if(_0x46ce85[_0xa82a('0x3f')][_0xa82a('0x4b')]){_0x451a7e[_0xa82a('0x4a')]=_['merge'](_0x451a7e[_0xa82a('0x4a')],{'$or':_[_0xa82a('0x3c')](_0x4082ee,function(_0x3b22c2){if(_0x3b22c2[_0xa82a('0x4c')]!==_0xa82a('0x4d')){var _0xb6eced={};_0xb6eced[_0x3b22c2[_0xa82a('0x39')]]={'$like':'%'+_0x46ce85['query'][_0xa82a('0x4b')]+'%'};return _0xb6eced;}})});}_0x451a7e=_[_0xa82a('0x4e')]({},_0x451a7e,_0x46ce85[_0xa82a('0x4f')]);var _0x340a14={'where':_0x451a7e['where']};return db[_0xa82a('0x3d')][_0xa82a('0x2f')](_0x340a14)['then'](function(_0xcc96af){_0x4921a2[_0xa82a('0x2f')]=_0xcc96af;if(_0x46ce85['query'][_0xa82a('0x50')]){_0x451a7e[_0xa82a('0x51')]=[{'all':!![]}];}return db[_0xa82a('0x3d')][_0xa82a('0x52')](_0x451a7e);})[_0xa82a('0x20')](function(_0x3d3a38){_0x4921a2['rows']=_0x3d3a38;return _0x4921a2;})[_0xa82a('0x20')](respondWithFilteredResult(_0x40a310,_0x451a7e))['catch'](handleError(_0x40a310,null));};exports[_0xa82a('0x53')]=function(_0x23cb34,_0x3a7610){var _0x2de963={'raw':!![],'where':{'id':_0x23cb34[_0xa82a('0x54')]['id']}},_0x46ab89={};_0x46ab89[_0xa82a('0x3e')]=_[_0xa82a('0x40')](db['ChatQueue'][_0xa82a('0x55')]);_0x46ab89[_0xa82a('0x3f')]=_[_0xa82a('0x40')](_0x23cb34[_0xa82a('0x3f')]);_0x46ab89['filters']=_[_0xa82a('0x42')](_0x46ab89[_0xa82a('0x3e')],_0x46ab89['query']);_0x2de963[_0xa82a('0x43')]=_[_0xa82a('0x42')](_0x46ab89['model'],qs[_0xa82a('0x44')](_0x23cb34['query'][_0xa82a('0x44')]));_0x2de963[_0xa82a('0x43')]=_0x2de963[_0xa82a('0x43')]['length']?_0x2de963['attributes']:_0x46ab89[_0xa82a('0x3e')];if(_0x23cb34[_0xa82a('0x3f')]['includeAll']){_0x2de963[_0xa82a('0x51')]=[{'all':!![]}];}_0x2de963=_[_0xa82a('0x4e')]({},_0x2de963,_0x23cb34[_0xa82a('0x4f')]);return db[_0xa82a('0x3d')]['find'](_0x2de963)[_0xa82a('0x20')](handleEntityNotFound(_0x3a7610,null))[_0xa82a('0x20')](respondWithResult(_0x3a7610,null))[_0xa82a('0x29')](handleError(_0x3a7610,null));};exports[_0xa82a('0x56')]=function(_0x59d07e,_0x397793){return db[_0xa82a('0x3d')][_0xa82a('0x56')](_0x59d07e[_0xa82a('0x57')],{})[_0xa82a('0x20')](function(_0x98a741){var _0x456a69=_0x59d07e['user']['get']({'plain':!![]});if(!_0x456a69)throw new Error(_0xa82a('0x58'));if(_0x456a69['role']===_0xa82a('0x59')){var _0xb930d=_0x98a741[_0xa82a('0x34')]({'plain':!![]});var _0x149ed4='ChatQueues';return db[_0xa82a('0x5a')][_0xa82a('0x5b')]({'where':{'name':_0x149ed4,'userProfileId':_0x456a69[_0xa82a('0x5c')]},'raw':!![]})[_0xa82a('0x20')](function(_0x54f758){if(_0x54f758&&_0x54f758['autoAssociation']===0x0){return db['UserProfileResource'][_0xa82a('0x56')]({'name':_0xb930d[_0xa82a('0x39')],'resourceId':_0xb930d['id'],'type':_0x54f758[_0xa82a('0x39')],'sectionId':_0x54f758['id']},{})[_0xa82a('0x20')](function(){return _0x98a741;});}else{return _0x98a741;}})['catch'](function(_0x34f41d){logger['error'](_0xa82a('0x5d'),_0x34f41d);throw _0x34f41d;});}return _0x98a741;})['then'](respondWithResult(_0x397793,0xc9))[_0xa82a('0x29')](handleError(_0x397793,null));};exports['update']=function(_0x3217ad,_0x343abd){if(_0x3217ad[_0xa82a('0x57')]['id']){delete _0x3217ad[_0xa82a('0x57')]['id'];}return db['ChatQueue'][_0xa82a('0x5b')]({'where':{'id':_0x3217ad[_0xa82a('0x54')]['id']}})[_0xa82a('0x20')](handleEntityNotFound(_0x343abd,null))[_0xa82a('0x20')](saveUpdates(_0x3217ad[_0xa82a('0x57')],null))[_0xa82a('0x20')](respondWithResult(_0x343abd,null))[_0xa82a('0x29')](handleError(_0x343abd,null));};exports['destroy']=function(_0x20dd77,_0x308dec){return db[_0xa82a('0x3d')][_0xa82a('0x5b')]({'where':{'id':_0x20dd77['params']['id']}})[_0xa82a('0x20')](handleEntityNotFound(_0x308dec,null))[_0xa82a('0x20')](removeEntity(_0x308dec,null))['catch'](handleError(_0x308dec,null));};exports['describe']=function(_0x147e8b,_0x286a91){return db[_0xa82a('0x3d')]['describe']()[_0xa82a('0x20')](respondWithResult(_0x286a91,null))['catch'](handleError(_0x286a91,null));};exports[_0xa82a('0x5e')]=function(_0x5aee60,_0x52472d,_0x403fbb){var _0x5f3c85={'raw':!![],'where':{}},_0x526f6c={},_0x3db108;return db['ChatQueue'][_0xa82a('0x5f')]({'where':{'id':_0x5aee60[_0xa82a('0x54')]['id']}})['then'](handleEntityNotFound(_0x52472d,null))[_0xa82a('0x20')](function(_0x1c71c4){if(_0x1c71c4){_0x3db108=_0x1c71c4[_0xa82a('0x34')]({'plain':!![]});_0x526f6c[_0xa82a('0x3e')]=_[_0xa82a('0x40')](db[_0xa82a('0x60')][_0xa82a('0x55')]);_0x526f6c[_0xa82a('0x3f')]=_[_0xa82a('0x40')](_0x5aee60[_0xa82a('0x3f')]);_0x526f6c['filters']=_[_0xa82a('0x42')](_0x526f6c[_0xa82a('0x3e')],_0x526f6c['query']);_0x5f3c85[_0xa82a('0x43')]=_[_0xa82a('0x42')](_0x526f6c[_0xa82a('0x3e')],qs[_0xa82a('0x44')](_0x5aee60['query'][_0xa82a('0x44')]));_0x5f3c85[_0xa82a('0x43')]=_0x5f3c85[_0xa82a('0x43')][_0xa82a('0x45')]?_0x5f3c85[_0xa82a('0x43')]:_0x526f6c['model'];if(!_0x5aee60[_0xa82a('0x3f')][_0xa82a('0x46')](_0xa82a('0x47'))){_0x5f3c85['limit']=qs['limit'](_0x5aee60[_0xa82a('0x3f')][_0xa82a('0x30')]);_0x5f3c85['offset']=qs[_0xa82a('0x2d')](_0x5aee60[_0xa82a('0x3f')]['offset']);}_0x5f3c85[_0xa82a('0x48')]=qs['sort'](_0x5aee60[_0xa82a('0x3f')][_0xa82a('0x49')]);_0x5f3c85[_0xa82a('0x4a')]=qs[_0xa82a('0x41')](_[_0xa82a('0x61')](_0x5aee60[_0xa82a('0x3f')],_0x526f6c[_0xa82a('0x41')]));_0x5f3c85[_0xa82a('0x4a')][_0xa82a('0x62')]=_0x1c71c4['id'];if(_0x5aee60[_0xa82a('0x3f')]['filter']){_0x5f3c85[_0xa82a('0x4a')]=_['merge'](_0x5f3c85[_0xa82a('0x4a')],{'$or':_[_0xa82a('0x3c')](_0x5f3c85[_0xa82a('0x43')],function(_0x37a0c7){var _0x2ff7e4={};_0x2ff7e4[_0x37a0c7]={'$like':'%'+_0x5aee60[_0xa82a('0x3f')][_0xa82a('0x4b')]+'%'};return _0x2ff7e4;})});}_0x5f3c85=_[_0xa82a('0x4e')]({},_0x5f3c85,_0x5aee60['options']);return db['UserChatQueue'][_0xa82a('0x52')](_0x5f3c85);}})['then'](function(_0x4718f9){if(_0x4718f9){return db[_0xa82a('0x63')][_0xa82a('0x64')]({'where':{'id':_['map'](_0x4718f9,_0xa82a('0x65')),'role':_0xa82a('0x66')},'attributes':['id',_0xa82a('0x39'),'chatPause',_0xa82a('0x67'),_0xa82a('0x68')]});}})[_0xa82a('0x20')](function(_0x5069ba){if(_0x5069ba){return{'count':_0x5069ba[_0xa82a('0x2f')],'rows':_[_0xa82a('0x3c')](_0x5069ba[_0xa82a('0x69')],function(_0x88546b){return{'membername':_0x88546b[_0xa82a('0x39')],'UserId':_0x88546b['id'],'queue_name':_0x3db108['name'],'ChatQueueId':_0x3db108['id'],'interface':util['format'](_0xa82a('0x6a'),_0xa82a('0x6b'),_0x88546b[_0xa82a('0x39')]),'penalty':0x0,'paused':_0x88546b[_0xa82a('0x6c')],'createdAt':_0x88546b[_0xa82a('0x68')],'updatedAt':_0x88546b[_0xa82a('0x67')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xa82a('0x20')](respondWithFilteredResult(_0x52472d,_0x5f3c85))[_0xa82a('0x29')](handleError(_0x52472d,null));};exports['getTeams']=function(_0x16df1a,_0x55fd83,_0x3270ed){var _0x1da13e={};var _0x48ad40={};var _0xb9995;var _0x1a7f7b;return db['ChatQueue']['findOne']({'where':{'id':_0x16df1a[_0xa82a('0x54')]['id']}})[_0xa82a('0x20')](handleEntityNotFound(_0x55fd83,null))[_0xa82a('0x20')](function(_0x5b5538){if(_0x5b5538){_0xb9995=_0x5b5538;_0x48ad40[_0xa82a('0x3e')]=_[_0xa82a('0x40')](db[_0xa82a('0x6d')][_0xa82a('0x55')]);_0x48ad40[_0xa82a('0x3f')]=_[_0xa82a('0x40')](_0x16df1a[_0xa82a('0x3f')]);_0x48ad40['filters']=_[_0xa82a('0x42')](_0x48ad40[_0xa82a('0x3e')],_0x48ad40[_0xa82a('0x3f')]);_0x1da13e[_0xa82a('0x43')]=_[_0xa82a('0x42')](_0x48ad40['model'],qs[_0xa82a('0x44')](_0x16df1a['query'][_0xa82a('0x44')]));_0x1da13e[_0xa82a('0x43')]=_0x1da13e[_0xa82a('0x43')]['length']?_0x1da13e[_0xa82a('0x43')]:_0x48ad40[_0xa82a('0x3e')];_0x1da13e[_0xa82a('0x48')]=qs[_0xa82a('0x49')](_0x16df1a[_0xa82a('0x3f')][_0xa82a('0x49')]);_0x1da13e[_0xa82a('0x4a')]=qs[_0xa82a('0x41')](_[_0xa82a('0x61')](_0x16df1a['query'],_0x48ad40[_0xa82a('0x41')]));if(_0x16df1a[_0xa82a('0x3f')]['filter']){_0x1da13e[_0xa82a('0x4a')]=_[_0xa82a('0x4e')](_0x1da13e[_0xa82a('0x4a')],{'$or':_[_0xa82a('0x3c')](_0x1da13e[_0xa82a('0x43')],function(_0xb99b0c){var _0x2647ff={};_0x2647ff[_0xb99b0c]={'$like':'%'+_0x16df1a['query'][_0xa82a('0x4b')]+'%'};return _0x2647ff;})});}_0x1da13e=_[_0xa82a('0x4e')]({},_0x1da13e,_0x16df1a[_0xa82a('0x4f')]);return _0xb9995[_0xa82a('0x6e')](_0x1da13e);}})[_0xa82a('0x20')](function(_0x31088f){if(_0x31088f){_0x1a7f7b=_0x31088f[_0xa82a('0x45')];if(!_0x16df1a[_0xa82a('0x3f')][_0xa82a('0x46')]('nolimit')){_0x1da13e['limit']=qs[_0xa82a('0x30')](_0x16df1a[_0xa82a('0x3f')][_0xa82a('0x30')]);_0x1da13e[_0xa82a('0x2d')]=qs['offset'](_0x16df1a[_0xa82a('0x3f')][_0xa82a('0x2d')]);}return _0xb9995['getTeams'](_0x1da13e);}})[_0xa82a('0x20')](function(_0x362cd9){if(_0x362cd9){return _0x362cd9?{'count':_0x1a7f7b,'rows':_0x362cd9}:null;}})[_0xa82a('0x20')](respondWithResult(_0x55fd83,null))['catch'](handleError(_0x55fd83,null));};exports['addTeams']=function(_0x156866,_0x441ff7,_0x3a4118){var _0x105367=_0x156866[_0xa82a('0x57')]['ids'];return db[_0xa82a('0x6d')][_0xa82a('0x52')]({'where':{'id':_0x105367},'attributes':['id'],'include':[{'model':db[_0xa82a('0x63')],'as':_0xa82a('0x6f'),'attributes':['id',_0xa82a('0x39'),_0xa82a('0x70'),_0xa82a('0x71'),_0xa82a('0x72')],'raw':!![]}]})[_0xa82a('0x20')](function(_0x59f413){if(_0x59f413){var _0x333436=_[_0xa82a('0x73')](_0x59f413,function(_0xd670db){var _0x10d416=_0xd670db[_0xa82a('0x34')]({'plain':!![]});return _0x10d416[_0xa82a('0x6f')];});return db[_0xa82a('0x3d')][_0xa82a('0x5b')]({'where':{'id':_0x156866[_0xa82a('0x54')]['id']}})[_0xa82a('0x20')](function(_0x339428){return db['sequelize'][_0xa82a('0x74')](function(_0x482836){return _0x339428['addTeams'](_0x105367,{'transaction':_0x482836})[_0xa82a('0x20')](function(){return BPromise[_0xa82a('0x75')](_0x333436,function(_0x153264){return db['UserChatQueue']['findOrCreate']({'where':{'UserId':_0x153264['id'],'ChatQueueId':_0x156866[_0xa82a('0x54')]['id']},'transaction':_0x482836});});})[_0xa82a('0x20')](function(){_0x333436[_0xa82a('0x76')](function(_0x19b1a1){socket[_0xa82a('0x77')]('userChatQueue:save',{'UserId':_0x19b1a1['id'],'ChatQueueId':_0x339428['id']});});});});});}})[_0xa82a('0x20')](respondWithStatusCode(_0x441ff7,null))[_0xa82a('0x29')](handleError(_0x441ff7,null));};exports[_0xa82a('0x78')]=function(_0xe416,_0x151207,_0x1658cb){return db[_0xa82a('0x6d')][_0xa82a('0x52')]({'where':{'id':_0xe416[_0xa82a('0x3f')][_0xa82a('0x79')]},'attributes':['id'],'include':[{'model':db[_0xa82a('0x63')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xa82a('0x20')](handleEntityNotFound(_0x151207,null))[_0xa82a('0x20')](function(_0x5a24ab){var _0xedc291=_[_0xa82a('0x3c')](_0x5a24ab,'id');var _0x452af=[];var _0x5116dc=[];var _0xd4d3c=squel[_0xa82a('0x7a')]();_0xd4d3c[_0xa82a('0x7b')](_0xa82a('0x7c'))[_0xa82a('0x7d')]('team_has_chat_queues','tq')[_0xa82a('0x7e')](_0xa82a('0x7f'),'ut',_0xa82a('0x80'))['where'](_0xa82a('0x81'),_0xe416[_0xa82a('0x54')]['id']);for(var _0xa192bd=0x0;_0xa192bd<_0x5a24ab[_0xa82a('0x45')];_0xa192bd+=0x1){let _0xaf98f9=_0x5a24ab[_0xa192bd];for(var _0x5e1cd2=0x0;_0x5e1cd2<_0xaf98f9[_0xa82a('0x6f')][_0xa82a('0x45')];_0x5e1cd2+=0x1){let _0x13d815=_0xaf98f9['Agents'][_0x5e1cd2];var _0x266c4c=_0xd4d3c[_0xa82a('0x82')]();_0x266c4c[_0xa82a('0x4a')](_0xa82a('0x83'),_0x13d815['id']);_0x5116dc[_0xa82a('0x84')](db['sequelize'][_0xa82a('0x3f')](_0x266c4c[_0xa82a('0x85')](),{'type':db[_0xa82a('0x86')][_0xa82a('0x87')][_0xa82a('0x88')]})[_0xa82a('0x20')](function(_0x1a3455){if(_0x1a3455[_0xa82a('0x45')]===0x1){return _0x13d815['id'];}else{var _0x45acf4=_[_0xa82a('0x89')](_[_0xa82a('0x3c')](_0x1a3455,_0xa82a('0x8a')),function(_0x25d2e6){return _[_0xa82a('0x8b')](_0xedc291,_0x25d2e6);});if(_0x45acf4){return _0x13d815['id'];}}}));}}return BPromise[_0xa82a('0x8c')](_0x5116dc)[_0xa82a('0x20')](function(_0x385aad){_0x452af=_(_0x452af)['union'](_0x385aad)[_0xa82a('0x8d')]()[_0xa82a('0x8e')]();return db['ChatQueue'][_0xa82a('0x5b')]({'where':{'id':_0xe416[_0xa82a('0x54')]['id']}})[_0xa82a('0x20')](function(_0x1f4d0c){return db[_0xa82a('0x86')][_0xa82a('0x74')](function(_0x10c94e){return _0x1f4d0c[_0xa82a('0x78')](_0xe416['query']['ids'],{'transaction':_0x10c94e})['then'](function(){if(!_[_0xa82a('0x8f')](_0x452af)){return _0x1f4d0c[_0xa82a('0x90')](_0x452af,{'transaction':_0x10c94e});}})['then'](function(){_0x452af[_0xa82a('0x76')](function(_0x527d50){socket[_0xa82a('0x77')](_0xa82a('0x91'),{'UserId':_0x527d50,'ChatQueueId':_0x1f4d0c['id']});});});});});});})[_0xa82a('0x20')](respondWithStatusCode(_0x151207,null))[_0xa82a('0x29')](handleError(_0x151207,null));};exports[_0xa82a('0x92')]=function(_0x5bb467,_0x5f5375,_0x2bdb1c){return db[_0xa82a('0x3d')][_0xa82a('0x5b')]({'where':{'id':_0x5bb467[_0xa82a('0x54')]['id']}})['then'](handleEntityNotFound(_0x5f5375,null))[_0xa82a('0x20')](function(_0x3db43f){if(_0x3db43f){return _0x3db43f[_0xa82a('0x92')](_0x5bb467[_0xa82a('0x57')][_0xa82a('0x79')],_['omit'](_0x5bb467['body'],['ids','id'])||{})[_0xa82a('0x93')](function(_0x3d5997){for(var _0x4dc9cd=0x0;_0x4dc9cd<_0x5bb467[_0xa82a('0x57')][_0xa82a('0x79')]['length'];_0x4dc9cd+=0x1){socket[_0xa82a('0x77')](_0xa82a('0x94'),{'UserId':Number(_0x5bb467['body']['ids'][_0x4dc9cd]),'ChatQueueId':Number(_0x5bb467['params']['id'])});}return _0x3d5997;});}})[_0xa82a('0x20')](respondWithResult(_0x5f5375,null))['catch'](handleError(_0x5f5375,null));};exports[_0xa82a('0x90')]=function(_0xf1e22a,_0x20f1e9,_0x317262){return db[_0xa82a('0x3d')][_0xa82a('0x5b')]({'where':{'id':_0xf1e22a[_0xa82a('0x54')]['id']}})[_0xa82a('0x20')](handleEntityNotFound(_0x20f1e9,null))[_0xa82a('0x20')](function(_0x3b65d8){if(_0x3b65d8){return _0x3b65d8[_0xa82a('0x90')](_0xf1e22a[_0xa82a('0x3f')][_0xa82a('0x79')])[_0xa82a('0x20')](function(){if(_[_0xa82a('0x95')](_0xf1e22a['query']['ids'])){for(var _0x301e5b=0x0;_0x301e5b<_0xf1e22a[_0xa82a('0x3f')][_0xa82a('0x79')][_0xa82a('0x45')];_0x301e5b+=0x1){socket['emit'](_0xa82a('0x91'),{'UserId':Number(_0xf1e22a['query'][_0xa82a('0x79')][_0x301e5b]),'ChatQueueId':Number(_0xf1e22a[_0xa82a('0x54')]['id'])});}}else{socket['emit'](_0xa82a('0x91'),{'UserId':Number(_0xf1e22a[_0xa82a('0x3f')]['ids']),'ChatQueueId':Number(_0xf1e22a['params']['id'])});}});}})['then'](respondWithStatusCode(_0x20f1e9,null))[_0xa82a('0x29')](handleError(_0x20f1e9,null));};exports[_0xa82a('0x96')]=function(_0x22984b,_0x118e4d,_0x3612f3){var _0x1f373a={};var _0x532bee={};var _0x4a8a08;var _0x5105be;return db['ChatQueue'][_0xa82a('0x5f')]({'where':{'id':_0x22984b[_0xa82a('0x54')]['id']}})['then'](handleEntityNotFound(_0x118e4d,null))[_0xa82a('0x20')](function(_0x4564a5){if(_0x4564a5){_0x4a8a08=_0x4564a5;_0x532bee[_0xa82a('0x3e')]=_[_0xa82a('0x40')](db[_0xa82a('0x63')][_0xa82a('0x55')]);_0x532bee[_0xa82a('0x3f')]=_[_0xa82a('0x40')](_0x22984b[_0xa82a('0x3f')]);_0x532bee[_0xa82a('0x41')]=_[_0xa82a('0x42')](_0x532bee[_0xa82a('0x3e')],_0x532bee['query']);_0x1f373a['attributes']=_['intersection'](_0x532bee[_0xa82a('0x3e')],qs[_0xa82a('0x44')](_0x22984b[_0xa82a('0x3f')][_0xa82a('0x44')]));_0x1f373a[_0xa82a('0x43')]=_0x1f373a[_0xa82a('0x43')]['length']?_0x1f373a[_0xa82a('0x43')]:_0x532bee[_0xa82a('0x3e')];_0x1f373a[_0xa82a('0x48')]=qs[_0xa82a('0x49')](_0x22984b['query'][_0xa82a('0x49')]);_0x1f373a[_0xa82a('0x4a')]=qs[_0xa82a('0x41')](_[_0xa82a('0x61')](_0x22984b['query'],_0x532bee[_0xa82a('0x41')]));if(_0x22984b[_0xa82a('0x3f')][_0xa82a('0x4b')]){_0x1f373a[_0xa82a('0x4a')]=_[_0xa82a('0x4e')](_0x1f373a['where'],{'$or':_[_0xa82a('0x3c')](_0x1f373a['attributes'],function(_0x32c6d9){var _0x3ddcb7={};_0x3ddcb7[_0x32c6d9]={'$like':'%'+_0x22984b[_0xa82a('0x3f')]['filter']+'%'};return _0x3ddcb7;})});}_0x1f373a=_[_0xa82a('0x4e')]({},_0x1f373a,_0x22984b['options']);return _0x4a8a08[_0xa82a('0x96')](_0x1f373a);}})['then'](function(_0x5a19c4){if(_0x5a19c4){_0x5105be=_0x5a19c4[_0xa82a('0x45')];if(!_0x22984b[_0xa82a('0x3f')][_0xa82a('0x46')]('nolimit')){_0x1f373a[_0xa82a('0x30')]=qs['limit'](_0x22984b['query'][_0xa82a('0x30')]);_0x1f373a[_0xa82a('0x2d')]=qs[_0xa82a('0x2d')](_0x22984b[_0xa82a('0x3f')][_0xa82a('0x2d')]);}return _0x4a8a08['getAgents'](_0x1f373a);}})['then'](function(_0x4f78b8){if(_0x4f78b8){return _0x4f78b8?{'count':_0x5105be,'rows':_0x4f78b8}:null;}})[_0xa82a('0x20')](respondWithResult(_0x118e4d,null))[_0xa82a('0x29')](handleError(_0x118e4d,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 12e63c2..1f66fc3 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 _0xa362=['events','../../mysqldb','ChatQueue','setMaxListeners','save','remove','emit','hook','exports'];(function(_0x273c39,_0x1052e6){var _0x46d6b5=function(_0x44f1fb){while(--_0x44f1fb){_0x273c39['push'](_0x273c39['shift']());}};_0x46d6b5(++_0x1052e6);}(_0xa362,0x183));var _0x2a36=function(_0x36bfc5,_0x1f5802){_0x36bfc5=_0x36bfc5-0x0;var _0x2ca9fa=_0xa362[_0x36bfc5];return _0x2ca9fa;};'use strict';var EventEmitter=require(_0x2a36('0x0'));var ChatQueue=require(_0x2a36('0x1'))['db'][_0x2a36('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x2a36('0x3')](0x0);var events={'afterCreate':_0x2a36('0x4'),'afterUpdate':'update','afterDestroy':_0x2a36('0x5')};function emitEvent(_0x3b2a3d){return function(_0x315780,_0x240a4e,_0x34d8ed){ChatQueueEvents[_0x2a36('0x6')](_0x3b2a3d+':'+_0x315780['id'],_0x315780);ChatQueueEvents[_0x2a36('0x6')](_0x3b2a3d,_0x315780);_0x34d8ed(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatQueue[_0x2a36('0x7')](e,emitEvent(event));}}module[_0x2a36('0x8')]=ChatQueueEvents; \ No newline at end of file +var _0x6487=['../../mysqldb','ChatQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events'];(function(_0x4271c4,_0x2925f5){var _0xf52862=function(_0x3fd518){while(--_0x3fd518){_0x4271c4['push'](_0x4271c4['shift']());}};_0xf52862(++_0x2925f5);}(_0x6487,0x1f3));var _0x7648=function(_0x25322d,_0x22b30d){_0x25322d=_0x25322d-0x0;var _0x1110c8=_0x6487[_0x25322d];return _0x1110c8;};'use strict';var EventEmitter=require(_0x7648('0x0'));var ChatQueue=require(_0x7648('0x1'))['db'][_0x7648('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x7648('0x3')](0x0);var events={'afterCreate':_0x7648('0x4'),'afterUpdate':_0x7648('0x5'),'afterDestroy':_0x7648('0x6')};function emitEvent(_0x31c236){return function(_0x167094,_0x161613,_0x56878e){ChatQueueEvents[_0x7648('0x7')](_0x31c236+':'+_0x167094['id'],_0x167094);ChatQueueEvents[_0x7648('0x7')](_0x31c236,_0x167094);_0x56878e(null);};}for(var e in events){if(events[_0x7648('0x8')](e)){var event=events[e];ChatQueue['hook'](e,emitEvent(event));}}module[_0x7648('0x9')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 985b334..6df0c42 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 _0x2d61=['lodash','util','../../config/logger','moment','bluebird','path','rimraf','exports','define','ChatQueue','chat_queues'];(function(_0x531f64,_0x2e179c){var _0x503b4d=function(_0x4fb265){while(--_0x4fb265){_0x531f64['push'](_0x531f64['shift']());}};_0x503b4d(++_0x2e179c);}(_0x2d61,0x6e));var _0x12d6=function(_0x372253,_0x2cdbb3){_0x372253=_0x372253-0x0;var _0x5e0f1d=_0x2d61[_0x372253];return _0x5e0f1d;};'use strict';var _=require(_0x12d6('0x0'));var util=require(_0x12d6('0x1'));var logger=require(_0x12d6('0x2'))('api');var moment=require(_0x12d6('0x3'));var BPromise=require(_0x12d6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x12d6('0x5'));var rimraf=require(_0x12d6('0x6'));var config=require('../../config/environment');var attributes=require('./chatQueue.attributes');module[_0x12d6('0x7')]=function(_0x18dce0,_0x398021){return _0x18dce0[_0x12d6('0x8')](_0x12d6('0x9'),attributes,{'tableName':_0x12d6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc3c4=['moment','bluebird','path','rimraf','./chatQueue.attributes','exports','define','ChatQueue','chat_queues','lodash','util','../../config/logger','api'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc3c4,0x19c));var _0x4c3c=function(_0xc8e836,_0x184d10){_0xc8e836=_0xc8e836-0x0;var _0x54d18c=_0xc3c4[_0xc8e836];return _0x54d18c;};'use strict';var _=require(_0x4c3c('0x0'));var util=require(_0x4c3c('0x1'));var logger=require(_0x4c3c('0x2'))(_0x4c3c('0x3'));var moment=require(_0x4c3c('0x4'));var BPromise=require(_0x4c3c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4c3c('0x6'));var rimraf=require(_0x4c3c('0x7'));var config=require('../../config/environment');var attributes=require(_0x4c3c('0x8'));module[_0x4c3c('0x9')]=function(_0xae035f,_0x420de8){return _0xae035f[_0x4c3c('0xa')](_0x4c3c('0xb'),attributes,{'tableName':_0x4c3c('0xc'),'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 c1d4443..69a3c1c 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 _0x342c=['then','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','request','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','GetChatQueue','findAll','raw','options','where','attributes','limit','include','map','model','catch','ShowChatQueue','ChatQueue'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x342c,0x149));var _0xc342=function(_0x19396c,_0x2528a8){_0x19396c=_0x19396c-0x0;var _0x18e2a1=_0x342c[_0x19396c];return _0x18e2a1;};'use strict';var _=require(_0xc342('0x0'));var util=require(_0xc342('0x1'));var moment=require('moment');var BPromise=require(_0xc342('0x2'));var rs=require(_0xc342('0x3'));var fs=require('fs');var Redis=require(_0xc342('0x4'));var db=require(_0xc342('0x5'))['db'];var utils=require(_0xc342('0x6'));var logger=require('../../config/logger')(_0xc342('0x7'));var config=require(_0xc342('0x8'));var jayson=require(_0xc342('0x9'));var client=jayson[_0xc342('0xa')]['http']({'port':0x232a});config[_0xc342('0xb')]=_[_0xc342('0xc')](config['redis'],{'host':_0xc342('0xd'),'port':0x18eb});var socket=require(_0xc342('0xe'))(new Redis(config['redis']));require(_0xc342('0xf'))[_0xc342('0x10')](socket);function respondWithRpcPromise(_0x451ecf,_0x29a751,_0x55a04c){return new BPromise(function(_0x41db94,_0x4228b9){return client[_0xc342('0x11')](_0x451ecf,_0x55a04c)['then'](function(_0x356575){logger[_0xc342('0x12')](_0xc342('0x13'),_0x29a751,_0xc342('0x14'));logger[_0xc342('0x15')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x29a751,_0xc342('0x14'),JSON[_0xc342('0x16')](_0x356575));if(_0x356575['error']){if(_0x356575[_0xc342('0x17')][_0xc342('0x18')]===0x1f4){logger[_0xc342('0x17')](_0xc342('0x13'),_0x29a751,_0x356575[_0xc342('0x17')][_0xc342('0x19')]);return _0x4228b9(_0x356575[_0xc342('0x17')][_0xc342('0x19')]);}logger['error'](_0xc342('0x13'),_0x29a751,_0x356575[_0xc342('0x17')][_0xc342('0x19')]);return _0x41db94(_0x356575['error'][_0xc342('0x19')]);}else{logger[_0xc342('0x12')](_0xc342('0x13'),_0x29a751,_0xc342('0x14'));_0x41db94(_0x356575[_0xc342('0x1a')][_0xc342('0x19')]);}})['catch'](function(_0x163c01){logger['error'](_0xc342('0x13'),_0x29a751,_0x163c01);_0x4228b9(_0x163c01);});});}exports[_0xc342('0x1b')]=function(_0x4377cb){var _0x24e8c8=this;return new Promise(function(_0xe6b1ed,_0x2e5e59){return db['ChatQueue'][_0xc342('0x1c')]({'raw':_0x4377cb['options']?_0x4377cb['options'][_0xc342('0x1d')]===undefined?!![]:![]:!![],'where':_0x4377cb['options']?_0x4377cb[_0xc342('0x1e')][_0xc342('0x1f')]||null:null,'attributes':_0x4377cb['options']?_0x4377cb[_0xc342('0x1e')][_0xc342('0x20')]||null:null,'limit':_0x4377cb[_0xc342('0x1e')]?_0x4377cb[_0xc342('0x1e')][_0xc342('0x21')]||null:null,'include':_0x4377cb['options']?_0x4377cb[_0xc342('0x1e')][_0xc342('0x22')]?_[_0xc342('0x23')](_0x4377cb[_0xc342('0x1e')]['include'],function(_0x34c7fd){return{'model':db[_0x34c7fd['model']],'as':_0x34c7fd['as'],'attributes':_0x34c7fd['attributes'],'include':_0x34c7fd[_0xc342('0x22')]?_[_0xc342('0x23')](_0x34c7fd[_0xc342('0x22')],function(_0xffe9fd){return{'model':db[_0xffe9fd[_0xc342('0x24')]],'as':_0xffe9fd['as'],'attributes':_0xffe9fd[_0xc342('0x20')],'include':_0xffe9fd[_0xc342('0x22')]?_['map'](_0xffe9fd[_0xc342('0x22')],function(_0x318e6f){return{'model':db[_0x318e6f[_0xc342('0x24')]],'as':_0x318e6f['as'],'attributes':_0x318e6f[_0xc342('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1051aa){logger[_0xc342('0x12')](_0xc342('0x1b'),_0x4377cb);logger[_0xc342('0x15')](_0xc342('0x1b'),_0x4377cb,JSON['stringify'](_0x1051aa));_0xe6b1ed(_0x1051aa);})[_0xc342('0x25')](function(_0x12432e){logger[_0xc342('0x17')](_0xc342('0x1b'),_0x12432e['message'],_0x4377cb);_0x2e5e59(_0x24e8c8[_0xc342('0x17')](0x1f4,_0x12432e[_0xc342('0x19')]));});});};exports[_0xc342('0x26')]=function(_0x509b3b){var _0x4520c3=this;return new Promise(function(_0x3d5da7,_0x2cadd9){return db[_0xc342('0x27')]['find']({'raw':_0x509b3b[_0xc342('0x1e')]?_0x509b3b[_0xc342('0x1e')][_0xc342('0x1d')]===undefined?!![]:![]:!![],'where':_0x509b3b[_0xc342('0x1e')]?_0x509b3b[_0xc342('0x1e')][_0xc342('0x1f')]||null:null,'attributes':_0x509b3b['options']?_0x509b3b[_0xc342('0x1e')][_0xc342('0x20')]||null:null,'include':_0x509b3b[_0xc342('0x1e')]?_0x509b3b[_0xc342('0x1e')][_0xc342('0x22')]?_[_0xc342('0x23')](_0x509b3b[_0xc342('0x1e')][_0xc342('0x22')],function(_0x156956){return{'model':db[_0x156956[_0xc342('0x24')]],'as':_0x156956['as'],'attributes':_0x156956['attributes'],'include':_0x156956[_0xc342('0x22')]?_[_0xc342('0x23')](_0x156956[_0xc342('0x22')],function(_0x182e3a){return{'model':db[_0x182e3a[_0xc342('0x24')]],'as':_0x182e3a['as'],'attributes':_0x182e3a[_0xc342('0x20')],'include':_0x182e3a[_0xc342('0x22')]?_[_0xc342('0x23')](_0x182e3a[_0xc342('0x22')],function(_0x3ae15e){return{'model':db[_0x3ae15e[_0xc342('0x24')]],'as':_0x3ae15e['as'],'attributes':_0x3ae15e['attributes']};}):[]};}):[]};}):[]:[]})[_0xc342('0x28')](function(_0x3c33c4){logger[_0xc342('0x12')](_0xc342('0x26'),_0x509b3b);logger['debug']('ShowChatQueue',_0x509b3b,JSON[_0xc342('0x16')](_0x3c33c4));_0x3d5da7(_0x3c33c4);})[_0xc342('0x25')](function(_0x24b3ae){logger[_0xc342('0x17')](_0xc342('0x26'),_0x24b3ae[_0xc342('0x19')],_0x509b3b);_0x2cadd9(_0x4520c3[_0xc342('0x17')](0x1f4,_0x24b3ae[_0xc342('0x19')]));});});}; \ No newline at end of file +var _0x4628=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','socket.io-emitter','request','info','request\x20sent','stringify','error','ChatQueue,\x20%s,\x20%s','message','result','catch','GetChatQueue','ChatQueue','findAll','options','raw','limit','include','map','model','attributes','ShowChatQueue','find','where','debug','lodash','util','bluebird','randomstring','ioredis'];(function(_0x500210,_0x15bbe6){var _0x5b5da3=function(_0x29d0d8){while(--_0x29d0d8){_0x500210['push'](_0x500210['shift']());}};_0x5b5da3(++_0x15bbe6);}(_0x4628,0xd3));var _0x8462=function(_0x3e65b1,_0x535a82){_0x3e65b1=_0x3e65b1-0x0;var _0x22b2c1=_0x4628[_0x3e65b1];return _0x22b2c1;};'use strict';var _=require(_0x8462('0x0'));var util=require(_0x8462('0x1'));var moment=require('moment');var BPromise=require(_0x8462('0x2'));var rs=require(_0x8462('0x3'));var fs=require('fs');var Redis=require(_0x8462('0x4'));var db=require(_0x8462('0x5'))['db'];var utils=require(_0x8462('0x6'));var logger=require('../../config/logger')(_0x8462('0x7'));var config=require(_0x8462('0x8'));var jayson=require(_0x8462('0x9'));var client=jayson[_0x8462('0xa')]['http']({'port':0x232a});config[_0x8462('0xb')]=_['defaults'](config[_0x8462('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x8462('0xc'))(new Redis(config[_0x8462('0xb')]));require('./chatQueue.socket')['register'](socket);function respondWithRpcPromise(_0x3ebf01,_0x1cc040,_0x34cd6b){return new BPromise(function(_0x3cd893,_0x18e80e){return client[_0x8462('0xd')](_0x3ebf01,_0x34cd6b)['then'](function(_0x1799d6){logger[_0x8462('0xe')]('ChatQueue,\x20%s,\x20%s',_0x1cc040,_0x8462('0xf'));logger['debug']('ChatQueue,\x20%s,\x20%s,\x20%s',_0x1cc040,'request\x20sent',JSON[_0x8462('0x10')](_0x1799d6));if(_0x1799d6[_0x8462('0x11')]){if(_0x1799d6[_0x8462('0x11')]['code']===0x1f4){logger[_0x8462('0x11')](_0x8462('0x12'),_0x1cc040,_0x1799d6[_0x8462('0x11')][_0x8462('0x13')]);return _0x18e80e(_0x1799d6['error'][_0x8462('0x13')]);}logger[_0x8462('0x11')]('ChatQueue,\x20%s,\x20%s',_0x1cc040,_0x1799d6[_0x8462('0x11')][_0x8462('0x13')]);return _0x3cd893(_0x1799d6[_0x8462('0x11')][_0x8462('0x13')]);}else{logger['info'](_0x8462('0x12'),_0x1cc040,_0x8462('0xf'));_0x3cd893(_0x1799d6[_0x8462('0x14')][_0x8462('0x13')]);}})[_0x8462('0x15')](function(_0x528157){logger['error'](_0x8462('0x12'),_0x1cc040,_0x528157);_0x18e80e(_0x528157);});});}exports[_0x8462('0x16')]=function(_0x267e7d){var _0x2c3c48=this;return new Promise(function(_0x49bef5,_0x490dcb){return db[_0x8462('0x17')][_0x8462('0x18')]({'raw':_0x267e7d[_0x8462('0x19')]?_0x267e7d[_0x8462('0x19')][_0x8462('0x1a')]===undefined?!![]:![]:!![],'where':_0x267e7d['options']?_0x267e7d[_0x8462('0x19')]['where']||null:null,'attributes':_0x267e7d['options']?_0x267e7d['options']['attributes']||null:null,'limit':_0x267e7d[_0x8462('0x19')]?_0x267e7d[_0x8462('0x19')][_0x8462('0x1b')]||null:null,'include':_0x267e7d[_0x8462('0x19')]?_0x267e7d[_0x8462('0x19')][_0x8462('0x1c')]?_[_0x8462('0x1d')](_0x267e7d['options'][_0x8462('0x1c')],function(_0x328e71){return{'model':db[_0x328e71[_0x8462('0x1e')]],'as':_0x328e71['as'],'attributes':_0x328e71[_0x8462('0x1f')],'include':_0x328e71[_0x8462('0x1c')]?_[_0x8462('0x1d')](_0x328e71['include'],function(_0x5e50a0){return{'model':db[_0x5e50a0['model']],'as':_0x5e50a0['as'],'attributes':_0x5e50a0[_0x8462('0x1f')],'include':_0x5e50a0[_0x8462('0x1c')]?_['map'](_0x5e50a0[_0x8462('0x1c')],function(_0x3e4e30){return{'model':db[_0x3e4e30[_0x8462('0x1e')]],'as':_0x3e4e30['as'],'attributes':_0x3e4e30[_0x8462('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3d7ee6){logger['info'](_0x8462('0x16'),_0x267e7d);logger['debug'](_0x8462('0x16'),_0x267e7d,JSON['stringify'](_0x3d7ee6));_0x49bef5(_0x3d7ee6);})['catch'](function(_0x11cab6){logger[_0x8462('0x11')](_0x8462('0x16'),_0x11cab6[_0x8462('0x13')],_0x267e7d);_0x490dcb(_0x2c3c48['error'](0x1f4,_0x11cab6[_0x8462('0x13')]));});});};exports[_0x8462('0x20')]=function(_0x32a3ad){var _0x4a7150=this;return new Promise(function(_0xf7d96a,_0x3fc528){return db['ChatQueue'][_0x8462('0x21')]({'raw':_0x32a3ad[_0x8462('0x19')]?_0x32a3ad[_0x8462('0x19')][_0x8462('0x1a')]===undefined?!![]:![]:!![],'where':_0x32a3ad[_0x8462('0x19')]?_0x32a3ad[_0x8462('0x19')][_0x8462('0x22')]||null:null,'attributes':_0x32a3ad[_0x8462('0x19')]?_0x32a3ad['options'][_0x8462('0x1f')]||null:null,'include':_0x32a3ad[_0x8462('0x19')]?_0x32a3ad['options'][_0x8462('0x1c')]?_['map'](_0x32a3ad[_0x8462('0x19')]['include'],function(_0x2de13d){return{'model':db[_0x2de13d[_0x8462('0x1e')]],'as':_0x2de13d['as'],'attributes':_0x2de13d[_0x8462('0x1f')],'include':_0x2de13d[_0x8462('0x1c')]?_[_0x8462('0x1d')](_0x2de13d['include'],function(_0x3fdf98){return{'model':db[_0x3fdf98[_0x8462('0x1e')]],'as':_0x3fdf98['as'],'attributes':_0x3fdf98[_0x8462('0x1f')],'include':_0x3fdf98['include']?_[_0x8462('0x1d')](_0x3fdf98[_0x8462('0x1c')],function(_0x4a7f0b){return{'model':db[_0x4a7f0b[_0x8462('0x1e')]],'as':_0x4a7f0b['as'],'attributes':_0x4a7f0b['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x11a27f){logger['info']('ShowChatQueue',_0x32a3ad);logger[_0x8462('0x23')](_0x8462('0x20'),_0x32a3ad,JSON[_0x8462('0x10')](_0x11a27f));_0xf7d96a(_0x11a27f);})['catch'](function(_0x2bb9f6){logger['error'](_0x8462('0x20'),_0x2bb9f6['message'],_0x32a3ad);_0x3fc528(_0x4a7150[_0x8462('0x11')](0x1f4,_0x2bb9f6[_0x8462('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 6a4baa3..f4f1bea 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 _0x22fb=['remove','emit','removeListener','register','length','chatQueue:'];(function(_0xf737bf,_0x1efdea){var _0x308603=function(_0xbef4af){while(--_0xbef4af){_0xf737bf['push'](_0xf737bf['shift']());}};_0x308603(++_0x1efdea);}(_0x22fb,0x192));var _0xb22f=function(_0x5d4c6f,_0x5c9953){_0x5d4c6f=_0x5d4c6f-0x0;var _0x5d646f=_0x22fb[_0x5d4c6f];return _0x5d646f;};'use strict';var ChatQueueEvents=require('./chatQueue.events');var events=['save',_0xb22f('0x0'),'update'];function createListener(_0x3f643d,_0x306b6e){return function(_0x2221f1){_0x306b6e[_0xb22f('0x1')](_0x3f643d,_0x2221f1);};}function removeListener(_0x201512,_0x50cdab){return function(){ChatQueueEvents[_0xb22f('0x2')](_0x201512,_0x50cdab);};}exports[_0xb22f('0x3')]=function(_0x2d1fb3){for(var _0xc3ffcc=0x0,_0x412a95=events[_0xb22f('0x4')];_0xc3ffcc<_0x412a95;_0xc3ffcc++){var _0x47f61a=events[_0xc3ffcc];var _0x34433b=createListener(_0xb22f('0x5')+_0x47f61a,_0x2d1fb3);ChatQueueEvents['on'](_0x47f61a,_0x34433b);}}; \ No newline at end of file +var _0x6334=['length','chatQueue:','./chatQueue.events','save','remove','update','emit','removeListener','register'];(function(_0x19e56e,_0x13f117){var _0x368f76=function(_0x18f190){while(--_0x18f190){_0x19e56e['push'](_0x19e56e['shift']());}};_0x368f76(++_0x13f117);}(_0x6334,0x119));var _0x4633=function(_0x59616b,_0x38e534){_0x59616b=_0x59616b-0x0;var _0x5c4523=_0x6334[_0x59616b];return _0x5c4523;};'use strict';var ChatQueueEvents=require(_0x4633('0x0'));var events=[_0x4633('0x1'),_0x4633('0x2'),_0x4633('0x3')];function createListener(_0x1e53a0,_0x47254b){return function(_0x5109db){_0x47254b[_0x4633('0x4')](_0x1e53a0,_0x5109db);};}function removeListener(_0x205442,_0x2a2b3c){return function(){ChatQueueEvents[_0x4633('0x5')](_0x205442,_0x2a2b3c);};}exports[_0x4633('0x6')]=function(_0x6493dc){for(var _0x175e14=0x0,_0x4a8997=events[_0x4633('0x7')];_0x175e14<_0x4a8997;_0x175e14++){var _0x56891d=events[_0x175e14];var _0x21af74=createListener(_0x4633('0x8')+_0x56891d,_0x6493dc);ChatQueueEvents['on'](_0x56891d,_0x21af74);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 12d0646..1e7795e 100644 --- a/server/api/chatQueue/index.js +++ b/server/api/chatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7217=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','addTeams','update','delete','destroy','removeTeams','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x5bb4be,_0x3cb40c){var _0x3d66f8=function(_0x26a64f){while(--_0x26a64f){_0x5bb4be['push'](_0x5bb4be['shift']());}};_0x3d66f8(++_0x3cb40c);}(_0x7217,0x19e));var _0x7721=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0x7217[_0x3c2a69];return _0x596bc8;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router[_0x7721('0x8')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('0x8')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0x8')](_0x7721('0xf'),auth['isAuthenticated'](),controller[_0x7721('0x10')]);router[_0x7721('0x8')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x12')]);router[_0x7721('0x8')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller['getAgents']);router[_0x7721('0x14')]('/',auth[_0x7721('0x9')](),controller['create']);router[_0x7721('0x14')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x15')]);router['post'](_0x7721('0x13'),auth[_0x7721('0x9')](),controller['addAgents']);router['put']('/:id',auth[_0x7721('0x9')](),controller[_0x7721('0x16')]);router[_0x7721('0x17')](_0x7721('0xd'),auth['isAuthenticated'](),controller[_0x7721('0x18')]);router['delete'](_0x7721('0x11'),auth['isAuthenticated'](),controller[_0x7721('0x19')]);router[_0x7721('0x17')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller[_0x7721('0x1a')]);module[_0x7721('0x1b')]=router; \ No newline at end of file +var _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(_0xc9695d,_0x5e853f){_0xc9695d=_0xc9695d-0x0;var _0x35b499=_0x3e74[_0xc9695d];return _0x35b499;};'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 3b9e447..8b522b0 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 _0x6f72=['STRING','DATE','sequelize','exports'];(function(_0x131585,_0x1abd33){var _0x1fcca2=function(_0x8f165b){while(--_0x8f165b){_0x131585['push'](_0x131585['shift']());}};_0x1fcca2(++_0x1abd33);}(_0x6f72,0xae));var _0x26f7=function(_0x3d7c55,_0x38bac3){_0x3d7c55=_0x3d7c55-0x0;var _0x1b747d=_0x6f72[_0x3d7c55];return _0x1b747d;};'use strict';var moment=require('moment');var Sequelize=require(_0x26f7('0x0'));module[_0x26f7('0x1')]={'uniqueid':{'type':Sequelize[_0x26f7('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x26f7('0x3')]},'leaveAt':{'type':Sequelize[_0x26f7('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x26f7('0x3')]},'reason':{'type':Sequelize[_0x26f7('0x2')]}}; \ No newline at end of file +var _0xe773=['exports','STRING','DATE','sequelize'];(function(_0x5312fe,_0xb93720){var _0x2bfb49=function(_0x564d7a){while(--_0x564d7a){_0x5312fe['push'](_0x5312fe['shift']());}};_0x2bfb49(++_0xb93720);}(_0xe773,0x117));var _0x3e77=function(_0x17f274,_0x5331d0){_0x17f274=_0x17f274-0x0;var _0x273b80=_0xe773[_0x17f274];return _0x273b80;};'use strict';var moment=require('moment');var Sequelize=require(_0x3e77('0x0'));module[_0x3e77('0x1')]={'uniqueid':{'type':Sequelize[_0x3e77('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x3e77('0x2')]},'joinAt':{'type':Sequelize[_0x3e77('0x3')]},'leaveAt':{'type':Sequelize[_0x3e77('0x3')]},'acceptAt':{'type':Sequelize[_0x3e77('0x3')]},'exitAt':{'type':Sequelize[_0x3e77('0x3')]},'reason':{'type':Sequelize[_0x3e77('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index d1d5b0c..12bb609 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 _0x2dc3=['include','findAll','rows','catch','show','params','length','find','create','body','describe','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','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','save','then','destroy','error','name','send','index','map','ChatQueueReport','fieldName','key','keys','query','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll'];(function(_0x7afd31,_0x5a0987){var _0x592e81=function(_0xdc35f7){while(--_0xdc35f7){_0x7afd31['push'](_0x7afd31['shift']());}};_0x592e81(++_0x5a0987);}(_0x2dc3,0x127));var _0x32dc=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x2dc3[_0x501510];return _0x1e6ee5;};'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'];function respondWithStatusCode(_0x36ab9f,_0x480027){_0x480027=_0x480027||0xcc;return function(_0x3b163b){if(_0x3b163b){return _0x36ab9f[_0x32dc('0x16')](_0x480027);}return _0x36ab9f[_0x32dc('0x17')](_0x480027)['end']();};}function respondWithResult(_0x355d98,_0x10f169){_0x10f169=_0x10f169||0xc8;return function(_0x5e373a){if(_0x5e373a){return _0x355d98[_0x32dc('0x17')](_0x10f169)['json'](_0x5e373a);}};}function respondWithFilteredResult(_0x2dee08,_0x5954f3){return function(_0x47fe19){if(_0x47fe19){var _0x497b11=typeof _0x5954f3[_0x32dc('0x18')]===_0x32dc('0x19')&&typeof _0x5954f3[_0x32dc('0x1a')]==='undefined';var _0x284dfe=_0x47fe19[_0x32dc('0x1b')];var _0x38064a=_0x497b11?0x0:_0x5954f3['offset'];var _0x36e287=_0x497b11?_0x47fe19[_0x32dc('0x1b')]:_0x5954f3[_0x32dc('0x18')]+_0x5954f3[_0x32dc('0x1a')];var _0x5bbd7c;if(_0x36e287>=_0x284dfe){_0x36e287=_0x284dfe;_0x5bbd7c=0xc8;}else{_0x5bbd7c=0xce;}_0x2dee08[_0x32dc('0x17')](_0x5bbd7c);return _0x2dee08[_0x32dc('0x1c')](_0x32dc('0x1d'),_0x38064a+'-'+_0x36e287+'/'+_0x284dfe)[_0x32dc('0x1e')](_0x47fe19);}return null;};}function patchUpdates(_0x43b4a3){return function(_0x445c79){try{jsonpatch[_0x32dc('0x1f')](_0x445c79,_0x43b4a3,!![]);}catch(_0x33eae0){return BPromise['reject'](_0x33eae0);}return _0x445c79[_0x32dc('0x20')]();};}function saveUpdates(_0x37e2d1,_0xd8dd68){return function(_0x2a4bf9){if(_0x2a4bf9){return _0x2a4bf9['update'](_0x37e2d1)[_0x32dc('0x21')](function(_0x3582af){return _0x3582af;});}return null;};}function removeEntity(_0x36398c,_0x39182b){return function(_0x57e1e3){if(_0x57e1e3){return _0x57e1e3[_0x32dc('0x22')]()[_0x32dc('0x21')](function(){_0x36398c[_0x32dc('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51af54,_0x3718e1){return function(_0x4a0e6e){if(!_0x4a0e6e){_0x51af54[_0x32dc('0x16')](0x194);}return _0x4a0e6e;};}function handleError(_0x582651,_0x5a7382){_0x5a7382=_0x5a7382||0x1f4;return function(_0x50ccf4){logger[_0x32dc('0x23')](_0x50ccf4['stack']);if(_0x50ccf4[_0x32dc('0x24')]){delete _0x50ccf4[_0x32dc('0x24')];}_0x582651['status'](_0x5a7382)[_0x32dc('0x25')](_0x50ccf4);};}exports[_0x32dc('0x26')]=function(_0x28beb9,_0xa37191){var _0x287bb2={},_0x41d845={},_0x84c29d={'count':0x0,'rows':[]};var _0x53dd9e=_[_0x32dc('0x27')](db[_0x32dc('0x28')]['rawAttributes'],function(_0x486c19){return{'name':_0x486c19[_0x32dc('0x29')],'type':_0x486c19['type'][_0x32dc('0x2a')]};});_0x41d845['model']=_[_0x32dc('0x27')](_0x53dd9e,_0x32dc('0x24'));_0x41d845['query']=_[_0x32dc('0x2b')](_0x28beb9[_0x32dc('0x2c')]);_0x41d845[_0x32dc('0x2d')]=_['intersection'](_0x41d845[_0x32dc('0x2e')],_0x41d845[_0x32dc('0x2c')]);_0x287bb2[_0x32dc('0x2f')]=_[_0x32dc('0x30')](_0x41d845[_0x32dc('0x2e')],qs[_0x32dc('0x31')](_0x28beb9[_0x32dc('0x2c')][_0x32dc('0x31')]));_0x287bb2[_0x32dc('0x2f')]=_0x287bb2[_0x32dc('0x2f')]['length']?_0x287bb2[_0x32dc('0x2f')]:_0x41d845[_0x32dc('0x2e')];if(!_0x28beb9[_0x32dc('0x2c')][_0x32dc('0x32')](_0x32dc('0x33'))){_0x287bb2['limit']=qs[_0x32dc('0x1a')](_0x28beb9['query'][_0x32dc('0x1a')]);_0x287bb2['offset']=qs[_0x32dc('0x18')](_0x28beb9['query']['offset']);}_0x287bb2[_0x32dc('0x34')]=qs[_0x32dc('0x35')](_0x28beb9[_0x32dc('0x2c')][_0x32dc('0x35')]);_0x287bb2['where']=qs[_0x32dc('0x2d')](_[_0x32dc('0x36')](_0x28beb9[_0x32dc('0x2c')],_0x41d845[_0x32dc('0x2d')]),_0x53dd9e);if(_0x28beb9['query'][_0x32dc('0x37')]){_0x287bb2[_0x32dc('0x38')]=_[_0x32dc('0x39')](_0x287bb2[_0x32dc('0x38')],{'$or':_[_0x32dc('0x27')](_0x53dd9e,function(_0x5718b2){if(_0x5718b2['type']!=='VIRTUAL'){var _0x52b6d8={};_0x52b6d8[_0x5718b2['name']]={'$like':'%'+_0x28beb9[_0x32dc('0x2c')][_0x32dc('0x37')]+'%'};return _0x52b6d8;}})});}_0x287bb2=_['merge']({},_0x287bb2,_0x28beb9[_0x32dc('0x3a')]);var _0x46f049={'where':_0x287bb2['where']};return db[_0x32dc('0x28')][_0x32dc('0x1b')](_0x46f049)[_0x32dc('0x21')](function(_0x4afc95){_0x84c29d['count']=_0x4afc95;if(_0x28beb9[_0x32dc('0x2c')][_0x32dc('0x3b')]){_0x287bb2[_0x32dc('0x3c')]=[{'all':!![]}];}return db[_0x32dc('0x28')][_0x32dc('0x3d')](_0x287bb2);})[_0x32dc('0x21')](function(_0xc54728){_0x84c29d[_0x32dc('0x3e')]=_0xc54728;return _0x84c29d;})[_0x32dc('0x21')](respondWithFilteredResult(_0xa37191,_0x287bb2))[_0x32dc('0x3f')](handleError(_0xa37191,null));};exports[_0x32dc('0x40')]=function(_0x205e71,_0x4411c4){var _0x4d53f1={'raw':!![],'where':{'id':_0x205e71[_0x32dc('0x41')]['id']}},_0x5705fe={};_0x5705fe[_0x32dc('0x2e')]=_[_0x32dc('0x2b')](db[_0x32dc('0x28')]['rawAttributes']);_0x5705fe[_0x32dc('0x2c')]=_[_0x32dc('0x2b')](_0x205e71[_0x32dc('0x2c')]);_0x5705fe['filters']=_[_0x32dc('0x30')](_0x5705fe['model'],_0x5705fe[_0x32dc('0x2c')]);_0x4d53f1[_0x32dc('0x2f')]=_[_0x32dc('0x30')](_0x5705fe[_0x32dc('0x2e')],qs['fields'](_0x205e71[_0x32dc('0x2c')]['fields']));_0x4d53f1[_0x32dc('0x2f')]=_0x4d53f1['attributes'][_0x32dc('0x42')]?_0x4d53f1[_0x32dc('0x2f')]:_0x5705fe[_0x32dc('0x2e')];if(_0x205e71[_0x32dc('0x2c')][_0x32dc('0x3b')]){_0x4d53f1[_0x32dc('0x3c')]=[{'all':!![]}];}_0x4d53f1=_[_0x32dc('0x39')]({},_0x4d53f1,_0x205e71[_0x32dc('0x3a')]);return db[_0x32dc('0x28')][_0x32dc('0x43')](_0x4d53f1)[_0x32dc('0x21')](handleEntityNotFound(_0x4411c4,null))['then'](respondWithResult(_0x4411c4,null))[_0x32dc('0x3f')](handleError(_0x4411c4,null));};exports[_0x32dc('0x44')]=function(_0x265197,_0xdd70f5){return db['ChatQueueReport'][_0x32dc('0x44')](_0x265197['body'],{})[_0x32dc('0x21')](respondWithResult(_0xdd70f5,0xc9))['catch'](handleError(_0xdd70f5,null));};exports['update']=function(_0x79a5b6,_0xdb438c){if(_0x79a5b6[_0x32dc('0x45')]['id']){delete _0x79a5b6[_0x32dc('0x45')]['id'];}return db['ChatQueueReport'][_0x32dc('0x43')]({'where':{'id':_0x79a5b6[_0x32dc('0x41')]['id']}})[_0x32dc('0x21')](handleEntityNotFound(_0xdb438c,null))['then'](saveUpdates(_0x79a5b6['body'],null))[_0x32dc('0x21')](respondWithResult(_0xdb438c,null))['catch'](handleError(_0xdb438c,null));};exports[_0x32dc('0x22')]=function(_0x57ff36,_0x48395d){return db[_0x32dc('0x28')][_0x32dc('0x43')]({'where':{'id':_0x57ff36[_0x32dc('0x41')]['id']}})[_0x32dc('0x21')](handleEntityNotFound(_0x48395d,null))['then'](removeEntity(_0x48395d,null))[_0x32dc('0x3f')](handleError(_0x48395d,null));};exports['describe']=function(_0x2514ff,_0x2056c2){return db[_0x32dc('0x28')][_0x32dc('0x46')]()[_0x32dc('0x21')](respondWithResult(_0x2056c2,null))['catch'](handleError(_0x2056c2,null));}; \ No newline at end of file +var _0x576b=['apply','save','update','then','destroy','error','name','send','index','map','ChatQueueReport','fieldName','type','key','query','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','filters','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','keys','rawAttributes','options','create','body','find','catch','describe','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set'];(function(_0x386c34,_0x50e495){var _0x51c889=function(_0x22f542){while(--_0x22f542){_0x386c34['push'](_0x386c34['shift']());}};_0x51c889(++_0x50e495);}(_0x576b,0x1d9));var _0xb576=function(_0x894a65,_0x1f569f){_0x894a65=_0x894a65-0x0;var _0x12d580=_0x576b[_0x894a65];return _0x12d580;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb576('0x0'));var rp=require(_0xb576('0x1'));var moment=require('moment');var BPromise=require(_0xb576('0x2'));var Mustache=require(_0xb576('0x3'));var util=require('util');var path=require(_0xb576('0x4'));var sox=require(_0xb576('0x5'));var csv=require(_0xb576('0x6'));var ejs=require(_0xb576('0x7'));var fs=require('fs');var fs_extra=require(_0xb576('0x8'));var _=require(_0xb576('0x9'));var squel=require(_0xb576('0xa'));var crypto=require(_0xb576('0xb'));var jsforce=require(_0xb576('0xc'));var deskjs=require(_0xb576('0xd'));var toCsv=require(_0xb576('0x6'));var querystring=require(_0xb576('0xe'));var Papa=require(_0xb576('0xf'));var Redis=require(_0xb576('0x10'));var authService=require(_0xb576('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xb576('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb576('0x13'))(_0xb576('0x14'));var utils=require(_0xb576('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb576('0x16'))['db'];function respondWithStatusCode(_0x420041,_0x8d09e0){_0x8d09e0=_0x8d09e0||0xcc;return function(_0x1c5cf2){if(_0x1c5cf2){return _0x420041[_0xb576('0x17')](_0x8d09e0);}return _0x420041[_0xb576('0x18')](_0x8d09e0)[_0xb576('0x19')]();};}function respondWithResult(_0x1f3a23,_0xb80ee8){_0xb80ee8=_0xb80ee8||0xc8;return function(_0x1791f0){if(_0x1791f0){return _0x1f3a23['status'](_0xb80ee8)['json'](_0x1791f0);}};}function respondWithFilteredResult(_0x5cf596,_0x4173de){return function(_0x44f1b3){if(_0x44f1b3){var _0x18cd64=typeof _0x4173de[_0xb576('0x1a')]===_0xb576('0x1b')&&typeof _0x4173de[_0xb576('0x1c')]==='undefined';var _0x91d029=_0x44f1b3[_0xb576('0x1d')];var _0x5406c9=_0x18cd64?0x0:_0x4173de['offset'];var _0x394d7e=_0x18cd64?_0x44f1b3[_0xb576('0x1d')]:_0x4173de[_0xb576('0x1a')]+_0x4173de['limit'];var _0x4e8677;if(_0x394d7e>=_0x91d029){_0x394d7e=_0x91d029;_0x4e8677=0xc8;}else{_0x4e8677=0xce;}_0x5cf596['status'](_0x4e8677);return _0x5cf596[_0xb576('0x1e')]('Content-Range',_0x5406c9+'-'+_0x394d7e+'/'+_0x91d029)['json'](_0x44f1b3);}return null;};}function patchUpdates(_0x2243b1){return function(_0x2bedf0){try{jsonpatch[_0xb576('0x1f')](_0x2bedf0,_0x2243b1,!![]);}catch(_0x2a95a3){return BPromise['reject'](_0x2a95a3);}return _0x2bedf0[_0xb576('0x20')]();};}function saveUpdates(_0x38cf07,_0xde0fb1){return function(_0x2295ed){if(_0x2295ed){return _0x2295ed[_0xb576('0x21')](_0x38cf07)[_0xb576('0x22')](function(_0x2b6074){return _0x2b6074;});}return null;};}function removeEntity(_0x2a930d,_0x23d3e7){return function(_0x189c32){if(_0x189c32){return _0x189c32[_0xb576('0x23')]()[_0xb576('0x22')](function(){_0x2a930d[_0xb576('0x18')](0xcc)[_0xb576('0x19')]();});}};}function handleEntityNotFound(_0x5c343f,_0x456648){return function(_0xa0be5e){if(!_0xa0be5e){_0x5c343f[_0xb576('0x17')](0x194);}return _0xa0be5e;};}function handleError(_0x3b8a50,_0x12098f){_0x12098f=_0x12098f||0x1f4;return function(_0x46863c){logger[_0xb576('0x24')](_0x46863c['stack']);if(_0x46863c[_0xb576('0x25')]){delete _0x46863c[_0xb576('0x25')];}_0x3b8a50[_0xb576('0x18')](_0x12098f)[_0xb576('0x26')](_0x46863c);};}exports[_0xb576('0x27')]=function(_0x592dfc,_0x13d833){var _0x5a7b3d={},_0xc6cbc={},_0x19f443={'count':0x0,'rows':[]};var _0x239638=_[_0xb576('0x28')](db[_0xb576('0x29')]['rawAttributes'],function(_0x1be38b){return{'name':_0x1be38b[_0xb576('0x2a')],'type':_0x1be38b[_0xb576('0x2b')][_0xb576('0x2c')]};});_0xc6cbc['model']=_[_0xb576('0x28')](_0x239638,_0xb576('0x25'));_0xc6cbc[_0xb576('0x2d')]=_['keys'](_0x592dfc['query']);_0xc6cbc['filters']=_[_0xb576('0x2e')](_0xc6cbc[_0xb576('0x2f')],_0xc6cbc[_0xb576('0x2d')]);_0x5a7b3d[_0xb576('0x30')]=_[_0xb576('0x2e')](_0xc6cbc[_0xb576('0x2f')],qs[_0xb576('0x31')](_0x592dfc[_0xb576('0x2d')][_0xb576('0x31')]));_0x5a7b3d['attributes']=_0x5a7b3d[_0xb576('0x30')]['length']?_0x5a7b3d['attributes']:_0xc6cbc[_0xb576('0x2f')];if(!_0x592dfc[_0xb576('0x2d')][_0xb576('0x32')]('nolimit')){_0x5a7b3d[_0xb576('0x1c')]=qs[_0xb576('0x1c')](_0x592dfc['query'][_0xb576('0x1c')]);_0x5a7b3d[_0xb576('0x1a')]=qs[_0xb576('0x1a')](_0x592dfc[_0xb576('0x2d')][_0xb576('0x1a')]);}_0x5a7b3d[_0xb576('0x33')]=qs[_0xb576('0x34')](_0x592dfc[_0xb576('0x2d')][_0xb576('0x34')]);_0x5a7b3d[_0xb576('0x35')]=qs[_0xb576('0x36')](_['pick'](_0x592dfc['query'],_0xc6cbc[_0xb576('0x36')]),_0x239638);if(_0x592dfc['query'][_0xb576('0x37')]){_0x5a7b3d[_0xb576('0x35')]=_[_0xb576('0x38')](_0x5a7b3d[_0xb576('0x35')],{'$or':_['map'](_0x239638,function(_0x17f0dc){if(_0x17f0dc['type']!==_0xb576('0x39')){var _0x3e076a={};_0x3e076a[_0x17f0dc[_0xb576('0x25')]]={'$like':'%'+_0x592dfc['query'][_0xb576('0x37')]+'%'};return _0x3e076a;}})});}_0x5a7b3d=_['merge']({},_0x5a7b3d,_0x592dfc['options']);var _0x47012a={'where':_0x5a7b3d[_0xb576('0x35')]};return db[_0xb576('0x29')][_0xb576('0x1d')](_0x47012a)[_0xb576('0x22')](function(_0x3a61c9){_0x19f443['count']=_0x3a61c9;if(_0x592dfc[_0xb576('0x2d')][_0xb576('0x3a')]){_0x5a7b3d[_0xb576('0x3b')]=[{'all':!![]}];}return db[_0xb576('0x29')][_0xb576('0x3c')](_0x5a7b3d);})[_0xb576('0x22')](function(_0x1207f4){_0x19f443[_0xb576('0x3d')]=_0x1207f4;return _0x19f443;})[_0xb576('0x22')](respondWithFilteredResult(_0x13d833,_0x5a7b3d))['catch'](handleError(_0x13d833,null));};exports[_0xb576('0x3e')]=function(_0x30a358,_0xbf5ca7){var _0x1c6a4c={'raw':!![],'where':{'id':_0x30a358[_0xb576('0x3f')]['id']}},_0x28a0cb={};_0x28a0cb[_0xb576('0x2f')]=_[_0xb576('0x40')](db[_0xb576('0x29')][_0xb576('0x41')]);_0x28a0cb[_0xb576('0x2d')]=_['keys'](_0x30a358['query']);_0x28a0cb[_0xb576('0x36')]=_[_0xb576('0x2e')](_0x28a0cb[_0xb576('0x2f')],_0x28a0cb[_0xb576('0x2d')]);_0x1c6a4c[_0xb576('0x30')]=_[_0xb576('0x2e')](_0x28a0cb[_0xb576('0x2f')],qs[_0xb576('0x31')](_0x30a358[_0xb576('0x2d')]['fields']));_0x1c6a4c['attributes']=_0x1c6a4c[_0xb576('0x30')]['length']?_0x1c6a4c['attributes']:_0x28a0cb[_0xb576('0x2f')];if(_0x30a358[_0xb576('0x2d')][_0xb576('0x3a')]){_0x1c6a4c['include']=[{'all':!![]}];}_0x1c6a4c=_[_0xb576('0x38')]({},_0x1c6a4c,_0x30a358[_0xb576('0x42')]);return db[_0xb576('0x29')]['find'](_0x1c6a4c)['then'](handleEntityNotFound(_0xbf5ca7,null))[_0xb576('0x22')](respondWithResult(_0xbf5ca7,null))['catch'](handleError(_0xbf5ca7,null));};exports[_0xb576('0x43')]=function(_0xe74e70,_0x58f269){return db['ChatQueueReport'][_0xb576('0x43')](_0xe74e70[_0xb576('0x44')],{})[_0xb576('0x22')](respondWithResult(_0x58f269,0xc9))['catch'](handleError(_0x58f269,null));};exports[_0xb576('0x21')]=function(_0x27e80d,_0x35a707){if(_0x27e80d[_0xb576('0x44')]['id']){delete _0x27e80d[_0xb576('0x44')]['id'];}return db[_0xb576('0x29')][_0xb576('0x45')]({'where':{'id':_0x27e80d[_0xb576('0x3f')]['id']}})[_0xb576('0x22')](handleEntityNotFound(_0x35a707,null))[_0xb576('0x22')](saveUpdates(_0x27e80d[_0xb576('0x44')],null))[_0xb576('0x22')](respondWithResult(_0x35a707,null))[_0xb576('0x46')](handleError(_0x35a707,null));};exports[_0xb576('0x23')]=function(_0x32b58c,_0x33e0df){return db[_0xb576('0x29')][_0xb576('0x45')]({'where':{'id':_0x32b58c['params']['id']}})[_0xb576('0x22')](handleEntityNotFound(_0x33e0df,null))[_0xb576('0x22')](removeEntity(_0x33e0df,null))[_0xb576('0x46')](handleError(_0x33e0df,null));};exports[_0xb576('0x47')]=function(_0x40f867,_0x3fd02e){return db[_0xb576('0x29')]['describe']()['then'](respondWithResult(_0x3fd02e,null))['catch'](handleError(_0x3fd02e,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 0b0b827..07dea43 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(_0x5cc665,_0x124a7e){var _0x3d19a7=function(_0x2c4b97){while(--_0x2c4b97){_0x5cc665['push'](_0x5cc665['shift']());}};_0x3d19a7(++_0x124a7e);}(_0x757a,0xde));var _0xa757=function(_0x146c77,_0x5da6c8){_0x146c77=_0x146c77-0x0;var _0x20b38e=_0x757a[_0x146c77];return _0x20b38e;};'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 _0xb7e7=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','define','ChatQueueReport','uniqueid','lodash'];(function(_0x3d1c22,_0x4eb5fb){var _0x3af7ad=function(_0x34467b){while(--_0x34467b){_0x3d1c22['push'](_0x3d1c22['shift']());}};_0x3af7ad(++_0x4eb5fb);}(_0xb7e7,0x121));var _0x7b7e=function(_0x342700,_0x569f75){_0x342700=_0x342700-0x0;var _0x53406f=_0xb7e7[_0x342700];return _0x53406f;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));module['exports']=function(_0x53ed64,_0x333fa4){return _0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x8'),attributes,{'tableName':'report_chat_queue','paranoid':![],'indexes':[{'name':_0x7b7e('0x9'),'fields':[_0x7b7e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 40b3dc0..32c46e7 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 _0x53b0=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','ChatQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateChatQueueReport','create','body','options','raw','debug','UpdateChatQueueReport','update','where','attributes','limit','stringify'];(function(_0x5e13cc,_0x3b584d){var _0x42d93c=function(_0x2d0e3d){while(--_0x2d0e3d){_0x5e13cc['push'](_0x5e13cc['shift']());}};_0x42d93c(++_0x3b584d);}(_0x53b0,0x1dc));var _0x053b=function(_0x3d3fa1,_0x570439){_0x3d3fa1=_0x3d3fa1-0x0;var _0x4bfa64=_0x53b0[_0x3d3fa1];return _0x4bfa64;};'use strict';var _=require('lodash');var util=require(_0x053b('0x0'));var moment=require('moment');var BPromise=require(_0x053b('0x1'));var rs=require(_0x053b('0x2'));var fs=require('fs');var Redis=require(_0x053b('0x3'));var db=require(_0x053b('0x4'))['db'];var utils=require(_0x053b('0x5'));var logger=require(_0x053b('0x6'))(_0x053b('0x7'));var config=require(_0x053b('0x8'));var jayson=require(_0x053b('0x9'));var client=jayson['client'][_0x053b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x220070,_0x3267c1,_0x12bcfb){return new BPromise(function(_0x27df44,_0x1cffd3){return client[_0x053b('0xb')](_0x220070,_0x12bcfb)[_0x053b('0xc')](function(_0x3ba13a){logger[_0x053b('0xd')](_0x053b('0xe'),_0x3267c1,_0x053b('0xf'));logger['debug'](_0x053b('0x10'),_0x3267c1,_0x053b('0xf'),JSON['stringify'](_0x3ba13a));if(_0x3ba13a[_0x053b('0x11')]){if(_0x3ba13a[_0x053b('0x11')][_0x053b('0x12')]===0x1f4){logger['error'](_0x053b('0xe'),_0x3267c1,_0x3ba13a[_0x053b('0x11')][_0x053b('0x13')]);return _0x1cffd3(_0x3ba13a[_0x053b('0x11')]['message']);}logger[_0x053b('0x11')](_0x053b('0xe'),_0x3267c1,_0x3ba13a['error'][_0x053b('0x13')]);return _0x27df44(_0x3ba13a[_0x053b('0x11')][_0x053b('0x13')]);}else{logger[_0x053b('0xd')]('ChatQueueReport,\x20%s,\x20%s',_0x3267c1,_0x053b('0xf'));_0x27df44(_0x3ba13a[_0x053b('0x14')][_0x053b('0x13')]);}})[_0x053b('0x15')](function(_0x1653d8){logger[_0x053b('0x11')]('ChatQueueReport,\x20%s,\x20%s',_0x3267c1,_0x1653d8);_0x1cffd3(_0x1653d8);});});}exports[_0x053b('0x16')]=function(_0x33c2f5){var _0x35ecba=this;return new Promise(function(_0x2379ad,_0xe752b2){return db['ChatQueueReport'][_0x053b('0x17')](_0x33c2f5[_0x053b('0x18')],{'raw':_0x33c2f5[_0x053b('0x19')]?_0x33c2f5[_0x053b('0x19')][_0x053b('0x1a')]===undefined?!![]:![]:!![]})[_0x053b('0xc')](function(_0x40c404){logger['info'](_0x053b('0x16'),_0x33c2f5);logger[_0x053b('0x1b')](_0x053b('0x16'),_0x33c2f5,JSON['stringify'](_0x40c404));_0x2379ad(_0x40c404);})[_0x053b('0x15')](function(_0x389c70){logger['error']('CreateChatQueueReport',_0x389c70['message'],_0x33c2f5);_0xe752b2(_0x35ecba[_0x053b('0x11')](0x1f4,_0x389c70[_0x053b('0x13')]));});});};exports[_0x053b('0x1c')]=function(_0x2482a1){var _0x2642f2=this;return new Promise(function(_0xb73945,_0x534b18){return db['ChatQueueReport'][_0x053b('0x1d')](_0x2482a1[_0x053b('0x18')],{'raw':_0x2482a1['options']?_0x2482a1[_0x053b('0x19')][_0x053b('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2482a1[_0x053b('0x19')]?_0x2482a1[_0x053b('0x19')][_0x053b('0x1e')]||null:null,'attributes':_0x2482a1[_0x053b('0x19')]?_0x2482a1[_0x053b('0x19')][_0x053b('0x1f')]||null:null,'limit':_0x2482a1[_0x053b('0x19')]?_0x2482a1[_0x053b('0x19')][_0x053b('0x20')]||null:null})[_0x053b('0xc')](function(_0x86404a){logger[_0x053b('0xd')]('UpdateChatQueueReport',_0x2482a1);logger[_0x053b('0x1b')](_0x053b('0x1c'),_0x2482a1,JSON[_0x053b('0x21')](_0x86404a));_0xb73945(_0x86404a);})['catch'](function(_0x46bed4){logger['error'](_0x053b('0x1c'),_0x46bed4[_0x053b('0x13')],_0x2482a1);_0x534b18(_0x2642f2['error'](0x1f4,_0x46bed4[_0x053b('0x13')]));});});}; \ No newline at end of file +var _0xcbbb=['../../config/environment','jayson/promise','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateChatQueueReport','ChatQueueReport','create','body','raw','UpdateChatQueueReport','update','options','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x47ab94,_0x305e42){var _0x5bc244=function(_0x1ccb73){while(--_0x1ccb73){_0x47ab94['push'](_0x47ab94['shift']());}};_0x5bc244(++_0x305e42);}(_0xcbbb,0x1ee));var _0xbcbb=function(_0x45f951,_0x2750c8){_0x45f951=_0x45f951-0x0;var _0x24756c=_0xcbbb[_0x45f951];return _0x24756c;};'use strict';var _=require(_0xbcbb('0x0'));var util=require(_0xbcbb('0x1'));var moment=require(_0xbcbb('0x2'));var BPromise=require(_0xbcbb('0x3'));var rs=require(_0xbcbb('0x4'));var fs=require('fs');var Redis=require(_0xbcbb('0x5'));var db=require(_0xbcbb('0x6'))['db'];var utils=require(_0xbcbb('0x7'));var logger=require(_0xbcbb('0x8'))(_0xbcbb('0x9'));var config=require(_0xbcbb('0xa'));var jayson=require(_0xbcbb('0xb'));var client=jayson['client'][_0xbcbb('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5e8f4f,_0x5165d9,_0x3b9f7e){return new BPromise(function(_0xef0be8,_0x233eaa){return client[_0xbcbb('0xd')](_0x5e8f4f,_0x3b9f7e)[_0xbcbb('0xe')](function(_0x4feca1){logger[_0xbcbb('0xf')](_0xbcbb('0x10'),_0x5165d9,'request\x20sent');logger[_0xbcbb('0x11')](_0xbcbb('0x12'),_0x5165d9,_0xbcbb('0x13'),JSON[_0xbcbb('0x14')](_0x4feca1));if(_0x4feca1[_0xbcbb('0x15')]){if(_0x4feca1[_0xbcbb('0x15')][_0xbcbb('0x16')]===0x1f4){logger['error']('ChatQueueReport,\x20%s,\x20%s',_0x5165d9,_0x4feca1[_0xbcbb('0x15')][_0xbcbb('0x17')]);return _0x233eaa(_0x4feca1['error']['message']);}logger['error']('ChatQueueReport,\x20%s,\x20%s',_0x5165d9,_0x4feca1[_0xbcbb('0x15')][_0xbcbb('0x17')]);return _0xef0be8(_0x4feca1['error']['message']);}else{logger[_0xbcbb('0xf')](_0xbcbb('0x10'),_0x5165d9,'request\x20sent');_0xef0be8(_0x4feca1[_0xbcbb('0x18')]['message']);}})[_0xbcbb('0x19')](function(_0x3ce70e){logger['error']('ChatQueueReport,\x20%s,\x20%s',_0x5165d9,_0x3ce70e);_0x233eaa(_0x3ce70e);});});}exports[_0xbcbb('0x1a')]=function(_0x556ec9){var _0x587df2=this;return new Promise(function(_0x3a7644,_0xe524b4){return db[_0xbcbb('0x1b')][_0xbcbb('0x1c')](_0x556ec9[_0xbcbb('0x1d')],{'raw':_0x556ec9['options']?_0x556ec9['options'][_0xbcbb('0x1e')]===undefined?!![]:![]:!![]})[_0xbcbb('0xe')](function(_0x1b804f){logger[_0xbcbb('0xf')](_0xbcbb('0x1a'),_0x556ec9);logger[_0xbcbb('0x11')]('CreateChatQueueReport',_0x556ec9,JSON[_0xbcbb('0x14')](_0x1b804f));_0x3a7644(_0x1b804f);})['catch'](function(_0x30ebb9){logger[_0xbcbb('0x15')](_0xbcbb('0x1a'),_0x30ebb9[_0xbcbb('0x17')],_0x556ec9);_0xe524b4(_0x587df2[_0xbcbb('0x15')](0x1f4,_0x30ebb9['message']));});});};exports[_0xbcbb('0x1f')]=function(_0x46b924){var _0x2cdd88=this;return new Promise(function(_0x431a4c,_0x9263f8){return db['ChatQueueReport'][_0xbcbb('0x20')](_0x46b924[_0xbcbb('0x1d')],{'raw':_0x46b924[_0xbcbb('0x21')]?_0x46b924[_0xbcbb('0x21')][_0xbcbb('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x46b924[_0xbcbb('0x21')]?_0x46b924['options']['where']||null:null,'attributes':_0x46b924[_0xbcbb('0x21')]?_0x46b924[_0xbcbb('0x21')][_0xbcbb('0x22')]||null:null,'limit':_0x46b924[_0xbcbb('0x21')]?_0x46b924['options'][_0xbcbb('0x23')]||null:null})[_0xbcbb('0xe')](function(_0x5677c9){logger[_0xbcbb('0xf')]('UpdateChatQueueReport',_0x46b924);logger[_0xbcbb('0x11')](_0xbcbb('0x1f'),_0x46b924,JSON[_0xbcbb('0x14')](_0x5677c9));_0x431a4c(_0x5677c9);})[_0xbcbb('0x19')](function(_0x4237c2){logger['error'](_0xbcbb('0x1f'),_0x4237c2['message'],_0x46b924);_0x9263f8(_0x2cdd88['error'](0x1f4,_0x4237c2[_0xbcbb('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 2134515..c101aee 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 _0x30f9=['get','index','/describe','describe','show','post','isAuthenticated','create','put','/:id','update','delete','destroy','multer','connect-timeout','Router','../../components/auth/service','../../config/environment','./chatQueueReport.controller'];(function(_0x4bad6c,_0x29ec89){var _0x46ac3b=function(_0x7f67e0){while(--_0x7f67e0){_0x4bad6c['push'](_0x4bad6c['shift']());}};_0x46ac3b(++_0x29ec89);}(_0x30f9,0x6c));var _0x930f=function(_0x4cbf20,_0x1bfa66){_0x4cbf20=_0x4cbf20-0x0;var _0x582ae4=_0x30f9[_0x4cbf20];return _0x582ae4;};'use strict';var multer=require(_0x930f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x930f('0x1'));var express=require('express');var router=express[_0x930f('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x930f('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x930f('0x4'));var controller=require(_0x930f('0x5'));router[_0x930f('0x6')]('/',auth['isAuthenticated'](),controller[_0x930f('0x7')]);router[_0x930f('0x6')](_0x930f('0x8'),auth['isAuthenticated'](),controller[_0x930f('0x9')]);router[_0x930f('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x930f('0xa')]);router[_0x930f('0xb')]('/',auth[_0x930f('0xc')](),controller[_0x930f('0xd')]);router[_0x930f('0xe')](_0x930f('0xf'),auth[_0x930f('0xc')](),controller[_0x930f('0x10')]);router[_0x930f('0x11')]('/:id',auth[_0x930f('0xc')](),controller[_0x930f('0x12')]);module['exports']=router; \ No newline at end of file +var _0x9160=['create','put','/:id','update','destroy','exports','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','describe','show','post'];(function(_0xc6568f,_0xc4a5b6){var _0x31dbe8=function(_0x473a34){while(--_0x473a34){_0xc6568f['push'](_0xc6568f['shift']());}};_0x31dbe8(++_0xc4a5b6);}(_0x9160,0x1a6));var _0x0916=function(_0x231d3e,_0x20989c){_0x231d3e=_0x231d3e-0x0;var _0x3bc434=_0x9160[_0x231d3e];return _0x3bc434;};'use strict';var multer=require('multer');var util=require(_0x0916('0x0'));var path=require(_0x0916('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x0916('0x2'));var auth=require(_0x0916('0x3'));var interaction=require(_0x0916('0x4'));var config=require('../../config/environment');var controller=require('./chatQueueReport.controller');router[_0x0916('0x5')]('/',auth[_0x0916('0x6')](),controller['index']);router[_0x0916('0x5')]('/describe',auth[_0x0916('0x6')](),controller[_0x0916('0x7')]);router[_0x0916('0x5')]('/:id',auth[_0x0916('0x6')](),controller[_0x0916('0x8')]);router[_0x0916('0x9')]('/',auth[_0x0916('0x6')](),controller[_0x0916('0xa')]);router[_0x0916('0xb')](_0x0916('0xc'),auth[_0x0916('0x6')](),controller[_0x0916('0xd')]);router['delete'](_0x0916('0xc'),auth[_0x0916('0x6')](),controller[_0x0916('0xe')]);module[_0x0916('0xf')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 746f5b3..d21cfab 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 _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x57a902,_0x7a36c6){var _0x5c45d1=function(_0x118ea4){while(--_0x118ea4){_0x57a902['push'](_0x57a902['shift']());}};_0x5c45d1(++_0x7a36c6);}(_0xf4eb,0xec));var _0xbf4e=function(_0x2992e8,_0x579e0e){_0x2992e8=_0x2992e8-0x0;var _0xf50aef=_0xf4eb[_0x2992e8];return _0xf50aef;};'use strict';var moment=require(_0xbf4e('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbf4e('0x1'),'agent','queue'),'allowNull':![],'defaultValue':_0xbf4e('0x2')},'transferredAt':{'type':Sequelize[_0xbf4e('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xbf4e('0x4')]}}; \ No newline at end of file +var _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x4173d3,_0x34a106){var _0x4a7685=function(_0x2d1593){while(--_0x2d1593){_0x4173d3['push'](_0x4173d3['shift']());}};_0x4a7685(++_0x34a106);}(_0xedd9,0xfc));var _0x9edd=function(_0x2310f0,_0x35fc7e){_0x2310f0=_0x2310f0-0x0;var _0x25915c=_0xedd9[_0x2310f0];return _0x25915c;};'use strict';var moment=require('moment');var Sequelize=require(_0x9edd('0x0'));module[_0x9edd('0x1')]={'uniqueid':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9edd('0x3')](_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6')),'allowNull':![],'defaultValue':_0x9edd('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x9edd('0x7')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 2741217..3f50b0c 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 _0x27d6=['name','send','map','ChatTransferReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','length','find','create','body','describe','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','reject','save','update','then','destroy','error'];(function(_0x46d4e9,_0x37f650){var _0x5f1993=function(_0x1d656d){while(--_0x1d656d){_0x46d4e9['push'](_0x46d4e9['shift']());}};_0x5f1993(++_0x37f650);}(_0x27d6,0x14a));var _0x627d=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x27d6[_0x13e741];return _0x3f8bb3;};'use strict';var emlformat=require(_0x627d('0x0'));var rimraf=require(_0x627d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x627d('0x2'));var moment=require('moment');var BPromise=require(_0x627d('0x3'));var Mustache=require(_0x627d('0x4'));var util=require(_0x627d('0x5'));var path=require(_0x627d('0x6'));var sox=require(_0x627d('0x7'));var csv=require(_0x627d('0x8'));var ejs=require(_0x627d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x627d('0xa'));var squel=require(_0x627d('0xb'));var crypto=require(_0x627d('0xc'));var jsforce=require(_0x627d('0xd'));var deskjs=require(_0x627d('0xe'));var toCsv=require('to-csv');var querystring=require(_0x627d('0xf'));var Papa=require('papaparse');var Redis=require(_0x627d('0x10'));var authService=require(_0x627d('0x11'));var qs=require(_0x627d('0x12'));var as=require(_0x627d('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x627d('0x14'))('api');var utils=require(_0x627d('0x15'));var config=require(_0x627d('0x16'));var licenseUtil=require(_0x627d('0x17'));var db=require(_0x627d('0x18'))['db'];function respondWithStatusCode(_0x1ad092,_0x328a6d){_0x328a6d=_0x328a6d||0xcc;return function(_0x58b912){if(_0x58b912){return _0x1ad092[_0x627d('0x19')](_0x328a6d);}return _0x1ad092[_0x627d('0x1a')](_0x328a6d)[_0x627d('0x1b')]();};}function respondWithResult(_0x192481,_0x331e93){_0x331e93=_0x331e93||0xc8;return function(_0x198144){if(_0x198144){return _0x192481[_0x627d('0x1a')](_0x331e93)[_0x627d('0x1c')](_0x198144);}};}function respondWithFilteredResult(_0x2e98b3,_0x1c6839){return function(_0x3f6a1d){if(_0x3f6a1d){var _0x3f8d48=typeof _0x1c6839[_0x627d('0x1d')]===_0x627d('0x1e')&&typeof _0x1c6839['limit']===_0x627d('0x1e');var _0x27bbd2=_0x3f6a1d[_0x627d('0x1f')];var _0x169c96=_0x3f8d48?0x0:_0x1c6839[_0x627d('0x1d')];var _0x292091=_0x3f8d48?_0x3f6a1d[_0x627d('0x1f')]:_0x1c6839[_0x627d('0x1d')]+_0x1c6839[_0x627d('0x20')];var _0x88303d;if(_0x292091>=_0x27bbd2){_0x292091=_0x27bbd2;_0x88303d=0xc8;}else{_0x88303d=0xce;}_0x2e98b3[_0x627d('0x1a')](_0x88303d);return _0x2e98b3['set'](_0x627d('0x21'),_0x169c96+'-'+_0x292091+'/'+_0x27bbd2)['json'](_0x3f6a1d);}return null;};}function patchUpdates(_0x117a0f){return function(_0x418e96){try{jsonpatch['apply'](_0x418e96,_0x117a0f,!![]);}catch(_0x49a931){return BPromise[_0x627d('0x22')](_0x49a931);}return _0x418e96[_0x627d('0x23')]();};}function saveUpdates(_0x98e0b2,_0x2d5bb9){return function(_0x124be4){if(_0x124be4){return _0x124be4[_0x627d('0x24')](_0x98e0b2)[_0x627d('0x25')](function(_0x369524){return _0x369524;});}return null;};}function removeEntity(_0x1aa4d3,_0x20afa8){return function(_0x5472fd){if(_0x5472fd){return _0x5472fd[_0x627d('0x26')]()[_0x627d('0x25')](function(){_0x1aa4d3[_0x627d('0x1a')](0xcc)[_0x627d('0x1b')]();});}};}function handleEntityNotFound(_0x264267,_0x45558a){return function(_0x1dbdab){if(!_0x1dbdab){_0x264267[_0x627d('0x19')](0x194);}return _0x1dbdab;};}function handleError(_0x429891,_0x242e62){_0x242e62=_0x242e62||0x1f4;return function(_0x4a7d5c){logger[_0x627d('0x27')](_0x4a7d5c['stack']);if(_0x4a7d5c[_0x627d('0x28')]){delete _0x4a7d5c[_0x627d('0x28')];}_0x429891[_0x627d('0x1a')](_0x242e62)[_0x627d('0x29')](_0x4a7d5c);};}exports['index']=function(_0xbfe94e,_0xa151bf){var _0x32ac66={},_0x4dc3b7={},_0x2c304c={'count':0x0,'rows':[]};var _0x809b=_[_0x627d('0x2a')](db[_0x627d('0x2b')][_0x627d('0x2c')],function(_0x4daeb2){return{'name':_0x4daeb2[_0x627d('0x2d')],'type':_0x4daeb2[_0x627d('0x2e')][_0x627d('0x2f')]};});_0x4dc3b7[_0x627d('0x30')]=_['map'](_0x809b,'name');_0x4dc3b7[_0x627d('0x31')]=_['keys'](_0xbfe94e[_0x627d('0x31')]);_0x4dc3b7[_0x627d('0x32')]=_[_0x627d('0x33')](_0x4dc3b7[_0x627d('0x30')],_0x4dc3b7[_0x627d('0x31')]);_0x32ac66['attributes']=_['intersection'](_0x4dc3b7[_0x627d('0x30')],qs[_0x627d('0x34')](_0xbfe94e[_0x627d('0x31')][_0x627d('0x34')]));_0x32ac66[_0x627d('0x35')]=_0x32ac66[_0x627d('0x35')]['length']?_0x32ac66[_0x627d('0x35')]:_0x4dc3b7[_0x627d('0x30')];if(!_0xbfe94e[_0x627d('0x31')][_0x627d('0x36')](_0x627d('0x37'))){_0x32ac66['limit']=qs[_0x627d('0x20')](_0xbfe94e[_0x627d('0x31')][_0x627d('0x20')]);_0x32ac66['offset']=qs[_0x627d('0x1d')](_0xbfe94e[_0x627d('0x31')]['offset']);}_0x32ac66['order']=qs[_0x627d('0x38')](_0xbfe94e[_0x627d('0x31')][_0x627d('0x38')]);_0x32ac66['where']=qs[_0x627d('0x32')](_['pick'](_0xbfe94e['query'],_0x4dc3b7[_0x627d('0x32')]),_0x809b);if(_0xbfe94e[_0x627d('0x31')]['filter']){_0x32ac66[_0x627d('0x39')]=_['merge'](_0x32ac66['where'],{'$or':_[_0x627d('0x2a')](_0x809b,function(_0x13760d){if(_0x13760d[_0x627d('0x2e')]!==_0x627d('0x3a')){var _0x4a05b4={};_0x4a05b4[_0x13760d[_0x627d('0x28')]]={'$like':'%'+_0xbfe94e[_0x627d('0x31')][_0x627d('0x3b')]+'%'};return _0x4a05b4;}})});}_0x32ac66=_['merge']({},_0x32ac66,_0xbfe94e[_0x627d('0x3c')]);var _0x181b6f={'where':_0x32ac66[_0x627d('0x39')]};return db[_0x627d('0x2b')]['count'](_0x181b6f)[_0x627d('0x25')](function(_0x1e100f){_0x2c304c[_0x627d('0x1f')]=_0x1e100f;if(_0xbfe94e[_0x627d('0x31')][_0x627d('0x3d')]){_0x32ac66[_0x627d('0x3e')]=[{'all':!![]}];}return db[_0x627d('0x2b')][_0x627d('0x3f')](_0x32ac66);})[_0x627d('0x25')](function(_0x37d8ff){_0x2c304c[_0x627d('0x40')]=_0x37d8ff;return _0x2c304c;})[_0x627d('0x25')](respondWithFilteredResult(_0xa151bf,_0x32ac66))[_0x627d('0x41')](handleError(_0xa151bf,null));};exports[_0x627d('0x42')]=function(_0x103dd2,_0x546255){var _0x42a821={'raw':!![],'where':{'id':_0x103dd2[_0x627d('0x43')]['id']}},_0x4b994b={};_0x4b994b[_0x627d('0x30')]=_[_0x627d('0x44')](db[_0x627d('0x2b')]['rawAttributes']);_0x4b994b[_0x627d('0x31')]=_[_0x627d('0x44')](_0x103dd2[_0x627d('0x31')]);_0x4b994b[_0x627d('0x32')]=_['intersection'](_0x4b994b[_0x627d('0x30')],_0x4b994b[_0x627d('0x31')]);_0x42a821[_0x627d('0x35')]=_[_0x627d('0x33')](_0x4b994b[_0x627d('0x30')],qs[_0x627d('0x34')](_0x103dd2[_0x627d('0x31')][_0x627d('0x34')]));_0x42a821[_0x627d('0x35')]=_0x42a821[_0x627d('0x35')][_0x627d('0x45')]?_0x42a821[_0x627d('0x35')]:_0x4b994b[_0x627d('0x30')];if(_0x103dd2[_0x627d('0x31')][_0x627d('0x3d')]){_0x42a821[_0x627d('0x3e')]=[{'all':!![]}];}_0x42a821=_['merge']({},_0x42a821,_0x103dd2[_0x627d('0x3c')]);return db[_0x627d('0x2b')][_0x627d('0x46')](_0x42a821)[_0x627d('0x25')](handleEntityNotFound(_0x546255,null))['then'](respondWithResult(_0x546255,null))[_0x627d('0x41')](handleError(_0x546255,null));};exports[_0x627d('0x47')]=function(_0x2a134c,_0x5f17ff){return db['ChatTransferReport'][_0x627d('0x47')](_0x2a134c['body'],{})[_0x627d('0x25')](respondWithResult(_0x5f17ff,0xc9))[_0x627d('0x41')](handleError(_0x5f17ff,null));};exports[_0x627d('0x24')]=function(_0x136e2e,_0x46d5e2){if(_0x136e2e[_0x627d('0x48')]['id']){delete _0x136e2e[_0x627d('0x48')]['id'];}return db[_0x627d('0x2b')][_0x627d('0x46')]({'where':{'id':_0x136e2e['params']['id']}})[_0x627d('0x25')](handleEntityNotFound(_0x46d5e2,null))[_0x627d('0x25')](saveUpdates(_0x136e2e[_0x627d('0x48')],null))['then'](respondWithResult(_0x46d5e2,null))[_0x627d('0x41')](handleError(_0x46d5e2,null));};exports[_0x627d('0x26')]=function(_0x575758,_0x409064){return db['ChatTransferReport'][_0x627d('0x46')]({'where':{'id':_0x575758[_0x627d('0x43')]['id']}})[_0x627d('0x25')](handleEntityNotFound(_0x409064,null))[_0x627d('0x25')](removeEntity(_0x409064,null))[_0x627d('0x41')](handleError(_0x409064,null));};exports[_0x627d('0x49')]=function(_0x29fbc3,_0x267794){return db[_0x627d('0x2b')][_0x627d('0x49')]()[_0x627d('0x25')](respondWithResult(_0x267794,null))[_0x627d('0x41')](handleError(_0x267794,null));}; \ No newline at end of file +var _0x3a15=['filters','pick','filter','where','merge','type','VIRTUAL','options','findAll','rows','catch','params','length','include','find','create','body','describe','eml-format','zip-dir','request-promise','moment','bluebird','path','fs-extra','squel','crypto','jsforce','to-csv','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','error','stack','name','send','index','map','ChatTransferReport','rawAttributes','fieldName','model','query','keys','attributes','intersection','fields','nolimit','order','sort'];(function(_0x3d9b8c,_0x1accd9){var _0x5afdbc=function(_0x4ac82c){while(--_0x4ac82c){_0x3d9b8c['push'](_0x3d9b8c['shift']());}};_0x5afdbc(++_0x1accd9);}(_0x3a15,0xde));var _0x53a1=function(_0x4a787c,_0x129bdb){_0x4a787c=_0x4a787c-0x0;var _0xf4aff6=_0x3a15[_0x4a787c];return _0xf4aff6;};'use strict';var emlformat=require(_0x53a1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x53a1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x53a1('0x2'));var moment=require(_0x53a1('0x3'));var BPromise=require(_0x53a1('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x53a1('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x53a1('0x6'));var _=require('lodash');var squel=require(_0x53a1('0x7'));var crypto=require(_0x53a1('0x8'));var jsforce=require(_0x53a1('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x53a1('0xa'));var querystring=require(_0x53a1('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x53a1('0xc'));var as=require(_0x53a1('0xd'));var hardwareService=require(_0x53a1('0xe'));var logger=require(_0x53a1('0xf'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x53a1('0x10'));var db=require(_0x53a1('0x11'))['db'];function respondWithStatusCode(_0x50cd84,_0x1a89e9){_0x1a89e9=_0x1a89e9||0xcc;return function(_0x17d23b){if(_0x17d23b){return _0x50cd84[_0x53a1('0x12')](_0x1a89e9);}return _0x50cd84['status'](_0x1a89e9)[_0x53a1('0x13')]();};}function respondWithResult(_0x456144,_0x3d66f5){_0x3d66f5=_0x3d66f5||0xc8;return function(_0x36e275){if(_0x36e275){return _0x456144[_0x53a1('0x14')](_0x3d66f5)[_0x53a1('0x15')](_0x36e275);}};}function respondWithFilteredResult(_0x762aaa,_0x3313fe){return function(_0x474d58){if(_0x474d58){var _0x552306=typeof _0x3313fe[_0x53a1('0x16')]===_0x53a1('0x17')&&typeof _0x3313fe[_0x53a1('0x18')]===_0x53a1('0x17');var _0x153ce9=_0x474d58[_0x53a1('0x19')];var _0x1cb902=_0x552306?0x0:_0x3313fe['offset'];var _0x3c7bed=_0x552306?_0x474d58['count']:_0x3313fe[_0x53a1('0x16')]+_0x3313fe[_0x53a1('0x18')];var _0x6f21f7;if(_0x3c7bed>=_0x153ce9){_0x3c7bed=_0x153ce9;_0x6f21f7=0xc8;}else{_0x6f21f7=0xce;}_0x762aaa[_0x53a1('0x14')](_0x6f21f7);return _0x762aaa[_0x53a1('0x1a')](_0x53a1('0x1b'),_0x1cb902+'-'+_0x3c7bed+'/'+_0x153ce9)['json'](_0x474d58);}return null;};}function patchUpdates(_0x16916f){return function(_0x167671){try{jsonpatch['apply'](_0x167671,_0x16916f,!![]);}catch(_0xcea683){return BPromise[_0x53a1('0x1c')](_0xcea683);}return _0x167671['save']();};}function saveUpdates(_0x2f0f7e,_0x11253c){return function(_0x5173a3){if(_0x5173a3){return _0x5173a3[_0x53a1('0x1d')](_0x2f0f7e)[_0x53a1('0x1e')](function(_0x5f4135){return _0x5f4135;});}return null;};}function removeEntity(_0x1140a0,_0x1a4dab){return function(_0x471e34){if(_0x471e34){return _0x471e34[_0x53a1('0x1f')]()['then'](function(){_0x1140a0[_0x53a1('0x14')](0xcc)[_0x53a1('0x13')]();});}};}function handleEntityNotFound(_0x2a71f1,_0x1027d4){return function(_0x3bf15c){if(!_0x3bf15c){_0x2a71f1[_0x53a1('0x12')](0x194);}return _0x3bf15c;};}function handleError(_0x507a9e,_0xc8a720){_0xc8a720=_0xc8a720||0x1f4;return function(_0xc86808){logger[_0x53a1('0x20')](_0xc86808[_0x53a1('0x21')]);if(_0xc86808[_0x53a1('0x22')]){delete _0xc86808[_0x53a1('0x22')];}_0x507a9e[_0x53a1('0x14')](_0xc8a720)[_0x53a1('0x23')](_0xc86808);};}exports[_0x53a1('0x24')]=function(_0x162bd1,_0x255768){var _0x15a530={},_0x5cb95e={},_0x61d58c={'count':0x0,'rows':[]};var _0x384f20=_[_0x53a1('0x25')](db[_0x53a1('0x26')][_0x53a1('0x27')],function(_0x2da6b5){return{'name':_0x2da6b5[_0x53a1('0x28')],'type':_0x2da6b5['type']['key']};});_0x5cb95e[_0x53a1('0x29')]=_[_0x53a1('0x25')](_0x384f20,_0x53a1('0x22'));_0x5cb95e[_0x53a1('0x2a')]=_[_0x53a1('0x2b')](_0x162bd1[_0x53a1('0x2a')]);_0x5cb95e['filters']=_['intersection'](_0x5cb95e[_0x53a1('0x29')],_0x5cb95e[_0x53a1('0x2a')]);_0x15a530[_0x53a1('0x2c')]=_[_0x53a1('0x2d')](_0x5cb95e[_0x53a1('0x29')],qs[_0x53a1('0x2e')](_0x162bd1[_0x53a1('0x2a')][_0x53a1('0x2e')]));_0x15a530[_0x53a1('0x2c')]=_0x15a530['attributes']['length']?_0x15a530[_0x53a1('0x2c')]:_0x5cb95e[_0x53a1('0x29')];if(!_0x162bd1[_0x53a1('0x2a')]['hasOwnProperty'](_0x53a1('0x2f'))){_0x15a530[_0x53a1('0x18')]=qs[_0x53a1('0x18')](_0x162bd1[_0x53a1('0x2a')][_0x53a1('0x18')]);_0x15a530[_0x53a1('0x16')]=qs['offset'](_0x162bd1[_0x53a1('0x2a')][_0x53a1('0x16')]);}_0x15a530[_0x53a1('0x30')]=qs[_0x53a1('0x31')](_0x162bd1['query'][_0x53a1('0x31')]);_0x15a530['where']=qs[_0x53a1('0x32')](_[_0x53a1('0x33')](_0x162bd1[_0x53a1('0x2a')],_0x5cb95e[_0x53a1('0x32')]),_0x384f20);if(_0x162bd1[_0x53a1('0x2a')][_0x53a1('0x34')]){_0x15a530[_0x53a1('0x35')]=_[_0x53a1('0x36')](_0x15a530[_0x53a1('0x35')],{'$or':_['map'](_0x384f20,function(_0x2ae1f4){if(_0x2ae1f4[_0x53a1('0x37')]!==_0x53a1('0x38')){var _0x2d8216={};_0x2d8216[_0x2ae1f4[_0x53a1('0x22')]]={'$like':'%'+_0x162bd1['query'][_0x53a1('0x34')]+'%'};return _0x2d8216;}})});}_0x15a530=_[_0x53a1('0x36')]({},_0x15a530,_0x162bd1[_0x53a1('0x39')]);var _0x3da61c={'where':_0x15a530[_0x53a1('0x35')]};return db['ChatTransferReport']['count'](_0x3da61c)[_0x53a1('0x1e')](function(_0x3eb628){_0x61d58c[_0x53a1('0x19')]=_0x3eb628;if(_0x162bd1[_0x53a1('0x2a')]['includeAll']){_0x15a530['include']=[{'all':!![]}];}return db['ChatTransferReport'][_0x53a1('0x3a')](_0x15a530);})[_0x53a1('0x1e')](function(_0x45fb6d){_0x61d58c[_0x53a1('0x3b')]=_0x45fb6d;return _0x61d58c;})['then'](respondWithFilteredResult(_0x255768,_0x15a530))[_0x53a1('0x3c')](handleError(_0x255768,null));};exports['show']=function(_0x5c5c15,_0x21f531){var _0x4baec9={'raw':!![],'where':{'id':_0x5c5c15[_0x53a1('0x3d')]['id']}},_0x2e8242={};_0x2e8242['model']=_[_0x53a1('0x2b')](db['ChatTransferReport'][_0x53a1('0x27')]);_0x2e8242['query']=_[_0x53a1('0x2b')](_0x5c5c15['query']);_0x2e8242['filters']=_[_0x53a1('0x2d')](_0x2e8242['model'],_0x2e8242['query']);_0x4baec9[_0x53a1('0x2c')]=_[_0x53a1('0x2d')](_0x2e8242[_0x53a1('0x29')],qs['fields'](_0x5c5c15[_0x53a1('0x2a')][_0x53a1('0x2e')]));_0x4baec9[_0x53a1('0x2c')]=_0x4baec9[_0x53a1('0x2c')][_0x53a1('0x3e')]?_0x4baec9['attributes']:_0x2e8242[_0x53a1('0x29')];if(_0x5c5c15[_0x53a1('0x2a')]['includeAll']){_0x4baec9[_0x53a1('0x3f')]=[{'all':!![]}];}_0x4baec9=_[_0x53a1('0x36')]({},_0x4baec9,_0x5c5c15[_0x53a1('0x39')]);return db[_0x53a1('0x26')][_0x53a1('0x40')](_0x4baec9)['then'](handleEntityNotFound(_0x21f531,null))[_0x53a1('0x1e')](respondWithResult(_0x21f531,null))[_0x53a1('0x3c')](handleError(_0x21f531,null));};exports['create']=function(_0x5aabe1,_0x2d352d){return db[_0x53a1('0x26')][_0x53a1('0x41')](_0x5aabe1[_0x53a1('0x42')],{})[_0x53a1('0x1e')](respondWithResult(_0x2d352d,0xc9))[_0x53a1('0x3c')](handleError(_0x2d352d,null));};exports[_0x53a1('0x1d')]=function(_0x3c4aa3,_0x7dd2ee){if(_0x3c4aa3[_0x53a1('0x42')]['id']){delete _0x3c4aa3['body']['id'];}return db['ChatTransferReport'][_0x53a1('0x40')]({'where':{'id':_0x3c4aa3['params']['id']}})[_0x53a1('0x1e')](handleEntityNotFound(_0x7dd2ee,null))[_0x53a1('0x1e')](saveUpdates(_0x3c4aa3[_0x53a1('0x42')],null))['then'](respondWithResult(_0x7dd2ee,null))[_0x53a1('0x3c')](handleError(_0x7dd2ee,null));};exports[_0x53a1('0x1f')]=function(_0x455527,_0xbfe9aa){return db[_0x53a1('0x26')]['find']({'where':{'id':_0x455527[_0x53a1('0x3d')]['id']}})[_0x53a1('0x1e')](handleEntityNotFound(_0xbfe9aa,null))[_0x53a1('0x1e')](removeEntity(_0xbfe9aa,null))[_0x53a1('0x3c')](handleError(_0xbfe9aa,null));};exports[_0x53a1('0x43')]=function(_0x1b5484,_0x368374){return db[_0x53a1('0x26')]['describe']()['then'](respondWithResult(_0x368374,null))['catch'](handleError(_0x368374,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 31ba19b..a00747f 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 _0xdbbc=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes','exports','uniqueid','lodash','util','../../config/logger','api'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xdbbc,0x1c3));var _0xcdbb=function(_0x4a1d85,_0x54af7f){_0x4a1d85=_0x4a1d85-0x0;var _0x485f74=_0xdbbc[_0x4a1d85];return _0x485f74;};'use strict';var _=require(_0xcdbb('0x0'));var util=require(_0xcdbb('0x1'));var logger=require(_0xcdbb('0x2'))(_0xcdbb('0x3'));var moment=require(_0xcdbb('0x4'));var BPromise=require(_0xcdbb('0x5'));var rp=require(_0xcdbb('0x6'));var fs=require('fs');var path=require(_0xcdbb('0x7'));var rimraf=require(_0xcdbb('0x8'));var config=require(_0xcdbb('0x9'));var attributes=require(_0xcdbb('0xa'));module[_0xcdbb('0xb')]=function(_0x21e2a2,_0x5421dc){return _0x21e2a2['define']('ChatTransferReport',attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0xcdbb('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x51e2=['uniqueid','lodash','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','exports','ChatTransferReport','report_chat_transfer'];(function(_0x305ec9,_0x54c3d7){var _0x344ba2=function(_0x29edac){while(--_0x29edac){_0x305ec9['push'](_0x305ec9['shift']());}};_0x344ba2(++_0x54c3d7);}(_0x51e2,0x11f));var _0x251e=function(_0x1005d7,_0x4dba9d){_0x1005d7=_0x1005d7-0x0;var _0x1cd293=_0x51e2[_0x1005d7];return _0x1cd293;};'use strict';var _=require(_0x251e('0x0'));var util=require('util');var logger=require(_0x251e('0x1'))('api');var moment=require(_0x251e('0x2'));var BPromise=require('bluebird');var rp=require(_0x251e('0x3'));var fs=require('fs');var path=require(_0x251e('0x4'));var rimraf=require(_0x251e('0x5'));var config=require(_0x251e('0x6'));var attributes=require('./chatTransferReport.attributes');module[_0x251e('0x7')]=function(_0x568a40,_0x42ab46){return _0x568a40['define'](_0x251e('0x8'),attributes,{'tableName':_0x251e('0x9'),'paranoid':![],'indexes':[{'name':_0x251e('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 9ddd894..33636d4 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 _0x6ad9=['request\x20sent','error','code','message','info','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','ChatTransferReport,\x20%s,\x20%s','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x6ad9,0x12c));var _0x96ad=function(_0x5f293b,_0x3532ff){_0x5f293b=_0x5f293b-0x0;var _0x453b19=_0x6ad9[_0x5f293b];return _0x453b19;};'use strict';var _=require(_0x96ad('0x0'));var util=require('util');var moment=require(_0x96ad('0x1'));var BPromise=require('bluebird');var rs=require(_0x96ad('0x2'));var fs=require('fs');var Redis=require(_0x96ad('0x3'));var db=require(_0x96ad('0x4'))['db'];var utils=require(_0x96ad('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x96ad('0x6'));var jayson=require(_0x96ad('0x7'));var client=jayson[_0x96ad('0x8')][_0x96ad('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x48e219,_0x1f8a85,_0x970d7){return new BPromise(function(_0x5ea1bd,_0xa94a97){return client[_0x96ad('0xa')](_0x48e219,_0x970d7)[_0x96ad('0xb')](function(_0x3157ac){logger['info'](_0x96ad('0xc'),_0x1f8a85,'request\x20sent');logger[_0x96ad('0xd')](_0x96ad('0xe'),_0x1f8a85,_0x96ad('0xf'),JSON['stringify'](_0x3157ac));if(_0x3157ac['error']){if(_0x3157ac[_0x96ad('0x10')][_0x96ad('0x11')]===0x1f4){logger[_0x96ad('0x10')](_0x96ad('0xc'),_0x1f8a85,_0x3157ac[_0x96ad('0x10')][_0x96ad('0x12')]);return _0xa94a97(_0x3157ac['error'][_0x96ad('0x12')]);}logger[_0x96ad('0x10')](_0x96ad('0xc'),_0x1f8a85,_0x3157ac['error'][_0x96ad('0x12')]);return _0x5ea1bd(_0x3157ac['error'][_0x96ad('0x12')]);}else{logger[_0x96ad('0x13')]('ChatTransferReport,\x20%s,\x20%s',_0x1f8a85,_0x96ad('0xf'));_0x5ea1bd(_0x3157ac['result'][_0x96ad('0x12')]);}})[_0x96ad('0x14')](function(_0x3b6ce6){logger[_0x96ad('0x10')](_0x96ad('0xc'),_0x1f8a85,_0x3b6ce6);_0xa94a97(_0x3b6ce6);});});} \ No newline at end of file +var _0x8680=['catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x3b75e6,_0x2a79a1){var _0x2df5f3=function(_0x54f00f){while(--_0x54f00f){_0x3b75e6['push'](_0x3b75e6['shift']());}};_0x2df5f3(++_0x2a79a1);}(_0x8680,0x169));var _0x0868=function(_0x1435e7,_0x5537ae){_0x1435e7=_0x1435e7-0x0;var _0x20f0be=_0x8680[_0x1435e7];return _0x20f0be;};'use strict';var _=require('lodash');var util=require(_0x0868('0x0'));var moment=require(_0x0868('0x1'));var BPromise=require(_0x0868('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0868('0x3'));var db=require(_0x0868('0x4'))['db'];var utils=require(_0x0868('0x5'));var logger=require('../../config/logger')(_0x0868('0x6'));var config=require(_0x0868('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0868('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x49dec1,_0x5749ad,_0x1a0cb8){return new BPromise(function(_0x1c3574,_0x613998){return client[_0x0868('0x9')](_0x49dec1,_0x1a0cb8)[_0x0868('0xa')](function(_0xb769e9){logger[_0x0868('0xb')](_0x0868('0xc'),_0x5749ad,_0x0868('0xd'));logger['debug'](_0x0868('0xe'),_0x5749ad,_0x0868('0xd'),JSON[_0x0868('0xf')](_0xb769e9));if(_0xb769e9[_0x0868('0x10')]){if(_0xb769e9[_0x0868('0x10')][_0x0868('0x11')]===0x1f4){logger[_0x0868('0x10')]('ChatTransferReport,\x20%s,\x20%s',_0x5749ad,_0xb769e9[_0x0868('0x10')][_0x0868('0x12')]);return _0x613998(_0xb769e9[_0x0868('0x10')]['message']);}logger[_0x0868('0x10')]('ChatTransferReport,\x20%s,\x20%s',_0x5749ad,_0xb769e9['error'][_0x0868('0x12')]);return _0x1c3574(_0xb769e9[_0x0868('0x10')]['message']);}else{logger[_0x0868('0xb')](_0x0868('0xc'),_0x5749ad,'request\x20sent');_0x1c3574(_0xb769e9['result'][_0x0868('0x12')]);}})[_0x0868('0x13')](function(_0x5a9b96){logger[_0x0868('0x10')]('ChatTransferReport,\x20%s,\x20%s',_0x5749ad,_0x5a9b96);_0x613998(_0x5a9b96);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index a7c5580..4596753 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 _0x5745=['../../components/auth/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','/describe','/:id','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x182573,_0x1899ea){var _0x5dcbc1=function(_0x685bc3){while(--_0x685bc3){_0x182573['push'](_0x182573['shift']());}};_0x5dcbc1(++_0x1899ea);}(_0x5745,0x1e8));var _0x5574=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x5745[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x5574('0x0'));var util=require(_0x5574('0x1'));var path=require(_0x5574('0x2'));var timeout=require(_0x5574('0x3'));var express=require(_0x5574('0x4'));var router=express['Router']();var fs_extra=require(_0x5574('0x5'));var auth=require(_0x5574('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5574('0x7'));var controller=require(_0x5574('0x8'));router[_0x5574('0x9')]('/',auth[_0x5574('0xa')](),controller['index']);router['get'](_0x5574('0xb'),auth[_0x5574('0xa')](),controller['describe']);router['get'](_0x5574('0xc'),auth[_0x5574('0xa')](),controller['show']);router[_0x5574('0xd')]('/',auth[_0x5574('0xa')](),controller[_0x5574('0xe')]);router[_0x5574('0xf')]('/:id',auth[_0x5574('0xa')](),controller[_0x5574('0x10')]);router[_0x5574('0x11')](_0x5574('0xc'),auth[_0x5574('0xa')](),controller['destroy']);module[_0x5574('0x12')]=router; \ No newline at end of file +var _0x99b9=['fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','get','/describe','describe','show','post','create','put','/:id','delete','destroy','exports','multer','util','connect-timeout','express'];(function(_0x4b4b0e,_0x6c674){var _0x4c2d91=function(_0x4d440d){while(--_0x4d440d){_0x4b4b0e['push'](_0x4b4b0e['shift']());}};_0x4c2d91(++_0x6c674);}(_0x99b9,0x13f));var _0x999b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x99b9[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x999b('0x0'));var util=require(_0x999b('0x1'));var path=require('path');var timeout=require(_0x999b('0x2'));var express=require(_0x999b('0x3'));var router=express['Router']();var fs_extra=require(_0x999b('0x4'));var auth=require(_0x999b('0x5'));var interaction=require(_0x999b('0x6'));var config=require('../../config/environment');var controller=require('./chatTransferReport.controller');router['get']('/',auth[_0x999b('0x7')](),controller['index']);router[_0x999b('0x8')](_0x999b('0x9'),auth['isAuthenticated'](),controller[_0x999b('0xa')]);router[_0x999b('0x8')]('/:id',auth[_0x999b('0x7')](),controller[_0x999b('0xb')]);router[_0x999b('0xc')]('/',auth['isAuthenticated'](),controller[_0x999b('0xd')]);router[_0x999b('0xe')](_0x999b('0xf'),auth[_0x999b('0x7')](),controller['update']);router[_0x999b('0x10')](_0x999b('0xf'),auth['isAuthenticated'](),controller[_0x999b('0x11')]);module[_0x999b('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index b89f77e..d0345d2 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 _0xcf32=['Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Skip','website_alias','bottom_right','CHAT','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','exports','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER','ENUM','squared','rounded','We\x20are\x20here!','Contact\x20us','BOOLEAN','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Send','thumb','star','stringify','input','name','text','getDataValue','onlineForm','parse','textarea','Leave\x20your\x20comments','offlineForm','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'];(function(_0x36e6b6,_0x189fe2){var _0x1aea27=function(_0x552b0f){while(--_0x552b0f){_0x36e6b6['push'](_0x36e6b6['shift']());}};_0x1aea27(++_0x189fe2);}(_0xcf32,0x70));var _0x2cf3=function(_0x3227c1,_0x4318c5){_0x3227c1=_0x3227c1-0x0;var _0x31fd48=_0xcf32[_0x3227c1];return _0x31fd48;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0x2cf3('0x0')]={'name':{'type':Sequelize[_0x2cf3('0x1')],'allowNull':![]},'address':{'type':Sequelize[_0x2cf3('0x1')],'allowNull':![],'unique':_0x2cf3('0x2')},'description':{'type':Sequelize[_0x2cf3('0x1')]},'mapKey':{'type':Sequelize[_0x2cf3('0x1')],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize[_0x2cf3('0x1')],'defaultValue':_0x2cf3('0x3')},'key':{'type':Sequelize[_0x2cf3('0x1')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x2cf3('0x1')],'defaultValue':_0x2cf3('0x4')},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x2cf3('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x2cf3('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x2cf3('0x1')],'allowNull':![],'defaultValue':_0x2cf3('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x2cf3('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x2cf3('0x1')]},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x2cf3('0x8')]('rounded',_0x2cf3('0x9')),'defaultValue':_0x2cf3('0xa')},'header_online':{'type':Sequelize[_0x2cf3('0x1')],'defaultValue':_0x2cf3('0xb')},'start_chat_button':{'type':Sequelize[_0x2cf3('0x1')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize[_0x2cf3('0x1')],'defaultValue':'Send'},'header_offline':{'type':Sequelize[_0x2cf3('0x1')],'defaultValue':_0x2cf3('0xc')},'download_transcript':{'type':Sequelize[_0x2cf3('0xd')],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x2cf3('0x1')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x2cf3('0xe')]},'closingQuestion':{'type':Sequelize[_0x2cf3('0x1')],'defaultValue':_0x2cf3('0xf')},'formSubmitSuccessMessage':{'type':Sequelize[_0x2cf3('0x1')],'defaultValue':_0x2cf3('0x10')},'formSubmitFailureMessage':{'type':Sequelize[_0x2cf3('0x1')],'defaultValue':_0x2cf3('0x11')},'noteTitle':{'type':Sequelize[_0x2cf3('0x1')],'defaultValue':_0x2cf3('0x12')},'placeholderMessage':{'type':Sequelize[_0x2cf3('0x1')],'defaultValue':_0x2cf3('0x13')},'closingMessage':{'type':Sequelize[_0x2cf3('0x1')],'defaultValue':_0x2cf3('0x14')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x2cf3('0x15')},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x2cf3('0xd')],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x2cf3('0x1')],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize[_0x2cf3('0x8')]('star',_0x2cf3('0x16')),'defaultValue':_0x2cf3('0x17')},'ratingStarsNumber':{'type':Sequelize[_0x2cf3('0x7')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x2cf3('0xe')],'defaultValue':function(){return JSON[_0x2cf3('0x18')]({'items':[{'type':_0x2cf3('0x19'),'variable':null,'config':{'placeholder':_0x2cf3('0x1a'),'type':_0x2cf3('0x1b'),'required':!![]},'props':{'title':'name','helpText':''}},{'type':_0x2cf3('0x19'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x2cf3('0x3'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x2cf3('0x1c')](_0x2cf3('0x1d'))?JSON[_0x2cf3('0x1e')](this['getDataValue'](_0x2cf3('0x1d'))):{};},'set':function(_0x10d371){return this['setDataValue'](_0x2cf3('0x1d'),JSON[_0x2cf3('0x18')](_0x10d371));}},'offlineForm':{'type':Sequelize[_0x2cf3('0xe')],'defaultValue':function(){return JSON[_0x2cf3('0x18')]({'items':[{'type':'input','props':{'title':_0x2cf3('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0x2cf3('0x3'),'type':'email'},'variable':null},{'type':_0x2cf3('0x1f'),'config':{'placeholder':'Comments'},'props':{'title':'Comments','helpText':_0x2cf3('0x20')}}],'fromKey':0x0});},'get':function(){return this[_0x2cf3('0x1c')](_0x2cf3('0x21'))?JSON[_0x2cf3('0x1e')](this['getDataValue']('offlineForm')):{};},'set':function(_0x4a4b90){return this['setDataValue']('offlineForm',JSON[_0x2cf3('0x18')](_0x4a4b90));}},'token':{'type':Sequelize[_0x2cf3('0x1')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x2cf3('0xd')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x2cf3('0xd')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x2cf3('0x1')]},'forwardOffline':{'type':Sequelize[_0x2cf3('0xd')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x2cf3('0x1')]},'waitingTitle':{'type':Sequelize[_0x2cf3('0x1')],'defaultValue':_0x2cf3('0x22')},'waitingMessage':{'type':Sequelize[_0x2cf3('0x1')],'defaultValue':_0x2cf3('0x23')},'offlineMessageSubject':{'type':Sequelize[_0x2cf3('0x1')],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0x2cf3('0x24')},'enableUnmanagedNote':{'type':Sequelize[_0x2cf3('0xd')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x2cf3('0x1')],'defaultValue':_0x2cf3('0x25')},'skipUnmanaged':{'type':Sequelize[_0x2cf3('0x1')],'defaultValue':_0x2cf3('0x26')},'sendUnmanaged':{'type':Sequelize[_0x2cf3('0x1')],'defaultValue':_0x2cf3('0x15')},'enableCustomerAttachment':{'type':Sequelize[_0x2cf3('0xd')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x2cf3('0xd')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize[_0x2cf3('0x1')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x2cf3('0xd')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x2cf3('0xd')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x2cf3('0xd')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x2cf3('0x1')],'defaultValue':_0x2cf3('0x27')},'waitForTheAssignedAgent':{'type':Sequelize[_0x2cf3('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x2cf3('0x1')],'defaultValue':_0x2cf3('0x28')},'verticalAlignment':{'type':Sequelize[_0x2cf3('0x7')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x2cf3('0x1')],'defaultValue':_0x2cf3('0x29')},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0x2cf3('0x1')]},'customerAvatar':{'type':Sequelize[_0x2cf3('0xe')]},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x2cf3('0x1')],'allowNull':![],'defaultValue':_0x2cf3('0x2a'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x2cf3('0xd')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x2cf3('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x2cf3('0x1')],'defaultValue':_0x2cf3('0x2b')},'systemAvatar':{'type':Sequelize[_0x2cf3('0xe')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x2cf3('0x7')],'comment':_0x2cf3('0x2c')},'mandatoryDisposition':{'type':Sequelize[_0x2cf3('0xd')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x5a4bb0){if(!_0x5a4bb0)this[_0x2cf3('0x2d')](_0x2cf3('0x2e'),null);this[_0x2cf3('0x2d')](_0x2cf3('0x2f'),_0x5a4bb0);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x2cf3('0x1')]},'vidaooTopic':{'type':Sequelize[_0x2cf3('0x1')],'allowNull':![],'defaultValue':_0x2cf3('0x30')},'vidaooNote':{'type':Sequelize[_0x2cf3('0x1')],'defaultValue':function(){return'Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}';}},'vidaooMetadata':{'type':Sequelize[_0x2cf3('0xe')],'defaultValue':null},'openNewInteraction':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x2cf3('0xe')]}}; \ No newline at end of file +var _0xf5b4=['input','name','text','onlineForm','parse','getDataValue','setDataValue','textarea','Comments','offlineForm','generate','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','Your\x20request\x20has\x20not\x20been\x20processed.','Skip','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','CHAT','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','exports','STRING','address','email','Agent','#011F6A','#ffffff','BOOLEAN','rounded','squared','We\x20are\x20here!','Chat','Send','INTEGER','Powered\x20by\x20xCALLY','Form\x20properly\x20submitted','Form\x20submission\x20error','Thanks\x20you\x20for\x20your\x20time!','ENUM','star','TEXT','stringify'];(function(_0x437db9,_0xd65673){var _0x511697=function(_0x2db1cb){while(--_0x2db1cb){_0x437db9['push'](_0x437db9['shift']());}};_0x511697(++_0xd65673);}(_0xf5b4,0xb1));var _0x4f5b=function(_0x3f0c12,_0xea4b1d){_0x3f0c12=_0x3f0c12-0x0;var _0x2b90e0=_0xf5b4[_0x3f0c12];return _0x2b90e0;};'use strict';var Sequelize=require(_0x4f5b('0x0'));var rs=require('randomstring');module[_0x4f5b('0x1')]={'name':{'type':Sequelize[_0x4f5b('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0x4f5b('0x2')],'allowNull':![],'unique':_0x4f5b('0x3')},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize[_0x4f5b('0x2')],'defaultValue':_0x4f5b('0x4')},'mapKeyOffline':{'type':Sequelize[_0x4f5b('0x2')],'defaultValue':_0x4f5b('0x4')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0x4f5b('0x5')},'customerAlias':{'type':Sequelize[_0x4f5b('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x4f5b('0x2')],'allowNull':![],'defaultValue':_0x4f5b('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x4f5b('0x2')],'allowNull':![],'defaultValue':_0x4f5b('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x4f5b('0x2')],'allowNull':![],'defaultValue':_0x4f5b('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0x4f5b('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM'](_0x4f5b('0x9'),_0x4f5b('0xa')),'defaultValue':'rounded'},'header_online':{'type':Sequelize[_0x4f5b('0x2')],'defaultValue':_0x4f5b('0xb')},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x4f5b('0xc')},'offline_chat_button':{'type':Sequelize[_0x4f5b('0x2')],'defaultValue':_0x4f5b('0xd')},'header_offline':{'type':Sequelize[_0x4f5b('0x2')],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize[_0x4f5b('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x4f5b('0xe')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x4f5b('0x2')],'defaultValue':_0x4f5b('0xf')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize[_0x4f5b('0x2')],'defaultValue':_0x4f5b('0x10')},'formSubmitFailureMessage':{'type':Sequelize[_0x4f5b('0x2')],'defaultValue':_0x4f5b('0x11')},'noteTitle':{'type':Sequelize[_0x4f5b('0x2')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x4f5b('0x12')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x4f5b('0xd')},'skipMessageButton':{'type':Sequelize[_0x4f5b('0x2')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0x4f5b('0x8')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x4f5b('0x8')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x4f5b('0x8')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x4f5b('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x4f5b('0x2')],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize[_0x4f5b('0x13')](_0x4f5b('0x14'),'thumb'),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x4f5b('0x15')],'defaultValue':function(){return JSON[_0x4f5b('0x16')]({'items':[{'type':_0x4f5b('0x17'),'variable':null,'config':{'placeholder':_0x4f5b('0x18'),'type':_0x4f5b('0x19'),'required':!![]},'props':{'title':_0x4f5b('0x18'),'helpText':''}},{'type':_0x4f5b('0x17'),'props':{'title':_0x4f5b('0x4'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0x4f5b('0x1a'))?JSON[_0x4f5b('0x1b')](this[_0x4f5b('0x1c')]('onlineForm')):{};},'set':function(_0x278474){return this[_0x4f5b('0x1d')]('onlineForm',JSON[_0x4f5b('0x16')](_0x278474));}},'offlineForm':{'type':Sequelize[_0x4f5b('0x15')],'defaultValue':function(){return JSON[_0x4f5b('0x16')]({'items':[{'type':_0x4f5b('0x17'),'props':{'title':_0x4f5b('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x4f5b('0x4'),'type':'email'},'variable':null},{'type':_0x4f5b('0x1e'),'config':{'placeholder':_0x4f5b('0x1f')},'props':{'title':_0x4f5b('0x1f'),'helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0x4f5b('0x1c')](_0x4f5b('0x20'))?JSON[_0x4f5b('0x1b')](this[_0x4f5b('0x1c')](_0x4f5b('0x20'))):{};},'set':function(_0x31cfd4){return this[_0x4f5b('0x1d')](_0x4f5b('0x20'),JSON[_0x4f5b('0x16')](_0x31cfd4));}},'token':{'type':Sequelize[_0x4f5b('0x2')],'defaultValue':function(){return rs[_0x4f5b('0x21')]();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x4f5b('0x8')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x4f5b('0x2')]},'forwardOffline':{'type':Sequelize[_0x4f5b('0x8')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x4f5b('0x2')]},'waitingTitle':{'type':Sequelize[_0x4f5b('0x2')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x4f5b('0x22')},'offlineMessageSubject':{'type':Sequelize[_0x4f5b('0x2')],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0x4f5b('0x2')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0x4f5b('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x4f5b('0x2')],'defaultValue':_0x4f5b('0x23')},'skipUnmanaged':{'type':Sequelize[_0x4f5b('0x2')],'defaultValue':_0x4f5b('0x24')},'sendUnmanaged':{'type':Sequelize[_0x4f5b('0x2')],'defaultValue':_0x4f5b('0xd')},'enableCustomerAttachment':{'type':Sequelize[_0x4f5b('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x4f5b('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize[_0x4f5b('0x8')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x4f5b('0x2')]},'notificationTemplate':{'type':Sequelize[_0x4f5b('0x15')],'defaultValue':function(){return _0x4f5b('0x25');}},'notificationSound':{'type':Sequelize[_0x4f5b('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x4f5b('0x8')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x4f5b('0x8')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x4f5b('0x2')],'defaultValue':_0x4f5b('0x26')},'waitForTheAssignedAgent':{'type':Sequelize[_0x4f5b('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x4f5b('0x2')],'defaultValue':_0x4f5b('0x27')},'verticalAlignment':{'type':Sequelize[_0x4f5b('0xe')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x4f5b('0x2')],'defaultValue':_0x4f5b('0x28')},'messagesAlignment':{'type':Sequelize[_0x4f5b('0x2')],'defaultValue':_0x4f5b('0x29')},'defaultTitle':{'type':Sequelize[_0x4f5b('0x2')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x4f5b('0xe')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x4f5b('0x2')],'allowNull':![],'defaultValue':_0x4f5b('0x2a'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x4f5b('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x4f5b('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x4f5b('0x2')],'defaultValue':_0x4f5b('0x2b')},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x4f5b('0x2c')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x4f5b('0x2d'),'set':function(_0x5085b9){if(!_0x5085b9)this['setDataValue'](_0x4f5b('0x2e'),null);this[_0x4f5b('0x1d')](_0x4f5b('0x2f'),_0x5085b9);}},'vidaooEscalation':{'type':Sequelize[_0x4f5b('0x8')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x4f5b('0x2')]},'vidaooTopic':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x4f5b('0x30')},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return _0x4f5b('0x31');}},'vidaooMetadata':{'type':Sequelize[_0x4f5b('0x15')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x4f5b('0x8')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x4f5b('0x15')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 688b2d0..578ff99 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 _0xe562=['agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','notify','files','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','server','offline-chat','basename','openNewInteraction','transaction','MailAccount','MailServerOut','Smtp','forwardOfflineAddress','service','host','port','secure','authentication','auth','pass','SendMail','sendMail','email','MailAccountId','originalname','mimetype','subjectOffline','toPairsIn','Chat','NotifyMailAccount','notifyMail','attachments','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','Contact','Owner','fullname','Tags','tag','Command','getSnippet','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','timezone','No\x20timezone','inspect','Interval','Intervals','custom','License','increment','some','server/files/chat/iframe.ejs','remote','x-real-ip','connection','remoteAddress','virtual','replace','alignment','labelText','textColor','color_button','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','stack','finally','getApplications','chatProactiveAction','addProactiveActions','getProactiveActions','ChatProactiveAction','getFields','false','offlineForm','onlineForm','items','fromKey','ChatOfflineMessage','Attachment','addAgents','emit','removeAgents','isArray','userChatWebsite:remove','getAgents','bluebird','util','path','fs-extra','lodash','querystring','../../components/parsers/qs','../../config/logger','../../mysqldb','redis','defaults','socket.io-emitter','./chatWebsite.socket','register','jayson/promise','client','http','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','status','end','json','undefined','limit','count','set','Content-Range','update','destroy','get','ChatWebsites','UserProfileResource','sendStatus','send','index','Pause','map','ChatWebsite','rawAttributes','fieldName','type','key','name','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','offset','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','mandatoryDispositionPause','keys','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','params','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','order','removeDispositions','CannedAnswer','getAnswers','removeAnswers','ids','addLogo','sitepic','file','filename','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','join','server/files/images/logos/default_logo.svg','getLicense','isNil','existsSync','root','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','systemAvatar','headers','getResult','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','from','CmList','List','Contacts','DESC','ChatApplication','account','applications','Applications','list','priority','ListId','contact','cf-connecting-ip','x-forwarded-for','first','firstName','lastName','x-real-port','browser','version','unknown','format','device','vendor','stringify','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','messageId','created','autoclose','push','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','User','unshift'];(function(_0x2080a3,_0x48acfa){var _0x8d7d17=function(_0x2dbc06){while(--_0x2dbc06){_0x2080a3['push'](_0x2080a3['shift']());}};_0x8d7d17(++_0x48acfa);}(_0xe562,0x72));var _0x2e56=function(_0xdb4b33,_0xfd8bf4){_0xdb4b33=_0xdb4b33-0x0;var _0x56518e=_0xe562[_0xdb4b33];return _0x56518e;};'use strict';var BPromise=require(_0x2e56('0x0'));var Mustache=require('mustache');var util=require(_0x2e56('0x1'));var path=require(_0x2e56('0x2'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2e56('0x3'));var _=require(_0x2e56('0x4'));var querystring=require(_0x2e56('0x5'));var Redis=require('ioredis');var qs=require(_0x2e56('0x6'));var logger=require(_0x2e56('0x7'))('api');var config=require('../../config/environment');var db=require(_0x2e56('0x8'))['db'];config[_0x2e56('0x9')]=_[_0x2e56('0xa')](config[_0x2e56('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x2e56('0xb'))(new Redis(config['redis']));require(_0x2e56('0xc'))[_0x2e56('0xd')](socket);var jayson=require(_0x2e56('0xe'));var client=jayson[_0x2e56('0xf')][_0x2e56('0x10')]({'port':0x232c});var client9002=jayson[_0x2e56('0xf')][_0x2e56('0x10')]({'port':0x232a});var client9003=jayson[_0x2e56('0xf')][_0x2e56('0x10')]({'port':0x232b});var client9001=jayson[_0x2e56('0xf')]['http']({'port':0x2329});function respondWithRpcPromise(_0x37555b,_0x318699,_0x1c15c0,_0x8b2ea7){return new BPromise(function(_0x37cf69,_0x4d235b){var _0x45815d=_0x8b2ea7||client;return _0x45815d[_0x2e56('0x11')](_0x37555b,_0x1c15c0)[_0x2e56('0x12')](function(_0x2737ba){logger[_0x2e56('0x13')](_0x2e56('0x14'),_0x318699,_0x2e56('0x15'));logger[_0x2e56('0x16')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x318699,'request\x20sent',JSON['stringify'](_0x2737ba));if(_0x2737ba[_0x2e56('0x17')]){if(_0x2737ba[_0x2e56('0x17')][_0x2e56('0x18')]===0x1f4){logger[_0x2e56('0x17')]('ChatWebsite,\x20%s,\x20%s',_0x318699,_0x2737ba[_0x2e56('0x17')][_0x2e56('0x19')]);return _0x4d235b(_0x2737ba[_0x2e56('0x17')]['message']);}logger[_0x2e56('0x17')](_0x2e56('0x14'),_0x318699,_0x2737ba[_0x2e56('0x17')][_0x2e56('0x19')]);return _0x37cf69(_0x2737ba[_0x2e56('0x17')][_0x2e56('0x19')]);}else{logger[_0x2e56('0x13')](_0x2e56('0x14'),_0x318699,_0x2e56('0x15'));_0x37cf69(_0x2737ba[_0x2e56('0x1a')][_0x2e56('0x19')]);}})[_0x2e56('0x1b')](function(_0x40c060){logger[_0x2e56('0x17')](_0x2e56('0x14'),_0x318699,_0x40c060);_0x4d235b(_0x40c060);});});}function respondWithStatusCode(_0x36e37a,_0x25d94c){_0x25d94c=_0x25d94c||0xcc;return function(_0xdb20e0){if(_0xdb20e0){return _0x36e37a['sendStatus'](_0x25d94c);}return _0x36e37a[_0x2e56('0x1c')](_0x25d94c)[_0x2e56('0x1d')]();};}function respondWithResult(_0x36ec2c,_0x259505){_0x259505=_0x259505||0xc8;return function(_0x3d5722){if(_0x3d5722){return _0x36ec2c[_0x2e56('0x1c')](_0x259505)[_0x2e56('0x1e')](_0x3d5722);}};}function respondWithFilteredResult(_0x7ef8c1,_0x49a0c7){return function(_0x2c187f){if(_0x2c187f){var _0x164905=typeof _0x49a0c7['offset']===_0x2e56('0x1f')&&typeof _0x49a0c7[_0x2e56('0x20')]===_0x2e56('0x1f');var _0xcf1e29=_0x2c187f['count'];var _0x2bedcc=_0x164905?0x0:_0x49a0c7['offset'];var _0x3fda5a=_0x164905?_0x2c187f[_0x2e56('0x21')]:_0x49a0c7['offset']+_0x49a0c7[_0x2e56('0x20')];var _0x11e52d;if(_0x3fda5a>=_0xcf1e29){_0x3fda5a=_0xcf1e29;_0x11e52d=0xc8;}else{_0x11e52d=0xce;}_0x7ef8c1[_0x2e56('0x1c')](_0x11e52d);return _0x7ef8c1[_0x2e56('0x22')](_0x2e56('0x23'),_0x2bedcc+'-'+_0x3fda5a+'/'+_0xcf1e29)[_0x2e56('0x1e')](_0x2c187f);}return null;};}function saveUpdates(_0x164cf3){return function(_0x2c3ee8){if(_0x2c3ee8){return _0x2c3ee8[_0x2e56('0x24')](_0x164cf3)[_0x2e56('0x12')](function(_0x34e8dc){return _0x34e8dc;});}return null;};}function removeEntity(_0x6a891a){return function(_0x206e2e){if(_0x206e2e){return _0x206e2e[_0x2e56('0x25')]()[_0x2e56('0x12')](function(){var _0x5cdd4e=_0x206e2e[_0x2e56('0x26')]({'plain':!![]});var _0x1e1320=_0x2e56('0x27');return db[_0x2e56('0x28')][_0x2e56('0x25')]({'where':{'type':_0x1e1320,'resourceId':_0x5cdd4e['id']}})[_0x2e56('0x12')](function(){return _0x206e2e;});})[_0x2e56('0x12')](function(){_0x6a891a['status'](0xcc)[_0x2e56('0x1d')]();});}};}function handleEntityNotFound(_0x31561c){return function(_0x5922bf){if(!_0x5922bf){_0x31561c[_0x2e56('0x29')](0x194);}return _0x5922bf;};}function handleError(_0x1ab1fa,_0x38c78e){_0x38c78e=_0x38c78e||0x1f4;return function(_0x2cbd35){logger['error'](_0x2cbd35['stack']);if(_0x2cbd35['name']){delete _0x2cbd35['name'];}_0x1ab1fa[_0x2e56('0x1c')](_0x38c78e)[_0x2e56('0x2a')](_0x2cbd35);};}exports[_0x2e56('0x2b')]=function(_0x2c8663,_0x3e9e40){var _0x268383={'include':[{'model':db[_0x2e56('0x2c')],'as':'mandatoryDispositionPause'}]},_0x459969={},_0x1b9bbb={'count':0x0,'rows':[]};var _0x4c74af=_[_0x2e56('0x2d')](db[_0x2e56('0x2e')][_0x2e56('0x2f')],function(_0x32144a){return{'name':_0x32144a[_0x2e56('0x30')],'type':_0x32144a[_0x2e56('0x31')][_0x2e56('0x32')]};});_0x459969['model']=_[_0x2e56('0x2d')](_0x4c74af,_0x2e56('0x33'));_0x459969[_0x2e56('0x34')]=_['keys'](_0x2c8663[_0x2e56('0x34')]);_0x459969[_0x2e56('0x35')]=_[_0x2e56('0x36')](_0x459969[_0x2e56('0x37')],_0x459969[_0x2e56('0x34')]);_0x268383[_0x2e56('0x38')]=_[_0x2e56('0x36')](_0x459969[_0x2e56('0x37')],qs[_0x2e56('0x39')](_0x2c8663[_0x2e56('0x34')]['fields']));_0x268383[_0x2e56('0x38')]=_0x268383[_0x2e56('0x38')][_0x2e56('0x3a')]?_0x268383[_0x2e56('0x38')]:_0x459969[_0x2e56('0x37')];if(!_0x2c8663['query'][_0x2e56('0x3b')](_0x2e56('0x3c'))){_0x268383[_0x2e56('0x20')]=qs[_0x2e56('0x20')](_0x2c8663['query'][_0x2e56('0x20')]);_0x268383[_0x2e56('0x3d')]=qs[_0x2e56('0x3d')](_0x2c8663['query']['offset']);}_0x268383['order']=qs[_0x2e56('0x3e')](_0x2c8663[_0x2e56('0x34')][_0x2e56('0x3e')]);_0x268383[_0x2e56('0x3f')]=qs[_0x2e56('0x35')](_[_0x2e56('0x40')](_0x2c8663['query'],_0x459969[_0x2e56('0x35')]),_0x4c74af);if(_0x2c8663[_0x2e56('0x34')][_0x2e56('0x41')]){_0x268383[_0x2e56('0x3f')]=_[_0x2e56('0x42')](_0x268383[_0x2e56('0x3f')],{'$or':_['map'](_0x4c74af,function(_0xef1973){if(_0xef1973[_0x2e56('0x31')]!==_0x2e56('0x43')){var _0x294eae={};_0x294eae[_0xef1973['name']]={'$like':'%'+_0x2c8663[_0x2e56('0x34')][_0x2e56('0x41')]+'%'};return _0x294eae;}})});}_0x268383=_['merge']({},_0x268383,_0x2c8663[_0x2e56('0x44')]);var _0x2ae383={'where':_0x268383[_0x2e56('0x3f')]};return db[_0x2e56('0x2e')][_0x2e56('0x21')](_0x2ae383)['then'](function(_0x74c009){_0x1b9bbb[_0x2e56('0x21')]=_0x74c009;if(_0x2c8663[_0x2e56('0x34')][_0x2e56('0x45')]){_0x268383['include']=[{'all':!![]}];}return db[_0x2e56('0x2e')][_0x2e56('0x46')](_0x268383);})[_0x2e56('0x12')](function(_0x4d0254){_0x1b9bbb[_0x2e56('0x47')]=_0x4d0254;return _0x1b9bbb;})[_0x2e56('0x12')](respondWithFilteredResult(_0x3e9e40,_0x268383))[_0x2e56('0x1b')](handleError(_0x3e9e40,null));};exports[_0x2e56('0x48')]=function(_0x1e0405,_0x54d448){var _0x25f9ca={'raw':![],'where':{'id':_0x1e0405['params']['id']},'include':[{'model':db[_0x2e56('0x2c')],'as':_0x2e56('0x49')}]},_0x349515={};_0x349515['model']=_[_0x2e56('0x4a')](db[_0x2e56('0x2e')][_0x2e56('0x2f')]);_0x349515[_0x2e56('0x34')]=_[_0x2e56('0x4a')](_0x1e0405['query']);_0x349515[_0x2e56('0x35')]=_['intersection'](_0x349515[_0x2e56('0x37')],_0x349515['query']);_0x25f9ca[_0x2e56('0x38')]=_['intersection'](_0x349515[_0x2e56('0x37')],qs[_0x2e56('0x39')](_0x1e0405['query']['fields']));_0x25f9ca[_0x2e56('0x38')]=_0x25f9ca['attributes'][_0x2e56('0x3a')]?_0x25f9ca[_0x2e56('0x38')]:_0x349515['model'];if(_0x1e0405[_0x2e56('0x34')][_0x2e56('0x45')]){_0x25f9ca[_0x2e56('0x4b')]=[{'all':!![]}];}_0x25f9ca=_[_0x2e56('0x42')]({},_0x25f9ca,_0x1e0405['options']);return db[_0x2e56('0x2e')][_0x2e56('0x4c')](_0x25f9ca)[_0x2e56('0x12')](handleEntityNotFound(_0x54d448,null))[_0x2e56('0x12')](respondWithResult(_0x54d448,null))[_0x2e56('0x1b')](handleError(_0x54d448,null));};exports[_0x2e56('0x4d')]=function(_0x39f1b6,_0x55a628){return db[_0x2e56('0x2e')][_0x2e56('0x4d')](_0x39f1b6[_0x2e56('0x4e')],{})[_0x2e56('0x12')](function(_0x21c767){var _0xa6257c=_0x39f1b6[_0x2e56('0x4f')]['get']({'plain':!![]});if(!_0xa6257c)throw new Error(_0x2e56('0x50'));if(_0xa6257c[_0x2e56('0x51')]===_0x2e56('0x4f')){var _0x405007=_0x21c767[_0x2e56('0x26')]({'plain':!![]});var _0x27ed07=_0x2e56('0x27');return db[_0x2e56('0x52')][_0x2e56('0x4c')]({'where':{'name':_0x27ed07,'userProfileId':_0xa6257c[_0x2e56('0x53')]},'raw':!![]})[_0x2e56('0x12')](function(_0x492331){if(_0x492331&&_0x492331['autoAssociation']===0x0){return db[_0x2e56('0x28')]['create']({'name':_0x405007[_0x2e56('0x33')],'resourceId':_0x405007['id'],'type':_0x492331[_0x2e56('0x33')],'sectionId':_0x492331['id']},{})['then'](function(){return _0x21c767;});}else{return _0x21c767;}})[_0x2e56('0x1b')](function(_0x482116){logger[_0x2e56('0x17')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x482116);throw _0x482116;});}return _0x21c767;})[_0x2e56('0x12')](respondWithResult(_0x55a628,0xc9))[_0x2e56('0x1b')](handleError(_0x55a628,null));};exports[_0x2e56('0x24')]=function(_0x36e896,_0x15d2ce){if(_0x36e896['body']['id']){delete _0x36e896[_0x2e56('0x4e')]['id'];}return db['ChatWebsite'][_0x2e56('0x4c')]({'where':{'id':_0x36e896['params']['id']},'include':[{'model':db['Pause'],'as':_0x2e56('0x49')}]})[_0x2e56('0x12')](handleEntityNotFound(_0x15d2ce,null))[_0x2e56('0x12')](saveUpdates(_0x36e896[_0x2e56('0x4e')],null))[_0x2e56('0x12')](respondWithResult(_0x15d2ce,null))[_0x2e56('0x1b')](handleError(_0x15d2ce,null));};exports[_0x2e56('0x25')]=function(_0x249f89,_0x3fbe6e){return db['ChatWebsite'][_0x2e56('0x4c')]({'where':{'id':_0x249f89[_0x2e56('0x54')]['id']}})['then'](handleEntityNotFound(_0x3fbe6e,null))[_0x2e56('0x12')](removeEntity(_0x3fbe6e,null))[_0x2e56('0x1b')](handleError(_0x3fbe6e,null));};exports['describe']=function(_0x407811,_0x52e3be){return db['ChatWebsite'][_0x2e56('0x55')]()[_0x2e56('0x12')](respondWithResult(_0x52e3be,null))[_0x2e56('0x1b')](handleError(_0x52e3be,null));};exports[_0x2e56('0x56')]=function(_0x3f558f,_0xdd84c3){if(_0x3f558f['body']['id']){delete _0x3f558f[_0x2e56('0x4e')]['id'];}return db[_0x2e56('0x2e')][_0x2e56('0x4c')]({'where':{'id':_0x3f558f[_0x2e56('0x54')]['id']}})['then'](handleEntityNotFound(_0xdd84c3,null))['then'](function(_0x42cec0){if(_0x42cec0){_0x3f558f[_0x2e56('0x4e')][_0x2e56('0x57')]=_0x42cec0['id'];return db[_0x2e56('0x58')][_0x2e56('0x4d')](_0x3f558f['body']);}})[_0x2e56('0x12')](respondWithResult(_0xdd84c3,null))['catch'](handleError(_0xdd84c3,null));};exports[_0x2e56('0x59')]=function(_0x293bc1,_0x292bc6){var _0x92c904={'raw':![],'where':{}};var _0x5f3293={};var _0x4fc17f={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x2e56('0x5a')]({'where':{'id':_0x293bc1['params']['id']}})[_0x2e56('0x12')](handleEntityNotFound(_0x292bc6,null))[_0x2e56('0x12')](function(_0x1b7f37){if(_0x1b7f37){_0x5f3293[_0x2e56('0x37')]=_[_0x2e56('0x4a')](db[_0x2e56('0x58')][_0x2e56('0x2f')]);_0x5f3293[_0x2e56('0x34')]=_[_0x2e56('0x4a')](_0x293bc1[_0x2e56('0x34')]);_0x5f3293[_0x2e56('0x35')]=_[_0x2e56('0x36')](_0x5f3293[_0x2e56('0x37')],_0x5f3293[_0x2e56('0x34')]);_0x92c904[_0x2e56('0x38')]=_[_0x2e56('0x36')](_0x5f3293[_0x2e56('0x37')],qs['fields'](_0x293bc1[_0x2e56('0x34')][_0x2e56('0x39')]));_0x92c904[_0x2e56('0x38')]=_0x92c904[_0x2e56('0x38')][_0x2e56('0x3a')]?_0x92c904[_0x2e56('0x38')]:_0x5f3293[_0x2e56('0x37')];if(!_0x293bc1['query']['hasOwnProperty'](_0x2e56('0x3c'))){_0x92c904[_0x2e56('0x20')]=qs['limit'](_0x293bc1[_0x2e56('0x34')][_0x2e56('0x20')]);_0x92c904[_0x2e56('0x3d')]=qs[_0x2e56('0x3d')](_0x293bc1['query']['offset']);}_0x92c904[_0x2e56('0x5b')]=qs[_0x2e56('0x3e')](_0x293bc1[_0x2e56('0x34')][_0x2e56('0x3e')]);_0x92c904[_0x2e56('0x3f')]=qs[_0x2e56('0x35')](_[_0x2e56('0x40')](_0x293bc1[_0x2e56('0x34')],_0x5f3293['filters']));_0x92c904[_0x2e56('0x3f')][_0x2e56('0x57')]=_0x1b7f37['id'];if(_0x293bc1['query'][_0x2e56('0x41')]){_0x92c904['where']=_[_0x2e56('0x42')](_0x92c904[_0x2e56('0x3f')],{'$or':_['map'](_0x92c904[_0x2e56('0x38')],function(_0x3468ae){var _0x5d938a={};_0x5d938a[_0x3468ae]={'$like':'%'+_0x293bc1['query']['filter']+'%'};return _0x5d938a;})});}_0x92c904=_[_0x2e56('0x42')]({},_0x92c904,_0x293bc1[_0x2e56('0x44')]);return db['Disposition'][_0x2e56('0x21')]({'where':_0x92c904['where']})[_0x2e56('0x12')](function(_0x1cbd4d){_0x4fc17f[_0x2e56('0x21')]=_0x1cbd4d;if(_0x293bc1['query'][_0x2e56('0x45')]){_0x92c904[_0x2e56('0x4b')]=[{'all':!![]}];}return db['Disposition'][_0x2e56('0x46')](_0x92c904);})['then'](function(_0x40580a){_0x4fc17f[_0x2e56('0x47')]=_0x40580a;return _0x4fc17f;});}})[_0x2e56('0x12')](respondWithFilteredResult(_0x292bc6,_0x92c904))[_0x2e56('0x1b')](handleError(_0x292bc6,null));};exports[_0x2e56('0x5c')]=function(_0xdc1948,_0x4de067){return db['ChatWebsite']['find']({'where':{'id':_0xdc1948[_0x2e56('0x54')]['id']}})[_0x2e56('0x12')](handleEntityNotFound(_0x4de067,null))[_0x2e56('0x12')](function(_0x321ecd){if(_0x321ecd){return _0x321ecd[_0x2e56('0x5c')](_0xdc1948['query']['ids']);}})[_0x2e56('0x12')](respondWithStatusCode(_0x4de067,null))[_0x2e56('0x1b')](handleError(_0x4de067,null));};exports['addAnswer']=function(_0x3ea30e,_0x38656a){if(_0x3ea30e[_0x2e56('0x4e')]['id']){delete _0x3ea30e[_0x2e56('0x4e')]['id'];}return db[_0x2e56('0x2e')][_0x2e56('0x4c')]({'where':{'id':_0x3ea30e[_0x2e56('0x54')]['id']}})[_0x2e56('0x12')](handleEntityNotFound(_0x38656a,null))[_0x2e56('0x12')](function(_0x503c50){if(_0x503c50){_0x3ea30e[_0x2e56('0x4e')][_0x2e56('0x57')]=_0x503c50['id'];return db[_0x2e56('0x5d')][_0x2e56('0x4d')](_0x3ea30e[_0x2e56('0x4e')]);}})[_0x2e56('0x12')](respondWithResult(_0x38656a,null))['catch'](handleError(_0x38656a,null));};exports[_0x2e56('0x5e')]=function(_0x3201dc,_0x4a5893){var _0x190984={'raw':![],'where':{}};var _0xd9d3e={};var _0x141ab4={'count':0x0,'rows':[]};return db[_0x2e56('0x2e')][_0x2e56('0x5a')]({'where':{'id':_0x3201dc[_0x2e56('0x54')]['id']}})[_0x2e56('0x12')](handleEntityNotFound(_0x4a5893,null))[_0x2e56('0x12')](function(_0x236638){if(_0x236638){_0xd9d3e[_0x2e56('0x37')]=_[_0x2e56('0x4a')](db[_0x2e56('0x5d')]['rawAttributes']);_0xd9d3e[_0x2e56('0x34')]=_['keys'](_0x3201dc[_0x2e56('0x34')]);_0xd9d3e[_0x2e56('0x35')]=_['intersection'](_0xd9d3e['model'],_0xd9d3e['query']);_0x190984[_0x2e56('0x38')]=_[_0x2e56('0x36')](_0xd9d3e[_0x2e56('0x37')],qs['fields'](_0x3201dc['query'][_0x2e56('0x39')]));_0x190984[_0x2e56('0x38')]=_0x190984[_0x2e56('0x38')][_0x2e56('0x3a')]?_0x190984[_0x2e56('0x38')]:_0xd9d3e[_0x2e56('0x37')];if(!_0x3201dc[_0x2e56('0x34')][_0x2e56('0x3b')](_0x2e56('0x3c'))){_0x190984[_0x2e56('0x20')]=qs[_0x2e56('0x20')](_0x3201dc[_0x2e56('0x34')][_0x2e56('0x20')]);_0x190984[_0x2e56('0x3d')]=qs['offset'](_0x3201dc[_0x2e56('0x34')]['offset']);}_0x190984[_0x2e56('0x5b')]=qs[_0x2e56('0x3e')](_0x3201dc[_0x2e56('0x34')]['sort']);_0x190984['where']=qs[_0x2e56('0x35')](_[_0x2e56('0x40')](_0x3201dc[_0x2e56('0x34')],_0xd9d3e[_0x2e56('0x35')]));_0x190984[_0x2e56('0x3f')][_0x2e56('0x57')]=_0x236638['id'];if(_0x3201dc['query']['filter']){_0x190984['where']=_[_0x2e56('0x42')](_0x190984[_0x2e56('0x3f')],{'$or':_[_0x2e56('0x2d')](_0x190984[_0x2e56('0x38')],function(_0x4daeb1){var _0x577283={};_0x577283[_0x4daeb1]={'$like':'%'+_0x3201dc[_0x2e56('0x34')][_0x2e56('0x41')]+'%'};return _0x577283;})});}_0x190984=_['merge']({},_0x190984,_0x3201dc[_0x2e56('0x44')]);return db[_0x2e56('0x5d')]['count']({'where':_0x190984['where']})[_0x2e56('0x12')](function(_0x43f404){_0x141ab4[_0x2e56('0x21')]=_0x43f404;if(_0x3201dc['query'][_0x2e56('0x45')]){_0x190984[_0x2e56('0x4b')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x190984);})[_0x2e56('0x12')](function(_0x275da2){_0x141ab4[_0x2e56('0x47')]=_0x275da2;return _0x141ab4;});}})[_0x2e56('0x12')](respondWithFilteredResult(_0x4a5893,_0x190984))['catch'](handleError(_0x4a5893,null));};exports[_0x2e56('0x5f')]=function(_0x5a5095,_0xde5e90){return db['ChatWebsite']['find']({'where':{'id':_0x5a5095[_0x2e56('0x54')]['id']}})[_0x2e56('0x12')](handleEntityNotFound(_0xde5e90,null))[_0x2e56('0x12')](function(_0x2aedc2){if(_0x2aedc2){return _0x2aedc2[_0x2e56('0x5f')](_0x5a5095['query'][_0x2e56('0x60')]);}})['then'](respondWithStatusCode(_0xde5e90,null))[_0x2e56('0x1b')](handleError(_0xde5e90,null));};exports[_0x2e56('0x61')]=function(_0x1f2c8a,_0x35c162){_0x1f2c8a[_0x2e56('0x4e')][_0x2e56('0x62')]=_0x1f2c8a[_0x2e56('0x63')][_0x2e56('0x64')];return db[_0x2e56('0x2e')]['find']({'where':{'id':_0x1f2c8a[_0x2e56('0x54')]['id']}})['then'](handleEntityNotFound(_0x35c162,null))[_0x2e56('0x12')](saveUpdates(_0x1f2c8a[_0x2e56('0x4e')],null))['then'](respondWithResult(_0x35c162,null))[_0x2e56('0x1b')](handleError(_0x35c162,null));};exports['addAvatar']=function(_0x255189,_0x52f25){_0x255189['body'][_0x2e56('0x65')]=_0x255189[_0x2e56('0x63')][_0x2e56('0x64')];return db[_0x2e56('0x2e')][_0x2e56('0x4c')]({'where':{'id':_0x255189[_0x2e56('0x54')]['id']}})[_0x2e56('0x12')](handleEntityNotFound(_0x52f25,null))['then'](saveUpdates(_0x255189['body'],null))[_0x2e56('0x12')](respondWithResult(_0x52f25,null))[_0x2e56('0x1b')](handleError(_0x52f25,null));};exports[_0x2e56('0x66')]=function(_0x37db9b,_0x56b2ff){_0x37db9b[_0x2e56('0x4e')][_0x2e56('0x67')]=_0x37db9b[_0x2e56('0x63')][_0x2e56('0x64')];return db[_0x2e56('0x2e')][_0x2e56('0x4c')]({'where':{'id':_0x37db9b[_0x2e56('0x54')]['id']}})[_0x2e56('0x12')](handleEntityNotFound(_0x56b2ff,null))[_0x2e56('0x12')](saveUpdates(_0x37db9b[_0x2e56('0x4e')],null))[_0x2e56('0x12')](respondWithResult(_0x56b2ff,null))[_0x2e56('0x1b')](handleError(_0x56b2ff,null));};exports[_0x2e56('0x68')]=function(_0x204d51,_0x401e09){_0x204d51[_0x2e56('0x4e')]['systemAvatar']=_0x204d51[_0x2e56('0x63')]['filename'];return db['ChatWebsite'][_0x2e56('0x4c')]({'where':{'id':_0x204d51[_0x2e56('0x54')]['id']}})[_0x2e56('0x12')](handleEntityNotFound(_0x401e09,null))['then'](saveUpdates(_0x204d51[_0x2e56('0x4e')],null))[_0x2e56('0x12')](respondWithResult(_0x401e09,null))[_0x2e56('0x1b')](handleError(_0x401e09,null));};exports['getLogo']=function(_0x4c0c27,_0xa7955a){var _0x4144ce=path[_0x2e56('0x69')](config['root'],_0x2e56('0x6a'));var _0x2d5047={'where':{'id':_0x4c0c27[_0x2e56('0x54')]['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x391d6a=![];return require('../../config/license/util')[_0x2e56('0x6b')]()[_0x2e56('0x12')](function(_0x154265){if(_0x154265){_0x391d6a=_0x154265['custom'];}})['then'](function(){return db[_0x2e56('0x2e')]['find'](_0x2d5047);})[_0x2e56('0x12')](handleEntityNotFound(_0xa7955a,null))[_0x2e56('0x12')](function(_0x55b5e6){if(_0x55b5e6){if(!_[_0x2e56('0x6c')](_0x55b5e6[_0x2e56('0x62')])){if(fs[_0x2e56('0x6d')](path[_0x2e56('0x69')](config[_0x2e56('0x6e')],_0x2e56('0x6f'),_0x55b5e6[_0x2e56('0x62')]))&&_0x391d6a){_0x4144ce=path['join'](config[_0x2e56('0x6e')],_0x2e56('0x6f'),_0x55b5e6['sitepic']);}}return _0xa7955a[_0x2e56('0x70')](_0x4144ce);}})[_0x2e56('0x1b')](handleError(_0xa7955a,null));};exports[_0x2e56('0x71')]=function(_0x3a96bc,_0x2cd3ad){var _0x2f3d2e=path[_0x2e56('0x69')](config['root'],_0x2e56('0x72'));var _0xd38f44={'where':{'id':_0x3a96bc[_0x2e56('0x54')]['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db[_0x2e56('0x2e')]['find'](_0xd38f44)[_0x2e56('0x12')](handleEntityNotFound(_0x2cd3ad,null))[_0x2e56('0x12')](function(_0x2ad4d7){if(_0x2ad4d7){if(!_['isNil'](_0x2ad4d7[_0x2e56('0x65')])){if(fs[_0x2e56('0x6d')](path[_0x2e56('0x69')](config['root'],'server/files/images/avatars/',_0x2ad4d7[_0x2e56('0x65')]))){_0x2f3d2e=path[_0x2e56('0x69')](config[_0x2e56('0x6e')],_0x2e56('0x73'),_0x2ad4d7['agentAvatar']);}}return _0x2cd3ad['download'](_0x2f3d2e);}})[_0x2e56('0x1b')](handleError(_0x2cd3ad,null));};exports[_0x2e56('0x74')]=function(_0x5c6f3e,_0x539958){var _0x39ed2f=path[_0x2e56('0x69')](config[_0x2e56('0x6e')],_0x2e56('0x75'));var _0x57c80d={'where':{'id':_0x5c6f3e[_0x2e56('0x54')]['id']},'attributes':['id',_0x2e56('0x67'),'showCustomerAvatar'],'raw':!![]};return db[_0x2e56('0x2e')]['find'](_0x57c80d)[_0x2e56('0x12')](handleEntityNotFound(_0x539958,null))['then'](function(_0x13bdd9){if(_0x13bdd9){if(!_[_0x2e56('0x6c')](_0x13bdd9['customerAvatar'])){if(fs[_0x2e56('0x6d')](path['join'](config[_0x2e56('0x6e')],'server/files/images/avatars/',_0x13bdd9[_0x2e56('0x67')]))&&_0x13bdd9[_0x2e56('0x76')]){_0x39ed2f=path[_0x2e56('0x69')](config[_0x2e56('0x6e')],_0x2e56('0x73'),_0x13bdd9[_0x2e56('0x67')]);}}return _0x539958[_0x2e56('0x70')](_0x39ed2f);}})[_0x2e56('0x1b')](handleError(_0x539958,null));};exports[_0x2e56('0x77')]=function(_0x23d7f8,_0x37f303){var _0x3fe8c1=path['join'](config[_0x2e56('0x6e')],_0x2e56('0x78'));var _0x29afb2={'where':{'id':_0x23d7f8['params']['id']},'attributes':['id',_0x2e56('0x79')],'raw':!![]};return db[_0x2e56('0x2e')][_0x2e56('0x4c')](_0x29afb2)[_0x2e56('0x12')](handleEntityNotFound(_0x37f303,null))[_0x2e56('0x12')](function(_0x14e748){if(_0x14e748){if(!_[_0x2e56('0x6c')](_0x14e748[_0x2e56('0x79')])){if(fs[_0x2e56('0x6d')](path[_0x2e56('0x69')](config[_0x2e56('0x6e')],_0x2e56('0x73'),_0x14e748[_0x2e56('0x79')]))){_0x3fe8c1=path[_0x2e56('0x69')](config[_0x2e56('0x6e')],'server/files/images/avatars/',_0x14e748[_0x2e56('0x79')]);}}return _0x37f303[_0x2e56('0x70')](_0x3fe8c1);}})['catch'](handleError(_0x37f303,null));};exports['notify']=function(_0x340692,_0x1b819f){var _0x5c3b18=require('user-agent-parser');var _0x4a23e3=new _0x5c3b18();var _0x5741cd=_0x4a23e3['setUA'](_0x340692[_0x2e56('0x7a')]['user-agent'])[_0x2e56('0x7b')]();var _0x1dacf7={'body':_0x340692['body'],'channel':'chat'};var _0x41a032=[];var _0x274414=[];var _0x2f56e6={};var _0x55db0d=![];return db[_0x2e56('0x7c')][_0x2e56('0x55')]()[_0x2e56('0x12')](function(_0xa72cb){if(!_0xa72cb){throw new db[(_0x2e56('0x7d'))][(_0x2e56('0x7e'))](_0x2e56('0x7f'));}_0x41a032=_[_0x2e56('0x80')](_['keys'](_0xa72cb),[_0x2e56('0x81'),_0x2e56('0x82')]);_0x274414=_[_0x2e56('0x80')](_[_0x2e56('0x4a')](_0xa72cb),[_0x2e56('0x81'),_0x2e56('0x82'),_0x2e56('0x83'),'ListId']);if(_0x340692[_0x2e56('0x4e')]['id']){delete _0x340692['body']['id'];}if(_[_0x2e56('0x6c')](_0x340692[_0x2e56('0x4e')]['from'])){throw new db[(_0x2e56('0x7d'))][(_0x2e56('0x7e'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x340692['body'][_0x2e56('0x4e')])||_0x340692['body'][_0x2e56('0x4e')]===''){throw new db[(_0x2e56('0x7d'))][(_0x2e56('0x7e'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x2e56('0x6c')](_0x340692[_0x2e56('0x4e')]['mapKey'])){throw new db['Sequelize'][(_0x2e56('0x7e'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x274414);}if(!_[_0x2e56('0x84')](_0x274414,_0x340692['body']['mapKey'])){throw new db['Sequelize'][(_0x2e56('0x7e'))](_0x2e56('0x85')+_0x274414);}_0x2f56e6[_0x340692['body'][_0x2e56('0x86')]]=_0x340692['body'][_0x2e56('0x87')];})[_0x2e56('0x12')](function(){return db[_0x2e56('0x2e')][_0x2e56('0x4c')]({'where':{'id':_0x340692[_0x2e56('0x54')]['id']},'include':[{'model':db[_0x2e56('0x88')],'as':_0x2e56('0x89'),'include':[{'model':db['CmContact'],'as':_0x2e56('0x8a'),'where':_0x2f56e6,'limit':0x1,'order':[[_0x2e56('0x82'),_0x2e56('0x8b')]]}]},{'model':db[_0x2e56('0x8c')],'as':'Applications'}]});})['then'](handleEntityNotFound(_0x1b819f,null))[_0x2e56('0x12')](function(_0xbad4cd){if(_0xbad4cd&&_0xbad4cd[_0x2e56('0x89')]){_0x1dacf7[_0x2e56('0x8d')]=_0xbad4cd;_0x1dacf7[_0x2e56('0x8e')]=_0xbad4cd[_0x2e56('0x8f')];_0x1dacf7[_0x2e56('0x90')]=_0xbad4cd[_0x2e56('0x89')];_0x1dacf7[_0x2e56('0x8e')]=_['orderBy'](_0x1dacf7[_0x2e56('0x8e')],[_0x2e56('0x91')],['asc']);if(_0x1dacf7[_0x2e56('0x8d')][_0x2e56('0x8f')]){delete _0x1dacf7[_0x2e56('0x8d')]['Applications'];}if(_0x1dacf7['account'][_0x2e56('0x89')]&&_0x1dacf7['account'][_0x2e56('0x89')]['Contacts']['length']){return _0x1dacf7[_0x2e56('0x8d')][_0x2e56('0x89')][_0x2e56('0x8a')][0x0];}var _0x4e9cfc=_[_0x2e56('0xa')](_0x340692[_0x2e56('0x4e')],{'firstName':_0x340692['body']['from'],'ListId':_0xbad4cd[_0x2e56('0x92')]});_0x4e9cfc[_0x340692[_0x2e56('0x4e')][_0x2e56('0x86')]]=_0x340692['body'][_0x2e56('0x87')];return db[_0x2e56('0x7c')][_0x2e56('0x4d')](_0x4e9cfc,{'fields':_0x41a032,'raw':!![]});}})[_0x2e56('0x12')](handleEntityNotFound(_0x1b819f,null))[_0x2e56('0x12')](function(_0xe439c0){_0x1dacf7[_0x2e56('0x93')]=_0xe439c0;var _0x3378ad=_0x340692[_0x2e56('0x4e')]['customerIp'];if(_0x340692[_0x2e56('0x7a')][_0x2e56('0x94')]){_0x3378ad=_0x340692[_0x2e56('0x7a')]['cf-connecting-ip'];}else if(_0x340692[_0x2e56('0x7a')][_0x2e56('0x95')]){_0x3378ad=_[_0x2e56('0x96')](_0x340692[_0x2e56('0x7a')][_0x2e56('0x95')]['split'](','));}if(_0xe439c0){var _0x1bff39={'ContactId':_0xe439c0['id'],'ChatWebsiteId':_0x340692[_0x2e56('0x54')]['id'],'from':(_0xe439c0[_0x2e56('0x97')]||'')+'\x20'+(_0xe439c0[_0x2e56('0x98')]||''),'customerIp':_0x3378ad,'customerPort':_0x340692['headers']['x-real-port']?_0x340692[_0x2e56('0x7a')][_0x2e56('0x99')]:null,'referer':_0x340692[_0x2e56('0x4e')]['referer'],'browserName':_0x5741cd[_0x2e56('0x9a')][_0x2e56('0x33')]&&_0x5741cd['browser'][_0x2e56('0x9b')]?util['format']('%s\x20%s',_0x5741cd[_0x2e56('0x9a')][_0x2e56('0x33')],_0x5741cd['browser'][_0x2e56('0x9b')]):_0x2e56('0x9c'),'browserVersion':_0x5741cd['browser']['version']||_0x2e56('0x9c'),'osName':util[_0x2e56('0x9d')]('%s\x20%s',_0x5741cd['os'][_0x2e56('0x33')],_0x5741cd['os']['version']),'osVersion':_0x5741cd['os'][_0x2e56('0x9b')],'deviceModel':_0x5741cd['device'][_0x2e56('0x37')]&&_0x5741cd[_0x2e56('0x9e')][_0x2e56('0x9f')]?util['format']('%s\x20%s\x20%s',_0x5741cd['device']['model'],_0x5741cd['device']['vendor'],_0x5741cd['device'][_0x2e56('0x31')]):null,'deviceVendor':_0x5741cd['device'][_0x2e56('0x9f')],'deviceType':_0x5741cd[_0x2e56('0x9e')][_0x2e56('0x31')],'formData':JSON[_0x2e56('0xa0')](_0x340692[_0x2e56('0x4e')])};var _0x323cd4={'ChatWebsiteId':_0x340692['params']['id'],'closed':![]};if(_0x340692['body'][_0x2e56('0xa1')]){_0x323cd4['threadId']=_0x340692[_0x2e56('0x4e')]['threadId'];return db[_0x2e56('0xa2')][_0x2e56('0x4c')]({'where':_0x323cd4})[_0x2e56('0x12')](function(_0x4c8285){if(_0x4c8285){return[_0x4c8285,![]];}_0x1bff39[_0x2e56('0xa1')]=_0x340692[_0x2e56('0x4e')][_0x2e56('0xa1')];_0x1bff39['externalUrl']=_0x340692[_0x2e56('0x4e')][_0x2e56('0xa3')];return db[_0x2e56('0xa2')][_0x2e56('0x4d')](_0x1bff39)[_0x2e56('0x12')](function(_0xdb1c20){return[_0xdb1c20,!![]];});});}_0x323cd4[_0x2e56('0xa4')]=_0xe439c0['id'];if(_0x340692[_0x2e56('0x4e')][_0x2e56('0xa5')]&&_0x340692['body']['interaction']['id']){_0x323cd4['id']=_0x340692['body'][_0x2e56('0xa5')]['id'];return db[_0x2e56('0xa2')][_0x2e56('0x4c')]({'where':_0x323cd4})[_0x2e56('0x12')](function(_0x1fe09c){if(_0x1fe09c){return[_0x1fe09c,![]];}return db[_0x2e56('0xa2')][_0x2e56('0x4d')](_0x1bff39)[_0x2e56('0x12')](function(_0x26d672){return[_0x26d672,!![]];});});}return db[_0x2e56('0xa2')][_0x2e56('0x4d')](_0x1bff39)['then'](function(_0x4e1875){return[_0x4e1875,!![]];});}})[_0x2e56('0xa6')](function(_0x39a9cc,_0x5e16d3){if(_0x39a9cc){_0x55db0d=_0x5e16d3;if(!_0x5e16d3){var _0x13e8ff={'from':(_0x1dacf7[_0x2e56('0x93')][_0x2e56('0x97')]||'')+'\x20'+(_0x1dacf7['contact'][_0x2e56('0x98')]||'')};if(_0x340692[_0x2e56('0x4e')][_0x2e56('0xa1')]&&_0x340692[_0x2e56('0x4e')]['messageId']&&_0x340692[_0x2e56('0x4e')][_0x2e56('0xa1')]!=_0x340692['body'][_0x2e56('0xa7')]){_0x13e8ff['threadId']=_0x340692['body'][_0x2e56('0xa7')];}return _0x39a9cc['update'](_0x13e8ff);}else{return _0x39a9cc;}}})['then'](function(_0x4c4e1d){_0x1dacf7['interaction']=_0x4c4e1d['get']({'plain':!![]});_0x1dacf7[_0x2e56('0xa5')]['created']=_0x55db0d;if(_0x1dacf7[_0x2e56('0xa5')][_0x2e56('0xa8')]){if(_0x1dacf7[_0x2e56('0x8d')][_0x2e56('0xa9')]){_0x1dacf7[_0x2e56('0x8e')][_0x2e56('0xaa')]({'id':0x0,'priority':_0x1dacf7[_0x2e56('0x8e')]['length']+0x1,'app':_0x2e56('0xab'),'appdata':_0x2e56('0xac'),'interval':_0x2e56('0xad')});}}return db[_0x2e56('0xae')]['create']({'body':_0x340692[_0x2e56('0x4e')][_0x2e56('0x4e')],'ChatWebsiteId':_0x340692[_0x2e56('0x54')]['id'],'ChatInteractionId':_0x4c4e1d['id'],'direction':'in','ContactId':_0x1dacf7['contact']['id'],'AttachmentId':_0x340692[_0x2e56('0x4e')][_0x2e56('0xaf')]});})[_0x2e56('0x12')](function(_0x28ce2f){_0x1dacf7[_0x2e56('0x19')]=_0x28ce2f;if(_0x1dacf7['interaction'][_0x2e56('0xb0')]){return db[_0x2e56('0xb1')][_0x2e56('0x4c')]({'attributes':['id',_0x2e56('0x33')],'where':{'id':_0x1dacf7[_0x2e56('0xa5')][_0x2e56('0xb0')]}})[_0x2e56('0x12')](function(_0x43aae1){if(_0x43aae1){_0x1dacf7[_0x2e56('0x8e')][_0x2e56('0xb2')]({'id':0x0,'priority':0x0,'app':_0x2e56('0xb3'),'appdata':_0x43aae1[_0x2e56('0x33')]+','+(_0x1dacf7[_0x2e56('0x8d')][_0x2e56('0xb4')]||0xa),'interval':'*,*,*,*'});_0x1dacf7[_0x2e56('0xb5')]=!![];}return respondWithRpcPromise(_0x2e56('0xb6'),_0x2e56('0xb7'),_0x1dacf7);});}return respondWithRpcPromise(_0x2e56('0xb6'),'startRouting',_0x1dacf7);})[_0x2e56('0x12')](function(_0x5de652){respondWithRpcPromise('EventManager',_0x2e56('0xb8'),{'event':_0x2e56('0xb9'),'message':_0x5de652},client9002);return _0x5de652;})[_0x2e56('0x12')](respondWithResult(_0x1b819f,null))[_0x2e56('0x1b')](handleError(_0x1b819f,null));};exports['offline']=function(_0x5e848b,_0x204dc6){var _0x9bcb2f,_0x3656df,_0x3142b2;var _0x114343=[];var _0x34cf58={};var _0x49227e=_0x5e848b[_0x2e56('0xba')]||[];var _0x2e33b2=[];var _0x351a4c;return db[_0x2e56('0x7c')][_0x2e56('0x55')]()[_0x2e56('0x12')](function(_0x79a546){if(!_0x79a546){throw new db[(_0x2e56('0x7d'))][(_0x2e56('0x7e'))]('no\x20available\x20attributes');}_0x114343=_['difference'](_['keys'](_0x79a546),[_0x2e56('0x81'),'updatedAt',_0x2e56('0x83'),_0x2e56('0x92')]);if(_0x5e848b[_0x2e56('0x4e')]['id']){delete _0x5e848b[_0x2e56('0x4e')]['id'];}if(_[_0x2e56('0x6c')](_0x5e848b[_0x2e56('0x4e')][_0x2e56('0x87')])){throw _0x204dc6[_0x2e56('0x1c')](0x1f4)['send'](new db[(_0x2e56('0x7d'))]['ValidationError'](_0x2e56('0xbb')));}if(_[_0x2e56('0x6c')](_0x5e848b[_0x2e56('0x4e')][_0x2e56('0x4e')])||_0x5e848b['body'][_0x2e56('0x4e')]===''){throw _0x204dc6[_0x2e56('0x1c')](0x1f4)[_0x2e56('0x2a')](new db['Sequelize']['ValidationError'](_0x2e56('0xbc')));}if(_['isNil'](_0x5e848b[_0x2e56('0x4e')][_0x2e56('0xbd')])){throw _0x204dc6[_0x2e56('0x1c')](0x1f4)[_0x2e56('0x2a')](new db[(_0x2e56('0x7d'))][(_0x2e56('0x7e'))](_0x2e56('0xbe')+_0x114343));}if(!_[_0x2e56('0x84')](_0x114343,_0x5e848b[_0x2e56('0x4e')]['mapKeyOffline'])){throw _0x204dc6[_0x2e56('0x1c')](0x1f4)[_0x2e56('0x2a')](new db[(_0x2e56('0x7d'))][(_0x2e56('0x7e'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x114343));}_0x34cf58[_0x5e848b[_0x2e56('0x4e')][_0x2e56('0xbd')]]=_0x5e848b['body']['from'];})[_0x2e56('0x12')](function(){return db[_0x2e56('0x2e')]['find']({'where':{'id':_0x5e848b[_0x2e56('0x54')]['id']},'include':[{'model':db[_0x2e56('0x88')],'as':_0x2e56('0x89')},{'model':db['MailAccount'],'as':'MailAccount'}]});})['then'](handleEntityNotFound(_0x204dc6,null))[_0x2e56('0x12')](function(_0x422de8){if(_0x422de8&&_0x422de8[_0x2e56('0x89')]){_0x3656df=_0x422de8;var _0x51a3d5=_[_0x2e56('0xa')](_0x5e848b[_0x2e56('0x4e')],{'firstName':_0x5e848b[_0x2e56('0x4e')][_0x2e56('0x87')],'phone':_0x5e848b['body'][_0x2e56('0x87')],'ListId':_0x422de8['ListId']});_0x51a3d5[_0x5e848b['body'][_0x2e56('0xbd')]]=_0x5e848b['body'][_0x2e56('0x87')];return db[_0x2e56('0x7c')][_0x2e56('0xbf')]({'where':_0x34cf58,'defaults':_0x51a3d5});}})['spread'](function(_0x1e7260){if(_0x1e7260){_0x3142b2=_0x1e7260;var _0x3d8527=fs[_0x2e56('0xc0')](path['join'](config[_0x2e56('0x6e')],_0x2e56('0xc1')),_0x2e56('0xc2'));var _0x5b7de5=ejs[_0x2e56('0xc3')](_0x3d8527,{'body':_[_0x2e56('0xc4')](_0x5e848b[_0x2e56('0x4e')][_0x2e56('0x4e')]),'bodyTitle':_0x3656df[_0x2e56('0xc5')]});return db['ChatOfflineMessage'][_0x2e56('0x4d')]({'body':_0x5b7de5,'ContactId':_0x1e7260['id'],'ChatWebsiteId':_0x3656df['id']});}})['then'](function(_0x4303d6){_0x351a4c=_0x4303d6;if(_0x49227e[_0x2e56('0x3a')]){var _0x145580=_0x49227e[_0x2e56('0x2d')](function(_0x11ccc6){return{'name':_0x11ccc6['originalname'],'basename':_0x11ccc6[_0x2e56('0x64')],'type':_0x11ccc6['mimetype'],'ChatOfflineMessageId':_0x4303d6['id']};});_0x2e33b2=_0x145580[_0x2e56('0x2d')](_0x54c43e=>{var _0x5eaad1={'filename':_0x54c43e[_0x2e56('0x33')],'path':path[_0x2e56('0x69')](config[_0x2e56('0x6e')],_0x2e56('0xc6'),_0x2e56('0xba'),'attachments',_0x2e56('0xc7'),_0x54c43e[_0x2e56('0xc8')])};return _0x5eaad1;});if(!_0x3656df[_0x2e56('0xc9')]){return db['sequelize'][_0x2e56('0xca')](function(_0x7c20c){return db['Attachment']['bulkCreate'](_0x145580,{'transaction':_0x7c20c});});}}})[_0x2e56('0x12')](function(){if(_0x351a4c){_0x9bcb2f=_0x351a4c;return db[_0x2e56('0xcb')][_0x2e56('0x5a')]({'where':{'active':!![]},'include':[{'model':db[_0x2e56('0xcc')],'as':'Smtp','raw':!![]}]});}})[_0x2e56('0x12')](function(_0x402a4e){if(_0x402a4e&&_0x402a4e[_0x2e56('0xcd')]&&_0x3656df['forwardOffline']&&_0x3656df[_0x2e56('0xce')]){var _0x376f43={'tls':{'rejectUnauthorized':![]}};if(_0x402a4e[_0x2e56('0xcd')][_0x2e56('0xcf')]){_0x376f43[_0x2e56('0xcf')]=_0x402a4e[_0x2e56('0xcd')][_0x2e56('0xcf')];}else{_0x376f43[_0x2e56('0xd0')]=_0x402a4e[_0x2e56('0xcd')][_0x2e56('0xd0')];_0x376f43[_0x2e56('0xd1')]=_0x402a4e[_0x2e56('0xcd')][_0x2e56('0xd1')];_0x376f43[_0x2e56('0xd2')]=_0x402a4e[_0x2e56('0xcd')][_0x2e56('0xd2')];}if(_0x402a4e[_0x2e56('0xcd')][_0x2e56('0xd3')]){_0x376f43[_0x2e56('0xd4')]={'user':_0x402a4e[_0x2e56('0xcd')][_0x2e56('0x4f')],'pass':_0x402a4e['Smtp'][_0x2e56('0xd5')]};}return respondWithRpcPromise(_0x2e56('0xd6'),_0x2e56('0xd7'),{'account':_0x376f43,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x402a4e['name'],_0x402a4e[_0x2e56('0xd8')]||_0x402a4e[_0x2e56('0xcd')][_0x2e56('0x4f')]),'to':_0x3656df[_0x2e56('0xce')],'subject':_0x3656df['offlineMessageSubject'],'html':_0x9bcb2f[_0x2e56('0x4e')],'attachments':_0x2e33b2}},client9003)[_0x2e56('0x12')](function(){return _0x9bcb2f;})[_0x2e56('0x1b')](function(_0xf24efb){console[_0x2e56('0x17')](_0xf24efb);});}})[_0x2e56('0x12')](function(){if(_0x3656df&&_0x3656df[_0x2e56('0xc9')]&&_0x3656df[_0x2e56('0xd9')]){var _0x42fb88=[];if(_0x49227e[_0x2e56('0x3a')]){_0x42fb88=_0x49227e['map'](function(_0x1627a1){return{'name':_0x1627a1[_0x2e56('0xda')],'basename':_0x1627a1['filename'],'type':_0x1627a1[_0x2e56('0xdb')],'ChatOfflineMessageId':_0x351a4c['id']};});}var _0x332eec;if(!_[_0x2e56('0x6c')](_0x3656df[_0x2e56('0xdc')])){var _0x1e1049=_['map'](_0x5e848b[_0x2e56('0x4e')],function(_0x8c8308){return _0x8c8308;});var _0x113880=_[_0x2e56('0xdd')](_0x1e1049)[0x0];var _0x476b1d=_['mapValues'](_0x113880,function(_0x4582ba){return _0x4582ba;});_0x332eec=_0x476b1d[0x1][_0x3656df[_0x2e56('0xdc')]];}var _0x4b5b42={'from':_0x3142b2[_0x2e56('0xd8')],'firstName':_0x3142b2['firstName'],'lastName':_0x3142b2['lastName'],'mapKey':_0x2e56('0xd8'),'message':{'from':_0x3142b2[_0x2e56('0xd8')],'to':_0x3656df['MailAccount'][_0x2e56('0xd8')],'cc':'','subject':_[_0x2e56('0x6c')](_0x332eec)?_0x3656df['offlineMessageSubject']:_0x332eec,'messageId':'','sentAt':new Date(),'attach':_0x42fb88[_0x2e56('0x3a')],'attachments':_0x42fb88,'originChannel':_0x2e56('0xde'),'ChatWebsiteId':_0x3656df['id'],'ChatOfflineMessageId':_0x9bcb2f['id'],'originTo':_0x3656df['MailAccount']['email']},'body':_0x9bcb2f[_0x2e56('0x4e')]};var _0x9af1d3={'account':{'id':_0x3656df[_0x2e56('0xd9')]},'body':_0x4b5b42,'log':'NotifyMailAccount'};return respondWithRpcPromise(_0x2e56('0xdf'),_0x2e56('0xe0'),_0x9af1d3,client9001)[_0x2e56('0x12')](function(){return _0x9bcb2f;})[_0x2e56('0x1b')](function(_0x28af9a){console[_0x2e56('0x17')](_0x28af9a);});}return;})[_0x2e56('0x12')](function(){if(_0x9bcb2f){return _0x9bcb2f;}})[_0x2e56('0x12')](respondWithResult(_0x204dc6,null))[_0x2e56('0x1b')](function(_0x50b94c){console['error'](_0x2e56('0x1b'),_0x50b94c);for(var _0x238e84 of _0x49227e){var _0x53f08f=path[_0x2e56('0x69')](config[_0x2e56('0x6e')],_0x2e56('0xc6'),'files',_0x2e56('0xe1'),'offline-chat',_0x238e84[_0x2e56('0x64')]);fs_extra[_0x2e56('0xe2')](_0x53f08f)[_0x2e56('0x1b')](function(_0x2951e1){console['error'](_0x2e56('0xe3'),_0x53f08f,_0x2951e1);});}});};exports[_0x2e56('0xe4')]=function(_0xd71bb0,_0x34eabf){return db[_0x2e56('0xa2')][_0x2e56('0x4c')]({'where':{'id':_0xd71bb0[_0x2e56('0x54')]['id']}})[_0x2e56('0x12')](handleEntityNotFound(_0x34eabf,null))[_0x2e56('0x12')](function(_0x177259){if(_0x177259){return _0x177259[_0x2e56('0xe4')](_0xd71bb0['body'][_0x2e56('0x60')],_[_0x2e56('0xe5')](_0xd71bb0[_0x2e56('0x4e')],['ids','id'])||{});}})['then'](respondWithResult(_0x34eabf,null))[_0x2e56('0x1b')](handleError(_0x34eabf,null));};exports['getInteractions']=function(_0x58d21d,_0x1447a1){var _0x140d94={'raw':![],'where':{}};var _0x39e4f7={};var _0x27b09f={'count':0x0,'rows':[]};return db[_0x2e56('0x2e')][_0x2e56('0x5a')]({'where':{'id':_0x58d21d[_0x2e56('0x54')]['id']}})['then'](handleEntityNotFound(_0x1447a1,null))['then'](function(_0x3f97b3){if(_0x3f97b3){_0x39e4f7[_0x2e56('0x37')]=_[_0x2e56('0x4a')](db['ChatInteraction'][_0x2e56('0x2f')]);_0x39e4f7['query']=_[_0x2e56('0x4a')](_0x58d21d[_0x2e56('0x34')]);_0x39e4f7[_0x2e56('0x35')]=_[_0x2e56('0x36')](_0x39e4f7[_0x2e56('0x37')],_0x39e4f7['query']);_0x140d94[_0x2e56('0x38')]=_[_0x2e56('0x36')](_0x39e4f7['model'],qs['fields'](_0x58d21d[_0x2e56('0x34')][_0x2e56('0x39')]));_0x140d94['attributes']=_0x140d94[_0x2e56('0x38')]['length']?_0x140d94['attributes']:_0x39e4f7[_0x2e56('0x37')];if(!_0x58d21d['query'][_0x2e56('0x3b')](_0x2e56('0x3c'))){_0x140d94[_0x2e56('0x20')]=qs[_0x2e56('0x20')](_0x58d21d['query'][_0x2e56('0x20')]);_0x140d94[_0x2e56('0x3d')]=qs[_0x2e56('0x3d')](_0x58d21d[_0x2e56('0x34')]['offset']);}_0x140d94[_0x2e56('0x5b')]=qs[_0x2e56('0x3e')](_0x58d21d[_0x2e56('0x34')][_0x2e56('0x3e')]);_0x140d94[_0x2e56('0x3f')]=qs[_0x2e56('0x35')](_[_0x2e56('0x40')](_0x58d21d[_0x2e56('0x34')],_0x39e4f7[_0x2e56('0x35')]));_0x140d94['where'][_0x2e56('0x57')]=_0x3f97b3['id'];if(_0x58d21d['query'][_0x2e56('0x41')]){_0x140d94['where']=_[_0x2e56('0x42')](_0x140d94['where'],{'$or':_[_0x2e56('0x2d')](_0x140d94['attributes'],function(_0x309450){var _0x33142c={};_0x33142c[_0x309450]={'$like':'%'+_0x58d21d[_0x2e56('0x34')][_0x2e56('0x41')]+'%'};return _0x33142c;})});}_0x140d94=_[_0x2e56('0x42')]({},_0x140d94,_0x58d21d['options']);return db[_0x2e56('0xa2')][_0x2e56('0x21')]({'where':_0x140d94[_0x2e56('0x3f')]})[_0x2e56('0x12')](function(_0x3a828b){_0x27b09f[_0x2e56('0x21')]=_0x3a828b;if(_0x58d21d[_0x2e56('0x34')][_0x2e56('0x45')]){_0x140d94['include']=[{'model':db[_0x2e56('0x7c')],'as':_0x2e56('0xe6'),'required':![]},{'model':db[_0x2e56('0xb1')],'as':_0x2e56('0xe7'),'attributes':[_0x2e56('0x33'),_0x2e56('0xe8'),'internal'],'required':![]},{'model':db['Tag'],'as':_0x2e56('0xe9'),'attributes':['id',_0x2e56('0x33'),'color'],'where':_0x58d21d['query']['tag']?{'id':_0x58d21d[_0x2e56('0x34')][_0x2e56('0xea')]}:undefined,'required':_0x58d21d[_0x2e56('0x34')][_0x2e56('0xea')]?!![]:![]}];}return db[_0x2e56('0xa2')][_0x2e56('0x46')](_0x140d94);})[_0x2e56('0x12')](function(_0x3b5f78){_0x27b09f['rows']=_0x3b5f78;return _0x27b09f;});}})['then'](respondWithFilteredResult(_0x1447a1,_0x140d94))[_0x2e56('0x1b')](handleError(_0x1447a1,null));};function iftimePromise(_0x5f3190,_0x55a86d){return respondWithRpcPromise(_0x2e56('0xeb'),_0x2e56('0xec'),{'command':_0x55a86d['timezone']?util[_0x2e56('0x9d')](_0x2e56('0xed'),_0x5f3190[_0x2e56('0xee')],_0x55a86d['timezone']):util[_0x2e56('0x9d')](_0x2e56('0xef'),_0x5f3190[_0x2e56('0xee')])},client9002)[_0x2e56('0x12')](function(_0x2f8ad5){var _0x67f8ce=_0x2f8ad5&&_0x2f8ad5[_0x2e56('0xf0')](_0x2e56('0xf1'))>=0x0?!![]:![];logger[_0x2e56('0x13')](_0x2e56('0xf2'),_0x55a86d['id'],_0x5f3190['id'],_0x5f3190[_0x2e56('0xee')],_0x67f8ce?_0x2e56('0xf3'):_0x2e56('0xf4'),_0x55a86d[_0x2e56('0xf5')]?_0x55a86d[_0x2e56('0xf5')]:_0x2e56('0xf6'));return _0x67f8ce;})[_0x2e56('0x1b')](function(_0x25da36){logger[_0x2e56('0x17')](_0x2e56('0xf2'),_0x55a86d['id'],_0x5f3190['id'],_0x5f3190[_0x2e56('0xee')],util[_0x2e56('0xf7')](_0x25da36,{'showHidden':![],'depth':null}),_0x55a86d[_0x2e56('0xf5')]?_0x55a86d[_0x2e56('0xf5')]:_0x2e56('0xf6'));return![];});}exports[_0x2e56('0xec')]=function(_0x23c5a7,_0x1e2c40){var _0x5dbff4=0x0;var _0x5e55b9=0x0;var _0x4891a8=![];var _0x5a4ddb;var _0x10c776;return db[_0x2e56('0x2e')][_0x2e56('0x4c')]({'where':{'id':_0x23c5a7[_0x2e56('0x54')]['id']},'include':[{'model':db[_0x2e56('0xf8')],'as':_0x2e56('0xf8'),'include':[{'model':db[_0x2e56('0xf8')],'as':_0x2e56('0xf9'),'attributes':['id',_0x2e56('0xee')],'raw':!![]}]}]})[_0x2e56('0x12')](handleEntityNotFound(_0x1e2c40,null))[_0x2e56('0x12')](function(_0x458ecf){if(_0x458ecf){_0x5a4ddb=_0x458ecf;return _0x458ecf['getProactiveActions']({'raw':!![]});}})[_0x2e56('0x12')](function(_0x15d6dd){if(_0x5a4ddb){if(_0x15d6dd){_0x10c776=_0x15d6dd;}}return require('../../config/license/util')[_0x2e56('0x6b')]();})[_0x2e56('0x12')](function(_0x269dd6){if(_0x269dd6){_0x5e55b9=_0x269dd6['virtual'];_0x4891a8=_0x269dd6[_0x2e56('0xfa')];}})[_0x2e56('0x12')](function(){return db[_0x2e56('0xa2')][_0x2e56('0x21')]({'where':{'closed':![]}});})[_0x2e56('0x12')](function(_0x3e9ea1){_0x5dbff4=_0x3e9ea1;if(_0x5e55b9&&_0x3e9ea1>_0x5e55b9){return db[_0x2e56('0xfb')][_0x2e56('0x5a')]({'where':{'id':0x1}})[_0x2e56('0x12')](function(_0x56b6d6){if(_0x56b6d6){_0x56b6d6[_0x2e56('0xfc')]('chatLicenseExceeded');}});}})['then'](function(){if(_0x5a4ddb[_0x2e56('0xf8')]&&_0x5a4ddb[_0x2e56('0xf8')][_0x2e56('0xf9')]){var _0x21ba17=[];for(var _0x106a11=0x0;_0x106a11<_0x5a4ddb['Interval']['Intervals']['length'];_0x106a11++){var _0xa152f2=_0x5a4ddb[_0x2e56('0xf8')][_0x2e56('0xf9')][_0x106a11][_0x2e56('0x26')]({'plain':!![]});_0x21ba17[_0x2e56('0xaa')](iftimePromise(_0xa152f2,_0x5a4ddb));}return BPromise['all'](_0x21ba17)[_0x2e56('0x12')](function(_0x1eabb3){return _[_0x2e56('0xfd')](_0x1eabb3);});}else{return!![];}})[_0x2e56('0x12')](function(_0x57256f){var _0x25a95e=fs[_0x2e56('0xc0')](path['join'](config['root'],_0x2e56('0xfe')),_0x2e56('0xc2'));var _0x3c1994={'remote':_0x5a4ddb[_0x2e56('0xff')],'query':querystring[_0x2e56('0xa0')](_[_0x2e56('0x42')](_0x5a4ddb['get']({'plain':!![]}),{'customerIp':_0x23c5a7['headers'][_0x2e56('0x95')]||_0x23c5a7['headers'][_0x2e56('0x100')]||_0x23c5a7[_0x2e56('0x101')][_0x2e56('0x102')]||_0x23c5a7['ip'],'referer':_0x23c5a7[_0x2e56('0x7a')]['referer'],'openedInteractions':_0x5dbff4,'maxInteractions':_0x5e55b9,'virtual':_0x4891a8[_0x2e56('0x103')],'online':_0x57256f,'custom':_0x4891a8}))[_0x2e56('0x104')](/'/g,'\x5c\x27')};_0x1e2c40[_0x2e56('0x2a')](ejs[_0x2e56('0xc3')](Mustache[_0x2e56('0xc3')](_0x25a95e,_0x3c1994),{'proactiveActions':_0x10c776,'alignment':_0x5a4ddb[_0x2e56('0x105')],'verticalAlignment':_0x5a4ddb['verticalAlignment'],'div_color':_0x5a4ddb['color'],'labelText':_0x5a4ddb[_0x2e56('0x106')],'text_color':_0x5a4ddb[_0x2e56('0x107')],'button_color':_0x5a4ddb[_0x2e56('0x108')],'background_color':_0x5a4ddb['backgroundColor']}));})[_0x2e56('0x1b')](handleError(_0x1e2c40,null));};exports[_0x2e56('0x109')]=function(_0x3e2be2,_0x19f413){var _0x595a90=_0x3e2be2['params']['id'];var _0x3a1427=_0x3e2be2[_0x2e56('0x4e')];var _0x3f1b66=0xc8;var _0x428967=null;return db[_0x2e56('0x10a')]['transaction']({'isolationLevel':db['sequelize'][_0x2e56('0x10b')][_0x2e56('0x10c')][_0x2e56('0x10d')]},function(_0xd52e32){return db[_0x2e56('0x2e')]['findOne']({'where':{'id':_0x595a90},'transaction':_0xd52e32})[_0x2e56('0x12')](function(_0x37054a){if(_0x37054a){return db[_0x2e56('0x8c')][_0x2e56('0x25')]({'where':{'ChatWebsiteId':_0x595a90},'transaction':_0xd52e32})[_0x2e56('0x12')](function(){var _0x196825=_[_0x2e56('0x2d')](_0x3a1427,function(_0x284be6){_0x284be6[_0x2e56('0x57')]=_0x595a90;return _0x284be6;});return db[_0x2e56('0x8c')][_0x2e56('0x10e')](_0x196825,{'transaction':_0xd52e32});});}else{_0x3f1b66=0x194;_0x428967=[];}});})['then'](function(){if(_0x3f1b66!==0x194){return db['ChatApplication'][_0x2e56('0x10f')]({'where':{'ChatWebsiteId':_0x595a90},'order':_0x2e56('0x91')})[_0x2e56('0x12')](function(_0x3d164f){_0x428967=_0x3d164f;});}})[_0x2e56('0x1b')](function(_0x1898c7){_0x3f1b66=0x1f4;logger['error'](_0x1898c7[_0x2e56('0x110')]);if(_0x1898c7[_0x2e56('0x33')]){delete _0x1898c7['name'];}_0x428967=_0x1898c7;})[_0x2e56('0x111')](function(){if(_0x428967===null){_0x19f413[_0x2e56('0x29')](_0x3f1b66);}else{if(_0x3f1b66===0x1f4){_0x19f413[_0x2e56('0x1c')](_0x3f1b66)['send'](_0x428967);}else{_0x19f413[_0x2e56('0x1c')](_0x3f1b66)['json'](_0x428967);}}});};exports[_0x2e56('0x112')]=function(_0x6c9c24,_0x491368){var _0x5553f3={};var _0x42d61c={};var _0x4fd98e;var _0x417497;return db[_0x2e56('0x2e')][_0x2e56('0x5a')]({'where':{'id':_0x6c9c24[_0x2e56('0x54')]['id']}})[_0x2e56('0x12')](handleEntityNotFound(_0x491368,null))[_0x2e56('0x12')](function(_0x71957c){if(_0x71957c){_0x4fd98e=_0x71957c;_0x42d61c[_0x2e56('0x37')]=_[_0x2e56('0x4a')](db['ChatApplication'][_0x2e56('0x2f')]);_0x42d61c[_0x2e56('0x34')]=_[_0x2e56('0x4a')](_0x6c9c24[_0x2e56('0x34')]);_0x42d61c[_0x2e56('0x35')]=_['intersection'](_0x42d61c[_0x2e56('0x37')],_0x42d61c[_0x2e56('0x34')]);_0x5553f3['attributes']=_[_0x2e56('0x36')](_0x42d61c['model'],qs['fields'](_0x6c9c24[_0x2e56('0x34')][_0x2e56('0x39')]));_0x5553f3[_0x2e56('0x38')]=_0x5553f3['attributes']['length']?_0x5553f3[_0x2e56('0x38')]:_0x42d61c['model'];_0x5553f3[_0x2e56('0x5b')]=qs[_0x2e56('0x3e')](_0x6c9c24[_0x2e56('0x34')]['sort']);_0x5553f3['where']=qs['filters'](_[_0x2e56('0x40')](_0x6c9c24[_0x2e56('0x34')],_0x42d61c[_0x2e56('0x35')]));if(_0x6c9c24[_0x2e56('0x34')]['filter']){_0x5553f3[_0x2e56('0x3f')]=_[_0x2e56('0x42')](_0x5553f3[_0x2e56('0x3f')],{'$or':_[_0x2e56('0x2d')](_0x5553f3[_0x2e56('0x38')],function(_0x33753b){var _0x422b66={};_0x422b66[_0x33753b]={'$like':'%'+_0x6c9c24['query'][_0x2e56('0x41')]+'%'};return _0x422b66;})});}_0x5553f3=_[_0x2e56('0x42')]({},_0x5553f3,_0x6c9c24[_0x2e56('0x44')]);return _0x4fd98e[_0x2e56('0x112')](_0x5553f3);}})[_0x2e56('0x12')](function(_0x4b53f8){if(_0x4b53f8){_0x417497=_0x4b53f8[_0x2e56('0x3a')];if(!_0x6c9c24[_0x2e56('0x34')]['hasOwnProperty'](_0x2e56('0x3c'))){_0x5553f3['limit']=qs['limit'](_0x6c9c24[_0x2e56('0x34')]['limit']);_0x5553f3['offset']=qs['offset'](_0x6c9c24[_0x2e56('0x34')][_0x2e56('0x3d')]);}return _0x4fd98e[_0x2e56('0x112')](_0x5553f3);}})[_0x2e56('0x12')](function(_0x47b0e6){if(_0x47b0e6){return _0x47b0e6?{'count':_0x417497,'rows':_0x47b0e6}:null;}})[_0x2e56('0x12')](respondWithResult(_0x491368,null))[_0x2e56('0x1b')](handleError(_0x491368,null));};exports['addProactiveActions']=function(_0x53d215,_0xf0a581){return db[_0x2e56('0x113')]['find']({'where':{'id':_0x53d215[_0x2e56('0x54')]['id']}})['then'](handleEntityNotFound(_0xf0a581,null))[_0x2e56('0x12')](function(_0x3e8ea3){if(_0x3e8ea3){return _0x3e8ea3[_0x2e56('0x114')](_0x53d215[_0x2e56('0x4e')][_0x2e56('0x60')],_[_0x2e56('0xe5')](_0x53d215[_0x2e56('0x4e')],[_0x2e56('0x60'),'id'])||{});}})[_0x2e56('0x12')](respondWithResult(_0xf0a581,null))[_0x2e56('0x1b')](handleError(_0xf0a581,null));};exports[_0x2e56('0x115')]=function(_0x4c3872,_0x117d8e){var _0x4f8b24={};var _0x4dc56b={};var _0x1b5fb9;var _0x4533b1;return db[_0x2e56('0x2e')][_0x2e56('0x5a')]({'where':{'id':_0x4c3872[_0x2e56('0x54')]['id']}})[_0x2e56('0x12')](handleEntityNotFound(_0x117d8e,null))[_0x2e56('0x12')](function(_0x6909aa){if(_0x6909aa){_0x1b5fb9=_0x6909aa;_0x4dc56b['model']=_['keys'](db[_0x2e56('0x116')][_0x2e56('0x2f')]);_0x4dc56b[_0x2e56('0x34')]=_[_0x2e56('0x4a')](_0x4c3872[_0x2e56('0x34')]);_0x4dc56b['filters']=_[_0x2e56('0x36')](_0x4dc56b['model'],_0x4dc56b[_0x2e56('0x34')]);_0x4f8b24[_0x2e56('0x38')]=_[_0x2e56('0x36')](_0x4dc56b[_0x2e56('0x37')],qs[_0x2e56('0x39')](_0x4c3872[_0x2e56('0x34')][_0x2e56('0x39')]));_0x4f8b24[_0x2e56('0x38')]=_0x4f8b24[_0x2e56('0x38')][_0x2e56('0x3a')]?_0x4f8b24['attributes']:_0x4dc56b[_0x2e56('0x37')];_0x4f8b24[_0x2e56('0x5b')]=qs['sort'](_0x4c3872[_0x2e56('0x34')][_0x2e56('0x3e')]);_0x4f8b24[_0x2e56('0x3f')]=qs[_0x2e56('0x35')](_[_0x2e56('0x40')](_0x4c3872[_0x2e56('0x34')],_0x4dc56b[_0x2e56('0x35')]));if(_0x4c3872['query']['filter']){_0x4f8b24[_0x2e56('0x3f')]=_[_0x2e56('0x42')](_0x4f8b24[_0x2e56('0x3f')],{'$or':_['map'](_0x4f8b24[_0x2e56('0x38')],function(_0xd1f143){var _0x35e4b7={};_0x35e4b7[_0xd1f143]={'$like':'%'+_0x4c3872[_0x2e56('0x34')][_0x2e56('0x41')]+'%'};return _0x35e4b7;})});}_0x4f8b24=_['merge']({},_0x4f8b24,_0x4c3872[_0x2e56('0x44')]);return _0x1b5fb9[_0x2e56('0x115')](_0x4f8b24);}})[_0x2e56('0x12')](function(_0x5700ee){if(_0x5700ee){_0x4533b1=_0x5700ee[_0x2e56('0x3a')];if(!_0x4c3872[_0x2e56('0x34')][_0x2e56('0x3b')]('nolimit')){_0x4f8b24[_0x2e56('0x20')]=qs[_0x2e56('0x20')](_0x4c3872[_0x2e56('0x34')][_0x2e56('0x20')]);_0x4f8b24[_0x2e56('0x3d')]=qs['offset'](_0x4c3872['query'][_0x2e56('0x3d')]);}return _0x1b5fb9[_0x2e56('0x115')](_0x4f8b24);}})[_0x2e56('0x12')](function(_0x5e05b2){if(_0x5e05b2){return _0x5e05b2?{'count':_0x4533b1,'rows':_0x5e05b2}:null;}})[_0x2e56('0x12')](respondWithResult(_0x117d8e,null))['catch'](handleError(_0x117d8e,null));};exports[_0x2e56('0x117')]=function(_0x119798,_0x562dc6){var _0x26c3eb=_0x119798[_0x2e56('0x34')]['online']===_0x2e56('0x118')?_0x2e56('0x119'):_0x2e56('0x11a');return db['ChatWebsite'][_0x2e56('0x4c')]({'attributes':['id',_0x26c3eb],'where':{'id':_0x119798[_0x2e56('0x54')]['id']}})[_0x2e56('0x12')](handleEntityNotFound(_0x562dc6,null))[_0x2e56('0x12')](function(_0x32ca4e){if(_0x32ca4e){var _0x5237c1=_0x32ca4e[_0x26c3eb];var _0x4c7223=_0x5237c1&&_0x5237c1[_0x2e56('0x11b')]?_0x5237c1[_0x2e56('0x11b')]:[];_0x562dc6[_0x2e56('0x2a')]({'fromKey':_[_0x2e56('0x6c')](_0x5237c1[_0x2e56('0x11c')])?undefined:_0x5237c1[_0x2e56('0x11c')],'count':_0x4c7223['length'],'rows':_0x4c7223});}})[_0x2e56('0x1b')](handleError(_0x562dc6,null));};exports['getOfflineMessages']=function(_0x173876,_0x130342){var _0x258040={'raw':![],'where':{}};var _0x18c0f5={};var _0x136e24={'count':0x0,'rows':[]};return db[_0x2e56('0x2e')][_0x2e56('0x5a')]({'where':{'id':_0x173876[_0x2e56('0x54')]['id']}})['then'](handleEntityNotFound(_0x130342,null))[_0x2e56('0x12')](function(_0x13580f){if(_0x13580f){_0x18c0f5['model']=_[_0x2e56('0x4a')](db[_0x2e56('0x11d')]['rawAttributes']);_0x18c0f5[_0x2e56('0x34')]=_['keys'](_0x173876[_0x2e56('0x34')]);_0x18c0f5[_0x2e56('0x35')]=_[_0x2e56('0x36')](_0x18c0f5[_0x2e56('0x37')],_0x18c0f5['query']);_0x258040[_0x2e56('0x38')]=_[_0x2e56('0x36')](_0x18c0f5[_0x2e56('0x37')],qs[_0x2e56('0x39')](_0x173876['query']['fields']));_0x258040[_0x2e56('0x38')]=_0x258040[_0x2e56('0x38')][_0x2e56('0x3a')]?_0x258040[_0x2e56('0x38')]:_0x18c0f5['model'];if(!_0x173876['query'][_0x2e56('0x3b')](_0x2e56('0x3c'))){_0x258040['limit']=qs[_0x2e56('0x20')](_0x173876['query']['limit']);_0x258040[_0x2e56('0x3d')]=qs[_0x2e56('0x3d')](_0x173876[_0x2e56('0x34')][_0x2e56('0x3d')]);}_0x258040['order']=qs['sort'](_0x173876['query'][_0x2e56('0x3e')]);_0x258040[_0x2e56('0x3f')]=qs[_0x2e56('0x35')](_[_0x2e56('0x40')](_0x173876[_0x2e56('0x34')],_0x18c0f5[_0x2e56('0x35')]));_0x258040[_0x2e56('0x3f')][_0x2e56('0x57')]=_0x13580f['id'];if(_0x173876[_0x2e56('0x34')][_0x2e56('0x41')]){_0x258040[_0x2e56('0x3f')]=_[_0x2e56('0x42')](_0x258040[_0x2e56('0x3f')],{'$or':_[_0x2e56('0x2d')](_0x258040[_0x2e56('0x38')],function(_0x353490){var _0x4c2d3d={};_0x4c2d3d[_0x353490]={'$like':'%'+_0x173876[_0x2e56('0x34')][_0x2e56('0x41')]+'%'};return _0x4c2d3d;})});}_0x258040=_[_0x2e56('0x42')]({},_0x258040,_0x173876[_0x2e56('0x44')]);return db['ChatOfflineMessage'][_0x2e56('0x21')]({'where':_0x258040[_0x2e56('0x3f')]})[_0x2e56('0x12')](function(_0x5f1774){_0x136e24[_0x2e56('0x21')]=_0x5f1774;if(_0x173876[_0x2e56('0x34')][_0x2e56('0x45')]){_0x258040[_0x2e56('0x4b')]=[{'all':!![]}];}else{_0x258040[_0x2e56('0x4b')]=[{'model':db['CmContact'],'as':_0x2e56('0xe6'),'required':![]},{'model':db[_0x2e56('0x11e')],'as':'Attachments','required':![]}];}return db[_0x2e56('0x11d')][_0x2e56('0x46')](_0x258040);})['then'](function(_0x43ae95){_0x136e24[_0x2e56('0x47')]=_0x43ae95;return _0x136e24;});}})['then'](respondWithFilteredResult(_0x130342,_0x258040))[_0x2e56('0x1b')](handleError(_0x130342,null));};exports[_0x2e56('0x11f')]=function(_0x1487a8,_0x3f6920){return db['ChatWebsite'][_0x2e56('0x4c')]({'where':{'id':_0x1487a8['params']['id']}})[_0x2e56('0x12')](handleEntityNotFound(_0x3f6920,null))[_0x2e56('0x12')](function(_0xa09c34){if(_0xa09c34){return _0xa09c34['addAgents'](_0x1487a8['body']['ids'],_['omit'](_0x1487a8[_0x2e56('0x4e')],[_0x2e56('0x60'),'id'])||{})[_0x2e56('0xa6')](function(_0x443282){for(var _0x1c6106=0x0;_0x1c6106<_0x1487a8[_0x2e56('0x4e')]['ids']['length'];_0x1c6106+=0x1){socket[_0x2e56('0x120')]('userChatWebsite:save',{'UserId':Number(_0x1487a8[_0x2e56('0x4e')][_0x2e56('0x60')][_0x1c6106]),'ChatWebsiteId':Number(_0x1487a8[_0x2e56('0x54')]['id'])});}return _0x443282;});}})['then'](respondWithResult(_0x3f6920,null))['catch'](handleError(_0x3f6920,null));};exports[_0x2e56('0x121')]=function(_0x2ec4f3,_0x460114){return db[_0x2e56('0x2e')][_0x2e56('0x4c')]({'where':{'id':_0x2ec4f3[_0x2e56('0x54')]['id']}})[_0x2e56('0x12')](handleEntityNotFound(_0x460114,null))['then'](function(_0x318327){if(_0x318327){return _0x318327['removeAgents'](_0x2ec4f3[_0x2e56('0x34')][_0x2e56('0x60')])['then'](function(){if(_[_0x2e56('0x122')](_0x2ec4f3[_0x2e56('0x34')][_0x2e56('0x60')])){for(var _0x101d4b=0x0;_0x101d4b<_0x2ec4f3[_0x2e56('0x34')][_0x2e56('0x60')][_0x2e56('0x3a')];_0x101d4b+=0x1){socket[_0x2e56('0x120')](_0x2e56('0x123'),{'UserId':Number(_0x2ec4f3[_0x2e56('0x34')][_0x2e56('0x60')][_0x101d4b]),'ChatWebsiteId':Number(_0x2ec4f3[_0x2e56('0x54')]['id'])});}}else{socket[_0x2e56('0x120')](_0x2e56('0x123'),{'UserId':Number(_0x2ec4f3[_0x2e56('0x34')][_0x2e56('0x60')]),'ChatWebsiteId':Number(_0x2ec4f3[_0x2e56('0x54')]['id'])});}});}})['then'](respondWithStatusCode(_0x460114,null))[_0x2e56('0x1b')](handleError(_0x460114,null));};exports['getAgents']=function(_0xf8088d,_0x3c06ed){var _0x19a4a8={};var _0x34a8da={};var _0x50f6de;var _0x41e679;return db['ChatWebsite'][_0x2e56('0x5a')]({'where':{'id':_0xf8088d[_0x2e56('0x54')]['id']}})['then'](handleEntityNotFound(_0x3c06ed,null))[_0x2e56('0x12')](function(_0x21b606){if(_0x21b606){_0x50f6de=_0x21b606;_0x34a8da[_0x2e56('0x37')]=_[_0x2e56('0x4a')](db[_0x2e56('0xb1')][_0x2e56('0x2f')]);_0x34a8da[_0x2e56('0x34')]=_[_0x2e56('0x4a')](_0xf8088d[_0x2e56('0x34')]);_0x34a8da[_0x2e56('0x35')]=_[_0x2e56('0x36')](_0x34a8da['model'],_0x34a8da['query']);_0x19a4a8[_0x2e56('0x38')]=_[_0x2e56('0x36')](_0x34a8da['model'],qs[_0x2e56('0x39')](_0xf8088d[_0x2e56('0x34')][_0x2e56('0x39')]));_0x19a4a8[_0x2e56('0x38')]=_0x19a4a8[_0x2e56('0x38')][_0x2e56('0x3a')]?_0x19a4a8[_0x2e56('0x38')]:_0x34a8da[_0x2e56('0x37')];_0x19a4a8['order']=qs[_0x2e56('0x3e')](_0xf8088d[_0x2e56('0x34')][_0x2e56('0x3e')]);_0x19a4a8['where']=qs[_0x2e56('0x35')](_[_0x2e56('0x40')](_0xf8088d[_0x2e56('0x34')],_0x34a8da[_0x2e56('0x35')]));if(_0xf8088d[_0x2e56('0x34')][_0x2e56('0x41')]){_0x19a4a8[_0x2e56('0x3f')]=_['merge'](_0x19a4a8[_0x2e56('0x3f')],{'$or':_[_0x2e56('0x2d')](_0x19a4a8['attributes'],function(_0x4c72d6){var _0xdc93d6={};_0xdc93d6[_0x4c72d6]={'$like':'%'+_0xf8088d[_0x2e56('0x34')][_0x2e56('0x41')]+'%'};return _0xdc93d6;})});}_0x19a4a8=_[_0x2e56('0x42')]({},_0x19a4a8,_0xf8088d[_0x2e56('0x44')]);return _0x50f6de['getAgents'](_0x19a4a8);}})[_0x2e56('0x12')](function(_0x45891a){if(_0x45891a){_0x41e679=_0x45891a['length'];if(!_0xf8088d[_0x2e56('0x34')][_0x2e56('0x3b')]('nolimit')){_0x19a4a8[_0x2e56('0x20')]=qs[_0x2e56('0x20')](_0xf8088d[_0x2e56('0x34')][_0x2e56('0x20')]);_0x19a4a8[_0x2e56('0x3d')]=qs[_0x2e56('0x3d')](_0xf8088d[_0x2e56('0x34')][_0x2e56('0x3d')]);}return _0x50f6de[_0x2e56('0x124')](_0x19a4a8);}})[_0x2e56('0x12')](function(_0x5ddc3e){if(_0x5ddc3e){return _0x5ddc3e?{'count':_0x41e679,'rows':_0x5ddc3e}:null;}})[_0x2e56('0x12')](respondWithResult(_0x3c06ed,null))[_0x2e56('0x1b')](handleError(_0x3c06ed,null));}; \ No newline at end of file +var _0x1bba=['merge','VIRTUAL','options','findAll','rows','show','params','include','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','includeAll','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addLogo','sitepic','file','filename','addAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','join','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','isNil','existsSync','server/files/images/logos/','root','download','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','agentAvatar','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','getSystemAvatar','systemAvatar','notify','user-agent-parser','setUA','headers','user-agent','getResult','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','updatedAt','difference','createdAt','CompanyId','ListId','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','Contacts','ChatApplication','List','account','applications','list','orderBy','Applications','cf-connecting-ip','x-forwarded-for','first','split','firstName','lastName','browser','version','format','%s\x20%s','unknown','device','vendor','%s\x20%s\x20%s','threadId','ChatInteraction','externalUrl','ContactId','interaction','contact','messageId','created','close','unmanaged','ChatMessage','AttachmentId','UserId','User','unshift','agent','*,*,*,*','Start','startRouting','EventManager','offline','send','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','spread','readFileSync','server/files/templates/chatOfflineMessage.ejs','ChatOfflineMessage','originalname','mimetype','server','files','offline-chat','openNewInteraction','bulkCreate','MailServerOut','Smtp','forwardOffline','forwardOfflineAddress','service','host','port','secure','authentication','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','MailAccountId','subjectOffline','mapValues','email','offlineMessageSubject','NotifyMailAccount','notifyMail','attachments','remove','addInteraction','omit','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','Command','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','Interval','getProactiveActions','virtual','custom','License','increment','chatLicenseExceeded','Intervals','push','some','server/files/chat/iframe.ejs','utf8','x-real-ip','connection','remoteAddress','replace','render','alignment','labelText','textColor','color_button','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','finally','getApplications','chatProactiveAction','addProactiveActions','ChatProactiveAction','getFields','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','Attachment','addAgents','emit','userChatWebsite:save','isArray','userChatWebsite:remove','getAgents','mustache','util','ejs','fs-extra','lodash','querystring','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','ChatWebsite,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','update','ChatWebsites','UserProfileResource','destroy','stack','name','index','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter'];(function(_0x28d9b6,_0x10f7fd){var _0x31c3b8=function(_0x47f985){while(--_0x47f985){_0x28d9b6['push'](_0x28d9b6['shift']());}};_0x31c3b8(++_0x10f7fd);}(_0x1bba,0xe4));var _0xa1bb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1bba[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require('bluebird');var Mustache=require(_0xa1bb('0x0'));var util=require(_0xa1bb('0x1'));var path=require('path');var ejs=require(_0xa1bb('0x2'));var fs=require('fs');var fs_extra=require(_0xa1bb('0x3'));var _=require(_0xa1bb('0x4'));var querystring=require(_0xa1bb('0x5'));var Redis=require('ioredis');var qs=require(_0xa1bb('0x6'));var logger=require(_0xa1bb('0x7'))(_0xa1bb('0x8'));var config=require(_0xa1bb('0x9'));var db=require(_0xa1bb('0xa'))['db'];config[_0xa1bb('0xb')]=_[_0xa1bb('0xc')](config[_0xa1bb('0xb')],{'host':_0xa1bb('0xd'),'port':0x18eb});var socket=require(_0xa1bb('0xe'))(new Redis(config['redis']));require('./chatWebsite.socket')[_0xa1bb('0xf')](socket);var jayson=require(_0xa1bb('0x10'));var client=jayson[_0xa1bb('0x11')]['http']({'port':0x232c});var client9002=jayson[_0xa1bb('0x11')]['http']({'port':0x232a});var client9003=jayson[_0xa1bb('0x11')]['http']({'port':0x232b});var client9001=jayson[_0xa1bb('0x11')][_0xa1bb('0x12')]({'port':0x2329});function respondWithRpcPromise(_0x158410,_0x55d25a,_0x1132cc,_0x8fa59d){return new BPromise(function(_0x514cee,_0x1cbd2e){var _0x13273f=_0x8fa59d||client;return _0x13273f[_0xa1bb('0x13')](_0x158410,_0x1132cc)[_0xa1bb('0x14')](function(_0x18254a){logger[_0xa1bb('0x15')](_0xa1bb('0x16'),_0x55d25a,'request\x20sent');logger['debug']('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x55d25a,'request\x20sent',JSON[_0xa1bb('0x17')](_0x18254a));if(_0x18254a[_0xa1bb('0x18')]){if(_0x18254a[_0xa1bb('0x18')][_0xa1bb('0x19')]===0x1f4){logger[_0xa1bb('0x18')]('ChatWebsite,\x20%s,\x20%s',_0x55d25a,_0x18254a[_0xa1bb('0x18')]['message']);return _0x1cbd2e(_0x18254a[_0xa1bb('0x18')][_0xa1bb('0x1a')]);}logger[_0xa1bb('0x18')](_0xa1bb('0x16'),_0x55d25a,_0x18254a[_0xa1bb('0x18')][_0xa1bb('0x1a')]);return _0x514cee(_0x18254a[_0xa1bb('0x18')][_0xa1bb('0x1a')]);}else{logger[_0xa1bb('0x15')](_0xa1bb('0x16'),_0x55d25a,'request\x20sent');_0x514cee(_0x18254a['result'][_0xa1bb('0x1a')]);}})[_0xa1bb('0x1b')](function(_0x599824){logger['error'](_0xa1bb('0x16'),_0x55d25a,_0x599824);_0x1cbd2e(_0x599824);});});}function respondWithStatusCode(_0x161033,_0x39a3b3){_0x39a3b3=_0x39a3b3||0xcc;return function(_0x326252){if(_0x326252){return _0x161033[_0xa1bb('0x1c')](_0x39a3b3);}return _0x161033[_0xa1bb('0x1d')](_0x39a3b3)[_0xa1bb('0x1e')]();};}function respondWithResult(_0x2b9a0d,_0x1a227c){_0x1a227c=_0x1a227c||0xc8;return function(_0x416262){if(_0x416262){return _0x2b9a0d[_0xa1bb('0x1d')](_0x1a227c)[_0xa1bb('0x1f')](_0x416262);}};}function respondWithFilteredResult(_0x4632fa,_0x238f37){return function(_0x43f833){if(_0x43f833){var _0x22c40d=typeof _0x238f37['offset']==='undefined'&&typeof _0x238f37[_0xa1bb('0x20')]===_0xa1bb('0x21');var _0x507591=_0x43f833[_0xa1bb('0x22')];var _0xb74e0a=_0x22c40d?0x0:_0x238f37[_0xa1bb('0x23')];var _0xb6aebd=_0x22c40d?_0x43f833[_0xa1bb('0x22')]:_0x238f37['offset']+_0x238f37['limit'];var _0x7647fa;if(_0xb6aebd>=_0x507591){_0xb6aebd=_0x507591;_0x7647fa=0xc8;}else{_0x7647fa=0xce;}_0x4632fa[_0xa1bb('0x1d')](_0x7647fa);return _0x4632fa[_0xa1bb('0x24')](_0xa1bb('0x25'),_0xb74e0a+'-'+_0xb6aebd+'/'+_0x507591)[_0xa1bb('0x1f')](_0x43f833);}return null;};}function saveUpdates(_0x4f9bb9){return function(_0x14cb9b){if(_0x14cb9b){return _0x14cb9b[_0xa1bb('0x26')](_0x4f9bb9)[_0xa1bb('0x14')](function(_0x21e0ce){return _0x21e0ce;});}return null;};}function removeEntity(_0xa6962a){return function(_0x5304e6){if(_0x5304e6){return _0x5304e6['destroy']()['then'](function(){var _0x4d62f8=_0x5304e6['get']({'plain':!![]});var _0x5184bc=_0xa1bb('0x27');return db[_0xa1bb('0x28')][_0xa1bb('0x29')]({'where':{'type':_0x5184bc,'resourceId':_0x4d62f8['id']}})[_0xa1bb('0x14')](function(){return _0x5304e6;});})[_0xa1bb('0x14')](function(){_0xa6962a[_0xa1bb('0x1d')](0xcc)[_0xa1bb('0x1e')]();});}};}function handleEntityNotFound(_0x4c2682){return function(_0x15cd98){if(!_0x15cd98){_0x4c2682['sendStatus'](0x194);}return _0x15cd98;};}function handleError(_0x719272,_0x34df76){_0x34df76=_0x34df76||0x1f4;return function(_0x1d9f1c){logger[_0xa1bb('0x18')](_0x1d9f1c[_0xa1bb('0x2a')]);if(_0x1d9f1c['name']){delete _0x1d9f1c[_0xa1bb('0x2b')];}_0x719272[_0xa1bb('0x1d')](_0x34df76)['send'](_0x1d9f1c);};}exports[_0xa1bb('0x2c')]=function(_0x556911,_0x1ad2fd){var _0x489759={'include':[{'model':db[_0xa1bb('0x2d')],'as':_0xa1bb('0x2e')}]},_0x28ebf9={},_0xca5b48={'count':0x0,'rows':[]};var _0x24e2d6=_[_0xa1bb('0x2f')](db[_0xa1bb('0x30')][_0xa1bb('0x31')],function(_0x45adac){return{'name':_0x45adac['fieldName'],'type':_0x45adac[_0xa1bb('0x32')][_0xa1bb('0x33')]};});_0x28ebf9[_0xa1bb('0x34')]=_[_0xa1bb('0x2f')](_0x24e2d6,'name');_0x28ebf9[_0xa1bb('0x35')]=_[_0xa1bb('0x36')](_0x556911['query']);_0x28ebf9[_0xa1bb('0x37')]=_[_0xa1bb('0x38')](_0x28ebf9[_0xa1bb('0x34')],_0x28ebf9[_0xa1bb('0x35')]);_0x489759[_0xa1bb('0x39')]=_[_0xa1bb('0x38')](_0x28ebf9[_0xa1bb('0x34')],qs[_0xa1bb('0x3a')](_0x556911[_0xa1bb('0x35')][_0xa1bb('0x3a')]));_0x489759[_0xa1bb('0x39')]=_0x489759[_0xa1bb('0x39')][_0xa1bb('0x3b')]?_0x489759[_0xa1bb('0x39')]:_0x28ebf9[_0xa1bb('0x34')];if(!_0x556911[_0xa1bb('0x35')][_0xa1bb('0x3c')](_0xa1bb('0x3d'))){_0x489759[_0xa1bb('0x20')]=qs['limit'](_0x556911[_0xa1bb('0x35')][_0xa1bb('0x20')]);_0x489759[_0xa1bb('0x23')]=qs[_0xa1bb('0x23')](_0x556911[_0xa1bb('0x35')]['offset']);}_0x489759[_0xa1bb('0x3e')]=qs[_0xa1bb('0x3f')](_0x556911['query'][_0xa1bb('0x3f')]);_0x489759[_0xa1bb('0x40')]=qs[_0xa1bb('0x37')](_[_0xa1bb('0x41')](_0x556911[_0xa1bb('0x35')],_0x28ebf9[_0xa1bb('0x37')]),_0x24e2d6);if(_0x556911[_0xa1bb('0x35')][_0xa1bb('0x42')]){_0x489759['where']=_[_0xa1bb('0x43')](_0x489759['where'],{'$or':_['map'](_0x24e2d6,function(_0x3d367d){if(_0x3d367d[_0xa1bb('0x32')]!==_0xa1bb('0x44')){var _0x49717d={};_0x49717d[_0x3d367d['name']]={'$like':'%'+_0x556911[_0xa1bb('0x35')][_0xa1bb('0x42')]+'%'};return _0x49717d;}})});}_0x489759=_['merge']({},_0x489759,_0x556911[_0xa1bb('0x45')]);var _0x254d77={'where':_0x489759[_0xa1bb('0x40')]};return db[_0xa1bb('0x30')][_0xa1bb('0x22')](_0x254d77)[_0xa1bb('0x14')](function(_0x77689f){_0xca5b48[_0xa1bb('0x22')]=_0x77689f;if(_0x556911['query']['includeAll']){_0x489759['include']=[{'all':!![]}];}return db['ChatWebsite'][_0xa1bb('0x46')](_0x489759);})[_0xa1bb('0x14')](function(_0x3b2c0d){_0xca5b48[_0xa1bb('0x47')]=_0x3b2c0d;return _0xca5b48;})[_0xa1bb('0x14')](respondWithFilteredResult(_0x1ad2fd,_0x489759))['catch'](handleError(_0x1ad2fd,null));};exports[_0xa1bb('0x48')]=function(_0x184e6c,_0x33983e){var _0x357b8a={'raw':![],'where':{'id':_0x184e6c[_0xa1bb('0x49')]['id']},'include':[{'model':db[_0xa1bb('0x2d')],'as':_0xa1bb('0x2e')}]},_0x4768b5={};_0x4768b5[_0xa1bb('0x34')]=_[_0xa1bb('0x36')](db['ChatWebsite'][_0xa1bb('0x31')]);_0x4768b5['query']=_['keys'](_0x184e6c['query']);_0x4768b5['filters']=_[_0xa1bb('0x38')](_0x4768b5[_0xa1bb('0x34')],_0x4768b5[_0xa1bb('0x35')]);_0x357b8a['attributes']=_[_0xa1bb('0x38')](_0x4768b5[_0xa1bb('0x34')],qs[_0xa1bb('0x3a')](_0x184e6c['query'][_0xa1bb('0x3a')]));_0x357b8a[_0xa1bb('0x39')]=_0x357b8a[_0xa1bb('0x39')][_0xa1bb('0x3b')]?_0x357b8a[_0xa1bb('0x39')]:_0x4768b5[_0xa1bb('0x34')];if(_0x184e6c[_0xa1bb('0x35')]['includeAll']){_0x357b8a[_0xa1bb('0x4a')]=[{'all':!![]}];}_0x357b8a=_[_0xa1bb('0x43')]({},_0x357b8a,_0x184e6c['options']);return db[_0xa1bb('0x30')][_0xa1bb('0x4b')](_0x357b8a)[_0xa1bb('0x14')](handleEntityNotFound(_0x33983e,null))[_0xa1bb('0x14')](respondWithResult(_0x33983e,null))['catch'](handleError(_0x33983e,null));};exports['create']=function(_0x665285,_0x391fbc){return db['ChatWebsite'][_0xa1bb('0x4c')](_0x665285['body'],{})[_0xa1bb('0x14')](function(_0x57cd1a){var _0x3c1c86=_0x665285[_0xa1bb('0x4d')][_0xa1bb('0x4e')]({'plain':!![]});if(!_0x3c1c86)throw new Error(_0xa1bb('0x4f'));if(_0x3c1c86['role']===_0xa1bb('0x4d')){var _0x3dd83c=_0x57cd1a['get']({'plain':!![]});var _0x43e7b5=_0xa1bb('0x27');return db[_0xa1bb('0x50')][_0xa1bb('0x4b')]({'where':{'name':_0x43e7b5,'userProfileId':_0x3c1c86[_0xa1bb('0x51')]},'raw':!![]})[_0xa1bb('0x14')](function(_0x379704){if(_0x379704&&_0x379704[_0xa1bb('0x52')]===0x0){return db[_0xa1bb('0x28')][_0xa1bb('0x4c')]({'name':_0x3dd83c[_0xa1bb('0x2b')],'resourceId':_0x3dd83c['id'],'type':_0x379704['name'],'sectionId':_0x379704['id']},{})[_0xa1bb('0x14')](function(){return _0x57cd1a;});}else{return _0x57cd1a;}})['catch'](function(_0x2f4d85){logger[_0xa1bb('0x18')](_0xa1bb('0x53'),_0x2f4d85);throw _0x2f4d85;});}return _0x57cd1a;})[_0xa1bb('0x14')](respondWithResult(_0x391fbc,0xc9))[_0xa1bb('0x1b')](handleError(_0x391fbc,null));};exports[_0xa1bb('0x26')]=function(_0x266ef1,_0x30f961){if(_0x266ef1['body']['id']){delete _0x266ef1['body']['id'];}return db[_0xa1bb('0x30')][_0xa1bb('0x4b')]({'where':{'id':_0x266ef1['params']['id']},'include':[{'model':db[_0xa1bb('0x2d')],'as':_0xa1bb('0x2e')}]})[_0xa1bb('0x14')](handleEntityNotFound(_0x30f961,null))[_0xa1bb('0x14')](saveUpdates(_0x266ef1[_0xa1bb('0x54')],null))[_0xa1bb('0x14')](respondWithResult(_0x30f961,null))[_0xa1bb('0x1b')](handleError(_0x30f961,null));};exports[_0xa1bb('0x29')]=function(_0x5ab9d4,_0x4e33e8){return db['ChatWebsite']['find']({'where':{'id':_0x5ab9d4[_0xa1bb('0x49')]['id']}})[_0xa1bb('0x14')](handleEntityNotFound(_0x4e33e8,null))[_0xa1bb('0x14')](removeEntity(_0x4e33e8,null))[_0xa1bb('0x1b')](handleError(_0x4e33e8,null));};exports['describe']=function(_0x5a2286,_0x30aeaf){return db[_0xa1bb('0x30')][_0xa1bb('0x55')]()[_0xa1bb('0x14')](respondWithResult(_0x30aeaf,null))[_0xa1bb('0x1b')](handleError(_0x30aeaf,null));};exports[_0xa1bb('0x56')]=function(_0x934e90,_0x53d816){if(_0x934e90[_0xa1bb('0x54')]['id']){delete _0x934e90[_0xa1bb('0x54')]['id'];}return db[_0xa1bb('0x30')]['find']({'where':{'id':_0x934e90[_0xa1bb('0x49')]['id']}})[_0xa1bb('0x14')](handleEntityNotFound(_0x53d816,null))[_0xa1bb('0x14')](function(_0x2ddd97){if(_0x2ddd97){_0x934e90[_0xa1bb('0x54')][_0xa1bb('0x57')]=_0x2ddd97['id'];return db[_0xa1bb('0x58')]['create'](_0x934e90[_0xa1bb('0x54')]);}})[_0xa1bb('0x14')](respondWithResult(_0x53d816,null))[_0xa1bb('0x1b')](handleError(_0x53d816,null));};exports[_0xa1bb('0x59')]=function(_0x3d4a1c,_0x18a17d){var _0x468e70={'raw':![],'where':{}};var _0x305762={};var _0x16073f={'count':0x0,'rows':[]};return db[_0xa1bb('0x30')][_0xa1bb('0x5a')]({'where':{'id':_0x3d4a1c['params']['id']}})['then'](handleEntityNotFound(_0x18a17d,null))[_0xa1bb('0x14')](function(_0x4bb330){if(_0x4bb330){_0x305762['model']=_[_0xa1bb('0x36')](db[_0xa1bb('0x58')][_0xa1bb('0x31')]);_0x305762[_0xa1bb('0x35')]=_[_0xa1bb('0x36')](_0x3d4a1c[_0xa1bb('0x35')]);_0x305762['filters']=_[_0xa1bb('0x38')](_0x305762['model'],_0x305762[_0xa1bb('0x35')]);_0x468e70[_0xa1bb('0x39')]=_[_0xa1bb('0x38')](_0x305762['model'],qs[_0xa1bb('0x3a')](_0x3d4a1c[_0xa1bb('0x35')]['fields']));_0x468e70[_0xa1bb('0x39')]=_0x468e70[_0xa1bb('0x39')][_0xa1bb('0x3b')]?_0x468e70[_0xa1bb('0x39')]:_0x305762[_0xa1bb('0x34')];if(!_0x3d4a1c['query']['hasOwnProperty'](_0xa1bb('0x3d'))){_0x468e70[_0xa1bb('0x20')]=qs[_0xa1bb('0x20')](_0x3d4a1c['query'][_0xa1bb('0x20')]);_0x468e70[_0xa1bb('0x23')]=qs[_0xa1bb('0x23')](_0x3d4a1c[_0xa1bb('0x35')][_0xa1bb('0x23')]);}_0x468e70['order']=qs[_0xa1bb('0x3f')](_0x3d4a1c['query'][_0xa1bb('0x3f')]);_0x468e70[_0xa1bb('0x40')]=qs[_0xa1bb('0x37')](_['pick'](_0x3d4a1c[_0xa1bb('0x35')],_0x305762[_0xa1bb('0x37')]));_0x468e70[_0xa1bb('0x40')][_0xa1bb('0x57')]=_0x4bb330['id'];if(_0x3d4a1c[_0xa1bb('0x35')][_0xa1bb('0x42')]){_0x468e70['where']=_[_0xa1bb('0x43')](_0x468e70['where'],{'$or':_[_0xa1bb('0x2f')](_0x468e70['attributes'],function(_0x4bef0e){var _0x28503f={};_0x28503f[_0x4bef0e]={'$like':'%'+_0x3d4a1c[_0xa1bb('0x35')][_0xa1bb('0x42')]+'%'};return _0x28503f;})});}_0x468e70=_[_0xa1bb('0x43')]({},_0x468e70,_0x3d4a1c['options']);return db['Disposition'][_0xa1bb('0x22')]({'where':_0x468e70[_0xa1bb('0x40')]})[_0xa1bb('0x14')](function(_0x4629e7){_0x16073f[_0xa1bb('0x22')]=_0x4629e7;if(_0x3d4a1c[_0xa1bb('0x35')][_0xa1bb('0x5b')]){_0x468e70[_0xa1bb('0x4a')]=[{'all':!![]}];}return db[_0xa1bb('0x58')][_0xa1bb('0x46')](_0x468e70);})[_0xa1bb('0x14')](function(_0x70d47a){_0x16073f[_0xa1bb('0x47')]=_0x70d47a;return _0x16073f;});}})[_0xa1bb('0x14')](respondWithFilteredResult(_0x18a17d,_0x468e70))[_0xa1bb('0x1b')](handleError(_0x18a17d,null));};exports['removeDispositions']=function(_0xc933de,_0x25f479){return db[_0xa1bb('0x30')][_0xa1bb('0x4b')]({'where':{'id':_0xc933de['params']['id']}})[_0xa1bb('0x14')](handleEntityNotFound(_0x25f479,null))['then'](function(_0x2758fc){if(_0x2758fc){return _0x2758fc['removeDispositions'](_0xc933de[_0xa1bb('0x35')][_0xa1bb('0x5c')]);}})[_0xa1bb('0x14')](respondWithStatusCode(_0x25f479,null))['catch'](handleError(_0x25f479,null));};exports[_0xa1bb('0x5d')]=function(_0x3bb7b2,_0x469a6c){if(_0x3bb7b2[_0xa1bb('0x54')]['id']){delete _0x3bb7b2['body']['id'];}return db[_0xa1bb('0x30')]['find']({'where':{'id':_0x3bb7b2[_0xa1bb('0x49')]['id']}})[_0xa1bb('0x14')](handleEntityNotFound(_0x469a6c,null))['then'](function(_0x4d1b26){if(_0x4d1b26){_0x3bb7b2[_0xa1bb('0x54')][_0xa1bb('0x57')]=_0x4d1b26['id'];return db[_0xa1bb('0x5e')][_0xa1bb('0x4c')](_0x3bb7b2['body']);}})[_0xa1bb('0x14')](respondWithResult(_0x469a6c,null))[_0xa1bb('0x1b')](handleError(_0x469a6c,null));};exports[_0xa1bb('0x5f')]=function(_0x1cd154,_0x31d194){var _0xfc7af2={'raw':![],'where':{}};var _0x2eb26f={};var _0x568eee={'count':0x0,'rows':[]};return db[_0xa1bb('0x30')]['findOne']({'where':{'id':_0x1cd154[_0xa1bb('0x49')]['id']}})[_0xa1bb('0x14')](handleEntityNotFound(_0x31d194,null))[_0xa1bb('0x14')](function(_0x2bdc3b){if(_0x2bdc3b){_0x2eb26f['model']=_[_0xa1bb('0x36')](db[_0xa1bb('0x5e')][_0xa1bb('0x31')]);_0x2eb26f[_0xa1bb('0x35')]=_['keys'](_0x1cd154['query']);_0x2eb26f[_0xa1bb('0x37')]=_['intersection'](_0x2eb26f[_0xa1bb('0x34')],_0x2eb26f[_0xa1bb('0x35')]);_0xfc7af2['attributes']=_[_0xa1bb('0x38')](_0x2eb26f['model'],qs[_0xa1bb('0x3a')](_0x1cd154[_0xa1bb('0x35')][_0xa1bb('0x3a')]));_0xfc7af2['attributes']=_0xfc7af2[_0xa1bb('0x39')]['length']?_0xfc7af2[_0xa1bb('0x39')]:_0x2eb26f[_0xa1bb('0x34')];if(!_0x1cd154[_0xa1bb('0x35')][_0xa1bb('0x3c')](_0xa1bb('0x3d'))){_0xfc7af2[_0xa1bb('0x20')]=qs[_0xa1bb('0x20')](_0x1cd154[_0xa1bb('0x35')]['limit']);_0xfc7af2['offset']=qs[_0xa1bb('0x23')](_0x1cd154['query']['offset']);}_0xfc7af2['order']=qs[_0xa1bb('0x3f')](_0x1cd154['query'][_0xa1bb('0x3f')]);_0xfc7af2[_0xa1bb('0x40')]=qs[_0xa1bb('0x37')](_[_0xa1bb('0x41')](_0x1cd154['query'],_0x2eb26f['filters']));_0xfc7af2[_0xa1bb('0x40')][_0xa1bb('0x57')]=_0x2bdc3b['id'];if(_0x1cd154[_0xa1bb('0x35')][_0xa1bb('0x42')]){_0xfc7af2[_0xa1bb('0x40')]=_[_0xa1bb('0x43')](_0xfc7af2['where'],{'$or':_['map'](_0xfc7af2[_0xa1bb('0x39')],function(_0x5aafe1){var _0x5e2e84={};_0x5e2e84[_0x5aafe1]={'$like':'%'+_0x1cd154[_0xa1bb('0x35')][_0xa1bb('0x42')]+'%'};return _0x5e2e84;})});}_0xfc7af2=_['merge']({},_0xfc7af2,_0x1cd154[_0xa1bb('0x45')]);return db[_0xa1bb('0x5e')][_0xa1bb('0x22')]({'where':_0xfc7af2[_0xa1bb('0x40')]})[_0xa1bb('0x14')](function(_0xe76c5e){_0x568eee[_0xa1bb('0x22')]=_0xe76c5e;if(_0x1cd154[_0xa1bb('0x35')][_0xa1bb('0x5b')]){_0xfc7af2['include']=[{'all':!![]}];}return db['CannedAnswer'][_0xa1bb('0x46')](_0xfc7af2);})[_0xa1bb('0x14')](function(_0x371395){_0x568eee[_0xa1bb('0x47')]=_0x371395;return _0x568eee;});}})['then'](respondWithFilteredResult(_0x31d194,_0xfc7af2))[_0xa1bb('0x1b')](handleError(_0x31d194,null));};exports[_0xa1bb('0x60')]=function(_0x1a997d,_0x3e2cd0){return db[_0xa1bb('0x30')][_0xa1bb('0x4b')]({'where':{'id':_0x1a997d['params']['id']}})[_0xa1bb('0x14')](handleEntityNotFound(_0x3e2cd0,null))[_0xa1bb('0x14')](function(_0x569c0a){if(_0x569c0a){return _0x569c0a['removeAnswers'](_0x1a997d[_0xa1bb('0x35')][_0xa1bb('0x5c')]);}})[_0xa1bb('0x14')](respondWithStatusCode(_0x3e2cd0,null))[_0xa1bb('0x1b')](handleError(_0x3e2cd0,null));};exports[_0xa1bb('0x61')]=function(_0xc36703,_0x1b5291){_0xc36703[_0xa1bb('0x54')][_0xa1bb('0x62')]=_0xc36703[_0xa1bb('0x63')][_0xa1bb('0x64')];return db[_0xa1bb('0x30')][_0xa1bb('0x4b')]({'where':{'id':_0xc36703[_0xa1bb('0x49')]['id']}})[_0xa1bb('0x14')](handleEntityNotFound(_0x1b5291,null))['then'](saveUpdates(_0xc36703[_0xa1bb('0x54')],null))[_0xa1bb('0x14')](respondWithResult(_0x1b5291,null))[_0xa1bb('0x1b')](handleError(_0x1b5291,null));};exports[_0xa1bb('0x65')]=function(_0xc3e6d4,_0x1dbfe9){_0xc3e6d4[_0xa1bb('0x54')]['agentAvatar']=_0xc3e6d4[_0xa1bb('0x63')][_0xa1bb('0x64')];return db['ChatWebsite']['find']({'where':{'id':_0xc3e6d4[_0xa1bb('0x49')]['id']}})[_0xa1bb('0x14')](handleEntityNotFound(_0x1dbfe9,null))[_0xa1bb('0x14')](saveUpdates(_0xc3e6d4[_0xa1bb('0x54')],null))[_0xa1bb('0x14')](respondWithResult(_0x1dbfe9,null))[_0xa1bb('0x1b')](handleError(_0x1dbfe9,null));};exports[_0xa1bb('0x66')]=function(_0x14a7fb,_0x230747){_0x14a7fb[_0xa1bb('0x54')][_0xa1bb('0x67')]=_0x14a7fb[_0xa1bb('0x63')][_0xa1bb('0x64')];return db[_0xa1bb('0x30')][_0xa1bb('0x4b')]({'where':{'id':_0x14a7fb[_0xa1bb('0x49')]['id']}})[_0xa1bb('0x14')](handleEntityNotFound(_0x230747,null))[_0xa1bb('0x14')](saveUpdates(_0x14a7fb[_0xa1bb('0x54')],null))[_0xa1bb('0x14')](respondWithResult(_0x230747,null))[_0xa1bb('0x1b')](handleError(_0x230747,null));};exports[_0xa1bb('0x68')]=function(_0x3ec5a8,_0x1c228b){_0x3ec5a8[_0xa1bb('0x54')]['systemAvatar']=_0x3ec5a8[_0xa1bb('0x63')][_0xa1bb('0x64')];return db[_0xa1bb('0x30')][_0xa1bb('0x4b')]({'where':{'id':_0x3ec5a8[_0xa1bb('0x49')]['id']}})['then'](handleEntityNotFound(_0x1c228b,null))[_0xa1bb('0x14')](saveUpdates(_0x3ec5a8[_0xa1bb('0x54')],null))['then'](respondWithResult(_0x1c228b,null))[_0xa1bb('0x1b')](handleError(_0x1c228b,null));};exports['getLogo']=function(_0xbf1907,_0x5c9fca){var _0x1b1190=path[_0xa1bb('0x69')](config['root'],_0xa1bb('0x6a'));var _0x36b2da={'where':{'id':_0xbf1907['params']['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x22f2f1=![];return require(_0xa1bb('0x6b'))[_0xa1bb('0x6c')]()['then'](function(_0x445793){if(_0x445793){_0x22f2f1=_0x445793['custom'];}})[_0xa1bb('0x14')](function(){return db[_0xa1bb('0x30')][_0xa1bb('0x4b')](_0x36b2da);})['then'](handleEntityNotFound(_0x5c9fca,null))[_0xa1bb('0x14')](function(_0x31c05c){if(_0x31c05c){if(!_[_0xa1bb('0x6d')](_0x31c05c[_0xa1bb('0x62')])){if(fs[_0xa1bb('0x6e')](path[_0xa1bb('0x69')](config['root'],_0xa1bb('0x6f'),_0x31c05c[_0xa1bb('0x62')]))&&_0x22f2f1){_0x1b1190=path[_0xa1bb('0x69')](config[_0xa1bb('0x70')],_0xa1bb('0x6f'),_0x31c05c[_0xa1bb('0x62')]);}}return _0x5c9fca[_0xa1bb('0x71')](_0x1b1190);}})[_0xa1bb('0x1b')](handleError(_0x5c9fca,null));};exports[_0xa1bb('0x72')]=function(_0x2395f3,_0x2f3ad4){var _0x4e8c16=path[_0xa1bb('0x69')](config[_0xa1bb('0x70')],_0xa1bb('0x73'));var _0x58dd83={'where':{'id':_0x2395f3[_0xa1bb('0x49')]['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db[_0xa1bb('0x30')]['find'](_0x58dd83)[_0xa1bb('0x14')](handleEntityNotFound(_0x2f3ad4,null))['then'](function(_0x73d84d){if(_0x73d84d){if(!_[_0xa1bb('0x6d')](_0x73d84d['agentAvatar'])){if(fs[_0xa1bb('0x6e')](path['join'](config['root'],_0xa1bb('0x74'),_0x73d84d['agentAvatar']))){_0x4e8c16=path[_0xa1bb('0x69')](config[_0xa1bb('0x70')],'server/files/images/avatars/',_0x73d84d[_0xa1bb('0x75')]);}}return _0x2f3ad4[_0xa1bb('0x71')](_0x4e8c16);}})[_0xa1bb('0x1b')](handleError(_0x2f3ad4,null));};exports[_0xa1bb('0x76')]=function(_0x7002f1,_0x846db2){var _0x2cf322=path[_0xa1bb('0x69')](config[_0xa1bb('0x70')],_0xa1bb('0x77'));var _0x1c14a9={'where':{'id':_0x7002f1[_0xa1bb('0x49')]['id']},'attributes':['id',_0xa1bb('0x67'),'showCustomerAvatar'],'raw':!![]};return db[_0xa1bb('0x30')]['find'](_0x1c14a9)[_0xa1bb('0x14')](handleEntityNotFound(_0x846db2,null))[_0xa1bb('0x14')](function(_0x3a0bcc){if(_0x3a0bcc){if(!_[_0xa1bb('0x6d')](_0x3a0bcc[_0xa1bb('0x67')])){if(fs[_0xa1bb('0x6e')](path[_0xa1bb('0x69')](config[_0xa1bb('0x70')],_0xa1bb('0x74'),_0x3a0bcc[_0xa1bb('0x67')]))&&_0x3a0bcc['showCustomerAvatar']){_0x2cf322=path[_0xa1bb('0x69')](config[_0xa1bb('0x70')],_0xa1bb('0x74'),_0x3a0bcc['customerAvatar']);}}return _0x846db2['download'](_0x2cf322);}})[_0xa1bb('0x1b')](handleError(_0x846db2,null));};exports[_0xa1bb('0x78')]=function(_0x34dcbc,_0x22aea5){var _0xcb1ddf=path['join'](config[_0xa1bb('0x70')],'server/files/images/avatars/system_avatar.png');var _0x35dbac={'where':{'id':_0x34dcbc[_0xa1bb('0x49')]['id']},'attributes':['id',_0xa1bb('0x79')],'raw':!![]};return db[_0xa1bb('0x30')][_0xa1bb('0x4b')](_0x35dbac)[_0xa1bb('0x14')](handleEntityNotFound(_0x22aea5,null))[_0xa1bb('0x14')](function(_0x25ce1c){if(_0x25ce1c){if(!_[_0xa1bb('0x6d')](_0x25ce1c[_0xa1bb('0x79')])){if(fs[_0xa1bb('0x6e')](path[_0xa1bb('0x69')](config[_0xa1bb('0x70')],_0xa1bb('0x74'),_0x25ce1c[_0xa1bb('0x79')]))){_0xcb1ddf=path[_0xa1bb('0x69')](config[_0xa1bb('0x70')],_0xa1bb('0x74'),_0x25ce1c[_0xa1bb('0x79')]);}}return _0x22aea5[_0xa1bb('0x71')](_0xcb1ddf);}})['catch'](handleError(_0x22aea5,null));};exports[_0xa1bb('0x7a')]=function(_0x101dd2,_0x3d3960){var _0x1ac102=require(_0xa1bb('0x7b'));var _0x18914e=new _0x1ac102();var _0x5cb209=_0x18914e[_0xa1bb('0x7c')](_0x101dd2[_0xa1bb('0x7d')][_0xa1bb('0x7e')])[_0xa1bb('0x7f')]();var _0x1278ef={'body':_0x101dd2[_0xa1bb('0x54')],'channel':'chat'};var _0x52ffe9=[];var _0x37db36=[];var _0x189287={};var _0x58e581=![];return db[_0xa1bb('0x80')][_0xa1bb('0x55')]()[_0xa1bb('0x14')](function(_0x4b3dfd){if(!_0x4b3dfd){throw new db[(_0xa1bb('0x81'))][(_0xa1bb('0x82'))](_0xa1bb('0x83'));}_0x52ffe9=_['difference'](_[_0xa1bb('0x36')](_0x4b3dfd),['createdAt',_0xa1bb('0x84')]);_0x37db36=_[_0xa1bb('0x85')](_['keys'](_0x4b3dfd),[_0xa1bb('0x86'),_0xa1bb('0x84'),_0xa1bb('0x87'),_0xa1bb('0x88')]);if(_0x101dd2[_0xa1bb('0x54')]['id']){delete _0x101dd2[_0xa1bb('0x54')]['id'];}if(_[_0xa1bb('0x6d')](_0x101dd2[_0xa1bb('0x54')][_0xa1bb('0x89')])){throw new db[(_0xa1bb('0x81'))][(_0xa1bb('0x82'))](_0xa1bb('0x8a'));}if(_[_0xa1bb('0x6d')](_0x101dd2[_0xa1bb('0x54')][_0xa1bb('0x54')])||_0x101dd2['body'][_0xa1bb('0x54')]===''){throw new db['Sequelize']['ValidationError'](_0xa1bb('0x8b'));}if(_[_0xa1bb('0x6d')](_0x101dd2[_0xa1bb('0x54')]['mapKey'])){throw new db[(_0xa1bb('0x81'))]['ValidationError'](_0xa1bb('0x8c')+_0x37db36);}if(!_[_0xa1bb('0x8d')](_0x37db36,_0x101dd2['body'][_0xa1bb('0x8e')])){throw new db[(_0xa1bb('0x81'))][(_0xa1bb('0x82'))](_0xa1bb('0x8f')+_0x37db36);}_0x189287[_0x101dd2[_0xa1bb('0x54')][_0xa1bb('0x8e')]]=_0x101dd2['body'][_0xa1bb('0x89')];})[_0xa1bb('0x14')](function(){return db['ChatWebsite'][_0xa1bb('0x4b')]({'where':{'id':_0x101dd2[_0xa1bb('0x49')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0xa1bb('0x80')],'as':_0xa1bb('0x90'),'where':_0x189287,'limit':0x1,'order':[[_0xa1bb('0x84'),'DESC']]}]},{'model':db[_0xa1bb('0x91')],'as':'Applications'}]});})['then'](handleEntityNotFound(_0x3d3960,null))[_0xa1bb('0x14')](function(_0x9fea7c){if(_0x9fea7c&&_0x9fea7c[_0xa1bb('0x92')]){_0x1278ef[_0xa1bb('0x93')]=_0x9fea7c;_0x1278ef[_0xa1bb('0x94')]=_0x9fea7c['Applications'];_0x1278ef[_0xa1bb('0x95')]=_0x9fea7c[_0xa1bb('0x92')];_0x1278ef[_0xa1bb('0x94')]=_[_0xa1bb('0x96')](_0x1278ef[_0xa1bb('0x94')],['priority'],['asc']);if(_0x1278ef['account'][_0xa1bb('0x97')]){delete _0x1278ef[_0xa1bb('0x93')][_0xa1bb('0x97')];}if(_0x1278ef[_0xa1bb('0x93')]['List']&&_0x1278ef[_0xa1bb('0x93')][_0xa1bb('0x92')][_0xa1bb('0x90')]['length']){return _0x1278ef[_0xa1bb('0x93')]['List'][_0xa1bb('0x90')][0x0];}var _0x56436b=_[_0xa1bb('0xc')](_0x101dd2['body'],{'firstName':_0x101dd2['body'][_0xa1bb('0x89')],'ListId':_0x9fea7c[_0xa1bb('0x88')]});_0x56436b[_0x101dd2[_0xa1bb('0x54')]['mapKey']]=_0x101dd2[_0xa1bb('0x54')][_0xa1bb('0x89')];return db['CmContact'][_0xa1bb('0x4c')](_0x56436b,{'fields':_0x52ffe9,'raw':!![]});}})[_0xa1bb('0x14')](handleEntityNotFound(_0x3d3960,null))[_0xa1bb('0x14')](function(_0x5bc3e7){_0x1278ef['contact']=_0x5bc3e7;var _0x45f683=_0x101dd2[_0xa1bb('0x54')]['customerIp'];if(_0x101dd2[_0xa1bb('0x7d')]['cf-connecting-ip']){_0x45f683=_0x101dd2[_0xa1bb('0x7d')][_0xa1bb('0x98')];}else if(_0x101dd2['headers'][_0xa1bb('0x99')]){_0x45f683=_[_0xa1bb('0x9a')](_0x101dd2[_0xa1bb('0x7d')]['x-forwarded-for'][_0xa1bb('0x9b')](','));}if(_0x5bc3e7){var _0xdc17fd={'ContactId':_0x5bc3e7['id'],'ChatWebsiteId':_0x101dd2[_0xa1bb('0x49')]['id'],'from':(_0x5bc3e7[_0xa1bb('0x9c')]||'')+'\x20'+(_0x5bc3e7[_0xa1bb('0x9d')]||''),'customerIp':_0x45f683,'customerPort':_0x101dd2['headers']['x-real-port']?_0x101dd2[_0xa1bb('0x7d')]['x-real-port']:null,'referer':_0x101dd2[_0xa1bb('0x54')]['referer'],'browserName':_0x5cb209[_0xa1bb('0x9e')][_0xa1bb('0x2b')]&&_0x5cb209[_0xa1bb('0x9e')][_0xa1bb('0x9f')]?util[_0xa1bb('0xa0')](_0xa1bb('0xa1'),_0x5cb209[_0xa1bb('0x9e')][_0xa1bb('0x2b')],_0x5cb209['browser'][_0xa1bb('0x9f')]):_0xa1bb('0xa2'),'browserVersion':_0x5cb209[_0xa1bb('0x9e')][_0xa1bb('0x9f')]||'unknown','osName':util[_0xa1bb('0xa0')]('%s\x20%s',_0x5cb209['os'][_0xa1bb('0x2b')],_0x5cb209['os']['version']),'osVersion':_0x5cb209['os'][_0xa1bb('0x9f')],'deviceModel':_0x5cb209[_0xa1bb('0xa3')]['model']&&_0x5cb209[_0xa1bb('0xa3')][_0xa1bb('0xa4')]?util[_0xa1bb('0xa0')](_0xa1bb('0xa5'),_0x5cb209[_0xa1bb('0xa3')][_0xa1bb('0x34')],_0x5cb209['device']['vendor'],_0x5cb209[_0xa1bb('0xa3')]['type']):null,'deviceVendor':_0x5cb209[_0xa1bb('0xa3')]['vendor'],'deviceType':_0x5cb209[_0xa1bb('0xa3')][_0xa1bb('0x32')],'formData':JSON[_0xa1bb('0x17')](_0x101dd2[_0xa1bb('0x54')])};var _0x3b569d={'ChatWebsiteId':_0x101dd2['params']['id'],'closed':![]};if(_0x101dd2['body'][_0xa1bb('0xa6')]){_0x3b569d[_0xa1bb('0xa6')]=_0x101dd2[_0xa1bb('0x54')][_0xa1bb('0xa6')];return db[_0xa1bb('0xa7')][_0xa1bb('0x4b')]({'where':_0x3b569d})[_0xa1bb('0x14')](function(_0x1e538b){if(_0x1e538b){return[_0x1e538b,![]];}_0xdc17fd['threadId']=_0x101dd2[_0xa1bb('0x54')]['threadId'];_0xdc17fd[_0xa1bb('0xa8')]=_0x101dd2[_0xa1bb('0x54')][_0xa1bb('0xa8')];return db[_0xa1bb('0xa7')][_0xa1bb('0x4c')](_0xdc17fd)['then'](function(_0x54fc90){return[_0x54fc90,!![]];});});}_0x3b569d[_0xa1bb('0xa9')]=_0x5bc3e7['id'];if(_0x101dd2[_0xa1bb('0x54')][_0xa1bb('0xaa')]&&_0x101dd2[_0xa1bb('0x54')]['interaction']['id']){_0x3b569d['id']=_0x101dd2[_0xa1bb('0x54')]['interaction']['id'];return db[_0xa1bb('0xa7')]['find']({'where':_0x3b569d})[_0xa1bb('0x14')](function(_0x720f0e){if(_0x720f0e){return[_0x720f0e,![]];}return db['ChatInteraction']['create'](_0xdc17fd)[_0xa1bb('0x14')](function(_0x464284){return[_0x464284,!![]];});});}return db[_0xa1bb('0xa7')][_0xa1bb('0x4c')](_0xdc17fd)[_0xa1bb('0x14')](function(_0x4bf734){return[_0x4bf734,!![]];});}})['spread'](function(_0xdcf6b1,_0x2a38ec){if(_0xdcf6b1){_0x58e581=_0x2a38ec;if(!_0x2a38ec){var _0x3af66d={'from':(_0x1278ef['contact'][_0xa1bb('0x9c')]||'')+'\x20'+(_0x1278ef[_0xa1bb('0xab')][_0xa1bb('0x9d')]||'')};if(_0x101dd2[_0xa1bb('0x54')][_0xa1bb('0xa6')]&&_0x101dd2['body'][_0xa1bb('0xac')]&&_0x101dd2[_0xa1bb('0x54')]['threadId']!=_0x101dd2['body'][_0xa1bb('0xac')]){_0x3af66d[_0xa1bb('0xa6')]=_0x101dd2[_0xa1bb('0x54')]['messageId'];}return _0xdcf6b1['update'](_0x3af66d);}else{return _0xdcf6b1;}}})[_0xa1bb('0x14')](function(_0x197f46){_0x1278ef[_0xa1bb('0xaa')]=_0x197f46[_0xa1bb('0x4e')]({'plain':!![]});_0x1278ef[_0xa1bb('0xaa')]['created']=_0x58e581;if(_0x1278ef[_0xa1bb('0xaa')][_0xa1bb('0xad')]){if(_0x1278ef[_0xa1bb('0x93')]['autoclose']){_0x1278ef['applications']['push']({'id':0x0,'priority':_0x1278ef[_0xa1bb('0x94')][_0xa1bb('0x3b')]+0x1,'app':_0xa1bb('0xae'),'appdata':_0xa1bb('0xaf'),'interval':'*,*,*,*'});}}return db[_0xa1bb('0xb0')][_0xa1bb('0x4c')]({'body':_0x101dd2['body'][_0xa1bb('0x54')],'ChatWebsiteId':_0x101dd2[_0xa1bb('0x49')]['id'],'ChatInteractionId':_0x197f46['id'],'direction':'in','ContactId':_0x1278ef[_0xa1bb('0xab')]['id'],'AttachmentId':_0x101dd2['body'][_0xa1bb('0xb1')]});})[_0xa1bb('0x14')](function(_0x419834){_0x1278ef[_0xa1bb('0x1a')]=_0x419834;if(_0x1278ef[_0xa1bb('0xaa')][_0xa1bb('0xb2')]){return db[_0xa1bb('0xb3')][_0xa1bb('0x4b')]({'attributes':['id',_0xa1bb('0x2b')],'where':{'id':_0x1278ef['interaction'][_0xa1bb('0xb2')]}})['then'](function(_0x39f9c0){if(_0x39f9c0){_0x1278ef['applications'][_0xa1bb('0xb4')]({'id':0x0,'priority':0x0,'app':_0xa1bb('0xb5'),'appdata':_0x39f9c0[_0xa1bb('0x2b')]+','+(_0x1278ef[_0xa1bb('0x93')]['waitForTheAssignedAgent']||0xa),'interval':_0xa1bb('0xb6')});_0x1278ef['forcedOwnership']=!![];}return respondWithRpcPromise(_0xa1bb('0xb7'),_0xa1bb('0xb8'),_0x1278ef);});}return respondWithRpcPromise(_0xa1bb('0xb7'),_0xa1bb('0xb8'),_0x1278ef);})[_0xa1bb('0x14')](function(_0x493cf4){respondWithRpcPromise(_0xa1bb('0xb9'),_0xa1bb('0xb9'),{'event':_0xa1bb('0x7a'),'message':_0x493cf4},client9002);return _0x493cf4;})[_0xa1bb('0x14')](respondWithResult(_0x3d3960,null))['catch'](handleError(_0x3d3960,null));};exports[_0xa1bb('0xba')]=function(_0x5861fc,_0x280ea5){var _0x4ec86c,_0x22f860,_0x57ff70;var _0x202d45=[];var _0x1097b3={};var _0x26467d=_0x5861fc['files']||[];var _0x279251=[];var _0x547fd5;return db[_0xa1bb('0x80')]['describe']()[_0xa1bb('0x14')](function(_0x5b6b23){if(!_0x5b6b23){throw new db[(_0xa1bb('0x81'))][(_0xa1bb('0x82'))]('no\x20available\x20attributes');}_0x202d45=_[_0xa1bb('0x85')](_[_0xa1bb('0x36')](_0x5b6b23),[_0xa1bb('0x86'),_0xa1bb('0x84'),_0xa1bb('0x87'),_0xa1bb('0x88')]);if(_0x5861fc[_0xa1bb('0x54')]['id']){delete _0x5861fc[_0xa1bb('0x54')]['id'];}if(_[_0xa1bb('0x6d')](_0x5861fc[_0xa1bb('0x54')][_0xa1bb('0x89')])){throw _0x280ea5['status'](0x1f4)[_0xa1bb('0xbb')](new db[(_0xa1bb('0x81'))]['ValidationError'](_0xa1bb('0x8a')));}if(_[_0xa1bb('0x6d')](_0x5861fc[_0xa1bb('0x54')]['body'])||_0x5861fc[_0xa1bb('0x54')][_0xa1bb('0x54')]===''){throw _0x280ea5[_0xa1bb('0x1d')](0x1f4)[_0xa1bb('0xbb')](new db[(_0xa1bb('0x81'))][(_0xa1bb('0x82'))](_0xa1bb('0x8b')));}if(_[_0xa1bb('0x6d')](_0x5861fc[_0xa1bb('0x54')][_0xa1bb('0xbc')])){throw _0x280ea5[_0xa1bb('0x1d')](0x1f4)[_0xa1bb('0xbb')](new db[(_0xa1bb('0x81'))][(_0xa1bb('0x82'))](_0xa1bb('0xbd')+_0x202d45));}if(!_[_0xa1bb('0x8d')](_0x202d45,_0x5861fc[_0xa1bb('0x54')][_0xa1bb('0xbc')])){throw _0x280ea5[_0xa1bb('0x1d')](0x1f4)[_0xa1bb('0xbb')](new db[(_0xa1bb('0x81'))]['ValidationError'](_0xa1bb('0xbe')+_0x202d45));}_0x1097b3[_0x5861fc[_0xa1bb('0x54')][_0xa1bb('0xbc')]]=_0x5861fc[_0xa1bb('0x54')][_0xa1bb('0x89')];})[_0xa1bb('0x14')](function(){return db['ChatWebsite']['find']({'where':{'id':_0x5861fc['params']['id']},'include':[{'model':db['CmList'],'as':_0xa1bb('0x92')},{'model':db[_0xa1bb('0xbf')],'as':_0xa1bb('0xbf')}]});})[_0xa1bb('0x14')](handleEntityNotFound(_0x280ea5,null))[_0xa1bb('0x14')](function(_0x9cb91a){if(_0x9cb91a&&_0x9cb91a['List']){_0x22f860=_0x9cb91a;var _0x142c5e=_[_0xa1bb('0xc')](_0x5861fc[_0xa1bb('0x54')],{'firstName':_0x5861fc['body'][_0xa1bb('0x89')],'phone':_0x5861fc[_0xa1bb('0x54')][_0xa1bb('0x89')],'ListId':_0x9cb91a[_0xa1bb('0x88')]});_0x142c5e[_0x5861fc['body']['mapKeyOffline']]=_0x5861fc[_0xa1bb('0x54')][_0xa1bb('0x89')];return db[_0xa1bb('0x80')]['findOrCreate']({'where':_0x1097b3,'defaults':_0x142c5e});}})[_0xa1bb('0xc0')](function(_0x925abd){if(_0x925abd){_0x57ff70=_0x925abd;var _0x3b3c0e=fs[_0xa1bb('0xc1')](path[_0xa1bb('0x69')](config[_0xa1bb('0x70')],_0xa1bb('0xc2')),'utf8');var _0x98d18=ejs['render'](_0x3b3c0e,{'body':_['toPairs'](_0x5861fc[_0xa1bb('0x54')][_0xa1bb('0x54')]),'bodyTitle':_0x22f860['offlineMessageBody']});return db[_0xa1bb('0xc3')][_0xa1bb('0x4c')]({'body':_0x98d18,'ContactId':_0x925abd['id'],'ChatWebsiteId':_0x22f860['id']});}})['then'](function(_0x3dad94){_0x547fd5=_0x3dad94;if(_0x26467d['length']){var _0x410a67=_0x26467d['map'](function(_0x3cef6d){return{'name':_0x3cef6d[_0xa1bb('0xc4')],'basename':_0x3cef6d[_0xa1bb('0x64')],'type':_0x3cef6d[_0xa1bb('0xc5')],'ChatOfflineMessageId':_0x3dad94['id']};});_0x279251=_0x410a67[_0xa1bb('0x2f')](_0x19b659=>{var _0xaf77cc={'filename':_0x19b659[_0xa1bb('0x2b')],'path':path[_0xa1bb('0x69')](config[_0xa1bb('0x70')],_0xa1bb('0xc6'),_0xa1bb('0xc7'),'attachments',_0xa1bb('0xc8'),_0x19b659['basename'])};return _0xaf77cc;});if(!_0x22f860[_0xa1bb('0xc9')]){return db['sequelize']['transaction'](function(_0x3542b6){return db['Attachment'][_0xa1bb('0xca')](_0x410a67,{'transaction':_0x3542b6});});}}})[_0xa1bb('0x14')](function(){if(_0x547fd5){_0x4ec86c=_0x547fd5;return db[_0xa1bb('0xbf')]['findOne']({'where':{'active':!![]},'include':[{'model':db[_0xa1bb('0xcb')],'as':_0xa1bb('0xcc'),'raw':!![]}]});}})[_0xa1bb('0x14')](function(_0x5c0a1c){if(_0x5c0a1c&&_0x5c0a1c[_0xa1bb('0xcc')]&&_0x22f860[_0xa1bb('0xcd')]&&_0x22f860[_0xa1bb('0xce')]){var _0x3007df={'tls':{'rejectUnauthorized':![]}};if(_0x5c0a1c['Smtp'][_0xa1bb('0xcf')]){_0x3007df[_0xa1bb('0xcf')]=_0x5c0a1c[_0xa1bb('0xcc')]['service'];}else{_0x3007df[_0xa1bb('0xd0')]=_0x5c0a1c[_0xa1bb('0xcc')][_0xa1bb('0xd0')];_0x3007df[_0xa1bb('0xd1')]=_0x5c0a1c[_0xa1bb('0xcc')][_0xa1bb('0xd1')];_0x3007df[_0xa1bb('0xd2')]=_0x5c0a1c[_0xa1bb('0xcc')][_0xa1bb('0xd2')];}if(_0x5c0a1c[_0xa1bb('0xcc')][_0xa1bb('0xd3')]){_0x3007df[_0xa1bb('0xd4')]={'user':_0x5c0a1c['Smtp'][_0xa1bb('0x4d')],'pass':_0x5c0a1c[_0xa1bb('0xcc')][_0xa1bb('0xd5')]};}return respondWithRpcPromise(_0xa1bb('0xd6'),_0xa1bb('0xd7'),{'account':_0x3007df,'message':{'from':util[_0xa1bb('0xa0')](_0xa1bb('0xd8'),_0x5c0a1c[_0xa1bb('0x2b')],_0x5c0a1c['email']||_0x5c0a1c['Smtp']['user']),'to':_0x22f860[_0xa1bb('0xce')],'subject':_0x22f860['offlineMessageSubject'],'html':_0x4ec86c[_0xa1bb('0x54')],'attachments':_0x279251}},client9003)['then'](function(){return _0x4ec86c;})['catch'](function(_0x360fb5){console[_0xa1bb('0x18')](_0x360fb5);});}})[_0xa1bb('0x14')](function(){if(_0x22f860&&_0x22f860['openNewInteraction']&&_0x22f860[_0xa1bb('0xd9')]){var _0x59d081=[];if(_0x26467d[_0xa1bb('0x3b')]){_0x59d081=_0x26467d[_0xa1bb('0x2f')](function(_0xbb4f0a){return{'name':_0xbb4f0a[_0xa1bb('0xc4')],'basename':_0xbb4f0a[_0xa1bb('0x64')],'type':_0xbb4f0a[_0xa1bb('0xc5')],'ChatOfflineMessageId':_0x547fd5['id']};});}var _0x2a907b;if(!_[_0xa1bb('0x6d')](_0x22f860[_0xa1bb('0xda')])){var _0x199bb6=_[_0xa1bb('0x2f')](_0x5861fc[_0xa1bb('0x54')],function(_0x93fa9b){return _0x93fa9b;});var _0x970934=_['toPairsIn'](_0x199bb6)[0x0];var _0x3a8e05=_[_0xa1bb('0xdb')](_0x970934,function(_0xf9684){return _0xf9684;});_0x2a907b=_0x3a8e05[0x1][_0x22f860[_0xa1bb('0xda')]];}var _0x5d00b9={'from':_0x57ff70['email'],'firstName':_0x57ff70[_0xa1bb('0x9c')],'lastName':_0x57ff70['lastName'],'mapKey':_0xa1bb('0xdc'),'message':{'from':_0x57ff70[_0xa1bb('0xdc')],'to':_0x22f860[_0xa1bb('0xbf')][_0xa1bb('0xdc')],'cc':'','subject':_['isNil'](_0x2a907b)?_0x22f860[_0xa1bb('0xdd')]:_0x2a907b,'messageId':'','sentAt':new Date(),'attach':_0x59d081[_0xa1bb('0x3b')],'attachments':_0x59d081,'originChannel':'Chat','ChatWebsiteId':_0x22f860['id'],'ChatOfflineMessageId':_0x4ec86c['id'],'originTo':_0x22f860['MailAccount'][_0xa1bb('0xdc')]},'body':_0x4ec86c[_0xa1bb('0x54')]};var _0x6ec0f1={'account':{'id':_0x22f860['MailAccountId']},'body':_0x5d00b9,'log':_0xa1bb('0xde')};return respondWithRpcPromise(_0xa1bb('0xde'),_0xa1bb('0xdf'),_0x6ec0f1,client9001)[_0xa1bb('0x14')](function(){return _0x4ec86c;})['catch'](function(_0x42c12e){console[_0xa1bb('0x18')](_0x42c12e);});}return;})['then'](function(){if(_0x4ec86c){return _0x4ec86c;}})[_0xa1bb('0x14')](respondWithResult(_0x280ea5,null))[_0xa1bb('0x1b')](function(_0x5b6cb7){console[_0xa1bb('0x18')]('catch',_0x5b6cb7);for(var _0x4b1b3a of _0x26467d){var _0x2642af=path['join'](config['root'],_0xa1bb('0xc6'),'files',_0xa1bb('0xe0'),_0xa1bb('0xc8'),_0x4b1b3a[_0xa1bb('0x64')]);fs_extra[_0xa1bb('0xe1')](_0x2642af)[_0xa1bb('0x1b')](function(_0x2f0d3b){console['error']('Could\x20not\x20remove\x20attachment\x20file',_0x2642af,_0x2f0d3b);});}});};exports['addInteraction']=function(_0x23d6bc,_0x32699f){return db[_0xa1bb('0xa7')]['find']({'where':{'id':_0x23d6bc['params']['id']}})[_0xa1bb('0x14')](handleEntityNotFound(_0x32699f,null))[_0xa1bb('0x14')](function(_0xa8b215){if(_0xa8b215){return _0xa8b215[_0xa1bb('0xe2')](_0x23d6bc[_0xa1bb('0x54')][_0xa1bb('0x5c')],_[_0xa1bb('0xe3')](_0x23d6bc[_0xa1bb('0x54')],['ids','id'])||{});}})['then'](respondWithResult(_0x32699f,null))[_0xa1bb('0x1b')](handleError(_0x32699f,null));};exports[_0xa1bb('0xe4')]=function(_0x3ae2fb,_0x48b6fb){var _0x4c9c97={'raw':![],'where':{}};var _0x180104={};var _0x309b1f={'count':0x0,'rows':[]};return db[_0xa1bb('0x30')][_0xa1bb('0x5a')]({'where':{'id':_0x3ae2fb[_0xa1bb('0x49')]['id']}})['then'](handleEntityNotFound(_0x48b6fb,null))[_0xa1bb('0x14')](function(_0x721c4d){if(_0x721c4d){_0x180104['model']=_[_0xa1bb('0x36')](db[_0xa1bb('0xa7')]['rawAttributes']);_0x180104[_0xa1bb('0x35')]=_[_0xa1bb('0x36')](_0x3ae2fb[_0xa1bb('0x35')]);_0x180104[_0xa1bb('0x37')]=_['intersection'](_0x180104[_0xa1bb('0x34')],_0x180104[_0xa1bb('0x35')]);_0x4c9c97[_0xa1bb('0x39')]=_['intersection'](_0x180104['model'],qs[_0xa1bb('0x3a')](_0x3ae2fb[_0xa1bb('0x35')][_0xa1bb('0x3a')]));_0x4c9c97[_0xa1bb('0x39')]=_0x4c9c97[_0xa1bb('0x39')]['length']?_0x4c9c97[_0xa1bb('0x39')]:_0x180104[_0xa1bb('0x34')];if(!_0x3ae2fb[_0xa1bb('0x35')][_0xa1bb('0x3c')](_0xa1bb('0x3d'))){_0x4c9c97[_0xa1bb('0x20')]=qs[_0xa1bb('0x20')](_0x3ae2fb[_0xa1bb('0x35')]['limit']);_0x4c9c97[_0xa1bb('0x23')]=qs[_0xa1bb('0x23')](_0x3ae2fb[_0xa1bb('0x35')][_0xa1bb('0x23')]);}_0x4c9c97[_0xa1bb('0x3e')]=qs[_0xa1bb('0x3f')](_0x3ae2fb[_0xa1bb('0x35')][_0xa1bb('0x3f')]);_0x4c9c97['where']=qs[_0xa1bb('0x37')](_['pick'](_0x3ae2fb[_0xa1bb('0x35')],_0x180104[_0xa1bb('0x37')]));_0x4c9c97[_0xa1bb('0x40')][_0xa1bb('0x57')]=_0x721c4d['id'];if(_0x3ae2fb[_0xa1bb('0x35')]['filter']){_0x4c9c97[_0xa1bb('0x40')]=_['merge'](_0x4c9c97['where'],{'$or':_[_0xa1bb('0x2f')](_0x4c9c97[_0xa1bb('0x39')],function(_0x2882a1){var _0x36ab87={};_0x36ab87[_0x2882a1]={'$like':'%'+_0x3ae2fb[_0xa1bb('0x35')]['filter']+'%'};return _0x36ab87;})});}_0x4c9c97=_[_0xa1bb('0x43')]({},_0x4c9c97,_0x3ae2fb['options']);return db[_0xa1bb('0xa7')]['count']({'where':_0x4c9c97[_0xa1bb('0x40')]})[_0xa1bb('0x14')](function(_0x43f991){_0x309b1f[_0xa1bb('0x22')]=_0x43f991;if(_0x3ae2fb['query'][_0xa1bb('0x5b')]){_0x4c9c97['include']=[{'model':db[_0xa1bb('0x80')],'as':_0xa1bb('0xe5'),'required':![]},{'model':db[_0xa1bb('0xb3')],'as':_0xa1bb('0xe6'),'attributes':[_0xa1bb('0x2b'),_0xa1bb('0xe7'),_0xa1bb('0xe8')],'required':![]},{'model':db[_0xa1bb('0xe9')],'as':_0xa1bb('0xea'),'attributes':['id',_0xa1bb('0x2b'),_0xa1bb('0xeb')],'where':_0x3ae2fb[_0xa1bb('0x35')]['tag']?{'id':_0x3ae2fb[_0xa1bb('0x35')]['tag']}:undefined,'required':_0x3ae2fb[_0xa1bb('0x35')][_0xa1bb('0xec')]?!![]:![]}];}return db[_0xa1bb('0xa7')][_0xa1bb('0x46')](_0x4c9c97);})[_0xa1bb('0x14')](function(_0x5f2990){_0x309b1f[_0xa1bb('0x47')]=_0x5f2990;return _0x309b1f;});}})[_0xa1bb('0x14')](respondWithFilteredResult(_0x48b6fb,_0x4c9c97))[_0xa1bb('0x1b')](handleError(_0x48b6fb,null));};function iftimePromise(_0x3ee4dc,_0x185ebd){return respondWithRpcPromise(_0xa1bb('0xed'),_0xa1bb('0xee'),{'command':_0x185ebd[_0xa1bb('0xef')]?util['format'](_0xa1bb('0xf0'),_0x3ee4dc[_0xa1bb('0xf1')],_0x185ebd['timezone']):util['format'](_0xa1bb('0xf2'),_0x3ee4dc[_0xa1bb('0xf1')])},client9002)[_0xa1bb('0x14')](function(_0xe179f4){var _0x828604=_0xe179f4&&_0xe179f4[_0xa1bb('0xf3')]('true')>=0x0?!![]:![];logger['info'](_0xa1bb('0xf4'),_0x185ebd['id'],_0x3ee4dc['id'],_0x3ee4dc[_0xa1bb('0xf1')],_0x828604?_0xa1bb('0xf5'):_0xa1bb('0xf6'),_0x185ebd[_0xa1bb('0xef')]?_0x185ebd['timezone']:_0xa1bb('0xf7'));return _0x828604;})[_0xa1bb('0x1b')](function(_0x20772e){logger[_0xa1bb('0x18')](_0xa1bb('0xf4'),_0x185ebd['id'],_0x3ee4dc['id'],_0x3ee4dc[_0xa1bb('0xf1')],util['inspect'](_0x20772e,{'showHidden':![],'depth':null}),_0x185ebd['timezone']?_0x185ebd[_0xa1bb('0xef')]:_0xa1bb('0xf7'));return![];});}exports['getSnippet']=function(_0x39a100,_0x2eece2){var _0x3e854f=0x0;var _0x5ec8be=0x0;var _0x253c59=![];var _0x462624;var _0xd5e599;return db[_0xa1bb('0x30')][_0xa1bb('0x4b')]({'where':{'id':_0x39a100[_0xa1bb('0x49')]['id']},'include':[{'model':db[_0xa1bb('0xf8')],'as':_0xa1bb('0xf8'),'include':[{'model':db[_0xa1bb('0xf8')],'as':'Intervals','attributes':['id',_0xa1bb('0xf1')],'raw':!![]}]}]})[_0xa1bb('0x14')](handleEntityNotFound(_0x2eece2,null))[_0xa1bb('0x14')](function(_0xe80f6a){if(_0xe80f6a){_0x462624=_0xe80f6a;return _0xe80f6a[_0xa1bb('0xf9')]({'raw':!![]});}})[_0xa1bb('0x14')](function(_0x43d027){if(_0x462624){if(_0x43d027){_0xd5e599=_0x43d027;}}return require('../../config/license/util')[_0xa1bb('0x6c')]();})[_0xa1bb('0x14')](function(_0x516f30){if(_0x516f30){_0x5ec8be=_0x516f30[_0xa1bb('0xfa')];_0x253c59=_0x516f30[_0xa1bb('0xfb')];}})[_0xa1bb('0x14')](function(){return db[_0xa1bb('0xa7')][_0xa1bb('0x22')]({'where':{'closed':![]}});})[_0xa1bb('0x14')](function(_0x212566){_0x3e854f=_0x212566;if(_0x5ec8be&&_0x212566>_0x5ec8be){return db[_0xa1bb('0xfc')]['findOne']({'where':{'id':0x1}})[_0xa1bb('0x14')](function(_0x4e03b9){if(_0x4e03b9){_0x4e03b9[_0xa1bb('0xfd')](_0xa1bb('0xfe'));}});}})[_0xa1bb('0x14')](function(){if(_0x462624[_0xa1bb('0xf8')]&&_0x462624['Interval'][_0xa1bb('0xff')]){var _0x434b3b=[];for(var _0x9d74f6=0x0;_0x9d74f6<_0x462624[_0xa1bb('0xf8')][_0xa1bb('0xff')][_0xa1bb('0x3b')];_0x9d74f6++){var _0x1cdc15=_0x462624['Interval'][_0xa1bb('0xff')][_0x9d74f6][_0xa1bb('0x4e')]({'plain':!![]});_0x434b3b[_0xa1bb('0x100')](iftimePromise(_0x1cdc15,_0x462624));}return BPromise['all'](_0x434b3b)[_0xa1bb('0x14')](function(_0x237ce9){return _[_0xa1bb('0x101')](_0x237ce9);});}else{return!![];}})[_0xa1bb('0x14')](function(_0x416c9e){var _0x143e4a=fs[_0xa1bb('0xc1')](path['join'](config['root'],_0xa1bb('0x102')),_0xa1bb('0x103'));var _0x359579={'remote':_0x462624['remote'],'query':querystring[_0xa1bb('0x17')](_[_0xa1bb('0x43')](_0x462624[_0xa1bb('0x4e')]({'plain':!![]}),{'customerIp':_0x39a100[_0xa1bb('0x7d')][_0xa1bb('0x99')]||_0x39a100[_0xa1bb('0x7d')][_0xa1bb('0x104')]||_0x39a100[_0xa1bb('0x105')][_0xa1bb('0x106')]||_0x39a100['ip'],'referer':_0x39a100[_0xa1bb('0x7d')]['referer'],'openedInteractions':_0x3e854f,'maxInteractions':_0x5ec8be,'virtual':_0x253c59['virtual'],'online':_0x416c9e,'custom':_0x253c59}))[_0xa1bb('0x107')](/'/g,'\x5c\x27')};_0x2eece2[_0xa1bb('0xbb')](ejs[_0xa1bb('0x108')](Mustache[_0xa1bb('0x108')](_0x143e4a,_0x359579),{'proactiveActions':_0xd5e599,'alignment':_0x462624[_0xa1bb('0x109')],'verticalAlignment':_0x462624['verticalAlignment'],'div_color':_0x462624[_0xa1bb('0xeb')],'labelText':_0x462624[_0xa1bb('0x10a')],'text_color':_0x462624[_0xa1bb('0x10b')],'button_color':_0x462624[_0xa1bb('0x10c')],'background_color':_0x462624['backgroundColor']}));})[_0xa1bb('0x1b')](handleError(_0x2eece2,null));};exports[_0xa1bb('0x10d')]=function(_0x4483fb,_0x183f86){var _0x43355a=_0x4483fb['params']['id'];var _0x447cbb=_0x4483fb[_0xa1bb('0x54')];var _0x2fd123=0xc8;var _0x29f765=null;return db[_0xa1bb('0x10e')][_0xa1bb('0x10f')]({'isolationLevel':db[_0xa1bb('0x10e')][_0xa1bb('0x110')][_0xa1bb('0x111')][_0xa1bb('0x112')]},function(_0x534080){return db[_0xa1bb('0x30')][_0xa1bb('0x5a')]({'where':{'id':_0x43355a},'transaction':_0x534080})[_0xa1bb('0x14')](function(_0x323470){if(_0x323470){return db[_0xa1bb('0x91')][_0xa1bb('0x29')]({'where':{'ChatWebsiteId':_0x43355a},'transaction':_0x534080})[_0xa1bb('0x14')](function(){var _0x15c98c=_[_0xa1bb('0x2f')](_0x447cbb,function(_0x586631){_0x586631[_0xa1bb('0x57')]=_0x43355a;return _0x586631;});return db[_0xa1bb('0x91')][_0xa1bb('0xca')](_0x15c98c,{'transaction':_0x534080});});}else{_0x2fd123=0x194;_0x29f765=[];}});})['then'](function(){if(_0x2fd123!==0x194){return db[_0xa1bb('0x91')][_0xa1bb('0x113')]({'where':{'ChatWebsiteId':_0x43355a},'order':'priority'})[_0xa1bb('0x14')](function(_0x3c020c){_0x29f765=_0x3c020c;});}})['catch'](function(_0x13800){_0x2fd123=0x1f4;logger[_0xa1bb('0x18')](_0x13800[_0xa1bb('0x2a')]);if(_0x13800[_0xa1bb('0x2b')]){delete _0x13800[_0xa1bb('0x2b')];}_0x29f765=_0x13800;})[_0xa1bb('0x114')](function(){if(_0x29f765===null){_0x183f86[_0xa1bb('0x1c')](_0x2fd123);}else{if(_0x2fd123===0x1f4){_0x183f86[_0xa1bb('0x1d')](_0x2fd123)[_0xa1bb('0xbb')](_0x29f765);}else{_0x183f86[_0xa1bb('0x1d')](_0x2fd123)[_0xa1bb('0x1f')](_0x29f765);}}});};exports[_0xa1bb('0x115')]=function(_0x360332,_0x1830c3){var _0x46bf4c={};var _0x4d31b0={};var _0x5007b7;var _0x120558;return db[_0xa1bb('0x30')][_0xa1bb('0x5a')]({'where':{'id':_0x360332['params']['id']}})['then'](handleEntityNotFound(_0x1830c3,null))['then'](function(_0x28f1b4){if(_0x28f1b4){_0x5007b7=_0x28f1b4;_0x4d31b0[_0xa1bb('0x34')]=_[_0xa1bb('0x36')](db['ChatApplication'][_0xa1bb('0x31')]);_0x4d31b0[_0xa1bb('0x35')]=_[_0xa1bb('0x36')](_0x360332[_0xa1bb('0x35')]);_0x4d31b0['filters']=_[_0xa1bb('0x38')](_0x4d31b0[_0xa1bb('0x34')],_0x4d31b0[_0xa1bb('0x35')]);_0x46bf4c[_0xa1bb('0x39')]=_[_0xa1bb('0x38')](_0x4d31b0[_0xa1bb('0x34')],qs['fields'](_0x360332[_0xa1bb('0x35')][_0xa1bb('0x3a')]));_0x46bf4c[_0xa1bb('0x39')]=_0x46bf4c[_0xa1bb('0x39')]['length']?_0x46bf4c['attributes']:_0x4d31b0[_0xa1bb('0x34')];_0x46bf4c[_0xa1bb('0x3e')]=qs[_0xa1bb('0x3f')](_0x360332['query']['sort']);_0x46bf4c[_0xa1bb('0x40')]=qs[_0xa1bb('0x37')](_['pick'](_0x360332[_0xa1bb('0x35')],_0x4d31b0['filters']));if(_0x360332[_0xa1bb('0x35')][_0xa1bb('0x42')]){_0x46bf4c[_0xa1bb('0x40')]=_[_0xa1bb('0x43')](_0x46bf4c[_0xa1bb('0x40')],{'$or':_[_0xa1bb('0x2f')](_0x46bf4c[_0xa1bb('0x39')],function(_0x51cf73){var _0x15a2b5={};_0x15a2b5[_0x51cf73]={'$like':'%'+_0x360332[_0xa1bb('0x35')][_0xa1bb('0x42')]+'%'};return _0x15a2b5;})});}_0x46bf4c=_[_0xa1bb('0x43')]({},_0x46bf4c,_0x360332['options']);return _0x5007b7[_0xa1bb('0x115')](_0x46bf4c);}})[_0xa1bb('0x14')](function(_0x33dce9){if(_0x33dce9){_0x120558=_0x33dce9[_0xa1bb('0x3b')];if(!_0x360332[_0xa1bb('0x35')][_0xa1bb('0x3c')](_0xa1bb('0x3d'))){_0x46bf4c['limit']=qs[_0xa1bb('0x20')](_0x360332['query'][_0xa1bb('0x20')]);_0x46bf4c[_0xa1bb('0x23')]=qs[_0xa1bb('0x23')](_0x360332[_0xa1bb('0x35')][_0xa1bb('0x23')]);}return _0x5007b7[_0xa1bb('0x115')](_0x46bf4c);}})['then'](function(_0x711d3a){if(_0x711d3a){return _0x711d3a?{'count':_0x120558,'rows':_0x711d3a}:null;}})[_0xa1bb('0x14')](respondWithResult(_0x1830c3,null))[_0xa1bb('0x1b')](handleError(_0x1830c3,null));};exports['addProactiveActions']=function(_0x1c9834,_0x59c077){return db[_0xa1bb('0x116')][_0xa1bb('0x4b')]({'where':{'id':_0x1c9834[_0xa1bb('0x49')]['id']}})['then'](handleEntityNotFound(_0x59c077,null))[_0xa1bb('0x14')](function(_0x2fcf85){if(_0x2fcf85){return _0x2fcf85[_0xa1bb('0x117')](_0x1c9834[_0xa1bb('0x54')]['ids'],_[_0xa1bb('0xe3')](_0x1c9834[_0xa1bb('0x54')],['ids','id'])||{});}})[_0xa1bb('0x14')](respondWithResult(_0x59c077,null))[_0xa1bb('0x1b')](handleError(_0x59c077,null));};exports[_0xa1bb('0xf9')]=function(_0x260d8a,_0xaea661){var _0x27bb6e={};var _0x9ebea7={};var _0x2b515f;var _0x28509e;return db['ChatWebsite'][_0xa1bb('0x5a')]({'where':{'id':_0x260d8a[_0xa1bb('0x49')]['id']}})[_0xa1bb('0x14')](handleEntityNotFound(_0xaea661,null))[_0xa1bb('0x14')](function(_0x211a36){if(_0x211a36){_0x2b515f=_0x211a36;_0x9ebea7[_0xa1bb('0x34')]=_[_0xa1bb('0x36')](db[_0xa1bb('0x118')]['rawAttributes']);_0x9ebea7['query']=_[_0xa1bb('0x36')](_0x260d8a[_0xa1bb('0x35')]);_0x9ebea7['filters']=_[_0xa1bb('0x38')](_0x9ebea7['model'],_0x9ebea7[_0xa1bb('0x35')]);_0x27bb6e[_0xa1bb('0x39')]=_[_0xa1bb('0x38')](_0x9ebea7[_0xa1bb('0x34')],qs[_0xa1bb('0x3a')](_0x260d8a[_0xa1bb('0x35')]['fields']));_0x27bb6e['attributes']=_0x27bb6e[_0xa1bb('0x39')]['length']?_0x27bb6e[_0xa1bb('0x39')]:_0x9ebea7['model'];_0x27bb6e['order']=qs[_0xa1bb('0x3f')](_0x260d8a[_0xa1bb('0x35')][_0xa1bb('0x3f')]);_0x27bb6e[_0xa1bb('0x40')]=qs['filters'](_['pick'](_0x260d8a[_0xa1bb('0x35')],_0x9ebea7['filters']));if(_0x260d8a['query'][_0xa1bb('0x42')]){_0x27bb6e[_0xa1bb('0x40')]=_[_0xa1bb('0x43')](_0x27bb6e[_0xa1bb('0x40')],{'$or':_['map'](_0x27bb6e[_0xa1bb('0x39')],function(_0x413ae6){var _0x49b328={};_0x49b328[_0x413ae6]={'$like':'%'+_0x260d8a[_0xa1bb('0x35')][_0xa1bb('0x42')]+'%'};return _0x49b328;})});}_0x27bb6e=_[_0xa1bb('0x43')]({},_0x27bb6e,_0x260d8a[_0xa1bb('0x45')]);return _0x2b515f[_0xa1bb('0xf9')](_0x27bb6e);}})[_0xa1bb('0x14')](function(_0x475ad8){if(_0x475ad8){_0x28509e=_0x475ad8[_0xa1bb('0x3b')];if(!_0x260d8a[_0xa1bb('0x35')][_0xa1bb('0x3c')](_0xa1bb('0x3d'))){_0x27bb6e[_0xa1bb('0x20')]=qs[_0xa1bb('0x20')](_0x260d8a[_0xa1bb('0x35')][_0xa1bb('0x20')]);_0x27bb6e[_0xa1bb('0x23')]=qs[_0xa1bb('0x23')](_0x260d8a[_0xa1bb('0x35')][_0xa1bb('0x23')]);}return _0x2b515f['getProactiveActions'](_0x27bb6e);}})[_0xa1bb('0x14')](function(_0x322de2){if(_0x322de2){return _0x322de2?{'count':_0x28509e,'rows':_0x322de2}:null;}})['then'](respondWithResult(_0xaea661,null))[_0xa1bb('0x1b')](handleError(_0xaea661,null));};exports[_0xa1bb('0x119')]=function(_0x430309,_0x4a215a){var _0x456249=_0x430309[_0xa1bb('0x35')]['online']===_0xa1bb('0x11a')?_0xa1bb('0x11b'):_0xa1bb('0x11c');return db[_0xa1bb('0x30')][_0xa1bb('0x4b')]({'attributes':['id',_0x456249],'where':{'id':_0x430309[_0xa1bb('0x49')]['id']}})[_0xa1bb('0x14')](handleEntityNotFound(_0x4a215a,null))[_0xa1bb('0x14')](function(_0x26db53){if(_0x26db53){var _0x1bda62=_0x26db53[_0x456249];var _0x11d023=_0x1bda62&&_0x1bda62[_0xa1bb('0x11d')]?_0x1bda62[_0xa1bb('0x11d')]:[];_0x4a215a[_0xa1bb('0xbb')]({'fromKey':_[_0xa1bb('0x6d')](_0x1bda62[_0xa1bb('0x11e')])?undefined:_0x1bda62[_0xa1bb('0x11e')],'count':_0x11d023[_0xa1bb('0x3b')],'rows':_0x11d023});}})[_0xa1bb('0x1b')](handleError(_0x4a215a,null));};exports[_0xa1bb('0x11f')]=function(_0xa47c5e,_0x2fb2e5){var _0x14ff04={'raw':![],'where':{}};var _0x2174e4={};var _0x382cec={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xa1bb('0x5a')]({'where':{'id':_0xa47c5e[_0xa1bb('0x49')]['id']}})[_0xa1bb('0x14')](handleEntityNotFound(_0x2fb2e5,null))['then'](function(_0x200ab2){if(_0x200ab2){_0x2174e4['model']=_[_0xa1bb('0x36')](db[_0xa1bb('0xc3')][_0xa1bb('0x31')]);_0x2174e4[_0xa1bb('0x35')]=_[_0xa1bb('0x36')](_0xa47c5e[_0xa1bb('0x35')]);_0x2174e4[_0xa1bb('0x37')]=_[_0xa1bb('0x38')](_0x2174e4['model'],_0x2174e4[_0xa1bb('0x35')]);_0x14ff04[_0xa1bb('0x39')]=_['intersection'](_0x2174e4['model'],qs[_0xa1bb('0x3a')](_0xa47c5e[_0xa1bb('0x35')]['fields']));_0x14ff04[_0xa1bb('0x39')]=_0x14ff04[_0xa1bb('0x39')][_0xa1bb('0x3b')]?_0x14ff04['attributes']:_0x2174e4['model'];if(!_0xa47c5e['query'][_0xa1bb('0x3c')](_0xa1bb('0x3d'))){_0x14ff04[_0xa1bb('0x20')]=qs[_0xa1bb('0x20')](_0xa47c5e[_0xa1bb('0x35')][_0xa1bb('0x20')]);_0x14ff04[_0xa1bb('0x23')]=qs[_0xa1bb('0x23')](_0xa47c5e[_0xa1bb('0x35')][_0xa1bb('0x23')]);}_0x14ff04[_0xa1bb('0x3e')]=qs[_0xa1bb('0x3f')](_0xa47c5e[_0xa1bb('0x35')][_0xa1bb('0x3f')]);_0x14ff04[_0xa1bb('0x40')]=qs[_0xa1bb('0x37')](_[_0xa1bb('0x41')](_0xa47c5e['query'],_0x2174e4[_0xa1bb('0x37')]));_0x14ff04[_0xa1bb('0x40')][_0xa1bb('0x57')]=_0x200ab2['id'];if(_0xa47c5e[_0xa1bb('0x35')][_0xa1bb('0x42')]){_0x14ff04['where']=_[_0xa1bb('0x43')](_0x14ff04[_0xa1bb('0x40')],{'$or':_[_0xa1bb('0x2f')](_0x14ff04['attributes'],function(_0x56195b){var _0x253094={};_0x253094[_0x56195b]={'$like':'%'+_0xa47c5e[_0xa1bb('0x35')][_0xa1bb('0x42')]+'%'};return _0x253094;})});}_0x14ff04=_[_0xa1bb('0x43')]({},_0x14ff04,_0xa47c5e[_0xa1bb('0x45')]);return db[_0xa1bb('0xc3')][_0xa1bb('0x22')]({'where':_0x14ff04[_0xa1bb('0x40')]})[_0xa1bb('0x14')](function(_0x143e84){_0x382cec['count']=_0x143e84;if(_0xa47c5e[_0xa1bb('0x35')][_0xa1bb('0x5b')]){_0x14ff04[_0xa1bb('0x4a')]=[{'all':!![]}];}else{_0x14ff04['include']=[{'model':db[_0xa1bb('0x80')],'as':_0xa1bb('0xe5'),'required':![]},{'model':db[_0xa1bb('0x120')],'as':'Attachments','required':![]}];}return db[_0xa1bb('0xc3')][_0xa1bb('0x46')](_0x14ff04);})[_0xa1bb('0x14')](function(_0x3819f8){_0x382cec[_0xa1bb('0x47')]=_0x3819f8;return _0x382cec;});}})[_0xa1bb('0x14')](respondWithFilteredResult(_0x2fb2e5,_0x14ff04))[_0xa1bb('0x1b')](handleError(_0x2fb2e5,null));};exports[_0xa1bb('0x121')]=function(_0x33ce4b,_0x4a4031){return db['ChatWebsite'][_0xa1bb('0x4b')]({'where':{'id':_0x33ce4b[_0xa1bb('0x49')]['id']}})[_0xa1bb('0x14')](handleEntityNotFound(_0x4a4031,null))[_0xa1bb('0x14')](function(_0x3b9c00){if(_0x3b9c00){return _0x3b9c00['addAgents'](_0x33ce4b[_0xa1bb('0x54')]['ids'],_[_0xa1bb('0xe3')](_0x33ce4b['body'],[_0xa1bb('0x5c'),'id'])||{})[_0xa1bb('0xc0')](function(_0x4a910d){for(var _0x1b9e3b=0x0;_0x1b9e3b<_0x33ce4b[_0xa1bb('0x54')][_0xa1bb('0x5c')][_0xa1bb('0x3b')];_0x1b9e3b+=0x1){socket[_0xa1bb('0x122')](_0xa1bb('0x123'),{'UserId':Number(_0x33ce4b[_0xa1bb('0x54')][_0xa1bb('0x5c')][_0x1b9e3b]),'ChatWebsiteId':Number(_0x33ce4b['params']['id'])});}return _0x4a910d;});}})[_0xa1bb('0x14')](respondWithResult(_0x4a4031,null))[_0xa1bb('0x1b')](handleError(_0x4a4031,null));};exports['removeAgents']=function(_0x3dcc61,_0x427d35){return db[_0xa1bb('0x30')][_0xa1bb('0x4b')]({'where':{'id':_0x3dcc61['params']['id']}})[_0xa1bb('0x14')](handleEntityNotFound(_0x427d35,null))['then'](function(_0x19a7a4){if(_0x19a7a4){return _0x19a7a4['removeAgents'](_0x3dcc61['query']['ids'])['then'](function(){if(_[_0xa1bb('0x124')](_0x3dcc61[_0xa1bb('0x35')][_0xa1bb('0x5c')])){for(var _0x43b541=0x0;_0x43b541<_0x3dcc61[_0xa1bb('0x35')][_0xa1bb('0x5c')][_0xa1bb('0x3b')];_0x43b541+=0x1){socket['emit'](_0xa1bb('0x125'),{'UserId':Number(_0x3dcc61[_0xa1bb('0x35')][_0xa1bb('0x5c')][_0x43b541]),'ChatWebsiteId':Number(_0x3dcc61[_0xa1bb('0x49')]['id'])});}}else{socket[_0xa1bb('0x122')](_0xa1bb('0x125'),{'UserId':Number(_0x3dcc61[_0xa1bb('0x35')][_0xa1bb('0x5c')]),'ChatWebsiteId':Number(_0x3dcc61[_0xa1bb('0x49')]['id'])});}});}})[_0xa1bb('0x14')](respondWithStatusCode(_0x427d35,null))[_0xa1bb('0x1b')](handleError(_0x427d35,null));};exports[_0xa1bb('0x126')]=function(_0x4f5ea0,_0x3a128d){var _0x22a5b8={};var _0x3b6c5e={};var _0x3b0833;var _0xfd753a;return db[_0xa1bb('0x30')]['findOne']({'where':{'id':_0x4f5ea0[_0xa1bb('0x49')]['id']}})['then'](handleEntityNotFound(_0x3a128d,null))['then'](function(_0x483019){if(_0x483019){_0x3b0833=_0x483019;_0x3b6c5e[_0xa1bb('0x34')]=_[_0xa1bb('0x36')](db['User'][_0xa1bb('0x31')]);_0x3b6c5e[_0xa1bb('0x35')]=_[_0xa1bb('0x36')](_0x4f5ea0[_0xa1bb('0x35')]);_0x3b6c5e[_0xa1bb('0x37')]=_[_0xa1bb('0x38')](_0x3b6c5e[_0xa1bb('0x34')],_0x3b6c5e[_0xa1bb('0x35')]);_0x22a5b8[_0xa1bb('0x39')]=_['intersection'](_0x3b6c5e[_0xa1bb('0x34')],qs[_0xa1bb('0x3a')](_0x4f5ea0['query']['fields']));_0x22a5b8[_0xa1bb('0x39')]=_0x22a5b8[_0xa1bb('0x39')][_0xa1bb('0x3b')]?_0x22a5b8[_0xa1bb('0x39')]:_0x3b6c5e[_0xa1bb('0x34')];_0x22a5b8[_0xa1bb('0x3e')]=qs[_0xa1bb('0x3f')](_0x4f5ea0[_0xa1bb('0x35')]['sort']);_0x22a5b8[_0xa1bb('0x40')]=qs[_0xa1bb('0x37')](_['pick'](_0x4f5ea0[_0xa1bb('0x35')],_0x3b6c5e[_0xa1bb('0x37')]));if(_0x4f5ea0['query'][_0xa1bb('0x42')]){_0x22a5b8[_0xa1bb('0x40')]=_[_0xa1bb('0x43')](_0x22a5b8[_0xa1bb('0x40')],{'$or':_[_0xa1bb('0x2f')](_0x22a5b8['attributes'],function(_0x2f8c7f){var _0x4632c4={};_0x4632c4[_0x2f8c7f]={'$like':'%'+_0x4f5ea0[_0xa1bb('0x35')][_0xa1bb('0x42')]+'%'};return _0x4632c4;})});}_0x22a5b8=_[_0xa1bb('0x43')]({},_0x22a5b8,_0x4f5ea0[_0xa1bb('0x45')]);return _0x3b0833['getAgents'](_0x22a5b8);}})[_0xa1bb('0x14')](function(_0x5beceb){if(_0x5beceb){_0xfd753a=_0x5beceb[_0xa1bb('0x3b')];if(!_0x4f5ea0[_0xa1bb('0x35')][_0xa1bb('0x3c')]('nolimit')){_0x22a5b8['limit']=qs[_0xa1bb('0x20')](_0x4f5ea0['query'][_0xa1bb('0x20')]);_0x22a5b8['offset']=qs[_0xa1bb('0x23')](_0x4f5ea0[_0xa1bb('0x35')][_0xa1bb('0x23')]);}return _0x3b0833[_0xa1bb('0x126')](_0x22a5b8);}})[_0xa1bb('0x14')](function(_0x2d21d0){if(_0x2d21d0){return _0x2d21d0?{'count':_0xfd753a,'rows':_0x2d21d0}:null;}})[_0xa1bb('0x14')](respondWithResult(_0x3a128d,null))['catch'](handleError(_0x3a128d,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index dc24d7c..07e005e 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 _0xbe02=['ChatWebsite','setMaxListeners','update','remove','emit','hasOwnProperty','events','../../mysqldb'];(function(_0x13b247,_0x33d312){var _0x305a4b=function(_0x46c7b5){while(--_0x46c7b5){_0x13b247['push'](_0x13b247['shift']());}};_0x305a4b(++_0x33d312);}(_0xbe02,0x146));var _0x2be0=function(_0x30f788,_0x17626d){_0x30f788=_0x30f788-0x0;var _0x34a919=_0xbe02[_0x30f788];return _0x34a919;};'use strict';var EventEmitter=require(_0x2be0('0x0'));var ChatWebsite=require(_0x2be0('0x1'))['db'][_0x2be0('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x2be0('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2be0('0x4'),'afterDestroy':_0x2be0('0x5')};function emitEvent(_0x9eb980){return function(_0x364c99,_0x22ed11,_0x3b824){ChatWebsiteEvents[_0x2be0('0x6')](_0x9eb980+':'+_0x364c99['id'],_0x364c99);ChatWebsiteEvents[_0x2be0('0x6')](_0x9eb980,_0x364c99);_0x3b824(null);};}for(var e in events){if(events[_0x2be0('0x7')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file +var _0x7f90=['save','emit','hasOwnProperty','hook','events','../../mysqldb','ChatWebsite','setMaxListeners'];(function(_0x57d3d9,_0x2d605b){var _0x46730c=function(_0x1e7019){while(--_0x1e7019){_0x57d3d9['push'](_0x57d3d9['shift']());}};_0x46730c(++_0x2d605b);}(_0x7f90,0xf4));var _0x07f9=function(_0x17f7d9,_0x550daf){_0x17f7d9=_0x17f7d9-0x0;var _0x178a78=_0x7f90[_0x17f7d9];return _0x178a78;};'use strict';var EventEmitter=require(_0x07f9('0x0'));var ChatWebsite=require(_0x07f9('0x1'))['db'][_0x07f9('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x07f9('0x3')](0x0);var events={'afterCreate':_0x07f9('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x15b548){return function(_0x132ae4,_0x574e7d,_0x36a0f1){ChatWebsiteEvents[_0x07f9('0x5')](_0x15b548+':'+_0x132ae4['id'],_0x132ae4);ChatWebsiteEvents[_0x07f9('0x5')](_0x15b548,_0x132ae4);_0x36a0f1(null);};}for(var e in events){if(events[_0x07f9('0x6')](e)){var event=events[e];ChatWebsite[_0x07f9('0x7')](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index a3f0351..61ff328 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 _0xc274=['api','moment','bluebird','path','rimraf','../../config/environment','exports','define','ChatWebsite','lodash','util','../../config/logger'];(function(_0x27d877,_0x4ccf83){var _0x3d4d0e=function(_0x213c5a){while(--_0x213c5a){_0x27d877['push'](_0x27d877['shift']());}};_0x3d4d0e(++_0x4ccf83);}(_0xc274,0x17d));var _0x4c27=function(_0x54e60d,_0x3b3ee9){_0x54e60d=_0x54e60d-0x0;var _0x28db5e=_0xc274[_0x54e60d];return _0x28db5e;};'use strict';var _=require(_0x4c27('0x0'));var util=require(_0x4c27('0x1'));var logger=require(_0x4c27('0x2'))(_0x4c27('0x3'));var moment=require(_0x4c27('0x4'));var BPromise=require(_0x4c27('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4c27('0x6'));var rimraf=require(_0x4c27('0x7'));var config=require(_0x4c27('0x8'));var attributes=require('./chatWebsite.attributes');module[_0x4c27('0x9')]=function(_0x3060f5,_0x58e0de){return _0x3060f5[_0x4c27('0xa')](_0x4c27('0xb'),attributes,{'tableName':'chat_websites','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8288=['path','./chatWebsite.attributes','exports','define','ChatWebsite','chat_websites','lodash','../../config/logger','api','moment','bluebird'];(function(_0x424a9a,_0x2dd9af){var _0xa7831c=function(_0x512534){while(--_0x512534){_0x424a9a['push'](_0x424a9a['shift']());}};_0xa7831c(++_0x2dd9af);}(_0x8288,0x103));var _0x8828=function(_0x2b12ac,_0x5bff10){_0x2b12ac=_0x2b12ac-0x0;var _0x497835=_0x8288[_0x2b12ac];return _0x497835;};'use strict';var _=require(_0x8828('0x0'));var util=require('util');var logger=require(_0x8828('0x1'))(_0x8828('0x2'));var moment=require(_0x8828('0x3'));var BPromise=require(_0x8828('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8828('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8828('0x6'));module[_0x8828('0x7')]=function(_0x47f0ce,_0x3752b2){return _0x47f0ce[_0x8828('0x8')](_0x8828('0x9'),attributes,{'tableName':_0x8828('0xa'),'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 c41f520..e86ea25 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 _0x7a9d=['util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','then','ChatWebsite,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash'];(function(_0x3bef2c,_0x5a86fd){var _0x331503=function(_0x463430){while(--_0x463430){_0x3bef2c['push'](_0x3bef2c['shift']());}};_0x331503(++_0x5a86fd);}(_0x7a9d,0x112));var _0xd7a9=function(_0x2bf86b,_0x508522){_0x2bf86b=_0x2bf86b-0x0;var _0x5b5ff6=_0x7a9d[_0x2bf86b];return _0x5b5ff6;};'use strict';var _=require(_0xd7a9('0x0'));var util=require(_0xd7a9('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd7a9('0x2'));var fs=require('fs');var Redis=require(_0xd7a9('0x3'));var db=require(_0xd7a9('0x4'))['db'];var utils=require(_0xd7a9('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xd7a9('0x6'));var jayson=require(_0xd7a9('0x7'));var client=jayson[_0xd7a9('0x8')]['http']({'port':0x232a});config[_0xd7a9('0x9')]=_[_0xd7a9('0xa')](config[_0xd7a9('0x9')],{'host':_0xd7a9('0xb'),'port':0x18eb});var socket=require(_0xd7a9('0xc'))(new Redis(config[_0xd7a9('0x9')]));require(_0xd7a9('0xd'))[_0xd7a9('0xe')](socket);function respondWithRpcPromise(_0x47b53f,_0x596894,_0x4fc0a4){return new BPromise(function(_0xeed2c7,_0x374ba5){return client['request'](_0x47b53f,_0x4fc0a4)[_0xd7a9('0xf')](function(_0x253d6a){logger['info'](_0xd7a9('0x10'),_0x596894,'request\x20sent');logger[_0xd7a9('0x11')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x596894,_0xd7a9('0x12'),JSON[_0xd7a9('0x13')](_0x253d6a));if(_0x253d6a[_0xd7a9('0x14')]){if(_0x253d6a[_0xd7a9('0x14')][_0xd7a9('0x15')]===0x1f4){logger['error'](_0xd7a9('0x10'),_0x596894,_0x253d6a[_0xd7a9('0x14')][_0xd7a9('0x16')]);return _0x374ba5(_0x253d6a[_0xd7a9('0x14')][_0xd7a9('0x16')]);}logger[_0xd7a9('0x14')](_0xd7a9('0x10'),_0x596894,_0x253d6a[_0xd7a9('0x14')][_0xd7a9('0x16')]);return _0xeed2c7(_0x253d6a[_0xd7a9('0x14')][_0xd7a9('0x16')]);}else{logger['info']('ChatWebsite,\x20%s,\x20%s',_0x596894,_0xd7a9('0x12'));_0xeed2c7(_0x253d6a[_0xd7a9('0x17')]['message']);}})[_0xd7a9('0x18')](function(_0x1ec3d4){logger[_0xd7a9('0x14')](_0xd7a9('0x10'),_0x596894,_0x1ec3d4);_0x374ba5(_0x1ec3d4);});});} \ No newline at end of file +var _0xc063=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','./chatWebsite.socket','register','request','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash'];(function(_0x4981bc,_0x33ab8d){var _0xf8e8d8=function(_0x1b30df){while(--_0x1b30df){_0x4981bc['push'](_0x4981bc['shift']());}};_0xf8e8d8(++_0x33ab8d);}(_0xc063,0x1c1));var _0x3c06=function(_0x36530c,_0x496046){_0x36530c=_0x36530c-0x0;var _0xe7a70d=_0xc063[_0x36530c];return _0xe7a70d;};'use strict';var _=require(_0x3c06('0x0'));var util=require('util');var moment=require(_0x3c06('0x1'));var BPromise=require(_0x3c06('0x2'));var rs=require(_0x3c06('0x3'));var fs=require('fs');var Redis=require(_0x3c06('0x4'));var db=require(_0x3c06('0x5'))['db'];var utils=require(_0x3c06('0x6'));var logger=require(_0x3c06('0x7'))('rpc');var config=require(_0x3c06('0x8'));var jayson=require(_0x3c06('0x9'));var client=jayson[_0x3c06('0xa')][_0x3c06('0xb')]({'port':0x232a});config['redis']=_[_0x3c06('0xc')](config[_0x3c06('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3c06('0xd')]));require(_0x3c06('0xe'))[_0x3c06('0xf')](socket);function respondWithRpcPromise(_0xe10f7d,_0x59f439,_0xbb65c0){return new BPromise(function(_0x225137,_0x5ac5cb){return client[_0x3c06('0x10')](_0xe10f7d,_0xbb65c0)[_0x3c06('0x11')](function(_0x10d15f){logger['info'](_0x3c06('0x12'),_0x59f439,_0x3c06('0x13'));logger['debug'](_0x3c06('0x14'),_0x59f439,_0x3c06('0x13'),JSON['stringify'](_0x10d15f));if(_0x10d15f[_0x3c06('0x15')]){if(_0x10d15f[_0x3c06('0x15')][_0x3c06('0x16')]===0x1f4){logger[_0x3c06('0x15')]('ChatWebsite,\x20%s,\x20%s',_0x59f439,_0x10d15f[_0x3c06('0x15')][_0x3c06('0x17')]);return _0x5ac5cb(_0x10d15f[_0x3c06('0x15')][_0x3c06('0x17')]);}logger[_0x3c06('0x15')]('ChatWebsite,\x20%s,\x20%s',_0x59f439,_0x10d15f[_0x3c06('0x15')]['message']);return _0x225137(_0x10d15f[_0x3c06('0x15')]['message']);}else{logger['info'](_0x3c06('0x12'),_0x59f439,'request\x20sent');_0x225137(_0x10d15f[_0x3c06('0x18')][_0x3c06('0x17')]);}})['catch'](function(_0xc8b06c){logger[_0x3c06('0x15')](_0x3c06('0x12'),_0x59f439,_0xc8b06c);_0x5ac5cb(_0xc8b06c);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index dd14d09..3186656 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 _0xdef0=['register','length','chatWebsite:','./chatWebsite.events','save','update','emit','removeListener'];(function(_0x34d152,_0x515b3b){var _0x2f360d=function(_0x8315d9){while(--_0x8315d9){_0x34d152['push'](_0x34d152['shift']());}};_0x2f360d(++_0x515b3b);}(_0xdef0,0x19b));var _0x0def=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xdef0[_0x2dafbe];return _0x58a45a;};'use strict';var ChatWebsiteEvents=require(_0x0def('0x0'));var events=[_0x0def('0x1'),'remove',_0x0def('0x2')];function createListener(_0xf3397e,_0x4f19e4){return function(_0x1c65c3){_0x4f19e4[_0x0def('0x3')](_0xf3397e,_0x1c65c3);};}function removeListener(_0x3c05b3,_0x3dbc29){return function(){ChatWebsiteEvents[_0x0def('0x4')](_0x3c05b3,_0x3dbc29);};}exports[_0x0def('0x5')]=function(_0xfc90e1){for(var _0x3d0a40=0x0,_0x71a39a=events[_0x0def('0x6')];_0x3d0a40<_0x71a39a;_0x3d0a40++){var _0x3ef19a=events[_0x3d0a40];var _0x5e1bb0=createListener(_0x0def('0x7')+_0x3ef19a,_0xfc90e1);ChatWebsiteEvents['on'](_0x3ef19a,_0x5e1bb0);}}; \ No newline at end of file +var _0xb191=['remove','update','emit','removeListener','register','chatWebsite:','save'];(function(_0xd2e862,_0x33f476){var _0x3dd95b=function(_0xedd960){while(--_0xedd960){_0xd2e862['push'](_0xd2e862['shift']());}};_0x3dd95b(++_0x33f476);}(_0xb191,0x1a3));var _0x1b19=function(_0x2e0380,_0xbcdf26){_0x2e0380=_0x2e0380-0x0;var _0x1c73d8=_0xb191[_0x2e0380];return _0x1c73d8;};'use strict';var ChatWebsiteEvents=require('./chatWebsite.events');var events=[_0x1b19('0x0'),_0x1b19('0x1'),_0x1b19('0x2')];function createListener(_0x10353f,_0x56180a){return function(_0x5b9ce1){_0x56180a[_0x1b19('0x3')](_0x10353f,_0x5b9ce1);};}function removeListener(_0x3d61d4,_0x3f02d3){return function(){ChatWebsiteEvents[_0x1b19('0x4')](_0x3d61d4,_0x3f02d3);};}exports[_0x1b19('0x5')]=function(_0x484cd9){for(var _0x1bdcea=0x0,_0x5ce4b4=events['length'];_0x1bdcea<_0x5ce4b4;_0x1bdcea++){var _0x67aecb=events[_0x1bdcea];var _0x5793ab=createListener(_0x1b19('0x6')+_0x67aecb,_0x484cd9);ChatWebsiteEvents['on'](_0x67aecb,_0x5793ab);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 768b8d0..ae392f9 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 _0xa596=['getAnswers','getLogo','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','/:id/interactions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','addDisposition','addAnswer','diskStorage','join','root','format','%s-%s','originalname','/:id/logo','single','file','server/files/images/avatars/','now','/:id/avatar','addAvatar','addSystemAvatar','/:id/notify','notify','server/files','attachments','offline-chat','ensureDir','replace','any','offline','addInteraction','addProactiveActions','addAgents','put','update','delete','removeDispositions','removeAnswers','removeAgents','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers'];(function(_0x4d38cf,_0x50efa6){var _0x40c835=function(_0x327729){while(--_0x327729){_0x4d38cf['push'](_0x4d38cf['shift']());}};_0x40c835(++_0x50efa6);}(_0xa596,0x81));var _0x6a59=function(_0x6d6b83,_0x3b94d8){_0x6d6b83=_0x6d6b83-0x0;var _0x5f003f=_0xa596[_0x6d6b83];return _0x5f003f;};'use strict';var multer=require('multer');var util=require(_0x6a59('0x0'));var path=require(_0x6a59('0x1'));var timeout=require(_0x6a59('0x2'));var express=require(_0x6a59('0x3'));var router=express[_0x6a59('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6a59('0x5'));var interaction=require(_0x6a59('0x6'));var config=require(_0x6a59('0x7'));var controller=require(_0x6a59('0x8'));router[_0x6a59('0x9')]('/',auth[_0x6a59('0xa')](),controller[_0x6a59('0xb')]);router['get'](_0x6a59('0xc'),auth[_0x6a59('0xa')](),controller[_0x6a59('0xd')]);router[_0x6a59('0x9')](_0x6a59('0xe'),auth[_0x6a59('0xa')](),controller[_0x6a59('0xf')]);router['get'](_0x6a59('0x10'),auth[_0x6a59('0xa')](),controller[_0x6a59('0x11')]);router[_0x6a59('0x9')](_0x6a59('0x12'),auth[_0x6a59('0xa')](),controller[_0x6a59('0x13')]);router['get']('/:id/logo',controller[_0x6a59('0x14')]);router[_0x6a59('0x9')]('/:id/avatar',controller[_0x6a59('0x15')]);router['get'](_0x6a59('0x16'),controller[_0x6a59('0x17')]);router[_0x6a59('0x9')](_0x6a59('0x18'),controller['getSystemAvatar']);router[_0x6a59('0x9')](_0x6a59('0x19'),auth['isAuthenticated'](),controller['getInteractions']);router[_0x6a59('0x9')](_0x6a59('0x1a'),controller[_0x6a59('0x1b')]);router[_0x6a59('0x9')](_0x6a59('0x1c'),auth[_0x6a59('0xa')](),controller[_0x6a59('0x1d')]);router[_0x6a59('0x9')](_0x6a59('0x1e'),auth[_0x6a59('0xa')](),controller[_0x6a59('0x1f')]);router[_0x6a59('0x9')](_0x6a59('0x20'),controller[_0x6a59('0x21')]);router[_0x6a59('0x9')](_0x6a59('0x22'),auth[_0x6a59('0xa')](),controller[_0x6a59('0x23')]);router['get'](_0x6a59('0x24'),auth[_0x6a59('0xa')](),controller[_0x6a59('0x25')]);router['post']('/',auth[_0x6a59('0xa')](),controller['create']);router[_0x6a59('0x26')](_0x6a59('0x10'),auth['isAuthenticated'](),controller[_0x6a59('0x27')]);router[_0x6a59('0x26')]('/:id/canned_answers',auth[_0x6a59('0xa')](),controller[_0x6a59('0x28')]);var upload=multer({'storage':multer[_0x6a59('0x29')]({'destination':function(_0x4d6b29,_0x3b6129,_0x8e9dfc){_0x8e9dfc(null,path[_0x6a59('0x2a')](config[_0x6a59('0x2b')],'server/files/images/logos/'));},'filename':function(_0x204a75,_0x225901,_0x27f6bb){_0x27f6bb(null,util[_0x6a59('0x2c')](_0x6a59('0x2d'),Date['now'](),_0x225901[_0x6a59('0x2e')]));}})});router[_0x6a59('0x26')](_0x6a59('0x2f'),upload[_0x6a59('0x30')](_0x6a59('0x31')),controller['addLogo']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x599602,_0xbb951a,_0x56912f){_0x56912f(null,path[_0x6a59('0x2a')](config[_0x6a59('0x2b')],_0x6a59('0x32')));},'filename':function(_0x1d9a6b,_0x1ae163,_0x4e6439){_0x4e6439(null,util['format'](_0x6a59('0x2d'),Date[_0x6a59('0x33')](),_0x1ae163['originalname']));}})});router['post'](_0x6a59('0x34'),upload['single'](_0x6a59('0x31')),controller[_0x6a59('0x35')]);var upload=multer({'storage':multer[_0x6a59('0x29')]({'destination':function(_0x591c6b,_0x4c3446,_0x408213){_0x408213(null,path[_0x6a59('0x2a')](config[_0x6a59('0x2b')],_0x6a59('0x32')));},'filename':function(_0x466c16,_0x5f3b5f,_0x5089d3){_0x5089d3(null,util[_0x6a59('0x2c')](_0x6a59('0x2d'),Date['now'](),_0x5f3b5f[_0x6a59('0x2e')]));}})});router['post'](_0x6a59('0x16'),upload[_0x6a59('0x30')](_0x6a59('0x31')),controller['addCustomerAvatar']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3ee9ad,_0x54bbbb,_0x50028a){_0x50028a(null,path[_0x6a59('0x2a')](config[_0x6a59('0x2b')],'server/files/images/avatars/'));},'filename':function(_0x249454,_0x5b967a,_0x3a50c1){_0x3a50c1(null,util['format'](_0x6a59('0x2d'),Date[_0x6a59('0x33')](),_0x5b967a[_0x6a59('0x2e')]));}})});router[_0x6a59('0x26')](_0x6a59('0x18'),upload[_0x6a59('0x30')](_0x6a59('0x31')),controller[_0x6a59('0x36')]);router[_0x6a59('0x26')](_0x6a59('0x37'),controller[_0x6a59('0x38')]);const offlineUploadMulter=multer({'storage':multer[_0x6a59('0x29')]({'destination':function(_0x4a9a70,_0x95fdec,_0xd3b0a){const _0x26f753=path[_0x6a59('0x2a')](config[_0x6a59('0x2b')],_0x6a59('0x39'),_0x6a59('0x3a'),_0x6a59('0x3b'));fs_extra[_0x6a59('0x3c')](_0x26f753,function(){_0xd3b0a(null,_0x26f753);});},'filename':function(_0x595098,_0xd41ea7,_0x1dc2db){const _0x5a189c=_0xd41ea7[_0x6a59('0x2e')][_0x6a59('0x3d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x341d6b=path['extname'](_0x5a189c);const _0x4a6745=Date[_0x6a59('0x33')]()+'-'+_0x5a189c[_0x6a59('0x3d')](_0x341d6b,'')+_0x341d6b;_0x1dc2db(null,_0x4a6745);}})});router[_0x6a59('0x26')]('/:id/offline',offlineUploadMulter[_0x6a59('0x3e')](),controller[_0x6a59('0x3f')]);router[_0x6a59('0x26')]('/:id/interactions',auth[_0x6a59('0xa')](),controller[_0x6a59('0x40')]);router[_0x6a59('0x26')](_0x6a59('0x1c'),auth[_0x6a59('0xa')](),controller['addApplications']);router['post']('/:id/proactive_actions',auth['isAuthenticated'](),controller[_0x6a59('0x41')]);router[_0x6a59('0x26')](_0x6a59('0x24'),auth['isAuthenticated'](),controller[_0x6a59('0x42')]);router[_0x6a59('0x43')](_0x6a59('0xe'),auth[_0x6a59('0xa')](),controller[_0x6a59('0x44')]);router[_0x6a59('0x45')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0x6a59('0x45')](_0x6a59('0x10'),auth[_0x6a59('0xa')](),controller[_0x6a59('0x46')]);router['delete'](_0x6a59('0x12'),auth[_0x6a59('0xa')](),controller[_0x6a59('0x47')]);router[_0x6a59('0x45')](_0x6a59('0x24'),auth['isAuthenticated'](),controller[_0x6a59('0x48')]);module[_0x6a59('0x49')]=router; \ No newline at end of file +var _0x772f=['update','delete','destroy','removeDispositions','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getLogo','/:id/avatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','/:id/fields','getFields','getOfflineMessages','/:id/users','getAgents','post','addDisposition','addAnswer','diskStorage','join','server/files/images/logos/','format','now','originalname','single','file','addLogo','root','server/files/images/avatars/','addAvatar','%s-%s','addSystemAvatar','/:id/notify','server/files','attachments','offline-chat','ensureDir','replace','extname','/:id/offline','offline','addInteraction','addApplications','addProactiveActions','addAgents'];(function(_0xc350,_0x2fb0f8){var _0x126021=function(_0x3f0b9e){while(--_0x3f0b9e){_0xc350['push'](_0xc350['shift']());}};_0x126021(++_0x2fb0f8);}(_0x772f,0x12e));var _0xf772=function(_0x43a5c7,_0x2286bf){_0x43a5c7=_0x43a5c7-0x0;var _0x3b12a2=_0x772f[_0x43a5c7];return _0x3b12a2;};'use strict';var multer=require(_0xf772('0x0'));var util=require('util');var path=require(_0xf772('0x1'));var timeout=require(_0xf772('0x2'));var express=require(_0xf772('0x3'));var router=express[_0xf772('0x4')]();var fs_extra=require(_0xf772('0x5'));var auth=require(_0xf772('0x6'));var interaction=require(_0xf772('0x7'));var config=require(_0xf772('0x8'));var controller=require(_0xf772('0x9'));router[_0xf772('0xa')]('/',auth['isAuthenticated'](),controller[_0xf772('0xb')]);router['get'](_0xf772('0xc'),auth[_0xf772('0xd')](),controller[_0xf772('0xe')]);router['get'](_0xf772('0xf'),auth[_0xf772('0xd')](),controller[_0xf772('0x10')]);router[_0xf772('0xa')](_0xf772('0x11'),auth[_0xf772('0xd')](),controller[_0xf772('0x12')]);router[_0xf772('0xa')](_0xf772('0x13'),auth[_0xf772('0xd')](),controller[_0xf772('0x14')]);router['get']('/:id/logo',controller[_0xf772('0x15')]);router[_0xf772('0xa')](_0xf772('0x16'),controller['getAvatar']);router[_0xf772('0xa')](_0xf772('0x17'),controller[_0xf772('0x18')]);router[_0xf772('0xa')](_0xf772('0x19'),controller[_0xf772('0x1a')]);router[_0xf772('0xa')](_0xf772('0x1b'),auth['isAuthenticated'](),controller['getInteractions']);router[_0xf772('0xa')](_0xf772('0x1c'),controller[_0xf772('0x1d')]);router[_0xf772('0xa')](_0xf772('0x1e'),auth['isAuthenticated'](),controller[_0xf772('0x1f')]);router[_0xf772('0xa')](_0xf772('0x20'),auth[_0xf772('0xd')](),controller['getProactiveActions']);router[_0xf772('0xa')](_0xf772('0x21'),controller[_0xf772('0x22')]);router[_0xf772('0xa')]('/:id/offline_messages',auth[_0xf772('0xd')](),controller[_0xf772('0x23')]);router[_0xf772('0xa')](_0xf772('0x24'),auth[_0xf772('0xd')](),controller[_0xf772('0x25')]);router[_0xf772('0x26')]('/',auth[_0xf772('0xd')](),controller['create']);router[_0xf772('0x26')](_0xf772('0x11'),auth[_0xf772('0xd')](),controller[_0xf772('0x27')]);router[_0xf772('0x26')]('/:id/canned_answers',auth[_0xf772('0xd')](),controller[_0xf772('0x28')]);var upload=multer({'storage':multer[_0xf772('0x29')]({'destination':function(_0x5b7912,_0x42f485,_0x990263){_0x990263(null,path[_0xf772('0x2a')](config['root'],_0xf772('0x2b')));},'filename':function(_0x47d250,_0x122153,_0x4d7214){_0x4d7214(null,util[_0xf772('0x2c')]('%s-%s',Date[_0xf772('0x2d')](),_0x122153[_0xf772('0x2e')]));}})});router[_0xf772('0x26')]('/:id/logo',upload[_0xf772('0x2f')](_0xf772('0x30')),controller[_0xf772('0x31')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1668bd,_0x417daf,_0x8cb99c){_0x8cb99c(null,path[_0xf772('0x2a')](config[_0xf772('0x32')],_0xf772('0x33')));},'filename':function(_0x506c20,_0xac1e4f,_0x2f4f3e){_0x2f4f3e(null,util['format']('%s-%s',Date[_0xf772('0x2d')](),_0xac1e4f['originalname']));}})});router[_0xf772('0x26')](_0xf772('0x16'),upload[_0xf772('0x2f')](_0xf772('0x30')),controller[_0xf772('0x34')]);var upload=multer({'storage':multer[_0xf772('0x29')]({'destination':function(_0x22d0aa,_0x248e8e,_0x4ae100){_0x4ae100(null,path[_0xf772('0x2a')](config[_0xf772('0x32')],_0xf772('0x33')));},'filename':function(_0x5f3bba,_0x93478a,_0x496538){_0x496538(null,util[_0xf772('0x2c')]('%s-%s',Date[_0xf772('0x2d')](),_0x93478a[_0xf772('0x2e')]));}})});router['post'](_0xf772('0x17'),upload[_0xf772('0x2f')](_0xf772('0x30')),controller['addCustomerAvatar']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4f8f83,_0x258dff,_0x1f7541){_0x1f7541(null,path[_0xf772('0x2a')](config[_0xf772('0x32')],_0xf772('0x33')));},'filename':function(_0x290b67,_0xc5164,_0x2a09a1){_0x2a09a1(null,util['format'](_0xf772('0x35'),Date[_0xf772('0x2d')](),_0xc5164[_0xf772('0x2e')]));}})});router[_0xf772('0x26')](_0xf772('0x19'),upload['single'](_0xf772('0x30')),controller[_0xf772('0x36')]);router[_0xf772('0x26')](_0xf772('0x37'),controller['notify']);const offlineUploadMulter=multer({'storage':multer[_0xf772('0x29')]({'destination':function(_0x976c31,_0xe458c7,_0xa5d719){const _0x28853e=path['join'](config[_0xf772('0x32')],_0xf772('0x38'),_0xf772('0x39'),_0xf772('0x3a'));fs_extra[_0xf772('0x3b')](_0x28853e,function(){_0xa5d719(null,_0x28853e);});},'filename':function(_0xa7e0b,_0x4b5d9c,_0x74cf6c){const _0x26dda4=_0x4b5d9c[_0xf772('0x2e')][_0xf772('0x3c')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x439e5a=path[_0xf772('0x3d')](_0x26dda4);const _0x10710b=Date['now']()+'-'+_0x26dda4[_0xf772('0x3c')](_0x439e5a,'')+_0x439e5a;_0x74cf6c(null,_0x10710b);}})});router[_0xf772('0x26')](_0xf772('0x3e'),offlineUploadMulter['any'](),controller[_0xf772('0x3f')]);router[_0xf772('0x26')](_0xf772('0x1b'),auth['isAuthenticated'](),controller[_0xf772('0x40')]);router[_0xf772('0x26')](_0xf772('0x1e'),auth[_0xf772('0xd')](),controller[_0xf772('0x41')]);router[_0xf772('0x26')]('/:id/proactive_actions',auth['isAuthenticated'](),controller[_0xf772('0x42')]);router[_0xf772('0x26')](_0xf772('0x24'),auth[_0xf772('0xd')](),controller[_0xf772('0x43')]);router['put'](_0xf772('0xf'),auth[_0xf772('0xd')](),controller[_0xf772('0x44')]);router[_0xf772('0x45')](_0xf772('0xf'),auth['isAuthenticated'](),controller[_0xf772('0x46')]);router['delete'](_0xf772('0x11'),auth[_0xf772('0xd')](),controller[_0xf772('0x47')]);router[_0xf772('0x45')](_0xf772('0x13'),auth[_0xf772('0xd')](),controller['removeAnswers']);router[_0xf772('0x45')]('/:id/users',auth[_0xf772('0xd')](),controller[_0xf772('0x48')]);module[_0xf772('0x49')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 257ef1e..33dc430 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 _0x1f53=['Google','ENUM','Dynamics365','MicrosoftAzure\x20=>\x20tenant','TEXT','MicrosoftAzure\x20=>\x20access_token','sequelize','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1f53,0x16e));var _0x31f5=function(_0x226724,_0x110fc8){_0x226724=_0x226724-0x0;var _0x373db3=_0x1f53[_0x226724];return _0x373db3;};'use strict';var Sequelize=require(_0x31f5('0x0'));module[_0x31f5('0x1')]={'name':{'type':Sequelize[_0x31f5('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize['ENUM']('AmazonAWS',_0x31f5('0x3'),'MicrosoftAzure'),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x31f5('0x4')]('Outlook365',_0x31f5('0x5'))},'data1':{'type':Sequelize[_0x31f5('0x2')],'comment':'MicrosoftAzure\x20=>\x20client_id'},'data2':{'type':Sequelize['STRING'],'comment':_0x31f5('0x6')},'data3':{'type':Sequelize[_0x31f5('0x2')],'comment':'MicrosoftAzure\x20=>\x20client_secret'},'data4':{'type':Sequelize[_0x31f5('0x2')],'comment':'MicrosoftAzure\x20=>\x20redirect_uri'},'data5':{'type':Sequelize[_0x31f5('0x7')],'comment':_0x31f5('0x8')},'data6':{'type':Sequelize[_0x31f5('0x7')],'comment':'MicrosoftAzure\x20=>\x20refresh_token'}}; \ No newline at end of file +var _0x8314=['Dynamics365','MicrosoftAzure\x20=>\x20client_id','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','sequelize','exports','STRING','ENUM','AmazonAWS','Google','MicrosoftAzure'];(function(_0x2de84b,_0x32bd82){var _0x3d5943=function(_0x201289){while(--_0x201289){_0x2de84b['push'](_0x2de84b['shift']());}};_0x3d5943(++_0x32bd82);}(_0x8314,0x19d));var _0x4831=function(_0x204ed6,_0x1279c7){_0x204ed6=_0x204ed6-0x0;var _0x32c75d=_0x8314[_0x204ed6];return _0x32c75d;};'use strict';var Sequelize=require(_0x4831('0x0'));module[_0x4831('0x1')]={'name':{'type':Sequelize[_0x4831('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x4831('0x3')](_0x4831('0x4'),_0x4831('0x5'),_0x4831('0x6')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x4831('0x3')]('Outlook365',_0x4831('0x7'))},'data1':{'type':Sequelize[_0x4831('0x2')],'comment':_0x4831('0x8')},'data2':{'type':Sequelize[_0x4831('0x2')],'comment':'MicrosoftAzure\x20=>\x20tenant'},'data3':{'type':Sequelize['STRING'],'comment':'MicrosoftAzure\x20=>\x20client_secret'},'data4':{'type':Sequelize[_0x4831('0x2')],'comment':'MicrosoftAzure\x20=>\x20redirect_uri'},'data5':{'type':Sequelize[_0x4831('0x9')],'comment':_0x4831('0xa')},'data6':{'type':Sequelize['TEXT'],'comment':_0x4831('0xb')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index fe43eb7..b903fb6 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 _0x304a=['{TENANT_ID}','data2','code','id_token','from','stringify','toString','base64','randomBytes','hex','client_id','data1','response_type','join','data4','response_mode','scope','state','nonce','login','value','oauth2Claims','oauth2/','set','decode','payload','iss','issuer','aud','audience','isAfter','unix','data6','data3','POST','access_token','refresh_token','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s','oauth2MicrosoftAuthorize','user','oauth2MicrosoftCallback','get','Invalid\x20state\x20parameter','parse','Unable\x20to\x20validate\x20id_token','data5','bind','emit','microsoftAuthorization:success','Invalid\x20authentication\x20state\x20parameter','request-promise','lodash','moment','crypto','jsonwebtoken','ioredis','../../components/parsers/qs','../../config/environment','../../config/logger','api','../../mysqldb','defaults','redis','localhost','socket.io-emitter','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','/authorize','/token','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','then','destroy','error','stack','name','send','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','attributes','model','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','CloudProvider','includeAll','include','findAll','params','find','create','catch','update','body','replace'];(function(_0xef85d5,_0x5c4efe){var _0x387cd3=function(_0x1efd17){while(--_0x1efd17){_0xef85d5['push'](_0xef85d5['shift']());}};_0x387cd3(++_0x5c4efe);}(_0x304a,0x19a));var _0xa304=function(_0x51fbcd,_0x5d564d){_0x51fbcd=_0x51fbcd-0x0;var _0x25106a=_0x304a[_0x51fbcd];return _0x25106a;};'use strict';var rp=require(_0xa304('0x0'));var _=require(_0xa304('0x1'));var moment=require(_0xa304('0x2'));var crypto=require(_0xa304('0x3'));var jwt=require(_0xa304('0x4'));var Redis=require(_0xa304('0x5'));var qs=require(_0xa304('0x6'));var config=require(_0xa304('0x7'));var logger=require(_0xa304('0x8'))(_0xa304('0x9'));var db=require(_0xa304('0xa'))['db'];config['redis']=_[_0xa304('0xb')](config[_0xa304('0xc')],{'host':_0xa304('0xd'),'port':0x18eb});var socket=require(_0xa304('0xe'))(new Redis(config[_0xa304('0xc')]));var redis=new Redis(config[_0xa304('0xc')]);var MICROSOFT_AUTH_URL=_0xa304('0xf');var AZURE_AUTH_SCOPES={'Outlook365':[_0xa304('0x10'),'profile',_0xa304('0x11'),_0xa304('0x12'),_0xa304('0x13'),_0xa304('0x14'),'https://outlook.office.com/SMTP.Send'],'Dynamics365':['openid',_0xa304('0x12')]};var AZURE_TOKEN_SCOPES={'Outlook365':'https://outlook.office365.com/IMAP.AccessAsUser.All','Dynamics365':''};var MICROSOFT_AUTH_ENDPOINT=_0xa304('0x15');var MICROSOFT_TOKEN_ENDPOINT=_0xa304('0x16');function respondWithStatusCode(_0x32806a,_0x2acc50){_0x2acc50=_0x2acc50||0xcc;return function(_0x3995b6){if(_0x3995b6){return _0x32806a[_0xa304('0x17')](_0x2acc50);}return _0x32806a[_0xa304('0x18')](_0x2acc50)[_0xa304('0x19')]();};}function respondWithResult(_0x49c63e,_0x3ab97a){_0x3ab97a=_0x3ab97a||0xc8;return function(_0x4952f8){if(_0x4952f8){return _0x49c63e[_0xa304('0x18')](_0x3ab97a)[_0xa304('0x1a')](_0x4952f8);}};}function respondWithFilteredResult(_0x3746da,_0x4bc7a5){return function(_0x1c79ca){if(_0x1c79ca){var _0x423975=typeof _0x4bc7a5[_0xa304('0x1b')]===_0xa304('0x1c')&&typeof _0x4bc7a5[_0xa304('0x1d')]===_0xa304('0x1c');var _0xe1b137=_0x1c79ca[_0xa304('0x1e')];var _0x3096be=_0x423975?0x0:_0x4bc7a5[_0xa304('0x1b')];var _0x355677=_0x423975?_0x1c79ca[_0xa304('0x1e')]:_0x4bc7a5[_0xa304('0x1b')]+_0x4bc7a5[_0xa304('0x1d')];var _0x65be9b;if(_0x355677>=_0xe1b137){_0x355677=_0xe1b137;_0x65be9b=0xc8;}else{_0x65be9b=0xce;}_0x3746da['status'](_0x65be9b);return _0x3746da['set'](_0xa304('0x1f'),_0x3096be+'-'+_0x355677+'/'+_0xe1b137)[_0xa304('0x1a')](_0x1c79ca);}return null;};}function saveUpdates(_0x3626fd){return function(_0x37b317){if(_0x37b317){return _0x37b317['update'](_0x3626fd)[_0xa304('0x20')](function(_0x1ed68d){return _0x1ed68d;});}return null;};}function removeEntity(_0x131f8d){return function(_0x35d841){if(_0x35d841){return _0x35d841[_0xa304('0x21')]()['then'](function(){_0x131f8d[_0xa304('0x18')](0xcc)[_0xa304('0x19')]();});}};}function handleEntityNotFound(_0x3e5d5c){return function(_0x40d27a){if(!_0x40d27a){_0x3e5d5c[_0xa304('0x17')](0x194);}return _0x40d27a;};}function handleError(_0x2f6d4e,_0x5d8bc3){_0x5d8bc3=_0x5d8bc3||0x1f4;return function(_0x131fdd){logger[_0xa304('0x22')](_0x131fdd[_0xa304('0x23')]);if(_0x131fdd[_0xa304('0x24')]){delete _0x131fdd[_0xa304('0x24')];}_0x2f6d4e[_0xa304('0x18')](_0x5d8bc3)[_0xa304('0x25')](_0x131fdd);};}exports['index']=function(_0x5dd112,_0x32f8fb){var _0x26f037={},_0x3670e0={},_0x56ec3c={'count':0x0,'rows':[]};var _0x17d5a9=_['map'](db['CloudProvider'][_0xa304('0x26')],function(_0x3f9c8e){return{'name':_0x3f9c8e[_0xa304('0x27')],'type':_0x3f9c8e[_0xa304('0x28')][_0xa304('0x29')]};});_0x3670e0['model']=_[_0xa304('0x2a')](_0x17d5a9,_0xa304('0x24'));_0x3670e0[_0xa304('0x2b')]=_[_0xa304('0x2c')](_0x5dd112[_0xa304('0x2b')]);_0x3670e0[_0xa304('0x2d')]=_[_0xa304('0x2e')](_0x3670e0['model'],_0x3670e0[_0xa304('0x2b')]);_0x26f037[_0xa304('0x2f')]=_[_0xa304('0x2e')](_0x3670e0[_0xa304('0x30')],qs[_0xa304('0x31')](_0x5dd112[_0xa304('0x2b')][_0xa304('0x31')]));_0x26f037[_0xa304('0x2f')]=_0x26f037[_0xa304('0x2f')][_0xa304('0x32')]?_0x26f037[_0xa304('0x2f')]:_0x3670e0['model'];if(!_0x5dd112[_0xa304('0x2b')]['hasOwnProperty'](_0xa304('0x33'))){_0x26f037[_0xa304('0x1d')]=qs[_0xa304('0x1d')](_0x5dd112[_0xa304('0x2b')]['limit']);_0x26f037['offset']=qs[_0xa304('0x1b')](_0x5dd112['query']['offset']);}_0x26f037[_0xa304('0x34')]=qs[_0xa304('0x35')](_0x5dd112['query']['sort']);_0x26f037[_0xa304('0x36')]=qs['filters'](_['pick'](_0x5dd112['query'],_0x3670e0[_0xa304('0x2d')]),_0x17d5a9);if(_0x5dd112['query'][_0xa304('0x37')]){_0x26f037['where']=_[_0xa304('0x38')](_0x26f037[_0xa304('0x36')],{'$or':_[_0xa304('0x2a')](_0x17d5a9,function(_0x23415c){if(_0x23415c[_0xa304('0x28')]!==_0xa304('0x39')){var _0x801e={};_0x801e[_0x23415c[_0xa304('0x24')]]={'$like':'%'+_0x5dd112[_0xa304('0x2b')]['filter']+'%'};return _0x801e;}})});}_0x26f037=_['merge']({},_0x26f037,_0x5dd112[_0xa304('0x3a')]);var _0x4f6b83={'where':_0x26f037[_0xa304('0x36')]};return db[_0xa304('0x3b')][_0xa304('0x1e')](_0x4f6b83)[_0xa304('0x20')](function(_0x35fa68){_0x56ec3c[_0xa304('0x1e')]=_0x35fa68;if(_0x5dd112['query'][_0xa304('0x3c')]){_0x26f037[_0xa304('0x3d')]=[{'all':!![]}];}return db[_0xa304('0x3b')][_0xa304('0x3e')](_0x26f037);})[_0xa304('0x20')](function(_0x294178){_0x56ec3c['rows']=_0x294178;return _0x56ec3c;})[_0xa304('0x20')](respondWithFilteredResult(_0x32f8fb,_0x26f037))['catch'](handleError(_0x32f8fb,null));};exports['show']=function(_0x17abcf,_0x4352e0){var _0x424ed0={'raw':!![],'where':{'id':_0x17abcf[_0xa304('0x3f')]['id']}},_0xa7bc54={};_0xa7bc54[_0xa304('0x30')]=_[_0xa304('0x2c')](db[_0xa304('0x3b')]['rawAttributes']);_0xa7bc54[_0xa304('0x2b')]=_[_0xa304('0x2c')](_0x17abcf[_0xa304('0x2b')]);_0xa7bc54['filters']=_['intersection'](_0xa7bc54[_0xa304('0x30')],_0xa7bc54['query']);_0x424ed0[_0xa304('0x2f')]=_['intersection'](_0xa7bc54[_0xa304('0x30')],qs[_0xa304('0x31')](_0x17abcf['query'][_0xa304('0x31')]));_0x424ed0[_0xa304('0x2f')]=_0x424ed0[_0xa304('0x2f')][_0xa304('0x32')]?_0x424ed0[_0xa304('0x2f')]:_0xa7bc54[_0xa304('0x30')];if(_0x17abcf['query']['includeAll']){_0x424ed0['include']=[{'all':!![]}];}_0x424ed0=_[_0xa304('0x38')]({},_0x424ed0,_0x17abcf[_0xa304('0x3a')]);return db['CloudProvider'][_0xa304('0x40')](_0x424ed0)[_0xa304('0x20')](handleEntityNotFound(_0x4352e0,null))[_0xa304('0x20')](respondWithResult(_0x4352e0,null))['catch'](handleError(_0x4352e0,null));};exports[_0xa304('0x41')]=function(_0x3352dd,_0x1ed1e7){return db[_0xa304('0x3b')]['create'](_0x3352dd['body'],{})[_0xa304('0x20')](respondWithResult(_0x1ed1e7,0xc9))[_0xa304('0x42')](handleError(_0x1ed1e7,null));};exports[_0xa304('0x43')]=function(_0x4976a3,_0x28f2bd){if(_0x4976a3['body']['id']){delete _0x4976a3[_0xa304('0x44')]['id'];}return db[_0xa304('0x3b')][_0xa304('0x40')]({'where':{'id':_0x4976a3[_0xa304('0x3f')]['id']}})[_0xa304('0x20')](handleEntityNotFound(_0x28f2bd,null))[_0xa304('0x20')](saveUpdates(_0x4976a3[_0xa304('0x44')],null))['then'](respondWithResult(_0x28f2bd,null))[_0xa304('0x42')](handleError(_0x28f2bd,null));};exports[_0xa304('0x21')]=function(_0x269798,_0x5efc5a){return db[_0xa304('0x3b')][_0xa304('0x40')]({'where':{'id':_0x269798[_0xa304('0x3f')]['id']}})['then'](handleEntityNotFound(_0x5efc5a,null))['then'](removeEntity(_0x5efc5a,null))[_0xa304('0x42')](handleError(_0x5efc5a,null));};function generateMicrosoftAuthorizationUrl(_0x7319db,_0x5b6d71){var _0x58c94e=MICROSOFT_AUTH_URL[_0xa304('0x45')](_0xa304('0x46'),_0x7319db[_0xa304('0x47')]);var _0x4722ef=[_0xa304('0x48'),_0xa304('0x49')];var _0x1baa7e=Buffer[_0xa304('0x4a')](JSON[_0xa304('0x4b')]({'id':_0x5b6d71}))[_0xa304('0x4c')](_0xa304('0x4d'));var _0x53c220=crypto[_0xa304('0x4e')](0x10)[_0xa304('0x4c')](_0xa304('0x4f'));var _0x61d024=[{'key':_0xa304('0x50'),'value':_0x7319db[_0xa304('0x51')]},{'key':_0xa304('0x52'),'value':encodeURIComponent(_0x4722ef[_0xa304('0x53')]('\x20'))},{'key':'redirect_uri','value':_0x7319db[_0xa304('0x54')]},{'key':_0xa304('0x55'),'value':'form_post'},{'key':_0xa304('0x56'),'value':encodeURIComponent(AZURE_AUTH_SCOPES[_0x7319db[_0xa304('0x28')]][_0xa304('0x53')]('\x20'))},{'key':_0xa304('0x57'),'value':_0x1baa7e},{'key':_0xa304('0x58'),'value':_0x53c220},{'key':'prompt','value':_0xa304('0x59')}];var _0x5bb751=_0x58c94e+MICROSOFT_AUTH_ENDPOINT+'?'+_['map'](_0x61d024,function(_0x216ebc){return _0x216ebc[_0xa304('0x29')]+'='+_0x216ebc[_0xa304('0x5a')];})[_0xa304('0x53')]('&');_0x7319db[_0xa304('0x5b')]={'issuer':_0x58c94e['replace'](_0xa304('0x5c'),''),'audience':_0x7319db[_0xa304('0x51')],'state':_0x1baa7e,'nonce':_0x53c220};redis[_0xa304('0x5d')](_0x1baa7e,JSON[_0xa304('0x4b')](_0x7319db));return _0x5bb751;}function isValidIdToken(_0xec8db8,_0x51a05c){try{var _0x2599b1=jwt[_0xa304('0x5e')](_0xec8db8,{'complete':!![]});var _0xc6c3bf=_0x2599b1[_0xa304('0x5f')];if(_0xc6c3bf[_0xa304('0x60')]!==_0x51a05c[_0xa304('0x61')])return![];if(_0xc6c3bf[_0xa304('0x62')]!==_0x51a05c[_0xa304('0x63')])return![];if(_0xc6c3bf[_0xa304('0x58')]!==_0x51a05c[_0xa304('0x58')])return![];if(moment()[_0xa304('0x64')](moment[_0xa304('0x65')](_0xc6c3bf['exp'])))return![];return!![];}catch(_0x2412d){throw _0x2412d;}}function refreshOauth2MicrosoftAccessToken(_0xc15596){var _0xc2909e={'grant_type':'refresh_token','refresh_token':_0xc15596[_0xa304('0x66')],'scope':AZURE_TOKEN_SCOPES[_0xc15596[_0xa304('0x28')]],'redirect_uri':_0xc15596[_0xa304('0x54')],'client_id':_0xc15596[_0xa304('0x51')],'client_secret':_0xc15596[_0xa304('0x67')]};var _0x2c936f={'method':_0xa304('0x68'),'uri':MICROSOFT_AUTH_URL[_0xa304('0x45')](_0xa304('0x46'),_0xc15596[_0xa304('0x47')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0xc2909e,'json':!![]};return rp(_0x2c936f)[_0xa304('0x20')](function(_0x51edd6){return db[_0xa304('0x3b')][_0xa304('0x43')]({'data5':_0x51edd6[_0xa304('0x69')],'data6':_0x51edd6[_0xa304('0x6a')]},{'where':{'id':_0xc15596['id']}});})[_0xa304('0x42')](function(_0xb981ba){logger[_0xa304('0x22')](_0xa304('0x6b'),_0xc15596['id'],_0xb981ba);});}function getOauth2MicrosoftAccessToken(_0x795c1b,_0x212881){var _0x351665={'grant_type':'authorization_code','code':_0x795c1b,'scope':AZURE_TOKEN_SCOPES[_0x212881[_0xa304('0x28')]],'redirect_uri':_0x212881[_0xa304('0x54')],'client_id':_0x212881[_0xa304('0x51')],'client_secret':_0x212881[_0xa304('0x67')]};var _0xd17322={'method':_0xa304('0x68'),'uri':MICROSOFT_AUTH_URL[_0xa304('0x45')](_0xa304('0x46'),_0x212881['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x351665,'json':!![]};return rp(_0xd17322);}exports[_0xa304('0x6c')]=function(_0x52eda4,_0x3c4ffd){return db[_0xa304('0x3b')]['findOne']({'where':{'id':_0x52eda4[_0xa304('0x3f')]['id']},'raw':!![]})[_0xa304('0x20')](function(_0x21c435){if(!_0x21c435)return _0x3c4ffd[_0xa304('0x17')](0x194);return{'url':generateMicrosoftAuthorizationUrl(_0x21c435,_0x52eda4[_0xa304('0x6d')]['id'])};})[_0xa304('0x20')](respondWithResult(_0x3c4ffd,null))['catch'](handleError(_0x3c4ffd,null));};exports[_0xa304('0x6e')]=function(_0x126490,_0x114092){var _0x2a6298=_0x126490[_0xa304('0x44')];var _0x24b6f4;var _0xe061b0;if(_0x2a6298[_0xa304('0x22')])throw _0x2a6298;redis[_0xa304('0x6f')](_0x2a6298[_0xa304('0x57')])[_0xa304('0x20')](function(_0x16e0f3){if(!_0x16e0f3)throw new Error(_0xa304('0x70'));_0x24b6f4=JSON[_0xa304('0x71')](_0x16e0f3);var _0x3828b7=Buffer[_0xa304('0x4a')](_0x2a6298[_0xa304('0x57')],_0xa304('0x4d'))[_0xa304('0x4c')]('ascii');_0xe061b0=JSON['parse'](_0x3828b7);if(!isValidIdToken(_0x2a6298['id_token'],_0x24b6f4['oauth2Claims']))throw new Error(_0xa304('0x72'));redis['del'](_0x2a6298[_0xa304('0x57')]);return getOauth2MicrosoftAccessToken(_0x2a6298[_0xa304('0x48')],_0x24b6f4);})[_0xa304('0x20')](function(_0x454b55){_0x24b6f4[_0xa304('0x73')]=_0x454b55[_0xa304('0x69')];_0x24b6f4[_0xa304('0x66')]=_0x454b55[_0xa304('0x6a')];return db[_0xa304('0x3b')][_0xa304('0x43')]({'data5':_0x24b6f4[_0xa304('0x73')],'data6':_0x24b6f4['data6']},{'where':{'id':_0x24b6f4['id']}});})[_0xa304('0x20')](function(){setInterval(refreshOauth2MicrosoftAccessToken[_0xa304('0x74')](this,_0x24b6f4),0xfa*0x3e8);socket[_0xa304('0x75')](_0xa304('0x76'),{'id':_0xe061b0['id']});return;})[_0xa304('0x20')](respondWithStatusCode(_0x114092,null))[_0xa304('0x42')](function(_0x5a9745){if(_0xe061b0){socket[_0xa304('0x75')]('microsoftAuthorization:error',{'id':_0xe061b0['id']});}if(!_0x24b6f4){logger[_0xa304('0x22')](_0xa304('0x77'),_0x5a9745);return _0x114092[_0xa304('0x18')](0x1f4)[_0xa304('0x25')](_0x5a9745['message']);}logger['error']('Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s',_0x24b6f4['id'],_0x5a9745);});}; \ No newline at end of file +var _0x50e4=['destroy','error','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','CloudProvider','catch','params','find','create','body','replace','data2','id_token','from','stringify','toString','base64','randomBytes','client_id','response_type','join','redirect_uri','response_mode','form_post','scope','prompt','login','value','oauth2Claims','data1','decode','payload','iss','issuer','aud','nonce','isAfter','unix','exp','refresh_token','data6','data3','POST','access_token','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s','{TENANT_ID}','findOne','user','oauth2MicrosoftCallback','get','state','parse','ascii','Unable\x20to\x20validate\x20id_token','del','code','data5','emit','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s','request-promise','lodash','jsonwebtoken','ioredis','../../components/parsers/qs','../../config/environment','api','redis','defaults','localhost','socket.io-emitter','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','/token','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','update','then'];(function(_0x5e3ef9,_0x2e9ab6){var _0x3bc522=function(_0x2261ed){while(--_0x2261ed){_0x5e3ef9['push'](_0x5e3ef9['shift']());}};_0x3bc522(++_0x2e9ab6);}(_0x50e4,0x1c5));var _0x450e=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0x50e4[_0x32f7d7];return _0x133d09;};'use strict';var rp=require(_0x450e('0x0'));var _=require(_0x450e('0x1'));var moment=require('moment');var crypto=require('crypto');var jwt=require(_0x450e('0x2'));var Redis=require(_0x450e('0x3'));var qs=require(_0x450e('0x4'));var config=require(_0x450e('0x5'));var logger=require('../../config/logger')(_0x450e('0x6'));var db=require('../../mysqldb')['db'];config[_0x450e('0x7')]=_[_0x450e('0x8')](config[_0x450e('0x7')],{'host':_0x450e('0x9'),'port':0x18eb});var socket=require(_0x450e('0xa'))(new Redis(config[_0x450e('0x7')]));var redis=new Redis(config[_0x450e('0x7')]);var MICROSOFT_AUTH_URL='https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0';var AZURE_AUTH_SCOPES={'Outlook365':[_0x450e('0xb'),_0x450e('0xc'),_0x450e('0xd'),_0x450e('0xe'),_0x450e('0xf'),_0x450e('0x10'),_0x450e('0x11')],'Dynamics365':[_0x450e('0xb'),'offline_access']};var AZURE_TOKEN_SCOPES={'Outlook365':_0x450e('0xf'),'Dynamics365':''};var MICROSOFT_AUTH_ENDPOINT=_0x450e('0x12');var MICROSOFT_TOKEN_ENDPOINT=_0x450e('0x13');function respondWithStatusCode(_0x342e06,_0x58af85){_0x58af85=_0x58af85||0xcc;return function(_0x568417){if(_0x568417){return _0x342e06[_0x450e('0x14')](_0x58af85);}return _0x342e06[_0x450e('0x15')](_0x58af85)[_0x450e('0x16')]();};}function respondWithResult(_0x2e9e75,_0x120301){_0x120301=_0x120301||0xc8;return function(_0x150905){if(_0x150905){return _0x2e9e75['status'](_0x120301)[_0x450e('0x17')](_0x150905);}};}function respondWithFilteredResult(_0x500238,_0x31a96f){return function(_0x561df7){if(_0x561df7){var _0x569a97=typeof _0x31a96f[_0x450e('0x18')]===_0x450e('0x19')&&typeof _0x31a96f['limit']===_0x450e('0x19');var _0x2638ee=_0x561df7[_0x450e('0x1a')];var _0xab35e1=_0x569a97?0x0:_0x31a96f[_0x450e('0x18')];var _0x1e655a=_0x569a97?_0x561df7['count']:_0x31a96f['offset']+_0x31a96f['limit'];var _0x144fd3;if(_0x1e655a>=_0x2638ee){_0x1e655a=_0x2638ee;_0x144fd3=0xc8;}else{_0x144fd3=0xce;}_0x500238[_0x450e('0x15')](_0x144fd3);return _0x500238[_0x450e('0x1b')](_0x450e('0x1c'),_0xab35e1+'-'+_0x1e655a+'/'+_0x2638ee)[_0x450e('0x17')](_0x561df7);}return null;};}function saveUpdates(_0x39a448){return function(_0x31473a){if(_0x31473a){return _0x31473a[_0x450e('0x1d')](_0x39a448)[_0x450e('0x1e')](function(_0x50a3da){return _0x50a3da;});}return null;};}function removeEntity(_0x3a6dce){return function(_0x4054c6){if(_0x4054c6){return _0x4054c6[_0x450e('0x1f')]()[_0x450e('0x1e')](function(){_0x3a6dce[_0x450e('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x123e63){return function(_0x5d8095){if(!_0x5d8095){_0x123e63[_0x450e('0x14')](0x194);}return _0x5d8095;};}function handleError(_0x354b68,_0x328a8a){_0x328a8a=_0x328a8a||0x1f4;return function(_0x4f1342){logger[_0x450e('0x20')](_0x4f1342['stack']);if(_0x4f1342[_0x450e('0x21')]){delete _0x4f1342[_0x450e('0x21')];}_0x354b68[_0x450e('0x15')](_0x328a8a)[_0x450e('0x22')](_0x4f1342);};}exports[_0x450e('0x23')]=function(_0x4bcc72,_0x805fb0){var _0x3e9247={},_0x205c98={},_0x5c6967={'count':0x0,'rows':[]};var _0x2c708a=_[_0x450e('0x24')](db['CloudProvider'][_0x450e('0x25')],function(_0x1718d6){return{'name':_0x1718d6[_0x450e('0x26')],'type':_0x1718d6['type'][_0x450e('0x27')]};});_0x205c98[_0x450e('0x28')]=_[_0x450e('0x24')](_0x2c708a,_0x450e('0x21'));_0x205c98[_0x450e('0x29')]=_[_0x450e('0x2a')](_0x4bcc72[_0x450e('0x29')]);_0x205c98[_0x450e('0x2b')]=_['intersection'](_0x205c98[_0x450e('0x28')],_0x205c98['query']);_0x3e9247['attributes']=_[_0x450e('0x2c')](_0x205c98['model'],qs[_0x450e('0x2d')](_0x4bcc72[_0x450e('0x29')][_0x450e('0x2d')]));_0x3e9247['attributes']=_0x3e9247['attributes'][_0x450e('0x2e')]?_0x3e9247[_0x450e('0x2f')]:_0x205c98['model'];if(!_0x4bcc72[_0x450e('0x29')][_0x450e('0x30')](_0x450e('0x31'))){_0x3e9247[_0x450e('0x32')]=qs['limit'](_0x4bcc72[_0x450e('0x29')][_0x450e('0x32')]);_0x3e9247[_0x450e('0x18')]=qs[_0x450e('0x18')](_0x4bcc72[_0x450e('0x29')][_0x450e('0x18')]);}_0x3e9247[_0x450e('0x33')]=qs['sort'](_0x4bcc72[_0x450e('0x29')][_0x450e('0x34')]);_0x3e9247['where']=qs[_0x450e('0x2b')](_[_0x450e('0x35')](_0x4bcc72[_0x450e('0x29')],_0x205c98['filters']),_0x2c708a);if(_0x4bcc72[_0x450e('0x29')][_0x450e('0x36')]){_0x3e9247[_0x450e('0x37')]=_[_0x450e('0x38')](_0x3e9247[_0x450e('0x37')],{'$or':_['map'](_0x2c708a,function(_0xaca7b2){if(_0xaca7b2[_0x450e('0x39')]!==_0x450e('0x3a')){var _0x547461={};_0x547461[_0xaca7b2['name']]={'$like':'%'+_0x4bcc72[_0x450e('0x29')]['filter']+'%'};return _0x547461;}})});}_0x3e9247=_[_0x450e('0x38')]({},_0x3e9247,_0x4bcc72[_0x450e('0x3b')]);var _0x42e271={'where':_0x3e9247[_0x450e('0x37')]};return db['CloudProvider'][_0x450e('0x1a')](_0x42e271)[_0x450e('0x1e')](function(_0x4caf7e){_0x5c6967[_0x450e('0x1a')]=_0x4caf7e;if(_0x4bcc72[_0x450e('0x29')][_0x450e('0x3c')]){_0x3e9247[_0x450e('0x3d')]=[{'all':!![]}];}return db[_0x450e('0x3e')]['findAll'](_0x3e9247);})[_0x450e('0x1e')](function(_0x36b6fc){_0x5c6967['rows']=_0x36b6fc;return _0x5c6967;})[_0x450e('0x1e')](respondWithFilteredResult(_0x805fb0,_0x3e9247))[_0x450e('0x3f')](handleError(_0x805fb0,null));};exports['show']=function(_0x25399c,_0x48edb2){var _0x598e40={'raw':!![],'where':{'id':_0x25399c[_0x450e('0x40')]['id']}},_0x375fe2={};_0x375fe2['model']=_[_0x450e('0x2a')](db[_0x450e('0x3e')]['rawAttributes']);_0x375fe2[_0x450e('0x29')]=_[_0x450e('0x2a')](_0x25399c[_0x450e('0x29')]);_0x375fe2['filters']=_[_0x450e('0x2c')](_0x375fe2[_0x450e('0x28')],_0x375fe2[_0x450e('0x29')]);_0x598e40['attributes']=_[_0x450e('0x2c')](_0x375fe2[_0x450e('0x28')],qs[_0x450e('0x2d')](_0x25399c[_0x450e('0x29')][_0x450e('0x2d')]));_0x598e40[_0x450e('0x2f')]=_0x598e40[_0x450e('0x2f')][_0x450e('0x2e')]?_0x598e40[_0x450e('0x2f')]:_0x375fe2[_0x450e('0x28')];if(_0x25399c[_0x450e('0x29')][_0x450e('0x3c')]){_0x598e40['include']=[{'all':!![]}];}_0x598e40=_['merge']({},_0x598e40,_0x25399c[_0x450e('0x3b')]);return db['CloudProvider'][_0x450e('0x41')](_0x598e40)[_0x450e('0x1e')](handleEntityNotFound(_0x48edb2,null))[_0x450e('0x1e')](respondWithResult(_0x48edb2,null))[_0x450e('0x3f')](handleError(_0x48edb2,null));};exports[_0x450e('0x42')]=function(_0x515d2c,_0x122924){return db[_0x450e('0x3e')][_0x450e('0x42')](_0x515d2c['body'],{})[_0x450e('0x1e')](respondWithResult(_0x122924,0xc9))['catch'](handleError(_0x122924,null));};exports[_0x450e('0x1d')]=function(_0x32db2c,_0x57fe6c){if(_0x32db2c[_0x450e('0x43')]['id']){delete _0x32db2c['body']['id'];}return db[_0x450e('0x3e')][_0x450e('0x41')]({'where':{'id':_0x32db2c[_0x450e('0x40')]['id']}})[_0x450e('0x1e')](handleEntityNotFound(_0x57fe6c,null))['then'](saveUpdates(_0x32db2c[_0x450e('0x43')],null))[_0x450e('0x1e')](respondWithResult(_0x57fe6c,null))[_0x450e('0x3f')](handleError(_0x57fe6c,null));};exports[_0x450e('0x1f')]=function(_0x1c2dc4,_0x564063){return db['CloudProvider'][_0x450e('0x41')]({'where':{'id':_0x1c2dc4[_0x450e('0x40')]['id']}})[_0x450e('0x1e')](handleEntityNotFound(_0x564063,null))[_0x450e('0x1e')](removeEntity(_0x564063,null))[_0x450e('0x3f')](handleError(_0x564063,null));};function generateMicrosoftAuthorizationUrl(_0x18537c,_0x4f6b7b){var _0x3fd546=MICROSOFT_AUTH_URL[_0x450e('0x44')]('{TENANT_ID}',_0x18537c[_0x450e('0x45')]);var _0x58dedb=['code',_0x450e('0x46')];var _0x290476=Buffer[_0x450e('0x47')](JSON[_0x450e('0x48')]({'id':_0x4f6b7b}))[_0x450e('0x49')](_0x450e('0x4a'));var _0x1b21ad=crypto[_0x450e('0x4b')](0x10)[_0x450e('0x49')]('hex');var _0x521c0c=[{'key':_0x450e('0x4c'),'value':_0x18537c['data1']},{'key':_0x450e('0x4d'),'value':encodeURIComponent(_0x58dedb[_0x450e('0x4e')]('\x20'))},{'key':_0x450e('0x4f'),'value':_0x18537c['data4']},{'key':_0x450e('0x50'),'value':_0x450e('0x51')},{'key':_0x450e('0x52'),'value':encodeURIComponent(AZURE_AUTH_SCOPES[_0x18537c[_0x450e('0x39')]][_0x450e('0x4e')]('\x20'))},{'key':'state','value':_0x290476},{'key':'nonce','value':_0x1b21ad},{'key':_0x450e('0x53'),'value':_0x450e('0x54')}];var _0x5603e9=_0x3fd546+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x450e('0x24')](_0x521c0c,function(_0x3a85fb){return _0x3a85fb['key']+'='+_0x3a85fb[_0x450e('0x55')];})[_0x450e('0x4e')]('&');_0x18537c[_0x450e('0x56')]={'issuer':_0x3fd546[_0x450e('0x44')]('oauth2/',''),'audience':_0x18537c[_0x450e('0x57')],'state':_0x290476,'nonce':_0x1b21ad};redis[_0x450e('0x1b')](_0x290476,JSON['stringify'](_0x18537c));return _0x5603e9;}function isValidIdToken(_0x51f28e,_0x599a34){try{var _0x3ec3a3=jwt[_0x450e('0x58')](_0x51f28e,{'complete':!![]});var _0x2237fb=_0x3ec3a3[_0x450e('0x59')];if(_0x2237fb[_0x450e('0x5a')]!==_0x599a34[_0x450e('0x5b')])return![];if(_0x2237fb[_0x450e('0x5c')]!==_0x599a34['audience'])return![];if(_0x2237fb[_0x450e('0x5d')]!==_0x599a34[_0x450e('0x5d')])return![];if(moment()[_0x450e('0x5e')](moment[_0x450e('0x5f')](_0x2237fb[_0x450e('0x60')])))return![];return!![];}catch(_0x3ccce6){throw _0x3ccce6;}}function refreshOauth2MicrosoftAccessToken(_0x4ce00f){var _0x55fa6f={'grant_type':_0x450e('0x61'),'refresh_token':_0x4ce00f[_0x450e('0x62')],'scope':AZURE_TOKEN_SCOPES[_0x4ce00f[_0x450e('0x39')]],'redirect_uri':_0x4ce00f['data4'],'client_id':_0x4ce00f[_0x450e('0x57')],'client_secret':_0x4ce00f[_0x450e('0x63')]};var _0xb8a894={'method':_0x450e('0x64'),'uri':MICROSOFT_AUTH_URL[_0x450e('0x44')]('{TENANT_ID}',_0x4ce00f[_0x450e('0x45')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x55fa6f,'json':!![]};return rp(_0xb8a894)['then'](function(_0x5d493b){return db['CloudProvider'][_0x450e('0x1d')]({'data5':_0x5d493b[_0x450e('0x65')],'data6':_0x5d493b['refresh_token']},{'where':{'id':_0x4ce00f['id']}});})[_0x450e('0x3f')](function(_0x318b8e){logger[_0x450e('0x20')](_0x450e('0x66'),_0x4ce00f['id'],_0x318b8e);});}function getOauth2MicrosoftAccessToken(_0x5684e7,_0x48b6c7){var _0x21465a={'grant_type':'authorization_code','code':_0x5684e7,'scope':AZURE_TOKEN_SCOPES[_0x48b6c7[_0x450e('0x39')]],'redirect_uri':_0x48b6c7['data4'],'client_id':_0x48b6c7[_0x450e('0x57')],'client_secret':_0x48b6c7[_0x450e('0x63')]};var _0x4a289c={'method':'POST','uri':MICROSOFT_AUTH_URL['replace'](_0x450e('0x67'),_0x48b6c7['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x21465a,'json':!![]};return rp(_0x4a289c);}exports['oauth2MicrosoftAuthorize']=function(_0xd5d4a,_0x31b487){return db[_0x450e('0x3e')][_0x450e('0x68')]({'where':{'id':_0xd5d4a['params']['id']},'raw':!![]})['then'](function(_0x59bb0b){if(!_0x59bb0b)return _0x31b487[_0x450e('0x14')](0x194);return{'url':generateMicrosoftAuthorizationUrl(_0x59bb0b,_0xd5d4a[_0x450e('0x69')]['id'])};})['then'](respondWithResult(_0x31b487,null))['catch'](handleError(_0x31b487,null));};exports[_0x450e('0x6a')]=function(_0x7f49bd,_0x2050ce){var _0x1671f9=_0x7f49bd[_0x450e('0x43')];var _0x402b54;var _0x27e227;if(_0x1671f9[_0x450e('0x20')])throw _0x1671f9;redis[_0x450e('0x6b')](_0x1671f9[_0x450e('0x6c')])[_0x450e('0x1e')](function(_0x293a62){if(!_0x293a62)throw new Error('Invalid\x20state\x20parameter');_0x402b54=JSON[_0x450e('0x6d')](_0x293a62);var _0x2d2689=Buffer['from'](_0x1671f9[_0x450e('0x6c')],_0x450e('0x4a'))[_0x450e('0x49')](_0x450e('0x6e'));_0x27e227=JSON[_0x450e('0x6d')](_0x2d2689);if(!isValidIdToken(_0x1671f9[_0x450e('0x46')],_0x402b54[_0x450e('0x56')]))throw new Error(_0x450e('0x6f'));redis[_0x450e('0x70')](_0x1671f9[_0x450e('0x6c')]);return getOauth2MicrosoftAccessToken(_0x1671f9[_0x450e('0x71')],_0x402b54);})['then'](function(_0x27abd9){_0x402b54[_0x450e('0x72')]=_0x27abd9[_0x450e('0x65')];_0x402b54[_0x450e('0x62')]=_0x27abd9[_0x450e('0x61')];return db[_0x450e('0x3e')]['update']({'data5':_0x402b54[_0x450e('0x72')],'data6':_0x402b54[_0x450e('0x62')]},{'where':{'id':_0x402b54['id']}});})['then'](function(){setInterval(refreshOauth2MicrosoftAccessToken['bind'](this,_0x402b54),0xfa*0x3e8);socket[_0x450e('0x73')](_0x450e('0x74'),{'id':_0x27e227['id']});return;})[_0x450e('0x1e')](respondWithStatusCode(_0x2050ce,null))[_0x450e('0x3f')](function(_0xf1554){if(_0x27e227){socket[_0x450e('0x73')](_0x450e('0x75'),{'id':_0x27e227['id']});}if(!_0x402b54){logger[_0x450e('0x20')](_0x450e('0x76'),_0xf1554);return _0x2050ce[_0x450e('0x15')](0x1f4)[_0x450e('0x22')](_0xf1554[_0x450e('0x77')]);}logger[_0x450e('0x20')](_0x450e('0x78'),_0x402b54['id'],_0xf1554);});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 6982d9d..5a2fcab 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 _0xf65a=['lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./cloudProvider.attributes','define','CloudProvider'];(function(_0x2dc817,_0x28c714){var _0x494cea=function(_0x1cb107){while(--_0x1cb107){_0x2dc817['push'](_0x2dc817['shift']());}};_0x494cea(++_0x28c714);}(_0xf65a,0xbb));var _0xaf65=function(_0x317c08,_0x8eac60){_0x317c08=_0x317c08-0x0;var _0x514b5b=_0xf65a[_0x317c08];return _0x514b5b;};'use strict';var _=require(_0xaf65('0x0'));var util=require(_0xaf65('0x1'));var logger=require(_0xaf65('0x2'))(_0xaf65('0x3'));var moment=require(_0xaf65('0x4'));var BPromise=require('bluebird');var rp=require(_0xaf65('0x5'));var fs=require('fs');var path=require(_0xaf65('0x6'));var rimraf=require('rimraf');var config=require(_0xaf65('0x7'));var attributes=require(_0xaf65('0x8'));module['exports']=function(_0x19b7ff,_0x2787a8){return _0x19b7ff[_0xaf65('0x9')](_0xaf65('0xa'),attributes,{'tableName':'cloud_providers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa98a=['CloudProvider','api','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x452d8c,_0x376ea5){var _0x1cd191=function(_0xde7da2){while(--_0xde7da2){_0x452d8c['push'](_0x452d8c['shift']());}};_0x1cd191(++_0x376ea5);}(_0xa98a,0x1e1));var _0xaa98=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa98a[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xaa98('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xaa98('0x1'));var fs=require('fs');var path=require(_0xaa98('0x2'));var rimraf=require(_0xaa98('0x3'));var config=require(_0xaa98('0x4'));var attributes=require('./cloudProvider.attributes');module[_0xaa98('0x5')]=function(_0x2d28bc,_0x22494d){return _0x2d28bc[_0xaa98('0x6')](_0xaa98('0x7'),attributes,{'tableName':'cloud_providers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index 3b0c2ea..dd497a5 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 _0xfaf2=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','info','debug','CloudProvider,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','CloudProvider,\x20%s,\x20%s','message','result'];(function(_0x16f72a,_0x19065d){var _0x28fcab=function(_0x17136e){while(--_0x17136e){_0x16f72a['push'](_0x16f72a['shift']());}};_0x28fcab(++_0x19065d);}(_0xfaf2,0x169));var _0x2faf=function(_0x2423c5,_0x17425f){_0x2423c5=_0x2423c5-0x0;var _0xe384a7=_0xfaf2[_0x2423c5];return _0xe384a7;};'use strict';var _=require(_0x2faf('0x0'));var util=require(_0x2faf('0x1'));var moment=require(_0x2faf('0x2'));var BPromise=require(_0x2faf('0x3'));var rs=require(_0x2faf('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2faf('0x5'))['db'];var utils=require(_0x2faf('0x6'));var logger=require(_0x2faf('0x7'))(_0x2faf('0x8'));var config=require(_0x2faf('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x32cdb3,_0x43128c,_0x1d3420){return new BPromise(function(_0x1522cb,_0x3f5c12){return client['request'](_0x32cdb3,_0x1d3420)['then'](function(_0x9c958c){logger[_0x2faf('0xa')]('CloudProvider,\x20%s,\x20%s',_0x43128c,'request\x20sent');logger[_0x2faf('0xb')](_0x2faf('0xc'),_0x43128c,_0x2faf('0xd'),JSON['stringify'](_0x9c958c));if(_0x9c958c['error']){if(_0x9c958c[_0x2faf('0xe')][_0x2faf('0xf')]===0x1f4){logger['error'](_0x2faf('0x10'),_0x43128c,_0x9c958c['error'][_0x2faf('0x11')]);return _0x3f5c12(_0x9c958c[_0x2faf('0xe')][_0x2faf('0x11')]);}logger[_0x2faf('0xe')](_0x2faf('0x10'),_0x43128c,_0x9c958c[_0x2faf('0xe')]['message']);return _0x1522cb(_0x9c958c[_0x2faf('0xe')][_0x2faf('0x11')]);}else{logger['info'](_0x2faf('0x10'),_0x43128c,_0x2faf('0xd'));_0x1522cb(_0x9c958c[_0x2faf('0x12')][_0x2faf('0x11')]);}})['catch'](function(_0x3a2f18){logger[_0x2faf('0xe')](_0x2faf('0x10'),_0x43128c,_0x3a2f18);_0x3f5c12(_0x3a2f18);});});} \ No newline at end of file +var _0xae1b=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','bluebird','randomstring','ioredis'];(function(_0x1c7852,_0x451d3a){var _0x1df168=function(_0x337c90){while(--_0x337c90){_0x1c7852['push'](_0x1c7852['shift']());}};_0x1df168(++_0x451d3a);}(_0xae1b,0x96));var _0xbae1=function(_0x4e481d,_0x4d8ab7){_0x4e481d=_0x4e481d-0x0;var _0x1dbef6=_0xae1b[_0x4e481d];return _0x1dbef6;};'use strict';var _=require('lodash');var util=require(_0xbae1('0x0'));var moment=require('moment');var BPromise=require(_0xbae1('0x1'));var rs=require(_0xbae1('0x2'));var fs=require('fs');var Redis=require(_0xbae1('0x3'));var db=require(_0xbae1('0x4'))['db'];var utils=require(_0xbae1('0x5'));var logger=require(_0xbae1('0x6'))('rpc');var config=require(_0xbae1('0x7'));var jayson=require(_0xbae1('0x8'));var client=jayson['client'][_0xbae1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5d7130,_0xac9c47,_0x54ba1f){return new BPromise(function(_0x3f0ff5,_0x340ff9){return client['request'](_0x5d7130,_0x54ba1f)[_0xbae1('0xa')](function(_0x366106){logger[_0xbae1('0xb')](_0xbae1('0xc'),_0xac9c47,_0xbae1('0xd'));logger[_0xbae1('0xe')](_0xbae1('0xf'),_0xac9c47,_0xbae1('0xd'),JSON[_0xbae1('0x10')](_0x366106));if(_0x366106[_0xbae1('0x11')]){if(_0x366106[_0xbae1('0x11')][_0xbae1('0x12')]===0x1f4){logger['error']('CloudProvider,\x20%s,\x20%s',_0xac9c47,_0x366106['error']['message']);return _0x340ff9(_0x366106[_0xbae1('0x11')][_0xbae1('0x13')]);}logger[_0xbae1('0x11')](_0xbae1('0xc'),_0xac9c47,_0x366106[_0xbae1('0x11')]['message']);return _0x3f0ff5(_0x366106[_0xbae1('0x11')][_0xbae1('0x13')]);}else{logger[_0xbae1('0xb')]('CloudProvider,\x20%s,\x20%s',_0xac9c47,_0xbae1('0xd'));_0x3f0ff5(_0x366106[_0xbae1('0x14')][_0xbae1('0x13')]);}})[_0xbae1('0x15')](function(_0x7d92b7){logger[_0xbae1('0x11')](_0xbae1('0xc'),_0xac9c47,_0x7d92b7);_0x340ff9(_0x7d92b7);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 64049ea..fc979df 100644 --- a/server/api/cloudProvider/index.js +++ b/server/api/cloudProvider/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['isAuthenticated','/:id','show','post','create','delete','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','oauth2MicrosoftCallback','exports','express','Router','../../components/auth/service','get'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0x7a54,0x106));var _0x47a5=function(_0x1228f9,_0x2512bf){_0x1228f9=_0x1228f9-0x0;var _0x31e547=_0x7a54[_0x1228f9];return _0x31e547;};'use strict';var express=require(_0x47a5('0x0'));var router=express[_0x47a5('0x1')]();var auth=require(_0x47a5('0x2'));var controller=require('./cloudProvider.controller');router[_0x47a5('0x3')]('/',auth[_0x47a5('0x4')](),controller['index']);router[_0x47a5('0x3')](_0x47a5('0x5'),auth[_0x47a5('0x4')](),controller[_0x47a5('0x6')]);router[_0x47a5('0x7')]('/',auth['isAuthenticated'](),controller[_0x47a5('0x8')]);router['put'](_0x47a5('0x5'),auth[_0x47a5('0x4')](),controller['update']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0x47a5('0x3')](_0x47a5('0xa'),auth['isAuthenticated'](),controller[_0x47a5('0xb')]);router['post']('/oauth2/microsoft/callback',controller[_0x47a5('0xc')]);module[_0x47a5('0xd')]=router; \ No newline at end of file +var _0x2ef3=['Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','/:id','show','post','put','update','delete','destroy','/:id/oauth2/microsoft/authorize/','/oauth2/microsoft/callback','oauth2MicrosoftCallback','exports','express'];(function(_0x4e9c61,_0x4585cd){var _0x554a13=function(_0xfeff5d){while(--_0xfeff5d){_0x4e9c61['push'](_0x4e9c61['shift']());}};_0x554a13(++_0x4585cd);}(_0x2ef3,0xba));var _0x32ef=function(_0x521df3,_0x3cf120){_0x521df3=_0x521df3-0x0;var _0x442685=_0x2ef3[_0x521df3];return _0x442685;};'use strict';var express=require(_0x32ef('0x0'));var router=express[_0x32ef('0x1')]();var auth=require(_0x32ef('0x2'));var controller=require(_0x32ef('0x3'));router[_0x32ef('0x4')]('/',auth[_0x32ef('0x5')](),controller['index']);router[_0x32ef('0x4')](_0x32ef('0x6'),auth['isAuthenticated'](),controller[_0x32ef('0x7')]);router[_0x32ef('0x8')]('/',auth['isAuthenticated'](),controller['create']);router[_0x32ef('0x9')](_0x32ef('0x6'),auth[_0x32ef('0x5')](),controller[_0x32ef('0xa')]);router[_0x32ef('0xb')](_0x32ef('0x6'),auth[_0x32ef('0x5')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x4')](_0x32ef('0xd'),auth['isAuthenticated'](),controller['oauth2MicrosoftAuthorize']);router[_0x32ef('0x8')](_0x32ef('0xe'),controller[_0x32ef('0xf')]);module[_0x32ef('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 250faac..18ebf1a 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 _0xd609=['STRING'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xd609,0x10b));var _0x9d60=function(_0x5bf915,_0xcc81e2){_0x5bf915=_0x5bf915-0x0;var _0x2f6c74=_0xd609[_0x5bf915];return _0x2f6c74;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x9d60('0x0')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize[_0x9d60('0x0')]},'website':{'type':Sequelize[_0x9d60('0x0')]},'phone':{'type':Sequelize[_0x9d60('0x0')]},'fax':{'type':Sequelize[_0x9d60('0x0')]},'type':{'type':Sequelize[_0x9d60('0x0')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x9d60('0x0')]},'city':{'type':Sequelize[_0x9d60('0x0')]},'country':{'type':Sequelize[_0x9d60('0x0')]},'email':{'type':Sequelize[_0x9d60('0x0')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0x9d60('0x0')]},'sPostalCode':{'type':Sequelize[_0x9d60('0x0')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0x9d60('0x0')]},'description':{'type':Sequelize[_0x9d60('0x0')]}}; \ No newline at end of file +var _0x347b=['exports','STRING','name','sequelize'];(function(_0x5c6d18,_0x2cf5c0){var _0x2dce18=function(_0xe03f91){while(--_0xe03f91){_0x5c6d18['push'](_0x5c6d18['shift']());}};_0x2dce18(++_0x2cf5c0);}(_0x347b,0x9f));var _0xb347=function(_0x46aaaa,_0x3af897){_0x46aaaa=_0x46aaaa-0x0;var _0x26d04e=_0x347b[_0x46aaaa];return _0x26d04e;};'use strict';var Sequelize=require(_0xb347('0x0'));module[_0xb347('0x1')]={'name':{'type':Sequelize[_0xb347('0x2')],'unique':_0xb347('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize[_0xb347('0x2')]},'website':{'type':Sequelize[_0xb347('0x2')]},'phone':{'type':Sequelize[_0xb347('0x2')]},'fax':{'type':Sequelize[_0xb347('0x2')]},'type':{'type':Sequelize[_0xb347('0x2')]},'street':{'type':Sequelize[_0xb347('0x2')]},'postalCode':{'type':Sequelize[_0xb347('0x2')]},'city':{'type':Sequelize[_0xb347('0x2')]},'country':{'type':Sequelize[_0xb347('0x2')]},'email':{'type':Sequelize[_0xb347('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0xb347('0x2')]},'sPostalCode':{'type':Sequelize[_0xb347('0x2')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb347('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 1585b23..b0799f8 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 _0xdf1c=['apply','save','update','then','destroy','Companies','UserProfileResource','error','name','send','index','CmCompany','describe','model','query','filters','intersection','attributes','fields','length','order','sort','pick','filter','where','merge','map','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addContacts','CmContact','ids','omit','getContacts','findOne','keys','hasOwnProperty','nolimit','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range'];(function(_0x5b5926,_0x50052d){var _0x1753f1=function(_0x2b1b4d){while(--_0x2b1b4d){_0x5b5926['push'](_0x5b5926['shift']());}};_0x1753f1(++_0x50052d);}(_0xdf1c,0xe3));var _0xcdf1=function(_0x2991ba,_0x3cc2c3){_0x2991ba=_0x2991ba-0x0;var _0x45665a=_0xdf1c[_0x2991ba];return _0x45665a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcdf1('0x0'));var zipdir=require(_0xcdf1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcdf1('0x2'));var moment=require('moment');var BPromise=require(_0xcdf1('0x3'));var Mustache=require(_0xcdf1('0x4'));var util=require(_0xcdf1('0x5'));var path=require(_0xcdf1('0x6'));var sox=require(_0xcdf1('0x7'));var csv=require(_0xcdf1('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcdf1('0x9'));var _=require('lodash');var squel=require(_0xcdf1('0xa'));var crypto=require(_0xcdf1('0xb'));var jsforce=require(_0xcdf1('0xc'));var deskjs=require(_0xcdf1('0xd'));var toCsv=require(_0xcdf1('0x8'));var querystring=require(_0xcdf1('0xe'));var Papa=require('papaparse');var Redis=require(_0xcdf1('0xf'));var authService=require(_0xcdf1('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xcdf1('0x11'));var utils=require('../../config/utils');var config=require(_0xcdf1('0x12'));var licenseUtil=require(_0xcdf1('0x13'));var db=require(_0xcdf1('0x14'))['db'];function respondWithStatusCode(_0x587932,_0x4d0871){_0x4d0871=_0x4d0871||0xcc;return function(_0x24cda9){if(_0x24cda9){return _0x587932[_0xcdf1('0x15')](_0x4d0871);}return _0x587932[_0xcdf1('0x16')](_0x4d0871)[_0xcdf1('0x17')]();};}function respondWithResult(_0x308611,_0x29bf0c){_0x29bf0c=_0x29bf0c||0xc8;return function(_0x5a76e1){if(_0x5a76e1){return _0x308611['status'](_0x29bf0c)[_0xcdf1('0x18')](_0x5a76e1);}};}function respondWithFilteredResult(_0x179ae9,_0x18a5c5){return function(_0x396057){if(_0x396057){var _0x9c3930=typeof _0x18a5c5[_0xcdf1('0x19')]==='undefined'&&typeof _0x18a5c5[_0xcdf1('0x1a')]===_0xcdf1('0x1b');var _0x5c4d37=_0x396057[_0xcdf1('0x1c')];var _0xb5177c=_0x9c3930?0x0:_0x18a5c5['offset'];var _0x19fe84=_0x9c3930?_0x396057[_0xcdf1('0x1c')]:_0x18a5c5[_0xcdf1('0x19')]+_0x18a5c5['limit'];var _0x2b3f79;if(_0x19fe84>=_0x5c4d37){_0x19fe84=_0x5c4d37;_0x2b3f79=0xc8;}else{_0x2b3f79=0xce;}_0x179ae9['status'](_0x2b3f79);return _0x179ae9[_0xcdf1('0x1d')](_0xcdf1('0x1e'),_0xb5177c+'-'+_0x19fe84+'/'+_0x5c4d37)[_0xcdf1('0x18')](_0x396057);}return null;};}function patchUpdates(_0x995ed0){return function(_0x75a625){try{jsonpatch[_0xcdf1('0x1f')](_0x75a625,_0x995ed0,!![]);}catch(_0x38d7a8){return BPromise['reject'](_0x38d7a8);}return _0x75a625[_0xcdf1('0x20')]();};}function saveUpdates(_0x262125,_0x226055){return function(_0x2703e3){if(_0x2703e3){return _0x2703e3[_0xcdf1('0x21')](_0x262125)[_0xcdf1('0x22')](function(_0x367482){return _0x367482;});}return null;};}function removeEntity(_0x56995f,_0x4802a2){return function(_0x4fad79){if(_0x4fad79){return _0x4fad79[_0xcdf1('0x23')]()[_0xcdf1('0x22')](function(){var _0x5ee777=_0x4fad79['get']({'plain':!![]});var _0x2ec349=_0xcdf1('0x24');return db[_0xcdf1('0x25')]['destroy']({'where':{'type':_0x2ec349,'resourceId':_0x5ee777['id']}})[_0xcdf1('0x22')](function(){return _0x4fad79;});})[_0xcdf1('0x22')](function(){_0x56995f[_0xcdf1('0x16')](0xcc)[_0xcdf1('0x17')]();});}};}function handleEntityNotFound(_0x4af307,_0x494483){return function(_0x474a64){if(!_0x474a64){_0x4af307[_0xcdf1('0x15')](0x194);}return _0x474a64;};}function handleError(_0x10853e,_0x37d99e){_0x37d99e=_0x37d99e||0x1f4;return function(_0x5b4039){logger[_0xcdf1('0x26')](_0x5b4039['stack']);if(_0x5b4039[_0xcdf1('0x27')]){delete _0x5b4039[_0xcdf1('0x27')];}_0x10853e[_0xcdf1('0x16')](_0x37d99e)[_0xcdf1('0x28')](_0x5b4039);};}exports[_0xcdf1('0x29')]=function(_0x24e865,_0x51529a){var _0x42437b={},_0x3adca3={},_0x43b555={'count':0x0,'rows':[]};return db[_0xcdf1('0x2a')][_0xcdf1('0x2b')]()[_0xcdf1('0x22')](function(_0x17afc1){_0x3adca3[_0xcdf1('0x2c')]=_['keys'](_0x17afc1);_0x3adca3[_0xcdf1('0x2d')]=_['keys'](_0x24e865[_0xcdf1('0x2d')]);_0x3adca3[_0xcdf1('0x2e')]=_[_0xcdf1('0x2f')](_0x3adca3[_0xcdf1('0x2c')],_0x3adca3[_0xcdf1('0x2d')]);_0x42437b[_0xcdf1('0x30')]=_[_0xcdf1('0x2f')](_0x3adca3[_0xcdf1('0x2c')],qs[_0xcdf1('0x31')](_0x24e865[_0xcdf1('0x2d')][_0xcdf1('0x31')]));_0x42437b[_0xcdf1('0x30')]=_0x42437b[_0xcdf1('0x30')][_0xcdf1('0x32')]?_0x42437b[_0xcdf1('0x30')]:_0x3adca3[_0xcdf1('0x2c')];if(!_0x24e865[_0xcdf1('0x2d')]['hasOwnProperty']('nolimit')){_0x42437b[_0xcdf1('0x1a')]=qs['limit'](_0x24e865['query']['limit']);_0x42437b['offset']=qs['offset'](_0x24e865[_0xcdf1('0x2d')][_0xcdf1('0x19')]);}_0x42437b[_0xcdf1('0x33')]=qs['sort'](_0x24e865['query'][_0xcdf1('0x34')]);_0x42437b['where']=qs[_0xcdf1('0x2e')](_[_0xcdf1('0x35')](_0x24e865[_0xcdf1('0x2d')],_0x3adca3[_0xcdf1('0x2e')]),_0x17afc1);if(_0x24e865[_0xcdf1('0x2d')][_0xcdf1('0x36')]){_0x42437b[_0xcdf1('0x37')]=_[_0xcdf1('0x38')](_0x42437b[_0xcdf1('0x37')],{'$or':_[_0xcdf1('0x39')](_0x42437b['attributes'],function(_0x40f1a6){var _0x5177e5={};_0x5177e5[_0x40f1a6]={'$like':'%'+_0x24e865[_0xcdf1('0x2d')]['filter']+'%'};return _0x5177e5;})});}_0x42437b=_[_0xcdf1('0x38')]({},_0x42437b,_0x24e865[_0xcdf1('0x3a')]);var _0x31915b={'where':_0x42437b[_0xcdf1('0x37')]};return db['CmCompany']['count'](_0x31915b)['then'](function(_0x7b6f4){_0x43b555[_0xcdf1('0x1c')]=_0x7b6f4;if(_0x24e865[_0xcdf1('0x2d')][_0xcdf1('0x3b')]){_0x42437b[_0xcdf1('0x3c')]=[{'all':!![]}];}return db[_0xcdf1('0x2a')][_0xcdf1('0x3d')](_0x42437b);})['then'](function(_0x5e44e5){_0x43b555[_0xcdf1('0x3e')]=_0x5e44e5;return _0x43b555;})[_0xcdf1('0x22')](respondWithFilteredResult(_0x51529a,_0x42437b))[_0xcdf1('0x3f')](handleError(_0x51529a,null));})['catch'](handleError(_0x51529a,null));};exports[_0xcdf1('0x40')]=function(_0x3eb81f,_0x3d9e7e){var _0x50a903={'raw':![],'where':{'id':_0x3eb81f[_0xcdf1('0x41')]['id']}},_0x4092e7={};_0x4092e7[_0xcdf1('0x2c')]=_['keys'](db[_0xcdf1('0x2a')][_0xcdf1('0x42')]);_0x4092e7['query']=_['keys'](_0x3eb81f[_0xcdf1('0x2d')]);_0x4092e7[_0xcdf1('0x2e')]=_[_0xcdf1('0x2f')](_0x4092e7[_0xcdf1('0x2c')],_0x4092e7[_0xcdf1('0x2d')]);_0x50a903['attributes']=_[_0xcdf1('0x2f')](_0x4092e7[_0xcdf1('0x2c')],qs['fields'](_0x3eb81f[_0xcdf1('0x2d')][_0xcdf1('0x31')]));_0x50a903[_0xcdf1('0x30')]=_0x50a903[_0xcdf1('0x30')][_0xcdf1('0x32')]?_0x50a903[_0xcdf1('0x30')]:_0x4092e7[_0xcdf1('0x2c')];if(_0x3eb81f['query'][_0xcdf1('0x3b')]){_0x50a903[_0xcdf1('0x3c')]=[{'all':!![]}];}_0x50a903=_['merge']({},_0x50a903,_0x3eb81f[_0xcdf1('0x3a')]);return db[_0xcdf1('0x2a')][_0xcdf1('0x43')](_0x50a903)[_0xcdf1('0x22')](handleEntityNotFound(_0x3d9e7e,null))[_0xcdf1('0x22')](respondWithResult(_0x3d9e7e,null))[_0xcdf1('0x3f')](handleError(_0x3d9e7e,null));};exports[_0xcdf1('0x44')]=function(_0x5d053e,_0x5381ce){return db['CmCompany']['create'](_0x5d053e['body'],{})['then'](function(_0x168ac8){var _0x4d36ea=_0x5d053e[_0xcdf1('0x45')][_0xcdf1('0x46')]({'plain':!![]});if(!_0x4d36ea)throw new Error(_0xcdf1('0x47'));if(_0x4d36ea['role']===_0xcdf1('0x45')){var _0x6d4863=_0x168ac8[_0xcdf1('0x46')]({'plain':!![]});var _0x493305=_0xcdf1('0x24');return db[_0xcdf1('0x48')]['find']({'where':{'name':_0x493305,'userProfileId':_0x4d36ea[_0xcdf1('0x49')]},'raw':!![]})[_0xcdf1('0x22')](function(_0x1f42c8){if(_0x1f42c8&&_0x1f42c8[_0xcdf1('0x4a')]===0x0){return db['UserProfileResource'][_0xcdf1('0x44')]({'name':_0x6d4863['name'],'resourceId':_0x6d4863['id'],'type':_0x1f42c8[_0xcdf1('0x27')],'sectionId':_0x1f42c8['id']},{})['then'](function(){return _0x168ac8;});}else{return _0x168ac8;}})[_0xcdf1('0x3f')](function(_0x432138){logger[_0xcdf1('0x26')](_0xcdf1('0x4b'),_0x432138);throw _0x432138;});}return _0x168ac8;})[_0xcdf1('0x22')](respondWithResult(_0x5381ce,0xc9))[_0xcdf1('0x3f')](handleError(_0x5381ce,null));};exports[_0xcdf1('0x21')]=function(_0x3070d8,_0x3b1c0c){if(_0x3070d8[_0xcdf1('0x4c')]['id']){delete _0x3070d8[_0xcdf1('0x4c')]['id'];}return db[_0xcdf1('0x2a')][_0xcdf1('0x43')]({'where':{'id':_0x3070d8['params']['id']}})[_0xcdf1('0x22')](handleEntityNotFound(_0x3b1c0c,null))[_0xcdf1('0x22')](saveUpdates(_0x3070d8[_0xcdf1('0x4c')],null))[_0xcdf1('0x22')](respondWithResult(_0x3b1c0c,null))['catch'](handleError(_0x3b1c0c,null));};exports['destroy']=function(_0x2e5750,_0x548b00){return db[_0xcdf1('0x2a')]['find']({'where':{'id':_0x2e5750['params']['id']}})[_0xcdf1('0x22')](handleEntityNotFound(_0x548b00,null))[_0xcdf1('0x22')](removeEntity(_0x548b00,null))[_0xcdf1('0x3f')](handleError(_0x548b00,null));};exports['describe']=function(_0x30bd24,_0x4e41cd){return db[_0xcdf1('0x2a')]['describe']()[_0xcdf1('0x22')](respondWithResult(_0x4e41cd,null))[_0xcdf1('0x3f')](handleError(_0x4e41cd,null));};exports[_0xcdf1('0x4d')]=function(_0x1faf1a,_0x2efb98,_0x2c9ca4){return db[_0xcdf1('0x4e')][_0xcdf1('0x43')]({'where':{'id':_0x1faf1a[_0xcdf1('0x41')]['id']}})['then'](handleEntityNotFound(_0x2efb98,null))['then'](function(_0x1ef026){if(_0x1ef026){return _0x1ef026[_0xcdf1('0x4d')](_0x1faf1a['body'][_0xcdf1('0x4f')],_[_0xcdf1('0x50')](_0x1faf1a[_0xcdf1('0x4c')],['ids','id'])||{});}})[_0xcdf1('0x22')](respondWithResult(_0x2efb98,null))[_0xcdf1('0x3f')](handleError(_0x2efb98,null));};exports[_0xcdf1('0x51')]=function(_0x359bf7,_0x1ea9a2,_0xe8aad0){var _0x21ea79={};var _0x27014a={};var _0x12d536;var _0x45482;return db[_0xcdf1('0x2a')][_0xcdf1('0x52')]({'where':{'id':_0x359bf7['params']['id']}})[_0xcdf1('0x22')](handleEntityNotFound(_0x1ea9a2,null))[_0xcdf1('0x22')](function(_0x56e516){if(_0x56e516){_0x12d536=_0x56e516;_0x27014a[_0xcdf1('0x2c')]=_[_0xcdf1('0x53')](db[_0xcdf1('0x4e')]['rawAttributes']);_0x27014a[_0xcdf1('0x2d')]=_[_0xcdf1('0x53')](_0x359bf7['query']);_0x27014a[_0xcdf1('0x2e')]=_[_0xcdf1('0x2f')](_0x27014a[_0xcdf1('0x2c')],_0x27014a[_0xcdf1('0x2d')]);_0x21ea79['attributes']=_[_0xcdf1('0x2f')](_0x27014a[_0xcdf1('0x2c')],qs['fields'](_0x359bf7[_0xcdf1('0x2d')][_0xcdf1('0x31')]));_0x21ea79[_0xcdf1('0x30')]=_0x21ea79[_0xcdf1('0x30')][_0xcdf1('0x32')]?_0x21ea79[_0xcdf1('0x30')]:_0x27014a[_0xcdf1('0x2c')];_0x21ea79[_0xcdf1('0x33')]=qs[_0xcdf1('0x34')](_0x359bf7[_0xcdf1('0x2d')][_0xcdf1('0x34')]);_0x21ea79['where']=qs[_0xcdf1('0x2e')](_[_0xcdf1('0x35')](_0x359bf7[_0xcdf1('0x2d')],_0x27014a[_0xcdf1('0x2e')]));if(_0x359bf7[_0xcdf1('0x2d')][_0xcdf1('0x36')]){_0x21ea79[_0xcdf1('0x37')]=_[_0xcdf1('0x38')](_0x21ea79[_0xcdf1('0x37')],{'$or':_[_0xcdf1('0x39')](_0x21ea79['attributes'],function(_0x238945){var _0x3f32c9={};_0x3f32c9[_0x238945]={'$like':'%'+_0x359bf7[_0xcdf1('0x2d')][_0xcdf1('0x36')]+'%'};return _0x3f32c9;})});}_0x21ea79=_[_0xcdf1('0x38')]({},_0x21ea79,_0x359bf7[_0xcdf1('0x3a')]);return _0x12d536['getContacts'](_0x21ea79);}})[_0xcdf1('0x22')](function(_0x5b0627){if(_0x5b0627){_0x45482=_0x5b0627['length'];if(!_0x359bf7[_0xcdf1('0x2d')][_0xcdf1('0x54')](_0xcdf1('0x55'))){_0x21ea79[_0xcdf1('0x1a')]=qs[_0xcdf1('0x1a')](_0x359bf7[_0xcdf1('0x2d')]['limit']);_0x21ea79[_0xcdf1('0x19')]=qs[_0xcdf1('0x19')](_0x359bf7[_0xcdf1('0x2d')][_0xcdf1('0x19')]);}return _0x12d536['getContacts'](_0x21ea79);}})[_0xcdf1('0x22')](function(_0x33e416){if(_0x33e416){return _0x33e416?{'count':_0x45482,'rows':_0x33e416}:null;}})[_0xcdf1('0x22')](respondWithResult(_0x1ea9a2,null))['catch'](handleError(_0x1ea9a2,null));}; \ No newline at end of file +var _0x4d28=['user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','destroy','addContacts','ids','omit','getContacts','findOne','map','hasOwnProperty','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','get','Companies','UserProfileResource','error','stack','name','index','CmCompany','describe','model','keys','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','options','include','catch','params','rawAttributes','length','includeAll','create'];(function(_0x35ce34,_0x4e9604){var _0xf13af7=function(_0xf66f12){while(--_0xf66f12){_0x35ce34['push'](_0x35ce34['shift']());}};_0xf13af7(++_0x4e9604);}(_0x4d28,0x1c9));var _0x84d2=function(_0x10f060,_0x312a7b){_0x10f060=_0x10f060-0x0;var _0x512722=_0x4d28[_0x10f060];return _0x512722;};'use strict';var emlformat=require(_0x84d2('0x0'));var rimraf=require(_0x84d2('0x1'));var zipdir=require(_0x84d2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x84d2('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x84d2('0x4'));var util=require(_0x84d2('0x5'));var path=require(_0x84d2('0x6'));var sox=require(_0x84d2('0x7'));var csv=require(_0x84d2('0x8'));var ejs=require(_0x84d2('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x84d2('0xa'));var squel=require(_0x84d2('0xb'));var crypto=require(_0x84d2('0xc'));var jsforce=require(_0x84d2('0xd'));var deskjs=require(_0x84d2('0xe'));var toCsv=require(_0x84d2('0x8'));var querystring=require(_0x84d2('0xf'));var Papa=require(_0x84d2('0x10'));var Redis=require(_0x84d2('0x11'));var authService=require(_0x84d2('0x12'));var qs=require(_0x84d2('0x13'));var as=require(_0x84d2('0x14'));var hardwareService=require(_0x84d2('0x15'));var logger=require(_0x84d2('0x16'))('api');var utils=require(_0x84d2('0x17'));var config=require(_0x84d2('0x18'));var licenseUtil=require(_0x84d2('0x19'));var db=require(_0x84d2('0x1a'))['db'];function respondWithStatusCode(_0x3e7b5b,_0xdfc90b){_0xdfc90b=_0xdfc90b||0xcc;return function(_0x4de965){if(_0x4de965){return _0x3e7b5b[_0x84d2('0x1b')](_0xdfc90b);}return _0x3e7b5b[_0x84d2('0x1c')](_0xdfc90b)[_0x84d2('0x1d')]();};}function respondWithResult(_0x32d01b,_0x37cb22){_0x37cb22=_0x37cb22||0xc8;return function(_0x16c93c){if(_0x16c93c){return _0x32d01b[_0x84d2('0x1c')](_0x37cb22)[_0x84d2('0x1e')](_0x16c93c);}};}function respondWithFilteredResult(_0x321f01,_0x45de5a){return function(_0x37bd5a){if(_0x37bd5a){var _0x753c9c=typeof _0x45de5a[_0x84d2('0x1f')]===_0x84d2('0x20')&&typeof _0x45de5a[_0x84d2('0x21')]==='undefined';var _0x496a25=_0x37bd5a[_0x84d2('0x22')];var _0x476b07=_0x753c9c?0x0:_0x45de5a[_0x84d2('0x1f')];var _0x4304dc=_0x753c9c?_0x37bd5a[_0x84d2('0x22')]:_0x45de5a[_0x84d2('0x1f')]+_0x45de5a[_0x84d2('0x21')];var _0x3af563;if(_0x4304dc>=_0x496a25){_0x4304dc=_0x496a25;_0x3af563=0xc8;}else{_0x3af563=0xce;}_0x321f01['status'](_0x3af563);return _0x321f01[_0x84d2('0x23')](_0x84d2('0x24'),_0x476b07+'-'+_0x4304dc+'/'+_0x496a25)['json'](_0x37bd5a);}return null;};}function patchUpdates(_0x2e2106){return function(_0x228cd0){try{jsonpatch[_0x84d2('0x25')](_0x228cd0,_0x2e2106,!![]);}catch(_0xcb1351){return BPromise['reject'](_0xcb1351);}return _0x228cd0[_0x84d2('0x26')]();};}function saveUpdates(_0x5c746b,_0x4f388a){return function(_0x2120c3){if(_0x2120c3){return _0x2120c3['update'](_0x5c746b)[_0x84d2('0x27')](function(_0x3e6d71){return _0x3e6d71;});}return null;};}function removeEntity(_0x2d160f,_0x3cd389){return function(_0x3c7e4c){if(_0x3c7e4c){return _0x3c7e4c['destroy']()[_0x84d2('0x27')](function(){var _0x5191a0=_0x3c7e4c[_0x84d2('0x28')]({'plain':!![]});var _0x29e85=_0x84d2('0x29');return db[_0x84d2('0x2a')]['destroy']({'where':{'type':_0x29e85,'resourceId':_0x5191a0['id']}})[_0x84d2('0x27')](function(){return _0x3c7e4c;});})[_0x84d2('0x27')](function(){_0x2d160f[_0x84d2('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f857f,_0x116564){return function(_0x508e95){if(!_0x508e95){_0x4f857f[_0x84d2('0x1b')](0x194);}return _0x508e95;};}function handleError(_0x48c045,_0xcef64c){_0xcef64c=_0xcef64c||0x1f4;return function(_0xe2e495){logger[_0x84d2('0x2b')](_0xe2e495[_0x84d2('0x2c')]);if(_0xe2e495[_0x84d2('0x2d')]){delete _0xe2e495['name'];}_0x48c045['status'](_0xcef64c)['send'](_0xe2e495);};}exports[_0x84d2('0x2e')]=function(_0x546b18,_0x3474fd){var _0x420d4b={},_0x133c73={},_0xbb6ca3={'count':0x0,'rows':[]};return db[_0x84d2('0x2f')][_0x84d2('0x30')]()[_0x84d2('0x27')](function(_0x5b3f0c){_0x133c73[_0x84d2('0x31')]=_['keys'](_0x5b3f0c);_0x133c73['query']=_[_0x84d2('0x32')](_0x546b18[_0x84d2('0x33')]);_0x133c73[_0x84d2('0x34')]=_[_0x84d2('0x35')](_0x133c73[_0x84d2('0x31')],_0x133c73[_0x84d2('0x33')]);_0x420d4b[_0x84d2('0x36')]=_[_0x84d2('0x35')](_0x133c73[_0x84d2('0x31')],qs[_0x84d2('0x37')](_0x546b18[_0x84d2('0x33')][_0x84d2('0x37')]));_0x420d4b['attributes']=_0x420d4b[_0x84d2('0x36')]['length']?_0x420d4b['attributes']:_0x133c73['model'];if(!_0x546b18[_0x84d2('0x33')]['hasOwnProperty'](_0x84d2('0x38'))){_0x420d4b['limit']=qs['limit'](_0x546b18[_0x84d2('0x33')][_0x84d2('0x21')]);_0x420d4b[_0x84d2('0x1f')]=qs[_0x84d2('0x1f')](_0x546b18['query'][_0x84d2('0x1f')]);}_0x420d4b[_0x84d2('0x39')]=qs[_0x84d2('0x3a')](_0x546b18['query'][_0x84d2('0x3a')]);_0x420d4b[_0x84d2('0x3b')]=qs[_0x84d2('0x34')](_[_0x84d2('0x3c')](_0x546b18[_0x84d2('0x33')],_0x133c73[_0x84d2('0x34')]),_0x5b3f0c);if(_0x546b18[_0x84d2('0x33')][_0x84d2('0x3d')]){_0x420d4b['where']=_[_0x84d2('0x3e')](_0x420d4b[_0x84d2('0x3b')],{'$or':_['map'](_0x420d4b[_0x84d2('0x36')],function(_0x12ff40){var _0x41e7dd={};_0x41e7dd[_0x12ff40]={'$like':'%'+_0x546b18[_0x84d2('0x33')][_0x84d2('0x3d')]+'%'};return _0x41e7dd;})});}_0x420d4b=_[_0x84d2('0x3e')]({},_0x420d4b,_0x546b18[_0x84d2('0x3f')]);var _0x298153={'where':_0x420d4b[_0x84d2('0x3b')]};return db['CmCompany'][_0x84d2('0x22')](_0x298153)[_0x84d2('0x27')](function(_0x4554d5){_0xbb6ca3['count']=_0x4554d5;if(_0x546b18['query']['includeAll']){_0x420d4b[_0x84d2('0x40')]=[{'all':!![]}];}return db['CmCompany']['findAll'](_0x420d4b);})[_0x84d2('0x27')](function(_0x58cbfd){_0xbb6ca3['rows']=_0x58cbfd;return _0xbb6ca3;})[_0x84d2('0x27')](respondWithFilteredResult(_0x3474fd,_0x420d4b))[_0x84d2('0x41')](handleError(_0x3474fd,null));})[_0x84d2('0x41')](handleError(_0x3474fd,null));};exports['show']=function(_0x4e0dbe,_0x223fe0){var _0x563825={'raw':![],'where':{'id':_0x4e0dbe[_0x84d2('0x42')]['id']}},_0x38d430={};_0x38d430[_0x84d2('0x31')]=_['keys'](db[_0x84d2('0x2f')][_0x84d2('0x43')]);_0x38d430[_0x84d2('0x33')]=_[_0x84d2('0x32')](_0x4e0dbe[_0x84d2('0x33')]);_0x38d430[_0x84d2('0x34')]=_[_0x84d2('0x35')](_0x38d430['model'],_0x38d430[_0x84d2('0x33')]);_0x563825['attributes']=_[_0x84d2('0x35')](_0x38d430['model'],qs['fields'](_0x4e0dbe[_0x84d2('0x33')][_0x84d2('0x37')]));_0x563825[_0x84d2('0x36')]=_0x563825[_0x84d2('0x36')][_0x84d2('0x44')]?_0x563825[_0x84d2('0x36')]:_0x38d430[_0x84d2('0x31')];if(_0x4e0dbe[_0x84d2('0x33')][_0x84d2('0x45')]){_0x563825[_0x84d2('0x40')]=[{'all':!![]}];}_0x563825=_[_0x84d2('0x3e')]({},_0x563825,_0x4e0dbe[_0x84d2('0x3f')]);return db['CmCompany']['find'](_0x563825)['then'](handleEntityNotFound(_0x223fe0,null))[_0x84d2('0x27')](respondWithResult(_0x223fe0,null))[_0x84d2('0x41')](handleError(_0x223fe0,null));};exports['create']=function(_0x1f59a2,_0x1653fb){return db[_0x84d2('0x2f')][_0x84d2('0x46')](_0x1f59a2['body'],{})[_0x84d2('0x27')](function(_0x3c9872){var _0x36078d=_0x1f59a2[_0x84d2('0x47')][_0x84d2('0x28')]({'plain':!![]});if(!_0x36078d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x36078d[_0x84d2('0x48')]===_0x84d2('0x47')){var _0x56fd61=_0x3c9872[_0x84d2('0x28')]({'plain':!![]});var _0x33046d=_0x84d2('0x29');return db[_0x84d2('0x49')][_0x84d2('0x4a')]({'where':{'name':_0x33046d,'userProfileId':_0x36078d[_0x84d2('0x4b')]},'raw':!![]})['then'](function(_0x36d11d){if(_0x36d11d&&_0x36d11d[_0x84d2('0x4c')]===0x0){return db[_0x84d2('0x2a')][_0x84d2('0x46')]({'name':_0x56fd61[_0x84d2('0x2d')],'resourceId':_0x56fd61['id'],'type':_0x36d11d[_0x84d2('0x2d')],'sectionId':_0x36d11d['id']},{})[_0x84d2('0x27')](function(){return _0x3c9872;});}else{return _0x3c9872;}})[_0x84d2('0x41')](function(_0x37135b){logger['error'](_0x84d2('0x4d'),_0x37135b);throw _0x37135b;});}return _0x3c9872;})[_0x84d2('0x27')](respondWithResult(_0x1653fb,0xc9))[_0x84d2('0x41')](handleError(_0x1653fb,null));};exports[_0x84d2('0x4e')]=function(_0x3a91d8,_0x543e40){if(_0x3a91d8[_0x84d2('0x4f')]['id']){delete _0x3a91d8[_0x84d2('0x4f')]['id'];}return db[_0x84d2('0x2f')][_0x84d2('0x4a')]({'where':{'id':_0x3a91d8[_0x84d2('0x42')]['id']}})['then'](handleEntityNotFound(_0x543e40,null))['then'](saveUpdates(_0x3a91d8[_0x84d2('0x4f')],null))[_0x84d2('0x27')](respondWithResult(_0x543e40,null))[_0x84d2('0x41')](handleError(_0x543e40,null));};exports[_0x84d2('0x50')]=function(_0x1525e4,_0x3d794b){return db[_0x84d2('0x2f')][_0x84d2('0x4a')]({'where':{'id':_0x1525e4[_0x84d2('0x42')]['id']}})[_0x84d2('0x27')](handleEntityNotFound(_0x3d794b,null))[_0x84d2('0x27')](removeEntity(_0x3d794b,null))['catch'](handleError(_0x3d794b,null));};exports[_0x84d2('0x30')]=function(_0x19d841,_0x585e77){return db[_0x84d2('0x2f')]['describe']()[_0x84d2('0x27')](respondWithResult(_0x585e77,null))[_0x84d2('0x41')](handleError(_0x585e77,null));};exports[_0x84d2('0x51')]=function(_0x3db4b1,_0x5894e3,_0x10432f){return db['CmContact']['find']({'where':{'id':_0x3db4b1[_0x84d2('0x42')]['id']}})[_0x84d2('0x27')](handleEntityNotFound(_0x5894e3,null))[_0x84d2('0x27')](function(_0x30a994){if(_0x30a994){return _0x30a994[_0x84d2('0x51')](_0x3db4b1[_0x84d2('0x4f')][_0x84d2('0x52')],_[_0x84d2('0x53')](_0x3db4b1['body'],[_0x84d2('0x52'),'id'])||{});}})[_0x84d2('0x27')](respondWithResult(_0x5894e3,null))[_0x84d2('0x41')](handleError(_0x5894e3,null));};exports[_0x84d2('0x54')]=function(_0x1a0641,_0x240a03,_0x1653ab){var _0x4a37f={};var _0x33de12={};var _0x57c9f3;var _0x3b71cb;return db['CmCompany'][_0x84d2('0x55')]({'where':{'id':_0x1a0641[_0x84d2('0x42')]['id']}})[_0x84d2('0x27')](handleEntityNotFound(_0x240a03,null))[_0x84d2('0x27')](function(_0x477f65){if(_0x477f65){_0x57c9f3=_0x477f65;_0x33de12[_0x84d2('0x31')]=_[_0x84d2('0x32')](db['CmContact']['rawAttributes']);_0x33de12[_0x84d2('0x33')]=_[_0x84d2('0x32')](_0x1a0641['query']);_0x33de12[_0x84d2('0x34')]=_[_0x84d2('0x35')](_0x33de12['model'],_0x33de12[_0x84d2('0x33')]);_0x4a37f['attributes']=_[_0x84d2('0x35')](_0x33de12[_0x84d2('0x31')],qs[_0x84d2('0x37')](_0x1a0641[_0x84d2('0x33')][_0x84d2('0x37')]));_0x4a37f[_0x84d2('0x36')]=_0x4a37f[_0x84d2('0x36')][_0x84d2('0x44')]?_0x4a37f[_0x84d2('0x36')]:_0x33de12[_0x84d2('0x31')];_0x4a37f[_0x84d2('0x39')]=qs[_0x84d2('0x3a')](_0x1a0641[_0x84d2('0x33')][_0x84d2('0x3a')]);_0x4a37f[_0x84d2('0x3b')]=qs[_0x84d2('0x34')](_['pick'](_0x1a0641['query'],_0x33de12[_0x84d2('0x34')]));if(_0x1a0641[_0x84d2('0x33')]['filter']){_0x4a37f[_0x84d2('0x3b')]=_[_0x84d2('0x3e')](_0x4a37f[_0x84d2('0x3b')],{'$or':_[_0x84d2('0x56')](_0x4a37f[_0x84d2('0x36')],function(_0x173e49){var _0xedc233={};_0xedc233[_0x173e49]={'$like':'%'+_0x1a0641[_0x84d2('0x33')][_0x84d2('0x3d')]+'%'};return _0xedc233;})});}_0x4a37f=_[_0x84d2('0x3e')]({},_0x4a37f,_0x1a0641[_0x84d2('0x3f')]);return _0x57c9f3[_0x84d2('0x54')](_0x4a37f);}})[_0x84d2('0x27')](function(_0x17aa14){if(_0x17aa14){_0x3b71cb=_0x17aa14[_0x84d2('0x44')];if(!_0x1a0641[_0x84d2('0x33')][_0x84d2('0x57')](_0x84d2('0x38'))){_0x4a37f[_0x84d2('0x21')]=qs[_0x84d2('0x21')](_0x1a0641[_0x84d2('0x33')][_0x84d2('0x21')]);_0x4a37f['offset']=qs[_0x84d2('0x1f')](_0x1a0641[_0x84d2('0x33')]['offset']);}return _0x57c9f3[_0x84d2('0x54')](_0x4a37f);}})[_0x84d2('0x27')](function(_0x37a3e0){if(_0x37a3e0){return _0x37a3e0?{'count':_0x3b71cb,'rows':_0x37a3e0}:null;}})['then'](respondWithResult(_0x240a03,null))[_0x84d2('0x41')](handleError(_0x240a03,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index dfb973d..bb7ba97 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 _0x8139=['moment','bluebird','rimraf','../../config/environment','./cmCompany.attributes','exports','define','CmCompany','lodash','util','../../config/logger'];(function(_0x5c0a90,_0x448892){var _0x5adda6=function(_0x24310f){while(--_0x24310f){_0x5c0a90['push'](_0x5c0a90['shift']());}};_0x5adda6(++_0x448892);}(_0x8139,0x76));var _0x9813=function(_0x15c6fc,_0x5e7a75){_0x15c6fc=_0x15c6fc-0x0;var _0x1185dd=_0x8139[_0x15c6fc];return _0x1185dd;};'use strict';var _=require(_0x9813('0x0'));var util=require(_0x9813('0x1'));var logger=require(_0x9813('0x2'))('api');var moment=require(_0x9813('0x3'));var BPromise=require(_0x9813('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9813('0x5'));var config=require(_0x9813('0x6'));var attributes=require(_0x9813('0x7'));module[_0x9813('0x8')]=function(_0x3207f3,_0x27ae58){return _0x3207f3[_0x9813('0x9')](_0x9813('0xa'),attributes,{'tableName':'cm_companies','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7506=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmCompany.attributes','define','CmCompany','cm_companies','lodash','../../config/logger','api'];(function(_0x15a817,_0x50dbdc){var _0x5606aa=function(_0x162ce7){while(--_0x162ce7){_0x15a817['push'](_0x15a817['shift']());}};_0x5606aa(++_0x50dbdc);}(_0x7506,0x128));var _0x6750=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x7506[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x6750('0x0'));var util=require('util');var logger=require(_0x6750('0x1'))(_0x6750('0x2'));var moment=require(_0x6750('0x3'));var BPromise=require(_0x6750('0x4'));var rp=require(_0x6750('0x5'));var fs=require('fs');var path=require(_0x6750('0x6'));var rimraf=require(_0x6750('0x7'));var config=require(_0x6750('0x8'));var attributes=require(_0x6750('0x9'));module['exports']=function(_0x1cdc60,_0x22903){return _0x1cdc60[_0x6750('0xa')](_0x6750('0xb'),attributes,{'tableName':_0x6750('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 7e9f328..ec4362f 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 _0x3bb3=['bluebird','ioredis','../../config/logger','rpc','jayson/promise','client','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','lodash','util'];(function(_0x176d37,_0x5dfa31){var _0x14cf5c=function(_0xa78179){while(--_0xa78179){_0x176d37['push'](_0x176d37['shift']());}};_0x14cf5c(++_0x5dfa31);}(_0x3bb3,0x152));var _0x33bb=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x3bb3[_0x618414];return _0x21c19a;};'use strict';var _=require(_0x33bb('0x0'));var util=require(_0x33bb('0x1'));var moment=require('moment');var BPromise=require(_0x33bb('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x33bb('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x33bb('0x4'))(_0x33bb('0x5'));var config=require('../../config/environment');var jayson=require(_0x33bb('0x6'));var client=jayson[_0x33bb('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3e157c,_0x1a3f95,_0x31b2b9){return new BPromise(function(_0x5e88c8,_0x1fa6c4){return client['request'](_0x3e157c,_0x31b2b9)[_0x33bb('0x8')](function(_0x2d49a6){logger[_0x33bb('0x9')](_0x33bb('0xa'),_0x1a3f95,_0x33bb('0xb'));logger[_0x33bb('0xc')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x1a3f95,_0x33bb('0xb'),JSON[_0x33bb('0xd')](_0x2d49a6));if(_0x2d49a6[_0x33bb('0xe')]){if(_0x2d49a6['error']['code']===0x1f4){logger[_0x33bb('0xe')](_0x33bb('0xa'),_0x1a3f95,_0x2d49a6[_0x33bb('0xe')][_0x33bb('0xf')]);return _0x1fa6c4(_0x2d49a6[_0x33bb('0xe')]['message']);}logger[_0x33bb('0xe')]('CmCompany,\x20%s,\x20%s',_0x1a3f95,_0x2d49a6[_0x33bb('0xe')][_0x33bb('0xf')]);return _0x5e88c8(_0x2d49a6[_0x33bb('0xe')][_0x33bb('0xf')]);}else{logger[_0x33bb('0x9')]('CmCompany,\x20%s,\x20%s',_0x1a3f95,_0x33bb('0xb'));_0x5e88c8(_0x2d49a6[_0x33bb('0x10')]['message']);}})['catch'](function(_0x26c5e3){logger[_0x33bb('0xe')](_0x33bb('0xa'),_0x1a3f95,_0x26c5e3);_0x1fa6c4(_0x26c5e3);});});} \ No newline at end of file +var _0x7fcb=['request','info','CmCompany,\x20%s,\x20%s','debug','CmCompany,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0x7fcb,0x84));var _0xb7fc=function(_0x515283,_0x813dea){_0x515283=_0x515283-0x0;var _0x38f836=_0x7fcb[_0x515283];return _0x38f836;};'use strict';var _=require(_0xb7fc('0x0'));var util=require('util');var moment=require(_0xb7fc('0x1'));var BPromise=require('bluebird');var rs=require(_0xb7fc('0x2'));var fs=require('fs');var Redis=require(_0xb7fc('0x3'));var db=require(_0xb7fc('0x4'))['db'];var utils=require(_0xb7fc('0x5'));var logger=require(_0xb7fc('0x6'))(_0xb7fc('0x7'));var config=require(_0xb7fc('0x8'));var jayson=require(_0xb7fc('0x9'));var client=jayson[_0xb7fc('0xa')][_0xb7fc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x10b680,_0x322e72,_0xf17328){return new BPromise(function(_0x1dd626,_0x530f7b){return client[_0xb7fc('0xc')](_0x10b680,_0xf17328)['then'](function(_0x35f309){logger[_0xb7fc('0xd')](_0xb7fc('0xe'),_0x322e72,'request\x20sent');logger[_0xb7fc('0xf')](_0xb7fc('0x10'),_0x322e72,_0xb7fc('0x11'),JSON[_0xb7fc('0x12')](_0x35f309));if(_0x35f309[_0xb7fc('0x13')]){if(_0x35f309['error'][_0xb7fc('0x14')]===0x1f4){logger[_0xb7fc('0x13')](_0xb7fc('0xe'),_0x322e72,_0x35f309[_0xb7fc('0x13')][_0xb7fc('0x15')]);return _0x530f7b(_0x35f309['error']['message']);}logger[_0xb7fc('0x13')](_0xb7fc('0xe'),_0x322e72,_0x35f309['error'][_0xb7fc('0x15')]);return _0x1dd626(_0x35f309[_0xb7fc('0x13')][_0xb7fc('0x15')]);}else{logger['info']('CmCompany,\x20%s,\x20%s',_0x322e72,_0xb7fc('0x11'));_0x1dd626(_0x35f309[_0xb7fc('0x16')][_0xb7fc('0x15')]);}})[_0xb7fc('0x17')](function(_0x27e95a){logger['error'](_0xb7fc('0xe'),_0x322e72,_0x27e95a);_0x530f7b(_0x27e95a);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 5197b17..cb070b6 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 _0x1aa5=['path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./cmCompany.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/contacts','create','addContacts','update','delete','destroy','multer'];(function(_0x3cc6af,_0x5929a4){var _0x326cdd=function(_0x35a28b){while(--_0x35a28b){_0x3cc6af['push'](_0x3cc6af['shift']());}};_0x326cdd(++_0x5929a4);}(_0x1aa5,0x18e));var _0x51aa=function(_0x119226,_0x51833a){_0x119226=_0x119226-0x0;var _0x166d0a=_0x1aa5[_0x119226];return _0x166d0a;};'use strict';var multer=require(_0x51aa('0x0'));var util=require('util');var path=require(_0x51aa('0x1'));var timeout=require(_0x51aa('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x51aa('0x3'));var auth=require(_0x51aa('0x4'));var interaction=require(_0x51aa('0x5'));var config=require('../../config/environment');var controller=require(_0x51aa('0x6'));router[_0x51aa('0x7')]('/',auth[_0x51aa('0x8')](),controller[_0x51aa('0x9')]);router[_0x51aa('0x7')](_0x51aa('0xa'),auth[_0x51aa('0x8')](),controller['describe']);router[_0x51aa('0x7')](_0x51aa('0xb'),auth['isAuthenticated'](),controller[_0x51aa('0xc')]);router[_0x51aa('0x7')](_0x51aa('0xd'),auth[_0x51aa('0x8')](),controller['getContacts']);router['post']('/',auth[_0x51aa('0x8')](),controller[_0x51aa('0xe')]);router['post']('/:id/contacts',auth[_0x51aa('0x8')](),controller[_0x51aa('0xf')]);router['put']('/:id',auth[_0x51aa('0x8')](),controller[_0x51aa('0x10')]);router[_0x51aa('0x11')](_0x51aa('0xb'),auth[_0x51aa('0x8')](),controller[_0x51aa('0x12')]);module['exports']=router; \ No newline at end of file +var _0x9c5b=['describe','/:id','show','getContacts','post','/:id/contacts','addContacts','put','delete','destroy','exports','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','index'];(function(_0x1c90a7,_0x115e4d){var _0x408b33=function(_0x4b2b46){while(--_0x4b2b46){_0x1c90a7['push'](_0x1c90a7['shift']());}};_0x408b33(++_0x115e4d);}(_0x9c5b,0x9e));var _0xb9c5=function(_0x4c858f,_0xcd21d1){_0x4c858f=_0x4c858f-0x0;var _0x322921=_0x9c5b[_0x4c858f];return _0x322921;};'use strict';var multer=require('multer');var util=require(_0xb9c5('0x0'));var path=require(_0xb9c5('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xb9c5('0x2'));var auth=require(_0xb9c5('0x3'));var interaction=require(_0xb9c5('0x4'));var config=require(_0xb9c5('0x5'));var controller=require(_0xb9c5('0x6'));router[_0xb9c5('0x7')]('/',auth[_0xb9c5('0x8')](),controller[_0xb9c5('0x9')]);router[_0xb9c5('0x7')]('/describe',auth[_0xb9c5('0x8')](),controller[_0xb9c5('0xa')]);router[_0xb9c5('0x7')](_0xb9c5('0xb'),auth['isAuthenticated'](),controller[_0xb9c5('0xc')]);router[_0xb9c5('0x7')]('/:id/contacts',auth[_0xb9c5('0x8')](),controller[_0xb9c5('0xd')]);router[_0xb9c5('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xb9c5('0xe')](_0xb9c5('0xf'),auth[_0xb9c5('0x8')](),controller[_0xb9c5('0x10')]);router[_0xb9c5('0x11')](_0xb9c5('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xb9c5('0x12')](_0xb9c5('0xb'),auth['isAuthenticated'](),controller[_0xb9c5('0x13')]);module[_0xb9c5('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 067cabd..b95ad76 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 _0x29ca=['TEXT','INTEGER','UNSIGNED','DATE','lodash','sequelize','exports','STRING'];(function(_0x4dea8f,_0x7abc1b){var _0x472ea6=function(_0x2e3f2a){while(--_0x2e3f2a){_0x4dea8f['push'](_0x4dea8f['shift']());}};_0x472ea6(++_0x7abc1b);}(_0x29ca,0x1a4));var _0xa29c=function(_0x2a7d55,_0x36bd70){_0x2a7d55=_0x2a7d55-0x0;var _0x137989=_0x29ca[_0x2a7d55];return _0x137989;};'use strict';var _=require(_0xa29c('0x0'));var Sequelize=require(_0xa29c('0x1'));module[_0xa29c('0x2')]={'firstName':{'type':Sequelize[_0xa29c('0x3')],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0xa29c('0x3')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xa29c('0x3')]},'country':{'type':Sequelize[_0xa29c('0x3')]},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa29c('0x4')]},'phone':{'type':Sequelize[_0xa29c('0x3')]},'mobile':{'type':Sequelize[_0xa29c('0x3')]},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize[_0xa29c('0x3')]},'facebook':{'type':Sequelize[_0xa29c('0x3')]},'fb_data':{'type':Sequelize[_0xa29c('0x3')]},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize[_0xa29c('0x3')]},'teams':{'type':Sequelize[_0xa29c('0x3')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize[_0xa29c('0x3')]},'wechat':{'type':Sequelize[_0xa29c('0x3')]},'telegram':{'type':Sequelize[_0xa29c('0x3')]},'UserId':{'type':Sequelize['INTEGER']},'priority':{'type':Sequelize[_0xa29c('0x5')](0x2)[_0xa29c('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xa29c('0x7')],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0x698e=['INTEGER','UNSIGNED','DATE','NOW','lodash','sequelize','exports','STRING','TEXT'];(function(_0x47d686,_0x2b3692){var _0x283fe5=function(_0x3edb9f){while(--_0x3edb9f){_0x47d686['push'](_0x47d686['shift']());}};_0x283fe5(++_0x2b3692);}(_0x698e,0x16c));var _0xe698=function(_0x5e7dab,_0x150215){_0x5e7dab=_0x5e7dab-0x0;var _0x43a15d=_0x698e[_0x5e7dab];return _0x43a15d;};'use strict';var _=require(_0xe698('0x0'));var Sequelize=require(_0xe698('0x1'));module[_0xe698('0x2')]={'firstName':{'type':Sequelize[_0xe698('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0xe698('0x3')]},'street':{'type':Sequelize[_0xe698('0x3')]},'postalCode':{'type':Sequelize[_0xe698('0x3')]},'city':{'type':Sequelize[_0xe698('0x3')]},'country':{'type':Sequelize[_0xe698('0x3')]},'dateOfBirth':{'type':Sequelize[_0xe698('0x3')]},'description':{'type':Sequelize[_0xe698('0x4')]},'phone':{'type':Sequelize[_0xe698('0x3')]},'mobile':{'type':Sequelize[_0xe698('0x3')]},'fax':{'type':Sequelize[_0xe698('0x3')]},'email':{'type':Sequelize[_0xe698('0x3')]},'url':{'type':Sequelize[_0xe698('0x3')]},'facebook':{'type':Sequelize[_0xe698('0x3')]},'fb_data':{'type':Sequelize[_0xe698('0x3')]},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize[_0xe698('0x3')]},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize[_0xe698('0x3')]},'line':{'type':Sequelize[_0xe698('0x3')]},'wechat':{'type':Sequelize[_0xe698('0x3')]},'telegram':{'type':Sequelize[_0xe698('0x3')]},'UserId':{'type':Sequelize[_0xe698('0x5')]},'priority':{'type':Sequelize[_0xe698('0x5')](0x2)[_0xe698('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xe698('0x7')],'defaultValue':Sequelize[_0xe698('0x8')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 0415c91..c1e9571 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 _0x3ef0=['FaxInteraction','OpenchannelMessage','CmHopperFinal','ReportAgentPreview','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','join','bulkCreate','duplicates','$or','findOrCreate','show','Tag','findAll','format','cf_%d','$and','omit','table','setFields','id\x20=\x20?','params','toParam','phone','getTags','options','setTags','getHoppers','ContactId','includeAll','include','CmHopperHistory','getHopperFinals','rawAttributes','getJscriptySessions','uploadCsv','No\x20ListId\x20specified','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','binding_keys','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','server/files/tmp','file','filename','0777','child_process','fork','../../components/import/cm/csv','CompanyId','File\x20uploaded\x20correctly!','pid','send','createReadStream','path','parse','meta','import','binding','stringify','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','getJourney','mail','chat','sms','fax','whatsapp','voice','-createdAt','resolve','channel','includes','toLowerCase','Invalid\x20channel','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','uniqueid','source','callerid','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','DESC','startCase','Website','closed','thirdDisposition','Account','key','Owner','browserName','customerIp','customerPort','deviceModel','osName','ratingMessage','ratingType','ratingValue','substatus','threadId','Interaction','findAndCountAll','all','flatten','slice','moment','util','lodash','papaparse','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','status','json','undefined','limit','count','offset','set','Content-Range','then','end','error','stack','name','CmContact','describe','length','keys','cf_','push','CmCustomField','findOne','trimStart','fieldType','type','query','intersection','model','fields','attributes','nolimit','sort','where','pick','filters','field','color','from','tools_tags','select','cm_contacts','cm_user_has_contacts','uc.CmContactId\x20=\x20c.id','left_join','ct.CmContactId\x20=\x20c.id','t.id\x20=\x20ct.TagId','c.deletedAt\x20IS\x20NULL','expr','search','parseSearch','sqlOperator','conditions','find','value','split','map','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','and','datetime','DATE','buildExpression','text','hasOwnProperty','filter','Contact','isEmpty','ListId','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','tag','replace','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','group','Sequelize','QueryTypes','clone','c.id','order','having','t.id\x20IN\x20?','user','role','agent','some','getLists','c.ListId\x20IS\x20NULL','c.ListId\x20IN\x20?','sequelize','toString','keyBy','merge','c.firstName','c.lastName','c.phone','c.fax','c.ListId','c.createdAt','c.CompanyId','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','Tags','rows','destroy','tags','startsWith','columnName','displayName','alias','custom','values','catch','body','get','mergeWith','isArray','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','update','ChatMessage','ChatOfflineMessage','MailMessage','MailInteraction','SmsInteraction','SmsMessage'];(function(_0x27a411,_0x1e6480){var _0x1ca87c=function(_0x191910){while(--_0x191910){_0x27a411['push'](_0x27a411['shift']());}};_0x1ca87c(++_0x1e6480);}(_0x3ef0,0x19a));var _0x03ef=function(_0x4057f5,_0x41b6ef){_0x4057f5=_0x4057f5-0x0;var _0x59f6af=_0x3ef0[_0x4057f5];return _0x59f6af;};'use strict';var moment=require(_0x03ef('0x0'));var BPromise=require('bluebird');var util=require(_0x03ef('0x1'));var path=require('path');var fs=require('fs');var _=require(_0x03ef('0x2'));var squel=require('squel');var Papa=require(_0x03ef('0x3'));var Redis=require(_0x03ef('0x4'));var qs=require(_0x03ef('0x5'));var as=require('../../components/parsers/advancedSearch');var logger=require('../../config/logger')(_0x03ef('0x6'));var config=require(_0x03ef('0x7'));var db=require(_0x03ef('0x8'))['db'];config['redis']=_[_0x03ef('0x9')](config[_0x03ef('0xa')],{'host':_0x03ef('0xb'),'port':0x18eb});var socket=require(_0x03ef('0xc'))(new Redis(config['redis']));require('./cmContact.socket')[_0x03ef('0xd')](socket);function respondWithResult(_0x6a6cd4,_0x2d3cc9){_0x2d3cc9=_0x2d3cc9||0xc8;return function(_0x52bd94){if(_0x52bd94){return _0x6a6cd4[_0x03ef('0xe')](_0x2d3cc9)[_0x03ef('0xf')](_0x52bd94);}};}function respondWithFilteredResult(_0x5299de,_0x269454){return function(_0x278ff9){if(_0x278ff9){var _0x2c7883=typeof _0x269454['offset']===_0x03ef('0x10')&&typeof _0x269454[_0x03ef('0x11')]===_0x03ef('0x10');var _0x1e138e=_0x278ff9[_0x03ef('0x12')];var _0x2eb81a=_0x2c7883?0x0:_0x269454[_0x03ef('0x13')];var _0x39ed69=_0x2c7883?_0x278ff9[_0x03ef('0x12')]:_0x269454[_0x03ef('0x13')]+_0x269454[_0x03ef('0x11')];var _0x51f68e;if(_0x39ed69>=_0x1e138e){_0x39ed69=_0x1e138e;_0x51f68e=0xc8;}else{_0x51f68e=0xce;}_0x5299de['status'](_0x51f68e);return _0x5299de[_0x03ef('0x14')](_0x03ef('0x15'),_0x2eb81a+'-'+_0x39ed69+'/'+_0x1e138e)[_0x03ef('0xf')](_0x278ff9);}return null;};}function saveUpdates(_0x2f6a35){return function(_0x12169c){if(_0x12169c){return _0x12169c['update'](_0x2f6a35)['then'](function(_0x343bf0){return _0x343bf0;});}return null;};}function removeEntity(_0x1f412c){return function(_0x501d87){if(_0x501d87){return _0x501d87['destroy']()[_0x03ef('0x16')](function(){_0x1f412c[_0x03ef('0xe')](0xcc)[_0x03ef('0x17')]();});}};}function handleEntityNotFound(_0x111073){return function(_0x1776d8){if(!_0x1776d8){_0x111073['sendStatus'](0x194);}return _0x1776d8;};}function handleError(_0x275e03,_0x47c1e6){_0x47c1e6=_0x47c1e6||0x1f4;return function(_0x5161b0){logger[_0x03ef('0x18')](_0x5161b0[_0x03ef('0x19')]);if(_0x5161b0[_0x03ef('0x1a')]){delete _0x5161b0[_0x03ef('0x1a')];}_0x275e03[_0x03ef('0xe')](_0x47c1e6)['send'](_0x5161b0);};}exports['index']=function(_0x41d7d7,_0x5d56e1){var _0x11073e={},_0x5644f5={},_0x5c1a36={'count':0x0,'rows':[]};return db[_0x03ef('0x1b')][_0x03ef('0x1c')]()['then'](function(_0x5f0084){var _0x3aafcd=[];for(var _0x38a7c5=0x0;_0x38a7c50x1){_0x2ec612['or'](_0x03ef('0x57'),qs['getFullTextValue'](_0x440366),null);}else{if(qs['isNumeric'](_0x440366)){_0x2ec612['or'](_0x03ef('0x58'),_0x440366+'%');_0x2ec612['or'](_0x03ef('0x59'),_0x440366+'%');_0x2ec612['or'](_0x03ef('0x5a'),_0x440366+'%');_0x2ec612['or'](_0x03ef('0x5b'),_0x440366+'%');}else if(qs['isEmail'](_0x440366)){_0x2ec612['or'](_0x03ef('0x5c'),_0x440366+'%');}else{_0x2ec612['or'](_0x03ef('0x5d'),'%'+_0x440366+'%');_0x2ec612['or'](_0x03ef('0x5e'),'%'+_0x440366+'%');_0x2ec612['or'](_0x03ef('0x5c'),'%'+_0x440366+'%');}}}}_0x3d1c9e[_0x03ef('0x2d')](_0x2ec612);_0x3d1c9e[_0x03ef('0x5f')]('c.id');var _0x30fe3b={'type':db[_0x03ef('0x60')][_0x03ef('0x61')]['SELECT'],'raw':!![]};var _0x111935=_0x3d1c9e[_0x03ef('0x62')]()[_0x03ef('0x30')](_0x03ef('0x63'));if(_0x11073e[_0x03ef('0x64')]){_0x11073e[_0x03ef('0x64')]['forEach'](function(_0x8923b9){_0x3d1c9e[_0x03ef('0x64')]('c.'+_0x8923b9[0x0],_0x8923b9[0x1]==='DESC'?![]:!![]);});}if(!_[_0x03ef('0x51')](_0x5f8cb2)){_0x3d1c9e[_0x03ef('0x65')](_0x5b79de);_0x111935[_0x03ef('0x2d')](_0x03ef('0x66'),_0x5f8cb2);}BPromise['resolve']()[_0x03ef('0x16')](function(){if(!_0x113f9b)return;if(_0x41d7d7[_0x03ef('0x67')][_0x03ef('0x68')]!==_0x03ef('0x69'))return;if(!_[_0x03ef('0x6a')](_0x113f9b[_0x03ef('0x40')],[_0x03ef('0x30'),_0x03ef('0x48')])){return _0x41d7d7[_0x03ef('0x67')][_0x03ef('0x6b')]({'attributes':['id'],'raw':!![]})[_0x03ef('0x16')](function(_0x49489a){if(_[_0x03ef('0x51')](_0x49489a)){_0x111935[_0x03ef('0x2d')](_0x03ef('0x6c'));_0x3d1c9e[_0x03ef('0x2d')](_0x03ef('0x6c'));}else{_0x111935[_0x03ef('0x2d')](_0x03ef('0x6d'),_[_0x03ef('0x44')](_0x49489a,'id'));_0x3d1c9e[_0x03ef('0x2d')](_0x03ef('0x6d'),_['map'](_0x49489a,'id'));}});}})[_0x03ef('0x16')](function(){if(_0x41d7d7[_0x03ef('0x67')][_0x03ef('0x68')]===_0x03ef('0x69')&&!_0x113f9b&&!_0x41d7d7[_0x03ef('0x26')][_0x03ef('0x52')])return[];return db[_0x03ef('0x6e')][_0x03ef('0x26')](_0x111935[_0x03ef('0x6f')](),_0x30fe3b);})[_0x03ef('0x16')](function(_0x4e1c69){_0x5c1a36[_0x03ef('0x12')]=_0x4e1c69[_0x03ef('0x1d')];if(_0x5c1a36[_0x03ef('0x12')]===0x0)return[];return db[_0x03ef('0x6e')][_0x03ef('0x26')](_0x4e8b4c[_0x03ef('0x6f')](),_0x30fe3b)[_0x03ef('0x16')](function(_0x30f2f0){_0x24f1c1=_[_0x03ef('0x70')](_0x30f2f0,'id');_0x30fe3b=_[_0x03ef('0x71')](_0x30fe3b,{'model':db[_0x03ef('0x1b')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x41d7d7[_0x03ef('0x26')]['fields']){_0x11073e[_0x03ef('0x2a')][_0x03ef('0x45')](function(_0x1cdbd5){_0x3d1c9e[_0x03ef('0x30')]('c.'+_0x1cdbd5);});}else{_0x3d1c9e[_0x03ef('0x30')](_0x03ef('0x63'));_0x3d1c9e[_0x03ef('0x30')](_0x03ef('0x72'));_0x3d1c9e[_0x03ef('0x30')](_0x03ef('0x73'));_0x3d1c9e['field'](_0x03ef('0x74'));_0x3d1c9e[_0x03ef('0x30')]('c.mobile');_0x3d1c9e[_0x03ef('0x30')](_0x03ef('0x75'));_0x3d1c9e[_0x03ef('0x30')]('c.email');_0x3d1c9e[_0x03ef('0x30')](_0x03ef('0x76'));_0x3d1c9e[_0x03ef('0x30')](_0x03ef('0x77'));_0x3d1c9e[_0x03ef('0x30')]('c.deletedAt');_0x3d1c9e[_0x03ef('0x30')](_0x03ef('0x78'));_0x3d1c9e[_0x03ef('0x30')](_0x03ef('0x79'),_0x03ef('0x7a'));}if(_0x11073e[_0x03ef('0x11')])_0x3d1c9e[_0x03ef('0x11')](_0x11073e['limit']);if(_0x11073e[_0x03ef('0x13')])_0x3d1c9e[_0x03ef('0x13')](_0x11073e['offset']);return db['sequelize'][_0x03ef('0x26')](_0x3d1c9e[_0x03ef('0x6f')](),_0x30fe3b);});})['then'](function(_0x5a0e20){_0x5a0e20[_0x03ef('0x45')](function(_0x7d275f){if(_0x7d275f[_0x03ef('0x7a')]){_0x7d275f[_0x03ef('0x7b')]=[];_0x7d275f[_0x03ef('0x7a')][_0x03ef('0x43')](',')[_0x03ef('0x45')](function(_0x39b84e){_0x7d275f['Tags']['push'](_0x24f1c1[_0x39b84e]);});}delete _0x7d275f[_0x03ef('0x7a')];});_0x5c1a36[_0x03ef('0x7c')]=_0x5a0e20;return _0x5c1a36;})[_0x03ef('0x16')](respondWithFilteredResult(_0x5d56e1,_0x11073e));})['catch'](handleError(_0x5d56e1,null));};exports[_0x03ef('0x7d')]=function(_0x38838e,_0x2f0e72){return db['CmContact'][_0x03ef('0x41')]({'where':{'id':_0x38838e['params']['id']}})[_0x03ef('0x16')](handleEntityNotFound(_0x2f0e72,null))[_0x03ef('0x16')](removeEntity(_0x2f0e72,null))['catch'](handleError(_0x2f0e72,null));};exports[_0x03ef('0x1c')]=function(_0x5d8f2d,_0x1dc93c){return db[_0x03ef('0x1b')][_0x03ef('0x1c')]()[_0x03ef('0x16')](function(_0x4f7dd5){delete _0x4f7dd5[_0x03ef('0x7e')];for(var _0x49a584=0x0;_0x49a584=_0x367005){_0x2b4538=_0x367005;_0x3cd5dc=0xc8;}else{_0x3cd5dc=0xce;}_0x576d08[_0xc423('0x13')](_0x3cd5dc);return _0x576d08['set'](_0xc423('0x14'),_0x28241f+'-'+_0x2b4538+'/'+_0x367005)[_0xc423('0xe')](_0x571ce4);}return null;};}function saveUpdates(_0xff2cec){return function(_0x518a56){if(_0x518a56){return _0x518a56['update'](_0xff2cec)[_0xc423('0x15')](function(_0x56c75c){return _0x56c75c;});}return null;};}function removeEntity(_0x439f8f){return function(_0xa89615){if(_0xa89615){return _0xa89615['destroy']()['then'](function(){_0x439f8f[_0xc423('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x430fe0){return function(_0x56f4b6){if(!_0x56f4b6){_0x430fe0[_0xc423('0x16')](0x194);}return _0x56f4b6;};}function handleError(_0x2f0318,_0xdf9412){_0xdf9412=_0xdf9412||0x1f4;return function(_0x5b475f){logger[_0xc423('0x17')](_0x5b475f[_0xc423('0x18')]);if(_0x5b475f[_0xc423('0x19')]){delete _0x5b475f[_0xc423('0x19')];}_0x2f0318[_0xc423('0x13')](_0xdf9412)[_0xc423('0x1a')](_0x5b475f);};}exports[_0xc423('0x1b')]=function(_0x8192f3,_0x2b0cf5){var _0x3a42c1={},_0x1002a3={},_0x305d75={'count':0x0,'rows':[]};return db[_0xc423('0x1c')]['describe']()[_0xc423('0x15')](function(_0x1b061b){var _0x4c204e=[];for(var _0x1833ec=0x0;_0x1833ec0x1){_0x430833['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x5be898),null);}else{if(qs[_0xc423('0x5b')](_0x5be898)){_0x430833['or']('c.id\x20LIKE\x20?',_0x5be898+'%');_0x430833['or']('c.phone\x20LIKE\x20?',_0x5be898+'%');_0x430833['or']('c.mobile\x20LIKE\x20?',_0x5be898+'%');_0x430833['or'](_0xc423('0x5c'),_0x5be898+'%');}else if(qs['isEmail'](_0x5be898)){_0x430833['or'](_0xc423('0x5d'),_0x5be898+'%');}else{_0x430833['or'](_0xc423('0x5e'),'%'+_0x5be898+'%');_0x430833['or']('c.lastName\x20LIKE\x20?','%'+_0x5be898+'%');_0x430833['or'](_0xc423('0x5d'),'%'+_0x5be898+'%');}}}}_0x4b2b94[_0xc423('0x30')](_0x430833);_0x4b2b94[_0xc423('0x5f')]('c.id');var _0x375b93={'type':db[_0xc423('0x60')]['QueryTypes'][_0xc423('0x61')],'raw':!![]};var _0x3c34c5=_0x4b2b94[_0xc423('0x62')]()[_0xc423('0x33')]('c.id');if(_0x3a42c1['order']){_0x3a42c1[_0xc423('0x2e')][_0xc423('0x45')](function(_0x753da5){_0x4b2b94[_0xc423('0x2e')]('c.'+_0x753da5[0x0],_0x753da5[0x1]===_0xc423('0x63')?![]:!![]);});}if(!_[_0xc423('0x54')](_0x55e181)){_0x4b2b94[_0xc423('0x64')](_0x10fb26);_0x3c34c5['where'](_0xc423('0x65'),_0x55e181);}BPromise[_0xc423('0x66')]()[_0xc423('0x15')](function(){if(!_0x566254)return;if(_0x8192f3[_0xc423('0x67')][_0xc423('0x68')]!==_0xc423('0x69'))return;if(!_[_0xc423('0x6a')](_0x566254['conditions'],[_0xc423('0x33'),'User'])){return _0x8192f3['user'][_0xc423('0x6b')]({'attributes':['id'],'raw':!![]})[_0xc423('0x15')](function(_0x1dde89){if(_[_0xc423('0x54')](_0x1dde89)){_0x3c34c5[_0xc423('0x30')](_0xc423('0x6c'));_0x4b2b94['where'](_0xc423('0x6c'));}else{_0x3c34c5['where'](_0xc423('0x56'),_['map'](_0x1dde89,'id'));_0x4b2b94[_0xc423('0x30')](_0xc423('0x56'),_[_0xc423('0x44')](_0x1dde89,'id'));}});}})['then'](function(){if(_0x8192f3[_0xc423('0x67')][_0xc423('0x68')]==='agent'&&!_0x566254&&!_0x8192f3[_0xc423('0x27')][_0xc423('0x55')])return[];return db[_0xc423('0x6d')][_0xc423('0x27')](_0x3c34c5[_0xc423('0x6e')](),_0x375b93);})['then'](function(_0x273e65){_0x305d75[_0xc423('0x10')]=_0x273e65[_0xc423('0x1e')];if(_0x305d75['count']===0x0)return[];return db[_0xc423('0x6d')][_0xc423('0x27')](_0x45b9a5['toString'](),_0x375b93)[_0xc423('0x15')](function(_0x227ec0){_0x437055=_['keyBy'](_0x227ec0,'id');_0x375b93=_[_0xc423('0x6f')](_0x375b93,{'model':db['CmContact'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x8192f3[_0xc423('0x27')][_0xc423('0x2b')]){_0x3a42c1[_0xc423('0x2c')][_0xc423('0x45')](function(_0x235437){_0x4b2b94[_0xc423('0x33')]('c.'+_0x235437);});}else{_0x4b2b94[_0xc423('0x33')](_0xc423('0x70'));_0x4b2b94['field'](_0xc423('0x71'));_0x4b2b94['field'](_0xc423('0x72'));_0x4b2b94[_0xc423('0x33')](_0xc423('0x73'));_0x4b2b94[_0xc423('0x33')](_0xc423('0x74'));_0x4b2b94[_0xc423('0x33')](_0xc423('0x75'));_0x4b2b94['field'](_0xc423('0x76'));_0x4b2b94[_0xc423('0x33')]('c.ListId');_0x4b2b94['field'](_0xc423('0x77'));_0x4b2b94['field']('c.deletedAt');_0x4b2b94[_0xc423('0x33')](_0xc423('0x78'));_0x4b2b94[_0xc423('0x33')](_0xc423('0x79'),_0xc423('0x7a'));}if(_0x3a42c1['limit'])_0x4b2b94['limit'](_0x3a42c1[_0xc423('0x12')]);if(_0x3a42c1[_0xc423('0x11')])_0x4b2b94[_0xc423('0x11')](_0x3a42c1[_0xc423('0x11')]);return db[_0xc423('0x6d')][_0xc423('0x27')](_0x4b2b94[_0xc423('0x6e')](),_0x375b93);});})[_0xc423('0x15')](function(_0x5ea514){_0x5ea514[_0xc423('0x45')](function(_0x1d967e){if(_0x1d967e[_0xc423('0x7a')]){_0x1d967e[_0xc423('0x7b')]=[];_0x1d967e[_0xc423('0x7a')]['split'](',')[_0xc423('0x45')](function(_0x37ae7c){_0x1d967e[_0xc423('0x7b')]['push'](_0x437055[_0x37ae7c]);});}delete _0x1d967e['TagIds'];});_0x305d75['rows']=_0x5ea514;return _0x305d75;})[_0xc423('0x15')](respondWithFilteredResult(_0x2b0cf5,_0x3a42c1));})[_0xc423('0x7c')](handleError(_0x2b0cf5,null));};exports['destroy']=function(_0x2f1138,_0x679216){return db['CmContact']['find']({'where':{'id':_0x2f1138[_0xc423('0x7d')]['id']}})[_0xc423('0x15')](handleEntityNotFound(_0x679216,null))[_0xc423('0x15')](removeEntity(_0x679216,null))[_0xc423('0x7c')](handleError(_0x679216,null));};exports[_0xc423('0x7e')]=function(_0x577406,_0x5d5d46){return db[_0xc423('0x1c')][_0xc423('0x7e')]()['then'](function(_0x34a8ac){delete _0x34a8ac['tags'];for(var _0x245568=0x0;_0x245568{}\s\\|]/g,'-');_0x2e9d8f(null,util[_0xa2b1('0x1f')](_0xa2b1('0x20'),path[_0xa2b1('0x21')](_0xbffd58[_0xa2b1('0x1e')],path[_0xa2b1('0x22')](_0xbffd58[_0xa2b1('0x1e')])),Date['now'](),path[_0xa2b1('0x22')](_0xbffd58[_0xa2b1('0x1e')])));}})});router[_0xa2b1('0x19')](_0xa2b1('0x23'),upload[_0xa2b1('0x24')](_0xa2b1('0x25')),controller[_0xa2b1('0x26')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2468e4,_0x550f79,_0x5f4d54){_0x5f4d54(null,path[_0xa2b1('0x1d')](config[_0xa2b1('0x27')],_0xa2b1('0x28')));},'filename':function(_0x20a7a2,_0x5a4069,_0x4ce843){_0x5a4069[_0xa2b1('0x1e')]=_0x5a4069[_0xa2b1('0x1e')][_0xa2b1('0x29')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4ce843(null,util['format']('%s-%s%s',path[_0xa2b1('0x21')](_0x5a4069[_0xa2b1('0x1e')],path['extname'](_0x5a4069[_0xa2b1('0x1e')])),Date[_0xa2b1('0x2a')](),path[_0xa2b1('0x22')](_0x5a4069[_0xa2b1('0x1e')])));}})});router[_0xa2b1('0x19')](_0xa2b1('0x2b'),upload[_0xa2b1('0x24')]('file'),controller[_0xa2b1('0x2c')]);router[_0xa2b1('0x19')]('/upload/:id',auth[_0xa2b1('0x8')](),controller[_0xa2b1('0x2d')]);router[_0xa2b1('0x2e')](_0xa2b1('0xb'),auth[_0xa2b1('0x8')](),controller[_0xa2b1('0x2f')]);router[_0xa2b1('0x30')](_0xa2b1('0xb'),auth[_0xa2b1('0x8')](),controller[_0xa2b1('0x31')]);module[_0xa2b1('0x32')]=router; \ No newline at end of file +var _0x0ecf=['show','getTags','/:id/hoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','/:id/journey','post','/merge','merge','create','/create_many','bulkCreate','setTags','diskStorage','server/files/tmp','originalname','format','%s-%s%s','basename','extname','/csv','single','upload','/upload/:id','import','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./cmContact.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x89b9df,_0x1ae06f){var _0x2e78b0=function(_0x225c9d){while(--_0x225c9d){_0x89b9df['push'](_0x89b9df['shift']());}};_0x2e78b0(++_0x1ae06f);}(_0x0ecf,0xfa));var _0xf0ec=function(_0x14da3b,_0x6b9857){_0x14da3b=_0x14da3b-0x0;var _0x30a464=_0x0ecf[_0x14da3b];return _0x30a464;};'use strict';var multer=require(_0xf0ec('0x0'));var util=require(_0xf0ec('0x1'));var path=require(_0xf0ec('0x2'));var timeout=require(_0xf0ec('0x3'));var express=require('express');var router=express[_0xf0ec('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xf0ec('0x5'));var config=require(_0xf0ec('0x6'));var controller=require(_0xf0ec('0x7'));router[_0xf0ec('0x8')]('/',auth[_0xf0ec('0x9')](),controller[_0xf0ec('0xa')]);router[_0xf0ec('0x8')](_0xf0ec('0xb'),auth['isAuthenticated'](),controller[_0xf0ec('0xc')]);router['get'](_0xf0ec('0xd'),auth[_0xf0ec('0x9')](),controller[_0xf0ec('0xe')]);router[_0xf0ec('0x8')]('/:id/tags',auth[_0xf0ec('0x9')](),controller[_0xf0ec('0xf')]);router[_0xf0ec('0x8')](_0xf0ec('0x10'),auth[_0xf0ec('0x9')](),controller['getHoppers']);router[_0xf0ec('0x8')](_0xf0ec('0x11'),auth[_0xf0ec('0x9')](),controller[_0xf0ec('0x12')]);router['get'](_0xf0ec('0x13'),auth[_0xf0ec('0x9')](),controller['getHopperFinals']);router[_0xf0ec('0x8')]('/:id/jscripty_sessions',auth[_0xf0ec('0x9')](),controller['getJscriptySessions']);router[_0xf0ec('0x8')](_0xf0ec('0x14'),auth[_0xf0ec('0x9')](),controller['getJourney']);router[_0xf0ec('0x15')](_0xf0ec('0x16'),auth[_0xf0ec('0x9')](),controller[_0xf0ec('0x17')]);router[_0xf0ec('0x15')]('/',auth['isAuthenticated'](),controller[_0xf0ec('0x18')]);router[_0xf0ec('0x15')](_0xf0ec('0x19'),auth[_0xf0ec('0x9')](),controller[_0xf0ec('0x1a')]);router[_0xf0ec('0x15')]('/:id/tags',auth['isAuthenticated'](),controller[_0xf0ec('0x1b')]);var upload=multer({'storage':multer[_0xf0ec('0x1c')]({'destination':function(_0x25ba60,_0x36408f,_0x1169f2){_0x1169f2(null,path['join'](config['root'],_0xf0ec('0x1d')));},'filename':function(_0x4bdb5e,_0x21a6bb,_0x29e50e){_0x21a6bb[_0xf0ec('0x1e')]=_0x21a6bb[_0xf0ec('0x1e')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x29e50e(null,util[_0xf0ec('0x1f')](_0xf0ec('0x20'),path[_0xf0ec('0x21')](_0x21a6bb[_0xf0ec('0x1e')],path[_0xf0ec('0x22')](_0x21a6bb['originalname'])),Date['now'](),path[_0xf0ec('0x22')](_0x21a6bb['originalname'])));}})});router['post'](_0xf0ec('0x23'),upload[_0xf0ec('0x24')]('file'),controller['uploadCsv']);var upload=multer({'storage':multer[_0xf0ec('0x1c')]({'destination':function(_0x10b1d9,_0x3b8742,_0x4bf622){_0x4bf622(null,path['join'](config['root'],_0xf0ec('0x1d')));},'filename':function(_0x22d44d,_0x465254,_0x1b37c9){_0x465254[_0xf0ec('0x1e')]=_0x465254['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1b37c9(null,util['format'](_0xf0ec('0x20'),path[_0xf0ec('0x21')](_0x465254['originalname'],path['extname'](_0x465254['originalname'])),Date['now'](),path[_0xf0ec('0x22')](_0x465254[_0xf0ec('0x1e')])));}})});router[_0xf0ec('0x15')]('/upload',upload['single']('file'),controller[_0xf0ec('0x25')]);router['post'](_0xf0ec('0x26'),auth['isAuthenticated'](),controller[_0xf0ec('0x27')]);router[_0xf0ec('0x28')](_0xf0ec('0xd'),auth[_0xf0ec('0x9')](),controller['update']);router[_0xf0ec('0x29')](_0xf0ec('0xd'),auth['isAuthenticated'](),controller[_0xf0ec('0x2a')]);module[_0xf0ec('0x2b')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 120540a..c727f61 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 _0x2833=['lodash','exports','VIRTUAL','getDataValue','STRING','setDataValue','alias','long','select','values','isArray','stringify','BOOLEAN','sequelize'];(function(_0x46c7fe,_0x2b6b9a){var _0x2cbbf7=function(_0x2efc37){while(--_0x2efc37){_0x46c7fe['push'](_0x46c7fe['shift']());}};_0x2cbbf7(++_0x2b6b9a);}(_0x2833,0x187));var _0x3283=function(_0x566048,_0xa7c107){_0x566048=_0x566048-0x0;var _0x41fb7e=_0x2833[_0x566048];return _0x41fb7e;};'use strict';var Sequelize=require(_0x3283('0x0'));var _=require(_0x3283('0x1'));module[_0x3283('0x2')]={'name':{'type':Sequelize[_0x3283('0x3')],'get':function(_0x462746){return this[_0x3283('0x4')]('alias');}},'alias':{'type':Sequelize[_0x3283('0x5')],'allowNull':![],'set':function(_0x1b8b79){this[_0x3283('0x6')](_0x3283('0x7'),_0x1b8b79?_0x1b8b79:this[_0x3283('0x4')]('name'));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize['TEXT'](_0x3283('0x8')),'get':function(){if(this[_0x3283('0x4')]('type')===_0x3283('0x9')){return JSON['parse'](this['getDataValue'](_0x3283('0xa')));}else{return this[_0x3283('0x4')](_0x3283('0xa'));}},'set':function(_0x5d2e25){if(Array[_0x3283('0xb')](_0x5d2e25)){this['setDataValue'](_0x3283('0xa'),JSON[_0x3283('0xc')](_0x5d2e25));}else{this[_0x3283('0x6')](_0x3283('0xa'),_0x5d2e25);}}},'required':{'type':Sequelize[_0x3283('0xd')],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM']('voice')}}; \ No newline at end of file +var _0xd67e=['voice','sequelize','lodash','exports','VIRTUAL','getDataValue','alias','STRING','TEXT','type','select','parse','values','isArray','setDataValue','stringify','BOOLEAN'];(function(_0x20b42c,_0x1180f6){var _0x2abe15=function(_0x823ed3){while(--_0x823ed3){_0x20b42c['push'](_0x20b42c['shift']());}};_0x2abe15(++_0x1180f6);}(_0xd67e,0xde));var _0xed67=function(_0x2e3a00,_0x58d319){_0x2e3a00=_0x2e3a00-0x0;var _0x4edb13=_0xd67e[_0x2e3a00];return _0x4edb13;};'use strict';var Sequelize=require(_0xed67('0x0'));var _=require(_0xed67('0x1'));module[_0xed67('0x2')]={'name':{'type':Sequelize[_0xed67('0x3')],'get':function(_0x4c9a57){return this[_0xed67('0x4')](_0xed67('0x5'));}},'alias':{'type':Sequelize[_0xed67('0x6')],'allowNull':![],'set':function(_0x1577c3){this['setDataValue'](_0xed67('0x5'),_0x1577c3?_0x1577c3:this[_0xed67('0x4')]('name'));}},'type':{'type':Sequelize[_0xed67('0x6')],'allowNull':![]},'values':{'type':Sequelize[_0xed67('0x7')]('long'),'get':function(){if(this[_0xed67('0x4')](_0xed67('0x8'))===_0xed67('0x9')){return JSON[_0xed67('0xa')](this[_0xed67('0x4')]('values'));}else{return this[_0xed67('0x4')](_0xed67('0xb'));}},'set':function(_0x3dd1b8){if(Array[_0xed67('0xc')](_0x3dd1b8)){this[_0xed67('0xd')](_0xed67('0xb'),JSON[_0xed67('0xe')](_0x3dd1b8));}else{this['setDataValue'](_0xed67('0xb'),_0x3dd1b8);}}},'required':{'type':Sequelize[_0xed67('0xf')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xed67('0xf')],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM'](_0xed67('0x10'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index d5d5813..9e50655 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 _0xea98=['queryInterface','addColumn','cm_contacts','format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','CmCustomField','rawAttributes','fieldName','type','model','differenceBy','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','options','includeAll','include','findAll','catch','show','params','find','body','transaction','create','TEXT','text','Sequelize','number','INTEGER','switch','BOOLEAN','defaultValue','sequelize'];(function(_0x4827b3,_0x375541){var _0x1050df=function(_0x332def){while(--_0x332def){_0x4827b3['push'](_0x4827b3['shift']());}};_0x1050df(++_0x375541);}(_0xea98,0x1c6));var _0x8ea9=function(_0x4b87e2,_0x58dec0){_0x4b87e2=_0x4b87e2-0x0;var _0x5911b6=_0xea98[_0x4b87e2];return _0x5911b6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8ea9('0x0'));var zipdir=require(_0x8ea9('0x1'));var jsonpatch=require(_0x8ea9('0x2'));var rp=require(_0x8ea9('0x3'));var moment=require('moment');var BPromise=require(_0x8ea9('0x4'));var Mustache=require(_0x8ea9('0x5'));var util=require(_0x8ea9('0x6'));var path=require(_0x8ea9('0x7'));var sox=require('sox');var csv=require(_0x8ea9('0x8'));var ejs=require(_0x8ea9('0x9'));var fs=require('fs');var fs_extra=require(_0x8ea9('0xa'));var _=require(_0x8ea9('0xb'));var squel=require('squel');var crypto=require(_0x8ea9('0xc'));var jsforce=require(_0x8ea9('0xd'));var deskjs=require(_0x8ea9('0xe'));var toCsv=require(_0x8ea9('0x8'));var querystring=require(_0x8ea9('0xf'));var Papa=require(_0x8ea9('0x10'));var Redis=require(_0x8ea9('0x11'));var authService=require(_0x8ea9('0x12'));var qs=require(_0x8ea9('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8ea9('0x14'));var logger=require(_0x8ea9('0x15'))(_0x8ea9('0x16'));var utils=require(_0x8ea9('0x17'));var config=require(_0x8ea9('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x8ea9('0x19'))['db'];function respondWithStatusCode(_0x3c5d29,_0x72d165){_0x72d165=_0x72d165||0xcc;return function(_0x4041e0){if(_0x4041e0){return _0x3c5d29[_0x8ea9('0x1a')](_0x72d165);}return _0x3c5d29[_0x8ea9('0x1b')](_0x72d165)[_0x8ea9('0x1c')]();};}function respondWithResult(_0x13f659,_0x46bccb){_0x46bccb=_0x46bccb||0xc8;return function(_0x1bd43a){if(_0x1bd43a){return _0x13f659['status'](_0x46bccb)[_0x8ea9('0x1d')](_0x1bd43a);}};}function respondWithFilteredResult(_0x44eaa1,_0x532e2f){return function(_0x56632a){if(_0x56632a){var _0x3399cc=typeof _0x532e2f[_0x8ea9('0x1e')]===_0x8ea9('0x1f')&&typeof _0x532e2f['limit']==='undefined';var _0x5d57f9=_0x56632a['count'];var _0x4df92d=_0x3399cc?0x0:_0x532e2f[_0x8ea9('0x1e')];var _0xb873d0=_0x3399cc?_0x56632a[_0x8ea9('0x20')]:_0x532e2f[_0x8ea9('0x1e')]+_0x532e2f[_0x8ea9('0x21')];var _0x2a46c;if(_0xb873d0>=_0x5d57f9){_0xb873d0=_0x5d57f9;_0x2a46c=0xc8;}else{_0x2a46c=0xce;}_0x44eaa1['status'](_0x2a46c);return _0x44eaa1['set']('Content-Range',_0x4df92d+'-'+_0xb873d0+'/'+_0x5d57f9)[_0x8ea9('0x1d')](_0x56632a);}return null;};}function patchUpdates(_0x40f9f7){return function(_0x2651ac){try{jsonpatch[_0x8ea9('0x22')](_0x2651ac,_0x40f9f7,!![]);}catch(_0x56baa6){return BPromise[_0x8ea9('0x23')](_0x56baa6);}return _0x2651ac[_0x8ea9('0x24')]();};}function saveUpdates(_0x5bc36f,_0x19fe61){return function(_0x1a107c){if(_0x1a107c){return _0x1a107c[_0x8ea9('0x25')](_0x5bc36f)[_0x8ea9('0x26')](function(_0x43b193){return _0x43b193;});}return null;};}function removeEntity(_0x11fa65,_0xd9abdf){return function(_0x10fe46){if(_0x10fe46){return _0x10fe46[_0x8ea9('0x27')]()[_0x8ea9('0x26')](function(){_0x11fa65[_0x8ea9('0x1b')](0xcc)[_0x8ea9('0x1c')]();});}};}function handleEntityNotFound(_0x3b9f2d,_0x16a176){return function(_0x49741d){if(!_0x49741d){_0x3b9f2d[_0x8ea9('0x1a')](0x194);}return _0x49741d;};}function handleError(_0x573809,_0x2267f9){_0x2267f9=_0x2267f9||0x1f4;return function(_0x51292b){logger[_0x8ea9('0x28')](_0x51292b[_0x8ea9('0x29')]);if(_0x51292b['name']){delete _0x51292b[_0x8ea9('0x2a')];}_0x573809[_0x8ea9('0x1b')](_0x2267f9)[_0x8ea9('0x2b')](_0x51292b);};}exports[_0x8ea9('0x2c')]=function(_0x486693,_0x4e2389){var _0x49cc39={},_0x5979b2={},_0x552022={'count':0x0,'rows':[]};var _0x38fc4e=_[_0x8ea9('0x2d')](db[_0x8ea9('0x2e')][_0x8ea9('0x2f')],function(_0x4d42d1){return{'name':_0x4d42d1[_0x8ea9('0x30')],'type':_0x4d42d1[_0x8ea9('0x31')]['key']};});_0x5979b2[_0x8ea9('0x32')]=_[_0x8ea9('0x33')](_[_0x8ea9('0x2d')](_0x38fc4e,_0x8ea9('0x2a')),[_0x8ea9('0x2a')]);_0x5979b2['query']=_[_0x8ea9('0x34')](_0x486693['query']);_0x5979b2[_0x8ea9('0x35')]=_[_0x8ea9('0x36')](_0x5979b2[_0x8ea9('0x32')],_0x5979b2[_0x8ea9('0x37')]);_0x49cc39[_0x8ea9('0x38')]=_[_0x8ea9('0x36')](_0x5979b2[_0x8ea9('0x32')],qs[_0x8ea9('0x39')](_0x486693[_0x8ea9('0x37')][_0x8ea9('0x39')]));_0x49cc39['attributes']=_0x49cc39['attributes'][_0x8ea9('0x3a')]?_0x49cc39[_0x8ea9('0x38')]:_0x5979b2[_0x8ea9('0x32')];if(!_0x486693[_0x8ea9('0x37')][_0x8ea9('0x3b')](_0x8ea9('0x3c'))){_0x49cc39[_0x8ea9('0x21')]=qs[_0x8ea9('0x21')](_0x486693['query'][_0x8ea9('0x21')]);_0x49cc39[_0x8ea9('0x1e')]=qs[_0x8ea9('0x1e')](_0x486693['query'][_0x8ea9('0x1e')]);}_0x49cc39[_0x8ea9('0x3d')]=qs[_0x8ea9('0x3e')](_0x486693[_0x8ea9('0x37')][_0x8ea9('0x3e')]);_0x49cc39[_0x8ea9('0x3f')]=qs[_0x8ea9('0x35')](_[_0x8ea9('0x40')](_0x486693[_0x8ea9('0x37')],_0x5979b2[_0x8ea9('0x35')]),_0x38fc4e);if(_0x486693[_0x8ea9('0x37')]['filter']){_0x49cc39[_0x8ea9('0x3f')]=_[_0x8ea9('0x41')](_0x49cc39[_0x8ea9('0x3f')],{'$or':_[_0x8ea9('0x2d')](_0x38fc4e,function(_0x3a7409){if(_0x3a7409[_0x8ea9('0x31')]!=='VIRTUAL'){var _0x2dc458={};_0x2dc458[_0x3a7409['name']]={'$like':'%'+_0x486693[_0x8ea9('0x37')]['filter']+'%'};return _0x2dc458;}})});}_0x49cc39=_[_0x8ea9('0x41')]({},_0x49cc39,_0x486693[_0x8ea9('0x42')]);var _0x2fad95={'where':_0x49cc39['where']};return db[_0x8ea9('0x2e')][_0x8ea9('0x20')](_0x2fad95)[_0x8ea9('0x26')](function(_0x148608){_0x552022[_0x8ea9('0x20')]=_0x148608;if(_0x486693[_0x8ea9('0x37')][_0x8ea9('0x43')]){_0x49cc39[_0x8ea9('0x44')]=[{'all':!![]}];}return db[_0x8ea9('0x2e')][_0x8ea9('0x45')](_0x49cc39);})[_0x8ea9('0x26')](function(_0x6e8e86){_0x552022['rows']=_0x6e8e86;return _0x552022;})['then'](respondWithFilteredResult(_0x4e2389,_0x49cc39))[_0x8ea9('0x46')](handleError(_0x4e2389,null));};exports[_0x8ea9('0x47')]=function(_0xfdfcd6,_0x502e23){var _0x12e81b={'raw':!![],'where':{'id':_0xfdfcd6[_0x8ea9('0x48')]['id']}},_0x347fee={};_0x347fee['model']=_['keys'](db['CmCustomField'][_0x8ea9('0x2f')]);_0x347fee['query']=_['keys'](_0xfdfcd6['query']);_0x347fee[_0x8ea9('0x35')]=_[_0x8ea9('0x36')](_0x347fee['model'],_0x347fee[_0x8ea9('0x37')]);_0x12e81b[_0x8ea9('0x38')]=_[_0x8ea9('0x36')](_0x347fee[_0x8ea9('0x32')],qs[_0x8ea9('0x39')](_0xfdfcd6[_0x8ea9('0x37')][_0x8ea9('0x39')]));_0x12e81b['attributes']=_0x12e81b['attributes'][_0x8ea9('0x3a')]?_0x12e81b[_0x8ea9('0x38')]:_0x347fee[_0x8ea9('0x32')];if(_0xfdfcd6[_0x8ea9('0x37')][_0x8ea9('0x43')]){_0x12e81b[_0x8ea9('0x44')]=[{'all':!![]}];}_0x12e81b=_[_0x8ea9('0x41')]({},_0x12e81b,_0xfdfcd6[_0x8ea9('0x42')]);return db['CmCustomField'][_0x8ea9('0x49')](_0x12e81b)[_0x8ea9('0x26')](handleEntityNotFound(_0x502e23,null))['then'](respondWithResult(_0x502e23,null))[_0x8ea9('0x46')](handleError(_0x502e23,null));};exports[_0x8ea9('0x25')]=function(_0x3d4223,_0x14750d){if(_0x3d4223['body']['id']){delete _0x3d4223[_0x8ea9('0x4a')]['id'];}return db[_0x8ea9('0x2e')][_0x8ea9('0x49')]({'where':{'id':_0x3d4223['params']['id']}})[_0x8ea9('0x26')](handleEntityNotFound(_0x14750d,null))['then'](saveUpdates(_0x3d4223[_0x8ea9('0x4a')],null))[_0x8ea9('0x26')](respondWithResult(_0x14750d,null))[_0x8ea9('0x46')](handleError(_0x14750d,null));};exports[_0x8ea9('0x27')]=function(_0x370d1e,_0x599ad7){return db[_0x8ea9('0x2e')][_0x8ea9('0x49')]({'where':{'id':_0x370d1e['params']['id']}})[_0x8ea9('0x26')](handleEntityNotFound(_0x599ad7,null))[_0x8ea9('0x26')](removeEntity(_0x599ad7,null))[_0x8ea9('0x46')](handleError(_0x599ad7,null));};exports['create']=function(_0x1bb226,_0x14a977){var _0x3237e7;return db['sequelize'][_0x8ea9('0x4b')](function(_0x15f503){return db[_0x8ea9('0x2e')][_0x8ea9('0x4c')](_0x1bb226[_0x8ea9('0x4a')],{'transaction':_0x15f503})[_0x8ea9('0x26')](function(_0xe0265){_0x3237e7=_0xe0265;var _0x278fd2={'type':db['Sequelize'][_0x8ea9('0x4d')],'transaction':_0x15f503};switch(_0x1bb226[_0x8ea9('0x4a')]['type']){case _0x8ea9('0x4e'):_0x278fd2[_0x8ea9('0x31')]=db[_0x8ea9('0x4f')]['TEXT'];break;case _0x8ea9('0x50'):_0x278fd2['type']=db['Sequelize'][_0x8ea9('0x51')];break;case _0x8ea9('0x52'):_0x278fd2[_0x8ea9('0x31')]=db[_0x8ea9('0x4f')][_0x8ea9('0x53')];_0x278fd2[_0x8ea9('0x54')]=![];break;default:}return db[_0x8ea9('0x55')][_0x8ea9('0x56')][_0x8ea9('0x57')](_0x8ea9('0x58'),util[_0x8ea9('0x59')]('cf_%d',_0x3237e7['id']),_0x278fd2);})[_0x8ea9('0x26')](function(){return _0x3237e7;});})[_0x8ea9('0x26')](respondWithResult(_0x14a977,0xc9))[_0x8ea9('0x46')](handleError(_0x14a977,null));}; \ No newline at end of file +var _0xf14a=['path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','offset','undefined','limit','count','set','json','apply','update','then','destroy','error','name','send','index','map','CmCustomField','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','keys','length','includeAll','find','create','sequelize','transaction','Sequelize','TEXT','body','text','number','INTEGER','switch','BOOLEAN','defaultValue','addColumn','cm_contacts','format','cf_%d','eml-format','zip-dir','request-promise','moment'];(function(_0x171e4d,_0x4f2493){var _0x2d2bf4=function(_0x3a74cc){while(--_0x3a74cc){_0x171e4d['push'](_0x171e4d['shift']());}};_0x2d2bf4(++_0x4f2493);}(_0xf14a,0xaa));var _0xaf14=function(_0x21e06a,_0x9eae17){_0x21e06a=_0x21e06a-0x0;var _0x596088=_0xf14a[_0x21e06a];return _0x596088;};'use strict';var emlformat=require(_0xaf14('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xaf14('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaf14('0x2'));var moment=require(_0xaf14('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xaf14('0x4'));var sox=require(_0xaf14('0x5'));var csv=require(_0xaf14('0x6'));var ejs=require(_0xaf14('0x7'));var fs=require('fs');var fs_extra=require(_0xaf14('0x8'));var _=require(_0xaf14('0x9'));var squel=require(_0xaf14('0xa'));var crypto=require(_0xaf14('0xb'));var jsforce=require(_0xaf14('0xc'));var deskjs=require(_0xaf14('0xd'));var toCsv=require(_0xaf14('0x6'));var querystring=require(_0xaf14('0xe'));var Papa=require(_0xaf14('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xaf14('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaf14('0x11'));var logger=require(_0xaf14('0x12'))(_0xaf14('0x13'));var utils=require(_0xaf14('0x14'));var config=require(_0xaf14('0x15'));var licenseUtil=require(_0xaf14('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x27926c,_0x4e26c8){_0x4e26c8=_0x4e26c8||0xcc;return function(_0x5ac1a4){if(_0x5ac1a4){return _0x27926c[_0xaf14('0x17')](_0x4e26c8);}return _0x27926c['status'](_0x4e26c8)[_0xaf14('0x18')]();};}function respondWithResult(_0x35b550,_0x2b5026){_0x2b5026=_0x2b5026||0xc8;return function(_0x1e5e13){if(_0x1e5e13){return _0x35b550[_0xaf14('0x19')](_0x2b5026)['json'](_0x1e5e13);}};}function respondWithFilteredResult(_0x43a400,_0x34ae6e){return function(_0x172cad){if(_0x172cad){var _0x163421=typeof _0x34ae6e[_0xaf14('0x1a')]===_0xaf14('0x1b')&&typeof _0x34ae6e[_0xaf14('0x1c')]===_0xaf14('0x1b');var _0x47775d=_0x172cad['count'];var _0x29c6b3=_0x163421?0x0:_0x34ae6e['offset'];var _0x19c762=_0x163421?_0x172cad[_0xaf14('0x1d')]:_0x34ae6e[_0xaf14('0x1a')]+_0x34ae6e[_0xaf14('0x1c')];var _0x328f90;if(_0x19c762>=_0x47775d){_0x19c762=_0x47775d;_0x328f90=0xc8;}else{_0x328f90=0xce;}_0x43a400[_0xaf14('0x19')](_0x328f90);return _0x43a400[_0xaf14('0x1e')]('Content-Range',_0x29c6b3+'-'+_0x19c762+'/'+_0x47775d)[_0xaf14('0x1f')](_0x172cad);}return null;};}function patchUpdates(_0x464567){return function(_0x1da6b5){try{jsonpatch[_0xaf14('0x20')](_0x1da6b5,_0x464567,!![]);}catch(_0x14ddbd){return BPromise['reject'](_0x14ddbd);}return _0x1da6b5['save']();};}function saveUpdates(_0x1f4bbd,_0x585395){return function(_0x185f15){if(_0x185f15){return _0x185f15[_0xaf14('0x21')](_0x1f4bbd)[_0xaf14('0x22')](function(_0xa1b40f){return _0xa1b40f;});}return null;};}function removeEntity(_0x103fff,_0x5f471e){return function(_0x5f087d){if(_0x5f087d){return _0x5f087d[_0xaf14('0x23')]()[_0xaf14('0x22')](function(){_0x103fff[_0xaf14('0x19')](0xcc)[_0xaf14('0x18')]();});}};}function handleEntityNotFound(_0x284bda,_0xca851f){return function(_0x15e6d5){if(!_0x15e6d5){_0x284bda[_0xaf14('0x17')](0x194);}return _0x15e6d5;};}function handleError(_0x4af171,_0x27d7c8){_0x27d7c8=_0x27d7c8||0x1f4;return function(_0x564c0d){logger[_0xaf14('0x24')](_0x564c0d['stack']);if(_0x564c0d[_0xaf14('0x25')]){delete _0x564c0d[_0xaf14('0x25')];}_0x4af171[_0xaf14('0x19')](_0x27d7c8)[_0xaf14('0x26')](_0x564c0d);};}exports[_0xaf14('0x27')]=function(_0x527c30,_0xa49eb8){var _0x16a47f={},_0x4cda84={},_0x49d455={'count':0x0,'rows':[]};var _0x3f3b23=_[_0xaf14('0x28')](db[_0xaf14('0x29')][_0xaf14('0x2a')],function(_0x581832){return{'name':_0x581832[_0xaf14('0x2b')],'type':_0x581832[_0xaf14('0x2c')][_0xaf14('0x2d')]};});_0x4cda84[_0xaf14('0x2e')]=_['differenceBy'](_[_0xaf14('0x28')](_0x3f3b23,_0xaf14('0x25')),[_0xaf14('0x25')]);_0x4cda84[_0xaf14('0x2f')]=_['keys'](_0x527c30[_0xaf14('0x2f')]);_0x4cda84[_0xaf14('0x30')]=_['intersection'](_0x4cda84['model'],_0x4cda84[_0xaf14('0x2f')]);_0x16a47f[_0xaf14('0x31')]=_[_0xaf14('0x32')](_0x4cda84[_0xaf14('0x2e')],qs[_0xaf14('0x33')](_0x527c30[_0xaf14('0x2f')][_0xaf14('0x33')]));_0x16a47f[_0xaf14('0x31')]=_0x16a47f['attributes']['length']?_0x16a47f[_0xaf14('0x31')]:_0x4cda84[_0xaf14('0x2e')];if(!_0x527c30[_0xaf14('0x2f')]['hasOwnProperty'](_0xaf14('0x34'))){_0x16a47f['limit']=qs[_0xaf14('0x1c')](_0x527c30[_0xaf14('0x2f')][_0xaf14('0x1c')]);_0x16a47f[_0xaf14('0x1a')]=qs['offset'](_0x527c30[_0xaf14('0x2f')][_0xaf14('0x1a')]);}_0x16a47f[_0xaf14('0x35')]=qs[_0xaf14('0x36')](_0x527c30[_0xaf14('0x2f')][_0xaf14('0x36')]);_0x16a47f['where']=qs['filters'](_[_0xaf14('0x37')](_0x527c30['query'],_0x4cda84[_0xaf14('0x30')]),_0x3f3b23);if(_0x527c30[_0xaf14('0x2f')][_0xaf14('0x38')]){_0x16a47f[_0xaf14('0x39')]=_[_0xaf14('0x3a')](_0x16a47f['where'],{'$or':_[_0xaf14('0x28')](_0x3f3b23,function(_0x368d55){if(_0x368d55['type']!==_0xaf14('0x3b')){var _0x95b376={};_0x95b376[_0x368d55[_0xaf14('0x25')]]={'$like':'%'+_0x527c30[_0xaf14('0x2f')][_0xaf14('0x38')]+'%'};return _0x95b376;}})});}_0x16a47f=_[_0xaf14('0x3a')]({},_0x16a47f,_0x527c30[_0xaf14('0x3c')]);var _0xe358a5={'where':_0x16a47f[_0xaf14('0x39')]};return db[_0xaf14('0x29')][_0xaf14('0x1d')](_0xe358a5)[_0xaf14('0x22')](function(_0x17fcd8){_0x49d455[_0xaf14('0x1d')]=_0x17fcd8;if(_0x527c30['query']['includeAll']){_0x16a47f[_0xaf14('0x3d')]=[{'all':!![]}];}return db[_0xaf14('0x29')][_0xaf14('0x3e')](_0x16a47f);})[_0xaf14('0x22')](function(_0x4f3f41){_0x49d455[_0xaf14('0x3f')]=_0x4f3f41;return _0x49d455;})[_0xaf14('0x22')](respondWithFilteredResult(_0xa49eb8,_0x16a47f))[_0xaf14('0x40')](handleError(_0xa49eb8,null));};exports[_0xaf14('0x41')]=function(_0x1e9aba,_0x193bf7){var _0x2c4d9f={'raw':!![],'where':{'id':_0x1e9aba[_0xaf14('0x42')]['id']}},_0x573c45={};_0x573c45[_0xaf14('0x2e')]=_[_0xaf14('0x43')](db[_0xaf14('0x29')][_0xaf14('0x2a')]);_0x573c45[_0xaf14('0x2f')]=_[_0xaf14('0x43')](_0x1e9aba[_0xaf14('0x2f')]);_0x573c45['filters']=_[_0xaf14('0x32')](_0x573c45['model'],_0x573c45['query']);_0x2c4d9f[_0xaf14('0x31')]=_['intersection'](_0x573c45[_0xaf14('0x2e')],qs[_0xaf14('0x33')](_0x1e9aba['query'][_0xaf14('0x33')]));_0x2c4d9f[_0xaf14('0x31')]=_0x2c4d9f[_0xaf14('0x31')][_0xaf14('0x44')]?_0x2c4d9f['attributes']:_0x573c45[_0xaf14('0x2e')];if(_0x1e9aba[_0xaf14('0x2f')][_0xaf14('0x45')]){_0x2c4d9f['include']=[{'all':!![]}];}_0x2c4d9f=_[_0xaf14('0x3a')]({},_0x2c4d9f,_0x1e9aba['options']);return db[_0xaf14('0x29')][_0xaf14('0x46')](_0x2c4d9f)[_0xaf14('0x22')](handleEntityNotFound(_0x193bf7,null))[_0xaf14('0x22')](respondWithResult(_0x193bf7,null))[_0xaf14('0x40')](handleError(_0x193bf7,null));};exports['update']=function(_0x310179,_0x1ed66a){if(_0x310179['body']['id']){delete _0x310179['body']['id'];}return db[_0xaf14('0x29')][_0xaf14('0x46')]({'where':{'id':_0x310179['params']['id']}})[_0xaf14('0x22')](handleEntityNotFound(_0x1ed66a,null))['then'](saveUpdates(_0x310179['body'],null))[_0xaf14('0x22')](respondWithResult(_0x1ed66a,null))[_0xaf14('0x40')](handleError(_0x1ed66a,null));};exports[_0xaf14('0x23')]=function(_0x54def6,_0x229175){return db['CmCustomField']['find']({'where':{'id':_0x54def6[_0xaf14('0x42')]['id']}})[_0xaf14('0x22')](handleEntityNotFound(_0x229175,null))[_0xaf14('0x22')](removeEntity(_0x229175,null))['catch'](handleError(_0x229175,null));};exports[_0xaf14('0x47')]=function(_0x3a958f,_0x1d8301){var _0x238f3a;return db[_0xaf14('0x48')][_0xaf14('0x49')](function(_0x5091c3){return db[_0xaf14('0x29')][_0xaf14('0x47')](_0x3a958f['body'],{'transaction':_0x5091c3})[_0xaf14('0x22')](function(_0x410cfb){_0x238f3a=_0x410cfb;var _0xd0c69b={'type':db[_0xaf14('0x4a')][_0xaf14('0x4b')],'transaction':_0x5091c3};switch(_0x3a958f[_0xaf14('0x4c')]['type']){case _0xaf14('0x4d'):_0xd0c69b['type']=db[_0xaf14('0x4a')]['TEXT'];break;case _0xaf14('0x4e'):_0xd0c69b[_0xaf14('0x2c')]=db[_0xaf14('0x4a')][_0xaf14('0x4f')];break;case _0xaf14('0x50'):_0xd0c69b['type']=db[_0xaf14('0x4a')][_0xaf14('0x51')];_0xd0c69b[_0xaf14('0x52')]=![];break;default:}return db['sequelize']['queryInterface'][_0xaf14('0x53')](_0xaf14('0x54'),util[_0xaf14('0x55')](_0xaf14('0x56'),_0x238f3a['id']),_0xd0c69b);})['then'](function(){return _0x238f3a;});})[_0xaf14('0x22')](respondWithResult(_0x1d8301,0xc9))[_0xaf14('0x40')](handleError(_0x1d8301,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 131bb1e..a7eb9c8 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 _0x61da=['define','CmCustomField','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./cmCustomField.attributes'];(function(_0x56a594,_0x2698c1){var _0x4c9acf=function(_0x41a443){while(--_0x41a443){_0x56a594['push'](_0x56a594['shift']());}};_0x4c9acf(++_0x2698c1);}(_0x61da,0x16a));var _0xa61d=function(_0x585daa,_0x425bdd){_0x585daa=_0x585daa-0x0;var _0x1f1e8a=_0x61da[_0x585daa];return _0x1f1e8a;};'use strict';var _=require(_0xa61d('0x0'));var util=require(_0xa61d('0x1'));var logger=require(_0xa61d('0x2'))(_0xa61d('0x3'));var moment=require(_0xa61d('0x4'));var BPromise=require(_0xa61d('0x5'));var rp=require(_0xa61d('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa61d('0x7'));var config=require(_0xa61d('0x8'));var attributes=require(_0xa61d('0x9'));module['exports']=function(_0x427499,_0x3aee1a){return _0x427499[_0xa61d('0xa')](_0xa61d('0xb'),attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xebd8=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','CmCustomField','cm_custom_fields','lodash','util','../../config/logger'];(function(_0x356fc6,_0x4bb5d8){var _0x232743=function(_0x4852d6){while(--_0x4852d6){_0x356fc6['push'](_0x356fc6['shift']());}};_0x232743(++_0x4bb5d8);}(_0xebd8,0xc1));var _0x8ebd=function(_0x2e35ee,_0x3e44a4){_0x2e35ee=_0x2e35ee-0x0;var _0x47358f=_0xebd8[_0x2e35ee];return _0x47358f;};'use strict';var _=require(_0x8ebd('0x0'));var util=require(_0x8ebd('0x1'));var logger=require(_0x8ebd('0x2'))(_0x8ebd('0x3'));var moment=require(_0x8ebd('0x4'));var BPromise=require(_0x8ebd('0x5'));var rp=require(_0x8ebd('0x6'));var fs=require('fs');var path=require(_0x8ebd('0x7'));var rimraf=require(_0x8ebd('0x8'));var config=require(_0x8ebd('0x9'));var attributes=require('./cmCustomField.attributes');module[_0x8ebd('0xa')]=function(_0x27dd3b,_0x1f307a){return _0x27dd3b[_0x8ebd('0xb')](_0x8ebd('0xc'),attributes,{'tableName':_0x8ebd('0xd'),'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 95d75f7..c0ee8bb 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 _0x9117=['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','CmCustomField,\x20%s,\x20%s','request\x20sent','CmCustomField,\x20%s,\x20%s,\x20%s'];(function(_0x26acf9,_0x16c720){var _0x57c983=function(_0xea0219){while(--_0xea0219){_0x26acf9['push'](_0x26acf9['shift']());}};_0x57c983(++_0x16c720);}(_0x9117,0x118));var _0x7911=function(_0x4c5f45,_0x629730){_0x4c5f45=_0x4c5f45-0x0;var _0x2e2824=_0x9117[_0x4c5f45];return _0x2e2824;};'use strict';var _=require(_0x7911('0x0'));var util=require(_0x7911('0x1'));var moment=require(_0x7911('0x2'));var BPromise=require(_0x7911('0x3'));var rs=require(_0x7911('0x4'));var fs=require('fs');var Redis=require(_0x7911('0x5'));var db=require(_0x7911('0x6'))['db'];var utils=require(_0x7911('0x7'));var logger=require(_0x7911('0x8'))(_0x7911('0x9'));var config=require(_0x7911('0xa'));var jayson=require(_0x7911('0xb'));var client=jayson[_0x7911('0xc')][_0x7911('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x163589,_0x5a5d78,_0x3ef752){return new BPromise(function(_0x1d74f3,_0x243f0f){return client[_0x7911('0xe')](_0x163589,_0x3ef752)[_0x7911('0xf')](function(_0x524273){logger[_0x7911('0x10')](_0x7911('0x11'),_0x5a5d78,_0x7911('0x12'));logger['debug'](_0x7911('0x13'),_0x5a5d78,_0x7911('0x12'),JSON['stringify'](_0x524273));if(_0x524273[_0x7911('0x14')]){if(_0x524273[_0x7911('0x14')][_0x7911('0x15')]===0x1f4){logger['error'](_0x7911('0x11'),_0x5a5d78,_0x524273[_0x7911('0x14')][_0x7911('0x16')]);return _0x243f0f(_0x524273['error'][_0x7911('0x16')]);}logger[_0x7911('0x14')](_0x7911('0x11'),_0x5a5d78,_0x524273[_0x7911('0x14')][_0x7911('0x16')]);return _0x1d74f3(_0x524273['error'][_0x7911('0x16')]);}else{logger[_0x7911('0x10')](_0x7911('0x11'),_0x5a5d78,_0x7911('0x12'));_0x1d74f3(_0x524273[_0x7911('0x17')][_0x7911('0x16')]);}})[_0x7911('0x18')](function(_0x48bd07){logger[_0x7911('0x14')](_0x7911('0x11'),_0x5a5d78,_0x48bd07);_0x243f0f(_0x48bd07);});});} \ No newline at end of file +var _0x5044=['CmCustomField,\x20%s,\x20%s','request\x20sent','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','info'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0x5044,0x7c));var _0x4504=function(_0x195c6b,_0x558639){_0x195c6b=_0x195c6b-0x0;var _0x239123=_0x5044[_0x195c6b];return _0x239123;};'use strict';var _=require(_0x4504('0x0'));var util=require(_0x4504('0x1'));var moment=require(_0x4504('0x2'));var BPromise=require(_0x4504('0x3'));var rs=require(_0x4504('0x4'));var fs=require('fs');var Redis=require(_0x4504('0x5'));var db=require(_0x4504('0x6'))['db'];var utils=require(_0x4504('0x7'));var logger=require(_0x4504('0x8'))('rpc');var config=require(_0x4504('0x9'));var jayson=require(_0x4504('0xa'));var client=jayson[_0x4504('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x9b1a26,_0x14785e,_0x5c72e0){return new BPromise(function(_0x50b2d1,_0x20157c){return client['request'](_0x9b1a26,_0x5c72e0)[_0x4504('0xc')](function(_0x160b65){logger[_0x4504('0xd')](_0x4504('0xe'),_0x14785e,_0x4504('0xf'));logger['debug'](_0x4504('0x10'),_0x14785e,'request\x20sent',JSON[_0x4504('0x11')](_0x160b65));if(_0x160b65[_0x4504('0x12')]){if(_0x160b65['error'][_0x4504('0x13')]===0x1f4){logger[_0x4504('0x12')](_0x4504('0xe'),_0x14785e,_0x160b65['error']['message']);return _0x20157c(_0x160b65[_0x4504('0x12')][_0x4504('0x14')]);}logger[_0x4504('0x12')](_0x4504('0xe'),_0x14785e,_0x160b65[_0x4504('0x12')][_0x4504('0x14')]);return _0x50b2d1(_0x160b65[_0x4504('0x12')][_0x4504('0x14')]);}else{logger[_0x4504('0xd')]('CmCustomField,\x20%s,\x20%s',_0x14785e,'request\x20sent');_0x50b2d1(_0x160b65[_0x4504('0x15')]['message']);}})[_0x4504('0x16')](function(_0xdd2460){logger[_0x4504('0x12')]('CmCustomField,\x20%s,\x20%s',_0x14785e,_0xdd2460);_0x20157c(_0xdd2460);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 4b589b6..f32852b 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 _0xeec6=['./cmCustomField.controller','isAuthenticated','index','/:id','show','post','create','put','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x36c9fb,_0x307935){var _0x818f0a=function(_0x1f6882){while(--_0x1f6882){_0x36c9fb['push'](_0x36c9fb['shift']());}};_0x818f0a(++_0x307935);}(_0xeec6,0x1c2));var _0x6eec=function(_0x22eb96,_0x3c2d8d){_0x22eb96=_0x22eb96-0x0;var _0x5e1adf=_0xeec6[_0x22eb96];return _0x5e1adf;};'use strict';var multer=require(_0x6eec('0x0'));var util=require(_0x6eec('0x1'));var path=require(_0x6eec('0x2'));var timeout=require(_0x6eec('0x3'));var express=require('express');var router=express[_0x6eec('0x4')]();var fs_extra=require(_0x6eec('0x5'));var auth=require(_0x6eec('0x6'));var interaction=require(_0x6eec('0x7'));var config=require(_0x6eec('0x8'));var controller=require(_0x6eec('0x9'));router['get']('/',auth[_0x6eec('0xa')](),controller[_0x6eec('0xb')]);router['get'](_0x6eec('0xc'),auth[_0x6eec('0xa')](),controller[_0x6eec('0xd')]);router[_0x6eec('0xe')]('/',auth['isAuthenticated'](),controller[_0x6eec('0xf')]);router[_0x6eec('0x10')](_0x6eec('0xc'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x6eec('0xc'),auth[_0x6eec('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xdc97=['get','isAuthenticated','show','post','create','put','update','delete','/:id','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../config/environment','./cmCustomField.controller'];(function(_0x440ee1,_0x33457c){var _0x423f53=function(_0x3139d1){while(--_0x3139d1){_0x440ee1['push'](_0x440ee1['shift']());}};_0x423f53(++_0x33457c);}(_0xdc97,0x13b));var _0x7dc9=function(_0x171bad,_0x2b79d1){_0x171bad=_0x171bad-0x0;var _0x582297=_0xdc97[_0x171bad];return _0x582297;};'use strict';var multer=require(_0x7dc9('0x0'));var util=require(_0x7dc9('0x1'));var path=require(_0x7dc9('0x2'));var timeout=require('connect-timeout');var express=require(_0x7dc9('0x3'));var router=express['Router']();var fs_extra=require(_0x7dc9('0x4'));var auth=require(_0x7dc9('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7dc9('0x6'));var controller=require(_0x7dc9('0x7'));router[_0x7dc9('0x8')]('/',auth[_0x7dc9('0x9')](),controller['index']);router[_0x7dc9('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x7dc9('0xa')]);router[_0x7dc9('0xb')]('/',auth[_0x7dc9('0x9')](),controller[_0x7dc9('0xc')]);router[_0x7dc9('0xd')]('/:id',auth[_0x7dc9('0x9')](),controller[_0x7dc9('0xe')]);router[_0x7dc9('0xf')](_0x7dc9('0x10'),auth[_0x7dc9('0x9')](),controller[_0x7dc9('0x11')]);module[_0x7dc9('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 393ca32..03a570f 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 _0x6df6=['contactListQueue','moment','sequelize','STRING','DATE','format','INTEGER','BOOLEAN','UNSIGNED'];(function(_0x597646,_0x3b7fa5){var _0x3d2ee8=function(_0x8fe622){while(--_0x8fe622){_0x597646['push'](_0x597646['shift']());}};_0x3d2ee8(++_0x3b7fa5);}(_0x6df6,0xa3));var _0x66df=function(_0x49fcfb,_0x504dec){_0x49fcfb=_0x49fcfb-0x0;var _0x964926=_0x6df6[_0x49fcfb];return _0x964926;};'use strict';var moment=require(_0x66df('0x0'));var Sequelize=require(_0x66df('0x1'));module['exports']={'phone':{'type':Sequelize[_0x66df('0x2')],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x66df('0x3')],'defaultValue':moment()[_0x66df('0x4')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0x66df('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x66df('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x66df('0x5')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x66df('0x6')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x66df('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize[_0x66df('0x5')](0x2)[_0x66df('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x66df('0x8')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x66df('0x8')},'UserId':{'type':Sequelize[_0x66df('0x5')]},'VoiceQueueId':{'type':Sequelize[_0x66df('0x5')],'unique':_0x66df('0x8')},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize[_0x66df('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x66df('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x66df('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x66df('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x3b0b=['YYYY-MM-DD\x20HH:mm:ss','INTEGER','BOOLEAN','DATE','contactListQueue','moment','sequelize','exports','STRING'];(function(_0x1c3832,_0x2175cf){var _0x21f506=function(_0x322b43){while(--_0x322b43){_0x1c3832['push'](_0x1c3832['shift']());}};_0x21f506(++_0x2175cf);}(_0x3b0b,0xe6));var _0xb3b0=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0x3b0b[_0x491a7f];return _0x3d8f44;};'use strict';var moment=require(_0xb3b0('0x0'));var Sequelize=require(_0xb3b0('0x1'));module[_0xb3b0('0x2')]={'phone':{'type':Sequelize[_0xb3b0('0x3')],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()['format'](_0xb3b0('0x4'))},'countbusyretry':{'type':Sequelize[_0xb3b0('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xb3b0('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xb3b0('0x5')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xb3b0('0x6')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xb3b0('0x7')]},'priority':{'type':Sequelize[_0xb3b0('0x5')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xb3b0('0x5')],'unique':_0xb3b0('0x8')},'ListId':{'type':Sequelize[_0xb3b0('0x5')],'unique':_0xb3b0('0x8')},'UserId':{'type':Sequelize[_0xb3b0('0x5')]},'VoiceQueueId':{'type':Sequelize[_0xb3b0('0x5')],'unique':_0xb3b0('0x8')},'CampaignId':{'type':Sequelize[_0xb3b0('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0xb3b0('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xb3b0('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xb3b0('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xb3b0('0x5')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index 18272e3..1244dd7 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 _0xab2a=['sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','error','index','map','CmHopper','rawAttributes','fieldName','type','key','name','query','keys','filters','intersection','model','$and','$gt','$gte','$ne','$eq','$not','$between','$in','$like','$notLike','$iLike','$notILike','$overlap','$contained','$any','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','show','params','create','body','describe','find','CampaignId','VoiceQueueId','VoiceQueue','Campaign','omit','dataValues','updatedAt','statedesc','deleted','campaign','membername','user','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','phone','campaigntype','ivr','CmContact','ContactId','firstName','lastName','isNil','calleridname','CmHopperFinal','getPreview','outbound','preview','dialPreviewAutoRecallMe','value','direction','prev','isEmpty','hopperIds','ASC','dialOrderByScheduledAt','DESC','sequelize','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','priority','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','UPDATE','Contact','CmCompany','Company','CmList','List','Queue','dialActive','getOpenContacts','getVoiceQueues','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','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'];(function(_0x48564d,_0x2c1c8c){var _0x2ad779=function(_0x4490dd){while(--_0x4490dd){_0x48564d['push'](_0x48564d['shift']());}};_0x2ad779(++_0x2c1c8c);}(_0xab2a,0x1a1));var _0xaab2=function(_0x35a791,_0x877a12){_0x35a791=_0x35a791-0x0;var _0x3ba2b8=_0xab2a[_0x35a791];return _0x3ba2b8;};'use strict';var emlformat=require(_0xaab2('0x0'));var rimraf=require(_0xaab2('0x1'));var zipdir=require(_0xaab2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaab2('0x3'));var moment=require('moment');var BPromise=require(_0xaab2('0x4'));var Mustache=require(_0xaab2('0x5'));var util=require(_0xaab2('0x6'));var path=require('path');var sox=require(_0xaab2('0x7'));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(_0xaab2('0x8'));var crypto=require(_0xaab2('0x9'));var jsforce=require(_0xaab2('0xa'));var deskjs=require(_0xaab2('0xb'));var toCsv=require(_0xaab2('0xc'));var querystring=require(_0xaab2('0xd'));var Papa=require(_0xaab2('0xe'));var Redis=require(_0xaab2('0xf'));var authService=require(_0xaab2('0x10'));var qs=require(_0xaab2('0x11'));var as=require(_0xaab2('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xaab2('0x13'))('api');var utils=require(_0xaab2('0x14'));var config=require(_0xaab2('0x15'));var licenseUtil=require(_0xaab2('0x16'));var db=require(_0xaab2('0x17'))['db'];function respondWithStatusCode(_0x56d19d,_0x433136){_0x433136=_0x433136||0xcc;return function(_0x84d7db){if(_0x84d7db){return _0x56d19d[_0xaab2('0x18')](_0x433136);}return _0x56d19d[_0xaab2('0x19')](_0x433136)[_0xaab2('0x1a')]();};}function respondWithResult(_0x1549ec,_0x5cdabe){_0x5cdabe=_0x5cdabe||0xc8;return function(_0x58cab0){if(_0x58cab0){return _0x1549ec[_0xaab2('0x19')](_0x5cdabe)[_0xaab2('0x1b')](_0x58cab0);}};}function respondWithFilteredResult(_0x5d8dc1,_0x39585c){return function(_0x17cbb3){if(_0x17cbb3){var _0x3e59a7=typeof _0x39585c[_0xaab2('0x1c')]===_0xaab2('0x1d')&&typeof _0x39585c['limit']==='undefined';var _0x1b58a7=_0x17cbb3[_0xaab2('0x1e')];var _0x4d796a=_0x3e59a7?0x0:_0x39585c[_0xaab2('0x1c')];var _0x27b87d=_0x3e59a7?_0x17cbb3['count']:_0x39585c['offset']+_0x39585c[_0xaab2('0x1f')];var _0x67aca3;if(_0x27b87d>=_0x1b58a7){_0x27b87d=_0x1b58a7;_0x67aca3=0xc8;}else{_0x67aca3=0xce;}_0x5d8dc1[_0xaab2('0x19')](_0x67aca3);return _0x5d8dc1[_0xaab2('0x20')](_0xaab2('0x21'),_0x4d796a+'-'+_0x27b87d+'/'+_0x1b58a7)[_0xaab2('0x1b')](_0x17cbb3);}return null;};}function patchUpdates(_0x37bd23){return function(_0x17b7fd){try{jsonpatch[_0xaab2('0x22')](_0x17b7fd,_0x37bd23,!![]);}catch(_0x2de8a9){return BPromise[_0xaab2('0x23')](_0x2de8a9);}return _0x17b7fd[_0xaab2('0x24')]();};}function saveUpdates(_0x20cd3a,_0x358848){return function(_0x22452d){if(_0x22452d){return _0x22452d[_0xaab2('0x25')](_0x20cd3a)[_0xaab2('0x26')](function(_0x3e8fc7){return _0x3e8fc7;});}return null;};}function removeEntity(_0x134ebb,_0x57595e){return function(_0x2ce729){if(_0x2ce729){return _0x2ce729['destroy']()[_0xaab2('0x26')](function(){_0x134ebb['status'](0xcc)[_0xaab2('0x1a')]();});}};}function handleEntityNotFound(_0x2900aa,_0x4d7ed){return function(_0x35e3e6){if(!_0x35e3e6){_0x2900aa[_0xaab2('0x18')](0x194);}return _0x35e3e6;};}function handleError(_0xae3537,_0x50caa3){_0x50caa3=_0x50caa3||0x1f4;return function(_0x445733){logger[_0xaab2('0x27')](_0x445733['stack']);if(_0x445733['name']){delete _0x445733['name'];}_0xae3537[_0xaab2('0x19')](_0x50caa3)['send'](_0x445733);};}exports[_0xaab2('0x28')]=function(_0x258dd7,_0x6f13d4){var _0x5a4a49={},_0x578501={},_0x217975={'count':0x0,'rows':[]};var _0x4dcbd0=_[_0xaab2('0x29')](db[_0xaab2('0x2a')][_0xaab2('0x2b')],function(_0x2e30f5){return{'name':_0x2e30f5[_0xaab2('0x2c')],'type':_0x2e30f5[_0xaab2('0x2d')][_0xaab2('0x2e')]};});_0x578501['model']=_[_0xaab2('0x29')](_0x4dcbd0,_0xaab2('0x2f'));_0x578501[_0xaab2('0x30')]=_[_0xaab2('0x31')](_0x258dd7['query']);_0x578501[_0xaab2('0x32')]=_[_0xaab2('0x33')](_0x578501[_0xaab2('0x34')],_0x578501[_0xaab2('0x30')]);_0x578501[_0xaab2('0x32')]=_['concat'](_0x578501[_0xaab2('0x32')],[_0xaab2('0x35'),'$or',_0xaab2('0x36'),_0xaab2('0x37'),'$lt','$lte',_0xaab2('0x38'),_0xaab2('0x39'),_0xaab2('0x3a'),_0xaab2('0x3b'),'$notBetween',_0xaab2('0x3c'),'$notIn',_0xaab2('0x3d'),_0xaab2('0x3e'),_0xaab2('0x3f'),_0xaab2('0x40'),'$like',_0xaab2('0x41'),'$contains',_0xaab2('0x42'),_0xaab2('0x43')]);_0x5a4a49[_0xaab2('0x44')]=_[_0xaab2('0x33')](_0x578501[_0xaab2('0x34')],qs['fields'](_0x258dd7[_0xaab2('0x30')][_0xaab2('0x45')]));_0x5a4a49[_0xaab2('0x44')]=_0x5a4a49[_0xaab2('0x44')][_0xaab2('0x46')]?_0x5a4a49['attributes']:_0x578501[_0xaab2('0x34')];if(!_0x258dd7[_0xaab2('0x30')][_0xaab2('0x47')](_0xaab2('0x48'))){_0x5a4a49[_0xaab2('0x1f')]=qs[_0xaab2('0x1f')](_0x258dd7['query'][_0xaab2('0x1f')]);_0x5a4a49[_0xaab2('0x1c')]=qs[_0xaab2('0x1c')](_0x258dd7[_0xaab2('0x30')][_0xaab2('0x1c')]);}_0x5a4a49[_0xaab2('0x49')]=qs[_0xaab2('0x4a')](_0x258dd7[_0xaab2('0x30')][_0xaab2('0x4a')]);_0x5a4a49[_0xaab2('0x4b')]=qs[_0xaab2('0x32')](_[_0xaab2('0x4c')](_0x258dd7[_0xaab2('0x30')],_0x578501[_0xaab2('0x32')]),_0x4dcbd0);if(_0x258dd7[_0xaab2('0x30')][_0xaab2('0x4d')]){_0x5a4a49[_0xaab2('0x4b')]=_[_0xaab2('0x4e')](_0x5a4a49[_0xaab2('0x4b')],{'$or':_[_0xaab2('0x29')](_0x4dcbd0,function(_0x5750bf){if(_0x5750bf[_0xaab2('0x2d')]!==_0xaab2('0x4f')){var _0x161976={};_0x161976[_0x5750bf[_0xaab2('0x2f')]]={'$like':'%'+_0x258dd7['query'][_0xaab2('0x4d')]+'%'};return _0x161976;}})});}_0x5a4a49=_[_0xaab2('0x4e')]({},_0x5a4a49,_0x258dd7[_0xaab2('0x50')]);var _0x19347a={'where':_0x5a4a49['where']};return db[_0xaab2('0x2a')][_0xaab2('0x1e')](_0x19347a)[_0xaab2('0x26')](function(_0x4adfc3){_0x217975[_0xaab2('0x1e')]=_0x4adfc3;if(_0x258dd7['query'][_0xaab2('0x51')]){_0x5a4a49[_0xaab2('0x52')]=[{'all':!![]}];}return db[_0xaab2('0x2a')]['findAll'](_0x5a4a49);})['then'](function(_0x4f201c){_0x217975['rows']=_0x4f201c;return _0x217975;})[_0xaab2('0x26')](respondWithFilteredResult(_0x6f13d4,_0x5a4a49))[_0xaab2('0x53')](handleError(_0x6f13d4,null));};exports[_0xaab2('0x54')]=function(_0x40d81d,_0xffd70e){var _0x2c3e26={'raw':!![],'where':{'id':_0x40d81d[_0xaab2('0x55')]['id']}},_0x2d91e5={};_0x2d91e5[_0xaab2('0x34')]=_['keys'](db['CmHopper'][_0xaab2('0x2b')]);_0x2d91e5[_0xaab2('0x30')]=_[_0xaab2('0x31')](_0x40d81d['query']);_0x2d91e5[_0xaab2('0x32')]=_[_0xaab2('0x33')](_0x2d91e5[_0xaab2('0x34')],_0x2d91e5['query']);_0x2c3e26[_0xaab2('0x44')]=_[_0xaab2('0x33')](_0x2d91e5['model'],qs[_0xaab2('0x45')](_0x40d81d[_0xaab2('0x30')][_0xaab2('0x45')]));_0x2c3e26['attributes']=_0x2c3e26[_0xaab2('0x44')][_0xaab2('0x46')]?_0x2c3e26[_0xaab2('0x44')]:_0x2d91e5[_0xaab2('0x34')];if(_0x40d81d[_0xaab2('0x30')]['includeAll']){_0x2c3e26[_0xaab2('0x52')]=[{'all':!![]}];}_0x2c3e26=_[_0xaab2('0x4e')]({},_0x2c3e26,_0x40d81d[_0xaab2('0x50')]);return db[_0xaab2('0x2a')]['find'](_0x2c3e26)[_0xaab2('0x26')](handleEntityNotFound(_0xffd70e,null))[_0xaab2('0x26')](respondWithResult(_0xffd70e,null))[_0xaab2('0x53')](handleError(_0xffd70e,null));};exports[_0xaab2('0x56')]=function(_0x2cdad6,_0x203335){return db[_0xaab2('0x2a')]['create'](_0x2cdad6['body'],{})[_0xaab2('0x26')](respondWithResult(_0x203335,0xc9))[_0xaab2('0x53')](handleError(_0x203335,null));};exports[_0xaab2('0x25')]=function(_0x40d5fc,_0x47c4ee){if(_0x40d5fc[_0xaab2('0x57')]['id']){delete _0x40d5fc[_0xaab2('0x57')]['id'];}return db['CmHopper']['find']({'where':{'id':_0x40d5fc['params']['id']}})[_0xaab2('0x26')](handleEntityNotFound(_0x47c4ee,null))[_0xaab2('0x26')](saveUpdates(_0x40d5fc[_0xaab2('0x57')],null))[_0xaab2('0x26')](respondWithResult(_0x47c4ee,null))['catch'](handleError(_0x47c4ee,null));};exports[_0xaab2('0x58')]=function(_0x3733c9,_0x5ef62a){return db[_0xaab2('0x2a')][_0xaab2('0x58')]()[_0xaab2('0x26')](respondWithResult(_0x5ef62a,null))[_0xaab2('0x53')](handleError(_0x5ef62a,null));};exports['destroy']=function(_0x139136,_0x1f945d){var _0x36cef1;return db['CmHopper'][_0xaab2('0x59')]({'where':{'id':_0x139136['params']['id']}})[_0xaab2('0x26')](handleEntityNotFound(_0x1f945d,null))['then'](function(_0x86b333){if(_0x86b333){return _0x86b333['destroy']()[_0xaab2('0x26')](function(_0x5f0c61){return _0x5f0c61;});}})[_0xaab2('0x26')](function(_0x3c6788){_0x36cef1=_0x3c6788;if(_0x3c6788){if(_0x3c6788['VoiceQueueId']||_0x3c6788[_0xaab2('0x5a')]){return db[_0x3c6788[_0xaab2('0x5b')]?_0xaab2('0x5c'):_0xaab2('0x5d')][_0xaab2('0x59')]({'where':{'id':_0x3c6788[_0xaab2('0x5b')]?_0x3c6788[_0xaab2('0x5b')]:_0x3c6788[_0xaab2('0x5a')]},'attributes':['id',_0xaab2('0x2f')],'raw':!![]});}}})[_0xaab2('0x26')](function(_0x2612c2){var _0x592e44={};if(_0x2612c2){_[_0xaab2('0x4e')](_0x592e44,_[_0xaab2('0x5e')](_0x36cef1[_0xaab2('0x5f')],['createdAt',_0xaab2('0x60'),'id']));_0x592e44['state']=0x15;_0x592e44[_0xaab2('0x61')]=_0xaab2('0x62');_0x592e44[_0xaab2('0x63')]=_0x2612c2[_0xaab2('0x2f')];_0x592e44[_0xaab2('0x64')]=_0x139136[_0xaab2('0x65')]['name'];_0x592e44['UserId']=_0x139136[_0xaab2('0x65')]['id'];_0x592e44['deleted']=!![];_0x592e44[_0xaab2('0x66')]=moment()[_0xaab2('0x67')](_0xaab2('0x68'));_0x592e44['calleridnum']=_0x36cef1[_0xaab2('0x69')];_0x592e44[_0xaab2('0x6a')]=_0x36cef1[_0xaab2('0x5b')]?'queue':_0xaab2('0x6b');return db[_0xaab2('0x6c')]['find']({'where':{'id':_0x592e44[_0xaab2('0x6d')]},'attributes':[_0xaab2('0x6e'),_0xaab2('0x6f')]})[_0xaab2('0x26')](function(_0x38f7ad){if(!_[_0xaab2('0x70')](_0x1f945d)&&!_[_0xaab2('0x70')](_0x38f7ad[_0xaab2('0x6e')])){_0x592e44[_0xaab2('0x71')]=_0x38f7ad[_0xaab2('0x6e')];if(!_[_0xaab2('0x70')](_0x38f7ad[_0xaab2('0x6f')])){_0x592e44['calleridname']+='\x20'+_0x38f7ad[_0xaab2('0x6f')];}}})['finally'](function(){return db[_0xaab2('0x72')]['create'](_0x592e44);});}})[_0xaab2('0x26')](function(){return _0x1f945d[_0xaab2('0x19')](0xcc)[_0xaab2('0x1a')]();})[_0xaab2('0x53')](handleError(_0x1f945d,null));};exports[_0xaab2('0x73')]=function(_0x460f82,_0x191153,_0x31ec56){var _0x2ff92d=[];return db[_0xaab2('0x6c')][_0xaab2('0x58')]()[_0xaab2('0x26')](function(_0x6ba100){_0x2ff92d=_[_0xaab2('0x31')](_0x6ba100);return _0x460f82[_0xaab2('0x65')]['getVoiceQueues']({'where':{'type':_0xaab2('0x74'),'dialActive':!![],'dialMethod':_0xaab2('0x75')},'attributes':['id','dialOrderByScheduledAt',_0xaab2('0x76')],'raw':!![]});})[_0xaab2('0x26')](function(_0x11e8c2){if(_0x11e8c2&&_0x11e8c2[_0xaab2('0x46')]){return db['sequelize']['transaction'](function(_0x1984dd){var _0x380c3e={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xaab2('0x67')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0xaab2('0x29')](_0x11e8c2,'id')},'$or':[{'UserId':null},{'UserId':_0x460f82['user']['id']}]};var _0x53cd56={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x11e8c2)[_0xaab2('0x4d')]([_0xaab2('0x76'),0x0])[_0xaab2('0x29')]('id')[_0xaab2('0x77')]()},'$or':[{'UserId':null},{'UserId':_0x460f82[_0xaab2('0x65')]['id']}]};var _0x22cfce={'$or':[_0x380c3e,_0x53cd56]};var _0x42d89e=[];if(_0x460f82['body'][_0xaab2('0x78')]&&_0x460f82['body'][_0xaab2('0x78')]===_0xaab2('0x79')){if(!_[_0xaab2('0x7a')](_0x460f82[_0xaab2('0x57')][_0xaab2('0x7b')])){_0x22cfce['id']={'$in':_0x460f82[_0xaab2('0x57')][_0xaab2('0x7b')]};}_0x42d89e=[['priority',_0xaab2('0x7c')],['scheduledAt',_0x11e8c2[0x0][_0xaab2('0x7d')]==='ASC'?_0xaab2('0x7e'):_0xaab2('0x7c')],db[_0xaab2('0x7f')][_0xaab2('0x80')](_0xaab2('0x81')),['id',_0xaab2('0x7e')]];}else{if(!_[_0xaab2('0x7a')](_0x460f82[_0xaab2('0x57')]['hopperIds'])){_0x22cfce['id']={'$notIn':_0x460f82[_0xaab2('0x57')][_0xaab2('0x7b')]};}_0x42d89e=[[_0xaab2('0x82'),_0xaab2('0x7e')],['scheduledAt',_0x11e8c2[0x0][_0xaab2('0x7d')]],db[_0xaab2('0x7f')][_0xaab2('0x80')](_0xaab2('0x83')),['id',_0xaab2('0x7c')]];}return db[_0xaab2('0x2a')][_0xaab2('0x84')]({'attributes':['id',_0xaab2('0x85'),'recallme'],'where':_0x22cfce,'order':_0x42d89e,'transaction':_0x1984dd,'lock':_0x1984dd['LOCK'][_0xaab2('0x86')],'include':[{'model':db[_0xaab2('0x6c')],'as':_0xaab2('0x87'),'attributes':_0x2ff92d,'include':[{'model':db[_0xaab2('0x88')],'as':_0xaab2('0x89'),'attributes':['id',_0xaab2('0x2f')]}]},{'model':db[_0xaab2('0x8a')],'as':_0xaab2('0x8b'),'attributes':['id',_0xaab2('0x2f')]},{'model':db[_0xaab2('0x5c')],'as':_0xaab2('0x8c'),'attributes':['id',_0xaab2('0x2f'),_0xaab2('0x8d')]}]})['then'](function(_0x4c46ba){if(_0x4c46ba){return _0x4c46ba[_0xaab2('0x25')]({'UserId':_0x460f82[_0xaab2('0x65')]['id']},{'transaction':_0x1984dd});}});});}})[_0xaab2('0x26')](handleEntityNotFound(_0x191153,null))[_0xaab2('0x26')](respondWithResult(_0x191153,null))[_0xaab2('0x53')](handleError(_0x191153,null));};exports[_0xaab2('0x8e')]=function(_0x37804d,_0x202449,_0x548af0){return _0x37804d['user'][_0xaab2('0x8f')]({'where':{'type':_0xaab2('0x74'),'dialActive':!![],'dialMethod':_0xaab2('0x75')},'attributes':['id'],'raw':!![]})[_0xaab2('0x26')](function(_0x47fe11){if(_0x47fe11&&_0x47fe11['length']){return db[_0xaab2('0x2a')][_0xaab2('0x1e')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xaab2('0x67')](_0xaab2('0x68'))},'VoiceQueueId':{'$in':_[_0xaab2('0x29')](_0x47fe11,'id')},'$or':[{'UserId':null},{'UserId':_0x37804d[_0xaab2('0x65')]['id']}]}});}return 0x0;})[_0xaab2('0x26')](function(_0x4bc88f){if(!_['isNil'](_0x4bc88f)&&_[_0xaab2('0x90')](_0x4bc88f)){return _0x202449['status'](0xc8)['json']({'contacts':_0x4bc88f});}else{logger[_0xaab2('0x27')](_0xaab2('0x91'),_0xaab2('0x8e'),0x194,_0xaab2('0x92'));_0x202449[_0xaab2('0x18')](0x194);}})[_0xaab2('0x53')](handleError(_0x202449,null));}; \ No newline at end of file +var _0xd672=['CmList','Queue','dialActive','getOpenContacts','isNumber','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','end','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','send','index','map','CmHopper','fieldName','query','keys','filters','intersection','model','$or','$gt','$gte','$lt','$lte','$ne','$not','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contained','$any','attributes','length','order','sort','pick','filter','where','type','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','fields','include','find','create','body','describe','destroy','VoiceQueueId','VoiceQueue','omit','dataValues','createdAt','updatedAt','state','deleted','membername','UserId','deletedat','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','ivr','CmContact','ContactId','firstName','isNil','calleridname','lastName','finally','CmHopperFinal','getPreview','user','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','transaction','format','dialPreviewAutoRecallMe','value','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','DESC','sequelize','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','scheduledat','LOCK','UPDATE','CmCompany','Company'];(function(_0x4c9bdd,_0x487eff){var _0x2cc1cc=function(_0x42e32e){while(--_0x42e32e){_0x4c9bdd['push'](_0x4c9bdd['shift']());}};_0x2cc1cc(++_0x487eff);}(_0xd672,0x96));var _0x2d67=function(_0x207e3f,_0x499487){_0x207e3f=_0x207e3f-0x0;var _0x3a9460=_0xd672[_0x207e3f];return _0x3a9460;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2d67('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2d67('0x1'));var moment=require('moment');var BPromise=require(_0x2d67('0x2'));var Mustache=require(_0x2d67('0x3'));var util=require('util');var path=require(_0x2d67('0x4'));var sox=require(_0x2d67('0x5'));var csv=require(_0x2d67('0x6'));var ejs=require(_0x2d67('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x2d67('0x8'));var crypto=require(_0x2d67('0x9'));var jsforce=require(_0x2d67('0xa'));var deskjs=require(_0x2d67('0xb'));var toCsv=require('to-csv');var querystring=require(_0x2d67('0xc'));var Papa=require(_0x2d67('0xd'));var Redis=require(_0x2d67('0xe'));var authService=require(_0x2d67('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x2d67('0x10'));var hardwareService=require(_0x2d67('0x11'));var logger=require(_0x2d67('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x2d67('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x2d67('0x14'))['db'];function respondWithStatusCode(_0xcd5726,_0x1dfbbd){_0x1dfbbd=_0x1dfbbd||0xcc;return function(_0x5d88a0){if(_0x5d88a0){return _0xcd5726['sendStatus'](_0x1dfbbd);}return _0xcd5726['status'](_0x1dfbbd)[_0x2d67('0x15')]();};}function respondWithResult(_0x4fa4be,_0x2b3acc){_0x2b3acc=_0x2b3acc||0xc8;return function(_0x2c3408){if(_0x2c3408){return _0x4fa4be[_0x2d67('0x16')](_0x2b3acc)[_0x2d67('0x17')](_0x2c3408);}};}function respondWithFilteredResult(_0x397526,_0x1ff875){return function(_0x3aef32){if(_0x3aef32){var _0xd83cf9=typeof _0x1ff875[_0x2d67('0x18')]==='undefined'&&typeof _0x1ff875['limit']===_0x2d67('0x19');var _0x429411=_0x3aef32['count'];var _0x5ad412=_0xd83cf9?0x0:_0x1ff875[_0x2d67('0x18')];var _0xfad30f=_0xd83cf9?_0x3aef32[_0x2d67('0x1a')]:_0x1ff875[_0x2d67('0x18')]+_0x1ff875[_0x2d67('0x1b')];var _0x10864d;if(_0xfad30f>=_0x429411){_0xfad30f=_0x429411;_0x10864d=0xc8;}else{_0x10864d=0xce;}_0x397526[_0x2d67('0x16')](_0x10864d);return _0x397526['set'](_0x2d67('0x1c'),_0x5ad412+'-'+_0xfad30f+'/'+_0x429411)[_0x2d67('0x17')](_0x3aef32);}return null;};}function patchUpdates(_0x3ef872){return function(_0x5c2cd7){try{jsonpatch[_0x2d67('0x1d')](_0x5c2cd7,_0x3ef872,!![]);}catch(_0x54a63c){return BPromise[_0x2d67('0x1e')](_0x54a63c);}return _0x5c2cd7[_0x2d67('0x1f')]();};}function saveUpdates(_0xaa57e,_0x5da742){return function(_0x14632b){if(_0x14632b){return _0x14632b[_0x2d67('0x20')](_0xaa57e)[_0x2d67('0x21')](function(_0x29941f){return _0x29941f;});}return null;};}function removeEntity(_0x351132,_0x30581d){return function(_0x179fbf){if(_0x179fbf){return _0x179fbf['destroy']()[_0x2d67('0x21')](function(){_0x351132[_0x2d67('0x16')](0xcc)[_0x2d67('0x15')]();});}};}function handleEntityNotFound(_0x4b3750,_0x2855a9){return function(_0x3906c2){if(!_0x3906c2){_0x4b3750[_0x2d67('0x22')](0x194);}return _0x3906c2;};}function handleError(_0x41d9d5,_0x143c82){_0x143c82=_0x143c82||0x1f4;return function(_0x1ac3e7){logger[_0x2d67('0x23')](_0x1ac3e7[_0x2d67('0x24')]);if(_0x1ac3e7['name']){delete _0x1ac3e7[_0x2d67('0x25')];}_0x41d9d5[_0x2d67('0x16')](_0x143c82)[_0x2d67('0x26')](_0x1ac3e7);};}exports[_0x2d67('0x27')]=function(_0x471626,_0x27bbba){var _0x431f34={},_0xb9abe3={},_0x37e3a4={'count':0x0,'rows':[]};var _0x2c1a59=_[_0x2d67('0x28')](db[_0x2d67('0x29')]['rawAttributes'],function(_0x4c59a8){return{'name':_0x4c59a8[_0x2d67('0x2a')],'type':_0x4c59a8['type']['key']};});_0xb9abe3['model']=_[_0x2d67('0x28')](_0x2c1a59,_0x2d67('0x25'));_0xb9abe3[_0x2d67('0x2b')]=_[_0x2d67('0x2c')](_0x471626[_0x2d67('0x2b')]);_0xb9abe3[_0x2d67('0x2d')]=_[_0x2d67('0x2e')](_0xb9abe3[_0x2d67('0x2f')],_0xb9abe3[_0x2d67('0x2b')]);_0xb9abe3[_0x2d67('0x2d')]=_['concat'](_0xb9abe3[_0x2d67('0x2d')],['$and',_0x2d67('0x30'),_0x2d67('0x31'),_0x2d67('0x32'),_0x2d67('0x33'),_0x2d67('0x34'),_0x2d67('0x35'),'$eq',_0x2d67('0x36'),_0x2d67('0x37'),_0x2d67('0x38'),_0x2d67('0x39'),_0x2d67('0x3a'),_0x2d67('0x3b'),_0x2d67('0x3c'),_0x2d67('0x3d'),_0x2d67('0x3e'),'$like',_0x2d67('0x3f'),'$contains',_0x2d67('0x40'),_0x2d67('0x41')]);_0x431f34[_0x2d67('0x42')]=_[_0x2d67('0x2e')](_0xb9abe3[_0x2d67('0x2f')],qs['fields'](_0x471626[_0x2d67('0x2b')]['fields']));_0x431f34[_0x2d67('0x42')]=_0x431f34[_0x2d67('0x42')][_0x2d67('0x43')]?_0x431f34[_0x2d67('0x42')]:_0xb9abe3['model'];if(!_0x471626[_0x2d67('0x2b')]['hasOwnProperty']('nolimit')){_0x431f34[_0x2d67('0x1b')]=qs['limit'](_0x471626[_0x2d67('0x2b')][_0x2d67('0x1b')]);_0x431f34[_0x2d67('0x18')]=qs['offset'](_0x471626['query'][_0x2d67('0x18')]);}_0x431f34[_0x2d67('0x44')]=qs[_0x2d67('0x45')](_0x471626['query']['sort']);_0x431f34['where']=qs[_0x2d67('0x2d')](_[_0x2d67('0x46')](_0x471626['query'],_0xb9abe3[_0x2d67('0x2d')]),_0x2c1a59);if(_0x471626['query'][_0x2d67('0x47')]){_0x431f34[_0x2d67('0x48')]=_['merge'](_0x431f34[_0x2d67('0x48')],{'$or':_[_0x2d67('0x28')](_0x2c1a59,function(_0x2a871e){if(_0x2a871e[_0x2d67('0x49')]!==_0x2d67('0x4a')){var _0x26487d={};_0x26487d[_0x2a871e[_0x2d67('0x25')]]={'$like':'%'+_0x471626[_0x2d67('0x2b')]['filter']+'%'};return _0x26487d;}})});}_0x431f34=_[_0x2d67('0x4b')]({},_0x431f34,_0x471626[_0x2d67('0x4c')]);var _0x45b850={'where':_0x431f34[_0x2d67('0x48')]};return db['CmHopper'][_0x2d67('0x1a')](_0x45b850)[_0x2d67('0x21')](function(_0x5d58ee){_0x37e3a4[_0x2d67('0x1a')]=_0x5d58ee;if(_0x471626[_0x2d67('0x2b')][_0x2d67('0x4d')]){_0x431f34['include']=[{'all':!![]}];}return db[_0x2d67('0x29')][_0x2d67('0x4e')](_0x431f34);})[_0x2d67('0x21')](function(_0x5919dd){_0x37e3a4[_0x2d67('0x4f')]=_0x5919dd;return _0x37e3a4;})['then'](respondWithFilteredResult(_0x27bbba,_0x431f34))[_0x2d67('0x50')](handleError(_0x27bbba,null));};exports[_0x2d67('0x51')]=function(_0x4f1280,_0x4da460){var _0x11b2f5={'raw':!![],'where':{'id':_0x4f1280[_0x2d67('0x52')]['id']}},_0x159312={};_0x159312['model']=_[_0x2d67('0x2c')](db[_0x2d67('0x29')]['rawAttributes']);_0x159312['query']=_[_0x2d67('0x2c')](_0x4f1280[_0x2d67('0x2b')]);_0x159312[_0x2d67('0x2d')]=_[_0x2d67('0x2e')](_0x159312['model'],_0x159312['query']);_0x11b2f5[_0x2d67('0x42')]=_[_0x2d67('0x2e')](_0x159312['model'],qs[_0x2d67('0x53')](_0x4f1280[_0x2d67('0x2b')][_0x2d67('0x53')]));_0x11b2f5[_0x2d67('0x42')]=_0x11b2f5[_0x2d67('0x42')][_0x2d67('0x43')]?_0x11b2f5[_0x2d67('0x42')]:_0x159312[_0x2d67('0x2f')];if(_0x4f1280['query']['includeAll']){_0x11b2f5[_0x2d67('0x54')]=[{'all':!![]}];}_0x11b2f5=_[_0x2d67('0x4b')]({},_0x11b2f5,_0x4f1280[_0x2d67('0x4c')]);return db[_0x2d67('0x29')][_0x2d67('0x55')](_0x11b2f5)[_0x2d67('0x21')](handleEntityNotFound(_0x4da460,null))[_0x2d67('0x21')](respondWithResult(_0x4da460,null))[_0x2d67('0x50')](handleError(_0x4da460,null));};exports['create']=function(_0x18abc3,_0x54e8b2){return db[_0x2d67('0x29')][_0x2d67('0x56')](_0x18abc3[_0x2d67('0x57')],{})[_0x2d67('0x21')](respondWithResult(_0x54e8b2,0xc9))[_0x2d67('0x50')](handleError(_0x54e8b2,null));};exports[_0x2d67('0x20')]=function(_0x10ef43,_0x100ac3){if(_0x10ef43[_0x2d67('0x57')]['id']){delete _0x10ef43[_0x2d67('0x57')]['id'];}return db[_0x2d67('0x29')][_0x2d67('0x55')]({'where':{'id':_0x10ef43[_0x2d67('0x52')]['id']}})[_0x2d67('0x21')](handleEntityNotFound(_0x100ac3,null))['then'](saveUpdates(_0x10ef43[_0x2d67('0x57')],null))[_0x2d67('0x21')](respondWithResult(_0x100ac3,null))['catch'](handleError(_0x100ac3,null));};exports['describe']=function(_0x351be1,_0xd37a76){return db['CmHopper'][_0x2d67('0x58')]()[_0x2d67('0x21')](respondWithResult(_0xd37a76,null))[_0x2d67('0x50')](handleError(_0xd37a76,null));};exports[_0x2d67('0x59')]=function(_0x5b786d,_0x5538cf){var _0xebf66a;return db[_0x2d67('0x29')][_0x2d67('0x55')]({'where':{'id':_0x5b786d['params']['id']}})[_0x2d67('0x21')](handleEntityNotFound(_0x5538cf,null))['then'](function(_0x3d9589){if(_0x3d9589){return _0x3d9589[_0x2d67('0x59')]()[_0x2d67('0x21')](function(_0x11f616){return _0x11f616;});}})[_0x2d67('0x21')](function(_0x29fb2d){_0xebf66a=_0x29fb2d;if(_0x29fb2d){if(_0x29fb2d['VoiceQueueId']||_0x29fb2d['CampaignId']){return db[_0x29fb2d[_0x2d67('0x5a')]?_0x2d67('0x5b'):'Campaign'][_0x2d67('0x55')]({'where':{'id':_0x29fb2d[_0x2d67('0x5a')]?_0x29fb2d['VoiceQueueId']:_0x29fb2d['CampaignId']},'attributes':['id',_0x2d67('0x25')],'raw':!![]});}}})[_0x2d67('0x21')](function(_0x1ff237){var _0x3b2ac4={};if(_0x1ff237){_['merge'](_0x3b2ac4,_[_0x2d67('0x5c')](_0xebf66a[_0x2d67('0x5d')],[_0x2d67('0x5e'),_0x2d67('0x5f'),'id']));_0x3b2ac4[_0x2d67('0x60')]=0x15;_0x3b2ac4['statedesc']=_0x2d67('0x61');_0x3b2ac4['campaign']=_0x1ff237['name'];_0x3b2ac4[_0x2d67('0x62')]=_0x5b786d['user'][_0x2d67('0x25')];_0x3b2ac4[_0x2d67('0x63')]=_0x5b786d['user']['id'];_0x3b2ac4[_0x2d67('0x61')]=!![];_0x3b2ac4[_0x2d67('0x64')]=moment()['format'](_0x2d67('0x65'));_0x3b2ac4[_0x2d67('0x66')]=_0xebf66a[_0x2d67('0x67')];_0x3b2ac4[_0x2d67('0x68')]=_0xebf66a[_0x2d67('0x5a')]?_0x2d67('0x69'):_0x2d67('0x6a');return db[_0x2d67('0x6b')]['find']({'where':{'id':_0x3b2ac4[_0x2d67('0x6c')]},'attributes':[_0x2d67('0x6d'),'lastName']})['then'](function(_0x1456f9){if(!_[_0x2d67('0x6e')](_0x5538cf)&&!_[_0x2d67('0x6e')](_0x1456f9[_0x2d67('0x6d')])){_0x3b2ac4['calleridname']=_0x1456f9[_0x2d67('0x6d')];if(!_[_0x2d67('0x6e')](_0x1456f9['lastName'])){_0x3b2ac4[_0x2d67('0x6f')]+='\x20'+_0x1456f9[_0x2d67('0x70')];}}})[_0x2d67('0x71')](function(){return db[_0x2d67('0x72')][_0x2d67('0x56')](_0x3b2ac4);});}})[_0x2d67('0x21')](function(){return _0x5538cf[_0x2d67('0x16')](0xcc)['end']();})[_0x2d67('0x50')](handleError(_0x5538cf,null));};exports[_0x2d67('0x73')]=function(_0x39b6ba,_0x68d6a7,_0xbbec02){var _0xf56c8c=[];return db[_0x2d67('0x6b')][_0x2d67('0x58')]()['then'](function(_0x32d628){_0xf56c8c=_[_0x2d67('0x2c')](_0x32d628);return _0x39b6ba[_0x2d67('0x74')][_0x2d67('0x75')]({'where':{'type':_0x2d67('0x76'),'dialActive':!![],'dialMethod':_0x2d67('0x77')},'attributes':['id',_0x2d67('0x78'),'dialPreviewAutoRecallMe'],'raw':!![]});})['then'](function(_0x4d5947){if(_0x4d5947&&_0x4d5947[_0x2d67('0x43')]){return db['sequelize'][_0x2d67('0x79')](function(_0x87535c){var _0x35314e={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x2d67('0x7a')](_0x2d67('0x65'))},'VoiceQueueId':{'$in':_['map'](_0x4d5947,'id')},'$or':[{'UserId':null},{'UserId':_0x39b6ba[_0x2d67('0x74')]['id']}]};var _0x57960e={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x4d5947)[_0x2d67('0x47')]([_0x2d67('0x7b'),0x0])[_0x2d67('0x28')]('id')[_0x2d67('0x7c')]()},'$or':[{'UserId':null},{'UserId':_0x39b6ba['user']['id']}]};var _0xbc5963={'$or':[_0x35314e,_0x57960e]};var _0x255f91=[];if(_0x39b6ba[_0x2d67('0x57')]['direction']&&_0x39b6ba[_0x2d67('0x57')]['direction']===_0x2d67('0x7d')){if(!_[_0x2d67('0x7e')](_0x39b6ba['body'][_0x2d67('0x7f')])){_0xbc5963['id']={'$in':_0x39b6ba[_0x2d67('0x57')][_0x2d67('0x7f')]};}_0x255f91=[[_0x2d67('0x80'),_0x2d67('0x81')],[_0x2d67('0x82'),_0x4d5947[0x0][_0x2d67('0x78')]===_0x2d67('0x81')?_0x2d67('0x83'):'ASC'],db[_0x2d67('0x84')][_0x2d67('0x85')](_0x2d67('0x86')),['id',_0x2d67('0x83')]];}else{if(!_[_0x2d67('0x7e')](_0x39b6ba[_0x2d67('0x57')][_0x2d67('0x7f')])){_0xbc5963['id']={'$notIn':_0x39b6ba[_0x2d67('0x57')][_0x2d67('0x7f')]};}_0x255f91=[[_0x2d67('0x80'),_0x2d67('0x83')],[_0x2d67('0x82'),_0x4d5947[0x0][_0x2d67('0x78')]],db[_0x2d67('0x84')][_0x2d67('0x85')]('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0x2d67('0x81')]];}return db['CmHopper']['findOne']({'attributes':['id',_0x2d67('0x87'),'recallme'],'where':_0xbc5963,'order':_0x255f91,'transaction':_0x87535c,'lock':_0x87535c[_0x2d67('0x88')][_0x2d67('0x89')],'include':[{'model':db['CmContact'],'as':'Contact','attributes':_0xf56c8c,'include':[{'model':db[_0x2d67('0x8a')],'as':_0x2d67('0x8b'),'attributes':['id','name']}]},{'model':db[_0x2d67('0x8c')],'as':'List','attributes':['id',_0x2d67('0x25')]},{'model':db['VoiceQueue'],'as':_0x2d67('0x8d'),'attributes':['id',_0x2d67('0x25'),_0x2d67('0x8e')]}]})[_0x2d67('0x21')](function(_0x223d72){if(_0x223d72){return _0x223d72[_0x2d67('0x20')]({'UserId':_0x39b6ba['user']['id']},{'transaction':_0x87535c});}});});}})[_0x2d67('0x21')](handleEntityNotFound(_0x68d6a7,null))['then'](respondWithResult(_0x68d6a7,null))['catch'](handleError(_0x68d6a7,null));};exports[_0x2d67('0x8f')]=function(_0x8d8de7,_0x1c6cae,_0x31a9e4){return _0x8d8de7[_0x2d67('0x74')][_0x2d67('0x75')]({'where':{'type':_0x2d67('0x76'),'dialActive':!![],'dialMethod':_0x2d67('0x77')},'attributes':['id'],'raw':!![]})[_0x2d67('0x21')](function(_0x389d31){if(_0x389d31&&_0x389d31[_0x2d67('0x43')]){return db[_0x2d67('0x29')][_0x2d67('0x1a')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x2d67('0x28')](_0x389d31,'id')},'$or':[{'UserId':null},{'UserId':_0x8d8de7[_0x2d67('0x74')]['id']}]}});}return 0x0;})[_0x2d67('0x21')](function(_0x465b4d){if(!_[_0x2d67('0x6e')](_0x465b4d)&&_[_0x2d67('0x90')](_0x465b4d)){return _0x1c6cae[_0x2d67('0x16')](0xc8)[_0x2d67('0x17')]({'contacts':_0x465b4d});}else{logger[_0x2d67('0x23')]('CmHopper,\x20%s,\x20%s,\x20%s',_0x2d67('0x8f'),0x194,'entity\x20not\x20found');_0x1c6cae[_0x2d67('0x22')](0x194);}})['catch'](handleError(_0x1c6cae,null));}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 0428bb6..aa6473a 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 _0xdbf5=['define','CmHopper','cm_hopper','scheduledat','phone','priority','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','exports'];(function(_0x4d469d,_0x4b766c){var _0x3113c1=function(_0x440fda){while(--_0x440fda){_0x4d469d['push'](_0x4d469d['shift']());}};_0x3113c1(++_0x4b766c);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x5d6630,_0x585612){_0x5d6630=_0x5d6630-0x0;var _0x42e399=_0xdbf5[_0x5d6630];return _0x42e399;};'use strict';var _=require('lodash');var util=require(_0x5dbf('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x5dbf('0x1'));var BPromise=require(_0x5dbf('0x2'));var rp=require(_0x5dbf('0x3'));var fs=require('fs');var path=require(_0x5dbf('0x4'));var rimraf=require(_0x5dbf('0x5'));var config=require(_0x5dbf('0x6'));var attributes=require(_0x5dbf('0x7'));module[_0x5dbf('0x8')]=function(_0x3f8628,_0x3f8222){return _0x3f8628[_0x5dbf('0x9')](_0x5dbf('0xa'),attributes,{'tableName':_0x5dbf('0xb'),'paranoid':![],'indexes':[{'name':'scheduledat','fields':[_0x5dbf('0xc')]},{'name':'phone','fields':[_0x5dbf('0xd')]},{'name':_0x5dbf('0xe'),'fields':[_0x5dbf('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2eb2=['request-promise','rimraf','exports','define','CmHopper','cm_hopper','scheduledat','phone','priority','util','../../config/logger','api','moment','bluebird'];(function(_0x36aa4a,_0x36c836){var _0x1ba185=function(_0x27fe7b){while(--_0x27fe7b){_0x36aa4a['push'](_0x36aa4a['shift']());}};_0x1ba185(++_0x36c836);}(_0x2eb2,0x19f));var _0x22eb=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0x2eb2[_0x4e1d03];return _0x362d4b;};'use strict';var _=require('lodash');var util=require(_0x22eb('0x0'));var logger=require(_0x22eb('0x1'))(_0x22eb('0x2'));var moment=require(_0x22eb('0x3'));var BPromise=require(_0x22eb('0x4'));var rp=require(_0x22eb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x22eb('0x6'));var config=require('../../config/environment');var attributes=require('./cmHopper.attributes');module[_0x22eb('0x7')]=function(_0x10e116,_0x35dd5b){return _0x10e116[_0x22eb('0x8')](_0x22eb('0x9'),attributes,{'tableName':_0x22eb('0xa'),'paranoid':![],'indexes':[{'name':_0x22eb('0xb'),'fields':[_0x22eb('0xb')]},{'name':_0x22eb('0xc'),'fields':[_0x22eb('0xc')]},{'name':_0x22eb('0xd'),'fields':[_0x22eb('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 1a5cca2..e849997 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 _0x20df=['info','CmHopper,\x20%s,\x20%s','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CmHopper','findAll','options','raw','where','include','map','model','attributes','GetCmHopper','debug','ShowCmHopper','CreateCmHopper','body','UpdateCmHopper','update','limit','active','DestroyCmHopper','CmContact','describe','sequelize','transaction','UPDATE','Contact','keys','User','name','voicePause','includes','push','all','GetContactDialer','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','MoveContactManagedDialer','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','destroy','CountReScheduled','COUNT','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','GetContactRecallMe','order','LOCK','length','ResetActiveCalls','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then'];(function(_0x4ae137,_0x5303c0){var _0x1e1820=function(_0x1473d0){while(--_0x1473d0){_0x4ae137['push'](_0x4ae137['shift']());}};_0x1e1820(++_0x5303c0);}(_0x20df,0xc8));var _0xf20d=function(_0x43a37c,_0x25a567){_0x43a37c=_0x43a37c-0x0;var _0x5d1d40=_0x20df[_0x43a37c];return _0x5d1d40;};'use strict';var _=require('lodash');var util=require(_0xf20d('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf20d('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf20d('0x2'))['db'];var utils=require(_0xf20d('0x3'));var logger=require(_0xf20d('0x4'))(_0xf20d('0x5'));var config=require(_0xf20d('0x6'));var jayson=require(_0xf20d('0x7'));var client=jayson[_0xf20d('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x22bda1,_0x81796f,_0x35b7d8){return new BPromise(function(_0x5e2a44,_0x39ec9a){return client['request'](_0x22bda1,_0x35b7d8)[_0xf20d('0x9')](function(_0x3f7da0){logger[_0xf20d('0xa')](_0xf20d('0xb'),_0x81796f,'request\x20sent');logger['debug'](_0xf20d('0xc'),_0x81796f,'request\x20sent',JSON[_0xf20d('0xd')](_0x3f7da0));if(_0x3f7da0[_0xf20d('0xe')]){if(_0x3f7da0[_0xf20d('0xe')]['code']===0x1f4){logger['error'](_0xf20d('0xb'),_0x81796f,_0x3f7da0[_0xf20d('0xe')][_0xf20d('0xf')]);return _0x39ec9a(_0x3f7da0['error'][_0xf20d('0xf')]);}logger[_0xf20d('0xe')](_0xf20d('0xb'),_0x81796f,_0x3f7da0[_0xf20d('0xe')][_0xf20d('0xf')]);return _0x5e2a44(_0x3f7da0[_0xf20d('0xe')][_0xf20d('0xf')]);}else{logger[_0xf20d('0xa')](_0xf20d('0xb'),_0x81796f,'request\x20sent');_0x5e2a44(_0x3f7da0[_0xf20d('0x10')]['message']);}})[_0xf20d('0x11')](function(_0x599725){logger[_0xf20d('0xe')](_0xf20d('0xb'),_0x81796f,_0x599725);_0x39ec9a(_0x599725);});});}exports['GetCmHopper']=function(_0x5b8ad5){var _0x456bba=this;return new Promise(function(_0x10b2a7,_0x508922){return db[_0xf20d('0x12')][_0xf20d('0x13')]({'raw':_0x5b8ad5[_0xf20d('0x14')]?_0x5b8ad5[_0xf20d('0x14')][_0xf20d('0x15')]===undefined?!![]:![]:!![],'where':_0x5b8ad5[_0xf20d('0x14')]?_0x5b8ad5[_0xf20d('0x14')][_0xf20d('0x16')]||null:null,'attributes':_0x5b8ad5['options']?_0x5b8ad5[_0xf20d('0x14')]['attributes']||null:null,'limit':_0x5b8ad5[_0xf20d('0x14')]?_0x5b8ad5[_0xf20d('0x14')]['limit']||null:null,'include':_0x5b8ad5['options']?_0x5b8ad5[_0xf20d('0x14')][_0xf20d('0x17')]?_[_0xf20d('0x18')](_0x5b8ad5[_0xf20d('0x14')][_0xf20d('0x17')],function(_0x4b932d){return{'model':db[_0x4b932d[_0xf20d('0x19')]],'as':_0x4b932d['as'],'attributes':_0x4b932d[_0xf20d('0x1a')],'include':_0x4b932d['include']?_[_0xf20d('0x18')](_0x4b932d['include'],function(_0x262fa8){return{'model':db[_0x262fa8['model']],'as':_0x262fa8['as'],'attributes':_0x262fa8['attributes'],'include':_0x262fa8[_0xf20d('0x17')]?_[_0xf20d('0x18')](_0x262fa8[_0xf20d('0x17')],function(_0x102589){return{'model':db[_0x102589[_0xf20d('0x19')]],'as':_0x102589['as'],'attributes':_0x102589[_0xf20d('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x48c9a7){logger[_0xf20d('0xa')](_0xf20d('0x1b'),_0x5b8ad5);logger[_0xf20d('0x1c')](_0xf20d('0x1b'),_0x5b8ad5,JSON['stringify'](_0x48c9a7));_0x10b2a7(_0x48c9a7);})[_0xf20d('0x11')](function(_0x30b3c1){logger[_0xf20d('0xe')](_0xf20d('0x1b'),_0x30b3c1[_0xf20d('0xf')],_0x5b8ad5);_0x508922(_0x456bba[_0xf20d('0xe')](0x1f4,_0x30b3c1[_0xf20d('0xf')]));});});};exports[_0xf20d('0x1d')]=function(_0x23ee44){var _0x22f314=this;return new Promise(function(_0x4eab0c,_0x44b525){return db['CmHopper']['find']({'raw':_0x23ee44['options']?_0x23ee44[_0xf20d('0x14')][_0xf20d('0x15')]===undefined?!![]:![]:!![],'where':_0x23ee44[_0xf20d('0x14')]?_0x23ee44[_0xf20d('0x14')]['where']||null:null,'attributes':_0x23ee44[_0xf20d('0x14')]?_0x23ee44[_0xf20d('0x14')][_0xf20d('0x1a')]||null:null,'include':_0x23ee44['options']?_0x23ee44[_0xf20d('0x14')][_0xf20d('0x17')]?_[_0xf20d('0x18')](_0x23ee44['options']['include'],function(_0x45b821){return{'model':db[_0x45b821['model']],'as':_0x45b821['as'],'attributes':_0x45b821['attributes'],'include':_0x45b821[_0xf20d('0x17')]?_[_0xf20d('0x18')](_0x45b821[_0xf20d('0x17')],function(_0x2afe62){return{'model':db[_0x2afe62[_0xf20d('0x19')]],'as':_0x2afe62['as'],'attributes':_0x2afe62[_0xf20d('0x1a')],'include':_0x2afe62['include']?_[_0xf20d('0x18')](_0x2afe62[_0xf20d('0x17')],function(_0x247445){return{'model':db[_0x247445[_0xf20d('0x19')]],'as':_0x247445['as'],'attributes':_0x247445['attributes']};}):[]};}):[]};}):[]:[]})[_0xf20d('0x9')](function(_0x3768fe){logger['info'](_0xf20d('0x1d'),_0x23ee44);logger['debug'](_0xf20d('0x1d'),_0x23ee44,JSON[_0xf20d('0xd')](_0x3768fe));_0x4eab0c(_0x3768fe);})['catch'](function(_0x22fb06){logger['error'](_0xf20d('0x1d'),_0x22fb06[_0xf20d('0xf')],_0x23ee44);_0x44b525(_0x22f314[_0xf20d('0xe')](0x1f4,_0x22fb06['message']));});});};exports[_0xf20d('0x1e')]=function(_0x4ef447){var _0x575b4f=this;return new Promise(function(_0x23ad45,_0xcaae5a){return db['CmHopper']['create'](_0x4ef447[_0xf20d('0x1f')],{'raw':_0x4ef447[_0xf20d('0x14')]?_0x4ef447[_0xf20d('0x14')][_0xf20d('0x15')]===undefined?!![]:![]:!![]})[_0xf20d('0x9')](function(_0x5c7f61){logger[_0xf20d('0xa')](_0xf20d('0x1e'),_0x4ef447);logger[_0xf20d('0x1c')](_0xf20d('0x1e'),_0x4ef447,JSON['stringify'](_0x5c7f61));_0x23ad45(_0x5c7f61);})[_0xf20d('0x11')](function(_0x49d38b){logger[_0xf20d('0xe')](_0xf20d('0x1e'),_0x49d38b['message'],_0x4ef447);_0xcaae5a(_0x575b4f[_0xf20d('0xe')](0x1f4,_0x49d38b['message']));});});};exports[_0xf20d('0x20')]=function(_0x17c4f7){var _0x475b83=this;return new Promise(function(_0x38aa9c,_0x4d3765){return db[_0xf20d('0x12')][_0xf20d('0x21')](_0x17c4f7[_0xf20d('0x1f')],{'raw':_0x17c4f7['options']?_0x17c4f7[_0xf20d('0x14')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x17c4f7['options']?_0x17c4f7[_0xf20d('0x14')][_0xf20d('0x16')]||null:null,'attributes':_0x17c4f7[_0xf20d('0x14')]?_0x17c4f7[_0xf20d('0x14')][_0xf20d('0x1a')]||null:null,'limit':_0x17c4f7[_0xf20d('0x14')]?_0x17c4f7[_0xf20d('0x14')][_0xf20d('0x22')]||null:null})[_0xf20d('0x9')](function(_0x3797f0){logger[_0xf20d('0xa')](_0xf20d('0x20'),_0x17c4f7);logger['info']('UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON['stringify'](_0x17c4f7['options'][_0xf20d('0x16')]),_0x17c4f7[_0xf20d('0x1f')][_0xf20d('0x23')]);logger[_0xf20d('0x1c')](_0xf20d('0x20'),_0x17c4f7,JSON[_0xf20d('0xd')](_0x3797f0));_0x38aa9c(_0x3797f0);})[_0xf20d('0x11')](function(_0x3314fc){logger[_0xf20d('0xe')](_0xf20d('0x20'),_0x3314fc[_0xf20d('0xf')],_0x17c4f7);_0x4d3765(_0x475b83[_0xf20d('0xe')](0x1f4,_0x3314fc[_0xf20d('0xf')]));});});};exports[_0xf20d('0x24')]=function(_0x3a6440){var _0x325e3d=this;return new Promise(function(_0x513ad5,_0x33dedd){return db[_0xf20d('0x12')]['destroy']({'where':_0x3a6440[_0xf20d('0x14')]?_0x3a6440[_0xf20d('0x14')][_0xf20d('0x16')]||null:null})[_0xf20d('0x9')](function(_0x10395d){logger[_0xf20d('0xa')](_0xf20d('0x24'),_0x3a6440);logger[_0xf20d('0x1c')](_0xf20d('0x24'),_0x3a6440,JSON[_0xf20d('0xd')](_0x10395d));_0x513ad5(_0x10395d);})['catch'](function(_0x63bc06){logger[_0xf20d('0xe')](_0xf20d('0x24'),_0x63bc06[_0xf20d('0xf')],_0x3a6440);_0x33dedd(_0x325e3d['error'](0x1f4,_0x63bc06[_0xf20d('0xf')]));});});};exports['GetContactDialer']=function(_0x30d578){var _0x425c6c=this;return new Promise(function(_0x1d08f0,_0x44a571){return db[_0xf20d('0x25')][_0xf20d('0x26')]()[_0xf20d('0x9')](function(_0x38dd5f){return db[_0xf20d('0x27')][_0xf20d('0x28')](function(_0x331d93){return db['CmHopper'][_0xf20d('0x13')]({'where':_0x30d578[_0xf20d('0x14')]?_0x30d578[_0xf20d('0x14')][_0xf20d('0x16')]||null:null,'attributes':_0x30d578[_0xf20d('0x14')]?_0x30d578['options']['attributes']||null:null,'limit':_0x30d578[_0xf20d('0x14')]?_0x30d578[_0xf20d('0x14')][_0xf20d('0x22')]||null:null,'order':_0x30d578[_0xf20d('0x14')]?_0x30d578[_0xf20d('0x14')]['order']||null:null,'transaction':_0x331d93,'lock':_0x331d93['LOCK'][_0xf20d('0x29')],'include':[{'model':db[_0xf20d('0x25')],'as':_0xf20d('0x2a'),'attributes':_[_0xf20d('0x2b')](_0x38dd5f)},{'model':db[_0xf20d('0x2c')],'as':'Agent','attributes':['id',_0xf20d('0x2d'),_0xf20d('0x2e')]}]})[_0xf20d('0x9')](function(_0x535e62){var _0x5d65f8=[];var _0x58421c=[];for(var _0x32574c=0x0;_0x32574c<_0x535e62['length'];_0x32574c+=0x1){var _0x5a7975=_0x535e62[_0x32574c]['UserId'];if(_0x5a7975===null){_0x5d65f8['push'](_0x535e62[_0x32574c][_0xf20d('0x21')](_0x30d578[_0xf20d('0x1f')],{'transaction':_0x331d93}));}else if(!_0x58421c[_0xf20d('0x2f')](_0x5a7975)){_0x58421c[_0xf20d('0x30')](_0x5a7975);_0x5d65f8[_0xf20d('0x30')](_0x535e62[_0x32574c][_0xf20d('0x21')](_0x30d578[_0xf20d('0x1f')],{'transaction':_0x331d93}));}}return BPromise[_0xf20d('0x31')](_0x5d65f8);});})[_0xf20d('0x9')](function(_0x32247a){logger['info'](_0xf20d('0x32'),_0x30d578);if(_0x32247a['length']>0x0){logger[_0xf20d('0xa')](_0xf20d('0x33'),_0x32247a[0x0][_0xf20d('0x34')]['id'],_0x32247a[0x0][_0xf20d('0x34')][_0xf20d('0x35')],_0x32247a[0x0][_0xf20d('0x34')][_0xf20d('0x23')]);}logger[_0xf20d('0x1c')](_0xf20d('0x32'),_0x30d578,JSON[_0xf20d('0xd')](_0x32247a));_0x1d08f0(_0x32247a);})[_0xf20d('0x11')](function(_0x465907){logger[_0xf20d('0xe')](_0xf20d('0x32'),_0x465907[_0xf20d('0xf')],_0x30d578);_0x44a571(_0x425c6c['error'](0x1f4,_0x465907['message']));});});});};exports[_0xf20d('0x36')]=function(_0x53fb2a){var _0x56e365=this;return new Promise(function(_0x2710f9,_0x2fa20b){return db[_0xf20d('0x27')]['transaction'](function(_0x1d31cc){return db[_0xf20d('0x37')]['create'](_0x53fb2a[_0xf20d('0x1f')],{'raw':_0x53fb2a['options']?_0x53fb2a[_0xf20d('0x14')][_0xf20d('0x15')]===undefined?!![]:![]:!![],'transaction':_0x1d31cc})['then'](function(){logger[_0xf20d('0xa')](_0xf20d('0x38'),JSON[_0xf20d('0xd')](_0x53fb2a[_0xf20d('0x14')][_0xf20d('0x16')]),_0x53fb2a[_0xf20d('0x14')][_0xf20d('0x16')]['active']);return db[_0xf20d('0x12')][_0xf20d('0x39')]({'where':_0x53fb2a[_0xf20d('0x14')]?_0x53fb2a[_0xf20d('0x14')]['where']||null:null,'transaction':_0x1d31cc});});})[_0xf20d('0x9')](function(_0x33c5fc){logger['info'](_0xf20d('0x36'),_0x53fb2a);logger[_0xf20d('0x1c')](_0xf20d('0x36'),_0x53fb2a,JSON[_0xf20d('0xd')](_0x33c5fc));_0x2710f9(_0x33c5fc);})[_0xf20d('0x11')](function(_0x44f1bb){logger[_0xf20d('0xe')](_0xf20d('0x36'),_0x44f1bb['message'],_0x53fb2a);_0x2fa20b(_0x56e365[_0xf20d('0xe')](0x1f4,_0x44f1bb[_0xf20d('0xf')]));});});};exports[_0xf20d('0x3a')]=function(_0x12dacc){var _0x450c33=this;return new Promise(function(_0x25495d,_0xaefd7b){return db[_0xf20d('0x12')][_0xf20d('0x13')]({'raw':_0x12dacc[_0xf20d('0x14')]?_0x12dacc[_0xf20d('0x14')][_0xf20d('0x15')]===undefined?!![]:![]:!![],'where':_0x12dacc[_0xf20d('0x14')]?_0x12dacc[_0xf20d('0x14')]['where']||null:null,'attributes':[[db['sequelize']['fn'](_0xf20d('0x3b'),db[_0xf20d('0x27')]['fn']('IF',db['sequelize']['literal'](_0xf20d('0x3c')+util[_0xf20d('0x3d')](_0xf20d('0x3e'),moment()[_0xf20d('0x3d')](_0xf20d('0x3f')))+_0xf20d('0x40')))),'contactsRescheduled']]})['then'](function(_0x2613d0){logger[_0xf20d('0xa')]('CountReScheduled',_0x12dacc);logger[_0xf20d('0x1c')](_0xf20d('0x3a'),_0x12dacc,JSON[_0xf20d('0xd')](_0x2613d0));_0x25495d(_0x2613d0);})['catch'](function(_0x3dda1f){logger[_0xf20d('0xe')](_0xf20d('0x3a'),_0x3dda1f['message'],_0x12dacc);_0xaefd7b(_0x450c33[_0xf20d('0xe')](0x1f4,_0x3dda1f['message']));});});};exports[_0xf20d('0x41')]=function(_0x15622a){var _0x4fb15c=this;return new Promise(function(_0x1316ab,_0x2e698e){return db[_0xf20d('0x25')][_0xf20d('0x26')]()['then'](function(_0x354d9c){return db['sequelize']['transaction'](function(_0x58f22d){return db[_0xf20d('0x12')][_0xf20d('0x13')]({'where':_0x15622a[_0xf20d('0x14')]?_0x15622a['options'][_0xf20d('0x16')]||null:null,'attributes':_0x15622a[_0xf20d('0x14')]?_0x15622a[_0xf20d('0x14')][_0xf20d('0x1a')]||null:null,'limit':0x1,'order':_0x15622a[_0xf20d('0x14')]?_0x15622a[_0xf20d('0x14')][_0xf20d('0x42')]||null:null,'group':db[_0xf20d('0x12')]['UserId'],'transaction':_0x58f22d,'lock':_0x58f22d[_0xf20d('0x43')][_0xf20d('0x29')],'include':_0x15622a[_0xf20d('0x14')]?_0x15622a[_0xf20d('0x14')][_0xf20d('0x17')]?_['map'](_0x15622a['options'][_0xf20d('0x17')],function(_0x3f1bee){return{'model':db[_0x3f1bee[_0xf20d('0x19')]],'as':_0x3f1bee['as'],'attributes':_0x3f1bee[_0xf20d('0x1a')],'include':_0x3f1bee[_0xf20d('0x17')]?_[_0xf20d('0x18')](_0x3f1bee[_0xf20d('0x17')],function(_0x266c97){return{'model':db[_0x266c97[_0xf20d('0x19')]],'as':_0x266c97['as'],'attributes':_0x266c97[_0xf20d('0x1a')],'include':_0x266c97[_0xf20d('0x17')]?_[_0xf20d('0x18')](_0x266c97[_0xf20d('0x17')],function(_0x194f8b){return{'model':db[_0x194f8b[_0xf20d('0x19')]],'as':_0x194f8b['as'],'attributes':_0x194f8b[_0xf20d('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xf20d('0x9')](function(_0x14ec18){var _0x38fceb=[];for(var _0x2dd9f2=0x0;_0x2dd9f2<_0x14ec18[_0xf20d('0x44')];_0x2dd9f2+=0x1){_0x38fceb[_0xf20d('0x30')](_0x14ec18[_0x2dd9f2]['update'](_0x15622a[_0xf20d('0x1f')],{'transaction':_0x58f22d}));}return BPromise[_0xf20d('0x31')](_0x38fceb);});})[_0xf20d('0x9')](function(_0x374b35){logger[_0xf20d('0xa')]('GetContactRecallMe',_0x15622a);logger[_0xf20d('0x1c')](_0xf20d('0x41'),_0x15622a,JSON['stringify'](_0x374b35));_0x1316ab(_0x374b35);})[_0xf20d('0x11')](function(_0x4700be){logger[_0xf20d('0xe')](_0xf20d('0x41'),_0x4700be['message'],_0x15622a);_0x2e698e(_0x4fb15c[_0xf20d('0xe')](0x1f4,_0x4700be[_0xf20d('0xf')]));});});});};exports['GetCmHopperPreview']=function(_0x7cf8a8){var _0x3e12a5=this;return new Promise(function(_0x44bff1,_0x129ca9){db[_0xf20d('0x25')][_0xf20d('0x26')]()[_0xf20d('0x9')](function(_0x146b1b){return db['CmHopper']['findAll']({'raw':_0x7cf8a8[_0xf20d('0x14')]?_0x7cf8a8[_0xf20d('0x14')][_0xf20d('0x15')]===undefined?!![]:![]:!![],'where':_0x7cf8a8[_0xf20d('0x14')]?_0x7cf8a8['options'][_0xf20d('0x16')]||null:null,'attributes':_0x7cf8a8[_0xf20d('0x14')]?_0x7cf8a8[_0xf20d('0x14')][_0xf20d('0x1a')]||null:null,'limit':_0x7cf8a8['options']?_0x7cf8a8[_0xf20d('0x14')][_0xf20d('0x22')]||null:null,'include':_0x7cf8a8[_0xf20d('0x14')]?_0x7cf8a8[_0xf20d('0x14')][_0xf20d('0x17')]?_[_0xf20d('0x18')](_0x7cf8a8['options'][_0xf20d('0x17')],function(_0x33c7d9){return{'model':db[_0x33c7d9['model']],'as':_0x33c7d9['as'],'attributes':_0x33c7d9['as']===_0xf20d('0x2a')?_[_0xf20d('0x2b')](_0x146b1b):_0x33c7d9[_0xf20d('0x1a')],'include':_0x33c7d9[_0xf20d('0x17')]?_[_0xf20d('0x18')](_0x33c7d9[_0xf20d('0x17')],function(_0x2893f0){return{'model':db[_0x2893f0[_0xf20d('0x19')]],'as':_0x2893f0['as'],'attributes':_0x2893f0[_0xf20d('0x1a')],'include':_0x2893f0[_0xf20d('0x17')]?_[_0xf20d('0x18')](_0x2893f0['include'],function(_0x40037b){return{'model':db[_0x40037b['model']],'as':_0x40037b['as'],'attributes':_0x40037b[_0xf20d('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xf20d('0x9')](function(_0x1918f9){logger[_0xf20d('0xa')]('GetCmHopper',_0x7cf8a8);logger[_0xf20d('0x1c')](_0xf20d('0x1b'),_0x7cf8a8,JSON[_0xf20d('0xd')](_0x1918f9));_0x44bff1(_0x1918f9);})[_0xf20d('0x11')](function(_0xbaa00b){logger[_0xf20d('0xe')](_0xf20d('0x1b'),_0xbaa00b['message'],_0x7cf8a8);_0x129ca9(_0x3e12a5[_0xf20d('0xe')](0x1f4,_0xbaa00b['message']));});});});};exports[_0xf20d('0x45')]=function(_0xd01547){var _0x50c749=this;return new Promise(function(_0x1b297d,_0x57a066){return db[_0xf20d('0x27')][_0xf20d('0x28')](function(_0x767754){return db[_0xf20d('0x12')][_0xf20d('0x21')]({'active':![]},{'where':{},'transaction':_0x767754})[_0xf20d('0x9')](function(_0xcff33f){logger['info'](_0xf20d('0x45'),_0xd01547);logger[_0xf20d('0x1c')](_0xf20d('0x45'),_0xd01547,JSON['stringify'](_0xcff33f));_0x1b297d(_0xcff33f);})['catch'](function(_0x24389f){logger[_0xf20d('0xe')]('ResetActiveCalls',_0x24389f[_0xf20d('0xf')],_0xd01547);_0x57a066(_0x50c749[_0xf20d('0xe')](0x1f4,_0x24389f[_0xf20d('0xf')]));});});});}; \ No newline at end of file +var _0xc24b=['DestroyCmHopper','GetContactDialer','CmContact','describe','sequelize','order','UPDATE','Contact','keys','User','Agent','name','voicePause','length','UserId','push','includes','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','CmHopperFinal','create','raw','MoveContactManagedDialer','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','contactsRescheduled','GetContactRecallMe','transaction','LOCK','GetCmHopperPreview','ResetActiveCalls','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','CmHopper,\x20%s,\x20%s','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetCmHopper','CmHopper','findAll','options','where','attributes','limit','include','map','model','then','ShowCmHopper','CreateCmHopper','body','stringify','update','UpdateCmHopper','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','destroy'];(function(_0x4dc136,_0x45f0c3){var _0x4e516=function(_0x2b3cbf){while(--_0x2b3cbf){_0x4dc136['push'](_0x4dc136['shift']());}};_0x4e516(++_0x45f0c3);}(_0xc24b,0x76));var _0xbc24=function(_0x2fd0f0,_0x4b634e){_0x2fd0f0=_0x2fd0f0-0x0;var _0x57f71a=_0xc24b[_0x2fd0f0];return _0x57f71a;};'use strict';var _=require(_0xbc24('0x0'));var util=require(_0xbc24('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbc24('0x2'));var fs=require('fs');var Redis=require(_0xbc24('0x3'));var db=require(_0xbc24('0x4'))['db'];var utils=require(_0xbc24('0x5'));var logger=require(_0xbc24('0x6'))(_0xbc24('0x7'));var config=require('../../config/environment');var jayson=require(_0xbc24('0x8'));var client=jayson[_0xbc24('0x9')][_0xbc24('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x51f13a,_0x598520,_0x456e18){return new BPromise(function(_0x4468f2,_0x12f589){return client[_0xbc24('0xb')](_0x51f13a,_0x456e18)['then'](function(_0x252609){logger[_0xbc24('0xc')](_0xbc24('0xd'),_0x598520,_0xbc24('0xe'));logger[_0xbc24('0xf')](_0xbc24('0x10'),_0x598520,'request\x20sent',JSON['stringify'](_0x252609));if(_0x252609[_0xbc24('0x11')]){if(_0x252609[_0xbc24('0x11')][_0xbc24('0x12')]===0x1f4){logger[_0xbc24('0x11')](_0xbc24('0xd'),_0x598520,_0x252609[_0xbc24('0x11')][_0xbc24('0x13')]);return _0x12f589(_0x252609[_0xbc24('0x11')][_0xbc24('0x13')]);}logger[_0xbc24('0x11')](_0xbc24('0xd'),_0x598520,_0x252609[_0xbc24('0x11')][_0xbc24('0x13')]);return _0x4468f2(_0x252609['error'][_0xbc24('0x13')]);}else{logger[_0xbc24('0xc')](_0xbc24('0xd'),_0x598520,_0xbc24('0xe'));_0x4468f2(_0x252609[_0xbc24('0x14')][_0xbc24('0x13')]);}})[_0xbc24('0x15')](function(_0x3e2b35){logger[_0xbc24('0x11')](_0xbc24('0xd'),_0x598520,_0x3e2b35);_0x12f589(_0x3e2b35);});});}exports[_0xbc24('0x16')]=function(_0x216f25){var _0x243492=this;return new Promise(function(_0x339336,_0x2d1fc0){return db[_0xbc24('0x17')][_0xbc24('0x18')]({'raw':_0x216f25['options']?_0x216f25[_0xbc24('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x216f25[_0xbc24('0x19')]?_0x216f25[_0xbc24('0x19')][_0xbc24('0x1a')]||null:null,'attributes':_0x216f25[_0xbc24('0x19')]?_0x216f25[_0xbc24('0x19')][_0xbc24('0x1b')]||null:null,'limit':_0x216f25['options']?_0x216f25[_0xbc24('0x19')][_0xbc24('0x1c')]||null:null,'include':_0x216f25['options']?_0x216f25[_0xbc24('0x19')][_0xbc24('0x1d')]?_[_0xbc24('0x1e')](_0x216f25[_0xbc24('0x19')][_0xbc24('0x1d')],function(_0x3d3b43){return{'model':db[_0x3d3b43['model']],'as':_0x3d3b43['as'],'attributes':_0x3d3b43[_0xbc24('0x1b')],'include':_0x3d3b43['include']?_[_0xbc24('0x1e')](_0x3d3b43[_0xbc24('0x1d')],function(_0xbf85bc){return{'model':db[_0xbf85bc['model']],'as':_0xbf85bc['as'],'attributes':_0xbf85bc['attributes'],'include':_0xbf85bc[_0xbc24('0x1d')]?_[_0xbc24('0x1e')](_0xbf85bc[_0xbc24('0x1d')],function(_0x1635f2){return{'model':db[_0x1635f2[_0xbc24('0x1f')]],'as':_0x1635f2['as'],'attributes':_0x1635f2[_0xbc24('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xbc24('0x20')](function(_0xac76bb){logger['info'](_0xbc24('0x16'),_0x216f25);logger[_0xbc24('0xf')](_0xbc24('0x16'),_0x216f25,JSON['stringify'](_0xac76bb));_0x339336(_0xac76bb);})['catch'](function(_0x580c06){logger[_0xbc24('0x11')](_0xbc24('0x16'),_0x580c06[_0xbc24('0x13')],_0x216f25);_0x2d1fc0(_0x243492[_0xbc24('0x11')](0x1f4,_0x580c06['message']));});});};exports[_0xbc24('0x21')]=function(_0x52b142){var _0x1a726c=this;return new Promise(function(_0x15fc45,_0x302c08){return db[_0xbc24('0x17')]['find']({'raw':_0x52b142['options']?_0x52b142['options']['raw']===undefined?!![]:![]:!![],'where':_0x52b142[_0xbc24('0x19')]?_0x52b142[_0xbc24('0x19')][_0xbc24('0x1a')]||null:null,'attributes':_0x52b142['options']?_0x52b142['options'][_0xbc24('0x1b')]||null:null,'include':_0x52b142[_0xbc24('0x19')]?_0x52b142[_0xbc24('0x19')][_0xbc24('0x1d')]?_['map'](_0x52b142[_0xbc24('0x19')]['include'],function(_0x3e999d){return{'model':db[_0x3e999d['model']],'as':_0x3e999d['as'],'attributes':_0x3e999d[_0xbc24('0x1b')],'include':_0x3e999d[_0xbc24('0x1d')]?_[_0xbc24('0x1e')](_0x3e999d[_0xbc24('0x1d')],function(_0x432c78){return{'model':db[_0x432c78['model']],'as':_0x432c78['as'],'attributes':_0x432c78[_0xbc24('0x1b')],'include':_0x432c78[_0xbc24('0x1d')]?_['map'](_0x432c78[_0xbc24('0x1d')],function(_0x3366d4){return{'model':db[_0x3366d4[_0xbc24('0x1f')]],'as':_0x3366d4['as'],'attributes':_0x3366d4[_0xbc24('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xbc24('0x20')](function(_0x4d5993){logger[_0xbc24('0xc')]('ShowCmHopper',_0x52b142);logger['debug'](_0xbc24('0x21'),_0x52b142,JSON['stringify'](_0x4d5993));_0x15fc45(_0x4d5993);})[_0xbc24('0x15')](function(_0x3bc77f){logger[_0xbc24('0x11')](_0xbc24('0x21'),_0x3bc77f[_0xbc24('0x13')],_0x52b142);_0x302c08(_0x1a726c[_0xbc24('0x11')](0x1f4,_0x3bc77f[_0xbc24('0x13')]));});});};exports[_0xbc24('0x22')]=function(_0x1a393a){var _0x111640=this;return new Promise(function(_0x32b7ed,_0x270db4){return db[_0xbc24('0x17')]['create'](_0x1a393a[_0xbc24('0x23')],{'raw':_0x1a393a[_0xbc24('0x19')]?_0x1a393a[_0xbc24('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xbc24('0x20')](function(_0x3581a9){logger[_0xbc24('0xc')](_0xbc24('0x22'),_0x1a393a);logger[_0xbc24('0xf')](_0xbc24('0x22'),_0x1a393a,JSON[_0xbc24('0x24')](_0x3581a9));_0x32b7ed(_0x3581a9);})[_0xbc24('0x15')](function(_0x2c9cdf){logger[_0xbc24('0x11')](_0xbc24('0x22'),_0x2c9cdf[_0xbc24('0x13')],_0x1a393a);_0x270db4(_0x111640[_0xbc24('0x11')](0x1f4,_0x2c9cdf[_0xbc24('0x13')]));});});};exports['UpdateCmHopper']=function(_0x1b8f14){var _0x60a6ba=this;return new Promise(function(_0x20e08a,_0x187a95){return db[_0xbc24('0x17')][_0xbc24('0x25')](_0x1b8f14[_0xbc24('0x23')],{'raw':_0x1b8f14[_0xbc24('0x19')]?_0x1b8f14[_0xbc24('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b8f14['options']?_0x1b8f14['options'][_0xbc24('0x1a')]||null:null,'attributes':_0x1b8f14['options']?_0x1b8f14[_0xbc24('0x19')][_0xbc24('0x1b')]||null:null,'limit':_0x1b8f14[_0xbc24('0x19')]?_0x1b8f14['options'][_0xbc24('0x1c')]||null:null})[_0xbc24('0x20')](function(_0x4434c2){logger['info'](_0xbc24('0x26'),_0x1b8f14);logger[_0xbc24('0xc')](_0xbc24('0x27'),JSON['stringify'](_0x1b8f14[_0xbc24('0x19')]['where']),_0x1b8f14[_0xbc24('0x23')][_0xbc24('0x28')]);logger[_0xbc24('0xf')](_0xbc24('0x26'),_0x1b8f14,JSON['stringify'](_0x4434c2));_0x20e08a(_0x4434c2);})[_0xbc24('0x15')](function(_0x4295c0){logger['error']('UpdateCmHopper',_0x4295c0['message'],_0x1b8f14);_0x187a95(_0x60a6ba[_0xbc24('0x11')](0x1f4,_0x4295c0[_0xbc24('0x13')]));});});};exports['DestroyCmHopper']=function(_0xe533b0){var _0x1025e5=this;return new Promise(function(_0x3a9502,_0x3ab01e){return db[_0xbc24('0x17')][_0xbc24('0x29')]({'where':_0xe533b0[_0xbc24('0x19')]?_0xe533b0[_0xbc24('0x19')][_0xbc24('0x1a')]||null:null})['then'](function(_0x5472c9){logger[_0xbc24('0xc')](_0xbc24('0x2a'),_0xe533b0);logger['debug'](_0xbc24('0x2a'),_0xe533b0,JSON['stringify'](_0x5472c9));_0x3a9502(_0x5472c9);})['catch'](function(_0x2b92fa){logger['error'](_0xbc24('0x2a'),_0x2b92fa[_0xbc24('0x13')],_0xe533b0);_0x3ab01e(_0x1025e5['error'](0x1f4,_0x2b92fa['message']));});});};exports[_0xbc24('0x2b')]=function(_0x536ace){var _0x2c3e98=this;return new Promise(function(_0x93d5d5,_0x5fb29c){return db[_0xbc24('0x2c')][_0xbc24('0x2d')]()[_0xbc24('0x20')](function(_0x10d24b){return db[_0xbc24('0x2e')]['transaction'](function(_0x327c1d){return db[_0xbc24('0x17')][_0xbc24('0x18')]({'where':_0x536ace[_0xbc24('0x19')]?_0x536ace[_0xbc24('0x19')][_0xbc24('0x1a')]||null:null,'attributes':_0x536ace['options']?_0x536ace['options'][_0xbc24('0x1b')]||null:null,'limit':_0x536ace['options']?_0x536ace[_0xbc24('0x19')][_0xbc24('0x1c')]||null:null,'order':_0x536ace[_0xbc24('0x19')]?_0x536ace[_0xbc24('0x19')][_0xbc24('0x2f')]||null:null,'transaction':_0x327c1d,'lock':_0x327c1d['LOCK'][_0xbc24('0x30')],'include':[{'model':db[_0xbc24('0x2c')],'as':_0xbc24('0x31'),'attributes':_[_0xbc24('0x32')](_0x10d24b)},{'model':db[_0xbc24('0x33')],'as':_0xbc24('0x34'),'attributes':['id',_0xbc24('0x35'),_0xbc24('0x36')]}]})[_0xbc24('0x20')](function(_0x469159){var _0xe94a11=[];var _0xe23ba4=[];for(var _0x19620e=0x0;_0x19620e<_0x469159[_0xbc24('0x37')];_0x19620e+=0x1){var _0x281b02=_0x469159[_0x19620e][_0xbc24('0x38')];if(_0x281b02===null){_0xe94a11[_0xbc24('0x39')](_0x469159[_0x19620e][_0xbc24('0x25')](_0x536ace[_0xbc24('0x23')],{'transaction':_0x327c1d}));}else if(!_0xe23ba4[_0xbc24('0x3a')](_0x281b02)){_0xe23ba4[_0xbc24('0x39')](_0x281b02);_0xe94a11[_0xbc24('0x39')](_0x469159[_0x19620e][_0xbc24('0x25')](_0x536ace[_0xbc24('0x23')],{'transaction':_0x327c1d}));}}return BPromise[_0xbc24('0x3b')](_0xe94a11);});})[_0xbc24('0x20')](function(_0x32ce54){logger['info'](_0xbc24('0x2b'),_0x536ace);if(_0x32ce54[_0xbc24('0x37')]>0x0){logger[_0xbc24('0xc')](_0xbc24('0x3c'),_0x32ce54[0x0][_0xbc24('0x3d')]['id'],_0x32ce54[0x0][_0xbc24('0x3d')][_0xbc24('0x3e')],_0x32ce54[0x0][_0xbc24('0x3d')][_0xbc24('0x28')]);}logger[_0xbc24('0xf')](_0xbc24('0x2b'),_0x536ace,JSON['stringify'](_0x32ce54));_0x93d5d5(_0x32ce54);})[_0xbc24('0x15')](function(_0x17c549){logger[_0xbc24('0x11')](_0xbc24('0x2b'),_0x17c549[_0xbc24('0x13')],_0x536ace);_0x5fb29c(_0x2c3e98['error'](0x1f4,_0x17c549[_0xbc24('0x13')]));});});});};exports['MoveContactManagedDialer']=function(_0x1b51fa){var _0x389b8b=this;return new Promise(function(_0x477597,_0xdc319f){return db[_0xbc24('0x2e')]['transaction'](function(_0x35a0f0){return db[_0xbc24('0x3f')][_0xbc24('0x40')](_0x1b51fa['body'],{'raw':_0x1b51fa[_0xbc24('0x19')]?_0x1b51fa['options'][_0xbc24('0x41')]===undefined?!![]:![]:!![],'transaction':_0x35a0f0})[_0xbc24('0x20')](function(){logger[_0xbc24('0xc')]('MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0xbc24('0x24')](_0x1b51fa[_0xbc24('0x19')][_0xbc24('0x1a')]),_0x1b51fa['options'][_0xbc24('0x1a')]['active']);return db[_0xbc24('0x17')]['destroy']({'where':_0x1b51fa['options']?_0x1b51fa[_0xbc24('0x19')][_0xbc24('0x1a')]||null:null,'transaction':_0x35a0f0});});})[_0xbc24('0x20')](function(_0x219268){logger['info']('MoveContactManagedDialer',_0x1b51fa);logger[_0xbc24('0xf')](_0xbc24('0x42'),_0x1b51fa,JSON[_0xbc24('0x24')](_0x219268));_0x477597(_0x219268);})[_0xbc24('0x15')](function(_0x2a23c0){logger[_0xbc24('0x11')](_0xbc24('0x42'),_0x2a23c0[_0xbc24('0x13')],_0x1b51fa);_0xdc319f(_0x389b8b[_0xbc24('0x11')](0x1f4,_0x2a23c0[_0xbc24('0x13')]));});});};exports[_0xbc24('0x43')]=function(_0x1c5b52){var _0x42a803=this;return new Promise(function(_0x2dee27,_0x5b9e67){return db[_0xbc24('0x17')][_0xbc24('0x18')]({'raw':_0x1c5b52[_0xbc24('0x19')]?_0x1c5b52['options'][_0xbc24('0x41')]===undefined?!![]:![]:!![],'where':_0x1c5b52[_0xbc24('0x19')]?_0x1c5b52[_0xbc24('0x19')]['where']||null:null,'attributes':[[db[_0xbc24('0x2e')]['fn'](_0xbc24('0x44'),db[_0xbc24('0x2e')]['fn']('IF',db[_0xbc24('0x2e')][_0xbc24('0x45')](_0xbc24('0x46')+util[_0xbc24('0x47')](_0xbc24('0x48'),moment()[_0xbc24('0x47')](_0xbc24('0x49')))+'\x20,\x201,\x20null'))),_0xbc24('0x4a')]]})['then'](function(_0x1cd12c){logger[_0xbc24('0xc')](_0xbc24('0x43'),_0x1c5b52);logger['debug']('CountReScheduled',_0x1c5b52,JSON[_0xbc24('0x24')](_0x1cd12c));_0x2dee27(_0x1cd12c);})[_0xbc24('0x15')](function(_0x457155){logger['error'](_0xbc24('0x43'),_0x457155[_0xbc24('0x13')],_0x1c5b52);_0x5b9e67(_0x42a803['error'](0x1f4,_0x457155[_0xbc24('0x13')]));});});};exports[_0xbc24('0x4b')]=function(_0x595979){var _0x5bdf54=this;return new Promise(function(_0x223853,_0x188a36){return db['CmContact'][_0xbc24('0x2d')]()[_0xbc24('0x20')](function(_0xbd4d79){return db[_0xbc24('0x2e')][_0xbc24('0x4c')](function(_0x289575){return db[_0xbc24('0x17')]['findAll']({'where':_0x595979[_0xbc24('0x19')]?_0x595979['options'][_0xbc24('0x1a')]||null:null,'attributes':_0x595979['options']?_0x595979[_0xbc24('0x19')][_0xbc24('0x1b')]||null:null,'limit':0x1,'order':_0x595979[_0xbc24('0x19')]?_0x595979[_0xbc24('0x19')][_0xbc24('0x2f')]||null:null,'group':db[_0xbc24('0x17')]['UserId'],'transaction':_0x289575,'lock':_0x289575[_0xbc24('0x4d')][_0xbc24('0x30')],'include':_0x595979[_0xbc24('0x19')]?_0x595979[_0xbc24('0x19')][_0xbc24('0x1d')]?_[_0xbc24('0x1e')](_0x595979[_0xbc24('0x19')][_0xbc24('0x1d')],function(_0x54effd){return{'model':db[_0x54effd['model']],'as':_0x54effd['as'],'attributes':_0x54effd[_0xbc24('0x1b')],'include':_0x54effd['include']?_[_0xbc24('0x1e')](_0x54effd[_0xbc24('0x1d')],function(_0x5dfa0a){return{'model':db[_0x5dfa0a['model']],'as':_0x5dfa0a['as'],'attributes':_0x5dfa0a[_0xbc24('0x1b')],'include':_0x5dfa0a[_0xbc24('0x1d')]?_['map'](_0x5dfa0a[_0xbc24('0x1d')],function(_0x8126){return{'model':db[_0x8126[_0xbc24('0x1f')]],'as':_0x8126['as'],'attributes':_0x8126['attributes']};}):[]};}):[]};}):[]:[]})[_0xbc24('0x20')](function(_0xe51af9){var _0x5bc393=[];for(var _0x593a5b=0x0;_0x593a5b<_0xe51af9[_0xbc24('0x37')];_0x593a5b+=0x1){_0x5bc393['push'](_0xe51af9[_0x593a5b][_0xbc24('0x25')](_0x595979[_0xbc24('0x23')],{'transaction':_0x289575}));}return BPromise[_0xbc24('0x3b')](_0x5bc393);});})['then'](function(_0x51ddfc){logger[_0xbc24('0xc')](_0xbc24('0x4b'),_0x595979);logger[_0xbc24('0xf')]('GetContactRecallMe',_0x595979,JSON['stringify'](_0x51ddfc));_0x223853(_0x51ddfc);})[_0xbc24('0x15')](function(_0x4bd12c){logger[_0xbc24('0x11')]('GetContactRecallMe',_0x4bd12c['message'],_0x595979);_0x188a36(_0x5bdf54['error'](0x1f4,_0x4bd12c[_0xbc24('0x13')]));});});});};exports[_0xbc24('0x4e')]=function(_0x1945fc){var _0x5be118=this;return new Promise(function(_0x42c143,_0x8fe941){db[_0xbc24('0x2c')][_0xbc24('0x2d')]()[_0xbc24('0x20')](function(_0x3d0c95){return db[_0xbc24('0x17')][_0xbc24('0x18')]({'raw':_0x1945fc['options']?_0x1945fc[_0xbc24('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x1945fc[_0xbc24('0x19')]?_0x1945fc[_0xbc24('0x19')][_0xbc24('0x1a')]||null:null,'attributes':_0x1945fc[_0xbc24('0x19')]?_0x1945fc[_0xbc24('0x19')][_0xbc24('0x1b')]||null:null,'limit':_0x1945fc[_0xbc24('0x19')]?_0x1945fc[_0xbc24('0x19')][_0xbc24('0x1c')]||null:null,'include':_0x1945fc['options']?_0x1945fc['options'][_0xbc24('0x1d')]?_[_0xbc24('0x1e')](_0x1945fc[_0xbc24('0x19')][_0xbc24('0x1d')],function(_0x7da65c){return{'model':db[_0x7da65c[_0xbc24('0x1f')]],'as':_0x7da65c['as'],'attributes':_0x7da65c['as']===_0xbc24('0x31')?_[_0xbc24('0x32')](_0x3d0c95):_0x7da65c['attributes'],'include':_0x7da65c[_0xbc24('0x1d')]?_[_0xbc24('0x1e')](_0x7da65c[_0xbc24('0x1d')],function(_0x5b196e){return{'model':db[_0x5b196e[_0xbc24('0x1f')]],'as':_0x5b196e['as'],'attributes':_0x5b196e['attributes'],'include':_0x5b196e['include']?_['map'](_0x5b196e['include'],function(_0x1afc1f){return{'model':db[_0x1afc1f[_0xbc24('0x1f')]],'as':_0x1afc1f['as'],'attributes':_0x1afc1f[_0xbc24('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xbc24('0x20')](function(_0x3bff45){logger['info'](_0xbc24('0x16'),_0x1945fc);logger[_0xbc24('0xf')]('GetCmHopper',_0x1945fc,JSON[_0xbc24('0x24')](_0x3bff45));_0x42c143(_0x3bff45);})[_0xbc24('0x15')](function(_0x371ef3){logger[_0xbc24('0x11')](_0xbc24('0x16'),_0x371ef3[_0xbc24('0x13')],_0x1945fc);_0x8fe941(_0x5be118['error'](0x1f4,_0x371ef3['message']));});});});};exports[_0xbc24('0x4f')]=function(_0x2c33a5){var _0x5b8c8c=this;return new Promise(function(_0x526ae8,_0x117a33){return db[_0xbc24('0x2e')][_0xbc24('0x4c')](function(_0x336c83){return db[_0xbc24('0x17')][_0xbc24('0x25')]({'active':![]},{'where':{},'transaction':_0x336c83})[_0xbc24('0x20')](function(_0x28818a){logger[_0xbc24('0xc')]('ResetActiveCalls',_0x2c33a5);logger[_0xbc24('0xf')]('ResetActiveCalls',_0x2c33a5,JSON[_0xbc24('0x24')](_0x28818a));_0x526ae8(_0x28818a);})[_0xbc24('0x15')](function(_0x48184a){logger[_0xbc24('0x11')](_0xbc24('0x4f'),_0x48184a['message'],_0x2c33a5);_0x117a33(_0x5b8c8c[_0xbc24('0x11')](0x1f4,_0x48184a[_0xbc24('0x13')]));});});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index dbb0107..3dbff36 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 _0x8d02=['post','create','put','delete','multer','util','connect-timeout','express','Router','fs-extra','../../config/environment','./cmHopper.controller','isAuthenticated','index','get','/describe','describe','/opencontacts','/:id','show'];(function(_0xc8c303,_0x355e4a){var _0x3f16dc=function(_0x41feaf){while(--_0x41feaf){_0xc8c303['push'](_0xc8c303['shift']());}};_0x3f16dc(++_0x355e4a);}(_0x8d02,0xa4));var _0x28d0=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x8d02[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0x28d0('0x0'));var util=require(_0x28d0('0x1'));var path=require('path');var timeout=require(_0x28d0('0x2'));var express=require(_0x28d0('0x3'));var router=express[_0x28d0('0x4')]();var fs_extra=require(_0x28d0('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x28d0('0x6'));var controller=require(_0x28d0('0x7'));router['get']('/',auth[_0x28d0('0x8')](),controller[_0x28d0('0x9')]);router[_0x28d0('0xa')](_0x28d0('0xb'),auth[_0x28d0('0x8')](),controller[_0x28d0('0xc')]);router[_0x28d0('0xa')](_0x28d0('0xd'),auth[_0x28d0('0x8')](),controller['getOpenContacts']);router[_0x28d0('0xa')](_0x28d0('0xe'),auth[_0x28d0('0x8')](),controller[_0x28d0('0xf')]);router[_0x28d0('0x10')]('/',auth['isAuthenticated'](),controller[_0x28d0('0x11')]);router['post']('/preview',auth[_0x28d0('0x8')](),controller['getPreview']);router[_0x28d0('0x12')](_0x28d0('0xe'),auth[_0x28d0('0x8')](),controller['update']);router[_0x28d0('0x13')](_0x28d0('0xe'),auth[_0x28d0('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xa6ab=['/preview','getPreview','put','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopper.controller','get','isAuthenticated','index','/describe','describe','/opencontacts','getOpenContacts','/:id','post','create'];(function(_0x16ea87,_0x378d8b){var _0x6e7b1c=function(_0x26306e){while(--_0x26306e){_0x16ea87['push'](_0x16ea87['shift']());}};_0x6e7b1c(++_0x378d8b);}(_0xa6ab,0x18c));var _0xba6a=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xa6ab[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0xba6a('0x0'));var util=require(_0xba6a('0x1'));var path=require(_0xba6a('0x2'));var timeout=require(_0xba6a('0x3'));var express=require(_0xba6a('0x4'));var router=express['Router']();var fs_extra=require(_0xba6a('0x5'));var auth=require(_0xba6a('0x6'));var interaction=require(_0xba6a('0x7'));var config=require(_0xba6a('0x8'));var controller=require(_0xba6a('0x9'));router[_0xba6a('0xa')]('/',auth[_0xba6a('0xb')](),controller[_0xba6a('0xc')]);router['get'](_0xba6a('0xd'),auth[_0xba6a('0xb')](),controller[_0xba6a('0xe')]);router[_0xba6a('0xa')](_0xba6a('0xf'),auth[_0xba6a('0xb')](),controller[_0xba6a('0x10')]);router[_0xba6a('0xa')](_0xba6a('0x11'),auth['isAuthenticated'](),controller['show']);router[_0xba6a('0x12')]('/',auth[_0xba6a('0xb')](),controller[_0xba6a('0x13')]);router[_0xba6a('0x12')](_0xba6a('0x14'),auth[_0xba6a('0xb')](),controller[_0xba6a('0x15')]);router[_0xba6a('0x16')](_0xba6a('0x11'),auth[_0xba6a('0xb')](),controller['update']);router[_0xba6a('0x17')](_0xba6a('0x11'),auth[_0xba6a('0xb')](),controller[_0xba6a('0x18')]);module[_0xba6a('0x19')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 399fbc3..2eb90c1 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 _0x2e65=['contactListQueue','moment','sequelize','exports','STRING','INTEGER'];(function(_0x58ca49,_0x10549){var _0x530eee=function(_0xa6f39b){while(--_0xa6f39b){_0x58ca49['push'](_0x58ca49['shift']());}};_0x530eee(++_0x10549);}(_0x2e65,0x193));var _0x52e6=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x2e65[_0x21a9d9];return _0x46adce;};'use strict';var moment=require(_0x52e6('0x0'));var Sequelize=require(_0x52e6('0x1'));module[_0x52e6('0x2')]={'phone':{'type':Sequelize[_0x52e6('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x52e6('0x4')],'unique':_0x52e6('0x5')},'ListId':{'type':Sequelize[_0x52e6('0x4')],'unique':_0x52e6('0x5')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x52e6('0x5')}}; \ No newline at end of file +var _0x908e=['INTEGER','contactListQueue','moment','sequelize'];(function(_0xe73080,_0x24c56d){var _0x12cbc4=function(_0x1377e2){while(--_0x1377e2){_0xe73080['push'](_0xe73080['shift']());}};_0x12cbc4(++_0x24c56d);}(_0x908e,0x182));var _0xe908=function(_0x5ecbbc,_0x2541f5){_0x5ecbbc=_0x5ecbbc-0x0;var _0x219a19=_0x908e[_0x5ecbbc];return _0x219a19;};'use strict';var moment=require(_0xe908('0x0'));var Sequelize=require(_0xe908('0x1'));module['exports']={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize[_0xe908('0x2')],'unique':_0xe908('0x3')},'ListId':{'type':Sequelize[_0xe908('0x2')],'unique':_0xe908('0x3')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0xe908('0x3')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index e65df52..b61057a 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 _0x484d=['catch','show','params','rawAttributes','find','body','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','end','status','json','undefined','limit','count','offset','set','apply','save','then','destroy','stack','name','send','index','map','CmHopperBlack','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows'];(function(_0x56608c,_0x29eb74){var _0x3c7fb0=function(_0x154b1c){while(--_0x154b1c){_0x56608c['push'](_0x56608c['shift']());}};_0x3c7fb0(++_0x29eb74);}(_0x484d,0x165));var _0xd484=function(_0x59a1d8,_0x55a556){_0x59a1d8=_0x59a1d8-0x0;var _0x374ccd=_0x484d[_0x59a1d8];return _0x374ccd;};'use strict';var emlformat=require(_0xd484('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xd484('0x1'));var rp=require(_0xd484('0x2'));var moment=require(_0xd484('0x3'));var BPromise=require(_0xd484('0x4'));var Mustache=require(_0xd484('0x5'));var util=require(_0xd484('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xd484('0x7'));var ejs=require(_0xd484('0x8'));var fs=require('fs');var fs_extra=require(_0xd484('0x9'));var _=require(_0xd484('0xa'));var squel=require('squel');var crypto=require(_0xd484('0xb'));var jsforce=require(_0xd484('0xc'));var deskjs=require(_0xd484('0xd'));var toCsv=require('to-csv');var querystring=require(_0xd484('0xe'));var Papa=require(_0xd484('0xf'));var Redis=require('ioredis');var authService=require(_0xd484('0x10'));var qs=require(_0xd484('0x11'));var as=require(_0xd484('0x12'));var hardwareService=require(_0xd484('0x13'));var logger=require(_0xd484('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xd484('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x49e3fb,_0x16aa0c){_0x16aa0c=_0x16aa0c||0xcc;return function(_0xf1cd47){if(_0xf1cd47){return _0x49e3fb['sendStatus'](_0x16aa0c);}return _0x49e3fb['status'](_0x16aa0c)[_0xd484('0x16')]();};}function respondWithResult(_0x250936,_0x2df694){_0x2df694=_0x2df694||0xc8;return function(_0x4edb53){if(_0x4edb53){return _0x250936[_0xd484('0x17')](_0x2df694)[_0xd484('0x18')](_0x4edb53);}};}function respondWithFilteredResult(_0x271205,_0x10c649){return function(_0x5ad5fb){if(_0x5ad5fb){var _0xecf180=typeof _0x10c649['offset']===_0xd484('0x19')&&typeof _0x10c649[_0xd484('0x1a')]==='undefined';var _0x44fe68=_0x5ad5fb[_0xd484('0x1b')];var _0x565ea2=_0xecf180?0x0:_0x10c649[_0xd484('0x1c')];var _0x5a8071=_0xecf180?_0x5ad5fb[_0xd484('0x1b')]:_0x10c649[_0xd484('0x1c')]+_0x10c649[_0xd484('0x1a')];var _0x5ba0e1;if(_0x5a8071>=_0x44fe68){_0x5a8071=_0x44fe68;_0x5ba0e1=0xc8;}else{_0x5ba0e1=0xce;}_0x271205[_0xd484('0x17')](_0x5ba0e1);return _0x271205[_0xd484('0x1d')]('Content-Range',_0x565ea2+'-'+_0x5a8071+'/'+_0x44fe68)[_0xd484('0x18')](_0x5ad5fb);}return null;};}function patchUpdates(_0x490be2){return function(_0x5012c9){try{jsonpatch[_0xd484('0x1e')](_0x5012c9,_0x490be2,!![]);}catch(_0x56ed2c){return BPromise['reject'](_0x56ed2c);}return _0x5012c9[_0xd484('0x1f')]();};}function saveUpdates(_0x2667f3,_0x51228b){return function(_0x3ccf61){if(_0x3ccf61){return _0x3ccf61['update'](_0x2667f3)[_0xd484('0x20')](function(_0xd5df1e){return _0xd5df1e;});}return null;};}function removeEntity(_0x28e2c8,_0x53e57a){return function(_0xe98b69){if(_0xe98b69){return _0xe98b69[_0xd484('0x21')]()[_0xd484('0x20')](function(){_0x28e2c8[_0xd484('0x17')](0xcc)[_0xd484('0x16')]();});}};}function handleEntityNotFound(_0x1ae59c,_0x4171f8){return function(_0x35d6a1){if(!_0x35d6a1){_0x1ae59c['sendStatus'](0x194);}return _0x35d6a1;};}function handleError(_0x2eefd4,_0x485c5b){_0x485c5b=_0x485c5b||0x1f4;return function(_0x5661e1){logger['error'](_0x5661e1[_0xd484('0x22')]);if(_0x5661e1[_0xd484('0x23')]){delete _0x5661e1['name'];}_0x2eefd4[_0xd484('0x17')](_0x485c5b)[_0xd484('0x24')](_0x5661e1);};}exports[_0xd484('0x25')]=function(_0xf80a23,_0x41afdb){var _0x3e21c5={},_0xf525d2={},_0x2bb2cc={'count':0x0,'rows':[]};var _0x4e566b=_[_0xd484('0x26')](db[_0xd484('0x27')]['rawAttributes'],function(_0x791383){return{'name':_0x791383[_0xd484('0x28')],'type':_0x791383[_0xd484('0x29')]['key']};});_0xf525d2[_0xd484('0x2a')]=_['map'](_0x4e566b,_0xd484('0x23'));_0xf525d2[_0xd484('0x2b')]=_['keys'](_0xf80a23[_0xd484('0x2b')]);_0xf525d2[_0xd484('0x2c')]=_[_0xd484('0x2d')](_0xf525d2[_0xd484('0x2a')],_0xf525d2[_0xd484('0x2b')]);_0x3e21c5[_0xd484('0x2e')]=_[_0xd484('0x2d')](_0xf525d2[_0xd484('0x2a')],qs[_0xd484('0x2f')](_0xf80a23[_0xd484('0x2b')][_0xd484('0x2f')]));_0x3e21c5[_0xd484('0x2e')]=_0x3e21c5[_0xd484('0x2e')][_0xd484('0x30')]?_0x3e21c5[_0xd484('0x2e')]:_0xf525d2[_0xd484('0x2a')];if(!_0xf80a23['query'][_0xd484('0x31')](_0xd484('0x32'))){_0x3e21c5[_0xd484('0x1a')]=qs[_0xd484('0x1a')](_0xf80a23[_0xd484('0x2b')][_0xd484('0x1a')]);_0x3e21c5['offset']=qs[_0xd484('0x1c')](_0xf80a23['query'][_0xd484('0x1c')]);}_0x3e21c5[_0xd484('0x33')]=qs[_0xd484('0x34')](_0xf80a23[_0xd484('0x2b')][_0xd484('0x34')]);_0x3e21c5[_0xd484('0x35')]=qs[_0xd484('0x2c')](_[_0xd484('0x36')](_0xf80a23[_0xd484('0x2b')],_0xf525d2['filters']),_0x4e566b);if(_0xf80a23[_0xd484('0x2b')][_0xd484('0x37')]){_0x3e21c5['where']=_[_0xd484('0x38')](_0x3e21c5['where'],{'$or':_['map'](_0x4e566b,function(_0x47d41f){if(_0x47d41f[_0xd484('0x29')]!==_0xd484('0x39')){var _0x564ff7={};_0x564ff7[_0x47d41f['name']]={'$like':'%'+_0xf80a23[_0xd484('0x2b')]['filter']+'%'};return _0x564ff7;}})});}_0x3e21c5=_[_0xd484('0x38')]({},_0x3e21c5,_0xf80a23[_0xd484('0x3a')]);var _0xa833a7={'where':_0x3e21c5['where']};return db[_0xd484('0x27')][_0xd484('0x1b')](_0xa833a7)[_0xd484('0x20')](function(_0x4b18b6){_0x2bb2cc['count']=_0x4b18b6;if(_0xf80a23[_0xd484('0x2b')][_0xd484('0x3b')]){_0x3e21c5[_0xd484('0x3c')]=[{'all':!![]}];}return db[_0xd484('0x27')][_0xd484('0x3d')](_0x3e21c5);})[_0xd484('0x20')](function(_0x42f213){_0x2bb2cc[_0xd484('0x3e')]=_0x42f213;return _0x2bb2cc;})[_0xd484('0x20')](respondWithFilteredResult(_0x41afdb,_0x3e21c5))[_0xd484('0x3f')](handleError(_0x41afdb,null));};exports[_0xd484('0x40')]=function(_0x524d05,_0xbf201e){var _0x5d3d51={'raw':!![],'where':{'id':_0x524d05[_0xd484('0x41')]['id']}},_0x2fbd34={};_0x2fbd34['model']=_['keys'](db[_0xd484('0x27')][_0xd484('0x42')]);_0x2fbd34[_0xd484('0x2b')]=_['keys'](_0x524d05[_0xd484('0x2b')]);_0x2fbd34[_0xd484('0x2c')]=_[_0xd484('0x2d')](_0x2fbd34[_0xd484('0x2a')],_0x2fbd34[_0xd484('0x2b')]);_0x5d3d51[_0xd484('0x2e')]=_[_0xd484('0x2d')](_0x2fbd34['model'],qs[_0xd484('0x2f')](_0x524d05['query'][_0xd484('0x2f')]));_0x5d3d51[_0xd484('0x2e')]=_0x5d3d51[_0xd484('0x2e')][_0xd484('0x30')]?_0x5d3d51[_0xd484('0x2e')]:_0x2fbd34[_0xd484('0x2a')];if(_0x524d05[_0xd484('0x2b')][_0xd484('0x3b')]){_0x5d3d51['include']=[{'all':!![]}];}_0x5d3d51=_[_0xd484('0x38')]({},_0x5d3d51,_0x524d05[_0xd484('0x3a')]);return db['CmHopperBlack']['find'](_0x5d3d51)['then'](handleEntityNotFound(_0xbf201e,null))[_0xd484('0x20')](respondWithResult(_0xbf201e,null))['catch'](handleError(_0xbf201e,null));};exports['update']=function(_0x336af2,_0x3de2f5){if(_0x336af2['body']['id']){delete _0x336af2['body']['id'];}return db[_0xd484('0x27')][_0xd484('0x43')]({'where':{'id':_0x336af2[_0xd484('0x41')]['id']}})[_0xd484('0x20')](handleEntityNotFound(_0x3de2f5,null))[_0xd484('0x20')](saveUpdates(_0x336af2[_0xd484('0x44')],null))[_0xd484('0x20')](respondWithResult(_0x3de2f5,null))['catch'](handleError(_0x3de2f5,null));};exports[_0xd484('0x21')]=function(_0x3135ab,_0x1e5d3e){return db[_0xd484('0x27')][_0xd484('0x43')]({'where':{'id':_0x3135ab[_0xd484('0x41')]['id']}})[_0xd484('0x20')](handleEntityNotFound(_0x1e5d3e,null))['then'](removeEntity(_0x1e5d3e,null))[_0xd484('0x3f')](handleError(_0x1e5d3e,null));};exports[_0xd484('0x45')]=function(_0x4bdaf0,_0x23b9f2){return db[_0xd484('0x27')]['describe']()['then'](respondWithResult(_0x23b9f2,null))[_0xd484('0x3f')](handleError(_0x23b9f2,null));}; \ No newline at end of file +var _0x9d6d=['json','offset','undefined','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','CmHopperBlack','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','nolimit','limit','order','sort','where','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','length','includeAll','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x2ec2bf,_0x64e983){var _0x2c279c=function(_0x41fe42){while(--_0x41fe42){_0x2ec2bf['push'](_0x2ec2bf['shift']());}};_0x2c279c(++_0x64e983);}(_0x9d6d,0xc2));var _0xd9d6=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9d6d[_0x5ddb1c];return _0x354adc;};'use strict';var emlformat=require(_0xd9d6('0x0'));var rimraf=require(_0xd9d6('0x1'));var zipdir=require(_0xd9d6('0x2'));var jsonpatch=require(_0xd9d6('0x3'));var rp=require(_0xd9d6('0x4'));var moment=require(_0xd9d6('0x5'));var BPromise=require(_0xd9d6('0x6'));var Mustache=require(_0xd9d6('0x7'));var util=require('util');var path=require(_0xd9d6('0x8'));var sox=require('sox');var csv=require(_0xd9d6('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd9d6('0xa'));var _=require(_0xd9d6('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd9d6('0xc'));var deskjs=require(_0xd9d6('0xd'));var toCsv=require(_0xd9d6('0x9'));var querystring=require(_0xd9d6('0xe'));var Papa=require(_0xd9d6('0xf'));var Redis=require(_0xd9d6('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd9d6('0x11'));var hardwareService=require(_0xd9d6('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xd9d6('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xd9d6('0x14'));var db=require(_0xd9d6('0x15'))['db'];function respondWithStatusCode(_0x3d4d64,_0x56fdc5){_0x56fdc5=_0x56fdc5||0xcc;return function(_0x4f0910){if(_0x4f0910){return _0x3d4d64[_0xd9d6('0x16')](_0x56fdc5);}return _0x3d4d64[_0xd9d6('0x17')](_0x56fdc5)[_0xd9d6('0x18')]();};}function respondWithResult(_0x4493f8,_0x58b889){_0x58b889=_0x58b889||0xc8;return function(_0x2440e1){if(_0x2440e1){return _0x4493f8[_0xd9d6('0x17')](_0x58b889)[_0xd9d6('0x19')](_0x2440e1);}};}function respondWithFilteredResult(_0x3f8bba,_0x14bf17){return function(_0x12c206){if(_0x12c206){var _0x29573b=typeof _0x14bf17[_0xd9d6('0x1a')]===_0xd9d6('0x1b')&&typeof _0x14bf17['limit']==='undefined';var _0x318c7f=_0x12c206[_0xd9d6('0x1c')];var _0x2dfe12=_0x29573b?0x0:_0x14bf17['offset'];var _0x3e7158=_0x29573b?_0x12c206['count']:_0x14bf17['offset']+_0x14bf17['limit'];var _0x2f036f;if(_0x3e7158>=_0x318c7f){_0x3e7158=_0x318c7f;_0x2f036f=0xc8;}else{_0x2f036f=0xce;}_0x3f8bba['status'](_0x2f036f);return _0x3f8bba['set'](_0xd9d6('0x1d'),_0x2dfe12+'-'+_0x3e7158+'/'+_0x318c7f)[_0xd9d6('0x19')](_0x12c206);}return null;};}function patchUpdates(_0x425420){return function(_0x1ab5b8){try{jsonpatch[_0xd9d6('0x1e')](_0x1ab5b8,_0x425420,!![]);}catch(_0x1be4d2){return BPromise[_0xd9d6('0x1f')](_0x1be4d2);}return _0x1ab5b8[_0xd9d6('0x20')]();};}function saveUpdates(_0xe269c2,_0x23bfbe){return function(_0x26a05b){if(_0x26a05b){return _0x26a05b[_0xd9d6('0x21')](_0xe269c2)[_0xd9d6('0x22')](function(_0xc26be6){return _0xc26be6;});}return null;};}function removeEntity(_0x261153,_0x5995a1){return function(_0x4094a4){if(_0x4094a4){return _0x4094a4[_0xd9d6('0x23')]()[_0xd9d6('0x22')](function(){_0x261153['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e3d79,_0x18d0d5){return function(_0x53654e){if(!_0x53654e){_0x2e3d79[_0xd9d6('0x16')](0x194);}return _0x53654e;};}function handleError(_0x313172,_0x153973){_0x153973=_0x153973||0x1f4;return function(_0x593239){logger[_0xd9d6('0x24')](_0x593239[_0xd9d6('0x25')]);if(_0x593239[_0xd9d6('0x26')]){delete _0x593239[_0xd9d6('0x26')];}_0x313172[_0xd9d6('0x17')](_0x153973)[_0xd9d6('0x27')](_0x593239);};}exports[_0xd9d6('0x28')]=function(_0x3d37de,_0x45b2a2){var _0x362948={},_0x44f5d3={},_0xddda9c={'count':0x0,'rows':[]};var _0x4b6677=_[_0xd9d6('0x29')](db[_0xd9d6('0x2a')][_0xd9d6('0x2b')],function(_0x5e9b55){return{'name':_0x5e9b55[_0xd9d6('0x2c')],'type':_0x5e9b55[_0xd9d6('0x2d')]['key']};});_0x44f5d3[_0xd9d6('0x2e')]=_[_0xd9d6('0x29')](_0x4b6677,_0xd9d6('0x26'));_0x44f5d3[_0xd9d6('0x2f')]=_[_0xd9d6('0x30')](_0x3d37de[_0xd9d6('0x2f')]);_0x44f5d3[_0xd9d6('0x31')]=_[_0xd9d6('0x32')](_0x44f5d3['model'],_0x44f5d3['query']);_0x362948[_0xd9d6('0x33')]=_[_0xd9d6('0x32')](_0x44f5d3[_0xd9d6('0x2e')],qs[_0xd9d6('0x34')](_0x3d37de[_0xd9d6('0x2f')]['fields']));_0x362948[_0xd9d6('0x33')]=_0x362948['attributes']['length']?_0x362948[_0xd9d6('0x33')]:_0x44f5d3[_0xd9d6('0x2e')];if(!_0x3d37de[_0xd9d6('0x2f')]['hasOwnProperty'](_0xd9d6('0x35'))){_0x362948[_0xd9d6('0x36')]=qs[_0xd9d6('0x36')](_0x3d37de['query'][_0xd9d6('0x36')]);_0x362948[_0xd9d6('0x1a')]=qs[_0xd9d6('0x1a')](_0x3d37de['query'][_0xd9d6('0x1a')]);}_0x362948[_0xd9d6('0x37')]=qs['sort'](_0x3d37de['query'][_0xd9d6('0x38')]);_0x362948[_0xd9d6('0x39')]=qs[_0xd9d6('0x31')](_['pick'](_0x3d37de[_0xd9d6('0x2f')],_0x44f5d3[_0xd9d6('0x31')]),_0x4b6677);if(_0x3d37de[_0xd9d6('0x2f')]['filter']){_0x362948[_0xd9d6('0x39')]=_[_0xd9d6('0x3a')](_0x362948[_0xd9d6('0x39')],{'$or':_[_0xd9d6('0x29')](_0x4b6677,function(_0x16a5f5){if(_0x16a5f5['type']!==_0xd9d6('0x3b')){var _0xb0072={};_0xb0072[_0x16a5f5[_0xd9d6('0x26')]]={'$like':'%'+_0x3d37de[_0xd9d6('0x2f')][_0xd9d6('0x3c')]+'%'};return _0xb0072;}})});}_0x362948=_[_0xd9d6('0x3a')]({},_0x362948,_0x3d37de[_0xd9d6('0x3d')]);var _0x496a14={'where':_0x362948[_0xd9d6('0x39')]};return db[_0xd9d6('0x2a')][_0xd9d6('0x1c')](_0x496a14)[_0xd9d6('0x22')](function(_0x2785de){_0xddda9c['count']=_0x2785de;if(_0x3d37de[_0xd9d6('0x2f')]['includeAll']){_0x362948[_0xd9d6('0x3e')]=[{'all':!![]}];}return db[_0xd9d6('0x2a')][_0xd9d6('0x3f')](_0x362948);})['then'](function(_0x1bde4a){_0xddda9c[_0xd9d6('0x40')]=_0x1bde4a;return _0xddda9c;})[_0xd9d6('0x22')](respondWithFilteredResult(_0x45b2a2,_0x362948))[_0xd9d6('0x41')](handleError(_0x45b2a2,null));};exports[_0xd9d6('0x42')]=function(_0x4666d9,_0x29850b){var _0x3f85e1={'raw':!![],'where':{'id':_0x4666d9[_0xd9d6('0x43')]['id']}},_0x5baa33={};_0x5baa33['model']=_[_0xd9d6('0x30')](db[_0xd9d6('0x2a')][_0xd9d6('0x2b')]);_0x5baa33['query']=_[_0xd9d6('0x30')](_0x4666d9[_0xd9d6('0x2f')]);_0x5baa33[_0xd9d6('0x31')]=_[_0xd9d6('0x32')](_0x5baa33['model'],_0x5baa33[_0xd9d6('0x2f')]);_0x3f85e1['attributes']=_[_0xd9d6('0x32')](_0x5baa33[_0xd9d6('0x2e')],qs['fields'](_0x4666d9[_0xd9d6('0x2f')][_0xd9d6('0x34')]));_0x3f85e1[_0xd9d6('0x33')]=_0x3f85e1[_0xd9d6('0x33')][_0xd9d6('0x44')]?_0x3f85e1[_0xd9d6('0x33')]:_0x5baa33[_0xd9d6('0x2e')];if(_0x4666d9[_0xd9d6('0x2f')][_0xd9d6('0x45')]){_0x3f85e1[_0xd9d6('0x3e')]=[{'all':!![]}];}_0x3f85e1=_['merge']({},_0x3f85e1,_0x4666d9[_0xd9d6('0x3d')]);return db[_0xd9d6('0x2a')]['find'](_0x3f85e1)['then'](handleEntityNotFound(_0x29850b,null))['then'](respondWithResult(_0x29850b,null))[_0xd9d6('0x41')](handleError(_0x29850b,null));};exports[_0xd9d6('0x21')]=function(_0x27f35e,_0x385dbd){if(_0x27f35e[_0xd9d6('0x46')]['id']){delete _0x27f35e[_0xd9d6('0x46')]['id'];}return db[_0xd9d6('0x2a')]['find']({'where':{'id':_0x27f35e[_0xd9d6('0x43')]['id']}})[_0xd9d6('0x22')](handleEntityNotFound(_0x385dbd,null))['then'](saveUpdates(_0x27f35e[_0xd9d6('0x46')],null))[_0xd9d6('0x22')](respondWithResult(_0x385dbd,null))['catch'](handleError(_0x385dbd,null));};exports['destroy']=function(_0x210574,_0x287655){return db[_0xd9d6('0x2a')][_0xd9d6('0x47')]({'where':{'id':_0x210574[_0xd9d6('0x43')]['id']}})[_0xd9d6('0x22')](handleEntityNotFound(_0x287655,null))['then'](removeEntity(_0x287655,null))[_0xd9d6('0x41')](handleError(_0x287655,null));};exports[_0xd9d6('0x48')]=function(_0x54b474,_0x123c4c){return db[_0xd9d6('0x2a')][_0xd9d6('0x48')]()['then'](respondWithResult(_0x123c4c,null))[_0xd9d6('0x41')](handleError(_0x123c4c,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index aa4219f..481ee76 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 _0x6567=['rimraf','../../config/environment','./cmHopperBlack.attributes','exports','define','CmHopperBlack','cm_hopper_black','lodash','util','api','moment','bluebird'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x6567,0x1c3));var _0x7656=function(_0x4e5f99,_0x32edcd){_0x4e5f99=_0x4e5f99-0x0;var _0x384e8b=_0x6567[_0x4e5f99];return _0x384e8b;};'use strict';var _=require(_0x7656('0x0'));var util=require(_0x7656('0x1'));var logger=require('../../config/logger')(_0x7656('0x2'));var moment=require(_0x7656('0x3'));var BPromise=require(_0x7656('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7656('0x5'));var config=require(_0x7656('0x6'));var attributes=require(_0x7656('0x7'));module[_0x7656('0x8')]=function(_0x1ea058,_0x17d968){return _0x1ea058[_0x7656('0x9')](_0x7656('0xa'),attributes,{'tableName':_0x7656('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd37c=['exports','define','cm_hopper_black','util','api','moment','bluebird','request-promise','path','../../config/environment','./cmHopperBlack.attributes'];(function(_0x56608c,_0x29eb74){var _0x3c7fb0=function(_0x154b1c){while(--_0x154b1c){_0x56608c['push'](_0x56608c['shift']());}};_0x3c7fb0(++_0x29eb74);}(_0xd37c,0x87));var _0xcd37=function(_0x45e896,_0x244d1b){_0x45e896=_0x45e896-0x0;var _0x2c41d5=_0xd37c[_0x45e896];return _0x2c41d5;};'use strict';var _=require('lodash');var util=require(_0xcd37('0x0'));var logger=require('../../config/logger')(_0xcd37('0x1'));var moment=require(_0xcd37('0x2'));var BPromise=require(_0xcd37('0x3'));var rp=require(_0xcd37('0x4'));var fs=require('fs');var path=require(_0xcd37('0x5'));var rimraf=require('rimraf');var config=require(_0xcd37('0x6'));var attributes=require(_0xcd37('0x7'));module[_0xcd37('0x8')]=function(_0x572fce,_0x3b86ca){return _0x572fce[_0xcd37('0x9')]('CmHopperBlack',attributes,{'tableName':_0xcd37('0xa'),'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 9862b82..50d62b1 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 _0x0523=['util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','client','http','request','then','info','request\x20sent','CmHopperBlack,\x20%s,\x20%s,\x20%s','error','CmHopperBlack,\x20%s,\x20%s','message','catch','findAll','options','where','attributes','limit','include','model','map','GetCmHopperBlack','debug','body','raw','UpdateCmHopperBlack','stringify','destroy','DestroyCmHopperBlack'];(function(_0x27ad79,_0x33a96f){var _0x4f6f40=function(_0x1e54cc){while(--_0x1e54cc){_0x27ad79['push'](_0x27ad79['shift']());}};_0x4f6f40(++_0x33a96f);}(_0x0523,0x110));var _0x3052=function(_0x425bdd,_0x26da8d){_0x425bdd=_0x425bdd-0x0;var _0x595bc6=_0x0523[_0x425bdd];return _0x595bc6;};'use strict';var _=require('lodash');var util=require(_0x3052('0x0'));var moment=require(_0x3052('0x1'));var BPromise=require(_0x3052('0x2'));var rs=require(_0x3052('0x3'));var fs=require('fs');var Redis=require(_0x3052('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3052('0x5'));var logger=require('../../config/logger')(_0x3052('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3052('0x7')][_0x3052('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x75ea37,_0x22f8fe,_0x1dc4ad){return new BPromise(function(_0x144fec,_0x5701f1){return client[_0x3052('0x9')](_0x75ea37,_0x1dc4ad)[_0x3052('0xa')](function(_0x2ca217){logger[_0x3052('0xb')]('CmHopperBlack,\x20%s,\x20%s',_0x22f8fe,_0x3052('0xc'));logger['debug'](_0x3052('0xd'),_0x22f8fe,_0x3052('0xc'),JSON['stringify'](_0x2ca217));if(_0x2ca217['error']){if(_0x2ca217[_0x3052('0xe')]['code']===0x1f4){logger[_0x3052('0xe')](_0x3052('0xf'),_0x22f8fe,_0x2ca217[_0x3052('0xe')]['message']);return _0x5701f1(_0x2ca217[_0x3052('0xe')][_0x3052('0x10')]);}logger[_0x3052('0xe')](_0x3052('0xf'),_0x22f8fe,_0x2ca217['error'][_0x3052('0x10')]);return _0x144fec(_0x2ca217[_0x3052('0xe')][_0x3052('0x10')]);}else{logger[_0x3052('0xb')](_0x3052('0xf'),_0x22f8fe,'request\x20sent');_0x144fec(_0x2ca217['result'][_0x3052('0x10')]);}})[_0x3052('0x11')](function(_0x3bca49){logger['error'](_0x3052('0xf'),_0x22f8fe,_0x3bca49);_0x5701f1(_0x3bca49);});});}exports['GetCmHopperBlack']=function(_0x3725bb){var _0x559c56=this;return new Promise(function(_0x5a6bc5,_0x3bdb20){return db['CmHopperBlack'][_0x3052('0x12')]({'raw':_0x3725bb[_0x3052('0x13')]?_0x3725bb[_0x3052('0x13')]['raw']===undefined?!![]:![]:!![],'where':_0x3725bb[_0x3052('0x13')]?_0x3725bb[_0x3052('0x13')][_0x3052('0x14')]||null:null,'attributes':_0x3725bb['options']?_0x3725bb[_0x3052('0x13')][_0x3052('0x15')]||null:null,'limit':_0x3725bb[_0x3052('0x13')]?_0x3725bb[_0x3052('0x13')][_0x3052('0x16')]||null:null,'include':_0x3725bb[_0x3052('0x13')]?_0x3725bb[_0x3052('0x13')]['include']?_['map'](_0x3725bb[_0x3052('0x13')][_0x3052('0x17')],function(_0x1cb741){return{'model':db[_0x1cb741[_0x3052('0x18')]],'as':_0x1cb741['as'],'attributes':_0x1cb741['attributes'],'include':_0x1cb741[_0x3052('0x17')]?_[_0x3052('0x19')](_0x1cb741['include'],function(_0x3cb6f4){return{'model':db[_0x3cb6f4[_0x3052('0x18')]],'as':_0x3cb6f4['as'],'attributes':_0x3cb6f4['attributes'],'include':_0x3cb6f4[_0x3052('0x17')]?_[_0x3052('0x19')](_0x3cb6f4['include'],function(_0x8ada8c){return{'model':db[_0x8ada8c[_0x3052('0x18')]],'as':_0x8ada8c['as'],'attributes':_0x8ada8c['attributes']};}):[]};}):[]};}):[]:[]})[_0x3052('0xa')](function(_0x11d906){logger[_0x3052('0xb')](_0x3052('0x1a'),_0x3725bb);logger[_0x3052('0x1b')](_0x3052('0x1a'),_0x3725bb,JSON['stringify'](_0x11d906));_0x5a6bc5(_0x11d906);})[_0x3052('0x11')](function(_0x413f5c){logger[_0x3052('0xe')]('GetCmHopperBlack',_0x413f5c[_0x3052('0x10')],_0x3725bb);_0x3bdb20(_0x559c56[_0x3052('0xe')](0x1f4,_0x413f5c[_0x3052('0x10')]));});});};exports['UpdateCmHopperBlack']=function(_0x1f0162){var _0x2289e6=this;return new Promise(function(_0x24110b,_0x1b6a48){return db['CmHopperBlack']['update'](_0x1f0162[_0x3052('0x1c')],{'raw':_0x1f0162[_0x3052('0x13')]?_0x1f0162[_0x3052('0x13')][_0x3052('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1f0162[_0x3052('0x13')]?_0x1f0162[_0x3052('0x13')]['where']||null:null,'attributes':_0x1f0162[_0x3052('0x13')]?_0x1f0162[_0x3052('0x13')]['attributes']||null:null,'limit':_0x1f0162[_0x3052('0x13')]?_0x1f0162[_0x3052('0x13')]['limit']||null:null})[_0x3052('0xa')](function(_0x26969d){logger['info'](_0x3052('0x1e'),_0x1f0162);logger[_0x3052('0x1b')]('UpdateCmHopperBlack',_0x1f0162,JSON[_0x3052('0x1f')](_0x26969d));_0x24110b(_0x26969d);})[_0x3052('0x11')](function(_0x5e364f){logger[_0x3052('0xe')](_0x3052('0x1e'),_0x5e364f[_0x3052('0x10')],_0x1f0162);_0x1b6a48(_0x2289e6[_0x3052('0xe')](0x1f4,_0x5e364f[_0x3052('0x10')]));});});};exports['DestroyCmHopperBlack']=function(_0x2d00cc){var _0x15719a=this;return new Promise(function(_0x490c89,_0xe61af0){return db['CmHopperBlack'][_0x3052('0x20')]({'where':_0x2d00cc[_0x3052('0x13')]?_0x2d00cc[_0x3052('0x13')][_0x3052('0x14')]||null:null})[_0x3052('0xa')](function(_0x26a5a6){logger[_0x3052('0xb')](_0x3052('0x21'),_0x2d00cc);logger[_0x3052('0x1b')](_0x3052('0x21'),_0x2d00cc,JSON[_0x3052('0x1f')](_0x26a5a6));_0x490c89(_0x26a5a6);})[_0x3052('0x11')](function(_0x48d3b9){logger[_0x3052('0xe')](_0x3052('0x21'),_0x48d3b9[_0x3052('0x10')],_0x2d00cc);_0xe61af0(_0x15719a[_0x3052('0xe')](0x1f4,_0x48d3b9[_0x3052('0x10')]));});});}; \ No newline at end of file +var _0xedc8=['where','attributes','limit','include','map','model','then','GetCmHopperBlack','body','UpdateCmHopperBlack','catch','DestroyCmHopperBlack','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CmHopperBlack','findAll','options','raw'];(function(_0x31f24b,_0x20e465){var _0x40ce57=function(_0x1778ee){while(--_0x1778ee){_0x31f24b['push'](_0x31f24b['shift']());}};_0x40ce57(++_0x20e465);}(_0xedc8,0x7e));var _0x8edc=function(_0x19b3f9,_0xade753){_0x19b3f9=_0x19b3f9-0x0;var _0x18c3f6=_0xedc8[_0x19b3f9];return _0x18c3f6;};'use strict';var _=require(_0x8edc('0x0'));var util=require(_0x8edc('0x1'));var moment=require(_0x8edc('0x2'));var BPromise=require(_0x8edc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8edc('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8edc('0x5'));var logger=require(_0x8edc('0x6'))(_0x8edc('0x7'));var config=require(_0x8edc('0x8'));var jayson=require(_0x8edc('0x9'));var client=jayson[_0x8edc('0xa')][_0x8edc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x54fee2,_0x1b073b,_0x5ca5e9){return new BPromise(function(_0xfaacfc,_0x5c0c97){return client[_0x8edc('0xc')](_0x54fee2,_0x5ca5e9)['then'](function(_0x39747a){logger[_0x8edc('0xd')](_0x8edc('0xe'),_0x1b073b,_0x8edc('0xf'));logger[_0x8edc('0x10')](_0x8edc('0x11'),_0x1b073b,_0x8edc('0xf'),JSON[_0x8edc('0x12')](_0x39747a));if(_0x39747a[_0x8edc('0x13')]){if(_0x39747a[_0x8edc('0x13')][_0x8edc('0x14')]===0x1f4){logger[_0x8edc('0x13')](_0x8edc('0xe'),_0x1b073b,_0x39747a[_0x8edc('0x13')]['message']);return _0x5c0c97(_0x39747a[_0x8edc('0x13')][_0x8edc('0x15')]);}logger[_0x8edc('0x13')](_0x8edc('0xe'),_0x1b073b,_0x39747a[_0x8edc('0x13')][_0x8edc('0x15')]);return _0xfaacfc(_0x39747a[_0x8edc('0x13')][_0x8edc('0x15')]);}else{logger[_0x8edc('0xd')]('CmHopperBlack,\x20%s,\x20%s',_0x1b073b,_0x8edc('0xf'));_0xfaacfc(_0x39747a['result']['message']);}})['catch'](function(_0x308a23){logger[_0x8edc('0x13')](_0x8edc('0xe'),_0x1b073b,_0x308a23);_0x5c0c97(_0x308a23);});});}exports['GetCmHopperBlack']=function(_0x473b18){var _0x1bb1c0=this;return new Promise(function(_0x221a03,_0x3a2b5d){return db[_0x8edc('0x16')][_0x8edc('0x17')]({'raw':_0x473b18[_0x8edc('0x18')]?_0x473b18[_0x8edc('0x18')][_0x8edc('0x19')]===undefined?!![]:![]:!![],'where':_0x473b18[_0x8edc('0x18')]?_0x473b18[_0x8edc('0x18')][_0x8edc('0x1a')]||null:null,'attributes':_0x473b18[_0x8edc('0x18')]?_0x473b18[_0x8edc('0x18')][_0x8edc('0x1b')]||null:null,'limit':_0x473b18[_0x8edc('0x18')]?_0x473b18[_0x8edc('0x18')][_0x8edc('0x1c')]||null:null,'include':_0x473b18['options']?_0x473b18[_0x8edc('0x18')][_0x8edc('0x1d')]?_[_0x8edc('0x1e')](_0x473b18[_0x8edc('0x18')][_0x8edc('0x1d')],function(_0x43838c){return{'model':db[_0x43838c[_0x8edc('0x1f')]],'as':_0x43838c['as'],'attributes':_0x43838c[_0x8edc('0x1b')],'include':_0x43838c['include']?_[_0x8edc('0x1e')](_0x43838c[_0x8edc('0x1d')],function(_0x14538c){return{'model':db[_0x14538c[_0x8edc('0x1f')]],'as':_0x14538c['as'],'attributes':_0x14538c[_0x8edc('0x1b')],'include':_0x14538c['include']?_[_0x8edc('0x1e')](_0x14538c[_0x8edc('0x1d')],function(_0x2d8dee){return{'model':db[_0x2d8dee[_0x8edc('0x1f')]],'as':_0x2d8dee['as'],'attributes':_0x2d8dee[_0x8edc('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x8edc('0x20')](function(_0x3a90ed){logger[_0x8edc('0xd')]('GetCmHopperBlack',_0x473b18);logger['debug'](_0x8edc('0x21'),_0x473b18,JSON['stringify'](_0x3a90ed));_0x221a03(_0x3a90ed);})['catch'](function(_0x4dc469){logger[_0x8edc('0x13')]('GetCmHopperBlack',_0x4dc469[_0x8edc('0x15')],_0x473b18);_0x3a2b5d(_0x1bb1c0[_0x8edc('0x13')](0x1f4,_0x4dc469[_0x8edc('0x15')]));});});};exports['UpdateCmHopperBlack']=function(_0x5e6c9c){var _0x5d61a0=this;return new Promise(function(_0x270e10,_0x5b93df){return db[_0x8edc('0x16')]['update'](_0x5e6c9c[_0x8edc('0x22')],{'raw':_0x5e6c9c[_0x8edc('0x18')]?_0x5e6c9c[_0x8edc('0x18')][_0x8edc('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5e6c9c[_0x8edc('0x18')]?_0x5e6c9c[_0x8edc('0x18')][_0x8edc('0x1a')]||null:null,'attributes':_0x5e6c9c[_0x8edc('0x18')]?_0x5e6c9c[_0x8edc('0x18')]['attributes']||null:null,'limit':_0x5e6c9c[_0x8edc('0x18')]?_0x5e6c9c[_0x8edc('0x18')][_0x8edc('0x1c')]||null:null})[_0x8edc('0x20')](function(_0x1978c8){logger['info'](_0x8edc('0x23'),_0x5e6c9c);logger[_0x8edc('0x10')](_0x8edc('0x23'),_0x5e6c9c,JSON[_0x8edc('0x12')](_0x1978c8));_0x270e10(_0x1978c8);})[_0x8edc('0x24')](function(_0x4c3e18){logger[_0x8edc('0x13')](_0x8edc('0x23'),_0x4c3e18['message'],_0x5e6c9c);_0x5b93df(_0x5d61a0[_0x8edc('0x13')](0x1f4,_0x4c3e18[_0x8edc('0x15')]));});});};exports[_0x8edc('0x25')]=function(_0xad91b7){var _0x583efe=this;return new Promise(function(_0x542105,_0x3aa91b){return db['CmHopperBlack']['destroy']({'where':_0xad91b7[_0x8edc('0x18')]?_0xad91b7[_0x8edc('0x18')][_0x8edc('0x1a')]||null:null})[_0x8edc('0x20')](function(_0x4a0469){logger[_0x8edc('0xd')](_0x8edc('0x25'),_0xad91b7);logger[_0x8edc('0x10')]('DestroyCmHopperBlack',_0xad91b7,JSON[_0x8edc('0x12')](_0x4a0469));_0x542105(_0x4a0469);})[_0x8edc('0x24')](function(_0x90e917){logger['error']('DestroyCmHopperBlack',_0x90e917[_0x8edc('0x15')],_0xad91b7);_0x3aa91b(_0x583efe[_0x8edc('0x13')](0x1f4,_0x90e917[_0x8edc('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 229c18b..d7bd70e 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 _0x57ca=['../../components/interaction/service','./cmHopperBlack.controller','get','isAuthenticated','index','/describe','describe','/:id','show','put','delete','destroy','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x46c415,_0x442b74){var _0x2d854d=function(_0x568b01){while(--_0x568b01){_0x46c415['push'](_0x46c415['shift']());}};_0x2d854d(++_0x442b74);}(_0x57ca,0x108));var _0xa57c=function(_0xbea479,_0x948477){_0xbea479=_0xbea479-0x0;var _0x543df1=_0x57ca[_0xbea479];return _0x543df1;};'use strict';var multer=require('multer');var util=require(_0xa57c('0x0'));var path=require(_0xa57c('0x1'));var timeout=require('connect-timeout');var express=require(_0xa57c('0x2'));var router=express[_0xa57c('0x3')]();var fs_extra=require(_0xa57c('0x4'));var auth=require(_0xa57c('0x5'));var interaction=require(_0xa57c('0x6'));var config=require('../../config/environment');var controller=require(_0xa57c('0x7'));router[_0xa57c('0x8')]('/',auth[_0xa57c('0x9')](),controller[_0xa57c('0xa')]);router[_0xa57c('0x8')](_0xa57c('0xb'),auth[_0xa57c('0x9')](),controller[_0xa57c('0xc')]);router['get'](_0xa57c('0xd'),auth['isAuthenticated'](),controller[_0xa57c('0xe')]);router[_0xa57c('0xf')]('/:id',auth[_0xa57c('0x9')](),controller['update']);router[_0xa57c('0x10')](_0xa57c('0xd'),auth['isAuthenticated'](),controller[_0xa57c('0x11')]);module['exports']=router; \ No newline at end of file +var _0xd117=['/describe','describe','/:id','show','put','update','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','index'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xd117,0x182));var _0x7d11=function(_0x4bcf38,_0x3c12be){_0x4bcf38=_0x4bcf38-0x0;var _0x4a89be=_0xd117[_0x4bcf38];return _0x4a89be;};'use strict';var multer=require(_0x7d11('0x0'));var util=require(_0x7d11('0x1'));var path=require(_0x7d11('0x2'));var timeout=require(_0x7d11('0x3'));var express=require(_0x7d11('0x4'));var router=express[_0x7d11('0x5')]();var fs_extra=require(_0x7d11('0x6'));var auth=require(_0x7d11('0x7'));var interaction=require(_0x7d11('0x8'));var config=require(_0x7d11('0x9'));var controller=require(_0x7d11('0xa'));router[_0x7d11('0xb')]('/',auth[_0x7d11('0xc')](),controller[_0x7d11('0xd')]);router[_0x7d11('0xb')](_0x7d11('0xe'),auth['isAuthenticated'](),controller[_0x7d11('0xf')]);router[_0x7d11('0xb')](_0x7d11('0x10'),auth['isAuthenticated'](),controller[_0x7d11('0x11')]);router[_0x7d11('0x12')](_0x7d11('0x10'),auth['isAuthenticated'](),controller[_0x7d11('0x13')]);router['delete']('/:id',auth[_0x7d11('0xc')](),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 382b8f7..beffa5a 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 _0x1762=['seconds','BOOLEAN','sequelize','moment','INTEGER','DATE','STRING','getDataValue','endtime','setDataValue','followuptime','diff'];(function(_0x17c483,_0xc69535){var _0x112bdb=function(_0x19adb9){while(--_0x19adb9){_0x17c483['push'](_0x17c483['shift']());}};_0x112bdb(++_0xc69535);}(_0x1762,0x1b2));var _0x2176=function(_0x5e8c92,_0x38fe8d){_0x5e8c92=_0x5e8c92-0x0;var _0x48686f=_0x1762[_0x5e8c92];return _0x48686f;};'use strict';var Sequelize=require(_0x2176('0x0'));var moment=require(_0x2176('0x1'));module['exports']={'state':{'type':Sequelize[_0x2176('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x2176('0x3')]},'countbusyretry':{'type':Sequelize[_0x2176('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x2176('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x2176('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x2176('0x4')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x2176('0x4')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x2176('0x4')]},'starttime':{'type':Sequelize[_0x2176('0x3')]},'responsetime':{'type':Sequelize[_0x2176('0x3')]},'answertime':{'type':Sequelize[_0x2176('0x3')]},'droptime':{'type':Sequelize[_0x2176('0x3')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x2176('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x2176('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x2176('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x2176('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x2176('0x4')]},'campaign':{'type':Sequelize[_0x2176('0x4')]},'campaigntype':{'type':Sequelize[_0x2176('0x4')]},'membername':{'type':Sequelize[_0x2176('0x4')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x2176('0x4')]},'thirdDisposition':{'type':Sequelize[_0x2176('0x4')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x5c0f06){var _0x3791fe=this[_0x2176('0x5')](_0x2176('0x6'));if(_0x3791fe&&_0x5c0f06){this[_0x2176('0x7')](_0x2176('0x8'),moment(_0x5c0f06)[_0x2176('0x9')](moment(_0x3791fe),_0x2176('0xa')));}return this['setDataValue']('dispositionat',_0x5c0f06);}},'amd':{'type':Sequelize[_0x2176('0xb')],'defaultValue':![]},'fax':{'type':Sequelize[_0x2176('0xb')],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x2176('0xb')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x2176('0x3')]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x2176('0x3')]},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0x2176('0x3')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x2176('0x3')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x2176('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x2176('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x2176('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xa85c=['exports','INTEGER','STRING','DATE','getDataValue','endtime','setDataValue','followuptime','diff','seconds','dispositionat','BOOLEAN'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa85c,0xb4));var _0xca85=function(_0x5519a9,_0x1c5147){_0x5519a9=_0x5519a9-0x0;var _0x32f2cc=_0xa85c[_0x5519a9];return _0x32f2cc;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0xca85('0x0')]={'state':{'type':Sequelize[_0xca85('0x1')](0x2)},'statedesc':{'type':Sequelize[_0xca85('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xca85('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xca85('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xca85('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xca85('0x2')]},'originatecalleridnum':{'type':Sequelize[_0xca85('0x2')]},'originatecalleridname':{'type':Sequelize[_0xca85('0x2')]},'calleridnum':{'type':Sequelize[_0xca85('0x2')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xca85('0x3')]},'answertime':{'type':Sequelize[_0xca85('0x3')]},'droptime':{'type':Sequelize[_0xca85('0x3')]},'endtime':{'type':Sequelize[_0xca85('0x3')]},'ringtime':{'type':Sequelize[_0xca85('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xca85('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xca85('0x2')]},'campaign':{'type':Sequelize[_0xca85('0x2')]},'campaigntype':{'type':Sequelize[_0xca85('0x2')]},'membername':{'type':Sequelize[_0xca85('0x2')]},'reason':{'type':Sequelize[_0xca85('0x2')]},'disposition':{'type':Sequelize[_0xca85('0x2')]},'secondDisposition':{'type':Sequelize[_0xca85('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize[_0xca85('0x3')],'set':function(_0x4856fd){var _0x5e1146=this[_0xca85('0x4')](_0xca85('0x5'));if(_0x5e1146&&_0x4856fd){this[_0xca85('0x6')](_0xca85('0x7'),moment(_0x4856fd)[_0xca85('0x8')](moment(_0x5e1146),_0xca85('0x9')));}return this[_0xca85('0x6')](_0xca85('0xa'),_0x4856fd);}},'amd':{'type':Sequelize[_0xca85('0xb')],'defaultValue':![]},'fax':{'type':Sequelize[_0xca85('0xb')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xca85('0xb')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xca85('0xb')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xca85('0x3')]},'callback':{'type':Sequelize[_0xca85('0xb')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xca85('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0xca85('0x2')],'defaultValue':null},'deletedat':{'type':Sequelize[_0xca85('0x3')]},'recallme':{'type':Sequelize[_0xca85('0xb')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xca85('0x3')]},'countnosuchnumberretry':{'type':Sequelize[_0xca85('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xca85('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xca85('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xca85('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xca85('0x1')],'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 aedb0d9..befd640 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 _0x187d=['state\x20=\x20?','calleridnum\x20NOT\x20IN\x20(?)','select','from','cm_hopper','calleridnum','cm_hopper_final','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','insert','into','CampaignId','CampaignId\x20=\x20?','state','checkContactHopper','CmHopper','findOne','eml-format','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','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','update','destroy','error','stack','name','index','map','CmHopperFinal','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','where','filter','merge','includeAll','include','findAll','then','rows','catch','show','params','fields','options','find','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','COUNT','sequelize','literal','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x200,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2022,\x201,\x20null','moveContactsQueueCampaignHopperFinal','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','VoiceQueueId\x20=\x20?','toString'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0x187d,0x93));var _0xd187=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0x187d[_0x5b78e8];return _0xf2c321;};'use strict';var emlformat=require(_0xd187('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd187('0x1'));var jsonpatch=require(_0xd187('0x2'));var rp=require(_0xd187('0x3'));var moment=require(_0xd187('0x4'));var BPromise=require(_0xd187('0x5'));var Mustache=require(_0xd187('0x6'));var util=require('util');var path=require(_0xd187('0x7'));var sox=require(_0xd187('0x8'));var csv=require('to-csv');var ejs=require(_0xd187('0x9'));var fs=require('fs');var fs_extra=require(_0xd187('0xa'));var _=require(_0xd187('0xb'));var squel=require(_0xd187('0xc'));var crypto=require(_0xd187('0xd'));var jsforce=require(_0xd187('0xe'));var deskjs=require(_0xd187('0xf'));var toCsv=require(_0xd187('0x10'));var querystring=require('querystring');var Papa=require(_0xd187('0x11'));var Redis=require(_0xd187('0x12'));var authService=require(_0xd187('0x13'));var qs=require(_0xd187('0x14'));var as=require(_0xd187('0x15'));var hardwareService=require(_0xd187('0x16'));var logger=require('../../config/logger')(_0xd187('0x17'));var utils=require(_0xd187('0x18'));var config=require(_0xd187('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xd187('0x1a'))['db'];function respondWithStatusCode(_0x4545cf,_0x32ba07){_0x32ba07=_0x32ba07||0xcc;return function(_0x59ee4a){if(_0x59ee4a){return _0x4545cf[_0xd187('0x1b')](_0x32ba07);}return _0x4545cf[_0xd187('0x1c')](_0x32ba07)[_0xd187('0x1d')]();};}function respondWithResult(_0x126d1a,_0x517b25){_0x517b25=_0x517b25||0xc8;return function(_0x39a927){if(_0x39a927){return _0x126d1a[_0xd187('0x1c')](_0x517b25)[_0xd187('0x1e')](_0x39a927);}};}function respondWithFilteredResult(_0x188cfe,_0x4c8f68){return function(_0x245d3e){if(_0x245d3e){var _0x52a208=typeof _0x4c8f68['offset']===_0xd187('0x1f')&&typeof _0x4c8f68['limit']==='undefined';var _0x207b36=_0x245d3e[_0xd187('0x20')];var _0x374fe0=_0x52a208?0x0:_0x4c8f68[_0xd187('0x21')];var _0x21df74=_0x52a208?_0x245d3e[_0xd187('0x20')]:_0x4c8f68[_0xd187('0x21')]+_0x4c8f68[_0xd187('0x22')];var _0x4f2f88;if(_0x21df74>=_0x207b36){_0x21df74=_0x207b36;_0x4f2f88=0xc8;}else{_0x4f2f88=0xce;}_0x188cfe[_0xd187('0x1c')](_0x4f2f88);return _0x188cfe[_0xd187('0x23')](_0xd187('0x24'),_0x374fe0+'-'+_0x21df74+'/'+_0x207b36)[_0xd187('0x1e')](_0x245d3e);}return null;};}function patchUpdates(_0x5204ee){return function(_0x2f7fb3){try{jsonpatch[_0xd187('0x25')](_0x2f7fb3,_0x5204ee,!![]);}catch(_0xc5bba5){return BPromise['reject'](_0xc5bba5);}return _0x2f7fb3['save']();};}function saveUpdates(_0x57cf1d,_0x435d94){return function(_0x33741d){if(_0x33741d){return _0x33741d[_0xd187('0x26')](_0x57cf1d)['then'](function(_0x2c07c8){return _0x2c07c8;});}return null;};}function removeEntity(_0x57186b,_0x145771){return function(_0x5a7a23){if(_0x5a7a23){return _0x5a7a23[_0xd187('0x27')]()['then'](function(){_0x57186b['status'](0xcc)[_0xd187('0x1d')]();});}};}function handleEntityNotFound(_0x4d992b,_0x12da33){return function(_0x598aa4){if(!_0x598aa4){_0x4d992b['sendStatus'](0x194);}return _0x598aa4;};}function handleError(_0x4eac6a,_0x848ddd){_0x848ddd=_0x848ddd||0x1f4;return function(_0xeff822){logger[_0xd187('0x28')](_0xeff822[_0xd187('0x29')]);if(_0xeff822['name']){delete _0xeff822[_0xd187('0x2a')];}_0x4eac6a[_0xd187('0x1c')](_0x848ddd)['send'](_0xeff822);};}exports[_0xd187('0x2b')]=function(_0x1c87ee,_0x34febe){var _0x4c50a5={},_0x15e2e8={},_0x56e292={'count':0x0,'rows':[]};var _0x263e31=_[_0xd187('0x2c')](db[_0xd187('0x2d')][_0xd187('0x2e')],function(_0x489f2e){return{'name':_0x489f2e[_0xd187('0x2f')],'type':_0x489f2e[_0xd187('0x30')]['key']};});_0x15e2e8['model']=_[_0xd187('0x2c')](_0x263e31,_0xd187('0x2a'));_0x15e2e8[_0xd187('0x31')]=_[_0xd187('0x32')](_0x1c87ee[_0xd187('0x31')]);_0x15e2e8[_0xd187('0x33')]=_[_0xd187('0x34')](_0x15e2e8[_0xd187('0x35')],_0x15e2e8['query']);_0x4c50a5[_0xd187('0x36')]=_[_0xd187('0x34')](_0x15e2e8[_0xd187('0x35')],qs['fields'](_0x1c87ee[_0xd187('0x31')]['fields']));_0x4c50a5[_0xd187('0x36')]=_0x4c50a5[_0xd187('0x36')][_0xd187('0x37')]?_0x4c50a5['attributes']:_0x15e2e8['model'];if(!_0x1c87ee[_0xd187('0x31')][_0xd187('0x38')]('nolimit')){_0x4c50a5[_0xd187('0x22')]=qs[_0xd187('0x22')](_0x1c87ee[_0xd187('0x31')]['limit']);_0x4c50a5['offset']=qs[_0xd187('0x21')](_0x1c87ee[_0xd187('0x31')]['offset']);}_0x4c50a5['order']=qs['sort'](_0x1c87ee[_0xd187('0x31')]['sort']);_0x4c50a5[_0xd187('0x39')]=qs[_0xd187('0x33')](_['pick'](_0x1c87ee[_0xd187('0x31')],_0x15e2e8['filters']),_0x263e31);if(_0x1c87ee[_0xd187('0x31')][_0xd187('0x3a')]){_0x4c50a5['where']=_[_0xd187('0x3b')](_0x4c50a5[_0xd187('0x39')],{'$or':_['map'](_0x263e31,function(_0x4399a5){if(_0x4399a5['type']!=='VIRTUAL'){var _0x26b06d={};_0x26b06d[_0x4399a5[_0xd187('0x2a')]]={'$like':'%'+_0x1c87ee[_0xd187('0x31')][_0xd187('0x3a')]+'%'};return _0x26b06d;}})});}_0x4c50a5=_[_0xd187('0x3b')]({},_0x4c50a5,_0x1c87ee['options']);var _0x8860c={'where':_0x4c50a5[_0xd187('0x39')]};return db[_0xd187('0x2d')]['count'](_0x8860c)['then'](function(_0x538c05){_0x56e292['count']=_0x538c05;if(_0x1c87ee[_0xd187('0x31')][_0xd187('0x3c')]){_0x4c50a5[_0xd187('0x3d')]=[{'all':!![]}];}return db[_0xd187('0x2d')][_0xd187('0x3e')](_0x4c50a5);})[_0xd187('0x3f')](function(_0x4699e1){_0x56e292[_0xd187('0x40')]=_0x4699e1;return _0x56e292;})['then'](respondWithFilteredResult(_0x34febe,_0x4c50a5))[_0xd187('0x41')](handleError(_0x34febe,null));};exports[_0xd187('0x42')]=function(_0x31d9d2,_0x51c7fc){var _0x21cbf6={'raw':!![],'where':{'id':_0x31d9d2[_0xd187('0x43')]['id']}},_0x48c100={};_0x48c100[_0xd187('0x35')]=_[_0xd187('0x32')](db[_0xd187('0x2d')][_0xd187('0x2e')]);_0x48c100['query']=_[_0xd187('0x32')](_0x31d9d2[_0xd187('0x31')]);_0x48c100[_0xd187('0x33')]=_[_0xd187('0x34')](_0x48c100['model'],_0x48c100[_0xd187('0x31')]);_0x21cbf6[_0xd187('0x36')]=_['intersection'](_0x48c100[_0xd187('0x35')],qs[_0xd187('0x44')](_0x31d9d2['query']['fields']));_0x21cbf6[_0xd187('0x36')]=_0x21cbf6[_0xd187('0x36')]['length']?_0x21cbf6['attributes']:_0x48c100['model'];if(_0x31d9d2[_0xd187('0x31')][_0xd187('0x3c')]){_0x21cbf6[_0xd187('0x3d')]=[{'all':!![]}];}_0x21cbf6=_[_0xd187('0x3b')]({},_0x21cbf6,_0x31d9d2[_0xd187('0x45')]);return db[_0xd187('0x2d')][_0xd187('0x46')](_0x21cbf6)['then'](handleEntityNotFound(_0x51c7fc,null))[_0xd187('0x3f')](respondWithResult(_0x51c7fc,null))[_0xd187('0x41')](handleError(_0x51c7fc,null));};exports[_0xd187('0x47')]=function(_0x3ce4a1,_0x3f5def){return db[_0xd187('0x2d')][_0xd187('0x47')]()[_0xd187('0x3f')](respondWithResult(_0x3f5def,null))['catch'](handleError(_0x3f5def,null));};exports[_0xd187('0x26')]=function(_0x2657be,_0x4523c8){if(_0x2657be[_0xd187('0x48')][_0xd187('0x49')]){delete _0x2657be['body'][_0xd187('0x49')];}return db[_0xd187('0x2d')]['find']({'where':{'uniqueid':_0x2657be[_0xd187('0x43')]['id']}})[_0xd187('0x3f')](handleEntityNotFound(_0x4523c8,null))['then'](saveUpdates(_0x2657be['body'],null))['then'](respondWithResult(_0x4523c8,null))['catch'](handleError(_0x4523c8,null));};exports[_0xd187('0x4a')]=function(_0x22f432,_0x12d448,_0x1bcc3a){return db[_0xd187('0x2d')][_0xd187('0x3e')]({'raw':![],'where':{'VoiceQueueId':_0x22f432[_0xd187('0x43')]['id']},'attributes':[[db['sequelize']['fn'](_0xd187('0x4b'),db[_0xd187('0x4c')]['fn']('IF',db[_0xd187('0x4c')][_0xd187('0x4d')]('`state`\x20=\x200,\x201,\x20null'))),_0xd187('0x4e')],[db['sequelize']['fn']('COUNT',db[_0xd187('0x4c')]['fn']('IF',db['sequelize'][_0xd187('0x4d')](_0xd187('0x4f')))),_0xd187('0x50')],[db[_0xd187('0x4c')]['fn'](_0xd187('0x4b'),db[_0xd187('0x4c')]['fn']('IF',db[_0xd187('0x4c')][_0xd187('0x4d')](_0xd187('0x51')))),'busyContacts'],[db[_0xd187('0x4c')]['fn'](_0xd187('0x4b'),db['sequelize']['fn']('IF',db[_0xd187('0x4c')][_0xd187('0x4d')](_0xd187('0x52')))),'congestionContacts'],[db[_0xd187('0x4c')]['fn'](_0xd187('0x4b'),db['sequelize']['fn']('IF',db[_0xd187('0x4c')][_0xd187('0x4d')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0xd187('0x53')],[db['sequelize']['fn'](_0xd187('0x4b'),db[_0xd187('0x4c')]['fn']('IF',db[_0xd187('0x4c')][_0xd187('0x4d')](_0xd187('0x54')))),_0xd187('0x55')],[db[_0xd187('0x4c')]['fn']('COUNT',db[_0xd187('0x4c')]['fn']('IF',db[_0xd187('0x4c')][_0xd187('0x4d')]('`state`\x20=\x2022,\x201,\x20null'))),_0xd187('0x56')],[db[_0xd187('0x4c')]['fn'](_0xd187('0x4b'),db[_0xd187('0x4c')]['fn']('IF',db[_0xd187('0x4c')][_0xd187('0x4d')](_0xd187('0x57')))),_0xd187('0x58')]]})[_0xd187('0x3f')](handleEntityNotFound(_0x12d448,null))[_0xd187('0x3f')](respondWithResult(_0x12d448,null))[_0xd187('0x41')](handleError(_0x12d448,null));};exports[_0xd187('0x59')]=function(_0x23271b,_0x288a04,_0x39934c){return db[_0xd187('0x2d')][_0xd187('0x3e')]({'raw':![],'where':{'CampaignId':_0x23271b[_0xd187('0x43')]['id']},'attributes':[[db[_0xd187('0x4c')]['fn'](_0xd187('0x4b'),db['sequelize']['fn']('IF',db[_0xd187('0x4c')]['literal'](_0xd187('0x5a')))),_0xd187('0x4e')],[db[_0xd187('0x4c')]['fn'](_0xd187('0x4b'),db['sequelize']['fn']('IF',db[_0xd187('0x4c')][_0xd187('0x4d')]('`state`\x20=\x203,\x201,\x20null'))),'noAnswerContacts'],[db[_0xd187('0x4c')]['fn'](_0xd187('0x4b'),db[_0xd187('0x4c')]['fn']('IF',db[_0xd187('0x4c')]['literal'](_0xd187('0x51')))),'busyContacts'],[db[_0xd187('0x4c')]['fn'](_0xd187('0x4b'),db[_0xd187('0x4c')]['fn']('IF',db[_0xd187('0x4c')]['literal'](_0xd187('0x52')))),_0xd187('0x5b')],[db[_0xd187('0x4c')]['fn'](_0xd187('0x4b'),db[_0xd187('0x4c')]['fn']('IF',db['sequelize']['literal'](_0xd187('0x5c')))),_0xd187('0x53')],[db[_0xd187('0x4c')]['fn'](_0xd187('0x4b'),db[_0xd187('0x4c')]['fn']('IF',db[_0xd187('0x4c')][_0xd187('0x4d')](_0xd187('0x54')))),_0xd187('0x55')],[db[_0xd187('0x4c')]['fn'](_0xd187('0x4b'),db[_0xd187('0x4c')]['fn']('IF',db['sequelize'][_0xd187('0x4d')](_0xd187('0x5d')))),'reCallContacts'],[db[_0xd187('0x4c')]['fn'](_0xd187('0x4b'),db['sequelize']['fn']('IF',db['sequelize'][_0xd187('0x4d')](_0xd187('0x57')))),_0xd187('0x58')]]})[_0xd187('0x3f')](handleEntityNotFound(_0x288a04,null))['then'](respondWithResult(_0x288a04,null))[_0xd187('0x41')](handleError(_0x288a04,null));};exports[_0xd187('0x5e')]=function(_0x52e364,_0x569959,_0x3bca83){return db['VoiceQueue'][_0xd187('0x46')]({'where':{'id':_0x52e364[_0xd187('0x43')]['id']}})['then'](handleEntityNotFound(_0x569959,null))[_0xd187('0x3f')](function(_0x570c1c){var _0x317bc3;if(_0x570c1c){_0x317bc3=squel['insert']()['into']('cm_hopper')[_0xd187('0x5f')]([_0xd187('0x60'),_0xd187('0x61'),_0xd187('0x62'),_0xd187('0x63'),_0xd187('0x64'),_0xd187('0x65'),_0xd187('0x66')],squel['select']()[_0xd187('0x67')](_0xd187('0x68'),_0xd187('0x60'))['field'](_0xd187('0x69'),_0xd187('0x61'))[_0xd187('0x67')](_0xd187('0x6a'),'ContactId')[_0xd187('0x67')](_0xd187('0x6b'),'ListId')[_0xd187('0x67')](_0xd187('0x6c'),_0xd187('0x64'))[_0xd187('0x67')]('NOW()',_0xd187('0x65'))[_0xd187('0x67')]('NOW()',_0xd187('0x66'))['from']('cm_hopper_final')['where'](_0xd187('0x6d'),_0x52e364[_0xd187('0x43')]['id'][_0xd187('0x6e')]())[_0xd187('0x39')](_0xd187('0x6f'),_0x52e364[_0xd187('0x48')]['state'][_0xd187('0x6e')]())[_0xd187('0x39')]('calleridnum\x20IS\x20NOT\x20NULL')['where'](_0xd187('0x70'),squel[_0xd187('0x71')]()[_0xd187('0x67')](_0xd187('0x60'))[_0xd187('0x72')](_0xd187('0x73'))['where'](_0xd187('0x6d'),_0x52e364[_0xd187('0x43')]['id'][_0xd187('0x6e')]()))[_0xd187('0x39')](_0xd187('0x70'),squel[_0xd187('0x71')]()[_0xd187('0x67')](_0xd187('0x74'))[_0xd187('0x72')](_0xd187('0x75'))[_0xd187('0x39')](_0xd187('0x6d'),_0x52e364['params']['id']['toString']())[_0xd187('0x39')](_0xd187('0x76')))[_0xd187('0x77')](_0xd187('0x62')))[_0xd187('0x6e')]();return db[_0xd187('0x4c')]['query'](_0x317bc3);}return[];})[_0xd187('0x3f')](respondWithResult(_0x569959,null))['catch'](handleError(_0x569959,null));};exports[_0xd187('0x78')]=function(_0x520f86,_0x5cbfa6,_0x304117){return db['Campaign'][_0xd187('0x46')]({'where':{'id':_0x520f86[_0xd187('0x43')]['id']}})[_0xd187('0x3f')](handleEntityNotFound(_0x5cbfa6,null))[_0xd187('0x3f')](function(_0x1b93db){var _0x13a362;if(_0x1b93db){_0x13a362=squel[_0xd187('0x79')]()[_0xd187('0x7a')](_0xd187('0x73'))[_0xd187('0x5f')]([_0xd187('0x60'),_0xd187('0x61'),_0xd187('0x62'),_0xd187('0x63'),_0xd187('0x7b'),'createdAt',_0xd187('0x66')],squel[_0xd187('0x71')]()[_0xd187('0x67')](_0xd187('0x68'),'phone')[_0xd187('0x67')](_0xd187('0x69'),'scheduledAt')['field'](_0xd187('0x6a'),_0xd187('0x62'))[_0xd187('0x67')](_0xd187('0x6b'),_0xd187('0x63'))[_0xd187('0x67')]('ANY_VALUE(CampaignId)',_0xd187('0x7b'))[_0xd187('0x67')]('NOW()',_0xd187('0x65'))[_0xd187('0x67')](_0xd187('0x69'),_0xd187('0x66'))['from']('cm_hopper_final')[_0xd187('0x39')](_0xd187('0x7c'),_0x520f86[_0xd187('0x43')]['id']['toString']())[_0xd187('0x39')](_0xd187('0x6f'),_0x520f86[_0xd187('0x48')][_0xd187('0x7d')]['toString']())[_0xd187('0x39')]('calleridnum\x20IS\x20NOT\x20NULL')['where']('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()['field']('phone')['from'](_0xd187('0x73'))[_0xd187('0x39')]('CampaignId\x20=\x20?',_0x520f86[_0xd187('0x43')]['id'][_0xd187('0x6e')]()))[_0xd187('0x39')](_0xd187('0x70'),squel[_0xd187('0x71')]()['field'](_0xd187('0x74'))['from'](_0xd187('0x75'))[_0xd187('0x39')](_0xd187('0x7c'),_0x520f86[_0xd187('0x43')]['id'][_0xd187('0x6e')]())[_0xd187('0x39')](_0xd187('0x76')))['group'](_0xd187('0x62')))[_0xd187('0x6e')]();return db['sequelize'][_0xd187('0x31')](_0x13a362);}return[];})[_0xd187('0x3f')](respondWithResult(_0x5cbfa6,null))['catch'](handleError(_0x5cbfa6,null));};exports[_0xd187('0x7e')]=function(_0x3bd1d8,_0x224312,_0x45b522){return db[_0xd187('0x7f')][_0xd187('0x80')]({'where':{'VoiceQueueId':_0x3bd1d8[_0xd187('0x48')][_0xd187('0x64')],'CampaignId':_0x3bd1d8['body'][_0xd187('0x7b')],'ContactId':_0x3bd1d8[_0xd187('0x48')][_0xd187('0x62')]}})[_0xd187('0x3f')](handleEntityNotFound(_0x224312,null))[_0xd187('0x3f')](function(_0x400a9){if(_0x400a9){return _0x400a9;}return null;})['then'](respondWithResult(_0x224312,null))['catch'](handleError(_0x224312,null));}; \ No newline at end of file +var _0x7880=['index','CmHopperFinal','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','show','params','keys','options','find','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','`state`\x20=\x200,\x201,\x20null','noSuchContacts','COUNT','noAnswerContacts','literal','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x2022,\x201,\x20null','reCallContacts','moveContactsQueueCampaignHopperFinal','insert','into','cm_hopper','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','where','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','phone','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','fromQuery','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','checkContactHopper','CmHopper','findOne','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','limit','set','json','apply','reject','save','update','then','destroy','error','stack','name','send'];(function(_0x31710d,_0x255445){var _0x31659b=function(_0x4a67dd){while(--_0x4a67dd){_0x31710d['push'](_0x31710d['shift']());}};_0x31659b(++_0x255445);}(_0x7880,0x1f4));var _0x0788=function(_0x495f0b,_0x499f83){_0x495f0b=_0x495f0b-0x0;var _0xef44be=_0x7880[_0x495f0b];return _0xef44be;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0788('0x0'));var zipdir=require(_0x0788('0x1'));var jsonpatch=require(_0x0788('0x2'));var rp=require(_0x0788('0x3'));var moment=require(_0x0788('0x4'));var BPromise=require(_0x0788('0x5'));var Mustache=require('mustache');var util=require(_0x0788('0x6'));var path=require(_0x0788('0x7'));var sox=require(_0x0788('0x8'));var csv=require(_0x0788('0x9'));var ejs=require(_0x0788('0xa'));var fs=require('fs');var fs_extra=require(_0x0788('0xb'));var _=require(_0x0788('0xc'));var squel=require(_0x0788('0xd'));var crypto=require(_0x0788('0xe'));var jsforce=require(_0x0788('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x0788('0x9'));var querystring=require('querystring');var Papa=require(_0x0788('0x10'));var Redis=require('ioredis');var authService=require(_0x0788('0x11'));var qs=require(_0x0788('0x12'));var as=require(_0x0788('0x13'));var hardwareService=require(_0x0788('0x14'));var logger=require(_0x0788('0x15'))('api');var utils=require(_0x0788('0x16'));var config=require(_0x0788('0x17'));var licenseUtil=require(_0x0788('0x18'));var db=require(_0x0788('0x19'))['db'];function respondWithStatusCode(_0x311729,_0xce4342){_0xce4342=_0xce4342||0xcc;return function(_0x261ebc){if(_0x261ebc){return _0x311729['sendStatus'](_0xce4342);}return _0x311729[_0x0788('0x1a')](_0xce4342)[_0x0788('0x1b')]();};}function respondWithResult(_0x3bdcdf,_0x13cf07){_0x13cf07=_0x13cf07||0xc8;return function(_0x51e5d3){if(_0x51e5d3){return _0x3bdcdf[_0x0788('0x1a')](_0x13cf07)['json'](_0x51e5d3);}};}function respondWithFilteredResult(_0x195f14,_0x170d56){return function(_0x3fd1e4){if(_0x3fd1e4){var _0xb406fb=typeof _0x170d56[_0x0788('0x1c')]===_0x0788('0x1d')&&typeof _0x170d56['limit']==='undefined';var _0x17d805=_0x3fd1e4[_0x0788('0x1e')];var _0x5b2bdc=_0xb406fb?0x0:_0x170d56[_0x0788('0x1c')];var _0x415f19=_0xb406fb?_0x3fd1e4[_0x0788('0x1e')]:_0x170d56['offset']+_0x170d56[_0x0788('0x1f')];var _0x3fb723;if(_0x415f19>=_0x17d805){_0x415f19=_0x17d805;_0x3fb723=0xc8;}else{_0x3fb723=0xce;}_0x195f14['status'](_0x3fb723);return _0x195f14[_0x0788('0x20')]('Content-Range',_0x5b2bdc+'-'+_0x415f19+'/'+_0x17d805)[_0x0788('0x21')](_0x3fd1e4);}return null;};}function patchUpdates(_0x48bc5f){return function(_0x17cca3){try{jsonpatch[_0x0788('0x22')](_0x17cca3,_0x48bc5f,!![]);}catch(_0x18ff22){return BPromise[_0x0788('0x23')](_0x18ff22);}return _0x17cca3[_0x0788('0x24')]();};}function saveUpdates(_0x4f0005,_0x48ec43){return function(_0x2270d4){if(_0x2270d4){return _0x2270d4[_0x0788('0x25')](_0x4f0005)[_0x0788('0x26')](function(_0x7a99a1){return _0x7a99a1;});}return null;};}function removeEntity(_0x5ba1da,_0x4d5c93){return function(_0x79204e){if(_0x79204e){return _0x79204e[_0x0788('0x27')]()[_0x0788('0x26')](function(){_0x5ba1da['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x240459,_0xa1f7dc){return function(_0x5f2dda){if(!_0x5f2dda){_0x240459['sendStatus'](0x194);}return _0x5f2dda;};}function handleError(_0x5a54a5,_0x44798c){_0x44798c=_0x44798c||0x1f4;return function(_0x57fda1){logger[_0x0788('0x28')](_0x57fda1[_0x0788('0x29')]);if(_0x57fda1[_0x0788('0x2a')]){delete _0x57fda1[_0x0788('0x2a')];}_0x5a54a5[_0x0788('0x1a')](_0x44798c)[_0x0788('0x2b')](_0x57fda1);};}exports[_0x0788('0x2c')]=function(_0x3ffe4f,_0x5b7594){var _0x5a5178={},_0x3c5246={},_0x40d345={'count':0x0,'rows':[]};var _0x54979a=_['map'](db[_0x0788('0x2d')][_0x0788('0x2e')],function(_0x20fcd8){return{'name':_0x20fcd8[_0x0788('0x2f')],'type':_0x20fcd8[_0x0788('0x30')][_0x0788('0x31')]};});_0x3c5246[_0x0788('0x32')]=_[_0x0788('0x33')](_0x54979a,_0x0788('0x2a'));_0x3c5246[_0x0788('0x34')]=_['keys'](_0x3ffe4f[_0x0788('0x34')]);_0x3c5246[_0x0788('0x35')]=_[_0x0788('0x36')](_0x3c5246[_0x0788('0x32')],_0x3c5246[_0x0788('0x34')]);_0x5a5178[_0x0788('0x37')]=_[_0x0788('0x36')](_0x3c5246[_0x0788('0x32')],qs[_0x0788('0x38')](_0x3ffe4f[_0x0788('0x34')]['fields']));_0x5a5178['attributes']=_0x5a5178['attributes']['length']?_0x5a5178['attributes']:_0x3c5246['model'];if(!_0x3ffe4f[_0x0788('0x34')][_0x0788('0x39')](_0x0788('0x3a'))){_0x5a5178['limit']=qs[_0x0788('0x1f')](_0x3ffe4f[_0x0788('0x34')][_0x0788('0x1f')]);_0x5a5178[_0x0788('0x1c')]=qs['offset'](_0x3ffe4f[_0x0788('0x34')]['offset']);}_0x5a5178[_0x0788('0x3b')]=qs['sort'](_0x3ffe4f[_0x0788('0x34')][_0x0788('0x3c')]);_0x5a5178['where']=qs[_0x0788('0x35')](_[_0x0788('0x3d')](_0x3ffe4f['query'],_0x3c5246[_0x0788('0x35')]),_0x54979a);if(_0x3ffe4f['query'][_0x0788('0x3e')]){_0x5a5178['where']=_[_0x0788('0x3f')](_0x5a5178['where'],{'$or':_[_0x0788('0x33')](_0x54979a,function(_0x57fec9){if(_0x57fec9['type']!==_0x0788('0x40')){var _0x68d9d4={};_0x68d9d4[_0x57fec9[_0x0788('0x2a')]]={'$like':'%'+_0x3ffe4f[_0x0788('0x34')][_0x0788('0x3e')]+'%'};return _0x68d9d4;}})});}_0x5a5178=_['merge']({},_0x5a5178,_0x3ffe4f['options']);var _0x530d83={'where':_0x5a5178['where']};return db[_0x0788('0x2d')][_0x0788('0x1e')](_0x530d83)[_0x0788('0x26')](function(_0x358a22){_0x40d345[_0x0788('0x1e')]=_0x358a22;if(_0x3ffe4f['query']['includeAll']){_0x5a5178[_0x0788('0x41')]=[{'all':!![]}];}return db[_0x0788('0x2d')][_0x0788('0x42')](_0x5a5178);})[_0x0788('0x26')](function(_0x236b63){_0x40d345[_0x0788('0x43')]=_0x236b63;return _0x40d345;})[_0x0788('0x26')](respondWithFilteredResult(_0x5b7594,_0x5a5178))[_0x0788('0x44')](handleError(_0x5b7594,null));};exports[_0x0788('0x45')]=function(_0x50e8f5,_0x5581e6){var _0x441aec={'raw':!![],'where':{'id':_0x50e8f5[_0x0788('0x46')]['id']}},_0x1d579d={};_0x1d579d['model']=_['keys'](db['CmHopperFinal'][_0x0788('0x2e')]);_0x1d579d[_0x0788('0x34')]=_[_0x0788('0x47')](_0x50e8f5[_0x0788('0x34')]);_0x1d579d[_0x0788('0x35')]=_[_0x0788('0x36')](_0x1d579d[_0x0788('0x32')],_0x1d579d[_0x0788('0x34')]);_0x441aec['attributes']=_[_0x0788('0x36')](_0x1d579d[_0x0788('0x32')],qs[_0x0788('0x38')](_0x50e8f5[_0x0788('0x34')]['fields']));_0x441aec[_0x0788('0x37')]=_0x441aec[_0x0788('0x37')]['length']?_0x441aec['attributes']:_0x1d579d['model'];if(_0x50e8f5[_0x0788('0x34')]['includeAll']){_0x441aec[_0x0788('0x41')]=[{'all':!![]}];}_0x441aec=_[_0x0788('0x3f')]({},_0x441aec,_0x50e8f5[_0x0788('0x48')]);return db[_0x0788('0x2d')][_0x0788('0x49')](_0x441aec)[_0x0788('0x26')](handleEntityNotFound(_0x5581e6,null))[_0x0788('0x26')](respondWithResult(_0x5581e6,null))[_0x0788('0x44')](handleError(_0x5581e6,null));};exports['describe']=function(_0x4c6366,_0x39c3cc){return db[_0x0788('0x2d')][_0x0788('0x4a')]()['then'](respondWithResult(_0x39c3cc,null))[_0x0788('0x44')](handleError(_0x39c3cc,null));};exports[_0x0788('0x25')]=function(_0x19aad6,_0x4563cd){if(_0x19aad6[_0x0788('0x4b')]['uniqueid']){delete _0x19aad6['body'][_0x0788('0x4c')];}return db[_0x0788('0x2d')]['find']({'where':{'uniqueid':_0x19aad6[_0x0788('0x46')]['id']}})['then'](handleEntityNotFound(_0x4563cd,null))[_0x0788('0x26')](saveUpdates(_0x19aad6[_0x0788('0x4b')],null))[_0x0788('0x26')](respondWithResult(_0x4563cd,null))[_0x0788('0x44')](handleError(_0x4563cd,null));};exports[_0x0788('0x4d')]=function(_0x379928,_0x1722d4,_0x25ac3c){return db['CmHopperFinal'][_0x0788('0x42')]({'raw':![],'where':{'VoiceQueueId':_0x379928[_0x0788('0x46')]['id']},'attributes':[[db[_0x0788('0x4e')]['fn']('COUNT',db[_0x0788('0x4e')]['fn']('IF',db[_0x0788('0x4e')]['literal'](_0x0788('0x4f')))),_0x0788('0x50')],[db[_0x0788('0x4e')]['fn'](_0x0788('0x51'),db[_0x0788('0x4e')]['fn']('IF',db[_0x0788('0x4e')]['literal']('`state`\x20=\x203,\x201,\x20null'))),_0x0788('0x52')],[db[_0x0788('0x4e')]['fn']('COUNT',db[_0x0788('0x4e')]['fn']('IF',db[_0x0788('0x4e')][_0x0788('0x53')](_0x0788('0x54')))),_0x0788('0x55')],[db[_0x0788('0x4e')]['fn'](_0x0788('0x51'),db[_0x0788('0x4e')]['fn']('IF',db[_0x0788('0x4e')][_0x0788('0x53')](_0x0788('0x56')))),_0x0788('0x57')],[db['sequelize']['fn'](_0x0788('0x51'),db[_0x0788('0x4e')]['fn']('IF',db[_0x0788('0x4e')]['literal'](_0x0788('0x58')))),_0x0788('0x59')],[db['sequelize']['fn']('COUNT',db[_0x0788('0x4e')]['fn']('IF',db[_0x0788('0x4e')][_0x0788('0x53')](_0x0788('0x5a')))),_0x0788('0x5b')],[db[_0x0788('0x4e')]['fn']('COUNT',db[_0x0788('0x4e')]['fn']('IF',db[_0x0788('0x4e')][_0x0788('0x53')]('`state`\x20=\x2022,\x201,\x20null'))),'reCallContacts'],[db[_0x0788('0x4e')]['fn']('COUNT',db[_0x0788('0x4e')]['fn']('IF',db[_0x0788('0x4e')][_0x0788('0x53')](_0x0788('0x5c')))),_0x0788('0x5d')]]})[_0x0788('0x26')](handleEntityNotFound(_0x1722d4,null))[_0x0788('0x26')](respondWithResult(_0x1722d4,null))[_0x0788('0x44')](handleError(_0x1722d4,null));};exports[_0x0788('0x5e')]=function(_0x2a8b14,_0x59fcbc,_0xe1a934){return db[_0x0788('0x2d')][_0x0788('0x42')]({'raw':![],'where':{'CampaignId':_0x2a8b14[_0x0788('0x46')]['id']},'attributes':[[db['sequelize']['fn'](_0x0788('0x51'),db[_0x0788('0x4e')]['fn']('IF',db[_0x0788('0x4e')][_0x0788('0x53')](_0x0788('0x4f')))),'noSuchContacts'],[db[_0x0788('0x4e')]['fn']('COUNT',db[_0x0788('0x4e')]['fn']('IF',db[_0x0788('0x4e')][_0x0788('0x53')](_0x0788('0x5f')))),_0x0788('0x52')],[db[_0x0788('0x4e')]['fn'](_0x0788('0x51'),db[_0x0788('0x4e')]['fn']('IF',db[_0x0788('0x4e')]['literal'](_0x0788('0x54')))),_0x0788('0x55')],[db[_0x0788('0x4e')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x0788('0x4e')][_0x0788('0x53')](_0x0788('0x56')))),'congestionContacts'],[db[_0x0788('0x4e')]['fn'](_0x0788('0x51'),db[_0x0788('0x4e')]['fn']('IF',db[_0x0788('0x4e')]['literal']('`state`\x20=\x2010\x20,\x201,\x20null'))),'dropContacts'],[db[_0x0788('0x4e')]['fn'](_0x0788('0x51'),db[_0x0788('0x4e')]['fn']('IF',db['sequelize']['literal'](_0x0788('0x5a')))),'abandonedContacts'],[db[_0x0788('0x4e')]['fn'](_0x0788('0x51'),db[_0x0788('0x4e')]['fn']('IF',db[_0x0788('0x4e')][_0x0788('0x53')](_0x0788('0x60')))),_0x0788('0x61')],[db[_0x0788('0x4e')]['fn'](_0x0788('0x51'),db[_0x0788('0x4e')]['fn']('IF',db['sequelize'][_0x0788('0x53')](_0x0788('0x5c')))),'answeringMachine']]})['then'](handleEntityNotFound(_0x59fcbc,null))[_0x0788('0x26')](respondWithResult(_0x59fcbc,null))[_0x0788('0x44')](handleError(_0x59fcbc,null));};exports[_0x0788('0x62')]=function(_0x219252,_0x3628d6,_0x192798){return db['VoiceQueue'][_0x0788('0x49')]({'where':{'id':_0x219252[_0x0788('0x46')]['id']}})[_0x0788('0x26')](handleEntityNotFound(_0x3628d6,null))[_0x0788('0x26')](function(_0x4e0282){var _0x35c612;if(_0x4e0282){_0x35c612=squel[_0x0788('0x63')]()[_0x0788('0x64')](_0x0788('0x65'))['fromQuery'](['phone',_0x0788('0x66'),_0x0788('0x67'),_0x0788('0x68'),_0x0788('0x69'),_0x0788('0x6a'),_0x0788('0x6b')],squel[_0x0788('0x6c')]()[_0x0788('0x6d')](_0x0788('0x6e'),'phone')[_0x0788('0x6d')](_0x0788('0x6f'),_0x0788('0x66'))['field']('ANY_VALUE(ContactId)',_0x0788('0x67'))['field'](_0x0788('0x70'),_0x0788('0x68'))[_0x0788('0x6d')](_0x0788('0x71'),_0x0788('0x69'))[_0x0788('0x6d')](_0x0788('0x6f'),_0x0788('0x6a'))[_0x0788('0x6d')]('NOW()',_0x0788('0x6b'))[_0x0788('0x72')](_0x0788('0x73'))['where'](_0x0788('0x74'),_0x219252[_0x0788('0x46')]['id'][_0x0788('0x75')]())['where'](_0x0788('0x76'),_0x219252[_0x0788('0x4b')][_0x0788('0x77')][_0x0788('0x75')]())[_0x0788('0x78')](_0x0788('0x79'))[_0x0788('0x78')](_0x0788('0x7a'),squel[_0x0788('0x6c')]()['field'](_0x0788('0x7b'))[_0x0788('0x72')](_0x0788('0x65'))[_0x0788('0x78')](_0x0788('0x74'),_0x219252['params']['id'][_0x0788('0x75')]()))[_0x0788('0x78')](_0x0788('0x7a'),squel['select']()[_0x0788('0x6d')](_0x0788('0x7c'))[_0x0788('0x72')](_0x0788('0x73'))[_0x0788('0x78')]('VoiceQueueId\x20=\x20?',_0x219252[_0x0788('0x46')]['id'][_0x0788('0x75')]())['where'](_0x0788('0x7d')))[_0x0788('0x7e')]('ContactId'))[_0x0788('0x75')]();return db[_0x0788('0x4e')][_0x0788('0x34')](_0x35c612);}return[];})['then'](respondWithResult(_0x3628d6,null))[_0x0788('0x44')](handleError(_0x3628d6,null));};exports[_0x0788('0x7f')]=function(_0xbb5b1d,_0x53730a,_0xddfb97){return db[_0x0788('0x80')][_0x0788('0x49')]({'where':{'id':_0xbb5b1d[_0x0788('0x46')]['id']}})[_0x0788('0x26')](handleEntityNotFound(_0x53730a,null))[_0x0788('0x26')](function(_0x2545a7){var _0x174931;if(_0x2545a7){_0x174931=squel['insert']()[_0x0788('0x64')](_0x0788('0x65'))[_0x0788('0x81')]([_0x0788('0x7b'),'scheduledAt','ContactId',_0x0788('0x68'),_0x0788('0x82'),'createdAt',_0x0788('0x6b')],squel[_0x0788('0x6c')]()[_0x0788('0x6d')]('ANY_VALUE(calleridnum)','phone')[_0x0788('0x6d')](_0x0788('0x6f'),'scheduledAt')['field']('ANY_VALUE(ContactId)',_0x0788('0x67'))[_0x0788('0x6d')]('ANY_VALUE(ListId)',_0x0788('0x68'))[_0x0788('0x6d')](_0x0788('0x83'),_0x0788('0x82'))[_0x0788('0x6d')]('NOW()',_0x0788('0x6a'))['field'](_0x0788('0x6f'),'updatedAt')[_0x0788('0x72')](_0x0788('0x73'))[_0x0788('0x78')](_0x0788('0x84'),_0xbb5b1d[_0x0788('0x46')]['id'][_0x0788('0x75')]())[_0x0788('0x78')](_0x0788('0x76'),_0xbb5b1d[_0x0788('0x4b')][_0x0788('0x77')][_0x0788('0x75')]())[_0x0788('0x78')](_0x0788('0x79'))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()[_0x0788('0x6d')](_0x0788('0x7b'))[_0x0788('0x72')](_0x0788('0x65'))[_0x0788('0x78')](_0x0788('0x84'),_0xbb5b1d[_0x0788('0x46')]['id'][_0x0788('0x75')]()))[_0x0788('0x78')](_0x0788('0x7a'),squel[_0x0788('0x6c')]()['field']('calleridnum')[_0x0788('0x72')](_0x0788('0x73'))[_0x0788('0x78')](_0x0788('0x84'),_0xbb5b1d[_0x0788('0x46')]['id'][_0x0788('0x75')]())[_0x0788('0x78')](_0x0788('0x7d')))['group']('ContactId'))[_0x0788('0x75')]();return db[_0x0788('0x4e')][_0x0788('0x34')](_0x174931);}return[];})[_0x0788('0x26')](respondWithResult(_0x53730a,null))[_0x0788('0x44')](handleError(_0x53730a,null));};exports[_0x0788('0x85')]=function(_0x52dd97,_0x2f6851,_0x1311d7){return db[_0x0788('0x86')][_0x0788('0x87')]({'where':{'VoiceQueueId':_0x52dd97[_0x0788('0x4b')][_0x0788('0x69')],'CampaignId':_0x52dd97[_0x0788('0x4b')][_0x0788('0x82')],'ContactId':_0x52dd97[_0x0788('0x4b')]['ContactId']}})[_0x0788('0x26')](handleEntityNotFound(_0x2f6851,null))[_0x0788('0x26')](function(_0x178f52){if(_0x178f52){return _0x178f52;}return null;})[_0x0788('0x26')](respondWithResult(_0x2f6851,null))[_0x0788('0x44')](handleError(_0x2f6851,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 90a6bda..ce749f3 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 _0x7ece=['cm_hopper_final','calleridnum','uniqueid','lodash','util','api','bluebird','request-promise','rimraf','exports','CmHopperFinal'];(function(_0x4f8c0d,_0x14c734){var _0x38d1a7=function(_0x1be12c){while(--_0x1be12c){_0x4f8c0d['push'](_0x4f8c0d['shift']());}};_0x38d1a7(++_0x14c734);}(_0x7ece,0xf5));var _0xe7ec=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x7ece[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0xe7ec('0x0'));var util=require(_0xe7ec('0x1'));var logger=require('../../config/logger')(_0xe7ec('0x2'));var moment=require('moment');var BPromise=require(_0xe7ec('0x3'));var rp=require(_0xe7ec('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe7ec('0x5'));var config=require('../../config/environment');var attributes=require('./cmHopperFinal.attributes');module[_0xe7ec('0x6')]=function(_0x5bca3f,_0x3e35bf){return _0x5bca3f['define'](_0xe7ec('0x7'),attributes,{'tableName':_0xe7ec('0x8'),'paranoid':![],'indexes':[{'name':_0xe7ec('0x9'),'fields':[_0xe7ec('0x9')]},{'name':_0xe7ec('0xa'),'fields':[_0xe7ec('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3985=['moment','bluebird','path','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util','api'];(function(_0x1bd9ed,_0xe52788){var _0x4e8fca=function(_0x4c272f){while(--_0x4c272f){_0x1bd9ed['push'](_0x1bd9ed['shift']());}};_0x4e8fca(++_0xe52788);}(_0x3985,0x123));var _0x5398=function(_0x104cbb,_0x1408c8){_0x104cbb=_0x104cbb-0x0;var _0x28340e=_0x3985[_0x104cbb];return _0x28340e;};'use strict';var _=require(_0x5398('0x0'));var util=require(_0x5398('0x1'));var logger=require('../../config/logger')(_0x5398('0x2'));var moment=require(_0x5398('0x3'));var BPromise=require(_0x5398('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5398('0x5'));var rimraf=require(_0x5398('0x6'));var config=require(_0x5398('0x7'));var attributes=require(_0x5398('0x8'));module[_0x5398('0x9')]=function(_0x3547e3,_0x284849){return _0x3547e3['define'](_0x5398('0xa'),attributes,{'tableName':_0x5398('0xb'),'paranoid':![],'indexes':[{'name':'calleridnum','fields':[_0x5398('0xc')]},{'name':_0x5398('0xd'),'fields':[_0x5398('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index dd10c09..5270d46 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.rpc.js +++ b/server/api/cmHopperFinal/cmHopperFinal.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x542588,_0x4305c9){var _0xf24784=function(_0x13ea9d){while(--_0x13ea9d){_0x542588['push'](_0x542588['shift']());}};_0xf24784(++_0x4305c9);}(_0xb10b,0x12a));var _0xbb10=function(_0x5d07bb,_0x271464){_0x5d07bb=_0x5d07bb-0x0;var _0x42960a=_0xb10b[_0x5d07bb];return _0x42960a;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x5a5813,_0xd0c874){var _0x3a7a10=function(_0x3f6cc7){while(--_0x3f6cc7){_0x5a5813['push'](_0x5a5813['shift']());}};_0x3a7a10(++_0xd0c874);}(_0x7a54,0x106));var _0x47a5=function(_0x9f93c4,_0x349e90){_0x9f93c4=_0x9f93c4-0x0;var _0x2f4cd6=_0x7a54[_0x9f93c4];return _0x2f4cd6;};'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 4a97ca7..08abc45 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 _0x68a1=['./cmHopperFinal.controller','get','index','/describe','describe','/:id','isAuthenticated','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','update','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x103327,_0x48624a){var _0x445e50=function(_0x209da6){while(--_0x209da6){_0x103327['push'](_0x103327['shift']());}};_0x445e50(++_0x48624a);}(_0x68a1,0x89));var _0x168a=function(_0x27c0b9,_0x417555){_0x27c0b9=_0x27c0b9-0x0;var _0x3f0c06=_0x68a1[_0x27c0b9];return _0x3f0c06;};'use strict';var multer=require(_0x168a('0x0'));var util=require(_0x168a('0x1'));var path=require(_0x168a('0x2'));var timeout=require(_0x168a('0x3'));var express=require('express');var router=express[_0x168a('0x4')]();var fs_extra=require(_0x168a('0x5'));var auth=require(_0x168a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x168a('0x7'));var controller=require(_0x168a('0x8'));router[_0x168a('0x9')]('/',auth['isAuthenticated'](),controller[_0x168a('0xa')]);router[_0x168a('0x9')](_0x168a('0xb'),auth['isAuthenticated'](),controller[_0x168a('0xc')]);router[_0x168a('0x9')](_0x168a('0xd'),auth[_0x168a('0xe')](),controller[_0x168a('0xf')]);router[_0x168a('0x9')](_0x168a('0x10'),auth[_0x168a('0xe')](),controller[_0x168a('0x11')]);router[_0x168a('0x9')](_0x168a('0x12'),auth[_0x168a('0xe')](),controller[_0x168a('0x13')]);router[_0x168a('0x14')](_0x168a('0x15'),auth[_0x168a('0xe')](),controller[_0x168a('0x16')]);router[_0x168a('0x14')](_0x168a('0x17'),auth[_0x168a('0xe')](),controller[_0x168a('0x18')]);router['post'](_0x168a('0x19'),auth['isAuthenticated'](),controller[_0x168a('0x1a')]);router[_0x168a('0x1b')](_0x168a('0xd'),auth['isAuthenticated'](),controller[_0x168a('0x1c')]);module['exports']=router; \ No newline at end of file +var _0xdca2=['multer','path','express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','describe','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','/:id','exports'];(function(_0x50d793,_0x1870f9){var _0x18f64e=function(_0x1d2d80){while(--_0x1d2d80){_0x50d793['push'](_0x50d793['shift']());}};_0x18f64e(++_0x1870f9);}(_0xdca2,0xfd));var _0x2dca=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0xdca2[_0x82129b];return _0x2ae5dc;};'use strict';var multer=require(_0x2dca('0x0'));var util=require('util');var path=require(_0x2dca('0x1'));var timeout=require('connect-timeout');var express=require(_0x2dca('0x2'));var router=express['Router']();var fs_extra=require(_0x2dca('0x3'));var auth=require(_0x2dca('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x2dca('0x5'));var controller=require('./cmHopperFinal.controller');router[_0x2dca('0x6')]('/',auth[_0x2dca('0x7')](),controller['index']);router['get'](_0x2dca('0x8'),auth['isAuthenticated'](),controller[_0x2dca('0x9')]);router['get']('/:id',auth[_0x2dca('0x7')](),controller[_0x2dca('0xa')]);router[_0x2dca('0x6')](_0x2dca('0xb'),auth['isAuthenticated'](),controller[_0x2dca('0xc')]);router['get'](_0x2dca('0xd'),auth[_0x2dca('0x7')](),controller[_0x2dca('0xe')]);router[_0x2dca('0xf')]('/voice/queue/moveContacts/:id',auth['isAuthenticated'](),controller[_0x2dca('0x10')]);router[_0x2dca('0xf')](_0x2dca('0x11'),auth[_0x2dca('0x7')](),controller[_0x2dca('0x12')]);router['post'](_0x2dca('0x13'),auth[_0x2dca('0x7')](),controller[_0x2dca('0x14')]);router['put'](_0x2dca('0x15'),auth['isAuthenticated'](),controller['update']);module[_0x2dca('0x16')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 0a5f2ea..61d0e82 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 _0x1ff1=['BOOLEAN','sequelize','exports','STRING','DATE','INTEGER'];(function(_0x5177c5,_0x2b3d33){var _0x4783d6=function(_0x2455ee){while(--_0x2455ee){_0x5177c5['push'](_0x5177c5['shift']());}};_0x4783d6(++_0x2b3d33);}(_0x1ff1,0x139));var _0x11ff=function(_0x4bd3f3,_0xe87cb4){_0x4bd3f3=_0x4bd3f3-0x0;var _0x51e4f6=_0x1ff1[_0x4bd3f3];return _0x51e4f6;};'use strict';var Sequelize=require(_0x11ff('0x0'));module[_0x11ff('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x11ff('0x2')]},'scheduledat':{'type':Sequelize[_0x11ff('0x3')]},'countbusyretry':{'type':Sequelize[_0x11ff('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x11ff('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x11ff('0x4')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x11ff('0x4')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x11ff('0x2')]},'originatecalleridnum':{'type':Sequelize[_0x11ff('0x2')]},'originatecalleridname':{'type':Sequelize[_0x11ff('0x2')]},'calleridnum':{'type':Sequelize[_0x11ff('0x2')]},'calleridname':{'type':Sequelize[_0x11ff('0x2')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x11ff('0x3')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x11ff('0x3')]},'endtime':{'type':Sequelize[_0x11ff('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x11ff('0x4')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x11ff('0x2')]},'campaigntype':{'type':Sequelize[_0x11ff('0x2')]},'membername':{'type':Sequelize[_0x11ff('0x2')]},'reason':{'type':Sequelize[_0x11ff('0x2')]},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x11ff('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x11ff('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x11ff('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x11ff('0x3')]},'recallme':{'type':Sequelize[_0x11ff('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x11ff('0x3')]},'edited':{'type':Sequelize[_0x11ff('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x11ff('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x11ff('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x11ff('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x11ff('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa24d=['INTEGER','STRING','DATE','BOOLEAN','sequelize','exports'];(function(_0xbbf444,_0x1cc38a){var _0x4f2506=function(_0x248bd9){while(--_0x248bd9){_0xbbf444['push'](_0xbbf444['shift']());}};_0x4f2506(++_0x1cc38a);}(_0xa24d,0x17e));var _0xda24=function(_0x506a86,_0x41e1c9){_0x506a86=_0x506a86-0x0;var _0x5e1960=_0xa24d[_0x506a86];return _0x5e1960;};'use strict';var Sequelize=require(_0xda24('0x0'));module[_0xda24('0x1')]={'state':{'type':Sequelize[_0xda24('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xda24('0x3')]},'scheduledat':{'type':Sequelize[_0xda24('0x4')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xda24('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xda24('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xda24('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xda24('0x3')]},'originatecalleridnum':{'type':Sequelize[_0xda24('0x3')]},'originatecalleridname':{'type':Sequelize[_0xda24('0x3')]},'calleridnum':{'type':Sequelize[_0xda24('0x3')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xda24('0x4')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0xda24('0x4')]},'endtime':{'type':Sequelize[_0xda24('0x4')]},'ringtime':{'type':Sequelize[_0xda24('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xda24('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xda24('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xda24('0x3')]},'campaign':{'type':Sequelize[_0xda24('0x3')]},'campaigntype':{'type':Sequelize[_0xda24('0x3')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0xda24('0x3')]},'amd':{'type':Sequelize[_0xda24('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0xda24('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0xda24('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xda24('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xda24('0x4')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize[_0xda24('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xda24('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xda24('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xda24('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xda24('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index f0dc4b6..679c8b9 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 _0x57e8=['destroy','error','name','index','rawAttributes','fieldName','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','CmHopperHistory','findAll','rows','catch','show','params','find','update','body','uniqueid','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','then'];(function(_0x341cce,_0x284b0e){var _0x3bd24=function(_0x3c10ee){while(--_0x3c10ee){_0x341cce['push'](_0x341cce['shift']());}};_0x3bd24(++_0x284b0e);}(_0x57e8,0x1dc));var _0x857e=function(_0x4d6e14,_0x265a89){_0x4d6e14=_0x4d6e14-0x0;var _0x15468a=_0x57e8[_0x4d6e14];return _0x15468a;};'use strict';var emlformat=require(_0x857e('0x0'));var rimraf=require(_0x857e('0x1'));var zipdir=require(_0x857e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x857e('0x3'));var moment=require(_0x857e('0x4'));var BPromise=require(_0x857e('0x5'));var Mustache=require('mustache');var util=require(_0x857e('0x6'));var path=require(_0x857e('0x7'));var sox=require(_0x857e('0x8'));var csv=require(_0x857e('0x9'));var ejs=require(_0x857e('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x857e('0xb'));var crypto=require(_0x857e('0xc'));var jsforce=require(_0x857e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x857e('0x9'));var querystring=require('querystring');var Papa=require(_0x857e('0xe'));var Redis=require(_0x857e('0xf'));var authService=require(_0x857e('0x10'));var qs=require(_0x857e('0x11'));var as=require(_0x857e('0x12'));var hardwareService=require(_0x857e('0x13'));var logger=require(_0x857e('0x14'))('api');var utils=require(_0x857e('0x15'));var config=require(_0x857e('0x16'));var licenseUtil=require(_0x857e('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5b553d,_0x1725ff){_0x1725ff=_0x1725ff||0xcc;return function(_0x24e253){if(_0x24e253){return _0x5b553d[_0x857e('0x18')](_0x1725ff);}return _0x5b553d[_0x857e('0x19')](_0x1725ff)[_0x857e('0x1a')]();};}function respondWithResult(_0x48e2ad,_0x3bcb5f){_0x3bcb5f=_0x3bcb5f||0xc8;return function(_0x10b53e){if(_0x10b53e){return _0x48e2ad['status'](_0x3bcb5f)['json'](_0x10b53e);}};}function respondWithFilteredResult(_0x4480be,_0x3c18c9){return function(_0x2b242d){if(_0x2b242d){var _0x7ee851=typeof _0x3c18c9[_0x857e('0x1b')]===_0x857e('0x1c')&&typeof _0x3c18c9[_0x857e('0x1d')]==='undefined';var _0x13572b=_0x2b242d[_0x857e('0x1e')];var _0x1036bf=_0x7ee851?0x0:_0x3c18c9[_0x857e('0x1b')];var _0x282b79=_0x7ee851?_0x2b242d[_0x857e('0x1e')]:_0x3c18c9[_0x857e('0x1b')]+_0x3c18c9[_0x857e('0x1d')];var _0x3c8fcf;if(_0x282b79>=_0x13572b){_0x282b79=_0x13572b;_0x3c8fcf=0xc8;}else{_0x3c8fcf=0xce;}_0x4480be['status'](_0x3c8fcf);return _0x4480be[_0x857e('0x1f')](_0x857e('0x20'),_0x1036bf+'-'+_0x282b79+'/'+_0x13572b)['json'](_0x2b242d);}return null;};}function patchUpdates(_0xaedc5a){return function(_0x3e0552){try{jsonpatch[_0x857e('0x21')](_0x3e0552,_0xaedc5a,!![]);}catch(_0x27b109){return BPromise['reject'](_0x27b109);}return _0x3e0552['save']();};}function saveUpdates(_0x1b215c,_0x309d00){return function(_0x44256f){if(_0x44256f){return _0x44256f['update'](_0x1b215c)[_0x857e('0x22')](function(_0x163725){return _0x163725;});}return null;};}function removeEntity(_0x7e9a7e,_0x450714){return function(_0x25f36d){if(_0x25f36d){return _0x25f36d[_0x857e('0x23')]()['then'](function(){_0x7e9a7e[_0x857e('0x19')](0xcc)[_0x857e('0x1a')]();});}};}function handleEntityNotFound(_0x351325,_0x3240c4){return function(_0x5a75d2){if(!_0x5a75d2){_0x351325[_0x857e('0x18')](0x194);}return _0x5a75d2;};}function handleError(_0x3b76f8,_0x49335b){_0x49335b=_0x49335b||0x1f4;return function(_0x3622ce){logger[_0x857e('0x24')](_0x3622ce['stack']);if(_0x3622ce[_0x857e('0x25')]){delete _0x3622ce[_0x857e('0x25')];}_0x3b76f8[_0x857e('0x19')](_0x49335b)['send'](_0x3622ce);};}exports[_0x857e('0x26')]=function(_0x542a0a,_0x1c07ab){var _0xecc9e4={},_0x238f9d={},_0x57d902={'count':0x0,'rows':[]};var _0x3be728=_['map'](db['CmHopperHistory'][_0x857e('0x27')],function(_0xb46f6a){return{'name':_0xb46f6a[_0x857e('0x28')],'type':_0xb46f6a['type'][_0x857e('0x29')]};});_0x238f9d[_0x857e('0x2a')]=_[_0x857e('0x2b')](_0x3be728,_0x857e('0x25'));_0x238f9d[_0x857e('0x2c')]=_[_0x857e('0x2d')](_0x542a0a[_0x857e('0x2c')]);_0x238f9d[_0x857e('0x2e')]=_['intersection'](_0x238f9d[_0x857e('0x2a')],_0x238f9d[_0x857e('0x2c')]);_0xecc9e4[_0x857e('0x2f')]=_[_0x857e('0x30')](_0x238f9d[_0x857e('0x2a')],qs['fields'](_0x542a0a[_0x857e('0x2c')][_0x857e('0x31')]));_0xecc9e4['attributes']=_0xecc9e4[_0x857e('0x2f')][_0x857e('0x32')]?_0xecc9e4['attributes']:_0x238f9d[_0x857e('0x2a')];if(!_0x542a0a[_0x857e('0x2c')][_0x857e('0x33')](_0x857e('0x34'))){_0xecc9e4[_0x857e('0x1d')]=qs[_0x857e('0x1d')](_0x542a0a['query'][_0x857e('0x1d')]);_0xecc9e4[_0x857e('0x1b')]=qs[_0x857e('0x1b')](_0x542a0a[_0x857e('0x2c')][_0x857e('0x1b')]);}_0xecc9e4[_0x857e('0x35')]=qs['sort'](_0x542a0a[_0x857e('0x2c')]['sort']);_0xecc9e4[_0x857e('0x36')]=qs[_0x857e('0x2e')](_[_0x857e('0x37')](_0x542a0a[_0x857e('0x2c')],_0x238f9d[_0x857e('0x2e')]),_0x3be728);if(_0x542a0a[_0x857e('0x2c')][_0x857e('0x38')]){_0xecc9e4[_0x857e('0x36')]=_['merge'](_0xecc9e4[_0x857e('0x36')],{'$or':_[_0x857e('0x2b')](_0x3be728,function(_0x431490){if(_0x431490[_0x857e('0x39')]!==_0x857e('0x3a')){var _0x225b37={};_0x225b37[_0x431490[_0x857e('0x25')]]={'$like':'%'+_0x542a0a[_0x857e('0x2c')][_0x857e('0x38')]+'%'};return _0x225b37;}})});}_0xecc9e4=_[_0x857e('0x3b')]({},_0xecc9e4,_0x542a0a[_0x857e('0x3c')]);var _0x3a2c9b={'where':_0xecc9e4[_0x857e('0x36')]};return db['CmHopperHistory'][_0x857e('0x1e')](_0x3a2c9b)['then'](function(_0x2f09df){_0x57d902['count']=_0x2f09df;if(_0x542a0a[_0x857e('0x2c')][_0x857e('0x3d')]){_0xecc9e4[_0x857e('0x3e')]=[{'all':!![]}];}return db[_0x857e('0x3f')][_0x857e('0x40')](_0xecc9e4);})[_0x857e('0x22')](function(_0x4de811){_0x57d902[_0x857e('0x41')]=_0x4de811;return _0x57d902;})[_0x857e('0x22')](respondWithFilteredResult(_0x1c07ab,_0xecc9e4))[_0x857e('0x42')](handleError(_0x1c07ab,null));};exports[_0x857e('0x43')]=function(_0x54a4be,_0x457848){var _0x353555={'raw':!![],'where':{'id':_0x54a4be[_0x857e('0x44')]['id']}},_0x582947={};_0x582947[_0x857e('0x2a')]=_['keys'](db['CmHopperHistory'][_0x857e('0x27')]);_0x582947['query']=_[_0x857e('0x2d')](_0x54a4be['query']);_0x582947[_0x857e('0x2e')]=_['intersection'](_0x582947[_0x857e('0x2a')],_0x582947[_0x857e('0x2c')]);_0x353555[_0x857e('0x2f')]=_[_0x857e('0x30')](_0x582947[_0x857e('0x2a')],qs[_0x857e('0x31')](_0x54a4be['query'][_0x857e('0x31')]));_0x353555[_0x857e('0x2f')]=_0x353555[_0x857e('0x2f')][_0x857e('0x32')]?_0x353555['attributes']:_0x582947[_0x857e('0x2a')];if(_0x54a4be[_0x857e('0x2c')][_0x857e('0x3d')]){_0x353555['include']=[{'all':!![]}];}_0x353555=_[_0x857e('0x3b')]({},_0x353555,_0x54a4be['options']);return db[_0x857e('0x3f')][_0x857e('0x45')](_0x353555)[_0x857e('0x22')](handleEntityNotFound(_0x457848,null))[_0x857e('0x22')](respondWithResult(_0x457848,null))['catch'](handleError(_0x457848,null));};exports['create']=function(_0xef8328,_0x27101a){return db[_0x857e('0x3f')]['create'](_0xef8328['body'],{})[_0x857e('0x22')](respondWithResult(_0x27101a,0xc9))[_0x857e('0x42')](handleError(_0x27101a,null));};exports['describe']=function(_0x32b628,_0x2d45a6){return db['CmHopperHistory']['describe']()['then'](respondWithResult(_0x2d45a6,null))['catch'](handleError(_0x2d45a6,null));};exports[_0x857e('0x46')]=function(_0x398a4c,_0x3564ce){if(_0x398a4c[_0x857e('0x47')][_0x857e('0x48')]){delete _0x398a4c['body'][_0x857e('0x48')];}return db[_0x857e('0x3f')][_0x857e('0x45')]({'where':{'uniqueid':_0x398a4c[_0x857e('0x44')]['id']}})['then'](handleEntityNotFound(_0x3564ce,null))[_0x857e('0x22')](saveUpdates(_0x398a4c[_0x857e('0x47')],null))[_0x857e('0x22')](respondWithResult(_0x3564ce,null))['catch'](handleError(_0x3564ce,null));}; \ No newline at end of file +var _0x0d0d=['VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','describe','uniqueid','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/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','reject','update','then','destroy','error','name','send','map','CmHopperHistory','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter'];(function(_0x3f4070,_0x3ff2a6){var _0x1063be=function(_0x13aa61){while(--_0x13aa61){_0x3f4070['push'](_0x3f4070['shift']());}};_0x1063be(++_0x3ff2a6);}(_0x0d0d,0x143));var _0xd0d0=function(_0x429e86,_0x1245c5){_0x429e86=_0x429e86-0x0;var _0x7e9100=_0x0d0d[_0x429e86];return _0x7e9100;};'use strict';var emlformat=require(_0xd0d0('0x0'));var rimraf=require(_0xd0d0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd0d0('0x2'));var rp=require('request-promise');var moment=require(_0xd0d0('0x3'));var BPromise=require(_0xd0d0('0x4'));var Mustache=require(_0xd0d0('0x5'));var util=require(_0xd0d0('0x6'));var path=require(_0xd0d0('0x7'));var sox=require('sox');var csv=require(_0xd0d0('0x8'));var ejs=require(_0xd0d0('0x9'));var fs=require('fs');var fs_extra=require(_0xd0d0('0xa'));var _=require(_0xd0d0('0xb'));var squel=require(_0xd0d0('0xc'));var crypto=require(_0xd0d0('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xd0d0('0xe'));var toCsv=require('to-csv');var querystring=require(_0xd0d0('0xf'));var Papa=require(_0xd0d0('0x10'));var Redis=require(_0xd0d0('0x11'));var authService=require(_0xd0d0('0x12'));var qs=require(_0xd0d0('0x13'));var as=require(_0xd0d0('0x14'));var hardwareService=require(_0xd0d0('0x15'));var logger=require('../../config/logger')(_0xd0d0('0x16'));var utils=require(_0xd0d0('0x17'));var config=require(_0xd0d0('0x18'));var licenseUtil=require(_0xd0d0('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x448d26,_0x59b193){_0x59b193=_0x59b193||0xcc;return function(_0x434ef1){if(_0x434ef1){return _0x448d26[_0xd0d0('0x1a')](_0x59b193);}return _0x448d26[_0xd0d0('0x1b')](_0x59b193)[_0xd0d0('0x1c')]();};}function respondWithResult(_0x2353bb,_0x431dfd){_0x431dfd=_0x431dfd||0xc8;return function(_0x18cf50){if(_0x18cf50){return _0x2353bb['status'](_0x431dfd)[_0xd0d0('0x1d')](_0x18cf50);}};}function respondWithFilteredResult(_0x37099e,_0x4b0239){return function(_0x1f6f74){if(_0x1f6f74){var _0x2ae58f=typeof _0x4b0239['offset']==='undefined'&&typeof _0x4b0239[_0xd0d0('0x1e')]===_0xd0d0('0x1f');var _0x165057=_0x1f6f74[_0xd0d0('0x20')];var _0x59e2e6=_0x2ae58f?0x0:_0x4b0239[_0xd0d0('0x21')];var _0x193608=_0x2ae58f?_0x1f6f74[_0xd0d0('0x20')]:_0x4b0239[_0xd0d0('0x21')]+_0x4b0239[_0xd0d0('0x1e')];var _0x52411b;if(_0x193608>=_0x165057){_0x193608=_0x165057;_0x52411b=0xc8;}else{_0x52411b=0xce;}_0x37099e[_0xd0d0('0x1b')](_0x52411b);return _0x37099e[_0xd0d0('0x22')](_0xd0d0('0x23'),_0x59e2e6+'-'+_0x193608+'/'+_0x165057)[_0xd0d0('0x1d')](_0x1f6f74);}return null;};}function patchUpdates(_0x40ede0){return function(_0x4de017){try{jsonpatch['apply'](_0x4de017,_0x40ede0,!![]);}catch(_0x115700){return BPromise[_0xd0d0('0x24')](_0x115700);}return _0x4de017['save']();};}function saveUpdates(_0x33d7a2,_0x124aad){return function(_0x40a07f){if(_0x40a07f){return _0x40a07f[_0xd0d0('0x25')](_0x33d7a2)[_0xd0d0('0x26')](function(_0x3f6da5){return _0x3f6da5;});}return null;};}function removeEntity(_0x1d5ef3,_0x1706d0){return function(_0x43c6d4){if(_0x43c6d4){return _0x43c6d4[_0xd0d0('0x27')]()[_0xd0d0('0x26')](function(){_0x1d5ef3[_0xd0d0('0x1b')](0xcc)[_0xd0d0('0x1c')]();});}};}function handleEntityNotFound(_0x3a9df6,_0x326b83){return function(_0x33066d){if(!_0x33066d){_0x3a9df6['sendStatus'](0x194);}return _0x33066d;};}function handleError(_0x3c5800,_0x26f792){_0x26f792=_0x26f792||0x1f4;return function(_0x4289ab){logger[_0xd0d0('0x28')](_0x4289ab['stack']);if(_0x4289ab[_0xd0d0('0x29')]){delete _0x4289ab[_0xd0d0('0x29')];}_0x3c5800[_0xd0d0('0x1b')](_0x26f792)[_0xd0d0('0x2a')](_0x4289ab);};}exports['index']=function(_0x1fb30b,_0x403d7a){var _0x9bec52={},_0x5d4af2={},_0x5caef2={'count':0x0,'rows':[]};var _0x513113=_[_0xd0d0('0x2b')](db[_0xd0d0('0x2c')]['rawAttributes'],function(_0x35f386){return{'name':_0x35f386[_0xd0d0('0x2d')],'type':_0x35f386[_0xd0d0('0x2e')][_0xd0d0('0x2f')]};});_0x5d4af2['model']=_[_0xd0d0('0x2b')](_0x513113,_0xd0d0('0x29'));_0x5d4af2[_0xd0d0('0x30')]=_[_0xd0d0('0x31')](_0x1fb30b[_0xd0d0('0x30')]);_0x5d4af2[_0xd0d0('0x32')]=_[_0xd0d0('0x33')](_0x5d4af2[_0xd0d0('0x34')],_0x5d4af2[_0xd0d0('0x30')]);_0x9bec52[_0xd0d0('0x35')]=_[_0xd0d0('0x33')](_0x5d4af2[_0xd0d0('0x34')],qs[_0xd0d0('0x36')](_0x1fb30b[_0xd0d0('0x30')][_0xd0d0('0x36')]));_0x9bec52[_0xd0d0('0x35')]=_0x9bec52[_0xd0d0('0x35')][_0xd0d0('0x37')]?_0x9bec52[_0xd0d0('0x35')]:_0x5d4af2[_0xd0d0('0x34')];if(!_0x1fb30b[_0xd0d0('0x30')][_0xd0d0('0x38')]('nolimit')){_0x9bec52['limit']=qs[_0xd0d0('0x1e')](_0x1fb30b[_0xd0d0('0x30')][_0xd0d0('0x1e')]);_0x9bec52[_0xd0d0('0x21')]=qs['offset'](_0x1fb30b[_0xd0d0('0x30')][_0xd0d0('0x21')]);}_0x9bec52[_0xd0d0('0x39')]=qs['sort'](_0x1fb30b[_0xd0d0('0x30')][_0xd0d0('0x3a')]);_0x9bec52[_0xd0d0('0x3b')]=qs[_0xd0d0('0x32')](_[_0xd0d0('0x3c')](_0x1fb30b['query'],_0x5d4af2[_0xd0d0('0x32')]),_0x513113);if(_0x1fb30b[_0xd0d0('0x30')][_0xd0d0('0x3d')]){_0x9bec52[_0xd0d0('0x3b')]=_['merge'](_0x9bec52['where'],{'$or':_[_0xd0d0('0x2b')](_0x513113,function(_0x1607f6){if(_0x1607f6['type']!==_0xd0d0('0x3e')){var _0x44ed9f={};_0x44ed9f[_0x1607f6[_0xd0d0('0x29')]]={'$like':'%'+_0x1fb30b[_0xd0d0('0x30')]['filter']+'%'};return _0x44ed9f;}})});}_0x9bec52=_[_0xd0d0('0x3f')]({},_0x9bec52,_0x1fb30b[_0xd0d0('0x40')]);var _0x4b0cd9={'where':_0x9bec52[_0xd0d0('0x3b')]};return db['CmHopperHistory'][_0xd0d0('0x20')](_0x4b0cd9)[_0xd0d0('0x26')](function(_0x358e82){_0x5caef2[_0xd0d0('0x20')]=_0x358e82;if(_0x1fb30b['query'][_0xd0d0('0x41')]){_0x9bec52[_0xd0d0('0x42')]=[{'all':!![]}];}return db[_0xd0d0('0x2c')][_0xd0d0('0x43')](_0x9bec52);})[_0xd0d0('0x26')](function(_0x2346f6){_0x5caef2['rows']=_0x2346f6;return _0x5caef2;})[_0xd0d0('0x26')](respondWithFilteredResult(_0x403d7a,_0x9bec52))[_0xd0d0('0x44')](handleError(_0x403d7a,null));};exports[_0xd0d0('0x45')]=function(_0x33b854,_0x531b06){var _0x559697={'raw':!![],'where':{'id':_0x33b854[_0xd0d0('0x46')]['id']}},_0x365a64={};_0x365a64[_0xd0d0('0x34')]=_['keys'](db[_0xd0d0('0x2c')][_0xd0d0('0x47')]);_0x365a64[_0xd0d0('0x30')]=_[_0xd0d0('0x31')](_0x33b854[_0xd0d0('0x30')]);_0x365a64['filters']=_[_0xd0d0('0x33')](_0x365a64[_0xd0d0('0x34')],_0x365a64[_0xd0d0('0x30')]);_0x559697['attributes']=_['intersection'](_0x365a64[_0xd0d0('0x34')],qs[_0xd0d0('0x36')](_0x33b854[_0xd0d0('0x30')][_0xd0d0('0x36')]));_0x559697[_0xd0d0('0x35')]=_0x559697['attributes'][_0xd0d0('0x37')]?_0x559697[_0xd0d0('0x35')]:_0x365a64['model'];if(_0x33b854['query'][_0xd0d0('0x41')]){_0x559697[_0xd0d0('0x42')]=[{'all':!![]}];}_0x559697=_[_0xd0d0('0x3f')]({},_0x559697,_0x33b854['options']);return db[_0xd0d0('0x2c')][_0xd0d0('0x48')](_0x559697)[_0xd0d0('0x26')](handleEntityNotFound(_0x531b06,null))[_0xd0d0('0x26')](respondWithResult(_0x531b06,null))[_0xd0d0('0x44')](handleError(_0x531b06,null));};exports[_0xd0d0('0x49')]=function(_0x5e97d1,_0x4bb2f7){return db[_0xd0d0('0x2c')][_0xd0d0('0x49')](_0x5e97d1[_0xd0d0('0x4a')],{})[_0xd0d0('0x26')](respondWithResult(_0x4bb2f7,0xc9))[_0xd0d0('0x44')](handleError(_0x4bb2f7,null));};exports[_0xd0d0('0x4b')]=function(_0x52b30a,_0x5de25a){return db[_0xd0d0('0x2c')][_0xd0d0('0x4b')]()['then'](respondWithResult(_0x5de25a,null))['catch'](handleError(_0x5de25a,null));};exports[_0xd0d0('0x25')]=function(_0x35f377,_0x5d1e29){if(_0x35f377[_0xd0d0('0x4a')][_0xd0d0('0x4c')]){delete _0x35f377[_0xd0d0('0x4a')][_0xd0d0('0x4c')];}return db['CmHopperHistory'][_0xd0d0('0x48')]({'where':{'uniqueid':_0x35f377[_0xd0d0('0x46')]['id']}})[_0xd0d0('0x26')](handleEntityNotFound(_0x5d1e29,null))[_0xd0d0('0x26')](saveUpdates(_0x35f377[_0xd0d0('0x4a')],null))[_0xd0d0('0x26')](respondWithResult(_0x5d1e29,null))[_0xd0d0('0x44')](handleError(_0x5d1e29,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 9648ef7..d6ed43e 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 _0xdb28=['bluebird','request-promise','path','rimraf','../../config/environment','exports','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','util','../../config/logger','api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdb28,0x106));var _0x8db2=function(_0x514ac4,_0x1f0374){_0x514ac4=_0x514ac4-0x0;var _0x372431=_0xdb28[_0x514ac4];return _0x372431;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var logger=require(_0x8db2('0x2'))(_0x8db2('0x3'));var moment=require('moment');var BPromise=require(_0x8db2('0x4'));var rp=require(_0x8db2('0x5'));var fs=require('fs');var path=require(_0x8db2('0x6'));var rimraf=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var attributes=require('./cmHopperHistory.attributes');module[_0x8db2('0x9')]=function(_0x1d2dd3,_0x5f42ee){return _0x1d2dd3['define'](_0x8db2('0xa'),attributes,{'tableName':_0x8db2('0xb'),'paranoid':![],'indexes':[{'name':_0x8db2('0xc'),'fields':[_0x8db2('0xc')]},{'name':_0x8db2('0xd'),'fields':[_0x8db2('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6d5e=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperHistory.attributes','exports','CmHopperHistory','uniqueid','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6d5e,0x103));var _0xe6d5=function(_0x273142,_0x46849e){_0x273142=_0x273142-0x0;var _0x4a71b2=_0x6d5e[_0x273142];return _0x4a71b2;};'use strict';var _=require(_0xe6d5('0x0'));var util=require(_0xe6d5('0x1'));var logger=require(_0xe6d5('0x2'))(_0xe6d5('0x3'));var moment=require('moment');var BPromise=require(_0xe6d5('0x4'));var rp=require(_0xe6d5('0x5'));var fs=require('fs');var path=require(_0xe6d5('0x6'));var rimraf=require(_0xe6d5('0x7'));var config=require(_0xe6d5('0x8'));var attributes=require(_0xe6d5('0x9'));module[_0xe6d5('0xa')]=function(_0x57c0ca,_0x13411d){return _0x57c0ca['define'](_0xe6d5('0xb'),attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':'endtime','fields':['endtime']},{'name':'uniqueid','fields':[_0xe6d5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index d42e9b3..98f3711 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 _0x8c58=['`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','COUNT','`state`\x20=\x2010,\x201,\x20null','`state`\x20=\x2011,\x201,\x20null','AVG','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','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','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','debug','GetCampaignHopperHistory','col','ivrTotalCallsDays','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','CmHopperHistory,\x20%s,\x20%s','request\x20sent','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateCmHopperHistory','CmHopperHistory','create','options','raw','AvgHandleTime','findAll','where','sequelize','predictiveIntervalTotalCalls','literal'];(function(_0x1cc1e3,_0x4598a4){var _0x2843cc=function(_0x24261b){while(--_0x24261b){_0x1cc1e3['push'](_0x1cc1e3['shift']());}};_0x2843cc(++_0x4598a4);}(_0x8c58,0xba));var _0x88c5=function(_0x5c9307,_0x5b97e4){_0x5c9307=_0x5c9307-0x0;var _0x373e29=_0x8c58[_0x5c9307];return _0x373e29;};'use strict';var _=require(_0x88c5('0x0'));var util=require(_0x88c5('0x1'));var moment=require('moment');var BPromise=require(_0x88c5('0x2'));var rs=require(_0x88c5('0x3'));var fs=require('fs');var Redis=require(_0x88c5('0x4'));var db=require(_0x88c5('0x5'))['db'];var utils=require(_0x88c5('0x6'));var logger=require(_0x88c5('0x7'))(_0x88c5('0x8'));var config=require(_0x88c5('0x9'));var jayson=require(_0x88c5('0xa'));var client=jayson[_0x88c5('0xb')][_0x88c5('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x26f059,_0x30a1a3,_0x44e6f5){return new BPromise(function(_0x5a0b92,_0x52416e){return client[_0x88c5('0xd')](_0x26f059,_0x44e6f5)[_0x88c5('0xe')](function(_0x2967b2){logger['info'](_0x88c5('0xf'),_0x30a1a3,_0x88c5('0x10'));logger['debug'](_0x88c5('0x11'),_0x30a1a3,_0x88c5('0x10'),JSON[_0x88c5('0x12')](_0x2967b2));if(_0x2967b2[_0x88c5('0x13')]){if(_0x2967b2['error'][_0x88c5('0x14')]===0x1f4){logger[_0x88c5('0x13')]('CmHopperHistory,\x20%s,\x20%s',_0x30a1a3,_0x2967b2[_0x88c5('0x13')][_0x88c5('0x15')]);return _0x52416e(_0x2967b2[_0x88c5('0x13')][_0x88c5('0x15')]);}logger[_0x88c5('0x13')](_0x88c5('0xf'),_0x30a1a3,_0x2967b2['error'][_0x88c5('0x15')]);return _0x5a0b92(_0x2967b2[_0x88c5('0x13')][_0x88c5('0x15')]);}else{logger[_0x88c5('0x16')]('CmHopperHistory,\x20%s,\x20%s',_0x30a1a3,_0x88c5('0x10'));_0x5a0b92(_0x2967b2[_0x88c5('0x17')][_0x88c5('0x15')]);}})[_0x88c5('0x18')](function(_0xd014bb){logger[_0x88c5('0x13')]('CmHopperHistory,\x20%s,\x20%s',_0x30a1a3,_0xd014bb);_0x52416e(_0xd014bb);});});}exports[_0x88c5('0x19')]=function(_0x3675aa){var _0x2e6737=this;return new Promise(function(_0x342371,_0x12dd04){return db[_0x88c5('0x1a')][_0x88c5('0x1b')](_0x3675aa['body'],{'raw':_0x3675aa[_0x88c5('0x1c')]?_0x3675aa[_0x88c5('0x1c')][_0x88c5('0x1d')]===undefined?!![]:![]:!![]})[_0x88c5('0xe')](function(_0x737835){logger[_0x88c5('0x16')](_0x88c5('0x19'),_0x3675aa);logger['debug'](_0x88c5('0x19'),_0x3675aa,JSON['stringify'](_0x737835));_0x342371(_0x737835);})[_0x88c5('0x18')](function(_0x1db033){logger[_0x88c5('0x13')](_0x88c5('0x19'),_0x1db033[_0x88c5('0x15')],_0x3675aa);_0x12dd04(_0x2e6737[_0x88c5('0x13')](0x1f4,_0x1db033[_0x88c5('0x15')]));});});};exports[_0x88c5('0x1e')]=function(_0x10aee4){var _0x25c3f3=this;return new Promise(function(_0x452eb7,_0x494d21){return db[_0x88c5('0x1a')][_0x88c5('0x1f')]({'raw':_0x10aee4[_0x88c5('0x1c')]?_0x10aee4['options'][_0x88c5('0x1d')]===undefined?!![]:![]:!![],'where':_0x10aee4[_0x88c5('0x1c')]?_0x10aee4['options'][_0x88c5('0x20')]||null:null,'attributes':[[db[_0x88c5('0x21')]['fn']('COUNT',db[_0x88c5('0x21')]['col']('id')),_0x88c5('0x22')],[db['sequelize']['fn']('COUNT',db[_0x88c5('0x21')]['fn']('IF',db[_0x88c5('0x21')][_0x88c5('0x23')](_0x88c5('0x24')))),_0x88c5('0x25')],[db['sequelize']['fn'](_0x88c5('0x26'),db[_0x88c5('0x21')]['fn']('IF',db[_0x88c5('0x21')][_0x88c5('0x23')](_0x88c5('0x27')))),'predictiveIntervalDroppedCallsTimeout'],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x88c5('0x21')][_0x88c5('0x23')](_0x88c5('0x28')))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0x88c5('0x21')]['fn'](_0x88c5('0x29'),db[_0x88c5('0x21')]['fn']('IF',db['sequelize'][_0x88c5('0x23')]('`state`\x20=\x204,\x20`holdtime`,\x20null'))),_0x88c5('0x2a')],[db[_0x88c5('0x21')]['fn'](_0x88c5('0x29'),db[_0x88c5('0x21')]['fn']('IF',db[_0x88c5('0x21')][_0x88c5('0x23')](_0x88c5('0x2b')))),_0x88c5('0x2c')]]})[_0x88c5('0xe')](function(_0xd5558d){logger[_0x88c5('0x16')](_0x88c5('0x1e'),_0x10aee4);logger['debug'](_0x88c5('0x1e'),_0x10aee4,JSON[_0x88c5('0x12')](_0xd5558d));_0x452eb7(_0xd5558d);})[_0x88c5('0x18')](function(_0x70d855){logger['error'](_0x88c5('0x1e'),_0x70d855['message'],_0x10aee4);_0x494d21(_0x25c3f3[_0x88c5('0x13')](0x1f4,_0x70d855[_0x88c5('0x15')]));});});};exports[_0x88c5('0x2d')]=function(_0x210514){var _0x3269cb=this;return new Promise(function(_0x27b5b1,_0x397d99){return db[_0x88c5('0x1a')][_0x88c5('0x1f')]({'raw':_0x210514['options']?_0x210514[_0x88c5('0x1c')][_0x88c5('0x1d')]===undefined?!![]:![]:!![],'where':_0x210514[_0x88c5('0x1c')]?_0x210514[_0x88c5('0x1c')][_0x88c5('0x20')]||null:null,'attributes':[[_0x88c5('0x2e'),_0x88c5('0x2f')],[db[_0x88c5('0x21')]['fn'](_0x88c5('0x26'),db[_0x88c5('0x21')]['fn']('IF',db[_0x88c5('0x21')][_0x88c5('0x23')](_0x88c5('0x30')))),_0x88c5('0x31')],[db['sequelize']['fn'](_0x88c5('0x26'),db[_0x88c5('0x21')]['fn']('IF',db[_0x88c5('0x21')]['literal'](_0x88c5('0x32')))),_0x88c5('0x33')],[db[_0x88c5('0x21')]['fn'](_0x88c5('0x26'),db['sequelize']['fn']('IF',db[_0x88c5('0x21')]['literal'](_0x88c5('0x24')))),_0x88c5('0x34')],[db[_0x88c5('0x21')]['fn'](_0x88c5('0x26'),db[_0x88c5('0x21')]['fn']('IF',db[_0x88c5('0x21')][_0x88c5('0x23')](_0x88c5('0x35')))),_0x88c5('0x36')],[db[_0x88c5('0x21')]['fn'](_0x88c5('0x26'),db[_0x88c5('0x21')]['fn']('IF',db[_0x88c5('0x21')]['literal'](_0x88c5('0x37')))),_0x88c5('0x38')],[db[_0x88c5('0x21')]['fn']('COUNT',db[_0x88c5('0x21')]['fn']('IF',db[_0x88c5('0x21')]['literal'](_0x88c5('0x39')))),_0x88c5('0x3a')],[db[_0x88c5('0x21')]['fn'](_0x88c5('0x26'),db[_0x88c5('0x21')]['fn']('IF',db[_0x88c5('0x21')][_0x88c5('0x23')](_0x88c5('0x3b')))),_0x88c5('0x3c')],[db[_0x88c5('0x21')]['fn'](_0x88c5('0x26'),db[_0x88c5('0x21')]['fn']('IF',db[_0x88c5('0x21')][_0x88c5('0x23')](_0x88c5('0x3d')))),_0x88c5('0x3e')],[db[_0x88c5('0x21')]['fn']('COUNT',db[_0x88c5('0x21')]['fn']('IF',db[_0x88c5('0x21')][_0x88c5('0x23')]('`state`\x20=\x2013,\x201,\x20null'))),_0x88c5('0x3f')],[db[_0x88c5('0x21')]['fn'](_0x88c5('0x26'),db[_0x88c5('0x21')]['fn']('IF',db['sequelize']['literal'](_0x88c5('0x40')))),_0x88c5('0x41')],[db['sequelize']['fn']('COUNT',db[_0x88c5('0x21')]['fn']('IF',db[_0x88c5('0x21')]['literal']('`state`\x20=\x2018,\x201,\x20null'))),_0x88c5('0x42')],[db[_0x88c5('0x21')]['fn']('COUNT',db[_0x88c5('0x21')]['fn']('IF',db[_0x88c5('0x21')][_0x88c5('0x23')](_0x88c5('0x43')))),'outboundAnswerAgiCallsDay'],[db[_0x88c5('0x21')]['fn']('COUNT',db[_0x88c5('0x21')]['fn']('IF',db[_0x88c5('0x21')][_0x88c5('0x23')](_0x88c5('0x44')))),'outboundRejectCallsDay'],[db[_0x88c5('0x21')]['fn']('COUNT',db[_0x88c5('0x21')]['fn']('IF',db['sequelize']['literal'](_0x88c5('0x45')))),'outboundReCallsDay']],'group':[_0x88c5('0x2e')]})[_0x88c5('0xe')](function(_0x3c6ce0){logger[_0x88c5('0x16')]('GetVoiceQueueHopperHistory',_0x210514);logger[_0x88c5('0x46')]('GetVoiceQueueHopperHistory',_0x210514,JSON[_0x88c5('0x12')](_0x3c6ce0));_0x27b5b1(_0x3c6ce0);})['catch'](function(_0x435f9e){logger[_0x88c5('0x13')]('GetVoiceQueueHopperHistory',_0x435f9e[_0x88c5('0x15')],_0x210514);_0x397d99(_0x3269cb['error'](0x1f4,_0x435f9e[_0x88c5('0x15')]));});});};exports[_0x88c5('0x47')]=function(_0x1917d7){var _0x190e9c=this;return new Promise(function(_0x49b5da,_0x2960ce){return db['CmHopperHistory'][_0x88c5('0x1f')]({'raw':_0x1917d7[_0x88c5('0x1c')]?_0x1917d7['options']['raw']===undefined?!![]:![]:!![],'where':_0x1917d7[_0x88c5('0x1c')]?_0x1917d7[_0x88c5('0x1c')]['where']||null:null,'attributes':[[_0x88c5('0x2e'),_0x88c5('0x2f')],[db[_0x88c5('0x21')]['fn']('COUNT',db[_0x88c5('0x21')][_0x88c5('0x48')]('id')),_0x88c5('0x49')],[db[_0x88c5('0x21')]['fn'](_0x88c5('0x26'),db['sequelize']['fn']('IF',db['sequelize'][_0x88c5('0x23')](_0x88c5('0x24')))),'ivrAnswerCallsDay']],'group':[_0x88c5('0x2e')]})[_0x88c5('0xe')](function(_0x12d231){logger['info']('GetCampaignHopperHistory',_0x1917d7);logger[_0x88c5('0x46')](_0x88c5('0x47'),_0x1917d7,JSON[_0x88c5('0x12')](_0x12d231));_0x49b5da(_0x12d231);})[_0x88c5('0x18')](function(_0x94d73e){logger[_0x88c5('0x13')](_0x88c5('0x47'),_0x94d73e['message'],_0x1917d7);_0x2960ce(_0x190e9c[_0x88c5('0x13')](0x1f4,_0x94d73e[_0x88c5('0x15')]));});});}; \ No newline at end of file +var _0xa62c=['`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','AvgHandleTime','GetVoiceQueueHopperHistory','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x204,\x201,\x20null','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2012,\x201,\x20null','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','`state`\x20=\x2016,\x201,\x20null','`state`\x20=\x2020,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','CmHopperHistory,\x20%s,\x20%s','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','then','findAll','where','sequelize','col','COUNT','literal','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout'];(function(_0x14650f,_0x496f0c){var _0x1012ac=function(_0x3e6adf){while(--_0x3e6adf){_0x14650f['push'](_0x14650f['shift']());}};_0x1012ac(++_0x496f0c);}(_0xa62c,0x70));var _0xca62=function(_0x6182ff,_0x59d492){_0x6182ff=_0x6182ff-0x0;var _0x1cec22=_0xa62c[_0x6182ff];return _0x1cec22;};'use strict';var _=require(_0xca62('0x0'));var util=require(_0xca62('0x1'));var moment=require(_0xca62('0x2'));var BPromise=require(_0xca62('0x3'));var rs=require(_0xca62('0x4'));var fs=require('fs');var Redis=require(_0xca62('0x5'));var db=require(_0xca62('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xca62('0x7'))(_0xca62('0x8'));var config=require(_0xca62('0x9'));var jayson=require(_0xca62('0xa'));var client=jayson[_0xca62('0xb')][_0xca62('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x310378,_0x4584ab,_0x5da9b9){return new BPromise(function(_0x2160c4,_0xd7f11b){return client[_0xca62('0xd')](_0x310378,_0x5da9b9)['then'](function(_0x29fce7){logger[_0xca62('0xe')](_0xca62('0xf'),_0x4584ab,'request\x20sent');logger[_0xca62('0x10')](_0xca62('0x11'),_0x4584ab,_0xca62('0x12'),JSON[_0xca62('0x13')](_0x29fce7));if(_0x29fce7[_0xca62('0x14')]){if(_0x29fce7[_0xca62('0x14')][_0xca62('0x15')]===0x1f4){logger[_0xca62('0x14')](_0xca62('0xf'),_0x4584ab,_0x29fce7['error'][_0xca62('0x16')]);return _0xd7f11b(_0x29fce7[_0xca62('0x14')][_0xca62('0x16')]);}logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x4584ab,_0x29fce7['error'][_0xca62('0x16')]);return _0x2160c4(_0x29fce7['error'][_0xca62('0x16')]);}else{logger[_0xca62('0xe')]('CmHopperHistory,\x20%s,\x20%s',_0x4584ab,'request\x20sent');_0x2160c4(_0x29fce7[_0xca62('0x17')][_0xca62('0x16')]);}})[_0xca62('0x18')](function(_0x5512c2){logger[_0xca62('0x14')](_0xca62('0xf'),_0x4584ab,_0x5512c2);_0xd7f11b(_0x5512c2);});});}exports[_0xca62('0x19')]=function(_0x58d6f6){var _0x83990a=this;return new Promise(function(_0x34a370,_0x13194b){return db[_0xca62('0x1a')][_0xca62('0x1b')](_0x58d6f6[_0xca62('0x1c')],{'raw':_0x58d6f6[_0xca62('0x1d')]?_0x58d6f6[_0xca62('0x1d')][_0xca62('0x1e')]===undefined?!![]:![]:!![]})[_0xca62('0x1f')](function(_0x133132){logger[_0xca62('0xe')]('CreateCmHopperHistory',_0x58d6f6);logger['debug']('CreateCmHopperHistory',_0x58d6f6,JSON[_0xca62('0x13')](_0x133132));_0x34a370(_0x133132);})[_0xca62('0x18')](function(_0x3f2a52){logger[_0xca62('0x14')](_0xca62('0x19'),_0x3f2a52[_0xca62('0x16')],_0x58d6f6);_0x13194b(_0x83990a[_0xca62('0x14')](0x1f4,_0x3f2a52[_0xca62('0x16')]));});});};exports['AvgHandleTime']=function(_0x486763){var _0x23acd7=this;return new Promise(function(_0x4b5d77,_0x46f079){return db[_0xca62('0x1a')][_0xca62('0x20')]({'raw':_0x486763[_0xca62('0x1d')]?_0x486763[_0xca62('0x1d')][_0xca62('0x1e')]===undefined?!![]:![]:!![],'where':_0x486763['options']?_0x486763['options'][_0xca62('0x21')]||null:null,'attributes':[[db[_0xca62('0x22')]['fn']('COUNT',db['sequelize'][_0xca62('0x23')]('id')),'predictiveIntervalTotalCalls'],[db[_0xca62('0x22')]['fn'](_0xca62('0x24'),db[_0xca62('0x22')]['fn']('IF',db[_0xca62('0x22')][_0xca62('0x25')]('`state`\x20=\x204,\x201,\x20null'))),'predictiveIntervalAnsweredCalls'],[db[_0xca62('0x22')]['fn'](_0xca62('0x24'),db['sequelize']['fn']('IF',db[_0xca62('0x22')][_0xca62('0x25')](_0xca62('0x26')))),_0xca62('0x27')],[db[_0xca62('0x22')]['fn'](_0xca62('0x24'),db[_0xca62('0x22')]['fn']('IF',db[_0xca62('0x22')][_0xca62('0x25')](_0xca62('0x28')))),_0xca62('0x29')],[db[_0xca62('0x22')]['fn'](_0xca62('0x2a'),db[_0xca62('0x22')]['fn']('IF',db[_0xca62('0x22')][_0xca62('0x25')](_0xca62('0x2b')))),_0xca62('0x2c')],[db[_0xca62('0x22')]['fn'](_0xca62('0x2a'),db['sequelize']['fn']('IF',db['sequelize'][_0xca62('0x25')](_0xca62('0x2d')))),'predictiveIntervalAvgTalktime']]})['then'](function(_0x196111){logger[_0xca62('0xe')](_0xca62('0x2e'),_0x486763);logger[_0xca62('0x10')]('AvgHandleTime',_0x486763,JSON[_0xca62('0x13')](_0x196111));_0x4b5d77(_0x196111);})[_0xca62('0x18')](function(_0x589ce7){logger['error']('AvgHandleTime',_0x589ce7[_0xca62('0x16')],_0x486763);_0x46f079(_0x23acd7['error'](0x1f4,_0x589ce7[_0xca62('0x16')]));});});};exports[_0xca62('0x2f')]=function(_0x3f4883){var _0x23cc45=this;return new Promise(function(_0x438400,_0x14d0e3){return db[_0xca62('0x1a')]['findAll']({'raw':_0x3f4883[_0xca62('0x1d')]?_0x3f4883[_0xca62('0x1d')][_0xca62('0x1e')]===undefined?!![]:![]:!![],'where':_0x3f4883[_0xca62('0x1d')]?_0x3f4883[_0xca62('0x1d')][_0xca62('0x21')]||null:null,'attributes':[[_0xca62('0x30'),_0xca62('0x31')],[db['sequelize']['fn'](_0xca62('0x24'),db[_0xca62('0x22')]['fn']('IF',db['sequelize']['literal'](_0xca62('0x32')))),_0xca62('0x33')],[db[_0xca62('0x22')]['fn'](_0xca62('0x24'),db['sequelize']['fn']('IF',db[_0xca62('0x22')][_0xca62('0x25')](_0xca62('0x34')))),'outboundNoAnswerCallsDay'],[db[_0xca62('0x22')]['fn'](_0xca62('0x24'),db[_0xca62('0x22')]['fn']('IF',db[_0xca62('0x22')]['literal'](_0xca62('0x35')))),_0xca62('0x36')],[db['sequelize']['fn']('COUNT',db[_0xca62('0x22')]['fn']('IF',db[_0xca62('0x22')][_0xca62('0x25')](_0xca62('0x37')))),_0xca62('0x38')],[db['sequelize']['fn'](_0xca62('0x24'),db['sequelize']['fn']('IF',db[_0xca62('0x22')][_0xca62('0x25')](_0xca62('0x39')))),_0xca62('0x3a')],[db[_0xca62('0x22')]['fn'](_0xca62('0x24'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0xca62('0x3b')))),_0xca62('0x3c')],[db['sequelize']['fn'](_0xca62('0x24'),db['sequelize']['fn']('IF',db[_0xca62('0x22')][_0xca62('0x25')](_0xca62('0x3d')))),'outboundDropCallsDayCallersExit'],[db['sequelize']['fn'](_0xca62('0x24'),db[_0xca62('0x22')]['fn']('IF',db[_0xca62('0x22')]['literal'](_0xca62('0x3e')))),'outboundUnknownCallsDay'],[db[_0xca62('0x22')]['fn'](_0xca62('0x24'),db[_0xca62('0x22')]['fn']('IF',db[_0xca62('0x22')][_0xca62('0x25')](_0xca62('0x3f')))),_0xca62('0x40')],[db[_0xca62('0x22')]['fn'](_0xca62('0x24'),db[_0xca62('0x22')]['fn']('IF',db[_0xca62('0x22')][_0xca62('0x25')](_0xca62('0x41')))),_0xca62('0x42')],[db[_0xca62('0x22')]['fn']('COUNT',db[_0xca62('0x22')]['fn']('IF',db[_0xca62('0x22')][_0xca62('0x25')](_0xca62('0x43')))),'outboundRejectCallsDay'],[db['sequelize']['fn']('COUNT',db[_0xca62('0x22')]['fn']('IF',db[_0xca62('0x22')][_0xca62('0x25')](_0xca62('0x44')))),'outboundAnswerAgiCallsDay'],[db[_0xca62('0x22')]['fn'](_0xca62('0x24'),db[_0xca62('0x22')]['fn']('IF',db[_0xca62('0x22')][_0xca62('0x25')](_0xca62('0x45')))),_0xca62('0x46')],[db[_0xca62('0x22')]['fn'](_0xca62('0x24'),db[_0xca62('0x22')]['fn']('IF',db[_0xca62('0x22')][_0xca62('0x25')](_0xca62('0x47')))),_0xca62('0x48')]],'group':['campaign']})['then'](function(_0x330029){logger['info'](_0xca62('0x2f'),_0x3f4883);logger[_0xca62('0x10')](_0xca62('0x2f'),_0x3f4883,JSON['stringify'](_0x330029));_0x438400(_0x330029);})[_0xca62('0x18')](function(_0x2ebc11){logger[_0xca62('0x14')](_0xca62('0x2f'),_0x2ebc11['message'],_0x3f4883);_0x14d0e3(_0x23cc45[_0xca62('0x14')](0x1f4,_0x2ebc11[_0xca62('0x16')]));});});};exports[_0xca62('0x49')]=function(_0x10a6c3){var _0x2e5595=this;return new Promise(function(_0x3e6e52,_0x3f2ac7){return db[_0xca62('0x1a')]['findAll']({'raw':_0x10a6c3[_0xca62('0x1d')]?_0x10a6c3[_0xca62('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x10a6c3['options']?_0x10a6c3['options']['where']||null:null,'attributes':[['campaign',_0xca62('0x31')],[db[_0xca62('0x22')]['fn'](_0xca62('0x24'),db[_0xca62('0x22')][_0xca62('0x23')]('id')),_0xca62('0x4a')],[db['sequelize']['fn']('COUNT',db[_0xca62('0x22')]['fn']('IF',db[_0xca62('0x22')]['literal'](_0xca62('0x35')))),_0xca62('0x4b')]],'group':[_0xca62('0x30')]})[_0xca62('0x1f')](function(_0x2512e1){logger['info'](_0xca62('0x49'),_0x10a6c3);logger[_0xca62('0x10')](_0xca62('0x49'),_0x10a6c3,JSON[_0xca62('0x13')](_0x2512e1));_0x3e6e52(_0x2512e1);})['catch'](function(_0x3a9fce){logger[_0xca62('0x14')](_0xca62('0x49'),_0x3a9fce['message'],_0x10a6c3);_0x3f2ac7(_0x2e5595[_0xca62('0x14')](0x1f4,_0x3a9fce['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index a24aa1d..cd04e5b 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 _0x23a1=['../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','/describe','describe','post','put','/:id','update','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x19c9d0,_0x4c6f81){var _0x6de53e=function(_0x135875){while(--_0x135875){_0x19c9d0['push'](_0x19c9d0['shift']());}};_0x6de53e(++_0x4c6f81);}(_0x23a1,0x73));var _0x123a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x23a1[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x123a('0x0'));var timeout=require(_0x123a('0x1'));var express=require(_0x123a('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x123a('0x3'));var interaction=require(_0x123a('0x4'));var config=require(_0x123a('0x5'));var controller=require(_0x123a('0x6'));router[_0x123a('0x7')]('/',auth[_0x123a('0x8')](),controller['index']);router['get'](_0x123a('0x9'),auth[_0x123a('0x8')](),controller[_0x123a('0xa')]);router['get']('/:id',auth[_0x123a('0x8')](),controller['show']);router[_0x123a('0xb')]('/',auth[_0x123a('0x8')](),controller['create']);router[_0x123a('0xc')](_0x123a('0xd'),auth[_0x123a('0x8')](),controller[_0x123a('0xe')]);module['exports']=router; \ No newline at end of file +var _0xf6b1=['../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','update','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x55d829,_0x43f06c){var _0x52163b=function(_0x493cd8){while(--_0x493cd8){_0x55d829['push'](_0x55d829['shift']());}};_0x52163b(++_0x43f06c);}(_0xf6b1,0x15f));var _0x1f6b=function(_0x373dc3,_0x2742b1){_0x373dc3=_0x373dc3-0x0;var _0x28a768=_0xf6b1[_0x373dc3];return _0x28a768;};'use strict';var multer=require(_0x1f6b('0x0'));var util=require(_0x1f6b('0x1'));var path=require(_0x1f6b('0x2'));var timeout=require(_0x1f6b('0x3'));var express=require(_0x1f6b('0x4'));var router=express[_0x1f6b('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x1f6b('0x6'));var interaction=require(_0x1f6b('0x7'));var config=require(_0x1f6b('0x8'));var controller=require(_0x1f6b('0x9'));router[_0x1f6b('0xa')]('/',auth[_0x1f6b('0xb')](),controller['index']);router['get'](_0x1f6b('0xc'),auth[_0x1f6b('0xb')](),controller[_0x1f6b('0xd')]);router['get'](_0x1f6b('0xe'),auth[_0x1f6b('0xb')](),controller[_0x1f6b('0xf')]);router[_0x1f6b('0x10')]('/',auth[_0x1f6b('0xb')](),controller[_0x1f6b('0x11')]);router[_0x1f6b('0x12')](_0x1f6b('0xe'),auth['isAuthenticated'](),controller[_0x1f6b('0x13')]);module[_0x1f6b('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 0b51381..a4b93fb 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 _0x536e=['name','sequelize','exports','STRING'];(function(_0x105233,_0xd0c461){var _0x28006d=function(_0x13e659){while(--_0x13e659){_0x105233['push'](_0x105233['shift']());}};_0x28006d(++_0xd0c461);}(_0x536e,0x155));var _0xe536=function(_0x6b8e6,_0x5b5b8d){_0x6b8e6=_0x6b8e6-0x0;var _0x11e8d9=_0x536e[_0x6b8e6];return _0x11e8d9;};'use strict';var Sequelize=require(_0xe536('0x0'));module[_0xe536('0x1')]={'name':{'type':Sequelize[_0xe536('0x2')],'unique':_0xe536('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xe536('0x2')]},'dialPrefix':{'type':Sequelize[_0xe536('0x2')]}}; \ No newline at end of file +var _0xefbf=['STRING','sequelize','exports'];(function(_0x2a3ed4,_0x1c4755){var _0xfb3bf5=function(_0x4597c4){while(--_0x4597c4){_0x2a3ed4['push'](_0x2a3ed4['shift']());}};_0xfb3bf5(++_0x1c4755);}(_0xefbf,0xa3));var _0xfefb=function(_0x449fd,_0x456222){_0x449fd=_0x449fd-0x0;var _0x3a4fb1=_0xefbf[_0x449fd];return _0x3a4fb1;};'use strict';var Sequelize=require(_0xfefb('0x0'));module[_0xfefb('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize[_0xfefb('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 3c01b15..b40b177 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 _0x989c=['download','addCustomField','sequelize','transaction','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','cm_contacts','cf_%s','findAndCountAll','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmList.socket','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','then','get','Lists','UserProfileResource','end','error','stack','name','send','index','map','CmList','rawAttributes','type','key','model','keys','query','intersection','attributes','fields','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','length','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','ListId','findOne','Disposition','hasOwnProperty','removeDispositions','ids','CmContact','tags','isArray','join','push','omit','success','dataValues','errors','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','cf_%d','pick','getContactsCsv','format','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x989c,0xa9));var _0xc989=function(_0x4d3b97,_0x210218){_0x4d3b97=_0x4d3b97-0x0;var _0x17354e=_0x989c[_0x4d3b97];return _0x17354e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc989('0x0'));var jsonpatch=require(_0xc989('0x1'));var rp=require(_0xc989('0x2'));var moment=require(_0xc989('0x3'));var BPromise=require(_0xc989('0x4'));var Mustache=require(_0xc989('0x5'));var util=require('util');var path=require(_0xc989('0x6'));var sox=require('sox');var csv=require(_0xc989('0x7'));var ejs=require(_0xc989('0x8'));var fs=require('fs');var fs_extra=require(_0xc989('0x9'));var _=require('lodash');var squel=require(_0xc989('0xa'));var crypto=require(_0xc989('0xb'));var jsforce=require(_0xc989('0xc'));var deskjs=require(_0xc989('0xd'));var toCsv=require(_0xc989('0x7'));var querystring=require(_0xc989('0xe'));var Papa=require(_0xc989('0xf'));var Redis=require(_0xc989('0x10'));var authService=require(_0xc989('0x11'));var qs=require(_0xc989('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc989('0x13'))(_0xc989('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc989('0x15'));var db=require(_0xc989('0x16'))['db'];config[_0xc989('0x17')]=_[_0xc989('0x18')](config[_0xc989('0x17')],{'host':_0xc989('0x19'),'port':0x18eb});var socket=require(_0xc989('0x1a'))(new Redis(config[_0xc989('0x17')]));require(_0xc989('0x1b'))['register'](socket);function respondWithStatusCode(_0x3f8e9d,_0x38b03a){_0x38b03a=_0x38b03a||0xcc;return function(_0x1352af){if(_0x1352af){return _0x3f8e9d[_0xc989('0x1c')](_0x38b03a);}return _0x3f8e9d[_0xc989('0x1d')](_0x38b03a)['end']();};}function respondWithResult(_0x43669d,_0x2c8203){_0x2c8203=_0x2c8203||0xc8;return function(_0x547807){if(_0x547807){return _0x43669d[_0xc989('0x1d')](_0x2c8203)[_0xc989('0x1e')](_0x547807);}};}function respondWithFilteredResult(_0x5a3b4b,_0x48ac50){return function(_0x90c868){if(_0x90c868){var _0x16e413=typeof _0x48ac50[_0xc989('0x1f')]===_0xc989('0x20')&&typeof _0x48ac50[_0xc989('0x21')]===_0xc989('0x20');var _0x4d2f63=_0x90c868[_0xc989('0x22')];var _0x58a342=_0x16e413?0x0:_0x48ac50[_0xc989('0x1f')];var _0x5b0807=_0x16e413?_0x90c868[_0xc989('0x22')]:_0x48ac50[_0xc989('0x1f')]+_0x48ac50[_0xc989('0x21')];var _0x3992f2;if(_0x5b0807>=_0x4d2f63){_0x5b0807=_0x4d2f63;_0x3992f2=0xc8;}else{_0x3992f2=0xce;}_0x5a3b4b[_0xc989('0x1d')](_0x3992f2);return _0x5a3b4b[_0xc989('0x23')](_0xc989('0x24'),_0x58a342+'-'+_0x5b0807+'/'+_0x4d2f63)[_0xc989('0x1e')](_0x90c868);}return null;};}function patchUpdates(_0x2c4433){return function(_0x16a2a3){try{jsonpatch['apply'](_0x16a2a3,_0x2c4433,!![]);}catch(_0x3e74b1){return BPromise[_0xc989('0x25')](_0x3e74b1);}return _0x16a2a3[_0xc989('0x26')]();};}function saveUpdates(_0x4e47ae,_0x2813b4){return function(_0x4dd52a){if(_0x4dd52a){return _0x4dd52a[_0xc989('0x27')](_0x4e47ae)['then'](function(_0x4e6476){return _0x4e6476;});}return null;};}function removeEntity(_0x5d9463,_0x3f5632){return function(_0x28256d){if(_0x28256d){return _0x28256d[_0xc989('0x28')]()[_0xc989('0x29')](function(){var _0x80e933=_0x28256d[_0xc989('0x2a')]({'plain':!![]});var _0x288ddb=_0xc989('0x2b');return db[_0xc989('0x2c')][_0xc989('0x28')]({'where':{'type':_0x288ddb,'resourceId':_0x80e933['id']}})[_0xc989('0x29')](function(){return _0x28256d;});})[_0xc989('0x29')](function(){_0x5d9463[_0xc989('0x1d')](0xcc)[_0xc989('0x2d')]();});}};}function handleEntityNotFound(_0x300f4d,_0x2b7cec){return function(_0xf4b009){if(!_0xf4b009){_0x300f4d['sendStatus'](0x194);}return _0xf4b009;};}function handleError(_0x51b4fd,_0x558cff){_0x558cff=_0x558cff||0x1f4;return function(_0x5ed2b7){logger[_0xc989('0x2e')](_0x5ed2b7[_0xc989('0x2f')]);if(_0x5ed2b7[_0xc989('0x30')]){delete _0x5ed2b7[_0xc989('0x30')];}_0x51b4fd[_0xc989('0x1d')](_0x558cff)[_0xc989('0x31')](_0x5ed2b7);};}exports[_0xc989('0x32')]=function(_0x43d533,_0xc672c2){var _0x114063={},_0x2a7116={},_0x51ea7a={'count':0x0,'rows':[]};var _0x3e5112=_[_0xc989('0x33')](db[_0xc989('0x34')][_0xc989('0x35')],function(_0x47044d){return{'name':_0x47044d['fieldName'],'type':_0x47044d[_0xc989('0x36')][_0xc989('0x37')]};});_0x2a7116[_0xc989('0x38')]=_[_0xc989('0x33')](_0x3e5112,'name');_0x2a7116['query']=_[_0xc989('0x39')](_0x43d533[_0xc989('0x3a')]);_0x2a7116['filters']=_[_0xc989('0x3b')](_0x2a7116[_0xc989('0x38')],_0x2a7116[_0xc989('0x3a')]);_0x114063[_0xc989('0x3c')]=_['intersection'](_0x2a7116[_0xc989('0x38')],qs[_0xc989('0x3d')](_0x43d533[_0xc989('0x3a')]['fields']));_0x114063[_0xc989('0x3c')]=_0x114063[_0xc989('0x3c')]['length']?_0x114063[_0xc989('0x3c')]:_0x2a7116['model'];if(!_0x43d533[_0xc989('0x3a')]['hasOwnProperty'](_0xc989('0x3e'))){_0x114063[_0xc989('0x21')]=qs['limit'](_0x43d533[_0xc989('0x3a')][_0xc989('0x21')]);_0x114063['offset']=qs[_0xc989('0x1f')](_0x43d533[_0xc989('0x3a')][_0xc989('0x1f')]);}_0x114063[_0xc989('0x3f')]=qs[_0xc989('0x40')](_0x43d533[_0xc989('0x3a')][_0xc989('0x40')]);_0x114063['where']=qs['filters'](_['pick'](_0x43d533[_0xc989('0x3a')],_0x2a7116[_0xc989('0x41')]),_0x3e5112);if(_0x43d533[_0xc989('0x3a')][_0xc989('0x42')]){_0x114063[_0xc989('0x43')]=_[_0xc989('0x44')](_0x114063['where'],{'$or':_[_0xc989('0x33')](_0x3e5112,function(_0x3a7b88){if(_0x3a7b88[_0xc989('0x36')]!==_0xc989('0x45')){var _0xcfb10d={};_0xcfb10d[_0x3a7b88[_0xc989('0x30')]]={'$like':'%'+_0x43d533[_0xc989('0x3a')][_0xc989('0x42')]+'%'};return _0xcfb10d;}})});}_0x114063=_[_0xc989('0x44')]({},_0x114063,_0x43d533[_0xc989('0x46')]);var _0x31c405={'where':_0x114063[_0xc989('0x43')]};return db[_0xc989('0x34')][_0xc989('0x22')](_0x31c405)[_0xc989('0x29')](function(_0x1a8eb8){_0x51ea7a[_0xc989('0x22')]=_0x1a8eb8;if(_0x43d533['query'][_0xc989('0x47')]){_0x114063['include']=[{'all':!![]}];}return db['CmList'][_0xc989('0x48')](_0x114063);})[_0xc989('0x29')](function(_0x37ec1a){_0x51ea7a[_0xc989('0x49')]=_0x37ec1a;return _0x51ea7a;})[_0xc989('0x29')](respondWithFilteredResult(_0xc672c2,_0x114063))[_0xc989('0x4a')](handleError(_0xc672c2,null));};exports['show']=function(_0x4ba93c,_0x1db956){var _0x5aef4b={'raw':![],'where':{'id':_0x4ba93c[_0xc989('0x4b')]['id']}},_0x111d73={};_0x111d73['model']=_[_0xc989('0x39')](db['CmList']['rawAttributes']);_0x111d73[_0xc989('0x3a')]=_[_0xc989('0x39')](_0x4ba93c['query']);_0x111d73[_0xc989('0x41')]=_['intersection'](_0x111d73[_0xc989('0x38')],_0x111d73[_0xc989('0x3a')]);_0x5aef4b[_0xc989('0x3c')]=_['intersection'](_0x111d73['model'],qs['fields'](_0x4ba93c[_0xc989('0x3a')][_0xc989('0x3d')]));_0x5aef4b[_0xc989('0x3c')]=_0x5aef4b[_0xc989('0x3c')][_0xc989('0x4c')]?_0x5aef4b['attributes']:_0x111d73['model'];if(_0x4ba93c[_0xc989('0x3a')][_0xc989('0x47')]){_0x5aef4b[_0xc989('0x4d')]=[{'all':!![]}];}_0x5aef4b=_[_0xc989('0x44')]({},_0x5aef4b,_0x4ba93c['options']);return db[_0xc989('0x34')][_0xc989('0x4e')](_0x5aef4b)[_0xc989('0x29')](handleEntityNotFound(_0x1db956,null))[_0xc989('0x29')](respondWithResult(_0x1db956,null))['catch'](handleError(_0x1db956,null));};exports[_0xc989('0x4f')]=function(_0x2ef62b,_0xebf3b5){return db[_0xc989('0x34')][_0xc989('0x4f')](_0x2ef62b['body'],{})[_0xc989('0x29')](function(_0xf21698){var _0xc44c05=_0x2ef62b[_0xc989('0x50')][_0xc989('0x2a')]({'plain':!![]});if(!_0xc44c05)throw new Error(_0xc989('0x51'));if(_0xc44c05[_0xc989('0x52')]===_0xc989('0x50')){var _0x16de8c=_0xf21698[_0xc989('0x2a')]({'plain':!![]});var _0x3f5255=_0xc989('0x2b');return db[_0xc989('0x53')][_0xc989('0x4e')]({'where':{'name':_0x3f5255,'userProfileId':_0xc44c05['userProfileId']},'raw':!![]})['then'](function(_0x4c3092){if(_0x4c3092&&_0x4c3092['autoAssociation']===0x0){return db[_0xc989('0x2c')][_0xc989('0x4f')]({'name':_0x16de8c['name'],'resourceId':_0x16de8c['id'],'type':_0x4c3092[_0xc989('0x30')],'sectionId':_0x4c3092['id']},{})[_0xc989('0x29')](function(){return _0xf21698;});}else{return _0xf21698;}})[_0xc989('0x4a')](function(_0x302823){logger[_0xc989('0x2e')](_0xc989('0x54'),_0x302823);throw _0x302823;});}return _0xf21698;})[_0xc989('0x29')](respondWithResult(_0xebf3b5,0xc9))[_0xc989('0x4a')](handleError(_0xebf3b5,null));};exports[_0xc989('0x27')]=function(_0x475bfc,_0x6d0e03){if(_0x475bfc['body']['id']){delete _0x475bfc[_0xc989('0x55')]['id'];}return db[_0xc989('0x34')]['find']({'where':{'id':_0x475bfc[_0xc989('0x4b')]['id']}})['then'](handleEntityNotFound(_0x6d0e03,null))[_0xc989('0x29')](saveUpdates(_0x475bfc[_0xc989('0x55')],null))[_0xc989('0x29')](respondWithResult(_0x6d0e03,null))[_0xc989('0x4a')](handleError(_0x6d0e03,null));};exports[_0xc989('0x28')]=function(_0x120b8a,_0x5a2d00){return db[_0xc989('0x34')][_0xc989('0x4e')]({'where':{'id':_0x120b8a[_0xc989('0x4b')]['id']}})[_0xc989('0x29')](handleEntityNotFound(_0x5a2d00,null))['then'](removeEntity(_0x5a2d00,null))[_0xc989('0x4a')](handleError(_0x5a2d00,null));};exports[_0xc989('0x56')]=function(_0x8c68c9,_0x2b670d){return db[_0xc989('0x34')]['describe']()[_0xc989('0x29')](respondWithResult(_0x2b670d,null))[_0xc989('0x4a')](handleError(_0x2b670d,null));};exports[_0xc989('0x57')]=function(_0x42a3b9,_0x58bc42,_0x2f05d0){if(_0x42a3b9[_0xc989('0x55')]['id']){delete _0x42a3b9[_0xc989('0x55')]['id'];}return db[_0xc989('0x34')][_0xc989('0x4e')]({'where':{'id':_0x42a3b9['params']['id']}})['then'](handleEntityNotFound(_0x58bc42,null))[_0xc989('0x29')](function(_0x324974){if(_0x324974){_0x42a3b9[_0xc989('0x55')][_0xc989('0x58')]=_0x324974['id'];return db['Disposition'][_0xc989('0x4f')](_0x42a3b9[_0xc989('0x55')]);}})[_0xc989('0x29')](respondWithResult(_0x58bc42,null))[_0xc989('0x4a')](handleError(_0x58bc42,null));};exports['getDispositions']=function(_0x534a4d,_0x4fd95f,_0x4285bf){var _0x304c4d={'raw':![],'where':{}};var _0x14cde7={};var _0x3bf0e2={'count':0x0,'rows':[]};return db[_0xc989('0x34')][_0xc989('0x59')]({'where':{'id':_0x534a4d[_0xc989('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4fd95f,null))[_0xc989('0x29')](function(_0x2253a4){if(_0x2253a4){_0x14cde7[_0xc989('0x38')]=_[_0xc989('0x39')](db[_0xc989('0x5a')][_0xc989('0x35')]);_0x14cde7[_0xc989('0x3a')]=_[_0xc989('0x39')](_0x534a4d[_0xc989('0x3a')]);_0x14cde7[_0xc989('0x41')]=_[_0xc989('0x3b')](_0x14cde7[_0xc989('0x38')],_0x14cde7['query']);_0x304c4d[_0xc989('0x3c')]=_[_0xc989('0x3b')](_0x14cde7['model'],qs[_0xc989('0x3d')](_0x534a4d[_0xc989('0x3a')][_0xc989('0x3d')]));_0x304c4d[_0xc989('0x3c')]=_0x304c4d[_0xc989('0x3c')][_0xc989('0x4c')]?_0x304c4d[_0xc989('0x3c')]:_0x14cde7[_0xc989('0x38')];if(!_0x534a4d[_0xc989('0x3a')][_0xc989('0x5b')](_0xc989('0x3e'))){_0x304c4d['limit']=qs[_0xc989('0x21')](_0x534a4d[_0xc989('0x3a')][_0xc989('0x21')]);_0x304c4d[_0xc989('0x1f')]=qs[_0xc989('0x1f')](_0x534a4d[_0xc989('0x3a')][_0xc989('0x1f')]);}_0x304c4d[_0xc989('0x3f')]=qs['sort'](_0x534a4d[_0xc989('0x3a')][_0xc989('0x40')]);_0x304c4d[_0xc989('0x43')]=qs[_0xc989('0x41')](_['pick'](_0x534a4d[_0xc989('0x3a')],_0x14cde7[_0xc989('0x41')]));_0x304c4d['where'][_0xc989('0x58')]=_0x2253a4['id'];if(_0x534a4d[_0xc989('0x3a')][_0xc989('0x42')]){_0x304c4d[_0xc989('0x43')]=_[_0xc989('0x44')](_0x304c4d[_0xc989('0x43')],{'$or':_['map'](_0x304c4d[_0xc989('0x3c')],function(_0x56e08e){var _0x1260b6={};_0x1260b6[_0x56e08e]={'$like':'%'+_0x534a4d[_0xc989('0x3a')][_0xc989('0x42')]+'%'};return _0x1260b6;})});}_0x304c4d=_[_0xc989('0x44')]({},_0x304c4d,_0x534a4d[_0xc989('0x46')]);return db[_0xc989('0x5a')][_0xc989('0x22')]({'where':_0x304c4d[_0xc989('0x43')]})[_0xc989('0x29')](function(_0x5ae9f6){_0x3bf0e2['count']=_0x5ae9f6;if(_0x534a4d[_0xc989('0x3a')][_0xc989('0x47')]){_0x304c4d[_0xc989('0x4d')]=[{'all':!![]}];}return db[_0xc989('0x5a')][_0xc989('0x48')](_0x304c4d);})['then'](function(_0x42466b){_0x3bf0e2[_0xc989('0x49')]=_0x42466b;return _0x3bf0e2;});}})[_0xc989('0x29')](respondWithFilteredResult(_0x4fd95f,_0x304c4d))[_0xc989('0x4a')](handleError(_0x4fd95f,null));};exports[_0xc989('0x5c')]=function(_0x5d735a,_0x1c1e1b,_0x3e3e47){return db[_0xc989('0x34')]['find']({'where':{'id':_0x5d735a[_0xc989('0x4b')]['id']}})[_0xc989('0x29')](handleEntityNotFound(_0x1c1e1b,null))[_0xc989('0x29')](function(_0x13b04a){if(_0x13b04a){return _0x13b04a[_0xc989('0x5c')](_0x5d735a[_0xc989('0x3a')][_0xc989('0x5d')]);}})[_0xc989('0x29')](respondWithStatusCode(_0x1c1e1b,null))[_0xc989('0x4a')](handleError(_0x1c1e1b,null));};exports['addContacts']=function(_0x143a09,_0x1457d6,_0x3b2a85){return db['CmList'][_0xc989('0x4e')]({'where':{'id':_0x143a09[_0xc989('0x4b')]['id']}})[_0xc989('0x29')](handleEntityNotFound(_0x1457d6,null))[_0xc989('0x29')](function(_0x30117f){if(_0x30117f){var _0x537680=[];var _0x2f92f4={'success':[],'errors':[]};return db[_0xc989('0x5e')][_0xc989('0x56')]()[_0xc989('0x29')](function(_0x3a407f){if(_0x143a09[_0xc989('0x55')][_0xc989('0x5f')]&&_[_0xc989('0x60')](_0x143a09[_0xc989('0x55')][_0xc989('0x5f')])){if(_0x143a09[_0xc989('0x55')][_0xc989('0x5f')][_0xc989('0x4c')]){_0x143a09[_0xc989('0x55')][_0xc989('0x5f')]=_0x143a09[_0xc989('0x55')][_0xc989('0x5f')][_0xc989('0x61')](';')+';';}else{_0x143a09['body'][_0xc989('0x5f')]=null;}}else{_0x143a09[_0xc989('0x55')][_0xc989('0x5f')]=null;}if(_0x143a09['body']&&_[_0xc989('0x60')](_0x143a09[_0xc989('0x55')])){for(var _0x118ef9=0x0;_0x118ef9<_0x143a09['body'][_0xc989('0x4c')];_0x118ef9+=0x1){_0x143a09[_0xc989('0x55')][_0x118ef9][_0xc989('0x58')]=_0x143a09['params']['id'];_0x537680[_0xc989('0x62')](_0x143a09[_0xc989('0x55')][_0x118ef9]);}return BPromise['each'](_0x537680,function(_0x22b007){return db[_0xc989('0x5e')][_0xc989('0x4f')](_[_0xc989('0x63')](_0x22b007,['ids','id'])||{},{'fields':_[_0xc989('0x39')](_0x3a407f),'raw':!![]})['then'](function(_0x4277b2){_0x2f92f4[_0xc989('0x64')][_0xc989('0x62')](_0x4277b2[_0xc989('0x65')]);})[_0xc989('0x4a')](function(_0x12454a){_0x2f92f4[_0xc989('0x66')][_0xc989('0x62')]({'data':_0x22b007,'error':_0x12454a['message']});});})['then'](function(_0x5f2a4e){return _0x2f92f4;})[_0xc989('0x4a')](function(_0x32c14e){return _0x32c14e;});}else{_0x1457d6[_0xc989('0x1d')](0x190)[_0xc989('0x1e')]({'message':_0xc989('0x67')});}});}})['then'](respondWithResult(_0x1457d6,null))[_0xc989('0x4a')](handleError(_0x1457d6,null));};exports[_0xc989('0x68')]=function(_0x4e0774,_0x4da1e9,_0x5423cc){var _0x58feed;return db[_0xc989('0x34')][_0xc989('0x4e')]({'where':{'id':_0x4e0774[_0xc989('0x4b')]['id']},'include':[{'model':db[_0xc989('0x69')],'as':_0xc989('0x6a')}]})['then'](handleEntityNotFound(_0x4da1e9,null))['then'](function(_0x2a518e){if(_0x2a518e){_0x58feed=_0x2a518e;return db[_0xc989('0x5e')][_0xc989('0x35')];}})[_0xc989('0x29')](function(_0x7795db){if(_0x7795db){var _0x5b67e9={};var _0x187e94={};_0x187e94[_0xc989('0x38')]=_[_0xc989('0x6b')](_[_0xc989('0x39')](_0x7795db),_[_0xc989('0x33')](_0x58feed[_0xc989('0x6a')],function(_0x3903dd){return util['format'](_0xc989('0x6c'),_0x3903dd['id']);}));_0x187e94[_0xc989('0x3a')]=_[_0xc989('0x39')](_0x4e0774['query']);_0x187e94[_0xc989('0x41')]=_[_0xc989('0x3b')](_0x187e94[_0xc989('0x38')],_0x187e94[_0xc989('0x3a')]);_0x5b67e9['attributes']=_[_0xc989('0x3b')](_0x187e94[_0xc989('0x38')],qs[_0xc989('0x3d')](_0x4e0774[_0xc989('0x3a')][_0xc989('0x3d')]));_0x5b67e9[_0xc989('0x3c')]=_0x5b67e9[_0xc989('0x3c')][_0xc989('0x4c')]?_0x5b67e9['attributes']:_0x187e94[_0xc989('0x38')];if(!_0x4e0774[_0xc989('0x3a')][_0xc989('0x5b')](_0xc989('0x3e'))){_0x5b67e9['limit']=qs[_0xc989('0x21')](_0x4e0774[_0xc989('0x3a')][_0xc989('0x21')]);_0x5b67e9[_0xc989('0x1f')]=qs[_0xc989('0x1f')](_0x4e0774[_0xc989('0x3a')]['offset']);}_0x5b67e9[_0xc989('0x3f')]=qs[_0xc989('0x40')](_0x4e0774[_0xc989('0x3a')][_0xc989('0x40')]);_0x5b67e9[_0xc989('0x43')]=qs[_0xc989('0x41')](_[_0xc989('0x6d')](_0x4e0774[_0xc989('0x3a')],_0x187e94[_0xc989('0x41')]));_0x5b67e9['raw']=!![];if(_0x4e0774[_0xc989('0x3a')][_0xc989('0x42')]){_0x5b67e9[_0xc989('0x43')]=_[_0xc989('0x44')](_0x5b67e9[_0xc989('0x43')],{'$or':_[_0xc989('0x33')](_0x5b67e9['attributes'],function(_0x53180a){var _0x46a9d3={};_0x46a9d3[_0x53180a]={'$like':'%'+_0x4e0774['query'][_0xc989('0x42')]+'%'};return _0x46a9d3;})});}_0x5b67e9=_[_0xc989('0x44')]({},_0x5b67e9,_0x4e0774[_0xc989('0x46')]);return _0x58feed[_0xc989('0x68')](_0x5b67e9);}})['then'](respondWithResult(_0x4da1e9,null))[_0xc989('0x4a')](handleError(_0x4da1e9,null));};exports[_0xc989('0x6e')]=function(_0x456bda,_0x36e5fb,_0xe54eb2){var _0x14a038;return db[_0xc989('0x34')][_0xc989('0x4e')]({'where':{'id':_0x456bda[_0xc989('0x4b')]['id']},'include':[{'model':db[_0xc989('0x69')],'as':_0xc989('0x6a')}]})[_0xc989('0x29')](handleEntityNotFound(_0x36e5fb,null))[_0xc989('0x29')](function(_0x31db6e){if(_0x31db6e){_0x14a038=_0x31db6e;return db[_0xc989('0x5e')][_0xc989('0x35')];}})['then'](function(_0x124399){if(_0x124399){var _0x5a0b05={};var _0x331154={};_0x331154[_0xc989('0x38')]=_['concat'](_[_0xc989('0x39')](_0x124399),_[_0xc989('0x33')](_0x14a038['CustomFields'],function(_0x394aa5){return util[_0xc989('0x6f')](_0xc989('0x6c'),_0x394aa5['id']);}));_0x331154['query']=_[_0xc989('0x39')](_0x456bda[_0xc989('0x3a')]);_0x331154[_0xc989('0x41')]=_[_0xc989('0x3b')](_0x331154[_0xc989('0x38')],_0x331154[_0xc989('0x3a')]);_0x5a0b05[_0xc989('0x3c')]=_[_0xc989('0x3b')](_0x331154[_0xc989('0x38')],qs['fields'](_0x456bda[_0xc989('0x3a')][_0xc989('0x3d')]));_0x5a0b05[_0xc989('0x3c')]=_0x5a0b05[_0xc989('0x3c')]['length']?_0x5a0b05[_0xc989('0x3c')]:_0x331154[_0xc989('0x38')];if(!_0x456bda['query'][_0xc989('0x5b')]('nolimit')){_0x5a0b05['limit']=qs[_0xc989('0x21')](_0x456bda[_0xc989('0x3a')][_0xc989('0x21')]);_0x5a0b05['offset']=qs[_0xc989('0x1f')](_0x456bda['query'][_0xc989('0x1f')]);}_0x5a0b05[_0xc989('0x3f')]=qs[_0xc989('0x40')](_0x456bda[_0xc989('0x3a')][_0xc989('0x40')]);_0x5a0b05[_0xc989('0x43')]=qs[_0xc989('0x41')](_['pick'](_0x456bda[_0xc989('0x3a')],_0x331154[_0xc989('0x41')]));_0x5a0b05['raw']=!![];if(_0x456bda['query'][_0xc989('0x42')]){_0x5a0b05[_0xc989('0x43')]=_[_0xc989('0x44')](_0x5a0b05[_0xc989('0x43')],{'$or':_[_0xc989('0x33')](_0x5a0b05[_0xc989('0x3c')],function(_0x3c38a0){var _0x2b768b={};_0x2b768b[_0x3c38a0]={'$like':'%'+_0x456bda['query'][_0xc989('0x42')]+'%'};return _0x2b768b;})});}_0x5a0b05=_['merge']({},_0x5a0b05,_0x456bda[_0xc989('0x46')]);return _0x14a038[_0xc989('0x68')](_0x5a0b05);}})['then'](function(_0x2b2bcf){if(!_[_0xc989('0x70')](_0x2b2bcf)){var _0x9bd59e=toCsv(_0x2b2bcf);var _0x8eedee=Date[_0xc989('0x71')]();fs[_0xc989('0x72')](util['format'](_0xc989('0x73'),_0x14a038['id'],_0x8eedee),_0x9bd59e);_0x36e5fb[_0xc989('0x74')]('Content-disposition',_0xc989('0x75')+util[_0xc989('0x6f')](_0xc989('0x76'),_0x14a038['id'],_0x8eedee));_0x36e5fb[_0xc989('0x74')](_0xc989('0x77'),_0xc989('0x78'));return _0x36e5fb[_0xc989('0x79')](util[_0xc989('0x6f')](_0xc989('0x73'),_0x14a038['id'],_0x8eedee));}else{return _0x36e5fb[_0xc989('0x1c')](0xcc);}})[_0xc989('0x4a')](handleError(_0x36e5fb,null));};exports[_0xc989('0x7a')]=function(_0x471685,_0x3dddab,_0x2101cc){var _0x3c725a;delete _0x471685[_0xc989('0x55')]['id'];return db[_0xc989('0x34')][_0xc989('0x59')]({'where':{'id':_0x471685['params']['id']}})[_0xc989('0x29')](handleEntityNotFound(_0x3dddab,null))[_0xc989('0x29')](function(_0x18ae44){if(_0x18ae44){return db[_0xc989('0x7b')][_0xc989('0x7c')](function(_0xe3f8d6){return db[_0xc989('0x69')][_0xc989('0x4f')](_0x471685[_0xc989('0x55')],{'transaction':_0xe3f8d6})['then'](function(_0x5b24f1){_0x3c725a=_0x5b24f1;return _0x18ae44['addCustomFields'](_0x5b24f1,{'transaction':_0xe3f8d6});})[_0xc989('0x29')](function(){var _0x469139={'type':db[_0xc989('0x7d')][_0xc989('0x7e')],'transaction':_0xe3f8d6};switch(_0x471685[_0xc989('0x55')][_0xc989('0x36')]){case _0xc989('0x7f'):_0x469139[_0xc989('0x36')]=db[_0xc989('0x7d')]['TEXT'];break;case _0xc989('0x80'):_0x469139[_0xc989('0x36')]=db['Sequelize'][_0xc989('0x81')];break;case _0xc989('0x82'):_0x469139[_0xc989('0x36')]=db[_0xc989('0x7d')][_0xc989('0x83')];_0x469139[_0xc989('0x84')]=![];break;default:}return db['sequelize'][_0xc989('0x85')]['addColumn'](_0xc989('0x86'),util[_0xc989('0x6f')](_0xc989('0x87'),_0x3c725a['id']),_0x469139);})['then'](function(){return _0x3c725a;});});}})[_0xc989('0x29')](respondWithResult(_0x3dddab,null))[_0xc989('0x4a')](handleError(_0x3dddab,null));};exports['getCustomFields']=function(_0x5d46ce,_0x31f7b9,_0x106d71){var _0x37bed0={};var _0x44f071={};var _0x940c11;var _0x432dcd;return db[_0xc989('0x34')]['findOne']({'where':{'id':_0x5d46ce[_0xc989('0x4b')]['id']}})['then'](handleEntityNotFound(_0x31f7b9,null))[_0xc989('0x29')](function(_0x1ba9d9){if(_0x1ba9d9){_0x940c11=_0x1ba9d9;_0x44f071['model']=_[_0xc989('0x39')](db[_0xc989('0x69')][_0xc989('0x35')]);_0x44f071['query']=_[_0xc989('0x39')](_0x5d46ce['query']);_0x44f071[_0xc989('0x41')]=_['intersection'](_0x44f071[_0xc989('0x38')],_0x44f071[_0xc989('0x3a')]);_0x37bed0[_0xc989('0x3c')]=_[_0xc989('0x3b')](_0x44f071[_0xc989('0x38')],qs[_0xc989('0x3d')](_0x5d46ce[_0xc989('0x3a')]['fields']));_0x37bed0['attributes']=_0x37bed0['attributes'][_0xc989('0x4c')]?_0x37bed0[_0xc989('0x3c')]:_0x44f071['model'];_0x37bed0['order']=qs[_0xc989('0x40')](_0x5d46ce['query'][_0xc989('0x40')]);_0x37bed0[_0xc989('0x43')]=qs[_0xc989('0x41')](_[_0xc989('0x6d')](_0x5d46ce[_0xc989('0x3a')],_0x44f071[_0xc989('0x41')]));_0x37bed0[_0xc989('0x43')]=_[_0xc989('0x44')](_0x37bed0['where'],{'$or':[{'ListId':_0x1ba9d9['id']},{'ListId':null}]});if(_0x5d46ce[_0xc989('0x3a')][_0xc989('0x42')]){_0x37bed0[_0xc989('0x43')]=_['merge'](_0x37bed0[_0xc989('0x43')],{'$or':_[_0xc989('0x33')](_0x37bed0[_0xc989('0x3c')],function(_0x1906d9){var _0x16d06a={};_0x16d06a[_0x1906d9]={'$like':'%'+_0x5d46ce[_0xc989('0x3a')]['filter']+'%'};return _0x16d06a;})});}_0x37bed0=_[_0xc989('0x44')]({},_0x37bed0,_0x5d46ce[_0xc989('0x46')]);return db['CmCustomField'][_0xc989('0x88')](_0x37bed0);}})[_0xc989('0x29')](respondWithResult(_0x31f7b9,null))['catch'](handleError(_0x31f7b9,null));};exports[_0xc989('0x89')]=function(_0x8f77,_0x21bd69,_0x3e9e02){return db[_0xc989('0x34')][_0xc989('0x4e')]({'where':{'id':_0x8f77[_0xc989('0x4b')]['id']}})['then'](handleEntityNotFound(_0x21bd69,null))[_0xc989('0x29')](function(_0x383079){if(_0x383079){return _0x383079[_0xc989('0x89')](_0x8f77[_0xc989('0x55')]['ids'],_[_0xc989('0x63')](_0x8f77[_0xc989('0x55')],['ids','id'])||{})[_0xc989('0x8a')](function(_0x5cf0b9){for(var _0x4e0870=0x0;_0x4e0870<_0x8f77[_0xc989('0x55')][_0xc989('0x5d')][_0xc989('0x4c')];_0x4e0870+=0x1){socket[_0xc989('0x8b')](_0xc989('0x8c'),{'UserId':Number(_0x8f77[_0xc989('0x55')][_0xc989('0x5d')][_0x4e0870]),'CmListId':Number(_0x8f77['params']['id'])});}return _0x5cf0b9;});}})[_0xc989('0x29')](respondWithResult(_0x21bd69,null))[_0xc989('0x4a')](handleError(_0x21bd69,null));};exports['removeAgents']=function(_0x2d2a2a,_0x240909,_0x4c1800){return db[_0xc989('0x34')]['find']({'where':{'id':_0x2d2a2a[_0xc989('0x4b')]['id']}})['then'](handleEntityNotFound(_0x240909,null))[_0xc989('0x29')](function(_0xa7a7f9){if(_0xa7a7f9){return _0xa7a7f9[_0xc989('0x8d')](_0x2d2a2a[_0xc989('0x3a')][_0xc989('0x5d')])[_0xc989('0x29')](function(){if(_[_0xc989('0x60')](_0x2d2a2a[_0xc989('0x3a')]['ids'])){for(var _0x110954=0x0;_0x110954<_0x2d2a2a[_0xc989('0x3a')][_0xc989('0x5d')]['length'];_0x110954+=0x1){socket[_0xc989('0x8b')](_0xc989('0x8e'),{'UserId':Number(_0x2d2a2a[_0xc989('0x3a')][_0xc989('0x5d')][_0x110954]),'CmListId':Number(_0x2d2a2a[_0xc989('0x4b')]['id'])});}}else{socket[_0xc989('0x8b')](_0xc989('0x8e'),{'UserId':Number(_0x2d2a2a['query'][_0xc989('0x5d')]),'CmListId':Number(_0x2d2a2a[_0xc989('0x4b')]['id'])});}});}})[_0xc989('0x29')](respondWithStatusCode(_0x240909,null))[_0xc989('0x4a')](handleError(_0x240909,null));};exports[_0xc989('0x8f')]=function(_0x25debc,_0x3556cd,_0x1c9342){var _0x2a0724={};var _0x559552={};var _0x29f9bf;var _0x4bcd71;return db[_0xc989('0x34')][_0xc989('0x59')]({'where':{'id':_0x25debc[_0xc989('0x4b')]['id']}})[_0xc989('0x29')](handleEntityNotFound(_0x3556cd,null))['then'](function(_0x39fb51){if(_0x39fb51){_0x29f9bf=_0x39fb51;_0x559552['model']=_[_0xc989('0x39')](db[_0xc989('0x90')][_0xc989('0x35')]);_0x559552[_0xc989('0x3a')]=_[_0xc989('0x39')](_0x25debc[_0xc989('0x3a')]);_0x559552['filters']=_[_0xc989('0x3b')](_0x559552[_0xc989('0x38')],_0x559552[_0xc989('0x3a')]);_0x2a0724[_0xc989('0x3c')]=_[_0xc989('0x3b')](_0x559552[_0xc989('0x38')],qs['fields'](_0x25debc[_0xc989('0x3a')][_0xc989('0x3d')]));_0x2a0724['attributes']=_0x2a0724['attributes'][_0xc989('0x4c')]?_0x2a0724[_0xc989('0x3c')]:_0x559552['model'];_0x2a0724[_0xc989('0x3f')]=qs[_0xc989('0x40')](_0x25debc['query'][_0xc989('0x40')]);_0x2a0724[_0xc989('0x43')]=qs[_0xc989('0x41')](_['pick'](_0x25debc['query'],_0x559552[_0xc989('0x41')]));if(_0x25debc['query'][_0xc989('0x42')]){_0x2a0724[_0xc989('0x43')]=_[_0xc989('0x44')](_0x2a0724[_0xc989('0x43')],{'$or':_[_0xc989('0x33')](_0x2a0724[_0xc989('0x3c')],function(_0x37c692){var _0x200b0c={};_0x200b0c[_0x37c692]={'$like':'%'+_0x25debc['query']['filter']+'%'};return _0x200b0c;})});}_0x2a0724=_['merge']({},_0x2a0724,_0x25debc['options']);return _0x29f9bf[_0xc989('0x8f')](_0x2a0724);}})[_0xc989('0x29')](function(_0x54bbba){if(_0x54bbba){_0x4bcd71=_0x54bbba[_0xc989('0x4c')];if(!_0x25debc['query'][_0xc989('0x5b')](_0xc989('0x3e'))){_0x2a0724[_0xc989('0x21')]=qs[_0xc989('0x21')](_0x25debc['query'][_0xc989('0x21')]);_0x2a0724[_0xc989('0x1f')]=qs[_0xc989('0x1f')](_0x25debc[_0xc989('0x3a')][_0xc989('0x1f')]);}return _0x29f9bf[_0xc989('0x8f')](_0x2a0724);}})[_0xc989('0x29')](function(_0xf874e9){if(_0xf874e9){return _0xf874e9?{'count':_0x4bcd71,'rows':_0xf874e9}:null;}})[_0xc989('0x29')](respondWithResult(_0x3556cd,null))[_0xc989('0x4a')](handleError(_0x3556cd,null));}; \ No newline at end of file +var _0xa3d6=['send','index','map','CmList','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','length','create','body','user','role','Lists','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','ListId','Disposition','getDispositions','findOne','hasOwnProperty','removeDispositions','ids','isArray','tags','join','push','each','CmContact','omit','success','dataValues','errors','message','getContacts','CmCustomField','CustomFields','cf_%d','raw','concat','isEmpty','writeFileSync','format','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','download','sequelize','transaction','addCustomFields','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','defaultValue','addColumn','cm_contacts','cf_%s','getCustomFields','addAgents','spread','userCmList:save','removeAgents','userCmList:remove','emit','getAgents','User','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','get','UserProfileResource','error','name'];(function(_0x2257c3,_0x38dc9b){var _0x53638c=function(_0x26bcdb){while(--_0x26bcdb){_0x2257c3['push'](_0x2257c3['shift']());}};_0x53638c(++_0x38dc9b);}(_0xa3d6,0xf5));var _0x6a3d=function(_0x433829,_0x158aa1){_0x433829=_0x433829-0x0;var _0x4ea7a2=_0xa3d6[_0x433829];return _0x4ea7a2;};'use strict';var emlformat=require(_0x6a3d('0x0'));var rimraf=require(_0x6a3d('0x1'));var zipdir=require(_0x6a3d('0x2'));var jsonpatch=require(_0x6a3d('0x3'));var rp=require(_0x6a3d('0x4'));var moment=require(_0x6a3d('0x5'));var BPromise=require(_0x6a3d('0x6'));var Mustache=require(_0x6a3d('0x7'));var util=require(_0x6a3d('0x8'));var path=require(_0x6a3d('0x9'));var sox=require(_0x6a3d('0xa'));var csv=require('to-csv');var ejs=require(_0x6a3d('0xb'));var fs=require('fs');var fs_extra=require(_0x6a3d('0xc'));var _=require(_0x6a3d('0xd'));var squel=require(_0x6a3d('0xe'));var crypto=require(_0x6a3d('0xf'));var jsforce=require(_0x6a3d('0x10'));var deskjs=require(_0x6a3d('0x11'));var toCsv=require(_0x6a3d('0x12'));var querystring=require(_0x6a3d('0x13'));var Papa=require(_0x6a3d('0x14'));var Redis=require('ioredis');var authService=require(_0x6a3d('0x15'));var qs=require(_0x6a3d('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6a3d('0x17'));var logger=require(_0x6a3d('0x18'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x6a3d('0x19'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x6a3d('0x1a')](config[_0x6a3d('0x1b')],{'host':_0x6a3d('0x1c'),'port':0x18eb});var socket=require(_0x6a3d('0x1d'))(new Redis(config[_0x6a3d('0x1b')]));require(_0x6a3d('0x1e'))[_0x6a3d('0x1f')](socket);function respondWithStatusCode(_0x1a9b3c,_0x18f674){_0x18f674=_0x18f674||0xcc;return function(_0x4c0702){if(_0x4c0702){return _0x1a9b3c[_0x6a3d('0x20')](_0x18f674);}return _0x1a9b3c[_0x6a3d('0x21')](_0x18f674)['end']();};}function respondWithResult(_0x2ab668,_0x13f5a1){_0x13f5a1=_0x13f5a1||0xc8;return function(_0xd4c4b6){if(_0xd4c4b6){return _0x2ab668[_0x6a3d('0x21')](_0x13f5a1)[_0x6a3d('0x22')](_0xd4c4b6);}};}function respondWithFilteredResult(_0x4977a5,_0x4f2578){return function(_0x1b35e1){if(_0x1b35e1){var _0x26b741=typeof _0x4f2578[_0x6a3d('0x23')]===_0x6a3d('0x24')&&typeof _0x4f2578[_0x6a3d('0x25')]==='undefined';var _0x2a5036=_0x1b35e1[_0x6a3d('0x26')];var _0x2a23fc=_0x26b741?0x0:_0x4f2578['offset'];var _0x21f1e0=_0x26b741?_0x1b35e1[_0x6a3d('0x26')]:_0x4f2578[_0x6a3d('0x23')]+_0x4f2578[_0x6a3d('0x25')];var _0x57e443;if(_0x21f1e0>=_0x2a5036){_0x21f1e0=_0x2a5036;_0x57e443=0xc8;}else{_0x57e443=0xce;}_0x4977a5[_0x6a3d('0x21')](_0x57e443);return _0x4977a5[_0x6a3d('0x27')](_0x6a3d('0x28'),_0x2a23fc+'-'+_0x21f1e0+'/'+_0x2a5036)['json'](_0x1b35e1);}return null;};}function patchUpdates(_0x425d32){return function(_0x147985){try{jsonpatch[_0x6a3d('0x29')](_0x147985,_0x425d32,!![]);}catch(_0x3901d8){return BPromise['reject'](_0x3901d8);}return _0x147985['save']();};}function saveUpdates(_0x350b27,_0x4f77f6){return function(_0x5145be){if(_0x5145be){return _0x5145be[_0x6a3d('0x2a')](_0x350b27)[_0x6a3d('0x2b')](function(_0x251d4d){return _0x251d4d;});}return null;};}function removeEntity(_0x214a6c,_0x1dc5c2){return function(_0x14dcec){if(_0x14dcec){return _0x14dcec[_0x6a3d('0x2c')]()[_0x6a3d('0x2b')](function(){var _0xe33e50=_0x14dcec[_0x6a3d('0x2d')]({'plain':!![]});var _0x124114='Lists';return db[_0x6a3d('0x2e')][_0x6a3d('0x2c')]({'where':{'type':_0x124114,'resourceId':_0xe33e50['id']}})[_0x6a3d('0x2b')](function(){return _0x14dcec;});})['then'](function(){_0x214a6c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3217b7,_0x3a7969){return function(_0x1aa418){if(!_0x1aa418){_0x3217b7[_0x6a3d('0x20')](0x194);}return _0x1aa418;};}function handleError(_0x409f92,_0x36430f){_0x36430f=_0x36430f||0x1f4;return function(_0xd64322){logger[_0x6a3d('0x2f')](_0xd64322['stack']);if(_0xd64322[_0x6a3d('0x30')]){delete _0xd64322[_0x6a3d('0x30')];}_0x409f92[_0x6a3d('0x21')](_0x36430f)[_0x6a3d('0x31')](_0xd64322);};}exports[_0x6a3d('0x32')]=function(_0x3f8012,_0x1e17b4){var _0x4d01db={},_0x142b58={},_0x201908={'count':0x0,'rows':[]};var _0x3ade11=_[_0x6a3d('0x33')](db[_0x6a3d('0x34')][_0x6a3d('0x35')],function(_0x39f87c){return{'name':_0x39f87c[_0x6a3d('0x36')],'type':_0x39f87c[_0x6a3d('0x37')][_0x6a3d('0x38')]};});_0x142b58[_0x6a3d('0x39')]=_[_0x6a3d('0x33')](_0x3ade11,_0x6a3d('0x30'));_0x142b58[_0x6a3d('0x3a')]=_[_0x6a3d('0x3b')](_0x3f8012[_0x6a3d('0x3a')]);_0x142b58[_0x6a3d('0x3c')]=_[_0x6a3d('0x3d')](_0x142b58[_0x6a3d('0x39')],_0x142b58[_0x6a3d('0x3a')]);_0x4d01db[_0x6a3d('0x3e')]=_[_0x6a3d('0x3d')](_0x142b58['model'],qs[_0x6a3d('0x3f')](_0x3f8012[_0x6a3d('0x3a')][_0x6a3d('0x3f')]));_0x4d01db[_0x6a3d('0x3e')]=_0x4d01db[_0x6a3d('0x3e')]['length']?_0x4d01db[_0x6a3d('0x3e')]:_0x142b58[_0x6a3d('0x39')];if(!_0x3f8012[_0x6a3d('0x3a')]['hasOwnProperty'](_0x6a3d('0x40'))){_0x4d01db[_0x6a3d('0x25')]=qs[_0x6a3d('0x25')](_0x3f8012[_0x6a3d('0x3a')][_0x6a3d('0x25')]);_0x4d01db['offset']=qs[_0x6a3d('0x23')](_0x3f8012['query'][_0x6a3d('0x23')]);}_0x4d01db[_0x6a3d('0x41')]=qs[_0x6a3d('0x42')](_0x3f8012[_0x6a3d('0x3a')]['sort']);_0x4d01db[_0x6a3d('0x43')]=qs[_0x6a3d('0x3c')](_[_0x6a3d('0x44')](_0x3f8012[_0x6a3d('0x3a')],_0x142b58[_0x6a3d('0x3c')]),_0x3ade11);if(_0x3f8012[_0x6a3d('0x3a')][_0x6a3d('0x45')]){_0x4d01db['where']=_[_0x6a3d('0x46')](_0x4d01db['where'],{'$or':_[_0x6a3d('0x33')](_0x3ade11,function(_0x3c7b41){if(_0x3c7b41['type']!=='VIRTUAL'){var _0x1ee1ba={};_0x1ee1ba[_0x3c7b41[_0x6a3d('0x30')]]={'$like':'%'+_0x3f8012[_0x6a3d('0x3a')][_0x6a3d('0x45')]+'%'};return _0x1ee1ba;}})});}_0x4d01db=_[_0x6a3d('0x46')]({},_0x4d01db,_0x3f8012[_0x6a3d('0x47')]);var _0x519103={'where':_0x4d01db['where']};return db['CmList']['count'](_0x519103)[_0x6a3d('0x2b')](function(_0x4d7563){_0x201908[_0x6a3d('0x26')]=_0x4d7563;if(_0x3f8012['query'][_0x6a3d('0x48')]){_0x4d01db[_0x6a3d('0x49')]=[{'all':!![]}];}return db['CmList'][_0x6a3d('0x4a')](_0x4d01db);})[_0x6a3d('0x2b')](function(_0x19de21){_0x201908[_0x6a3d('0x4b')]=_0x19de21;return _0x201908;})['then'](respondWithFilteredResult(_0x1e17b4,_0x4d01db))[_0x6a3d('0x4c')](handleError(_0x1e17b4,null));};exports[_0x6a3d('0x4d')]=function(_0x22cfdf,_0x555845){var _0x3e7138={'raw':![],'where':{'id':_0x22cfdf['params']['id']}},_0x55f10a={};_0x55f10a['model']=_[_0x6a3d('0x3b')](db[_0x6a3d('0x34')]['rawAttributes']);_0x55f10a['query']=_['keys'](_0x22cfdf[_0x6a3d('0x3a')]);_0x55f10a[_0x6a3d('0x3c')]=_[_0x6a3d('0x3d')](_0x55f10a[_0x6a3d('0x39')],_0x55f10a['query']);_0x3e7138[_0x6a3d('0x3e')]=_[_0x6a3d('0x3d')](_0x55f10a['model'],qs[_0x6a3d('0x3f')](_0x22cfdf[_0x6a3d('0x3a')]['fields']));_0x3e7138[_0x6a3d('0x3e')]=_0x3e7138['attributes'][_0x6a3d('0x4e')]?_0x3e7138[_0x6a3d('0x3e')]:_0x55f10a[_0x6a3d('0x39')];if(_0x22cfdf[_0x6a3d('0x3a')][_0x6a3d('0x48')]){_0x3e7138[_0x6a3d('0x49')]=[{'all':!![]}];}_0x3e7138=_['merge']({},_0x3e7138,_0x22cfdf[_0x6a3d('0x47')]);return db[_0x6a3d('0x34')]['find'](_0x3e7138)['then'](handleEntityNotFound(_0x555845,null))[_0x6a3d('0x2b')](respondWithResult(_0x555845,null))[_0x6a3d('0x4c')](handleError(_0x555845,null));};exports['create']=function(_0x40b612,_0x5e3a8a){return db[_0x6a3d('0x34')][_0x6a3d('0x4f')](_0x40b612[_0x6a3d('0x50')],{})['then'](function(_0x2a6732){var _0x4304a8=_0x40b612[_0x6a3d('0x51')][_0x6a3d('0x2d')]({'plain':!![]});if(!_0x4304a8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4304a8[_0x6a3d('0x52')]===_0x6a3d('0x51')){var _0xc17051=_0x2a6732[_0x6a3d('0x2d')]({'plain':!![]});var _0x19c57b=_0x6a3d('0x53');return db[_0x6a3d('0x54')][_0x6a3d('0x55')]({'where':{'name':_0x19c57b,'userProfileId':_0x4304a8[_0x6a3d('0x56')]},'raw':!![]})['then'](function(_0x256bb3){if(_0x256bb3&&_0x256bb3[_0x6a3d('0x57')]===0x0){return db[_0x6a3d('0x2e')][_0x6a3d('0x4f')]({'name':_0xc17051[_0x6a3d('0x30')],'resourceId':_0xc17051['id'],'type':_0x256bb3['name'],'sectionId':_0x256bb3['id']},{})[_0x6a3d('0x2b')](function(){return _0x2a6732;});}else{return _0x2a6732;}})[_0x6a3d('0x4c')](function(_0x2c3d8f){logger[_0x6a3d('0x2f')](_0x6a3d('0x58'),_0x2c3d8f);throw _0x2c3d8f;});}return _0x2a6732;})['then'](respondWithResult(_0x5e3a8a,0xc9))['catch'](handleError(_0x5e3a8a,null));};exports[_0x6a3d('0x2a')]=function(_0x3dc2d6,_0x1cc838){if(_0x3dc2d6[_0x6a3d('0x50')]['id']){delete _0x3dc2d6[_0x6a3d('0x50')]['id'];}return db['CmList'][_0x6a3d('0x55')]({'where':{'id':_0x3dc2d6[_0x6a3d('0x59')]['id']}})['then'](handleEntityNotFound(_0x1cc838,null))['then'](saveUpdates(_0x3dc2d6['body'],null))[_0x6a3d('0x2b')](respondWithResult(_0x1cc838,null))[_0x6a3d('0x4c')](handleError(_0x1cc838,null));};exports[_0x6a3d('0x2c')]=function(_0x1dd8d4,_0x5e7799){return db[_0x6a3d('0x34')]['find']({'where':{'id':_0x1dd8d4['params']['id']}})['then'](handleEntityNotFound(_0x5e7799,null))[_0x6a3d('0x2b')](removeEntity(_0x5e7799,null))['catch'](handleError(_0x5e7799,null));};exports[_0x6a3d('0x5a')]=function(_0x357f3a,_0x2c4b37){return db['CmList']['describe']()[_0x6a3d('0x2b')](respondWithResult(_0x2c4b37,null))['catch'](handleError(_0x2c4b37,null));};exports['addDisposition']=function(_0x56f750,_0x2a545f,_0x4e35e9){if(_0x56f750[_0x6a3d('0x50')]['id']){delete _0x56f750[_0x6a3d('0x50')]['id'];}return db[_0x6a3d('0x34')][_0x6a3d('0x55')]({'where':{'id':_0x56f750[_0x6a3d('0x59')]['id']}})[_0x6a3d('0x2b')](handleEntityNotFound(_0x2a545f,null))[_0x6a3d('0x2b')](function(_0x57ec8d){if(_0x57ec8d){_0x56f750['body'][_0x6a3d('0x5b')]=_0x57ec8d['id'];return db[_0x6a3d('0x5c')][_0x6a3d('0x4f')](_0x56f750[_0x6a3d('0x50')]);}})['then'](respondWithResult(_0x2a545f,null))[_0x6a3d('0x4c')](handleError(_0x2a545f,null));};exports[_0x6a3d('0x5d')]=function(_0x55f8b1,_0x502bb3,_0x5aa378){var _0x5dc4aa={'raw':![],'where':{}};var _0x56566c={};var _0x42ec30={'count':0x0,'rows':[]};return db[_0x6a3d('0x34')][_0x6a3d('0x5e')]({'where':{'id':_0x55f8b1[_0x6a3d('0x59')]['id']}})[_0x6a3d('0x2b')](handleEntityNotFound(_0x502bb3,null))[_0x6a3d('0x2b')](function(_0x32d8db){if(_0x32d8db){_0x56566c[_0x6a3d('0x39')]=_['keys'](db[_0x6a3d('0x5c')]['rawAttributes']);_0x56566c[_0x6a3d('0x3a')]=_[_0x6a3d('0x3b')](_0x55f8b1[_0x6a3d('0x3a')]);_0x56566c[_0x6a3d('0x3c')]=_[_0x6a3d('0x3d')](_0x56566c[_0x6a3d('0x39')],_0x56566c[_0x6a3d('0x3a')]);_0x5dc4aa[_0x6a3d('0x3e')]=_[_0x6a3d('0x3d')](_0x56566c[_0x6a3d('0x39')],qs['fields'](_0x55f8b1['query']['fields']));_0x5dc4aa[_0x6a3d('0x3e')]=_0x5dc4aa[_0x6a3d('0x3e')]['length']?_0x5dc4aa[_0x6a3d('0x3e')]:_0x56566c[_0x6a3d('0x39')];if(!_0x55f8b1['query'][_0x6a3d('0x5f')]('nolimit')){_0x5dc4aa[_0x6a3d('0x25')]=qs[_0x6a3d('0x25')](_0x55f8b1[_0x6a3d('0x3a')][_0x6a3d('0x25')]);_0x5dc4aa['offset']=qs['offset'](_0x55f8b1[_0x6a3d('0x3a')][_0x6a3d('0x23')]);}_0x5dc4aa[_0x6a3d('0x41')]=qs[_0x6a3d('0x42')](_0x55f8b1[_0x6a3d('0x3a')][_0x6a3d('0x42')]);_0x5dc4aa[_0x6a3d('0x43')]=qs[_0x6a3d('0x3c')](_['pick'](_0x55f8b1[_0x6a3d('0x3a')],_0x56566c['filters']));_0x5dc4aa[_0x6a3d('0x43')][_0x6a3d('0x5b')]=_0x32d8db['id'];if(_0x55f8b1[_0x6a3d('0x3a')][_0x6a3d('0x45')]){_0x5dc4aa[_0x6a3d('0x43')]=_['merge'](_0x5dc4aa[_0x6a3d('0x43')],{'$or':_['map'](_0x5dc4aa['attributes'],function(_0x56731f){var _0x2ff7df={};_0x2ff7df[_0x56731f]={'$like':'%'+_0x55f8b1['query']['filter']+'%'};return _0x2ff7df;})});}_0x5dc4aa=_['merge']({},_0x5dc4aa,_0x55f8b1[_0x6a3d('0x47')]);return db[_0x6a3d('0x5c')][_0x6a3d('0x26')]({'where':_0x5dc4aa[_0x6a3d('0x43')]})[_0x6a3d('0x2b')](function(_0x5432ef){_0x42ec30[_0x6a3d('0x26')]=_0x5432ef;if(_0x55f8b1[_0x6a3d('0x3a')][_0x6a3d('0x48')]){_0x5dc4aa[_0x6a3d('0x49')]=[{'all':!![]}];}return db[_0x6a3d('0x5c')][_0x6a3d('0x4a')](_0x5dc4aa);})['then'](function(_0x1cb0a6){_0x42ec30[_0x6a3d('0x4b')]=_0x1cb0a6;return _0x42ec30;});}})[_0x6a3d('0x2b')](respondWithFilteredResult(_0x502bb3,_0x5dc4aa))[_0x6a3d('0x4c')](handleError(_0x502bb3,null));};exports[_0x6a3d('0x60')]=function(_0x43f05c,_0x2022b8,_0xf73268){return db[_0x6a3d('0x34')]['find']({'where':{'id':_0x43f05c['params']['id']}})[_0x6a3d('0x2b')](handleEntityNotFound(_0x2022b8,null))[_0x6a3d('0x2b')](function(_0xc4cae7){if(_0xc4cae7){return _0xc4cae7[_0x6a3d('0x60')](_0x43f05c[_0x6a3d('0x3a')][_0x6a3d('0x61')]);}})[_0x6a3d('0x2b')](respondWithStatusCode(_0x2022b8,null))[_0x6a3d('0x4c')](handleError(_0x2022b8,null));};exports['addContacts']=function(_0x5230e5,_0x3f4c3b,_0x55c8df){return db[_0x6a3d('0x34')][_0x6a3d('0x55')]({'where':{'id':_0x5230e5[_0x6a3d('0x59')]['id']}})[_0x6a3d('0x2b')](handleEntityNotFound(_0x3f4c3b,null))[_0x6a3d('0x2b')](function(_0x41ec90){if(_0x41ec90){var _0x251010=[];var _0x274f3f={'success':[],'errors':[]};return db['CmContact'][_0x6a3d('0x5a')]()[_0x6a3d('0x2b')](function(_0x4ba188){if(_0x5230e5[_0x6a3d('0x50')]['tags']&&_[_0x6a3d('0x62')](_0x5230e5[_0x6a3d('0x50')][_0x6a3d('0x63')])){if(_0x5230e5[_0x6a3d('0x50')][_0x6a3d('0x63')][_0x6a3d('0x4e')]){_0x5230e5[_0x6a3d('0x50')][_0x6a3d('0x63')]=_0x5230e5[_0x6a3d('0x50')]['tags'][_0x6a3d('0x64')](';')+';';}else{_0x5230e5[_0x6a3d('0x50')]['tags']=null;}}else{_0x5230e5[_0x6a3d('0x50')]['tags']=null;}if(_0x5230e5['body']&&_[_0x6a3d('0x62')](_0x5230e5['body'])){for(var _0x6b8e15=0x0;_0x6b8e15<_0x5230e5[_0x6a3d('0x50')][_0x6a3d('0x4e')];_0x6b8e15+=0x1){_0x5230e5['body'][_0x6b8e15][_0x6a3d('0x5b')]=_0x5230e5['params']['id'];_0x251010[_0x6a3d('0x65')](_0x5230e5[_0x6a3d('0x50')][_0x6b8e15]);}return BPromise[_0x6a3d('0x66')](_0x251010,function(_0x473743){return db[_0x6a3d('0x67')][_0x6a3d('0x4f')](_[_0x6a3d('0x68')](_0x473743,[_0x6a3d('0x61'),'id'])||{},{'fields':_['keys'](_0x4ba188),'raw':!![]})['then'](function(_0x56095b){_0x274f3f[_0x6a3d('0x69')][_0x6a3d('0x65')](_0x56095b[_0x6a3d('0x6a')]);})[_0x6a3d('0x4c')](function(_0x13a4c4){_0x274f3f[_0x6a3d('0x6b')][_0x6a3d('0x65')]({'data':_0x473743,'error':_0x13a4c4[_0x6a3d('0x6c')]});});})[_0x6a3d('0x2b')](function(_0x2a6aec){return _0x274f3f;})['catch'](function(_0x1ab398){return _0x1ab398;});}else{_0x3f4c3b[_0x6a3d('0x21')](0x190)['json']({'message':'Malformed\x20request\x20syntax'});}});}})[_0x6a3d('0x2b')](respondWithResult(_0x3f4c3b,null))[_0x6a3d('0x4c')](handleError(_0x3f4c3b,null));};exports[_0x6a3d('0x6d')]=function(_0x34e224,_0x411767,_0x4ad7fd){var _0x911251;return db[_0x6a3d('0x34')][_0x6a3d('0x55')]({'where':{'id':_0x34e224[_0x6a3d('0x59')]['id']},'include':[{'model':db[_0x6a3d('0x6e')],'as':_0x6a3d('0x6f')}]})[_0x6a3d('0x2b')](handleEntityNotFound(_0x411767,null))[_0x6a3d('0x2b')](function(_0x41cda8){if(_0x41cda8){_0x911251=_0x41cda8;return db[_0x6a3d('0x67')][_0x6a3d('0x35')];}})[_0x6a3d('0x2b')](function(_0x1efe1d){if(_0x1efe1d){var _0x3e68a5={};var _0x5e81f7={};_0x5e81f7[_0x6a3d('0x39')]=_['concat'](_[_0x6a3d('0x3b')](_0x1efe1d),_['map'](_0x911251[_0x6a3d('0x6f')],function(_0x151e23){return util['format'](_0x6a3d('0x70'),_0x151e23['id']);}));_0x5e81f7['query']=_['keys'](_0x34e224[_0x6a3d('0x3a')]);_0x5e81f7[_0x6a3d('0x3c')]=_[_0x6a3d('0x3d')](_0x5e81f7[_0x6a3d('0x39')],_0x5e81f7[_0x6a3d('0x3a')]);_0x3e68a5[_0x6a3d('0x3e')]=_['intersection'](_0x5e81f7[_0x6a3d('0x39')],qs[_0x6a3d('0x3f')](_0x34e224[_0x6a3d('0x3a')][_0x6a3d('0x3f')]));_0x3e68a5[_0x6a3d('0x3e')]=_0x3e68a5[_0x6a3d('0x3e')][_0x6a3d('0x4e')]?_0x3e68a5[_0x6a3d('0x3e')]:_0x5e81f7[_0x6a3d('0x39')];if(!_0x34e224[_0x6a3d('0x3a')]['hasOwnProperty'](_0x6a3d('0x40'))){_0x3e68a5['limit']=qs[_0x6a3d('0x25')](_0x34e224[_0x6a3d('0x3a')][_0x6a3d('0x25')]);_0x3e68a5[_0x6a3d('0x23')]=qs[_0x6a3d('0x23')](_0x34e224[_0x6a3d('0x3a')][_0x6a3d('0x23')]);}_0x3e68a5[_0x6a3d('0x41')]=qs[_0x6a3d('0x42')](_0x34e224[_0x6a3d('0x3a')][_0x6a3d('0x42')]);_0x3e68a5[_0x6a3d('0x43')]=qs['filters'](_[_0x6a3d('0x44')](_0x34e224[_0x6a3d('0x3a')],_0x5e81f7['filters']));_0x3e68a5[_0x6a3d('0x71')]=!![];if(_0x34e224[_0x6a3d('0x3a')][_0x6a3d('0x45')]){_0x3e68a5[_0x6a3d('0x43')]=_[_0x6a3d('0x46')](_0x3e68a5[_0x6a3d('0x43')],{'$or':_['map'](_0x3e68a5[_0x6a3d('0x3e')],function(_0x3a7841){var _0xa8f2e3={};_0xa8f2e3[_0x3a7841]={'$like':'%'+_0x34e224[_0x6a3d('0x3a')]['filter']+'%'};return _0xa8f2e3;})});}_0x3e68a5=_[_0x6a3d('0x46')]({},_0x3e68a5,_0x34e224[_0x6a3d('0x47')]);return _0x911251['getContacts'](_0x3e68a5);}})[_0x6a3d('0x2b')](respondWithResult(_0x411767,null))[_0x6a3d('0x4c')](handleError(_0x411767,null));};exports['getContactsCsv']=function(_0x2f22b5,_0x3657b9,_0x3563f8){var _0x509c01;return db[_0x6a3d('0x34')][_0x6a3d('0x55')]({'where':{'id':_0x2f22b5['params']['id']},'include':[{'model':db[_0x6a3d('0x6e')],'as':_0x6a3d('0x6f')}]})[_0x6a3d('0x2b')](handleEntityNotFound(_0x3657b9,null))[_0x6a3d('0x2b')](function(_0x168a96){if(_0x168a96){_0x509c01=_0x168a96;return db[_0x6a3d('0x67')][_0x6a3d('0x35')];}})['then'](function(_0x56992a){if(_0x56992a){var _0x3519af={};var _0x27980c={};_0x27980c[_0x6a3d('0x39')]=_[_0x6a3d('0x72')](_['keys'](_0x56992a),_[_0x6a3d('0x33')](_0x509c01[_0x6a3d('0x6f')],function(_0x1aadf2){return util['format'](_0x6a3d('0x70'),_0x1aadf2['id']);}));_0x27980c['query']=_['keys'](_0x2f22b5['query']);_0x27980c[_0x6a3d('0x3c')]=_[_0x6a3d('0x3d')](_0x27980c[_0x6a3d('0x39')],_0x27980c[_0x6a3d('0x3a')]);_0x3519af[_0x6a3d('0x3e')]=_[_0x6a3d('0x3d')](_0x27980c[_0x6a3d('0x39')],qs[_0x6a3d('0x3f')](_0x2f22b5[_0x6a3d('0x3a')][_0x6a3d('0x3f')]));_0x3519af[_0x6a3d('0x3e')]=_0x3519af['attributes'][_0x6a3d('0x4e')]?_0x3519af[_0x6a3d('0x3e')]:_0x27980c[_0x6a3d('0x39')];if(!_0x2f22b5[_0x6a3d('0x3a')][_0x6a3d('0x5f')](_0x6a3d('0x40'))){_0x3519af[_0x6a3d('0x25')]=qs[_0x6a3d('0x25')](_0x2f22b5[_0x6a3d('0x3a')][_0x6a3d('0x25')]);_0x3519af[_0x6a3d('0x23')]=qs[_0x6a3d('0x23')](_0x2f22b5[_0x6a3d('0x3a')]['offset']);}_0x3519af[_0x6a3d('0x41')]=qs['sort'](_0x2f22b5[_0x6a3d('0x3a')][_0x6a3d('0x42')]);_0x3519af['where']=qs[_0x6a3d('0x3c')](_[_0x6a3d('0x44')](_0x2f22b5[_0x6a3d('0x3a')],_0x27980c[_0x6a3d('0x3c')]));_0x3519af[_0x6a3d('0x71')]=!![];if(_0x2f22b5[_0x6a3d('0x3a')][_0x6a3d('0x45')]){_0x3519af[_0x6a3d('0x43')]=_['merge'](_0x3519af['where'],{'$or':_[_0x6a3d('0x33')](_0x3519af[_0x6a3d('0x3e')],function(_0x1958ee){var _0x2ac313={};_0x2ac313[_0x1958ee]={'$like':'%'+_0x2f22b5['query'][_0x6a3d('0x45')]+'%'};return _0x2ac313;})});}_0x3519af=_[_0x6a3d('0x46')]({},_0x3519af,_0x2f22b5['options']);return _0x509c01[_0x6a3d('0x6d')](_0x3519af);}})[_0x6a3d('0x2b')](function(_0x5534d2){if(!_[_0x6a3d('0x73')](_0x5534d2)){var _0x7438fc=toCsv(_0x5534d2);var _0x21cd21=Date['now']();fs[_0x6a3d('0x74')](util[_0x6a3d('0x75')](_0x6a3d('0x76'),_0x509c01['id'],_0x21cd21),_0x7438fc);_0x3657b9[_0x6a3d('0x77')](_0x6a3d('0x78'),_0x6a3d('0x79')+util[_0x6a3d('0x75')](_0x6a3d('0x7a'),_0x509c01['id'],_0x21cd21));_0x3657b9['setHeader']('Content-type','text/csv');return _0x3657b9[_0x6a3d('0x7b')](util[_0x6a3d('0x75')](_0x6a3d('0x76'),_0x509c01['id'],_0x21cd21));}else{return _0x3657b9[_0x6a3d('0x20')](0xcc);}})['catch'](handleError(_0x3657b9,null));};exports['addCustomField']=function(_0x1f2f86,_0xd42fd9,_0x268f7b){var _0x3370eb;delete _0x1f2f86[_0x6a3d('0x50')]['id'];return db[_0x6a3d('0x34')][_0x6a3d('0x5e')]({'where':{'id':_0x1f2f86[_0x6a3d('0x59')]['id']}})['then'](handleEntityNotFound(_0xd42fd9,null))[_0x6a3d('0x2b')](function(_0x1c465d){if(_0x1c465d){return db[_0x6a3d('0x7c')][_0x6a3d('0x7d')](function(_0x18250e){return db['CmCustomField'][_0x6a3d('0x4f')](_0x1f2f86[_0x6a3d('0x50')],{'transaction':_0x18250e})[_0x6a3d('0x2b')](function(_0x31edfb){_0x3370eb=_0x31edfb;return _0x1c465d[_0x6a3d('0x7e')](_0x31edfb,{'transaction':_0x18250e});})[_0x6a3d('0x2b')](function(){var _0x1647e3={'type':db[_0x6a3d('0x7f')][_0x6a3d('0x80')],'transaction':_0x18250e};switch(_0x1f2f86['body'][_0x6a3d('0x37')]){case _0x6a3d('0x81'):_0x1647e3[_0x6a3d('0x37')]=db[_0x6a3d('0x7f')]['TEXT'];break;case _0x6a3d('0x82'):_0x1647e3[_0x6a3d('0x37')]=db[_0x6a3d('0x7f')][_0x6a3d('0x83')];break;case _0x6a3d('0x84'):_0x1647e3['type']=db[_0x6a3d('0x7f')][_0x6a3d('0x85')];_0x1647e3[_0x6a3d('0x86')]=![];break;default:}return db['sequelize']['queryInterface'][_0x6a3d('0x87')](_0x6a3d('0x88'),util[_0x6a3d('0x75')](_0x6a3d('0x89'),_0x3370eb['id']),_0x1647e3);})['then'](function(){return _0x3370eb;});});}})[_0x6a3d('0x2b')](respondWithResult(_0xd42fd9,null))[_0x6a3d('0x4c')](handleError(_0xd42fd9,null));};exports[_0x6a3d('0x8a')]=function(_0x2ce33d,_0x5926fc,_0x297da0){var _0x32a475={};var _0x4b040f={};var _0x40972a;var _0x2493fb;return db[_0x6a3d('0x34')][_0x6a3d('0x5e')]({'where':{'id':_0x2ce33d[_0x6a3d('0x59')]['id']}})[_0x6a3d('0x2b')](handleEntityNotFound(_0x5926fc,null))[_0x6a3d('0x2b')](function(_0x3482cb){if(_0x3482cb){_0x40972a=_0x3482cb;_0x4b040f[_0x6a3d('0x39')]=_[_0x6a3d('0x3b')](db[_0x6a3d('0x6e')]['rawAttributes']);_0x4b040f[_0x6a3d('0x3a')]=_['keys'](_0x2ce33d[_0x6a3d('0x3a')]);_0x4b040f['filters']=_[_0x6a3d('0x3d')](_0x4b040f[_0x6a3d('0x39')],_0x4b040f[_0x6a3d('0x3a')]);_0x32a475[_0x6a3d('0x3e')]=_[_0x6a3d('0x3d')](_0x4b040f[_0x6a3d('0x39')],qs[_0x6a3d('0x3f')](_0x2ce33d[_0x6a3d('0x3a')][_0x6a3d('0x3f')]));_0x32a475[_0x6a3d('0x3e')]=_0x32a475[_0x6a3d('0x3e')][_0x6a3d('0x4e')]?_0x32a475[_0x6a3d('0x3e')]:_0x4b040f[_0x6a3d('0x39')];_0x32a475['order']=qs[_0x6a3d('0x42')](_0x2ce33d[_0x6a3d('0x3a')]['sort']);_0x32a475[_0x6a3d('0x43')]=qs[_0x6a3d('0x3c')](_[_0x6a3d('0x44')](_0x2ce33d[_0x6a3d('0x3a')],_0x4b040f[_0x6a3d('0x3c')]));_0x32a475[_0x6a3d('0x43')]=_['merge'](_0x32a475[_0x6a3d('0x43')],{'$or':[{'ListId':_0x3482cb['id']},{'ListId':null}]});if(_0x2ce33d[_0x6a3d('0x3a')]['filter']){_0x32a475['where']=_['merge'](_0x32a475[_0x6a3d('0x43')],{'$or':_[_0x6a3d('0x33')](_0x32a475[_0x6a3d('0x3e')],function(_0x55dd57){var _0x7c102={};_0x7c102[_0x55dd57]={'$like':'%'+_0x2ce33d[_0x6a3d('0x3a')][_0x6a3d('0x45')]+'%'};return _0x7c102;})});}_0x32a475=_[_0x6a3d('0x46')]({},_0x32a475,_0x2ce33d['options']);return db[_0x6a3d('0x6e')]['findAndCountAll'](_0x32a475);}})['then'](respondWithResult(_0x5926fc,null))[_0x6a3d('0x4c')](handleError(_0x5926fc,null));};exports['addAgents']=function(_0x506745,_0x34cd02,_0x5638fb){return db[_0x6a3d('0x34')][_0x6a3d('0x55')]({'where':{'id':_0x506745[_0x6a3d('0x59')]['id']}})['then'](handleEntityNotFound(_0x34cd02,null))['then'](function(_0x5e2cae){if(_0x5e2cae){return _0x5e2cae[_0x6a3d('0x8b')](_0x506745['body'][_0x6a3d('0x61')],_['omit'](_0x506745[_0x6a3d('0x50')],[_0x6a3d('0x61'),'id'])||{})[_0x6a3d('0x8c')](function(_0x16c231){for(var _0x1a1c5b=0x0;_0x1a1c5b<_0x506745[_0x6a3d('0x50')][_0x6a3d('0x61')]['length'];_0x1a1c5b+=0x1){socket['emit'](_0x6a3d('0x8d'),{'UserId':Number(_0x506745['body'][_0x6a3d('0x61')][_0x1a1c5b]),'CmListId':Number(_0x506745[_0x6a3d('0x59')]['id'])});}return _0x16c231;});}})[_0x6a3d('0x2b')](respondWithResult(_0x34cd02,null))['catch'](handleError(_0x34cd02,null));};exports[_0x6a3d('0x8e')]=function(_0x2c8960,_0x17b605,_0x131cda){return db[_0x6a3d('0x34')][_0x6a3d('0x55')]({'where':{'id':_0x2c8960[_0x6a3d('0x59')]['id']}})['then'](handleEntityNotFound(_0x17b605,null))[_0x6a3d('0x2b')](function(_0x1e10e0){if(_0x1e10e0){return _0x1e10e0['removeAgents'](_0x2c8960[_0x6a3d('0x3a')]['ids'])[_0x6a3d('0x2b')](function(){if(_[_0x6a3d('0x62')](_0x2c8960[_0x6a3d('0x3a')][_0x6a3d('0x61')])){for(var _0x112508=0x0;_0x112508<_0x2c8960[_0x6a3d('0x3a')]['ids'][_0x6a3d('0x4e')];_0x112508+=0x1){socket['emit'](_0x6a3d('0x8f'),{'UserId':Number(_0x2c8960['query']['ids'][_0x112508]),'CmListId':Number(_0x2c8960[_0x6a3d('0x59')]['id'])});}}else{socket[_0x6a3d('0x90')](_0x6a3d('0x8f'),{'UserId':Number(_0x2c8960[_0x6a3d('0x3a')][_0x6a3d('0x61')]),'CmListId':Number(_0x2c8960[_0x6a3d('0x59')]['id'])});}});}})[_0x6a3d('0x2b')](respondWithStatusCode(_0x17b605,null))['catch'](handleError(_0x17b605,null));};exports[_0x6a3d('0x91')]=function(_0x2be212,_0x2a186e,_0x2f6cc3){var _0x35d6b6={};var _0x1ccf7e={};var _0x552a91;var _0x5b2747;return db[_0x6a3d('0x34')]['findOne']({'where':{'id':_0x2be212[_0x6a3d('0x59')]['id']}})['then'](handleEntityNotFound(_0x2a186e,null))[_0x6a3d('0x2b')](function(_0x14175){if(_0x14175){_0x552a91=_0x14175;_0x1ccf7e[_0x6a3d('0x39')]=_[_0x6a3d('0x3b')](db[_0x6a3d('0x92')]['rawAttributes']);_0x1ccf7e[_0x6a3d('0x3a')]=_[_0x6a3d('0x3b')](_0x2be212[_0x6a3d('0x3a')]);_0x1ccf7e[_0x6a3d('0x3c')]=_[_0x6a3d('0x3d')](_0x1ccf7e[_0x6a3d('0x39')],_0x1ccf7e[_0x6a3d('0x3a')]);_0x35d6b6[_0x6a3d('0x3e')]=_[_0x6a3d('0x3d')](_0x1ccf7e[_0x6a3d('0x39')],qs[_0x6a3d('0x3f')](_0x2be212[_0x6a3d('0x3a')][_0x6a3d('0x3f')]));_0x35d6b6[_0x6a3d('0x3e')]=_0x35d6b6[_0x6a3d('0x3e')][_0x6a3d('0x4e')]?_0x35d6b6[_0x6a3d('0x3e')]:_0x1ccf7e[_0x6a3d('0x39')];_0x35d6b6['order']=qs['sort'](_0x2be212['query']['sort']);_0x35d6b6[_0x6a3d('0x43')]=qs[_0x6a3d('0x3c')](_[_0x6a3d('0x44')](_0x2be212['query'],_0x1ccf7e[_0x6a3d('0x3c')]));if(_0x2be212[_0x6a3d('0x3a')][_0x6a3d('0x45')]){_0x35d6b6[_0x6a3d('0x43')]=_['merge'](_0x35d6b6['where'],{'$or':_[_0x6a3d('0x33')](_0x35d6b6[_0x6a3d('0x3e')],function(_0x2312e1){var _0x220327={};_0x220327[_0x2312e1]={'$like':'%'+_0x2be212[_0x6a3d('0x3a')][_0x6a3d('0x45')]+'%'};return _0x220327;})});}_0x35d6b6=_[_0x6a3d('0x46')]({},_0x35d6b6,_0x2be212[_0x6a3d('0x47')]);return _0x552a91[_0x6a3d('0x91')](_0x35d6b6);}})['then'](function(_0x46d29e){if(_0x46d29e){_0x5b2747=_0x46d29e[_0x6a3d('0x4e')];if(!_0x2be212[_0x6a3d('0x3a')][_0x6a3d('0x5f')](_0x6a3d('0x40'))){_0x35d6b6[_0x6a3d('0x25')]=qs[_0x6a3d('0x25')](_0x2be212[_0x6a3d('0x3a')][_0x6a3d('0x25')]);_0x35d6b6[_0x6a3d('0x23')]=qs[_0x6a3d('0x23')](_0x2be212[_0x6a3d('0x3a')][_0x6a3d('0x23')]);}return _0x552a91[_0x6a3d('0x91')](_0x35d6b6);}})[_0x6a3d('0x2b')](function(_0xfe09e1){if(_0xfe09e1){return _0xfe09e1?{'count':_0x5b2747,'rows':_0xfe09e1}:null;}})[_0x6a3d('0x2b')](respondWithResult(_0x2a186e,null))[_0x6a3d('0x4c')](handleError(_0x2a186e,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 6c911c9..85c2120 100644 --- a/server/api/cmList/cmList.events.js +++ b/server/api/cmList/cmList.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','CmList'];(function(_0x557463,_0x1f72d4){var _0xe19022=function(_0x365111){while(--_0x365111){_0x557463['push'](_0x557463['shift']());}};_0xe19022(++_0x1f72d4);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var EventEmitter=require(_0x7995('0x0'));var CmList=require(_0x7995('0x1'))['db'][_0x7995('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0x7995('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7995('0x4'),'afterDestroy':_0x7995('0x5')};function emitEvent(_0x1902b4){return function(_0x462a03,_0x576d89,_0x744bea){CmListEvents[_0x7995('0x6')](_0x1902b4+':'+_0x462a03['id'],_0x462a03);CmListEvents[_0x7995('0x6')](_0x1902b4,_0x462a03);_0x744bea(null);};}for(var e in events){if(events[_0x7995('0x7')](e)){var event=events[e];CmList[_0x7995('0x8')](e,emitEvent(event));}}module[_0x7995('0x9')]=CmListEvents; \ No newline at end of file +var _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(_0x814fb2,_0x11654a){_0x814fb2=_0x814fb2-0x0;var _0xd2127=_0x3e74[_0x814fb2];return _0xd2127;};'use strict';var EventEmitter=require(_0x43e7('0x0'));var CmList=require('../../mysqldb')['db'][_0x43e7('0x1')];var CmListEvents=new EventEmitter();CmListEvents[_0x43e7('0x2')](0x0);var events={'afterCreate':_0x43e7('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xc58479){return function(_0x4f9bbe,_0x128b0f,_0xe838b4){CmListEvents[_0x43e7('0x4')](_0xc58479+':'+_0x4f9bbe['id'],_0x4f9bbe);CmListEvents[_0x43e7('0x4')](_0xc58479,_0x4f9bbe);_0xe838b4(null);};}for(var e in events){if(events[_0x43e7('0x5')](e)){var event=events[e];CmList['hook'](e,emitEvent(event));}}module[_0x43e7('0x6')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 7b5abb1..815f9e0 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 _0xa75b=['request-promise','path','rimraf','../../config/environment','./cmList.attributes','exports','define','CmList','lodash','api','moment','bluebird'];(function(_0x95942,_0x85da80){var _0x6d7f81=function(_0x510549){while(--_0x510549){_0x95942['push'](_0x95942['shift']());}};_0x6d7f81(++_0x85da80);}(_0xa75b,0x170));var _0xba75=function(_0x34dc04,_0x5beb16){_0x34dc04=_0x34dc04-0x0;var _0xddc079=_0xa75b[_0x34dc04];return _0xddc079;};'use strict';var _=require(_0xba75('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xba75('0x1'));var moment=require(_0xba75('0x2'));var BPromise=require(_0xba75('0x3'));var rp=require(_0xba75('0x4'));var fs=require('fs');var path=require(_0xba75('0x5'));var rimraf=require(_0xba75('0x6'));var config=require(_0xba75('0x7'));var attributes=require(_0xba75('0x8'));module[_0xba75('0x9')]=function(_0x41afc9,_0x2baa28){return _0x41afc9[_0xba75('0xa')](_0xba75('0xb'),attributes,{'tableName':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x91a7=['bluebird','path','./cmList.attributes','exports','CmList','cm_lists','util','../../config/logger','api'];(function(_0x237f8b,_0xc5eddb){var _0x423f94=function(_0x1f18f9){while(--_0x1f18f9){_0x237f8b['push'](_0x237f8b['shift']());}};_0x423f94(++_0xc5eddb);}(_0x91a7,0xe7));var _0x791a=function(_0x35cf8e,_0x1f765e){_0x35cf8e=_0x35cf8e-0x0;var _0x730c3f=_0x91a7[_0x35cf8e];return _0x730c3f;};'use strict';var _=require('lodash');var util=require(_0x791a('0x0'));var logger=require(_0x791a('0x1'))(_0x791a('0x2'));var moment=require('moment');var BPromise=require(_0x791a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x791a('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x791a('0x5'));module[_0x791a('0x6')]=function(_0x49a9b7,_0x361f53){return _0x49a9b7['define'](_0x791a('0x7'),attributes,{'tableName':_0x791a('0x8'),'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 f65fc54..83fc607 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 _0x88b1=['request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','localhost','socket.io-emitter','register','request','then','info','CmList,\x20%s,\x20%s','debug','CmList,\x20%s,\x20%s,\x20%s'];(function(_0x42181c,_0x267642){var _0x2e2e20=function(_0x430bad){while(--_0x430bad){_0x42181c['push'](_0x42181c['shift']());}};_0x2e2e20(++_0x267642);}(_0x88b1,0x1c7));var _0x188b=function(_0xe48773,_0x2e8d5b){_0xe48773=_0xe48773-0x0;var _0x295910=_0x88b1[_0xe48773];return _0x295910;};'use strict';var _=require('lodash');var util=require(_0x188b('0x0'));var moment=require(_0x188b('0x1'));var BPromise=require(_0x188b('0x2'));var rs=require(_0x188b('0x3'));var fs=require('fs');var Redis=require(_0x188b('0x4'));var db=require(_0x188b('0x5'))['db'];var utils=require(_0x188b('0x6'));var logger=require(_0x188b('0x7'))(_0x188b('0x8'));var config=require(_0x188b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x188b('0xa')]['http']({'port':0x232a});config[_0x188b('0xb')]=_['defaults'](config[_0x188b('0xb')],{'host':_0x188b('0xc'),'port':0x18eb});var socket=require(_0x188b('0xd'))(new Redis(config[_0x188b('0xb')]));require('./cmList.socket')[_0x188b('0xe')](socket);function respondWithRpcPromise(_0x706c9a,_0x27bed2,_0x311a1c){return new BPromise(function(_0x2a43c5,_0x2e4dfc){return client[_0x188b('0xf')](_0x706c9a,_0x311a1c)[_0x188b('0x10')](function(_0x268245){logger[_0x188b('0x11')](_0x188b('0x12'),_0x27bed2,'request\x20sent');logger[_0x188b('0x13')](_0x188b('0x14'),_0x27bed2,_0x188b('0x15'),JSON[_0x188b('0x16')](_0x268245));if(_0x268245[_0x188b('0x17')]){if(_0x268245[_0x188b('0x17')][_0x188b('0x18')]===0x1f4){logger[_0x188b('0x17')](_0x188b('0x12'),_0x27bed2,_0x268245[_0x188b('0x17')][_0x188b('0x19')]);return _0x2e4dfc(_0x268245[_0x188b('0x17')]['message']);}logger[_0x188b('0x17')](_0x188b('0x12'),_0x27bed2,_0x268245[_0x188b('0x17')][_0x188b('0x19')]);return _0x2a43c5(_0x268245[_0x188b('0x17')][_0x188b('0x19')]);}else{logger[_0x188b('0x11')](_0x188b('0x12'),_0x27bed2,_0x188b('0x15'));_0x2a43c5(_0x268245[_0x188b('0x1a')][_0x188b('0x19')]);}})[_0x188b('0x1b')](function(_0x135e2c){logger['error'](_0x188b('0x12'),_0x27bed2,_0x135e2c);_0x2e4dfc(_0x135e2c);});});} \ No newline at end of file +var _0xba10=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','./cmList.socket','register','then','info','CmList,\x20%s,\x20%s','request\x20sent','error','code','message','catch','lodash','util','moment','bluebird'];(function(_0x5af459,_0x4974ca){var _0x4cefd2=function(_0x27e00e){while(--_0x27e00e){_0x5af459['push'](_0x5af459['shift']());}};_0x4cefd2(++_0x4974ca);}(_0xba10,0x14c));var _0x0ba1=function(_0x4a8f3d,_0x4d2f42){_0x4a8f3d=_0x4a8f3d-0x0;var _0x3c9ba4=_0xba10[_0x4a8f3d];return _0x3c9ba4;};'use strict';var _=require(_0x0ba1('0x0'));var util=require(_0x0ba1('0x1'));var moment=require(_0x0ba1('0x2'));var BPromise=require(_0x0ba1('0x3'));var rs=require(_0x0ba1('0x4'));var fs=require('fs');var Redis=require(_0x0ba1('0x5'));var db=require(_0x0ba1('0x6'))['db'];var utils=require(_0x0ba1('0x7'));var logger=require(_0x0ba1('0x8'))('rpc');var config=require(_0x0ba1('0x9'));var jayson=require(_0x0ba1('0xa'));var client=jayson[_0x0ba1('0xb')][_0x0ba1('0xc')]({'port':0x232a});config[_0x0ba1('0xd')]=_['defaults'](config[_0x0ba1('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0ba1('0xd')]));require(_0x0ba1('0xe'))[_0x0ba1('0xf')](socket);function respondWithRpcPromise(_0x5631a7,_0x885c77,_0x3c07c3){return new BPromise(function(_0x217488,_0xaea259){return client['request'](_0x5631a7,_0x3c07c3)[_0x0ba1('0x10')](function(_0xae88e7){logger[_0x0ba1('0x11')](_0x0ba1('0x12'),_0x885c77,_0x0ba1('0x13'));logger['debug']('CmList,\x20%s,\x20%s,\x20%s',_0x885c77,'request\x20sent',JSON['stringify'](_0xae88e7));if(_0xae88e7[_0x0ba1('0x14')]){if(_0xae88e7[_0x0ba1('0x14')][_0x0ba1('0x15')]===0x1f4){logger[_0x0ba1('0x14')]('CmList,\x20%s,\x20%s',_0x885c77,_0xae88e7[_0x0ba1('0x14')][_0x0ba1('0x16')]);return _0xaea259(_0xae88e7['error']['message']);}logger[_0x0ba1('0x14')](_0x0ba1('0x12'),_0x885c77,_0xae88e7[_0x0ba1('0x14')][_0x0ba1('0x16')]);return _0x217488(_0xae88e7[_0x0ba1('0x14')]['message']);}else{logger[_0x0ba1('0x11')](_0x0ba1('0x12'),_0x885c77,'request\x20sent');_0x217488(_0xae88e7['result'][_0x0ba1('0x16')]);}})[_0x0ba1('0x17')](function(_0x103cca){logger['error'](_0x0ba1('0x12'),_0x885c77,_0x103cca);_0xaea259(_0x103cca);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 0e6b425..7caf446 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 _0x48f8=['register','./cmList.events','save','remove','update','emit'];(function(_0x5c48e4,_0x2ef2ee){var _0x807bc4=function(_0x490181){while(--_0x490181){_0x5c48e4['push'](_0x5c48e4['shift']());}};_0x807bc4(++_0x2ef2ee);}(_0x48f8,0x127));var _0x848f=function(_0x27c156,_0x14ce9b){_0x27c156=_0x27c156-0x0;var _0x4a94af=_0x48f8[_0x27c156];return _0x4a94af;};'use strict';var CmListEvents=require(_0x848f('0x0'));var events=[_0x848f('0x1'),_0x848f('0x2'),_0x848f('0x3')];function createListener(_0x47c32d,_0x55c8d9){return function(_0xdf4cd6){_0x55c8d9[_0x848f('0x4')](_0x47c32d,_0xdf4cd6);};}function removeListener(_0x53051a,_0x429f5b){return function(){CmListEvents['removeListener'](_0x53051a,_0x429f5b);};}exports[_0x848f('0x5')]=function(_0x8d9719){for(var _0x3bbfcc=0x0,_0x5adf3d=events['length'];_0x3bbfcc<_0x5adf3d;_0x3bbfcc++){var _0x2ce49b=events[_0x3bbfcc];var _0xde0611=createListener('cmList:'+_0x2ce49b,_0x8d9719);CmListEvents['on'](_0x2ce49b,_0xde0611);}}; \ No newline at end of file +var _0xaaa2=['cmList:','./cmList.events','save','remove','update','emit','register'];(function(_0x4eb6ec,_0x7f2520){var _0x58881b=function(_0x4f375f){while(--_0x4f375f){_0x4eb6ec['push'](_0x4eb6ec['shift']());}};_0x58881b(++_0x7f2520);}(_0xaaa2,0x190));var _0x2aaa=function(_0x5b00f3,_0x2b03c1){_0x5b00f3=_0x5b00f3-0x0;var _0x5d2d2a=_0xaaa2[_0x5b00f3];return _0x5d2d2a;};'use strict';var CmListEvents=require(_0x2aaa('0x0'));var events=[_0x2aaa('0x1'),_0x2aaa('0x2'),_0x2aaa('0x3')];function createListener(_0x5e096e,_0x2f793f){return function(_0x35ee51){_0x2f793f[_0x2aaa('0x4')](_0x5e096e,_0x35ee51);};}function removeListener(_0x616141,_0x122601){return function(){CmListEvents['removeListener'](_0x616141,_0x122601);};}exports[_0x2aaa('0x5')]=function(_0x11c049){for(var _0x485959=0x0,_0x7dffa8=events['length'];_0x485959<_0x7dffa8;_0x485959++){var _0x27e321=events[_0x485959];var _0x1dc4d9=createListener(_0x2aaa('0x6')+_0x27e321,_0x11c049);CmListEvents['on'](_0x27e321,_0x1dc4d9);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 1931044..ce71536 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 _0x5d71=['fs-extra','../../components/auth/service','./cmList.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','getContacts','/:id/fields','getCustomFields','/:id/users','getAgents','create','post','/:id/contacts','addAgents','update','delete','removeDispositions','exports','multer','path','connect-timeout','Router'];(function(_0x11f78d,_0x58c792){var _0x10568a=function(_0x160a0f){while(--_0x160a0f){_0x11f78d['push'](_0x11f78d['shift']());}};_0x10568a(++_0x58c792);}(_0x5d71,0x175));var _0x15d7=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x5d71[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require(_0x15d7('0x0'));var util=require('util');var path=require(_0x15d7('0x1'));var timeout=require(_0x15d7('0x2'));var express=require('express');var router=express[_0x15d7('0x3')]();var fs_extra=require(_0x15d7('0x4'));var auth=require(_0x15d7('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x15d7('0x6'));router[_0x15d7('0x7')]('/',auth['isAuthenticated'](),controller[_0x15d7('0x8')]);router[_0x15d7('0x7')](_0x15d7('0x9'),auth[_0x15d7('0xa')](),controller[_0x15d7('0xb')]);router[_0x15d7('0x7')](_0x15d7('0xc'),auth['isAuthenticated'](),controller[_0x15d7('0xd')]);router['get'](_0x15d7('0xe'),auth[_0x15d7('0xa')](),controller[_0x15d7('0xf')]);router['get']('/:id/contacts',auth[_0x15d7('0xa')](),controller[_0x15d7('0x10')]);router[_0x15d7('0x7')]('/:id/contacts/csv',auth[_0x15d7('0xa')](),controller['getContactsCsv']);router['get'](_0x15d7('0x11'),auth[_0x15d7('0xa')](),controller[_0x15d7('0x12')]);router[_0x15d7('0x7')](_0x15d7('0x13'),auth['isAuthenticated'](),controller[_0x15d7('0x14')]);router['post']('/',auth[_0x15d7('0xa')](),controller[_0x15d7('0x15')]);router[_0x15d7('0x16')]('/:id/dispositions',auth[_0x15d7('0xa')](),controller['addDisposition']);router['post'](_0x15d7('0x17'),auth[_0x15d7('0xa')](),controller['addContacts']);router['post']('/:id/fields',auth['isAuthenticated'](),controller['addCustomField']);router[_0x15d7('0x16')](_0x15d7('0x13'),auth[_0x15d7('0xa')](),controller[_0x15d7('0x18')]);router['put'](_0x15d7('0xc'),auth['isAuthenticated'](),controller[_0x15d7('0x19')]);router[_0x15d7('0x1a')](_0x15d7('0xc'),auth[_0x15d7('0xa')](),controller['destroy']);router['delete']('/:id/dispositions',auth[_0x15d7('0xa')](),controller[_0x15d7('0x1b')]);router[_0x15d7('0x1a')](_0x15d7('0x13'),auth[_0x15d7('0xa')](),controller['removeAgents']);module[_0x15d7('0x1c')]=router; \ No newline at end of file +var _0xe4db=['/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','post','addDisposition','/:id/users','put','update','delete','removeDispositions','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./cmList.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/contacts','getContacts'];(function(_0x47e7f0,_0x551614){var _0x40c44e=function(_0x596251){while(--_0x596251){_0x47e7f0['push'](_0x47e7f0['shift']());}};_0x40c44e(++_0x551614);}(_0xe4db,0x1af));var _0xbe4d=function(_0x32362e,_0xd791dd){_0x32362e=_0x32362e-0x0;var _0x299127=_0xe4db[_0x32362e];return _0x299127;};'use strict';var multer=require('multer');var util=require(_0xbe4d('0x0'));var path=require(_0xbe4d('0x1'));var timeout=require(_0xbe4d('0x2'));var express=require(_0xbe4d('0x3'));var router=express[_0xbe4d('0x4')]();var fs_extra=require(_0xbe4d('0x5'));var auth=require(_0xbe4d('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbe4d('0x7'));router[_0xbe4d('0x8')]('/',auth[_0xbe4d('0x9')](),controller[_0xbe4d('0xa')]);router[_0xbe4d('0x8')](_0xbe4d('0xb'),auth[_0xbe4d('0x9')](),controller[_0xbe4d('0xc')]);router[_0xbe4d('0x8')](_0xbe4d('0xd'),auth[_0xbe4d('0x9')](),controller[_0xbe4d('0xe')]);router[_0xbe4d('0x8')](_0xbe4d('0xf'),auth[_0xbe4d('0x9')](),controller[_0xbe4d('0x10')]);router[_0xbe4d('0x8')](_0xbe4d('0x11'),auth['isAuthenticated'](),controller[_0xbe4d('0x12')]);router[_0xbe4d('0x8')](_0xbe4d('0x13'),auth[_0xbe4d('0x9')](),controller[_0xbe4d('0x14')]);router[_0xbe4d('0x8')](_0xbe4d('0x15'),auth['isAuthenticated'](),controller[_0xbe4d('0x16')]);router['get']('/:id/users',auth[_0xbe4d('0x9')](),controller['getAgents']);router[_0xbe4d('0x17')]('/',auth['isAuthenticated'](),controller['create']);router[_0xbe4d('0x17')](_0xbe4d('0xf'),auth[_0xbe4d('0x9')](),controller[_0xbe4d('0x18')]);router[_0xbe4d('0x17')](_0xbe4d('0x11'),auth[_0xbe4d('0x9')](),controller['addContacts']);router[_0xbe4d('0x17')]('/:id/fields',auth[_0xbe4d('0x9')](),controller['addCustomField']);router['post'](_0xbe4d('0x19'),auth[_0xbe4d('0x9')](),controller['addAgents']);router[_0xbe4d('0x1a')](_0xbe4d('0xd'),auth[_0xbe4d('0x9')](),controller[_0xbe4d('0x1b')]);router[_0xbe4d('0x1c')]('/:id',auth[_0xbe4d('0x9')](),controller['destroy']);router[_0xbe4d('0x1c')](_0xbe4d('0xf'),auth[_0xbe4d('0x9')](),controller[_0xbe4d('0x1d')]);router[_0xbe4d('0x1c')]('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 032d526..1260d07 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 _0x20a1=['sequelize','exports','VIRTUAL','getDataValue','field','STRING'];(function(_0x19958c,_0x9c863b){var _0x3cbcd1=function(_0x105b4e){while(--_0x105b4e){_0x19958c['push'](_0x19958c['shift']());}};_0x3cbcd1(++_0x9c863b);}(_0x20a1,0x11a));var _0x120a=function(_0xd674d1,_0x1a347b){_0xd674d1=_0xd674d1-0x0;var _0x11b100=_0x20a1[_0xd674d1];return _0x11b100;};'use strict';var Sequelize=require(_0x120a('0x0'));module[_0x120a('0x1')]={'name':{'type':Sequelize[_0x120a('0x2')],'get':function(_0x4dc53e){return this[_0x120a('0x3')](_0x120a('0x4'));}},'field':{'type':Sequelize[_0x120a('0x5')],'allowNull':![]},'operator':{'type':Sequelize[_0x120a('0x5')],'allowNull':![]},'value':{'type':Sequelize[_0x120a('0x5')],'allowNull':![]}}; \ No newline at end of file +var _0xb33c=['STRING','sequelize','getDataValue'];(function(_0x311909,_0x414bf7){var _0x8d3163=function(_0x226f55){while(--_0x226f55){_0x311909['push'](_0x311909['shift']());}};_0x8d3163(++_0x414bf7);}(_0xb33c,0x178));var _0xcb33=function(_0x2a3d6b,_0xbc006d){_0x2a3d6b=_0x2a3d6b-0x0;var _0x451410=_0xb33c[_0x2a3d6b];return _0x451410;};'use strict';var Sequelize=require(_0xcb33('0x0'));module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x541a29){return this[_0xcb33('0x1')]('field');}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0xcb33('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0xcb33('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 12f1f4c..1af7bb0 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(_0x4c93c0,_0x1e0be0){var _0x4c3dcd=function(_0x5645a1){while(--_0x5645a1){_0x4c93c0['push'](_0x4c93c0['shift']());}};_0x4c3dcd(++_0x1e0be0);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file +var _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(_0x1e1c99,_0x5ef3a5){var _0x1abdd4=function(_0x24385f){while(--_0x24385f){_0x1e1c99['push'](_0x1e1c99['shift']());}};_0x1abdd4(++_0x5ef3a5);}(_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 diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 4db934a..1c2c8de 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 _0x72a9=['rimraf','../../config/environment','./condition.attributes','exports','define','Condition','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x23d878,_0x59d6d9){var _0x38fa8b=function(_0x589550){while(--_0x589550){_0x23d878['push'](_0x23d878['shift']());}};_0x38fa8b(++_0x59d6d9);}(_0x72a9,0x1a6));var _0x972a=function(_0x584fde,_0x479309){_0x584fde=_0x584fde-0x0;var _0x4b7515=_0x72a9[_0x584fde];return _0x4b7515;};'use strict';var _=require(_0x972a('0x0'));var util=require('util');var logger=require(_0x972a('0x1'))(_0x972a('0x2'));var moment=require(_0x972a('0x3'));var BPromise=require(_0x972a('0x4'));var rp=require(_0x972a('0x5'));var fs=require('fs');var path=require(_0x972a('0x6'));var rimraf=require(_0x972a('0x7'));var config=require(_0x972a('0x8'));var attributes=require(_0x972a('0x9'));module[_0x972a('0xa')]=function(_0x2ab057,_0x596992){return _0x2ab057[_0x972a('0xb')](_0x972a('0xc'),attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4ad0=['../../config/logger','api','moment','rimraf','../../config/environment','./condition.attributes','exports','define','lodash','util'];(function(_0x104232,_0x3b49cc){var _0x5e5ea1=function(_0x55c80e){while(--_0x55c80e){_0x104232['push'](_0x104232['shift']());}};_0x5e5ea1(++_0x3b49cc);}(_0x4ad0,0x80));var _0x04ad=function(_0x25f404,_0x485a38){_0x25f404=_0x25f404-0x0;var _0x2c0e38=_0x4ad0[_0x25f404];return _0x2c0e38;};'use strict';var _=require(_0x04ad('0x0'));var util=require(_0x04ad('0x1'));var logger=require(_0x04ad('0x2'))(_0x04ad('0x3'));var moment=require(_0x04ad('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x04ad('0x5'));var config=require(_0x04ad('0x6'));var attributes=require(_0x04ad('0x7'));module[_0x04ad('0x8')]=function(_0x2271f1,_0x7e8bc8){return _0x2271f1[_0x04ad('0x9')]('Condition',attributes,{'tableName':'tools_conditions','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 9c2abc2..4aa5a0f 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 _0x8a91=['stringify','error','code','message','info','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','Condition,\x20%s,\x20%s','Condition,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0xf93cc1,_0x253b48){var _0x21c1d8=function(_0x55600b){while(--_0x55600b){_0xf93cc1['push'](_0xf93cc1['shift']());}};_0x21c1d8(++_0x253b48);}(_0x8a91,0xa1));var _0x18a9=function(_0x37a512,_0x2d4b2b){_0x37a512=_0x37a512-0x0;var _0x58c663=_0x8a91[_0x37a512];return _0x58c663;};'use strict';var _=require(_0x18a9('0x0'));var util=require('util');var moment=require(_0x18a9('0x1'));var BPromise=require(_0x18a9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x18a9('0x3'));var db=require(_0x18a9('0x4'))['db'];var utils=require(_0x18a9('0x5'));var logger=require(_0x18a9('0x6'))(_0x18a9('0x7'));var config=require(_0x18a9('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x18a9('0x9')][_0x18a9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x38f633,_0x5a6184,_0x386171){return new BPromise(function(_0x4784e2,_0x2bd334){return client[_0x18a9('0xb')](_0x38f633,_0x386171)['then'](function(_0x5c4582){logger['info'](_0x18a9('0xc'),_0x5a6184,'request\x20sent');logger['debug'](_0x18a9('0xd'),_0x5a6184,_0x18a9('0xe'),JSON[_0x18a9('0xf')](_0x5c4582));if(_0x5c4582[_0x18a9('0x10')]){if(_0x5c4582[_0x18a9('0x10')][_0x18a9('0x11')]===0x1f4){logger[_0x18a9('0x10')](_0x18a9('0xc'),_0x5a6184,_0x5c4582[_0x18a9('0x10')]['message']);return _0x2bd334(_0x5c4582[_0x18a9('0x10')][_0x18a9('0x12')]);}logger[_0x18a9('0x10')](_0x18a9('0xc'),_0x5a6184,_0x5c4582[_0x18a9('0x10')][_0x18a9('0x12')]);return _0x4784e2(_0x5c4582['error'][_0x18a9('0x12')]);}else{logger[_0x18a9('0x13')](_0x18a9('0xc'),_0x5a6184,_0x18a9('0xe'));_0x4784e2(_0x5c4582[_0x18a9('0x14')][_0x18a9('0x12')]);}})[_0x18a9('0x15')](function(_0x27af66){logger[_0x18a9('0x10')](_0x18a9('0xc'),_0x5a6184,_0x27af66);_0x2bd334(_0x27af66);});});} \ No newline at end of file +var _0x7c8c=['bluebird','randomstring','../../mysqldb','../../config/utils','rpc','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util'];(function(_0x3ed348,_0x424a0f){var _0x2662cb=function(_0x45c833){while(--_0x45c833){_0x3ed348['push'](_0x3ed348['shift']());}};_0x2662cb(++_0x424a0f);}(_0x7c8c,0x6a));var _0xc7c8=function(_0x3af3b8,_0x30a688){_0x3af3b8=_0x3af3b8-0x0;var _0x5da40b=_0x7c8c[_0x3af3b8];return _0x5da40b;};'use strict';var _=require(_0xc7c8('0x0'));var util=require(_0xc7c8('0x1'));var moment=require('moment');var BPromise=require(_0xc7c8('0x2'));var rs=require(_0xc7c8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc7c8('0x4'))['db'];var utils=require(_0xc7c8('0x5'));var logger=require('../../config/logger')(_0xc7c8('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4fc767,_0x25adab,_0x150cc4){return new BPromise(function(_0x3ff244,_0x32a83e){return client['request'](_0x4fc767,_0x150cc4)[_0xc7c8('0x7')](function(_0x4a72d2){logger[_0xc7c8('0x8')](_0xc7c8('0x9'),_0x25adab,_0xc7c8('0xa'));logger[_0xc7c8('0xb')]('Condition,\x20%s,\x20%s,\x20%s',_0x25adab,'request\x20sent',JSON[_0xc7c8('0xc')](_0x4a72d2));if(_0x4a72d2['error']){if(_0x4a72d2[_0xc7c8('0xd')][_0xc7c8('0xe')]===0x1f4){logger[_0xc7c8('0xd')]('Condition,\x20%s,\x20%s',_0x25adab,_0x4a72d2['error'][_0xc7c8('0xf')]);return _0x32a83e(_0x4a72d2[_0xc7c8('0xd')]['message']);}logger['error']('Condition,\x20%s,\x20%s',_0x25adab,_0x4a72d2['error']['message']);return _0x3ff244(_0x4a72d2[_0xc7c8('0xd')]['message']);}else{logger[_0xc7c8('0x8')](_0xc7c8('0x9'),_0x25adab,_0xc7c8('0xa'));_0x3ff244(_0x4a72d2[_0xc7c8('0x10')]['message']);}})[_0xc7c8('0x11')](function(_0x572783){logger[_0xc7c8('0xd')](_0xc7c8('0x9'),_0x25adab,_0x572783);_0x32a83e(_0x572783);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 9963742..6e21957 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 _0x5d26=['exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','update','/:id','destroy'];(function(_0x5a9841,_0x950566){var _0xb4f748=function(_0xdecea8){while(--_0xdecea8){_0x5a9841['push'](_0x5a9841['shift']());}};_0xb4f748(++_0x950566);}(_0x5d26,0x1d5));var _0x65d2=function(_0x10bf64,_0x1b2e31){_0x10bf64=_0x10bf64-0x0;var _0x5e63cf=_0x5d26[_0x10bf64];return _0x5e63cf;};'use strict';var multer=require(_0x65d2('0x0'));var util=require(_0x65d2('0x1'));var path=require('path');var timeout=require(_0x65d2('0x2'));var express=require(_0x65d2('0x3'));var router=express[_0x65d2('0x4')]();var fs_extra=require(_0x65d2('0x5'));var auth=require(_0x65d2('0x6'));var interaction=require(_0x65d2('0x7'));var config=require(_0x65d2('0x8'));var controller=require('./condition.controller');router['put']('/:id',auth['isAuthenticated'](),controller[_0x65d2('0x9')]);router['delete'](_0x65d2('0xa'),auth['isAuthenticated'](),controller[_0x65d2('0xb')]);module[_0x65d2('0xc')]=router; \ No newline at end of file +var _0x2dbb=['./condition.controller','put','/:id','isAuthenticated','update','delete','destroy','exports','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x22d6c4,_0x5eccb6){var _0x127689=function(_0x54b925){while(--_0x54b925){_0x22d6c4['push'](_0x22d6c4['shift']());}};_0x127689(++_0x5eccb6);}(_0x2dbb,0x170));var _0xb2db=function(_0x5d7aab,_0x11bcb2){_0x5d7aab=_0x5d7aab-0x0;var _0x34c764=_0x2dbb[_0x5d7aab];return _0x34c764;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xb2db('0x0'));var express=require(_0xb2db('0x1'));var router=express[_0xb2db('0x2')]();var fs_extra=require(_0xb2db('0x3'));var auth=require(_0xb2db('0x4'));var interaction=require(_0xb2db('0x5'));var config=require(_0xb2db('0x6'));var controller=require(_0xb2db('0x7'));router[_0xb2db('0x8')](_0xb2db('0x9'),auth[_0xb2db('0xa')](),controller[_0xb2db('0xb')]);router[_0xb2db('0xc')](_0xb2db('0x9'),auth[_0xb2db('0xa')](),controller[_0xb2db('0xd')]);module[_0xb2db('0xe')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 218f536..02645f5 100644 --- a/server/api/dashboard/dashboard.attributes.js +++ b/server/api/dashboard/dashboard.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x757a=['exports','STRING'];(function(_0xa13eff,_0x3e7df8){var _0x22a765=function(_0x63e8f6){while(--_0x63e8f6){_0xa13eff['push'](_0xa13eff['shift']());}};_0x22a765(++_0x3e7df8);}(_0x757a,0xde));var _0xa757=function(_0x3397ea,_0x224688){_0x3397ea=_0x3397ea-0x0;var _0x303e76=_0x757a[_0x3397ea];return _0x303e76;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'name':{'type':Sequelize[_0xa757('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xbaf0=['name','exports','STRING'];(function(_0x2642cb,_0x4b917f){var _0xe6e41=function(_0x281676){while(--_0x281676){_0x2642cb['push'](_0x2642cb['shift']());}};_0xe6e41(++_0x4b917f);}(_0xbaf0,0x12a));var _0x0baf=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xbaf0[_0x4cf98e];return _0x1623ac;};'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 diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 0eaf345..0639810 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 _0xe6a0=['rows','catch','show','params','rawAttributes','intersection','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','UserProfileResource','clone','merge','omit','createdAt','updatedAt','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','iframe','attrUrl','attrs','value','https://','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','stringify','addItem','DashboardId','DashboardItem','findOne','hasOwnProperty','nolimit','zip-dir','request-promise','mustache','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./dashboard.socket','sendStatus','end','status','json','offset','undefined','limit','count','set','reject','update','then','destroy','get','CustomDashboards','error','stack','name','send','index','map','fieldName','type','key','query','keys','filters','model','fields','attributes','length','order','sort','where','pick','filter','VIRTUAL','includeAll','include','Dashboard','findAll'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe6a0,0x1bd));var _0x0e6a=function(_0x2afb75,_0x1e9ddf){_0x2afb75=_0x2afb75-0x0;var _0x5e0c7=_0xe6a0[_0x2afb75];return _0x5e0c7;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0e6a('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0e6a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0e6a('0x2'));var util=require('util');var path=require('path');var sox=require(_0x0e6a('0x3'));var csv=require('to-csv');var ejs=require(_0x0e6a('0x4'));var fs=require('fs');var fs_extra=require(_0x0e6a('0x5'));var _=require(_0x0e6a('0x6'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0e6a('0x7'));var deskjs=require(_0x0e6a('0x8'));var toCsv=require(_0x0e6a('0x9'));var querystring=require(_0x0e6a('0xa'));var Papa=require(_0x0e6a('0xb'));var Redis=require(_0x0e6a('0xc'));var authService=require(_0x0e6a('0xd'));var qs=require(_0x0e6a('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0e6a('0xf'));var logger=require(_0x0e6a('0x10'))('api');var utils=require(_0x0e6a('0x11'));var config=require(_0x0e6a('0x12'));var licenseUtil=require(_0x0e6a('0x13'));var db=require(_0x0e6a('0x14'))['db'];config['redis']=_[_0x0e6a('0x15')](config[_0x0e6a('0x16')],{'host':_0x0e6a('0x17'),'port':0x18eb});var socket=require(_0x0e6a('0x18'))(new Redis(config['redis']));require(_0x0e6a('0x19'))['register'](socket);function respondWithStatusCode(_0x52b157,_0x3a4d0f){_0x3a4d0f=_0x3a4d0f||0xcc;return function(_0x865f65){if(_0x865f65){return _0x52b157[_0x0e6a('0x1a')](_0x3a4d0f);}return _0x52b157['status'](_0x3a4d0f)[_0x0e6a('0x1b')]();};}function respondWithResult(_0x5d556f,_0x3b483d){_0x3b483d=_0x3b483d||0xc8;return function(_0x333963){if(_0x333963){return _0x5d556f[_0x0e6a('0x1c')](_0x3b483d)[_0x0e6a('0x1d')](_0x333963);}};}function respondWithFilteredResult(_0x30b730,_0xee9d16){return function(_0x1980cd){if(_0x1980cd){var _0x18badd=typeof _0xee9d16[_0x0e6a('0x1e')]===_0x0e6a('0x1f')&&typeof _0xee9d16[_0x0e6a('0x20')]==='undefined';var _0x2cc554=_0x1980cd[_0x0e6a('0x21')];var _0x5b12a1=_0x18badd?0x0:_0xee9d16[_0x0e6a('0x1e')];var _0x4c58d9=_0x18badd?_0x1980cd['count']:_0xee9d16[_0x0e6a('0x1e')]+_0xee9d16[_0x0e6a('0x20')];var _0x1444cf;if(_0x4c58d9>=_0x2cc554){_0x4c58d9=_0x2cc554;_0x1444cf=0xc8;}else{_0x1444cf=0xce;}_0x30b730[_0x0e6a('0x1c')](_0x1444cf);return _0x30b730[_0x0e6a('0x22')]('Content-Range',_0x5b12a1+'-'+_0x4c58d9+'/'+_0x2cc554)[_0x0e6a('0x1d')](_0x1980cd);}return null;};}function patchUpdates(_0x3fc989){return function(_0x347101){try{jsonpatch['apply'](_0x347101,_0x3fc989,!![]);}catch(_0x591892){return BPromise[_0x0e6a('0x23')](_0x591892);}return _0x347101['save']();};}function saveUpdates(_0x466db6,_0x555bc3){return function(_0x27250b){if(_0x27250b){return _0x27250b[_0x0e6a('0x24')](_0x466db6)[_0x0e6a('0x25')](function(_0x46eced){return _0x46eced;});}return null;};}function removeEntity(_0x5926e2,_0x26bd0a){return function(_0x2ac979){if(_0x2ac979){return _0x2ac979[_0x0e6a('0x26')]()[_0x0e6a('0x25')](function(){var _0x1281c0=_0x2ac979[_0x0e6a('0x27')]({'plain':!![]});var _0x1cbc61=_0x0e6a('0x28');return db['UserProfileResource'][_0x0e6a('0x26')]({'where':{'type':_0x1cbc61,'resourceId':_0x1281c0['id']}})['then'](function(){return _0x2ac979;});})[_0x0e6a('0x25')](function(){_0x5926e2[_0x0e6a('0x1c')](0xcc)[_0x0e6a('0x1b')]();});}};}function handleEntityNotFound(_0x3e31b9,_0x57fd1f){return function(_0x1af311){if(!_0x1af311){_0x3e31b9['sendStatus'](0x194);}return _0x1af311;};}function handleError(_0x2cde3e,_0x1e4357){_0x1e4357=_0x1e4357||0x1f4;return function(_0x482bdf){logger[_0x0e6a('0x29')](_0x482bdf[_0x0e6a('0x2a')]);if(_0x482bdf['name']){delete _0x482bdf[_0x0e6a('0x2b')];}_0x2cde3e[_0x0e6a('0x1c')](_0x1e4357)[_0x0e6a('0x2c')](_0x482bdf);};}exports[_0x0e6a('0x2d')]=function(_0x41774e,_0x4d593c){var _0x182a5c={},_0x1fe0a1={},_0x501f8e={'count':0x0,'rows':[]};var _0x50e231=_[_0x0e6a('0x2e')](db['Dashboard']['rawAttributes'],function(_0x1ba6de){return{'name':_0x1ba6de[_0x0e6a('0x2f')],'type':_0x1ba6de[_0x0e6a('0x30')][_0x0e6a('0x31')]};});_0x1fe0a1['model']=_['map'](_0x50e231,_0x0e6a('0x2b'));_0x1fe0a1[_0x0e6a('0x32')]=_[_0x0e6a('0x33')](_0x41774e[_0x0e6a('0x32')]);_0x1fe0a1[_0x0e6a('0x34')]=_['intersection'](_0x1fe0a1[_0x0e6a('0x35')],_0x1fe0a1['query']);_0x182a5c['attributes']=_['intersection'](_0x1fe0a1[_0x0e6a('0x35')],qs[_0x0e6a('0x36')](_0x41774e[_0x0e6a('0x32')][_0x0e6a('0x36')]));_0x182a5c['attributes']=_0x182a5c[_0x0e6a('0x37')][_0x0e6a('0x38')]?_0x182a5c[_0x0e6a('0x37')]:_0x1fe0a1[_0x0e6a('0x35')];if(!_0x41774e[_0x0e6a('0x32')]['hasOwnProperty']('nolimit')){_0x182a5c[_0x0e6a('0x20')]=qs[_0x0e6a('0x20')](_0x41774e['query'][_0x0e6a('0x20')]);_0x182a5c[_0x0e6a('0x1e')]=qs[_0x0e6a('0x1e')](_0x41774e[_0x0e6a('0x32')][_0x0e6a('0x1e')]);}_0x182a5c[_0x0e6a('0x39')]=qs[_0x0e6a('0x3a')](_0x41774e[_0x0e6a('0x32')]['sort']);_0x182a5c[_0x0e6a('0x3b')]=qs['filters'](_[_0x0e6a('0x3c')](_0x41774e['query'],_0x1fe0a1[_0x0e6a('0x34')]),_0x50e231);if(_0x41774e[_0x0e6a('0x32')][_0x0e6a('0x3d')]){_0x182a5c[_0x0e6a('0x3b')]=_['merge'](_0x182a5c[_0x0e6a('0x3b')],{'$or':_[_0x0e6a('0x2e')](_0x50e231,function(_0x4d2141){if(_0x4d2141['type']!==_0x0e6a('0x3e')){var _0x2d55d1={};_0x2d55d1[_0x4d2141[_0x0e6a('0x2b')]]={'$like':'%'+_0x41774e['query']['filter']+'%'};return _0x2d55d1;}})});}_0x182a5c=_['merge']({},_0x182a5c,_0x41774e['options']);var _0x589339={'where':_0x182a5c[_0x0e6a('0x3b')]};return db['Dashboard'][_0x0e6a('0x21')](_0x589339)['then'](function(_0x8183fb){_0x501f8e[_0x0e6a('0x21')]=_0x8183fb;if(_0x41774e['query'][_0x0e6a('0x3f')]){_0x182a5c[_0x0e6a('0x40')]=[{'all':!![]}];}return db[_0x0e6a('0x41')][_0x0e6a('0x42')](_0x182a5c);})[_0x0e6a('0x25')](function(_0x354ca9){_0x501f8e[_0x0e6a('0x43')]=_0x354ca9;return _0x501f8e;})[_0x0e6a('0x25')](respondWithFilteredResult(_0x4d593c,_0x182a5c))[_0x0e6a('0x44')](handleError(_0x4d593c,null));};exports[_0x0e6a('0x45')]=function(_0xe01ab,_0x353116){var _0x2e84ba={'raw':![],'where':{'id':_0xe01ab[_0x0e6a('0x46')]['id']}},_0x16deed={};_0x16deed[_0x0e6a('0x35')]=_[_0x0e6a('0x33')](db[_0x0e6a('0x41')][_0x0e6a('0x47')]);_0x16deed[_0x0e6a('0x32')]=_[_0x0e6a('0x33')](_0xe01ab[_0x0e6a('0x32')]);_0x16deed[_0x0e6a('0x34')]=_[_0x0e6a('0x48')](_0x16deed[_0x0e6a('0x35')],_0x16deed[_0x0e6a('0x32')]);_0x2e84ba[_0x0e6a('0x37')]=_[_0x0e6a('0x48')](_0x16deed['model'],qs[_0x0e6a('0x36')](_0xe01ab[_0x0e6a('0x32')][_0x0e6a('0x36')]));_0x2e84ba['attributes']=_0x2e84ba[_0x0e6a('0x37')][_0x0e6a('0x38')]?_0x2e84ba[_0x0e6a('0x37')]:_0x16deed[_0x0e6a('0x35')];if(_0xe01ab['query'][_0x0e6a('0x3f')]){_0x2e84ba[_0x0e6a('0x40')]=[{'all':!![]}];}_0x2e84ba=_['merge']({},_0x2e84ba,_0xe01ab[_0x0e6a('0x49')]);return db[_0x0e6a('0x41')]['find'](_0x2e84ba)[_0x0e6a('0x25')](handleEntityNotFound(_0x353116,null))[_0x0e6a('0x25')](respondWithResult(_0x353116,null))[_0x0e6a('0x44')](handleError(_0x353116,null));};exports[_0x0e6a('0x4a')]=function(_0x3eee5a,_0x10b325){return db[_0x0e6a('0x41')][_0x0e6a('0x4a')](_0x3eee5a[_0x0e6a('0x4b')],{})['then'](function(_0x3b5577){var _0xeebc31=_0x3eee5a[_0x0e6a('0x4c')][_0x0e6a('0x27')]({'plain':!![]});if(!_0xeebc31)throw new Error(_0x0e6a('0x4d'));if(_0xeebc31['role']===_0x0e6a('0x4c')){var _0x558a9d=_0x3b5577[_0x0e6a('0x27')]({'plain':!![]});var _0x235b0a=_0x0e6a('0x28');return db[_0x0e6a('0x4e')][_0x0e6a('0x4f')]({'where':{'name':_0x235b0a,'userProfileId':_0xeebc31[_0x0e6a('0x50')]},'raw':!![]})[_0x0e6a('0x25')](function(_0x4d69dc){if(_0x4d69dc&&_0x4d69dc['autoAssociation']===0x0){return db[_0x0e6a('0x51')][_0x0e6a('0x4a')]({'name':_0x558a9d[_0x0e6a('0x2b')],'resourceId':_0x558a9d['id'],'type':_0x4d69dc[_0x0e6a('0x2b')],'sectionId':_0x4d69dc['id']},{})[_0x0e6a('0x25')](function(){return _0x3b5577;});}else{return _0x3b5577;}})[_0x0e6a('0x44')](function(_0xad667c){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xad667c);throw _0xad667c;});}return _0x3b5577;})['then'](respondWithResult(_0x10b325,0xc9))[_0x0e6a('0x44')](handleError(_0x10b325,null));};exports[_0x0e6a('0x52')]=function(_0xa2309,_0x4abf7b){var _0x4e0455={'where':{'id':_0xa2309[_0x0e6a('0x46')]['id']}},_0x3336bb={};_0x3336bb[_0x0e6a('0x35')]=_[_0x0e6a('0x33')](db[_0x0e6a('0x41')][_0x0e6a('0x47')]);_0x4e0455[_0x0e6a('0x37')]=_[_0x0e6a('0x48')](_0x3336bb[_0x0e6a('0x35')],qs[_0x0e6a('0x36')](_0xa2309[_0x0e6a('0x32')][_0x0e6a('0x36')]));_0x4e0455['attributes']=_0x4e0455[_0x0e6a('0x37')][_0x0e6a('0x38')]?_0x4e0455['attributes']:_0x3336bb[_0x0e6a('0x35')];if(_0xa2309[_0x0e6a('0x32')][_0x0e6a('0x3f')]){_0x4e0455['include']=[{'all':!![]}];}_0x4e0455=_[_0x0e6a('0x53')]({},_0x4e0455,_0xa2309['options']);return db['Dashboard'][_0x0e6a('0x4f')](_0x4e0455)['then'](handleEntityNotFound(_0x4abf7b,null))[_0x0e6a('0x25')](function(_0x3d999c){if(_0x3d999c){var _0x19c3d0=_0x3d999c[_0x0e6a('0x27')]({'plain':!![]});_0x19c3d0=qs[_0x0e6a('0x54')](_0x19c3d0,['id',_0x0e6a('0x55'),_0x0e6a('0x56')]);_0xa2309[_0x0e6a('0x4b')]=_['omit'](_0xa2309[_0x0e6a('0x4b')],['id',_0x0e6a('0x55'),_0x0e6a('0x56')]);return db[_0x0e6a('0x41')][_0x0e6a('0x4a')](_[_0x0e6a('0x53')](_0x19c3d0,_0xa2309[_0x0e6a('0x4b')]),{'include':_0xa2309[_0x0e6a('0x32')][_0x0e6a('0x3f')]?[{'all':!![]}]:undefined})[_0x0e6a('0x25')](function(_0x488a94){var _0x538d13=_0xa2309[_0x0e6a('0x4c')][_0x0e6a('0x27')]({'plain':!![]});if(!_0x538d13)throw new Error(_0x0e6a('0x4d'));if(_0x538d13[_0x0e6a('0x57')]===_0x0e6a('0x4c')){var _0x4efa69=_0x488a94[_0x0e6a('0x27')]({'plain':!![]});var _0x1ebaa4=_0x0e6a('0x28');return db[_0x0e6a('0x4e')][_0x0e6a('0x4f')]({'where':{'name':_0x1ebaa4,'userProfileId':_0x538d13[_0x0e6a('0x50')]},'raw':!![]})[_0x0e6a('0x25')](function(_0x14da26){if(_0x14da26&&_0x14da26[_0x0e6a('0x58')]===0x0){return db[_0x0e6a('0x51')]['create']({'name':_0x4efa69[_0x0e6a('0x2b')],'resourceId':_0x4efa69['id'],'type':_0x14da26[_0x0e6a('0x2b')],'sectionId':_0x14da26['id']},{})['then'](function(){return _0x488a94;});}else{return _0x488a94;}})[_0x0e6a('0x44')](function(_0x13acd8){logger[_0x0e6a('0x29')](_0x0e6a('0x59'),_0x13acd8);throw _0x13acd8;});}return _0x488a94;});}})[_0x0e6a('0x25')](respondWithResult(_0x4abf7b,0xc9))['catch'](handleError(_0x4abf7b,null));};exports['update']=function(_0x3ed72c,_0x430103){if(_0x3ed72c[_0x0e6a('0x4b')]['id']){delete _0x3ed72c[_0x0e6a('0x4b')]['id'];}return db['Dashboard']['find']({'where':{'id':_0x3ed72c[_0x0e6a('0x46')]['id']}})[_0x0e6a('0x25')](handleEntityNotFound(_0x430103,null))['then'](saveUpdates(_0x3ed72c[_0x0e6a('0x4b')],null))[_0x0e6a('0x25')](respondWithResult(_0x430103,null))[_0x0e6a('0x44')](handleError(_0x430103,null));};exports[_0x0e6a('0x26')]=function(_0x5a77d6,_0x26bc86){return db[_0x0e6a('0x41')][_0x0e6a('0x4f')]({'where':{'id':_0x5a77d6['params']['id']}})['then'](handleEntityNotFound(_0x26bc86,null))['then'](removeEntity(_0x26bc86,null))[_0x0e6a('0x44')](handleError(_0x26bc86,null));};function widgetAttributes(_0x330687){try{switch(_0x330687[_0x0e6a('0x30')]){case _0x0e6a('0x5a'):return[{'name':'attrUrl','value':_0x330687[_0x0e6a('0x5b')]||(_0x330687[_0x0e6a('0x5c')]&&_0x330687[_0x0e6a('0x5c')][0x0]?_0x330687[_0x0e6a('0x5c')][0x0][_0x0e6a('0x5d')]:undefined)||_0x0e6a('0x5e')}];case'custom':return[{'name':_0x0e6a('0x5f'),'value':_0x330687[_0x0e6a('0x5f')]||(_0x330687[_0x0e6a('0x5c')]&&_0x330687['attrs'][0x0]?_0x330687[_0x0e6a('0x5c')][0x0][_0x0e6a('0x5d')]:undefined)||''}];case _0x0e6a('0x60'):return[{'name':_0x0e6a('0x61'),'value':_0x330687['attrHourFormat']||(_0x330687['attrs']&&_0x330687[_0x0e6a('0x5c')][0x0]?_0x330687[_0x0e6a('0x5c')][0x0][_0x0e6a('0x5d')]:undefined)||_0x0e6a('0x62')},{'name':_0x0e6a('0x63'),'value':_0x330687[_0x0e6a('0x63')]||(_0x330687['attrs']&&_0x330687[_0x0e6a('0x5c')][0x1]?_0x330687[_0x0e6a('0x5c')][0x1][_0x0e6a('0x5d')]:undefined)||'0.00'},{'name':_0x0e6a('0x64'),'value':_0x330687[_0x0e6a('0x64')]||(_0x330687[_0x0e6a('0x5c')]&&_0x330687[_0x0e6a('0x5c')][0x2]?_0x330687[_0x0e6a('0x5c')][0x2][_0x0e6a('0x5d')]:undefined)||0xc}];case'counter':return[{'name':_0x0e6a('0x65'),'value':_0x330687[_0x0e6a('0x65')]||(_0x330687[_0x0e6a('0x5c')]&&_0x330687['attrs'][0x0]?_0x330687['attrs'][0x0][_0x0e6a('0x5d')]:undefined)||_0x0e6a('0x66')},{'name':_0x0e6a('0x67'),'value':_0x330687[_0x0e6a('0x67')]||(_0x330687['attrs']&&_0x330687[_0x0e6a('0x5c')][0x1]?_0x330687['attrs'][0x1][_0x0e6a('0x5d')]:undefined)||[]},{'name':_0x0e6a('0x64'),'value':_0x330687['attrFontSize']||(_0x330687[_0x0e6a('0x5c')]&&_0x330687[_0x0e6a('0x5c')][0x2]?_0x330687['attrs'][0x2][_0x0e6a('0x5d')]:undefined)||0x14},{'name':_0x0e6a('0x68'),'value':_0x330687[_0x0e6a('0x68')]||(_0x330687['attrs']&&_0x330687[_0x0e6a('0x5c')][0x3]?_0x330687[_0x0e6a('0x5c')][0x3][_0x0e6a('0x5d')]:undefined)||_0x0e6a('0x69')},{'name':_0x0e6a('0x6a'),'value':_0x330687['attrEmailAccounts']||(_0x330687[_0x0e6a('0x5c')]&&_0x330687[_0x0e6a('0x5c')][0x4]?_0x330687[_0x0e6a('0x5c')][0x4][_0x0e6a('0x5d')]:undefined)||''},{'name':_0x0e6a('0x6b'),'value':_0x330687[_0x0e6a('0x6b')]||(_0x330687[_0x0e6a('0x5c')]&&_0x330687[_0x0e6a('0x5c')][0x5]?_0x330687[_0x0e6a('0x5c')][0x5][_0x0e6a('0x5d')]:undefined)||''},{'name':_0x0e6a('0x6c'),'value':_0x330687[_0x0e6a('0x6c')]||(_0x330687['attrs']&&_0x330687[_0x0e6a('0x5c')][0x6]?_0x330687[_0x0e6a('0x5c')][0x6][_0x0e6a('0x5d')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x330687[_0x0e6a('0x6d')]||(_0x330687['attrs']&&_0x330687['attrs'][0x7]?_0x330687[_0x0e6a('0x5c')][0x7][_0x0e6a('0x5d')]:undefined)||''},{'name':_0x0e6a('0x6e'),'value':_0x330687[_0x0e6a('0x6e')]||(_0x330687['attrs']&&_0x330687[_0x0e6a('0x5c')][0x8]?_0x330687[_0x0e6a('0x5c')][0x8][_0x0e6a('0x5d')]:undefined)||''},{'name':_0x0e6a('0x6f'),'value':_0x330687[_0x0e6a('0x6f')]||(_0x330687[_0x0e6a('0x5c')]&&_0x330687[_0x0e6a('0x5c')][0x9]?_0x330687[_0x0e6a('0x5c')][0x9][_0x0e6a('0x5d')]:undefined)||''}];case _0x0e6a('0x70'):case _0x0e6a('0x71'):return[{'name':'attrSerie1','value':_0x330687[_0x0e6a('0x72')]||(_0x330687[_0x0e6a('0x5c')]&&_0x330687[_0x0e6a('0x5c')][0x0]?_0x330687[_0x0e6a('0x5c')][0x0][_0x0e6a('0x5d')]:undefined)||_0x0e6a('0x66')},{'name':_0x0e6a('0x73'),'value':_0x330687[_0x0e6a('0x73')]||(_0x330687['attrs']&&_0x330687[_0x0e6a('0x5c')][0x1]?_0x330687['attrs'][0x1][_0x0e6a('0x5d')]:undefined)||null},{'name':_0x0e6a('0x74'),'value':_0x330687[_0x0e6a('0x74')]||(_0x330687[_0x0e6a('0x5c')]&&_0x330687['attrs'][0x2]?_0x330687[_0x0e6a('0x5c')][0x2]['value']:undefined)||null},{'name':_0x0e6a('0x67'),'value':_0x330687['attrVoiceQueues']||(_0x330687[_0x0e6a('0x5c')]&&_0x330687[_0x0e6a('0x5c')][0x3]?_0x330687[_0x0e6a('0x5c')][0x3][_0x0e6a('0x5d')]:undefined)||[]},{'name':_0x0e6a('0x68'),'value':_0x330687[_0x0e6a('0x68')]||(_0x330687[_0x0e6a('0x5c')]&&_0x330687[_0x0e6a('0x5c')][0x4]?_0x330687[_0x0e6a('0x5c')][0x4][_0x0e6a('0x5d')]:undefined)||'voice'},{'name':_0x0e6a('0x6a'),'value':_0x330687[_0x0e6a('0x6a')]||(_0x330687['attrs']&&_0x330687['attrs'][0x5]?_0x330687['attrs'][0x5]['value']:undefined)||''},{'name':_0x0e6a('0x6b'),'value':_0x330687[_0x0e6a('0x6b')]||(_0x330687[_0x0e6a('0x5c')]&&_0x330687[_0x0e6a('0x5c')][0x6]?_0x330687[_0x0e6a('0x5c')][0x6][_0x0e6a('0x5d')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x330687[_0x0e6a('0x6c')]||(_0x330687[_0x0e6a('0x5c')]&&_0x330687[_0x0e6a('0x5c')][0x7]?_0x330687['attrs'][0x7][_0x0e6a('0x5d')]:undefined)||''},{'name':_0x0e6a('0x6d'),'value':_0x330687['attrOpenchannelAccounts']||(_0x330687[_0x0e6a('0x5c')]&&_0x330687[_0x0e6a('0x5c')][0x8]?_0x330687[_0x0e6a('0x5c')][0x8][_0x0e6a('0x5d')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x330687[_0x0e6a('0x6e')]||(_0x330687[_0x0e6a('0x5c')]&&_0x330687[_0x0e6a('0x5c')][0x9]?_0x330687['attrs'][0x9]['value']:undefined)||''},{'name':_0x0e6a('0x6f'),'value':_0x330687[_0x0e6a('0x6f')]||(_0x330687[_0x0e6a('0x5c')]&&_0x330687[_0x0e6a('0x5c')][0xa]?_0x330687[_0x0e6a('0x5c')][0xa]['value']:undefined)||''}];case _0x0e6a('0x75'):return[{'name':_0x0e6a('0x76'),'type':_0x330687[_0x0e6a('0x77')]||(_0x330687[_0x0e6a('0x5c')]&&_0x330687[_0x0e6a('0x5c')][0x0]?_0x330687[_0x0e6a('0x5c')][0x0]['type']:undefined)||null,'value':_0x330687[_0x0e6a('0x76')]||(_0x330687[_0x0e6a('0x5c')]&&_0x330687[_0x0e6a('0x5c')][0x0]?_0x330687[_0x0e6a('0x5c')][0x0][_0x0e6a('0x5d')]:undefined)||null},{'name':'attrRefresh','value':_0x330687[_0x0e6a('0x78')]||(_0x330687[_0x0e6a('0x5c')]&&_0x330687['attrs'][0x1]?_0x330687[_0x0e6a('0x5c')][0x1][_0x0e6a('0x5d')]:undefined)||0x0}];default:return[];}}catch(_0xb2fbb){logger[_0x0e6a('0x29')]('widgetAttributes:\x20%s',JSON[_0x0e6a('0x79')](_0xb2fbb));return[];}}exports[_0x0e6a('0x7a')]=function(_0x313ca2,_0x5b0ce4,_0x399e2b){if(_0x313ca2['body']['id']){delete _0x313ca2[_0x0e6a('0x4b')]['id'];}return db[_0x0e6a('0x41')][_0x0e6a('0x4f')]({'where':{'id':_0x313ca2[_0x0e6a('0x46')]['id']}})['then'](handleEntityNotFound(_0x5b0ce4,null))[_0x0e6a('0x25')](function(_0x547792){if(_0x547792){_0x313ca2[_0x0e6a('0x4b')][_0x0e6a('0x7b')]=_0x547792['id'];_0x313ca2[_0x0e6a('0x4b')][_0x0e6a('0x5c')]=widgetAttributes(_0x313ca2[_0x0e6a('0x4b')]);return db[_0x0e6a('0x7c')]['create'](_0x313ca2[_0x0e6a('0x4b')]);}})[_0x0e6a('0x25')](respondWithResult(_0x5b0ce4,null))['catch'](handleError(_0x5b0ce4,null));};exports['getItems']=function(_0x99de5f,_0x11a8d8,_0x5cec5b){var _0x47269={};var _0x311e90={};var _0x5b7d7e;var _0x3d2cce;return db[_0x0e6a('0x41')][_0x0e6a('0x7d')]({'where':{'id':_0x99de5f['params']['id']}})['then'](handleEntityNotFound(_0x11a8d8,null))['then'](function(_0x24ea4e){if(_0x24ea4e){_0x5b7d7e=_0x24ea4e;_0x311e90[_0x0e6a('0x35')]=_[_0x0e6a('0x33')](db[_0x0e6a('0x7c')][_0x0e6a('0x47')]);_0x311e90[_0x0e6a('0x32')]=_[_0x0e6a('0x33')](_0x99de5f[_0x0e6a('0x32')]);_0x311e90[_0x0e6a('0x34')]=_[_0x0e6a('0x48')](_0x311e90[_0x0e6a('0x35')],_0x311e90[_0x0e6a('0x32')]);_0x47269['attributes']=_['intersection'](_0x311e90[_0x0e6a('0x35')],qs[_0x0e6a('0x36')](_0x99de5f[_0x0e6a('0x32')][_0x0e6a('0x36')]));_0x47269[_0x0e6a('0x37')]=_0x47269[_0x0e6a('0x37')][_0x0e6a('0x38')]?_0x47269[_0x0e6a('0x37')]:_0x311e90[_0x0e6a('0x35')];_0x47269[_0x0e6a('0x39')]=qs[_0x0e6a('0x3a')](_0x99de5f['query'][_0x0e6a('0x3a')]);_0x47269['where']=qs[_0x0e6a('0x34')](_[_0x0e6a('0x3c')](_0x99de5f[_0x0e6a('0x32')],_0x311e90[_0x0e6a('0x34')]));if(_0x99de5f[_0x0e6a('0x32')][_0x0e6a('0x3d')]){_0x47269[_0x0e6a('0x3b')]=_['merge'](_0x47269[_0x0e6a('0x3b')],{'$or':_[_0x0e6a('0x2e')](_0x47269[_0x0e6a('0x37')],function(_0x42234a){var _0x5ca536={};_0x5ca536[_0x42234a]={'$like':'%'+_0x99de5f[_0x0e6a('0x32')][_0x0e6a('0x3d')]+'%'};return _0x5ca536;})});}_0x47269=_[_0x0e6a('0x53')]({},_0x47269,_0x99de5f[_0x0e6a('0x49')]);return _0x5b7d7e['getItems'](_0x47269);}})['then'](function(_0x2795a6){if(_0x2795a6){_0x3d2cce=_0x2795a6[_0x0e6a('0x38')];if(!_0x99de5f[_0x0e6a('0x32')][_0x0e6a('0x7e')](_0x0e6a('0x7f'))){_0x47269[_0x0e6a('0x20')]=qs[_0x0e6a('0x20')](_0x99de5f['query'][_0x0e6a('0x20')]);_0x47269[_0x0e6a('0x1e')]=qs[_0x0e6a('0x1e')](_0x99de5f[_0x0e6a('0x32')][_0x0e6a('0x1e')]);}return _0x5b7d7e['getItems'](_0x47269);}})['then'](function(_0x5cbad1){if(_0x5cbad1){return _0x5cbad1?{'count':_0x3d2cce,'rows':_0x5cbad1}:null;}})[_0x0e6a('0x25')](respondWithResult(_0x11a8d8,null))[_0x0e6a('0x44')](handleError(_0x11a8d8,null));}; \ No newline at end of file +var _0xfc55=['where','filter','options','includeAll','include','findAll','rows','catch','length','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CustomDashboards','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','merge','createdAt','body','omit','value','https://','custom','attrPath','attrs','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','counter','attrMetric','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','attrSerie1','total','attrSerie2','attrSerie3','attrVoiceQueues','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','DashboardId','DashboardItem','getItems','findOne','pick','eml-format','rimraf','fast-json-patch','request-promise','mustache','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./dashboard.socket','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','Dashboard','rawAttributes','fieldName','type','model','map','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort'];(function(_0x37a9d7,_0x2b6fde){var _0x1343d3=function(_0x3bde45){while(--_0x3bde45){_0x37a9d7['push'](_0x37a9d7['shift']());}};_0x1343d3(++_0x2b6fde);}(_0xfc55,0x1b6));var _0x5fc5=function(_0x36e69c,_0x356f32){_0x36e69c=_0x36e69c-0x0;var _0x314fdb=_0xfc55[_0x36e69c];return _0x314fdb;};'use strict';var emlformat=require(_0x5fc5('0x0'));var rimraf=require(_0x5fc5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5fc5('0x2'));var rp=require(_0x5fc5('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5fc5('0x4'));var util=require('util');var path=require('path');var sox=require(_0x5fc5('0x5'));var csv=require('to-csv');var ejs=require(_0x5fc5('0x6'));var fs=require('fs');var fs_extra=require(_0x5fc5('0x7'));var _=require(_0x5fc5('0x8'));var squel=require('squel');var crypto=require(_0x5fc5('0x9'));var jsforce=require(_0x5fc5('0xa'));var deskjs=require(_0x5fc5('0xb'));var toCsv=require(_0x5fc5('0xc'));var querystring=require(_0x5fc5('0xd'));var Papa=require('papaparse');var Redis=require(_0x5fc5('0xe'));var authService=require(_0x5fc5('0xf'));var qs=require(_0x5fc5('0x10'));var as=require(_0x5fc5('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5fc5('0x12'))('api');var utils=require(_0x5fc5('0x13'));var config=require(_0x5fc5('0x14'));var licenseUtil=require(_0x5fc5('0x15'));var db=require(_0x5fc5('0x16'))['db'];config[_0x5fc5('0x17')]=_[_0x5fc5('0x18')](config[_0x5fc5('0x17')],{'host':_0x5fc5('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5fc5('0x17')]));require(_0x5fc5('0x1a'))['register'](socket);function respondWithStatusCode(_0x3fe701,_0x91343){_0x91343=_0x91343||0xcc;return function(_0x1d76e1){if(_0x1d76e1){return _0x3fe701[_0x5fc5('0x1b')](_0x91343);}return _0x3fe701[_0x5fc5('0x1c')](_0x91343)[_0x5fc5('0x1d')]();};}function respondWithResult(_0x36e473,_0x3e0100){_0x3e0100=_0x3e0100||0xc8;return function(_0x4b9b82){if(_0x4b9b82){return _0x36e473[_0x5fc5('0x1c')](_0x3e0100)[_0x5fc5('0x1e')](_0x4b9b82);}};}function respondWithFilteredResult(_0x179cc3,_0x1b48e3){return function(_0x2284ea){if(_0x2284ea){var _0x330741=typeof _0x1b48e3[_0x5fc5('0x1f')]==='undefined'&&typeof _0x1b48e3[_0x5fc5('0x20')]===_0x5fc5('0x21');var _0x449f53=_0x2284ea['count'];var _0x2562ab=_0x330741?0x0:_0x1b48e3['offset'];var _0x47df7d=_0x330741?_0x2284ea[_0x5fc5('0x22')]:_0x1b48e3['offset']+_0x1b48e3[_0x5fc5('0x20')];var _0x4cfabd;if(_0x47df7d>=_0x449f53){_0x47df7d=_0x449f53;_0x4cfabd=0xc8;}else{_0x4cfabd=0xce;}_0x179cc3[_0x5fc5('0x1c')](_0x4cfabd);return _0x179cc3[_0x5fc5('0x23')]('Content-Range',_0x2562ab+'-'+_0x47df7d+'/'+_0x449f53)['json'](_0x2284ea);}return null;};}function patchUpdates(_0xcab252){return function(_0x1959ce){try{jsonpatch[_0x5fc5('0x24')](_0x1959ce,_0xcab252,!![]);}catch(_0x2c1ad1){return BPromise[_0x5fc5('0x25')](_0x2c1ad1);}return _0x1959ce[_0x5fc5('0x26')]();};}function saveUpdates(_0x4e75df,_0x3b5077){return function(_0x511faf){if(_0x511faf){return _0x511faf[_0x5fc5('0x27')](_0x4e75df)['then'](function(_0x55d476){return _0x55d476;});}return null;};}function removeEntity(_0x304a1f,_0x257951){return function(_0x81fe52){if(_0x81fe52){return _0x81fe52['destroy']()[_0x5fc5('0x28')](function(){var _0xcca513=_0x81fe52['get']({'plain':!![]});var _0x563995='CustomDashboards';return db['UserProfileResource'][_0x5fc5('0x29')]({'where':{'type':_0x563995,'resourceId':_0xcca513['id']}})[_0x5fc5('0x28')](function(){return _0x81fe52;});})[_0x5fc5('0x28')](function(){_0x304a1f[_0x5fc5('0x1c')](0xcc)[_0x5fc5('0x1d')]();});}};}function handleEntityNotFound(_0x3aff95,_0x1d0477){return function(_0x14a640){if(!_0x14a640){_0x3aff95[_0x5fc5('0x1b')](0x194);}return _0x14a640;};}function handleError(_0x3fd696,_0x1374f9){_0x1374f9=_0x1374f9||0x1f4;return function(_0x89244a){logger[_0x5fc5('0x2a')](_0x89244a[_0x5fc5('0x2b')]);if(_0x89244a[_0x5fc5('0x2c')]){delete _0x89244a[_0x5fc5('0x2c')];}_0x3fd696[_0x5fc5('0x1c')](_0x1374f9)[_0x5fc5('0x2d')](_0x89244a);};}exports['index']=function(_0x49e7ba,_0x2da2e9){var _0x2d6c0e={},_0x437516={},_0x4c39d7={'count':0x0,'rows':[]};var _0x55346d=_['map'](db[_0x5fc5('0x2e')][_0x5fc5('0x2f')],function(_0x2577ec){return{'name':_0x2577ec[_0x5fc5('0x30')],'type':_0x2577ec[_0x5fc5('0x31')]['key']};});_0x437516[_0x5fc5('0x32')]=_[_0x5fc5('0x33')](_0x55346d,_0x5fc5('0x2c'));_0x437516['query']=_[_0x5fc5('0x34')](_0x49e7ba[_0x5fc5('0x35')]);_0x437516[_0x5fc5('0x36')]=_[_0x5fc5('0x37')](_0x437516[_0x5fc5('0x32')],_0x437516[_0x5fc5('0x35')]);_0x2d6c0e[_0x5fc5('0x38')]=_['intersection'](_0x437516[_0x5fc5('0x32')],qs[_0x5fc5('0x39')](_0x49e7ba[_0x5fc5('0x35')][_0x5fc5('0x39')]));_0x2d6c0e[_0x5fc5('0x38')]=_0x2d6c0e[_0x5fc5('0x38')]['length']?_0x2d6c0e['attributes']:_0x437516[_0x5fc5('0x32')];if(!_0x49e7ba[_0x5fc5('0x35')][_0x5fc5('0x3a')](_0x5fc5('0x3b'))){_0x2d6c0e[_0x5fc5('0x20')]=qs[_0x5fc5('0x20')](_0x49e7ba[_0x5fc5('0x35')]['limit']);_0x2d6c0e[_0x5fc5('0x1f')]=qs[_0x5fc5('0x1f')](_0x49e7ba['query'][_0x5fc5('0x1f')]);}_0x2d6c0e[_0x5fc5('0x3c')]=qs[_0x5fc5('0x3d')](_0x49e7ba[_0x5fc5('0x35')]['sort']);_0x2d6c0e[_0x5fc5('0x3e')]=qs[_0x5fc5('0x36')](_['pick'](_0x49e7ba[_0x5fc5('0x35')],_0x437516[_0x5fc5('0x36')]),_0x55346d);if(_0x49e7ba[_0x5fc5('0x35')]['filter']){_0x2d6c0e[_0x5fc5('0x3e')]=_['merge'](_0x2d6c0e[_0x5fc5('0x3e')],{'$or':_[_0x5fc5('0x33')](_0x55346d,function(_0x2f790e){if(_0x2f790e['type']!=='VIRTUAL'){var _0xc476b1={};_0xc476b1[_0x2f790e['name']]={'$like':'%'+_0x49e7ba[_0x5fc5('0x35')][_0x5fc5('0x3f')]+'%'};return _0xc476b1;}})});}_0x2d6c0e=_['merge']({},_0x2d6c0e,_0x49e7ba[_0x5fc5('0x40')]);var _0x5d4994={'where':_0x2d6c0e[_0x5fc5('0x3e')]};return db[_0x5fc5('0x2e')][_0x5fc5('0x22')](_0x5d4994)[_0x5fc5('0x28')](function(_0x4f7dbe){_0x4c39d7[_0x5fc5('0x22')]=_0x4f7dbe;if(_0x49e7ba[_0x5fc5('0x35')][_0x5fc5('0x41')]){_0x2d6c0e[_0x5fc5('0x42')]=[{'all':!![]}];}return db[_0x5fc5('0x2e')][_0x5fc5('0x43')](_0x2d6c0e);})[_0x5fc5('0x28')](function(_0x16963d){_0x4c39d7[_0x5fc5('0x44')]=_0x16963d;return _0x4c39d7;})[_0x5fc5('0x28')](respondWithFilteredResult(_0x2da2e9,_0x2d6c0e))[_0x5fc5('0x45')](handleError(_0x2da2e9,null));};exports['show']=function(_0x325638,_0x2a6831){var _0x1b7469={'raw':![],'where':{'id':_0x325638['params']['id']}},_0x4ec9d3={};_0x4ec9d3['model']=_[_0x5fc5('0x34')](db[_0x5fc5('0x2e')][_0x5fc5('0x2f')]);_0x4ec9d3['query']=_['keys'](_0x325638['query']);_0x4ec9d3[_0x5fc5('0x36')]=_[_0x5fc5('0x37')](_0x4ec9d3[_0x5fc5('0x32')],_0x4ec9d3['query']);_0x1b7469[_0x5fc5('0x38')]=_[_0x5fc5('0x37')](_0x4ec9d3[_0x5fc5('0x32')],qs['fields'](_0x325638[_0x5fc5('0x35')][_0x5fc5('0x39')]));_0x1b7469[_0x5fc5('0x38')]=_0x1b7469[_0x5fc5('0x38')][_0x5fc5('0x46')]?_0x1b7469[_0x5fc5('0x38')]:_0x4ec9d3[_0x5fc5('0x32')];if(_0x325638[_0x5fc5('0x35')][_0x5fc5('0x41')]){_0x1b7469['include']=[{'all':!![]}];}_0x1b7469=_['merge']({},_0x1b7469,_0x325638['options']);return db[_0x5fc5('0x2e')][_0x5fc5('0x47')](_0x1b7469)[_0x5fc5('0x28')](handleEntityNotFound(_0x2a6831,null))[_0x5fc5('0x28')](respondWithResult(_0x2a6831,null))[_0x5fc5('0x45')](handleError(_0x2a6831,null));};exports['create']=function(_0x3100d4,_0x3e91dc){return db[_0x5fc5('0x2e')][_0x5fc5('0x48')](_0x3100d4['body'],{})['then'](function(_0x44ba83){var _0x55e2c7=_0x3100d4[_0x5fc5('0x49')][_0x5fc5('0x4a')]({'plain':!![]});if(!_0x55e2c7)throw new Error(_0x5fc5('0x4b'));if(_0x55e2c7[_0x5fc5('0x4c')]==='user'){var _0x5ab068=_0x44ba83['get']({'plain':!![]});var _0x1f531d=_0x5fc5('0x4d');return db[_0x5fc5('0x4e')][_0x5fc5('0x47')]({'where':{'name':_0x1f531d,'userProfileId':_0x55e2c7[_0x5fc5('0x4f')]},'raw':!![]})[_0x5fc5('0x28')](function(_0x4efbdc){if(_0x4efbdc&&_0x4efbdc[_0x5fc5('0x50')]===0x0){return db[_0x5fc5('0x51')]['create']({'name':_0x5ab068[_0x5fc5('0x2c')],'resourceId':_0x5ab068['id'],'type':_0x4efbdc['name'],'sectionId':_0x4efbdc['id']},{})[_0x5fc5('0x28')](function(){return _0x44ba83;});}else{return _0x44ba83;}})[_0x5fc5('0x45')](function(_0x1b5f48){logger[_0x5fc5('0x2a')](_0x5fc5('0x52'),_0x1b5f48);throw _0x1b5f48;});}return _0x44ba83;})[_0x5fc5('0x28')](respondWithResult(_0x3e91dc,0xc9))[_0x5fc5('0x45')](handleError(_0x3e91dc,null));};exports[_0x5fc5('0x53')]=function(_0x488b61,_0x170d93){var _0x110d66={'where':{'id':_0x488b61[_0x5fc5('0x54')]['id']}},_0x2537df={};_0x2537df[_0x5fc5('0x32')]=_[_0x5fc5('0x34')](db[_0x5fc5('0x2e')][_0x5fc5('0x2f')]);_0x110d66[_0x5fc5('0x38')]=_[_0x5fc5('0x37')](_0x2537df[_0x5fc5('0x32')],qs[_0x5fc5('0x39')](_0x488b61['query'][_0x5fc5('0x39')]));_0x110d66[_0x5fc5('0x38')]=_0x110d66[_0x5fc5('0x38')]['length']?_0x110d66['attributes']:_0x2537df['model'];if(_0x488b61[_0x5fc5('0x35')]['includeAll']){_0x110d66[_0x5fc5('0x42')]=[{'all':!![]}];}_0x110d66=_[_0x5fc5('0x55')]({},_0x110d66,_0x488b61[_0x5fc5('0x40')]);return db[_0x5fc5('0x2e')][_0x5fc5('0x47')](_0x110d66)[_0x5fc5('0x28')](handleEntityNotFound(_0x170d93,null))[_0x5fc5('0x28')](function(_0xd4f79f){if(_0xd4f79f){var _0x113690=_0xd4f79f['get']({'plain':!![]});_0x113690=qs['omit'](_0x113690,['id',_0x5fc5('0x56'),'updatedAt']);_0x488b61[_0x5fc5('0x57')]=_[_0x5fc5('0x58')](_0x488b61['body'],['id','createdAt','updatedAt']);return db[_0x5fc5('0x2e')]['create'](_[_0x5fc5('0x55')](_0x113690,_0x488b61['body']),{'include':_0x488b61[_0x5fc5('0x35')][_0x5fc5('0x41')]?[{'all':!![]}]:undefined})['then'](function(_0x1b42ca){var _0x103eb6=_0x488b61[_0x5fc5('0x49')][_0x5fc5('0x4a')]({'plain':!![]});if(!_0x103eb6)throw new Error(_0x5fc5('0x4b'));if(_0x103eb6[_0x5fc5('0x4c')]===_0x5fc5('0x49')){var _0xf0ca09=_0x1b42ca['get']({'plain':!![]});var _0x4c87c7='CustomDashboards';return db[_0x5fc5('0x4e')][_0x5fc5('0x47')]({'where':{'name':_0x4c87c7,'userProfileId':_0x103eb6[_0x5fc5('0x4f')]},'raw':!![]})['then'](function(_0x2247b2){if(_0x2247b2&&_0x2247b2[_0x5fc5('0x50')]===0x0){return db[_0x5fc5('0x51')][_0x5fc5('0x48')]({'name':_0xf0ca09['name'],'resourceId':_0xf0ca09['id'],'type':_0x2247b2[_0x5fc5('0x2c')],'sectionId':_0x2247b2['id']},{})[_0x5fc5('0x28')](function(){return _0x1b42ca;});}else{return _0x1b42ca;}})[_0x5fc5('0x45')](function(_0x6534e5){logger[_0x5fc5('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x6534e5);throw _0x6534e5;});}return _0x1b42ca;});}})['then'](respondWithResult(_0x170d93,0xc9))['catch'](handleError(_0x170d93,null));};exports[_0x5fc5('0x27')]=function(_0x1147bd,_0x494722){if(_0x1147bd[_0x5fc5('0x57')]['id']){delete _0x1147bd[_0x5fc5('0x57')]['id'];}return db[_0x5fc5('0x2e')][_0x5fc5('0x47')]({'where':{'id':_0x1147bd[_0x5fc5('0x54')]['id']}})[_0x5fc5('0x28')](handleEntityNotFound(_0x494722,null))[_0x5fc5('0x28')](saveUpdates(_0x1147bd[_0x5fc5('0x57')],null))[_0x5fc5('0x28')](respondWithResult(_0x494722,null))['catch'](handleError(_0x494722,null));};exports[_0x5fc5('0x29')]=function(_0x3dc631,_0x3c6f6b){return db[_0x5fc5('0x2e')][_0x5fc5('0x47')]({'where':{'id':_0x3dc631[_0x5fc5('0x54')]['id']}})['then'](handleEntityNotFound(_0x3c6f6b,null))['then'](removeEntity(_0x3c6f6b,null))[_0x5fc5('0x45')](handleError(_0x3c6f6b,null));};function widgetAttributes(_0x5a3232){try{switch(_0x5a3232[_0x5fc5('0x31')]){case'iframe':return[{'name':'attrUrl','value':_0x5a3232['attrUrl']||(_0x5a3232['attrs']&&_0x5a3232['attrs'][0x0]?_0x5a3232['attrs'][0x0][_0x5fc5('0x59')]:undefined)||_0x5fc5('0x5a')}];case _0x5fc5('0x5b'):return[{'name':_0x5fc5('0x5c'),'value':_0x5a3232['attrPath']||(_0x5a3232[_0x5fc5('0x5d')]&&_0x5a3232['attrs'][0x0]?_0x5a3232[_0x5fc5('0x5d')][0x0][_0x5fc5('0x59')]:undefined)||''}];case _0x5fc5('0x5e'):return[{'name':_0x5fc5('0x5f'),'value':_0x5a3232[_0x5fc5('0x5f')]||(_0x5a3232['attrs']&&_0x5a3232['attrs'][0x0]?_0x5a3232[_0x5fc5('0x5d')][0x0]['value']:undefined)||'HH:mm:ss'},{'name':_0x5fc5('0x60'),'value':_0x5a3232[_0x5fc5('0x60')]||(_0x5a3232[_0x5fc5('0x5d')]&&_0x5a3232[_0x5fc5('0x5d')][0x1]?_0x5a3232[_0x5fc5('0x5d')][0x1][_0x5fc5('0x59')]:undefined)||_0x5fc5('0x61')},{'name':_0x5fc5('0x62'),'value':_0x5a3232['attrFontSize']||(_0x5a3232[_0x5fc5('0x5d')]&&_0x5a3232[_0x5fc5('0x5d')][0x2]?_0x5a3232[_0x5fc5('0x5d')][0x2][_0x5fc5('0x59')]:undefined)||0xc}];case _0x5fc5('0x63'):return[{'name':_0x5fc5('0x64'),'value':_0x5a3232[_0x5fc5('0x64')]||(_0x5a3232[_0x5fc5('0x5d')]&&_0x5a3232['attrs'][0x0]?_0x5a3232[_0x5fc5('0x5d')][0x0][_0x5fc5('0x59')]:undefined)||'total'},{'name':'attrVoiceQueues','value':_0x5a3232['attrVoiceQueues']||(_0x5a3232[_0x5fc5('0x5d')]&&_0x5a3232[_0x5fc5('0x5d')][0x1]?_0x5a3232[_0x5fc5('0x5d')][0x1][_0x5fc5('0x59')]:undefined)||[]},{'name':_0x5fc5('0x62'),'value':_0x5a3232[_0x5fc5('0x62')]||(_0x5a3232[_0x5fc5('0x5d')]&&_0x5a3232[_0x5fc5('0x5d')][0x2]?_0x5a3232[_0x5fc5('0x5d')][0x2][_0x5fc5('0x59')]:undefined)||0x14},{'name':_0x5fc5('0x65'),'value':_0x5a3232[_0x5fc5('0x65')]||(_0x5a3232[_0x5fc5('0x5d')]&&_0x5a3232[_0x5fc5('0x5d')][0x3]?_0x5a3232[_0x5fc5('0x5d')][0x3][_0x5fc5('0x59')]:undefined)||_0x5fc5('0x66')},{'name':_0x5fc5('0x67'),'value':_0x5a3232['attrEmailAccounts']||(_0x5a3232['attrs']&&_0x5a3232[_0x5fc5('0x5d')][0x4]?_0x5a3232[_0x5fc5('0x5d')][0x4][_0x5fc5('0x59')]:undefined)||''},{'name':_0x5fc5('0x68'),'value':_0x5a3232[_0x5fc5('0x68')]||(_0x5a3232[_0x5fc5('0x5d')]&&_0x5a3232[_0x5fc5('0x5d')][0x5]?_0x5a3232['attrs'][0x5][_0x5fc5('0x59')]:undefined)||''},{'name':_0x5fc5('0x69'),'value':_0x5a3232['attrSmsAccounts']||(_0x5a3232[_0x5fc5('0x5d')]&&_0x5a3232[_0x5fc5('0x5d')][0x6]?_0x5a3232[_0x5fc5('0x5d')][0x6][_0x5fc5('0x59')]:undefined)||''},{'name':_0x5fc5('0x6a'),'value':_0x5a3232[_0x5fc5('0x6a')]||(_0x5a3232[_0x5fc5('0x5d')]&&_0x5a3232['attrs'][0x7]?_0x5a3232[_0x5fc5('0x5d')][0x7][_0x5fc5('0x59')]:undefined)||''},{'name':_0x5fc5('0x6b'),'value':_0x5a3232[_0x5fc5('0x6b')]||(_0x5a3232[_0x5fc5('0x5d')]&&_0x5a3232['attrs'][0x8]?_0x5a3232[_0x5fc5('0x5d')][0x8][_0x5fc5('0x59')]:undefined)||''},{'name':_0x5fc5('0x6c'),'value':_0x5a3232[_0x5fc5('0x6c')]||(_0x5a3232[_0x5fc5('0x5d')]&&_0x5a3232[_0x5fc5('0x5d')][0x9]?_0x5a3232[_0x5fc5('0x5d')][0x9][_0x5fc5('0x59')]:undefined)||''}];case _0x5fc5('0x6d'):case'pie-chart':return[{'name':_0x5fc5('0x6e'),'value':_0x5a3232[_0x5fc5('0x6e')]||(_0x5a3232[_0x5fc5('0x5d')]&&_0x5a3232['attrs'][0x0]?_0x5a3232[_0x5fc5('0x5d')][0x0][_0x5fc5('0x59')]:undefined)||_0x5fc5('0x6f')},{'name':_0x5fc5('0x70'),'value':_0x5a3232[_0x5fc5('0x70')]||(_0x5a3232[_0x5fc5('0x5d')]&&_0x5a3232[_0x5fc5('0x5d')][0x1]?_0x5a3232[_0x5fc5('0x5d')][0x1]['value']:undefined)||null},{'name':_0x5fc5('0x71'),'value':_0x5a3232[_0x5fc5('0x71')]||(_0x5a3232[_0x5fc5('0x5d')]&&_0x5a3232[_0x5fc5('0x5d')][0x2]?_0x5a3232[_0x5fc5('0x5d')][0x2]['value']:undefined)||null},{'name':_0x5fc5('0x72'),'value':_0x5a3232[_0x5fc5('0x72')]||(_0x5a3232['attrs']&&_0x5a3232[_0x5fc5('0x5d')][0x3]?_0x5a3232[_0x5fc5('0x5d')][0x3][_0x5fc5('0x59')]:undefined)||[]},{'name':'attrChannel','value':_0x5a3232['attrChannel']||(_0x5a3232['attrs']&&_0x5a3232[_0x5fc5('0x5d')][0x4]?_0x5a3232[_0x5fc5('0x5d')][0x4]['value']:undefined)||_0x5fc5('0x66')},{'name':'attrEmailAccounts','value':_0x5a3232[_0x5fc5('0x67')]||(_0x5a3232[_0x5fc5('0x5d')]&&_0x5a3232[_0x5fc5('0x5d')][0x5]?_0x5a3232[_0x5fc5('0x5d')][0x5][_0x5fc5('0x59')]:undefined)||''},{'name':_0x5fc5('0x68'),'value':_0x5a3232[_0x5fc5('0x68')]||(_0x5a3232[_0x5fc5('0x5d')]&&_0x5a3232[_0x5fc5('0x5d')][0x6]?_0x5a3232['attrs'][0x6][_0x5fc5('0x59')]:undefined)||''},{'name':_0x5fc5('0x69'),'value':_0x5a3232[_0x5fc5('0x69')]||(_0x5a3232[_0x5fc5('0x5d')]&&_0x5a3232[_0x5fc5('0x5d')][0x7]?_0x5a3232['attrs'][0x7]['value']:undefined)||''},{'name':_0x5fc5('0x6a'),'value':_0x5a3232[_0x5fc5('0x6a')]||(_0x5a3232[_0x5fc5('0x5d')]&&_0x5a3232['attrs'][0x8]?_0x5a3232[_0x5fc5('0x5d')][0x8][_0x5fc5('0x59')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x5a3232[_0x5fc5('0x6b')]||(_0x5a3232['attrs']&&_0x5a3232[_0x5fc5('0x5d')][0x9]?_0x5a3232['attrs'][0x9][_0x5fc5('0x59')]:undefined)||''},{'name':_0x5fc5('0x6c'),'value':_0x5a3232[_0x5fc5('0x6c')]||(_0x5a3232['attrs']&&_0x5a3232[_0x5fc5('0x5d')][0xa]?_0x5a3232[_0x5fc5('0x5d')][0xa][_0x5fc5('0x59')]:undefined)||''}];case _0x5fc5('0x73'):return[{'name':_0x5fc5('0x74'),'type':_0x5a3232['reportType']||(_0x5a3232[_0x5fc5('0x5d')]&&_0x5a3232[_0x5fc5('0x5d')][0x0]?_0x5a3232[_0x5fc5('0x5d')][0x0][_0x5fc5('0x31')]:undefined)||null,'value':_0x5a3232['attrReport']||(_0x5a3232['attrs']&&_0x5a3232[_0x5fc5('0x5d')][0x0]?_0x5a3232[_0x5fc5('0x5d')][0x0][_0x5fc5('0x59')]:undefined)||null},{'name':_0x5fc5('0x75'),'value':_0x5a3232[_0x5fc5('0x75')]||(_0x5a3232[_0x5fc5('0x5d')]&&_0x5a3232[_0x5fc5('0x5d')][0x1]?_0x5a3232[_0x5fc5('0x5d')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x50c7d9){logger[_0x5fc5('0x2a')](_0x5fc5('0x76'),JSON[_0x5fc5('0x77')](_0x50c7d9));return[];}}exports['addItem']=function(_0x2e9e01,_0xe54844,_0x3cecc0){if(_0x2e9e01['body']['id']){delete _0x2e9e01[_0x5fc5('0x57')]['id'];}return db[_0x5fc5('0x2e')][_0x5fc5('0x47')]({'where':{'id':_0x2e9e01[_0x5fc5('0x54')]['id']}})[_0x5fc5('0x28')](handleEntityNotFound(_0xe54844,null))[_0x5fc5('0x28')](function(_0x57dc29){if(_0x57dc29){_0x2e9e01[_0x5fc5('0x57')][_0x5fc5('0x78')]=_0x57dc29['id'];_0x2e9e01[_0x5fc5('0x57')][_0x5fc5('0x5d')]=widgetAttributes(_0x2e9e01[_0x5fc5('0x57')]);return db[_0x5fc5('0x79')][_0x5fc5('0x48')](_0x2e9e01[_0x5fc5('0x57')]);}})[_0x5fc5('0x28')](respondWithResult(_0xe54844,null))[_0x5fc5('0x45')](handleError(_0xe54844,null));};exports[_0x5fc5('0x7a')]=function(_0x3c2b94,_0x1f930d,_0x57f2aa){var _0x21d826={};var _0x3a2980={};var _0x2054a3;var _0x118dc4;return db[_0x5fc5('0x2e')][_0x5fc5('0x7b')]({'where':{'id':_0x3c2b94['params']['id']}})[_0x5fc5('0x28')](handleEntityNotFound(_0x1f930d,null))[_0x5fc5('0x28')](function(_0x3d461d){if(_0x3d461d){_0x2054a3=_0x3d461d;_0x3a2980['model']=_[_0x5fc5('0x34')](db['DashboardItem']['rawAttributes']);_0x3a2980[_0x5fc5('0x35')]=_[_0x5fc5('0x34')](_0x3c2b94[_0x5fc5('0x35')]);_0x3a2980[_0x5fc5('0x36')]=_[_0x5fc5('0x37')](_0x3a2980[_0x5fc5('0x32')],_0x3a2980[_0x5fc5('0x35')]);_0x21d826[_0x5fc5('0x38')]=_['intersection'](_0x3a2980['model'],qs[_0x5fc5('0x39')](_0x3c2b94[_0x5fc5('0x35')][_0x5fc5('0x39')]));_0x21d826[_0x5fc5('0x38')]=_0x21d826[_0x5fc5('0x38')][_0x5fc5('0x46')]?_0x21d826[_0x5fc5('0x38')]:_0x3a2980[_0x5fc5('0x32')];_0x21d826[_0x5fc5('0x3c')]=qs['sort'](_0x3c2b94['query']['sort']);_0x21d826[_0x5fc5('0x3e')]=qs[_0x5fc5('0x36')](_[_0x5fc5('0x7c')](_0x3c2b94[_0x5fc5('0x35')],_0x3a2980[_0x5fc5('0x36')]));if(_0x3c2b94[_0x5fc5('0x35')][_0x5fc5('0x3f')]){_0x21d826['where']=_[_0x5fc5('0x55')](_0x21d826[_0x5fc5('0x3e')],{'$or':_['map'](_0x21d826[_0x5fc5('0x38')],function(_0x1f2018){var _0x43e8ac={};_0x43e8ac[_0x1f2018]={'$like':'%'+_0x3c2b94[_0x5fc5('0x35')][_0x5fc5('0x3f')]+'%'};return _0x43e8ac;})});}_0x21d826=_[_0x5fc5('0x55')]({},_0x21d826,_0x3c2b94[_0x5fc5('0x40')]);return _0x2054a3[_0x5fc5('0x7a')](_0x21d826);}})[_0x5fc5('0x28')](function(_0x152b62){if(_0x152b62){_0x118dc4=_0x152b62[_0x5fc5('0x46')];if(!_0x3c2b94[_0x5fc5('0x35')][_0x5fc5('0x3a')](_0x5fc5('0x3b'))){_0x21d826[_0x5fc5('0x20')]=qs[_0x5fc5('0x20')](_0x3c2b94[_0x5fc5('0x35')][_0x5fc5('0x20')]);_0x21d826['offset']=qs[_0x5fc5('0x1f')](_0x3c2b94[_0x5fc5('0x35')]['offset']);}return _0x2054a3['getItems'](_0x21d826);}})[_0x5fc5('0x28')](function(_0x53492b){if(_0x53492b){return _0x53492b?{'count':_0x118dc4,'rows':_0x53492b}:null;}})[_0x5fc5('0x28')](respondWithResult(_0x1f930d,null))[_0x5fc5('0x45')](handleError(_0x1f930d,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index dee3f54..2f62477 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 _0xd4e8=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','Dashboard'];(function(_0x151436,_0x469bcf){var _0x117e9d=function(_0x5b9890){while(--_0x5b9890){_0x151436['push'](_0x151436['shift']());}};_0x117e9d(++_0x469bcf);}(_0xd4e8,0xe7));var _0x8d4e=function(_0x10de99,_0xdd42d){_0x10de99=_0x10de99-0x0;var _0x8550e5=_0xd4e8[_0x10de99];return _0x8550e5;};'use strict';var EventEmitter=require(_0x8d4e('0x0'));var Dashboard=require(_0x8d4e('0x1'))['db'][_0x8d4e('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x8d4e('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8d4e('0x4'),'afterDestroy':_0x8d4e('0x5')};function emitEvent(_0x5ca730){return function(_0x2f42a7,_0x371f4c,_0x22d139){DashboardEvents[_0x8d4e('0x6')](_0x5ca730+':'+_0x2f42a7['id'],_0x2f42a7);DashboardEvents['emit'](_0x5ca730,_0x2f42a7);_0x22d139(null);};}for(var e in events){if(events[_0x8d4e('0x7')](e)){var event=events[e];Dashboard[_0x8d4e('0x8')](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file +var _0xb8f1=['save','emit','hasOwnProperty','events','../../mysqldb','setMaxListeners'];(function(_0x5489c4,_0x1e7a17){var _0x2c4624=function(_0x42675a){while(--_0x42675a){_0x5489c4['push'](_0x5489c4['shift']());}};_0x2c4624(++_0x1e7a17);}(_0xb8f1,0x15f));var _0x1b8f=function(_0x34a223,_0x5b0fe9){_0x34a223=_0x34a223-0x0;var _0x4a9a0e=_0xb8f1[_0x34a223];return _0x4a9a0e;};'use strict';var EventEmitter=require(_0x1b8f('0x0'));var Dashboard=require(_0x1b8f('0x1'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0x1b8f('0x2')](0x0);var events={'afterCreate':_0x1b8f('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1f800b){return function(_0x469d08,_0x3cceee,_0x9158c2){DashboardEvents[_0x1b8f('0x4')](_0x1f800b+':'+_0x469d08['id'],_0x469d08);DashboardEvents[_0x1b8f('0x4')](_0x1f800b,_0x469d08);_0x9158c2(null);};}for(var e in events){if(events[_0x1b8f('0x5')](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 47d5fad..582fb9b 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 _0xa4b1=['request-promise','path','../../config/environment','./dashboard.attributes','exports','define','Dashboard','dashboards','lodash','util','../../config/logger','api','moment'];(function(_0x42d67f,_0x5ec7ab){var _0x4e1773=function(_0x1d1aa7){while(--_0x1d1aa7){_0x42d67f['push'](_0x42d67f['shift']());}};_0x4e1773(++_0x5ec7ab);}(_0xa4b1,0x133));var _0x1a4b=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa4b1[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x1a4b('0x0'));var util=require(_0x1a4b('0x1'));var logger=require(_0x1a4b('0x2'))(_0x1a4b('0x3'));var moment=require(_0x1a4b('0x4'));var BPromise=require('bluebird');var rp=require(_0x1a4b('0x5'));var fs=require('fs');var path=require(_0x1a4b('0x6'));var rimraf=require('rimraf');var config=require(_0x1a4b('0x7'));var attributes=require(_0x1a4b('0x8'));module[_0x1a4b('0x9')]=function(_0x2861ef,_0x569494){return _0x2861ef[_0x1a4b('0xa')](_0x1a4b('0xb'),attributes,{'tableName':_0x1a4b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x708d=['lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./dashboard.attributes','exports','define','Dashboard','dashboards'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x708d,0x145));var _0xd708=function(_0x449166,_0x35d5c7){_0x449166=_0x449166-0x0;var _0x37916d=_0x708d[_0x449166];return _0x37916d;};'use strict';var _=require(_0xd708('0x0'));var util=require(_0xd708('0x1'));var logger=require(_0xd708('0x2'))('api');var moment=require('moment');var BPromise=require(_0xd708('0x3'));var rp=require(_0xd708('0x4'));var fs=require('fs');var path=require(_0xd708('0x5'));var rimraf=require(_0xd708('0x6'));var config=require(_0xd708('0x7'));var attributes=require(_0xd708('0x8'));module[_0xd708('0x9')]=function(_0x190770,_0x1f9255){return _0x190770[_0xd708('0xa')](_0xd708('0xb'),attributes,{'tableName':_0xd708('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index 50ed44c..66f15b5 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 _0x924b=['code','Dashboard,\x20%s,\x20%s','message','info','result','catch','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','then','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','error'];(function(_0x8e9386,_0x3cc60f){var _0x4abf26=function(_0x59de5a){while(--_0x59de5a){_0x8e9386['push'](_0x8e9386['shift']());}};_0x4abf26(++_0x3cc60f);}(_0x924b,0x76));var _0xb924=function(_0x497948,_0x4ca60c){_0x497948=_0x497948-0x0;var _0x39bb36=_0x924b[_0x497948];return _0x39bb36;};'use strict';var _=require(_0xb924('0x0'));var util=require('util');var moment=require(_0xb924('0x1'));var BPromise=require(_0xb924('0x2'));var rs=require(_0xb924('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb924('0x4'));var logger=require(_0xb924('0x5'))(_0xb924('0x6'));var config=require(_0xb924('0x7'));var jayson=require(_0xb924('0x8'));var client=jayson[_0xb924('0x9')][_0xb924('0xa')]({'port':0x232a});config[_0xb924('0xb')]=_[_0xb924('0xc')](config[_0xb924('0xb')],{'host':_0xb924('0xd'),'port':0x18eb});var socket=require(_0xb924('0xe'))(new Redis(config[_0xb924('0xb')]));require(_0xb924('0xf'))[_0xb924('0x10')](socket);function respondWithRpcPromise(_0x39bcc8,_0x5df619,_0x200dfd){return new BPromise(function(_0x9d7f1e,_0x46cf22){return client['request'](_0x39bcc8,_0x200dfd)[_0xb924('0x11')](function(_0x51fb48){logger['info']('Dashboard,\x20%s,\x20%s',_0x5df619,_0xb924('0x12'));logger[_0xb924('0x13')](_0xb924('0x14'),_0x5df619,_0xb924('0x12'),JSON['stringify'](_0x51fb48));if(_0x51fb48[_0xb924('0x15')]){if(_0x51fb48[_0xb924('0x15')][_0xb924('0x16')]===0x1f4){logger[_0xb924('0x15')](_0xb924('0x17'),_0x5df619,_0x51fb48['error'][_0xb924('0x18')]);return _0x46cf22(_0x51fb48[_0xb924('0x15')][_0xb924('0x18')]);}logger[_0xb924('0x15')]('Dashboard,\x20%s,\x20%s',_0x5df619,_0x51fb48[_0xb924('0x15')][_0xb924('0x18')]);return _0x9d7f1e(_0x51fb48['error'][_0xb924('0x18')]);}else{logger[_0xb924('0x19')](_0xb924('0x17'),_0x5df619,_0xb924('0x12'));_0x9d7f1e(_0x51fb48[_0xb924('0x1a')][_0xb924('0x18')]);}})[_0xb924('0x1b')](function(_0x58709f){logger[_0xb924('0x15')](_0xb924('0x17'),_0x5df619,_0x58709f);_0x46cf22(_0x58709f);});});} \ No newline at end of file +var _0x4fd2=['code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x51db82,_0x4c69ce){var _0x21ded1=function(_0x54988f){while(--_0x54988f){_0x51db82['push'](_0x51db82['shift']());}};_0x21ded1(++_0x4c69ce);}(_0x4fd2,0x77));var _0x24fd=function(_0x17f79c,_0x2072d5){_0x17f79c=_0x17f79c-0x0;var _0x44ff45=_0x4fd2[_0x17f79c];return _0x44ff45;};'use strict';var _=require(_0x24fd('0x0'));var util=require(_0x24fd('0x1'));var moment=require(_0x24fd('0x2'));var BPromise=require(_0x24fd('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x24fd('0x4'));var db=require(_0x24fd('0x5'))['db'];var utils=require(_0x24fd('0x6'));var logger=require(_0x24fd('0x7'))('rpc');var config=require(_0x24fd('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x24fd('0x9')][_0x24fd('0xa')]({'port':0x232a});config[_0x24fd('0xb')]=_[_0x24fd('0xc')](config[_0x24fd('0xb')],{'host':_0x24fd('0xd'),'port':0x18eb});var socket=require(_0x24fd('0xe'))(new Redis(config[_0x24fd('0xb')]));require(_0x24fd('0xf'))[_0x24fd('0x10')](socket);function respondWithRpcPromise(_0x202c36,_0x2e103b,_0x50771c){return new BPromise(function(_0xdce557,_0x26c5ca){return client[_0x24fd('0x11')](_0x202c36,_0x50771c)[_0x24fd('0x12')](function(_0x3d1a55){logger[_0x24fd('0x13')](_0x24fd('0x14'),_0x2e103b,_0x24fd('0x15'));logger[_0x24fd('0x16')](_0x24fd('0x17'),_0x2e103b,'request\x20sent',JSON[_0x24fd('0x18')](_0x3d1a55));if(_0x3d1a55[_0x24fd('0x19')]){if(_0x3d1a55[_0x24fd('0x19')][_0x24fd('0x1a')]===0x1f4){logger[_0x24fd('0x19')](_0x24fd('0x14'),_0x2e103b,_0x3d1a55[_0x24fd('0x19')][_0x24fd('0x1b')]);return _0x26c5ca(_0x3d1a55[_0x24fd('0x19')][_0x24fd('0x1b')]);}logger[_0x24fd('0x19')]('Dashboard,\x20%s,\x20%s',_0x2e103b,_0x3d1a55[_0x24fd('0x19')][_0x24fd('0x1b')]);return _0xdce557(_0x3d1a55[_0x24fd('0x19')][_0x24fd('0x1b')]);}else{logger[_0x24fd('0x13')](_0x24fd('0x14'),_0x2e103b,_0x24fd('0x15'));_0xdce557(_0x3d1a55[_0x24fd('0x1c')][_0x24fd('0x1b')]);}})['catch'](function(_0x4c2894){logger[_0x24fd('0x19')](_0x24fd('0x14'),_0x2e103b,_0x4c2894);_0x26c5ca(_0x4c2894);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 97f0845..a6786c3 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 _0xe443=['save','remove','update','removeListener','length','dashboard:'];(function(_0x3741ac,_0x46bf07){var _0x2b22c5=function(_0x591f8d){while(--_0x591f8d){_0x3741ac['push'](_0x3741ac['shift']());}};_0x2b22c5(++_0x46bf07);}(_0xe443,0x162));var _0x3e44=function(_0x3fee0b,_0x141c74){_0x3fee0b=_0x3fee0b-0x0;var _0x1d1e29=_0xe443[_0x3fee0b];return _0x1d1e29;};'use strict';var DashboardEvents=require('./dashboard.events');var events=[_0x3e44('0x0'),_0x3e44('0x1'),_0x3e44('0x2')];function createListener(_0x46aac9,_0x2f9273){return function(_0x1e8b39){_0x2f9273['emit'](_0x46aac9,_0x1e8b39);};}function removeListener(_0xa32fb2,_0x546daf){return function(){DashboardEvents[_0x3e44('0x3')](_0xa32fb2,_0x546daf);};}exports['register']=function(_0x3d560e){for(var _0x14b6ce=0x0,_0x184e16=events[_0x3e44('0x4')];_0x14b6ce<_0x184e16;_0x14b6ce++){var _0x53eb7d=events[_0x14b6ce];var _0x860104=createListener(_0x3e44('0x5')+_0x53eb7d,_0x3d560e);DashboardEvents['on'](_0x53eb7d,_0x860104);}}; \ No newline at end of file +var _0x6141=['dashboard:','save','remove','update','emit','removeListener','register'];(function(_0x25fa5c,_0x421141){var _0x1bade2=function(_0x3faf20){while(--_0x3faf20){_0x25fa5c['push'](_0x25fa5c['shift']());}};_0x1bade2(++_0x421141);}(_0x6141,0x119));var _0x1614=function(_0x210c74,_0x1b9096){_0x210c74=_0x210c74-0x0;var _0x22de10=_0x6141[_0x210c74];return _0x22de10;};'use strict';var DashboardEvents=require('./dashboard.events');var events=[_0x1614('0x0'),_0x1614('0x1'),_0x1614('0x2')];function createListener(_0x16a5ba,_0x1b7c56){return function(_0x416bb2){_0x1b7c56[_0x1614('0x3')](_0x16a5ba,_0x416bb2);};}function removeListener(_0x155f72,_0x504350){return function(){DashboardEvents[_0x1614('0x4')](_0x155f72,_0x504350);};}exports[_0x1614('0x5')]=function(_0xc64a0e){for(var _0x4f639e=0x0,_0x51b7e7=events['length'];_0x4f639e<_0x51b7e7;_0x4f639e++){var _0x3496ad=events[_0x4f639e];var _0x2d60f2=createListener(_0x1614('0x6')+_0x3496ad,_0xc64a0e);DashboardEvents['on'](_0x3496ad,_0x2d60f2);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index ccfc7df..8603936 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 _0x687f=['clone','addItem','update','delete','destroy','multer','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','getItems','post'];(function(_0x1635fe,_0x5f1d9f){var _0x3c512a=function(_0x26b53d){while(--_0x26b53d){_0x1635fe['push'](_0x1635fe['shift']());}};_0x3c512a(++_0x5f1d9f);}(_0x687f,0xa7));var _0xf687=function(_0x3337b6,_0x42c7f9){_0x3337b6=_0x3337b6-0x0;var _0x568270=_0x687f[_0x3337b6];return _0x568270;};'use strict';var multer=require(_0xf687('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xf687('0x1'));var router=express[_0xf687('0x2')]();var fs_extra=require(_0xf687('0x3'));var auth=require(_0xf687('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xf687('0x5'));var controller=require('./dashboard.controller');router[_0xf687('0x6')]('/',auth[_0xf687('0x7')](),controller[_0xf687('0x8')]);router[_0xf687('0x6')](_0xf687('0x9'),auth[_0xf687('0x7')](),controller[_0xf687('0xa')]);router[_0xf687('0x6')]('/:id/items',auth[_0xf687('0x7')](),controller[_0xf687('0xb')]);router['post']('/',auth[_0xf687('0x7')](),controller['create']);router[_0xf687('0xc')]('/:id/clone',auth[_0xf687('0x7')](),controller[_0xf687('0xd')]);router[_0xf687('0xc')]('/:id/items',auth['isAuthenticated'](),controller[_0xf687('0xe')]);router['put'](_0xf687('0x9'),auth[_0xf687('0x7')](),controller[_0xf687('0xf')]);router[_0xf687('0x10')](_0xf687('0x9'),auth[_0xf687('0x7')](),controller[_0xf687('0x11')]);module['exports']=router; \ No newline at end of file +var _0x5a0b=['index','/:id','show','/:id/items','getItems','post','create','/:id/clone','addItem','put','update','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated'];(function(_0x1d3019,_0x8dbbd5){var _0x36458e=function(_0x5d60db){while(--_0x5d60db){_0x1d3019['push'](_0x1d3019['shift']());}};_0x36458e(++_0x8dbbd5);}(_0x5a0b,0xa3));var _0xb5a0=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0x5a0b[_0x40ac5e];return _0x2839d6;};'use strict';var multer=require(_0xb5a0('0x0'));var util=require(_0xb5a0('0x1'));var path=require(_0xb5a0('0x2'));var timeout=require('connect-timeout');var express=require(_0xb5a0('0x3'));var router=express[_0xb5a0('0x4')]();var fs_extra=require(_0xb5a0('0x5'));var auth=require(_0xb5a0('0x6'));var interaction=require(_0xb5a0('0x7'));var config=require(_0xb5a0('0x8'));var controller=require(_0xb5a0('0x9'));router[_0xb5a0('0xa')]('/',auth[_0xb5a0('0xb')](),controller[_0xb5a0('0xc')]);router[_0xb5a0('0xa')](_0xb5a0('0xd'),auth[_0xb5a0('0xb')](),controller[_0xb5a0('0xe')]);router[_0xb5a0('0xa')](_0xb5a0('0xf'),auth['isAuthenticated'](),controller[_0xb5a0('0x10')]);router[_0xb5a0('0x11')]('/',auth[_0xb5a0('0xb')](),controller[_0xb5a0('0x12')]);router[_0xb5a0('0x11')](_0xb5a0('0x13'),auth[_0xb5a0('0xb')](),controller['clone']);router[_0xb5a0('0x11')](_0xb5a0('0xf'),auth[_0xb5a0('0xb')](),controller[_0xb5a0('0x14')]);router[_0xb5a0('0x15')](_0xb5a0('0xd'),auth[_0xb5a0('0xb')](),controller[_0xb5a0('0x16')]);router['delete']('/:id',auth[_0xb5a0('0xb')](),controller[_0xb5a0('0x17')]);module[_0xb5a0('0x18')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 88aa9bc..4bfe06a 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 _0x6f47=['#ffffff','squel','lodash','STRING','TEXT','parse','getDataValue','attrs','setDataValue','stringify','INTEGER'];(function(_0x3f2b8f,_0x28a198){var _0x367e4a=function(_0x5b4d8e){while(--_0x5b4d8e){_0x3f2b8f['push'](_0x3f2b8f['shift']());}};_0x367e4a(++_0x28a198);}(_0x6f47,0xc7));var _0x76f4=function(_0x1c8c28,_0x3ee093){_0x1c8c28=_0x1c8c28-0x0;var _0x1f59b4=_0x6f47[_0x1c8c28];return _0x1f59b4;};'use strict';var Sequelize=require('sequelize');var squel=require(_0x76f4('0x0'));var _=require(_0x76f4('0x1'));module['exports']={'title':{'type':Sequelize[_0x76f4('0x2')],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x76f4('0x3')]('long'),'get':function(){try{return JSON[_0x76f4('0x4')](this[_0x76f4('0x5')](_0x76f4('0x6')));}catch(_0x2523ba){return[];}},'set':function(_0x5754ca){try{this[_0x76f4('0x7')](_0x76f4('0x6'),JSON[_0x76f4('0x8')](_0x5754ca));}catch(_0x497f99){this[_0x76f4('0x7')](_0x76f4('0x6'),JSON[_0x76f4('0x8')]([]));}}},'sizeX':{'type':Sequelize[_0x76f4('0x9')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x76f4('0x9')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize[_0x76f4('0x2')],'allowNull':![],'defaultValue':_0x76f4('0xa'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x76f4('0x2')]},'titleFontSize':{'type':Sequelize[_0x76f4('0x9')],'defaultValue':0xc}}; \ No newline at end of file +var _0xc4aa=['getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3','sequelize','squel','lodash','exports','STRING'];(function(_0x1a9d87,_0x3e51a1){var _0x2714a8=function(_0x3f03bf){while(--_0x3f03bf){_0x1a9d87['push'](_0x1a9d87['shift']());}};_0x2714a8(++_0x3e51a1);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0xc4aa[_0x17b6e3];return _0x3906f3;};'use strict';var Sequelize=require(_0xac4a('0x0'));var squel=require(_0xac4a('0x1'));var _=require(_0xac4a('0x2'));module[_0xac4a('0x3')]={'title':{'type':Sequelize[_0xac4a('0x4')],'allowNull':![]},'type':{'type':Sequelize[_0xac4a('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT']('long'),'get':function(){try{return JSON['parse'](this[_0xac4a('0x5')](_0xac4a('0x6')));}catch(_0x730a38){return[];}},'set':function(_0x215f39){try{this[_0xac4a('0x7')](_0xac4a('0x6'),JSON[_0xac4a('0x8')](_0x215f39));}catch(_0x10525b){this['setDataValue']('attrs',JSON[_0xac4a('0x8')]([]));}}},'sizeX':{'type':Sequelize[_0xac4a('0x9')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xac4a('0x9')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize[_0xac4a('0x9')]},'background':{'type':Sequelize[_0xac4a('0x4')],'allowNull':![],'defaultValue':_0xac4a('0xa'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xac4a('0xb'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']},'titleFontSize':{'type':Sequelize[_0xac4a('0x9')],'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 e7dda7b..1ee59e4 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 _0xcaf2=['type','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./dashboardItem.socket','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','save','update','then','sendStatus','error','stack','name','send','show','model','keys','rawAttributes','query','filters','attributes','intersection','fields','includeAll','include','merge','options','DashboardItem','find','catch','params'];(function(_0x2f0510,_0x193e90){var _0x2ef5b8=function(_0x4f2892){while(--_0x4f2892){_0x2f0510['push'](_0x2f0510['shift']());}};_0x2ef5b8(++_0x193e90);}(_0xcaf2,0x8a));var _0x2caf=function(_0x5a69ab,_0x610049){_0x5a69ab=_0x5a69ab-0x0;var _0x27f2f7=_0xcaf2[_0x5a69ab];return _0x27f2f7;};'use strict';var emlformat=require(_0x2caf('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2caf('0x1'));var jsonpatch=require(_0x2caf('0x2'));var rp=require('request-promise');var moment=require(_0x2caf('0x3'));var BPromise=require(_0x2caf('0x4'));var Mustache=require('mustache');var util=require(_0x2caf('0x5'));var path=require('path');var sox=require(_0x2caf('0x6'));var csv=require(_0x2caf('0x7'));var ejs=require(_0x2caf('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2caf('0x9'));var squel=require(_0x2caf('0xa'));var crypto=require(_0x2caf('0xb'));var jsforce=require(_0x2caf('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x2caf('0x7'));var querystring=require(_0x2caf('0xd'));var Papa=require(_0x2caf('0xe'));var Redis=require(_0x2caf('0xf'));var authService=require(_0x2caf('0x10'));var qs=require(_0x2caf('0x11'));var as=require(_0x2caf('0x12'));var hardwareService=require(_0x2caf('0x13'));var logger=require(_0x2caf('0x14'))('api');var utils=require(_0x2caf('0x15'));var config=require(_0x2caf('0x16'));var licenseUtil=require(_0x2caf('0x17'));var db=require(_0x2caf('0x18'))['db'];config[_0x2caf('0x19')]=_[_0x2caf('0x1a')](config[_0x2caf('0x19')],{'host':_0x2caf('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2caf('0x19')]));require(_0x2caf('0x1c'))['register'](socket);function respondWithStatusCode(_0x4c47b8,_0x5f1e93){_0x5f1e93=_0x5f1e93||0xcc;return function(_0x27bca8){if(_0x27bca8){return _0x4c47b8['sendStatus'](_0x5f1e93);}return _0x4c47b8[_0x2caf('0x1d')](_0x5f1e93)[_0x2caf('0x1e')]();};}function respondWithResult(_0x3b8b67,_0x32ff41){_0x32ff41=_0x32ff41||0xc8;return function(_0x486b8d){if(_0x486b8d){return _0x3b8b67[_0x2caf('0x1d')](_0x32ff41)['json'](_0x486b8d);}};}function respondWithFilteredResult(_0x2d5b64,_0x57f3cd){return function(_0x4a33fc){if(_0x4a33fc){var _0x3e975f=typeof _0x57f3cd['offset']===_0x2caf('0x1f')&&typeof _0x57f3cd[_0x2caf('0x20')]==='undefined';var _0x12624b=_0x4a33fc[_0x2caf('0x21')];var _0x6b3778=_0x3e975f?0x0:_0x57f3cd[_0x2caf('0x22')];var _0x20f7d3=_0x3e975f?_0x4a33fc['count']:_0x57f3cd[_0x2caf('0x22')]+_0x57f3cd[_0x2caf('0x20')];var _0x2b4d16;if(_0x20f7d3>=_0x12624b){_0x20f7d3=_0x12624b;_0x2b4d16=0xc8;}else{_0x2b4d16=0xce;}_0x2d5b64[_0x2caf('0x1d')](_0x2b4d16);return _0x2d5b64[_0x2caf('0x23')](_0x2caf('0x24'),_0x6b3778+'-'+_0x20f7d3+'/'+_0x12624b)[_0x2caf('0x25')](_0x4a33fc);}return null;};}function patchUpdates(_0x256cc4){return function(_0x3332b1){try{jsonpatch[_0x2caf('0x26')](_0x3332b1,_0x256cc4,!![]);}catch(_0x6814bc){return BPromise['reject'](_0x6814bc);}return _0x3332b1[_0x2caf('0x27')]();};}function saveUpdates(_0x14bfd2,_0x1f29b0){return function(_0x401ea2){if(_0x401ea2){return _0x401ea2[_0x2caf('0x28')](_0x14bfd2)[_0x2caf('0x29')](function(_0x392196){return _0x392196;});}return null;};}function removeEntity(_0x164da,_0x2e0a75){return function(_0x31f059){if(_0x31f059){return _0x31f059['destroy']()[_0x2caf('0x29')](function(){_0x164da[_0x2caf('0x1d')](0xcc)[_0x2caf('0x1e')]();});}};}function handleEntityNotFound(_0x37b08f,_0x3c60d1){return function(_0x17d3c6){if(!_0x17d3c6){_0x37b08f[_0x2caf('0x2a')](0x194);}return _0x17d3c6;};}function handleError(_0x135977,_0x23f765){_0x23f765=_0x23f765||0x1f4;return function(_0x2304f1){logger[_0x2caf('0x2b')](_0x2304f1[_0x2caf('0x2c')]);if(_0x2304f1[_0x2caf('0x2d')]){delete _0x2304f1['name'];}_0x135977[_0x2caf('0x1d')](_0x23f765)[_0x2caf('0x2e')](_0x2304f1);};}exports[_0x2caf('0x2f')]=function(_0x25bbfc,_0xa8523b){var _0x1f52bf={'raw':![],'where':{'id':_0x25bbfc['params']['id']}},_0x3812cd={};_0x3812cd[_0x2caf('0x30')]=_[_0x2caf('0x31')](db['DashboardItem'][_0x2caf('0x32')]);_0x3812cd[_0x2caf('0x33')]=_[_0x2caf('0x31')](_0x25bbfc['query']);_0x3812cd[_0x2caf('0x34')]=_['intersection'](_0x3812cd['model'],_0x3812cd[_0x2caf('0x33')]);_0x1f52bf[_0x2caf('0x35')]=_[_0x2caf('0x36')](_0x3812cd[_0x2caf('0x30')],qs[_0x2caf('0x37')](_0x25bbfc[_0x2caf('0x33')][_0x2caf('0x37')]));_0x1f52bf[_0x2caf('0x35')]=_0x1f52bf[_0x2caf('0x35')]['length']?_0x1f52bf[_0x2caf('0x35')]:_0x3812cd[_0x2caf('0x30')];if(_0x25bbfc[_0x2caf('0x33')][_0x2caf('0x38')]){_0x1f52bf[_0x2caf('0x39')]=[{'all':!![]}];}_0x1f52bf=_[_0x2caf('0x3a')]({},_0x1f52bf,_0x25bbfc[_0x2caf('0x3b')]);return db[_0x2caf('0x3c')][_0x2caf('0x3d')](_0x1f52bf)[_0x2caf('0x29')](handleEntityNotFound(_0xa8523b,null))[_0x2caf('0x29')](respondWithResult(_0xa8523b,null))[_0x2caf('0x3e')](handleError(_0xa8523b,null));};exports['destroy']=function(_0x5b3a78,_0x410020){return db[_0x2caf('0x3c')][_0x2caf('0x3d')]({'where':{'id':_0x5b3a78[_0x2caf('0x3f')]['id']}})['then'](handleEntityNotFound(_0x410020,null))[_0x2caf('0x29')](removeEntity(_0x410020,null))[_0x2caf('0x3e')](handleError(_0x410020,null));};function widgetAttributes(_0x4568f9){try{switch(_0x4568f9[_0x2caf('0x40')]){case _0x2caf('0x41'):return[{'name':_0x2caf('0x42'),'value':_0x4568f9[_0x2caf('0x42')]||(_0x4568f9[_0x2caf('0x43')]&&_0x4568f9['attrs'][0x0]?_0x4568f9['attrs'][0x0][_0x2caf('0x44')]:undefined)||_0x2caf('0x45')}];case _0x2caf('0x46'):return[{'name':_0x2caf('0x47'),'value':_0x4568f9[_0x2caf('0x47')]||(_0x4568f9[_0x2caf('0x43')]&&_0x4568f9[_0x2caf('0x43')][0x0]?_0x4568f9[_0x2caf('0x43')][0x0][_0x2caf('0x44')]:undefined)||''}];case _0x2caf('0x48'):return[{'name':_0x2caf('0x49'),'value':_0x4568f9['attrHourFormat']||(_0x4568f9[_0x2caf('0x43')]&&_0x4568f9[_0x2caf('0x43')][0x0]?_0x4568f9[_0x2caf('0x43')][0x0]['value']:undefined)||_0x2caf('0x4a')},{'name':_0x2caf('0x4b'),'value':_0x4568f9[_0x2caf('0x4b')]||(_0x4568f9['attrs']&&_0x4568f9[_0x2caf('0x43')][0x1]?_0x4568f9[_0x2caf('0x43')][0x1]['value']:undefined)||_0x2caf('0x4c')},{'name':_0x2caf('0x4d'),'value':_0x4568f9['attrFontSize']||(_0x4568f9[_0x2caf('0x43')]&&_0x4568f9[_0x2caf('0x43')][0x2]?_0x4568f9[_0x2caf('0x43')][0x2][_0x2caf('0x44')]:undefined)||0xc}];case _0x2caf('0x4e'):return[{'name':_0x2caf('0x4f'),'value':_0x4568f9[_0x2caf('0x4f')]||(_0x4568f9[_0x2caf('0x43')]&&_0x4568f9['attrs'][0x0]?_0x4568f9[_0x2caf('0x43')][0x0]['value']:undefined)||_0x2caf('0x50')},{'name':_0x2caf('0x51'),'value':_0x4568f9[_0x2caf('0x51')]||(_0x4568f9['attrs']&&_0x4568f9['attrs'][0x1]?_0x4568f9[_0x2caf('0x43')][0x1]['value']:undefined)||[]},{'name':_0x2caf('0x4d'),'value':_0x4568f9[_0x2caf('0x4d')]||(_0x4568f9[_0x2caf('0x43')]&&_0x4568f9[_0x2caf('0x43')][0x2]?_0x4568f9[_0x2caf('0x43')][0x2][_0x2caf('0x44')]:undefined)||0x14},{'name':_0x2caf('0x52'),'value':_0x4568f9[_0x2caf('0x52')]||(_0x4568f9[_0x2caf('0x43')]&&_0x4568f9[_0x2caf('0x43')][0x3]?_0x4568f9[_0x2caf('0x43')][0x3][_0x2caf('0x44')]:undefined)||_0x2caf('0x53')},{'name':_0x2caf('0x54'),'value':_0x4568f9[_0x2caf('0x54')]||(_0x4568f9[_0x2caf('0x43')]&&_0x4568f9[_0x2caf('0x43')][0x4]?_0x4568f9[_0x2caf('0x43')][0x4][_0x2caf('0x44')]:undefined)||''},{'name':_0x2caf('0x55'),'value':_0x4568f9[_0x2caf('0x55')]||(_0x4568f9['attrs']&&_0x4568f9[_0x2caf('0x43')][0x5]?_0x4568f9[_0x2caf('0x43')][0x5]['value']:undefined)||''},{'name':'attrSmsAccounts','value':_0x4568f9[_0x2caf('0x56')]||(_0x4568f9[_0x2caf('0x43')]&&_0x4568f9['attrs'][0x6]?_0x4568f9[_0x2caf('0x43')][0x6][_0x2caf('0x44')]:undefined)||''},{'name':_0x2caf('0x57'),'value':_0x4568f9[_0x2caf('0x57')]||(_0x4568f9[_0x2caf('0x43')]&&_0x4568f9[_0x2caf('0x43')][0x7]?_0x4568f9[_0x2caf('0x43')][0x7][_0x2caf('0x44')]:undefined)||''},{'name':_0x2caf('0x58'),'value':_0x4568f9[_0x2caf('0x58')]||(_0x4568f9[_0x2caf('0x43')]&&_0x4568f9[_0x2caf('0x43')][0x8]?_0x4568f9[_0x2caf('0x43')][0x8]['value']:undefined)||''},{'name':_0x2caf('0x59'),'value':_0x4568f9[_0x2caf('0x59')]||(_0x4568f9[_0x2caf('0x43')]&&_0x4568f9['attrs'][0x9]?_0x4568f9[_0x2caf('0x43')][0x9][_0x2caf('0x44')]:undefined)||''}];case _0x2caf('0x5a'):case _0x2caf('0x5b'):return[{'name':_0x2caf('0x5c'),'value':_0x4568f9[_0x2caf('0x5c')]||(_0x4568f9[_0x2caf('0x43')]&&_0x4568f9[_0x2caf('0x43')][0x0]?_0x4568f9[_0x2caf('0x43')][0x0][_0x2caf('0x44')]:undefined)||'total'},{'name':_0x2caf('0x5d'),'value':_0x4568f9[_0x2caf('0x5d')]||(_0x4568f9[_0x2caf('0x43')]&&_0x4568f9['attrs'][0x1]?_0x4568f9[_0x2caf('0x43')][0x1][_0x2caf('0x44')]:undefined)||null},{'name':_0x2caf('0x5e'),'value':_0x4568f9['attrSerie3']||(_0x4568f9[_0x2caf('0x43')]&&_0x4568f9[_0x2caf('0x43')][0x2]?_0x4568f9[_0x2caf('0x43')][0x2][_0x2caf('0x44')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x4568f9[_0x2caf('0x51')]||(_0x4568f9[_0x2caf('0x43')]&&_0x4568f9[_0x2caf('0x43')][0x3]?_0x4568f9['attrs'][0x3][_0x2caf('0x44')]:undefined)||[]},{'name':_0x2caf('0x52'),'value':_0x4568f9['attrChannel']||(_0x4568f9[_0x2caf('0x43')]&&_0x4568f9[_0x2caf('0x43')][0x4]?_0x4568f9[_0x2caf('0x43')][0x4]['value']:undefined)||_0x2caf('0x53')},{'name':'attrEmailAccounts','value':_0x4568f9[_0x2caf('0x54')]||(_0x4568f9[_0x2caf('0x43')]&&_0x4568f9['attrs'][0x5]?_0x4568f9['attrs'][0x5][_0x2caf('0x44')]:undefined)||''},{'name':_0x2caf('0x55'),'value':_0x4568f9[_0x2caf('0x55')]||(_0x4568f9[_0x2caf('0x43')]&&_0x4568f9[_0x2caf('0x43')][0x6]?_0x4568f9['attrs'][0x6][_0x2caf('0x44')]:undefined)||''},{'name':_0x2caf('0x56'),'value':_0x4568f9['attrSmsAccounts']||(_0x4568f9[_0x2caf('0x43')]&&_0x4568f9[_0x2caf('0x43')][0x7]?_0x4568f9['attrs'][0x7]['value']:undefined)||''},{'name':_0x2caf('0x57'),'value':_0x4568f9['attrOpenchannelAccounts']||(_0x4568f9[_0x2caf('0x43')]&&_0x4568f9[_0x2caf('0x43')][0x8]?_0x4568f9[_0x2caf('0x43')][0x8][_0x2caf('0x44')]:undefined)||''},{'name':_0x2caf('0x58'),'value':_0x4568f9['attrWhatsappAccounts']||(_0x4568f9[_0x2caf('0x43')]&&_0x4568f9['attrs'][0x9]?_0x4568f9[_0x2caf('0x43')][0x9]['value']:undefined)||''},{'name':_0x2caf('0x59'),'value':_0x4568f9['attrChatWebsites']||(_0x4568f9['attrs']&&_0x4568f9[_0x2caf('0x43')][0xa]?_0x4568f9['attrs'][0xa][_0x2caf('0x44')]:undefined)||''}];case'web-report':return[{'name':'attrReport','type':_0x4568f9[_0x2caf('0x5f')]||(_0x4568f9[_0x2caf('0x43')]&&_0x4568f9[_0x2caf('0x43')][0x0]?_0x4568f9[_0x2caf('0x43')][0x0][_0x2caf('0x40')]:undefined)||null,'value':_0x4568f9['attrReport']||(_0x4568f9[_0x2caf('0x43')]&&_0x4568f9[_0x2caf('0x43')][0x0]?_0x4568f9['attrs'][0x0][_0x2caf('0x44')]:undefined)||null},{'name':'attrRefresh','value':_0x4568f9[_0x2caf('0x60')]||(_0x4568f9[_0x2caf('0x43')]&&_0x4568f9[_0x2caf('0x43')][0x1]?_0x4568f9[_0x2caf('0x43')][0x1][_0x2caf('0x44')]:undefined)||0x0}];default:return[];}}catch(_0x5d82f5){logger['error'](_0x2caf('0x61'),JSON[_0x2caf('0x62')](_0x5d82f5));return[];}}exports[_0x2caf('0x63')]=function(_0x177e28,_0x16eb75){if(_0x177e28[_0x2caf('0x64')]){_0x177e28[_0x2caf('0x64')]['attrs']=widgetAttributes(_0x177e28[_0x2caf('0x64')]);}return db[_0x2caf('0x3c')][_0x2caf('0x63')](_0x177e28[_0x2caf('0x64')],{})[_0x2caf('0x29')](respondWithResult(_0x16eb75,0xc9))['catch'](handleError(_0x16eb75,null));};exports[_0x2caf('0x28')]=function(_0x5ed955,_0x1fb36f){if(_0x5ed955[_0x2caf('0x64')]['id']){delete _0x5ed955[_0x2caf('0x64')]['id'];}_0x5ed955[_0x2caf('0x64')][_0x2caf('0x43')]=widgetAttributes(_0x5ed955['body']);return db[_0x2caf('0x3c')]['find']({'where':{'id':_0x5ed955[_0x2caf('0x3f')]['id']}})[_0x2caf('0x29')](handleEntityNotFound(_0x1fb36f,null))['then'](saveUpdates(_0x5ed955[_0x2caf('0x64')],null))[_0x2caf('0x29')](respondWithResult(_0x1fb36f,null))[_0x2caf('0x3e')](handleError(_0x1fb36f,null));}; \ No newline at end of file +var _0xdedd=['attrs','value','https://','custom','attrPath','attrHourFormat','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','attrSerie1','attrSerie2','voice','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','save','update','destroy','error','stack','name','send','show','params','keys','DashboardItem','query','attributes','intersection','model','fields','length','includeAll','merge','options','then','find','catch','type','iframe'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xdedd,0x197));var _0xdded=function(_0x21e142,_0x53b4c0){_0x21e142=_0x21e142-0x0;var _0xef77ea=_0xdedd[_0x21e142];return _0xef77ea;};'use strict';var emlformat=require(_0xdded('0x0'));var rimraf=require(_0xdded('0x1'));var zipdir=require(_0xdded('0x2'));var jsonpatch=require(_0xdded('0x3'));var rp=require(_0xdded('0x4'));var moment=require('moment');var BPromise=require(_0xdded('0x5'));var Mustache=require(_0xdded('0x6'));var util=require(_0xdded('0x7'));var path=require(_0xdded('0x8'));var sox=require(_0xdded('0x9'));var csv=require(_0xdded('0xa'));var ejs=require(_0xdded('0xb'));var fs=require('fs');var fs_extra=require(_0xdded('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xdded('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xdded('0xe'));var Papa=require(_0xdded('0xf'));var Redis=require(_0xdded('0x10'));var authService=require(_0xdded('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xdded('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdded('0x13'))(_0xdded('0x14'));var utils=require(_0xdded('0x15'));var config=require(_0xdded('0x16'));var licenseUtil=require(_0xdded('0x17'));var db=require(_0xdded('0x18'))['db'];config[_0xdded('0x19')]=_[_0xdded('0x1a')](config[_0xdded('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xdded('0x1b'))(new Redis(config[_0xdded('0x19')]));require('./dashboardItem.socket')[_0xdded('0x1c')](socket);function respondWithStatusCode(_0x5256e7,_0x3a5dec){_0x3a5dec=_0x3a5dec||0xcc;return function(_0x57548f){if(_0x57548f){return _0x5256e7[_0xdded('0x1d')](_0x3a5dec);}return _0x5256e7[_0xdded('0x1e')](_0x3a5dec)[_0xdded('0x1f')]();};}function respondWithResult(_0x481ae4,_0x338383){_0x338383=_0x338383||0xc8;return function(_0xfb3f67){if(_0xfb3f67){return _0x481ae4[_0xdded('0x1e')](_0x338383)[_0xdded('0x20')](_0xfb3f67);}};}function respondWithFilteredResult(_0x1454e4,_0x45cd32){return function(_0x323c30){if(_0x323c30){var _0x436ee9=typeof _0x45cd32['offset']===_0xdded('0x21')&&typeof _0x45cd32[_0xdded('0x22')]===_0xdded('0x21');var _0x153686=_0x323c30[_0xdded('0x23')];var _0x29eb80=_0x436ee9?0x0:_0x45cd32[_0xdded('0x24')];var _0x457ee4=_0x436ee9?_0x323c30[_0xdded('0x23')]:_0x45cd32[_0xdded('0x24')]+_0x45cd32[_0xdded('0x22')];var _0x35000a;if(_0x457ee4>=_0x153686){_0x457ee4=_0x153686;_0x35000a=0xc8;}else{_0x35000a=0xce;}_0x1454e4[_0xdded('0x1e')](_0x35000a);return _0x1454e4['set'](_0xdded('0x25'),_0x29eb80+'-'+_0x457ee4+'/'+_0x153686)[_0xdded('0x20')](_0x323c30);}return null;};}function patchUpdates(_0x233776){return function(_0xee75f1){try{jsonpatch['apply'](_0xee75f1,_0x233776,!![]);}catch(_0xa0c790){return BPromise['reject'](_0xa0c790);}return _0xee75f1[_0xdded('0x26')]();};}function saveUpdates(_0x1c1473,_0x362151){return function(_0x3c34e4){if(_0x3c34e4){return _0x3c34e4[_0xdded('0x27')](_0x1c1473)['then'](function(_0x1c5025){return _0x1c5025;});}return null;};}function removeEntity(_0xb6f82e,_0x2b66b3){return function(_0x14b1bd){if(_0x14b1bd){return _0x14b1bd[_0xdded('0x28')]()['then'](function(){_0xb6f82e['status'](0xcc)[_0xdded('0x1f')]();});}};}function handleEntityNotFound(_0x88b9f1,_0xfb0379){return function(_0x4358f6){if(!_0x4358f6){_0x88b9f1[_0xdded('0x1d')](0x194);}return _0x4358f6;};}function handleError(_0x591a94,_0x367154){_0x367154=_0x367154||0x1f4;return function(_0x10c128){logger[_0xdded('0x29')](_0x10c128[_0xdded('0x2a')]);if(_0x10c128['name']){delete _0x10c128[_0xdded('0x2b')];}_0x591a94['status'](_0x367154)[_0xdded('0x2c')](_0x10c128);};}exports[_0xdded('0x2d')]=function(_0x37f0f5,_0x36880e){var _0xf193a8={'raw':![],'where':{'id':_0x37f0f5[_0xdded('0x2e')]['id']}},_0x3459c7={};_0x3459c7['model']=_[_0xdded('0x2f')](db[_0xdded('0x30')]['rawAttributes']);_0x3459c7[_0xdded('0x31')]=_[_0xdded('0x2f')](_0x37f0f5['query']);_0x3459c7['filters']=_['intersection'](_0x3459c7['model'],_0x3459c7[_0xdded('0x31')]);_0xf193a8[_0xdded('0x32')]=_[_0xdded('0x33')](_0x3459c7[_0xdded('0x34')],qs[_0xdded('0x35')](_0x37f0f5[_0xdded('0x31')][_0xdded('0x35')]));_0xf193a8['attributes']=_0xf193a8[_0xdded('0x32')][_0xdded('0x36')]?_0xf193a8[_0xdded('0x32')]:_0x3459c7[_0xdded('0x34')];if(_0x37f0f5[_0xdded('0x31')][_0xdded('0x37')]){_0xf193a8['include']=[{'all':!![]}];}_0xf193a8=_[_0xdded('0x38')]({},_0xf193a8,_0x37f0f5[_0xdded('0x39')]);return db[_0xdded('0x30')]['find'](_0xf193a8)[_0xdded('0x3a')](handleEntityNotFound(_0x36880e,null))[_0xdded('0x3a')](respondWithResult(_0x36880e,null))['catch'](handleError(_0x36880e,null));};exports[_0xdded('0x28')]=function(_0x2d9019,_0x382a48){return db[_0xdded('0x30')][_0xdded('0x3b')]({'where':{'id':_0x2d9019[_0xdded('0x2e')]['id']}})[_0xdded('0x3a')](handleEntityNotFound(_0x382a48,null))[_0xdded('0x3a')](removeEntity(_0x382a48,null))[_0xdded('0x3c')](handleError(_0x382a48,null));};function widgetAttributes(_0x4242b5){try{switch(_0x4242b5[_0xdded('0x3d')]){case _0xdded('0x3e'):return[{'name':'attrUrl','value':_0x4242b5['attrUrl']||(_0x4242b5[_0xdded('0x3f')]&&_0x4242b5[_0xdded('0x3f')][0x0]?_0x4242b5[_0xdded('0x3f')][0x0][_0xdded('0x40')]:undefined)||_0xdded('0x41')}];case _0xdded('0x42'):return[{'name':_0xdded('0x43'),'value':_0x4242b5[_0xdded('0x43')]||(_0x4242b5[_0xdded('0x3f')]&&_0x4242b5[_0xdded('0x3f')][0x0]?_0x4242b5[_0xdded('0x3f')][0x0][_0xdded('0x40')]:undefined)||''}];case'clock':return[{'name':_0xdded('0x44'),'value':_0x4242b5['attrHourFormat']||(_0x4242b5[_0xdded('0x3f')]&&_0x4242b5['attrs'][0x0]?_0x4242b5[_0xdded('0x3f')][0x0][_0xdded('0x40')]:undefined)||'HH:mm:ss'},{'name':_0xdded('0x45'),'value':_0x4242b5['attrTimezone']||(_0x4242b5[_0xdded('0x3f')]&&_0x4242b5[_0xdded('0x3f')][0x1]?_0x4242b5[_0xdded('0x3f')][0x1][_0xdded('0x40')]:undefined)||_0xdded('0x46')},{'name':_0xdded('0x47'),'value':_0x4242b5[_0xdded('0x47')]||(_0x4242b5[_0xdded('0x3f')]&&_0x4242b5['attrs'][0x2]?_0x4242b5[_0xdded('0x3f')][0x2]['value']:undefined)||0xc}];case'counter':return[{'name':_0xdded('0x48'),'value':_0x4242b5[_0xdded('0x48')]||(_0x4242b5['attrs']&&_0x4242b5[_0xdded('0x3f')][0x0]?_0x4242b5[_0xdded('0x3f')][0x0][_0xdded('0x40')]:undefined)||_0xdded('0x49')},{'name':_0xdded('0x4a'),'value':_0x4242b5[_0xdded('0x4a')]||(_0x4242b5[_0xdded('0x3f')]&&_0x4242b5[_0xdded('0x3f')][0x1]?_0x4242b5[_0xdded('0x3f')][0x1][_0xdded('0x40')]:undefined)||[]},{'name':_0xdded('0x47'),'value':_0x4242b5['attrFontSize']||(_0x4242b5[_0xdded('0x3f')]&&_0x4242b5['attrs'][0x2]?_0x4242b5[_0xdded('0x3f')][0x2][_0xdded('0x40')]:undefined)||0x14},{'name':_0xdded('0x4b'),'value':_0x4242b5[_0xdded('0x4b')]||(_0x4242b5[_0xdded('0x3f')]&&_0x4242b5[_0xdded('0x3f')][0x3]?_0x4242b5[_0xdded('0x3f')][0x3][_0xdded('0x40')]:undefined)||'voice'},{'name':'attrEmailAccounts','value':_0x4242b5[_0xdded('0x4c')]||(_0x4242b5[_0xdded('0x3f')]&&_0x4242b5[_0xdded('0x3f')][0x4]?_0x4242b5[_0xdded('0x3f')][0x4]['value']:undefined)||''},{'name':_0xdded('0x4d'),'value':_0x4242b5['attrFaxAccounts']||(_0x4242b5[_0xdded('0x3f')]&&_0x4242b5[_0xdded('0x3f')][0x5]?_0x4242b5[_0xdded('0x3f')][0x5]['value']:undefined)||''},{'name':'attrSmsAccounts','value':_0x4242b5[_0xdded('0x4e')]||(_0x4242b5[_0xdded('0x3f')]&&_0x4242b5[_0xdded('0x3f')][0x6]?_0x4242b5['attrs'][0x6][_0xdded('0x40')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x4242b5[_0xdded('0x4f')]||(_0x4242b5[_0xdded('0x3f')]&&_0x4242b5['attrs'][0x7]?_0x4242b5[_0xdded('0x3f')][0x7][_0xdded('0x40')]:undefined)||''},{'name':_0xdded('0x50'),'value':_0x4242b5[_0xdded('0x50')]||(_0x4242b5['attrs']&&_0x4242b5[_0xdded('0x3f')][0x8]?_0x4242b5[_0xdded('0x3f')][0x8][_0xdded('0x40')]:undefined)||''},{'name':_0xdded('0x51'),'value':_0x4242b5[_0xdded('0x51')]||(_0x4242b5[_0xdded('0x3f')]&&_0x4242b5['attrs'][0x9]?_0x4242b5[_0xdded('0x3f')][0x9]['value']:undefined)||''}];case _0xdded('0x52'):case'pie-chart':return[{'name':_0xdded('0x53'),'value':_0x4242b5[_0xdded('0x53')]||(_0x4242b5[_0xdded('0x3f')]&&_0x4242b5['attrs'][0x0]?_0x4242b5[_0xdded('0x3f')][0x0]['value']:undefined)||_0xdded('0x49')},{'name':_0xdded('0x54'),'value':_0x4242b5[_0xdded('0x54')]||(_0x4242b5['attrs']&&_0x4242b5['attrs'][0x1]?_0x4242b5[_0xdded('0x3f')][0x1][_0xdded('0x40')]:undefined)||null},{'name':'attrSerie3','value':_0x4242b5['attrSerie3']||(_0x4242b5[_0xdded('0x3f')]&&_0x4242b5[_0xdded('0x3f')][0x2]?_0x4242b5[_0xdded('0x3f')][0x2][_0xdded('0x40')]:undefined)||null},{'name':_0xdded('0x4a'),'value':_0x4242b5[_0xdded('0x4a')]||(_0x4242b5[_0xdded('0x3f')]&&_0x4242b5[_0xdded('0x3f')][0x3]?_0x4242b5['attrs'][0x3][_0xdded('0x40')]:undefined)||[]},{'name':_0xdded('0x4b'),'value':_0x4242b5[_0xdded('0x4b')]||(_0x4242b5[_0xdded('0x3f')]&&_0x4242b5[_0xdded('0x3f')][0x4]?_0x4242b5[_0xdded('0x3f')][0x4][_0xdded('0x40')]:undefined)||_0xdded('0x55')},{'name':_0xdded('0x4c'),'value':_0x4242b5['attrEmailAccounts']||(_0x4242b5[_0xdded('0x3f')]&&_0x4242b5[_0xdded('0x3f')][0x5]?_0x4242b5[_0xdded('0x3f')][0x5][_0xdded('0x40')]:undefined)||''},{'name':_0xdded('0x4d'),'value':_0x4242b5[_0xdded('0x4d')]||(_0x4242b5['attrs']&&_0x4242b5[_0xdded('0x3f')][0x6]?_0x4242b5[_0xdded('0x3f')][0x6]['value']:undefined)||''},{'name':'attrSmsAccounts','value':_0x4242b5[_0xdded('0x4e')]||(_0x4242b5[_0xdded('0x3f')]&&_0x4242b5[_0xdded('0x3f')][0x7]?_0x4242b5[_0xdded('0x3f')][0x7][_0xdded('0x40')]:undefined)||''},{'name':_0xdded('0x4f'),'value':_0x4242b5[_0xdded('0x4f')]||(_0x4242b5['attrs']&&_0x4242b5['attrs'][0x8]?_0x4242b5[_0xdded('0x3f')][0x8][_0xdded('0x40')]:undefined)||''},{'name':_0xdded('0x50'),'value':_0x4242b5[_0xdded('0x50')]||(_0x4242b5[_0xdded('0x3f')]&&_0x4242b5[_0xdded('0x3f')][0x9]?_0x4242b5[_0xdded('0x3f')][0x9][_0xdded('0x40')]:undefined)||''},{'name':_0xdded('0x51'),'value':_0x4242b5['attrChatWebsites']||(_0x4242b5[_0xdded('0x3f')]&&_0x4242b5[_0xdded('0x3f')][0xa]?_0x4242b5[_0xdded('0x3f')][0xa]['value']:undefined)||''}];case _0xdded('0x56'):return[{'name':_0xdded('0x57'),'type':_0x4242b5[_0xdded('0x58')]||(_0x4242b5[_0xdded('0x3f')]&&_0x4242b5['attrs'][0x0]?_0x4242b5['attrs'][0x0]['type']:undefined)||null,'value':_0x4242b5['attrReport']||(_0x4242b5[_0xdded('0x3f')]&&_0x4242b5['attrs'][0x0]?_0x4242b5[_0xdded('0x3f')][0x0][_0xdded('0x40')]:undefined)||null},{'name':_0xdded('0x59'),'value':_0x4242b5[_0xdded('0x59')]||(_0x4242b5[_0xdded('0x3f')]&&_0x4242b5[_0xdded('0x3f')][0x1]?_0x4242b5[_0xdded('0x3f')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x9d120d){logger[_0xdded('0x29')](_0xdded('0x5a'),JSON[_0xdded('0x5b')](_0x9d120d));return[];}}exports[_0xdded('0x5c')]=function(_0x29bd5d,_0x464f62){if(_0x29bd5d[_0xdded('0x5d')]){_0x29bd5d[_0xdded('0x5d')][_0xdded('0x3f')]=widgetAttributes(_0x29bd5d['body']);}return db[_0xdded('0x30')]['create'](_0x29bd5d[_0xdded('0x5d')],{})[_0xdded('0x3a')](respondWithResult(_0x464f62,0xc9))['catch'](handleError(_0x464f62,null));};exports['update']=function(_0x487a72,_0x25d185){if(_0x487a72[_0xdded('0x5d')]['id']){delete _0x487a72[_0xdded('0x5d')]['id'];}_0x487a72['body'][_0xdded('0x3f')]=widgetAttributes(_0x487a72[_0xdded('0x5d')]);return db[_0xdded('0x30')][_0xdded('0x3b')]({'where':{'id':_0x487a72[_0xdded('0x2e')]['id']}})[_0xdded('0x3a')](handleEntityNotFound(_0x25d185,null))[_0xdded('0x3a')](saveUpdates(_0x487a72[_0xdded('0x5d')],null))[_0xdded('0x3a')](respondWithResult(_0x25d185,null))['catch'](handleError(_0x25d185,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 963ad2e..71f53e8 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 _0x583d=['hook','exports','events','../../mysqldb','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0xa2de20,_0x550ae9){var _0x598681=function(_0x24d22f){while(--_0x24d22f){_0xa2de20['push'](_0xa2de20['shift']());}};_0x598681(++_0x550ae9);}(_0x583d,0x161));var _0xd583=function(_0x5e229a,_0xd2334a){_0x5e229a=_0x5e229a-0x0;var _0x274086=_0x583d[_0x5e229a];return _0x274086;};'use strict';var EventEmitter=require(_0xd583('0x0'));var DashboardItem=require(_0xd583('0x1'))['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xd583('0x2')](0x0);var events={'afterCreate':_0xd583('0x3'),'afterUpdate':'update','afterDestroy':_0xd583('0x4')};function emitEvent(_0x7bcf5){return function(_0x4bd8fa,_0x1df511,_0x4f1aa3){DashboardItemEvents['emit'](_0x7bcf5+':'+_0x4bd8fa['id'],_0x4bd8fa);DashboardItemEvents[_0xd583('0x5')](_0x7bcf5,_0x4bd8fa);_0x4f1aa3(null);};}for(var e in events){if(events[_0xd583('0x6')](e)){var event=events[e];DashboardItem[_0xd583('0x7')](e,emitEvent(event));}}module[_0xd583('0x8')]=DashboardItemEvents; \ No newline at end of file +var _0xa469=['update','remove','emit','hasOwnProperty','exports','events','setMaxListeners','save'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa469,0x9d));var _0x9a46=function(_0x4d80f9,_0x67d5a7){_0x4d80f9=_0x4d80f9-0x0;var _0x46b5d3=_0xa469[_0x4d80f9];return _0x46b5d3;};'use strict';var EventEmitter=require(_0x9a46('0x0'));var DashboardItem=require('../../mysqldb')['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x9a46('0x1')](0x0);var events={'afterCreate':_0x9a46('0x2'),'afterUpdate':_0x9a46('0x3'),'afterDestroy':_0x9a46('0x4')};function emitEvent(_0x11912f){return function(_0x4f5719,_0x5afb6d,_0x209730){DashboardItemEvents['emit'](_0x11912f+':'+_0x4f5719['id'],_0x4f5719);DashboardItemEvents[_0x9a46('0x5')](_0x11912f,_0x4f5719);_0x209730(null);};}for(var e in events){if(events[_0x9a46('0x6')](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module[_0x9a46('0x7')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index c4ee6fb..548d5d4 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 _0x89b9=['lodash','bluebird','request-promise','path','rimraf','./dashboardItem.attributes','exports','define','dashboard_items'];(function(_0x4cd0c0,_0xfb9df5){var _0x1fcab1=function(_0x3c5b15){while(--_0x3c5b15){_0x4cd0c0['push'](_0x4cd0c0['shift']());}};_0x1fcab1(++_0xfb9df5);}(_0x89b9,0x17a));var _0x989b=function(_0x1b1828,_0x4a5b02){_0x1b1828=_0x1b1828-0x0;var _0x3a065a=_0x89b9[_0x1b1828];return _0x3a065a;};'use strict';var _=require(_0x989b('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x989b('0x1'));var rp=require(_0x989b('0x2'));var fs=require('fs');var path=require(_0x989b('0x3'));var rimraf=require(_0x989b('0x4'));var config=require('../../config/environment');var attributes=require(_0x989b('0x5'));module[_0x989b('0x6')]=function(_0x3cd354,_0x5b2b7f){return _0x3cd354[_0x989b('0x7')]('DashboardItem',attributes,{'tableName':_0x989b('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x510c=['request-promise','path','rimraf','../../config/environment','./dashboardItem.attributes','exports','define','DashboardItem','dashboard_items','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x382737,_0x4ca74f){var _0x52adc0=function(_0x867c6b){while(--_0x867c6b){_0x382737['push'](_0x382737['shift']());}};_0x52adc0(++_0x4ca74f);}(_0x510c,0x117));var _0xc510=function(_0x8dc6a3,_0x13b084){_0x8dc6a3=_0x8dc6a3-0x0;var _0x23cad1=_0x510c[_0x8dc6a3];return _0x23cad1;};'use strict';var _=require(_0xc510('0x0'));var util=require(_0xc510('0x1'));var logger=require(_0xc510('0x2'))(_0xc510('0x3'));var moment=require(_0xc510('0x4'));var BPromise=require(_0xc510('0x5'));var rp=require(_0xc510('0x6'));var fs=require('fs');var path=require(_0xc510('0x7'));var rimraf=require(_0xc510('0x8'));var config=require(_0xc510('0x9'));var attributes=require(_0xc510('0xa'));module[_0xc510('0xb')]=function(_0x3cd54b,_0x1fe3e6){return _0x3cd54b[_0xc510('0xc')](_0xc510('0xd'),attributes,{'tableName':_0xc510('0xe'),'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 9c33cc9..096acb7 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 _0x6c77=['request','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','redis','./dashboardItem.socket','register'];(function(_0x43794c,_0x4b4158){var _0xa31045=function(_0x2201e7){while(--_0x2201e7){_0x43794c['push'](_0x43794c['shift']());}};_0xa31045(++_0x4b4158);}(_0x6c77,0xfd));var _0x76c7=function(_0x19be52,_0x417078){_0x19be52=_0x19be52-0x0;var _0x42dfd2=_0x6c77[_0x19be52];return _0x42dfd2;};'use strict';var _=require('lodash');var util=require(_0x76c7('0x0'));var moment=require(_0x76c7('0x1'));var BPromise=require('bluebird');var rs=require(_0x76c7('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x76c7('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x76c7('0x4'));var config=require(_0x76c7('0x5'));var jayson=require(_0x76c7('0x6'));var client=jayson[_0x76c7('0x7')]['http']({'port':0x232a});config[_0x76c7('0x8')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x76c7('0x8')]));require(_0x76c7('0x9'))[_0x76c7('0xa')](socket);function respondWithRpcPromise(_0x2e8d1a,_0xd12308,_0x167226){return new BPromise(function(_0x105a5f,_0x2b7c62){return client[_0x76c7('0xb')](_0x2e8d1a,_0x167226)['then'](function(_0x498813){logger[_0x76c7('0xc')](_0x76c7('0xd'),_0xd12308,_0x76c7('0xe'));logger[_0x76c7('0xf')](_0x76c7('0x10'),_0xd12308,_0x76c7('0xe'),JSON[_0x76c7('0x11')](_0x498813));if(_0x498813[_0x76c7('0x12')]){if(_0x498813[_0x76c7('0x12')]['code']===0x1f4){logger[_0x76c7('0x12')](_0x76c7('0xd'),_0xd12308,_0x498813[_0x76c7('0x12')][_0x76c7('0x13')]);return _0x2b7c62(_0x498813[_0x76c7('0x12')][_0x76c7('0x13')]);}logger[_0x76c7('0x12')](_0x76c7('0xd'),_0xd12308,_0x498813[_0x76c7('0x12')][_0x76c7('0x13')]);return _0x105a5f(_0x498813[_0x76c7('0x12')][_0x76c7('0x13')]);}else{logger[_0x76c7('0xc')](_0x76c7('0xd'),_0xd12308,_0x76c7('0xe'));_0x105a5f(_0x498813[_0x76c7('0x14')][_0x76c7('0x13')]);}})[_0x76c7('0x15')](function(_0x384402){logger[_0x76c7('0x12')](_0x76c7('0xd'),_0xd12308,_0x384402);_0x2b7c62(_0x384402);});});} \ No newline at end of file +var _0x5ab9=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./dashboardItem.socket','request','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','util','moment'];(function(_0x571efc,_0x58ed0c){var _0xa4cabb=function(_0xe61292){while(--_0xe61292){_0x571efc['push'](_0x571efc['shift']());}};_0xa4cabb(++_0x58ed0c);}(_0x5ab9,0x11f));var _0x95ab=function(_0xce3d93,_0x504f1c){_0xce3d93=_0xce3d93-0x0;var _0x16bcf8=_0x5ab9[_0xce3d93];return _0x16bcf8;};'use strict';var _=require(_0x95ab('0x0'));var util=require(_0x95ab('0x1'));var moment=require(_0x95ab('0x2'));var BPromise=require(_0x95ab('0x3'));var rs=require(_0x95ab('0x4'));var fs=require('fs');var Redis=require(_0x95ab('0x5'));var db=require(_0x95ab('0x6'))['db'];var utils=require(_0x95ab('0x7'));var logger=require('../../config/logger')(_0x95ab('0x8'));var config=require('../../config/environment');var jayson=require(_0x95ab('0x9'));var client=jayson[_0x95ab('0xa')][_0x95ab('0xb')]({'port':0x232a});config[_0x95ab('0xc')]=_['defaults'](config[_0x95ab('0xc')],{'host':_0x95ab('0xd'),'port':0x18eb});var socket=require(_0x95ab('0xe'))(new Redis(config['redis']));require(_0x95ab('0xf'))['register'](socket);function respondWithRpcPromise(_0x1935c8,_0x470efe,_0x43f0a3){return new BPromise(function(_0x242289,_0x35a7f3){return client[_0x95ab('0x10')](_0x1935c8,_0x43f0a3)[_0x95ab('0x11')](function(_0x308491){logger[_0x95ab('0x12')](_0x95ab('0x13'),_0x470efe,_0x95ab('0x14'));logger[_0x95ab('0x15')](_0x95ab('0x16'),_0x470efe,'request\x20sent',JSON[_0x95ab('0x17')](_0x308491));if(_0x308491['error']){if(_0x308491['error'][_0x95ab('0x18')]===0x1f4){logger[_0x95ab('0x19')](_0x95ab('0x13'),_0x470efe,_0x308491[_0x95ab('0x19')][_0x95ab('0x1a')]);return _0x35a7f3(_0x308491[_0x95ab('0x19')][_0x95ab('0x1a')]);}logger[_0x95ab('0x19')](_0x95ab('0x13'),_0x470efe,_0x308491[_0x95ab('0x19')]['message']);return _0x242289(_0x308491[_0x95ab('0x19')][_0x95ab('0x1a')]);}else{logger[_0x95ab('0x12')](_0x95ab('0x13'),_0x470efe,_0x95ab('0x14'));_0x242289(_0x308491[_0x95ab('0x1b')][_0x95ab('0x1a')]);}})[_0x95ab('0x1c')](function(_0x339763){logger[_0x95ab('0x19')](_0x95ab('0x13'),_0x470efe,_0x339763);_0x35a7f3(_0x339763);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 815038e..8ea7be9 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 _0x1a9f=['save','update','removeListener','length','dashboardItem:'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x1a9f,0x154));var _0xf1a9=function(_0x5181f4,_0x3e7316){_0x5181f4=_0x5181f4-0x0;var _0x2eb504=_0x1a9f[_0x5181f4];return _0x2eb504;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=[_0xf1a9('0x0'),'remove',_0xf1a9('0x1')];function createListener(_0x2bdfeb,_0x2daabd){return function(_0x117d31){_0x2daabd['emit'](_0x2bdfeb,_0x117d31);};}function removeListener(_0x2e762a,_0x37c457){return function(){DashboardItemEvents[_0xf1a9('0x2')](_0x2e762a,_0x37c457);};}exports['register']=function(_0x14ed0b){for(var _0x1c5492=0x0,_0x125ef1=events[_0xf1a9('0x3')];_0x1c5492<_0x125ef1;_0x1c5492++){var _0x261060=events[_0x1c5492];var _0x34e210=createListener(_0xf1a9('0x4')+_0x261060,_0x14ed0b);DashboardItemEvents['on'](_0x261060,_0x34e210);}}; \ No newline at end of file +var _0x9477=['./dashboardItem.events','save','remove','emit','register','length'];(function(_0x10ed40,_0xf4e642){var _0x3665e4=function(_0xc839d8){while(--_0xc839d8){_0x10ed40['push'](_0x10ed40['shift']());}};_0x3665e4(++_0xf4e642);}(_0x9477,0x162));var _0x7947=function(_0x2465b2,_0xe556f1){_0x2465b2=_0x2465b2-0x0;var _0x169add=_0x9477[_0x2465b2];return _0x169add;};'use strict';var DashboardItemEvents=require(_0x7947('0x0'));var events=[_0x7947('0x1'),_0x7947('0x2'),'update'];function createListener(_0x536e62,_0x247a61){return function(_0x1390dd){_0x247a61[_0x7947('0x3')](_0x536e62,_0x1390dd);};}function removeListener(_0xa13699,_0x425551){return function(){DashboardItemEvents['removeListener'](_0xa13699,_0x425551);};}exports[_0x7947('0x4')]=function(_0x4a91d1){for(var _0xcf2551=0x0,_0x4182ed=events[_0x7947('0x5')];_0xcf2551<_0x4182ed;_0xcf2551++){var _0x31c714=events[_0xcf2551];var _0x338df3=createListener('dashboardItem:'+_0x31c714,_0x4a91d1);DashboardItemEvents['on'](_0x31c714,_0x338df3);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index ce467c3..94bfe6b 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 _0x51a5=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','isAuthenticated','show','post','create','update','delete','/:id','destroy','exports','util','path'];(function(_0x470bfb,_0x389787){var _0x2f5d97=function(_0x3431b4){while(--_0x3431b4){_0x470bfb['push'](_0x470bfb['shift']());}};_0x2f5d97(++_0x389787);}(_0x51a5,0x1b6));var _0x551a=function(_0x17cd56,_0x5c47ff){_0x17cd56=_0x17cd56-0x0;var _0x4b7f02=_0x51a5[_0x17cd56];return _0x4b7f02;};'use strict';var multer=require('multer');var util=require(_0x551a('0x0'));var path=require(_0x551a('0x1'));var timeout=require(_0x551a('0x2'));var express=require(_0x551a('0x3'));var router=express[_0x551a('0x4')]();var fs_extra=require(_0x551a('0x5'));var auth=require(_0x551a('0x6'));var interaction=require(_0x551a('0x7'));var config=require(_0x551a('0x8'));var controller=require(_0x551a('0x9'));router[_0x551a('0xa')]('/:id',auth[_0x551a('0xb')](),controller[_0x551a('0xc')]);router[_0x551a('0xd')]('/',auth['isAuthenticated'](),controller[_0x551a('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x551a('0xf')]);router[_0x551a('0x10')](_0x551a('0x11'),auth[_0x551a('0xb')](),controller[_0x551a('0x12')]);module[_0x551a('0x13')]=router; \ No newline at end of file +var _0xdb72=['post','create','put','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','/:id','isAuthenticated','show'];(function(_0x1241c6,_0x11db93){var _0x5f13a1=function(_0x5839d5){while(--_0x5839d5){_0x1241c6['push'](_0x1241c6['shift']());}};_0x5f13a1(++_0x11db93);}(_0xdb72,0x174));var _0x2db7=function(_0x423549,_0x242e63){_0x423549=_0x423549-0x0;var _0xdcb104=_0xdb72[_0x423549];return _0xdcb104;};'use strict';var multer=require(_0x2db7('0x0'));var util=require(_0x2db7('0x1'));var path=require(_0x2db7('0x2'));var timeout=require(_0x2db7('0x3'));var express=require('express');var router=express[_0x2db7('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2db7('0x5'));var interaction=require(_0x2db7('0x6'));var config=require(_0x2db7('0x7'));var controller=require(_0x2db7('0x8'));router['get'](_0x2db7('0x9'),auth[_0x2db7('0xa')](),controller[_0x2db7('0xb')]);router[_0x2db7('0xc')]('/',auth[_0x2db7('0xa')](),controller[_0x2db7('0xd')]);router[_0x2db7('0xe')](_0x2db7('0x9'),auth[_0x2db7('0xa')](),controller['update']);router['delete'](_0x2db7('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x2db7('0xf')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 0562ebe..76a09d4 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 _0x340e=['first','second','third','sequelize','STRING'];(function(_0x2fd156,_0x23802d){var _0x1cd1dd=function(_0x376d97){while(--_0x376d97){_0x2fd156['push'](_0x2fd156['shift']());}};_0x1cd1dd(++_0x23802d);}(_0x340e,0x134));var _0xe340=function(_0x159edb,_0x235456){_0x159edb=_0x159edb-0x0;var _0x8b86cb=_0x340e[_0x159edb];return _0x8b86cb;};'use strict';var Sequelize=require(_0xe340('0x0'));module['exports']={'name':{'type':Sequelize[_0xe340('0x1')],'allowNull':![]},'level':{'type':Sequelize['ENUM'](_0xe340('0x2'),_0xe340('0x3'),_0xe340('0x4')),'allowNull':![],'defaultValue':_0xe340('0x2')},'description':{'type':Sequelize[_0xe340('0x1')]}}; \ No newline at end of file +var _0xca63=['exports','STRING','first','third','sequelize'];(function(_0x30c07a,_0xb38507){var _0x5d9f41=function(_0x2501c1){while(--_0x2501c1){_0x30c07a['push'](_0x30c07a['shift']());}};_0x5d9f41(++_0xb38507);}(_0xca63,0x1d0));var _0x3ca6=function(_0x252e36,_0x3c2f02){_0x252e36=_0x252e36-0x0;var _0x260d22=_0xca63[_0x252e36];return _0x260d22;};'use strict';var Sequelize=require(_0x3ca6('0x0'));module[_0x3ca6('0x1')]={'name':{'type':Sequelize[_0x3ca6('0x2')],'allowNull':![]},'level':{'type':Sequelize['ENUM'](_0x3ca6('0x3'),'second',_0x3ca6('0x4')),'allowNull':![],'defaultValue':_0x3ca6('0x3')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 49bc1ef..39e5fb2 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 _0x76db=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','Dispositions','UserProfileResource','destroy','error','stack','name','send','map','Disposition','rawAttributes','fieldName','key','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto'];(function(_0x20aad7,_0x2f256b){var _0x321bdd=function(_0x3a6a4e){while(--_0x3a6a4e){_0x20aad7['push'](_0x20aad7['shift']());}};_0x321bdd(++_0x2f256b);}(_0x76db,0x9d));var _0xb76d=function(_0x480e8b,_0x15afc6){_0x480e8b=_0x480e8b-0x0;var _0x3a87f3=_0x76db[_0x480e8b];return _0x3a87f3;};'use strict';var emlformat=require(_0xb76d('0x0'));var rimraf=require(_0xb76d('0x1'));var zipdir=require(_0xb76d('0x2'));var jsonpatch=require(_0xb76d('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb76d('0x4'));var Mustache=require(_0xb76d('0x5'));var util=require(_0xb76d('0x6'));var path=require(_0xb76d('0x7'));var sox=require('sox');var csv=require(_0xb76d('0x8'));var ejs=require(_0xb76d('0x9'));var fs=require('fs');var fs_extra=require(_0xb76d('0xa'));var _=require('lodash');var squel=require(_0xb76d('0xb'));var crypto=require(_0xb76d('0xc'));var jsforce=require(_0xb76d('0xd'));var deskjs=require(_0xb76d('0xe'));var toCsv=require(_0xb76d('0x8'));var querystring=require(_0xb76d('0xf'));var Papa=require(_0xb76d('0x10'));var Redis=require(_0xb76d('0x11'));var authService=require(_0xb76d('0x12'));var qs=require(_0xb76d('0x13'));var as=require(_0xb76d('0x14'));var hardwareService=require(_0xb76d('0x15'));var logger=require(_0xb76d('0x16'))('api');var utils=require(_0xb76d('0x17'));var config=require(_0xb76d('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xb76d('0x19'))['db'];function respondWithStatusCode(_0x17f40e,_0x512d30){_0x512d30=_0x512d30||0xcc;return function(_0x32cb73){if(_0x32cb73){return _0x17f40e[_0xb76d('0x1a')](_0x512d30);}return _0x17f40e[_0xb76d('0x1b')](_0x512d30)[_0xb76d('0x1c')]();};}function respondWithResult(_0x25c052,_0x3e4360){_0x3e4360=_0x3e4360||0xc8;return function(_0x43b7d8){if(_0x43b7d8){return _0x25c052[_0xb76d('0x1b')](_0x3e4360)[_0xb76d('0x1d')](_0x43b7d8);}};}function respondWithFilteredResult(_0x139f9f,_0x2ddbba){return function(_0x3d9ec6){if(_0x3d9ec6){var _0x52516e=typeof _0x2ddbba['offset']==='undefined'&&typeof _0x2ddbba[_0xb76d('0x1e')]===_0xb76d('0x1f');var _0x9d857a=_0x3d9ec6[_0xb76d('0x20')];var _0x67a798=_0x52516e?0x0:_0x2ddbba[_0xb76d('0x21')];var _0x1f4e4=_0x52516e?_0x3d9ec6[_0xb76d('0x20')]:_0x2ddbba[_0xb76d('0x21')]+_0x2ddbba[_0xb76d('0x1e')];var _0xfba511;if(_0x1f4e4>=_0x9d857a){_0x1f4e4=_0x9d857a;_0xfba511=0xc8;}else{_0xfba511=0xce;}_0x139f9f[_0xb76d('0x1b')](_0xfba511);return _0x139f9f[_0xb76d('0x22')](_0xb76d('0x23'),_0x67a798+'-'+_0x1f4e4+'/'+_0x9d857a)[_0xb76d('0x1d')](_0x3d9ec6);}return null;};}function patchUpdates(_0x57ca1e){return function(_0x211302){try{jsonpatch[_0xb76d('0x24')](_0x211302,_0x57ca1e,!![]);}catch(_0x42e28c){return BPromise[_0xb76d('0x25')](_0x42e28c);}return _0x211302[_0xb76d('0x26')]();};}function saveUpdates(_0xec31d,_0x4e6e37){return function(_0x53ab33){if(_0x53ab33){return _0x53ab33[_0xb76d('0x27')](_0xec31d)[_0xb76d('0x28')](function(_0xdecff9){return _0xdecff9;});}return null;};}function removeEntity(_0x38fc3c,_0x187580){return function(_0x55eed7){if(_0x55eed7){return _0x55eed7['destroy']()[_0xb76d('0x28')](function(){var _0x584a64=_0x55eed7['get']({'plain':!![]});var _0x1fe4f8=_0xb76d('0x29');return db[_0xb76d('0x2a')][_0xb76d('0x2b')]({'where':{'type':_0x1fe4f8,'resourceId':_0x584a64['id']}})[_0xb76d('0x28')](function(){return _0x55eed7;});})[_0xb76d('0x28')](function(){_0x38fc3c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x17ab8a,_0x34d629){return function(_0x52e470){if(!_0x52e470){_0x17ab8a[_0xb76d('0x1a')](0x194);}return _0x52e470;};}function handleError(_0x17e497,_0x419423){_0x419423=_0x419423||0x1f4;return function(_0x237db1){logger[_0xb76d('0x2c')](_0x237db1[_0xb76d('0x2d')]);if(_0x237db1[_0xb76d('0x2e')]){delete _0x237db1[_0xb76d('0x2e')];}_0x17e497['status'](_0x419423)[_0xb76d('0x2f')](_0x237db1);};}exports['index']=function(_0x53e543,_0x268991){var _0x120bc7={},_0x215495={},_0x159116={'count':0x0,'rows':[]};var _0x381cde=_[_0xb76d('0x30')](db[_0xb76d('0x31')][_0xb76d('0x32')],function(_0x5b9cb4){return{'name':_0x5b9cb4[_0xb76d('0x33')],'type':_0x5b9cb4['type'][_0xb76d('0x34')]};});_0x215495['model']=_[_0xb76d('0x30')](_0x381cde,_0xb76d('0x2e'));_0x215495[_0xb76d('0x35')]=_[_0xb76d('0x36')](_0x53e543[_0xb76d('0x35')]);_0x215495[_0xb76d('0x37')]=_[_0xb76d('0x38')](_0x215495[_0xb76d('0x39')],_0x215495[_0xb76d('0x35')]);_0x120bc7['attributes']=_[_0xb76d('0x38')](_0x215495[_0xb76d('0x39')],qs[_0xb76d('0x3a')](_0x53e543[_0xb76d('0x35')][_0xb76d('0x3a')]));_0x120bc7[_0xb76d('0x3b')]=_0x120bc7[_0xb76d('0x3b')][_0xb76d('0x3c')]?_0x120bc7[_0xb76d('0x3b')]:_0x215495[_0xb76d('0x39')];if(!_0x53e543[_0xb76d('0x35')]['hasOwnProperty'](_0xb76d('0x3d'))){_0x120bc7[_0xb76d('0x1e')]=qs[_0xb76d('0x1e')](_0x53e543[_0xb76d('0x35')][_0xb76d('0x1e')]);_0x120bc7[_0xb76d('0x21')]=qs[_0xb76d('0x21')](_0x53e543[_0xb76d('0x35')][_0xb76d('0x21')]);}_0x120bc7[_0xb76d('0x3e')]=qs[_0xb76d('0x3f')](_0x53e543[_0xb76d('0x35')][_0xb76d('0x3f')]);_0x120bc7[_0xb76d('0x40')]=qs['filters'](_[_0xb76d('0x41')](_0x53e543[_0xb76d('0x35')],_0x215495[_0xb76d('0x37')]),_0x381cde);if(_0x53e543['query'][_0xb76d('0x42')]){_0x120bc7[_0xb76d('0x40')]=_[_0xb76d('0x43')](_0x120bc7[_0xb76d('0x40')],{'$or':_[_0xb76d('0x30')](_0x381cde,function(_0x8cffbc){if(_0x8cffbc['type']!==_0xb76d('0x44')){var _0x31d22f={};_0x31d22f[_0x8cffbc[_0xb76d('0x2e')]]={'$like':'%'+_0x53e543[_0xb76d('0x35')][_0xb76d('0x42')]+'%'};return _0x31d22f;}})});}_0x120bc7=_['merge']({},_0x120bc7,_0x53e543[_0xb76d('0x45')]);var _0x13265b={'where':_0x120bc7[_0xb76d('0x40')]};return db['Disposition'][_0xb76d('0x20')](_0x13265b)['then'](function(_0x1d5681){_0x159116[_0xb76d('0x20')]=_0x1d5681;if(_0x53e543[_0xb76d('0x35')][_0xb76d('0x46')]){_0x120bc7[_0xb76d('0x47')]=[{'all':!![]}];}return db[_0xb76d('0x31')][_0xb76d('0x48')](_0x120bc7);})[_0xb76d('0x28')](function(_0x333db9){_0x159116['rows']=_0x333db9;return _0x159116;})[_0xb76d('0x28')](respondWithFilteredResult(_0x268991,_0x120bc7))[_0xb76d('0x49')](handleError(_0x268991,null));};exports[_0xb76d('0x4a')]=function(_0xe4aaf9,_0xd9263a){var _0x1feb66={'raw':!![],'where':{'id':_0xe4aaf9[_0xb76d('0x4b')]['id']}},_0x55cb09={};_0x55cb09[_0xb76d('0x39')]=_[_0xb76d('0x36')](db[_0xb76d('0x31')][_0xb76d('0x32')]);_0x55cb09[_0xb76d('0x35')]=_[_0xb76d('0x36')](_0xe4aaf9[_0xb76d('0x35')]);_0x55cb09['filters']=_[_0xb76d('0x38')](_0x55cb09[_0xb76d('0x39')],_0x55cb09[_0xb76d('0x35')]);_0x1feb66['attributes']=_[_0xb76d('0x38')](_0x55cb09[_0xb76d('0x39')],qs['fields'](_0xe4aaf9[_0xb76d('0x35')][_0xb76d('0x3a')]));_0x1feb66['attributes']=_0x1feb66[_0xb76d('0x3b')][_0xb76d('0x3c')]?_0x1feb66[_0xb76d('0x3b')]:_0x55cb09[_0xb76d('0x39')];if(_0xe4aaf9[_0xb76d('0x35')]['includeAll']){_0x1feb66['include']=[{'all':!![]}];}_0x1feb66=_[_0xb76d('0x43')]({},_0x1feb66,_0xe4aaf9['options']);return db[_0xb76d('0x31')][_0xb76d('0x4c')](_0x1feb66)[_0xb76d('0x28')](handleEntityNotFound(_0xd9263a,null))[_0xb76d('0x28')](respondWithResult(_0xd9263a,null))['catch'](handleError(_0xd9263a,null));};exports['create']=function(_0x58e06e,_0x2e9736){return db[_0xb76d('0x31')]['create'](_0x58e06e[_0xb76d('0x4d')],{})[_0xb76d('0x28')](function(_0x2173be){var _0x5ab19c=_0x58e06e[_0xb76d('0x4e')]['get']({'plain':!![]});if(!_0x5ab19c)throw new Error(_0xb76d('0x4f'));if(_0x5ab19c[_0xb76d('0x50')]==='user'){var _0x2337a5=_0x2173be[_0xb76d('0x51')]({'plain':!![]});var _0x9c954d=_0xb76d('0x29');return db[_0xb76d('0x52')][_0xb76d('0x4c')]({'where':{'name':_0x9c954d,'userProfileId':_0x5ab19c['userProfileId']},'raw':!![]})[_0xb76d('0x28')](function(_0x13bc66){if(_0x13bc66&&_0x13bc66['autoAssociation']===0x0){return db['UserProfileResource'][_0xb76d('0x53')]({'name':_0x2337a5['name'],'resourceId':_0x2337a5['id'],'type':_0x13bc66[_0xb76d('0x2e')],'sectionId':_0x13bc66['id']},{})[_0xb76d('0x28')](function(){return _0x2173be;});}else{return _0x2173be;}})[_0xb76d('0x49')](function(_0x4d6158){logger[_0xb76d('0x2c')](_0xb76d('0x54'),_0x4d6158);throw _0x4d6158;});}return _0x2173be;})[_0xb76d('0x28')](respondWithResult(_0x2e9736,0xc9))['catch'](handleError(_0x2e9736,null));};exports[_0xb76d('0x27')]=function(_0x5676c1,_0x55414b){if(_0x5676c1[_0xb76d('0x4d')]['id']){delete _0x5676c1['body']['id'];}return db[_0xb76d('0x31')][_0xb76d('0x4c')]({'where':{'id':_0x5676c1[_0xb76d('0x4b')]['id']}})[_0xb76d('0x28')](handleEntityNotFound(_0x55414b,null))[_0xb76d('0x28')](saveUpdates(_0x5676c1[_0xb76d('0x4d')],null))[_0xb76d('0x28')](respondWithResult(_0x55414b,null))[_0xb76d('0x49')](handleError(_0x55414b,null));};exports['destroy']=function(_0x3ce705,_0x5a23d2){return db[_0xb76d('0x31')][_0xb76d('0x4c')]({'where':{'id':_0x3ce705['params']['id']}})[_0xb76d('0x28')](handleEntityNotFound(_0x5a23d2,null))[_0xb76d('0x28')](removeEntity(_0x5a23d2,null))['catch'](handleError(_0x5a23d2,null));}; \ No newline at end of file +var _0xa4a1=['../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','get','Dispositions','UserProfileResource','then','error','stack','name','send','map','Disposition','rawAttributes','fieldName','key','model','query','keys','filters','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','intersection','length','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0xe03e39,_0x190874){var _0xd13973=function(_0x57d6fb){while(--_0x57d6fb){_0xe03e39['push'](_0xe03e39['shift']());}};_0xd13973(++_0x190874);}(_0xa4a1,0x138));var _0x1a4a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa4a1[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x1a4a('0x0'));var rimraf=require(_0x1a4a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1a4a('0x2'));var rp=require('request-promise');var moment=require(_0x1a4a('0x3'));var BPromise=require(_0x1a4a('0x4'));var Mustache=require(_0x1a4a('0x5'));var util=require(_0x1a4a('0x6'));var path=require(_0x1a4a('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1a4a('0x8'));var fs=require('fs');var fs_extra=require(_0x1a4a('0x9'));var _=require(_0x1a4a('0xa'));var squel=require(_0x1a4a('0xb'));var crypto=require(_0x1a4a('0xc'));var jsforce=require(_0x1a4a('0xd'));var deskjs=require(_0x1a4a('0xe'));var toCsv=require('to-csv');var querystring=require(_0x1a4a('0xf'));var Papa=require('papaparse');var Redis=require(_0x1a4a('0x10'));var authService=require(_0x1a4a('0x11'));var qs=require(_0x1a4a('0x12'));var as=require(_0x1a4a('0x13'));var hardwareService=require(_0x1a4a('0x14'));var logger=require(_0x1a4a('0x15'))(_0x1a4a('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1a4a('0x17'))['db'];function respondWithStatusCode(_0x4902a1,_0x5190a4){_0x5190a4=_0x5190a4||0xcc;return function(_0x5f53de){if(_0x5f53de){return _0x4902a1[_0x1a4a('0x18')](_0x5190a4);}return _0x4902a1[_0x1a4a('0x19')](_0x5190a4)[_0x1a4a('0x1a')]();};}function respondWithResult(_0xffb74a,_0x2bcc8f){_0x2bcc8f=_0x2bcc8f||0xc8;return function(_0x436da8){if(_0x436da8){return _0xffb74a[_0x1a4a('0x19')](_0x2bcc8f)['json'](_0x436da8);}};}function respondWithFilteredResult(_0xd6bff9,_0x23e01d){return function(_0x180252){if(_0x180252){var _0x3136d5=typeof _0x23e01d[_0x1a4a('0x1b')]===_0x1a4a('0x1c')&&typeof _0x23e01d[_0x1a4a('0x1d')]==='undefined';var _0x3c320c=_0x180252[_0x1a4a('0x1e')];var _0x2a6db6=_0x3136d5?0x0:_0x23e01d[_0x1a4a('0x1b')];var _0x4fd852=_0x3136d5?_0x180252['count']:_0x23e01d[_0x1a4a('0x1b')]+_0x23e01d['limit'];var _0x211349;if(_0x4fd852>=_0x3c320c){_0x4fd852=_0x3c320c;_0x211349=0xc8;}else{_0x211349=0xce;}_0xd6bff9['status'](_0x211349);return _0xd6bff9[_0x1a4a('0x1f')](_0x1a4a('0x20'),_0x2a6db6+'-'+_0x4fd852+'/'+_0x3c320c)['json'](_0x180252);}return null;};}function patchUpdates(_0x5ed6fa){return function(_0x5e3967){try{jsonpatch['apply'](_0x5e3967,_0x5ed6fa,!![]);}catch(_0x3564c4){return BPromise[_0x1a4a('0x21')](_0x3564c4);}return _0x5e3967[_0x1a4a('0x22')]();};}function saveUpdates(_0x4c842f,_0x1d6314){return function(_0x4c155a){if(_0x4c155a){return _0x4c155a[_0x1a4a('0x23')](_0x4c842f)['then'](function(_0x519d1d){return _0x519d1d;});}return null;};}function removeEntity(_0x3609ce,_0x2b8301){return function(_0x5cf4f2){if(_0x5cf4f2){return _0x5cf4f2[_0x1a4a('0x24')]()['then'](function(){var _0x5a3a15=_0x5cf4f2[_0x1a4a('0x25')]({'plain':!![]});var _0x567f89=_0x1a4a('0x26');return db[_0x1a4a('0x27')][_0x1a4a('0x24')]({'where':{'type':_0x567f89,'resourceId':_0x5a3a15['id']}})[_0x1a4a('0x28')](function(){return _0x5cf4f2;});})[_0x1a4a('0x28')](function(){_0x3609ce[_0x1a4a('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59ffe4,_0x3b361b){return function(_0x27fdb9){if(!_0x27fdb9){_0x59ffe4[_0x1a4a('0x18')](0x194);}return _0x27fdb9;};}function handleError(_0x5da837,_0x49a186){_0x49a186=_0x49a186||0x1f4;return function(_0x44b05b){logger[_0x1a4a('0x29')](_0x44b05b[_0x1a4a('0x2a')]);if(_0x44b05b[_0x1a4a('0x2b')]){delete _0x44b05b[_0x1a4a('0x2b')];}_0x5da837[_0x1a4a('0x19')](_0x49a186)[_0x1a4a('0x2c')](_0x44b05b);};}exports['index']=function(_0x1c3545,_0x1a9c8c){var _0x3339fb={},_0x560d36={},_0x453c94={'count':0x0,'rows':[]};var _0x2b7c43=_[_0x1a4a('0x2d')](db[_0x1a4a('0x2e')][_0x1a4a('0x2f')],function(_0x6f6c4f){return{'name':_0x6f6c4f[_0x1a4a('0x30')],'type':_0x6f6c4f['type'][_0x1a4a('0x31')]};});_0x560d36[_0x1a4a('0x32')]=_[_0x1a4a('0x2d')](_0x2b7c43,_0x1a4a('0x2b'));_0x560d36[_0x1a4a('0x33')]=_[_0x1a4a('0x34')](_0x1c3545[_0x1a4a('0x33')]);_0x560d36[_0x1a4a('0x35')]=_['intersection'](_0x560d36['model'],_0x560d36[_0x1a4a('0x33')]);_0x3339fb[_0x1a4a('0x36')]=_['intersection'](_0x560d36[_0x1a4a('0x32')],qs['fields'](_0x1c3545[_0x1a4a('0x33')][_0x1a4a('0x37')]));_0x3339fb[_0x1a4a('0x36')]=_0x3339fb['attributes']['length']?_0x3339fb[_0x1a4a('0x36')]:_0x560d36[_0x1a4a('0x32')];if(!_0x1c3545[_0x1a4a('0x33')][_0x1a4a('0x38')]('nolimit')){_0x3339fb[_0x1a4a('0x1d')]=qs['limit'](_0x1c3545['query'][_0x1a4a('0x1d')]);_0x3339fb[_0x1a4a('0x1b')]=qs['offset'](_0x1c3545[_0x1a4a('0x33')][_0x1a4a('0x1b')]);}_0x3339fb[_0x1a4a('0x39')]=qs[_0x1a4a('0x3a')](_0x1c3545[_0x1a4a('0x33')][_0x1a4a('0x3a')]);_0x3339fb[_0x1a4a('0x3b')]=qs[_0x1a4a('0x35')](_[_0x1a4a('0x3c')](_0x1c3545[_0x1a4a('0x33')],_0x560d36['filters']),_0x2b7c43);if(_0x1c3545[_0x1a4a('0x33')][_0x1a4a('0x3d')]){_0x3339fb[_0x1a4a('0x3b')]=_[_0x1a4a('0x3e')](_0x3339fb['where'],{'$or':_[_0x1a4a('0x2d')](_0x2b7c43,function(_0x333aa2){if(_0x333aa2['type']!==_0x1a4a('0x3f')){var _0x4a161f={};_0x4a161f[_0x333aa2['name']]={'$like':'%'+_0x1c3545[_0x1a4a('0x33')][_0x1a4a('0x3d')]+'%'};return _0x4a161f;}})});}_0x3339fb=_[_0x1a4a('0x3e')]({},_0x3339fb,_0x1c3545[_0x1a4a('0x40')]);var _0x17191f={'where':_0x3339fb[_0x1a4a('0x3b')]};return db['Disposition'][_0x1a4a('0x1e')](_0x17191f)[_0x1a4a('0x28')](function(_0x53be73){_0x453c94['count']=_0x53be73;if(_0x1c3545[_0x1a4a('0x33')][_0x1a4a('0x41')]){_0x3339fb[_0x1a4a('0x42')]=[{'all':!![]}];}return db[_0x1a4a('0x2e')]['findAll'](_0x3339fb);})[_0x1a4a('0x28')](function(_0x392894){_0x453c94[_0x1a4a('0x43')]=_0x392894;return _0x453c94;})[_0x1a4a('0x28')](respondWithFilteredResult(_0x1a9c8c,_0x3339fb))[_0x1a4a('0x44')](handleError(_0x1a9c8c,null));};exports[_0x1a4a('0x45')]=function(_0x49b422,_0x2082bd){var _0x2dd797={'raw':!![],'where':{'id':_0x49b422[_0x1a4a('0x46')]['id']}},_0x1ea454={};_0x1ea454['model']=_['keys'](db[_0x1a4a('0x2e')]['rawAttributes']);_0x1ea454[_0x1a4a('0x33')]=_[_0x1a4a('0x34')](_0x49b422[_0x1a4a('0x33')]);_0x1ea454['filters']=_[_0x1a4a('0x47')](_0x1ea454[_0x1a4a('0x32')],_0x1ea454[_0x1a4a('0x33')]);_0x2dd797[_0x1a4a('0x36')]=_[_0x1a4a('0x47')](_0x1ea454['model'],qs[_0x1a4a('0x37')](_0x49b422['query']['fields']));_0x2dd797[_0x1a4a('0x36')]=_0x2dd797['attributes'][_0x1a4a('0x48')]?_0x2dd797['attributes']:_0x1ea454[_0x1a4a('0x32')];if(_0x49b422['query']['includeAll']){_0x2dd797[_0x1a4a('0x42')]=[{'all':!![]}];}_0x2dd797=_['merge']({},_0x2dd797,_0x49b422[_0x1a4a('0x40')]);return db[_0x1a4a('0x2e')]['find'](_0x2dd797)[_0x1a4a('0x28')](handleEntityNotFound(_0x2082bd,null))[_0x1a4a('0x28')](respondWithResult(_0x2082bd,null))[_0x1a4a('0x44')](handleError(_0x2082bd,null));};exports[_0x1a4a('0x49')]=function(_0x2169e6,_0xdd744f){return db['Disposition'][_0x1a4a('0x49')](_0x2169e6[_0x1a4a('0x4a')],{})[_0x1a4a('0x28')](function(_0x2f6258){var _0x5dc9a1=_0x2169e6['user'][_0x1a4a('0x25')]({'plain':!![]});if(!_0x5dc9a1)throw new Error(_0x1a4a('0x4b'));if(_0x5dc9a1[_0x1a4a('0x4c')]===_0x1a4a('0x4d')){var _0x4c3a4f=_0x2f6258[_0x1a4a('0x25')]({'plain':!![]});var _0x42ffb5=_0x1a4a('0x26');return db[_0x1a4a('0x4e')][_0x1a4a('0x4f')]({'where':{'name':_0x42ffb5,'userProfileId':_0x5dc9a1[_0x1a4a('0x50')]},'raw':!![]})['then'](function(_0x4da199){if(_0x4da199&&_0x4da199[_0x1a4a('0x51')]===0x0){return db[_0x1a4a('0x27')][_0x1a4a('0x49')]({'name':_0x4c3a4f['name'],'resourceId':_0x4c3a4f['id'],'type':_0x4da199[_0x1a4a('0x2b')],'sectionId':_0x4da199['id']},{})[_0x1a4a('0x28')](function(){return _0x2f6258;});}else{return _0x2f6258;}})[_0x1a4a('0x44')](function(_0x460991){logger['error'](_0x1a4a('0x52'),_0x460991);throw _0x460991;});}return _0x2f6258;})[_0x1a4a('0x28')](respondWithResult(_0xdd744f,0xc9))[_0x1a4a('0x44')](handleError(_0xdd744f,null));};exports[_0x1a4a('0x23')]=function(_0xd6af54,_0x5bae71){if(_0xd6af54[_0x1a4a('0x4a')]['id']){delete _0xd6af54[_0x1a4a('0x4a')]['id'];}return db[_0x1a4a('0x2e')][_0x1a4a('0x4f')]({'where':{'id':_0xd6af54[_0x1a4a('0x46')]['id']}})[_0x1a4a('0x28')](handleEntityNotFound(_0x5bae71,null))[_0x1a4a('0x28')](saveUpdates(_0xd6af54[_0x1a4a('0x4a')],null))[_0x1a4a('0x28')](respondWithResult(_0x5bae71,null))[_0x1a4a('0x44')](handleError(_0x5bae71,null));};exports[_0x1a4a('0x24')]=function(_0x2c88a4,_0x3a4fad){return db[_0x1a4a('0x2e')][_0x1a4a('0x4f')]({'where':{'id':_0x2c88a4[_0x1a4a('0x46')]['id']}})['then'](handleEntityNotFound(_0x3a4fad,null))['then'](removeEntity(_0x3a4fad,null))[_0x1a4a('0x44')](handleError(_0x3a4fad,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 1854c3c..27ecc83 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 _0x33a9=['../../config/environment','./disposition.attributes','exports','define','Disposition','tools_dispositions','name_voice','name','ListId','name_chat','ChatWebsiteId','name_mail','MailAccountId','SmsAccountId','name_fax','name_openchannel','name_whatsapp','WhatsappAccountId','lodash','util','../../config/logger','moment','path','rimraf'];(function(_0x3f25b2,_0x412bd4){var _0xd8caeb=function(_0x52d252){while(--_0x52d252){_0x3f25b2['push'](_0x3f25b2['shift']());}};_0xd8caeb(++_0x412bd4);}(_0x33a9,0x8a));var _0x933a=function(_0x4884a7,_0x18e38a){_0x4884a7=_0x4884a7-0x0;var _0x56b60e=_0x33a9[_0x4884a7];return _0x56b60e;};'use strict';var _=require(_0x933a('0x0'));var util=require(_0x933a('0x1'));var logger=require(_0x933a('0x2'))('api');var moment=require(_0x933a('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x933a('0x4'));var rimraf=require(_0x933a('0x5'));var config=require(_0x933a('0x6'));var attributes=require(_0x933a('0x7'));module[_0x933a('0x8')]=function(_0x27fc33,_0x44c2a5){return _0x27fc33[_0x933a('0x9')](_0x933a('0xa'),attributes,{'tableName':_0x933a('0xb'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x933a('0xc'),'fields':[_0x933a('0xd'),_0x933a('0xe')]},{'unique':!![],'name':_0x933a('0xf'),'fields':['name',_0x933a('0x10')]},{'unique':!![],'name':_0x933a('0x11'),'fields':[_0x933a('0xd'),_0x933a('0x12')]},{'unique':!![],'name':'name_sms','fields':[_0x933a('0xd'),_0x933a('0x13')]},{'unique':!![],'name':_0x933a('0x14'),'fields':[_0x933a('0xd'),'FaxAccountId']},{'unique':!![],'name':_0x933a('0x15'),'fields':[_0x933a('0xd'),'OpenchannelAccountId']},{'unique':!![],'name':_0x933a('0x16'),'fields':[_0x933a('0xd'),_0x933a('0x17')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa28f=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./disposition.attributes','exports','define','Disposition','tools_dispositions','name_voice','name','ListId','name_chat','ChatWebsiteId','name_mail','MailAccountId','SmsAccountId','FaxAccountId','OpenchannelAccountId','name_whatsapp','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa28f,0xf8));var _0xfa28=function(_0x35508c,_0x57f0bd){_0x35508c=_0x35508c-0x0;var _0x3a2bc0=_0xa28f[_0x35508c];return _0x3a2bc0;};'use strict';var _=require(_0xfa28('0x0'));var util=require(_0xfa28('0x1'));var logger=require(_0xfa28('0x2'))(_0xfa28('0x3'));var moment=require(_0xfa28('0x4'));var BPromise=require('bluebird');var rp=require(_0xfa28('0x5'));var fs=require('fs');var path=require(_0xfa28('0x6'));var rimraf=require(_0xfa28('0x7'));var config=require(_0xfa28('0x8'));var attributes=require(_0xfa28('0x9'));module[_0xfa28('0xa')]=function(_0x452f21,_0x435973){return _0x452f21[_0xfa28('0xb')](_0xfa28('0xc'),attributes,{'tableName':_0xfa28('0xd'),'paranoid':![],'indexes':[{'unique':!![],'name':_0xfa28('0xe'),'fields':[_0xfa28('0xf'),_0xfa28('0x10')]},{'unique':!![],'name':_0xfa28('0x11'),'fields':[_0xfa28('0xf'),_0xfa28('0x12')]},{'unique':!![],'name':_0xfa28('0x13'),'fields':[_0xfa28('0xf'),_0xfa28('0x14')]},{'unique':!![],'name':'name_sms','fields':[_0xfa28('0xf'),_0xfa28('0x15')]},{'unique':!![],'name':'name_fax','fields':[_0xfa28('0xf'),_0xfa28('0x16')]},{'unique':!![],'name':'name_openchannel','fields':['name',_0xfa28('0x17')]},{'unique':!![],'name':_0xfa28('0x18'),'fields':[_0xfa28('0xf'),'WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index f3eec23..1102f20 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(_0x179168,_0x24271f){var _0x5d21fa=function(_0x5414a2){while(--_0x5414a2){_0x179168['push'](_0x179168['shift']());}};_0x5d21fa(++_0x24271f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0xa9e0=['http','info','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(_0x2cda51,_0x367b70){var _0x2e1cf1=function(_0x23bd08){while(--_0x23bd08){_0x2cda51['push'](_0x2cda51['shift']());}};_0x2e1cf1(++_0x367b70);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'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 feec934..ac8c3d4 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 _0xe0c0=['./disposition.controller','get','isAuthenticated','index','show','post','create','delete','/:id','destroy','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x313fdf,_0xa6bcca){var _0x3002a5=function(_0x5b3146){while(--_0x5b3146){_0x313fdf['push'](_0x313fdf['shift']());}};_0x3002a5(++_0xa6bcca);}(_0xe0c0,0xe7));var _0x0e0c=function(_0x143b30,_0x17ebc3){_0x143b30=_0x143b30-0x0;var _0x1b9c7e=_0xe0c0[_0x143b30];return _0x1b9c7e;};'use strict';var multer=require(_0x0e0c('0x0'));var util=require('util');var path=require(_0x0e0c('0x1'));var timeout=require(_0x0e0c('0x2'));var express=require('express');var router=express[_0x0e0c('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0e0c('0x4'));var interaction=require(_0x0e0c('0x5'));var config=require(_0x0e0c('0x6'));var controller=require(_0x0e0c('0x7'));router[_0x0e0c('0x8')]('/',auth[_0x0e0c('0x9')](),controller[_0x0e0c('0xa')]);router[_0x0e0c('0x8')]('/:id',auth[_0x0e0c('0x9')](),controller[_0x0e0c('0xb')]);router[_0x0e0c('0xc')]('/',auth[_0x0e0c('0x9')](),controller[_0x0e0c('0xd')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x0e0c('0xe')](_0x0e0c('0xf'),auth['isAuthenticated'](),controller[_0x0e0c('0x10')]);module['exports']=router; \ No newline at end of file +var _0xb287=['fs-extra','../../components/interaction/service','../../config/environment','./disposition.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x5c6ceb,_0x4ed099){var _0x28821b=function(_0x391add){while(--_0x391add){_0x5c6ceb['push'](_0x5c6ceb['shift']());}};_0x28821b(++_0x4ed099);}(_0xb287,0x94));var _0x7b28=function(_0x481d05,_0x4e2dc1){_0x481d05=_0x481d05-0x0;var _0x421abb=_0xb287[_0x481d05];return _0x421abb;};'use strict';var multer=require(_0x7b28('0x0'));var util=require(_0x7b28('0x1'));var path=require(_0x7b28('0x2'));var timeout=require(_0x7b28('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x7b28('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x7b28('0x5'));var config=require(_0x7b28('0x6'));var controller=require(_0x7b28('0x7'));router[_0x7b28('0x8')]('/',auth[_0x7b28('0x9')](),controller['index']);router[_0x7b28('0x8')](_0x7b28('0xa'),auth[_0x7b28('0x9')](),controller[_0x7b28('0xb')]);router[_0x7b28('0xc')]('/',auth['isAuthenticated'](),controller[_0x7b28('0xd')]);router[_0x7b28('0xe')](_0x7b28('0xa'),auth[_0x7b28('0x9')](),controller[_0x7b28('0xf')]);router[_0x7b28('0x10')](_0x7b28('0xa'),auth[_0x7b28('0x9')](),controller[_0x7b28('0x11')]);module[_0x7b28('0x12')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index e83f3f0..cd62013 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 _0x5248=['14400','v17,v27,v29','INTEGER','SIP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','STRING','ENUM','localstationid','2400','4800','7200','9600'];(function(_0x149615,_0x269a87){var _0x4150cd=function(_0x4b7dac){while(--_0x4b7dac){_0x149615['push'](_0x149615['shift']());}};_0x4150cd(++_0x269a87);}(_0x5248,0x128));var _0x8524=function(_0x599864,_0x5ae102){_0x599864=_0x599864-0x0;var _0x16bede=_0x5248[_0x599864];return _0x16bede;};'use strict';var Sequelize=require(_0x8524('0x0'));module['exports']={'name':{'type':Sequelize[_0x8524('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x8524('0x1')]},'ecm':{'type':Sequelize[_0x8524('0x2')]('yes','no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0x8524('0x1')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0x8524('0x1')],'unique':_0x8524('0x3')},'minrate':{'type':Sequelize['ENUM'](_0x8524('0x4'),_0x8524('0x5'),_0x8524('0x6'),_0x8524('0x7'),'12000',_0x8524('0x8')),'defaultValue':_0x8524('0x5')},'maxrate':{'type':Sequelize['ENUM'](_0x8524('0x4'),_0x8524('0x5'),_0x8524('0x6'),'9600','12000','14400'),'defaultValue':_0x8524('0x8')},'modem':{'type':Sequelize[_0x8524('0x1')],'defaultValue':_0x8524('0x9')},'gateway':{'type':Sequelize[_0x8524('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x8524('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x8524('0xa')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM']('SIP','IAX','DADHI','KHOMP'),'defaultValue':_0x8524('0xb')},'key':{'type':Sequelize[_0x8524('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x8524('0xc')],'defaultValue':function(){return _0x8524('0xd');}},'notificationSound':{'type':Sequelize[_0x8524('0xe')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x8524('0xe')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x8524('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x8524('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x8524('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x8524('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x8524('0xa')],'allowNull':!![],'defaultValue':null,'comment':_0x8524('0xf')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x8524('0x10'),'set':function(_0x3544a3){if(!_0x3544a3)this[_0x8524('0x11')](_0x8524('0x12'),null);this['setDataValue']('mandatoryDisposition',_0x3544a3);}}}; \ No newline at end of file +var _0xfe2d=['Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','7200','12000','14400','4800','9600','INTEGER','SIP','DADHI','TEXT'];(function(_0x2a1507,_0x729808){var _0x557b4f=function(_0x44ac5c){while(--_0x44ac5c){_0x2a1507['push'](_0x2a1507['shift']());}};_0x557b4f(++_0x729808);}(_0xfe2d,0xa0));var _0xdfe2=function(_0x5b0eef,_0xc5d1eb){_0x5b0eef=_0x5b0eef-0x0;var _0x19d958=_0xfe2d[_0x5b0eef];return _0x19d958;};'use strict';var Sequelize=require(_0xdfe2('0x0'));module['exports']={'name':{'type':Sequelize[_0xdfe2('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xdfe2('0x1')]},'ecm':{'type':Sequelize[_0xdfe2('0x2')]('yes','no'),'defaultValue':_0xdfe2('0x3')},'headerinfo':{'type':Sequelize[_0xdfe2('0x1')],'defaultValue':_0xdfe2('0x4')},'localstationid':{'type':Sequelize[_0xdfe2('0x1')],'unique':_0xdfe2('0x5')},'minrate':{'type':Sequelize['ENUM'](_0xdfe2('0x6'),'4800',_0xdfe2('0x7'),'9600',_0xdfe2('0x8'),_0xdfe2('0x9')),'defaultValue':_0xdfe2('0xa')},'maxrate':{'type':Sequelize[_0xdfe2('0x2')]('2400',_0xdfe2('0xa'),_0xdfe2('0x7'),_0xdfe2('0xb'),_0xdfe2('0x8'),_0xdfe2('0x9')),'defaultValue':_0xdfe2('0x9')},'modem':{'type':Sequelize['STRING'],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0xdfe2('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xdfe2('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xdfe2('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xdfe2('0x2')](_0xdfe2('0xd'),'IAX',_0xdfe2('0xe'),'KHOMP'),'defaultValue':_0xdfe2('0xd')},'key':{'type':Sequelize[_0xdfe2('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xdfe2('0xf')],'defaultValue':function(){return _0xdfe2('0x10');}},'notificationSound':{'type':Sequelize[_0xdfe2('0x11')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xdfe2('0x11')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xdfe2('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xdfe2('0x11')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xdfe2('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xdfe2('0x11')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xdfe2('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xdfe2('0xc')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xdfe2('0x12'),'set':function(_0x4f9ccc){if(!_0x4f9ccc)this[_0xdfe2('0x13')](_0xdfe2('0x14'),null);this[_0xdfe2('0x13')](_0xdfe2('0x15'),_0x4f9ccc);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 73e5849..0496a86 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 _0x4d8d=['rawAttributes','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','Disposition','getDispositions','hasOwnProperty','nolimit','removeDispositions','addAnswer','FaxAccountId','CannedAnswer','removeAnswers','ids','addInteraction','FaxInteraction','findOne','CmContact','Contact','User','internal','Tag','Tags','color','tag','addApplications','transaction','sequelize','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','priority','finally','getApplications','localstationid','app','system','description','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','Set','ecm','faxdetect','maxrate','minrate','t38timeout','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','updateAccountApplications','VoiceExtension','omit','tech','key','createdAt','updatedAt','TrunkId','getMessages','FaxMessage','$gte','split','CmList','Contacts','attachments','join','root','server/files/attachments','CheckAfterSend','isNil','path','from','format','\x22%s\x22\x20<%s>','fax','List','Send\x20Fax\x20failed','user','out','filename','Messages','Contact\x20not\x20found','spread','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./faxAccount.socket','register','jayson/promise','client','http','request','info','FaxAccount,\x20%s,\x20%s','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','get','FaxAccounts','stack','name','send','index','mandatoryDispositionPause','map','FaxAccount','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','params','Pause'];(function(_0x1c7686,_0x5ac25f){var _0x11b2d8=function(_0x3408c8){while(--_0x3408c8){_0x1c7686['push'](_0x1c7686['shift']());}};_0x11b2d8(++_0x5ac25f);}(_0x4d8d,0x6b));var _0xd4d8=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4d8d[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0xd4d8('0x0'));var rimraf=require(_0xd4d8('0x1'));var zipdir=require(_0xd4d8('0x2'));var jsonpatch=require(_0xd4d8('0x3'));var rp=require(_0xd4d8('0x4'));var moment=require(_0xd4d8('0x5'));var BPromise=require(_0xd4d8('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xd4d8('0x7'));var csv=require('to-csv');var ejs=require(_0xd4d8('0x8'));var fs=require('fs');var fs_extra=require(_0xd4d8('0x9'));var _=require(_0xd4d8('0xa'));var squel=require(_0xd4d8('0xb'));var crypto=require('crypto');var jsforce=require(_0xd4d8('0xc'));var deskjs=require(_0xd4d8('0xd'));var toCsv=require(_0xd4d8('0xe'));var querystring=require(_0xd4d8('0xf'));var Papa=require(_0xd4d8('0x10'));var Redis=require(_0xd4d8('0x11'));var authService=require(_0xd4d8('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd4d8('0x13'))(_0xd4d8('0x14'));var utils=require(_0xd4d8('0x15'));var config=require(_0xd4d8('0x16'));var licenseUtil=require(_0xd4d8('0x17'));var db=require(_0xd4d8('0x18'))['db'];config[_0xd4d8('0x19')]=_[_0xd4d8('0x1a')](config[_0xd4d8('0x19')],{'host':_0xd4d8('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd4d8('0x19')]));require(_0xd4d8('0x1c'))[_0xd4d8('0x1d')](socket);var jayson=require(_0xd4d8('0x1e'));var client=jayson[_0xd4d8('0x1f')]['http']({'port':0x232c});var client9002=jayson[_0xd4d8('0x1f')][_0xd4d8('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x333568,_0x46ae8c,_0x4960a5,_0x1b7065){return new BPromise(function(_0x446b70,_0x438c09){var _0x1a1e41=_0x1b7065||client;return _0x1a1e41[_0xd4d8('0x21')](_0x333568,_0x4960a5)['then'](function(_0x3c8a66){logger[_0xd4d8('0x22')](_0xd4d8('0x23'),_0x46ae8c,'request\x20sent');logger['debug'](_0xd4d8('0x24'),_0x46ae8c,_0xd4d8('0x25'),JSON['stringify'](_0x3c8a66));if(_0x3c8a66[_0xd4d8('0x26')]){if(_0x3c8a66[_0xd4d8('0x26')][_0xd4d8('0x27')]===0x1f4){logger[_0xd4d8('0x26')](_0xd4d8('0x23'),_0x46ae8c,_0x3c8a66[_0xd4d8('0x26')]['message']);return _0x438c09(_0x3c8a66['error'][_0xd4d8('0x28')]);}logger['error'](_0xd4d8('0x23'),_0x46ae8c,_0x3c8a66[_0xd4d8('0x26')][_0xd4d8('0x28')]);return _0x446b70(_0x3c8a66['error']['message']);}else{logger[_0xd4d8('0x22')](_0xd4d8('0x23'),_0x46ae8c,_0xd4d8('0x25'));_0x446b70(_0x3c8a66[_0xd4d8('0x29')][_0xd4d8('0x28')]);}})[_0xd4d8('0x2a')](function(_0x1c3fbd){logger[_0xd4d8('0x26')](_0xd4d8('0x23'),_0x46ae8c,_0x1c3fbd);_0x438c09(_0x1c3fbd);});});}function respondWithStatusCode(_0x251d15,_0x586a8e){_0x586a8e=_0x586a8e||0xcc;return function(_0x164025){if(_0x164025){return _0x251d15[_0xd4d8('0x2b')](_0x586a8e);}return _0x251d15['status'](_0x586a8e)['end']();};}function respondWithResult(_0x1333e9,_0x201e2a){_0x201e2a=_0x201e2a||0xc8;return function(_0x52d3b4){if(_0x52d3b4){return _0x1333e9[_0xd4d8('0x2c')](_0x201e2a)[_0xd4d8('0x2d')](_0x52d3b4);}};}function respondWithFilteredResult(_0x140ed0,_0x473fbc){return function(_0x193ec7){if(_0x193ec7){var _0x4c2d42=typeof _0x473fbc[_0xd4d8('0x2e')]===_0xd4d8('0x2f')&&typeof _0x473fbc[_0xd4d8('0x30')]===_0xd4d8('0x2f');var _0x6bee9e=_0x193ec7[_0xd4d8('0x31')];var _0x4853b7=_0x4c2d42?0x0:_0x473fbc[_0xd4d8('0x2e')];var _0x1a6f72=_0x4c2d42?_0x193ec7[_0xd4d8('0x31')]:_0x473fbc[_0xd4d8('0x2e')]+_0x473fbc[_0xd4d8('0x30')];var _0x545663;if(_0x1a6f72>=_0x6bee9e){_0x1a6f72=_0x6bee9e;_0x545663=0xc8;}else{_0x545663=0xce;}_0x140ed0[_0xd4d8('0x2c')](_0x545663);return _0x140ed0[_0xd4d8('0x32')](_0xd4d8('0x33'),_0x4853b7+'-'+_0x1a6f72+'/'+_0x6bee9e)[_0xd4d8('0x2d')](_0x193ec7);}return null;};}function patchUpdates(_0xd95c57){return function(_0x27128b){try{jsonpatch['apply'](_0x27128b,_0xd95c57,!![]);}catch(_0x552bc7){return BPromise[_0xd4d8('0x34')](_0x552bc7);}return _0x27128b[_0xd4d8('0x35')]();};}function saveUpdates(_0x1f8b45,_0x4ca332){return function(_0xaadaed){if(_0xaadaed){return _0xaadaed[_0xd4d8('0x36')](_0x1f8b45)[_0xd4d8('0x37')](function(_0x20b951){return _0x20b951;});}return null;};}function removeEntity(_0x2814e7,_0x4723cb){return function(_0x32cd56){if(_0x32cd56){return _0x32cd56[_0xd4d8('0x38')]()['then'](function(){var _0x487b15=_0x32cd56[_0xd4d8('0x39')]({'plain':!![]});var _0xd073ac=_0xd4d8('0x3a');return db['UserProfileResource'][_0xd4d8('0x38')]({'where':{'type':_0xd073ac,'resourceId':_0x487b15['id']}})[_0xd4d8('0x37')](function(){return _0x32cd56;});})[_0xd4d8('0x37')](function(){_0x2814e7[_0xd4d8('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x14bcb4,_0x36c02d){return function(_0x92b9de){if(!_0x92b9de){_0x14bcb4[_0xd4d8('0x2b')](0x194);}return _0x92b9de;};}function handleError(_0x197340,_0x24438d){_0x24438d=_0x24438d||0x1f4;return function(_0x203802){logger[_0xd4d8('0x26')](_0x203802[_0xd4d8('0x3b')]);if(_0x203802[_0xd4d8('0x3c')]){delete _0x203802[_0xd4d8('0x3c')];}_0x197340[_0xd4d8('0x2c')](_0x24438d)[_0xd4d8('0x3d')](_0x203802);};}exports[_0xd4d8('0x3e')]=function(_0x20f2fb,_0x580387){var _0x24170a={'include':[{'model':db['Pause'],'as':_0xd4d8('0x3f')}]},_0x34b64c={},_0x55e7fa={'count':0x0,'rows':[]};var _0x4944f3=_[_0xd4d8('0x40')](db[_0xd4d8('0x41')]['rawAttributes'],function(_0x5a996a){return{'name':_0x5a996a[_0xd4d8('0x42')],'type':_0x5a996a[_0xd4d8('0x43')]['key']};});_0x34b64c[_0xd4d8('0x44')]=_[_0xd4d8('0x40')](_0x4944f3,'name');_0x34b64c[_0xd4d8('0x45')]=_[_0xd4d8('0x46')](_0x20f2fb[_0xd4d8('0x45')]);_0x34b64c[_0xd4d8('0x47')]=_[_0xd4d8('0x48')](_0x34b64c['model'],_0x34b64c[_0xd4d8('0x45')]);_0x24170a[_0xd4d8('0x49')]=_[_0xd4d8('0x48')](_0x34b64c[_0xd4d8('0x44')],qs[_0xd4d8('0x4a')](_0x20f2fb['query'][_0xd4d8('0x4a')]));_0x24170a[_0xd4d8('0x49')]=_0x24170a[_0xd4d8('0x49')][_0xd4d8('0x4b')]?_0x24170a['attributes']:_0x34b64c[_0xd4d8('0x44')];if(!_0x20f2fb[_0xd4d8('0x45')]['hasOwnProperty']('nolimit')){_0x24170a['limit']=qs[_0xd4d8('0x30')](_0x20f2fb[_0xd4d8('0x45')]['limit']);_0x24170a[_0xd4d8('0x2e')]=qs['offset'](_0x20f2fb[_0xd4d8('0x45')][_0xd4d8('0x2e')]);}_0x24170a[_0xd4d8('0x4c')]=qs[_0xd4d8('0x4d')](_0x20f2fb[_0xd4d8('0x45')][_0xd4d8('0x4d')]);_0x24170a[_0xd4d8('0x4e')]=qs[_0xd4d8('0x47')](_[_0xd4d8('0x4f')](_0x20f2fb[_0xd4d8('0x45')],_0x34b64c[_0xd4d8('0x47')]),_0x4944f3);if(_0x20f2fb[_0xd4d8('0x45')][_0xd4d8('0x50')]){_0x24170a[_0xd4d8('0x4e')]=_[_0xd4d8('0x51')](_0x24170a['where'],{'$or':_['map'](_0x4944f3,function(_0x594411){if(_0x594411[_0xd4d8('0x43')]!==_0xd4d8('0x52')){var _0x17ef8f={};_0x17ef8f[_0x594411[_0xd4d8('0x3c')]]={'$like':'%'+_0x20f2fb[_0xd4d8('0x45')]['filter']+'%'};return _0x17ef8f;}})});}_0x24170a=_[_0xd4d8('0x51')]({},_0x24170a,_0x20f2fb['options']);var _0x339dd6={'where':_0x24170a[_0xd4d8('0x4e')]};return db[_0xd4d8('0x41')][_0xd4d8('0x31')](_0x339dd6)['then'](function(_0x261835){_0x55e7fa[_0xd4d8('0x31')]=_0x261835;if(_0x20f2fb[_0xd4d8('0x45')][_0xd4d8('0x53')]){_0x24170a[_0xd4d8('0x54')]=[{'all':!![]}];}return db[_0xd4d8('0x41')][_0xd4d8('0x55')](_0x24170a);})[_0xd4d8('0x37')](function(_0x567066){_0x55e7fa[_0xd4d8('0x56')]=_0x567066;return _0x55e7fa;})[_0xd4d8('0x37')](respondWithFilteredResult(_0x580387,_0x24170a))['catch'](handleError(_0x580387,null));};exports['show']=function(_0x321434,_0x52fc5a){var _0x12017d={'raw':![],'where':{'id':_0x321434[_0xd4d8('0x57')]['id']},'include':[{'model':db[_0xd4d8('0x58')],'as':_0xd4d8('0x3f')}]},_0x189c6b={};_0x189c6b[_0xd4d8('0x44')]=_['keys'](db[_0xd4d8('0x41')][_0xd4d8('0x59')]);_0x189c6b['query']=_[_0xd4d8('0x46')](_0x321434[_0xd4d8('0x45')]);_0x189c6b[_0xd4d8('0x47')]=_[_0xd4d8('0x48')](_0x189c6b[_0xd4d8('0x44')],_0x189c6b['query']);_0x12017d['attributes']=_['intersection'](_0x189c6b[_0xd4d8('0x44')],qs[_0xd4d8('0x4a')](_0x321434[_0xd4d8('0x45')][_0xd4d8('0x4a')]));_0x12017d[_0xd4d8('0x49')]=_0x12017d['attributes'][_0xd4d8('0x4b')]?_0x12017d[_0xd4d8('0x49')]:_0x189c6b[_0xd4d8('0x44')];if(_0x321434['query'][_0xd4d8('0x53')]){_0x12017d['include']=[{'all':!![]}];}_0x12017d=_[_0xd4d8('0x51')]({},_0x12017d,_0x321434[_0xd4d8('0x5a')]);return db[_0xd4d8('0x41')][_0xd4d8('0x5b')](_0x12017d)[_0xd4d8('0x37')](handleEntityNotFound(_0x52fc5a,null))['then'](respondWithResult(_0x52fc5a,null))[_0xd4d8('0x2a')](handleError(_0x52fc5a,null));};exports[_0xd4d8('0x5c')]=function(_0x32520f,_0x47edd1){return db[_0xd4d8('0x41')]['create'](_0x32520f[_0xd4d8('0x5d')],{})[_0xd4d8('0x37')](function(_0x4a0ab2){var _0x4f3e19=_0x32520f['user'][_0xd4d8('0x39')]({'plain':!![]});if(!_0x4f3e19)throw new Error(_0xd4d8('0x5e'));if(_0x4f3e19[_0xd4d8('0x5f')]==='user'){var _0x4198a5=_0x4a0ab2['get']({'plain':!![]});var _0x3de380=_0xd4d8('0x3a');return db[_0xd4d8('0x60')][_0xd4d8('0x5b')]({'where':{'name':_0x3de380,'userProfileId':_0x4f3e19['userProfileId']},'raw':!![]})['then'](function(_0x34b82b){if(_0x34b82b&&_0x34b82b[_0xd4d8('0x61')]===0x0){return db[_0xd4d8('0x62')][_0xd4d8('0x5c')]({'name':_0x4198a5[_0xd4d8('0x3c')],'resourceId':_0x4198a5['id'],'type':_0x34b82b[_0xd4d8('0x3c')],'sectionId':_0x34b82b['id']},{})[_0xd4d8('0x37')](function(){return _0x4a0ab2;});}else{return _0x4a0ab2;}})[_0xd4d8('0x2a')](function(_0x5bac22){logger[_0xd4d8('0x26')](_0xd4d8('0x63'),_0x5bac22);throw _0x5bac22;});}return _0x4a0ab2;})[_0xd4d8('0x37')](respondWithResult(_0x47edd1,0xc9))['catch'](handleError(_0x47edd1,null));};exports[_0xd4d8('0x36')]=function(_0x26231f,_0x3d17bd){if(_0x26231f[_0xd4d8('0x5d')]['id']){delete _0x26231f[_0xd4d8('0x5d')]['id'];}return db['FaxAccount'][_0xd4d8('0x5b')]({'where':{'id':_0x26231f[_0xd4d8('0x57')]['id']},'include':[{'model':db['Pause'],'as':_0xd4d8('0x3f')}]})['then'](handleEntityNotFound(_0x3d17bd,null))[_0xd4d8('0x37')](saveUpdates(_0x26231f[_0xd4d8('0x5d')],null))[_0xd4d8('0x37')](respondWithResult(_0x3d17bd,null))[_0xd4d8('0x2a')](handleError(_0x3d17bd,null));};exports[_0xd4d8('0x38')]=function(_0x161c32,_0x560aeb){return db['FaxAccount'][_0xd4d8('0x5b')]({'where':{'id':_0x161c32['params']['id']}})[_0xd4d8('0x37')](handleEntityNotFound(_0x560aeb,null))[_0xd4d8('0x37')](removeEntity(_0x560aeb,null))[_0xd4d8('0x2a')](handleError(_0x560aeb,null));};exports['describe']=function(_0x43d23c,_0x335a95){return db[_0xd4d8('0x41')][_0xd4d8('0x64')]()[_0xd4d8('0x37')](respondWithResult(_0x335a95,null))['catch'](handleError(_0x335a95,null));};exports[_0xd4d8('0x65')]=function(_0x2557b4,_0x1f9dcd,_0x278dd6){if(_0x2557b4[_0xd4d8('0x5d')]['id']){delete _0x2557b4['body']['id'];}return db[_0xd4d8('0x41')][_0xd4d8('0x5b')]({'where':{'id':_0x2557b4['params']['id']}})['then'](handleEntityNotFound(_0x1f9dcd,null))[_0xd4d8('0x37')](function(_0x383a36){if(_0x383a36){_0x2557b4[_0xd4d8('0x5d')]['FaxAccountId']=_0x383a36['id'];return db[_0xd4d8('0x66')][_0xd4d8('0x5c')](_0x2557b4[_0xd4d8('0x5d')]);}})[_0xd4d8('0x37')](respondWithResult(_0x1f9dcd,null))[_0xd4d8('0x2a')](handleError(_0x1f9dcd,null));};exports[_0xd4d8('0x67')]=function(_0x32699e,_0x3671ed,_0x5d0704){var _0x41d1d0={'raw':![],'where':{}};var _0x1d14e4={};var _0x131198={'count':0x0,'rows':[]};return db[_0xd4d8('0x41')]['findOne']({'where':{'id':_0x32699e['params']['id']}})[_0xd4d8('0x37')](handleEntityNotFound(_0x3671ed,null))[_0xd4d8('0x37')](function(_0x5c17f9){if(_0x5c17f9){_0x1d14e4[_0xd4d8('0x44')]=_['keys'](db[_0xd4d8('0x66')][_0xd4d8('0x59')]);_0x1d14e4[_0xd4d8('0x45')]=_[_0xd4d8('0x46')](_0x32699e['query']);_0x1d14e4[_0xd4d8('0x47')]=_['intersection'](_0x1d14e4['model'],_0x1d14e4['query']);_0x41d1d0['attributes']=_[_0xd4d8('0x48')](_0x1d14e4[_0xd4d8('0x44')],qs['fields'](_0x32699e[_0xd4d8('0x45')][_0xd4d8('0x4a')]));_0x41d1d0['attributes']=_0x41d1d0[_0xd4d8('0x49')][_0xd4d8('0x4b')]?_0x41d1d0['attributes']:_0x1d14e4[_0xd4d8('0x44')];if(!_0x32699e[_0xd4d8('0x45')][_0xd4d8('0x68')](_0xd4d8('0x69'))){_0x41d1d0[_0xd4d8('0x30')]=qs[_0xd4d8('0x30')](_0x32699e['query'][_0xd4d8('0x30')]);_0x41d1d0['offset']=qs[_0xd4d8('0x2e')](_0x32699e[_0xd4d8('0x45')][_0xd4d8('0x2e')]);}_0x41d1d0[_0xd4d8('0x4c')]=qs[_0xd4d8('0x4d')](_0x32699e[_0xd4d8('0x45')][_0xd4d8('0x4d')]);_0x41d1d0['where']=qs[_0xd4d8('0x47')](_['pick'](_0x32699e[_0xd4d8('0x45')],_0x1d14e4['filters']));_0x41d1d0[_0xd4d8('0x4e')]['FaxAccountId']=_0x5c17f9['id'];if(_0x32699e['query'][_0xd4d8('0x50')]){_0x41d1d0[_0xd4d8('0x4e')]=_[_0xd4d8('0x51')](_0x41d1d0[_0xd4d8('0x4e')],{'$or':_[_0xd4d8('0x40')](_0x41d1d0['attributes'],function(_0x170c62){var _0x39bf61={};_0x39bf61[_0x170c62]={'$like':'%'+_0x32699e[_0xd4d8('0x45')][_0xd4d8('0x50')]+'%'};return _0x39bf61;})});}_0x41d1d0=_[_0xd4d8('0x51')]({},_0x41d1d0,_0x32699e[_0xd4d8('0x5a')]);return db[_0xd4d8('0x66')]['count']({'where':_0x41d1d0[_0xd4d8('0x4e')]})[_0xd4d8('0x37')](function(_0x54c6f7){_0x131198['count']=_0x54c6f7;if(_0x32699e[_0xd4d8('0x45')][_0xd4d8('0x53')]){_0x41d1d0[_0xd4d8('0x54')]=[{'all':!![]}];}return db[_0xd4d8('0x66')][_0xd4d8('0x55')](_0x41d1d0);})[_0xd4d8('0x37')](function(_0x17538a){_0x131198['rows']=_0x17538a;return _0x131198;});}})['then'](respondWithFilteredResult(_0x3671ed,_0x41d1d0))['catch'](handleError(_0x3671ed,null));};exports['removeDispositions']=function(_0x1a9bc8,_0x186633,_0x35b917){return db[_0xd4d8('0x41')][_0xd4d8('0x5b')]({'where':{'id':_0x1a9bc8[_0xd4d8('0x57')]['id']}})[_0xd4d8('0x37')](handleEntityNotFound(_0x186633,null))[_0xd4d8('0x37')](function(_0x890ffe){if(_0x890ffe){return _0x890ffe[_0xd4d8('0x6a')](_0x1a9bc8[_0xd4d8('0x45')]['ids']);}})[_0xd4d8('0x37')](respondWithStatusCode(_0x186633,null))['catch'](handleError(_0x186633,null));};exports[_0xd4d8('0x6b')]=function(_0x135682,_0x46bb08,_0x3ba00c){if(_0x135682[_0xd4d8('0x5d')]['id']){delete _0x135682[_0xd4d8('0x5d')]['id'];}return db['FaxAccount'][_0xd4d8('0x5b')]({'where':{'id':_0x135682[_0xd4d8('0x57')]['id']}})[_0xd4d8('0x37')](handleEntityNotFound(_0x46bb08,null))[_0xd4d8('0x37')](function(_0x57de02){if(_0x57de02){_0x135682[_0xd4d8('0x5d')][_0xd4d8('0x6c')]=_0x57de02['id'];return db[_0xd4d8('0x6d')][_0xd4d8('0x5c')](_0x135682[_0xd4d8('0x5d')]);}})['then'](respondWithResult(_0x46bb08,null))['catch'](handleError(_0x46bb08,null));};exports['getAnswers']=function(_0x2eb3f5,_0x5d5fef,_0x535544){var _0x4f626e={'raw':![],'where':{}};var _0x9e5763={};var _0x2d6dfb={'count':0x0,'rows':[]};return db[_0xd4d8('0x41')]['findOne']({'where':{'id':_0x2eb3f5['params']['id']}})[_0xd4d8('0x37')](handleEntityNotFound(_0x5d5fef,null))[_0xd4d8('0x37')](function(_0x592819){if(_0x592819){_0x9e5763['model']=_['keys'](db['CannedAnswer'][_0xd4d8('0x59')]);_0x9e5763[_0xd4d8('0x45')]=_[_0xd4d8('0x46')](_0x2eb3f5[_0xd4d8('0x45')]);_0x9e5763[_0xd4d8('0x47')]=_[_0xd4d8('0x48')](_0x9e5763[_0xd4d8('0x44')],_0x9e5763['query']);_0x4f626e[_0xd4d8('0x49')]=_[_0xd4d8('0x48')](_0x9e5763[_0xd4d8('0x44')],qs[_0xd4d8('0x4a')](_0x2eb3f5[_0xd4d8('0x45')][_0xd4d8('0x4a')]));_0x4f626e[_0xd4d8('0x49')]=_0x4f626e[_0xd4d8('0x49')][_0xd4d8('0x4b')]?_0x4f626e[_0xd4d8('0x49')]:_0x9e5763[_0xd4d8('0x44')];if(!_0x2eb3f5[_0xd4d8('0x45')][_0xd4d8('0x68')](_0xd4d8('0x69'))){_0x4f626e[_0xd4d8('0x30')]=qs[_0xd4d8('0x30')](_0x2eb3f5[_0xd4d8('0x45')][_0xd4d8('0x30')]);_0x4f626e[_0xd4d8('0x2e')]=qs[_0xd4d8('0x2e')](_0x2eb3f5[_0xd4d8('0x45')][_0xd4d8('0x2e')]);}_0x4f626e['order']=qs[_0xd4d8('0x4d')](_0x2eb3f5[_0xd4d8('0x45')]['sort']);_0x4f626e['where']=qs[_0xd4d8('0x47')](_['pick'](_0x2eb3f5[_0xd4d8('0x45')],_0x9e5763[_0xd4d8('0x47')]));_0x4f626e[_0xd4d8('0x4e')][_0xd4d8('0x6c')]=_0x592819['id'];if(_0x2eb3f5[_0xd4d8('0x45')][_0xd4d8('0x50')]){_0x4f626e[_0xd4d8('0x4e')]=_[_0xd4d8('0x51')](_0x4f626e['where'],{'$or':_['map'](_0x4f626e[_0xd4d8('0x49')],function(_0x860d23){var _0x20d0e2={};_0x20d0e2[_0x860d23]={'$like':'%'+_0x2eb3f5['query'][_0xd4d8('0x50')]+'%'};return _0x20d0e2;})});}_0x4f626e=_[_0xd4d8('0x51')]({},_0x4f626e,_0x2eb3f5[_0xd4d8('0x5a')]);return db[_0xd4d8('0x6d')][_0xd4d8('0x31')]({'where':_0x4f626e[_0xd4d8('0x4e')]})[_0xd4d8('0x37')](function(_0x33b11f){_0x2d6dfb[_0xd4d8('0x31')]=_0x33b11f;if(_0x2eb3f5[_0xd4d8('0x45')][_0xd4d8('0x53')]){_0x4f626e[_0xd4d8('0x54')]=[{'all':!![]}];}return db[_0xd4d8('0x6d')][_0xd4d8('0x55')](_0x4f626e);})[_0xd4d8('0x37')](function(_0x311100){_0x2d6dfb[_0xd4d8('0x56')]=_0x311100;return _0x2d6dfb;});}})[_0xd4d8('0x37')](respondWithFilteredResult(_0x5d5fef,_0x4f626e))[_0xd4d8('0x2a')](handleError(_0x5d5fef,null));};exports[_0xd4d8('0x6e')]=function(_0x3a316d,_0xb7ca78,_0x1835b7){return db[_0xd4d8('0x41')][_0xd4d8('0x5b')]({'where':{'id':_0x3a316d[_0xd4d8('0x57')]['id']}})[_0xd4d8('0x37')](handleEntityNotFound(_0xb7ca78,null))[_0xd4d8('0x37')](function(_0x1f2480){if(_0x1f2480){return _0x1f2480['removeAnswers'](_0x3a316d['query'][_0xd4d8('0x6f')]);}})['then'](respondWithStatusCode(_0xb7ca78,null))[_0xd4d8('0x2a')](handleError(_0xb7ca78,null));};exports[_0xd4d8('0x70')]=function(_0x64d9b5,_0x26fbe9,_0x47580d){return db[_0xd4d8('0x71')][_0xd4d8('0x5b')]({'where':{'id':_0x64d9b5[_0xd4d8('0x57')]['id']}})[_0xd4d8('0x37')](handleEntityNotFound(_0x26fbe9,null))[_0xd4d8('0x37')](function(_0x4da052){if(_0x4da052){return _0x4da052[_0xd4d8('0x70')](_0x64d9b5[_0xd4d8('0x5d')]['ids'],_['omit'](_0x64d9b5[_0xd4d8('0x5d')],[_0xd4d8('0x6f'),'id'])||{});}})[_0xd4d8('0x37')](respondWithResult(_0x26fbe9,null))[_0xd4d8('0x2a')](handleError(_0x26fbe9,null));};exports['getInteractions']=function(_0x46905b,_0x17378a,_0x17c887){var _0x2e5635={'raw':![],'where':{}};var _0xa62283={};var _0x30d729={'count':0x0,'rows':[]};return db[_0xd4d8('0x41')][_0xd4d8('0x72')]({'where':{'id':_0x46905b[_0xd4d8('0x57')]['id']}})['then'](handleEntityNotFound(_0x17378a,null))[_0xd4d8('0x37')](function(_0x169a3e){if(_0x169a3e){_0xa62283['model']=_[_0xd4d8('0x46')](db[_0xd4d8('0x71')][_0xd4d8('0x59')]);_0xa62283['query']=_['keys'](_0x46905b[_0xd4d8('0x45')]);_0xa62283[_0xd4d8('0x47')]=_['intersection'](_0xa62283[_0xd4d8('0x44')],_0xa62283[_0xd4d8('0x45')]);_0x2e5635[_0xd4d8('0x49')]=_[_0xd4d8('0x48')](_0xa62283[_0xd4d8('0x44')],qs[_0xd4d8('0x4a')](_0x46905b['query'][_0xd4d8('0x4a')]));_0x2e5635[_0xd4d8('0x49')]=_0x2e5635['attributes'][_0xd4d8('0x4b')]?_0x2e5635[_0xd4d8('0x49')]:_0xa62283[_0xd4d8('0x44')];if(!_0x46905b[_0xd4d8('0x45')]['hasOwnProperty'](_0xd4d8('0x69'))){_0x2e5635[_0xd4d8('0x30')]=qs[_0xd4d8('0x30')](_0x46905b[_0xd4d8('0x45')][_0xd4d8('0x30')]);_0x2e5635[_0xd4d8('0x2e')]=qs[_0xd4d8('0x2e')](_0x46905b[_0xd4d8('0x45')][_0xd4d8('0x2e')]);}_0x2e5635['order']=qs['sort'](_0x46905b[_0xd4d8('0x45')]['sort']);_0x2e5635[_0xd4d8('0x4e')]=qs[_0xd4d8('0x47')](_['pick'](_0x46905b[_0xd4d8('0x45')],_0xa62283[_0xd4d8('0x47')]));_0x2e5635[_0xd4d8('0x4e')][_0xd4d8('0x6c')]=_0x169a3e['id'];if(_0x46905b[_0xd4d8('0x45')][_0xd4d8('0x50')]){_0x2e5635['where']=_[_0xd4d8('0x51')](_0x2e5635[_0xd4d8('0x4e')],{'$or':_[_0xd4d8('0x40')](_0x2e5635['attributes'],function(_0x417189){var _0x571dcd={};_0x571dcd[_0x417189]={'$like':'%'+_0x46905b['query'][_0xd4d8('0x50')]+'%'};return _0x571dcd;})});}_0x2e5635=_[_0xd4d8('0x51')]({},_0x2e5635,_0x46905b[_0xd4d8('0x5a')]);return db[_0xd4d8('0x71')][_0xd4d8('0x31')]({'where':_0x2e5635[_0xd4d8('0x4e')]})[_0xd4d8('0x37')](function(_0x2a11ac){_0x30d729[_0xd4d8('0x31')]=_0x2a11ac;if(_0x46905b['query']['includeAll']){_0x2e5635[_0xd4d8('0x54')]=[{'model':db[_0xd4d8('0x73')],'as':_0xd4d8('0x74'),'required':![]},{'model':db[_0xd4d8('0x75')],'as':'Owner','attributes':[_0xd4d8('0x3c'),'fullname',_0xd4d8('0x76')],'required':![]},{'model':db[_0xd4d8('0x77')],'as':_0xd4d8('0x78'),'attributes':['id','name',_0xd4d8('0x79')],'where':_0x46905b[_0xd4d8('0x45')][_0xd4d8('0x7a')]?{'id':_0x46905b[_0xd4d8('0x45')]['tag']}:undefined,'required':_0x46905b[_0xd4d8('0x45')][_0xd4d8('0x7a')]?!![]:![]}];}return db['FaxInteraction'][_0xd4d8('0x55')](_0x2e5635);})[_0xd4d8('0x37')](function(_0x4e2925){_0x30d729[_0xd4d8('0x56')]=_0x4e2925;return _0x30d729;});}})[_0xd4d8('0x37')](respondWithFilteredResult(_0x17378a,_0x2e5635))['catch'](handleError(_0x17378a,null));};exports[_0xd4d8('0x7b')]=function(_0x94b0b4,_0x27797e){var _0x3a4602=_0x94b0b4['params']['id'];var _0x26d97a=_0x94b0b4[_0xd4d8('0x5d')];var _0x2a092e=0xc8;var _0x556a53=null;return db['sequelize'][_0xd4d8('0x7c')]({'isolationLevel':db[_0xd4d8('0x7d')]['Transaction'][_0xd4d8('0x7e')][_0xd4d8('0x7f')]},function(_0x4b8d24){return db[_0xd4d8('0x41')][_0xd4d8('0x72')]({'where':{'id':_0x3a4602},'transaction':_0x4b8d24})[_0xd4d8('0x37')](function(_0x1abf2b){if(_0x1abf2b){return db[_0xd4d8('0x80')]['destroy']({'where':{'FaxAccountId':_0x3a4602},'transaction':_0x4b8d24})['then'](function(){var _0xe698d7=_[_0xd4d8('0x40')](_0x26d97a,function(_0x49161b){_0x49161b[_0xd4d8('0x6c')]=_0x3a4602;return _0x49161b;});return db[_0xd4d8('0x80')][_0xd4d8('0x81')](_0xe698d7,{'transaction':_0x4b8d24});});}else{_0x2a092e=0x194;_0x556a53=[];}});})[_0xd4d8('0x37')](function(){if(_0x2a092e!==0x194){return db['FaxApplication']['findAndCountAll']({'where':{'FaxAccountId':_0x3a4602},'order':_0xd4d8('0x82')})[_0xd4d8('0x37')](function(_0x51c6e2){_0x556a53=_0x51c6e2;});}})[_0xd4d8('0x2a')](function(_0x411350){_0x2a092e=0x1f4;logger['error'](_0x411350['stack']);if(_0x411350['name']){delete _0x411350[_0xd4d8('0x3c')];}_0x556a53=_0x411350;})[_0xd4d8('0x83')](function(){if(_0x556a53===null){_0x27797e[_0xd4d8('0x2b')](_0x2a092e);}else{if(_0x2a092e===0x1f4){_0x27797e[_0xd4d8('0x2c')](_0x2a092e)[_0xd4d8('0x3d')](_0x556a53);}else{_0x27797e['status'](_0x2a092e)[_0xd4d8('0x2d')](_0x556a53);}}});};exports[_0xd4d8('0x84')]=function(_0x124bc4,_0x1c5d39,_0x49b7eb){var _0x65c6a3={};var _0x20b13c={};var _0x5ea9ce;var _0x3f643e;return db['FaxAccount'][_0xd4d8('0x72')]({'where':{'id':_0x124bc4[_0xd4d8('0x57')]['id']}})[_0xd4d8('0x37')](handleEntityNotFound(_0x1c5d39,null))[_0xd4d8('0x37')](function(_0x832c7){if(_0x832c7){_0x5ea9ce=_0x832c7;_0x20b13c['model']=_[_0xd4d8('0x46')](db[_0xd4d8('0x80')][_0xd4d8('0x59')]);_0x20b13c['query']=_[_0xd4d8('0x46')](_0x124bc4[_0xd4d8('0x45')]);_0x20b13c['filters']=_[_0xd4d8('0x48')](_0x20b13c[_0xd4d8('0x44')],_0x20b13c['query']);_0x65c6a3[_0xd4d8('0x49')]=_[_0xd4d8('0x48')](_0x20b13c[_0xd4d8('0x44')],qs[_0xd4d8('0x4a')](_0x124bc4['query'][_0xd4d8('0x4a')]));_0x65c6a3[_0xd4d8('0x49')]=_0x65c6a3[_0xd4d8('0x49')]['length']?_0x65c6a3['attributes']:_0x20b13c['model'];_0x65c6a3[_0xd4d8('0x4c')]=qs[_0xd4d8('0x4d')](_0x124bc4[_0xd4d8('0x45')][_0xd4d8('0x4d')]);_0x65c6a3['where']=qs['filters'](_['pick'](_0x124bc4[_0xd4d8('0x45')],_0x20b13c[_0xd4d8('0x47')]));if(_0x124bc4['query'][_0xd4d8('0x50')]){_0x65c6a3[_0xd4d8('0x4e')]=_[_0xd4d8('0x51')](_0x65c6a3[_0xd4d8('0x4e')],{'$or':_['map'](_0x65c6a3[_0xd4d8('0x49')],function(_0xf52afc){var _0x185fb8={};_0x185fb8[_0xf52afc]={'$like':'%'+_0x124bc4['query']['filter']+'%'};return _0x185fb8;})});}_0x65c6a3=_[_0xd4d8('0x51')]({},_0x65c6a3,_0x124bc4[_0xd4d8('0x5a')]);return _0x5ea9ce[_0xd4d8('0x84')](_0x65c6a3);}})[_0xd4d8('0x37')](function(_0x36592b){if(_0x36592b){_0x3f643e=_0x36592b['length'];if(!_0x124bc4['query'][_0xd4d8('0x68')]('nolimit')){_0x65c6a3[_0xd4d8('0x30')]=qs[_0xd4d8('0x30')](_0x124bc4['query'][_0xd4d8('0x30')]);_0x65c6a3[_0xd4d8('0x2e')]=qs[_0xd4d8('0x2e')](_0x124bc4['query']['offset']);}return _0x5ea9ce[_0xd4d8('0x84')](_0x65c6a3);}})['then'](function(_0x4332cc){if(_0x4332cc){return _0x4332cc?{'count':_0x3f643e,'rows':_0x4332cc}:null;}})[_0xd4d8('0x37')](respondWithResult(_0x1c5d39,null))[_0xd4d8('0x2a')](handleError(_0x1c5d39,null));};function Extension(_0x37c9,_0x370532,_0x36a466,_0x3454d1){this['context']='from-voip-provider';this['exten']=_0x37c9[_0xd4d8('0x85')];this[_0xd4d8('0x86')]=_0x3454d1;this[_0xd4d8('0x43')]=_0xd4d8('0x87');this[_0xd4d8('0x88')]=_0xd4d8('0x89');this[_0xd4d8('0x6c')]=_0x37c9['id'];this[_0xd4d8('0x82')]=_0x370532;this[_0xd4d8('0x8a')]=_0x36a466;}function createExtensionsReciveFax(_0x4a7d17){var _0x41fb15=0x1;var _0x1f9308=[];_0x1f9308[_0xd4d8('0x8b')](new Extension(_0x4a7d17,_0x41fb15,'',_0xd4d8('0x8c')));_0x41fb15+=0x1;_0x1f9308[_0xd4d8('0x8b')](new Extension(_0x4a7d17,_0x41fb15,_0xd4d8('0x8d'),_0xd4d8('0x8e')));_0x41fb15+=0x1;for(var _0x4f5d52 in _0x4a7d17){if(_0x4a7d17[_0xd4d8('0x68')](_0x4f5d52)&&(_0x4f5d52===_0xd4d8('0x8f')||_0x4f5d52==='localstationid'||_0x4f5d52==='gateway'||_0x4f5d52===_0xd4d8('0x90')||_0x4f5d52==='headerinfo'||_0x4f5d52===_0xd4d8('0x91')||_0x4f5d52===_0xd4d8('0x92')||_0x4f5d52==='modem'||_0x4f5d52===_0xd4d8('0x93'))){_0x1f9308[_0xd4d8('0x8b')](new Extension(_0x4a7d17,_0x41fb15,_0xd4d8('0x94')+_0x4f5d52+')='+_0x4a7d17[_0x4f5d52],_0xd4d8('0x8e')));_0x41fb15+=0x1;}}_0x1f9308['push'](new Extension(_0x4a7d17,_0x41fb15,'6',_0xd4d8('0x95')));_0x41fb15+=0x1;_0x1f9308[_0xd4d8('0x8b')](new Extension(_0x4a7d17,_0x41fb15,_0xd4d8('0x96'),_0xd4d8('0x97')));_0x41fb15=0x0;return _0x1f9308;}exports['addAccountApplications']=function(_0x3804bf,_0x219141,_0x467dc0){var _0x30a342;return db['sequelize'][_0xd4d8('0x7c')](function(_0xbe7252){return db[_0xd4d8('0x41')]['create'](_0x3804bf[_0xd4d8('0x5d')],{'transaction':_0xbe7252})['then'](function(_0x2f59e0){_0x30a342=_0x2f59e0[_0xd4d8('0x39')]({'plain':!![]});return db['VoiceExtension'][_0xd4d8('0x81')](createExtensionsReciveFax(_0x30a342),{'transaction':_0xbe7252});});})['then'](function(){return _0x30a342;})[_0xd4d8('0x37')](respondWithResult(_0x219141,null))['catch'](handleError(_0x219141,null));};exports[_0xd4d8('0x98')]=function(_0x32435d,_0x11e616,_0x462cc8){var _0x41db61;return db[_0xd4d8('0x7d')][_0xd4d8('0x7c')](function(_0x184c32){return db[_0xd4d8('0x41')][_0xd4d8('0x36')](_0x32435d[_0xd4d8('0x5d')],{'where':{'id':_0x32435d['body']['id']},'transaction':_0x184c32})[_0xd4d8('0x37')](function(_0xb12938){return db['VoiceExtension'][_0xd4d8('0x38')]({'where':{'FaxAccountId':_0x32435d[_0xd4d8('0x5d')]['id']},'transaction':_0x184c32})['then'](function(_0x212107){return db[_0xd4d8('0x99')][_0xd4d8('0x81')](createExtensionsReciveFax(_[_0xd4d8('0x9a')](_0x32435d[_0xd4d8('0x5d')],[_0xd4d8('0x9b'),_0xd4d8('0x9c'),_0xd4d8('0x9d'),_0xd4d8('0x9e'),_0xd4d8('0x9f'),'ListId'])),{'transaction':_0x184c32});});});})['then'](function(){return db[_0xd4d8('0x41')]['findById'](_0x32435d[_0xd4d8('0x5d')]['id']);})[_0xd4d8('0x37')](respondWithResult(_0x11e616,null))['catch'](handleError(_0x11e616,null));};exports[_0xd4d8('0xa0')]=function(_0xf0039d,_0x48e57f,_0x10229a){var _0x3adff4={'raw':!![],'where':{}};var _0x382590={};var _0x1c6ea7={'count':0x0,'rows':[]};return db[_0xd4d8('0x41')]['findOne']({'where':{'id':_0xf0039d[_0xd4d8('0x57')]['id']}})[_0xd4d8('0x37')](handleEntityNotFound(_0x48e57f,null))[_0xd4d8('0x37')](function(_0x5c9e19){if(_0x5c9e19){_0x382590[_0xd4d8('0x44')]=_[_0xd4d8('0x46')](db[_0xd4d8('0xa1')][_0xd4d8('0x59')]);_0x382590['query']=_[_0xd4d8('0x46')](_0xf0039d['query']);_0x382590[_0xd4d8('0x47')]=_[_0xd4d8('0x48')](_0x382590[_0xd4d8('0x44')],_0x382590['query']);_0x3adff4['attributes']=_[_0xd4d8('0x48')](_0x382590[_0xd4d8('0x44')],qs[_0xd4d8('0x4a')](_0xf0039d[_0xd4d8('0x45')][_0xd4d8('0x4a')]));_0x3adff4['attributes']=_0x3adff4[_0xd4d8('0x49')]['length']?_0x3adff4[_0xd4d8('0x49')]:_0x382590['model'];if(!_0xf0039d[_0xd4d8('0x45')][_0xd4d8('0x68')](_0xd4d8('0x69'))){_0x3adff4['limit']=qs[_0xd4d8('0x30')](_0xf0039d['query']['limit']);_0x3adff4[_0xd4d8('0x2e')]=qs[_0xd4d8('0x2e')](_0xf0039d[_0xd4d8('0x45')]['offset']);}_0x3adff4[_0xd4d8('0x4c')]=qs[_0xd4d8('0x4d')](_0xf0039d[_0xd4d8('0x45')][_0xd4d8('0x4d')]);_0x3adff4[_0xd4d8('0x4e')]=qs['filters'](_[_0xd4d8('0x4f')](_0xf0039d[_0xd4d8('0x45')],_0x382590[_0xd4d8('0x47')]));_0x3adff4[_0xd4d8('0x4e')][_0xd4d8('0x6c')]=_0x5c9e19['id'];if(_0xf0039d[_0xd4d8('0x45')][_0xd4d8('0x50')]){_0x3adff4[_0xd4d8('0x4e')]=_[_0xd4d8('0x51')](_0x3adff4[_0xd4d8('0x4e')],{'$or':_[_0xd4d8('0x40')](_0x3adff4['attributes'],function(_0x4199bb){var _0x2e6a55={};_0x2e6a55[_0x4199bb]={'$like':'%'+_0xf0039d[_0xd4d8('0x45')][_0xd4d8('0x50')]+'%'};return _0x2e6a55;})});}if(_0xf0039d[_0xd4d8('0x45')][_0xd4d8('0xa2')]){var _0x451f3a=_0xf0039d[_0xd4d8('0x45')]['$gte'][_0xd4d8('0xa3')](',');var _0x851334={};_0x851334[_0x451f3a[0x0]]={'$gte':moment(_0x451f3a[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x3adff4[_0xd4d8('0x4e')]=_[_0xd4d8('0x51')](_0x3adff4[_0xd4d8('0x4e')],_0x851334);}_0x3adff4=_['merge']({},_0x3adff4,_0xf0039d['options']);return db['FaxMessage'][_0xd4d8('0x31')]({'where':_0x3adff4[_0xd4d8('0x4e')]})[_0xd4d8('0x37')](function(_0x539ad6){_0x1c6ea7[_0xd4d8('0x31')]=_0x539ad6;if(_0xf0039d['query'][_0xd4d8('0x53')]){_0x3adff4[_0xd4d8('0x54')]=[{'all':!![]}];}return db['FaxMessage']['findAll'](_0x3adff4);})[_0xd4d8('0x37')](function(_0x1bd9bf){_0x1c6ea7[_0xd4d8('0x56')]=_0x1bd9bf;return _0x1c6ea7;});}})[_0xd4d8('0x37')](respondWithFilteredResult(_0x48e57f,_0x3adff4))[_0xd4d8('0x2a')](handleError(_0x48e57f,null));};exports[_0xd4d8('0x3d')]=function(_0x5a79f6,_0x33104c,_0x4e9a31){var _0x1e6268,_0x17b2f9={},_0x2b1ddf;if(_0x5a79f6[_0xd4d8('0x5d')]['to']){_0x2b1ddf=_0x5a79f6[_0xd4d8('0x5d')]['to'][0x0];}return db[_0xd4d8('0x41')][_0xd4d8('0x5b')]({'where':{'id':_0x5a79f6[_0xd4d8('0x57')]['id']},'include':[{'model':db[_0xd4d8('0xa4')],'as':'List','include':[{'model':db[_0xd4d8('0x73')],'as':_0xd4d8('0xa5'),'where':{'fax':_0x2b1ddf},'limit':0x1,'order':[['updatedAt','DESC']]}]}]})[_0xd4d8('0x37')](handleEntityNotFound(_0x33104c,null))[_0xd4d8('0x37')](function(_0x5e58ac){_0x1e6268=_0x5e58ac;if(_0x5a79f6[_0xd4d8('0x5d')][_0xd4d8('0xa6')]&&_0x5a79f6[_0xd4d8('0x5d')][_0xd4d8('0xa6')]['length']){for(var _0x474080=0x0;_0x474080<_0x5a79f6['body'][_0xd4d8('0xa6')]['length'];_0x474080+=0x1){_0x5a79f6[_0xd4d8('0x5d')][_0xd4d8('0xa6')][_0x474080]={'filename':_0x5a79f6[_0xd4d8('0x5d')][_0xd4d8('0xa6')][_0x474080][_0xd4d8('0x3c')],'id':_0x5a79f6[_0xd4d8('0x5d')]['attachments'][_0x474080]['id'],'path':path[_0xd4d8('0xa7')](config[_0xd4d8('0xa8')],_0xd4d8('0xa9'),_0x5a79f6[_0xd4d8('0x5d')][_0xd4d8('0xa6')][_0x474080]['basename'])};}}return respondWithRpcPromise(_0xd4d8('0xaa'),_0xd4d8('0xaa'),{'FaxAccountId':_[_0xd4d8('0xab')](_0x5a79f6[_0xd4d8('0x57')]['id'])?undefined:_0x5a79f6[_0xd4d8('0x57')]['id'],'path':_['isNil'](_0x5a79f6['body'][_0xd4d8('0xa6')][0x0][_0xd4d8('0xac')])?undefined:_0x5a79f6[_0xd4d8('0x5d')][_0xd4d8('0xa6')][0x0][_0xd4d8('0xac')],'fax':_['isNil'](_0x5a79f6[_0xd4d8('0x5d')]['to'][0x0])?undefined:_0x5a79f6['body']['to'][0x0]},client9002);})[_0xd4d8('0x37')](function(){if(_0x1e6268){if(_['isNil'](_0x5a79f6[_0xd4d8('0x5d')]['from'])){_0x5a79f6[_0xd4d8('0x5d')][_0xd4d8('0xad')]=util[_0xd4d8('0xae')](_0xd4d8('0xaf'),_0x1e6268[_0xd4d8('0x3c')],_0x1e6268[_0xd4d8('0xb0')]);}if(_0x1e6268[_0xd4d8('0xb1')]){if(_0x1e6268[_0xd4d8('0xb1')][_0xd4d8('0xa5')][_0xd4d8('0x4b')]){return _0x1e6268['List'][_0xd4d8('0xa5')][0x0];}else{return db[_0xd4d8('0x73')][_0xd4d8('0x5c')](_[_0xd4d8('0x1a')](_0x5a79f6[_0xd4d8('0x5d')],{'firstName':_0x5a79f6[_0xd4d8('0x5d')]['to'][0x0],'phone':_0x5a79f6[_0xd4d8('0x5d')]['to'][0x0],'fax':_0x5a79f6[_0xd4d8('0x5d')]['to'][0x0],'ListId':_0x1e6268['ListId']}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error(_0xd4d8('0xb2'));}})['then'](function(_0x23192f){if(_0x23192f){return db[_0xd4d8('0x71')][_0xd4d8('0x5b')]({'where':{'ContactId':_0x23192f['id'],'closed':![],'FaxAccountId':_0x1e6268['id']}})[_0xd4d8('0x37')](function(_0x49baf2){if(_0x49baf2){return[_0x49baf2,![]];}return db[_0xd4d8('0x71')][_0xd4d8('0x5c')]({'UserId':_0x5a79f6[_0xd4d8('0xb3')]['id'],'ContactId':_0x23192f['id'],'FaxAccountId':_0x1e6268['id'],'fax':_0x5a79f6[_0xd4d8('0x5d')]['to'][0x0],'firstMsgDirection':_0xd4d8('0xb4'),'Messages':[_[_0xd4d8('0x51')](_0x5a79f6[_0xd4d8('0x5d')],{'read':![],'body':_0x5a79f6[_0xd4d8('0x5d')]['attachments'][0x0][_0xd4d8('0xb5')],'FaxAccountId':_0x1e6268['id'],'UserId':_0x5a79f6[_0xd4d8('0xb3')]['id'],'ContactId':_0x23192f['id'],'AttachmentId':_0x5a79f6[_0xd4d8('0x5d')][_0xd4d8('0xa6')][0x0]['id']})]},{'include':[{'model':db[_0xd4d8('0xa1')],'as':_0xd4d8('0xb6')}]})['then'](function(_0x375ad2){return[_0x375ad2,!![]];});});}else{throw new Error(_0xd4d8('0xb7'));}})[_0xd4d8('0xb8')](function(_0x33f2a0,_0x5e0a4b){if(_0x5e0a4b){return _0x33f2a0;}return db[_0xd4d8('0xa1')][_0xd4d8('0x5c')]({'direction':'out','read':![],'body':_0x5a79f6[_0xd4d8('0x5d')][_0xd4d8('0xa6')][0x0][_0xd4d8('0xb5')],'FaxAccountId':_0x1e6268['id'],'FaxInteractionId':_0x33f2a0['id'],'UserId':_0x5a79f6[_0xd4d8('0xb3')]['id'],'ContactId':_0x33f2a0[_0xd4d8('0xb9')],'AttachmentId':_0x5a79f6[_0xd4d8('0x5d')][_0xd4d8('0xa6')][0x0]['id']})[_0xd4d8('0x37')](function(_0x5a5278){_0x33f2a0[_0xd4d8('0xba')]['Messages']=[];_0x33f2a0[_0xd4d8('0xba')][_0xd4d8('0xb6')][_0xd4d8('0x8b')](_0x5a5278[_0xd4d8('0xba')]);return _0x33f2a0;});})[_0xd4d8('0x37')](function(_0x50e8ac){respondWithRpcPromise(_0xd4d8('0xbb'),_0xd4d8('0xbb'),{'FaxAccountId':_['isNil'](_0x5a79f6['params']['id'])?undefined:_0x5a79f6[_0xd4d8('0x57')]['id'],'path':_['isNil'](_0x5a79f6[_0xd4d8('0x5d')]['attachments'][0x0]['path'])?undefined:_0x5a79f6[_0xd4d8('0x5d')][_0xd4d8('0xa6')][0x0][_0xd4d8('0xac')],'fax':_['isNil'](_0x5a79f6[_0xd4d8('0x5d')]['to'][0x0])?undefined:_0x5a79f6[_0xd4d8('0x5d')]['to'][0x0],'AttachmentId':_0x5a79f6[_0xd4d8('0x5d')][_0xd4d8('0xa6')][0x0]['id']},client9002)[_0xd4d8('0x37')](function(_0x3911be){logger[_0xd4d8('0x22')](_0xd4d8('0xbc'),_0x3911be);})['catch'](function(_0x8c095c){logger[_0xd4d8('0x22')](_0xd4d8('0xbc'),_0x8c095c);});return _0x50e8ac;})[_0xd4d8('0x37')](respondWithResult(_0x33104c,null))[_0xd4d8('0x2a')](handleError(_0x33104c,null));};exports[_0xd4d8('0xbd')]=function(_0x2a4028,_0xcf5e1d,_0xab56bc){return db[_0xd4d8('0x41')][_0xd4d8('0x5b')]({'where':{'id':_0x2a4028['params']['id']}})[_0xd4d8('0x37')](handleEntityNotFound(_0xcf5e1d,null))[_0xd4d8('0x37')](function(_0xf5efc2){if(_0xf5efc2){return _0xf5efc2[_0xd4d8('0xbd')](_0x2a4028[_0xd4d8('0x5d')][_0xd4d8('0x6f')],_[_0xd4d8('0x9a')](_0x2a4028[_0xd4d8('0x5d')],[_0xd4d8('0x6f'),'id'])||{})['spread'](function(_0x1466ee){for(var _0x160fc7=0x0;_0x160fc7<_0x2a4028[_0xd4d8('0x5d')][_0xd4d8('0x6f')][_0xd4d8('0x4b')];_0x160fc7+=0x1){socket[_0xd4d8('0xbe')](_0xd4d8('0xbf'),{'UserId':Number(_0x2a4028['body'][_0xd4d8('0x6f')][_0x160fc7]),'FaxAccountId':Number(_0x2a4028['params']['id'])});}return _0x1466ee;});}})[_0xd4d8('0x37')](respondWithResult(_0xcf5e1d,null))[_0xd4d8('0x2a')](handleError(_0xcf5e1d,null));};exports[_0xd4d8('0xc0')]=function(_0x5685ad,_0x13be33,_0x5ab6d5){return db[_0xd4d8('0x41')]['find']({'where':{'id':_0x5685ad[_0xd4d8('0x57')]['id']}})[_0xd4d8('0x37')](handleEntityNotFound(_0x13be33,null))[_0xd4d8('0x37')](function(_0x398353){if(_0x398353){return _0x398353[_0xd4d8('0xc0')](_0x5685ad[_0xd4d8('0x45')][_0xd4d8('0x6f')])[_0xd4d8('0x37')](function(){if(_[_0xd4d8('0xc1')](_0x5685ad['query'][_0xd4d8('0x6f')])){for(var _0x48d08d=0x0;_0x48d08d<_0x5685ad[_0xd4d8('0x45')][_0xd4d8('0x6f')][_0xd4d8('0x4b')];_0x48d08d+=0x1){socket[_0xd4d8('0xbe')](_0xd4d8('0xc2'),{'UserId':Number(_0x5685ad[_0xd4d8('0x45')]['ids'][_0x48d08d]),'FaxAccountId':Number(_0x5685ad['params']['id'])});}}else{socket[_0xd4d8('0xbe')]('userFaxAccount:remove',{'UserId':Number(_0x5685ad[_0xd4d8('0x45')]['ids']),'FaxAccountId':Number(_0x5685ad[_0xd4d8('0x57')]['id'])});}});}})[_0xd4d8('0x37')](respondWithStatusCode(_0x13be33,null))[_0xd4d8('0x2a')](handleError(_0x13be33,null));};exports[_0xd4d8('0xc3')]=function(_0x128f0d,_0x4e788c,_0x3ab01a){var _0x30df7={};var _0xc6a696={};var _0x4918a3;var _0x1d7b3b;return db['FaxAccount']['findOne']({'where':{'id':_0x128f0d[_0xd4d8('0x57')]['id']}})[_0xd4d8('0x37')](handleEntityNotFound(_0x4e788c,null))[_0xd4d8('0x37')](function(_0x4d3e08){if(_0x4d3e08){_0x4918a3=_0x4d3e08;_0xc6a696[_0xd4d8('0x44')]=_[_0xd4d8('0x46')](db['User'][_0xd4d8('0x59')]);_0xc6a696[_0xd4d8('0x45')]=_['keys'](_0x128f0d[_0xd4d8('0x45')]);_0xc6a696[_0xd4d8('0x47')]=_[_0xd4d8('0x48')](_0xc6a696[_0xd4d8('0x44')],_0xc6a696[_0xd4d8('0x45')]);_0x30df7[_0xd4d8('0x49')]=_[_0xd4d8('0x48')](_0xc6a696['model'],qs[_0xd4d8('0x4a')](_0x128f0d[_0xd4d8('0x45')]['fields']));_0x30df7[_0xd4d8('0x49')]=_0x30df7[_0xd4d8('0x49')]['length']?_0x30df7['attributes']:_0xc6a696[_0xd4d8('0x44')];_0x30df7[_0xd4d8('0x4c')]=qs['sort'](_0x128f0d[_0xd4d8('0x45')][_0xd4d8('0x4d')]);_0x30df7[_0xd4d8('0x4e')]=qs['filters'](_[_0xd4d8('0x4f')](_0x128f0d[_0xd4d8('0x45')],_0xc6a696['filters']));if(_0x128f0d[_0xd4d8('0x45')][_0xd4d8('0x50')]){_0x30df7['where']=_[_0xd4d8('0x51')](_0x30df7[_0xd4d8('0x4e')],{'$or':_['map'](_0x30df7[_0xd4d8('0x49')],function(_0x2634dc){var _0x374c15={};_0x374c15[_0x2634dc]={'$like':'%'+_0x128f0d[_0xd4d8('0x45')][_0xd4d8('0x50')]+'%'};return _0x374c15;})});}_0x30df7=_[_0xd4d8('0x51')]({},_0x30df7,_0x128f0d[_0xd4d8('0x5a')]);return _0x4918a3[_0xd4d8('0xc3')](_0x30df7);}})[_0xd4d8('0x37')](function(_0x631894){if(_0x631894){_0x1d7b3b=_0x631894['length'];if(!_0x128f0d['query'][_0xd4d8('0x68')]('nolimit')){_0x30df7[_0xd4d8('0x30')]=qs[_0xd4d8('0x30')](_0x128f0d['query'][_0xd4d8('0x30')]);_0x30df7[_0xd4d8('0x2e')]=qs[_0xd4d8('0x2e')](_0x128f0d[_0xd4d8('0x45')][_0xd4d8('0x2e')]);}return _0x4918a3['getAgents'](_0x30df7);}})[_0xd4d8('0x37')](function(_0x5e710a){if(_0x5e710a){return _0x5e710a?{'count':_0x1d7b3b,'rows':_0x5e710a}:null;}})[_0xd4d8('0x37')](respondWithResult(_0x4e788c,null))['catch'](handleError(_0x4e788c,null));}; \ No newline at end of file +var _0xc9a5=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','defaults','socket.io-emitter','register','jayson/promise','client','http','request','then','debug','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','FaxAccount,\x20%s,\x20%s','message','info','result','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','destroy','get','UserProfileResource','stack','name','send','Pause','mandatoryDispositionPause','FaxAccount','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','rows','catch','show','params','includeAll','include','create','body','user','role','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','Disposition','FaxAccountId','map','findAll','removeDispositions','ids','addAnswer','getAnswers','findOne','CannedAnswer','length','removeAnswers','addInteraction','getInteractions','FaxInteraction','pick','CmContact','Contact','Owner','internal','Tags','color','tag','addApplications','sequelize','Transaction','ISOLATION_LEVELS','bulkCreate','findAndCountAll','priority','finally','FaxApplication','getApplications','localstationid','app','system','Fax\x20Extension','appdata','push','CDR(type)=inbound-fax','Set','ecm','gateway','faxdetect','headerinfo','maxrate','minrate','modem','transaction','VoiceExtension','updateAccountApplications','tech','updatedAt','ListId','findById','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','List','Contacts','DESC','attachments','server/files/attachments','basename','CheckAfterSend','isNil','from','List\x20not\x20found','Send\x20Fax\x20failed','Messages','Contact\x20not\x20found','spread','filename','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','omit','emit','removeAgents','userFaxAccount:remove','getAgents','User','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x4214da,_0x586705){var _0x64da0=function(_0x273e00){while(--_0x273e00){_0x4214da['push'](_0x4214da['shift']());}};_0x64da0(++_0x586705);}(_0xc9a5,0xa6));var _0x5c9a=function(_0x47a16a,_0x5396df){_0x47a16a=_0x47a16a-0x0;var _0x2f88c0=_0xc9a5[_0x47a16a];return _0x2f88c0;};'use strict';var emlformat=require(_0x5c9a('0x0'));var rimraf=require(_0x5c9a('0x1'));var zipdir=require(_0x5c9a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5c9a('0x3'));var moment=require(_0x5c9a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x5c9a('0x5'));var util=require('util');var path=require(_0x5c9a('0x6'));var sox=require(_0x5c9a('0x7'));var csv=require(_0x5c9a('0x8'));var ejs=require(_0x5c9a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5c9a('0xa'));var squel=require(_0x5c9a('0xb'));var crypto=require(_0x5c9a('0xc'));var jsforce=require(_0x5c9a('0xd'));var deskjs=require(_0x5c9a('0xe'));var toCsv=require('to-csv');var querystring=require(_0x5c9a('0xf'));var Papa=require(_0x5c9a('0x10'));var Redis=require(_0x5c9a('0x11'));var authService=require(_0x5c9a('0x12'));var qs=require(_0x5c9a('0x13'));var as=require(_0x5c9a('0x14'));var hardwareService=require(_0x5c9a('0x15'));var logger=require('../../config/logger')(_0x5c9a('0x16'));var utils=require(_0x5c9a('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5c9a('0x18'))['db'];config[_0x5c9a('0x19')]=_[_0x5c9a('0x1a')](config[_0x5c9a('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x5c9a('0x1b'))(new Redis(config[_0x5c9a('0x19')]));require('./faxAccount.socket')[_0x5c9a('0x1c')](socket);var jayson=require(_0x5c9a('0x1d'));var client=jayson[_0x5c9a('0x1e')][_0x5c9a('0x1f')]({'port':0x232c});var client9002=jayson['client'][_0x5c9a('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x580f91,_0x3bba3a,_0x16927e,_0x39fead){return new BPromise(function(_0x2416f3,_0x593384){var _0x5061b4=_0x39fead||client;return _0x5061b4[_0x5c9a('0x20')](_0x580f91,_0x16927e)[_0x5c9a('0x21')](function(_0x2ff721){logger['info']('FaxAccount,\x20%s,\x20%s',_0x3bba3a,'request\x20sent');logger[_0x5c9a('0x22')](_0x5c9a('0x23'),_0x3bba3a,_0x5c9a('0x24'),JSON[_0x5c9a('0x25')](_0x2ff721));if(_0x2ff721['error']){if(_0x2ff721[_0x5c9a('0x26')]['code']===0x1f4){logger[_0x5c9a('0x26')](_0x5c9a('0x27'),_0x3bba3a,_0x2ff721[_0x5c9a('0x26')][_0x5c9a('0x28')]);return _0x593384(_0x2ff721[_0x5c9a('0x26')][_0x5c9a('0x28')]);}logger[_0x5c9a('0x26')](_0x5c9a('0x27'),_0x3bba3a,_0x2ff721[_0x5c9a('0x26')][_0x5c9a('0x28')]);return _0x2416f3(_0x2ff721[_0x5c9a('0x26')][_0x5c9a('0x28')]);}else{logger[_0x5c9a('0x29')](_0x5c9a('0x27'),_0x3bba3a,'request\x20sent');_0x2416f3(_0x2ff721[_0x5c9a('0x2a')][_0x5c9a('0x28')]);}})['catch'](function(_0x561190){logger[_0x5c9a('0x26')](_0x5c9a('0x27'),_0x3bba3a,_0x561190);_0x593384(_0x561190);});});}function respondWithStatusCode(_0x36abe4,_0x4a8af4){_0x4a8af4=_0x4a8af4||0xcc;return function(_0x59eb7e){if(_0x59eb7e){return _0x36abe4[_0x5c9a('0x2b')](_0x4a8af4);}return _0x36abe4[_0x5c9a('0x2c')](_0x4a8af4)[_0x5c9a('0x2d')]();};}function respondWithResult(_0x1ba482,_0x52c4fb){_0x52c4fb=_0x52c4fb||0xc8;return function(_0x4a97c9){if(_0x4a97c9){return _0x1ba482[_0x5c9a('0x2c')](_0x52c4fb)[_0x5c9a('0x2e')](_0x4a97c9);}};}function respondWithFilteredResult(_0x45a0d0,_0x4012ff){return function(_0x3f1785){if(_0x3f1785){var _0x9937ea=typeof _0x4012ff[_0x5c9a('0x2f')]===_0x5c9a('0x30')&&typeof _0x4012ff[_0x5c9a('0x31')]===_0x5c9a('0x30');var _0x3cc194=_0x3f1785['count'];var _0x239a48=_0x9937ea?0x0:_0x4012ff[_0x5c9a('0x2f')];var _0x44bd62=_0x9937ea?_0x3f1785[_0x5c9a('0x32')]:_0x4012ff[_0x5c9a('0x2f')]+_0x4012ff[_0x5c9a('0x31')];var _0x2f0c37;if(_0x44bd62>=_0x3cc194){_0x44bd62=_0x3cc194;_0x2f0c37=0xc8;}else{_0x2f0c37=0xce;}_0x45a0d0[_0x5c9a('0x2c')](_0x2f0c37);return _0x45a0d0[_0x5c9a('0x33')]('Content-Range',_0x239a48+'-'+_0x44bd62+'/'+_0x3cc194)[_0x5c9a('0x2e')](_0x3f1785);}return null;};}function patchUpdates(_0x452fb3){return function(_0x243df2){try{jsonpatch[_0x5c9a('0x34')](_0x243df2,_0x452fb3,!![]);}catch(_0x1ddc0e){return BPromise['reject'](_0x1ddc0e);}return _0x243df2[_0x5c9a('0x35')]();};}function saveUpdates(_0x3a459a,_0x4ead01){return function(_0x4b810d){if(_0x4b810d){return _0x4b810d['update'](_0x3a459a)['then'](function(_0x70af7d){return _0x70af7d;});}return null;};}function removeEntity(_0x34a6f2,_0x2a7dc1){return function(_0x2593ad){if(_0x2593ad){return _0x2593ad[_0x5c9a('0x36')]()[_0x5c9a('0x21')](function(){var _0x4c0eec=_0x2593ad[_0x5c9a('0x37')]({'plain':!![]});var _0x57d124='FaxAccounts';return db[_0x5c9a('0x38')][_0x5c9a('0x36')]({'where':{'type':_0x57d124,'resourceId':_0x4c0eec['id']}})['then'](function(){return _0x2593ad;});})['then'](function(){_0x34a6f2[_0x5c9a('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1518d6,_0x4f06c4){return function(_0x571dfb){if(!_0x571dfb){_0x1518d6['sendStatus'](0x194);}return _0x571dfb;};}function handleError(_0x4f2f60,_0x3a553f){_0x3a553f=_0x3a553f||0x1f4;return function(_0x1672dd){logger[_0x5c9a('0x26')](_0x1672dd[_0x5c9a('0x39')]);if(_0x1672dd[_0x5c9a('0x3a')]){delete _0x1672dd[_0x5c9a('0x3a')];}_0x4f2f60['status'](_0x3a553f)[_0x5c9a('0x3b')](_0x1672dd);};}exports['index']=function(_0x257102,_0x156413){var _0x10df13={'include':[{'model':db[_0x5c9a('0x3c')],'as':_0x5c9a('0x3d')}]},_0x435097={},_0x56ed48={'count':0x0,'rows':[]};var _0xfc7dba=_['map'](db[_0x5c9a('0x3e')][_0x5c9a('0x3f')],function(_0x456c69){return{'name':_0x456c69[_0x5c9a('0x40')],'type':_0x456c69[_0x5c9a('0x41')]['key']};});_0x435097[_0x5c9a('0x42')]=_['map'](_0xfc7dba,_0x5c9a('0x3a'));_0x435097['query']=_[_0x5c9a('0x43')](_0x257102[_0x5c9a('0x44')]);_0x435097[_0x5c9a('0x45')]=_[_0x5c9a('0x46')](_0x435097['model'],_0x435097[_0x5c9a('0x44')]);_0x10df13[_0x5c9a('0x47')]=_['intersection'](_0x435097[_0x5c9a('0x42')],qs['fields'](_0x257102[_0x5c9a('0x44')][_0x5c9a('0x48')]));_0x10df13[_0x5c9a('0x47')]=_0x10df13[_0x5c9a('0x47')]['length']?_0x10df13[_0x5c9a('0x47')]:_0x435097['model'];if(!_0x257102[_0x5c9a('0x44')][_0x5c9a('0x49')](_0x5c9a('0x4a'))){_0x10df13[_0x5c9a('0x31')]=qs[_0x5c9a('0x31')](_0x257102[_0x5c9a('0x44')]['limit']);_0x10df13[_0x5c9a('0x2f')]=qs[_0x5c9a('0x2f')](_0x257102[_0x5c9a('0x44')]['offset']);}_0x10df13[_0x5c9a('0x4b')]=qs['sort'](_0x257102[_0x5c9a('0x44')][_0x5c9a('0x4c')]);_0x10df13[_0x5c9a('0x4d')]=qs[_0x5c9a('0x45')](_['pick'](_0x257102[_0x5c9a('0x44')],_0x435097[_0x5c9a('0x45')]),_0xfc7dba);if(_0x257102['query'][_0x5c9a('0x4e')]){_0x10df13[_0x5c9a('0x4d')]=_[_0x5c9a('0x4f')](_0x10df13[_0x5c9a('0x4d')],{'$or':_['map'](_0xfc7dba,function(_0x3784e3){if(_0x3784e3['type']!==_0x5c9a('0x50')){var _0x20852f={};_0x20852f[_0x3784e3[_0x5c9a('0x3a')]]={'$like':'%'+_0x257102[_0x5c9a('0x44')][_0x5c9a('0x4e')]+'%'};return _0x20852f;}})});}_0x10df13=_['merge']({},_0x10df13,_0x257102[_0x5c9a('0x51')]);var _0x4fdd7a={'where':_0x10df13[_0x5c9a('0x4d')]};return db[_0x5c9a('0x3e')]['count'](_0x4fdd7a)[_0x5c9a('0x21')](function(_0x5dd0a7){_0x56ed48[_0x5c9a('0x32')]=_0x5dd0a7;if(_0x257102[_0x5c9a('0x44')]['includeAll']){_0x10df13['include']=[{'all':!![]}];}return db['FaxAccount']['findAll'](_0x10df13);})[_0x5c9a('0x21')](function(_0x4c0882){_0x56ed48[_0x5c9a('0x52')]=_0x4c0882;return _0x56ed48;})['then'](respondWithFilteredResult(_0x156413,_0x10df13))[_0x5c9a('0x53')](handleError(_0x156413,null));};exports[_0x5c9a('0x54')]=function(_0x2323a3,_0x4a124d){var _0x59d7f6={'raw':![],'where':{'id':_0x2323a3[_0x5c9a('0x55')]['id']},'include':[{'model':db[_0x5c9a('0x3c')],'as':_0x5c9a('0x3d')}]},_0x17d551={};_0x17d551[_0x5c9a('0x42')]=_['keys'](db[_0x5c9a('0x3e')]['rawAttributes']);_0x17d551['query']=_[_0x5c9a('0x43')](_0x2323a3[_0x5c9a('0x44')]);_0x17d551[_0x5c9a('0x45')]=_['intersection'](_0x17d551['model'],_0x17d551[_0x5c9a('0x44')]);_0x59d7f6[_0x5c9a('0x47')]=_[_0x5c9a('0x46')](_0x17d551['model'],qs[_0x5c9a('0x48')](_0x2323a3[_0x5c9a('0x44')][_0x5c9a('0x48')]));_0x59d7f6[_0x5c9a('0x47')]=_0x59d7f6[_0x5c9a('0x47')]['length']?_0x59d7f6[_0x5c9a('0x47')]:_0x17d551[_0x5c9a('0x42')];if(_0x2323a3['query'][_0x5c9a('0x56')]){_0x59d7f6[_0x5c9a('0x57')]=[{'all':!![]}];}_0x59d7f6=_[_0x5c9a('0x4f')]({},_0x59d7f6,_0x2323a3[_0x5c9a('0x51')]);return db[_0x5c9a('0x3e')]['find'](_0x59d7f6)[_0x5c9a('0x21')](handleEntityNotFound(_0x4a124d,null))[_0x5c9a('0x21')](respondWithResult(_0x4a124d,null))[_0x5c9a('0x53')](handleError(_0x4a124d,null));};exports['create']=function(_0xf854d7,_0x1cb99c){return db[_0x5c9a('0x3e')][_0x5c9a('0x58')](_0xf854d7[_0x5c9a('0x59')],{})[_0x5c9a('0x21')](function(_0x5f4d11){var _0x1ef392=_0xf854d7[_0x5c9a('0x5a')][_0x5c9a('0x37')]({'plain':!![]});if(!_0x1ef392)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1ef392[_0x5c9a('0x5b')]==='user'){var _0x5f2ce2=_0x5f4d11[_0x5c9a('0x37')]({'plain':!![]});var _0x104656='FaxAccounts';return db['UserProfileSection'][_0x5c9a('0x5c')]({'where':{'name':_0x104656,'userProfileId':_0x1ef392['userProfileId']},'raw':!![]})['then'](function(_0x322a69){if(_0x322a69&&_0x322a69[_0x5c9a('0x5d')]===0x0){return db[_0x5c9a('0x38')]['create']({'name':_0x5f2ce2[_0x5c9a('0x3a')],'resourceId':_0x5f2ce2['id'],'type':_0x322a69['name'],'sectionId':_0x322a69['id']},{})[_0x5c9a('0x21')](function(){return _0x5f4d11;});}else{return _0x5f4d11;}})[_0x5c9a('0x53')](function(_0x48f128){logger[_0x5c9a('0x26')](_0x5c9a('0x5e'),_0x48f128);throw _0x48f128;});}return _0x5f4d11;})[_0x5c9a('0x21')](respondWithResult(_0x1cb99c,0xc9))[_0x5c9a('0x53')](handleError(_0x1cb99c,null));};exports[_0x5c9a('0x5f')]=function(_0x383c05,_0x66c5b4){if(_0x383c05['body']['id']){delete _0x383c05['body']['id'];}return db[_0x5c9a('0x3e')]['find']({'where':{'id':_0x383c05['params']['id']},'include':[{'model':db['Pause'],'as':_0x5c9a('0x3d')}]})[_0x5c9a('0x21')](handleEntityNotFound(_0x66c5b4,null))[_0x5c9a('0x21')](saveUpdates(_0x383c05[_0x5c9a('0x59')],null))[_0x5c9a('0x21')](respondWithResult(_0x66c5b4,null))[_0x5c9a('0x53')](handleError(_0x66c5b4,null));};exports[_0x5c9a('0x36')]=function(_0x113596,_0x5ea86a){return db[_0x5c9a('0x3e')][_0x5c9a('0x5c')]({'where':{'id':_0x113596['params']['id']}})[_0x5c9a('0x21')](handleEntityNotFound(_0x5ea86a,null))[_0x5c9a('0x21')](removeEntity(_0x5ea86a,null))[_0x5c9a('0x53')](handleError(_0x5ea86a,null));};exports[_0x5c9a('0x60')]=function(_0x1c6543,_0x48c4cb){return db[_0x5c9a('0x3e')]['describe']()[_0x5c9a('0x21')](respondWithResult(_0x48c4cb,null))[_0x5c9a('0x53')](handleError(_0x48c4cb,null));};exports[_0x5c9a('0x61')]=function(_0x19c85c,_0x4f89d9,_0x1280e7){if(_0x19c85c[_0x5c9a('0x59')]['id']){delete _0x19c85c[_0x5c9a('0x59')]['id'];}return db['FaxAccount'][_0x5c9a('0x5c')]({'where':{'id':_0x19c85c[_0x5c9a('0x55')]['id']}})[_0x5c9a('0x21')](handleEntityNotFound(_0x4f89d9,null))['then'](function(_0x29049e){if(_0x29049e){_0x19c85c[_0x5c9a('0x59')]['FaxAccountId']=_0x29049e['id'];return db['Disposition']['create'](_0x19c85c[_0x5c9a('0x59')]);}})['then'](respondWithResult(_0x4f89d9,null))[_0x5c9a('0x53')](handleError(_0x4f89d9,null));};exports['getDispositions']=function(_0x479cb1,_0x147e8b,_0x182174){var _0x364d12={'raw':![],'where':{}};var _0x1c3ef5={};var _0x56666d={'count':0x0,'rows':[]};return db[_0x5c9a('0x3e')]['findOne']({'where':{'id':_0x479cb1[_0x5c9a('0x55')]['id']}})[_0x5c9a('0x21')](handleEntityNotFound(_0x147e8b,null))['then'](function(_0x3ad51){if(_0x3ad51){_0x1c3ef5[_0x5c9a('0x42')]=_[_0x5c9a('0x43')](db[_0x5c9a('0x62')]['rawAttributes']);_0x1c3ef5[_0x5c9a('0x44')]=_[_0x5c9a('0x43')](_0x479cb1[_0x5c9a('0x44')]);_0x1c3ef5[_0x5c9a('0x45')]=_[_0x5c9a('0x46')](_0x1c3ef5['model'],_0x1c3ef5['query']);_0x364d12['attributes']=_['intersection'](_0x1c3ef5[_0x5c9a('0x42')],qs[_0x5c9a('0x48')](_0x479cb1[_0x5c9a('0x44')][_0x5c9a('0x48')]));_0x364d12[_0x5c9a('0x47')]=_0x364d12[_0x5c9a('0x47')]['length']?_0x364d12[_0x5c9a('0x47')]:_0x1c3ef5[_0x5c9a('0x42')];if(!_0x479cb1[_0x5c9a('0x44')][_0x5c9a('0x49')](_0x5c9a('0x4a'))){_0x364d12['limit']=qs[_0x5c9a('0x31')](_0x479cb1[_0x5c9a('0x44')][_0x5c9a('0x31')]);_0x364d12[_0x5c9a('0x2f')]=qs['offset'](_0x479cb1[_0x5c9a('0x44')][_0x5c9a('0x2f')]);}_0x364d12[_0x5c9a('0x4b')]=qs[_0x5c9a('0x4c')](_0x479cb1[_0x5c9a('0x44')][_0x5c9a('0x4c')]);_0x364d12['where']=qs[_0x5c9a('0x45')](_['pick'](_0x479cb1[_0x5c9a('0x44')],_0x1c3ef5['filters']));_0x364d12[_0x5c9a('0x4d')][_0x5c9a('0x63')]=_0x3ad51['id'];if(_0x479cb1[_0x5c9a('0x44')][_0x5c9a('0x4e')]){_0x364d12[_0x5c9a('0x4d')]=_[_0x5c9a('0x4f')](_0x364d12[_0x5c9a('0x4d')],{'$or':_[_0x5c9a('0x64')](_0x364d12[_0x5c9a('0x47')],function(_0x5215c9){var _0x5c32de={};_0x5c32de[_0x5215c9]={'$like':'%'+_0x479cb1[_0x5c9a('0x44')][_0x5c9a('0x4e')]+'%'};return _0x5c32de;})});}_0x364d12=_[_0x5c9a('0x4f')]({},_0x364d12,_0x479cb1[_0x5c9a('0x51')]);return db[_0x5c9a('0x62')][_0x5c9a('0x32')]({'where':_0x364d12[_0x5c9a('0x4d')]})['then'](function(_0x11f427){_0x56666d['count']=_0x11f427;if(_0x479cb1['query'][_0x5c9a('0x56')]){_0x364d12[_0x5c9a('0x57')]=[{'all':!![]}];}return db[_0x5c9a('0x62')][_0x5c9a('0x65')](_0x364d12);})[_0x5c9a('0x21')](function(_0x6e2a8b){_0x56666d[_0x5c9a('0x52')]=_0x6e2a8b;return _0x56666d;});}})['then'](respondWithFilteredResult(_0x147e8b,_0x364d12))[_0x5c9a('0x53')](handleError(_0x147e8b,null));};exports[_0x5c9a('0x66')]=function(_0x1121ac,_0x2efe5c,_0x4953bd){return db[_0x5c9a('0x3e')]['find']({'where':{'id':_0x1121ac[_0x5c9a('0x55')]['id']}})[_0x5c9a('0x21')](handleEntityNotFound(_0x2efe5c,null))[_0x5c9a('0x21')](function(_0x9eb62){if(_0x9eb62){return _0x9eb62[_0x5c9a('0x66')](_0x1121ac['query'][_0x5c9a('0x67')]);}})['then'](respondWithStatusCode(_0x2efe5c,null))[_0x5c9a('0x53')](handleError(_0x2efe5c,null));};exports[_0x5c9a('0x68')]=function(_0x5312d6,_0x12174a,_0x518ffd){if(_0x5312d6[_0x5c9a('0x59')]['id']){delete _0x5312d6['body']['id'];}return db[_0x5c9a('0x3e')]['find']({'where':{'id':_0x5312d6[_0x5c9a('0x55')]['id']}})[_0x5c9a('0x21')](handleEntityNotFound(_0x12174a,null))[_0x5c9a('0x21')](function(_0xfcf9ec){if(_0xfcf9ec){_0x5312d6[_0x5c9a('0x59')][_0x5c9a('0x63')]=_0xfcf9ec['id'];return db['CannedAnswer'][_0x5c9a('0x58')](_0x5312d6[_0x5c9a('0x59')]);}})[_0x5c9a('0x21')](respondWithResult(_0x12174a,null))[_0x5c9a('0x53')](handleError(_0x12174a,null));};exports[_0x5c9a('0x69')]=function(_0x9aee91,_0x4f3450,_0x3fc45f){var _0x14e059={'raw':![],'where':{}};var _0xc1efd8={};var _0x3ec46d={'count':0x0,'rows':[]};return db[_0x5c9a('0x3e')][_0x5c9a('0x6a')]({'where':{'id':_0x9aee91[_0x5c9a('0x55')]['id']}})[_0x5c9a('0x21')](handleEntityNotFound(_0x4f3450,null))[_0x5c9a('0x21')](function(_0x132a2c){if(_0x132a2c){_0xc1efd8[_0x5c9a('0x42')]=_[_0x5c9a('0x43')](db[_0x5c9a('0x6b')][_0x5c9a('0x3f')]);_0xc1efd8[_0x5c9a('0x44')]=_[_0x5c9a('0x43')](_0x9aee91['query']);_0xc1efd8[_0x5c9a('0x45')]=_[_0x5c9a('0x46')](_0xc1efd8[_0x5c9a('0x42')],_0xc1efd8['query']);_0x14e059[_0x5c9a('0x47')]=_[_0x5c9a('0x46')](_0xc1efd8[_0x5c9a('0x42')],qs[_0x5c9a('0x48')](_0x9aee91[_0x5c9a('0x44')][_0x5c9a('0x48')]));_0x14e059['attributes']=_0x14e059[_0x5c9a('0x47')][_0x5c9a('0x6c')]?_0x14e059[_0x5c9a('0x47')]:_0xc1efd8[_0x5c9a('0x42')];if(!_0x9aee91[_0x5c9a('0x44')][_0x5c9a('0x49')](_0x5c9a('0x4a'))){_0x14e059['limit']=qs[_0x5c9a('0x31')](_0x9aee91[_0x5c9a('0x44')][_0x5c9a('0x31')]);_0x14e059['offset']=qs[_0x5c9a('0x2f')](_0x9aee91[_0x5c9a('0x44')][_0x5c9a('0x2f')]);}_0x14e059[_0x5c9a('0x4b')]=qs[_0x5c9a('0x4c')](_0x9aee91[_0x5c9a('0x44')][_0x5c9a('0x4c')]);_0x14e059[_0x5c9a('0x4d')]=qs[_0x5c9a('0x45')](_['pick'](_0x9aee91[_0x5c9a('0x44')],_0xc1efd8[_0x5c9a('0x45')]));_0x14e059[_0x5c9a('0x4d')][_0x5c9a('0x63')]=_0x132a2c['id'];if(_0x9aee91['query'][_0x5c9a('0x4e')]){_0x14e059['where']=_[_0x5c9a('0x4f')](_0x14e059[_0x5c9a('0x4d')],{'$or':_['map'](_0x14e059['attributes'],function(_0xa35e56){var _0x1a5014={};_0x1a5014[_0xa35e56]={'$like':'%'+_0x9aee91['query']['filter']+'%'};return _0x1a5014;})});}_0x14e059=_['merge']({},_0x14e059,_0x9aee91[_0x5c9a('0x51')]);return db[_0x5c9a('0x6b')][_0x5c9a('0x32')]({'where':_0x14e059[_0x5c9a('0x4d')]})[_0x5c9a('0x21')](function(_0x120700){_0x3ec46d['count']=_0x120700;if(_0x9aee91['query'][_0x5c9a('0x56')]){_0x14e059['include']=[{'all':!![]}];}return db[_0x5c9a('0x6b')][_0x5c9a('0x65')](_0x14e059);})[_0x5c9a('0x21')](function(_0x98e25c){_0x3ec46d[_0x5c9a('0x52')]=_0x98e25c;return _0x3ec46d;});}})['then'](respondWithFilteredResult(_0x4f3450,_0x14e059))[_0x5c9a('0x53')](handleError(_0x4f3450,null));};exports[_0x5c9a('0x6d')]=function(_0x1bc768,_0x47a4db,_0x2b561c){return db[_0x5c9a('0x3e')][_0x5c9a('0x5c')]({'where':{'id':_0x1bc768['params']['id']}})['then'](handleEntityNotFound(_0x47a4db,null))['then'](function(_0x3ddda4){if(_0x3ddda4){return _0x3ddda4[_0x5c9a('0x6d')](_0x1bc768[_0x5c9a('0x44')][_0x5c9a('0x67')]);}})[_0x5c9a('0x21')](respondWithStatusCode(_0x47a4db,null))['catch'](handleError(_0x47a4db,null));};exports[_0x5c9a('0x6e')]=function(_0x3391b7,_0x3eeee3,_0x49a140){return db['FaxInteraction'][_0x5c9a('0x5c')]({'where':{'id':_0x3391b7['params']['id']}})[_0x5c9a('0x21')](handleEntityNotFound(_0x3eeee3,null))[_0x5c9a('0x21')](function(_0x52af1e){if(_0x52af1e){return _0x52af1e[_0x5c9a('0x6e')](_0x3391b7[_0x5c9a('0x59')][_0x5c9a('0x67')],_['omit'](_0x3391b7[_0x5c9a('0x59')],[_0x5c9a('0x67'),'id'])||{});}})['then'](respondWithResult(_0x3eeee3,null))[_0x5c9a('0x53')](handleError(_0x3eeee3,null));};exports[_0x5c9a('0x6f')]=function(_0x4709d3,_0x4b2ea2,_0x5b6676){var _0x45f943={'raw':![],'where':{}};var _0x3f8cd6={};var _0x553d42={'count':0x0,'rows':[]};return db[_0x5c9a('0x3e')][_0x5c9a('0x6a')]({'where':{'id':_0x4709d3['params']['id']}})[_0x5c9a('0x21')](handleEntityNotFound(_0x4b2ea2,null))[_0x5c9a('0x21')](function(_0x2314d9){if(_0x2314d9){_0x3f8cd6[_0x5c9a('0x42')]=_[_0x5c9a('0x43')](db[_0x5c9a('0x70')]['rawAttributes']);_0x3f8cd6[_0x5c9a('0x44')]=_[_0x5c9a('0x43')](_0x4709d3['query']);_0x3f8cd6[_0x5c9a('0x45')]=_[_0x5c9a('0x46')](_0x3f8cd6[_0x5c9a('0x42')],_0x3f8cd6['query']);_0x45f943['attributes']=_[_0x5c9a('0x46')](_0x3f8cd6[_0x5c9a('0x42')],qs[_0x5c9a('0x48')](_0x4709d3[_0x5c9a('0x44')][_0x5c9a('0x48')]));_0x45f943[_0x5c9a('0x47')]=_0x45f943[_0x5c9a('0x47')][_0x5c9a('0x6c')]?_0x45f943[_0x5c9a('0x47')]:_0x3f8cd6[_0x5c9a('0x42')];if(!_0x4709d3[_0x5c9a('0x44')]['hasOwnProperty'](_0x5c9a('0x4a'))){_0x45f943['limit']=qs['limit'](_0x4709d3['query']['limit']);_0x45f943[_0x5c9a('0x2f')]=qs[_0x5c9a('0x2f')](_0x4709d3[_0x5c9a('0x44')][_0x5c9a('0x2f')]);}_0x45f943[_0x5c9a('0x4b')]=qs['sort'](_0x4709d3['query'][_0x5c9a('0x4c')]);_0x45f943['where']=qs['filters'](_[_0x5c9a('0x71')](_0x4709d3[_0x5c9a('0x44')],_0x3f8cd6[_0x5c9a('0x45')]));_0x45f943['where'][_0x5c9a('0x63')]=_0x2314d9['id'];if(_0x4709d3[_0x5c9a('0x44')][_0x5c9a('0x4e')]){_0x45f943[_0x5c9a('0x4d')]=_['merge'](_0x45f943[_0x5c9a('0x4d')],{'$or':_[_0x5c9a('0x64')](_0x45f943[_0x5c9a('0x47')],function(_0x4295ea){var _0x453cef={};_0x453cef[_0x4295ea]={'$like':'%'+_0x4709d3['query'][_0x5c9a('0x4e')]+'%'};return _0x453cef;})});}_0x45f943=_[_0x5c9a('0x4f')]({},_0x45f943,_0x4709d3[_0x5c9a('0x51')]);return db[_0x5c9a('0x70')][_0x5c9a('0x32')]({'where':_0x45f943[_0x5c9a('0x4d')]})[_0x5c9a('0x21')](function(_0x475920){_0x553d42['count']=_0x475920;if(_0x4709d3[_0x5c9a('0x44')][_0x5c9a('0x56')]){_0x45f943[_0x5c9a('0x57')]=[{'model':db[_0x5c9a('0x72')],'as':_0x5c9a('0x73'),'required':![]},{'model':db['User'],'as':_0x5c9a('0x74'),'attributes':[_0x5c9a('0x3a'),'fullname',_0x5c9a('0x75')],'required':![]},{'model':db['Tag'],'as':_0x5c9a('0x76'),'attributes':['id',_0x5c9a('0x3a'),_0x5c9a('0x77')],'where':_0x4709d3[_0x5c9a('0x44')]['tag']?{'id':_0x4709d3[_0x5c9a('0x44')][_0x5c9a('0x78')]}:undefined,'required':_0x4709d3[_0x5c9a('0x44')]['tag']?!![]:![]}];}return db[_0x5c9a('0x70')][_0x5c9a('0x65')](_0x45f943);})[_0x5c9a('0x21')](function(_0x745e6c){_0x553d42[_0x5c9a('0x52')]=_0x745e6c;return _0x553d42;});}})[_0x5c9a('0x21')](respondWithFilteredResult(_0x4b2ea2,_0x45f943))['catch'](handleError(_0x4b2ea2,null));};exports[_0x5c9a('0x79')]=function(_0xbe4d8d,_0x4f3407){var _0x52e40f=_0xbe4d8d[_0x5c9a('0x55')]['id'];var _0x312a76=_0xbe4d8d[_0x5c9a('0x59')];var _0x1bbf4c=0xc8;var _0x4d71fe=null;return db[_0x5c9a('0x7a')]['transaction']({'isolationLevel':db[_0x5c9a('0x7a')][_0x5c9a('0x7b')][_0x5c9a('0x7c')]['READ_COMMITTED']},function(_0x27079){return db[_0x5c9a('0x3e')]['findOne']({'where':{'id':_0x52e40f},'transaction':_0x27079})[_0x5c9a('0x21')](function(_0x513442){if(_0x513442){return db['FaxApplication'][_0x5c9a('0x36')]({'where':{'FaxAccountId':_0x52e40f},'transaction':_0x27079})[_0x5c9a('0x21')](function(){var _0x26c4ca=_[_0x5c9a('0x64')](_0x312a76,function(_0x256a0f){_0x256a0f[_0x5c9a('0x63')]=_0x52e40f;return _0x256a0f;});return db['FaxApplication'][_0x5c9a('0x7d')](_0x26c4ca,{'transaction':_0x27079});});}else{_0x1bbf4c=0x194;_0x4d71fe=[];}});})[_0x5c9a('0x21')](function(){if(_0x1bbf4c!==0x194){return db['FaxApplication'][_0x5c9a('0x7e')]({'where':{'FaxAccountId':_0x52e40f},'order':_0x5c9a('0x7f')})[_0x5c9a('0x21')](function(_0x337279){_0x4d71fe=_0x337279;});}})[_0x5c9a('0x53')](function(_0x330794){_0x1bbf4c=0x1f4;logger[_0x5c9a('0x26')](_0x330794[_0x5c9a('0x39')]);if(_0x330794[_0x5c9a('0x3a')]){delete _0x330794[_0x5c9a('0x3a')];}_0x4d71fe=_0x330794;})[_0x5c9a('0x80')](function(){if(_0x4d71fe===null){_0x4f3407[_0x5c9a('0x2b')](_0x1bbf4c);}else{if(_0x1bbf4c===0x1f4){_0x4f3407[_0x5c9a('0x2c')](_0x1bbf4c)[_0x5c9a('0x3b')](_0x4d71fe);}else{_0x4f3407[_0x5c9a('0x2c')](_0x1bbf4c)[_0x5c9a('0x2e')](_0x4d71fe);}}});};exports['getApplications']=function(_0xc6f250,_0x25293e,_0x16e853){var _0x3043b7={};var _0x2a5170={};var _0x2424fb;var _0x2592d5;return db[_0x5c9a('0x3e')][_0x5c9a('0x6a')]({'where':{'id':_0xc6f250[_0x5c9a('0x55')]['id']}})[_0x5c9a('0x21')](handleEntityNotFound(_0x25293e,null))[_0x5c9a('0x21')](function(_0x3f372c){if(_0x3f372c){_0x2424fb=_0x3f372c;_0x2a5170['model']=_[_0x5c9a('0x43')](db[_0x5c9a('0x81')]['rawAttributes']);_0x2a5170[_0x5c9a('0x44')]=_['keys'](_0xc6f250[_0x5c9a('0x44')]);_0x2a5170[_0x5c9a('0x45')]=_[_0x5c9a('0x46')](_0x2a5170[_0x5c9a('0x42')],_0x2a5170['query']);_0x3043b7['attributes']=_[_0x5c9a('0x46')](_0x2a5170[_0x5c9a('0x42')],qs[_0x5c9a('0x48')](_0xc6f250[_0x5c9a('0x44')][_0x5c9a('0x48')]));_0x3043b7[_0x5c9a('0x47')]=_0x3043b7[_0x5c9a('0x47')][_0x5c9a('0x6c')]?_0x3043b7['attributes']:_0x2a5170['model'];_0x3043b7[_0x5c9a('0x4b')]=qs[_0x5c9a('0x4c')](_0xc6f250[_0x5c9a('0x44')]['sort']);_0x3043b7['where']=qs[_0x5c9a('0x45')](_[_0x5c9a('0x71')](_0xc6f250[_0x5c9a('0x44')],_0x2a5170[_0x5c9a('0x45')]));if(_0xc6f250['query'][_0x5c9a('0x4e')]){_0x3043b7[_0x5c9a('0x4d')]=_[_0x5c9a('0x4f')](_0x3043b7[_0x5c9a('0x4d')],{'$or':_[_0x5c9a('0x64')](_0x3043b7[_0x5c9a('0x47')],function(_0x1f756f){var _0x30774e={};_0x30774e[_0x1f756f]={'$like':'%'+_0xc6f250['query'][_0x5c9a('0x4e')]+'%'};return _0x30774e;})});}_0x3043b7=_[_0x5c9a('0x4f')]({},_0x3043b7,_0xc6f250[_0x5c9a('0x51')]);return _0x2424fb[_0x5c9a('0x82')](_0x3043b7);}})['then'](function(_0x124063){if(_0x124063){_0x2592d5=_0x124063[_0x5c9a('0x6c')];if(!_0xc6f250[_0x5c9a('0x44')]['hasOwnProperty']('nolimit')){_0x3043b7[_0x5c9a('0x31')]=qs['limit'](_0xc6f250['query'][_0x5c9a('0x31')]);_0x3043b7[_0x5c9a('0x2f')]=qs[_0x5c9a('0x2f')](_0xc6f250[_0x5c9a('0x44')]['offset']);}return _0x2424fb['getApplications'](_0x3043b7);}})[_0x5c9a('0x21')](function(_0x2fdd08){if(_0x2fdd08){return _0x2fdd08?{'count':_0x2592d5,'rows':_0x2fdd08}:null;}})[_0x5c9a('0x21')](respondWithResult(_0x25293e,null))[_0x5c9a('0x53')](handleError(_0x25293e,null));};function Extension(_0x544242,_0x5ce292,_0x2bc22e,_0x224368){this['context']='from-voip-provider';this['exten']=_0x544242[_0x5c9a('0x83')];this[_0x5c9a('0x84')]=_0x224368;this[_0x5c9a('0x41')]=_0x5c9a('0x85');this['description']=_0x5c9a('0x86');this['FaxAccountId']=_0x544242['id'];this['priority']=_0x5ce292;this[_0x5c9a('0x87')]=_0x2bc22e;}function createExtensionsReciveFax(_0x525c48){var _0x5638e5=0x1;var _0x7fa8e0=[];_0x7fa8e0[_0x5c9a('0x88')](new Extension(_0x525c48,_0x5638e5,'','Answer'));_0x5638e5+=0x1;_0x7fa8e0[_0x5c9a('0x88')](new Extension(_0x525c48,_0x5638e5,_0x5c9a('0x89'),_0x5c9a('0x8a')));_0x5638e5+=0x1;for(var _0x165d59 in _0x525c48){if(_0x525c48[_0x5c9a('0x49')](_0x165d59)&&(_0x165d59===_0x5c9a('0x8b')||_0x165d59===_0x5c9a('0x83')||_0x165d59===_0x5c9a('0x8c')||_0x165d59===_0x5c9a('0x8d')||_0x165d59===_0x5c9a('0x8e')||_0x165d59===_0x5c9a('0x8f')||_0x165d59===_0x5c9a('0x90')||_0x165d59===_0x5c9a('0x91')||_0x165d59==='t38timeout')){_0x7fa8e0[_0x5c9a('0x88')](new Extension(_0x525c48,_0x5638e5,'FAXOPT('+_0x165d59+')='+_0x525c48[_0x165d59],_0x5c9a('0x8a')));_0x5638e5+=0x1;}}_0x7fa8e0['push'](new Extension(_0x525c48,_0x5638e5,'6','Wait'));_0x5638e5+=0x1;_0x7fa8e0['push'](new Extension(_0x525c48,_0x5638e5,'/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'));_0x5638e5=0x0;return _0x7fa8e0;}exports['addAccountApplications']=function(_0x384d8c,_0x3fd60f,_0x3976cd){var _0x53b05b;return db['sequelize'][_0x5c9a('0x92')](function(_0x56fcb2){return db[_0x5c9a('0x3e')][_0x5c9a('0x58')](_0x384d8c[_0x5c9a('0x59')],{'transaction':_0x56fcb2})[_0x5c9a('0x21')](function(_0x4436b0){_0x53b05b=_0x4436b0[_0x5c9a('0x37')]({'plain':!![]});return db[_0x5c9a('0x93')][_0x5c9a('0x7d')](createExtensionsReciveFax(_0x53b05b),{'transaction':_0x56fcb2});});})[_0x5c9a('0x21')](function(){return _0x53b05b;})[_0x5c9a('0x21')](respondWithResult(_0x3fd60f,null))[_0x5c9a('0x53')](handleError(_0x3fd60f,null));};exports[_0x5c9a('0x94')]=function(_0x107b9c,_0x5a407a,_0x308095){var _0x181a51;return db[_0x5c9a('0x7a')][_0x5c9a('0x92')](function(_0x1574d7){return db[_0x5c9a('0x3e')][_0x5c9a('0x5f')](_0x107b9c['body'],{'where':{'id':_0x107b9c[_0x5c9a('0x59')]['id']},'transaction':_0x1574d7})[_0x5c9a('0x21')](function(_0x501eb9){return db[_0x5c9a('0x93')][_0x5c9a('0x36')]({'where':{'FaxAccountId':_0x107b9c[_0x5c9a('0x59')]['id']},'transaction':_0x1574d7})['then'](function(_0x57bd27){return db[_0x5c9a('0x93')][_0x5c9a('0x7d')](createExtensionsReciveFax(_['omit'](_0x107b9c[_0x5c9a('0x59')],[_0x5c9a('0x95'),'key','createdAt',_0x5c9a('0x96'),'TrunkId',_0x5c9a('0x97')])),{'transaction':_0x1574d7});});});})['then'](function(){return db['FaxAccount'][_0x5c9a('0x98')](_0x107b9c[_0x5c9a('0x59')]['id']);})[_0x5c9a('0x21')](respondWithResult(_0x5a407a,null))[_0x5c9a('0x53')](handleError(_0x5a407a,null));};exports['getMessages']=function(_0x24553c,_0x3b48c7,_0x568933){var _0x25d780={'raw':!![],'where':{}};var _0x55f546={};var _0x552cf8={'count':0x0,'rows':[]};return db[_0x5c9a('0x3e')]['findOne']({'where':{'id':_0x24553c['params']['id']}})['then'](handleEntityNotFound(_0x3b48c7,null))[_0x5c9a('0x21')](function(_0x300c55){if(_0x300c55){_0x55f546[_0x5c9a('0x42')]=_['keys'](db[_0x5c9a('0x99')][_0x5c9a('0x3f')]);_0x55f546[_0x5c9a('0x44')]=_[_0x5c9a('0x43')](_0x24553c[_0x5c9a('0x44')]);_0x55f546[_0x5c9a('0x45')]=_[_0x5c9a('0x46')](_0x55f546[_0x5c9a('0x42')],_0x55f546[_0x5c9a('0x44')]);_0x25d780['attributes']=_[_0x5c9a('0x46')](_0x55f546['model'],qs['fields'](_0x24553c['query'][_0x5c9a('0x48')]));_0x25d780[_0x5c9a('0x47')]=_0x25d780[_0x5c9a('0x47')][_0x5c9a('0x6c')]?_0x25d780['attributes']:_0x55f546[_0x5c9a('0x42')];if(!_0x24553c['query'][_0x5c9a('0x49')](_0x5c9a('0x4a'))){_0x25d780[_0x5c9a('0x31')]=qs[_0x5c9a('0x31')](_0x24553c[_0x5c9a('0x44')]['limit']);_0x25d780[_0x5c9a('0x2f')]=qs[_0x5c9a('0x2f')](_0x24553c['query'][_0x5c9a('0x2f')]);}_0x25d780[_0x5c9a('0x4b')]=qs[_0x5c9a('0x4c')](_0x24553c['query'][_0x5c9a('0x4c')]);_0x25d780[_0x5c9a('0x4d')]=qs['filters'](_[_0x5c9a('0x71')](_0x24553c[_0x5c9a('0x44')],_0x55f546[_0x5c9a('0x45')]));_0x25d780[_0x5c9a('0x4d')][_0x5c9a('0x63')]=_0x300c55['id'];if(_0x24553c['query'][_0x5c9a('0x4e')]){_0x25d780[_0x5c9a('0x4d')]=_[_0x5c9a('0x4f')](_0x25d780[_0x5c9a('0x4d')],{'$or':_[_0x5c9a('0x64')](_0x25d780[_0x5c9a('0x47')],function(_0x46e162){var _0xd15f76={};_0xd15f76[_0x46e162]={'$like':'%'+_0x24553c['query'][_0x5c9a('0x4e')]+'%'};return _0xd15f76;})});}if(_0x24553c['query'][_0x5c9a('0x9a')]){var _0x2ffa6e=_0x24553c[_0x5c9a('0x44')][_0x5c9a('0x9a')][_0x5c9a('0x9b')](',');var _0x1a0ab6={};_0x1a0ab6[_0x2ffa6e[0x0]]={'$gte':moment(_0x2ffa6e[0x1])[_0x5c9a('0x9c')](_0x5c9a('0x9d'))};_0x25d780[_0x5c9a('0x4d')]=_[_0x5c9a('0x4f')](_0x25d780[_0x5c9a('0x4d')],_0x1a0ab6);}_0x25d780=_[_0x5c9a('0x4f')]({},_0x25d780,_0x24553c[_0x5c9a('0x51')]);return db['FaxMessage'][_0x5c9a('0x32')]({'where':_0x25d780[_0x5c9a('0x4d')]})[_0x5c9a('0x21')](function(_0x287cbb){_0x552cf8[_0x5c9a('0x32')]=_0x287cbb;if(_0x24553c[_0x5c9a('0x44')][_0x5c9a('0x56')]){_0x25d780[_0x5c9a('0x57')]=[{'all':!![]}];}return db['FaxMessage'][_0x5c9a('0x65')](_0x25d780);})['then'](function(_0x11a6ba){_0x552cf8[_0x5c9a('0x52')]=_0x11a6ba;return _0x552cf8;});}})[_0x5c9a('0x21')](respondWithFilteredResult(_0x3b48c7,_0x25d780))[_0x5c9a('0x53')](handleError(_0x3b48c7,null));};exports[_0x5c9a('0x3b')]=function(_0x390c09,_0x148a39,_0x36a462){var _0x2d6a5a,_0x2e39ab={},_0x301daf;if(_0x390c09[_0x5c9a('0x59')]['to']){_0x301daf=_0x390c09[_0x5c9a('0x59')]['to'][0x0];}return db[_0x5c9a('0x3e')][_0x5c9a('0x5c')]({'where':{'id':_0x390c09[_0x5c9a('0x55')]['id']},'include':[{'model':db['CmList'],'as':_0x5c9a('0x9e'),'include':[{'model':db[_0x5c9a('0x72')],'as':_0x5c9a('0x9f'),'where':{'fax':_0x301daf},'limit':0x1,'order':[[_0x5c9a('0x96'),_0x5c9a('0xa0')]]}]}]})['then'](handleEntityNotFound(_0x148a39,null))['then'](function(_0x262f92){_0x2d6a5a=_0x262f92;if(_0x390c09[_0x5c9a('0x59')]['attachments']&&_0x390c09[_0x5c9a('0x59')]['attachments'][_0x5c9a('0x6c')]){for(var _0x1f2c06=0x0;_0x1f2c06<_0x390c09['body'][_0x5c9a('0xa1')][_0x5c9a('0x6c')];_0x1f2c06+=0x1){_0x390c09[_0x5c9a('0x59')][_0x5c9a('0xa1')][_0x1f2c06]={'filename':_0x390c09[_0x5c9a('0x59')][_0x5c9a('0xa1')][_0x1f2c06]['name'],'id':_0x390c09[_0x5c9a('0x59')][_0x5c9a('0xa1')][_0x1f2c06]['id'],'path':path['join'](config['root'],_0x5c9a('0xa2'),_0x390c09[_0x5c9a('0x59')]['attachments'][_0x1f2c06][_0x5c9a('0xa3')])};}}return respondWithRpcPromise(_0x5c9a('0xa4'),_0x5c9a('0xa4'),{'FaxAccountId':_['isNil'](_0x390c09['params']['id'])?undefined:_0x390c09[_0x5c9a('0x55')]['id'],'path':_[_0x5c9a('0xa5')](_0x390c09['body'][_0x5c9a('0xa1')][0x0][_0x5c9a('0x6')])?undefined:_0x390c09[_0x5c9a('0x59')][_0x5c9a('0xa1')][0x0][_0x5c9a('0x6')],'fax':_['isNil'](_0x390c09['body']['to'][0x0])?undefined:_0x390c09['body']['to'][0x0]},client9002);})[_0x5c9a('0x21')](function(){if(_0x2d6a5a){if(_[_0x5c9a('0xa5')](_0x390c09[_0x5c9a('0x59')][_0x5c9a('0xa6')])){_0x390c09[_0x5c9a('0x59')]['from']=util['format']('\x22%s\x22\x20<%s>',_0x2d6a5a[_0x5c9a('0x3a')],_0x2d6a5a['fax']);}if(_0x2d6a5a[_0x5c9a('0x9e')]){if(_0x2d6a5a[_0x5c9a('0x9e')][_0x5c9a('0x9f')][_0x5c9a('0x6c')]){return _0x2d6a5a[_0x5c9a('0x9e')][_0x5c9a('0x9f')][0x0];}else{return db[_0x5c9a('0x72')][_0x5c9a('0x58')](_['defaults'](_0x390c09[_0x5c9a('0x59')],{'firstName':_0x390c09['body']['to'][0x0],'phone':_0x390c09[_0x5c9a('0x59')]['to'][0x0],'fax':_0x390c09['body']['to'][0x0],'ListId':_0x2d6a5a[_0x5c9a('0x97')]}));}}else{throw new Error(_0x5c9a('0xa7'));}}else{throw new Error(_0x5c9a('0xa8'));}})[_0x5c9a('0x21')](function(_0x5f181d){if(_0x5f181d){return db[_0x5c9a('0x70')][_0x5c9a('0x5c')]({'where':{'ContactId':_0x5f181d['id'],'closed':![],'FaxAccountId':_0x2d6a5a['id']}})[_0x5c9a('0x21')](function(_0x4192c7){if(_0x4192c7){return[_0x4192c7,![]];}return db[_0x5c9a('0x70')]['create']({'UserId':_0x390c09[_0x5c9a('0x5a')]['id'],'ContactId':_0x5f181d['id'],'FaxAccountId':_0x2d6a5a['id'],'fax':_0x390c09[_0x5c9a('0x59')]['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0x5c9a('0x4f')](_0x390c09['body'],{'read':![],'body':_0x390c09[_0x5c9a('0x59')]['attachments'][0x0]['filename'],'FaxAccountId':_0x2d6a5a['id'],'UserId':_0x390c09[_0x5c9a('0x5a')]['id'],'ContactId':_0x5f181d['id'],'AttachmentId':_0x390c09[_0x5c9a('0x59')]['attachments'][0x0]['id']})]},{'include':[{'model':db[_0x5c9a('0x99')],'as':_0x5c9a('0xa9')}]})[_0x5c9a('0x21')](function(_0x574480){return[_0x574480,!![]];});});}else{throw new Error(_0x5c9a('0xaa'));}})[_0x5c9a('0xab')](function(_0x4256d4,_0x5d141a){if(_0x5d141a){return _0x4256d4;}return db[_0x5c9a('0x99')][_0x5c9a('0x58')]({'direction':'out','read':![],'body':_0x390c09[_0x5c9a('0x59')][_0x5c9a('0xa1')][0x0][_0x5c9a('0xac')],'FaxAccountId':_0x2d6a5a['id'],'FaxInteractionId':_0x4256d4['id'],'UserId':_0x390c09['user']['id'],'ContactId':_0x4256d4[_0x5c9a('0xad')],'AttachmentId':_0x390c09[_0x5c9a('0x59')][_0x5c9a('0xa1')][0x0]['id']})['then'](function(_0x35447a){_0x4256d4['dataValues'][_0x5c9a('0xa9')]=[];_0x4256d4[_0x5c9a('0xae')]['Messages']['push'](_0x35447a['dataValues']);return _0x4256d4;});})[_0x5c9a('0x21')](function(_0xf0e33f){respondWithRpcPromise(_0x5c9a('0xaf'),_0x5c9a('0xaf'),{'FaxAccountId':_['isNil'](_0x390c09[_0x5c9a('0x55')]['id'])?undefined:_0x390c09[_0x5c9a('0x55')]['id'],'path':_[_0x5c9a('0xa5')](_0x390c09[_0x5c9a('0x59')]['attachments'][0x0][_0x5c9a('0x6')])?undefined:_0x390c09[_0x5c9a('0x59')][_0x5c9a('0xa1')][0x0]['path'],'fax':_[_0x5c9a('0xa5')](_0x390c09[_0x5c9a('0x59')]['to'][0x0])?undefined:_0x390c09[_0x5c9a('0x59')]['to'][0x0],'AttachmentId':_0x390c09[_0x5c9a('0x59')]['attachments'][0x0]['id']},client9002)[_0x5c9a('0x21')](function(_0x1ec1b9){logger[_0x5c9a('0x29')](_0x5c9a('0xb0'),_0x1ec1b9);})['catch'](function(_0xa1fe52){logger[_0x5c9a('0x29')](_0x5c9a('0xb0'),_0xa1fe52);});return _0xf0e33f;})[_0x5c9a('0x21')](respondWithResult(_0x148a39,null))['catch'](handleError(_0x148a39,null));};exports[_0x5c9a('0xb1')]=function(_0x266b9d,_0x19ad79,_0x14486e){return db[_0x5c9a('0x3e')][_0x5c9a('0x5c')]({'where':{'id':_0x266b9d[_0x5c9a('0x55')]['id']}})[_0x5c9a('0x21')](handleEntityNotFound(_0x19ad79,null))['then'](function(_0x74367a){if(_0x74367a){return _0x74367a['addAgents'](_0x266b9d[_0x5c9a('0x59')]['ids'],_[_0x5c9a('0xb2')](_0x266b9d[_0x5c9a('0x59')],[_0x5c9a('0x67'),'id'])||{})['spread'](function(_0x5c86e3){for(var _0x489ca5=0x0;_0x489ca5<_0x266b9d[_0x5c9a('0x59')][_0x5c9a('0x67')]['length'];_0x489ca5+=0x1){socket[_0x5c9a('0xb3')]('userFaxAccount:save',{'UserId':Number(_0x266b9d[_0x5c9a('0x59')]['ids'][_0x489ca5]),'FaxAccountId':Number(_0x266b9d['params']['id'])});}return _0x5c86e3;});}})['then'](respondWithResult(_0x19ad79,null))[_0x5c9a('0x53')](handleError(_0x19ad79,null));};exports[_0x5c9a('0xb4')]=function(_0x451c88,_0x4875f3,_0xd6f2a0){return db[_0x5c9a('0x3e')][_0x5c9a('0x5c')]({'where':{'id':_0x451c88[_0x5c9a('0x55')]['id']}})['then'](handleEntityNotFound(_0x4875f3,null))['then'](function(_0x302eb2){if(_0x302eb2){return _0x302eb2[_0x5c9a('0xb4')](_0x451c88['query'][_0x5c9a('0x67')])[_0x5c9a('0x21')](function(){if(_['isArray'](_0x451c88[_0x5c9a('0x44')][_0x5c9a('0x67')])){for(var _0x4e01b5=0x0;_0x4e01b5<_0x451c88[_0x5c9a('0x44')]['ids']['length'];_0x4e01b5+=0x1){socket[_0x5c9a('0xb3')]('userFaxAccount:remove',{'UserId':Number(_0x451c88[_0x5c9a('0x44')][_0x5c9a('0x67')][_0x4e01b5]),'FaxAccountId':Number(_0x451c88['params']['id'])});}}else{socket[_0x5c9a('0xb3')](_0x5c9a('0xb5'),{'UserId':Number(_0x451c88['query'][_0x5c9a('0x67')]),'FaxAccountId':Number(_0x451c88['params']['id'])});}});}})[_0x5c9a('0x21')](respondWithStatusCode(_0x4875f3,null))[_0x5c9a('0x53')](handleError(_0x4875f3,null));};exports[_0x5c9a('0xb6')]=function(_0x587c61,_0x36b325,_0x4f1475){var _0x478c71={};var _0x3cca5e={};var _0xe75da7;var _0x18e7cb;return db[_0x5c9a('0x3e')][_0x5c9a('0x6a')]({'where':{'id':_0x587c61['params']['id']}})[_0x5c9a('0x21')](handleEntityNotFound(_0x36b325,null))[_0x5c9a('0x21')](function(_0x4a2356){if(_0x4a2356){_0xe75da7=_0x4a2356;_0x3cca5e[_0x5c9a('0x42')]=_[_0x5c9a('0x43')](db[_0x5c9a('0xb7')][_0x5c9a('0x3f')]);_0x3cca5e[_0x5c9a('0x44')]=_[_0x5c9a('0x43')](_0x587c61[_0x5c9a('0x44')]);_0x3cca5e['filters']=_[_0x5c9a('0x46')](_0x3cca5e[_0x5c9a('0x42')],_0x3cca5e[_0x5c9a('0x44')]);_0x478c71[_0x5c9a('0x47')]=_[_0x5c9a('0x46')](_0x3cca5e[_0x5c9a('0x42')],qs[_0x5c9a('0x48')](_0x587c61['query'][_0x5c9a('0x48')]));_0x478c71[_0x5c9a('0x47')]=_0x478c71[_0x5c9a('0x47')][_0x5c9a('0x6c')]?_0x478c71[_0x5c9a('0x47')]:_0x3cca5e[_0x5c9a('0x42')];_0x478c71[_0x5c9a('0x4b')]=qs[_0x5c9a('0x4c')](_0x587c61[_0x5c9a('0x44')][_0x5c9a('0x4c')]);_0x478c71['where']=qs[_0x5c9a('0x45')](_['pick'](_0x587c61[_0x5c9a('0x44')],_0x3cca5e[_0x5c9a('0x45')]));if(_0x587c61[_0x5c9a('0x44')]['filter']){_0x478c71['where']=_['merge'](_0x478c71[_0x5c9a('0x4d')],{'$or':_[_0x5c9a('0x64')](_0x478c71[_0x5c9a('0x47')],function(_0x162cea){var _0x529b6e={};_0x529b6e[_0x162cea]={'$like':'%'+_0x587c61[_0x5c9a('0x44')]['filter']+'%'};return _0x529b6e;})});}_0x478c71=_[_0x5c9a('0x4f')]({},_0x478c71,_0x587c61[_0x5c9a('0x51')]);return _0xe75da7[_0x5c9a('0xb6')](_0x478c71);}})['then'](function(_0x4f3113){if(_0x4f3113){_0x18e7cb=_0x4f3113[_0x5c9a('0x6c')];if(!_0x587c61['query'][_0x5c9a('0x49')](_0x5c9a('0x4a'))){_0x478c71['limit']=qs[_0x5c9a('0x31')](_0x587c61[_0x5c9a('0x44')][_0x5c9a('0x31')]);_0x478c71['offset']=qs[_0x5c9a('0x2f')](_0x587c61['query'][_0x5c9a('0x2f')]);}return _0xe75da7[_0x5c9a('0xb6')](_0x478c71);}})[_0x5c9a('0x21')](function(_0xf6ef49){if(_0xf6ef49){return _0xf6ef49?{'count':_0x18e7cb,'rows':_0xf6ef49}:null;}})[_0x5c9a('0x21')](respondWithResult(_0x36b325,null))[_0x5c9a('0x53')](handleError(_0x36b325,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index b6371dd..ca9adf7 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 _0x5835=['emit','hook','exports','events','setMaxListeners','save'];(function(_0xbf5e16,_0x146ce3){var _0x5975a5=function(_0x2387a7){while(--_0x2387a7){_0xbf5e16['push'](_0xbf5e16['shift']());}};_0x5975a5(++_0x146ce3);}(_0x5835,0x123));var _0x5583=function(_0x541930,_0x4d9f67){_0x541930=_0x541930-0x0;var _0x38fad5=_0x5835[_0x541930];return _0x38fad5;};'use strict';var EventEmitter=require(_0x5583('0x0'));var FaxAccount=require('../../mysqldb')['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x5583('0x1')](0x0);var events={'afterCreate':_0x5583('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x241edf){return function(_0x4da6c6,_0x1f775f,_0x5c45bc){FaxAccountEvents[_0x5583('0x3')](_0x241edf+':'+_0x4da6c6['id'],_0x4da6c6);FaxAccountEvents['emit'](_0x241edf,_0x4da6c6);_0x5c45bc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0x5583('0x4')](e,emitEvent(event));}}module[_0x5583('0x5')]=FaxAccountEvents; \ No newline at end of file +var _0x11fc=['hasOwnProperty','hook','exports','../../mysqldb','save','update','emit'];(function(_0x1c208e,_0x2a0a5b){var _0x5104ff=function(_0x3ca41f){while(--_0x3ca41f){_0x1c208e['push'](_0x1c208e['shift']());}};_0x5104ff(++_0x2a0a5b);}(_0x11fc,0x130));var _0xc11f=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x11fc[_0x618414];return _0x21c19a;};'use strict';var EventEmitter=require('events');var FaxAccount=require(_0xc11f('0x0'))['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc11f('0x1'),'afterUpdate':_0xc11f('0x2'),'afterDestroy':'remove'};function emitEvent(_0x50b0e7){return function(_0x393d31,_0x1847cb,_0x17bd1b){FaxAccountEvents[_0xc11f('0x3')](_0x50b0e7+':'+_0x393d31['id'],_0x393d31);FaxAccountEvents[_0xc11f('0x3')](_0x50b0e7,_0x393d31);_0x17bd1b(null);};}for(var e in events){if(events[_0xc11f('0x4')](e)){var event=events[e];FaxAccount[_0xc11f('0x5')](e,emitEvent(event));}}module[_0xc11f('0x6')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index e324816..59d4da0 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 _0x8b86=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','FaxAccount'];(function(_0x267ecf,_0x444e45){var _0xf67a1f=function(_0x2d9d44){while(--_0x2d9d44){_0x267ecf['push'](_0x267ecf['shift']());}};_0xf67a1f(++_0x444e45);}(_0x8b86,0xfd));var _0x68b8=function(_0x15da5f,_0x3fce0e){_0x15da5f=_0x15da5f-0x0;var _0x1992f1=_0x8b86[_0x15da5f];return _0x1992f1;};'use strict';var _=require('lodash');var util=require(_0x68b8('0x0'));var logger=require(_0x68b8('0x1'))('api');var moment=require(_0x68b8('0x2'));var BPromise=require(_0x68b8('0x3'));var rp=require(_0x68b8('0x4'));var fs=require('fs');var path=require(_0x68b8('0x5'));var rimraf=require(_0x68b8('0x6'));var config=require(_0x68b8('0x7'));var attributes=require('./faxAccount.attributes');module[_0x68b8('0x8')]=function(_0x7cabee,_0xc9dd9b){return _0x7cabee[_0x68b8('0x9')](_0x68b8('0xa'),attributes,{'tableName':'fax_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9e18=['./faxAccount.attributes','FaxAccount','fax_accounts','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x11379e,_0x2e2c6c){var _0x12839a=function(_0x235235){while(--_0x235235){_0x11379e['push'](_0x11379e['shift']());}};_0x12839a(++_0x2e2c6c);}(_0x9e18,0x107));var _0x89e1=function(_0xbfc560,_0x311fba){_0xbfc560=_0xbfc560-0x0;var _0x47b022=_0x9e18[_0xbfc560];return _0x47b022;};'use strict';var _=require('lodash');var util=require(_0x89e1('0x0'));var logger=require(_0x89e1('0x1'))('api');var moment=require('moment');var BPromise=require(_0x89e1('0x2'));var rp=require(_0x89e1('0x3'));var fs=require('fs');var path=require(_0x89e1('0x4'));var rimraf=require(_0x89e1('0x5'));var config=require(_0x89e1('0x6'));var attributes=require(_0x89e1('0x7'));module['exports']=function(_0x28a71a,_0x1a6e9a){return _0x28a71a['define'](_0x89e1('0x8'),attributes,{'tableName':_0x89e1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.rpc.js b/server/api/faxAccount/faxAccount.rpc.js index 55d3d8b..7adebc1 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 _0x58be=['User','name','agent','waitForTheAssignedAgent','Start','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','./faxAccount.socket','register','request','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetFaxAccount','findAll','options','raw','where','limit','include','model','attributes','then','stringify','NotifyFaxAccount','fax','describe','Sequelize','no\x20available\x20attributes','difference','keys','createdAt','CompanyId','ListId','body','isNil','from','from\x20is\x20mandatory','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','FaxAccount','find','account','CmList','CmContact','Contacts','updatedAt','DESC','FaxApplication','List','get','Applications','list','applications','asc','length','defaults','create','FaxInteraction','Contact\x20not\x20found','spread','autoclose','push','close','*,*,*,*','created','ContactId','AttachmentId','interaction','UserId'];(function(_0xb79944,_0x486504){var _0x330f1d=function(_0x53e214){while(--_0x53e214){_0xb79944['push'](_0xb79944['shift']());}};_0x330f1d(++_0x486504);}(_0x58be,0x119));var _0xe58b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x58be[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xe58b('0x0'));var util=require(_0xe58b('0x1'));var moment=require(_0xe58b('0x2'));var BPromise=require(_0xe58b('0x3'));var rs=require(_0xe58b('0x4'));var fs=require('fs');var Redis=require(_0xe58b('0x5'));var db=require(_0xe58b('0x6'))['db'];var utils=require(_0xe58b('0x7'));var logger=require(_0xe58b('0x8'))('rpc');var config=require(_0xe58b('0x9'));var jayson=require(_0xe58b('0xa'));var client=jayson[_0xe58b('0xb')][_0xe58b('0xc')]({'port':0x232c});config[_0xe58b('0xd')]=_['defaults'](config[_0xe58b('0xd')],{'host':_0xe58b('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe58b('0xd')]));require(_0xe58b('0xf'))[_0xe58b('0x10')](socket);function respondWithRpcPromise(_0x3141a8,_0x5b8d0d,_0x4d040e){return new BPromise(function(_0x3711bd,_0xa2670a){return client[_0xe58b('0x11')](_0x3141a8,_0x4d040e)['then'](function(_0x2677e2){logger[_0xe58b('0x12')](_0xe58b('0x13'),_0x5b8d0d,_0xe58b('0x14'));logger[_0xe58b('0x15')](_0xe58b('0x16'),_0x5b8d0d,'request\x20sent',JSON['stringify'](_0x2677e2));if(_0x2677e2[_0xe58b('0x17')]){if(_0x2677e2[_0xe58b('0x17')]['code']===0x1f4){logger['error'](_0xe58b('0x13'),_0x5b8d0d,_0x2677e2[_0xe58b('0x17')][_0xe58b('0x18')]);return _0xa2670a(_0x2677e2['error'][_0xe58b('0x18')]);}logger['error'](_0xe58b('0x13'),_0x5b8d0d,_0x2677e2[_0xe58b('0x17')][_0xe58b('0x18')]);return _0x3711bd(_0x2677e2[_0xe58b('0x17')][_0xe58b('0x18')]);}else{logger['info'](_0xe58b('0x13'),_0x5b8d0d,_0xe58b('0x14'));_0x3711bd(_0x2677e2[_0xe58b('0x19')]['message']);}})[_0xe58b('0x1a')](function(_0x137e49){logger['error']('FaxAccount,\x20%s,\x20%s',_0x5b8d0d,_0x137e49);_0xa2670a(_0x137e49);});});}exports[_0xe58b('0x1b')]=function(_0x499755){var _0x4f32ee=this;return new Promise(function(_0x491ec8,_0x3e2c19){return db['FaxAccount'][_0xe58b('0x1c')]({'raw':_0x499755[_0xe58b('0x1d')]?_0x499755['options'][_0xe58b('0x1e')]===undefined?!![]:![]:!![],'where':_0x499755[_0xe58b('0x1d')]?_0x499755[_0xe58b('0x1d')][_0xe58b('0x1f')]||null:null,'attributes':_0x499755[_0xe58b('0x1d')]?_0x499755['options']['attributes']||null:null,'limit':_0x499755[_0xe58b('0x1d')]?_0x499755[_0xe58b('0x1d')][_0xe58b('0x20')]||null:null,'include':_0x499755[_0xe58b('0x1d')]?_0x499755[_0xe58b('0x1d')]['include']?_['map'](_0x499755['options'][_0xe58b('0x21')],function(_0x2acd5d){return{'model':db[_0x2acd5d[_0xe58b('0x22')]],'as':_0x2acd5d['as'],'attributes':_0x2acd5d[_0xe58b('0x23')],'include':_0x2acd5d[_0xe58b('0x21')]?_['map'](_0x2acd5d[_0xe58b('0x21')],function(_0x43e8c5){return{'model':db[_0x43e8c5[_0xe58b('0x22')]],'as':_0x43e8c5['as'],'attributes':_0x43e8c5[_0xe58b('0x23')],'include':_0x43e8c5['include']?_['map'](_0x43e8c5['include'],function(_0x5ccfe0){return{'model':db[_0x5ccfe0[_0xe58b('0x22')]],'as':_0x5ccfe0['as'],'attributes':_0x5ccfe0['attributes']};}):[]};}):[]};}):[]:[]})[_0xe58b('0x24')](function(_0x3cb25d){logger[_0xe58b('0x12')]('GetFaxAccount',_0x499755);logger['debug'](_0xe58b('0x1b'),_0x499755,JSON[_0xe58b('0x25')](_0x3cb25d));_0x491ec8(_0x3cb25d);})[_0xe58b('0x1a')](function(_0x595f36){logger['error'](_0xe58b('0x1b'),_0x595f36['message'],_0x499755);_0x3e2c19(_0x4f32ee['error'](0x1f4,_0x595f36['message']));});});};exports[_0xe58b('0x26')]=function(_0x30a022,_0x228305,_0x2aac95){var _0x381219=this;return new Promise(function(_0x3c2d16,_0x4ead7a){var _0x41de73={'body':_0x30a022['body'],'channel':_0xe58b('0x27')};var _0x318215=[];var _0x501aea=[];var _0xc9fc4c={};return db['CmContact'][_0xe58b('0x28')]()[_0xe58b('0x24')](function(_0x14cc91){if(!_0x14cc91){throw new db[(_0xe58b('0x29'))]['ValidationError'](_0xe58b('0x2a'));}_0x318215=_[_0xe58b('0x2b')](_[_0xe58b('0x2c')](_0x14cc91),[_0xe58b('0x2d'),'updatedAt']);_0x501aea=_[_0xe58b('0x2b')](_[_0xe58b('0x2c')](_0x14cc91),[_0xe58b('0x2d'),'updatedAt',_0xe58b('0x2e'),_0xe58b('0x2f')]);if(_0x30a022['body']['id']){delete _0x30a022[_0xe58b('0x30')]['id'];}if(_[_0xe58b('0x31')](_0x30a022['body'][_0xe58b('0x32')])){throw new db[(_0xe58b('0x29'))]['ValidationError'](_0xe58b('0x33'));}if(_[_0xe58b('0x31')](_0x30a022[_0xe58b('0x30')][_0xe58b('0x30')])||_0x30a022[_0xe58b('0x30')][_0xe58b('0x30')]===''){throw new db[(_0xe58b('0x29'))][(_0xe58b('0x34'))](_0xe58b('0x35'));}if(_['isNil'](_0x30a022[_0xe58b('0x30')][_0xe58b('0x36')])){throw new db[(_0xe58b('0x29'))][(_0xe58b('0x34'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x501aea);}if(!_[_0xe58b('0x37')](_0x501aea,_0x30a022[_0xe58b('0x30')][_0xe58b('0x36')])){throw new db[(_0xe58b('0x29'))][(_0xe58b('0x34'))](_0xe58b('0x38')+_0x501aea);}_0xc9fc4c[_0x30a022['body'][_0xe58b('0x36')]]=_0x30a022[_0xe58b('0x30')][_0xe58b('0x32')];})[_0xe58b('0x24')](function(){return db[_0xe58b('0x39')][_0xe58b('0x3a')]({'where':{'id':_0x30a022[_0xe58b('0x3b')]['id']},'include':[{'model':db[_0xe58b('0x3c')],'as':'List','include':[{'model':db[_0xe58b('0x3d')],'as':_0xe58b('0x3e'),'where':_0xc9fc4c,'limit':0x1,'order':[[_0xe58b('0x3f'),_0xe58b('0x40')]]}]},{'model':db[_0xe58b('0x41')],'as':'Applications'}]});})['then'](function(_0x46bf53){if(_0x46bf53&&_0x46bf53[_0xe58b('0x42')]){var _0x5c4671=_0x46bf53[_0xe58b('0x43')]({'plain':!![]});_0x41de73['account']=_0x5c4671;_0x41de73['applications']=_0x5c4671[_0xe58b('0x44')];_0x41de73[_0xe58b('0x45')]=_0x5c4671[_0xe58b('0x42')];_0x41de73[_0xe58b('0x46')]=_['orderBy'](_0x41de73['applications'],['priority'],[_0xe58b('0x47')]);if(_0x41de73['account'][_0xe58b('0x44')]){delete _0x41de73[_0xe58b('0x3b')]['Applications'];}if(_0x41de73[_0xe58b('0x3b')]['List']&&_0x41de73[_0xe58b('0x3b')][_0xe58b('0x42')][_0xe58b('0x3e')][_0xe58b('0x48')]){return _0x41de73[_0xe58b('0x3b')][_0xe58b('0x42')][_0xe58b('0x3e')][0x0];}var _0x31b1ab=_[_0xe58b('0x49')](_0x30a022[_0xe58b('0x30')],{'firstName':_0x30a022['body'][_0xe58b('0x32')],'ListId':_0x5c4671[_0xe58b('0x2f')]});_0x31b1ab[_0x30a022[_0xe58b('0x30')][_0xe58b('0x36')]]=_0x30a022[_0xe58b('0x30')][_0xe58b('0x32')];return db[_0xe58b('0x3d')][_0xe58b('0x4a')](_0x31b1ab,{'fields':_0x318215,'raw':!![]});}})[_0xe58b('0x24')](function(_0x58b54e){_0x41de73['contact']=_0x58b54e;if(_0x58b54e){var _0x5487ac={'ContactId':_0x58b54e['id'],'FaxAccountId':_0x30a022[_0xe58b('0x3b')]['id'],'fax':_0x58b54e[_0xe58b('0x27')]};return db[_0xe58b('0x4b')]['find']({'where':{'ContactId':_0x58b54e['id'],'closed':![],'FaxAccountId':_0x30a022['account']['id']}})[_0xe58b('0x24')](function(_0xec4ee){if(_0xec4ee){return[_0xec4ee,![]];}return db[_0xe58b('0x4b')][_0xe58b('0x4a')](_0x5487ac)[_0xe58b('0x24')](function(_0x467348){return[_0x467348,!![]];});});}else{throw new Error(_0xe58b('0x4c'));}})[_0xe58b('0x4d')](function(_0x4aece3,_0x2bc5de){var _0x1abb66=_0x4aece3[_0xe58b('0x43')]({'plain':!![]});if(_0x2bc5de){if(_0x41de73[_0xe58b('0x3b')][_0xe58b('0x4e')]){_0x41de73['applications'][_0xe58b('0x4f')]({'id':0x0,'priority':_0x41de73[_0xe58b('0x46')][_0xe58b('0x48')]+0x1,'app':_0xe58b('0x50'),'appdata':'unmanaged','interval':_0xe58b('0x51')});}_0x1abb66[_0xe58b('0x52')]=!![];}else{_0x1abb66[_0xe58b('0x52')]=![];}_0x41de73['interaction']=_0x1abb66;return db['FaxMessage']['create']({'body':_0x30a022[_0xe58b('0x30')][_0xe58b('0x30')],'FaxAccountId':_0x30a022[_0xe58b('0x3b')]['id'],'FaxInteractionId':_0x4aece3['id'],'direction':'in','ContactId':_0x4aece3[_0xe58b('0x53')],'AttachmentId':_0x30a022['body'][_0xe58b('0x54')]});})[_0xe58b('0x24')](function(_0x39c74c){_0x41de73[_0xe58b('0x18')]=_0x39c74c;if(_0x41de73[_0xe58b('0x55')][_0xe58b('0x56')]){return db[_0xe58b('0x57')][_0xe58b('0x3a')]({'attributes':['id',_0xe58b('0x58')],'where':{'id':_0x41de73[_0xe58b('0x55')][_0xe58b('0x56')]}})[_0xe58b('0x24')](function(_0x2e9540){if(_0x2e9540){_0x41de73[_0xe58b('0x46')]['unshift']({'id':0x0,'priority':0x0,'app':_0xe58b('0x59'),'appdata':_0x2e9540[_0xe58b('0x58')]+','+(_0x41de73[_0xe58b('0x3b')][_0xe58b('0x5a')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start','startRouting',_0x41de73);});}return respondWithRpcPromise(_0xe58b('0x5b'),'startRouting',_0x41de73);})['then'](function(_0x479920){_0x3c2d16(_0x479920);})[_0xe58b('0x1a')](function(_0x1860c6){_0x4ead7a(_0x381219['error'](0x1f4,_0x1860c6[_0xe58b('0x18')]));});});}; \ No newline at end of file +var _0xea0b=['message','request\x20sent','GetFaxAccount','FaxAccount','findAll','options','where','attributes','limit','include','map','model','catch','body','fax','CmContact','describe','Sequelize','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','ListId','isNil','from','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','List','Contacts','DESC','FaxApplication','Applications','get','applications','list','orderBy','asc','length','create','contact','FaxInteraction','Contact\x20not\x20found','spread','autoclose','push','close','*,*,*,*','created','interaction','FaxMessage','AttachmentId','UserId','User','unshift','agent','name','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','defaults','redis','./faxAccount.socket','register','request','then','info','debug','stringify','error','code','FaxAccount,\x20%s,\x20%s'];(function(_0x4d1ee9,_0x394a78){var _0x9a5456=function(_0x224f3b){while(--_0x224f3b){_0x4d1ee9['push'](_0x4d1ee9['shift']());}};_0x9a5456(++_0x394a78);}(_0xea0b,0xee));var _0xbea0=function(_0x52a192,_0x3ffac0){_0x52a192=_0x52a192-0x0;var _0x4da4ae=_0xea0b[_0x52a192];return _0x4da4ae;};'use strict';var _=require(_0xbea0('0x0'));var util=require(_0xbea0('0x1'));var moment=require(_0xbea0('0x2'));var BPromise=require(_0xbea0('0x3'));var rs=require(_0xbea0('0x4'));var fs=require('fs');var Redis=require(_0xbea0('0x5'));var db=require(_0xbea0('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xbea0('0x7'))('rpc');var config=require(_0xbea0('0x8'));var jayson=require(_0xbea0('0x9'));var client=jayson[_0xbea0('0xa')]['http']({'port':0x232c});config['redis']=_[_0xbea0('0xb')](config[_0xbea0('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbea0('0xc')]));require(_0xbea0('0xd'))[_0xbea0('0xe')](socket);function respondWithRpcPromise(_0x521b57,_0x5bdd7c,_0x111229){return new BPromise(function(_0x40f0f0,_0x27a550){return client[_0xbea0('0xf')](_0x521b57,_0x111229)[_0xbea0('0x10')](function(_0xc8dd95){logger[_0xbea0('0x11')]('FaxAccount,\x20%s,\x20%s',_0x5bdd7c,'request\x20sent');logger[_0xbea0('0x12')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x5bdd7c,'request\x20sent',JSON[_0xbea0('0x13')](_0xc8dd95));if(_0xc8dd95[_0xbea0('0x14')]){if(_0xc8dd95[_0xbea0('0x14')][_0xbea0('0x15')]===0x1f4){logger[_0xbea0('0x14')](_0xbea0('0x16'),_0x5bdd7c,_0xc8dd95['error']['message']);return _0x27a550(_0xc8dd95[_0xbea0('0x14')][_0xbea0('0x17')]);}logger[_0xbea0('0x14')](_0xbea0('0x16'),_0x5bdd7c,_0xc8dd95[_0xbea0('0x14')][_0xbea0('0x17')]);return _0x40f0f0(_0xc8dd95[_0xbea0('0x14')]['message']);}else{logger[_0xbea0('0x11')](_0xbea0('0x16'),_0x5bdd7c,_0xbea0('0x18'));_0x40f0f0(_0xc8dd95['result'][_0xbea0('0x17')]);}})['catch'](function(_0x251af9){logger['error'](_0xbea0('0x16'),_0x5bdd7c,_0x251af9);_0x27a550(_0x251af9);});});}exports[_0xbea0('0x19')]=function(_0x7ba5d9){var _0x4ff728=this;return new Promise(function(_0x45c348,_0x3bd2ab){return db[_0xbea0('0x1a')][_0xbea0('0x1b')]({'raw':_0x7ba5d9[_0xbea0('0x1c')]?_0x7ba5d9[_0xbea0('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x7ba5d9[_0xbea0('0x1c')]?_0x7ba5d9[_0xbea0('0x1c')][_0xbea0('0x1d')]||null:null,'attributes':_0x7ba5d9[_0xbea0('0x1c')]?_0x7ba5d9[_0xbea0('0x1c')][_0xbea0('0x1e')]||null:null,'limit':_0x7ba5d9[_0xbea0('0x1c')]?_0x7ba5d9['options'][_0xbea0('0x1f')]||null:null,'include':_0x7ba5d9[_0xbea0('0x1c')]?_0x7ba5d9[_0xbea0('0x1c')][_0xbea0('0x20')]?_[_0xbea0('0x21')](_0x7ba5d9[_0xbea0('0x1c')][_0xbea0('0x20')],function(_0x4c40c0){return{'model':db[_0x4c40c0[_0xbea0('0x22')]],'as':_0x4c40c0['as'],'attributes':_0x4c40c0[_0xbea0('0x1e')],'include':_0x4c40c0['include']?_[_0xbea0('0x21')](_0x4c40c0[_0xbea0('0x20')],function(_0x5cf4ae){return{'model':db[_0x5cf4ae[_0xbea0('0x22')]],'as':_0x5cf4ae['as'],'attributes':_0x5cf4ae[_0xbea0('0x1e')],'include':_0x5cf4ae['include']?_[_0xbea0('0x21')](_0x5cf4ae[_0xbea0('0x20')],function(_0x27eebb){return{'model':db[_0x27eebb[_0xbea0('0x22')]],'as':_0x27eebb['as'],'attributes':_0x27eebb[_0xbea0('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xbea0('0x10')](function(_0x4655b0){logger[_0xbea0('0x11')](_0xbea0('0x19'),_0x7ba5d9);logger[_0xbea0('0x12')]('GetFaxAccount',_0x7ba5d9,JSON[_0xbea0('0x13')](_0x4655b0));_0x45c348(_0x4655b0);})[_0xbea0('0x23')](function(_0x4317b6){logger[_0xbea0('0x14')]('GetFaxAccount',_0x4317b6['message'],_0x7ba5d9);_0x3bd2ab(_0x4ff728[_0xbea0('0x14')](0x1f4,_0x4317b6[_0xbea0('0x17')]));});});};exports['NotifyFaxAccount']=function(_0x38d590,_0x399370,_0x43cec1){var _0x21a031=this;return new Promise(function(_0xced6b9,_0x36b526){var _0x2e1d34={'body':_0x38d590[_0xbea0('0x24')],'channel':_0xbea0('0x25')};var _0xd1df36=[];var _0x268bd2=[];var _0x1c3ae1={};return db[_0xbea0('0x26')][_0xbea0('0x27')]()['then'](function(_0x3dbc2c){if(!_0x3dbc2c){throw new db[(_0xbea0('0x28'))]['ValidationError'](_0xbea0('0x29'));}_0xd1df36=_[_0xbea0('0x2a')](_[_0xbea0('0x2b')](_0x3dbc2c),[_0xbea0('0x2c'),'updatedAt']);_0x268bd2=_[_0xbea0('0x2a')](_['keys'](_0x3dbc2c),[_0xbea0('0x2c'),_0xbea0('0x2d'),'CompanyId',_0xbea0('0x2e')]);if(_0x38d590[_0xbea0('0x24')]['id']){delete _0x38d590['body']['id'];}if(_[_0xbea0('0x2f')](_0x38d590['body'][_0xbea0('0x30')])){throw new db[(_0xbea0('0x28'))][(_0xbea0('0x31'))]('from\x20is\x20mandatory');}if(_[_0xbea0('0x2f')](_0x38d590[_0xbea0('0x24')][_0xbea0('0x24')])||_0x38d590[_0xbea0('0x24')]['body']===''){throw new db[(_0xbea0('0x28'))][(_0xbea0('0x31'))](_0xbea0('0x32'));}if(_['isNil'](_0x38d590[_0xbea0('0x24')][_0xbea0('0x33')])){throw new db[(_0xbea0('0x28'))]['ValidationError'](_0xbea0('0x34')+_0x268bd2);}if(!_['includes'](_0x268bd2,_0x38d590[_0xbea0('0x24')][_0xbea0('0x33')])){throw new db[(_0xbea0('0x28'))][(_0xbea0('0x31'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x268bd2);}_0x1c3ae1[_0x38d590['body'][_0xbea0('0x33')]]=_0x38d590[_0xbea0('0x24')][_0xbea0('0x30')];})[_0xbea0('0x10')](function(){return db[_0xbea0('0x1a')][_0xbea0('0x35')]({'where':{'id':_0x38d590[_0xbea0('0x36')]['id']},'include':[{'model':db['CmList'],'as':_0xbea0('0x37'),'include':[{'model':db['CmContact'],'as':_0xbea0('0x38'),'where':_0x1c3ae1,'limit':0x1,'order':[['updatedAt',_0xbea0('0x39')]]}]},{'model':db[_0xbea0('0x3a')],'as':_0xbea0('0x3b')}]});})['then'](function(_0x4ce974){if(_0x4ce974&&_0x4ce974[_0xbea0('0x37')]){var _0x4f65cb=_0x4ce974[_0xbea0('0x3c')]({'plain':!![]});_0x2e1d34[_0xbea0('0x36')]=_0x4f65cb;_0x2e1d34[_0xbea0('0x3d')]=_0x4f65cb[_0xbea0('0x3b')];_0x2e1d34[_0xbea0('0x3e')]=_0x4f65cb[_0xbea0('0x37')];_0x2e1d34['applications']=_[_0xbea0('0x3f')](_0x2e1d34['applications'],['priority'],[_0xbea0('0x40')]);if(_0x2e1d34['account']['Applications']){delete _0x2e1d34['account']['Applications'];}if(_0x2e1d34[_0xbea0('0x36')][_0xbea0('0x37')]&&_0x2e1d34[_0xbea0('0x36')][_0xbea0('0x37')][_0xbea0('0x38')][_0xbea0('0x41')]){return _0x2e1d34[_0xbea0('0x36')][_0xbea0('0x37')][_0xbea0('0x38')][0x0];}var _0x359c9a=_[_0xbea0('0xb')](_0x38d590['body'],{'firstName':_0x38d590[_0xbea0('0x24')][_0xbea0('0x30')],'ListId':_0x4f65cb['ListId']});_0x359c9a[_0x38d590[_0xbea0('0x24')][_0xbea0('0x33')]]=_0x38d590[_0xbea0('0x24')]['from'];return db[_0xbea0('0x26')][_0xbea0('0x42')](_0x359c9a,{'fields':_0xd1df36,'raw':!![]});}})['then'](function(_0x56e74a){_0x2e1d34[_0xbea0('0x43')]=_0x56e74a;if(_0x56e74a){var _0xc79fc1={'ContactId':_0x56e74a['id'],'FaxAccountId':_0x38d590[_0xbea0('0x36')]['id'],'fax':_0x56e74a[_0xbea0('0x25')]};return db['FaxInteraction'][_0xbea0('0x35')]({'where':{'ContactId':_0x56e74a['id'],'closed':![],'FaxAccountId':_0x38d590[_0xbea0('0x36')]['id']}})[_0xbea0('0x10')](function(_0x158c84){if(_0x158c84){return[_0x158c84,![]];}return db[_0xbea0('0x44')][_0xbea0('0x42')](_0xc79fc1)[_0xbea0('0x10')](function(_0x5b7098){return[_0x5b7098,!![]];});});}else{throw new Error(_0xbea0('0x45'));}})[_0xbea0('0x46')](function(_0x808bea,_0x36dfab){var _0x52146e=_0x808bea[_0xbea0('0x3c')]({'plain':!![]});if(_0x36dfab){if(_0x2e1d34[_0xbea0('0x36')][_0xbea0('0x47')]){_0x2e1d34[_0xbea0('0x3d')][_0xbea0('0x48')]({'id':0x0,'priority':_0x2e1d34[_0xbea0('0x3d')][_0xbea0('0x41')]+0x1,'app':_0xbea0('0x49'),'appdata':'unmanaged','interval':_0xbea0('0x4a')});}_0x52146e[_0xbea0('0x4b')]=!![];}else{_0x52146e[_0xbea0('0x4b')]=![];}_0x2e1d34[_0xbea0('0x4c')]=_0x52146e;return db[_0xbea0('0x4d')][_0xbea0('0x42')]({'body':_0x38d590[_0xbea0('0x24')][_0xbea0('0x24')],'FaxAccountId':_0x38d590[_0xbea0('0x36')]['id'],'FaxInteractionId':_0x808bea['id'],'direction':'in','ContactId':_0x808bea['ContactId'],'AttachmentId':_0x38d590[_0xbea0('0x24')][_0xbea0('0x4e')]});})[_0xbea0('0x10')](function(_0x1ecf45){_0x2e1d34[_0xbea0('0x17')]=_0x1ecf45;if(_0x2e1d34[_0xbea0('0x4c')][_0xbea0('0x4f')]){return db[_0xbea0('0x50')][_0xbea0('0x35')]({'attributes':['id','name'],'where':{'id':_0x2e1d34[_0xbea0('0x4c')][_0xbea0('0x4f')]}})['then'](function(_0x470f2d){if(_0x470f2d){_0x2e1d34[_0xbea0('0x3d')][_0xbea0('0x51')]({'id':0x0,'priority':0x0,'app':_0xbea0('0x52'),'appdata':_0x470f2d[_0xbea0('0x53')]+','+(_0x2e1d34[_0xbea0('0x36')][_0xbea0('0x54')]||0xa),'interval':_0xbea0('0x4a')});}return respondWithRpcPromise(_0xbea0('0x55'),_0xbea0('0x56'),_0x2e1d34);});}return respondWithRpcPromise(_0xbea0('0x55'),_0xbea0('0x56'),_0x2e1d34);})[_0xbea0('0x10')](function(_0x2d4852){_0xced6b9(_0x2d4852);})['catch'](function(_0x262fd0){_0x36b526(_0x21a031['error'](0x1f4,_0x262fd0['message']));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 8ddbb60..fc18fc7 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 _0x99c1=['remove','update','emit','removeListener','length','faxAccount:','./faxAccount.events','save'];(function(_0x453ecd,_0x5491f7){var _0x55b214=function(_0x3555c0){while(--_0x3555c0){_0x453ecd['push'](_0x453ecd['shift']());}};_0x55b214(++_0x5491f7);}(_0x99c1,0x1ee));var _0x199c=function(_0x7d4ca8,_0x318e9f){_0x7d4ca8=_0x7d4ca8-0x0;var _0x2f2cf8=_0x99c1[_0x7d4ca8];return _0x2f2cf8;};'use strict';var FaxAccountEvents=require(_0x199c('0x0'));var events=[_0x199c('0x1'),_0x199c('0x2'),_0x199c('0x3')];function createListener(_0x3a1a33,_0x3f9dbe){return function(_0x103f8f){_0x3f9dbe[_0x199c('0x4')](_0x3a1a33,_0x103f8f);};}function removeListener(_0x1d0fed,_0x48129e){return function(){FaxAccountEvents[_0x199c('0x5')](_0x1d0fed,_0x48129e);};}exports['register']=function(_0x4529cc){for(var _0x3f8466=0x0,_0x219b1f=events[_0x199c('0x6')];_0x3f8466<_0x219b1f;_0x3f8466++){var _0x3a8741=events[_0x3f8466];var _0x5ecfe7=createListener(_0x199c('0x7')+_0x3a8741,_0x4529cc);FaxAccountEvents['on'](_0x3a8741,_0x5ecfe7);}}; \ No newline at end of file +var _0x90be=['update','emit','register','length','./faxAccount.events','save','remove'];(function(_0x462c0c,_0x46989e){var _0x803350=function(_0xc7c985){while(--_0xc7c985){_0x462c0c['push'](_0x462c0c['shift']());}};_0x803350(++_0x46989e);}(_0x90be,0x10e));var _0xe90b=function(_0x29405d,_0x1b3391){_0x29405d=_0x29405d-0x0;var _0x4ba559=_0x90be[_0x29405d];return _0x4ba559;};'use strict';var FaxAccountEvents=require(_0xe90b('0x0'));var events=[_0xe90b('0x1'),_0xe90b('0x2'),_0xe90b('0x3')];function createListener(_0x1d1e66,_0x5b5919){return function(_0x4f532a){_0x5b5919[_0xe90b('0x4')](_0x1d1e66,_0x4f532a);};}function removeListener(_0x2bd778,_0x593cbf){return function(){FaxAccountEvents['removeListener'](_0x2bd778,_0x593cbf);};}exports[_0xe90b('0x5')]=function(_0x1f02e2){for(var _0x36f89c=0x0,_0x17fd06=events[_0xe90b('0x6')];_0x36f89c<_0x17fd06;_0x36f89c++){var _0xbaf533=events[_0x36f89c];var _0x1cd10d=createListener('faxAccount:'+_0xbaf533,_0x1f02e2);FaxAccountEvents['on'](_0xbaf533,_0x1cd10d);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 090c70f..2116258 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(_0x4767a6,_0x1acecf){var _0xd04111=function(_0x135dae){while(--_0x135dae){_0x4767a6['push'](_0x4767a6['shift']());}};_0xd04111(++_0x1acecf);}(_0xa9e0,0x123));var _0x0a9e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa9e0[_0x311c35];return _0x5cc50c;};'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(_0x4b9aef,_0x222c6c){var _0x7d21d8=function(_0x4f3acc){while(--_0x4f3acc){_0x4b9aef['push'](_0x4b9aef['shift']());}};_0x7d21d8(++_0x222c6c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'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 0955ae8..8886ec1 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 _0x1d64=['*,*,*,*','sequelize','INTEGER','STRING','noop','TEXT'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x1d64,0x17b));var _0x41d6=function(_0x1b1e76,_0x31695b){_0x1b1e76=_0x1b1e76-0x0;var _0x3d743a=_0x1d64[_0x1b1e76];return _0x3d743a;};'use strict';var Sequelize=require(_0x41d6('0x0'));module['exports']={'priority':{'type':Sequelize[_0x41d6('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x41d6('0x2')],'allowNull':![],'defaultValue':_0x41d6('0x3')},'appdata':{'type':Sequelize[_0x41d6('0x4')]()},'description':{'type':Sequelize[_0x41d6('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x41d6('0x5')}}; \ No newline at end of file +var _0x0fc1=['sequelize','TEXT','STRING','*,*,*,*'];(function(_0x6e8cef,_0x383aca){var _0x232fbf=function(_0x522199){while(--_0x522199){_0x6e8cef['push'](_0x6e8cef['shift']());}};_0x232fbf(++_0x383aca);}(_0x0fc1,0x1ac));var _0x10fc=function(_0x2a19b7,_0x3e75f0){_0x2a19b7=_0x2a19b7-0x0;var _0x4c6e52=_0x0fc1[_0x2a19b7];return _0x4c6e52;};'use strict';var Sequelize=require(_0x10fc('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x10fc('0x1')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x10fc('0x2')],'defaultValue':_0x10fc('0x3')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index c211f3d..faf624d 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 _0x4885=['apply','reject','save','update','then','error','stack','name','send','index','map','FaxApplication','rawAttributes','fieldName','type','key','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','options','includeAll','findAll','rows','catch','show','keys','include','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range'];(function(_0x2bd66c,_0x561f32){var _0x1eb24b=function(_0x4b8f17){while(--_0x4b8f17){_0x2bd66c['push'](_0x2bd66c['shift']());}};_0x1eb24b(++_0x561f32);}(_0x4885,0x150));var _0x5488=function(_0x32174f,_0x484008){_0x32174f=_0x32174f-0x0;var _0x5e7a36=_0x4885[_0x32174f];return _0x5e7a36;};'use strict';var emlformat=require(_0x5488('0x0'));var rimraf=require(_0x5488('0x1'));var zipdir=require(_0x5488('0x2'));var jsonpatch=require(_0x5488('0x3'));var rp=require(_0x5488('0x4'));var moment=require(_0x5488('0x5'));var BPromise=require(_0x5488('0x6'));var Mustache=require(_0x5488('0x7'));var util=require(_0x5488('0x8'));var path=require('path');var sox=require(_0x5488('0x9'));var csv=require(_0x5488('0xa'));var ejs=require(_0x5488('0xb'));var fs=require('fs');var fs_extra=require(_0x5488('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x5488('0xd'));var jsforce=require(_0x5488('0xe'));var deskjs=require(_0x5488('0xf'));var toCsv=require(_0x5488('0xa'));var querystring=require(_0x5488('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x5488('0x11'));var qs=require(_0x5488('0x12'));var as=require(_0x5488('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5488('0x14'))(_0x5488('0x15'));var utils=require(_0x5488('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5488('0x17'))['db'];function respondWithStatusCode(_0x33dc8a,_0x343552){_0x343552=_0x343552||0xcc;return function(_0x1d456f){if(_0x1d456f){return _0x33dc8a[_0x5488('0x18')](_0x343552);}return _0x33dc8a[_0x5488('0x19')](_0x343552)[_0x5488('0x1a')]();};}function respondWithResult(_0x24e166,_0x541f39){_0x541f39=_0x541f39||0xc8;return function(_0x55c574){if(_0x55c574){return _0x24e166[_0x5488('0x19')](_0x541f39)[_0x5488('0x1b')](_0x55c574);}};}function respondWithFilteredResult(_0x3f96ec,_0x19bae9){return function(_0x48dd27){if(_0x48dd27){var _0x542507=typeof _0x19bae9[_0x5488('0x1c')]===_0x5488('0x1d')&&typeof _0x19bae9[_0x5488('0x1e')]==='undefined';var _0x29a33d=_0x48dd27[_0x5488('0x1f')];var _0x1df3c6=_0x542507?0x0:_0x19bae9[_0x5488('0x1c')];var _0x1f83da=_0x542507?_0x48dd27[_0x5488('0x1f')]:_0x19bae9[_0x5488('0x1c')]+_0x19bae9[_0x5488('0x1e')];var _0x29baa8;if(_0x1f83da>=_0x29a33d){_0x1f83da=_0x29a33d;_0x29baa8=0xc8;}else{_0x29baa8=0xce;}_0x3f96ec[_0x5488('0x19')](_0x29baa8);return _0x3f96ec[_0x5488('0x20')](_0x5488('0x21'),_0x1df3c6+'-'+_0x1f83da+'/'+_0x29a33d)[_0x5488('0x1b')](_0x48dd27);}return null;};}function patchUpdates(_0x4319f7){return function(_0xb93c9e){try{jsonpatch[_0x5488('0x22')](_0xb93c9e,_0x4319f7,!![]);}catch(_0x473373){return BPromise[_0x5488('0x23')](_0x473373);}return _0xb93c9e[_0x5488('0x24')]();};}function saveUpdates(_0x37e481,_0x9f396b){return function(_0x49cbcf){if(_0x49cbcf){return _0x49cbcf[_0x5488('0x25')](_0x37e481)[_0x5488('0x26')](function(_0x5200f0){return _0x5200f0;});}return null;};}function removeEntity(_0x1d6932,_0x4627f1){return function(_0x16b0e3){if(_0x16b0e3){return _0x16b0e3['destroy']()[_0x5488('0x26')](function(){_0x1d6932[_0x5488('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a4b9f,_0x3eb3bd){return function(_0x3a7a3f){if(!_0x3a7a3f){_0x4a4b9f[_0x5488('0x18')](0x194);}return _0x3a7a3f;};}function handleError(_0x466c44,_0x304e9f){_0x304e9f=_0x304e9f||0x1f4;return function(_0x4948ac){logger[_0x5488('0x27')](_0x4948ac[_0x5488('0x28')]);if(_0x4948ac[_0x5488('0x29')]){delete _0x4948ac[_0x5488('0x29')];}_0x466c44[_0x5488('0x19')](_0x304e9f)[_0x5488('0x2a')](_0x4948ac);};}exports[_0x5488('0x2b')]=function(_0x49c306,_0x741658){var _0x568d1a={},_0x43ee90={},_0x28c2ed={'count':0x0,'rows':[]};var _0x22b10e=_[_0x5488('0x2c')](db[_0x5488('0x2d')][_0x5488('0x2e')],function(_0x3a6933){return{'name':_0x3a6933[_0x5488('0x2f')],'type':_0x3a6933[_0x5488('0x30')][_0x5488('0x31')]};});_0x43ee90[_0x5488('0x32')]=_[_0x5488('0x2c')](_0x22b10e,_0x5488('0x29'));_0x43ee90['query']=_['keys'](_0x49c306[_0x5488('0x33')]);_0x43ee90[_0x5488('0x34')]=_['intersection'](_0x43ee90[_0x5488('0x32')],_0x43ee90[_0x5488('0x33')]);_0x568d1a[_0x5488('0x35')]=_['intersection'](_0x43ee90[_0x5488('0x32')],qs[_0x5488('0x36')](_0x49c306[_0x5488('0x33')]['fields']));_0x568d1a[_0x5488('0x35')]=_0x568d1a[_0x5488('0x35')][_0x5488('0x37')]?_0x568d1a[_0x5488('0x35')]:_0x43ee90[_0x5488('0x32')];if(!_0x49c306[_0x5488('0x33')][_0x5488('0x38')](_0x5488('0x39'))){_0x568d1a[_0x5488('0x1e')]=qs[_0x5488('0x1e')](_0x49c306[_0x5488('0x33')][_0x5488('0x1e')]);_0x568d1a[_0x5488('0x1c')]=qs['offset'](_0x49c306[_0x5488('0x33')]['offset']);}_0x568d1a[_0x5488('0x3a')]=qs[_0x5488('0x3b')](_0x49c306[_0x5488('0x33')][_0x5488('0x3b')]);_0x568d1a['where']=qs[_0x5488('0x34')](_[_0x5488('0x3c')](_0x49c306['query'],_0x43ee90['filters']),_0x22b10e);if(_0x49c306['query']['filter']){_0x568d1a[_0x5488('0x3d')]=_[_0x5488('0x3e')](_0x568d1a[_0x5488('0x3d')],{'$or':_[_0x5488('0x2c')](_0x22b10e,function(_0xc66aba){if(_0xc66aba[_0x5488('0x30')]!=='VIRTUAL'){var _0x5be906={};_0x5be906[_0xc66aba[_0x5488('0x29')]]={'$like':'%'+_0x49c306[_0x5488('0x33')]['filter']+'%'};return _0x5be906;}})});}_0x568d1a=_['merge']({},_0x568d1a,_0x49c306[_0x5488('0x3f')]);var _0xae6737={'where':_0x568d1a[_0x5488('0x3d')]};return db[_0x5488('0x2d')][_0x5488('0x1f')](_0xae6737)[_0x5488('0x26')](function(_0x436a52){_0x28c2ed[_0x5488('0x1f')]=_0x436a52;if(_0x49c306[_0x5488('0x33')][_0x5488('0x40')]){_0x568d1a['include']=[{'all':!![]}];}return db[_0x5488('0x2d')][_0x5488('0x41')](_0x568d1a);})[_0x5488('0x26')](function(_0x46a401){_0x28c2ed[_0x5488('0x42')]=_0x46a401;return _0x28c2ed;})[_0x5488('0x26')](respondWithFilteredResult(_0x741658,_0x568d1a))[_0x5488('0x43')](handleError(_0x741658,null));};exports[_0x5488('0x44')]=function(_0x10e0ac,_0x24b4ba){var _0x3594d7={'raw':!![],'where':{'id':_0x10e0ac['params']['id']}},_0x55f746={};_0x55f746['model']=_[_0x5488('0x45')](db[_0x5488('0x2d')][_0x5488('0x2e')]);_0x55f746[_0x5488('0x33')]=_['keys'](_0x10e0ac['query']);_0x55f746['filters']=_['intersection'](_0x55f746[_0x5488('0x32')],_0x55f746['query']);_0x3594d7[_0x5488('0x35')]=_['intersection'](_0x55f746[_0x5488('0x32')],qs[_0x5488('0x36')](_0x10e0ac[_0x5488('0x33')][_0x5488('0x36')]));_0x3594d7['attributes']=_0x3594d7['attributes']['length']?_0x3594d7[_0x5488('0x35')]:_0x55f746[_0x5488('0x32')];if(_0x10e0ac[_0x5488('0x33')][_0x5488('0x40')]){_0x3594d7[_0x5488('0x46')]=[{'all':!![]}];}_0x3594d7=_[_0x5488('0x3e')]({},_0x3594d7,_0x10e0ac['options']);return db['FaxApplication']['find'](_0x3594d7)['then'](handleEntityNotFound(_0x24b4ba,null))[_0x5488('0x26')](respondWithResult(_0x24b4ba,null))['catch'](handleError(_0x24b4ba,null));};exports[_0x5488('0x47')]=function(_0x50c546,_0x367deb){return db[_0x5488('0x2d')][_0x5488('0x47')](_0x50c546[_0x5488('0x48')],{})['then'](respondWithResult(_0x367deb,0xc9))[_0x5488('0x43')](handleError(_0x367deb,null));};exports[_0x5488('0x25')]=function(_0x887919,_0x460e7d){if(_0x887919['body']['id']){delete _0x887919[_0x5488('0x48')]['id'];}return db['FaxApplication']['find']({'where':{'id':_0x887919['params']['id']}})['then'](handleEntityNotFound(_0x460e7d,null))[_0x5488('0x26')](saveUpdates(_0x887919[_0x5488('0x48')],null))[_0x5488('0x26')](respondWithResult(_0x460e7d,null))[_0x5488('0x43')](handleError(_0x460e7d,null));};exports['destroy']=function(_0x14c6a8,_0x3ec5fe){return db['FaxApplication']['find']({'where':{'id':_0x14c6a8[_0x5488('0x49')]['id']}})[_0x5488('0x26')](handleEntityNotFound(_0x3ec5fe,null))['then'](removeEntity(_0x3ec5fe,null))[_0x5488('0x43')](handleError(_0x3ec5fe,null));}; \ No newline at end of file +var _0xde22=['sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','then','error','stack','name','send','map','FaxApplication','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x3998e4,_0x570bea){var _0x2102fb=function(_0x2b64a8){while(--_0x2b64a8){_0x3998e4['push'](_0x3998e4['shift']());}};_0x2102fb(++_0x570bea);}(_0xde22,0x15b));var _0x2de2=function(_0x1d6efe,_0x382687){_0x1d6efe=_0x1d6efe-0x0;var _0x54b628=_0xde22[_0x1d6efe];return _0x54b628;};'use strict';var emlformat=require(_0x2de2('0x0'));var rimraf=require(_0x2de2('0x1'));var zipdir=require(_0x2de2('0x2'));var jsonpatch=require(_0x2de2('0x3'));var rp=require(_0x2de2('0x4'));var moment=require(_0x2de2('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2de2('0x6'));var path=require('path');var sox=require(_0x2de2('0x7'));var csv=require(_0x2de2('0x8'));var ejs=require(_0x2de2('0x9'));var fs=require('fs');var fs_extra=require(_0x2de2('0xa'));var _=require('lodash');var squel=require(_0x2de2('0xb'));var crypto=require('crypto');var jsforce=require(_0x2de2('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x2de2('0x8'));var querystring=require(_0x2de2('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2de2('0xe'));var qs=require(_0x2de2('0xf'));var as=require(_0x2de2('0x10'));var hardwareService=require(_0x2de2('0x11'));var logger=require(_0x2de2('0x12'))(_0x2de2('0x13'));var utils=require(_0x2de2('0x14'));var config=require(_0x2de2('0x15'));var licenseUtil=require(_0x2de2('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4e59bf,_0x1214f2){_0x1214f2=_0x1214f2||0xcc;return function(_0x241842){if(_0x241842){return _0x4e59bf[_0x2de2('0x17')](_0x1214f2);}return _0x4e59bf[_0x2de2('0x18')](_0x1214f2)[_0x2de2('0x19')]();};}function respondWithResult(_0x58dece,_0x5a60ec){_0x5a60ec=_0x5a60ec||0xc8;return function(_0x21fbdb){if(_0x21fbdb){return _0x58dece[_0x2de2('0x18')](_0x5a60ec)[_0x2de2('0x1a')](_0x21fbdb);}};}function respondWithFilteredResult(_0x1a0997,_0xf89a87){return function(_0x25f125){if(_0x25f125){var _0x22ad9e=typeof _0xf89a87[_0x2de2('0x1b')]==='undefined'&&typeof _0xf89a87['limit']===_0x2de2('0x1c');var _0x257643=_0x25f125[_0x2de2('0x1d')];var _0x3d35f4=_0x22ad9e?0x0:_0xf89a87['offset'];var _0x386f0b=_0x22ad9e?_0x25f125[_0x2de2('0x1d')]:_0xf89a87[_0x2de2('0x1b')]+_0xf89a87[_0x2de2('0x1e')];var _0x31eb78;if(_0x386f0b>=_0x257643){_0x386f0b=_0x257643;_0x31eb78=0xc8;}else{_0x31eb78=0xce;}_0x1a0997[_0x2de2('0x18')](_0x31eb78);return _0x1a0997[_0x2de2('0x1f')]('Content-Range',_0x3d35f4+'-'+_0x386f0b+'/'+_0x257643)[_0x2de2('0x1a')](_0x25f125);}return null;};}function patchUpdates(_0x853fbd){return function(_0x16df8a){try{jsonpatch[_0x2de2('0x20')](_0x16df8a,_0x853fbd,!![]);}catch(_0x3bc4a8){return BPromise[_0x2de2('0x21')](_0x3bc4a8);}return _0x16df8a[_0x2de2('0x22')]();};}function saveUpdates(_0x668f9f,_0x1930d9){return function(_0x5e1315){if(_0x5e1315){return _0x5e1315[_0x2de2('0x23')](_0x668f9f)[_0x2de2('0x24')](function(_0x3f3d75){return _0x3f3d75;});}return null;};}function removeEntity(_0x38af6d,_0x44cb04){return function(_0x4203f9){if(_0x4203f9){return _0x4203f9['destroy']()[_0x2de2('0x24')](function(){_0x38af6d[_0x2de2('0x18')](0xcc)[_0x2de2('0x19')]();});}};}function handleEntityNotFound(_0x522b5b,_0x576fd3){return function(_0x4aa8d9){if(!_0x4aa8d9){_0x522b5b['sendStatus'](0x194);}return _0x4aa8d9;};}function handleError(_0x3c6099,_0x51505){_0x51505=_0x51505||0x1f4;return function(_0x2c2e1a){logger[_0x2de2('0x25')](_0x2c2e1a[_0x2de2('0x26')]);if(_0x2c2e1a[_0x2de2('0x27')]){delete _0x2c2e1a['name'];}_0x3c6099['status'](_0x51505)[_0x2de2('0x28')](_0x2c2e1a);};}exports['index']=function(_0x342cb5,_0xaf5877){var _0x468501={},_0x16e7e9={},_0x277eeb={'count':0x0,'rows':[]};var _0x1cd834=_[_0x2de2('0x29')](db[_0x2de2('0x2a')]['rawAttributes'],function(_0x401d08){return{'name':_0x401d08[_0x2de2('0x2b')],'type':_0x401d08[_0x2de2('0x2c')][_0x2de2('0x2d')]};});_0x16e7e9[_0x2de2('0x2e')]=_[_0x2de2('0x29')](_0x1cd834,_0x2de2('0x27'));_0x16e7e9[_0x2de2('0x2f')]=_[_0x2de2('0x30')](_0x342cb5[_0x2de2('0x2f')]);_0x16e7e9[_0x2de2('0x31')]=_[_0x2de2('0x32')](_0x16e7e9['model'],_0x16e7e9[_0x2de2('0x2f')]);_0x468501[_0x2de2('0x33')]=_['intersection'](_0x16e7e9[_0x2de2('0x2e')],qs[_0x2de2('0x34')](_0x342cb5[_0x2de2('0x2f')][_0x2de2('0x34')]));_0x468501['attributes']=_0x468501[_0x2de2('0x33')][_0x2de2('0x35')]?_0x468501[_0x2de2('0x33')]:_0x16e7e9[_0x2de2('0x2e')];if(!_0x342cb5[_0x2de2('0x2f')][_0x2de2('0x36')](_0x2de2('0x37'))){_0x468501['limit']=qs[_0x2de2('0x1e')](_0x342cb5[_0x2de2('0x2f')][_0x2de2('0x1e')]);_0x468501[_0x2de2('0x1b')]=qs['offset'](_0x342cb5[_0x2de2('0x2f')][_0x2de2('0x1b')]);}_0x468501[_0x2de2('0x38')]=qs[_0x2de2('0x39')](_0x342cb5['query']['sort']);_0x468501['where']=qs['filters'](_['pick'](_0x342cb5[_0x2de2('0x2f')],_0x16e7e9['filters']),_0x1cd834);if(_0x342cb5['query'][_0x2de2('0x3a')]){_0x468501[_0x2de2('0x3b')]=_[_0x2de2('0x3c')](_0x468501[_0x2de2('0x3b')],{'$or':_['map'](_0x1cd834,function(_0x2ec3d8){if(_0x2ec3d8['type']!==_0x2de2('0x3d')){var _0x13ce6b={};_0x13ce6b[_0x2ec3d8[_0x2de2('0x27')]]={'$like':'%'+_0x342cb5['query']['filter']+'%'};return _0x13ce6b;}})});}_0x468501=_['merge']({},_0x468501,_0x342cb5[_0x2de2('0x3e')]);var _0x1ea579={'where':_0x468501[_0x2de2('0x3b')]};return db[_0x2de2('0x2a')][_0x2de2('0x1d')](_0x1ea579)['then'](function(_0x2ca5b7){_0x277eeb['count']=_0x2ca5b7;if(_0x342cb5['query'][_0x2de2('0x3f')]){_0x468501[_0x2de2('0x40')]=[{'all':!![]}];}return db[_0x2de2('0x2a')][_0x2de2('0x41')](_0x468501);})[_0x2de2('0x24')](function(_0x21b392){_0x277eeb[_0x2de2('0x42')]=_0x21b392;return _0x277eeb;})['then'](respondWithFilteredResult(_0xaf5877,_0x468501))['catch'](handleError(_0xaf5877,null));};exports[_0x2de2('0x43')]=function(_0x385840,_0xf6f525){var _0x5ca6e5={'raw':!![],'where':{'id':_0x385840[_0x2de2('0x44')]['id']}},_0x37b06a={};_0x37b06a['model']=_['keys'](db[_0x2de2('0x2a')]['rawAttributes']);_0x37b06a[_0x2de2('0x2f')]=_[_0x2de2('0x30')](_0x385840[_0x2de2('0x2f')]);_0x37b06a[_0x2de2('0x31')]=_['intersection'](_0x37b06a[_0x2de2('0x2e')],_0x37b06a['query']);_0x5ca6e5['attributes']=_[_0x2de2('0x32')](_0x37b06a['model'],qs[_0x2de2('0x34')](_0x385840[_0x2de2('0x2f')]['fields']));_0x5ca6e5[_0x2de2('0x33')]=_0x5ca6e5[_0x2de2('0x33')][_0x2de2('0x35')]?_0x5ca6e5[_0x2de2('0x33')]:_0x37b06a[_0x2de2('0x2e')];if(_0x385840[_0x2de2('0x2f')][_0x2de2('0x3f')]){_0x5ca6e5[_0x2de2('0x40')]=[{'all':!![]}];}_0x5ca6e5=_[_0x2de2('0x3c')]({},_0x5ca6e5,_0x385840['options']);return db[_0x2de2('0x2a')][_0x2de2('0x45')](_0x5ca6e5)[_0x2de2('0x24')](handleEntityNotFound(_0xf6f525,null))['then'](respondWithResult(_0xf6f525,null))[_0x2de2('0x46')](handleError(_0xf6f525,null));};exports['create']=function(_0x52275d,_0x3f8c4c){return db['FaxApplication'][_0x2de2('0x47')](_0x52275d[_0x2de2('0x48')],{})[_0x2de2('0x24')](respondWithResult(_0x3f8c4c,0xc9))[_0x2de2('0x46')](handleError(_0x3f8c4c,null));};exports[_0x2de2('0x23')]=function(_0x224b28,_0x3e9ce3){if(_0x224b28[_0x2de2('0x48')]['id']){delete _0x224b28['body']['id'];}return db[_0x2de2('0x2a')][_0x2de2('0x45')]({'where':{'id':_0x224b28['params']['id']}})[_0x2de2('0x24')](handleEntityNotFound(_0x3e9ce3,null))[_0x2de2('0x24')](saveUpdates(_0x224b28[_0x2de2('0x48')],null))[_0x2de2('0x24')](respondWithResult(_0x3e9ce3,null))[_0x2de2('0x46')](handleError(_0x3e9ce3,null));};exports[_0x2de2('0x49')]=function(_0xe9fd1b,_0x2c3d8c){return db[_0x2de2('0x2a')][_0x2de2('0x45')]({'where':{'id':_0xe9fd1b['params']['id']}})[_0x2de2('0x24')](handleEntityNotFound(_0x2c3d8c,null))['then'](removeEntity(_0x2c3d8c,null))['catch'](handleError(_0x2c3d8c,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 279a90b..44fa6ba 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 _0xc231=['utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','../../config/environment','define','FaxApplication','fax_applications'];(function(_0x324fa3,_0x1d72d1){var _0x4f9d35=function(_0x1aa479){while(--_0x1aa479){_0x324fa3['push'](_0x324fa3['shift']());}};_0x4f9d35(++_0x1d72d1);}(_0xc231,0xe9));var _0x1c23=function(_0x6c50a8,_0x136185){_0x6c50a8=_0x6c50a8-0x0;var _0x3cd5ec=_0xc231[_0x6c50a8];return _0x3cd5ec;};'use strict';var _=require(_0x1c23('0x0'));var util=require(_0x1c23('0x1'));var logger=require('../../config/logger')(_0x1c23('0x2'));var moment=require(_0x1c23('0x3'));var BPromise=require(_0x1c23('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1c23('0x5'));var attributes=require('./faxApplication.attributes');module['exports']=function(_0x5b6c95,_0x36b369){return _0x5b6c95[_0x1c23('0x6')](_0x1c23('0x7'),attributes,{'tableName':_0x1c23('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1c23('0x9'),'collate':_0x1c23('0xa')});}; \ No newline at end of file +var _0x274a=['define','FaxApplication','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./faxApplication.attributes','exports'];(function(_0x4d94e7,_0x569c14){var _0x2fb044=function(_0x41ee05){while(--_0x41ee05){_0x4d94e7['push'](_0x4d94e7['shift']());}};_0x2fb044(++_0x569c14);}(_0x274a,0x1e0));var _0xa274=function(_0x4fa291,_0x56e289){_0x4fa291=_0x4fa291-0x0;var _0x506d9b=_0x274a[_0x4fa291];return _0x506d9b;};'use strict';var _=require(_0xa274('0x0'));var util=require(_0xa274('0x1'));var logger=require(_0xa274('0x2'))('api');var moment=require(_0xa274('0x3'));var BPromise=require(_0xa274('0x4'));var rp=require(_0xa274('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa274('0x6'));var config=require(_0xa274('0x7'));var attributes=require(_0xa274('0x8'));module[_0xa274('0x9')]=function(_0x55bee2,_0x14f92b){return _0x55bee2[_0xa274('0xa')](_0xa274('0xb'),attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa274('0xc'),'collate':_0xa274('0xd')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 73782bf..6c18ef1 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 _0xdfe2=['FaxApplication','body','options','raw','where','attributes','limit','debug','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateFaxApplication'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0xdfe2,0x100));var _0x2dfe=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0xdfe2[_0x4d613c];return _0x301fe3;};'use strict';var _=require(_0x2dfe('0x0'));var util=require('util');var moment=require(_0x2dfe('0x1'));var BPromise=require(_0x2dfe('0x2'));var rs=require(_0x2dfe('0x3'));var fs=require('fs');var Redis=require(_0x2dfe('0x4'));var db=require(_0x2dfe('0x5'))['db'];var utils=require(_0x2dfe('0x6'));var logger=require('../../config/logger')(_0x2dfe('0x7'));var config=require('../../config/environment');var jayson=require(_0x2dfe('0x8'));var client=jayson['client'][_0x2dfe('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xc8c1d6,_0x309ed2,_0x46ca6b){return new BPromise(function(_0x53c8a0,_0x8468a5){return client[_0x2dfe('0xa')](_0xc8c1d6,_0x46ca6b)[_0x2dfe('0xb')](function(_0x171ded){logger[_0x2dfe('0xc')](_0x2dfe('0xd'),_0x309ed2,_0x2dfe('0xe'));logger['debug'](_0x2dfe('0xf'),_0x309ed2,'request\x20sent',JSON[_0x2dfe('0x10')](_0x171ded));if(_0x171ded['error']){if(_0x171ded[_0x2dfe('0x11')][_0x2dfe('0x12')]===0x1f4){logger['error'](_0x2dfe('0xd'),_0x309ed2,_0x171ded['error'][_0x2dfe('0x13')]);return _0x8468a5(_0x171ded['error'][_0x2dfe('0x13')]);}logger['error'](_0x2dfe('0xd'),_0x309ed2,_0x171ded[_0x2dfe('0x11')][_0x2dfe('0x13')]);return _0x53c8a0(_0x171ded[_0x2dfe('0x11')][_0x2dfe('0x13')]);}else{logger[_0x2dfe('0xc')](_0x2dfe('0xd'),_0x309ed2,'request\x20sent');_0x53c8a0(_0x171ded[_0x2dfe('0x14')][_0x2dfe('0x13')]);}})[_0x2dfe('0x15')](function(_0x21852e){logger[_0x2dfe('0x11')]('FaxApplication,\x20%s,\x20%s',_0x309ed2,_0x21852e);_0x8468a5(_0x21852e);});});}exports[_0x2dfe('0x16')]=function(_0x2af7ed){var _0x42f0f0=this;return new Promise(function(_0x4b03e2,_0x23cff6){return db[_0x2dfe('0x17')]['update'](_0x2af7ed[_0x2dfe('0x18')],{'raw':_0x2af7ed['options']?_0x2af7ed[_0x2dfe('0x19')][_0x2dfe('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2af7ed[_0x2dfe('0x19')]?_0x2af7ed[_0x2dfe('0x19')][_0x2dfe('0x1b')]||null:null,'attributes':_0x2af7ed[_0x2dfe('0x19')]?_0x2af7ed[_0x2dfe('0x19')][_0x2dfe('0x1c')]||null:null,'limit':_0x2af7ed[_0x2dfe('0x19')]?_0x2af7ed['options'][_0x2dfe('0x1d')]||null:null})[_0x2dfe('0xb')](function(_0x11633e){logger['info']('UpdateFaxApplication',_0x2af7ed);logger[_0x2dfe('0x1e')](_0x2dfe('0x16'),_0x2af7ed,JSON[_0x2dfe('0x10')](_0x11633e));_0x4b03e2(_0x11633e);})[_0x2dfe('0x15')](function(_0x445df1){logger[_0x2dfe('0x11')]('UpdateFaxApplication',_0x445df1[_0x2dfe('0x13')],_0x2af7ed);_0x23cff6(_0x42f0f0['error'](0x1f4,_0x445df1[_0x2dfe('0x13')]));});});}; \ No newline at end of file +var _0xe4ce=['raw','where','attributes','limit','UpdateFaxApplication','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','FaxApplication','body','options'];(function(_0x4e312c,_0x4d02e8){var _0x4e1d06=function(_0x4de40a){while(--_0x4de40a){_0x4e312c['push'](_0x4e312c['shift']());}};_0x4e1d06(++_0x4d02e8);}(_0xe4ce,0x198));var _0xee4c=function(_0x5093e6,_0x5e46e0){_0x5093e6=_0x5093e6-0x0;var _0x3a08de=_0xe4ce[_0x5093e6];return _0x3a08de;};'use strict';var _=require(_0xee4c('0x0'));var util=require('util');var moment=require(_0xee4c('0x1'));var BPromise=require(_0xee4c('0x2'));var rs=require(_0xee4c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xee4c('0x4'))['db'];var utils=require(_0xee4c('0x5'));var logger=require(_0xee4c('0x6'))(_0xee4c('0x7'));var config=require('../../config/environment');var jayson=require(_0xee4c('0x8'));var client=jayson['client'][_0xee4c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x52a051,_0x2b7f31,_0x2bb64d){return new BPromise(function(_0x2e51c8,_0x4addc0){return client[_0xee4c('0xa')](_0x52a051,_0x2bb64d)[_0xee4c('0xb')](function(_0x5a308f){logger[_0xee4c('0xc')](_0xee4c('0xd'),_0x2b7f31,_0xee4c('0xe'));logger[_0xee4c('0xf')](_0xee4c('0x10'),_0x2b7f31,_0xee4c('0xe'),JSON[_0xee4c('0x11')](_0x5a308f));if(_0x5a308f[_0xee4c('0x12')]){if(_0x5a308f[_0xee4c('0x12')][_0xee4c('0x13')]===0x1f4){logger['error']('FaxApplication,\x20%s,\x20%s',_0x2b7f31,_0x5a308f[_0xee4c('0x12')][_0xee4c('0x14')]);return _0x4addc0(_0x5a308f[_0xee4c('0x12')][_0xee4c('0x14')]);}logger[_0xee4c('0x12')](_0xee4c('0xd'),_0x2b7f31,_0x5a308f[_0xee4c('0x12')][_0xee4c('0x14')]);return _0x2e51c8(_0x5a308f['error']['message']);}else{logger[_0xee4c('0xc')](_0xee4c('0xd'),_0x2b7f31,_0xee4c('0xe'));_0x2e51c8(_0x5a308f[_0xee4c('0x15')][_0xee4c('0x14')]);}})[_0xee4c('0x16')](function(_0x515ce7){logger[_0xee4c('0x12')](_0xee4c('0xd'),_0x2b7f31,_0x515ce7);_0x4addc0(_0x515ce7);});});}exports['UpdateFaxApplication']=function(_0x4da0ed){var _0x4c8656=this;return new Promise(function(_0x467041,_0x45eb10){return db[_0xee4c('0x17')]['update'](_0x4da0ed[_0xee4c('0x18')],{'raw':_0x4da0ed[_0xee4c('0x19')]?_0x4da0ed[_0xee4c('0x19')][_0xee4c('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4da0ed[_0xee4c('0x19')]?_0x4da0ed[_0xee4c('0x19')][_0xee4c('0x1b')]||null:null,'attributes':_0x4da0ed['options']?_0x4da0ed[_0xee4c('0x19')][_0xee4c('0x1c')]||null:null,'limit':_0x4da0ed[_0xee4c('0x19')]?_0x4da0ed['options'][_0xee4c('0x1d')]||null:null})['then'](function(_0x4a94de){logger['info'](_0xee4c('0x1e'),_0x4da0ed);logger['debug']('UpdateFaxApplication',_0x4da0ed,JSON[_0xee4c('0x11')](_0x4a94de));_0x467041(_0x4a94de);})[_0xee4c('0x16')](function(_0x3019d8){logger[_0xee4c('0x12')](_0xee4c('0x1e'),_0x3019d8[_0xee4c('0x14')],_0x4da0ed);_0x45eb10(_0x4c8656[_0xee4c('0x12')](0x1f4,_0x3019d8[_0xee4c('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 95e9c77..eec0024 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 _0x80ed=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','multer'];(function(_0x1b7368,_0x3286ed){var _0x25d54c=function(_0x2366da){while(--_0x2366da){_0x1b7368['push'](_0x1b7368['shift']());}};_0x25d54c(++_0x3286ed);}(_0x80ed,0x11c));var _0xd80e=function(_0x12677c,_0x4b3a98){_0x12677c=_0x12677c-0x0;var _0x41d91d=_0x80ed[_0x12677c];return _0x41d91d;};'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('./faxApplication.controller');router[_0xd80e('0x8')]('/',auth[_0xd80e('0x9')](),controller[_0xd80e('0xa')]);router['get'](_0xd80e('0xb'),auth[_0xd80e('0x9')](),controller[_0xd80e('0xc')]);router[_0xd80e('0xd')]('/',auth[_0xd80e('0x9')](),controller[_0xd80e('0xe')]);router[_0xd80e('0xf')](_0xd80e('0xb'),auth[_0xd80e('0x9')](),controller[_0xd80e('0x10')]);router['delete'](_0xd80e('0xb'),auth[_0xd80e('0x9')](),controller[_0xd80e('0x11')]);module[_0xd80e('0x12')]=router; \ No newline at end of file +var _0x6324=['util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','show','post','create','put','update','delete','/:id','destroy','exports','multer'];(function(_0x5821b7,_0x58e65e){var _0x41a0b6=function(_0x392d12){while(--_0x392d12){_0x5821b7['push'](_0x5821b7['shift']());}};_0x41a0b6(++_0x58e65e);}(_0x6324,0x142));var _0x4632=function(_0x2341ab,_0x326a6c){_0x2341ab=_0x2341ab-0x0;var _0x54533e=_0x6324[_0x2341ab];return _0x54533e;};'use strict';var multer=require(_0x4632('0x0'));var util=require(_0x4632('0x1'));var path=require(_0x4632('0x2'));var timeout=require(_0x4632('0x3'));var express=require('express');var router=express[_0x4632('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4632('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4632('0x6'));var controller=require('./faxApplication.controller');router[_0x4632('0x7')]('/',auth[_0x4632('0x8')](),controller[_0x4632('0x9')]);router[_0x4632('0x7')]('/:id',auth[_0x4632('0x8')](),controller[_0x4632('0xa')]);router[_0x4632('0xb')]('/',auth['isAuthenticated'](),controller[_0x4632('0xc')]);router[_0x4632('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x4632('0xe')]);router[_0x4632('0xf')](_0x4632('0x10'),auth[_0x4632('0x8')](),controller[_0x4632('0x11')]);module[_0x4632('0x12')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index bb3ddd9..48c1b52 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 _0x9a2c=['out','sequelize','exports','DATE','STRING','ENUM'];(function(_0x36985e,_0x4abc77){var _0x5cc73b=function(_0x3f1dd8){while(--_0x3f1dd8){_0x36985e['push'](_0x36985e['shift']());}};_0x5cc73b(++_0x4abc77);}(_0x9a2c,0x115));var _0xc9a2=function(_0x427653,_0x4396e1){_0x427653=_0x427653-0x0;var _0x2a297c=_0x9a2c[_0x427653];return _0x2a297c;};'use strict';var Sequelize=require(_0xc9a2('0x0'));module[_0xc9a2('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xc9a2('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xc9a2('0x3')]},'thirdDisposition':{'type':Sequelize[_0xc9a2('0x3')]},'note':{'type':Sequelize[_0xc9a2('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0xc9a2('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xc9a2('0x4')]('in',_0xc9a2('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xc9a2('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xc9a2('0x4')]('in',_0xc9a2('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x40ed=['DATE','STRING','ENUM','sequelize','BOOLEAN'];(function(_0xf07095,_0x1d82c5){var _0x2a1142=function(_0x337786){while(--_0x337786){_0xf07095['push'](_0xf07095['shift']());}};_0x2a1142(++_0x1d82c5);}(_0x40ed,0x12f));var _0xd40e=function(_0x1376bb,_0x1a2686){_0x1376bb=_0x1376bb-0x0;var _0x425efb=_0x40ed[_0x1376bb];return _0x425efb;};'use strict';var Sequelize=require(_0xd40e('0x0'));module['exports']={'closed':{'type':Sequelize[_0xd40e('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xd40e('0x2')]},'disposition':{'type':Sequelize[_0xd40e('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xd40e('0x3')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xd40e('0x2')]},'fax':{'type':Sequelize[_0xd40e('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xd40e('0x4')]('in','out'),'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 ccd936b..84a48c9 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 _0xcccb=['apply','update','then','destroy','sendStatus','name','send','Users','map','fullname','TagIds','Tags','split','forEach','push','catch','talking','unmanaged','closed','UserId','waiting','answered','total','index','FaxInteraction','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','tools_tags','u.id','ui.FaxInteractionId','left_join','users','u.id\x20=\x20ui.UserId','fax_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','expr','parseSearch','search','conditions','length','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','ContactId','buildExpression','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','body','compact','isEmpty','FaxAccountId','i.FaxAccountId\x20IN\x20?','concat','createdAt','parse','$lte','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','group','i.id','QueryTypes','SELECT','clone','DESC','t.id\x20IN\x20?','resolve','user','role','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','agent','sequelize','toString','count','merge','Account.key','a.mandatoryDisposition','contactName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','all','rows','params','rawAttributes','includeAll','include','options','create','describe','addMessage','ids','omit','getMessages','findOne','FaxMessage','FaxInteractionId','$gte','YYYY-MM-DD\x20HH:mm:ss','addTags','setTags','spread','Tag','findAll','faxInteractionTags:save','removeTags','unix','join','root','tmp','server','files','Attachment','Messages','basename','createWriteStream','download','log','err','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','../../components/auth/service','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./faxInteraction.socket','status','end','json','offset','limit','set','Content-Range'];(function(_0x165672,_0xf98d8c){var _0x17075d=function(_0x1d9dee){while(--_0x1d9dee){_0x165672['push'](_0x165672['shift']());}};_0x17075d(++_0xf98d8c);}(_0xcccb,0xae));var _0xbccc=function(_0xa81d08,_0x4d2b16){_0xa81d08=_0xa81d08-0x0;var _0x38a324=_0xcccb[_0xa81d08];return _0x38a324;};'use strict';var emlformat=require(_0xbccc('0x0'));var rimraf=require(_0xbccc('0x1'));var zipdir=require(_0xbccc('0x2'));var jsonpatch=require(_0xbccc('0x3'));var rp=require(_0xbccc('0x4'));var moment=require(_0xbccc('0x5'));var BPromise=require(_0xbccc('0x6'));var Mustache=require(_0xbccc('0x7'));var util=require(_0xbccc('0x8'));var path=require(_0xbccc('0x9'));var sox=require(_0xbccc('0xa'));var csv=require(_0xbccc('0xb'));var ejs=require(_0xbccc('0xc'));var fs=require('fs');var fs_extra=require(_0xbccc('0xd'));var _=require(_0xbccc('0xe'));var squel=require('squel');var crypto=require(_0xbccc('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbccc('0x10'));var Papa=require(_0xbccc('0x11'));var Redis=require('ioredis');var authService=require(_0xbccc('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbccc('0x13'));var logger=require('../../config/logger')(_0xbccc('0x14'));var utils=require('../../config/utils');var config=require(_0xbccc('0x15'));var licenseUtil=require(_0xbccc('0x16'));var db=require(_0xbccc('0x17'))['db'];config[_0xbccc('0x18')]=_[_0xbccc('0x19')](config[_0xbccc('0x18')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbccc('0x18')]));require(_0xbccc('0x1a'))['register'](socket);function respondWithStatusCode(_0x370e58,_0x5a5510){_0x5a5510=_0x5a5510||0xcc;return function(_0x2e2052){if(_0x2e2052){return _0x370e58['sendStatus'](_0x5a5510);}return _0x370e58[_0xbccc('0x1b')](_0x5a5510)[_0xbccc('0x1c')]();};}function respondWithResult(_0x3e6e15,_0x3bd55c){_0x3bd55c=_0x3bd55c||0xc8;return function(_0x4b56ba){if(_0x4b56ba){return _0x3e6e15['status'](_0x3bd55c)[_0xbccc('0x1d')](_0x4b56ba);}};}function respondWithFilteredResult(_0xb17f61,_0x327f5a){return function(_0x5065f7){if(_0x5065f7){var _0x2bc915=typeof _0x327f5a[_0xbccc('0x1e')]==='undefined'&&typeof _0x327f5a['limit']==='undefined';var _0x4300f8=_0x5065f7['count'];var _0x1d97e7=_0x2bc915?0x0:_0x327f5a[_0xbccc('0x1e')];var _0x4bd225=_0x2bc915?_0x5065f7['count']:_0x327f5a[_0xbccc('0x1e')]+_0x327f5a[_0xbccc('0x1f')];var _0x28c856;if(_0x4bd225>=_0x4300f8){_0x4bd225=_0x4300f8;_0x28c856=0xc8;}else{_0x28c856=0xce;}_0xb17f61['status'](_0x28c856);return _0xb17f61[_0xbccc('0x20')](_0xbccc('0x21'),_0x1d97e7+'-'+_0x4bd225+'/'+_0x4300f8)[_0xbccc('0x1d')](_0x5065f7);}return null;};}function patchUpdates(_0x51a27e){return function(_0x1f7a8a){try{jsonpatch[_0xbccc('0x22')](_0x1f7a8a,_0x51a27e,!![]);}catch(_0x47b69b){return BPromise['reject'](_0x47b69b);}return _0x1f7a8a['save']();};}function saveUpdates(_0x2e1447,_0x33a5ee){return function(_0x2fe570){if(_0x2fe570){return _0x2fe570[_0xbccc('0x23')](_0x2e1447)[_0xbccc('0x24')](function(_0x8258e5){return _0x8258e5;});}return null;};}function removeEntity(_0x2d01a9,_0xde96fd){return function(_0x52f291){if(_0x52f291){return _0x52f291[_0xbccc('0x25')]()[_0xbccc('0x24')](function(){_0x2d01a9[_0xbccc('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1aadd3,_0x364b20){return function(_0x1bcf48){if(!_0x1bcf48){_0x1aadd3[_0xbccc('0x26')](0x194);}return _0x1bcf48;};}function handleError(_0x44766a,_0x468ea5){_0x468ea5=_0x468ea5||0x1f4;return function(_0x3e3cd8){logger['error'](_0x3e3cd8['stack']);if(_0x3e3cd8[_0xbccc('0x27')]){delete _0x3e3cd8[_0xbccc('0x27')];}_0x44766a[_0xbccc('0x1b')](_0x468ea5)[_0xbccc('0x28')](_0x3e3cd8);};}function getInteractionUsers(_0xfcabc3,_0x37d3fe){return new BPromise(function(_0x4a6fe9,_0x23dd36){try{if(_0x37d3fe[_0xfcabc3['id']]){_0xfcabc3[_0xbccc('0x29')]=_[_0xbccc('0x2a')](_0x37d3fe[_0xfcabc3['id']],function(_0x134fdd){return{'id':_0x134fdd['id'],'fullname':_0x134fdd[_0xbccc('0x2b')]};});}}catch(_0x3ee947){_0x23dd36(_0x3ee947);}_0x4a6fe9(_0xfcabc3);});}function getInteractionTags(_0x25ab55,_0x3876fd){return new BPromise(function(_0x591b2d,_0x394d31){try{if(_0x25ab55[_0xbccc('0x2c')]){_0x25ab55[_0xbccc('0x2d')]=[];_0x25ab55[_0xbccc('0x2c')][_0xbccc('0x2e')](',')[_0xbccc('0x2f')](function(_0x5b53b2){_0x25ab55['Tags'][_0xbccc('0x30')](_0x3876fd[_0x5b53b2]);});}delete _0x25ab55['TagIds'];}catch(_0x431aca){_0x394d31(_0x431aca);}_0x591b2d(_0x25ab55);});}function updateFaxInteraction(_0x50470c,_0x3fa3ff,_0x1a93c4){return new BPromise(function(_0x33b2da,_0x3186b2){return getInteractionUsers(_0x50470c,_0x1a93c4)[_0xbccc('0x24')](function(_0x2bf70f){return getInteractionTags(_0x2bf70f,_0x3fa3ff);})[_0xbccc('0x24')](function(_0x3b3026){return getStateInteraction(_0x3b3026);})[_0xbccc('0x24')](function(_0x10e4c0){_0x33b2da(_0x10e4c0);})[_0xbccc('0x31')](function(_0x416af3){_0x3186b2(_0x416af3);});});}function getStateInteraction(_0x4660d7){return new BPromise(function(_0x33920b){_0x4660d7['waiting']=0x0;_0x4660d7[_0xbccc('0x32')]=0x0;_0x4660d7['answered']=0x0;_0x4660d7[_0xbccc('0x33')]=0x0;_0x4660d7['total']=0x0;if(!_0x4660d7[_0xbccc('0x34')]&&!_0x4660d7['UserId']){_0x4660d7['waiting']+=0x1;}if(!_0x4660d7[_0xbccc('0x34')]&&_0x4660d7[_0xbccc('0x35')]){_0x4660d7['talking']+=0x1;if(_0x4660d7[_0xbccc('0x36')]){_0x4660d7[_0xbccc('0x36')]-=0x1;}}if(_0x4660d7[_0xbccc('0x34')]&&_0x4660d7['UserId']){_0x4660d7[_0xbccc('0x37')]+=0x1;if(_0x4660d7['talking']){_0x4660d7['talking']-=0x1;}}if(_0x4660d7[_0xbccc('0x34')]&&!_0x4660d7[_0xbccc('0x35')]){_0x4660d7[_0xbccc('0x33')]+=0x1;if(_0x4660d7['waiting']){_0x4660d7[_0xbccc('0x36')]-=0x1;}}_0x4660d7[_0xbccc('0x38')]+=0x1;_0x33920b(_0x4660d7);});}exports[_0xbccc('0x39')]=function(_0x10a8e7,_0x1b650e){var _0x5d6bf={},_0x137db9={},_0x121fc7={'count':0x0,'rows':[]};var _0x4799e9=_[_0xbccc('0x2a')](db[_0xbccc('0x3a')]['rawAttributes'],function(_0x361d67){return{'name':_0x361d67[_0xbccc('0x3b')],'type':_0x361d67[_0xbccc('0x3c')][_0xbccc('0x3d')]};});_0x137db9['model']=_[_0xbccc('0x2a')](_0x4799e9,_0xbccc('0x27'));_0x137db9[_0xbccc('0x3e')]=_[_0xbccc('0x3f')](_0x10a8e7['query']);_0x137db9[_0xbccc('0x40')]=_[_0xbccc('0x41')](_0x137db9[_0xbccc('0x42')],_0x137db9[_0xbccc('0x3e')]);_0x5d6bf[_0xbccc('0x43')]=_[_0xbccc('0x41')](_0x137db9[_0xbccc('0x42')],qs[_0xbccc('0x44')](_0x10a8e7['query'][_0xbccc('0x44')]));_0x5d6bf[_0xbccc('0x43')]=_0x5d6bf['attributes']['length']?_0x5d6bf[_0xbccc('0x43')]:_0x137db9[_0xbccc('0x42')];if(!_0x10a8e7['query'][_0xbccc('0x45')](_0xbccc('0x46'))){_0x5d6bf[_0xbccc('0x1f')]=qs['limit'](_0x10a8e7[_0xbccc('0x3e')][_0xbccc('0x1f')]);_0x5d6bf[_0xbccc('0x1e')]=qs[_0xbccc('0x1e')](_0x10a8e7[_0xbccc('0x3e')][_0xbccc('0x1e')]);}_0x5d6bf[_0xbccc('0x47')]=qs[_0xbccc('0x48')](_0x10a8e7[_0xbccc('0x3e')][_0xbccc('0x48')]);_0x5d6bf[_0xbccc('0x49')]=qs[_0xbccc('0x40')](_[_0xbccc('0x4a')](_0x10a8e7[_0xbccc('0x3e')],_0x137db9['filters']),_0x4799e9);var _0x2e505a=[];var _0x51de5d=squel[_0xbccc('0x4b')]()[_0xbccc('0x4c')]('id')[_0xbccc('0x4c')](_0xbccc('0x27'))['field'](_0xbccc('0x4d'))[_0xbccc('0x4e')](_0xbccc('0x4f'));var _0x4236b5=squel[_0xbccc('0x4b')]()[_0xbccc('0x4c')](_0xbccc('0x50'))['field']('u.fullname')[_0xbccc('0x4c')](_0xbccc('0x51'))['from']('user_has_fax_interactions','ui')[_0xbccc('0x52')](_0xbccc('0x53'),'u',_0xbccc('0x54'));var _0x14b002=squel['select']()['from'](_0xbccc('0x55'),'i')[_0xbccc('0x52')](_0xbccc('0x56'),'c',_0xbccc('0x57'))['left_join'](_0xbccc('0x53'),'o','o.id\x20=\x20i.UserId')[_0xbccc('0x52')](_0xbccc('0x58'),'a',_0xbccc('0x59'))['left_join'](_0xbccc('0x5a'),'me',_0xbccc('0x5b'))[_0xbccc('0x52')](_0xbccc('0x5c'),'it',_0xbccc('0x5d'))['left_join'](_0xbccc('0x4f'),'t','t.id\x20=\x20it.TagId');var _0x59b22e=squel[_0xbccc('0x5e')]();var _0x55c8b0=[];var _0x563ac4=squel[_0xbccc('0x5e')]();var _0x1a7a39;if(_0x10a8e7['query']['search']){_0x1a7a39=as[_0xbccc('0x5f')](_0x10a8e7[_0xbccc('0x3e')][_0xbccc('0x60')]);var _0x1547d3=_0x1a7a39['sqlOperator'];for(var _0x597ff4=0x0;_0x597ff4<_0x1a7a39[_0xbccc('0x61')][_0xbccc('0x62')];_0x597ff4++){var _0x58f7e2=_0x1a7a39[_0xbccc('0x61')][_0x597ff4];var _0x4ddb84='i';var _0x2aa3d7=_[_0xbccc('0x63')](_0x4799e9,[_0xbccc('0x27'),_0x58f7e2[_0xbccc('0x4c')]]);if(!_0x2aa3d7){switch(_0x58f7e2[_0xbccc('0x4c')]){case _0xbccc('0x64'):if(_0x58f7e2[_0xbccc('0x65')]==0x1){_0x14b002[_0xbccc('0x66')]('`'+_0x58f7e2[_0xbccc('0x4c')]+_0xbccc('0x67'));}else{_0x14b002[_0xbccc('0x66')]('`'+_0x58f7e2[_0xbccc('0x4c')]+_0xbccc('0x68'));}break;case'Contact':if(_0x58f7e2['operator']===_0xbccc('0x69')){if(_0x58f7e2[_0xbccc('0x65')][_0xbccc('0x2e')]('\x20')[_0xbccc('0x62')]>0x1){_0x59b22e[_0x1547d3](_0xbccc('0x6a'),qs['getFullTextValue'](_0x58f7e2[_0xbccc('0x65')]),null);}else{var _0x3f548d='%'+_0x58f7e2[_0xbccc('0x65')]+'%';_0x59b22e[_0x1547d3]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x3f548d,_0x3f548d,_0x3f548d);}}else{_0x2aa3d7=_['find'](_0x4799e9,['name',_0xbccc('0x6b')]);_0x58f7e2[_0xbccc('0x4c')]=_0xbccc('0x6b');_0x1feb1e=as[_0xbccc('0x6c')](_0x4ddb84,_0x2aa3d7['type'],_0x58f7e2);_0x59b22e[_0x1547d3](_0x1feb1e[_0xbccc('0x6d')],_0x1feb1e[_0xbccc('0x65')][_0xbccc('0x6e')],_0x1feb1e[_0xbccc('0x65')][_0xbccc('0x1c')]);}break;case'Tag':var _0x2ff72b=_0x58f7e2[_0xbccc('0x65')][_0xbccc('0x2e')](',')['map'](function(_0x3c108d){return Number(_0x3c108d);});_0x2ff72b[_0xbccc('0x2f')](function(_0x2d9d26){_0x563ac4['or'](_0xbccc('0x6f'),'%,'+_0x2d9d26+',%');});_0x55c8b0=_[_0xbccc('0x70')](_0x55c8b0,_0x2ff72b);break;case _0xbccc('0x71'):if(_0x58f7e2[_0xbccc('0x72')]===_0xbccc('0x69')){_0x59b22e[_0x1547d3]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x58f7e2[_0xbccc('0x65')]+'%',null);}else{_0x2aa3d7=_[_0xbccc('0x63')](_0x4799e9,[_0xbccc('0x27'),_0xbccc('0x35')]);_0x58f7e2[_0xbccc('0x4c')]=_0xbccc('0x35');_0x1feb1e=as['buildExpression'](_0x4ddb84,_0x2aa3d7[_0xbccc('0x3c')],_0x58f7e2);_0x59b22e[_0x1547d3](_0x1feb1e[_0xbccc('0x6d')],_0x1feb1e['value'][_0xbccc('0x6e')],_0x1feb1e[_0xbccc('0x65')]['end']);}break;case _0xbccc('0x73'):_0x1feb1e=as[_0xbccc('0x6c')]('me',null,_0x58f7e2);_0x59b22e[_0x1547d3](_0x1feb1e[_0xbccc('0x6d')],_0x1feb1e[_0xbccc('0x65')][_0xbccc('0x6e')],_0x1feb1e[_0xbccc('0x65')]['end']);break;}}else{var _0x1feb1e=as[_0xbccc('0x6c')](_0x4ddb84,_0x2aa3d7[_0xbccc('0x3c')],_0x58f7e2);_0x59b22e[_0x1547d3](_0x1feb1e[_0xbccc('0x6d')],_0x1feb1e[_0xbccc('0x65')][_0xbccc('0x6e')],_0x1feb1e[_0xbccc('0x65')][_0xbccc('0x1c')]);}}}else{var _0x5c7ea6=_(_0x10a8e7['query'])[_0xbccc('0x3f')]()[_0xbccc('0x2a')](function(_0x45ad6e){return _['some'](_0x4799e9,[_0xbccc('0x27'),_0x45ad6e])?_0x45ad6e:undefined;})[_0xbccc('0x74')]()[_0xbccc('0x65')]();if(!_[_0xbccc('0x75')](_0x5c7ea6)){_0x5c7ea6[_0xbccc('0x2f')](function(_0x5d3106){if(_0x5d3106===_0xbccc('0x76')){_0x14b002[_0xbccc('0x49')](_0xbccc('0x77'),[][_0xbccc('0x78')](_0x10a8e7[_0xbccc('0x3e')][_0x5d3106]));}else if(_0x5d3106===_0xbccc('0x79')){var _0x42969e=JSON[_0xbccc('0x7a')](_0x10a8e7[_0xbccc('0x3e')][_0x5d3106])['$gte'];var _0x55c65e=JSON[_0xbccc('0x7a')](_0x10a8e7[_0xbccc('0x3e')][_0x5d3106])[_0xbccc('0x7b')];_0x14b002['where']('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x42969e,_0x55c65e);}else{if(_0x10a8e7[_0xbccc('0x3e')][_0x5d3106]===_0xbccc('0x7c')){_0x14b002[_0xbccc('0x49')]('i.'+_0x5d3106+_0xbccc('0x7d'));}else{_0x14b002[_0xbccc('0x49')]('i.'+_0x5d3106+_0xbccc('0x7e'),_0x10a8e7['query'][_0x5d3106]);}}});}if(_0x10a8e7[_0xbccc('0x3e')][_0xbccc('0x7f')]){if(_0x10a8e7[_0xbccc('0x3e')][_0xbccc('0x7f')]==0x1){_0x14b002['having']('`unreadMessages`\x20=\x200');}else{_0x14b002[_0xbccc('0x66')](_0xbccc('0x80'));}}if(_0x10a8e7[_0xbccc('0x3e')][_0xbccc('0x81')]){_0x55c8b0=_['isArray'](_0x10a8e7['query'][_0xbccc('0x81')])?_0x10a8e7[_0xbccc('0x3e')]['tag']:new Array(_0x10a8e7[_0xbccc('0x3e')][_0xbccc('0x81')]);_0x55c8b0[_0xbccc('0x2f')](function(_0x6ee637){_0x563ac4['or'](_0xbccc('0x6f'),'%,'+_0x6ee637+',%');});}if(_0x10a8e7[_0xbccc('0x3e')]['filter']){var _0x27ce04=_0x10a8e7[_0xbccc('0x3e')][_0xbccc('0x82')][_0xbccc('0x83')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0xbccc('0x84')](_0x27ce04)){_0x59b22e['or'](_0xbccc('0x85'),_0x27ce04+'%')['or'](_0xbccc('0x86'),_0x27ce04+'%');}_0x59b22e['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x27ce04+'%');}}_0x14b002[_0xbccc('0x49')](_0x59b22e);_0x14b002[_0xbccc('0x87')](_0xbccc('0x88'));var _0x3917c1={'type':db['Sequelize'][_0xbccc('0x89')][_0xbccc('0x8a')],'raw':!![]};var _0x4e8b2e=_0x14b002[_0xbccc('0x8b')]();_0x4e8b2e[_0xbccc('0x4c')](_0xbccc('0x88'));_0x4e8b2e[_0xbccc('0x4c')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xbccc('0x64'));if(_0x5d6bf[_0xbccc('0x47')]){_0x5d6bf[_0xbccc('0x47')]['forEach'](function(_0x363051){var _0x1ed374=_0x363051[0x0]==='contactName'?_0x363051[0x0]:'i.'+_0x363051[0x0];_0x14b002[_0xbccc('0x47')](_0x1ed374,_0x363051[0x1]===_0xbccc('0x8c')?![]:!![]);});}if(!_['isEmpty'](_0x55c8b0)){_0x14b002['having'](_0x563ac4);_0x4e8b2e[_0xbccc('0x49')](_0xbccc('0x8d'),_0x55c8b0);}BPromise[_0xbccc('0x8e')]()[_0xbccc('0x24')](function(){if(!_0x1a7a39){if(_0x10a8e7[_0xbccc('0x3e')][_0xbccc('0x76')])return;_0x4e8b2e[_0xbccc('0x49')]('i.FaxAccountId\x20IS\x20NOT\x20NULL');_0x14b002[_0xbccc('0x49')]('i.FaxAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x10a8e7[_0xbccc('0x8f')][_0xbccc('0x90')]!=='agent')return;return _0x10a8e7[_0xbccc('0x8f')][_0xbccc('0x91')]({'attributes':['id'],'raw':!![]})['then'](function(_0x1cee8a){if(_[_0xbccc('0x75')](_0x1cee8a)){_0x4e8b2e['where']('i.FaxAccountId\x20IS\x20NULL');_0x14b002[_0xbccc('0x49')](_0xbccc('0x92'));}else{_0x4e8b2e[_0xbccc('0x49')](_0xbccc('0x77'),_['map'](_0x1cee8a,'id'));_0x14b002[_0xbccc('0x49')](_0xbccc('0x77'),_['map'](_0x1cee8a,'id'));}});})[_0xbccc('0x24')](function(){if(_0x10a8e7[_0xbccc('0x8f')]['role']===_0xbccc('0x93')&&!_0x1a7a39&&!_0x10a8e7[_0xbccc('0x3e')][_0xbccc('0x76')])return[];return db[_0xbccc('0x94')][_0xbccc('0x3e')](_0x4e8b2e[_0xbccc('0x95')](),_0x3917c1);})['then'](function(_0x5623f5){_0x121fc7['count']=_0x5623f5[_0xbccc('0x62')];if(_0x121fc7[_0xbccc('0x96')]===0x0)return[];return db[_0xbccc('0x94')][_0xbccc('0x3e')](_0x51de5d[_0xbccc('0x95')](),_0x3917c1)[_0xbccc('0x24')](function(_0x3aeb55){_0x2e505a=_['keyBy'](_0x3aeb55,'id');_0x3917c1=_[_0xbccc('0x97')](_0x3917c1,{'model':db[_0xbccc('0x3a')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x10a8e7[_0xbccc('0x3e')]['fields']){_0x5d6bf[_0xbccc('0x43')][_0xbccc('0x2f')](function(_0x504195){_0x14b002['field']('i.'+_0x504195);});}else{_0x14b002['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');_0x14b002[_0xbccc('0x4c')]('a.key',_0xbccc('0x98'));_0x14b002[_0xbccc('0x4c')](_0xbccc('0x99'),'Account.mandatoryDisposition');_0x14b002[_0xbccc('0x4c')]('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',_0xbccc('0x9a'));_0x14b002[_0xbccc('0x4c')]('i.*');_0x14b002[_0xbccc('0x4c')]('c.firstName',_0xbccc('0x9b'));_0x14b002[_0xbccc('0x4c')](_0xbccc('0x9c'),_0xbccc('0x9d'));_0x14b002['field'](_0xbccc('0x9e'),_0xbccc('0x9f'));_0x14b002[_0xbccc('0x4c')]('c.phone',_0xbccc('0xa0'));_0x14b002['field']('c.mobile',_0xbccc('0xa1'));_0x14b002[_0xbccc('0x4c')](_0xbccc('0xa2'),_0xbccc('0xa3'));_0x14b002[_0xbccc('0x4c')](_0xbccc('0xa4'),_0xbccc('0xa5'));_0x14b002['field']('o.internal',_0xbccc('0xa6'));_0x14b002[_0xbccc('0x4c')](_0xbccc('0xa7'),_0xbccc('0x2c'));}if(_0x5d6bf[_0xbccc('0x1f')])_0x14b002[_0xbccc('0x1f')](_0x5d6bf[_0xbccc('0x1f')]);if(_0x5d6bf[_0xbccc('0x1e')])_0x14b002['offset'](_0x5d6bf[_0xbccc('0x1e')]);return db[_0xbccc('0x94')][_0xbccc('0x3e')](_0x14b002[_0xbccc('0x95')](),_0x3917c1);})[_0xbccc('0x24')](function(_0x36b0c0){if(_0x36b0c0[_0xbccc('0x62')]>0x0)_0x4236b5[_0xbccc('0x49')](_0xbccc('0xa8'),_[_0xbccc('0x2a')](_0x36b0c0,'id'));return db[_0xbccc('0x94')]['query'](_0x4236b5['toString'](),_0x3917c1)[_0xbccc('0x24')](function(_0x534525){var _0x3178d8=_[_0xbccc('0xa9')](_0x534525,'FaxInteractionId');var _0x462f3a=[];_0x36b0c0[_0xbccc('0x2f')](function(_0x164f5d){_0x462f3a['push'](updateFaxInteraction(_0x164f5d,_0x2e505a,_0x3178d8));});return BPromise[_0xbccc('0xaa')](_0x462f3a);});});})[_0xbccc('0x24')](function(_0x47a79c){_0x121fc7[_0xbccc('0xab')]=_0x47a79c;return _0x121fc7;})[_0xbccc('0x24')](respondWithFilteredResult(_0x1b650e,_0x5d6bf))['catch'](handleError(_0x1b650e,null));};exports['show']=function(_0x1e6b26,_0xc352bb){var _0x5ca6b={'raw':![],'where':{'id':_0x1e6b26[_0xbccc('0xac')]['id']}},_0x50e49e={};_0x50e49e[_0xbccc('0x42')]=_[_0xbccc('0x3f')](db[_0xbccc('0x3a')][_0xbccc('0xad')]);_0x50e49e['query']=_[_0xbccc('0x3f')](_0x1e6b26['query']);_0x50e49e[_0xbccc('0x40')]=_[_0xbccc('0x41')](_0x50e49e[_0xbccc('0x42')],_0x50e49e[_0xbccc('0x3e')]);_0x5ca6b['attributes']=_[_0xbccc('0x41')](_0x50e49e['model'],qs[_0xbccc('0x44')](_0x1e6b26[_0xbccc('0x3e')][_0xbccc('0x44')]));_0x5ca6b[_0xbccc('0x43')]=_0x5ca6b[_0xbccc('0x43')][_0xbccc('0x62')]?_0x5ca6b[_0xbccc('0x43')]:_0x50e49e[_0xbccc('0x42')];if(_0x1e6b26['query'][_0xbccc('0xae')]){_0x5ca6b[_0xbccc('0xaf')]=[{'all':!![]}];}_0x5ca6b=_[_0xbccc('0x97')]({},_0x5ca6b,_0x1e6b26[_0xbccc('0xb0')]);return db[_0xbccc('0x3a')][_0xbccc('0x63')](_0x5ca6b)[_0xbccc('0x24')](handleEntityNotFound(_0xc352bb,null))[_0xbccc('0x24')](respondWithResult(_0xc352bb,null))[_0xbccc('0x31')](handleError(_0xc352bb,null));};exports[_0xbccc('0xb1')]=function(_0x113486,_0x47edd4){return db[_0xbccc('0x3a')][_0xbccc('0xb1')](_0x113486[_0xbccc('0x73')],{})['then'](respondWithResult(_0x47edd4,0xc9))[_0xbccc('0x31')](handleError(_0x47edd4,null));};exports[_0xbccc('0x23')]=function(_0xfc76cf,_0x120f83){if(_0xfc76cf['body']['id']){delete _0xfc76cf[_0xbccc('0x73')]['id'];}return db[_0xbccc('0x3a')][_0xbccc('0x63')]({'where':{'id':_0xfc76cf[_0xbccc('0xac')]['id']}})[_0xbccc('0x24')](handleEntityNotFound(_0x120f83,null))[_0xbccc('0x24')](saveUpdates(_0xfc76cf['body'],null))[_0xbccc('0x24')](respondWithResult(_0x120f83,null))[_0xbccc('0x31')](handleError(_0x120f83,null));};exports['destroy']=function(_0x15f4a2,_0x5c6b96){return db[_0xbccc('0x3a')][_0xbccc('0x63')]({'where':{'id':_0x15f4a2['params']['id']}})[_0xbccc('0x24')](handleEntityNotFound(_0x5c6b96,null))[_0xbccc('0x24')](removeEntity(_0x5c6b96,null))[_0xbccc('0x31')](handleError(_0x5c6b96,null));};exports[_0xbccc('0xb2')]=function(_0x19e4fd,_0x416bde){return db[_0xbccc('0x3a')][_0xbccc('0xb2')]()[_0xbccc('0x24')](respondWithResult(_0x416bde,null))[_0xbccc('0x31')](handleError(_0x416bde,null));};exports['addMessage']=function(_0xf0d907,_0x3fa5c2,_0x5ebaa0){return db['FaxMessage'][_0xbccc('0x63')]({'where':{'id':_0xf0d907['params']['id']}})[_0xbccc('0x24')](handleEntityNotFound(_0x3fa5c2,null))[_0xbccc('0x24')](function(_0x26d037){if(_0x26d037){return _0x26d037[_0xbccc('0xb3')](_0xf0d907[_0xbccc('0x73')][_0xbccc('0xb4')],_[_0xbccc('0xb5')](_0xf0d907[_0xbccc('0x73')],[_0xbccc('0xb4'),'id'])||{});}})[_0xbccc('0x24')](respondWithResult(_0x3fa5c2,null))[_0xbccc('0x31')](handleError(_0x3fa5c2,null));};exports[_0xbccc('0xb6')]=function(_0x25322d,_0x400838,_0x31eddb){var _0x493958={'raw':![],'where':{}};var _0x5871b3={};var _0x127e9c={'count':0x0,'rows':[]};return db[_0xbccc('0x3a')][_0xbccc('0xb7')]({'where':{'id':_0x25322d[_0xbccc('0xac')]['id']}})[_0xbccc('0x24')](handleEntityNotFound(_0x400838,null))['then'](function(_0x7bf44a){if(_0x7bf44a){_0x5871b3[_0xbccc('0x42')]=_[_0xbccc('0x3f')](db[_0xbccc('0xb8')][_0xbccc('0xad')]);_0x5871b3['query']=_[_0xbccc('0x3f')](_0x25322d[_0xbccc('0x3e')]);_0x5871b3[_0xbccc('0x40')]=_[_0xbccc('0x41')](_0x5871b3[_0xbccc('0x42')],_0x5871b3[_0xbccc('0x3e')]);_0x493958[_0xbccc('0x43')]=_[_0xbccc('0x41')](_0x5871b3[_0xbccc('0x42')],qs[_0xbccc('0x44')](_0x25322d[_0xbccc('0x3e')]['fields']));_0x493958[_0xbccc('0x43')]=_0x493958[_0xbccc('0x43')][_0xbccc('0x62')]?_0x493958[_0xbccc('0x43')]:_0x5871b3[_0xbccc('0x42')];if(!_0x25322d[_0xbccc('0x3e')]['hasOwnProperty'](_0xbccc('0x46'))){_0x493958[_0xbccc('0x1f')]=qs[_0xbccc('0x1f')](_0x25322d['query'][_0xbccc('0x1f')]);_0x493958[_0xbccc('0x1e')]=qs[_0xbccc('0x1e')](_0x25322d[_0xbccc('0x3e')][_0xbccc('0x1e')]);}_0x493958['order']=qs[_0xbccc('0x48')](_0x25322d[_0xbccc('0x3e')][_0xbccc('0x48')]);_0x493958[_0xbccc('0x49')]=qs[_0xbccc('0x40')](_['pick'](_0x25322d[_0xbccc('0x3e')],_0x5871b3[_0xbccc('0x40')]));_0x493958[_0xbccc('0x49')][_0xbccc('0xb9')]=_0x7bf44a['id'];if(_0x25322d[_0xbccc('0x3e')][_0xbccc('0x82')]){_0x493958[_0xbccc('0x49')]=_[_0xbccc('0x97')](_0x493958[_0xbccc('0x49')],{'$or':_[_0xbccc('0x2a')](_0x493958[_0xbccc('0x43')],function(_0x273ebf){var _0x11a4d1={};_0x11a4d1[_0x273ebf]={'$like':'%'+_0x25322d['query'][_0xbccc('0x82')]+'%'};return _0x11a4d1;})});}if(_0x25322d[_0xbccc('0x3e')]['$gte']){var _0x4b6035=_0x25322d[_0xbccc('0x3e')][_0xbccc('0xba')][_0xbccc('0x2e')](',');var _0x17cad0={};_0x17cad0[_0x4b6035[0x0]]={'$gte':moment(_0x4b6035[0x1])['format'](_0xbccc('0xbb'))};_0x493958[_0xbccc('0x49')]=_[_0xbccc('0x97')](_0x493958[_0xbccc('0x49')],_0x17cad0);}_0x493958=_[_0xbccc('0x97')]({},_0x493958,_0x25322d[_0xbccc('0xb0')]);return db[_0xbccc('0xb8')][_0xbccc('0x96')]({'where':_0x493958[_0xbccc('0x49')]})['then'](function(_0x4169b7){_0x127e9c[_0xbccc('0x96')]=_0x4169b7;if(_0x25322d['query'][_0xbccc('0xae')]){_0x493958[_0xbccc('0xaf')]=[{'all':!![]}];}return db[_0xbccc('0xb8')]['findAll'](_0x493958);})[_0xbccc('0x24')](function(_0xb0564b){_0x127e9c[_0xbccc('0xab')]=_0xb0564b;return _0x127e9c;});}})[_0xbccc('0x24')](respondWithFilteredResult(_0x400838,_0x493958))[_0xbccc('0x31')](handleError(_0x400838,null));};exports[_0xbccc('0xbc')]=function(_0x11ff05,_0x5c2d20,_0x46d3ce){return db[_0xbccc('0x3a')][_0xbccc('0x63')]({'where':{'id':_0x11ff05[_0xbccc('0xac')]['id']}})['then'](handleEntityNotFound(_0x5c2d20,null))[_0xbccc('0x24')](function(_0x3b049f){if(_0x3b049f){return _0x3b049f[_0xbccc('0xbd')](_0x11ff05[_0xbccc('0x73')]['ids'],_['omit'](_0x11ff05[_0xbccc('0x73')],[_0xbccc('0xb4'),'id'])||{})[_0xbccc('0xbe')](function(){return db[_0xbccc('0xbf')][_0xbccc('0xc0')]({'attributes':['id',_0xbccc('0x27'),_0xbccc('0x4d')],'where':{'id':_0x11ff05[_0xbccc('0x73')][_0xbccc('0xb4')]}});})[_0xbccc('0x24')](function(_0x15e1b6){socket['emit'](_0xbccc('0xc1'),{'id':Number(_0x11ff05[_0xbccc('0xac')]['id']),'tags':_0x15e1b6||[]});return{'id':Number(_0x11ff05['params']['id']),'tags':_0x15e1b6||[]};});}})[_0xbccc('0x24')](respondWithResult(_0x5c2d20,null))[_0xbccc('0x31')](handleError(_0x5c2d20,null));};exports[_0xbccc('0xc2')]=function(_0x5db153,_0x58e841,_0x1334cc){return db['FaxInteraction']['find']({'where':{'id':_0x5db153[_0xbccc('0xac')]['id']}})[_0xbccc('0x24')](handleEntityNotFound(_0x58e841,null))[_0xbccc('0x24')](function(_0x2d49d4){if(_0x2d49d4){return _0x2d49d4['removeTags'](_0x5db153['query'][_0xbccc('0xb4')]);}})[_0xbccc('0x24')](respondWithStatusCode(_0x58e841,null))[_0xbccc('0x31')](handleError(_0x58e841,null));};exports['download']=function(_0x2d31a8,_0x32e805){var _0x7b24c7=moment()[_0xbccc('0xc3')]()[_0xbccc('0x95')]();var _0x35de7c=path[_0xbccc('0xc4')](config[_0xbccc('0xc5')],'server','files',_0xbccc('0xc6'));var _0xcc4c45=path[_0xbccc('0xc4')](config['root'],_0xbccc('0xc7'),_0xbccc('0xc8'),'attachments');var _0x5d9718=path[_0xbccc('0xc4')](_0x35de7c,_0x7b24c7);var _0x9af3f1=util['format']('transcript-%d-%s.zip',_0x2d31a8['params']['id'],_0x7b24c7);var _0x123024=path[_0xbccc('0xc4')](_0x35de7c,_0x9af3f1);var _0x563df8=[];_0x563df8['push']({'model':db['Attachment'],'as':_0xbccc('0xc9'),'raw':!![]});var _0x41123b=[{'model':db[_0xbccc('0xb8')],'as':_0xbccc('0xca'),'attributes':['id',_0xbccc('0x73'),_0xbccc('0x79')],'include':_0x563df8}];return db[_0xbccc('0x3a')][_0xbccc('0x63')]({'where':{'id':_0x2d31a8[_0xbccc('0xac')]['id']},'include':_0x41123b})[_0xbccc('0x24')](handleEntityNotFound(_0x32e805,null))['then'](function(_0x3aea80){if(_0x3aea80&&_0x3aea80[_0xbccc('0xca')]){var _0x25b859=_0x3aea80['get']({'plain':!![]});fs['mkdirSync'](_0x5d9718);for(var _0x22ae34=0x0;_0x22ae34<_0x25b859[_0xbccc('0xca')][_0xbccc('0x62')];_0x22ae34++){var _0x3ccdf3=_0x25b859[_0xbccc('0xca')][_0x22ae34][_0xbccc('0xc9')];if(_0x3ccdf3){var _0x3149e3=path['join'](_0xcc4c45,_0x3ccdf3[_0xbccc('0xcb')]);if(fs['existsSync'](_0x3149e3)){fs['createReadStream'](_0x3149e3)['pipe'](fs[_0xbccc('0xcc')](path[_0xbccc('0xc4')](_0x5d9718,_0x3ccdf3[_0xbccc('0xcb')])));}}}return BPromise['resolve']()['then'](function(){return new BPromise(function(_0x3a08c2,_0x4d222d){zipdir(_0x5d9718,{'saveTo':_0x123024},function(_0x1fd1d3,_0x4a51ca){if(_0x1fd1d3)return _0x4d222d(_0x1fd1d3);return _0x3a08c2(_0x4a51ca);});})[_0xbccc('0x24')](function(){return new BPromise(function(_0x11391b,_0x2ae05c){rimraf(_0x5d9718,function(_0x3be7b8){if(_0x3be7b8)_0x2ae05c(_0x3be7b8);return _0x11391b();});});})[_0xbccc('0x24')](function(){return _0x32e805[_0xbccc('0xcd')](_0x123024,_0x9af3f1,function(_0x342295){if(_0x342295){console[_0xbccc('0xce')](_0xbccc('0xcf'),_0x342295);}else{fs['unlinkSync'](_0x123024);}});});});}else{return _0x32e805['sendStatus'](0xc8);}})[_0xbccc('0x31')](handleError(_0x32e805,null));}; \ No newline at end of file +var _0xed1e=['isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','DESC','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','agent','i.FaxAccountId\x20IS\x20NULL','user','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Contact.firstName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','sequelize','ui.FaxInteractionId\x20IN\x20?','FaxInteractionId','all','rows','params','options','create','describe','addMessage','ids','omit','findOne','pick','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','include','FaxMessage','findAll','addTags','setTags','spread','emit','faxInteractionTags:save','removeTags','download','unix','join','server','files','root','transcript-%d-%s.zip','Attachment','createdAt','Messages','get','mkdirSync','existsSync','createReadStream','pipe','createWriteStream','log','err','unlinkSync','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','name','send','map','fullname','Tags','split','forEach','push','TagIds','catch','unmanaged','total','UserId','closed','talking','waiting','FaxInteraction','rawAttributes','fieldName','model','filters','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','sort','select','field','color','from','tools_tags','u.id','u.fullname','ui.FaxInteractionId','fax_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','fax_accounts','fax_messages','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','text','start','end','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','body','keys','some','compact','isEmpty','FaxAccountId','where','i.FaxAccountId\x20IN\x20?','concat','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag'];(function(_0x4e8ea9,_0x1964d9){var _0x1ddd5e=function(_0x4982f2){while(--_0x4982f2){_0x4e8ea9['push'](_0x4e8ea9['shift']());}};_0x1ddd5e(++_0x1964d9);}(_0xed1e,0x131));var _0xeed1=function(_0x70fd53,_0x2a95a6){_0x70fd53=_0x70fd53-0x0;var _0x4b71c5=_0xed1e[_0x70fd53];return _0x4b71c5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xeed1('0x0'));var zipdir=require(_0xeed1('0x1'));var jsonpatch=require(_0xeed1('0x2'));var rp=require(_0xeed1('0x3'));var moment=require('moment');var BPromise=require(_0xeed1('0x4'));var Mustache=require(_0xeed1('0x5'));var util=require(_0xeed1('0x6'));var path=require('path');var sox=require(_0xeed1('0x7'));var csv=require(_0xeed1('0x8'));var ejs=require(_0xeed1('0x9'));var fs=require('fs');var fs_extra=require(_0xeed1('0xa'));var _=require(_0xeed1('0xb'));var squel=require('squel');var crypto=require(_0xeed1('0xc'));var jsforce=require(_0xeed1('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xeed1('0x8'));var querystring=require('querystring');var Papa=require(_0xeed1('0xe'));var Redis=require(_0xeed1('0xf'));var authService=require(_0xeed1('0x10'));var qs=require(_0xeed1('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xeed1('0x12'));var logger=require(_0xeed1('0x13'))(_0xeed1('0x14'));var utils=require('../../config/utils');var config=require(_0xeed1('0x15'));var licenseUtil=require(_0xeed1('0x16'));var db=require(_0xeed1('0x17'))['db'];config['redis']=_[_0xeed1('0x18')](config[_0xeed1('0x19')],{'host':_0xeed1('0x1a'),'port':0x18eb});var socket=require(_0xeed1('0x1b'))(new Redis(config[_0xeed1('0x19')]));require('./faxInteraction.socket')['register'](socket);function respondWithStatusCode(_0xb8fb6e,_0x17ba19){_0x17ba19=_0x17ba19||0xcc;return function(_0x3ef745){if(_0x3ef745){return _0xb8fb6e[_0xeed1('0x1c')](_0x17ba19);}return _0xb8fb6e['status'](_0x17ba19)['end']();};}function respondWithResult(_0x107cf6,_0x3ae311){_0x3ae311=_0x3ae311||0xc8;return function(_0x3e4e48){if(_0x3e4e48){return _0x107cf6[_0xeed1('0x1d')](_0x3ae311)[_0xeed1('0x1e')](_0x3e4e48);}};}function respondWithFilteredResult(_0x22b6e6,_0x47319b){return function(_0x24f261){if(_0x24f261){var _0x329e51=typeof _0x47319b[_0xeed1('0x1f')]===_0xeed1('0x20')&&typeof _0x47319b[_0xeed1('0x21')]==='undefined';var _0x100a9d=_0x24f261['count'];var _0x5bee63=_0x329e51?0x0:_0x47319b['offset'];var _0x1cce60=_0x329e51?_0x24f261[_0xeed1('0x22')]:_0x47319b['offset']+_0x47319b[_0xeed1('0x21')];var _0x59d6e8;if(_0x1cce60>=_0x100a9d){_0x1cce60=_0x100a9d;_0x59d6e8=0xc8;}else{_0x59d6e8=0xce;}_0x22b6e6[_0xeed1('0x1d')](_0x59d6e8);return _0x22b6e6[_0xeed1('0x23')](_0xeed1('0x24'),_0x5bee63+'-'+_0x1cce60+'/'+_0x100a9d)[_0xeed1('0x1e')](_0x24f261);}return null;};}function patchUpdates(_0x4afe60){return function(_0x3130a){try{jsonpatch[_0xeed1('0x25')](_0x3130a,_0x4afe60,!![]);}catch(_0x1be470){return BPromise[_0xeed1('0x26')](_0x1be470);}return _0x3130a['save']();};}function saveUpdates(_0x2eaff8,_0x339b79){return function(_0x3eb610){if(_0x3eb610){return _0x3eb610[_0xeed1('0x27')](_0x2eaff8)[_0xeed1('0x28')](function(_0x288c77){return _0x288c77;});}return null;};}function removeEntity(_0x4d63bc,_0x429709){return function(_0x29c252){if(_0x29c252){return _0x29c252[_0xeed1('0x29')]()[_0xeed1('0x28')](function(){_0x4d63bc[_0xeed1('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0xd4b124,_0x27444f){return function(_0x139a13){if(!_0x139a13){_0xd4b124[_0xeed1('0x1c')](0x194);}return _0x139a13;};}function handleError(_0x30f55b,_0x29baf9){_0x29baf9=_0x29baf9||0x1f4;return function(_0x2b2ead){logger['error'](_0x2b2ead['stack']);if(_0x2b2ead[_0xeed1('0x2a')]){delete _0x2b2ead[_0xeed1('0x2a')];}_0x30f55b[_0xeed1('0x1d')](_0x29baf9)[_0xeed1('0x2b')](_0x2b2ead);};}function getInteractionUsers(_0x3bfded,_0x3127d7){return new BPromise(function(_0x5a3cec,_0x4858a0){try{if(_0x3127d7[_0x3bfded['id']]){_0x3bfded['Users']=_[_0xeed1('0x2c')](_0x3127d7[_0x3bfded['id']],function(_0x593923){return{'id':_0x593923['id'],'fullname':_0x593923[_0xeed1('0x2d')]};});}}catch(_0x94decc){_0x4858a0(_0x94decc);}_0x5a3cec(_0x3bfded);});}function getInteractionTags(_0x4c4e99,_0x19ce33){return new BPromise(function(_0x45c318,_0x3d71bb){try{if(_0x4c4e99['TagIds']){_0x4c4e99[_0xeed1('0x2e')]=[];_0x4c4e99['TagIds'][_0xeed1('0x2f')](',')[_0xeed1('0x30')](function(_0x3d95bb){_0x4c4e99[_0xeed1('0x2e')][_0xeed1('0x31')](_0x19ce33[_0x3d95bb]);});}delete _0x4c4e99[_0xeed1('0x32')];}catch(_0x370a2d){_0x3d71bb(_0x370a2d);}_0x45c318(_0x4c4e99);});}function updateFaxInteraction(_0x17087a,_0x39c5d2,_0x2ce861){return new BPromise(function(_0x46b0b6,_0x4b5e90){return getInteractionUsers(_0x17087a,_0x2ce861)[_0xeed1('0x28')](function(_0x3b75c5){return getInteractionTags(_0x3b75c5,_0x39c5d2);})[_0xeed1('0x28')](function(_0x1978af){return getStateInteraction(_0x1978af);})[_0xeed1('0x28')](function(_0x3834a4){_0x46b0b6(_0x3834a4);})[_0xeed1('0x33')](function(_0x5b85d5){_0x4b5e90(_0x5b85d5);});});}function getStateInteraction(_0x5467cb){return new BPromise(function(_0x3b6544){_0x5467cb['waiting']=0x0;_0x5467cb['talking']=0x0;_0x5467cb['answered']=0x0;_0x5467cb[_0xeed1('0x34')]=0x0;_0x5467cb[_0xeed1('0x35')]=0x0;if(!_0x5467cb['closed']&&!_0x5467cb[_0xeed1('0x36')]){_0x5467cb['waiting']+=0x1;}if(!_0x5467cb[_0xeed1('0x37')]&&_0x5467cb[_0xeed1('0x36')]){_0x5467cb[_0xeed1('0x38')]+=0x1;if(_0x5467cb['waiting']){_0x5467cb['waiting']-=0x1;}}if(_0x5467cb[_0xeed1('0x37')]&&_0x5467cb[_0xeed1('0x36')]){_0x5467cb['answered']+=0x1;if(_0x5467cb[_0xeed1('0x38')]){_0x5467cb['talking']-=0x1;}}if(_0x5467cb[_0xeed1('0x37')]&&!_0x5467cb['UserId']){_0x5467cb['unmanaged']+=0x1;if(_0x5467cb[_0xeed1('0x39')]){_0x5467cb[_0xeed1('0x39')]-=0x1;}}_0x5467cb[_0xeed1('0x35')]+=0x1;_0x3b6544(_0x5467cb);});}exports['index']=function(_0x5dd880,_0x42e074){var _0x391427={},_0x3d692f={},_0x30b8d9={'count':0x0,'rows':[]};var _0x199e85=_[_0xeed1('0x2c')](db[_0xeed1('0x3a')][_0xeed1('0x3b')],function(_0x2f5d9c){return{'name':_0x2f5d9c[_0xeed1('0x3c')],'type':_0x2f5d9c['type']['key']};});_0x3d692f[_0xeed1('0x3d')]=_[_0xeed1('0x2c')](_0x199e85,_0xeed1('0x2a'));_0x3d692f['query']=_['keys'](_0x5dd880['query']);_0x3d692f[_0xeed1('0x3e')]=_[_0xeed1('0x3f')](_0x3d692f['model'],_0x3d692f['query']);_0x391427[_0xeed1('0x40')]=_[_0xeed1('0x3f')](_0x3d692f['model'],qs[_0xeed1('0x41')](_0x5dd880[_0xeed1('0x42')][_0xeed1('0x41')]));_0x391427[_0xeed1('0x40')]=_0x391427[_0xeed1('0x40')][_0xeed1('0x43')]?_0x391427['attributes']:_0x3d692f[_0xeed1('0x3d')];if(!_0x5dd880['query'][_0xeed1('0x44')](_0xeed1('0x45'))){_0x391427[_0xeed1('0x21')]=qs[_0xeed1('0x21')](_0x5dd880['query']['limit']);_0x391427[_0xeed1('0x1f')]=qs[_0xeed1('0x1f')](_0x5dd880[_0xeed1('0x42')][_0xeed1('0x1f')]);}_0x391427['order']=qs[_0xeed1('0x46')](_0x5dd880[_0xeed1('0x42')]['sort']);_0x391427['where']=qs[_0xeed1('0x3e')](_['pick'](_0x5dd880[_0xeed1('0x42')],_0x3d692f['filters']),_0x199e85);var _0x4512a3=[];var _0xf9b32b=squel[_0xeed1('0x47')]()['field']('id')[_0xeed1('0x48')](_0xeed1('0x2a'))[_0xeed1('0x48')](_0xeed1('0x49'))[_0xeed1('0x4a')](_0xeed1('0x4b'));var _0x1b8983=squel[_0xeed1('0x47')]()[_0xeed1('0x48')](_0xeed1('0x4c'))['field'](_0xeed1('0x4d'))['field'](_0xeed1('0x4e'))['from']('user_has_fax_interactions','ui')['left_join']('users','u','u.id\x20=\x20ui.UserId');var _0x1b476c=squel[_0xeed1('0x47')]()['from'](_0xeed1('0x4f'),'i')[_0xeed1('0x50')](_0xeed1('0x51'),'c',_0xeed1('0x52'))[_0xeed1('0x50')](_0xeed1('0x53'),'o',_0xeed1('0x54'))[_0xeed1('0x50')](_0xeed1('0x55'),'a','a.id\x20=\x20i.FaxAccountId')[_0xeed1('0x50')](_0xeed1('0x56'),'me',_0xeed1('0x57'))[_0xeed1('0x50')](_0xeed1('0x58'),'it',_0xeed1('0x59'))[_0xeed1('0x50')]('tools_tags','t',_0xeed1('0x5a'));var _0x2915f2=squel['expr']();var _0x17664b=[];var _0xbc65f5=squel['expr']();var _0x4a2453;if(_0x5dd880[_0xeed1('0x42')][_0xeed1('0x5b')]){_0x4a2453=as[_0xeed1('0x5c')](_0x5dd880[_0xeed1('0x42')][_0xeed1('0x5b')]);var _0x3e6f97=_0x4a2453[_0xeed1('0x5d')];for(var _0x126727=0x0;_0x126727<_0x4a2453[_0xeed1('0x5e')]['length'];_0x126727++){var _0x247734=_0x4a2453['conditions'][_0x126727];var _0x5acf61='i';var _0x25e26f=_[_0xeed1('0x5f')](_0x199e85,[_0xeed1('0x2a'),_0x247734[_0xeed1('0x48')]]);if(!_0x25e26f){switch(_0x247734['field']){case _0xeed1('0x60'):if(_0x247734[_0xeed1('0x61')]==0x1){_0x1b476c[_0xeed1('0x62')]('`'+_0x247734[_0xeed1('0x48')]+_0xeed1('0x63'));}else{_0x1b476c[_0xeed1('0x62')]('`'+_0x247734['field']+_0xeed1('0x64'));}break;case _0xeed1('0x65'):if(_0x247734['operator']===_0xeed1('0x66')){if(_0x247734[_0xeed1('0x61')][_0xeed1('0x2f')]('\x20')[_0xeed1('0x43')]>0x1){_0x2915f2[_0x3e6f97](_0xeed1('0x67'),qs[_0xeed1('0x68')](_0x247734[_0xeed1('0x61')]),null);}else{var _0x5a5cb6='%'+_0x247734[_0xeed1('0x61')]+'%';_0x2915f2[_0x3e6f97](_0xeed1('0x69'),_0x5a5cb6,_0x5a5cb6,_0x5a5cb6);}}else{_0x25e26f=_[_0xeed1('0x5f')](_0x199e85,[_0xeed1('0x2a'),_0xeed1('0x6a')]);_0x247734['field']='ContactId';_0x3705cb=as[_0xeed1('0x6b')](_0x5acf61,_0x25e26f[_0xeed1('0x6c')],_0x247734);_0x2915f2[_0x3e6f97](_0x3705cb[_0xeed1('0x6d')],_0x3705cb[_0xeed1('0x61')][_0xeed1('0x6e')],_0x3705cb[_0xeed1('0x61')][_0xeed1('0x6f')]);}break;case _0xeed1('0x70'):var _0x20a35a=_0x247734['value'][_0xeed1('0x2f')](',')[_0xeed1('0x2c')](function(_0x59dba8){return Number(_0x59dba8);});_0x20a35a['forEach'](function(_0xde3b3b){_0xbc65f5['or'](_0xeed1('0x71'),'%,'+_0xde3b3b+',%');});_0x17664b=_[_0xeed1('0x72')](_0x17664b,_0x20a35a);break;case _0xeed1('0x73'):if(_0x247734[_0xeed1('0x74')]===_0xeed1('0x66')){_0x2915f2[_0x3e6f97]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x247734['value']+'%',null);}else{_0x25e26f=_['find'](_0x199e85,[_0xeed1('0x2a'),'UserId']);_0x247734['field']=_0xeed1('0x36');_0x3705cb=as['buildExpression'](_0x5acf61,_0x25e26f['type'],_0x247734);_0x2915f2[_0x3e6f97](_0x3705cb[_0xeed1('0x6d')],_0x3705cb[_0xeed1('0x61')][_0xeed1('0x6e')],_0x3705cb[_0xeed1('0x61')]['end']);}break;case _0xeed1('0x75'):_0x3705cb=as[_0xeed1('0x6b')]('me',null,_0x247734);_0x2915f2[_0x3e6f97](_0x3705cb['text'],_0x3705cb[_0xeed1('0x61')][_0xeed1('0x6e')],_0x3705cb['value'][_0xeed1('0x6f')]);break;}}else{var _0x3705cb=as[_0xeed1('0x6b')](_0x5acf61,_0x25e26f[_0xeed1('0x6c')],_0x247734);_0x2915f2[_0x3e6f97](_0x3705cb[_0xeed1('0x6d')],_0x3705cb[_0xeed1('0x61')]['start'],_0x3705cb['value']['end']);}}}else{var _0x3fc966=_(_0x5dd880[_0xeed1('0x42')])[_0xeed1('0x76')]()['map'](function(_0x341755){return _[_0xeed1('0x77')](_0x199e85,['name',_0x341755])?_0x341755:undefined;})[_0xeed1('0x78')]()['value']();if(!_[_0xeed1('0x79')](_0x3fc966)){_0x3fc966[_0xeed1('0x30')](function(_0x684b37){if(_0x684b37===_0xeed1('0x7a')){_0x1b476c[_0xeed1('0x7b')](_0xeed1('0x7c'),[][_0xeed1('0x7d')](_0x5dd880[_0xeed1('0x42')][_0x684b37]));}else if(_0x684b37==='createdAt'){var _0x5899c4=JSON['parse'](_0x5dd880[_0xeed1('0x42')][_0x684b37])[_0xeed1('0x7e')];var _0x5a98cd=JSON[_0xeed1('0x7f')](_0x5dd880['query'][_0x684b37])[_0xeed1('0x80')];_0x1b476c[_0xeed1('0x7b')](_0xeed1('0x81'),_0x5899c4,_0x5a98cd);}else{if(_0x5dd880[_0xeed1('0x42')][_0x684b37]===_0xeed1('0x82')){_0x1b476c[_0xeed1('0x7b')]('i.'+_0x684b37+_0xeed1('0x83'));}else{_0x1b476c[_0xeed1('0x7b')]('i.'+_0x684b37+_0xeed1('0x84'),_0x5dd880['query'][_0x684b37]);}}});}if(_0x5dd880['query'][_0xeed1('0x85')]){if(_0x5dd880[_0xeed1('0x42')][_0xeed1('0x85')]==0x1){_0x1b476c['having'](_0xeed1('0x86'));}else{_0x1b476c[_0xeed1('0x62')](_0xeed1('0x87'));}}if(_0x5dd880['query'][_0xeed1('0x88')]){_0x17664b=_[_0xeed1('0x89')](_0x5dd880['query'][_0xeed1('0x88')])?_0x5dd880['query']['tag']:new Array(_0x5dd880[_0xeed1('0x42')][_0xeed1('0x88')]);_0x17664b[_0xeed1('0x30')](function(_0x77b5d3){_0xbc65f5['or'](_0xeed1('0x71'),'%,'+_0x77b5d3+',%');});}if(_0x5dd880[_0xeed1('0x42')][_0xeed1('0x8a')]){var _0xf33fe3=_0x5dd880[_0xeed1('0x42')][_0xeed1('0x8a')][_0xeed1('0x8b')]('\x5c','\x5c\x5c')[_0xeed1('0x8b')](/'/g,'\x27\x27');if(qs[_0xeed1('0x8c')](_0xf33fe3)){_0x2915f2['or'](_0xeed1('0x8d'),_0xf33fe3+'%')['or'](_0xeed1('0x8e'),_0xf33fe3+'%');}_0x2915f2['or'](_0xeed1('0x8f'),_0xf33fe3+'%');}}_0x1b476c[_0xeed1('0x7b')](_0x2915f2);_0x1b476c['group'](_0xeed1('0x90'));var _0x55b1e5={'type':db[_0xeed1('0x91')][_0xeed1('0x92')][_0xeed1('0x93')],'raw':!![]};var _0x58de54=_0x1b476c[_0xeed1('0x94')]();_0x58de54['field'](_0xeed1('0x90'));_0x58de54['field'](_0xeed1('0x95'),'unreadMessages');if(_0x391427[_0xeed1('0x96')]){_0x391427[_0xeed1('0x96')][_0xeed1('0x30')](function(_0x6b77ad){var _0x2139f1=_0x6b77ad[0x0]==='contactName'?_0x6b77ad[0x0]:'i.'+_0x6b77ad[0x0];_0x1b476c[_0xeed1('0x96')](_0x2139f1,_0x6b77ad[0x1]===_0xeed1('0x97')?![]:!![]);});}if(!_['isEmpty'](_0x17664b)){_0x1b476c[_0xeed1('0x62')](_0xbc65f5);_0x58de54['where']('t.id\x20IN\x20?',_0x17664b);}BPromise[_0xeed1('0x98')]()[_0xeed1('0x28')](function(){if(!_0x4a2453){if(_0x5dd880[_0xeed1('0x42')]['FaxAccountId'])return;_0x58de54[_0xeed1('0x7b')](_0xeed1('0x99'));_0x1b476c[_0xeed1('0x7b')](_0xeed1('0x99'));return;}if(_0x5dd880['user']['role']!==_0xeed1('0x9a'))return;return _0x5dd880['user']['getFaxAccounts']({'attributes':['id'],'raw':!![]})[_0xeed1('0x28')](function(_0x41a7e3){if(_[_0xeed1('0x79')](_0x41a7e3)){_0x58de54['where'](_0xeed1('0x9b'));_0x1b476c['where']('i.FaxAccountId\x20IS\x20NULL');}else{_0x58de54[_0xeed1('0x7b')](_0xeed1('0x7c'),_[_0xeed1('0x2c')](_0x41a7e3,'id'));_0x1b476c[_0xeed1('0x7b')](_0xeed1('0x7c'),_[_0xeed1('0x2c')](_0x41a7e3,'id'));}});})[_0xeed1('0x28')](function(){if(_0x5dd880[_0xeed1('0x9c')]['role']===_0xeed1('0x9a')&&!_0x4a2453&&!_0x5dd880[_0xeed1('0x42')][_0xeed1('0x7a')])return[];return db['sequelize']['query'](_0x58de54[_0xeed1('0x9d')](),_0x55b1e5);})['then'](function(_0x7f9778){_0x30b8d9['count']=_0x7f9778[_0xeed1('0x43')];if(_0x30b8d9['count']===0x0)return[];return db['sequelize']['query'](_0xf9b32b[_0xeed1('0x9d')](),_0x55b1e5)['then'](function(_0x2aecbc){_0x4512a3=_[_0xeed1('0x9e')](_0x2aecbc,'id');_0x55b1e5=_[_0xeed1('0x9f')](_0x55b1e5,{'model':db[_0xeed1('0x3a')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5dd880[_0xeed1('0x42')][_0xeed1('0x41')]){_0x391427['attributes'][_0xeed1('0x30')](function(_0x13b3dd){_0x1b476c[_0xeed1('0x48')]('i.'+_0x13b3dd);});}else{_0x1b476c['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xeed1('0x60'));_0x1b476c[_0xeed1('0x48')](_0xeed1('0xa0'),_0xeed1('0xa1'));_0x1b476c[_0xeed1('0x48')](_0xeed1('0xa2'),'Account.mandatoryDisposition');_0x1b476c[_0xeed1('0x48')]('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');_0x1b476c['field']('i.*');_0x1b476c[_0xeed1('0x48')]('c.firstName',_0xeed1('0xa3'));_0x1b476c['field']('c.lastName','Contact.lastName');_0x1b476c[_0xeed1('0x48')](_0xeed1('0xa4'),_0xeed1('0xa5'));_0x1b476c[_0xeed1('0x48')](_0xeed1('0xa6'),_0xeed1('0xa7'));_0x1b476c[_0xeed1('0x48')](_0xeed1('0xa8'),_0xeed1('0xa9'));_0x1b476c[_0xeed1('0x48')](_0xeed1('0xaa'),_0xeed1('0xab'));_0x1b476c[_0xeed1('0x48')](_0xeed1('0xac'),_0xeed1('0xad'));_0x1b476c[_0xeed1('0x48')](_0xeed1('0xae'),_0xeed1('0xaf'));_0x1b476c[_0xeed1('0x48')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xeed1('0x32'));}if(_0x391427[_0xeed1('0x21')])_0x1b476c[_0xeed1('0x21')](_0x391427[_0xeed1('0x21')]);if(_0x391427['offset'])_0x1b476c[_0xeed1('0x1f')](_0x391427[_0xeed1('0x1f')]);return db[_0xeed1('0xb0')][_0xeed1('0x42')](_0x1b476c['toString'](),_0x55b1e5);})['then'](function(_0x133a6d){if(_0x133a6d[_0xeed1('0x43')]>0x0)_0x1b8983[_0xeed1('0x7b')](_0xeed1('0xb1'),_['map'](_0x133a6d,'id'));return db[_0xeed1('0xb0')][_0xeed1('0x42')](_0x1b8983['toString'](),_0x55b1e5)['then'](function(_0x2f3b0b){var _0x1ec9be=_['groupBy'](_0x2f3b0b,_0xeed1('0xb2'));var _0x4c924e=[];_0x133a6d['forEach'](function(_0x22fb11){_0x4c924e[_0xeed1('0x31')](updateFaxInteraction(_0x22fb11,_0x4512a3,_0x1ec9be));});return BPromise[_0xeed1('0xb3')](_0x4c924e);});});})[_0xeed1('0x28')](function(_0x14facb){_0x30b8d9[_0xeed1('0xb4')]=_0x14facb;return _0x30b8d9;})[_0xeed1('0x28')](respondWithFilteredResult(_0x42e074,_0x391427))[_0xeed1('0x33')](handleError(_0x42e074,null));};exports['show']=function(_0x4c04ce,_0x532842){var _0x586b56={'raw':![],'where':{'id':_0x4c04ce[_0xeed1('0xb5')]['id']}},_0x13bc47={};_0x13bc47['model']=_[_0xeed1('0x76')](db[_0xeed1('0x3a')]['rawAttributes']);_0x13bc47[_0xeed1('0x42')]=_[_0xeed1('0x76')](_0x4c04ce['query']);_0x13bc47[_0xeed1('0x3e')]=_['intersection'](_0x13bc47[_0xeed1('0x3d')],_0x13bc47[_0xeed1('0x42')]);_0x586b56[_0xeed1('0x40')]=_[_0xeed1('0x3f')](_0x13bc47[_0xeed1('0x3d')],qs['fields'](_0x4c04ce[_0xeed1('0x42')][_0xeed1('0x41')]));_0x586b56[_0xeed1('0x40')]=_0x586b56[_0xeed1('0x40')][_0xeed1('0x43')]?_0x586b56[_0xeed1('0x40')]:_0x13bc47[_0xeed1('0x3d')];if(_0x4c04ce[_0xeed1('0x42')]['includeAll']){_0x586b56['include']=[{'all':!![]}];}_0x586b56=_[_0xeed1('0x9f')]({},_0x586b56,_0x4c04ce[_0xeed1('0xb6')]);return db[_0xeed1('0x3a')][_0xeed1('0x5f')](_0x586b56)[_0xeed1('0x28')](handleEntityNotFound(_0x532842,null))[_0xeed1('0x28')](respondWithResult(_0x532842,null))[_0xeed1('0x33')](handleError(_0x532842,null));};exports[_0xeed1('0xb7')]=function(_0x2f50a7,_0x4811e6){return db['FaxInteraction']['create'](_0x2f50a7[_0xeed1('0x75')],{})[_0xeed1('0x28')](respondWithResult(_0x4811e6,0xc9))[_0xeed1('0x33')](handleError(_0x4811e6,null));};exports[_0xeed1('0x27')]=function(_0x10433a,_0x2c0dd7){if(_0x10433a[_0xeed1('0x75')]['id']){delete _0x10433a[_0xeed1('0x75')]['id'];}return db[_0xeed1('0x3a')][_0xeed1('0x5f')]({'where':{'id':_0x10433a['params']['id']}})[_0xeed1('0x28')](handleEntityNotFound(_0x2c0dd7,null))['then'](saveUpdates(_0x10433a['body'],null))[_0xeed1('0x28')](respondWithResult(_0x2c0dd7,null))['catch'](handleError(_0x2c0dd7,null));};exports[_0xeed1('0x29')]=function(_0x1d86bb,_0x4d0844){return db[_0xeed1('0x3a')][_0xeed1('0x5f')]({'where':{'id':_0x1d86bb[_0xeed1('0xb5')]['id']}})[_0xeed1('0x28')](handleEntityNotFound(_0x4d0844,null))[_0xeed1('0x28')](removeEntity(_0x4d0844,null))[_0xeed1('0x33')](handleError(_0x4d0844,null));};exports[_0xeed1('0xb8')]=function(_0x4f8e3e,_0x168ef1){return db[_0xeed1('0x3a')]['describe']()[_0xeed1('0x28')](respondWithResult(_0x168ef1,null))['catch'](handleError(_0x168ef1,null));};exports[_0xeed1('0xb9')]=function(_0x2522d6,_0x5eefee,_0x523142){return db['FaxMessage'][_0xeed1('0x5f')]({'where':{'id':_0x2522d6['params']['id']}})[_0xeed1('0x28')](handleEntityNotFound(_0x5eefee,null))[_0xeed1('0x28')](function(_0x30e9aa){if(_0x30e9aa){return _0x30e9aa[_0xeed1('0xb9')](_0x2522d6[_0xeed1('0x75')][_0xeed1('0xba')],_[_0xeed1('0xbb')](_0x2522d6[_0xeed1('0x75')],[_0xeed1('0xba'),'id'])||{});}})[_0xeed1('0x28')](respondWithResult(_0x5eefee,null))[_0xeed1('0x33')](handleError(_0x5eefee,null));};exports['getMessages']=function(_0x3bb790,_0x27151e,_0x9436ac){var _0x27f545={'raw':![],'where':{}};var _0x1e309b={};var _0x3741aa={'count':0x0,'rows':[]};return db[_0xeed1('0x3a')][_0xeed1('0xbc')]({'where':{'id':_0x3bb790['params']['id']}})[_0xeed1('0x28')](handleEntityNotFound(_0x27151e,null))[_0xeed1('0x28')](function(_0x5b47c7){if(_0x5b47c7){_0x1e309b[_0xeed1('0x3d')]=_[_0xeed1('0x76')](db['FaxMessage'][_0xeed1('0x3b')]);_0x1e309b['query']=_['keys'](_0x3bb790['query']);_0x1e309b['filters']=_['intersection'](_0x1e309b[_0xeed1('0x3d')],_0x1e309b['query']);_0x27f545['attributes']=_[_0xeed1('0x3f')](_0x1e309b[_0xeed1('0x3d')],qs[_0xeed1('0x41')](_0x3bb790[_0xeed1('0x42')]['fields']));_0x27f545[_0xeed1('0x40')]=_0x27f545[_0xeed1('0x40')][_0xeed1('0x43')]?_0x27f545['attributes']:_0x1e309b[_0xeed1('0x3d')];if(!_0x3bb790[_0xeed1('0x42')][_0xeed1('0x44')](_0xeed1('0x45'))){_0x27f545[_0xeed1('0x21')]=qs[_0xeed1('0x21')](_0x3bb790[_0xeed1('0x42')]['limit']);_0x27f545[_0xeed1('0x1f')]=qs[_0xeed1('0x1f')](_0x3bb790[_0xeed1('0x42')]['offset']);}_0x27f545[_0xeed1('0x96')]=qs[_0xeed1('0x46')](_0x3bb790['query'][_0xeed1('0x46')]);_0x27f545[_0xeed1('0x7b')]=qs[_0xeed1('0x3e')](_[_0xeed1('0xbd')](_0x3bb790[_0xeed1('0x42')],_0x1e309b[_0xeed1('0x3e')]));_0x27f545[_0xeed1('0x7b')][_0xeed1('0xb2')]=_0x5b47c7['id'];if(_0x3bb790['query'][_0xeed1('0x8a')]){_0x27f545['where']=_[_0xeed1('0x9f')](_0x27f545[_0xeed1('0x7b')],{'$or':_['map'](_0x27f545['attributes'],function(_0x5665f6){var _0x1ea166={};_0x1ea166[_0x5665f6]={'$like':'%'+_0x3bb790['query'][_0xeed1('0x8a')]+'%'};return _0x1ea166;})});}if(_0x3bb790[_0xeed1('0x42')][_0xeed1('0x7e')]){var _0x308c97=_0x3bb790['query'][_0xeed1('0x7e')][_0xeed1('0x2f')](',');var _0x22a183={};_0x22a183[_0x308c97[0x0]]={'$gte':moment(_0x308c97[0x1])[_0xeed1('0xbe')](_0xeed1('0xbf'))};_0x27f545[_0xeed1('0x7b')]=_[_0xeed1('0x9f')](_0x27f545[_0xeed1('0x7b')],_0x22a183);}_0x27f545=_[_0xeed1('0x9f')]({},_0x27f545,_0x3bb790[_0xeed1('0xb6')]);return db['FaxMessage']['count']({'where':_0x27f545[_0xeed1('0x7b')]})['then'](function(_0x56714d){_0x3741aa['count']=_0x56714d;if(_0x3bb790[_0xeed1('0x42')][_0xeed1('0xc0')]){_0x27f545[_0xeed1('0xc1')]=[{'all':!![]}];}return db[_0xeed1('0xc2')][_0xeed1('0xc3')](_0x27f545);})[_0xeed1('0x28')](function(_0x4b034b){_0x3741aa['rows']=_0x4b034b;return _0x3741aa;});}})[_0xeed1('0x28')](respondWithFilteredResult(_0x27151e,_0x27f545))['catch'](handleError(_0x27151e,null));};exports[_0xeed1('0xc4')]=function(_0x7ce133,_0x3e6b55,_0x4eac0a){return db[_0xeed1('0x3a')]['find']({'where':{'id':_0x7ce133[_0xeed1('0xb5')]['id']}})[_0xeed1('0x28')](handleEntityNotFound(_0x3e6b55,null))[_0xeed1('0x28')](function(_0x5ae466){if(_0x5ae466){return _0x5ae466[_0xeed1('0xc5')](_0x7ce133[_0xeed1('0x75')]['ids'],_[_0xeed1('0xbb')](_0x7ce133['body'],[_0xeed1('0xba'),'id'])||{})[_0xeed1('0xc6')](function(){return db[_0xeed1('0x70')][_0xeed1('0xc3')]({'attributes':['id',_0xeed1('0x2a'),_0xeed1('0x49')],'where':{'id':_0x7ce133['body']['ids']}});})[_0xeed1('0x28')](function(_0x6f298d){socket[_0xeed1('0xc7')](_0xeed1('0xc8'),{'id':Number(_0x7ce133[_0xeed1('0xb5')]['id']),'tags':_0x6f298d||[]});return{'id':Number(_0x7ce133[_0xeed1('0xb5')]['id']),'tags':_0x6f298d||[]};});}})[_0xeed1('0x28')](respondWithResult(_0x3e6b55,null))['catch'](handleError(_0x3e6b55,null));};exports[_0xeed1('0xc9')]=function(_0x59396e,_0x413656,_0x122048){return db['FaxInteraction'][_0xeed1('0x5f')]({'where':{'id':_0x59396e[_0xeed1('0xb5')]['id']}})[_0xeed1('0x28')](handleEntityNotFound(_0x413656,null))[_0xeed1('0x28')](function(_0x4b5488){if(_0x4b5488){return _0x4b5488[_0xeed1('0xc9')](_0x59396e[_0xeed1('0x42')][_0xeed1('0xba')]);}})[_0xeed1('0x28')](respondWithStatusCode(_0x413656,null))[_0xeed1('0x33')](handleError(_0x413656,null));};exports[_0xeed1('0xca')]=function(_0x1d57cb,_0x30693e){var _0x117276=moment()[_0xeed1('0xcb')]()['toString']();var _0x41b245=path[_0xeed1('0xcc')](config['root'],_0xeed1('0xcd'),_0xeed1('0xce'),'tmp');var _0x2f5df3=path[_0xeed1('0xcc')](config[_0xeed1('0xcf')],_0xeed1('0xcd'),_0xeed1('0xce'),'attachments');var _0x502a59=path['join'](_0x41b245,_0x117276);var _0x1fbf1f=util[_0xeed1('0xbe')](_0xeed1('0xd0'),_0x1d57cb[_0xeed1('0xb5')]['id'],_0x117276);var _0x3b4808=path['join'](_0x41b245,_0x1fbf1f);var _0x3b8c65=[];_0x3b8c65[_0xeed1('0x31')]({'model':db[_0xeed1('0xd1')],'as':_0xeed1('0xd1'),'raw':!![]});var _0x57a77f=[{'model':db[_0xeed1('0xc2')],'as':'Messages','attributes':['id',_0xeed1('0x75'),_0xeed1('0xd2')],'include':_0x3b8c65}];return db[_0xeed1('0x3a')][_0xeed1('0x5f')]({'where':{'id':_0x1d57cb[_0xeed1('0xb5')]['id']},'include':_0x57a77f})['then'](handleEntityNotFound(_0x30693e,null))[_0xeed1('0x28')](function(_0x5cad34){if(_0x5cad34&&_0x5cad34[_0xeed1('0xd3')]){var _0x48aa18=_0x5cad34[_0xeed1('0xd4')]({'plain':!![]});fs[_0xeed1('0xd5')](_0x502a59);for(var _0x55d7d8=0x0;_0x55d7d8<_0x48aa18[_0xeed1('0xd3')][_0xeed1('0x43')];_0x55d7d8++){var _0x6fa842=_0x48aa18[_0xeed1('0xd3')][_0x55d7d8][_0xeed1('0xd1')];if(_0x6fa842){var _0x5a7c56=path['join'](_0x2f5df3,_0x6fa842['basename']);if(fs[_0xeed1('0xd6')](_0x5a7c56)){fs[_0xeed1('0xd7')](_0x5a7c56)[_0xeed1('0xd8')](fs[_0xeed1('0xd9')](path[_0xeed1('0xcc')](_0x502a59,_0x6fa842['basename'])));}}}return BPromise[_0xeed1('0x98')]()['then'](function(){return new BPromise(function(_0xb6d44f,_0x323f2e){zipdir(_0x502a59,{'saveTo':_0x3b4808},function(_0x1d7905,_0x30eff2){if(_0x1d7905)return _0x323f2e(_0x1d7905);return _0xb6d44f(_0x30eff2);});})['then'](function(){return new BPromise(function(_0x31d185,_0x43cae6){rimraf(_0x502a59,function(_0x109685){if(_0x109685)_0x43cae6(_0x109685);return _0x31d185();});});})[_0xeed1('0x28')](function(){return _0x30693e[_0xeed1('0xca')](_0x3b4808,_0x1fbf1f,function(_0x26340c){if(_0x26340c){console[_0xeed1('0xda')](_0xeed1('0xdb'),_0x26340c);}else{fs[_0xeed1('0xdc')](_0x3b4808);}});});});}else{return _0x30693e['sendStatus'](0xc8);}})[_0xeed1('0x33')](handleError(_0x30693e,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index a31b317..d03c12a 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 _0x760f=['catch','hasOwnProperty','hook','exports','events','../../mysqldb','FaxInteraction','save','remove','then','setDataValue','Users','findAll','unreadMessages','length','emit'];(function(_0x4a1a5a,_0x4a0e1b){var _0x44bffd=function(_0x395de4){while(--_0x395de4){_0x4a1a5a['push'](_0x4a1a5a['shift']());}};_0x44bffd(++_0x4a0e1b);}(_0x760f,0x1a4));var _0xf760=function(_0x1fb1ba,_0x834081){_0x1fb1ba=_0x1fb1ba-0x0;var _0x1add53=_0x760f[_0x1fb1ba];return _0x1add53;};'use strict';var EventEmitter=require(_0xf760('0x0'));var FaxInteraction=require(_0xf760('0x1'))['db'][_0xf760('0x2')];var FaxMessage=require('../../mysqldb')['db']['FaxMessage'];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf760('0x3'),'afterUpdate':'update','afterDestroy':_0xf760('0x4')};function emitEvent(_0x2de189){return function(_0x29b3af,_0x313cfc,_0x163f3d){_0x29b3af['getUsers']({'attributes':['id'],'raw':!![]})[_0xf760('0x5')](function(_0x439cfa){_0x29b3af[_0xf760('0x6')](_0xf760('0x7'),_0x439cfa['map'](function(_0x1ff908){return{'id':_0x1ff908['id']};}));return FaxMessage[_0xf760('0x8')]({'where':{'FaxInteractionId':_0x29b3af['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf760('0x5')](function(_0xb75a63){_0x29b3af[_0xf760('0x6')](_0xf760('0x9'),_0xb75a63[_0xf760('0xa')]);FaxInteractionEvents[_0xf760('0xb')](_0x2de189+':'+_0x29b3af['id'],_0x29b3af);FaxInteractionEvents[_0xf760('0xb')](_0x2de189,_0x29b3af);_0x163f3d(null);})[_0xf760('0xc')](_0x163f3d(null));};}for(var e in events){if(events[_0xf760('0xd')](e)){var event=events[e];FaxInteraction[_0xf760('0xe')](e,emitEvent(event));}}module[_0xf760('0xf')]=FaxInteractionEvents; \ No newline at end of file +var _0xef54=['update','getUsers','Users','map','findAll','then','unreadMessages','length','emit','catch','hook','exports','../../mysqldb','setMaxListeners'];(function(_0x4c1c6a,_0x4c1ef5){var _0x59a9df=function(_0x6825f8){while(--_0x6825f8){_0x4c1c6a['push'](_0x4c1c6a['shift']());}};_0x59a9df(++_0x4c1ef5);}(_0xef54,0x178));var _0x4ef5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xef54[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0x4ef5('0x0'))['db']['FaxInteraction'];var FaxMessage=require(_0x4ef5('0x0'))['db']['FaxMessage'];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x4ef5('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4ef5('0x2'),'afterDestroy':'remove'};function emitEvent(_0x59e8cb){return function(_0x467726,_0x3ecff1,_0x15417a){_0x467726[_0x4ef5('0x3')]({'attributes':['id'],'raw':!![]})['then'](function(_0x425df6){_0x467726['setDataValue'](_0x4ef5('0x4'),_0x425df6[_0x4ef5('0x5')](function(_0x11dc3d){return{'id':_0x11dc3d['id']};}));return FaxMessage[_0x4ef5('0x6')]({'where':{'FaxInteractionId':_0x467726['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4ef5('0x7')](function(_0x25752f){_0x467726['setDataValue'](_0x4ef5('0x8'),_0x25752f[_0x4ef5('0x9')]);FaxInteractionEvents[_0x4ef5('0xa')](_0x59e8cb+':'+_0x467726['id'],_0x467726);FaxInteractionEvents[_0x4ef5('0xa')](_0x59e8cb,_0x467726);_0x15417a(null);})[_0x4ef5('0xb')](_0x15417a(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxInteraction[_0x4ef5('0xc')](e,emitEvent(event));}}module[_0x4ef5('0xd')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 66cda4f..be35a23 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 _0xcd26=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','FaxInteraction','fax_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','util'];(function(_0x3a7634,_0x2db384){var _0x23bbe9=function(_0x226734){while(--_0x226734){_0x3a7634['push'](_0x3a7634['shift']());}};_0x23bbe9(++_0x2db384);}(_0xcd26,0x77));var _0x6cd2=function(_0x525b28,_0x5cf5a0){_0x525b28=_0x525b28-0x0;var _0x180178=_0xcd26[_0x525b28];return _0x180178;};'use strict';var _=require('lodash');var util=require(_0x6cd2('0x0'));var logger=require('../../config/logger')(_0x6cd2('0x1'));var moment=require(_0x6cd2('0x2'));var BPromise=require(_0x6cd2('0x3'));var rp=require(_0x6cd2('0x4'));var fs=require('fs');var path=require(_0x6cd2('0x5'));var rimraf=require(_0x6cd2('0x6'));var config=require(_0x6cd2('0x7'));var attributes=require('./faxInteraction.attributes');module['exports']=function(_0xa7f153,_0x2e9b24){return _0xa7f153[_0x6cd2('0x8')](_0x6cd2('0x9'),attributes,{'tableName':_0x6cd2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x53d18d,_0x8a4d42,_0x5d2030){if(_0x53d18d[_0x6cd2('0xb')](_0x6cd2('0xc'))){_0x53d18d[_0x6cd2('0xd')]=moment()['format'](_0x6cd2('0xe'));}_0x5d2030(null,_0x53d18d);}}});}; \ No newline at end of file +var _0x5835=['changed','closed','closedAt','lodash','api','moment','path','../../config/environment','exports','define','FaxInteraction','fax_interactions'];(function(_0x182f24,_0x45248e){var _0x2a65f7=function(_0x43eb47){while(--_0x43eb47){_0x182f24['push'](_0x182f24['shift']());}};_0x2a65f7(++_0x45248e);}(_0x5835,0x123));var _0x5583=function(_0x4053e0,_0x37752f){_0x4053e0=_0x4053e0-0x0;var _0x10c77f=_0x5835[_0x4053e0];return _0x10c77f;};'use strict';var _=require(_0x5583('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5583('0x1'));var moment=require(_0x5583('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5583('0x3'));var rimraf=require('rimraf');var config=require(_0x5583('0x4'));var attributes=require('./faxInteraction.attributes');module[_0x5583('0x5')]=function(_0x5a0c58,_0x569959){return _0x5a0c58[_0x5583('0x6')](_0x5583('0x7'),attributes,{'tableName':_0x5583('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2e2362,_0x16b5f8,_0x35cd74){if(_0x2e2362[_0x5583('0x9')](_0x5583('0xa'))){_0x2e2362[_0x5583('0xb')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x35cd74(null,_0x2e2362);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 9ee25f1..9379d2d 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 _0x7bbd=['AddTags','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','./faxInteraction.socket','request','info','FaxInteraction,\x20%s,\x20%s','FaxInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','UpdateFaxInteraction','update','body','options','raw','where','attributes','limit','then','catch','AddTagsToFaxInteraction','FaxInteraction','find','addTags','ids','omit','spread'];(function(_0x2f7023,_0x1aa399){var _0x2f5e4e=function(_0x1fa5d4){while(--_0x1fa5d4){_0x2f7023['push'](_0x2f7023['shift']());}};_0x2f5e4e(++_0x1aa399);}(_0x7bbd,0x1ba));var _0xd7bb=function(_0x2a258d,_0x4460de){_0x2a258d=_0x2a258d-0x0;var _0x4fb931=_0x7bbd[_0x2a258d];return _0x4fb931;};'use strict';var _=require(_0xd7bb('0x0'));var util=require(_0xd7bb('0x1'));var moment=require(_0xd7bb('0x2'));var BPromise=require(_0xd7bb('0x3'));var rs=require(_0xd7bb('0x4'));var fs=require('fs');var Redis=require(_0xd7bb('0x5'));var db=require(_0xd7bb('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd7bb('0x7'));var config=require(_0xd7bb('0x8'));var jayson=require(_0xd7bb('0x9'));var client=jayson[_0xd7bb('0xa')][_0xd7bb('0xb')]({'port':0x232a});config['redis']=_[_0xd7bb('0xc')](config[_0xd7bb('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd7bb('0xd')]));require(_0xd7bb('0xe'))['register'](socket);function respondWithRpcPromise(_0x1c762c,_0x31c305,_0x3bc0b9){return new BPromise(function(_0x184715,_0x28a358){return client[_0xd7bb('0xf')](_0x1c762c,_0x3bc0b9)['then'](function(_0x2e0875){logger[_0xd7bb('0x10')](_0xd7bb('0x11'),_0x31c305,'request\x20sent');logger['debug'](_0xd7bb('0x12'),_0x31c305,_0xd7bb('0x13'),JSON[_0xd7bb('0x14')](_0x2e0875));if(_0x2e0875[_0xd7bb('0x15')]){if(_0x2e0875['error'][_0xd7bb('0x16')]===0x1f4){logger['error'](_0xd7bb('0x11'),_0x31c305,_0x2e0875[_0xd7bb('0x15')][_0xd7bb('0x17')]);return _0x28a358(_0x2e0875[_0xd7bb('0x15')][_0xd7bb('0x17')]);}logger['error'](_0xd7bb('0x11'),_0x31c305,_0x2e0875['error']['message']);return _0x184715(_0x2e0875[_0xd7bb('0x15')][_0xd7bb('0x17')]);}else{logger[_0xd7bb('0x10')]('FaxInteraction,\x20%s,\x20%s',_0x31c305,'request\x20sent');_0x184715(_0x2e0875[_0xd7bb('0x18')][_0xd7bb('0x17')]);}})['catch'](function(_0x111372){logger[_0xd7bb('0x15')](_0xd7bb('0x11'),_0x31c305,_0x111372);_0x28a358(_0x111372);});});}exports[_0xd7bb('0x19')]=function(_0x2386f7){var _0xe54458=this;return new Promise(function(_0x825df1,_0x571cad){return db['FaxInteraction'][_0xd7bb('0x1a')](_0x2386f7[_0xd7bb('0x1b')],{'raw':_0x2386f7[_0xd7bb('0x1c')]?_0x2386f7[_0xd7bb('0x1c')][_0xd7bb('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2386f7[_0xd7bb('0x1c')]?_0x2386f7['options'][_0xd7bb('0x1e')]||null:null,'attributes':_0x2386f7[_0xd7bb('0x1c')]?_0x2386f7['options'][_0xd7bb('0x1f')]||null:null,'limit':_0x2386f7[_0xd7bb('0x1c')]?_0x2386f7[_0xd7bb('0x1c')][_0xd7bb('0x20')]||null:null})[_0xd7bb('0x21')](function(_0x5d3218){logger[_0xd7bb('0x10')](_0xd7bb('0x19'),_0x2386f7);logger['debug'](_0xd7bb('0x19'),_0x2386f7,JSON['stringify'](_0x5d3218));_0x825df1(_0x5d3218);})[_0xd7bb('0x22')](function(_0x55a6d9){logger['error'](_0xd7bb('0x19'),_0x55a6d9[_0xd7bb('0x17')],_0x2386f7);_0x571cad(_0xe54458[_0xd7bb('0x15')](0x1f4,_0x55a6d9[_0xd7bb('0x17')]));});});};exports[_0xd7bb('0x23')]=function(_0x504f13){return new Promise(function(_0x470980,_0x68112f){return db[_0xd7bb('0x24')][_0xd7bb('0x25')]({'where':_0x504f13[_0xd7bb('0x1c')]?_0x504f13['options'][_0xd7bb('0x1e')]||null:null})[_0xd7bb('0x21')](function(_0x3a78f2){if(_0x3a78f2){return _0x3a78f2[_0xd7bb('0x26')](_0x504f13[_0xd7bb('0x1b')][_0xd7bb('0x27')],_[_0xd7bb('0x28')](_0x504f13['body'],['ids','id'])||{});}})[_0xd7bb('0x29')](function(_0x42c60b){logger[_0xd7bb('0x10')](_0xd7bb('0x2a'),_0x504f13);logger[_0xd7bb('0x2b')]('AddTags',_0x504f13,JSON[_0xd7bb('0x14')](_0x42c60b));_0x470980(_0x42c60b);})[_0xd7bb('0x22')](function(_0x2de131){logger['error']('AddTags',_0x2de131['message'],_0x504f13);_0x68112f(_this['error'](0x1f4,_0x2de131[_0xd7bb('0x17')]));});});}; \ No newline at end of file +var _0xcf49=['redis','localhost','socket.io-emitter','./faxInteraction.socket','request','then','info','request\x20sent','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxInteraction,\x20%s,\x20%s','message','result','catch','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','where','attributes','limit','debug','AddTagsToFaxInteraction','find','addTags','omit','ids','spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http'];(function(_0x2fbd33,_0x5ea91b){var _0x23059c=function(_0x408bc4){while(--_0x408bc4){_0x2fbd33['push'](_0x2fbd33['shift']());}};_0x23059c(++_0x5ea91b);}(_0xcf49,0x14e));var _0x9cf4=function(_0x536068,_0x3de52c){_0x536068=_0x536068-0x0;var _0x4a5db2=_0xcf49[_0x536068];return _0x4a5db2;};'use strict';var _=require(_0x9cf4('0x0'));var util=require(_0x9cf4('0x1'));var moment=require('moment');var BPromise=require(_0x9cf4('0x2'));var rs=require(_0x9cf4('0x3'));var fs=require('fs');var Redis=require(_0x9cf4('0x4'));var db=require(_0x9cf4('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9cf4('0x6'))(_0x9cf4('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9cf4('0x8')][_0x9cf4('0x9')]({'port':0x232a});config[_0x9cf4('0xa')]=_['defaults'](config[_0x9cf4('0xa')],{'host':_0x9cf4('0xb'),'port':0x18eb});var socket=require(_0x9cf4('0xc'))(new Redis(config['redis']));require(_0x9cf4('0xd'))['register'](socket);function respondWithRpcPromise(_0x498392,_0x497b41,_0x3acee1){return new BPromise(function(_0x243bde,_0x29039d){return client[_0x9cf4('0xe')](_0x498392,_0x3acee1)[_0x9cf4('0xf')](function(_0x1824d0){logger[_0x9cf4('0x10')]('FaxInteraction,\x20%s,\x20%s',_0x497b41,_0x9cf4('0x11'));logger['debug'](_0x9cf4('0x12'),_0x497b41,_0x9cf4('0x11'),JSON[_0x9cf4('0x13')](_0x1824d0));if(_0x1824d0[_0x9cf4('0x14')]){if(_0x1824d0[_0x9cf4('0x14')][_0x9cf4('0x15')]===0x1f4){logger['error'](_0x9cf4('0x16'),_0x497b41,_0x1824d0[_0x9cf4('0x14')][_0x9cf4('0x17')]);return _0x29039d(_0x1824d0[_0x9cf4('0x14')]['message']);}logger[_0x9cf4('0x14')](_0x9cf4('0x16'),_0x497b41,_0x1824d0[_0x9cf4('0x14')]['message']);return _0x243bde(_0x1824d0[_0x9cf4('0x14')]['message']);}else{logger[_0x9cf4('0x10')](_0x9cf4('0x16'),_0x497b41,_0x9cf4('0x11'));_0x243bde(_0x1824d0[_0x9cf4('0x18')][_0x9cf4('0x17')]);}})[_0x9cf4('0x19')](function(_0x312831){logger[_0x9cf4('0x14')](_0x9cf4('0x16'),_0x497b41,_0x312831);_0x29039d(_0x312831);});});}exports[_0x9cf4('0x1a')]=function(_0x40b253){var _0x4c1ccb=this;return new Promise(function(_0x1530cd,_0x536937){return db[_0x9cf4('0x1b')][_0x9cf4('0x1c')](_0x40b253[_0x9cf4('0x1d')],{'raw':_0x40b253[_0x9cf4('0x1e')]?_0x40b253['options'][_0x9cf4('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x40b253[_0x9cf4('0x1e')]?_0x40b253[_0x9cf4('0x1e')][_0x9cf4('0x20')]||null:null,'attributes':_0x40b253[_0x9cf4('0x1e')]?_0x40b253[_0x9cf4('0x1e')][_0x9cf4('0x21')]||null:null,'limit':_0x40b253['options']?_0x40b253[_0x9cf4('0x1e')][_0x9cf4('0x22')]||null:null})['then'](function(_0x5d142c){logger[_0x9cf4('0x10')](_0x9cf4('0x1a'),_0x40b253);logger[_0x9cf4('0x23')]('UpdateFaxInteraction',_0x40b253,JSON[_0x9cf4('0x13')](_0x5d142c));_0x1530cd(_0x5d142c);})[_0x9cf4('0x19')](function(_0x2534cb){logger[_0x9cf4('0x14')](_0x9cf4('0x1a'),_0x2534cb[_0x9cf4('0x17')],_0x40b253);_0x536937(_0x4c1ccb[_0x9cf4('0x14')](0x1f4,_0x2534cb['message']));});});};exports[_0x9cf4('0x24')]=function(_0x74f485){return new Promise(function(_0x3682b7,_0x228b7e){return db['FaxInteraction'][_0x9cf4('0x25')]({'where':_0x74f485[_0x9cf4('0x1e')]?_0x74f485['options'][_0x9cf4('0x20')]||null:null})['then'](function(_0x6140c7){if(_0x6140c7){return _0x6140c7[_0x9cf4('0x26')](_0x74f485[_0x9cf4('0x1d')]['ids'],_[_0x9cf4('0x27')](_0x74f485[_0x9cf4('0x1d')],[_0x9cf4('0x28'),'id'])||{});}})[_0x9cf4('0x29')](function(_0x475bba){logger[_0x9cf4('0x10')](_0x9cf4('0x2a'),_0x74f485);logger[_0x9cf4('0x23')](_0x9cf4('0x2a'),_0x74f485,JSON['stringify'](_0x475bba));_0x3682b7(_0x475bba);})[_0x9cf4('0x19')](function(_0x486e26){logger['error'](_0x9cf4('0x2a'),_0x486e26[_0x9cf4('0x17')],_0x74f485);_0x228b7e(_this[_0x9cf4('0x14')](0x1f4,_0x486e26[_0x9cf4('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 3784d40..ba17469 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 _0x2762=['remove','update','emit','removeListener','length','faxInteraction:','./faxInteraction.events','save'];(function(_0x4f205d,_0x39af34){var _0x255e92=function(_0x238e4c){while(--_0x238e4c){_0x4f205d['push'](_0x4f205d['shift']());}};_0x255e92(++_0x39af34);}(_0x2762,0x116));var _0x2276=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2762[_0x3dd15e];return _0x231fd0;};'use strict';var FaxInteractionEvents=require(_0x2276('0x0'));var events=[_0x2276('0x1'),_0x2276('0x2'),_0x2276('0x3')];function createListener(_0x31f0e7,_0x4d7fac){return function(_0x2d93df){_0x4d7fac[_0x2276('0x4')](_0x31f0e7,_0x2d93df);};}function removeListener(_0x420f0a,_0x3fe304){return function(){FaxInteractionEvents[_0x2276('0x5')](_0x420f0a,_0x3fe304);};}exports['register']=function(_0x142166){for(var _0x999b2c=0x0,_0x13e215=events[_0x2276('0x6')];_0x999b2c<_0x13e215;_0x999b2c++){var _0x4f022c=events[_0x999b2c];var _0x557987=createListener(_0x2276('0x7')+_0x4f022c,_0x142166);FaxInteractionEvents['on'](_0x4f022c,_0x557987);}}; \ No newline at end of file +var _0x3f8a=['./faxInteraction.events','save','update','removeListener','register','length','faxInteraction:'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0x3f8a,0x93));var _0xa3f8=function(_0x5c4aff,_0x8483ea){_0x5c4aff=_0x5c4aff-0x0;var _0x660184=_0x3f8a[_0x5c4aff];return _0x660184;};'use strict';var FaxInteractionEvents=require(_0xa3f8('0x0'));var events=[_0xa3f8('0x1'),'remove',_0xa3f8('0x2')];function createListener(_0x4afd4f,_0x520c07){return function(_0x215779){_0x520c07['emit'](_0x4afd4f,_0x215779);};}function removeListener(_0x5d801f,_0x49b059){return function(){FaxInteractionEvents[_0xa3f8('0x3')](_0x5d801f,_0x49b059);};}exports[_0xa3f8('0x4')]=function(_0xcf71d){for(var _0x1f2e3a=0x0,_0x1773d9=events[_0xa3f8('0x5')];_0x1f2e3a<_0x1773d9;_0x1f2e3a++){var _0x13a88e=events[_0x1f2e3a];var _0x4489c5=createListener(_0xa3f8('0x6')+_0x13a88e,_0xcf71d);FaxInteractionEvents['on'](_0x13a88e,_0x4489c5);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 3800d34..5763125 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 _0xec12=['show','/:id/messages','getMessages','/:id/download','download','post','addMessage','/:id/tags','fax','addTags','tracked','faxinteraction:update','update','delete','faxinteraction:destroy','destroy','removeTags','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0xa74e7b,_0x4a3ee5){var _0x431939=function(_0x58b6ed){while(--_0x58b6ed){_0xa74e7b['push'](_0xa74e7b['shift']());}};_0x431939(++_0x4a3ee5);}(_0xec12,0x1bf));var _0x2ec1=function(_0xd99de,_0x2270a9){_0xd99de=_0xd99de-0x0;var _0x54116b=_0xec12[_0xd99de];return _0x54116b;};'use strict';var multer=require(_0x2ec1('0x0'));var util=require(_0x2ec1('0x1'));var path=require('path');var timeout=require(_0x2ec1('0x2'));var express=require(_0x2ec1('0x3'));var router=express[_0x2ec1('0x4')]();var fs_extra=require(_0x2ec1('0x5'));var auth=require(_0x2ec1('0x6'));var interaction=require(_0x2ec1('0x7'));var config=require(_0x2ec1('0x8'));var controller=require('./faxInteraction.controller');router[_0x2ec1('0x9')]('/',auth[_0x2ec1('0xa')](),controller[_0x2ec1('0xb')]);router[_0x2ec1('0x9')](_0x2ec1('0xc'),auth[_0x2ec1('0xa')](),controller[_0x2ec1('0xd')]);router[_0x2ec1('0x9')](_0x2ec1('0xe'),auth[_0x2ec1('0xa')](),controller[_0x2ec1('0xf')]);router['get'](_0x2ec1('0x10'),auth[_0x2ec1('0xa')](),controller[_0x2ec1('0x11')]);router[_0x2ec1('0x9')](_0x2ec1('0x12'),auth[_0x2ec1('0xa')](),controller[_0x2ec1('0x13')]);router[_0x2ec1('0x14')]('/',auth[_0x2ec1('0xa')](),controller['create']);router[_0x2ec1('0x14')]('/:id/messages',auth[_0x2ec1('0xa')](),controller[_0x2ec1('0x15')]);router[_0x2ec1('0x14')](_0x2ec1('0x16'),auth[_0x2ec1('0xa')](),interaction['tracked'](_0x2ec1('0x17'),'faxinteraction:addtags'),controller[_0x2ec1('0x18')]);router['put'](_0x2ec1('0xe'),auth[_0x2ec1('0xa')](),interaction[_0x2ec1('0x19')]('fax',_0x2ec1('0x1a')),controller[_0x2ec1('0x1b')]);router[_0x2ec1('0x1c')](_0x2ec1('0xe'),auth[_0x2ec1('0xa')](),interaction[_0x2ec1('0x19')](_0x2ec1('0x17'),_0x2ec1('0x1d')),controller[_0x2ec1('0x1e')]);router[_0x2ec1('0x1c')]('/:id/tags',auth[_0x2ec1('0xa')](),controller[_0x2ec1('0x1f')]);module[_0x2ec1('0x20')]=router; \ No newline at end of file +var _0x9c5e=['/:id/tags','removeTags','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','index','describe','show','getMessages','/:id/download','download','post','create','/:id/messages','addMessage','tracked','fax','faxinteraction:addtags','addTags','/:id','update','faxinteraction:destroy','destroy','delete'];(function(_0x5a8e1d,_0x54d414){var _0x171d83=function(_0x30ee59){while(--_0x30ee59){_0x5a8e1d['push'](_0x5a8e1d['shift']());}};_0x171d83(++_0x54d414);}(_0x9c5e,0x113));var _0xe9c5=function(_0x2e5a9a,_0x2b809c){_0x2e5a9a=_0x2e5a9a-0x0;var _0x198d5b=_0x9c5e[_0x2e5a9a];return _0x198d5b;};'use strict';var multer=require('multer');var util=require(_0xe9c5('0x0'));var path=require(_0xe9c5('0x1'));var timeout=require(_0xe9c5('0x2'));var express=require(_0xe9c5('0x3'));var router=express[_0xe9c5('0x4')]();var fs_extra=require(_0xe9c5('0x5'));var auth=require(_0xe9c5('0x6'));var interaction=require(_0xe9c5('0x7'));var config=require(_0xe9c5('0x8'));var controller=require(_0xe9c5('0x9'));router[_0xe9c5('0xa')]('/',auth[_0xe9c5('0xb')](),controller[_0xe9c5('0xc')]);router[_0xe9c5('0xa')]('/describe',auth[_0xe9c5('0xb')](),controller[_0xe9c5('0xd')]);router[_0xe9c5('0xa')]('/:id',auth[_0xe9c5('0xb')](),controller[_0xe9c5('0xe')]);router['get']('/:id/messages',auth[_0xe9c5('0xb')](),controller[_0xe9c5('0xf')]);router['get'](_0xe9c5('0x10'),auth[_0xe9c5('0xb')](),controller[_0xe9c5('0x11')]);router[_0xe9c5('0x12')]('/',auth['isAuthenticated'](),controller[_0xe9c5('0x13')]);router[_0xe9c5('0x12')](_0xe9c5('0x14'),auth['isAuthenticated'](),controller[_0xe9c5('0x15')]);router['post']('/:id/tags',auth[_0xe9c5('0xb')](),interaction[_0xe9c5('0x16')](_0xe9c5('0x17'),_0xe9c5('0x18')),controller[_0xe9c5('0x19')]);router['put'](_0xe9c5('0x1a'),auth[_0xe9c5('0xb')](),interaction[_0xe9c5('0x16')](_0xe9c5('0x17'),'faxinteraction:update'),controller[_0xe9c5('0x1b')]);router['delete'](_0xe9c5('0x1a'),auth[_0xe9c5('0xb')](),interaction[_0xe9c5('0x16')](_0xe9c5('0x17'),_0xe9c5('0x1c')),controller[_0xe9c5('0x1d')]);router[_0xe9c5('0x1e')](_0xe9c5('0x1f'),auth[_0xe9c5('0xb')](),controller[_0xe9c5('0x20')]);module[_0xe9c5('0x21')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index ff12f11..d55450e 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 _0x6737=['BOOLEAN','ENUM','out','DATE','exports','TEXT'];(function(_0x56916d,_0x37b935){var _0x2b7f1f=function(_0x206eb1){while(--_0x206eb1){_0x56916d['push'](_0x56916d['shift']());}};_0x2b7f1f(++_0x37b935);}(_0x6737,0xe2));var _0x7673=function(_0x133d89,_0xe80fe9){_0x133d89=_0x133d89-0x0;var _0x20e597=_0x6737[_0x133d89];return _0x20e597;};'use strict';var Sequelize=require('sequelize');module[_0x7673('0x0')]={'body':{'type':Sequelize[_0x7673('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x7673('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x7673('0x3')]('in',_0x7673('0x4')),'defaultValue':_0x7673('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize[_0x7673('0x5')]}}; \ No newline at end of file +var _0xa37e=['DATE','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0x2a1ff0,_0x37e676){var _0x4d4c01=function(_0x142059){while(--_0x142059){_0x2a1ff0['push'](_0x2a1ff0['shift']());}};_0x4d4c01(++_0x37e676);}(_0xa37e,0x97));var _0xea37=function(_0x272aca,_0x695f4d){_0x272aca=_0x272aca-0x0;var _0x5e62ca=_0xa37e[_0x272aca];return _0x5e62ca;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0xea37('0x0')](_0xea37('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0xea37('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xea37('0x3')]('in','out'),'defaultValue':_0xea37('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize[_0xea37('0x5')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index d6b65bd..ce7fb2a 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 _0x271f=['root','server','download','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./faxMessage.socket','register','client','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','stack','name','send','index','map','FaxMessage','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','options','includeAll','findAll','rows','show','params','length','include','find','body','destroy','describe','accept','fax','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','FaxInteraction','FaxInteractionId','isNil','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','interaction','stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','motionChannel','channel','event','EventManager','acceptmessage','fax-interactions','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','rejectMessage','sequelize','rejectmessage','create','CmContact','Attachment','findOne','AttachmentId','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','join'];(function(_0x1477ef,_0x54a5d6){var _0x164acd=function(_0x139149){while(--_0x139149){_0x1477ef['push'](_0x1477ef['shift']());}};_0x164acd(++_0x54a5d6);}(_0x271f,0x123));var _0xf271=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x271f[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require(_0xf271('0x0'));var rimraf=require(_0xf271('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf271('0x2'));var moment=require(_0xf271('0x3'));var BPromise=require(_0xf271('0x4'));var Mustache=require(_0xf271('0x5'));var util=require(_0xf271('0x6'));var path=require(_0xf271('0x7'));var sox=require('sox');var csv=require(_0xf271('0x8'));var ejs=require(_0xf271('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf271('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf271('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xf271('0x8'));var querystring=require(_0xf271('0xc'));var Papa=require(_0xf271('0xd'));var Redis=require('ioredis');var authService=require(_0xf271('0xe'));var qs=require(_0xf271('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf271('0x10'));var logger=require(_0xf271('0x11'))(_0xf271('0x12'));var utils=require(_0xf271('0x13'));var config=require(_0xf271('0x14'));var licenseUtil=require(_0xf271('0x15'));var db=require(_0xf271('0x16'))['db'];config[_0xf271('0x17')]=_[_0xf271('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xf271('0x19'))(new Redis(config[_0xf271('0x17')]));require(_0xf271('0x1a'))[_0xf271('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson[_0xf271('0x1c')]['http']({'port':0x232c});var client9002=jayson[_0xf271('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x300437,_0x3f8a66,_0x83a5ec,_0xafe6f5){return new BPromise(function(_0x3b7ebc,_0x5e37e7){var _0x48b1a5=_0xafe6f5||client;return _0x48b1a5[_0xf271('0x1d')](_0x300437,_0x83a5ec)[_0xf271('0x1e')](function(_0x435a75){logger[_0xf271('0x1f')](_0xf271('0x20'),_0x3f8a66,_0xf271('0x21'));logger[_0xf271('0x22')](_0xf271('0x23'),_0x3f8a66,_0xf271('0x21'),JSON['stringify'](_0x435a75));if(_0x435a75[_0xf271('0x24')]){if(_0x435a75[_0xf271('0x24')][_0xf271('0x25')]===0x1f4){logger[_0xf271('0x24')](_0xf271('0x20'),_0x3f8a66,_0x435a75['error'][_0xf271('0x26')]);return _0x5e37e7(_0x435a75['error'][_0xf271('0x26')]);}logger[_0xf271('0x24')](_0xf271('0x20'),_0x3f8a66,_0x435a75[_0xf271('0x24')][_0xf271('0x26')]);return _0x3b7ebc(_0x435a75[_0xf271('0x24')][_0xf271('0x26')]);}else{logger['info'](_0xf271('0x20'),_0x3f8a66,_0xf271('0x21'));_0x3b7ebc(_0x435a75[_0xf271('0x27')][_0xf271('0x26')]);}})[_0xf271('0x28')](function(_0x5aea02){logger['error'](_0xf271('0x20'),_0x3f8a66,_0x5aea02);_0x5e37e7(_0x5aea02);});});}function respondWithStatusCode(_0x1a69cd,_0x12250f){_0x12250f=_0x12250f||0xcc;return function(_0x158fd0){if(_0x158fd0){return _0x1a69cd[_0xf271('0x29')](_0x12250f);}return _0x1a69cd[_0xf271('0x2a')](_0x12250f)[_0xf271('0x2b')]();};}function respondWithResult(_0x30e61b,_0x124645){_0x124645=_0x124645||0xc8;return function(_0x58d337){if(_0x58d337){return _0x30e61b[_0xf271('0x2a')](_0x124645)[_0xf271('0x2c')](_0x58d337);}};}function respondWithFilteredResult(_0x56e017,_0x2558b3){return function(_0x2416e0){if(_0x2416e0){var _0x4c37ed=typeof _0x2558b3[_0xf271('0x2d')]===_0xf271('0x2e')&&typeof _0x2558b3[_0xf271('0x2f')]===_0xf271('0x2e');var _0x35001d=_0x2416e0[_0xf271('0x30')];var _0x4579bc=_0x4c37ed?0x0:_0x2558b3[_0xf271('0x2d')];var _0x11f92a=_0x4c37ed?_0x2416e0[_0xf271('0x30')]:_0x2558b3['offset']+_0x2558b3['limit'];var _0x5ebb3c;if(_0x11f92a>=_0x35001d){_0x11f92a=_0x35001d;_0x5ebb3c=0xc8;}else{_0x5ebb3c=0xce;}_0x56e017[_0xf271('0x2a')](_0x5ebb3c);return _0x56e017[_0xf271('0x31')]('Content-Range',_0x4579bc+'-'+_0x11f92a+'/'+_0x35001d)[_0xf271('0x2c')](_0x2416e0);}return null;};}function patchUpdates(_0x34e386){return function(_0x301d0b){try{jsonpatch[_0xf271('0x32')](_0x301d0b,_0x34e386,!![]);}catch(_0x2a6a64){return BPromise[_0xf271('0x33')](_0x2a6a64);}return _0x301d0b[_0xf271('0x34')]();};}function saveUpdates(_0x1ca018,_0x1a2e23){return function(_0x9614b4){if(_0x9614b4){return _0x9614b4[_0xf271('0x35')](_0x1ca018)[_0xf271('0x1e')](function(_0x1e8668){return _0x1e8668;});}return null;};}function removeEntity(_0x3e709b,_0x258e04){return function(_0x3da6b5){if(_0x3da6b5){return _0x3da6b5['destroy']()['then'](function(){_0x3e709b[_0xf271('0x2a')](0xcc)[_0xf271('0x2b')]();});}};}function handleEntityNotFound(_0x225d61,_0xd719d9){return function(_0x585b98){if(!_0x585b98){_0x225d61[_0xf271('0x29')](0x194);}return _0x585b98;};}function handleError(_0x1a475a,_0xdb1b1d){_0xdb1b1d=_0xdb1b1d||0x1f4;return function(_0x263eaa){logger[_0xf271('0x24')](_0x263eaa[_0xf271('0x36')]);if(_0x263eaa[_0xf271('0x37')]){delete _0x263eaa[_0xf271('0x37')];}_0x1a475a['status'](_0xdb1b1d)[_0xf271('0x38')](_0x263eaa);};}exports[_0xf271('0x39')]=function(_0x25c777,_0x49d380){var _0x25787a={},_0x554879={},_0x3e0eca={'count':0x0,'rows':[]};var _0xc62ef9=_[_0xf271('0x3a')](db[_0xf271('0x3b')][_0xf271('0x3c')],function(_0x48ba69){return{'name':_0x48ba69[_0xf271('0x3d')],'type':_0x48ba69[_0xf271('0x3e')]['key']};});_0x554879[_0xf271('0x3f')]=_['map'](_0xc62ef9,_0xf271('0x37'));_0x554879[_0xf271('0x40')]=_[_0xf271('0x41')](_0x25c777[_0xf271('0x40')]);_0x554879[_0xf271('0x42')]=_[_0xf271('0x43')](_0x554879['model'],_0x554879[_0xf271('0x40')]);_0x25787a[_0xf271('0x44')]=_[_0xf271('0x43')](_0x554879['model'],qs['fields'](_0x25c777[_0xf271('0x40')][_0xf271('0x45')]));_0x25787a[_0xf271('0x44')]=_0x25787a[_0xf271('0x44')]['length']?_0x25787a[_0xf271('0x44')]:_0x554879[_0xf271('0x3f')];if(!_0x25c777[_0xf271('0x40')][_0xf271('0x46')](_0xf271('0x47'))){_0x25787a[_0xf271('0x2f')]=qs[_0xf271('0x2f')](_0x25c777[_0xf271('0x40')][_0xf271('0x2f')]);_0x25787a[_0xf271('0x2d')]=qs[_0xf271('0x2d')](_0x25c777[_0xf271('0x40')][_0xf271('0x2d')]);}_0x25787a['order']=qs[_0xf271('0x48')](_0x25c777['query'][_0xf271('0x48')]);_0x25787a[_0xf271('0x49')]=qs[_0xf271('0x42')](_['pick'](_0x25c777[_0xf271('0x40')],_0x554879[_0xf271('0x42')]),_0xc62ef9);if(_0x25c777[_0xf271('0x40')][_0xf271('0x4a')]){_0x25787a[_0xf271('0x49')]=_['merge'](_0x25787a['where'],{'$or':_[_0xf271('0x3a')](_0xc62ef9,function(_0x101a76){if(_0x101a76['type']!==_0xf271('0x4b')){var _0xf7ca83={};_0xf7ca83[_0x101a76[_0xf271('0x37')]]={'$like':'%'+_0x25c777[_0xf271('0x40')][_0xf271('0x4a')]+'%'};return _0xf7ca83;}})});}_0x25787a=_[_0xf271('0x4c')]({},_0x25787a,_0x25c777[_0xf271('0x4d')]);var _0x5ea420={'where':_0x25787a['where']};return db[_0xf271('0x3b')][_0xf271('0x30')](_0x5ea420)[_0xf271('0x1e')](function(_0x4e2309){_0x3e0eca['count']=_0x4e2309;if(_0x25c777['query'][_0xf271('0x4e')]){_0x25787a['include']=[{'all':!![]}];}return db['FaxMessage'][_0xf271('0x4f')](_0x25787a);})['then'](function(_0x2f976c){_0x3e0eca[_0xf271('0x50')]=_0x2f976c;return _0x3e0eca;})[_0xf271('0x1e')](respondWithFilteredResult(_0x49d380,_0x25787a))[_0xf271('0x28')](handleError(_0x49d380,null));};exports[_0xf271('0x51')]=function(_0xe2dca0,_0x24554d){var _0x2fec38={'raw':!![],'where':{'id':_0xe2dca0[_0xf271('0x52')]['id']}},_0x637ec4={};_0x637ec4['model']=_[_0xf271('0x41')](db[_0xf271('0x3b')][_0xf271('0x3c')]);_0x637ec4[_0xf271('0x40')]=_[_0xf271('0x41')](_0xe2dca0[_0xf271('0x40')]);_0x637ec4[_0xf271('0x42')]=_[_0xf271('0x43')](_0x637ec4['model'],_0x637ec4[_0xf271('0x40')]);_0x2fec38[_0xf271('0x44')]=_['intersection'](_0x637ec4['model'],qs['fields'](_0xe2dca0[_0xf271('0x40')][_0xf271('0x45')]));_0x2fec38[_0xf271('0x44')]=_0x2fec38[_0xf271('0x44')][_0xf271('0x53')]?_0x2fec38[_0xf271('0x44')]:_0x637ec4['model'];if(_0xe2dca0[_0xf271('0x40')][_0xf271('0x4e')]){_0x2fec38[_0xf271('0x54')]=[{'all':!![]}];}_0x2fec38=_['merge']({},_0x2fec38,_0xe2dca0['options']);return db['FaxMessage'][_0xf271('0x55')](_0x2fec38)[_0xf271('0x1e')](handleEntityNotFound(_0x24554d,null))[_0xf271('0x1e')](respondWithResult(_0x24554d,null))[_0xf271('0x28')](handleError(_0x24554d,null));};exports[_0xf271('0x35')]=function(_0x599266,_0x42e531){if(_0x599266[_0xf271('0x56')]['id']){delete _0x599266[_0xf271('0x56')]['id'];}return db[_0xf271('0x3b')][_0xf271('0x55')]({'where':{'id':_0x599266[_0xf271('0x52')]['id']}})[_0xf271('0x1e')](handleEntityNotFound(_0x42e531,null))[_0xf271('0x1e')](saveUpdates(_0x599266[_0xf271('0x56')],null))[_0xf271('0x1e')](respondWithResult(_0x42e531,null))[_0xf271('0x28')](handleError(_0x42e531,null));};exports[_0xf271('0x57')]=function(_0x514244,_0x4ff051){return db['FaxMessage'][_0xf271('0x55')]({'where':{'id':_0x514244['params']['id']}})[_0xf271('0x1e')](handleEntityNotFound(_0x4ff051,null))[_0xf271('0x1e')](removeEntity(_0x4ff051,null))[_0xf271('0x28')](handleError(_0x4ff051,null));};exports[_0xf271('0x58')]=function(_0x24a4fc,_0x50ec5f){return db['FaxMessage'][_0xf271('0x58')]()[_0xf271('0x1e')](respondWithResult(_0x50ec5f,null))[_0xf271('0x28')](handleError(_0x50ec5f,null));};var interaction_log=require(_0xf271('0x11'))('fax-interactions');exports[_0xf271('0x59')]=function(_0xc5560f,_0x6a61e9,_0x56ee29){var _0x529f7c={'agent':{},'channel':_0xf271('0x5a')};if(_0xc5560f[_0xf271('0x56')]['id']){delete _0xc5560f[_0xf271('0x56')]['id'];}_0xc5560f['body'][_0xf271('0x5b')]=!![];_0xc5560f[_0xf271('0x56')][_0xf271('0x5c')]=moment()[_0xf271('0x5d')](_0xf271('0x5e'));_0xc5560f[_0xf271('0x56')][_0xf271('0x5f')]=_0xc5560f[_0xf271('0x56')][_0xf271('0x5f')]||_0xc5560f[_0xf271('0x60')]['id'];_0x529f7c[_0xf271('0x61')]['id']=_0xc5560f[_0xf271('0x56')][_0xf271('0x5f')];return db['FaxMessage'][_0xf271('0x55')]({'where':{'id':_0xc5560f['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x6a61e9,null))[_0xf271('0x1e')](saveUpdates(_0xc5560f['body'],null))[_0xf271('0x1e')](function(_0x1b62e1){if(_0x1b62e1){_0x529f7c['message']=_0x1b62e1[_0xf271('0x62')]({'plain':!![]});return db[_0xf271('0x63')][_0xf271('0x55')]({'where':{'id':_0x1b62e1[_0xf271('0x64')]}});}return null;})[_0xf271('0x1e')](handleEntityNotFound(_0x6a61e9,null))[_0xf271('0x1e')](function(_0x5231cd){if(_0x5231cd){return _0x5231cd[_0xf271('0x35')]({'UserId':_0xc5560f[_0xf271('0x56')]['UserId'],'read1stAt':_[_0xf271('0x65')](_0x5231cd['read1stAt'])?moment()[_0xf271('0x5d')](_0xf271('0x5e')):undefined});}return null;})['then'](function(_0x106885){if(_0x106885){_0x529f7c['interaction']=_0x106885[_0xf271('0x62')]({'plain':!![]});interaction_log[_0xf271('0x1f')](_0xf271('0x66'),_0xc5560f['user']['id'],_0xc5560f['user'][_0xf271('0x37')],_0xc5560f[_0xf271('0x60')]['role'],_0x529f7c[_0xf271('0x67')]['id'],_0xc5560f['body']?JSON[_0xf271('0x68')](_0xc5560f[_0xf271('0x56')]):_0xf271('0x69'));return respondWithRpcPromise(_0xf271('0x6a'),_0xf271('0x6b'),_0x529f7c);}return null;})[_0xf271('0x1e')](function(_0x432319){var _0x258011=_0xf271('0x6c')+_0x432319[_0xf271('0x26')][_0xf271('0x6d')];return db['sequelize'][_0xf271('0x40')](_0x258011,{'type':db[_0xf271('0x6e')][_0xf271('0x6f')][_0xf271('0x70')],'raw':!![]})[_0xf271('0x1e')](function(_0x33c591){return _0x33c591;});})[_0xf271('0x1e')](function(_0x282d8c){if(_0x282d8c){_0x529f7c['message'][_0xf271('0x71')]=_0x282d8c[0x0];if(!_0xc5560f[_0xf271('0x56')][_0xf271('0x5f')])return;return db[_0xf271('0x72')][_0xf271('0x55')]({'where':{'id':_0xc5560f[_0xf271('0x56')][_0xf271('0x5f')],'role':_0xf271('0x61')},'attributes':['id',_0xf271('0x37'),_0xf271('0x73'),_0xf271('0x74'),_0xf271('0x75')],'raw':!![]});}return null;})[_0xf271('0x1e')](function(_0x2b1185){if(!_0x2b1185)return null;_0x529f7c[_0xf271('0x26')][_0xf271('0x61')]=_0x2b1185;return _0x529f7c;})['then'](function(_0x45bce5){if(_0x45bce5){if(_0xc5560f['body'][_0xf271('0x76')]){_0x529f7c[_0xf271('0x26')][_0xf271('0x77')]=util[_0xf271('0x5d')](_0xf271('0x78'),_0xc5560f['user']['name']);_0x529f7c['message']['channel']=_0x529f7c['channel'];_0x529f7c[_0xf271('0x26')][_0xf271('0x79')]=_0x529f7c[_0xf271('0x7a')];_0x529f7c[_0xf271('0x26')][_0xf271('0x7b')]=_0xf271('0x59');return respondWithRpcPromise(_0xf271('0x7c'),_0xf271('0x7c'),{'event':_0xf271('0x7d'),'message':_0x529f7c['message']},client9002)[_0xf271('0x1e')](function(){return _0x529f7c;});}return _0x529f7c;}return null;})[_0xf271('0x1e')](respondWithResult(_0x6a61e9,null))[_0xf271('0x28')](handleError(_0x6a61e9,null));};var interaction_log=require(_0xf271('0x11'))(_0xf271('0x7e'));exports['reject']=function(_0x376b91,_0x309453,_0x3b501e){var _0x42a80d={'agent':{},'channel':'fax'};if(_0x376b91[_0xf271('0x56')]['id']){delete _0x376b91[_0xf271('0x56')]['id'];}_0x376b91[_0xf271('0x56')][_0xf271('0x5f')]=_0x376b91[_0xf271('0x56')]['UserId']||_0x376b91[_0xf271('0x60')]['id'];_0x42a80d[_0xf271('0x61')]['id']=_0x376b91[_0xf271('0x56')]['UserId'];return db[_0xf271('0x3b')][_0xf271('0x55')]({'where':{'id':_0x376b91[_0xf271('0x52')]['id'],'UserId':null}})[_0xf271('0x1e')](handleEntityNotFound(_0x309453,null))[_0xf271('0x1e')](function(_0x8ba3cb){if(_0x8ba3cb){_0x42a80d[_0xf271('0x26')]=_0x8ba3cb['get']({'plain':!![]});return db[_0xf271('0x63')]['find']({'where':{'id':_0x8ba3cb[_0xf271('0x64')]}});}return null;})['then'](handleEntityNotFound(_0x309453,null))[_0xf271('0x1e')](function(_0x9ded20){if(_0x9ded20){_0x42a80d['interaction']=_0x9ded20[_0xf271('0x62')]({'plain':!![]});interaction_log[_0xf271('0x1f')](_0xf271('0x7f'),_0x376b91[_0xf271('0x60')]['id'],_0x376b91[_0xf271('0x60')][_0xf271('0x37')],_0x376b91[_0xf271('0x60')][_0xf271('0x80')],_0x42a80d[_0xf271('0x67')]['id'],_0x376b91['body']?JSON[_0xf271('0x68')](_0x376b91[_0xf271('0x56')]):_0xf271('0x69'));return respondWithRpcPromise('RejectMessage',_0xf271('0x81'),_0x42a80d);}return null;})[_0xf271('0x1e')](function(_0x2d4535){var _0x261085=_0xf271('0x6c')+_0x2d4535['message']['ContactId'];return db[_0xf271('0x82')][_0xf271('0x40')](_0x261085,{'type':db[_0xf271('0x6e')][_0xf271('0x6f')]['SELECT'],'raw':!![]})['then'](function(_0x273d74){return _0x273d74;});})['then'](function(_0x1469f7){if(_0x1469f7){_0x42a80d[_0xf271('0x26')]['contact']=_0x1469f7[0x0];if(!_0x376b91[_0xf271('0x56')][_0xf271('0x5f')])return;return db[_0xf271('0x72')][_0xf271('0x55')]({'where':{'id':_0x376b91['body'][_0xf271('0x5f')],'role':_0xf271('0x61')},'attributes':['id',_0xf271('0x37'),_0xf271('0x73'),_0xf271('0x74'),_0xf271('0x75')],'raw':!![]});}return null;})[_0xf271('0x1e')](function(_0x14a0a0){if(!_0x14a0a0)return null;_0x42a80d[_0xf271('0x26')]['agent']=_0x14a0a0;return _0x42a80d;})[_0xf271('0x1e')](function(_0x1e9aac){if(_0x1e9aac){_0x1e9aac[_0xf271('0x26')][_0xf271('0x77')]=util['format'](_0xf271('0x78'),_0x376b91['user']['name']);_0x1e9aac['message'][_0xf271('0x7a')]=_0x42a80d['channel'];_0x1e9aac['message'][_0xf271('0x79')]=_0x42a80d[_0xf271('0x7a')];_0x1e9aac[_0xf271('0x26')][_0xf271('0x7b')]=_0xf271('0x33');respondWithRpcPromise(_0xf271('0x7c'),'EventManager',{'event':_0xf271('0x83'),'message':_0x1e9aac[_0xf271('0x26')]},client9002);return _0x42a80d;}return null;})[_0xf271('0x1e')](respondWithResult(_0x309453,null))[_0xf271('0x28')](handleError(_0x309453,null));};exports[_0xf271('0x84')]=function(_0x5ecf7e,_0x254810){var _0x207ecf;return db[_0xf271('0x3b')][_0xf271('0x84')](_0x5ecf7e['body'],{})['then'](function(_0x49b050){_0x207ecf=_0x49b050;return db[_0xf271('0x85')]['findOne']({'where':{'id':_0x207ecf[_0xf271('0x6d')]}});})[_0xf271('0x1e')](function(_0x8d280){if(_['isNil'](_0x8d280)){return;}else{_0x207ecf[_0xf271('0x5a')]=_0x8d280[_0xf271('0x5a')];return db[_0xf271('0x86')][_0xf271('0x87')]({'where':{'id':_0x207ecf[_0xf271('0x88')]}});}})['then'](function(_0x2ed2aa){return respondWithRpcPromise('SendFax','SendFax',{'FaxAccountId':_[_0xf271('0x65')](_0x5ecf7e[_0xf271('0x56')])?undefined:_0x5ecf7e['body'][_0xf271('0x89')],'path':_['isNil'](_0x2ed2aa)?undefined:util[_0xf271('0x5d')](_0xf271('0x8a'),_0x2ed2aa[_0xf271('0x8b')]),'fax':_[_0xf271('0x65')](_0x207ecf[_0xf271('0x5a')])?undefined:_0x207ecf[_0xf271('0x5a')],'AttachmentId':_0x207ecf['AttachmentId']},client9002);})[_0xf271('0x1e')](respondWithResult(_0x254810,0xc9))[_0xf271('0x28')](handleError(_0x254810,null));};exports['download']=function(_0x1cfb29,_0x53e29f){var _0x42a2b6=path[_0xf271('0x8c')](config[_0xf271('0x8d')],_0xf271('0x8e'),'files','attachments');return db[_0xf271('0x3b')][_0xf271('0x55')]({'where':{'id':_0x1cfb29['params']['id']},'include':[{'model':db[_0xf271('0x86')],'as':_0xf271('0x86')}]})[_0xf271('0x1e')](handleEntityNotFound(_0x53e29f,null))['then'](function(_0x318cfe){if(_0x318cfe){return _0x53e29f[_0xf271('0x8f')](path[_0xf271('0x8c')](_0x42a2b6,_0x318cfe['Attachment'][_0xf271('0x8b')]));}})['catch'](handleError(_0x53e29f,null));}; \ No newline at end of file +var _0xdda6=['SIP/%s','channel','motionChannel','EventManager','info','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','contact','interface','event','rejectmessage','create','CmContact','findOne','isNil','AttachmentId','SendFax','FaxAccountId','basename','join','root','server','files','attachments','Attachment','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','then','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','update','end','stack','name','send','map','FaxMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','findAll','rows','show','includeAll','include','options','find','body','params','describe','fax-interactions','accept','fax','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','FaxInteraction','FaxInteractionId','read1stAt','format','interaction','get','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','agent','fullname','email','manual'];(function(_0x50eb2c,_0xf42415){var _0x34156f=function(_0x42724a){while(--_0x42724a){_0x50eb2c['push'](_0x50eb2c['shift']());}};_0x34156f(++_0xf42415);}(_0xdda6,0xac));var _0x6dda=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xdda6[_0x47a7d0];return _0xb9bd08;};'use strict';var emlformat=require(_0x6dda('0x0'));var rimraf=require(_0x6dda('0x1'));var zipdir=require(_0x6dda('0x2'));var jsonpatch=require(_0x6dda('0x3'));var rp=require(_0x6dda('0x4'));var moment=require(_0x6dda('0x5'));var BPromise=require(_0x6dda('0x6'));var Mustache=require(_0x6dda('0x7'));var util=require(_0x6dda('0x8'));var path=require(_0x6dda('0x9'));var sox=require(_0x6dda('0xa'));var csv=require('to-csv');var ejs=require(_0x6dda('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6dda('0xc'));var squel=require('squel');var crypto=require(_0x6dda('0xd'));var jsforce=require(_0x6dda('0xe'));var deskjs=require(_0x6dda('0xf'));var toCsv=require(_0x6dda('0x10'));var querystring=require(_0x6dda('0x11'));var Papa=require(_0x6dda('0x12'));var Redis=require(_0x6dda('0x13'));var authService=require(_0x6dda('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x6dda('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6dda('0x16'))(_0x6dda('0x17'));var utils=require('../../config/utils');var config=require(_0x6dda('0x18'));var licenseUtil=require(_0x6dda('0x19'));var db=require(_0x6dda('0x1a'))['db'];config[_0x6dda('0x1b')]=_[_0x6dda('0x1c')](config[_0x6dda('0x1b')],{'host':_0x6dda('0x1d'),'port':0x18eb});var socket=require(_0x6dda('0x1e'))(new Redis(config[_0x6dda('0x1b')]));require(_0x6dda('0x1f'))[_0x6dda('0x20')](socket);var jayson=require(_0x6dda('0x21'));var client=jayson[_0x6dda('0x22')][_0x6dda('0x23')]({'port':0x232c});var client9002=jayson[_0x6dda('0x22')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41134b,_0x4a2257,_0x37be7c,_0x9c1fa8){return new BPromise(function(_0x1dc570,_0x1d7d89){var _0x595d46=_0x9c1fa8||client;return _0x595d46['request'](_0x41134b,_0x37be7c)[_0x6dda('0x24')](function(_0x5f0e17){logger['info'](_0x6dda('0x25'),_0x4a2257,_0x6dda('0x26'));logger[_0x6dda('0x27')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x4a2257,_0x6dda('0x26'),JSON[_0x6dda('0x28')](_0x5f0e17));if(_0x5f0e17['error']){if(_0x5f0e17[_0x6dda('0x29')]['code']===0x1f4){logger[_0x6dda('0x29')](_0x6dda('0x25'),_0x4a2257,_0x5f0e17['error'][_0x6dda('0x2a')]);return _0x1d7d89(_0x5f0e17[_0x6dda('0x29')][_0x6dda('0x2a')]);}logger[_0x6dda('0x29')]('FaxMessage,\x20%s,\x20%s',_0x4a2257,_0x5f0e17[_0x6dda('0x29')][_0x6dda('0x2a')]);return _0x1dc570(_0x5f0e17[_0x6dda('0x29')][_0x6dda('0x2a')]);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0x4a2257,_0x6dda('0x26'));_0x1dc570(_0x5f0e17['result'][_0x6dda('0x2a')]);}})[_0x6dda('0x2b')](function(_0x4387c2){logger[_0x6dda('0x29')](_0x6dda('0x25'),_0x4a2257,_0x4387c2);_0x1d7d89(_0x4387c2);});});}function respondWithStatusCode(_0x472324,_0x55927b){_0x55927b=_0x55927b||0xcc;return function(_0x5cc521){if(_0x5cc521){return _0x472324[_0x6dda('0x2c')](_0x55927b);}return _0x472324[_0x6dda('0x2d')](_0x55927b)['end']();};}function respondWithResult(_0x15fabc,_0xa90823){_0xa90823=_0xa90823||0xc8;return function(_0xc7595e){if(_0xc7595e){return _0x15fabc[_0x6dda('0x2d')](_0xa90823)[_0x6dda('0x2e')](_0xc7595e);}};}function respondWithFilteredResult(_0xc1d633,_0x1bafa7){return function(_0xc2ebe5){if(_0xc2ebe5){var _0x2aa18c=typeof _0x1bafa7['offset']===_0x6dda('0x2f')&&typeof _0x1bafa7['limit']==='undefined';var _0x59e716=_0xc2ebe5[_0x6dda('0x30')];var _0x25d1a9=_0x2aa18c?0x0:_0x1bafa7[_0x6dda('0x31')];var _0x3b0da6=_0x2aa18c?_0xc2ebe5['count']:_0x1bafa7[_0x6dda('0x31')]+_0x1bafa7[_0x6dda('0x32')];var _0x5293f9;if(_0x3b0da6>=_0x59e716){_0x3b0da6=_0x59e716;_0x5293f9=0xc8;}else{_0x5293f9=0xce;}_0xc1d633['status'](_0x5293f9);return _0xc1d633[_0x6dda('0x33')](_0x6dda('0x34'),_0x25d1a9+'-'+_0x3b0da6+'/'+_0x59e716)[_0x6dda('0x2e')](_0xc2ebe5);}return null;};}function patchUpdates(_0x82d7f7){return function(_0x13d83d){try{jsonpatch[_0x6dda('0x35')](_0x13d83d,_0x82d7f7,!![]);}catch(_0x7a7baa){return BPromise[_0x6dda('0x36')](_0x7a7baa);}return _0x13d83d['save']();};}function saveUpdates(_0x478cbe,_0x3d586c){return function(_0x1bb34a){if(_0x1bb34a){return _0x1bb34a[_0x6dda('0x37')](_0x478cbe)[_0x6dda('0x24')](function(_0x39d15c){return _0x39d15c;});}return null;};}function removeEntity(_0x5caa25,_0x5ae0fa){return function(_0x551e01){if(_0x551e01){return _0x551e01['destroy']()[_0x6dda('0x24')](function(){_0x5caa25[_0x6dda('0x2d')](0xcc)[_0x6dda('0x38')]();});}};}function handleEntityNotFound(_0x505204,_0x3c7780){return function(_0x51da3c){if(!_0x51da3c){_0x505204[_0x6dda('0x2c')](0x194);}return _0x51da3c;};}function handleError(_0x31af46,_0x41ecd3){_0x41ecd3=_0x41ecd3||0x1f4;return function(_0x359f01){logger[_0x6dda('0x29')](_0x359f01[_0x6dda('0x39')]);if(_0x359f01['name']){delete _0x359f01[_0x6dda('0x3a')];}_0x31af46[_0x6dda('0x2d')](_0x41ecd3)[_0x6dda('0x3b')](_0x359f01);};}exports['index']=function(_0x44864f,_0x9233ff){var _0x2a6ad7={},_0x75e154={},_0x158021={'count':0x0,'rows':[]};var _0x536e14=_[_0x6dda('0x3c')](db[_0x6dda('0x3d')][_0x6dda('0x3e')],function(_0x4624a6){return{'name':_0x4624a6[_0x6dda('0x3f')],'type':_0x4624a6[_0x6dda('0x40')][_0x6dda('0x41')]};});_0x75e154[_0x6dda('0x42')]=_[_0x6dda('0x3c')](_0x536e14,'name');_0x75e154[_0x6dda('0x43')]=_[_0x6dda('0x44')](_0x44864f[_0x6dda('0x43')]);_0x75e154[_0x6dda('0x45')]=_[_0x6dda('0x46')](_0x75e154[_0x6dda('0x42')],_0x75e154[_0x6dda('0x43')]);_0x2a6ad7[_0x6dda('0x47')]=_[_0x6dda('0x46')](_0x75e154['model'],qs[_0x6dda('0x48')](_0x44864f[_0x6dda('0x43')][_0x6dda('0x48')]));_0x2a6ad7[_0x6dda('0x47')]=_0x2a6ad7['attributes'][_0x6dda('0x49')]?_0x2a6ad7['attributes']:_0x75e154[_0x6dda('0x42')];if(!_0x44864f['query'][_0x6dda('0x4a')](_0x6dda('0x4b'))){_0x2a6ad7[_0x6dda('0x32')]=qs[_0x6dda('0x32')](_0x44864f[_0x6dda('0x43')][_0x6dda('0x32')]);_0x2a6ad7[_0x6dda('0x31')]=qs[_0x6dda('0x31')](_0x44864f[_0x6dda('0x43')][_0x6dda('0x31')]);}_0x2a6ad7[_0x6dda('0x4c')]=qs[_0x6dda('0x4d')](_0x44864f[_0x6dda('0x43')][_0x6dda('0x4d')]);_0x2a6ad7[_0x6dda('0x4e')]=qs[_0x6dda('0x45')](_[_0x6dda('0x4f')](_0x44864f[_0x6dda('0x43')],_0x75e154[_0x6dda('0x45')]),_0x536e14);if(_0x44864f[_0x6dda('0x43')][_0x6dda('0x50')]){_0x2a6ad7[_0x6dda('0x4e')]=_[_0x6dda('0x51')](_0x2a6ad7['where'],{'$or':_[_0x6dda('0x3c')](_0x536e14,function(_0x1e9bea){if(_0x1e9bea['type']!=='VIRTUAL'){var _0x186dae={};_0x186dae[_0x1e9bea['name']]={'$like':'%'+_0x44864f[_0x6dda('0x43')][_0x6dda('0x50')]+'%'};return _0x186dae;}})});}_0x2a6ad7=_[_0x6dda('0x51')]({},_0x2a6ad7,_0x44864f['options']);var _0x46b962={'where':_0x2a6ad7['where']};return db[_0x6dda('0x3d')]['count'](_0x46b962)[_0x6dda('0x24')](function(_0x2753a4){_0x158021[_0x6dda('0x30')]=_0x2753a4;if(_0x44864f[_0x6dda('0x43')]['includeAll']){_0x2a6ad7['include']=[{'all':!![]}];}return db[_0x6dda('0x3d')][_0x6dda('0x52')](_0x2a6ad7);})[_0x6dda('0x24')](function(_0x5ad3f1){_0x158021[_0x6dda('0x53')]=_0x5ad3f1;return _0x158021;})[_0x6dda('0x24')](respondWithFilteredResult(_0x9233ff,_0x2a6ad7))[_0x6dda('0x2b')](handleError(_0x9233ff,null));};exports[_0x6dda('0x54')]=function(_0x3bddf4,_0x52c9ed){var _0x24f4eb={'raw':!![],'where':{'id':_0x3bddf4['params']['id']}},_0x5a40a7={};_0x5a40a7[_0x6dda('0x42')]=_[_0x6dda('0x44')](db[_0x6dda('0x3d')][_0x6dda('0x3e')]);_0x5a40a7[_0x6dda('0x43')]=_['keys'](_0x3bddf4[_0x6dda('0x43')]);_0x5a40a7[_0x6dda('0x45')]=_[_0x6dda('0x46')](_0x5a40a7[_0x6dda('0x42')],_0x5a40a7[_0x6dda('0x43')]);_0x24f4eb[_0x6dda('0x47')]=_[_0x6dda('0x46')](_0x5a40a7[_0x6dda('0x42')],qs[_0x6dda('0x48')](_0x3bddf4[_0x6dda('0x43')][_0x6dda('0x48')]));_0x24f4eb[_0x6dda('0x47')]=_0x24f4eb[_0x6dda('0x47')]['length']?_0x24f4eb['attributes']:_0x5a40a7[_0x6dda('0x42')];if(_0x3bddf4['query'][_0x6dda('0x55')]){_0x24f4eb[_0x6dda('0x56')]=[{'all':!![]}];}_0x24f4eb=_[_0x6dda('0x51')]({},_0x24f4eb,_0x3bddf4[_0x6dda('0x57')]);return db['FaxMessage'][_0x6dda('0x58')](_0x24f4eb)[_0x6dda('0x24')](handleEntityNotFound(_0x52c9ed,null))[_0x6dda('0x24')](respondWithResult(_0x52c9ed,null))['catch'](handleError(_0x52c9ed,null));};exports['update']=function(_0x5347bb,_0x50146a){if(_0x5347bb['body']['id']){delete _0x5347bb[_0x6dda('0x59')]['id'];}return db[_0x6dda('0x3d')]['find']({'where':{'id':_0x5347bb['params']['id']}})[_0x6dda('0x24')](handleEntityNotFound(_0x50146a,null))[_0x6dda('0x24')](saveUpdates(_0x5347bb[_0x6dda('0x59')],null))['then'](respondWithResult(_0x50146a,null))[_0x6dda('0x2b')](handleError(_0x50146a,null));};exports['destroy']=function(_0x53194c,_0x565574){return db[_0x6dda('0x3d')][_0x6dda('0x58')]({'where':{'id':_0x53194c[_0x6dda('0x5a')]['id']}})[_0x6dda('0x24')](handleEntityNotFound(_0x565574,null))['then'](removeEntity(_0x565574,null))[_0x6dda('0x2b')](handleError(_0x565574,null));};exports[_0x6dda('0x5b')]=function(_0x23db9e,_0x4023d3){return db[_0x6dda('0x3d')]['describe']()[_0x6dda('0x24')](respondWithResult(_0x4023d3,null))['catch'](handleError(_0x4023d3,null));};var interaction_log=require(_0x6dda('0x16'))(_0x6dda('0x5c'));exports[_0x6dda('0x5d')]=function(_0x4a4224,_0x45ebc1,_0x85c006){var _0x5d855e={'agent':{},'channel':_0x6dda('0x5e')};if(_0x4a4224[_0x6dda('0x59')]['id']){delete _0x4a4224['body']['id'];}_0x4a4224[_0x6dda('0x59')]['read']=!![];_0x4a4224[_0x6dda('0x59')][_0x6dda('0x5f')]=moment()['format'](_0x6dda('0x60'));_0x4a4224[_0x6dda('0x59')][_0x6dda('0x61')]=_0x4a4224['body'][_0x6dda('0x61')]||_0x4a4224['user']['id'];_0x5d855e['agent']['id']=_0x4a4224[_0x6dda('0x59')]['UserId'];return db['FaxMessage'][_0x6dda('0x58')]({'where':{'id':_0x4a4224['params']['id'],'UserId':null}})[_0x6dda('0x24')](handleEntityNotFound(_0x45ebc1,null))[_0x6dda('0x24')](saveUpdates(_0x4a4224[_0x6dda('0x59')],null))[_0x6dda('0x24')](function(_0x31ae7d){if(_0x31ae7d){_0x5d855e[_0x6dda('0x2a')]=_0x31ae7d['get']({'plain':!![]});return db[_0x6dda('0x62')][_0x6dda('0x58')]({'where':{'id':_0x31ae7d[_0x6dda('0x63')]}});}return null;})['then'](handleEntityNotFound(_0x45ebc1,null))[_0x6dda('0x24')](function(_0x468cf0){if(_0x468cf0){return _0x468cf0['update']({'UserId':_0x4a4224['body']['UserId'],'read1stAt':_['isNil'](_0x468cf0[_0x6dda('0x64')])?moment()[_0x6dda('0x65')](_0x6dda('0x60')):undefined});}return null;})[_0x6dda('0x24')](function(_0x3700b4){if(_0x3700b4){_0x5d855e[_0x6dda('0x66')]=_0x3700b4[_0x6dda('0x67')]({'plain':!![]});interaction_log['info'](_0x6dda('0x68'),_0x4a4224['user']['id'],_0x4a4224[_0x6dda('0x69')][_0x6dda('0x3a')],_0x4a4224[_0x6dda('0x69')][_0x6dda('0x6a')],_0x5d855e['interaction']['id'],_0x4a4224[_0x6dda('0x59')]?JSON[_0x6dda('0x28')](_0x4a4224[_0x6dda('0x59')]):_0x6dda('0x6b'));return respondWithRpcPromise('AcceptMessage',_0x6dda('0x6c'),_0x5d855e);}return null;})[_0x6dda('0x24')](function(_0x139102){var _0x3d6e40=_0x6dda('0x6d')+_0x139102[_0x6dda('0x2a')][_0x6dda('0x6e')];return db['sequelize']['query'](_0x3d6e40,{'type':db[_0x6dda('0x6f')][_0x6dda('0x70')][_0x6dda('0x71')],'raw':!![]})[_0x6dda('0x24')](function(_0x238711){return _0x238711;});})['then'](function(_0x2512dc){if(_0x2512dc){_0x5d855e['message']['contact']=_0x2512dc[0x0];if(!_0x4a4224['body'][_0x6dda('0x61')])return;return db['User']['find']({'where':{'id':_0x4a4224[_0x6dda('0x59')][_0x6dda('0x61')],'role':_0x6dda('0x72')},'attributes':['id','name',_0x6dda('0x73'),_0x6dda('0x74'),'internal'],'raw':!![]});}return null;})[_0x6dda('0x24')](function(_0x32bf73){if(!_0x32bf73)return null;_0x5d855e[_0x6dda('0x2a')][_0x6dda('0x72')]=_0x32bf73;return _0x5d855e;})[_0x6dda('0x24')](function(_0x4d59e1){if(_0x4d59e1){if(_0x4a4224[_0x6dda('0x59')][_0x6dda('0x75')]){_0x5d855e[_0x6dda('0x2a')]['interface']=util['format'](_0x6dda('0x76'),_0x4a4224['user'][_0x6dda('0x3a')]);_0x5d855e[_0x6dda('0x2a')]['channel']=_0x5d855e[_0x6dda('0x77')];_0x5d855e['message'][_0x6dda('0x78')]=_0x5d855e[_0x6dda('0x77')];_0x5d855e[_0x6dda('0x2a')]['event']='accept';return respondWithRpcPromise(_0x6dda('0x79'),_0x6dda('0x79'),{'event':'acceptmessage','message':_0x5d855e[_0x6dda('0x2a')]},client9002)[_0x6dda('0x24')](function(){return _0x5d855e;});}return _0x5d855e;}return null;})['then'](respondWithResult(_0x45ebc1,null))[_0x6dda('0x2b')](handleError(_0x45ebc1,null));};var interaction_log=require('../../config/logger')(_0x6dda('0x5c'));exports[_0x6dda('0x36')]=function(_0x505ce5,_0x4f16fe,_0x1769c6){var _0xae37d2={'agent':{},'channel':_0x6dda('0x5e')};if(_0x505ce5['body']['id']){delete _0x505ce5[_0x6dda('0x59')]['id'];}_0x505ce5[_0x6dda('0x59')][_0x6dda('0x61')]=_0x505ce5[_0x6dda('0x59')][_0x6dda('0x61')]||_0x505ce5[_0x6dda('0x69')]['id'];_0xae37d2[_0x6dda('0x72')]['id']=_0x505ce5[_0x6dda('0x59')][_0x6dda('0x61')];return db[_0x6dda('0x3d')][_0x6dda('0x58')]({'where':{'id':_0x505ce5['params']['id'],'UserId':null}})[_0x6dda('0x24')](handleEntityNotFound(_0x4f16fe,null))[_0x6dda('0x24')](function(_0x15064e){if(_0x15064e){_0xae37d2['message']=_0x15064e[_0x6dda('0x67')]({'plain':!![]});return db[_0x6dda('0x62')][_0x6dda('0x58')]({'where':{'id':_0x15064e[_0x6dda('0x63')]}});}return null;})[_0x6dda('0x24')](handleEntityNotFound(_0x4f16fe,null))[_0x6dda('0x24')](function(_0x23b591){if(_0x23b591){_0xae37d2[_0x6dda('0x66')]=_0x23b591[_0x6dda('0x67')]({'plain':!![]});interaction_log[_0x6dda('0x7a')](_0x6dda('0x7b'),_0x505ce5[_0x6dda('0x69')]['id'],_0x505ce5['user'][_0x6dda('0x3a')],_0x505ce5[_0x6dda('0x69')]['role'],_0xae37d2[_0x6dda('0x66')]['id'],_0x505ce5[_0x6dda('0x59')]?JSON[_0x6dda('0x28')](_0x505ce5[_0x6dda('0x59')]):_0x6dda('0x6b'));return respondWithRpcPromise(_0x6dda('0x7c'),_0x6dda('0x7d'),_0xae37d2);}return null;})[_0x6dda('0x24')](function(_0x4572cf){var _0x9a89ca=_0x6dda('0x6d')+_0x4572cf[_0x6dda('0x2a')][_0x6dda('0x6e')];return db['sequelize'][_0x6dda('0x43')](_0x9a89ca,{'type':db[_0x6dda('0x6f')][_0x6dda('0x70')][_0x6dda('0x71')],'raw':!![]})[_0x6dda('0x24')](function(_0x5f7278){return _0x5f7278;});})['then'](function(_0x143bf2){if(_0x143bf2){_0xae37d2[_0x6dda('0x2a')][_0x6dda('0x7e')]=_0x143bf2[0x0];if(!_0x505ce5['body'][_0x6dda('0x61')])return;return db['User'][_0x6dda('0x58')]({'where':{'id':_0x505ce5[_0x6dda('0x59')][_0x6dda('0x61')],'role':_0x6dda('0x72')},'attributes':['id',_0x6dda('0x3a'),_0x6dda('0x73'),_0x6dda('0x74'),'internal'],'raw':!![]});}return null;})['then'](function(_0x2d75b7){if(!_0x2d75b7)return null;_0xae37d2[_0x6dda('0x2a')][_0x6dda('0x72')]=_0x2d75b7;return _0xae37d2;})[_0x6dda('0x24')](function(_0x2564d9){if(_0x2564d9){_0x2564d9['message'][_0x6dda('0x7f')]=util[_0x6dda('0x65')](_0x6dda('0x76'),_0x505ce5['user'][_0x6dda('0x3a')]);_0x2564d9[_0x6dda('0x2a')]['channel']=_0xae37d2[_0x6dda('0x77')];_0x2564d9[_0x6dda('0x2a')][_0x6dda('0x78')]=_0xae37d2[_0x6dda('0x77')];_0x2564d9[_0x6dda('0x2a')][_0x6dda('0x80')]='reject';respondWithRpcPromise(_0x6dda('0x79'),_0x6dda('0x79'),{'event':_0x6dda('0x81'),'message':_0x2564d9[_0x6dda('0x2a')]},client9002);return _0xae37d2;}return null;})[_0x6dda('0x24')](respondWithResult(_0x4f16fe,null))[_0x6dda('0x2b')](handleError(_0x4f16fe,null));};exports['create']=function(_0x495c7e,_0x3c46c3){var _0x417201;return db[_0x6dda('0x3d')][_0x6dda('0x82')](_0x495c7e['body'],{})[_0x6dda('0x24')](function(_0x48d053){_0x417201=_0x48d053;return db[_0x6dda('0x83')][_0x6dda('0x84')]({'where':{'id':_0x417201[_0x6dda('0x6e')]}});})[_0x6dda('0x24')](function(_0x1813b6){if(_[_0x6dda('0x85')](_0x1813b6)){return;}else{_0x417201[_0x6dda('0x5e')]=_0x1813b6[_0x6dda('0x5e')];return db['Attachment']['findOne']({'where':{'id':_0x417201[_0x6dda('0x86')]}});}})[_0x6dda('0x24')](function(_0x222ece){return respondWithRpcPromise(_0x6dda('0x87'),_0x6dda('0x87'),{'FaxAccountId':_[_0x6dda('0x85')](_0x495c7e['body'])?undefined:_0x495c7e[_0x6dda('0x59')][_0x6dda('0x88')],'path':_[_0x6dda('0x85')](_0x222ece)?undefined:util[_0x6dda('0x65')]('/var/opt/motion2/server/files/attachments/%s',_0x222ece[_0x6dda('0x89')]),'fax':_[_0x6dda('0x85')](_0x417201[_0x6dda('0x5e')])?undefined:_0x417201[_0x6dda('0x5e')],'AttachmentId':_0x417201['AttachmentId']},client9002);})[_0x6dda('0x24')](respondWithResult(_0x3c46c3,0xc9))[_0x6dda('0x2b')](handleError(_0x3c46c3,null));};exports['download']=function(_0x2e2cb4,_0x4893c4){var _0x370025=path[_0x6dda('0x8a')](config[_0x6dda('0x8b')],_0x6dda('0x8c'),_0x6dda('0x8d'),_0x6dda('0x8e'));return db[_0x6dda('0x3d')][_0x6dda('0x58')]({'where':{'id':_0x2e2cb4[_0x6dda('0x5a')]['id']},'include':[{'model':db[_0x6dda('0x8f')],'as':'Attachment'}]})[_0x6dda('0x24')](handleEntityNotFound(_0x4893c4,null))[_0x6dda('0x24')](function(_0x387d1b){if(_0x387d1b){return _0x4893c4[_0x6dda('0x90')](path['join'](_0x370025,_0x387d1b[_0x6dda('0x8f')]['basename']));}})[_0x6dda('0x2b')](handleError(_0x4893c4,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index d5d7917..a883612 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 _0x4fb4=['../../mysqldb','FaxMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x490be3,_0xf0fca3){var _0x3f5140=function(_0x15fa80){while(--_0x15fa80){_0x490be3['push'](_0x490be3['shift']());}};_0x3f5140(++_0xf0fca3);}(_0x4fb4,0x190));var _0x44fb=function(_0x16ae41,_0x590626){_0x16ae41=_0x16ae41-0x0;var _0x1112f0=_0x4fb4[_0x16ae41];return _0x1112f0;};'use strict';var EventEmitter=require('events');var FaxMessage=require(_0x44fb('0x0'))['db'][_0x44fb('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x44fb('0x2')](0x0);var events={'afterCreate':_0x44fb('0x3'),'afterUpdate':_0x44fb('0x4'),'afterDestroy':_0x44fb('0x5')};function emitEvent(_0x53ee5d){return function(_0xec6dce,_0x953327,_0x308b96){FaxMessageEvents[_0x44fb('0x6')](_0x53ee5d+':'+_0xec6dce['id'],_0xec6dce);FaxMessageEvents[_0x44fb('0x6')](_0x53ee5d,_0xec6dce);_0x308b96(null);};}for(var e in events){if(events[_0x44fb('0x7')](e)){var event=events[e];FaxMessage[_0x44fb('0x8')](e,emitEvent(event));}}module[_0x44fb('0x9')]=FaxMessageEvents; \ No newline at end of file +var _0x078f=['emit','hasOwnProperty','hook','exports','../../mysqldb','FaxMessage','save','update','remove'];(function(_0x37c22c,_0x28a70d){var _0x119d79=function(_0x243a13){while(--_0x243a13){_0x37c22c['push'](_0x37c22c['shift']());}};_0x119d79(++_0x28a70d);}(_0x078f,0x1b4));var _0xf078=function(_0x239073,_0x15e447){_0x239073=_0x239073-0x0;var _0x18f2dc=_0x078f[_0x239073];return _0x18f2dc;};'use strict';var EventEmitter=require('events');var FaxMessage=require(_0xf078('0x0'))['db'][_0xf078('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf078('0x2'),'afterUpdate':_0xf078('0x3'),'afterDestroy':_0xf078('0x4')};function emitEvent(_0x1b4e81){return function(_0x5da705,_0x288c1a,_0x203e73){FaxMessageEvents[_0xf078('0x5')](_0x1b4e81+':'+_0x5da705['id'],_0x5da705);FaxMessageEvents[_0xf078('0x5')](_0x1b4e81,_0x5da705);_0x203e73(null);};}for(var e in events){if(events[_0xf078('0x6')](e)){var event=events[e];FaxMessage[_0xf078('0x7')](e,emitEvent(event));}}module[_0xf078('0x8')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index ce701eb..6aae0da 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 _0xa87f=['fax_messages','body','FULLTEXT','get','direction','toLowerCase','out','secret','isNil','UserId','FaxInteraction','findOne','FaxInteractionId','then','createdAt','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','bluebird','request-promise','../../config/environment','./faxMessage.attributes','exports','FaxMessage'];(function(_0x45d123,_0x3f7632){var _0x11fef3=function(_0x28bc8e){while(--_0x28bc8e){_0x45d123['push'](_0x45d123['shift']());}};_0x11fef3(++_0x3f7632);}(_0xa87f,0x1b1));var _0xfa87=function(_0x4243f7,_0x3e05be){_0x4243f7=_0x4243f7-0x0;var _0x1c89ae=_0xa87f[_0x4243f7];return _0x1c89ae;};'use strict';var _=require('lodash');var util=require(_0xfa87('0x0'));var logger=require(_0xfa87('0x1'))(_0xfa87('0x2'));var moment=require('moment');var BPromise=require(_0xfa87('0x3'));var rp=require(_0xfa87('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xfa87('0x5'));var attributes=require(_0xfa87('0x6'));module[_0xfa87('0x7')]=function(_0x178bf8,_0x17510a){return _0x178bf8['define'](_0xfa87('0x8'),attributes,{'tableName':_0xfa87('0x9'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':[_0xfa87('0xa')],'type':_0xfa87('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x57b9f6,_0x1ec2e2,_0xaf9cbb){var _0x116493=_0x178bf8['models'];var _0x58de66=_0x57b9f6[_0xfa87('0xc')]({'plain':!![]});if(_0x58de66[_0xfa87('0xd')][_0xfa87('0xe')]()==='in'||_0x58de66['direction'][_0xfa87('0xe')]()===_0xfa87('0xf')&&!_0x58de66[_0xfa87('0x10')]&&!_[_0xfa87('0x11')](_0x58de66[_0xfa87('0x12')])){_0x116493[_0xfa87('0x13')][_0xfa87('0x14')]({'where':{'id':_0x58de66[_0xfa87('0x15')]}})[_0xfa87('0x16')](function(_0x4d268d){if(_0x4d268d){_0x4d268d['update']({'lastMsgAt':_0x58de66[_0xfa87('0x17')],'lastMsgDirection':_0x58de66['direction']['toLowerCase']()});}})['catch'](function(_0x31907d){console['error'](_0x31907d);});}_0xaf9cbb();}},'charset':_0xfa87('0x18'),'collate':_0xfa87('0x19')});}; \ No newline at end of file +var _0xb1d3=['define','FaxMessage','fax_messages','body','FULLTEXT','get','direction','toLowerCase','out','secret','isNil','UserId','FaxInteraction','findOne','FaxInteractionId','then','update','createdAt','error','utf8mb4','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./faxMessage.attributes'];(function(_0x246f92,_0xcf7bd4){var _0x2b8e7d=function(_0x9e8650){while(--_0x9e8650){_0x246f92['push'](_0x246f92['shift']());}};_0x2b8e7d(++_0xcf7bd4);}(_0xb1d3,0xc2));var _0x3b1d=function(_0x1ad931,_0x3573c6){_0x1ad931=_0x1ad931-0x0;var _0x2973b7=_0xb1d3[_0x1ad931];return _0x2973b7;};'use strict';var _=require(_0x3b1d('0x0'));var util=require(_0x3b1d('0x1'));var logger=require(_0x3b1d('0x2'))('api');var moment=require('moment');var BPromise=require(_0x3b1d('0x3'));var rp=require(_0x3b1d('0x4'));var fs=require('fs');var path=require(_0x3b1d('0x5'));var rimraf=require(_0x3b1d('0x6'));var config=require(_0x3b1d('0x7'));var attributes=require(_0x3b1d('0x8'));module['exports']=function(_0x120f1a,_0x3de07c){return _0x120f1a[_0x3b1d('0x9')](_0x3b1d('0xa'),attributes,{'tableName':_0x3b1d('0xb'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':[_0x3b1d('0xc')],'type':_0x3b1d('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3f56c6,_0x1b12e7,_0x51b886){var _0x4a5b7e=_0x120f1a['models'];var _0x190d2c=_0x3f56c6[_0x3b1d('0xe')]({'plain':!![]});if(_0x190d2c[_0x3b1d('0xf')]['toLowerCase']()==='in'||_0x190d2c[_0x3b1d('0xf')][_0x3b1d('0x10')]()===_0x3b1d('0x11')&&!_0x190d2c[_0x3b1d('0x12')]&&!_[_0x3b1d('0x13')](_0x190d2c[_0x3b1d('0x14')])){_0x4a5b7e[_0x3b1d('0x15')][_0x3b1d('0x16')]({'where':{'id':_0x190d2c[_0x3b1d('0x17')]}})[_0x3b1d('0x18')](function(_0x50c67c){if(_0x50c67c){_0x50c67c[_0x3b1d('0x19')]({'lastMsgAt':_0x190d2c[_0x3b1d('0x1a')],'lastMsgDirection':_0x190d2c[_0x3b1d('0xf')][_0x3b1d('0x10')]()});}})['catch'](function(_0x49a73c){console[_0x3b1d('0x1b')](_0x49a73c);});}_0x51b886();}},'charset':_0x3b1d('0x1c'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 95f1586..6353f0e 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 _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(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xed1f,0x6a));var _0xfed1=function(_0x45d3f0,_0x4be53f){_0x45d3f0=_0x45d3f0-0x0;var _0x314b79=_0xed1f[_0x45d3f0];return _0x314b79;};'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 +var _0x6aa7=['redis','defaults','socket.io-emitter','./faxMessage.socket','request','then','info','FaxMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','CreateFaxMessage','FaxMessage','create','options','raw','catch','update','body','attributes','limit','UpdateFaxMessage','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client'];(function(_0x3fb91e,_0x5387ea){var _0x21b7da=function(_0x4d364b){while(--_0x4d364b){_0x3fb91e['push'](_0x3fb91e['shift']());}};_0x21b7da(++_0x5387ea);}(_0x6aa7,0x178));var _0x76aa=function(_0x279919,_0x33c67e){_0x279919=_0x279919-0x0;var _0xd6641f=_0x6aa7[_0x279919];return _0xd6641f;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var moment=require(_0x76aa('0x1'));var BPromise=require(_0x76aa('0x2'));var rs=require(_0x76aa('0x3'));var fs=require('fs');var Redis=require(_0x76aa('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x76aa('0x5'));var logger=require(_0x76aa('0x6'))(_0x76aa('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x76aa('0x8')]['http']({'port':0x232a});config[_0x76aa('0x9')]=_[_0x76aa('0xa')](config[_0x76aa('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x76aa('0xb'))(new Redis(config[_0x76aa('0x9')]));require(_0x76aa('0xc'))['register'](socket);function respondWithRpcPromise(_0xcd99aa,_0x25856d,_0x41643a){return new BPromise(function(_0x16cb50,_0x37f1ab){return client[_0x76aa('0xd')](_0xcd99aa,_0x41643a)[_0x76aa('0xe')](function(_0x8dc35c){logger[_0x76aa('0xf')](_0x76aa('0x10'),_0x25856d,'request\x20sent');logger[_0x76aa('0x11')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x25856d,_0x76aa('0x12'),JSON[_0x76aa('0x13')](_0x8dc35c));if(_0x8dc35c[_0x76aa('0x14')]){if(_0x8dc35c[_0x76aa('0x14')][_0x76aa('0x15')]===0x1f4){logger['error']('FaxMessage,\x20%s,\x20%s',_0x25856d,_0x8dc35c[_0x76aa('0x14')]['message']);return _0x37f1ab(_0x8dc35c[_0x76aa('0x14')][_0x76aa('0x16')]);}logger['error'](_0x76aa('0x10'),_0x25856d,_0x8dc35c['error'][_0x76aa('0x16')]);return _0x16cb50(_0x8dc35c['error'][_0x76aa('0x16')]);}else{logger[_0x76aa('0xf')](_0x76aa('0x10'),_0x25856d,_0x76aa('0x12'));_0x16cb50(_0x8dc35c[_0x76aa('0x17')][_0x76aa('0x16')]);}})['catch'](function(_0x5d6202){logger[_0x76aa('0x14')](_0x76aa('0x10'),_0x25856d,_0x5d6202);_0x37f1ab(_0x5d6202);});});}exports[_0x76aa('0x18')]=function(_0x15b931){var _0x15109b=this;return new Promise(function(_0x191560,_0x19af92){return db[_0x76aa('0x19')][_0x76aa('0x1a')](_0x15b931['body'],{'raw':_0x15b931[_0x76aa('0x1b')]?_0x15b931[_0x76aa('0x1b')][_0x76aa('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x41463a){logger[_0x76aa('0xf')](_0x76aa('0x18'),_0x15b931);logger[_0x76aa('0x11')](_0x76aa('0x18'),_0x15b931,JSON[_0x76aa('0x13')](_0x41463a));_0x191560(_0x41463a);})[_0x76aa('0x1d')](function(_0x3363b3){logger[_0x76aa('0x14')](_0x76aa('0x18'),_0x3363b3[_0x76aa('0x16')],_0x15b931);_0x19af92(_0x15109b[_0x76aa('0x14')](0x1f4,_0x3363b3[_0x76aa('0x16')]));});});};exports['UpdateFaxMessage']=function(_0xb5e8a9){var _0x1d6d15=this;return new Promise(function(_0x25c614,_0x2e7ab4){return db[_0x76aa('0x19')][_0x76aa('0x1e')](_0xb5e8a9[_0x76aa('0x1f')],{'raw':_0xb5e8a9[_0x76aa('0x1b')]?_0xb5e8a9[_0x76aa('0x1b')][_0x76aa('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xb5e8a9['options']?_0xb5e8a9[_0x76aa('0x1b')]['where']||null:null,'attributes':_0xb5e8a9[_0x76aa('0x1b')]?_0xb5e8a9[_0x76aa('0x1b')][_0x76aa('0x20')]||null:null,'limit':_0xb5e8a9[_0x76aa('0x1b')]?_0xb5e8a9[_0x76aa('0x1b')][_0x76aa('0x21')]||null:null})[_0x76aa('0xe')](function(_0x3827ec){logger[_0x76aa('0xf')](_0x76aa('0x22'),_0xb5e8a9);logger['debug'](_0x76aa('0x22'),_0xb5e8a9,JSON[_0x76aa('0x13')](_0x3827ec));_0x25c614(_0x3827ec);})[_0x76aa('0x1d')](function(_0x928ccf){logger[_0x76aa('0x14')](_0x76aa('0x22'),_0x928ccf[_0x76aa('0x16')],_0xb5e8a9);_0x2e7ab4(_0x1d6d15['error'](0x1f4,_0x928ccf[_0x76aa('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 37b9de6..8cd1144 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 _0x765b=['faxMessage:','./faxMessage.events','save','remove','removeListener','register','length'];(function(_0x41a3e3,_0x8f880e){var _0x377596=function(_0x7bf3b1){while(--_0x7bf3b1){_0x41a3e3['push'](_0x41a3e3['shift']());}};_0x377596(++_0x8f880e);}(_0x765b,0xfd));var _0xb765=function(_0x24fa1a,_0x16d9c2){_0x24fa1a=_0x24fa1a-0x0;var _0xc5621f=_0x765b[_0x24fa1a];return _0xc5621f;};'use strict';var FaxMessageEvents=require(_0xb765('0x0'));var events=[_0xb765('0x1'),_0xb765('0x2'),'update'];function createListener(_0x37189d,_0x301d22){return function(_0x576517){_0x301d22['emit'](_0x37189d,_0x576517);};}function removeListener(_0x528532,_0x241885){return function(){FaxMessageEvents[_0xb765('0x3')](_0x528532,_0x241885);};}exports[_0xb765('0x4')]=function(_0x56720f){for(var _0x414916=0x0,_0x486106=events[_0xb765('0x5')];_0x414916<_0x486106;_0x414916++){var _0x199f3c=events[_0x414916];var _0x1f88ce=createListener(_0xb765('0x6')+_0x199f3c,_0x56720f);FaxMessageEvents['on'](_0x199f3c,_0x1f88ce);}}; \ No newline at end of file +var _0x46fd=['length','faxMessage:','./faxMessage.events','save','remove','update','emit','removeListener','register'];(function(_0x28a4ce,_0x111fe3){var _0x117c95=function(_0x3ee1b1){while(--_0x3ee1b1){_0x28a4ce['push'](_0x28a4ce['shift']());}};_0x117c95(++_0x111fe3);}(_0x46fd,0x161));var _0xd46f=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x46fd[_0x42cae2];return _0x5f256f;};'use strict';var FaxMessageEvents=require(_0xd46f('0x0'));var events=[_0xd46f('0x1'),_0xd46f('0x2'),_0xd46f('0x3')];function createListener(_0x5603c3,_0x3c7050){return function(_0x58f24f){_0x3c7050[_0xd46f('0x4')](_0x5603c3,_0x58f24f);};}function removeListener(_0x32950d,_0x4c0ec1){return function(){FaxMessageEvents[_0xd46f('0x5')](_0x32950d,_0x4c0ec1);};}exports[_0xd46f('0x6')]=function(_0x7e59d4){for(var _0x46f7e3=0x0,_0x47aeef=events[_0xd46f('0x7')];_0x46f7e3<_0x47aeef;_0x46f7e3++){var _0x2c56ce=events[_0x46f7e3];var _0x54f835=createListener(_0xd46f('0x8')+_0x2c56ce,_0x7e59d4);FaxMessageEvents['on'](_0x2c56ce,_0x54f835);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 25d5472..e1690fb 100644 --- a/server/api/faxMessage/index.js +++ b/server/api/faxMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb43b=['update','/:id/reject','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','index','/describe','isAuthenticated','describe','get','/:id','show','download','post','tracked','fax','create','put'];(function(_0x33759c,_0x12b87f){var _0x50df90=function(_0x27d0dc){while(--_0x27d0dc){_0x33759c['push'](_0x33759c['shift']());}};_0x50df90(++_0x12b87f);}(_0xb43b,0x1b2));var _0xbb43=function(_0x12e442,_0x42555c){_0x12e442=_0x12e442-0x0;var _0x4faaef=_0xb43b[_0x12e442];return _0x4faaef;};'use strict';var multer=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var path=require('path');var timeout=require(_0xbb43('0x2'));var express=require(_0xbb43('0x3'));var router=express[_0xbb43('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xbb43('0x5'));var interaction=require(_0xbb43('0x6'));var config=require(_0xbb43('0x7'));var controller=require(_0xbb43('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xbb43('0x9')]);router['get'](_0xbb43('0xa'),auth[_0xbb43('0xb')](),controller[_0xbb43('0xc')]);router[_0xbb43('0xd')](_0xbb43('0xe'),auth['isAuthenticated'](),controller[_0xbb43('0xf')]);router[_0xbb43('0xd')]('/:id/download',auth[_0xbb43('0xb')](),controller[_0xbb43('0x10')]);router[_0xbb43('0x11')]('/',auth[_0xbb43('0xb')](),interaction[_0xbb43('0x12')](_0xbb43('0x13'),'faxmessage:create'),controller[_0xbb43('0x14')]);router[_0xbb43('0x15')]('/:id',auth['isAuthenticated'](),controller[_0xbb43('0x16')]);router['put']('/:id/accept',auth[_0xbb43('0xb')](),controller['accept']);router[_0xbb43('0x15')](_0xbb43('0x17'),auth['isAuthenticated'](),controller['reject']);router['delete'](_0xbb43('0xe'),auth[_0xbb43('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x579c=['../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','describe','/:id','show','/:id/download','download','post','tracked','fax','faxmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x3739f3,_0x16f91f){var _0x5cd047=function(_0x30f8f0){while(--_0x30f8f0){_0x3739f3['push'](_0x3739f3['shift']());}};_0x5cd047(++_0x16f91f);}(_0x579c,0xda));var _0xc579=function(_0x35ee85,_0x1a870c){_0x35ee85=_0x35ee85-0x0;var _0x173aed=_0x579c[_0x35ee85];return _0x173aed;};'use strict';var multer=require(_0xc579('0x0'));var util=require(_0xc579('0x1'));var path=require(_0xc579('0x2'));var timeout=require(_0xc579('0x3'));var express=require(_0xc579('0x4'));var router=express['Router']();var fs_extra=require(_0xc579('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc579('0x6'));var config=require(_0xc579('0x7'));var controller=require(_0xc579('0x8'));router[_0xc579('0x9')]('/',auth[_0xc579('0xa')](),controller[_0xc579('0xb')]);router[_0xc579('0x9')]('/describe',auth[_0xc579('0xa')](),controller[_0xc579('0xc')]);router[_0xc579('0x9')](_0xc579('0xd'),auth[_0xc579('0xa')](),controller[_0xc579('0xe')]);router[_0xc579('0x9')](_0xc579('0xf'),auth['isAuthenticated'](),controller[_0xc579('0x10')]);router[_0xc579('0x11')]('/',auth[_0xc579('0xa')](),interaction[_0xc579('0x12')](_0xc579('0x13'),_0xc579('0x14')),controller[_0xc579('0x15')]);router[_0xc579('0x16')](_0xc579('0xd'),auth[_0xc579('0xa')](),controller[_0xc579('0x17')]);router['put'](_0xc579('0x18'),auth['isAuthenticated'](),controller[_0xc579('0x19')]);router['put'](_0xc579('0x1a'),auth['isAuthenticated'](),controller[_0xc579('0x1b')]);router['delete'](_0xc579('0xd'),auth[_0xc579('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index e427053..ac21575 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 _0x3832=['name','INTEGER','ENUM','rrmemory','roundrobin','sequelize','exports','STRING'];(function(_0x2211ed,_0x1bca0b){var _0x4d78cc=function(_0x467b59){while(--_0x467b59){_0x2211ed['push'](_0x2211ed['shift']());}};_0x4d78cc(++_0x1bca0b);}(_0x3832,0x9d));var _0x2383=function(_0x59259c,_0x46a459){_0x59259c=_0x59259c-0x0;var _0x3178b3=_0x3832[_0x59259c];return _0x3178b3;};'use strict';var Sequelize=require(_0x2383('0x0'));module[_0x2383('0x1')]={'name':{'type':Sequelize[_0x2383('0x2')],'unique':_0x2383('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x2383('0x2')]},'timeout':{'type':Sequelize[_0x2383('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x2383('0x5')](_0x2383('0x6'),'beepall',_0x2383('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x2383('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe824=['sequelize','STRING','INTEGER','ENUM','rrmemory','beepall'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0xe824,0x1c2));var _0x4e82=function(_0x56b3a3,_0x77b2d){_0x56b3a3=_0x56b3a3-0x0;var _0x5315cf=_0xe824[_0x56b3a3];return _0x5315cf;};'use strict';var Sequelize=require(_0x4e82('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x4e82('0x1')]},'timeout':{'type':Sequelize[_0x4e82('0x2')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x4e82('0x3')](_0x4e82('0x4'),_0x4e82('0x5'),'roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x4e82('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index 423d5a0..35c2ba1 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 _0x9f11=['attributes','hasOwnProperty','sort','filter','merge','where','options','includeAll','include','findAll','rows','catch','show','params','fields','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','FaxQueues','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','findOne','nolimit','order','pick','FaxQueueId','findAndCountAll','agent','faxPause','updatedAt','createdAt','getTeams','Team','addTeams','ids','User','Agents','online','interface','flatMap','transaction','UserFaxQueue','findOrCreate','emit','userFaxQueue:save','select','field','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','removeTeams','isEmpty','removeAgents','forEach','userFaxQueue:remove','addAgents','omit','isArray','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../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','register','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','then','get','UserProfileResource','destroy','end','error','name','send','map','FaxQueue','rawAttributes','type','key','model','query','keys','filters','intersection'];(function(_0xbf607b,_0x403437){var _0x4153f1=function(_0x5f0a97){while(--_0x5f0a97){_0xbf607b['push'](_0xbf607b['shift']());}};_0x4153f1(++_0x403437);}(_0x9f11,0x16b));var _0x19f1=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9f11[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x19f1('0x0'));var rimraf=require(_0x19f1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x19f1('0x2'));var rp=require(_0x19f1('0x3'));var moment=require(_0x19f1('0x4'));var BPromise=require(_0x19f1('0x5'));var Mustache=require(_0x19f1('0x6'));var util=require(_0x19f1('0x7'));var path=require(_0x19f1('0x8'));var sox=require(_0x19f1('0x9'));var csv=require(_0x19f1('0xa'));var ejs=require(_0x19f1('0xb'));var fs=require('fs');var fs_extra=require(_0x19f1('0xc'));var _=require(_0x19f1('0xd'));var squel=require(_0x19f1('0xe'));var crypto=require(_0x19f1('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x19f1('0xa'));var querystring=require(_0x19f1('0x10'));var Papa=require(_0x19f1('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x19f1('0x12'));var as=require(_0x19f1('0x13'));var hardwareService=require(_0x19f1('0x14'));var logger=require(_0x19f1('0x15'))(_0x19f1('0x16'));var utils=require(_0x19f1('0x17'));var config=require(_0x19f1('0x18'));var licenseUtil=require(_0x19f1('0x19'));var db=require(_0x19f1('0x1a'))['db'];config['redis']=_[_0x19f1('0x1b')](config['redis'],{'host':_0x19f1('0x1c'),'port':0x18eb});var socket=require(_0x19f1('0x1d'))(new Redis(config['redis']));require('./faxQueue.socket')[_0x19f1('0x1e')](socket);function respondWithStatusCode(_0x519fc3,_0x51c63e){_0x51c63e=_0x51c63e||0xcc;return function(_0x2ae89b){if(_0x2ae89b){return _0x519fc3[_0x19f1('0x1f')](_0x51c63e);}return _0x519fc3[_0x19f1('0x20')](_0x51c63e)['end']();};}function respondWithResult(_0x3e6fcd,_0x3109b3){_0x3109b3=_0x3109b3||0xc8;return function(_0x541462){if(_0x541462){return _0x3e6fcd['status'](_0x3109b3)['json'](_0x541462);}};}function respondWithFilteredResult(_0x260883,_0x3d9d5a){return function(_0x53f11b){if(_0x53f11b){var _0x158905=typeof _0x3d9d5a[_0x19f1('0x21')]===_0x19f1('0x22')&&typeof _0x3d9d5a[_0x19f1('0x23')]===_0x19f1('0x22');var _0x2228d4=_0x53f11b[_0x19f1('0x24')];var _0x2d2dcd=_0x158905?0x0:_0x3d9d5a['offset'];var _0x56804f=_0x158905?_0x53f11b[_0x19f1('0x24')]:_0x3d9d5a['offset']+_0x3d9d5a[_0x19f1('0x23')];var _0x5de2fd;if(_0x56804f>=_0x2228d4){_0x56804f=_0x2228d4;_0x5de2fd=0xc8;}else{_0x5de2fd=0xce;}_0x260883['status'](_0x5de2fd);return _0x260883[_0x19f1('0x25')](_0x19f1('0x26'),_0x2d2dcd+'-'+_0x56804f+'/'+_0x2228d4)[_0x19f1('0x27')](_0x53f11b);}return null;};}function patchUpdates(_0x728c){return function(_0x529613){try{jsonpatch[_0x19f1('0x28')](_0x529613,_0x728c,!![]);}catch(_0x1d6eef){return BPromise[_0x19f1('0x29')](_0x1d6eef);}return _0x529613['save']();};}function saveUpdates(_0x2b2e43,_0x55a200){return function(_0x4c63f0){if(_0x4c63f0){return _0x4c63f0['update'](_0x2b2e43)[_0x19f1('0x2a')](function(_0x366cc4){return _0x366cc4;});}return null;};}function removeEntity(_0x328d13,_0x56cfce){return function(_0x264bf4){if(_0x264bf4){return _0x264bf4['destroy']()[_0x19f1('0x2a')](function(){var _0x188006=_0x264bf4[_0x19f1('0x2b')]({'plain':!![]});var _0x2c656d='FaxQueues';return db[_0x19f1('0x2c')][_0x19f1('0x2d')]({'where':{'type':_0x2c656d,'resourceId':_0x188006['id']}})[_0x19f1('0x2a')](function(){return _0x264bf4;});})[_0x19f1('0x2a')](function(){_0x328d13[_0x19f1('0x20')](0xcc)[_0x19f1('0x2e')]();});}};}function handleEntityNotFound(_0x19d2ca,_0x4bd1cb){return function(_0x1b22bf){if(!_0x1b22bf){_0x19d2ca['sendStatus'](0x194);}return _0x1b22bf;};}function handleError(_0x51f947,_0x2110db){_0x2110db=_0x2110db||0x1f4;return function(_0x4fcf96){logger[_0x19f1('0x2f')](_0x4fcf96['stack']);if(_0x4fcf96[_0x19f1('0x30')]){delete _0x4fcf96[_0x19f1('0x30')];}_0x51f947['status'](_0x2110db)[_0x19f1('0x31')](_0x4fcf96);};}exports['index']=function(_0x443677,_0x4b9768){var _0x8a782={},_0x47d4c0={},_0xec2cbb={'count':0x0,'rows':[]};var _0x3b19ff=_[_0x19f1('0x32')](db[_0x19f1('0x33')][_0x19f1('0x34')],function(_0x276739){return{'name':_0x276739['fieldName'],'type':_0x276739[_0x19f1('0x35')][_0x19f1('0x36')]};});_0x47d4c0[_0x19f1('0x37')]=_[_0x19f1('0x32')](_0x3b19ff,'name');_0x47d4c0[_0x19f1('0x38')]=_[_0x19f1('0x39')](_0x443677['query']);_0x47d4c0[_0x19f1('0x3a')]=_[_0x19f1('0x3b')](_0x47d4c0[_0x19f1('0x37')],_0x47d4c0[_0x19f1('0x38')]);_0x8a782[_0x19f1('0x3c')]=_['intersection'](_0x47d4c0[_0x19f1('0x37')],qs['fields'](_0x443677['query']['fields']));_0x8a782[_0x19f1('0x3c')]=_0x8a782[_0x19f1('0x3c')]['length']?_0x8a782['attributes']:_0x47d4c0['model'];if(!_0x443677['query'][_0x19f1('0x3d')]('nolimit')){_0x8a782[_0x19f1('0x23')]=qs[_0x19f1('0x23')](_0x443677[_0x19f1('0x38')][_0x19f1('0x23')]);_0x8a782[_0x19f1('0x21')]=qs[_0x19f1('0x21')](_0x443677['query'][_0x19f1('0x21')]);}_0x8a782['order']=qs[_0x19f1('0x3e')](_0x443677[_0x19f1('0x38')]['sort']);_0x8a782['where']=qs[_0x19f1('0x3a')](_['pick'](_0x443677[_0x19f1('0x38')],_0x47d4c0['filters']),_0x3b19ff);if(_0x443677[_0x19f1('0x38')][_0x19f1('0x3f')]){_0x8a782['where']=_[_0x19f1('0x40')](_0x8a782[_0x19f1('0x41')],{'$or':_[_0x19f1('0x32')](_0x3b19ff,function(_0x4536d2){if(_0x4536d2[_0x19f1('0x35')]!=='VIRTUAL'){var _0x147a04={};_0x147a04[_0x4536d2['name']]={'$like':'%'+_0x443677[_0x19f1('0x38')][_0x19f1('0x3f')]+'%'};return _0x147a04;}})});}_0x8a782=_[_0x19f1('0x40')]({},_0x8a782,_0x443677[_0x19f1('0x42')]);var _0x5c1ebf={'where':_0x8a782['where']};return db['FaxQueue']['count'](_0x5c1ebf)['then'](function(_0x2348be){_0xec2cbb[_0x19f1('0x24')]=_0x2348be;if(_0x443677[_0x19f1('0x38')][_0x19f1('0x43')]){_0x8a782[_0x19f1('0x44')]=[{'all':!![]}];}return db[_0x19f1('0x33')][_0x19f1('0x45')](_0x8a782);})[_0x19f1('0x2a')](function(_0x32eeb8){_0xec2cbb[_0x19f1('0x46')]=_0x32eeb8;return _0xec2cbb;})[_0x19f1('0x2a')](respondWithFilteredResult(_0x4b9768,_0x8a782))[_0x19f1('0x47')](handleError(_0x4b9768,null));};exports[_0x19f1('0x48')]=function(_0x4017d9,_0x5721ea){var _0x215849={'raw':!![],'where':{'id':_0x4017d9[_0x19f1('0x49')]['id']}},_0x5c4de1={};_0x5c4de1[_0x19f1('0x37')]=_['keys'](db['FaxQueue'][_0x19f1('0x34')]);_0x5c4de1[_0x19f1('0x38')]=_[_0x19f1('0x39')](_0x4017d9[_0x19f1('0x38')]);_0x5c4de1[_0x19f1('0x3a')]=_['intersection'](_0x5c4de1['model'],_0x5c4de1[_0x19f1('0x38')]);_0x215849[_0x19f1('0x3c')]=_[_0x19f1('0x3b')](_0x5c4de1[_0x19f1('0x37')],qs[_0x19f1('0x4a')](_0x4017d9['query'][_0x19f1('0x4a')]));_0x215849[_0x19f1('0x3c')]=_0x215849['attributes'][_0x19f1('0x4b')]?_0x215849[_0x19f1('0x3c')]:_0x5c4de1[_0x19f1('0x37')];if(_0x4017d9['query']['includeAll']){_0x215849[_0x19f1('0x44')]=[{'all':!![]}];}_0x215849=_[_0x19f1('0x40')]({},_0x215849,_0x4017d9[_0x19f1('0x42')]);return db['FaxQueue'][_0x19f1('0x4c')](_0x215849)[_0x19f1('0x2a')](handleEntityNotFound(_0x5721ea,null))['then'](respondWithResult(_0x5721ea,null))[_0x19f1('0x47')](handleError(_0x5721ea,null));};exports[_0x19f1('0x4d')]=function(_0x85cab9,_0xaff14a){return db['FaxQueue'][_0x19f1('0x4d')](_0x85cab9[_0x19f1('0x4e')],{})[_0x19f1('0x2a')](function(_0x5cdb69){var _0x34b2c1=_0x85cab9[_0x19f1('0x4f')][_0x19f1('0x2b')]({'plain':!![]});if(!_0x34b2c1)throw new Error(_0x19f1('0x50'));if(_0x34b2c1[_0x19f1('0x51')]==='user'){var _0x5ace6e=_0x5cdb69[_0x19f1('0x2b')]({'plain':!![]});var _0xb5fe3d=_0x19f1('0x52');return db['UserProfileSection']['find']({'where':{'name':_0xb5fe3d,'userProfileId':_0x34b2c1[_0x19f1('0x53')]},'raw':!![]})['then'](function(_0x36cfeb){if(_0x36cfeb&&_0x36cfeb['autoAssociation']===0x0){return db['UserProfileResource'][_0x19f1('0x4d')]({'name':_0x5ace6e[_0x19f1('0x30')],'resourceId':_0x5ace6e['id'],'type':_0x36cfeb['name'],'sectionId':_0x36cfeb['id']},{})[_0x19f1('0x2a')](function(){return _0x5cdb69;});}else{return _0x5cdb69;}})[_0x19f1('0x47')](function(_0x335128){logger['error'](_0x19f1('0x54'),_0x335128);throw _0x335128;});}return _0x5cdb69;})[_0x19f1('0x2a')](respondWithResult(_0xaff14a,0xc9))[_0x19f1('0x47')](handleError(_0xaff14a,null));};exports[_0x19f1('0x55')]=function(_0x201e9d,_0x3eed86){if(_0x201e9d[_0x19f1('0x4e')]['id']){delete _0x201e9d['body']['id'];}return db['FaxQueue'][_0x19f1('0x4c')]({'where':{'id':_0x201e9d[_0x19f1('0x49')]['id']}})[_0x19f1('0x2a')](handleEntityNotFound(_0x3eed86,null))['then'](saveUpdates(_0x201e9d[_0x19f1('0x4e')],null))[_0x19f1('0x2a')](respondWithResult(_0x3eed86,null))[_0x19f1('0x47')](handleError(_0x3eed86,null));};exports[_0x19f1('0x2d')]=function(_0x3c3dac,_0x227cd9){return db[_0x19f1('0x33')]['find']({'where':{'id':_0x3c3dac[_0x19f1('0x49')]['id']}})[_0x19f1('0x2a')](handleEntityNotFound(_0x227cd9,null))['then'](removeEntity(_0x227cd9,null))[_0x19f1('0x47')](handleError(_0x227cd9,null));};exports[_0x19f1('0x56')]=function(_0x1b9e61,_0x1f84e5){return db[_0x19f1('0x33')][_0x19f1('0x56')]()['then'](respondWithResult(_0x1f84e5,null))[_0x19f1('0x47')](handleError(_0x1f84e5,null));};exports['getMembers']=function(_0x3b99a2,_0x2cc371,_0x41806d){var _0x13c844={'raw':!![],'where':{}},_0x2b374f={},_0x108188;return db[_0x19f1('0x33')][_0x19f1('0x57')]({'where':{'id':_0x3b99a2[_0x19f1('0x49')]['id']}})[_0x19f1('0x2a')](handleEntityNotFound(_0x2cc371,null))['then'](function(_0x561e36){if(_0x561e36){_0x108188=_0x561e36[_0x19f1('0x2b')]({'plain':!![]});_0x2b374f['model']=_[_0x19f1('0x39')](db['UserFaxQueue'][_0x19f1('0x34')]);_0x2b374f[_0x19f1('0x38')]=_[_0x19f1('0x39')](_0x3b99a2[_0x19f1('0x38')]);_0x2b374f[_0x19f1('0x3a')]=_['intersection'](_0x2b374f[_0x19f1('0x37')],_0x2b374f[_0x19f1('0x38')]);_0x13c844[_0x19f1('0x3c')]=_['intersection'](_0x2b374f[_0x19f1('0x37')],qs[_0x19f1('0x4a')](_0x3b99a2[_0x19f1('0x38')]['fields']));_0x13c844['attributes']=_0x13c844['attributes'][_0x19f1('0x4b')]?_0x13c844['attributes']:_0x2b374f[_0x19f1('0x37')];if(!_0x3b99a2[_0x19f1('0x38')][_0x19f1('0x3d')](_0x19f1('0x58'))){_0x13c844[_0x19f1('0x23')]=qs[_0x19f1('0x23')](_0x3b99a2[_0x19f1('0x38')][_0x19f1('0x23')]);_0x13c844[_0x19f1('0x21')]=qs[_0x19f1('0x21')](_0x3b99a2[_0x19f1('0x38')]['offset']);}_0x13c844[_0x19f1('0x59')]=qs[_0x19f1('0x3e')](_0x3b99a2[_0x19f1('0x38')][_0x19f1('0x3e')]);_0x13c844[_0x19f1('0x41')]=qs[_0x19f1('0x3a')](_[_0x19f1('0x5a')](_0x3b99a2['query'],_0x2b374f[_0x19f1('0x3a')]));_0x13c844[_0x19f1('0x41')][_0x19f1('0x5b')]=_0x561e36['id'];if(_0x3b99a2[_0x19f1('0x38')][_0x19f1('0x3f')]){_0x13c844['where']=_['merge'](_0x13c844[_0x19f1('0x41')],{'$or':_[_0x19f1('0x32')](_0x13c844[_0x19f1('0x3c')],function(_0x25b42e){var _0x16aab8={};_0x16aab8[_0x25b42e]={'$like':'%'+_0x3b99a2[_0x19f1('0x38')][_0x19f1('0x3f')]+'%'};return _0x16aab8;})});}_0x13c844=_[_0x19f1('0x40')]({},_0x13c844,_0x3b99a2[_0x19f1('0x42')]);return db['UserFaxQueue']['findAll'](_0x13c844);}})['then'](function(_0x203640){if(_0x203640){return db['User'][_0x19f1('0x5c')]({'where':{'id':_['map'](_0x203640,'UserId'),'role':_0x19f1('0x5d')},'attributes':['id',_0x19f1('0x30'),_0x19f1('0x5e'),_0x19f1('0x5f'),_0x19f1('0x60')]});}})[_0x19f1('0x2a')](function(_0x6ef3a){if(_0x6ef3a){return{'count':_0x6ef3a['count'],'rows':_[_0x19f1('0x32')](_0x6ef3a[_0x19f1('0x46')],function(_0x552b7c){return{'membername':_0x552b7c[_0x19f1('0x30')],'UserId':_0x552b7c['id'],'queue_name':_0x108188[_0x19f1('0x30')],'FaxQueueId':_0x108188['id'],'interface':util['format']('%s/%s','SIP',_0x552b7c[_0x19f1('0x30')]),'penalty':0x0,'paused':_0x552b7c[_0x19f1('0x5e')],'createdAt':_0x552b7c['createdAt'],'updatedAt':_0x552b7c[_0x19f1('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x19f1('0x2a')](respondWithFilteredResult(_0x2cc371,_0x13c844))['catch'](handleError(_0x2cc371,null));};exports[_0x19f1('0x61')]=function(_0x43aac2,_0x2e9fa5,_0x3e5bc5){var _0x365616={};var _0x5768bd={};var _0x5d3336;var _0x1295c3;return db[_0x19f1('0x33')][_0x19f1('0x57')]({'where':{'id':_0x43aac2[_0x19f1('0x49')]['id']}})[_0x19f1('0x2a')](handleEntityNotFound(_0x2e9fa5,null))[_0x19f1('0x2a')](function(_0x290929){if(_0x290929){_0x5d3336=_0x290929;_0x5768bd[_0x19f1('0x37')]=_[_0x19f1('0x39')](db[_0x19f1('0x62')][_0x19f1('0x34')]);_0x5768bd[_0x19f1('0x38')]=_[_0x19f1('0x39')](_0x43aac2['query']);_0x5768bd[_0x19f1('0x3a')]=_[_0x19f1('0x3b')](_0x5768bd[_0x19f1('0x37')],_0x5768bd[_0x19f1('0x38')]);_0x365616[_0x19f1('0x3c')]=_[_0x19f1('0x3b')](_0x5768bd[_0x19f1('0x37')],qs[_0x19f1('0x4a')](_0x43aac2[_0x19f1('0x38')][_0x19f1('0x4a')]));_0x365616[_0x19f1('0x3c')]=_0x365616['attributes'][_0x19f1('0x4b')]?_0x365616[_0x19f1('0x3c')]:_0x5768bd[_0x19f1('0x37')];_0x365616['order']=qs[_0x19f1('0x3e')](_0x43aac2[_0x19f1('0x38')][_0x19f1('0x3e')]);_0x365616[_0x19f1('0x41')]=qs['filters'](_[_0x19f1('0x5a')](_0x43aac2['query'],_0x5768bd['filters']));if(_0x43aac2[_0x19f1('0x38')]['filter']){_0x365616[_0x19f1('0x41')]=_[_0x19f1('0x40')](_0x365616[_0x19f1('0x41')],{'$or':_[_0x19f1('0x32')](_0x365616[_0x19f1('0x3c')],function(_0x5db8c0){var _0x533b6d={};_0x533b6d[_0x5db8c0]={'$like':'%'+_0x43aac2[_0x19f1('0x38')][_0x19f1('0x3f')]+'%'};return _0x533b6d;})});}_0x365616=_[_0x19f1('0x40')]({},_0x365616,_0x43aac2[_0x19f1('0x42')]);return _0x5d3336[_0x19f1('0x61')](_0x365616);}})[_0x19f1('0x2a')](function(_0x1e7572){if(_0x1e7572){_0x1295c3=_0x1e7572['length'];if(!_0x43aac2[_0x19f1('0x38')][_0x19f1('0x3d')](_0x19f1('0x58'))){_0x365616['limit']=qs[_0x19f1('0x23')](_0x43aac2[_0x19f1('0x38')][_0x19f1('0x23')]);_0x365616[_0x19f1('0x21')]=qs[_0x19f1('0x21')](_0x43aac2[_0x19f1('0x38')][_0x19f1('0x21')]);}return _0x5d3336[_0x19f1('0x61')](_0x365616);}})[_0x19f1('0x2a')](function(_0x2d8d58){if(_0x2d8d58){return _0x2d8d58?{'count':_0x1295c3,'rows':_0x2d8d58}:null;}})['then'](respondWithResult(_0x2e9fa5,null))['catch'](handleError(_0x2e9fa5,null));};exports[_0x19f1('0x63')]=function(_0x122db1,_0x5d9de3,_0x1d3167){var _0x4f8f4b=_0x122db1[_0x19f1('0x4e')][_0x19f1('0x64')];return db[_0x19f1('0x62')][_0x19f1('0x45')]({'where':{'id':_0x4f8f4b},'attributes':['id'],'include':[{'model':db[_0x19f1('0x65')],'as':_0x19f1('0x66'),'attributes':['id','name',_0x19f1('0x67'),'voicePause',_0x19f1('0x68')],'raw':!![]}]})[_0x19f1('0x2a')](function(_0x543dff){if(_0x543dff){var _0x9463e3=_[_0x19f1('0x69')](_0x543dff,function(_0x48323c){var _0x30077f=_0x48323c[_0x19f1('0x2b')]({'plain':!![]});return _0x30077f['Agents'];});return db[_0x19f1('0x33')][_0x19f1('0x4c')]({'where':{'id':_0x122db1[_0x19f1('0x49')]['id']}})['then'](function(_0xea4f15){return db['sequelize'][_0x19f1('0x6a')](function(_0x4fbfe3){return _0xea4f15[_0x19f1('0x63')](_0x4f8f4b,{'transaction':_0x4fbfe3})['then'](function(){return BPromise['each'](_0x9463e3,function(_0x5efd17){return db[_0x19f1('0x6b')][_0x19f1('0x6c')]({'where':{'UserId':_0x5efd17['id'],'FaxQueueId':_0x122db1[_0x19f1('0x49')]['id']},'transaction':_0x4fbfe3});});})['then'](function(){_0x9463e3['forEach'](function(_0x33096f){socket[_0x19f1('0x6d')](_0x19f1('0x6e'),{'UserId':_0x33096f['id'],'FaxQueueId':_0xea4f15['id']});});});});});}})[_0x19f1('0x2a')](respondWithStatusCode(_0x5d9de3,null))['catch'](handleError(_0x5d9de3,null));};exports['removeTeams']=function(_0x18947b,_0x19106f,_0x217887){return db['Team'][_0x19f1('0x45')]({'where':{'id':_0x18947b[_0x19f1('0x38')]['ids']},'attributes':['id'],'include':[{'model':db[_0x19f1('0x65')],'as':_0x19f1('0x66'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x19106f,null))[_0x19f1('0x2a')](function(_0x508331){var _0x85ad9a=_[_0x19f1('0x32')](_0x508331,'id');var _0x3ff317=[];var _0x459c28=[];var _0x5e43b0=squel[_0x19f1('0x6f')]();_0x5e43b0[_0x19f1('0x70')](_0x19f1('0x71'))[_0x19f1('0x72')](_0x19f1('0x73'),'tq')[_0x19f1('0x74')](_0x19f1('0x75'),'ut',_0x19f1('0x76'))[_0x19f1('0x41')](_0x19f1('0x77'),_0x18947b[_0x19f1('0x49')]['id']);for(var _0x2f65db=0x0;_0x2f65db<_0x508331[_0x19f1('0x4b')];_0x2f65db+=0x1){let _0x9e04bd=_0x508331[_0x2f65db];for(var _0x46cb7c=0x0;_0x46cb7c<_0x9e04bd[_0x19f1('0x66')]['length'];_0x46cb7c+=0x1){let _0x1fd861=_0x9e04bd['Agents'][_0x46cb7c];var _0x3c2cb0=_0x5e43b0['clone']();_0x3c2cb0[_0x19f1('0x41')]('ut.UserId\x20=\x20?',_0x1fd861['id']);_0x459c28[_0x19f1('0x78')](db[_0x19f1('0x79')][_0x19f1('0x38')](_0x3c2cb0[_0x19f1('0x7a')](),{'type':db['sequelize'][_0x19f1('0x7b')][_0x19f1('0x7c')]})['then'](function(_0x4801ff){if(_0x4801ff[_0x19f1('0x4b')]===0x1){return _0x1fd861['id'];}else{var _0x4f3312=_[_0x19f1('0x7d')](_['map'](_0x4801ff,_0x19f1('0x7e')),function(_0x23a443){return _[_0x19f1('0x7f')](_0x85ad9a,_0x23a443);});if(_0x4f3312){return _0x1fd861['id'];}}}));}}return BPromise[_0x19f1('0x80')](_0x459c28)[_0x19f1('0x2a')](function(_0xf851bb){_0x3ff317=_(_0x3ff317)[_0x19f1('0x81')](_0xf851bb)[_0x19f1('0x82')]()[_0x19f1('0x83')]();return db['FaxQueue'][_0x19f1('0x4c')]({'where':{'id':_0x18947b[_0x19f1('0x49')]['id']}})[_0x19f1('0x2a')](function(_0x5e5692){return db['sequelize'][_0x19f1('0x6a')](function(_0x1db3e9){return _0x5e5692[_0x19f1('0x84')](_0x18947b['query'][_0x19f1('0x64')],{'transaction':_0x1db3e9})[_0x19f1('0x2a')](function(){if(!_[_0x19f1('0x85')](_0x3ff317)){return _0x5e5692[_0x19f1('0x86')](_0x3ff317,{'transaction':_0x1db3e9});}})[_0x19f1('0x2a')](function(){_0x3ff317[_0x19f1('0x87')](function(_0x36dd78){socket['emit'](_0x19f1('0x88'),{'UserId':_0x36dd78,'FaxQueueId':_0x5e5692['id']});});});});});});})[_0x19f1('0x2a')](respondWithStatusCode(_0x19106f,null))[_0x19f1('0x47')](handleError(_0x19106f,null));};exports[_0x19f1('0x89')]=function(_0x2258dd,_0x1b81f5,_0x5d8bc0){return db['FaxQueue'][_0x19f1('0x4c')]({'where':{'id':_0x2258dd[_0x19f1('0x49')]['id']}})[_0x19f1('0x2a')](handleEntityNotFound(_0x1b81f5,null))['then'](function(_0xe8829c){if(_0xe8829c){return _0xe8829c['addAgents'](_0x2258dd[_0x19f1('0x4e')][_0x19f1('0x64')],_[_0x19f1('0x8a')](_0x2258dd[_0x19f1('0x4e')],[_0x19f1('0x64'),'id'])||{})['spread'](function(_0x92412){for(var _0x12f750=0x0;_0x12f750<_0x2258dd[_0x19f1('0x4e')]['ids']['length'];_0x12f750+=0x1){socket['emit']('userFaxQueue:save',{'UserId':Number(_0x2258dd[_0x19f1('0x4e')][_0x19f1('0x64')][_0x12f750]),'FaxQueueId':Number(_0x2258dd['params']['id'])});}return _0x92412;});}})[_0x19f1('0x2a')](respondWithResult(_0x1b81f5,null))[_0x19f1('0x47')](handleError(_0x1b81f5,null));};exports[_0x19f1('0x86')]=function(_0x486331,_0x2b36d8,_0x87b914){return db[_0x19f1('0x33')]['find']({'where':{'id':_0x486331[_0x19f1('0x49')]['id']}})['then'](handleEntityNotFound(_0x2b36d8,null))[_0x19f1('0x2a')](function(_0x88b58d){if(_0x88b58d){return _0x88b58d[_0x19f1('0x86')](_0x486331[_0x19f1('0x38')][_0x19f1('0x64')])['then'](function(){if(_[_0x19f1('0x8b')](_0x486331[_0x19f1('0x38')]['ids'])){for(var _0x51d5b8=0x0;_0x51d5b8<_0x486331[_0x19f1('0x38')][_0x19f1('0x64')][_0x19f1('0x4b')];_0x51d5b8+=0x1){socket[_0x19f1('0x6d')]('userFaxQueue:remove',{'UserId':Number(_0x486331[_0x19f1('0x38')]['ids'][_0x51d5b8]),'FaxQueueId':Number(_0x486331[_0x19f1('0x49')]['id'])});}}else{socket['emit'](_0x19f1('0x88'),{'UserId':Number(_0x486331[_0x19f1('0x38')][_0x19f1('0x64')]),'FaxQueueId':Number(_0x486331['params']['id'])});}});}})[_0x19f1('0x2a')](respondWithStatusCode(_0x2b36d8,null))[_0x19f1('0x47')](handleError(_0x2b36d8,null));};exports[_0x19f1('0x8c')]=function(_0x12e4f5,_0x23f1c0,_0x4eb0c1){var _0x505d06={};var _0x3b41ba={};var _0x7849f3;var _0x5fefc8;return db[_0x19f1('0x33')]['findOne']({'where':{'id':_0x12e4f5[_0x19f1('0x49')]['id']}})['then'](handleEntityNotFound(_0x23f1c0,null))[_0x19f1('0x2a')](function(_0x1fcc13){if(_0x1fcc13){_0x7849f3=_0x1fcc13;_0x3b41ba['model']=_[_0x19f1('0x39')](db['User']['rawAttributes']);_0x3b41ba['query']=_[_0x19f1('0x39')](_0x12e4f5[_0x19f1('0x38')]);_0x3b41ba['filters']=_[_0x19f1('0x3b')](_0x3b41ba[_0x19f1('0x37')],_0x3b41ba['query']);_0x505d06[_0x19f1('0x3c')]=_[_0x19f1('0x3b')](_0x3b41ba['model'],qs[_0x19f1('0x4a')](_0x12e4f5['query'][_0x19f1('0x4a')]));_0x505d06[_0x19f1('0x3c')]=_0x505d06['attributes'][_0x19f1('0x4b')]?_0x505d06[_0x19f1('0x3c')]:_0x3b41ba['model'];_0x505d06[_0x19f1('0x59')]=qs['sort'](_0x12e4f5['query'][_0x19f1('0x3e')]);_0x505d06[_0x19f1('0x41')]=qs[_0x19f1('0x3a')](_[_0x19f1('0x5a')](_0x12e4f5[_0x19f1('0x38')],_0x3b41ba[_0x19f1('0x3a')]));if(_0x12e4f5[_0x19f1('0x38')]['filter']){_0x505d06[_0x19f1('0x41')]=_[_0x19f1('0x40')](_0x505d06['where'],{'$or':_[_0x19f1('0x32')](_0x505d06['attributes'],function(_0x3c2d49){var _0x373ce7={};_0x373ce7[_0x3c2d49]={'$like':'%'+_0x12e4f5[_0x19f1('0x38')][_0x19f1('0x3f')]+'%'};return _0x373ce7;})});}_0x505d06=_['merge']({},_0x505d06,_0x12e4f5['options']);return _0x7849f3[_0x19f1('0x8c')](_0x505d06);}})[_0x19f1('0x2a')](function(_0x4cf1ea){if(_0x4cf1ea){_0x5fefc8=_0x4cf1ea['length'];if(!_0x12e4f5[_0x19f1('0x38')][_0x19f1('0x3d')]('nolimit')){_0x505d06['limit']=qs[_0x19f1('0x23')](_0x12e4f5[_0x19f1('0x38')][_0x19f1('0x23')]);_0x505d06[_0x19f1('0x21')]=qs['offset'](_0x12e4f5[_0x19f1('0x38')][_0x19f1('0x21')]);}return _0x7849f3[_0x19f1('0x8c')](_0x505d06);}})[_0x19f1('0x2a')](function(_0x1c2f91){if(_0x1c2f91){return _0x1c2f91?{'count':_0x5fefc8,'rows':_0x1c2f91}:null;}})[_0x19f1('0x2a')](respondWithResult(_0x23f1c0,null))['catch'](handleError(_0x23f1c0,null));}; \ No newline at end of file +var _0xa86e=['UserFaxQueue','nolimit','pick','FaxQueueId','User','findAndCountAll','updatedAt','SIP','faxPause','getTeams','addTeams','ids','Team','Agents','online','voicePause','flatMap','transaction','each','findOrCreate','emit','removeTeams','select','field','from','team_has_fax_queues','join','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','toString','sequelize','QueryTypes','SELECT','every','TeamId','all','union','compact','removeAgents','forEach','userFaxQueue:remove','addAgents','omit','spread','userFaxQueue:save','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','then','destroy','FaxQueues','UserProfileResource','stack','name','index','FaxQueue','rawAttributes','fieldName','type','key','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','keys','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','params','getMembers','findOne'];(function(_0x29266a,_0x3c7943){var _0xbf84a3=function(_0x2786c6){while(--_0x2786c6){_0x29266a['push'](_0x29266a['shift']());}};_0xbf84a3(++_0x3c7943);}(_0xa86e,0x1c7));var _0xea86=function(_0x5df83d,_0x5b323f){_0x5df83d=_0x5df83d-0x0;var _0x51d78f=_0xa86e[_0x5df83d];return _0x51d78f;};'use strict';var emlformat=require(_0xea86('0x0'));var rimraf=require(_0xea86('0x1'));var zipdir=require(_0xea86('0x2'));var jsonpatch=require(_0xea86('0x3'));var rp=require(_0xea86('0x4'));var moment=require('moment');var BPromise=require(_0xea86('0x5'));var Mustache=require(_0xea86('0x6'));var util=require('util');var path=require(_0xea86('0x7'));var sox=require(_0xea86('0x8'));var csv=require(_0xea86('0x9'));var ejs=require(_0xea86('0xa'));var fs=require('fs');var fs_extra=require(_0xea86('0xb'));var _=require(_0xea86('0xc'));var squel=require(_0xea86('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xea86('0xe'));var toCsv=require('to-csv');var querystring=require(_0xea86('0xf'));var Papa=require(_0xea86('0x10'));var Redis=require('ioredis');var authService=require(_0xea86('0x11'));var qs=require(_0xea86('0x12'));var as=require(_0xea86('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xea86('0x14'));var utils=require(_0xea86('0x15'));var config=require(_0xea86('0x16'));var licenseUtil=require(_0xea86('0x17'));var db=require(_0xea86('0x18'))['db'];config[_0xea86('0x19')]=_[_0xea86('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xea86('0x1b'))(new Redis(config['redis']));require('./faxQueue.socket')[_0xea86('0x1c')](socket);function respondWithStatusCode(_0x4ccaf0,_0x396718){_0x396718=_0x396718||0xcc;return function(_0x4f62c9){if(_0x4f62c9){return _0x4ccaf0[_0xea86('0x1d')](_0x396718);}return _0x4ccaf0[_0xea86('0x1e')](_0x396718)[_0xea86('0x1f')]();};}function respondWithResult(_0x14f3d0,_0x27c1c6){_0x27c1c6=_0x27c1c6||0xc8;return function(_0x2529ff){if(_0x2529ff){return _0x14f3d0[_0xea86('0x1e')](_0x27c1c6)[_0xea86('0x20')](_0x2529ff);}};}function respondWithFilteredResult(_0x4e3fe3,_0x26b0f4){return function(_0x2c6aa0){if(_0x2c6aa0){var _0x464bfe=typeof _0x26b0f4[_0xea86('0x21')]===_0xea86('0x22')&&typeof _0x26b0f4[_0xea86('0x23')]==='undefined';var _0x21bf9e=_0x2c6aa0['count'];var _0xf3e39c=_0x464bfe?0x0:_0x26b0f4[_0xea86('0x21')];var _0x5ce5c2=_0x464bfe?_0x2c6aa0['count']:_0x26b0f4['offset']+_0x26b0f4[_0xea86('0x23')];var _0x1bdf1b;if(_0x5ce5c2>=_0x21bf9e){_0x5ce5c2=_0x21bf9e;_0x1bdf1b=0xc8;}else{_0x1bdf1b=0xce;}_0x4e3fe3[_0xea86('0x1e')](_0x1bdf1b);return _0x4e3fe3[_0xea86('0x24')](_0xea86('0x25'),_0xf3e39c+'-'+_0x5ce5c2+'/'+_0x21bf9e)[_0xea86('0x20')](_0x2c6aa0);}return null;};}function patchUpdates(_0x4b50e4){return function(_0x2a1c72){try{jsonpatch['apply'](_0x2a1c72,_0x4b50e4,!![]);}catch(_0x42b2ad){return BPromise['reject'](_0x42b2ad);}return _0x2a1c72['save']();};}function saveUpdates(_0x1bc115,_0xd3654d){return function(_0x106083){if(_0x106083){return _0x106083['update'](_0x1bc115)[_0xea86('0x26')](function(_0x142e0b){return _0x142e0b;});}return null;};}function removeEntity(_0x4e98c5,_0x57412e){return function(_0x2e6af6){if(_0x2e6af6){return _0x2e6af6[_0xea86('0x27')]()[_0xea86('0x26')](function(){var _0x4c8a23=_0x2e6af6['get']({'plain':!![]});var _0x136b66=_0xea86('0x28');return db[_0xea86('0x29')][_0xea86('0x27')]({'where':{'type':_0x136b66,'resourceId':_0x4c8a23['id']}})['then'](function(){return _0x2e6af6;});})[_0xea86('0x26')](function(){_0x4e98c5[_0xea86('0x1e')](0xcc)[_0xea86('0x1f')]();});}};}function handleEntityNotFound(_0x4d3851,_0xd11b9){return function(_0x270ff1){if(!_0x270ff1){_0x4d3851['sendStatus'](0x194);}return _0x270ff1;};}function handleError(_0xd065fd,_0x40bb79){_0x40bb79=_0x40bb79||0x1f4;return function(_0x44535c){logger['error'](_0x44535c[_0xea86('0x2a')]);if(_0x44535c[_0xea86('0x2b')]){delete _0x44535c['name'];}_0xd065fd['status'](_0x40bb79)['send'](_0x44535c);};}exports[_0xea86('0x2c')]=function(_0x12a69d,_0x4212f8){var _0x53aeb9={},_0x184d95={},_0x248f12={'count':0x0,'rows':[]};var _0x22d56b=_['map'](db[_0xea86('0x2d')][_0xea86('0x2e')],function(_0x3e13ba){return{'name':_0x3e13ba[_0xea86('0x2f')],'type':_0x3e13ba[_0xea86('0x30')][_0xea86('0x31')]};});_0x184d95['model']=_[_0xea86('0x32')](_0x22d56b,_0xea86('0x2b'));_0x184d95[_0xea86('0x33')]=_['keys'](_0x12a69d[_0xea86('0x33')]);_0x184d95[_0xea86('0x34')]=_[_0xea86('0x35')](_0x184d95[_0xea86('0x36')],_0x184d95[_0xea86('0x33')]);_0x53aeb9[_0xea86('0x37')]=_['intersection'](_0x184d95[_0xea86('0x36')],qs[_0xea86('0x38')](_0x12a69d['query'][_0xea86('0x38')]));_0x53aeb9[_0xea86('0x37')]=_0x53aeb9['attributes'][_0xea86('0x39')]?_0x53aeb9[_0xea86('0x37')]:_0x184d95[_0xea86('0x36')];if(!_0x12a69d[_0xea86('0x33')][_0xea86('0x3a')]('nolimit')){_0x53aeb9[_0xea86('0x23')]=qs[_0xea86('0x23')](_0x12a69d[_0xea86('0x33')][_0xea86('0x23')]);_0x53aeb9[_0xea86('0x21')]=qs[_0xea86('0x21')](_0x12a69d[_0xea86('0x33')][_0xea86('0x21')]);}_0x53aeb9[_0xea86('0x3b')]=qs[_0xea86('0x3c')](_0x12a69d['query'][_0xea86('0x3c')]);_0x53aeb9[_0xea86('0x3d')]=qs[_0xea86('0x34')](_['pick'](_0x12a69d[_0xea86('0x33')],_0x184d95[_0xea86('0x34')]),_0x22d56b);if(_0x12a69d['query'][_0xea86('0x3e')]){_0x53aeb9[_0xea86('0x3d')]=_[_0xea86('0x3f')](_0x53aeb9[_0xea86('0x3d')],{'$or':_[_0xea86('0x32')](_0x22d56b,function(_0x3517db){if(_0x3517db[_0xea86('0x30')]!==_0xea86('0x40')){var _0x489676={};_0x489676[_0x3517db[_0xea86('0x2b')]]={'$like':'%'+_0x12a69d[_0xea86('0x33')][_0xea86('0x3e')]+'%'};return _0x489676;}})});}_0x53aeb9=_['merge']({},_0x53aeb9,_0x12a69d[_0xea86('0x41')]);var _0x56aca7={'where':_0x53aeb9[_0xea86('0x3d')]};return db['FaxQueue'][_0xea86('0x42')](_0x56aca7)[_0xea86('0x26')](function(_0x3f196d){_0x248f12['count']=_0x3f196d;if(_0x12a69d[_0xea86('0x33')][_0xea86('0x43')]){_0x53aeb9[_0xea86('0x44')]=[{'all':!![]}];}return db[_0xea86('0x2d')][_0xea86('0x45')](_0x53aeb9);})[_0xea86('0x26')](function(_0x51614d){_0x248f12[_0xea86('0x46')]=_0x51614d;return _0x248f12;})[_0xea86('0x26')](respondWithFilteredResult(_0x4212f8,_0x53aeb9))[_0xea86('0x47')](handleError(_0x4212f8,null));};exports[_0xea86('0x48')]=function(_0x4b670a,_0x23a8f9){var _0x1514d6={'raw':!![],'where':{'id':_0x4b670a['params']['id']}},_0x1213b1={};_0x1213b1[_0xea86('0x36')]=_[_0xea86('0x49')](db['FaxQueue'][_0xea86('0x2e')]);_0x1213b1[_0xea86('0x33')]=_[_0xea86('0x49')](_0x4b670a[_0xea86('0x33')]);_0x1213b1[_0xea86('0x34')]=_[_0xea86('0x35')](_0x1213b1[_0xea86('0x36')],_0x1213b1[_0xea86('0x33')]);_0x1514d6[_0xea86('0x37')]=_[_0xea86('0x35')](_0x1213b1[_0xea86('0x36')],qs[_0xea86('0x38')](_0x4b670a[_0xea86('0x33')][_0xea86('0x38')]));_0x1514d6[_0xea86('0x37')]=_0x1514d6[_0xea86('0x37')]['length']?_0x1514d6[_0xea86('0x37')]:_0x1213b1[_0xea86('0x36')];if(_0x4b670a[_0xea86('0x33')]['includeAll']){_0x1514d6[_0xea86('0x44')]=[{'all':!![]}];}_0x1514d6=_[_0xea86('0x3f')]({},_0x1514d6,_0x4b670a[_0xea86('0x41')]);return db[_0xea86('0x2d')]['find'](_0x1514d6)['then'](handleEntityNotFound(_0x23a8f9,null))[_0xea86('0x26')](respondWithResult(_0x23a8f9,null))['catch'](handleError(_0x23a8f9,null));};exports[_0xea86('0x4a')]=function(_0x5450d4,_0x2337c6){return db[_0xea86('0x2d')][_0xea86('0x4a')](_0x5450d4[_0xea86('0x4b')],{})[_0xea86('0x26')](function(_0x4733aa){var _0x14a2ee=_0x5450d4[_0xea86('0x4c')]['get']({'plain':!![]});if(!_0x14a2ee)throw new Error(_0xea86('0x4d'));if(_0x14a2ee[_0xea86('0x4e')]===_0xea86('0x4c')){var _0x29c9dd=_0x4733aa[_0xea86('0x4f')]({'plain':!![]});var _0x2e6cb0=_0xea86('0x28');return db[_0xea86('0x50')]['find']({'where':{'name':_0x2e6cb0,'userProfileId':_0x14a2ee[_0xea86('0x51')]},'raw':!![]})[_0xea86('0x26')](function(_0xa12585){if(_0xa12585&&_0xa12585[_0xea86('0x52')]===0x0){return db[_0xea86('0x29')][_0xea86('0x4a')]({'name':_0x29c9dd[_0xea86('0x2b')],'resourceId':_0x29c9dd['id'],'type':_0xa12585['name'],'sectionId':_0xa12585['id']},{})['then'](function(){return _0x4733aa;});}else{return _0x4733aa;}})[_0xea86('0x47')](function(_0x23fa1c){logger[_0xea86('0x53')](_0xea86('0x54'),_0x23fa1c);throw _0x23fa1c;});}return _0x4733aa;})[_0xea86('0x26')](respondWithResult(_0x2337c6,0xc9))[_0xea86('0x47')](handleError(_0x2337c6,null));};exports['update']=function(_0x53fd74,_0x332877){if(_0x53fd74[_0xea86('0x4b')]['id']){delete _0x53fd74[_0xea86('0x4b')]['id'];}return db['FaxQueue']['find']({'where':{'id':_0x53fd74['params']['id']}})['then'](handleEntityNotFound(_0x332877,null))[_0xea86('0x26')](saveUpdates(_0x53fd74[_0xea86('0x4b')],null))[_0xea86('0x26')](respondWithResult(_0x332877,null))[_0xea86('0x47')](handleError(_0x332877,null));};exports['destroy']=function(_0x35fc82,_0x4568f8){return db['FaxQueue'][_0xea86('0x55')]({'where':{'id':_0x35fc82[_0xea86('0x56')]['id']}})[_0xea86('0x26')](handleEntityNotFound(_0x4568f8,null))[_0xea86('0x26')](removeEntity(_0x4568f8,null))[_0xea86('0x47')](handleError(_0x4568f8,null));};exports['describe']=function(_0x256955,_0x4ce01a){return db[_0xea86('0x2d')]['describe']()[_0xea86('0x26')](respondWithResult(_0x4ce01a,null))['catch'](handleError(_0x4ce01a,null));};exports[_0xea86('0x57')]=function(_0x907eb3,_0x3ef9da,_0x314b27){var _0x4e2f87={'raw':!![],'where':{}},_0x5ba266={},_0x5089e7;return db[_0xea86('0x2d')][_0xea86('0x58')]({'where':{'id':_0x907eb3[_0xea86('0x56')]['id']}})[_0xea86('0x26')](handleEntityNotFound(_0x3ef9da,null))[_0xea86('0x26')](function(_0x4de15e){if(_0x4de15e){_0x5089e7=_0x4de15e[_0xea86('0x4f')]({'plain':!![]});_0x5ba266[_0xea86('0x36')]=_[_0xea86('0x49')](db[_0xea86('0x59')][_0xea86('0x2e')]);_0x5ba266[_0xea86('0x33')]=_[_0xea86('0x49')](_0x907eb3[_0xea86('0x33')]);_0x5ba266[_0xea86('0x34')]=_[_0xea86('0x35')](_0x5ba266[_0xea86('0x36')],_0x5ba266[_0xea86('0x33')]);_0x4e2f87[_0xea86('0x37')]=_[_0xea86('0x35')](_0x5ba266[_0xea86('0x36')],qs[_0xea86('0x38')](_0x907eb3[_0xea86('0x33')][_0xea86('0x38')]));_0x4e2f87['attributes']=_0x4e2f87[_0xea86('0x37')][_0xea86('0x39')]?_0x4e2f87['attributes']:_0x5ba266['model'];if(!_0x907eb3[_0xea86('0x33')][_0xea86('0x3a')](_0xea86('0x5a'))){_0x4e2f87[_0xea86('0x23')]=qs['limit'](_0x907eb3[_0xea86('0x33')][_0xea86('0x23')]);_0x4e2f87['offset']=qs[_0xea86('0x21')](_0x907eb3[_0xea86('0x33')]['offset']);}_0x4e2f87[_0xea86('0x3b')]=qs[_0xea86('0x3c')](_0x907eb3[_0xea86('0x33')]['sort']);_0x4e2f87[_0xea86('0x3d')]=qs[_0xea86('0x34')](_[_0xea86('0x5b')](_0x907eb3['query'],_0x5ba266[_0xea86('0x34')]));_0x4e2f87['where'][_0xea86('0x5c')]=_0x4de15e['id'];if(_0x907eb3['query'][_0xea86('0x3e')]){_0x4e2f87[_0xea86('0x3d')]=_[_0xea86('0x3f')](_0x4e2f87[_0xea86('0x3d')],{'$or':_[_0xea86('0x32')](_0x4e2f87[_0xea86('0x37')],function(_0x45e123){var _0x5ab970={};_0x5ab970[_0x45e123]={'$like':'%'+_0x907eb3[_0xea86('0x33')][_0xea86('0x3e')]+'%'};return _0x5ab970;})});}_0x4e2f87=_[_0xea86('0x3f')]({},_0x4e2f87,_0x907eb3[_0xea86('0x41')]);return db[_0xea86('0x59')][_0xea86('0x45')](_0x4e2f87);}})[_0xea86('0x26')](function(_0xd20269){if(_0xd20269){return db[_0xea86('0x5d')][_0xea86('0x5e')]({'where':{'id':_[_0xea86('0x32')](_0xd20269,'UserId'),'role':'agent'},'attributes':['id',_0xea86('0x2b'),'faxPause',_0xea86('0x5f'),'createdAt']});}})[_0xea86('0x26')](function(_0x43ebad){if(_0x43ebad){return{'count':_0x43ebad[_0xea86('0x42')],'rows':_['map'](_0x43ebad[_0xea86('0x46')],function(_0x120cab){return{'membername':_0x120cab[_0xea86('0x2b')],'UserId':_0x120cab['id'],'queue_name':_0x5089e7[_0xea86('0x2b')],'FaxQueueId':_0x5089e7['id'],'interface':util['format']('%s/%s',_0xea86('0x60'),_0x120cab[_0xea86('0x2b')]),'penalty':0x0,'paused':_0x120cab[_0xea86('0x61')],'createdAt':_0x120cab['createdAt'],'updatedAt':_0x120cab[_0xea86('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xea86('0x26')](respondWithFilteredResult(_0x3ef9da,_0x4e2f87))[_0xea86('0x47')](handleError(_0x3ef9da,null));};exports['getTeams']=function(_0x3c79cf,_0x553d20,_0x265921){var _0x123227={};var _0x3c4702={};var _0x412330;var _0x499e2a;return db[_0xea86('0x2d')][_0xea86('0x58')]({'where':{'id':_0x3c79cf[_0xea86('0x56')]['id']}})[_0xea86('0x26')](handleEntityNotFound(_0x553d20,null))[_0xea86('0x26')](function(_0x16179){if(_0x16179){_0x412330=_0x16179;_0x3c4702[_0xea86('0x36')]=_[_0xea86('0x49')](db['Team']['rawAttributes']);_0x3c4702[_0xea86('0x33')]=_['keys'](_0x3c79cf[_0xea86('0x33')]);_0x3c4702[_0xea86('0x34')]=_['intersection'](_0x3c4702[_0xea86('0x36')],_0x3c4702[_0xea86('0x33')]);_0x123227[_0xea86('0x37')]=_['intersection'](_0x3c4702['model'],qs[_0xea86('0x38')](_0x3c79cf['query'][_0xea86('0x38')]));_0x123227[_0xea86('0x37')]=_0x123227[_0xea86('0x37')]['length']?_0x123227[_0xea86('0x37')]:_0x3c4702['model'];_0x123227[_0xea86('0x3b')]=qs[_0xea86('0x3c')](_0x3c79cf['query'][_0xea86('0x3c')]);_0x123227['where']=qs[_0xea86('0x34')](_[_0xea86('0x5b')](_0x3c79cf[_0xea86('0x33')],_0x3c4702['filters']));if(_0x3c79cf['query'][_0xea86('0x3e')]){_0x123227['where']=_['merge'](_0x123227['where'],{'$or':_['map'](_0x123227[_0xea86('0x37')],function(_0x373e5f){var _0x521bef={};_0x521bef[_0x373e5f]={'$like':'%'+_0x3c79cf[_0xea86('0x33')]['filter']+'%'};return _0x521bef;})});}_0x123227=_['merge']({},_0x123227,_0x3c79cf[_0xea86('0x41')]);return _0x412330[_0xea86('0x62')](_0x123227);}})['then'](function(_0x404d33){if(_0x404d33){_0x499e2a=_0x404d33[_0xea86('0x39')];if(!_0x3c79cf[_0xea86('0x33')][_0xea86('0x3a')]('nolimit')){_0x123227[_0xea86('0x23')]=qs[_0xea86('0x23')](_0x3c79cf[_0xea86('0x33')][_0xea86('0x23')]);_0x123227[_0xea86('0x21')]=qs['offset'](_0x3c79cf[_0xea86('0x33')][_0xea86('0x21')]);}return _0x412330[_0xea86('0x62')](_0x123227);}})[_0xea86('0x26')](function(_0x266c45){if(_0x266c45){return _0x266c45?{'count':_0x499e2a,'rows':_0x266c45}:null;}})[_0xea86('0x26')](respondWithResult(_0x553d20,null))['catch'](handleError(_0x553d20,null));};exports[_0xea86('0x63')]=function(_0x3a7adc,_0x4162d0,_0x215533){var _0x4eb111=_0x3a7adc['body'][_0xea86('0x64')];return db[_0xea86('0x65')][_0xea86('0x45')]({'where':{'id':_0x4eb111},'attributes':['id'],'include':[{'model':db[_0xea86('0x5d')],'as':_0xea86('0x66'),'attributes':['id',_0xea86('0x2b'),_0xea86('0x67'),_0xea86('0x68'),'interface'],'raw':!![]}]})['then'](function(_0x386801){if(_0x386801){var _0x4fa53a=_[_0xea86('0x69')](_0x386801,function(_0x10e06e){var _0xa9158=_0x10e06e[_0xea86('0x4f')]({'plain':!![]});return _0xa9158['Agents'];});return db[_0xea86('0x2d')]['find']({'where':{'id':_0x3a7adc[_0xea86('0x56')]['id']}})[_0xea86('0x26')](function(_0x3a6f12){return db['sequelize'][_0xea86('0x6a')](function(_0x517d80){return _0x3a6f12['addTeams'](_0x4eb111,{'transaction':_0x517d80})[_0xea86('0x26')](function(){return BPromise[_0xea86('0x6b')](_0x4fa53a,function(_0x18b8cd){return db[_0xea86('0x59')][_0xea86('0x6c')]({'where':{'UserId':_0x18b8cd['id'],'FaxQueueId':_0x3a7adc[_0xea86('0x56')]['id']},'transaction':_0x517d80});});})[_0xea86('0x26')](function(){_0x4fa53a['forEach'](function(_0xcde859){socket[_0xea86('0x6d')]('userFaxQueue:save',{'UserId':_0xcde859['id'],'FaxQueueId':_0x3a6f12['id']});});});});});}})[_0xea86('0x26')](respondWithStatusCode(_0x4162d0,null))[_0xea86('0x47')](handleError(_0x4162d0,null));};exports[_0xea86('0x6e')]=function(_0x5340bb,_0x267f3b,_0xc0a8ef){return db[_0xea86('0x65')][_0xea86('0x45')]({'where':{'id':_0x5340bb['query'][_0xea86('0x64')]},'attributes':['id'],'include':[{'model':db[_0xea86('0x5d')],'as':_0xea86('0x66'),'attributes':['id'],'raw':!![]}]})[_0xea86('0x26')](handleEntityNotFound(_0x267f3b,null))['then'](function(_0x235e49){var _0x25b9fd=_[_0xea86('0x32')](_0x235e49,'id');var _0x4c7d2e=[];var _0x1aede0=[];var _0x5461f0=squel[_0xea86('0x6f')]();_0x5461f0[_0xea86('0x70')]('tq.TeamId')[_0xea86('0x71')](_0xea86('0x72'),'tq')[_0xea86('0x73')]('user_has_teams','ut',_0xea86('0x74'))['where']('FaxQueueId\x20=\x20?',_0x5340bb['params']['id']);for(var _0x37169e=0x0;_0x37169e<_0x235e49[_0xea86('0x39')];_0x37169e+=0x1){let _0x3ce679=_0x235e49[_0x37169e];for(var _0x58f4a6=0x0;_0x58f4a6<_0x3ce679['Agents'][_0xea86('0x39')];_0x58f4a6+=0x1){let _0xed2b57=_0x3ce679[_0xea86('0x66')][_0x58f4a6];var _0x260d9f=_0x5461f0['clone']();_0x260d9f['where'](_0xea86('0x75'),_0xed2b57['id']);_0x1aede0[_0xea86('0x76')](db['sequelize'][_0xea86('0x33')](_0x260d9f[_0xea86('0x77')](),{'type':db[_0xea86('0x78')][_0xea86('0x79')][_0xea86('0x7a')]})['then'](function(_0x367824){if(_0x367824[_0xea86('0x39')]===0x1){return _0xed2b57['id'];}else{var _0x27ed0e=_[_0xea86('0x7b')](_[_0xea86('0x32')](_0x367824,_0xea86('0x7c')),function(_0x590491){return _['includes'](_0x25b9fd,_0x590491);});if(_0x27ed0e){return _0xed2b57['id'];}}}));}}return BPromise[_0xea86('0x7d')](_0x1aede0)[_0xea86('0x26')](function(_0x3320e6){_0x4c7d2e=_(_0x4c7d2e)[_0xea86('0x7e')](_0x3320e6)[_0xea86('0x7f')]()['value']();return db['FaxQueue'][_0xea86('0x55')]({'where':{'id':_0x5340bb['params']['id']}})['then'](function(_0x132e39){return db[_0xea86('0x78')][_0xea86('0x6a')](function(_0x725b53){return _0x132e39[_0xea86('0x6e')](_0x5340bb['query'][_0xea86('0x64')],{'transaction':_0x725b53})[_0xea86('0x26')](function(){if(!_['isEmpty'](_0x4c7d2e)){return _0x132e39[_0xea86('0x80')](_0x4c7d2e,{'transaction':_0x725b53});}})['then'](function(){_0x4c7d2e[_0xea86('0x81')](function(_0x54ff8a){socket[_0xea86('0x6d')](_0xea86('0x82'),{'UserId':_0x54ff8a,'FaxQueueId':_0x132e39['id']});});});});});});})[_0xea86('0x26')](respondWithStatusCode(_0x267f3b,null))[_0xea86('0x47')](handleError(_0x267f3b,null));};exports['addAgents']=function(_0x31bb2d,_0x4ca043,_0x59a110){return db[_0xea86('0x2d')][_0xea86('0x55')]({'where':{'id':_0x31bb2d['params']['id']}})[_0xea86('0x26')](handleEntityNotFound(_0x4ca043,null))['then'](function(_0x56b6bf){if(_0x56b6bf){return _0x56b6bf[_0xea86('0x83')](_0x31bb2d[_0xea86('0x4b')][_0xea86('0x64')],_[_0xea86('0x84')](_0x31bb2d[_0xea86('0x4b')],['ids','id'])||{})[_0xea86('0x85')](function(_0x544fe3){for(var _0x1d9fef=0x0;_0x1d9fef<_0x31bb2d[_0xea86('0x4b')][_0xea86('0x64')][_0xea86('0x39')];_0x1d9fef+=0x1){socket[_0xea86('0x6d')](_0xea86('0x86'),{'UserId':Number(_0x31bb2d[_0xea86('0x4b')][_0xea86('0x64')][_0x1d9fef]),'FaxQueueId':Number(_0x31bb2d[_0xea86('0x56')]['id'])});}return _0x544fe3;});}})[_0xea86('0x26')](respondWithResult(_0x4ca043,null))[_0xea86('0x47')](handleError(_0x4ca043,null));};exports[_0xea86('0x80')]=function(_0x137fe1,_0x35dd86,_0xf7945c){return db[_0xea86('0x2d')][_0xea86('0x55')]({'where':{'id':_0x137fe1[_0xea86('0x56')]['id']}})[_0xea86('0x26')](handleEntityNotFound(_0x35dd86,null))[_0xea86('0x26')](function(_0x2d1b70){if(_0x2d1b70){return _0x2d1b70['removeAgents'](_0x137fe1['query'][_0xea86('0x64')])[_0xea86('0x26')](function(){if(_['isArray'](_0x137fe1['query'][_0xea86('0x64')])){for(var _0x1762fe=0x0;_0x1762fe<_0x137fe1[_0xea86('0x33')]['ids'][_0xea86('0x39')];_0x1762fe+=0x1){socket[_0xea86('0x6d')](_0xea86('0x82'),{'UserId':Number(_0x137fe1[_0xea86('0x33')][_0xea86('0x64')][_0x1762fe]),'FaxQueueId':Number(_0x137fe1[_0xea86('0x56')]['id'])});}}else{socket['emit'](_0xea86('0x82'),{'UserId':Number(_0x137fe1[_0xea86('0x33')]['ids']),'FaxQueueId':Number(_0x137fe1[_0xea86('0x56')]['id'])});}});}})[_0xea86('0x26')](respondWithStatusCode(_0x35dd86,null))['catch'](handleError(_0x35dd86,null));};exports[_0xea86('0x87')]=function(_0x14872c,_0x4482fd,_0x949f7f){var _0x515a78={};var _0x1a6820={};var _0x22ca58;var _0x2b485b;return db[_0xea86('0x2d')][_0xea86('0x58')]({'where':{'id':_0x14872c['params']['id']}})[_0xea86('0x26')](handleEntityNotFound(_0x4482fd,null))[_0xea86('0x26')](function(_0x1ace07){if(_0x1ace07){_0x22ca58=_0x1ace07;_0x1a6820['model']=_['keys'](db['User'][_0xea86('0x2e')]);_0x1a6820[_0xea86('0x33')]=_[_0xea86('0x49')](_0x14872c[_0xea86('0x33')]);_0x1a6820['filters']=_[_0xea86('0x35')](_0x1a6820[_0xea86('0x36')],_0x1a6820[_0xea86('0x33')]);_0x515a78[_0xea86('0x37')]=_[_0xea86('0x35')](_0x1a6820[_0xea86('0x36')],qs[_0xea86('0x38')](_0x14872c[_0xea86('0x33')][_0xea86('0x38')]));_0x515a78[_0xea86('0x37')]=_0x515a78[_0xea86('0x37')][_0xea86('0x39')]?_0x515a78[_0xea86('0x37')]:_0x1a6820[_0xea86('0x36')];_0x515a78[_0xea86('0x3b')]=qs['sort'](_0x14872c[_0xea86('0x33')][_0xea86('0x3c')]);_0x515a78['where']=qs[_0xea86('0x34')](_[_0xea86('0x5b')](_0x14872c[_0xea86('0x33')],_0x1a6820[_0xea86('0x34')]));if(_0x14872c[_0xea86('0x33')]['filter']){_0x515a78[_0xea86('0x3d')]=_[_0xea86('0x3f')](_0x515a78[_0xea86('0x3d')],{'$or':_['map'](_0x515a78[_0xea86('0x37')],function(_0x1ee3ed){var _0x3e7b91={};_0x3e7b91[_0x1ee3ed]={'$like':'%'+_0x14872c['query']['filter']+'%'};return _0x3e7b91;})});}_0x515a78=_['merge']({},_0x515a78,_0x14872c[_0xea86('0x41')]);return _0x22ca58[_0xea86('0x87')](_0x515a78);}})[_0xea86('0x26')](function(_0x4f6b0e){if(_0x4f6b0e){_0x2b485b=_0x4f6b0e[_0xea86('0x39')];if(!_0x14872c[_0xea86('0x33')]['hasOwnProperty']('nolimit')){_0x515a78[_0xea86('0x23')]=qs['limit'](_0x14872c[_0xea86('0x33')][_0xea86('0x23')]);_0x515a78[_0xea86('0x21')]=qs[_0xea86('0x21')](_0x14872c[_0xea86('0x33')][_0xea86('0x21')]);}return _0x22ca58[_0xea86('0x87')](_0x515a78);}})[_0xea86('0x26')](function(_0x49ae36){if(_0x49ae36){return _0x49ae36?{'count':_0x2b485b,'rows':_0x49ae36}:null;}})[_0xea86('0x26')](respondWithResult(_0x4482fd,null))[_0xea86('0x47')](handleError(_0x4482fd,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 11d4c00..ea92a3e 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 _0xd3e4=['FaxQueue','save','hook','exports','events','../../mysqldb'];(function(_0x4605dc,_0x3f7ae5){var _0x5d3e81=function(_0x1d0375){while(--_0x1d0375){_0x4605dc['push'](_0x4605dc['shift']());}};_0x5d3e81(++_0x3f7ae5);}(_0xd3e4,0x7c));var _0x4d3e=function(_0x468eba,_0x172609){_0x468eba=_0x468eba-0x0;var _0x5d27d1=_0xd3e4[_0x468eba];return _0x5d27d1;};'use strict';var EventEmitter=require(_0x4d3e('0x0'));var FaxQueue=require(_0x4d3e('0x1'))['db'][_0x4d3e('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4d3e('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x3c5197){return function(_0x270cff,_0x2275bc,_0xeee6ff){FaxQueueEvents['emit'](_0x3c5197+':'+_0x270cff['id'],_0x270cff);FaxQueueEvents['emit'](_0x3c5197,_0x270cff);_0xeee6ff(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0x4d3e('0x4')](e,emitEvent(event));}}module[_0x4d3e('0x5')]=FaxQueueEvents; \ No newline at end of file +var _0xe58d=['exports','FaxQueue','save','update','emit','hasOwnProperty','hook'];(function(_0x39efa7,_0x4cf468){var _0xb44021=function(_0x57eafc){while(--_0x57eafc){_0x39efa7['push'](_0x39efa7['shift']());}};_0xb44021(++_0x4cf468);}(_0xe58d,0x1b3));var _0xde58=function(_0xd8a3c1,_0x5780bd){_0xd8a3c1=_0xd8a3c1-0x0;var _0x28cad0=_0xe58d[_0xd8a3c1];return _0x28cad0;};'use strict';var EventEmitter=require('events');var FaxQueue=require('../../mysqldb')['db'][_0xde58('0x0')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xde58('0x1'),'afterUpdate':_0xde58('0x2'),'afterDestroy':'remove'};function emitEvent(_0x148b14){return function(_0x109978,_0x242925,_0x2f18d4){FaxQueueEvents[_0xde58('0x3')](_0x148b14+':'+_0x109978['id'],_0x109978);FaxQueueEvents[_0xde58('0x3')](_0x148b14,_0x109978);_0x2f18d4(null);};}for(var e in events){if(events[_0xde58('0x4')](e)){var event=events[e];FaxQueue[_0xde58('0x5')](e,emitEvent(event));}}module[_0xde58('0x6')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 9ce0ff9..cbb218d 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 _0x9d2e=['rimraf','../../config/environment','./faxQueue.attributes','define','FaxQueue','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xd63e3a,_0x1bd6eb){var _0x19c178=function(_0x56be0d){while(--_0x56be0d){_0xd63e3a['push'](_0xd63e3a['shift']());}};_0x19c178(++_0x1bd6eb);}(_0x9d2e,0x125));var _0xe9d2=function(_0x4e0174,_0x347ca3){_0x4e0174=_0x4e0174-0x0;var _0x21b5db=_0x9d2e[_0x4e0174];return _0x21b5db;};'use strict';var _=require(_0xe9d2('0x0'));var util=require(_0xe9d2('0x1'));var logger=require(_0xe9d2('0x2'))(_0xe9d2('0x3'));var moment=require(_0xe9d2('0x4'));var BPromise=require(_0xe9d2('0x5'));var rp=require(_0xe9d2('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe9d2('0x7'));var config=require(_0xe9d2('0x8'));var attributes=require(_0xe9d2('0x9'));module['exports']=function(_0x4be4b9,_0x50adf3){return _0x4be4b9[_0xe9d2('0xa')](_0xe9d2('0xb'),attributes,{'tableName':'fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe100=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','define','FaxQueue','fax_queues','util'];(function(_0xa634ad,_0x27959e){var _0x4defef=function(_0x5920d2){while(--_0x5920d2){_0xa634ad['push'](_0xa634ad['shift']());}};_0x4defef(++_0x27959e);}(_0xe100,0x133));var _0x0e10=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe100[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x0e10('0x0'));var logger=require(_0x0e10('0x1'))(_0x0e10('0x2'));var moment=require('moment');var BPromise=require(_0x0e10('0x3'));var rp=require(_0x0e10('0x4'));var fs=require('fs');var path=require(_0x0e10('0x5'));var rimraf=require(_0x0e10('0x6'));var config=require(_0x0e10('0x7'));var attributes=require('./faxQueue.attributes');module['exports']=function(_0x51b264,_0x5cc653){return _0x51b264[_0x0e10('0x8')](_0x0e10('0x9'),attributes,{'tableName':_0x0e10('0xa'),'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 f217c01..1a0cc70 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 _0x3bce=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./faxQueue.socket','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetFaxQueue','FaxQueue','options','raw','where','attributes','limit','include','map','model','find','ShowFaxQueue','lodash','moment'];(function(_0x318410,_0x451962){var _0x2898a3=function(_0x58e572){while(--_0x58e572){_0x318410['push'](_0x318410['shift']());}};_0x2898a3(++_0x451962);}(_0x3bce,0x10f));var _0xe3bc=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x3bce[_0x4b055c];return _0x4b62bb;};'use strict';var _=require(_0xe3bc('0x0'));var util=require('util');var moment=require(_0xe3bc('0x1'));var BPromise=require(_0xe3bc('0x2'));var rs=require(_0xe3bc('0x3'));var fs=require('fs');var Redis=require(_0xe3bc('0x4'));var db=require(_0xe3bc('0x5'))['db'];var utils=require(_0xe3bc('0x6'));var logger=require(_0xe3bc('0x7'))('rpc');var config=require(_0xe3bc('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xe3bc('0x9')][_0xe3bc('0xa')]({'port':0x232a});config['redis']=_[_0xe3bc('0xb')](config[_0xe3bc('0xc')],{'host':_0xe3bc('0xd'),'port':0x18eb});var socket=require(_0xe3bc('0xe'))(new Redis(config[_0xe3bc('0xc')]));require(_0xe3bc('0xf'))['register'](socket);function respondWithRpcPromise(_0x4c0e50,_0x23ff58,_0x260a6c){return new BPromise(function(_0x3dca65,_0x25b5c5){return client['request'](_0x4c0e50,_0x260a6c)[_0xe3bc('0x10')](function(_0x4b07d0){logger[_0xe3bc('0x11')](_0xe3bc('0x12'),_0x23ff58,_0xe3bc('0x13'));logger[_0xe3bc('0x14')](_0xe3bc('0x15'),_0x23ff58,_0xe3bc('0x13'),JSON[_0xe3bc('0x16')](_0x4b07d0));if(_0x4b07d0[_0xe3bc('0x17')]){if(_0x4b07d0[_0xe3bc('0x17')]['code']===0x1f4){logger[_0xe3bc('0x17')](_0xe3bc('0x12'),_0x23ff58,_0x4b07d0[_0xe3bc('0x17')]['message']);return _0x25b5c5(_0x4b07d0['error'][_0xe3bc('0x18')]);}logger[_0xe3bc('0x17')](_0xe3bc('0x12'),_0x23ff58,_0x4b07d0[_0xe3bc('0x17')][_0xe3bc('0x18')]);return _0x3dca65(_0x4b07d0[_0xe3bc('0x17')][_0xe3bc('0x18')]);}else{logger['info'](_0xe3bc('0x12'),_0x23ff58,_0xe3bc('0x13'));_0x3dca65(_0x4b07d0[_0xe3bc('0x19')]['message']);}})[_0xe3bc('0x1a')](function(_0x47bcf0){logger[_0xe3bc('0x17')](_0xe3bc('0x12'),_0x23ff58,_0x47bcf0);_0x25b5c5(_0x47bcf0);});});}exports[_0xe3bc('0x1b')]=function(_0x5ef18d){var _0x1d7926=this;return new Promise(function(_0x4eabbb,_0x404bc0){return db[_0xe3bc('0x1c')]['findAll']({'raw':_0x5ef18d[_0xe3bc('0x1d')]?_0x5ef18d['options'][_0xe3bc('0x1e')]===undefined?!![]:![]:!![],'where':_0x5ef18d[_0xe3bc('0x1d')]?_0x5ef18d[_0xe3bc('0x1d')][_0xe3bc('0x1f')]||null:null,'attributes':_0x5ef18d[_0xe3bc('0x1d')]?_0x5ef18d[_0xe3bc('0x1d')][_0xe3bc('0x20')]||null:null,'limit':_0x5ef18d['options']?_0x5ef18d[_0xe3bc('0x1d')][_0xe3bc('0x21')]||null:null,'include':_0x5ef18d[_0xe3bc('0x1d')]?_0x5ef18d[_0xe3bc('0x1d')][_0xe3bc('0x22')]?_[_0xe3bc('0x23')](_0x5ef18d[_0xe3bc('0x1d')]['include'],function(_0x5016b8){return{'model':db[_0x5016b8['model']],'as':_0x5016b8['as'],'attributes':_0x5016b8[_0xe3bc('0x20')],'include':_0x5016b8[_0xe3bc('0x22')]?_[_0xe3bc('0x23')](_0x5016b8['include'],function(_0x1ea3f4){return{'model':db[_0x1ea3f4[_0xe3bc('0x24')]],'as':_0x1ea3f4['as'],'attributes':_0x1ea3f4[_0xe3bc('0x20')],'include':_0x1ea3f4[_0xe3bc('0x22')]?_[_0xe3bc('0x23')](_0x1ea3f4[_0xe3bc('0x22')],function(_0x20bf1e){return{'model':db[_0x20bf1e[_0xe3bc('0x24')]],'as':_0x20bf1e['as'],'attributes':_0x20bf1e[_0xe3bc('0x20')]};}):[]};}):[]};}):[]:[]})[_0xe3bc('0x10')](function(_0x5078c2){logger['info'](_0xe3bc('0x1b'),_0x5ef18d);logger[_0xe3bc('0x14')](_0xe3bc('0x1b'),_0x5ef18d,JSON[_0xe3bc('0x16')](_0x5078c2));_0x4eabbb(_0x5078c2);})[_0xe3bc('0x1a')](function(_0x37f972){logger[_0xe3bc('0x17')](_0xe3bc('0x1b'),_0x37f972[_0xe3bc('0x18')],_0x5ef18d);_0x404bc0(_0x1d7926[_0xe3bc('0x17')](0x1f4,_0x37f972['message']));});});};exports['ShowFaxQueue']=function(_0x32b025){var _0x5608fe=this;return new Promise(function(_0x3dbf51,_0x10d77d){return db[_0xe3bc('0x1c')][_0xe3bc('0x25')]({'raw':_0x32b025[_0xe3bc('0x1d')]?_0x32b025[_0xe3bc('0x1d')][_0xe3bc('0x1e')]===undefined?!![]:![]:!![],'where':_0x32b025[_0xe3bc('0x1d')]?_0x32b025[_0xe3bc('0x1d')]['where']||null:null,'attributes':_0x32b025[_0xe3bc('0x1d')]?_0x32b025[_0xe3bc('0x1d')][_0xe3bc('0x20')]||null:null,'include':_0x32b025[_0xe3bc('0x1d')]?_0x32b025[_0xe3bc('0x1d')][_0xe3bc('0x22')]?_[_0xe3bc('0x23')](_0x32b025['options'][_0xe3bc('0x22')],function(_0x2df276){return{'model':db[_0x2df276[_0xe3bc('0x24')]],'as':_0x2df276['as'],'attributes':_0x2df276[_0xe3bc('0x20')],'include':_0x2df276[_0xe3bc('0x22')]?_[_0xe3bc('0x23')](_0x2df276['include'],function(_0x205e49){return{'model':db[_0x205e49[_0xe3bc('0x24')]],'as':_0x205e49['as'],'attributes':_0x205e49[_0xe3bc('0x20')],'include':_0x205e49[_0xe3bc('0x22')]?_[_0xe3bc('0x23')](_0x205e49['include'],function(_0x2df9e3){return{'model':db[_0x2df9e3[_0xe3bc('0x24')]],'as':_0x2df9e3['as'],'attributes':_0x2df9e3[_0xe3bc('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x7ab3b3){logger[_0xe3bc('0x11')](_0xe3bc('0x26'),_0x32b025);logger[_0xe3bc('0x14')](_0xe3bc('0x26'),_0x32b025,JSON[_0xe3bc('0x16')](_0x7ab3b3));_0x3dbf51(_0x7ab3b3);})[_0xe3bc('0x1a')](function(_0x2bbdbb){logger[_0xe3bc('0x17')]('ShowFaxQueue',_0x2bbdbb[_0xe3bc('0x18')],_0x32b025);_0x10d77d(_0x5608fe[_0xe3bc('0x17')](0x1f4,_0x2bbdbb[_0xe3bc('0x18')]));});});}; \ No newline at end of file +var _0x10f7=['attributes','limit','include','map','GetFaxQueue','find','model','ShowFaxQueue','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./faxQueue.socket','register','then','info','FaxQueue,\x20%s,\x20%s','debug','FaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','FaxQueue','findAll','options','raw','where'];(function(_0xa624f8,_0x14fdda){var _0x5e011c=function(_0x5bac1d){while(--_0x5bac1d){_0xa624f8['push'](_0xa624f8['shift']());}};_0x5e011c(++_0x14fdda);}(_0x10f7,0x128));var _0x710f=function(_0x1db3bb,_0x15c046){_0x1db3bb=_0x1db3bb-0x0;var _0x5d3b62=_0x10f7[_0x1db3bb];return _0x5d3b62;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x710f('0x0'));var BPromise=require('bluebird');var rs=require(_0x710f('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x710f('0x2'))['db'];var utils=require(_0x710f('0x3'));var logger=require('../../config/logger')(_0x710f('0x4'));var config=require(_0x710f('0x5'));var jayson=require(_0x710f('0x6'));var client=jayson[_0x710f('0x7')]['http']({'port':0x232a});config[_0x710f('0x8')]=_[_0x710f('0x9')](config[_0x710f('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x710f('0xa'))(new Redis(config[_0x710f('0x8')]));require(_0x710f('0xb'))[_0x710f('0xc')](socket);function respondWithRpcPromise(_0x4d99cc,_0x45a27c,_0x58a450){return new BPromise(function(_0x2780f5,_0x5ede33){return client['request'](_0x4d99cc,_0x58a450)[_0x710f('0xd')](function(_0x22e45a){logger[_0x710f('0xe')](_0x710f('0xf'),_0x45a27c,'request\x20sent');logger[_0x710f('0x10')](_0x710f('0x11'),_0x45a27c,_0x710f('0x12'),JSON[_0x710f('0x13')](_0x22e45a));if(_0x22e45a[_0x710f('0x14')]){if(_0x22e45a[_0x710f('0x14')]['code']===0x1f4){logger[_0x710f('0x14')]('FaxQueue,\x20%s,\x20%s',_0x45a27c,_0x22e45a['error'][_0x710f('0x15')]);return _0x5ede33(_0x22e45a['error'][_0x710f('0x15')]);}logger['error'](_0x710f('0xf'),_0x45a27c,_0x22e45a['error'][_0x710f('0x15')]);return _0x2780f5(_0x22e45a[_0x710f('0x14')]['message']);}else{logger['info'](_0x710f('0xf'),_0x45a27c,_0x710f('0x12'));_0x2780f5(_0x22e45a[_0x710f('0x16')][_0x710f('0x15')]);}})['catch'](function(_0x101226){logger[_0x710f('0x14')]('FaxQueue,\x20%s,\x20%s',_0x45a27c,_0x101226);_0x5ede33(_0x101226);});});}exports['GetFaxQueue']=function(_0x1359e4){var _0x55528a=this;return new Promise(function(_0x1875e4,_0x51c386){return db[_0x710f('0x17')][_0x710f('0x18')]({'raw':_0x1359e4[_0x710f('0x19')]?_0x1359e4[_0x710f('0x19')][_0x710f('0x1a')]===undefined?!![]:![]:!![],'where':_0x1359e4['options']?_0x1359e4[_0x710f('0x19')][_0x710f('0x1b')]||null:null,'attributes':_0x1359e4[_0x710f('0x19')]?_0x1359e4[_0x710f('0x19')][_0x710f('0x1c')]||null:null,'limit':_0x1359e4[_0x710f('0x19')]?_0x1359e4[_0x710f('0x19')][_0x710f('0x1d')]||null:null,'include':_0x1359e4['options']?_0x1359e4[_0x710f('0x19')][_0x710f('0x1e')]?_[_0x710f('0x1f')](_0x1359e4[_0x710f('0x19')][_0x710f('0x1e')],function(_0x21211d){return{'model':db[_0x21211d['model']],'as':_0x21211d['as'],'attributes':_0x21211d[_0x710f('0x1c')],'include':_0x21211d[_0x710f('0x1e')]?_[_0x710f('0x1f')](_0x21211d[_0x710f('0x1e')],function(_0x48793e){return{'model':db[_0x48793e['model']],'as':_0x48793e['as'],'attributes':_0x48793e[_0x710f('0x1c')],'include':_0x48793e[_0x710f('0x1e')]?_['map'](_0x48793e[_0x710f('0x1e')],function(_0x4f2e55){return{'model':db[_0x4f2e55['model']],'as':_0x4f2e55['as'],'attributes':_0x4f2e55[_0x710f('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x710f('0xd')](function(_0x5cd06f){logger[_0x710f('0xe')](_0x710f('0x20'),_0x1359e4);logger[_0x710f('0x10')]('GetFaxQueue',_0x1359e4,JSON[_0x710f('0x13')](_0x5cd06f));_0x1875e4(_0x5cd06f);})['catch'](function(_0x15a031){logger[_0x710f('0x14')](_0x710f('0x20'),_0x15a031['message'],_0x1359e4);_0x51c386(_0x55528a[_0x710f('0x14')](0x1f4,_0x15a031['message']));});});};exports['ShowFaxQueue']=function(_0x2875ab){var _0xf7cf5d=this;return new Promise(function(_0x1eeb28,_0x58f497){return db[_0x710f('0x17')][_0x710f('0x21')]({'raw':_0x2875ab[_0x710f('0x19')]?_0x2875ab[_0x710f('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x2875ab[_0x710f('0x19')]?_0x2875ab[_0x710f('0x19')][_0x710f('0x1b')]||null:null,'attributes':_0x2875ab[_0x710f('0x19')]?_0x2875ab[_0x710f('0x19')][_0x710f('0x1c')]||null:null,'include':_0x2875ab[_0x710f('0x19')]?_0x2875ab[_0x710f('0x19')][_0x710f('0x1e')]?_[_0x710f('0x1f')](_0x2875ab[_0x710f('0x19')][_0x710f('0x1e')],function(_0x12b030){return{'model':db[_0x12b030[_0x710f('0x22')]],'as':_0x12b030['as'],'attributes':_0x12b030['attributes'],'include':_0x12b030[_0x710f('0x1e')]?_[_0x710f('0x1f')](_0x12b030['include'],function(_0x17ac21){return{'model':db[_0x17ac21[_0x710f('0x22')]],'as':_0x17ac21['as'],'attributes':_0x17ac21['attributes'],'include':_0x17ac21[_0x710f('0x1e')]?_['map'](_0x17ac21['include'],function(_0xa536fa){return{'model':db[_0xa536fa['model']],'as':_0xa536fa['as'],'attributes':_0xa536fa[_0x710f('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x710f('0xd')](function(_0x32e44d){logger[_0x710f('0xe')](_0x710f('0x23'),_0x2875ab);logger[_0x710f('0x10')]('ShowFaxQueue',_0x2875ab,JSON[_0x710f('0x13')](_0x32e44d));_0x1eeb28(_0x32e44d);})['catch'](function(_0x3a7749){logger[_0x710f('0x14')](_0x710f('0x23'),_0x3a7749['message'],_0x2875ab);_0x58f497(_0xf7cf5d['error'](0x1f4,_0x3a7749['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index a818b9a..66d9f50 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 _0xad9b=['./faxQueue.events','remove','update','emit','removeListener','length'];(function(_0x24579a,_0x59612d){var _0x59dff7=function(_0x47c50f){while(--_0x47c50f){_0x24579a['push'](_0x24579a['shift']());}};_0x59dff7(++_0x59612d);}(_0xad9b,0x10e));var _0xbad9=function(_0xdd56d8,_0x404844){_0xdd56d8=_0xdd56d8-0x0;var _0x5b4efd=_0xad9b[_0xdd56d8];return _0x5b4efd;};'use strict';var FaxQueueEvents=require(_0xbad9('0x0'));var events=['save',_0xbad9('0x1'),_0xbad9('0x2')];function createListener(_0x3f9f81,_0x190e63){return function(_0x45aee3){_0x190e63[_0xbad9('0x3')](_0x3f9f81,_0x45aee3);};}function removeListener(_0x5423d9,_0x5cd9b9){return function(){FaxQueueEvents[_0xbad9('0x4')](_0x5423d9,_0x5cd9b9);};}exports['register']=function(_0xbca672){for(var _0x4a77f1=0x0,_0x4e05fd=events[_0xbad9('0x5')];_0x4a77f1<_0x4e05fd;_0x4a77f1++){var _0x18216f=events[_0x4a77f1];var _0x41895e=createListener('faxQueue:'+_0x18216f,_0xbca672);FaxQueueEvents['on'](_0x18216f,_0x41895e);}}; \ No newline at end of file +var _0x7560=['emit','removeListener','register','faxQueue:','./faxQueue.events','save','remove','update'];(function(_0x1e91eb,_0x5829a3){var _0x2af75a=function(_0x1815d1){while(--_0x1815d1){_0x1e91eb['push'](_0x1e91eb['shift']());}};_0x2af75a(++_0x5829a3);}(_0x7560,0x18c));var _0x0756=function(_0x17772e,_0x3d4d93){_0x17772e=_0x17772e-0x0;var _0x21e766=_0x7560[_0x17772e];return _0x21e766;};'use strict';var FaxQueueEvents=require(_0x0756('0x0'));var events=[_0x0756('0x1'),_0x0756('0x2'),_0x0756('0x3')];function createListener(_0x4e5dd0,_0x47a943){return function(_0x5294af){_0x47a943[_0x0756('0x4')](_0x4e5dd0,_0x5294af);};}function removeListener(_0x3237b9,_0x3c4bea){return function(){FaxQueueEvents[_0x0756('0x5')](_0x3237b9,_0x3c4bea);};}exports[_0x0756('0x6')]=function(_0x20b9e5){for(var _0x43e093=0x0,_0x258449=events['length'];_0x43e093<_0x258449;_0x43e093++){var _0x951a7a=events[_0x43e093];var _0x7a4378=createListener(_0x0756('0x7')+_0x951a7a,_0x20b9e5);FaxQueueEvents['on'](_0x951a7a,_0x7a4378);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 38d9181..51a2ce7 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 _0xaa3f=['getMembers','/:id/teams','getTeams','post','create','addTeams','/:id/users','addAgents','put','update','delete','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','/describe','isAuthenticated','describe','/:id','show'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xaa3f,0xbb));var _0xfaa3=function(_0x2c2e2f,_0x1387a8){_0x2c2e2f=_0x2c2e2f-0x0;var _0x1928fe=_0xaa3f[_0x2c2e2f];return _0x1928fe;};'use strict';var multer=require(_0xfaa3('0x0'));var util=require(_0xfaa3('0x1'));var path=require(_0xfaa3('0x2'));var timeout=require(_0xfaa3('0x3'));var express=require(_0xfaa3('0x4'));var router=express[_0xfaa3('0x5')]();var fs_extra=require(_0xfaa3('0x6'));var auth=require(_0xfaa3('0x7'));var interaction=require(_0xfaa3('0x8'));var config=require('../../config/environment');var controller=require('./faxQueue.controller');router[_0xfaa3('0x9')]('/',auth['isAuthenticated'](),controller[_0xfaa3('0xa')]);router[_0xfaa3('0x9')](_0xfaa3('0xb'),auth[_0xfaa3('0xc')](),controller[_0xfaa3('0xd')]);router[_0xfaa3('0x9')](_0xfaa3('0xe'),auth['isAuthenticated'](),controller[_0xfaa3('0xf')]);router[_0xfaa3('0x9')]('/:id/members',auth['isAuthenticated'](),controller[_0xfaa3('0x10')]);router[_0xfaa3('0x9')](_0xfaa3('0x11'),auth[_0xfaa3('0xc')](),controller[_0xfaa3('0x12')]);router[_0xfaa3('0x9')]('/:id/users',auth[_0xfaa3('0xc')](),controller['getAgents']);router[_0xfaa3('0x13')]('/',auth[_0xfaa3('0xc')](),controller[_0xfaa3('0x14')]);router['post'](_0xfaa3('0x11'),auth['isAuthenticated'](),controller[_0xfaa3('0x15')]);router[_0xfaa3('0x13')](_0xfaa3('0x16'),auth[_0xfaa3('0xc')](),controller[_0xfaa3('0x17')]);router[_0xfaa3('0x18')]('/:id',auth['isAuthenticated'](),controller[_0xfaa3('0x19')]);router[_0xfaa3('0x1a')](_0xfaa3('0xe'),auth[_0xfaa3('0xc')](),controller['destroy']);router['delete']('/:id/teams',auth['isAuthenticated'](),controller['removeTeams']);router[_0xfaa3('0x1a')]('/:id/users',auth[_0xfaa3('0xc')](),controller[_0xfaa3('0x1b')]);module[_0xfaa3('0x1c')]=router; \ No newline at end of file +var _0xa456=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','/describe','describe','/:id/members','getMembers','getTeams','post','create','/:id/teams','/:id/users','addAgents','put','/:id','destroy','delete','removeTeams','exports','multer','util'];(function(_0xf2e3a2,_0x32d0da){var _0x2f2491=function(_0x297660){while(--_0x297660){_0xf2e3a2['push'](_0xf2e3a2['shift']());}};_0x2f2491(++_0x32d0da);}(_0xa456,0x142));var _0x6a45=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0xa456[_0x5f3f88];return _0xd08119;};'use strict';var multer=require(_0x6a45('0x0'));var util=require(_0x6a45('0x1'));var path=require(_0x6a45('0x2'));var timeout=require(_0x6a45('0x3'));var express=require('express');var router=express[_0x6a45('0x4')]();var fs_extra=require(_0x6a45('0x5'));var auth=require(_0x6a45('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6a45('0x7'));var controller=require(_0x6a45('0x8'));router[_0x6a45('0x9')]('/',auth[_0x6a45('0xa')](),controller['index']);router[_0x6a45('0x9')](_0x6a45('0xb'),auth[_0x6a45('0xa')](),controller[_0x6a45('0xc')]);router[_0x6a45('0x9')]('/:id',auth[_0x6a45('0xa')](),controller['show']);router[_0x6a45('0x9')](_0x6a45('0xd'),auth[_0x6a45('0xa')](),controller[_0x6a45('0xe')]);router[_0x6a45('0x9')]('/:id/teams',auth['isAuthenticated'](),controller[_0x6a45('0xf')]);router[_0x6a45('0x9')]('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0x6a45('0x10')]('/',auth[_0x6a45('0xa')](),controller[_0x6a45('0x11')]);router[_0x6a45('0x10')](_0x6a45('0x12'),auth['isAuthenticated'](),controller['addTeams']);router[_0x6a45('0x10')](_0x6a45('0x13'),auth['isAuthenticated'](),controller[_0x6a45('0x14')]);router[_0x6a45('0x15')](_0x6a45('0x16'),auth[_0x6a45('0xa')](),controller['update']);router['delete']('/:id',auth[_0x6a45('0xa')](),controller[_0x6a45('0x17')]);router[_0x6a45('0x18')]('/:id/teams',auth[_0x6a45('0xa')](),controller[_0x6a45('0x19')]);router[_0x6a45('0x18')]('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module[_0x6a45('0x1a')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 27065b9..6c7cfc1 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 _0x57e4=['STRING','moment','sequelize','exports','DATE'];(function(_0x741184,_0x174846){var _0x3fff52=function(_0x537842){while(--_0x537842){_0x741184['push'](_0x741184['shift']());}};_0x3fff52(++_0x174846);}(_0x57e4,0x1eb));var _0x457e=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x57e4[_0xa464c9];return _0x3d73c4;};'use strict';var moment=require(_0x457e('0x0'));var Sequelize=require(_0x457e('0x1'));module[_0x457e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x457e('0x3')]},'leaveAt':{'type':Sequelize[_0x457e('0x3')]},'acceptAt':{'type':Sequelize[_0x457e('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x457e('0x4')]}}; \ No newline at end of file +var _0x808f=['STRING','DATE','sequelize','exports'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x808f,0x1ea));var _0xf808=function(_0x44c18f,_0x143a29){_0x44c18f=_0x44c18f-0x0;var _0x18bd86=_0x808f[_0x44c18f];return _0x18bd86;};'use strict';var moment=require('moment');var Sequelize=require(_0xf808('0x0'));module[_0xf808('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xf808('0x2')]},'joinAt':{'type':Sequelize[_0xf808('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xf808('0x3')]},'exitAt':{'type':Sequelize[_0xf808('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 336448a..0841682 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 _0xde2c=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','set','Content-Range','save','update','destroy','error','name','send','index','map','FaxQueueReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','then','show','find','create','body','params','catch','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xde2c,0x7f));var _0xcde2=function(_0x492af5,_0xd51471){_0x492af5=_0x492af5-0x0;var _0x59f529=_0xde2c[_0x492af5];return _0x59f529;};'use strict';var emlformat=require(_0xcde2('0x0'));var rimraf=require(_0xcde2('0x1'));var zipdir=require(_0xcde2('0x2'));var jsonpatch=require(_0xcde2('0x3'));var rp=require(_0xcde2('0x4'));var moment=require(_0xcde2('0x5'));var BPromise=require(_0xcde2('0x6'));var Mustache=require(_0xcde2('0x7'));var util=require('util');var path=require(_0xcde2('0x8'));var sox=require(_0xcde2('0x9'));var csv=require(_0xcde2('0xa'));var ejs=require(_0xcde2('0xb'));var fs=require('fs');var fs_extra=require(_0xcde2('0xc'));var _=require('lodash');var squel=require(_0xcde2('0xd'));var crypto=require(_0xcde2('0xe'));var jsforce=require(_0xcde2('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xcde2('0x10'));var Papa=require(_0xcde2('0x11'));var Redis=require('ioredis');var authService=require(_0xcde2('0x12'));var qs=require(_0xcde2('0x13'));var as=require(_0xcde2('0x14'));var hardwareService=require(_0xcde2('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xcde2('0x16'));var config=require(_0xcde2('0x17'));var licenseUtil=require(_0xcde2('0x18'));var db=require(_0xcde2('0x19'))['db'];function respondWithStatusCode(_0x932b90,_0x1ea4bb){_0x1ea4bb=_0x1ea4bb||0xcc;return function(_0x599294){if(_0x599294){return _0x932b90[_0xcde2('0x1a')](_0x1ea4bb);}return _0x932b90['status'](_0x1ea4bb)[_0xcde2('0x1b')]();};}function respondWithResult(_0x4f0ac9,_0x4b0e0e){_0x4b0e0e=_0x4b0e0e||0xc8;return function(_0x34e079){if(_0x34e079){return _0x4f0ac9[_0xcde2('0x1c')](_0x4b0e0e)[_0xcde2('0x1d')](_0x34e079);}};}function respondWithFilteredResult(_0x19b54b,_0x11665c){return function(_0x5312c7){if(_0x5312c7){var _0x39b023=typeof _0x11665c['offset']===_0xcde2('0x1e')&&typeof _0x11665c[_0xcde2('0x1f')]===_0xcde2('0x1e');var _0x1f1858=_0x5312c7['count'];var _0x4fd5aa=_0x39b023?0x0:_0x11665c['offset'];var _0x2b4468=_0x39b023?_0x5312c7['count']:_0x11665c[_0xcde2('0x20')]+_0x11665c[_0xcde2('0x1f')];var _0x252372;if(_0x2b4468>=_0x1f1858){_0x2b4468=_0x1f1858;_0x252372=0xc8;}else{_0x252372=0xce;}_0x19b54b['status'](_0x252372);return _0x19b54b[_0xcde2('0x21')](_0xcde2('0x22'),_0x4fd5aa+'-'+_0x2b4468+'/'+_0x1f1858)[_0xcde2('0x1d')](_0x5312c7);}return null;};}function patchUpdates(_0x3c1d7e){return function(_0x43df7a){try{jsonpatch['apply'](_0x43df7a,_0x3c1d7e,!![]);}catch(_0x4bce90){return BPromise['reject'](_0x4bce90);}return _0x43df7a[_0xcde2('0x23')]();};}function saveUpdates(_0x3e5170,_0x2c9562){return function(_0x4063d4){if(_0x4063d4){return _0x4063d4[_0xcde2('0x24')](_0x3e5170)['then'](function(_0x1104b8){return _0x1104b8;});}return null;};}function removeEntity(_0x52368b,_0x280d8c){return function(_0xb2123c){if(_0xb2123c){return _0xb2123c[_0xcde2('0x25')]()['then'](function(){_0x52368b['status'](0xcc)[_0xcde2('0x1b')]();});}};}function handleEntityNotFound(_0x207a12,_0x3e8aaf){return function(_0x217ec9){if(!_0x217ec9){_0x207a12[_0xcde2('0x1a')](0x194);}return _0x217ec9;};}function handleError(_0x5a5b92,_0x2d1d17){_0x2d1d17=_0x2d1d17||0x1f4;return function(_0x45275a){logger[_0xcde2('0x26')](_0x45275a['stack']);if(_0x45275a[_0xcde2('0x27')]){delete _0x45275a[_0xcde2('0x27')];}_0x5a5b92[_0xcde2('0x1c')](_0x2d1d17)[_0xcde2('0x28')](_0x45275a);};}exports[_0xcde2('0x29')]=function(_0x5b2b7,_0x40b12c){var _0x3e492f={},_0x5bf1e6={},_0x3c3c01={'count':0x0,'rows':[]};var _0x4a0826=_[_0xcde2('0x2a')](db[_0xcde2('0x2b')][_0xcde2('0x2c')],function(_0x49cb58){return{'name':_0x49cb58[_0xcde2('0x2d')],'type':_0x49cb58[_0xcde2('0x2e')]['key']};});_0x5bf1e6[_0xcde2('0x2f')]=_[_0xcde2('0x2a')](_0x4a0826,_0xcde2('0x27'));_0x5bf1e6[_0xcde2('0x30')]=_[_0xcde2('0x31')](_0x5b2b7[_0xcde2('0x30')]);_0x5bf1e6[_0xcde2('0x32')]=_[_0xcde2('0x33')](_0x5bf1e6['model'],_0x5bf1e6[_0xcde2('0x30')]);_0x3e492f[_0xcde2('0x34')]=_[_0xcde2('0x33')](_0x5bf1e6[_0xcde2('0x2f')],qs['fields'](_0x5b2b7[_0xcde2('0x30')][_0xcde2('0x35')]));_0x3e492f[_0xcde2('0x34')]=_0x3e492f[_0xcde2('0x34')]['length']?_0x3e492f[_0xcde2('0x34')]:_0x5bf1e6[_0xcde2('0x2f')];if(!_0x5b2b7[_0xcde2('0x30')][_0xcde2('0x36')]('nolimit')){_0x3e492f[_0xcde2('0x1f')]=qs[_0xcde2('0x1f')](_0x5b2b7[_0xcde2('0x30')][_0xcde2('0x1f')]);_0x3e492f[_0xcde2('0x20')]=qs['offset'](_0x5b2b7[_0xcde2('0x30')][_0xcde2('0x20')]);}_0x3e492f[_0xcde2('0x37')]=qs[_0xcde2('0x38')](_0x5b2b7['query']['sort']);_0x3e492f[_0xcde2('0x39')]=qs[_0xcde2('0x32')](_[_0xcde2('0x3a')](_0x5b2b7[_0xcde2('0x30')],_0x5bf1e6[_0xcde2('0x32')]),_0x4a0826);if(_0x5b2b7[_0xcde2('0x30')][_0xcde2('0x3b')]){_0x3e492f[_0xcde2('0x39')]=_[_0xcde2('0x3c')](_0x3e492f['where'],{'$or':_[_0xcde2('0x2a')](_0x4a0826,function(_0x766279){if(_0x766279[_0xcde2('0x2e')]!==_0xcde2('0x3d')){var _0x2a73df={};_0x2a73df[_0x766279['name']]={'$like':'%'+_0x5b2b7['query'][_0xcde2('0x3b')]+'%'};return _0x2a73df;}})});}_0x3e492f=_[_0xcde2('0x3c')]({},_0x3e492f,_0x5b2b7[_0xcde2('0x3e')]);var _0x383899={'where':_0x3e492f[_0xcde2('0x39')]};return db[_0xcde2('0x2b')]['count'](_0x383899)['then'](function(_0x5160c2){_0x3c3c01[_0xcde2('0x3f')]=_0x5160c2;if(_0x5b2b7[_0xcde2('0x30')][_0xcde2('0x40')]){_0x3e492f[_0xcde2('0x41')]=[{'all':!![]}];}return db[_0xcde2('0x2b')][_0xcde2('0x42')](_0x3e492f);})[_0xcde2('0x43')](function(_0x49b862){_0x3c3c01['rows']=_0x49b862;return _0x3c3c01;})[_0xcde2('0x43')](respondWithFilteredResult(_0x40b12c,_0x3e492f))['catch'](handleError(_0x40b12c,null));};exports[_0xcde2('0x44')]=function(_0x4fc7bf,_0x1126b2){var _0x3239a0={'raw':!![],'where':{'id':_0x4fc7bf['params']['id']}},_0x2cf372={};_0x2cf372[_0xcde2('0x2f')]=_['keys'](db[_0xcde2('0x2b')][_0xcde2('0x2c')]);_0x2cf372[_0xcde2('0x30')]=_[_0xcde2('0x31')](_0x4fc7bf[_0xcde2('0x30')]);_0x2cf372[_0xcde2('0x32')]=_['intersection'](_0x2cf372['model'],_0x2cf372[_0xcde2('0x30')]);_0x3239a0['attributes']=_['intersection'](_0x2cf372[_0xcde2('0x2f')],qs['fields'](_0x4fc7bf[_0xcde2('0x30')][_0xcde2('0x35')]));_0x3239a0['attributes']=_0x3239a0[_0xcde2('0x34')]['length']?_0x3239a0['attributes']:_0x2cf372[_0xcde2('0x2f')];if(_0x4fc7bf[_0xcde2('0x30')]['includeAll']){_0x3239a0[_0xcde2('0x41')]=[{'all':!![]}];}_0x3239a0=_['merge']({},_0x3239a0,_0x4fc7bf[_0xcde2('0x3e')]);return db[_0xcde2('0x2b')][_0xcde2('0x45')](_0x3239a0)[_0xcde2('0x43')](handleEntityNotFound(_0x1126b2,null))[_0xcde2('0x43')](respondWithResult(_0x1126b2,null))['catch'](handleError(_0x1126b2,null));};exports[_0xcde2('0x46')]=function(_0x3e4fc0,_0x40d14b){return db[_0xcde2('0x2b')]['create'](_0x3e4fc0['body'],{})[_0xcde2('0x43')](respondWithResult(_0x40d14b,0xc9))['catch'](handleError(_0x40d14b,null));};exports[_0xcde2('0x24')]=function(_0x3e9e79,_0x381bd4){if(_0x3e9e79[_0xcde2('0x47')]['id']){delete _0x3e9e79[_0xcde2('0x47')]['id'];}return db[_0xcde2('0x2b')]['find']({'where':{'id':_0x3e9e79[_0xcde2('0x48')]['id']}})['then'](handleEntityNotFound(_0x381bd4,null))[_0xcde2('0x43')](saveUpdates(_0x3e9e79['body'],null))[_0xcde2('0x43')](respondWithResult(_0x381bd4,null))[_0xcde2('0x49')](handleError(_0x381bd4,null));};exports[_0xcde2('0x25')]=function(_0x16cddb,_0x446cf0){return db[_0xcde2('0x2b')]['find']({'where':{'id':_0x16cddb[_0xcde2('0x48')]['id']}})['then'](handleEntityNotFound(_0x446cf0,null))[_0xcde2('0x43')](removeEntity(_0x446cf0,null))[_0xcde2('0x49')](handleError(_0x446cf0,null));};exports[_0xcde2('0x4a')]=function(_0x428a55,_0x1e1c9e){return db[_0xcde2('0x2b')][_0xcde2('0x4a')]()[_0xcde2('0x43')](respondWithResult(_0x1e1c9e,null))[_0xcde2('0x49')](handleError(_0x1e1c9e,null));}; \ No newline at end of file +var _0x32c0=['offset','undefined','limit','count','set','Content-Range','update','then','destroy','error','stack','name','send','index','map','FaxQueueReport','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','show','rawAttributes','options','catch','create','body','find','params','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','desk.js','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json'];(function(_0x38832e,_0x2cc705){var _0x2be939=function(_0x4eeb26){while(--_0x4eeb26){_0x38832e['push'](_0x38832e['shift']());}};_0x2be939(++_0x2cc705);}(_0x32c0,0x1f3));var _0x032c=function(_0x2421f5,_0x4a1562){_0x2421f5=_0x2421f5-0x0;var _0x17924d=_0x32c0[_0x2421f5];return _0x17924d;};'use strict';var emlformat=require(_0x032c('0x0'));var rimraf=require(_0x032c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x032c('0x2'));var rp=require(_0x032c('0x3'));var moment=require('moment');var BPromise=require(_0x032c('0x4'));var Mustache=require(_0x032c('0x5'));var util=require(_0x032c('0x6'));var path=require(_0x032c('0x7'));var sox=require('sox');var csv=require(_0x032c('0x8'));var ejs=require(_0x032c('0x9'));var fs=require('fs');var fs_extra=require(_0x032c('0xa'));var _=require(_0x032c('0xb'));var squel=require('squel');var crypto=require(_0x032c('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x032c('0xd'));var toCsv=require(_0x032c('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x032c('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x032c('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x032c('0x10'));var logger=require(_0x032c('0x11'))(_0x032c('0x12'));var utils=require(_0x032c('0x13'));var config=require(_0x032c('0x14'));var licenseUtil=require(_0x032c('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x25af77,_0xc88e78){_0xc88e78=_0xc88e78||0xcc;return function(_0x364605){if(_0x364605){return _0x25af77[_0x032c('0x16')](_0xc88e78);}return _0x25af77['status'](_0xc88e78)[_0x032c('0x17')]();};}function respondWithResult(_0x2650d6,_0x1ec9d8){_0x1ec9d8=_0x1ec9d8||0xc8;return function(_0x216984){if(_0x216984){return _0x2650d6[_0x032c('0x18')](_0x1ec9d8)[_0x032c('0x19')](_0x216984);}};}function respondWithFilteredResult(_0x51266f,_0xb678d5){return function(_0x15ddb8){if(_0x15ddb8){var _0x3ebda8=typeof _0xb678d5[_0x032c('0x1a')]===_0x032c('0x1b')&&typeof _0xb678d5[_0x032c('0x1c')]==='undefined';var _0x1444bb=_0x15ddb8[_0x032c('0x1d')];var _0x4435ad=_0x3ebda8?0x0:_0xb678d5[_0x032c('0x1a')];var _0x2b2693=_0x3ebda8?_0x15ddb8[_0x032c('0x1d')]:_0xb678d5[_0x032c('0x1a')]+_0xb678d5[_0x032c('0x1c')];var _0x3a6f71;if(_0x2b2693>=_0x1444bb){_0x2b2693=_0x1444bb;_0x3a6f71=0xc8;}else{_0x3a6f71=0xce;}_0x51266f[_0x032c('0x18')](_0x3a6f71);return _0x51266f[_0x032c('0x1e')](_0x032c('0x1f'),_0x4435ad+'-'+_0x2b2693+'/'+_0x1444bb)[_0x032c('0x19')](_0x15ddb8);}return null;};}function patchUpdates(_0x515409){return function(_0x8a8f30){try{jsonpatch['apply'](_0x8a8f30,_0x515409,!![]);}catch(_0x5341e6){return BPromise['reject'](_0x5341e6);}return _0x8a8f30['save']();};}function saveUpdates(_0x2a24f7,_0x4c0c4b){return function(_0x2ce758){if(_0x2ce758){return _0x2ce758[_0x032c('0x20')](_0x2a24f7)[_0x032c('0x21')](function(_0x51ad8c){return _0x51ad8c;});}return null;};}function removeEntity(_0x135612,_0x16d40f){return function(_0x28ae24){if(_0x28ae24){return _0x28ae24[_0x032c('0x22')]()[_0x032c('0x21')](function(){_0x135612[_0x032c('0x18')](0xcc)[_0x032c('0x17')]();});}};}function handleEntityNotFound(_0x58894b,_0x16ed08){return function(_0x1a0881){if(!_0x1a0881){_0x58894b[_0x032c('0x16')](0x194);}return _0x1a0881;};}function handleError(_0x56d20d,_0x1350d1){_0x1350d1=_0x1350d1||0x1f4;return function(_0x19ed06){logger[_0x032c('0x23')](_0x19ed06[_0x032c('0x24')]);if(_0x19ed06['name']){delete _0x19ed06[_0x032c('0x25')];}_0x56d20d[_0x032c('0x18')](_0x1350d1)[_0x032c('0x26')](_0x19ed06);};}exports[_0x032c('0x27')]=function(_0x51d679,_0x119d8f){var _0x1de595={},_0x5cdd90={},_0x659bbf={'count':0x0,'rows':[]};var _0x306935=_[_0x032c('0x28')](db[_0x032c('0x29')]['rawAttributes'],function(_0x50a3f8){return{'name':_0x50a3f8[_0x032c('0x2a')],'type':_0x50a3f8['type'][_0x032c('0x2b')]};});_0x5cdd90[_0x032c('0x2c')]=_['map'](_0x306935,_0x032c('0x25'));_0x5cdd90[_0x032c('0x2d')]=_[_0x032c('0x2e')](_0x51d679[_0x032c('0x2d')]);_0x5cdd90['filters']=_[_0x032c('0x2f')](_0x5cdd90[_0x032c('0x2c')],_0x5cdd90['query']);_0x1de595[_0x032c('0x30')]=_[_0x032c('0x2f')](_0x5cdd90[_0x032c('0x2c')],qs[_0x032c('0x31')](_0x51d679[_0x032c('0x2d')]['fields']));_0x1de595[_0x032c('0x30')]=_0x1de595['attributes'][_0x032c('0x32')]?_0x1de595['attributes']:_0x5cdd90[_0x032c('0x2c')];if(!_0x51d679[_0x032c('0x2d')][_0x032c('0x33')](_0x032c('0x34'))){_0x1de595[_0x032c('0x1c')]=qs[_0x032c('0x1c')](_0x51d679['query'][_0x032c('0x1c')]);_0x1de595[_0x032c('0x1a')]=qs['offset'](_0x51d679[_0x032c('0x2d')][_0x032c('0x1a')]);}_0x1de595[_0x032c('0x35')]=qs['sort'](_0x51d679[_0x032c('0x2d')][_0x032c('0x36')]);_0x1de595[_0x032c('0x37')]=qs[_0x032c('0x38')](_[_0x032c('0x39')](_0x51d679[_0x032c('0x2d')],_0x5cdd90[_0x032c('0x38')]),_0x306935);if(_0x51d679['query'][_0x032c('0x3a')]){_0x1de595[_0x032c('0x37')]=_[_0x032c('0x3b')](_0x1de595[_0x032c('0x37')],{'$or':_[_0x032c('0x28')](_0x306935,function(_0xf27830){if(_0xf27830[_0x032c('0x3c')]!==_0x032c('0x3d')){var _0x4bba77={};_0x4bba77[_0xf27830[_0x032c('0x25')]]={'$like':'%'+_0x51d679['query'][_0x032c('0x3a')]+'%'};return _0x4bba77;}})});}_0x1de595=_['merge']({},_0x1de595,_0x51d679['options']);var _0x238291={'where':_0x1de595[_0x032c('0x37')]};return db['FaxQueueReport']['count'](_0x238291)[_0x032c('0x21')](function(_0x4c6c2b){_0x659bbf['count']=_0x4c6c2b;if(_0x51d679[_0x032c('0x2d')][_0x032c('0x3e')]){_0x1de595[_0x032c('0x3f')]=[{'all':!![]}];}return db[_0x032c('0x29')][_0x032c('0x40')](_0x1de595);})[_0x032c('0x21')](function(_0x49b83a){_0x659bbf[_0x032c('0x41')]=_0x49b83a;return _0x659bbf;})['then'](respondWithFilteredResult(_0x119d8f,_0x1de595))['catch'](handleError(_0x119d8f,null));};exports[_0x032c('0x42')]=function(_0x15ebeb,_0x2035d5){var _0x235ad6={'raw':!![],'where':{'id':_0x15ebeb['params']['id']}},_0x47360a={};_0x47360a['model']=_[_0x032c('0x2e')](db['FaxQueueReport'][_0x032c('0x43')]);_0x47360a[_0x032c('0x2d')]=_[_0x032c('0x2e')](_0x15ebeb[_0x032c('0x2d')]);_0x47360a[_0x032c('0x38')]=_[_0x032c('0x2f')](_0x47360a[_0x032c('0x2c')],_0x47360a[_0x032c('0x2d')]);_0x235ad6[_0x032c('0x30')]=_['intersection'](_0x47360a[_0x032c('0x2c')],qs['fields'](_0x15ebeb['query'][_0x032c('0x31')]));_0x235ad6[_0x032c('0x30')]=_0x235ad6[_0x032c('0x30')][_0x032c('0x32')]?_0x235ad6[_0x032c('0x30')]:_0x47360a['model'];if(_0x15ebeb['query']['includeAll']){_0x235ad6[_0x032c('0x3f')]=[{'all':!![]}];}_0x235ad6=_['merge']({},_0x235ad6,_0x15ebeb[_0x032c('0x44')]);return db[_0x032c('0x29')]['find'](_0x235ad6)[_0x032c('0x21')](handleEntityNotFound(_0x2035d5,null))[_0x032c('0x21')](respondWithResult(_0x2035d5,null))[_0x032c('0x45')](handleError(_0x2035d5,null));};exports[_0x032c('0x46')]=function(_0x3a877a,_0x26e988){return db[_0x032c('0x29')][_0x032c('0x46')](_0x3a877a[_0x032c('0x47')],{})['then'](respondWithResult(_0x26e988,0xc9))[_0x032c('0x45')](handleError(_0x26e988,null));};exports['update']=function(_0x367638,_0x13f1a7){if(_0x367638[_0x032c('0x47')]['id']){delete _0x367638[_0x032c('0x47')]['id'];}return db[_0x032c('0x29')][_0x032c('0x48')]({'where':{'id':_0x367638[_0x032c('0x49')]['id']}})[_0x032c('0x21')](handleEntityNotFound(_0x13f1a7,null))[_0x032c('0x21')](saveUpdates(_0x367638['body'],null))[_0x032c('0x21')](respondWithResult(_0x13f1a7,null))['catch'](handleError(_0x13f1a7,null));};exports[_0x032c('0x22')]=function(_0x2f1032,_0x4e8fd6){return db[_0x032c('0x29')][_0x032c('0x48')]({'where':{'id':_0x2f1032['params']['id']}})[_0x032c('0x21')](handleEntityNotFound(_0x4e8fd6,null))[_0x032c('0x21')](removeEntity(_0x4e8fd6,null))[_0x032c('0x45')](handleError(_0x4e8fd6,null));};exports['describe']=function(_0x43efaa,_0xf7d545){return db[_0x032c('0x29')][_0x032c('0x4a')]()[_0x032c('0x21')](respondWithResult(_0xf7d545,null))[_0x032c('0x45')](handleError(_0xf7d545,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index c21db0f..b944209 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 _0x5fab=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','FaxQueueReport','report_fax_queue','uniqueid','lodash','util','api'];(function(_0x84dbd4,_0x590b54){var _0x3b079e=function(_0x5384e6){while(--_0x5384e6){_0x84dbd4['push'](_0x84dbd4['shift']());}};_0x3b079e(++_0x590b54);}(_0x5fab,0x177));var _0xb5fa=function(_0x5137c9,_0x3d193f){_0x5137c9=_0x5137c9-0x0;var _0x548778=_0x5fab[_0x5137c9];return _0x548778;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var logger=require('../../config/logger')(_0xb5fa('0x2'));var moment=require(_0xb5fa('0x3'));var BPromise=require(_0xb5fa('0x4'));var rp=require(_0xb5fa('0x5'));var fs=require('fs');var path=require(_0xb5fa('0x6'));var rimraf=require(_0xb5fa('0x7'));var config=require(_0xb5fa('0x8'));var attributes=require(_0xb5fa('0x9'));module[_0xb5fa('0xa')]=function(_0x44df89,_0x4a0249){return _0x44df89['define'](_0xb5fa('0xb'),attributes,{'tableName':_0xb5fa('0xc'),'paranoid':![],'indexes':[{'name':_0xb5fa('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xf494=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','uniqueid','lodash'];(function(_0x239a21,_0x54bdde){var _0x3960a8=function(_0x49ecb2){while(--_0x49ecb2){_0x239a21['push'](_0x239a21['shift']());}};_0x3960a8(++_0x54bdde);}(_0xf494,0x1c6));var _0x4f49=function(_0x43c63a,_0x120cf1){_0x43c63a=_0x43c63a-0x0;var _0x1749f7=_0xf494[_0x43c63a];return _0x1749f7;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var logger=require(_0x4f49('0x2'))('api');var moment=require(_0x4f49('0x3'));var BPromise=require(_0x4f49('0x4'));var rp=require(_0x4f49('0x5'));var fs=require('fs');var path=require(_0x4f49('0x6'));var rimraf=require(_0x4f49('0x7'));var config=require(_0x4f49('0x8'));var attributes=require(_0x4f49('0x9'));module[_0x4f49('0xa')]=function(_0xc5e778,_0x413530){return _0xc5e778[_0x4f49('0xb')]('FaxQueueReport',attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0x4f49('0xc'),'fields':[_0x4f49('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 0f6142c..e037c77 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 _0x8e5b=['FaxQueueReport','body','catch','UpdateFaxQueueReport','update','options','raw','where','attributes','limit','then','lodash','moment','../../mysqldb','../../config/logger','client','request','info','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FaxQueueReport,\x20%s,\x20%s','result','CreateFaxQueueReport'];(function(_0x57a1f7,_0xd3f42b){var _0x38a9c2=function(_0x193383){while(--_0x193383){_0x57a1f7['push'](_0x57a1f7['shift']());}};_0x38a9c2(++_0xd3f42b);}(_0x8e5b,0x193));var _0xb8e5=function(_0x399d11,_0xab24f1){_0x399d11=_0x399d11-0x0;var _0xa03faa=_0x8e5b[_0x399d11];return _0xa03faa;};'use strict';var _=require(_0xb8e5('0x0'));var util=require('util');var moment=require(_0xb8e5('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb8e5('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xb8e5('0x3'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb8e5('0x4')]['http']({'port':0x232a});function respondWithRpcPromise(_0x46bf0d,_0x4230a2,_0x4e0b14){return new BPromise(function(_0x53df13,_0xec6cc5){return client[_0xb8e5('0x5')](_0x46bf0d,_0x4e0b14)['then'](function(_0x52b00c){logger[_0xb8e5('0x6')]('FaxQueueReport,\x20%s,\x20%s',_0x4230a2,_0xb8e5('0x7'));logger[_0xb8e5('0x8')](_0xb8e5('0x9'),_0x4230a2,_0xb8e5('0x7'),JSON[_0xb8e5('0xa')](_0x52b00c));if(_0x52b00c['error']){if(_0x52b00c[_0xb8e5('0xb')][_0xb8e5('0xc')]===0x1f4){logger[_0xb8e5('0xb')]('FaxQueueReport,\x20%s,\x20%s',_0x4230a2,_0x52b00c['error'][_0xb8e5('0xd')]);return _0xec6cc5(_0x52b00c['error'][_0xb8e5('0xd')]);}logger['error'](_0xb8e5('0xe'),_0x4230a2,_0x52b00c[_0xb8e5('0xb')][_0xb8e5('0xd')]);return _0x53df13(_0x52b00c[_0xb8e5('0xb')]['message']);}else{logger[_0xb8e5('0x6')](_0xb8e5('0xe'),_0x4230a2,_0xb8e5('0x7'));_0x53df13(_0x52b00c[_0xb8e5('0xf')]['message']);}})['catch'](function(_0x198f9a){logger[_0xb8e5('0xb')](_0xb8e5('0xe'),_0x4230a2,_0x198f9a);_0xec6cc5(_0x198f9a);});});}exports[_0xb8e5('0x10')]=function(_0x441ab2){var _0x32d945=this;return new Promise(function(_0x9bf260,_0x248cb9){return db[_0xb8e5('0x11')]['create'](_0x441ab2[_0xb8e5('0x12')],{'raw':_0x441ab2['options']?_0x441ab2['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x2d9135){logger[_0xb8e5('0x6')]('CreateFaxQueueReport',_0x441ab2);logger[_0xb8e5('0x8')]('CreateFaxQueueReport',_0x441ab2,JSON[_0xb8e5('0xa')](_0x2d9135));_0x9bf260(_0x2d9135);})[_0xb8e5('0x13')](function(_0x9b36f4){logger['error'](_0xb8e5('0x10'),_0x9b36f4[_0xb8e5('0xd')],_0x441ab2);_0x248cb9(_0x32d945['error'](0x1f4,_0x9b36f4[_0xb8e5('0xd')]));});});};exports[_0xb8e5('0x14')]=function(_0x5f55b2){var _0x446d31=this;return new Promise(function(_0xc08511,_0x4432d9){return db[_0xb8e5('0x11')][_0xb8e5('0x15')](_0x5f55b2[_0xb8e5('0x12')],{'raw':_0x5f55b2['options']?_0x5f55b2[_0xb8e5('0x16')][_0xb8e5('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5f55b2[_0xb8e5('0x16')]?_0x5f55b2['options'][_0xb8e5('0x18')]||null:null,'attributes':_0x5f55b2['options']?_0x5f55b2['options'][_0xb8e5('0x19')]||null:null,'limit':_0x5f55b2[_0xb8e5('0x16')]?_0x5f55b2[_0xb8e5('0x16')][_0xb8e5('0x1a')]||null:null})[_0xb8e5('0x1b')](function(_0x479665){logger[_0xb8e5('0x6')](_0xb8e5('0x14'),_0x5f55b2);logger[_0xb8e5('0x8')](_0xb8e5('0x14'),_0x5f55b2,JSON[_0xb8e5('0xa')](_0x479665));_0xc08511(_0x479665);})['catch'](function(_0x1ed575){logger[_0xb8e5('0xb')](_0xb8e5('0x14'),_0x1ed575[_0xb8e5('0xd')],_0x5f55b2);_0x4432d9(_0x446d31[_0xb8e5('0xb')](0x1f4,_0x1ed575[_0xb8e5('0xd')]));});});}; \ No newline at end of file +var _0xd3fd=['raw','where','attributes','limit','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateFaxQueueReport','FaxQueueReport','create','body','options','then','stringify','UpdateFaxQueueReport','update'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xd3fd,0x158));var _0xdd3f=function(_0x2ba2a2,_0x5e91fe){_0x2ba2a2=_0x2ba2a2-0x0;var _0x45921a=_0xd3fd[_0x2ba2a2];return _0x45921a;};'use strict';var _=require(_0xdd3f('0x0'));var util=require(_0xdd3f('0x1'));var moment=require(_0xdd3f('0x2'));var BPromise=require('bluebird');var rs=require(_0xdd3f('0x3'));var fs=require('fs');var Redis=require(_0xdd3f('0x4'));var db=require(_0xdd3f('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xdd3f('0x6'));var config=require(_0xdd3f('0x7'));var jayson=require(_0xdd3f('0x8'));var client=jayson[_0xdd3f('0x9')][_0xdd3f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2c7f65,_0x24b02c,_0x13b51d){return new BPromise(function(_0x2eacec,_0x1cf23d){return client[_0xdd3f('0xb')](_0x2c7f65,_0x13b51d)['then'](function(_0x1954d8){logger[_0xdd3f('0xc')](_0xdd3f('0xd'),_0x24b02c,_0xdd3f('0xe'));logger[_0xdd3f('0xf')](_0xdd3f('0x10'),_0x24b02c,_0xdd3f('0xe'),JSON['stringify'](_0x1954d8));if(_0x1954d8[_0xdd3f('0x11')]){if(_0x1954d8['error'][_0xdd3f('0x12')]===0x1f4){logger['error']('FaxQueueReport,\x20%s,\x20%s',_0x24b02c,_0x1954d8[_0xdd3f('0x11')][_0xdd3f('0x13')]);return _0x1cf23d(_0x1954d8['error'][_0xdd3f('0x13')]);}logger['error']('FaxQueueReport,\x20%s,\x20%s',_0x24b02c,_0x1954d8[_0xdd3f('0x11')][_0xdd3f('0x13')]);return _0x2eacec(_0x1954d8[_0xdd3f('0x11')][_0xdd3f('0x13')]);}else{logger['info'](_0xdd3f('0xd'),_0x24b02c,'request\x20sent');_0x2eacec(_0x1954d8[_0xdd3f('0x14')][_0xdd3f('0x13')]);}})['catch'](function(_0x183b95){logger['error'](_0xdd3f('0xd'),_0x24b02c,_0x183b95);_0x1cf23d(_0x183b95);});});}exports[_0xdd3f('0x15')]=function(_0x2cc5d5){var _0x5a4c38=this;return new Promise(function(_0x95ce3c,_0x5aea0c){return db[_0xdd3f('0x16')][_0xdd3f('0x17')](_0x2cc5d5[_0xdd3f('0x18')],{'raw':_0x2cc5d5['options']?_0x2cc5d5[_0xdd3f('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xdd3f('0x1a')](function(_0x491619){logger[_0xdd3f('0xc')](_0xdd3f('0x15'),_0x2cc5d5);logger['debug'](_0xdd3f('0x15'),_0x2cc5d5,JSON[_0xdd3f('0x1b')](_0x491619));_0x95ce3c(_0x491619);})['catch'](function(_0x2d822e){logger[_0xdd3f('0x11')]('CreateFaxQueueReport',_0x2d822e[_0xdd3f('0x13')],_0x2cc5d5);_0x5aea0c(_0x5a4c38[_0xdd3f('0x11')](0x1f4,_0x2d822e[_0xdd3f('0x13')]));});});};exports[_0xdd3f('0x1c')]=function(_0x4f9657){var _0x1fd204=this;return new Promise(function(_0x2f388a,_0x5f2c3f){return db[_0xdd3f('0x16')][_0xdd3f('0x1d')](_0x4f9657[_0xdd3f('0x18')],{'raw':_0x4f9657[_0xdd3f('0x19')]?_0x4f9657[_0xdd3f('0x19')][_0xdd3f('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f9657[_0xdd3f('0x19')]?_0x4f9657['options'][_0xdd3f('0x1f')]||null:null,'attributes':_0x4f9657[_0xdd3f('0x19')]?_0x4f9657[_0xdd3f('0x19')][_0xdd3f('0x20')]||null:null,'limit':_0x4f9657['options']?_0x4f9657[_0xdd3f('0x19')][_0xdd3f('0x21')]||null:null})[_0xdd3f('0x1a')](function(_0x1d560c){logger['info'](_0xdd3f('0x1c'),_0x4f9657);logger[_0xdd3f('0xf')](_0xdd3f('0x1c'),_0x4f9657,JSON[_0xdd3f('0x1b')](_0x1d560c));_0x2f388a(_0x1d560c);})['catch'](function(_0x581817){logger['error']('UpdateFaxQueueReport',_0x581817[_0xdd3f('0x13')],_0x4f9657);_0x5f2c3f(_0x1fd204[_0xdd3f('0x11')](0x1f4,_0x581817['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 41cbe8a..33cee2d 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 _0x67e9=['/describe','describe','/:id','show','create','put','delete','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','isAuthenticated','get'];(function(_0x208eef,_0x3f809d){var _0x3adce9=function(_0x2858ed){while(--_0x2858ed){_0x208eef['push'](_0x208eef['shift']());}};_0x3adce9(++_0x3f809d);}(_0x67e9,0xbb));var _0x967e=function(_0x44ca27,_0x81f0da){_0x44ca27=_0x44ca27-0x0;var _0x38bc17=_0x67e9[_0x44ca27];return _0x38bc17;};'use strict';var multer=require(_0x967e('0x0'));var util=require('util');var path=require(_0x967e('0x1'));var timeout=require(_0x967e('0x2'));var express=require('express');var router=express[_0x967e('0x3')]();var fs_extra=require(_0x967e('0x4'));var auth=require(_0x967e('0x5'));var interaction=require(_0x967e('0x6'));var config=require(_0x967e('0x7'));var controller=require(_0x967e('0x8'));router['get']('/',auth[_0x967e('0x9')](),controller['index']);router[_0x967e('0xa')](_0x967e('0xb'),auth[_0x967e('0x9')](),controller[_0x967e('0xc')]);router['get'](_0x967e('0xd'),auth['isAuthenticated'](),controller[_0x967e('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x967e('0xf')]);router[_0x967e('0x10')]('/:id',auth[_0x967e('0x9')](),controller['update']);router[_0x967e('0x11')](_0x967e('0xd'),auth[_0x967e('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x9891=['describe','show','post','create','put','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./faxQueueReport.controller','get','isAuthenticated','index','/describe'];(function(_0x15b309,_0x2fc54c){var _0x3012cc=function(_0x4dd40a){while(--_0x4dd40a){_0x15b309['push'](_0x15b309['shift']());}};_0x3012cc(++_0x2fc54c);}(_0x9891,0x184));var _0x1989=function(_0x2f4c1c,_0x5a3dd4){_0x2f4c1c=_0x2f4c1c-0x0;var _0x25e0f2=_0x9891[_0x2f4c1c];return _0x25e0f2;};'use strict';var multer=require(_0x1989('0x0'));var util=require(_0x1989('0x1'));var path=require('path');var timeout=require(_0x1989('0x2'));var express=require(_0x1989('0x3'));var router=express[_0x1989('0x4')]();var fs_extra=require(_0x1989('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x1989('0x6'));var config=require('../../config/environment');var controller=require(_0x1989('0x7'));router[_0x1989('0x8')]('/',auth[_0x1989('0x9')](),controller[_0x1989('0xa')]);router[_0x1989('0x8')](_0x1989('0xb'),auth[_0x1989('0x9')](),controller[_0x1989('0xc')]);router[_0x1989('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x1989('0xd')]);router[_0x1989('0xe')]('/',auth[_0x1989('0x9')](),controller[_0x1989('0xf')]);router[_0x1989('0x10')]('/:id',auth[_0x1989('0x9')](),controller['update']);router[_0x1989('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x1989('0x12')]);module[_0x1989('0x13')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index f5ef907..2e998af 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 _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x341ed1,_0x3eb708){var _0x32f175=function(_0x49bbe5){while(--_0x49bbe5){_0x341ed1['push'](_0x341ed1['shift']());}};_0x32f175(++_0x3eb708);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x43dc7e,_0x49a390){_0x43dc7e=_0x43dc7e-0x0;var _0x21e12d=_0xf3cd[_0x43dc7e];return _0x21e12d;};'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 _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x11f0c0,_0xfa324a){var _0x287378=function(_0x1fc837){while(--_0x1fc837){_0x11f0c0['push'](_0x11f0c0['shift']());}};_0x287378(++_0xfa324a);}(_0x70e0,0x17b));var _0x070e=function(_0x13e6a0,_0x43f8e9){_0x13e6a0=_0x13e6a0-0x0;var _0x1c7a5a=_0x70e0[_0x13e6a0];return _0x1c7a5a;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index ca035bd..7f33ff5 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 _0x2e19=['json','offset','undefined','count','Content-Range','apply','reject','save','then','end','error','stack','name','send','index','FaxTransferReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','limit','order','sort','where','filter','merge','map','VIRTUAL','options','includeAll','findAll','rows','catch','params','include','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x961bcc,_0x518765){var _0x3663e4=function(_0x1b2c0e){while(--_0x1b2c0e){_0x961bcc['push'](_0x961bcc['shift']());}};_0x3663e4(++_0x518765);}(_0x2e19,0x113));var _0x92e1=function(_0x13c20c,_0x20bc08){_0x13c20c=_0x13c20c-0x0;var _0x4a7577=_0x2e19[_0x13c20c];return _0x4a7577;};'use strict';var emlformat=require(_0x92e1('0x0'));var rimraf=require(_0x92e1('0x1'));var zipdir=require(_0x92e1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x92e1('0x3'));var moment=require(_0x92e1('0x4'));var BPromise=require(_0x92e1('0x5'));var Mustache=require(_0x92e1('0x6'));var util=require(_0x92e1('0x7'));var path=require(_0x92e1('0x8'));var sox=require('sox');var csv=require(_0x92e1('0x9'));var ejs=require(_0x92e1('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x92e1('0xb'));var squel=require(_0x92e1('0xc'));var crypto=require(_0x92e1('0xd'));var jsforce=require(_0x92e1('0xe'));var deskjs=require(_0x92e1('0xf'));var toCsv=require(_0x92e1('0x9'));var querystring=require('querystring');var Papa=require(_0x92e1('0x10'));var Redis=require('ioredis');var authService=require(_0x92e1('0x11'));var qs=require(_0x92e1('0x12'));var as=require(_0x92e1('0x13'));var hardwareService=require(_0x92e1('0x14'));var logger=require(_0x92e1('0x15'))(_0x92e1('0x16'));var utils=require(_0x92e1('0x17'));var config=require(_0x92e1('0x18'));var licenseUtil=require(_0x92e1('0x19'));var db=require(_0x92e1('0x1a'))['db'];function respondWithStatusCode(_0x2ad0b9,_0x5e4935){_0x5e4935=_0x5e4935||0xcc;return function(_0x55a422){if(_0x55a422){return _0x2ad0b9[_0x92e1('0x1b')](_0x5e4935);}return _0x2ad0b9[_0x92e1('0x1c')](_0x5e4935)['end']();};}function respondWithResult(_0x31ea10,_0xc425e8){_0xc425e8=_0xc425e8||0xc8;return function(_0x61cbf9){if(_0x61cbf9){return _0x31ea10[_0x92e1('0x1c')](_0xc425e8)[_0x92e1('0x1d')](_0x61cbf9);}};}function respondWithFilteredResult(_0x1beeec,_0x3882b1){return function(_0x3d8c39){if(_0x3d8c39){var _0x19dced=typeof _0x3882b1[_0x92e1('0x1e')]==='undefined'&&typeof _0x3882b1['limit']===_0x92e1('0x1f');var _0xf11eb7=_0x3d8c39[_0x92e1('0x20')];var _0x20e278=_0x19dced?0x0:_0x3882b1[_0x92e1('0x1e')];var _0x58d87d=_0x19dced?_0x3d8c39[_0x92e1('0x20')]:_0x3882b1[_0x92e1('0x1e')]+_0x3882b1['limit'];var _0x24a1fd;if(_0x58d87d>=_0xf11eb7){_0x58d87d=_0xf11eb7;_0x24a1fd=0xc8;}else{_0x24a1fd=0xce;}_0x1beeec[_0x92e1('0x1c')](_0x24a1fd);return _0x1beeec['set'](_0x92e1('0x21'),_0x20e278+'-'+_0x58d87d+'/'+_0xf11eb7)[_0x92e1('0x1d')](_0x3d8c39);}return null;};}function patchUpdates(_0x2fdfe4){return function(_0x4b54ef){try{jsonpatch[_0x92e1('0x22')](_0x4b54ef,_0x2fdfe4,!![]);}catch(_0xb555ae){return BPromise[_0x92e1('0x23')](_0xb555ae);}return _0x4b54ef[_0x92e1('0x24')]();};}function saveUpdates(_0x211aad,_0x2e1fdf){return function(_0x126416){if(_0x126416){return _0x126416['update'](_0x211aad)[_0x92e1('0x25')](function(_0x55b594){return _0x55b594;});}return null;};}function removeEntity(_0x3d0cee,_0x2623d3){return function(_0x3f2609){if(_0x3f2609){return _0x3f2609['destroy']()['then'](function(){_0x3d0cee[_0x92e1('0x1c')](0xcc)[_0x92e1('0x26')]();});}};}function handleEntityNotFound(_0x46712b,_0x414a35){return function(_0x5c99d1){if(!_0x5c99d1){_0x46712b[_0x92e1('0x1b')](0x194);}return _0x5c99d1;};}function handleError(_0x165c31,_0x51e7fd){_0x51e7fd=_0x51e7fd||0x1f4;return function(_0x4fbdf2){logger[_0x92e1('0x27')](_0x4fbdf2[_0x92e1('0x28')]);if(_0x4fbdf2[_0x92e1('0x29')]){delete _0x4fbdf2[_0x92e1('0x29')];}_0x165c31[_0x92e1('0x1c')](_0x51e7fd)[_0x92e1('0x2a')](_0x4fbdf2);};}exports[_0x92e1('0x2b')]=function(_0x30cd29,_0x26d468){var _0x11855f={},_0x1bae73={},_0x1be05e={'count':0x0,'rows':[]};var _0x1b0e0c=_['map'](db[_0x92e1('0x2c')][_0x92e1('0x2d')],function(_0x459513){return{'name':_0x459513['fieldName'],'type':_0x459513[_0x92e1('0x2e')][_0x92e1('0x2f')]};});_0x1bae73[_0x92e1('0x30')]=_['map'](_0x1b0e0c,_0x92e1('0x29'));_0x1bae73[_0x92e1('0x31')]=_[_0x92e1('0x32')](_0x30cd29['query']);_0x1bae73[_0x92e1('0x33')]=_[_0x92e1('0x34')](_0x1bae73[_0x92e1('0x30')],_0x1bae73['query']);_0x11855f[_0x92e1('0x35')]=_['intersection'](_0x1bae73['model'],qs['fields'](_0x30cd29[_0x92e1('0x31')][_0x92e1('0x36')]));_0x11855f[_0x92e1('0x35')]=_0x11855f[_0x92e1('0x35')]['length']?_0x11855f['attributes']:_0x1bae73['model'];if(!_0x30cd29[_0x92e1('0x31')]['hasOwnProperty'](_0x92e1('0x37'))){_0x11855f[_0x92e1('0x38')]=qs[_0x92e1('0x38')](_0x30cd29[_0x92e1('0x31')][_0x92e1('0x38')]);_0x11855f[_0x92e1('0x1e')]=qs[_0x92e1('0x1e')](_0x30cd29[_0x92e1('0x31')][_0x92e1('0x1e')]);}_0x11855f[_0x92e1('0x39')]=qs[_0x92e1('0x3a')](_0x30cd29['query']['sort']);_0x11855f[_0x92e1('0x3b')]=qs[_0x92e1('0x33')](_['pick'](_0x30cd29['query'],_0x1bae73[_0x92e1('0x33')]),_0x1b0e0c);if(_0x30cd29[_0x92e1('0x31')][_0x92e1('0x3c')]){_0x11855f[_0x92e1('0x3b')]=_[_0x92e1('0x3d')](_0x11855f[_0x92e1('0x3b')],{'$or':_[_0x92e1('0x3e')](_0x1b0e0c,function(_0x1e55ec){if(_0x1e55ec['type']!==_0x92e1('0x3f')){var _0x3e5c74={};_0x3e5c74[_0x1e55ec['name']]={'$like':'%'+_0x30cd29[_0x92e1('0x31')][_0x92e1('0x3c')]+'%'};return _0x3e5c74;}})});}_0x11855f=_[_0x92e1('0x3d')]({},_0x11855f,_0x30cd29[_0x92e1('0x40')]);var _0xde6bfc={'where':_0x11855f['where']};return db[_0x92e1('0x2c')][_0x92e1('0x20')](_0xde6bfc)[_0x92e1('0x25')](function(_0x4e2c61){_0x1be05e[_0x92e1('0x20')]=_0x4e2c61;if(_0x30cd29[_0x92e1('0x31')][_0x92e1('0x41')]){_0x11855f['include']=[{'all':!![]}];}return db[_0x92e1('0x2c')][_0x92e1('0x42')](_0x11855f);})[_0x92e1('0x25')](function(_0x32b851){_0x1be05e[_0x92e1('0x43')]=_0x32b851;return _0x1be05e;})[_0x92e1('0x25')](respondWithFilteredResult(_0x26d468,_0x11855f))[_0x92e1('0x44')](handleError(_0x26d468,null));};exports['show']=function(_0x3aef40,_0x5bf1c3){var _0xbe1dc9={'raw':!![],'where':{'id':_0x3aef40[_0x92e1('0x45')]['id']}},_0xa8faaf={};_0xa8faaf[_0x92e1('0x30')]=_[_0x92e1('0x32')](db[_0x92e1('0x2c')][_0x92e1('0x2d')]);_0xa8faaf[_0x92e1('0x31')]=_[_0x92e1('0x32')](_0x3aef40[_0x92e1('0x31')]);_0xa8faaf['filters']=_[_0x92e1('0x34')](_0xa8faaf[_0x92e1('0x30')],_0xa8faaf[_0x92e1('0x31')]);_0xbe1dc9[_0x92e1('0x35')]=_[_0x92e1('0x34')](_0xa8faaf[_0x92e1('0x30')],qs[_0x92e1('0x36')](_0x3aef40[_0x92e1('0x31')][_0x92e1('0x36')]));_0xbe1dc9['attributes']=_0xbe1dc9[_0x92e1('0x35')]['length']?_0xbe1dc9[_0x92e1('0x35')]:_0xa8faaf[_0x92e1('0x30')];if(_0x3aef40[_0x92e1('0x31')][_0x92e1('0x41')]){_0xbe1dc9[_0x92e1('0x46')]=[{'all':!![]}];}_0xbe1dc9=_[_0x92e1('0x3d')]({},_0xbe1dc9,_0x3aef40[_0x92e1('0x40')]);return db[_0x92e1('0x2c')][_0x92e1('0x47')](_0xbe1dc9)[_0x92e1('0x25')](handleEntityNotFound(_0x5bf1c3,null))['then'](respondWithResult(_0x5bf1c3,null))[_0x92e1('0x44')](handleError(_0x5bf1c3,null));};exports[_0x92e1('0x48')]=function(_0x4c1a90,_0x5abd13){return db[_0x92e1('0x2c')][_0x92e1('0x48')](_0x4c1a90[_0x92e1('0x49')],{})[_0x92e1('0x25')](respondWithResult(_0x5abd13,0xc9))['catch'](handleError(_0x5abd13,null));};exports['update']=function(_0x5bba85,_0x23eb87){if(_0x5bba85['body']['id']){delete _0x5bba85[_0x92e1('0x49')]['id'];}return db['FaxTransferReport'][_0x92e1('0x47')]({'where':{'id':_0x5bba85['params']['id']}})[_0x92e1('0x25')](handleEntityNotFound(_0x23eb87,null))[_0x92e1('0x25')](saveUpdates(_0x5bba85['body'],null))['then'](respondWithResult(_0x23eb87,null))['catch'](handleError(_0x23eb87,null));};exports[_0x92e1('0x4a')]=function(_0x2b8568,_0x32721b){return db[_0x92e1('0x2c')][_0x92e1('0x47')]({'where':{'id':_0x2b8568['params']['id']}})[_0x92e1('0x25')](handleEntityNotFound(_0x32721b,null))['then'](removeEntity(_0x32721b,null))[_0x92e1('0x44')](handleError(_0x32721b,null));};exports['describe']=function(_0x1b3212,_0xc49b2){return db[_0x92e1('0x2c')][_0x92e1('0x4b')]()[_0x92e1('0x25')](respondWithResult(_0xc49b2,null))[_0x92e1('0x44')](handleError(_0xc49b2,null));}; \ No newline at end of file +var _0x6fd5=['../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','end','error','stack','name','rawAttributes','fieldName','type','key','model','map','query','intersection','attributes','fields','length','sort','where','filters','pick','filter','merge','VIRTUAL','options','FaxTransferReport','include','rows','catch','params','includeAll','create','update','body','find','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x5679e6,_0x3124a7){var _0x215b93=function(_0x5f263d){while(--_0x5f263d){_0x5679e6['push'](_0x5679e6['shift']());}};_0x215b93(++_0x3124a7);}(_0x6fd5,0x7d));var _0x56fd=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x6fd5[_0xefd519];return _0x4bb882;};'use strict';var emlformat=require(_0x56fd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x56fd('0x1'));var jsonpatch=require(_0x56fd('0x2'));var rp=require('request-promise');var moment=require(_0x56fd('0x3'));var BPromise=require(_0x56fd('0x4'));var Mustache=require(_0x56fd('0x5'));var util=require(_0x56fd('0x6'));var path=require(_0x56fd('0x7'));var sox=require(_0x56fd('0x8'));var csv=require(_0x56fd('0x9'));var ejs=require(_0x56fd('0xa'));var fs=require('fs');var fs_extra=require(_0x56fd('0xb'));var _=require('lodash');var squel=require(_0x56fd('0xc'));var crypto=require(_0x56fd('0xd'));var jsforce=require(_0x56fd('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x56fd('0xf'));var Papa=require(_0x56fd('0x10'));var Redis=require(_0x56fd('0x11'));var authService=require(_0x56fd('0x12'));var qs=require(_0x56fd('0x13'));var as=require(_0x56fd('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x56fd('0x15'))(_0x56fd('0x16'));var utils=require(_0x56fd('0x17'));var config=require(_0x56fd('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1507b6,_0x3a689f){_0x3a689f=_0x3a689f||0xcc;return function(_0x5c6228){if(_0x5c6228){return _0x1507b6[_0x56fd('0x19')](_0x3a689f);}return _0x1507b6[_0x56fd('0x1a')](_0x3a689f)['end']();};}function respondWithResult(_0x246eaf,_0x114d1a){_0x114d1a=_0x114d1a||0xc8;return function(_0x32b703){if(_0x32b703){return _0x246eaf[_0x56fd('0x1a')](_0x114d1a)[_0x56fd('0x1b')](_0x32b703);}};}function respondWithFilteredResult(_0xb6d785,_0x570999){return function(_0x3564ae){if(_0x3564ae){var _0x5bbb34=typeof _0x570999[_0x56fd('0x1c')]===_0x56fd('0x1d')&&typeof _0x570999[_0x56fd('0x1e')]===_0x56fd('0x1d');var _0x14847a=_0x3564ae[_0x56fd('0x1f')];var _0x3ab4f3=_0x5bbb34?0x0:_0x570999[_0x56fd('0x1c')];var _0x202457=_0x5bbb34?_0x3564ae[_0x56fd('0x1f')]:_0x570999[_0x56fd('0x1c')]+_0x570999[_0x56fd('0x1e')];var _0x32702b;if(_0x202457>=_0x14847a){_0x202457=_0x14847a;_0x32702b=0xc8;}else{_0x32702b=0xce;}_0xb6d785[_0x56fd('0x1a')](_0x32702b);return _0xb6d785[_0x56fd('0x20')](_0x56fd('0x21'),_0x3ab4f3+'-'+_0x202457+'/'+_0x14847a)[_0x56fd('0x1b')](_0x3564ae);}return null;};}function patchUpdates(_0x347836){return function(_0x4bf6d8){try{jsonpatch[_0x56fd('0x22')](_0x4bf6d8,_0x347836,!![]);}catch(_0x3a3d0b){return BPromise[_0x56fd('0x23')](_0x3a3d0b);}return _0x4bf6d8[_0x56fd('0x24')]();};}function saveUpdates(_0x15d426,_0x4bbbf6){return function(_0x45a88a){if(_0x45a88a){return _0x45a88a['update'](_0x15d426)['then'](function(_0x5dcfec){return _0x5dcfec;});}return null;};}function removeEntity(_0x2ccb05,_0x2e7225){return function(_0x461409){if(_0x461409){return _0x461409[_0x56fd('0x25')]()[_0x56fd('0x26')](function(){_0x2ccb05[_0x56fd('0x1a')](0xcc)[_0x56fd('0x27')]();});}};}function handleEntityNotFound(_0x23fa47,_0x3f782a){return function(_0x2081e1){if(!_0x2081e1){_0x23fa47['sendStatus'](0x194);}return _0x2081e1;};}function handleError(_0x487309,_0x65c535){_0x65c535=_0x65c535||0x1f4;return function(_0x5034ba){logger[_0x56fd('0x28')](_0x5034ba[_0x56fd('0x29')]);if(_0x5034ba[_0x56fd('0x2a')]){delete _0x5034ba['name'];}_0x487309[_0x56fd('0x1a')](_0x65c535)['send'](_0x5034ba);};}exports['index']=function(_0x32914e,_0x2faa93){var _0x332ae0={},_0x33fd44={},_0x308eee={'count':0x0,'rows':[]};var _0x33a438=_['map'](db['FaxTransferReport'][_0x56fd('0x2b')],function(_0xad4f4){return{'name':_0xad4f4[_0x56fd('0x2c')],'type':_0xad4f4[_0x56fd('0x2d')][_0x56fd('0x2e')]};});_0x33fd44[_0x56fd('0x2f')]=_[_0x56fd('0x30')](_0x33a438,'name');_0x33fd44['query']=_['keys'](_0x32914e[_0x56fd('0x31')]);_0x33fd44['filters']=_[_0x56fd('0x32')](_0x33fd44[_0x56fd('0x2f')],_0x33fd44['query']);_0x332ae0[_0x56fd('0x33')]=_[_0x56fd('0x32')](_0x33fd44[_0x56fd('0x2f')],qs[_0x56fd('0x34')](_0x32914e[_0x56fd('0x31')][_0x56fd('0x34')]));_0x332ae0[_0x56fd('0x33')]=_0x332ae0[_0x56fd('0x33')][_0x56fd('0x35')]?_0x332ae0[_0x56fd('0x33')]:_0x33fd44[_0x56fd('0x2f')];if(!_0x32914e[_0x56fd('0x31')]['hasOwnProperty']('nolimit')){_0x332ae0[_0x56fd('0x1e')]=qs['limit'](_0x32914e[_0x56fd('0x31')][_0x56fd('0x1e')]);_0x332ae0['offset']=qs[_0x56fd('0x1c')](_0x32914e[_0x56fd('0x31')]['offset']);}_0x332ae0['order']=qs['sort'](_0x32914e[_0x56fd('0x31')][_0x56fd('0x36')]);_0x332ae0[_0x56fd('0x37')]=qs[_0x56fd('0x38')](_[_0x56fd('0x39')](_0x32914e[_0x56fd('0x31')],_0x33fd44[_0x56fd('0x38')]),_0x33a438);if(_0x32914e['query'][_0x56fd('0x3a')]){_0x332ae0['where']=_[_0x56fd('0x3b')](_0x332ae0[_0x56fd('0x37')],{'$or':_[_0x56fd('0x30')](_0x33a438,function(_0x3414e5){if(_0x3414e5['type']!==_0x56fd('0x3c')){var _0x3bbfd7={};_0x3bbfd7[_0x3414e5['name']]={'$like':'%'+_0x32914e['query'][_0x56fd('0x3a')]+'%'};return _0x3bbfd7;}})});}_0x332ae0=_[_0x56fd('0x3b')]({},_0x332ae0,_0x32914e[_0x56fd('0x3d')]);var _0x39826c={'where':_0x332ae0[_0x56fd('0x37')]};return db[_0x56fd('0x3e')]['count'](_0x39826c)['then'](function(_0x1e5262){_0x308eee[_0x56fd('0x1f')]=_0x1e5262;if(_0x32914e[_0x56fd('0x31')]['includeAll']){_0x332ae0[_0x56fd('0x3f')]=[{'all':!![]}];}return db[_0x56fd('0x3e')]['findAll'](_0x332ae0);})['then'](function(_0x4ac9cc){_0x308eee[_0x56fd('0x40')]=_0x4ac9cc;return _0x308eee;})[_0x56fd('0x26')](respondWithFilteredResult(_0x2faa93,_0x332ae0))[_0x56fd('0x41')](handleError(_0x2faa93,null));};exports['show']=function(_0x34a6d1,_0x44f530){var _0x4e91d4={'raw':!![],'where':{'id':_0x34a6d1[_0x56fd('0x42')]['id']}},_0x3ed476={};_0x3ed476[_0x56fd('0x2f')]=_['keys'](db[_0x56fd('0x3e')][_0x56fd('0x2b')]);_0x3ed476['query']=_['keys'](_0x34a6d1[_0x56fd('0x31')]);_0x3ed476[_0x56fd('0x38')]=_[_0x56fd('0x32')](_0x3ed476[_0x56fd('0x2f')],_0x3ed476[_0x56fd('0x31')]);_0x4e91d4['attributes']=_['intersection'](_0x3ed476['model'],qs['fields'](_0x34a6d1[_0x56fd('0x31')][_0x56fd('0x34')]));_0x4e91d4[_0x56fd('0x33')]=_0x4e91d4[_0x56fd('0x33')][_0x56fd('0x35')]?_0x4e91d4['attributes']:_0x3ed476[_0x56fd('0x2f')];if(_0x34a6d1[_0x56fd('0x31')][_0x56fd('0x43')]){_0x4e91d4[_0x56fd('0x3f')]=[{'all':!![]}];}_0x4e91d4=_['merge']({},_0x4e91d4,_0x34a6d1[_0x56fd('0x3d')]);return db[_0x56fd('0x3e')]['find'](_0x4e91d4)[_0x56fd('0x26')](handleEntityNotFound(_0x44f530,null))[_0x56fd('0x26')](respondWithResult(_0x44f530,null))[_0x56fd('0x41')](handleError(_0x44f530,null));};exports[_0x56fd('0x44')]=function(_0x196fc6,_0xec0d63){return db['FaxTransferReport'][_0x56fd('0x44')](_0x196fc6['body'],{})['then'](respondWithResult(_0xec0d63,0xc9))['catch'](handleError(_0xec0d63,null));};exports[_0x56fd('0x45')]=function(_0x2695b5,_0x3346e5){if(_0x2695b5[_0x56fd('0x46')]['id']){delete _0x2695b5[_0x56fd('0x46')]['id'];}return db['FaxTransferReport'][_0x56fd('0x47')]({'where':{'id':_0x2695b5['params']['id']}})['then'](handleEntityNotFound(_0x3346e5,null))[_0x56fd('0x26')](saveUpdates(_0x2695b5[_0x56fd('0x46')],null))[_0x56fd('0x26')](respondWithResult(_0x3346e5,null))[_0x56fd('0x41')](handleError(_0x3346e5,null));};exports[_0x56fd('0x25')]=function(_0xd84864,_0x47db55){return db['FaxTransferReport'][_0x56fd('0x47')]({'where':{'id':_0xd84864[_0x56fd('0x42')]['id']}})[_0x56fd('0x26')](handleEntityNotFound(_0x47db55,null))[_0x56fd('0x26')](removeEntity(_0x47db55,null))['catch'](handleError(_0x47db55,null));};exports[_0x56fd('0x48')]=function(_0xd560d0,_0x197473){return db[_0x56fd('0x3e')][_0x56fd('0x48')]()['then'](respondWithResult(_0x197473,null))[_0x56fd('0x41')](handleError(_0x197473,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 95251a0..d71d986 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 _0x216c=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','FaxTransferReport','uniqueid','lodash','util'];(function(_0x456cbb,_0x547275){var _0x9c3a70=function(_0x1c8686){while(--_0x1c8686){_0x456cbb['push'](_0x456cbb['shift']());}};_0x9c3a70(++_0x547275);}(_0x216c,0xb4));var _0xc216=function(_0x85e1fb,_0x4ca682){_0x85e1fb=_0x85e1fb-0x0;var _0xbc071c=_0x216c[_0x85e1fb];return _0xbc071c;};'use strict';var _=require(_0xc216('0x0'));var util=require(_0xc216('0x1'));var logger=require(_0xc216('0x2'))(_0xc216('0x3'));var moment=require(_0xc216('0x4'));var BPromise=require(_0xc216('0x5'));var rp=require(_0xc216('0x6'));var fs=require('fs');var path=require(_0xc216('0x7'));var rimraf=require(_0xc216('0x8'));var config=require(_0xc216('0x9'));var attributes=require('./faxTransferReport.attributes');module[_0xc216('0xa')]=function(_0x198cdb,_0x187be7){return _0x198cdb['define'](_0xc216('0xb'),attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xc216('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3acd=['rimraf','../../config/environment','./faxTransferReport.attributes','exports','define','report_fax_transfer','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x70bc09,_0x3d57f8){var _0xca8675=function(_0x4300f2){while(--_0x4300f2){_0x70bc09['push'](_0x70bc09['shift']());}};_0xca8675(++_0x3d57f8);}(_0x3acd,0x69));var _0xd3ac=function(_0x4b80f7,_0x52dd11){_0x4b80f7=_0x4b80f7-0x0;var _0xef87a2=_0x3acd[_0x4b80f7];return _0xef87a2;};'use strict';var _=require(_0xd3ac('0x0'));var util=require(_0xd3ac('0x1'));var logger=require(_0xd3ac('0x2'))(_0xd3ac('0x3'));var moment=require('moment');var BPromise=require(_0xd3ac('0x4'));var rp=require(_0xd3ac('0x5'));var fs=require('fs');var path=require(_0xd3ac('0x6'));var rimraf=require(_0xd3ac('0x7'));var config=require(_0xd3ac('0x8'));var attributes=require(_0xd3ac('0x9'));module[_0xd3ac('0xa')]=function(_0x2c7a09,_0x54b162){return _0x2c7a09[_0xd3ac('0xb')]('FaxTransferReport',attributes,{'tableName':_0xd3ac('0xc'),'paranoid':![],'indexes':[{'name':_0xd3ac('0xd'),'fields':[_0xd3ac('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 a0b9d6c..e2eb894 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 _0xf82b=['debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','FaxTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0x40ebff,_0x1dd15e){var _0x40122a=function(_0xae6174){while(--_0xae6174){_0x40ebff['push'](_0x40ebff['shift']());}};_0x40122a(++_0x1dd15e);}(_0xf82b,0x9b));var _0xbf82=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xf82b[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require(_0xbf82('0x0'));var moment=require(_0xbf82('0x1'));var BPromise=require(_0xbf82('0x2'));var rs=require(_0xbf82('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbf82('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xbf82('0x5'))(_0xbf82('0x6'));var config=require(_0xbf82('0x7'));var jayson=require(_0xbf82('0x8'));var client=jayson[_0xbf82('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x40b1a9,_0x54838a,_0x1553fd){return new BPromise(function(_0x379e93,_0x1cdc3a){return client[_0xbf82('0xa')](_0x40b1a9,_0x1553fd)['then'](function(_0xeb6305){logger['info'](_0xbf82('0xb'),_0x54838a,_0xbf82('0xc'));logger[_0xbf82('0xd')](_0xbf82('0xe'),_0x54838a,_0xbf82('0xc'),JSON[_0xbf82('0xf')](_0xeb6305));if(_0xeb6305[_0xbf82('0x10')]){if(_0xeb6305[_0xbf82('0x10')][_0xbf82('0x11')]===0x1f4){logger[_0xbf82('0x10')]('FaxTransferReport,\x20%s,\x20%s',_0x54838a,_0xeb6305[_0xbf82('0x10')][_0xbf82('0x12')]);return _0x1cdc3a(_0xeb6305['error'][_0xbf82('0x12')]);}logger[_0xbf82('0x10')](_0xbf82('0xb'),_0x54838a,_0xeb6305[_0xbf82('0x10')]['message']);return _0x379e93(_0xeb6305[_0xbf82('0x10')][_0xbf82('0x12')]);}else{logger['info']('FaxTransferReport,\x20%s,\x20%s',_0x54838a,_0xbf82('0xc'));_0x379e93(_0xeb6305[_0xbf82('0x13')][_0xbf82('0x12')]);}})[_0xbf82('0x14')](function(_0x280759){logger[_0xbf82('0x10')](_0xbf82('0xb'),_0x54838a,_0x280759);_0x1cdc3a(_0x280759);});});} \ No newline at end of file +var _0xb15d=['FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xb15d,0x195));var _0xdb15=function(_0x5bf77c,_0x2f2210){_0x5bf77c=_0x5bf77c-0x0;var _0x5b51e7=_0xb15d[_0x5bf77c];return _0x5b51e7;};'use strict';var _=require(_0xdb15('0x0'));var util=require(_0xdb15('0x1'));var moment=require(_0xdb15('0x2'));var BPromise=require(_0xdb15('0x3'));var rs=require(_0xdb15('0x4'));var fs=require('fs');var Redis=require(_0xdb15('0x5'));var db=require(_0xdb15('0x6'))['db'];var utils=require(_0xdb15('0x7'));var logger=require('../../config/logger')(_0xdb15('0x8'));var config=require(_0xdb15('0x9'));var jayson=require(_0xdb15('0xa'));var client=jayson[_0xdb15('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4b3c6e,_0x247cc0,_0x182d23){return new BPromise(function(_0x21f7af,_0x37ff16){return client['request'](_0x4b3c6e,_0x182d23)[_0xdb15('0xc')](function(_0x14f791){logger['info'](_0xdb15('0xd'),_0x247cc0,_0xdb15('0xe'));logger[_0xdb15('0xf')](_0xdb15('0x10'),_0x247cc0,_0xdb15('0xe'),JSON[_0xdb15('0x11')](_0x14f791));if(_0x14f791['error']){if(_0x14f791[_0xdb15('0x12')][_0xdb15('0x13')]===0x1f4){logger[_0xdb15('0x12')](_0xdb15('0xd'),_0x247cc0,_0x14f791[_0xdb15('0x12')][_0xdb15('0x14')]);return _0x37ff16(_0x14f791['error']['message']);}logger['error'](_0xdb15('0xd'),_0x247cc0,_0x14f791[_0xdb15('0x12')]['message']);return _0x21f7af(_0x14f791[_0xdb15('0x12')][_0xdb15('0x14')]);}else{logger['info']('FaxTransferReport,\x20%s,\x20%s',_0x247cc0,'request\x20sent');_0x21f7af(_0x14f791['result']['message']);}})[_0xdb15('0x15')](function(_0x12767c){logger[_0xdb15('0x12')](_0xdb15('0xd'),_0x247cc0,_0x12767c);_0x37ff16(_0x12767c);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index affff49..a50ead4 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 _0xf043=['isAuthenticated','index','get','/describe','/:id','post','put','update','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller'];(function(_0x2e0ced,_0x2d02d5){var _0x3390e6=function(_0x2237af){while(--_0x2237af){_0x2e0ced['push'](_0x2e0ced['shift']());}};_0x3390e6(++_0x2d02d5);}(_0xf043,0x14d));var _0x3f04=function(_0x104021,_0x1a3217){_0x104021=_0x104021-0x0;var _0x5c2290=_0xf043[_0x104021];return _0x5c2290;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3f04('0x0'));var timeout=require(_0x3f04('0x1'));var express=require(_0x3f04('0x2'));var router=express[_0x3f04('0x3')]();var fs_extra=require(_0x3f04('0x4'));var auth=require(_0x3f04('0x5'));var interaction=require(_0x3f04('0x6'));var config=require(_0x3f04('0x7'));var controller=require(_0x3f04('0x8'));router['get']('/',auth[_0x3f04('0x9')](),controller[_0x3f04('0xa')]);router[_0x3f04('0xb')](_0x3f04('0xc'),auth[_0x3f04('0x9')](),controller['describe']);router[_0x3f04('0xb')](_0x3f04('0xd'),auth[_0x3f04('0x9')](),controller['show']);router[_0x3f04('0xe')]('/',auth[_0x3f04('0x9')](),controller['create']);router[_0x3f04('0xf')](_0x3f04('0xd'),auth[_0x3f04('0x9')](),controller[_0x3f04('0x10')]);router['delete'](_0x3f04('0xd'),auth['isAuthenticated'](),controller[_0x3f04('0x11')]);module[_0x3f04('0x12')]=router; \ No newline at end of file +var _0x1c9d=['put','/:id','update','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./faxTransferReport.controller','get','isAuthenticated','describe','show','post','create'];(function(_0x8749ee,_0x34752a){var _0x150794=function(_0x52da98){while(--_0x52da98){_0x8749ee['push'](_0x8749ee['shift']());}};_0x150794(++_0x34752a);}(_0x1c9d,0x124));var _0xd1c9=function(_0x13117b,_0x3449eb){_0x13117b=_0x13117b-0x0;var _0x418124=_0x1c9d[_0x13117b];return _0x418124;};'use strict';var multer=require(_0xd1c9('0x0'));var util=require(_0xd1c9('0x1'));var path=require('path');var timeout=require(_0xd1c9('0x2'));var express=require(_0xd1c9('0x3'));var router=express[_0xd1c9('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd1c9('0x5'));var interaction=require(_0xd1c9('0x6'));var config=require('../../config/environment');var controller=require(_0xd1c9('0x7'));router[_0xd1c9('0x8')]('/',auth[_0xd1c9('0x9')](),controller['index']);router[_0xd1c9('0x8')]('/describe',auth['isAuthenticated'](),controller[_0xd1c9('0xa')]);router[_0xd1c9('0x8')]('/:id',auth[_0xd1c9('0x9')](),controller[_0xd1c9('0xb')]);router[_0xd1c9('0xc')]('/',auth[_0xd1c9('0x9')](),controller[_0xd1c9('0xd')]);router[_0xd1c9('0xe')](_0xd1c9('0xf'),auth['isAuthenticated'](),controller[_0xd1c9('0x10')]);router['delete'](_0xd1c9('0xf'),auth[_0xd1c9('0x9')](),controller[_0xd1c9('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 934df72..65dd532 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 _0x121a=['update','delete','util','path','connect-timeout','fs-extra','../../components/auth/service','./intDeskAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','/:id/fields','post','addConfiguration'];(function(_0x2e11d3,_0x26a29a){var _0x3f7f7f=function(_0x3c43f1){while(--_0x3c43f1){_0x2e11d3['push'](_0x2e11d3['shift']());}};_0x3f7f7f(++_0x26a29a);}(_0x121a,0x182));var _0xa121=function(_0x18836f,_0x4fd6d6){_0x18836f=_0x18836f-0x0;var _0x5bd3b4=_0x121a[_0x18836f];return _0x5bd3b4;};'use strict';var multer=require('multer');var util=require(_0xa121('0x0'));var path=require(_0xa121('0x1'));var timeout=require(_0xa121('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xa121('0x3'));var auth=require(_0xa121('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa121('0x5'));router[_0xa121('0x6')]('/',auth[_0xa121('0x7')](),controller['index']);router['get'](_0xa121('0x8'),auth['isAuthenticated'](),controller[_0xa121('0x9')]);router[_0xa121('0x6')](_0xa121('0xa'),auth[_0xa121('0x7')](),controller['getConfigurations']);router[_0xa121('0x6')](_0xa121('0xb'),auth[_0xa121('0x7')](),controller['getFields']);router['post']('/',auth[_0xa121('0x7')](),controller['create']);router[_0xa121('0xc')]('/:id/configurations',auth['isAuthenticated'](),controller[_0xa121('0xd')]);router['put']('/:id',auth[_0xa121('0x7')](),controller[_0xa121('0xe')]);router[_0xa121('0xf')]('/:id',auth[_0xa121('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xb185=['get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','addConfiguration','put','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller'];(function(_0x68fa03,_0x343951){var _0x297c67=function(_0x3c2bb2){while(--_0x3c2bb2){_0x68fa03['push'](_0x68fa03['shift']());}};_0x297c67(++_0x343951);}(_0xb185,0x13b));var _0x5b18=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0xb185[_0x4ff09b];return _0x3f5c2e;};'use strict';var multer=require('multer');var util=require(_0x5b18('0x0'));var path=require(_0x5b18('0x1'));var timeout=require(_0x5b18('0x2'));var express=require(_0x5b18('0x3'));var router=express[_0x5b18('0x4')]();var fs_extra=require(_0x5b18('0x5'));var auth=require(_0x5b18('0x6'));var interaction=require(_0x5b18('0x7'));var config=require(_0x5b18('0x8'));var controller=require(_0x5b18('0x9'));router[_0x5b18('0xa')]('/',auth[_0x5b18('0xb')](),controller[_0x5b18('0xc')]);router[_0x5b18('0xa')](_0x5b18('0xd'),auth[_0x5b18('0xb')](),controller['show']);router[_0x5b18('0xa')](_0x5b18('0xe'),auth[_0x5b18('0xb')](),controller[_0x5b18('0xf')]);router[_0x5b18('0xa')](_0x5b18('0x10'),auth[_0x5b18('0xb')](),controller[_0x5b18('0x11')]);router['post']('/',auth[_0x5b18('0xb')](),controller[_0x5b18('0x12')]);router[_0x5b18('0x13')](_0x5b18('0xe'),auth['isAuthenticated'](),controller[_0x5b18('0x14')]);router[_0x5b18('0x15')]('/:id',auth[_0x5b18('0xb')](),controller[_0x5b18('0x16')]);router['delete']('/:id',auth[_0x5b18('0xb')](),controller[_0x5b18('0x17')]);module[_0x5b18('0x18')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index cba582f..e8d7554 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 _0xfbf5=['basic','integrationTab','newTab','sequelize','STRING','ENUM'];(function(_0x25495f,_0x33d201){var _0xbf083e=function(_0x2bf395){while(--_0x2bf395){_0x25495f['push'](_0x25495f['shift']());}};_0xbf083e(++_0x33d201);}(_0xfbf5,0x17d));var _0x5fbf=function(_0x9efe2,_0x18328c){_0x9efe2=_0x9efe2-0x0;var _0x2eafe5=_0xfbf5[_0x9efe2];return _0x2eafe5;};'use strict';var Sequelize=require(_0x5fbf('0x0'));module['exports']={'name':{'type':Sequelize[_0x5fbf('0x1')]},'description':{'type':Sequelize[_0x5fbf('0x1')]},'username':{'type':Sequelize[_0x5fbf('0x1')]},'remoteUri':{'type':Sequelize[_0x5fbf('0x1')]},'authType':{'type':Sequelize[_0x5fbf('0x2')](_0x5fbf('0x3')),'defaultValue':_0x5fbf('0x3')},'password':{'type':Sequelize[_0x5fbf('0x1')]},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize[_0x5fbf('0x1')]},'token':{'type':Sequelize[_0x5fbf('0x1')]},'tokenSecret':{'type':Sequelize[_0x5fbf('0x1')]},'serverUrl':{'type':Sequelize[_0x5fbf('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x5fbf('0x2')](_0x5fbf('0x4'),_0x5fbf('0x5')),'defaultValue':_0x5fbf('0x4')}}; \ No newline at end of file +var _0x5dda=['basic','integrationTab','newTab','sequelize','STRING','ENUM'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5dda,0xdb));var _0xa5dd=function(_0x1ba82f,_0x5a5751){_0x1ba82f=_0x1ba82f-0x0;var _0x5b607b=_0x5dda[_0x1ba82f];return _0x5b607b;};'use strict';var Sequelize=require(_0xa5dd('0x0'));module['exports']={'name':{'type':Sequelize[_0xa5dd('0x1')]},'description':{'type':Sequelize[_0xa5dd('0x1')]},'username':{'type':Sequelize[_0xa5dd('0x1')]},'remoteUri':{'type':Sequelize[_0xa5dd('0x1')]},'authType':{'type':Sequelize[_0xa5dd('0x2')](_0xa5dd('0x3')),'defaultValue':_0xa5dd('0x3')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0xa5dd('0x1')]},'consumerSecret':{'type':Sequelize[_0xa5dd('0x1')]},'token':{'type':Sequelize[_0xa5dd('0x1')]},'tokenSecret':{'type':Sequelize[_0xa5dd('0x1')]},'serverUrl':{'type':Sequelize[_0xa5dd('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xa5dd('0x2')](_0xa5dd('0x4'),_0xa5dd('0x5')),'defaultValue':_0xa5dd('0x4')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 1171e60..dedb6c3 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 _0xdefc=['DeskField','getFields','priority','authType','username','password','consumerSecret','token','tokenSecret','remoteUri','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','basic','headers','Basic\x20%s','base64','_embedded','entries','label','test','stringify','Wrong\x20credentials','statusCode','eml-format','zip-dir','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','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','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','save','destroy','then','end','error','stack','name','send','map','DeskAccount','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','getConfigurations','findOne','addConfiguration','AccountId','Subjects','Descriptions','channel','DeskConfiguration'];(function(_0x622f4b,_0x37ec98){var _0x5287b7=function(_0x1df0af){while(--_0x1df0af){_0x622f4b['push'](_0x622f4b['shift']());}};_0x5287b7(++_0x37ec98);}(_0xdefc,0x15c));var _0xcdef=function(_0x78929c,_0x529d2f){_0x78929c=_0x78929c-0x0;var _0x1c1c5c=_0xdefc[_0x78929c];return _0x1c1c5c;};'use strict';var emlformat=require(_0xcdef('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcdef('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xcdef('0x2'));var BPromise=require(_0xcdef('0x3'));var Mustache=require('mustache');var util=require(_0xcdef('0x4'));var path=require(_0xcdef('0x5'));var sox=require(_0xcdef('0x6'));var csv=require(_0xcdef('0x7'));var ejs=require(_0xcdef('0x8'));var fs=require('fs');var fs_extra=require(_0xcdef('0x9'));var _=require(_0xcdef('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xcdef('0x7'));var querystring=require(_0xcdef('0xb'));var Papa=require(_0xcdef('0xc'));var Redis=require(_0xcdef('0xd'));var authService=require(_0xcdef('0xe'));var qs=require(_0xcdef('0xf'));var as=require(_0xcdef('0x10'));var hardwareService=require(_0xcdef('0x11'));var logger=require(_0xcdef('0x12'))(_0xcdef('0x13'));var utils=require(_0xcdef('0x14'));var config=require(_0xcdef('0x15'));var licenseUtil=require(_0xcdef('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0xcdef('0x17'));function respondWithStatusCode(_0x5c3631,_0x995565){_0x995565=_0x995565||0xcc;return function(_0x1bbcd9){if(_0x1bbcd9){return _0x5c3631[_0xcdef('0x18')](_0x995565);}return _0x5c3631[_0xcdef('0x19')](_0x995565)['end']();};}function respondWithResult(_0x5e1b10,_0x2fc890){_0x2fc890=_0x2fc890||0xc8;return function(_0x59dea5){if(_0x59dea5){return _0x5e1b10[_0xcdef('0x19')](_0x2fc890)[_0xcdef('0x1a')](_0x59dea5);}};}function respondWithFilteredResult(_0x3c9010,_0x40add5){return function(_0x34216f){if(_0x34216f){var _0x1bf22c=typeof _0x40add5[_0xcdef('0x1b')]===_0xcdef('0x1c')&&typeof _0x40add5[_0xcdef('0x1d')]==='undefined';var _0x307185=_0x34216f[_0xcdef('0x1e')];var _0x4b24b5=_0x1bf22c?0x0:_0x40add5['offset'];var _0x7e41cd=_0x1bf22c?_0x34216f[_0xcdef('0x1e')]:_0x40add5[_0xcdef('0x1b')]+_0x40add5['limit'];var _0x55070f;if(_0x7e41cd>=_0x307185){_0x7e41cd=_0x307185;_0x55070f=0xc8;}else{_0x55070f=0xce;}_0x3c9010[_0xcdef('0x19')](_0x55070f);return _0x3c9010['set'](_0xcdef('0x1f'),_0x4b24b5+'-'+_0x7e41cd+'/'+_0x307185)[_0xcdef('0x1a')](_0x34216f);}return null;};}function patchUpdates(_0x3e19a9){return function(_0x12b07d){try{jsonpatch[_0xcdef('0x20')](_0x12b07d,_0x3e19a9,!![]);}catch(_0x5e4bca){return BPromise['reject'](_0x5e4bca);}return _0x12b07d[_0xcdef('0x21')]();};}function saveUpdates(_0x2da779,_0x5a9621){return function(_0x1a465b){if(_0x1a465b){return _0x1a465b['update'](_0x2da779)['then'](function(_0x155431){return _0x155431;});}return null;};}function removeEntity(_0x30474d,_0x4bdad8){return function(_0xf8ccaf){if(_0xf8ccaf){return _0xf8ccaf[_0xcdef('0x22')]()[_0xcdef('0x23')](function(){_0x30474d['status'](0xcc)[_0xcdef('0x24')]();});}};}function handleEntityNotFound(_0x706e15,_0x37fe97){return function(_0x5eea2b){if(!_0x5eea2b){_0x706e15['sendStatus'](0x194);}return _0x5eea2b;};}function handleError(_0x2fe68b,_0x45f83c){_0x45f83c=_0x45f83c||0x1f4;return function(_0x10b36e){logger[_0xcdef('0x25')](_0x10b36e[_0xcdef('0x26')]);if(_0x10b36e[_0xcdef('0x27')]){delete _0x10b36e[_0xcdef('0x27')];}_0x2fe68b[_0xcdef('0x19')](_0x45f83c)[_0xcdef('0x28')](_0x10b36e);};}exports['index']=function(_0x5e4061,_0x980362){var _0x159c90={},_0x18e7a={},_0x2a9af4={'count':0x0,'rows':[]};var _0x4c444e=_[_0xcdef('0x29')](db[_0xcdef('0x2a')][_0xcdef('0x2b')],function(_0x45c964){return{'name':_0x45c964[_0xcdef('0x2c')],'type':_0x45c964[_0xcdef('0x2d')][_0xcdef('0x2e')]};});_0x18e7a[_0xcdef('0x2f')]=_[_0xcdef('0x29')](_0x4c444e,_0xcdef('0x27'));_0x18e7a['query']=_[_0xcdef('0x30')](_0x5e4061['query']);_0x18e7a[_0xcdef('0x31')]=_[_0xcdef('0x32')](_0x18e7a[_0xcdef('0x2f')],_0x18e7a[_0xcdef('0x33')]);_0x159c90[_0xcdef('0x34')]=_['intersection'](_0x18e7a['model'],qs[_0xcdef('0x35')](_0x5e4061[_0xcdef('0x33')][_0xcdef('0x35')]));_0x159c90[_0xcdef('0x34')]=_0x159c90[_0xcdef('0x34')][_0xcdef('0x36')]?_0x159c90[_0xcdef('0x34')]:_0x18e7a[_0xcdef('0x2f')];if(!_0x5e4061[_0xcdef('0x33')][_0xcdef('0x37')](_0xcdef('0x38'))){_0x159c90['limit']=qs[_0xcdef('0x1d')](_0x5e4061[_0xcdef('0x33')][_0xcdef('0x1d')]);_0x159c90[_0xcdef('0x1b')]=qs[_0xcdef('0x1b')](_0x5e4061[_0xcdef('0x33')][_0xcdef('0x1b')]);}_0x159c90['order']=qs[_0xcdef('0x39')](_0x5e4061[_0xcdef('0x33')][_0xcdef('0x39')]);_0x159c90['where']=qs[_0xcdef('0x31')](_['pick'](_0x5e4061[_0xcdef('0x33')],_0x18e7a[_0xcdef('0x31')]),_0x4c444e);if(_0x5e4061['query'][_0xcdef('0x3a')]){_0x159c90['where']=_[_0xcdef('0x3b')](_0x159c90[_0xcdef('0x3c')],{'$or':_[_0xcdef('0x29')](_0x4c444e,function(_0x3915da){if(_0x3915da['type']!==_0xcdef('0x3d')){var _0x455164={};_0x455164[_0x3915da['name']]={'$like':'%'+_0x5e4061['query'][_0xcdef('0x3a')]+'%'};return _0x455164;}})});}_0x159c90=_[_0xcdef('0x3b')]({},_0x159c90,_0x5e4061[_0xcdef('0x3e')]);var _0x1e0d8c={'where':_0x159c90[_0xcdef('0x3c')]};return db[_0xcdef('0x2a')][_0xcdef('0x1e')](_0x1e0d8c)['then'](function(_0x1d987d){_0x2a9af4[_0xcdef('0x1e')]=_0x1d987d;if(_0x5e4061[_0xcdef('0x33')][_0xcdef('0x3f')]){_0x159c90[_0xcdef('0x40')]=[{'all':!![]}];}return db['DeskAccount'][_0xcdef('0x41')](_0x159c90);})[_0xcdef('0x23')](function(_0x3834df){_0x2a9af4['rows']=_0x3834df;return _0x2a9af4;})[_0xcdef('0x23')](respondWithFilteredResult(_0x980362,_0x159c90))[_0xcdef('0x42')](handleError(_0x980362,null));};exports[_0xcdef('0x43')]=function(_0x36bb07,_0x28c2f7){var _0x22aa2b={'raw':![],'where':{'id':_0x36bb07[_0xcdef('0x44')]['id']}},_0x58ffd7={};_0x58ffd7[_0xcdef('0x2f')]=_[_0xcdef('0x30')](db[_0xcdef('0x2a')][_0xcdef('0x2b')]);_0x58ffd7[_0xcdef('0x33')]=_[_0xcdef('0x30')](_0x36bb07[_0xcdef('0x33')]);_0x58ffd7['filters']=_[_0xcdef('0x32')](_0x58ffd7[_0xcdef('0x2f')],_0x58ffd7['query']);_0x22aa2b[_0xcdef('0x34')]=_[_0xcdef('0x32')](_0x58ffd7['model'],qs['fields'](_0x36bb07[_0xcdef('0x33')][_0xcdef('0x35')]));_0x22aa2b['attributes']=_0x22aa2b[_0xcdef('0x34')][_0xcdef('0x36')]?_0x22aa2b[_0xcdef('0x34')]:_0x58ffd7[_0xcdef('0x2f')];if(_0x36bb07[_0xcdef('0x33')][_0xcdef('0x3f')]){_0x22aa2b[_0xcdef('0x40')]=[{'all':!![]}];}_0x22aa2b=_[_0xcdef('0x3b')]({},_0x22aa2b,_0x36bb07[_0xcdef('0x3e')]);return db['DeskAccount'][_0xcdef('0x45')](_0x22aa2b)[_0xcdef('0x23')](handleEntityNotFound(_0x28c2f7,null))[_0xcdef('0x23')](respondWithResult(_0x28c2f7,null))['catch'](handleError(_0x28c2f7,null));};exports[_0xcdef('0x46')]=function(_0x3efd87,_0x16ce72){return db[_0xcdef('0x2a')]['create'](_0x3efd87[_0xcdef('0x47')],{})[_0xcdef('0x23')](respondWithResult(_0x16ce72,0xc9))[_0xcdef('0x42')](handleError(_0x16ce72,null));};exports['update']=function(_0x15cbdf,_0x1d31e2){if(_0x15cbdf['body']['id']){delete _0x15cbdf[_0xcdef('0x47')]['id'];}return db['DeskAccount'][_0xcdef('0x45')]({'where':{'id':_0x15cbdf[_0xcdef('0x44')]['id']}})[_0xcdef('0x23')](handleEntityNotFound(_0x1d31e2,null))['then'](saveUpdates(_0x15cbdf[_0xcdef('0x47')],null))[_0xcdef('0x23')](respondWithResult(_0x1d31e2,null))[_0xcdef('0x42')](handleError(_0x1d31e2,null));};exports['destroy']=function(_0x30c628,_0x1ee91c){return db[_0xcdef('0x2a')][_0xcdef('0x45')]({'where':{'id':_0x30c628[_0xcdef('0x44')]['id']}})['then'](handleEntityNotFound(_0x1ee91c,null))['then'](removeEntity(_0x1ee91c,null))[_0xcdef('0x42')](handleError(_0x1ee91c,null));};exports[_0xcdef('0x48')]=function(_0x57621e,_0x29f042,_0x4b83ab){var _0x5fb60e={};var _0x1e5714={};var _0x426eb4;var _0x368356;return db[_0xcdef('0x2a')][_0xcdef('0x49')]({'where':{'id':_0x57621e[_0xcdef('0x44')]['id']}})[_0xcdef('0x23')](handleEntityNotFound(_0x29f042,null))['then'](function(_0x4c223a){if(_0x4c223a){_0x426eb4=_0x4c223a;_0x1e5714[_0xcdef('0x2f')]=_[_0xcdef('0x30')](db['DeskConfiguration']['rawAttributes']);_0x1e5714['query']=_['keys'](_0x57621e['query']);_0x1e5714[_0xcdef('0x31')]=_[_0xcdef('0x32')](_0x1e5714['model'],_0x1e5714['query']);_0x5fb60e[_0xcdef('0x34')]=_[_0xcdef('0x32')](_0x1e5714[_0xcdef('0x2f')],qs[_0xcdef('0x35')](_0x57621e['query'][_0xcdef('0x35')]));_0x5fb60e[_0xcdef('0x34')]=_0x5fb60e[_0xcdef('0x34')]['length']?_0x5fb60e[_0xcdef('0x34')]:_0x1e5714[_0xcdef('0x2f')];_0x5fb60e['order']=qs[_0xcdef('0x39')](_0x57621e[_0xcdef('0x33')][_0xcdef('0x39')]);_0x5fb60e[_0xcdef('0x3c')]=qs[_0xcdef('0x31')](_['pick'](_0x57621e[_0xcdef('0x33')],_0x1e5714[_0xcdef('0x31')]));if(_0x57621e['query']['filter']){_0x5fb60e['where']=_[_0xcdef('0x3b')](_0x5fb60e[_0xcdef('0x3c')],{'$or':_['map'](_0x5fb60e[_0xcdef('0x34')],function(_0x92fde2){var _0x55ee2a={};_0x55ee2a[_0x92fde2]={'$like':'%'+_0x57621e[_0xcdef('0x33')][_0xcdef('0x3a')]+'%'};return _0x55ee2a;})});}_0x5fb60e=_['merge']({},_0x5fb60e,_0x57621e[_0xcdef('0x3e')]);return _0x426eb4['getConfigurations'](_0x5fb60e);}})[_0xcdef('0x23')](function(_0x5c65e5){if(_0x5c65e5){_0x368356=_0x5c65e5['length'];if(!_0x57621e[_0xcdef('0x33')]['hasOwnProperty'](_0xcdef('0x38'))){_0x5fb60e[_0xcdef('0x1d')]=qs['limit'](_0x57621e[_0xcdef('0x33')]['limit']);_0x5fb60e[_0xcdef('0x1b')]=qs['offset'](_0x57621e[_0xcdef('0x33')][_0xcdef('0x1b')]);}return _0x426eb4[_0xcdef('0x48')](_0x5fb60e);}})[_0xcdef('0x23')](function(_0x11f6ac){if(_0x11f6ac){return _0x11f6ac?{'count':_0x368356,'rows':_0x11f6ac}:null;}})[_0xcdef('0x23')](respondWithResult(_0x29f042,null))[_0xcdef('0x42')](handleError(_0x29f042,null));};exports[_0xcdef('0x4a')]=function(_0x9a7de8,_0x45456a,_0x52ece8){if(_0x9a7de8['body']['id']){delete _0x9a7de8[_0xcdef('0x47')]['id'];}return db[_0xcdef('0x2a')][_0xcdef('0x49')]({'where':{'id':_0x9a7de8['params']['id']}})[_0xcdef('0x23')](handleEntityNotFound(_0x45456a,null))[_0xcdef('0x23')](function(_0x1ff46a){if(_0x1ff46a){_0x9a7de8[_0xcdef('0x47')][_0xcdef('0x4b')]=_0x1ff46a['id'];_0x9a7de8[_0xcdef('0x47')][_0xcdef('0x4c')]=integrations['getSubjects'](_0x9a7de8[_0xcdef('0x47')]['channel'],_0x9a7de8[_0xcdef('0x47')][_0xcdef('0x2d')]);_0x9a7de8[_0xcdef('0x47')][_0xcdef('0x4d')]=integrations['getDescriptions'](_0x9a7de8[_0xcdef('0x47')][_0xcdef('0x4e')],_0x9a7de8['body'][_0xcdef('0x2d')]);return db[_0xcdef('0x4f')][_0xcdef('0x46')](_0x9a7de8[_0xcdef('0x47')],{'include':[{'model':db[_0xcdef('0x50')],'as':'Subjects'},{'model':db[_0xcdef('0x50')],'as':_0xcdef('0x4d')}]});}return null;})[_0xcdef('0x23')](respondWithResult(_0x45456a,null))[_0xcdef('0x42')](handleError(_0x45456a,null));};exports[_0xcdef('0x51')]=function(_0x55e2dd,_0x2fb677,_0x57a761){var _0x16bd26=[{'name':_0xcdef('0x52'),'label':'priority','custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x5ad459='';return db[_0xcdef('0x2a')]['findOne']({'where':{'id':_0x55e2dd[_0xcdef('0x44')]['id']},'attributes':['id','remoteUri',_0xcdef('0x53'),_0xcdef('0x54'),_0xcdef('0x55'),'consumerKey',_0xcdef('0x56'),_0xcdef('0x57'),_0xcdef('0x58')]})['then'](handleEntityNotFound(_0x2fb677,null))[_0xcdef('0x23')](function(_0x3b809c){if(_0x3b809c){_0x5ad459=_0x3b809c[_0xcdef('0x59')];var _0x590a71=_0x5ad459['slice'](-0x1);if(_0x590a71==='/'){_0x5ad459=_0x5ad459[_0xcdef('0x5a')](0x0,_0x5ad459[_0xcdef('0x5b')](_0x590a71));}var _0x54568a={'method':_0xcdef('0x5c'),'uri':util[_0xcdef('0x5d')](_0xcdef('0x5e'),_0x5ad459),'headers':{'Content-Type':_0xcdef('0x5f'),'Accept':_0xcdef('0x5f')},'json':!![]};if(_0x3b809c['authType']===_0xcdef('0x60')){_0x54568a[_0xcdef('0x61')]['Authorization']=util[_0xcdef('0x5d')](_0xcdef('0x62'),new Buffer(util['format']('%s:%s',_0x3b809c[_0xcdef('0x54')],_0x3b809c[_0xcdef('0x55')]))['toString'](_0xcdef('0x63')));}return rp(_0x54568a)[_0xcdef('0x23')](function(_0x52d231){return _0x16bd26['concat'](_[_0xcdef('0x29')](_0x52d231[_0xcdef('0x64')][_0xcdef('0x65')],function(_0x3d41a7){return{'id':_0x3d41a7[_0xcdef('0x27')],'name':_0x3d41a7['name'],'type':_0x3d41a7[_0xcdef('0x2d')],'active':_0x3d41a7['active'],'label':_0x3d41a7[_0xcdef('0x66')],'custom':!![]};}));});}})[_0xcdef('0x23')](function(_0x118218){return{'count':_0x118218[_0xcdef('0x36')],'rows':_0x118218};})['then'](respondWithResult(_0x2fb677,null))[_0xcdef('0x42')](function(_0x4d8e7e){var _0x5494d8=_0x55e2dd[_0xcdef('0x33')][_0xcdef('0x67')]?0x1f4:_0x4d8e7e['statusCode']||0x1f4;logger[_0xcdef('0x25')]('getFields,\x20%s,\x20%s,\x20%s',_0xcdef('0x51'),_0x5494d8,JSON[_0xcdef('0x68')](_0x4d8e7e));delete _0x4d8e7e[_0xcdef('0x27')];if(_0x5494d8===0x191){_0x5494d8=0x190;}_0x2fb677[_0xcdef('0x19')](_0x5494d8)[_0xcdef('0x28')](_0x55e2dd[_0xcdef('0x33')][_0xcdef('0x67')]?{'message':_0xcdef('0x69'),'statusCode':_0x4d8e7e[_0xcdef('0x6a')]}:_0x4d8e7e);});}; \ No newline at end of file +var _0x3e6a=['count','offset','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','DeskAccount','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','find','create','body','params','getConfigurations','findOne','DeskConfiguration','pick','addConfiguration','Subjects','getSubjects','channel','DeskField','getFields','priority','authType','username','consumerKey','token','tokenSecret','slice','substring','lastIndexOf','GET','%s/custom_fields','application/json','basic','headers','Authorization','format','Basic\x20%s','%s:%s','password','toString','base64','concat','_embedded','entries','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../components/integrations/configuration','status','end','undefined'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x3e6a,0x1b3));var _0xa3e6=function(_0x5bf493,_0x3c46bf){_0x5bf493=_0x5bf493-0x0;var _0x5e69b1=_0x3e6a[_0x5bf493];return _0x5e69b1;};'use strict';var emlformat=require(_0xa3e6('0x0'));var rimraf=require(_0xa3e6('0x1'));var zipdir=require(_0xa3e6('0x2'));var jsonpatch=require(_0xa3e6('0x3'));var rp=require(_0xa3e6('0x4'));var moment=require(_0xa3e6('0x5'));var BPromise=require(_0xa3e6('0x6'));var Mustache=require(_0xa3e6('0x7'));var util=require(_0xa3e6('0x8'));var path=require('path');var sox=require(_0xa3e6('0x9'));var csv=require(_0xa3e6('0xa'));var ejs=require(_0xa3e6('0xb'));var fs=require('fs');var fs_extra=require(_0xa3e6('0xc'));var _=require(_0xa3e6('0xd'));var squel=require(_0xa3e6('0xe'));var crypto=require(_0xa3e6('0xf'));var jsforce=require(_0xa3e6('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xa3e6('0xa'));var querystring=require(_0xa3e6('0x11'));var Papa=require(_0xa3e6('0x12'));var Redis=require(_0xa3e6('0x13'));var authService=require(_0xa3e6('0x14'));var qs=require(_0xa3e6('0x15'));var as=require(_0xa3e6('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa3e6('0x17'))('api');var utils=require(_0xa3e6('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0xa3e6('0x19'));function respondWithStatusCode(_0x5c5cdd,_0x1a56d3){_0x1a56d3=_0x1a56d3||0xcc;return function(_0x430be3){if(_0x430be3){return _0x5c5cdd['sendStatus'](_0x1a56d3);}return _0x5c5cdd[_0xa3e6('0x1a')](_0x1a56d3)[_0xa3e6('0x1b')]();};}function respondWithResult(_0x3ebc1e,_0x1b0538){_0x1b0538=_0x1b0538||0xc8;return function(_0x3c885f){if(_0x3c885f){return _0x3ebc1e['status'](_0x1b0538)['json'](_0x3c885f);}};}function respondWithFilteredResult(_0x4618b0,_0x561273){return function(_0x232ddc){if(_0x232ddc){var _0x2cfede=typeof _0x561273['offset']===_0xa3e6('0x1c')&&typeof _0x561273['limit']===_0xa3e6('0x1c');var _0x17dc06=_0x232ddc[_0xa3e6('0x1d')];var _0x4e793a=_0x2cfede?0x0:_0x561273[_0xa3e6('0x1e')];var _0x32af92=_0x2cfede?_0x232ddc[_0xa3e6('0x1d')]:_0x561273['offset']+_0x561273['limit'];var _0x359a5d;if(_0x32af92>=_0x17dc06){_0x32af92=_0x17dc06;_0x359a5d=0xc8;}else{_0x359a5d=0xce;}_0x4618b0[_0xa3e6('0x1a')](_0x359a5d);return _0x4618b0['set'](_0xa3e6('0x1f'),_0x4e793a+'-'+_0x32af92+'/'+_0x17dc06)[_0xa3e6('0x20')](_0x232ddc);}return null;};}function patchUpdates(_0x4dd100){return function(_0x585e52){try{jsonpatch[_0xa3e6('0x21')](_0x585e52,_0x4dd100,!![]);}catch(_0x48c0b7){return BPromise[_0xa3e6('0x22')](_0x48c0b7);}return _0x585e52[_0xa3e6('0x23')]();};}function saveUpdates(_0x4db68e,_0x2b74d8){return function(_0x362af7){if(_0x362af7){return _0x362af7[_0xa3e6('0x24')](_0x4db68e)[_0xa3e6('0x25')](function(_0x16a5d8){return _0x16a5d8;});}return null;};}function removeEntity(_0x149c92,_0x2d9eb9){return function(_0xc9333c){if(_0xc9333c){return _0xc9333c[_0xa3e6('0x26')]()[_0xa3e6('0x25')](function(){_0x149c92['status'](0xcc)[_0xa3e6('0x1b')]();});}};}function handleEntityNotFound(_0xa48a13,_0x341138){return function(_0x3ad7ce){if(!_0x3ad7ce){_0xa48a13[_0xa3e6('0x27')](0x194);}return _0x3ad7ce;};}function handleError(_0x21f8bc,_0x4044ab){_0x4044ab=_0x4044ab||0x1f4;return function(_0x334e86){logger[_0xa3e6('0x28')](_0x334e86[_0xa3e6('0x29')]);if(_0x334e86[_0xa3e6('0x2a')]){delete _0x334e86[_0xa3e6('0x2a')];}_0x21f8bc[_0xa3e6('0x1a')](_0x4044ab)[_0xa3e6('0x2b')](_0x334e86);};}exports[_0xa3e6('0x2c')]=function(_0x1bb7a6,_0x29fc0d){var _0x28ac95={},_0x2fe75d={},_0x42a5f0={'count':0x0,'rows':[]};var _0x1aed47=_[_0xa3e6('0x2d')](db[_0xa3e6('0x2e')][_0xa3e6('0x2f')],function(_0x263092){return{'name':_0x263092['fieldName'],'type':_0x263092[_0xa3e6('0x30')][_0xa3e6('0x31')]};});_0x2fe75d[_0xa3e6('0x32')]=_[_0xa3e6('0x2d')](_0x1aed47,'name');_0x2fe75d['query']=_[_0xa3e6('0x33')](_0x1bb7a6[_0xa3e6('0x34')]);_0x2fe75d[_0xa3e6('0x35')]=_[_0xa3e6('0x36')](_0x2fe75d[_0xa3e6('0x32')],_0x2fe75d[_0xa3e6('0x34')]);_0x28ac95[_0xa3e6('0x37')]=_['intersection'](_0x2fe75d['model'],qs[_0xa3e6('0x38')](_0x1bb7a6[_0xa3e6('0x34')][_0xa3e6('0x38')]));_0x28ac95[_0xa3e6('0x37')]=_0x28ac95[_0xa3e6('0x37')][_0xa3e6('0x39')]?_0x28ac95['attributes']:_0x2fe75d[_0xa3e6('0x32')];if(!_0x1bb7a6[_0xa3e6('0x34')][_0xa3e6('0x3a')](_0xa3e6('0x3b'))){_0x28ac95[_0xa3e6('0x3c')]=qs[_0xa3e6('0x3c')](_0x1bb7a6[_0xa3e6('0x34')][_0xa3e6('0x3c')]);_0x28ac95[_0xa3e6('0x1e')]=qs[_0xa3e6('0x1e')](_0x1bb7a6[_0xa3e6('0x34')]['offset']);}_0x28ac95[_0xa3e6('0x3d')]=qs['sort'](_0x1bb7a6[_0xa3e6('0x34')][_0xa3e6('0x3e')]);_0x28ac95[_0xa3e6('0x3f')]=qs[_0xa3e6('0x35')](_['pick'](_0x1bb7a6[_0xa3e6('0x34')],_0x2fe75d[_0xa3e6('0x35')]),_0x1aed47);if(_0x1bb7a6[_0xa3e6('0x34')][_0xa3e6('0x40')]){_0x28ac95[_0xa3e6('0x3f')]=_['merge'](_0x28ac95[_0xa3e6('0x3f')],{'$or':_[_0xa3e6('0x2d')](_0x1aed47,function(_0x319f3e){if(_0x319f3e[_0xa3e6('0x30')]!==_0xa3e6('0x41')){var _0x3ebba8={};_0x3ebba8[_0x319f3e[_0xa3e6('0x2a')]]={'$like':'%'+_0x1bb7a6['query']['filter']+'%'};return _0x3ebba8;}})});}_0x28ac95=_[_0xa3e6('0x42')]({},_0x28ac95,_0x1bb7a6['options']);var _0x2577dd={'where':_0x28ac95[_0xa3e6('0x3f')]};return db[_0xa3e6('0x2e')][_0xa3e6('0x1d')](_0x2577dd)[_0xa3e6('0x25')](function(_0x205717){_0x42a5f0[_0xa3e6('0x1d')]=_0x205717;if(_0x1bb7a6[_0xa3e6('0x34')][_0xa3e6('0x43')]){_0x28ac95[_0xa3e6('0x44')]=[{'all':!![]}];}return db['DeskAccount'][_0xa3e6('0x45')](_0x28ac95);})['then'](function(_0xe53853){_0x42a5f0[_0xa3e6('0x46')]=_0xe53853;return _0x42a5f0;})['then'](respondWithFilteredResult(_0x29fc0d,_0x28ac95))[_0xa3e6('0x47')](handleError(_0x29fc0d,null));};exports['show']=function(_0x377d85,_0x51a466){var _0x5949f0={'raw':![],'where':{'id':_0x377d85['params']['id']}},_0x115232={};_0x115232[_0xa3e6('0x32')]=_[_0xa3e6('0x33')](db[_0xa3e6('0x2e')]['rawAttributes']);_0x115232[_0xa3e6('0x34')]=_[_0xa3e6('0x33')](_0x377d85[_0xa3e6('0x34')]);_0x115232[_0xa3e6('0x35')]=_[_0xa3e6('0x36')](_0x115232[_0xa3e6('0x32')],_0x115232[_0xa3e6('0x34')]);_0x5949f0[_0xa3e6('0x37')]=_[_0xa3e6('0x36')](_0x115232['model'],qs['fields'](_0x377d85[_0xa3e6('0x34')][_0xa3e6('0x38')]));_0x5949f0['attributes']=_0x5949f0[_0xa3e6('0x37')][_0xa3e6('0x39')]?_0x5949f0[_0xa3e6('0x37')]:_0x115232[_0xa3e6('0x32')];if(_0x377d85['query'][_0xa3e6('0x43')]){_0x5949f0[_0xa3e6('0x44')]=[{'all':!![]}];}_0x5949f0=_[_0xa3e6('0x42')]({},_0x5949f0,_0x377d85['options']);return db[_0xa3e6('0x2e')][_0xa3e6('0x48')](_0x5949f0)[_0xa3e6('0x25')](handleEntityNotFound(_0x51a466,null))[_0xa3e6('0x25')](respondWithResult(_0x51a466,null))[_0xa3e6('0x47')](handleError(_0x51a466,null));};exports['create']=function(_0xa75183,_0x560cea){return db['DeskAccount'][_0xa3e6('0x49')](_0xa75183[_0xa3e6('0x4a')],{})['then'](respondWithResult(_0x560cea,0xc9))['catch'](handleError(_0x560cea,null));};exports[_0xa3e6('0x24')]=function(_0x25ec58,_0x5b3774){if(_0x25ec58['body']['id']){delete _0x25ec58[_0xa3e6('0x4a')]['id'];}return db['DeskAccount']['find']({'where':{'id':_0x25ec58[_0xa3e6('0x4b')]['id']}})[_0xa3e6('0x25')](handleEntityNotFound(_0x5b3774,null))['then'](saveUpdates(_0x25ec58[_0xa3e6('0x4a')],null))[_0xa3e6('0x25')](respondWithResult(_0x5b3774,null))['catch'](handleError(_0x5b3774,null));};exports[_0xa3e6('0x26')]=function(_0xe0defc,_0x24e8cb){return db[_0xa3e6('0x2e')][_0xa3e6('0x48')]({'where':{'id':_0xe0defc['params']['id']}})[_0xa3e6('0x25')](handleEntityNotFound(_0x24e8cb,null))['then'](removeEntity(_0x24e8cb,null))[_0xa3e6('0x47')](handleError(_0x24e8cb,null));};exports[_0xa3e6('0x4c')]=function(_0x4dd348,_0x1ac366,_0x274433){var _0x21f243={};var _0x4fe3a3={};var _0x344db6;var _0x4faeae;return db['DeskAccount'][_0xa3e6('0x4d')]({'where':{'id':_0x4dd348['params']['id']}})[_0xa3e6('0x25')](handleEntityNotFound(_0x1ac366,null))[_0xa3e6('0x25')](function(_0x96d769){if(_0x96d769){_0x344db6=_0x96d769;_0x4fe3a3[_0xa3e6('0x32')]=_[_0xa3e6('0x33')](db[_0xa3e6('0x4e')][_0xa3e6('0x2f')]);_0x4fe3a3[_0xa3e6('0x34')]=_[_0xa3e6('0x33')](_0x4dd348[_0xa3e6('0x34')]);_0x4fe3a3['filters']=_[_0xa3e6('0x36')](_0x4fe3a3[_0xa3e6('0x32')],_0x4fe3a3[_0xa3e6('0x34')]);_0x21f243[_0xa3e6('0x37')]=_[_0xa3e6('0x36')](_0x4fe3a3[_0xa3e6('0x32')],qs[_0xa3e6('0x38')](_0x4dd348[_0xa3e6('0x34')]['fields']));_0x21f243[_0xa3e6('0x37')]=_0x21f243[_0xa3e6('0x37')]['length']?_0x21f243[_0xa3e6('0x37')]:_0x4fe3a3[_0xa3e6('0x32')];_0x21f243[_0xa3e6('0x3d')]=qs[_0xa3e6('0x3e')](_0x4dd348[_0xa3e6('0x34')][_0xa3e6('0x3e')]);_0x21f243[_0xa3e6('0x3f')]=qs[_0xa3e6('0x35')](_[_0xa3e6('0x4f')](_0x4dd348[_0xa3e6('0x34')],_0x4fe3a3[_0xa3e6('0x35')]));if(_0x4dd348[_0xa3e6('0x34')][_0xa3e6('0x40')]){_0x21f243[_0xa3e6('0x3f')]=_[_0xa3e6('0x42')](_0x21f243[_0xa3e6('0x3f')],{'$or':_[_0xa3e6('0x2d')](_0x21f243[_0xa3e6('0x37')],function(_0x3a5544){var _0x40e9d1={};_0x40e9d1[_0x3a5544]={'$like':'%'+_0x4dd348[_0xa3e6('0x34')][_0xa3e6('0x40')]+'%'};return _0x40e9d1;})});}_0x21f243=_[_0xa3e6('0x42')]({},_0x21f243,_0x4dd348['options']);return _0x344db6['getConfigurations'](_0x21f243);}})[_0xa3e6('0x25')](function(_0x4fc272){if(_0x4fc272){_0x4faeae=_0x4fc272[_0xa3e6('0x39')];if(!_0x4dd348[_0xa3e6('0x34')][_0xa3e6('0x3a')](_0xa3e6('0x3b'))){_0x21f243[_0xa3e6('0x3c')]=qs['limit'](_0x4dd348[_0xa3e6('0x34')]['limit']);_0x21f243[_0xa3e6('0x1e')]=qs[_0xa3e6('0x1e')](_0x4dd348['query']['offset']);}return _0x344db6['getConfigurations'](_0x21f243);}})[_0xa3e6('0x25')](function(_0x55a311){if(_0x55a311){return _0x55a311?{'count':_0x4faeae,'rows':_0x55a311}:null;}})[_0xa3e6('0x25')](respondWithResult(_0x1ac366,null))[_0xa3e6('0x47')](handleError(_0x1ac366,null));};exports[_0xa3e6('0x50')]=function(_0x463432,_0x3e35ef,_0x5c690b){if(_0x463432['body']['id']){delete _0x463432['body']['id'];}return db[_0xa3e6('0x2e')][_0xa3e6('0x4d')]({'where':{'id':_0x463432['params']['id']}})[_0xa3e6('0x25')](handleEntityNotFound(_0x3e35ef,null))[_0xa3e6('0x25')](function(_0x3d1538){if(_0x3d1538){_0x463432['body']['AccountId']=_0x3d1538['id'];_0x463432[_0xa3e6('0x4a')][_0xa3e6('0x51')]=integrations[_0xa3e6('0x52')](_0x463432[_0xa3e6('0x4a')][_0xa3e6('0x53')],_0x463432[_0xa3e6('0x4a')][_0xa3e6('0x30')]);_0x463432['body']['Descriptions']=integrations['getDescriptions'](_0x463432[_0xa3e6('0x4a')][_0xa3e6('0x53')],_0x463432[_0xa3e6('0x4a')]['type']);return db[_0xa3e6('0x4e')][_0xa3e6('0x49')](_0x463432['body'],{'include':[{'model':db[_0xa3e6('0x54')],'as':'Subjects'},{'model':db['DeskField'],'as':'Descriptions'}]});}return null;})[_0xa3e6('0x25')](respondWithResult(_0x3e35ef,null))[_0xa3e6('0x47')](handleError(_0x3e35ef,null));};exports[_0xa3e6('0x55')]=function(_0x335eff,_0x4d9a43,_0x55cbf9){var _0x1ed454=[{'name':_0xa3e6('0x56'),'label':'priority','custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x44e867='';return db['DeskAccount'][_0xa3e6('0x4d')]({'where':{'id':_0x335eff[_0xa3e6('0x4b')]['id']},'attributes':['id','remoteUri',_0xa3e6('0x57'),_0xa3e6('0x58'),'password',_0xa3e6('0x59'),'consumerSecret',_0xa3e6('0x5a'),_0xa3e6('0x5b')]})['then'](handleEntityNotFound(_0x4d9a43,null))['then'](function(_0x44a8b4){if(_0x44a8b4){_0x44e867=_0x44a8b4['remoteUri'];var _0x5d3558=_0x44e867[_0xa3e6('0x5c')](-0x1);if(_0x5d3558==='/'){_0x44e867=_0x44e867[_0xa3e6('0x5d')](0x0,_0x44e867[_0xa3e6('0x5e')](_0x5d3558));}var _0x430bb0={'method':_0xa3e6('0x5f'),'uri':util['format'](_0xa3e6('0x60'),_0x44e867),'headers':{'Content-Type':_0xa3e6('0x61'),'Accept':_0xa3e6('0x61')},'json':!![]};if(_0x44a8b4[_0xa3e6('0x57')]===_0xa3e6('0x62')){_0x430bb0[_0xa3e6('0x63')][_0xa3e6('0x64')]=util[_0xa3e6('0x65')](_0xa3e6('0x66'),new Buffer(util[_0xa3e6('0x65')](_0xa3e6('0x67'),_0x44a8b4[_0xa3e6('0x58')],_0x44a8b4[_0xa3e6('0x68')]))[_0xa3e6('0x69')](_0xa3e6('0x6a')));}return rp(_0x430bb0)[_0xa3e6('0x25')](function(_0x4d94ad){return _0x1ed454[_0xa3e6('0x6b')](_['map'](_0x4d94ad[_0xa3e6('0x6c')][_0xa3e6('0x6d')],function(_0x5896ad){return{'id':_0x5896ad[_0xa3e6('0x2a')],'name':_0x5896ad[_0xa3e6('0x2a')],'type':_0x5896ad[_0xa3e6('0x30')],'active':_0x5896ad['active'],'label':_0x5896ad[_0xa3e6('0x6e')],'custom':!![]};}));});}})['then'](function(_0x502dc9){return{'count':_0x502dc9['length'],'rows':_0x502dc9};})[_0xa3e6('0x25')](respondWithResult(_0x4d9a43,null))[_0xa3e6('0x47')](function(_0x55ac6c){var _0x14215b=_0x335eff[_0xa3e6('0x34')][_0xa3e6('0x6f')]?0x1f4:_0x55ac6c[_0xa3e6('0x70')]||0x1f4;logger[_0xa3e6('0x28')](_0xa3e6('0x71'),_0xa3e6('0x55'),_0x14215b,JSON[_0xa3e6('0x72')](_0x55ac6c));delete _0x55ac6c['name'];if(_0x14215b===0x191){_0x14215b=0x190;}_0x4d9a43[_0xa3e6('0x1a')](_0x14215b)['send'](_0x335eff[_0xa3e6('0x34')][_0xa3e6('0x6f')]?{'message':_0xa3e6('0x73'),'statusCode':_0x55ac6c[_0xa3e6('0x70')]}:_0x55ac6c);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 9135fb7..deff831 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 _0x0ec7=['api','moment','bluebird','request-promise','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','int_desk_accounts','lodash','util','../../config/logger'];(function(_0x14eb8c,_0x18dbd6){var _0x1e1167=function(_0x37ee80){while(--_0x37ee80){_0x14eb8c['push'](_0x14eb8c['shift']());}};_0x1e1167(++_0x18dbd6);}(_0x0ec7,0x10e));var _0x70ec=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x0ec7[_0x110c3d];return _0x226d67;};'use strict';var _=require(_0x70ec('0x0'));var util=require(_0x70ec('0x1'));var logger=require(_0x70ec('0x2'))(_0x70ec('0x3'));var moment=require(_0x70ec('0x4'));var BPromise=require(_0x70ec('0x5'));var rp=require(_0x70ec('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x70ec('0x7'));var config=require(_0x70ec('0x8'));var attributes=require('./intDeskAccount.attributes');var integrations=require(_0x70ec('0x9'));module[_0x70ec('0xa')]=function(_0x22ed2d,_0x75b865){return _0x22ed2d[_0x70ec('0xb')]('DeskAccount',attributes,{'tableName':_0x70ec('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd4f9=['moment','bluebird','path','../../config/environment','exports','DeskAccount','lodash','util','../../config/logger','api'];(function(_0x3b5250,_0x7a0b2c){var _0xc844a1=function(_0x2fbc98){while(--_0x2fbc98){_0x3b5250['push'](_0x3b5250['shift']());}};_0xc844a1(++_0x7a0b2c);}(_0xd4f9,0x114));var _0x9d4f=function(_0x5cda2c,_0x11dab1){_0x5cda2c=_0x5cda2c-0x0;var _0x53430b=_0xd4f9[_0x5cda2c];return _0x53430b;};'use strict';var _=require(_0x9d4f('0x0'));var util=require(_0x9d4f('0x1'));var logger=require(_0x9d4f('0x2'))(_0x9d4f('0x3'));var moment=require(_0x9d4f('0x4'));var BPromise=require(_0x9d4f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9d4f('0x6'));var rimraf=require('rimraf');var config=require(_0x9d4f('0x7'));var attributes=require('./intDeskAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x9d4f('0x8')]=function(_0x4db661,_0x570ecb){return _0x4db661['define'](_0x9d4f('0x9'),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 ca764e7..e4f6a3c 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 _0x9604=['DeskAccount,\x20%s,\x20%s','message','info','catch','DeskAccount','findAll','options','raw','where','attributes','include','map','model','GetDeskAccount','ShowDeskAccount','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','stringify','error'];(function(_0x36e8fa,_0x1d2b32){var _0x2b5c4a=function(_0x237da6){while(--_0x237da6){_0x36e8fa['push'](_0x36e8fa['shift']());}};_0x2b5c4a(++_0x1d2b32);}(_0x9604,0x6f));var _0x4960=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9604[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4960('0x0'));var util=require(_0x4960('0x1'));var moment=require('moment');var BPromise=require(_0x4960('0x2'));var rs=require(_0x4960('0x3'));var fs=require('fs');var Redis=require(_0x4960('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4960('0x5'));var logger=require(_0x4960('0x6'))(_0x4960('0x7'));var config=require(_0x4960('0x8'));var jayson=require(_0x4960('0x9'));var client=jayson[_0x4960('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3831b9,_0x2a476e,_0x5c43b6){return new BPromise(function(_0x12059d,_0x45c390){return client[_0x4960('0xb')](_0x3831b9,_0x5c43b6)[_0x4960('0xc')](function(_0x1cc494){logger['info']('DeskAccount,\x20%s,\x20%s',_0x2a476e,_0x4960('0xd'));logger[_0x4960('0xe')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x2a476e,_0x4960('0xd'),JSON[_0x4960('0xf')](_0x1cc494));if(_0x1cc494[_0x4960('0x10')]){if(_0x1cc494[_0x4960('0x10')]['code']===0x1f4){logger[_0x4960('0x10')](_0x4960('0x11'),_0x2a476e,_0x1cc494[_0x4960('0x10')]['message']);return _0x45c390(_0x1cc494['error'][_0x4960('0x12')]);}logger[_0x4960('0x10')](_0x4960('0x11'),_0x2a476e,_0x1cc494[_0x4960('0x10')][_0x4960('0x12')]);return _0x12059d(_0x1cc494[_0x4960('0x10')][_0x4960('0x12')]);}else{logger[_0x4960('0x13')](_0x4960('0x11'),_0x2a476e,_0x4960('0xd'));_0x12059d(_0x1cc494['result'][_0x4960('0x12')]);}})[_0x4960('0x14')](function(_0x36b652){logger[_0x4960('0x10')](_0x4960('0x11'),_0x2a476e,_0x36b652);_0x45c390(_0x36b652);});});}exports['GetDeskAccount']=function(_0x38010c){var _0x479149=this;return new Promise(function(_0x443239,_0x30538c){return db[_0x4960('0x15')][_0x4960('0x16')]({'raw':_0x38010c[_0x4960('0x17')]?_0x38010c['options'][_0x4960('0x18')]===undefined?!![]:![]:!![],'where':_0x38010c[_0x4960('0x17')]?_0x38010c[_0x4960('0x17')][_0x4960('0x19')]||null:null,'attributes':_0x38010c[_0x4960('0x17')]?_0x38010c[_0x4960('0x17')][_0x4960('0x1a')]||null:null,'limit':_0x38010c[_0x4960('0x17')]?_0x38010c['options']['limit']||null:null,'include':_0x38010c[_0x4960('0x17')]?_0x38010c[_0x4960('0x17')][_0x4960('0x1b')]?_[_0x4960('0x1c')](_0x38010c['options'][_0x4960('0x1b')],function(_0x27d9e8){return{'model':db[_0x27d9e8[_0x4960('0x1d')]],'as':_0x27d9e8['as'],'attributes':_0x27d9e8[_0x4960('0x1a')],'include':_0x27d9e8['include']?_['map'](_0x27d9e8[_0x4960('0x1b')],function(_0xac750d){return{'model':db[_0xac750d[_0x4960('0x1d')]],'as':_0xac750d['as'],'attributes':_0xac750d[_0x4960('0x1a')],'include':_0xac750d[_0x4960('0x1b')]?_[_0x4960('0x1c')](_0xac750d[_0x4960('0x1b')],function(_0x3485cf){return{'model':db[_0x3485cf[_0x4960('0x1d')]],'as':_0x3485cf['as'],'attributes':_0x3485cf[_0x4960('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x4960('0xc')](function(_0x17f364){logger['info']('GetDeskAccount',_0x38010c);logger['debug']('GetDeskAccount',_0x38010c,JSON['stringify'](_0x17f364));_0x443239(_0x17f364);})[_0x4960('0x14')](function(_0x52a9fe){logger['error'](_0x4960('0x1e'),_0x52a9fe[_0x4960('0x12')],_0x38010c);_0x30538c(_0x479149[_0x4960('0x10')](0x1f4,_0x52a9fe[_0x4960('0x12')]));});});};exports[_0x4960('0x1f')]=function(_0x30d69d){var _0x927cc0=this;return new Promise(function(_0x53feb7,_0x953b46){return db['DeskAccount']['find']({'raw':_0x30d69d[_0x4960('0x17')]?_0x30d69d['options'][_0x4960('0x18')]===undefined?!![]:![]:!![],'where':_0x30d69d['options']?_0x30d69d[_0x4960('0x17')][_0x4960('0x19')]||null:null,'attributes':_0x30d69d[_0x4960('0x17')]?_0x30d69d['options'][_0x4960('0x1a')]||null:null,'include':_0x30d69d['options']?_0x30d69d[_0x4960('0x17')][_0x4960('0x1b')]?_['map'](_0x30d69d[_0x4960('0x17')][_0x4960('0x1b')],function(_0x4b1f23){return{'model':db[_0x4b1f23[_0x4960('0x1d')]],'as':_0x4b1f23['as'],'attributes':_0x4b1f23[_0x4960('0x1a')],'include':_0x4b1f23[_0x4960('0x1b')]?_['map'](_0x4b1f23[_0x4960('0x1b')],function(_0xa18256){return{'model':db[_0xa18256[_0x4960('0x1d')]],'as':_0xa18256['as'],'attributes':_0xa18256[_0x4960('0x1a')],'include':_0xa18256[_0x4960('0x1b')]?_['map'](_0xa18256[_0x4960('0x1b')],function(_0x4450d9){return{'model':db[_0x4450d9[_0x4960('0x1d')]],'as':_0x4450d9['as'],'attributes':_0x4450d9[_0x4960('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x4960('0xc')](function(_0x3c2112){logger[_0x4960('0x13')](_0x4960('0x1f'),_0x30d69d);logger[_0x4960('0xe')]('ShowDeskAccount',_0x30d69d,JSON['stringify'](_0x3c2112));_0x53feb7(_0x3c2112);})['catch'](function(_0x456ecb){logger['error'](_0x4960('0x1f'),_0x456ecb[_0x4960('0x12')],_0x30d69d);_0x953b46(_0x927cc0[_0x4960('0x10')](0x1f4,_0x456ecb[_0x4960('0x12')]));});});}; \ No newline at end of file +var _0x9f84=['lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','then','info','request\x20sent','debug','error','code','DeskAccount,\x20%s,\x20%s','message','result','catch','GetDeskAccount','DeskAccount','findAll','options','raw','where','attributes','limit','include','model','map','ShowDeskAccount','find','stringify'];(function(_0x4b075e,_0x57874c){var _0x31385c=function(_0x3ab6ef){while(--_0x3ab6ef){_0x4b075e['push'](_0x4b075e['shift']());}};_0x31385c(++_0x57874c);}(_0x9f84,0x1c7));var _0x49f8=function(_0x493a95,_0x4cfccb){_0x493a95=_0x493a95-0x0;var _0x1cac44=_0x9f84[_0x493a95];return _0x1cac44;};'use strict';var _=require(_0x49f8('0x0'));var util=require(_0x49f8('0x1'));var moment=require(_0x49f8('0x2'));var BPromise=require('bluebird');var rs=require(_0x49f8('0x3'));var fs=require('fs');var Redis=require(_0x49f8('0x4'));var db=require(_0x49f8('0x5'))['db'];var utils=require(_0x49f8('0x6'));var logger=require('../../config/logger')(_0x49f8('0x7'));var config=require(_0x49f8('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x49f8('0x9')][_0x49f8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x137a61,_0x280cb9,_0x586c99){return new BPromise(function(_0x342a8e,_0x564d9e){return client['request'](_0x137a61,_0x586c99)[_0x49f8('0xb')](function(_0x53849b){logger[_0x49f8('0xc')]('DeskAccount,\x20%s,\x20%s',_0x280cb9,_0x49f8('0xd'));logger[_0x49f8('0xe')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x280cb9,_0x49f8('0xd'),JSON['stringify'](_0x53849b));if(_0x53849b[_0x49f8('0xf')]){if(_0x53849b[_0x49f8('0xf')][_0x49f8('0x10')]===0x1f4){logger[_0x49f8('0xf')](_0x49f8('0x11'),_0x280cb9,_0x53849b[_0x49f8('0xf')][_0x49f8('0x12')]);return _0x564d9e(_0x53849b[_0x49f8('0xf')][_0x49f8('0x12')]);}logger[_0x49f8('0xf')](_0x49f8('0x11'),_0x280cb9,_0x53849b[_0x49f8('0xf')]['message']);return _0x342a8e(_0x53849b[_0x49f8('0xf')]['message']);}else{logger[_0x49f8('0xc')](_0x49f8('0x11'),_0x280cb9,_0x49f8('0xd'));_0x342a8e(_0x53849b[_0x49f8('0x13')][_0x49f8('0x12')]);}})[_0x49f8('0x14')](function(_0x155054){logger[_0x49f8('0xf')]('DeskAccount,\x20%s,\x20%s',_0x280cb9,_0x155054);_0x564d9e(_0x155054);});});}exports[_0x49f8('0x15')]=function(_0x280d45){var _0x1462c5=this;return new Promise(function(_0x393528,_0x1afe68){return db[_0x49f8('0x16')][_0x49f8('0x17')]({'raw':_0x280d45[_0x49f8('0x18')]?_0x280d45[_0x49f8('0x18')][_0x49f8('0x19')]===undefined?!![]:![]:!![],'where':_0x280d45[_0x49f8('0x18')]?_0x280d45[_0x49f8('0x18')][_0x49f8('0x1a')]||null:null,'attributes':_0x280d45['options']?_0x280d45[_0x49f8('0x18')][_0x49f8('0x1b')]||null:null,'limit':_0x280d45[_0x49f8('0x18')]?_0x280d45[_0x49f8('0x18')][_0x49f8('0x1c')]||null:null,'include':_0x280d45['options']?_0x280d45['options']['include']?_['map'](_0x280d45[_0x49f8('0x18')][_0x49f8('0x1d')],function(_0x130eca){return{'model':db[_0x130eca[_0x49f8('0x1e')]],'as':_0x130eca['as'],'attributes':_0x130eca[_0x49f8('0x1b')],'include':_0x130eca[_0x49f8('0x1d')]?_[_0x49f8('0x1f')](_0x130eca[_0x49f8('0x1d')],function(_0x5a248d){return{'model':db[_0x5a248d[_0x49f8('0x1e')]],'as':_0x5a248d['as'],'attributes':_0x5a248d[_0x49f8('0x1b')],'include':_0x5a248d[_0x49f8('0x1d')]?_[_0x49f8('0x1f')](_0x5a248d[_0x49f8('0x1d')],function(_0x552b18){return{'model':db[_0x552b18[_0x49f8('0x1e')]],'as':_0x552b18['as'],'attributes':_0x552b18[_0x49f8('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x510a7c){logger[_0x49f8('0xc')]('GetDeskAccount',_0x280d45);logger[_0x49f8('0xe')](_0x49f8('0x15'),_0x280d45,JSON['stringify'](_0x510a7c));_0x393528(_0x510a7c);})[_0x49f8('0x14')](function(_0x2f79f0){logger[_0x49f8('0xf')](_0x49f8('0x15'),_0x2f79f0[_0x49f8('0x12')],_0x280d45);_0x1afe68(_0x1462c5[_0x49f8('0xf')](0x1f4,_0x2f79f0[_0x49f8('0x12')]));});});};exports[_0x49f8('0x20')]=function(_0x5deb61){var _0x487b31=this;return new Promise(function(_0x132691,_0x3674d1){return db['DeskAccount'][_0x49f8('0x21')]({'raw':_0x5deb61[_0x49f8('0x18')]?_0x5deb61['options'][_0x49f8('0x19')]===undefined?!![]:![]:!![],'where':_0x5deb61['options']?_0x5deb61[_0x49f8('0x18')][_0x49f8('0x1a')]||null:null,'attributes':_0x5deb61[_0x49f8('0x18')]?_0x5deb61[_0x49f8('0x18')][_0x49f8('0x1b')]||null:null,'include':_0x5deb61[_0x49f8('0x18')]?_0x5deb61[_0x49f8('0x18')][_0x49f8('0x1d')]?_[_0x49f8('0x1f')](_0x5deb61[_0x49f8('0x18')][_0x49f8('0x1d')],function(_0x56f722){return{'model':db[_0x56f722[_0x49f8('0x1e')]],'as':_0x56f722['as'],'attributes':_0x56f722[_0x49f8('0x1b')],'include':_0x56f722[_0x49f8('0x1d')]?_[_0x49f8('0x1f')](_0x56f722[_0x49f8('0x1d')],function(_0x28a5a6){return{'model':db[_0x28a5a6[_0x49f8('0x1e')]],'as':_0x28a5a6['as'],'attributes':_0x28a5a6[_0x49f8('0x1b')],'include':_0x28a5a6[_0x49f8('0x1d')]?_[_0x49f8('0x1f')](_0x28a5a6[_0x49f8('0x1d')],function(_0x45c9a2){return{'model':db[_0x45c9a2[_0x49f8('0x1e')]],'as':_0x45c9a2['as'],'attributes':_0x45c9a2[_0x49f8('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x22c24a){logger[_0x49f8('0xc')](_0x49f8('0x20'),_0x5deb61);logger[_0x49f8('0xe')](_0x49f8('0x20'),_0x5deb61,JSON[_0x49f8('0x22')](_0x22c24a));_0x132691(_0x22c24a);})[_0x49f8('0x14')](function(_0x436039){logger['error'](_0x49f8('0x20'),_0x436039['message'],_0x5deb61);_0x3674d1(_0x487b31[_0x49f8('0xf')](0x1f4,_0x436039[_0x49f8('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 413f1b3..e57a9be 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 _0x34e8=['../../config/environment','./intDeskConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','put','update','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x2690a6,_0x234902){var _0x9bff67=function(_0x5e0158){while(--_0x5e0158){_0x2690a6['push'](_0x2690a6['shift']());}};_0x9bff67(++_0x234902);}(_0x34e8,0x12c));var _0x834e=function(_0x38e198,_0x168db5){_0x38e198=_0x38e198-0x0;var _0x15be8f=_0x34e8[_0x38e198];return _0x15be8f;};'use strict';var multer=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var path=require(_0x834e('0x2'));var timeout=require(_0x834e('0x3'));var express=require('express');var router=express[_0x834e('0x4')]();var fs_extra=require(_0x834e('0x5'));var auth=require(_0x834e('0x6'));var interaction=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var controller=require(_0x834e('0x9'));router[_0x834e('0xa')]('/',auth['isAuthenticated'](),controller[_0x834e('0xb')]);router['get'](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0xe')]);router[_0x834e('0xa')](_0x834e('0xf'),auth[_0x834e('0xd')](),controller[_0x834e('0x10')]);router[_0x834e('0xa')](_0x834e('0x11'),auth[_0x834e('0xd')](),controller[_0x834e('0x12')]);router[_0x834e('0xa')](_0x834e('0x13'),auth[_0x834e('0xd')](),controller[_0x834e('0x14')]);router[_0x834e('0xa')](_0x834e('0x15'),auth['isAuthenticated'](),controller[_0x834e('0x16')]);router[_0x834e('0x17')]('/',auth['isAuthenticated'](),controller[_0x834e('0x18')]);router[_0x834e('0x17')](_0x834e('0x15'),auth[_0x834e('0xd')](),controller['setTags']);router[_0x834e('0x19')](_0x834e('0xc'),auth['isAuthenticated'](),controller[_0x834e('0x1a')]);router['delete'](_0x834e('0xc'),auth[_0x834e('0xd')](),controller['destroy']);module[_0x834e('0x1b')]=router; \ No newline at end of file +var _0x9c44=['destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intDeskConfiguration.controller','isAuthenticated','index','get','/:id','/:id/fields','getFields','getSubjects','/:id/descriptions','/:id/tags','post','setTags','put','update'];(function(_0x511be1,_0x1b2a51){var _0x4b5429=function(_0x430020){while(--_0x430020){_0x511be1['push'](_0x511be1['shift']());}};_0x4b5429(++_0x1b2a51);}(_0x9c44,0x178));var _0x49c4=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x9c44[_0x4b055c];return _0x4b62bb;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x49c4('0x6'));router['get']('/',auth[_0x49c4('0x7')](),controller[_0x49c4('0x8')]);router[_0x49c4('0x9')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller['show']);router[_0x49c4('0x9')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0xc')]);router['get']('/:id/subjects',auth[_0x49c4('0x7')](),controller[_0x49c4('0xd')]);router['get'](_0x49c4('0xe'),auth[_0x49c4('0x7')](),controller['getDescriptions']);router['get'](_0x49c4('0xf'),auth[_0x49c4('0x7')](),controller['getTags']);router[_0x49c4('0x10')]('/',auth[_0x49c4('0x7')](),controller['create']);router[_0x49c4('0x10')](_0x49c4('0xf'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x11')]);router[_0x49c4('0x12')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x13')]);router['delete'](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x14')]);module[_0x49c4('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index cf46c03..4d797ab 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 _0xcfda=['exports','STRING'];(function(_0x231606,_0x56c320){var _0x45dd41=function(_0x3f700d){while(--_0x3f700d){_0x231606['push'](_0x231606['shift']());}};_0x45dd41(++_0x56c320);}(_0xcfda,0xca));var _0xacfd=function(_0x3167a7,_0x6bce6b){_0x3167a7=_0x3167a7-0x0;var _0x37eaf0=_0xcfda[_0x3167a7];return _0x37eaf0;};'use strict';var Sequelize=require('sequelize');module[_0xacfd('0x0')]={'name':{'type':Sequelize[_0xacfd('0x1')]},'description':{'type':Sequelize[_0xacfd('0x1')]}}; \ No newline at end of file +var _0x49df=['exports','STRING'];(function(_0x1f71b5,_0x25620f){var _0x305b44=function(_0x52b482){while(--_0x52b482){_0x1f71b5['push'](_0x1f71b5['shift']());}};_0x305b44(++_0x25620f);}(_0x49df,0xba));var _0xf49d=function(_0xd0e677,_0x42939d){_0xd0e677=_0xd0e677-0x0;var _0x18aeb9=_0x49df[_0xd0e677];return _0x18aeb9;};'use strict';var Sequelize=require('sequelize');module[_0xf49d('0x0')]={'name':{'type':Sequelize[_0xf49d('0x1')]},'description':{'type':Sequelize[_0xf49d('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index f512472..dfdcd1a 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 _0xc713=['findOne','Tag','getTags','setTags','ids','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','ejs','fs-extra','to-csv','querystring','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','DeskConfiguration','rawAttributes','fieldName','type','model','map','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','keys','find','create','params','destroy','getFields','DeskField','getSubjects','getDescriptions'];(function(_0x420df7,_0x26fa8b){var _0x59dc5c=function(_0x5d7315){while(--_0x5d7315){_0x420df7['push'](_0x420df7['shift']());}};_0x59dc5c(++_0x26fa8b);}(_0xc713,0xef));var _0x3c71=function(_0x1c0778,_0x167133){_0x1c0778=_0x1c0778-0x0;var _0x1e63d4=_0xc713[_0x1c0778];return _0x1e63d4;};'use strict';var emlformat=require(_0x3c71('0x0'));var rimraf=require(_0x3c71('0x1'));var zipdir=require(_0x3c71('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3c71('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3c71('0x4'));var util=require(_0x3c71('0x5'));var path=require(_0x3c71('0x6'));var sox=require(_0x3c71('0x7'));var csv=require('to-csv');var ejs=require(_0x3c71('0x8'));var fs=require('fs');var fs_extra=require(_0x3c71('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3c71('0xa'));var querystring=require(_0x3c71('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3c71('0xc'));var logger=require(_0x3c71('0xd'))('api');var utils=require(_0x3c71('0xe'));var config=require(_0x3c71('0xf'));var licenseUtil=require(_0x3c71('0x10'));var db=require(_0x3c71('0x11'))['db'];function respondWithStatusCode(_0x175b11,_0x5e74e6){_0x5e74e6=_0x5e74e6||0xcc;return function(_0x5b3a22){if(_0x5b3a22){return _0x175b11[_0x3c71('0x12')](_0x5e74e6);}return _0x175b11[_0x3c71('0x13')](_0x5e74e6)['end']();};}function respondWithResult(_0x130070,_0x510761){_0x510761=_0x510761||0xc8;return function(_0x3adc0a){if(_0x3adc0a){return _0x130070['status'](_0x510761)[_0x3c71('0x14')](_0x3adc0a);}};}function respondWithFilteredResult(_0x3f1ef7,_0x4cb368){return function(_0x116f22){if(_0x116f22){var _0xe770a7=typeof _0x4cb368['offset']===_0x3c71('0x15')&&typeof _0x4cb368['limit']==='undefined';var _0x752d3d=_0x116f22[_0x3c71('0x16')];var _0x1d4fda=_0xe770a7?0x0:_0x4cb368[_0x3c71('0x17')];var _0x4bb5da=_0xe770a7?_0x116f22[_0x3c71('0x16')]:_0x4cb368[_0x3c71('0x17')]+_0x4cb368[_0x3c71('0x18')];var _0x1525c5;if(_0x4bb5da>=_0x752d3d){_0x4bb5da=_0x752d3d;_0x1525c5=0xc8;}else{_0x1525c5=0xce;}_0x3f1ef7[_0x3c71('0x13')](_0x1525c5);return _0x3f1ef7[_0x3c71('0x19')](_0x3c71('0x1a'),_0x1d4fda+'-'+_0x4bb5da+'/'+_0x752d3d)['json'](_0x116f22);}return null;};}function patchUpdates(_0x11e1b2){return function(_0x5b0b3e){try{jsonpatch[_0x3c71('0x1b')](_0x5b0b3e,_0x11e1b2,!![]);}catch(_0x1f5921){return BPromise[_0x3c71('0x1c')](_0x1f5921);}return _0x5b0b3e[_0x3c71('0x1d')]();};}function saveUpdates(_0x475c4a,_0x418886){return function(_0x13d69f){if(_0x13d69f){return _0x13d69f[_0x3c71('0x1e')](_0x475c4a)[_0x3c71('0x1f')](function(_0x106ea3){return _0x106ea3;});}return null;};}function removeEntity(_0x4f5bdd,_0x4845f6){return function(_0x2bdc8f){if(_0x2bdc8f){return _0x2bdc8f['destroy']()[_0x3c71('0x1f')](function(){_0x4f5bdd[_0x3c71('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3fd0df,_0x26c1db){return function(_0x5874ec){if(!_0x5874ec){_0x3fd0df[_0x3c71('0x12')](0x194);}return _0x5874ec;};}function handleError(_0x7928e1,_0x2776b1){_0x2776b1=_0x2776b1||0x1f4;return function(_0x118784){logger[_0x3c71('0x20')](_0x118784[_0x3c71('0x21')]);if(_0x118784[_0x3c71('0x22')]){delete _0x118784['name'];}_0x7928e1[_0x3c71('0x13')](_0x2776b1)[_0x3c71('0x23')](_0x118784);};}exports[_0x3c71('0x24')]=function(_0x425ae3,_0x5b7f6e){var _0x4e2e0f={},_0x397199={},_0x37bb6b={'count':0x0,'rows':[]};var _0x5c5fec=_['map'](db[_0x3c71('0x25')][_0x3c71('0x26')],function(_0x2bd3bc){return{'name':_0x2bd3bc[_0x3c71('0x27')],'type':_0x2bd3bc[_0x3c71('0x28')]['key']};});_0x397199[_0x3c71('0x29')]=_[_0x3c71('0x2a')](_0x5c5fec,_0x3c71('0x22'));_0x397199[_0x3c71('0x2b')]=_['keys'](_0x425ae3[_0x3c71('0x2b')]);_0x397199['filters']=_[_0x3c71('0x2c')](_0x397199[_0x3c71('0x29')],_0x397199[_0x3c71('0x2b')]);_0x4e2e0f[_0x3c71('0x2d')]=_[_0x3c71('0x2c')](_0x397199[_0x3c71('0x29')],qs[_0x3c71('0x2e')](_0x425ae3[_0x3c71('0x2b')][_0x3c71('0x2e')]));_0x4e2e0f[_0x3c71('0x2d')]=_0x4e2e0f[_0x3c71('0x2d')][_0x3c71('0x2f')]?_0x4e2e0f[_0x3c71('0x2d')]:_0x397199[_0x3c71('0x29')];if(!_0x425ae3[_0x3c71('0x2b')][_0x3c71('0x30')](_0x3c71('0x31'))){_0x4e2e0f[_0x3c71('0x18')]=qs[_0x3c71('0x18')](_0x425ae3[_0x3c71('0x2b')]['limit']);_0x4e2e0f[_0x3c71('0x17')]=qs[_0x3c71('0x17')](_0x425ae3[_0x3c71('0x2b')][_0x3c71('0x17')]);}_0x4e2e0f[_0x3c71('0x32')]=qs[_0x3c71('0x33')](_0x425ae3[_0x3c71('0x2b')]['sort']);_0x4e2e0f[_0x3c71('0x34')]=qs[_0x3c71('0x35')](_[_0x3c71('0x36')](_0x425ae3[_0x3c71('0x2b')],_0x397199[_0x3c71('0x35')]),_0x5c5fec);if(_0x425ae3['query'][_0x3c71('0x37')]){_0x4e2e0f[_0x3c71('0x34')]=_['merge'](_0x4e2e0f[_0x3c71('0x34')],{'$or':_[_0x3c71('0x2a')](_0x5c5fec,function(_0x15d96c){if(_0x15d96c[_0x3c71('0x28')]!==_0x3c71('0x38')){var _0x2f0d03={};_0x2f0d03[_0x15d96c[_0x3c71('0x22')]]={'$like':'%'+_0x425ae3['query'][_0x3c71('0x37')]+'%'};return _0x2f0d03;}})});}_0x4e2e0f=_[_0x3c71('0x39')]({},_0x4e2e0f,_0x425ae3[_0x3c71('0x3a')]);var _0x14a664={'where':_0x4e2e0f[_0x3c71('0x34')]};return db[_0x3c71('0x25')]['count'](_0x14a664)[_0x3c71('0x1f')](function(_0xcbaa59){_0x37bb6b['count']=_0xcbaa59;if(_0x425ae3[_0x3c71('0x2b')][_0x3c71('0x3b')]){_0x4e2e0f[_0x3c71('0x3c')]=[{'all':!![]}];}return db[_0x3c71('0x25')][_0x3c71('0x3d')](_0x4e2e0f);})[_0x3c71('0x1f')](function(_0x2b992f){_0x37bb6b['rows']=_0x2b992f;return _0x37bb6b;})[_0x3c71('0x1f')](respondWithFilteredResult(_0x5b7f6e,_0x4e2e0f))[_0x3c71('0x3e')](handleError(_0x5b7f6e,null));};exports[_0x3c71('0x3f')]=function(_0x262cf8,_0x199ca7){var _0x6f866={'raw':![],'where':{'id':_0x262cf8['params']['id']}},_0x3e50c4={};_0x3e50c4['model']=_['keys'](db[_0x3c71('0x25')][_0x3c71('0x26')]);_0x3e50c4[_0x3c71('0x2b')]=_[_0x3c71('0x40')](_0x262cf8[_0x3c71('0x2b')]);_0x3e50c4['filters']=_[_0x3c71('0x2c')](_0x3e50c4['model'],_0x3e50c4[_0x3c71('0x2b')]);_0x6f866[_0x3c71('0x2d')]=_[_0x3c71('0x2c')](_0x3e50c4[_0x3c71('0x29')],qs['fields'](_0x262cf8[_0x3c71('0x2b')]['fields']));_0x6f866[_0x3c71('0x2d')]=_0x6f866[_0x3c71('0x2d')][_0x3c71('0x2f')]?_0x6f866[_0x3c71('0x2d')]:_0x3e50c4['model'];if(_0x262cf8['query']['includeAll']){_0x6f866[_0x3c71('0x3c')]=[{'all':!![]}];}_0x6f866=_[_0x3c71('0x39')]({},_0x6f866,_0x262cf8[_0x3c71('0x3a')]);return db[_0x3c71('0x25')][_0x3c71('0x41')](_0x6f866)[_0x3c71('0x1f')](handleEntityNotFound(_0x199ca7,null))[_0x3c71('0x1f')](respondWithResult(_0x199ca7,null))[_0x3c71('0x3e')](handleError(_0x199ca7,null));};exports[_0x3c71('0x42')]=function(_0x35e480,_0x58e348){return db['DeskConfiguration']['create'](_0x35e480['body'],{})['then'](respondWithResult(_0x58e348,0xc9))['catch'](handleError(_0x58e348,null));};exports['update']=function(_0x37e093,_0x5c0146){if(_0x37e093['body']['id']){delete _0x37e093['body']['id'];}return db[_0x3c71('0x25')][_0x3c71('0x41')]({'where':{'id':_0x37e093[_0x3c71('0x43')]['id']}})['then'](handleEntityNotFound(_0x5c0146,null))[_0x3c71('0x1f')](saveUpdates(_0x37e093['body'],null))[_0x3c71('0x1f')](respondWithResult(_0x5c0146,null))[_0x3c71('0x3e')](handleError(_0x5c0146,null));};exports[_0x3c71('0x44')]=function(_0x55934e,_0x18f785){return db[_0x3c71('0x25')][_0x3c71('0x41')]({'where':{'id':_0x55934e[_0x3c71('0x43')]['id']}})[_0x3c71('0x1f')](handleEntityNotFound(_0x18f785,null))[_0x3c71('0x1f')](removeEntity(_0x18f785,null))[_0x3c71('0x3e')](handleError(_0x18f785,null));};exports[_0x3c71('0x45')]=function(_0x5e03b5,_0x5bba58,_0x3c9b06){var _0x3d98d3={};var _0x132412={};var _0x4391f2;var _0x571106;return db[_0x3c71('0x25')]['findOne']({'where':{'id':_0x5e03b5[_0x3c71('0x43')]['id']}})[_0x3c71('0x1f')](handleEntityNotFound(_0x5bba58,null))[_0x3c71('0x1f')](function(_0x2c0bef){if(_0x2c0bef){_0x4391f2=_0x2c0bef;_0x132412[_0x3c71('0x29')]=_[_0x3c71('0x40')](db['DeskField'][_0x3c71('0x26')]);_0x132412[_0x3c71('0x2b')]=_[_0x3c71('0x40')](_0x5e03b5[_0x3c71('0x2b')]);_0x132412['filters']=_[_0x3c71('0x2c')](_0x132412[_0x3c71('0x29')],_0x132412[_0x3c71('0x2b')]);_0x3d98d3[_0x3c71('0x2d')]=_[_0x3c71('0x2c')](_0x132412[_0x3c71('0x29')],qs[_0x3c71('0x2e')](_0x5e03b5[_0x3c71('0x2b')]['fields']));_0x3d98d3[_0x3c71('0x2d')]=_0x3d98d3[_0x3c71('0x2d')][_0x3c71('0x2f')]?_0x3d98d3['attributes']:_0x132412[_0x3c71('0x29')];_0x3d98d3[_0x3c71('0x32')]=qs[_0x3c71('0x33')](_0x5e03b5[_0x3c71('0x2b')][_0x3c71('0x33')]);_0x3d98d3['where']=qs[_0x3c71('0x35')](_[_0x3c71('0x36')](_0x5e03b5[_0x3c71('0x2b')],_0x132412[_0x3c71('0x35')]));if(_0x5e03b5[_0x3c71('0x2b')][_0x3c71('0x37')]){_0x3d98d3[_0x3c71('0x34')]=_[_0x3c71('0x39')](_0x3d98d3[_0x3c71('0x34')],{'$or':_[_0x3c71('0x2a')](_0x3d98d3[_0x3c71('0x2d')],function(_0x1eec62){var _0x342994={};_0x342994[_0x1eec62]={'$like':'%'+_0x5e03b5[_0x3c71('0x2b')][_0x3c71('0x37')]+'%'};return _0x342994;})});}_0x3d98d3=_[_0x3c71('0x39')]({},_0x3d98d3,_0x5e03b5['options']);return _0x4391f2['getFields'](_0x3d98d3);}})[_0x3c71('0x1f')](function(_0x483f9a){if(_0x483f9a){_0x571106=_0x483f9a['length'];if(!_0x5e03b5[_0x3c71('0x2b')][_0x3c71('0x30')](_0x3c71('0x31'))){_0x3d98d3[_0x3c71('0x18')]=qs[_0x3c71('0x18')](_0x5e03b5[_0x3c71('0x2b')][_0x3c71('0x18')]);_0x3d98d3[_0x3c71('0x17')]=qs[_0x3c71('0x17')](_0x5e03b5['query']['offset']);}return _0x4391f2['getFields'](_0x3d98d3);}})[_0x3c71('0x1f')](function(_0x38a871){if(_0x38a871){return _0x38a871?{'count':_0x571106,'rows':_0x38a871}:null;}})[_0x3c71('0x1f')](respondWithResult(_0x5bba58,null))[_0x3c71('0x3e')](handleError(_0x5bba58,null));};exports['getSubjects']=function(_0x2e80c2,_0x5b20db,_0x59b76f){var _0x88a374={};var _0x37398e={};var _0x56b755;var _0x405516;return db[_0x3c71('0x25')]['findOne']({'where':{'id':_0x2e80c2[_0x3c71('0x43')]['id']}})[_0x3c71('0x1f')](handleEntityNotFound(_0x5b20db,null))[_0x3c71('0x1f')](function(_0x5b5248){if(_0x5b5248){_0x56b755=_0x5b5248;_0x37398e[_0x3c71('0x29')]=_[_0x3c71('0x40')](db[_0x3c71('0x46')][_0x3c71('0x26')]);_0x37398e['query']=_[_0x3c71('0x40')](_0x2e80c2[_0x3c71('0x2b')]);_0x37398e[_0x3c71('0x35')]=_['intersection'](_0x37398e['model'],_0x37398e[_0x3c71('0x2b')]);_0x88a374[_0x3c71('0x2d')]=_[_0x3c71('0x2c')](_0x37398e[_0x3c71('0x29')],qs[_0x3c71('0x2e')](_0x2e80c2[_0x3c71('0x2b')][_0x3c71('0x2e')]));_0x88a374[_0x3c71('0x2d')]=_0x88a374[_0x3c71('0x2d')][_0x3c71('0x2f')]?_0x88a374['attributes']:_0x37398e['model'];_0x88a374[_0x3c71('0x32')]=qs['sort'](_0x2e80c2[_0x3c71('0x2b')]['sort']);_0x88a374[_0x3c71('0x34')]=qs[_0x3c71('0x35')](_[_0x3c71('0x36')](_0x2e80c2[_0x3c71('0x2b')],_0x37398e[_0x3c71('0x35')]));if(_0x2e80c2['query'][_0x3c71('0x37')]){_0x88a374[_0x3c71('0x34')]=_['merge'](_0x88a374[_0x3c71('0x34')],{'$or':_[_0x3c71('0x2a')](_0x88a374[_0x3c71('0x2d')],function(_0x25705c){var _0xecf066={};_0xecf066[_0x25705c]={'$like':'%'+_0x2e80c2[_0x3c71('0x2b')][_0x3c71('0x37')]+'%'};return _0xecf066;})});}_0x88a374=_['merge']({},_0x88a374,_0x2e80c2['options']);return _0x56b755[_0x3c71('0x47')](_0x88a374);}})[_0x3c71('0x1f')](function(_0x514831){if(_0x514831){_0x405516=_0x514831[_0x3c71('0x2f')];if(!_0x2e80c2[_0x3c71('0x2b')][_0x3c71('0x30')](_0x3c71('0x31'))){_0x88a374['limit']=qs['limit'](_0x2e80c2['query'][_0x3c71('0x18')]);_0x88a374[_0x3c71('0x17')]=qs['offset'](_0x2e80c2['query'][_0x3c71('0x17')]);}return _0x56b755[_0x3c71('0x47')](_0x88a374);}})[_0x3c71('0x1f')](function(_0x57b255){if(_0x57b255){return _0x57b255?{'count':_0x405516,'rows':_0x57b255}:null;}})[_0x3c71('0x1f')](respondWithResult(_0x5b20db,null))[_0x3c71('0x3e')](handleError(_0x5b20db,null));};exports[_0x3c71('0x48')]=function(_0x34760b,_0xf28481,_0x762136){var _0x3e8b3b={};var _0x3c84ca={};var _0x353a91;var _0x1aee55;return db[_0x3c71('0x25')][_0x3c71('0x49')]({'where':{'id':_0x34760b[_0x3c71('0x43')]['id']}})[_0x3c71('0x1f')](handleEntityNotFound(_0xf28481,null))['then'](function(_0x470384){if(_0x470384){_0x353a91=_0x470384;_0x3c84ca[_0x3c71('0x29')]=_['keys'](db[_0x3c71('0x46')][_0x3c71('0x26')]);_0x3c84ca[_0x3c71('0x2b')]=_[_0x3c71('0x40')](_0x34760b[_0x3c71('0x2b')]);_0x3c84ca[_0x3c71('0x35')]=_[_0x3c71('0x2c')](_0x3c84ca['model'],_0x3c84ca[_0x3c71('0x2b')]);_0x3e8b3b[_0x3c71('0x2d')]=_[_0x3c71('0x2c')](_0x3c84ca[_0x3c71('0x29')],qs[_0x3c71('0x2e')](_0x34760b[_0x3c71('0x2b')][_0x3c71('0x2e')]));_0x3e8b3b[_0x3c71('0x2d')]=_0x3e8b3b[_0x3c71('0x2d')][_0x3c71('0x2f')]?_0x3e8b3b[_0x3c71('0x2d')]:_0x3c84ca[_0x3c71('0x29')];_0x3e8b3b['order']=qs[_0x3c71('0x33')](_0x34760b[_0x3c71('0x2b')][_0x3c71('0x33')]);_0x3e8b3b[_0x3c71('0x34')]=qs['filters'](_[_0x3c71('0x36')](_0x34760b[_0x3c71('0x2b')],_0x3c84ca[_0x3c71('0x35')]));if(_0x34760b['query'][_0x3c71('0x37')]){_0x3e8b3b[_0x3c71('0x34')]=_[_0x3c71('0x39')](_0x3e8b3b[_0x3c71('0x34')],{'$or':_['map'](_0x3e8b3b[_0x3c71('0x2d')],function(_0x31c9d0){var _0x13b5da={};_0x13b5da[_0x31c9d0]={'$like':'%'+_0x34760b[_0x3c71('0x2b')][_0x3c71('0x37')]+'%'};return _0x13b5da;})});}_0x3e8b3b=_[_0x3c71('0x39')]({},_0x3e8b3b,_0x34760b[_0x3c71('0x3a')]);return _0x353a91[_0x3c71('0x48')](_0x3e8b3b);}})[_0x3c71('0x1f')](function(_0x4849a3){if(_0x4849a3){_0x1aee55=_0x4849a3[_0x3c71('0x2f')];if(!_0x34760b['query'][_0x3c71('0x30')](_0x3c71('0x31'))){_0x3e8b3b['limit']=qs[_0x3c71('0x18')](_0x34760b[_0x3c71('0x2b')][_0x3c71('0x18')]);_0x3e8b3b[_0x3c71('0x17')]=qs[_0x3c71('0x17')](_0x34760b[_0x3c71('0x2b')][_0x3c71('0x17')]);}return _0x353a91['getDescriptions'](_0x3e8b3b);}})['then'](function(_0x2ee98b){if(_0x2ee98b){return _0x2ee98b?{'count':_0x1aee55,'rows':_0x2ee98b}:null;}})[_0x3c71('0x1f')](respondWithResult(_0xf28481,null))[_0x3c71('0x3e')](handleError(_0xf28481,null));};exports['getTags']=function(_0x3183b0,_0x5ea225,_0x3c74f8){var _0x5b5149={};var _0xcc5ba3={};var _0x3aec87;var _0xf796ff;return db[_0x3c71('0x25')][_0x3c71('0x49')]({'where':{'id':_0x3183b0[_0x3c71('0x43')]['id']}})['then'](handleEntityNotFound(_0x5ea225,null))[_0x3c71('0x1f')](function(_0x2af26c){if(_0x2af26c){_0x3aec87=_0x2af26c;_0xcc5ba3['model']=_[_0x3c71('0x40')](db[_0x3c71('0x4a')][_0x3c71('0x26')]);_0xcc5ba3[_0x3c71('0x2b')]=_['keys'](_0x3183b0[_0x3c71('0x2b')]);_0xcc5ba3['filters']=_[_0x3c71('0x2c')](_0xcc5ba3['model'],_0xcc5ba3[_0x3c71('0x2b')]);_0x5b5149['attributes']=_[_0x3c71('0x2c')](_0xcc5ba3[_0x3c71('0x29')],qs[_0x3c71('0x2e')](_0x3183b0[_0x3c71('0x2b')][_0x3c71('0x2e')]));_0x5b5149['attributes']=_0x5b5149[_0x3c71('0x2d')][_0x3c71('0x2f')]?_0x5b5149[_0x3c71('0x2d')]:_0xcc5ba3['model'];_0x5b5149[_0x3c71('0x32')]=qs[_0x3c71('0x33')](_0x3183b0[_0x3c71('0x2b')][_0x3c71('0x33')]);_0x5b5149[_0x3c71('0x34')]=qs['filters'](_[_0x3c71('0x36')](_0x3183b0[_0x3c71('0x2b')],_0xcc5ba3[_0x3c71('0x35')]));if(_0x3183b0['query'][_0x3c71('0x37')]){_0x5b5149[_0x3c71('0x34')]=_[_0x3c71('0x39')](_0x5b5149['where'],{'$or':_[_0x3c71('0x2a')](_0x5b5149[_0x3c71('0x2d')],function(_0x42e9c5){var _0x39b803={};_0x39b803[_0x42e9c5]={'$like':'%'+_0x3183b0[_0x3c71('0x2b')][_0x3c71('0x37')]+'%'};return _0x39b803;})});}_0x5b5149=_[_0x3c71('0x39')]({},_0x5b5149,_0x3183b0[_0x3c71('0x3a')]);return _0x3aec87[_0x3c71('0x4b')](_0x5b5149);}})['then'](function(_0x49fa78){if(_0x49fa78){_0xf796ff=_0x49fa78[_0x3c71('0x2f')];if(!_0x3183b0[_0x3c71('0x2b')][_0x3c71('0x30')](_0x3c71('0x31'))){_0x5b5149[_0x3c71('0x18')]=qs[_0x3c71('0x18')](_0x3183b0[_0x3c71('0x2b')]['limit']);_0x5b5149[_0x3c71('0x17')]=qs[_0x3c71('0x17')](_0x3183b0[_0x3c71('0x2b')][_0x3c71('0x17')]);}return _0x3aec87[_0x3c71('0x4b')](_0x5b5149);}})[_0x3c71('0x1f')](function(_0x3df777){if(_0x3df777){return _0x3df777?{'count':_0xf796ff,'rows':_0x3df777}:null;}})[_0x3c71('0x1f')](respondWithResult(_0x5ea225,null))[_0x3c71('0x3e')](handleError(_0x5ea225,null));};exports[_0x3c71('0x4c')]=function(_0x80ab7a,_0x57c0a1,_0x201610){if(_0x80ab7a['body']['id']){delete _0x80ab7a['body']['id'];}return db[_0x3c71('0x25')][_0x3c71('0x49')]({'where':{'id':_0x80ab7a[_0x3c71('0x43')]['id']}})[_0x3c71('0x1f')](handleEntityNotFound(_0x57c0a1,null))[_0x3c71('0x1f')](function(_0x4ada04){if(_0x4ada04){return _0x4ada04['setTags'](_0x80ab7a['body'][_0x3c71('0x4d')]||[]);}return null;})[_0x3c71('0x1f')](respondWithResult(_0x57c0a1,null))[_0x3c71('0x3e')](handleError(_0x57c0a1,null));}; \ No newline at end of file +var _0x8084=['find','catch','create','body','destroy','getFields','DeskField','getSubjects','findOne','getDescriptions','getTags','Tag','setTags','ids','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','error','stack','name','send','index','map','DeskConfiguration','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','rows','params'];(function(_0x1fcaf1,_0x21c3c2){var _0x55f464=function(_0x348eb3){while(--_0x348eb3){_0x1fcaf1['push'](_0x1fcaf1['shift']());}};_0x55f464(++_0x21c3c2);}(_0x8084,0xae));var _0x4808=function(_0xb3b119,_0x2408b6){_0xb3b119=_0xb3b119-0x0;var _0x15b695=_0x8084[_0xb3b119];return _0x15b695;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4808('0x0'));var jsonpatch=require(_0x4808('0x1'));var rp=require('request-promise');var moment=require(_0x4808('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x4808('0x3'));var util=require('util');var path=require(_0x4808('0x4'));var sox=require(_0x4808('0x5'));var csv=require(_0x4808('0x6'));var ejs=require(_0x4808('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4808('0x8'));var squel=require('squel');var crypto=require(_0x4808('0x9'));var jsforce=require(_0x4808('0xa'));var deskjs=require(_0x4808('0xb'));var toCsv=require(_0x4808('0x6'));var querystring=require(_0x4808('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4808('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4808('0xe'));var logger=require(_0x4808('0xf'))('api');var utils=require(_0x4808('0x10'));var config=require(_0x4808('0x11'));var licenseUtil=require(_0x4808('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3bcdba,_0x1799e1){_0x1799e1=_0x1799e1||0xcc;return function(_0x95add3){if(_0x95add3){return _0x3bcdba[_0x4808('0x13')](_0x1799e1);}return _0x3bcdba[_0x4808('0x14')](_0x1799e1)[_0x4808('0x15')]();};}function respondWithResult(_0x4e6009,_0x1d0b25){_0x1d0b25=_0x1d0b25||0xc8;return function(_0x21402e){if(_0x21402e){return _0x4e6009[_0x4808('0x14')](_0x1d0b25)[_0x4808('0x16')](_0x21402e);}};}function respondWithFilteredResult(_0x126837,_0x5d2901){return function(_0x34bf03){if(_0x34bf03){var _0x38dd7c=typeof _0x5d2901[_0x4808('0x17')]===_0x4808('0x18')&&typeof _0x5d2901[_0x4808('0x19')]===_0x4808('0x18');var _0x111e47=_0x34bf03[_0x4808('0x1a')];var _0x539797=_0x38dd7c?0x0:_0x5d2901['offset'];var _0x3c725e=_0x38dd7c?_0x34bf03[_0x4808('0x1a')]:_0x5d2901[_0x4808('0x17')]+_0x5d2901['limit'];var _0x82e988;if(_0x3c725e>=_0x111e47){_0x3c725e=_0x111e47;_0x82e988=0xc8;}else{_0x82e988=0xce;}_0x126837['status'](_0x82e988);return _0x126837[_0x4808('0x1b')](_0x4808('0x1c'),_0x539797+'-'+_0x3c725e+'/'+_0x111e47)[_0x4808('0x16')](_0x34bf03);}return null;};}function patchUpdates(_0x53728d){return function(_0x33e45e){try{jsonpatch['apply'](_0x33e45e,_0x53728d,!![]);}catch(_0x57b1df){return BPromise[_0x4808('0x1d')](_0x57b1df);}return _0x33e45e[_0x4808('0x1e')]();};}function saveUpdates(_0x5bfd4e,_0x426f4a){return function(_0x449e72){if(_0x449e72){return _0x449e72[_0x4808('0x1f')](_0x5bfd4e)['then'](function(_0x5a7eb0){return _0x5a7eb0;});}return null;};}function removeEntity(_0x3384e0,_0x1cc7a7){return function(_0x5a59d5){if(_0x5a59d5){return _0x5a59d5['destroy']()[_0x4808('0x20')](function(){_0x3384e0[_0x4808('0x14')](0xcc)[_0x4808('0x15')]();});}};}function handleEntityNotFound(_0x218b7c,_0x465e6b){return function(_0x416db7){if(!_0x416db7){_0x218b7c[_0x4808('0x13')](0x194);}return _0x416db7;};}function handleError(_0x245076,_0x2c09a8){_0x2c09a8=_0x2c09a8||0x1f4;return function(_0x9973dd){logger[_0x4808('0x21')](_0x9973dd[_0x4808('0x22')]);if(_0x9973dd['name']){delete _0x9973dd[_0x4808('0x23')];}_0x245076[_0x4808('0x14')](_0x2c09a8)[_0x4808('0x24')](_0x9973dd);};}exports[_0x4808('0x25')]=function(_0x54b8f5,_0x1959d7){var _0x1bde29={},_0x4ac66b={},_0x317f59={'count':0x0,'rows':[]};var _0x40f256=_[_0x4808('0x26')](db[_0x4808('0x27')][_0x4808('0x28')],function(_0x2a5074){return{'name':_0x2a5074[_0x4808('0x29')],'type':_0x2a5074['type'][_0x4808('0x2a')]};});_0x4ac66b[_0x4808('0x2b')]=_[_0x4808('0x26')](_0x40f256,_0x4808('0x23'));_0x4ac66b['query']=_[_0x4808('0x2c')](_0x54b8f5[_0x4808('0x2d')]);_0x4ac66b[_0x4808('0x2e')]=_[_0x4808('0x2f')](_0x4ac66b['model'],_0x4ac66b[_0x4808('0x2d')]);_0x1bde29[_0x4808('0x30')]=_[_0x4808('0x2f')](_0x4ac66b[_0x4808('0x2b')],qs[_0x4808('0x31')](_0x54b8f5[_0x4808('0x2d')]['fields']));_0x1bde29[_0x4808('0x30')]=_0x1bde29[_0x4808('0x30')][_0x4808('0x32')]?_0x1bde29[_0x4808('0x30')]:_0x4ac66b[_0x4808('0x2b')];if(!_0x54b8f5[_0x4808('0x2d')][_0x4808('0x33')](_0x4808('0x34'))){_0x1bde29[_0x4808('0x19')]=qs[_0x4808('0x19')](_0x54b8f5[_0x4808('0x2d')]['limit']);_0x1bde29[_0x4808('0x17')]=qs[_0x4808('0x17')](_0x54b8f5[_0x4808('0x2d')][_0x4808('0x17')]);}_0x1bde29[_0x4808('0x35')]=qs[_0x4808('0x36')](_0x54b8f5[_0x4808('0x2d')][_0x4808('0x36')]);_0x1bde29[_0x4808('0x37')]=qs[_0x4808('0x2e')](_[_0x4808('0x38')](_0x54b8f5[_0x4808('0x2d')],_0x4ac66b[_0x4808('0x2e')]),_0x40f256);if(_0x54b8f5['query'][_0x4808('0x39')]){_0x1bde29[_0x4808('0x37')]=_[_0x4808('0x3a')](_0x1bde29[_0x4808('0x37')],{'$or':_['map'](_0x40f256,function(_0x3ae8ac){if(_0x3ae8ac[_0x4808('0x3b')]!=='VIRTUAL'){var _0x1ab14b={};_0x1ab14b[_0x3ae8ac[_0x4808('0x23')]]={'$like':'%'+_0x54b8f5['query'][_0x4808('0x39')]+'%'};return _0x1ab14b;}})});}_0x1bde29=_[_0x4808('0x3a')]({},_0x1bde29,_0x54b8f5[_0x4808('0x3c')]);var _0x45e2fb={'where':_0x1bde29['where']};return db[_0x4808('0x27')][_0x4808('0x1a')](_0x45e2fb)[_0x4808('0x20')](function(_0xea2fd0){_0x317f59['count']=_0xea2fd0;if(_0x54b8f5[_0x4808('0x2d')][_0x4808('0x3d')]){_0x1bde29[_0x4808('0x3e')]=[{'all':!![]}];}return db[_0x4808('0x27')][_0x4808('0x3f')](_0x1bde29);})[_0x4808('0x20')](function(_0x26bd4a){_0x317f59[_0x4808('0x40')]=_0x26bd4a;return _0x317f59;})[_0x4808('0x20')](respondWithFilteredResult(_0x1959d7,_0x1bde29))['catch'](handleError(_0x1959d7,null));};exports['show']=function(_0x3e6c02,_0x556f08){var _0x40b54b={'raw':![],'where':{'id':_0x3e6c02[_0x4808('0x41')]['id']}},_0x38743b={};_0x38743b[_0x4808('0x2b')]=_[_0x4808('0x2c')](db[_0x4808('0x27')][_0x4808('0x28')]);_0x38743b[_0x4808('0x2d')]=_[_0x4808('0x2c')](_0x3e6c02[_0x4808('0x2d')]);_0x38743b[_0x4808('0x2e')]=_[_0x4808('0x2f')](_0x38743b['model'],_0x38743b[_0x4808('0x2d')]);_0x40b54b[_0x4808('0x30')]=_[_0x4808('0x2f')](_0x38743b[_0x4808('0x2b')],qs[_0x4808('0x31')](_0x3e6c02[_0x4808('0x2d')][_0x4808('0x31')]));_0x40b54b[_0x4808('0x30')]=_0x40b54b[_0x4808('0x30')][_0x4808('0x32')]?_0x40b54b[_0x4808('0x30')]:_0x38743b['model'];if(_0x3e6c02['query'][_0x4808('0x3d')]){_0x40b54b[_0x4808('0x3e')]=[{'all':!![]}];}_0x40b54b=_[_0x4808('0x3a')]({},_0x40b54b,_0x3e6c02['options']);return db[_0x4808('0x27')][_0x4808('0x42')](_0x40b54b)[_0x4808('0x20')](handleEntityNotFound(_0x556f08,null))[_0x4808('0x20')](respondWithResult(_0x556f08,null))[_0x4808('0x43')](handleError(_0x556f08,null));};exports[_0x4808('0x44')]=function(_0x2469c9,_0x6d0940){return db[_0x4808('0x27')][_0x4808('0x44')](_0x2469c9[_0x4808('0x45')],{})[_0x4808('0x20')](respondWithResult(_0x6d0940,0xc9))[_0x4808('0x43')](handleError(_0x6d0940,null));};exports[_0x4808('0x1f')]=function(_0x1e5452,_0x2489ab){if(_0x1e5452[_0x4808('0x45')]['id']){delete _0x1e5452[_0x4808('0x45')]['id'];}return db['DeskConfiguration']['find']({'where':{'id':_0x1e5452[_0x4808('0x41')]['id']}})['then'](handleEntityNotFound(_0x2489ab,null))[_0x4808('0x20')](saveUpdates(_0x1e5452[_0x4808('0x45')],null))['then'](respondWithResult(_0x2489ab,null))[_0x4808('0x43')](handleError(_0x2489ab,null));};exports[_0x4808('0x46')]=function(_0x40e2db,_0x3acd20){return db[_0x4808('0x27')]['find']({'where':{'id':_0x40e2db['params']['id']}})[_0x4808('0x20')](handleEntityNotFound(_0x3acd20,null))[_0x4808('0x20')](removeEntity(_0x3acd20,null))[_0x4808('0x43')](handleError(_0x3acd20,null));};exports[_0x4808('0x47')]=function(_0x263735,_0x3b5115,_0x42653b){var _0x10bf15={};var _0x121624={};var _0x1cb2ac;var _0x248958;return db[_0x4808('0x27')]['findOne']({'where':{'id':_0x263735['params']['id']}})[_0x4808('0x20')](handleEntityNotFound(_0x3b5115,null))['then'](function(_0x235cd8){if(_0x235cd8){_0x1cb2ac=_0x235cd8;_0x121624[_0x4808('0x2b')]=_['keys'](db[_0x4808('0x48')][_0x4808('0x28')]);_0x121624[_0x4808('0x2d')]=_['keys'](_0x263735[_0x4808('0x2d')]);_0x121624['filters']=_[_0x4808('0x2f')](_0x121624[_0x4808('0x2b')],_0x121624[_0x4808('0x2d')]);_0x10bf15['attributes']=_[_0x4808('0x2f')](_0x121624[_0x4808('0x2b')],qs[_0x4808('0x31')](_0x263735[_0x4808('0x2d')][_0x4808('0x31')]));_0x10bf15['attributes']=_0x10bf15['attributes'][_0x4808('0x32')]?_0x10bf15['attributes']:_0x121624[_0x4808('0x2b')];_0x10bf15['order']=qs['sort'](_0x263735[_0x4808('0x2d')]['sort']);_0x10bf15[_0x4808('0x37')]=qs[_0x4808('0x2e')](_[_0x4808('0x38')](_0x263735[_0x4808('0x2d')],_0x121624[_0x4808('0x2e')]));if(_0x263735[_0x4808('0x2d')]['filter']){_0x10bf15[_0x4808('0x37')]=_[_0x4808('0x3a')](_0x10bf15[_0x4808('0x37')],{'$or':_['map'](_0x10bf15[_0x4808('0x30')],function(_0x400bd9){var _0xb6abcb={};_0xb6abcb[_0x400bd9]={'$like':'%'+_0x263735[_0x4808('0x2d')]['filter']+'%'};return _0xb6abcb;})});}_0x10bf15=_['merge']({},_0x10bf15,_0x263735['options']);return _0x1cb2ac[_0x4808('0x47')](_0x10bf15);}})[_0x4808('0x20')](function(_0x44cedb){if(_0x44cedb){_0x248958=_0x44cedb[_0x4808('0x32')];if(!_0x263735[_0x4808('0x2d')][_0x4808('0x33')](_0x4808('0x34'))){_0x10bf15[_0x4808('0x19')]=qs['limit'](_0x263735[_0x4808('0x2d')][_0x4808('0x19')]);_0x10bf15[_0x4808('0x17')]=qs[_0x4808('0x17')](_0x263735[_0x4808('0x2d')][_0x4808('0x17')]);}return _0x1cb2ac[_0x4808('0x47')](_0x10bf15);}})[_0x4808('0x20')](function(_0x112f08){if(_0x112f08){return _0x112f08?{'count':_0x248958,'rows':_0x112f08}:null;}})[_0x4808('0x20')](respondWithResult(_0x3b5115,null))[_0x4808('0x43')](handleError(_0x3b5115,null));};exports[_0x4808('0x49')]=function(_0x56bfd9,_0x515dd3,_0x48e03d){var _0x23aaaa={};var _0x37f67b={};var _0x5dc2ac;var _0xb3885e;return db['DeskConfiguration'][_0x4808('0x4a')]({'where':{'id':_0x56bfd9[_0x4808('0x41')]['id']}})[_0x4808('0x20')](handleEntityNotFound(_0x515dd3,null))[_0x4808('0x20')](function(_0x29072d){if(_0x29072d){_0x5dc2ac=_0x29072d;_0x37f67b[_0x4808('0x2b')]=_['keys'](db['DeskField']['rawAttributes']);_0x37f67b['query']=_[_0x4808('0x2c')](_0x56bfd9[_0x4808('0x2d')]);_0x37f67b[_0x4808('0x2e')]=_[_0x4808('0x2f')](_0x37f67b[_0x4808('0x2b')],_0x37f67b[_0x4808('0x2d')]);_0x23aaaa[_0x4808('0x30')]=_['intersection'](_0x37f67b[_0x4808('0x2b')],qs[_0x4808('0x31')](_0x56bfd9[_0x4808('0x2d')][_0x4808('0x31')]));_0x23aaaa[_0x4808('0x30')]=_0x23aaaa[_0x4808('0x30')][_0x4808('0x32')]?_0x23aaaa[_0x4808('0x30')]:_0x37f67b['model'];_0x23aaaa[_0x4808('0x35')]=qs[_0x4808('0x36')](_0x56bfd9[_0x4808('0x2d')]['sort']);_0x23aaaa[_0x4808('0x37')]=qs['filters'](_[_0x4808('0x38')](_0x56bfd9['query'],_0x37f67b[_0x4808('0x2e')]));if(_0x56bfd9['query'][_0x4808('0x39')]){_0x23aaaa[_0x4808('0x37')]=_[_0x4808('0x3a')](_0x23aaaa[_0x4808('0x37')],{'$or':_[_0x4808('0x26')](_0x23aaaa['attributes'],function(_0x5dc8e6){var _0x164196={};_0x164196[_0x5dc8e6]={'$like':'%'+_0x56bfd9['query'][_0x4808('0x39')]+'%'};return _0x164196;})});}_0x23aaaa=_[_0x4808('0x3a')]({},_0x23aaaa,_0x56bfd9[_0x4808('0x3c')]);return _0x5dc2ac[_0x4808('0x49')](_0x23aaaa);}})[_0x4808('0x20')](function(_0x9551ef){if(_0x9551ef){_0xb3885e=_0x9551ef[_0x4808('0x32')];if(!_0x56bfd9[_0x4808('0x2d')][_0x4808('0x33')](_0x4808('0x34'))){_0x23aaaa[_0x4808('0x19')]=qs[_0x4808('0x19')](_0x56bfd9[_0x4808('0x2d')][_0x4808('0x19')]);_0x23aaaa[_0x4808('0x17')]=qs[_0x4808('0x17')](_0x56bfd9[_0x4808('0x2d')]['offset']);}return _0x5dc2ac['getSubjects'](_0x23aaaa);}})[_0x4808('0x20')](function(_0x17aa84){if(_0x17aa84){return _0x17aa84?{'count':_0xb3885e,'rows':_0x17aa84}:null;}})[_0x4808('0x20')](respondWithResult(_0x515dd3,null))['catch'](handleError(_0x515dd3,null));};exports[_0x4808('0x4b')]=function(_0x1f1832,_0x5201b0,_0x512d3f){var _0xe37966={};var _0x222da8={};var _0x766b3;var _0x1cb251;return db[_0x4808('0x27')][_0x4808('0x4a')]({'where':{'id':_0x1f1832[_0x4808('0x41')]['id']}})[_0x4808('0x20')](handleEntityNotFound(_0x5201b0,null))['then'](function(_0x3951c0){if(_0x3951c0){_0x766b3=_0x3951c0;_0x222da8[_0x4808('0x2b')]=_[_0x4808('0x2c')](db[_0x4808('0x48')][_0x4808('0x28')]);_0x222da8[_0x4808('0x2d')]=_[_0x4808('0x2c')](_0x1f1832['query']);_0x222da8[_0x4808('0x2e')]=_[_0x4808('0x2f')](_0x222da8[_0x4808('0x2b')],_0x222da8[_0x4808('0x2d')]);_0xe37966[_0x4808('0x30')]=_[_0x4808('0x2f')](_0x222da8[_0x4808('0x2b')],qs[_0x4808('0x31')](_0x1f1832['query']['fields']));_0xe37966[_0x4808('0x30')]=_0xe37966[_0x4808('0x30')][_0x4808('0x32')]?_0xe37966[_0x4808('0x30')]:_0x222da8[_0x4808('0x2b')];_0xe37966['order']=qs[_0x4808('0x36')](_0x1f1832[_0x4808('0x2d')][_0x4808('0x36')]);_0xe37966['where']=qs[_0x4808('0x2e')](_['pick'](_0x1f1832['query'],_0x222da8['filters']));if(_0x1f1832['query'][_0x4808('0x39')]){_0xe37966[_0x4808('0x37')]=_[_0x4808('0x3a')](_0xe37966[_0x4808('0x37')],{'$or':_[_0x4808('0x26')](_0xe37966['attributes'],function(_0x25bebd){var _0x4d94e4={};_0x4d94e4[_0x25bebd]={'$like':'%'+_0x1f1832[_0x4808('0x2d')][_0x4808('0x39')]+'%'};return _0x4d94e4;})});}_0xe37966=_[_0x4808('0x3a')]({},_0xe37966,_0x1f1832[_0x4808('0x3c')]);return _0x766b3['getDescriptions'](_0xe37966);}})[_0x4808('0x20')](function(_0x250b4d){if(_0x250b4d){_0x1cb251=_0x250b4d[_0x4808('0x32')];if(!_0x1f1832['query'][_0x4808('0x33')](_0x4808('0x34'))){_0xe37966[_0x4808('0x19')]=qs[_0x4808('0x19')](_0x1f1832[_0x4808('0x2d')][_0x4808('0x19')]);_0xe37966['offset']=qs[_0x4808('0x17')](_0x1f1832[_0x4808('0x2d')][_0x4808('0x17')]);}return _0x766b3[_0x4808('0x4b')](_0xe37966);}})[_0x4808('0x20')](function(_0x2ac378){if(_0x2ac378){return _0x2ac378?{'count':_0x1cb251,'rows':_0x2ac378}:null;}})[_0x4808('0x20')](respondWithResult(_0x5201b0,null))[_0x4808('0x43')](handleError(_0x5201b0,null));};exports[_0x4808('0x4c')]=function(_0xe0e4f2,_0x380212,_0x2304da){var _0x39d187={};var _0x5b57f4={};var _0x11bdc2;var _0x195727;return db[_0x4808('0x27')]['findOne']({'where':{'id':_0xe0e4f2[_0x4808('0x41')]['id']}})['then'](handleEntityNotFound(_0x380212,null))[_0x4808('0x20')](function(_0x420f34){if(_0x420f34){_0x11bdc2=_0x420f34;_0x5b57f4[_0x4808('0x2b')]=_[_0x4808('0x2c')](db[_0x4808('0x4d')]['rawAttributes']);_0x5b57f4['query']=_[_0x4808('0x2c')](_0xe0e4f2['query']);_0x5b57f4['filters']=_[_0x4808('0x2f')](_0x5b57f4[_0x4808('0x2b')],_0x5b57f4[_0x4808('0x2d')]);_0x39d187['attributes']=_[_0x4808('0x2f')](_0x5b57f4[_0x4808('0x2b')],qs['fields'](_0xe0e4f2[_0x4808('0x2d')][_0x4808('0x31')]));_0x39d187[_0x4808('0x30')]=_0x39d187[_0x4808('0x30')][_0x4808('0x32')]?_0x39d187[_0x4808('0x30')]:_0x5b57f4[_0x4808('0x2b')];_0x39d187['order']=qs[_0x4808('0x36')](_0xe0e4f2[_0x4808('0x2d')][_0x4808('0x36')]);_0x39d187[_0x4808('0x37')]=qs[_0x4808('0x2e')](_[_0x4808('0x38')](_0xe0e4f2[_0x4808('0x2d')],_0x5b57f4['filters']));if(_0xe0e4f2[_0x4808('0x2d')]['filter']){_0x39d187['where']=_[_0x4808('0x3a')](_0x39d187[_0x4808('0x37')],{'$or':_['map'](_0x39d187['attributes'],function(_0x474f9d){var _0x487d73={};_0x487d73[_0x474f9d]={'$like':'%'+_0xe0e4f2[_0x4808('0x2d')]['filter']+'%'};return _0x487d73;})});}_0x39d187=_[_0x4808('0x3a')]({},_0x39d187,_0xe0e4f2[_0x4808('0x3c')]);return _0x11bdc2[_0x4808('0x4c')](_0x39d187);}})[_0x4808('0x20')](function(_0x45eb97){if(_0x45eb97){_0x195727=_0x45eb97[_0x4808('0x32')];if(!_0xe0e4f2['query'][_0x4808('0x33')]('nolimit')){_0x39d187[_0x4808('0x19')]=qs[_0x4808('0x19')](_0xe0e4f2[_0x4808('0x2d')][_0x4808('0x19')]);_0x39d187[_0x4808('0x17')]=qs['offset'](_0xe0e4f2[_0x4808('0x2d')][_0x4808('0x17')]);}return _0x11bdc2[_0x4808('0x4c')](_0x39d187);}})[_0x4808('0x20')](function(_0xeb6ab9){if(_0xeb6ab9){return _0xeb6ab9?{'count':_0x195727,'rows':_0xeb6ab9}:null;}})[_0x4808('0x20')](respondWithResult(_0x380212,null))[_0x4808('0x43')](handleError(_0x380212,null));};exports[_0x4808('0x4e')]=function(_0x50c0fd,_0x52aa89,_0x288ebd){if(_0x50c0fd[_0x4808('0x45')]['id']){delete _0x50c0fd[_0x4808('0x45')]['id'];}return db[_0x4808('0x27')][_0x4808('0x4a')]({'where':{'id':_0x50c0fd[_0x4808('0x41')]['id']}})[_0x4808('0x20')](handleEntityNotFound(_0x52aa89,null))[_0x4808('0x20')](function(_0x94d8d0){if(_0x94d8d0){return _0x94d8d0['setTags'](_0x50c0fd['body'][_0x4808('0x4f')]||[]);}return null;})[_0x4808('0x20')](respondWithResult(_0x52aa89,null))[_0x4808('0x43')](handleError(_0x52aa89,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 0e813bf..411e6f1 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 _0xe962=['../../config/environment','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','lodash','util','api','moment','request-promise','path'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xe962,0x9f));var _0x2e96=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe962[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x2e96('0x0'));var util=require(_0x2e96('0x1'));var logger=require('../../config/logger')(_0x2e96('0x2'));var moment=require(_0x2e96('0x3'));var BPromise=require('bluebird');var rp=require(_0x2e96('0x4'));var fs=require('fs');var path=require(_0x2e96('0x5'));var rimraf=require('rimraf');var config=require(_0x2e96('0x6'));var attributes=require(_0x2e96('0x7'));module[_0x2e96('0x8')]=function(_0x2d77ad,_0x2a8832){return _0x2d77ad[_0x2e96('0x9')](_0x2e96('0xa'),attributes,{'tableName':'int_desk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc557=['util','moment','bluebird','request-promise','path','../../config/environment','./intDeskConfiguration.attributes','exports','DeskConfiguration','int_desk_configurations','lodash'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0xc557,0x180));var _0x7c55=function(_0x4a09c6,_0x54ce5e){_0x4a09c6=_0x4a09c6-0x0;var _0x25d834=_0xc557[_0x4a09c6];return _0x25d834;};'use strict';var _=require(_0x7c55('0x0'));var util=require(_0x7c55('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x7c55('0x2'));var BPromise=require(_0x7c55('0x3'));var rp=require(_0x7c55('0x4'));var fs=require('fs');var path=require(_0x7c55('0x5'));var rimraf=require('rimraf');var config=require(_0x7c55('0x6'));var attributes=require(_0x7c55('0x7'));module[_0x7c55('0x8')]=function(_0x3395fd,_0x4a9830){return _0x3395fd['define'](_0x7c55('0x9'),attributes,{'tableName':_0x7c55('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 9588b27..4178009 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 _0x24d5=['catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0x24d5,0xa9));var _0x524d=function(_0x2f477d,_0x2dfcc6){_0x2f477d=_0x2f477d-0x0;var _0x434974=_0x24d5[_0x2f477d];return _0x434974;};'use strict';var _=require(_0x524d('0x0'));var util=require(_0x524d('0x1'));var moment=require(_0x524d('0x2'));var BPromise=require('bluebird');var rs=require(_0x524d('0x3'));var fs=require('fs');var Redis=require(_0x524d('0x4'));var db=require(_0x524d('0x5'))['db'];var utils=require(_0x524d('0x6'));var logger=require(_0x524d('0x7'))(_0x524d('0x8'));var config=require(_0x524d('0x9'));var jayson=require(_0x524d('0xa'));var client=jayson['client'][_0x524d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1c27ee,_0x348814,_0xb2cba){return new BPromise(function(_0x40702d,_0x30ade2){return client[_0x524d('0xc')](_0x1c27ee,_0xb2cba)[_0x524d('0xd')](function(_0x25172c){logger[_0x524d('0xe')](_0x524d('0xf'),_0x348814,_0x524d('0x10'));logger['debug'](_0x524d('0x11'),_0x348814,'request\x20sent',JSON[_0x524d('0x12')](_0x25172c));if(_0x25172c[_0x524d('0x13')]){if(_0x25172c[_0x524d('0x13')][_0x524d('0x14')]===0x1f4){logger['error'](_0x524d('0xf'),_0x348814,_0x25172c[_0x524d('0x13')][_0x524d('0x15')]);return _0x30ade2(_0x25172c[_0x524d('0x13')]['message']);}logger[_0x524d('0x13')](_0x524d('0xf'),_0x348814,_0x25172c[_0x524d('0x13')][_0x524d('0x15')]);return _0x40702d(_0x25172c[_0x524d('0x13')][_0x524d('0x15')]);}else{logger[_0x524d('0xe')](_0x524d('0xf'),_0x348814,_0x524d('0x10'));_0x40702d(_0x25172c[_0x524d('0x16')][_0x524d('0x15')]);}})[_0x524d('0x17')](function(_0x2c47b0){logger[_0x524d('0x13')](_0x524d('0xf'),_0x348814,_0x2c47b0);_0x30ade2(_0x2c47b0);});});} \ No newline at end of file +var _0x3d04=['result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','stringify','error','DeskConfiguration,\x20%s,\x20%s','message','info'];(function(_0x4d6d5f,_0x5d75bb){var _0x49ba9e=function(_0x4db534){while(--_0x4db534){_0x4d6d5f['push'](_0x4d6d5f['shift']());}};_0x49ba9e(++_0x5d75bb);}(_0x3d04,0xbe));var _0x43d0=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x3d04[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x43d0('0x0'));var util=require(_0x43d0('0x1'));var moment=require(_0x43d0('0x2'));var BPromise=require(_0x43d0('0x3'));var rs=require(_0x43d0('0x4'));var fs=require('fs');var Redis=require(_0x43d0('0x5'));var db=require(_0x43d0('0x6'))['db'];var utils=require(_0x43d0('0x7'));var logger=require('../../config/logger')(_0x43d0('0x8'));var config=require(_0x43d0('0x9'));var jayson=require(_0x43d0('0xa'));var client=jayson[_0x43d0('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x484271,_0x50919e,_0x5efb95){return new BPromise(function(_0x457550,_0x3344d3){return client[_0x43d0('0xc')](_0x484271,_0x5efb95)[_0x43d0('0xd')](function(_0x44a763){logger['info']('DeskConfiguration,\x20%s,\x20%s',_0x50919e,_0x43d0('0xe'));logger['debug']('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x50919e,_0x43d0('0xe'),JSON[_0x43d0('0xf')](_0x44a763));if(_0x44a763[_0x43d0('0x10')]){if(_0x44a763[_0x43d0('0x10')]['code']===0x1f4){logger[_0x43d0('0x10')](_0x43d0('0x11'),_0x50919e,_0x44a763['error'][_0x43d0('0x12')]);return _0x3344d3(_0x44a763[_0x43d0('0x10')][_0x43d0('0x12')]);}logger['error'](_0x43d0('0x11'),_0x50919e,_0x44a763[_0x43d0('0x10')][_0x43d0('0x12')]);return _0x457550(_0x44a763['error'][_0x43d0('0x12')]);}else{logger[_0x43d0('0x13')](_0x43d0('0x11'),_0x50919e,_0x43d0('0xe'));_0x457550(_0x44a763[_0x43d0('0x14')]['message']);}})['catch'](function(_0x1e91a7){logger[_0x43d0('0x10')](_0x43d0('0x11'),_0x50919e,_0x1e91a7);_0x3344d3(_0x1e91a7);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 144b59d..b2cc397 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 _0x2764=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','/:id','show','post','create','update','delete','destroy','multer','util','path','connect-timeout'];(function(_0x3c307c,_0x1b06c4){var _0x32cf08=function(_0x371144){while(--_0x371144){_0x3c307c['push'](_0x3c307c['shift']());}};_0x32cf08(++_0x1b06c4);}(_0x2764,0x13f));var _0x4276=function(_0x5bdda9,_0x361059){_0x5bdda9=_0x5bdda9-0x0;var _0x42ee98=_0x2764[_0x5bdda9];return _0x42ee98;};'use strict';var multer=require(_0x4276('0x0'));var util=require(_0x4276('0x1'));var path=require(_0x4276('0x2'));var timeout=require(_0x4276('0x3'));var express=require(_0x4276('0x4'));var router=express[_0x4276('0x5')]();var fs_extra=require(_0x4276('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x4276('0x7'));var config=require(_0x4276('0x8'));var controller=require(_0x4276('0x9'));router[_0x4276('0xa')]('/',auth[_0x4276('0xb')](),controller['index']);router[_0x4276('0xa')](_0x4276('0xc'),auth[_0x4276('0xb')](),controller[_0x4276('0xd')]);router[_0x4276('0xe')]('/',auth['isAuthenticated'](),controller[_0x4276('0xf')]);router['put']('/:id',auth[_0x4276('0xb')](),controller[_0x4276('0x10')]);router[_0x4276('0x11')](_0x4276('0xc'),auth[_0x4276('0xb')](),controller[_0x4276('0x12')]);module['exports']=router; \ No newline at end of file +var _0x753c=['delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update'];(function(_0x2dd2f5,_0x1bf66a){var _0x36d48e=function(_0x3221d4){while(--_0x3221d4){_0x2dd2f5['push'](_0x2dd2f5['shift']());}};_0x36d48e(++_0x1bf66a);}(_0x753c,0x96));var _0xc753=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x753c[_0x6c993a];return _0x27f547;};'use strict';var multer=require('multer');var util=require(_0xc753('0x0'));var path=require('path');var timeout=require(_0xc753('0x1'));var express=require(_0xc753('0x2'));var router=express[_0xc753('0x3')]();var fs_extra=require(_0xc753('0x4'));var auth=require(_0xc753('0x5'));var interaction=require(_0xc753('0x6'));var config=require(_0xc753('0x7'));var controller=require(_0xc753('0x8'));router[_0xc753('0x9')]('/',auth[_0xc753('0xa')](),controller[_0xc753('0xb')]);router[_0xc753('0x9')](_0xc753('0xc'),auth[_0xc753('0xa')](),controller[_0xc753('0xd')]);router[_0xc753('0xe')]('/',auth[_0xc753('0xa')](),controller[_0xc753('0xf')]);router[_0xc753('0x10')](_0xc753('0xc'),auth[_0xc753('0xa')](),controller[_0xc753('0x11')]);router[_0xc753('0x12')](_0xc753('0xc'),auth['isAuthenticated'](),controller[_0xc753('0x13')]);module[_0xc753('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index efe64da..b7b6d70 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 _0xd7d0=['exports','string','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize'];(function(_0x412d4f,_0x4a368f){var _0x4e8f13=function(_0x599a51){while(--_0x599a51){_0x412d4f['push'](_0x412d4f['shift']());}};_0x4e8f13(++_0x4a368f);}(_0xd7d0,0xe7));var _0x0d7d=function(_0xfeba9,_0x28c392){_0xfeba9=_0xfeba9-0x0;var _0x266971=_0xd7d0[_0xfeba9];return _0x266971;};'use strict';var Sequelize=require(_0x0d7d('0x0'));module[_0x0d7d('0x1')]={'type':{'type':Sequelize['ENUM'](_0x0d7d('0x2'),'variable',_0x0d7d('0x3'),_0x0d7d('0x4'),_0x0d7d('0x5')),'defaultValue':_0x0d7d('0x2')},'content':{'type':Sequelize[_0x0d7d('0x6')]},'key':{'type':Sequelize[_0x0d7d('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x0d7d('0x2'),'variable',_0x0d7d('0x3'))},'keyContent':{'type':Sequelize[_0x0d7d('0x6')]},'idField':{'type':Sequelize[_0x0d7d('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x0d7d('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0d7d('0x6')]}}; \ No newline at end of file +var _0xc125=['customVariable','keyValue','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable'];(function(_0x2c8ed0,_0x4a03fe){var _0x4045be=function(_0x3c1b80){while(--_0x3c1b80){_0x2c8ed0['push'](_0x2c8ed0['shift']());}};_0x4045be(++_0x4a03fe);}(_0xc125,0x109));var _0x5c12=function(_0x395b8e,_0x549d34){_0x395b8e=_0x395b8e-0x0;var _0x4ce76a=_0xc125[_0x395b8e];return _0x4ce76a;};'use strict';var Sequelize=require(_0x5c12('0x0'));module[_0x5c12('0x1')]={'type':{'type':Sequelize[_0x5c12('0x2')](_0x5c12('0x3'),_0x5c12('0x4'),_0x5c12('0x5'),_0x5c12('0x6'),'picklist'),'defaultValue':_0x5c12('0x3')},'content':{'type':Sequelize[_0x5c12('0x7')]},'key':{'type':Sequelize[_0x5c12('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x5c12('0x3'),_0x5c12('0x4'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x5c12('0x7')]},'nameField':{'type':Sequelize[_0x5c12('0x7')]},'customField':{'type':Sequelize[_0x5c12('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index fa2345b..207d735 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 _0x7c09=['stack','name','send','index','map','DeskField','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','merge','find','create','body','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x7c09,0x102));var _0x97c0=function(_0x27a08e,_0x1d9a5b){_0x27a08e=_0x27a08e-0x0;var _0x20d509=_0x7c09[_0x27a08e];return _0x20d509;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x97c0('0x0'));var zipdir=require(_0x97c0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x97c0('0x2'));var moment=require(_0x97c0('0x3'));var BPromise=require(_0x97c0('0x4'));var Mustache=require(_0x97c0('0x5'));var util=require(_0x97c0('0x6'));var path=require(_0x97c0('0x7'));var sox=require(_0x97c0('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x97c0('0x9'));var squel=require(_0x97c0('0xa'));var crypto=require(_0x97c0('0xb'));var jsforce=require(_0x97c0('0xc'));var deskjs=require(_0x97c0('0xd'));var toCsv=require('to-csv');var querystring=require(_0x97c0('0xe'));var Papa=require('papaparse');var Redis=require(_0x97c0('0xf'));var authService=require(_0x97c0('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x97c0('0x11'));var logger=require(_0x97c0('0x12'))(_0x97c0('0x13'));var utils=require(_0x97c0('0x14'));var config=require(_0x97c0('0x15'));var licenseUtil=require(_0x97c0('0x16'));var db=require(_0x97c0('0x17'))['db'];function respondWithStatusCode(_0x39a3b4,_0x9ca3c1){_0x9ca3c1=_0x9ca3c1||0xcc;return function(_0x2ecf34){if(_0x2ecf34){return _0x39a3b4[_0x97c0('0x18')](_0x9ca3c1);}return _0x39a3b4[_0x97c0('0x19')](_0x9ca3c1)[_0x97c0('0x1a')]();};}function respondWithResult(_0x514782,_0x3f2fc2){_0x3f2fc2=_0x3f2fc2||0xc8;return function(_0x15b336){if(_0x15b336){return _0x514782[_0x97c0('0x19')](_0x3f2fc2)['json'](_0x15b336);}};}function respondWithFilteredResult(_0x42027d,_0x9ca6a8){return function(_0x379951){if(_0x379951){var _0x21e5f7=typeof _0x9ca6a8[_0x97c0('0x1b')]===_0x97c0('0x1c')&&typeof _0x9ca6a8['limit']===_0x97c0('0x1c');var _0x3ae7c4=_0x379951['count'];var _0x560ac0=_0x21e5f7?0x0:_0x9ca6a8[_0x97c0('0x1b')];var _0x179d43=_0x21e5f7?_0x379951[_0x97c0('0x1d')]:_0x9ca6a8[_0x97c0('0x1b')]+_0x9ca6a8[_0x97c0('0x1e')];var _0x4fed42;if(_0x179d43>=_0x3ae7c4){_0x179d43=_0x3ae7c4;_0x4fed42=0xc8;}else{_0x4fed42=0xce;}_0x42027d[_0x97c0('0x19')](_0x4fed42);return _0x42027d[_0x97c0('0x1f')](_0x97c0('0x20'),_0x560ac0+'-'+_0x179d43+'/'+_0x3ae7c4)['json'](_0x379951);}return null;};}function patchUpdates(_0x554122){return function(_0x2b74a2){try{jsonpatch[_0x97c0('0x21')](_0x2b74a2,_0x554122,!![]);}catch(_0x169f19){return BPromise['reject'](_0x169f19);}return _0x2b74a2[_0x97c0('0x22')]();};}function saveUpdates(_0x20bc4c,_0x31ffb7){return function(_0x272314){if(_0x272314){return _0x272314[_0x97c0('0x23')](_0x20bc4c)[_0x97c0('0x24')](function(_0x9dff60){return _0x9dff60;});}return null;};}function removeEntity(_0x5ac457,_0x60ab00){return function(_0x29b3aa){if(_0x29b3aa){return _0x29b3aa[_0x97c0('0x25')]()[_0x97c0('0x24')](function(){_0x5ac457['status'](0xcc)[_0x97c0('0x1a')]();});}};}function handleEntityNotFound(_0x14cada,_0x52a429){return function(_0x2ec9d6){if(!_0x2ec9d6){_0x14cada[_0x97c0('0x18')](0x194);}return _0x2ec9d6;};}function handleError(_0x447316,_0x4af5a5){_0x4af5a5=_0x4af5a5||0x1f4;return function(_0x4f11ba){logger['error'](_0x4f11ba[_0x97c0('0x26')]);if(_0x4f11ba[_0x97c0('0x27')]){delete _0x4f11ba[_0x97c0('0x27')];}_0x447316[_0x97c0('0x19')](_0x4af5a5)[_0x97c0('0x28')](_0x4f11ba);};}exports[_0x97c0('0x29')]=function(_0x4a3645,_0x10e47e){var _0x1c183f={},_0x325090={},_0x4ad645={'count':0x0,'rows':[]};var _0x14617c=_[_0x97c0('0x2a')](db[_0x97c0('0x2b')][_0x97c0('0x2c')],function(_0x2a7b2b){return{'name':_0x2a7b2b['fieldName'],'type':_0x2a7b2b['type'][_0x97c0('0x2d')]};});_0x325090[_0x97c0('0x2e')]=_[_0x97c0('0x2a')](_0x14617c,'name');_0x325090[_0x97c0('0x2f')]=_[_0x97c0('0x30')](_0x4a3645['query']);_0x325090[_0x97c0('0x31')]=_[_0x97c0('0x32')](_0x325090[_0x97c0('0x2e')],_0x325090[_0x97c0('0x2f')]);_0x1c183f[_0x97c0('0x33')]=_[_0x97c0('0x32')](_0x325090[_0x97c0('0x2e')],qs[_0x97c0('0x34')](_0x4a3645[_0x97c0('0x2f')][_0x97c0('0x34')]));_0x1c183f[_0x97c0('0x33')]=_0x1c183f[_0x97c0('0x33')][_0x97c0('0x35')]?_0x1c183f[_0x97c0('0x33')]:_0x325090[_0x97c0('0x2e')];if(!_0x4a3645['query'][_0x97c0('0x36')](_0x97c0('0x37'))){_0x1c183f[_0x97c0('0x1e')]=qs[_0x97c0('0x1e')](_0x4a3645[_0x97c0('0x2f')][_0x97c0('0x1e')]);_0x1c183f[_0x97c0('0x1b')]=qs[_0x97c0('0x1b')](_0x4a3645['query'][_0x97c0('0x1b')]);}_0x1c183f['order']=qs[_0x97c0('0x38')](_0x4a3645[_0x97c0('0x2f')][_0x97c0('0x38')]);_0x1c183f[_0x97c0('0x39')]=qs[_0x97c0('0x31')](_[_0x97c0('0x3a')](_0x4a3645[_0x97c0('0x2f')],_0x325090[_0x97c0('0x31')]),_0x14617c);if(_0x4a3645[_0x97c0('0x2f')][_0x97c0('0x3b')]){_0x1c183f[_0x97c0('0x39')]=_['merge'](_0x1c183f[_0x97c0('0x39')],{'$or':_[_0x97c0('0x2a')](_0x14617c,function(_0x4d47b1){if(_0x4d47b1[_0x97c0('0x3c')]!==_0x97c0('0x3d')){var _0x2aeffc={};_0x2aeffc[_0x4d47b1[_0x97c0('0x27')]]={'$like':'%'+_0x4a3645['query'][_0x97c0('0x3b')]+'%'};return _0x2aeffc;}})});}_0x1c183f=_['merge']({},_0x1c183f,_0x4a3645[_0x97c0('0x3e')]);var _0x64cfcd={'where':_0x1c183f['where']};return db[_0x97c0('0x2b')][_0x97c0('0x1d')](_0x64cfcd)[_0x97c0('0x24')](function(_0xb13649){_0x4ad645[_0x97c0('0x1d')]=_0xb13649;if(_0x4a3645[_0x97c0('0x2f')][_0x97c0('0x3f')]){_0x1c183f[_0x97c0('0x40')]=[{'all':!![]}];}return db[_0x97c0('0x2b')][_0x97c0('0x41')](_0x1c183f);})[_0x97c0('0x24')](function(_0x2cca4c){_0x4ad645[_0x97c0('0x42')]=_0x2cca4c;return _0x4ad645;})['then'](respondWithFilteredResult(_0x10e47e,_0x1c183f))[_0x97c0('0x43')](handleError(_0x10e47e,null));};exports[_0x97c0('0x44')]=function(_0x1dc6ff,_0x142421){var _0x312fce={'raw':!![],'where':{'id':_0x1dc6ff[_0x97c0('0x45')]['id']}},_0x375ebc={};_0x375ebc['model']=_['keys'](db[_0x97c0('0x2b')][_0x97c0('0x2c')]);_0x375ebc[_0x97c0('0x2f')]=_[_0x97c0('0x30')](_0x1dc6ff[_0x97c0('0x2f')]);_0x375ebc['filters']=_['intersection'](_0x375ebc['model'],_0x375ebc[_0x97c0('0x2f')]);_0x312fce['attributes']=_['intersection'](_0x375ebc[_0x97c0('0x2e')],qs[_0x97c0('0x34')](_0x1dc6ff[_0x97c0('0x2f')][_0x97c0('0x34')]));_0x312fce[_0x97c0('0x33')]=_0x312fce['attributes'][_0x97c0('0x35')]?_0x312fce[_0x97c0('0x33')]:_0x375ebc[_0x97c0('0x2e')];if(_0x1dc6ff[_0x97c0('0x2f')][_0x97c0('0x3f')]){_0x312fce[_0x97c0('0x40')]=[{'all':!![]}];}_0x312fce=_[_0x97c0('0x46')]({},_0x312fce,_0x1dc6ff[_0x97c0('0x3e')]);return db[_0x97c0('0x2b')][_0x97c0('0x47')](_0x312fce)['then'](handleEntityNotFound(_0x142421,null))[_0x97c0('0x24')](respondWithResult(_0x142421,null))[_0x97c0('0x43')](handleError(_0x142421,null));};exports[_0x97c0('0x48')]=function(_0x276c98,_0x4ff0a5){return db['DeskField'][_0x97c0('0x48')](_0x276c98[_0x97c0('0x49')],{})[_0x97c0('0x24')](respondWithResult(_0x4ff0a5,0xc9))['catch'](handleError(_0x4ff0a5,null));};exports[_0x97c0('0x23')]=function(_0xac56ac,_0x240f68){if(_0xac56ac[_0x97c0('0x49')]['id']){delete _0xac56ac[_0x97c0('0x49')]['id'];}return db['DeskField'][_0x97c0('0x47')]({'where':{'id':_0xac56ac[_0x97c0('0x45')]['id']}})[_0x97c0('0x24')](handleEntityNotFound(_0x240f68,null))['then'](saveUpdates(_0xac56ac['body'],null))[_0x97c0('0x24')](respondWithResult(_0x240f68,null))['catch'](handleError(_0x240f68,null));};exports['destroy']=function(_0x473b63,_0x20e2a5){return db[_0x97c0('0x2b')]['find']({'where':{'id':_0x473b63['params']['id']}})['then'](handleEntityNotFound(_0x20e2a5,null))[_0x97c0('0x24')](removeEntity(_0x20e2a5,null))[_0x97c0('0x43')](handleError(_0x20e2a5,null));}; \ No newline at end of file +var _0xb245=['key','model','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','limit','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','util','path','sox','ejs','fs-extra','squel','desk.js','to-csv','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','count','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','send','index','map','DeskField','rawAttributes','fieldName','type'];(function(_0x4c260a,_0x148241){var _0x17bbdd=function(_0x4f3e9f){while(--_0x4f3e9f){_0x4c260a['push'](_0x4c260a['shift']());}};_0x17bbdd(++_0x148241);}(_0xb245,0xf8));var _0x5b24=function(_0x4dc335,_0x19b24b){_0x4dc335=_0x4dc335-0x0;var _0x115ac7=_0xb245[_0x4dc335];return _0x115ac7;};'use strict';var emlformat=require(_0x5b24('0x0'));var rimraf=require(_0x5b24('0x1'));var zipdir=require(_0x5b24('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5b24('0x3'));var moment=require(_0x5b24('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5b24('0x5'));var path=require(_0x5b24('0x6'));var sox=require(_0x5b24('0x7'));var csv=require('to-csv');var ejs=require(_0x5b24('0x8'));var fs=require('fs');var fs_extra=require(_0x5b24('0x9'));var _=require('lodash');var squel=require(_0x5b24('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5b24('0xb'));var toCsv=require(_0x5b24('0xc'));var querystring=require('querystring');var Papa=require(_0x5b24('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5b24('0xe'));var as=require(_0x5b24('0xf'));var hardwareService=require(_0x5b24('0x10'));var logger=require(_0x5b24('0x11'))(_0x5b24('0x12'));var utils=require(_0x5b24('0x13'));var config=require(_0x5b24('0x14'));var licenseUtil=require(_0x5b24('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x337154,_0x3d0f0c){_0x3d0f0c=_0x3d0f0c||0xcc;return function(_0x3191af){if(_0x3191af){return _0x337154['sendStatus'](_0x3d0f0c);}return _0x337154[_0x5b24('0x16')](_0x3d0f0c)[_0x5b24('0x17')]();};}function respondWithResult(_0x158d8f,_0x1d8317){_0x1d8317=_0x1d8317||0xc8;return function(_0xefe820){if(_0xefe820){return _0x158d8f[_0x5b24('0x16')](_0x1d8317)[_0x5b24('0x18')](_0xefe820);}};}function respondWithFilteredResult(_0x123329,_0x191602){return function(_0x4eff69){if(_0x4eff69){var _0xe98dec=typeof _0x191602[_0x5b24('0x19')]===_0x5b24('0x1a')&&typeof _0x191602['limit']==='undefined';var _0xec20fe=_0x4eff69[_0x5b24('0x1b')];var _0x3d466f=_0xe98dec?0x0:_0x191602['offset'];var _0x2fe4a8=_0xe98dec?_0x4eff69[_0x5b24('0x1b')]:_0x191602['offset']+_0x191602['limit'];var _0x4523ee;if(_0x2fe4a8>=_0xec20fe){_0x2fe4a8=_0xec20fe;_0x4523ee=0xc8;}else{_0x4523ee=0xce;}_0x123329[_0x5b24('0x16')](_0x4523ee);return _0x123329['set'](_0x5b24('0x1c'),_0x3d466f+'-'+_0x2fe4a8+'/'+_0xec20fe)['json'](_0x4eff69);}return null;};}function patchUpdates(_0x312b50){return function(_0x31bb39){try{jsonpatch[_0x5b24('0x1d')](_0x31bb39,_0x312b50,!![]);}catch(_0x332aa0){return BPromise[_0x5b24('0x1e')](_0x332aa0);}return _0x31bb39[_0x5b24('0x1f')]();};}function saveUpdates(_0x5b6ab1,_0x3b79bc){return function(_0x2bded9){if(_0x2bded9){return _0x2bded9[_0x5b24('0x20')](_0x5b6ab1)[_0x5b24('0x21')](function(_0x572cfc){return _0x572cfc;});}return null;};}function removeEntity(_0x4ba7b7,_0x293240){return function(_0x238360){if(_0x238360){return _0x238360[_0x5b24('0x22')]()[_0x5b24('0x21')](function(){_0x4ba7b7[_0x5b24('0x16')](0xcc)[_0x5b24('0x17')]();});}};}function handleEntityNotFound(_0xd1eda5,_0x2aa426){return function(_0x23c1b3){if(!_0x23c1b3){_0xd1eda5[_0x5b24('0x23')](0x194);}return _0x23c1b3;};}function handleError(_0x55ce26,_0x1f012d){_0x1f012d=_0x1f012d||0x1f4;return function(_0xfb4bae){logger['error'](_0xfb4bae[_0x5b24('0x24')]);if(_0xfb4bae['name']){delete _0xfb4bae['name'];}_0x55ce26['status'](_0x1f012d)[_0x5b24('0x25')](_0xfb4bae);};}exports[_0x5b24('0x26')]=function(_0x5e5ed8,_0x50f8f0){var _0x13fd3a={},_0x455a6e={},_0x9aec64={'count':0x0,'rows':[]};var _0x47998b=_[_0x5b24('0x27')](db[_0x5b24('0x28')][_0x5b24('0x29')],function(_0x2657bf){return{'name':_0x2657bf[_0x5b24('0x2a')],'type':_0x2657bf[_0x5b24('0x2b')][_0x5b24('0x2c')]};});_0x455a6e[_0x5b24('0x2d')]=_[_0x5b24('0x27')](_0x47998b,_0x5b24('0x2e'));_0x455a6e[_0x5b24('0x2f')]=_[_0x5b24('0x30')](_0x5e5ed8[_0x5b24('0x2f')]);_0x455a6e[_0x5b24('0x31')]=_[_0x5b24('0x32')](_0x455a6e[_0x5b24('0x2d')],_0x455a6e[_0x5b24('0x2f')]);_0x13fd3a['attributes']=_[_0x5b24('0x32')](_0x455a6e[_0x5b24('0x2d')],qs[_0x5b24('0x33')](_0x5e5ed8[_0x5b24('0x2f')]['fields']));_0x13fd3a[_0x5b24('0x34')]=_0x13fd3a[_0x5b24('0x34')][_0x5b24('0x35')]?_0x13fd3a[_0x5b24('0x34')]:_0x455a6e[_0x5b24('0x2d')];if(!_0x5e5ed8[_0x5b24('0x2f')][_0x5b24('0x36')]('nolimit')){_0x13fd3a[_0x5b24('0x37')]=qs[_0x5b24('0x37')](_0x5e5ed8[_0x5b24('0x2f')][_0x5b24('0x37')]);_0x13fd3a[_0x5b24('0x19')]=qs['offset'](_0x5e5ed8[_0x5b24('0x2f')][_0x5b24('0x19')]);}_0x13fd3a['order']=qs[_0x5b24('0x38')](_0x5e5ed8[_0x5b24('0x2f')][_0x5b24('0x38')]);_0x13fd3a[_0x5b24('0x39')]=qs[_0x5b24('0x31')](_[_0x5b24('0x3a')](_0x5e5ed8['query'],_0x455a6e[_0x5b24('0x31')]),_0x47998b);if(_0x5e5ed8[_0x5b24('0x2f')]['filter']){_0x13fd3a[_0x5b24('0x39')]=_['merge'](_0x13fd3a[_0x5b24('0x39')],{'$or':_[_0x5b24('0x27')](_0x47998b,function(_0x4e4bf1){if(_0x4e4bf1[_0x5b24('0x2b')]!==_0x5b24('0x3b')){var _0x1e1da1={};_0x1e1da1[_0x4e4bf1[_0x5b24('0x2e')]]={'$like':'%'+_0x5e5ed8[_0x5b24('0x2f')][_0x5b24('0x3c')]+'%'};return _0x1e1da1;}})});}_0x13fd3a=_[_0x5b24('0x3d')]({},_0x13fd3a,_0x5e5ed8[_0x5b24('0x3e')]);var _0x37faaa={'where':_0x13fd3a[_0x5b24('0x39')]};return db['DeskField'][_0x5b24('0x1b')](_0x37faaa)[_0x5b24('0x21')](function(_0x31d18a){_0x9aec64['count']=_0x31d18a;if(_0x5e5ed8[_0x5b24('0x2f')][_0x5b24('0x3f')]){_0x13fd3a[_0x5b24('0x40')]=[{'all':!![]}];}return db[_0x5b24('0x28')][_0x5b24('0x41')](_0x13fd3a);})[_0x5b24('0x21')](function(_0x233126){_0x9aec64[_0x5b24('0x42')]=_0x233126;return _0x9aec64;})[_0x5b24('0x21')](respondWithFilteredResult(_0x50f8f0,_0x13fd3a))[_0x5b24('0x43')](handleError(_0x50f8f0,null));};exports[_0x5b24('0x44')]=function(_0x270cf9,_0x5c6a9a){var _0x4fc4c6={'raw':!![],'where':{'id':_0x270cf9[_0x5b24('0x45')]['id']}},_0x38e15b={};_0x38e15b[_0x5b24('0x2d')]=_[_0x5b24('0x30')](db[_0x5b24('0x28')][_0x5b24('0x29')]);_0x38e15b[_0x5b24('0x2f')]=_[_0x5b24('0x30')](_0x270cf9[_0x5b24('0x2f')]);_0x38e15b[_0x5b24('0x31')]=_[_0x5b24('0x32')](_0x38e15b[_0x5b24('0x2d')],_0x38e15b['query']);_0x4fc4c6[_0x5b24('0x34')]=_[_0x5b24('0x32')](_0x38e15b[_0x5b24('0x2d')],qs[_0x5b24('0x33')](_0x270cf9['query'][_0x5b24('0x33')]));_0x4fc4c6[_0x5b24('0x34')]=_0x4fc4c6['attributes'][_0x5b24('0x35')]?_0x4fc4c6['attributes']:_0x38e15b[_0x5b24('0x2d')];if(_0x270cf9[_0x5b24('0x2f')][_0x5b24('0x3f')]){_0x4fc4c6[_0x5b24('0x40')]=[{'all':!![]}];}_0x4fc4c6=_[_0x5b24('0x3d')]({},_0x4fc4c6,_0x270cf9['options']);return db[_0x5b24('0x28')][_0x5b24('0x46')](_0x4fc4c6)[_0x5b24('0x21')](handleEntityNotFound(_0x5c6a9a,null))[_0x5b24('0x21')](respondWithResult(_0x5c6a9a,null))[_0x5b24('0x43')](handleError(_0x5c6a9a,null));};exports[_0x5b24('0x47')]=function(_0x43d379,_0x27cbba){return db['DeskField'][_0x5b24('0x47')](_0x43d379[_0x5b24('0x48')],{})[_0x5b24('0x21')](respondWithResult(_0x27cbba,0xc9))[_0x5b24('0x43')](handleError(_0x27cbba,null));};exports[_0x5b24('0x20')]=function(_0x2a943d,_0x29eeb3){if(_0x2a943d[_0x5b24('0x48')]['id']){delete _0x2a943d[_0x5b24('0x48')]['id'];}return db[_0x5b24('0x28')][_0x5b24('0x46')]({'where':{'id':_0x2a943d['params']['id']}})['then'](handleEntityNotFound(_0x29eeb3,null))[_0x5b24('0x21')](saveUpdates(_0x2a943d[_0x5b24('0x48')],null))['then'](respondWithResult(_0x29eeb3,null))[_0x5b24('0x43')](handleError(_0x29eeb3,null));};exports['destroy']=function(_0x5690b1,_0x44e12a){return db[_0x5b24('0x28')]['find']({'where':{'id':_0x5690b1[_0x5b24('0x45')]['id']}})['then'](handleEntityNotFound(_0x44e12a,null))[_0x5b24('0x21')](removeEntity(_0x44e12a,null))['catch'](handleError(_0x44e12a,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 451d91f..d469b09 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 _0x6e10=['desk_unique_index','idField','FieldId','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','DeskField','int_desk_fields'];(function(_0x49f8de,_0x223f99){var _0x1b98bb=function(_0x58ae30){while(--_0x58ae30){_0x49f8de['push'](_0x49f8de['shift']());}};_0x1b98bb(++_0x223f99);}(_0x6e10,0x9f));var _0x06e1=function(_0x3437c0,_0x59e6b0){_0x3437c0=_0x3437c0-0x0;var _0x53e0e7=_0x6e10[_0x3437c0];return _0x53e0e7;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x06e1('0x0'))(_0x06e1('0x1'));var moment=require(_0x06e1('0x2'));var BPromise=require(_0x06e1('0x3'));var rp=require(_0x06e1('0x4'));var fs=require('fs');var path=require(_0x06e1('0x5'));var rimraf=require(_0x06e1('0x6'));var config=require(_0x06e1('0x7'));var attributes=require('./intDeskField.attributes');module['exports']=function(_0x672062,_0x5dea43){return _0x672062['define'](_0x06e1('0x8'),attributes,{'tableName':_0x06e1('0x9'),'paranoid':![],'indexes':[{'name':_0x06e1('0xa'),'fields':[_0x06e1('0xb'),_0x06e1('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4de6=['./intDeskField.attributes','exports','define','DeskField','desk_unique_index','idField','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x13903c,_0x2c3c64){var _0x5374e3=function(_0x1e9a5d){while(--_0x1e9a5d){_0x13903c['push'](_0x13903c['shift']());}};_0x5374e3(++_0x2c3c64);}(_0x4de6,0x1b8));var _0x64de=function(_0x11bb26,_0x4a78fe){_0x11bb26=_0x11bb26-0x0;var _0x207e97=_0x4de6[_0x11bb26];return _0x207e97;};'use strict';var _=require('lodash');var util=require(_0x64de('0x0'));var logger=require('../../config/logger')(_0x64de('0x1'));var moment=require(_0x64de('0x2'));var BPromise=require(_0x64de('0x3'));var rp=require(_0x64de('0x4'));var fs=require('fs');var path=require(_0x64de('0x5'));var rimraf=require(_0x64de('0x6'));var config=require(_0x64de('0x7'));var attributes=require(_0x64de('0x8'));module[_0x64de('0x9')]=function(_0xe1f25,_0x8ea9ad){return _0xe1f25[_0x64de('0xa')](_0x64de('0xb'),attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':_0x64de('0xc'),'fields':[_0x64de('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index ed5de94..ab7ce53 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 _0x7fb6=['stringify','error','code','message','DeskField,\x20%s,\x20%s','result','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s'];(function(_0x3625ea,_0xc6bf4a){var _0x57211e=function(_0x3e5acf){while(--_0x3e5acf){_0x3625ea['push'](_0x3625ea['shift']());}};_0x57211e(++_0xc6bf4a);}(_0x7fb6,0x1ab));var _0x67fb=function(_0x7628f1,_0x10e7fc){_0x7628f1=_0x7628f1-0x0;var _0xd5fd4e=_0x7fb6[_0x7628f1];return _0xd5fd4e;};'use strict';var _=require('lodash');var util=require(_0x67fb('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x67fb('0x1'));var fs=require('fs');var Redis=require(_0x67fb('0x2'));var db=require(_0x67fb('0x3'))['db'];var utils=require(_0x67fb('0x4'));var logger=require('../../config/logger')(_0x67fb('0x5'));var config=require(_0x67fb('0x6'));var jayson=require(_0x67fb('0x7'));var client=jayson['client'][_0x67fb('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x34aaff,_0x4087be,_0x27dba7){return new BPromise(function(_0x278f6e,_0x4f4e75){return client[_0x67fb('0x9')](_0x34aaff,_0x27dba7)['then'](function(_0x289f4b){logger[_0x67fb('0xa')]('DeskField,\x20%s,\x20%s',_0x4087be,_0x67fb('0xb'));logger[_0x67fb('0xc')](_0x67fb('0xd'),_0x4087be,_0x67fb('0xb'),JSON[_0x67fb('0xe')](_0x289f4b));if(_0x289f4b[_0x67fb('0xf')]){if(_0x289f4b[_0x67fb('0xf')][_0x67fb('0x10')]===0x1f4){logger[_0x67fb('0xf')]('DeskField,\x20%s,\x20%s',_0x4087be,_0x289f4b[_0x67fb('0xf')][_0x67fb('0x11')]);return _0x4f4e75(_0x289f4b[_0x67fb('0xf')][_0x67fb('0x11')]);}logger[_0x67fb('0xf')]('DeskField,\x20%s,\x20%s',_0x4087be,_0x289f4b[_0x67fb('0xf')][_0x67fb('0x11')]);return _0x278f6e(_0x289f4b[_0x67fb('0xf')][_0x67fb('0x11')]);}else{logger['info'](_0x67fb('0x12'),_0x4087be,_0x67fb('0xb'));_0x278f6e(_0x289f4b[_0x67fb('0x13')]['message']);}})[_0x67fb('0x14')](function(_0x480030){logger[_0x67fb('0xf')](_0x67fb('0x12'),_0x4087be,_0x480030);_0x4f4e75(_0x480030);});});} \ No newline at end of file +var _0xaadb=['request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','error','message','DeskField,\x20%s,\x20%s','info','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0x4a7a03,_0x288e4a){var _0x1ed2a4=function(_0x4eb658){while(--_0x4eb658){_0x4a7a03['push'](_0x4a7a03['shift']());}};_0x1ed2a4(++_0x288e4a);}(_0xaadb,0xd0));var _0xbaad=function(_0x23a074,_0x589d9e){_0x23a074=_0x23a074-0x0;var _0x164105=_0xaadb[_0x23a074];return _0x164105;};'use strict';var _=require(_0xbaad('0x0'));var util=require(_0xbaad('0x1'));var moment=require(_0xbaad('0x2'));var BPromise=require('bluebird');var rs=require(_0xbaad('0x3'));var fs=require('fs');var Redis=require(_0xbaad('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbaad('0x5'));var logger=require(_0xbaad('0x6'))('rpc');var config=require(_0xbaad('0x7'));var jayson=require(_0xbaad('0x8'));var client=jayson[_0xbaad('0x9')][_0xbaad('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d2dbf,_0x389d78,_0x27e436){return new BPromise(function(_0x4c6f01,_0x5bfa6d){return client[_0xbaad('0xb')](_0x1d2dbf,_0x27e436)['then'](function(_0x2349bb){logger['info']('DeskField,\x20%s,\x20%s',_0x389d78,_0xbaad('0xc'));logger[_0xbaad('0xd')](_0xbaad('0xe'),_0x389d78,_0xbaad('0xc'),JSON['stringify'](_0x2349bb));if(_0x2349bb[_0xbaad('0xf')]){if(_0x2349bb[_0xbaad('0xf')]['code']===0x1f4){logger['error']('DeskField,\x20%s,\x20%s',_0x389d78,_0x2349bb[_0xbaad('0xf')][_0xbaad('0x10')]);return _0x5bfa6d(_0x2349bb[_0xbaad('0xf')][_0xbaad('0x10')]);}logger['error'](_0xbaad('0x11'),_0x389d78,_0x2349bb['error'][_0xbaad('0x10')]);return _0x4c6f01(_0x2349bb[_0xbaad('0xf')][_0xbaad('0x10')]);}else{logger[_0xbaad('0x12')](_0xbaad('0x11'),_0x389d78,_0xbaad('0xc'));_0x4c6f01(_0x2349bb['result'][_0xbaad('0x10')]);}})[_0xbaad('0x13')](function(_0x865f24){logger[_0xbaad('0xf')]('DeskField,\x20%s,\x20%s',_0x389d78,_0x865f24);_0x5bfa6d(_0x865f24);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index b8b7c2a..9cf0b77 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 _0x468e=['post','/:id/configurations','put','update','delete','exports','path','connect-timeout','express','Router','fs-extra','./intDynamics365Account.controller','get','isAuthenticated','/:id','getConfigurations','/:id/fields','getFields'];(function(_0x4a869e,_0x350c89){var _0x54ae70=function(_0x29f47c){while(--_0x29f47c){_0x4a869e['push'](_0x4a869e['shift']());}};_0x54ae70(++_0x350c89);}(_0x468e,0x126));var _0xe468=function(_0x50123f,_0x3c7d8d){_0x50123f=_0x50123f-0x0;var _0x2e6166=_0x468e[_0x50123f];return _0x2e6166;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe468('0x0'));var timeout=require(_0xe468('0x1'));var express=require(_0xe468('0x2'));var router=express[_0xe468('0x3')]();var fs_extra=require(_0xe468('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xe468('0x5'));router[_0xe468('0x6')]('/',auth[_0xe468('0x7')](),controller['index']);router[_0xe468('0x6')](_0xe468('0x8'),auth[_0xe468('0x7')](),controller['show']);router[_0xe468('0x6')]('/:id/configurations',auth['isAuthenticated'](),controller[_0xe468('0x9')]);router[_0xe468('0x6')](_0xe468('0xa'),auth[_0xe468('0x7')](),controller[_0xe468('0xb')]);router[_0xe468('0xc')]('/',auth[_0xe468('0x7')](),controller['create']);router['post'](_0xe468('0xd'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0xe468('0xe')](_0xe468('0x8'),auth[_0xe468('0x7')](),controller[_0xe468('0xf')]);router[_0xe468('0x10')](_0xe468('0x8'),auth[_0xe468('0x7')](),controller['destroy']);module[_0xe468('0x11')]=router; \ No newline at end of file +var _0x1536=['util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','getFields','post','addConfiguration','put','update','delete','destroy','exports'];(function(_0x198339,_0x417659){var _0x3b92ab=function(_0x36fe70){while(--_0x36fe70){_0x198339['push'](_0x198339['shift']());}};_0x3b92ab(++_0x417659);}(_0x1536,0x1e4));var _0x6153=function(_0x4a4581,_0x318dfc){_0x4a4581=_0x4a4581-0x0;var _0xe7febb=_0x1536[_0x4a4581];return _0xe7febb;};'use strict';var multer=require('multer');var util=require(_0x6153('0x0'));var path=require(_0x6153('0x1'));var timeout=require(_0x6153('0x2'));var express=require('express');var router=express[_0x6153('0x3')]();var fs_extra=require(_0x6153('0x4'));var auth=require(_0x6153('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6153('0x6'));var controller=require(_0x6153('0x7'));router[_0x6153('0x8')]('/',auth[_0x6153('0x9')](),controller['index']);router[_0x6153('0x8')](_0x6153('0xa'),auth[_0x6153('0x9')](),controller[_0x6153('0xb')]);router[_0x6153('0x8')](_0x6153('0xc'),auth['isAuthenticated'](),controller[_0x6153('0xd')]);router['get']('/:id/fields',auth[_0x6153('0x9')](),controller[_0x6153('0xe')]);router['post']('/',auth[_0x6153('0x9')](),controller['create']);router[_0x6153('0xf')](_0x6153('0xc'),auth[_0x6153('0x9')](),controller[_0x6153('0x10')]);router[_0x6153('0x11')](_0x6153('0xa'),auth['isAuthenticated'](),controller[_0x6153('0x12')]);router[_0x6153('0x13')](_0x6153('0xa'),auth[_0x6153('0x9')](),controller[_0x6153('0x14')]);module[_0x6153('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 5813cbc..99714ab 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 _0x9d3b=['STRING','sequelize','exports'];(function(_0x2c4de8,_0x3d664d){var _0x15f310=function(_0x147206){while(--_0x147206){_0x2c4de8['push'](_0x2c4de8['shift']());}};_0x15f310(++_0x3d664d);}(_0x9d3b,0x15d));var _0xb9d3=function(_0x166742,_0x55520c){_0x166742=_0x166742-0x0;var _0xb7814a=_0x9d3b[_0x166742];return _0xb7814a;};'use strict';var Sequelize=require(_0xb9d3('0x0'));module[_0xb9d3('0x1')]={'name':{'type':Sequelize[_0xb9d3('0x2')]},'username':{'type':Sequelize[_0xb9d3('0x2')]},'password':{'type':Sequelize[_0xb9d3('0x2')]},'remoteUri':{'type':Sequelize[_0xb9d3('0x2')]},'tenantId':{'type':Sequelize[_0xb9d3('0x2')]},'clientId':{'type':Sequelize[_0xb9d3('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xb9d3('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xb9d3('0x2')]}}; \ No newline at end of file +var _0xba17=['STRING','sequelize'];(function(_0x93e7d9,_0x4dcc43){var _0x16716b=function(_0x4e80db){while(--_0x4e80db){_0x93e7d9['push'](_0x93e7d9['shift']());}};_0x16716b(++_0x4dcc43);}(_0xba17,0x1a9));var _0x7ba1=function(_0x2bcb85,_0x25ad2f){_0x2bcb85=_0x2bcb85-0x0;var _0x1b8e2e=_0xba17[_0x2bcb85];return _0x1b8e2e;};'use strict';var Sequelize=require(_0x7ba1('0x0'));module['exports']={'name':{'type':Sequelize[_0x7ba1('0x1')]},'username':{'type':Sequelize[_0x7ba1('0x1')]},'password':{'type':Sequelize[_0x7ba1('0x1')]},'remoteUri':{'type':Sequelize[_0x7ba1('0x1')]},'tenantId':{'type':Sequelize[_0x7ba1('0x1')]},'clientId':{'type':Sequelize[_0x7ba1('0x1')]},'clientSecret':{'type':Sequelize[_0x7ba1('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x7ba1('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 37c5f53..98bea59 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 _0xf822=['true','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','DisplayName','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','undefined','count','offset','limit','set','Content-Range','json','apply','reject','save','update','end','error','name','send','index','map','Dynamics365Account','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','sort','where','pick','filter','options','then','rows','catch','show','params','length','includeAll','merge','find','create','body','destroy','getConfigurations','findOne','Dynamics365Configuration','order','hasOwnProperty','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Field','getFields','ticketType','incident','Incident','PhoneCall','title','description','customerid','ownerid','phonenumber','regardingobjectid','directioncode','accountidname','accountidyominame','actualserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyname','createdonbehalfbyname','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','numberofchildincidents','onholdtime','overriddencreatedon','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','ticketnumber','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','password','remoteUri','tenantId','clientId','slice','lastIndexOf','format','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','includes','LogicalName','@odata.type','push','MetadataId','isNil','substring','BooleanAttributeMetadata','all','forEach','DoubleAttributeMetadata','BigIntAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','stack','test','Wrong\x20credentials','EntityDefinitions(',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','Options','Label','Value',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','OptionSet','UserLocalizedLabel'];(function(_0x378aa7,_0x3968cd){var _0x35ba1d=function(_0x41d6d0){while(--_0x41d6d0){_0x378aa7['push'](_0x378aa7['shift']());}};_0x35ba1d(++_0x3968cd);}(_0xf822,0x19e));var _0x2f82=function(_0x2f5b40,_0x2a7e15){_0x2f5b40=_0x2f5b40-0x0;var _0x58f943=_0xf822[_0x2f5b40];return _0x58f943;};'use strict';var emlformat=require(_0x2f82('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2f82('0x1'));var jsonpatch=require(_0x2f82('0x2'));var rp=require(_0x2f82('0x3'));var moment=require(_0x2f82('0x4'));var BPromise=require(_0x2f82('0x5'));var Mustache=require(_0x2f82('0x6'));var util=require('util');var path=require(_0x2f82('0x7'));var sox=require(_0x2f82('0x8'));var csv=require(_0x2f82('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2f82('0xa'));var _=require('lodash');var squel=require(_0x2f82('0xb'));var crypto=require(_0x2f82('0xc'));var jsforce=require(_0x2f82('0xd'));var deskjs=require(_0x2f82('0xe'));var toCsv=require(_0x2f82('0x9'));var querystring=require(_0x2f82('0xf'));var Papa=require('papaparse');var Redis=require(_0x2f82('0x10'));var authService=require(_0x2f82('0x11'));var qs=require(_0x2f82('0x12'));var as=require(_0x2f82('0x13'));var hardwareService=require(_0x2f82('0x14'));var logger=require(_0x2f82('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x2f82('0x16'));var licenseUtil=require(_0x2f82('0x17'));var db=require(_0x2f82('0x18'))['db'];var integrations=require(_0x2f82('0x19'));function respondWithStatusCode(_0x5e7036,_0x5f51f4){_0x5f51f4=_0x5f51f4||0xcc;return function(_0x153655){if(_0x153655){return _0x5e7036[_0x2f82('0x1a')](_0x5f51f4);}return _0x5e7036[_0x2f82('0x1b')](_0x5f51f4)['end']();};}function respondWithResult(_0x434262,_0x2df1bf){_0x2df1bf=_0x2df1bf||0xc8;return function(_0x5bdc8d){if(_0x5bdc8d){return _0x434262['status'](_0x2df1bf)['json'](_0x5bdc8d);}};}function respondWithFilteredResult(_0x6d2748,_0x14f4b7){return function(_0xe1a92f){if(_0xe1a92f){var _0x3e41ea=typeof _0x14f4b7['offset']===_0x2f82('0x1c')&&typeof _0x14f4b7['limit']===_0x2f82('0x1c');var _0x5ec789=_0xe1a92f[_0x2f82('0x1d')];var _0xccbee0=_0x3e41ea?0x0:_0x14f4b7[_0x2f82('0x1e')];var _0x371720=_0x3e41ea?_0xe1a92f[_0x2f82('0x1d')]:_0x14f4b7[_0x2f82('0x1e')]+_0x14f4b7[_0x2f82('0x1f')];var _0x26f9dc;if(_0x371720>=_0x5ec789){_0x371720=_0x5ec789;_0x26f9dc=0xc8;}else{_0x26f9dc=0xce;}_0x6d2748['status'](_0x26f9dc);return _0x6d2748[_0x2f82('0x20')](_0x2f82('0x21'),_0xccbee0+'-'+_0x371720+'/'+_0x5ec789)[_0x2f82('0x22')](_0xe1a92f);}return null;};}function patchUpdates(_0x56357a){return function(_0xbac84c){try{jsonpatch[_0x2f82('0x23')](_0xbac84c,_0x56357a,!![]);}catch(_0x17cd6b){return BPromise[_0x2f82('0x24')](_0x17cd6b);}return _0xbac84c[_0x2f82('0x25')]();};}function saveUpdates(_0x508a52,_0x3e9b75){return function(_0x339335){if(_0x339335){return _0x339335[_0x2f82('0x26')](_0x508a52)['then'](function(_0x530e1b){return _0x530e1b;});}return null;};}function removeEntity(_0x510bd0,_0x3f2abc){return function(_0x1bf504){if(_0x1bf504){return _0x1bf504['destroy']()['then'](function(){_0x510bd0[_0x2f82('0x1b')](0xcc)[_0x2f82('0x27')]();});}};}function handleEntityNotFound(_0x1525ac,_0x46222f){return function(_0x2efdf7){if(!_0x2efdf7){_0x1525ac['sendStatus'](0x194);}return _0x2efdf7;};}function handleError(_0x5e1df8,_0x30efa5){_0x30efa5=_0x30efa5||0x1f4;return function(_0x5280fe){logger[_0x2f82('0x28')](_0x5280fe['stack']);if(_0x5280fe[_0x2f82('0x29')]){delete _0x5280fe[_0x2f82('0x29')];}_0x5e1df8[_0x2f82('0x1b')](_0x30efa5)[_0x2f82('0x2a')](_0x5280fe);};}exports[_0x2f82('0x2b')]=function(_0x5f121f,_0x1f9a03){var _0x3f2e84={},_0x41c9dd={},_0x16886b={'count':0x0,'rows':[]};var _0x101bf4=_[_0x2f82('0x2c')](db[_0x2f82('0x2d')][_0x2f82('0x2e')],function(_0xead18){return{'name':_0xead18['fieldName'],'type':_0xead18[_0x2f82('0x2f')][_0x2f82('0x30')]};});_0x41c9dd[_0x2f82('0x31')]=_[_0x2f82('0x2c')](_0x101bf4,_0x2f82('0x29'));_0x41c9dd[_0x2f82('0x32')]=_[_0x2f82('0x33')](_0x5f121f['query']);_0x41c9dd[_0x2f82('0x34')]=_[_0x2f82('0x35')](_0x41c9dd[_0x2f82('0x31')],_0x41c9dd[_0x2f82('0x32')]);_0x3f2e84[_0x2f82('0x36')]=_[_0x2f82('0x35')](_0x41c9dd['model'],qs[_0x2f82('0x37')](_0x5f121f[_0x2f82('0x32')]['fields']));_0x3f2e84['attributes']=_0x3f2e84[_0x2f82('0x36')]['length']?_0x3f2e84[_0x2f82('0x36')]:_0x41c9dd[_0x2f82('0x31')];if(!_0x5f121f[_0x2f82('0x32')]['hasOwnProperty'](_0x2f82('0x38'))){_0x3f2e84[_0x2f82('0x1f')]=qs[_0x2f82('0x1f')](_0x5f121f['query'][_0x2f82('0x1f')]);_0x3f2e84[_0x2f82('0x1e')]=qs['offset'](_0x5f121f['query'][_0x2f82('0x1e')]);}_0x3f2e84['order']=qs[_0x2f82('0x39')](_0x5f121f['query']['sort']);_0x3f2e84[_0x2f82('0x3a')]=qs[_0x2f82('0x34')](_[_0x2f82('0x3b')](_0x5f121f[_0x2f82('0x32')],_0x41c9dd[_0x2f82('0x34')]),_0x101bf4);if(_0x5f121f[_0x2f82('0x32')][_0x2f82('0x3c')]){_0x3f2e84['where']=_['merge'](_0x3f2e84[_0x2f82('0x3a')],{'$or':_[_0x2f82('0x2c')](_0x101bf4,function(_0x33dc9f){if(_0x33dc9f[_0x2f82('0x2f')]!=='VIRTUAL'){var _0x1a7337={};_0x1a7337[_0x33dc9f[_0x2f82('0x29')]]={'$like':'%'+_0x5f121f[_0x2f82('0x32')][_0x2f82('0x3c')]+'%'};return _0x1a7337;}})});}_0x3f2e84=_['merge']({},_0x3f2e84,_0x5f121f[_0x2f82('0x3d')]);var _0x3f6239={'where':_0x3f2e84[_0x2f82('0x3a')]};return db['Dynamics365Account'][_0x2f82('0x1d')](_0x3f6239)[_0x2f82('0x3e')](function(_0x4142af){_0x16886b[_0x2f82('0x1d')]=_0x4142af;if(_0x5f121f[_0x2f82('0x32')]['includeAll']){_0x3f2e84['include']=[{'all':!![]}];}return db['Dynamics365Account']['findAll'](_0x3f2e84);})['then'](function(_0x1ae81b){_0x16886b[_0x2f82('0x3f')]=_0x1ae81b;return _0x16886b;})[_0x2f82('0x3e')](respondWithFilteredResult(_0x1f9a03,_0x3f2e84))[_0x2f82('0x40')](handleError(_0x1f9a03,null));};exports[_0x2f82('0x41')]=function(_0x589d44,_0x3577cc){var _0x32b927={'raw':![],'where':{'id':_0x589d44[_0x2f82('0x42')]['id']}},_0x34f377={};_0x34f377[_0x2f82('0x31')]=_[_0x2f82('0x33')](db[_0x2f82('0x2d')][_0x2f82('0x2e')]);_0x34f377[_0x2f82('0x32')]=_[_0x2f82('0x33')](_0x589d44[_0x2f82('0x32')]);_0x34f377[_0x2f82('0x34')]=_[_0x2f82('0x35')](_0x34f377[_0x2f82('0x31')],_0x34f377[_0x2f82('0x32')]);_0x32b927['attributes']=_[_0x2f82('0x35')](_0x34f377[_0x2f82('0x31')],qs['fields'](_0x589d44[_0x2f82('0x32')][_0x2f82('0x37')]));_0x32b927['attributes']=_0x32b927[_0x2f82('0x36')][_0x2f82('0x43')]?_0x32b927[_0x2f82('0x36')]:_0x34f377[_0x2f82('0x31')];if(_0x589d44[_0x2f82('0x32')][_0x2f82('0x44')]){_0x32b927['include']=[{'all':!![]}];}_0x32b927=_[_0x2f82('0x45')]({},_0x32b927,_0x589d44[_0x2f82('0x3d')]);return db[_0x2f82('0x2d')][_0x2f82('0x46')](_0x32b927)[_0x2f82('0x3e')](handleEntityNotFound(_0x3577cc,null))[_0x2f82('0x3e')](respondWithResult(_0x3577cc,null))['catch'](handleError(_0x3577cc,null));};exports[_0x2f82('0x47')]=function(_0x133aef,_0x571094){return db[_0x2f82('0x2d')][_0x2f82('0x47')](_0x133aef[_0x2f82('0x48')],{})[_0x2f82('0x3e')](respondWithResult(_0x571094,0xc9))[_0x2f82('0x40')](handleError(_0x571094,null));};exports['update']=function(_0x42a55b,_0x3a7ccd){if(_0x42a55b[_0x2f82('0x48')]['id']){delete _0x42a55b[_0x2f82('0x48')]['id'];}return db[_0x2f82('0x2d')][_0x2f82('0x46')]({'where':{'id':_0x42a55b[_0x2f82('0x42')]['id']}})['then'](handleEntityNotFound(_0x3a7ccd,null))[_0x2f82('0x3e')](saveUpdates(_0x42a55b['body'],null))[_0x2f82('0x3e')](respondWithResult(_0x3a7ccd,null))[_0x2f82('0x40')](handleError(_0x3a7ccd,null));};exports[_0x2f82('0x49')]=function(_0x5b5ef5,_0x310623){return db['Dynamics365Account'][_0x2f82('0x46')]({'where':{'id':_0x5b5ef5['params']['id']}})[_0x2f82('0x3e')](handleEntityNotFound(_0x310623,null))[_0x2f82('0x3e')](removeEntity(_0x310623,null))[_0x2f82('0x40')](handleError(_0x310623,null));};exports[_0x2f82('0x4a')]=function(_0x2e6e44,_0x51902d,_0x5ba529){var _0x105800={};var _0x5341c7={};var _0x29dda6;var _0x5036d1;return db[_0x2f82('0x2d')][_0x2f82('0x4b')]({'where':{'id':_0x2e6e44['params']['id']}})[_0x2f82('0x3e')](handleEntityNotFound(_0x51902d,null))[_0x2f82('0x3e')](function(_0x165b5f){if(_0x165b5f){_0x29dda6=_0x165b5f;_0x5341c7[_0x2f82('0x31')]=_['keys'](db[_0x2f82('0x4c')][_0x2f82('0x2e')]);_0x5341c7[_0x2f82('0x32')]=_[_0x2f82('0x33')](_0x2e6e44['query']);_0x5341c7[_0x2f82('0x34')]=_['intersection'](_0x5341c7['model'],_0x5341c7[_0x2f82('0x32')]);_0x105800[_0x2f82('0x36')]=_['intersection'](_0x5341c7[_0x2f82('0x31')],qs['fields'](_0x2e6e44[_0x2f82('0x32')][_0x2f82('0x37')]));_0x105800[_0x2f82('0x36')]=_0x105800['attributes'][_0x2f82('0x43')]?_0x105800[_0x2f82('0x36')]:_0x5341c7[_0x2f82('0x31')];_0x105800[_0x2f82('0x4d')]=qs[_0x2f82('0x39')](_0x2e6e44['query'][_0x2f82('0x39')]);_0x105800[_0x2f82('0x3a')]=qs[_0x2f82('0x34')](_['pick'](_0x2e6e44[_0x2f82('0x32')],_0x5341c7[_0x2f82('0x34')]));if(_0x2e6e44[_0x2f82('0x32')][_0x2f82('0x3c')]){_0x105800[_0x2f82('0x3a')]=_[_0x2f82('0x45')](_0x105800[_0x2f82('0x3a')],{'$or':_[_0x2f82('0x2c')](_0x105800[_0x2f82('0x36')],function(_0x1680b3){var _0x28b946={};_0x28b946[_0x1680b3]={'$like':'%'+_0x2e6e44[_0x2f82('0x32')]['filter']+'%'};return _0x28b946;})});}_0x105800=_[_0x2f82('0x45')]({},_0x105800,_0x2e6e44[_0x2f82('0x3d')]);return _0x29dda6['getConfigurations'](_0x105800);}})[_0x2f82('0x3e')](function(_0x5c0220){if(_0x5c0220){_0x5036d1=_0x5c0220[_0x2f82('0x43')];if(!_0x2e6e44[_0x2f82('0x32')][_0x2f82('0x4e')]('nolimit')){_0x105800[_0x2f82('0x1f')]=qs[_0x2f82('0x1f')](_0x2e6e44[_0x2f82('0x32')][_0x2f82('0x1f')]);_0x105800['offset']=qs[_0x2f82('0x1e')](_0x2e6e44[_0x2f82('0x32')][_0x2f82('0x1e')]);}return _0x29dda6[_0x2f82('0x4a')](_0x105800);}})[_0x2f82('0x3e')](function(_0x1e1726){if(_0x1e1726){return _0x1e1726?{'count':_0x5036d1,'rows':_0x1e1726}:null;}})[_0x2f82('0x3e')](respondWithResult(_0x51902d,null))[_0x2f82('0x40')](handleError(_0x51902d,null));};exports[_0x2f82('0x4f')]=function(_0x309b75,_0x423cd0,_0x285205){if(_0x309b75['body']['id']){delete _0x309b75['body']['id'];}return db[_0x2f82('0x2d')][_0x2f82('0x4b')]({'where':{'id':_0x309b75['params']['id']}})[_0x2f82('0x3e')](handleEntityNotFound(_0x423cd0,null))[_0x2f82('0x3e')](function(_0x588219){if(_0x588219){_0x309b75[_0x2f82('0x48')]['AccountId']=_0x588219['id'];_0x309b75['body'][_0x2f82('0x50')]=integrations[_0x2f82('0x51')](_0x309b75[_0x2f82('0x48')][_0x2f82('0x52')],_0x309b75[_0x2f82('0x48')][_0x2f82('0x2f')]);_0x309b75['body'][_0x2f82('0x53')]=integrations[_0x2f82('0x54')](_0x309b75[_0x2f82('0x48')][_0x2f82('0x52')],_0x309b75['body'][_0x2f82('0x2f')]);return db[_0x2f82('0x4c')][_0x2f82('0x47')](_0x309b75[_0x2f82('0x48')],{'include':[{'model':db[_0x2f82('0x55')],'as':'Subjects'},{'model':db[_0x2f82('0x55')],'as':'Descriptions'}]});}return null;})[_0x2f82('0x3e')](respondWithResult(_0x423cd0,null))[_0x2f82('0x40')](handleError(_0x423cd0,null));};exports[_0x2f82('0x56')]=function(_0x1fe33b,_0x1f6649,_0xe913de){var _0x280bf9=_0x1fe33b[_0x2f82('0x32')][_0x2f82('0x57')];var _0xba9687=_0x280bf9===_0x2f82('0x58')?_0x2f82('0x59'):_0x2f82('0x5a');var _0x1258e7='';var _0x2f8a43='';var _0x1bfaac='';var _0x5424e1='';var _0x330657='';var _0x509deb='';var _0x1582cb='';var _0x3e121e='';var _0x983d47=[_0x2f82('0x5b'),_0x2f82('0x5c'),_0x2f82('0x5d'),_0x2f82('0x5e'),'caseorigincode','subject',_0x2f82('0x5f'),_0x2f82('0x60'),_0x2f82('0x61'),'phonecall_activity_parties'];var _0x443e43=[_0x2f82('0x62'),_0x2f82('0x63'),_0x2f82('0x64'),'billedserviceunits',_0x2f82('0x65'),_0x2f82('0x66'),_0x2f82('0x67'),_0x2f82('0x68'),_0x2f82('0x69'),'createdbyexternalpartyyominame',_0x2f82('0x6a'),'createdbyyominame','createdon',_0x2f82('0x6b'),'createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame',_0x2f82('0x6c'),_0x2f82('0x6d'),_0x2f82('0x6e'),_0x2f82('0x6f'),_0x2f82('0x70'),'exchangerate',_0x2f82('0x71'),_0x2f82('0x72'),_0x2f82('0x73'),_0x2f82('0x74'),_0x2f82('0x75'),'lastonholdtime',_0x2f82('0x76'),_0x2f82('0x77'),_0x2f82('0x78'),_0x2f82('0x79'),_0x2f82('0x7a'),_0x2f82('0x7b'),_0x2f82('0x7c'),'modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname',_0x2f82('0x7d'),_0x2f82('0x7e'),_0x2f82('0x7f'),'owneridname','owneridtype',_0x2f82('0x80'),_0x2f82('0x81'),_0x2f82('0x82'),_0x2f82('0x83'),_0x2f82('0x84'),_0x2f82('0x85'),_0x2f82('0x86'),_0x2f82('0x87'),_0x2f82('0x88'),'responseby','responsiblecontactidname',_0x2f82('0x89'),_0x2f82('0x8a'),_0x2f82('0x8b'),_0x2f82('0x8c'),_0x2f82('0x8d'),_0x2f82('0x8e'),_0x2f82('0x8f'),'subjectidname',_0x2f82('0x90'),'timezoneruleversionnumber','transactioncurrencyidname',_0x2f82('0x91'),_0x2f82('0x92'),_0x2f82('0x93')];var _0x5073eb=_0x983d47[_0x2f82('0x94')](_0x443e43);return db[_0x2f82('0x2d')][_0x2f82('0x4b')]({'where':{'id':_0x1fe33b[_0x2f82('0x42')]['id']},'attributes':['id',_0x2f82('0x95'),_0x2f82('0x96'),_0x2f82('0x97'),_0x2f82('0x98'),_0x2f82('0x99'),'clientSecret']})[_0x2f82('0x3e')](handleEntityNotFound(_0x1f6649,null))[_0x2f82('0x3e')](function(_0x558cf9){if(_0x558cf9){_0x3e121e=_0x558cf9[_0x2f82('0x97')];var _0x54bf03=_0x3e121e[_0x2f82('0x9a')](-0x1);if(_0x54bf03==='/'){_0x3e121e=_0x3e121e['substring'](0x0,_0x3e121e[_0x2f82('0x9b')](_0x54bf03));}_0x1582cb=util[_0x2f82('0x9c')](_0x2f82('0x9d'),_0x3e121e);var _0x4f21ac={'method':_0x2f82('0x9e'),'uri':_0x2f82('0x9f')+_0x558cf9[_0x2f82('0x98')]+'/oauth2/token','form':{'client_id':_0x558cf9[_0x2f82('0x99')],'resource':_0x3e121e,'username':_0x558cf9[_0x2f82('0x95')],'password':_0x558cf9['password'],'grant_type':'password','client_secret':_0x558cf9['clientSecret']},'json':!![]};return rp(_0x4f21ac);}})[_0x2f82('0x3e')](function(_0xb4e8f8){_0x509deb=_0xb4e8f8[_0x2f82('0xa0')];var _0x3f858b={'method':_0x2f82('0xa1'),'uri':encodeURI(_0x1582cb+_0x2f82('0xa2')+_0xba9687+'\x27'),'headers':{'Authorization':_0x2f82('0xa3')+_0x509deb,'If-None-Match':null,'OData-Version':_0x2f82('0xa4')},'json':!![]};return rp(_0x3f858b);})[_0x2f82('0x3e')](function(_0x1b6aa7){var _0x4093e4=_0x1b6aa7['value'][0x0];var _0x465d87=_0x4093e4['MetadataId'];var _0x454a0f={'method':_0x2f82('0xa1'),'uri':_0x1582cb+'EntityDefinitions('+_0x465d87+_0x2f82('0xa5'),'headers':{'Authorization':_0x2f82('0xa3')+_0x509deb,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x454a0f);})[_0x2f82('0x3e')](function(_0x4d01f4){_0x1258e7=_0x4d01f4;_0x2f8a43=_0x1258e7[_0x2f82('0xa6')];_0x2f8a43=_['remove'](_0x2f8a43,function(_0x8eac3){return!_0x5073eb[_0x2f82('0xa7')](_0x8eac3[_0x2f82('0xa8')]);});var _0x40865d=[];var _0x27d4f9=[];_0x2f8a43['forEach'](function(_0x4a4f81){if(_0x4a4f81[_0x2f82('0xa9')]){var _0x3d5493=_0x4a4f81['@odata.type']['substring'](_0x4a4f81[_0x2f82('0xa9')][_0x2f82('0x9b')]('.')+0x1);if(_0x3d5493==='PicklistAttributeMetadata'){_0x40865d[_0x2f82('0xaa')](getSelectList(_0x1582cb,_0x280bf9,_0x27d4f9,_0x1258e7[_0x2f82('0xab')],_0x4a4f81[_0x2f82('0xab')],_0x509deb));}}});return Promise['all'](_0x40865d);})[_0x2f82('0x3e')](function(_0x4971c2){_0x1bfaac=_0x4971c2[0x0];var _0x7defc0=[];var _0x1c29e0=[];_0x2f8a43['forEach'](function(_0x350c62){if(!_[_0x2f82('0xac')](_0x350c62[_0x2f82('0xa9')])){var _0x4ff916=_0x350c62[_0x2f82('0xa9')][_0x2f82('0xad')](_0x350c62[_0x2f82('0xa9')][_0x2f82('0x9b')]('.')+0x1);if(_0x4ff916===_0x2f82('0xae')){_0x7defc0[_0x2f82('0xaa')](getBooleanList(_0x1582cb,_0x280bf9,_0x1c29e0,_0x1258e7['MetadataId'],_0x350c62[_0x2f82('0xab')],_0x509deb));}}});return Promise[_0x2f82('0xaf')](_0x7defc0);})[_0x2f82('0x3e')](function(_0x50be33){_0x5424e1=_0x50be33[0x0];var _0x2dff8f=[];var _0x24e632=[];_0x2f8a43[_0x2f82('0xb0')](function(_0x1174db){if(_0x1174db[_0x2f82('0xa9')]){var _0x13c8b2=_0x1174db[_0x2f82('0xa9')][_0x2f82('0xad')](_0x1174db['@odata.type']['lastIndexOf']('.')+0x1);if(_0x13c8b2==='StringAttributeMetadata'||_0x13c8b2===_0x2f82('0xb1')||_0x13c8b2===_0x2f82('0xb2')||_0x13c8b2==='IntegerAttributeMetadata'||_0x13c8b2===_0x2f82('0xb3')||_0x13c8b2===_0x2f82('0xb4')||_0x13c8b2===_0x2f82('0xb5')||_0x13c8b2===_0x2f82('0xb6')||_0x13c8b2===_0x2f82('0xb7')||_0x13c8b2===_0x2f82('0xb8')){_0x2dff8f['push'](getInputList(_0x1582cb,_0x280bf9,_0x13c8b2,_0x24e632,_0x1258e7[_0x2f82('0xab')],_0x1174db[_0x2f82('0xab')],_0x509deb));}}});return Promise[_0x2f82('0xaf')](_0x2dff8f);})['then'](function(_0x46f602){_0x330657=_0x46f602[0x0];var _0x2bf0fa=_0x1bfaac[_0x2f82('0x94')](_0x5424e1)[_0x2f82('0x94')](_0x330657);var _0x2dcf03={'count':_0x2bf0fa[_0x2f82('0x43')],'rows':_0x2bf0fa};return _0x2dcf03;})[_0x2f82('0x3e')](respondWithResult(_0x1f6649,null))[_0x2f82('0x40')](function(_0xe26040){var _0x50fc7b=_0x1fe33b[_0x2f82('0x32')]['test']?0x1f4:_0xe26040['statusCode']||0x1f4;logger[_0x2f82('0x28')](_0xe26040[_0x2f82('0xb9')]);delete _0xe26040[_0x2f82('0x29')];if(_0x50fc7b===0x191){_0x50fc7b=0x190;}_0x1f6649[_0x2f82('0x1b')](_0x50fc7b)[_0x2f82('0x2a')](_0x1fe33b[_0x2f82('0x32')][_0x2f82('0xba')]?{'message':_0x2f82('0xbb'),'statusCode':_0xe26040['statusCode']}:_0xe26040);});};function getSelectList(_0x39db15,_0x8c7676,_0x9a296d,_0x13fbca,_0x19b20d,_0x66b919){var _0x5212a9={'method':_0x2f82('0xa1'),'uri':_0x39db15+_0x2f82('0xbc')+_0x13fbca+_0x2f82('0xbd')+_0x19b20d+_0x2f82('0xbe')+_0x2f82('0xbf'),'headers':{'Authorization':_0x2f82('0xa3')+_0x66b919,'If-None-Match':null,'OData-Version':_0x2f82('0xa4')},'json':!![]};return rp(_0x5212a9)[_0x2f82('0x3e')](function(_0x5c75b4){var _0xceb90=[];var _0x350be5=_0x5c75b4['OptionSet'][_0x2f82('0xc0')];_0x350be5[_0x2f82('0xb0')](function(_0x45757f){_0xceb90[_0x2f82('0xaa')]({'name':_0x45757f[_0x2f82('0xc1')]['UserLocalizedLabel'][_0x2f82('0xc1')],'value':String(_0x45757f[_0x2f82('0xc2')])});});var _0x28a265={'id':_0x8c7676+'_'+_0x5c75b4['LogicalName'],'name':_0x5c75b4['DisplayName']['UserLocalizedLabel'][_0x2f82('0xc1')],'custom':![],'options':_0xceb90};_0x9a296d[_0x2f82('0xaa')](_0x28a265);return _0x9a296d;});}function getBooleanList(_0x10f8b4,_0x517458,_0x1e1ddd,_0x12263a,_0x2aa965,_0xd609bf){var _0x2e671b={'method':_0x2f82('0xa1'),'uri':_0x10f8b4+_0x2f82('0xbc')+_0x12263a+_0x2f82('0xbd')+_0x2aa965+_0x2f82('0xc3'),'headers':{'Authorization':'Bearer\x20'+_0xd609bf,'If-None-Match':null,'OData-Version':_0x2f82('0xa4')},'json':!![]};return rp(_0x2e671b)[_0x2f82('0x3e')](function(_0x3a7786){var _0x1bda99=[];_0x1bda99['push']({'name':_0x3a7786[_0x2f82('0xc4')]['TrueOption'][_0x2f82('0xc1')][_0x2f82('0xc5')][_0x2f82('0xc1')],'value':_0x2f82('0xc6')},{'name':_0x3a7786[_0x2f82('0xc4')][_0x2f82('0xc7')][_0x2f82('0xc1')][_0x2f82('0xc5')][_0x2f82('0xc1')],'value':_0x2f82('0xc8')});var _0x1b4613={'id':_0x517458+'_'+_0x3a7786[_0x2f82('0xa8')],'name':_0x3a7786['DisplayName'][_0x2f82('0xc5')]['Label'],'custom':![],'options':_0x1bda99};_0x1e1ddd[_0x2f82('0xaa')](_0x1b4613);return _0x1e1ddd;});}function getInputList(_0xfd72b6,_0x147a52,_0x18d028,_0x7dfc17,_0x4a5ebe,_0x38f73b,_0x2184d3){var _0x5867a0={'method':_0x2f82('0xa1'),'uri':_0xfd72b6+_0x2f82('0xbc')+_0x4a5ebe+_0x2f82('0xbd')+_0x38f73b+_0x2f82('0xc9')+_0x18d028+_0x2f82('0xca'),'headers':{'Authorization':'Bearer\x20'+_0x2184d3,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x5867a0)['then'](function(_0x44da23){var _0x565cc={'id':_0x147a52+'_'+_0x44da23[_0x2f82('0xa8')],'name':_0x44da23[_0x2f82('0xcb')][_0x2f82('0xc5')]?_0x44da23[_0x2f82('0xcb')][_0x2f82('0xc5')][_0x2f82('0xc1')]:_0x44da23['LogicalName'],'custom':![],'options':[]};_0x7dfc17[_0x2f82('0xaa')](_0x565cc);return _0x7dfc17;});} \ No newline at end of file +var _0xc39c=['OptionSet','Label','UserLocalizedLabel','LogicalName','DisplayName',')/Attributes(',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','then','error','stack','name','send','index','rawAttributes','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','Dynamics365Account','includeAll','include','rows','catch','show','params','create','body','update','find','getConfigurations','findOne','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Configuration','Dynamics365Field','getFields','incident','Incident','PhoneCall','description','customerid','ownerid','caseorigincode','subject','phonenumber','directioncode','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridtype','customeridyominame','emailaddress','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','importsequencenumber','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedonbehalfbyyominame','msdyn_iotalertname','onholdtime','overriddencreatedon','owneridname','owneridyominame','parentcaseidname','primarycontactidname','productserialnumber','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slaname','socialprofileidname','statuscode','subjectidname','ticketnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','password','clientId','remoteUri','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','tenantId','/oauth2/token','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','4.0','remove','includes','@odata.type','PicklistAttributeMetadata','push','all','BooleanAttributeMetadata','forEach','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','MemoAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','statusCode','test','Wrong\x20credentials',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)'];(function(_0x4a3243,_0x282592){var _0x383318=function(_0x1bacac){while(--_0x1bacac){_0x4a3243['push'](_0x4a3243['shift']());}};_0x383318(++_0x282592);}(_0xc39c,0xd2));var _0xcc39=function(_0x54ee22,_0x953d26){_0x54ee22=_0x54ee22-0x0;var _0x3117ef=_0xc39c[_0x54ee22];return _0x3117ef;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcc39('0x0'));var zipdir=require(_0xcc39('0x1'));var jsonpatch=require(_0xcc39('0x2'));var rp=require('request-promise');var moment=require(_0xcc39('0x3'));var BPromise=require(_0xcc39('0x4'));var Mustache=require(_0xcc39('0x5'));var util=require('util');var path=require(_0xcc39('0x6'));var sox=require(_0xcc39('0x7'));var csv=require(_0xcc39('0x8'));var ejs=require(_0xcc39('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcc39('0xa'));var squel=require(_0xcc39('0xb'));var crypto=require(_0xcc39('0xc'));var jsforce=require(_0xcc39('0xd'));var deskjs=require(_0xcc39('0xe'));var toCsv=require(_0xcc39('0x8'));var querystring=require(_0xcc39('0xf'));var Papa=require(_0xcc39('0x10'));var Redis=require(_0xcc39('0x11'));var authService=require(_0xcc39('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xcc39('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcc39('0x14'))(_0xcc39('0x15'));var utils=require(_0xcc39('0x16'));var config=require(_0xcc39('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0xcc39('0x18'));function respondWithStatusCode(_0x415abc,_0x532f88){_0x532f88=_0x532f88||0xcc;return function(_0x59c1f3){if(_0x59c1f3){return _0x415abc[_0xcc39('0x19')](_0x532f88);}return _0x415abc[_0xcc39('0x1a')](_0x532f88)[_0xcc39('0x1b')]();};}function respondWithResult(_0x1e0d4f,_0x999b61){_0x999b61=_0x999b61||0xc8;return function(_0x5be540){if(_0x5be540){return _0x1e0d4f['status'](_0x999b61)[_0xcc39('0x1c')](_0x5be540);}};}function respondWithFilteredResult(_0x2ae7e5,_0x205a38){return function(_0x425c73){if(_0x425c73){var _0xbfb6ba=typeof _0x205a38[_0xcc39('0x1d')]==='undefined'&&typeof _0x205a38[_0xcc39('0x1e')]===_0xcc39('0x1f');var _0x1d0594=_0x425c73[_0xcc39('0x20')];var _0x4ba92b=_0xbfb6ba?0x0:_0x205a38['offset'];var _0x20cbe1=_0xbfb6ba?_0x425c73['count']:_0x205a38[_0xcc39('0x1d')]+_0x205a38[_0xcc39('0x1e')];var _0x2e5457;if(_0x20cbe1>=_0x1d0594){_0x20cbe1=_0x1d0594;_0x2e5457=0xc8;}else{_0x2e5457=0xce;}_0x2ae7e5['status'](_0x2e5457);return _0x2ae7e5[_0xcc39('0x21')](_0xcc39('0x22'),_0x4ba92b+'-'+_0x20cbe1+'/'+_0x1d0594)[_0xcc39('0x1c')](_0x425c73);}return null;};}function patchUpdates(_0x4c2fe5){return function(_0x409408){try{jsonpatch['apply'](_0x409408,_0x4c2fe5,!![]);}catch(_0x2bab79){return BPromise[_0xcc39('0x23')](_0x2bab79);}return _0x409408['save']();};}function saveUpdates(_0x1ade0d,_0x21c982){return function(_0x2b3f75){if(_0x2b3f75){return _0x2b3f75['update'](_0x1ade0d)[_0xcc39('0x24')](function(_0x249b29){return _0x249b29;});}return null;};}function removeEntity(_0x21243f,_0x1ec9c6){return function(_0x9ce9f3){if(_0x9ce9f3){return _0x9ce9f3['destroy']()[_0xcc39('0x24')](function(){_0x21243f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1bdce6,_0x2b96ec){return function(_0x183ff1){if(!_0x183ff1){_0x1bdce6['sendStatus'](0x194);}return _0x183ff1;};}function handleError(_0x477355,_0x3e1ae6){_0x3e1ae6=_0x3e1ae6||0x1f4;return function(_0x1416d5){logger[_0xcc39('0x25')](_0x1416d5[_0xcc39('0x26')]);if(_0x1416d5[_0xcc39('0x27')]){delete _0x1416d5[_0xcc39('0x27')];}_0x477355[_0xcc39('0x1a')](_0x3e1ae6)[_0xcc39('0x28')](_0x1416d5);};}exports[_0xcc39('0x29')]=function(_0x1dac9a,_0x6a2286){var _0x20b4de={},_0x3b7a73={},_0x5a6b7b={'count':0x0,'rows':[]};var _0xb534bc=_['map'](db['Dynamics365Account'][_0xcc39('0x2a')],function(_0x5d114c){return{'name':_0x5d114c['fieldName'],'type':_0x5d114c['type'][_0xcc39('0x2b')]};});_0x3b7a73[_0xcc39('0x2c')]=_['map'](_0xb534bc,_0xcc39('0x27'));_0x3b7a73['query']=_[_0xcc39('0x2d')](_0x1dac9a[_0xcc39('0x2e')]);_0x3b7a73[_0xcc39('0x2f')]=_[_0xcc39('0x30')](_0x3b7a73[_0xcc39('0x2c')],_0x3b7a73[_0xcc39('0x2e')]);_0x20b4de[_0xcc39('0x31')]=_['intersection'](_0x3b7a73[_0xcc39('0x2c')],qs['fields'](_0x1dac9a[_0xcc39('0x2e')][_0xcc39('0x32')]));_0x20b4de[_0xcc39('0x31')]=_0x20b4de[_0xcc39('0x31')][_0xcc39('0x33')]?_0x20b4de[_0xcc39('0x31')]:_0x3b7a73[_0xcc39('0x2c')];if(!_0x1dac9a[_0xcc39('0x2e')][_0xcc39('0x34')](_0xcc39('0x35'))){_0x20b4de[_0xcc39('0x1e')]=qs[_0xcc39('0x1e')](_0x1dac9a[_0xcc39('0x2e')]['limit']);_0x20b4de[_0xcc39('0x1d')]=qs[_0xcc39('0x1d')](_0x1dac9a['query'][_0xcc39('0x1d')]);}_0x20b4de[_0xcc39('0x36')]=qs[_0xcc39('0x37')](_0x1dac9a[_0xcc39('0x2e')][_0xcc39('0x37')]);_0x20b4de[_0xcc39('0x38')]=qs[_0xcc39('0x2f')](_[_0xcc39('0x39')](_0x1dac9a[_0xcc39('0x2e')],_0x3b7a73[_0xcc39('0x2f')]),_0xb534bc);if(_0x1dac9a[_0xcc39('0x2e')][_0xcc39('0x3a')]){_0x20b4de['where']=_['merge'](_0x20b4de['where'],{'$or':_['map'](_0xb534bc,function(_0x2c0009){if(_0x2c0009[_0xcc39('0x3b')]!==_0xcc39('0x3c')){var _0x946db7={};_0x946db7[_0x2c0009[_0xcc39('0x27')]]={'$like':'%'+_0x1dac9a[_0xcc39('0x2e')][_0xcc39('0x3a')]+'%'};return _0x946db7;}})});}_0x20b4de=_[_0xcc39('0x3d')]({},_0x20b4de,_0x1dac9a[_0xcc39('0x3e')]);var _0x305ae1={'where':_0x20b4de['where']};return db[_0xcc39('0x3f')][_0xcc39('0x20')](_0x305ae1)[_0xcc39('0x24')](function(_0x4d1bea){_0x5a6b7b[_0xcc39('0x20')]=_0x4d1bea;if(_0x1dac9a[_0xcc39('0x2e')][_0xcc39('0x40')]){_0x20b4de[_0xcc39('0x41')]=[{'all':!![]}];}return db[_0xcc39('0x3f')]['findAll'](_0x20b4de);})[_0xcc39('0x24')](function(_0x12b243){_0x5a6b7b[_0xcc39('0x42')]=_0x12b243;return _0x5a6b7b;})[_0xcc39('0x24')](respondWithFilteredResult(_0x6a2286,_0x20b4de))[_0xcc39('0x43')](handleError(_0x6a2286,null));};exports[_0xcc39('0x44')]=function(_0x402fe1,_0xaf1cd4){var _0x27501f={'raw':![],'where':{'id':_0x402fe1[_0xcc39('0x45')]['id']}},_0x44aea3={};_0x44aea3['model']=_[_0xcc39('0x2d')](db['Dynamics365Account']['rawAttributes']);_0x44aea3['query']=_[_0xcc39('0x2d')](_0x402fe1[_0xcc39('0x2e')]);_0x44aea3[_0xcc39('0x2f')]=_[_0xcc39('0x30')](_0x44aea3[_0xcc39('0x2c')],_0x44aea3['query']);_0x27501f[_0xcc39('0x31')]=_[_0xcc39('0x30')](_0x44aea3[_0xcc39('0x2c')],qs['fields'](_0x402fe1[_0xcc39('0x2e')][_0xcc39('0x32')]));_0x27501f['attributes']=_0x27501f[_0xcc39('0x31')][_0xcc39('0x33')]?_0x27501f['attributes']:_0x44aea3[_0xcc39('0x2c')];if(_0x402fe1[_0xcc39('0x2e')][_0xcc39('0x40')]){_0x27501f[_0xcc39('0x41')]=[{'all':!![]}];}_0x27501f=_[_0xcc39('0x3d')]({},_0x27501f,_0x402fe1[_0xcc39('0x3e')]);return db[_0xcc39('0x3f')]['find'](_0x27501f)['then'](handleEntityNotFound(_0xaf1cd4,null))[_0xcc39('0x24')](respondWithResult(_0xaf1cd4,null))[_0xcc39('0x43')](handleError(_0xaf1cd4,null));};exports[_0xcc39('0x46')]=function(_0x166c87,_0x4b090b){return db[_0xcc39('0x3f')][_0xcc39('0x46')](_0x166c87[_0xcc39('0x47')],{})[_0xcc39('0x24')](respondWithResult(_0x4b090b,0xc9))[_0xcc39('0x43')](handleError(_0x4b090b,null));};exports[_0xcc39('0x48')]=function(_0x45814c,_0x274f74){if(_0x45814c['body']['id']){delete _0x45814c['body']['id'];}return db['Dynamics365Account'][_0xcc39('0x49')]({'where':{'id':_0x45814c[_0xcc39('0x45')]['id']}})[_0xcc39('0x24')](handleEntityNotFound(_0x274f74,null))[_0xcc39('0x24')](saveUpdates(_0x45814c[_0xcc39('0x47')],null))['then'](respondWithResult(_0x274f74,null))['catch'](handleError(_0x274f74,null));};exports['destroy']=function(_0x27e3e8,_0x2b32b2){return db[_0xcc39('0x3f')][_0xcc39('0x49')]({'where':{'id':_0x27e3e8[_0xcc39('0x45')]['id']}})[_0xcc39('0x24')](handleEntityNotFound(_0x2b32b2,null))[_0xcc39('0x24')](removeEntity(_0x2b32b2,null))[_0xcc39('0x43')](handleError(_0x2b32b2,null));};exports[_0xcc39('0x4a')]=function(_0x32da81,_0x5c4c64,_0x2017f6){var _0x1219cb={};var _0x190231={};var _0x37e381;var _0x150bad;return db[_0xcc39('0x3f')][_0xcc39('0x4b')]({'where':{'id':_0x32da81['params']['id']}})[_0xcc39('0x24')](handleEntityNotFound(_0x5c4c64,null))[_0xcc39('0x24')](function(_0x5e3d88){if(_0x5e3d88){_0x37e381=_0x5e3d88;_0x190231[_0xcc39('0x2c')]=_[_0xcc39('0x2d')](db['Dynamics365Configuration'][_0xcc39('0x2a')]);_0x190231[_0xcc39('0x2e')]=_[_0xcc39('0x2d')](_0x32da81[_0xcc39('0x2e')]);_0x190231['filters']=_[_0xcc39('0x30')](_0x190231['model'],_0x190231[_0xcc39('0x2e')]);_0x1219cb['attributes']=_[_0xcc39('0x30')](_0x190231[_0xcc39('0x2c')],qs[_0xcc39('0x32')](_0x32da81[_0xcc39('0x2e')][_0xcc39('0x32')]));_0x1219cb[_0xcc39('0x31')]=_0x1219cb['attributes']['length']?_0x1219cb[_0xcc39('0x31')]:_0x190231[_0xcc39('0x2c')];_0x1219cb[_0xcc39('0x36')]=qs['sort'](_0x32da81[_0xcc39('0x2e')][_0xcc39('0x37')]);_0x1219cb['where']=qs[_0xcc39('0x2f')](_[_0xcc39('0x39')](_0x32da81[_0xcc39('0x2e')],_0x190231[_0xcc39('0x2f')]));if(_0x32da81[_0xcc39('0x2e')][_0xcc39('0x3a')]){_0x1219cb[_0xcc39('0x38')]=_[_0xcc39('0x3d')](_0x1219cb[_0xcc39('0x38')],{'$or':_['map'](_0x1219cb[_0xcc39('0x31')],function(_0x70576f){var _0x21d522={};_0x21d522[_0x70576f]={'$like':'%'+_0x32da81[_0xcc39('0x2e')]['filter']+'%'};return _0x21d522;})});}_0x1219cb=_[_0xcc39('0x3d')]({},_0x1219cb,_0x32da81[_0xcc39('0x3e')]);return _0x37e381[_0xcc39('0x4a')](_0x1219cb);}})['then'](function(_0xa169c7){if(_0xa169c7){_0x150bad=_0xa169c7[_0xcc39('0x33')];if(!_0x32da81[_0xcc39('0x2e')][_0xcc39('0x34')](_0xcc39('0x35'))){_0x1219cb['limit']=qs[_0xcc39('0x1e')](_0x32da81['query'][_0xcc39('0x1e')]);_0x1219cb[_0xcc39('0x1d')]=qs[_0xcc39('0x1d')](_0x32da81[_0xcc39('0x2e')][_0xcc39('0x1d')]);}return _0x37e381[_0xcc39('0x4a')](_0x1219cb);}})[_0xcc39('0x24')](function(_0x404c96){if(_0x404c96){return _0x404c96?{'count':_0x150bad,'rows':_0x404c96}:null;}})[_0xcc39('0x24')](respondWithResult(_0x5c4c64,null))[_0xcc39('0x43')](handleError(_0x5c4c64,null));};exports[_0xcc39('0x4c')]=function(_0x531140,_0x4b1742,_0x3430d2){if(_0x531140[_0xcc39('0x47')]['id']){delete _0x531140['body']['id'];}return db['Dynamics365Account'][_0xcc39('0x4b')]({'where':{'id':_0x531140[_0xcc39('0x45')]['id']}})['then'](handleEntityNotFound(_0x4b1742,null))[_0xcc39('0x24')](function(_0x53d7b0){if(_0x53d7b0){_0x531140[_0xcc39('0x47')][_0xcc39('0x4d')]=_0x53d7b0['id'];_0x531140[_0xcc39('0x47')][_0xcc39('0x4e')]=integrations[_0xcc39('0x4f')](_0x531140['body'][_0xcc39('0x50')],_0x531140['body'][_0xcc39('0x3b')]);_0x531140[_0xcc39('0x47')][_0xcc39('0x51')]=integrations[_0xcc39('0x52')](_0x531140[_0xcc39('0x47')][_0xcc39('0x50')],_0x531140[_0xcc39('0x47')][_0xcc39('0x3b')]);return db[_0xcc39('0x53')][_0xcc39('0x46')](_0x531140[_0xcc39('0x47')],{'include':[{'model':db[_0xcc39('0x54')],'as':_0xcc39('0x4e')},{'model':db[_0xcc39('0x54')],'as':_0xcc39('0x51')}]});}return null;})[_0xcc39('0x24')](respondWithResult(_0x4b1742,null))[_0xcc39('0x43')](handleError(_0x4b1742,null));};exports[_0xcc39('0x55')]=function(_0xe77c57,_0x5bb144,_0x3c4a07){var _0x330682=_0xe77c57[_0xcc39('0x2e')]['ticketType'];var _0x27cf81=_0x330682===_0xcc39('0x56')?_0xcc39('0x57'):_0xcc39('0x58');var _0x57c3e0='';var _0x5e9651='';var _0x2a5641='';var _0x5cdb21='';var _0x17bfc5='';var _0xe71618='';var _0x1ff0d6='';var _0x12326c='';var _0x525d7d=['title',_0xcc39('0x59'),_0xcc39('0x5a'),_0xcc39('0x5b'),_0xcc39('0x5c'),_0xcc39('0x5d'),_0xcc39('0x5e'),'regardingobjectid',_0xcc39('0x5f'),'phonecall_activity_parties'];var _0x1420c3=[_0xcc39('0x60'),_0xcc39('0x61'),_0xcc39('0x62'),_0xcc39('0x63'),_0xcc39('0x64'),'contactidyominame',_0xcc39('0x65'),_0xcc39('0x66'),_0xcc39('0x67'),_0xcc39('0x68'),_0xcc39('0x69'),'createdbyyominame',_0xcc39('0x6a'),_0xcc39('0x6b'),_0xcc39('0x6c'),'customeridname',_0xcc39('0x6d'),_0xcc39('0x6e'),_0xcc39('0x6f'),'entitlementidname',_0xcc39('0x70'),_0xcc39('0x71'),_0xcc39('0x72'),_0xcc39('0x73'),_0xcc39('0x74'),'followupby',_0xcc39('0x75'),'influencescore','kbarticleidname',_0xcc39('0x76'),_0xcc39('0x77'),_0xcc39('0x78'),_0xcc39('0x79'),_0xcc39('0x7a'),_0xcc39('0x7b'),'modifiedon','modifiedonbehalfbyname',_0xcc39('0x7c'),'msdyn_incidenttypename',_0xcc39('0x7d'),'numberofchildincidents',_0xcc39('0x7e'),_0xcc39('0x7f'),_0xcc39('0x80'),'owneridtype',_0xcc39('0x81'),_0xcc39('0x82'),_0xcc39('0x83'),'primarycontactidyominame','prioritycodename','productidname',_0xcc39('0x84'),'resolveby','resolvebykpiidname','responseby',_0xcc39('0x85'),_0xcc39('0x86'),_0xcc39('0x87'),'slainvokedidname',_0xcc39('0x88'),_0xcc39('0x89'),'statecode',_0xcc39('0x8a'),_0xcc39('0x8b'),_0xcc39('0x8c'),'timezoneruleversionnumber',_0xcc39('0x8d'),_0xcc39('0x8e'),_0xcc39('0x8f'),_0xcc39('0x90')];var _0x15c9c5=_0x525d7d[_0xcc39('0x91')](_0x1420c3);return db[_0xcc39('0x3f')][_0xcc39('0x4b')]({'where':{'id':_0xe77c57[_0xcc39('0x45')]['id']},'attributes':['id','username',_0xcc39('0x92'),'remoteUri','tenantId',_0xcc39('0x93'),'clientSecret']})[_0xcc39('0x24')](handleEntityNotFound(_0x5bb144,null))[_0xcc39('0x24')](function(_0x5dc5c7){if(_0x5dc5c7){_0x12326c=_0x5dc5c7[_0xcc39('0x94')];var _0x364598=_0x12326c[_0xcc39('0x95')](-0x1);if(_0x364598==='/'){_0x12326c=_0x12326c[_0xcc39('0x96')](0x0,_0x12326c[_0xcc39('0x97')](_0x364598));}_0x1ff0d6=util[_0xcc39('0x98')](_0xcc39('0x99'),_0x12326c);var _0x4ead10={'method':_0xcc39('0x9a'),'uri':_0xcc39('0x9b')+_0x5dc5c7[_0xcc39('0x9c')]+_0xcc39('0x9d'),'form':{'client_id':_0x5dc5c7[_0xcc39('0x93')],'resource':_0x12326c,'username':_0x5dc5c7['username'],'password':_0x5dc5c7[_0xcc39('0x92')],'grant_type':_0xcc39('0x92'),'client_secret':_0x5dc5c7['clientSecret']},'json':!![]};return rp(_0x4ead10);}})['then'](function(_0x3ebab3){_0xe71618=_0x3ebab3[_0xcc39('0x9e')];var _0x283227={'method':_0xcc39('0x9f'),'uri':encodeURI(_0x1ff0d6+_0xcc39('0xa0')+_0x27cf81+'\x27'),'headers':{'Authorization':_0xcc39('0xa1')+_0xe71618,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x283227);})[_0xcc39('0x24')](function(_0x50d8de){var _0x2404a4=_0x50d8de[_0xcc39('0xa2')][0x0];var _0x33b483=_0x2404a4[_0xcc39('0xa3')];var _0x2e16a1={'method':_0xcc39('0x9f'),'uri':_0x1ff0d6+_0xcc39('0xa4')+_0x33b483+_0xcc39('0xa5'),'headers':{'Authorization':_0xcc39('0xa1')+_0xe71618,'If-None-Match':null,'OData-Version':_0xcc39('0xa6')},'json':!![]};return rp(_0x2e16a1);})[_0xcc39('0x24')](function(_0x23b568){_0x57c3e0=_0x23b568;_0x5e9651=_0x57c3e0['Attributes'];_0x5e9651=_[_0xcc39('0xa7')](_0x5e9651,function(_0x2850b3){return!_0x15c9c5[_0xcc39('0xa8')](_0x2850b3['LogicalName']);});var _0x5838be=[];var _0x49f4b2=[];_0x5e9651['forEach'](function(_0x425b30){if(_0x425b30[_0xcc39('0xa9')]){var _0x12da14=_0x425b30['@odata.type'][_0xcc39('0x96')](_0x425b30[_0xcc39('0xa9')][_0xcc39('0x97')]('.')+0x1);if(_0x12da14===_0xcc39('0xaa')){_0x5838be[_0xcc39('0xab')](getSelectList(_0x1ff0d6,_0x330682,_0x49f4b2,_0x57c3e0['MetadataId'],_0x425b30[_0xcc39('0xa3')],_0xe71618));}}});return Promise[_0xcc39('0xac')](_0x5838be);})[_0xcc39('0x24')](function(_0x1ba3c2){_0x2a5641=_0x1ba3c2[0x0];var _0x21b3cd=[];var _0x3224e9=[];_0x5e9651['forEach'](function(_0x12e4f7){if(!_['isNil'](_0x12e4f7[_0xcc39('0xa9')])){var _0x2270a8=_0x12e4f7[_0xcc39('0xa9')]['substring'](_0x12e4f7['@odata.type'][_0xcc39('0x97')]('.')+0x1);if(_0x2270a8===_0xcc39('0xad')){_0x21b3cd['push'](getBooleanList(_0x1ff0d6,_0x330682,_0x3224e9,_0x57c3e0['MetadataId'],_0x12e4f7[_0xcc39('0xa3')],_0xe71618));}}});return Promise['all'](_0x21b3cd);})[_0xcc39('0x24')](function(_0xf11661){_0x5cdb21=_0xf11661[0x0];var _0xb13353=[];var _0x5ca74b=[];_0x5e9651[_0xcc39('0xae')](function(_0x468cd1){if(_0x468cd1[_0xcc39('0xa9')]){var _0x467f11=_0x468cd1[_0xcc39('0xa9')][_0xcc39('0x96')](_0x468cd1[_0xcc39('0xa9')][_0xcc39('0x97')]('.')+0x1);if(_0x467f11===_0xcc39('0xaf')||_0x467f11===_0xcc39('0xb0')||_0x467f11===_0xcc39('0xb1')||_0x467f11==='IntegerAttributeMetadata'||_0x467f11===_0xcc39('0xb2')||_0x467f11==='DateTimeAttributeMetadata'||_0x467f11===_0xcc39('0xb3')||_0x467f11===_0xcc39('0xb4')||_0x467f11==='StateAttributeMetadata'||_0x467f11==='DecimalAttributeMetadata'){_0xb13353['push'](getInputList(_0x1ff0d6,_0x330682,_0x467f11,_0x5ca74b,_0x57c3e0[_0xcc39('0xa3')],_0x468cd1['MetadataId'],_0xe71618));}}});return Promise['all'](_0xb13353);})['then'](function(_0xd9c834){_0x17bfc5=_0xd9c834[0x0];var _0x2b70ff=_0x2a5641['concat'](_0x5cdb21)[_0xcc39('0x91')](_0x17bfc5);var _0xbdce6d={'count':_0x2b70ff[_0xcc39('0x33')],'rows':_0x2b70ff};return _0xbdce6d;})[_0xcc39('0x24')](respondWithResult(_0x5bb144,null))['catch'](function(_0x4d452a){var _0x186f29=_0xe77c57[_0xcc39('0x2e')]['test']?0x1f4:_0x4d452a[_0xcc39('0xb5')]||0x1f4;logger['error'](_0x4d452a['stack']);delete _0x4d452a[_0xcc39('0x27')];if(_0x186f29===0x191){_0x186f29=0x190;}_0x5bb144[_0xcc39('0x1a')](_0x186f29)[_0xcc39('0x28')](_0xe77c57[_0xcc39('0x2e')][_0xcc39('0xb6')]?{'message':_0xcc39('0xb7'),'statusCode':_0x4d452a[_0xcc39('0xb5')]}:_0x4d452a);});};function getSelectList(_0x27239a,_0x2e205a,_0x33f761,_0x1de4d1,_0x6d3a58,_0x12b8f2){var _0x1641b9={'method':_0xcc39('0x9f'),'uri':_0x27239a+_0xcc39('0xa4')+_0x1de4d1+')/Attributes('+_0x6d3a58+_0xcc39('0xb8')+_0xcc39('0xb9'),'headers':{'Authorization':_0xcc39('0xa1')+_0x12b8f2,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x1641b9)[_0xcc39('0x24')](function(_0x2fd3a8){var _0x386c16=[];var _0x4b2995=_0x2fd3a8[_0xcc39('0xba')]['Options'];_0x4b2995['forEach'](function(_0xf0d2c7){_0x386c16[_0xcc39('0xab')]({'name':_0xf0d2c7[_0xcc39('0xbb')][_0xcc39('0xbc')][_0xcc39('0xbb')],'value':String(_0xf0d2c7['Value'])});});var _0x1984ae={'id':_0x2e205a+'_'+_0x2fd3a8[_0xcc39('0xbd')],'name':_0x2fd3a8[_0xcc39('0xbe')][_0xcc39('0xbc')][_0xcc39('0xbb')],'custom':![],'options':_0x386c16};_0x33f761['push'](_0x1984ae);return _0x33f761;});}function getBooleanList(_0x381be2,_0x219bdd,_0x4ab9bb,_0x2f772e,_0xa1a05d,_0x2cbb3f){var _0x2c32a3={'method':_0xcc39('0x9f'),'uri':_0x381be2+'EntityDefinitions('+_0x2f772e+_0xcc39('0xbf')+_0xa1a05d+_0xcc39('0xc0'),'headers':{'Authorization':_0xcc39('0xa1')+_0x2cbb3f,'If-None-Match':null,'OData-Version':_0xcc39('0xa6')},'json':!![]};return rp(_0x2c32a3)[_0xcc39('0x24')](function(_0x3506a6){var _0x12eedf=[];_0x12eedf['push']({'name':_0x3506a6[_0xcc39('0xba')]['TrueOption'][_0xcc39('0xbb')][_0xcc39('0xbc')]['Label'],'value':_0xcc39('0xc1')},{'name':_0x3506a6['OptionSet'][_0xcc39('0xc2')][_0xcc39('0xbb')][_0xcc39('0xbc')][_0xcc39('0xbb')],'value':_0xcc39('0xc3')});var _0x68f809={'id':_0x219bdd+'_'+_0x3506a6[_0xcc39('0xbd')],'name':_0x3506a6['DisplayName']['UserLocalizedLabel'][_0xcc39('0xbb')],'custom':![],'options':_0x12eedf};_0x4ab9bb['push'](_0x68f809);return _0x4ab9bb;});}function getInputList(_0x84eb0b,_0x33053d,_0xc5843f,_0x1ec40b,_0x4bac31,_0x2577fd,_0x3397b2){var _0x27342f={'method':_0xcc39('0x9f'),'uri':_0x84eb0b+'EntityDefinitions('+_0x4bac31+_0xcc39('0xbf')+_0x2577fd+_0xcc39('0xc4')+_0xc5843f+_0xcc39('0xc5'),'headers':{'Authorization':_0xcc39('0xa1')+_0x3397b2,'If-None-Match':null,'OData-Version':_0xcc39('0xa6')},'json':!![]};return rp(_0x27342f)['then'](function(_0xd51a9f){var _0x38b1dd={'id':_0x33053d+'_'+_0xd51a9f['LogicalName'],'name':_0xd51a9f['DisplayName']['UserLocalizedLabel']?_0xd51a9f[_0xcc39('0xbe')][_0xcc39('0xbc')]['Label']:_0xd51a9f[_0xcc39('0xbd')],'custom':![],'options':[]};_0x1ec40b[_0xcc39('0xab')](_0x38b1dd);return _0x1ec40b;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 038bb0c..cdd1899 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 _0xbaf0=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','util'];(function(_0x48db3d,_0x5188a4){var _0x1e94a4=function(_0x4feb2e){while(--_0x4feb2e){_0x48db3d['push'](_0x48db3d['shift']());}};_0x1e94a4(++_0x5188a4);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xbaf0[_0x5ddb1c];return _0x354adc;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));var integrations=require(_0x0baf('0x9'));module[_0x0baf('0xa')]=function(_0x335e24,_0x1a10b1){return _0x335e24[_0x0baf('0xb')](_0x0baf('0xc'),attributes,{'tableName':'int_dynamics365_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb7e7=['int_dynamics365_accounts','lodash','../../config/logger','moment','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','define'];(function(_0x2b8cce,_0x5c4b8a){var _0x4db75f=function(_0x169f96){while(--_0x169f96){_0x2b8cce['push'](_0x2b8cce['shift']());}};_0x4db75f(++_0x5c4b8a);}(_0xb7e7,0x121));var _0x7b7e=function(_0x487b0c,_0x14ff74){_0x487b0c=_0x487b0c-0x0;var _0x1adbdc=_0xb7e7[_0x487b0c];return _0x1adbdc;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x333fa4,_0x372bde){return _0x333fa4[_0x7b7e('0x7')]('Dynamics365Account',attributes,{'tableName':_0x7b7e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index 0f8da49..c49cb92 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 _0x17a1=['raw','where','attributes','limit','map','include','model','stringify','ShowDynamics365Account','find','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','Dynamics365Account,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetDynamics365Account','findAll','options'];(function(_0x514fc0,_0x1032a0){var _0x26f8ee=function(_0x3bd0da){while(--_0x3bd0da){_0x514fc0['push'](_0x514fc0['shift']());}};_0x26f8ee(++_0x1032a0);}(_0x17a1,0x13b));var _0x117a=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x17a1[_0x422905];return _0x33dc6c;};'use strict';var _=require(_0x117a('0x0'));var util=require(_0x117a('0x1'));var moment=require(_0x117a('0x2'));var BPromise=require(_0x117a('0x3'));var rs=require(_0x117a('0x4'));var fs=require('fs');var Redis=require(_0x117a('0x5'));var db=require(_0x117a('0x6'))['db'];var utils=require(_0x117a('0x7'));var logger=require(_0x117a('0x8'))(_0x117a('0x9'));var config=require(_0x117a('0xa'));var jayson=require(_0x117a('0xb'));var client=jayson[_0x117a('0xc')][_0x117a('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x4b0267,_0x134e47,_0x270cbc){return new BPromise(function(_0x122f09,_0x46573a){return client[_0x117a('0xe')](_0x4b0267,_0x270cbc)[_0x117a('0xf')](function(_0x30b783){logger[_0x117a('0x10')](_0x117a('0x11'),_0x134e47,_0x117a('0x12'));logger['debug'](_0x117a('0x13'),_0x134e47,_0x117a('0x12'),JSON['stringify'](_0x30b783));if(_0x30b783['error']){if(_0x30b783[_0x117a('0x14')]['code']===0x1f4){logger[_0x117a('0x14')](_0x117a('0x11'),_0x134e47,_0x30b783['error'][_0x117a('0x15')]);return _0x46573a(_0x30b783[_0x117a('0x14')][_0x117a('0x15')]);}logger[_0x117a('0x14')](_0x117a('0x11'),_0x134e47,_0x30b783[_0x117a('0x14')][_0x117a('0x15')]);return _0x122f09(_0x30b783['error'][_0x117a('0x15')]);}else{logger[_0x117a('0x10')](_0x117a('0x11'),_0x134e47,_0x117a('0x12'));_0x122f09(_0x30b783[_0x117a('0x16')][_0x117a('0x15')]);}})[_0x117a('0x17')](function(_0x18b3c7){logger[_0x117a('0x14')](_0x117a('0x11'),_0x134e47,_0x18b3c7);_0x46573a(_0x18b3c7);});});}exports[_0x117a('0x18')]=function(_0x3ec9fe){var _0x59a821=this;return new Promise(function(_0x5a036a,_0x20423f){return db['Dynamics365Account'][_0x117a('0x19')]({'raw':_0x3ec9fe[_0x117a('0x1a')]?_0x3ec9fe[_0x117a('0x1a')][_0x117a('0x1b')]===undefined?!![]:![]:!![],'where':_0x3ec9fe['options']?_0x3ec9fe[_0x117a('0x1a')][_0x117a('0x1c')]||null:null,'attributes':_0x3ec9fe[_0x117a('0x1a')]?_0x3ec9fe[_0x117a('0x1a')][_0x117a('0x1d')]||null:null,'limit':_0x3ec9fe[_0x117a('0x1a')]?_0x3ec9fe[_0x117a('0x1a')][_0x117a('0x1e')]||null:null,'include':_0x3ec9fe[_0x117a('0x1a')]?_0x3ec9fe[_0x117a('0x1a')]['include']?_[_0x117a('0x1f')](_0x3ec9fe['options'][_0x117a('0x20')],function(_0x159c40){return{'model':db[_0x159c40[_0x117a('0x21')]],'as':_0x159c40['as'],'attributes':_0x159c40['attributes'],'include':_0x159c40['include']?_[_0x117a('0x1f')](_0x159c40[_0x117a('0x20')],function(_0x4f3f6e){return{'model':db[_0x4f3f6e[_0x117a('0x21')]],'as':_0x4f3f6e['as'],'attributes':_0x4f3f6e[_0x117a('0x1d')],'include':_0x4f3f6e[_0x117a('0x20')]?_[_0x117a('0x1f')](_0x4f3f6e[_0x117a('0x20')],function(_0x2a4f02){return{'model':db[_0x2a4f02['model']],'as':_0x2a4f02['as'],'attributes':_0x2a4f02[_0x117a('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x117a('0xf')](function(_0x13b92e){logger['info'](_0x117a('0x18'),_0x3ec9fe);logger['debug'](_0x117a('0x18'),_0x3ec9fe,JSON[_0x117a('0x22')](_0x13b92e));_0x5a036a(_0x13b92e);})[_0x117a('0x17')](function(_0x1e56a2){logger[_0x117a('0x14')](_0x117a('0x18'),_0x1e56a2[_0x117a('0x15')],_0x3ec9fe);_0x20423f(_0x59a821[_0x117a('0x14')](0x1f4,_0x1e56a2['message']));});});};exports[_0x117a('0x23')]=function(_0x2a98d8){var _0x4cf26c=this;return new Promise(function(_0x10f6ed,_0x44db7d){return db['Dynamics365Account'][_0x117a('0x24')]({'raw':_0x2a98d8[_0x117a('0x1a')]?_0x2a98d8[_0x117a('0x1a')][_0x117a('0x1b')]===undefined?!![]:![]:!![],'where':_0x2a98d8[_0x117a('0x1a')]?_0x2a98d8[_0x117a('0x1a')][_0x117a('0x1c')]||null:null,'attributes':_0x2a98d8[_0x117a('0x1a')]?_0x2a98d8['options']['attributes']||null:null,'include':_0x2a98d8['options']?_0x2a98d8[_0x117a('0x1a')][_0x117a('0x20')]?_[_0x117a('0x1f')](_0x2a98d8['options'][_0x117a('0x20')],function(_0x513c09){return{'model':db[_0x513c09[_0x117a('0x21')]],'as':_0x513c09['as'],'attributes':_0x513c09[_0x117a('0x1d')],'include':_0x513c09['include']?_[_0x117a('0x1f')](_0x513c09[_0x117a('0x20')],function(_0x5608c6){return{'model':db[_0x5608c6[_0x117a('0x21')]],'as':_0x5608c6['as'],'attributes':_0x5608c6[_0x117a('0x1d')],'include':_0x5608c6[_0x117a('0x20')]?_['map'](_0x5608c6[_0x117a('0x20')],function(_0x5544b9){return{'model':db[_0x5544b9[_0x117a('0x21')]],'as':_0x5544b9['as'],'attributes':_0x5544b9[_0x117a('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x117a('0xf')](function(_0x273cb6){logger[_0x117a('0x10')]('ShowDynamics365Account',_0x2a98d8);logger[_0x117a('0x25')](_0x117a('0x23'),_0x2a98d8,JSON[_0x117a('0x22')](_0x273cb6));_0x10f6ed(_0x273cb6);})[_0x117a('0x17')](function(_0x47f3c1){logger['error'](_0x117a('0x23'),_0x47f3c1[_0x117a('0x15')],_0x2a98d8);_0x44db7d(_0x4cf26c[_0x117a('0x14')](0x1f4,_0x47f3c1['message']));});});}; \ No newline at end of file +var _0xec78=['ShowDynamics365Account','find','raw','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','Dynamics365Account','findAll','options','where','attributes','limit','map','include','model','GetDynamics365Account','debug'];(function(_0x3559b4,_0x7ec87b){var _0x73b3e1=function(_0x33e853){while(--_0x33e853){_0x3559b4['push'](_0x3559b4['shift']());}};_0x73b3e1(++_0x7ec87b);}(_0xec78,0x14d));var _0x8ec7=function(_0xc298ad,_0xea4dc2){_0xc298ad=_0xc298ad-0x0;var _0x11b2e6=_0xec78[_0xc298ad];return _0x11b2e6;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x8ec7('0x0'));var rs=require(_0x8ec7('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8ec7('0x2'));var logger=require('../../config/logger')(_0x8ec7('0x3'));var config=require(_0x8ec7('0x4'));var jayson=require(_0x8ec7('0x5'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xa84f16,_0x3ac8ad,_0x47dd38){return new BPromise(function(_0x2cea43,_0x441f05){return client[_0x8ec7('0x6')](_0xa84f16,_0x47dd38)[_0x8ec7('0x7')](function(_0x43f92f){logger[_0x8ec7('0x8')](_0x8ec7('0x9'),_0x3ac8ad,_0x8ec7('0xa'));logger['debug']('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x3ac8ad,'request\x20sent',JSON[_0x8ec7('0xb')](_0x43f92f));if(_0x43f92f[_0x8ec7('0xc')]){if(_0x43f92f[_0x8ec7('0xc')]['code']===0x1f4){logger[_0x8ec7('0xc')](_0x8ec7('0x9'),_0x3ac8ad,_0x43f92f[_0x8ec7('0xc')]['message']);return _0x441f05(_0x43f92f['error']['message']);}logger[_0x8ec7('0xc')](_0x8ec7('0x9'),_0x3ac8ad,_0x43f92f['error']['message']);return _0x2cea43(_0x43f92f[_0x8ec7('0xc')][_0x8ec7('0xd')]);}else{logger['info'](_0x8ec7('0x9'),_0x3ac8ad,_0x8ec7('0xa'));_0x2cea43(_0x43f92f[_0x8ec7('0xe')][_0x8ec7('0xd')]);}})[_0x8ec7('0xf')](function(_0xf945b7){logger[_0x8ec7('0xc')](_0x8ec7('0x9'),_0x3ac8ad,_0xf945b7);_0x441f05(_0xf945b7);});});}exports['GetDynamics365Account']=function(_0x4fc55c){var _0x21e85=this;return new Promise(function(_0x8d8336,_0x50e717){return db[_0x8ec7('0x10')][_0x8ec7('0x11')]({'raw':_0x4fc55c[_0x8ec7('0x12')]?_0x4fc55c[_0x8ec7('0x12')]['raw']===undefined?!![]:![]:!![],'where':_0x4fc55c['options']?_0x4fc55c[_0x8ec7('0x12')][_0x8ec7('0x13')]||null:null,'attributes':_0x4fc55c['options']?_0x4fc55c['options'][_0x8ec7('0x14')]||null:null,'limit':_0x4fc55c[_0x8ec7('0x12')]?_0x4fc55c[_0x8ec7('0x12')][_0x8ec7('0x15')]||null:null,'include':_0x4fc55c[_0x8ec7('0x12')]?_0x4fc55c[_0x8ec7('0x12')]['include']?_[_0x8ec7('0x16')](_0x4fc55c[_0x8ec7('0x12')][_0x8ec7('0x17')],function(_0x3dbeb2){return{'model':db[_0x3dbeb2[_0x8ec7('0x18')]],'as':_0x3dbeb2['as'],'attributes':_0x3dbeb2[_0x8ec7('0x14')],'include':_0x3dbeb2[_0x8ec7('0x17')]?_['map'](_0x3dbeb2[_0x8ec7('0x17')],function(_0x36fca5){return{'model':db[_0x36fca5[_0x8ec7('0x18')]],'as':_0x36fca5['as'],'attributes':_0x36fca5[_0x8ec7('0x14')],'include':_0x36fca5[_0x8ec7('0x17')]?_[_0x8ec7('0x16')](_0x36fca5[_0x8ec7('0x17')],function(_0x5d155f){return{'model':db[_0x5d155f['model']],'as':_0x5d155f['as'],'attributes':_0x5d155f[_0x8ec7('0x14')]};}):[]};}):[]};}):[]:[]})[_0x8ec7('0x7')](function(_0x4a2878){logger[_0x8ec7('0x8')](_0x8ec7('0x19'),_0x4fc55c);logger[_0x8ec7('0x1a')]('GetDynamics365Account',_0x4fc55c,JSON[_0x8ec7('0xb')](_0x4a2878));_0x8d8336(_0x4a2878);})[_0x8ec7('0xf')](function(_0x463cef){logger[_0x8ec7('0xc')](_0x8ec7('0x19'),_0x463cef[_0x8ec7('0xd')],_0x4fc55c);_0x50e717(_0x21e85['error'](0x1f4,_0x463cef['message']));});});};exports[_0x8ec7('0x1b')]=function(_0x16392f){var _0x4852b8=this;return new Promise(function(_0x52fbcf,_0x58c721){return db['Dynamics365Account'][_0x8ec7('0x1c')]({'raw':_0x16392f['options']?_0x16392f['options'][_0x8ec7('0x1d')]===undefined?!![]:![]:!![],'where':_0x16392f['options']?_0x16392f[_0x8ec7('0x12')][_0x8ec7('0x13')]||null:null,'attributes':_0x16392f[_0x8ec7('0x12')]?_0x16392f['options'][_0x8ec7('0x14')]||null:null,'include':_0x16392f[_0x8ec7('0x12')]?_0x16392f[_0x8ec7('0x12')][_0x8ec7('0x17')]?_[_0x8ec7('0x16')](_0x16392f[_0x8ec7('0x12')]['include'],function(_0x1389e2){return{'model':db[_0x1389e2[_0x8ec7('0x18')]],'as':_0x1389e2['as'],'attributes':_0x1389e2[_0x8ec7('0x14')],'include':_0x1389e2[_0x8ec7('0x17')]?_['map'](_0x1389e2[_0x8ec7('0x17')],function(_0x1484af){return{'model':db[_0x1484af[_0x8ec7('0x18')]],'as':_0x1484af['as'],'attributes':_0x1484af[_0x8ec7('0x14')],'include':_0x1484af[_0x8ec7('0x17')]?_['map'](_0x1484af[_0x8ec7('0x17')],function(_0x167452){return{'model':db[_0x167452[_0x8ec7('0x18')]],'as':_0x167452['as'],'attributes':_0x167452['attributes']};}):[]};}):[]};}):[]:[]})[_0x8ec7('0x7')](function(_0x4a2f2d){logger['info']('ShowDynamics365Account',_0x16392f);logger['debug']('ShowDynamics365Account',_0x16392f,JSON[_0x8ec7('0xb')](_0x4a2f2d));_0x52fbcf(_0x4a2f2d);})['catch'](function(_0x159d4e){logger[_0x8ec7('0xc')](_0x8ec7('0x1b'),_0x159d4e['message'],_0x16392f);_0x58c721(_0x4852b8[_0x8ec7('0xc')](0x1f4,_0x159d4e[_0x8ec7('0xd')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index cbb59a6..860629e 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 _0x3d3e=['isAuthenticated','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','index','/:id'];(function(_0x285824,_0x3da647){var _0x311d7e=function(_0x2f3de0){while(--_0x2f3de0){_0x285824['push'](_0x285824['shift']());}};_0x311d7e(++_0x3da647);}(_0x3d3e,0x89));var _0xe3d3=function(_0x2f04ed,_0x18e3ce){_0x2f04ed=_0x2f04ed-0x0;var _0x5116d7=_0x3d3e[_0x2f04ed];return _0x5116d7;};'use strict';var multer=require(_0xe3d3('0x0'));var util=require(_0xe3d3('0x1'));var path=require(_0xe3d3('0x2'));var timeout=require(_0xe3d3('0x3'));var express=require(_0xe3d3('0x4'));var router=express[_0xe3d3('0x5')]();var fs_extra=require(_0xe3d3('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xe3d3('0x7'));var config=require(_0xe3d3('0x8'));var controller=require(_0xe3d3('0x9'));router[_0xe3d3('0xa')]('/',auth['isAuthenticated'](),controller[_0xe3d3('0xb')]);router[_0xe3d3('0xa')](_0xe3d3('0xc'),auth[_0xe3d3('0xd')](),controller['show']);router['get'](_0xe3d3('0xe'),auth[_0xe3d3('0xd')](),controller[_0xe3d3('0xf')]);router[_0xe3d3('0xa')](_0xe3d3('0x10'),auth['isAuthenticated'](),controller[_0xe3d3('0x11')]);router['get'](_0xe3d3('0x12'),auth[_0xe3d3('0xd')](),controller[_0xe3d3('0x13')]);router[_0xe3d3('0x14')]('/',auth[_0xe3d3('0xd')](),controller[_0xe3d3('0x15')]);router[_0xe3d3('0x16')](_0xe3d3('0xc'),auth[_0xe3d3('0xd')](),controller['update']);router[_0xe3d3('0x17')](_0xe3d3('0xc'),auth[_0xe3d3('0xd')](),controller['destroy']);module[_0xe3d3('0x18')]=router; \ No newline at end of file +var _0x2396=['getSubjects','getDescriptions','post','create','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','index','isAuthenticated','show','/:id/fields','getFields'];(function(_0x13cba3,_0x50e6fe){var _0xc79cc9=function(_0x19e9dc){while(--_0x19e9dc){_0x13cba3['push'](_0x13cba3['shift']());}};_0xc79cc9(++_0x50e6fe);}(_0x2396,0xb9));var _0x6239=function(_0x220f3b,_0x34332d){_0x220f3b=_0x220f3b-0x0;var _0x752fb7=_0x2396[_0x220f3b];return _0x752fb7;};'use strict';var multer=require(_0x6239('0x0'));var util=require('util');var path=require(_0x6239('0x1'));var timeout=require(_0x6239('0x2'));var express=require(_0x6239('0x3'));var router=express[_0x6239('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6239('0x5'));var interaction=require(_0x6239('0x6'));var config=require(_0x6239('0x7'));var controller=require(_0x6239('0x8'));router[_0x6239('0x9')]('/',auth['isAuthenticated'](),controller[_0x6239('0xa')]);router[_0x6239('0x9')]('/:id',auth[_0x6239('0xb')](),controller[_0x6239('0xc')]);router[_0x6239('0x9')](_0x6239('0xd'),auth[_0x6239('0xb')](),controller[_0x6239('0xe')]);router[_0x6239('0x9')]('/:id/subjects',auth[_0x6239('0xb')](),controller[_0x6239('0xf')]);router[_0x6239('0x9')]('/:id/descriptions',auth[_0x6239('0xb')](),controller[_0x6239('0x10')]);router[_0x6239('0x11')]('/',auth[_0x6239('0xb')](),controller[_0x6239('0x12')]);router[_0x6239('0x13')](_0x6239('0x14'),auth['isAuthenticated'](),controller[_0x6239('0x15')]);router[_0x6239('0x16')]('/:id',auth[_0x6239('0xb')](),controller[_0x6239('0x17')]);module[_0x6239('0x18')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 32dbced..55365d9 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 _0x03dd=['ENUM','incident','phonecall','contact','nothing','sequelize','exports','STRING'];(function(_0x4db1c1,_0x4f26a4){var _0xb48c08=function(_0x2a7cac){while(--_0x2a7cac){_0x4db1c1['push'](_0x4db1c1['shift']());}};_0xb48c08(++_0x4f26a4);}(_0x03dd,0x19d));var _0xd03d=function(_0x501e6d,_0x43ce8e){_0x501e6d=_0x501e6d-0x0;var _0x545ff9=_0x03dd[_0x501e6d];return _0x545ff9;};'use strict';var Sequelize=require(_0xd03d('0x0'));module[_0xd03d('0x1')]={'name':{'type':Sequelize[_0xd03d('0x2')]},'description':{'type':Sequelize[_0xd03d('0x2')]},'ticketType':{'type':Sequelize[_0xd03d('0x3')](_0xd03d('0x4'),_0xd03d('0x5')),'defaultValue':_0xd03d('0x4')},'moduleCreate':{'type':Sequelize[_0xd03d('0x3')](_0xd03d('0x6'),_0xd03d('0x7')),'defaultValue':_0xd03d('0x6'),'allowNull':![]}}; \ No newline at end of file +var _0x86c9=['incident','contact','nothing','exports','STRING','ENUM','phonecall'];(function(_0x4a379b,_0x334e8b){var _0x2e2509=function(_0x82c3b3){while(--_0x82c3b3){_0x4a379b['push'](_0x4a379b['shift']());}};_0x2e2509(++_0x334e8b);}(_0x86c9,0x18b));var _0x986c=function(_0x5378e9,_0x6b5343){_0x5378e9=_0x5378e9-0x0;var _0x5b10ae=_0x86c9[_0x5378e9];return _0x5b10ae;};'use strict';var Sequelize=require('sequelize');module[_0x986c('0x0')]={'name':{'type':Sequelize[_0x986c('0x1')]},'description':{'type':Sequelize[_0x986c('0x1')]},'ticketType':{'type':Sequelize[_0x986c('0x2')]('incident',_0x986c('0x3')),'defaultValue':_0x986c('0x4')},'moduleCreate':{'type':Sequelize[_0x986c('0x2')](_0x986c('0x5'),_0x986c('0x6')),'defaultValue':'contact','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 55f1e78..5a5ab3f 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 _0x2978=['bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','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','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','index','Dynamics365Configuration','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','nolimit','order','sort','where','filters','filter','merge','map','VIRTUAL','includeAll','include','rows','catch','show','params','length','options','find','create','body','update','Dynamics365Field','pick','getFields','findOne','hasOwnProperty','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x189f19,_0x1b0c2c){var _0x5ecd63=function(_0x14e406){while(--_0x14e406){_0x189f19['push'](_0x189f19['shift']());}};_0x5ecd63(++_0x1b0c2c);}(_0x2978,0x152));var _0x8297=function(_0x1fc3fd,_0x2c74f6){_0x1fc3fd=_0x1fc3fd-0x0;var _0x3a9727=_0x2978[_0x1fc3fd];return _0x3a9727;};'use strict';var emlformat=require(_0x8297('0x0'));var rimraf=require(_0x8297('0x1'));var zipdir=require(_0x8297('0x2'));var jsonpatch=require(_0x8297('0x3'));var rp=require(_0x8297('0x4'));var moment=require(_0x8297('0x5'));var BPromise=require(_0x8297('0x6'));var Mustache=require(_0x8297('0x7'));var util=require(_0x8297('0x8'));var path=require(_0x8297('0x9'));var sox=require(_0x8297('0xa'));var csv=require('to-csv');var ejs=require(_0x8297('0xb'));var fs=require('fs');var fs_extra=require(_0x8297('0xc'));var _=require(_0x8297('0xd'));var squel=require(_0x8297('0xe'));var crypto=require(_0x8297('0xf'));var jsforce=require(_0x8297('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x8297('0x11'));var querystring=require(_0x8297('0x12'));var Papa=require(_0x8297('0x13'));var Redis=require(_0x8297('0x14'));var authService=require(_0x8297('0x15'));var qs=require(_0x8297('0x16'));var as=require(_0x8297('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8297('0x18'))(_0x8297('0x19'));var utils=require(_0x8297('0x1a'));var config=require(_0x8297('0x1b'));var licenseUtil=require(_0x8297('0x1c'));var db=require(_0x8297('0x1d'))['db'];function respondWithStatusCode(_0x56d3ae,_0x3af227){_0x3af227=_0x3af227||0xcc;return function(_0x5f4af4){if(_0x5f4af4){return _0x56d3ae['sendStatus'](_0x3af227);}return _0x56d3ae[_0x8297('0x1e')](_0x3af227)[_0x8297('0x1f')]();};}function respondWithResult(_0x2a2a30,_0x3c5b15){_0x3c5b15=_0x3c5b15||0xc8;return function(_0xafb2f0){if(_0xafb2f0){return _0x2a2a30[_0x8297('0x1e')](_0x3c5b15)[_0x8297('0x20')](_0xafb2f0);}};}function respondWithFilteredResult(_0x1a7c68,_0x2f5092){return function(_0x4ef6bf){if(_0x4ef6bf){var _0x320b3a=typeof _0x2f5092[_0x8297('0x21')]==='undefined'&&typeof _0x2f5092[_0x8297('0x22')]===_0x8297('0x23');var _0x3777ce=_0x4ef6bf[_0x8297('0x24')];var _0x101ee2=_0x320b3a?0x0:_0x2f5092['offset'];var _0x290b93=_0x320b3a?_0x4ef6bf[_0x8297('0x24')]:_0x2f5092[_0x8297('0x21')]+_0x2f5092[_0x8297('0x22')];var _0x771727;if(_0x290b93>=_0x3777ce){_0x290b93=_0x3777ce;_0x771727=0xc8;}else{_0x771727=0xce;}_0x1a7c68[_0x8297('0x1e')](_0x771727);return _0x1a7c68['set'](_0x8297('0x25'),_0x101ee2+'-'+_0x290b93+'/'+_0x3777ce)[_0x8297('0x20')](_0x4ef6bf);}return null;};}function patchUpdates(_0x472211){return function(_0x540fd){try{jsonpatch[_0x8297('0x26')](_0x540fd,_0x472211,!![]);}catch(_0x44b400){return BPromise[_0x8297('0x27')](_0x44b400);}return _0x540fd[_0x8297('0x28')]();};}function saveUpdates(_0x522f44,_0x4a3955){return function(_0xed0e07){if(_0xed0e07){return _0xed0e07['update'](_0x522f44)[_0x8297('0x29')](function(_0x3890b){return _0x3890b;});}return null;};}function removeEntity(_0xa7574f,_0x51a021){return function(_0x24ed68){if(_0x24ed68){return _0x24ed68[_0x8297('0x2a')]()[_0x8297('0x29')](function(){_0xa7574f[_0x8297('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x42d794,_0x231388){return function(_0x377fdf){if(!_0x377fdf){_0x42d794[_0x8297('0x2b')](0x194);}return _0x377fdf;};}function handleError(_0x7730fc,_0x5cd7d3){_0x5cd7d3=_0x5cd7d3||0x1f4;return function(_0x2473b8){logger[_0x8297('0x2c')](_0x2473b8[_0x8297('0x2d')]);if(_0x2473b8[_0x8297('0x2e')]){delete _0x2473b8['name'];}_0x7730fc[_0x8297('0x1e')](_0x5cd7d3)[_0x8297('0x2f')](_0x2473b8);};}exports[_0x8297('0x30')]=function(_0xf5efe1,_0x463308){var _0x250dc7={},_0x490eb5={},_0x506089={'count':0x0,'rows':[]};var _0x42fe42=_['map'](db[_0x8297('0x31')][_0x8297('0x32')],function(_0x2fc129){return{'name':_0x2fc129['fieldName'],'type':_0x2fc129[_0x8297('0x33')][_0x8297('0x34')]};});_0x490eb5[_0x8297('0x35')]=_['map'](_0x42fe42,_0x8297('0x2e'));_0x490eb5[_0x8297('0x36')]=_[_0x8297('0x37')](_0xf5efe1['query']);_0x490eb5['filters']=_[_0x8297('0x38')](_0x490eb5[_0x8297('0x35')],_0x490eb5[_0x8297('0x36')]);_0x250dc7['attributes']=_['intersection'](_0x490eb5[_0x8297('0x35')],qs[_0x8297('0x39')](_0xf5efe1[_0x8297('0x36')]['fields']));_0x250dc7['attributes']=_0x250dc7['attributes']['length']?_0x250dc7[_0x8297('0x3a')]:_0x490eb5[_0x8297('0x35')];if(!_0xf5efe1['query']['hasOwnProperty'](_0x8297('0x3b'))){_0x250dc7[_0x8297('0x22')]=qs[_0x8297('0x22')](_0xf5efe1[_0x8297('0x36')][_0x8297('0x22')]);_0x250dc7[_0x8297('0x21')]=qs[_0x8297('0x21')](_0xf5efe1[_0x8297('0x36')][_0x8297('0x21')]);}_0x250dc7[_0x8297('0x3c')]=qs[_0x8297('0x3d')](_0xf5efe1[_0x8297('0x36')]['sort']);_0x250dc7[_0x8297('0x3e')]=qs['filters'](_['pick'](_0xf5efe1[_0x8297('0x36')],_0x490eb5[_0x8297('0x3f')]),_0x42fe42);if(_0xf5efe1[_0x8297('0x36')][_0x8297('0x40')]){_0x250dc7[_0x8297('0x3e')]=_[_0x8297('0x41')](_0x250dc7[_0x8297('0x3e')],{'$or':_[_0x8297('0x42')](_0x42fe42,function(_0x4a8c29){if(_0x4a8c29[_0x8297('0x33')]!==_0x8297('0x43')){var _0x217037={};_0x217037[_0x4a8c29[_0x8297('0x2e')]]={'$like':'%'+_0xf5efe1[_0x8297('0x36')]['filter']+'%'};return _0x217037;}})});}_0x250dc7=_[_0x8297('0x41')]({},_0x250dc7,_0xf5efe1['options']);var _0x510a40={'where':_0x250dc7['where']};return db[_0x8297('0x31')][_0x8297('0x24')](_0x510a40)[_0x8297('0x29')](function(_0x562546){_0x506089[_0x8297('0x24')]=_0x562546;if(_0xf5efe1[_0x8297('0x36')][_0x8297('0x44')]){_0x250dc7[_0x8297('0x45')]=[{'all':!![]}];}return db[_0x8297('0x31')]['findAll'](_0x250dc7);})[_0x8297('0x29')](function(_0x3de34){_0x506089[_0x8297('0x46')]=_0x3de34;return _0x506089;})[_0x8297('0x29')](respondWithFilteredResult(_0x463308,_0x250dc7))[_0x8297('0x47')](handleError(_0x463308,null));};exports[_0x8297('0x48')]=function(_0xdafbec,_0xe31d05){var _0x3d9562={'raw':![],'where':{'id':_0xdafbec[_0x8297('0x49')]['id']}},_0x149e98={};_0x149e98[_0x8297('0x35')]=_[_0x8297('0x37')](db[_0x8297('0x31')][_0x8297('0x32')]);_0x149e98['query']=_[_0x8297('0x37')](_0xdafbec[_0x8297('0x36')]);_0x149e98[_0x8297('0x3f')]=_['intersection'](_0x149e98[_0x8297('0x35')],_0x149e98[_0x8297('0x36')]);_0x3d9562[_0x8297('0x3a')]=_[_0x8297('0x38')](_0x149e98[_0x8297('0x35')],qs[_0x8297('0x39')](_0xdafbec['query']['fields']));_0x3d9562['attributes']=_0x3d9562['attributes'][_0x8297('0x4a')]?_0x3d9562[_0x8297('0x3a')]:_0x149e98[_0x8297('0x35')];if(_0xdafbec[_0x8297('0x36')][_0x8297('0x44')]){_0x3d9562[_0x8297('0x45')]=[{'all':!![]}];}_0x3d9562=_['merge']({},_0x3d9562,_0xdafbec[_0x8297('0x4b')]);return db['Dynamics365Configuration'][_0x8297('0x4c')](_0x3d9562)[_0x8297('0x29')](handleEntityNotFound(_0xe31d05,null))['then'](respondWithResult(_0xe31d05,null))[_0x8297('0x47')](handleError(_0xe31d05,null));};exports[_0x8297('0x4d')]=function(_0x181147,_0x418ba3){return db[_0x8297('0x31')]['create'](_0x181147[_0x8297('0x4e')],{})[_0x8297('0x29')](respondWithResult(_0x418ba3,0xc9))[_0x8297('0x47')](handleError(_0x418ba3,null));};exports[_0x8297('0x4f')]=function(_0x40f2ff,_0xa25154){if(_0x40f2ff[_0x8297('0x4e')]['id']){delete _0x40f2ff[_0x8297('0x4e')]['id'];}return db[_0x8297('0x31')][_0x8297('0x4c')]({'where':{'id':_0x40f2ff[_0x8297('0x49')]['id']}})[_0x8297('0x29')](handleEntityNotFound(_0xa25154,null))[_0x8297('0x29')](saveUpdates(_0x40f2ff[_0x8297('0x4e')],null))['then'](respondWithResult(_0xa25154,null))[_0x8297('0x47')](handleError(_0xa25154,null));};exports['destroy']=function(_0x38d067,_0x12ed7a){return db['Dynamics365Configuration'][_0x8297('0x4c')]({'where':{'id':_0x38d067[_0x8297('0x49')]['id']}})[_0x8297('0x29')](handleEntityNotFound(_0x12ed7a,null))[_0x8297('0x29')](removeEntity(_0x12ed7a,null))[_0x8297('0x47')](handleError(_0x12ed7a,null));};exports['getFields']=function(_0x45863b,_0x2edf6d,_0x1d9435){var _0x5298cb={};var _0x243996={};var _0xd76f5c;var _0x3d71a5;return db['Dynamics365Configuration']['findOne']({'where':{'id':_0x45863b[_0x8297('0x49')]['id']}})[_0x8297('0x29')](handleEntityNotFound(_0x2edf6d,null))[_0x8297('0x29')](function(_0x4a8ad7){if(_0x4a8ad7){_0xd76f5c=_0x4a8ad7;_0x243996[_0x8297('0x35')]=_['keys'](db[_0x8297('0x50')][_0x8297('0x32')]);_0x243996['query']=_[_0x8297('0x37')](_0x45863b['query']);_0x243996[_0x8297('0x3f')]=_[_0x8297('0x38')](_0x243996[_0x8297('0x35')],_0x243996['query']);_0x5298cb[_0x8297('0x3a')]=_[_0x8297('0x38')](_0x243996[_0x8297('0x35')],qs[_0x8297('0x39')](_0x45863b[_0x8297('0x36')][_0x8297('0x39')]));_0x5298cb['attributes']=_0x5298cb[_0x8297('0x3a')][_0x8297('0x4a')]?_0x5298cb[_0x8297('0x3a')]:_0x243996['model'];_0x5298cb[_0x8297('0x3c')]=qs['sort'](_0x45863b[_0x8297('0x36')]['sort']);_0x5298cb[_0x8297('0x3e')]=qs[_0x8297('0x3f')](_[_0x8297('0x51')](_0x45863b[_0x8297('0x36')],_0x243996[_0x8297('0x3f')]));if(_0x45863b[_0x8297('0x36')][_0x8297('0x40')]){_0x5298cb['where']=_[_0x8297('0x41')](_0x5298cb[_0x8297('0x3e')],{'$or':_['map'](_0x5298cb[_0x8297('0x3a')],function(_0x132669){var _0x2d4761={};_0x2d4761[_0x132669]={'$like':'%'+_0x45863b[_0x8297('0x36')][_0x8297('0x40')]+'%'};return _0x2d4761;})});}_0x5298cb=_['merge']({},_0x5298cb,_0x45863b[_0x8297('0x4b')]);return _0xd76f5c[_0x8297('0x52')](_0x5298cb);}})[_0x8297('0x29')](function(_0x528441){if(_0x528441){_0x3d71a5=_0x528441['length'];if(!_0x45863b[_0x8297('0x36')]['hasOwnProperty'](_0x8297('0x3b'))){_0x5298cb['limit']=qs[_0x8297('0x22')](_0x45863b[_0x8297('0x36')][_0x8297('0x22')]);_0x5298cb['offset']=qs[_0x8297('0x21')](_0x45863b[_0x8297('0x36')][_0x8297('0x21')]);}return _0xd76f5c['getFields'](_0x5298cb);}})[_0x8297('0x29')](function(_0x408290){if(_0x408290){return _0x408290?{'count':_0x3d71a5,'rows':_0x408290}:null;}})['then'](respondWithResult(_0x2edf6d,null))[_0x8297('0x47')](handleError(_0x2edf6d,null));};exports['getSubjects']=function(_0x3ecadd,_0x5aa187,_0x5086b5){var _0x16b678={};var _0x6d4ae5={};var _0xecc286;var _0x85bcc;return db[_0x8297('0x31')][_0x8297('0x53')]({'where':{'id':_0x3ecadd[_0x8297('0x49')]['id']}})[_0x8297('0x29')](handleEntityNotFound(_0x5aa187,null))[_0x8297('0x29')](function(_0x528d58){if(_0x528d58){_0xecc286=_0x528d58;_0x6d4ae5[_0x8297('0x35')]=_[_0x8297('0x37')](db[_0x8297('0x50')][_0x8297('0x32')]);_0x6d4ae5[_0x8297('0x36')]=_[_0x8297('0x37')](_0x3ecadd[_0x8297('0x36')]);_0x6d4ae5['filters']=_[_0x8297('0x38')](_0x6d4ae5[_0x8297('0x35')],_0x6d4ae5[_0x8297('0x36')]);_0x16b678[_0x8297('0x3a')]=_[_0x8297('0x38')](_0x6d4ae5[_0x8297('0x35')],qs['fields'](_0x3ecadd[_0x8297('0x36')][_0x8297('0x39')]));_0x16b678['attributes']=_0x16b678[_0x8297('0x3a')]['length']?_0x16b678[_0x8297('0x3a')]:_0x6d4ae5[_0x8297('0x35')];_0x16b678[_0x8297('0x3c')]=qs[_0x8297('0x3d')](_0x3ecadd[_0x8297('0x36')][_0x8297('0x3d')]);_0x16b678['where']=qs[_0x8297('0x3f')](_[_0x8297('0x51')](_0x3ecadd['query'],_0x6d4ae5['filters']));if(_0x3ecadd['query'][_0x8297('0x40')]){_0x16b678[_0x8297('0x3e')]=_[_0x8297('0x41')](_0x16b678[_0x8297('0x3e')],{'$or':_[_0x8297('0x42')](_0x16b678['attributes'],function(_0xba093e){var _0x4340b2={};_0x4340b2[_0xba093e]={'$like':'%'+_0x3ecadd[_0x8297('0x36')][_0x8297('0x40')]+'%'};return _0x4340b2;})});}_0x16b678=_['merge']({},_0x16b678,_0x3ecadd[_0x8297('0x4b')]);return _0xecc286['getSubjects'](_0x16b678);}})[_0x8297('0x29')](function(_0x552e39){if(_0x552e39){_0x85bcc=_0x552e39['length'];if(!_0x3ecadd[_0x8297('0x36')][_0x8297('0x54')](_0x8297('0x3b'))){_0x16b678[_0x8297('0x22')]=qs[_0x8297('0x22')](_0x3ecadd[_0x8297('0x36')][_0x8297('0x22')]);_0x16b678[_0x8297('0x21')]=qs[_0x8297('0x21')](_0x3ecadd[_0x8297('0x36')][_0x8297('0x21')]);}return _0xecc286['getSubjects'](_0x16b678);}})['then'](function(_0x67084b){if(_0x67084b){return _0x67084b?{'count':_0x85bcc,'rows':_0x67084b}:null;}})['then'](respondWithResult(_0x5aa187,null))['catch'](handleError(_0x5aa187,null));};exports[_0x8297('0x55')]=function(_0x3b5309,_0x577854,_0x307f6b){var _0x523772={};var _0x15e27f={};var _0x22e0e8;var _0x955389;return db[_0x8297('0x31')][_0x8297('0x53')]({'where':{'id':_0x3b5309[_0x8297('0x49')]['id']}})[_0x8297('0x29')](handleEntityNotFound(_0x577854,null))[_0x8297('0x29')](function(_0x2019c6){if(_0x2019c6){_0x22e0e8=_0x2019c6;_0x15e27f[_0x8297('0x35')]=_[_0x8297('0x37')](db[_0x8297('0x50')][_0x8297('0x32')]);_0x15e27f[_0x8297('0x36')]=_[_0x8297('0x37')](_0x3b5309[_0x8297('0x36')]);_0x15e27f[_0x8297('0x3f')]=_[_0x8297('0x38')](_0x15e27f[_0x8297('0x35')],_0x15e27f['query']);_0x523772[_0x8297('0x3a')]=_[_0x8297('0x38')](_0x15e27f['model'],qs[_0x8297('0x39')](_0x3b5309[_0x8297('0x36')][_0x8297('0x39')]));_0x523772[_0x8297('0x3a')]=_0x523772[_0x8297('0x3a')][_0x8297('0x4a')]?_0x523772[_0x8297('0x3a')]:_0x15e27f[_0x8297('0x35')];_0x523772[_0x8297('0x3c')]=qs['sort'](_0x3b5309[_0x8297('0x36')][_0x8297('0x3d')]);_0x523772['where']=qs[_0x8297('0x3f')](_['pick'](_0x3b5309[_0x8297('0x36')],_0x15e27f[_0x8297('0x3f')]));if(_0x3b5309['query'][_0x8297('0x40')]){_0x523772[_0x8297('0x3e')]=_[_0x8297('0x41')](_0x523772[_0x8297('0x3e')],{'$or':_[_0x8297('0x42')](_0x523772[_0x8297('0x3a')],function(_0x23742e){var _0x2d3cde={};_0x2d3cde[_0x23742e]={'$like':'%'+_0x3b5309[_0x8297('0x36')][_0x8297('0x40')]+'%'};return _0x2d3cde;})});}_0x523772=_[_0x8297('0x41')]({},_0x523772,_0x3b5309[_0x8297('0x4b')]);return _0x22e0e8[_0x8297('0x55')](_0x523772);}})[_0x8297('0x29')](function(_0x5eebec){if(_0x5eebec){_0x955389=_0x5eebec[_0x8297('0x4a')];if(!_0x3b5309[_0x8297('0x36')][_0x8297('0x54')]('nolimit')){_0x523772['limit']=qs['limit'](_0x3b5309[_0x8297('0x36')][_0x8297('0x22')]);_0x523772[_0x8297('0x21')]=qs[_0x8297('0x21')](_0x3b5309[_0x8297('0x36')][_0x8297('0x21')]);}return _0x22e0e8[_0x8297('0x55')](_0x523772);}})[_0x8297('0x29')](function(_0x3ced15){if(_0x3ced15){return _0x3ced15?{'count':_0x955389,'rows':_0x3ced15}:null;}})[_0x8297('0x29')](respondWithResult(_0x577854,null))[_0x8297('0x47')](handleError(_0x577854,null));}; \ No newline at end of file +var _0x0dab=['lodash','squel','crypto','jsforce','desk.js','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','limit','count','Content-Range','apply','reject','save','update','then','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','pick','filter','merge','VIRTUAL','options','Dynamics365Configuration','findAll','catch','show','params','includeAll','include','find','body','destroy','Dynamics365Field','where','hasOwnProperty','nolimit','getFields','getSubjects','findOne','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x2691ed,_0x113669){var _0x270c2c=function(_0x3751f7){while(--_0x3751f7){_0x2691ed['push'](_0x2691ed['shift']());}};_0x270c2c(++_0x113669);}(_0x0dab,0x1d3));var _0xb0da=function(_0x2121ba,_0x1d824a){_0x2121ba=_0x2121ba-0x0;var _0xeba05b=_0x0dab[_0x2121ba];return _0xeba05b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb0da('0x0'));var zipdir=require(_0xb0da('0x1'));var jsonpatch=require(_0xb0da('0x2'));var rp=require(_0xb0da('0x3'));var moment=require(_0xb0da('0x4'));var BPromise=require(_0xb0da('0x5'));var Mustache=require(_0xb0da('0x6'));var util=require(_0xb0da('0x7'));var path=require(_0xb0da('0x8'));var sox=require(_0xb0da('0x9'));var csv=require(_0xb0da('0xa'));var ejs=require(_0xb0da('0xb'));var fs=require('fs');var fs_extra=require(_0xb0da('0xc'));var _=require(_0xb0da('0xd'));var squel=require(_0xb0da('0xe'));var crypto=require(_0xb0da('0xf'));var jsforce=require(_0xb0da('0x10'));var deskjs=require(_0xb0da('0x11'));var toCsv=require(_0xb0da('0xa'));var querystring=require('querystring');var Papa=require(_0xb0da('0x12'));var Redis=require(_0xb0da('0x13'));var authService=require(_0xb0da('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xb0da('0x15'));var hardwareService=require(_0xb0da('0x16'));var logger=require(_0xb0da('0x17'))(_0xb0da('0x18'));var utils=require(_0xb0da('0x19'));var config=require(_0xb0da('0x1a'));var licenseUtil=require(_0xb0da('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x39e2df,_0x1ccb9a){_0x1ccb9a=_0x1ccb9a||0xcc;return function(_0x49f401){if(_0x49f401){return _0x39e2df[_0xb0da('0x1c')](_0x1ccb9a);}return _0x39e2df[_0xb0da('0x1d')](_0x1ccb9a)['end']();};}function respondWithResult(_0x11279f,_0x20a140){_0x20a140=_0x20a140||0xc8;return function(_0x11b7be){if(_0x11b7be){return _0x11279f[_0xb0da('0x1d')](_0x20a140)[_0xb0da('0x1e')](_0x11b7be);}};}function respondWithFilteredResult(_0x2d18fb,_0x2e8531){return function(_0x18c1df){if(_0x18c1df){var _0xe19c16=typeof _0x2e8531[_0xb0da('0x1f')]==='undefined'&&typeof _0x2e8531[_0xb0da('0x20')]==='undefined';var _0x13d144=_0x18c1df['count'];var _0x370051=_0xe19c16?0x0:_0x2e8531['offset'];var _0x5bbc15=_0xe19c16?_0x18c1df[_0xb0da('0x21')]:_0x2e8531['offset']+_0x2e8531['limit'];var _0x32079c;if(_0x5bbc15>=_0x13d144){_0x5bbc15=_0x13d144;_0x32079c=0xc8;}else{_0x32079c=0xce;}_0x2d18fb[_0xb0da('0x1d')](_0x32079c);return _0x2d18fb['set'](_0xb0da('0x22'),_0x370051+'-'+_0x5bbc15+'/'+_0x13d144)[_0xb0da('0x1e')](_0x18c1df);}return null;};}function patchUpdates(_0x32013f){return function(_0x427c12){try{jsonpatch[_0xb0da('0x23')](_0x427c12,_0x32013f,!![]);}catch(_0x5984f7){return BPromise[_0xb0da('0x24')](_0x5984f7);}return _0x427c12[_0xb0da('0x25')]();};}function saveUpdates(_0x25d4af,_0x58a691){return function(_0x8faeb1){if(_0x8faeb1){return _0x8faeb1[_0xb0da('0x26')](_0x25d4af)['then'](function(_0x4c2fd2){return _0x4c2fd2;});}return null;};}function removeEntity(_0x19add9,_0x44d62b){return function(_0x8e862b){if(_0x8e862b){return _0x8e862b['destroy']()[_0xb0da('0x27')](function(){_0x19add9[_0xb0da('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4292e7,_0x57df9d){return function(_0x3faea9){if(!_0x3faea9){_0x4292e7[_0xb0da('0x1c')](0x194);}return _0x3faea9;};}function handleError(_0x2c363a,_0x5d341f){_0x5d341f=_0x5d341f||0x1f4;return function(_0x1ebf03){logger['error'](_0x1ebf03['stack']);if(_0x1ebf03[_0xb0da('0x28')]){delete _0x1ebf03[_0xb0da('0x28')];}_0x2c363a[_0xb0da('0x1d')](_0x5d341f)['send'](_0x1ebf03);};}exports[_0xb0da('0x29')]=function(_0x503250,_0x5940a4){var _0xdebf13={},_0x5f81ce={},_0x131b93={'count':0x0,'rows':[]};var _0xc6e580=_[_0xb0da('0x2a')](db['Dynamics365Configuration'][_0xb0da('0x2b')],function(_0x15b672){return{'name':_0x15b672[_0xb0da('0x2c')],'type':_0x15b672[_0xb0da('0x2d')][_0xb0da('0x2e')]};});_0x5f81ce[_0xb0da('0x2f')]=_['map'](_0xc6e580,_0xb0da('0x28'));_0x5f81ce[_0xb0da('0x30')]=_[_0xb0da('0x31')](_0x503250['query']);_0x5f81ce[_0xb0da('0x32')]=_[_0xb0da('0x33')](_0x5f81ce[_0xb0da('0x2f')],_0x5f81ce[_0xb0da('0x30')]);_0xdebf13[_0xb0da('0x34')]=_['intersection'](_0x5f81ce[_0xb0da('0x2f')],qs[_0xb0da('0x35')](_0x503250['query']['fields']));_0xdebf13[_0xb0da('0x34')]=_0xdebf13[_0xb0da('0x34')][_0xb0da('0x36')]?_0xdebf13[_0xb0da('0x34')]:_0x5f81ce[_0xb0da('0x2f')];if(!_0x503250[_0xb0da('0x30')]['hasOwnProperty']('nolimit')){_0xdebf13[_0xb0da('0x20')]=qs['limit'](_0x503250[_0xb0da('0x30')][_0xb0da('0x20')]);_0xdebf13[_0xb0da('0x1f')]=qs['offset'](_0x503250[_0xb0da('0x30')]['offset']);}_0xdebf13[_0xb0da('0x37')]=qs[_0xb0da('0x38')](_0x503250[_0xb0da('0x30')][_0xb0da('0x38')]);_0xdebf13['where']=qs['filters'](_[_0xb0da('0x39')](_0x503250['query'],_0x5f81ce[_0xb0da('0x32')]),_0xc6e580);if(_0x503250[_0xb0da('0x30')][_0xb0da('0x3a')]){_0xdebf13['where']=_[_0xb0da('0x3b')](_0xdebf13['where'],{'$or':_['map'](_0xc6e580,function(_0x1846fb){if(_0x1846fb[_0xb0da('0x2d')]!==_0xb0da('0x3c')){var _0x346912={};_0x346912[_0x1846fb[_0xb0da('0x28')]]={'$like':'%'+_0x503250[_0xb0da('0x30')]['filter']+'%'};return _0x346912;}})});}_0xdebf13=_[_0xb0da('0x3b')]({},_0xdebf13,_0x503250[_0xb0da('0x3d')]);var _0x5ed7f9={'where':_0xdebf13['where']};return db[_0xb0da('0x3e')][_0xb0da('0x21')](_0x5ed7f9)[_0xb0da('0x27')](function(_0x1c747f){_0x131b93[_0xb0da('0x21')]=_0x1c747f;if(_0x503250[_0xb0da('0x30')]['includeAll']){_0xdebf13['include']=[{'all':!![]}];}return db[_0xb0da('0x3e')][_0xb0da('0x3f')](_0xdebf13);})[_0xb0da('0x27')](function(_0x3cabfa){_0x131b93['rows']=_0x3cabfa;return _0x131b93;})['then'](respondWithFilteredResult(_0x5940a4,_0xdebf13))[_0xb0da('0x40')](handleError(_0x5940a4,null));};exports[_0xb0da('0x41')]=function(_0x4fb08e,_0x3b0c75){var _0x57b056={'raw':![],'where':{'id':_0x4fb08e[_0xb0da('0x42')]['id']}},_0x384473={};_0x384473[_0xb0da('0x2f')]=_[_0xb0da('0x31')](db[_0xb0da('0x3e')][_0xb0da('0x2b')]);_0x384473['query']=_[_0xb0da('0x31')](_0x4fb08e[_0xb0da('0x30')]);_0x384473['filters']=_[_0xb0da('0x33')](_0x384473['model'],_0x384473[_0xb0da('0x30')]);_0x57b056[_0xb0da('0x34')]=_[_0xb0da('0x33')](_0x384473[_0xb0da('0x2f')],qs[_0xb0da('0x35')](_0x4fb08e[_0xb0da('0x30')][_0xb0da('0x35')]));_0x57b056[_0xb0da('0x34')]=_0x57b056[_0xb0da('0x34')][_0xb0da('0x36')]?_0x57b056[_0xb0da('0x34')]:_0x384473[_0xb0da('0x2f')];if(_0x4fb08e[_0xb0da('0x30')][_0xb0da('0x43')]){_0x57b056[_0xb0da('0x44')]=[{'all':!![]}];}_0x57b056=_[_0xb0da('0x3b')]({},_0x57b056,_0x4fb08e[_0xb0da('0x3d')]);return db[_0xb0da('0x3e')][_0xb0da('0x45')](_0x57b056)[_0xb0da('0x27')](handleEntityNotFound(_0x3b0c75,null))[_0xb0da('0x27')](respondWithResult(_0x3b0c75,null))[_0xb0da('0x40')](handleError(_0x3b0c75,null));};exports['create']=function(_0x35149e,_0x3191c9){return db[_0xb0da('0x3e')]['create'](_0x35149e[_0xb0da('0x46')],{})[_0xb0da('0x27')](respondWithResult(_0x3191c9,0xc9))[_0xb0da('0x40')](handleError(_0x3191c9,null));};exports['update']=function(_0x2377ec,_0x4f4616){if(_0x2377ec[_0xb0da('0x46')]['id']){delete _0x2377ec[_0xb0da('0x46')]['id'];}return db[_0xb0da('0x3e')][_0xb0da('0x45')]({'where':{'id':_0x2377ec[_0xb0da('0x42')]['id']}})[_0xb0da('0x27')](handleEntityNotFound(_0x4f4616,null))[_0xb0da('0x27')](saveUpdates(_0x2377ec[_0xb0da('0x46')],null))[_0xb0da('0x27')](respondWithResult(_0x4f4616,null))['catch'](handleError(_0x4f4616,null));};exports[_0xb0da('0x47')]=function(_0x2a0cda,_0x2fa09e){return db[_0xb0da('0x3e')][_0xb0da('0x45')]({'where':{'id':_0x2a0cda[_0xb0da('0x42')]['id']}})[_0xb0da('0x27')](handleEntityNotFound(_0x2fa09e,null))[_0xb0da('0x27')](removeEntity(_0x2fa09e,null))['catch'](handleError(_0x2fa09e,null));};exports['getFields']=function(_0x13f0b3,_0x548fb4,_0x197760){var _0x204c8f={};var _0x44380c={};var _0x47a4b3;var _0x22d766;return db['Dynamics365Configuration']['findOne']({'where':{'id':_0x13f0b3[_0xb0da('0x42')]['id']}})[_0xb0da('0x27')](handleEntityNotFound(_0x548fb4,null))[_0xb0da('0x27')](function(_0x2bb83c){if(_0x2bb83c){_0x47a4b3=_0x2bb83c;_0x44380c['model']=_[_0xb0da('0x31')](db[_0xb0da('0x48')][_0xb0da('0x2b')]);_0x44380c[_0xb0da('0x30')]=_[_0xb0da('0x31')](_0x13f0b3[_0xb0da('0x30')]);_0x44380c[_0xb0da('0x32')]=_['intersection'](_0x44380c['model'],_0x44380c['query']);_0x204c8f[_0xb0da('0x34')]=_[_0xb0da('0x33')](_0x44380c[_0xb0da('0x2f')],qs[_0xb0da('0x35')](_0x13f0b3[_0xb0da('0x30')][_0xb0da('0x35')]));_0x204c8f['attributes']=_0x204c8f[_0xb0da('0x34')][_0xb0da('0x36')]?_0x204c8f['attributes']:_0x44380c[_0xb0da('0x2f')];_0x204c8f['order']=qs[_0xb0da('0x38')](_0x13f0b3[_0xb0da('0x30')][_0xb0da('0x38')]);_0x204c8f[_0xb0da('0x49')]=qs[_0xb0da('0x32')](_[_0xb0da('0x39')](_0x13f0b3[_0xb0da('0x30')],_0x44380c[_0xb0da('0x32')]));if(_0x13f0b3[_0xb0da('0x30')][_0xb0da('0x3a')]){_0x204c8f[_0xb0da('0x49')]=_[_0xb0da('0x3b')](_0x204c8f[_0xb0da('0x49')],{'$or':_[_0xb0da('0x2a')](_0x204c8f['attributes'],function(_0x51f518){var _0x5023bf={};_0x5023bf[_0x51f518]={'$like':'%'+_0x13f0b3[_0xb0da('0x30')][_0xb0da('0x3a')]+'%'};return _0x5023bf;})});}_0x204c8f=_[_0xb0da('0x3b')]({},_0x204c8f,_0x13f0b3[_0xb0da('0x3d')]);return _0x47a4b3['getFields'](_0x204c8f);}})[_0xb0da('0x27')](function(_0x4c23ac){if(_0x4c23ac){_0x22d766=_0x4c23ac[_0xb0da('0x36')];if(!_0x13f0b3[_0xb0da('0x30')][_0xb0da('0x4a')](_0xb0da('0x4b'))){_0x204c8f[_0xb0da('0x20')]=qs[_0xb0da('0x20')](_0x13f0b3['query'][_0xb0da('0x20')]);_0x204c8f[_0xb0da('0x1f')]=qs[_0xb0da('0x1f')](_0x13f0b3[_0xb0da('0x30')][_0xb0da('0x1f')]);}return _0x47a4b3[_0xb0da('0x4c')](_0x204c8f);}})[_0xb0da('0x27')](function(_0x5afc57){if(_0x5afc57){return _0x5afc57?{'count':_0x22d766,'rows':_0x5afc57}:null;}})[_0xb0da('0x27')](respondWithResult(_0x548fb4,null))['catch'](handleError(_0x548fb4,null));};exports[_0xb0da('0x4d')]=function(_0xeda856,_0x141b87,_0x4b3e33){var _0x417e14={};var _0x163317={};var _0x2058dc;var _0x5dc4de;return db[_0xb0da('0x3e')][_0xb0da('0x4e')]({'where':{'id':_0xeda856[_0xb0da('0x42')]['id']}})[_0xb0da('0x27')](handleEntityNotFound(_0x141b87,null))['then'](function(_0x3212fb){if(_0x3212fb){_0x2058dc=_0x3212fb;_0x163317[_0xb0da('0x2f')]=_['keys'](db[_0xb0da('0x48')]['rawAttributes']);_0x163317['query']=_[_0xb0da('0x31')](_0xeda856[_0xb0da('0x30')]);_0x163317[_0xb0da('0x32')]=_[_0xb0da('0x33')](_0x163317[_0xb0da('0x2f')],_0x163317[_0xb0da('0x30')]);_0x417e14[_0xb0da('0x34')]=_['intersection'](_0x163317[_0xb0da('0x2f')],qs[_0xb0da('0x35')](_0xeda856[_0xb0da('0x30')]['fields']));_0x417e14[_0xb0da('0x34')]=_0x417e14[_0xb0da('0x34')][_0xb0da('0x36')]?_0x417e14[_0xb0da('0x34')]:_0x163317['model'];_0x417e14[_0xb0da('0x37')]=qs[_0xb0da('0x38')](_0xeda856[_0xb0da('0x30')][_0xb0da('0x38')]);_0x417e14['where']=qs[_0xb0da('0x32')](_['pick'](_0xeda856['query'],_0x163317[_0xb0da('0x32')]));if(_0xeda856['query'][_0xb0da('0x3a')]){_0x417e14[_0xb0da('0x49')]=_['merge'](_0x417e14[_0xb0da('0x49')],{'$or':_[_0xb0da('0x2a')](_0x417e14['attributes'],function(_0x32ef6d){var _0x2995c7={};_0x2995c7[_0x32ef6d]={'$like':'%'+_0xeda856['query']['filter']+'%'};return _0x2995c7;})});}_0x417e14=_[_0xb0da('0x3b')]({},_0x417e14,_0xeda856['options']);return _0x2058dc[_0xb0da('0x4d')](_0x417e14);}})[_0xb0da('0x27')](function(_0x4e5dff){if(_0x4e5dff){_0x5dc4de=_0x4e5dff[_0xb0da('0x36')];if(!_0xeda856['query']['hasOwnProperty']('nolimit')){_0x417e14[_0xb0da('0x20')]=qs[_0xb0da('0x20')](_0xeda856[_0xb0da('0x30')][_0xb0da('0x20')]);_0x417e14[_0xb0da('0x1f')]=qs[_0xb0da('0x1f')](_0xeda856[_0xb0da('0x30')][_0xb0da('0x1f')]);}return _0x2058dc[_0xb0da('0x4d')](_0x417e14);}})[_0xb0da('0x27')](function(_0x56301b){if(_0x56301b){return _0x56301b?{'count':_0x5dc4de,'rows':_0x56301b}:null;}})[_0xb0da('0x27')](respondWithResult(_0x141b87,null))[_0xb0da('0x40')](handleError(_0x141b87,null));};exports[_0xb0da('0x4f')]=function(_0x45fee5,_0x5b1baa,_0x52994e){var _0x5c87e9={};var _0xa7486a={};var _0x38c477;var _0x8e7933;return db['Dynamics365Configuration'][_0xb0da('0x4e')]({'where':{'id':_0x45fee5[_0xb0da('0x42')]['id']}})[_0xb0da('0x27')](handleEntityNotFound(_0x5b1baa,null))['then'](function(_0x106a9a){if(_0x106a9a){_0x38c477=_0x106a9a;_0xa7486a[_0xb0da('0x2f')]=_['keys'](db[_0xb0da('0x48')][_0xb0da('0x2b')]);_0xa7486a['query']=_[_0xb0da('0x31')](_0x45fee5[_0xb0da('0x30')]);_0xa7486a[_0xb0da('0x32')]=_[_0xb0da('0x33')](_0xa7486a['model'],_0xa7486a['query']);_0x5c87e9['attributes']=_['intersection'](_0xa7486a[_0xb0da('0x2f')],qs[_0xb0da('0x35')](_0x45fee5['query'][_0xb0da('0x35')]));_0x5c87e9[_0xb0da('0x34')]=_0x5c87e9[_0xb0da('0x34')][_0xb0da('0x36')]?_0x5c87e9[_0xb0da('0x34')]:_0xa7486a['model'];_0x5c87e9['order']=qs[_0xb0da('0x38')](_0x45fee5[_0xb0da('0x30')][_0xb0da('0x38')]);_0x5c87e9[_0xb0da('0x49')]=qs[_0xb0da('0x32')](_[_0xb0da('0x39')](_0x45fee5[_0xb0da('0x30')],_0xa7486a[_0xb0da('0x32')]));if(_0x45fee5[_0xb0da('0x30')]['filter']){_0x5c87e9[_0xb0da('0x49')]=_[_0xb0da('0x3b')](_0x5c87e9['where'],{'$or':_['map'](_0x5c87e9['attributes'],function(_0x41c16a){var _0x3f432e={};_0x3f432e[_0x41c16a]={'$like':'%'+_0x45fee5[_0xb0da('0x30')][_0xb0da('0x3a')]+'%'};return _0x3f432e;})});}_0x5c87e9=_[_0xb0da('0x3b')]({},_0x5c87e9,_0x45fee5[_0xb0da('0x3d')]);return _0x38c477[_0xb0da('0x4f')](_0x5c87e9);}})[_0xb0da('0x27')](function(_0x66c9e){if(_0x66c9e){_0x8e7933=_0x66c9e[_0xb0da('0x36')];if(!_0x45fee5[_0xb0da('0x30')][_0xb0da('0x4a')](_0xb0da('0x4b'))){_0x5c87e9[_0xb0da('0x20')]=qs['limit'](_0x45fee5[_0xb0da('0x30')]['limit']);_0x5c87e9['offset']=qs[_0xb0da('0x1f')](_0x45fee5[_0xb0da('0x30')][_0xb0da('0x1f')]);}return _0x38c477['getDescriptions'](_0x5c87e9);}})[_0xb0da('0x27')](function(_0x58e628){if(_0x58e628){return _0x58e628?{'count':_0x8e7933,'rows':_0x58e628}:null;}})[_0xb0da('0x27')](respondWithResult(_0x5b1baa,null))[_0xb0da('0x40')](handleError(_0x5b1baa,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 8baa8b6..38907e3 100644 --- a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js +++ b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf3cd=['path','rimraf','../../config/environment','exports','define','Dynamics365Configuration','int_dynamics365_configurations','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x5755d2,_0x5a33c4){var _0x4d3de6=function(_0x4e454d){while(--_0x4e454d){_0x5755d2['push'](_0x5755d2['shift']());}};_0x4d3de6(++_0x5a33c4);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x59dccc,_0x184c1c){_0x59dccc=_0x59dccc-0x0;var _0xc97bcb=_0xf3cd[_0x59dccc];return _0xc97bcb;};'use strict';var _=require(_0xdf3c('0x0'));var util=require(_0xdf3c('0x1'));var logger=require(_0xdf3c('0x2'))(_0xdf3c('0x3'));var moment=require(_0xdf3c('0x4'));var BPromise=require(_0xdf3c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdf3c('0x6'));var rimraf=require(_0xdf3c('0x7'));var config=require(_0xdf3c('0x8'));var attributes=require('./intDynamics365Configuration.attributes');module[_0xdf3c('0x9')]=function(_0x17d42a,_0x1313d5){return _0x17d42a[_0xdf3c('0xa')](_0xdf3c('0xb'),attributes,{'tableName':_0xdf3c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9f62=['api','moment','bluebird','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','int_dynamics365_configurations','util'];(function(_0x2dc8e8,_0x4a85e6){var _0x485a38=function(_0x562d41){while(--_0x562d41){_0x2dc8e8['push'](_0x2dc8e8['shift']());}};_0x485a38(++_0x4a85e6);}(_0x9f62,0x154));var _0x29f6=function(_0x52855b,_0x1590a1){_0x52855b=_0x52855b-0x0;var _0xde3ba8=_0x9f62[_0x52855b];return _0xde3ba8;};'use strict';var _=require('lodash');var util=require(_0x29f6('0x0'));var logger=require('../../config/logger')(_0x29f6('0x1'));var moment=require(_0x29f6('0x2'));var BPromise=require(_0x29f6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x29f6('0x4'));var config=require(_0x29f6('0x5'));var attributes=require(_0x29f6('0x6'));module[_0x29f6('0x7')]=function(_0x595034,_0xf66137){return _0x595034[_0x29f6('0x8')](_0x29f6('0x9'),attributes,{'tableName':_0x29f6('0xa'),'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 dbc9463..504cc22 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 _0xbbdc=['ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird'];(function(_0x8de54f,_0x271987){var _0x14cba4=function(_0x58ed41){while(--_0x58ed41){_0x8de54f['push'](_0x8de54f['shift']());}};_0x14cba4(++_0x271987);}(_0xbbdc,0x81));var _0xcbbd=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xbbdc[_0x4e676e];return _0x336a3c;};'use strict';var _=require(_0xcbbd('0x0'));var util=require(_0xcbbd('0x1'));var moment=require('moment');var BPromise=require(_0xcbbd('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcbbd('0x3'));var db=require(_0xcbbd('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xcbbd('0x5'));var jayson=require(_0xcbbd('0x6'));var client=jayson[_0xcbbd('0x7')][_0xcbbd('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1c66b7,_0x41b39b,_0x5a1eef){return new BPromise(function(_0x44206d,_0x3e0bd0){return client[_0xcbbd('0x9')](_0x1c66b7,_0x5a1eef)[_0xcbbd('0xa')](function(_0x52f262){logger[_0xcbbd('0xb')](_0xcbbd('0xc'),_0x41b39b,_0xcbbd('0xd'));logger[_0xcbbd('0xe')](_0xcbbd('0xf'),_0x41b39b,_0xcbbd('0xd'),JSON[_0xcbbd('0x10')](_0x52f262));if(_0x52f262[_0xcbbd('0x11')]){if(_0x52f262[_0xcbbd('0x11')][_0xcbbd('0x12')]===0x1f4){logger[_0xcbbd('0x11')](_0xcbbd('0xc'),_0x41b39b,_0x52f262['error']['message']);return _0x3e0bd0(_0x52f262['error'][_0xcbbd('0x13')]);}logger[_0xcbbd('0x11')](_0xcbbd('0xc'),_0x41b39b,_0x52f262[_0xcbbd('0x11')]['message']);return _0x44206d(_0x52f262['error']['message']);}else{logger[_0xcbbd('0xb')]('Dynamics365Configuration,\x20%s,\x20%s',_0x41b39b,_0xcbbd('0xd'));_0x44206d(_0x52f262[_0xcbbd('0x14')][_0xcbbd('0x13')]);}})[_0xcbbd('0x15')](function(_0xbd88f6){logger[_0xcbbd('0x11')](_0xcbbd('0xc'),_0x41b39b,_0xbd88f6);_0x3e0bd0(_0xbd88f6);});});} \ No newline at end of file +var _0x8080=['http','then','Dynamics365Configuration,\x20%s,\x20%s','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x4dbba7,_0x34d6d1){var _0x43ef83=function(_0x27acf1){while(--_0x27acf1){_0x4dbba7['push'](_0x4dbba7['shift']());}};_0x43ef83(++_0x34d6d1);}(_0x8080,0x140));var _0x0808=function(_0x2abffd,_0x760487){_0x2abffd=_0x2abffd-0x0;var _0xe147d4=_0x8080[_0x2abffd];return _0xe147d4;};'use strict';var _=require(_0x0808('0x0'));var util=require(_0x0808('0x1'));var moment=require('moment');var BPromise=require(_0x0808('0x2'));var rs=require(_0x0808('0x3'));var fs=require('fs');var Redis=require(_0x0808('0x4'));var db=require(_0x0808('0x5'))['db'];var utils=require(_0x0808('0x6'));var logger=require('../../config/logger')(_0x0808('0x7'));var config=require(_0x0808('0x8'));var jayson=require(_0x0808('0x9'));var client=jayson['client'][_0x0808('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b75f8,_0x41864f,_0x438d55){return new BPromise(function(_0x4d6b20,_0x1f9433){return client['request'](_0x4b75f8,_0x438d55)[_0x0808('0xb')](function(_0xdc8582){logger['info'](_0x0808('0xc'),_0x41864f,'request\x20sent');logger[_0x0808('0xd')](_0x0808('0xe'),_0x41864f,_0x0808('0xf'),JSON[_0x0808('0x10')](_0xdc8582));if(_0xdc8582['error']){if(_0xdc8582[_0x0808('0x11')][_0x0808('0x12')]===0x1f4){logger[_0x0808('0x11')](_0x0808('0xc'),_0x41864f,_0xdc8582[_0x0808('0x11')]['message']);return _0x1f9433(_0xdc8582['error']['message']);}logger[_0x0808('0x11')](_0x0808('0xc'),_0x41864f,_0xdc8582[_0x0808('0x11')][_0x0808('0x13')]);return _0x4d6b20(_0xdc8582[_0x0808('0x11')][_0x0808('0x13')]);}else{logger[_0x0808('0x14')](_0x0808('0xc'),_0x41864f,_0x0808('0xf'));_0x4d6b20(_0xdc8582['result'][_0x0808('0x13')]);}})[_0x0808('0x15')](function(_0x352699){logger[_0x0808('0x11')]('Dynamics365Configuration,\x20%s,\x20%s',_0x41864f,_0x352699);_0x1f9433(_0x352699);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 7a1e380..90d885a 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 _0xc9ae=['destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','/:id','show','create','update','delete'];(function(_0x3fb9dd,_0x174fff){var _0x20136a=function(_0x480081){while(--_0x480081){_0x3fb9dd['push'](_0x3fb9dd['shift']());}};_0x20136a(++_0x174fff);}(_0xc9ae,0xf2));var _0xec9a=function(_0x2e3fb6,_0x587302){_0x2e3fb6=_0x2e3fb6-0x0;var _0x5cea59=_0xc9ae[_0x2e3fb6];return _0x5cea59;};'use strict';var multer=require(_0xec9a('0x0'));var util=require('util');var path=require(_0xec9a('0x1'));var timeout=require(_0xec9a('0x2'));var express=require(_0xec9a('0x3'));var router=express[_0xec9a('0x4')]();var fs_extra=require(_0xec9a('0x5'));var auth=require(_0xec9a('0x6'));var interaction=require(_0xec9a('0x7'));var config=require(_0xec9a('0x8'));var controller=require(_0xec9a('0x9'));router[_0xec9a('0xa')]('/',auth[_0xec9a('0xb')](),controller[_0xec9a('0xc')]);router['get'](_0xec9a('0xd'),auth[_0xec9a('0xb')](),controller[_0xec9a('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xec9a('0xf')]);router['put'](_0xec9a('0xd'),auth[_0xec9a('0xb')](),controller[_0xec9a('0x10')]);router[_0xec9a('0x11')](_0xec9a('0xd'),auth[_0xec9a('0xb')](),controller[_0xec9a('0x12')]);module[_0xec9a('0x13')]=router; \ No newline at end of file +var _0x08d7=['util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDynamics365Field.controller','get','isAuthenticated','/:id','show','post','create','update','delete','exports'];(function(_0x7aff0,_0x544e58){var _0x2bd5bd=function(_0x1f4913){while(--_0x1f4913){_0x7aff0['push'](_0x7aff0['shift']());}};_0x2bd5bd(++_0x544e58);}(_0x08d7,0xc0));var _0x708d=function(_0x26cc1c,_0x4f6b44){_0x26cc1c=_0x26cc1c-0x0;var _0x23d79c=_0x08d7[_0x26cc1c];return _0x23d79c;};'use strict';var multer=require('multer');var util=require(_0x708d('0x0'));var path=require('path');var timeout=require(_0x708d('0x1'));var express=require('express');var router=express[_0x708d('0x2')]();var fs_extra=require(_0x708d('0x3'));var auth=require(_0x708d('0x4'));var interaction=require(_0x708d('0x5'));var config=require('../../config/environment');var controller=require(_0x708d('0x6'));router[_0x708d('0x7')]('/',auth[_0x708d('0x8')](),controller['index']);router['get'](_0x708d('0x9'),auth[_0x708d('0x8')](),controller[_0x708d('0xa')]);router[_0x708d('0xb')]('/',auth[_0x708d('0x8')](),controller[_0x708d('0xc')]);router['put']('/:id',auth[_0x708d('0x8')](),controller[_0x708d('0xd')]);router[_0x708d('0xe')](_0x708d('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x708d('0xf')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 884974c..b526a7b 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 _0xc7fa=['customVariable','picklist','string','STRING','ENUM','variable','BOOLEAN','sequelize','exports'];(function(_0x2794e4,_0x11bcf6){var _0xf860d4=function(_0x1ef56e){while(--_0x1ef56e){_0x2794e4['push'](_0x2794e4['shift']());}};_0xf860d4(++_0x11bcf6);}(_0xc7fa,0xcd));var _0xac7f=function(_0x2ec8b0,_0x112dc9){_0x2ec8b0=_0x2ec8b0-0x0;var _0x207302=_0xc7fa[_0x2ec8b0];return _0x207302;};'use strict';var Sequelize=require(_0xac7f('0x0'));module[_0xac7f('0x1')]={'type':{'type':Sequelize['ENUM']('string','variable',_0xac7f('0x2'),'keyValue',_0xac7f('0x3')),'defaultValue':_0xac7f('0x4')},'content':{'type':Sequelize[_0xac7f('0x5')]},'key':{'type':Sequelize[_0xac7f('0x5')]},'keyType':{'type':Sequelize[_0xac7f('0x6')](_0xac7f('0x4'),_0xac7f('0x7'),_0xac7f('0x2'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xac7f('0x5')]},'nameField':{'type':Sequelize[_0xac7f('0x5')]},'customField':{'type':Sequelize[_0xac7f('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xac7f('0x5')]}}; \ No newline at end of file +var _0xf230=['customVariable','picklist','STRING','string','BOOLEAN','sequelize','exports','ENUM','variable'];(function(_0x80ae2b,_0x3033d6){var _0x372937=function(_0x288831){while(--_0x288831){_0x80ae2b['push'](_0x80ae2b['shift']());}};_0x372937(++_0x3033d6);}(_0xf230,0x149));var _0x0f23=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xf230[_0x3ab51d];return _0x29a04e;};'use strict';var Sequelize=require(_0x0f23('0x0'));module[_0x0f23('0x1')]={'type':{'type':Sequelize[_0x0f23('0x2')]('string',_0x0f23('0x3'),_0x0f23('0x4'),'keyValue',_0x0f23('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x0f23('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x0f23('0x2')](_0x0f23('0x7'),_0x0f23('0x3'),_0x0f23('0x4'))},'keyContent':{'type':Sequelize[_0x0f23('0x6')]},'idField':{'type':Sequelize[_0x0f23('0x6')]},'nameField':{'type':Sequelize[_0x0f23('0x6')]},'customField':{'type':Sequelize[_0x0f23('0x8')],'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 c7e634e..bc76bc6 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 _0x644a=['send','index','map','rawAttributes','type','model','keys','query','filters','intersection','attributes','length','order','sort','where','filter','merge','VIRTUAL','options','Dynamics365Field','includeAll','include','findAll','rows','show','params','fields','catch','create','body','find','eml-format','rimraf','zip-dir','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','json','apply','save','update','then','destroy','error','stack','name'];(function(_0x1fb86d,_0xc5978a){var _0x3f7334=function(_0x4b74b9){while(--_0x4b74b9){_0x1fb86d['push'](_0x1fb86d['shift']());}};_0x3f7334(++_0xc5978a);}(_0x644a,0xfa));var _0xa644=function(_0xcb537a,_0x15ca9b){_0xcb537a=_0xcb537a-0x0;var _0x5dcba0=_0x644a[_0xcb537a];return _0x5dcba0;};'use strict';var emlformat=require(_0xa644('0x0'));var rimraf=require(_0xa644('0x1'));var zipdir=require(_0xa644('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa644('0x3'));var moment=require(_0xa644('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa644('0x5'));var path=require(_0xa644('0x6'));var sox=require(_0xa644('0x7'));var csv=require(_0xa644('0x8'));var ejs=require(_0xa644('0x9'));var fs=require('fs');var fs_extra=require(_0xa644('0xa'));var _=require(_0xa644('0xb'));var squel=require(_0xa644('0xc'));var crypto=require('crypto');var jsforce=require(_0xa644('0xd'));var deskjs=require(_0xa644('0xe'));var toCsv=require('to-csv');var querystring=require(_0xa644('0xf'));var Papa=require(_0xa644('0x10'));var Redis=require(_0xa644('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xa644('0x12'));var as=require(_0xa644('0x13'));var hardwareService=require(_0xa644('0x14'));var logger=require(_0xa644('0x15'))(_0xa644('0x16'));var utils=require(_0xa644('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xa644('0x18'));var db=require(_0xa644('0x19'))['db'];function respondWithStatusCode(_0xebda80,_0x250fd3){_0x250fd3=_0x250fd3||0xcc;return function(_0x3ba2a1){if(_0x3ba2a1){return _0xebda80[_0xa644('0x1a')](_0x250fd3);}return _0xebda80['status'](_0x250fd3)[_0xa644('0x1b')]();};}function respondWithResult(_0x466df7,_0x16307a){_0x16307a=_0x16307a||0xc8;return function(_0x3a29ef){if(_0x3a29ef){return _0x466df7[_0xa644('0x1c')](_0x16307a)['json'](_0x3a29ef);}};}function respondWithFilteredResult(_0x43dad0,_0x882196){return function(_0x4049d6){if(_0x4049d6){var _0x3d5c24=typeof _0x882196[_0xa644('0x1d')]===_0xa644('0x1e')&&typeof _0x882196[_0xa644('0x1f')]===_0xa644('0x1e');var _0x533269=_0x4049d6[_0xa644('0x20')];var _0x4710db=_0x3d5c24?0x0:_0x882196[_0xa644('0x1d')];var _0x5b1db9=_0x3d5c24?_0x4049d6['count']:_0x882196['offset']+_0x882196[_0xa644('0x1f')];var _0x87c9aa;if(_0x5b1db9>=_0x533269){_0x5b1db9=_0x533269;_0x87c9aa=0xc8;}else{_0x87c9aa=0xce;}_0x43dad0[_0xa644('0x1c')](_0x87c9aa);return _0x43dad0['set']('Content-Range',_0x4710db+'-'+_0x5b1db9+'/'+_0x533269)[_0xa644('0x21')](_0x4049d6);}return null;};}function patchUpdates(_0x2564da){return function(_0x47b944){try{jsonpatch[_0xa644('0x22')](_0x47b944,_0x2564da,!![]);}catch(_0x406813){return BPromise['reject'](_0x406813);}return _0x47b944[_0xa644('0x23')]();};}function saveUpdates(_0x115a1e,_0x2ec514){return function(_0x280802){if(_0x280802){return _0x280802[_0xa644('0x24')](_0x115a1e)[_0xa644('0x25')](function(_0x51159d){return _0x51159d;});}return null;};}function removeEntity(_0x1d2752,_0x3e6858){return function(_0xd6c5b){if(_0xd6c5b){return _0xd6c5b[_0xa644('0x26')]()[_0xa644('0x25')](function(){_0x1d2752['status'](0xcc)[_0xa644('0x1b')]();});}};}function handleEntityNotFound(_0x32d71d,_0x23d67c){return function(_0x34ff82){if(!_0x34ff82){_0x32d71d[_0xa644('0x1a')](0x194);}return _0x34ff82;};}function handleError(_0x24f7dc,_0x4c7b61){_0x4c7b61=_0x4c7b61||0x1f4;return function(_0x57886a){logger[_0xa644('0x27')](_0x57886a[_0xa644('0x28')]);if(_0x57886a[_0xa644('0x29')]){delete _0x57886a['name'];}_0x24f7dc[_0xa644('0x1c')](_0x4c7b61)[_0xa644('0x2a')](_0x57886a);};}exports[_0xa644('0x2b')]=function(_0x32e039,_0x14cdf9){var _0x2ad71a={},_0x1dfc81={},_0x291676={'count':0x0,'rows':[]};var _0x5ef7e0=_[_0xa644('0x2c')](db['Dynamics365Field'][_0xa644('0x2d')],function(_0x369dab){return{'name':_0x369dab['fieldName'],'type':_0x369dab[_0xa644('0x2e')]['key']};});_0x1dfc81[_0xa644('0x2f')]=_['map'](_0x5ef7e0,_0xa644('0x29'));_0x1dfc81['query']=_[_0xa644('0x30')](_0x32e039[_0xa644('0x31')]);_0x1dfc81[_0xa644('0x32')]=_[_0xa644('0x33')](_0x1dfc81[_0xa644('0x2f')],_0x1dfc81[_0xa644('0x31')]);_0x2ad71a[_0xa644('0x34')]=_[_0xa644('0x33')](_0x1dfc81[_0xa644('0x2f')],qs['fields'](_0x32e039[_0xa644('0x31')]['fields']));_0x2ad71a['attributes']=_0x2ad71a['attributes'][_0xa644('0x35')]?_0x2ad71a[_0xa644('0x34')]:_0x1dfc81[_0xa644('0x2f')];if(!_0x32e039[_0xa644('0x31')]['hasOwnProperty']('nolimit')){_0x2ad71a[_0xa644('0x1f')]=qs['limit'](_0x32e039['query']['limit']);_0x2ad71a[_0xa644('0x1d')]=qs[_0xa644('0x1d')](_0x32e039[_0xa644('0x31')]['offset']);}_0x2ad71a[_0xa644('0x36')]=qs['sort'](_0x32e039[_0xa644('0x31')][_0xa644('0x37')]);_0x2ad71a[_0xa644('0x38')]=qs[_0xa644('0x32')](_['pick'](_0x32e039['query'],_0x1dfc81[_0xa644('0x32')]),_0x5ef7e0);if(_0x32e039[_0xa644('0x31')][_0xa644('0x39')]){_0x2ad71a[_0xa644('0x38')]=_[_0xa644('0x3a')](_0x2ad71a[_0xa644('0x38')],{'$or':_['map'](_0x5ef7e0,function(_0xbd88dd){if(_0xbd88dd['type']!==_0xa644('0x3b')){var _0xacdb0f={};_0xacdb0f[_0xbd88dd['name']]={'$like':'%'+_0x32e039['query']['filter']+'%'};return _0xacdb0f;}})});}_0x2ad71a=_[_0xa644('0x3a')]({},_0x2ad71a,_0x32e039[_0xa644('0x3c')]);var _0x27e83a={'where':_0x2ad71a['where']};return db[_0xa644('0x3d')][_0xa644('0x20')](_0x27e83a)['then'](function(_0x131a85){_0x291676[_0xa644('0x20')]=_0x131a85;if(_0x32e039[_0xa644('0x31')][_0xa644('0x3e')]){_0x2ad71a[_0xa644('0x3f')]=[{'all':!![]}];}return db[_0xa644('0x3d')][_0xa644('0x40')](_0x2ad71a);})['then'](function(_0x18ef37){_0x291676[_0xa644('0x41')]=_0x18ef37;return _0x291676;})[_0xa644('0x25')](respondWithFilteredResult(_0x14cdf9,_0x2ad71a))['catch'](handleError(_0x14cdf9,null));};exports[_0xa644('0x42')]=function(_0x50bfcb,_0x2e6de0){var _0x588e3c={'raw':!![],'where':{'id':_0x50bfcb[_0xa644('0x43')]['id']}},_0x4aa258={};_0x4aa258[_0xa644('0x2f')]=_[_0xa644('0x30')](db[_0xa644('0x3d')][_0xa644('0x2d')]);_0x4aa258[_0xa644('0x31')]=_[_0xa644('0x30')](_0x50bfcb[_0xa644('0x31')]);_0x4aa258['filters']=_[_0xa644('0x33')](_0x4aa258[_0xa644('0x2f')],_0x4aa258[_0xa644('0x31')]);_0x588e3c['attributes']=_['intersection'](_0x4aa258[_0xa644('0x2f')],qs['fields'](_0x50bfcb[_0xa644('0x31')][_0xa644('0x44')]));_0x588e3c['attributes']=_0x588e3c['attributes'][_0xa644('0x35')]?_0x588e3c[_0xa644('0x34')]:_0x4aa258[_0xa644('0x2f')];if(_0x50bfcb[_0xa644('0x31')][_0xa644('0x3e')]){_0x588e3c[_0xa644('0x3f')]=[{'all':!![]}];}_0x588e3c=_[_0xa644('0x3a')]({},_0x588e3c,_0x50bfcb['options']);return db[_0xa644('0x3d')]['find'](_0x588e3c)[_0xa644('0x25')](handleEntityNotFound(_0x2e6de0,null))['then'](respondWithResult(_0x2e6de0,null))[_0xa644('0x45')](handleError(_0x2e6de0,null));};exports[_0xa644('0x46')]=function(_0x96b3d1,_0xb75742){return db[_0xa644('0x3d')]['create'](_0x96b3d1[_0xa644('0x47')],{})['then'](respondWithResult(_0xb75742,0xc9))[_0xa644('0x45')](handleError(_0xb75742,null));};exports[_0xa644('0x24')]=function(_0x58fcb6,_0x18dd5c){if(_0x58fcb6[_0xa644('0x47')]['id']){delete _0x58fcb6[_0xa644('0x47')]['id'];}return db[_0xa644('0x3d')][_0xa644('0x48')]({'where':{'id':_0x58fcb6['params']['id']}})[_0xa644('0x25')](handleEntityNotFound(_0x18dd5c,null))[_0xa644('0x25')](saveUpdates(_0x58fcb6[_0xa644('0x47')],null))['then'](respondWithResult(_0x18dd5c,null))['catch'](handleError(_0x18dd5c,null));};exports[_0xa644('0x26')]=function(_0x3c24b3,_0x224f32){return db[_0xa644('0x3d')]['find']({'where':{'id':_0x3c24b3[_0xa644('0x43')]['id']}})[_0xa644('0x25')](handleEntityNotFound(_0x224f32,null))[_0xa644('0x25')](removeEntity(_0x224f32,null))[_0xa644('0x45')](handleError(_0x224f32,null));}; \ No newline at end of file +var _0x2e40=['../../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','stack','name','send','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','Dynamics365Field','includeAll','include','findAll','rows','catch','show','params','find','create','body','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x19fa95,_0x1cca0a){var _0x58a835=function(_0x3e1957){while(--_0x3e1957){_0x19fa95['push'](_0x19fa95['shift']());}};_0x58a835(++_0x1cca0a);}(_0x2e40,0x88));var _0x02e4=function(_0x205c6e,_0x5f0217){_0x205c6e=_0x205c6e-0x0;var _0x1d7456=_0x2e40[_0x205c6e];return _0x1d7456;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x02e4('0x0'));var jsonpatch=require(_0x02e4('0x1'));var rp=require(_0x02e4('0x2'));var moment=require(_0x02e4('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x02e4('0x4'));var util=require(_0x02e4('0x5'));var path=require(_0x02e4('0x6'));var sox=require(_0x02e4('0x7'));var csv=require(_0x02e4('0x8'));var ejs=require(_0x02e4('0x9'));var fs=require('fs');var fs_extra=require(_0x02e4('0xa'));var _=require(_0x02e4('0xb'));var squel=require(_0x02e4('0xc'));var crypto=require(_0x02e4('0xd'));var jsforce=require(_0x02e4('0xe'));var deskjs=require(_0x02e4('0xf'));var toCsv=require(_0x02e4('0x8'));var querystring=require(_0x02e4('0x10'));var Papa=require(_0x02e4('0x11'));var Redis=require(_0x02e4('0x12'));var authService=require(_0x02e4('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x02e4('0x14'));var hardwareService=require(_0x02e4('0x15'));var logger=require(_0x02e4('0x16'))('api');var utils=require(_0x02e4('0x17'));var config=require(_0x02e4('0x18'));var licenseUtil=require(_0x02e4('0x19'));var db=require(_0x02e4('0x1a'))['db'];function respondWithStatusCode(_0x380c0c,_0x5cff7a){_0x5cff7a=_0x5cff7a||0xcc;return function(_0x3de9de){if(_0x3de9de){return _0x380c0c[_0x02e4('0x1b')](_0x5cff7a);}return _0x380c0c['status'](_0x5cff7a)[_0x02e4('0x1c')]();};}function respondWithResult(_0x342c64,_0x3f85c5){_0x3f85c5=_0x3f85c5||0xc8;return function(_0x168d4b){if(_0x168d4b){return _0x342c64[_0x02e4('0x1d')](_0x3f85c5)[_0x02e4('0x1e')](_0x168d4b);}};}function respondWithFilteredResult(_0x5f3e27,_0xcf7899){return function(_0x313d8e){if(_0x313d8e){var _0x1cf8f7=typeof _0xcf7899[_0x02e4('0x1f')]===_0x02e4('0x20')&&typeof _0xcf7899[_0x02e4('0x21')]===_0x02e4('0x20');var _0xc2cfa0=_0x313d8e[_0x02e4('0x22')];var _0x4ced34=_0x1cf8f7?0x0:_0xcf7899[_0x02e4('0x1f')];var _0x1c25ab=_0x1cf8f7?_0x313d8e['count']:_0xcf7899[_0x02e4('0x1f')]+_0xcf7899[_0x02e4('0x21')];var _0x1b28f2;if(_0x1c25ab>=_0xc2cfa0){_0x1c25ab=_0xc2cfa0;_0x1b28f2=0xc8;}else{_0x1b28f2=0xce;}_0x5f3e27['status'](_0x1b28f2);return _0x5f3e27[_0x02e4('0x23')](_0x02e4('0x24'),_0x4ced34+'-'+_0x1c25ab+'/'+_0xc2cfa0)['json'](_0x313d8e);}return null;};}function patchUpdates(_0xf4563e){return function(_0x2ad1a0){try{jsonpatch[_0x02e4('0x25')](_0x2ad1a0,_0xf4563e,!![]);}catch(_0x85d691){return BPromise[_0x02e4('0x26')](_0x85d691);}return _0x2ad1a0[_0x02e4('0x27')]();};}function saveUpdates(_0x18eee1,_0xf6166c){return function(_0x23551a){if(_0x23551a){return _0x23551a[_0x02e4('0x28')](_0x18eee1)[_0x02e4('0x29')](function(_0x3af653){return _0x3af653;});}return null;};}function removeEntity(_0x84f3b1,_0x5e1c30){return function(_0x179404){if(_0x179404){return _0x179404[_0x02e4('0x2a')]()[_0x02e4('0x29')](function(){_0x84f3b1[_0x02e4('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5932f3,_0x346c5e){return function(_0xd2818d){if(!_0xd2818d){_0x5932f3['sendStatus'](0x194);}return _0xd2818d;};}function handleError(_0x28429e,_0x517a6e){_0x517a6e=_0x517a6e||0x1f4;return function(_0x3bef2b){logger['error'](_0x3bef2b[_0x02e4('0x2b')]);if(_0x3bef2b[_0x02e4('0x2c')]){delete _0x3bef2b[_0x02e4('0x2c')];}_0x28429e[_0x02e4('0x1d')](_0x517a6e)[_0x02e4('0x2d')](_0x3bef2b);};}exports['index']=function(_0x45f044,_0x2ba3b5){var _0xa089d={},_0x62785={},_0xfc6304={'count':0x0,'rows':[]};var _0x2aa4ab=_[_0x02e4('0x2e')](db['Dynamics365Field'][_0x02e4('0x2f')],function(_0x61eb57){return{'name':_0x61eb57['fieldName'],'type':_0x61eb57[_0x02e4('0x30')][_0x02e4('0x31')]};});_0x62785[_0x02e4('0x32')]=_['map'](_0x2aa4ab,_0x02e4('0x2c'));_0x62785[_0x02e4('0x33')]=_[_0x02e4('0x34')](_0x45f044['query']);_0x62785[_0x02e4('0x35')]=_[_0x02e4('0x36')](_0x62785[_0x02e4('0x32')],_0x62785[_0x02e4('0x33')]);_0xa089d[_0x02e4('0x37')]=_[_0x02e4('0x36')](_0x62785[_0x02e4('0x32')],qs[_0x02e4('0x38')](_0x45f044[_0x02e4('0x33')][_0x02e4('0x38')]));_0xa089d[_0x02e4('0x37')]=_0xa089d[_0x02e4('0x37')][_0x02e4('0x39')]?_0xa089d[_0x02e4('0x37')]:_0x62785['model'];if(!_0x45f044[_0x02e4('0x33')]['hasOwnProperty'](_0x02e4('0x3a'))){_0xa089d['limit']=qs['limit'](_0x45f044['query']['limit']);_0xa089d[_0x02e4('0x1f')]=qs[_0x02e4('0x1f')](_0x45f044[_0x02e4('0x33')][_0x02e4('0x1f')]);}_0xa089d[_0x02e4('0x3b')]=qs[_0x02e4('0x3c')](_0x45f044[_0x02e4('0x33')]['sort']);_0xa089d[_0x02e4('0x3d')]=qs[_0x02e4('0x35')](_[_0x02e4('0x3e')](_0x45f044['query'],_0x62785[_0x02e4('0x35')]),_0x2aa4ab);if(_0x45f044[_0x02e4('0x33')][_0x02e4('0x3f')]){_0xa089d[_0x02e4('0x3d')]=_[_0x02e4('0x40')](_0xa089d[_0x02e4('0x3d')],{'$or':_[_0x02e4('0x2e')](_0x2aa4ab,function(_0x404496){if(_0x404496[_0x02e4('0x30')]!==_0x02e4('0x41')){var _0x3dc88a={};_0x3dc88a[_0x404496[_0x02e4('0x2c')]]={'$like':'%'+_0x45f044[_0x02e4('0x33')][_0x02e4('0x3f')]+'%'};return _0x3dc88a;}})});}_0xa089d=_['merge']({},_0xa089d,_0x45f044[_0x02e4('0x42')]);var _0x4a522a={'where':_0xa089d['where']};return db[_0x02e4('0x43')][_0x02e4('0x22')](_0x4a522a)[_0x02e4('0x29')](function(_0x17f7dd){_0xfc6304[_0x02e4('0x22')]=_0x17f7dd;if(_0x45f044[_0x02e4('0x33')][_0x02e4('0x44')]){_0xa089d[_0x02e4('0x45')]=[{'all':!![]}];}return db[_0x02e4('0x43')][_0x02e4('0x46')](_0xa089d);})[_0x02e4('0x29')](function(_0x2d3d49){_0xfc6304[_0x02e4('0x47')]=_0x2d3d49;return _0xfc6304;})[_0x02e4('0x29')](respondWithFilteredResult(_0x2ba3b5,_0xa089d))[_0x02e4('0x48')](handleError(_0x2ba3b5,null));};exports[_0x02e4('0x49')]=function(_0x34082a,_0x219091){var _0x49a4b6={'raw':!![],'where':{'id':_0x34082a[_0x02e4('0x4a')]['id']}},_0x322b7a={};_0x322b7a[_0x02e4('0x32')]=_['keys'](db['Dynamics365Field'][_0x02e4('0x2f')]);_0x322b7a[_0x02e4('0x33')]=_['keys'](_0x34082a[_0x02e4('0x33')]);_0x322b7a['filters']=_[_0x02e4('0x36')](_0x322b7a[_0x02e4('0x32')],_0x322b7a[_0x02e4('0x33')]);_0x49a4b6[_0x02e4('0x37')]=_[_0x02e4('0x36')](_0x322b7a[_0x02e4('0x32')],qs[_0x02e4('0x38')](_0x34082a['query'][_0x02e4('0x38')]));_0x49a4b6[_0x02e4('0x37')]=_0x49a4b6['attributes'][_0x02e4('0x39')]?_0x49a4b6[_0x02e4('0x37')]:_0x322b7a[_0x02e4('0x32')];if(_0x34082a['query'][_0x02e4('0x44')]){_0x49a4b6[_0x02e4('0x45')]=[{'all':!![]}];}_0x49a4b6=_[_0x02e4('0x40')]({},_0x49a4b6,_0x34082a[_0x02e4('0x42')]);return db[_0x02e4('0x43')][_0x02e4('0x4b')](_0x49a4b6)[_0x02e4('0x29')](handleEntityNotFound(_0x219091,null))[_0x02e4('0x29')](respondWithResult(_0x219091,null))[_0x02e4('0x48')](handleError(_0x219091,null));};exports[_0x02e4('0x4c')]=function(_0x52b0be,_0x45aea3){return db[_0x02e4('0x43')][_0x02e4('0x4c')](_0x52b0be[_0x02e4('0x4d')],{})[_0x02e4('0x29')](respondWithResult(_0x45aea3,0xc9))['catch'](handleError(_0x45aea3,null));};exports['update']=function(_0x3c56b6,_0xb7833b){if(_0x3c56b6['body']['id']){delete _0x3c56b6[_0x02e4('0x4d')]['id'];}return db['Dynamics365Field']['find']({'where':{'id':_0x3c56b6[_0x02e4('0x4a')]['id']}})['then'](handleEntityNotFound(_0xb7833b,null))[_0x02e4('0x29')](saveUpdates(_0x3c56b6[_0x02e4('0x4d')],null))[_0x02e4('0x29')](respondWithResult(_0xb7833b,null))[_0x02e4('0x48')](handleError(_0xb7833b,null));};exports[_0x02e4('0x2a')]=function(_0x4f4669,_0x5308f0){return db[_0x02e4('0x43')]['find']({'where':{'id':_0x4f4669['params']['id']}})[_0x02e4('0x29')](handleEntityNotFound(_0x5308f0,null))[_0x02e4('0x29')](removeEntity(_0x5308f0,null))[_0x02e4('0x48')](handleError(_0x5308f0,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 26efcb5..112e997 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 _0x0db4=['util','api','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Field.attributes','exports','define','Dynamics365Field','int_dynamics365_fields','idField','FieldId','lodash'];(function(_0x5ae58c,_0x5e2828){var _0x168636=function(_0x27e113){while(--_0x27e113){_0x5ae58c['push'](_0x5ae58c['shift']());}};_0x168636(++_0x5e2828);}(_0x0db4,0x95));var _0x40db=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0x0db4[_0x4792c8];return _0x35edb1;};'use strict';var _=require(_0x40db('0x0'));var util=require(_0x40db('0x1'));var logger=require('../../config/logger')(_0x40db('0x2'));var moment=require('moment');var BPromise=require(_0x40db('0x3'));var rp=require(_0x40db('0x4'));var fs=require('fs');var path=require(_0x40db('0x5'));var rimraf=require(_0x40db('0x6'));var config=require(_0x40db('0x7'));var attributes=require(_0x40db('0x8'));module[_0x40db('0x9')]=function(_0x1cb302,_0x2ed7ea){return _0x1cb302[_0x40db('0xa')](_0x40db('0xb'),attributes,{'tableName':_0x40db('0xc'),'paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':[_0x40db('0xd'),_0x40db('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x115f=['./intDynamics365Field.attributes','exports','define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','util','../../config/logger','moment','bluebird','path','../../config/environment'];(function(_0x1cd77b,_0x1a1e6e){var _0x21198b=function(_0x3d2223){while(--_0x3d2223){_0x1cd77b['push'](_0x1cd77b['shift']());}};_0x21198b(++_0x1a1e6e);}(_0x115f,0x13c));var _0xf115=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x115f[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require('lodash');var util=require(_0xf115('0x0'));var logger=require(_0xf115('0x1'))('api');var moment=require(_0xf115('0x2'));var BPromise=require(_0xf115('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf115('0x4'));var rimraf=require('rimraf');var config=require(_0xf115('0x5'));var attributes=require(_0xf115('0x6'));module[_0xf115('0x7')]=function(_0x1e8937,_0x45ff05){return _0x1e8937[_0xf115('0x8')](_0xf115('0x9'),attributes,{'tableName':_0xf115('0xa'),'paranoid':![],'indexes':[{'name':_0xf115('0xb'),'fields':[_0xf115('0xc'),_0xf115('0xd')],'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 93b1924..a8609b7 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 _0x8955=['Dynamics365Field,\x20%s,\x20%s','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','message','error','result','catch','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info'];(function(_0x4565db,_0x4d6706){var _0x2de14c=function(_0x67b358){while(--_0x67b358){_0x4565db['push'](_0x4565db['shift']());}};_0x2de14c(++_0x4d6706);}(_0x8955,0x1ae));var _0x5895=function(_0x164f75,_0x9be61c){_0x164f75=_0x164f75-0x0;var _0x312eba=_0x8955[_0x164f75];return _0x312eba;};'use strict';var _=require('lodash');var util=require(_0x5895('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5895('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5895('0x2'))['db'];var utils=require(_0x5895('0x3'));var logger=require(_0x5895('0x4'))(_0x5895('0x5'));var config=require('../../config/environment');var jayson=require(_0x5895('0x6'));var client=jayson[_0x5895('0x7')][_0x5895('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x51857b,_0x249e28,_0x2a409a){return new BPromise(function(_0x431438,_0x238e31){return client['request'](_0x51857b,_0x2a409a)[_0x5895('0x9')](function(_0x1db0b4){logger[_0x5895('0xa')](_0x5895('0xb'),_0x249e28,'request\x20sent');logger[_0x5895('0xc')](_0x5895('0xd'),_0x249e28,_0x5895('0xe'),JSON[_0x5895('0xf')](_0x1db0b4));if(_0x1db0b4['error']){if(_0x1db0b4['error'][_0x5895('0x10')]===0x1f4){logger['error']('Dynamics365Field,\x20%s,\x20%s',_0x249e28,_0x1db0b4['error'][_0x5895('0x11')]);return _0x238e31(_0x1db0b4[_0x5895('0x12')][_0x5895('0x11')]);}logger[_0x5895('0x12')]('Dynamics365Field,\x20%s,\x20%s',_0x249e28,_0x1db0b4[_0x5895('0x12')][_0x5895('0x11')]);return _0x431438(_0x1db0b4[_0x5895('0x12')][_0x5895('0x11')]);}else{logger[_0x5895('0xa')](_0x5895('0xb'),_0x249e28,_0x5895('0xe'));_0x431438(_0x1db0b4[_0x5895('0x13')][_0x5895('0x11')]);}})[_0x5895('0x14')](function(_0xefadfb){logger['error']('Dynamics365Field,\x20%s,\x20%s',_0x249e28,_0xefadfb);_0x238e31(_0xefadfb);});});} \ No newline at end of file +var _0x4a59=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring'];(function(_0xb2ec9,_0x11b2e5){var _0x3fb27e=function(_0x1d2abc){while(--_0x1d2abc){_0xb2ec9['push'](_0xb2ec9['shift']());}};_0x3fb27e(++_0x11b2e5);}(_0x4a59,0x182));var _0x94a5=function(_0x97daab,_0x347ac5){_0x97daab=_0x97daab-0x0;var _0x3b716c=_0x4a59[_0x97daab];return _0x3b716c;};'use strict';var _=require(_0x94a5('0x0'));var util=require(_0x94a5('0x1'));var moment=require(_0x94a5('0x2'));var BPromise=require(_0x94a5('0x3'));var rs=require(_0x94a5('0x4'));var fs=require('fs');var Redis=require(_0x94a5('0x5'));var db=require(_0x94a5('0x6'))['db'];var utils=require(_0x94a5('0x7'));var logger=require('../../config/logger')(_0x94a5('0x8'));var config=require(_0x94a5('0x9'));var jayson=require(_0x94a5('0xa'));var client=jayson[_0x94a5('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2527df,_0x2c49fa,_0x58342b){return new BPromise(function(_0x52f5e5,_0xdd4ec1){return client[_0x94a5('0xc')](_0x2527df,_0x58342b)[_0x94a5('0xd')](function(_0x46915c){logger[_0x94a5('0xe')](_0x94a5('0xf'),_0x2c49fa,_0x94a5('0x10'));logger[_0x94a5('0x11')]('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x2c49fa,'request\x20sent',JSON[_0x94a5('0x12')](_0x46915c));if(_0x46915c[_0x94a5('0x13')]){if(_0x46915c[_0x94a5('0x13')][_0x94a5('0x14')]===0x1f4){logger[_0x94a5('0x13')](_0x94a5('0xf'),_0x2c49fa,_0x46915c['error'][_0x94a5('0x15')]);return _0xdd4ec1(_0x46915c['error']['message']);}logger[_0x94a5('0x13')](_0x94a5('0xf'),_0x2c49fa,_0x46915c[_0x94a5('0x13')][_0x94a5('0x15')]);return _0x52f5e5(_0x46915c[_0x94a5('0x13')][_0x94a5('0x15')]);}else{logger[_0x94a5('0xe')](_0x94a5('0xf'),_0x2c49fa,_0x94a5('0x10'));_0x52f5e5(_0x46915c[_0x94a5('0x16')][_0x94a5('0x15')]);}})['catch'](function(_0x2e4123){logger[_0x94a5('0x13')](_0x94a5('0xf'),_0x2c49fa,_0x2e4123);_0xdd4ec1(_0x2e4123);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index d14e373..f8eb8d6 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 _0x2dd2=['delete','destroy','multer','path','express','fs-extra','../../config/environment','./intFreshdeskAccount.controller','get','index','/:id','isAuthenticated','show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0x2dd2,0x17e));var _0x22dd=function(_0x25ba1b,_0x172071){_0x25ba1b=_0x25ba1b-0x0;var _0x303a0d=_0x2dd2[_0x25ba1b];return _0x303a0d;};'use strict';var multer=require(_0x22dd('0x0'));var util=require('util');var path=require(_0x22dd('0x1'));var timeout=require('connect-timeout');var express=require(_0x22dd('0x2'));var router=express['Router']();var fs_extra=require(_0x22dd('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x22dd('0x4'));var controller=require(_0x22dd('0x5'));router[_0x22dd('0x6')]('/',auth['isAuthenticated'](),controller[_0x22dd('0x7')]);router[_0x22dd('0x6')](_0x22dd('0x8'),auth[_0x22dd('0x9')](),controller[_0x22dd('0xa')]);router[_0x22dd('0x6')](_0x22dd('0xb'),auth[_0x22dd('0x9')](),controller['getConfigurations']);router[_0x22dd('0x6')](_0x22dd('0xc'),auth[_0x22dd('0x9')](),controller[_0x22dd('0xd')]);router[_0x22dd('0xe')]('/',auth[_0x22dd('0x9')](),controller[_0x22dd('0xf')]);router[_0x22dd('0xe')]('/:id/configurations',auth[_0x22dd('0x9')](),controller[_0x22dd('0x10')]);router[_0x22dd('0x11')](_0x22dd('0x8'),auth[_0x22dd('0x9')](),controller['update']);router[_0x22dd('0x12')](_0x22dd('0x8'),auth[_0x22dd('0x9')](),controller[_0x22dd('0x13')]);module['exports']=router; \ No newline at end of file +var _0x443a=['../../config/environment','get','index','isAuthenticated','show','getConfigurations','getFields','post','addConfiguration','put','update','delete','/:id','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x443a,0x172));var _0xa443=function(_0x39c89e,_0x2f46a3){_0x39c89e=_0x39c89e-0x0;var _0x1c94a1=_0x443a[_0x39c89e];return _0x1c94a1;};'use strict';var multer=require(_0xa443('0x0'));var util=require(_0xa443('0x1'));var path=require(_0xa443('0x2'));var timeout=require(_0xa443('0x3'));var express=require('express');var router=express[_0xa443('0x4')]();var fs_extra=require(_0xa443('0x5'));var auth=require(_0xa443('0x6'));var interaction=require(_0xa443('0x7'));var config=require(_0xa443('0x8'));var controller=require('./intFreshdeskAccount.controller');router[_0xa443('0x9')]('/',auth['isAuthenticated'](),controller[_0xa443('0xa')]);router['get']('/:id',auth[_0xa443('0xb')](),controller[_0xa443('0xc')]);router[_0xa443('0x9')]('/:id/configurations',auth[_0xa443('0xb')](),controller[_0xa443('0xd')]);router[_0xa443('0x9')]('/:id/fields',auth['isAuthenticated'](),controller[_0xa443('0xe')]);router['post']('/',auth[_0xa443('0xb')](),controller['create']);router[_0xa443('0xf')]('/:id/configurations',auth[_0xa443('0xb')](),controller[_0xa443('0x10')]);router[_0xa443('0x11')]('/:id',auth[_0xa443('0xb')](),controller[_0xa443('0x12')]);router[_0xa443('0x13')](_0xa443('0x14'),auth[_0xa443('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index d7cffb5..0494e04 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 _0xd824=['exports','STRING','username','remoteUri','sequelize'];(function(_0x17ea97,_0x1b7351){var _0x37c25a=function(_0x16a1f1){while(--_0x16a1f1){_0x17ea97['push'](_0x17ea97['shift']());}};_0x37c25a(++_0x1b7351);}(_0xd824,0xc2));var _0x4d82=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd824[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x4d82('0x0'));module[_0x4d82('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x4d82('0x2')],'unique':_0x4d82('0x3')},'apiKey':{'type':Sequelize[_0x4d82('0x2')]},'remoteUri':{'type':Sequelize[_0x4d82('0x2')],'unique':_0x4d82('0x4')},'serverUrl':{'type':Sequelize[_0x4d82('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xf2e3=['STRING','username','remoteUri','sequelize'];(function(_0x3815c2,_0x1f54e3){var _0x271f88=function(_0x53963c){while(--_0x53963c){_0x3815c2['push'](_0x3815c2['shift']());}};_0x271f88(++_0x1f54e3);}(_0xf2e3,0x9b));var _0x3f2e=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0xf2e3[_0x525c7b];return _0x27b33e;};'use strict';var Sequelize=require(_0x3f2e('0x0'));module['exports']={'name':{'type':Sequelize[_0x3f2e('0x1')]},'description':{'type':Sequelize[_0x3f2e('0x1')]},'username':{'type':Sequelize[_0x3f2e('0x1')],'unique':_0x3f2e('0x2')},'apiKey':{'type':Sequelize[_0x3f2e('0x1')]},'remoteUri':{'type':Sequelize[_0x3f2e('0x1')],'unique':_0x3f2e('0x3')},'serverUrl':{'type':Sequelize[_0x3f2e('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 1a9ff76..23654f5 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 _0x3189=['query','keys','filters','intersection','fields','attributes','length','nolimit','sort','where','pick','filter','VIRTUAL','merge','FreshdeskAccount','includeAll','findAll','rows','catch','include','find','create','body','params','findOne','order','options','getConfigurations','hasOwnProperty','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshdeskConfiguration','FreshdeskField','getFields','remoteUri','apiKey','slice','GET','format','api/v2/ticket_fields','Basic\x20%s','toString','base64','requester','subject','agent','description','group','source','company','includes','default','custom_dropdown','label','choices','capitalize','test','statusCode','error','stringify','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','sox','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','limit','undefined','count','set','Content-Range','json','reject','save','then','destroy','end','stack','name','send','index','map','rawAttributes','fieldName','type','model'];(function(_0x711043,_0x2555b8){var _0x39aa7e=function(_0x373028){while(--_0x373028){_0x711043['push'](_0x711043['shift']());}};_0x39aa7e(++_0x2555b8);}(_0x3189,0xae));var _0x9318=function(_0x478c2d,_0x4f07fd){_0x478c2d=_0x478c2d-0x0;var _0x372758=_0x3189[_0x478c2d];return _0x372758;};'use strict';var emlformat=require(_0x9318('0x0'));var rimraf=require(_0x9318('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9318('0x2'));var rp=require(_0x9318('0x3'));var moment=require(_0x9318('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9318('0x5'));var util=require('util');var path=require('path');var sox=require(_0x9318('0x6'));var csv=require(_0x9318('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9318('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x9318('0x9'));var jsforce=require(_0x9318('0xa'));var deskjs=require(_0x9318('0xb'));var toCsv=require('to-csv');var querystring=require(_0x9318('0xc'));var Papa=require(_0x9318('0xd'));var Redis=require(_0x9318('0xe'));var authService=require(_0x9318('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9318('0x10'));var logger=require('../../config/logger')(_0x9318('0x11'));var utils=require(_0x9318('0x12'));var config=require(_0x9318('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x9318('0x14'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x5133a4,_0x2ac258){_0x2ac258=_0x2ac258||0xcc;return function(_0x4fba52){if(_0x4fba52){return _0x5133a4[_0x9318('0x15')](_0x2ac258);}return _0x5133a4[_0x9318('0x16')](_0x2ac258)['end']();};}function respondWithResult(_0x258b56,_0xfe145c){_0xfe145c=_0xfe145c||0xc8;return function(_0x326e26){if(_0x326e26){return _0x258b56['status'](_0xfe145c)['json'](_0x326e26);}};}function respondWithFilteredResult(_0x10d4f0,_0x11b380){return function(_0x4ee574){if(_0x4ee574){var _0x1a22c=typeof _0x11b380[_0x9318('0x17')]==='undefined'&&typeof _0x11b380[_0x9318('0x18')]===_0x9318('0x19');var _0x411fa4=_0x4ee574[_0x9318('0x1a')];var _0xd1fd86=_0x1a22c?0x0:_0x11b380[_0x9318('0x17')];var _0xf657f7=_0x1a22c?_0x4ee574[_0x9318('0x1a')]:_0x11b380['offset']+_0x11b380[_0x9318('0x18')];var _0x4611cb;if(_0xf657f7>=_0x411fa4){_0xf657f7=_0x411fa4;_0x4611cb=0xc8;}else{_0x4611cb=0xce;}_0x10d4f0[_0x9318('0x16')](_0x4611cb);return _0x10d4f0[_0x9318('0x1b')](_0x9318('0x1c'),_0xd1fd86+'-'+_0xf657f7+'/'+_0x411fa4)[_0x9318('0x1d')](_0x4ee574);}return null;};}function patchUpdates(_0x59a34f){return function(_0x325f14){try{jsonpatch['apply'](_0x325f14,_0x59a34f,!![]);}catch(_0x4c2883){return BPromise[_0x9318('0x1e')](_0x4c2883);}return _0x325f14[_0x9318('0x1f')]();};}function saveUpdates(_0xa45304,_0x2b3d31){return function(_0x714c45){if(_0x714c45){return _0x714c45['update'](_0xa45304)[_0x9318('0x20')](function(_0x3d6205){return _0x3d6205;});}return null;};}function removeEntity(_0x451694,_0x33502a){return function(_0x4316f8){if(_0x4316f8){return _0x4316f8[_0x9318('0x21')]()[_0x9318('0x20')](function(){_0x451694[_0x9318('0x16')](0xcc)[_0x9318('0x22')]();});}};}function handleEntityNotFound(_0xaf8aec,_0x30386c){return function(_0x202123){if(!_0x202123){_0xaf8aec[_0x9318('0x15')](0x194);}return _0x202123;};}function handleError(_0x659998,_0x35e85e){_0x35e85e=_0x35e85e||0x1f4;return function(_0x30be80){logger['error'](_0x30be80[_0x9318('0x23')]);if(_0x30be80[_0x9318('0x24')]){delete _0x30be80['name'];}_0x659998[_0x9318('0x16')](_0x35e85e)[_0x9318('0x25')](_0x30be80);};}exports[_0x9318('0x26')]=function(_0xf8bc76,_0xf01d79){var _0x430f42={},_0x30b048={},_0x4c8dc6={'count':0x0,'rows':[]};var _0x2fb678=_[_0x9318('0x27')](db['FreshdeskAccount'][_0x9318('0x28')],function(_0x4c4a6f){return{'name':_0x4c4a6f[_0x9318('0x29')],'type':_0x4c4a6f[_0x9318('0x2a')]['key']};});_0x30b048[_0x9318('0x2b')]=_['map'](_0x2fb678,_0x9318('0x24'));_0x30b048[_0x9318('0x2c')]=_[_0x9318('0x2d')](_0xf8bc76['query']);_0x30b048[_0x9318('0x2e')]=_[_0x9318('0x2f')](_0x30b048[_0x9318('0x2b')],_0x30b048[_0x9318('0x2c')]);_0x430f42['attributes']=_['intersection'](_0x30b048[_0x9318('0x2b')],qs['fields'](_0xf8bc76[_0x9318('0x2c')][_0x9318('0x30')]));_0x430f42['attributes']=_0x430f42[_0x9318('0x31')][_0x9318('0x32')]?_0x430f42['attributes']:_0x30b048[_0x9318('0x2b')];if(!_0xf8bc76[_0x9318('0x2c')]['hasOwnProperty'](_0x9318('0x33'))){_0x430f42[_0x9318('0x18')]=qs[_0x9318('0x18')](_0xf8bc76[_0x9318('0x2c')][_0x9318('0x18')]);_0x430f42[_0x9318('0x17')]=qs[_0x9318('0x17')](_0xf8bc76[_0x9318('0x2c')][_0x9318('0x17')]);}_0x430f42['order']=qs['sort'](_0xf8bc76[_0x9318('0x2c')][_0x9318('0x34')]);_0x430f42[_0x9318('0x35')]=qs[_0x9318('0x2e')](_[_0x9318('0x36')](_0xf8bc76[_0x9318('0x2c')],_0x30b048[_0x9318('0x2e')]),_0x2fb678);if(_0xf8bc76[_0x9318('0x2c')][_0x9318('0x37')]){_0x430f42[_0x9318('0x35')]=_['merge'](_0x430f42['where'],{'$or':_[_0x9318('0x27')](_0x2fb678,function(_0x5538b2){if(_0x5538b2['type']!==_0x9318('0x38')){var _0xa1b0b1={};_0xa1b0b1[_0x5538b2[_0x9318('0x24')]]={'$like':'%'+_0xf8bc76[_0x9318('0x2c')][_0x9318('0x37')]+'%'};return _0xa1b0b1;}})});}_0x430f42=_[_0x9318('0x39')]({},_0x430f42,_0xf8bc76['options']);var _0x3f3673={'where':_0x430f42[_0x9318('0x35')]};return db[_0x9318('0x3a')][_0x9318('0x1a')](_0x3f3673)['then'](function(_0xf31f83){_0x4c8dc6[_0x9318('0x1a')]=_0xf31f83;if(_0xf8bc76[_0x9318('0x2c')][_0x9318('0x3b')]){_0x430f42['include']=[{'all':!![]}];}return db['FreshdeskAccount'][_0x9318('0x3c')](_0x430f42);})[_0x9318('0x20')](function(_0x5392b0){_0x4c8dc6[_0x9318('0x3d')]=_0x5392b0;return _0x4c8dc6;})[_0x9318('0x20')](respondWithFilteredResult(_0xf01d79,_0x430f42))[_0x9318('0x3e')](handleError(_0xf01d79,null));};exports['show']=function(_0x94a111,_0x205f06){var _0x28d505={'raw':![],'where':{'id':_0x94a111['params']['id']}},_0x430975={};_0x430975[_0x9318('0x2b')]=_['keys'](db[_0x9318('0x3a')][_0x9318('0x28')]);_0x430975[_0x9318('0x2c')]=_[_0x9318('0x2d')](_0x94a111[_0x9318('0x2c')]);_0x430975[_0x9318('0x2e')]=_['intersection'](_0x430975[_0x9318('0x2b')],_0x430975['query']);_0x28d505[_0x9318('0x31')]=_[_0x9318('0x2f')](_0x430975['model'],qs['fields'](_0x94a111['query'][_0x9318('0x30')]));_0x28d505[_0x9318('0x31')]=_0x28d505[_0x9318('0x31')][_0x9318('0x32')]?_0x28d505[_0x9318('0x31')]:_0x430975[_0x9318('0x2b')];if(_0x94a111[_0x9318('0x2c')][_0x9318('0x3b')]){_0x28d505[_0x9318('0x3f')]=[{'all':!![]}];}_0x28d505=_[_0x9318('0x39')]({},_0x28d505,_0x94a111['options']);return db[_0x9318('0x3a')][_0x9318('0x40')](_0x28d505)[_0x9318('0x20')](handleEntityNotFound(_0x205f06,null))[_0x9318('0x20')](respondWithResult(_0x205f06,null))[_0x9318('0x3e')](handleError(_0x205f06,null));};exports[_0x9318('0x41')]=function(_0x5eec25,_0x210f74){return db['FreshdeskAccount'][_0x9318('0x41')](_0x5eec25[_0x9318('0x42')],{})[_0x9318('0x20')](respondWithResult(_0x210f74,0xc9))['catch'](handleError(_0x210f74,null));};exports['update']=function(_0x4ce675,_0x19aa0e){if(_0x4ce675[_0x9318('0x42')]['id']){delete _0x4ce675[_0x9318('0x42')]['id'];}return db[_0x9318('0x3a')][_0x9318('0x40')]({'where':{'id':_0x4ce675[_0x9318('0x43')]['id']}})[_0x9318('0x20')](handleEntityNotFound(_0x19aa0e,null))['then'](saveUpdates(_0x4ce675[_0x9318('0x42')],null))[_0x9318('0x20')](respondWithResult(_0x19aa0e,null))['catch'](handleError(_0x19aa0e,null));};exports['destroy']=function(_0x1d8e80,_0x155e69){return db[_0x9318('0x3a')][_0x9318('0x40')]({'where':{'id':_0x1d8e80[_0x9318('0x43')]['id']}})[_0x9318('0x20')](handleEntityNotFound(_0x155e69,null))[_0x9318('0x20')](removeEntity(_0x155e69,null))[_0x9318('0x3e')](handleError(_0x155e69,null));};exports['getConfigurations']=function(_0x2c7eca,_0x221dc3,_0x44128e){var _0x14b195={};var _0x1bd5c1={};var _0x11b2ce;var _0x2c41a0;return db[_0x9318('0x3a')][_0x9318('0x44')]({'where':{'id':_0x2c7eca[_0x9318('0x43')]['id']}})[_0x9318('0x20')](handleEntityNotFound(_0x221dc3,null))[_0x9318('0x20')](function(_0x359871){if(_0x359871){_0x11b2ce=_0x359871;_0x1bd5c1[_0x9318('0x2b')]=_[_0x9318('0x2d')](db['FreshdeskConfiguration']['rawAttributes']);_0x1bd5c1[_0x9318('0x2c')]=_[_0x9318('0x2d')](_0x2c7eca['query']);_0x1bd5c1[_0x9318('0x2e')]=_[_0x9318('0x2f')](_0x1bd5c1[_0x9318('0x2b')],_0x1bd5c1[_0x9318('0x2c')]);_0x14b195[_0x9318('0x31')]=_[_0x9318('0x2f')](_0x1bd5c1['model'],qs['fields'](_0x2c7eca[_0x9318('0x2c')][_0x9318('0x30')]));_0x14b195[_0x9318('0x31')]=_0x14b195['attributes']['length']?_0x14b195[_0x9318('0x31')]:_0x1bd5c1['model'];_0x14b195[_0x9318('0x45')]=qs[_0x9318('0x34')](_0x2c7eca['query'][_0x9318('0x34')]);_0x14b195['where']=qs[_0x9318('0x2e')](_['pick'](_0x2c7eca[_0x9318('0x2c')],_0x1bd5c1[_0x9318('0x2e')]));if(_0x2c7eca[_0x9318('0x2c')][_0x9318('0x37')]){_0x14b195[_0x9318('0x35')]=_[_0x9318('0x39')](_0x14b195[_0x9318('0x35')],{'$or':_[_0x9318('0x27')](_0x14b195[_0x9318('0x31')],function(_0x37be4d){var _0x21ced4={};_0x21ced4[_0x37be4d]={'$like':'%'+_0x2c7eca[_0x9318('0x2c')][_0x9318('0x37')]+'%'};return _0x21ced4;})});}_0x14b195=_['merge']({},_0x14b195,_0x2c7eca[_0x9318('0x46')]);return _0x11b2ce[_0x9318('0x47')](_0x14b195);}})[_0x9318('0x20')](function(_0x2c98f4){if(_0x2c98f4){_0x2c41a0=_0x2c98f4['length'];if(!_0x2c7eca[_0x9318('0x2c')][_0x9318('0x48')](_0x9318('0x33'))){_0x14b195[_0x9318('0x18')]=qs[_0x9318('0x18')](_0x2c7eca[_0x9318('0x2c')]['limit']);_0x14b195[_0x9318('0x17')]=qs[_0x9318('0x17')](_0x2c7eca[_0x9318('0x2c')][_0x9318('0x17')]);}return _0x11b2ce[_0x9318('0x47')](_0x14b195);}})[_0x9318('0x20')](function(_0x34178d){if(_0x34178d){return _0x34178d?{'count':_0x2c41a0,'rows':_0x34178d}:null;}})[_0x9318('0x20')](respondWithResult(_0x221dc3,null))[_0x9318('0x3e')](handleError(_0x221dc3,null));};exports['addConfiguration']=function(_0x19db94,_0x1dbfcc,_0x1178fc){if(_0x19db94[_0x9318('0x42')]['id']){delete _0x19db94[_0x9318('0x42')]['id'];}return db[_0x9318('0x3a')]['findOne']({'where':{'id':_0x19db94['params']['id']}})[_0x9318('0x20')](handleEntityNotFound(_0x1dbfcc,null))[_0x9318('0x20')](function(_0x3b9b1c){if(_0x3b9b1c){_0x19db94['body'][_0x9318('0x49')]=_0x3b9b1c['id'];_0x19db94[_0x9318('0x42')][_0x9318('0x4a')]=integrations[_0x9318('0x4b')](_0x19db94[_0x9318('0x42')][_0x9318('0x4c')],_0x19db94['body'][_0x9318('0x2a')]);_0x19db94[_0x9318('0x42')][_0x9318('0x4d')]=integrations[_0x9318('0x4e')](_0x19db94[_0x9318('0x42')]['channel'],_0x19db94[_0x9318('0x42')][_0x9318('0x2a')]);return db[_0x9318('0x4f')][_0x9318('0x41')](_0x19db94[_0x9318('0x42')],{'include':[{'model':db[_0x9318('0x50')],'as':_0x9318('0x4a')},{'model':db[_0x9318('0x50')],'as':_0x9318('0x4d')}]});}return null;})[_0x9318('0x20')](respondWithResult(_0x1dbfcc,null))[_0x9318('0x3e')](handleError(_0x1dbfcc,null));};exports[_0x9318('0x51')]=function(_0x178fc5,_0x497171,_0x43850e){var _0x3ec6cb='';return db[_0x9318('0x3a')][_0x9318('0x44')]({'where':{'id':_0x178fc5['params']['id']},'attributes':['id',_0x9318('0x52'),_0x9318('0x53')]})[_0x9318('0x20')](handleEntityNotFound(_0x497171,null))[_0x9318('0x20')](function(_0x53900c){if(_0x53900c){_0x3ec6cb=_0x53900c[_0x9318('0x52')];var _0x2a4a07=_0x3ec6cb[_0x9318('0x54')](-0x1);if(_0x2a4a07==='/'){_0x3ec6cb=_0x3ec6cb['substring'](0x0,_0x3ec6cb['lastIndexOf'](_0x2a4a07));}return rp({'method':_0x9318('0x55'),'uri':util[_0x9318('0x56')]('%s/%s',_0x3ec6cb,_0x9318('0x57')),'headers':{'Authorization':util[_0x9318('0x56')](_0x9318('0x58'),new Buffer(util[_0x9318('0x56')]('%s:X',_0x53900c[_0x9318('0x53')]))[_0x9318('0x59')](_0x9318('0x5a')))},'json':!![]});}})[_0x9318('0x20')](function(_0x58e274){if(_0x58e274){var _0x197f01=[_0x9318('0x5b'),_0x9318('0x5c'),_0x9318('0x5d'),_0x9318('0x5e'),_0x9318('0x16'),'priority',_0x9318('0x5f'),_0x9318('0x60'),'ticket_type',_0x9318('0x5f'),_0x9318('0x61')];_['remove'](_0x58e274,function(_0xdde700){return _0x197f01[_0x9318('0x62')](_0xdde700[_0x9318('0x24')])||!_0xdde700[_0x9318('0x63')]&&_0xdde700[_0x9318('0x2a')]!=='custom_text'&&_0xdde700[_0x9318('0x2a')]!==_0x9318('0x64');});return{'count':_0x58e274['length'],'rows':_[_0x9318('0x27')](_0x58e274,function(_0x76fe43){return{'id':_0x76fe43['name'],'name':_0x76fe43[_0x9318('0x65')],'custom':!_0x76fe43[_0x9318('0x63')],'options':_0x76fe43[_0x9318('0x66')]?_[_0x9318('0x27')](_0x76fe43[_0x9318('0x66')],function(_0x34600f){return{'name':_[_0x9318('0x67')](_0x34600f),'value':_0x34600f};}):[]};})};}})['then'](respondWithResult(_0x497171,null))[_0x9318('0x3e')](function(_0x1b9b25){var _0x2ca2e6=_0x178fc5[_0x9318('0x2c')][_0x9318('0x68')]?0x1f4:_0x1b9b25[_0x9318('0x69')]||0x1f4;logger[_0x9318('0x6a')]('getFields,\x20%s,\x20%s,\x20%s',_0x9318('0x51'),_0x2ca2e6,JSON[_0x9318('0x6b')](_0x1b9b25));delete _0x1b9b25['name'];if(_0x2ca2e6===0x191){_0x2ca2e6=0x190;}_0x497171[_0x9318('0x16')](_0x2ca2e6)['send'](_0x178fc5[_0x9318('0x2c')][_0x9318('0x68')]?{'message':_0x9318('0x6c'),'statusCode':_0x1b9b25[_0x9318('0x69')]}:_0x1b9b25);});}; \ No newline at end of file +var _0xd240=['description','priority','group','source','ticket_type','company','remove','default','custom_text','label','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','rimraf','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','map','FreshdeskAccount','rawAttributes','fieldName','model','query','keys','intersection','attributes','fields','length','nolimit','sort','where','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','merge','find','catch','create','body','params','destroy','findOne','FreshdeskConfiguration','filters','order','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshdeskField','getFields','remoteUri','apiKey','slice','substring','lastIndexOf','format','%s/%s','toString','subject','agent'];(function(_0x21331a,_0x57fc48){var _0x325c55=function(_0x770dfa){while(--_0x770dfa){_0x21331a['push'](_0x21331a['shift']());}};_0x325c55(++_0x57fc48);}(_0xd240,0x1c7));var _0x0d24=function(_0x65cd78,_0x5a65bf){_0x65cd78=_0x65cd78-0x0;var _0xd5f41a=_0xd240[_0x65cd78];return _0xd5f41a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0d24('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0d24('0x1'));var moment=require(_0x0d24('0x2'));var BPromise=require(_0x0d24('0x3'));var Mustache=require(_0x0d24('0x4'));var util=require(_0x0d24('0x5'));var path=require(_0x0d24('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0d24('0x7'));var fs=require('fs');var fs_extra=require(_0x0d24('0x8'));var _=require(_0x0d24('0x9'));var squel=require(_0x0d24('0xa'));var crypto=require('crypto');var jsforce=require(_0x0d24('0xb'));var deskjs=require(_0x0d24('0xc'));var toCsv=require(_0x0d24('0xd'));var querystring=require(_0x0d24('0xe'));var Papa=require(_0x0d24('0xf'));var Redis=require(_0x0d24('0x10'));var authService=require(_0x0d24('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x0d24('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0d24('0x13'))('api');var utils=require(_0x0d24('0x14'));var config=require(_0x0d24('0x15'));var licenseUtil=require(_0x0d24('0x16'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x29f892,_0x1b6f50){_0x1b6f50=_0x1b6f50||0xcc;return function(_0x41838d){if(_0x41838d){return _0x29f892['sendStatus'](_0x1b6f50);}return _0x29f892[_0x0d24('0x17')](_0x1b6f50)[_0x0d24('0x18')]();};}function respondWithResult(_0x58ac0d,_0x4d24b5){_0x4d24b5=_0x4d24b5||0xc8;return function(_0x13c2ce){if(_0x13c2ce){return _0x58ac0d[_0x0d24('0x17')](_0x4d24b5)[_0x0d24('0x19')](_0x13c2ce);}};}function respondWithFilteredResult(_0x175841,_0xd9a534){return function(_0x6ec239){if(_0x6ec239){var _0xf188c9=typeof _0xd9a534[_0x0d24('0x1a')]==='undefined'&&typeof _0xd9a534[_0x0d24('0x1b')]===_0x0d24('0x1c');var _0x591d04=_0x6ec239[_0x0d24('0x1d')];var _0x1c5899=_0xf188c9?0x0:_0xd9a534[_0x0d24('0x1a')];var _0x151030=_0xf188c9?_0x6ec239['count']:_0xd9a534[_0x0d24('0x1a')]+_0xd9a534[_0x0d24('0x1b')];var _0x527f6b;if(_0x151030>=_0x591d04){_0x151030=_0x591d04;_0x527f6b=0xc8;}else{_0x527f6b=0xce;}_0x175841['status'](_0x527f6b);return _0x175841[_0x0d24('0x1e')](_0x0d24('0x1f'),_0x1c5899+'-'+_0x151030+'/'+_0x591d04)[_0x0d24('0x19')](_0x6ec239);}return null;};}function patchUpdates(_0x2f611b){return function(_0x30e520){try{jsonpatch[_0x0d24('0x20')](_0x30e520,_0x2f611b,!![]);}catch(_0x120625){return BPromise[_0x0d24('0x21')](_0x120625);}return _0x30e520[_0x0d24('0x22')]();};}function saveUpdates(_0x5df68d,_0x2499e1){return function(_0x14108f){if(_0x14108f){return _0x14108f[_0x0d24('0x23')](_0x5df68d)[_0x0d24('0x24')](function(_0x4e6ded){return _0x4e6ded;});}return null;};}function removeEntity(_0x23440c,_0x3cd88f){return function(_0x367028){if(_0x367028){return _0x367028['destroy']()[_0x0d24('0x24')](function(){_0x23440c[_0x0d24('0x17')](0xcc)[_0x0d24('0x18')]();});}};}function handleEntityNotFound(_0x5905c3,_0x26db95){return function(_0xa5d22d){if(!_0xa5d22d){_0x5905c3[_0x0d24('0x25')](0x194);}return _0xa5d22d;};}function handleError(_0x582169,_0x2226d6){_0x2226d6=_0x2226d6||0x1f4;return function(_0x1a5feb){logger[_0x0d24('0x26')](_0x1a5feb[_0x0d24('0x27')]);if(_0x1a5feb[_0x0d24('0x28')]){delete _0x1a5feb[_0x0d24('0x28')];}_0x582169['status'](_0x2226d6)['send'](_0x1a5feb);};}exports['index']=function(_0x1057c3,_0x2064e3){var _0x1a1ef7={},_0xa1bccb={},_0x31ea4b={'count':0x0,'rows':[]};var _0x8f3446=_[_0x0d24('0x29')](db[_0x0d24('0x2a')][_0x0d24('0x2b')],function(_0x45c4bc){return{'name':_0x45c4bc[_0x0d24('0x2c')],'type':_0x45c4bc['type']['key']};});_0xa1bccb[_0x0d24('0x2d')]=_['map'](_0x8f3446,'name');_0xa1bccb[_0x0d24('0x2e')]=_[_0x0d24('0x2f')](_0x1057c3[_0x0d24('0x2e')]);_0xa1bccb['filters']=_[_0x0d24('0x30')](_0xa1bccb['model'],_0xa1bccb[_0x0d24('0x2e')]);_0x1a1ef7[_0x0d24('0x31')]=_[_0x0d24('0x30')](_0xa1bccb[_0x0d24('0x2d')],qs[_0x0d24('0x32')](_0x1057c3['query']['fields']));_0x1a1ef7[_0x0d24('0x31')]=_0x1a1ef7[_0x0d24('0x31')][_0x0d24('0x33')]?_0x1a1ef7[_0x0d24('0x31')]:_0xa1bccb[_0x0d24('0x2d')];if(!_0x1057c3[_0x0d24('0x2e')]['hasOwnProperty'](_0x0d24('0x34'))){_0x1a1ef7[_0x0d24('0x1b')]=qs['limit'](_0x1057c3[_0x0d24('0x2e')][_0x0d24('0x1b')]);_0x1a1ef7['offset']=qs[_0x0d24('0x1a')](_0x1057c3[_0x0d24('0x2e')][_0x0d24('0x1a')]);}_0x1a1ef7['order']=qs[_0x0d24('0x35')](_0x1057c3[_0x0d24('0x2e')][_0x0d24('0x35')]);_0x1a1ef7[_0x0d24('0x36')]=qs['filters'](_['pick'](_0x1057c3[_0x0d24('0x2e')],_0xa1bccb['filters']),_0x8f3446);if(_0x1057c3['query']['filter']){_0x1a1ef7[_0x0d24('0x36')]=_['merge'](_0x1a1ef7[_0x0d24('0x36')],{'$or':_[_0x0d24('0x29')](_0x8f3446,function(_0x37302d){if(_0x37302d[_0x0d24('0x37')]!==_0x0d24('0x38')){var _0x274cf5={};_0x274cf5[_0x37302d[_0x0d24('0x28')]]={'$like':'%'+_0x1057c3[_0x0d24('0x2e')][_0x0d24('0x39')]+'%'};return _0x274cf5;}})});}_0x1a1ef7=_['merge']({},_0x1a1ef7,_0x1057c3[_0x0d24('0x3a')]);var _0x554917={'where':_0x1a1ef7['where']};return db[_0x0d24('0x2a')][_0x0d24('0x1d')](_0x554917)[_0x0d24('0x24')](function(_0x1396cf){_0x31ea4b[_0x0d24('0x1d')]=_0x1396cf;if(_0x1057c3[_0x0d24('0x2e')][_0x0d24('0x3b')]){_0x1a1ef7[_0x0d24('0x3c')]=[{'all':!![]}];}return db[_0x0d24('0x2a')][_0x0d24('0x3d')](_0x1a1ef7);})[_0x0d24('0x24')](function(_0x548fee){_0x31ea4b[_0x0d24('0x3e')]=_0x548fee;return _0x31ea4b;})[_0x0d24('0x24')](respondWithFilteredResult(_0x2064e3,_0x1a1ef7))['catch'](handleError(_0x2064e3,null));};exports[_0x0d24('0x3f')]=function(_0x9dd427,_0x119152){var _0x1fbff7={'raw':![],'where':{'id':_0x9dd427['params']['id']}},_0x4004d7={};_0x4004d7[_0x0d24('0x2d')]=_['keys'](db[_0x0d24('0x2a')][_0x0d24('0x2b')]);_0x4004d7['query']=_[_0x0d24('0x2f')](_0x9dd427[_0x0d24('0x2e')]);_0x4004d7['filters']=_['intersection'](_0x4004d7['model'],_0x4004d7[_0x0d24('0x2e')]);_0x1fbff7[_0x0d24('0x31')]=_[_0x0d24('0x30')](_0x4004d7[_0x0d24('0x2d')],qs[_0x0d24('0x32')](_0x9dd427['query'][_0x0d24('0x32')]));_0x1fbff7[_0x0d24('0x31')]=_0x1fbff7['attributes'][_0x0d24('0x33')]?_0x1fbff7['attributes']:_0x4004d7[_0x0d24('0x2d')];if(_0x9dd427[_0x0d24('0x2e')]['includeAll']){_0x1fbff7[_0x0d24('0x3c')]=[{'all':!![]}];}_0x1fbff7=_[_0x0d24('0x40')]({},_0x1fbff7,_0x9dd427[_0x0d24('0x3a')]);return db[_0x0d24('0x2a')][_0x0d24('0x41')](_0x1fbff7)[_0x0d24('0x24')](handleEntityNotFound(_0x119152,null))[_0x0d24('0x24')](respondWithResult(_0x119152,null))[_0x0d24('0x42')](handleError(_0x119152,null));};exports[_0x0d24('0x43')]=function(_0x211bea,_0x149ea2){return db[_0x0d24('0x2a')]['create'](_0x211bea[_0x0d24('0x44')],{})[_0x0d24('0x24')](respondWithResult(_0x149ea2,0xc9))[_0x0d24('0x42')](handleError(_0x149ea2,null));};exports[_0x0d24('0x23')]=function(_0x39e695,_0xfc9d42){if(_0x39e695[_0x0d24('0x44')]['id']){delete _0x39e695['body']['id'];}return db['FreshdeskAccount'][_0x0d24('0x41')]({'where':{'id':_0x39e695[_0x0d24('0x45')]['id']}})[_0x0d24('0x24')](handleEntityNotFound(_0xfc9d42,null))[_0x0d24('0x24')](saveUpdates(_0x39e695['body'],null))[_0x0d24('0x24')](respondWithResult(_0xfc9d42,null))[_0x0d24('0x42')](handleError(_0xfc9d42,null));};exports[_0x0d24('0x46')]=function(_0x5544ff,_0x1c52f2){return db[_0x0d24('0x2a')][_0x0d24('0x41')]({'where':{'id':_0x5544ff[_0x0d24('0x45')]['id']}})[_0x0d24('0x24')](handleEntityNotFound(_0x1c52f2,null))[_0x0d24('0x24')](removeEntity(_0x1c52f2,null))[_0x0d24('0x42')](handleError(_0x1c52f2,null));};exports['getConfigurations']=function(_0x574242,_0x141c37,_0x3bc338){var _0xbf0dc0={};var _0x5e1df1={};var _0x3d7e8e;var _0x306897;return db[_0x0d24('0x2a')][_0x0d24('0x47')]({'where':{'id':_0x574242[_0x0d24('0x45')]['id']}})[_0x0d24('0x24')](handleEntityNotFound(_0x141c37,null))[_0x0d24('0x24')](function(_0x4e2969){if(_0x4e2969){_0x3d7e8e=_0x4e2969;_0x5e1df1[_0x0d24('0x2d')]=_[_0x0d24('0x2f')](db[_0x0d24('0x48')][_0x0d24('0x2b')]);_0x5e1df1[_0x0d24('0x2e')]=_['keys'](_0x574242[_0x0d24('0x2e')]);_0x5e1df1[_0x0d24('0x49')]=_[_0x0d24('0x30')](_0x5e1df1[_0x0d24('0x2d')],_0x5e1df1[_0x0d24('0x2e')]);_0xbf0dc0['attributes']=_[_0x0d24('0x30')](_0x5e1df1['model'],qs[_0x0d24('0x32')](_0x574242[_0x0d24('0x2e')]['fields']));_0xbf0dc0[_0x0d24('0x31')]=_0xbf0dc0[_0x0d24('0x31')][_0x0d24('0x33')]?_0xbf0dc0[_0x0d24('0x31')]:_0x5e1df1[_0x0d24('0x2d')];_0xbf0dc0[_0x0d24('0x4a')]=qs[_0x0d24('0x35')](_0x574242[_0x0d24('0x2e')][_0x0d24('0x35')]);_0xbf0dc0[_0x0d24('0x36')]=qs[_0x0d24('0x49')](_[_0x0d24('0x4b')](_0x574242[_0x0d24('0x2e')],_0x5e1df1[_0x0d24('0x49')]));if(_0x574242[_0x0d24('0x2e')]['filter']){_0xbf0dc0[_0x0d24('0x36')]=_[_0x0d24('0x40')](_0xbf0dc0[_0x0d24('0x36')],{'$or':_[_0x0d24('0x29')](_0xbf0dc0[_0x0d24('0x31')],function(_0x3a347e){var _0x147461={};_0x147461[_0x3a347e]={'$like':'%'+_0x574242[_0x0d24('0x2e')][_0x0d24('0x39')]+'%'};return _0x147461;})});}_0xbf0dc0=_['merge']({},_0xbf0dc0,_0x574242[_0x0d24('0x3a')]);return _0x3d7e8e['getConfigurations'](_0xbf0dc0);}})[_0x0d24('0x24')](function(_0x24ce98){if(_0x24ce98){_0x306897=_0x24ce98[_0x0d24('0x33')];if(!_0x574242[_0x0d24('0x2e')]['hasOwnProperty'](_0x0d24('0x34'))){_0xbf0dc0[_0x0d24('0x1b')]=qs[_0x0d24('0x1b')](_0x574242[_0x0d24('0x2e')]['limit']);_0xbf0dc0[_0x0d24('0x1a')]=qs[_0x0d24('0x1a')](_0x574242[_0x0d24('0x2e')]['offset']);}return _0x3d7e8e['getConfigurations'](_0xbf0dc0);}})[_0x0d24('0x24')](function(_0x476c62){if(_0x476c62){return _0x476c62?{'count':_0x306897,'rows':_0x476c62}:null;}})[_0x0d24('0x24')](respondWithResult(_0x141c37,null))['catch'](handleError(_0x141c37,null));};exports[_0x0d24('0x4c')]=function(_0x5a91db,_0x4794cf,_0x3f711d){if(_0x5a91db['body']['id']){delete _0x5a91db[_0x0d24('0x44')]['id'];}return db['FreshdeskAccount'][_0x0d24('0x47')]({'where':{'id':_0x5a91db[_0x0d24('0x45')]['id']}})[_0x0d24('0x24')](handleEntityNotFound(_0x4794cf,null))[_0x0d24('0x24')](function(_0x957841){if(_0x957841){_0x5a91db['body'][_0x0d24('0x4d')]=_0x957841['id'];_0x5a91db[_0x0d24('0x44')][_0x0d24('0x4e')]=integrations[_0x0d24('0x4f')](_0x5a91db[_0x0d24('0x44')][_0x0d24('0x50')],_0x5a91db[_0x0d24('0x44')][_0x0d24('0x37')]);_0x5a91db[_0x0d24('0x44')][_0x0d24('0x51')]=integrations[_0x0d24('0x52')](_0x5a91db[_0x0d24('0x44')][_0x0d24('0x50')],_0x5a91db[_0x0d24('0x44')][_0x0d24('0x37')]);return db['FreshdeskConfiguration'][_0x0d24('0x43')](_0x5a91db[_0x0d24('0x44')],{'include':[{'model':db['FreshdeskField'],'as':_0x0d24('0x4e')},{'model':db[_0x0d24('0x53')],'as':_0x0d24('0x51')}]});}return null;})[_0x0d24('0x24')](respondWithResult(_0x4794cf,null))['catch'](handleError(_0x4794cf,null));};exports[_0x0d24('0x54')]=function(_0x3ba9b6,_0x2248bf,_0x24639d){var _0x515309='';return db[_0x0d24('0x2a')][_0x0d24('0x47')]({'where':{'id':_0x3ba9b6[_0x0d24('0x45')]['id']},'attributes':['id',_0x0d24('0x55'),_0x0d24('0x56')]})[_0x0d24('0x24')](handleEntityNotFound(_0x2248bf,null))[_0x0d24('0x24')](function(_0xbe28b9){if(_0xbe28b9){_0x515309=_0xbe28b9[_0x0d24('0x55')];var _0x187cc1=_0x515309[_0x0d24('0x57')](-0x1);if(_0x187cc1==='/'){_0x515309=_0x515309[_0x0d24('0x58')](0x0,_0x515309[_0x0d24('0x59')](_0x187cc1));}return rp({'method':'GET','uri':util[_0x0d24('0x5a')](_0x0d24('0x5b'),_0x515309,'api/v2/ticket_fields'),'headers':{'Authorization':util[_0x0d24('0x5a')]('Basic\x20%s',new Buffer(util[_0x0d24('0x5a')]('%s:X',_0xbe28b9['apiKey']))[_0x0d24('0x5c')]('base64'))},'json':!![]});}})[_0x0d24('0x24')](function(_0xd836d4){if(_0xd836d4){var _0x134063=['requester',_0x0d24('0x5d'),_0x0d24('0x5e'),_0x0d24('0x5f'),'status',_0x0d24('0x60'),_0x0d24('0x61'),_0x0d24('0x62'),_0x0d24('0x63'),_0x0d24('0x61'),_0x0d24('0x64')];_[_0x0d24('0x65')](_0xd836d4,function(_0x31e6c7){return _0x134063['includes'](_0x31e6c7[_0x0d24('0x28')])||!_0x31e6c7[_0x0d24('0x66')]&&_0x31e6c7[_0x0d24('0x37')]!==_0x0d24('0x67')&&_0x31e6c7[_0x0d24('0x37')]!=='custom_dropdown';});return{'count':_0xd836d4[_0x0d24('0x33')],'rows':_[_0x0d24('0x29')](_0xd836d4,function(_0x29a08a){return{'id':_0x29a08a[_0x0d24('0x28')],'name':_0x29a08a[_0x0d24('0x68')],'custom':!_0x29a08a[_0x0d24('0x66')],'options':_0x29a08a['choices']?_[_0x0d24('0x29')](_0x29a08a['choices'],function(_0x4d0314){return{'name':_[_0x0d24('0x69')](_0x4d0314),'value':_0x4d0314};}):[]};})};}})[_0x0d24('0x24')](respondWithResult(_0x2248bf,null))[_0x0d24('0x42')](function(_0x116066){var _0x43bb46=_0x3ba9b6['query'][_0x0d24('0x6a')]?0x1f4:_0x116066[_0x0d24('0x6b')]||0x1f4;logger[_0x0d24('0x26')](_0x0d24('0x6c'),_0x0d24('0x54'),_0x43bb46,JSON[_0x0d24('0x6d')](_0x116066));delete _0x116066[_0x0d24('0x28')];if(_0x43bb46===0x191){_0x43bb46=0x190;}_0x2248bf[_0x0d24('0x17')](_0x43bb46)['send'](_0x3ba9b6['query'][_0x0d24('0x6a')]?{'message':'Wrong\x20credentials','statusCode':_0x116066[_0x0d24('0x6b')]}:_0x116066);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 4702b1b..b82d2e4 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 _0x75fe=['bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','define','FreshdeskAccount','int_freshdesk_accounts','lodash','../../config/logger','api','moment'];(function(_0x424895,_0x14c6f8){var _0xbf70ff=function(_0x2aacf5){while(--_0x2aacf5){_0x424895['push'](_0x424895['shift']());}};_0xbf70ff(++_0x14c6f8);}(_0x75fe,0x182));var _0xe75f=function(_0x1b4052,_0x1652ac){_0x1b4052=_0x1b4052-0x0;var _0x4e6cd8=_0x75fe[_0x1b4052];return _0x4e6cd8;};'use strict';var _=require(_0xe75f('0x0'));var util=require('util');var logger=require(_0xe75f('0x1'))(_0xe75f('0x2'));var moment=require(_0xe75f('0x3'));var BPromise=require(_0xe75f('0x4'));var rp=require(_0xe75f('0x5'));var fs=require('fs');var path=require(_0xe75f('0x6'));var rimraf=require(_0xe75f('0x7'));var config=require(_0xe75f('0x8'));var attributes=require('./intFreshdeskAccount.attributes');var integrations=require(_0xe75f('0x9'));module['exports']=function(_0x400d52,_0x39b7e5){return _0x400d52[_0xe75f('0xa')](_0xe75f('0xb'),attributes,{'tableName':_0xe75f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x67b1=['rimraf','../../config/environment','./intFreshdeskAccount.attributes','exports','define','FreshdeskAccount','int_freshdesk_accounts','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x5d4b59,_0x2bb4b4){var _0x1bdecf=function(_0x2876a0){while(--_0x2876a0){_0x5d4b59['push'](_0x5d4b59['shift']());}};_0x1bdecf(++_0x2bb4b4);}(_0x67b1,0x12d));var _0x167b=function(_0x130705,_0x2d266b){_0x130705=_0x130705-0x0;var _0x1fa991=_0x67b1[_0x130705];return _0x1fa991;};'use strict';var _=require(_0x167b('0x0'));var util=require(_0x167b('0x1'));var logger=require(_0x167b('0x2'))(_0x167b('0x3'));var moment=require('moment');var BPromise=require(_0x167b('0x4'));var rp=require(_0x167b('0x5'));var fs=require('fs');var path=require(_0x167b('0x6'));var rimraf=require(_0x167b('0x7'));var config=require(_0x167b('0x8'));var attributes=require(_0x167b('0x9'));var integrations=require('../../components/integrations/configuration');module[_0x167b('0xa')]=function(_0x3cc326,_0x46448){return _0x3cc326[_0x167b('0xb')](_0x167b('0xc'),attributes,{'tableName':_0x167b('0xd'),'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 fd4f5da..01139a4 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 _0xf620=['util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','FreshdeskAccount,\x20%s,\x20%s','message','GetFreshdeskAccount','findAll','raw','options','attributes','limit','include','model','debug','stringify','FreshdeskAccount','find','map','ShowFreshdeskAccount','lodash'];(function(_0x3ceeb4,_0x909aae){var _0x39070a=function(_0x54042d){while(--_0x54042d){_0x3ceeb4['push'](_0x3ceeb4['shift']());}};_0x39070a(++_0x909aae);}(_0xf620,0x197));var _0x0f62=function(_0x1edd84,_0x4fabf2){_0x1edd84=_0x1edd84-0x0;var _0x2160cf=_0xf620[_0x1edd84];return _0x2160cf;};'use strict';var _=require(_0x0f62('0x0'));var util=require(_0x0f62('0x1'));var moment=require(_0x0f62('0x2'));var BPromise=require(_0x0f62('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0f62('0x4'));var db=require(_0x0f62('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x0f62('0x6'));var config=require(_0x0f62('0x7'));var jayson=require(_0x0f62('0x8'));var client=jayson[_0x0f62('0x9')][_0x0f62('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xde828a,_0x4aa40c,_0x169451){return new BPromise(function(_0x4575d1,_0x20789c){return client[_0x0f62('0xb')](_0xde828a,_0x169451)[_0x0f62('0xc')](function(_0xe35873){logger[_0x0f62('0xd')]('FreshdeskAccount,\x20%s,\x20%s',_0x4aa40c,'request\x20sent');logger['debug'](_0x0f62('0xe'),_0x4aa40c,_0x0f62('0xf'),JSON['stringify'](_0xe35873));if(_0xe35873['error']){if(_0xe35873['error'][_0x0f62('0x10')]===0x1f4){logger[_0x0f62('0x11')](_0x0f62('0x12'),_0x4aa40c,_0xe35873[_0x0f62('0x11')][_0x0f62('0x13')]);return _0x20789c(_0xe35873[_0x0f62('0x11')]['message']);}logger[_0x0f62('0x11')](_0x0f62('0x12'),_0x4aa40c,_0xe35873[_0x0f62('0x11')]['message']);return _0x4575d1(_0xe35873[_0x0f62('0x11')][_0x0f62('0x13')]);}else{logger[_0x0f62('0xd')](_0x0f62('0x12'),_0x4aa40c,_0x0f62('0xf'));_0x4575d1(_0xe35873['result'][_0x0f62('0x13')]);}})['catch'](function(_0x5037f2){logger['error'](_0x0f62('0x12'),_0x4aa40c,_0x5037f2);_0x20789c(_0x5037f2);});});}exports[_0x0f62('0x14')]=function(_0x299a5a){var _0x273f11=this;return new Promise(function(_0x535452,_0x46576d){return db['FreshdeskAccount'][_0x0f62('0x15')]({'raw':_0x299a5a['options']?_0x299a5a['options'][_0x0f62('0x16')]===undefined?!![]:![]:!![],'where':_0x299a5a[_0x0f62('0x17')]?_0x299a5a['options']['where']||null:null,'attributes':_0x299a5a[_0x0f62('0x17')]?_0x299a5a['options'][_0x0f62('0x18')]||null:null,'limit':_0x299a5a[_0x0f62('0x17')]?_0x299a5a[_0x0f62('0x17')][_0x0f62('0x19')]||null:null,'include':_0x299a5a[_0x0f62('0x17')]?_0x299a5a[_0x0f62('0x17')][_0x0f62('0x1a')]?_['map'](_0x299a5a[_0x0f62('0x17')][_0x0f62('0x1a')],function(_0x40efd7){return{'model':db[_0x40efd7[_0x0f62('0x1b')]],'as':_0x40efd7['as'],'attributes':_0x40efd7[_0x0f62('0x18')],'include':_0x40efd7['include']?_['map'](_0x40efd7[_0x0f62('0x1a')],function(_0x567f3e){return{'model':db[_0x567f3e[_0x0f62('0x1b')]],'as':_0x567f3e['as'],'attributes':_0x567f3e[_0x0f62('0x18')],'include':_0x567f3e['include']?_['map'](_0x567f3e['include'],function(_0x3a3877){return{'model':db[_0x3a3877['model']],'as':_0x3a3877['as'],'attributes':_0x3a3877['attributes']};}):[]};}):[]};}):[]:[]})[_0x0f62('0xc')](function(_0x420fe3){logger[_0x0f62('0xd')](_0x0f62('0x14'),_0x299a5a);logger[_0x0f62('0x1c')](_0x0f62('0x14'),_0x299a5a,JSON[_0x0f62('0x1d')](_0x420fe3));_0x535452(_0x420fe3);})['catch'](function(_0x1c7672){logger[_0x0f62('0x11')](_0x0f62('0x14'),_0x1c7672['message'],_0x299a5a);_0x46576d(_0x273f11['error'](0x1f4,_0x1c7672['message']));});});};exports['ShowFreshdeskAccount']=function(_0x4c89fc){var _0x27d515=this;return new Promise(function(_0x324918,_0x5355e0){return db[_0x0f62('0x1e')][_0x0f62('0x1f')]({'raw':_0x4c89fc[_0x0f62('0x17')]?_0x4c89fc[_0x0f62('0x17')][_0x0f62('0x16')]===undefined?!![]:![]:!![],'where':_0x4c89fc[_0x0f62('0x17')]?_0x4c89fc[_0x0f62('0x17')]['where']||null:null,'attributes':_0x4c89fc[_0x0f62('0x17')]?_0x4c89fc[_0x0f62('0x17')]['attributes']||null:null,'include':_0x4c89fc[_0x0f62('0x17')]?_0x4c89fc['options']['include']?_['map'](_0x4c89fc[_0x0f62('0x17')][_0x0f62('0x1a')],function(_0x1b8a31){return{'model':db[_0x1b8a31[_0x0f62('0x1b')]],'as':_0x1b8a31['as'],'attributes':_0x1b8a31[_0x0f62('0x18')],'include':_0x1b8a31[_0x0f62('0x1a')]?_[_0x0f62('0x20')](_0x1b8a31[_0x0f62('0x1a')],function(_0x287568){return{'model':db[_0x287568[_0x0f62('0x1b')]],'as':_0x287568['as'],'attributes':_0x287568[_0x0f62('0x18')],'include':_0x287568[_0x0f62('0x1a')]?_[_0x0f62('0x20')](_0x287568[_0x0f62('0x1a')],function(_0x55cc31){return{'model':db[_0x55cc31[_0x0f62('0x1b')]],'as':_0x55cc31['as'],'attributes':_0x55cc31[_0x0f62('0x18')]};}):[]};}):[]};}):[]:[]})[_0x0f62('0xc')](function(_0x39b8b4){logger['info'](_0x0f62('0x21'),_0x4c89fc);logger['debug'](_0x0f62('0x21'),_0x4c89fc,JSON[_0x0f62('0x1d')](_0x39b8b4));_0x324918(_0x39b8b4);})['catch'](function(_0x3e45ea){logger[_0x0f62('0x11')](_0x0f62('0x21'),_0x3e45ea[_0x0f62('0x13')],_0x4c89fc);_0x5355e0(_0x27d515['error'](0x1f4,_0x3e45ea['message']));});});}; \ No newline at end of file +var _0xbd48=['error','code','message','result','catch','findAll','options','raw','where','attributes','limit','include','map','model','then','GetFreshdeskAccount','ShowFreshdeskAccount','FreshdeskAccount','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xbd48,0x124));var _0x8bd4=function(_0x586d83,_0x2ddb2d){_0x586d83=_0x586d83-0x0;var _0x54460e=_0xbd48[_0x586d83];return _0x54460e;};'use strict';var _=require(_0x8bd4('0x0'));var util=require(_0x8bd4('0x1'));var moment=require(_0x8bd4('0x2'));var BPromise=require(_0x8bd4('0x3'));var rs=require(_0x8bd4('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8bd4('0x5'))['db'];var utils=require(_0x8bd4('0x6'));var logger=require(_0x8bd4('0x7'))(_0x8bd4('0x8'));var config=require(_0x8bd4('0x9'));var jayson=require(_0x8bd4('0xa'));var client=jayson[_0x8bd4('0xb')][_0x8bd4('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x545622,_0x1df015,_0x2ede5d){return new BPromise(function(_0x488953,_0x5f4a58){return client[_0x8bd4('0xd')](_0x545622,_0x2ede5d)['then'](function(_0x1f49ec){logger[_0x8bd4('0xe')](_0x8bd4('0xf'),_0x1df015,_0x8bd4('0x10'));logger[_0x8bd4('0x11')](_0x8bd4('0x12'),_0x1df015,'request\x20sent',JSON[_0x8bd4('0x13')](_0x1f49ec));if(_0x1f49ec[_0x8bd4('0x14')]){if(_0x1f49ec[_0x8bd4('0x14')][_0x8bd4('0x15')]===0x1f4){logger[_0x8bd4('0x14')](_0x8bd4('0xf'),_0x1df015,_0x1f49ec['error'][_0x8bd4('0x16')]);return _0x5f4a58(_0x1f49ec[_0x8bd4('0x14')][_0x8bd4('0x16')]);}logger[_0x8bd4('0x14')](_0x8bd4('0xf'),_0x1df015,_0x1f49ec['error']['message']);return _0x488953(_0x1f49ec['error'][_0x8bd4('0x16')]);}else{logger[_0x8bd4('0xe')](_0x8bd4('0xf'),_0x1df015,'request\x20sent');_0x488953(_0x1f49ec[_0x8bd4('0x17')][_0x8bd4('0x16')]);}})[_0x8bd4('0x18')](function(_0x3d6a44){logger[_0x8bd4('0x14')](_0x8bd4('0xf'),_0x1df015,_0x3d6a44);_0x5f4a58(_0x3d6a44);});});}exports['GetFreshdeskAccount']=function(_0x575788){var _0x4c4c46=this;return new Promise(function(_0x3fef97,_0x427f3e){return db['FreshdeskAccount'][_0x8bd4('0x19')]({'raw':_0x575788[_0x8bd4('0x1a')]?_0x575788[_0x8bd4('0x1a')][_0x8bd4('0x1b')]===undefined?!![]:![]:!![],'where':_0x575788['options']?_0x575788['options'][_0x8bd4('0x1c')]||null:null,'attributes':_0x575788['options']?_0x575788[_0x8bd4('0x1a')][_0x8bd4('0x1d')]||null:null,'limit':_0x575788[_0x8bd4('0x1a')]?_0x575788[_0x8bd4('0x1a')][_0x8bd4('0x1e')]||null:null,'include':_0x575788[_0x8bd4('0x1a')]?_0x575788[_0x8bd4('0x1a')][_0x8bd4('0x1f')]?_[_0x8bd4('0x20')](_0x575788[_0x8bd4('0x1a')][_0x8bd4('0x1f')],function(_0x5508b2){return{'model':db[_0x5508b2[_0x8bd4('0x21')]],'as':_0x5508b2['as'],'attributes':_0x5508b2['attributes'],'include':_0x5508b2['include']?_[_0x8bd4('0x20')](_0x5508b2['include'],function(_0x471314){return{'model':db[_0x471314[_0x8bd4('0x21')]],'as':_0x471314['as'],'attributes':_0x471314[_0x8bd4('0x1d')],'include':_0x471314[_0x8bd4('0x1f')]?_['map'](_0x471314['include'],function(_0x170ad3){return{'model':db[_0x170ad3[_0x8bd4('0x21')]],'as':_0x170ad3['as'],'attributes':_0x170ad3[_0x8bd4('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x8bd4('0x22')](function(_0x22c9ff){logger['info'](_0x8bd4('0x23'),_0x575788);logger[_0x8bd4('0x11')](_0x8bd4('0x23'),_0x575788,JSON[_0x8bd4('0x13')](_0x22c9ff));_0x3fef97(_0x22c9ff);})[_0x8bd4('0x18')](function(_0x5bde5a){logger[_0x8bd4('0x14')]('GetFreshdeskAccount',_0x5bde5a['message'],_0x575788);_0x427f3e(_0x4c4c46['error'](0x1f4,_0x5bde5a[_0x8bd4('0x16')]));});});};exports[_0x8bd4('0x24')]=function(_0xf70840){var _0x5dceef=this;return new Promise(function(_0x504cac,_0x1b7d8b){return db[_0x8bd4('0x25')][_0x8bd4('0x26')]({'raw':_0xf70840[_0x8bd4('0x1a')]?_0xf70840[_0x8bd4('0x1a')][_0x8bd4('0x1b')]===undefined?!![]:![]:!![],'where':_0xf70840[_0x8bd4('0x1a')]?_0xf70840['options'][_0x8bd4('0x1c')]||null:null,'attributes':_0xf70840['options']?_0xf70840[_0x8bd4('0x1a')][_0x8bd4('0x1d')]||null:null,'include':_0xf70840[_0x8bd4('0x1a')]?_0xf70840[_0x8bd4('0x1a')][_0x8bd4('0x1f')]?_[_0x8bd4('0x20')](_0xf70840[_0x8bd4('0x1a')][_0x8bd4('0x1f')],function(_0x39cc62){return{'model':db[_0x39cc62[_0x8bd4('0x21')]],'as':_0x39cc62['as'],'attributes':_0x39cc62[_0x8bd4('0x1d')],'include':_0x39cc62['include']?_[_0x8bd4('0x20')](_0x39cc62['include'],function(_0x543885){return{'model':db[_0x543885['model']],'as':_0x543885['as'],'attributes':_0x543885[_0x8bd4('0x1d')],'include':_0x543885[_0x8bd4('0x1f')]?_[_0x8bd4('0x20')](_0x543885[_0x8bd4('0x1f')],function(_0x71b77f){return{'model':db[_0x71b77f['model']],'as':_0x71b77f['as'],'attributes':_0x71b77f[_0x8bd4('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x8bd4('0x22')](function(_0x33df0d){logger[_0x8bd4('0xe')](_0x8bd4('0x24'),_0xf70840);logger[_0x8bd4('0x11')](_0x8bd4('0x24'),_0xf70840,JSON['stringify'](_0x33df0d));_0x504cac(_0x33df0d);})[_0x8bd4('0x18')](function(_0x398f97){logger[_0x8bd4('0x14')](_0x8bd4('0x24'),_0x398f97['message'],_0xf70840);_0x1b7d8b(_0x5dceef[_0x8bd4('0x14')](0x1f4,_0x398f97[_0x8bd4('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 75a3269..0ec63a6 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 _0xe350=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','/:id/tags','getTags','post','create','put','update','delete','destroy','exports','multer','path','Router','fs-extra'];(function(_0x17c5bf,_0x20f3e5){var _0x1cce18=function(_0x464a16){while(--_0x464a16){_0x17c5bf['push'](_0x17c5bf['shift']());}};_0x1cce18(++_0x20f3e5);}(_0xe350,0x1ac));var _0x0e35=function(_0x464470,_0x33ca44){_0x464470=_0x464470-0x0;var _0x3f8444=_0xe350[_0x464470];return _0x3f8444;};'use strict';var multer=require(_0x0e35('0x0'));var util=require('util');var path=require(_0x0e35('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0e35('0x2')]();var fs_extra=require(_0x0e35('0x3'));var auth=require(_0x0e35('0x4'));var interaction=require(_0x0e35('0x5'));var config=require(_0x0e35('0x6'));var controller=require(_0x0e35('0x7'));router[_0x0e35('0x8')]('/',auth['isAuthenticated'](),controller[_0x0e35('0x9')]);router[_0x0e35('0x8')](_0x0e35('0xa'),auth[_0x0e35('0xb')](),controller[_0x0e35('0xc')]);router[_0x0e35('0x8')](_0x0e35('0xd'),auth[_0x0e35('0xb')](),controller[_0x0e35('0xe')]);router[_0x0e35('0x8')](_0x0e35('0xf'),auth[_0x0e35('0xb')](),controller[_0x0e35('0x10')]);router['get'](_0x0e35('0x11'),auth[_0x0e35('0xb')](),controller['getDescriptions']);router['get'](_0x0e35('0x12'),auth[_0x0e35('0xb')](),controller[_0x0e35('0x13')]);router[_0x0e35('0x14')]('/',auth[_0x0e35('0xb')](),controller[_0x0e35('0x15')]);router[_0x0e35('0x14')]('/:id/tags',auth[_0x0e35('0xb')](),controller['setTags']);router[_0x0e35('0x16')]('/:id',auth[_0x0e35('0xb')](),controller[_0x0e35('0x17')]);router[_0x0e35('0x18')](_0x0e35('0xa'),auth[_0x0e35('0xb')](),controller[_0x0e35('0x19')]);module[_0x0e35('0x1a')]=router; \ No newline at end of file +var _0x9f6f=['update','delete','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intFreshdeskConfiguration.controller','get','show','isAuthenticated','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','getTags','post','create','/:id/tags','setTags','put','/:id'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x9f6f,0xb1));var _0xf9f6=function(_0x4eafd4,_0x536fe5){_0x4eafd4=_0x4eafd4-0x0;var _0x3b7db3=_0x9f6f[_0x4eafd4];return _0x3b7db3;};'use strict';var multer=require('multer');var util=require(_0xf9f6('0x0'));var path=require(_0xf9f6('0x1'));var timeout=require(_0xf9f6('0x2'));var express=require(_0xf9f6('0x3'));var router=express[_0xf9f6('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf9f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf9f6('0x6'));var controller=require(_0xf9f6('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xf9f6('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xf9f6('0x9')]);router[_0xf9f6('0x8')]('/:id/fields',auth[_0xf9f6('0xa')](),controller[_0xf9f6('0xb')]);router[_0xf9f6('0x8')](_0xf9f6('0xc'),auth['isAuthenticated'](),controller[_0xf9f6('0xd')]);router[_0xf9f6('0x8')](_0xf9f6('0xe'),auth[_0xf9f6('0xa')](),controller[_0xf9f6('0xf')]);router[_0xf9f6('0x8')]('/:id/tags',auth[_0xf9f6('0xa')](),controller[_0xf9f6('0x10')]);router[_0xf9f6('0x11')]('/',auth[_0xf9f6('0xa')](),controller[_0xf9f6('0x12')]);router[_0xf9f6('0x11')](_0xf9f6('0x13'),auth[_0xf9f6('0xa')](),controller[_0xf9f6('0x14')]);router[_0xf9f6('0x15')](_0xf9f6('0x16'),auth[_0xf9f6('0xa')](),controller[_0xf9f6('0x17')]);router[_0xf9f6('0x18')](_0xf9f6('0x16'),auth[_0xf9f6('0xa')](),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 ba40a72..5115272 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 _0xc6cb=['STRING','sequelize'];(function(_0x228ab4,_0x5cb3da){var _0x4e1fd1=function(_0x1bd7cb){while(--_0x1bd7cb){_0x228ab4['push'](_0x228ab4['shift']());}};_0x4e1fd1(++_0x5cb3da);}(_0xc6cb,0x87));var _0xbc6c=function(_0x450b7d,_0x161564){_0x450b7d=_0x450b7d-0x0;var _0x206e46=_0xc6cb[_0x450b7d];return _0x206e46;};'use strict';var Sequelize=require(_0xbc6c('0x0'));module['exports']={'name':{'type':Sequelize[_0xbc6c('0x1')]},'description':{'type':Sequelize[_0xbc6c('0x1')]}}; \ No newline at end of file +var _0xa647=['exports','STRING','sequelize'];(function(_0x1cdc4d,_0x22db79){var _0x4e965a=function(_0x9f4d1e){while(--_0x9f4d1e){_0x1cdc4d['push'](_0x1cdc4d['shift']());}};_0x4e965a(++_0x22db79);}(_0xa647,0x17f));var _0x7a64=function(_0x429a33,_0x2620b0){_0x429a33=_0x429a33-0x0;var _0x19008f=_0xa647[_0x429a33];return _0x19008f;};'use strict';var Sequelize=require(_0x7a64('0x0'));module[_0x7a64('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x7a64('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 500c097..45025e5 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 _0x3b4f=['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','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','end','error','name','send','index','map','FreshdeskConfiguration','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filters','filter','merge','options','includeAll','findAll','rows','catch','show','params','include','create','body','find','destroy','getFields','findOne','FreshdeskField','hasOwnProperty','getSubjects','getDescriptions','getTags','Tag','setTags','ids'];(function(_0x4f88fe,_0x142997){var _0x52bbc0=function(_0xf1b466){while(--_0xf1b466){_0x4f88fe['push'](_0x4f88fe['shift']());}};_0x52bbc0(++_0x142997);}(_0x3b4f,0x1bd));var _0xf3b4=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x3b4f[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require(_0xf3b4('0x0'));var rimraf=require(_0xf3b4('0x1'));var zipdir=require(_0xf3b4('0x2'));var jsonpatch=require(_0xf3b4('0x3'));var rp=require(_0xf3b4('0x4'));var moment=require(_0xf3b4('0x5'));var BPromise=require(_0xf3b4('0x6'));var Mustache=require('mustache');var util=require(_0xf3b4('0x7'));var path=require(_0xf3b4('0x8'));var sox=require(_0xf3b4('0x9'));var csv=require(_0xf3b4('0xa'));var ejs=require(_0xf3b4('0xb'));var fs=require('fs');var fs_extra=require(_0xf3b4('0xc'));var _=require('lodash');var squel=require(_0xf3b4('0xd'));var crypto=require(_0xf3b4('0xe'));var jsforce=require(_0xf3b4('0xf'));var deskjs=require(_0xf3b4('0x10'));var toCsv=require('to-csv');var querystring=require(_0xf3b4('0x11'));var Papa=require(_0xf3b4('0x12'));var Redis=require('ioredis');var authService=require(_0xf3b4('0x13'));var qs=require(_0xf3b4('0x14'));var as=require(_0xf3b4('0x15'));var hardwareService=require(_0xf3b4('0x16'));var logger=require('../../config/logger')(_0xf3b4('0x17'));var utils=require(_0xf3b4('0x18'));var config=require(_0xf3b4('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xf3b4('0x1a'))['db'];function respondWithStatusCode(_0x561d1e,_0x4c363d){_0x4c363d=_0x4c363d||0xcc;return function(_0x4caea8){if(_0x4caea8){return _0x561d1e[_0xf3b4('0x1b')](_0x4c363d);}return _0x561d1e[_0xf3b4('0x1c')](_0x4c363d)['end']();};}function respondWithResult(_0x4589c,_0xf33b8){_0xf33b8=_0xf33b8||0xc8;return function(_0x37b1fe){if(_0x37b1fe){return _0x4589c[_0xf3b4('0x1c')](_0xf33b8)['json'](_0x37b1fe);}};}function respondWithFilteredResult(_0x439408,_0x2060f9){return function(_0x47c188){if(_0x47c188){var _0x205c0d=typeof _0x2060f9[_0xf3b4('0x1d')]===_0xf3b4('0x1e')&&typeof _0x2060f9['limit']===_0xf3b4('0x1e');var _0x1bb350=_0x47c188[_0xf3b4('0x1f')];var _0x2e3021=_0x205c0d?0x0:_0x2060f9['offset'];var _0x4e54cf=_0x205c0d?_0x47c188[_0xf3b4('0x1f')]:_0x2060f9['offset']+_0x2060f9[_0xf3b4('0x20')];var _0x11244d;if(_0x4e54cf>=_0x1bb350){_0x4e54cf=_0x1bb350;_0x11244d=0xc8;}else{_0x11244d=0xce;}_0x439408['status'](_0x11244d);return _0x439408[_0xf3b4('0x21')](_0xf3b4('0x22'),_0x2e3021+'-'+_0x4e54cf+'/'+_0x1bb350)[_0xf3b4('0x23')](_0x47c188);}return null;};}function patchUpdates(_0x3eaf2e){return function(_0x4d8611){try{jsonpatch[_0xf3b4('0x24')](_0x4d8611,_0x3eaf2e,!![]);}catch(_0x442fdc){return BPromise[_0xf3b4('0x25')](_0x442fdc);}return _0x4d8611[_0xf3b4('0x26')]();};}function saveUpdates(_0x1c8f18,_0x22abf1){return function(_0x3d07a9){if(_0x3d07a9){return _0x3d07a9[_0xf3b4('0x27')](_0x1c8f18)[_0xf3b4('0x28')](function(_0x4e8482){return _0x4e8482;});}return null;};}function removeEntity(_0x4a58f8,_0x25b216){return function(_0x3037b0){if(_0x3037b0){return _0x3037b0['destroy']()[_0xf3b4('0x28')](function(){_0x4a58f8[_0xf3b4('0x1c')](0xcc)[_0xf3b4('0x29')]();});}};}function handleEntityNotFound(_0x2d039b,_0x3459c3){return function(_0x43cfe0){if(!_0x43cfe0){_0x2d039b['sendStatus'](0x194);}return _0x43cfe0;};}function handleError(_0x5b6d01,_0x43626f){_0x43626f=_0x43626f||0x1f4;return function(_0x2c561a){logger[_0xf3b4('0x2a')](_0x2c561a['stack']);if(_0x2c561a['name']){delete _0x2c561a[_0xf3b4('0x2b')];}_0x5b6d01['status'](_0x43626f)[_0xf3b4('0x2c')](_0x2c561a);};}exports[_0xf3b4('0x2d')]=function(_0x4ccda5,_0x5805a2){var _0x46d023={},_0x1698e7={},_0x26f1e7={'count':0x0,'rows':[]};var _0x467026=_[_0xf3b4('0x2e')](db[_0xf3b4('0x2f')][_0xf3b4('0x30')],function(_0x16dd21){return{'name':_0x16dd21[_0xf3b4('0x31')],'type':_0x16dd21[_0xf3b4('0x32')][_0xf3b4('0x33')]};});_0x1698e7[_0xf3b4('0x34')]=_[_0xf3b4('0x2e')](_0x467026,_0xf3b4('0x2b'));_0x1698e7[_0xf3b4('0x35')]=_[_0xf3b4('0x36')](_0x4ccda5[_0xf3b4('0x35')]);_0x1698e7['filters']=_['intersection'](_0x1698e7[_0xf3b4('0x34')],_0x1698e7['query']);_0x46d023[_0xf3b4('0x37')]=_[_0xf3b4('0x38')](_0x1698e7[_0xf3b4('0x34')],qs[_0xf3b4('0x39')](_0x4ccda5[_0xf3b4('0x35')][_0xf3b4('0x39')]));_0x46d023[_0xf3b4('0x37')]=_0x46d023[_0xf3b4('0x37')][_0xf3b4('0x3a')]?_0x46d023[_0xf3b4('0x37')]:_0x1698e7['model'];if(!_0x4ccda5[_0xf3b4('0x35')]['hasOwnProperty'](_0xf3b4('0x3b'))){_0x46d023['limit']=qs[_0xf3b4('0x20')](_0x4ccda5['query'][_0xf3b4('0x20')]);_0x46d023[_0xf3b4('0x1d')]=qs['offset'](_0x4ccda5[_0xf3b4('0x35')]['offset']);}_0x46d023[_0xf3b4('0x3c')]=qs[_0xf3b4('0x3d')](_0x4ccda5['query'][_0xf3b4('0x3d')]);_0x46d023[_0xf3b4('0x3e')]=qs['filters'](_[_0xf3b4('0x3f')](_0x4ccda5[_0xf3b4('0x35')],_0x1698e7[_0xf3b4('0x40')]),_0x467026);if(_0x4ccda5[_0xf3b4('0x35')][_0xf3b4('0x41')]){_0x46d023[_0xf3b4('0x3e')]=_[_0xf3b4('0x42')](_0x46d023['where'],{'$or':_[_0xf3b4('0x2e')](_0x467026,function(_0x525a3f){if(_0x525a3f[_0xf3b4('0x32')]!=='VIRTUAL'){var _0x328465={};_0x328465[_0x525a3f[_0xf3b4('0x2b')]]={'$like':'%'+_0x4ccda5['query'][_0xf3b4('0x41')]+'%'};return _0x328465;}})});}_0x46d023=_['merge']({},_0x46d023,_0x4ccda5[_0xf3b4('0x43')]);var _0x4fb499={'where':_0x46d023['where']};return db['FreshdeskConfiguration'][_0xf3b4('0x1f')](_0x4fb499)[_0xf3b4('0x28')](function(_0x16cf3f){_0x26f1e7[_0xf3b4('0x1f')]=_0x16cf3f;if(_0x4ccda5[_0xf3b4('0x35')][_0xf3b4('0x44')]){_0x46d023['include']=[{'all':!![]}];}return db[_0xf3b4('0x2f')][_0xf3b4('0x45')](_0x46d023);})[_0xf3b4('0x28')](function(_0x25db70){_0x26f1e7[_0xf3b4('0x46')]=_0x25db70;return _0x26f1e7;})['then'](respondWithFilteredResult(_0x5805a2,_0x46d023))[_0xf3b4('0x47')](handleError(_0x5805a2,null));};exports[_0xf3b4('0x48')]=function(_0x2ce4ec,_0x4ee7b3){var _0x36158e={'raw':![],'where':{'id':_0x2ce4ec[_0xf3b4('0x49')]['id']}},_0x367d1b={};_0x367d1b['model']=_[_0xf3b4('0x36')](db[_0xf3b4('0x2f')][_0xf3b4('0x30')]);_0x367d1b[_0xf3b4('0x35')]=_['keys'](_0x2ce4ec['query']);_0x367d1b[_0xf3b4('0x40')]=_[_0xf3b4('0x38')](_0x367d1b[_0xf3b4('0x34')],_0x367d1b['query']);_0x36158e[_0xf3b4('0x37')]=_[_0xf3b4('0x38')](_0x367d1b[_0xf3b4('0x34')],qs[_0xf3b4('0x39')](_0x2ce4ec[_0xf3b4('0x35')][_0xf3b4('0x39')]));_0x36158e[_0xf3b4('0x37')]=_0x36158e[_0xf3b4('0x37')]['length']?_0x36158e[_0xf3b4('0x37')]:_0x367d1b[_0xf3b4('0x34')];if(_0x2ce4ec[_0xf3b4('0x35')]['includeAll']){_0x36158e[_0xf3b4('0x4a')]=[{'all':!![]}];}_0x36158e=_['merge']({},_0x36158e,_0x2ce4ec[_0xf3b4('0x43')]);return db['FreshdeskConfiguration']['find'](_0x36158e)[_0xf3b4('0x28')](handleEntityNotFound(_0x4ee7b3,null))[_0xf3b4('0x28')](respondWithResult(_0x4ee7b3,null))[_0xf3b4('0x47')](handleError(_0x4ee7b3,null));};exports['create']=function(_0x8e595b,_0x547b0e){return db[_0xf3b4('0x2f')][_0xf3b4('0x4b')](_0x8e595b[_0xf3b4('0x4c')],{})['then'](respondWithResult(_0x547b0e,0xc9))[_0xf3b4('0x47')](handleError(_0x547b0e,null));};exports['update']=function(_0x3587e2,_0x3fc95b){if(_0x3587e2[_0xf3b4('0x4c')]['id']){delete _0x3587e2[_0xf3b4('0x4c')]['id'];}return db['FreshdeskConfiguration'][_0xf3b4('0x4d')]({'where':{'id':_0x3587e2[_0xf3b4('0x49')]['id']}})[_0xf3b4('0x28')](handleEntityNotFound(_0x3fc95b,null))[_0xf3b4('0x28')](saveUpdates(_0x3587e2[_0xf3b4('0x4c')],null))[_0xf3b4('0x28')](respondWithResult(_0x3fc95b,null))[_0xf3b4('0x47')](handleError(_0x3fc95b,null));};exports[_0xf3b4('0x4e')]=function(_0x1ad7f9,_0x5342c2){return db['FreshdeskConfiguration'][_0xf3b4('0x4d')]({'where':{'id':_0x1ad7f9['params']['id']}})[_0xf3b4('0x28')](handleEntityNotFound(_0x5342c2,null))[_0xf3b4('0x28')](removeEntity(_0x5342c2,null))[_0xf3b4('0x47')](handleError(_0x5342c2,null));};exports[_0xf3b4('0x4f')]=function(_0x53fc5e,_0x2ed132,_0x1ed361){var _0x2e573c={};var _0x833149={};var _0x1e7aee;var _0x2006e3;return db[_0xf3b4('0x2f')][_0xf3b4('0x50')]({'where':{'id':_0x53fc5e[_0xf3b4('0x49')]['id']}})[_0xf3b4('0x28')](handleEntityNotFound(_0x2ed132,null))[_0xf3b4('0x28')](function(_0x52d1cd){if(_0x52d1cd){_0x1e7aee=_0x52d1cd;_0x833149[_0xf3b4('0x34')]=_['keys'](db[_0xf3b4('0x51')][_0xf3b4('0x30')]);_0x833149[_0xf3b4('0x35')]=_[_0xf3b4('0x36')](_0x53fc5e[_0xf3b4('0x35')]);_0x833149[_0xf3b4('0x40')]=_['intersection'](_0x833149['model'],_0x833149[_0xf3b4('0x35')]);_0x2e573c[_0xf3b4('0x37')]=_[_0xf3b4('0x38')](_0x833149['model'],qs[_0xf3b4('0x39')](_0x53fc5e[_0xf3b4('0x35')][_0xf3b4('0x39')]));_0x2e573c['attributes']=_0x2e573c[_0xf3b4('0x37')][_0xf3b4('0x3a')]?_0x2e573c[_0xf3b4('0x37')]:_0x833149[_0xf3b4('0x34')];_0x2e573c[_0xf3b4('0x3c')]=qs[_0xf3b4('0x3d')](_0x53fc5e[_0xf3b4('0x35')][_0xf3b4('0x3d')]);_0x2e573c[_0xf3b4('0x3e')]=qs[_0xf3b4('0x40')](_['pick'](_0x53fc5e[_0xf3b4('0x35')],_0x833149[_0xf3b4('0x40')]));if(_0x53fc5e[_0xf3b4('0x35')][_0xf3b4('0x41')]){_0x2e573c[_0xf3b4('0x3e')]=_['merge'](_0x2e573c[_0xf3b4('0x3e')],{'$or':_[_0xf3b4('0x2e')](_0x2e573c[_0xf3b4('0x37')],function(_0xda7a60){var _0x4bc70a={};_0x4bc70a[_0xda7a60]={'$like':'%'+_0x53fc5e[_0xf3b4('0x35')]['filter']+'%'};return _0x4bc70a;})});}_0x2e573c=_[_0xf3b4('0x42')]({},_0x2e573c,_0x53fc5e[_0xf3b4('0x43')]);return _0x1e7aee[_0xf3b4('0x4f')](_0x2e573c);}})['then'](function(_0x3d9429){if(_0x3d9429){_0x2006e3=_0x3d9429[_0xf3b4('0x3a')];if(!_0x53fc5e[_0xf3b4('0x35')][_0xf3b4('0x52')](_0xf3b4('0x3b'))){_0x2e573c['limit']=qs[_0xf3b4('0x20')](_0x53fc5e[_0xf3b4('0x35')]['limit']);_0x2e573c[_0xf3b4('0x1d')]=qs[_0xf3b4('0x1d')](_0x53fc5e['query']['offset']);}return _0x1e7aee[_0xf3b4('0x4f')](_0x2e573c);}})[_0xf3b4('0x28')](function(_0x575321){if(_0x575321){return _0x575321?{'count':_0x2006e3,'rows':_0x575321}:null;}})[_0xf3b4('0x28')](respondWithResult(_0x2ed132,null))[_0xf3b4('0x47')](handleError(_0x2ed132,null));};exports[_0xf3b4('0x53')]=function(_0x3ce2e1,_0x27370d,_0x1cc479){var _0x1cbaaf={};var _0x5757ce={};var _0xcdb92c;var _0x424c97;return db[_0xf3b4('0x2f')][_0xf3b4('0x50')]({'where':{'id':_0x3ce2e1[_0xf3b4('0x49')]['id']}})[_0xf3b4('0x28')](handleEntityNotFound(_0x27370d,null))['then'](function(_0x4fc621){if(_0x4fc621){_0xcdb92c=_0x4fc621;_0x5757ce[_0xf3b4('0x34')]=_[_0xf3b4('0x36')](db[_0xf3b4('0x51')]['rawAttributes']);_0x5757ce['query']=_[_0xf3b4('0x36')](_0x3ce2e1['query']);_0x5757ce[_0xf3b4('0x40')]=_[_0xf3b4('0x38')](_0x5757ce[_0xf3b4('0x34')],_0x5757ce['query']);_0x1cbaaf[_0xf3b4('0x37')]=_[_0xf3b4('0x38')](_0x5757ce[_0xf3b4('0x34')],qs['fields'](_0x3ce2e1['query']['fields']));_0x1cbaaf[_0xf3b4('0x37')]=_0x1cbaaf[_0xf3b4('0x37')][_0xf3b4('0x3a')]?_0x1cbaaf['attributes']:_0x5757ce['model'];_0x1cbaaf[_0xf3b4('0x3c')]=qs['sort'](_0x3ce2e1['query'][_0xf3b4('0x3d')]);_0x1cbaaf[_0xf3b4('0x3e')]=qs[_0xf3b4('0x40')](_['pick'](_0x3ce2e1[_0xf3b4('0x35')],_0x5757ce['filters']));if(_0x3ce2e1[_0xf3b4('0x35')][_0xf3b4('0x41')]){_0x1cbaaf[_0xf3b4('0x3e')]=_[_0xf3b4('0x42')](_0x1cbaaf[_0xf3b4('0x3e')],{'$or':_['map'](_0x1cbaaf[_0xf3b4('0x37')],function(_0x56d7f4){var _0x26dbef={};_0x26dbef[_0x56d7f4]={'$like':'%'+_0x3ce2e1['query'][_0xf3b4('0x41')]+'%'};return _0x26dbef;})});}_0x1cbaaf=_[_0xf3b4('0x42')]({},_0x1cbaaf,_0x3ce2e1[_0xf3b4('0x43')]);return _0xcdb92c[_0xf3b4('0x53')](_0x1cbaaf);}})[_0xf3b4('0x28')](function(_0x4b770e){if(_0x4b770e){_0x424c97=_0x4b770e['length'];if(!_0x3ce2e1['query'][_0xf3b4('0x52')](_0xf3b4('0x3b'))){_0x1cbaaf[_0xf3b4('0x20')]=qs[_0xf3b4('0x20')](_0x3ce2e1[_0xf3b4('0x35')][_0xf3b4('0x20')]);_0x1cbaaf['offset']=qs[_0xf3b4('0x1d')](_0x3ce2e1[_0xf3b4('0x35')][_0xf3b4('0x1d')]);}return _0xcdb92c[_0xf3b4('0x53')](_0x1cbaaf);}})[_0xf3b4('0x28')](function(_0x1feecd){if(_0x1feecd){return _0x1feecd?{'count':_0x424c97,'rows':_0x1feecd}:null;}})['then'](respondWithResult(_0x27370d,null))[_0xf3b4('0x47')](handleError(_0x27370d,null));};exports['getDescriptions']=function(_0x3bf997,_0x2260e3,_0x4ccdfb){var _0x5c5af6={};var _0x874338={};var _0xd30366;var _0x55021d;return db[_0xf3b4('0x2f')][_0xf3b4('0x50')]({'where':{'id':_0x3bf997[_0xf3b4('0x49')]['id']}})[_0xf3b4('0x28')](handleEntityNotFound(_0x2260e3,null))[_0xf3b4('0x28')](function(_0x32bf60){if(_0x32bf60){_0xd30366=_0x32bf60;_0x874338['model']=_['keys'](db['FreshdeskField'][_0xf3b4('0x30')]);_0x874338[_0xf3b4('0x35')]=_[_0xf3b4('0x36')](_0x3bf997['query']);_0x874338[_0xf3b4('0x40')]=_[_0xf3b4('0x38')](_0x874338['model'],_0x874338[_0xf3b4('0x35')]);_0x5c5af6[_0xf3b4('0x37')]=_[_0xf3b4('0x38')](_0x874338[_0xf3b4('0x34')],qs[_0xf3b4('0x39')](_0x3bf997[_0xf3b4('0x35')][_0xf3b4('0x39')]));_0x5c5af6[_0xf3b4('0x37')]=_0x5c5af6[_0xf3b4('0x37')][_0xf3b4('0x3a')]?_0x5c5af6['attributes']:_0x874338[_0xf3b4('0x34')];_0x5c5af6[_0xf3b4('0x3c')]=qs['sort'](_0x3bf997[_0xf3b4('0x35')][_0xf3b4('0x3d')]);_0x5c5af6['where']=qs[_0xf3b4('0x40')](_['pick'](_0x3bf997[_0xf3b4('0x35')],_0x874338[_0xf3b4('0x40')]));if(_0x3bf997['query'][_0xf3b4('0x41')]){_0x5c5af6['where']=_[_0xf3b4('0x42')](_0x5c5af6[_0xf3b4('0x3e')],{'$or':_[_0xf3b4('0x2e')](_0x5c5af6[_0xf3b4('0x37')],function(_0xfb8e79){var _0x510346={};_0x510346[_0xfb8e79]={'$like':'%'+_0x3bf997[_0xf3b4('0x35')][_0xf3b4('0x41')]+'%'};return _0x510346;})});}_0x5c5af6=_['merge']({},_0x5c5af6,_0x3bf997['options']);return _0xd30366[_0xf3b4('0x54')](_0x5c5af6);}})['then'](function(_0x62f81e){if(_0x62f81e){_0x55021d=_0x62f81e[_0xf3b4('0x3a')];if(!_0x3bf997[_0xf3b4('0x35')][_0xf3b4('0x52')]('nolimit')){_0x5c5af6[_0xf3b4('0x20')]=qs[_0xf3b4('0x20')](_0x3bf997[_0xf3b4('0x35')][_0xf3b4('0x20')]);_0x5c5af6[_0xf3b4('0x1d')]=qs['offset'](_0x3bf997[_0xf3b4('0x35')][_0xf3b4('0x1d')]);}return _0xd30366[_0xf3b4('0x54')](_0x5c5af6);}})[_0xf3b4('0x28')](function(_0x565f52){if(_0x565f52){return _0x565f52?{'count':_0x55021d,'rows':_0x565f52}:null;}})[_0xf3b4('0x28')](respondWithResult(_0x2260e3,null))[_0xf3b4('0x47')](handleError(_0x2260e3,null));};exports[_0xf3b4('0x55')]=function(_0x21209f,_0x1cc313,_0x32f321){var _0x26e577={};var _0x1095b9={};var _0x854f6b;var _0x241c18;return db[_0xf3b4('0x2f')][_0xf3b4('0x50')]({'where':{'id':_0x21209f[_0xf3b4('0x49')]['id']}})[_0xf3b4('0x28')](handleEntityNotFound(_0x1cc313,null))[_0xf3b4('0x28')](function(_0x2617b3){if(_0x2617b3){_0x854f6b=_0x2617b3;_0x1095b9['model']=_[_0xf3b4('0x36')](db[_0xf3b4('0x56')]['rawAttributes']);_0x1095b9[_0xf3b4('0x35')]=_[_0xf3b4('0x36')](_0x21209f['query']);_0x1095b9[_0xf3b4('0x40')]=_[_0xf3b4('0x38')](_0x1095b9[_0xf3b4('0x34')],_0x1095b9[_0xf3b4('0x35')]);_0x26e577[_0xf3b4('0x37')]=_[_0xf3b4('0x38')](_0x1095b9[_0xf3b4('0x34')],qs[_0xf3b4('0x39')](_0x21209f[_0xf3b4('0x35')]['fields']));_0x26e577['attributes']=_0x26e577[_0xf3b4('0x37')]['length']?_0x26e577[_0xf3b4('0x37')]:_0x1095b9['model'];_0x26e577['order']=qs[_0xf3b4('0x3d')](_0x21209f[_0xf3b4('0x35')]['sort']);_0x26e577['where']=qs[_0xf3b4('0x40')](_[_0xf3b4('0x3f')](_0x21209f[_0xf3b4('0x35')],_0x1095b9['filters']));if(_0x21209f['query']['filter']){_0x26e577[_0xf3b4('0x3e')]=_[_0xf3b4('0x42')](_0x26e577[_0xf3b4('0x3e')],{'$or':_[_0xf3b4('0x2e')](_0x26e577[_0xf3b4('0x37')],function(_0x31f473){var _0x3d85ae={};_0x3d85ae[_0x31f473]={'$like':'%'+_0x21209f[_0xf3b4('0x35')][_0xf3b4('0x41')]+'%'};return _0x3d85ae;})});}_0x26e577=_[_0xf3b4('0x42')]({},_0x26e577,_0x21209f[_0xf3b4('0x43')]);return _0x854f6b[_0xf3b4('0x55')](_0x26e577);}})[_0xf3b4('0x28')](function(_0x3d6c0f){if(_0x3d6c0f){_0x241c18=_0x3d6c0f[_0xf3b4('0x3a')];if(!_0x21209f[_0xf3b4('0x35')][_0xf3b4('0x52')](_0xf3b4('0x3b'))){_0x26e577[_0xf3b4('0x20')]=qs[_0xf3b4('0x20')](_0x21209f[_0xf3b4('0x35')][_0xf3b4('0x20')]);_0x26e577['offset']=qs[_0xf3b4('0x1d')](_0x21209f[_0xf3b4('0x35')][_0xf3b4('0x1d')]);}return _0x854f6b[_0xf3b4('0x55')](_0x26e577);}})[_0xf3b4('0x28')](function(_0x377f6d){if(_0x377f6d){return _0x377f6d?{'count':_0x241c18,'rows':_0x377f6d}:null;}})[_0xf3b4('0x28')](respondWithResult(_0x1cc313,null))[_0xf3b4('0x47')](handleError(_0x1cc313,null));};exports[_0xf3b4('0x57')]=function(_0x3e68b3,_0x2a8134,_0x4c0499){if(_0x3e68b3[_0xf3b4('0x4c')]['id']){delete _0x3e68b3['body']['id'];}return db[_0xf3b4('0x2f')]['findOne']({'where':{'id':_0x3e68b3['params']['id']}})['then'](handleEntityNotFound(_0x2a8134,null))[_0xf3b4('0x28')](function(_0x20e138){if(_0x20e138){return _0x20e138[_0xf3b4('0x57')](_0x3e68b3[_0xf3b4('0x4c')][_0xf3b4('0x58')]||[]);}return null;})[_0xf3b4('0x28')](respondWithResult(_0x2a8134,null))[_0xf3b4('0x47')](handleError(_0x2a8134,null));}; \ No newline at end of file +var _0x9b88=['end','json','offset','undefined','limit','count','set','apply','reject','then','destroy','stack','name','map','FreshdeskConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','length','find','catch','create','update','body','findOne','params','FreshdeskField','getFields','getSubjects','getDescriptions','Tag','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status'];(function(_0x4b970a,_0x58d378){var _0xc340f8=function(_0x21a66d){while(--_0x21a66d){_0x4b970a['push'](_0x4b970a['shift']());}};_0xc340f8(++_0x58d378);}(_0x9b88,0x1d2));var _0x89b8=function(_0x14c68e,_0x47061d){_0x14c68e=_0x14c68e-0x0;var _0x87a0b9=_0x9b88[_0x14c68e];return _0x87a0b9;};'use strict';var emlformat=require(_0x89b8('0x0'));var rimraf=require(_0x89b8('0x1'));var zipdir=require(_0x89b8('0x2'));var jsonpatch=require(_0x89b8('0x3'));var rp=require('request-promise');var moment=require(_0x89b8('0x4'));var BPromise=require(_0x89b8('0x5'));var Mustache=require('mustache');var util=require(_0x89b8('0x6'));var path=require(_0x89b8('0x7'));var sox=require(_0x89b8('0x8'));var csv=require(_0x89b8('0x9'));var ejs=require(_0x89b8('0xa'));var fs=require('fs');var fs_extra=require(_0x89b8('0xb'));var _=require('lodash');var squel=require(_0x89b8('0xc'));var crypto=require(_0x89b8('0xd'));var jsforce=require(_0x89b8('0xe'));var deskjs=require(_0x89b8('0xf'));var toCsv=require('to-csv');var querystring=require(_0x89b8('0x10'));var Papa=require(_0x89b8('0x11'));var Redis=require('ioredis');var authService=require(_0x89b8('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x89b8('0x13'));var hardwareService=require(_0x89b8('0x14'));var logger=require(_0x89b8('0x15'))(_0x89b8('0x16'));var utils=require('../../config/utils');var config=require(_0x89b8('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x7de78,_0x279825){_0x279825=_0x279825||0xcc;return function(_0x282b6a){if(_0x282b6a){return _0x7de78[_0x89b8('0x18')](_0x279825);}return _0x7de78[_0x89b8('0x19')](_0x279825)[_0x89b8('0x1a')]();};}function respondWithResult(_0x4071b8,_0x5c3efd){_0x5c3efd=_0x5c3efd||0xc8;return function(_0x199c89){if(_0x199c89){return _0x4071b8[_0x89b8('0x19')](_0x5c3efd)[_0x89b8('0x1b')](_0x199c89);}};}function respondWithFilteredResult(_0x4847f0,_0x2fe24a){return function(_0x531501){if(_0x531501){var _0x24876e=typeof _0x2fe24a[_0x89b8('0x1c')]===_0x89b8('0x1d')&&typeof _0x2fe24a[_0x89b8('0x1e')]===_0x89b8('0x1d');var _0x3053cb=_0x531501[_0x89b8('0x1f')];var _0x2d06eb=_0x24876e?0x0:_0x2fe24a['offset'];var _0x1e9060=_0x24876e?_0x531501[_0x89b8('0x1f')]:_0x2fe24a[_0x89b8('0x1c')]+_0x2fe24a[_0x89b8('0x1e')];var _0x23518e;if(_0x1e9060>=_0x3053cb){_0x1e9060=_0x3053cb;_0x23518e=0xc8;}else{_0x23518e=0xce;}_0x4847f0[_0x89b8('0x19')](_0x23518e);return _0x4847f0[_0x89b8('0x20')]('Content-Range',_0x2d06eb+'-'+_0x1e9060+'/'+_0x3053cb)[_0x89b8('0x1b')](_0x531501);}return null;};}function patchUpdates(_0x1b57cf){return function(_0x549350){try{jsonpatch[_0x89b8('0x21')](_0x549350,_0x1b57cf,!![]);}catch(_0x1ee514){return BPromise[_0x89b8('0x22')](_0x1ee514);}return _0x549350['save']();};}function saveUpdates(_0x40891c,_0x2c30de){return function(_0x1f8715){if(_0x1f8715){return _0x1f8715['update'](_0x40891c)[_0x89b8('0x23')](function(_0x3f6e23){return _0x3f6e23;});}return null;};}function removeEntity(_0x389b97,_0x31ff83){return function(_0x2167a5){if(_0x2167a5){return _0x2167a5[_0x89b8('0x24')]()[_0x89b8('0x23')](function(){_0x389b97[_0x89b8('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x276673,_0x4362d2){return function(_0x1cf7a){if(!_0x1cf7a){_0x276673['sendStatus'](0x194);}return _0x1cf7a;};}function handleError(_0x6387d2,_0x4c7385){_0x4c7385=_0x4c7385||0x1f4;return function(_0x59d3cc){logger['error'](_0x59d3cc[_0x89b8('0x25')]);if(_0x59d3cc[_0x89b8('0x26')]){delete _0x59d3cc[_0x89b8('0x26')];}_0x6387d2[_0x89b8('0x19')](_0x4c7385)['send'](_0x59d3cc);};}exports['index']=function(_0x461fdf,_0x4cd1d5){var _0x5ae60f={},_0x5ede69={},_0x22dc37={'count':0x0,'rows':[]};var _0x760226=_[_0x89b8('0x27')](db[_0x89b8('0x28')][_0x89b8('0x29')],function(_0x57c1f1){return{'name':_0x57c1f1[_0x89b8('0x2a')],'type':_0x57c1f1[_0x89b8('0x2b')][_0x89b8('0x2c')]};});_0x5ede69[_0x89b8('0x2d')]=_[_0x89b8('0x27')](_0x760226,_0x89b8('0x26'));_0x5ede69[_0x89b8('0x2e')]=_[_0x89b8('0x2f')](_0x461fdf[_0x89b8('0x2e')]);_0x5ede69[_0x89b8('0x30')]=_['intersection'](_0x5ede69[_0x89b8('0x2d')],_0x5ede69[_0x89b8('0x2e')]);_0x5ae60f[_0x89b8('0x31')]=_[_0x89b8('0x32')](_0x5ede69[_0x89b8('0x2d')],qs[_0x89b8('0x33')](_0x461fdf[_0x89b8('0x2e')][_0x89b8('0x33')]));_0x5ae60f[_0x89b8('0x31')]=_0x5ae60f[_0x89b8('0x31')]['length']?_0x5ae60f[_0x89b8('0x31')]:_0x5ede69[_0x89b8('0x2d')];if(!_0x461fdf[_0x89b8('0x2e')][_0x89b8('0x34')](_0x89b8('0x35'))){_0x5ae60f[_0x89b8('0x1e')]=qs[_0x89b8('0x1e')](_0x461fdf[_0x89b8('0x2e')]['limit']);_0x5ae60f[_0x89b8('0x1c')]=qs[_0x89b8('0x1c')](_0x461fdf[_0x89b8('0x2e')][_0x89b8('0x1c')]);}_0x5ae60f[_0x89b8('0x36')]=qs[_0x89b8('0x37')](_0x461fdf[_0x89b8('0x2e')][_0x89b8('0x37')]);_0x5ae60f[_0x89b8('0x38')]=qs[_0x89b8('0x30')](_[_0x89b8('0x39')](_0x461fdf[_0x89b8('0x2e')],_0x5ede69['filters']),_0x760226);if(_0x461fdf['query']['filter']){_0x5ae60f[_0x89b8('0x38')]=_[_0x89b8('0x3a')](_0x5ae60f[_0x89b8('0x38')],{'$or':_[_0x89b8('0x27')](_0x760226,function(_0x590906){if(_0x590906[_0x89b8('0x2b')]!==_0x89b8('0x3b')){var _0x37f149={};_0x37f149[_0x590906['name']]={'$like':'%'+_0x461fdf[_0x89b8('0x2e')][_0x89b8('0x3c')]+'%'};return _0x37f149;}})});}_0x5ae60f=_[_0x89b8('0x3a')]({},_0x5ae60f,_0x461fdf[_0x89b8('0x3d')]);var _0x3c4406={'where':_0x5ae60f[_0x89b8('0x38')]};return db[_0x89b8('0x28')][_0x89b8('0x1f')](_0x3c4406)[_0x89b8('0x23')](function(_0x586df5){_0x22dc37[_0x89b8('0x1f')]=_0x586df5;if(_0x461fdf['query'][_0x89b8('0x3e')]){_0x5ae60f[_0x89b8('0x3f')]=[{'all':!![]}];}return db[_0x89b8('0x28')][_0x89b8('0x40')](_0x5ae60f);})[_0x89b8('0x23')](function(_0x2ffd5a){_0x22dc37[_0x89b8('0x41')]=_0x2ffd5a;return _0x22dc37;})[_0x89b8('0x23')](respondWithFilteredResult(_0x4cd1d5,_0x5ae60f))['catch'](handleError(_0x4cd1d5,null));};exports['show']=function(_0x448325,_0x42814c){var _0x537f04={'raw':![],'where':{'id':_0x448325['params']['id']}},_0x43b8dc={};_0x43b8dc[_0x89b8('0x2d')]=_[_0x89b8('0x2f')](db[_0x89b8('0x28')]['rawAttributes']);_0x43b8dc[_0x89b8('0x2e')]=_[_0x89b8('0x2f')](_0x448325['query']);_0x43b8dc[_0x89b8('0x30')]=_[_0x89b8('0x32')](_0x43b8dc[_0x89b8('0x2d')],_0x43b8dc[_0x89b8('0x2e')]);_0x537f04[_0x89b8('0x31')]=_[_0x89b8('0x32')](_0x43b8dc['model'],qs[_0x89b8('0x33')](_0x448325['query'][_0x89b8('0x33')]));_0x537f04[_0x89b8('0x31')]=_0x537f04[_0x89b8('0x31')][_0x89b8('0x42')]?_0x537f04[_0x89b8('0x31')]:_0x43b8dc[_0x89b8('0x2d')];if(_0x448325[_0x89b8('0x2e')][_0x89b8('0x3e')]){_0x537f04[_0x89b8('0x3f')]=[{'all':!![]}];}_0x537f04=_[_0x89b8('0x3a')]({},_0x537f04,_0x448325['options']);return db[_0x89b8('0x28')][_0x89b8('0x43')](_0x537f04)[_0x89b8('0x23')](handleEntityNotFound(_0x42814c,null))['then'](respondWithResult(_0x42814c,null))[_0x89b8('0x44')](handleError(_0x42814c,null));};exports[_0x89b8('0x45')]=function(_0x351d20,_0x3a8c8f){return db[_0x89b8('0x28')][_0x89b8('0x45')](_0x351d20['body'],{})[_0x89b8('0x23')](respondWithResult(_0x3a8c8f,0xc9))[_0x89b8('0x44')](handleError(_0x3a8c8f,null));};exports[_0x89b8('0x46')]=function(_0x264e1f,_0x32793f){if(_0x264e1f[_0x89b8('0x47')]['id']){delete _0x264e1f[_0x89b8('0x47')]['id'];}return db['FreshdeskConfiguration'][_0x89b8('0x43')]({'where':{'id':_0x264e1f['params']['id']}})['then'](handleEntityNotFound(_0x32793f,null))[_0x89b8('0x23')](saveUpdates(_0x264e1f[_0x89b8('0x47')],null))[_0x89b8('0x23')](respondWithResult(_0x32793f,null))[_0x89b8('0x44')](handleError(_0x32793f,null));};exports[_0x89b8('0x24')]=function(_0x52a665,_0x12d7e3){return db['FreshdeskConfiguration'][_0x89b8('0x43')]({'where':{'id':_0x52a665['params']['id']}})[_0x89b8('0x23')](handleEntityNotFound(_0x12d7e3,null))[_0x89b8('0x23')](removeEntity(_0x12d7e3,null))['catch'](handleError(_0x12d7e3,null));};exports['getFields']=function(_0x95b96,_0x17dc17,_0x4424ee){var _0x5cef6b={};var _0x7dc42d={};var _0x4c80c5;var _0x49cb4c;return db[_0x89b8('0x28')][_0x89b8('0x48')]({'where':{'id':_0x95b96[_0x89b8('0x49')]['id']}})['then'](handleEntityNotFound(_0x17dc17,null))['then'](function(_0x52a5d1){if(_0x52a5d1){_0x4c80c5=_0x52a5d1;_0x7dc42d[_0x89b8('0x2d')]=_[_0x89b8('0x2f')](db[_0x89b8('0x4a')][_0x89b8('0x29')]);_0x7dc42d[_0x89b8('0x2e')]=_[_0x89b8('0x2f')](_0x95b96[_0x89b8('0x2e')]);_0x7dc42d[_0x89b8('0x30')]=_[_0x89b8('0x32')](_0x7dc42d[_0x89b8('0x2d')],_0x7dc42d['query']);_0x5cef6b[_0x89b8('0x31')]=_[_0x89b8('0x32')](_0x7dc42d[_0x89b8('0x2d')],qs[_0x89b8('0x33')](_0x95b96[_0x89b8('0x2e')][_0x89b8('0x33')]));_0x5cef6b['attributes']=_0x5cef6b[_0x89b8('0x31')][_0x89b8('0x42')]?_0x5cef6b['attributes']:_0x7dc42d['model'];_0x5cef6b[_0x89b8('0x36')]=qs['sort'](_0x95b96[_0x89b8('0x2e')][_0x89b8('0x37')]);_0x5cef6b[_0x89b8('0x38')]=qs[_0x89b8('0x30')](_[_0x89b8('0x39')](_0x95b96['query'],_0x7dc42d['filters']));if(_0x95b96[_0x89b8('0x2e')][_0x89b8('0x3c')]){_0x5cef6b['where']=_[_0x89b8('0x3a')](_0x5cef6b[_0x89b8('0x38')],{'$or':_[_0x89b8('0x27')](_0x5cef6b['attributes'],function(_0x2e7e96){var _0x59ea1c={};_0x59ea1c[_0x2e7e96]={'$like':'%'+_0x95b96[_0x89b8('0x2e')][_0x89b8('0x3c')]+'%'};return _0x59ea1c;})});}_0x5cef6b=_[_0x89b8('0x3a')]({},_0x5cef6b,_0x95b96[_0x89b8('0x3d')]);return _0x4c80c5['getFields'](_0x5cef6b);}})[_0x89b8('0x23')](function(_0x1f76ec){if(_0x1f76ec){_0x49cb4c=_0x1f76ec[_0x89b8('0x42')];if(!_0x95b96[_0x89b8('0x2e')]['hasOwnProperty'](_0x89b8('0x35'))){_0x5cef6b['limit']=qs[_0x89b8('0x1e')](_0x95b96[_0x89b8('0x2e')][_0x89b8('0x1e')]);_0x5cef6b[_0x89b8('0x1c')]=qs[_0x89b8('0x1c')](_0x95b96[_0x89b8('0x2e')][_0x89b8('0x1c')]);}return _0x4c80c5[_0x89b8('0x4b')](_0x5cef6b);}})['then'](function(_0xebf8c8){if(_0xebf8c8){return _0xebf8c8?{'count':_0x49cb4c,'rows':_0xebf8c8}:null;}})[_0x89b8('0x23')](respondWithResult(_0x17dc17,null))[_0x89b8('0x44')](handleError(_0x17dc17,null));};exports[_0x89b8('0x4c')]=function(_0x410588,_0x448d4d,_0x25922c){var _0xde0076={};var _0x222102={};var _0x20970b;var _0x3fcf47;return db[_0x89b8('0x28')][_0x89b8('0x48')]({'where':{'id':_0x410588['params']['id']}})[_0x89b8('0x23')](handleEntityNotFound(_0x448d4d,null))[_0x89b8('0x23')](function(_0x1389f7){if(_0x1389f7){_0x20970b=_0x1389f7;_0x222102[_0x89b8('0x2d')]=_['keys'](db[_0x89b8('0x4a')][_0x89b8('0x29')]);_0x222102[_0x89b8('0x2e')]=_['keys'](_0x410588['query']);_0x222102[_0x89b8('0x30')]=_[_0x89b8('0x32')](_0x222102['model'],_0x222102['query']);_0xde0076[_0x89b8('0x31')]=_[_0x89b8('0x32')](_0x222102[_0x89b8('0x2d')],qs['fields'](_0x410588[_0x89b8('0x2e')][_0x89b8('0x33')]));_0xde0076['attributes']=_0xde0076[_0x89b8('0x31')]['length']?_0xde0076[_0x89b8('0x31')]:_0x222102[_0x89b8('0x2d')];_0xde0076[_0x89b8('0x36')]=qs[_0x89b8('0x37')](_0x410588[_0x89b8('0x2e')][_0x89b8('0x37')]);_0xde0076[_0x89b8('0x38')]=qs['filters'](_[_0x89b8('0x39')](_0x410588['query'],_0x222102[_0x89b8('0x30')]));if(_0x410588[_0x89b8('0x2e')][_0x89b8('0x3c')]){_0xde0076[_0x89b8('0x38')]=_[_0x89b8('0x3a')](_0xde0076[_0x89b8('0x38')],{'$or':_[_0x89b8('0x27')](_0xde0076['attributes'],function(_0x5464a8){var _0x264273={};_0x264273[_0x5464a8]={'$like':'%'+_0x410588['query'][_0x89b8('0x3c')]+'%'};return _0x264273;})});}_0xde0076=_[_0x89b8('0x3a')]({},_0xde0076,_0x410588[_0x89b8('0x3d')]);return _0x20970b[_0x89b8('0x4c')](_0xde0076);}})[_0x89b8('0x23')](function(_0x1886c0){if(_0x1886c0){_0x3fcf47=_0x1886c0[_0x89b8('0x42')];if(!_0x410588['query'][_0x89b8('0x34')](_0x89b8('0x35'))){_0xde0076[_0x89b8('0x1e')]=qs['limit'](_0x410588[_0x89b8('0x2e')][_0x89b8('0x1e')]);_0xde0076[_0x89b8('0x1c')]=qs['offset'](_0x410588[_0x89b8('0x2e')][_0x89b8('0x1c')]);}return _0x20970b['getSubjects'](_0xde0076);}})[_0x89b8('0x23')](function(_0xc5fc68){if(_0xc5fc68){return _0xc5fc68?{'count':_0x3fcf47,'rows':_0xc5fc68}:null;}})[_0x89b8('0x23')](respondWithResult(_0x448d4d,null))['catch'](handleError(_0x448d4d,null));};exports[_0x89b8('0x4d')]=function(_0x1d3da2,_0x1566dd,_0x16e961){var _0xa8a943={};var _0x2083a3={};var _0xdc1ae2;var _0x2735b2;return db[_0x89b8('0x28')][_0x89b8('0x48')]({'where':{'id':_0x1d3da2['params']['id']}})[_0x89b8('0x23')](handleEntityNotFound(_0x1566dd,null))[_0x89b8('0x23')](function(_0x3c2b64){if(_0x3c2b64){_0xdc1ae2=_0x3c2b64;_0x2083a3[_0x89b8('0x2d')]=_[_0x89b8('0x2f')](db['FreshdeskField'][_0x89b8('0x29')]);_0x2083a3['query']=_[_0x89b8('0x2f')](_0x1d3da2[_0x89b8('0x2e')]);_0x2083a3[_0x89b8('0x30')]=_['intersection'](_0x2083a3[_0x89b8('0x2d')],_0x2083a3[_0x89b8('0x2e')]);_0xa8a943[_0x89b8('0x31')]=_['intersection'](_0x2083a3['model'],qs['fields'](_0x1d3da2[_0x89b8('0x2e')][_0x89b8('0x33')]));_0xa8a943['attributes']=_0xa8a943[_0x89b8('0x31')][_0x89b8('0x42')]?_0xa8a943['attributes']:_0x2083a3[_0x89b8('0x2d')];_0xa8a943[_0x89b8('0x36')]=qs[_0x89b8('0x37')](_0x1d3da2[_0x89b8('0x2e')][_0x89b8('0x37')]);_0xa8a943[_0x89b8('0x38')]=qs['filters'](_[_0x89b8('0x39')](_0x1d3da2[_0x89b8('0x2e')],_0x2083a3[_0x89b8('0x30')]));if(_0x1d3da2['query'][_0x89b8('0x3c')]){_0xa8a943[_0x89b8('0x38')]=_['merge'](_0xa8a943[_0x89b8('0x38')],{'$or':_[_0x89b8('0x27')](_0xa8a943[_0x89b8('0x31')],function(_0x451435){var _0x1f0e62={};_0x1f0e62[_0x451435]={'$like':'%'+_0x1d3da2[_0x89b8('0x2e')][_0x89b8('0x3c')]+'%'};return _0x1f0e62;})});}_0xa8a943=_[_0x89b8('0x3a')]({},_0xa8a943,_0x1d3da2['options']);return _0xdc1ae2['getDescriptions'](_0xa8a943);}})['then'](function(_0x30bcf1){if(_0x30bcf1){_0x2735b2=_0x30bcf1['length'];if(!_0x1d3da2[_0x89b8('0x2e')]['hasOwnProperty']('nolimit')){_0xa8a943[_0x89b8('0x1e')]=qs[_0x89b8('0x1e')](_0x1d3da2[_0x89b8('0x2e')][_0x89b8('0x1e')]);_0xa8a943[_0x89b8('0x1c')]=qs[_0x89b8('0x1c')](_0x1d3da2['query'][_0x89b8('0x1c')]);}return _0xdc1ae2['getDescriptions'](_0xa8a943);}})[_0x89b8('0x23')](function(_0x43ac06){if(_0x43ac06){return _0x43ac06?{'count':_0x2735b2,'rows':_0x43ac06}:null;}})[_0x89b8('0x23')](respondWithResult(_0x1566dd,null))[_0x89b8('0x44')](handleError(_0x1566dd,null));};exports['getTags']=function(_0x1e6c51,_0x2342e4,_0x2b3574){var _0x385b03={};var _0x5ba0a9={};var _0x3b8188;var _0x1c561e;return db[_0x89b8('0x28')][_0x89b8('0x48')]({'where':{'id':_0x1e6c51['params']['id']}})[_0x89b8('0x23')](handleEntityNotFound(_0x2342e4,null))[_0x89b8('0x23')](function(_0x15c255){if(_0x15c255){_0x3b8188=_0x15c255;_0x5ba0a9['model']=_[_0x89b8('0x2f')](db[_0x89b8('0x4e')][_0x89b8('0x29')]);_0x5ba0a9[_0x89b8('0x2e')]=_[_0x89b8('0x2f')](_0x1e6c51[_0x89b8('0x2e')]);_0x5ba0a9[_0x89b8('0x30')]=_['intersection'](_0x5ba0a9[_0x89b8('0x2d')],_0x5ba0a9['query']);_0x385b03[_0x89b8('0x31')]=_[_0x89b8('0x32')](_0x5ba0a9['model'],qs['fields'](_0x1e6c51[_0x89b8('0x2e')]['fields']));_0x385b03[_0x89b8('0x31')]=_0x385b03['attributes'][_0x89b8('0x42')]?_0x385b03[_0x89b8('0x31')]:_0x5ba0a9[_0x89b8('0x2d')];_0x385b03[_0x89b8('0x36')]=qs[_0x89b8('0x37')](_0x1e6c51[_0x89b8('0x2e')]['sort']);_0x385b03[_0x89b8('0x38')]=qs[_0x89b8('0x30')](_['pick'](_0x1e6c51[_0x89b8('0x2e')],_0x5ba0a9[_0x89b8('0x30')]));if(_0x1e6c51['query'][_0x89b8('0x3c')]){_0x385b03[_0x89b8('0x38')]=_[_0x89b8('0x3a')](_0x385b03[_0x89b8('0x38')],{'$or':_[_0x89b8('0x27')](_0x385b03[_0x89b8('0x31')],function(_0x3f21de){var _0x2d5d63={};_0x2d5d63[_0x3f21de]={'$like':'%'+_0x1e6c51[_0x89b8('0x2e')][_0x89b8('0x3c')]+'%'};return _0x2d5d63;})});}_0x385b03=_['merge']({},_0x385b03,_0x1e6c51['options']);return _0x3b8188[_0x89b8('0x4f')](_0x385b03);}})[_0x89b8('0x23')](function(_0x224ca9){if(_0x224ca9){_0x1c561e=_0x224ca9[_0x89b8('0x42')];if(!_0x1e6c51['query'][_0x89b8('0x34')]('nolimit')){_0x385b03[_0x89b8('0x1e')]=qs[_0x89b8('0x1e')](_0x1e6c51[_0x89b8('0x2e')]['limit']);_0x385b03[_0x89b8('0x1c')]=qs[_0x89b8('0x1c')](_0x1e6c51[_0x89b8('0x2e')][_0x89b8('0x1c')]);}return _0x3b8188[_0x89b8('0x4f')](_0x385b03);}})['then'](function(_0x102031){if(_0x102031){return _0x102031?{'count':_0x1c561e,'rows':_0x102031}:null;}})['then'](respondWithResult(_0x2342e4,null))[_0x89b8('0x44')](handleError(_0x2342e4,null));};exports[_0x89b8('0x50')]=function(_0x3abc85,_0x1e09ea,_0x1a821c){if(_0x3abc85[_0x89b8('0x47')]['id']){delete _0x3abc85[_0x89b8('0x47')]['id'];}return db[_0x89b8('0x28')]['findOne']({'where':{'id':_0x3abc85[_0x89b8('0x49')]['id']}})['then'](handleEntityNotFound(_0x1e09ea,null))[_0x89b8('0x23')](function(_0x34e458){if(_0x34e458){return _0x34e458[_0x89b8('0x50')](_0x3abc85[_0x89b8('0x47')][_0x89b8('0x51')]||[]);}return null;})[_0x89b8('0x23')](respondWithResult(_0x1e09ea,null))[_0x89b8('0x44')](handleError(_0x1e09ea,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 2c9c86a..e0f312a 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 _0x6798=['request-promise','path','rimraf','./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','../../config/logger','api','moment'];(function(_0x513254,_0x1305ca){var _0x384c92=function(_0xb22823){while(--_0xb22823){_0x513254['push'](_0x513254['shift']());}};_0x384c92(++_0x1305ca);}(_0x6798,0x97));var _0x8679=function(_0x3525f3,_0x49aef4){_0x3525f3=_0x3525f3-0x0;var _0x3e3770=_0x6798[_0x3525f3];return _0x3e3770;};'use strict';var _=require(_0x8679('0x0'));var util=require(_0x8679('0x1'));var logger=require(_0x8679('0x2'))(_0x8679('0x3'));var moment=require(_0x8679('0x4'));var BPromise=require('bluebird');var rp=require(_0x8679('0x5'));var fs=require('fs');var path=require(_0x8679('0x6'));var rimraf=require(_0x8679('0x7'));var config=require('../../config/environment');var attributes=require(_0x8679('0x8'));module[_0x8679('0x9')]=function(_0x33b9a9,_0x8edf61){return _0x33b9a9[_0x8679('0xa')](_0x8679('0xb'),attributes,{'tableName':_0x8679('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8ce3=['./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','../../config/logger','api','bluebird','path','rimraf','../../config/environment'];(function(_0x6ae47d,_0xdf355a){var _0x5f3c0b=function(_0x45e44c){while(--_0x45e44c){_0x6ae47d['push'](_0x6ae47d['shift']());}};_0x5f3c0b(++_0xdf355a);}(_0x8ce3,0x149));var _0x38ce=function(_0x508c10,_0x5a15f0){_0x508c10=_0x508c10-0x0;var _0x3108b5=_0x8ce3[_0x508c10];return _0x3108b5;};'use strict';var _=require(_0x38ce('0x0'));var util=require('util');var logger=require(_0x38ce('0x1'))(_0x38ce('0x2'));var moment=require('moment');var BPromise=require(_0x38ce('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x38ce('0x4'));var rimraf=require(_0x38ce('0x5'));var config=require(_0x38ce('0x6'));var attributes=require(_0x38ce('0x7'));module[_0x38ce('0x8')]=function(_0x270247,_0xb2358f){return _0x270247[_0x38ce('0x9')](_0x38ce('0xa'),attributes,{'tableName':_0x38ce('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js index de9d522..8a4fb1a 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 _0x6858=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','FreshdeskConfiguration,\x20%s,\x20%s','message','result','lodash','util','bluebird','../../mysqldb'];(function(_0x934425,_0x5af72f){var _0x31d596=function(_0x219869){while(--_0x219869){_0x934425['push'](_0x934425['shift']());}};_0x31d596(++_0x5af72f);}(_0x6858,0x10d));var _0x8685=function(_0x15f6a4,_0x40aecd){_0x15f6a4=_0x15f6a4-0x0;var _0x2bc869=_0x6858[_0x15f6a4];return _0x2bc869;};'use strict';var _=require(_0x8685('0x0'));var util=require(_0x8685('0x1'));var moment=require('moment');var BPromise=require(_0x8685('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8685('0x3'))['db'];var utils=require(_0x8685('0x4'));var logger=require(_0x8685('0x5'))(_0x8685('0x6'));var config=require(_0x8685('0x7'));var jayson=require(_0x8685('0x8'));var client=jayson[_0x8685('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x456bb9,_0x2a4dc8,_0x52c8fa){return new BPromise(function(_0x2971bc,_0x2e442b){return client[_0x8685('0xa')](_0x456bb9,_0x52c8fa)[_0x8685('0xb')](function(_0x35ae6){logger[_0x8685('0xc')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x2a4dc8,_0x8685('0xd'));logger[_0x8685('0xe')](_0x8685('0xf'),_0x2a4dc8,_0x8685('0xd'),JSON[_0x8685('0x10')](_0x35ae6));if(_0x35ae6['error']){if(_0x35ae6['error']['code']===0x1f4){logger[_0x8685('0x11')](_0x8685('0x12'),_0x2a4dc8,_0x35ae6[_0x8685('0x11')][_0x8685('0x13')]);return _0x2e442b(_0x35ae6[_0x8685('0x11')][_0x8685('0x13')]);}logger[_0x8685('0x11')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x2a4dc8,_0x35ae6[_0x8685('0x11')]['message']);return _0x2971bc(_0x35ae6[_0x8685('0x11')]['message']);}else{logger['info']('FreshdeskConfiguration,\x20%s,\x20%s',_0x2a4dc8,_0x8685('0xd'));_0x2971bc(_0x35ae6[_0x8685('0x14')][_0x8685('0x13')]);}})['catch'](function(_0x221eab){logger[_0x8685('0x11')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x2a4dc8,_0x221eab);_0x2e442b(_0x221eab);});});} \ No newline at end of file +var _0xc7dc=['../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','moment','randomstring','ioredis','../../mysqldb'];(function(_0x1fa022,_0x5a1b71){var _0x1098d7=function(_0x466928){while(--_0x466928){_0x1fa022['push'](_0x1fa022['shift']());}};_0x1098d7(++_0x5a1b71);}(_0xc7dc,0x150));var _0xcc7d=function(_0x5b4f98,_0x4e2213){_0x5b4f98=_0x5b4f98-0x0;var _0x1f5022=_0xc7dc[_0x5b4f98];return _0x1f5022;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xcc7d('0x0'));var BPromise=require('bluebird');var rs=require(_0xcc7d('0x1'));var fs=require('fs');var Redis=require(_0xcc7d('0x2'));var db=require(_0xcc7d('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xcc7d('0x4'))(_0xcc7d('0x5'));var config=require(_0xcc7d('0x6'));var jayson=require(_0xcc7d('0x7'));var client=jayson[_0xcc7d('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x49b77c,_0x372636,_0x3c8ced){return new BPromise(function(_0x290ad,_0x20a457){return client[_0xcc7d('0x9')](_0x49b77c,_0x3c8ced)[_0xcc7d('0xa')](function(_0x3432a8){logger[_0xcc7d('0xb')](_0xcc7d('0xc'),_0x372636,_0xcc7d('0xd'));logger[_0xcc7d('0xe')](_0xcc7d('0xf'),_0x372636,_0xcc7d('0xd'),JSON['stringify'](_0x3432a8));if(_0x3432a8[_0xcc7d('0x10')]){if(_0x3432a8['error'][_0xcc7d('0x11')]===0x1f4){logger['error'](_0xcc7d('0xc'),_0x372636,_0x3432a8[_0xcc7d('0x10')][_0xcc7d('0x12')]);return _0x20a457(_0x3432a8[_0xcc7d('0x10')][_0xcc7d('0x12')]);}logger[_0xcc7d('0x10')](_0xcc7d('0xc'),_0x372636,_0x3432a8['error'][_0xcc7d('0x12')]);return _0x290ad(_0x3432a8[_0xcc7d('0x10')][_0xcc7d('0x12')]);}else{logger[_0xcc7d('0xb')](_0xcc7d('0xc'),_0x372636,'request\x20sent');_0x290ad(_0x3432a8[_0xcc7d('0x13')][_0xcc7d('0x12')]);}})['catch'](function(_0x23ae5c){logger[_0xcc7d('0x10')](_0xcc7d('0xc'),_0x372636,_0x23ae5c);_0x20a457(_0x23ae5c);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 805dc5e..4bc1a33 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 _0x4527=['/:id','show','create','put','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','index'];(function(_0x47e93d,_0x26bbdd){var _0xe86c46=function(_0x10e072){while(--_0x10e072){_0x47e93d['push'](_0x47e93d['shift']());}};_0xe86c46(++_0x26bbdd);}(_0x4527,0xc5));var _0x7452=function(_0x404de1,_0x401a5f){_0x404de1=_0x404de1-0x0;var _0x43daa7=_0x4527[_0x404de1];return _0x43daa7;};'use strict';var multer=require(_0x7452('0x0'));var util=require(_0x7452('0x1'));var path=require(_0x7452('0x2'));var timeout=require(_0x7452('0x3'));var express=require('express');var router=express[_0x7452('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x7452('0x5'));var interaction=require(_0x7452('0x6'));var config=require(_0x7452('0x7'));var controller=require(_0x7452('0x8'));router[_0x7452('0x9')]('/',auth[_0x7452('0xa')](),controller[_0x7452('0xb')]);router[_0x7452('0x9')](_0x7452('0xc'),auth[_0x7452('0xa')](),controller[_0x7452('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x7452('0xe')]);router[_0x7452('0xf')](_0x7452('0xc'),auth['isAuthenticated'](),controller[_0x7452('0x10')]);router[_0x7452('0x11')](_0x7452('0xc'),auth[_0x7452('0xa')](),controller['destroy']);module[_0x7452('0x12')]=router; \ No newline at end of file +var _0xdd88=['update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','create','put'];(function(_0x3db122,_0x5e6bee){var _0x325b67=function(_0x5095af){while(--_0x5095af){_0x3db122['push'](_0x3db122['shift']());}};_0x325b67(++_0x5e6bee);}(_0xdd88,0x158));var _0x8dd8=function(_0x59b37f,_0x1f58a8){_0x59b37f=_0x59b37f-0x0;var _0x4d1589=_0xdd88[_0x59b37f];return _0x4d1589;};'use strict';var multer=require(_0x8dd8('0x0'));var util=require(_0x8dd8('0x1'));var path=require(_0x8dd8('0x2'));var timeout=require(_0x8dd8('0x3'));var express=require(_0x8dd8('0x4'));var router=express[_0x8dd8('0x5')]();var fs_extra=require(_0x8dd8('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x8dd8('0x7'));var config=require(_0x8dd8('0x8'));var controller=require('./intFreshdeskField.controller');router[_0x8dd8('0x9')]('/',auth[_0x8dd8('0xa')](),controller[_0x8dd8('0xb')]);router[_0x8dd8('0x9')](_0x8dd8('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x8dd8('0xd')]('/',auth[_0x8dd8('0xa')](),controller[_0x8dd8('0xe')]);router[_0x8dd8('0xf')]('/:id',auth[_0x8dd8('0xa')](),controller[_0x8dd8('0x10')]);router['delete'](_0x8dd8('0xc'),auth[_0x8dd8('0xa')](),controller[_0x8dd8('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 58a5a73..349cd36 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 _0x78be=['picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable'];(function(_0x3b5f00,_0xa1466a){var _0x507e05=function(_0x579753){while(--_0x579753){_0x3b5f00['push'](_0x3b5f00['shift']());}};_0x507e05(++_0xa1466a);}(_0x78be,0x1ce));var _0xe78b=function(_0x4f4f3b,_0x25aa57){_0x4f4f3b=_0x4f4f3b-0x0;var _0x2c11d9=_0x78be[_0x4f4f3b];return _0x2c11d9;};'use strict';var Sequelize=require(_0xe78b('0x0'));module[_0xe78b('0x1')]={'type':{'type':Sequelize[_0xe78b('0x2')](_0xe78b('0x3'),_0xe78b('0x4'),_0xe78b('0x5'),'keyValue',_0xe78b('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0xe78b('0x7')]},'key':{'type':Sequelize[_0xe78b('0x7')]},'keyType':{'type':Sequelize[_0xe78b('0x2')](_0xe78b('0x3'),_0xe78b('0x4'),_0xe78b('0x5'))},'keyContent':{'type':Sequelize[_0xe78b('0x7')]},'idField':{'type':Sequelize[_0xe78b('0x7')]},'nameField':{'type':Sequelize[_0xe78b('0x7')]},'customField':{'type':Sequelize[_0xe78b('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe78b('0x7')]}}; \ No newline at end of file +var _0x1fc4=['variable','STRING','exports','ENUM','string','customVariable','keyValue'];(function(_0x19c49c,_0x7ed1e4){var _0x17e24e=function(_0x16d2e3){while(--_0x16d2e3){_0x19c49c['push'](_0x19c49c['shift']());}};_0x17e24e(++_0x7ed1e4);}(_0x1fc4,0xf7));var _0x41fc=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x1fc4[_0x1035c1];return _0x308d67;};'use strict';var Sequelize=require('sequelize');module[_0x41fc('0x0')]={'type':{'type':Sequelize[_0x41fc('0x1')](_0x41fc('0x2'),'variable',_0x41fc('0x3'),_0x41fc('0x4'),'picklist'),'defaultValue':_0x41fc('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x41fc('0x1')](_0x41fc('0x2'),_0x41fc('0x5'),_0x41fc('0x3'))},'keyContent':{'type':Sequelize[_0x41fc('0x6')]},'idField':{'type':Sequelize[_0x41fc('0x6')]},'nameField':{'type':Sequelize[_0x41fc('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x41fc('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 147d13e..9b76a39 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 _0x9e0d=['includeAll','findAll','rows','params','include','find','catch','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','undefined','limit','count','offset','set','apply','reject','save','then','destroy','end','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','FreshdeskField'];(function(_0x5b5302,_0x1b9d54){var _0x379a62=function(_0x8dbc5c){while(--_0x8dbc5c){_0x5b5302['push'](_0x5b5302['shift']());}};_0x379a62(++_0x1b9d54);}(_0x9e0d,0xf7));var _0xd9e0=function(_0x59aecc,_0x255014){_0x59aecc=_0x59aecc-0x0;var _0x46b112=_0x9e0d[_0x59aecc];return _0x46b112;};'use strict';var emlformat=require(_0xd9e0('0x0'));var rimraf=require(_0xd9e0('0x1'));var zipdir=require(_0xd9e0('0x2'));var jsonpatch=require(_0xd9e0('0x3'));var rp=require('request-promise');var moment=require(_0xd9e0('0x4'));var BPromise=require(_0xd9e0('0x5'));var Mustache=require(_0xd9e0('0x6'));var util=require(_0xd9e0('0x7'));var path=require(_0xd9e0('0x8'));var sox=require(_0xd9e0('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd9e0('0xa'));var _=require(_0xd9e0('0xb'));var squel=require(_0xd9e0('0xc'));var crypto=require(_0xd9e0('0xd'));var jsforce=require(_0xd9e0('0xe'));var deskjs=require(_0xd9e0('0xf'));var toCsv=require('to-csv');var querystring=require(_0xd9e0('0x10'));var Papa=require(_0xd9e0('0x11'));var Redis=require(_0xd9e0('0x12'));var authService=require(_0xd9e0('0x13'));var qs=require(_0xd9e0('0x14'));var as=require(_0xd9e0('0x15'));var hardwareService=require(_0xd9e0('0x16'));var logger=require('../../config/logger')(_0xd9e0('0x17'));var utils=require(_0xd9e0('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xd9e0('0x19'));var db=require(_0xd9e0('0x1a'))['db'];function respondWithStatusCode(_0x418d84,_0x1fb454){_0x1fb454=_0x1fb454||0xcc;return function(_0x18fdf2){if(_0x18fdf2){return _0x418d84['sendStatus'](_0x1fb454);}return _0x418d84[_0xd9e0('0x1b')](_0x1fb454)['end']();};}function respondWithResult(_0x2f311c,_0x55c704){_0x55c704=_0x55c704||0xc8;return function(_0x24d361){if(_0x24d361){return _0x2f311c[_0xd9e0('0x1b')](_0x55c704)[_0xd9e0('0x1c')](_0x24d361);}};}function respondWithFilteredResult(_0x18301b,_0x3e4c5d){return function(_0x4da900){if(_0x4da900){var _0x58d44c=typeof _0x3e4c5d['offset']===_0xd9e0('0x1d')&&typeof _0x3e4c5d[_0xd9e0('0x1e')]===_0xd9e0('0x1d');var _0x1cdcb6=_0x4da900['count'];var _0x209c04=_0x58d44c?0x0:_0x3e4c5d['offset'];var _0x483b74=_0x58d44c?_0x4da900[_0xd9e0('0x1f')]:_0x3e4c5d[_0xd9e0('0x20')]+_0x3e4c5d['limit'];var _0x5ac8f5;if(_0x483b74>=_0x1cdcb6){_0x483b74=_0x1cdcb6;_0x5ac8f5=0xc8;}else{_0x5ac8f5=0xce;}_0x18301b[_0xd9e0('0x1b')](_0x5ac8f5);return _0x18301b[_0xd9e0('0x21')]('Content-Range',_0x209c04+'-'+_0x483b74+'/'+_0x1cdcb6)[_0xd9e0('0x1c')](_0x4da900);}return null;};}function patchUpdates(_0x4cc3c9){return function(_0xd3d455){try{jsonpatch[_0xd9e0('0x22')](_0xd3d455,_0x4cc3c9,!![]);}catch(_0x67f69f){return BPromise[_0xd9e0('0x23')](_0x67f69f);}return _0xd3d455[_0xd9e0('0x24')]();};}function saveUpdates(_0x5711a1,_0x19534a){return function(_0x333233){if(_0x333233){return _0x333233['update'](_0x5711a1)[_0xd9e0('0x25')](function(_0x124ca7){return _0x124ca7;});}return null;};}function removeEntity(_0x5d4549,_0x357bd9){return function(_0x5e17d4){if(_0x5e17d4){return _0x5e17d4[_0xd9e0('0x26')]()[_0xd9e0('0x25')](function(){_0x5d4549['status'](0xcc)[_0xd9e0('0x27')]();});}};}function handleEntityNotFound(_0x53cf67,_0x554aeb){return function(_0x50f57d){if(!_0x50f57d){_0x53cf67[_0xd9e0('0x28')](0x194);}return _0x50f57d;};}function handleError(_0x21c796,_0x7065c6){_0x7065c6=_0x7065c6||0x1f4;return function(_0x1c36df){logger[_0xd9e0('0x29')](_0x1c36df[_0xd9e0('0x2a')]);if(_0x1c36df[_0xd9e0('0x2b')]){delete _0x1c36df['name'];}_0x21c796[_0xd9e0('0x1b')](_0x7065c6)[_0xd9e0('0x2c')](_0x1c36df);};}exports[_0xd9e0('0x2d')]=function(_0x17a899,_0x2738e9){var _0x4f5367={},_0x4b4f7d={},_0x4e719c={'count':0x0,'rows':[]};var _0x2cdbba=_[_0xd9e0('0x2e')](db['FreshdeskField'][_0xd9e0('0x2f')],function(_0x183a79){return{'name':_0x183a79[_0xd9e0('0x30')],'type':_0x183a79[_0xd9e0('0x31')][_0xd9e0('0x32')]};});_0x4b4f7d[_0xd9e0('0x33')]=_[_0xd9e0('0x2e')](_0x2cdbba,'name');_0x4b4f7d[_0xd9e0('0x34')]=_[_0xd9e0('0x35')](_0x17a899[_0xd9e0('0x34')]);_0x4b4f7d[_0xd9e0('0x36')]=_[_0xd9e0('0x37')](_0x4b4f7d[_0xd9e0('0x33')],_0x4b4f7d[_0xd9e0('0x34')]);_0x4f5367[_0xd9e0('0x38')]=_[_0xd9e0('0x37')](_0x4b4f7d[_0xd9e0('0x33')],qs[_0xd9e0('0x39')](_0x17a899[_0xd9e0('0x34')]['fields']));_0x4f5367[_0xd9e0('0x38')]=_0x4f5367[_0xd9e0('0x38')][_0xd9e0('0x3a')]?_0x4f5367[_0xd9e0('0x38')]:_0x4b4f7d[_0xd9e0('0x33')];if(!_0x17a899['query'][_0xd9e0('0x3b')](_0xd9e0('0x3c'))){_0x4f5367[_0xd9e0('0x1e')]=qs[_0xd9e0('0x1e')](_0x17a899['query'][_0xd9e0('0x1e')]);_0x4f5367['offset']=qs[_0xd9e0('0x20')](_0x17a899[_0xd9e0('0x34')][_0xd9e0('0x20')]);}_0x4f5367[_0xd9e0('0x3d')]=qs[_0xd9e0('0x3e')](_0x17a899[_0xd9e0('0x34')][_0xd9e0('0x3e')]);_0x4f5367[_0xd9e0('0x3f')]=qs[_0xd9e0('0x36')](_['pick'](_0x17a899[_0xd9e0('0x34')],_0x4b4f7d[_0xd9e0('0x36')]),_0x2cdbba);if(_0x17a899[_0xd9e0('0x34')][_0xd9e0('0x40')]){_0x4f5367['where']=_[_0xd9e0('0x41')](_0x4f5367[_0xd9e0('0x3f')],{'$or':_[_0xd9e0('0x2e')](_0x2cdbba,function(_0x317414){if(_0x317414[_0xd9e0('0x31')]!==_0xd9e0('0x42')){var _0x3fc833={};_0x3fc833[_0x317414[_0xd9e0('0x2b')]]={'$like':'%'+_0x17a899[_0xd9e0('0x34')][_0xd9e0('0x40')]+'%'};return _0x3fc833;}})});}_0x4f5367=_[_0xd9e0('0x41')]({},_0x4f5367,_0x17a899[_0xd9e0('0x43')]);var _0x18ee0b={'where':_0x4f5367[_0xd9e0('0x3f')]};return db[_0xd9e0('0x44')][_0xd9e0('0x1f')](_0x18ee0b)['then'](function(_0x1d071e){_0x4e719c[_0xd9e0('0x1f')]=_0x1d071e;if(_0x17a899['query'][_0xd9e0('0x45')]){_0x4f5367['include']=[{'all':!![]}];}return db[_0xd9e0('0x44')][_0xd9e0('0x46')](_0x4f5367);})[_0xd9e0('0x25')](function(_0x34a00f){_0x4e719c[_0xd9e0('0x47')]=_0x34a00f;return _0x4e719c;})[_0xd9e0('0x25')](respondWithFilteredResult(_0x2738e9,_0x4f5367))['catch'](handleError(_0x2738e9,null));};exports['show']=function(_0x142fa7,_0x186365){var _0x36ab92={'raw':!![],'where':{'id':_0x142fa7[_0xd9e0('0x48')]['id']}},_0x3fa8cb={};_0x3fa8cb['model']=_[_0xd9e0('0x35')](db[_0xd9e0('0x44')][_0xd9e0('0x2f')]);_0x3fa8cb[_0xd9e0('0x34')]=_['keys'](_0x142fa7[_0xd9e0('0x34')]);_0x3fa8cb[_0xd9e0('0x36')]=_[_0xd9e0('0x37')](_0x3fa8cb['model'],_0x3fa8cb['query']);_0x36ab92[_0xd9e0('0x38')]=_[_0xd9e0('0x37')](_0x3fa8cb['model'],qs['fields'](_0x142fa7[_0xd9e0('0x34')][_0xd9e0('0x39')]));_0x36ab92[_0xd9e0('0x38')]=_0x36ab92[_0xd9e0('0x38')][_0xd9e0('0x3a')]?_0x36ab92[_0xd9e0('0x38')]:_0x3fa8cb[_0xd9e0('0x33')];if(_0x142fa7[_0xd9e0('0x34')]['includeAll']){_0x36ab92[_0xd9e0('0x49')]=[{'all':!![]}];}_0x36ab92=_[_0xd9e0('0x41')]({},_0x36ab92,_0x142fa7['options']);return db[_0xd9e0('0x44')][_0xd9e0('0x4a')](_0x36ab92)[_0xd9e0('0x25')](handleEntityNotFound(_0x186365,null))[_0xd9e0('0x25')](respondWithResult(_0x186365,null))[_0xd9e0('0x4b')](handleError(_0x186365,null));};exports[_0xd9e0('0x4c')]=function(_0x42be53,_0x2ec72a){return db[_0xd9e0('0x44')][_0xd9e0('0x4c')](_0x42be53[_0xd9e0('0x4d')],{})[_0xd9e0('0x25')](respondWithResult(_0x2ec72a,0xc9))['catch'](handleError(_0x2ec72a,null));};exports[_0xd9e0('0x4e')]=function(_0x23d7fb,_0x4e3e1c){if(_0x23d7fb[_0xd9e0('0x4d')]['id']){delete _0x23d7fb['body']['id'];}return db[_0xd9e0('0x44')][_0xd9e0('0x4a')]({'where':{'id':_0x23d7fb[_0xd9e0('0x48')]['id']}})[_0xd9e0('0x25')](handleEntityNotFound(_0x4e3e1c,null))[_0xd9e0('0x25')](saveUpdates(_0x23d7fb[_0xd9e0('0x4d')],null))[_0xd9e0('0x25')](respondWithResult(_0x4e3e1c,null))['catch'](handleError(_0x4e3e1c,null));};exports[_0xd9e0('0x26')]=function(_0xc2b731,_0x434b47){return db[_0xd9e0('0x44')][_0xd9e0('0x4a')]({'where':{'id':_0xc2b731['params']['id']}})['then'](handleEntityNotFound(_0x434b47,null))[_0xd9e0('0x25')](removeEntity(_0x434b47,null))['catch'](handleError(_0x434b47,null));}; \ No newline at end of file +var _0xd52a=['catch','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','lodash','crypto','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','error','name','send','index','map','FreshdeskField','rawAttributes','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','merge','type','filter','options','then','includeAll','rows','show','params','keys','include','find','create','body'];(function(_0x365d88,_0x5a0036){var _0x108c83=function(_0x64c9dd){while(--_0x64c9dd){_0x365d88['push'](_0x365d88['shift']());}};_0x108c83(++_0x5a0036);}(_0xd52a,0xca));var _0xad52=function(_0x469192,_0x467b72){_0x469192=_0x469192-0x0;var _0x1ab515=_0xd52a[_0x469192];return _0x1ab515;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xad52('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xad52('0x1'));var rp=require(_0xad52('0x2'));var moment=require(_0xad52('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xad52('0x4'));var util=require(_0xad52('0x5'));var path=require(_0xad52('0x6'));var sox=require(_0xad52('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xad52('0x8'));var squel=require('squel');var crypto=require(_0xad52('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xad52('0xa'));var toCsv=require(_0xad52('0xb'));var querystring=require('querystring');var Papa=require(_0xad52('0xc'));var Redis=require('ioredis');var authService=require(_0xad52('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xad52('0xe'));var hardwareService=require(_0xad52('0xf'));var logger=require(_0xad52('0x10'))(_0xad52('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xad52('0x12'))['db'];function respondWithStatusCode(_0x79b1e7,_0x378b0c){_0x378b0c=_0x378b0c||0xcc;return function(_0x41331e){if(_0x41331e){return _0x79b1e7[_0xad52('0x13')](_0x378b0c);}return _0x79b1e7[_0xad52('0x14')](_0x378b0c)[_0xad52('0x15')]();};}function respondWithResult(_0xd04cde,_0x3d2df6){_0x3d2df6=_0x3d2df6||0xc8;return function(_0x5727a2){if(_0x5727a2){return _0xd04cde[_0xad52('0x14')](_0x3d2df6)[_0xad52('0x16')](_0x5727a2);}};}function respondWithFilteredResult(_0x3bc8f6,_0x42eb20){return function(_0x38be7e){if(_0x38be7e){var _0xcb6cd5=typeof _0x42eb20[_0xad52('0x17')]===_0xad52('0x18')&&typeof _0x42eb20[_0xad52('0x19')]==='undefined';var _0x4abd73=_0x38be7e[_0xad52('0x1a')];var _0x39128c=_0xcb6cd5?0x0:_0x42eb20[_0xad52('0x17')];var _0x1c19e9=_0xcb6cd5?_0x38be7e[_0xad52('0x1a')]:_0x42eb20['offset']+_0x42eb20[_0xad52('0x19')];var _0x5a71c4;if(_0x1c19e9>=_0x4abd73){_0x1c19e9=_0x4abd73;_0x5a71c4=0xc8;}else{_0x5a71c4=0xce;}_0x3bc8f6[_0xad52('0x14')](_0x5a71c4);return _0x3bc8f6[_0xad52('0x1b')](_0xad52('0x1c'),_0x39128c+'-'+_0x1c19e9+'/'+_0x4abd73)['json'](_0x38be7e);}return null;};}function patchUpdates(_0x24fb52){return function(_0x593dfd){try{jsonpatch[_0xad52('0x1d')](_0x593dfd,_0x24fb52,!![]);}catch(_0x179a64){return BPromise[_0xad52('0x1e')](_0x179a64);}return _0x593dfd[_0xad52('0x1f')]();};}function saveUpdates(_0x2c182f,_0x2f1526){return function(_0x4b5f2f){if(_0x4b5f2f){return _0x4b5f2f[_0xad52('0x20')](_0x2c182f)['then'](function(_0x1aac2e){return _0x1aac2e;});}return null;};}function removeEntity(_0x2acbb4,_0x2fa90c){return function(_0x5bce67){if(_0x5bce67){return _0x5bce67[_0xad52('0x21')]()['then'](function(){_0x2acbb4['status'](0xcc)[_0xad52('0x15')]();});}};}function handleEntityNotFound(_0x583999,_0x477b47){return function(_0x3a54a1){if(!_0x3a54a1){_0x583999['sendStatus'](0x194);}return _0x3a54a1;};}function handleError(_0x58adf5,_0xb526bf){_0xb526bf=_0xb526bf||0x1f4;return function(_0x31b5e0){logger[_0xad52('0x22')](_0x31b5e0['stack']);if(_0x31b5e0[_0xad52('0x23')]){delete _0x31b5e0['name'];}_0x58adf5[_0xad52('0x14')](_0xb526bf)[_0xad52('0x24')](_0x31b5e0);};}exports[_0xad52('0x25')]=function(_0x231bbe,_0x503bd0){var _0x426106={},_0x2a604c={},_0x534cc5={'count':0x0,'rows':[]};var _0x3f5757=_[_0xad52('0x26')](db[_0xad52('0x27')][_0xad52('0x28')],function(_0x32f4fe){return{'name':_0x32f4fe['fieldName'],'type':_0x32f4fe['type']['key']};});_0x2a604c[_0xad52('0x29')]=_[_0xad52('0x26')](_0x3f5757,_0xad52('0x23'));_0x2a604c['query']=_['keys'](_0x231bbe[_0xad52('0x2a')]);_0x2a604c[_0xad52('0x2b')]=_[_0xad52('0x2c')](_0x2a604c[_0xad52('0x29')],_0x2a604c[_0xad52('0x2a')]);_0x426106[_0xad52('0x2d')]=_['intersection'](_0x2a604c[_0xad52('0x29')],qs[_0xad52('0x2e')](_0x231bbe[_0xad52('0x2a')][_0xad52('0x2e')]));_0x426106[_0xad52('0x2d')]=_0x426106[_0xad52('0x2d')][_0xad52('0x2f')]?_0x426106[_0xad52('0x2d')]:_0x2a604c[_0xad52('0x29')];if(!_0x231bbe[_0xad52('0x2a')][_0xad52('0x30')]('nolimit')){_0x426106[_0xad52('0x19')]=qs[_0xad52('0x19')](_0x231bbe[_0xad52('0x2a')][_0xad52('0x19')]);_0x426106[_0xad52('0x17')]=qs[_0xad52('0x17')](_0x231bbe['query'][_0xad52('0x17')]);}_0x426106[_0xad52('0x31')]=qs[_0xad52('0x32')](_0x231bbe['query'][_0xad52('0x32')]);_0x426106[_0xad52('0x33')]=qs[_0xad52('0x2b')](_['pick'](_0x231bbe[_0xad52('0x2a')],_0x2a604c[_0xad52('0x2b')]),_0x3f5757);if(_0x231bbe[_0xad52('0x2a')]['filter']){_0x426106[_0xad52('0x33')]=_[_0xad52('0x34')](_0x426106[_0xad52('0x33')],{'$or':_[_0xad52('0x26')](_0x3f5757,function(_0x253c86){if(_0x253c86[_0xad52('0x35')]!=='VIRTUAL'){var _0xb1ea93={};_0xb1ea93[_0x253c86['name']]={'$like':'%'+_0x231bbe[_0xad52('0x2a')][_0xad52('0x36')]+'%'};return _0xb1ea93;}})});}_0x426106=_[_0xad52('0x34')]({},_0x426106,_0x231bbe[_0xad52('0x37')]);var _0x1d5e8a={'where':_0x426106['where']};return db[_0xad52('0x27')][_0xad52('0x1a')](_0x1d5e8a)[_0xad52('0x38')](function(_0x47f02c){_0x534cc5[_0xad52('0x1a')]=_0x47f02c;if(_0x231bbe[_0xad52('0x2a')][_0xad52('0x39')]){_0x426106['include']=[{'all':!![]}];}return db[_0xad52('0x27')]['findAll'](_0x426106);})[_0xad52('0x38')](function(_0x355381){_0x534cc5[_0xad52('0x3a')]=_0x355381;return _0x534cc5;})[_0xad52('0x38')](respondWithFilteredResult(_0x503bd0,_0x426106))['catch'](handleError(_0x503bd0,null));};exports[_0xad52('0x3b')]=function(_0x134d54,_0x249724){var _0x2bd94a={'raw':!![],'where':{'id':_0x134d54[_0xad52('0x3c')]['id']}},_0x3886ec={};_0x3886ec[_0xad52('0x29')]=_[_0xad52('0x3d')](db['FreshdeskField'][_0xad52('0x28')]);_0x3886ec['query']=_[_0xad52('0x3d')](_0x134d54[_0xad52('0x2a')]);_0x3886ec[_0xad52('0x2b')]=_[_0xad52('0x2c')](_0x3886ec[_0xad52('0x29')],_0x3886ec[_0xad52('0x2a')]);_0x2bd94a[_0xad52('0x2d')]=_[_0xad52('0x2c')](_0x3886ec[_0xad52('0x29')],qs[_0xad52('0x2e')](_0x134d54[_0xad52('0x2a')][_0xad52('0x2e')]));_0x2bd94a[_0xad52('0x2d')]=_0x2bd94a[_0xad52('0x2d')][_0xad52('0x2f')]?_0x2bd94a[_0xad52('0x2d')]:_0x3886ec[_0xad52('0x29')];if(_0x134d54[_0xad52('0x2a')][_0xad52('0x39')]){_0x2bd94a[_0xad52('0x3e')]=[{'all':!![]}];}_0x2bd94a=_['merge']({},_0x2bd94a,_0x134d54[_0xad52('0x37')]);return db[_0xad52('0x27')][_0xad52('0x3f')](_0x2bd94a)['then'](handleEntityNotFound(_0x249724,null))[_0xad52('0x38')](respondWithResult(_0x249724,null))['catch'](handleError(_0x249724,null));};exports[_0xad52('0x40')]=function(_0x5bb02a,_0x4cf477){return db[_0xad52('0x27')][_0xad52('0x40')](_0x5bb02a[_0xad52('0x41')],{})[_0xad52('0x38')](respondWithResult(_0x4cf477,0xc9))['catch'](handleError(_0x4cf477,null));};exports['update']=function(_0x254416,_0x5dede4){if(_0x254416[_0xad52('0x41')]['id']){delete _0x254416['body']['id'];}return db[_0xad52('0x27')][_0xad52('0x3f')]({'where':{'id':_0x254416[_0xad52('0x3c')]['id']}})[_0xad52('0x38')](handleEntityNotFound(_0x5dede4,null))[_0xad52('0x38')](saveUpdates(_0x254416[_0xad52('0x41')],null))['then'](respondWithResult(_0x5dede4,null))[_0xad52('0x42')](handleError(_0x5dede4,null));};exports[_0xad52('0x21')]=function(_0x44c401,_0xb3a238){return db['FreshdeskField'][_0xad52('0x3f')]({'where':{'id':_0x44c401[_0xad52('0x3c')]['id']}})[_0xad52('0x38')](handleEntityNotFound(_0xb3a238,null))['then'](removeEntity(_0xb3a238,null))[_0xad52('0x42')](handleError(_0xb3a238,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 77cfa12..5fcdd2c 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 _0x59c0=['exports','int_freshdesk_fields','freshdesk_unique_index','idField','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intFreshdeskField.attributes'];(function(_0x3e6449,_0x5d46b0){var _0x530f70=function(_0x309c5b){while(--_0x309c5b){_0x3e6449['push'](_0x3e6449['shift']());}};_0x530f70(++_0x5d46b0);}(_0x59c0,0x163));var _0x059c=function(_0x1c75c1,_0x393564){_0x1c75c1=_0x1c75c1-0x0;var _0x576b28=_0x59c0[_0x1c75c1];return _0x576b28;};'use strict';var _=require('lodash');var util=require(_0x059c('0x0'));var logger=require(_0x059c('0x1'))(_0x059c('0x2'));var moment=require(_0x059c('0x3'));var BPromise=require(_0x059c('0x4'));var rp=require(_0x059c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x059c('0x6'));var config=require(_0x059c('0x7'));var attributes=require(_0x059c('0x8'));module[_0x059c('0x9')]=function(_0x1a0bd8,_0x41a8b8){return _0x1a0bd8['define']('FreshdeskField',attributes,{'tableName':_0x059c('0xa'),'paranoid':![],'indexes':[{'name':_0x059c('0xb'),'fields':[_0x059c('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb2ed=['FieldId','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','FreshdeskField','freshdesk_unique_index','idField'];(function(_0x5e21b0,_0x4d7961){var _0x5903e2=function(_0x510551){while(--_0x510551){_0x5e21b0['push'](_0x5e21b0['shift']());}};_0x5903e2(++_0x4d7961);}(_0xb2ed,0x127));var _0xdb2e=function(_0x10d34b,_0x4fef76){_0x10d34b=_0x10d34b-0x0;var _0x92b0bf=_0xb2ed[_0x10d34b];return _0x92b0bf;};'use strict';var _=require(_0xdb2e('0x0'));var util=require(_0xdb2e('0x1'));var logger=require(_0xdb2e('0x2'))(_0xdb2e('0x3'));var moment=require('moment');var BPromise=require(_0xdb2e('0x4'));var rp=require(_0xdb2e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdb2e('0x6'));var config=require(_0xdb2e('0x7'));var attributes=require(_0xdb2e('0x8'));module[_0xdb2e('0x9')]=function(_0x2761f1,_0x1dcc25){return _0x2761f1['define'](_0xdb2e('0xa'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':_0xdb2e('0xb'),'fields':[_0xdb2e('0xc'),_0xdb2e('0xd')],'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 a1da190..1ac5c57 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 _0x711d=['message','result','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x711d,0xc9));var _0xd711=function(_0x3c84eb,_0x4fbd31){_0x3c84eb=_0x3c84eb-0x0;var _0x2f7dec=_0x711d[_0x3c84eb];return _0x2f7dec;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd711('0x0'));var BPromise=require('bluebird');var rs=require(_0xd711('0x1'));var fs=require('fs');var Redis=require(_0xd711('0x2'));var db=require(_0xd711('0x3'))['db'];var utils=require(_0xd711('0x4'));var logger=require(_0xd711('0x5'))(_0xd711('0x6'));var config=require(_0xd711('0x7'));var jayson=require(_0xd711('0x8'));var client=jayson['client'][_0xd711('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x306e70,_0x39dae8,_0x50b7b0){return new BPromise(function(_0x25db2b,_0x45571c){return client[_0xd711('0xa')](_0x306e70,_0x50b7b0)[_0xd711('0xb')](function(_0x30048c){logger[_0xd711('0xc')](_0xd711('0xd'),_0x39dae8,_0xd711('0xe'));logger[_0xd711('0xf')](_0xd711('0x10'),_0x39dae8,'request\x20sent',JSON['stringify'](_0x30048c));if(_0x30048c[_0xd711('0x11')]){if(_0x30048c[_0xd711('0x11')][_0xd711('0x12')]===0x1f4){logger['error'](_0xd711('0xd'),_0x39dae8,_0x30048c[_0xd711('0x11')]['message']);return _0x45571c(_0x30048c[_0xd711('0x11')][_0xd711('0x13')]);}logger[_0xd711('0x11')](_0xd711('0xd'),_0x39dae8,_0x30048c['error'][_0xd711('0x13')]);return _0x25db2b(_0x30048c[_0xd711('0x11')][_0xd711('0x13')]);}else{logger[_0xd711('0xc')](_0xd711('0xd'),_0x39dae8,_0xd711('0xe'));_0x25db2b(_0x30048c[_0xd711('0x14')][_0xd711('0x13')]);}})[_0xd711('0x15')](function(_0x2eb084){logger[_0xd711('0x11')](_0xd711('0xd'),_0x39dae8,_0x2eb084);_0x45571c(_0x2eb084);});});} \ No newline at end of file +var _0x34f2=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshdeskField,\x20%s,\x20%s','message'];(function(_0x52c8a7,_0x51cbf6){var _0x2865b3=function(_0x22e863){while(--_0x22e863){_0x52c8a7['push'](_0x52c8a7['shift']());}};_0x2865b3(++_0x51cbf6);}(_0x34f2,0x160));var _0x234f=function(_0x2302ca,_0x153050){_0x2302ca=_0x2302ca-0x0;var _0x295129=_0x34f2[_0x2302ca];return _0x295129;};'use strict';var _=require(_0x234f('0x0'));var util=require(_0x234f('0x1'));var moment=require(_0x234f('0x2'));var BPromise=require(_0x234f('0x3'));var rs=require(_0x234f('0x4'));var fs=require('fs');var Redis=require(_0x234f('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x234f('0x6'));var logger=require(_0x234f('0x7'))(_0x234f('0x8'));var config=require(_0x234f('0x9'));var jayson=require(_0x234f('0xa'));var client=jayson[_0x234f('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e22f0,_0x5180c4,_0x275ab3){return new BPromise(function(_0xe9c5a0,_0x3e4f1b){return client[_0x234f('0xc')](_0x4e22f0,_0x275ab3)['then'](function(_0x521ddf){logger[_0x234f('0xd')]('FreshdeskField,\x20%s,\x20%s',_0x5180c4,_0x234f('0xe'));logger[_0x234f('0xf')](_0x234f('0x10'),_0x5180c4,_0x234f('0xe'),JSON[_0x234f('0x11')](_0x521ddf));if(_0x521ddf[_0x234f('0x12')]){if(_0x521ddf[_0x234f('0x12')][_0x234f('0x13')]===0x1f4){logger[_0x234f('0x12')](_0x234f('0x14'),_0x5180c4,_0x521ddf['error']['message']);return _0x3e4f1b(_0x521ddf[_0x234f('0x12')]['message']);}logger[_0x234f('0x12')](_0x234f('0x14'),_0x5180c4,_0x521ddf[_0x234f('0x12')][_0x234f('0x15')]);return _0xe9c5a0(_0x521ddf[_0x234f('0x12')][_0x234f('0x15')]);}else{logger[_0x234f('0xd')](_0x234f('0x14'),_0x5180c4,_0x234f('0xe'));_0xe9c5a0(_0x521ddf['result'][_0x234f('0x15')]);}})['catch'](function(_0x3e286b){logger['error'](_0x234f('0x14'),_0x5180c4,_0x3e286b);_0x3e4f1b(_0x3e286b);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index be34d02..624f471 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 _0xbf6e=['./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x118355,_0x201311){var _0x32f7ea=function(_0x4fd55b){while(--_0x4fd55b){_0x118355['push'](_0x118355['shift']());}};_0x32f7ea(++_0x201311);}(_0xbf6e,0x149));var _0xebf6=function(_0x3d8088,_0x59af8b){_0x3d8088=_0x3d8088-0x0;var _0x1705a6=_0xbf6e[_0x3d8088];return _0x1705a6;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xebf6('0x0'));var timeout=require(_0xebf6('0x1'));var express=require(_0xebf6('0x2'));var router=express[_0xebf6('0x3')]();var fs_extra=require(_0xebf6('0x4'));var auth=require(_0xebf6('0x5'));var interaction=require(_0xebf6('0x6'));var config=require('../../config/environment');var controller=require(_0xebf6('0x7'));router[_0xebf6('0x8')]('/',auth[_0xebf6('0x9')](),controller[_0xebf6('0xa')]);router[_0xebf6('0x8')](_0xebf6('0xb'),auth[_0xebf6('0x9')](),controller['show']);router[_0xebf6('0x8')](_0xebf6('0xc'),auth[_0xebf6('0x9')](),controller['getConfigurations']);router[_0xebf6('0x8')](_0xebf6('0xd'),auth['isAuthenticated'](),controller[_0xebf6('0xe')]);router[_0xebf6('0xf')]('/',auth[_0xebf6('0x9')](),controller[_0xebf6('0x10')]);router[_0xebf6('0xf')](_0xebf6('0xc'),auth['isAuthenticated'](),controller[_0xebf6('0x11')]);router[_0xebf6('0x12')]('/:id',auth[_0xebf6('0x9')](),controller[_0xebf6('0x13')]);router[_0xebf6('0x14')](_0xebf6('0xb'),auth[_0xebf6('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x4483=['../../components/auth/service','../../components/interaction/service','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra'];(function(_0x4348f2,_0x41a1cf){var _0x2ae8d3=function(_0x34a55e){while(--_0x34a55e){_0x4348f2['push'](_0x4348f2['shift']());}};_0x2ae8d3(++_0x41a1cf);}(_0x4483,0x1a3));var _0x3448=function(_0x16195d,_0x361f73){_0x16195d=_0x16195d-0x0;var _0x5a104f=_0x4483[_0x16195d];return _0x5a104f;};'use strict';var multer=require(_0x3448('0x0'));var util=require(_0x3448('0x1'));var path=require(_0x3448('0x2'));var timeout=require('connect-timeout');var express=require(_0x3448('0x3'));var router=express[_0x3448('0x4')]();var fs_extra=require(_0x3448('0x5'));var auth=require(_0x3448('0x6'));var interaction=require(_0x3448('0x7'));var config=require('../../config/environment');var controller=require(_0x3448('0x8'));router[_0x3448('0x9')]('/',auth[_0x3448('0xa')](),controller[_0x3448('0xb')]);router[_0x3448('0x9')](_0x3448('0xc'),auth[_0x3448('0xa')](),controller[_0x3448('0xd')]);router['get']('/:id/configurations',auth[_0x3448('0xa')](),controller[_0x3448('0xe')]);router[_0x3448('0x9')](_0x3448('0xf'),auth[_0x3448('0xa')](),controller[_0x3448('0x10')]);router[_0x3448('0x11')]('/',auth[_0x3448('0xa')](),controller[_0x3448('0x12')]);router[_0x3448('0x11')](_0x3448('0x13'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0x3448('0x14')](_0x3448('0xc'),auth['isAuthenticated'](),controller[_0x3448('0x15')]);router[_0x3448('0x16')](_0x3448('0xc'),auth['isAuthenticated'](),controller[_0x3448('0x17')]);module[_0x3448('0x18')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 92a1810..f5997b7 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 _0x5c3c=['remoteUri','sequelize','exports','STRING','username'];(function(_0xc83285,_0x3860f3){var _0x59ef36=function(_0x375eaf){while(--_0x375eaf){_0xc83285['push'](_0xc83285['shift']());}};_0x59ef36(++_0x3860f3);}(_0x5c3c,0x132));var _0xc5c3=function(_0x50aa2e,_0xfbd6f0){_0x50aa2e=_0x50aa2e-0x0;var _0x5e07f0=_0x5c3c[_0x50aa2e];return _0x5e07f0;};'use strict';var Sequelize=require(_0xc5c3('0x0'));module[_0xc5c3('0x1')]={'name':{'type':Sequelize[_0xc5c3('0x2')]},'description':{'type':Sequelize[_0xc5c3('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0xc5c3('0x3')},'apiKey':{'type':Sequelize[_0xc5c3('0x2')]},'remoteUri':{'type':Sequelize[_0xc5c3('0x2')],'unique':_0xc5c3('0x4')},'serverUrl':{'type':Sequelize[_0xc5c3('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xe820=['sequelize','STRING','username'];(function(_0x21f1a7,_0x2561fe){var _0xd52580=function(_0x2994d6){while(--_0x2994d6){_0x21f1a7['push'](_0x21f1a7['shift']());}};_0xd52580(++_0x2561fe);}(_0xe820,0xd2));var _0x0e82=function(_0x41d7a3,_0x3ebd19){_0x41d7a3=_0x41d7a3-0x0;var _0x3f00bd=_0xe820[_0x41d7a3];return _0x3f00bd;};'use strict';var Sequelize=require(_0x0e82('0x0'));module['exports']={'name':{'type':Sequelize[_0x0e82('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x0e82('0x2')},'apiKey':{'type':Sequelize[_0x0e82('0x1')]},'remoteUri':{'type':Sequelize[_0x0e82('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x0e82('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 4db4996..339a00f 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 _0x8de1=['undefined','limit','count','offset','set','apply','update','destroy','then','end','sendStatus','error','name','index','map','FreshsalesAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','show','length','options','catch','create','body','find','params','getConfigurations','FreshsalesConfiguration','addConfiguration','findOne','AccountId','channel','Descriptions','getDescriptions','Subjects','FreshsalesField','username','remoteUri','apiKey','substring','lastIndexOf','GET','format','%s%s','Token\x20token=','users','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','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','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../components/integrations/configuration','status','json'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8de1,0x113));var _0x18de=function(_0x19c5dd,_0x2a35f5){_0x19c5dd=_0x19c5dd-0x0;var _0x40218d=_0x8de1[_0x19c5dd];return _0x40218d;};'use strict';var emlformat=require(_0x18de('0x0'));var rimraf=require(_0x18de('0x1'));var zipdir=require(_0x18de('0x2'));var jsonpatch=require(_0x18de('0x3'));var rp=require(_0x18de('0x4'));var moment=require(_0x18de('0x5'));var BPromise=require(_0x18de('0x6'));var Mustache=require(_0x18de('0x7'));var util=require(_0x18de('0x8'));var path=require(_0x18de('0x9'));var sox=require(_0x18de('0xa'));var csv=require(_0x18de('0xb'));var ejs=require(_0x18de('0xc'));var fs=require('fs');var fs_extra=require(_0x18de('0xd'));var _=require(_0x18de('0xe'));var squel=require(_0x18de('0xf'));var crypto=require('crypto');var jsforce=require(_0x18de('0x10'));var deskjs=require(_0x18de('0x11'));var toCsv=require(_0x18de('0xb'));var querystring=require('querystring');var Papa=require(_0x18de('0x12'));var Redis=require(_0x18de('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x18de('0x14'));var as=require(_0x18de('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x18de('0x16'));var utils=require(_0x18de('0x17'));var config=require(_0x18de('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x18de('0x19'));function respondWithStatusCode(_0x321cb6,_0x139737){_0x139737=_0x139737||0xcc;return function(_0x30ddda){if(_0x30ddda){return _0x321cb6['sendStatus'](_0x139737);}return _0x321cb6['status'](_0x139737)['end']();};}function respondWithResult(_0x3e283b,_0xb14c84){_0xb14c84=_0xb14c84||0xc8;return function(_0x37760b){if(_0x37760b){return _0x3e283b[_0x18de('0x1a')](_0xb14c84)[_0x18de('0x1b')](_0x37760b);}};}function respondWithFilteredResult(_0x2e1d4e,_0x4b62f6){return function(_0x26f07c){if(_0x26f07c){var _0x320e88=typeof _0x4b62f6['offset']===_0x18de('0x1c')&&typeof _0x4b62f6[_0x18de('0x1d')]===_0x18de('0x1c');var _0xe39aed=_0x26f07c[_0x18de('0x1e')];var _0x4c9c40=_0x320e88?0x0:_0x4b62f6[_0x18de('0x1f')];var _0x2df677=_0x320e88?_0x26f07c[_0x18de('0x1e')]:_0x4b62f6[_0x18de('0x1f')]+_0x4b62f6[_0x18de('0x1d')];var _0x5b6801;if(_0x2df677>=_0xe39aed){_0x2df677=_0xe39aed;_0x5b6801=0xc8;}else{_0x5b6801=0xce;}_0x2e1d4e[_0x18de('0x1a')](_0x5b6801);return _0x2e1d4e[_0x18de('0x20')]('Content-Range',_0x4c9c40+'-'+_0x2df677+'/'+_0xe39aed)[_0x18de('0x1b')](_0x26f07c);}return null;};}function patchUpdates(_0x28ff4d){return function(_0x1b0fb1){try{jsonpatch[_0x18de('0x21')](_0x1b0fb1,_0x28ff4d,!![]);}catch(_0x1de8e7){return BPromise['reject'](_0x1de8e7);}return _0x1b0fb1['save']();};}function saveUpdates(_0x492af9,_0x24fb67){return function(_0x23a430){if(_0x23a430){return _0x23a430[_0x18de('0x22')](_0x492af9)['then'](function(_0x5c9f34){return _0x5c9f34;});}return null;};}function removeEntity(_0x1c3aa2,_0x2b8bc1){return function(_0x225af4){if(_0x225af4){return _0x225af4[_0x18de('0x23')]()[_0x18de('0x24')](function(){_0x1c3aa2[_0x18de('0x1a')](0xcc)[_0x18de('0x25')]();});}};}function handleEntityNotFound(_0x522a84,_0x4011ee){return function(_0x35237e){if(!_0x35237e){_0x522a84[_0x18de('0x26')](0x194);}return _0x35237e;};}function handleError(_0x3adc50,_0x5aad22){_0x5aad22=_0x5aad22||0x1f4;return function(_0x421856){logger[_0x18de('0x27')](_0x421856['stack']);if(_0x421856[_0x18de('0x28')]){delete _0x421856[_0x18de('0x28')];}_0x3adc50['status'](_0x5aad22)['send'](_0x421856);};}exports[_0x18de('0x29')]=function(_0x36485e,_0x3c3ea8){var _0x26f7dd={},_0x598d4d={},_0x1b1ebc={'count':0x0,'rows':[]};var _0x3d46a6=_[_0x18de('0x2a')](db[_0x18de('0x2b')][_0x18de('0x2c')],function(_0xb951a5){return{'name':_0xb951a5[_0x18de('0x2d')],'type':_0xb951a5[_0x18de('0x2e')][_0x18de('0x2f')]};});_0x598d4d[_0x18de('0x30')]=_[_0x18de('0x2a')](_0x3d46a6,_0x18de('0x28'));_0x598d4d[_0x18de('0x31')]=_[_0x18de('0x32')](_0x36485e[_0x18de('0x31')]);_0x598d4d[_0x18de('0x33')]=_[_0x18de('0x34')](_0x598d4d[_0x18de('0x30')],_0x598d4d['query']);_0x26f7dd[_0x18de('0x35')]=_[_0x18de('0x34')](_0x598d4d[_0x18de('0x30')],qs[_0x18de('0x36')](_0x36485e[_0x18de('0x31')]['fields']));_0x26f7dd['attributes']=_0x26f7dd[_0x18de('0x35')]['length']?_0x26f7dd['attributes']:_0x598d4d[_0x18de('0x30')];if(!_0x36485e[_0x18de('0x31')][_0x18de('0x37')](_0x18de('0x38'))){_0x26f7dd[_0x18de('0x1d')]=qs['limit'](_0x36485e[_0x18de('0x31')][_0x18de('0x1d')]);_0x26f7dd[_0x18de('0x1f')]=qs['offset'](_0x36485e[_0x18de('0x31')]['offset']);}_0x26f7dd[_0x18de('0x39')]=qs[_0x18de('0x3a')](_0x36485e[_0x18de('0x31')][_0x18de('0x3a')]);_0x26f7dd[_0x18de('0x3b')]=qs[_0x18de('0x33')](_[_0x18de('0x3c')](_0x36485e[_0x18de('0x31')],_0x598d4d[_0x18de('0x33')]),_0x3d46a6);if(_0x36485e[_0x18de('0x31')][_0x18de('0x3d')]){_0x26f7dd[_0x18de('0x3b')]=_[_0x18de('0x3e')](_0x26f7dd[_0x18de('0x3b')],{'$or':_[_0x18de('0x2a')](_0x3d46a6,function(_0x10f2c9){if(_0x10f2c9[_0x18de('0x2e')]!==_0x18de('0x3f')){var _0x1d615a={};_0x1d615a[_0x10f2c9['name']]={'$like':'%'+_0x36485e[_0x18de('0x31')]['filter']+'%'};return _0x1d615a;}})});}_0x26f7dd=_[_0x18de('0x3e')]({},_0x26f7dd,_0x36485e['options']);var _0x256e7c={'where':_0x26f7dd[_0x18de('0x3b')]};return db[_0x18de('0x2b')][_0x18de('0x1e')](_0x256e7c)['then'](function(_0x4d3674){_0x1b1ebc[_0x18de('0x1e')]=_0x4d3674;if(_0x36485e[_0x18de('0x31')][_0x18de('0x40')]){_0x26f7dd[_0x18de('0x41')]=[{'all':!![]}];}return db[_0x18de('0x2b')][_0x18de('0x42')](_0x26f7dd);})['then'](function(_0x2a9223){_0x1b1ebc['rows']=_0x2a9223;return _0x1b1ebc;})['then'](respondWithFilteredResult(_0x3c3ea8,_0x26f7dd))['catch'](handleError(_0x3c3ea8,null));};exports[_0x18de('0x43')]=function(_0x59b0c9,_0x3d51f3){var _0x24f30c={'raw':![],'where':{'id':_0x59b0c9['params']['id']}},_0x3eaa69={};_0x3eaa69[_0x18de('0x30')]=_[_0x18de('0x32')](db[_0x18de('0x2b')]['rawAttributes']);_0x3eaa69['query']=_[_0x18de('0x32')](_0x59b0c9['query']);_0x3eaa69[_0x18de('0x33')]=_['intersection'](_0x3eaa69['model'],_0x3eaa69['query']);_0x24f30c[_0x18de('0x35')]=_[_0x18de('0x34')](_0x3eaa69[_0x18de('0x30')],qs[_0x18de('0x36')](_0x59b0c9[_0x18de('0x31')][_0x18de('0x36')]));_0x24f30c['attributes']=_0x24f30c['attributes'][_0x18de('0x44')]?_0x24f30c[_0x18de('0x35')]:_0x3eaa69[_0x18de('0x30')];if(_0x59b0c9[_0x18de('0x31')][_0x18de('0x40')]){_0x24f30c[_0x18de('0x41')]=[{'all':!![]}];}_0x24f30c=_[_0x18de('0x3e')]({},_0x24f30c,_0x59b0c9[_0x18de('0x45')]);return db[_0x18de('0x2b')]['find'](_0x24f30c)['then'](handleEntityNotFound(_0x3d51f3,null))[_0x18de('0x24')](respondWithResult(_0x3d51f3,null))[_0x18de('0x46')](handleError(_0x3d51f3,null));};exports[_0x18de('0x47')]=function(_0x158a71,_0x537fe7){return db[_0x18de('0x2b')][_0x18de('0x47')](_0x158a71['body'],{})[_0x18de('0x24')](respondWithResult(_0x537fe7,0xc9))[_0x18de('0x46')](handleError(_0x537fe7,null));};exports[_0x18de('0x22')]=function(_0xd87198,_0x3a7913){if(_0xd87198[_0x18de('0x48')]['id']){delete _0xd87198[_0x18de('0x48')]['id'];}return db[_0x18de('0x2b')][_0x18de('0x49')]({'where':{'id':_0xd87198['params']['id']}})[_0x18de('0x24')](handleEntityNotFound(_0x3a7913,null))['then'](saveUpdates(_0xd87198[_0x18de('0x48')],null))[_0x18de('0x24')](respondWithResult(_0x3a7913,null))['catch'](handleError(_0x3a7913,null));};exports[_0x18de('0x23')]=function(_0x49f5c7,_0x321d59){return db[_0x18de('0x2b')][_0x18de('0x49')]({'where':{'id':_0x49f5c7[_0x18de('0x4a')]['id']}})[_0x18de('0x24')](handleEntityNotFound(_0x321d59,null))['then'](removeEntity(_0x321d59,null))['catch'](handleError(_0x321d59,null));};exports[_0x18de('0x4b')]=function(_0x1eb707,_0x226b61,_0x35b7c5){var _0x18d275={};var _0x592db3={};var _0x4e6bdc;var _0x3db84b;return db[_0x18de('0x2b')]['findOne']({'where':{'id':_0x1eb707[_0x18de('0x4a')]['id']}})['then'](handleEntityNotFound(_0x226b61,null))['then'](function(_0x53009e){if(_0x53009e){_0x4e6bdc=_0x53009e;_0x592db3[_0x18de('0x30')]=_[_0x18de('0x32')](db[_0x18de('0x4c')][_0x18de('0x2c')]);_0x592db3[_0x18de('0x31')]=_[_0x18de('0x32')](_0x1eb707[_0x18de('0x31')]);_0x592db3[_0x18de('0x33')]=_[_0x18de('0x34')](_0x592db3[_0x18de('0x30')],_0x592db3[_0x18de('0x31')]);_0x18d275['attributes']=_[_0x18de('0x34')](_0x592db3[_0x18de('0x30')],qs[_0x18de('0x36')](_0x1eb707[_0x18de('0x31')][_0x18de('0x36')]));_0x18d275['attributes']=_0x18d275[_0x18de('0x35')][_0x18de('0x44')]?_0x18d275[_0x18de('0x35')]:_0x592db3[_0x18de('0x30')];_0x18d275['order']=qs[_0x18de('0x3a')](_0x1eb707[_0x18de('0x31')][_0x18de('0x3a')]);_0x18d275[_0x18de('0x3b')]=qs[_0x18de('0x33')](_['pick'](_0x1eb707['query'],_0x592db3['filters']));if(_0x1eb707[_0x18de('0x31')]['filter']){_0x18d275[_0x18de('0x3b')]=_['merge'](_0x18d275[_0x18de('0x3b')],{'$or':_[_0x18de('0x2a')](_0x18d275[_0x18de('0x35')],function(_0x4c6412){var _0x467981={};_0x467981[_0x4c6412]={'$like':'%'+_0x1eb707[_0x18de('0x31')]['filter']+'%'};return _0x467981;})});}_0x18d275=_[_0x18de('0x3e')]({},_0x18d275,_0x1eb707['options']);return _0x4e6bdc['getConfigurations'](_0x18d275);}})[_0x18de('0x24')](function(_0x4c7376){if(_0x4c7376){_0x3db84b=_0x4c7376[_0x18de('0x44')];if(!_0x1eb707[_0x18de('0x31')][_0x18de('0x37')](_0x18de('0x38'))){_0x18d275[_0x18de('0x1d')]=qs[_0x18de('0x1d')](_0x1eb707[_0x18de('0x31')]['limit']);_0x18d275[_0x18de('0x1f')]=qs['offset'](_0x1eb707[_0x18de('0x31')][_0x18de('0x1f')]);}return _0x4e6bdc[_0x18de('0x4b')](_0x18d275);}})['then'](function(_0x48e981){if(_0x48e981){return _0x48e981?{'count':_0x3db84b,'rows':_0x48e981}:null;}})[_0x18de('0x24')](respondWithResult(_0x226b61,null))[_0x18de('0x46')](handleError(_0x226b61,null));};exports[_0x18de('0x4d')]=function(_0x1bff95,_0x5a256c,_0x1c4f68){if(_0x1bff95[_0x18de('0x48')]['id']){delete _0x1bff95['body']['id'];}return db[_0x18de('0x2b')][_0x18de('0x4e')]({'where':{'id':_0x1bff95['params']['id']}})[_0x18de('0x24')](handleEntityNotFound(_0x5a256c,null))[_0x18de('0x24')](function(_0x3a8450){if(_0x3a8450){_0x1bff95[_0x18de('0x48')][_0x18de('0x4f')]=_0x3a8450['id'];_0x1bff95['body']['Subjects']=integrations['getSubjects'](_0x1bff95['body'][_0x18de('0x50')],_0x1bff95['body'][_0x18de('0x2e')]);_0x1bff95[_0x18de('0x48')][_0x18de('0x51')]=integrations[_0x18de('0x52')](_0x1bff95[_0x18de('0x48')][_0x18de('0x50')],_0x1bff95[_0x18de('0x48')]['type']);return db[_0x18de('0x4c')]['create'](_0x1bff95[_0x18de('0x48')],{'include':[{'model':db['FreshsalesField'],'as':_0x18de('0x53')},{'model':db[_0x18de('0x54')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x5a256c,null))[_0x18de('0x46')](handleError(_0x5a256c,null));};exports['getFields']=function(_0x483b89,_0x23cba8,_0x119aba){var _0x535985='';var _0x24fd1e='';return db['FreshsalesAccount'][_0x18de('0x4e')]({'where':{'id':_0x483b89[_0x18de('0x4a')]['id']},'attributes':['id',_0x18de('0x55'),_0x18de('0x56'),_0x18de('0x57')]})[_0x18de('0x24')](handleEntityNotFound(_0x23cba8,null))[_0x18de('0x24')](function(_0x347b03){if(_0x347b03){_0x24fd1e=_0x347b03[_0x18de('0x55')];_0x535985=_0x347b03['remoteUri'];var _0x25697e=_0x347b03[_0x18de('0x56')]['slice'](-0x1);if(_0x25697e==='/'){_0x535985=_0x535985[_0x18de('0x58')](0x0,_0x535985[_0x18de('0x59')](_0x25697e));}return rp({'method':_0x18de('0x5a'),'uri':util[_0x18de('0x5b')](_0x18de('0x5c'),_0x535985,'/api/selector/owners'),'headers':{'Authorization':_0x18de('0x5d')+_0x347b03['apiKey']},'json':!![]});}})[_0x18de('0x24')](function(_0x448b38){if(_0x448b38){var _0x40aa26=_0x448b38[_0x18de('0x5e')];var _0x42d34e=![];var _0x45046d=null;for(_0x45046d=0x0;_0x45046d<_0x40aa26['length'];_0x45046d++){if(_0x40aa26[_0x45046d]['email']===_0x24fd1e){_0x42d34e=!![];}}if(_0x42d34e){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x18de('0x5f')});}}})['then'](respondWithResult(_0x23cba8,null))[_0x18de('0x46')](function(_0x37212c){var _0x4bf079=_0x483b89[_0x18de('0x31')][_0x18de('0x60')]?0x1f4:_0x37212c[_0x18de('0x61')]||0x1f4;logger['error'](_0x18de('0x62'),_0x18de('0x63'),_0x4bf079,JSON['stringify'](_0x37212c));delete _0x37212c['name'];if(_0x4bf079===0x191){_0x4bf079=0x190;}_0x23cba8[_0x18de('0x1a')](_0x4bf079)['send'](_0x483b89[_0x18de('0x31')][_0x18de('0x60')]?{'message':_0x18de('0x64'),'statusCode':_0x37212c[_0x18de('0x61')]}:_0x37212c);});}; \ No newline at end of file +var _0x3d97=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','end','stack','name','send','map','FreshsalesAccount','fieldName','type','model','query','filters','intersection','fields','attributes','length','offset','order','sort','where','pick','merge','options','include','rows','catch','show','params','keys','includeAll','find','create','body','getConfigurations','findOne','rawAttributes','filter','nolimit','Subjects','getSubjects','Descriptions','getDescriptions','channel','FreshsalesField','username','remoteUri','apiKey','slice','substring','lastIndexOf','format','/api/selector/owners','Token\x20token=','users','Requested\x20Resource\x20not\x20Found','test','error','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce'];(function(_0x5de66f,_0x326c91){var _0x226e23=function(_0x51b0b3){while(--_0x51b0b3){_0x5de66f['push'](_0x5de66f['shift']());}};_0x226e23(++_0x326c91);}(_0x3d97,0x1db));var _0x73d9=function(_0x2d73ec,_0x1daaeb){_0x2d73ec=_0x2d73ec-0x0;var _0x2a4437=_0x3d97[_0x2d73ec];return _0x2a4437;};'use strict';var emlformat=require(_0x73d9('0x0'));var rimraf=require(_0x73d9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x73d9('0x2'));var rp=require(_0x73d9('0x3'));var moment=require(_0x73d9('0x4'));var BPromise=require(_0x73d9('0x5'));var Mustache=require(_0x73d9('0x6'));var util=require(_0x73d9('0x7'));var path=require(_0x73d9('0x8'));var sox=require(_0x73d9('0x9'));var csv=require(_0x73d9('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x73d9('0xb'));var _=require('lodash');var squel=require(_0x73d9('0xc'));var crypto=require(_0x73d9('0xd'));var jsforce=require(_0x73d9('0xe'));var deskjs=require(_0x73d9('0xf'));var toCsv=require(_0x73d9('0xa'));var querystring=require(_0x73d9('0x10'));var Papa=require(_0x73d9('0x11'));var Redis=require(_0x73d9('0x12'));var authService=require(_0x73d9('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x73d9('0x14'));var logger=require(_0x73d9('0x15'))('api');var utils=require(_0x73d9('0x16'));var config=require(_0x73d9('0x17'));var licenseUtil=require(_0x73d9('0x18'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x5d9e7d,_0x502fea){_0x502fea=_0x502fea||0xcc;return function(_0x5e2ef7){if(_0x5e2ef7){return _0x5d9e7d[_0x73d9('0x19')](_0x502fea);}return _0x5d9e7d[_0x73d9('0x1a')](_0x502fea)['end']();};}function respondWithResult(_0xec8c04,_0x477139){_0x477139=_0x477139||0xc8;return function(_0x56fdf4){if(_0x56fdf4){return _0xec8c04[_0x73d9('0x1a')](_0x477139)[_0x73d9('0x1b')](_0x56fdf4);}};}function respondWithFilteredResult(_0x22788a,_0x4e548f){return function(_0x50972e){if(_0x50972e){var _0xf352ff=typeof _0x4e548f['offset']===_0x73d9('0x1c')&&typeof _0x4e548f['limit']===_0x73d9('0x1c');var _0x460aee=_0x50972e[_0x73d9('0x1d')];var _0x2be1a6=_0xf352ff?0x0:_0x4e548f['offset'];var _0x44a097=_0xf352ff?_0x50972e[_0x73d9('0x1d')]:_0x4e548f['offset']+_0x4e548f[_0x73d9('0x1e')];var _0x474e12;if(_0x44a097>=_0x460aee){_0x44a097=_0x460aee;_0x474e12=0xc8;}else{_0x474e12=0xce;}_0x22788a[_0x73d9('0x1a')](_0x474e12);return _0x22788a[_0x73d9('0x1f')](_0x73d9('0x20'),_0x2be1a6+'-'+_0x44a097+'/'+_0x460aee)[_0x73d9('0x1b')](_0x50972e);}return null;};}function patchUpdates(_0x498793){return function(_0x1bb474){try{jsonpatch[_0x73d9('0x21')](_0x1bb474,_0x498793,!![]);}catch(_0x2b9f9c){return BPromise[_0x73d9('0x22')](_0x2b9f9c);}return _0x1bb474['save']();};}function saveUpdates(_0x29981a,_0x845fc8){return function(_0x596fe4){if(_0x596fe4){return _0x596fe4[_0x73d9('0x23')](_0x29981a)[_0x73d9('0x24')](function(_0x46cb56){return _0x46cb56;});}return null;};}function removeEntity(_0x282194,_0x22d4c4){return function(_0x354675){if(_0x354675){return _0x354675[_0x73d9('0x25')]()[_0x73d9('0x24')](function(){_0x282194[_0x73d9('0x1a')](0xcc)[_0x73d9('0x26')]();});}};}function handleEntityNotFound(_0x548d87,_0x618195){return function(_0x2be811){if(!_0x2be811){_0x548d87['sendStatus'](0x194);}return _0x2be811;};}function handleError(_0x16d855,_0x4ebee8){_0x4ebee8=_0x4ebee8||0x1f4;return function(_0x5efa6d){logger['error'](_0x5efa6d[_0x73d9('0x27')]);if(_0x5efa6d[_0x73d9('0x28')]){delete _0x5efa6d['name'];}_0x16d855[_0x73d9('0x1a')](_0x4ebee8)[_0x73d9('0x29')](_0x5efa6d);};}exports['index']=function(_0x15f068,_0x5d2d51){var _0x5a6b74={},_0x4ae849={},_0x24c7f6={'count':0x0,'rows':[]};var _0x564f4b=_[_0x73d9('0x2a')](db[_0x73d9('0x2b')]['rawAttributes'],function(_0xa7bf8){return{'name':_0xa7bf8[_0x73d9('0x2c')],'type':_0xa7bf8[_0x73d9('0x2d')]['key']};});_0x4ae849[_0x73d9('0x2e')]=_[_0x73d9('0x2a')](_0x564f4b,'name');_0x4ae849[_0x73d9('0x2f')]=_['keys'](_0x15f068[_0x73d9('0x2f')]);_0x4ae849[_0x73d9('0x30')]=_['intersection'](_0x4ae849[_0x73d9('0x2e')],_0x4ae849[_0x73d9('0x2f')]);_0x5a6b74['attributes']=_[_0x73d9('0x31')](_0x4ae849['model'],qs[_0x73d9('0x32')](_0x15f068[_0x73d9('0x2f')][_0x73d9('0x32')]));_0x5a6b74[_0x73d9('0x33')]=_0x5a6b74[_0x73d9('0x33')][_0x73d9('0x34')]?_0x5a6b74[_0x73d9('0x33')]:_0x4ae849[_0x73d9('0x2e')];if(!_0x15f068[_0x73d9('0x2f')]['hasOwnProperty']('nolimit')){_0x5a6b74[_0x73d9('0x1e')]=qs[_0x73d9('0x1e')](_0x15f068[_0x73d9('0x2f')][_0x73d9('0x1e')]);_0x5a6b74[_0x73d9('0x35')]=qs[_0x73d9('0x35')](_0x15f068[_0x73d9('0x2f')][_0x73d9('0x35')]);}_0x5a6b74[_0x73d9('0x36')]=qs[_0x73d9('0x37')](_0x15f068[_0x73d9('0x2f')]['sort']);_0x5a6b74[_0x73d9('0x38')]=qs[_0x73d9('0x30')](_[_0x73d9('0x39')](_0x15f068[_0x73d9('0x2f')],_0x4ae849[_0x73d9('0x30')]),_0x564f4b);if(_0x15f068[_0x73d9('0x2f')]['filter']){_0x5a6b74[_0x73d9('0x38')]=_[_0x73d9('0x3a')](_0x5a6b74['where'],{'$or':_[_0x73d9('0x2a')](_0x564f4b,function(_0x2e1135){if(_0x2e1135['type']!=='VIRTUAL'){var _0x370128={};_0x370128[_0x2e1135['name']]={'$like':'%'+_0x15f068[_0x73d9('0x2f')]['filter']+'%'};return _0x370128;}})});}_0x5a6b74=_[_0x73d9('0x3a')]({},_0x5a6b74,_0x15f068[_0x73d9('0x3b')]);var _0x48e51c={'where':_0x5a6b74[_0x73d9('0x38')]};return db[_0x73d9('0x2b')][_0x73d9('0x1d')](_0x48e51c)['then'](function(_0x59c089){_0x24c7f6[_0x73d9('0x1d')]=_0x59c089;if(_0x15f068['query']['includeAll']){_0x5a6b74[_0x73d9('0x3c')]=[{'all':!![]}];}return db['FreshsalesAccount']['findAll'](_0x5a6b74);})[_0x73d9('0x24')](function(_0x9bc38b){_0x24c7f6[_0x73d9('0x3d')]=_0x9bc38b;return _0x24c7f6;})[_0x73d9('0x24')](respondWithFilteredResult(_0x5d2d51,_0x5a6b74))[_0x73d9('0x3e')](handleError(_0x5d2d51,null));};exports[_0x73d9('0x3f')]=function(_0x5573c0,_0x56c6d1){var _0x51a8df={'raw':![],'where':{'id':_0x5573c0[_0x73d9('0x40')]['id']}},_0x14eadc={};_0x14eadc[_0x73d9('0x2e')]=_['keys'](db['FreshsalesAccount']['rawAttributes']);_0x14eadc['query']=_[_0x73d9('0x41')](_0x5573c0['query']);_0x14eadc['filters']=_['intersection'](_0x14eadc['model'],_0x14eadc[_0x73d9('0x2f')]);_0x51a8df[_0x73d9('0x33')]=_['intersection'](_0x14eadc[_0x73d9('0x2e')],qs[_0x73d9('0x32')](_0x5573c0[_0x73d9('0x2f')]['fields']));_0x51a8df[_0x73d9('0x33')]=_0x51a8df[_0x73d9('0x33')][_0x73d9('0x34')]?_0x51a8df[_0x73d9('0x33')]:_0x14eadc[_0x73d9('0x2e')];if(_0x5573c0[_0x73d9('0x2f')][_0x73d9('0x42')]){_0x51a8df[_0x73d9('0x3c')]=[{'all':!![]}];}_0x51a8df=_['merge']({},_0x51a8df,_0x5573c0[_0x73d9('0x3b')]);return db[_0x73d9('0x2b')][_0x73d9('0x43')](_0x51a8df)[_0x73d9('0x24')](handleEntityNotFound(_0x56c6d1,null))[_0x73d9('0x24')](respondWithResult(_0x56c6d1,null))[_0x73d9('0x3e')](handleError(_0x56c6d1,null));};exports[_0x73d9('0x44')]=function(_0x57b8d6,_0x397097){return db[_0x73d9('0x2b')]['create'](_0x57b8d6[_0x73d9('0x45')],{})['then'](respondWithResult(_0x397097,0xc9))[_0x73d9('0x3e')](handleError(_0x397097,null));};exports[_0x73d9('0x23')]=function(_0x5e2073,_0x78d8c6){if(_0x5e2073[_0x73d9('0x45')]['id']){delete _0x5e2073[_0x73d9('0x45')]['id'];}return db[_0x73d9('0x2b')]['find']({'where':{'id':_0x5e2073[_0x73d9('0x40')]['id']}})[_0x73d9('0x24')](handleEntityNotFound(_0x78d8c6,null))[_0x73d9('0x24')](saveUpdates(_0x5e2073[_0x73d9('0x45')],null))[_0x73d9('0x24')](respondWithResult(_0x78d8c6,null))[_0x73d9('0x3e')](handleError(_0x78d8c6,null));};exports['destroy']=function(_0x171611,_0x1c882a){return db[_0x73d9('0x2b')][_0x73d9('0x43')]({'where':{'id':_0x171611[_0x73d9('0x40')]['id']}})[_0x73d9('0x24')](handleEntityNotFound(_0x1c882a,null))['then'](removeEntity(_0x1c882a,null))['catch'](handleError(_0x1c882a,null));};exports[_0x73d9('0x46')]=function(_0x2fde3e,_0x486b46,_0x48a8bd){var _0x129059={};var _0x48c26b={};var _0x4e4b71;var _0x44702d;return db[_0x73d9('0x2b')][_0x73d9('0x47')]({'where':{'id':_0x2fde3e[_0x73d9('0x40')]['id']}})[_0x73d9('0x24')](handleEntityNotFound(_0x486b46,null))[_0x73d9('0x24')](function(_0x210f33){if(_0x210f33){_0x4e4b71=_0x210f33;_0x48c26b[_0x73d9('0x2e')]=_[_0x73d9('0x41')](db['FreshsalesConfiguration'][_0x73d9('0x48')]);_0x48c26b[_0x73d9('0x2f')]=_[_0x73d9('0x41')](_0x2fde3e[_0x73d9('0x2f')]);_0x48c26b[_0x73d9('0x30')]=_['intersection'](_0x48c26b[_0x73d9('0x2e')],_0x48c26b[_0x73d9('0x2f')]);_0x129059[_0x73d9('0x33')]=_[_0x73d9('0x31')](_0x48c26b[_0x73d9('0x2e')],qs[_0x73d9('0x32')](_0x2fde3e['query'][_0x73d9('0x32')]));_0x129059[_0x73d9('0x33')]=_0x129059[_0x73d9('0x33')][_0x73d9('0x34')]?_0x129059[_0x73d9('0x33')]:_0x48c26b[_0x73d9('0x2e')];_0x129059[_0x73d9('0x36')]=qs['sort'](_0x2fde3e[_0x73d9('0x2f')][_0x73d9('0x37')]);_0x129059[_0x73d9('0x38')]=qs['filters'](_[_0x73d9('0x39')](_0x2fde3e[_0x73d9('0x2f')],_0x48c26b[_0x73d9('0x30')]));if(_0x2fde3e[_0x73d9('0x2f')]['filter']){_0x129059[_0x73d9('0x38')]=_[_0x73d9('0x3a')](_0x129059[_0x73d9('0x38')],{'$or':_['map'](_0x129059[_0x73d9('0x33')],function(_0x605aab){var _0x19f346={};_0x19f346[_0x605aab]={'$like':'%'+_0x2fde3e[_0x73d9('0x2f')][_0x73d9('0x49')]+'%'};return _0x19f346;})});}_0x129059=_['merge']({},_0x129059,_0x2fde3e[_0x73d9('0x3b')]);return _0x4e4b71[_0x73d9('0x46')](_0x129059);}})[_0x73d9('0x24')](function(_0x50e17e){if(_0x50e17e){_0x44702d=_0x50e17e['length'];if(!_0x2fde3e[_0x73d9('0x2f')]['hasOwnProperty'](_0x73d9('0x4a'))){_0x129059[_0x73d9('0x1e')]=qs[_0x73d9('0x1e')](_0x2fde3e['query']['limit']);_0x129059['offset']=qs['offset'](_0x2fde3e[_0x73d9('0x2f')][_0x73d9('0x35')]);}return _0x4e4b71[_0x73d9('0x46')](_0x129059);}})[_0x73d9('0x24')](function(_0x1d17dc){if(_0x1d17dc){return _0x1d17dc?{'count':_0x44702d,'rows':_0x1d17dc}:null;}})[_0x73d9('0x24')](respondWithResult(_0x486b46,null))[_0x73d9('0x3e')](handleError(_0x486b46,null));};exports['addConfiguration']=function(_0xebaf9c,_0x43e68e,_0x20b0b7){if(_0xebaf9c['body']['id']){delete _0xebaf9c[_0x73d9('0x45')]['id'];}return db[_0x73d9('0x2b')][_0x73d9('0x47')]({'where':{'id':_0xebaf9c[_0x73d9('0x40')]['id']}})['then'](handleEntityNotFound(_0x43e68e,null))['then'](function(_0x1d7c42){if(_0x1d7c42){_0xebaf9c['body']['AccountId']=_0x1d7c42['id'];_0xebaf9c[_0x73d9('0x45')][_0x73d9('0x4b')]=integrations[_0x73d9('0x4c')](_0xebaf9c[_0x73d9('0x45')]['channel'],_0xebaf9c[_0x73d9('0x45')]['type']);_0xebaf9c[_0x73d9('0x45')][_0x73d9('0x4d')]=integrations[_0x73d9('0x4e')](_0xebaf9c['body'][_0x73d9('0x4f')],_0xebaf9c[_0x73d9('0x45')][_0x73d9('0x2d')]);return db['FreshsalesConfiguration'][_0x73d9('0x44')](_0xebaf9c[_0x73d9('0x45')],{'include':[{'model':db[_0x73d9('0x50')],'as':_0x73d9('0x4b')},{'model':db[_0x73d9('0x50')],'as':'Descriptions'}]});}return null;})[_0x73d9('0x24')](respondWithResult(_0x43e68e,null))[_0x73d9('0x3e')](handleError(_0x43e68e,null));};exports['getFields']=function(_0x1982e1,_0x1d735a,_0x2b9295){var _0x33e363='';var _0x487726='';return db[_0x73d9('0x2b')][_0x73d9('0x47')]({'where':{'id':_0x1982e1[_0x73d9('0x40')]['id']},'attributes':['id',_0x73d9('0x51'),_0x73d9('0x52'),_0x73d9('0x53')]})[_0x73d9('0x24')](handleEntityNotFound(_0x1d735a,null))[_0x73d9('0x24')](function(_0x248015){if(_0x248015){_0x487726=_0x248015[_0x73d9('0x51')];_0x33e363=_0x248015[_0x73d9('0x52')];var _0x4f9eea=_0x248015[_0x73d9('0x52')][_0x73d9('0x54')](-0x1);if(_0x4f9eea==='/'){_0x33e363=_0x33e363[_0x73d9('0x55')](0x0,_0x33e363[_0x73d9('0x56')](_0x4f9eea));}return rp({'method':'GET','uri':util[_0x73d9('0x57')]('%s%s',_0x33e363,_0x73d9('0x58')),'headers':{'Authorization':_0x73d9('0x59')+_0x248015[_0x73d9('0x53')]},'json':!![]});}})[_0x73d9('0x24')](function(_0x30cfa6){if(_0x30cfa6){var _0x5efd93=_0x30cfa6[_0x73d9('0x5a')];var _0x2af477=![];var _0x5a2a34=null;for(_0x5a2a34=0x0;_0x5a2a34<_0x5efd93['length'];_0x5a2a34++){if(_0x5efd93[_0x5a2a34]['email']===_0x487726){_0x2af477=!![];}}if(_0x2af477){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x73d9('0x5b')});}}})[_0x73d9('0x24')](respondWithResult(_0x1d735a,null))[_0x73d9('0x3e')](function(_0x368568){var _0x5e518c=_0x1982e1['query'][_0x73d9('0x5c')]?0x1f4:_0x368568['statusCode']||0x1f4;logger[_0x73d9('0x5d')](_0x73d9('0x5e'),_0x73d9('0x5f'),_0x5e518c,JSON[_0x73d9('0x60')](_0x368568));delete _0x368568[_0x73d9('0x28')];if(_0x5e518c===0x191){_0x5e518c=0x190;}_0x1d735a['status'](_0x5e518c)[_0x73d9('0x29')](_0x1982e1['query'][_0x73d9('0x5c')]?{'message':_0x73d9('0x61'),'statusCode':_0x368568['statusCode']}:_0x368568);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 4002930..dd69697 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 _0x32f4=['define','FreshsalesAccount','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x4290e7,_0x57cd3b){var _0x2b63b9=function(_0x211f0d){while(--_0x211f0d){_0x4290e7['push'](_0x4290e7['shift']());}};_0x2b63b9(++_0x57cd3b);}(_0x32f4,0x154));var _0x432f=function(_0x4694d8,_0x5b23a8){_0x4694d8=_0x4694d8-0x0;var _0xe14393=_0x32f4[_0x4694d8];return _0xe14393;};'use strict';var _=require(_0x432f('0x0'));var util=require(_0x432f('0x1'));var logger=require(_0x432f('0x2'))(_0x432f('0x3'));var moment=require('moment');var BPromise=require(_0x432f('0x4'));var rp=require(_0x432f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x432f('0x6'));var config=require(_0x432f('0x7'));var attributes=require(_0x432f('0x8'));var integrations=require(_0x432f('0x9'));module[_0x432f('0xa')]=function(_0x5d8cc0,_0x5b5f08){return _0x5d8cc0[_0x432f('0xb')](_0x432f('0xc'),attributes,{'tableName':'int_freshsales_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9582=['bluebird','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','FreshsalesAccount','lodash','util','../../config/logger','api','moment'];(function(_0x287dc0,_0x284f0b){var _0x12c334=function(_0x31a131){while(--_0x31a131){_0x287dc0['push'](_0x287dc0['shift']());}};_0x12c334(++_0x284f0b);}(_0x9582,0x95));var _0x2958=function(_0x2aa1db,_0x4c4bdf){_0x2aa1db=_0x2aa1db-0x0;var _0x39f0b1=_0x9582[_0x2aa1db];return _0x39f0b1;};'use strict';var _=require(_0x2958('0x0'));var util=require(_0x2958('0x1'));var logger=require(_0x2958('0x2'))(_0x2958('0x3'));var moment=require(_0x2958('0x4'));var BPromise=require(_0x2958('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2958('0x6'));var rimraf=require(_0x2958('0x7'));var config=require(_0x2958('0x8'));var attributes=require(_0x2958('0x9'));var integrations=require(_0x2958('0xa'));module[_0x2958('0xb')]=function(_0x88ffaa,_0x309525){return _0x88ffaa[_0x2958('0xc')](_0x2958('0xd'),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 b69d90d..fdc70a9 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 _0x47c5=['include','model','attributes','map','GetFreshsalesAccount','ShowFreshsalesAccount','where','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','FreshsalesAccount','findAll','options','raw'];(function(_0x5681ed,_0x352e95){var _0x33d383=function(_0x127eb9){while(--_0x127eb9){_0x5681ed['push'](_0x5681ed['shift']());}};_0x33d383(++_0x352e95);}(_0x47c5,0x165));var _0x547c=function(_0xb517fb,_0x1ae8bc){_0xb517fb=_0xb517fb-0x0;var _0x348a16=_0x47c5[_0xb517fb];return _0x348a16;};'use strict';var _=require(_0x547c('0x0'));var util=require(_0x547c('0x1'));var moment=require(_0x547c('0x2'));var BPromise=require(_0x547c('0x3'));var rs=require(_0x547c('0x4'));var fs=require('fs');var Redis=require(_0x547c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x547c('0x6'));var logger=require(_0x547c('0x7'))('rpc');var config=require(_0x547c('0x8'));var jayson=require(_0x547c('0x9'));var client=jayson['client'][_0x547c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x439f25,_0x381f2e,_0x10a334){return new BPromise(function(_0x12fb7d,_0x4ef079){return client[_0x547c('0xb')](_0x439f25,_0x10a334)[_0x547c('0xc')](function(_0x10dec9){logger[_0x547c('0xd')](_0x547c('0xe'),_0x381f2e,_0x547c('0xf'));logger[_0x547c('0x10')](_0x547c('0x11'),_0x381f2e,_0x547c('0xf'),JSON[_0x547c('0x12')](_0x10dec9));if(_0x10dec9[_0x547c('0x13')]){if(_0x10dec9['error'][_0x547c('0x14')]===0x1f4){logger[_0x547c('0x13')]('FreshsalesAccount,\x20%s,\x20%s',_0x381f2e,_0x10dec9[_0x547c('0x13')][_0x547c('0x15')]);return _0x4ef079(_0x10dec9[_0x547c('0x13')][_0x547c('0x15')]);}logger[_0x547c('0x13')](_0x547c('0xe'),_0x381f2e,_0x10dec9[_0x547c('0x13')][_0x547c('0x15')]);return _0x12fb7d(_0x10dec9[_0x547c('0x13')][_0x547c('0x15')]);}else{logger[_0x547c('0xd')](_0x547c('0xe'),_0x381f2e,_0x547c('0xf'));_0x12fb7d(_0x10dec9[_0x547c('0x16')][_0x547c('0x15')]);}})[_0x547c('0x17')](function(_0x39498d){logger[_0x547c('0x13')]('FreshsalesAccount,\x20%s,\x20%s',_0x381f2e,_0x39498d);_0x4ef079(_0x39498d);});});}exports['GetFreshsalesAccount']=function(_0x23fa9e){var _0x199e4f=this;return new Promise(function(_0xeb059e,_0x4a8901){return db[_0x547c('0x18')][_0x547c('0x19')]({'raw':_0x23fa9e[_0x547c('0x1a')]?_0x23fa9e['options'][_0x547c('0x1b')]===undefined?!![]:![]:!![],'where':_0x23fa9e[_0x547c('0x1a')]?_0x23fa9e['options']['where']||null:null,'attributes':_0x23fa9e[_0x547c('0x1a')]?_0x23fa9e[_0x547c('0x1a')]['attributes']||null:null,'limit':_0x23fa9e[_0x547c('0x1a')]?_0x23fa9e[_0x547c('0x1a')]['limit']||null:null,'include':_0x23fa9e[_0x547c('0x1a')]?_0x23fa9e[_0x547c('0x1a')][_0x547c('0x1c')]?_['map'](_0x23fa9e[_0x547c('0x1a')][_0x547c('0x1c')],function(_0x470694){return{'model':db[_0x470694[_0x547c('0x1d')]],'as':_0x470694['as'],'attributes':_0x470694[_0x547c('0x1e')],'include':_0x470694[_0x547c('0x1c')]?_[_0x547c('0x1f')](_0x470694[_0x547c('0x1c')],function(_0x507895){return{'model':db[_0x507895[_0x547c('0x1d')]],'as':_0x507895['as'],'attributes':_0x507895['attributes'],'include':_0x507895['include']?_['map'](_0x507895['include'],function(_0x2c725d){return{'model':db[_0x2c725d['model']],'as':_0x2c725d['as'],'attributes':_0x2c725d[_0x547c('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3ea493){logger['info'](_0x547c('0x20'),_0x23fa9e);logger[_0x547c('0x10')](_0x547c('0x20'),_0x23fa9e,JSON[_0x547c('0x12')](_0x3ea493));_0xeb059e(_0x3ea493);})[_0x547c('0x17')](function(_0x569924){logger['error'](_0x547c('0x20'),_0x569924['message'],_0x23fa9e);_0x4a8901(_0x199e4f[_0x547c('0x13')](0x1f4,_0x569924[_0x547c('0x15')]));});});};exports[_0x547c('0x21')]=function(_0x1695be){var _0x4652e7=this;return new Promise(function(_0x51e6e7,_0x342c10){return db['FreshsalesAccount']['find']({'raw':_0x1695be[_0x547c('0x1a')]?_0x1695be[_0x547c('0x1a')][_0x547c('0x1b')]===undefined?!![]:![]:!![],'where':_0x1695be[_0x547c('0x1a')]?_0x1695be[_0x547c('0x1a')][_0x547c('0x22')]||null:null,'attributes':_0x1695be[_0x547c('0x1a')]?_0x1695be[_0x547c('0x1a')][_0x547c('0x1e')]||null:null,'include':_0x1695be[_0x547c('0x1a')]?_0x1695be[_0x547c('0x1a')][_0x547c('0x1c')]?_[_0x547c('0x1f')](_0x1695be[_0x547c('0x1a')]['include'],function(_0x3afc28){return{'model':db[_0x3afc28['model']],'as':_0x3afc28['as'],'attributes':_0x3afc28['attributes'],'include':_0x3afc28['include']?_[_0x547c('0x1f')](_0x3afc28[_0x547c('0x1c')],function(_0x31c7d3){return{'model':db[_0x31c7d3[_0x547c('0x1d')]],'as':_0x31c7d3['as'],'attributes':_0x31c7d3[_0x547c('0x1e')],'include':_0x31c7d3[_0x547c('0x1c')]?_['map'](_0x31c7d3['include'],function(_0x5ea2c7){return{'model':db[_0x5ea2c7[_0x547c('0x1d')]],'as':_0x5ea2c7['as'],'attributes':_0x5ea2c7[_0x547c('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x547c('0xc')](function(_0x44687e){logger[_0x547c('0xd')](_0x547c('0x21'),_0x1695be);logger['debug'](_0x547c('0x21'),_0x1695be,JSON['stringify'](_0x44687e));_0x51e6e7(_0x44687e);})[_0x547c('0x17')](function(_0x18fcc5){logger['error'](_0x547c('0x21'),_0x18fcc5['message'],_0x1695be);_0x342c10(_0x4652e7['error'](0x1f4,_0x18fcc5[_0x547c('0x15')]));});});}; \ No newline at end of file +var _0xba34=['request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowFreshsalesAccount','find','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshsalesAccount,\x20%s,\x20%s'];(function(_0x33ecfc,_0x27f029){var _0x299846=function(_0x48378b){while(--_0x48378b){_0x33ecfc['push'](_0x33ecfc['shift']());}};_0x299846(++_0x27f029);}(_0xba34,0x119));var _0x4ba3=function(_0x58204e,_0x35e4ad){_0x58204e=_0x58204e-0x0;var _0x488a2f=_0xba34[_0x58204e];return _0x488a2f;};'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);});});}exports[_0x4ba3('0x18')]=function(_0x5ff7ce){var _0x451c92=this;return new Promise(function(_0x556290,_0x2519bb){return db[_0x4ba3('0x19')][_0x4ba3('0x1a')]({'raw':_0x5ff7ce[_0x4ba3('0x1b')]?_0x5ff7ce[_0x4ba3('0x1b')][_0x4ba3('0x1c')]===undefined?!![]:![]:!![],'where':_0x5ff7ce['options']?_0x5ff7ce['options'][_0x4ba3('0x1d')]||null:null,'attributes':_0x5ff7ce['options']?_0x5ff7ce[_0x4ba3('0x1b')][_0x4ba3('0x1e')]||null:null,'limit':_0x5ff7ce[_0x4ba3('0x1b')]?_0x5ff7ce[_0x4ba3('0x1b')][_0x4ba3('0x1f')]||null:null,'include':_0x5ff7ce[_0x4ba3('0x1b')]?_0x5ff7ce['options'][_0x4ba3('0x20')]?_[_0x4ba3('0x21')](_0x5ff7ce['options'][_0x4ba3('0x20')],function(_0x4ffe39){return{'model':db[_0x4ffe39[_0x4ba3('0x22')]],'as':_0x4ffe39['as'],'attributes':_0x4ffe39[_0x4ba3('0x1e')],'include':_0x4ffe39[_0x4ba3('0x20')]?_[_0x4ba3('0x21')](_0x4ffe39[_0x4ba3('0x20')],function(_0xe29a49){return{'model':db[_0xe29a49[_0x4ba3('0x22')]],'as':_0xe29a49['as'],'attributes':_0xe29a49[_0x4ba3('0x1e')],'include':_0xe29a49[_0x4ba3('0x20')]?_[_0x4ba3('0x21')](_0xe29a49['include'],function(_0x252f37){return{'model':db[_0x252f37[_0x4ba3('0x22')]],'as':_0x252f37['as'],'attributes':_0x252f37[_0x4ba3('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x10537e){logger[_0x4ba3('0xd')](_0x4ba3('0x18'),_0x5ff7ce);logger['debug'](_0x4ba3('0x18'),_0x5ff7ce,JSON[_0x4ba3('0x12')](_0x10537e));_0x556290(_0x10537e);})[_0x4ba3('0x17')](function(_0x22394d){logger['error']('GetFreshsalesAccount',_0x22394d[_0x4ba3('0x15')],_0x5ff7ce);_0x2519bb(_0x451c92[_0x4ba3('0x13')](0x1f4,_0x22394d[_0x4ba3('0x15')]));});});};exports[_0x4ba3('0x23')]=function(_0x2cb5d5){var _0x11f88f=this;return new Promise(function(_0x48b3b7,_0x27444b){return db[_0x4ba3('0x19')][_0x4ba3('0x24')]({'raw':_0x2cb5d5[_0x4ba3('0x1b')]?_0x2cb5d5[_0x4ba3('0x1b')][_0x4ba3('0x1c')]===undefined?!![]:![]:!![],'where':_0x2cb5d5[_0x4ba3('0x1b')]?_0x2cb5d5[_0x4ba3('0x1b')][_0x4ba3('0x1d')]||null:null,'attributes':_0x2cb5d5[_0x4ba3('0x1b')]?_0x2cb5d5['options']['attributes']||null:null,'include':_0x2cb5d5['options']?_0x2cb5d5[_0x4ba3('0x1b')][_0x4ba3('0x20')]?_[_0x4ba3('0x21')](_0x2cb5d5[_0x4ba3('0x1b')][_0x4ba3('0x20')],function(_0x137f9b){return{'model':db[_0x137f9b[_0x4ba3('0x22')]],'as':_0x137f9b['as'],'attributes':_0x137f9b[_0x4ba3('0x1e')],'include':_0x137f9b[_0x4ba3('0x20')]?_[_0x4ba3('0x21')](_0x137f9b[_0x4ba3('0x20')],function(_0x3439cb){return{'model':db[_0x3439cb['model']],'as':_0x3439cb['as'],'attributes':_0x3439cb[_0x4ba3('0x1e')],'include':_0x3439cb[_0x4ba3('0x20')]?_[_0x4ba3('0x21')](_0x3439cb['include'],function(_0x188f8c){return{'model':db[_0x188f8c['model']],'as':_0x188f8c['as'],'attributes':_0x188f8c[_0x4ba3('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x4ba3('0xc')](function(_0x426e11){logger[_0x4ba3('0xd')](_0x4ba3('0x23'),_0x2cb5d5);logger[_0x4ba3('0x10')]('ShowFreshsalesAccount',_0x2cb5d5,JSON[_0x4ba3('0x12')](_0x426e11));_0x48b3b7(_0x426e11);})[_0x4ba3('0x17')](function(_0x2e77d4){logger['error'](_0x4ba3('0x23'),_0x2e77d4[_0x4ba3('0x15')],_0x2cb5d5);_0x27444b(_0x11f88f['error'](0x1f4,_0x2e77d4[_0x4ba3('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 6622c22..2bb59ec 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 _0xd9c5=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post'];(function(_0x4620d4,_0x515a83){var _0x5e4d64=function(_0x7292e9){while(--_0x7292e9){_0x4620d4['push'](_0x4620d4['shift']());}};_0x5e4d64(++_0x515a83);}(_0xd9c5,0x18c));var _0x5d9c=function(_0x53c87d,_0x26a4f5){_0x53c87d=_0x53c87d-0x0;var _0x42c635=_0xd9c5[_0x53c87d];return _0x42c635;};'use strict';var multer=require(_0x5d9c('0x0'));var util=require(_0x5d9c('0x1'));var path=require(_0x5d9c('0x2'));var timeout=require(_0x5d9c('0x3'));var express=require(_0x5d9c('0x4'));var router=express[_0x5d9c('0x5')]();var fs_extra=require(_0x5d9c('0x6'));var auth=require(_0x5d9c('0x7'));var interaction=require(_0x5d9c('0x8'));var config=require('../../config/environment');var controller=require(_0x5d9c('0x9'));router[_0x5d9c('0xa')]('/',auth[_0x5d9c('0xb')](),controller[_0x5d9c('0xc')]);router[_0x5d9c('0xa')](_0x5d9c('0xd'),auth[_0x5d9c('0xb')](),controller[_0x5d9c('0xe')]);router[_0x5d9c('0xa')](_0x5d9c('0xf'),auth[_0x5d9c('0xb')](),controller[_0x5d9c('0x10')]);router[_0x5d9c('0xa')](_0x5d9c('0x11'),auth[_0x5d9c('0xb')](),controller[_0x5d9c('0x12')]);router[_0x5d9c('0xa')]('/:id/fields',auth[_0x5d9c('0xb')](),controller['getFields']);router[_0x5d9c('0x13')]('/',auth[_0x5d9c('0xb')](),controller[_0x5d9c('0x14')]);router[_0x5d9c('0x15')](_0x5d9c('0xd'),auth['isAuthenticated'](),controller[_0x5d9c('0x16')]);router[_0x5d9c('0x17')](_0x5d9c('0xd'),auth[_0x5d9c('0xb')](),controller[_0x5d9c('0x18')]);module[_0x5d9c('0x19')]=router; \ No newline at end of file +var _0xaa89=['post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intFreshsalesConfiguration.controller','isAuthenticated','index','/:id','/:id/subjects','getSubjects','get','/:id/descriptions','getFields'];(function(_0x223e2e,_0x12226e){var _0xe9ab2a=function(_0x591125){while(--_0x591125){_0x223e2e['push'](_0x223e2e['shift']());}};_0xe9ab2a(++_0x12226e);}(_0xaa89,0xa7));var _0x9aa8=function(_0x340756,_0xad31ae){_0x340756=_0x340756-0x0;var _0x2ef745=_0xaa89[_0x340756];return _0x2ef745;};'use strict';var multer=require(_0x9aa8('0x0'));var util=require(_0x9aa8('0x1'));var path=require(_0x9aa8('0x2'));var timeout=require(_0x9aa8('0x3'));var express=require(_0x9aa8('0x4'));var router=express[_0x9aa8('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x9aa8('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9aa8('0x7'));var controller=require(_0x9aa8('0x8'));router['get']('/',auth[_0x9aa8('0x9')](),controller[_0x9aa8('0xa')]);router['get'](_0x9aa8('0xb'),auth['isAuthenticated'](),controller['show']);router['get'](_0x9aa8('0xc'),auth[_0x9aa8('0x9')](),controller[_0x9aa8('0xd')]);router[_0x9aa8('0xe')](_0x9aa8('0xf'),auth[_0x9aa8('0x9')](),controller['getDescriptions']);router[_0x9aa8('0xe')]('/:id/fields',auth[_0x9aa8('0x9')](),controller[_0x9aa8('0x10')]);router[_0x9aa8('0x11')]('/',auth['isAuthenticated'](),controller[_0x9aa8('0x12')]);router['put'](_0x9aa8('0xb'),auth[_0x9aa8('0x9')](),controller[_0x9aa8('0x13')]);router[_0x9aa8('0x14')](_0x9aa8('0xb'),auth[_0x9aa8('0x9')](),controller[_0x9aa8('0x15')]);module[_0x9aa8('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index d9583b0..05274b7 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 _0xd4b8=['STRING','exports'];(function(_0x138b14,_0x4e7854){var _0xa6c08c=function(_0x559547){while(--_0x559547){_0x138b14['push'](_0x138b14['shift']());}};_0xa6c08c(++_0x4e7854);}(_0xd4b8,0x10d));var _0x8d4b=function(_0x8566f1,_0x198297){_0x8566f1=_0x8566f1-0x0;var _0x2174c1=_0xd4b8[_0x8566f1];return _0x2174c1;};'use strict';var Sequelize=require('sequelize');module[_0x8d4b('0x0')]={'name':{'type':Sequelize[_0x8d4b('0x1')]},'description':{'type':Sequelize[_0x8d4b('0x1')]}}; \ No newline at end of file +var _0x0c83=['STRING','sequelize','exports'];(function(_0x27f97d,_0x342e86){var _0x212872=function(_0x22872e){while(--_0x22872e){_0x27f97d['push'](_0x27f97d['shift']());}};_0x212872(++_0x342e86);}(_0x0c83,0x1c9));var _0x30c8=function(_0x2ce422,_0x52a299){_0x2ce422=_0x2ce422-0x0;var _0x8b50fa=_0x0c83[_0x2ce422];return _0x8b50fa;};'use strict';var Sequelize=require(_0x30c8('0x0'));module[_0x30c8('0x1')]={'name':{'type':Sequelize[_0x30c8('0x2')]},'description':{'type':Sequelize[_0x30c8('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 162e9fc..a530224 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 _0xa9c3=['findOne','FreshsalesField','getDescriptions','getFields','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','json','offset','count','status','set','Content-Range','apply','reject','update','then','destroy','name','send','index','map','FreshsalesConfiguration','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','show','params','include','find','create','body','getSubjects'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9c3,0xa0));var _0x3a9c=function(_0xbf8ebe,_0x3b69a5){_0xbf8ebe=_0xbf8ebe-0x0;var _0x1e25e8=_0xa9c3[_0xbf8ebe];return _0x1e25e8;};'use strict';var emlformat=require(_0x3a9c('0x0'));var rimraf=require(_0x3a9c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3a9c('0x2'));var moment=require(_0x3a9c('0x3'));var BPromise=require(_0x3a9c('0x4'));var Mustache=require(_0x3a9c('0x5'));var util=require(_0x3a9c('0x6'));var path=require(_0x3a9c('0x7'));var sox=require(_0x3a9c('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3a9c('0x9'));var _=require(_0x3a9c('0xa'));var squel=require(_0x3a9c('0xb'));var crypto=require(_0x3a9c('0xc'));var jsforce=require(_0x3a9c('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x3a9c('0xe'));var querystring=require(_0x3a9c('0xf'));var Papa=require(_0x3a9c('0x10'));var Redis=require(_0x3a9c('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x3a9c('0x12'));var as=require(_0x3a9c('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3a9c('0x14'))('api');var utils=require(_0x3a9c('0x15'));var config=require(_0x3a9c('0x16'));var licenseUtil=require(_0x3a9c('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x429a29,_0xa68a88){_0xa68a88=_0xa68a88||0xcc;return function(_0x726f36){if(_0x726f36){return _0x429a29[_0x3a9c('0x18')](_0xa68a88);}return _0x429a29['status'](_0xa68a88)[_0x3a9c('0x19')]();};}function respondWithResult(_0x37a1ed,_0x244ad3){_0x244ad3=_0x244ad3||0xc8;return function(_0x10dd9e){if(_0x10dd9e){return _0x37a1ed['status'](_0x244ad3)[_0x3a9c('0x1a')](_0x10dd9e);}};}function respondWithFilteredResult(_0x5667e8,_0x346b7c){return function(_0x33e847){if(_0x33e847){var _0xcd5713=typeof _0x346b7c[_0x3a9c('0x1b')]==='undefined'&&typeof _0x346b7c['limit']==='undefined';var _0xff1532=_0x33e847['count'];var _0x39cfba=_0xcd5713?0x0:_0x346b7c[_0x3a9c('0x1b')];var _0x4c3594=_0xcd5713?_0x33e847[_0x3a9c('0x1c')]:_0x346b7c[_0x3a9c('0x1b')]+_0x346b7c['limit'];var _0x3d1c81;if(_0x4c3594>=_0xff1532){_0x4c3594=_0xff1532;_0x3d1c81=0xc8;}else{_0x3d1c81=0xce;}_0x5667e8[_0x3a9c('0x1d')](_0x3d1c81);return _0x5667e8[_0x3a9c('0x1e')](_0x3a9c('0x1f'),_0x39cfba+'-'+_0x4c3594+'/'+_0xff1532)[_0x3a9c('0x1a')](_0x33e847);}return null;};}function patchUpdates(_0x55a2e6){return function(_0x35fbd3){try{jsonpatch[_0x3a9c('0x20')](_0x35fbd3,_0x55a2e6,!![]);}catch(_0x15cf59){return BPromise[_0x3a9c('0x21')](_0x15cf59);}return _0x35fbd3['save']();};}function saveUpdates(_0x4b29ab,_0x24f0af){return function(_0x413e94){if(_0x413e94){return _0x413e94[_0x3a9c('0x22')](_0x4b29ab)[_0x3a9c('0x23')](function(_0x5553e3){return _0x5553e3;});}return null;};}function removeEntity(_0x203860,_0x11db44){return function(_0x597a24){if(_0x597a24){return _0x597a24[_0x3a9c('0x24')]()['then'](function(){_0x203860['status'](0xcc)[_0x3a9c('0x19')]();});}};}function handleEntityNotFound(_0x586809,_0x42102a){return function(_0x55d92d){if(!_0x55d92d){_0x586809['sendStatus'](0x194);}return _0x55d92d;};}function handleError(_0x157808,_0x5a9b9e){_0x5a9b9e=_0x5a9b9e||0x1f4;return function(_0xd4c8fb){logger['error'](_0xd4c8fb['stack']);if(_0xd4c8fb[_0x3a9c('0x25')]){delete _0xd4c8fb[_0x3a9c('0x25')];}_0x157808[_0x3a9c('0x1d')](_0x5a9b9e)[_0x3a9c('0x26')](_0xd4c8fb);};}exports[_0x3a9c('0x27')]=function(_0x29c581,_0x67f7fc){var _0xd46c27={},_0x28cdf0={},_0x7d846d={'count':0x0,'rows':[]};var _0x410051=_[_0x3a9c('0x28')](db[_0x3a9c('0x29')][_0x3a9c('0x2a')],function(_0x2a0b1b){return{'name':_0x2a0b1b['fieldName'],'type':_0x2a0b1b[_0x3a9c('0x2b')][_0x3a9c('0x2c')]};});_0x28cdf0[_0x3a9c('0x2d')]=_[_0x3a9c('0x28')](_0x410051,'name');_0x28cdf0[_0x3a9c('0x2e')]=_[_0x3a9c('0x2f')](_0x29c581['query']);_0x28cdf0[_0x3a9c('0x30')]=_['intersection'](_0x28cdf0[_0x3a9c('0x2d')],_0x28cdf0[_0x3a9c('0x2e')]);_0xd46c27[_0x3a9c('0x31')]=_[_0x3a9c('0x32')](_0x28cdf0['model'],qs[_0x3a9c('0x33')](_0x29c581['query']['fields']));_0xd46c27['attributes']=_0xd46c27[_0x3a9c('0x31')][_0x3a9c('0x34')]?_0xd46c27[_0x3a9c('0x31')]:_0x28cdf0[_0x3a9c('0x2d')];if(!_0x29c581[_0x3a9c('0x2e')][_0x3a9c('0x35')](_0x3a9c('0x36'))){_0xd46c27[_0x3a9c('0x37')]=qs[_0x3a9c('0x37')](_0x29c581['query'][_0x3a9c('0x37')]);_0xd46c27['offset']=qs[_0x3a9c('0x1b')](_0x29c581[_0x3a9c('0x2e')][_0x3a9c('0x1b')]);}_0xd46c27[_0x3a9c('0x38')]=qs['sort'](_0x29c581[_0x3a9c('0x2e')][_0x3a9c('0x39')]);_0xd46c27[_0x3a9c('0x3a')]=qs[_0x3a9c('0x30')](_[_0x3a9c('0x3b')](_0x29c581[_0x3a9c('0x2e')],_0x28cdf0['filters']),_0x410051);if(_0x29c581['query'][_0x3a9c('0x3c')]){_0xd46c27[_0x3a9c('0x3a')]=_[_0x3a9c('0x3d')](_0xd46c27['where'],{'$or':_['map'](_0x410051,function(_0x3d61ae){if(_0x3d61ae['type']!==_0x3a9c('0x3e')){var _0x3ce588={};_0x3ce588[_0x3d61ae[_0x3a9c('0x25')]]={'$like':'%'+_0x29c581['query']['filter']+'%'};return _0x3ce588;}})});}_0xd46c27=_[_0x3a9c('0x3d')]({},_0xd46c27,_0x29c581[_0x3a9c('0x3f')]);var _0x2ffb28={'where':_0xd46c27['where']};return db[_0x3a9c('0x29')][_0x3a9c('0x1c')](_0x2ffb28)[_0x3a9c('0x23')](function(_0x395219){_0x7d846d['count']=_0x395219;if(_0x29c581['query']['includeAll']){_0xd46c27['include']=[{'all':!![]}];}return db['FreshsalesConfiguration'][_0x3a9c('0x40')](_0xd46c27);})[_0x3a9c('0x23')](function(_0x5dcfd8){_0x7d846d[_0x3a9c('0x41')]=_0x5dcfd8;return _0x7d846d;})['then'](respondWithFilteredResult(_0x67f7fc,_0xd46c27))[_0x3a9c('0x42')](handleError(_0x67f7fc,null));};exports[_0x3a9c('0x43')]=function(_0x205cde,_0x5302b1){var _0x35079e={'raw':![],'where':{'id':_0x205cde[_0x3a9c('0x44')]['id']}},_0x1c4793={};_0x1c4793[_0x3a9c('0x2d')]=_[_0x3a9c('0x2f')](db[_0x3a9c('0x29')][_0x3a9c('0x2a')]);_0x1c4793[_0x3a9c('0x2e')]=_[_0x3a9c('0x2f')](_0x205cde[_0x3a9c('0x2e')]);_0x1c4793[_0x3a9c('0x30')]=_[_0x3a9c('0x32')](_0x1c4793[_0x3a9c('0x2d')],_0x1c4793['query']);_0x35079e['attributes']=_[_0x3a9c('0x32')](_0x1c4793[_0x3a9c('0x2d')],qs['fields'](_0x205cde[_0x3a9c('0x2e')][_0x3a9c('0x33')]));_0x35079e[_0x3a9c('0x31')]=_0x35079e[_0x3a9c('0x31')][_0x3a9c('0x34')]?_0x35079e['attributes']:_0x1c4793[_0x3a9c('0x2d')];if(_0x205cde[_0x3a9c('0x2e')]['includeAll']){_0x35079e[_0x3a9c('0x45')]=[{'all':!![]}];}_0x35079e=_[_0x3a9c('0x3d')]({},_0x35079e,_0x205cde['options']);return db['FreshsalesConfiguration'][_0x3a9c('0x46')](_0x35079e)[_0x3a9c('0x23')](handleEntityNotFound(_0x5302b1,null))[_0x3a9c('0x23')](respondWithResult(_0x5302b1,null))[_0x3a9c('0x42')](handleError(_0x5302b1,null));};exports[_0x3a9c('0x47')]=function(_0x35eac6,_0xec193f){return db[_0x3a9c('0x29')][_0x3a9c('0x47')](_0x35eac6[_0x3a9c('0x48')],{})[_0x3a9c('0x23')](respondWithResult(_0xec193f,0xc9))[_0x3a9c('0x42')](handleError(_0xec193f,null));};exports[_0x3a9c('0x22')]=function(_0x5bc19b,_0x1b8eec){if(_0x5bc19b[_0x3a9c('0x48')]['id']){delete _0x5bc19b[_0x3a9c('0x48')]['id'];}return db[_0x3a9c('0x29')][_0x3a9c('0x46')]({'where':{'id':_0x5bc19b[_0x3a9c('0x44')]['id']}})[_0x3a9c('0x23')](handleEntityNotFound(_0x1b8eec,null))[_0x3a9c('0x23')](saveUpdates(_0x5bc19b[_0x3a9c('0x48')],null))[_0x3a9c('0x23')](respondWithResult(_0x1b8eec,null))[_0x3a9c('0x42')](handleError(_0x1b8eec,null));};exports[_0x3a9c('0x24')]=function(_0x58f364,_0x47c4bf){return db['FreshsalesConfiguration'][_0x3a9c('0x46')]({'where':{'id':_0x58f364[_0x3a9c('0x44')]['id']}})[_0x3a9c('0x23')](handleEntityNotFound(_0x47c4bf,null))['then'](removeEntity(_0x47c4bf,null))[_0x3a9c('0x42')](handleError(_0x47c4bf,null));};exports[_0x3a9c('0x49')]=function(_0x470a1a,_0x30b747,_0xbce29b){var _0x28593d={};var _0x203bda={};var _0x5bef89;var _0x211d3c;return db[_0x3a9c('0x29')][_0x3a9c('0x4a')]({'where':{'id':_0x470a1a[_0x3a9c('0x44')]['id']}})[_0x3a9c('0x23')](handleEntityNotFound(_0x30b747,null))['then'](function(_0xe58d0e){if(_0xe58d0e){_0x5bef89=_0xe58d0e;_0x203bda[_0x3a9c('0x2d')]=_[_0x3a9c('0x2f')](db[_0x3a9c('0x4b')][_0x3a9c('0x2a')]);_0x203bda[_0x3a9c('0x2e')]=_[_0x3a9c('0x2f')](_0x470a1a['query']);_0x203bda[_0x3a9c('0x30')]=_['intersection'](_0x203bda[_0x3a9c('0x2d')],_0x203bda[_0x3a9c('0x2e')]);_0x28593d[_0x3a9c('0x31')]=_[_0x3a9c('0x32')](_0x203bda[_0x3a9c('0x2d')],qs['fields'](_0x470a1a['query']['fields']));_0x28593d[_0x3a9c('0x31')]=_0x28593d['attributes']['length']?_0x28593d['attributes']:_0x203bda[_0x3a9c('0x2d')];_0x28593d[_0x3a9c('0x38')]=qs['sort'](_0x470a1a['query'][_0x3a9c('0x39')]);_0x28593d[_0x3a9c('0x3a')]=qs[_0x3a9c('0x30')](_[_0x3a9c('0x3b')](_0x470a1a[_0x3a9c('0x2e')],_0x203bda[_0x3a9c('0x30')]));if(_0x470a1a[_0x3a9c('0x2e')][_0x3a9c('0x3c')]){_0x28593d['where']=_[_0x3a9c('0x3d')](_0x28593d['where'],{'$or':_[_0x3a9c('0x28')](_0x28593d[_0x3a9c('0x31')],function(_0xf61e7a){var _0x59da05={};_0x59da05[_0xf61e7a]={'$like':'%'+_0x470a1a[_0x3a9c('0x2e')][_0x3a9c('0x3c')]+'%'};return _0x59da05;})});}_0x28593d=_['merge']({},_0x28593d,_0x470a1a[_0x3a9c('0x3f')]);return _0x5bef89[_0x3a9c('0x49')](_0x28593d);}})[_0x3a9c('0x23')](function(_0x582ab3){if(_0x582ab3){_0x211d3c=_0x582ab3[_0x3a9c('0x34')];if(!_0x470a1a[_0x3a9c('0x2e')]['hasOwnProperty'](_0x3a9c('0x36'))){_0x28593d[_0x3a9c('0x37')]=qs[_0x3a9c('0x37')](_0x470a1a[_0x3a9c('0x2e')][_0x3a9c('0x37')]);_0x28593d[_0x3a9c('0x1b')]=qs[_0x3a9c('0x1b')](_0x470a1a[_0x3a9c('0x2e')][_0x3a9c('0x1b')]);}return _0x5bef89[_0x3a9c('0x49')](_0x28593d);}})[_0x3a9c('0x23')](function(_0x4f591d){if(_0x4f591d){return _0x4f591d?{'count':_0x211d3c,'rows':_0x4f591d}:null;}})[_0x3a9c('0x23')](respondWithResult(_0x30b747,null))[_0x3a9c('0x42')](handleError(_0x30b747,null));};exports[_0x3a9c('0x4c')]=function(_0x58a68a,_0x462829,_0x2d4289){var _0x106720={};var _0x211f22={};var _0x2319c8;var _0x9d09a0;return db[_0x3a9c('0x29')]['findOne']({'where':{'id':_0x58a68a[_0x3a9c('0x44')]['id']}})[_0x3a9c('0x23')](handleEntityNotFound(_0x462829,null))['then'](function(_0x220e2a){if(_0x220e2a){_0x2319c8=_0x220e2a;_0x211f22[_0x3a9c('0x2d')]=_[_0x3a9c('0x2f')](db[_0x3a9c('0x4b')][_0x3a9c('0x2a')]);_0x211f22[_0x3a9c('0x2e')]=_[_0x3a9c('0x2f')](_0x58a68a[_0x3a9c('0x2e')]);_0x211f22[_0x3a9c('0x30')]=_[_0x3a9c('0x32')](_0x211f22['model'],_0x211f22['query']);_0x106720[_0x3a9c('0x31')]=_['intersection'](_0x211f22[_0x3a9c('0x2d')],qs[_0x3a9c('0x33')](_0x58a68a['query'][_0x3a9c('0x33')]));_0x106720[_0x3a9c('0x31')]=_0x106720[_0x3a9c('0x31')][_0x3a9c('0x34')]?_0x106720[_0x3a9c('0x31')]:_0x211f22[_0x3a9c('0x2d')];_0x106720['order']=qs[_0x3a9c('0x39')](_0x58a68a[_0x3a9c('0x2e')][_0x3a9c('0x39')]);_0x106720[_0x3a9c('0x3a')]=qs['filters'](_[_0x3a9c('0x3b')](_0x58a68a[_0x3a9c('0x2e')],_0x211f22[_0x3a9c('0x30')]));if(_0x58a68a[_0x3a9c('0x2e')][_0x3a9c('0x3c')]){_0x106720[_0x3a9c('0x3a')]=_[_0x3a9c('0x3d')](_0x106720[_0x3a9c('0x3a')],{'$or':_[_0x3a9c('0x28')](_0x106720[_0x3a9c('0x31')],function(_0x35a448){var _0x3c1c1e={};_0x3c1c1e[_0x35a448]={'$like':'%'+_0x58a68a[_0x3a9c('0x2e')][_0x3a9c('0x3c')]+'%'};return _0x3c1c1e;})});}_0x106720=_['merge']({},_0x106720,_0x58a68a[_0x3a9c('0x3f')]);return _0x2319c8['getDescriptions'](_0x106720);}})['then'](function(_0x4ab25d){if(_0x4ab25d){_0x9d09a0=_0x4ab25d['length'];if(!_0x58a68a[_0x3a9c('0x2e')][_0x3a9c('0x35')]('nolimit')){_0x106720[_0x3a9c('0x37')]=qs[_0x3a9c('0x37')](_0x58a68a[_0x3a9c('0x2e')][_0x3a9c('0x37')]);_0x106720[_0x3a9c('0x1b')]=qs[_0x3a9c('0x1b')](_0x58a68a['query']['offset']);}return _0x2319c8[_0x3a9c('0x4c')](_0x106720);}})['then'](function(_0x4543f0){if(_0x4543f0){return _0x4543f0?{'count':_0x9d09a0,'rows':_0x4543f0}:null;}})[_0x3a9c('0x23')](respondWithResult(_0x462829,null))[_0x3a9c('0x42')](handleError(_0x462829,null));};exports[_0x3a9c('0x4d')]=function(_0x168cf5,_0x585e11,_0x41fed9){var _0x5a68a1={};var _0x43f05f={};var _0x4681de;var _0x5502f2;return db[_0x3a9c('0x29')]['findOne']({'where':{'id':_0x168cf5['params']['id']}})[_0x3a9c('0x23')](handleEntityNotFound(_0x585e11,null))[_0x3a9c('0x23')](function(_0x395dae){if(_0x395dae){_0x4681de=_0x395dae;_0x43f05f[_0x3a9c('0x2d')]=_[_0x3a9c('0x2f')](db[_0x3a9c('0x4b')][_0x3a9c('0x2a')]);_0x43f05f['query']=_['keys'](_0x168cf5[_0x3a9c('0x2e')]);_0x43f05f[_0x3a9c('0x30')]=_[_0x3a9c('0x32')](_0x43f05f[_0x3a9c('0x2d')],_0x43f05f[_0x3a9c('0x2e')]);_0x5a68a1[_0x3a9c('0x31')]=_[_0x3a9c('0x32')](_0x43f05f[_0x3a9c('0x2d')],qs['fields'](_0x168cf5['query'][_0x3a9c('0x33')]));_0x5a68a1[_0x3a9c('0x31')]=_0x5a68a1[_0x3a9c('0x31')]['length']?_0x5a68a1[_0x3a9c('0x31')]:_0x43f05f[_0x3a9c('0x2d')];_0x5a68a1[_0x3a9c('0x38')]=qs[_0x3a9c('0x39')](_0x168cf5[_0x3a9c('0x2e')][_0x3a9c('0x39')]);_0x5a68a1[_0x3a9c('0x3a')]=qs[_0x3a9c('0x30')](_[_0x3a9c('0x3b')](_0x168cf5[_0x3a9c('0x2e')],_0x43f05f['filters']));if(_0x168cf5[_0x3a9c('0x2e')][_0x3a9c('0x3c')]){_0x5a68a1['where']=_[_0x3a9c('0x3d')](_0x5a68a1[_0x3a9c('0x3a')],{'$or':_['map'](_0x5a68a1[_0x3a9c('0x31')],function(_0x510cf9){var _0xdacbee={};_0xdacbee[_0x510cf9]={'$like':'%'+_0x168cf5[_0x3a9c('0x2e')]['filter']+'%'};return _0xdacbee;})});}_0x5a68a1=_[_0x3a9c('0x3d')]({},_0x5a68a1,_0x168cf5['options']);return _0x4681de[_0x3a9c('0x4d')](_0x5a68a1);}})['then'](function(_0x2cda6e){if(_0x2cda6e){_0x5502f2=_0x2cda6e[_0x3a9c('0x34')];if(!_0x168cf5[_0x3a9c('0x2e')][_0x3a9c('0x35')](_0x3a9c('0x36'))){_0x5a68a1[_0x3a9c('0x37')]=qs[_0x3a9c('0x37')](_0x168cf5['query'][_0x3a9c('0x37')]);_0x5a68a1['offset']=qs[_0x3a9c('0x1b')](_0x168cf5[_0x3a9c('0x2e')][_0x3a9c('0x1b')]);}return _0x4681de['getFields'](_0x5a68a1);}})[_0x3a9c('0x23')](function(_0xc264dd){if(_0xc264dd){return _0xc264dd?{'count':_0x5502f2,'rows':_0xc264dd}:null;}})['then'](respondWithResult(_0x585e11,null))[_0x3a9c('0x42')](handleError(_0x585e11,null));}; \ No newline at end of file +var _0x2b16=['findAll','rows','catch','params','keys','create','body','find','getSubjects','findOne','FreshsalesField','getDescriptions','getFields','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','undefined','count','offset','set','Content-Range','json','update','then','destroy','end','error','name','send','index','map','FreshsalesConfiguration','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll'];(function(_0x5cb139,_0x1a5f77){var _0x816e2b=function(_0x1ad50f){while(--_0x1ad50f){_0x5cb139['push'](_0x5cb139['shift']());}};_0x816e2b(++_0x1a5f77);}(_0x2b16,0x13d));var _0x62b1=function(_0x1318b3,_0x5cf6bf){_0x1318b3=_0x1318b3-0x0;var _0x17c244=_0x2b16[_0x1318b3];return _0x17c244;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x62b1('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x62b1('0x1'));var moment=require(_0x62b1('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x62b1('0x3'));var util=require(_0x62b1('0x4'));var path=require(_0x62b1('0x5'));var sox=require(_0x62b1('0x6'));var csv=require(_0x62b1('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x62b1('0x8'));var _=require(_0x62b1('0x9'));var squel=require(_0x62b1('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x62b1('0x7'));var querystring=require(_0x62b1('0xb'));var Papa=require(_0x62b1('0xc'));var Redis=require(_0x62b1('0xd'));var authService=require(_0x62b1('0xe'));var qs=require(_0x62b1('0xf'));var as=require(_0x62b1('0x10'));var hardwareService=require(_0x62b1('0x11'));var logger=require('../../config/logger')(_0x62b1('0x12'));var utils=require(_0x62b1('0x13'));var config=require(_0x62b1('0x14'));var licenseUtil=require(_0x62b1('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x310682,_0x26d933){_0x26d933=_0x26d933||0xcc;return function(_0x3bdcb0){if(_0x3bdcb0){return _0x310682[_0x62b1('0x16')](_0x26d933);}return _0x310682[_0x62b1('0x17')](_0x26d933)['end']();};}function respondWithResult(_0x2f6464,_0x386a57){_0x386a57=_0x386a57||0xc8;return function(_0x2bc116){if(_0x2bc116){return _0x2f6464[_0x62b1('0x17')](_0x386a57)['json'](_0x2bc116);}};}function respondWithFilteredResult(_0x545b95,_0x4d2336){return function(_0xc9be17){if(_0xc9be17){var _0xd5bb20=typeof _0x4d2336['offset']===_0x62b1('0x18')&&typeof _0x4d2336['limit']===_0x62b1('0x18');var _0x5bc30c=_0xc9be17[_0x62b1('0x19')];var _0x24c4b4=_0xd5bb20?0x0:_0x4d2336[_0x62b1('0x1a')];var _0x10adc1=_0xd5bb20?_0xc9be17[_0x62b1('0x19')]:_0x4d2336[_0x62b1('0x1a')]+_0x4d2336['limit'];var _0x312d1e;if(_0x10adc1>=_0x5bc30c){_0x10adc1=_0x5bc30c;_0x312d1e=0xc8;}else{_0x312d1e=0xce;}_0x545b95[_0x62b1('0x17')](_0x312d1e);return _0x545b95[_0x62b1('0x1b')](_0x62b1('0x1c'),_0x24c4b4+'-'+_0x10adc1+'/'+_0x5bc30c)[_0x62b1('0x1d')](_0xc9be17);}return null;};}function patchUpdates(_0x144ab1){return function(_0x526c46){try{jsonpatch['apply'](_0x526c46,_0x144ab1,!![]);}catch(_0x3b25f3){return BPromise['reject'](_0x3b25f3);}return _0x526c46['save']();};}function saveUpdates(_0x341cea,_0x46877d){return function(_0x9eb104){if(_0x9eb104){return _0x9eb104[_0x62b1('0x1e')](_0x341cea)[_0x62b1('0x1f')](function(_0x1f3797){return _0x1f3797;});}return null;};}function removeEntity(_0x4bbcc4,_0x587ca3){return function(_0x4ec893){if(_0x4ec893){return _0x4ec893[_0x62b1('0x20')]()[_0x62b1('0x1f')](function(){_0x4bbcc4[_0x62b1('0x17')](0xcc)[_0x62b1('0x21')]();});}};}function handleEntityNotFound(_0x543f80,_0x30030f){return function(_0x179214){if(!_0x179214){_0x543f80[_0x62b1('0x16')](0x194);}return _0x179214;};}function handleError(_0x45b593,_0x98571){_0x98571=_0x98571||0x1f4;return function(_0x166d7a){logger[_0x62b1('0x22')](_0x166d7a['stack']);if(_0x166d7a[_0x62b1('0x23')]){delete _0x166d7a[_0x62b1('0x23')];}_0x45b593[_0x62b1('0x17')](_0x98571)[_0x62b1('0x24')](_0x166d7a);};}exports[_0x62b1('0x25')]=function(_0x4726ad,_0x7b1d1b){var _0x263caa={},_0x48d331={},_0x5ccdc0={'count':0x0,'rows':[]};var _0x2a43ff=_[_0x62b1('0x26')](db[_0x62b1('0x27')][_0x62b1('0x28')],function(_0x46d77f){return{'name':_0x46d77f[_0x62b1('0x29')],'type':_0x46d77f[_0x62b1('0x2a')][_0x62b1('0x2b')]};});_0x48d331[_0x62b1('0x2c')]=_[_0x62b1('0x26')](_0x2a43ff,'name');_0x48d331['query']=_['keys'](_0x4726ad[_0x62b1('0x2d')]);_0x48d331[_0x62b1('0x2e')]=_['intersection'](_0x48d331[_0x62b1('0x2c')],_0x48d331['query']);_0x263caa[_0x62b1('0x2f')]=_[_0x62b1('0x30')](_0x48d331[_0x62b1('0x2c')],qs[_0x62b1('0x31')](_0x4726ad[_0x62b1('0x2d')][_0x62b1('0x31')]));_0x263caa[_0x62b1('0x2f')]=_0x263caa[_0x62b1('0x2f')][_0x62b1('0x32')]?_0x263caa['attributes']:_0x48d331[_0x62b1('0x2c')];if(!_0x4726ad['query'][_0x62b1('0x33')](_0x62b1('0x34'))){_0x263caa[_0x62b1('0x35')]=qs['limit'](_0x4726ad[_0x62b1('0x2d')][_0x62b1('0x35')]);_0x263caa['offset']=qs[_0x62b1('0x1a')](_0x4726ad['query'][_0x62b1('0x1a')]);}_0x263caa[_0x62b1('0x36')]=qs[_0x62b1('0x37')](_0x4726ad[_0x62b1('0x2d')][_0x62b1('0x37')]);_0x263caa[_0x62b1('0x38')]=qs[_0x62b1('0x2e')](_[_0x62b1('0x39')](_0x4726ad[_0x62b1('0x2d')],_0x48d331['filters']),_0x2a43ff);if(_0x4726ad['query']['filter']){_0x263caa['where']=_[_0x62b1('0x3a')](_0x263caa[_0x62b1('0x38')],{'$or':_['map'](_0x2a43ff,function(_0x2c0b26){if(_0x2c0b26[_0x62b1('0x2a')]!==_0x62b1('0x3b')){var _0xd80c1b={};_0xd80c1b[_0x2c0b26['name']]={'$like':'%'+_0x4726ad[_0x62b1('0x2d')][_0x62b1('0x3c')]+'%'};return _0xd80c1b;}})});}_0x263caa=_['merge']({},_0x263caa,_0x4726ad[_0x62b1('0x3d')]);var _0x25c655={'where':_0x263caa[_0x62b1('0x38')]};return db[_0x62b1('0x27')][_0x62b1('0x19')](_0x25c655)[_0x62b1('0x1f')](function(_0x8feaa5){_0x5ccdc0['count']=_0x8feaa5;if(_0x4726ad[_0x62b1('0x2d')][_0x62b1('0x3e')]){_0x263caa['include']=[{'all':!![]}];}return db[_0x62b1('0x27')][_0x62b1('0x3f')](_0x263caa);})[_0x62b1('0x1f')](function(_0x2f39c4){_0x5ccdc0[_0x62b1('0x40')]=_0x2f39c4;return _0x5ccdc0;})[_0x62b1('0x1f')](respondWithFilteredResult(_0x7b1d1b,_0x263caa))[_0x62b1('0x41')](handleError(_0x7b1d1b,null));};exports['show']=function(_0x4a8eca,_0x5a854d){var _0x535967={'raw':![],'where':{'id':_0x4a8eca[_0x62b1('0x42')]['id']}},_0x52b0b4={};_0x52b0b4[_0x62b1('0x2c')]=_[_0x62b1('0x43')](db[_0x62b1('0x27')]['rawAttributes']);_0x52b0b4[_0x62b1('0x2d')]=_['keys'](_0x4a8eca['query']);_0x52b0b4[_0x62b1('0x2e')]=_[_0x62b1('0x30')](_0x52b0b4[_0x62b1('0x2c')],_0x52b0b4[_0x62b1('0x2d')]);_0x535967['attributes']=_[_0x62b1('0x30')](_0x52b0b4['model'],qs[_0x62b1('0x31')](_0x4a8eca[_0x62b1('0x2d')][_0x62b1('0x31')]));_0x535967[_0x62b1('0x2f')]=_0x535967[_0x62b1('0x2f')][_0x62b1('0x32')]?_0x535967[_0x62b1('0x2f')]:_0x52b0b4[_0x62b1('0x2c')];if(_0x4a8eca[_0x62b1('0x2d')][_0x62b1('0x3e')]){_0x535967['include']=[{'all':!![]}];}_0x535967=_[_0x62b1('0x3a')]({},_0x535967,_0x4a8eca[_0x62b1('0x3d')]);return db[_0x62b1('0x27')]['find'](_0x535967)[_0x62b1('0x1f')](handleEntityNotFound(_0x5a854d,null))[_0x62b1('0x1f')](respondWithResult(_0x5a854d,null))['catch'](handleError(_0x5a854d,null));};exports[_0x62b1('0x44')]=function(_0x3b0609,_0x30dcb3){return db['FreshsalesConfiguration']['create'](_0x3b0609[_0x62b1('0x45')],{})[_0x62b1('0x1f')](respondWithResult(_0x30dcb3,0xc9))['catch'](handleError(_0x30dcb3,null));};exports['update']=function(_0x51598f,_0xe42561){if(_0x51598f[_0x62b1('0x45')]['id']){delete _0x51598f[_0x62b1('0x45')]['id'];}return db[_0x62b1('0x27')][_0x62b1('0x46')]({'where':{'id':_0x51598f[_0x62b1('0x42')]['id']}})[_0x62b1('0x1f')](handleEntityNotFound(_0xe42561,null))[_0x62b1('0x1f')](saveUpdates(_0x51598f['body'],null))['then'](respondWithResult(_0xe42561,null))['catch'](handleError(_0xe42561,null));};exports[_0x62b1('0x20')]=function(_0x1d876d,_0x5126dd){return db[_0x62b1('0x27')][_0x62b1('0x46')]({'where':{'id':_0x1d876d[_0x62b1('0x42')]['id']}})[_0x62b1('0x1f')](handleEntityNotFound(_0x5126dd,null))[_0x62b1('0x1f')](removeEntity(_0x5126dd,null))['catch'](handleError(_0x5126dd,null));};exports[_0x62b1('0x47')]=function(_0x17c505,_0x648aaa,_0x1e5f22){var _0x1f007f={};var _0x3c178b={};var _0x44fe32;var _0x2ccf7b;return db[_0x62b1('0x27')][_0x62b1('0x48')]({'where':{'id':_0x17c505['params']['id']}})[_0x62b1('0x1f')](handleEntityNotFound(_0x648aaa,null))['then'](function(_0x35453b){if(_0x35453b){_0x44fe32=_0x35453b;_0x3c178b[_0x62b1('0x2c')]=_['keys'](db[_0x62b1('0x49')][_0x62b1('0x28')]);_0x3c178b['query']=_[_0x62b1('0x43')](_0x17c505['query']);_0x3c178b[_0x62b1('0x2e')]=_[_0x62b1('0x30')](_0x3c178b[_0x62b1('0x2c')],_0x3c178b[_0x62b1('0x2d')]);_0x1f007f[_0x62b1('0x2f')]=_[_0x62b1('0x30')](_0x3c178b[_0x62b1('0x2c')],qs[_0x62b1('0x31')](_0x17c505[_0x62b1('0x2d')][_0x62b1('0x31')]));_0x1f007f[_0x62b1('0x2f')]=_0x1f007f[_0x62b1('0x2f')][_0x62b1('0x32')]?_0x1f007f[_0x62b1('0x2f')]:_0x3c178b[_0x62b1('0x2c')];_0x1f007f[_0x62b1('0x36')]=qs[_0x62b1('0x37')](_0x17c505[_0x62b1('0x2d')]['sort']);_0x1f007f[_0x62b1('0x38')]=qs[_0x62b1('0x2e')](_[_0x62b1('0x39')](_0x17c505[_0x62b1('0x2d')],_0x3c178b[_0x62b1('0x2e')]));if(_0x17c505['query']['filter']){_0x1f007f[_0x62b1('0x38')]=_['merge'](_0x1f007f[_0x62b1('0x38')],{'$or':_[_0x62b1('0x26')](_0x1f007f[_0x62b1('0x2f')],function(_0xbd6d03){var _0x58ea33={};_0x58ea33[_0xbd6d03]={'$like':'%'+_0x17c505[_0x62b1('0x2d')][_0x62b1('0x3c')]+'%'};return _0x58ea33;})});}_0x1f007f=_[_0x62b1('0x3a')]({},_0x1f007f,_0x17c505[_0x62b1('0x3d')]);return _0x44fe32[_0x62b1('0x47')](_0x1f007f);}})[_0x62b1('0x1f')](function(_0x111e57){if(_0x111e57){_0x2ccf7b=_0x111e57[_0x62b1('0x32')];if(!_0x17c505[_0x62b1('0x2d')]['hasOwnProperty'](_0x62b1('0x34'))){_0x1f007f['limit']=qs[_0x62b1('0x35')](_0x17c505[_0x62b1('0x2d')]['limit']);_0x1f007f[_0x62b1('0x1a')]=qs[_0x62b1('0x1a')](_0x17c505[_0x62b1('0x2d')][_0x62b1('0x1a')]);}return _0x44fe32[_0x62b1('0x47')](_0x1f007f);}})[_0x62b1('0x1f')](function(_0x5b446c){if(_0x5b446c){return _0x5b446c?{'count':_0x2ccf7b,'rows':_0x5b446c}:null;}})[_0x62b1('0x1f')](respondWithResult(_0x648aaa,null))[_0x62b1('0x41')](handleError(_0x648aaa,null));};exports[_0x62b1('0x4a')]=function(_0xa188b1,_0x506130,_0x5e0c76){var _0x535f49={};var _0x55196e={};var _0x4fba88;var _0x1e4329;return db['FreshsalesConfiguration'][_0x62b1('0x48')]({'where':{'id':_0xa188b1[_0x62b1('0x42')]['id']}})[_0x62b1('0x1f')](handleEntityNotFound(_0x506130,null))['then'](function(_0x440bbd){if(_0x440bbd){_0x4fba88=_0x440bbd;_0x55196e[_0x62b1('0x2c')]=_['keys'](db['FreshsalesField'][_0x62b1('0x28')]);_0x55196e[_0x62b1('0x2d')]=_[_0x62b1('0x43')](_0xa188b1[_0x62b1('0x2d')]);_0x55196e[_0x62b1('0x2e')]=_[_0x62b1('0x30')](_0x55196e[_0x62b1('0x2c')],_0x55196e[_0x62b1('0x2d')]);_0x535f49[_0x62b1('0x2f')]=_[_0x62b1('0x30')](_0x55196e[_0x62b1('0x2c')],qs[_0x62b1('0x31')](_0xa188b1[_0x62b1('0x2d')][_0x62b1('0x31')]));_0x535f49['attributes']=_0x535f49[_0x62b1('0x2f')]['length']?_0x535f49[_0x62b1('0x2f')]:_0x55196e[_0x62b1('0x2c')];_0x535f49['order']=qs[_0x62b1('0x37')](_0xa188b1[_0x62b1('0x2d')][_0x62b1('0x37')]);_0x535f49[_0x62b1('0x38')]=qs[_0x62b1('0x2e')](_[_0x62b1('0x39')](_0xa188b1[_0x62b1('0x2d')],_0x55196e['filters']));if(_0xa188b1[_0x62b1('0x2d')][_0x62b1('0x3c')]){_0x535f49[_0x62b1('0x38')]=_[_0x62b1('0x3a')](_0x535f49[_0x62b1('0x38')],{'$or':_['map'](_0x535f49['attributes'],function(_0x25f5ac){var _0x19f82d={};_0x19f82d[_0x25f5ac]={'$like':'%'+_0xa188b1['query']['filter']+'%'};return _0x19f82d;})});}_0x535f49=_['merge']({},_0x535f49,_0xa188b1[_0x62b1('0x3d')]);return _0x4fba88[_0x62b1('0x4a')](_0x535f49);}})['then'](function(_0x31aeaa){if(_0x31aeaa){_0x1e4329=_0x31aeaa['length'];if(!_0xa188b1[_0x62b1('0x2d')][_0x62b1('0x33')](_0x62b1('0x34'))){_0x535f49[_0x62b1('0x35')]=qs[_0x62b1('0x35')](_0xa188b1[_0x62b1('0x2d')]['limit']);_0x535f49['offset']=qs['offset'](_0xa188b1[_0x62b1('0x2d')][_0x62b1('0x1a')]);}return _0x4fba88[_0x62b1('0x4a')](_0x535f49);}})[_0x62b1('0x1f')](function(_0x4b3406){if(_0x4b3406){return _0x4b3406?{'count':_0x1e4329,'rows':_0x4b3406}:null;}})['then'](respondWithResult(_0x506130,null))['catch'](handleError(_0x506130,null));};exports[_0x62b1('0x4b')]=function(_0x81cb11,_0x5dd353,_0x3ea368){var _0x440fa4={};var _0x47e827={};var _0xcd161f;var _0x718ab8;return db[_0x62b1('0x27')][_0x62b1('0x48')]({'where':{'id':_0x81cb11[_0x62b1('0x42')]['id']}})[_0x62b1('0x1f')](handleEntityNotFound(_0x5dd353,null))[_0x62b1('0x1f')](function(_0x3b3057){if(_0x3b3057){_0xcd161f=_0x3b3057;_0x47e827[_0x62b1('0x2c')]=_[_0x62b1('0x43')](db[_0x62b1('0x49')][_0x62b1('0x28')]);_0x47e827['query']=_[_0x62b1('0x43')](_0x81cb11[_0x62b1('0x2d')]);_0x47e827[_0x62b1('0x2e')]=_[_0x62b1('0x30')](_0x47e827[_0x62b1('0x2c')],_0x47e827[_0x62b1('0x2d')]);_0x440fa4[_0x62b1('0x2f')]=_[_0x62b1('0x30')](_0x47e827[_0x62b1('0x2c')],qs[_0x62b1('0x31')](_0x81cb11[_0x62b1('0x2d')][_0x62b1('0x31')]));_0x440fa4[_0x62b1('0x2f')]=_0x440fa4[_0x62b1('0x2f')]['length']?_0x440fa4[_0x62b1('0x2f')]:_0x47e827[_0x62b1('0x2c')];_0x440fa4[_0x62b1('0x36')]=qs[_0x62b1('0x37')](_0x81cb11[_0x62b1('0x2d')]['sort']);_0x440fa4[_0x62b1('0x38')]=qs[_0x62b1('0x2e')](_[_0x62b1('0x39')](_0x81cb11['query'],_0x47e827[_0x62b1('0x2e')]));if(_0x81cb11[_0x62b1('0x2d')][_0x62b1('0x3c')]){_0x440fa4[_0x62b1('0x38')]=_[_0x62b1('0x3a')](_0x440fa4[_0x62b1('0x38')],{'$or':_['map'](_0x440fa4['attributes'],function(_0xe75c48){var _0x26efaf={};_0x26efaf[_0xe75c48]={'$like':'%'+_0x81cb11[_0x62b1('0x2d')]['filter']+'%'};return _0x26efaf;})});}_0x440fa4=_[_0x62b1('0x3a')]({},_0x440fa4,_0x81cb11[_0x62b1('0x3d')]);return _0xcd161f[_0x62b1('0x4b')](_0x440fa4);}})[_0x62b1('0x1f')](function(_0x12c4b7){if(_0x12c4b7){_0x718ab8=_0x12c4b7[_0x62b1('0x32')];if(!_0x81cb11[_0x62b1('0x2d')][_0x62b1('0x33')](_0x62b1('0x34'))){_0x440fa4[_0x62b1('0x35')]=qs[_0x62b1('0x35')](_0x81cb11[_0x62b1('0x2d')][_0x62b1('0x35')]);_0x440fa4[_0x62b1('0x1a')]=qs['offset'](_0x81cb11[_0x62b1('0x2d')][_0x62b1('0x1a')]);}return _0xcd161f[_0x62b1('0x4b')](_0x440fa4);}})[_0x62b1('0x1f')](function(_0x22f347){if(_0x22f347){return _0x22f347?{'count':_0x718ab8,'rows':_0x22f347}:null;}})['then'](respondWithResult(_0x5dd353,null))[_0x62b1('0x41')](handleError(_0x5dd353,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index b864853..9745777 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 _0x6ddb=['FreshsalesConfiguration','int_freshsales_configurations','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x52285a,_0x4fa3fc){var _0x423654=function(_0x9774f5){while(--_0x9774f5){_0x52285a['push'](_0x52285a['shift']());}};_0x423654(++_0x4fa3fc);}(_0x6ddb,0x10a));var _0xb6dd=function(_0x29c644,_0x46941a){_0x29c644=_0x29c644-0x0;var _0x2d704a=_0x6ddb[_0x29c644];return _0x2d704a;};'use strict';var _=require(_0xb6dd('0x0'));var util=require(_0xb6dd('0x1'));var logger=require(_0xb6dd('0x2'))('api');var moment=require(_0xb6dd('0x3'));var BPromise=require(_0xb6dd('0x4'));var rp=require(_0xb6dd('0x5'));var fs=require('fs');var path=require(_0xb6dd('0x6'));var rimraf=require(_0xb6dd('0x7'));var config=require(_0xb6dd('0x8'));var attributes=require('./intFreshsalesConfiguration.attributes');module['exports']=function(_0x2b3fb8,_0x2b3a84){return _0x2b3fb8['define'](_0xb6dd('0x9'),attributes,{'tableName':_0xb6dd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb1ef=['exports','define','int_freshsales_configurations','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes'];(function(_0x4f7b33,_0x43d0b3){var _0x87cce3=function(_0x52e0bb){while(--_0x52e0bb){_0x4f7b33['push'](_0x4f7b33['shift']());}};_0x87cce3(++_0x43d0b3);}(_0xb1ef,0xff));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 logger=require('../../config/logger')(_0xfb1e('0x1'));var moment=require(_0xfb1e('0x2'));var BPromise=require(_0xfb1e('0x3'));var rp=require(_0xfb1e('0x4'));var fs=require('fs');var path=require(_0xfb1e('0x5'));var rimraf=require(_0xfb1e('0x6'));var config=require(_0xfb1e('0x7'));var attributes=require(_0xfb1e('0x8'));module[_0xfb1e('0x9')]=function(_0xdbb0d4,_0xd6a47a){return _0xdbb0d4[_0xfb1e('0xa')]('FreshsalesConfiguration',attributes,{'tableName':_0xfb1e('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 ebe6b3e..0e0ca11 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 _0x77e1=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x2824e,_0xfc2cb){var _0x529cb7=function(_0x266193){while(--_0x266193){_0x2824e['push'](_0x2824e['shift']());}};_0x529cb7(++_0xfc2cb);}(_0x77e1,0x9c));var _0x177e=function(_0x378614,_0x2f9bdd){_0x378614=_0x378614-0x0;var _0xe135b2=_0x77e1[_0x378614];return _0xe135b2;};'use strict';var _=require(_0x177e('0x0'));var util=require(_0x177e('0x1'));var moment=require(_0x177e('0x2'));var BPromise=require(_0x177e('0x3'));var rs=require(_0x177e('0x4'));var fs=require('fs');var Redis=require(_0x177e('0x5'));var db=require(_0x177e('0x6'))['db'];var utils=require(_0x177e('0x7'));var logger=require(_0x177e('0x8'))(_0x177e('0x9'));var config=require('../../config/environment');var jayson=require(_0x177e('0xa'));var client=jayson[_0x177e('0xb')][_0x177e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3d6895,_0xc4a5bb,_0x347004){return new BPromise(function(_0x4db53f,_0x39b8aa){return client[_0x177e('0xd')](_0x3d6895,_0x347004)[_0x177e('0xe')](function(_0x1a522c){logger[_0x177e('0xf')](_0x177e('0x10'),_0xc4a5bb,'request\x20sent');logger[_0x177e('0x11')](_0x177e('0x12'),_0xc4a5bb,_0x177e('0x13'),JSON[_0x177e('0x14')](_0x1a522c));if(_0x1a522c[_0x177e('0x15')]){if(_0x1a522c['error'][_0x177e('0x16')]===0x1f4){logger[_0x177e('0x15')](_0x177e('0x10'),_0xc4a5bb,_0x1a522c[_0x177e('0x15')]['message']);return _0x39b8aa(_0x1a522c[_0x177e('0x15')][_0x177e('0x17')]);}logger[_0x177e('0x15')](_0x177e('0x10'),_0xc4a5bb,_0x1a522c['error'][_0x177e('0x17')]);return _0x4db53f(_0x1a522c[_0x177e('0x15')][_0x177e('0x17')]);}else{logger[_0x177e('0xf')](_0x177e('0x10'),_0xc4a5bb,_0x177e('0x13'));_0x4db53f(_0x1a522c[_0x177e('0x18')][_0x177e('0x17')]);}})[_0x177e('0x19')](function(_0x13edaf){logger[_0x177e('0x15')](_0x177e('0x10'),_0xc4a5bb,_0x13edaf);_0x39b8aa(_0x13edaf);});});} \ No newline at end of file +var _0x5a30=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x1a6289,_0x17a622){var _0x26d086=function(_0x26bb89){while(--_0x26bb89){_0x1a6289['push'](_0x1a6289['shift']());}};_0x26d086(++_0x17a622);}(_0x5a30,0x8a));var _0x05a3=function(_0x49ca6b,_0x3ba842){_0x49ca6b=_0x49ca6b-0x0;var _0x1d957f=_0x5a30[_0x49ca6b];return _0x1d957f;};'use strict';var _=require(_0x05a3('0x0'));var util=require(_0x05a3('0x1'));var moment=require(_0x05a3('0x2'));var BPromise=require(_0x05a3('0x3'));var rs=require(_0x05a3('0x4'));var fs=require('fs');var Redis=require(_0x05a3('0x5'));var db=require(_0x05a3('0x6'))['db'];var utils=require(_0x05a3('0x7'));var logger=require('../../config/logger')(_0x05a3('0x8'));var config=require('../../config/environment');var jayson=require(_0x05a3('0x9'));var client=jayson[_0x05a3('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xa82001,_0x49a31c,_0x1700fb){return new BPromise(function(_0x195267,_0x51b992){return client[_0x05a3('0xb')](_0xa82001,_0x1700fb)[_0x05a3('0xc')](function(_0x20a98f){logger['info'](_0x05a3('0xd'),_0x49a31c,_0x05a3('0xe'));logger[_0x05a3('0xf')](_0x05a3('0x10'),_0x49a31c,'request\x20sent',JSON[_0x05a3('0x11')](_0x20a98f));if(_0x20a98f[_0x05a3('0x12')]){if(_0x20a98f['error'][_0x05a3('0x13')]===0x1f4){logger[_0x05a3('0x12')](_0x05a3('0xd'),_0x49a31c,_0x20a98f[_0x05a3('0x12')][_0x05a3('0x14')]);return _0x51b992(_0x20a98f[_0x05a3('0x12')][_0x05a3('0x14')]);}logger['error'](_0x05a3('0xd'),_0x49a31c,_0x20a98f[_0x05a3('0x12')][_0x05a3('0x14')]);return _0x195267(_0x20a98f[_0x05a3('0x12')][_0x05a3('0x14')]);}else{logger[_0x05a3('0x15')](_0x05a3('0xd'),_0x49a31c,_0x05a3('0xe'));_0x195267(_0x20a98f[_0x05a3('0x16')][_0x05a3('0x14')]);}})[_0x05a3('0x17')](function(_0x1edfd6){logger[_0x05a3('0x12')](_0x05a3('0xd'),_0x49a31c,_0x1edfd6);_0x51b992(_0x1edfd6);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index a053cf7..957c547 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 _0x03bc=['create','put','update','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','index','/:id','isAuthenticated','show','post'];(function(_0x2c0c09,_0x20ea92){var _0x482b0a=function(_0x5d876a){while(--_0x5d876a){_0x2c0c09['push'](_0x2c0c09['shift']());}};_0x482b0a(++_0x20ea92);}(_0x03bc,0xb8));var _0xc03b=function(_0x24e01,_0x58be5a){_0x24e01=_0x24e01-0x0;var _0x25efc6=_0x03bc[_0x24e01];return _0x25efc6;};'use strict';var multer=require(_0xc03b('0x0'));var util=require('util');var path=require(_0xc03b('0x1'));var timeout=require(_0xc03b('0x2'));var express=require('express');var router=express[_0xc03b('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xc03b('0x4'));var interaction=require(_0xc03b('0x5'));var config=require(_0xc03b('0x6'));var controller=require(_0xc03b('0x7'));router[_0xc03b('0x8')]('/',auth['isAuthenticated'](),controller[_0xc03b('0x9')]);router['get'](_0xc03b('0xa'),auth[_0xc03b('0xb')](),controller[_0xc03b('0xc')]);router[_0xc03b('0xd')]('/',auth[_0xc03b('0xb')](),controller[_0xc03b('0xe')]);router[_0xc03b('0xf')](_0xc03b('0xa'),auth['isAuthenticated'](),controller[_0xc03b('0x10')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xc03b('0x11')]=router; \ No newline at end of file +var _0x26bc=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshsalesField.controller','isAuthenticated','index','get','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path'];(function(_0x1f0829,_0x52d889){var _0x503ca4=function(_0x326e31){while(--_0x326e31){_0x1f0829['push'](_0x1f0829['shift']());}};_0x503ca4(++_0x52d889);}(_0x26bc,0x162));var _0xc26b=function(_0x28091c,_0x5596e5){_0x28091c=_0x28091c-0x0;var _0x322871=_0x26bc[_0x28091c];return _0x322871;};'use strict';var multer=require(_0xc26b('0x0'));var util=require(_0xc26b('0x1'));var path=require(_0xc26b('0x2'));var timeout=require(_0xc26b('0x3'));var express=require(_0xc26b('0x4'));var router=express['Router']();var fs_extra=require(_0xc26b('0x5'));var auth=require(_0xc26b('0x6'));var interaction=require(_0xc26b('0x7'));var config=require('../../config/environment');var controller=require(_0xc26b('0x8'));router['get']('/',auth[_0xc26b('0x9')](),controller[_0xc26b('0xa')]);router[_0xc26b('0xb')]('/:id',auth[_0xc26b('0x9')](),controller[_0xc26b('0xc')]);router[_0xc26b('0xd')]('/',auth[_0xc26b('0x9')](),controller[_0xc26b('0xe')]);router[_0xc26b('0xf')](_0xc26b('0x10'),auth[_0xc26b('0x9')](),controller[_0xc26b('0x11')]);router[_0xc26b('0x12')]('/:id',auth[_0xc26b('0x9')](),controller[_0xc26b('0x13')]);module[_0xc26b('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 86a898a..fe6d006 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 _0x1167=['picklist','STRING','BOOLEAN','sequelize','exports','string','variable','customVariable','keyValue'];(function(_0x55ab14,_0x46a1aa){var _0x180e29=function(_0x1775bd){while(--_0x1775bd){_0x55ab14['push'](_0x55ab14['shift']());}};_0x180e29(++_0x46a1aa);}(_0x1167,0x150));var _0x7116=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x1167[_0x3e5086];return _0xfeb102;};'use strict';var Sequelize=require(_0x7116('0x0'));module[_0x7116('0x1')]={'type':{'type':Sequelize['ENUM'](_0x7116('0x2'),_0x7116('0x3'),_0x7116('0x4'),_0x7116('0x5'),_0x7116('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x7116('0x7')]},'key':{'type':Sequelize[_0x7116('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x7116('0x2'),'variable',_0x7116('0x4'))},'keyContent':{'type':Sequelize[_0x7116('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x7116('0x7')]},'customField':{'type':Sequelize[_0x7116('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x07e9=['customVariable','keyValue','picklist','STRING','sequelize','exports','ENUM','string','variable'];(function(_0x54f189,_0x5899d7){var _0x55c472=function(_0x53c878){while(--_0x53c878){_0x54f189['push'](_0x54f189['shift']());}};_0x55c472(++_0x5899d7);}(_0x07e9,0x175));var _0x907e=function(_0x248af0,_0x5adc97){_0x248af0=_0x248af0-0x0;var _0x1dc00e=_0x07e9[_0x248af0];return _0x1dc00e;};'use strict';var Sequelize=require(_0x907e('0x0'));module[_0x907e('0x1')]={'type':{'type':Sequelize[_0x907e('0x2')](_0x907e('0x3'),_0x907e('0x4'),_0x907e('0x5'),_0x907e('0x6'),_0x907e('0x7')),'defaultValue':'string'},'content':{'type':Sequelize[_0x907e('0x8')]},'key':{'type':Sequelize[_0x907e('0x8')]},'keyType':{'type':Sequelize['ENUM']('string',_0x907e('0x4'),_0x907e('0x5'))},'keyContent':{'type':Sequelize[_0x907e('0x8')]},'idField':{'type':Sequelize[_0x907e('0x8')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 02c63ce..2dc1dbe 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 _0x3b92=['count','set','apply','save','update','then','destroy','sendStatus','name','send','map','FreshsalesField','fieldName','type','key','query','filters','model','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','params','keys','rawAttributes','intersection','find','catch','create','body','eml-format','rimraf','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','undefined'];(function(_0x592df4,_0x4e719b){var _0x3b4fe4=function(_0x5ebf53){while(--_0x5ebf53){_0x592df4['push'](_0x592df4['shift']());}};_0x3b4fe4(++_0x4e719b);}(_0x3b92,0x135));var _0x23b9=function(_0x388180,_0xd4f7d3){_0x388180=_0x388180-0x0;var _0x30c18b=_0x3b92[_0x388180];return _0x30c18b;};'use strict';var emlformat=require(_0x23b9('0x0'));var rimraf=require(_0x23b9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x23b9('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x23b9('0x3'));var util=require('util');var path=require(_0x23b9('0x4'));var sox=require(_0x23b9('0x5'));var csv=require(_0x23b9('0x6'));var ejs=require(_0x23b9('0x7'));var fs=require('fs');var fs_extra=require(_0x23b9('0x8'));var _=require(_0x23b9('0x9'));var squel=require(_0x23b9('0xa'));var crypto=require(_0x23b9('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x23b9('0x6'));var querystring=require('querystring');var Papa=require(_0x23b9('0xc'));var Redis=require('ioredis');var authService=require(_0x23b9('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x23b9('0xe'));var hardwareService=require(_0x23b9('0xf'));var logger=require(_0x23b9('0x10'))(_0x23b9('0x11'));var utils=require(_0x23b9('0x12'));var config=require(_0x23b9('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x23b9('0x14'))['db'];function respondWithStatusCode(_0x5e1612,_0x4b3273){_0x4b3273=_0x4b3273||0xcc;return function(_0x4c593f){if(_0x4c593f){return _0x5e1612['sendStatus'](_0x4b3273);}return _0x5e1612['status'](_0x4b3273)[_0x23b9('0x15')]();};}function respondWithResult(_0x360f02,_0x399c0b){_0x399c0b=_0x399c0b||0xc8;return function(_0x2908c6){if(_0x2908c6){return _0x360f02[_0x23b9('0x16')](_0x399c0b)[_0x23b9('0x17')](_0x2908c6);}};}function respondWithFilteredResult(_0x2c5a13,_0x379501){return function(_0x5e2783){if(_0x5e2783){var _0x76ca04=typeof _0x379501[_0x23b9('0x18')]===_0x23b9('0x19')&&typeof _0x379501['limit']===_0x23b9('0x19');var _0x234b50=_0x5e2783[_0x23b9('0x1a')];var _0x1c3d2e=_0x76ca04?0x0:_0x379501[_0x23b9('0x18')];var _0x316155=_0x76ca04?_0x5e2783[_0x23b9('0x1a')]:_0x379501['offset']+_0x379501['limit'];var _0x38ce73;if(_0x316155>=_0x234b50){_0x316155=_0x234b50;_0x38ce73=0xc8;}else{_0x38ce73=0xce;}_0x2c5a13[_0x23b9('0x16')](_0x38ce73);return _0x2c5a13[_0x23b9('0x1b')]('Content-Range',_0x1c3d2e+'-'+_0x316155+'/'+_0x234b50)[_0x23b9('0x17')](_0x5e2783);}return null;};}function patchUpdates(_0x40c210){return function(_0x5c85a6){try{jsonpatch[_0x23b9('0x1c')](_0x5c85a6,_0x40c210,!![]);}catch(_0x4baa22){return BPromise['reject'](_0x4baa22);}return _0x5c85a6[_0x23b9('0x1d')]();};}function saveUpdates(_0x20a10d,_0x786ae5){return function(_0x3e951a){if(_0x3e951a){return _0x3e951a[_0x23b9('0x1e')](_0x20a10d)[_0x23b9('0x1f')](function(_0xab8b48){return _0xab8b48;});}return null;};}function removeEntity(_0x4bcdaf,_0x2de317){return function(_0xa9a243){if(_0xa9a243){return _0xa9a243[_0x23b9('0x20')]()[_0x23b9('0x1f')](function(){_0x4bcdaf[_0x23b9('0x16')](0xcc)[_0x23b9('0x15')]();});}};}function handleEntityNotFound(_0x4d868c,_0x325dbc){return function(_0x163e72){if(!_0x163e72){_0x4d868c[_0x23b9('0x21')](0x194);}return _0x163e72;};}function handleError(_0x1bd737,_0x5de3b0){_0x5de3b0=_0x5de3b0||0x1f4;return function(_0x539e51){logger['error'](_0x539e51['stack']);if(_0x539e51[_0x23b9('0x22')]){delete _0x539e51[_0x23b9('0x22')];}_0x1bd737[_0x23b9('0x16')](_0x5de3b0)[_0x23b9('0x23')](_0x539e51);};}exports['index']=function(_0x173693,_0x25b4cc){var _0x1945e7={},_0x396e54={},_0xdf80e0={'count':0x0,'rows':[]};var _0x4d69e8=_[_0x23b9('0x24')](db[_0x23b9('0x25')]['rawAttributes'],function(_0xf2005a){return{'name':_0xf2005a[_0x23b9('0x26')],'type':_0xf2005a[_0x23b9('0x27')][_0x23b9('0x28')]};});_0x396e54['model']=_['map'](_0x4d69e8,_0x23b9('0x22'));_0x396e54[_0x23b9('0x29')]=_['keys'](_0x173693['query']);_0x396e54[_0x23b9('0x2a')]=_['intersection'](_0x396e54[_0x23b9('0x2b')],_0x396e54[_0x23b9('0x29')]);_0x1945e7[_0x23b9('0x2c')]=_['intersection'](_0x396e54[_0x23b9('0x2b')],qs[_0x23b9('0x2d')](_0x173693[_0x23b9('0x29')][_0x23b9('0x2d')]));_0x1945e7['attributes']=_0x1945e7[_0x23b9('0x2c')][_0x23b9('0x2e')]?_0x1945e7['attributes']:_0x396e54[_0x23b9('0x2b')];if(!_0x173693['query'][_0x23b9('0x2f')]('nolimit')){_0x1945e7[_0x23b9('0x30')]=qs[_0x23b9('0x30')](_0x173693[_0x23b9('0x29')][_0x23b9('0x30')]);_0x1945e7[_0x23b9('0x18')]=qs[_0x23b9('0x18')](_0x173693[_0x23b9('0x29')][_0x23b9('0x18')]);}_0x1945e7[_0x23b9('0x31')]=qs[_0x23b9('0x32')](_0x173693[_0x23b9('0x29')][_0x23b9('0x32')]);_0x1945e7[_0x23b9('0x33')]=qs['filters'](_[_0x23b9('0x34')](_0x173693['query'],_0x396e54[_0x23b9('0x2a')]),_0x4d69e8);if(_0x173693['query'][_0x23b9('0x35')]){_0x1945e7[_0x23b9('0x33')]=_[_0x23b9('0x36')](_0x1945e7[_0x23b9('0x33')],{'$or':_['map'](_0x4d69e8,function(_0x5ec248){if(_0x5ec248[_0x23b9('0x27')]!==_0x23b9('0x37')){var _0x5c5abc={};_0x5c5abc[_0x5ec248[_0x23b9('0x22')]]={'$like':'%'+_0x173693[_0x23b9('0x29')]['filter']+'%'};return _0x5c5abc;}})});}_0x1945e7=_['merge']({},_0x1945e7,_0x173693['options']);var _0x2c7511={'where':_0x1945e7[_0x23b9('0x33')]};return db[_0x23b9('0x25')][_0x23b9('0x1a')](_0x2c7511)['then'](function(_0x54790a){_0xdf80e0[_0x23b9('0x1a')]=_0x54790a;if(_0x173693[_0x23b9('0x29')][_0x23b9('0x38')]){_0x1945e7[_0x23b9('0x39')]=[{'all':!![]}];}return db[_0x23b9('0x25')]['findAll'](_0x1945e7);})['then'](function(_0x3a4f66){_0xdf80e0[_0x23b9('0x3a')]=_0x3a4f66;return _0xdf80e0;})[_0x23b9('0x1f')](respondWithFilteredResult(_0x25b4cc,_0x1945e7))['catch'](handleError(_0x25b4cc,null));};exports['show']=function(_0x19d3f5,_0x2509e5){var _0xf7c4f8={'raw':!![],'where':{'id':_0x19d3f5[_0x23b9('0x3b')]['id']}},_0x25b041={};_0x25b041[_0x23b9('0x2b')]=_[_0x23b9('0x3c')](db['FreshsalesField'][_0x23b9('0x3d')]);_0x25b041['query']=_['keys'](_0x19d3f5[_0x23b9('0x29')]);_0x25b041[_0x23b9('0x2a')]=_[_0x23b9('0x3e')](_0x25b041['model'],_0x25b041['query']);_0xf7c4f8['attributes']=_[_0x23b9('0x3e')](_0x25b041[_0x23b9('0x2b')],qs[_0x23b9('0x2d')](_0x19d3f5['query'][_0x23b9('0x2d')]));_0xf7c4f8[_0x23b9('0x2c')]=_0xf7c4f8['attributes'][_0x23b9('0x2e')]?_0xf7c4f8[_0x23b9('0x2c')]:_0x25b041[_0x23b9('0x2b')];if(_0x19d3f5[_0x23b9('0x29')]['includeAll']){_0xf7c4f8[_0x23b9('0x39')]=[{'all':!![]}];}_0xf7c4f8=_[_0x23b9('0x36')]({},_0xf7c4f8,_0x19d3f5['options']);return db[_0x23b9('0x25')][_0x23b9('0x3f')](_0xf7c4f8)[_0x23b9('0x1f')](handleEntityNotFound(_0x2509e5,null))[_0x23b9('0x1f')](respondWithResult(_0x2509e5,null))[_0x23b9('0x40')](handleError(_0x2509e5,null));};exports[_0x23b9('0x41')]=function(_0x5a3340,_0x21a81c){return db[_0x23b9('0x25')][_0x23b9('0x41')](_0x5a3340[_0x23b9('0x42')],{})[_0x23b9('0x1f')](respondWithResult(_0x21a81c,0xc9))[_0x23b9('0x40')](handleError(_0x21a81c,null));};exports['update']=function(_0x4f0340,_0x185dfc){if(_0x4f0340[_0x23b9('0x42')]['id']){delete _0x4f0340[_0x23b9('0x42')]['id'];}return db[_0x23b9('0x25')][_0x23b9('0x3f')]({'where':{'id':_0x4f0340[_0x23b9('0x3b')]['id']}})[_0x23b9('0x1f')](handleEntityNotFound(_0x185dfc,null))[_0x23b9('0x1f')](saveUpdates(_0x4f0340[_0x23b9('0x42')],null))[_0x23b9('0x1f')](respondWithResult(_0x185dfc,null))[_0x23b9('0x40')](handleError(_0x185dfc,null));};exports['destroy']=function(_0x49a075,_0x2cccc1){return db[_0x23b9('0x25')]['find']({'where':{'id':_0x49a075[_0x23b9('0x3b')]['id']}})['then'](handleEntityNotFound(_0x2cccc1,null))[_0x23b9('0x1f')](removeEntity(_0x2cccc1,null))['catch'](handleError(_0x2cccc1,null));}; \ No newline at end of file +var _0xbf85=['status','end','json','offset','limit','undefined','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','FreshsalesField','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','count','include','catch','show','params','includeAll','find','create','body','eml-format','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbf85,0x1a5));var _0x5bf8=function(_0x24a8f1,_0x2d4fab){_0x24a8f1=_0x24a8f1-0x0;var _0x487552=_0xbf85[_0x24a8f1];return _0x487552;};'use strict';var emlformat=require(_0x5bf8('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5bf8('0x1'));var rp=require(_0x5bf8('0x2'));var moment=require(_0x5bf8('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5bf8('0x4'));var util=require(_0x5bf8('0x5'));var path=require(_0x5bf8('0x6'));var sox=require(_0x5bf8('0x7'));var csv=require(_0x5bf8('0x8'));var ejs=require(_0x5bf8('0x9'));var fs=require('fs');var fs_extra=require(_0x5bf8('0xa'));var _=require(_0x5bf8('0xb'));var squel=require(_0x5bf8('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5bf8('0xd'));var toCsv=require(_0x5bf8('0x8'));var querystring=require('querystring');var Papa=require(_0x5bf8('0xe'));var Redis=require(_0x5bf8('0xf'));var authService=require(_0x5bf8('0x10'));var qs=require(_0x5bf8('0x11'));var as=require(_0x5bf8('0x12'));var hardwareService=require(_0x5bf8('0x13'));var logger=require('../../config/logger')(_0x5bf8('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5bf8('0x15'));var db=require(_0x5bf8('0x16'))['db'];function respondWithStatusCode(_0x4d1755,_0x287e1c){_0x287e1c=_0x287e1c||0xcc;return function(_0x5c8a0f){if(_0x5c8a0f){return _0x4d1755['sendStatus'](_0x287e1c);}return _0x4d1755[_0x5bf8('0x17')](_0x287e1c)[_0x5bf8('0x18')]();};}function respondWithResult(_0x14d751,_0x754d19){_0x754d19=_0x754d19||0xc8;return function(_0x507ef0){if(_0x507ef0){return _0x14d751['status'](_0x754d19)[_0x5bf8('0x19')](_0x507ef0);}};}function respondWithFilteredResult(_0x13f20f,_0x1b37a4){return function(_0x5b31e8){if(_0x5b31e8){var _0x1ff97f=typeof _0x1b37a4[_0x5bf8('0x1a')]==='undefined'&&typeof _0x1b37a4[_0x5bf8('0x1b')]===_0x5bf8('0x1c');var _0x236368=_0x5b31e8['count'];var _0x2f5d66=_0x1ff97f?0x0:_0x1b37a4[_0x5bf8('0x1a')];var _0x47a6f2=_0x1ff97f?_0x5b31e8['count']:_0x1b37a4[_0x5bf8('0x1a')]+_0x1b37a4['limit'];var _0x404b0e;if(_0x47a6f2>=_0x236368){_0x47a6f2=_0x236368;_0x404b0e=0xc8;}else{_0x404b0e=0xce;}_0x13f20f['status'](_0x404b0e);return _0x13f20f[_0x5bf8('0x1d')](_0x5bf8('0x1e'),_0x2f5d66+'-'+_0x47a6f2+'/'+_0x236368)[_0x5bf8('0x19')](_0x5b31e8);}return null;};}function patchUpdates(_0x4e3a21){return function(_0x2748d1){try{jsonpatch[_0x5bf8('0x1f')](_0x2748d1,_0x4e3a21,!![]);}catch(_0x393483){return BPromise[_0x5bf8('0x20')](_0x393483);}return _0x2748d1[_0x5bf8('0x21')]();};}function saveUpdates(_0xd92229,_0x26b8d6){return function(_0x36f33a){if(_0x36f33a){return _0x36f33a[_0x5bf8('0x22')](_0xd92229)['then'](function(_0x1b682f){return _0x1b682f;});}return null;};}function removeEntity(_0x5756ba,_0x458a5f){return function(_0x1873f2){if(_0x1873f2){return _0x1873f2[_0x5bf8('0x23')]()[_0x5bf8('0x24')](function(){_0x5756ba['status'](0xcc)[_0x5bf8('0x18')]();});}};}function handleEntityNotFound(_0x53854b,_0x2d65d6){return function(_0x17cd18){if(!_0x17cd18){_0x53854b['sendStatus'](0x194);}return _0x17cd18;};}function handleError(_0x552ef3,_0x24e7f9){_0x24e7f9=_0x24e7f9||0x1f4;return function(_0x20b410){logger[_0x5bf8('0x25')](_0x20b410[_0x5bf8('0x26')]);if(_0x20b410['name']){delete _0x20b410[_0x5bf8('0x27')];}_0x552ef3[_0x5bf8('0x17')](_0x24e7f9)[_0x5bf8('0x28')](_0x20b410);};}exports[_0x5bf8('0x29')]=function(_0x5c00a1,_0x1dbb04){var _0xba3c65={},_0x33d44d={},_0x14e722={'count':0x0,'rows':[]};var _0x43ef7d=_[_0x5bf8('0x2a')](db[_0x5bf8('0x2b')][_0x5bf8('0x2c')],function(_0x49665d){return{'name':_0x49665d['fieldName'],'type':_0x49665d['type'][_0x5bf8('0x2d')]};});_0x33d44d[_0x5bf8('0x2e')]=_[_0x5bf8('0x2a')](_0x43ef7d,_0x5bf8('0x27'));_0x33d44d[_0x5bf8('0x2f')]=_[_0x5bf8('0x30')](_0x5c00a1[_0x5bf8('0x2f')]);_0x33d44d[_0x5bf8('0x31')]=_[_0x5bf8('0x32')](_0x33d44d['model'],_0x33d44d[_0x5bf8('0x2f')]);_0xba3c65['attributes']=_[_0x5bf8('0x32')](_0x33d44d[_0x5bf8('0x2e')],qs[_0x5bf8('0x33')](_0x5c00a1[_0x5bf8('0x2f')][_0x5bf8('0x33')]));_0xba3c65[_0x5bf8('0x34')]=_0xba3c65[_0x5bf8('0x34')][_0x5bf8('0x35')]?_0xba3c65['attributes']:_0x33d44d[_0x5bf8('0x2e')];if(!_0x5c00a1[_0x5bf8('0x2f')][_0x5bf8('0x36')](_0x5bf8('0x37'))){_0xba3c65[_0x5bf8('0x1b')]=qs[_0x5bf8('0x1b')](_0x5c00a1[_0x5bf8('0x2f')]['limit']);_0xba3c65[_0x5bf8('0x1a')]=qs[_0x5bf8('0x1a')](_0x5c00a1[_0x5bf8('0x2f')]['offset']);}_0xba3c65[_0x5bf8('0x38')]=qs['sort'](_0x5c00a1['query'][_0x5bf8('0x39')]);_0xba3c65[_0x5bf8('0x3a')]=qs['filters'](_[_0x5bf8('0x3b')](_0x5c00a1[_0x5bf8('0x2f')],_0x33d44d[_0x5bf8('0x31')]),_0x43ef7d);if(_0x5c00a1[_0x5bf8('0x2f')][_0x5bf8('0x3c')]){_0xba3c65[_0x5bf8('0x3a')]=_[_0x5bf8('0x3d')](_0xba3c65['where'],{'$or':_[_0x5bf8('0x2a')](_0x43ef7d,function(_0x544cb4){if(_0x544cb4[_0x5bf8('0x3e')]!==_0x5bf8('0x3f')){var _0x4df00e={};_0x4df00e[_0x544cb4[_0x5bf8('0x27')]]={'$like':'%'+_0x5c00a1[_0x5bf8('0x2f')]['filter']+'%'};return _0x4df00e;}})});}_0xba3c65=_['merge']({},_0xba3c65,_0x5c00a1[_0x5bf8('0x40')]);var _0x1fe609={'where':_0xba3c65[_0x5bf8('0x3a')]};return db[_0x5bf8('0x2b')][_0x5bf8('0x41')](_0x1fe609)['then'](function(_0x1cfbbd){_0x14e722[_0x5bf8('0x41')]=_0x1cfbbd;if(_0x5c00a1['query']['includeAll']){_0xba3c65[_0x5bf8('0x42')]=[{'all':!![]}];}return db[_0x5bf8('0x2b')]['findAll'](_0xba3c65);})['then'](function(_0x1bbda2){_0x14e722['rows']=_0x1bbda2;return _0x14e722;})[_0x5bf8('0x24')](respondWithFilteredResult(_0x1dbb04,_0xba3c65))[_0x5bf8('0x43')](handleError(_0x1dbb04,null));};exports[_0x5bf8('0x44')]=function(_0x6fc21a,_0x6b99ec){var _0x24857f={'raw':!![],'where':{'id':_0x6fc21a[_0x5bf8('0x45')]['id']}},_0x2cc895={};_0x2cc895[_0x5bf8('0x2e')]=_[_0x5bf8('0x30')](db[_0x5bf8('0x2b')]['rawAttributes']);_0x2cc895[_0x5bf8('0x2f')]=_['keys'](_0x6fc21a[_0x5bf8('0x2f')]);_0x2cc895['filters']=_[_0x5bf8('0x32')](_0x2cc895[_0x5bf8('0x2e')],_0x2cc895[_0x5bf8('0x2f')]);_0x24857f[_0x5bf8('0x34')]=_[_0x5bf8('0x32')](_0x2cc895[_0x5bf8('0x2e')],qs['fields'](_0x6fc21a['query'][_0x5bf8('0x33')]));_0x24857f[_0x5bf8('0x34')]=_0x24857f[_0x5bf8('0x34')][_0x5bf8('0x35')]?_0x24857f[_0x5bf8('0x34')]:_0x2cc895[_0x5bf8('0x2e')];if(_0x6fc21a['query'][_0x5bf8('0x46')]){_0x24857f[_0x5bf8('0x42')]=[{'all':!![]}];}_0x24857f=_[_0x5bf8('0x3d')]({},_0x24857f,_0x6fc21a[_0x5bf8('0x40')]);return db['FreshsalesField'][_0x5bf8('0x47')](_0x24857f)[_0x5bf8('0x24')](handleEntityNotFound(_0x6b99ec,null))[_0x5bf8('0x24')](respondWithResult(_0x6b99ec,null))[_0x5bf8('0x43')](handleError(_0x6b99ec,null));};exports[_0x5bf8('0x48')]=function(_0x560bdf,_0x4625a7){return db[_0x5bf8('0x2b')][_0x5bf8('0x48')](_0x560bdf[_0x5bf8('0x49')],{})[_0x5bf8('0x24')](respondWithResult(_0x4625a7,0xc9))[_0x5bf8('0x43')](handleError(_0x4625a7,null));};exports['update']=function(_0x11dc06,_0x2f0c34){if(_0x11dc06['body']['id']){delete _0x11dc06[_0x5bf8('0x49')]['id'];}return db[_0x5bf8('0x2b')]['find']({'where':{'id':_0x11dc06[_0x5bf8('0x45')]['id']}})['then'](handleEntityNotFound(_0x2f0c34,null))['then'](saveUpdates(_0x11dc06['body'],null))[_0x5bf8('0x24')](respondWithResult(_0x2f0c34,null))[_0x5bf8('0x43')](handleError(_0x2f0c34,null));};exports[_0x5bf8('0x23')]=function(_0x2153ed,_0x5dab37){return db[_0x5bf8('0x2b')][_0x5bf8('0x47')]({'where':{'id':_0x2153ed[_0x5bf8('0x45')]['id']}})[_0x5bf8('0x24')](handleEntityNotFound(_0x5dab37,null))[_0x5bf8('0x24')](removeEntity(_0x5dab37,null))[_0x5bf8('0x43')](handleError(_0x5dab37,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index a389c13..5182ef4 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 _0xaa64=['lodash','util','api','bluebird','request-promise','path','../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField','idField','FieldId'];(function(_0x5b3e6b,_0x47a86f){var _0x3f615a=function(_0x31b4a6){while(--_0x31b4a6){_0x5b3e6b['push'](_0x5b3e6b['shift']());}};_0x3f615a(++_0x47a86f);}(_0xaa64,0xf7));var _0x4aa6=function(_0x23f97b,_0x416706){_0x23f97b=_0x23f97b-0x0;var _0x45d628=_0xaa64[_0x23f97b];return _0x45d628;};'use strict';var _=require(_0x4aa6('0x0'));var util=require(_0x4aa6('0x1'));var logger=require('../../config/logger')(_0x4aa6('0x2'));var moment=require('moment');var BPromise=require(_0x4aa6('0x3'));var rp=require(_0x4aa6('0x4'));var fs=require('fs');var path=require(_0x4aa6('0x5'));var rimraf=require('rimraf');var config=require(_0x4aa6('0x6'));var attributes=require(_0x4aa6('0x7'));module[_0x4aa6('0x8')]=function(_0x37a260,_0x426bd6){return _0x37a260[_0x4aa6('0x9')](_0x4aa6('0xa'),attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0x4aa6('0xb'),_0x4aa6('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xaa64=['lodash','util','api','bluebird','request-promise','path','../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField','idField','FieldId'];(function(_0xec4c5a,_0x3e1624){var _0x16f4d5=function(_0x55da71){while(--_0x55da71){_0xec4c5a['push'](_0xec4c5a['shift']());}};_0x16f4d5(++_0x3e1624);}(_0xaa64,0xf7));var _0x4aa6=function(_0x44450c,_0x39f7e0){_0x44450c=_0x44450c-0x0;var _0x4e53ad=_0xaa64[_0x44450c];return _0x4e53ad;};'use strict';var _=require(_0x4aa6('0x0'));var util=require(_0x4aa6('0x1'));var logger=require('../../config/logger')(_0x4aa6('0x2'));var moment=require('moment');var BPromise=require(_0x4aa6('0x3'));var rp=require(_0x4aa6('0x4'));var fs=require('fs');var path=require(_0x4aa6('0x5'));var rimraf=require('rimraf');var config=require(_0x4aa6('0x6'));var attributes=require(_0x4aa6('0x7'));module[_0x4aa6('0x8')]=function(_0x37a260,_0x426bd6){return _0x37a260[_0x4aa6('0x9')](_0x4aa6('0xa'),attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0x4aa6('0xb'),_0x4aa6('0xc')],'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 a3aba8e..36372d9 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 _0x1883=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1973e1,_0x40e720){var _0x3458a4=function(_0x5f2a2c){while(--_0x5f2a2c){_0x1973e1['push'](_0x1973e1['shift']());}};_0x3458a4(++_0x40e720);}(_0x1883,0xab));var _0x3188=function(_0xa15c95,_0x28e844){_0xa15c95=_0xa15c95-0x0;var _0x13b137=_0x1883[_0xa15c95];return _0x13b137;};'use strict';var _=require(_0x3188('0x0'));var util=require(_0x3188('0x1'));var moment=require(_0x3188('0x2'));var BPromise=require(_0x3188('0x3'));var rs=require(_0x3188('0x4'));var fs=require('fs');var Redis=require(_0x3188('0x5'));var db=require(_0x3188('0x6'))['db'];var utils=require(_0x3188('0x7'));var logger=require(_0x3188('0x8'))(_0x3188('0x9'));var config=require(_0x3188('0xa'));var jayson=require(_0x3188('0xb'));var client=jayson[_0x3188('0xc')][_0x3188('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x24f2f1,_0x3ce7fd,_0x3e3afb){return new BPromise(function(_0x5c8f26,_0x446ab7){return client[_0x3188('0xe')](_0x24f2f1,_0x3e3afb)['then'](function(_0x2213b5){logger['info'](_0x3188('0xf'),_0x3ce7fd,_0x3188('0x10'));logger[_0x3188('0x11')](_0x3188('0x12'),_0x3ce7fd,'request\x20sent',JSON[_0x3188('0x13')](_0x2213b5));if(_0x2213b5[_0x3188('0x14')]){if(_0x2213b5['error']['code']===0x1f4){logger[_0x3188('0x14')](_0x3188('0xf'),_0x3ce7fd,_0x2213b5[_0x3188('0x14')][_0x3188('0x15')]);return _0x446ab7(_0x2213b5[_0x3188('0x14')][_0x3188('0x15')]);}logger['error'](_0x3188('0xf'),_0x3ce7fd,_0x2213b5['error']['message']);return _0x5c8f26(_0x2213b5[_0x3188('0x14')]['message']);}else{logger['info'](_0x3188('0xf'),_0x3ce7fd,_0x3188('0x10'));_0x5c8f26(_0x2213b5[_0x3188('0x16')][_0x3188('0x15')]);}})[_0x3188('0x17')](function(_0x259321){logger['error'](_0x3188('0xf'),_0x3ce7fd,_0x259321);_0x446ab7(_0x259321);});});} \ No newline at end of file +var _0x1623=['../../config/utils','../../config/environment','client','http','request','then','info','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','FreshsalesField,\x20%s,\x20%s','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x42ab74,_0x2ddf01){var _0x4cae10=function(_0x123cd2){while(--_0x123cd2){_0x42ab74['push'](_0x42ab74['shift']());}};_0x4cae10(++_0x2ddf01);}(_0x1623,0xab));var _0x3162=function(_0x44049b,_0x1e2ca6){_0x44049b=_0x44049b-0x0;var _0x4a1924=_0x1623[_0x44049b];return _0x4a1924;};'use strict';var _=require(_0x3162('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3162('0x1'));var rs=require(_0x3162('0x2'));var fs=require('fs');var Redis=require(_0x3162('0x3'));var db=require(_0x3162('0x4'))['db'];var utils=require(_0x3162('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x3162('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3162('0x7')][_0x3162('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x53260d,_0xffe9b6,_0x2dc07e){return new BPromise(function(_0x26ee32,_0x36609e){return client[_0x3162('0x9')](_0x53260d,_0x2dc07e)[_0x3162('0xa')](function(_0xe43099){logger[_0x3162('0xb')]('FreshsalesField,\x20%s,\x20%s',_0xffe9b6,'request\x20sent');logger[_0x3162('0xc')](_0x3162('0xd'),_0xffe9b6,_0x3162('0xe'),JSON[_0x3162('0xf')](_0xe43099));if(_0xe43099[_0x3162('0x10')]){if(_0xe43099[_0x3162('0x10')][_0x3162('0x11')]===0x1f4){logger[_0x3162('0x10')](_0x3162('0x12'),_0xffe9b6,_0xe43099['error'][_0x3162('0x13')]);return _0x36609e(_0xe43099['error'][_0x3162('0x13')]);}logger[_0x3162('0x10')]('FreshsalesField,\x20%s,\x20%s',_0xffe9b6,_0xe43099['error'][_0x3162('0x13')]);return _0x26ee32(_0xe43099[_0x3162('0x10')][_0x3162('0x13')]);}else{logger['info'](_0x3162('0x12'),_0xffe9b6,_0x3162('0xe'));_0x26ee32(_0xe43099[_0x3162('0x14')]['message']);}})[_0x3162('0x15')](function(_0x42cf7d){logger[_0x3162('0x10')](_0x3162('0x12'),_0xffe9b6,_0x42cf7d);_0x36609e(_0x42cf7d);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 55ae8a0..5023ad9 100644 --- a/server/api/intSalesforceAccount/index.js +++ b/server/api/intSalesforceAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x909a11,_0x3ecbbd){var _0x164081=function(_0x80fec9){while(--_0x80fec9){_0x909a11['push'](_0x909a11['shift']());}};_0x164081(++_0x3ecbbd);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x128c26,_0x45a640){var _0xb70aca=function(_0x40f96c){while(--_0x40f96c){_0x128c26['push'](_0x128c26['shift']());}};_0xb70aca(++_0x45a640);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 3f59916..927fbf4 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 _0xc373=['STRING','newTab','integrationTab','exports'];(function(_0x59b549,_0x3a2ba7){var _0x2da2d9=function(_0xf0a8b1){while(--_0xf0a8b1){_0x59b549['push'](_0x59b549['shift']());}};_0x2da2d9(++_0x3a2ba7);}(_0xc373,0x1c7));var _0x3c37=function(_0x43aee5,_0x11268b){_0x43aee5=_0x43aee5-0x0;var _0x76d1d0=_0xc373[_0x43aee5];return _0x76d1d0;};'use strict';var Sequelize=require('sequelize');module[_0x3c37('0x0')]={'name':{'type':Sequelize[_0x3c37('0x1')]},'description':{'type':Sequelize[_0x3c37('0x1')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'remoteUri':{'type':Sequelize[_0x3c37('0x1')]},'password':{'type':Sequelize[_0x3c37('0x1')]},'clientId':{'type':Sequelize[_0x3c37('0x1')]},'clientSecret':{'type':Sequelize[_0x3c37('0x1')]},'securityToken':{'type':Sequelize[_0x3c37('0x1')]},'serverUrl':{'type':Sequelize[_0x3c37('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('integrationTab',_0x3c37('0x2')),'defaultValue':_0x3c37('0x3')}}; \ No newline at end of file +var _0x3174=['username','ENUM','integrationTab','newTab','sequelize','STRING'];(function(_0xa22539,_0x4683ca){var _0x12d52f=function(_0x165b7d){while(--_0x165b7d){_0xa22539['push'](_0xa22539['shift']());}};_0x12d52f(++_0x4683ca);}(_0x3174,0x154));var _0x4317=function(_0x5759d8,_0x25f232){_0x5759d8=_0x5759d8-0x0;var _0x5c6d9e=_0x3174[_0x5759d8];return _0x5c6d9e;};'use strict';var Sequelize=require(_0x4317('0x0'));module['exports']={'name':{'type':Sequelize[_0x4317('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x4317('0x2')},'remoteUri':{'type':Sequelize[_0x4317('0x1')]},'password':{'type':Sequelize[_0x4317('0x1')]},'clientId':{'type':Sequelize[_0x4317('0x1')]},'clientSecret':{'type':Sequelize[_0x4317('0x1')]},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x4317('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x4317('0x3')](_0x4317('0x4'),_0x4317('0x5')),'defaultValue':_0x4317('0x4')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 5f256bb..4f03ca3 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 _0x4852=['isNil','ticketType','sobject','describe','OwnerId','IsRecurrence','Description','int','boolean','email','textarea','includes','label','custom','picklistValues','value','true','False','false','error','getFields,\x20%s,\x20%s,\x20%s','stringify','statusCode','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','then','destroy','stack','name','send','index','map','SalesforceAccount','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filters','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','update','body','getConfigurations','findOne','SalesforceConfiguration','nolimit','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','SalesforceField','getFields','Task','remoteUri','clientSecret','username','password','securityToken','slice','lastIndexOf','Connection','clientId'];(function(_0x1acc44,_0x4661ab){var _0x5bee35=function(_0x5da868){while(--_0x5da868){_0x1acc44['push'](_0x1acc44['shift']());}};_0x5bee35(++_0x4661ab);}(_0x4852,0xff));var _0x2485=function(_0x36e161,_0x4b15d0){_0x36e161=_0x36e161-0x0;var _0x5a7e53=_0x4852[_0x36e161];return _0x5a7e53;};'use strict';var emlformat=require(_0x2485('0x0'));var rimraf=require(_0x2485('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2485('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2485('0x3'));var Mustache=require(_0x2485('0x4'));var util=require(_0x2485('0x5'));var path=require(_0x2485('0x6'));var sox=require('sox');var csv=require(_0x2485('0x7'));var ejs=require(_0x2485('0x8'));var fs=require('fs');var fs_extra=require(_0x2485('0x9'));var _=require('lodash');var squel=require(_0x2485('0xa'));var crypto=require(_0x2485('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2485('0xc'));var Papa=require(_0x2485('0xd'));var Redis=require('ioredis');var authService=require(_0x2485('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x2485('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2485('0x10'))('api');var utils=require(_0x2485('0x11'));var config=require(_0x2485('0x12'));var licenseUtil=require(_0x2485('0x13'));var db=require(_0x2485('0x14'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x487f01,_0x21838d){_0x21838d=_0x21838d||0xcc;return function(_0x24d39b){if(_0x24d39b){return _0x487f01[_0x2485('0x15')](_0x21838d);}return _0x487f01[_0x2485('0x16')](_0x21838d)[_0x2485('0x17')]();};}function respondWithResult(_0x2cc78c,_0x50a33a){_0x50a33a=_0x50a33a||0xc8;return function(_0x338739){if(_0x338739){return _0x2cc78c['status'](_0x50a33a)[_0x2485('0x18')](_0x338739);}};}function respondWithFilteredResult(_0x848c7c,_0x3b225f){return function(_0x425d8e){if(_0x425d8e){var _0x5ba3b8=typeof _0x3b225f[_0x2485('0x19')]==='undefined'&&typeof _0x3b225f[_0x2485('0x1a')]===_0x2485('0x1b');var _0x4f321d=_0x425d8e[_0x2485('0x1c')];var _0x7ba65f=_0x5ba3b8?0x0:_0x3b225f[_0x2485('0x19')];var _0x332e72=_0x5ba3b8?_0x425d8e[_0x2485('0x1c')]:_0x3b225f['offset']+_0x3b225f['limit'];var _0x3a4667;if(_0x332e72>=_0x4f321d){_0x332e72=_0x4f321d;_0x3a4667=0xc8;}else{_0x3a4667=0xce;}_0x848c7c['status'](_0x3a4667);return _0x848c7c[_0x2485('0x1d')](_0x2485('0x1e'),_0x7ba65f+'-'+_0x332e72+'/'+_0x4f321d)[_0x2485('0x18')](_0x425d8e);}return null;};}function patchUpdates(_0x3d6de1){return function(_0x4b5c1a){try{jsonpatch[_0x2485('0x1f')](_0x4b5c1a,_0x3d6de1,!![]);}catch(_0x504dfa){return BPromise[_0x2485('0x20')](_0x504dfa);}return _0x4b5c1a['save']();};}function saveUpdates(_0x54d931,_0x172bb1){return function(_0x58c728){if(_0x58c728){return _0x58c728['update'](_0x54d931)[_0x2485('0x21')](function(_0x10e6d6){return _0x10e6d6;});}return null;};}function removeEntity(_0x496bd7,_0xa02fdd){return function(_0x38046d){if(_0x38046d){return _0x38046d[_0x2485('0x22')]()[_0x2485('0x21')](function(){_0x496bd7[_0x2485('0x16')](0xcc)[_0x2485('0x17')]();});}};}function handleEntityNotFound(_0x5068e6,_0x53c6cb){return function(_0x295f77){if(!_0x295f77){_0x5068e6[_0x2485('0x15')](0x194);}return _0x295f77;};}function handleError(_0x154d4d,_0x35b941){_0x35b941=_0x35b941||0x1f4;return function(_0x2fd1c7){logger['error'](_0x2fd1c7[_0x2485('0x23')]);if(_0x2fd1c7['name']){delete _0x2fd1c7[_0x2485('0x24')];}_0x154d4d['status'](_0x35b941)[_0x2485('0x25')](_0x2fd1c7);};}exports[_0x2485('0x26')]=function(_0x4f5034,_0x6de190){var _0x4620fe={},_0x1ef543={},_0x18b695={'count':0x0,'rows':[]};var _0x8cfddf=_[_0x2485('0x27')](db[_0x2485('0x28')][_0x2485('0x29')],function(_0x27b3d2){return{'name':_0x27b3d2[_0x2485('0x2a')],'type':_0x27b3d2[_0x2485('0x2b')]['key']};});_0x1ef543[_0x2485('0x2c')]=_[_0x2485('0x27')](_0x8cfddf,_0x2485('0x24'));_0x1ef543[_0x2485('0x2d')]=_[_0x2485('0x2e')](_0x4f5034[_0x2485('0x2d')]);_0x1ef543['filters']=_[_0x2485('0x2f')](_0x1ef543[_0x2485('0x2c')],_0x1ef543[_0x2485('0x2d')]);_0x4620fe[_0x2485('0x30')]=_[_0x2485('0x2f')](_0x1ef543[_0x2485('0x2c')],qs[_0x2485('0x31')](_0x4f5034[_0x2485('0x2d')]['fields']));_0x4620fe[_0x2485('0x30')]=_0x4620fe[_0x2485('0x30')][_0x2485('0x32')]?_0x4620fe[_0x2485('0x30')]:_0x1ef543[_0x2485('0x2c')];if(!_0x4f5034[_0x2485('0x2d')][_0x2485('0x33')]('nolimit')){_0x4620fe[_0x2485('0x1a')]=qs[_0x2485('0x1a')](_0x4f5034[_0x2485('0x2d')][_0x2485('0x1a')]);_0x4620fe[_0x2485('0x19')]=qs[_0x2485('0x19')](_0x4f5034[_0x2485('0x2d')][_0x2485('0x19')]);}_0x4620fe[_0x2485('0x34')]=qs[_0x2485('0x35')](_0x4f5034['query']['sort']);_0x4620fe[_0x2485('0x36')]=qs['filters'](_[_0x2485('0x37')](_0x4f5034[_0x2485('0x2d')],_0x1ef543[_0x2485('0x38')]),_0x8cfddf);if(_0x4f5034[_0x2485('0x2d')][_0x2485('0x39')]){_0x4620fe[_0x2485('0x36')]=_[_0x2485('0x3a')](_0x4620fe[_0x2485('0x36')],{'$or':_[_0x2485('0x27')](_0x8cfddf,function(_0x4efe9f){if(_0x4efe9f[_0x2485('0x2b')]!=='VIRTUAL'){var _0x1d2a8b={};_0x1d2a8b[_0x4efe9f['name']]={'$like':'%'+_0x4f5034[_0x2485('0x2d')][_0x2485('0x39')]+'%'};return _0x1d2a8b;}})});}_0x4620fe=_['merge']({},_0x4620fe,_0x4f5034[_0x2485('0x3b')]);var _0x354dea={'where':_0x4620fe['where']};return db[_0x2485('0x28')][_0x2485('0x1c')](_0x354dea)[_0x2485('0x21')](function(_0x1a0e44){_0x18b695[_0x2485('0x1c')]=_0x1a0e44;if(_0x4f5034[_0x2485('0x2d')][_0x2485('0x3c')]){_0x4620fe[_0x2485('0x3d')]=[{'all':!![]}];}return db[_0x2485('0x28')][_0x2485('0x3e')](_0x4620fe);})['then'](function(_0xf894ab){_0x18b695[_0x2485('0x3f')]=_0xf894ab;return _0x18b695;})[_0x2485('0x21')](respondWithFilteredResult(_0x6de190,_0x4620fe))[_0x2485('0x40')](handleError(_0x6de190,null));};exports[_0x2485('0x41')]=function(_0x19b7ba,_0x55f8d0){var _0x20da91={'raw':![],'where':{'id':_0x19b7ba[_0x2485('0x42')]['id']}},_0x221264={};_0x221264[_0x2485('0x2c')]=_[_0x2485('0x2e')](db[_0x2485('0x28')][_0x2485('0x29')]);_0x221264[_0x2485('0x2d')]=_['keys'](_0x19b7ba[_0x2485('0x2d')]);_0x221264[_0x2485('0x38')]=_['intersection'](_0x221264[_0x2485('0x2c')],_0x221264[_0x2485('0x2d')]);_0x20da91[_0x2485('0x30')]=_[_0x2485('0x2f')](_0x221264[_0x2485('0x2c')],qs[_0x2485('0x31')](_0x19b7ba[_0x2485('0x2d')]['fields']));_0x20da91['attributes']=_0x20da91[_0x2485('0x30')][_0x2485('0x32')]?_0x20da91[_0x2485('0x30')]:_0x221264[_0x2485('0x2c')];if(_0x19b7ba[_0x2485('0x2d')][_0x2485('0x3c')]){_0x20da91[_0x2485('0x3d')]=[{'all':!![]}];}_0x20da91=_[_0x2485('0x3a')]({},_0x20da91,_0x19b7ba[_0x2485('0x3b')]);return db[_0x2485('0x28')][_0x2485('0x43')](_0x20da91)[_0x2485('0x21')](handleEntityNotFound(_0x55f8d0,null))[_0x2485('0x21')](respondWithResult(_0x55f8d0,null))['catch'](handleError(_0x55f8d0,null));};exports[_0x2485('0x44')]=function(_0x5a7ed3,_0x4e1d04){return db['SalesforceAccount'][_0x2485('0x44')](_0x5a7ed3['body'],{})['then'](respondWithResult(_0x4e1d04,0xc9))[_0x2485('0x40')](handleError(_0x4e1d04,null));};exports[_0x2485('0x45')]=function(_0x501273,_0x1f7b5a){if(_0x501273[_0x2485('0x46')]['id']){delete _0x501273[_0x2485('0x46')]['id'];}return db[_0x2485('0x28')][_0x2485('0x43')]({'where':{'id':_0x501273[_0x2485('0x42')]['id']}})['then'](handleEntityNotFound(_0x1f7b5a,null))[_0x2485('0x21')](saveUpdates(_0x501273[_0x2485('0x46')],null))[_0x2485('0x21')](respondWithResult(_0x1f7b5a,null))[_0x2485('0x40')](handleError(_0x1f7b5a,null));};exports[_0x2485('0x22')]=function(_0xe62b06,_0x148fc3){return db[_0x2485('0x28')][_0x2485('0x43')]({'where':{'id':_0xe62b06[_0x2485('0x42')]['id']}})[_0x2485('0x21')](handleEntityNotFound(_0x148fc3,null))[_0x2485('0x21')](removeEntity(_0x148fc3,null))[_0x2485('0x40')](handleError(_0x148fc3,null));};exports[_0x2485('0x47')]=function(_0x46e645,_0x3769d4,_0x17405c){var _0x2665a7={};var _0x31dee3={};var _0x5f0aa0;var _0x5a476a;return db['SalesforceAccount'][_0x2485('0x48')]({'where':{'id':_0x46e645[_0x2485('0x42')]['id']}})[_0x2485('0x21')](handleEntityNotFound(_0x3769d4,null))[_0x2485('0x21')](function(_0x38778c){if(_0x38778c){_0x5f0aa0=_0x38778c;_0x31dee3[_0x2485('0x2c')]=_[_0x2485('0x2e')](db[_0x2485('0x49')][_0x2485('0x29')]);_0x31dee3[_0x2485('0x2d')]=_[_0x2485('0x2e')](_0x46e645[_0x2485('0x2d')]);_0x31dee3['filters']=_['intersection'](_0x31dee3[_0x2485('0x2c')],_0x31dee3[_0x2485('0x2d')]);_0x2665a7['attributes']=_[_0x2485('0x2f')](_0x31dee3[_0x2485('0x2c')],qs[_0x2485('0x31')](_0x46e645[_0x2485('0x2d')][_0x2485('0x31')]));_0x2665a7[_0x2485('0x30')]=_0x2665a7[_0x2485('0x30')]['length']?_0x2665a7[_0x2485('0x30')]:_0x31dee3[_0x2485('0x2c')];_0x2665a7[_0x2485('0x34')]=qs['sort'](_0x46e645[_0x2485('0x2d')]['sort']);_0x2665a7[_0x2485('0x36')]=qs[_0x2485('0x38')](_[_0x2485('0x37')](_0x46e645[_0x2485('0x2d')],_0x31dee3[_0x2485('0x38')]));if(_0x46e645[_0x2485('0x2d')]['filter']){_0x2665a7[_0x2485('0x36')]=_[_0x2485('0x3a')](_0x2665a7[_0x2485('0x36')],{'$or':_[_0x2485('0x27')](_0x2665a7[_0x2485('0x30')],function(_0x1a6c72){var _0x4b3ab5={};_0x4b3ab5[_0x1a6c72]={'$like':'%'+_0x46e645[_0x2485('0x2d')]['filter']+'%'};return _0x4b3ab5;})});}_0x2665a7=_[_0x2485('0x3a')]({},_0x2665a7,_0x46e645[_0x2485('0x3b')]);return _0x5f0aa0['getConfigurations'](_0x2665a7);}})[_0x2485('0x21')](function(_0x20aca8){if(_0x20aca8){_0x5a476a=_0x20aca8[_0x2485('0x32')];if(!_0x46e645[_0x2485('0x2d')][_0x2485('0x33')](_0x2485('0x4a'))){_0x2665a7[_0x2485('0x1a')]=qs['limit'](_0x46e645[_0x2485('0x2d')][_0x2485('0x1a')]);_0x2665a7[_0x2485('0x19')]=qs['offset'](_0x46e645[_0x2485('0x2d')][_0x2485('0x19')]);}return _0x5f0aa0['getConfigurations'](_0x2665a7);}})[_0x2485('0x21')](function(_0x3b69a4){if(_0x3b69a4){return _0x3b69a4?{'count':_0x5a476a,'rows':_0x3b69a4}:null;}})[_0x2485('0x21')](respondWithResult(_0x3769d4,null))[_0x2485('0x40')](handleError(_0x3769d4,null));};exports['addConfiguration']=function(_0x190720,_0x5dc366,_0x259f2a){if(_0x190720[_0x2485('0x46')]['id']){delete _0x190720[_0x2485('0x46')]['id'];}return db['SalesforceAccount'][_0x2485('0x48')]({'where':{'id':_0x190720[_0x2485('0x42')]['id']}})[_0x2485('0x21')](handleEntityNotFound(_0x5dc366,null))[_0x2485('0x21')](function(_0x44615b){if(_0x44615b){_0x190720['body'][_0x2485('0x4b')]=_0x44615b['id'];_0x190720[_0x2485('0x46')][_0x2485('0x4c')]=integrations[_0x2485('0x4d')](_0x190720[_0x2485('0x46')]['channel'],_0x190720[_0x2485('0x46')][_0x2485('0x2b')]);_0x190720[_0x2485('0x46')][_0x2485('0x4e')]=integrations[_0x2485('0x4f')](_0x190720[_0x2485('0x46')][_0x2485('0x50')],_0x190720[_0x2485('0x46')][_0x2485('0x2b')]);return db['SalesforceConfiguration'][_0x2485('0x44')](_0x190720['body'],{'include':[{'model':db[_0x2485('0x51')],'as':'Subjects'},{'model':db[_0x2485('0x51')],'as':_0x2485('0x4e')}]});}return null;})[_0x2485('0x21')](respondWithResult(_0x5dc366,null))[_0x2485('0x40')](handleError(_0x5dc366,null));};exports[_0x2485('0x52')]=function(_0x5c67a1,_0x22afa9,_0x15c20d){var _0x1687ce;var _0x2afd99='';var _0x4e028f=_0x2485('0x53');return db[_0x2485('0x28')][_0x2485('0x48')]({'where':{'id':_0x5c67a1[_0x2485('0x42')]['id']},'attributes':['id',_0x2485('0x54'),'clientId',_0x2485('0x55'),_0x2485('0x56'),_0x2485('0x57'),_0x2485('0x58')]})[_0x2485('0x21')](handleEntityNotFound(_0x22afa9,null))[_0x2485('0x21')](function(_0x6086fa){if(_0x6086fa){_0x2afd99=_0x6086fa['remoteUri'];var _0x354dc0=_0x2afd99[_0x2485('0x59')](-0x1);if(_0x354dc0==='/'){_0x2afd99=_0x2afd99['substring'](0x0,_0x2afd99[_0x2485('0x5a')](_0x354dc0));}_0x1687ce=new jsforce[(_0x2485('0x5b'))]({'oauth2':{'loginUrl':_0x2afd99,'clientId':_0x6086fa[_0x2485('0x5c')],'clientSecret':_0x6086fa[_0x2485('0x55')]}});return _0x1687ce['login'](_0x6086fa['username'],_0x6086fa[_0x2485('0x57')]['concat'](_0x6086fa[_0x2485('0x58')]));}})[_0x2485('0x21')](function(_0x2d57e){if(_0x2d57e){if(!_[_0x2485('0x5d')](_0x5c67a1[_0x2485('0x2d')][_0x2485('0x5e')])){_0x4e028f=_0x5c67a1[_0x2485('0x2d')][_0x2485('0x5e')];}return _0x1687ce[_0x2485('0x5f')](_0x4e028f)[_0x2485('0x60')]();}})[_0x2485('0x21')](function(_0xc2c887){var _0x324966=[_0x2485('0x61'),'ActivityDate','IsReminderSet',_0x2485('0x62'),'Subject',_0x2485('0x63')];var _0x1d3725=['string',_0x2485('0x64'),'picklist',_0x2485('0x65'),_0x2485('0x66'),_0x2485('0x67'),'phone'];if(_0xc2c887){_['remove'](_0xc2c887[_0x2485('0x31')],function(_0x3d0d0c){return _0x324966[_0x2485('0x68')](_0x3d0d0c[_0x2485('0x24')])||!_0x1d3725[_0x2485('0x68')](_0x3d0d0c[_0x2485('0x2b')]);});return{'count':_0xc2c887[_0x2485('0x31')][_0x2485('0x32')],'rows':_['map'](_0xc2c887[_0x2485('0x31')],function(_0x17de7d){return{'id':_0x17de7d[_0x2485('0x24')],'name':_0x17de7d[_0x2485('0x69')],'custom':_0x17de7d[_0x2485('0x6a')],'options':_0x17de7d[_0x2485('0x6b')][_0x2485('0x32')]>0x0?_[_0x2485('0x27')](_0x17de7d[_0x2485('0x6b')],function(_0x584fc7){return{'name':_0x584fc7[_0x2485('0x69')],'value':_0x584fc7[_0x2485('0x6c')]};}):_0x17de7d['type']==_0x2485('0x65')?[{'name':'True','value':_0x2485('0x6d')},{'name':_0x2485('0x6e'),'value':_0x2485('0x6f')}]:[]};})};}})[_0x2485('0x21')](respondWithResult(_0x22afa9,null))[_0x2485('0x40')](function(_0x350a2a){var _0x57f209=_0x5c67a1[_0x2485('0x2d')]['test']?0x1f4:_0x350a2a['statusCode']||0x1f4;logger[_0x2485('0x70')](_0x2485('0x71'),_0x2485('0x52'),_0x57f209,JSON[_0x2485('0x72')](_0x350a2a));delete _0x350a2a[_0x2485('0x24')];if(_0x57f209===0x191){_0x57f209=0x190;}_0x22afa9[_0x2485('0x16')](_0x57f209)['send'](_0x5c67a1['query']['test']?{'message':'Wrong\x20credentials','statusCode':_0x350a2a[_0x2485('0x73')]}:_0x350a2a);});}; \ No newline at end of file +var _0x01d4=['getFields','Task','remoteUri','clientId','clientSecret','username','password','securityToken','slice','substring','lastIndexOf','login','concat','isNil','ticketType','sobject','describe','ActivityDate','IsReminderSet','IsRecurrence','Subject','string','int','picklist','email','textarea','phone','includes','label','custom','picklistValues','value','True','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','SalesforceAccount','count','includeAll','findAll','rows','catch','show','params','include','find','create','body','getConfigurations','findOne','SalesforceConfiguration','nolimit','Subjects','getSubjects','channel','Descriptions','SalesforceField'];(function(_0x45c191,_0x1af42a){var _0x24adf8=function(_0x27371b){while(--_0x27371b){_0x45c191['push'](_0x45c191['shift']());}};_0x24adf8(++_0x1af42a);}(_0x01d4,0xa6));var _0x401d=function(_0x3c765b,_0x5e3333){_0x3c765b=_0x3c765b-0x0;var _0x5c0605=_0x01d4[_0x3c765b];return _0x5c0605;};'use strict';var emlformat=require(_0x401d('0x0'));var rimraf=require(_0x401d('0x1'));var zipdir=require(_0x401d('0x2'));var jsonpatch=require(_0x401d('0x3'));var rp=require(_0x401d('0x4'));var moment=require(_0x401d('0x5'));var BPromise=require(_0x401d('0x6'));var Mustache=require('mustache');var util=require(_0x401d('0x7'));var path=require(_0x401d('0x8'));var sox=require(_0x401d('0x9'));var csv=require(_0x401d('0xa'));var ejs=require(_0x401d('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x401d('0xc'));var crypto=require('crypto');var jsforce=require(_0x401d('0xd'));var deskjs=require(_0x401d('0xe'));var toCsv=require('to-csv');var querystring=require(_0x401d('0xf'));var Papa=require(_0x401d('0x10'));var Redis=require('ioredis');var authService=require(_0x401d('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x401d('0x12'));var hardwareService=require(_0x401d('0x13'));var logger=require(_0x401d('0x14'))(_0x401d('0x15'));var utils=require(_0x401d('0x16'));var config=require(_0x401d('0x17'));var licenseUtil=require(_0x401d('0x18'));var db=require(_0x401d('0x19'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0xc694bb,_0x484a49){_0x484a49=_0x484a49||0xcc;return function(_0x5aae1b){if(_0x5aae1b){return _0xc694bb[_0x401d('0x1a')](_0x484a49);}return _0xc694bb[_0x401d('0x1b')](_0x484a49)[_0x401d('0x1c')]();};}function respondWithResult(_0x17a7e2,_0x3b6545){_0x3b6545=_0x3b6545||0xc8;return function(_0xfd7a73){if(_0xfd7a73){return _0x17a7e2[_0x401d('0x1b')](_0x3b6545)[_0x401d('0x1d')](_0xfd7a73);}};}function respondWithFilteredResult(_0x5cf807,_0x24a507){return function(_0x3bbde3){if(_0x3bbde3){var _0x22203d=typeof _0x24a507[_0x401d('0x1e')]===_0x401d('0x1f')&&typeof _0x24a507['limit']===_0x401d('0x1f');var _0x175bba=_0x3bbde3['count'];var _0x53547b=_0x22203d?0x0:_0x24a507[_0x401d('0x1e')];var _0x1f2fa0=_0x22203d?_0x3bbde3['count']:_0x24a507[_0x401d('0x1e')]+_0x24a507[_0x401d('0x20')];var _0x107b37;if(_0x1f2fa0>=_0x175bba){_0x1f2fa0=_0x175bba;_0x107b37=0xc8;}else{_0x107b37=0xce;}_0x5cf807[_0x401d('0x1b')](_0x107b37);return _0x5cf807['set'](_0x401d('0x21'),_0x53547b+'-'+_0x1f2fa0+'/'+_0x175bba)[_0x401d('0x1d')](_0x3bbde3);}return null;};}function patchUpdates(_0x345cab){return function(_0x2c93f7){try{jsonpatch[_0x401d('0x22')](_0x2c93f7,_0x345cab,!![]);}catch(_0x4d199e){return BPromise[_0x401d('0x23')](_0x4d199e);}return _0x2c93f7[_0x401d('0x24')]();};}function saveUpdates(_0x39230b,_0x5d3851){return function(_0x23b68b){if(_0x23b68b){return _0x23b68b[_0x401d('0x25')](_0x39230b)[_0x401d('0x26')](function(_0x420312){return _0x420312;});}return null;};}function removeEntity(_0x307da7,_0x13c74d){return function(_0x3a7493){if(_0x3a7493){return _0x3a7493[_0x401d('0x27')]()[_0x401d('0x26')](function(){_0x307da7[_0x401d('0x1b')](0xcc)[_0x401d('0x1c')]();});}};}function handleEntityNotFound(_0x286083,_0x4d1c0e){return function(_0x1f7a1c){if(!_0x1f7a1c){_0x286083[_0x401d('0x1a')](0x194);}return _0x1f7a1c;};}function handleError(_0x55c0a2,_0x48a37e){_0x48a37e=_0x48a37e||0x1f4;return function(_0x1c2d46){logger[_0x401d('0x28')](_0x1c2d46[_0x401d('0x29')]);if(_0x1c2d46[_0x401d('0x2a')]){delete _0x1c2d46[_0x401d('0x2a')];}_0x55c0a2[_0x401d('0x1b')](_0x48a37e)[_0x401d('0x2b')](_0x1c2d46);};}exports[_0x401d('0x2c')]=function(_0x1e1349,_0x279fd0){var _0x41348f={},_0x4a022e={},_0x3fe2ba={'count':0x0,'rows':[]};var _0x3eee09=_[_0x401d('0x2d')](db['SalesforceAccount'][_0x401d('0x2e')],function(_0x548041){return{'name':_0x548041[_0x401d('0x2f')],'type':_0x548041[_0x401d('0x30')][_0x401d('0x31')]};});_0x4a022e[_0x401d('0x32')]=_[_0x401d('0x2d')](_0x3eee09,_0x401d('0x2a'));_0x4a022e[_0x401d('0x33')]=_[_0x401d('0x34')](_0x1e1349['query']);_0x4a022e[_0x401d('0x35')]=_['intersection'](_0x4a022e[_0x401d('0x32')],_0x4a022e['query']);_0x41348f[_0x401d('0x36')]=_[_0x401d('0x37')](_0x4a022e['model'],qs[_0x401d('0x38')](_0x1e1349['query'][_0x401d('0x38')]));_0x41348f[_0x401d('0x36')]=_0x41348f['attributes'][_0x401d('0x39')]?_0x41348f[_0x401d('0x36')]:_0x4a022e[_0x401d('0x32')];if(!_0x1e1349[_0x401d('0x33')][_0x401d('0x3a')]('nolimit')){_0x41348f['limit']=qs[_0x401d('0x20')](_0x1e1349[_0x401d('0x33')][_0x401d('0x20')]);_0x41348f[_0x401d('0x1e')]=qs['offset'](_0x1e1349['query']['offset']);}_0x41348f[_0x401d('0x3b')]=qs[_0x401d('0x3c')](_0x1e1349[_0x401d('0x33')]['sort']);_0x41348f[_0x401d('0x3d')]=qs[_0x401d('0x35')](_[_0x401d('0x3e')](_0x1e1349['query'],_0x4a022e['filters']),_0x3eee09);if(_0x1e1349[_0x401d('0x33')]['filter']){_0x41348f[_0x401d('0x3d')]=_[_0x401d('0x3f')](_0x41348f[_0x401d('0x3d')],{'$or':_['map'](_0x3eee09,function(_0x5cdfce){if(_0x5cdfce[_0x401d('0x30')]!==_0x401d('0x40')){var _0x4e9dc0={};_0x4e9dc0[_0x5cdfce[_0x401d('0x2a')]]={'$like':'%'+_0x1e1349[_0x401d('0x33')][_0x401d('0x41')]+'%'};return _0x4e9dc0;}})});}_0x41348f=_[_0x401d('0x3f')]({},_0x41348f,_0x1e1349[_0x401d('0x42')]);var _0x2a235a={'where':_0x41348f[_0x401d('0x3d')]};return db[_0x401d('0x43')][_0x401d('0x44')](_0x2a235a)['then'](function(_0x143725){_0x3fe2ba[_0x401d('0x44')]=_0x143725;if(_0x1e1349['query'][_0x401d('0x45')]){_0x41348f['include']=[{'all':!![]}];}return db[_0x401d('0x43')][_0x401d('0x46')](_0x41348f);})[_0x401d('0x26')](function(_0x25483b){_0x3fe2ba[_0x401d('0x47')]=_0x25483b;return _0x3fe2ba;})[_0x401d('0x26')](respondWithFilteredResult(_0x279fd0,_0x41348f))[_0x401d('0x48')](handleError(_0x279fd0,null));};exports[_0x401d('0x49')]=function(_0x4f07c2,_0x5c78d1){var _0xb5f17f={'raw':![],'where':{'id':_0x4f07c2[_0x401d('0x4a')]['id']}},_0x350f00={};_0x350f00[_0x401d('0x32')]=_[_0x401d('0x34')](db[_0x401d('0x43')][_0x401d('0x2e')]);_0x350f00['query']=_['keys'](_0x4f07c2[_0x401d('0x33')]);_0x350f00[_0x401d('0x35')]=_['intersection'](_0x350f00['model'],_0x350f00['query']);_0xb5f17f[_0x401d('0x36')]=_[_0x401d('0x37')](_0x350f00[_0x401d('0x32')],qs[_0x401d('0x38')](_0x4f07c2[_0x401d('0x33')][_0x401d('0x38')]));_0xb5f17f[_0x401d('0x36')]=_0xb5f17f[_0x401d('0x36')][_0x401d('0x39')]?_0xb5f17f[_0x401d('0x36')]:_0x350f00[_0x401d('0x32')];if(_0x4f07c2[_0x401d('0x33')][_0x401d('0x45')]){_0xb5f17f[_0x401d('0x4b')]=[{'all':!![]}];}_0xb5f17f=_[_0x401d('0x3f')]({},_0xb5f17f,_0x4f07c2['options']);return db[_0x401d('0x43')][_0x401d('0x4c')](_0xb5f17f)[_0x401d('0x26')](handleEntityNotFound(_0x5c78d1,null))[_0x401d('0x26')](respondWithResult(_0x5c78d1,null))[_0x401d('0x48')](handleError(_0x5c78d1,null));};exports['create']=function(_0x2efefe,_0x533b40){return db['SalesforceAccount'][_0x401d('0x4d')](_0x2efefe[_0x401d('0x4e')],{})[_0x401d('0x26')](respondWithResult(_0x533b40,0xc9))['catch'](handleError(_0x533b40,null));};exports[_0x401d('0x25')]=function(_0x213dcc,_0x40e464){if(_0x213dcc[_0x401d('0x4e')]['id']){delete _0x213dcc[_0x401d('0x4e')]['id'];}return db[_0x401d('0x43')][_0x401d('0x4c')]({'where':{'id':_0x213dcc['params']['id']}})[_0x401d('0x26')](handleEntityNotFound(_0x40e464,null))[_0x401d('0x26')](saveUpdates(_0x213dcc[_0x401d('0x4e')],null))[_0x401d('0x26')](respondWithResult(_0x40e464,null))['catch'](handleError(_0x40e464,null));};exports[_0x401d('0x27')]=function(_0x1fd702,_0x7b5fc8){return db[_0x401d('0x43')][_0x401d('0x4c')]({'where':{'id':_0x1fd702[_0x401d('0x4a')]['id']}})[_0x401d('0x26')](handleEntityNotFound(_0x7b5fc8,null))[_0x401d('0x26')](removeEntity(_0x7b5fc8,null))[_0x401d('0x48')](handleError(_0x7b5fc8,null));};exports[_0x401d('0x4f')]=function(_0x3dd780,_0x2826fa,_0x3a465a){var _0x1e88b7={};var _0x1e45d2={};var _0x3972c8;var _0x3c324b;return db[_0x401d('0x43')][_0x401d('0x50')]({'where':{'id':_0x3dd780[_0x401d('0x4a')]['id']}})[_0x401d('0x26')](handleEntityNotFound(_0x2826fa,null))[_0x401d('0x26')](function(_0x46a7a9){if(_0x46a7a9){_0x3972c8=_0x46a7a9;_0x1e45d2[_0x401d('0x32')]=_[_0x401d('0x34')](db[_0x401d('0x51')]['rawAttributes']);_0x1e45d2[_0x401d('0x33')]=_[_0x401d('0x34')](_0x3dd780[_0x401d('0x33')]);_0x1e45d2[_0x401d('0x35')]=_[_0x401d('0x37')](_0x1e45d2[_0x401d('0x32')],_0x1e45d2['query']);_0x1e88b7[_0x401d('0x36')]=_['intersection'](_0x1e45d2[_0x401d('0x32')],qs['fields'](_0x3dd780[_0x401d('0x33')][_0x401d('0x38')]));_0x1e88b7[_0x401d('0x36')]=_0x1e88b7['attributes'][_0x401d('0x39')]?_0x1e88b7['attributes']:_0x1e45d2[_0x401d('0x32')];_0x1e88b7['order']=qs['sort'](_0x3dd780[_0x401d('0x33')][_0x401d('0x3c')]);_0x1e88b7[_0x401d('0x3d')]=qs['filters'](_[_0x401d('0x3e')](_0x3dd780[_0x401d('0x33')],_0x1e45d2[_0x401d('0x35')]));if(_0x3dd780[_0x401d('0x33')][_0x401d('0x41')]){_0x1e88b7['where']=_[_0x401d('0x3f')](_0x1e88b7['where'],{'$or':_['map'](_0x1e88b7['attributes'],function(_0x4d889b){var _0x53c9e9={};_0x53c9e9[_0x4d889b]={'$like':'%'+_0x3dd780[_0x401d('0x33')][_0x401d('0x41')]+'%'};return _0x53c9e9;})});}_0x1e88b7=_[_0x401d('0x3f')]({},_0x1e88b7,_0x3dd780['options']);return _0x3972c8[_0x401d('0x4f')](_0x1e88b7);}})[_0x401d('0x26')](function(_0x2ad99f){if(_0x2ad99f){_0x3c324b=_0x2ad99f[_0x401d('0x39')];if(!_0x3dd780[_0x401d('0x33')][_0x401d('0x3a')](_0x401d('0x52'))){_0x1e88b7['limit']=qs[_0x401d('0x20')](_0x3dd780[_0x401d('0x33')]['limit']);_0x1e88b7['offset']=qs[_0x401d('0x1e')](_0x3dd780[_0x401d('0x33')]['offset']);}return _0x3972c8[_0x401d('0x4f')](_0x1e88b7);}})[_0x401d('0x26')](function(_0x47ab83){if(_0x47ab83){return _0x47ab83?{'count':_0x3c324b,'rows':_0x47ab83}:null;}})[_0x401d('0x26')](respondWithResult(_0x2826fa,null))[_0x401d('0x48')](handleError(_0x2826fa,null));};exports['addConfiguration']=function(_0x284815,_0x418fd6,_0x165b00){if(_0x284815[_0x401d('0x4e')]['id']){delete _0x284815[_0x401d('0x4e')]['id'];}return db[_0x401d('0x43')][_0x401d('0x50')]({'where':{'id':_0x284815[_0x401d('0x4a')]['id']}})[_0x401d('0x26')](handleEntityNotFound(_0x418fd6,null))[_0x401d('0x26')](function(_0x283c7c){if(_0x283c7c){_0x284815[_0x401d('0x4e')]['AccountId']=_0x283c7c['id'];_0x284815[_0x401d('0x4e')][_0x401d('0x53')]=integrations[_0x401d('0x54')](_0x284815['body'][_0x401d('0x55')],_0x284815[_0x401d('0x4e')][_0x401d('0x30')]);_0x284815[_0x401d('0x4e')][_0x401d('0x56')]=integrations['getDescriptions'](_0x284815[_0x401d('0x4e')]['channel'],_0x284815[_0x401d('0x4e')][_0x401d('0x30')]);return db[_0x401d('0x51')]['create'](_0x284815[_0x401d('0x4e')],{'include':[{'model':db['SalesforceField'],'as':'Subjects'},{'model':db[_0x401d('0x57')],'as':_0x401d('0x56')}]});}return null;})['then'](respondWithResult(_0x418fd6,null))[_0x401d('0x48')](handleError(_0x418fd6,null));};exports[_0x401d('0x58')]=function(_0x4e881a,_0x380029,_0x8a723c){var _0x81a235;var _0x2c551e='';var _0xb5b917=_0x401d('0x59');return db[_0x401d('0x43')][_0x401d('0x50')]({'where':{'id':_0x4e881a['params']['id']},'attributes':['id',_0x401d('0x5a'),_0x401d('0x5b'),_0x401d('0x5c'),_0x401d('0x5d'),_0x401d('0x5e'),_0x401d('0x5f')]})[_0x401d('0x26')](handleEntityNotFound(_0x380029,null))[_0x401d('0x26')](function(_0x5366f2){if(_0x5366f2){_0x2c551e=_0x5366f2[_0x401d('0x5a')];var _0x5d493d=_0x2c551e[_0x401d('0x60')](-0x1);if(_0x5d493d==='/'){_0x2c551e=_0x2c551e[_0x401d('0x61')](0x0,_0x2c551e[_0x401d('0x62')](_0x5d493d));}_0x81a235=new jsforce['Connection']({'oauth2':{'loginUrl':_0x2c551e,'clientId':_0x5366f2['clientId'],'clientSecret':_0x5366f2['clientSecret']}});return _0x81a235[_0x401d('0x63')](_0x5366f2[_0x401d('0x5d')],_0x5366f2[_0x401d('0x5e')][_0x401d('0x64')](_0x5366f2[_0x401d('0x5f')]));}})['then'](function(_0x119abf){if(_0x119abf){if(!_[_0x401d('0x65')](_0x4e881a[_0x401d('0x33')][_0x401d('0x66')])){_0xb5b917=_0x4e881a[_0x401d('0x33')][_0x401d('0x66')];}return _0x81a235[_0x401d('0x67')](_0xb5b917)[_0x401d('0x68')]();}})['then'](function(_0x1dd1de){var _0x5c7c2e=['OwnerId',_0x401d('0x69'),_0x401d('0x6a'),_0x401d('0x6b'),_0x401d('0x6c'),'Description'];var _0x41f613=[_0x401d('0x6d'),_0x401d('0x6e'),_0x401d('0x6f'),'boolean',_0x401d('0x70'),_0x401d('0x71'),_0x401d('0x72')];if(_0x1dd1de){_['remove'](_0x1dd1de[_0x401d('0x38')],function(_0x5e243a){return _0x5c7c2e['includes'](_0x5e243a[_0x401d('0x2a')])||!_0x41f613[_0x401d('0x73')](_0x5e243a[_0x401d('0x30')]);});return{'count':_0x1dd1de['fields'][_0x401d('0x39')],'rows':_[_0x401d('0x2d')](_0x1dd1de['fields'],function(_0x2463e1){return{'id':_0x2463e1[_0x401d('0x2a')],'name':_0x2463e1[_0x401d('0x74')],'custom':_0x2463e1[_0x401d('0x75')],'options':_0x2463e1[_0x401d('0x76')]['length']>0x0?_[_0x401d('0x2d')](_0x2463e1[_0x401d('0x76')],function(_0x27c64a){return{'name':_0x27c64a[_0x401d('0x74')],'value':_0x27c64a[_0x401d('0x77')]};}):_0x2463e1[_0x401d('0x30')]=='boolean'?[{'name':_0x401d('0x78'),'value':'true'},{'name':'False','value':_0x401d('0x79')}]:[]};})};}})[_0x401d('0x26')](respondWithResult(_0x380029,null))['catch'](function(_0x33b52d){var _0x459f3f=_0x4e881a[_0x401d('0x33')][_0x401d('0x7a')]?0x1f4:_0x33b52d[_0x401d('0x7b')]||0x1f4;logger[_0x401d('0x28')](_0x401d('0x7c'),'getFields',_0x459f3f,JSON[_0x401d('0x7d')](_0x33b52d));delete _0x33b52d[_0x401d('0x2a')];if(_0x459f3f===0x191){_0x459f3f=0x190;}_0x380029['status'](_0x459f3f)[_0x401d('0x2b')](_0x4e881a['query'][_0x401d('0x7a')]?{'message':_0x401d('0x7e'),'statusCode':_0x33b52d['statusCode']}:_0x33b52d);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index ce267bf..9e7fda4 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 _0xd9cc=['exports','define','SalesforceAccount','lodash','util','api','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration'];(function(_0x440c08,_0x502eb1){var _0x2fd835=function(_0xe24c46){while(--_0xe24c46){_0x440c08['push'](_0x440c08['shift']());}};_0x2fd835(++_0x502eb1);}(_0xd9cc,0x66));var _0xcd9c=function(_0x4d1fbd,_0x54ba98){_0x4d1fbd=_0x4d1fbd-0x0;var _0x9220e6=_0xd9cc[_0x4d1fbd];return _0x9220e6;};'use strict';var _=require(_0xcd9c('0x0'));var util=require(_0xcd9c('0x1'));var logger=require('../../config/logger')(_0xcd9c('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xcd9c('0x3'));var fs=require('fs');var path=require(_0xcd9c('0x4'));var rimraf=require(_0xcd9c('0x5'));var config=require(_0xcd9c('0x6'));var attributes=require('./intSalesforceAccount.attributes');var integrations=require(_0xcd9c('0x7'));module[_0xcd9c('0x8')]=function(_0x294833,_0x242d02){return _0x294833[_0xcd9c('0x9')](_0xcd9c('0xa'),attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xacd7=['api','request-promise','path','rimraf','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define','SalesforceAccount','int_salesforce_accounts','util','../../config/logger'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xacd7,0x1a2));var _0x7acd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xacd7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x7acd('0x0'));var logger=require(_0x7acd('0x1'))(_0x7acd('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7acd('0x3'));var fs=require('fs');var path=require(_0x7acd('0x4'));var rimraf=require(_0x7acd('0x5'));var config=require('../../config/environment');var attributes=require(_0x7acd('0x6'));var integrations=require(_0x7acd('0x7'));module[_0x7acd('0x8')]=function(_0x26af83,_0x322352){return _0x26af83[_0x7acd('0x9')](_0x7acd('0xa'),attributes,{'tableName':_0x7acd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index 024cac5..875088d 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 _0x13e6=['stringify','error','code','SalesforceAccount,\x20%s,\x20%s','message','info','result','catch','SalesforceAccount','findAll','options','raw','where','limit','include','map','attributes','model','GetSalesforceAccount','ShowSalesforceAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','then','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s'];(function(_0x3d7fd7,_0x3e260e){var _0x455aa7=function(_0x584f2a){while(--_0x584f2a){_0x3d7fd7['push'](_0x3d7fd7['shift']());}};_0x455aa7(++_0x3e260e);}(_0x13e6,0xce));var _0x613e=function(_0x53af3f,_0x3c7918){_0x53af3f=_0x53af3f-0x0;var _0x2339b2=_0x13e6[_0x53af3f];return _0x2339b2;};'use strict';var _=require(_0x613e('0x0'));var util=require(_0x613e('0x1'));var moment=require(_0x613e('0x2'));var BPromise=require(_0x613e('0x3'));var rs=require(_0x613e('0x4'));var fs=require('fs');var Redis=require(_0x613e('0x5'));var db=require(_0x613e('0x6'))['db'];var utils=require(_0x613e('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x613e('0x8'));var jayson=require(_0x613e('0x9'));var client=jayson['client'][_0x613e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x28effb,_0x20a707,_0x5ec4a9){return new BPromise(function(_0x2edaef,_0x223ac9){return client[_0x613e('0xb')](_0x28effb,_0x5ec4a9)[_0x613e('0xc')](function(_0x244213){logger['info']('SalesforceAccount,\x20%s,\x20%s',_0x20a707,_0x613e('0xd'));logger[_0x613e('0xe')](_0x613e('0xf'),_0x20a707,_0x613e('0xd'),JSON[_0x613e('0x10')](_0x244213));if(_0x244213[_0x613e('0x11')]){if(_0x244213[_0x613e('0x11')][_0x613e('0x12')]===0x1f4){logger[_0x613e('0x11')](_0x613e('0x13'),_0x20a707,_0x244213[_0x613e('0x11')][_0x613e('0x14')]);return _0x223ac9(_0x244213[_0x613e('0x11')][_0x613e('0x14')]);}logger[_0x613e('0x11')](_0x613e('0x13'),_0x20a707,_0x244213[_0x613e('0x11')]['message']);return _0x2edaef(_0x244213[_0x613e('0x11')]['message']);}else{logger[_0x613e('0x15')](_0x613e('0x13'),_0x20a707,'request\x20sent');_0x2edaef(_0x244213[_0x613e('0x16')][_0x613e('0x14')]);}})[_0x613e('0x17')](function(_0x194026){logger[_0x613e('0x11')](_0x613e('0x13'),_0x20a707,_0x194026);_0x223ac9(_0x194026);});});}exports['GetSalesforceAccount']=function(_0x77be25){var _0x3946ee=this;return new Promise(function(_0xd03746,_0x2dff7d){return db[_0x613e('0x18')][_0x613e('0x19')]({'raw':_0x77be25[_0x613e('0x1a')]?_0x77be25['options'][_0x613e('0x1b')]===undefined?!![]:![]:!![],'where':_0x77be25['options']?_0x77be25[_0x613e('0x1a')][_0x613e('0x1c')]||null:null,'attributes':_0x77be25['options']?_0x77be25[_0x613e('0x1a')]['attributes']||null:null,'limit':_0x77be25['options']?_0x77be25[_0x613e('0x1a')][_0x613e('0x1d')]||null:null,'include':_0x77be25['options']?_0x77be25[_0x613e('0x1a')][_0x613e('0x1e')]?_[_0x613e('0x1f')](_0x77be25[_0x613e('0x1a')][_0x613e('0x1e')],function(_0x50c044){return{'model':db[_0x50c044['model']],'as':_0x50c044['as'],'attributes':_0x50c044[_0x613e('0x20')],'include':_0x50c044[_0x613e('0x1e')]?_[_0x613e('0x1f')](_0x50c044[_0x613e('0x1e')],function(_0x3882db){return{'model':db[_0x3882db[_0x613e('0x21')]],'as':_0x3882db['as'],'attributes':_0x3882db[_0x613e('0x20')],'include':_0x3882db[_0x613e('0x1e')]?_['map'](_0x3882db[_0x613e('0x1e')],function(_0x241c7b){return{'model':db[_0x241c7b['model']],'as':_0x241c7b['as'],'attributes':_0x241c7b['attributes']};}):[]};}):[]};}):[]:[]})[_0x613e('0xc')](function(_0x22e26c){logger['info'](_0x613e('0x22'),_0x77be25);logger[_0x613e('0xe')]('GetSalesforceAccount',_0x77be25,JSON['stringify'](_0x22e26c));_0xd03746(_0x22e26c);})[_0x613e('0x17')](function(_0x48d81b){logger[_0x613e('0x11')](_0x613e('0x22'),_0x48d81b[_0x613e('0x14')],_0x77be25);_0x2dff7d(_0x3946ee[_0x613e('0x11')](0x1f4,_0x48d81b[_0x613e('0x14')]));});});};exports[_0x613e('0x23')]=function(_0x1f05bf){var _0x21cbb6=this;return new Promise(function(_0x410518,_0x537382){return db[_0x613e('0x18')][_0x613e('0x24')]({'raw':_0x1f05bf[_0x613e('0x1a')]?_0x1f05bf[_0x613e('0x1a')][_0x613e('0x1b')]===undefined?!![]:![]:!![],'where':_0x1f05bf[_0x613e('0x1a')]?_0x1f05bf[_0x613e('0x1a')]['where']||null:null,'attributes':_0x1f05bf[_0x613e('0x1a')]?_0x1f05bf[_0x613e('0x1a')][_0x613e('0x20')]||null:null,'include':_0x1f05bf[_0x613e('0x1a')]?_0x1f05bf[_0x613e('0x1a')][_0x613e('0x1e')]?_[_0x613e('0x1f')](_0x1f05bf[_0x613e('0x1a')][_0x613e('0x1e')],function(_0x430f38){return{'model':db[_0x430f38[_0x613e('0x21')]],'as':_0x430f38['as'],'attributes':_0x430f38['attributes'],'include':_0x430f38['include']?_[_0x613e('0x1f')](_0x430f38[_0x613e('0x1e')],function(_0x5c7251){return{'model':db[_0x5c7251[_0x613e('0x21')]],'as':_0x5c7251['as'],'attributes':_0x5c7251[_0x613e('0x20')],'include':_0x5c7251[_0x613e('0x1e')]?_[_0x613e('0x1f')](_0x5c7251['include'],function(_0x1c05c3){return{'model':db[_0x1c05c3[_0x613e('0x21')]],'as':_0x1c05c3['as'],'attributes':_0x1c05c3['attributes']};}):[]};}):[]};}):[]:[]})[_0x613e('0xc')](function(_0x48444c){logger['info'](_0x613e('0x23'),_0x1f05bf);logger[_0x613e('0xe')](_0x613e('0x23'),_0x1f05bf,JSON[_0x613e('0x10')](_0x48444c));_0x410518(_0x48444c);})[_0x613e('0x17')](function(_0x2c625d){logger[_0x613e('0x11')](_0x613e('0x23'),_0x2c625d[_0x613e('0x14')],_0x1f05bf);_0x537382(_0x21cbb6[_0x613e('0x11')](0x1f4,_0x2c625d['message']));});});}; \ No newline at end of file +var _0x42a1=['findAll','options','raw','where','map','include','model','attributes','then','ShowSalesforceAccount','find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSalesforceAccount','SalesforceAccount'];(function(_0xf30514,_0x49ab53){var _0x533fc6=function(_0x2dc200){while(--_0x2dc200){_0xf30514['push'](_0xf30514['shift']());}};_0x533fc6(++_0x49ab53);}(_0x42a1,0x123));var _0x142a=function(_0x4b2251,_0x393f10){_0x4b2251=_0x4b2251-0x0;var _0x5d22fb=_0x42a1[_0x4b2251];return _0x5d22fb;};'use strict';var _=require(_0x142a('0x0'));var util=require(_0x142a('0x1'));var moment=require('moment');var BPromise=require(_0x142a('0x2'));var rs=require(_0x142a('0x3'));var fs=require('fs');var Redis=require(_0x142a('0x4'));var db=require(_0x142a('0x5'))['db'];var utils=require(_0x142a('0x6'));var logger=require(_0x142a('0x7'))('rpc');var config=require(_0x142a('0x8'));var jayson=require(_0x142a('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x29a737,_0xde2e95,_0x1e7073){return new BPromise(function(_0x59f8cc,_0x6ec246){return client[_0x142a('0xa')](_0x29a737,_0x1e7073)['then'](function(_0x4abb82){logger[_0x142a('0xb')](_0x142a('0xc'),_0xde2e95,_0x142a('0xd'));logger[_0x142a('0xe')](_0x142a('0xf'),_0xde2e95,_0x142a('0xd'),JSON[_0x142a('0x10')](_0x4abb82));if(_0x4abb82['error']){if(_0x4abb82[_0x142a('0x11')][_0x142a('0x12')]===0x1f4){logger[_0x142a('0x11')](_0x142a('0xc'),_0xde2e95,_0x4abb82[_0x142a('0x11')][_0x142a('0x13')]);return _0x6ec246(_0x4abb82[_0x142a('0x11')][_0x142a('0x13')]);}logger[_0x142a('0x11')](_0x142a('0xc'),_0xde2e95,_0x4abb82[_0x142a('0x11')][_0x142a('0x13')]);return _0x59f8cc(_0x4abb82[_0x142a('0x11')][_0x142a('0x13')]);}else{logger[_0x142a('0xb')](_0x142a('0xc'),_0xde2e95,_0x142a('0xd'));_0x59f8cc(_0x4abb82[_0x142a('0x14')][_0x142a('0x13')]);}})[_0x142a('0x15')](function(_0x20a197){logger[_0x142a('0x11')](_0x142a('0xc'),_0xde2e95,_0x20a197);_0x6ec246(_0x20a197);});});}exports[_0x142a('0x16')]=function(_0x5c229d){var _0x57f6ee=this;return new Promise(function(_0x1cd280,_0x413c67){return db[_0x142a('0x17')][_0x142a('0x18')]({'raw':_0x5c229d[_0x142a('0x19')]?_0x5c229d[_0x142a('0x19')][_0x142a('0x1a')]===undefined?!![]:![]:!![],'where':_0x5c229d[_0x142a('0x19')]?_0x5c229d[_0x142a('0x19')][_0x142a('0x1b')]||null:null,'attributes':_0x5c229d[_0x142a('0x19')]?_0x5c229d[_0x142a('0x19')]['attributes']||null:null,'limit':_0x5c229d[_0x142a('0x19')]?_0x5c229d[_0x142a('0x19')]['limit']||null:null,'include':_0x5c229d[_0x142a('0x19')]?_0x5c229d[_0x142a('0x19')]['include']?_[_0x142a('0x1c')](_0x5c229d[_0x142a('0x19')][_0x142a('0x1d')],function(_0x377553){return{'model':db[_0x377553[_0x142a('0x1e')]],'as':_0x377553['as'],'attributes':_0x377553[_0x142a('0x1f')],'include':_0x377553[_0x142a('0x1d')]?_[_0x142a('0x1c')](_0x377553[_0x142a('0x1d')],function(_0x1c2675){return{'model':db[_0x1c2675[_0x142a('0x1e')]],'as':_0x1c2675['as'],'attributes':_0x1c2675[_0x142a('0x1f')],'include':_0x1c2675[_0x142a('0x1d')]?_['map'](_0x1c2675[_0x142a('0x1d')],function(_0x202136){return{'model':db[_0x202136[_0x142a('0x1e')]],'as':_0x202136['as'],'attributes':_0x202136[_0x142a('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x142a('0x20')](function(_0x3c1c75){logger['info'](_0x142a('0x16'),_0x5c229d);logger[_0x142a('0xe')](_0x142a('0x16'),_0x5c229d,JSON[_0x142a('0x10')](_0x3c1c75));_0x1cd280(_0x3c1c75);})[_0x142a('0x15')](function(_0x28bbd3){logger[_0x142a('0x11')](_0x142a('0x16'),_0x28bbd3['message'],_0x5c229d);_0x413c67(_0x57f6ee[_0x142a('0x11')](0x1f4,_0x28bbd3[_0x142a('0x13')]));});});};exports[_0x142a('0x21')]=function(_0x4608e3){var _0x4d17c4=this;return new Promise(function(_0x4cc3aa,_0x39ff3c){return db[_0x142a('0x17')][_0x142a('0x22')]({'raw':_0x4608e3[_0x142a('0x19')]?_0x4608e3[_0x142a('0x19')][_0x142a('0x1a')]===undefined?!![]:![]:!![],'where':_0x4608e3[_0x142a('0x19')]?_0x4608e3[_0x142a('0x19')][_0x142a('0x1b')]||null:null,'attributes':_0x4608e3[_0x142a('0x19')]?_0x4608e3[_0x142a('0x19')]['attributes']||null:null,'include':_0x4608e3[_0x142a('0x19')]?_0x4608e3['options'][_0x142a('0x1d')]?_[_0x142a('0x1c')](_0x4608e3[_0x142a('0x19')][_0x142a('0x1d')],function(_0x2653c5){return{'model':db[_0x2653c5['model']],'as':_0x2653c5['as'],'attributes':_0x2653c5[_0x142a('0x1f')],'include':_0x2653c5[_0x142a('0x1d')]?_[_0x142a('0x1c')](_0x2653c5[_0x142a('0x1d')],function(_0x2b809a){return{'model':db[_0x2b809a['model']],'as':_0x2b809a['as'],'attributes':_0x2b809a[_0x142a('0x1f')],'include':_0x2b809a[_0x142a('0x1d')]?_['map'](_0x2b809a[_0x142a('0x1d')],function(_0x1d2e9d){return{'model':db[_0x1d2e9d[_0x142a('0x1e')]],'as':_0x1d2e9d['as'],'attributes':_0x1d2e9d['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5c9602){logger['info'](_0x142a('0x21'),_0x4608e3);logger[_0x142a('0xe')](_0x142a('0x21'),_0x4608e3,JSON['stringify'](_0x5c9602));_0x4cc3aa(_0x5c9602);})['catch'](function(_0x37c334){logger[_0x142a('0x11')](_0x142a('0x21'),_0x37c334[_0x142a('0x13')],_0x4608e3);_0x39ff3c(_0x4d17c4['error'](0x1f4,_0x37c334[_0x142a('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 1c6af65..8de6bab 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 _0x2ef3=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intSalesforceConfiguration.controller','get','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','exports','multer','util','path'];(function(_0x5ae869,_0x3872b3){var _0xf9d957=function(_0x24e31a){while(--_0x24e31a){_0x5ae869['push'](_0x5ae869['shift']());}};_0xf9d957(++_0x3872b3);}(_0x2ef3,0xba));var _0x32ef=function(_0x635f76,_0x468cdf){_0x635f76=_0x635f76-0x0;var _0x303d69=_0x2ef3[_0x635f76];return _0x303d69;};'use strict';var multer=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var path=require(_0x32ef('0x2'));var timeout=require(_0x32ef('0x3'));var express=require(_0x32ef('0x4'));var router=express[_0x32ef('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x32ef('0x6'));var interaction=require(_0x32ef('0x7'));var config=require('../../config/environment');var controller=require(_0x32ef('0x8'));router[_0x32ef('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x32ef('0x9')](_0x32ef('0xa'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x9')](_0x32ef('0xd'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xe')]);router[_0x32ef('0x9')](_0x32ef('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x32ef('0x9')](_0x32ef('0x10'),auth[_0x32ef('0xb')](),controller[_0x32ef('0x11')]);router['post']('/',auth[_0x32ef('0xb')](),controller['create']);router[_0x32ef('0x12')]('/:id',auth[_0x32ef('0xb')](),controller[_0x32ef('0x13')]);router['delete']('/:id',auth[_0x32ef('0xb')](),controller['destroy']);module[_0x32ef('0x14')]=router; \ No newline at end of file +var _0x5f2f=['Router','fs-extra','../../components/auth/service','./intSalesforceConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','create','put','update','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x4898c9,_0x5d5850){var _0x3a35a4=function(_0x36d942){while(--_0x36d942){_0x4898c9['push'](_0x4898c9['shift']());}};_0x3a35a4(++_0x5d5850);}(_0x5f2f,0x73));var _0xf5f2=function(_0x35942d,_0x3e95f7){_0x35942d=_0x35942d-0x0;var _0x57c399=_0x5f2f[_0x35942d];return _0x57c399;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var fs_extra=require(_0xf5f2('0x6'));var auth=require(_0xf5f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router[_0xf5f2('0x9')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x9')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x9')](_0xf5f2('0x10'),auth['isAuthenticated'](),controller[_0xf5f2('0x11')]);router['get']('/:id/descriptions',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x12')]);router['post']('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x13')]);router[_0xf5f2('0x14')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x15')]);router['delete'](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x16')]);module[_0xf5f2('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index b9e8b7d..30fe17f 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 _0x854d=['contact_lead','nothing','sequelize','exports','STRING','ENUM','Case','Task','contact','lead','account_contact_lead','account'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0x854d,0x13a));var _0xd854=function(_0x2f2693,_0x115f40){_0x2f2693=_0x2f2693-0x0;var _0x379d90=_0x854d[_0x2f2693];return _0x379d90;};'use strict';var Sequelize=require(_0xd854('0x0'));module[_0xd854('0x1')]={'name':{'type':Sequelize[_0xd854('0x2')]},'description':{'type':Sequelize[_0xd854('0x2')]},'ticketType':{'type':Sequelize[_0xd854('0x3')]('Task',_0xd854('0x4')),'defaultValue':_0xd854('0x5')},'moduleSearch':{'type':Sequelize['ENUM']('contact_lead',_0xd854('0x6'),_0xd854('0x7'),_0xd854('0x8'),_0xd854('0x9')),'defaultValue':_0xd854('0xa')},'moduleCreate':{'type':Sequelize['ENUM'](_0xd854('0xb'),_0xd854('0x6'),_0xd854('0x7'),'account'),'defaultValue':_0xd854('0x7')},'leadId':{'type':Sequelize['STRING']},'additionalSearchAccount':{'type':Sequelize[_0xd854('0x2')]},'additionalSearchContact':{'type':Sequelize['STRING']},'additionalSearchLead':{'type':Sequelize[_0xd854('0x2')]}}; \ No newline at end of file +var _0x01e1=['account','nothing','lead','sequelize','exports','STRING','ENUM','Task','Case','contact_lead','contact','account_contact_lead'];(function(_0x213125,_0xbaf878){var _0x1a7138=function(_0x515bd9){while(--_0x515bd9){_0x213125['push'](_0x213125['shift']());}};_0x1a7138(++_0xbaf878);}(_0x01e1,0xff));var _0x101e=function(_0x167916,_0x3cf704){_0x167916=_0x167916-0x0;var _0x4bb041=_0x01e1[_0x167916];return _0x4bb041;};'use strict';var Sequelize=require(_0x101e('0x0'));module[_0x101e('0x1')]={'name':{'type':Sequelize[_0x101e('0x2')]},'description':{'type':Sequelize[_0x101e('0x2')]},'ticketType':{'type':Sequelize[_0x101e('0x3')](_0x101e('0x4'),_0x101e('0x5')),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize['ENUM'](_0x101e('0x6'),_0x101e('0x7'),'lead',_0x101e('0x8'),_0x101e('0x9')),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize[_0x101e('0x3')](_0x101e('0xa'),_0x101e('0x7'),_0x101e('0xb'),_0x101e('0x9')),'defaultValue':_0x101e('0xb')},'leadId':{'type':Sequelize[_0x101e('0x2')]},'additionalSearchAccount':{'type':Sequelize['STRING']},'additionalSearchContact':{'type':Sequelize[_0x101e('0x2')]},'additionalSearchLead':{'type':Sequelize[_0x101e('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index a7f4dcf..69950bd 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 _0x83b1=['../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','save','then','destroy','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','SalesforceConfiguration','include','rows','catch','show','params','intersection','includeAll','options','create','body','find','getFields','findOne','SalesforceField','nolimit','getSubjects','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x3a6efd,_0x2a5102){var _0x487b9a=function(_0x104f89){while(--_0x104f89){_0x3a6efd['push'](_0x3a6efd['shift']());}};_0x487b9a(++_0x2a5102);}(_0x83b1,0x128));var _0x183b=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x83b1[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require(_0x183b('0x0'));var rimraf=require(_0x183b('0x1'));var zipdir=require(_0x183b('0x2'));var jsonpatch=require(_0x183b('0x3'));var rp=require(_0x183b('0x4'));var moment=require(_0x183b('0x5'));var BPromise=require(_0x183b('0x6'));var Mustache=require(_0x183b('0x7'));var util=require(_0x183b('0x8'));var path=require(_0x183b('0x9'));var sox=require('sox');var csv=require(_0x183b('0xa'));var ejs=require(_0x183b('0xb'));var fs=require('fs');var fs_extra=require(_0x183b('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x183b('0xd'));var deskjs=require(_0x183b('0xe'));var toCsv=require('to-csv');var querystring=require(_0x183b('0xf'));var Papa=require(_0x183b('0x10'));var Redis=require('ioredis');var authService=require(_0x183b('0x11'));var qs=require(_0x183b('0x12'));var as=require(_0x183b('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x183b('0x14'))('api');var utils=require(_0x183b('0x15'));var config=require(_0x183b('0x16'));var licenseUtil=require(_0x183b('0x17'));var db=require(_0x183b('0x18'))['db'];function respondWithStatusCode(_0x32e32c,_0x22d011){_0x22d011=_0x22d011||0xcc;return function(_0x1585ee){if(_0x1585ee){return _0x32e32c[_0x183b('0x19')](_0x22d011);}return _0x32e32c['status'](_0x22d011)[_0x183b('0x1a')]();};}function respondWithResult(_0x1ba54c,_0x10ab2c){_0x10ab2c=_0x10ab2c||0xc8;return function(_0x4b10bd){if(_0x4b10bd){return _0x1ba54c[_0x183b('0x1b')](_0x10ab2c)[_0x183b('0x1c')](_0x4b10bd);}};}function respondWithFilteredResult(_0x51a76d,_0x5f15da){return function(_0x2198ca){if(_0x2198ca){var _0x40216e=typeof _0x5f15da[_0x183b('0x1d')]===_0x183b('0x1e')&&typeof _0x5f15da[_0x183b('0x1f')]==='undefined';var _0x1dc872=_0x2198ca[_0x183b('0x20')];var _0x4c7c6f=_0x40216e?0x0:_0x5f15da[_0x183b('0x1d')];var _0x3ace95=_0x40216e?_0x2198ca[_0x183b('0x20')]:_0x5f15da[_0x183b('0x1d')]+_0x5f15da[_0x183b('0x1f')];var _0x436e18;if(_0x3ace95>=_0x1dc872){_0x3ace95=_0x1dc872;_0x436e18=0xc8;}else{_0x436e18=0xce;}_0x51a76d[_0x183b('0x1b')](_0x436e18);return _0x51a76d['set'](_0x183b('0x21'),_0x4c7c6f+'-'+_0x3ace95+'/'+_0x1dc872)[_0x183b('0x1c')](_0x2198ca);}return null;};}function patchUpdates(_0x47c729){return function(_0x37c251){try{jsonpatch[_0x183b('0x22')](_0x37c251,_0x47c729,!![]);}catch(_0x4263a0){return BPromise['reject'](_0x4263a0);}return _0x37c251[_0x183b('0x23')]();};}function saveUpdates(_0x1614b8,_0x2a3968){return function(_0x5c6d2e){if(_0x5c6d2e){return _0x5c6d2e['update'](_0x1614b8)[_0x183b('0x24')](function(_0x25faf8){return _0x25faf8;});}return null;};}function removeEntity(_0x9acab1,_0x2373ab){return function(_0x165eea){if(_0x165eea){return _0x165eea[_0x183b('0x25')]()[_0x183b('0x24')](function(){_0x9acab1[_0x183b('0x1b')](0xcc)[_0x183b('0x1a')]();});}};}function handleEntityNotFound(_0x177e01,_0x1042de){return function(_0xd8e699){if(!_0xd8e699){_0x177e01['sendStatus'](0x194);}return _0xd8e699;};}function handleError(_0x22f9e1,_0x402b73){_0x402b73=_0x402b73||0x1f4;return function(_0x3f8bd7){logger['error'](_0x3f8bd7[_0x183b('0x26')]);if(_0x3f8bd7[_0x183b('0x27')]){delete _0x3f8bd7[_0x183b('0x27')];}_0x22f9e1[_0x183b('0x1b')](_0x402b73)[_0x183b('0x28')](_0x3f8bd7);};}exports[_0x183b('0x29')]=function(_0x3fdb2f,_0x5b0776){var _0x33da4f={},_0x24cdff={},_0x56e9a4={'count':0x0,'rows':[]};var _0x5abc17=_['map'](db['SalesforceConfiguration'][_0x183b('0x2a')],function(_0x53e9e8){return{'name':_0x53e9e8[_0x183b('0x2b')],'type':_0x53e9e8[_0x183b('0x2c')][_0x183b('0x2d')]};});_0x24cdff[_0x183b('0x2e')]=_[_0x183b('0x2f')](_0x5abc17,_0x183b('0x27'));_0x24cdff[_0x183b('0x30')]=_[_0x183b('0x31')](_0x3fdb2f['query']);_0x24cdff[_0x183b('0x32')]=_['intersection'](_0x24cdff[_0x183b('0x2e')],_0x24cdff[_0x183b('0x30')]);_0x33da4f['attributes']=_['intersection'](_0x24cdff[_0x183b('0x2e')],qs[_0x183b('0x33')](_0x3fdb2f[_0x183b('0x30')][_0x183b('0x33')]));_0x33da4f[_0x183b('0x34')]=_0x33da4f['attributes'][_0x183b('0x35')]?_0x33da4f[_0x183b('0x34')]:_0x24cdff['model'];if(!_0x3fdb2f['query'][_0x183b('0x36')]('nolimit')){_0x33da4f['limit']=qs[_0x183b('0x1f')](_0x3fdb2f[_0x183b('0x30')]['limit']);_0x33da4f[_0x183b('0x1d')]=qs[_0x183b('0x1d')](_0x3fdb2f[_0x183b('0x30')]['offset']);}_0x33da4f[_0x183b('0x37')]=qs['sort'](_0x3fdb2f['query'][_0x183b('0x38')]);_0x33da4f[_0x183b('0x39')]=qs[_0x183b('0x32')](_[_0x183b('0x3a')](_0x3fdb2f[_0x183b('0x30')],_0x24cdff[_0x183b('0x32')]),_0x5abc17);if(_0x3fdb2f[_0x183b('0x30')][_0x183b('0x3b')]){_0x33da4f[_0x183b('0x39')]=_[_0x183b('0x3c')](_0x33da4f[_0x183b('0x39')],{'$or':_[_0x183b('0x2f')](_0x5abc17,function(_0xdaa087){if(_0xdaa087[_0x183b('0x2c')]!==_0x183b('0x3d')){var _0x363d79={};_0x363d79[_0xdaa087[_0x183b('0x27')]]={'$like':'%'+_0x3fdb2f[_0x183b('0x30')][_0x183b('0x3b')]+'%'};return _0x363d79;}})});}_0x33da4f=_[_0x183b('0x3c')]({},_0x33da4f,_0x3fdb2f['options']);var _0x25ae2a={'where':_0x33da4f[_0x183b('0x39')]};return db[_0x183b('0x3e')][_0x183b('0x20')](_0x25ae2a)[_0x183b('0x24')](function(_0x2d0f68){_0x56e9a4['count']=_0x2d0f68;if(_0x3fdb2f['query']['includeAll']){_0x33da4f[_0x183b('0x3f')]=[{'all':!![]}];}return db[_0x183b('0x3e')]['findAll'](_0x33da4f);})[_0x183b('0x24')](function(_0x37fac8){_0x56e9a4[_0x183b('0x40')]=_0x37fac8;return _0x56e9a4;})[_0x183b('0x24')](respondWithFilteredResult(_0x5b0776,_0x33da4f))[_0x183b('0x41')](handleError(_0x5b0776,null));};exports[_0x183b('0x42')]=function(_0x9dd656,_0x15118c){var _0xfcf83d={'raw':![],'where':{'id':_0x9dd656[_0x183b('0x43')]['id']}},_0x4358c1={};_0x4358c1[_0x183b('0x2e')]=_[_0x183b('0x31')](db[_0x183b('0x3e')][_0x183b('0x2a')]);_0x4358c1[_0x183b('0x30')]=_[_0x183b('0x31')](_0x9dd656[_0x183b('0x30')]);_0x4358c1[_0x183b('0x32')]=_[_0x183b('0x44')](_0x4358c1[_0x183b('0x2e')],_0x4358c1[_0x183b('0x30')]);_0xfcf83d[_0x183b('0x34')]=_[_0x183b('0x44')](_0x4358c1[_0x183b('0x2e')],qs[_0x183b('0x33')](_0x9dd656[_0x183b('0x30')]['fields']));_0xfcf83d[_0x183b('0x34')]=_0xfcf83d[_0x183b('0x34')][_0x183b('0x35')]?_0xfcf83d['attributes']:_0x4358c1[_0x183b('0x2e')];if(_0x9dd656[_0x183b('0x30')][_0x183b('0x45')]){_0xfcf83d[_0x183b('0x3f')]=[{'all':!![]}];}_0xfcf83d=_[_0x183b('0x3c')]({},_0xfcf83d,_0x9dd656[_0x183b('0x46')]);return db[_0x183b('0x3e')]['find'](_0xfcf83d)[_0x183b('0x24')](handleEntityNotFound(_0x15118c,null))[_0x183b('0x24')](respondWithResult(_0x15118c,null))['catch'](handleError(_0x15118c,null));};exports[_0x183b('0x47')]=function(_0xcbd5bb,_0x2f5037){return db[_0x183b('0x3e')][_0x183b('0x47')](_0xcbd5bb[_0x183b('0x48')],{})[_0x183b('0x24')](respondWithResult(_0x2f5037,0xc9))[_0x183b('0x41')](handleError(_0x2f5037,null));};exports['update']=function(_0x4ce103,_0x139fd7){if(_0x4ce103[_0x183b('0x48')]['id']){delete _0x4ce103[_0x183b('0x48')]['id'];}return db[_0x183b('0x3e')][_0x183b('0x49')]({'where':{'id':_0x4ce103[_0x183b('0x43')]['id']}})[_0x183b('0x24')](handleEntityNotFound(_0x139fd7,null))['then'](saveUpdates(_0x4ce103[_0x183b('0x48')],null))[_0x183b('0x24')](respondWithResult(_0x139fd7,null))[_0x183b('0x41')](handleError(_0x139fd7,null));};exports[_0x183b('0x25')]=function(_0x2a4406,_0x24e505){return db[_0x183b('0x3e')][_0x183b('0x49')]({'where':{'id':_0x2a4406[_0x183b('0x43')]['id']}})[_0x183b('0x24')](handleEntityNotFound(_0x24e505,null))[_0x183b('0x24')](removeEntity(_0x24e505,null))['catch'](handleError(_0x24e505,null));};exports[_0x183b('0x4a')]=function(_0x2f2afb,_0x9c1fc1,_0x92073a){var _0x173455={};var _0x2ab18e={};var _0x3575a1;var _0x1097b7;return db['SalesforceConfiguration'][_0x183b('0x4b')]({'where':{'id':_0x2f2afb[_0x183b('0x43')]['id']}})[_0x183b('0x24')](handleEntityNotFound(_0x9c1fc1,null))[_0x183b('0x24')](function(_0x55694d){if(_0x55694d){_0x3575a1=_0x55694d;_0x2ab18e['model']=_[_0x183b('0x31')](db[_0x183b('0x4c')]['rawAttributes']);_0x2ab18e[_0x183b('0x30')]=_[_0x183b('0x31')](_0x2f2afb['query']);_0x2ab18e[_0x183b('0x32')]=_['intersection'](_0x2ab18e['model'],_0x2ab18e['query']);_0x173455[_0x183b('0x34')]=_[_0x183b('0x44')](_0x2ab18e[_0x183b('0x2e')],qs['fields'](_0x2f2afb['query'][_0x183b('0x33')]));_0x173455['attributes']=_0x173455[_0x183b('0x34')][_0x183b('0x35')]?_0x173455['attributes']:_0x2ab18e[_0x183b('0x2e')];_0x173455[_0x183b('0x37')]=qs[_0x183b('0x38')](_0x2f2afb['query']['sort']);_0x173455[_0x183b('0x39')]=qs[_0x183b('0x32')](_[_0x183b('0x3a')](_0x2f2afb[_0x183b('0x30')],_0x2ab18e[_0x183b('0x32')]));if(_0x2f2afb['query'][_0x183b('0x3b')]){_0x173455['where']=_[_0x183b('0x3c')](_0x173455[_0x183b('0x39')],{'$or':_[_0x183b('0x2f')](_0x173455[_0x183b('0x34')],function(_0x3c1851){var _0x21e097={};_0x21e097[_0x3c1851]={'$like':'%'+_0x2f2afb[_0x183b('0x30')][_0x183b('0x3b')]+'%'};return _0x21e097;})});}_0x173455=_[_0x183b('0x3c')]({},_0x173455,_0x2f2afb['options']);return _0x3575a1[_0x183b('0x4a')](_0x173455);}})[_0x183b('0x24')](function(_0x2139ec){if(_0x2139ec){_0x1097b7=_0x2139ec[_0x183b('0x35')];if(!_0x2f2afb[_0x183b('0x30')][_0x183b('0x36')](_0x183b('0x4d'))){_0x173455[_0x183b('0x1f')]=qs['limit'](_0x2f2afb[_0x183b('0x30')][_0x183b('0x1f')]);_0x173455[_0x183b('0x1d')]=qs[_0x183b('0x1d')](_0x2f2afb['query'][_0x183b('0x1d')]);}return _0x3575a1['getFields'](_0x173455);}})[_0x183b('0x24')](function(_0x223345){if(_0x223345){return _0x223345?{'count':_0x1097b7,'rows':_0x223345}:null;}})[_0x183b('0x24')](respondWithResult(_0x9c1fc1,null))[_0x183b('0x41')](handleError(_0x9c1fc1,null));};exports[_0x183b('0x4e')]=function(_0x50494f,_0x5365f2,_0x24ead4){var _0x39a629={};var _0x9d4d08={};var _0x28d840;var _0x95fcc7;return db['SalesforceConfiguration'][_0x183b('0x4b')]({'where':{'id':_0x50494f[_0x183b('0x43')]['id']}})[_0x183b('0x24')](handleEntityNotFound(_0x5365f2,null))[_0x183b('0x24')](function(_0x227958){if(_0x227958){_0x28d840=_0x227958;_0x9d4d08[_0x183b('0x2e')]=_[_0x183b('0x31')](db[_0x183b('0x4c')][_0x183b('0x2a')]);_0x9d4d08[_0x183b('0x30')]=_[_0x183b('0x31')](_0x50494f[_0x183b('0x30')]);_0x9d4d08['filters']=_[_0x183b('0x44')](_0x9d4d08[_0x183b('0x2e')],_0x9d4d08[_0x183b('0x30')]);_0x39a629[_0x183b('0x34')]=_['intersection'](_0x9d4d08[_0x183b('0x2e')],qs['fields'](_0x50494f[_0x183b('0x30')][_0x183b('0x33')]));_0x39a629[_0x183b('0x34')]=_0x39a629[_0x183b('0x34')][_0x183b('0x35')]?_0x39a629[_0x183b('0x34')]:_0x9d4d08[_0x183b('0x2e')];_0x39a629[_0x183b('0x37')]=qs['sort'](_0x50494f['query'][_0x183b('0x38')]);_0x39a629[_0x183b('0x39')]=qs[_0x183b('0x32')](_[_0x183b('0x3a')](_0x50494f['query'],_0x9d4d08[_0x183b('0x32')]));if(_0x50494f['query']['filter']){_0x39a629[_0x183b('0x39')]=_[_0x183b('0x3c')](_0x39a629[_0x183b('0x39')],{'$or':_[_0x183b('0x2f')](_0x39a629[_0x183b('0x34')],function(_0x23f33a){var _0x1b0418={};_0x1b0418[_0x23f33a]={'$like':'%'+_0x50494f[_0x183b('0x30')][_0x183b('0x3b')]+'%'};return _0x1b0418;})});}_0x39a629=_['merge']({},_0x39a629,_0x50494f[_0x183b('0x46')]);return _0x28d840[_0x183b('0x4e')](_0x39a629);}})[_0x183b('0x24')](function(_0x11d4aa){if(_0x11d4aa){_0x95fcc7=_0x11d4aa['length'];if(!_0x50494f[_0x183b('0x30')][_0x183b('0x36')](_0x183b('0x4d'))){_0x39a629['limit']=qs[_0x183b('0x1f')](_0x50494f[_0x183b('0x30')]['limit']);_0x39a629[_0x183b('0x1d')]=qs['offset'](_0x50494f[_0x183b('0x30')][_0x183b('0x1d')]);}return _0x28d840['getSubjects'](_0x39a629);}})[_0x183b('0x24')](function(_0x54ec7c){if(_0x54ec7c){return _0x54ec7c?{'count':_0x95fcc7,'rows':_0x54ec7c}:null;}})['then'](respondWithResult(_0x5365f2,null))[_0x183b('0x41')](handleError(_0x5365f2,null));};exports['getDescriptions']=function(_0x363b09,_0x4cbfd0,_0x202cf3){var _0x1c6978={};var _0x5ea245={};var _0x27afbb;var _0xf4518c;return db[_0x183b('0x3e')][_0x183b('0x4b')]({'where':{'id':_0x363b09[_0x183b('0x43')]['id']}})['then'](handleEntityNotFound(_0x4cbfd0,null))[_0x183b('0x24')](function(_0x3159b9){if(_0x3159b9){_0x27afbb=_0x3159b9;_0x5ea245[_0x183b('0x2e')]=_[_0x183b('0x31')](db[_0x183b('0x4c')][_0x183b('0x2a')]);_0x5ea245[_0x183b('0x30')]=_[_0x183b('0x31')](_0x363b09[_0x183b('0x30')]);_0x5ea245[_0x183b('0x32')]=_[_0x183b('0x44')](_0x5ea245[_0x183b('0x2e')],_0x5ea245[_0x183b('0x30')]);_0x1c6978['attributes']=_[_0x183b('0x44')](_0x5ea245[_0x183b('0x2e')],qs[_0x183b('0x33')](_0x363b09[_0x183b('0x30')][_0x183b('0x33')]));_0x1c6978[_0x183b('0x34')]=_0x1c6978[_0x183b('0x34')][_0x183b('0x35')]?_0x1c6978[_0x183b('0x34')]:_0x5ea245['model'];_0x1c6978['order']=qs[_0x183b('0x38')](_0x363b09[_0x183b('0x30')][_0x183b('0x38')]);_0x1c6978[_0x183b('0x39')]=qs[_0x183b('0x32')](_['pick'](_0x363b09['query'],_0x5ea245[_0x183b('0x32')]));if(_0x363b09[_0x183b('0x30')][_0x183b('0x3b')]){_0x1c6978[_0x183b('0x39')]=_[_0x183b('0x3c')](_0x1c6978[_0x183b('0x39')],{'$or':_[_0x183b('0x2f')](_0x1c6978[_0x183b('0x34')],function(_0x114ebd){var _0x167211={};_0x167211[_0x114ebd]={'$like':'%'+_0x363b09[_0x183b('0x30')][_0x183b('0x3b')]+'%'};return _0x167211;})});}_0x1c6978=_[_0x183b('0x3c')]({},_0x1c6978,_0x363b09[_0x183b('0x46')]);return _0x27afbb['getDescriptions'](_0x1c6978);}})[_0x183b('0x24')](function(_0x1ea60c){if(_0x1ea60c){_0xf4518c=_0x1ea60c[_0x183b('0x35')];if(!_0x363b09['query'][_0x183b('0x36')]('nolimit')){_0x1c6978['limit']=qs[_0x183b('0x1f')](_0x363b09[_0x183b('0x30')][_0x183b('0x1f')]);_0x1c6978[_0x183b('0x1d')]=qs[_0x183b('0x1d')](_0x363b09[_0x183b('0x30')]['offset']);}return _0x27afbb['getDescriptions'](_0x1c6978);}})[_0x183b('0x24')](function(_0x23022b){if(_0x23022b){return _0x23022b?{'count':_0xf4518c,'rows':_0x23022b}:null;}})[_0x183b('0x24')](respondWithResult(_0x4cbfd0,null))[_0x183b('0x41')](handleError(_0x4cbfd0,null));}; \ No newline at end of file +var _0xda62=['limit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','getFields','findOne','SalesforceField','getSubjects','getDescriptions','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/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','set','apply','reject','save','update','then','error','stack','name','send','index','map','SalesforceConfiguration','rawAttributes','fieldName','key','keys','query','model','attributes','intersection','fields','length','hasOwnProperty','nolimit'];(function(_0x2825e8,_0x4b49ba){var _0x2ce74c=function(_0x4cb19c){while(--_0x4cb19c){_0x2825e8['push'](_0x2825e8['shift']());}};_0x2ce74c(++_0x4b49ba);}(_0xda62,0x1ba));var _0x2da6=function(_0x2ea2b9,_0x3f74cd){_0x2ea2b9=_0x2ea2b9-0x0;var _0x5db84c=_0xda62[_0x2ea2b9];return _0x5db84c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2da6('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2da6('0x1'));var moment=require(_0x2da6('0x2'));var BPromise=require(_0x2da6('0x3'));var Mustache=require(_0x2da6('0x4'));var util=require(_0x2da6('0x5'));var path=require(_0x2da6('0x6'));var sox=require(_0x2da6('0x7'));var csv=require(_0x2da6('0x8'));var ejs=require(_0x2da6('0x9'));var fs=require('fs');var fs_extra=require(_0x2da6('0xa'));var _=require(_0x2da6('0xb'));var squel=require(_0x2da6('0xc'));var crypto=require(_0x2da6('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x2da6('0xe'));var toCsv=require(_0x2da6('0x8'));var querystring=require(_0x2da6('0xf'));var Papa=require(_0x2da6('0x10'));var Redis=require(_0x2da6('0x11'));var authService=require(_0x2da6('0x12'));var qs=require(_0x2da6('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2da6('0x14'));var logger=require(_0x2da6('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x2da6('0x16'));var licenseUtil=require(_0x2da6('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4216c4,_0x2b4f92){_0x2b4f92=_0x2b4f92||0xcc;return function(_0x2dab72){if(_0x2dab72){return _0x4216c4[_0x2da6('0x18')](_0x2b4f92);}return _0x4216c4[_0x2da6('0x19')](_0x2b4f92)[_0x2da6('0x1a')]();};}function respondWithResult(_0x300b47,_0x1f4f6f){_0x1f4f6f=_0x1f4f6f||0xc8;return function(_0x3f9d2c){if(_0x3f9d2c){return _0x300b47[_0x2da6('0x19')](_0x1f4f6f)[_0x2da6('0x1b')](_0x3f9d2c);}};}function respondWithFilteredResult(_0x9be519,_0x2fc4d8){return function(_0x44f312){if(_0x44f312){var _0x3af51a=typeof _0x2fc4d8[_0x2da6('0x1c')]===_0x2da6('0x1d')&&typeof _0x2fc4d8['limit']===_0x2da6('0x1d');var _0x419deb=_0x44f312['count'];var _0x3029e7=_0x3af51a?0x0:_0x2fc4d8['offset'];var _0x3f954d=_0x3af51a?_0x44f312[_0x2da6('0x1e')]:_0x2fc4d8[_0x2da6('0x1c')]+_0x2fc4d8['limit'];var _0x4d1d72;if(_0x3f954d>=_0x419deb){_0x3f954d=_0x419deb;_0x4d1d72=0xc8;}else{_0x4d1d72=0xce;}_0x9be519[_0x2da6('0x19')](_0x4d1d72);return _0x9be519[_0x2da6('0x1f')]('Content-Range',_0x3029e7+'-'+_0x3f954d+'/'+_0x419deb)[_0x2da6('0x1b')](_0x44f312);}return null;};}function patchUpdates(_0x5a82b1){return function(_0x308272){try{jsonpatch[_0x2da6('0x20')](_0x308272,_0x5a82b1,!![]);}catch(_0x20b6e3){return BPromise[_0x2da6('0x21')](_0x20b6e3);}return _0x308272[_0x2da6('0x22')]();};}function saveUpdates(_0x4ac0db,_0x369d62){return function(_0x459336){if(_0x459336){return _0x459336[_0x2da6('0x23')](_0x4ac0db)[_0x2da6('0x24')](function(_0x3c3f67){return _0x3c3f67;});}return null;};}function removeEntity(_0x4efb68,_0x57326f){return function(_0x224cdc){if(_0x224cdc){return _0x224cdc['destroy']()[_0x2da6('0x24')](function(){_0x4efb68[_0x2da6('0x19')](0xcc)[_0x2da6('0x1a')]();});}};}function handleEntityNotFound(_0x1678b9,_0x181b29){return function(_0x2ee43b){if(!_0x2ee43b){_0x1678b9[_0x2da6('0x18')](0x194);}return _0x2ee43b;};}function handleError(_0x5e4b45,_0x13476f){_0x13476f=_0x13476f||0x1f4;return function(_0x6b2602){logger[_0x2da6('0x25')](_0x6b2602[_0x2da6('0x26')]);if(_0x6b2602['name']){delete _0x6b2602[_0x2da6('0x27')];}_0x5e4b45[_0x2da6('0x19')](_0x13476f)[_0x2da6('0x28')](_0x6b2602);};}exports[_0x2da6('0x29')]=function(_0x1f14ad,_0x30131e){var _0x518522={},_0x2ade1e={},_0x4e6a54={'count':0x0,'rows':[]};var _0x18e580=_[_0x2da6('0x2a')](db[_0x2da6('0x2b')][_0x2da6('0x2c')],function(_0x1cf7d7){return{'name':_0x1cf7d7[_0x2da6('0x2d')],'type':_0x1cf7d7['type'][_0x2da6('0x2e')]};});_0x2ade1e['model']=_[_0x2da6('0x2a')](_0x18e580,_0x2da6('0x27'));_0x2ade1e['query']=_[_0x2da6('0x2f')](_0x1f14ad[_0x2da6('0x30')]);_0x2ade1e['filters']=_['intersection'](_0x2ade1e[_0x2da6('0x31')],_0x2ade1e[_0x2da6('0x30')]);_0x518522[_0x2da6('0x32')]=_[_0x2da6('0x33')](_0x2ade1e[_0x2da6('0x31')],qs['fields'](_0x1f14ad['query'][_0x2da6('0x34')]));_0x518522[_0x2da6('0x32')]=_0x518522['attributes'][_0x2da6('0x35')]?_0x518522[_0x2da6('0x32')]:_0x2ade1e['model'];if(!_0x1f14ad[_0x2da6('0x30')][_0x2da6('0x36')](_0x2da6('0x37'))){_0x518522[_0x2da6('0x38')]=qs[_0x2da6('0x38')](_0x1f14ad[_0x2da6('0x30')][_0x2da6('0x38')]);_0x518522[_0x2da6('0x1c')]=qs[_0x2da6('0x1c')](_0x1f14ad[_0x2da6('0x30')]['offset']);}_0x518522[_0x2da6('0x39')]=qs[_0x2da6('0x3a')](_0x1f14ad[_0x2da6('0x30')][_0x2da6('0x3a')]);_0x518522[_0x2da6('0x3b')]=qs[_0x2da6('0x3c')](_[_0x2da6('0x3d')](_0x1f14ad[_0x2da6('0x30')],_0x2ade1e[_0x2da6('0x3c')]),_0x18e580);if(_0x1f14ad['query'][_0x2da6('0x3e')]){_0x518522[_0x2da6('0x3b')]=_[_0x2da6('0x3f')](_0x518522[_0x2da6('0x3b')],{'$or':_['map'](_0x18e580,function(_0x513a08){if(_0x513a08[_0x2da6('0x40')]!==_0x2da6('0x41')){var _0x485b65={};_0x485b65[_0x513a08[_0x2da6('0x27')]]={'$like':'%'+_0x1f14ad['query']['filter']+'%'};return _0x485b65;}})});}_0x518522=_[_0x2da6('0x3f')]({},_0x518522,_0x1f14ad[_0x2da6('0x42')]);var _0x568117={'where':_0x518522[_0x2da6('0x3b')]};return db['SalesforceConfiguration'][_0x2da6('0x1e')](_0x568117)[_0x2da6('0x24')](function(_0x2877cd){_0x4e6a54[_0x2da6('0x1e')]=_0x2877cd;if(_0x1f14ad[_0x2da6('0x30')][_0x2da6('0x43')]){_0x518522[_0x2da6('0x44')]=[{'all':!![]}];}return db[_0x2da6('0x2b')][_0x2da6('0x45')](_0x518522);})[_0x2da6('0x24')](function(_0x513ccc){_0x4e6a54[_0x2da6('0x46')]=_0x513ccc;return _0x4e6a54;})[_0x2da6('0x24')](respondWithFilteredResult(_0x30131e,_0x518522))[_0x2da6('0x47')](handleError(_0x30131e,null));};exports[_0x2da6('0x48')]=function(_0x19081a,_0x2235c6){var _0x41681b={'raw':![],'where':{'id':_0x19081a[_0x2da6('0x49')]['id']}},_0x44e83b={};_0x44e83b[_0x2da6('0x31')]=_[_0x2da6('0x2f')](db[_0x2da6('0x2b')][_0x2da6('0x2c')]);_0x44e83b[_0x2da6('0x30')]=_['keys'](_0x19081a['query']);_0x44e83b['filters']=_['intersection'](_0x44e83b[_0x2da6('0x31')],_0x44e83b[_0x2da6('0x30')]);_0x41681b[_0x2da6('0x32')]=_['intersection'](_0x44e83b['model'],qs['fields'](_0x19081a['query'][_0x2da6('0x34')]));_0x41681b[_0x2da6('0x32')]=_0x41681b['attributes']['length']?_0x41681b[_0x2da6('0x32')]:_0x44e83b['model'];if(_0x19081a[_0x2da6('0x30')][_0x2da6('0x43')]){_0x41681b[_0x2da6('0x44')]=[{'all':!![]}];}_0x41681b=_['merge']({},_0x41681b,_0x19081a[_0x2da6('0x42')]);return db[_0x2da6('0x2b')][_0x2da6('0x4a')](_0x41681b)[_0x2da6('0x24')](handleEntityNotFound(_0x2235c6,null))[_0x2da6('0x24')](respondWithResult(_0x2235c6,null))[_0x2da6('0x47')](handleError(_0x2235c6,null));};exports[_0x2da6('0x4b')]=function(_0x4ebe0d,_0x2e6193){return db[_0x2da6('0x2b')][_0x2da6('0x4b')](_0x4ebe0d['body'],{})[_0x2da6('0x24')](respondWithResult(_0x2e6193,0xc9))[_0x2da6('0x47')](handleError(_0x2e6193,null));};exports[_0x2da6('0x23')]=function(_0x124398,_0x2e475f){if(_0x124398['body']['id']){delete _0x124398['body']['id'];}return db[_0x2da6('0x2b')][_0x2da6('0x4a')]({'where':{'id':_0x124398[_0x2da6('0x49')]['id']}})[_0x2da6('0x24')](handleEntityNotFound(_0x2e475f,null))[_0x2da6('0x24')](saveUpdates(_0x124398[_0x2da6('0x4c')],null))[_0x2da6('0x24')](respondWithResult(_0x2e475f,null))['catch'](handleError(_0x2e475f,null));};exports[_0x2da6('0x4d')]=function(_0x50ca13,_0x2c0a8b){return db[_0x2da6('0x2b')][_0x2da6('0x4a')]({'where':{'id':_0x50ca13['params']['id']}})['then'](handleEntityNotFound(_0x2c0a8b,null))[_0x2da6('0x24')](removeEntity(_0x2c0a8b,null))[_0x2da6('0x47')](handleError(_0x2c0a8b,null));};exports[_0x2da6('0x4e')]=function(_0x39302e,_0x5e93c2,_0xcbe236){var _0x132d2c={};var _0x527d91={};var _0x4906d5;var _0xa87ce2;return db[_0x2da6('0x2b')][_0x2da6('0x4f')]({'where':{'id':_0x39302e[_0x2da6('0x49')]['id']}})[_0x2da6('0x24')](handleEntityNotFound(_0x5e93c2,null))[_0x2da6('0x24')](function(_0x2c59e1){if(_0x2c59e1){_0x4906d5=_0x2c59e1;_0x527d91[_0x2da6('0x31')]=_[_0x2da6('0x2f')](db[_0x2da6('0x50')][_0x2da6('0x2c')]);_0x527d91[_0x2da6('0x30')]=_[_0x2da6('0x2f')](_0x39302e[_0x2da6('0x30')]);_0x527d91['filters']=_['intersection'](_0x527d91[_0x2da6('0x31')],_0x527d91['query']);_0x132d2c['attributes']=_['intersection'](_0x527d91[_0x2da6('0x31')],qs['fields'](_0x39302e[_0x2da6('0x30')][_0x2da6('0x34')]));_0x132d2c[_0x2da6('0x32')]=_0x132d2c[_0x2da6('0x32')]['length']?_0x132d2c[_0x2da6('0x32')]:_0x527d91[_0x2da6('0x31')];_0x132d2c[_0x2da6('0x39')]=qs[_0x2da6('0x3a')](_0x39302e['query']['sort']);_0x132d2c[_0x2da6('0x3b')]=qs[_0x2da6('0x3c')](_[_0x2da6('0x3d')](_0x39302e[_0x2da6('0x30')],_0x527d91[_0x2da6('0x3c')]));if(_0x39302e[_0x2da6('0x30')][_0x2da6('0x3e')]){_0x132d2c[_0x2da6('0x3b')]=_[_0x2da6('0x3f')](_0x132d2c[_0x2da6('0x3b')],{'$or':_[_0x2da6('0x2a')](_0x132d2c[_0x2da6('0x32')],function(_0x6739c0){var _0x5fed52={};_0x5fed52[_0x6739c0]={'$like':'%'+_0x39302e['query'][_0x2da6('0x3e')]+'%'};return _0x5fed52;})});}_0x132d2c=_['merge']({},_0x132d2c,_0x39302e[_0x2da6('0x42')]);return _0x4906d5['getFields'](_0x132d2c);}})[_0x2da6('0x24')](function(_0x40435d){if(_0x40435d){_0xa87ce2=_0x40435d[_0x2da6('0x35')];if(!_0x39302e['query'][_0x2da6('0x36')]('nolimit')){_0x132d2c['limit']=qs[_0x2da6('0x38')](_0x39302e['query'][_0x2da6('0x38')]);_0x132d2c[_0x2da6('0x1c')]=qs[_0x2da6('0x1c')](_0x39302e[_0x2da6('0x30')]['offset']);}return _0x4906d5[_0x2da6('0x4e')](_0x132d2c);}})['then'](function(_0x4651c0){if(_0x4651c0){return _0x4651c0?{'count':_0xa87ce2,'rows':_0x4651c0}:null;}})[_0x2da6('0x24')](respondWithResult(_0x5e93c2,null))[_0x2da6('0x47')](handleError(_0x5e93c2,null));};exports[_0x2da6('0x51')]=function(_0xb2ce3b,_0x1f2a4f,_0x13f08e){var _0x31db82={};var _0x17d7a5={};var _0x597035;var _0x5eb1d9;return db[_0x2da6('0x2b')][_0x2da6('0x4f')]({'where':{'id':_0xb2ce3b[_0x2da6('0x49')]['id']}})[_0x2da6('0x24')](handleEntityNotFound(_0x1f2a4f,null))[_0x2da6('0x24')](function(_0x5e0340){if(_0x5e0340){_0x597035=_0x5e0340;_0x17d7a5[_0x2da6('0x31')]=_[_0x2da6('0x2f')](db[_0x2da6('0x50')]['rawAttributes']);_0x17d7a5[_0x2da6('0x30')]=_['keys'](_0xb2ce3b['query']);_0x17d7a5[_0x2da6('0x3c')]=_[_0x2da6('0x33')](_0x17d7a5[_0x2da6('0x31')],_0x17d7a5[_0x2da6('0x30')]);_0x31db82[_0x2da6('0x32')]=_['intersection'](_0x17d7a5[_0x2da6('0x31')],qs['fields'](_0xb2ce3b['query'][_0x2da6('0x34')]));_0x31db82[_0x2da6('0x32')]=_0x31db82[_0x2da6('0x32')][_0x2da6('0x35')]?_0x31db82[_0x2da6('0x32')]:_0x17d7a5[_0x2da6('0x31')];_0x31db82['order']=qs[_0x2da6('0x3a')](_0xb2ce3b[_0x2da6('0x30')]['sort']);_0x31db82['where']=qs[_0x2da6('0x3c')](_['pick'](_0xb2ce3b['query'],_0x17d7a5[_0x2da6('0x3c')]));if(_0xb2ce3b['query'][_0x2da6('0x3e')]){_0x31db82[_0x2da6('0x3b')]=_[_0x2da6('0x3f')](_0x31db82[_0x2da6('0x3b')],{'$or':_[_0x2da6('0x2a')](_0x31db82[_0x2da6('0x32')],function(_0x2969b2){var _0x2ec726={};_0x2ec726[_0x2969b2]={'$like':'%'+_0xb2ce3b[_0x2da6('0x30')][_0x2da6('0x3e')]+'%'};return _0x2ec726;})});}_0x31db82=_[_0x2da6('0x3f')]({},_0x31db82,_0xb2ce3b[_0x2da6('0x42')]);return _0x597035['getSubjects'](_0x31db82);}})['then'](function(_0x132077){if(_0x132077){_0x5eb1d9=_0x132077['length'];if(!_0xb2ce3b[_0x2da6('0x30')][_0x2da6('0x36')](_0x2da6('0x37'))){_0x31db82['limit']=qs[_0x2da6('0x38')](_0xb2ce3b[_0x2da6('0x30')]['limit']);_0x31db82[_0x2da6('0x1c')]=qs['offset'](_0xb2ce3b['query'][_0x2da6('0x1c')]);}return _0x597035['getSubjects'](_0x31db82);}})[_0x2da6('0x24')](function(_0x5c3b6b){if(_0x5c3b6b){return _0x5c3b6b?{'count':_0x5eb1d9,'rows':_0x5c3b6b}:null;}})[_0x2da6('0x24')](respondWithResult(_0x1f2a4f,null))[_0x2da6('0x47')](handleError(_0x1f2a4f,null));};exports[_0x2da6('0x52')]=function(_0xb3b11a,_0x525358,_0x5c19ae){var _0xe23ff8={};var _0x9d0ec3={};var _0xcfa5e6;var _0x37dfa2;return db[_0x2da6('0x2b')][_0x2da6('0x4f')]({'where':{'id':_0xb3b11a[_0x2da6('0x49')]['id']}})['then'](handleEntityNotFound(_0x525358,null))[_0x2da6('0x24')](function(_0x5830a8){if(_0x5830a8){_0xcfa5e6=_0x5830a8;_0x9d0ec3['model']=_[_0x2da6('0x2f')](db[_0x2da6('0x50')][_0x2da6('0x2c')]);_0x9d0ec3[_0x2da6('0x30')]=_[_0x2da6('0x2f')](_0xb3b11a[_0x2da6('0x30')]);_0x9d0ec3['filters']=_[_0x2da6('0x33')](_0x9d0ec3['model'],_0x9d0ec3['query']);_0xe23ff8[_0x2da6('0x32')]=_[_0x2da6('0x33')](_0x9d0ec3[_0x2da6('0x31')],qs[_0x2da6('0x34')](_0xb3b11a[_0x2da6('0x30')][_0x2da6('0x34')]));_0xe23ff8[_0x2da6('0x32')]=_0xe23ff8[_0x2da6('0x32')][_0x2da6('0x35')]?_0xe23ff8[_0x2da6('0x32')]:_0x9d0ec3[_0x2da6('0x31')];_0xe23ff8['order']=qs[_0x2da6('0x3a')](_0xb3b11a[_0x2da6('0x30')]['sort']);_0xe23ff8[_0x2da6('0x3b')]=qs[_0x2da6('0x3c')](_[_0x2da6('0x3d')](_0xb3b11a['query'],_0x9d0ec3[_0x2da6('0x3c')]));if(_0xb3b11a[_0x2da6('0x30')][_0x2da6('0x3e')]){_0xe23ff8[_0x2da6('0x3b')]=_[_0x2da6('0x3f')](_0xe23ff8[_0x2da6('0x3b')],{'$or':_[_0x2da6('0x2a')](_0xe23ff8[_0x2da6('0x32')],function(_0x4cd431){var _0x3400f8={};_0x3400f8[_0x4cd431]={'$like':'%'+_0xb3b11a[_0x2da6('0x30')][_0x2da6('0x3e')]+'%'};return _0x3400f8;})});}_0xe23ff8=_[_0x2da6('0x3f')]({},_0xe23ff8,_0xb3b11a[_0x2da6('0x42')]);return _0xcfa5e6[_0x2da6('0x52')](_0xe23ff8);}})[_0x2da6('0x24')](function(_0x16382a){if(_0x16382a){_0x37dfa2=_0x16382a[_0x2da6('0x35')];if(!_0xb3b11a['query'][_0x2da6('0x36')](_0x2da6('0x37'))){_0xe23ff8[_0x2da6('0x38')]=qs[_0x2da6('0x38')](_0xb3b11a['query'][_0x2da6('0x38')]);_0xe23ff8[_0x2da6('0x1c')]=qs[_0x2da6('0x1c')](_0xb3b11a[_0x2da6('0x30')][_0x2da6('0x1c')]);}return _0xcfa5e6['getDescriptions'](_0xe23ff8);}})['then'](function(_0x4b6d75){if(_0x4b6d75){return _0x4b6d75?{'count':_0x37dfa2,'rows':_0x4b6d75}:null;}})[_0x2da6('0x24')](respondWithResult(_0x525358,null))['catch'](handleError(_0x525358,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 53a23a1..2428cc7 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 _0xe63c=['rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports','define','int_salesforce_configurations','lodash','util','../../config/logger','moment','bluebird','path'];(function(_0x8cda6f,_0x4961bc){var _0x46bccd=function(_0x2cbc22){while(--_0x2cbc22){_0x8cda6f['push'](_0x8cda6f['shift']());}};_0x46bccd(++_0x4961bc);}(_0xe63c,0x66));var _0xce63=function(_0x457c96,_0x13785c){_0x457c96=_0x457c96-0x0;var _0x4e5ebc=_0xe63c[_0x457c96];return _0x4e5ebc;};'use strict';var _=require(_0xce63('0x0'));var util=require(_0xce63('0x1'));var logger=require(_0xce63('0x2'))('api');var moment=require(_0xce63('0x3'));var BPromise=require(_0xce63('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xce63('0x5'));var rimraf=require(_0xce63('0x6'));var config=require(_0xce63('0x7'));var attributes=require(_0xce63('0x8'));module[_0xce63('0x9')]=function(_0x19346e,_0x286e69){return _0x19346e[_0xce63('0xa')]('SalesforceConfiguration',attributes,{'tableName':_0xce63('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8ffe=['request-promise','path','rimraf','./intSalesforceConfiguration.attributes','SalesforceConfiguration','int_salesforce_configurations','lodash','util','api'];(function(_0x420269,_0x345914){var _0x430864=function(_0x1fd3c9){while(--_0x1fd3c9){_0x420269['push'](_0x420269['shift']());}};_0x430864(++_0x345914);}(_0x8ffe,0x11d));var _0xe8ff=function(_0x29c5a7,_0x500649){_0x29c5a7=_0x29c5a7-0x0;var _0x55df59=_0x8ffe[_0x29c5a7];return _0x55df59;};'use strict';var _=require(_0xe8ff('0x0'));var util=require(_0xe8ff('0x1'));var logger=require('../../config/logger')(_0xe8ff('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe8ff('0x3'));var fs=require('fs');var path=require(_0xe8ff('0x4'));var rimraf=require(_0xe8ff('0x5'));var config=require('../../config/environment');var attributes=require(_0xe8ff('0x6'));module['exports']=function(_0x1533e3,_0x168fce){return _0x1533e3['define'](_0xe8ff('0x7'),attributes,{'tableName':_0xe8ff('0x8'),'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 3513b1b..dc2b274 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 _0x70c4=['stringify','error','message','info','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x13b123,_0x3a9c70){var _0x10be5a=function(_0x804be2){while(--_0x804be2){_0x13b123['push'](_0x13b123['shift']());}};_0x10be5a(++_0x3a9c70);}(_0x70c4,0x1a8));var _0x470c=function(_0x394d1c,_0x2a926c){_0x394d1c=_0x394d1c-0x0;var _0x265922=_0x70c4[_0x394d1c];return _0x265922;};'use strict';var _=require(_0x470c('0x0'));var util=require(_0x470c('0x1'));var moment=require(_0x470c('0x2'));var BPromise=require(_0x470c('0x3'));var rs=require(_0x470c('0x4'));var fs=require('fs');var Redis=require(_0x470c('0x5'));var db=require(_0x470c('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x470c('0x7'))(_0x470c('0x8'));var config=require(_0x470c('0x9'));var jayson=require(_0x470c('0xa'));var client=jayson['client'][_0x470c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4721c5,_0x5825f4,_0x243f82){return new BPromise(function(_0x1b0e41,_0x1b475b){return client[_0x470c('0xc')](_0x4721c5,_0x243f82)['then'](function(_0x1c5a0e){logger['info'](_0x470c('0xd'),_0x5825f4,_0x470c('0xe'));logger[_0x470c('0xf')](_0x470c('0x10'),_0x5825f4,'request\x20sent',JSON[_0x470c('0x11')](_0x1c5a0e));if(_0x1c5a0e[_0x470c('0x12')]){if(_0x1c5a0e[_0x470c('0x12')]['code']===0x1f4){logger[_0x470c('0x12')](_0x470c('0xd'),_0x5825f4,_0x1c5a0e[_0x470c('0x12')][_0x470c('0x13')]);return _0x1b475b(_0x1c5a0e[_0x470c('0x12')][_0x470c('0x13')]);}logger[_0x470c('0x12')](_0x470c('0xd'),_0x5825f4,_0x1c5a0e['error'][_0x470c('0x13')]);return _0x1b0e41(_0x1c5a0e[_0x470c('0x12')][_0x470c('0x13')]);}else{logger[_0x470c('0x14')]('SalesforceConfiguration,\x20%s,\x20%s',_0x5825f4,'request\x20sent');_0x1b0e41(_0x1c5a0e['result'][_0x470c('0x13')]);}})['catch'](function(_0x18cf0d){logger['error'](_0x470c('0xd'),_0x5825f4,_0x18cf0d);_0x1b475b(_0x18cf0d);});});} \ No newline at end of file +var _0x10b1=['jayson/promise','client','http','request','then','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x71cd05,_0x36ac11){var _0x59c9e7=function(_0x5472cd){while(--_0x5472cd){_0x71cd05['push'](_0x71cd05['shift']());}};_0x59c9e7(++_0x36ac11);}(_0x10b1,0x92));var _0x110b=function(_0xa8f22b,_0x5d6fdd){_0xa8f22b=_0xa8f22b-0x0;var _0x13943d=_0x10b1[_0xa8f22b];return _0x13943d;};'use strict';var _=require('lodash');var util=require(_0x110b('0x0'));var moment=require('moment');var BPromise=require(_0x110b('0x1'));var rs=require(_0x110b('0x2'));var fs=require('fs');var Redis=require(_0x110b('0x3'));var db=require(_0x110b('0x4'))['db'];var utils=require(_0x110b('0x5'));var logger=require(_0x110b('0x6'))('rpc');var config=require(_0x110b('0x7'));var jayson=require(_0x110b('0x8'));var client=jayson[_0x110b('0x9')][_0x110b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x542c5f,_0x5a20d3,_0x2bbbb0){return new BPromise(function(_0x185667,_0x18c6de){return client[_0x110b('0xb')](_0x542c5f,_0x2bbbb0)[_0x110b('0xc')](function(_0x21063b){logger['info'](_0x110b('0xd'),_0x5a20d3,_0x110b('0xe'));logger[_0x110b('0xf')](_0x110b('0x10'),_0x5a20d3,_0x110b('0xe'),JSON[_0x110b('0x11')](_0x21063b));if(_0x21063b[_0x110b('0x12')]){if(_0x21063b[_0x110b('0x12')][_0x110b('0x13')]===0x1f4){logger['error'](_0x110b('0xd'),_0x5a20d3,_0x21063b[_0x110b('0x12')][_0x110b('0x14')]);return _0x18c6de(_0x21063b['error']['message']);}logger[_0x110b('0x12')](_0x110b('0xd'),_0x5a20d3,_0x21063b[_0x110b('0x12')][_0x110b('0x14')]);return _0x185667(_0x21063b[_0x110b('0x12')][_0x110b('0x14')]);}else{logger['info'](_0x110b('0xd'),_0x5a20d3,_0x110b('0xe'));_0x185667(_0x21063b[_0x110b('0x15')][_0x110b('0x14')]);}})['catch'](function(_0x2923b3){logger[_0x110b('0x12')]('SalesforceConfiguration,\x20%s,\x20%s',_0x5a20d3,_0x2923b3);_0x18c6de(_0x2923b3);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index d4a906c..5493b3a 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 _0x21c2=['isAuthenticated','index','show','post','/:id','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceField.controller','get'];(function(_0x164ab6,_0x45359d){var _0x1c471a=function(_0x450391){while(--_0x450391){_0x164ab6['push'](_0x164ab6['shift']());}};_0x1c471a(++_0x45359d);}(_0x21c2,0x1e3));var _0x221c=function(_0x5cde94,_0x17dcfa){_0x5cde94=_0x5cde94-0x0;var _0x2f9af5=_0x21c2[_0x5cde94];return _0x2f9af5;};'use strict';var multer=require(_0x221c('0x0'));var util=require(_0x221c('0x1'));var path=require(_0x221c('0x2'));var timeout=require(_0x221c('0x3'));var express=require(_0x221c('0x4'));var router=express[_0x221c('0x5')]();var fs_extra=require(_0x221c('0x6'));var auth=require(_0x221c('0x7'));var interaction=require(_0x221c('0x8'));var config=require('../../config/environment');var controller=require(_0x221c('0x9'));router[_0x221c('0xa')]('/',auth[_0x221c('0xb')](),controller[_0x221c('0xc')]);router[_0x221c('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x221c('0xd')]);router[_0x221c('0xe')]('/',auth[_0x221c('0xb')](),controller['create']);router['put'](_0x221c('0xf'),auth[_0x221c('0xb')](),controller[_0x221c('0x10')]);router[_0x221c('0x11')]('/:id',auth[_0x221c('0xb')](),controller['destroy']);module[_0x221c('0x12')]=router; \ No newline at end of file +var _0x16f0=['delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceField.controller','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x597c16,_0x2292fe){var _0x30cc2c=function(_0x26cb58){while(--_0x26cb58){_0x597c16['push'](_0x597c16['shift']());}};_0x30cc2c(++_0x2292fe);}(_0x16f0,0x121));var _0x016f=function(_0x397f10,_0x5576dd){_0x397f10=_0x397f10-0x0;var _0x10be40=_0x16f0[_0x397f10];return _0x10be40;};'use strict';var multer=require(_0x016f('0x0'));var util=require(_0x016f('0x1'));var path=require(_0x016f('0x2'));var timeout=require(_0x016f('0x3'));var express=require(_0x016f('0x4'));var router=express[_0x016f('0x5')]();var fs_extra=require(_0x016f('0x6'));var auth=require(_0x016f('0x7'));var interaction=require(_0x016f('0x8'));var config=require('../../config/environment');var controller=require(_0x016f('0x9'));router[_0x016f('0xa')]('/',auth[_0x016f('0xb')](),controller[_0x016f('0xc')]);router[_0x016f('0xa')](_0x016f('0xd'),auth[_0x016f('0xb')](),controller[_0x016f('0xe')]);router[_0x016f('0xf')]('/',auth[_0x016f('0xb')](),controller[_0x016f('0x10')]);router['put'](_0x016f('0xd'),auth[_0x016f('0xb')](),controller['update']);router[_0x016f('0x11')]('/:id',auth[_0x016f('0xb')](),controller['destroy']);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 84262fc..5670ad5 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 _0x723f=['customVariable','keyValue','STRING','sequelize','exports','ENUM','string','variable'];(function(_0x56d1c5,_0x9e5b88){var _0x37515d=function(_0x1e8a57){while(--_0x1e8a57){_0x56d1c5['push'](_0x56d1c5['shift']());}};_0x37515d(++_0x9e5b88);}(_0x723f,0xa3));var _0xf723=function(_0x17c5c8,_0x5729b1){_0x17c5c8=_0x17c5c8-0x0;var _0x35173a=_0x723f[_0x17c5c8];return _0x35173a;};'use strict';var Sequelize=require(_0xf723('0x0'));module[_0xf723('0x1')]={'type':{'type':Sequelize[_0xf723('0x2')](_0xf723('0x3'),_0xf723('0x4'),_0xf723('0x5'),_0xf723('0x6'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0xf723('0x7')]},'key':{'type':Sequelize[_0xf723('0x7')]},'keyType':{'type':Sequelize[_0xf723('0x2')](_0xf723('0x3'),_0xf723('0x4'),_0xf723('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize[_0xf723('0x7')]}}; \ No newline at end of file +var _0xfa70=['string','keyValue','picklist','STRING','variable','customVariable','ENUM'];(function(_0x210b43,_0x4e4899){var _0x46d9d5=function(_0xd80883){while(--_0xd80883){_0x210b43['push'](_0x210b43['shift']());}};_0x46d9d5(++_0x4e4899);}(_0xfa70,0x164));var _0x0fa7=function(_0x1024e4,_0x508920){_0x1024e4=_0x1024e4-0x0;var _0x4bb4c5=_0xfa70[_0x1024e4];return _0x4bb4c5;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x0fa7('0x0')](_0x0fa7('0x1'),'variable','customVariable',_0x0fa7('0x2'),_0x0fa7('0x3')),'defaultValue':'string'},'content':{'type':Sequelize[_0x0fa7('0x4')]},'key':{'type':Sequelize[_0x0fa7('0x4')]},'keyType':{'type':Sequelize['ENUM'](_0x0fa7('0x1'),_0x0fa7('0x5'),_0x0fa7('0x6'))},'keyContent':{'type':Sequelize[_0x0fa7('0x4')]},'idField':{'type':Sequelize[_0x0fa7('0x4')]},'variableName':{'type':Sequelize[_0x0fa7('0x4')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 208364e..411315e 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 _0xa037=['type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','params','find','catch','create','body','eml-format','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','destroy','sendStatus','stack','name','send','map','SalesforceField','rawAttributes'];(function(_0x58c7b0,_0x4cb178){var _0x22a17d=function(_0xdb4bc){while(--_0xdb4bc){_0x58c7b0['push'](_0x58c7b0['shift']());}};_0x22a17d(++_0x4cb178);}(_0xa037,0x1b9));var _0x7a03=function(_0x573a05,_0x116879){_0x573a05=_0x573a05-0x0;var _0x2b36db=_0xa037[_0x573a05];return _0x2b36db;};'use strict';var emlformat=require(_0x7a03('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7a03('0x1'));var rp=require('request-promise');var moment=require(_0x7a03('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x7a03('0x3'));var util=require(_0x7a03('0x4'));var path=require('path');var sox=require(_0x7a03('0x5'));var csv=require(_0x7a03('0x6'));var ejs=require(_0x7a03('0x7'));var fs=require('fs');var fs_extra=require(_0x7a03('0x8'));var _=require(_0x7a03('0x9'));var squel=require('squel');var crypto=require(_0x7a03('0xa'));var jsforce=require(_0x7a03('0xb'));var deskjs=require(_0x7a03('0xc'));var toCsv=require(_0x7a03('0x6'));var querystring=require('querystring');var Papa=require(_0x7a03('0xd'));var Redis=require(_0x7a03('0xe'));var authService=require(_0x7a03('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x7a03('0x10'));var hardwareService=require(_0x7a03('0x11'));var logger=require(_0x7a03('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x7a03('0x13'));var licenseUtil=require(_0x7a03('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3b8cef,_0x1e45df){_0x1e45df=_0x1e45df||0xcc;return function(_0x5767dd){if(_0x5767dd){return _0x3b8cef['sendStatus'](_0x1e45df);}return _0x3b8cef[_0x7a03('0x15')](_0x1e45df)[_0x7a03('0x16')]();};}function respondWithResult(_0x50e3f8,_0x166384){_0x166384=_0x166384||0xc8;return function(_0x595306){if(_0x595306){return _0x50e3f8[_0x7a03('0x15')](_0x166384)[_0x7a03('0x17')](_0x595306);}};}function respondWithFilteredResult(_0x3de216,_0x7c7383){return function(_0x46b49a){if(_0x46b49a){var _0xe253f1=typeof _0x7c7383['offset']===_0x7a03('0x18')&&typeof _0x7c7383[_0x7a03('0x19')]===_0x7a03('0x18');var _0x595859=_0x46b49a[_0x7a03('0x1a')];var _0x1b1d0d=_0xe253f1?0x0:_0x7c7383[_0x7a03('0x1b')];var _0x4facfd=_0xe253f1?_0x46b49a[_0x7a03('0x1a')]:_0x7c7383[_0x7a03('0x1b')]+_0x7c7383['limit'];var _0x1e7f58;if(_0x4facfd>=_0x595859){_0x4facfd=_0x595859;_0x1e7f58=0xc8;}else{_0x1e7f58=0xce;}_0x3de216[_0x7a03('0x15')](_0x1e7f58);return _0x3de216[_0x7a03('0x1c')](_0x7a03('0x1d'),_0x1b1d0d+'-'+_0x4facfd+'/'+_0x595859)['json'](_0x46b49a);}return null;};}function patchUpdates(_0x225bbc){return function(_0x2416ab){try{jsonpatch[_0x7a03('0x1e')](_0x2416ab,_0x225bbc,!![]);}catch(_0x4908d4){return BPromise['reject'](_0x4908d4);}return _0x2416ab[_0x7a03('0x1f')]();};}function saveUpdates(_0x4e6358,_0x28bb4f){return function(_0x29513b){if(_0x29513b){return _0x29513b[_0x7a03('0x20')](_0x4e6358)[_0x7a03('0x21')](function(_0x45cbb7){return _0x45cbb7;});}return null;};}function removeEntity(_0x217cb3,_0x5c782d){return function(_0x4bd3f6){if(_0x4bd3f6){return _0x4bd3f6[_0x7a03('0x22')]()['then'](function(){_0x217cb3[_0x7a03('0x15')](0xcc)[_0x7a03('0x16')]();});}};}function handleEntityNotFound(_0x13a524,_0x45796c){return function(_0x3114d0){if(!_0x3114d0){_0x13a524[_0x7a03('0x23')](0x194);}return _0x3114d0;};}function handleError(_0xeb4ba4,_0x19f8e5){_0x19f8e5=_0x19f8e5||0x1f4;return function(_0x40abcf){logger['error'](_0x40abcf[_0x7a03('0x24')]);if(_0x40abcf[_0x7a03('0x25')]){delete _0x40abcf[_0x7a03('0x25')];}_0xeb4ba4[_0x7a03('0x15')](_0x19f8e5)[_0x7a03('0x26')](_0x40abcf);};}exports['index']=function(_0x3b4318,_0x75add9){var _0x3482d8={},_0x4e3c20={},_0x322156={'count':0x0,'rows':[]};var _0x1def77=_[_0x7a03('0x27')](db[_0x7a03('0x28')][_0x7a03('0x29')],function(_0x8ea70a){return{'name':_0x8ea70a['fieldName'],'type':_0x8ea70a[_0x7a03('0x2a')][_0x7a03('0x2b')]};});_0x4e3c20[_0x7a03('0x2c')]=_[_0x7a03('0x27')](_0x1def77,'name');_0x4e3c20['query']=_[_0x7a03('0x2d')](_0x3b4318[_0x7a03('0x2e')]);_0x4e3c20[_0x7a03('0x2f')]=_[_0x7a03('0x30')](_0x4e3c20['model'],_0x4e3c20[_0x7a03('0x2e')]);_0x3482d8[_0x7a03('0x31')]=_[_0x7a03('0x30')](_0x4e3c20[_0x7a03('0x2c')],qs[_0x7a03('0x32')](_0x3b4318['query'][_0x7a03('0x32')]));_0x3482d8[_0x7a03('0x31')]=_0x3482d8[_0x7a03('0x31')][_0x7a03('0x33')]?_0x3482d8['attributes']:_0x4e3c20[_0x7a03('0x2c')];if(!_0x3b4318[_0x7a03('0x2e')]['hasOwnProperty'](_0x7a03('0x34'))){_0x3482d8[_0x7a03('0x19')]=qs[_0x7a03('0x19')](_0x3b4318[_0x7a03('0x2e')][_0x7a03('0x19')]);_0x3482d8[_0x7a03('0x1b')]=qs[_0x7a03('0x1b')](_0x3b4318[_0x7a03('0x2e')][_0x7a03('0x1b')]);}_0x3482d8[_0x7a03('0x35')]=qs[_0x7a03('0x36')](_0x3b4318[_0x7a03('0x2e')][_0x7a03('0x36')]);_0x3482d8[_0x7a03('0x37')]=qs[_0x7a03('0x2f')](_[_0x7a03('0x38')](_0x3b4318[_0x7a03('0x2e')],_0x4e3c20['filters']),_0x1def77);if(_0x3b4318['query'][_0x7a03('0x39')]){_0x3482d8[_0x7a03('0x37')]=_[_0x7a03('0x3a')](_0x3482d8[_0x7a03('0x37')],{'$or':_[_0x7a03('0x27')](_0x1def77,function(_0x410ead){if(_0x410ead[_0x7a03('0x2a')]!==_0x7a03('0x3b')){var _0x3f5198={};_0x3f5198[_0x410ead[_0x7a03('0x25')]]={'$like':'%'+_0x3b4318[_0x7a03('0x2e')][_0x7a03('0x39')]+'%'};return _0x3f5198;}})});}_0x3482d8=_['merge']({},_0x3482d8,_0x3b4318[_0x7a03('0x3c')]);var _0x173e70={'where':_0x3482d8[_0x7a03('0x37')]};return db[_0x7a03('0x28')][_0x7a03('0x1a')](_0x173e70)[_0x7a03('0x21')](function(_0x5b365c){_0x322156[_0x7a03('0x1a')]=_0x5b365c;if(_0x3b4318[_0x7a03('0x2e')][_0x7a03('0x3d')]){_0x3482d8[_0x7a03('0x3e')]=[{'all':!![]}];}return db[_0x7a03('0x28')][_0x7a03('0x3f')](_0x3482d8);})[_0x7a03('0x21')](function(_0x21ea2d){_0x322156['rows']=_0x21ea2d;return _0x322156;})[_0x7a03('0x21')](respondWithFilteredResult(_0x75add9,_0x3482d8))['catch'](handleError(_0x75add9,null));};exports['show']=function(_0x4c4e20,_0x405f8e){var _0x54df56={'raw':!![],'where':{'id':_0x4c4e20[_0x7a03('0x40')]['id']}},_0x3e0a8e={};_0x3e0a8e['model']=_[_0x7a03('0x2d')](db[_0x7a03('0x28')]['rawAttributes']);_0x3e0a8e[_0x7a03('0x2e')]=_[_0x7a03('0x2d')](_0x4c4e20[_0x7a03('0x2e')]);_0x3e0a8e[_0x7a03('0x2f')]=_[_0x7a03('0x30')](_0x3e0a8e['model'],_0x3e0a8e[_0x7a03('0x2e')]);_0x54df56['attributes']=_[_0x7a03('0x30')](_0x3e0a8e[_0x7a03('0x2c')],qs[_0x7a03('0x32')](_0x4c4e20['query'][_0x7a03('0x32')]));_0x54df56[_0x7a03('0x31')]=_0x54df56[_0x7a03('0x31')][_0x7a03('0x33')]?_0x54df56['attributes']:_0x3e0a8e['model'];if(_0x4c4e20[_0x7a03('0x2e')][_0x7a03('0x3d')]){_0x54df56['include']=[{'all':!![]}];}_0x54df56=_[_0x7a03('0x3a')]({},_0x54df56,_0x4c4e20['options']);return db[_0x7a03('0x28')][_0x7a03('0x41')](_0x54df56)[_0x7a03('0x21')](handleEntityNotFound(_0x405f8e,null))[_0x7a03('0x21')](respondWithResult(_0x405f8e,null))[_0x7a03('0x42')](handleError(_0x405f8e,null));};exports['create']=function(_0x90e197,_0x1ad67f){return db[_0x7a03('0x28')][_0x7a03('0x43')](_0x90e197['body'],{})[_0x7a03('0x21')](respondWithResult(_0x1ad67f,0xc9))['catch'](handleError(_0x1ad67f,null));};exports['update']=function(_0xdf2636,_0x7c7b00){if(_0xdf2636[_0x7a03('0x44')]['id']){delete _0xdf2636[_0x7a03('0x44')]['id'];}return db[_0x7a03('0x28')][_0x7a03('0x41')]({'where':{'id':_0xdf2636[_0x7a03('0x40')]['id']}})[_0x7a03('0x21')](handleEntityNotFound(_0x7c7b00,null))[_0x7a03('0x21')](saveUpdates(_0xdf2636['body'],null))[_0x7a03('0x21')](respondWithResult(_0x7c7b00,null))[_0x7a03('0x42')](handleError(_0x7c7b00,null));};exports[_0x7a03('0x22')]=function(_0x59ef42,_0x333121){return db[_0x7a03('0x28')][_0x7a03('0x41')]({'where':{'id':_0x59ef42[_0x7a03('0x40')]['id']}})[_0x7a03('0x21')](handleEntityNotFound(_0x333121,null))[_0x7a03('0x21')](removeEntity(_0x333121,null))[_0x7a03('0x42')](handleError(_0x333121,null));}; \ No newline at end of file +var _0x1db9=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','name','index','map','SalesforceField','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','pick','VIRTUAL','filter','merge','includeAll','include','findAll','rows','catch','show','keys','options','find','create','body','params','destroy','eml-format'];(function(_0x151d9b,_0x5da004){var _0x510a88=function(_0x50648c){while(--_0x50648c){_0x151d9b['push'](_0x151d9b['shift']());}};_0x510a88(++_0x5da004);}(_0x1db9,0x12b));var _0x91db=function(_0xc5e355,_0xcc3d9f){_0xc5e355=_0xc5e355-0x0;var _0x4f70e4=_0x1db9[_0xc5e355];return _0x4f70e4;};'use strict';var emlformat=require(_0x91db('0x0'));var rimraf=require(_0x91db('0x1'));var zipdir=require(_0x91db('0x2'));var jsonpatch=require(_0x91db('0x3'));var rp=require(_0x91db('0x4'));var moment=require(_0x91db('0x5'));var BPromise=require(_0x91db('0x6'));var Mustache=require(_0x91db('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x91db('0x8'));var fs=require('fs');var fs_extra=require(_0x91db('0x9'));var _=require(_0x91db('0xa'));var squel=require('squel');var crypto=require(_0x91db('0xb'));var jsforce=require(_0x91db('0xc'));var deskjs=require(_0x91db('0xd'));var toCsv=require(_0x91db('0xe'));var querystring=require('querystring');var Papa=require(_0x91db('0xf'));var Redis=require(_0x91db('0x10'));var authService=require(_0x91db('0x11'));var qs=require(_0x91db('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x91db('0x13'));var logger=require(_0x91db('0x14'))('api');var utils=require(_0x91db('0x15'));var config=require(_0x91db('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x91db('0x17'))['db'];function respondWithStatusCode(_0x4337db,_0x4f773b){_0x4f773b=_0x4f773b||0xcc;return function(_0x250dde){if(_0x250dde){return _0x4337db[_0x91db('0x18')](_0x4f773b);}return _0x4337db['status'](_0x4f773b)[_0x91db('0x19')]();};}function respondWithResult(_0x249a6d,_0x3d0d41){_0x3d0d41=_0x3d0d41||0xc8;return function(_0x439cbb){if(_0x439cbb){return _0x249a6d[_0x91db('0x1a')](_0x3d0d41)[_0x91db('0x1b')](_0x439cbb);}};}function respondWithFilteredResult(_0x4ac4f6,_0xb1b5d2){return function(_0x4d188c){if(_0x4d188c){var _0x5278af=typeof _0xb1b5d2[_0x91db('0x1c')]===_0x91db('0x1d')&&typeof _0xb1b5d2[_0x91db('0x1e')]==='undefined';var _0x16520e=_0x4d188c[_0x91db('0x1f')];var _0x557667=_0x5278af?0x0:_0xb1b5d2[_0x91db('0x1c')];var _0x3d4978=_0x5278af?_0x4d188c[_0x91db('0x1f')]:_0xb1b5d2['offset']+_0xb1b5d2[_0x91db('0x1e')];var _0x537e77;if(_0x3d4978>=_0x16520e){_0x3d4978=_0x16520e;_0x537e77=0xc8;}else{_0x537e77=0xce;}_0x4ac4f6['status'](_0x537e77);return _0x4ac4f6[_0x91db('0x20')](_0x91db('0x21'),_0x557667+'-'+_0x3d4978+'/'+_0x16520e)['json'](_0x4d188c);}return null;};}function patchUpdates(_0x2cff7e){return function(_0x79ba1e){try{jsonpatch[_0x91db('0x22')](_0x79ba1e,_0x2cff7e,!![]);}catch(_0xeb76c3){return BPromise[_0x91db('0x23')](_0xeb76c3);}return _0x79ba1e[_0x91db('0x24')]();};}function saveUpdates(_0x532184,_0x4d19b6){return function(_0x5a10f0){if(_0x5a10f0){return _0x5a10f0[_0x91db('0x25')](_0x532184)[_0x91db('0x26')](function(_0x434cc9){return _0x434cc9;});}return null;};}function removeEntity(_0x31b497,_0x4887ce){return function(_0x57c5e5){if(_0x57c5e5){return _0x57c5e5['destroy']()['then'](function(){_0x31b497[_0x91db('0x1a')](0xcc)[_0x91db('0x19')]();});}};}function handleEntityNotFound(_0x2e54c3,_0x3a1fa0){return function(_0x2f87db){if(!_0x2f87db){_0x2e54c3[_0x91db('0x18')](0x194);}return _0x2f87db;};}function handleError(_0x58bc29,_0x2c5672){_0x2c5672=_0x2c5672||0x1f4;return function(_0x571a55){logger[_0x91db('0x27')](_0x571a55['stack']);if(_0x571a55[_0x91db('0x28')]){delete _0x571a55[_0x91db('0x28')];}_0x58bc29[_0x91db('0x1a')](_0x2c5672)['send'](_0x571a55);};}exports[_0x91db('0x29')]=function(_0x12e422,_0x420789){var _0x5531e5={},_0x5441e8={},_0x48b5f5={'count':0x0,'rows':[]};var _0x15470b=_[_0x91db('0x2a')](db[_0x91db('0x2b')][_0x91db('0x2c')],function(_0x119fd5){return{'name':_0x119fd5['fieldName'],'type':_0x119fd5[_0x91db('0x2d')][_0x91db('0x2e')]};});_0x5441e8[_0x91db('0x2f')]=_['map'](_0x15470b,_0x91db('0x28'));_0x5441e8['query']=_['keys'](_0x12e422[_0x91db('0x30')]);_0x5441e8[_0x91db('0x31')]=_[_0x91db('0x32')](_0x5441e8['model'],_0x5441e8['query']);_0x5531e5['attributes']=_[_0x91db('0x32')](_0x5441e8[_0x91db('0x2f')],qs[_0x91db('0x33')](_0x12e422['query'][_0x91db('0x33')]));_0x5531e5[_0x91db('0x34')]=_0x5531e5[_0x91db('0x34')][_0x91db('0x35')]?_0x5531e5['attributes']:_0x5441e8[_0x91db('0x2f')];if(!_0x12e422['query'][_0x91db('0x36')](_0x91db('0x37'))){_0x5531e5[_0x91db('0x1e')]=qs[_0x91db('0x1e')](_0x12e422[_0x91db('0x30')][_0x91db('0x1e')]);_0x5531e5[_0x91db('0x1c')]=qs[_0x91db('0x1c')](_0x12e422[_0x91db('0x30')][_0x91db('0x1c')]);}_0x5531e5[_0x91db('0x38')]=qs['sort'](_0x12e422[_0x91db('0x30')]['sort']);_0x5531e5[_0x91db('0x39')]=qs['filters'](_[_0x91db('0x3a')](_0x12e422[_0x91db('0x30')],_0x5441e8[_0x91db('0x31')]),_0x15470b);if(_0x12e422[_0x91db('0x30')]['filter']){_0x5531e5['where']=_['merge'](_0x5531e5['where'],{'$or':_[_0x91db('0x2a')](_0x15470b,function(_0xb8394d){if(_0xb8394d[_0x91db('0x2d')]!==_0x91db('0x3b')){var _0x257b92={};_0x257b92[_0xb8394d['name']]={'$like':'%'+_0x12e422[_0x91db('0x30')][_0x91db('0x3c')]+'%'};return _0x257b92;}})});}_0x5531e5=_[_0x91db('0x3d')]({},_0x5531e5,_0x12e422['options']);var _0x2ebcfe={'where':_0x5531e5[_0x91db('0x39')]};return db[_0x91db('0x2b')][_0x91db('0x1f')](_0x2ebcfe)[_0x91db('0x26')](function(_0x554eea){_0x48b5f5['count']=_0x554eea;if(_0x12e422[_0x91db('0x30')][_0x91db('0x3e')]){_0x5531e5[_0x91db('0x3f')]=[{'all':!![]}];}return db['SalesforceField'][_0x91db('0x40')](_0x5531e5);})['then'](function(_0x201b98){_0x48b5f5[_0x91db('0x41')]=_0x201b98;return _0x48b5f5;})['then'](respondWithFilteredResult(_0x420789,_0x5531e5))[_0x91db('0x42')](handleError(_0x420789,null));};exports[_0x91db('0x43')]=function(_0xb8f48d,_0x3d0835){var _0x2ff848={'raw':!![],'where':{'id':_0xb8f48d['params']['id']}},_0x7fa808={};_0x7fa808[_0x91db('0x2f')]=_['keys'](db[_0x91db('0x2b')][_0x91db('0x2c')]);_0x7fa808[_0x91db('0x30')]=_[_0x91db('0x44')](_0xb8f48d[_0x91db('0x30')]);_0x7fa808[_0x91db('0x31')]=_['intersection'](_0x7fa808[_0x91db('0x2f')],_0x7fa808[_0x91db('0x30')]);_0x2ff848[_0x91db('0x34')]=_['intersection'](_0x7fa808[_0x91db('0x2f')],qs[_0x91db('0x33')](_0xb8f48d['query'][_0x91db('0x33')]));_0x2ff848[_0x91db('0x34')]=_0x2ff848[_0x91db('0x34')]['length']?_0x2ff848[_0x91db('0x34')]:_0x7fa808['model'];if(_0xb8f48d[_0x91db('0x30')][_0x91db('0x3e')]){_0x2ff848[_0x91db('0x3f')]=[{'all':!![]}];}_0x2ff848=_[_0x91db('0x3d')]({},_0x2ff848,_0xb8f48d[_0x91db('0x45')]);return db[_0x91db('0x2b')][_0x91db('0x46')](_0x2ff848)[_0x91db('0x26')](handleEntityNotFound(_0x3d0835,null))['then'](respondWithResult(_0x3d0835,null))[_0x91db('0x42')](handleError(_0x3d0835,null));};exports[_0x91db('0x47')]=function(_0x20ebd7,_0x12e1ce){return db[_0x91db('0x2b')][_0x91db('0x47')](_0x20ebd7['body'],{})['then'](respondWithResult(_0x12e1ce,0xc9))[_0x91db('0x42')](handleError(_0x12e1ce,null));};exports[_0x91db('0x25')]=function(_0x4927aa,_0x3b892c){if(_0x4927aa[_0x91db('0x48')]['id']){delete _0x4927aa[_0x91db('0x48')]['id'];}return db[_0x91db('0x2b')][_0x91db('0x46')]({'where':{'id':_0x4927aa[_0x91db('0x49')]['id']}})[_0x91db('0x26')](handleEntityNotFound(_0x3b892c,null))[_0x91db('0x26')](saveUpdates(_0x4927aa['body'],null))[_0x91db('0x26')](respondWithResult(_0x3b892c,null))['catch'](handleError(_0x3b892c,null));};exports[_0x91db('0x4a')]=function(_0x3fc625,_0x5d92be){return db[_0x91db('0x2b')][_0x91db('0x46')]({'where':{'id':_0x3fc625[_0x91db('0x49')]['id']}})[_0x91db('0x26')](handleEntityNotFound(_0x5d92be,null))[_0x91db('0x26')](removeEntity(_0x5d92be,null))[_0x91db('0x42')](handleError(_0x5d92be,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 86fa6e7..803f74d 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 _0xd26a=['request-promise','rimraf','../../config/environment','./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','FieldId','lodash','util','../../config/logger','bluebird'];(function(_0x330a1c,_0x21522c){var _0x5885c4=function(_0x14b892){while(--_0x14b892){_0x330a1c['push'](_0x330a1c['shift']());}};_0x5885c4(++_0x21522c);}(_0xd26a,0xec));var _0xad26=function(_0x84183f,_0xb91202){_0x84183f=_0x84183f-0x0;var _0x4950e4=_0xd26a[_0x84183f];return _0x4950e4;};'use strict';var _=require(_0xad26('0x0'));var util=require(_0xad26('0x1'));var logger=require(_0xad26('0x2'))('api');var moment=require('moment');var BPromise=require(_0xad26('0x3'));var rp=require(_0xad26('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xad26('0x5'));var config=require(_0xad26('0x6'));var attributes=require(_0xad26('0x7'));module[_0xad26('0x8')]=function(_0x37b557,_0x57a2d6){return _0x37b557[_0xad26('0x9')](_0xad26('0xa'),attributes,{'tableName':_0xad26('0xb'),'paranoid':![],'indexes':[{'name':_0xad26('0xc'),'fields':[_0xad26('0xd'),_0xad26('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x00af=['request-promise','rimraf','../../config/environment','./intSalesforceField.attributes','exports','SalesforceField','salesforce_unique_index','idField','FieldId','lodash','bluebird'];(function(_0x114ab5,_0x1b1bfc){var _0x474519=function(_0x1257ab){while(--_0x1257ab){_0x114ab5['push'](_0x114ab5['shift']());}};_0x474519(++_0x1b1bfc);}(_0x00af,0x6c));var _0xf00a=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x00af[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0xf00a('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xf00a('0x1'));var rp=require(_0xf00a('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf00a('0x3'));var config=require(_0xf00a('0x4'));var attributes=require(_0xf00a('0x5'));module[_0xf00a('0x6')]=function(_0x51d155,_0x5179d3){return _0x51d155['define'](_0xf00a('0x7'),attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':_0xf00a('0x8'),'fields':[_0xf00a('0x9'),_0xf00a('0xa')],'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 b189f60..36a98b8 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 _0x61b0=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0xd8c9a8,_0x4e4005){var _0x5488cc=function(_0x44ff67){while(--_0x44ff67){_0xd8c9a8['push'](_0xd8c9a8['shift']());}};_0x5488cc(++_0x4e4005);}(_0x61b0,0x1f1));var _0x061b=function(_0x2db78a,_0x499e2c){_0x2db78a=_0x2db78a-0x0;var _0x166c9e=_0x61b0[_0x2db78a];return _0x166c9e;};'use strict';var _=require(_0x061b('0x0'));var util=require(_0x061b('0x1'));var moment=require('moment');var BPromise=require(_0x061b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x061b('0x3'));var db=require(_0x061b('0x4'))['db'];var utils=require(_0x061b('0x5'));var logger=require(_0x061b('0x6'))(_0x061b('0x7'));var config=require(_0x061b('0x8'));var jayson=require(_0x061b('0x9'));var client=jayson[_0x061b('0xa')][_0x061b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1c4640,_0x453711,_0xb7ed6d){return new BPromise(function(_0x549e80,_0x4dc2a3){return client[_0x061b('0xc')](_0x1c4640,_0xb7ed6d)[_0x061b('0xd')](function(_0x297a58){logger[_0x061b('0xe')](_0x061b('0xf'),_0x453711,_0x061b('0x10'));logger[_0x061b('0x11')](_0x061b('0x12'),_0x453711,_0x061b('0x10'),JSON[_0x061b('0x13')](_0x297a58));if(_0x297a58[_0x061b('0x14')]){if(_0x297a58[_0x061b('0x14')][_0x061b('0x15')]===0x1f4){logger['error'](_0x061b('0xf'),_0x453711,_0x297a58[_0x061b('0x14')][_0x061b('0x16')]);return _0x4dc2a3(_0x297a58['error']['message']);}logger['error'](_0x061b('0xf'),_0x453711,_0x297a58['error'][_0x061b('0x16')]);return _0x549e80(_0x297a58[_0x061b('0x14')][_0x061b('0x16')]);}else{logger['info'](_0x061b('0xf'),_0x453711,'request\x20sent');_0x549e80(_0x297a58['result'][_0x061b('0x16')]);}})[_0x061b('0x17')](function(_0x3e21ba){logger[_0x061b('0x14')](_0x061b('0xf'),_0x453711,_0x3e21ba);_0x4dc2a3(_0x3e21ba);});});} \ No newline at end of file +var _0x79a9=['request','then','info','SalesforceField,\x20%s,\x20%s','debug','SalesforceField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x220afa,_0xf5f6cc){var _0x1b79d1=function(_0x178a39){while(--_0x178a39){_0x220afa['push'](_0x220afa['shift']());}};_0x1b79d1(++_0xf5f6cc);}(_0x79a9,0x156));var _0x979a=function(_0x131bd4,_0x1d3424){_0x131bd4=_0x131bd4-0x0;var _0xb3d00b=_0x79a9[_0x131bd4];return _0xb3d00b;};'use strict';var _=require('lodash');var util=require(_0x979a('0x0'));var moment=require('moment');var BPromise=require(_0x979a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x979a('0x2'));var db=require(_0x979a('0x3'))['db'];var utils=require(_0x979a('0x4'));var logger=require(_0x979a('0x5'))(_0x979a('0x6'));var config=require('../../config/environment');var jayson=require(_0x979a('0x7'));var client=jayson[_0x979a('0x8')][_0x979a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x16acc2,_0xfe903e,_0x4f59be){return new BPromise(function(_0x317122,_0x1f35f1){return client[_0x979a('0xa')](_0x16acc2,_0x4f59be)[_0x979a('0xb')](function(_0x227e62){logger[_0x979a('0xc')](_0x979a('0xd'),_0xfe903e,'request\x20sent');logger[_0x979a('0xe')](_0x979a('0xf'),_0xfe903e,_0x979a('0x10'),JSON[_0x979a('0x11')](_0x227e62));if(_0x227e62[_0x979a('0x12')]){if(_0x227e62['error'][_0x979a('0x13')]===0x1f4){logger[_0x979a('0x12')]('SalesforceField,\x20%s,\x20%s',_0xfe903e,_0x227e62[_0x979a('0x12')][_0x979a('0x14')]);return _0x1f35f1(_0x227e62['error']['message']);}logger[_0x979a('0x12')](_0x979a('0xd'),_0xfe903e,_0x227e62[_0x979a('0x12')][_0x979a('0x14')]);return _0x317122(_0x227e62[_0x979a('0x12')][_0x979a('0x14')]);}else{logger[_0x979a('0xc')](_0x979a('0xd'),_0xfe903e,_0x979a('0x10'));_0x317122(_0x227e62['result'][_0x979a('0x14')]);}})[_0x979a('0x15')](function(_0x11eab7){logger[_0x979a('0x12')](_0x979a('0xd'),_0xfe903e,_0x11eab7);_0x1f35f1(_0x11eab7);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 48aa4bf..3c67da6 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 _0x11b7=['/:id/fields','getFields','create','addConfiguration','put','update','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations'];(function(_0x5a87e9,_0x4053ca){var _0x475c33=function(_0x2d9549){while(--_0x2d9549){_0x5a87e9['push'](_0x5a87e9['shift']());}};_0x475c33(++_0x4053ca);}(_0x11b7,0x132));var _0x711b=function(_0xef7f3b,_0x4f689f){_0xef7f3b=_0xef7f3b-0x0;var _0x5bc9e3=_0x11b7[_0xef7f3b];return _0x5bc9e3;};'use strict';var multer=require(_0x711b('0x0'));var util=require(_0x711b('0x1'));var path=require(_0x711b('0x2'));var timeout=require(_0x711b('0x3'));var express=require(_0x711b('0x4'));var router=express[_0x711b('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x711b('0x6'));var interaction=require(_0x711b('0x7'));var config=require(_0x711b('0x8'));var controller=require('./intServicenowAccount.controller');router[_0x711b('0x9')]('/',auth[_0x711b('0xa')](),controller[_0x711b('0xb')]);router[_0x711b('0x9')](_0x711b('0xc'),auth[_0x711b('0xa')](),controller[_0x711b('0xd')]);router[_0x711b('0x9')](_0x711b('0xe'),auth[_0x711b('0xa')](),controller[_0x711b('0xf')]);router[_0x711b('0x9')](_0x711b('0x10'),auth[_0x711b('0xa')](),controller[_0x711b('0x11')]);router['post']('/',auth[_0x711b('0xa')](),controller[_0x711b('0x12')]);router['post'](_0x711b('0xe'),auth[_0x711b('0xa')](),controller[_0x711b('0x13')]);router[_0x711b('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x711b('0x15')]);router['delete'](_0x711b('0xc'),auth[_0x711b('0xa')](),controller['destroy']);module[_0x711b('0x16')]=router; \ No newline at end of file +var _0x43e4=['put','delete','destroy','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0x43e4,0x1cf));var _0x443e=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x43e4[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require(_0x443e('0x0'));var util=require(_0x443e('0x1'));var path=require(_0x443e('0x2'));var timeout=require('connect-timeout');var express=require(_0x443e('0x3'));var router=express[_0x443e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x443e('0x5'));var interaction=require(_0x443e('0x6'));var config=require(_0x443e('0x7'));var controller=require(_0x443e('0x8'));router[_0x443e('0x9')]('/',auth[_0x443e('0xa')](),controller[_0x443e('0xb')]);router[_0x443e('0x9')](_0x443e('0xc'),auth[_0x443e('0xa')](),controller[_0x443e('0xd')]);router[_0x443e('0x9')](_0x443e('0xe'),auth[_0x443e('0xa')](),controller['getConfigurations']);router[_0x443e('0x9')](_0x443e('0xf'),auth[_0x443e('0xa')](),controller[_0x443e('0x10')]);router[_0x443e('0x11')]('/',auth['isAuthenticated'](),controller[_0x443e('0x12')]);router[_0x443e('0x11')](_0x443e('0xe'),auth[_0x443e('0xa')](),controller[_0x443e('0x13')]);router[_0x443e('0x14')](_0x443e('0xc'),auth[_0x443e('0xa')](),controller['update']);router[_0x443e('0x15')](_0x443e('0xc'),auth[_0x443e('0xa')](),controller[_0x443e('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 955c957..14f2c53 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 _0xc7f4=['remoteUri','sequelize','STRING','username'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc7f4,0x121));var _0x4c7f=function(_0x17dccb,_0x35a024){_0x17dccb=_0x17dccb-0x0;var _0x1fa895=_0xc7f4[_0x17dccb];return _0x1fa895;};'use strict';var Sequelize=require(_0x4c7f('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4c7f('0x1')]},'username':{'type':Sequelize[_0x4c7f('0x1')],'unique':_0x4c7f('0x2')},'password':{'type':Sequelize[_0x4c7f('0x1')]},'email':{'type':Sequelize[_0x4c7f('0x1')]},'remoteUri':{'type':Sequelize[_0x4c7f('0x1')],'unique':_0x4c7f('0x3')},'serverUrl':{'type':Sequelize[_0x4c7f('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x5791=['remoteUri','exports','STRING','username'];(function(_0x4ca92b,_0x3ed8bb){var _0x1bd7d1=function(_0x59dfe9){while(--_0x59dfe9){_0x4ca92b['push'](_0x4ca92b['shift']());}};_0x1bd7d1(++_0x3ed8bb);}(_0x5791,0x17d));var _0x1579=function(_0x7e19de,_0x368cce){_0x7e19de=_0x7e19de-0x0;var _0x3b06be=_0x5791[_0x7e19de];return _0x3b06be;};'use strict';var Sequelize=require('sequelize');module[_0x1579('0x0')]={'name':{'type':Sequelize[_0x1579('0x1')]},'description':{'type':Sequelize[_0x1579('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x1579('0x2')},'password':{'type':Sequelize[_0x1579('0x1')]},'email':{'type':Sequelize[_0x1579('0x1')]},'remoteUri':{'type':Sequelize[_0x1579('0x1')],'unique':_0x1579('0x3')},'serverUrl':{'type':Sequelize[_0x1579('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 2e25a49..3a04b42 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 _0x62be=['VIRTUAL','options','ServicenowAccount','includeAll','include','findAll','catch','params','find','create','body','update','getConfigurations','findOne','ServicenowConfiguration','order','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','ServicenowField','Descriptions','getFields','hold_reason','knowledge','close_code','notify','incident_state','severity','category','parent','made_sla','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','approval_history','number','resolved_by','opened_by','sys_created_on','sys_domain','state','closed_at','cmdb_ci','delivery_plan','work_notes_list','business_service','sys_domain_path','rfc','time_worked','expected_start','opened_at','business_duration','work_end','reopened_time','approval_set','subcategory','work_notes','short_description','correlation_display','delivery_task','work_start','assignment_group','additional_assignee_list','description','calendar_duration','sys_class_name','close_notes','closed_by','follow_up','parent_incident','sys_id','reopened_by','problem_id','company','reassignment_count','activity_due','assigned_to','comments','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','escalation','correlation_id','location','username','email','remoteUri','serverUrl','slice','lastIndexOf','%s/api/now/doc/table/schema/','%s/api/now/table/','password','GET','result','log','incident\x20table\x20objects','assign','includes','internalType','label','all','TCL:\x20_object','remove','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','forEach','concat','ServiceNow\x20error:\x20','test','stack','Wrong\x20credentials','statusCode','boolean','True','true','sys_choice?sysparm_query=name=incident^element=','false','value','push','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','then','destroy','end','error','name','send','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','pick','filter','where','merge','type'];(function(_0x52b52f,_0x447c49){var _0x596a28=function(_0x5d75ce){while(--_0x5d75ce){_0x52b52f['push'](_0x52b52f['shift']());}};_0x596a28(++_0x447c49);}(_0x62be,0x7f));var _0xe62b=function(_0x2e1a04,_0x2e1e41){_0x2e1a04=_0x2e1a04-0x0;var _0x1ccb80=_0x62be[_0x2e1a04];return _0x1ccb80;};'use strict';var emlformat=require(_0xe62b('0x0'));var rimraf=require(_0xe62b('0x1'));var zipdir=require(_0xe62b('0x2'));var jsonpatch=require(_0xe62b('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe62b('0x4'));var Mustache=require(_0xe62b('0x5'));var util=require(_0xe62b('0x6'));var path=require(_0xe62b('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe62b('0x8'));var fs=require('fs');var fs_extra=require(_0xe62b('0x9'));var _=require('lodash');var squel=require(_0xe62b('0xa'));var crypto=require('crypto');var jsforce=require(_0xe62b('0xb'));var deskjs=require(_0xe62b('0xc'));var toCsv=require('to-csv');var querystring=require(_0xe62b('0xd'));var Papa=require('papaparse');var Redis=require(_0xe62b('0xe'));var authService=require(_0xe62b('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xe62b('0x10'));var hardwareService=require(_0xe62b('0x11'));var logger=require('../../config/logger')(_0xe62b('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xe62b('0x13'));var db=require('../../mysqldb')['db'];var integrations=require(_0xe62b('0x14'));function respondWithStatusCode(_0x97092c,_0x3f0b5d){_0x3f0b5d=_0x3f0b5d||0xcc;return function(_0x1c8806){if(_0x1c8806){return _0x97092c[_0xe62b('0x15')](_0x3f0b5d);}return _0x97092c[_0xe62b('0x16')](_0x3f0b5d)['end']();};}function respondWithResult(_0x4e95ac,_0x5d335f){_0x5d335f=_0x5d335f||0xc8;return function(_0x5378cb){if(_0x5378cb){return _0x4e95ac['status'](_0x5d335f)[_0xe62b('0x17')](_0x5378cb);}};}function respondWithFilteredResult(_0x4f8f51,_0x1554c5){return function(_0x1e4a09){if(_0x1e4a09){var _0x3f52e1=typeof _0x1554c5[_0xe62b('0x18')]===_0xe62b('0x19')&&typeof _0x1554c5[_0xe62b('0x1a')]===_0xe62b('0x19');var _0x2bdf55=_0x1e4a09[_0xe62b('0x1b')];var _0x4582d0=_0x3f52e1?0x0:_0x1554c5[_0xe62b('0x18')];var _0x859444=_0x3f52e1?_0x1e4a09['count']:_0x1554c5[_0xe62b('0x18')]+_0x1554c5['limit'];var _0x280b39;if(_0x859444>=_0x2bdf55){_0x859444=_0x2bdf55;_0x280b39=0xc8;}else{_0x280b39=0xce;}_0x4f8f51['status'](_0x280b39);return _0x4f8f51[_0xe62b('0x1c')](_0xe62b('0x1d'),_0x4582d0+'-'+_0x859444+'/'+_0x2bdf55)[_0xe62b('0x17')](_0x1e4a09);}return null;};}function patchUpdates(_0x4e8eb7){return function(_0x49be80){try{jsonpatch['apply'](_0x49be80,_0x4e8eb7,!![]);}catch(_0x34e03d){return BPromise['reject'](_0x34e03d);}return _0x49be80['save']();};}function saveUpdates(_0x2d0780,_0x1ab229){return function(_0x4eeff3){if(_0x4eeff3){return _0x4eeff3['update'](_0x2d0780)[_0xe62b('0x1e')](function(_0x461c40){return _0x461c40;});}return null;};}function removeEntity(_0x58c2ae,_0x77e356){return function(_0x21b227){if(_0x21b227){return _0x21b227[_0xe62b('0x1f')]()['then'](function(){_0x58c2ae[_0xe62b('0x16')](0xcc)[_0xe62b('0x20')]();});}};}function handleEntityNotFound(_0x37de3e,_0x162884){return function(_0x3dfc68){if(!_0x3dfc68){_0x37de3e['sendStatus'](0x194);}return _0x3dfc68;};}function handleError(_0x26d054,_0xd2c1fd){_0xd2c1fd=_0xd2c1fd||0x1f4;return function(_0x45a594){logger[_0xe62b('0x21')](_0x45a594['stack']);if(_0x45a594[_0xe62b('0x22')]){delete _0x45a594[_0xe62b('0x22')];}_0x26d054[_0xe62b('0x16')](_0xd2c1fd)[_0xe62b('0x23')](_0x45a594);};}exports['index']=function(_0x12f26d,_0x1b8f68){var _0x2c6911={},_0x57377b={},_0x7c20f4={'count':0x0,'rows':[]};var _0x3fcbc0=_[_0xe62b('0x24')](db['ServicenowAccount'][_0xe62b('0x25')],function(_0x1eaefe){return{'name':_0x1eaefe[_0xe62b('0x26')],'type':_0x1eaefe['type'][_0xe62b('0x27')]};});_0x57377b[_0xe62b('0x28')]=_[_0xe62b('0x24')](_0x3fcbc0,_0xe62b('0x22'));_0x57377b[_0xe62b('0x29')]=_[_0xe62b('0x2a')](_0x12f26d[_0xe62b('0x29')]);_0x57377b[_0xe62b('0x2b')]=_[_0xe62b('0x2c')](_0x57377b[_0xe62b('0x28')],_0x57377b['query']);_0x2c6911[_0xe62b('0x2d')]=_[_0xe62b('0x2c')](_0x57377b['model'],qs[_0xe62b('0x2e')](_0x12f26d[_0xe62b('0x29')][_0xe62b('0x2e')]));_0x2c6911[_0xe62b('0x2d')]=_0x2c6911[_0xe62b('0x2d')][_0xe62b('0x2f')]?_0x2c6911[_0xe62b('0x2d')]:_0x57377b[_0xe62b('0x28')];if(!_0x12f26d[_0xe62b('0x29')][_0xe62b('0x30')]('nolimit')){_0x2c6911[_0xe62b('0x1a')]=qs[_0xe62b('0x1a')](_0x12f26d[_0xe62b('0x29')][_0xe62b('0x1a')]);_0x2c6911[_0xe62b('0x18')]=qs['offset'](_0x12f26d['query'][_0xe62b('0x18')]);}_0x2c6911['order']=qs['sort'](_0x12f26d[_0xe62b('0x29')][_0xe62b('0x31')]);_0x2c6911['where']=qs['filters'](_[_0xe62b('0x32')](_0x12f26d['query'],_0x57377b[_0xe62b('0x2b')]),_0x3fcbc0);if(_0x12f26d['query'][_0xe62b('0x33')]){_0x2c6911[_0xe62b('0x34')]=_[_0xe62b('0x35')](_0x2c6911['where'],{'$or':_[_0xe62b('0x24')](_0x3fcbc0,function(_0x1b8d78){if(_0x1b8d78[_0xe62b('0x36')]!==_0xe62b('0x37')){var _0x2d0da3={};_0x2d0da3[_0x1b8d78['name']]={'$like':'%'+_0x12f26d[_0xe62b('0x29')][_0xe62b('0x33')]+'%'};return _0x2d0da3;}})});}_0x2c6911=_[_0xe62b('0x35')]({},_0x2c6911,_0x12f26d[_0xe62b('0x38')]);var _0x54c8d0={'where':_0x2c6911[_0xe62b('0x34')]};return db[_0xe62b('0x39')][_0xe62b('0x1b')](_0x54c8d0)['then'](function(_0x152793){_0x7c20f4[_0xe62b('0x1b')]=_0x152793;if(_0x12f26d[_0xe62b('0x29')][_0xe62b('0x3a')]){_0x2c6911[_0xe62b('0x3b')]=[{'all':!![]}];}return db[_0xe62b('0x39')][_0xe62b('0x3c')](_0x2c6911);})[_0xe62b('0x1e')](function(_0xa10d23){_0x7c20f4['rows']=_0xa10d23;return _0x7c20f4;})[_0xe62b('0x1e')](respondWithFilteredResult(_0x1b8f68,_0x2c6911))[_0xe62b('0x3d')](handleError(_0x1b8f68,null));};exports['show']=function(_0xeee056,_0x2b2225){var _0x448357={'raw':![],'where':{'id':_0xeee056[_0xe62b('0x3e')]['id']}},_0x41bdc4={};_0x41bdc4[_0xe62b('0x28')]=_[_0xe62b('0x2a')](db[_0xe62b('0x39')][_0xe62b('0x25')]);_0x41bdc4['query']=_[_0xe62b('0x2a')](_0xeee056[_0xe62b('0x29')]);_0x41bdc4['filters']=_['intersection'](_0x41bdc4['model'],_0x41bdc4[_0xe62b('0x29')]);_0x448357['attributes']=_[_0xe62b('0x2c')](_0x41bdc4[_0xe62b('0x28')],qs[_0xe62b('0x2e')](_0xeee056['query'][_0xe62b('0x2e')]));_0x448357[_0xe62b('0x2d')]=_0x448357[_0xe62b('0x2d')][_0xe62b('0x2f')]?_0x448357[_0xe62b('0x2d')]:_0x41bdc4[_0xe62b('0x28')];if(_0xeee056[_0xe62b('0x29')][_0xe62b('0x3a')]){_0x448357[_0xe62b('0x3b')]=[{'all':!![]}];}_0x448357=_[_0xe62b('0x35')]({},_0x448357,_0xeee056[_0xe62b('0x38')]);return db['ServicenowAccount'][_0xe62b('0x3f')](_0x448357)[_0xe62b('0x1e')](handleEntityNotFound(_0x2b2225,null))[_0xe62b('0x1e')](respondWithResult(_0x2b2225,null))['catch'](handleError(_0x2b2225,null));};exports[_0xe62b('0x40')]=function(_0x52dd6f,_0x1669a1){return db[_0xe62b('0x39')]['create'](_0x52dd6f[_0xe62b('0x41')],{})[_0xe62b('0x1e')](respondWithResult(_0x1669a1,0xc9))[_0xe62b('0x3d')](handleError(_0x1669a1,null));};exports[_0xe62b('0x42')]=function(_0x42c95b,_0x3c6734){if(_0x42c95b[_0xe62b('0x41')]['id']){delete _0x42c95b['body']['id'];}return db['ServicenowAccount'][_0xe62b('0x3f')]({'where':{'id':_0x42c95b[_0xe62b('0x3e')]['id']}})['then'](handleEntityNotFound(_0x3c6734,null))[_0xe62b('0x1e')](saveUpdates(_0x42c95b[_0xe62b('0x41')],null))[_0xe62b('0x1e')](respondWithResult(_0x3c6734,null))[_0xe62b('0x3d')](handleError(_0x3c6734,null));};exports[_0xe62b('0x1f')]=function(_0x2b2895,_0x15cf82){return db[_0xe62b('0x39')][_0xe62b('0x3f')]({'where':{'id':_0x2b2895['params']['id']}})[_0xe62b('0x1e')](handleEntityNotFound(_0x15cf82,null))[_0xe62b('0x1e')](removeEntity(_0x15cf82,null))[_0xe62b('0x3d')](handleError(_0x15cf82,null));};exports[_0xe62b('0x43')]=function(_0x5871f0,_0x372345,_0x4b869c){var _0x578ff8={};var _0x34afe3={};var _0x232210;var _0x369cbc;return db[_0xe62b('0x39')][_0xe62b('0x44')]({'where':{'id':_0x5871f0['params']['id']}})['then'](handleEntityNotFound(_0x372345,null))[_0xe62b('0x1e')](function(_0x7c384f){if(_0x7c384f){_0x232210=_0x7c384f;_0x34afe3[_0xe62b('0x28')]=_['keys'](db[_0xe62b('0x45')][_0xe62b('0x25')]);_0x34afe3['query']=_[_0xe62b('0x2a')](_0x5871f0['query']);_0x34afe3['filters']=_['intersection'](_0x34afe3[_0xe62b('0x28')],_0x34afe3[_0xe62b('0x29')]);_0x578ff8[_0xe62b('0x2d')]=_['intersection'](_0x34afe3['model'],qs['fields'](_0x5871f0[_0xe62b('0x29')][_0xe62b('0x2e')]));_0x578ff8['attributes']=_0x578ff8[_0xe62b('0x2d')]['length']?_0x578ff8[_0xe62b('0x2d')]:_0x34afe3[_0xe62b('0x28')];_0x578ff8[_0xe62b('0x46')]=qs[_0xe62b('0x31')](_0x5871f0[_0xe62b('0x29')]['sort']);_0x578ff8[_0xe62b('0x34')]=qs['filters'](_[_0xe62b('0x32')](_0x5871f0['query'],_0x34afe3[_0xe62b('0x2b')]));if(_0x5871f0[_0xe62b('0x29')][_0xe62b('0x33')]){_0x578ff8[_0xe62b('0x34')]=_[_0xe62b('0x35')](_0x578ff8[_0xe62b('0x34')],{'$or':_[_0xe62b('0x24')](_0x578ff8[_0xe62b('0x2d')],function(_0x3cac14){var _0x4e1db3={};_0x4e1db3[_0x3cac14]={'$like':'%'+_0x5871f0[_0xe62b('0x29')][_0xe62b('0x33')]+'%'};return _0x4e1db3;})});}_0x578ff8=_[_0xe62b('0x35')]({},_0x578ff8,_0x5871f0[_0xe62b('0x38')]);return _0x232210['getConfigurations'](_0x578ff8);}})[_0xe62b('0x1e')](function(_0x203ce9){if(_0x203ce9){_0x369cbc=_0x203ce9[_0xe62b('0x2f')];if(!_0x5871f0[_0xe62b('0x29')][_0xe62b('0x30')](_0xe62b('0x47'))){_0x578ff8['limit']=qs[_0xe62b('0x1a')](_0x5871f0[_0xe62b('0x29')][_0xe62b('0x1a')]);_0x578ff8['offset']=qs[_0xe62b('0x18')](_0x5871f0[_0xe62b('0x29')][_0xe62b('0x18')]);}return _0x232210['getConfigurations'](_0x578ff8);}})['then'](function(_0x19af9a){if(_0x19af9a){return _0x19af9a?{'count':_0x369cbc,'rows':_0x19af9a}:null;}})[_0xe62b('0x1e')](respondWithResult(_0x372345,null))['catch'](handleError(_0x372345,null));};exports[_0xe62b('0x48')]=function(_0x270837,_0x4698ea,_0x54e018){if(_0x270837['body']['id']){delete _0x270837[_0xe62b('0x41')]['id'];}return db[_0xe62b('0x39')][_0xe62b('0x44')]({'where':{'id':_0x270837[_0xe62b('0x3e')]['id']}})[_0xe62b('0x1e')](handleEntityNotFound(_0x4698ea,null))[_0xe62b('0x1e')](function(_0x2d6544){if(_0x2d6544){_0x270837[_0xe62b('0x41')][_0xe62b('0x49')]=_0x2d6544['id'];_0x270837[_0xe62b('0x41')][_0xe62b('0x4a')]=integrations[_0xe62b('0x4b')](_0x270837[_0xe62b('0x41')][_0xe62b('0x4c')],_0x270837[_0xe62b('0x41')][_0xe62b('0x36')]);_0x270837[_0xe62b('0x41')]['Descriptions']=integrations[_0xe62b('0x4d')](_0x270837['body'][_0xe62b('0x4c')],_0x270837[_0xe62b('0x41')][_0xe62b('0x36')]);return db[_0xe62b('0x45')][_0xe62b('0x40')](_0x270837[_0xe62b('0x41')],{'include':[{'model':db[_0xe62b('0x4e')],'as':_0xe62b('0x4a')},{'model':db[_0xe62b('0x4e')],'as':_0xe62b('0x4f')}]});}return null;})['then'](respondWithResult(_0x4698ea,null))[_0xe62b('0x3d')](handleError(_0x4698ea,null));};exports[_0xe62b('0x50')]=function(_0x528be0,_0xdfc901,_0xe5f4e){var _0x456159=['made_sla',_0xe62b('0x51'),_0xe62b('0x52'),'subcategory',_0xe62b('0x53'),_0xe62b('0x54'),_0xe62b('0x55'),_0xe62b('0x56'),_0xe62b('0x57')];var _0x31565b=[_0xe62b('0x58'),_0xe62b('0x59'),_0xe62b('0x5a'),_0xe62b('0x5b'),_0xe62b('0x5c'),_0xe62b('0x5d'),_0xe62b('0x5e'),_0xe62b('0x51'),_0xe62b('0x5f'),_0xe62b('0x60'),_0xe62b('0x61'),'sys_updated_by',_0xe62b('0x62'),'user_input',_0xe62b('0x63'),_0xe62b('0x64'),_0xe62b('0x65'),'sys_created_by',_0xe62b('0x52'),_0xe62b('0x46'),'calendar_stc',_0xe62b('0x66'),_0xe62b('0x67'),_0xe62b('0x68'),'impact','active',_0xe62b('0x69'),_0xe62b('0x6a'),'priority',_0xe62b('0x6b'),_0xe62b('0x6c'),_0xe62b('0x6d'),_0xe62b('0x6e'),_0xe62b('0x6f'),_0xe62b('0x70'),'group_list',_0xe62b('0x71'),_0xe62b('0x72'),'resolved_at','caller_id',_0xe62b('0x73'),_0xe62b('0x74'),_0xe62b('0x75'),_0xe62b('0x76'),_0xe62b('0x53'),_0xe62b('0x77'),_0xe62b('0x78'),_0xe62b('0x79'),_0xe62b('0x7a'),'business_stc',_0xe62b('0x7b'),_0xe62b('0x7c'),_0xe62b('0x7d'),_0xe62b('0x54'),_0xe62b('0x7e'),_0xe62b('0x7f'),_0xe62b('0x80'),_0xe62b('0x81'),_0xe62b('0x82'),_0xe62b('0x83'),'contact_type',_0xe62b('0x84'),'incident_state','urgency',_0xe62b('0x85'),_0xe62b('0x86'),_0xe62b('0x87'),_0xe62b('0x88'),_0xe62b('0x89'),'severity',_0xe62b('0x8a'),_0xe62b('0x8b'),_0xe62b('0x8c'),_0xe62b('0x8d'),_0xe62b('0x8e'),_0xe62b('0x8f'),'reopen_count','sys_tags',_0xe62b('0x90'),'upon_approval',_0xe62b('0x91'),_0xe62b('0x92'),'category'];var _0x421088='';var _0x264e72='';var _0x3166af=[];var _0x4d5b97='';var _0x5a9daf='';var _0x42f1bb=[];var _0x35d6ce='';var _0x44ae98='';var _0x5b0975={};var _0x4584f1='';return db[_0xe62b('0x39')][_0xe62b('0x44')]({'where':{'id':_0x528be0[_0xe62b('0x3e')]['id']},'attributes':['id',_0xe62b('0x93'),'password',_0xe62b('0x94'),_0xe62b('0x95'),_0xe62b('0x96')]})[_0xe62b('0x1e')](handleEntityNotFound(_0xdfc901,null))['then'](function(_0x3f048c){if(_0x3f048c){_0x4584f1=_0x3f048c[_0xe62b('0x95')];var _0x50534a=_0x4584f1[_0xe62b('0x97')](-0x1);if(_0x50534a==='/'){_0x4584f1=_0x4584f1['substring'](0x0,_0x4584f1[_0xe62b('0x98')](_0x50534a));}_0x44ae98=util['format'](_0xe62b('0x99'),_0x4584f1);_0x35d6ce=util['format'](_0xe62b('0x9a'),_0x4584f1);_0x5b0975={'user':_0x3f048c[_0xe62b('0x93')],'pass':_0x3f048c[_0xe62b('0x9b')]};var _0x1056d2={'method':_0xe62b('0x9c'),'uri':_0x44ae98+'incident?sysparm_display_value=all','auth':_0x5b0975,'json':!![]};return rp(_0x1056d2);}})['then'](function(_0x22e642){if(_0x22e642[_0xe62b('0x9d')][_0xe62b('0x2f')]>0x0){_0x421088=_0x22e642[_0xe62b('0x9d')];}console[_0xe62b('0x9e')](_0xe62b('0x9f'),_0x421088);_0x42f1bb=[];_0x264e72=Object[_0xe62b('0xa0')]([],_0x421088);_['remove'](_0x264e72,function(_0x31fb1c){return!_0x456159[_0xe62b('0xa1')](_0x31fb1c[_0xe62b('0x22')]);});_0x264e72['forEach'](function(_0xd11838){var _0x4b9c1d=createFieldObject(_0x35d6ce,_0x5b0975,_0xd11838[_0xe62b('0xa2')],_0xd11838['name'],_0xd11838[_0xe62b('0xa3')],![]);_0x42f1bb['push'](_0x4b9c1d);});return Promise[_0xe62b('0xa4')](_0x42f1bb);})[_0xe62b('0x1e')](function(_0x58beaa){_0x3166af=_0x58beaa;_0x4d5b97=Object['assign']([],_0x421088);console['log'](_0xe62b('0xa5'),_0x421088);_[_0xe62b('0xa6')](_0x4d5b97,function(_0x42fa7a){return _0x31565b[_0xe62b('0xa1')](_0x42fa7a[_0xe62b('0x22')]);});console[_0xe62b('0x9e')](_0xe62b('0xa7'),_0x4d5b97);_0x42f1bb=[];_0x4d5b97[_0xe62b('0xa8')](function(_0x254a7a){var _0x142fb2=createFieldObject(_0x35d6ce,_0x5b0975,_0x254a7a['internalType'],_0x254a7a[_0xe62b('0x22')],_0x254a7a[_0xe62b('0xa3')],!![]);_0x42f1bb['push'](_0x142fb2);});return Promise[_0xe62b('0xa4')](_0x42f1bb);})[_0xe62b('0x1e')](function(_0x50b7ad){_0x5a9daf=_0x50b7ad;var _0x204ae2=_0x3166af[_0xe62b('0xa9')](_0x5a9daf);return{'count':_0x204ae2[_0xe62b('0x2f')],'rows':_0x204ae2};})['then'](respondWithResult(_0xdfc901,null))['catch'](function(_0x396588){console['log'](_0xe62b('0xaa')+_0x396588);var _0x53468b=_0x528be0['query'][_0xe62b('0xab')]?0x1f4:_0x396588['statusCode']||0x1f4;logger[_0xe62b('0x21')](_0x396588[_0xe62b('0xac')]);delete _0x396588[_0xe62b('0x22')];if(_0x53468b===0x191){_0x53468b=0x190;}_0xdfc901['status'](_0x53468b)[_0xe62b('0x23')](_0x528be0[_0xe62b('0x29')]['test']?{'message':_0xe62b('0xad'),'statusCode':_0x396588[_0xe62b('0xae')]}:_0x396588);});};function createFieldObject(_0x28210d,_0x47c7b5,_0x47a586,_0x4d0768,_0x27aebf,_0x152a98){return new Promise(function(_0x28ed1e,_0x3b836a){var _0x541182={'id':_0x4d0768,'name':_0x27aebf,'custom':_0x152a98};if(_0x47a586===_0xe62b('0xaf')){_0x541182[_0xe62b('0x38')]=[{'name':_0xe62b('0xb0'),'value':_0xe62b('0xb1')},{'name':'False','value':'false'}];_0x28ed1e(_0x541182);}else{var _0x6ec87a={'method':_0xe62b('0x9c'),'uri':_0x28210d+_0xe62b('0xb2')+_0x4d0768,'auth':_0x47c7b5,'json':!![]};return rp(_0x6ec87a)[_0xe62b('0x1e')](function(_0x9959a9){var _0x3770fd=[];if(_0x9959a9[_0xe62b('0x9d')]['length']>0x0){_0x9959a9[_0xe62b('0x9d')][_0xe62b('0xa8')](function(_0x2166b7){if(_0x2166b7['inactive']===_0xe62b('0xb3')){var _0x2c94fe={'name':_0x2166b7['label'],'value':_0x2166b7[_0xe62b('0xb4')]};_0x3770fd[_0xe62b('0xb5')](_0x2c94fe);}});}_0x541182['options']=_0x3770fd;if(_0x541182[_0xe62b('0x38')][_0xe62b('0x2f')]>0x0){_0x28ed1e(_0x541182);}else{if(_0x152a98==![]){_0x28ed1e();}else{_0x28ed1e(_0x541182);}}});}});} \ No newline at end of file +var _0x2230=['reopened_time','resolved_at','caller_id','work_notes','short_description','correlation_display','assignment_group','business_stc','description','sys_class_name','close_notes','parent_incident','sys_id','reopened_by','urgency','company','reassignment_count','activity_due','assigned_to','comments','sla_due','due_date','sys_mod_count','sys_tags','upon_approval','correlation_id','category','username','email','remoteUri','serverUrl','slice','substring','lastIndexOf','%s/api/now/doc/table/schema/','format','%s/api/now/table/','password','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','remove','includes','internalType','label','push','all','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','concat','ServiceNow\x20error:\x20','test','statusCode','stack','boolean','True','true','False','inactive','false','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','json','undefined','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','status','end','error','name','send','map','fieldName','type','key','query','keys','filters','attributes','intersection','model','fields','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','ServicenowAccount','findAll','rows','show','params','rawAttributes','include','create','catch','body','find','getConfigurations','ServicenowConfiguration','length','addConfiguration','findOne','AccountId','Subjects','channel','Descriptions','getDescriptions','ServicenowField','getFields','made_sla','hold_reason','subcategory','close_code','notify','incident_state','severity','parent','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','approval_history','number','resolved_by','opened_by','user_input','sys_domain','state','knowledge','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','active','work_notes_list','business_service','priority','rfc','time_worked','expected_start','opened_at','business_duration','group_list','work_end'];(function(_0x5a085c,_0x23120b){var _0x52cbdf=function(_0x13cd9a){while(--_0x13cd9a){_0x5a085c['push'](_0x5a085c['shift']());}};_0x52cbdf(++_0x23120b);}(_0x2230,0xfa));var _0x0223=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2230[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0223('0x0'));var jsonpatch=require(_0x0223('0x1'));var rp=require(_0x0223('0x2'));var moment=require(_0x0223('0x3'));var BPromise=require(_0x0223('0x4'));var Mustache=require(_0x0223('0x5'));var util=require(_0x0223('0x6'));var path=require(_0x0223('0x7'));var sox=require(_0x0223('0x8'));var csv=require('to-csv');var ejs=require(_0x0223('0x9'));var fs=require('fs');var fs_extra=require(_0x0223('0xa'));var _=require(_0x0223('0xb'));var squel=require(_0x0223('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0223('0xd'));var toCsv=require('to-csv');var querystring=require(_0x0223('0xe'));var Papa=require(_0x0223('0xf'));var Redis=require(_0x0223('0x10'));var authService=require(_0x0223('0x11'));var qs=require(_0x0223('0x12'));var as=require(_0x0223('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0223('0x14'))(_0x0223('0x15'));var utils=require('../../config/utils');var config=require(_0x0223('0x16'));var licenseUtil=require(_0x0223('0x17'));var db=require(_0x0223('0x18'))['db'];var integrations=require(_0x0223('0x19'));function respondWithStatusCode(_0x3cf1f1,_0x456e45){_0x456e45=_0x456e45||0xcc;return function(_0x544c90){if(_0x544c90){return _0x3cf1f1[_0x0223('0x1a')](_0x456e45);}return _0x3cf1f1['status'](_0x456e45)['end']();};}function respondWithResult(_0x1c36f2,_0x1c8dfc){_0x1c8dfc=_0x1c8dfc||0xc8;return function(_0xa2004){if(_0xa2004){return _0x1c36f2['status'](_0x1c8dfc)[_0x0223('0x1b')](_0xa2004);}};}function respondWithFilteredResult(_0x10f029,_0xefec4c){return function(_0x123517){if(_0x123517){var _0x1dcbf5=typeof _0xefec4c['offset']===_0x0223('0x1c')&&typeof _0xefec4c['limit']===_0x0223('0x1c');var _0x2cfa4b=_0x123517[_0x0223('0x1d')];var _0x4fda78=_0x1dcbf5?0x0:_0xefec4c[_0x0223('0x1e')];var _0xe8cb4a=_0x1dcbf5?_0x123517[_0x0223('0x1d')]:_0xefec4c[_0x0223('0x1e')]+_0xefec4c[_0x0223('0x1f')];var _0x2f417f;if(_0xe8cb4a>=_0x2cfa4b){_0xe8cb4a=_0x2cfa4b;_0x2f417f=0xc8;}else{_0x2f417f=0xce;}_0x10f029['status'](_0x2f417f);return _0x10f029[_0x0223('0x20')](_0x0223('0x21'),_0x4fda78+'-'+_0xe8cb4a+'/'+_0x2cfa4b)['json'](_0x123517);}return null;};}function patchUpdates(_0x21c276){return function(_0x1cfa05){try{jsonpatch[_0x0223('0x22')](_0x1cfa05,_0x21c276,!![]);}catch(_0x3b22d1){return BPromise[_0x0223('0x23')](_0x3b22d1);}return _0x1cfa05['save']();};}function saveUpdates(_0x5d3de9,_0x318a8e){return function(_0x34d28b){if(_0x34d28b){return _0x34d28b[_0x0223('0x24')](_0x5d3de9)[_0x0223('0x25')](function(_0x185627){return _0x185627;});}return null;};}function removeEntity(_0xf57878,_0x1d628b){return function(_0x5b9463){if(_0x5b9463){return _0x5b9463[_0x0223('0x26')]()[_0x0223('0x25')](function(){_0xf57878[_0x0223('0x27')](0xcc)[_0x0223('0x28')]();});}};}function handleEntityNotFound(_0x532621,_0x430d27){return function(_0x82cd9c){if(!_0x82cd9c){_0x532621['sendStatus'](0x194);}return _0x82cd9c;};}function handleError(_0x137c40,_0x1cb7f8){_0x1cb7f8=_0x1cb7f8||0x1f4;return function(_0x2f6179){logger[_0x0223('0x29')](_0x2f6179['stack']);if(_0x2f6179[_0x0223('0x2a')]){delete _0x2f6179[_0x0223('0x2a')];}_0x137c40['status'](_0x1cb7f8)[_0x0223('0x2b')](_0x2f6179);};}exports['index']=function(_0x34bcb2,_0x41643e){var _0x2c0e45={},_0x3102be={},_0x2a1530={'count':0x0,'rows':[]};var _0x14a415=_[_0x0223('0x2c')](db['ServicenowAccount']['rawAttributes'],function(_0x5d96c9){return{'name':_0x5d96c9[_0x0223('0x2d')],'type':_0x5d96c9[_0x0223('0x2e')][_0x0223('0x2f')]};});_0x3102be['model']=_[_0x0223('0x2c')](_0x14a415,'name');_0x3102be[_0x0223('0x30')]=_[_0x0223('0x31')](_0x34bcb2[_0x0223('0x30')]);_0x3102be[_0x0223('0x32')]=_['intersection'](_0x3102be['model'],_0x3102be[_0x0223('0x30')]);_0x2c0e45[_0x0223('0x33')]=_[_0x0223('0x34')](_0x3102be[_0x0223('0x35')],qs['fields'](_0x34bcb2['query'][_0x0223('0x36')]));_0x2c0e45[_0x0223('0x33')]=_0x2c0e45[_0x0223('0x33')]['length']?_0x2c0e45[_0x0223('0x33')]:_0x3102be[_0x0223('0x35')];if(!_0x34bcb2['query'][_0x0223('0x37')]('nolimit')){_0x2c0e45[_0x0223('0x1f')]=qs[_0x0223('0x1f')](_0x34bcb2['query'][_0x0223('0x1f')]);_0x2c0e45[_0x0223('0x1e')]=qs['offset'](_0x34bcb2[_0x0223('0x30')]['offset']);}_0x2c0e45[_0x0223('0x38')]=qs[_0x0223('0x39')](_0x34bcb2[_0x0223('0x30')][_0x0223('0x39')]);_0x2c0e45[_0x0223('0x3a')]=qs['filters'](_[_0x0223('0x3b')](_0x34bcb2['query'],_0x3102be[_0x0223('0x32')]),_0x14a415);if(_0x34bcb2[_0x0223('0x30')][_0x0223('0x3c')]){_0x2c0e45[_0x0223('0x3a')]=_[_0x0223('0x3d')](_0x2c0e45[_0x0223('0x3a')],{'$or':_[_0x0223('0x2c')](_0x14a415,function(_0x346a5c){if(_0x346a5c[_0x0223('0x2e')]!=='VIRTUAL'){var _0x5a2aa5={};_0x5a2aa5[_0x346a5c[_0x0223('0x2a')]]={'$like':'%'+_0x34bcb2[_0x0223('0x30')][_0x0223('0x3c')]+'%'};return _0x5a2aa5;}})});}_0x2c0e45=_[_0x0223('0x3d')]({},_0x2c0e45,_0x34bcb2[_0x0223('0x3e')]);var _0x35b128={'where':_0x2c0e45[_0x0223('0x3a')]};return db['ServicenowAccount'][_0x0223('0x1d')](_0x35b128)[_0x0223('0x25')](function(_0x184572){_0x2a1530[_0x0223('0x1d')]=_0x184572;if(_0x34bcb2['query'][_0x0223('0x3f')]){_0x2c0e45['include']=[{'all':!![]}];}return db[_0x0223('0x40')][_0x0223('0x41')](_0x2c0e45);})['then'](function(_0x4fd378){_0x2a1530[_0x0223('0x42')]=_0x4fd378;return _0x2a1530;})[_0x0223('0x25')](respondWithFilteredResult(_0x41643e,_0x2c0e45))['catch'](handleError(_0x41643e,null));};exports[_0x0223('0x43')]=function(_0x4821cf,_0x5d214c){var _0x5b95a1={'raw':![],'where':{'id':_0x4821cf[_0x0223('0x44')]['id']}},_0x56b23e={};_0x56b23e[_0x0223('0x35')]=_[_0x0223('0x31')](db['ServicenowAccount'][_0x0223('0x45')]);_0x56b23e[_0x0223('0x30')]=_['keys'](_0x4821cf[_0x0223('0x30')]);_0x56b23e[_0x0223('0x32')]=_['intersection'](_0x56b23e[_0x0223('0x35')],_0x56b23e[_0x0223('0x30')]);_0x5b95a1['attributes']=_['intersection'](_0x56b23e[_0x0223('0x35')],qs[_0x0223('0x36')](_0x4821cf[_0x0223('0x30')][_0x0223('0x36')]));_0x5b95a1[_0x0223('0x33')]=_0x5b95a1[_0x0223('0x33')]['length']?_0x5b95a1[_0x0223('0x33')]:_0x56b23e[_0x0223('0x35')];if(_0x4821cf['query'][_0x0223('0x3f')]){_0x5b95a1[_0x0223('0x46')]=[{'all':!![]}];}_0x5b95a1=_['merge']({},_0x5b95a1,_0x4821cf[_0x0223('0x3e')]);return db[_0x0223('0x40')]['find'](_0x5b95a1)[_0x0223('0x25')](handleEntityNotFound(_0x5d214c,null))[_0x0223('0x25')](respondWithResult(_0x5d214c,null))['catch'](handleError(_0x5d214c,null));};exports[_0x0223('0x47')]=function(_0x2f57c4,_0x1e691a){return db['ServicenowAccount'][_0x0223('0x47')](_0x2f57c4['body'],{})[_0x0223('0x25')](respondWithResult(_0x1e691a,0xc9))[_0x0223('0x48')](handleError(_0x1e691a,null));};exports['update']=function(_0x3925a3,_0x24b284){if(_0x3925a3['body']['id']){delete _0x3925a3[_0x0223('0x49')]['id'];}return db[_0x0223('0x40')]['find']({'where':{'id':_0x3925a3['params']['id']}})[_0x0223('0x25')](handleEntityNotFound(_0x24b284,null))[_0x0223('0x25')](saveUpdates(_0x3925a3[_0x0223('0x49')],null))['then'](respondWithResult(_0x24b284,null))[_0x0223('0x48')](handleError(_0x24b284,null));};exports[_0x0223('0x26')]=function(_0x5f2e50,_0x42fb93){return db['ServicenowAccount'][_0x0223('0x4a')]({'where':{'id':_0x5f2e50['params']['id']}})['then'](handleEntityNotFound(_0x42fb93,null))[_0x0223('0x25')](removeEntity(_0x42fb93,null))[_0x0223('0x48')](handleError(_0x42fb93,null));};exports[_0x0223('0x4b')]=function(_0x2e19e2,_0x4348dc,_0x59225d){var _0x1fe450={};var _0x30a927={};var _0x295bb1;var _0x32e6e8;return db['ServicenowAccount']['findOne']({'where':{'id':_0x2e19e2[_0x0223('0x44')]['id']}})[_0x0223('0x25')](handleEntityNotFound(_0x4348dc,null))[_0x0223('0x25')](function(_0x230678){if(_0x230678){_0x295bb1=_0x230678;_0x30a927[_0x0223('0x35')]=_['keys'](db[_0x0223('0x4c')][_0x0223('0x45')]);_0x30a927[_0x0223('0x30')]=_[_0x0223('0x31')](_0x2e19e2[_0x0223('0x30')]);_0x30a927[_0x0223('0x32')]=_['intersection'](_0x30a927['model'],_0x30a927[_0x0223('0x30')]);_0x1fe450[_0x0223('0x33')]=_[_0x0223('0x34')](_0x30a927[_0x0223('0x35')],qs[_0x0223('0x36')](_0x2e19e2[_0x0223('0x30')]['fields']));_0x1fe450[_0x0223('0x33')]=_0x1fe450[_0x0223('0x33')][_0x0223('0x4d')]?_0x1fe450[_0x0223('0x33')]:_0x30a927[_0x0223('0x35')];_0x1fe450['order']=qs[_0x0223('0x39')](_0x2e19e2['query']['sort']);_0x1fe450[_0x0223('0x3a')]=qs['filters'](_[_0x0223('0x3b')](_0x2e19e2['query'],_0x30a927[_0x0223('0x32')]));if(_0x2e19e2['query'][_0x0223('0x3c')]){_0x1fe450['where']=_[_0x0223('0x3d')](_0x1fe450[_0x0223('0x3a')],{'$or':_[_0x0223('0x2c')](_0x1fe450[_0x0223('0x33')],function(_0x27f806){var _0x180bb0={};_0x180bb0[_0x27f806]={'$like':'%'+_0x2e19e2[_0x0223('0x30')]['filter']+'%'};return _0x180bb0;})});}_0x1fe450=_[_0x0223('0x3d')]({},_0x1fe450,_0x2e19e2[_0x0223('0x3e')]);return _0x295bb1[_0x0223('0x4b')](_0x1fe450);}})['then'](function(_0x11da81){if(_0x11da81){_0x32e6e8=_0x11da81[_0x0223('0x4d')];if(!_0x2e19e2['query']['hasOwnProperty']('nolimit')){_0x1fe450[_0x0223('0x1f')]=qs['limit'](_0x2e19e2[_0x0223('0x30')]['limit']);_0x1fe450[_0x0223('0x1e')]=qs[_0x0223('0x1e')](_0x2e19e2[_0x0223('0x30')][_0x0223('0x1e')]);}return _0x295bb1[_0x0223('0x4b')](_0x1fe450);}})[_0x0223('0x25')](function(_0x113871){if(_0x113871){return _0x113871?{'count':_0x32e6e8,'rows':_0x113871}:null;}})[_0x0223('0x25')](respondWithResult(_0x4348dc,null))[_0x0223('0x48')](handleError(_0x4348dc,null));};exports[_0x0223('0x4e')]=function(_0x46b042,_0x592901,_0x3ab09f){if(_0x46b042[_0x0223('0x49')]['id']){delete _0x46b042[_0x0223('0x49')]['id'];}return db[_0x0223('0x40')][_0x0223('0x4f')]({'where':{'id':_0x46b042[_0x0223('0x44')]['id']}})[_0x0223('0x25')](handleEntityNotFound(_0x592901,null))[_0x0223('0x25')](function(_0x590431){if(_0x590431){_0x46b042[_0x0223('0x49')][_0x0223('0x50')]=_0x590431['id'];_0x46b042[_0x0223('0x49')][_0x0223('0x51')]=integrations['getSubjects'](_0x46b042[_0x0223('0x49')][_0x0223('0x52')],_0x46b042['body'][_0x0223('0x2e')]);_0x46b042['body'][_0x0223('0x53')]=integrations[_0x0223('0x54')](_0x46b042[_0x0223('0x49')][_0x0223('0x52')],_0x46b042[_0x0223('0x49')]['type']);return db['ServicenowConfiguration'][_0x0223('0x47')](_0x46b042[_0x0223('0x49')],{'include':[{'model':db['ServicenowField'],'as':_0x0223('0x51')},{'model':db[_0x0223('0x55')],'as':_0x0223('0x53')}]});}return null;})[_0x0223('0x25')](respondWithResult(_0x592901,null))[_0x0223('0x48')](handleError(_0x592901,null));};exports[_0x0223('0x56')]=function(_0x14afa7,_0x385c1b,_0x51817f){var _0x1b81a9=[_0x0223('0x57'),_0x0223('0x58'),'knowledge',_0x0223('0x59'),_0x0223('0x5a'),_0x0223('0x5b'),_0x0223('0x5c'),_0x0223('0x5d'),'category'];var _0x5c610e=[_0x0223('0x5e'),_0x0223('0x57'),_0x0223('0x5f'),_0x0223('0x60'),_0x0223('0x61'),_0x0223('0x62'),_0x0223('0x63'),_0x0223('0x58'),_0x0223('0x64'),_0x0223('0x65'),_0x0223('0x66'),'sys_updated_by',_0x0223('0x67'),_0x0223('0x68'),'sys_created_on',_0x0223('0x69'),_0x0223('0x6a'),'sys_created_by',_0x0223('0x6b'),_0x0223('0x38'),_0x0223('0x6c'),_0x0223('0x6d'),_0x0223('0x6e'),_0x0223('0x6f'),_0x0223('0x70'),_0x0223('0x71'),_0x0223('0x72'),_0x0223('0x73'),_0x0223('0x74'),'sys_domain_path',_0x0223('0x75'),_0x0223('0x76'),_0x0223('0x77'),_0x0223('0x78'),_0x0223('0x79'),_0x0223('0x7a'),_0x0223('0x7b'),_0x0223('0x7c'),_0x0223('0x7d'),_0x0223('0x7e'),'approval_set',_0x0223('0x59'),_0x0223('0x7f'),_0x0223('0x80'),_0x0223('0x5a'),_0x0223('0x81'),'delivery_task','work_start',_0x0223('0x82'),_0x0223('0x83'),'additional_assignee_list',_0x0223('0x84'),'calendar_duration',_0x0223('0x5b'),_0x0223('0x85'),_0x0223('0x86'),'closed_by','follow_up',_0x0223('0x87'),_0x0223('0x88'),'contact_type',_0x0223('0x89'),'incident_state',_0x0223('0x8a'),'problem_id',_0x0223('0x8b'),_0x0223('0x8c'),_0x0223('0x8d'),_0x0223('0x8e'),_0x0223('0x5d'),_0x0223('0x8f'),_0x0223('0x90'),'approval','comments_and_work_notes',_0x0223('0x91'),_0x0223('0x92'),'reopen_count',_0x0223('0x93'),'escalation',_0x0223('0x94'),_0x0223('0x95'),'location',_0x0223('0x96')];var _0x7a3659='';var _0x2c8b67='';var _0x5de28c=[];var _0x4c3a85='';var _0x129a8f='';var _0x46c029=[];var _0x5d3787='';var _0x4dd45d='';var _0x511421={};var _0x2e294d='';return db[_0x0223('0x40')][_0x0223('0x4f')]({'where':{'id':_0x14afa7[_0x0223('0x44')]['id']},'attributes':['id',_0x0223('0x97'),'password',_0x0223('0x98'),_0x0223('0x99'),_0x0223('0x9a')]})[_0x0223('0x25')](handleEntityNotFound(_0x385c1b,null))[_0x0223('0x25')](function(_0x916572){if(_0x916572){_0x2e294d=_0x916572[_0x0223('0x99')];var _0x3333c1=_0x2e294d[_0x0223('0x9b')](-0x1);if(_0x3333c1==='/'){_0x2e294d=_0x2e294d[_0x0223('0x9c')](0x0,_0x2e294d[_0x0223('0x9d')](_0x3333c1));}_0x4dd45d=util['format'](_0x0223('0x9e'),_0x2e294d);_0x5d3787=util[_0x0223('0x9f')](_0x0223('0xa0'),_0x2e294d);_0x511421={'user':_0x916572[_0x0223('0x97')],'pass':_0x916572[_0x0223('0xa1')]};var _0x5091e9={'method':_0x0223('0xa2'),'uri':_0x4dd45d+_0x0223('0xa3'),'auth':_0x511421,'json':!![]};return rp(_0x5091e9);}})['then'](function(_0x4555e3){if(_0x4555e3[_0x0223('0xa4')]['length']>0x0){_0x7a3659=_0x4555e3[_0x0223('0xa4')];}console[_0x0223('0xa5')](_0x0223('0xa6'),_0x7a3659);_0x46c029=[];_0x2c8b67=Object[_0x0223('0xa7')]([],_0x7a3659);_[_0x0223('0xa8')](_0x2c8b67,function(_0x139a2d){return!_0x1b81a9[_0x0223('0xa9')](_0x139a2d[_0x0223('0x2a')]);});_0x2c8b67['forEach'](function(_0x337dab){var _0x13884e=createFieldObject(_0x5d3787,_0x511421,_0x337dab[_0x0223('0xaa')],_0x337dab[_0x0223('0x2a')],_0x337dab[_0x0223('0xab')],![]);_0x46c029[_0x0223('0xac')](_0x13884e);});return Promise[_0x0223('0xad')](_0x46c029);})[_0x0223('0x25')](function(_0x10535b){_0x5de28c=_0x10535b;_0x4c3a85=Object[_0x0223('0xa7')]([],_0x7a3659);console[_0x0223('0xa5')](_0x0223('0xae'),_0x7a3659);_[_0x0223('0xa8')](_0x4c3a85,function(_0x3f501f){return _0x5c610e[_0x0223('0xa9')](_0x3f501f[_0x0223('0x2a')]);});console[_0x0223('0xa5')](_0x0223('0xaf'),_0x4c3a85);_0x46c029=[];_0x4c3a85['forEach'](function(_0x3331c7){var _0x4a5c2b=createFieldObject(_0x5d3787,_0x511421,_0x3331c7['internalType'],_0x3331c7[_0x0223('0x2a')],_0x3331c7[_0x0223('0xab')],!![]);_0x46c029[_0x0223('0xac')](_0x4a5c2b);});return Promise['all'](_0x46c029);})[_0x0223('0x25')](function(_0x42b3cd){_0x129a8f=_0x42b3cd;var _0x48cf48=_0x5de28c[_0x0223('0xb0')](_0x129a8f);return{'count':_0x48cf48[_0x0223('0x4d')],'rows':_0x48cf48};})[_0x0223('0x25')](respondWithResult(_0x385c1b,null))[_0x0223('0x48')](function(_0x502701){console[_0x0223('0xa5')](_0x0223('0xb1')+_0x502701);var _0x142b1e=_0x14afa7[_0x0223('0x30')][_0x0223('0xb2')]?0x1f4:_0x502701[_0x0223('0xb3')]||0x1f4;logger[_0x0223('0x29')](_0x502701[_0x0223('0xb4')]);delete _0x502701['name'];if(_0x142b1e===0x191){_0x142b1e=0x190;}_0x385c1b[_0x0223('0x27')](_0x142b1e)[_0x0223('0x2b')](_0x14afa7[_0x0223('0x30')][_0x0223('0xb2')]?{'message':'Wrong\x20credentials','statusCode':_0x502701['statusCode']}:_0x502701);});};function createFieldObject(_0x4744d8,_0x9c4039,_0x53fa8c,_0x905997,_0xc5a147,_0x384a3d){return new Promise(function(_0x4bd23e,_0xdc57f4){var _0x550098={'id':_0x905997,'name':_0xc5a147,'custom':_0x384a3d};if(_0x53fa8c===_0x0223('0xb5')){_0x550098[_0x0223('0x3e')]=[{'name':_0x0223('0xb6'),'value':_0x0223('0xb7')},{'name':_0x0223('0xb8'),'value':'false'}];_0x4bd23e(_0x550098);}else{var _0x50cef4={'method':_0x0223('0xa2'),'uri':_0x4744d8+'sys_choice?sysparm_query=name=incident^element='+_0x905997,'auth':_0x9c4039,'json':!![]};return rp(_0x50cef4)[_0x0223('0x25')](function(_0x3539b1){var _0x5638ee=[];if(_0x3539b1[_0x0223('0xa4')][_0x0223('0x4d')]>0x0){_0x3539b1[_0x0223('0xa4')]['forEach'](function(_0x1bc6a7){if(_0x1bc6a7[_0x0223('0xb9')]===_0x0223('0xba')){var _0xaa72bd={'name':_0x1bc6a7[_0x0223('0xab')],'value':_0x1bc6a7['value']};_0x5638ee[_0x0223('0xac')](_0xaa72bd);}});}_0x550098[_0x0223('0x3e')]=_0x5638ee;if(_0x550098[_0x0223('0x3e')][_0x0223('0x4d')]>0x0){_0x4bd23e(_0x550098);}else{if(_0x384a3d==![]){_0x4bd23e();}else{_0x4bd23e(_0x550098);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index ab72799..f4ef31a 100644 --- a/server/api/intServicenowAccount/intServicenowAccount.model.js +++ b/server/api/intServicenowAccount/intServicenowAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x326f=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount','int_servicenow_accounts','lodash'];(function(_0x2283dc,_0x2fcfc5){var _0x16db90=function(_0x376c35){while(--_0x376c35){_0x2283dc['push'](_0x2283dc['shift']());}};_0x16db90(++_0x2fcfc5);}(_0x326f,0xd1));var _0xf326=function(_0x57e553,_0x4d0947){_0x57e553=_0x57e553-0x0;var _0x553c54=_0x326f[_0x57e553];return _0x553c54;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf326('0x1'));var moment=require(_0xf326('0x2'));var BPromise=require(_0xf326('0x3'));var rp=require(_0xf326('0x4'));var fs=require('fs');var path=require(_0xf326('0x5'));var rimraf=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var attributes=require(_0xf326('0x8'));var integrations=require(_0xf326('0x9'));module[_0xf326('0xa')]=function(_0x4c2249,_0x3c254d){return _0x4c2249[_0xf326('0xb')](_0xf326('0xc'),attributes,{'tableName':_0xf326('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x71ab=['path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount','int_servicenow_accounts','util','api','bluebird','request-promise'];(function(_0x32b85c,_0x40b6ab){var _0x20a6d8=function(_0xecbe26){while(--_0xecbe26){_0x32b85c['push'](_0x32b85c['shift']());}};_0x20a6d8(++_0x40b6ab);}(_0x71ab,0x64));var _0xb71a=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x71ab[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require('lodash');var util=require(_0xb71a('0x0'));var logger=require('../../config/logger')(_0xb71a('0x1'));var moment=require('moment');var BPromise=require(_0xb71a('0x2'));var rp=require(_0xb71a('0x3'));var fs=require('fs');var path=require(_0xb71a('0x4'));var rimraf=require(_0xb71a('0x5'));var config=require(_0xb71a('0x6'));var attributes=require(_0xb71a('0x7'));var integrations=require(_0xb71a('0x8'));module[_0xb71a('0x9')]=function(_0x22c072,_0x35a84e){return _0x22c072[_0xb71a('0xa')](_0xb71a('0xb'),attributes,{'tableName':_0xb71a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index f4f9f82..2f6f504 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 _0xaf3e=['randomstring','../../mysqldb','rpc','../../config/environment','then','info','request\x20sent','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ServicenowAccount,\x20%s,\x20%s','message','result','catch','GetServicenowAccount','ServicenowAccount','options','raw','where','attributes','limit','include','map','model','debug','ShowServicenowAccount','find','moment','bluebird'];(function(_0x4114c6,_0x32b67e){var _0x3df309=function(_0x103514){while(--_0x103514){_0x4114c6['push'](_0x4114c6['shift']());}};_0x3df309(++_0x32b67e);}(_0xaf3e,0xb2));var _0xeaf3=function(_0x4e8286,_0x4eaeb4){_0x4e8286=_0x4e8286-0x0;var _0x44a440=_0xaf3e[_0x4e8286];return _0x44a440;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xeaf3('0x0'));var BPromise=require(_0xeaf3('0x1'));var rs=require(_0xeaf3('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xeaf3('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xeaf3('0x4'));var config=require(_0xeaf3('0x5'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1ad2a7,_0x2d25c2,_0x391cc7){return new BPromise(function(_0x2b6599,_0xcffe57){return client['request'](_0x1ad2a7,_0x391cc7)[_0xeaf3('0x6')](function(_0x5163ac){logger[_0xeaf3('0x7')]('ServicenowAccount,\x20%s,\x20%s',_0x2d25c2,_0xeaf3('0x8'));logger['debug'](_0xeaf3('0x9'),_0x2d25c2,_0xeaf3('0x8'),JSON[_0xeaf3('0xa')](_0x5163ac));if(_0x5163ac[_0xeaf3('0xb')]){if(_0x5163ac['error'][_0xeaf3('0xc')]===0x1f4){logger['error'](_0xeaf3('0xd'),_0x2d25c2,_0x5163ac[_0xeaf3('0xb')][_0xeaf3('0xe')]);return _0xcffe57(_0x5163ac['error'][_0xeaf3('0xe')]);}logger['error'](_0xeaf3('0xd'),_0x2d25c2,_0x5163ac[_0xeaf3('0xb')]['message']);return _0x2b6599(_0x5163ac['error'][_0xeaf3('0xe')]);}else{logger[_0xeaf3('0x7')]('ServicenowAccount,\x20%s,\x20%s',_0x2d25c2,_0xeaf3('0x8'));_0x2b6599(_0x5163ac[_0xeaf3('0xf')]['message']);}})[_0xeaf3('0x10')](function(_0x203510){logger[_0xeaf3('0xb')](_0xeaf3('0xd'),_0x2d25c2,_0x203510);_0xcffe57(_0x203510);});});}exports[_0xeaf3('0x11')]=function(_0x50b65a){var _0x4dfb9f=this;return new Promise(function(_0x1f7649,_0x5389ab){return db[_0xeaf3('0x12')]['findAll']({'raw':_0x50b65a[_0xeaf3('0x13')]?_0x50b65a[_0xeaf3('0x13')][_0xeaf3('0x14')]===undefined?!![]:![]:!![],'where':_0x50b65a['options']?_0x50b65a[_0xeaf3('0x13')][_0xeaf3('0x15')]||null:null,'attributes':_0x50b65a[_0xeaf3('0x13')]?_0x50b65a['options'][_0xeaf3('0x16')]||null:null,'limit':_0x50b65a[_0xeaf3('0x13')]?_0x50b65a[_0xeaf3('0x13')][_0xeaf3('0x17')]||null:null,'include':_0x50b65a['options']?_0x50b65a[_0xeaf3('0x13')][_0xeaf3('0x18')]?_[_0xeaf3('0x19')](_0x50b65a[_0xeaf3('0x13')][_0xeaf3('0x18')],function(_0x30ce30){return{'model':db[_0x30ce30[_0xeaf3('0x1a')]],'as':_0x30ce30['as'],'attributes':_0x30ce30[_0xeaf3('0x16')],'include':_0x30ce30['include']?_[_0xeaf3('0x19')](_0x30ce30[_0xeaf3('0x18')],function(_0x440718){return{'model':db[_0x440718[_0xeaf3('0x1a')]],'as':_0x440718['as'],'attributes':_0x440718[_0xeaf3('0x16')],'include':_0x440718[_0xeaf3('0x18')]?_['map'](_0x440718[_0xeaf3('0x18')],function(_0x5a9e32){return{'model':db[_0x5a9e32[_0xeaf3('0x1a')]],'as':_0x5a9e32['as'],'attributes':_0x5a9e32['attributes']};}):[]};}):[]};}):[]:[]})[_0xeaf3('0x6')](function(_0x2e4c08){logger[_0xeaf3('0x7')](_0xeaf3('0x11'),_0x50b65a);logger[_0xeaf3('0x1b')](_0xeaf3('0x11'),_0x50b65a,JSON[_0xeaf3('0xa')](_0x2e4c08));_0x1f7649(_0x2e4c08);})[_0xeaf3('0x10')](function(_0x1c44d4){logger[_0xeaf3('0xb')](_0xeaf3('0x11'),_0x1c44d4[_0xeaf3('0xe')],_0x50b65a);_0x5389ab(_0x4dfb9f[_0xeaf3('0xb')](0x1f4,_0x1c44d4['message']));});});};exports[_0xeaf3('0x1c')]=function(_0x135df0){var _0x286b6d=this;return new Promise(function(_0x14af82,_0x5dad81){return db[_0xeaf3('0x12')][_0xeaf3('0x1d')]({'raw':_0x135df0[_0xeaf3('0x13')]?_0x135df0[_0xeaf3('0x13')][_0xeaf3('0x14')]===undefined?!![]:![]:!![],'where':_0x135df0[_0xeaf3('0x13')]?_0x135df0[_0xeaf3('0x13')][_0xeaf3('0x15')]||null:null,'attributes':_0x135df0['options']?_0x135df0[_0xeaf3('0x13')][_0xeaf3('0x16')]||null:null,'include':_0x135df0['options']?_0x135df0[_0xeaf3('0x13')][_0xeaf3('0x18')]?_[_0xeaf3('0x19')](_0x135df0[_0xeaf3('0x13')][_0xeaf3('0x18')],function(_0x59269c){return{'model':db[_0x59269c[_0xeaf3('0x1a')]],'as':_0x59269c['as'],'attributes':_0x59269c[_0xeaf3('0x16')],'include':_0x59269c[_0xeaf3('0x18')]?_[_0xeaf3('0x19')](_0x59269c[_0xeaf3('0x18')],function(_0x1f18c2){return{'model':db[_0x1f18c2[_0xeaf3('0x1a')]],'as':_0x1f18c2['as'],'attributes':_0x1f18c2[_0xeaf3('0x16')],'include':_0x1f18c2[_0xeaf3('0x18')]?_['map'](_0x1f18c2['include'],function(_0x7d1222){return{'model':db[_0x7d1222['model']],'as':_0x7d1222['as'],'attributes':_0x7d1222['attributes']};}):[]};}):[]};}):[]:[]})[_0xeaf3('0x6')](function(_0x2ee8a7){logger[_0xeaf3('0x7')](_0xeaf3('0x1c'),_0x135df0);logger[_0xeaf3('0x1b')](_0xeaf3('0x1c'),_0x135df0,JSON[_0xeaf3('0xa')](_0x2ee8a7));_0x14af82(_0x2ee8a7);})[_0xeaf3('0x10')](function(_0x10bcd7){logger[_0xeaf3('0xb')](_0xeaf3('0x1c'),_0x10bcd7[_0xeaf3('0xe')],_0x135df0);_0x5dad81(_0x286b6d[_0xeaf3('0xb')](0x1f4,_0x10bcd7['message']));});});}; \ No newline at end of file +var _0xc531=['../../config/logger','rpc','jayson/promise','http','request','info','ServicenowAccount,\x20%s,\x20%s','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetServicenowAccount','ServicenowAccount','findAll','options','where','attributes','include','map','model','then','ShowServicenowAccount','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x32c3ce,_0x3ba144){var _0x30ec2a=function(_0x4a9b58){while(--_0x4a9b58){_0x32c3ce['push'](_0x32c3ce['shift']());}};_0x30ec2a(++_0x3ba144);}(_0xc531,0x64));var _0x1c53=function(_0x4aa0ba,_0x4eacea){_0x4aa0ba=_0x4aa0ba-0x0;var _0x77518f=_0xc531[_0x4aa0ba];return _0x77518f;};'use strict';var _=require(_0x1c53('0x0'));var util=require(_0x1c53('0x1'));var moment=require(_0x1c53('0x2'));var BPromise=require(_0x1c53('0x3'));var rs=require(_0x1c53('0x4'));var fs=require('fs');var Redis=require(_0x1c53('0x5'));var db=require(_0x1c53('0x6'))['db'];var utils=require(_0x1c53('0x7'));var logger=require(_0x1c53('0x8'))(_0x1c53('0x9'));var config=require('../../config/environment');var jayson=require(_0x1c53('0xa'));var client=jayson['client'][_0x1c53('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x57beb1,_0x2c1a35,_0x18e01c){return new BPromise(function(_0x4b07a3,_0x52f105){return client[_0x1c53('0xc')](_0x57beb1,_0x18e01c)['then'](function(_0x55bff4){logger[_0x1c53('0xd')](_0x1c53('0xe'),_0x2c1a35,'request\x20sent');logger[_0x1c53('0xf')](_0x1c53('0x10'),_0x2c1a35,_0x1c53('0x11'),JSON[_0x1c53('0x12')](_0x55bff4));if(_0x55bff4['error']){if(_0x55bff4[_0x1c53('0x13')][_0x1c53('0x14')]===0x1f4){logger[_0x1c53('0x13')](_0x1c53('0xe'),_0x2c1a35,_0x55bff4[_0x1c53('0x13')]['message']);return _0x52f105(_0x55bff4['error']['message']);}logger[_0x1c53('0x13')](_0x1c53('0xe'),_0x2c1a35,_0x55bff4['error'][_0x1c53('0x15')]);return _0x4b07a3(_0x55bff4[_0x1c53('0x13')][_0x1c53('0x15')]);}else{logger[_0x1c53('0xd')](_0x1c53('0xe'),_0x2c1a35,_0x1c53('0x11'));_0x4b07a3(_0x55bff4[_0x1c53('0x16')]['message']);}})[_0x1c53('0x17')](function(_0x36c630){logger[_0x1c53('0x13')](_0x1c53('0xe'),_0x2c1a35,_0x36c630);_0x52f105(_0x36c630);});});}exports[_0x1c53('0x18')]=function(_0x3d4047){var _0x2e3cd0=this;return new Promise(function(_0x5f256e,_0x5d03de){return db[_0x1c53('0x19')][_0x1c53('0x1a')]({'raw':_0x3d4047[_0x1c53('0x1b')]?_0x3d4047['options']['raw']===undefined?!![]:![]:!![],'where':_0x3d4047['options']?_0x3d4047[_0x1c53('0x1b')][_0x1c53('0x1c')]||null:null,'attributes':_0x3d4047['options']?_0x3d4047['options'][_0x1c53('0x1d')]||null:null,'limit':_0x3d4047[_0x1c53('0x1b')]?_0x3d4047[_0x1c53('0x1b')]['limit']||null:null,'include':_0x3d4047[_0x1c53('0x1b')]?_0x3d4047[_0x1c53('0x1b')][_0x1c53('0x1e')]?_['map'](_0x3d4047[_0x1c53('0x1b')][_0x1c53('0x1e')],function(_0x5959a5){return{'model':db[_0x5959a5['model']],'as':_0x5959a5['as'],'attributes':_0x5959a5[_0x1c53('0x1d')],'include':_0x5959a5['include']?_[_0x1c53('0x1f')](_0x5959a5['include'],function(_0x28c847){return{'model':db[_0x28c847[_0x1c53('0x20')]],'as':_0x28c847['as'],'attributes':_0x28c847[_0x1c53('0x1d')],'include':_0x28c847['include']?_['map'](_0x28c847[_0x1c53('0x1e')],function(_0xf41ca1){return{'model':db[_0xf41ca1[_0x1c53('0x20')]],'as':_0xf41ca1['as'],'attributes':_0xf41ca1[_0x1c53('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x1c53('0x21')](function(_0x36c16b){logger[_0x1c53('0xd')](_0x1c53('0x18'),_0x3d4047);logger[_0x1c53('0xf')](_0x1c53('0x18'),_0x3d4047,JSON[_0x1c53('0x12')](_0x36c16b));_0x5f256e(_0x36c16b);})['catch'](function(_0x58b795){logger[_0x1c53('0x13')](_0x1c53('0x18'),_0x58b795[_0x1c53('0x15')],_0x3d4047);_0x5d03de(_0x2e3cd0['error'](0x1f4,_0x58b795[_0x1c53('0x15')]));});});};exports[_0x1c53('0x22')]=function(_0x4ff602){var _0x1a1b6d=this;return new Promise(function(_0x5ad515,_0x56e535){return db['ServicenowAccount']['find']({'raw':_0x4ff602['options']?_0x4ff602['options'][_0x1c53('0x23')]===undefined?!![]:![]:!![],'where':_0x4ff602[_0x1c53('0x1b')]?_0x4ff602[_0x1c53('0x1b')][_0x1c53('0x1c')]||null:null,'attributes':_0x4ff602[_0x1c53('0x1b')]?_0x4ff602[_0x1c53('0x1b')][_0x1c53('0x1d')]||null:null,'include':_0x4ff602[_0x1c53('0x1b')]?_0x4ff602[_0x1c53('0x1b')]['include']?_['map'](_0x4ff602[_0x1c53('0x1b')]['include'],function(_0x17014a){return{'model':db[_0x17014a[_0x1c53('0x20')]],'as':_0x17014a['as'],'attributes':_0x17014a[_0x1c53('0x1d')],'include':_0x17014a[_0x1c53('0x1e')]?_['map'](_0x17014a[_0x1c53('0x1e')],function(_0xf8f8b2){return{'model':db[_0xf8f8b2[_0x1c53('0x20')]],'as':_0xf8f8b2['as'],'attributes':_0xf8f8b2[_0x1c53('0x1d')],'include':_0xf8f8b2[_0x1c53('0x1e')]?_[_0x1c53('0x1f')](_0xf8f8b2['include'],function(_0x17c825){return{'model':db[_0x17c825[_0x1c53('0x20')]],'as':_0x17c825['as'],'attributes':_0x17c825[_0x1c53('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x1c53('0x21')](function(_0x21289a){logger[_0x1c53('0xd')](_0x1c53('0x22'),_0x4ff602);logger[_0x1c53('0xf')](_0x1c53('0x22'),_0x4ff602,JSON[_0x1c53('0x12')](_0x21289a));_0x5ad515(_0x21289a);})[_0x1c53('0x17')](function(_0x14a766){logger[_0x1c53('0x13')](_0x1c53('0x22'),_0x14a766[_0x1c53('0x15')],_0x4ff602);_0x56e535(_0x1a1b6d['error'](0x1f4,_0x14a766[_0x1c53('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 12c0b81..fa331f0 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 _0xeca0=['/:id/fields','getFields','getSubjects','/:id/descriptions','post','create','put','update','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id'];(function(_0x2f3cc8,_0x573a07){var _0x3d3b29=function(_0x58eabb){while(--_0x58eabb){_0x2f3cc8['push'](_0x2f3cc8['shift']());}};_0x3d3b29(++_0x573a07);}(_0xeca0,0xda));var _0x0eca=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xeca0[_0xbb091];return _0x467a04;};'use strict';var multer=require('multer');var util=require(_0x0eca('0x0'));var path=require(_0x0eca('0x1'));var timeout=require('connect-timeout');var express=require(_0x0eca('0x2'));var router=express[_0x0eca('0x3')]();var fs_extra=require(_0x0eca('0x4'));var auth=require(_0x0eca('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0eca('0x6'));var controller=require(_0x0eca('0x7'));router[_0x0eca('0x8')]('/',auth[_0x0eca('0x9')](),controller[_0x0eca('0xa')]);router[_0x0eca('0x8')](_0x0eca('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x0eca('0x8')](_0x0eca('0xc'),auth['isAuthenticated'](),controller[_0x0eca('0xd')]);router['get']('/:id/subjects',auth['isAuthenticated'](),controller[_0x0eca('0xe')]);router[_0x0eca('0x8')](_0x0eca('0xf'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0x0eca('0x10')]('/',auth[_0x0eca('0x9')](),controller[_0x0eca('0x11')]);router[_0x0eca('0x12')](_0x0eca('0xb'),auth['isAuthenticated'](),controller[_0x0eca('0x13')]);router[_0x0eca('0x14')](_0x0eca('0xb'),auth[_0x0eca('0x9')](),controller[_0x0eca('0x15')]);module[_0x0eca('0x16')]=router; \ No newline at end of file +var _0x96a1=['update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create'];(function(_0x181728,_0x471cc4){var _0x3525db=function(_0x59c05c){while(--_0x59c05c){_0x181728['push'](_0x181728['shift']());}};_0x3525db(++_0x471cc4);}(_0x96a1,0xfd));var _0x196a=function(_0x378891,_0x4e3e16){_0x378891=_0x378891-0x0;var _0xfbfda2=_0x96a1[_0x378891];return _0xfbfda2;};'use strict';var multer=require(_0x196a('0x0'));var util=require(_0x196a('0x1'));var path=require(_0x196a('0x2'));var timeout=require(_0x196a('0x3'));var express=require(_0x196a('0x4'));var router=express[_0x196a('0x5')]();var fs_extra=require(_0x196a('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x196a('0x7'));var config=require(_0x196a('0x8'));var controller=require(_0x196a('0x9'));router[_0x196a('0xa')]('/',auth[_0x196a('0xb')](),controller[_0x196a('0xc')]);router['get'](_0x196a('0xd'),auth[_0x196a('0xb')](),controller[_0x196a('0xe')]);router['get'](_0x196a('0xf'),auth[_0x196a('0xb')](),controller[_0x196a('0x10')]);router[_0x196a('0xa')](_0x196a('0x11'),auth[_0x196a('0xb')](),controller[_0x196a('0x12')]);router['get'](_0x196a('0x13'),auth[_0x196a('0xb')](),controller[_0x196a('0x14')]);router['post']('/',auth['isAuthenticated'](),controller[_0x196a('0x15')]);router['put'](_0x196a('0xd'),auth[_0x196a('0xb')](),controller[_0x196a('0x16')]);router[_0x196a('0x17')]('/:id',auth[_0x196a('0xb')](),controller[_0x196a('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 051eceb..e014350 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 _0x6dec=['STRING','sequelize'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0x6dec,0xcf));var _0xc6de=function(_0x562b4a,_0x1d0dc4){_0x562b4a=_0x562b4a-0x0;var _0x1cc1e5=_0x6dec[_0x562b4a];return _0x1cc1e5;};'use strict';var Sequelize=require(_0xc6de('0x0'));module['exports']={'name':{'type':Sequelize[_0xc6de('0x1')]},'description':{'type':Sequelize[_0xc6de('0x1')]}}; \ No newline at end of file +var _0x520e=['exports','STRING'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x520e,0x160));var _0xe520=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0x520e[_0x4c7fb5];return _0x2e10ac;};'use strict';var Sequelize=require('sequelize');module[_0xe520('0x0')]={'name':{'type':Sequelize[_0xe520('0x1')]},'description':{'type':Sequelize[_0xe520('0x1')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 95bde2a..bceff30 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 _0x55dc=['pick','getFields','getSubjects','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','ServicenowConfiguration','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','findAll','catch','rawAttributes','include','find','create','body','params','findOne','ServicenowField'];(function(_0x33d538,_0x1b5605){var _0x2fca45=function(_0x190877){while(--_0x190877){_0x33d538['push'](_0x33d538['shift']());}};_0x2fca45(++_0x1b5605);}(_0x55dc,0x1e3));var _0xc55d=function(_0xcd4e86,_0x10338c){_0xcd4e86=_0xcd4e86-0x0;var _0x3b10ed=_0x55dc[_0xcd4e86];return _0x3b10ed;};'use strict';var emlformat=require(_0xc55d('0x0'));var rimraf=require(_0xc55d('0x1'));var zipdir=require(_0xc55d('0x2'));var jsonpatch=require(_0xc55d('0x3'));var rp=require(_0xc55d('0x4'));var moment=require(_0xc55d('0x5'));var BPromise=require(_0xc55d('0x6'));var Mustache=require('mustache');var util=require(_0xc55d('0x7'));var path=require(_0xc55d('0x8'));var sox=require(_0xc55d('0x9'));var csv=require(_0xc55d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc55d('0xb'));var _=require(_0xc55d('0xc'));var squel=require(_0xc55d('0xd'));var crypto=require(_0xc55d('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc55d('0xf'));var toCsv=require(_0xc55d('0xa'));var querystring=require(_0xc55d('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xc55d('0x11'));var qs=require(_0xc55d('0x12'));var as=require(_0xc55d('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc55d('0x14'))(_0xc55d('0x15'));var utils=require(_0xc55d('0x16'));var config=require(_0xc55d('0x17'));var licenseUtil=require(_0xc55d('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x28c20f,_0x410465){_0x410465=_0x410465||0xcc;return function(_0x47c94c){if(_0x47c94c){return _0x28c20f['sendStatus'](_0x410465);}return _0x28c20f['status'](_0x410465)[_0xc55d('0x19')]();};}function respondWithResult(_0x15ae35,_0x5aeb3a){_0x5aeb3a=_0x5aeb3a||0xc8;return function(_0x3c5b4b){if(_0x3c5b4b){return _0x15ae35[_0xc55d('0x1a')](_0x5aeb3a)[_0xc55d('0x1b')](_0x3c5b4b);}};}function respondWithFilteredResult(_0x15705a,_0x229970){return function(_0x55c832){if(_0x55c832){var _0x22adee=typeof _0x229970[_0xc55d('0x1c')]===_0xc55d('0x1d')&&typeof _0x229970[_0xc55d('0x1e')]===_0xc55d('0x1d');var _0x4772e8=_0x55c832[_0xc55d('0x1f')];var _0x39d597=_0x22adee?0x0:_0x229970[_0xc55d('0x1c')];var _0x28c8d0=_0x22adee?_0x55c832[_0xc55d('0x1f')]:_0x229970['offset']+_0x229970['limit'];var _0x2db224;if(_0x28c8d0>=_0x4772e8){_0x28c8d0=_0x4772e8;_0x2db224=0xc8;}else{_0x2db224=0xce;}_0x15705a[_0xc55d('0x1a')](_0x2db224);return _0x15705a[_0xc55d('0x20')]('Content-Range',_0x39d597+'-'+_0x28c8d0+'/'+_0x4772e8)[_0xc55d('0x1b')](_0x55c832);}return null;};}function patchUpdates(_0x43ad50){return function(_0x38c048){try{jsonpatch[_0xc55d('0x21')](_0x38c048,_0x43ad50,!![]);}catch(_0x5b9a8d){return BPromise[_0xc55d('0x22')](_0x5b9a8d);}return _0x38c048[_0xc55d('0x23')]();};}function saveUpdates(_0x4a5b2b,_0x89ec9d){return function(_0x4cb9d0){if(_0x4cb9d0){return _0x4cb9d0[_0xc55d('0x24')](_0x4a5b2b)[_0xc55d('0x25')](function(_0x343ab6){return _0x343ab6;});}return null;};}function removeEntity(_0x1938f0,_0x1d27c8){return function(_0x21a91f){if(_0x21a91f){return _0x21a91f[_0xc55d('0x26')]()[_0xc55d('0x25')](function(){_0x1938f0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x53b2c5,_0x406ef6){return function(_0x530415){if(!_0x530415){_0x53b2c5[_0xc55d('0x27')](0x194);}return _0x530415;};}function handleError(_0x148e31,_0x40c7fe){_0x40c7fe=_0x40c7fe||0x1f4;return function(_0x33ae45){logger['error'](_0x33ae45[_0xc55d('0x28')]);if(_0x33ae45[_0xc55d('0x29')]){delete _0x33ae45[_0xc55d('0x29')];}_0x148e31[_0xc55d('0x1a')](_0x40c7fe)[_0xc55d('0x2a')](_0x33ae45);};}exports[_0xc55d('0x2b')]=function(_0x457040,_0x454222){var _0x4db568={},_0x5229b6={},_0x6c4623={'count':0x0,'rows':[]};var _0x43bd8f=_[_0xc55d('0x2c')](db[_0xc55d('0x2d')]['rawAttributes'],function(_0x132c20){return{'name':_0x132c20[_0xc55d('0x2e')],'type':_0x132c20[_0xc55d('0x2f')][_0xc55d('0x30')]};});_0x5229b6[_0xc55d('0x31')]=_[_0xc55d('0x2c')](_0x43bd8f,_0xc55d('0x29'));_0x5229b6[_0xc55d('0x32')]=_[_0xc55d('0x33')](_0x457040[_0xc55d('0x32')]);_0x5229b6['filters']=_[_0xc55d('0x34')](_0x5229b6[_0xc55d('0x31')],_0x5229b6[_0xc55d('0x32')]);_0x4db568[_0xc55d('0x35')]=_[_0xc55d('0x34')](_0x5229b6['model'],qs['fields'](_0x457040[_0xc55d('0x32')][_0xc55d('0x36')]));_0x4db568[_0xc55d('0x35')]=_0x4db568[_0xc55d('0x35')][_0xc55d('0x37')]?_0x4db568[_0xc55d('0x35')]:_0x5229b6[_0xc55d('0x31')];if(!_0x457040[_0xc55d('0x32')][_0xc55d('0x38')](_0xc55d('0x39'))){_0x4db568[_0xc55d('0x1e')]=qs[_0xc55d('0x1e')](_0x457040[_0xc55d('0x32')]['limit']);_0x4db568[_0xc55d('0x1c')]=qs[_0xc55d('0x1c')](_0x457040[_0xc55d('0x32')][_0xc55d('0x1c')]);}_0x4db568[_0xc55d('0x3a')]=qs[_0xc55d('0x3b')](_0x457040[_0xc55d('0x32')][_0xc55d('0x3b')]);_0x4db568[_0xc55d('0x3c')]=qs['filters'](_['pick'](_0x457040[_0xc55d('0x32')],_0x5229b6[_0xc55d('0x3d')]),_0x43bd8f);if(_0x457040[_0xc55d('0x32')][_0xc55d('0x3e')]){_0x4db568['where']=_[_0xc55d('0x3f')](_0x4db568[_0xc55d('0x3c')],{'$or':_[_0xc55d('0x2c')](_0x43bd8f,function(_0x14ef04){if(_0x14ef04['type']!==_0xc55d('0x40')){var _0x23b21d={};_0x23b21d[_0x14ef04['name']]={'$like':'%'+_0x457040[_0xc55d('0x32')]['filter']+'%'};return _0x23b21d;}})});}_0x4db568=_[_0xc55d('0x3f')]({},_0x4db568,_0x457040[_0xc55d('0x41')]);var _0x26f715={'where':_0x4db568[_0xc55d('0x3c')]};return db[_0xc55d('0x2d')][_0xc55d('0x1f')](_0x26f715)[_0xc55d('0x25')](function(_0x2950b3){_0x6c4623[_0xc55d('0x1f')]=_0x2950b3;if(_0x457040[_0xc55d('0x32')][_0xc55d('0x42')]){_0x4db568['include']=[{'all':!![]}];}return db[_0xc55d('0x2d')][_0xc55d('0x43')](_0x4db568);})['then'](function(_0x4fe90b){_0x6c4623['rows']=_0x4fe90b;return _0x6c4623;})['then'](respondWithFilteredResult(_0x454222,_0x4db568))[_0xc55d('0x44')](handleError(_0x454222,null));};exports['show']=function(_0x3d2cdd,_0x7cb595){var _0x88e685={'raw':![],'where':{'id':_0x3d2cdd['params']['id']}},_0x484d80={};_0x484d80[_0xc55d('0x31')]=_[_0xc55d('0x33')](db[_0xc55d('0x2d')][_0xc55d('0x45')]);_0x484d80[_0xc55d('0x32')]=_['keys'](_0x3d2cdd['query']);_0x484d80[_0xc55d('0x3d')]=_[_0xc55d('0x34')](_0x484d80[_0xc55d('0x31')],_0x484d80['query']);_0x88e685[_0xc55d('0x35')]=_[_0xc55d('0x34')](_0x484d80[_0xc55d('0x31')],qs[_0xc55d('0x36')](_0x3d2cdd['query'][_0xc55d('0x36')]));_0x88e685['attributes']=_0x88e685[_0xc55d('0x35')]['length']?_0x88e685[_0xc55d('0x35')]:_0x484d80['model'];if(_0x3d2cdd[_0xc55d('0x32')]['includeAll']){_0x88e685[_0xc55d('0x46')]=[{'all':!![]}];}_0x88e685=_[_0xc55d('0x3f')]({},_0x88e685,_0x3d2cdd['options']);return db[_0xc55d('0x2d')][_0xc55d('0x47')](_0x88e685)['then'](handleEntityNotFound(_0x7cb595,null))[_0xc55d('0x25')](respondWithResult(_0x7cb595,null))[_0xc55d('0x44')](handleError(_0x7cb595,null));};exports[_0xc55d('0x48')]=function(_0x4d971c,_0x2a97aa){return db[_0xc55d('0x2d')][_0xc55d('0x48')](_0x4d971c['body'],{})[_0xc55d('0x25')](respondWithResult(_0x2a97aa,0xc9))[_0xc55d('0x44')](handleError(_0x2a97aa,null));};exports[_0xc55d('0x24')]=function(_0x24420a,_0x157e02){if(_0x24420a[_0xc55d('0x49')]['id']){delete _0x24420a[_0xc55d('0x49')]['id'];}return db[_0xc55d('0x2d')][_0xc55d('0x47')]({'where':{'id':_0x24420a[_0xc55d('0x4a')]['id']}})['then'](handleEntityNotFound(_0x157e02,null))[_0xc55d('0x25')](saveUpdates(_0x24420a[_0xc55d('0x49')],null))['then'](respondWithResult(_0x157e02,null))[_0xc55d('0x44')](handleError(_0x157e02,null));};exports['destroy']=function(_0x3fb0e5,_0x599332){return db[_0xc55d('0x2d')][_0xc55d('0x47')]({'where':{'id':_0x3fb0e5['params']['id']}})[_0xc55d('0x25')](handleEntityNotFound(_0x599332,null))[_0xc55d('0x25')](removeEntity(_0x599332,null))[_0xc55d('0x44')](handleError(_0x599332,null));};exports['getFields']=function(_0x3e44e9,_0x27c47d,_0x5478d7){var _0x12cf06={};var _0x3317fe={};var _0x553f21;var _0x460454;return db[_0xc55d('0x2d')][_0xc55d('0x4b')]({'where':{'id':_0x3e44e9[_0xc55d('0x4a')]['id']}})[_0xc55d('0x25')](handleEntityNotFound(_0x27c47d,null))['then'](function(_0x56fb30){if(_0x56fb30){_0x553f21=_0x56fb30;_0x3317fe[_0xc55d('0x31')]=_['keys'](db[_0xc55d('0x4c')]['rawAttributes']);_0x3317fe[_0xc55d('0x32')]=_[_0xc55d('0x33')](_0x3e44e9['query']);_0x3317fe['filters']=_[_0xc55d('0x34')](_0x3317fe[_0xc55d('0x31')],_0x3317fe['query']);_0x12cf06[_0xc55d('0x35')]=_[_0xc55d('0x34')](_0x3317fe[_0xc55d('0x31')],qs[_0xc55d('0x36')](_0x3e44e9[_0xc55d('0x32')][_0xc55d('0x36')]));_0x12cf06[_0xc55d('0x35')]=_0x12cf06[_0xc55d('0x35')][_0xc55d('0x37')]?_0x12cf06[_0xc55d('0x35')]:_0x3317fe[_0xc55d('0x31')];_0x12cf06['order']=qs['sort'](_0x3e44e9['query'][_0xc55d('0x3b')]);_0x12cf06[_0xc55d('0x3c')]=qs[_0xc55d('0x3d')](_[_0xc55d('0x4d')](_0x3e44e9[_0xc55d('0x32')],_0x3317fe['filters']));if(_0x3e44e9[_0xc55d('0x32')][_0xc55d('0x3e')]){_0x12cf06[_0xc55d('0x3c')]=_['merge'](_0x12cf06[_0xc55d('0x3c')],{'$or':_[_0xc55d('0x2c')](_0x12cf06[_0xc55d('0x35')],function(_0x238bfe){var _0x5490e1={};_0x5490e1[_0x238bfe]={'$like':'%'+_0x3e44e9[_0xc55d('0x32')]['filter']+'%'};return _0x5490e1;})});}_0x12cf06=_[_0xc55d('0x3f')]({},_0x12cf06,_0x3e44e9[_0xc55d('0x41')]);return _0x553f21[_0xc55d('0x4e')](_0x12cf06);}})[_0xc55d('0x25')](function(_0x305265){if(_0x305265){_0x460454=_0x305265[_0xc55d('0x37')];if(!_0x3e44e9['query']['hasOwnProperty'](_0xc55d('0x39'))){_0x12cf06[_0xc55d('0x1e')]=qs['limit'](_0x3e44e9[_0xc55d('0x32')]['limit']);_0x12cf06['offset']=qs[_0xc55d('0x1c')](_0x3e44e9[_0xc55d('0x32')][_0xc55d('0x1c')]);}return _0x553f21[_0xc55d('0x4e')](_0x12cf06);}})[_0xc55d('0x25')](function(_0xe2d3af){if(_0xe2d3af){return _0xe2d3af?{'count':_0x460454,'rows':_0xe2d3af}:null;}})[_0xc55d('0x25')](respondWithResult(_0x27c47d,null))[_0xc55d('0x44')](handleError(_0x27c47d,null));};exports[_0xc55d('0x4f')]=function(_0xd34bb,_0x45af42,_0x20f884){var _0xaebd9f={};var _0x529a5f={};var _0x4c2509;var _0x31d8cf;return db[_0xc55d('0x2d')][_0xc55d('0x4b')]({'where':{'id':_0xd34bb[_0xc55d('0x4a')]['id']}})['then'](handleEntityNotFound(_0x45af42,null))['then'](function(_0x1f507b){if(_0x1f507b){_0x4c2509=_0x1f507b;_0x529a5f[_0xc55d('0x31')]=_[_0xc55d('0x33')](db[_0xc55d('0x4c')]['rawAttributes']);_0x529a5f[_0xc55d('0x32')]=_[_0xc55d('0x33')](_0xd34bb[_0xc55d('0x32')]);_0x529a5f['filters']=_[_0xc55d('0x34')](_0x529a5f[_0xc55d('0x31')],_0x529a5f[_0xc55d('0x32')]);_0xaebd9f[_0xc55d('0x35')]=_[_0xc55d('0x34')](_0x529a5f[_0xc55d('0x31')],qs[_0xc55d('0x36')](_0xd34bb[_0xc55d('0x32')][_0xc55d('0x36')]));_0xaebd9f[_0xc55d('0x35')]=_0xaebd9f[_0xc55d('0x35')][_0xc55d('0x37')]?_0xaebd9f[_0xc55d('0x35')]:_0x529a5f['model'];_0xaebd9f[_0xc55d('0x3a')]=qs[_0xc55d('0x3b')](_0xd34bb[_0xc55d('0x32')]['sort']);_0xaebd9f[_0xc55d('0x3c')]=qs[_0xc55d('0x3d')](_[_0xc55d('0x4d')](_0xd34bb[_0xc55d('0x32')],_0x529a5f[_0xc55d('0x3d')]));if(_0xd34bb[_0xc55d('0x32')][_0xc55d('0x3e')]){_0xaebd9f[_0xc55d('0x3c')]=_['merge'](_0xaebd9f[_0xc55d('0x3c')],{'$or':_[_0xc55d('0x2c')](_0xaebd9f[_0xc55d('0x35')],function(_0x353c6c){var _0x51e4d5={};_0x51e4d5[_0x353c6c]={'$like':'%'+_0xd34bb[_0xc55d('0x32')][_0xc55d('0x3e')]+'%'};return _0x51e4d5;})});}_0xaebd9f=_[_0xc55d('0x3f')]({},_0xaebd9f,_0xd34bb['options']);return _0x4c2509[_0xc55d('0x4f')](_0xaebd9f);}})['then'](function(_0x514eae){if(_0x514eae){_0x31d8cf=_0x514eae[_0xc55d('0x37')];if(!_0xd34bb[_0xc55d('0x32')]['hasOwnProperty'](_0xc55d('0x39'))){_0xaebd9f[_0xc55d('0x1e')]=qs[_0xc55d('0x1e')](_0xd34bb[_0xc55d('0x32')][_0xc55d('0x1e')]);_0xaebd9f[_0xc55d('0x1c')]=qs[_0xc55d('0x1c')](_0xd34bb[_0xc55d('0x32')][_0xc55d('0x1c')]);}return _0x4c2509[_0xc55d('0x4f')](_0xaebd9f);}})[_0xc55d('0x25')](function(_0x46e34e){if(_0x46e34e){return _0x46e34e?{'count':_0x31d8cf,'rows':_0x46e34e}:null;}})[_0xc55d('0x25')](respondWithResult(_0x45af42,null))['catch'](handleError(_0x45af42,null));};exports['getDescriptions']=function(_0x38276f,_0x32deeb,_0x402c6c){var _0x25b767={};var _0x3ba527={};var _0x58dfff;var _0x4c0507;return db[_0xc55d('0x2d')][_0xc55d('0x4b')]({'where':{'id':_0x38276f['params']['id']}})[_0xc55d('0x25')](handleEntityNotFound(_0x32deeb,null))[_0xc55d('0x25')](function(_0x151abf){if(_0x151abf){_0x58dfff=_0x151abf;_0x3ba527[_0xc55d('0x31')]=_[_0xc55d('0x33')](db['ServicenowField']['rawAttributes']);_0x3ba527[_0xc55d('0x32')]=_[_0xc55d('0x33')](_0x38276f['query']);_0x3ba527[_0xc55d('0x3d')]=_[_0xc55d('0x34')](_0x3ba527[_0xc55d('0x31')],_0x3ba527[_0xc55d('0x32')]);_0x25b767[_0xc55d('0x35')]=_[_0xc55d('0x34')](_0x3ba527[_0xc55d('0x31')],qs['fields'](_0x38276f[_0xc55d('0x32')][_0xc55d('0x36')]));_0x25b767[_0xc55d('0x35')]=_0x25b767[_0xc55d('0x35')][_0xc55d('0x37')]?_0x25b767[_0xc55d('0x35')]:_0x3ba527[_0xc55d('0x31')];_0x25b767[_0xc55d('0x3a')]=qs[_0xc55d('0x3b')](_0x38276f[_0xc55d('0x32')][_0xc55d('0x3b')]);_0x25b767[_0xc55d('0x3c')]=qs[_0xc55d('0x3d')](_[_0xc55d('0x4d')](_0x38276f['query'],_0x3ba527[_0xc55d('0x3d')]));if(_0x38276f[_0xc55d('0x32')]['filter']){_0x25b767['where']=_['merge'](_0x25b767['where'],{'$or':_[_0xc55d('0x2c')](_0x25b767[_0xc55d('0x35')],function(_0x324b7e){var _0x4c50c1={};_0x4c50c1[_0x324b7e]={'$like':'%'+_0x38276f[_0xc55d('0x32')][_0xc55d('0x3e')]+'%'};return _0x4c50c1;})});}_0x25b767=_[_0xc55d('0x3f')]({},_0x25b767,_0x38276f[_0xc55d('0x41')]);return _0x58dfff['getDescriptions'](_0x25b767);}})['then'](function(_0x4939e1){if(_0x4939e1){_0x4c0507=_0x4939e1[_0xc55d('0x37')];if(!_0x38276f[_0xc55d('0x32')][_0xc55d('0x38')]('nolimit')){_0x25b767[_0xc55d('0x1e')]=qs['limit'](_0x38276f[_0xc55d('0x32')][_0xc55d('0x1e')]);_0x25b767[_0xc55d('0x1c')]=qs[_0xc55d('0x1c')](_0x38276f[_0xc55d('0x32')][_0xc55d('0x1c')]);}return _0x58dfff['getDescriptions'](_0x25b767);}})[_0xc55d('0x25')](function(_0x5f37ac){if(_0x5f37ac){return _0x5f37ac?{'count':_0x4c0507,'rows':_0x5f37ac}:null;}})[_0xc55d('0x25')](respondWithResult(_0x32deeb,null))[_0xc55d('0x44')](handleError(_0x32deeb,null));}; \ No newline at end of file +var _0xbfae=['end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','destroy','then','stack','index','map','ServicenowConfiguration','fieldName','type','key','name','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','rawAttributes','options','create','body','update','find','getFields','findOne','ServicenowField','sort','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','status'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbfae,0x120));var _0xebfa=function(_0x1297e2,_0x53276f){_0x1297e2=_0x1297e2-0x0;var _0x5a7568=_0xbfae[_0x1297e2];return _0x5a7568;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xebfa('0x0'));var zipdir=require(_0xebfa('0x1'));var jsonpatch=require(_0xebfa('0x2'));var rp=require(_0xebfa('0x3'));var moment=require(_0xebfa('0x4'));var BPromise=require(_0xebfa('0x5'));var Mustache=require(_0xebfa('0x6'));var util=require(_0xebfa('0x7'));var path=require(_0xebfa('0x8'));var sox=require(_0xebfa('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xebfa('0xa'));var squel=require(_0xebfa('0xb'));var crypto=require('crypto');var jsforce=require(_0xebfa('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xebfa('0xd'));var querystring=require('querystring');var Papa=require(_0xebfa('0xe'));var Redis=require(_0xebfa('0xf'));var authService=require(_0xebfa('0x10'));var qs=require(_0xebfa('0x11'));var as=require(_0xebfa('0x12'));var hardwareService=require(_0xebfa('0x13'));var logger=require(_0xebfa('0x14'))(_0xebfa('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xebfa('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3f5333,_0x25a53f){_0x25a53f=_0x25a53f||0xcc;return function(_0x13f2f8){if(_0x13f2f8){return _0x3f5333['sendStatus'](_0x25a53f);}return _0x3f5333[_0xebfa('0x17')](_0x25a53f)[_0xebfa('0x18')]();};}function respondWithResult(_0x1910b7,_0x367839){_0x367839=_0x367839||0xc8;return function(_0x36ec34){if(_0x36ec34){return _0x1910b7[_0xebfa('0x17')](_0x367839)[_0xebfa('0x19')](_0x36ec34);}};}function respondWithFilteredResult(_0x13fc32,_0x1730c4){return function(_0x285d6e){if(_0x285d6e){var _0x1b6af2=typeof _0x1730c4[_0xebfa('0x1a')]===_0xebfa('0x1b')&&typeof _0x1730c4[_0xebfa('0x1c')]===_0xebfa('0x1b');var _0x25b922=_0x285d6e[_0xebfa('0x1d')];var _0x238ee2=_0x1b6af2?0x0:_0x1730c4[_0xebfa('0x1a')];var _0x593b2e=_0x1b6af2?_0x285d6e['count']:_0x1730c4[_0xebfa('0x1a')]+_0x1730c4['limit'];var _0x235f93;if(_0x593b2e>=_0x25b922){_0x593b2e=_0x25b922;_0x235f93=0xc8;}else{_0x235f93=0xce;}_0x13fc32[_0xebfa('0x17')](_0x235f93);return _0x13fc32['set'](_0xebfa('0x1e'),_0x238ee2+'-'+_0x593b2e+'/'+_0x25b922)['json'](_0x285d6e);}return null;};}function patchUpdates(_0x50e3dc){return function(_0x2a0dd9){try{jsonpatch[_0xebfa('0x1f')](_0x2a0dd9,_0x50e3dc,!![]);}catch(_0x14db31){return BPromise[_0xebfa('0x20')](_0x14db31);}return _0x2a0dd9[_0xebfa('0x21')]();};}function saveUpdates(_0x4ac3b5,_0x32d9eb){return function(_0x50223a){if(_0x50223a){return _0x50223a['update'](_0x4ac3b5)['then'](function(_0x58ba51){return _0x58ba51;});}return null;};}function removeEntity(_0x3d5a5a,_0x1d1023){return function(_0x389e43){if(_0x389e43){return _0x389e43[_0xebfa('0x22')]()[_0xebfa('0x23')](function(){_0x3d5a5a[_0xebfa('0x17')](0xcc)[_0xebfa('0x18')]();});}};}function handleEntityNotFound(_0x196441,_0x1c08f5){return function(_0x227281){if(!_0x227281){_0x196441['sendStatus'](0x194);}return _0x227281;};}function handleError(_0x392903,_0x267dc0){_0x267dc0=_0x267dc0||0x1f4;return function(_0x41e92f){logger['error'](_0x41e92f[_0xebfa('0x24')]);if(_0x41e92f['name']){delete _0x41e92f['name'];}_0x392903[_0xebfa('0x17')](_0x267dc0)['send'](_0x41e92f);};}exports[_0xebfa('0x25')]=function(_0x352040,_0x334f97){var _0x20e8bf={},_0x38cccc={},_0x2eed9e={'count':0x0,'rows':[]};var _0x235ea5=_[_0xebfa('0x26')](db[_0xebfa('0x27')]['rawAttributes'],function(_0xc0d4ae){return{'name':_0xc0d4ae[_0xebfa('0x28')],'type':_0xc0d4ae[_0xebfa('0x29')][_0xebfa('0x2a')]};});_0x38cccc['model']=_['map'](_0x235ea5,_0xebfa('0x2b'));_0x38cccc[_0xebfa('0x2c')]=_[_0xebfa('0x2d')](_0x352040[_0xebfa('0x2c')]);_0x38cccc['filters']=_[_0xebfa('0x2e')](_0x38cccc['model'],_0x38cccc[_0xebfa('0x2c')]);_0x20e8bf[_0xebfa('0x2f')]=_[_0xebfa('0x2e')](_0x38cccc[_0xebfa('0x30')],qs[_0xebfa('0x31')](_0x352040['query']['fields']));_0x20e8bf[_0xebfa('0x2f')]=_0x20e8bf[_0xebfa('0x2f')][_0xebfa('0x32')]?_0x20e8bf[_0xebfa('0x2f')]:_0x38cccc['model'];if(!_0x352040[_0xebfa('0x2c')][_0xebfa('0x33')](_0xebfa('0x34'))){_0x20e8bf['limit']=qs[_0xebfa('0x1c')](_0x352040[_0xebfa('0x2c')]['limit']);_0x20e8bf[_0xebfa('0x1a')]=qs[_0xebfa('0x1a')](_0x352040['query'][_0xebfa('0x1a')]);}_0x20e8bf[_0xebfa('0x35')]=qs['sort'](_0x352040['query']['sort']);_0x20e8bf[_0xebfa('0x36')]=qs[_0xebfa('0x37')](_[_0xebfa('0x38')](_0x352040[_0xebfa('0x2c')],_0x38cccc[_0xebfa('0x37')]),_0x235ea5);if(_0x352040[_0xebfa('0x2c')][_0xebfa('0x39')]){_0x20e8bf[_0xebfa('0x36')]=_[_0xebfa('0x3a')](_0x20e8bf[_0xebfa('0x36')],{'$or':_['map'](_0x235ea5,function(_0x494d6d){if(_0x494d6d['type']!==_0xebfa('0x3b')){var _0x3946c0={};_0x3946c0[_0x494d6d['name']]={'$like':'%'+_0x352040[_0xebfa('0x2c')][_0xebfa('0x39')]+'%'};return _0x3946c0;}})});}_0x20e8bf=_['merge']({},_0x20e8bf,_0x352040['options']);var _0x52abd9={'where':_0x20e8bf['where']};return db[_0xebfa('0x27')]['count'](_0x52abd9)[_0xebfa('0x23')](function(_0x40574c){_0x2eed9e['count']=_0x40574c;if(_0x352040[_0xebfa('0x2c')][_0xebfa('0x3c')]){_0x20e8bf[_0xebfa('0x3d')]=[{'all':!![]}];}return db[_0xebfa('0x27')][_0xebfa('0x3e')](_0x20e8bf);})[_0xebfa('0x23')](function(_0x276a94){_0x2eed9e['rows']=_0x276a94;return _0x2eed9e;})['then'](respondWithFilteredResult(_0x334f97,_0x20e8bf))[_0xebfa('0x3f')](handleError(_0x334f97,null));};exports[_0xebfa('0x40')]=function(_0x4a77c8,_0x100602){var _0x5ca5bd={'raw':![],'where':{'id':_0x4a77c8[_0xebfa('0x41')]['id']}},_0x87c87f={};_0x87c87f[_0xebfa('0x30')]=_[_0xebfa('0x2d')](db[_0xebfa('0x27')][_0xebfa('0x42')]);_0x87c87f[_0xebfa('0x2c')]=_[_0xebfa('0x2d')](_0x4a77c8[_0xebfa('0x2c')]);_0x87c87f[_0xebfa('0x37')]=_[_0xebfa('0x2e')](_0x87c87f[_0xebfa('0x30')],_0x87c87f[_0xebfa('0x2c')]);_0x5ca5bd[_0xebfa('0x2f')]=_[_0xebfa('0x2e')](_0x87c87f[_0xebfa('0x30')],qs[_0xebfa('0x31')](_0x4a77c8[_0xebfa('0x2c')][_0xebfa('0x31')]));_0x5ca5bd[_0xebfa('0x2f')]=_0x5ca5bd[_0xebfa('0x2f')][_0xebfa('0x32')]?_0x5ca5bd[_0xebfa('0x2f')]:_0x87c87f[_0xebfa('0x30')];if(_0x4a77c8[_0xebfa('0x2c')][_0xebfa('0x3c')]){_0x5ca5bd[_0xebfa('0x3d')]=[{'all':!![]}];}_0x5ca5bd=_[_0xebfa('0x3a')]({},_0x5ca5bd,_0x4a77c8[_0xebfa('0x43')]);return db[_0xebfa('0x27')]['find'](_0x5ca5bd)[_0xebfa('0x23')](handleEntityNotFound(_0x100602,null))[_0xebfa('0x23')](respondWithResult(_0x100602,null))[_0xebfa('0x3f')](handleError(_0x100602,null));};exports[_0xebfa('0x44')]=function(_0x169287,_0x128d08){return db[_0xebfa('0x27')][_0xebfa('0x44')](_0x169287[_0xebfa('0x45')],{})[_0xebfa('0x23')](respondWithResult(_0x128d08,0xc9))['catch'](handleError(_0x128d08,null));};exports[_0xebfa('0x46')]=function(_0x1d0dde,_0x58fc67){if(_0x1d0dde['body']['id']){delete _0x1d0dde[_0xebfa('0x45')]['id'];}return db[_0xebfa('0x27')][_0xebfa('0x47')]({'where':{'id':_0x1d0dde[_0xebfa('0x41')]['id']}})[_0xebfa('0x23')](handleEntityNotFound(_0x58fc67,null))[_0xebfa('0x23')](saveUpdates(_0x1d0dde[_0xebfa('0x45')],null))[_0xebfa('0x23')](respondWithResult(_0x58fc67,null))[_0xebfa('0x3f')](handleError(_0x58fc67,null));};exports[_0xebfa('0x22')]=function(_0x2a8e8f,_0x59a316){return db['ServicenowConfiguration'][_0xebfa('0x47')]({'where':{'id':_0x2a8e8f[_0xebfa('0x41')]['id']}})['then'](handleEntityNotFound(_0x59a316,null))[_0xebfa('0x23')](removeEntity(_0x59a316,null))[_0xebfa('0x3f')](handleError(_0x59a316,null));};exports[_0xebfa('0x48')]=function(_0x31c177,_0x2a4d0a,_0x249d5a){var _0x51e4ac={};var _0x31c81e={};var _0x4a41ad;var _0x3a267b;return db[_0xebfa('0x27')][_0xebfa('0x49')]({'where':{'id':_0x31c177[_0xebfa('0x41')]['id']}})[_0xebfa('0x23')](handleEntityNotFound(_0x2a4d0a,null))[_0xebfa('0x23')](function(_0x55873a){if(_0x55873a){_0x4a41ad=_0x55873a;_0x31c81e[_0xebfa('0x30')]=_[_0xebfa('0x2d')](db[_0xebfa('0x4a')][_0xebfa('0x42')]);_0x31c81e['query']=_[_0xebfa('0x2d')](_0x31c177[_0xebfa('0x2c')]);_0x31c81e[_0xebfa('0x37')]=_['intersection'](_0x31c81e['model'],_0x31c81e['query']);_0x51e4ac[_0xebfa('0x2f')]=_[_0xebfa('0x2e')](_0x31c81e['model'],qs[_0xebfa('0x31')](_0x31c177[_0xebfa('0x2c')]['fields']));_0x51e4ac[_0xebfa('0x2f')]=_0x51e4ac[_0xebfa('0x2f')][_0xebfa('0x32')]?_0x51e4ac['attributes']:_0x31c81e[_0xebfa('0x30')];_0x51e4ac[_0xebfa('0x35')]=qs['sort'](_0x31c177[_0xebfa('0x2c')][_0xebfa('0x4b')]);_0x51e4ac[_0xebfa('0x36')]=qs['filters'](_[_0xebfa('0x38')](_0x31c177['query'],_0x31c81e['filters']));if(_0x31c177[_0xebfa('0x2c')][_0xebfa('0x39')]){_0x51e4ac[_0xebfa('0x36')]=_[_0xebfa('0x3a')](_0x51e4ac[_0xebfa('0x36')],{'$or':_['map'](_0x51e4ac[_0xebfa('0x2f')],function(_0x570431){var _0x34b2fb={};_0x34b2fb[_0x570431]={'$like':'%'+_0x31c177[_0xebfa('0x2c')][_0xebfa('0x39')]+'%'};return _0x34b2fb;})});}_0x51e4ac=_[_0xebfa('0x3a')]({},_0x51e4ac,_0x31c177[_0xebfa('0x43')]);return _0x4a41ad[_0xebfa('0x48')](_0x51e4ac);}})[_0xebfa('0x23')](function(_0x744fb7){if(_0x744fb7){_0x3a267b=_0x744fb7[_0xebfa('0x32')];if(!_0x31c177[_0xebfa('0x2c')][_0xebfa('0x33')](_0xebfa('0x34'))){_0x51e4ac[_0xebfa('0x1c')]=qs['limit'](_0x31c177[_0xebfa('0x2c')][_0xebfa('0x1c')]);_0x51e4ac[_0xebfa('0x1a')]=qs[_0xebfa('0x1a')](_0x31c177[_0xebfa('0x2c')][_0xebfa('0x1a')]);}return _0x4a41ad[_0xebfa('0x48')](_0x51e4ac);}})[_0xebfa('0x23')](function(_0x557309){if(_0x557309){return _0x557309?{'count':_0x3a267b,'rows':_0x557309}:null;}})['then'](respondWithResult(_0x2a4d0a,null))['catch'](handleError(_0x2a4d0a,null));};exports[_0xebfa('0x4c')]=function(_0x209d43,_0x15d7ee,_0x9a7bb9){var _0x3c680a={};var _0x2c3a4f={};var _0x1c1fb0;var _0x228fff;return db[_0xebfa('0x27')]['findOne']({'where':{'id':_0x209d43['params']['id']}})[_0xebfa('0x23')](handleEntityNotFound(_0x15d7ee,null))[_0xebfa('0x23')](function(_0x268790){if(_0x268790){_0x1c1fb0=_0x268790;_0x2c3a4f[_0xebfa('0x30')]=_[_0xebfa('0x2d')](db[_0xebfa('0x4a')][_0xebfa('0x42')]);_0x2c3a4f[_0xebfa('0x2c')]=_['keys'](_0x209d43[_0xebfa('0x2c')]);_0x2c3a4f[_0xebfa('0x37')]=_[_0xebfa('0x2e')](_0x2c3a4f[_0xebfa('0x30')],_0x2c3a4f[_0xebfa('0x2c')]);_0x3c680a['attributes']=_[_0xebfa('0x2e')](_0x2c3a4f['model'],qs[_0xebfa('0x31')](_0x209d43[_0xebfa('0x2c')][_0xebfa('0x31')]));_0x3c680a[_0xebfa('0x2f')]=_0x3c680a[_0xebfa('0x2f')][_0xebfa('0x32')]?_0x3c680a[_0xebfa('0x2f')]:_0x2c3a4f[_0xebfa('0x30')];_0x3c680a[_0xebfa('0x35')]=qs[_0xebfa('0x4b')](_0x209d43[_0xebfa('0x2c')]['sort']);_0x3c680a['where']=qs['filters'](_[_0xebfa('0x38')](_0x209d43[_0xebfa('0x2c')],_0x2c3a4f[_0xebfa('0x37')]));if(_0x209d43[_0xebfa('0x2c')][_0xebfa('0x39')]){_0x3c680a[_0xebfa('0x36')]=_['merge'](_0x3c680a[_0xebfa('0x36')],{'$or':_[_0xebfa('0x26')](_0x3c680a['attributes'],function(_0x414b84){var _0x3ec96a={};_0x3ec96a[_0x414b84]={'$like':'%'+_0x209d43['query'][_0xebfa('0x39')]+'%'};return _0x3ec96a;})});}_0x3c680a=_[_0xebfa('0x3a')]({},_0x3c680a,_0x209d43[_0xebfa('0x43')]);return _0x1c1fb0[_0xebfa('0x4c')](_0x3c680a);}})[_0xebfa('0x23')](function(_0x334317){if(_0x334317){_0x228fff=_0x334317['length'];if(!_0x209d43[_0xebfa('0x2c')][_0xebfa('0x33')](_0xebfa('0x34'))){_0x3c680a[_0xebfa('0x1c')]=qs[_0xebfa('0x1c')](_0x209d43[_0xebfa('0x2c')]['limit']);_0x3c680a[_0xebfa('0x1a')]=qs[_0xebfa('0x1a')](_0x209d43[_0xebfa('0x2c')][_0xebfa('0x1a')]);}return _0x1c1fb0[_0xebfa('0x4c')](_0x3c680a);}})[_0xebfa('0x23')](function(_0x145298){if(_0x145298){return _0x145298?{'count':_0x228fff,'rows':_0x145298}:null;}})[_0xebfa('0x23')](respondWithResult(_0x15d7ee,null))[_0xebfa('0x3f')](handleError(_0x15d7ee,null));};exports[_0xebfa('0x4d')]=function(_0x17ac68,_0x2ea2c3,_0x46096f){var _0x553a35={};var _0x364c7d={};var _0x4ce74d;var _0x55365b;return db[_0xebfa('0x27')][_0xebfa('0x49')]({'where':{'id':_0x17ac68[_0xebfa('0x41')]['id']}})['then'](handleEntityNotFound(_0x2ea2c3,null))[_0xebfa('0x23')](function(_0xbf8863){if(_0xbf8863){_0x4ce74d=_0xbf8863;_0x364c7d['model']=_[_0xebfa('0x2d')](db[_0xebfa('0x4a')][_0xebfa('0x42')]);_0x364c7d[_0xebfa('0x2c')]=_['keys'](_0x17ac68[_0xebfa('0x2c')]);_0x364c7d['filters']=_['intersection'](_0x364c7d[_0xebfa('0x30')],_0x364c7d[_0xebfa('0x2c')]);_0x553a35['attributes']=_['intersection'](_0x364c7d[_0xebfa('0x30')],qs[_0xebfa('0x31')](_0x17ac68[_0xebfa('0x2c')][_0xebfa('0x31')]));_0x553a35['attributes']=_0x553a35['attributes'][_0xebfa('0x32')]?_0x553a35[_0xebfa('0x2f')]:_0x364c7d[_0xebfa('0x30')];_0x553a35[_0xebfa('0x35')]=qs[_0xebfa('0x4b')](_0x17ac68[_0xebfa('0x2c')][_0xebfa('0x4b')]);_0x553a35[_0xebfa('0x36')]=qs['filters'](_[_0xebfa('0x38')](_0x17ac68[_0xebfa('0x2c')],_0x364c7d[_0xebfa('0x37')]));if(_0x17ac68[_0xebfa('0x2c')][_0xebfa('0x39')]){_0x553a35[_0xebfa('0x36')]=_[_0xebfa('0x3a')](_0x553a35[_0xebfa('0x36')],{'$or':_[_0xebfa('0x26')](_0x553a35[_0xebfa('0x2f')],function(_0x2e299d){var _0x583644={};_0x583644[_0x2e299d]={'$like':'%'+_0x17ac68[_0xebfa('0x2c')][_0xebfa('0x39')]+'%'};return _0x583644;})});}_0x553a35=_[_0xebfa('0x3a')]({},_0x553a35,_0x17ac68[_0xebfa('0x43')]);return _0x4ce74d[_0xebfa('0x4d')](_0x553a35);}})['then'](function(_0x43933a){if(_0x43933a){_0x55365b=_0x43933a[_0xebfa('0x32')];if(!_0x17ac68[_0xebfa('0x2c')]['hasOwnProperty'](_0xebfa('0x34'))){_0x553a35[_0xebfa('0x1c')]=qs['limit'](_0x17ac68[_0xebfa('0x2c')][_0xebfa('0x1c')]);_0x553a35[_0xebfa('0x1a')]=qs[_0xebfa('0x1a')](_0x17ac68[_0xebfa('0x2c')]['offset']);}return _0x4ce74d[_0xebfa('0x4d')](_0x553a35);}})[_0xebfa('0x23')](function(_0x2db331){if(_0x2db331){return _0x2db331?{'count':_0x55365b,'rows':_0x2db331}:null;}})[_0xebfa('0x23')](respondWithResult(_0x2ea2c3,null))[_0xebfa('0x3f')](handleError(_0x2ea2c3,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 731785a..60d3b21 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 _0x14a0=['../../config/logger','api','moment','bluebird','request-promise','path','./intServicenowConfiguration.attributes','exports','ServicenowConfiguration','int_servicenow_configurations','util'];(function(_0x37a528,_0x39e1e5){var _0x2f24b3=function(_0xb6f341){while(--_0xb6f341){_0x37a528['push'](_0x37a528['shift']());}};_0x2f24b3(++_0x39e1e5);}(_0x14a0,0x8e));var _0x014a=function(_0x44c078,_0x2d9cd3){_0x44c078=_0x44c078-0x0;var _0xdef368=_0x14a0[_0x44c078];return _0xdef368;};'use strict';var _=require('lodash');var util=require(_0x014a('0x0'));var logger=require(_0x014a('0x1'))(_0x014a('0x2'));var moment=require(_0x014a('0x3'));var BPromise=require(_0x014a('0x4'));var rp=require(_0x014a('0x5'));var fs=require('fs');var path=require(_0x014a('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x014a('0x7'));module[_0x014a('0x8')]=function(_0x38a22c,_0x5ec84d){return _0x38a22c['define'](_0x014a('0x9'),attributes,{'tableName':_0x014a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x40ac=['api','moment','bluebird','request-promise','path','rimraf','./intServicenowConfiguration.attributes','exports','ServicenowConfiguration','int_servicenow_configurations','lodash','../../config/logger'];(function(_0x2d340d,_0x35a2f6){var _0x38932a=function(_0x425276){while(--_0x425276){_0x2d340d['push'](_0x2d340d['shift']());}};_0x38932a(++_0x35a2f6);}(_0x40ac,0x1de));var _0xc40a=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x40ac[_0x173441];return _0x2423a8;};'use strict';var _=require(_0xc40a('0x0'));var util=require('util');var logger=require(_0xc40a('0x1'))(_0xc40a('0x2'));var moment=require(_0xc40a('0x3'));var BPromise=require(_0xc40a('0x4'));var rp=require(_0xc40a('0x5'));var fs=require('fs');var path=require(_0xc40a('0x6'));var rimraf=require(_0xc40a('0x7'));var config=require('../../config/environment');var attributes=require(_0xc40a('0x8'));module[_0xc40a('0x9')]=function(_0xd6d891,_0x5e179f){return _0xd6d891['define'](_0xc40a('0xa'),attributes,{'tableName':_0xc40a('0xb'),'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 9131de5..e9014cf 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 _0x022e=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','moment'];(function(_0x598fc5,_0x36a47d){var _0x562451=function(_0x5a5047){while(--_0x5a5047){_0x598fc5['push'](_0x598fc5['shift']());}};_0x562451(++_0x36a47d);}(_0x022e,0xc4));var _0xe022=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x022e[_0x5d2803];return _0xdcad2c;};'use strict';var _=require(_0xe022('0x0'));var util=require('util');var moment=require(_0xe022('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe022('0x2'))['db'];var utils=require(_0xe022('0x3'));var logger=require('../../config/logger')(_0xe022('0x4'));var config=require(_0xe022('0x5'));var jayson=require(_0xe022('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x24513d,_0x56bcb5,_0x52c7ec){return new BPromise(function(_0x39d424,_0xce6f15){return client[_0xe022('0x7')](_0x24513d,_0x52c7ec)[_0xe022('0x8')](function(_0x38f264){logger[_0xe022('0x9')](_0xe022('0xa'),_0x56bcb5,_0xe022('0xb'));logger[_0xe022('0xc')](_0xe022('0xd'),_0x56bcb5,_0xe022('0xb'),JSON[_0xe022('0xe')](_0x38f264));if(_0x38f264[_0xe022('0xf')]){if(_0x38f264[_0xe022('0xf')]['code']===0x1f4){logger[_0xe022('0xf')](_0xe022('0xa'),_0x56bcb5,_0x38f264['error']['message']);return _0xce6f15(_0x38f264['error'][_0xe022('0x10')]);}logger[_0xe022('0xf')]('ServicenowConfiguration,\x20%s,\x20%s',_0x56bcb5,_0x38f264[_0xe022('0xf')]['message']);return _0x39d424(_0x38f264['error'][_0xe022('0x10')]);}else{logger[_0xe022('0x9')](_0xe022('0xa'),_0x56bcb5,'request\x20sent');_0x39d424(_0x38f264['result']['message']);}})[_0xe022('0x11')](function(_0x3444d3){logger[_0xe022('0xf')](_0xe022('0xa'),_0x56bcb5,_0x3444d3);_0xce6f15(_0x3444d3);});});} \ No newline at end of file +var _0x4627=['../../config/logger','rpc','jayson/promise','client','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0x4627,0xa0));var _0x7462=function(_0x56fe98,_0x43dc16){_0x56fe98=_0x56fe98-0x0;var _0x212f4f=_0x4627[_0x56fe98];return _0x212f4f;};'use strict';var _=require(_0x7462('0x0'));var util=require(_0x7462('0x1'));var moment=require(_0x7462('0x2'));var BPromise=require(_0x7462('0x3'));var rs=require(_0x7462('0x4'));var fs=require('fs');var Redis=require(_0x7462('0x5'));var db=require(_0x7462('0x6'))['db'];var utils=require(_0x7462('0x7'));var logger=require(_0x7462('0x8'))(_0x7462('0x9'));var config=require('../../config/environment');var jayson=require(_0x7462('0xa'));var client=jayson[_0x7462('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x48ef92,_0x2160ad,_0x25faf8){return new BPromise(function(_0x2e0ba3,_0x287e17){return client[_0x7462('0xc')](_0x48ef92,_0x25faf8)[_0x7462('0xd')](function(_0x2d8757){logger[_0x7462('0xe')](_0x7462('0xf'),_0x2160ad,_0x7462('0x10'));logger[_0x7462('0x11')](_0x7462('0x12'),_0x2160ad,_0x7462('0x10'),JSON[_0x7462('0x13')](_0x2d8757));if(_0x2d8757[_0x7462('0x14')]){if(_0x2d8757[_0x7462('0x14')][_0x7462('0x15')]===0x1f4){logger[_0x7462('0x14')](_0x7462('0xf'),_0x2160ad,_0x2d8757[_0x7462('0x14')][_0x7462('0x16')]);return _0x287e17(_0x2d8757['error'][_0x7462('0x16')]);}logger[_0x7462('0x14')]('ServicenowConfiguration,\x20%s,\x20%s',_0x2160ad,_0x2d8757[_0x7462('0x14')][_0x7462('0x16')]);return _0x2e0ba3(_0x2d8757['error']['message']);}else{logger['info'](_0x7462('0xf'),_0x2160ad,_0x7462('0x10'));_0x2e0ba3(_0x2d8757['result'][_0x7462('0x16')]);}})[_0x7462('0x17')](function(_0x1e2bec){logger[_0x7462('0x14')](_0x7462('0xf'),_0x2160ad,_0x1e2bec);_0x287e17(_0x1e2bec);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 0a798e7..5b8beec 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 _0x1bc8=['/:id','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','post','create'];(function(_0x15badf,_0x48c1d7){var _0x547965=function(_0x40ffa6){while(--_0x40ffa6){_0x15badf['push'](_0x15badf['shift']());}};_0x547965(++_0x48c1d7);}(_0x1bc8,0x70));var _0x81bc=function(_0x170941,_0x38d105){_0x170941=_0x170941-0x0;var _0x50e48d=_0x1bc8[_0x170941];return _0x50e48d;};'use strict';var multer=require(_0x81bc('0x0'));var util=require(_0x81bc('0x1'));var path=require(_0x81bc('0x2'));var timeout=require('connect-timeout');var express=require(_0x81bc('0x3'));var router=express[_0x81bc('0x4')]();var fs_extra=require(_0x81bc('0x5'));var auth=require(_0x81bc('0x6'));var interaction=require(_0x81bc('0x7'));var config=require(_0x81bc('0x8'));var controller=require('./intServicenowField.controller');router[_0x81bc('0x9')]('/',auth[_0x81bc('0xa')](),controller['index']);router[_0x81bc('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x81bc('0xb')]);router[_0x81bc('0xc')]('/',auth[_0x81bc('0xa')](),controller[_0x81bc('0xd')]);router['put'](_0x81bc('0xe'),auth[_0x81bc('0xa')](),controller['update']);router[_0x81bc('0xf')]('/:id',auth[_0x81bc('0xa')](),controller[_0x81bc('0x10')]);module[_0x81bc('0x11')]=router; \ No newline at end of file +var _0x7bf3=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','create','put','update','delete','destroy','multer','path','connect-timeout','express'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x7bf3,0x1ac));var _0x37bf=function(_0x581ae9,_0x4b6941){_0x581ae9=_0x581ae9-0x0;var _0x4c9c51=_0x7bf3[_0x581ae9];return _0x4c9c51;};'use strict';var multer=require(_0x37bf('0x0'));var util=require('util');var path=require(_0x37bf('0x1'));var timeout=require(_0x37bf('0x2'));var express=require(_0x37bf('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x37bf('0x4'));var interaction=require(_0x37bf('0x5'));var config=require(_0x37bf('0x6'));var controller=require('./intServicenowField.controller');router[_0x37bf('0x7')]('/',auth[_0x37bf('0x8')](),controller['index']);router[_0x37bf('0x7')](_0x37bf('0x9'),auth[_0x37bf('0x8')](),controller[_0x37bf('0xa')]);router['post']('/',auth[_0x37bf('0x8')](),controller[_0x37bf('0xb')]);router[_0x37bf('0xc')](_0x37bf('0x9'),auth[_0x37bf('0x8')](),controller[_0x37bf('0xd')]);router[_0x37bf('0xe')]('/:id',auth[_0x37bf('0x8')](),controller[_0x37bf('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 ed108ce..a7add3e 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 _0x1662=['keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable'];(function(_0x1a8f86,_0x5ed9c4){var _0x20d876=function(_0x596e1b){while(--_0x596e1b){_0x1a8f86['push'](_0x1a8f86['shift']());}};_0x20d876(++_0x5ed9c4);}(_0x1662,0xea));var _0x2166=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x1662[_0x3ab51d];return _0x29a04e;};'use strict';var Sequelize=require(_0x2166('0x0'));module[_0x2166('0x1')]={'type':{'type':Sequelize[_0x2166('0x2')](_0x2166('0x3'),_0x2166('0x4'),_0x2166('0x5'),_0x2166('0x6'),_0x2166('0x7')),'defaultValue':'string'},'content':{'type':Sequelize[_0x2166('0x8')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x2166('0x2')](_0x2166('0x3'),_0x2166('0x4'),_0x2166('0x5'))},'keyContent':{'type':Sequelize[_0x2166('0x8')]},'idField':{'type':Sequelize[_0x2166('0x8')]},'nameField':{'type':Sequelize[_0x2166('0x8')]},'customField':{'type':Sequelize[_0x2166('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2166('0x8')]}}; \ No newline at end of file +var _0x1712=['ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN','sequelize'];(function(_0x5f0547,_0x5f4ab8){var _0x2ba8d8=function(_0x46a243){while(--_0x46a243){_0x5f0547['push'](_0x5f0547['shift']());}};_0x2ba8d8(++_0x5f4ab8);}(_0x1712,0xbf));var _0x2171=function(_0x4c6d6f,_0x291557){_0x4c6d6f=_0x4c6d6f-0x0;var _0x2d4478=_0x1712[_0x4c6d6f];return _0x2d4478;};'use strict';var Sequelize=require(_0x2171('0x0'));module['exports']={'type':{'type':Sequelize[_0x2171('0x1')](_0x2171('0x2'),_0x2171('0x3'),_0x2171('0x4'),_0x2171('0x5'),'picklist'),'defaultValue':_0x2171('0x2')},'content':{'type':Sequelize[_0x2171('0x6')]},'key':{'type':Sequelize[_0x2171('0x6')]},'keyType':{'type':Sequelize['ENUM']('string',_0x2171('0x3'),_0x2171('0x4'))},'keyContent':{'type':Sequelize[_0x2171('0x6')]},'idField':{'type':Sequelize[_0x2171('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x2171('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2171('0x6')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index d1c31bb..4393bb5 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 _0x5a70=['count','offset','set','save','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','merge','options','ServicenowField','include','rows','catch','show','find','create','body','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined'];(function(_0x114596,_0x4b4a6b){var _0x3075e8=function(_0x270de0){while(--_0x270de0){_0x114596['push'](_0x114596['shift']());}};_0x3075e8(++_0x4b4a6b);}(_0x5a70,0x183));var _0x05a7=function(_0x8c1005,_0x1f3f16){_0x8c1005=_0x8c1005-0x0;var _0x175354=_0x5a70[_0x8c1005];return _0x175354;};'use strict';var emlformat=require(_0x05a7('0x0'));var rimraf=require(_0x05a7('0x1'));var zipdir=require(_0x05a7('0x2'));var jsonpatch=require(_0x05a7('0x3'));var rp=require(_0x05a7('0x4'));var moment=require('moment');var BPromise=require(_0x05a7('0x5'));var Mustache=require(_0x05a7('0x6'));var util=require(_0x05a7('0x7'));var path=require(_0x05a7('0x8'));var sox=require('sox');var csv=require(_0x05a7('0x9'));var ejs=require(_0x05a7('0xa'));var fs=require('fs');var fs_extra=require(_0x05a7('0xb'));var _=require(_0x05a7('0xc'));var squel=require(_0x05a7('0xd'));var crypto=require('crypto');var jsforce=require(_0x05a7('0xe'));var deskjs=require(_0x05a7('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x05a7('0x10'));var as=require(_0x05a7('0x11'));var hardwareService=require(_0x05a7('0x12'));var logger=require('../../config/logger')(_0x05a7('0x13'));var utils=require('../../config/utils');var config=require(_0x05a7('0x14'));var licenseUtil=require(_0x05a7('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5f1e5f,_0x5c9aa4){_0x5c9aa4=_0x5c9aa4||0xcc;return function(_0x15965a){if(_0x15965a){return _0x5f1e5f[_0x05a7('0x16')](_0x5c9aa4);}return _0x5f1e5f[_0x05a7('0x17')](_0x5c9aa4)[_0x05a7('0x18')]();};}function respondWithResult(_0x3a3a34,_0x57fa97){_0x57fa97=_0x57fa97||0xc8;return function(_0x5a18ba){if(_0x5a18ba){return _0x3a3a34[_0x05a7('0x17')](_0x57fa97)[_0x05a7('0x19')](_0x5a18ba);}};}function respondWithFilteredResult(_0x3f6dd7,_0x5e4a8e){return function(_0x5a969d){if(_0x5a969d){var _0x239a8f=typeof _0x5e4a8e['offset']==='undefined'&&typeof _0x5e4a8e['limit']===_0x05a7('0x1a');var _0x5b7523=_0x5a969d[_0x05a7('0x1b')];var _0x488e62=_0x239a8f?0x0:_0x5e4a8e[_0x05a7('0x1c')];var _0x162cc9=_0x239a8f?_0x5a969d[_0x05a7('0x1b')]:_0x5e4a8e['offset']+_0x5e4a8e['limit'];var _0x86cb88;if(_0x162cc9>=_0x5b7523){_0x162cc9=_0x5b7523;_0x86cb88=0xc8;}else{_0x86cb88=0xce;}_0x3f6dd7[_0x05a7('0x17')](_0x86cb88);return _0x3f6dd7[_0x05a7('0x1d')]('Content-Range',_0x488e62+'-'+_0x162cc9+'/'+_0x5b7523)[_0x05a7('0x19')](_0x5a969d);}return null;};}function patchUpdates(_0x3e4318){return function(_0xdea8e6){try{jsonpatch['apply'](_0xdea8e6,_0x3e4318,!![]);}catch(_0x5d029d){return BPromise['reject'](_0x5d029d);}return _0xdea8e6[_0x05a7('0x1e')]();};}function saveUpdates(_0x7bacbf,_0x449b90){return function(_0x1241a2){if(_0x1241a2){return _0x1241a2[_0x05a7('0x1f')](_0x7bacbf)[_0x05a7('0x20')](function(_0x5642ab){return _0x5642ab;});}return null;};}function removeEntity(_0x127109,_0x3ffaf1){return function(_0x1a6937){if(_0x1a6937){return _0x1a6937['destroy']()[_0x05a7('0x20')](function(){_0x127109[_0x05a7('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e3a05,_0x40346a){return function(_0x4f92b1){if(!_0x4f92b1){_0x2e3a05[_0x05a7('0x16')](0x194);}return _0x4f92b1;};}function handleError(_0x3521f9,_0x77e8e7){_0x77e8e7=_0x77e8e7||0x1f4;return function(_0x16226c){logger[_0x05a7('0x21')](_0x16226c[_0x05a7('0x22')]);if(_0x16226c[_0x05a7('0x23')]){delete _0x16226c[_0x05a7('0x23')];}_0x3521f9[_0x05a7('0x17')](_0x77e8e7)[_0x05a7('0x24')](_0x16226c);};}exports[_0x05a7('0x25')]=function(_0xee0edd,_0x2eb100){var _0x3d8e51={},_0x208da6={},_0x5cc23c={'count':0x0,'rows':[]};var _0x4d1992=_[_0x05a7('0x26')](db['ServicenowField'][_0x05a7('0x27')],function(_0x4bbc84){return{'name':_0x4bbc84[_0x05a7('0x28')],'type':_0x4bbc84[_0x05a7('0x29')][_0x05a7('0x2a')]};});_0x208da6['model']=_[_0x05a7('0x26')](_0x4d1992,'name');_0x208da6['query']=_[_0x05a7('0x2b')](_0xee0edd[_0x05a7('0x2c')]);_0x208da6['filters']=_[_0x05a7('0x2d')](_0x208da6[_0x05a7('0x2e')],_0x208da6[_0x05a7('0x2c')]);_0x3d8e51[_0x05a7('0x2f')]=_[_0x05a7('0x2d')](_0x208da6[_0x05a7('0x2e')],qs['fields'](_0xee0edd[_0x05a7('0x2c')][_0x05a7('0x30')]));_0x3d8e51[_0x05a7('0x2f')]=_0x3d8e51[_0x05a7('0x2f')][_0x05a7('0x31')]?_0x3d8e51[_0x05a7('0x2f')]:_0x208da6[_0x05a7('0x2e')];if(!_0xee0edd['query'][_0x05a7('0x32')](_0x05a7('0x33'))){_0x3d8e51['limit']=qs[_0x05a7('0x34')](_0xee0edd[_0x05a7('0x2c')][_0x05a7('0x34')]);_0x3d8e51[_0x05a7('0x1c')]=qs['offset'](_0xee0edd['query']['offset']);}_0x3d8e51[_0x05a7('0x35')]=qs['sort'](_0xee0edd[_0x05a7('0x2c')][_0x05a7('0x36')]);_0x3d8e51[_0x05a7('0x37')]=qs['filters'](_['pick'](_0xee0edd[_0x05a7('0x2c')],_0x208da6[_0x05a7('0x38')]),_0x4d1992);if(_0xee0edd[_0x05a7('0x2c')]['filter']){_0x3d8e51['where']=_[_0x05a7('0x39')](_0x3d8e51[_0x05a7('0x37')],{'$or':_[_0x05a7('0x26')](_0x4d1992,function(_0x13817e){if(_0x13817e[_0x05a7('0x29')]!=='VIRTUAL'){var _0x3ec95c={};_0x3ec95c[_0x13817e[_0x05a7('0x23')]]={'$like':'%'+_0xee0edd[_0x05a7('0x2c')]['filter']+'%'};return _0x3ec95c;}})});}_0x3d8e51=_[_0x05a7('0x39')]({},_0x3d8e51,_0xee0edd[_0x05a7('0x3a')]);var _0x3d1827={'where':_0x3d8e51[_0x05a7('0x37')]};return db[_0x05a7('0x3b')][_0x05a7('0x1b')](_0x3d1827)[_0x05a7('0x20')](function(_0x1de0f0){_0x5cc23c[_0x05a7('0x1b')]=_0x1de0f0;if(_0xee0edd[_0x05a7('0x2c')]['includeAll']){_0x3d8e51[_0x05a7('0x3c')]=[{'all':!![]}];}return db[_0x05a7('0x3b')]['findAll'](_0x3d8e51);})[_0x05a7('0x20')](function(_0x24ca9d){_0x5cc23c[_0x05a7('0x3d')]=_0x24ca9d;return _0x5cc23c;})[_0x05a7('0x20')](respondWithFilteredResult(_0x2eb100,_0x3d8e51))[_0x05a7('0x3e')](handleError(_0x2eb100,null));};exports[_0x05a7('0x3f')]=function(_0x4aa7f4,_0x4b3144){var _0x31bd98={'raw':!![],'where':{'id':_0x4aa7f4['params']['id']}},_0x3919f9={};_0x3919f9[_0x05a7('0x2e')]=_[_0x05a7('0x2b')](db['ServicenowField'][_0x05a7('0x27')]);_0x3919f9[_0x05a7('0x2c')]=_[_0x05a7('0x2b')](_0x4aa7f4[_0x05a7('0x2c')]);_0x3919f9[_0x05a7('0x38')]=_['intersection'](_0x3919f9[_0x05a7('0x2e')],_0x3919f9['query']);_0x31bd98[_0x05a7('0x2f')]=_[_0x05a7('0x2d')](_0x3919f9[_0x05a7('0x2e')],qs[_0x05a7('0x30')](_0x4aa7f4[_0x05a7('0x2c')][_0x05a7('0x30')]));_0x31bd98['attributes']=_0x31bd98[_0x05a7('0x2f')][_0x05a7('0x31')]?_0x31bd98[_0x05a7('0x2f')]:_0x3919f9[_0x05a7('0x2e')];if(_0x4aa7f4[_0x05a7('0x2c')]['includeAll']){_0x31bd98['include']=[{'all':!![]}];}_0x31bd98=_['merge']({},_0x31bd98,_0x4aa7f4[_0x05a7('0x3a')]);return db[_0x05a7('0x3b')][_0x05a7('0x40')](_0x31bd98)[_0x05a7('0x20')](handleEntityNotFound(_0x4b3144,null))['then'](respondWithResult(_0x4b3144,null))[_0x05a7('0x3e')](handleError(_0x4b3144,null));};exports[_0x05a7('0x41')]=function(_0x1e233f,_0x1b9bbd){return db['ServicenowField'][_0x05a7('0x41')](_0x1e233f[_0x05a7('0x42')],{})[_0x05a7('0x20')](respondWithResult(_0x1b9bbd,0xc9))[_0x05a7('0x3e')](handleError(_0x1b9bbd,null));};exports[_0x05a7('0x1f')]=function(_0x52a45c,_0x4a2f52){if(_0x52a45c[_0x05a7('0x42')]['id']){delete _0x52a45c['body']['id'];}return db[_0x05a7('0x3b')][_0x05a7('0x40')]({'where':{'id':_0x52a45c[_0x05a7('0x43')]['id']}})[_0x05a7('0x20')](handleEntityNotFound(_0x4a2f52,null))[_0x05a7('0x20')](saveUpdates(_0x52a45c[_0x05a7('0x42')],null))[_0x05a7('0x20')](respondWithResult(_0x4a2f52,null))['catch'](handleError(_0x4a2f52,null));};exports[_0x05a7('0x44')]=function(_0x51f8e6,_0x73703c){return db[_0x05a7('0x3b')][_0x05a7('0x40')]({'where':{'id':_0x51f8e6['params']['id']}})[_0x05a7('0x20')](handleEntityNotFound(_0x73703c,null))[_0x05a7('0x20')](removeEntity(_0x73703c,null))[_0x05a7('0x3e')](handleError(_0x73703c,null));}; \ No newline at end of file +var _0x64d1=['ServicenowField','rawAttributes','fieldName','type','key','model','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','VIRTUAL','merge','options','includeAll','findAll','rows','catch','params','keys','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','end','error','stack','name','send','index'];(function(_0x33787b,_0x2e0931){var _0x1a4025=function(_0x5229f0){while(--_0x5229f0){_0x33787b['push'](_0x33787b['shift']());}};_0x1a4025(++_0x2e0931);}(_0x64d1,0x107));var _0x164d=function(_0x1a0daa,_0x2a4634){_0x1a0daa=_0x1a0daa-0x0;var _0x1dbe15=_0x64d1[_0x1a0daa];return _0x1dbe15;};'use strict';var emlformat=require(_0x164d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x164d('0x1'));var jsonpatch=require(_0x164d('0x2'));var rp=require(_0x164d('0x3'));var moment=require(_0x164d('0x4'));var BPromise=require(_0x164d('0x5'));var Mustache=require(_0x164d('0x6'));var util=require(_0x164d('0x7'));var path=require(_0x164d('0x8'));var sox=require('sox');var csv=require(_0x164d('0x9'));var ejs=require(_0x164d('0xa'));var fs=require('fs');var fs_extra=require(_0x164d('0xb'));var _=require(_0x164d('0xc'));var squel=require(_0x164d('0xd'));var crypto=require(_0x164d('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x164d('0x9'));var querystring=require(_0x164d('0xf'));var Papa=require(_0x164d('0x10'));var Redis=require(_0x164d('0x11'));var authService=require(_0x164d('0x12'));var qs=require(_0x164d('0x13'));var as=require(_0x164d('0x14'));var hardwareService=require(_0x164d('0x15'));var logger=require('../../config/logger')(_0x164d('0x16'));var utils=require(_0x164d('0x17'));var config=require(_0x164d('0x18'));var licenseUtil=require(_0x164d('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x109254,_0x419eaa){_0x419eaa=_0x419eaa||0xcc;return function(_0x45ac1e){if(_0x45ac1e){return _0x109254[_0x164d('0x1a')](_0x419eaa);}return _0x109254[_0x164d('0x1b')](_0x419eaa)['end']();};}function respondWithResult(_0x5f5714,_0x49f1f5){_0x49f1f5=_0x49f1f5||0xc8;return function(_0x57b8e0){if(_0x57b8e0){return _0x5f5714[_0x164d('0x1b')](_0x49f1f5)[_0x164d('0x1c')](_0x57b8e0);}};}function respondWithFilteredResult(_0x2dc908,_0x4bb971){return function(_0x3ff7e1){if(_0x3ff7e1){var _0xef225e=typeof _0x4bb971[_0x164d('0x1d')]==='undefined'&&typeof _0x4bb971[_0x164d('0x1e')]===_0x164d('0x1f');var _0x48baef=_0x3ff7e1[_0x164d('0x20')];var _0x38038f=_0xef225e?0x0:_0x4bb971[_0x164d('0x1d')];var _0x5d5391=_0xef225e?_0x3ff7e1[_0x164d('0x20')]:_0x4bb971[_0x164d('0x1d')]+_0x4bb971[_0x164d('0x1e')];var _0x2c87e9;if(_0x5d5391>=_0x48baef){_0x5d5391=_0x48baef;_0x2c87e9=0xc8;}else{_0x2c87e9=0xce;}_0x2dc908['status'](_0x2c87e9);return _0x2dc908['set'](_0x164d('0x21'),_0x38038f+'-'+_0x5d5391+'/'+_0x48baef)[_0x164d('0x1c')](_0x3ff7e1);}return null;};}function patchUpdates(_0x239110){return function(_0x1fdb54){try{jsonpatch[_0x164d('0x22')](_0x1fdb54,_0x239110,!![]);}catch(_0x53fdea){return BPromise[_0x164d('0x23')](_0x53fdea);}return _0x1fdb54[_0x164d('0x24')]();};}function saveUpdates(_0x37c491,_0x255937){return function(_0x321420){if(_0x321420){return _0x321420[_0x164d('0x25')](_0x37c491)[_0x164d('0x26')](function(_0x335a89){return _0x335a89;});}return null;};}function removeEntity(_0x27a916,_0x4b0736){return function(_0x3065ae){if(_0x3065ae){return _0x3065ae['destroy']()[_0x164d('0x26')](function(){_0x27a916[_0x164d('0x1b')](0xcc)[_0x164d('0x27')]();});}};}function handleEntityNotFound(_0x3b50a8,_0x1a699c){return function(_0xd1c133){if(!_0xd1c133){_0x3b50a8['sendStatus'](0x194);}return _0xd1c133;};}function handleError(_0x119db0,_0x31fab6){_0x31fab6=_0x31fab6||0x1f4;return function(_0x10e5af){logger[_0x164d('0x28')](_0x10e5af[_0x164d('0x29')]);if(_0x10e5af['name']){delete _0x10e5af[_0x164d('0x2a')];}_0x119db0[_0x164d('0x1b')](_0x31fab6)[_0x164d('0x2b')](_0x10e5af);};}exports[_0x164d('0x2c')]=function(_0x15371e,_0x275680){var _0x5751ea={},_0x48adf3={},_0x5510c3={'count':0x0,'rows':[]};var _0x2d01fc=_['map'](db[_0x164d('0x2d')][_0x164d('0x2e')],function(_0xdd1011){return{'name':_0xdd1011[_0x164d('0x2f')],'type':_0xdd1011[_0x164d('0x30')][_0x164d('0x31')]};});_0x48adf3[_0x164d('0x32')]=_['map'](_0x2d01fc,_0x164d('0x2a'));_0x48adf3['query']=_['keys'](_0x15371e['query']);_0x48adf3[_0x164d('0x33')]=_[_0x164d('0x34')](_0x48adf3[_0x164d('0x32')],_0x48adf3[_0x164d('0x35')]);_0x5751ea[_0x164d('0x36')]=_[_0x164d('0x34')](_0x48adf3[_0x164d('0x32')],qs[_0x164d('0x37')](_0x15371e[_0x164d('0x35')][_0x164d('0x37')]));_0x5751ea[_0x164d('0x36')]=_0x5751ea[_0x164d('0x36')][_0x164d('0x38')]?_0x5751ea[_0x164d('0x36')]:_0x48adf3[_0x164d('0x32')];if(!_0x15371e['query'][_0x164d('0x39')](_0x164d('0x3a'))){_0x5751ea['limit']=qs[_0x164d('0x1e')](_0x15371e[_0x164d('0x35')]['limit']);_0x5751ea[_0x164d('0x1d')]=qs[_0x164d('0x1d')](_0x15371e[_0x164d('0x35')][_0x164d('0x1d')]);}_0x5751ea[_0x164d('0x3b')]=qs[_0x164d('0x3c')](_0x15371e[_0x164d('0x35')][_0x164d('0x3c')]);_0x5751ea[_0x164d('0x3d')]=qs[_0x164d('0x33')](_[_0x164d('0x3e')](_0x15371e[_0x164d('0x35')],_0x48adf3[_0x164d('0x33')]),_0x2d01fc);if(_0x15371e[_0x164d('0x35')][_0x164d('0x3f')]){_0x5751ea['where']=_['merge'](_0x5751ea[_0x164d('0x3d')],{'$or':_[_0x164d('0x40')](_0x2d01fc,function(_0x5c8c1a){if(_0x5c8c1a[_0x164d('0x30')]!==_0x164d('0x41')){var _0x2232aa={};_0x2232aa[_0x5c8c1a[_0x164d('0x2a')]]={'$like':'%'+_0x15371e[_0x164d('0x35')][_0x164d('0x3f')]+'%'};return _0x2232aa;}})});}_0x5751ea=_[_0x164d('0x42')]({},_0x5751ea,_0x15371e[_0x164d('0x43')]);var _0x586ab1={'where':_0x5751ea['where']};return db['ServicenowField']['count'](_0x586ab1)['then'](function(_0x4a98d3){_0x5510c3[_0x164d('0x20')]=_0x4a98d3;if(_0x15371e['query'][_0x164d('0x44')]){_0x5751ea['include']=[{'all':!![]}];}return db['ServicenowField'][_0x164d('0x45')](_0x5751ea);})['then'](function(_0x519665){_0x5510c3[_0x164d('0x46')]=_0x519665;return _0x5510c3;})[_0x164d('0x26')](respondWithFilteredResult(_0x275680,_0x5751ea))[_0x164d('0x47')](handleError(_0x275680,null));};exports['show']=function(_0x16fe0d,_0x45473a){var _0xa85b08={'raw':!![],'where':{'id':_0x16fe0d[_0x164d('0x48')]['id']}},_0x56ffbd={};_0x56ffbd[_0x164d('0x32')]=_[_0x164d('0x49')](db[_0x164d('0x2d')][_0x164d('0x2e')]);_0x56ffbd[_0x164d('0x35')]=_[_0x164d('0x49')](_0x16fe0d[_0x164d('0x35')]);_0x56ffbd['filters']=_[_0x164d('0x34')](_0x56ffbd[_0x164d('0x32')],_0x56ffbd[_0x164d('0x35')]);_0xa85b08[_0x164d('0x36')]=_['intersection'](_0x56ffbd['model'],qs[_0x164d('0x37')](_0x16fe0d['query'][_0x164d('0x37')]));_0xa85b08[_0x164d('0x36')]=_0xa85b08[_0x164d('0x36')][_0x164d('0x38')]?_0xa85b08[_0x164d('0x36')]:_0x56ffbd[_0x164d('0x32')];if(_0x16fe0d[_0x164d('0x35')]['includeAll']){_0xa85b08['include']=[{'all':!![]}];}_0xa85b08=_[_0x164d('0x42')]({},_0xa85b08,_0x16fe0d[_0x164d('0x43')]);return db[_0x164d('0x2d')][_0x164d('0x4a')](_0xa85b08)['then'](handleEntityNotFound(_0x45473a,null))[_0x164d('0x26')](respondWithResult(_0x45473a,null))[_0x164d('0x47')](handleError(_0x45473a,null));};exports[_0x164d('0x4b')]=function(_0x4de10e,_0x525b7c){return db[_0x164d('0x2d')][_0x164d('0x4b')](_0x4de10e[_0x164d('0x4c')],{})['then'](respondWithResult(_0x525b7c,0xc9))['catch'](handleError(_0x525b7c,null));};exports[_0x164d('0x25')]=function(_0x5df42b,_0x4d1970){if(_0x5df42b['body']['id']){delete _0x5df42b[_0x164d('0x4c')]['id'];}return db[_0x164d('0x2d')]['find']({'where':{'id':_0x5df42b[_0x164d('0x48')]['id']}})['then'](handleEntityNotFound(_0x4d1970,null))[_0x164d('0x26')](saveUpdates(_0x5df42b['body'],null))[_0x164d('0x26')](respondWithResult(_0x4d1970,null))[_0x164d('0x47')](handleError(_0x4d1970,null));};exports['destroy']=function(_0xc700b5,_0x2d2836){return db[_0x164d('0x2d')][_0x164d('0x4a')]({'where':{'id':_0xc700b5[_0x164d('0x48')]['id']}})[_0x164d('0x26')](handleEntityNotFound(_0x2d2836,null))[_0x164d('0x26')](removeEntity(_0x2d2836,null))[_0x164d('0x47')](handleError(_0x2d2836,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index a382b62..774b4f6 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 _0xae14=['servicenow_unique_index','FieldId','lodash','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./intServicenowField.attributes','exports','int_servicenow_fields'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xae14,0x152));var _0x4ae1=function(_0x99f2b5,_0xfe1b39){_0x99f2b5=_0x99f2b5-0x0;var _0x564380=_0xae14[_0x99f2b5];return _0x564380;};'use strict';var _=require(_0x4ae1('0x0'));var util=require('util');var logger=require(_0x4ae1('0x1'))(_0x4ae1('0x2'));var moment=require(_0x4ae1('0x3'));var BPromise=require(_0x4ae1('0x4'));var rp=require(_0x4ae1('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4ae1('0x6'));var attributes=require(_0x4ae1('0x7'));module[_0x4ae1('0x8')]=function(_0x3a3643,_0x417088){return _0x3a3643['define']('ServicenowField',attributes,{'tableName':_0x4ae1('0x9'),'paranoid':![],'indexes':[{'name':_0x4ae1('0xa'),'fields':['idField',_0x4ae1('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x571c=['bluebird','path','rimraf','../../config/environment','./intServicenowField.attributes','exports','ServicenowField','int_servicenow_fields','servicenow_unique_index','idField','FieldId','../../config/logger','api'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x571c,0xb4));var _0xc571=function(_0xa9925c,_0x20b310){_0xa9925c=_0xa9925c-0x0;var _0x479127=_0x571c[_0xa9925c];return _0x479127;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc571('0x0'))(_0xc571('0x1'));var moment=require('moment');var BPromise=require(_0xc571('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc571('0x3'));var rimraf=require(_0xc571('0x4'));var config=require(_0xc571('0x5'));var attributes=require(_0xc571('0x6'));module[_0xc571('0x7')]=function(_0x1f5ed2,_0x2f501a){return _0x1f5ed2['define'](_0xc571('0x8'),attributes,{'tableName':_0xc571('0x9'),'paranoid':![],'indexes':[{'name':_0xc571('0xa'),'fields':[_0xc571('0xb'),_0xc571('0xc')],'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 dbe82e5..2e9dc77 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 _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(_0x3ae9a2,_0x36e838){var _0x1d3436=function(_0x4837f8){while(--_0x4837f8){_0x3ae9a2['push'](_0x3ae9a2['shift']());}};_0x1d3436(++_0x36e838);}(_0x70e0,0x17b));var _0x070e=function(_0x59e3cc,_0x4b283f){_0x59e3cc=_0x59e3cc-0x0;var _0x36fd33=_0x70e0[_0x59e3cc];return _0x36fd33;};'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 +var _0xa9e0=['http','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1c71e2,_0x13ee46){var _0x2c2b28=function(_0xf36bc0){while(--_0xf36bc0){_0x1c71e2['push'](_0x1c71e2['shift']());}};_0x2c2b28(++_0x13ee46);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 90a6fc6..c533b08 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(_0xa11108,_0x1cbaf1){var _0x108bd3=function(_0x3c0ee3){while(--_0x3c0ee3){_0xa11108['push'](_0xa11108['shift']());}};_0x108bd3(++_0x1cbaf1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xa9e0[_0x12d033];return _0x3b4e80;};'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(_0x5e854f,_0xb9555a){var _0x267b82=function(_0x49bfa7){while(--_0x49bfa7){_0x5e854f['push'](_0x5e854f['shift']());}};_0x267b82(++_0xb9555a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'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 5fd7d3f..9fb4390 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(_0x4faf01,_0x46af65){var _0xacfcc=function(_0x5206f7){while(--_0x5206f7){_0x4faf01['push'](_0x4faf01['shift']());}};_0xacfcc(++_0x46af65);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xa9e0[_0x2a6809];return _0x11c371;};'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(_0x45b01f,_0x3b02f6){var _0x1eb864=function(_0x27faaf){while(--_0x27faaf){_0x45b01f['push'](_0x45b01f['shift']());}};_0x1eb864(++_0x3b02f6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'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 33b2232..04a1b5d 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 _0x5872=['pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','then','rows','catch','show','params','keys','create','body','destroy','find','getConfigurations','findOne','SugarcrmConfiguration','addConfiguration','AccountId','channel','type','Descriptions','getDescriptions','SugarcrmField','Subjects','assigned_user_id','created_by','description','parent_type','direction','username','password','remoteUri','slice','substring','lastIndexOf','format','/service/v4_1/rest.php','login','JSON','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','POST','%s%s','values','module_fields','remove','includes','label','endsWith','value','test','statusCode','getFields','Wrong\x20credentials','zip-dir','request-promise','moment','util','sox','fs-extra','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','api','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','end','error','name','send','map','SugarcrmAccount','rawAttributes','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x47cad6,_0x9d41e7){var _0x2a70b6=function(_0x224590){while(--_0x224590){_0x47cad6['push'](_0x47cad6['shift']());}};_0x2a70b6(++_0x9d41e7);}(_0x5872,0x18b));var _0x2587=function(_0x31a938,_0x4daec6){_0x31a938=_0x31a938-0x0;var _0x1bf341=_0x5872[_0x31a938];return _0x1bf341;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2587('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2587('0x1'));var moment=require(_0x2587('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2587('0x3'));var path=require('path');var sox=require(_0x2587('0x4'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2587('0x5'));var _=require('lodash');var squel=require(_0x2587('0x6'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2587('0x7'));var toCsv=require(_0x2587('0x8'));var querystring=require(_0x2587('0x9'));var Papa=require(_0x2587('0xa'));var Redis=require(_0x2587('0xb'));var authService=require(_0x2587('0xc'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2587('0xd'));var utils=require('../../config/utils');var config=require(_0x2587('0xe'));var licenseUtil=require(_0x2587('0xf'));var db=require('../../mysqldb')['db'];var integrations=require(_0x2587('0x10'));function respondWithStatusCode(_0x32438a,_0xe18dac){_0xe18dac=_0xe18dac||0xcc;return function(_0x23b409){if(_0x23b409){return _0x32438a[_0x2587('0x11')](_0xe18dac);}return _0x32438a['status'](_0xe18dac)['end']();};}function respondWithResult(_0x164ef3,_0x44a9c1){_0x44a9c1=_0x44a9c1||0xc8;return function(_0x38b6a3){if(_0x38b6a3){return _0x164ef3[_0x2587('0x12')](_0x44a9c1)[_0x2587('0x13')](_0x38b6a3);}};}function respondWithFilteredResult(_0x13c657,_0x33b8af){return function(_0x3f2a87){if(_0x3f2a87){var _0x30dbef=typeof _0x33b8af[_0x2587('0x14')]===_0x2587('0x15')&&typeof _0x33b8af[_0x2587('0x16')]===_0x2587('0x15');var _0x32cac4=_0x3f2a87[_0x2587('0x17')];var _0xa8f90c=_0x30dbef?0x0:_0x33b8af[_0x2587('0x14')];var _0x2dc93e=_0x30dbef?_0x3f2a87[_0x2587('0x17')]:_0x33b8af[_0x2587('0x14')]+_0x33b8af[_0x2587('0x16')];var _0xa1348f;if(_0x2dc93e>=_0x32cac4){_0x2dc93e=_0x32cac4;_0xa1348f=0xc8;}else{_0xa1348f=0xce;}_0x13c657[_0x2587('0x12')](_0xa1348f);return _0x13c657[_0x2587('0x18')](_0x2587('0x19'),_0xa8f90c+'-'+_0x2dc93e+'/'+_0x32cac4)[_0x2587('0x13')](_0x3f2a87);}return null;};}function patchUpdates(_0xd086db){return function(_0x105715){try{jsonpatch['apply'](_0x105715,_0xd086db,!![]);}catch(_0x2c74e0){return BPromise[_0x2587('0x1a')](_0x2c74e0);}return _0x105715[_0x2587('0x1b')]();};}function saveUpdates(_0x3458aa,_0x1c9d3a){return function(_0x329922){if(_0x329922){return _0x329922[_0x2587('0x1c')](_0x3458aa)['then'](function(_0x203b2d){return _0x203b2d;});}return null;};}function removeEntity(_0x50dc2b,_0x550b4b){return function(_0x43d877){if(_0x43d877){return _0x43d877['destroy']()['then'](function(){_0x50dc2b[_0x2587('0x12')](0xcc)[_0x2587('0x1d')]();});}};}function handleEntityNotFound(_0x580c17,_0x3deb7a){return function(_0x1c4b14){if(!_0x1c4b14){_0x580c17['sendStatus'](0x194);}return _0x1c4b14;};}function handleError(_0x2648c5,_0x269925){_0x269925=_0x269925||0x1f4;return function(_0x54fb1a){logger[_0x2587('0x1e')](_0x54fb1a['stack']);if(_0x54fb1a['name']){delete _0x54fb1a[_0x2587('0x1f')];}_0x2648c5[_0x2587('0x12')](_0x269925)[_0x2587('0x20')](_0x54fb1a);};}exports['index']=function(_0x3eebb0,_0x558e51){var _0x3ef176={},_0x22342e={},_0x2e556b={'count':0x0,'rows':[]};var _0x2d2f65=_[_0x2587('0x21')](db[_0x2587('0x22')][_0x2587('0x23')],function(_0x4a4a88){return{'name':_0x4a4a88['fieldName'],'type':_0x4a4a88['type'][_0x2587('0x24')]};});_0x22342e['model']=_['map'](_0x2d2f65,_0x2587('0x1f'));_0x22342e[_0x2587('0x25')]=_['keys'](_0x3eebb0[_0x2587('0x25')]);_0x22342e[_0x2587('0x26')]=_[_0x2587('0x27')](_0x22342e[_0x2587('0x28')],_0x22342e[_0x2587('0x25')]);_0x3ef176[_0x2587('0x29')]=_[_0x2587('0x27')](_0x22342e[_0x2587('0x28')],qs[_0x2587('0x2a')](_0x3eebb0['query'][_0x2587('0x2a')]));_0x3ef176[_0x2587('0x29')]=_0x3ef176[_0x2587('0x29')][_0x2587('0x2b')]?_0x3ef176[_0x2587('0x29')]:_0x22342e[_0x2587('0x28')];if(!_0x3eebb0[_0x2587('0x25')][_0x2587('0x2c')](_0x2587('0x2d'))){_0x3ef176[_0x2587('0x16')]=qs[_0x2587('0x16')](_0x3eebb0[_0x2587('0x25')]['limit']);_0x3ef176[_0x2587('0x14')]=qs[_0x2587('0x14')](_0x3eebb0[_0x2587('0x25')][_0x2587('0x14')]);}_0x3ef176[_0x2587('0x2e')]=qs[_0x2587('0x2f')](_0x3eebb0[_0x2587('0x25')][_0x2587('0x2f')]);_0x3ef176[_0x2587('0x30')]=qs[_0x2587('0x26')](_[_0x2587('0x31')](_0x3eebb0[_0x2587('0x25')],_0x22342e[_0x2587('0x26')]),_0x2d2f65);if(_0x3eebb0['query']['filter']){_0x3ef176[_0x2587('0x30')]=_[_0x2587('0x32')](_0x3ef176['where'],{'$or':_[_0x2587('0x21')](_0x2d2f65,function(_0x5d1c69){if(_0x5d1c69['type']!==_0x2587('0x33')){var _0x94fa8f={};_0x94fa8f[_0x5d1c69[_0x2587('0x1f')]]={'$like':'%'+_0x3eebb0[_0x2587('0x25')][_0x2587('0x34')]+'%'};return _0x94fa8f;}})});}_0x3ef176=_[_0x2587('0x32')]({},_0x3ef176,_0x3eebb0[_0x2587('0x35')]);var _0x3e81b2={'where':_0x3ef176[_0x2587('0x30')]};return db[_0x2587('0x22')][_0x2587('0x17')](_0x3e81b2)['then'](function(_0x3fa310){_0x2e556b[_0x2587('0x17')]=_0x3fa310;if(_0x3eebb0['query'][_0x2587('0x36')]){_0x3ef176[_0x2587('0x37')]=[{'all':!![]}];}return db[_0x2587('0x22')][_0x2587('0x38')](_0x3ef176);})[_0x2587('0x39')](function(_0x5dfbac){_0x2e556b[_0x2587('0x3a')]=_0x5dfbac;return _0x2e556b;})[_0x2587('0x39')](respondWithFilteredResult(_0x558e51,_0x3ef176))[_0x2587('0x3b')](handleError(_0x558e51,null));};exports[_0x2587('0x3c')]=function(_0xdc103b,_0x5a504d){var _0x2ca5ee={'raw':![],'where':{'id':_0xdc103b[_0x2587('0x3d')]['id']}},_0x57fa6e={};_0x57fa6e[_0x2587('0x28')]=_[_0x2587('0x3e')](db['SugarcrmAccount'][_0x2587('0x23')]);_0x57fa6e['query']=_[_0x2587('0x3e')](_0xdc103b[_0x2587('0x25')]);_0x57fa6e[_0x2587('0x26')]=_['intersection'](_0x57fa6e[_0x2587('0x28')],_0x57fa6e[_0x2587('0x25')]);_0x2ca5ee[_0x2587('0x29')]=_[_0x2587('0x27')](_0x57fa6e[_0x2587('0x28')],qs[_0x2587('0x2a')](_0xdc103b[_0x2587('0x25')][_0x2587('0x2a')]));_0x2ca5ee[_0x2587('0x29')]=_0x2ca5ee[_0x2587('0x29')][_0x2587('0x2b')]?_0x2ca5ee[_0x2587('0x29')]:_0x57fa6e[_0x2587('0x28')];if(_0xdc103b[_0x2587('0x25')][_0x2587('0x36')]){_0x2ca5ee[_0x2587('0x37')]=[{'all':!![]}];}_0x2ca5ee=_[_0x2587('0x32')]({},_0x2ca5ee,_0xdc103b['options']);return db[_0x2587('0x22')]['find'](_0x2ca5ee)['then'](handleEntityNotFound(_0x5a504d,null))['then'](respondWithResult(_0x5a504d,null))[_0x2587('0x3b')](handleError(_0x5a504d,null));};exports['create']=function(_0x5578ab,_0x402970){return db['SugarcrmAccount'][_0x2587('0x3f')](_0x5578ab['body'],{})[_0x2587('0x39')](respondWithResult(_0x402970,0xc9))[_0x2587('0x3b')](handleError(_0x402970,null));};exports['update']=function(_0x307777,_0x2cf484){if(_0x307777[_0x2587('0x40')]['id']){delete _0x307777[_0x2587('0x40')]['id'];}return db[_0x2587('0x22')]['find']({'where':{'id':_0x307777[_0x2587('0x3d')]['id']}})[_0x2587('0x39')](handleEntityNotFound(_0x2cf484,null))['then'](saveUpdates(_0x307777[_0x2587('0x40')],null))[_0x2587('0x39')](respondWithResult(_0x2cf484,null))[_0x2587('0x3b')](handleError(_0x2cf484,null));};exports[_0x2587('0x41')]=function(_0x5e3dc7,_0x93d08c){return db[_0x2587('0x22')][_0x2587('0x42')]({'where':{'id':_0x5e3dc7[_0x2587('0x3d')]['id']}})[_0x2587('0x39')](handleEntityNotFound(_0x93d08c,null))[_0x2587('0x39')](removeEntity(_0x93d08c,null))[_0x2587('0x3b')](handleError(_0x93d08c,null));};exports[_0x2587('0x43')]=function(_0x3a377a,_0x2a318c,_0x1f0ed9){var _0x4ce379={};var _0x5445b5={};var _0x46e908;var _0x341ea9;return db[_0x2587('0x22')][_0x2587('0x44')]({'where':{'id':_0x3a377a[_0x2587('0x3d')]['id']}})[_0x2587('0x39')](handleEntityNotFound(_0x2a318c,null))[_0x2587('0x39')](function(_0x997c0a){if(_0x997c0a){_0x46e908=_0x997c0a;_0x5445b5[_0x2587('0x28')]=_[_0x2587('0x3e')](db[_0x2587('0x45')][_0x2587('0x23')]);_0x5445b5['query']=_[_0x2587('0x3e')](_0x3a377a[_0x2587('0x25')]);_0x5445b5[_0x2587('0x26')]=_[_0x2587('0x27')](_0x5445b5[_0x2587('0x28')],_0x5445b5['query']);_0x4ce379[_0x2587('0x29')]=_['intersection'](_0x5445b5['model'],qs[_0x2587('0x2a')](_0x3a377a[_0x2587('0x25')][_0x2587('0x2a')]));_0x4ce379['attributes']=_0x4ce379[_0x2587('0x29')]['length']?_0x4ce379[_0x2587('0x29')]:_0x5445b5[_0x2587('0x28')];_0x4ce379[_0x2587('0x2e')]=qs[_0x2587('0x2f')](_0x3a377a[_0x2587('0x25')][_0x2587('0x2f')]);_0x4ce379[_0x2587('0x30')]=qs['filters'](_[_0x2587('0x31')](_0x3a377a[_0x2587('0x25')],_0x5445b5['filters']));if(_0x3a377a['query']['filter']){_0x4ce379[_0x2587('0x30')]=_[_0x2587('0x32')](_0x4ce379[_0x2587('0x30')],{'$or':_['map'](_0x4ce379['attributes'],function(_0x588aba){var _0x5b5410={};_0x5b5410[_0x588aba]={'$like':'%'+_0x3a377a[_0x2587('0x25')][_0x2587('0x34')]+'%'};return _0x5b5410;})});}_0x4ce379=_[_0x2587('0x32')]({},_0x4ce379,_0x3a377a['options']);return _0x46e908['getConfigurations'](_0x4ce379);}})[_0x2587('0x39')](function(_0x150f5e){if(_0x150f5e){_0x341ea9=_0x150f5e[_0x2587('0x2b')];if(!_0x3a377a[_0x2587('0x25')][_0x2587('0x2c')](_0x2587('0x2d'))){_0x4ce379[_0x2587('0x16')]=qs[_0x2587('0x16')](_0x3a377a[_0x2587('0x25')][_0x2587('0x16')]);_0x4ce379[_0x2587('0x14')]=qs[_0x2587('0x14')](_0x3a377a[_0x2587('0x25')][_0x2587('0x14')]);}return _0x46e908[_0x2587('0x43')](_0x4ce379);}})[_0x2587('0x39')](function(_0x741b6a){if(_0x741b6a){return _0x741b6a?{'count':_0x341ea9,'rows':_0x741b6a}:null;}})[_0x2587('0x39')](respondWithResult(_0x2a318c,null))[_0x2587('0x3b')](handleError(_0x2a318c,null));};exports[_0x2587('0x46')]=function(_0x373196,_0x59a714,_0xbd4c76){if(_0x373196['body']['id']){delete _0x373196[_0x2587('0x40')]['id'];}return db[_0x2587('0x22')][_0x2587('0x44')]({'where':{'id':_0x373196[_0x2587('0x3d')]['id']}})[_0x2587('0x39')](handleEntityNotFound(_0x59a714,null))[_0x2587('0x39')](function(_0x25edda){if(_0x25edda){_0x373196['body'][_0x2587('0x47')]=_0x25edda['id'];_0x373196[_0x2587('0x40')]['Subjects']=integrations['getSubjects'](_0x373196[_0x2587('0x40')][_0x2587('0x48')],_0x373196['body'][_0x2587('0x49')]);_0x373196[_0x2587('0x40')][_0x2587('0x4a')]=integrations[_0x2587('0x4b')](_0x373196['body'][_0x2587('0x48')],_0x373196[_0x2587('0x40')][_0x2587('0x49')]);return db[_0x2587('0x45')]['create'](_0x373196['body'],{'include':[{'model':db[_0x2587('0x4c')],'as':_0x2587('0x4d')},{'model':db[_0x2587('0x4c')],'as':_0x2587('0x4a')}]});}return null;})['then'](respondWithResult(_0x59a714,null))[_0x2587('0x3b')](handleError(_0x59a714,null));};exports['getFields']=function(_0x59c376,_0x9fc06,_0x36cae4){var _0x574cab='';var _0x4d559f=['id','name',_0x2587('0x4e'),_0x2587('0x4f'),_0x2587('0x50'),'date_start','duration_hours','duration_minutes','parent_id',_0x2587('0x51'),'parent_name',_0x2587('0x52')];return db[_0x2587('0x22')]['findOne']({'where':{'id':_0x59c376[_0x2587('0x3d')]['id']},'attributes':['id',_0x2587('0x53'),_0x2587('0x54'),'remoteUri']})[_0x2587('0x39')](handleEntityNotFound(_0x9fc06,null))[_0x2587('0x39')](function(_0x273b21){if(_0x273b21){_0x574cab=_0x273b21[_0x2587('0x55')];var _0x58a079=_0x574cab[_0x2587('0x56')](-0x1);if(_0x58a079==='/'){_0x574cab=_0x574cab[_0x2587('0x57')](0x0,_0x574cab[_0x2587('0x58')](_0x58a079));}return rp({'method':'POST','uri':util[_0x2587('0x59')]('%s%s',_0x574cab,_0x2587('0x5a')),'json':!![],'form':{'method':_0x2587('0x5b'),'input_type':_0x2587('0x5c'),'response_type':'JSON','rest_data':JSON[_0x2587('0x5d')]({'user_auth':{'user_name':_0x273b21[_0x2587('0x53')],'password':_0x273b21[_0x2587('0x54')],'encryption':_0x2587('0x5e')},'application':_0x2587('0x5f')})}});}})[_0x2587('0x39')](function(_0x4f8ee1){if(_0x4f8ee1&&_0x4f8ee1[_0x2587('0x1f')]!==_0x2587('0x60')&&_0x4f8ee1[_0x2587('0x1f')]!==_0x2587('0x61')){return rp({'method':_0x2587('0x62'),'uri':util[_0x2587('0x59')](_0x2587('0x63'),_0x574cab,_0x2587('0x5a')),'json':!![],'form':{'method':'get_module_fields','input_type':_0x2587('0x5c'),'response_type':_0x2587('0x5c'),'rest_data':JSON[_0x2587('0x5d')]({'session':_0x4f8ee1['id'],'module_name':'Calls'})}})[_0x2587('0x39')](function(_0x3ac5b1){if(_0x3ac5b1){var _0x15da6b=_[_0x2587('0x64')](_0x3ac5b1[_0x2587('0x65')]);_[_0x2587('0x66')](_0x15da6b,function(_0x5a92ee){return _0x4d559f[_0x2587('0x67')](_0x5a92ee[_0x2587('0x1f')]);});return{'count':_0x15da6b[_0x2587('0x2b')],'rows':_[_0x2587('0x21')](_0x15da6b,function(_0x9118dc){return{'id':_0x9118dc[_0x2587('0x1f')],'name':_0x9118dc[_0x2587('0x68')],'custom':_[_0x2587('0x69')](_0x9118dc[_0x2587('0x1f')],'_c')?!![]:![],'options':_0x9118dc[_0x2587('0x35')]?_[_0x2587('0x21')](_['values'](_0x9118dc[_0x2587('0x35')]),function(_0x3f6d8c){return{'name':_0x3f6d8c[_0x2587('0x6a')],'value':_0x3f6d8c[_0x2587('0x1f')]};}):[]};})};}})['then'](respondWithResult(_0x9fc06,null))['catch'](function(_0x331f16){var _0x161b11=_0x59c376[_0x2587('0x25')][_0x2587('0x6b')]?0x1f4:_0x331f16[_0x2587('0x6c')]||0x1f4;logger[_0x2587('0x1e')]('getFields,\x20%s,\x20%s,\x20%s',_0x2587('0x6d'),_0x161b11,JSON[_0x2587('0x5d')](_0x331f16));delete _0x331f16[_0x2587('0x1f')];if(_0x161b11===0x191){_0x161b11=0x190;}_0x9fc06[_0x2587('0x12')](_0x161b11)[_0x2587('0x20')](_0x59c376[_0x2587('0x25')][_0x2587('0x6b')]?{'message':'Wrong\x20credentials','statusCode':_0x331f16[_0x2587('0x6c')]}:_0x331f16);});}else{var _0x4ef690=0x1f4;_0x9fc06['status'](_0x4ef690)[_0x2587('0x20')]({'message':_0x2587('0x6e'),'statusCode':0x190});}});}; \ No newline at end of file +var _0xd3e7=['end','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','update','then','stack','name','send','SugarcrmAccount','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','findAll','rows','show','params','includeAll','find','catch','create','body','destroy','getConfigurations','findOne','SugarcrmConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SugarcrmField','assigned_user_id','created_by','description','date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','username','password','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','get_module_fields','Calls','module_fields','remove','includes','label','endsWith','values','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','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','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration'];(function(_0x4c647f,_0x3b56ff){var _0x3a738a=function(_0x1a3059){while(--_0x1a3059){_0x4c647f['push'](_0x4c647f['shift']());}};_0x3a738a(++_0x3b56ff);}(_0xd3e7,0x1e5));var _0x7d3e=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd3e7[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x7d3e('0x0'));var rimraf=require(_0x7d3e('0x1'));var zipdir=require(_0x7d3e('0x2'));var jsonpatch=require(_0x7d3e('0x3'));var rp=require(_0x7d3e('0x4'));var moment=require(_0x7d3e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x7d3e('0x6'));var util=require(_0x7d3e('0x7'));var path=require(_0x7d3e('0x8'));var sox=require(_0x7d3e('0x9'));var csv=require(_0x7d3e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7d3e('0xb'));var squel=require(_0x7d3e('0xc'));var crypto=require(_0x7d3e('0xd'));var jsforce=require(_0x7d3e('0xe'));var deskjs=require(_0x7d3e('0xf'));var toCsv=require(_0x7d3e('0xa'));var querystring=require(_0x7d3e('0x10'));var Papa=require(_0x7d3e('0x11'));var Redis=require('ioredis');var authService=require(_0x7d3e('0x12'));var qs=require(_0x7d3e('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7d3e('0x14'))(_0x7d3e('0x15'));var utils=require(_0x7d3e('0x16'));var config=require(_0x7d3e('0x17'));var licenseUtil=require(_0x7d3e('0x18'));var db=require(_0x7d3e('0x19'))['db'];var integrations=require(_0x7d3e('0x1a'));function respondWithStatusCode(_0x193372,_0x3fe2cb){_0x3fe2cb=_0x3fe2cb||0xcc;return function(_0x232bd3){if(_0x232bd3){return _0x193372['sendStatus'](_0x3fe2cb);}return _0x193372['status'](_0x3fe2cb)[_0x7d3e('0x1b')]();};}function respondWithResult(_0x2eda7e,_0x329202){_0x329202=_0x329202||0xc8;return function(_0x517643){if(_0x517643){return _0x2eda7e[_0x7d3e('0x1c')](_0x329202)[_0x7d3e('0x1d')](_0x517643);}};}function respondWithFilteredResult(_0xd1d05,_0x52b8af){return function(_0x476de7){if(_0x476de7){var _0x5e705=typeof _0x52b8af['offset']===_0x7d3e('0x1e')&&typeof _0x52b8af['limit']===_0x7d3e('0x1e');var _0x53ed37=_0x476de7[_0x7d3e('0x1f')];var _0x63f644=_0x5e705?0x0:_0x52b8af[_0x7d3e('0x20')];var _0xe2c44c=_0x5e705?_0x476de7['count']:_0x52b8af[_0x7d3e('0x20')]+_0x52b8af[_0x7d3e('0x21')];var _0x194617;if(_0xe2c44c>=_0x53ed37){_0xe2c44c=_0x53ed37;_0x194617=0xc8;}else{_0x194617=0xce;}_0xd1d05[_0x7d3e('0x1c')](_0x194617);return _0xd1d05[_0x7d3e('0x22')](_0x7d3e('0x23'),_0x63f644+'-'+_0xe2c44c+'/'+_0x53ed37)['json'](_0x476de7);}return null;};}function patchUpdates(_0x4a7c00){return function(_0x19669b){try{jsonpatch[_0x7d3e('0x24')](_0x19669b,_0x4a7c00,!![]);}catch(_0x3ba19a){return BPromise[_0x7d3e('0x25')](_0x3ba19a);}return _0x19669b['save']();};}function saveUpdates(_0x334286,_0xd5f8f9){return function(_0x593833){if(_0x593833){return _0x593833[_0x7d3e('0x26')](_0x334286)[_0x7d3e('0x27')](function(_0x5cc0d9){return _0x5cc0d9;});}return null;};}function removeEntity(_0x34aa89,_0x12b906){return function(_0x59ba1b){if(_0x59ba1b){return _0x59ba1b['destroy']()[_0x7d3e('0x27')](function(){_0x34aa89[_0x7d3e('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4718ba,_0x6de968){return function(_0x9b8fa1){if(!_0x9b8fa1){_0x4718ba['sendStatus'](0x194);}return _0x9b8fa1;};}function handleError(_0x4a3045,_0x35168c){_0x35168c=_0x35168c||0x1f4;return function(_0x28419e){logger['error'](_0x28419e[_0x7d3e('0x28')]);if(_0x28419e[_0x7d3e('0x29')]){delete _0x28419e[_0x7d3e('0x29')];}_0x4a3045[_0x7d3e('0x1c')](_0x35168c)[_0x7d3e('0x2a')](_0x28419e);};}exports['index']=function(_0x21621b,_0x75f161){var _0x381927={},_0x343f1f={},_0x46cddd={'count':0x0,'rows':[]};var _0x418a82=_['map'](db[_0x7d3e('0x2b')][_0x7d3e('0x2c')],function(_0x5e0a80){return{'name':_0x5e0a80[_0x7d3e('0x2d')],'type':_0x5e0a80[_0x7d3e('0x2e')][_0x7d3e('0x2f')]};});_0x343f1f[_0x7d3e('0x30')]=_[_0x7d3e('0x31')](_0x418a82,_0x7d3e('0x29'));_0x343f1f[_0x7d3e('0x32')]=_[_0x7d3e('0x33')](_0x21621b['query']);_0x343f1f[_0x7d3e('0x34')]=_[_0x7d3e('0x35')](_0x343f1f[_0x7d3e('0x30')],_0x343f1f[_0x7d3e('0x32')]);_0x381927[_0x7d3e('0x36')]=_[_0x7d3e('0x35')](_0x343f1f[_0x7d3e('0x30')],qs[_0x7d3e('0x37')](_0x21621b[_0x7d3e('0x32')]['fields']));_0x381927['attributes']=_0x381927[_0x7d3e('0x36')][_0x7d3e('0x38')]?_0x381927[_0x7d3e('0x36')]:_0x343f1f[_0x7d3e('0x30')];if(!_0x21621b[_0x7d3e('0x32')][_0x7d3e('0x39')](_0x7d3e('0x3a'))){_0x381927['limit']=qs[_0x7d3e('0x21')](_0x21621b[_0x7d3e('0x32')][_0x7d3e('0x21')]);_0x381927[_0x7d3e('0x20')]=qs[_0x7d3e('0x20')](_0x21621b[_0x7d3e('0x32')][_0x7d3e('0x20')]);}_0x381927[_0x7d3e('0x3b')]=qs[_0x7d3e('0x3c')](_0x21621b[_0x7d3e('0x32')]['sort']);_0x381927[_0x7d3e('0x3d')]=qs['filters'](_[_0x7d3e('0x3e')](_0x21621b[_0x7d3e('0x32')],_0x343f1f[_0x7d3e('0x34')]),_0x418a82);if(_0x21621b[_0x7d3e('0x32')]['filter']){_0x381927[_0x7d3e('0x3d')]=_[_0x7d3e('0x3f')](_0x381927[_0x7d3e('0x3d')],{'$or':_[_0x7d3e('0x31')](_0x418a82,function(_0x45c858){if(_0x45c858[_0x7d3e('0x2e')]!==_0x7d3e('0x40')){var _0x4d5bcb={};_0x4d5bcb[_0x45c858[_0x7d3e('0x29')]]={'$like':'%'+_0x21621b[_0x7d3e('0x32')][_0x7d3e('0x41')]+'%'};return _0x4d5bcb;}})});}_0x381927=_[_0x7d3e('0x3f')]({},_0x381927,_0x21621b[_0x7d3e('0x42')]);var _0x5a8126={'where':_0x381927[_0x7d3e('0x3d')]};return db['SugarcrmAccount']['count'](_0x5a8126)[_0x7d3e('0x27')](function(_0x2c7d41){_0x46cddd['count']=_0x2c7d41;if(_0x21621b['query']['includeAll']){_0x381927['include']=[{'all':!![]}];}return db[_0x7d3e('0x2b')][_0x7d3e('0x43')](_0x381927);})[_0x7d3e('0x27')](function(_0x1cbda1){_0x46cddd[_0x7d3e('0x44')]=_0x1cbda1;return _0x46cddd;})[_0x7d3e('0x27')](respondWithFilteredResult(_0x75f161,_0x381927))['catch'](handleError(_0x75f161,null));};exports[_0x7d3e('0x45')]=function(_0x26b0be,_0x41acb6){var _0x2a5893={'raw':![],'where':{'id':_0x26b0be[_0x7d3e('0x46')]['id']}},_0x2362dc={};_0x2362dc['model']=_[_0x7d3e('0x33')](db['SugarcrmAccount'][_0x7d3e('0x2c')]);_0x2362dc[_0x7d3e('0x32')]=_['keys'](_0x26b0be[_0x7d3e('0x32')]);_0x2362dc[_0x7d3e('0x34')]=_[_0x7d3e('0x35')](_0x2362dc[_0x7d3e('0x30')],_0x2362dc[_0x7d3e('0x32')]);_0x2a5893['attributes']=_[_0x7d3e('0x35')](_0x2362dc[_0x7d3e('0x30')],qs[_0x7d3e('0x37')](_0x26b0be['query'][_0x7d3e('0x37')]));_0x2a5893[_0x7d3e('0x36')]=_0x2a5893[_0x7d3e('0x36')]['length']?_0x2a5893[_0x7d3e('0x36')]:_0x2362dc[_0x7d3e('0x30')];if(_0x26b0be[_0x7d3e('0x32')][_0x7d3e('0x47')]){_0x2a5893['include']=[{'all':!![]}];}_0x2a5893=_[_0x7d3e('0x3f')]({},_0x2a5893,_0x26b0be['options']);return db['SugarcrmAccount'][_0x7d3e('0x48')](_0x2a5893)[_0x7d3e('0x27')](handleEntityNotFound(_0x41acb6,null))[_0x7d3e('0x27')](respondWithResult(_0x41acb6,null))[_0x7d3e('0x49')](handleError(_0x41acb6,null));};exports[_0x7d3e('0x4a')]=function(_0x5da7a8,_0x739c33){return db[_0x7d3e('0x2b')][_0x7d3e('0x4a')](_0x5da7a8[_0x7d3e('0x4b')],{})[_0x7d3e('0x27')](respondWithResult(_0x739c33,0xc9))[_0x7d3e('0x49')](handleError(_0x739c33,null));};exports[_0x7d3e('0x26')]=function(_0x48b959,_0x24c8ec){if(_0x48b959[_0x7d3e('0x4b')]['id']){delete _0x48b959[_0x7d3e('0x4b')]['id'];}return db[_0x7d3e('0x2b')][_0x7d3e('0x48')]({'where':{'id':_0x48b959[_0x7d3e('0x46')]['id']}})[_0x7d3e('0x27')](handleEntityNotFound(_0x24c8ec,null))[_0x7d3e('0x27')](saveUpdates(_0x48b959['body'],null))[_0x7d3e('0x27')](respondWithResult(_0x24c8ec,null))['catch'](handleError(_0x24c8ec,null));};exports[_0x7d3e('0x4c')]=function(_0x3d849e,_0x2239c7){return db[_0x7d3e('0x2b')][_0x7d3e('0x48')]({'where':{'id':_0x3d849e[_0x7d3e('0x46')]['id']}})[_0x7d3e('0x27')](handleEntityNotFound(_0x2239c7,null))[_0x7d3e('0x27')](removeEntity(_0x2239c7,null))[_0x7d3e('0x49')](handleError(_0x2239c7,null));};exports[_0x7d3e('0x4d')]=function(_0x437899,_0x32501c,_0x143583){var _0x2f9d0a={};var _0x1acd2f={};var _0x1807ee;var _0xf426a4;return db[_0x7d3e('0x2b')][_0x7d3e('0x4e')]({'where':{'id':_0x437899['params']['id']}})[_0x7d3e('0x27')](handleEntityNotFound(_0x32501c,null))[_0x7d3e('0x27')](function(_0x4445d3){if(_0x4445d3){_0x1807ee=_0x4445d3;_0x1acd2f[_0x7d3e('0x30')]=_[_0x7d3e('0x33')](db[_0x7d3e('0x4f')][_0x7d3e('0x2c')]);_0x1acd2f[_0x7d3e('0x32')]=_[_0x7d3e('0x33')](_0x437899[_0x7d3e('0x32')]);_0x1acd2f['filters']=_[_0x7d3e('0x35')](_0x1acd2f['model'],_0x1acd2f[_0x7d3e('0x32')]);_0x2f9d0a[_0x7d3e('0x36')]=_[_0x7d3e('0x35')](_0x1acd2f[_0x7d3e('0x30')],qs[_0x7d3e('0x37')](_0x437899[_0x7d3e('0x32')][_0x7d3e('0x37')]));_0x2f9d0a[_0x7d3e('0x36')]=_0x2f9d0a[_0x7d3e('0x36')][_0x7d3e('0x38')]?_0x2f9d0a[_0x7d3e('0x36')]:_0x1acd2f[_0x7d3e('0x30')];_0x2f9d0a[_0x7d3e('0x3b')]=qs['sort'](_0x437899[_0x7d3e('0x32')]['sort']);_0x2f9d0a['where']=qs['filters'](_['pick'](_0x437899[_0x7d3e('0x32')],_0x1acd2f[_0x7d3e('0x34')]));if(_0x437899[_0x7d3e('0x32')][_0x7d3e('0x41')]){_0x2f9d0a['where']=_[_0x7d3e('0x3f')](_0x2f9d0a[_0x7d3e('0x3d')],{'$or':_[_0x7d3e('0x31')](_0x2f9d0a['attributes'],function(_0x50dc86){var _0x3e520a={};_0x3e520a[_0x50dc86]={'$like':'%'+_0x437899[_0x7d3e('0x32')][_0x7d3e('0x41')]+'%'};return _0x3e520a;})});}_0x2f9d0a=_['merge']({},_0x2f9d0a,_0x437899['options']);return _0x1807ee[_0x7d3e('0x4d')](_0x2f9d0a);}})[_0x7d3e('0x27')](function(_0x386529){if(_0x386529){_0xf426a4=_0x386529[_0x7d3e('0x38')];if(!_0x437899['query'][_0x7d3e('0x39')](_0x7d3e('0x3a'))){_0x2f9d0a[_0x7d3e('0x21')]=qs[_0x7d3e('0x21')](_0x437899[_0x7d3e('0x32')][_0x7d3e('0x21')]);_0x2f9d0a[_0x7d3e('0x20')]=qs[_0x7d3e('0x20')](_0x437899['query'][_0x7d3e('0x20')]);}return _0x1807ee[_0x7d3e('0x4d')](_0x2f9d0a);}})[_0x7d3e('0x27')](function(_0x245a5b){if(_0x245a5b){return _0x245a5b?{'count':_0xf426a4,'rows':_0x245a5b}:null;}})[_0x7d3e('0x27')](respondWithResult(_0x32501c,null))[_0x7d3e('0x49')](handleError(_0x32501c,null));};exports[_0x7d3e('0x50')]=function(_0x5dd46c,_0x404472,_0x1ddf63){if(_0x5dd46c[_0x7d3e('0x4b')]['id']){delete _0x5dd46c['body']['id'];}return db['SugarcrmAccount'][_0x7d3e('0x4e')]({'where':{'id':_0x5dd46c[_0x7d3e('0x46')]['id']}})[_0x7d3e('0x27')](handleEntityNotFound(_0x404472,null))[_0x7d3e('0x27')](function(_0x22176b){if(_0x22176b){_0x5dd46c[_0x7d3e('0x4b')][_0x7d3e('0x51')]=_0x22176b['id'];_0x5dd46c['body'][_0x7d3e('0x52')]=integrations[_0x7d3e('0x53')](_0x5dd46c[_0x7d3e('0x4b')][_0x7d3e('0x54')],_0x5dd46c[_0x7d3e('0x4b')]['type']);_0x5dd46c[_0x7d3e('0x4b')][_0x7d3e('0x55')]=integrations[_0x7d3e('0x56')](_0x5dd46c[_0x7d3e('0x4b')][_0x7d3e('0x54')],_0x5dd46c[_0x7d3e('0x4b')][_0x7d3e('0x2e')]);return db[_0x7d3e('0x4f')]['create'](_0x5dd46c['body'],{'include':[{'model':db[_0x7d3e('0x57')],'as':'Subjects'},{'model':db[_0x7d3e('0x57')],'as':_0x7d3e('0x55')}]});}return null;})[_0x7d3e('0x27')](respondWithResult(_0x404472,null))[_0x7d3e('0x49')](handleError(_0x404472,null));};exports['getFields']=function(_0xf30e50,_0x54d981,_0x440930){var _0x338fbb='';var _0x5eab1b=['id',_0x7d3e('0x29'),_0x7d3e('0x58'),_0x7d3e('0x59'),_0x7d3e('0x5a'),_0x7d3e('0x5b'),_0x7d3e('0x5c'),_0x7d3e('0x5d'),_0x7d3e('0x5e'),_0x7d3e('0x5f'),_0x7d3e('0x60'),_0x7d3e('0x61')];return db[_0x7d3e('0x2b')][_0x7d3e('0x4e')]({'where':{'id':_0xf30e50[_0x7d3e('0x46')]['id']},'attributes':['id',_0x7d3e('0x62'),_0x7d3e('0x63'),_0x7d3e('0x64')]})[_0x7d3e('0x27')](handleEntityNotFound(_0x54d981,null))[_0x7d3e('0x27')](function(_0x31c260){if(_0x31c260){_0x338fbb=_0x31c260[_0x7d3e('0x64')];var _0x18e8ce=_0x338fbb[_0x7d3e('0x65')](-0x1);if(_0x18e8ce==='/'){_0x338fbb=_0x338fbb[_0x7d3e('0x66')](0x0,_0x338fbb[_0x7d3e('0x67')](_0x18e8ce));}return rp({'method':_0x7d3e('0x68'),'uri':util[_0x7d3e('0x69')](_0x7d3e('0x6a'),_0x338fbb,_0x7d3e('0x6b')),'json':!![],'form':{'method':_0x7d3e('0x6c'),'input_type':'JSON','response_type':_0x7d3e('0x6d'),'rest_data':JSON[_0x7d3e('0x6e')]({'user_auth':{'user_name':_0x31c260['username'],'password':_0x31c260[_0x7d3e('0x63')],'encryption':_0x7d3e('0x6f')},'application':_0x7d3e('0x70')})}});}})['then'](function(_0x7aa337){if(_0x7aa337&&_0x7aa337[_0x7d3e('0x29')]!==_0x7d3e('0x71')&&_0x7aa337[_0x7d3e('0x29')]!==_0x7d3e('0x72')){return rp({'method':_0x7d3e('0x68'),'uri':util[_0x7d3e('0x69')](_0x7d3e('0x6a'),_0x338fbb,_0x7d3e('0x6b')),'json':!![],'form':{'method':_0x7d3e('0x73'),'input_type':_0x7d3e('0x6d'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x7aa337['id'],'module_name':_0x7d3e('0x74')})}})[_0x7d3e('0x27')](function(_0x2001f2){if(_0x2001f2){var _0x30f35e=_['values'](_0x2001f2[_0x7d3e('0x75')]);_[_0x7d3e('0x76')](_0x30f35e,function(_0xc725c){return _0x5eab1b[_0x7d3e('0x77')](_0xc725c[_0x7d3e('0x29')]);});return{'count':_0x30f35e['length'],'rows':_[_0x7d3e('0x31')](_0x30f35e,function(_0x381010){return{'id':_0x381010[_0x7d3e('0x29')],'name':_0x381010[_0x7d3e('0x78')],'custom':_[_0x7d3e('0x79')](_0x381010[_0x7d3e('0x29')],'_c')?!![]:![],'options':_0x381010[_0x7d3e('0x42')]?_[_0x7d3e('0x31')](_[_0x7d3e('0x7a')](_0x381010[_0x7d3e('0x42')]),function(_0xb749f4){return{'name':_0xb749f4['value'],'value':_0xb749f4[_0x7d3e('0x29')]};}):[]};})};}})[_0x7d3e('0x27')](respondWithResult(_0x54d981,null))['catch'](function(_0x27c557){var _0x588b13=_0xf30e50['query']['test']?0x1f4:_0x27c557[_0x7d3e('0x7b')]||0x1f4;logger[_0x7d3e('0x7c')](_0x7d3e('0x7d'),'getFields',_0x588b13,JSON[_0x7d3e('0x6e')](_0x27c557));delete _0x27c557['name'];if(_0x588b13===0x191){_0x588b13=0x190;}_0x54d981[_0x7d3e('0x1c')](_0x588b13)[_0x7d3e('0x2a')](_0xf30e50[_0x7d3e('0x32')][_0x7d3e('0x7e')]?{'message':_0x7d3e('0x7f'),'statusCode':_0x27c557[_0x7d3e('0x7b')]}:_0x27c557);});}else{var _0x3449e4=0x1f4;_0x54d981[_0x7d3e('0x1c')](_0x3449e4)['send']({'message':'Wrong\x20credentials','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 4bbb05e..24aad6c 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 _0x5c82=['rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x5b84e8,_0xab1d30){var _0x441ef8=function(_0x14b25e){while(--_0x14b25e){_0x5b84e8['push'](_0x5b84e8['shift']());}};_0x441ef8(++_0xab1d30);}(_0x5c82,0x198));var _0x25c8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5c82[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x25c8('0x0'));var util=require(_0x25c8('0x1'));var logger=require(_0x25c8('0x2'))(_0x25c8('0x3'));var moment=require(_0x25c8('0x4'));var BPromise=require(_0x25c8('0x5'));var rp=require(_0x25c8('0x6'));var fs=require('fs');var path=require(_0x25c8('0x7'));var rimraf=require(_0x25c8('0x8'));var config=require(_0x25c8('0x9'));var attributes=require(_0x25c8('0xa'));var integrations=require(_0x25c8('0xb'));module[_0x25c8('0xc')]=function(_0x131ee7,_0x33f1ba){return _0x131ee7[_0x25c8('0xd')](_0x25c8('0xe'),attributes,{'tableName':_0x25c8('0xf'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x06d9=['SugarcrmAccount','int_sugarcrm_accounts','lodash','util','../../config/logger','moment','bluebird','request-promise','path','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define'];(function(_0x20c53d,_0xef4c4e){var _0x3835a8=function(_0x799192){while(--_0x799192){_0x20c53d['push'](_0x20c53d['shift']());}};_0x3835a8(++_0xef4c4e);}(_0x06d9,0xab));var _0x906d=function(_0x4f404f,_0x11c2c9){_0x4f404f=_0x4f404f-0x0;var _0x967c25=_0x06d9[_0x4f404f];return _0x967c25;};'use strict';var _=require(_0x906d('0x0'));var util=require(_0x906d('0x1'));var logger=require(_0x906d('0x2'))('api');var moment=require(_0x906d('0x3'));var BPromise=require(_0x906d('0x4'));var rp=require(_0x906d('0x5'));var fs=require('fs');var path=require(_0x906d('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x906d('0x7'));var integrations=require(_0x906d('0x8'));module[_0x906d('0x9')]=function(_0x3f4b9c,_0xf2ff2){return _0x3f4b9c[_0x906d('0xa')](_0x906d('0xb'),attributes,{'tableName':_0x906d('0xc'),'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 6823b23..7ed8d33 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 _0xe148=['attributes','catch','ShowSugarcrmAccount','find','util','bluebird','ioredis','../../mysqldb','../../config/environment','client','http','request','then','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where','limit','include','map','model'];(function(_0x1782ae,_0x9bcc0c){var _0x1d7cfc=function(_0xa10d16){while(--_0xa10d16){_0x1782ae['push'](_0x1782ae['shift']());}};_0x1d7cfc(++_0x9bcc0c);}(_0xe148,0xfc));var _0x8e14=function(_0xd60031,_0x5efb93){_0xd60031=_0xd60031-0x0;var _0x43d00a=_0xe148[_0xd60031];return _0x43d00a;};'use strict';var _=require('lodash');var util=require(_0x8e14('0x0'));var moment=require('moment');var BPromise=require(_0x8e14('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8e14('0x2'));var db=require(_0x8e14('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x8e14('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x8e14('0x5')][_0x8e14('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x479e3e,_0x17461b,_0x3ce933){return new BPromise(function(_0x108344,_0x78c49d){return client[_0x8e14('0x7')](_0x479e3e,_0x3ce933)[_0x8e14('0x8')](function(_0x38c8aa){logger['info'](_0x8e14('0x9'),_0x17461b,_0x8e14('0xa'));logger[_0x8e14('0xb')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x17461b,'request\x20sent',JSON[_0x8e14('0xc')](_0x38c8aa));if(_0x38c8aa[_0x8e14('0xd')]){if(_0x38c8aa[_0x8e14('0xd')]['code']===0x1f4){logger[_0x8e14('0xd')](_0x8e14('0x9'),_0x17461b,_0x38c8aa[_0x8e14('0xd')][_0x8e14('0xe')]);return _0x78c49d(_0x38c8aa['error']['message']);}logger[_0x8e14('0xd')](_0x8e14('0x9'),_0x17461b,_0x38c8aa['error'][_0x8e14('0xe')]);return _0x108344(_0x38c8aa[_0x8e14('0xd')][_0x8e14('0xe')]);}else{logger[_0x8e14('0xf')]('SugarcrmAccount,\x20%s,\x20%s',_0x17461b,_0x8e14('0xa'));_0x108344(_0x38c8aa[_0x8e14('0x10')][_0x8e14('0xe')]);}})['catch'](function(_0x2600bc){logger[_0x8e14('0xd')](_0x8e14('0x9'),_0x17461b,_0x2600bc);_0x78c49d(_0x2600bc);});});}exports[_0x8e14('0x11')]=function(_0x4eba39){var _0x1a63d6=this;return new Promise(function(_0x4c05a7,_0x39f9fa){return db[_0x8e14('0x12')][_0x8e14('0x13')]({'raw':_0x4eba39[_0x8e14('0x14')]?_0x4eba39[_0x8e14('0x14')][_0x8e14('0x15')]===undefined?!![]:![]:!![],'where':_0x4eba39[_0x8e14('0x14')]?_0x4eba39[_0x8e14('0x14')][_0x8e14('0x16')]||null:null,'attributes':_0x4eba39[_0x8e14('0x14')]?_0x4eba39['options']['attributes']||null:null,'limit':_0x4eba39[_0x8e14('0x14')]?_0x4eba39[_0x8e14('0x14')][_0x8e14('0x17')]||null:null,'include':_0x4eba39['options']?_0x4eba39[_0x8e14('0x14')][_0x8e14('0x18')]?_[_0x8e14('0x19')](_0x4eba39['options'][_0x8e14('0x18')],function(_0x3411a8){return{'model':db[_0x3411a8['model']],'as':_0x3411a8['as'],'attributes':_0x3411a8['attributes'],'include':_0x3411a8[_0x8e14('0x18')]?_[_0x8e14('0x19')](_0x3411a8[_0x8e14('0x18')],function(_0x12716f){return{'model':db[_0x12716f[_0x8e14('0x1a')]],'as':_0x12716f['as'],'attributes':_0x12716f[_0x8e14('0x1b')],'include':_0x12716f[_0x8e14('0x18')]?_[_0x8e14('0x19')](_0x12716f[_0x8e14('0x18')],function(_0x6d742b){return{'model':db[_0x6d742b[_0x8e14('0x1a')]],'as':_0x6d742b['as'],'attributes':_0x6d742b[_0x8e14('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x8e14('0x8')](function(_0x23dbe6){logger[_0x8e14('0xf')](_0x8e14('0x11'),_0x4eba39);logger[_0x8e14('0xb')](_0x8e14('0x11'),_0x4eba39,JSON[_0x8e14('0xc')](_0x23dbe6));_0x4c05a7(_0x23dbe6);})[_0x8e14('0x1c')](function(_0x4a6ebc){logger[_0x8e14('0xd')](_0x8e14('0x11'),_0x4a6ebc[_0x8e14('0xe')],_0x4eba39);_0x39f9fa(_0x1a63d6[_0x8e14('0xd')](0x1f4,_0x4a6ebc[_0x8e14('0xe')]));});});};exports[_0x8e14('0x1d')]=function(_0x229487){var _0x58861d=this;return new Promise(function(_0x2e86a7,_0x476ea4){return db[_0x8e14('0x12')][_0x8e14('0x1e')]({'raw':_0x229487[_0x8e14('0x14')]?_0x229487[_0x8e14('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x229487[_0x8e14('0x14')]?_0x229487[_0x8e14('0x14')][_0x8e14('0x16')]||null:null,'attributes':_0x229487[_0x8e14('0x14')]?_0x229487['options']['attributes']||null:null,'include':_0x229487['options']?_0x229487[_0x8e14('0x14')]['include']?_[_0x8e14('0x19')](_0x229487[_0x8e14('0x14')][_0x8e14('0x18')],function(_0x463c8d){return{'model':db[_0x463c8d[_0x8e14('0x1a')]],'as':_0x463c8d['as'],'attributes':_0x463c8d[_0x8e14('0x1b')],'include':_0x463c8d[_0x8e14('0x18')]?_[_0x8e14('0x19')](_0x463c8d[_0x8e14('0x18')],function(_0x1770c0){return{'model':db[_0x1770c0[_0x8e14('0x1a')]],'as':_0x1770c0['as'],'attributes':_0x1770c0[_0x8e14('0x1b')],'include':_0x1770c0[_0x8e14('0x18')]?_[_0x8e14('0x19')](_0x1770c0[_0x8e14('0x18')],function(_0x119d4c){return{'model':db[_0x119d4c[_0x8e14('0x1a')]],'as':_0x119d4c['as'],'attributes':_0x119d4c[_0x8e14('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x8e14('0x8')](function(_0xc79f58){logger[_0x8e14('0xf')](_0x8e14('0x1d'),_0x229487);logger['debug'](_0x8e14('0x1d'),_0x229487,JSON[_0x8e14('0xc')](_0xc79f58));_0x2e86a7(_0xc79f58);})['catch'](function(_0x4388e2){logger[_0x8e14('0xd')](_0x8e14('0x1d'),_0x4388e2['message'],_0x229487);_0x476ea4(_0x58861d[_0x8e14('0xd')](0x1f4,_0x4388e2['message']));});});}; \ No newline at end of file +var _0x6815=['limit','map','model','include','catch','ShowSugarcrmAccount','SugarcrmAccount','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','GetSugarcrmAccount','findAll','options','raw','where','attributes'];(function(_0x5a67af,_0xba474a){var _0x3c159e=function(_0x3bdc96){while(--_0x3bdc96){_0x5a67af['push'](_0x5a67af['shift']());}};_0x3c159e(++_0xba474a);}(_0x6815,0x17d));var _0x5681=function(_0x40b6ee,_0x3bfffc){_0x40b6ee=_0x40b6ee-0x0;var _0x2004ff=_0x6815[_0x40b6ee];return _0x2004ff;};'use strict';var _=require(_0x5681('0x0'));var util=require('util');var moment=require(_0x5681('0x1'));var BPromise=require(_0x5681('0x2'));var rs=require(_0x5681('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5681('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5681('0x5'))(_0x5681('0x6'));var config=require('../../config/environment');var jayson=require(_0x5681('0x7'));var client=jayson[_0x5681('0x8')][_0x5681('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3fb61d,_0x1ea552,_0x4da35f){return new BPromise(function(_0x373805,_0x5527dd){return client['request'](_0x3fb61d,_0x4da35f)[_0x5681('0xa')](function(_0x151dfa){logger[_0x5681('0xb')](_0x5681('0xc'),_0x1ea552,_0x5681('0xd'));logger[_0x5681('0xe')](_0x5681('0xf'),_0x1ea552,_0x5681('0xd'),JSON[_0x5681('0x10')](_0x151dfa));if(_0x151dfa['error']){if(_0x151dfa['error'][_0x5681('0x11')]===0x1f4){logger[_0x5681('0x12')](_0x5681('0xc'),_0x1ea552,_0x151dfa['error'][_0x5681('0x13')]);return _0x5527dd(_0x151dfa[_0x5681('0x12')]['message']);}logger[_0x5681('0x12')](_0x5681('0xc'),_0x1ea552,_0x151dfa['error'][_0x5681('0x13')]);return _0x373805(_0x151dfa[_0x5681('0x12')][_0x5681('0x13')]);}else{logger['info'](_0x5681('0xc'),_0x1ea552,'request\x20sent');_0x373805(_0x151dfa[_0x5681('0x14')]['message']);}})['catch'](function(_0x2ec3f5){logger[_0x5681('0x12')](_0x5681('0xc'),_0x1ea552,_0x2ec3f5);_0x5527dd(_0x2ec3f5);});});}exports[_0x5681('0x15')]=function(_0x2f6fea){var _0xebd2dc=this;return new Promise(function(_0x5d292c,_0x1b6dd6){return db['SugarcrmAccount'][_0x5681('0x16')]({'raw':_0x2f6fea['options']?_0x2f6fea[_0x5681('0x17')][_0x5681('0x18')]===undefined?!![]:![]:!![],'where':_0x2f6fea[_0x5681('0x17')]?_0x2f6fea[_0x5681('0x17')][_0x5681('0x19')]||null:null,'attributes':_0x2f6fea[_0x5681('0x17')]?_0x2f6fea[_0x5681('0x17')][_0x5681('0x1a')]||null:null,'limit':_0x2f6fea[_0x5681('0x17')]?_0x2f6fea[_0x5681('0x17')][_0x5681('0x1b')]||null:null,'include':_0x2f6fea[_0x5681('0x17')]?_0x2f6fea[_0x5681('0x17')]['include']?_[_0x5681('0x1c')](_0x2f6fea[_0x5681('0x17')]['include'],function(_0x193f59){return{'model':db[_0x193f59[_0x5681('0x1d')]],'as':_0x193f59['as'],'attributes':_0x193f59[_0x5681('0x1a')],'include':_0x193f59['include']?_[_0x5681('0x1c')](_0x193f59['include'],function(_0x22a15f){return{'model':db[_0x22a15f['model']],'as':_0x22a15f['as'],'attributes':_0x22a15f[_0x5681('0x1a')],'include':_0x22a15f[_0x5681('0x1e')]?_[_0x5681('0x1c')](_0x22a15f[_0x5681('0x1e')],function(_0x113bbe){return{'model':db[_0x113bbe[_0x5681('0x1d')]],'as':_0x113bbe['as'],'attributes':_0x113bbe[_0x5681('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x5681('0xa')](function(_0x50621d){logger[_0x5681('0xb')](_0x5681('0x15'),_0x2f6fea);logger[_0x5681('0xe')](_0x5681('0x15'),_0x2f6fea,JSON['stringify'](_0x50621d));_0x5d292c(_0x50621d);})[_0x5681('0x1f')](function(_0x54d155){logger[_0x5681('0x12')](_0x5681('0x15'),_0x54d155[_0x5681('0x13')],_0x2f6fea);_0x1b6dd6(_0xebd2dc[_0x5681('0x12')](0x1f4,_0x54d155[_0x5681('0x13')]));});});};exports[_0x5681('0x20')]=function(_0x5d2a0b){var _0x1cd53d=this;return new Promise(function(_0x5e2c15,_0x527347){return db[_0x5681('0x21')]['find']({'raw':_0x5d2a0b[_0x5681('0x17')]?_0x5d2a0b[_0x5681('0x17')][_0x5681('0x18')]===undefined?!![]:![]:!![],'where':_0x5d2a0b[_0x5681('0x17')]?_0x5d2a0b['options'][_0x5681('0x19')]||null:null,'attributes':_0x5d2a0b[_0x5681('0x17')]?_0x5d2a0b[_0x5681('0x17')]['attributes']||null:null,'include':_0x5d2a0b['options']?_0x5d2a0b[_0x5681('0x17')][_0x5681('0x1e')]?_[_0x5681('0x1c')](_0x5d2a0b[_0x5681('0x17')][_0x5681('0x1e')],function(_0x527c1d){return{'model':db[_0x527c1d[_0x5681('0x1d')]],'as':_0x527c1d['as'],'attributes':_0x527c1d[_0x5681('0x1a')],'include':_0x527c1d['include']?_[_0x5681('0x1c')](_0x527c1d[_0x5681('0x1e')],function(_0x415f0a){return{'model':db[_0x415f0a['model']],'as':_0x415f0a['as'],'attributes':_0x415f0a['attributes'],'include':_0x415f0a[_0x5681('0x1e')]?_[_0x5681('0x1c')](_0x415f0a[_0x5681('0x1e')],function(_0x1fbfcb){return{'model':db[_0x1fbfcb[_0x5681('0x1d')]],'as':_0x1fbfcb['as'],'attributes':_0x1fbfcb[_0x5681('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x5681('0xa')](function(_0x583695){logger[_0x5681('0xb')](_0x5681('0x20'),_0x5d2a0b);logger[_0x5681('0xe')]('ShowSugarcrmAccount',_0x5d2a0b,JSON[_0x5681('0x10')](_0x583695));_0x5e2c15(_0x583695);})[_0x5681('0x1f')](function(_0x31955c){logger['error'](_0x5681('0x20'),_0x31955c[_0x5681('0x13')],_0x5d2a0b);_0x527347(_0x1cd53d[_0x5681('0x12')](0x1f4,_0x31955c[_0x5681('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index a610b2c..f12c8a1 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 _0x68ee=['get','isAuthenticated','/:id','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x301cd1,_0x18d147){var _0xfd7391=function(_0x2f0bc6){while(--_0x2f0bc6){_0x301cd1['push'](_0x301cd1['shift']());}};_0xfd7391(++_0x18d147);}(_0x68ee,0xd3));var _0xe68e=function(_0x3d8633,_0x4641d8){_0x3d8633=_0x3d8633-0x0;var _0x13536b=_0x68ee[_0x3d8633];return _0x13536b;};'use strict';var multer=require(_0xe68e('0x0'));var util=require(_0xe68e('0x1'));var path=require(_0xe68e('0x2'));var timeout=require(_0xe68e('0x3'));var express=require(_0xe68e('0x4'));var router=express[_0xe68e('0x5')]();var fs_extra=require(_0xe68e('0x6'));var auth=require(_0xe68e('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xe68e('0x8'));var controller=require('./intSugarcrmConfiguration.controller');router[_0xe68e('0x9')]('/',auth[_0xe68e('0xa')](),controller['index']);router[_0xe68e('0x9')](_0xe68e('0xb'),auth['isAuthenticated'](),controller[_0xe68e('0xc')]);router[_0xe68e('0x9')]('/:id/fields',auth[_0xe68e('0xa')](),controller[_0xe68e('0xd')]);router['get'](_0xe68e('0xe'),auth[_0xe68e('0xa')](),controller[_0xe68e('0xf')]);router[_0xe68e('0x9')](_0xe68e('0x10'),auth[_0xe68e('0xa')](),controller['getDescriptions']);router['post']('/',auth[_0xe68e('0xa')](),controller[_0xe68e('0x11')]);router[_0xe68e('0x12')](_0xe68e('0xb'),auth[_0xe68e('0xa')](),controller['update']);router[_0xe68e('0x13')]('/:id',auth[_0xe68e('0xa')](),controller[_0xe68e('0x14')]);module[_0xe68e('0x15')]=router; \ No newline at end of file +var _0x8dff=['create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/:id','isAuthenticated','getFields','getSubjects','/:id/descriptions','getDescriptions','post'];(function(_0x247c08,_0x574f65){var _0x5b6ddd=function(_0x457b65){while(--_0x457b65){_0x247c08['push'](_0x247c08['shift']());}};_0x5b6ddd(++_0x574f65);}(_0x8dff,0x175));var _0xf8df=function(_0x3bd0a1,_0x388036){_0x3bd0a1=_0x3bd0a1-0x0;var _0x41d689=_0x8dff[_0x3bd0a1];return _0x41d689;};'use strict';var multer=require(_0xf8df('0x0'));var util=require(_0xf8df('0x1'));var path=require(_0xf8df('0x2'));var timeout=require(_0xf8df('0x3'));var express=require(_0xf8df('0x4'));var router=express[_0xf8df('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xf8df('0x6'));var interaction=require(_0xf8df('0x7'));var config=require(_0xf8df('0x8'));var controller=require('./intSugarcrmConfiguration.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xf8df('0x9')]);router[_0xf8df('0xa')](_0xf8df('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xf8df('0xa')]('/:id/fields',auth[_0xf8df('0xc')](),controller[_0xf8df('0xd')]);router[_0xf8df('0xa')]('/:id/subjects',auth[_0xf8df('0xc')](),controller[_0xf8df('0xe')]);router[_0xf8df('0xa')](_0xf8df('0xf'),auth['isAuthenticated'](),controller[_0xf8df('0x10')]);router[_0xf8df('0x11')]('/',auth['isAuthenticated'](),controller[_0xf8df('0x12')]);router[_0xf8df('0x13')](_0xf8df('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xf8df('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xf8df('0x15')]);module[_0xf8df('0x16')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 47bccc0..e83279d 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 _0x90e2=['sequelize','exports','STRING'];(function(_0x55daf2,_0x1b48de){var _0x1c8500=function(_0x4686b5){while(--_0x4686b5){_0x55daf2['push'](_0x55daf2['shift']());}};_0x1c8500(++_0x1b48de);}(_0x90e2,0x18f));var _0x290e=function(_0x2b1874,_0x3310ed){_0x2b1874=_0x2b1874-0x0;var _0xdb3d1a=_0x90e2[_0x2b1874];return _0xdb3d1a;};'use strict';var Sequelize=require(_0x290e('0x0'));module[_0x290e('0x1')]={'name':{'type':Sequelize[_0x290e('0x2')]},'description':{'type':Sequelize[_0x290e('0x2')]}}; \ No newline at end of file +var _0xe7a4=['sequelize','STRING'];(function(_0x58041f,_0x1a21a1){var _0xfba036=function(_0x167e7e){while(--_0x167e7e){_0x58041f['push'](_0x58041f['shift']());}};_0xfba036(++_0x1a21a1);}(_0xe7a4,0x116));var _0x4e7a=function(_0x3f907a,_0x515c65){_0x3f907a=_0x3f907a-0x0;var _0x27ae16=_0xe7a4[_0x3f907a];return _0x27ae16;};'use strict';var Sequelize=require(_0x4e7a('0x0'));module['exports']={'name':{'type':Sequelize[_0x4e7a('0x1')]},'description':{'type':Sequelize[_0x4e7a('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 93b8104..6046447 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 _0x1e7f=['getFields','hasOwnProperty','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','SugarcrmConfiguration','rawAttributes','fieldName','type','key','query','keys','model','attributes','intersection','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','show','create','body','find','params','catch','findOne','SugarcrmField'];(function(_0x556bb1,_0x34830d){var _0x45455f=function(_0x13c6ba){while(--_0x13c6ba){_0x556bb1['push'](_0x556bb1['shift']());}};_0x45455f(++_0x34830d);}(_0x1e7f,0xac));var _0xf1e7=function(_0x57f19e,_0x2d6f6b){_0x57f19e=_0x57f19e-0x0;var _0x2c362d=_0x1e7f[_0x57f19e];return _0x2c362d;};'use strict';var emlformat=require(_0xf1e7('0x0'));var rimraf=require(_0xf1e7('0x1'));var zipdir=require(_0xf1e7('0x2'));var jsonpatch=require(_0xf1e7('0x3'));var rp=require(_0xf1e7('0x4'));var moment=require(_0xf1e7('0x5'));var BPromise=require(_0xf1e7('0x6'));var Mustache=require(_0xf1e7('0x7'));var util=require(_0xf1e7('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xf1e7('0x9'));var ejs=require(_0xf1e7('0xa'));var fs=require('fs');var fs_extra=require(_0xf1e7('0xb'));var _=require(_0xf1e7('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf1e7('0xd'));var deskjs=require(_0xf1e7('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf1e7('0xf'));var Papa=require(_0xf1e7('0x10'));var Redis=require(_0xf1e7('0x11'));var authService=require(_0xf1e7('0x12'));var qs=require(_0xf1e7('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf1e7('0x14'));var logger=require(_0xf1e7('0x15'))(_0xf1e7('0x16'));var utils=require(_0xf1e7('0x17'));var config=require(_0xf1e7('0x18'));var licenseUtil=require(_0xf1e7('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2282b9,_0x44a559){_0x44a559=_0x44a559||0xcc;return function(_0x59af38){if(_0x59af38){return _0x2282b9[_0xf1e7('0x1a')](_0x44a559);}return _0x2282b9[_0xf1e7('0x1b')](_0x44a559)[_0xf1e7('0x1c')]();};}function respondWithResult(_0x38ccb8,_0x13918a){_0x13918a=_0x13918a||0xc8;return function(_0x9eadfa){if(_0x9eadfa){return _0x38ccb8[_0xf1e7('0x1b')](_0x13918a)[_0xf1e7('0x1d')](_0x9eadfa);}};}function respondWithFilteredResult(_0x1c25e9,_0x41ba9b){return function(_0x5341b1){if(_0x5341b1){var _0x2418d5=typeof _0x41ba9b['offset']==='undefined'&&typeof _0x41ba9b[_0xf1e7('0x1e')]===_0xf1e7('0x1f');var _0x1edf87=_0x5341b1[_0xf1e7('0x20')];var _0x1acdc9=_0x2418d5?0x0:_0x41ba9b[_0xf1e7('0x21')];var _0x4e653f=_0x2418d5?_0x5341b1[_0xf1e7('0x20')]:_0x41ba9b[_0xf1e7('0x21')]+_0x41ba9b[_0xf1e7('0x1e')];var _0x589c6f;if(_0x4e653f>=_0x1edf87){_0x4e653f=_0x1edf87;_0x589c6f=0xc8;}else{_0x589c6f=0xce;}_0x1c25e9['status'](_0x589c6f);return _0x1c25e9[_0xf1e7('0x22')](_0xf1e7('0x23'),_0x1acdc9+'-'+_0x4e653f+'/'+_0x1edf87)[_0xf1e7('0x1d')](_0x5341b1);}return null;};}function patchUpdates(_0x38c11a){return function(_0x38425d){try{jsonpatch[_0xf1e7('0x24')](_0x38425d,_0x38c11a,!![]);}catch(_0x59aa71){return BPromise[_0xf1e7('0x25')](_0x59aa71);}return _0x38425d['save']();};}function saveUpdates(_0x485e47,_0x18807b){return function(_0x1910ad){if(_0x1910ad){return _0x1910ad[_0xf1e7('0x26')](_0x485e47)[_0xf1e7('0x27')](function(_0x396992){return _0x396992;});}return null;};}function removeEntity(_0x135a77,_0x5b251a){return function(_0x317df1){if(_0x317df1){return _0x317df1[_0xf1e7('0x28')]()[_0xf1e7('0x27')](function(){_0x135a77[_0xf1e7('0x1b')](0xcc)[_0xf1e7('0x1c')]();});}};}function handleEntityNotFound(_0x2d8ee4,_0x27761b){return function(_0x1018bd){if(!_0x1018bd){_0x2d8ee4[_0xf1e7('0x1a')](0x194);}return _0x1018bd;};}function handleError(_0x3b33d8,_0x34cb83){_0x34cb83=_0x34cb83||0x1f4;return function(_0x4e6a8d){logger[_0xf1e7('0x29')](_0x4e6a8d[_0xf1e7('0x2a')]);if(_0x4e6a8d['name']){delete _0x4e6a8d[_0xf1e7('0x2b')];}_0x3b33d8[_0xf1e7('0x1b')](_0x34cb83)[_0xf1e7('0x2c')](_0x4e6a8d);};}exports[_0xf1e7('0x2d')]=function(_0x45b767,_0x38f938){var _0x14dd46={},_0x3875ec={},_0xd40bc3={'count':0x0,'rows':[]};var _0x511470=_[_0xf1e7('0x2e')](db[_0xf1e7('0x2f')][_0xf1e7('0x30')],function(_0x3fa0d4){return{'name':_0x3fa0d4[_0xf1e7('0x31')],'type':_0x3fa0d4[_0xf1e7('0x32')][_0xf1e7('0x33')]};});_0x3875ec['model']=_[_0xf1e7('0x2e')](_0x511470,_0xf1e7('0x2b'));_0x3875ec[_0xf1e7('0x34')]=_[_0xf1e7('0x35')](_0x45b767[_0xf1e7('0x34')]);_0x3875ec['filters']=_['intersection'](_0x3875ec[_0xf1e7('0x36')],_0x3875ec[_0xf1e7('0x34')]);_0x14dd46[_0xf1e7('0x37')]=_[_0xf1e7('0x38')](_0x3875ec[_0xf1e7('0x36')],qs[_0xf1e7('0x39')](_0x45b767[_0xf1e7('0x34')][_0xf1e7('0x39')]));_0x14dd46['attributes']=_0x14dd46[_0xf1e7('0x37')][_0xf1e7('0x3a')]?_0x14dd46[_0xf1e7('0x37')]:_0x3875ec[_0xf1e7('0x36')];if(!_0x45b767[_0xf1e7('0x34')]['hasOwnProperty'](_0xf1e7('0x3b'))){_0x14dd46[_0xf1e7('0x1e')]=qs[_0xf1e7('0x1e')](_0x45b767[_0xf1e7('0x34')][_0xf1e7('0x1e')]);_0x14dd46[_0xf1e7('0x21')]=qs[_0xf1e7('0x21')](_0x45b767[_0xf1e7('0x34')]['offset']);}_0x14dd46[_0xf1e7('0x3c')]=qs[_0xf1e7('0x3d')](_0x45b767[_0xf1e7('0x34')][_0xf1e7('0x3d')]);_0x14dd46[_0xf1e7('0x3e')]=qs[_0xf1e7('0x3f')](_[_0xf1e7('0x40')](_0x45b767[_0xf1e7('0x34')],_0x3875ec['filters']),_0x511470);if(_0x45b767[_0xf1e7('0x34')][_0xf1e7('0x41')]){_0x14dd46['where']=_['merge'](_0x14dd46['where'],{'$or':_[_0xf1e7('0x2e')](_0x511470,function(_0x236dfb){if(_0x236dfb[_0xf1e7('0x32')]!=='VIRTUAL'){var _0x457ed0={};_0x457ed0[_0x236dfb[_0xf1e7('0x2b')]]={'$like':'%'+_0x45b767['query'][_0xf1e7('0x41')]+'%'};return _0x457ed0;}})});}_0x14dd46=_[_0xf1e7('0x42')]({},_0x14dd46,_0x45b767[_0xf1e7('0x43')]);var _0x4a79b6={'where':_0x14dd46[_0xf1e7('0x3e')]};return db['SugarcrmConfiguration'][_0xf1e7('0x20')](_0x4a79b6)[_0xf1e7('0x27')](function(_0x9bd007){_0xd40bc3[_0xf1e7('0x20')]=_0x9bd007;if(_0x45b767[_0xf1e7('0x34')][_0xf1e7('0x44')]){_0x14dd46[_0xf1e7('0x45')]=[{'all':!![]}];}return db[_0xf1e7('0x2f')][_0xf1e7('0x46')](_0x14dd46);})[_0xf1e7('0x27')](function(_0x518bdc){_0xd40bc3[_0xf1e7('0x47')]=_0x518bdc;return _0xd40bc3;})[_0xf1e7('0x27')](respondWithFilteredResult(_0x38f938,_0x14dd46))['catch'](handleError(_0x38f938,null));};exports[_0xf1e7('0x48')]=function(_0x4bee2b,_0xdd6bc5){var _0x7164dc={'raw':![],'where':{'id':_0x4bee2b['params']['id']}},_0x232f9b={};_0x232f9b[_0xf1e7('0x36')]=_[_0xf1e7('0x35')](db[_0xf1e7('0x2f')]['rawAttributes']);_0x232f9b[_0xf1e7('0x34')]=_[_0xf1e7('0x35')](_0x4bee2b[_0xf1e7('0x34')]);_0x232f9b[_0xf1e7('0x3f')]=_['intersection'](_0x232f9b[_0xf1e7('0x36')],_0x232f9b[_0xf1e7('0x34')]);_0x7164dc[_0xf1e7('0x37')]=_[_0xf1e7('0x38')](_0x232f9b[_0xf1e7('0x36')],qs[_0xf1e7('0x39')](_0x4bee2b[_0xf1e7('0x34')]['fields']));_0x7164dc['attributes']=_0x7164dc[_0xf1e7('0x37')][_0xf1e7('0x3a')]?_0x7164dc[_0xf1e7('0x37')]:_0x232f9b[_0xf1e7('0x36')];if(_0x4bee2b['query'][_0xf1e7('0x44')]){_0x7164dc[_0xf1e7('0x45')]=[{'all':!![]}];}_0x7164dc=_[_0xf1e7('0x42')]({},_0x7164dc,_0x4bee2b[_0xf1e7('0x43')]);return db['SugarcrmConfiguration']['find'](_0x7164dc)[_0xf1e7('0x27')](handleEntityNotFound(_0xdd6bc5,null))[_0xf1e7('0x27')](respondWithResult(_0xdd6bc5,null))['catch'](handleError(_0xdd6bc5,null));};exports['create']=function(_0x57340e,_0x1176dc){return db[_0xf1e7('0x2f')][_0xf1e7('0x49')](_0x57340e[_0xf1e7('0x4a')],{})['then'](respondWithResult(_0x1176dc,0xc9))['catch'](handleError(_0x1176dc,null));};exports[_0xf1e7('0x26')]=function(_0x3c3436,_0x361e05){if(_0x3c3436[_0xf1e7('0x4a')]['id']){delete _0x3c3436['body']['id'];}return db[_0xf1e7('0x2f')][_0xf1e7('0x4b')]({'where':{'id':_0x3c3436[_0xf1e7('0x4c')]['id']}})['then'](handleEntityNotFound(_0x361e05,null))[_0xf1e7('0x27')](saveUpdates(_0x3c3436[_0xf1e7('0x4a')],null))[_0xf1e7('0x27')](respondWithResult(_0x361e05,null))[_0xf1e7('0x4d')](handleError(_0x361e05,null));};exports[_0xf1e7('0x28')]=function(_0x459153,_0x69233f){return db[_0xf1e7('0x2f')][_0xf1e7('0x4b')]({'where':{'id':_0x459153['params']['id']}})['then'](handleEntityNotFound(_0x69233f,null))[_0xf1e7('0x27')](removeEntity(_0x69233f,null))['catch'](handleError(_0x69233f,null));};exports['getFields']=function(_0x281ca7,_0x19bbd3,_0x23919b){var _0x1d9378={};var _0x53b7de={};var _0x9188a;var _0x20ab33;return db[_0xf1e7('0x2f')][_0xf1e7('0x4e')]({'where':{'id':_0x281ca7[_0xf1e7('0x4c')]['id']}})[_0xf1e7('0x27')](handleEntityNotFound(_0x19bbd3,null))[_0xf1e7('0x27')](function(_0x58841e){if(_0x58841e){_0x9188a=_0x58841e;_0x53b7de[_0xf1e7('0x36')]=_[_0xf1e7('0x35')](db[_0xf1e7('0x4f')][_0xf1e7('0x30')]);_0x53b7de[_0xf1e7('0x34')]=_[_0xf1e7('0x35')](_0x281ca7[_0xf1e7('0x34')]);_0x53b7de[_0xf1e7('0x3f')]=_['intersection'](_0x53b7de[_0xf1e7('0x36')],_0x53b7de[_0xf1e7('0x34')]);_0x1d9378[_0xf1e7('0x37')]=_[_0xf1e7('0x38')](_0x53b7de[_0xf1e7('0x36')],qs[_0xf1e7('0x39')](_0x281ca7[_0xf1e7('0x34')]['fields']));_0x1d9378[_0xf1e7('0x37')]=_0x1d9378[_0xf1e7('0x37')][_0xf1e7('0x3a')]?_0x1d9378[_0xf1e7('0x37')]:_0x53b7de[_0xf1e7('0x36')];_0x1d9378[_0xf1e7('0x3c')]=qs[_0xf1e7('0x3d')](_0x281ca7[_0xf1e7('0x34')]['sort']);_0x1d9378[_0xf1e7('0x3e')]=qs[_0xf1e7('0x3f')](_[_0xf1e7('0x40')](_0x281ca7[_0xf1e7('0x34')],_0x53b7de[_0xf1e7('0x3f')]));if(_0x281ca7[_0xf1e7('0x34')][_0xf1e7('0x41')]){_0x1d9378[_0xf1e7('0x3e')]=_[_0xf1e7('0x42')](_0x1d9378[_0xf1e7('0x3e')],{'$or':_[_0xf1e7('0x2e')](_0x1d9378[_0xf1e7('0x37')],function(_0x4d29c9){var _0x5b8008={};_0x5b8008[_0x4d29c9]={'$like':'%'+_0x281ca7['query'][_0xf1e7('0x41')]+'%'};return _0x5b8008;})});}_0x1d9378=_[_0xf1e7('0x42')]({},_0x1d9378,_0x281ca7[_0xf1e7('0x43')]);return _0x9188a[_0xf1e7('0x50')](_0x1d9378);}})['then'](function(_0x1acc91){if(_0x1acc91){_0x20ab33=_0x1acc91['length'];if(!_0x281ca7[_0xf1e7('0x34')][_0xf1e7('0x51')](_0xf1e7('0x3b'))){_0x1d9378['limit']=qs[_0xf1e7('0x1e')](_0x281ca7[_0xf1e7('0x34')][_0xf1e7('0x1e')]);_0x1d9378['offset']=qs[_0xf1e7('0x21')](_0x281ca7['query'][_0xf1e7('0x21')]);}return _0x9188a[_0xf1e7('0x50')](_0x1d9378);}})[_0xf1e7('0x27')](function(_0x5a7baa){if(_0x5a7baa){return _0x5a7baa?{'count':_0x20ab33,'rows':_0x5a7baa}:null;}})[_0xf1e7('0x27')](respondWithResult(_0x19bbd3,null))[_0xf1e7('0x4d')](handleError(_0x19bbd3,null));};exports[_0xf1e7('0x52')]=function(_0x1ecce0,_0x191098,_0x462ab3){var _0x3b5a10={};var _0x2848c9={};var _0x4f695d;var _0x115019;return db[_0xf1e7('0x2f')]['findOne']({'where':{'id':_0x1ecce0['params']['id']}})[_0xf1e7('0x27')](handleEntityNotFound(_0x191098,null))[_0xf1e7('0x27')](function(_0x28e284){if(_0x28e284){_0x4f695d=_0x28e284;_0x2848c9['model']=_['keys'](db['SugarcrmField'][_0xf1e7('0x30')]);_0x2848c9[_0xf1e7('0x34')]=_[_0xf1e7('0x35')](_0x1ecce0[_0xf1e7('0x34')]);_0x2848c9[_0xf1e7('0x3f')]=_[_0xf1e7('0x38')](_0x2848c9['model'],_0x2848c9['query']);_0x3b5a10[_0xf1e7('0x37')]=_[_0xf1e7('0x38')](_0x2848c9['model'],qs[_0xf1e7('0x39')](_0x1ecce0[_0xf1e7('0x34')][_0xf1e7('0x39')]));_0x3b5a10[_0xf1e7('0x37')]=_0x3b5a10['attributes']['length']?_0x3b5a10[_0xf1e7('0x37')]:_0x2848c9[_0xf1e7('0x36')];_0x3b5a10[_0xf1e7('0x3c')]=qs[_0xf1e7('0x3d')](_0x1ecce0[_0xf1e7('0x34')][_0xf1e7('0x3d')]);_0x3b5a10['where']=qs['filters'](_['pick'](_0x1ecce0['query'],_0x2848c9[_0xf1e7('0x3f')]));if(_0x1ecce0['query'][_0xf1e7('0x41')]){_0x3b5a10[_0xf1e7('0x3e')]=_['merge'](_0x3b5a10[_0xf1e7('0x3e')],{'$or':_['map'](_0x3b5a10[_0xf1e7('0x37')],function(_0xa3234e){var _0x34f9d1={};_0x34f9d1[_0xa3234e]={'$like':'%'+_0x1ecce0['query']['filter']+'%'};return _0x34f9d1;})});}_0x3b5a10=_[_0xf1e7('0x42')]({},_0x3b5a10,_0x1ecce0['options']);return _0x4f695d[_0xf1e7('0x52')](_0x3b5a10);}})[_0xf1e7('0x27')](function(_0x23fb67){if(_0x23fb67){_0x115019=_0x23fb67['length'];if(!_0x1ecce0[_0xf1e7('0x34')][_0xf1e7('0x51')](_0xf1e7('0x3b'))){_0x3b5a10[_0xf1e7('0x1e')]=qs[_0xf1e7('0x1e')](_0x1ecce0['query'][_0xf1e7('0x1e')]);_0x3b5a10[_0xf1e7('0x21')]=qs['offset'](_0x1ecce0[_0xf1e7('0x34')][_0xf1e7('0x21')]);}return _0x4f695d['getSubjects'](_0x3b5a10);}})['then'](function(_0x499374){if(_0x499374){return _0x499374?{'count':_0x115019,'rows':_0x499374}:null;}})[_0xf1e7('0x27')](respondWithResult(_0x191098,null))[_0xf1e7('0x4d')](handleError(_0x191098,null));};exports[_0xf1e7('0x53')]=function(_0x266808,_0x4a8c1a,_0x3696e4){var _0x1ca63f={};var _0x116921={};var _0x4e3d2f;var _0x362a34;return db[_0xf1e7('0x2f')][_0xf1e7('0x4e')]({'where':{'id':_0x266808[_0xf1e7('0x4c')]['id']}})[_0xf1e7('0x27')](handleEntityNotFound(_0x4a8c1a,null))[_0xf1e7('0x27')](function(_0x1ccee){if(_0x1ccee){_0x4e3d2f=_0x1ccee;_0x116921[_0xf1e7('0x36')]=_[_0xf1e7('0x35')](db[_0xf1e7('0x4f')][_0xf1e7('0x30')]);_0x116921[_0xf1e7('0x34')]=_[_0xf1e7('0x35')](_0x266808[_0xf1e7('0x34')]);_0x116921['filters']=_[_0xf1e7('0x38')](_0x116921[_0xf1e7('0x36')],_0x116921['query']);_0x1ca63f[_0xf1e7('0x37')]=_['intersection'](_0x116921[_0xf1e7('0x36')],qs[_0xf1e7('0x39')](_0x266808[_0xf1e7('0x34')][_0xf1e7('0x39')]));_0x1ca63f[_0xf1e7('0x37')]=_0x1ca63f[_0xf1e7('0x37')][_0xf1e7('0x3a')]?_0x1ca63f[_0xf1e7('0x37')]:_0x116921[_0xf1e7('0x36')];_0x1ca63f[_0xf1e7('0x3c')]=qs[_0xf1e7('0x3d')](_0x266808[_0xf1e7('0x34')][_0xf1e7('0x3d')]);_0x1ca63f['where']=qs[_0xf1e7('0x3f')](_['pick'](_0x266808[_0xf1e7('0x34')],_0x116921['filters']));if(_0x266808[_0xf1e7('0x34')]['filter']){_0x1ca63f[_0xf1e7('0x3e')]=_[_0xf1e7('0x42')](_0x1ca63f[_0xf1e7('0x3e')],{'$or':_[_0xf1e7('0x2e')](_0x1ca63f['attributes'],function(_0x5ed6f0){var _0x2e049f={};_0x2e049f[_0x5ed6f0]={'$like':'%'+_0x266808[_0xf1e7('0x34')][_0xf1e7('0x41')]+'%'};return _0x2e049f;})});}_0x1ca63f=_[_0xf1e7('0x42')]({},_0x1ca63f,_0x266808['options']);return _0x4e3d2f['getDescriptions'](_0x1ca63f);}})[_0xf1e7('0x27')](function(_0x20b8fa){if(_0x20b8fa){_0x362a34=_0x20b8fa[_0xf1e7('0x3a')];if(!_0x266808[_0xf1e7('0x34')][_0xf1e7('0x51')](_0xf1e7('0x3b'))){_0x1ca63f[_0xf1e7('0x1e')]=qs[_0xf1e7('0x1e')](_0x266808[_0xf1e7('0x34')]['limit']);_0x1ca63f[_0xf1e7('0x21')]=qs[_0xf1e7('0x21')](_0x266808[_0xf1e7('0x34')][_0xf1e7('0x21')]);}return _0x4e3d2f[_0xf1e7('0x53')](_0x1ca63f);}})[_0xf1e7('0x27')](function(_0xf4e77d){if(_0xf4e77d){return _0xf4e77d?{'count':_0x362a34,'rows':_0xf4e77d}:null;}})['then'](respondWithResult(_0x4a8c1a,null))[_0xf1e7('0x4d')](handleError(_0x4a8c1a,null));}; \ No newline at end of file +var _0x2057=['status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','sendStatus','stack','name','send','index','map','rawAttributes','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filters','filter','where','merge','VIRTUAL','options','SugarcrmConfiguration','includeAll','include','findAll','rows','catch','show','params','keys','find','update','body','findOne','SugarcrmField','getFields','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x104427,_0x48fe5c){var _0x22f6e5=function(_0x2e8276){while(--_0x2e8276){_0x104427['push'](_0x104427['shift']());}};_0x22f6e5(++_0x48fe5c);}(_0x2057,0xdf));var _0x7205=function(_0x28fbe3,_0x231a0c){_0x28fbe3=_0x28fbe3-0x0;var _0x2f342f=_0x2057[_0x28fbe3];return _0x2f342f;};'use strict';var emlformat=require(_0x7205('0x0'));var rimraf=require(_0x7205('0x1'));var zipdir=require(_0x7205('0x2'));var jsonpatch=require(_0x7205('0x3'));var rp=require(_0x7205('0x4'));var moment=require(_0x7205('0x5'));var BPromise=require(_0x7205('0x6'));var Mustache=require('mustache');var util=require(_0x7205('0x7'));var path=require(_0x7205('0x8'));var sox=require(_0x7205('0x9'));var csv=require(_0x7205('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7205('0xb'));var _=require(_0x7205('0xc'));var squel=require(_0x7205('0xd'));var crypto=require(_0x7205('0xe'));var jsforce=require(_0x7205('0xf'));var deskjs=require(_0x7205('0x10'));var toCsv=require(_0x7205('0xa'));var querystring=require(_0x7205('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7205('0x12'));var qs=require(_0x7205('0x13'));var as=require(_0x7205('0x14'));var hardwareService=require(_0x7205('0x15'));var logger=require(_0x7205('0x16'))('api');var utils=require(_0x7205('0x17'));var config=require(_0x7205('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x7205('0x19'))['db'];function respondWithStatusCode(_0x5ae0b8,_0x3f60bd){_0x3f60bd=_0x3f60bd||0xcc;return function(_0x2b2442){if(_0x2b2442){return _0x5ae0b8['sendStatus'](_0x3f60bd);}return _0x5ae0b8[_0x7205('0x1a')](_0x3f60bd)[_0x7205('0x1b')]();};}function respondWithResult(_0x26045b,_0xfaf3e){_0xfaf3e=_0xfaf3e||0xc8;return function(_0x4ccd58){if(_0x4ccd58){return _0x26045b[_0x7205('0x1a')](_0xfaf3e)[_0x7205('0x1c')](_0x4ccd58);}};}function respondWithFilteredResult(_0x25d9b7,_0x469d1d){return function(_0x4b6b66){if(_0x4b6b66){var _0x223011=typeof _0x469d1d['offset']===_0x7205('0x1d')&&typeof _0x469d1d[_0x7205('0x1e')]==='undefined';var _0x3d2765=_0x4b6b66[_0x7205('0x1f')];var _0x24542f=_0x223011?0x0:_0x469d1d[_0x7205('0x20')];var _0x2b39e9=_0x223011?_0x4b6b66['count']:_0x469d1d[_0x7205('0x20')]+_0x469d1d[_0x7205('0x1e')];var _0x2cefe8;if(_0x2b39e9>=_0x3d2765){_0x2b39e9=_0x3d2765;_0x2cefe8=0xc8;}else{_0x2cefe8=0xce;}_0x25d9b7[_0x7205('0x1a')](_0x2cefe8);return _0x25d9b7[_0x7205('0x21')](_0x7205('0x22'),_0x24542f+'-'+_0x2b39e9+'/'+_0x3d2765)[_0x7205('0x1c')](_0x4b6b66);}return null;};}function patchUpdates(_0x1a90d8){return function(_0x58ac9a){try{jsonpatch[_0x7205('0x23')](_0x58ac9a,_0x1a90d8,!![]);}catch(_0x4e4b2b){return BPromise[_0x7205('0x24')](_0x4e4b2b);}return _0x58ac9a[_0x7205('0x25')]();};}function saveUpdates(_0x433475,_0x16398c){return function(_0x2ff6af){if(_0x2ff6af){return _0x2ff6af['update'](_0x433475)[_0x7205('0x26')](function(_0x475722){return _0x475722;});}return null;};}function removeEntity(_0x38aa3c,_0x2f1a44){return function(_0x227674){if(_0x227674){return _0x227674[_0x7205('0x27')]()[_0x7205('0x26')](function(){_0x38aa3c[_0x7205('0x1a')](0xcc)[_0x7205('0x1b')]();});}};}function handleEntityNotFound(_0x485cd0,_0x29a85c){return function(_0x1a9739){if(!_0x1a9739){_0x485cd0[_0x7205('0x28')](0x194);}return _0x1a9739;};}function handleError(_0x50c5e1,_0x3d13da){_0x3d13da=_0x3d13da||0x1f4;return function(_0x4bb74d){logger['error'](_0x4bb74d[_0x7205('0x29')]);if(_0x4bb74d['name']){delete _0x4bb74d[_0x7205('0x2a')];}_0x50c5e1[_0x7205('0x1a')](_0x3d13da)[_0x7205('0x2b')](_0x4bb74d);};}exports[_0x7205('0x2c')]=function(_0xb148e3,_0xa5e5e7){var _0x5a71c7={},_0x32f816={},_0x5f0c7b={'count':0x0,'rows':[]};var _0x11a963=_[_0x7205('0x2d')](db['SugarcrmConfiguration'][_0x7205('0x2e')],function(_0x2fbd14){return{'name':_0x2fbd14['fieldName'],'type':_0x2fbd14[_0x7205('0x2f')][_0x7205('0x30')]};});_0x32f816[_0x7205('0x31')]=_[_0x7205('0x2d')](_0x11a963,'name');_0x32f816[_0x7205('0x32')]=_['keys'](_0xb148e3[_0x7205('0x32')]);_0x32f816['filters']=_[_0x7205('0x33')](_0x32f816[_0x7205('0x31')],_0x32f816[_0x7205('0x32')]);_0x5a71c7[_0x7205('0x34')]=_[_0x7205('0x33')](_0x32f816[_0x7205('0x31')],qs[_0x7205('0x35')](_0xb148e3[_0x7205('0x32')][_0x7205('0x35')]));_0x5a71c7[_0x7205('0x34')]=_0x5a71c7[_0x7205('0x34')][_0x7205('0x36')]?_0x5a71c7[_0x7205('0x34')]:_0x32f816['model'];if(!_0xb148e3['query'][_0x7205('0x37')](_0x7205('0x38'))){_0x5a71c7[_0x7205('0x1e')]=qs[_0x7205('0x1e')](_0xb148e3[_0x7205('0x32')][_0x7205('0x1e')]);_0x5a71c7[_0x7205('0x20')]=qs[_0x7205('0x20')](_0xb148e3[_0x7205('0x32')]['offset']);}_0x5a71c7[_0x7205('0x39')]=qs[_0x7205('0x3a')](_0xb148e3[_0x7205('0x32')][_0x7205('0x3a')]);_0x5a71c7['where']=qs['filters'](_[_0x7205('0x3b')](_0xb148e3[_0x7205('0x32')],_0x32f816[_0x7205('0x3c')]),_0x11a963);if(_0xb148e3['query'][_0x7205('0x3d')]){_0x5a71c7[_0x7205('0x3e')]=_[_0x7205('0x3f')](_0x5a71c7[_0x7205('0x3e')],{'$or':_[_0x7205('0x2d')](_0x11a963,function(_0x1a4325){if(_0x1a4325['type']!==_0x7205('0x40')){var _0x32e057={};_0x32e057[_0x1a4325[_0x7205('0x2a')]]={'$like':'%'+_0xb148e3[_0x7205('0x32')][_0x7205('0x3d')]+'%'};return _0x32e057;}})});}_0x5a71c7=_[_0x7205('0x3f')]({},_0x5a71c7,_0xb148e3[_0x7205('0x41')]);var _0x24380e={'where':_0x5a71c7[_0x7205('0x3e')]};return db[_0x7205('0x42')][_0x7205('0x1f')](_0x24380e)['then'](function(_0x28153){_0x5f0c7b['count']=_0x28153;if(_0xb148e3[_0x7205('0x32')][_0x7205('0x43')]){_0x5a71c7[_0x7205('0x44')]=[{'all':!![]}];}return db['SugarcrmConfiguration'][_0x7205('0x45')](_0x5a71c7);})[_0x7205('0x26')](function(_0x2e9cd9){_0x5f0c7b[_0x7205('0x46')]=_0x2e9cd9;return _0x5f0c7b;})[_0x7205('0x26')](respondWithFilteredResult(_0xa5e5e7,_0x5a71c7))[_0x7205('0x47')](handleError(_0xa5e5e7,null));};exports[_0x7205('0x48')]=function(_0x4cec95,_0x501269){var _0x57b3bb={'raw':![],'where':{'id':_0x4cec95[_0x7205('0x49')]['id']}},_0x1e975b={};_0x1e975b[_0x7205('0x31')]=_[_0x7205('0x4a')](db[_0x7205('0x42')]['rawAttributes']);_0x1e975b['query']=_[_0x7205('0x4a')](_0x4cec95['query']);_0x1e975b['filters']=_[_0x7205('0x33')](_0x1e975b['model'],_0x1e975b[_0x7205('0x32')]);_0x57b3bb[_0x7205('0x34')]=_['intersection'](_0x1e975b[_0x7205('0x31')],qs[_0x7205('0x35')](_0x4cec95['query'][_0x7205('0x35')]));_0x57b3bb['attributes']=_0x57b3bb[_0x7205('0x34')][_0x7205('0x36')]?_0x57b3bb['attributes']:_0x1e975b['model'];if(_0x4cec95[_0x7205('0x32')][_0x7205('0x43')]){_0x57b3bb[_0x7205('0x44')]=[{'all':!![]}];}_0x57b3bb=_[_0x7205('0x3f')]({},_0x57b3bb,_0x4cec95[_0x7205('0x41')]);return db['SugarcrmConfiguration'][_0x7205('0x4b')](_0x57b3bb)[_0x7205('0x26')](handleEntityNotFound(_0x501269,null))[_0x7205('0x26')](respondWithResult(_0x501269,null))[_0x7205('0x47')](handleError(_0x501269,null));};exports['create']=function(_0x39eafc,_0x25a7ba){return db[_0x7205('0x42')]['create'](_0x39eafc['body'],{})[_0x7205('0x26')](respondWithResult(_0x25a7ba,0xc9))[_0x7205('0x47')](handleError(_0x25a7ba,null));};exports[_0x7205('0x4c')]=function(_0x1ead19,_0x2ba7ef){if(_0x1ead19[_0x7205('0x4d')]['id']){delete _0x1ead19[_0x7205('0x4d')]['id'];}return db['SugarcrmConfiguration'][_0x7205('0x4b')]({'where':{'id':_0x1ead19[_0x7205('0x49')]['id']}})['then'](handleEntityNotFound(_0x2ba7ef,null))['then'](saveUpdates(_0x1ead19['body'],null))[_0x7205('0x26')](respondWithResult(_0x2ba7ef,null))[_0x7205('0x47')](handleError(_0x2ba7ef,null));};exports[_0x7205('0x27')]=function(_0xf84a3,_0xecf51b){return db['SugarcrmConfiguration'][_0x7205('0x4b')]({'where':{'id':_0xf84a3[_0x7205('0x49')]['id']}})[_0x7205('0x26')](handleEntityNotFound(_0xecf51b,null))['then'](removeEntity(_0xecf51b,null))['catch'](handleError(_0xecf51b,null));};exports['getFields']=function(_0x2b5a60,_0x15a0c0,_0x481a06){var _0x50978e={};var _0x445bde={};var _0x36ce52;var _0x2e0e80;return db[_0x7205('0x42')][_0x7205('0x4e')]({'where':{'id':_0x2b5a60['params']['id']}})[_0x7205('0x26')](handleEntityNotFound(_0x15a0c0,null))[_0x7205('0x26')](function(_0x4f02f2){if(_0x4f02f2){_0x36ce52=_0x4f02f2;_0x445bde[_0x7205('0x31')]=_['keys'](db[_0x7205('0x4f')]['rawAttributes']);_0x445bde[_0x7205('0x32')]=_['keys'](_0x2b5a60['query']);_0x445bde[_0x7205('0x3c')]=_[_0x7205('0x33')](_0x445bde['model'],_0x445bde[_0x7205('0x32')]);_0x50978e[_0x7205('0x34')]=_[_0x7205('0x33')](_0x445bde[_0x7205('0x31')],qs[_0x7205('0x35')](_0x2b5a60['query'][_0x7205('0x35')]));_0x50978e[_0x7205('0x34')]=_0x50978e[_0x7205('0x34')]['length']?_0x50978e['attributes']:_0x445bde[_0x7205('0x31')];_0x50978e[_0x7205('0x39')]=qs['sort'](_0x2b5a60[_0x7205('0x32')][_0x7205('0x3a')]);_0x50978e['where']=qs['filters'](_[_0x7205('0x3b')](_0x2b5a60[_0x7205('0x32')],_0x445bde['filters']));if(_0x2b5a60[_0x7205('0x32')][_0x7205('0x3d')]){_0x50978e[_0x7205('0x3e')]=_[_0x7205('0x3f')](_0x50978e['where'],{'$or':_['map'](_0x50978e[_0x7205('0x34')],function(_0x50e94e){var _0x17af21={};_0x17af21[_0x50e94e]={'$like':'%'+_0x2b5a60[_0x7205('0x32')][_0x7205('0x3d')]+'%'};return _0x17af21;})});}_0x50978e=_[_0x7205('0x3f')]({},_0x50978e,_0x2b5a60[_0x7205('0x41')]);return _0x36ce52['getFields'](_0x50978e);}})[_0x7205('0x26')](function(_0x27c5d0){if(_0x27c5d0){_0x2e0e80=_0x27c5d0[_0x7205('0x36')];if(!_0x2b5a60[_0x7205('0x32')][_0x7205('0x37')](_0x7205('0x38'))){_0x50978e[_0x7205('0x1e')]=qs[_0x7205('0x1e')](_0x2b5a60[_0x7205('0x32')][_0x7205('0x1e')]);_0x50978e[_0x7205('0x20')]=qs[_0x7205('0x20')](_0x2b5a60[_0x7205('0x32')][_0x7205('0x20')]);}return _0x36ce52[_0x7205('0x50')](_0x50978e);}})[_0x7205('0x26')](function(_0x249fcd){if(_0x249fcd){return _0x249fcd?{'count':_0x2e0e80,'rows':_0x249fcd}:null;}})[_0x7205('0x26')](respondWithResult(_0x15a0c0,null))[_0x7205('0x47')](handleError(_0x15a0c0,null));};exports[_0x7205('0x51')]=function(_0xa4559c,_0x25820f,_0x47a743){var _0x101b5b={};var _0x3d4780={};var _0x467874;var _0x160d88;return db[_0x7205('0x42')][_0x7205('0x4e')]({'where':{'id':_0xa4559c[_0x7205('0x49')]['id']}})[_0x7205('0x26')](handleEntityNotFound(_0x25820f,null))[_0x7205('0x26')](function(_0xe7984f){if(_0xe7984f){_0x467874=_0xe7984f;_0x3d4780[_0x7205('0x31')]=_[_0x7205('0x4a')](db[_0x7205('0x4f')][_0x7205('0x2e')]);_0x3d4780[_0x7205('0x32')]=_[_0x7205('0x4a')](_0xa4559c[_0x7205('0x32')]);_0x3d4780[_0x7205('0x3c')]=_['intersection'](_0x3d4780[_0x7205('0x31')],_0x3d4780[_0x7205('0x32')]);_0x101b5b[_0x7205('0x34')]=_[_0x7205('0x33')](_0x3d4780[_0x7205('0x31')],qs['fields'](_0xa4559c[_0x7205('0x32')][_0x7205('0x35')]));_0x101b5b['attributes']=_0x101b5b[_0x7205('0x34')][_0x7205('0x36')]?_0x101b5b[_0x7205('0x34')]:_0x3d4780[_0x7205('0x31')];_0x101b5b['order']=qs[_0x7205('0x3a')](_0xa4559c[_0x7205('0x32')][_0x7205('0x3a')]);_0x101b5b['where']=qs[_0x7205('0x3c')](_[_0x7205('0x3b')](_0xa4559c[_0x7205('0x32')],_0x3d4780['filters']));if(_0xa4559c[_0x7205('0x32')][_0x7205('0x3d')]){_0x101b5b[_0x7205('0x3e')]=_[_0x7205('0x3f')](_0x101b5b[_0x7205('0x3e')],{'$or':_[_0x7205('0x2d')](_0x101b5b[_0x7205('0x34')],function(_0x469968){var _0x174964={};_0x174964[_0x469968]={'$like':'%'+_0xa4559c[_0x7205('0x32')][_0x7205('0x3d')]+'%'};return _0x174964;})});}_0x101b5b=_[_0x7205('0x3f')]({},_0x101b5b,_0xa4559c[_0x7205('0x41')]);return _0x467874[_0x7205('0x51')](_0x101b5b);}})['then'](function(_0x28e5cd){if(_0x28e5cd){_0x160d88=_0x28e5cd['length'];if(!_0xa4559c[_0x7205('0x32')]['hasOwnProperty'](_0x7205('0x38'))){_0x101b5b[_0x7205('0x1e')]=qs['limit'](_0xa4559c['query'][_0x7205('0x1e')]);_0x101b5b[_0x7205('0x20')]=qs[_0x7205('0x20')](_0xa4559c['query'][_0x7205('0x20')]);}return _0x467874[_0x7205('0x51')](_0x101b5b);}})[_0x7205('0x26')](function(_0x1cb719){if(_0x1cb719){return _0x1cb719?{'count':_0x160d88,'rows':_0x1cb719}:null;}})[_0x7205('0x26')](respondWithResult(_0x25820f,null))[_0x7205('0x47')](handleError(_0x25820f,null));};exports[_0x7205('0x52')]=function(_0x341d26,_0x3091be,_0x2e61b9){var _0x35dd11={};var _0x3011f2={};var _0x300542;var _0x598202;return db[_0x7205('0x42')][_0x7205('0x4e')]({'where':{'id':_0x341d26[_0x7205('0x49')]['id']}})[_0x7205('0x26')](handleEntityNotFound(_0x3091be,null))[_0x7205('0x26')](function(_0x164ac3){if(_0x164ac3){_0x300542=_0x164ac3;_0x3011f2[_0x7205('0x31')]=_[_0x7205('0x4a')](db['SugarcrmField'][_0x7205('0x2e')]);_0x3011f2['query']=_['keys'](_0x341d26[_0x7205('0x32')]);_0x3011f2[_0x7205('0x3c')]=_[_0x7205('0x33')](_0x3011f2[_0x7205('0x31')],_0x3011f2[_0x7205('0x32')]);_0x35dd11['attributes']=_[_0x7205('0x33')](_0x3011f2[_0x7205('0x31')],qs['fields'](_0x341d26[_0x7205('0x32')][_0x7205('0x35')]));_0x35dd11[_0x7205('0x34')]=_0x35dd11[_0x7205('0x34')][_0x7205('0x36')]?_0x35dd11['attributes']:_0x3011f2[_0x7205('0x31')];_0x35dd11['order']=qs['sort'](_0x341d26[_0x7205('0x32')][_0x7205('0x3a')]);_0x35dd11[_0x7205('0x3e')]=qs[_0x7205('0x3c')](_['pick'](_0x341d26[_0x7205('0x32')],_0x3011f2['filters']));if(_0x341d26[_0x7205('0x32')][_0x7205('0x3d')]){_0x35dd11['where']=_['merge'](_0x35dd11[_0x7205('0x3e')],{'$or':_['map'](_0x35dd11[_0x7205('0x34')],function(_0x17116a){var _0x386357={};_0x386357[_0x17116a]={'$like':'%'+_0x341d26['query'][_0x7205('0x3d')]+'%'};return _0x386357;})});}_0x35dd11=_['merge']({},_0x35dd11,_0x341d26['options']);return _0x300542[_0x7205('0x52')](_0x35dd11);}})[_0x7205('0x26')](function(_0x229410){if(_0x229410){_0x598202=_0x229410[_0x7205('0x36')];if(!_0x341d26['query'][_0x7205('0x37')](_0x7205('0x38'))){_0x35dd11[_0x7205('0x1e')]=qs['limit'](_0x341d26[_0x7205('0x32')][_0x7205('0x1e')]);_0x35dd11[_0x7205('0x20')]=qs[_0x7205('0x20')](_0x341d26[_0x7205('0x32')][_0x7205('0x20')]);}return _0x300542['getDescriptions'](_0x35dd11);}})[_0x7205('0x26')](function(_0x2ea44b){if(_0x2ea44b){return _0x2ea44b?{'count':_0x598202,'rows':_0x2ea44b}:null;}})[_0x7205('0x26')](respondWithResult(_0x3091be,null))[_0x7205('0x47')](handleError(_0x3091be,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index c494c8e..cbb5ca2 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 _0x0475=['int_sugarcrm_configurations','lodash','api','moment','bluebird','request-promise','path','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define'];(function(_0x1f0f52,_0x563ada){var _0x25e4e6=function(_0x2054be){while(--_0x2054be){_0x1f0f52['push'](_0x1f0f52['shift']());}};_0x25e4e6(++_0x563ada);}(_0x0475,0xbc));var _0x5047=function(_0x5bd8f5,_0x5afd11){_0x5bd8f5=_0x5bd8f5-0x0;var _0x33d43b=_0x0475[_0x5bd8f5];return _0x33d43b;};'use strict';var _=require(_0x5047('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5047('0x1'));var moment=require(_0x5047('0x2'));var BPromise=require(_0x5047('0x3'));var rp=require(_0x5047('0x4'));var fs=require('fs');var path=require(_0x5047('0x5'));var rimraf=require('rimraf');var config=require(_0x5047('0x6'));var attributes=require(_0x5047('0x7'));module[_0x5047('0x8')]=function(_0x356712,_0x29e9b6){return _0x356712[_0x5047('0x9')]('SugarcrmConfiguration',attributes,{'tableName':_0x5047('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf836=['bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','SugarcrmConfiguration','lodash','util','../../config/logger','api'];(function(_0x21d532,_0x4552a4){var _0x37bda1=function(_0x134a6f){while(--_0x134a6f){_0x21d532['push'](_0x21d532['shift']());}};_0x37bda1(++_0x4552a4);}(_0xf836,0xc8));var _0x6f83=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xf836[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x6f83('0x0'));var util=require(_0x6f83('0x1'));var logger=require(_0x6f83('0x2'))(_0x6f83('0x3'));var moment=require('moment');var BPromise=require(_0x6f83('0x4'));var rp=require(_0x6f83('0x5'));var fs=require('fs');var path=require(_0x6f83('0x6'));var rimraf=require(_0x6f83('0x7'));var config=require(_0x6f83('0x8'));var attributes=require(_0x6f83('0x9'));module[_0x6f83('0xa')]=function(_0x31a299,_0x2d09c9){return _0x31a299['define'](_0x6f83('0xb'),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 367ce7c..7958adb 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 _0xd54b=['ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0xce5fa9,_0x1988e1){var _0x137403=function(_0x484d90){while(--_0x484d90){_0xce5fa9['push'](_0xce5fa9['shift']());}};_0x137403(++_0x1988e1);}(_0xd54b,0x19d));var _0xbd54=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xd54b[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0xbd54('0x0'));var util=require(_0xbd54('0x1'));var moment=require(_0xbd54('0x2'));var BPromise=require(_0xbd54('0x3'));var rs=require(_0xbd54('0x4'));var fs=require('fs');var Redis=require(_0xbd54('0x5'));var db=require(_0xbd54('0x6'))['db'];var utils=require(_0xbd54('0x7'));var logger=require('../../config/logger')(_0xbd54('0x8'));var config=require('../../config/environment');var jayson=require(_0xbd54('0x9'));var client=jayson[_0xbd54('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x24be82,_0x23d72e,_0x237d44){return new BPromise(function(_0x3b920c,_0x31439d){return client[_0xbd54('0xb')](_0x24be82,_0x237d44)[_0xbd54('0xc')](function(_0x432734){logger[_0xbd54('0xd')](_0xbd54('0xe'),_0x23d72e,_0xbd54('0xf'));logger['debug'](_0xbd54('0x10'),_0x23d72e,_0xbd54('0xf'),JSON[_0xbd54('0x11')](_0x432734));if(_0x432734[_0xbd54('0x12')]){if(_0x432734['error']['code']===0x1f4){logger[_0xbd54('0x12')](_0xbd54('0xe'),_0x23d72e,_0x432734['error'][_0xbd54('0x13')]);return _0x31439d(_0x432734[_0xbd54('0x12')][_0xbd54('0x13')]);}logger[_0xbd54('0x12')](_0xbd54('0xe'),_0x23d72e,_0x432734[_0xbd54('0x12')]['message']);return _0x3b920c(_0x432734[_0xbd54('0x12')][_0xbd54('0x13')]);}else{logger[_0xbd54('0xd')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x23d72e,_0xbd54('0xf'));_0x3b920c(_0x432734[_0xbd54('0x14')][_0xbd54('0x13')]);}})[_0xbd54('0x15')](function(_0x5caad3){logger[_0xbd54('0x12')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x23d72e,_0x5caad3);_0x31439d(_0x5caad3);});});} \ No newline at end of file +var _0xe349=['result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','info','request\x20sent','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','SugarcrmConfiguration,\x20%s,\x20%s','message'];(function(_0x609c72,_0x1ca318){var _0x4adb42=function(_0x3e639a){while(--_0x3e639a){_0x609c72['push'](_0x609c72['shift']());}};_0x4adb42(++_0x1ca318);}(_0xe349,0x127));var _0x9e34=function(_0x143a91,_0x235332){_0x143a91=_0x143a91-0x0;var _0x1906f5=_0xe349[_0x143a91];return _0x1906f5;};'use strict';var _=require(_0x9e34('0x0'));var util=require(_0x9e34('0x1'));var moment=require(_0x9e34('0x2'));var BPromise=require(_0x9e34('0x3'));var rs=require(_0x9e34('0x4'));var fs=require('fs');var Redis=require(_0x9e34('0x5'));var db=require(_0x9e34('0x6'))['db'];var utils=require(_0x9e34('0x7'));var logger=require(_0x9e34('0x8'))(_0x9e34('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9e34('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3bf719,_0x7a5663,_0x279cc5){return new BPromise(function(_0x1d01f8,_0x2df14e){return client[_0x9e34('0xb')](_0x3bf719,_0x279cc5)['then'](function(_0x56e6f5){logger[_0x9e34('0xc')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x7a5663,_0x9e34('0xd'));logger['debug'](_0x9e34('0xe'),_0x7a5663,_0x9e34('0xd'),JSON[_0x9e34('0xf')](_0x56e6f5));if(_0x56e6f5[_0x9e34('0x10')]){if(_0x56e6f5['error'][_0x9e34('0x11')]===0x1f4){logger[_0x9e34('0x10')](_0x9e34('0x12'),_0x7a5663,_0x56e6f5[_0x9e34('0x10')]['message']);return _0x2df14e(_0x56e6f5['error']['message']);}logger[_0x9e34('0x10')](_0x9e34('0x12'),_0x7a5663,_0x56e6f5[_0x9e34('0x10')][_0x9e34('0x13')]);return _0x1d01f8(_0x56e6f5[_0x9e34('0x10')]['message']);}else{logger[_0x9e34('0xc')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x7a5663,_0x9e34('0xd'));_0x1d01f8(_0x56e6f5[_0x9e34('0x14')][_0x9e34('0x13')]);}})['catch'](function(_0x46ed09){logger[_0x9e34('0x10')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x7a5663,_0x46ed09);_0x2df14e(_0x46ed09);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index a2fca48..35aba41 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 _0xb5d1=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','multer','util','path','connect-timeout','express','Router'];(function(_0x17de3a,_0x1102ba){var _0x456315=function(_0x6ac0d1){while(--_0x6ac0d1){_0x17de3a['push'](_0x17de3a['shift']());}};_0x456315(++_0x1102ba);}(_0xb5d1,0x14a));var _0x1b5d=function(_0x335840,_0xd1b8de){_0x335840=_0x335840-0x0;var _0x5e133f=_0xb5d1[_0x335840];return _0x5e133f;};'use strict';var multer=require(_0x1b5d('0x0'));var util=require(_0x1b5d('0x1'));var path=require(_0x1b5d('0x2'));var timeout=require(_0x1b5d('0x3'));var express=require(_0x1b5d('0x4'));var router=express[_0x1b5d('0x5')]();var fs_extra=require(_0x1b5d('0x6'));var auth=require(_0x1b5d('0x7'));var interaction=require(_0x1b5d('0x8'));var config=require(_0x1b5d('0x9'));var controller=require(_0x1b5d('0xa'));router[_0x1b5d('0xb')]('/',auth[_0x1b5d('0xc')](),controller[_0x1b5d('0xd')]);router['get'](_0x1b5d('0xe'),auth[_0x1b5d('0xc')](),controller[_0x1b5d('0xf')]);router[_0x1b5d('0x10')]('/',auth['isAuthenticated'](),controller[_0x1b5d('0x11')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x1b5d('0x12')]);router[_0x1b5d('0x13')](_0x1b5d('0xe'),auth['isAuthenticated'](),controller[_0x1b5d('0x14')]);module['exports']=router; \ No newline at end of file +var _0x95ca=['fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','show','post','create','put','update','delete','/:id','exports','multer','util','connect-timeout','express','Router'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x95ca,0x109));var _0xa95c=function(_0x1b35f0,_0x411c8a){_0x1b35f0=_0x1b35f0-0x0;var _0x5605ca=_0x95ca[_0x1b35f0];return _0x5605ca;};'use strict';var multer=require(_0xa95c('0x0'));var util=require(_0xa95c('0x1'));var path=require('path');var timeout=require(_0xa95c('0x2'));var express=require(_0xa95c('0x3'));var router=express[_0xa95c('0x4')]();var fs_extra=require(_0xa95c('0x5'));var auth=require(_0xa95c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa95c('0x7'));var controller=require('./intSugarcrmField.controller');router[_0xa95c('0x8')]('/',auth[_0xa95c('0x9')](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller[_0xa95c('0xa')]);router[_0xa95c('0xb')]('/',auth['isAuthenticated'](),controller[_0xa95c('0xc')]);router[_0xa95c('0xd')]('/:id',auth[_0xa95c('0x9')](),controller[_0xa95c('0xe')]);router[_0xa95c('0xf')](_0xa95c('0x10'),auth['isAuthenticated'](),controller['destroy']);module[_0xa95c('0x11')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 94fa97f..f3c8709 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 _0x365a=['STRING','customVariable','ENUM','string','keyValue','picklist'];(function(_0x22e5e2,_0x71f805){var _0x153885=function(_0x41fb3b){while(--_0x41fb3b){_0x22e5e2['push'](_0x22e5e2['shift']());}};_0x153885(++_0x71f805);}(_0x365a,0xb6));var _0xa365=function(_0x24fc6a,_0x2cbf56){_0x24fc6a=_0x24fc6a-0x0;var _0x166299=_0x365a[_0x24fc6a];return _0x166299;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xa365('0x0')](_0xa365('0x1'),'variable','customVariable',_0xa365('0x2'),_0xa365('0x3')),'defaultValue':_0xa365('0x1')},'content':{'type':Sequelize[_0xa365('0x4')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xa365('0x0')]('string','variable',_0xa365('0x5'))},'keyContent':{'type':Sequelize[_0xa365('0x4')]},'idField':{'type':Sequelize[_0xa365('0x4')]},'nameField':{'type':Sequelize[_0xa365('0x4')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa365('0x4')]}}; \ No newline at end of file +var _0x985a=['sequelize','ENUM','variable','customVariable','keyValue','picklist','string','STRING'];(function(_0x19dc27,_0x5b5670){var _0x1a83f6=function(_0x5b1421){while(--_0x5b1421){_0x19dc27['push'](_0x19dc27['shift']());}};_0x1a83f6(++_0x5b5670);}(_0x985a,0x1f0));var _0xa985=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x985a[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require(_0xa985('0x0'));module['exports']={'type':{'type':Sequelize[_0xa985('0x1')]('string',_0xa985('0x2'),_0xa985('0x3'),_0xa985('0x4'),_0xa985('0x5')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0xa985('0x6'),_0xa985('0x2'),_0xa985('0x3'))},'keyContent':{'type':Sequelize[_0xa985('0x7')]},'idField':{'type':Sequelize[_0xa985('0x7')]},'nameField':{'type':Sequelize[_0xa985('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa985('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index a343375..828bd8b 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 _0xff0f=['query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','type','VIRTUAL','filter','merge','options','SugarcrmField','count','includeAll','include','findAll','catch','params','model','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','json','offset','undefined','limit','Content-Range','apply','reject','save','update','then','destroy','status','end','sendStatus','error','name','rawAttributes','fieldName','key','map'];(function(_0x936f18,_0x110725){var _0x36b3b7=function(_0x5cd86b){while(--_0x5cd86b){_0x936f18['push'](_0x936f18['shift']());}};_0x36b3b7(++_0x110725);}(_0xff0f,0xfa));var _0xfff0=function(_0x3ab179,_0x3207a4){_0x3ab179=_0x3ab179-0x0;var _0x5e61c8=_0xff0f[_0x3ab179];return _0x5e61c8;};'use strict';var emlformat=require(_0xfff0('0x0'));var rimraf=require(_0xfff0('0x1'));var zipdir=require(_0xfff0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfff0('0x3'));var moment=require(_0xfff0('0x4'));var BPromise=require(_0xfff0('0x5'));var Mustache=require(_0xfff0('0x6'));var util=require(_0xfff0('0x7'));var path=require(_0xfff0('0x8'));var sox=require(_0xfff0('0x9'));var csv=require(_0xfff0('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfff0('0xb'));var squel=require(_0xfff0('0xc'));var crypto=require(_0xfff0('0xd'));var jsforce=require(_0xfff0('0xe'));var deskjs=require(_0xfff0('0xf'));var toCsv=require(_0xfff0('0xa'));var querystring=require(_0xfff0('0x10'));var Papa=require('papaparse');var Redis=require(_0xfff0('0x11'));var authService=require(_0xfff0('0x12'));var qs=require(_0xfff0('0x13'));var as=require(_0xfff0('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xfff0('0x15'));var utils=require(_0xfff0('0x16'));var config=require(_0xfff0('0x17'));var licenseUtil=require(_0xfff0('0x18'));var db=require(_0xfff0('0x19'))['db'];function respondWithStatusCode(_0xe18a0,_0x1b073e){_0x1b073e=_0x1b073e||0xcc;return function(_0x3dd23e){if(_0x3dd23e){return _0xe18a0['sendStatus'](_0x1b073e);}return _0xe18a0['status'](_0x1b073e)['end']();};}function respondWithResult(_0xbc671d,_0x225834){_0x225834=_0x225834||0xc8;return function(_0x53cff2){if(_0x53cff2){return _0xbc671d['status'](_0x225834)[_0xfff0('0x1a')](_0x53cff2);}};}function respondWithFilteredResult(_0x3c0955,_0x48e1ac){return function(_0x276014){if(_0x276014){var _0x53a0ac=typeof _0x48e1ac[_0xfff0('0x1b')]===_0xfff0('0x1c')&&typeof _0x48e1ac[_0xfff0('0x1d')]===_0xfff0('0x1c');var _0x4f1bc8=_0x276014['count'];var _0x54c817=_0x53a0ac?0x0:_0x48e1ac[_0xfff0('0x1b')];var _0x4ec89b=_0x53a0ac?_0x276014['count']:_0x48e1ac[_0xfff0('0x1b')]+_0x48e1ac[_0xfff0('0x1d')];var _0x3b8b47;if(_0x4ec89b>=_0x4f1bc8){_0x4ec89b=_0x4f1bc8;_0x3b8b47=0xc8;}else{_0x3b8b47=0xce;}_0x3c0955['status'](_0x3b8b47);return _0x3c0955['set'](_0xfff0('0x1e'),_0x54c817+'-'+_0x4ec89b+'/'+_0x4f1bc8)[_0xfff0('0x1a')](_0x276014);}return null;};}function patchUpdates(_0x1f291f){return function(_0x8cb825){try{jsonpatch[_0xfff0('0x1f')](_0x8cb825,_0x1f291f,!![]);}catch(_0x422f69){return BPromise[_0xfff0('0x20')](_0x422f69);}return _0x8cb825[_0xfff0('0x21')]();};}function saveUpdates(_0x1bd1a3,_0x283df2){return function(_0x2e8ea8){if(_0x2e8ea8){return _0x2e8ea8[_0xfff0('0x22')](_0x1bd1a3)[_0xfff0('0x23')](function(_0x31973a){return _0x31973a;});}return null;};}function removeEntity(_0x4c1ebb,_0x38eeab){return function(_0x3fc8a0){if(_0x3fc8a0){return _0x3fc8a0[_0xfff0('0x24')]()['then'](function(){_0x4c1ebb[_0xfff0('0x25')](0xcc)[_0xfff0('0x26')]();});}};}function handleEntityNotFound(_0x9e7573,_0x514142){return function(_0x3d554f){if(!_0x3d554f){_0x9e7573[_0xfff0('0x27')](0x194);}return _0x3d554f;};}function handleError(_0x15578e,_0x12c890){_0x12c890=_0x12c890||0x1f4;return function(_0x411ce4){logger[_0xfff0('0x28')](_0x411ce4['stack']);if(_0x411ce4['name']){delete _0x411ce4[_0xfff0('0x29')];}_0x15578e[_0xfff0('0x25')](_0x12c890)['send'](_0x411ce4);};}exports['index']=function(_0x44ffd6,_0xc24fab){var _0xd9299a={},_0x34cc90={},_0x1bbefa={'count':0x0,'rows':[]};var _0x1fe416=_['map'](db['SugarcrmField'][_0xfff0('0x2a')],function(_0x54e9f7){return{'name':_0x54e9f7[_0xfff0('0x2b')],'type':_0x54e9f7['type'][_0xfff0('0x2c')]};});_0x34cc90['model']=_[_0xfff0('0x2d')](_0x1fe416,'name');_0x34cc90[_0xfff0('0x2e')]=_[_0xfff0('0x2f')](_0x44ffd6[_0xfff0('0x2e')]);_0x34cc90[_0xfff0('0x30')]=_[_0xfff0('0x31')](_0x34cc90['model'],_0x34cc90['query']);_0xd9299a[_0xfff0('0x32')]=_[_0xfff0('0x31')](_0x34cc90['model'],qs[_0xfff0('0x33')](_0x44ffd6[_0xfff0('0x2e')][_0xfff0('0x33')]));_0xd9299a[_0xfff0('0x32')]=_0xd9299a[_0xfff0('0x32')][_0xfff0('0x34')]?_0xd9299a[_0xfff0('0x32')]:_0x34cc90['model'];if(!_0x44ffd6[_0xfff0('0x2e')][_0xfff0('0x35')](_0xfff0('0x36'))){_0xd9299a[_0xfff0('0x1d')]=qs['limit'](_0x44ffd6[_0xfff0('0x2e')]['limit']);_0xd9299a[_0xfff0('0x1b')]=qs['offset'](_0x44ffd6['query'][_0xfff0('0x1b')]);}_0xd9299a[_0xfff0('0x37')]=qs[_0xfff0('0x38')](_0x44ffd6[_0xfff0('0x2e')][_0xfff0('0x38')]);_0xd9299a[_0xfff0('0x39')]=qs[_0xfff0('0x30')](_['pick'](_0x44ffd6['query'],_0x34cc90[_0xfff0('0x30')]),_0x1fe416);if(_0x44ffd6[_0xfff0('0x2e')]['filter']){_0xd9299a[_0xfff0('0x39')]=_['merge'](_0xd9299a['where'],{'$or':_[_0xfff0('0x2d')](_0x1fe416,function(_0x196bee){if(_0x196bee[_0xfff0('0x3a')]!==_0xfff0('0x3b')){var _0x31578e={};_0x31578e[_0x196bee[_0xfff0('0x29')]]={'$like':'%'+_0x44ffd6[_0xfff0('0x2e')][_0xfff0('0x3c')]+'%'};return _0x31578e;}})});}_0xd9299a=_[_0xfff0('0x3d')]({},_0xd9299a,_0x44ffd6[_0xfff0('0x3e')]);var _0x2ae6b0={'where':_0xd9299a[_0xfff0('0x39')]};return db[_0xfff0('0x3f')]['count'](_0x2ae6b0)[_0xfff0('0x23')](function(_0xf66464){_0x1bbefa[_0xfff0('0x40')]=_0xf66464;if(_0x44ffd6[_0xfff0('0x2e')][_0xfff0('0x41')]){_0xd9299a[_0xfff0('0x42')]=[{'all':!![]}];}return db[_0xfff0('0x3f')][_0xfff0('0x43')](_0xd9299a);})[_0xfff0('0x23')](function(_0x43ac11){_0x1bbefa['rows']=_0x43ac11;return _0x1bbefa;})['then'](respondWithFilteredResult(_0xc24fab,_0xd9299a))[_0xfff0('0x44')](handleError(_0xc24fab,null));};exports['show']=function(_0x568288,_0x5aac1f){var _0x270f74={'raw':!![],'where':{'id':_0x568288[_0xfff0('0x45')]['id']}},_0x45b149={};_0x45b149[_0xfff0('0x46')]=_[_0xfff0('0x2f')](db['SugarcrmField']['rawAttributes']);_0x45b149['query']=_[_0xfff0('0x2f')](_0x568288[_0xfff0('0x2e')]);_0x45b149[_0xfff0('0x30')]=_[_0xfff0('0x31')](_0x45b149[_0xfff0('0x46')],_0x45b149[_0xfff0('0x2e')]);_0x270f74[_0xfff0('0x32')]=_[_0xfff0('0x31')](_0x45b149[_0xfff0('0x46')],qs[_0xfff0('0x33')](_0x568288[_0xfff0('0x2e')][_0xfff0('0x33')]));_0x270f74[_0xfff0('0x32')]=_0x270f74['attributes'][_0xfff0('0x34')]?_0x270f74[_0xfff0('0x32')]:_0x45b149[_0xfff0('0x46')];if(_0x568288[_0xfff0('0x2e')][_0xfff0('0x41')]){_0x270f74[_0xfff0('0x42')]=[{'all':!![]}];}_0x270f74=_[_0xfff0('0x3d')]({},_0x270f74,_0x568288[_0xfff0('0x3e')]);return db['SugarcrmField'][_0xfff0('0x47')](_0x270f74)[_0xfff0('0x23')](handleEntityNotFound(_0x5aac1f,null))[_0xfff0('0x23')](respondWithResult(_0x5aac1f,null))[_0xfff0('0x44')](handleError(_0x5aac1f,null));};exports[_0xfff0('0x48')]=function(_0x43aba2,_0x1b8a94){return db['SugarcrmField'][_0xfff0('0x48')](_0x43aba2[_0xfff0('0x49')],{})[_0xfff0('0x23')](respondWithResult(_0x1b8a94,0xc9))['catch'](handleError(_0x1b8a94,null));};exports[_0xfff0('0x22')]=function(_0x4a56a7,_0x23c694){if(_0x4a56a7['body']['id']){delete _0x4a56a7[_0xfff0('0x49')]['id'];}return db[_0xfff0('0x3f')][_0xfff0('0x47')]({'where':{'id':_0x4a56a7[_0xfff0('0x45')]['id']}})[_0xfff0('0x23')](handleEntityNotFound(_0x23c694,null))[_0xfff0('0x23')](saveUpdates(_0x4a56a7[_0xfff0('0x49')],null))[_0xfff0('0x23')](respondWithResult(_0x23c694,null))[_0xfff0('0x44')](handleError(_0x23c694,null));};exports[_0xfff0('0x24')]=function(_0x143a2b,_0xf1911d){return db['SugarcrmField'][_0xfff0('0x47')]({'where':{'id':_0x143a2b['params']['id']}})['then'](handleEntityNotFound(_0xf1911d,null))['then'](removeEntity(_0xf1911d,null))[_0xfff0('0x44')](handleError(_0xf1911d,null));}; \ No newline at end of file +var _0xc8a7=['name','index','map','SugarcrmField','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','merge','type','VIRTUAL','include','findAll','catch','params','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error'];(function(_0x4d8878,_0x196799){var _0x323acb=function(_0x4e68bc){while(--_0x4e68bc){_0x4d8878['push'](_0x4d8878['shift']());}};_0x323acb(++_0x196799);}(_0xc8a7,0x13d));var _0x7c8a=function(_0x435090,_0x21e01e){_0x435090=_0x435090-0x0;var _0x3b8285=_0xc8a7[_0x435090];return _0x3b8285;};'use strict';var emlformat=require(_0x7c8a('0x0'));var rimraf=require(_0x7c8a('0x1'));var zipdir=require(_0x7c8a('0x2'));var jsonpatch=require(_0x7c8a('0x3'));var rp=require(_0x7c8a('0x4'));var moment=require(_0x7c8a('0x5'));var BPromise=require(_0x7c8a('0x6'));var Mustache=require(_0x7c8a('0x7'));var util=require(_0x7c8a('0x8'));var path=require('path');var sox=require(_0x7c8a('0x9'));var csv=require(_0x7c8a('0xa'));var ejs=require(_0x7c8a('0xb'));var fs=require('fs');var fs_extra=require(_0x7c8a('0xc'));var _=require(_0x7c8a('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7c8a('0xe'));var deskjs=require(_0x7c8a('0xf'));var toCsv=require(_0x7c8a('0xa'));var querystring=require(_0x7c8a('0x10'));var Papa=require(_0x7c8a('0x11'));var Redis=require('ioredis');var authService=require(_0x7c8a('0x12'));var qs=require(_0x7c8a('0x13'));var as=require(_0x7c8a('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7c8a('0x15'))('api');var utils=require(_0x7c8a('0x16'));var config=require(_0x7c8a('0x17'));var licenseUtil=require(_0x7c8a('0x18'));var db=require(_0x7c8a('0x19'))['db'];function respondWithStatusCode(_0x12db88,_0x2ee8c5){_0x2ee8c5=_0x2ee8c5||0xcc;return function(_0x1c7e67){if(_0x1c7e67){return _0x12db88[_0x7c8a('0x1a')](_0x2ee8c5);}return _0x12db88[_0x7c8a('0x1b')](_0x2ee8c5)[_0x7c8a('0x1c')]();};}function respondWithResult(_0x3063ac,_0x51b2ca){_0x51b2ca=_0x51b2ca||0xc8;return function(_0x5a6172){if(_0x5a6172){return _0x3063ac[_0x7c8a('0x1b')](_0x51b2ca)[_0x7c8a('0x1d')](_0x5a6172);}};}function respondWithFilteredResult(_0x3e406c,_0x1250ee){return function(_0x379f02){if(_0x379f02){var _0x596213=typeof _0x1250ee[_0x7c8a('0x1e')]===_0x7c8a('0x1f')&&typeof _0x1250ee[_0x7c8a('0x20')]==='undefined';var _0x37227c=_0x379f02[_0x7c8a('0x21')];var _0x48ff91=_0x596213?0x0:_0x1250ee[_0x7c8a('0x1e')];var _0x4a09b1=_0x596213?_0x379f02[_0x7c8a('0x21')]:_0x1250ee[_0x7c8a('0x1e')]+_0x1250ee[_0x7c8a('0x20')];var _0x30eae8;if(_0x4a09b1>=_0x37227c){_0x4a09b1=_0x37227c;_0x30eae8=0xc8;}else{_0x30eae8=0xce;}_0x3e406c[_0x7c8a('0x1b')](_0x30eae8);return _0x3e406c[_0x7c8a('0x22')](_0x7c8a('0x23'),_0x48ff91+'-'+_0x4a09b1+'/'+_0x37227c)[_0x7c8a('0x1d')](_0x379f02);}return null;};}function patchUpdates(_0x1a41a4){return function(_0x2270dc){try{jsonpatch[_0x7c8a('0x24')](_0x2270dc,_0x1a41a4,!![]);}catch(_0x34a6c8){return BPromise[_0x7c8a('0x25')](_0x34a6c8);}return _0x2270dc[_0x7c8a('0x26')]();};}function saveUpdates(_0x3454de,_0x3d2b82){return function(_0x1ed870){if(_0x1ed870){return _0x1ed870[_0x7c8a('0x27')](_0x3454de)[_0x7c8a('0x28')](function(_0x9d8669){return _0x9d8669;});}return null;};}function removeEntity(_0x9ab0a3,_0x383bc8){return function(_0x5a51b2){if(_0x5a51b2){return _0x5a51b2[_0x7c8a('0x29')]()[_0x7c8a('0x28')](function(){_0x9ab0a3[_0x7c8a('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45fe5b,_0x250d5c){return function(_0x4c1628){if(!_0x4c1628){_0x45fe5b['sendStatus'](0x194);}return _0x4c1628;};}function handleError(_0x5dd72c,_0x128a26){_0x128a26=_0x128a26||0x1f4;return function(_0x595c40){logger[_0x7c8a('0x2a')](_0x595c40['stack']);if(_0x595c40[_0x7c8a('0x2b')]){delete _0x595c40[_0x7c8a('0x2b')];}_0x5dd72c['status'](_0x128a26)['send'](_0x595c40);};}exports[_0x7c8a('0x2c')]=function(_0x2d682f,_0x1d8f44){var _0x2f836a={},_0x3d195b={},_0x5c08d5={'count':0x0,'rows':[]};var _0x1723ad=_[_0x7c8a('0x2d')](db[_0x7c8a('0x2e')][_0x7c8a('0x2f')],function(_0x170bf2){return{'name':_0x170bf2[_0x7c8a('0x30')],'type':_0x170bf2['type'][_0x7c8a('0x31')]};});_0x3d195b[_0x7c8a('0x32')]=_[_0x7c8a('0x2d')](_0x1723ad,'name');_0x3d195b[_0x7c8a('0x33')]=_[_0x7c8a('0x34')](_0x2d682f['query']);_0x3d195b['filters']=_[_0x7c8a('0x35')](_0x3d195b[_0x7c8a('0x32')],_0x3d195b[_0x7c8a('0x33')]);_0x2f836a[_0x7c8a('0x36')]=_[_0x7c8a('0x35')](_0x3d195b[_0x7c8a('0x32')],qs[_0x7c8a('0x37')](_0x2d682f[_0x7c8a('0x33')]['fields']));_0x2f836a['attributes']=_0x2f836a[_0x7c8a('0x36')]['length']?_0x2f836a[_0x7c8a('0x36')]:_0x3d195b['model'];if(!_0x2d682f['query'][_0x7c8a('0x38')](_0x7c8a('0x39'))){_0x2f836a[_0x7c8a('0x20')]=qs['limit'](_0x2d682f[_0x7c8a('0x33')][_0x7c8a('0x20')]);_0x2f836a[_0x7c8a('0x1e')]=qs[_0x7c8a('0x1e')](_0x2d682f[_0x7c8a('0x33')][_0x7c8a('0x1e')]);}_0x2f836a[_0x7c8a('0x3a')]=qs[_0x7c8a('0x3b')](_0x2d682f[_0x7c8a('0x33')][_0x7c8a('0x3b')]);_0x2f836a[_0x7c8a('0x3c')]=qs[_0x7c8a('0x3d')](_['pick'](_0x2d682f[_0x7c8a('0x33')],_0x3d195b[_0x7c8a('0x3d')]),_0x1723ad);if(_0x2d682f[_0x7c8a('0x33')]['filter']){_0x2f836a[_0x7c8a('0x3c')]=_[_0x7c8a('0x3e')](_0x2f836a[_0x7c8a('0x3c')],{'$or':_[_0x7c8a('0x2d')](_0x1723ad,function(_0x3e3a8c){if(_0x3e3a8c[_0x7c8a('0x3f')]!==_0x7c8a('0x40')){var _0x20ac5f={};_0x20ac5f[_0x3e3a8c[_0x7c8a('0x2b')]]={'$like':'%'+_0x2d682f[_0x7c8a('0x33')]['filter']+'%'};return _0x20ac5f;}})});}_0x2f836a=_[_0x7c8a('0x3e')]({},_0x2f836a,_0x2d682f['options']);var _0x4494e2={'where':_0x2f836a[_0x7c8a('0x3c')]};return db[_0x7c8a('0x2e')]['count'](_0x4494e2)['then'](function(_0x1c0d4c){_0x5c08d5[_0x7c8a('0x21')]=_0x1c0d4c;if(_0x2d682f['query']['includeAll']){_0x2f836a[_0x7c8a('0x41')]=[{'all':!![]}];}return db[_0x7c8a('0x2e')][_0x7c8a('0x42')](_0x2f836a);})['then'](function(_0x17b98e){_0x5c08d5['rows']=_0x17b98e;return _0x5c08d5;})[_0x7c8a('0x28')](respondWithFilteredResult(_0x1d8f44,_0x2f836a))[_0x7c8a('0x43')](handleError(_0x1d8f44,null));};exports['show']=function(_0x249d7f,_0x15c0aa){var _0x547767={'raw':!![],'where':{'id':_0x249d7f[_0x7c8a('0x44')]['id']}},_0x220009={};_0x220009['model']=_[_0x7c8a('0x34')](db['SugarcrmField'][_0x7c8a('0x2f')]);_0x220009['query']=_[_0x7c8a('0x34')](_0x249d7f[_0x7c8a('0x33')]);_0x220009[_0x7c8a('0x3d')]=_[_0x7c8a('0x35')](_0x220009[_0x7c8a('0x32')],_0x220009[_0x7c8a('0x33')]);_0x547767[_0x7c8a('0x36')]=_[_0x7c8a('0x35')](_0x220009[_0x7c8a('0x32')],qs[_0x7c8a('0x37')](_0x249d7f[_0x7c8a('0x33')]['fields']));_0x547767[_0x7c8a('0x36')]=_0x547767[_0x7c8a('0x36')]['length']?_0x547767['attributes']:_0x220009[_0x7c8a('0x32')];if(_0x249d7f[_0x7c8a('0x33')]['includeAll']){_0x547767['include']=[{'all':!![]}];}_0x547767=_['merge']({},_0x547767,_0x249d7f['options']);return db[_0x7c8a('0x2e')]['find'](_0x547767)[_0x7c8a('0x28')](handleEntityNotFound(_0x15c0aa,null))['then'](respondWithResult(_0x15c0aa,null))[_0x7c8a('0x43')](handleError(_0x15c0aa,null));};exports[_0x7c8a('0x45')]=function(_0xccf0bc,_0x592bf8){return db[_0x7c8a('0x2e')][_0x7c8a('0x45')](_0xccf0bc[_0x7c8a('0x46')],{})[_0x7c8a('0x28')](respondWithResult(_0x592bf8,0xc9))['catch'](handleError(_0x592bf8,null));};exports[_0x7c8a('0x27')]=function(_0x287ae6,_0x308d6a){if(_0x287ae6[_0x7c8a('0x46')]['id']){delete _0x287ae6[_0x7c8a('0x46')]['id'];}return db[_0x7c8a('0x2e')][_0x7c8a('0x47')]({'where':{'id':_0x287ae6['params']['id']}})[_0x7c8a('0x28')](handleEntityNotFound(_0x308d6a,null))[_0x7c8a('0x28')](saveUpdates(_0x287ae6['body'],null))[_0x7c8a('0x28')](respondWithResult(_0x308d6a,null))[_0x7c8a('0x43')](handleError(_0x308d6a,null));};exports[_0x7c8a('0x29')]=function(_0x56d45d,_0x62e6e9){return db['SugarcrmField']['find']({'where':{'id':_0x56d45d[_0x7c8a('0x44')]['id']}})[_0x7c8a('0x28')](handleEntityNotFound(_0x62e6e9,null))[_0x7c8a('0x28')](removeEntity(_0x62e6e9,null))[_0x7c8a('0x43')](handleError(_0x62e6e9,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 0aff2c2..b6c29b1 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 _0xf9cc=['exports','SugarcrmField','sugarcrm_unique_index','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x41afaa,_0x290e0d){var _0x2b57c6=function(_0x467c9b){while(--_0x467c9b){_0x41afaa['push'](_0x41afaa['shift']());}};_0x2b57c6(++_0x290e0d);}(_0xf9cc,0xa8));var _0xcf9c=function(_0x51486a,_0x250856){_0x51486a=_0x51486a-0x0;var _0x7756d9=_0xf9cc[_0x51486a];return _0x7756d9;};'use strict';var _=require(_0xcf9c('0x0'));var util=require('util');var logger=require(_0xcf9c('0x1'))(_0xcf9c('0x2'));var moment=require(_0xcf9c('0x3'));var BPromise=require('bluebird');var rp=require(_0xcf9c('0x4'));var fs=require('fs');var path=require(_0xcf9c('0x5'));var rimraf=require(_0xcf9c('0x6'));var config=require(_0xcf9c('0x7'));var attributes=require('./intSugarcrmField.attributes');module[_0xcf9c('0x8')]=function(_0x2a3e3a,_0x376b28){return _0x2a3e3a['define'](_0xcf9c('0x9'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0xcf9c('0xa'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x144c=['rimraf','../../config/environment','./intSugarcrmField.attributes','define','SugarcrmField','int_sugarcrm_fields','idField','lodash','util','../../config/logger','api','bluebird'];(function(_0x4b4b0e,_0x6c674){var _0x4c2d91=function(_0x4d440d){while(--_0x4d440d){_0x4b4b0e['push'](_0x4b4b0e['shift']());}};_0x4c2d91(++_0x6c674);}(_0x144c,0x8b));var _0xc144=function(_0x490e0a,_0x1eca50){_0x490e0a=_0x490e0a-0x0;var _0x212ff2=_0x144c[_0x490e0a];return _0x212ff2;};'use strict';var _=require(_0xc144('0x0'));var util=require(_0xc144('0x1'));var logger=require(_0xc144('0x2'))(_0xc144('0x3'));var moment=require('moment');var BPromise=require(_0xc144('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc144('0x5'));var config=require(_0xc144('0x6'));var attributes=require(_0xc144('0x7'));module['exports']=function(_0x17a082,_0x435f26){return _0x17a082[_0xc144('0x8')](_0xc144('0x9'),attributes,{'tableName':_0xc144('0xa'),'paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':[_0xc144('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 42e89b0..6d137f4 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 _0x7202=['error','code','message','result','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','then','info','SugarcrmField,\x20%s,\x20%s','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x2ecb85,_0x4e24e0){var _0x37b245=function(_0x4211af){while(--_0x4211af){_0x2ecb85['push'](_0x2ecb85['shift']());}};_0x37b245(++_0x4e24e0);}(_0x7202,0x180));var _0x2720=function(_0x38b8c,_0x4a0c9f){_0x38b8c=_0x38b8c-0x0;var _0x41f904=_0x7202[_0x38b8c];return _0x41f904;};'use strict';var _=require('lodash');var util=require(_0x2720('0x0'));var moment=require(_0x2720('0x1'));var BPromise=require(_0x2720('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2720('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x2720('0x4'));var logger=require(_0x2720('0x5'))('rpc');var config=require(_0x2720('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x2720('0x7')][_0x2720('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xe2537,_0x1d8680,_0xa9506a){return new BPromise(function(_0xa181f2,_0x4026ad){return client['request'](_0xe2537,_0xa9506a)[_0x2720('0x9')](function(_0x543cd1){logger[_0x2720('0xa')](_0x2720('0xb'),_0x1d8680,'request\x20sent');logger[_0x2720('0xc')](_0x2720('0xd'),_0x1d8680,_0x2720('0xe'),JSON['stringify'](_0x543cd1));if(_0x543cd1['error']){if(_0x543cd1[_0x2720('0xf')][_0x2720('0x10')]===0x1f4){logger['error'](_0x2720('0xb'),_0x1d8680,_0x543cd1['error']['message']);return _0x4026ad(_0x543cd1[_0x2720('0xf')][_0x2720('0x11')]);}logger['error']('SugarcrmField,\x20%s,\x20%s',_0x1d8680,_0x543cd1[_0x2720('0xf')][_0x2720('0x11')]);return _0xa181f2(_0x543cd1[_0x2720('0xf')][_0x2720('0x11')]);}else{logger[_0x2720('0xa')](_0x2720('0xb'),_0x1d8680,_0x2720('0xe'));_0xa181f2(_0x543cd1[_0x2720('0x12')][_0x2720('0x11')]);}})['catch'](function(_0x50f9ce){logger['error']('SugarcrmField,\x20%s,\x20%s',_0x1d8680,_0x50f9ce);_0x4026ad(_0x50f9ce);});});} \ No newline at end of file +var _0x544a=['info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then'];(function(_0x56dccb,_0x2c4069){var _0x170f9c=function(_0x56888f){while(--_0x56888f){_0x56dccb['push'](_0x56dccb['shift']());}};_0x170f9c(++_0x2c4069);}(_0x544a,0x9d));var _0xa544=function(_0x158166,_0x345a77){_0x158166=_0x158166-0x0;var _0x309a38=_0x544a[_0x158166];return _0x309a38;};'use strict';var _=require(_0xa544('0x0'));var util=require(_0xa544('0x1'));var moment=require('moment');var BPromise=require(_0xa544('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa544('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa544('0x4'));var logger=require(_0xa544('0x5'))('rpc');var config=require(_0xa544('0x6'));var jayson=require(_0xa544('0x7'));var client=jayson['client'][_0xa544('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x22b173,_0x352865,_0x41f879){return new BPromise(function(_0x4e644d,_0x20e326){return client[_0xa544('0x9')](_0x22b173,_0x41f879)[_0xa544('0xa')](function(_0x4b77be){logger[_0xa544('0xb')](_0xa544('0xc'),_0x352865,_0xa544('0xd'));logger[_0xa544('0xe')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x352865,'request\x20sent',JSON[_0xa544('0xf')](_0x4b77be));if(_0x4b77be[_0xa544('0x10')]){if(_0x4b77be[_0xa544('0x10')][_0xa544('0x11')]===0x1f4){logger['error'](_0xa544('0xc'),_0x352865,_0x4b77be['error'][_0xa544('0x12')]);return _0x20e326(_0x4b77be[_0xa544('0x10')][_0xa544('0x12')]);}logger['error'](_0xa544('0xc'),_0x352865,_0x4b77be['error']['message']);return _0x4e644d(_0x4b77be[_0xa544('0x10')][_0xa544('0x12')]);}else{logger['info']('SugarcrmField,\x20%s,\x20%s',_0x352865,_0xa544('0xd'));_0x4e644d(_0x4b77be[_0xa544('0x13')][_0xa544('0x12')]);}})[_0xa544('0x14')](function(_0x37d74c){logger[_0xa544('0x10')]('SugarcrmField,\x20%s,\x20%s',_0x352865,_0x37d74c);_0x20e326(_0x37d74c);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index f6444bc..ad1a6b1 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 _0x2f42=['post','put','update','destroy','multer','util','path','express','../../components/auth/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','create'];(function(_0x43f2aa,_0x48a4e5){var _0x262eb4=function(_0x1484b7){while(--_0x1484b7){_0x43f2aa['push'](_0x43f2aa['shift']());}};_0x262eb4(++_0x48a4e5);}(_0x2f42,0x90));var _0x22f4=function(_0x3b770f,_0x1cd2b4){_0x3b770f=_0x3b770f-0x0;var _0x37b33d=_0x2f42[_0x3b770f];return _0x37b33d;};'use strict';var multer=require(_0x22f4('0x0'));var util=require(_0x22f4('0x1'));var path=require(_0x22f4('0x2'));var timeout=require('connect-timeout');var express=require(_0x22f4('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x22f4('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x22f4('0x5'));var controller=require(_0x22f4('0x6'));router[_0x22f4('0x7')]('/',auth[_0x22f4('0x8')](),controller[_0x22f4('0x9')]);router[_0x22f4('0x7')](_0x22f4('0xa'),auth[_0x22f4('0x8')](),controller[_0x22f4('0xb')]);router['get'](_0x22f4('0xc'),auth[_0x22f4('0x8')](),controller[_0x22f4('0xd')]);router[_0x22f4('0x7')](_0x22f4('0xe'),auth[_0x22f4('0x8')](),controller['getFields']);router['post']('/',auth['isAuthenticated'](),controller[_0x22f4('0xf')]);router[_0x22f4('0x10')](_0x22f4('0xc'),auth[_0x22f4('0x8')](),controller['addConfiguration']);router[_0x22f4('0x11')](_0x22f4('0xa'),auth[_0x22f4('0x8')](),controller[_0x22f4('0x12')]);router['delete'](_0x22f4('0xa'),auth[_0x22f4('0x8')](),controller[_0x22f4('0x13')]);module['exports']=router; \ No newline at end of file +var _0x98d3=['Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','multer','util','connect-timeout'];(function(_0x2f4448,_0x2958ed){var _0x529444=function(_0x5a18eb){while(--_0x5a18eb){_0x2f4448['push'](_0x2f4448['shift']());}};_0x529444(++_0x2958ed);}(_0x98d3,0x173));var _0x398d=function(_0x1fd491,_0x2f35ce){_0x1fd491=_0x1fd491-0x0;var _0x52c1ad=_0x98d3[_0x1fd491];return _0x52c1ad;};'use strict';var multer=require(_0x398d('0x0'));var util=require(_0x398d('0x1'));var path=require('path');var timeout=require(_0x398d('0x2'));var express=require('express');var router=express[_0x398d('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x398d('0x4'));var interaction=require(_0x398d('0x5'));var config=require('../../config/environment');var controller=require('./intVtigerAccount.controller');router[_0x398d('0x6')]('/',auth[_0x398d('0x7')](),controller[_0x398d('0x8')]);router['get'](_0x398d('0x9'),auth[_0x398d('0x7')](),controller[_0x398d('0xa')]);router[_0x398d('0x6')](_0x398d('0xb'),auth['isAuthenticated'](),controller[_0x398d('0xc')]);router[_0x398d('0x6')](_0x398d('0xd'),auth[_0x398d('0x7')](),controller[_0x398d('0xe')]);router[_0x398d('0xf')]('/',auth[_0x398d('0x7')](),controller[_0x398d('0x10')]);router['post'](_0x398d('0xb'),auth[_0x398d('0x7')](),controller[_0x398d('0x11')]);router[_0x398d('0x12')](_0x398d('0x9'),auth[_0x398d('0x7')](),controller[_0x398d('0x13')]);router[_0x398d('0x14')](_0x398d('0x9'),auth[_0x398d('0x7')](),controller[_0x398d('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index c6d5b47..1272187 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 _0x8e34=['sequelize','exports','STRING','HelpDesk'];(function(_0x252bac,_0x4cdbfe){var _0x2b43d4=function(_0x2e38e3){while(--_0x2e38e3){_0x252bac['push'](_0x252bac['shift']());}};_0x2b43d4(++_0x4cdbfe);}(_0x8e34,0x1cc));var _0x48e3=function(_0x44976c,_0x5132c4){_0x44976c=_0x44976c-0x0;var _0x332682=_0x8e34[_0x44976c];return _0x332682;};'use strict';var Sequelize=require(_0x48e3('0x0'));module[_0x48e3('0x1')]={'name':{'type':Sequelize[_0x48e3('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x48e3('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x48e3('0x2')],'allowNull':![],'defaultValue':_0x48e3('0x3')},'remoteUri':{'type':Sequelize[_0x48e3('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x48e3('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x3908=['exports','STRING','HelpDesk','sequelize'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x3908,0x1e3));var _0x8390=function(_0x211632,_0x378e2e){_0x211632=_0x211632-0x0;var _0x5a1da1=_0x3908[_0x211632];return _0x5a1da1;};'use strict';var Sequelize=require(_0x8390('0x0'));module[_0x8390('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x8390('0x2')]},'username':{'type':Sequelize[_0x8390('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x8390('0x2')],'allowNull':![],'defaultValue':_0x8390('0x3')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x8390('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x8390('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 652d345..c350356 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 _0xc5a9=['apply','reject','save','update','then','name','send','index','VtigerAccount','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','body','destroy','getConfigurations','findOne','VtigerConfiguration','Subjects','getSubjects','Descriptions','getDescriptions','channel','create','VtigerField','md5','getFields','username','description','moduleName','remoteUri','slice','lastIndexOf','GET','getchallenge','success','POST','login','token','describe','sessionName','autogenerated','owner','remove','result','editable','false','startsWith','picklistValues','length','label','value','log','vTiger\x20error:\x20','test','stringify','statusCode','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','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../components/integrations/configuration','sendStatus','end','json','offset','limit','undefined','count','status','set','Content-Range'];(function(_0x139dcd,_0x4f6f73){var _0x11308d=function(_0x139756){while(--_0x139756){_0x139dcd['push'](_0x139dcd['shift']());}};_0x11308d(++_0x4f6f73);}(_0xc5a9,0xc8));var _0x9c5a=function(_0xa60623,_0x2d4e4f){_0xa60623=_0xa60623-0x0;var _0x4a6487=_0xc5a9[_0xa60623];return _0x4a6487;};'use strict';var emlformat=require(_0x9c5a('0x0'));var rimraf=require(_0x9c5a('0x1'));var zipdir=require(_0x9c5a('0x2'));var jsonpatch=require(_0x9c5a('0x3'));var rp=require(_0x9c5a('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9c5a('0x5'));var util=require(_0x9c5a('0x6'));var path=require(_0x9c5a('0x7'));var sox=require(_0x9c5a('0x8'));var csv=require(_0x9c5a('0x9'));var ejs=require(_0x9c5a('0xa'));var fs=require('fs');var fs_extra=require(_0x9c5a('0xb'));var _=require(_0x9c5a('0xc'));var squel=require(_0x9c5a('0xd'));var crypto=require(_0x9c5a('0xe'));var jsforce=require(_0x9c5a('0xf'));var deskjs=require(_0x9c5a('0x10'));var toCsv=require('to-csv');var querystring=require(_0x9c5a('0x11'));var Papa=require(_0x9c5a('0x12'));var Redis=require(_0x9c5a('0x13'));var authService=require(_0x9c5a('0x14'));var qs=require(_0x9c5a('0x15'));var as=require(_0x9c5a('0x16'));var hardwareService=require(_0x9c5a('0x17'));var logger=require(_0x9c5a('0x18'))(_0x9c5a('0x19'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x9c5a('0x1a'));var db=require('../../mysqldb')['db'];var integrations=require(_0x9c5a('0x1b'));function respondWithStatusCode(_0x54dbaa,_0x33ffc5){_0x33ffc5=_0x33ffc5||0xcc;return function(_0xe7ca51){if(_0xe7ca51){return _0x54dbaa[_0x9c5a('0x1c')](_0x33ffc5);}return _0x54dbaa['status'](_0x33ffc5)[_0x9c5a('0x1d')]();};}function respondWithResult(_0x1772c3,_0x278302){_0x278302=_0x278302||0xc8;return function(_0x9b1194){if(_0x9b1194){return _0x1772c3['status'](_0x278302)[_0x9c5a('0x1e')](_0x9b1194);}};}function respondWithFilteredResult(_0x46f7be,_0x52a15c){return function(_0x3ec9b1){if(_0x3ec9b1){var _0x49e687=typeof _0x52a15c[_0x9c5a('0x1f')]==='undefined'&&typeof _0x52a15c[_0x9c5a('0x20')]===_0x9c5a('0x21');var _0x1997da=_0x3ec9b1['count'];var _0x5e84aa=_0x49e687?0x0:_0x52a15c[_0x9c5a('0x1f')];var _0x1fbc27=_0x49e687?_0x3ec9b1[_0x9c5a('0x22')]:_0x52a15c['offset']+_0x52a15c[_0x9c5a('0x20')];var _0x12e624;if(_0x1fbc27>=_0x1997da){_0x1fbc27=_0x1997da;_0x12e624=0xc8;}else{_0x12e624=0xce;}_0x46f7be[_0x9c5a('0x23')](_0x12e624);return _0x46f7be[_0x9c5a('0x24')](_0x9c5a('0x25'),_0x5e84aa+'-'+_0x1fbc27+'/'+_0x1997da)[_0x9c5a('0x1e')](_0x3ec9b1);}return null;};}function patchUpdates(_0x164509){return function(_0x556e48){try{jsonpatch[_0x9c5a('0x26')](_0x556e48,_0x164509,!![]);}catch(_0x20f8fe){return BPromise[_0x9c5a('0x27')](_0x20f8fe);}return _0x556e48[_0x9c5a('0x28')]();};}function saveUpdates(_0x58b8f0,_0x4dab14){return function(_0x1c05d4){if(_0x1c05d4){return _0x1c05d4[_0x9c5a('0x29')](_0x58b8f0)['then'](function(_0x18647d){return _0x18647d;});}return null;};}function removeEntity(_0x295c57,_0x23297d){return function(_0x360628){if(_0x360628){return _0x360628['destroy']()[_0x9c5a('0x2a')](function(){_0x295c57[_0x9c5a('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c7b6d,_0x585cec){return function(_0x1d6891){if(!_0x1d6891){_0x4c7b6d[_0x9c5a('0x1c')](0x194);}return _0x1d6891;};}function handleError(_0x3f9888,_0xc6cad8){_0xc6cad8=_0xc6cad8||0x1f4;return function(_0x299715){logger['error'](_0x299715['stack']);if(_0x299715[_0x9c5a('0x2b')]){delete _0x299715[_0x9c5a('0x2b')];}_0x3f9888['status'](_0xc6cad8)[_0x9c5a('0x2c')](_0x299715);};}exports[_0x9c5a('0x2d')]=function(_0x2ff7ff,_0x1d0e74){var _0x49794e={},_0x519156={},_0x470ac4={'count':0x0,'rows':[]};var _0x41d24e=_['map'](db[_0x9c5a('0x2e')][_0x9c5a('0x2f')],function(_0x460bf1){return{'name':_0x460bf1[_0x9c5a('0x30')],'type':_0x460bf1[_0x9c5a('0x31')]['key']};});_0x519156[_0x9c5a('0x32')]=_[_0x9c5a('0x33')](_0x41d24e,_0x9c5a('0x2b'));_0x519156[_0x9c5a('0x34')]=_[_0x9c5a('0x35')](_0x2ff7ff[_0x9c5a('0x34')]);_0x519156[_0x9c5a('0x36')]=_[_0x9c5a('0x37')](_0x519156[_0x9c5a('0x32')],_0x519156[_0x9c5a('0x34')]);_0x49794e[_0x9c5a('0x38')]=_[_0x9c5a('0x37')](_0x519156[_0x9c5a('0x32')],qs[_0x9c5a('0x39')](_0x2ff7ff['query'][_0x9c5a('0x39')]));_0x49794e[_0x9c5a('0x38')]=_0x49794e[_0x9c5a('0x38')]['length']?_0x49794e['attributes']:_0x519156[_0x9c5a('0x32')];if(!_0x2ff7ff['query']['hasOwnProperty'](_0x9c5a('0x3a'))){_0x49794e['limit']=qs[_0x9c5a('0x20')](_0x2ff7ff[_0x9c5a('0x34')]['limit']);_0x49794e['offset']=qs['offset'](_0x2ff7ff[_0x9c5a('0x34')][_0x9c5a('0x1f')]);}_0x49794e[_0x9c5a('0x3b')]=qs[_0x9c5a('0x3c')](_0x2ff7ff[_0x9c5a('0x34')][_0x9c5a('0x3c')]);_0x49794e[_0x9c5a('0x3d')]=qs['filters'](_[_0x9c5a('0x3e')](_0x2ff7ff[_0x9c5a('0x34')],_0x519156[_0x9c5a('0x36')]),_0x41d24e);if(_0x2ff7ff[_0x9c5a('0x34')][_0x9c5a('0x3f')]){_0x49794e['where']=_[_0x9c5a('0x40')](_0x49794e[_0x9c5a('0x3d')],{'$or':_['map'](_0x41d24e,function(_0x1ab3be){if(_0x1ab3be[_0x9c5a('0x31')]!==_0x9c5a('0x41')){var _0x49fb51={};_0x49fb51[_0x1ab3be[_0x9c5a('0x2b')]]={'$like':'%'+_0x2ff7ff['query'][_0x9c5a('0x3f')]+'%'};return _0x49fb51;}})});}_0x49794e=_[_0x9c5a('0x40')]({},_0x49794e,_0x2ff7ff[_0x9c5a('0x42')]);var _0x1548be={'where':_0x49794e[_0x9c5a('0x3d')]};return db[_0x9c5a('0x2e')][_0x9c5a('0x22')](_0x1548be)[_0x9c5a('0x2a')](function(_0x55c265){_0x470ac4[_0x9c5a('0x22')]=_0x55c265;if(_0x2ff7ff[_0x9c5a('0x34')][_0x9c5a('0x43')]){_0x49794e[_0x9c5a('0x44')]=[{'all':!![]}];}return db[_0x9c5a('0x2e')][_0x9c5a('0x45')](_0x49794e);})[_0x9c5a('0x2a')](function(_0x5d8ab9){_0x470ac4[_0x9c5a('0x46')]=_0x5d8ab9;return _0x470ac4;})['then'](respondWithFilteredResult(_0x1d0e74,_0x49794e))[_0x9c5a('0x47')](handleError(_0x1d0e74,null));};exports[_0x9c5a('0x48')]=function(_0x280a23,_0x41df58){var _0xc362e4={'raw':![],'where':{'id':_0x280a23[_0x9c5a('0x49')]['id']}},_0x5c3244={};_0x5c3244[_0x9c5a('0x32')]=_['keys'](db[_0x9c5a('0x2e')][_0x9c5a('0x2f')]);_0x5c3244[_0x9c5a('0x34')]=_[_0x9c5a('0x35')](_0x280a23['query']);_0x5c3244[_0x9c5a('0x36')]=_[_0x9c5a('0x37')](_0x5c3244[_0x9c5a('0x32')],_0x5c3244[_0x9c5a('0x34')]);_0xc362e4[_0x9c5a('0x38')]=_[_0x9c5a('0x37')](_0x5c3244[_0x9c5a('0x32')],qs[_0x9c5a('0x39')](_0x280a23[_0x9c5a('0x34')][_0x9c5a('0x39')]));_0xc362e4[_0x9c5a('0x38')]=_0xc362e4[_0x9c5a('0x38')]['length']?_0xc362e4[_0x9c5a('0x38')]:_0x5c3244['model'];if(_0x280a23[_0x9c5a('0x34')]['includeAll']){_0xc362e4[_0x9c5a('0x44')]=[{'all':!![]}];}_0xc362e4=_[_0x9c5a('0x40')]({},_0xc362e4,_0x280a23[_0x9c5a('0x42')]);return db['VtigerAccount'][_0x9c5a('0x4a')](_0xc362e4)['then'](handleEntityNotFound(_0x41df58,null))[_0x9c5a('0x2a')](respondWithResult(_0x41df58,null))['catch'](handleError(_0x41df58,null));};exports['create']=function(_0x1e7c79,_0x54faee){return db['VtigerAccount']['create'](_0x1e7c79[_0x9c5a('0x4b')],{})[_0x9c5a('0x2a')](respondWithResult(_0x54faee,0xc9))['catch'](handleError(_0x54faee,null));};exports[_0x9c5a('0x29')]=function(_0x43f5cf,_0x3c7db4){if(_0x43f5cf[_0x9c5a('0x4b')]['id']){delete _0x43f5cf['body']['id'];}return db[_0x9c5a('0x2e')]['find']({'where':{'id':_0x43f5cf['params']['id']}})[_0x9c5a('0x2a')](handleEntityNotFound(_0x3c7db4,null))[_0x9c5a('0x2a')](saveUpdates(_0x43f5cf[_0x9c5a('0x4b')],null))[_0x9c5a('0x2a')](respondWithResult(_0x3c7db4,null))['catch'](handleError(_0x3c7db4,null));};exports[_0x9c5a('0x4c')]=function(_0x5d58d3,_0xc5f13d){return db[_0x9c5a('0x2e')][_0x9c5a('0x4a')]({'where':{'id':_0x5d58d3['params']['id']}})['then'](handleEntityNotFound(_0xc5f13d,null))[_0x9c5a('0x2a')](removeEntity(_0xc5f13d,null))[_0x9c5a('0x47')](handleError(_0xc5f13d,null));};exports[_0x9c5a('0x4d')]=function(_0x27a099,_0x580065,_0x372790){var _0x14e38f={};var _0x461f0f={};var _0x4013e4;var _0x12fe8c;return db[_0x9c5a('0x2e')][_0x9c5a('0x4e')]({'where':{'id':_0x27a099[_0x9c5a('0x49')]['id']}})[_0x9c5a('0x2a')](handleEntityNotFound(_0x580065,null))[_0x9c5a('0x2a')](function(_0x25b316){if(_0x25b316){_0x4013e4=_0x25b316;_0x461f0f[_0x9c5a('0x32')]=_[_0x9c5a('0x35')](db[_0x9c5a('0x4f')][_0x9c5a('0x2f')]);_0x461f0f[_0x9c5a('0x34')]=_[_0x9c5a('0x35')](_0x27a099['query']);_0x461f0f[_0x9c5a('0x36')]=_['intersection'](_0x461f0f[_0x9c5a('0x32')],_0x461f0f['query']);_0x14e38f[_0x9c5a('0x38')]=_[_0x9c5a('0x37')](_0x461f0f[_0x9c5a('0x32')],qs[_0x9c5a('0x39')](_0x27a099[_0x9c5a('0x34')][_0x9c5a('0x39')]));_0x14e38f['attributes']=_0x14e38f['attributes']['length']?_0x14e38f['attributes']:_0x461f0f['model'];_0x14e38f['order']=qs[_0x9c5a('0x3c')](_0x27a099[_0x9c5a('0x34')][_0x9c5a('0x3c')]);_0x14e38f[_0x9c5a('0x3d')]=qs['filters'](_[_0x9c5a('0x3e')](_0x27a099['query'],_0x461f0f[_0x9c5a('0x36')]));if(_0x27a099[_0x9c5a('0x34')][_0x9c5a('0x3f')]){_0x14e38f[_0x9c5a('0x3d')]=_['merge'](_0x14e38f[_0x9c5a('0x3d')],{'$or':_['map'](_0x14e38f[_0x9c5a('0x38')],function(_0x16ebfc){var _0x8c2d05={};_0x8c2d05[_0x16ebfc]={'$like':'%'+_0x27a099[_0x9c5a('0x34')][_0x9c5a('0x3f')]+'%'};return _0x8c2d05;})});}_0x14e38f=_[_0x9c5a('0x40')]({},_0x14e38f,_0x27a099[_0x9c5a('0x42')]);return _0x4013e4[_0x9c5a('0x4d')](_0x14e38f);}})[_0x9c5a('0x2a')](function(_0x277cbe){if(_0x277cbe){_0x12fe8c=_0x277cbe['length'];if(!_0x27a099[_0x9c5a('0x34')]['hasOwnProperty'](_0x9c5a('0x3a'))){_0x14e38f[_0x9c5a('0x20')]=qs[_0x9c5a('0x20')](_0x27a099['query'][_0x9c5a('0x20')]);_0x14e38f[_0x9c5a('0x1f')]=qs[_0x9c5a('0x1f')](_0x27a099[_0x9c5a('0x34')][_0x9c5a('0x1f')]);}return _0x4013e4[_0x9c5a('0x4d')](_0x14e38f);}})[_0x9c5a('0x2a')](function(_0x2eb513){if(_0x2eb513){return _0x2eb513?{'count':_0x12fe8c,'rows':_0x2eb513}:null;}})['then'](respondWithResult(_0x580065,null))[_0x9c5a('0x47')](handleError(_0x580065,null));};exports['addConfiguration']=function(_0x361ca4,_0x537d4a,_0x1afaf8){if(_0x361ca4[_0x9c5a('0x4b')]['id']){delete _0x361ca4[_0x9c5a('0x4b')]['id'];}return db['VtigerAccount']['findOne']({'where':{'id':_0x361ca4[_0x9c5a('0x49')]['id']}})['then'](handleEntityNotFound(_0x537d4a,null))[_0x9c5a('0x2a')](function(_0x2ec1fe){if(_0x2ec1fe){_0x361ca4[_0x9c5a('0x4b')]['AccountId']=_0x2ec1fe['id'];_0x361ca4[_0x9c5a('0x4b')][_0x9c5a('0x50')]=integrations[_0x9c5a('0x51')](_0x361ca4['body']['channel'],_0x361ca4[_0x9c5a('0x4b')][_0x9c5a('0x31')]);_0x361ca4[_0x9c5a('0x4b')][_0x9c5a('0x52')]=integrations[_0x9c5a('0x53')](_0x361ca4[_0x9c5a('0x4b')][_0x9c5a('0x54')],_0x361ca4[_0x9c5a('0x4b')]['type']);return db[_0x9c5a('0x4f')][_0x9c5a('0x55')](_0x361ca4[_0x9c5a('0x4b')],{'include':[{'model':db[_0x9c5a('0x56')],'as':_0x9c5a('0x50')},{'model':db[_0x9c5a('0x56')],'as':_0x9c5a('0x52')}]});}return null;})[_0x9c5a('0x2a')](respondWithResult(_0x537d4a,null))[_0x9c5a('0x47')](handleError(_0x537d4a,null));};var md5=require(_0x9c5a('0x57'));exports[_0x9c5a('0x58')]=function(_0x14708e,_0x70073f,_0x34230d){var _0x584911=null;var _0x2cd360=null;var _0x292b81=null;var _0x144643=null;var _0x59dd64='';return db[_0x9c5a('0x2e')]['findOne']({'where':{'id':_0x14708e[_0x9c5a('0x49')]['id']},'attributes':['id','name',_0x9c5a('0x59'),_0x9c5a('0x5a'),_0x9c5a('0x5b'),'remoteUri','serverUrl','accessKey']})[_0x9c5a('0x2a')](handleEntityNotFound(_0x70073f,null))[_0x9c5a('0x2a')](function(_0x3b1240){if(_0x3b1240){_0x584911=_0x3b1240[_0x9c5a('0x59')];_0x2cd360=_0x3b1240['accessKey'];_0x292b81=_0x3b1240[_0x9c5a('0x5b')];_0x59dd64=_0x3b1240[_0x9c5a('0x5c')];var _0x2388dc=_0x59dd64[_0x9c5a('0x5d')](-0x1);if(_0x2388dc==='/'){_0x59dd64=_0x59dd64['substring'](0x0,_0x59dd64[_0x9c5a('0x5e')](_0x2388dc));}_0x144643=util['format']('%s/webservice.php',_0x59dd64);var _0x5e3cbb={'method':_0x9c5a('0x5f'),'uri':_0x144643,'qs':{'operation':_0x9c5a('0x60'),'username':_0x3b1240['username']},'json':!![]};return rp(_0x5e3cbb);}})[_0x9c5a('0x2a')](function(_0x50bff4){if(_0x50bff4[_0x9c5a('0x61')]){var _0x5dbf6b={'method':_0x9c5a('0x62'),'uri':_0x144643,'form':{'operation':_0x9c5a('0x63'),'username':_0x584911,'accessKey':md5(_0x50bff4['result'][_0x9c5a('0x64')]+_0x2cd360)},'json':!![]};return rp(_0x5dbf6b);}})['then'](function(_0xe3a426){if(_0xe3a426[_0x9c5a('0x61')]){var _0x3536d9={'method':_0x9c5a('0x5f'),'uri':_0x144643,'qs':{'operation':_0x9c5a('0x65'),'username':_0x584911,'sessionName':_0xe3a426['result'][_0x9c5a('0x66')],'elementType':_0x292b81},'json':!![]};return rp(_0x3536d9);}})[_0x9c5a('0x2a')](function(_0x58cf72){if(_0x58cf72['success']){var _0x2ca742=[_0x9c5a('0x67'),'reference',_0x9c5a('0x68')];_[_0x9c5a('0x69')](_0x58cf72[_0x9c5a('0x6a')]['fields'],function(_0x4aedd2){return _0x2ca742['includes'](_0x4aedd2['type'][_0x9c5a('0x2b')]);});_[_0x9c5a('0x69')](_0x58cf72[_0x9c5a('0x6a')][_0x9c5a('0x39')],function(_0x4c7388){return _0x4c7388[_0x9c5a('0x6b')]===_0x9c5a('0x6c');});return{'count':_0x58cf72['result'][_0x9c5a('0x39')]['length'],'rows':_[_0x9c5a('0x33')](_0x58cf72['result'][_0x9c5a('0x39')],function(_0x46d1fc){return{'id':_0x46d1fc[_0x9c5a('0x2b')],'name':_0x46d1fc['label'],'custom':_[_0x9c5a('0x6d')](_0x46d1fc[_0x9c5a('0x2b')],'cf_')?!![]:![],'options':_0x46d1fc[_0x9c5a('0x31')]['name']==='picklist'&&_0x46d1fc[_0x9c5a('0x31')][_0x9c5a('0x6e')][_0x9c5a('0x6f')]>0x0?_[_0x9c5a('0x33')](_0x46d1fc[_0x9c5a('0x31')][_0x9c5a('0x6e')],function(_0x3906ef){return{'name':_0x3906ef[_0x9c5a('0x70')],'value':_0x3906ef[_0x9c5a('0x71')]};}):[]};})};}})[_0x9c5a('0x2a')](respondWithResult(_0x70073f,null))['catch'](function(_0x348d7c){console[_0x9c5a('0x72')](_0x9c5a('0x73')+_0x348d7c);var _0x198bd9=_0x14708e[_0x9c5a('0x34')][_0x9c5a('0x74')]?0x1f4:_0x348d7c['statusCode']||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x9c5a('0x58'),_0x198bd9,JSON[_0x9c5a('0x75')](_0x348d7c));delete _0x348d7c[_0x9c5a('0x2b')];if(_0x198bd9===0x191){_0x198bd9=0x190;}_0x70073f['status'](_0x198bd9)['send'](_0x14708e[_0x9c5a('0x34')][_0x9c5a('0x74')]?{'message':'Wrong\x20credentials','statusCode':_0x348d7c[_0x9c5a('0x76')]}:_0x348d7c);});}; \ No newline at end of file +var _0x3050=['startsWith','cf_','picklist','picklistValues','value','log','vTiger\x20error:\x20','test','statusCode','stringify','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','limit','apply','reject','save','update','destroy','then','error','name','send','index','map','VtigerAccount','rawAttributes','fieldName','type','model','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','params','intersection','length','include','find','catch','create','body','findOne','VtigerConfiguration','order','AccountId','Descriptions','channel','md5','getFields','username','description','remoteUri','serverUrl','accessKey','moduleName','slice','lastIndexOf','format','%s/webservice.php','GET','getchallenge','POST','login','result','success','sessionName','reference','remove','includes','editable','false','label'];(function(_0x5c78d9,_0x2736c7){var _0x69ae1f=function(_0x4b31ac){while(--_0x4b31ac){_0x5c78d9['push'](_0x5c78d9['shift']());}};_0x69ae1f(++_0x2736c7);}(_0x3050,0x7e));var _0x0305=function(_0x2b4329,_0x126c4c){_0x2b4329=_0x2b4329-0x0;var _0x409c0f=_0x3050[_0x2b4329];return _0x409c0f;};'use strict';var emlformat=require(_0x0305('0x0'));var rimraf=require(_0x0305('0x1'));var zipdir=require(_0x0305('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0305('0x3'));var moment=require(_0x0305('0x4'));var BPromise=require(_0x0305('0x5'));var Mustache=require(_0x0305('0x6'));var util=require(_0x0305('0x7'));var path=require(_0x0305('0x8'));var sox=require(_0x0305('0x9'));var csv=require(_0x0305('0xa'));var ejs=require(_0x0305('0xb'));var fs=require('fs');var fs_extra=require(_0x0305('0xc'));var _=require(_0x0305('0xd'));var squel=require(_0x0305('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0305('0xf'));var toCsv=require(_0x0305('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0305('0x10'));var authService=require(_0x0305('0x11'));var qs=require(_0x0305('0x12'));var as=require(_0x0305('0x13'));var hardwareService=require(_0x0305('0x14'));var logger=require(_0x0305('0x15'))('api');var utils=require(_0x0305('0x16'));var config=require(_0x0305('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x0305('0x18'))['db'];var integrations=require(_0x0305('0x19'));function respondWithStatusCode(_0xd5be9,_0x5a68cd){_0x5a68cd=_0x5a68cd||0xcc;return function(_0x5404ba){if(_0x5404ba){return _0xd5be9[_0x0305('0x1a')](_0x5a68cd);}return _0xd5be9[_0x0305('0x1b')](_0x5a68cd)[_0x0305('0x1c')]();};}function respondWithResult(_0x4a3047,_0x8d866f){_0x8d866f=_0x8d866f||0xc8;return function(_0x168adc){if(_0x168adc){return _0x4a3047[_0x0305('0x1b')](_0x8d866f)[_0x0305('0x1d')](_0x168adc);}};}function respondWithFilteredResult(_0x1b8d34,_0x2de324){return function(_0x5f07ed){if(_0x5f07ed){var _0x553579=typeof _0x2de324[_0x0305('0x1e')]===_0x0305('0x1f')&&typeof _0x2de324['limit']===_0x0305('0x1f');var _0x3ff19c=_0x5f07ed['count'];var _0x35dc91=_0x553579?0x0:_0x2de324[_0x0305('0x1e')];var _0x1aab54=_0x553579?_0x5f07ed[_0x0305('0x20')]:_0x2de324[_0x0305('0x1e')]+_0x2de324[_0x0305('0x21')];var _0x42c8b4;if(_0x1aab54>=_0x3ff19c){_0x1aab54=_0x3ff19c;_0x42c8b4=0xc8;}else{_0x42c8b4=0xce;}_0x1b8d34[_0x0305('0x1b')](_0x42c8b4);return _0x1b8d34['set']('Content-Range',_0x35dc91+'-'+_0x1aab54+'/'+_0x3ff19c)[_0x0305('0x1d')](_0x5f07ed);}return null;};}function patchUpdates(_0x41e059){return function(_0x53a529){try{jsonpatch[_0x0305('0x22')](_0x53a529,_0x41e059,!![]);}catch(_0x11e22d){return BPromise[_0x0305('0x23')](_0x11e22d);}return _0x53a529[_0x0305('0x24')]();};}function saveUpdates(_0xa2d6f0,_0x706121){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0305('0x25')](_0xa2d6f0)['then'](function(_0x536f38){return _0x536f38;});}return null;};}function removeEntity(_0x590b30,_0x12eb01){return function(_0x5ecb17){if(_0x5ecb17){return _0x5ecb17[_0x0305('0x26')]()[_0x0305('0x27')](function(){_0x590b30[_0x0305('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x49494d,_0x169878){return function(_0x3bbb0f){if(!_0x3bbb0f){_0x49494d[_0x0305('0x1a')](0x194);}return _0x3bbb0f;};}function handleError(_0x5edcd3,_0x263786){_0x263786=_0x263786||0x1f4;return function(_0x396c03){logger[_0x0305('0x28')](_0x396c03['stack']);if(_0x396c03[_0x0305('0x29')]){delete _0x396c03[_0x0305('0x29')];}_0x5edcd3[_0x0305('0x1b')](_0x263786)[_0x0305('0x2a')](_0x396c03);};}exports[_0x0305('0x2b')]=function(_0x58d68f,_0x4d2849){var _0x157c63={},_0x536bd2={},_0x5b1c99={'count':0x0,'rows':[]};var _0x4cddd7=_[_0x0305('0x2c')](db[_0x0305('0x2d')][_0x0305('0x2e')],function(_0xe853c){return{'name':_0xe853c[_0x0305('0x2f')],'type':_0xe853c[_0x0305('0x30')]['key']};});_0x536bd2[_0x0305('0x31')]=_[_0x0305('0x2c')](_0x4cddd7,_0x0305('0x29'));_0x536bd2[_0x0305('0x32')]=_[_0x0305('0x33')](_0x58d68f[_0x0305('0x32')]);_0x536bd2[_0x0305('0x34')]=_['intersection'](_0x536bd2[_0x0305('0x31')],_0x536bd2[_0x0305('0x32')]);_0x157c63[_0x0305('0x35')]=_['intersection'](_0x536bd2[_0x0305('0x31')],qs[_0x0305('0x36')](_0x58d68f[_0x0305('0x32')]['fields']));_0x157c63['attributes']=_0x157c63['attributes']['length']?_0x157c63[_0x0305('0x35')]:_0x536bd2[_0x0305('0x31')];if(!_0x58d68f['query'][_0x0305('0x37')](_0x0305('0x38'))){_0x157c63[_0x0305('0x21')]=qs[_0x0305('0x21')](_0x58d68f[_0x0305('0x32')][_0x0305('0x21')]);_0x157c63[_0x0305('0x1e')]=qs['offset'](_0x58d68f['query'][_0x0305('0x1e')]);}_0x157c63['order']=qs[_0x0305('0x39')](_0x58d68f[_0x0305('0x32')][_0x0305('0x39')]);_0x157c63[_0x0305('0x3a')]=qs[_0x0305('0x34')](_[_0x0305('0x3b')](_0x58d68f[_0x0305('0x32')],_0x536bd2[_0x0305('0x34')]),_0x4cddd7);if(_0x58d68f[_0x0305('0x32')][_0x0305('0x3c')]){_0x157c63[_0x0305('0x3a')]=_[_0x0305('0x3d')](_0x157c63[_0x0305('0x3a')],{'$or':_[_0x0305('0x2c')](_0x4cddd7,function(_0x4fadfd){if(_0x4fadfd[_0x0305('0x30')]!==_0x0305('0x3e')){var _0x440a8b={};_0x440a8b[_0x4fadfd[_0x0305('0x29')]]={'$like':'%'+_0x58d68f[_0x0305('0x32')][_0x0305('0x3c')]+'%'};return _0x440a8b;}})});}_0x157c63=_[_0x0305('0x3d')]({},_0x157c63,_0x58d68f[_0x0305('0x3f')]);var _0x39bedf={'where':_0x157c63[_0x0305('0x3a')]};return db[_0x0305('0x2d')][_0x0305('0x20')](_0x39bedf)[_0x0305('0x27')](function(_0x24cf54){_0x5b1c99[_0x0305('0x20')]=_0x24cf54;if(_0x58d68f['query'][_0x0305('0x40')]){_0x157c63['include']=[{'all':!![]}];}return db[_0x0305('0x2d')][_0x0305('0x41')](_0x157c63);})['then'](function(_0x5df52b){_0x5b1c99[_0x0305('0x42')]=_0x5df52b;return _0x5b1c99;})[_0x0305('0x27')](respondWithFilteredResult(_0x4d2849,_0x157c63))['catch'](handleError(_0x4d2849,null));};exports['show']=function(_0x2c72c8,_0x1bbe1d){var _0xbd88aa={'raw':![],'where':{'id':_0x2c72c8[_0x0305('0x43')]['id']}},_0x341373={};_0x341373['model']=_[_0x0305('0x33')](db[_0x0305('0x2d')][_0x0305('0x2e')]);_0x341373[_0x0305('0x32')]=_[_0x0305('0x33')](_0x2c72c8['query']);_0x341373[_0x0305('0x34')]=_[_0x0305('0x44')](_0x341373['model'],_0x341373[_0x0305('0x32')]);_0xbd88aa['attributes']=_['intersection'](_0x341373[_0x0305('0x31')],qs[_0x0305('0x36')](_0x2c72c8[_0x0305('0x32')][_0x0305('0x36')]));_0xbd88aa[_0x0305('0x35')]=_0xbd88aa[_0x0305('0x35')][_0x0305('0x45')]?_0xbd88aa[_0x0305('0x35')]:_0x341373['model'];if(_0x2c72c8['query'][_0x0305('0x40')]){_0xbd88aa[_0x0305('0x46')]=[{'all':!![]}];}_0xbd88aa=_['merge']({},_0xbd88aa,_0x2c72c8[_0x0305('0x3f')]);return db[_0x0305('0x2d')][_0x0305('0x47')](_0xbd88aa)[_0x0305('0x27')](handleEntityNotFound(_0x1bbe1d,null))['then'](respondWithResult(_0x1bbe1d,null))[_0x0305('0x48')](handleError(_0x1bbe1d,null));};exports[_0x0305('0x49')]=function(_0x478ec1,_0x382cd3){return db['VtigerAccount'][_0x0305('0x49')](_0x478ec1[_0x0305('0x4a')],{})[_0x0305('0x27')](respondWithResult(_0x382cd3,0xc9))[_0x0305('0x48')](handleError(_0x382cd3,null));};exports[_0x0305('0x25')]=function(_0x55c301,_0x564d09){if(_0x55c301[_0x0305('0x4a')]['id']){delete _0x55c301[_0x0305('0x4a')]['id'];}return db[_0x0305('0x2d')][_0x0305('0x47')]({'where':{'id':_0x55c301[_0x0305('0x43')]['id']}})[_0x0305('0x27')](handleEntityNotFound(_0x564d09,null))['then'](saveUpdates(_0x55c301[_0x0305('0x4a')],null))['then'](respondWithResult(_0x564d09,null))[_0x0305('0x48')](handleError(_0x564d09,null));};exports[_0x0305('0x26')]=function(_0x2b8989,_0x1f4ee6){return db[_0x0305('0x2d')]['find']({'where':{'id':_0x2b8989['params']['id']}})[_0x0305('0x27')](handleEntityNotFound(_0x1f4ee6,null))[_0x0305('0x27')](removeEntity(_0x1f4ee6,null))[_0x0305('0x48')](handleError(_0x1f4ee6,null));};exports['getConfigurations']=function(_0x2f3456,_0x2f2cef,_0xafbc77){var _0x2db627={};var _0x24fdf8={};var _0x8d1683;var _0xf20d24;return db[_0x0305('0x2d')][_0x0305('0x4b')]({'where':{'id':_0x2f3456[_0x0305('0x43')]['id']}})['then'](handleEntityNotFound(_0x2f2cef,null))[_0x0305('0x27')](function(_0x568fca){if(_0x568fca){_0x8d1683=_0x568fca;_0x24fdf8[_0x0305('0x31')]=_['keys'](db[_0x0305('0x4c')]['rawAttributes']);_0x24fdf8[_0x0305('0x32')]=_['keys'](_0x2f3456['query']);_0x24fdf8['filters']=_['intersection'](_0x24fdf8[_0x0305('0x31')],_0x24fdf8[_0x0305('0x32')]);_0x2db627['attributes']=_[_0x0305('0x44')](_0x24fdf8[_0x0305('0x31')],qs[_0x0305('0x36')](_0x2f3456[_0x0305('0x32')][_0x0305('0x36')]));_0x2db627[_0x0305('0x35')]=_0x2db627[_0x0305('0x35')][_0x0305('0x45')]?_0x2db627[_0x0305('0x35')]:_0x24fdf8[_0x0305('0x31')];_0x2db627[_0x0305('0x4d')]=qs[_0x0305('0x39')](_0x2f3456[_0x0305('0x32')]['sort']);_0x2db627['where']=qs[_0x0305('0x34')](_['pick'](_0x2f3456['query'],_0x24fdf8[_0x0305('0x34')]));if(_0x2f3456[_0x0305('0x32')][_0x0305('0x3c')]){_0x2db627[_0x0305('0x3a')]=_['merge'](_0x2db627[_0x0305('0x3a')],{'$or':_[_0x0305('0x2c')](_0x2db627['attributes'],function(_0x4079bc){var _0x1edc98={};_0x1edc98[_0x4079bc]={'$like':'%'+_0x2f3456['query'][_0x0305('0x3c')]+'%'};return _0x1edc98;})});}_0x2db627=_[_0x0305('0x3d')]({},_0x2db627,_0x2f3456[_0x0305('0x3f')]);return _0x8d1683['getConfigurations'](_0x2db627);}})[_0x0305('0x27')](function(_0x5a71ff){if(_0x5a71ff){_0xf20d24=_0x5a71ff[_0x0305('0x45')];if(!_0x2f3456['query']['hasOwnProperty'](_0x0305('0x38'))){_0x2db627['limit']=qs[_0x0305('0x21')](_0x2f3456['query']['limit']);_0x2db627[_0x0305('0x1e')]=qs[_0x0305('0x1e')](_0x2f3456[_0x0305('0x32')][_0x0305('0x1e')]);}return _0x8d1683['getConfigurations'](_0x2db627);}})['then'](function(_0x515c8e){if(_0x515c8e){return _0x515c8e?{'count':_0xf20d24,'rows':_0x515c8e}:null;}})[_0x0305('0x27')](respondWithResult(_0x2f2cef,null))[_0x0305('0x48')](handleError(_0x2f2cef,null));};exports['addConfiguration']=function(_0x242e88,_0x15841d,_0x18a0d2){if(_0x242e88[_0x0305('0x4a')]['id']){delete _0x242e88['body']['id'];}return db[_0x0305('0x2d')]['findOne']({'where':{'id':_0x242e88['params']['id']}})['then'](handleEntityNotFound(_0x15841d,null))[_0x0305('0x27')](function(_0x5092ee){if(_0x5092ee){_0x242e88[_0x0305('0x4a')][_0x0305('0x4e')]=_0x5092ee['id'];_0x242e88[_0x0305('0x4a')]['Subjects']=integrations['getSubjects'](_0x242e88[_0x0305('0x4a')]['channel'],_0x242e88[_0x0305('0x4a')][_0x0305('0x30')]);_0x242e88[_0x0305('0x4a')][_0x0305('0x4f')]=integrations['getDescriptions'](_0x242e88['body'][_0x0305('0x50')],_0x242e88[_0x0305('0x4a')][_0x0305('0x30')]);return db[_0x0305('0x4c')][_0x0305('0x49')](_0x242e88[_0x0305('0x4a')],{'include':[{'model':db['VtigerField'],'as':'Subjects'},{'model':db['VtigerField'],'as':_0x0305('0x4f')}]});}return null;})[_0x0305('0x27')](respondWithResult(_0x15841d,null))[_0x0305('0x48')](handleError(_0x15841d,null));};var md5=require(_0x0305('0x51'));exports[_0x0305('0x52')]=function(_0x13a2ef,_0x288ff3,_0x5e5d19){var _0x4a82db=null;var _0x2834cb=null;var _0x1ae8ee=null;var _0x5c69a2=null;var _0x2f6150='';return db[_0x0305('0x2d')][_0x0305('0x4b')]({'where':{'id':_0x13a2ef[_0x0305('0x43')]['id']},'attributes':['id',_0x0305('0x29'),_0x0305('0x53'),_0x0305('0x54'),'moduleName',_0x0305('0x55'),_0x0305('0x56'),_0x0305('0x57')]})[_0x0305('0x27')](handleEntityNotFound(_0x288ff3,null))[_0x0305('0x27')](function(_0x5fd901){if(_0x5fd901){_0x4a82db=_0x5fd901[_0x0305('0x53')];_0x2834cb=_0x5fd901['accessKey'];_0x1ae8ee=_0x5fd901[_0x0305('0x58')];_0x2f6150=_0x5fd901['remoteUri'];var _0x27701c=_0x2f6150[_0x0305('0x59')](-0x1);if(_0x27701c==='/'){_0x2f6150=_0x2f6150['substring'](0x0,_0x2f6150[_0x0305('0x5a')](_0x27701c));}_0x5c69a2=util[_0x0305('0x5b')](_0x0305('0x5c'),_0x2f6150);var _0x22104a={'method':_0x0305('0x5d'),'uri':_0x5c69a2,'qs':{'operation':_0x0305('0x5e'),'username':_0x5fd901[_0x0305('0x53')]},'json':!![]};return rp(_0x22104a);}})[_0x0305('0x27')](function(_0x39f776){if(_0x39f776['success']){var _0x46b0={'method':_0x0305('0x5f'),'uri':_0x5c69a2,'form':{'operation':_0x0305('0x60'),'username':_0x4a82db,'accessKey':md5(_0x39f776[_0x0305('0x61')]['token']+_0x2834cb)},'json':!![]};return rp(_0x46b0);}})['then'](function(_0x41ed93){if(_0x41ed93[_0x0305('0x62')]){var _0x2cf78d={'method':_0x0305('0x5d'),'uri':_0x5c69a2,'qs':{'operation':'describe','username':_0x4a82db,'sessionName':_0x41ed93['result'][_0x0305('0x63')],'elementType':_0x1ae8ee},'json':!![]};return rp(_0x2cf78d);}})[_0x0305('0x27')](function(_0x32a65c){if(_0x32a65c[_0x0305('0x62')]){var _0x2c5238=['autogenerated',_0x0305('0x64'),'owner'];_[_0x0305('0x65')](_0x32a65c[_0x0305('0x61')][_0x0305('0x36')],function(_0x777f62){return _0x2c5238[_0x0305('0x66')](_0x777f62['type']['name']);});_[_0x0305('0x65')](_0x32a65c['result'][_0x0305('0x36')],function(_0x2b4ae3){return _0x2b4ae3[_0x0305('0x67')]===_0x0305('0x68');});return{'count':_0x32a65c[_0x0305('0x61')]['fields'][_0x0305('0x45')],'rows':_[_0x0305('0x2c')](_0x32a65c[_0x0305('0x61')][_0x0305('0x36')],function(_0x9f2841){return{'id':_0x9f2841[_0x0305('0x29')],'name':_0x9f2841[_0x0305('0x69')],'custom':_[_0x0305('0x6a')](_0x9f2841['name'],_0x0305('0x6b'))?!![]:![],'options':_0x9f2841[_0x0305('0x30')]['name']===_0x0305('0x6c')&&_0x9f2841['type'][_0x0305('0x6d')]['length']>0x0?_[_0x0305('0x2c')](_0x9f2841[_0x0305('0x30')][_0x0305('0x6d')],function(_0x41efd1){return{'name':_0x41efd1[_0x0305('0x69')],'value':_0x41efd1[_0x0305('0x6e')]};}):[]};})};}})[_0x0305('0x27')](respondWithResult(_0x288ff3,null))[_0x0305('0x48')](function(_0x485445){console[_0x0305('0x6f')](_0x0305('0x70')+_0x485445);var _0x385dff=_0x13a2ef[_0x0305('0x32')][_0x0305('0x71')]?0x1f4:_0x485445[_0x0305('0x72')]||0x1f4;logger[_0x0305('0x28')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x385dff,JSON[_0x0305('0x73')](_0x485445));delete _0x485445[_0x0305('0x29')];if(_0x385dff===0x191){_0x385dff=0x190;}_0x288ff3[_0x0305('0x1b')](_0x385dff)['send'](_0x13a2ef[_0x0305('0x32')][_0x0305('0x71')]?{'message':'Wrong\x20credentials','statusCode':_0x485445[_0x0305('0x72')]}:_0x485445);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 8a5fec4..0edecc6 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 _0x6d4a=['../../components/integrations/configuration','define','VtigerAccount','int_vtiger_accounts','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./intVtigerAccount.attributes'];(function(_0x2f34d5,_0x5cecda){var _0x5e79ea=function(_0x731662){while(--_0x731662){_0x2f34d5['push'](_0x2f34d5['shift']());}};_0x5e79ea(++_0x5cecda);}(_0x6d4a,0xc7));var _0xa6d4=function(_0x32026f,_0x183ee9){_0x32026f=_0x32026f-0x0;var _0x29153f=_0x6d4a[_0x32026f];return _0x29153f;};'use strict';var _=require(_0xa6d4('0x0'));var util=require(_0xa6d4('0x1'));var logger=require(_0xa6d4('0x2'))('api');var moment=require(_0xa6d4('0x3'));var BPromise=require(_0xa6d4('0x4'));var rp=require(_0xa6d4('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa6d4('0x6'));var config=require(_0xa6d4('0x7'));var attributes=require(_0xa6d4('0x8'));var integrations=require(_0xa6d4('0x9'));module['exports']=function(_0x13bec2,_0x5c4a2b){return _0x13bec2[_0xa6d4('0xa')](_0xa6d4('0xb'),attributes,{'tableName':_0xa6d4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeee2=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','int_vtiger_accounts','lodash','util'];(function(_0x49630b,_0x4f1736){var _0x3483fc=function(_0x1a4ce2){while(--_0x1a4ce2){_0x49630b['push'](_0x49630b['shift']());}};_0x3483fc(++_0x4f1736);}(_0xeee2,0x194));var _0x2eee=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xeee2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2eee('0x0'));var util=require(_0x2eee('0x1'));var logger=require(_0x2eee('0x2'))(_0x2eee('0x3'));var moment=require(_0x2eee('0x4'));var BPromise=require(_0x2eee('0x5'));var rp=require(_0x2eee('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2eee('0x7'));var config=require(_0x2eee('0x8'));var attributes=require(_0x2eee('0x9'));var integrations=require(_0x2eee('0xa'));module[_0x2eee('0xb')]=function(_0x55d15c,_0x180621){return _0x55d15c[_0x2eee('0xc')]('VtigerAccount',attributes,{'tableName':_0x2eee('0xd'),'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 933c28d..eb940ca 100644 --- a/server/api/intVtigerAccount/intVtigerAccount.rpc.js +++ b/server/api/intVtigerAccount/intVtigerAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe511=['find','attributes','ShowVtigerAccount','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetVtigerAccount','VtigerAccount','options','raw','where','include','map','model','then'];(function(_0x3360f3,_0x344f01){var _0x45e856=function(_0x588d0c){while(--_0x588d0c){_0x3360f3['push'](_0x3360f3['shift']());}};_0x45e856(++_0x344f01);}(_0xe511,0x16f));var _0x1e51=function(_0x5440e5,_0x56fac9){_0x5440e5=_0x5440e5-0x0;var _0x6c5beb=_0xe511[_0x5440e5];return _0x6c5beb;};'use strict';var _=require(_0x1e51('0x0'));var util=require(_0x1e51('0x1'));var moment=require('moment');var BPromise=require(_0x1e51('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1e51('0x3'));var db=require(_0x1e51('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1e51('0x5'))(_0x1e51('0x6'));var config=require(_0x1e51('0x7'));var jayson=require(_0x1e51('0x8'));var client=jayson['client'][_0x1e51('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x21ed6b,_0x5c4590,_0x4fa2ba){return new BPromise(function(_0x394ad8,_0x133021){return client['request'](_0x21ed6b,_0x4fa2ba)['then'](function(_0x658941){logger[_0x1e51('0xa')](_0x1e51('0xb'),_0x5c4590,_0x1e51('0xc'));logger[_0x1e51('0xd')](_0x1e51('0xe'),_0x5c4590,'request\x20sent',JSON[_0x1e51('0xf')](_0x658941));if(_0x658941[_0x1e51('0x10')]){if(_0x658941[_0x1e51('0x10')][_0x1e51('0x11')]===0x1f4){logger[_0x1e51('0x10')](_0x1e51('0xb'),_0x5c4590,_0x658941['error'][_0x1e51('0x12')]);return _0x133021(_0x658941[_0x1e51('0x10')][_0x1e51('0x12')]);}logger[_0x1e51('0x10')](_0x1e51('0xb'),_0x5c4590,_0x658941[_0x1e51('0x10')][_0x1e51('0x12')]);return _0x394ad8(_0x658941[_0x1e51('0x10')][_0x1e51('0x12')]);}else{logger[_0x1e51('0xa')]('VtigerAccount,\x20%s,\x20%s',_0x5c4590,_0x1e51('0xc'));_0x394ad8(_0x658941[_0x1e51('0x13')][_0x1e51('0x12')]);}})['catch'](function(_0xa3b410){logger['error']('VtigerAccount,\x20%s,\x20%s',_0x5c4590,_0xa3b410);_0x133021(_0xa3b410);});});}exports[_0x1e51('0x14')]=function(_0x27dcad){var _0x40ae4c=this;return new Promise(function(_0x4785a5,_0x4d1aae){return db[_0x1e51('0x15')]['findAll']({'raw':_0x27dcad[_0x1e51('0x16')]?_0x27dcad['options'][_0x1e51('0x17')]===undefined?!![]:![]:!![],'where':_0x27dcad[_0x1e51('0x16')]?_0x27dcad[_0x1e51('0x16')][_0x1e51('0x18')]||null:null,'attributes':_0x27dcad['options']?_0x27dcad['options']['attributes']||null:null,'limit':_0x27dcad['options']?_0x27dcad[_0x1e51('0x16')]['limit']||null:null,'include':_0x27dcad[_0x1e51('0x16')]?_0x27dcad[_0x1e51('0x16')][_0x1e51('0x19')]?_[_0x1e51('0x1a')](_0x27dcad[_0x1e51('0x16')][_0x1e51('0x19')],function(_0x270adf){return{'model':db[_0x270adf[_0x1e51('0x1b')]],'as':_0x270adf['as'],'attributes':_0x270adf['attributes'],'include':_0x270adf['include']?_[_0x1e51('0x1a')](_0x270adf[_0x1e51('0x19')],function(_0x2e42b1){return{'model':db[_0x2e42b1[_0x1e51('0x1b')]],'as':_0x2e42b1['as'],'attributes':_0x2e42b1['attributes'],'include':_0x2e42b1['include']?_['map'](_0x2e42b1[_0x1e51('0x19')],function(_0x2a1561){return{'model':db[_0x2a1561[_0x1e51('0x1b')]],'as':_0x2a1561['as'],'attributes':_0x2a1561['attributes']};}):[]};}):[]};}):[]:[]})[_0x1e51('0x1c')](function(_0x49c507){logger['info'](_0x1e51('0x14'),_0x27dcad);logger['debug'](_0x1e51('0x14'),_0x27dcad,JSON[_0x1e51('0xf')](_0x49c507));_0x4785a5(_0x49c507);})['catch'](function(_0x3e6ef2){logger[_0x1e51('0x10')](_0x1e51('0x14'),_0x3e6ef2[_0x1e51('0x12')],_0x27dcad);_0x4d1aae(_0x40ae4c['error'](0x1f4,_0x3e6ef2['message']));});});};exports['ShowVtigerAccount']=function(_0x20eb9b){var _0x288b50=this;return new Promise(function(_0x1ba84a,_0x36dabe){return db[_0x1e51('0x15')][_0x1e51('0x1d')]({'raw':_0x20eb9b[_0x1e51('0x16')]?_0x20eb9b[_0x1e51('0x16')][_0x1e51('0x17')]===undefined?!![]:![]:!![],'where':_0x20eb9b[_0x1e51('0x16')]?_0x20eb9b[_0x1e51('0x16')]['where']||null:null,'attributes':_0x20eb9b[_0x1e51('0x16')]?_0x20eb9b[_0x1e51('0x16')][_0x1e51('0x1e')]||null:null,'include':_0x20eb9b[_0x1e51('0x16')]?_0x20eb9b[_0x1e51('0x16')]['include']?_[_0x1e51('0x1a')](_0x20eb9b['options'][_0x1e51('0x19')],function(_0x3fb57e){return{'model':db[_0x3fb57e[_0x1e51('0x1b')]],'as':_0x3fb57e['as'],'attributes':_0x3fb57e['attributes'],'include':_0x3fb57e[_0x1e51('0x19')]?_['map'](_0x3fb57e[_0x1e51('0x19')],function(_0x4e0187){return{'model':db[_0x4e0187['model']],'as':_0x4e0187['as'],'attributes':_0x4e0187[_0x1e51('0x1e')],'include':_0x4e0187[_0x1e51('0x19')]?_[_0x1e51('0x1a')](_0x4e0187['include'],function(_0x42ac30){return{'model':db[_0x42ac30['model']],'as':_0x42ac30['as'],'attributes':_0x42ac30[_0x1e51('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x1e51('0x1c')](function(_0x5760ba){logger[_0x1e51('0xa')](_0x1e51('0x1f'),_0x20eb9b);logger[_0x1e51('0xd')](_0x1e51('0x1f'),_0x20eb9b,JSON[_0x1e51('0xf')](_0x5760ba));_0x1ba84a(_0x5760ba);})[_0x1e51('0x20')](function(_0x5c57a6){logger['error'](_0x1e51('0x1f'),_0x5c57a6['message'],_0x20eb9b);_0x36dabe(_0x288b50[_0x1e51('0x10')](0x1f4,_0x5c57a6[_0x1e51('0x12')]));});});}; \ No newline at end of file +var _0x4483=['client','http','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetVtigerAccount','options','raw','where','attributes','include','model','find','map','ShowVtigerAccount','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x26453c,_0x4019ed){var _0x458c0f=function(_0x1cdddf){while(--_0x1cdddf){_0x26453c['push'](_0x26453c['shift']());}};_0x458c0f(++_0x4019ed);}(_0x4483,0x1a3));var _0x3448=function(_0xa65c5a,_0x1b146d){_0xa65c5a=_0xa65c5a-0x0;var _0x2dfe3e=_0x4483[_0xa65c5a];return _0x2dfe3e;};'use strict';var _=require(_0x3448('0x0'));var util=require(_0x3448('0x1'));var moment=require(_0x3448('0x2'));var BPromise=require('bluebird');var rs=require(_0x3448('0x3'));var fs=require('fs');var Redis=require(_0x3448('0x4'));var db=require(_0x3448('0x5'))['db'];var utils=require(_0x3448('0x6'));var logger=require(_0x3448('0x7'))('rpc');var config=require(_0x3448('0x8'));var jayson=require(_0x3448('0x9'));var client=jayson[_0x3448('0xa')][_0x3448('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1bb7e5,_0x2caa81,_0x3cc81d){return new BPromise(function(_0x34b926,_0x5923ee){return client['request'](_0x1bb7e5,_0x3cc81d)[_0x3448('0xc')](function(_0x25c152){logger[_0x3448('0xd')](_0x3448('0xe'),_0x2caa81,_0x3448('0xf'));logger[_0x3448('0x10')](_0x3448('0x11'),_0x2caa81,_0x3448('0xf'),JSON[_0x3448('0x12')](_0x25c152));if(_0x25c152[_0x3448('0x13')]){if(_0x25c152[_0x3448('0x13')]['code']===0x1f4){logger['error'](_0x3448('0xe'),_0x2caa81,_0x25c152[_0x3448('0x13')]['message']);return _0x5923ee(_0x25c152[_0x3448('0x13')][_0x3448('0x14')]);}logger[_0x3448('0x13')]('VtigerAccount,\x20%s,\x20%s',_0x2caa81,_0x25c152[_0x3448('0x13')][_0x3448('0x14')]);return _0x34b926(_0x25c152['error'][_0x3448('0x14')]);}else{logger[_0x3448('0xd')](_0x3448('0xe'),_0x2caa81,'request\x20sent');_0x34b926(_0x25c152[_0x3448('0x15')][_0x3448('0x14')]);}})[_0x3448('0x16')](function(_0x30f8dd){logger[_0x3448('0x13')](_0x3448('0xe'),_0x2caa81,_0x30f8dd);_0x5923ee(_0x30f8dd);});});}exports[_0x3448('0x17')]=function(_0x425514){var _0x4a348c=this;return new Promise(function(_0x1658cd,_0x5b410d){return db['VtigerAccount']['findAll']({'raw':_0x425514[_0x3448('0x18')]?_0x425514[_0x3448('0x18')][_0x3448('0x19')]===undefined?!![]:![]:!![],'where':_0x425514['options']?_0x425514[_0x3448('0x18')][_0x3448('0x1a')]||null:null,'attributes':_0x425514[_0x3448('0x18')]?_0x425514[_0x3448('0x18')][_0x3448('0x1b')]||null:null,'limit':_0x425514[_0x3448('0x18')]?_0x425514['options']['limit']||null:null,'include':_0x425514['options']?_0x425514[_0x3448('0x18')][_0x3448('0x1c')]?_['map'](_0x425514['options'][_0x3448('0x1c')],function(_0x4371d6){return{'model':db[_0x4371d6[_0x3448('0x1d')]],'as':_0x4371d6['as'],'attributes':_0x4371d6[_0x3448('0x1b')],'include':_0x4371d6[_0x3448('0x1c')]?_['map'](_0x4371d6[_0x3448('0x1c')],function(_0x1b5c49){return{'model':db[_0x1b5c49[_0x3448('0x1d')]],'as':_0x1b5c49['as'],'attributes':_0x1b5c49[_0x3448('0x1b')],'include':_0x1b5c49[_0x3448('0x1c')]?_['map'](_0x1b5c49[_0x3448('0x1c')],function(_0x393081){return{'model':db[_0x393081['model']],'as':_0x393081['as'],'attributes':_0x393081[_0x3448('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x3448('0xc')](function(_0x310912){logger[_0x3448('0xd')](_0x3448('0x17'),_0x425514);logger[_0x3448('0x10')](_0x3448('0x17'),_0x425514,JSON[_0x3448('0x12')](_0x310912));_0x1658cd(_0x310912);})['catch'](function(_0x3307dc){logger[_0x3448('0x13')](_0x3448('0x17'),_0x3307dc['message'],_0x425514);_0x5b410d(_0x4a348c[_0x3448('0x13')](0x1f4,_0x3307dc['message']));});});};exports['ShowVtigerAccount']=function(_0x493898){var _0x52fb48=this;return new Promise(function(_0xff6513,_0x5e96f0){return db['VtigerAccount'][_0x3448('0x1e')]({'raw':_0x493898[_0x3448('0x18')]?_0x493898[_0x3448('0x18')][_0x3448('0x19')]===undefined?!![]:![]:!![],'where':_0x493898['options']?_0x493898[_0x3448('0x18')][_0x3448('0x1a')]||null:null,'attributes':_0x493898[_0x3448('0x18')]?_0x493898['options'][_0x3448('0x1b')]||null:null,'include':_0x493898[_0x3448('0x18')]?_0x493898['options']['include']?_[_0x3448('0x1f')](_0x493898[_0x3448('0x18')][_0x3448('0x1c')],function(_0x37a0ee){return{'model':db[_0x37a0ee['model']],'as':_0x37a0ee['as'],'attributes':_0x37a0ee[_0x3448('0x1b')],'include':_0x37a0ee[_0x3448('0x1c')]?_[_0x3448('0x1f')](_0x37a0ee[_0x3448('0x1c')],function(_0x5ebab6){return{'model':db[_0x5ebab6[_0x3448('0x1d')]],'as':_0x5ebab6['as'],'attributes':_0x5ebab6[_0x3448('0x1b')],'include':_0x5ebab6['include']?_[_0x3448('0x1f')](_0x5ebab6[_0x3448('0x1c')],function(_0x89d6ae){return{'model':db[_0x89d6ae[_0x3448('0x1d')]],'as':_0x89d6ae['as'],'attributes':_0x89d6ae[_0x3448('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x3448('0xc')](function(_0x32592f){logger[_0x3448('0xd')](_0x3448('0x20'),_0x493898);logger['debug']('ShowVtigerAccount',_0x493898,JSON[_0x3448('0x12')](_0x32592f));_0xff6513(_0x32592f);})['catch'](function(_0x22bb31){logger[_0x3448('0x13')](_0x3448('0x20'),_0x22bb31[_0x3448('0x14')],_0x493898);_0x5e96f0(_0x52fb48['error'](0x1f4,_0x22bb31[_0x3448('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 99f85c8..01203cf 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 _0xed9f=['destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','isAuthenticated','index','get','/:id','show','/:id/fields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','put','update','delete'];(function(_0x1ee1ff,_0x2e7079){var _0x106003=function(_0x1347bc){while(--_0x1347bc){_0x1ee1ff['push'](_0x1ee1ff['shift']());}};_0x106003(++_0x2e7079);}(_0xed9f,0x191));var _0xfed9=function(_0x5c4178,_0x11471c){_0x5c4178=_0x5c4178-0x0;var _0x384e71=_0xed9f[_0x5c4178];return _0x384e71;};'use strict';var multer=require(_0xfed9('0x0'));var util=require('util');var path=require(_0xfed9('0x1'));var timeout=require(_0xfed9('0x2'));var express=require(_0xfed9('0x3'));var router=express[_0xfed9('0x4')]();var fs_extra=require(_0xfed9('0x5'));var auth=require(_0xfed9('0x6'));var interaction=require(_0xfed9('0x7'));var config=require(_0xfed9('0x8'));var controller=require(_0xfed9('0x9'));router['get']('/',auth[_0xfed9('0xa')](),controller[_0xfed9('0xb')]);router[_0xfed9('0xc')](_0xfed9('0xd'),auth[_0xfed9('0xa')](),controller[_0xfed9('0xe')]);router['get'](_0xfed9('0xf'),auth['isAuthenticated'](),controller['getFields']);router[_0xfed9('0xc')](_0xfed9('0x10'),auth[_0xfed9('0xa')](),controller['getSubjects']);router[_0xfed9('0xc')](_0xfed9('0x11'),auth[_0xfed9('0xa')](),controller[_0xfed9('0x12')]);router[_0xfed9('0x13')]('/',auth[_0xfed9('0xa')](),controller[_0xfed9('0x14')]);router[_0xfed9('0x15')]('/:id',auth[_0xfed9('0xa')](),controller[_0xfed9('0x16')]);router[_0xfed9('0x17')]('/:id',auth['isAuthenticated'](),controller[_0xfed9('0x18')]);module['exports']=router; \ No newline at end of file +var _0x1df8=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','/:id','show','/:id/subjects','getSubjects','post','create','update','delete','destroy','multer','path','connect-timeout'];(function(_0x5426e2,_0x5f2968){var _0x920dc=function(_0x3a87c6){while(--_0x3a87c6){_0x5426e2['push'](_0x5426e2['shift']());}};_0x920dc(++_0x5f2968);}(_0x1df8,0x115));var _0x81df=function(_0x451db8,_0x36a10c){_0x451db8=_0x451db8-0x0;var _0x31475b=_0x1df8[_0x451db8];return _0x31475b;};'use strict';var multer=require(_0x81df('0x0'));var util=require('util');var path=require(_0x81df('0x1'));var timeout=require(_0x81df('0x2'));var express=require('express');var router=express[_0x81df('0x3')]();var fs_extra=require(_0x81df('0x4'));var auth=require(_0x81df('0x5'));var interaction=require(_0x81df('0x6'));var config=require(_0x81df('0x7'));var controller=require(_0x81df('0x8'));router[_0x81df('0x9')]('/',auth[_0x81df('0xa')](),controller['index']);router['get'](_0x81df('0xb'),auth[_0x81df('0xa')](),controller[_0x81df('0xc')]);router[_0x81df('0x9')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0x81df('0x9')](_0x81df('0xd'),auth[_0x81df('0xa')](),controller[_0x81df('0xe')]);router['get']('/:id/descriptions',auth[_0x81df('0xa')](),controller['getDescriptions']);router[_0x81df('0xf')]('/',auth['isAuthenticated'](),controller[_0x81df('0x10')]);router['put'](_0x81df('0xb'),auth[_0x81df('0xa')](),controller[_0x81df('0x11')]);router[_0x81df('0x12')](_0x81df('0xb'),auth[_0x81df('0xa')](),controller[_0x81df('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 866dba2..e834e32 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 _0x11c9=['sequelize','exports','STRING'];(function(_0xe1ae98,_0x20d529){var _0x2e0255=function(_0x39f7d7){while(--_0x39f7d7){_0xe1ae98['push'](_0xe1ae98['shift']());}};_0x2e0255(++_0x20d529);}(_0x11c9,0x1e3));var _0x911c=function(_0x5317b5,_0x4dfd6e){_0x5317b5=_0x5317b5-0x0;var _0x3b7ce2=_0x11c9[_0x5317b5];return _0x3b7ce2;};'use strict';var Sequelize=require(_0x911c('0x0'));module[_0x911c('0x1')]={'name':{'type':Sequelize[_0x911c('0x2')]},'description':{'type':Sequelize[_0x911c('0x2')]}}; \ No newline at end of file +var _0xb94d=['exports','STRING','sequelize'];(function(_0x118686,_0x51ac34){var _0xe53bf6=function(_0x24cc29){while(--_0x24cc29){_0x118686['push'](_0x118686['shift']());}};_0xe53bf6(++_0x51ac34);}(_0xb94d,0x80));var _0xdb94=function(_0x41cfd4,_0x1ed2cc){_0x41cfd4=_0x41cfd4-0x0;var _0x190f48=_0xb94d[_0x41cfd4];return _0x190f48;};'use strict';var Sequelize=require(_0xdb94('0x0'));module[_0xdb94('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xdb94('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 6542087..35f9810 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 _0xc474=['moment','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','update','then','destroy','name','index','map','VtigerConfiguration','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','merge','VIRTUAL','filter','options','include','rows','catch','show','keys','rawAttributes','create','body','find','params','getFields','findOne','VtigerField','order','getSubjects','getDescriptions','eml-format','rimraf','request-promise'];(function(_0x2c27ed,_0x5c50f0){var _0x597bd1=function(_0xd6db18){while(--_0xd6db18){_0x2c27ed['push'](_0x2c27ed['shift']());}};_0x597bd1(++_0x5c50f0);}(_0xc474,0x174));var _0x4c47=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0xc474[_0x5f3f88];return _0xd08119;};'use strict';var emlformat=require(_0x4c47('0x0'));var rimraf=require(_0x4c47('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4c47('0x2'));var moment=require(_0x4c47('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4c47('0x4'));var path=require(_0x4c47('0x5'));var sox=require('sox');var csv=require(_0x4c47('0x6'));var ejs=require(_0x4c47('0x7'));var fs=require('fs');var fs_extra=require(_0x4c47('0x8'));var _=require(_0x4c47('0x9'));var squel=require(_0x4c47('0xa'));var crypto=require(_0x4c47('0xb'));var jsforce=require(_0x4c47('0xc'));var deskjs=require(_0x4c47('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4c47('0xe'));var Redis=require(_0x4c47('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x4c47('0x10'));var as=require(_0x4c47('0x11'));var hardwareService=require(_0x4c47('0x12'));var logger=require('../../config/logger')(_0x4c47('0x13'));var utils=require(_0x4c47('0x14'));var config=require(_0x4c47('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5de2a3,_0x59a1e0){_0x59a1e0=_0x59a1e0||0xcc;return function(_0x2a33fa){if(_0x2a33fa){return _0x5de2a3[_0x4c47('0x16')](_0x59a1e0);}return _0x5de2a3[_0x4c47('0x17')](_0x59a1e0)[_0x4c47('0x18')]();};}function respondWithResult(_0x4a83ac,_0x18e897){_0x18e897=_0x18e897||0xc8;return function(_0xfe8d43){if(_0xfe8d43){return _0x4a83ac[_0x4c47('0x17')](_0x18e897)[_0x4c47('0x19')](_0xfe8d43);}};}function respondWithFilteredResult(_0x21e834,_0x416851){return function(_0x50fbac){if(_0x50fbac){var _0x35b949=typeof _0x416851[_0x4c47('0x1a')]===_0x4c47('0x1b')&&typeof _0x416851['limit']===_0x4c47('0x1b');var _0x4daafb=_0x50fbac[_0x4c47('0x1c')];var _0x92aea2=_0x35b949?0x0:_0x416851[_0x4c47('0x1a')];var _0x48047f=_0x35b949?_0x50fbac[_0x4c47('0x1c')]:_0x416851[_0x4c47('0x1a')]+_0x416851['limit'];var _0x36dd4e;if(_0x48047f>=_0x4daafb){_0x48047f=_0x4daafb;_0x36dd4e=0xc8;}else{_0x36dd4e=0xce;}_0x21e834[_0x4c47('0x17')](_0x36dd4e);return _0x21e834[_0x4c47('0x1d')](_0x4c47('0x1e'),_0x92aea2+'-'+_0x48047f+'/'+_0x4daafb)[_0x4c47('0x19')](_0x50fbac);}return null;};}function patchUpdates(_0x342453){return function(_0x26315f){try{jsonpatch[_0x4c47('0x1f')](_0x26315f,_0x342453,!![]);}catch(_0x3dd6b1){return BPromise['reject'](_0x3dd6b1);}return _0x26315f['save']();};}function saveUpdates(_0x5a7f13,_0x1c162d){return function(_0x2884b4){if(_0x2884b4){return _0x2884b4[_0x4c47('0x20')](_0x5a7f13)[_0x4c47('0x21')](function(_0x3bcec2){return _0x3bcec2;});}return null;};}function removeEntity(_0xd238e8,_0x331614){return function(_0x3b6db7){if(_0x3b6db7){return _0x3b6db7[_0x4c47('0x22')]()['then'](function(){_0xd238e8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x414977,_0x20e450){return function(_0x1cf25a){if(!_0x1cf25a){_0x414977[_0x4c47('0x16')](0x194);}return _0x1cf25a;};}function handleError(_0x1c5a24,_0x4d2d99){_0x4d2d99=_0x4d2d99||0x1f4;return function(_0x3449be){logger['error'](_0x3449be['stack']);if(_0x3449be[_0x4c47('0x23')]){delete _0x3449be[_0x4c47('0x23')];}_0x1c5a24['status'](_0x4d2d99)['send'](_0x3449be);};}exports[_0x4c47('0x24')]=function(_0x18f71a,_0xac33c5){var _0x3ca24a={},_0x207692={},_0x1904f8={'count':0x0,'rows':[]};var _0x399f54=_[_0x4c47('0x25')](db[_0x4c47('0x26')]['rawAttributes'],function(_0x2bb19c){return{'name':_0x2bb19c[_0x4c47('0x27')],'type':_0x2bb19c[_0x4c47('0x28')][_0x4c47('0x29')]};});_0x207692['model']=_[_0x4c47('0x25')](_0x399f54,'name');_0x207692['query']=_['keys'](_0x18f71a[_0x4c47('0x2a')]);_0x207692[_0x4c47('0x2b')]=_[_0x4c47('0x2c')](_0x207692[_0x4c47('0x2d')],_0x207692['query']);_0x3ca24a[_0x4c47('0x2e')]=_[_0x4c47('0x2c')](_0x207692[_0x4c47('0x2d')],qs['fields'](_0x18f71a[_0x4c47('0x2a')][_0x4c47('0x2f')]));_0x3ca24a[_0x4c47('0x2e')]=_0x3ca24a[_0x4c47('0x2e')][_0x4c47('0x30')]?_0x3ca24a[_0x4c47('0x2e')]:_0x207692[_0x4c47('0x2d')];if(!_0x18f71a[_0x4c47('0x2a')][_0x4c47('0x31')](_0x4c47('0x32'))){_0x3ca24a[_0x4c47('0x33')]=qs[_0x4c47('0x33')](_0x18f71a[_0x4c47('0x2a')][_0x4c47('0x33')]);_0x3ca24a[_0x4c47('0x1a')]=qs['offset'](_0x18f71a[_0x4c47('0x2a')][_0x4c47('0x1a')]);}_0x3ca24a['order']=qs[_0x4c47('0x34')](_0x18f71a[_0x4c47('0x2a')]['sort']);_0x3ca24a[_0x4c47('0x35')]=qs['filters'](_[_0x4c47('0x36')](_0x18f71a[_0x4c47('0x2a')],_0x207692['filters']),_0x399f54);if(_0x18f71a[_0x4c47('0x2a')]['filter']){_0x3ca24a[_0x4c47('0x35')]=_[_0x4c47('0x37')](_0x3ca24a[_0x4c47('0x35')],{'$or':_[_0x4c47('0x25')](_0x399f54,function(_0x46d6ce){if(_0x46d6ce[_0x4c47('0x28')]!==_0x4c47('0x38')){var _0x232d33={};_0x232d33[_0x46d6ce['name']]={'$like':'%'+_0x18f71a[_0x4c47('0x2a')][_0x4c47('0x39')]+'%'};return _0x232d33;}})});}_0x3ca24a=_[_0x4c47('0x37')]({},_0x3ca24a,_0x18f71a[_0x4c47('0x3a')]);var _0x8f654a={'where':_0x3ca24a[_0x4c47('0x35')]};return db['VtigerConfiguration']['count'](_0x8f654a)['then'](function(_0xa6d44e){_0x1904f8[_0x4c47('0x1c')]=_0xa6d44e;if(_0x18f71a[_0x4c47('0x2a')]['includeAll']){_0x3ca24a[_0x4c47('0x3b')]=[{'all':!![]}];}return db[_0x4c47('0x26')]['findAll'](_0x3ca24a);})[_0x4c47('0x21')](function(_0x40f2e1){_0x1904f8[_0x4c47('0x3c')]=_0x40f2e1;return _0x1904f8;})[_0x4c47('0x21')](respondWithFilteredResult(_0xac33c5,_0x3ca24a))[_0x4c47('0x3d')](handleError(_0xac33c5,null));};exports[_0x4c47('0x3e')]=function(_0x2a3459,_0x4329d9){var _0x57ab00={'raw':![],'where':{'id':_0x2a3459['params']['id']}},_0x38c81={};_0x38c81['model']=_[_0x4c47('0x3f')](db[_0x4c47('0x26')][_0x4c47('0x40')]);_0x38c81[_0x4c47('0x2a')]=_[_0x4c47('0x3f')](_0x2a3459[_0x4c47('0x2a')]);_0x38c81['filters']=_[_0x4c47('0x2c')](_0x38c81['model'],_0x38c81[_0x4c47('0x2a')]);_0x57ab00[_0x4c47('0x2e')]=_[_0x4c47('0x2c')](_0x38c81[_0x4c47('0x2d')],qs['fields'](_0x2a3459[_0x4c47('0x2a')][_0x4c47('0x2f')]));_0x57ab00[_0x4c47('0x2e')]=_0x57ab00['attributes'][_0x4c47('0x30')]?_0x57ab00[_0x4c47('0x2e')]:_0x38c81[_0x4c47('0x2d')];if(_0x2a3459[_0x4c47('0x2a')]['includeAll']){_0x57ab00[_0x4c47('0x3b')]=[{'all':!![]}];}_0x57ab00=_['merge']({},_0x57ab00,_0x2a3459[_0x4c47('0x3a')]);return db[_0x4c47('0x26')]['find'](_0x57ab00)[_0x4c47('0x21')](handleEntityNotFound(_0x4329d9,null))[_0x4c47('0x21')](respondWithResult(_0x4329d9,null))[_0x4c47('0x3d')](handleError(_0x4329d9,null));};exports[_0x4c47('0x41')]=function(_0x49f28b,_0x4d6fbb){return db[_0x4c47('0x26')][_0x4c47('0x41')](_0x49f28b[_0x4c47('0x42')],{})['then'](respondWithResult(_0x4d6fbb,0xc9))['catch'](handleError(_0x4d6fbb,null));};exports[_0x4c47('0x20')]=function(_0x5a9004,_0x5124c3){if(_0x5a9004['body']['id']){delete _0x5a9004[_0x4c47('0x42')]['id'];}return db[_0x4c47('0x26')]['find']({'where':{'id':_0x5a9004['params']['id']}})[_0x4c47('0x21')](handleEntityNotFound(_0x5124c3,null))[_0x4c47('0x21')](saveUpdates(_0x5a9004[_0x4c47('0x42')],null))[_0x4c47('0x21')](respondWithResult(_0x5124c3,null))[_0x4c47('0x3d')](handleError(_0x5124c3,null));};exports[_0x4c47('0x22')]=function(_0xceb97d,_0x49bc97){return db[_0x4c47('0x26')][_0x4c47('0x43')]({'where':{'id':_0xceb97d[_0x4c47('0x44')]['id']}})[_0x4c47('0x21')](handleEntityNotFound(_0x49bc97,null))[_0x4c47('0x21')](removeEntity(_0x49bc97,null))[_0x4c47('0x3d')](handleError(_0x49bc97,null));};exports[_0x4c47('0x45')]=function(_0x1059b8,_0x35756c,_0x3c666f){var _0x3fc29={};var _0x52de18={};var _0x25752c;var _0x4e1ad3;return db['VtigerConfiguration'][_0x4c47('0x46')]({'where':{'id':_0x1059b8['params']['id']}})[_0x4c47('0x21')](handleEntityNotFound(_0x35756c,null))[_0x4c47('0x21')](function(_0xf46838){if(_0xf46838){_0x25752c=_0xf46838;_0x52de18[_0x4c47('0x2d')]=_[_0x4c47('0x3f')](db[_0x4c47('0x47')][_0x4c47('0x40')]);_0x52de18[_0x4c47('0x2a')]=_[_0x4c47('0x3f')](_0x1059b8['query']);_0x52de18[_0x4c47('0x2b')]=_[_0x4c47('0x2c')](_0x52de18[_0x4c47('0x2d')],_0x52de18[_0x4c47('0x2a')]);_0x3fc29[_0x4c47('0x2e')]=_[_0x4c47('0x2c')](_0x52de18[_0x4c47('0x2d')],qs[_0x4c47('0x2f')](_0x1059b8[_0x4c47('0x2a')][_0x4c47('0x2f')]));_0x3fc29[_0x4c47('0x2e')]=_0x3fc29[_0x4c47('0x2e')][_0x4c47('0x30')]?_0x3fc29[_0x4c47('0x2e')]:_0x52de18[_0x4c47('0x2d')];_0x3fc29[_0x4c47('0x48')]=qs[_0x4c47('0x34')](_0x1059b8[_0x4c47('0x2a')][_0x4c47('0x34')]);_0x3fc29['where']=qs[_0x4c47('0x2b')](_[_0x4c47('0x36')](_0x1059b8[_0x4c47('0x2a')],_0x52de18[_0x4c47('0x2b')]));if(_0x1059b8[_0x4c47('0x2a')][_0x4c47('0x39')]){_0x3fc29['where']=_['merge'](_0x3fc29['where'],{'$or':_[_0x4c47('0x25')](_0x3fc29[_0x4c47('0x2e')],function(_0x5b26d5){var _0x506a28={};_0x506a28[_0x5b26d5]={'$like':'%'+_0x1059b8[_0x4c47('0x2a')][_0x4c47('0x39')]+'%'};return _0x506a28;})});}_0x3fc29=_['merge']({},_0x3fc29,_0x1059b8[_0x4c47('0x3a')]);return _0x25752c[_0x4c47('0x45')](_0x3fc29);}})['then'](function(_0x32be2f){if(_0x32be2f){_0x4e1ad3=_0x32be2f[_0x4c47('0x30')];if(!_0x1059b8[_0x4c47('0x2a')][_0x4c47('0x31')](_0x4c47('0x32'))){_0x3fc29[_0x4c47('0x33')]=qs['limit'](_0x1059b8[_0x4c47('0x2a')][_0x4c47('0x33')]);_0x3fc29[_0x4c47('0x1a')]=qs[_0x4c47('0x1a')](_0x1059b8[_0x4c47('0x2a')][_0x4c47('0x1a')]);}return _0x25752c[_0x4c47('0x45')](_0x3fc29);}})[_0x4c47('0x21')](function(_0x4de003){if(_0x4de003){return _0x4de003?{'count':_0x4e1ad3,'rows':_0x4de003}:null;}})['then'](respondWithResult(_0x35756c,null))['catch'](handleError(_0x35756c,null));};exports[_0x4c47('0x49')]=function(_0x4ee57d,_0x36750b,_0x556bd5){var _0x5f53ff={};var _0xd8a93e={};var _0xfe806b;var _0x120844;return db[_0x4c47('0x26')][_0x4c47('0x46')]({'where':{'id':_0x4ee57d[_0x4c47('0x44')]['id']}})[_0x4c47('0x21')](handleEntityNotFound(_0x36750b,null))[_0x4c47('0x21')](function(_0x3d433a){if(_0x3d433a){_0xfe806b=_0x3d433a;_0xd8a93e['model']=_['keys'](db[_0x4c47('0x47')][_0x4c47('0x40')]);_0xd8a93e[_0x4c47('0x2a')]=_[_0x4c47('0x3f')](_0x4ee57d['query']);_0xd8a93e[_0x4c47('0x2b')]=_[_0x4c47('0x2c')](_0xd8a93e[_0x4c47('0x2d')],_0xd8a93e[_0x4c47('0x2a')]);_0x5f53ff[_0x4c47('0x2e')]=_[_0x4c47('0x2c')](_0xd8a93e[_0x4c47('0x2d')],qs[_0x4c47('0x2f')](_0x4ee57d[_0x4c47('0x2a')]['fields']));_0x5f53ff[_0x4c47('0x2e')]=_0x5f53ff[_0x4c47('0x2e')][_0x4c47('0x30')]?_0x5f53ff[_0x4c47('0x2e')]:_0xd8a93e[_0x4c47('0x2d')];_0x5f53ff['order']=qs[_0x4c47('0x34')](_0x4ee57d[_0x4c47('0x2a')][_0x4c47('0x34')]);_0x5f53ff['where']=qs[_0x4c47('0x2b')](_[_0x4c47('0x36')](_0x4ee57d[_0x4c47('0x2a')],_0xd8a93e['filters']));if(_0x4ee57d[_0x4c47('0x2a')][_0x4c47('0x39')]){_0x5f53ff[_0x4c47('0x35')]=_[_0x4c47('0x37')](_0x5f53ff[_0x4c47('0x35')],{'$or':_[_0x4c47('0x25')](_0x5f53ff[_0x4c47('0x2e')],function(_0x144baf){var _0x2a704={};_0x2a704[_0x144baf]={'$like':'%'+_0x4ee57d['query'][_0x4c47('0x39')]+'%'};return _0x2a704;})});}_0x5f53ff=_[_0x4c47('0x37')]({},_0x5f53ff,_0x4ee57d[_0x4c47('0x3a')]);return _0xfe806b[_0x4c47('0x49')](_0x5f53ff);}})[_0x4c47('0x21')](function(_0x47ee10){if(_0x47ee10){_0x120844=_0x47ee10['length'];if(!_0x4ee57d[_0x4c47('0x2a')]['hasOwnProperty'](_0x4c47('0x32'))){_0x5f53ff[_0x4c47('0x33')]=qs[_0x4c47('0x33')](_0x4ee57d[_0x4c47('0x2a')]['limit']);_0x5f53ff[_0x4c47('0x1a')]=qs[_0x4c47('0x1a')](_0x4ee57d[_0x4c47('0x2a')][_0x4c47('0x1a')]);}return _0xfe806b['getSubjects'](_0x5f53ff);}})[_0x4c47('0x21')](function(_0x42a58f){if(_0x42a58f){return _0x42a58f?{'count':_0x120844,'rows':_0x42a58f}:null;}})[_0x4c47('0x21')](respondWithResult(_0x36750b,null))[_0x4c47('0x3d')](handleError(_0x36750b,null));};exports['getDescriptions']=function(_0x210cc7,_0x3754c9,_0x1a85cb){var _0x24ffa1={};var _0x44102b={};var _0x583190;var _0x41cb54;return db[_0x4c47('0x26')][_0x4c47('0x46')]({'where':{'id':_0x210cc7[_0x4c47('0x44')]['id']}})[_0x4c47('0x21')](handleEntityNotFound(_0x3754c9,null))['then'](function(_0x580faa){if(_0x580faa){_0x583190=_0x580faa;_0x44102b[_0x4c47('0x2d')]=_[_0x4c47('0x3f')](db[_0x4c47('0x47')][_0x4c47('0x40')]);_0x44102b[_0x4c47('0x2a')]=_['keys'](_0x210cc7['query']);_0x44102b[_0x4c47('0x2b')]=_[_0x4c47('0x2c')](_0x44102b[_0x4c47('0x2d')],_0x44102b[_0x4c47('0x2a')]);_0x24ffa1[_0x4c47('0x2e')]=_['intersection'](_0x44102b['model'],qs[_0x4c47('0x2f')](_0x210cc7[_0x4c47('0x2a')][_0x4c47('0x2f')]));_0x24ffa1['attributes']=_0x24ffa1[_0x4c47('0x2e')][_0x4c47('0x30')]?_0x24ffa1['attributes']:_0x44102b[_0x4c47('0x2d')];_0x24ffa1[_0x4c47('0x48')]=qs[_0x4c47('0x34')](_0x210cc7['query'][_0x4c47('0x34')]);_0x24ffa1[_0x4c47('0x35')]=qs[_0x4c47('0x2b')](_[_0x4c47('0x36')](_0x210cc7[_0x4c47('0x2a')],_0x44102b[_0x4c47('0x2b')]));if(_0x210cc7[_0x4c47('0x2a')][_0x4c47('0x39')]){_0x24ffa1[_0x4c47('0x35')]=_['merge'](_0x24ffa1[_0x4c47('0x35')],{'$or':_['map'](_0x24ffa1[_0x4c47('0x2e')],function(_0x163e6a){var _0x595295={};_0x595295[_0x163e6a]={'$like':'%'+_0x210cc7[_0x4c47('0x2a')][_0x4c47('0x39')]+'%'};return _0x595295;})});}_0x24ffa1=_[_0x4c47('0x37')]({},_0x24ffa1,_0x210cc7[_0x4c47('0x3a')]);return _0x583190[_0x4c47('0x4a')](_0x24ffa1);}})['then'](function(_0x3cfe95){if(_0x3cfe95){_0x41cb54=_0x3cfe95['length'];if(!_0x210cc7[_0x4c47('0x2a')][_0x4c47('0x31')]('nolimit')){_0x24ffa1[_0x4c47('0x33')]=qs['limit'](_0x210cc7[_0x4c47('0x2a')][_0x4c47('0x33')]);_0x24ffa1['offset']=qs[_0x4c47('0x1a')](_0x210cc7[_0x4c47('0x2a')]['offset']);}return _0x583190['getDescriptions'](_0x24ffa1);}})[_0x4c47('0x21')](function(_0x169712){if(_0x169712){return _0x169712?{'count':_0x41cb54,'rows':_0x169712}:null;}})[_0x4c47('0x21')](respondWithResult(_0x3754c9,null))[_0x4c47('0x3d')](handleError(_0x3754c9,null));}; \ No newline at end of file +var _0xb5cd=['ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','json','offset','undefined','count','status','set','Content-Range','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','VtigerConfiguration','rawAttributes','fieldName','type','key','map','query','filters','intersection','attributes','model','fields','length','nolimit','limit','sort','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','keys','find','create','body','getFields','findOne','VtigerField','order','getSubjects','hasOwnProperty','getDescriptions','pick','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','querystring'];(function(_0x11ba83,_0xd5611a){var _0x3f3925=function(_0x3d7cb0){while(--_0x3d7cb0){_0x11ba83['push'](_0x11ba83['shift']());}};_0x3f3925(++_0xd5611a);}(_0xb5cd,0x134));var _0xdb5c=function(_0x85a89f,_0xb533f7){_0x85a89f=_0x85a89f-0x0;var _0x55d024=_0xb5cd[_0x85a89f];return _0x55d024;};'use strict';var emlformat=require(_0xdb5c('0x0'));var rimraf=require(_0xdb5c('0x1'));var zipdir=require(_0xdb5c('0x2'));var jsonpatch=require(_0xdb5c('0x3'));var rp=require(_0xdb5c('0x4'));var moment=require('moment');var BPromise=require(_0xdb5c('0x5'));var Mustache=require(_0xdb5c('0x6'));var util=require(_0xdb5c('0x7'));var path=require(_0xdb5c('0x8'));var sox=require(_0xdb5c('0x9'));var csv=require(_0xdb5c('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdb5c('0xb'));var _=require(_0xdb5c('0xc'));var squel=require(_0xdb5c('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xdb5c('0xe'));var toCsv=require(_0xdb5c('0xa'));var querystring=require(_0xdb5c('0xf'));var Papa=require('papaparse');var Redis=require(_0xdb5c('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdb5c('0x11'));var logger=require(_0xdb5c('0x12'))(_0xdb5c('0x13'));var utils=require(_0xdb5c('0x14'));var config=require(_0xdb5c('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xdb5c('0x16'))['db'];function respondWithStatusCode(_0x504608,_0x1a3300){_0x1a3300=_0x1a3300||0xcc;return function(_0x4ea8b0){if(_0x4ea8b0){return _0x504608['sendStatus'](_0x1a3300);}return _0x504608['status'](_0x1a3300)['end']();};}function respondWithResult(_0x5c674a,_0xd6c5bd){_0xd6c5bd=_0xd6c5bd||0xc8;return function(_0x101952){if(_0x101952){return _0x5c674a['status'](_0xd6c5bd)[_0xdb5c('0x17')](_0x101952);}};}function respondWithFilteredResult(_0x543cc8,_0x466bb9){return function(_0x1d0f8c){if(_0x1d0f8c){var _0x40a8a0=typeof _0x466bb9[_0xdb5c('0x18')]===_0xdb5c('0x19')&&typeof _0x466bb9['limit']===_0xdb5c('0x19');var _0x4cc04e=_0x1d0f8c[_0xdb5c('0x1a')];var _0x12600a=_0x40a8a0?0x0:_0x466bb9[_0xdb5c('0x18')];var _0x42c61b=_0x40a8a0?_0x1d0f8c[_0xdb5c('0x1a')]:_0x466bb9[_0xdb5c('0x18')]+_0x466bb9['limit'];var _0x54a9d6;if(_0x42c61b>=_0x4cc04e){_0x42c61b=_0x4cc04e;_0x54a9d6=0xc8;}else{_0x54a9d6=0xce;}_0x543cc8[_0xdb5c('0x1b')](_0x54a9d6);return _0x543cc8[_0xdb5c('0x1c')](_0xdb5c('0x1d'),_0x12600a+'-'+_0x42c61b+'/'+_0x4cc04e)[_0xdb5c('0x17')](_0x1d0f8c);}return null;};}function patchUpdates(_0x4c509c){return function(_0x14a7da){try{jsonpatch['apply'](_0x14a7da,_0x4c509c,!![]);}catch(_0x1ea047){return BPromise[_0xdb5c('0x1e')](_0x1ea047);}return _0x14a7da[_0xdb5c('0x1f')]();};}function saveUpdates(_0xeb17b4,_0x524d28){return function(_0xc2a68d){if(_0xc2a68d){return _0xc2a68d[_0xdb5c('0x20')](_0xeb17b4)[_0xdb5c('0x21')](function(_0xc7f1e5){return _0xc7f1e5;});}return null;};}function removeEntity(_0xf2459,_0x290d65){return function(_0x123db1){if(_0x123db1){return _0x123db1[_0xdb5c('0x22')]()['then'](function(){_0xf2459[_0xdb5c('0x1b')](0xcc)[_0xdb5c('0x23')]();});}};}function handleEntityNotFound(_0x575d86,_0xd45a72){return function(_0x5b3fab){if(!_0x5b3fab){_0x575d86[_0xdb5c('0x24')](0x194);}return _0x5b3fab;};}function handleError(_0x4cdc83,_0x4bf30a){_0x4bf30a=_0x4bf30a||0x1f4;return function(_0x4bfc24){logger[_0xdb5c('0x25')](_0x4bfc24[_0xdb5c('0x26')]);if(_0x4bfc24[_0xdb5c('0x27')]){delete _0x4bfc24[_0xdb5c('0x27')];}_0x4cdc83[_0xdb5c('0x1b')](_0x4bf30a)[_0xdb5c('0x28')](_0x4bfc24);};}exports[_0xdb5c('0x29')]=function(_0x142f9c,_0xb5f283){var _0xc7ec58={},_0x1582fc={},_0xcb3b6={'count':0x0,'rows':[]};var _0x205d4a=_['map'](db[_0xdb5c('0x2a')][_0xdb5c('0x2b')],function(_0x46c9cc){return{'name':_0x46c9cc[_0xdb5c('0x2c')],'type':_0x46c9cc[_0xdb5c('0x2d')][_0xdb5c('0x2e')]};});_0x1582fc['model']=_[_0xdb5c('0x2f')](_0x205d4a,_0xdb5c('0x27'));_0x1582fc[_0xdb5c('0x30')]=_['keys'](_0x142f9c[_0xdb5c('0x30')]);_0x1582fc[_0xdb5c('0x31')]=_[_0xdb5c('0x32')](_0x1582fc['model'],_0x1582fc[_0xdb5c('0x30')]);_0xc7ec58[_0xdb5c('0x33')]=_[_0xdb5c('0x32')](_0x1582fc[_0xdb5c('0x34')],qs['fields'](_0x142f9c[_0xdb5c('0x30')][_0xdb5c('0x35')]));_0xc7ec58[_0xdb5c('0x33')]=_0xc7ec58[_0xdb5c('0x33')][_0xdb5c('0x36')]?_0xc7ec58[_0xdb5c('0x33')]:_0x1582fc[_0xdb5c('0x34')];if(!_0x142f9c[_0xdb5c('0x30')]['hasOwnProperty'](_0xdb5c('0x37'))){_0xc7ec58[_0xdb5c('0x38')]=qs[_0xdb5c('0x38')](_0x142f9c[_0xdb5c('0x30')]['limit']);_0xc7ec58[_0xdb5c('0x18')]=qs[_0xdb5c('0x18')](_0x142f9c['query'][_0xdb5c('0x18')]);}_0xc7ec58['order']=qs[_0xdb5c('0x39')](_0x142f9c[_0xdb5c('0x30')][_0xdb5c('0x39')]);_0xc7ec58['where']=qs[_0xdb5c('0x31')](_['pick'](_0x142f9c['query'],_0x1582fc['filters']),_0x205d4a);if(_0x142f9c[_0xdb5c('0x30')][_0xdb5c('0x3a')]){_0xc7ec58[_0xdb5c('0x3b')]=_['merge'](_0xc7ec58['where'],{'$or':_['map'](_0x205d4a,function(_0x35b43d){if(_0x35b43d[_0xdb5c('0x2d')]!==_0xdb5c('0x3c')){var _0x3631fb={};_0x3631fb[_0x35b43d[_0xdb5c('0x27')]]={'$like':'%'+_0x142f9c[_0xdb5c('0x30')][_0xdb5c('0x3a')]+'%'};return _0x3631fb;}})});}_0xc7ec58=_[_0xdb5c('0x3d')]({},_0xc7ec58,_0x142f9c[_0xdb5c('0x3e')]);var _0x220fc3={'where':_0xc7ec58[_0xdb5c('0x3b')]};return db[_0xdb5c('0x2a')][_0xdb5c('0x1a')](_0x220fc3)[_0xdb5c('0x21')](function(_0x28fa93){_0xcb3b6[_0xdb5c('0x1a')]=_0x28fa93;if(_0x142f9c[_0xdb5c('0x30')][_0xdb5c('0x3f')]){_0xc7ec58[_0xdb5c('0x40')]=[{'all':!![]}];}return db[_0xdb5c('0x2a')][_0xdb5c('0x41')](_0xc7ec58);})[_0xdb5c('0x21')](function(_0x17ba96){_0xcb3b6[_0xdb5c('0x42')]=_0x17ba96;return _0xcb3b6;})[_0xdb5c('0x21')](respondWithFilteredResult(_0xb5f283,_0xc7ec58))[_0xdb5c('0x43')](handleError(_0xb5f283,null));};exports['show']=function(_0x2804ff,_0x1bbe6b){var _0x515bbb={'raw':![],'where':{'id':_0x2804ff[_0xdb5c('0x44')]['id']}},_0x18efa3={};_0x18efa3[_0xdb5c('0x34')]=_[_0xdb5c('0x45')](db['VtigerConfiguration']['rawAttributes']);_0x18efa3[_0xdb5c('0x30')]=_['keys'](_0x2804ff['query']);_0x18efa3[_0xdb5c('0x31')]=_[_0xdb5c('0x32')](_0x18efa3[_0xdb5c('0x34')],_0x18efa3['query']);_0x515bbb[_0xdb5c('0x33')]=_['intersection'](_0x18efa3[_0xdb5c('0x34')],qs[_0xdb5c('0x35')](_0x2804ff['query'][_0xdb5c('0x35')]));_0x515bbb[_0xdb5c('0x33')]=_0x515bbb[_0xdb5c('0x33')]['length']?_0x515bbb['attributes']:_0x18efa3[_0xdb5c('0x34')];if(_0x2804ff[_0xdb5c('0x30')]['includeAll']){_0x515bbb[_0xdb5c('0x40')]=[{'all':!![]}];}_0x515bbb=_[_0xdb5c('0x3d')]({},_0x515bbb,_0x2804ff[_0xdb5c('0x3e')]);return db[_0xdb5c('0x2a')][_0xdb5c('0x46')](_0x515bbb)['then'](handleEntityNotFound(_0x1bbe6b,null))[_0xdb5c('0x21')](respondWithResult(_0x1bbe6b,null))[_0xdb5c('0x43')](handleError(_0x1bbe6b,null));};exports[_0xdb5c('0x47')]=function(_0x6b2d,_0x2732ce){return db[_0xdb5c('0x2a')][_0xdb5c('0x47')](_0x6b2d[_0xdb5c('0x48')],{})[_0xdb5c('0x21')](respondWithResult(_0x2732ce,0xc9))[_0xdb5c('0x43')](handleError(_0x2732ce,null));};exports[_0xdb5c('0x20')]=function(_0x2b7599,_0x525acc){if(_0x2b7599[_0xdb5c('0x48')]['id']){delete _0x2b7599['body']['id'];}return db[_0xdb5c('0x2a')][_0xdb5c('0x46')]({'where':{'id':_0x2b7599['params']['id']}})[_0xdb5c('0x21')](handleEntityNotFound(_0x525acc,null))[_0xdb5c('0x21')](saveUpdates(_0x2b7599[_0xdb5c('0x48')],null))['then'](respondWithResult(_0x525acc,null))[_0xdb5c('0x43')](handleError(_0x525acc,null));};exports[_0xdb5c('0x22')]=function(_0x5ecd15,_0x3e9899){return db[_0xdb5c('0x2a')][_0xdb5c('0x46')]({'where':{'id':_0x5ecd15[_0xdb5c('0x44')]['id']}})['then'](handleEntityNotFound(_0x3e9899,null))[_0xdb5c('0x21')](removeEntity(_0x3e9899,null))['catch'](handleError(_0x3e9899,null));};exports[_0xdb5c('0x49')]=function(_0x1090db,_0x30e232,_0x5ea137){var _0x46b7fb={};var _0x2d34ea={};var _0x4132cf;var _0x298261;return db[_0xdb5c('0x2a')][_0xdb5c('0x4a')]({'where':{'id':_0x1090db[_0xdb5c('0x44')]['id']}})[_0xdb5c('0x21')](handleEntityNotFound(_0x30e232,null))['then'](function(_0x44c1b4){if(_0x44c1b4){_0x4132cf=_0x44c1b4;_0x2d34ea[_0xdb5c('0x34')]=_[_0xdb5c('0x45')](db[_0xdb5c('0x4b')][_0xdb5c('0x2b')]);_0x2d34ea[_0xdb5c('0x30')]=_[_0xdb5c('0x45')](_0x1090db[_0xdb5c('0x30')]);_0x2d34ea[_0xdb5c('0x31')]=_['intersection'](_0x2d34ea[_0xdb5c('0x34')],_0x2d34ea['query']);_0x46b7fb['attributes']=_['intersection'](_0x2d34ea['model'],qs[_0xdb5c('0x35')](_0x1090db['query'][_0xdb5c('0x35')]));_0x46b7fb[_0xdb5c('0x33')]=_0x46b7fb['attributes'][_0xdb5c('0x36')]?_0x46b7fb['attributes']:_0x2d34ea['model'];_0x46b7fb[_0xdb5c('0x4c')]=qs[_0xdb5c('0x39')](_0x1090db[_0xdb5c('0x30')]['sort']);_0x46b7fb['where']=qs[_0xdb5c('0x31')](_['pick'](_0x1090db[_0xdb5c('0x30')],_0x2d34ea['filters']));if(_0x1090db['query'][_0xdb5c('0x3a')]){_0x46b7fb[_0xdb5c('0x3b')]=_[_0xdb5c('0x3d')](_0x46b7fb['where'],{'$or':_[_0xdb5c('0x2f')](_0x46b7fb[_0xdb5c('0x33')],function(_0x542c25){var _0x37ec14={};_0x37ec14[_0x542c25]={'$like':'%'+_0x1090db['query'][_0xdb5c('0x3a')]+'%'};return _0x37ec14;})});}_0x46b7fb=_['merge']({},_0x46b7fb,_0x1090db['options']);return _0x4132cf['getFields'](_0x46b7fb);}})[_0xdb5c('0x21')](function(_0x4b29c2){if(_0x4b29c2){_0x298261=_0x4b29c2[_0xdb5c('0x36')];if(!_0x1090db[_0xdb5c('0x30')]['hasOwnProperty']('nolimit')){_0x46b7fb[_0xdb5c('0x38')]=qs[_0xdb5c('0x38')](_0x1090db[_0xdb5c('0x30')][_0xdb5c('0x38')]);_0x46b7fb[_0xdb5c('0x18')]=qs['offset'](_0x1090db[_0xdb5c('0x30')][_0xdb5c('0x18')]);}return _0x4132cf[_0xdb5c('0x49')](_0x46b7fb);}})[_0xdb5c('0x21')](function(_0x190f2b){if(_0x190f2b){return _0x190f2b?{'count':_0x298261,'rows':_0x190f2b}:null;}})[_0xdb5c('0x21')](respondWithResult(_0x30e232,null))[_0xdb5c('0x43')](handleError(_0x30e232,null));};exports['getSubjects']=function(_0xfd116f,_0x24b55e,_0x587a29){var _0x42d272={};var _0x3cefc1={};var _0x3fa23b;var _0x3358b0;return db[_0xdb5c('0x2a')][_0xdb5c('0x4a')]({'where':{'id':_0xfd116f[_0xdb5c('0x44')]['id']}})[_0xdb5c('0x21')](handleEntityNotFound(_0x24b55e,null))['then'](function(_0x23f773){if(_0x23f773){_0x3fa23b=_0x23f773;_0x3cefc1[_0xdb5c('0x34')]=_[_0xdb5c('0x45')](db[_0xdb5c('0x4b')][_0xdb5c('0x2b')]);_0x3cefc1['query']=_[_0xdb5c('0x45')](_0xfd116f[_0xdb5c('0x30')]);_0x3cefc1['filters']=_[_0xdb5c('0x32')](_0x3cefc1[_0xdb5c('0x34')],_0x3cefc1[_0xdb5c('0x30')]);_0x42d272['attributes']=_[_0xdb5c('0x32')](_0x3cefc1[_0xdb5c('0x34')],qs[_0xdb5c('0x35')](_0xfd116f[_0xdb5c('0x30')][_0xdb5c('0x35')]));_0x42d272[_0xdb5c('0x33')]=_0x42d272['attributes'][_0xdb5c('0x36')]?_0x42d272[_0xdb5c('0x33')]:_0x3cefc1[_0xdb5c('0x34')];_0x42d272[_0xdb5c('0x4c')]=qs[_0xdb5c('0x39')](_0xfd116f[_0xdb5c('0x30')][_0xdb5c('0x39')]);_0x42d272['where']=qs[_0xdb5c('0x31')](_['pick'](_0xfd116f[_0xdb5c('0x30')],_0x3cefc1[_0xdb5c('0x31')]));if(_0xfd116f[_0xdb5c('0x30')][_0xdb5c('0x3a')]){_0x42d272[_0xdb5c('0x3b')]=_[_0xdb5c('0x3d')](_0x42d272[_0xdb5c('0x3b')],{'$or':_[_0xdb5c('0x2f')](_0x42d272[_0xdb5c('0x33')],function(_0x5e6a9d){var _0x4ebfb5={};_0x4ebfb5[_0x5e6a9d]={'$like':'%'+_0xfd116f[_0xdb5c('0x30')][_0xdb5c('0x3a')]+'%'};return _0x4ebfb5;})});}_0x42d272=_[_0xdb5c('0x3d')]({},_0x42d272,_0xfd116f[_0xdb5c('0x3e')]);return _0x3fa23b[_0xdb5c('0x4d')](_0x42d272);}})['then'](function(_0x49e366){if(_0x49e366){_0x3358b0=_0x49e366[_0xdb5c('0x36')];if(!_0xfd116f[_0xdb5c('0x30')][_0xdb5c('0x4e')](_0xdb5c('0x37'))){_0x42d272[_0xdb5c('0x38')]=qs['limit'](_0xfd116f[_0xdb5c('0x30')]['limit']);_0x42d272[_0xdb5c('0x18')]=qs[_0xdb5c('0x18')](_0xfd116f[_0xdb5c('0x30')][_0xdb5c('0x18')]);}return _0x3fa23b['getSubjects'](_0x42d272);}})[_0xdb5c('0x21')](function(_0x1bdf5b){if(_0x1bdf5b){return _0x1bdf5b?{'count':_0x3358b0,'rows':_0x1bdf5b}:null;}})[_0xdb5c('0x21')](respondWithResult(_0x24b55e,null))[_0xdb5c('0x43')](handleError(_0x24b55e,null));};exports[_0xdb5c('0x4f')]=function(_0x1b3fd2,_0x2b69bb,_0x54a989){var _0xcc7683={};var _0x887b76={};var _0x3f12ef;var _0x203ae6;return db[_0xdb5c('0x2a')][_0xdb5c('0x4a')]({'where':{'id':_0x1b3fd2[_0xdb5c('0x44')]['id']}})[_0xdb5c('0x21')](handleEntityNotFound(_0x2b69bb,null))[_0xdb5c('0x21')](function(_0x484054){if(_0x484054){_0x3f12ef=_0x484054;_0x887b76['model']=_[_0xdb5c('0x45')](db[_0xdb5c('0x4b')][_0xdb5c('0x2b')]);_0x887b76['query']=_['keys'](_0x1b3fd2['query']);_0x887b76['filters']=_[_0xdb5c('0x32')](_0x887b76[_0xdb5c('0x34')],_0x887b76[_0xdb5c('0x30')]);_0xcc7683['attributes']=_[_0xdb5c('0x32')](_0x887b76[_0xdb5c('0x34')],qs['fields'](_0x1b3fd2[_0xdb5c('0x30')][_0xdb5c('0x35')]));_0xcc7683[_0xdb5c('0x33')]=_0xcc7683[_0xdb5c('0x33')][_0xdb5c('0x36')]?_0xcc7683['attributes']:_0x887b76['model'];_0xcc7683['order']=qs[_0xdb5c('0x39')](_0x1b3fd2[_0xdb5c('0x30')][_0xdb5c('0x39')]);_0xcc7683['where']=qs[_0xdb5c('0x31')](_[_0xdb5c('0x50')](_0x1b3fd2[_0xdb5c('0x30')],_0x887b76[_0xdb5c('0x31')]));if(_0x1b3fd2[_0xdb5c('0x30')][_0xdb5c('0x3a')]){_0xcc7683[_0xdb5c('0x3b')]=_[_0xdb5c('0x3d')](_0xcc7683[_0xdb5c('0x3b')],{'$or':_['map'](_0xcc7683[_0xdb5c('0x33')],function(_0x143679){var _0x4ca7de={};_0x4ca7de[_0x143679]={'$like':'%'+_0x1b3fd2[_0xdb5c('0x30')][_0xdb5c('0x3a')]+'%'};return _0x4ca7de;})});}_0xcc7683=_[_0xdb5c('0x3d')]({},_0xcc7683,_0x1b3fd2[_0xdb5c('0x3e')]);return _0x3f12ef['getDescriptions'](_0xcc7683);}})[_0xdb5c('0x21')](function(_0xc1e8cd){if(_0xc1e8cd){_0x203ae6=_0xc1e8cd[_0xdb5c('0x36')];if(!_0x1b3fd2[_0xdb5c('0x30')][_0xdb5c('0x4e')](_0xdb5c('0x37'))){_0xcc7683[_0xdb5c('0x38')]=qs['limit'](_0x1b3fd2[_0xdb5c('0x30')]['limit']);_0xcc7683['offset']=qs['offset'](_0x1b3fd2[_0xdb5c('0x30')][_0xdb5c('0x18')]);}return _0x3f12ef[_0xdb5c('0x4f')](_0xcc7683);}})[_0xdb5c('0x21')](function(_0x495b28){if(_0x495b28){return _0x495b28?{'count':_0x203ae6,'rows':_0x495b28}:null;}})[_0xdb5c('0x21')](respondWithResult(_0x2b69bb,null))['catch'](handleError(_0x2b69bb,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 91285a6..708d715 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 _0x0ca5=['bluebird','../../config/environment','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','int_vtiger_configurations','lodash','util','moment'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x0ca5,0x15b));var _0x50ca=function(_0x40b7b5,_0x349fc6){_0x40b7b5=_0x40b7b5-0x0;var _0x4feab9=_0x0ca5[_0x40b7b5];return _0x4feab9;};'use strict';var _=require(_0x50ca('0x0'));var util=require(_0x50ca('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x50ca('0x2'));var BPromise=require(_0x50ca('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x50ca('0x4'));var attributes=require(_0x50ca('0x5'));module[_0x50ca('0x6')]=function(_0x4ef224,_0x17d645){return _0x4ef224[_0x50ca('0x7')](_0x50ca('0x8'),attributes,{'tableName':_0x50ca('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf52c=['../../config/environment','./intVtigerConfiguration.attributes','exports','VtigerConfiguration','int_vtiger_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x3ea4f5,_0x4fd9e0){var _0x13a95f=function(_0x35e3a0){while(--_0x35e3a0){_0x3ea4f5['push'](_0x3ea4f5['shift']());}};_0x13a95f(++_0x4fd9e0);}(_0xf52c,0x67));var _0xcf52=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf52c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xcf52('0x0'));var util=require(_0xcf52('0x1'));var logger=require(_0xcf52('0x2'))(_0xcf52('0x3'));var moment=require(_0xcf52('0x4'));var BPromise=require(_0xcf52('0x5'));var rp=require(_0xcf52('0x6'));var fs=require('fs');var path=require(_0xcf52('0x7'));var rimraf=require(_0xcf52('0x8'));var config=require(_0xcf52('0x9'));var attributes=require(_0xcf52('0xa'));module[_0xcf52('0xb')]=function(_0xe0aed8,_0x414bdf){return _0xe0aed8['define'](_0xcf52('0xc'),attributes,{'tableName':_0xcf52('0xd'),'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 9fd115d..fb8a22a 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 _0xc27a=['error','message','request\x20sent','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','VtigerConfiguration,\x20%s,\x20%s','stringify'];(function(_0x4b3ec4,_0x3c573c){var _0x192836=function(_0x498cc0){while(--_0x498cc0){_0x4b3ec4['push'](_0x4b3ec4['shift']());}};_0x192836(++_0x3c573c);}(_0xc27a,0x11c));var _0xac27=function(_0x546aaf,_0x1ed138){_0x546aaf=_0x546aaf-0x0;var _0x1cbf6d=_0xc27a[_0x546aaf];return _0x1cbf6d;};'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(_0xac27('0x4'));var db=require(_0xac27('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xac27('0x6'))(_0xac27('0x7'));var config=require(_0xac27('0x8'));var jayson=require(_0xac27('0x9'));var client=jayson[_0xac27('0xa')][_0xac27('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x57e440,_0x175003,_0x4504c5){return new BPromise(function(_0x23217f,_0x3bd07a){return client[_0xac27('0xc')](_0x57e440,_0x4504c5)[_0xac27('0xd')](function(_0x86f88c){logger['info'](_0xac27('0xe'),_0x175003,'request\x20sent');logger['debug']('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x175003,'request\x20sent',JSON[_0xac27('0xf')](_0x86f88c));if(_0x86f88c[_0xac27('0x10')]){if(_0x86f88c[_0xac27('0x10')]['code']===0x1f4){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x175003,_0x86f88c['error'][_0xac27('0x11')]);return _0x3bd07a(_0x86f88c['error']['message']);}logger['error'](_0xac27('0xe'),_0x175003,_0x86f88c[_0xac27('0x10')][_0xac27('0x11')]);return _0x23217f(_0x86f88c[_0xac27('0x10')][_0xac27('0x11')]);}else{logger['info'](_0xac27('0xe'),_0x175003,_0xac27('0x12'));_0x23217f(_0x86f88c[_0xac27('0x13')][_0xac27('0x11')]);}})['catch'](function(_0x1f59e6){logger[_0xac27('0x10')]('VtigerConfiguration,\x20%s,\x20%s',_0x175003,_0x1f59e6);_0x3bd07a(_0x1f59e6);});});} \ No newline at end of file +var _0x2f04=['info','request\x20sent','stringify','error','code','message','VtigerConfiguration,\x20%s,\x20%s','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','then'];(function(_0x57e96b,_0x35087c){var _0x282706=function(_0x3ed5e1){while(--_0x3ed5e1){_0x57e96b['push'](_0x57e96b['shift']());}};_0x282706(++_0x35087c);}(_0x2f04,0xed));var _0x42f0=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x2f04[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x42f0('0x0'));var util=require('util');var moment=require(_0x42f0('0x1'));var BPromise=require(_0x42f0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x42f0('0x3'));var db=require(_0x42f0('0x4'))['db'];var utils=require(_0x42f0('0x5'));var logger=require('../../config/logger')(_0x42f0('0x6'));var config=require('../../config/environment');var jayson=require(_0x42f0('0x7'));var client=jayson[_0x42f0('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1ca5b9,_0xcda507,_0x475daf){return new BPromise(function(_0x210414,_0x25017a){return client['request'](_0x1ca5b9,_0x475daf)[_0x42f0('0x9')](function(_0x3d999a){logger[_0x42f0('0xa')]('VtigerConfiguration,\x20%s,\x20%s',_0xcda507,_0x42f0('0xb'));logger['debug']('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0xcda507,_0x42f0('0xb'),JSON[_0x42f0('0xc')](_0x3d999a));if(_0x3d999a['error']){if(_0x3d999a[_0x42f0('0xd')][_0x42f0('0xe')]===0x1f4){logger[_0x42f0('0xd')]('VtigerConfiguration,\x20%s,\x20%s',_0xcda507,_0x3d999a[_0x42f0('0xd')]['message']);return _0x25017a(_0x3d999a[_0x42f0('0xd')][_0x42f0('0xf')]);}logger['error'](_0x42f0('0x10'),_0xcda507,_0x3d999a[_0x42f0('0xd')][_0x42f0('0xf')]);return _0x210414(_0x3d999a['error']['message']);}else{logger[_0x42f0('0xa')](_0x42f0('0x10'),_0xcda507,_0x42f0('0xb'));_0x210414(_0x3d999a[_0x42f0('0x11')][_0x42f0('0xf')]);}})[_0x42f0('0x12')](function(_0x523c21){logger[_0x42f0('0xd')](_0x42f0('0x10'),_0xcda507,_0x523c21);_0x25017a(_0x523c21);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index bb4a30b..24f73e5 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 _0x8744=['../../config/environment','./intVtigerField.controller','get','index','show','post','isAuthenticated','create','put','/:id','update','delete','destroy','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service'];(function(_0x6bd60c,_0x56f363){var _0x5e0e84=function(_0x57f08f){while(--_0x57f08f){_0x6bd60c['push'](_0x6bd60c['shift']());}};_0x5e0e84(++_0x56f363);}(_0x8744,0x12a));var _0x4874=function(_0x43daa8,_0x47f028){_0x43daa8=_0x43daa8-0x0;var _0x389155=_0x8744[_0x43daa8];return _0x389155;};'use strict';var multer=require(_0x4874('0x0'));var util=require(_0x4874('0x1'));var path=require('path');var timeout=require(_0x4874('0x2'));var express=require(_0x4874('0x3'));var router=express['Router']();var fs_extra=require(_0x4874('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x4874('0x5'));var config=require(_0x4874('0x6'));var controller=require(_0x4874('0x7'));router[_0x4874('0x8')]('/',auth['isAuthenticated'](),controller[_0x4874('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x4874('0xa')]);router[_0x4874('0xb')]('/',auth[_0x4874('0xc')](),controller[_0x4874('0xd')]);router[_0x4874('0xe')](_0x4874('0xf'),auth[_0x4874('0xc')](),controller[_0x4874('0x10')]);router[_0x4874('0x11')]('/:id',auth[_0x4874('0xc')](),controller[_0x4874('0x12')]);module['exports']=router; \ No newline at end of file +var _0x6c30=['delete','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','create','update'];(function(_0x1b8a6c,_0x4c2a5f){var _0x13ec3b=function(_0x53e579){while(--_0x53e579){_0x1b8a6c['push'](_0x1b8a6c['shift']());}};_0x13ec3b(++_0x4c2a5f);}(_0x6c30,0x1b3));var _0x06c3=function(_0x1c7889,_0x24cd26){_0x1c7889=_0x1c7889-0x0;var _0x2f14e5=_0x6c30[_0x1c7889];return _0x2f14e5;};'use strict';var multer=require(_0x06c3('0x0'));var util=require(_0x06c3('0x1'));var path=require(_0x06c3('0x2'));var timeout=require('connect-timeout');var express=require(_0x06c3('0x3'));var router=express['Router']();var fs_extra=require(_0x06c3('0x4'));var auth=require(_0x06c3('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x06c3('0x6'));var controller=require('./intVtigerField.controller');router[_0x06c3('0x7')]('/',auth[_0x06c3('0x8')](),controller[_0x06c3('0x9')]);router[_0x06c3('0x7')](_0x06c3('0xa'),auth[_0x06c3('0x8')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x06c3('0xb')]);router['put'](_0x06c3('0xa'),auth[_0x06c3('0x8')](),controller[_0x06c3('0xc')]);router[_0x06c3('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x06c3('0xe')]);module[_0x06c3('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 c1a8cbd..06039bc 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 _0xdfc4=['customVariable','BOOLEAN','sequelize','exports','string','variable','keyValue','picklist','STRING','ENUM'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0xdfc4,0x1ec));var _0x4dfc=function(_0x48a3bc,_0x28c428){_0x48a3bc=_0x48a3bc-0x0;var _0x2d3c15=_0xdfc4[_0x48a3bc];return _0x2d3c15;};'use strict';var Sequelize=require(_0x4dfc('0x0'));module[_0x4dfc('0x1')]={'type':{'type':Sequelize['ENUM'](_0x4dfc('0x2'),_0x4dfc('0x3'),'customVariable',_0x4dfc('0x4'),_0x4dfc('0x5')),'defaultValue':_0x4dfc('0x2')},'content':{'type':Sequelize[_0x4dfc('0x6')]},'key':{'type':Sequelize[_0x4dfc('0x6')]},'keyType':{'type':Sequelize[_0x4dfc('0x7')](_0x4dfc('0x2'),_0x4dfc('0x3'),_0x4dfc('0x8'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x4dfc('0x6')]},'nameField':{'type':Sequelize[_0x4dfc('0x6')]},'customField':{'type':Sequelize[_0x4dfc('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4dfc('0x6')]}}; \ No newline at end of file +var _0xa195=['sequelize','exports','ENUM','variable','customVariable','keyValue','string','STRING','BOOLEAN'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xa195,0x17a));var _0x5a19=function(_0x202a4f,_0x32de45){_0x202a4f=_0x202a4f-0x0;var _0x11939f=_0xa195[_0x202a4f];return _0x11939f;};'use strict';var Sequelize=require(_0x5a19('0x0'));module[_0x5a19('0x1')]={'type':{'type':Sequelize[_0x5a19('0x2')]('string',_0x5a19('0x3'),_0x5a19('0x4'),_0x5a19('0x5'),'picklist'),'defaultValue':_0x5a19('0x6')},'content':{'type':Sequelize[_0x5a19('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x5a19('0x2')]('string',_0x5a19('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x5a19('0x7')]},'idField':{'type':Sequelize[_0x5a19('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x5a19('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5a19('0x7')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 670e7d5..4a3ad79 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 _0x29c5=['index','map','VtigerField','fieldName','type','key','keys','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','includeAll','include','findAll','catch','show','rawAttributes','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send'];(function(_0x1c16a4,_0xbba97c){var _0xa47eb7=function(_0x3f4893){while(--_0x3f4893){_0x1c16a4['push'](_0x1c16a4['shift']());}};_0xa47eb7(++_0xbba97c);}(_0x29c5,0xb3));var _0x529c=function(_0x58bf21,_0x41f9f9){_0x58bf21=_0x58bf21-0x0;var _0x542d59=_0x29c5[_0x58bf21];return _0x542d59;};'use strict';var emlformat=require(_0x529c('0x0'));var rimraf=require(_0x529c('0x1'));var zipdir=require(_0x529c('0x2'));var jsonpatch=require(_0x529c('0x3'));var rp=require('request-promise');var moment=require(_0x529c('0x4'));var BPromise=require(_0x529c('0x5'));var Mustache=require(_0x529c('0x6'));var util=require(_0x529c('0x7'));var path=require(_0x529c('0x8'));var sox=require('sox');var csv=require(_0x529c('0x9'));var ejs=require(_0x529c('0xa'));var fs=require('fs');var fs_extra=require(_0x529c('0xb'));var _=require('lodash');var squel=require(_0x529c('0xc'));var crypto=require(_0x529c('0xd'));var jsforce=require(_0x529c('0xe'));var deskjs=require(_0x529c('0xf'));var toCsv=require('to-csv');var querystring=require(_0x529c('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x529c('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x529c('0x12'))(_0x529c('0x13'));var utils=require(_0x529c('0x14'));var config=require(_0x529c('0x15'));var licenseUtil=require(_0x529c('0x16'));var db=require(_0x529c('0x17'))['db'];function respondWithStatusCode(_0x1a39ba,_0x5eb3a8){_0x5eb3a8=_0x5eb3a8||0xcc;return function(_0x5bf789){if(_0x5bf789){return _0x1a39ba[_0x529c('0x18')](_0x5eb3a8);}return _0x1a39ba[_0x529c('0x19')](_0x5eb3a8)[_0x529c('0x1a')]();};}function respondWithResult(_0x2cdb92,_0x5d8231){_0x5d8231=_0x5d8231||0xc8;return function(_0x1172af){if(_0x1172af){return _0x2cdb92[_0x529c('0x19')](_0x5d8231)[_0x529c('0x1b')](_0x1172af);}};}function respondWithFilteredResult(_0x41e3f1,_0x555d9d){return function(_0x1d60f4){if(_0x1d60f4){var _0xa7b7a5=typeof _0x555d9d[_0x529c('0x1c')]==='undefined'&&typeof _0x555d9d['limit']===_0x529c('0x1d');var _0x5da3b6=_0x1d60f4['count'];var _0x179a86=_0xa7b7a5?0x0:_0x555d9d[_0x529c('0x1c')];var _0x18e6f3=_0xa7b7a5?_0x1d60f4[_0x529c('0x1e')]:_0x555d9d[_0x529c('0x1c')]+_0x555d9d[_0x529c('0x1f')];var _0x28cf9d;if(_0x18e6f3>=_0x5da3b6){_0x18e6f3=_0x5da3b6;_0x28cf9d=0xc8;}else{_0x28cf9d=0xce;}_0x41e3f1[_0x529c('0x19')](_0x28cf9d);return _0x41e3f1[_0x529c('0x20')](_0x529c('0x21'),_0x179a86+'-'+_0x18e6f3+'/'+_0x5da3b6)[_0x529c('0x1b')](_0x1d60f4);}return null;};}function patchUpdates(_0x130c91){return function(_0x338dd7){try{jsonpatch[_0x529c('0x22')](_0x338dd7,_0x130c91,!![]);}catch(_0x2d7aa5){return BPromise['reject'](_0x2d7aa5);}return _0x338dd7[_0x529c('0x23')]();};}function saveUpdates(_0x17ade9,_0x4fcd3f){return function(_0x2f08b2){if(_0x2f08b2){return _0x2f08b2[_0x529c('0x24')](_0x17ade9)[_0x529c('0x25')](function(_0x50559d){return _0x50559d;});}return null;};}function removeEntity(_0x2ad946,_0x154122){return function(_0x342bbf){if(_0x342bbf){return _0x342bbf[_0x529c('0x26')]()[_0x529c('0x25')](function(){_0x2ad946['status'](0xcc)[_0x529c('0x1a')]();});}};}function handleEntityNotFound(_0xccfe24,_0x515704){return function(_0x4e7048){if(!_0x4e7048){_0xccfe24['sendStatus'](0x194);}return _0x4e7048;};}function handleError(_0x2f7352,_0x1f6fd1){_0x1f6fd1=_0x1f6fd1||0x1f4;return function(_0x3d28a2){logger[_0x529c('0x27')](_0x3d28a2[_0x529c('0x28')]);if(_0x3d28a2[_0x529c('0x29')]){delete _0x3d28a2[_0x529c('0x29')];}_0x2f7352[_0x529c('0x19')](_0x1f6fd1)[_0x529c('0x2a')](_0x3d28a2);};}exports[_0x529c('0x2b')]=function(_0x1aa56f,_0x18cfd9){var _0x538cad={},_0x4ab9f5={},_0x2069cd={'count':0x0,'rows':[]};var _0x1c9a3d=_[_0x529c('0x2c')](db[_0x529c('0x2d')]['rawAttributes'],function(_0xf4f59a){return{'name':_0xf4f59a[_0x529c('0x2e')],'type':_0xf4f59a[_0x529c('0x2f')][_0x529c('0x30')]};});_0x4ab9f5['model']=_[_0x529c('0x2c')](_0x1c9a3d,'name');_0x4ab9f5['query']=_[_0x529c('0x31')](_0x1aa56f[_0x529c('0x32')]);_0x4ab9f5['filters']=_[_0x529c('0x33')](_0x4ab9f5[_0x529c('0x34')],_0x4ab9f5[_0x529c('0x32')]);_0x538cad['attributes']=_['intersection'](_0x4ab9f5[_0x529c('0x34')],qs[_0x529c('0x35')](_0x1aa56f[_0x529c('0x32')][_0x529c('0x35')]));_0x538cad[_0x529c('0x36')]=_0x538cad['attributes'][_0x529c('0x37')]?_0x538cad[_0x529c('0x36')]:_0x4ab9f5[_0x529c('0x34')];if(!_0x1aa56f[_0x529c('0x32')][_0x529c('0x38')](_0x529c('0x39'))){_0x538cad['limit']=qs[_0x529c('0x1f')](_0x1aa56f[_0x529c('0x32')][_0x529c('0x1f')]);_0x538cad[_0x529c('0x1c')]=qs[_0x529c('0x1c')](_0x1aa56f[_0x529c('0x32')]['offset']);}_0x538cad[_0x529c('0x3a')]=qs[_0x529c('0x3b')](_0x1aa56f[_0x529c('0x32')]['sort']);_0x538cad[_0x529c('0x3c')]=qs['filters'](_[_0x529c('0x3d')](_0x1aa56f['query'],_0x4ab9f5[_0x529c('0x3e')]),_0x1c9a3d);if(_0x1aa56f[_0x529c('0x32')][_0x529c('0x3f')]){_0x538cad[_0x529c('0x3c')]=_[_0x529c('0x40')](_0x538cad[_0x529c('0x3c')],{'$or':_['map'](_0x1c9a3d,function(_0x1349c7){if(_0x1349c7[_0x529c('0x2f')]!=='VIRTUAL'){var _0x47bebd={};_0x47bebd[_0x1349c7[_0x529c('0x29')]]={'$like':'%'+_0x1aa56f[_0x529c('0x32')]['filter']+'%'};return _0x47bebd;}})});}_0x538cad=_[_0x529c('0x40')]({},_0x538cad,_0x1aa56f['options']);var _0x29f46d={'where':_0x538cad['where']};return db[_0x529c('0x2d')][_0x529c('0x1e')](_0x29f46d)[_0x529c('0x25')](function(_0x32d01c){_0x2069cd[_0x529c('0x1e')]=_0x32d01c;if(_0x1aa56f[_0x529c('0x32')][_0x529c('0x41')]){_0x538cad[_0x529c('0x42')]=[{'all':!![]}];}return db['VtigerField'][_0x529c('0x43')](_0x538cad);})['then'](function(_0x38c8f1){_0x2069cd['rows']=_0x38c8f1;return _0x2069cd;})[_0x529c('0x25')](respondWithFilteredResult(_0x18cfd9,_0x538cad))[_0x529c('0x44')](handleError(_0x18cfd9,null));};exports[_0x529c('0x45')]=function(_0x128ffd,_0x50c737){var _0x31df86={'raw':!![],'where':{'id':_0x128ffd['params']['id']}},_0x1ce335={};_0x1ce335['model']=_[_0x529c('0x31')](db[_0x529c('0x2d')][_0x529c('0x46')]);_0x1ce335[_0x529c('0x32')]=_[_0x529c('0x31')](_0x128ffd[_0x529c('0x32')]);_0x1ce335[_0x529c('0x3e')]=_[_0x529c('0x33')](_0x1ce335[_0x529c('0x34')],_0x1ce335['query']);_0x31df86[_0x529c('0x36')]=_[_0x529c('0x33')](_0x1ce335[_0x529c('0x34')],qs[_0x529c('0x35')](_0x128ffd[_0x529c('0x32')][_0x529c('0x35')]));_0x31df86['attributes']=_0x31df86[_0x529c('0x36')][_0x529c('0x37')]?_0x31df86[_0x529c('0x36')]:_0x1ce335[_0x529c('0x34')];if(_0x128ffd['query'][_0x529c('0x41')]){_0x31df86['include']=[{'all':!![]}];}_0x31df86=_[_0x529c('0x40')]({},_0x31df86,_0x128ffd['options']);return db[_0x529c('0x2d')]['find'](_0x31df86)[_0x529c('0x25')](handleEntityNotFound(_0x50c737,null))[_0x529c('0x25')](respondWithResult(_0x50c737,null))[_0x529c('0x44')](handleError(_0x50c737,null));};exports[_0x529c('0x47')]=function(_0x483ffb,_0x15891f){return db['VtigerField'][_0x529c('0x47')](_0x483ffb['body'],{})[_0x529c('0x25')](respondWithResult(_0x15891f,0xc9))[_0x529c('0x44')](handleError(_0x15891f,null));};exports[_0x529c('0x24')]=function(_0x102d0f,_0xe59ddc){if(_0x102d0f[_0x529c('0x48')]['id']){delete _0x102d0f[_0x529c('0x48')]['id'];}return db[_0x529c('0x2d')]['find']({'where':{'id':_0x102d0f['params']['id']}})['then'](handleEntityNotFound(_0xe59ddc,null))[_0x529c('0x25')](saveUpdates(_0x102d0f['body'],null))[_0x529c('0x25')](respondWithResult(_0xe59ddc,null))[_0x529c('0x44')](handleError(_0xe59ddc,null));};exports['destroy']=function(_0x1b2e91,_0x449ef1){return db[_0x529c('0x2d')][_0x529c('0x49')]({'where':{'id':_0x1b2e91['params']['id']}})[_0x529c('0x25')](handleEntityNotFound(_0x449ef1,null))[_0x529c('0x25')](removeEntity(_0x449ef1,null))[_0x529c('0x44')](handleError(_0x449ef1,null));}; \ No newline at end of file +var _0xc837=['save','update','then','destroy','error','stack','name','send','index','map','VtigerField','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','nolimit','sort','where','pick','merge','VIRTUAL','filter','includeAll','findAll','catch','show','options','create','body','params','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject'];(function(_0x4a7631,_0x2c85b9){var _0x1a5a6f=function(_0x1ee3fd){while(--_0x1ee3fd){_0x4a7631['push'](_0x4a7631['shift']());}};_0x1a5a6f(++_0x2c85b9);}(_0xc837,0x71));var _0x7c83=function(_0x5f4c10,_0x5b8647){_0x5f4c10=_0x5f4c10-0x0;var _0x17a960=_0xc837[_0x5f4c10];return _0x17a960;};'use strict';var emlformat=require(_0x7c83('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7c83('0x1'));var jsonpatch=require(_0x7c83('0x2'));var rp=require('request-promise');var moment=require(_0x7c83('0x3'));var BPromise=require(_0x7c83('0x4'));var Mustache=require(_0x7c83('0x5'));var util=require('util');var path=require(_0x7c83('0x6'));var sox=require(_0x7c83('0x7'));var csv=require(_0x7c83('0x8'));var ejs=require(_0x7c83('0x9'));var fs=require('fs');var fs_extra=require(_0x7c83('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x7c83('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x7c83('0xc'));var toCsv=require(_0x7c83('0x8'));var querystring=require('querystring');var Papa=require(_0x7c83('0xd'));var Redis=require(_0x7c83('0xe'));var authService=require(_0x7c83('0xf'));var qs=require(_0x7c83('0x10'));var as=require(_0x7c83('0x11'));var hardwareService=require(_0x7c83('0x12'));var logger=require(_0x7c83('0x13'))(_0x7c83('0x14'));var utils=require(_0x7c83('0x15'));var config=require(_0x7c83('0x16'));var licenseUtil=require(_0x7c83('0x17'));var db=require(_0x7c83('0x18'))['db'];function respondWithStatusCode(_0x5c449f,_0x309163){_0x309163=_0x309163||0xcc;return function(_0x348cc1){if(_0x348cc1){return _0x5c449f[_0x7c83('0x19')](_0x309163);}return _0x5c449f[_0x7c83('0x1a')](_0x309163)[_0x7c83('0x1b')]();};}function respondWithResult(_0x33add3,_0x480fba){_0x480fba=_0x480fba||0xc8;return function(_0x402e89){if(_0x402e89){return _0x33add3[_0x7c83('0x1a')](_0x480fba)[_0x7c83('0x1c')](_0x402e89);}};}function respondWithFilteredResult(_0x26a6eb,_0x2bbbdf){return function(_0xc540){if(_0xc540){var _0x2ba35b=typeof _0x2bbbdf[_0x7c83('0x1d')]==='undefined'&&typeof _0x2bbbdf[_0x7c83('0x1e')]===_0x7c83('0x1f');var _0x174f4e=_0xc540[_0x7c83('0x20')];var _0xed8bef=_0x2ba35b?0x0:_0x2bbbdf[_0x7c83('0x1d')];var _0x13b8af=_0x2ba35b?_0xc540[_0x7c83('0x20')]:_0x2bbbdf['offset']+_0x2bbbdf[_0x7c83('0x1e')];var _0x5e6e25;if(_0x13b8af>=_0x174f4e){_0x13b8af=_0x174f4e;_0x5e6e25=0xc8;}else{_0x5e6e25=0xce;}_0x26a6eb[_0x7c83('0x1a')](_0x5e6e25);return _0x26a6eb[_0x7c83('0x21')](_0x7c83('0x22'),_0xed8bef+'-'+_0x13b8af+'/'+_0x174f4e)[_0x7c83('0x1c')](_0xc540);}return null;};}function patchUpdates(_0x45c060){return function(_0x29181b){try{jsonpatch[_0x7c83('0x23')](_0x29181b,_0x45c060,!![]);}catch(_0x29175e){return BPromise[_0x7c83('0x24')](_0x29175e);}return _0x29181b[_0x7c83('0x25')]();};}function saveUpdates(_0x169ac2,_0x48948d){return function(_0x14b66d){if(_0x14b66d){return _0x14b66d[_0x7c83('0x26')](_0x169ac2)[_0x7c83('0x27')](function(_0x4b9563){return _0x4b9563;});}return null;};}function removeEntity(_0x3c9a52,_0x1636ad){return function(_0x280c3c){if(_0x280c3c){return _0x280c3c[_0x7c83('0x28')]()[_0x7c83('0x27')](function(){_0x3c9a52['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3effd6,_0x22723a){return function(_0x44a9a8){if(!_0x44a9a8){_0x3effd6[_0x7c83('0x19')](0x194);}return _0x44a9a8;};}function handleError(_0x4e0e88,_0x510326){_0x510326=_0x510326||0x1f4;return function(_0x3dc691){logger[_0x7c83('0x29')](_0x3dc691[_0x7c83('0x2a')]);if(_0x3dc691[_0x7c83('0x2b')]){delete _0x3dc691[_0x7c83('0x2b')];}_0x4e0e88['status'](_0x510326)[_0x7c83('0x2c')](_0x3dc691);};}exports[_0x7c83('0x2d')]=function(_0x278853,_0x100249){var _0x313155={},_0x254d14={},_0x35f673={'count':0x0,'rows':[]};var _0x1ac66f=_[_0x7c83('0x2e')](db[_0x7c83('0x2f')][_0x7c83('0x30')],function(_0x40a67){return{'name':_0x40a67[_0x7c83('0x31')],'type':_0x40a67[_0x7c83('0x32')][_0x7c83('0x33')]};});_0x254d14['model']=_[_0x7c83('0x2e')](_0x1ac66f,'name');_0x254d14[_0x7c83('0x34')]=_[_0x7c83('0x35')](_0x278853[_0x7c83('0x34')]);_0x254d14[_0x7c83('0x36')]=_[_0x7c83('0x37')](_0x254d14['model'],_0x254d14['query']);_0x313155[_0x7c83('0x38')]=_[_0x7c83('0x37')](_0x254d14[_0x7c83('0x39')],qs[_0x7c83('0x3a')](_0x278853[_0x7c83('0x34')][_0x7c83('0x3a')]));_0x313155[_0x7c83('0x38')]=_0x313155[_0x7c83('0x38')][_0x7c83('0x3b')]?_0x313155['attributes']:_0x254d14[_0x7c83('0x39')];if(!_0x278853[_0x7c83('0x34')]['hasOwnProperty'](_0x7c83('0x3c'))){_0x313155[_0x7c83('0x1e')]=qs[_0x7c83('0x1e')](_0x278853['query']['limit']);_0x313155[_0x7c83('0x1d')]=qs[_0x7c83('0x1d')](_0x278853[_0x7c83('0x34')][_0x7c83('0x1d')]);}_0x313155['order']=qs[_0x7c83('0x3d')](_0x278853[_0x7c83('0x34')][_0x7c83('0x3d')]);_0x313155[_0x7c83('0x3e')]=qs[_0x7c83('0x36')](_[_0x7c83('0x3f')](_0x278853[_0x7c83('0x34')],_0x254d14[_0x7c83('0x36')]),_0x1ac66f);if(_0x278853[_0x7c83('0x34')]['filter']){_0x313155[_0x7c83('0x3e')]=_[_0x7c83('0x40')](_0x313155[_0x7c83('0x3e')],{'$or':_[_0x7c83('0x2e')](_0x1ac66f,function(_0x3e2744){if(_0x3e2744[_0x7c83('0x32')]!==_0x7c83('0x41')){var _0x2d5902={};_0x2d5902[_0x3e2744['name']]={'$like':'%'+_0x278853[_0x7c83('0x34')][_0x7c83('0x42')]+'%'};return _0x2d5902;}})});}_0x313155=_[_0x7c83('0x40')]({},_0x313155,_0x278853['options']);var _0x22e148={'where':_0x313155[_0x7c83('0x3e')]};return db[_0x7c83('0x2f')][_0x7c83('0x20')](_0x22e148)[_0x7c83('0x27')](function(_0x18fefe){_0x35f673[_0x7c83('0x20')]=_0x18fefe;if(_0x278853['query'][_0x7c83('0x43')]){_0x313155['include']=[{'all':!![]}];}return db[_0x7c83('0x2f')][_0x7c83('0x44')](_0x313155);})[_0x7c83('0x27')](function(_0x282474){_0x35f673['rows']=_0x282474;return _0x35f673;})[_0x7c83('0x27')](respondWithFilteredResult(_0x100249,_0x313155))[_0x7c83('0x45')](handleError(_0x100249,null));};exports[_0x7c83('0x46')]=function(_0x49b900,_0xf55636){var _0x358920={'raw':!![],'where':{'id':_0x49b900['params']['id']}},_0x3181c0={};_0x3181c0[_0x7c83('0x39')]=_['keys'](db[_0x7c83('0x2f')][_0x7c83('0x30')]);_0x3181c0[_0x7c83('0x34')]=_['keys'](_0x49b900['query']);_0x3181c0[_0x7c83('0x36')]=_[_0x7c83('0x37')](_0x3181c0['model'],_0x3181c0[_0x7c83('0x34')]);_0x358920['attributes']=_[_0x7c83('0x37')](_0x3181c0['model'],qs[_0x7c83('0x3a')](_0x49b900[_0x7c83('0x34')][_0x7c83('0x3a')]));_0x358920['attributes']=_0x358920[_0x7c83('0x38')][_0x7c83('0x3b')]?_0x358920[_0x7c83('0x38')]:_0x3181c0[_0x7c83('0x39')];if(_0x49b900[_0x7c83('0x34')][_0x7c83('0x43')]){_0x358920['include']=[{'all':!![]}];}_0x358920=_[_0x7c83('0x40')]({},_0x358920,_0x49b900[_0x7c83('0x47')]);return db[_0x7c83('0x2f')]['find'](_0x358920)[_0x7c83('0x27')](handleEntityNotFound(_0xf55636,null))[_0x7c83('0x27')](respondWithResult(_0xf55636,null))['catch'](handleError(_0xf55636,null));};exports[_0x7c83('0x48')]=function(_0x238c45,_0x56ac9a){return db[_0x7c83('0x2f')][_0x7c83('0x48')](_0x238c45[_0x7c83('0x49')],{})[_0x7c83('0x27')](respondWithResult(_0x56ac9a,0xc9))[_0x7c83('0x45')](handleError(_0x56ac9a,null));};exports[_0x7c83('0x26')]=function(_0x461c9d,_0x2db642){if(_0x461c9d['body']['id']){delete _0x461c9d[_0x7c83('0x49')]['id'];}return db[_0x7c83('0x2f')]['find']({'where':{'id':_0x461c9d['params']['id']}})['then'](handleEntityNotFound(_0x2db642,null))[_0x7c83('0x27')](saveUpdates(_0x461c9d['body'],null))[_0x7c83('0x27')](respondWithResult(_0x2db642,null))[_0x7c83('0x45')](handleError(_0x2db642,null));};exports[_0x7c83('0x28')]=function(_0x557609,_0x27e717){return db['VtigerField']['find']({'where':{'id':_0x557609[_0x7c83('0x4a')]['id']}})[_0x7c83('0x27')](handleEntityNotFound(_0x27e717,null))[_0x7c83('0x27')](removeEntity(_0x27e717,null))[_0x7c83('0x45')](handleError(_0x27e717,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 0d4c654..44cc779 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 _0x316d=['int_vtiger_fields','vtiger_unique_index','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerField.attributes','define','VtigerField'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x316d,0x72));var _0xd316=function(_0x3ec170,_0x4bd32b){_0x3ec170=_0x3ec170-0x0;var _0x49ab8b=_0x316d[_0x3ec170];return _0x49ab8b;};'use strict';var _=require(_0xd316('0x0'));var util=require(_0xd316('0x1'));var logger=require('../../config/logger')(_0xd316('0x2'));var moment=require(_0xd316('0x3'));var BPromise=require(_0xd316('0x4'));var rp=require(_0xd316('0x5'));var fs=require('fs');var path=require(_0xd316('0x6'));var rimraf=require(_0xd316('0x7'));var config=require(_0xd316('0x8'));var attributes=require(_0xd316('0x9'));module['exports']=function(_0x134c9a,_0x5989f6){return _0x134c9a[_0xd316('0xa')](_0xd316('0xb'),attributes,{'tableName':_0xd316('0xc'),'paranoid':![],'indexes':[{'name':_0xd316('0xd'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfcf7=['moment','rimraf','../../config/environment','./intVtigerField.attributes','exports','define','VtigerField','int_vtiger_fields','vtiger_unique_index','idField','FieldId','lodash','util','../../config/logger','api'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0xfcf7,0x1af));var _0x7fcf=function(_0x9a909,_0x5a26f3){_0x9a909=_0x9a909-0x0;var _0x46e23e=_0xfcf7[_0x9a909];return _0x46e23e;};'use strict';var _=require(_0x7fcf('0x0'));var util=require(_0x7fcf('0x1'));var logger=require(_0x7fcf('0x2'))(_0x7fcf('0x3'));var moment=require(_0x7fcf('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7fcf('0x5'));var config=require(_0x7fcf('0x6'));var attributes=require(_0x7fcf('0x7'));module[_0x7fcf('0x8')]=function(_0xd65d9d,_0x12ca32){return _0xd65d9d[_0x7fcf('0x9')](_0x7fcf('0xa'),attributes,{'tableName':_0x7fcf('0xb'),'paranoid':![],'indexes':[{'name':_0x7fcf('0xc'),'fields':[_0x7fcf('0xd'),_0x7fcf('0xe')],'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 3da6333..0dc563f 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 _0x4cad=['then','info','VtigerField,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0x1a6fc2,_0x4f7795){var _0x49d635=function(_0x315158){while(--_0x315158){_0x1a6fc2['push'](_0x1a6fc2['shift']());}};_0x49d635(++_0x4f7795);}(_0x4cad,0x1d8));var _0xd4ca=function(_0x3f2294,_0x1922e2){_0x3f2294=_0x3f2294-0x0;var _0x10f9a1=_0x4cad[_0x3f2294];return _0x10f9a1;};'use strict';var _=require(_0xd4ca('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd4ca('0x1'));var rs=require(_0xd4ca('0x2'));var fs=require('fs');var Redis=require(_0xd4ca('0x3'));var db=require(_0xd4ca('0x4'))['db'];var utils=require(_0xd4ca('0x5'));var logger=require(_0xd4ca('0x6'))(_0xd4ca('0x7'));var config=require('../../config/environment');var jayson=require(_0xd4ca('0x8'));var client=jayson[_0xd4ca('0x9')][_0xd4ca('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x132efb,_0x579acc,_0x5060e3){return new BPromise(function(_0x429270,_0x4e9832){return client[_0xd4ca('0xb')](_0x132efb,_0x5060e3)[_0xd4ca('0xc')](function(_0x203dc1){logger[_0xd4ca('0xd')](_0xd4ca('0xe'),_0x579acc,_0xd4ca('0xf'));logger['debug']('VtigerField,\x20%s,\x20%s,\x20%s',_0x579acc,_0xd4ca('0xf'),JSON[_0xd4ca('0x10')](_0x203dc1));if(_0x203dc1['error']){if(_0x203dc1['error'][_0xd4ca('0x11')]===0x1f4){logger['error'](_0xd4ca('0xe'),_0x579acc,_0x203dc1[_0xd4ca('0x12')][_0xd4ca('0x13')]);return _0x4e9832(_0x203dc1[_0xd4ca('0x12')][_0xd4ca('0x13')]);}logger[_0xd4ca('0x12')](_0xd4ca('0xe'),_0x579acc,_0x203dc1[_0xd4ca('0x12')]['message']);return _0x429270(_0x203dc1[_0xd4ca('0x12')][_0xd4ca('0x13')]);}else{logger[_0xd4ca('0xd')]('VtigerField,\x20%s,\x20%s',_0x579acc,_0xd4ca('0xf'));_0x429270(_0x203dc1[_0xd4ca('0x14')][_0xd4ca('0x13')]);}})[_0xd4ca('0x15')](function(_0x445bf1){logger['error'](_0xd4ca('0xe'),_0x579acc,_0x445bf1);_0x4e9832(_0x445bf1);});});} \ No newline at end of file +var _0x4ba0=['message','request\x20sent','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','VtigerField,\x20%s,\x20%s','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0xba9993,_0x17a58e){var _0x57d736=function(_0x12ea47){while(--_0x12ea47){_0xba9993['push'](_0xba9993['shift']());}};_0x57d736(++_0x17a58e);}(_0x4ba0,0xe0));var _0x04ba=function(_0x38ced4,_0x24263f){_0x38ced4=_0x38ced4-0x0;var _0x547c07=_0x4ba0[_0x38ced4];return _0x547c07;};'use strict';var _=require(_0x04ba('0x0'));var util=require('util');var moment=require(_0x04ba('0x1'));var BPromise=require('bluebird');var rs=require(_0x04ba('0x2'));var fs=require('fs');var Redis=require(_0x04ba('0x3'));var db=require(_0x04ba('0x4'))['db'];var utils=require(_0x04ba('0x5'));var logger=require('../../config/logger')(_0x04ba('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x04ba('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1ae533,_0x3ec930,_0x1e9dc8){return new BPromise(function(_0x37821a,_0x42c83a){return client['request'](_0x1ae533,_0x1e9dc8)['then'](function(_0x30a788){logger['info'](_0x04ba('0x8'),_0x3ec930,'request\x20sent');logger[_0x04ba('0x9')](_0x04ba('0xa'),_0x3ec930,'request\x20sent',JSON[_0x04ba('0xb')](_0x30a788));if(_0x30a788[_0x04ba('0xc')]){if(_0x30a788[_0x04ba('0xc')][_0x04ba('0xd')]===0x1f4){logger[_0x04ba('0xc')](_0x04ba('0x8'),_0x3ec930,_0x30a788[_0x04ba('0xc')]['message']);return _0x42c83a(_0x30a788['error']['message']);}logger[_0x04ba('0xc')]('VtigerField,\x20%s,\x20%s',_0x3ec930,_0x30a788['error'][_0x04ba('0xe')]);return _0x37821a(_0x30a788[_0x04ba('0xc')]['message']);}else{logger['info']('VtigerField,\x20%s,\x20%s',_0x3ec930,_0x04ba('0xf'));_0x37821a(_0x30a788['result'][_0x04ba('0xe')]);}})[_0x04ba('0x10')](function(_0x512645){logger['error']('VtigerField,\x20%s,\x20%s',_0x3ec930,_0x512645);_0x42c83a(_0x512645);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index f73e8bb..251f22f 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 _0x7ffb=['connect-timeout','Router','fs-extra','../../components/interaction/service','./intZendeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getFields','post','update','delete','destroy','multer'];(function(_0x36bfe3,_0x358938){var _0x9b0436=function(_0x86e47d){while(--_0x86e47d){_0x36bfe3['push'](_0x36bfe3['shift']());}};_0x9b0436(++_0x358938);}(_0x7ffb,0x197));var _0xb7ff=function(_0xe4bb3d,_0x21e87e){_0xe4bb3d=_0xe4bb3d-0x0;var _0xd9e51=_0x7ffb[_0xe4bb3d];return _0xd9e51;};'use strict';var multer=require(_0xb7ff('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xb7ff('0x1'));var express=require('express');var router=express[_0xb7ff('0x2')]();var fs_extra=require(_0xb7ff('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xb7ff('0x4'));var config=require('../../config/environment');var controller=require(_0xb7ff('0x5'));router[_0xb7ff('0x6')]('/',auth[_0xb7ff('0x7')](),controller[_0xb7ff('0x8')]);router[_0xb7ff('0x6')](_0xb7ff('0x9'),auth[_0xb7ff('0x7')](),controller[_0xb7ff('0xa')]);router[_0xb7ff('0x6')](_0xb7ff('0xb'),auth[_0xb7ff('0x7')](),controller['getConfigurations']);router[_0xb7ff('0x6')]('/:id/fields',auth[_0xb7ff('0x7')](),controller[_0xb7ff('0xc')]);router[_0xb7ff('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xb7ff('0xd')](_0xb7ff('0xb'),auth[_0xb7ff('0x7')](),controller['addConfiguration']);router['put'](_0xb7ff('0x9'),auth[_0xb7ff('0x7')](),controller[_0xb7ff('0xe')]);router[_0xb7ff('0xf')](_0xb7ff('0x9'),auth[_0xb7ff('0x7')](),controller[_0xb7ff('0x10')]);module['exports']=router; \ No newline at end of file +var _0x1be6=['Router','fs-extra','../../config/environment','./intZendeskAccount.controller','isAuthenticated','index','/:id','show','get','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','destroy','multer','util','path','connect-timeout'];(function(_0xf02353,_0x5d599b){var _0x59f7df=function(_0x2c7eb0){while(--_0x2c7eb0){_0xf02353['push'](_0xf02353['shift']());}};_0x59f7df(++_0x5d599b);}(_0x1be6,0x8f));var _0x61be=function(_0x1c1698,_0x3781d3){_0x1c1698=_0x1c1698-0x0;var _0x36386e=_0x1be6[_0x1c1698];return _0x36386e;};'use strict';var multer=require(_0x61be('0x0'));var util=require(_0x61be('0x1'));var path=require(_0x61be('0x2'));var timeout=require(_0x61be('0x3'));var express=require('express');var router=express[_0x61be('0x4')]();var fs_extra=require(_0x61be('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x61be('0x6'));var controller=require(_0x61be('0x7'));router['get']('/',auth[_0x61be('0x8')](),controller[_0x61be('0x9')]);router['get'](_0x61be('0xa'),auth['isAuthenticated'](),controller[_0x61be('0xb')]);router[_0x61be('0xc')](_0x61be('0xd'),auth[_0x61be('0x8')](),controller[_0x61be('0xe')]);router[_0x61be('0xc')](_0x61be('0xf'),auth[_0x61be('0x8')](),controller[_0x61be('0x10')]);router[_0x61be('0x11')]('/',auth[_0x61be('0x8')](),controller['create']);router['post'](_0x61be('0xd'),auth[_0x61be('0x8')](),controller[_0x61be('0x12')]);router[_0x61be('0x13')](_0x61be('0xa'),auth[_0x61be('0x8')](),controller['update']);router['delete'](_0x61be('0xa'),auth[_0x61be('0x8')](),controller[_0x61be('0x14')]);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 7ef3bea..0f03e4f 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 _0x9c63=['exports','STRING','ENUM','password','token','newTab','integrationTab','sequelize'];(function(_0x329940,_0x5ce09a){var _0x5eebc6=function(_0x1e0585){while(--_0x1e0585){_0x329940['push'](_0x329940['shift']());}};_0x5eebc6(++_0x5ce09a);}(_0x9c63,0x1a7));var _0x39c6=function(_0x1c1b62,_0x3e1da4){_0x1c1b62=_0x1c1b62-0x0;var _0x44bf5f=_0x9c63[_0x1c1b62];return _0x44bf5f;};'use strict';var Sequelize=require(_0x39c6('0x0'));module[_0x39c6('0x1')]={'name':{'type':Sequelize[_0x39c6('0x2')]},'description':{'type':Sequelize[_0x39c6('0x2')]},'username':{'type':Sequelize[_0x39c6('0x2')],'unique':'username'},'password':{'type':Sequelize[_0x39c6('0x2')]},'token':{'type':Sequelize[_0x39c6('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'authType':{'type':Sequelize[_0x39c6('0x3')](_0x39c6('0x4'),_0x39c6('0x5')),'defaultValue':_0x39c6('0x4')},'serverUrl':{'type':Sequelize[_0x39c6('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x39c6('0x3')]('integrationTab',_0x39c6('0x6')),'defaultValue':_0x39c6('0x7')}}; \ No newline at end of file +var _0x9bd9=['sequelize','exports','STRING','username','remoteUri','ENUM','token','password','integrationTab','newTab'];(function(_0x246f8c,_0x408602){var _0x1b652e=function(_0xf0d7ab){while(--_0xf0d7ab){_0x246f8c['push'](_0x246f8c['shift']());}};_0x1b652e(++_0x408602);}(_0x9bd9,0x1a4));var _0x99bd=function(_0x3b611a,_0x5358bb){_0x3b611a=_0x3b611a-0x0;var _0x41c633=_0x9bd9[_0x3b611a];return _0x41c633;};'use strict';var Sequelize=require(_0x99bd('0x0'));module[_0x99bd('0x1')]={'name':{'type':Sequelize[_0x99bd('0x2')]},'description':{'type':Sequelize[_0x99bd('0x2')]},'username':{'type':Sequelize[_0x99bd('0x2')],'unique':_0x99bd('0x3')},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x99bd('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x99bd('0x4')},'authType':{'type':Sequelize[_0x99bd('0x5')]('password',_0x99bd('0x6')),'defaultValue':_0x99bd('0x7')},'serverUrl':{'type':Sequelize[_0x99bd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x99bd('0x5')](_0x99bd('0x8'),_0x99bd('0x9')),'defaultValue':_0x99bd('0x8')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 8dff128..50c0917 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 _0xbfcc=['position','title','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','fast-json-patch','request-promise','moment','bluebird','to-csv','ejs','lodash','crypto','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','status','end','json','undefined','limit','offset','set','Content-Range','apply','save','update','destroy','sendStatus','error','stack','name','send','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','ZendeskAccount','count','include','findAll','rows','then','catch','show','params','includeAll','find','create','body','findOne','ZendeskConfiguration','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','getFields','username','token','authType','remoteUri','slice','substring','lastIndexOf','GET','%s/%s','ticket_fields','headers','Basic\x20%s','format','%s:%s','password','toString','base64','%s/token:%s','ValidationError','Unknown\x20authentication\x20type','subject','group','assignee','includes'];(function(_0x3213b7,_0x6789ca){var _0xb960bf=function(_0x2f7f04){while(--_0x2f7f04){_0x3213b7['push'](_0x3213b7['shift']());}};_0xb960bf(++_0x6789ca);}(_0xbfcc,0x1dd));var _0xcbfc=function(_0x3de8a4,_0x289a5c){_0x3de8a4=_0x3de8a4-0x0;var _0x4635cf=_0xbfcc[_0x3de8a4];return _0x4635cf;};'use strict';var emlformat=require(_0xcbfc('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xcbfc('0x1'));var rp=require(_0xcbfc('0x2'));var moment=require(_0xcbfc('0x3'));var BPromise=require(_0xcbfc('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xcbfc('0x5'));var ejs=require(_0xcbfc('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcbfc('0x7'));var squel=require('squel');var crypto=require(_0xcbfc('0x8'));var jsforce=require(_0xcbfc('0x9'));var deskjs=require(_0xcbfc('0xa'));var toCsv=require(_0xcbfc('0x5'));var querystring=require('querystring');var Papa=require(_0xcbfc('0xb'));var Redis=require(_0xcbfc('0xc'));var authService=require(_0xcbfc('0xd'));var qs=require(_0xcbfc('0xe'));var as=require(_0xcbfc('0xf'));var hardwareService=require(_0xcbfc('0x10'));var logger=require('../../config/logger')(_0xcbfc('0x11'));var utils=require(_0xcbfc('0x12'));var config=require(_0xcbfc('0x13'));var licenseUtil=require(_0xcbfc('0x14'));var db=require(_0xcbfc('0x15'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x3bfd05,_0x86f67c){_0x86f67c=_0x86f67c||0xcc;return function(_0x80d08d){if(_0x80d08d){return _0x3bfd05['sendStatus'](_0x86f67c);}return _0x3bfd05[_0xcbfc('0x16')](_0x86f67c)[_0xcbfc('0x17')]();};}function respondWithResult(_0x2f2bdd,_0x45a5cc){_0x45a5cc=_0x45a5cc||0xc8;return function(_0x16b659){if(_0x16b659){return _0x2f2bdd['status'](_0x45a5cc)[_0xcbfc('0x18')](_0x16b659);}};}function respondWithFilteredResult(_0x1963de,_0x1ec8c4){return function(_0x4317e4){if(_0x4317e4){var _0x50c6b6=typeof _0x1ec8c4['offset']===_0xcbfc('0x19')&&typeof _0x1ec8c4[_0xcbfc('0x1a')]===_0xcbfc('0x19');var _0x4d6946=_0x4317e4['count'];var _0x33f731=_0x50c6b6?0x0:_0x1ec8c4[_0xcbfc('0x1b')];var _0x344510=_0x50c6b6?_0x4317e4['count']:_0x1ec8c4[_0xcbfc('0x1b')]+_0x1ec8c4['limit'];var _0x28f7fb;if(_0x344510>=_0x4d6946){_0x344510=_0x4d6946;_0x28f7fb=0xc8;}else{_0x28f7fb=0xce;}_0x1963de[_0xcbfc('0x16')](_0x28f7fb);return _0x1963de[_0xcbfc('0x1c')](_0xcbfc('0x1d'),_0x33f731+'-'+_0x344510+'/'+_0x4d6946)[_0xcbfc('0x18')](_0x4317e4);}return null;};}function patchUpdates(_0x2653b1){return function(_0x5f09b0){try{jsonpatch[_0xcbfc('0x1e')](_0x5f09b0,_0x2653b1,!![]);}catch(_0x37ec3e){return BPromise['reject'](_0x37ec3e);}return _0x5f09b0[_0xcbfc('0x1f')]();};}function saveUpdates(_0x5a449b,_0x4cc8b3){return function(_0x4e2427){if(_0x4e2427){return _0x4e2427[_0xcbfc('0x20')](_0x5a449b)['then'](function(_0x4a1915){return _0x4a1915;});}return null;};}function removeEntity(_0x1b3e42,_0x34cffa){return function(_0x3ceeff){if(_0x3ceeff){return _0x3ceeff[_0xcbfc('0x21')]()['then'](function(){_0x1b3e42[_0xcbfc('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x280b78,_0x75bca0){return function(_0x53951a){if(!_0x53951a){_0x280b78[_0xcbfc('0x22')](0x194);}return _0x53951a;};}function handleError(_0x3b73a3,_0x4ab48e){_0x4ab48e=_0x4ab48e||0x1f4;return function(_0x1b2c01){logger[_0xcbfc('0x23')](_0x1b2c01[_0xcbfc('0x24')]);if(_0x1b2c01[_0xcbfc('0x25')]){delete _0x1b2c01['name'];}_0x3b73a3[_0xcbfc('0x16')](_0x4ab48e)[_0xcbfc('0x26')](_0x1b2c01);};}exports['index']=function(_0x1f6a14,_0x26463f){var _0x7cbdfa={},_0x388d41={},_0x2b4286={'count':0x0,'rows':[]};var _0x19d2e=_[_0xcbfc('0x27')](db['ZendeskAccount'][_0xcbfc('0x28')],function(_0x433300){return{'name':_0x433300[_0xcbfc('0x29')],'type':_0x433300[_0xcbfc('0x2a')]['key']};});_0x388d41[_0xcbfc('0x2b')]=_[_0xcbfc('0x27')](_0x19d2e,_0xcbfc('0x25'));_0x388d41[_0xcbfc('0x2c')]=_[_0xcbfc('0x2d')](_0x1f6a14[_0xcbfc('0x2c')]);_0x388d41[_0xcbfc('0x2e')]=_['intersection'](_0x388d41[_0xcbfc('0x2b')],_0x388d41[_0xcbfc('0x2c')]);_0x7cbdfa['attributes']=_[_0xcbfc('0x2f')](_0x388d41[_0xcbfc('0x2b')],qs[_0xcbfc('0x30')](_0x1f6a14['query']['fields']));_0x7cbdfa['attributes']=_0x7cbdfa[_0xcbfc('0x31')][_0xcbfc('0x32')]?_0x7cbdfa[_0xcbfc('0x31')]:_0x388d41[_0xcbfc('0x2b')];if(!_0x1f6a14[_0xcbfc('0x2c')][_0xcbfc('0x33')](_0xcbfc('0x34'))){_0x7cbdfa[_0xcbfc('0x1a')]=qs['limit'](_0x1f6a14[_0xcbfc('0x2c')][_0xcbfc('0x1a')]);_0x7cbdfa['offset']=qs[_0xcbfc('0x1b')](_0x1f6a14['query'][_0xcbfc('0x1b')]);}_0x7cbdfa[_0xcbfc('0x35')]=qs[_0xcbfc('0x36')](_0x1f6a14['query'][_0xcbfc('0x36')]);_0x7cbdfa['where']=qs['filters'](_[_0xcbfc('0x37')](_0x1f6a14[_0xcbfc('0x2c')],_0x388d41[_0xcbfc('0x2e')]),_0x19d2e);if(_0x1f6a14[_0xcbfc('0x2c')][_0xcbfc('0x38')]){_0x7cbdfa[_0xcbfc('0x39')]=_[_0xcbfc('0x3a')](_0x7cbdfa[_0xcbfc('0x39')],{'$or':_['map'](_0x19d2e,function(_0x15fb08){if(_0x15fb08['type']!==_0xcbfc('0x3b')){var _0x44064d={};_0x44064d[_0x15fb08[_0xcbfc('0x25')]]={'$like':'%'+_0x1f6a14[_0xcbfc('0x2c')]['filter']+'%'};return _0x44064d;}})});}_0x7cbdfa=_['merge']({},_0x7cbdfa,_0x1f6a14[_0xcbfc('0x3c')]);var _0x1c678b={'where':_0x7cbdfa[_0xcbfc('0x39')]};return db[_0xcbfc('0x3d')][_0xcbfc('0x3e')](_0x1c678b)['then'](function(_0x1901b4){_0x2b4286[_0xcbfc('0x3e')]=_0x1901b4;if(_0x1f6a14[_0xcbfc('0x2c')]['includeAll']){_0x7cbdfa[_0xcbfc('0x3f')]=[{'all':!![]}];}return db[_0xcbfc('0x3d')][_0xcbfc('0x40')](_0x7cbdfa);})['then'](function(_0x28266c){_0x2b4286[_0xcbfc('0x41')]=_0x28266c;return _0x2b4286;})[_0xcbfc('0x42')](respondWithFilteredResult(_0x26463f,_0x7cbdfa))[_0xcbfc('0x43')](handleError(_0x26463f,null));};exports[_0xcbfc('0x44')]=function(_0x28447a,_0x1e14bb){var _0x561544={'raw':![],'where':{'id':_0x28447a[_0xcbfc('0x45')]['id']}},_0x2de7fe={};_0x2de7fe['model']=_[_0xcbfc('0x2d')](db[_0xcbfc('0x3d')][_0xcbfc('0x28')]);_0x2de7fe[_0xcbfc('0x2c')]=_[_0xcbfc('0x2d')](_0x28447a[_0xcbfc('0x2c')]);_0x2de7fe[_0xcbfc('0x2e')]=_[_0xcbfc('0x2f')](_0x2de7fe['model'],_0x2de7fe[_0xcbfc('0x2c')]);_0x561544[_0xcbfc('0x31')]=_[_0xcbfc('0x2f')](_0x2de7fe[_0xcbfc('0x2b')],qs[_0xcbfc('0x30')](_0x28447a[_0xcbfc('0x2c')][_0xcbfc('0x30')]));_0x561544['attributes']=_0x561544[_0xcbfc('0x31')][_0xcbfc('0x32')]?_0x561544['attributes']:_0x2de7fe[_0xcbfc('0x2b')];if(_0x28447a[_0xcbfc('0x2c')][_0xcbfc('0x46')]){_0x561544['include']=[{'all':!![]}];}_0x561544=_[_0xcbfc('0x3a')]({},_0x561544,_0x28447a[_0xcbfc('0x3c')]);return db[_0xcbfc('0x3d')][_0xcbfc('0x47')](_0x561544)[_0xcbfc('0x42')](handleEntityNotFound(_0x1e14bb,null))[_0xcbfc('0x42')](respondWithResult(_0x1e14bb,null))[_0xcbfc('0x43')](handleError(_0x1e14bb,null));};exports['create']=function(_0x5a87b6,_0x237f30){return db[_0xcbfc('0x3d')][_0xcbfc('0x48')](_0x5a87b6[_0xcbfc('0x49')],{})['then'](respondWithResult(_0x237f30,0xc9))['catch'](handleError(_0x237f30,null));};exports[_0xcbfc('0x20')]=function(_0xe5c5ef,_0x12340f){if(_0xe5c5ef['body']['id']){delete _0xe5c5ef[_0xcbfc('0x49')]['id'];}return db[_0xcbfc('0x3d')][_0xcbfc('0x47')]({'where':{'id':_0xe5c5ef['params']['id']}})[_0xcbfc('0x42')](handleEntityNotFound(_0x12340f,null))[_0xcbfc('0x42')](saveUpdates(_0xe5c5ef[_0xcbfc('0x49')],null))[_0xcbfc('0x42')](respondWithResult(_0x12340f,null))[_0xcbfc('0x43')](handleError(_0x12340f,null));};exports[_0xcbfc('0x21')]=function(_0x222b58,_0x374998){return db[_0xcbfc('0x3d')][_0xcbfc('0x47')]({'where':{'id':_0x222b58['params']['id']}})[_0xcbfc('0x42')](handleEntityNotFound(_0x374998,null))[_0xcbfc('0x42')](removeEntity(_0x374998,null))[_0xcbfc('0x43')](handleError(_0x374998,null));};exports['getConfigurations']=function(_0x28ae7f,_0x1a89c1,_0x4b7038){var _0x54de8={};var _0x5ce8e3={};var _0x38db76;var _0x25e48d;return db['ZendeskAccount'][_0xcbfc('0x4a')]({'where':{'id':_0x28ae7f[_0xcbfc('0x45')]['id']}})['then'](handleEntityNotFound(_0x1a89c1,null))[_0xcbfc('0x42')](function(_0x34db13){if(_0x34db13){_0x38db76=_0x34db13;_0x5ce8e3[_0xcbfc('0x2b')]=_[_0xcbfc('0x2d')](db[_0xcbfc('0x4b')][_0xcbfc('0x28')]);_0x5ce8e3[_0xcbfc('0x2c')]=_[_0xcbfc('0x2d')](_0x28ae7f[_0xcbfc('0x2c')]);_0x5ce8e3[_0xcbfc('0x2e')]=_['intersection'](_0x5ce8e3[_0xcbfc('0x2b')],_0x5ce8e3['query']);_0x54de8['attributes']=_['intersection'](_0x5ce8e3[_0xcbfc('0x2b')],qs[_0xcbfc('0x30')](_0x28ae7f[_0xcbfc('0x2c')][_0xcbfc('0x30')]));_0x54de8[_0xcbfc('0x31')]=_0x54de8[_0xcbfc('0x31')][_0xcbfc('0x32')]?_0x54de8[_0xcbfc('0x31')]:_0x5ce8e3['model'];_0x54de8[_0xcbfc('0x35')]=qs[_0xcbfc('0x36')](_0x28ae7f[_0xcbfc('0x2c')]['sort']);_0x54de8[_0xcbfc('0x39')]=qs[_0xcbfc('0x2e')](_[_0xcbfc('0x37')](_0x28ae7f[_0xcbfc('0x2c')],_0x5ce8e3[_0xcbfc('0x2e')]));if(_0x28ae7f[_0xcbfc('0x2c')][_0xcbfc('0x38')]){_0x54de8['where']=_[_0xcbfc('0x3a')](_0x54de8['where'],{'$or':_[_0xcbfc('0x27')](_0x54de8[_0xcbfc('0x31')],function(_0x5de047){var _0x2c6b23={};_0x2c6b23[_0x5de047]={'$like':'%'+_0x28ae7f['query'][_0xcbfc('0x38')]+'%'};return _0x2c6b23;})});}_0x54de8=_[_0xcbfc('0x3a')]({},_0x54de8,_0x28ae7f[_0xcbfc('0x3c')]);return _0x38db76[_0xcbfc('0x4c')](_0x54de8);}})[_0xcbfc('0x42')](function(_0x1b2b24){if(_0x1b2b24){_0x25e48d=_0x1b2b24['length'];if(!_0x28ae7f[_0xcbfc('0x2c')][_0xcbfc('0x33')]('nolimit')){_0x54de8[_0xcbfc('0x1a')]=qs[_0xcbfc('0x1a')](_0x28ae7f[_0xcbfc('0x2c')][_0xcbfc('0x1a')]);_0x54de8[_0xcbfc('0x1b')]=qs[_0xcbfc('0x1b')](_0x28ae7f[_0xcbfc('0x2c')][_0xcbfc('0x1b')]);}return _0x38db76['getConfigurations'](_0x54de8);}})[_0xcbfc('0x42')](function(_0x3f01da){if(_0x3f01da){return _0x3f01da?{'count':_0x25e48d,'rows':_0x3f01da}:null;}})[_0xcbfc('0x42')](respondWithResult(_0x1a89c1,null))[_0xcbfc('0x43')](handleError(_0x1a89c1,null));};exports[_0xcbfc('0x4d')]=function(_0x2fb0c2,_0x209d61,_0x380539){if(_0x2fb0c2[_0xcbfc('0x49')]['id']){delete _0x2fb0c2[_0xcbfc('0x49')]['id'];}return db['ZendeskAccount'][_0xcbfc('0x4a')]({'where':{'id':_0x2fb0c2[_0xcbfc('0x45')]['id']}})['then'](handleEntityNotFound(_0x209d61,null))[_0xcbfc('0x42')](function(_0x510a43){if(_0x510a43){_0x2fb0c2['body'][_0xcbfc('0x4e')]=_0x510a43['id'];_0x2fb0c2[_0xcbfc('0x49')][_0xcbfc('0x4f')]=integrations[_0xcbfc('0x50')](_0x2fb0c2[_0xcbfc('0x49')]['channel'],_0x2fb0c2['body'][_0xcbfc('0x2a')]);_0x2fb0c2[_0xcbfc('0x49')][_0xcbfc('0x51')]=integrations[_0xcbfc('0x52')](_0x2fb0c2[_0xcbfc('0x49')]['channel'],_0x2fb0c2[_0xcbfc('0x49')][_0xcbfc('0x2a')]);return db[_0xcbfc('0x4b')]['create'](_0x2fb0c2['body'],{'include':[{'model':db['ZendeskField'],'as':_0xcbfc('0x4f')},{'model':db['ZendeskField'],'as':'Descriptions'}]});}return null;})[_0xcbfc('0x42')](respondWithResult(_0x209d61,null))['catch'](handleError(_0x209d61,null));};exports[_0xcbfc('0x53')]=function(_0x34e671,_0xed28ff,_0x461e5b){var _0x16d91a='';return db[_0xcbfc('0x3d')][_0xcbfc('0x4a')]({'where':{'id':_0x34e671[_0xcbfc('0x45')]['id']},'attributes':['id',_0xcbfc('0x54'),'password',_0xcbfc('0x55'),_0xcbfc('0x56'),_0xcbfc('0x57')]})['then'](handleEntityNotFound(_0xed28ff,null))[_0xcbfc('0x42')](function(_0x1640e9){if(_0x1640e9){_0x16d91a=_0x1640e9[_0xcbfc('0x57')];var _0x318346=_0x16d91a[_0xcbfc('0x58')](-0x1);if(_0x318346==='/'){_0x16d91a=_0x16d91a[_0xcbfc('0x59')](0x0,_0x16d91a[_0xcbfc('0x5a')](_0x318346));}var _0x562380={'method':_0xcbfc('0x5b'),'uri':util['format'](_0xcbfc('0x5c'),_0x16d91a,_0xcbfc('0x5d')),'json':!![]};switch(_0x1640e9[_0xcbfc('0x56')]){case'password':_0x562380[_0xcbfc('0x5e')]={'Authorization':util['format'](_0xcbfc('0x5f'),new Buffer(util[_0xcbfc('0x60')](_0xcbfc('0x61'),_0x1640e9[_0xcbfc('0x54')],_0x1640e9[_0xcbfc('0x62')]))[_0xcbfc('0x63')](_0xcbfc('0x64')))};break;case'token':_0x562380[_0xcbfc('0x5e')]={'Authorization':util[_0xcbfc('0x60')](_0xcbfc('0x5f'),new Buffer(util['format'](_0xcbfc('0x65'),_0x1640e9['username'],_0x1640e9[_0xcbfc('0x55')]))[_0xcbfc('0x63')](_0xcbfc('0x64')))};break;default:throw new db['Sequelize'][(_0xcbfc('0x66'))](_0xcbfc('0x67'));}return rp(_0x562380);}})['then'](function(_0xb3378d){if(_0xb3378d){var _0x58be73=[_0xcbfc('0x68'),'description',_0xcbfc('0x69'),_0xcbfc('0x6a')];_['remove'](_0xb3378d[_0xcbfc('0x5d')],function(_0x4cf2e1){return _0x58be73[_0xcbfc('0x6b')](_0x4cf2e1[_0xcbfc('0x2a')]);});return{'count':_0xb3378d[_0xcbfc('0x5d')][_0xcbfc('0x32')],'rows':_['map'](_0xb3378d[_0xcbfc('0x5d')],function(_0x4c1e0a){return{'id':_0x4c1e0a['id'],'name':_0x4c1e0a[_0xcbfc('0x6c')]>0x7?_0x4c1e0a[_0xcbfc('0x6d')]:_0x4c1e0a[_0xcbfc('0x2a')],'custom':_0x4c1e0a[_0xcbfc('0x6c')]>0x7?!![]:![],'options':_0x4c1e0a[_0xcbfc('0x6e')]?_0x4c1e0a[_0xcbfc('0x6e')]:_0x4c1e0a[_0xcbfc('0x6f')]?_0x4c1e0a[_0xcbfc('0x6f')]:[]};})};}})[_0xcbfc('0x42')](respondWithResult(_0xed28ff,null))[_0xcbfc('0x43')](function(_0x3a3b24){var _0x297513=_0x34e671[_0xcbfc('0x2c')][_0xcbfc('0x70')]?0x1f4:_0x3a3b24[_0xcbfc('0x71')]||0x1f4;logger[_0xcbfc('0x23')](_0xcbfc('0x72'),'getFields',_0x297513,JSON[_0xcbfc('0x73')](_0x3a3b24));delete _0x3a3b24['name'];if(_0x297513===0x191){_0x297513=0x190;}_0xed28ff[_0xcbfc('0x16')](_0x297513)['send'](_0x34e671[_0xcbfc('0x2c')][_0xcbfc('0x70')]?{'message':_0xcbfc('0x74'),'statusCode':_0x3a3b24[_0xcbfc('0x71')]}:_0x3a3b24);});}; \ No newline at end of file +var _0xcb91=['ZendeskAccount','rawAttributes','fieldName','key','map','query','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','type','VIRTUAL','options','findAll','rows','show','includeAll','include','find','create','body','params','catch','destroy','getConfigurations','keys','ZendeskConfiguration','addConfiguration','AccountId','channel','getDescriptions','ZendeskField','Subjects','Descriptions','getFields','findOne','username','password','token','remoteUri','slice','substring','GET','format','%s/%s','ticket_fields','authType','headers','Basic\x20%s','%s:%s','toString','%s/token:%s','base64','ValidationError','subject','group','assignee','remove','includes','position','system_field_options','custom_field_options','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','update','then','error','stack','name','send','index'];(function(_0x1883c8,_0x2392f4){var _0x19d9f9=function(_0x231bd5){while(--_0x231bd5){_0x1883c8['push'](_0x1883c8['shift']());}};_0x19d9f9(++_0x2392f4);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2e58c7,_0x23d092){_0x2e58c7=_0x2e58c7-0x0;var _0x26eb00=_0xcb91[_0x2e58c7];return _0x26eb00;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1cb9('0x0'));var jsonpatch=require(_0x1cb9('0x1'));var rp=require(_0x1cb9('0x2'));var moment=require(_0x1cb9('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1cb9('0x4'));var util=require(_0x1cb9('0x5'));var path=require('path');var sox=require(_0x1cb9('0x6'));var csv=require(_0x1cb9('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1cb9('0x8'));var _=require(_0x1cb9('0x9'));var squel=require('squel');var crypto=require(_0x1cb9('0xa'));var jsforce=require(_0x1cb9('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1cb9('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1cb9('0xc'));var authService=require(_0x1cb9('0xd'));var qs=require(_0x1cb9('0xe'));var as=require(_0x1cb9('0xf'));var hardwareService=require(_0x1cb9('0x10'));var logger=require('../../config/logger')(_0x1cb9('0x11'));var utils=require(_0x1cb9('0x12'));var config=require(_0x1cb9('0x13'));var licenseUtil=require(_0x1cb9('0x14'));var db=require(_0x1cb9('0x15'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x5e3c19,_0x59dec3){_0x59dec3=_0x59dec3||0xcc;return function(_0x358866){if(_0x358866){return _0x5e3c19[_0x1cb9('0x16')](_0x59dec3);}return _0x5e3c19[_0x1cb9('0x17')](_0x59dec3)[_0x1cb9('0x18')]();};}function respondWithResult(_0x56884d,_0x397727){_0x397727=_0x397727||0xc8;return function(_0x6ef389){if(_0x6ef389){return _0x56884d[_0x1cb9('0x17')](_0x397727)[_0x1cb9('0x19')](_0x6ef389);}};}function respondWithFilteredResult(_0x3e2d11,_0x5806d8){return function(_0x5572cb){if(_0x5572cb){var _0xd446a3=typeof _0x5806d8[_0x1cb9('0x1a')]===_0x1cb9('0x1b')&&typeof _0x5806d8[_0x1cb9('0x1c')]===_0x1cb9('0x1b');var _0xf22920=_0x5572cb[_0x1cb9('0x1d')];var _0x4e1340=_0xd446a3?0x0:_0x5806d8['offset'];var _0x1b2fa6=_0xd446a3?_0x5572cb[_0x1cb9('0x1d')]:_0x5806d8[_0x1cb9('0x1a')]+_0x5806d8[_0x1cb9('0x1c')];var _0x280a84;if(_0x1b2fa6>=_0xf22920){_0x1b2fa6=_0xf22920;_0x280a84=0xc8;}else{_0x280a84=0xce;}_0x3e2d11[_0x1cb9('0x17')](_0x280a84);return _0x3e2d11[_0x1cb9('0x1e')]('Content-Range',_0x4e1340+'-'+_0x1b2fa6+'/'+_0xf22920)['json'](_0x5572cb);}return null;};}function patchUpdates(_0x1a5a72){return function(_0x5dbfae){try{jsonpatch[_0x1cb9('0x1f')](_0x5dbfae,_0x1a5a72,!![]);}catch(_0x2265ea){return BPromise['reject'](_0x2265ea);}return _0x5dbfae['save']();};}function saveUpdates(_0x2e3854,_0x325637){return function(_0x103a63){if(_0x103a63){return _0x103a63[_0x1cb9('0x20')](_0x2e3854)[_0x1cb9('0x21')](function(_0x27db16){return _0x27db16;});}return null;};}function removeEntity(_0x59ebea,_0x55b232){return function(_0x6c6f61){if(_0x6c6f61){return _0x6c6f61['destroy']()[_0x1cb9('0x21')](function(){_0x59ebea[_0x1cb9('0x17')](0xcc)[_0x1cb9('0x18')]();});}};}function handleEntityNotFound(_0x44d3c4,_0x43a100){return function(_0x53f9fa){if(!_0x53f9fa){_0x44d3c4[_0x1cb9('0x16')](0x194);}return _0x53f9fa;};}function handleError(_0x9df250,_0x4c8d76){_0x4c8d76=_0x4c8d76||0x1f4;return function(_0xd6891c){logger[_0x1cb9('0x22')](_0xd6891c[_0x1cb9('0x23')]);if(_0xd6891c[_0x1cb9('0x24')]){delete _0xd6891c[_0x1cb9('0x24')];}_0x9df250[_0x1cb9('0x17')](_0x4c8d76)[_0x1cb9('0x25')](_0xd6891c);};}exports[_0x1cb9('0x26')]=function(_0x41e5c2,_0x9de64b){var _0x48888d={},_0x405a2f={},_0x536635={'count':0x0,'rows':[]};var _0x110282=_['map'](db[_0x1cb9('0x27')][_0x1cb9('0x28')],function(_0x3cd7f5){return{'name':_0x3cd7f5[_0x1cb9('0x29')],'type':_0x3cd7f5['type'][_0x1cb9('0x2a')]};});_0x405a2f['model']=_[_0x1cb9('0x2b')](_0x110282,_0x1cb9('0x24'));_0x405a2f[_0x1cb9('0x2c')]=_['keys'](_0x41e5c2[_0x1cb9('0x2c')]);_0x405a2f['filters']=_[_0x1cb9('0x2d')](_0x405a2f['model'],_0x405a2f[_0x1cb9('0x2c')]);_0x48888d[_0x1cb9('0x2e')]=_[_0x1cb9('0x2d')](_0x405a2f[_0x1cb9('0x2f')],qs['fields'](_0x41e5c2[_0x1cb9('0x2c')][_0x1cb9('0x30')]));_0x48888d[_0x1cb9('0x2e')]=_0x48888d[_0x1cb9('0x2e')][_0x1cb9('0x31')]?_0x48888d[_0x1cb9('0x2e')]:_0x405a2f[_0x1cb9('0x2f')];if(!_0x41e5c2[_0x1cb9('0x2c')][_0x1cb9('0x32')](_0x1cb9('0x33'))){_0x48888d[_0x1cb9('0x1c')]=qs[_0x1cb9('0x1c')](_0x41e5c2[_0x1cb9('0x2c')]['limit']);_0x48888d['offset']=qs[_0x1cb9('0x1a')](_0x41e5c2[_0x1cb9('0x2c')][_0x1cb9('0x1a')]);}_0x48888d[_0x1cb9('0x34')]=qs[_0x1cb9('0x35')](_0x41e5c2[_0x1cb9('0x2c')][_0x1cb9('0x35')]);_0x48888d[_0x1cb9('0x36')]=qs['filters'](_[_0x1cb9('0x37')](_0x41e5c2[_0x1cb9('0x2c')],_0x405a2f[_0x1cb9('0x38')]),_0x110282);if(_0x41e5c2['query'][_0x1cb9('0x39')]){_0x48888d['where']=_[_0x1cb9('0x3a')](_0x48888d['where'],{'$or':_[_0x1cb9('0x2b')](_0x110282,function(_0x13d4fd){if(_0x13d4fd[_0x1cb9('0x3b')]!==_0x1cb9('0x3c')){var _0x34ada2={};_0x34ada2[_0x13d4fd[_0x1cb9('0x24')]]={'$like':'%'+_0x41e5c2[_0x1cb9('0x2c')]['filter']+'%'};return _0x34ada2;}})});}_0x48888d=_['merge']({},_0x48888d,_0x41e5c2[_0x1cb9('0x3d')]);var _0x1d2723={'where':_0x48888d[_0x1cb9('0x36')]};return db[_0x1cb9('0x27')][_0x1cb9('0x1d')](_0x1d2723)[_0x1cb9('0x21')](function(_0x32130b){_0x536635['count']=_0x32130b;if(_0x41e5c2[_0x1cb9('0x2c')]['includeAll']){_0x48888d['include']=[{'all':!![]}];}return db['ZendeskAccount'][_0x1cb9('0x3e')](_0x48888d);})[_0x1cb9('0x21')](function(_0x1bf51c){_0x536635[_0x1cb9('0x3f')]=_0x1bf51c;return _0x536635;})[_0x1cb9('0x21')](respondWithFilteredResult(_0x9de64b,_0x48888d))['catch'](handleError(_0x9de64b,null));};exports[_0x1cb9('0x40')]=function(_0x523866,_0x91121){var _0x71db9d={'raw':![],'where':{'id':_0x523866['params']['id']}},_0x38d973={};_0x38d973[_0x1cb9('0x2f')]=_['keys'](db[_0x1cb9('0x27')][_0x1cb9('0x28')]);_0x38d973['query']=_['keys'](_0x523866[_0x1cb9('0x2c')]);_0x38d973[_0x1cb9('0x38')]=_[_0x1cb9('0x2d')](_0x38d973[_0x1cb9('0x2f')],_0x38d973[_0x1cb9('0x2c')]);_0x71db9d['attributes']=_[_0x1cb9('0x2d')](_0x38d973['model'],qs['fields'](_0x523866['query'][_0x1cb9('0x30')]));_0x71db9d[_0x1cb9('0x2e')]=_0x71db9d[_0x1cb9('0x2e')][_0x1cb9('0x31')]?_0x71db9d[_0x1cb9('0x2e')]:_0x38d973[_0x1cb9('0x2f')];if(_0x523866[_0x1cb9('0x2c')][_0x1cb9('0x41')]){_0x71db9d[_0x1cb9('0x42')]=[{'all':!![]}];}_0x71db9d=_[_0x1cb9('0x3a')]({},_0x71db9d,_0x523866[_0x1cb9('0x3d')]);return db['ZendeskAccount'][_0x1cb9('0x43')](_0x71db9d)[_0x1cb9('0x21')](handleEntityNotFound(_0x91121,null))[_0x1cb9('0x21')](respondWithResult(_0x91121,null))['catch'](handleError(_0x91121,null));};exports[_0x1cb9('0x44')]=function(_0x57251,_0x3c6044){return db[_0x1cb9('0x27')][_0x1cb9('0x44')](_0x57251['body'],{})[_0x1cb9('0x21')](respondWithResult(_0x3c6044,0xc9))['catch'](handleError(_0x3c6044,null));};exports[_0x1cb9('0x20')]=function(_0x4ac483,_0x1cf2ee){if(_0x4ac483[_0x1cb9('0x45')]['id']){delete _0x4ac483[_0x1cb9('0x45')]['id'];}return db[_0x1cb9('0x27')]['find']({'where':{'id':_0x4ac483[_0x1cb9('0x46')]['id']}})[_0x1cb9('0x21')](handleEntityNotFound(_0x1cf2ee,null))[_0x1cb9('0x21')](saveUpdates(_0x4ac483[_0x1cb9('0x45')],null))[_0x1cb9('0x21')](respondWithResult(_0x1cf2ee,null))[_0x1cb9('0x47')](handleError(_0x1cf2ee,null));};exports[_0x1cb9('0x48')]=function(_0x3b6a92,_0xbb500e){return db[_0x1cb9('0x27')]['find']({'where':{'id':_0x3b6a92['params']['id']}})[_0x1cb9('0x21')](handleEntityNotFound(_0xbb500e,null))[_0x1cb9('0x21')](removeEntity(_0xbb500e,null))[_0x1cb9('0x47')](handleError(_0xbb500e,null));};exports[_0x1cb9('0x49')]=function(_0x20b253,_0x2d076b,_0x367dd7){var _0x1c4ff6={};var _0x36c53a={};var _0x166ca2;var _0x4a4b87;return db[_0x1cb9('0x27')]['findOne']({'where':{'id':_0x20b253[_0x1cb9('0x46')]['id']}})['then'](handleEntityNotFound(_0x2d076b,null))[_0x1cb9('0x21')](function(_0x53c002){if(_0x53c002){_0x166ca2=_0x53c002;_0x36c53a['model']=_[_0x1cb9('0x4a')](db[_0x1cb9('0x4b')][_0x1cb9('0x28')]);_0x36c53a['query']=_[_0x1cb9('0x4a')](_0x20b253[_0x1cb9('0x2c')]);_0x36c53a['filters']=_['intersection'](_0x36c53a[_0x1cb9('0x2f')],_0x36c53a[_0x1cb9('0x2c')]);_0x1c4ff6[_0x1cb9('0x2e')]=_[_0x1cb9('0x2d')](_0x36c53a[_0x1cb9('0x2f')],qs[_0x1cb9('0x30')](_0x20b253[_0x1cb9('0x2c')]['fields']));_0x1c4ff6[_0x1cb9('0x2e')]=_0x1c4ff6[_0x1cb9('0x2e')][_0x1cb9('0x31')]?_0x1c4ff6['attributes']:_0x36c53a[_0x1cb9('0x2f')];_0x1c4ff6[_0x1cb9('0x34')]=qs[_0x1cb9('0x35')](_0x20b253[_0x1cb9('0x2c')][_0x1cb9('0x35')]);_0x1c4ff6[_0x1cb9('0x36')]=qs['filters'](_[_0x1cb9('0x37')](_0x20b253[_0x1cb9('0x2c')],_0x36c53a[_0x1cb9('0x38')]));if(_0x20b253[_0x1cb9('0x2c')][_0x1cb9('0x39')]){_0x1c4ff6[_0x1cb9('0x36')]=_[_0x1cb9('0x3a')](_0x1c4ff6[_0x1cb9('0x36')],{'$or':_[_0x1cb9('0x2b')](_0x1c4ff6[_0x1cb9('0x2e')],function(_0x370c97){var _0x55fb51={};_0x55fb51[_0x370c97]={'$like':'%'+_0x20b253[_0x1cb9('0x2c')][_0x1cb9('0x39')]+'%'};return _0x55fb51;})});}_0x1c4ff6=_[_0x1cb9('0x3a')]({},_0x1c4ff6,_0x20b253[_0x1cb9('0x3d')]);return _0x166ca2['getConfigurations'](_0x1c4ff6);}})['then'](function(_0x319358){if(_0x319358){_0x4a4b87=_0x319358[_0x1cb9('0x31')];if(!_0x20b253[_0x1cb9('0x2c')][_0x1cb9('0x32')](_0x1cb9('0x33'))){_0x1c4ff6[_0x1cb9('0x1c')]=qs[_0x1cb9('0x1c')](_0x20b253[_0x1cb9('0x2c')]['limit']);_0x1c4ff6['offset']=qs[_0x1cb9('0x1a')](_0x20b253['query']['offset']);}return _0x166ca2['getConfigurations'](_0x1c4ff6);}})['then'](function(_0x5d349b){if(_0x5d349b){return _0x5d349b?{'count':_0x4a4b87,'rows':_0x5d349b}:null;}})[_0x1cb9('0x21')](respondWithResult(_0x2d076b,null))[_0x1cb9('0x47')](handleError(_0x2d076b,null));};exports[_0x1cb9('0x4c')]=function(_0x43bafc,_0x23d435,_0xccbee3){if(_0x43bafc['body']['id']){delete _0x43bafc[_0x1cb9('0x45')]['id'];}return db[_0x1cb9('0x27')]['findOne']({'where':{'id':_0x43bafc['params']['id']}})[_0x1cb9('0x21')](handleEntityNotFound(_0x23d435,null))[_0x1cb9('0x21')](function(_0x2e818f){if(_0x2e818f){_0x43bafc[_0x1cb9('0x45')][_0x1cb9('0x4d')]=_0x2e818f['id'];_0x43bafc['body']['Subjects']=integrations['getSubjects'](_0x43bafc[_0x1cb9('0x45')][_0x1cb9('0x4e')],_0x43bafc[_0x1cb9('0x45')][_0x1cb9('0x3b')]);_0x43bafc[_0x1cb9('0x45')]['Descriptions']=integrations[_0x1cb9('0x4f')](_0x43bafc[_0x1cb9('0x45')]['channel'],_0x43bafc['body'][_0x1cb9('0x3b')]);return db['ZendeskConfiguration'][_0x1cb9('0x44')](_0x43bafc[_0x1cb9('0x45')],{'include':[{'model':db[_0x1cb9('0x50')],'as':_0x1cb9('0x51')},{'model':db[_0x1cb9('0x50')],'as':_0x1cb9('0x52')}]});}return null;})['then'](respondWithResult(_0x23d435,null))[_0x1cb9('0x47')](handleError(_0x23d435,null));};exports[_0x1cb9('0x53')]=function(_0x330fc1,_0x17c361,_0x5b5f0d){var _0x520d98='';return db[_0x1cb9('0x27')][_0x1cb9('0x54')]({'where':{'id':_0x330fc1[_0x1cb9('0x46')]['id']},'attributes':['id',_0x1cb9('0x55'),_0x1cb9('0x56'),_0x1cb9('0x57'),'authType',_0x1cb9('0x58')]})['then'](handleEntityNotFound(_0x17c361,null))[_0x1cb9('0x21')](function(_0x26dae9){if(_0x26dae9){_0x520d98=_0x26dae9['remoteUri'];var _0xf5b006=_0x520d98[_0x1cb9('0x59')](-0x1);if(_0xf5b006==='/'){_0x520d98=_0x520d98[_0x1cb9('0x5a')](0x0,_0x520d98['lastIndexOf'](_0xf5b006));}var _0x1b4878={'method':_0x1cb9('0x5b'),'uri':util[_0x1cb9('0x5c')](_0x1cb9('0x5d'),_0x520d98,_0x1cb9('0x5e')),'json':!![]};switch(_0x26dae9[_0x1cb9('0x5f')]){case'password':_0x1b4878[_0x1cb9('0x60')]={'Authorization':util[_0x1cb9('0x5c')](_0x1cb9('0x61'),new Buffer(util[_0x1cb9('0x5c')](_0x1cb9('0x62'),_0x26dae9[_0x1cb9('0x55')],_0x26dae9[_0x1cb9('0x56')]))[_0x1cb9('0x63')]('base64'))};break;case _0x1cb9('0x57'):_0x1b4878[_0x1cb9('0x60')]={'Authorization':util['format'](_0x1cb9('0x61'),new Buffer(util['format'](_0x1cb9('0x64'),_0x26dae9['username'],_0x26dae9['token']))[_0x1cb9('0x63')](_0x1cb9('0x65')))};break;default:throw new db['Sequelize'][(_0x1cb9('0x66'))]('Unknown\x20authentication\x20type');}return rp(_0x1b4878);}})[_0x1cb9('0x21')](function(_0x7ecb4e){if(_0x7ecb4e){var _0x399986=[_0x1cb9('0x67'),'description',_0x1cb9('0x68'),_0x1cb9('0x69')];_[_0x1cb9('0x6a')](_0x7ecb4e[_0x1cb9('0x5e')],function(_0x4f8d74){return _0x399986[_0x1cb9('0x6b')](_0x4f8d74['type']);});return{'count':_0x7ecb4e[_0x1cb9('0x5e')][_0x1cb9('0x31')],'rows':_[_0x1cb9('0x2b')](_0x7ecb4e[_0x1cb9('0x5e')],function(_0x102f2c){return{'id':_0x102f2c['id'],'name':_0x102f2c[_0x1cb9('0x6c')]>0x7?_0x102f2c['title']:_0x102f2c[_0x1cb9('0x3b')],'custom':_0x102f2c[_0x1cb9('0x6c')]>0x7?!![]:![],'options':_0x102f2c['system_field_options']?_0x102f2c[_0x1cb9('0x6d')]:_0x102f2c[_0x1cb9('0x6e')]?_0x102f2c[_0x1cb9('0x6e')]:[]};})};}})[_0x1cb9('0x21')](respondWithResult(_0x17c361,null))[_0x1cb9('0x47')](function(_0x209dc7){var _0x423aae=_0x330fc1['query'][_0x1cb9('0x6f')]?0x1f4:_0x209dc7['statusCode']||0x1f4;logger[_0x1cb9('0x22')](_0x1cb9('0x70'),'getFields',_0x423aae,JSON[_0x1cb9('0x71')](_0x209dc7));delete _0x209dc7[_0x1cb9('0x24')];if(_0x423aae===0x191){_0x423aae=0x190;}_0x17c361[_0x1cb9('0x17')](_0x423aae)[_0x1cb9('0x25')](_0x330fc1['query'][_0x1cb9('0x6f')]?{'message':_0x1cb9('0x72'),'statusCode':_0x209dc7[_0x1cb9('0x73')]}:_0x209dc7);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index af873f4..a745664 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 _0x2f2d=['./intZendeskAccount.attributes','../../components/integrations/configuration','define','ZendeskAccount','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment'];(function(_0xa90e10,_0x377ff7){var _0xe61724=function(_0x3695b4){while(--_0x3695b4){_0xa90e10['push'](_0xa90e10['shift']());}};_0xe61724(++_0x377ff7);}(_0x2f2d,0x1c0));var _0xd2f2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2f2d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd2f2('0x0'));var util=require(_0xd2f2('0x1'));var logger=require(_0xd2f2('0x2'))(_0xd2f2('0x3'));var moment=require('moment');var BPromise=require(_0xd2f2('0x4'));var rp=require(_0xd2f2('0x5'));var fs=require('fs');var path=require(_0xd2f2('0x6'));var rimraf=require('rimraf');var config=require(_0xd2f2('0x7'));var attributes=require(_0xd2f2('0x8'));var integrations=require(_0xd2f2('0x9'));module['exports']=function(_0x2dce8e,_0x9ee940){return _0x2dce8e[_0xd2f2('0xa')](_0xd2f2('0xb'),attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xddee=['./intZendeskAccount.attributes','exports','define','ZendeskAccount','int_zendesk_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2d4884,_0x10a24d){var _0xa68beb=function(_0x146b78){while(--_0x146b78){_0x2d4884['push'](_0x2d4884['shift']());}};_0xa68beb(++_0x10a24d);}(_0xddee,0x1b8));var _0xedde=function(_0x19dd7a,_0x51de21){_0x19dd7a=_0x19dd7a-0x0;var _0x3feb6a=_0xddee[_0x19dd7a];return _0x3feb6a;};'use strict';var _=require(_0xedde('0x0'));var util=require(_0xedde('0x1'));var logger=require(_0xedde('0x2'))(_0xedde('0x3'));var moment=require(_0xedde('0x4'));var BPromise=require(_0xedde('0x5'));var rp=require(_0xedde('0x6'));var fs=require('fs');var path=require(_0xedde('0x7'));var rimraf=require(_0xedde('0x8'));var config=require(_0xedde('0x9'));var attributes=require(_0xedde('0xa'));var integrations=require('../../components/integrations/configuration');module[_0xedde('0xb')]=function(_0x3fa00a,_0x396ce5){return _0x3fa00a[_0xedde('0xc')](_0xedde('0xd'),attributes,{'tableName':_0xedde('0xe'),'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 9341608..5291234 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 _0x5554=['ZendeskAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','GetZendeskAccount','findAll','options','limit','map','include','attributes','model','ShowZendeskAccount','find','raw','where','lodash','util','moment','bluebird','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x435044,_0x36ab8e){var _0x33d4c6=function(_0x15efa0){while(--_0x15efa0){_0x435044['push'](_0x435044['shift']());}};_0x33d4c6(++_0x36ab8e);}(_0x5554,0xfc));var _0x4555=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0x5554[_0x2ec461];return _0x28603d;};'use strict';var _=require(_0x4555('0x0'));var util=require(_0x4555('0x1'));var moment=require(_0x4555('0x2'));var BPromise=require(_0x4555('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4555('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x4555('0x5'));var jayson=require(_0x4555('0x6'));var client=jayson[_0x4555('0x7')][_0x4555('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x94b9ff,_0x336a9c,_0x165016){return new BPromise(function(_0x2e1b43,_0x394927){return client[_0x4555('0x9')](_0x94b9ff,_0x165016)[_0x4555('0xa')](function(_0x19669d){logger[_0x4555('0xb')](_0x4555('0xc'),_0x336a9c,'request\x20sent');logger[_0x4555('0xd')]('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x336a9c,_0x4555('0xe'),JSON[_0x4555('0xf')](_0x19669d));if(_0x19669d[_0x4555('0x10')]){if(_0x19669d[_0x4555('0x10')][_0x4555('0x11')]===0x1f4){logger[_0x4555('0x10')](_0x4555('0xc'),_0x336a9c,_0x19669d['error'][_0x4555('0x12')]);return _0x394927(_0x19669d[_0x4555('0x10')][_0x4555('0x12')]);}logger[_0x4555('0x10')]('ZendeskAccount,\x20%s,\x20%s',_0x336a9c,_0x19669d['error'][_0x4555('0x12')]);return _0x2e1b43(_0x19669d[_0x4555('0x10')][_0x4555('0x12')]);}else{logger[_0x4555('0xb')](_0x4555('0xc'),_0x336a9c,_0x4555('0xe'));_0x2e1b43(_0x19669d[_0x4555('0x13')][_0x4555('0x12')]);}})[_0x4555('0x14')](function(_0x393f4a){logger[_0x4555('0x10')](_0x4555('0xc'),_0x336a9c,_0x393f4a);_0x394927(_0x393f4a);});});}exports[_0x4555('0x15')]=function(_0x55ed4c){var _0x526cb6=this;return new Promise(function(_0x17fec6,_0x4e351d){return db['ZendeskAccount'][_0x4555('0x16')]({'raw':_0x55ed4c[_0x4555('0x17')]?_0x55ed4c[_0x4555('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x55ed4c[_0x4555('0x17')]?_0x55ed4c[_0x4555('0x17')]['where']||null:null,'attributes':_0x55ed4c['options']?_0x55ed4c[_0x4555('0x17')]['attributes']||null:null,'limit':_0x55ed4c[_0x4555('0x17')]?_0x55ed4c[_0x4555('0x17')][_0x4555('0x18')]||null:null,'include':_0x55ed4c[_0x4555('0x17')]?_0x55ed4c['options']['include']?_[_0x4555('0x19')](_0x55ed4c['options'][_0x4555('0x1a')],function(_0x1e8e25){return{'model':db[_0x1e8e25['model']],'as':_0x1e8e25['as'],'attributes':_0x1e8e25[_0x4555('0x1b')],'include':_0x1e8e25[_0x4555('0x1a')]?_['map'](_0x1e8e25['include'],function(_0x211b47){return{'model':db[_0x211b47[_0x4555('0x1c')]],'as':_0x211b47['as'],'attributes':_0x211b47['attributes'],'include':_0x211b47['include']?_[_0x4555('0x19')](_0x211b47[_0x4555('0x1a')],function(_0x1af6f1){return{'model':db[_0x1af6f1[_0x4555('0x1c')]],'as':_0x1af6f1['as'],'attributes':_0x1af6f1[_0x4555('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x4555('0xa')](function(_0x242a43){logger[_0x4555('0xb')](_0x4555('0x15'),_0x55ed4c);logger[_0x4555('0xd')](_0x4555('0x15'),_0x55ed4c,JSON['stringify'](_0x242a43));_0x17fec6(_0x242a43);})[_0x4555('0x14')](function(_0x263d75){logger[_0x4555('0x10')](_0x4555('0x15'),_0x263d75[_0x4555('0x12')],_0x55ed4c);_0x4e351d(_0x526cb6[_0x4555('0x10')](0x1f4,_0x263d75[_0x4555('0x12')]));});});};exports[_0x4555('0x1d')]=function(_0x44f196){var _0x1ab041=this;return new Promise(function(_0x367124,_0x42bbeb){return db['ZendeskAccount'][_0x4555('0x1e')]({'raw':_0x44f196[_0x4555('0x17')]?_0x44f196[_0x4555('0x17')][_0x4555('0x1f')]===undefined?!![]:![]:!![],'where':_0x44f196[_0x4555('0x17')]?_0x44f196[_0x4555('0x17')][_0x4555('0x20')]||null:null,'attributes':_0x44f196['options']?_0x44f196[_0x4555('0x17')]['attributes']||null:null,'include':_0x44f196[_0x4555('0x17')]?_0x44f196['options'][_0x4555('0x1a')]?_[_0x4555('0x19')](_0x44f196[_0x4555('0x17')][_0x4555('0x1a')],function(_0x265ccc){return{'model':db[_0x265ccc[_0x4555('0x1c')]],'as':_0x265ccc['as'],'attributes':_0x265ccc[_0x4555('0x1b')],'include':_0x265ccc[_0x4555('0x1a')]?_[_0x4555('0x19')](_0x265ccc[_0x4555('0x1a')],function(_0x4ad440){return{'model':db[_0x4ad440[_0x4555('0x1c')]],'as':_0x4ad440['as'],'attributes':_0x4ad440[_0x4555('0x1b')],'include':_0x4ad440['include']?_[_0x4555('0x19')](_0x4ad440[_0x4555('0x1a')],function(_0x1d036e){return{'model':db[_0x1d036e[_0x4555('0x1c')]],'as':_0x1d036e['as'],'attributes':_0x1d036e['attributes']};}):[]};}):[]};}):[]:[]})[_0x4555('0xa')](function(_0x3eb71b){logger[_0x4555('0xb')]('ShowZendeskAccount',_0x44f196);logger[_0x4555('0xd')](_0x4555('0x1d'),_0x44f196,JSON[_0x4555('0xf')](_0x3eb71b));_0x367124(_0x3eb71b);})[_0x4555('0x14')](function(_0x5c4f9e){logger['error']('ShowZendeskAccount',_0x5c4f9e[_0x4555('0x12')],_0x44f196);_0x42bbeb(_0x1ab041[_0x4555('0x10')](0x1f4,_0x5c4f9e[_0x4555('0x12')]));});});}; \ No newline at end of file +var _0x7c69=['stringify','code','error','message','result','catch','options','attributes','limit','map','model','include','GetZendeskAccount','find','raw','where','ShowZendeskAccount','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x5d653f,_0x92b8a1){var _0x4129e9=function(_0x5a04f2){while(--_0x5a04f2){_0x5d653f['push'](_0x5d653f['shift']());}};_0x4129e9(++_0x92b8a1);}(_0x7c69,0x1cd));var _0x97c6=function(_0x4e231f,_0x315a9e){_0x4e231f=_0x4e231f-0x0;var _0x43a501=_0x7c69[_0x4e231f];return _0x43a501;};'use strict';var _=require('lodash');var util=require(_0x97c6('0x0'));var moment=require(_0x97c6('0x1'));var BPromise=require(_0x97c6('0x2'));var rs=require(_0x97c6('0x3'));var fs=require('fs');var Redis=require(_0x97c6('0x4'));var db=require(_0x97c6('0x5'))['db'];var utils=require(_0x97c6('0x6'));var logger=require(_0x97c6('0x7'))(_0x97c6('0x8'));var config=require(_0x97c6('0x9'));var jayson=require(_0x97c6('0xa'));var client=jayson[_0x97c6('0xb')][_0x97c6('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1ec04d,_0x141bdb,_0x608021){return new BPromise(function(_0x20b718,_0x119c45){return client[_0x97c6('0xd')](_0x1ec04d,_0x608021)[_0x97c6('0xe')](function(_0x4f107b){logger[_0x97c6('0xf')](_0x97c6('0x10'),_0x141bdb,'request\x20sent');logger[_0x97c6('0x11')](_0x97c6('0x12'),_0x141bdb,_0x97c6('0x13'),JSON[_0x97c6('0x14')](_0x4f107b));if(_0x4f107b['error']){if(_0x4f107b['error'][_0x97c6('0x15')]===0x1f4){logger[_0x97c6('0x16')](_0x97c6('0x10'),_0x141bdb,_0x4f107b['error']['message']);return _0x119c45(_0x4f107b[_0x97c6('0x16')][_0x97c6('0x17')]);}logger[_0x97c6('0x16')](_0x97c6('0x10'),_0x141bdb,_0x4f107b['error']['message']);return _0x20b718(_0x4f107b[_0x97c6('0x16')]['message']);}else{logger[_0x97c6('0xf')](_0x97c6('0x10'),_0x141bdb,_0x97c6('0x13'));_0x20b718(_0x4f107b[_0x97c6('0x18')][_0x97c6('0x17')]);}})[_0x97c6('0x19')](function(_0x532097){logger[_0x97c6('0x16')]('ZendeskAccount,\x20%s,\x20%s',_0x141bdb,_0x532097);_0x119c45(_0x532097);});});}exports['GetZendeskAccount']=function(_0x338b72){var _0x57275d=this;return new Promise(function(_0x29b2ea,_0x31199d){return db['ZendeskAccount']['findAll']({'raw':_0x338b72[_0x97c6('0x1a')]?_0x338b72[_0x97c6('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x338b72[_0x97c6('0x1a')]?_0x338b72[_0x97c6('0x1a')]['where']||null:null,'attributes':_0x338b72[_0x97c6('0x1a')]?_0x338b72[_0x97c6('0x1a')][_0x97c6('0x1b')]||null:null,'limit':_0x338b72[_0x97c6('0x1a')]?_0x338b72[_0x97c6('0x1a')][_0x97c6('0x1c')]||null:null,'include':_0x338b72['options']?_0x338b72[_0x97c6('0x1a')]['include']?_[_0x97c6('0x1d')](_0x338b72[_0x97c6('0x1a')]['include'],function(_0x3ac049){return{'model':db[_0x3ac049[_0x97c6('0x1e')]],'as':_0x3ac049['as'],'attributes':_0x3ac049[_0x97c6('0x1b')],'include':_0x3ac049['include']?_[_0x97c6('0x1d')](_0x3ac049[_0x97c6('0x1f')],function(_0x567102){return{'model':db[_0x567102[_0x97c6('0x1e')]],'as':_0x567102['as'],'attributes':_0x567102[_0x97c6('0x1b')],'include':_0x567102[_0x97c6('0x1f')]?_[_0x97c6('0x1d')](_0x567102[_0x97c6('0x1f')],function(_0x4cd7bd){return{'model':db[_0x4cd7bd['model']],'as':_0x4cd7bd['as'],'attributes':_0x4cd7bd[_0x97c6('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x97c6('0xe')](function(_0x33e0d0){logger['info'](_0x97c6('0x20'),_0x338b72);logger['debug'](_0x97c6('0x20'),_0x338b72,JSON[_0x97c6('0x14')](_0x33e0d0));_0x29b2ea(_0x33e0d0);})[_0x97c6('0x19')](function(_0x4d181a){logger[_0x97c6('0x16')](_0x97c6('0x20'),_0x4d181a[_0x97c6('0x17')],_0x338b72);_0x31199d(_0x57275d[_0x97c6('0x16')](0x1f4,_0x4d181a[_0x97c6('0x17')]));});});};exports['ShowZendeskAccount']=function(_0x24a0ad){var _0x2343b5=this;return new Promise(function(_0x2d8c61,_0x3a24b3){return db['ZendeskAccount'][_0x97c6('0x21')]({'raw':_0x24a0ad[_0x97c6('0x1a')]?_0x24a0ad['options'][_0x97c6('0x22')]===undefined?!![]:![]:!![],'where':_0x24a0ad[_0x97c6('0x1a')]?_0x24a0ad['options'][_0x97c6('0x23')]||null:null,'attributes':_0x24a0ad['options']?_0x24a0ad['options'][_0x97c6('0x1b')]||null:null,'include':_0x24a0ad[_0x97c6('0x1a')]?_0x24a0ad[_0x97c6('0x1a')][_0x97c6('0x1f')]?_[_0x97c6('0x1d')](_0x24a0ad[_0x97c6('0x1a')][_0x97c6('0x1f')],function(_0x4f7684){return{'model':db[_0x4f7684['model']],'as':_0x4f7684['as'],'attributes':_0x4f7684['attributes'],'include':_0x4f7684[_0x97c6('0x1f')]?_[_0x97c6('0x1d')](_0x4f7684['include'],function(_0x47c168){return{'model':db[_0x47c168['model']],'as':_0x47c168['as'],'attributes':_0x47c168['attributes'],'include':_0x47c168[_0x97c6('0x1f')]?_[_0x97c6('0x1d')](_0x47c168[_0x97c6('0x1f')],function(_0x1de00a){return{'model':db[_0x1de00a[_0x97c6('0x1e')]],'as':_0x1de00a['as'],'attributes':_0x1de00a[_0x97c6('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x97c6('0xe')](function(_0xfabc03){logger['info'](_0x97c6('0x24'),_0x24a0ad);logger[_0x97c6('0x11')](_0x97c6('0x24'),_0x24a0ad,JSON[_0x97c6('0x14')](_0xfabc03));_0x2d8c61(_0xfabc03);})[_0x97c6('0x19')](function(_0x15a70c){logger[_0x97c6('0x16')](_0x97c6('0x24'),_0x15a70c[_0x97c6('0x17')],_0x24a0ad);_0x3a24b3(_0x2343b5['error'](0x1f4,_0x15a70c['message']));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index abf8bc4..59e0d38 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(_0xa3d2d8,_0x2b23c7){var _0x1c4b8a=function(_0x51bd4d){while(--_0x51bd4d){_0xa3d2d8['push'](_0xa3d2d8['shift']());}};_0x1c4b8a(++_0x2b23c7);}(_0xa571,0x107));var _0x1a57=function(_0xcd40f6,_0x45e0df){_0xcd40f6=_0xcd40f6-0x0;var _0x464ee5=_0xa571[_0xcd40f6];return _0x464ee5;};'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 _0xb688=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','update','exports','util'];(function(_0x2d4065,_0x38dc95){var _0xef6016=function(_0x195cee){while(--_0x195cee){_0x2d4065['push'](_0x2d4065['shift']());}};_0xef6016(++_0x38dc95);}(_0xb688,0xcf));var _0x8b68=function(_0x38437c,_0x5adbae){_0x38437c=_0x38437c-0x0;var _0x299fb2=_0xb688[_0x38437c];return _0x299fb2;};'use strict';var multer=require('multer');var util=require(_0x8b68('0x0'));var path=require(_0x8b68('0x1'));var timeout=require(_0x8b68('0x2'));var express=require(_0x8b68('0x3'));var router=express[_0x8b68('0x4')]();var fs_extra=require(_0x8b68('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8b68('0x6'));var config=require(_0x8b68('0x7'));var controller=require(_0x8b68('0x8'));router[_0x8b68('0x9')]('/',auth['isAuthenticated'](),controller[_0x8b68('0xa')]);router['get'](_0x8b68('0xb'),auth[_0x8b68('0xc')](),controller[_0x8b68('0xd')]);router[_0x8b68('0x9')](_0x8b68('0xe'),auth[_0x8b68('0xc')](),controller[_0x8b68('0xf')]);router[_0x8b68('0x9')](_0x8b68('0x10'),auth[_0x8b68('0xc')](),controller[_0x8b68('0x11')]);router[_0x8b68('0x9')](_0x8b68('0x12'),auth['isAuthenticated'](),controller[_0x8b68('0x13')]);router[_0x8b68('0x9')](_0x8b68('0x14'),auth[_0x8b68('0xc')](),controller[_0x8b68('0x15')]);router[_0x8b68('0x16')]('/',auth[_0x8b68('0xc')](),controller[_0x8b68('0x17')]);router[_0x8b68('0x16')]('/:id/tags',auth[_0x8b68('0xc')](),controller['setTags']);router['put'](_0x8b68('0xb'),auth[_0x8b68('0xc')](),controller[_0x8b68('0x18')]);router['delete']('/:id',auth[_0x8b68('0xc')](),controller['destroy']);module[_0x8b68('0x19')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 700443c..50490d2 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 _0xbc8d=['STRING','sequelize','exports'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xbc8d,0x15a));var _0xdbc8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbc8d[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xdbc8('0x0'));module[_0xdbc8('0x1')]={'name':{'type':Sequelize[_0xdbc8('0x2')]},'description':{'type':Sequelize[_0xdbc8('0x2')]}}; \ No newline at end of file +var _0x2dbe=['exports','STRING','sequelize'];(function(_0x20c24f,_0x4a8e8f){var _0x12e370=function(_0x35c931){while(--_0x35c931){_0x20c24f['push'](_0x20c24f['shift']());}};_0x12e370(++_0x4a8e8f);}(_0x2dbe,0x14f));var _0xe2db=function(_0x529296,_0x1a6a23){_0x529296=_0x529296-0x0;var _0x1796bf=_0x2dbe[_0x529296];return _0x1796bf;};'use strict';var Sequelize=require(_0xe2db('0x0'));module[_0xe2db('0x1')]={'name':{'type':Sequelize[_0xe2db('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 6b21aa6..a0bcce8 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 _0x1d2c=['offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','ZendeskConfiguration','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','map','type','include','findAll','rows','show','params','keys','catch','create','body','findOne','ZendeskField','order','options','getFields','getSubjects','getDescriptions','getTags','ids','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json'];(function(_0x4c4037,_0x15054b){var _0x357862=function(_0x480015){while(--_0x480015){_0x4c4037['push'](_0x4c4037['shift']());}};_0x357862(++_0x15054b);}(_0x1d2c,0x132));var _0xc1d2=function(_0x12cc45,_0x19d57b){_0x12cc45=_0x12cc45-0x0;var _0xf12864=_0x1d2c[_0x12cc45];return _0xf12864;};'use strict';var emlformat=require(_0xc1d2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc1d2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc1d2('0x2'));var moment=require(_0xc1d2('0x3'));var BPromise=require(_0xc1d2('0x4'));var Mustache=require(_0xc1d2('0x5'));var util=require(_0xc1d2('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xc1d2('0x7'));var ejs=require(_0xc1d2('0x8'));var fs=require('fs');var fs_extra=require(_0xc1d2('0x9'));var _=require(_0xc1d2('0xa'));var squel=require(_0xc1d2('0xb'));var crypto=require(_0xc1d2('0xc'));var jsforce=require(_0xc1d2('0xd'));var deskjs=require(_0xc1d2('0xe'));var toCsv=require(_0xc1d2('0x7'));var querystring=require(_0xc1d2('0xf'));var Papa=require(_0xc1d2('0x10'));var Redis=require(_0xc1d2('0x11'));var authService=require(_0xc1d2('0x12'));var qs=require(_0xc1d2('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc1d2('0x14'))(_0xc1d2('0x15'));var utils=require(_0xc1d2('0x16'));var config=require(_0xc1d2('0x17'));var licenseUtil=require(_0xc1d2('0x18'));var db=require(_0xc1d2('0x19'))['db'];function respondWithStatusCode(_0x122b22,_0xd0abdf){_0xd0abdf=_0xd0abdf||0xcc;return function(_0x4aa5b4){if(_0x4aa5b4){return _0x122b22[_0xc1d2('0x1a')](_0xd0abdf);}return _0x122b22[_0xc1d2('0x1b')](_0xd0abdf)[_0xc1d2('0x1c')]();};}function respondWithResult(_0xbfd38,_0x4084b8){_0x4084b8=_0x4084b8||0xc8;return function(_0x47a727){if(_0x47a727){return _0xbfd38[_0xc1d2('0x1b')](_0x4084b8)[_0xc1d2('0x1d')](_0x47a727);}};}function respondWithFilteredResult(_0x43c4bc,_0x10a01b){return function(_0x2537a2){if(_0x2537a2){var _0x43ec61=typeof _0x10a01b[_0xc1d2('0x1e')]===_0xc1d2('0x1f')&&typeof _0x10a01b[_0xc1d2('0x20')]==='undefined';var _0x4c760c=_0x2537a2[_0xc1d2('0x21')];var _0x4c9ab8=_0x43ec61?0x0:_0x10a01b['offset'];var _0x3cfc7f=_0x43ec61?_0x2537a2[_0xc1d2('0x21')]:_0x10a01b['offset']+_0x10a01b[_0xc1d2('0x20')];var _0x1074ac;if(_0x3cfc7f>=_0x4c760c){_0x3cfc7f=_0x4c760c;_0x1074ac=0xc8;}else{_0x1074ac=0xce;}_0x43c4bc[_0xc1d2('0x1b')](_0x1074ac);return _0x43c4bc[_0xc1d2('0x22')](_0xc1d2('0x23'),_0x4c9ab8+'-'+_0x3cfc7f+'/'+_0x4c760c)[_0xc1d2('0x1d')](_0x2537a2);}return null;};}function patchUpdates(_0x26fc30){return function(_0x5857ee){try{jsonpatch[_0xc1d2('0x24')](_0x5857ee,_0x26fc30,!![]);}catch(_0x523c8c){return BPromise[_0xc1d2('0x25')](_0x523c8c);}return _0x5857ee[_0xc1d2('0x26')]();};}function saveUpdates(_0x163396,_0xb38cd7){return function(_0x10abdf){if(_0x10abdf){return _0x10abdf[_0xc1d2('0x27')](_0x163396)[_0xc1d2('0x28')](function(_0x386a61){return _0x386a61;});}return null;};}function removeEntity(_0x5ad9d8,_0x3cc78e){return function(_0x112b88){if(_0x112b88){return _0x112b88[_0xc1d2('0x29')]()['then'](function(){_0x5ad9d8[_0xc1d2('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c8041,_0x5efc32){return function(_0x955b90){if(!_0x955b90){_0x2c8041[_0xc1d2('0x1a')](0x194);}return _0x955b90;};}function handleError(_0x528332,_0xc646fa){_0xc646fa=_0xc646fa||0x1f4;return function(_0x99a646){logger[_0xc1d2('0x2a')](_0x99a646['stack']);if(_0x99a646[_0xc1d2('0x2b')]){delete _0x99a646[_0xc1d2('0x2b')];}_0x528332[_0xc1d2('0x1b')](_0xc646fa)[_0xc1d2('0x2c')](_0x99a646);};}exports[_0xc1d2('0x2d')]=function(_0x5e4a21,_0x4488cc){var _0x44ce5a={},_0x4d4413={},_0x51a63a={'count':0x0,'rows':[]};var _0x320721=_['map'](db[_0xc1d2('0x2e')][_0xc1d2('0x2f')],function(_0x50d5d1){return{'name':_0x50d5d1[_0xc1d2('0x30')],'type':_0x50d5d1['type'][_0xc1d2('0x31')]};});_0x4d4413[_0xc1d2('0x32')]=_['map'](_0x320721,'name');_0x4d4413[_0xc1d2('0x33')]=_['keys'](_0x5e4a21['query']);_0x4d4413[_0xc1d2('0x34')]=_[_0xc1d2('0x35')](_0x4d4413['model'],_0x4d4413['query']);_0x44ce5a[_0xc1d2('0x36')]=_['intersection'](_0x4d4413[_0xc1d2('0x32')],qs[_0xc1d2('0x37')](_0x5e4a21['query']['fields']));_0x44ce5a[_0xc1d2('0x36')]=_0x44ce5a['attributes'][_0xc1d2('0x38')]?_0x44ce5a['attributes']:_0x4d4413['model'];if(!_0x5e4a21[_0xc1d2('0x33')][_0xc1d2('0x39')](_0xc1d2('0x3a'))){_0x44ce5a[_0xc1d2('0x20')]=qs[_0xc1d2('0x20')](_0x5e4a21['query'][_0xc1d2('0x20')]);_0x44ce5a[_0xc1d2('0x1e')]=qs['offset'](_0x5e4a21[_0xc1d2('0x33')][_0xc1d2('0x1e')]);}_0x44ce5a['order']=qs[_0xc1d2('0x3b')](_0x5e4a21[_0xc1d2('0x33')][_0xc1d2('0x3b')]);_0x44ce5a[_0xc1d2('0x3c')]=qs[_0xc1d2('0x34')](_[_0xc1d2('0x3d')](_0x5e4a21[_0xc1d2('0x33')],_0x4d4413[_0xc1d2('0x34')]),_0x320721);if(_0x5e4a21[_0xc1d2('0x33')][_0xc1d2('0x3e')]){_0x44ce5a['where']=_[_0xc1d2('0x3f')](_0x44ce5a[_0xc1d2('0x3c')],{'$or':_[_0xc1d2('0x40')](_0x320721,function(_0x2fd4cb){if(_0x2fd4cb[_0xc1d2('0x41')]!=='VIRTUAL'){var _0x464cfe={};_0x464cfe[_0x2fd4cb[_0xc1d2('0x2b')]]={'$like':'%'+_0x5e4a21['query'][_0xc1d2('0x3e')]+'%'};return _0x464cfe;}})});}_0x44ce5a=_[_0xc1d2('0x3f')]({},_0x44ce5a,_0x5e4a21['options']);var _0x304e8b={'where':_0x44ce5a['where']};return db['ZendeskConfiguration'][_0xc1d2('0x21')](_0x304e8b)[_0xc1d2('0x28')](function(_0x2addd4){_0x51a63a[_0xc1d2('0x21')]=_0x2addd4;if(_0x5e4a21['query']['includeAll']){_0x44ce5a[_0xc1d2('0x42')]=[{'all':!![]}];}return db[_0xc1d2('0x2e')][_0xc1d2('0x43')](_0x44ce5a);})[_0xc1d2('0x28')](function(_0x37e11d){_0x51a63a[_0xc1d2('0x44')]=_0x37e11d;return _0x51a63a;})[_0xc1d2('0x28')](respondWithFilteredResult(_0x4488cc,_0x44ce5a))['catch'](handleError(_0x4488cc,null));};exports[_0xc1d2('0x45')]=function(_0x52b10f,_0x5a2c20){var _0x4d9b8c={'raw':![],'where':{'id':_0x52b10f[_0xc1d2('0x46')]['id']}},_0x34bd92={};_0x34bd92['model']=_[_0xc1d2('0x47')](db[_0xc1d2('0x2e')][_0xc1d2('0x2f')]);_0x34bd92['query']=_[_0xc1d2('0x47')](_0x52b10f['query']);_0x34bd92['filters']=_['intersection'](_0x34bd92[_0xc1d2('0x32')],_0x34bd92[_0xc1d2('0x33')]);_0x4d9b8c['attributes']=_[_0xc1d2('0x35')](_0x34bd92['model'],qs['fields'](_0x52b10f[_0xc1d2('0x33')][_0xc1d2('0x37')]));_0x4d9b8c['attributes']=_0x4d9b8c[_0xc1d2('0x36')][_0xc1d2('0x38')]?_0x4d9b8c[_0xc1d2('0x36')]:_0x34bd92[_0xc1d2('0x32')];if(_0x52b10f[_0xc1d2('0x33')]['includeAll']){_0x4d9b8c[_0xc1d2('0x42')]=[{'all':!![]}];}_0x4d9b8c=_[_0xc1d2('0x3f')]({},_0x4d9b8c,_0x52b10f['options']);return db[_0xc1d2('0x2e')]['find'](_0x4d9b8c)[_0xc1d2('0x28')](handleEntityNotFound(_0x5a2c20,null))[_0xc1d2('0x28')](respondWithResult(_0x5a2c20,null))[_0xc1d2('0x48')](handleError(_0x5a2c20,null));};exports[_0xc1d2('0x49')]=function(_0x2a3746,_0x4535f8){return db[_0xc1d2('0x2e')][_0xc1d2('0x49')](_0x2a3746[_0xc1d2('0x4a')],{})['then'](respondWithResult(_0x4535f8,0xc9))[_0xc1d2('0x48')](handleError(_0x4535f8,null));};exports[_0xc1d2('0x27')]=function(_0x55d029,_0x59b01a){if(_0x55d029[_0xc1d2('0x4a')]['id']){delete _0x55d029[_0xc1d2('0x4a')]['id'];}return db['ZendeskConfiguration']['find']({'where':{'id':_0x55d029['params']['id']}})[_0xc1d2('0x28')](handleEntityNotFound(_0x59b01a,null))[_0xc1d2('0x28')](saveUpdates(_0x55d029[_0xc1d2('0x4a')],null))[_0xc1d2('0x28')](respondWithResult(_0x59b01a,null))[_0xc1d2('0x48')](handleError(_0x59b01a,null));};exports[_0xc1d2('0x29')]=function(_0x169f4b,_0x4bf774){return db['ZendeskConfiguration']['find']({'where':{'id':_0x169f4b[_0xc1d2('0x46')]['id']}})['then'](handleEntityNotFound(_0x4bf774,null))[_0xc1d2('0x28')](removeEntity(_0x4bf774,null))['catch'](handleError(_0x4bf774,null));};exports['getFields']=function(_0x5616b8,_0x338828,_0x2defe9){var _0x3457a7={};var _0x20d8d6={};var _0x2628f9;var _0x1f4637;return db[_0xc1d2('0x2e')][_0xc1d2('0x4b')]({'where':{'id':_0x5616b8[_0xc1d2('0x46')]['id']}})[_0xc1d2('0x28')](handleEntityNotFound(_0x338828,null))[_0xc1d2('0x28')](function(_0x8f40c1){if(_0x8f40c1){_0x2628f9=_0x8f40c1;_0x20d8d6[_0xc1d2('0x32')]=_[_0xc1d2('0x47')](db[_0xc1d2('0x4c')][_0xc1d2('0x2f')]);_0x20d8d6[_0xc1d2('0x33')]=_[_0xc1d2('0x47')](_0x5616b8[_0xc1d2('0x33')]);_0x20d8d6['filters']=_[_0xc1d2('0x35')](_0x20d8d6[_0xc1d2('0x32')],_0x20d8d6[_0xc1d2('0x33')]);_0x3457a7[_0xc1d2('0x36')]=_[_0xc1d2('0x35')](_0x20d8d6[_0xc1d2('0x32')],qs[_0xc1d2('0x37')](_0x5616b8[_0xc1d2('0x33')][_0xc1d2('0x37')]));_0x3457a7[_0xc1d2('0x36')]=_0x3457a7[_0xc1d2('0x36')][_0xc1d2('0x38')]?_0x3457a7[_0xc1d2('0x36')]:_0x20d8d6[_0xc1d2('0x32')];_0x3457a7[_0xc1d2('0x4d')]=qs[_0xc1d2('0x3b')](_0x5616b8[_0xc1d2('0x33')][_0xc1d2('0x3b')]);_0x3457a7[_0xc1d2('0x3c')]=qs[_0xc1d2('0x34')](_[_0xc1d2('0x3d')](_0x5616b8['query'],_0x20d8d6['filters']));if(_0x5616b8[_0xc1d2('0x33')]['filter']){_0x3457a7[_0xc1d2('0x3c')]=_[_0xc1d2('0x3f')](_0x3457a7['where'],{'$or':_[_0xc1d2('0x40')](_0x3457a7[_0xc1d2('0x36')],function(_0x4adb7d){var _0x461037={};_0x461037[_0x4adb7d]={'$like':'%'+_0x5616b8[_0xc1d2('0x33')][_0xc1d2('0x3e')]+'%'};return _0x461037;})});}_0x3457a7=_[_0xc1d2('0x3f')]({},_0x3457a7,_0x5616b8[_0xc1d2('0x4e')]);return _0x2628f9[_0xc1d2('0x4f')](_0x3457a7);}})[_0xc1d2('0x28')](function(_0x3334dd){if(_0x3334dd){_0x1f4637=_0x3334dd[_0xc1d2('0x38')];if(!_0x5616b8['query'][_0xc1d2('0x39')](_0xc1d2('0x3a'))){_0x3457a7[_0xc1d2('0x20')]=qs[_0xc1d2('0x20')](_0x5616b8[_0xc1d2('0x33')][_0xc1d2('0x20')]);_0x3457a7[_0xc1d2('0x1e')]=qs[_0xc1d2('0x1e')](_0x5616b8['query']['offset']);}return _0x2628f9[_0xc1d2('0x4f')](_0x3457a7);}})['then'](function(_0xd3dd54){if(_0xd3dd54){return _0xd3dd54?{'count':_0x1f4637,'rows':_0xd3dd54}:null;}})['then'](respondWithResult(_0x338828,null))['catch'](handleError(_0x338828,null));};exports['getSubjects']=function(_0x4e6be3,_0x5670af,_0x493e52){var _0x5b3782={};var _0xe82439={};var _0x42c2db;var _0x1a751a;return db[_0xc1d2('0x2e')][_0xc1d2('0x4b')]({'where':{'id':_0x4e6be3[_0xc1d2('0x46')]['id']}})[_0xc1d2('0x28')](handleEntityNotFound(_0x5670af,null))[_0xc1d2('0x28')](function(_0x246ada){if(_0x246ada){_0x42c2db=_0x246ada;_0xe82439['model']=_[_0xc1d2('0x47')](db[_0xc1d2('0x4c')][_0xc1d2('0x2f')]);_0xe82439[_0xc1d2('0x33')]=_[_0xc1d2('0x47')](_0x4e6be3[_0xc1d2('0x33')]);_0xe82439['filters']=_[_0xc1d2('0x35')](_0xe82439[_0xc1d2('0x32')],_0xe82439[_0xc1d2('0x33')]);_0x5b3782[_0xc1d2('0x36')]=_[_0xc1d2('0x35')](_0xe82439[_0xc1d2('0x32')],qs[_0xc1d2('0x37')](_0x4e6be3['query'][_0xc1d2('0x37')]));_0x5b3782[_0xc1d2('0x36')]=_0x5b3782[_0xc1d2('0x36')][_0xc1d2('0x38')]?_0x5b3782[_0xc1d2('0x36')]:_0xe82439[_0xc1d2('0x32')];_0x5b3782['order']=qs[_0xc1d2('0x3b')](_0x4e6be3[_0xc1d2('0x33')][_0xc1d2('0x3b')]);_0x5b3782[_0xc1d2('0x3c')]=qs['filters'](_[_0xc1d2('0x3d')](_0x4e6be3[_0xc1d2('0x33')],_0xe82439['filters']));if(_0x4e6be3[_0xc1d2('0x33')][_0xc1d2('0x3e')]){_0x5b3782[_0xc1d2('0x3c')]=_[_0xc1d2('0x3f')](_0x5b3782[_0xc1d2('0x3c')],{'$or':_[_0xc1d2('0x40')](_0x5b3782[_0xc1d2('0x36')],function(_0x5d9593){var _0x334a39={};_0x334a39[_0x5d9593]={'$like':'%'+_0x4e6be3['query']['filter']+'%'};return _0x334a39;})});}_0x5b3782=_[_0xc1d2('0x3f')]({},_0x5b3782,_0x4e6be3['options']);return _0x42c2db[_0xc1d2('0x50')](_0x5b3782);}})[_0xc1d2('0x28')](function(_0x27a9a3){if(_0x27a9a3){_0x1a751a=_0x27a9a3[_0xc1d2('0x38')];if(!_0x4e6be3[_0xc1d2('0x33')][_0xc1d2('0x39')]('nolimit')){_0x5b3782[_0xc1d2('0x20')]=qs['limit'](_0x4e6be3[_0xc1d2('0x33')][_0xc1d2('0x20')]);_0x5b3782[_0xc1d2('0x1e')]=qs[_0xc1d2('0x1e')](_0x4e6be3[_0xc1d2('0x33')][_0xc1d2('0x1e')]);}return _0x42c2db[_0xc1d2('0x50')](_0x5b3782);}})['then'](function(_0x3df29d){if(_0x3df29d){return _0x3df29d?{'count':_0x1a751a,'rows':_0x3df29d}:null;}})['then'](respondWithResult(_0x5670af,null))[_0xc1d2('0x48')](handleError(_0x5670af,null));};exports[_0xc1d2('0x51')]=function(_0x5e7751,_0x49c48e,_0x2bacb3){var _0x5a0eef={};var _0x2d582a={};var _0x4287c1;var _0x12c16a;return db['ZendeskConfiguration'][_0xc1d2('0x4b')]({'where':{'id':_0x5e7751[_0xc1d2('0x46')]['id']}})[_0xc1d2('0x28')](handleEntityNotFound(_0x49c48e,null))[_0xc1d2('0x28')](function(_0x97d660){if(_0x97d660){_0x4287c1=_0x97d660;_0x2d582a[_0xc1d2('0x32')]=_[_0xc1d2('0x47')](db['ZendeskField'][_0xc1d2('0x2f')]);_0x2d582a[_0xc1d2('0x33')]=_['keys'](_0x5e7751['query']);_0x2d582a[_0xc1d2('0x34')]=_['intersection'](_0x2d582a[_0xc1d2('0x32')],_0x2d582a['query']);_0x5a0eef[_0xc1d2('0x36')]=_['intersection'](_0x2d582a[_0xc1d2('0x32')],qs['fields'](_0x5e7751[_0xc1d2('0x33')]['fields']));_0x5a0eef[_0xc1d2('0x36')]=_0x5a0eef[_0xc1d2('0x36')][_0xc1d2('0x38')]?_0x5a0eef[_0xc1d2('0x36')]:_0x2d582a[_0xc1d2('0x32')];_0x5a0eef['order']=qs[_0xc1d2('0x3b')](_0x5e7751[_0xc1d2('0x33')][_0xc1d2('0x3b')]);_0x5a0eef['where']=qs[_0xc1d2('0x34')](_['pick'](_0x5e7751[_0xc1d2('0x33')],_0x2d582a['filters']));if(_0x5e7751[_0xc1d2('0x33')][_0xc1d2('0x3e')]){_0x5a0eef[_0xc1d2('0x3c')]=_[_0xc1d2('0x3f')](_0x5a0eef[_0xc1d2('0x3c')],{'$or':_[_0xc1d2('0x40')](_0x5a0eef[_0xc1d2('0x36')],function(_0x121d00){var _0x517cc1={};_0x517cc1[_0x121d00]={'$like':'%'+_0x5e7751[_0xc1d2('0x33')][_0xc1d2('0x3e')]+'%'};return _0x517cc1;})});}_0x5a0eef=_[_0xc1d2('0x3f')]({},_0x5a0eef,_0x5e7751[_0xc1d2('0x4e')]);return _0x4287c1['getDescriptions'](_0x5a0eef);}})[_0xc1d2('0x28')](function(_0x126b22){if(_0x126b22){_0x12c16a=_0x126b22[_0xc1d2('0x38')];if(!_0x5e7751[_0xc1d2('0x33')][_0xc1d2('0x39')]('nolimit')){_0x5a0eef['limit']=qs[_0xc1d2('0x20')](_0x5e7751[_0xc1d2('0x33')][_0xc1d2('0x20')]);_0x5a0eef[_0xc1d2('0x1e')]=qs[_0xc1d2('0x1e')](_0x5e7751[_0xc1d2('0x33')][_0xc1d2('0x1e')]);}return _0x4287c1['getDescriptions'](_0x5a0eef);}})[_0xc1d2('0x28')](function(_0x2f46ab){if(_0x2f46ab){return _0x2f46ab?{'count':_0x12c16a,'rows':_0x2f46ab}:null;}})[_0xc1d2('0x28')](respondWithResult(_0x49c48e,null))[_0xc1d2('0x48')](handleError(_0x49c48e,null));};exports['getTags']=function(_0x51eb95,_0x3ef561,_0x40df40){var _0x4713a6={};var _0x20201b={};var _0x572529;var _0xeaf975;return db[_0xc1d2('0x2e')]['findOne']({'where':{'id':_0x51eb95['params']['id']}})['then'](handleEntityNotFound(_0x3ef561,null))[_0xc1d2('0x28')](function(_0x37af36){if(_0x37af36){_0x572529=_0x37af36;_0x20201b[_0xc1d2('0x32')]=_[_0xc1d2('0x47')](db['Tag']['rawAttributes']);_0x20201b[_0xc1d2('0x33')]=_[_0xc1d2('0x47')](_0x51eb95['query']);_0x20201b[_0xc1d2('0x34')]=_[_0xc1d2('0x35')](_0x20201b['model'],_0x20201b[_0xc1d2('0x33')]);_0x4713a6[_0xc1d2('0x36')]=_['intersection'](_0x20201b['model'],qs[_0xc1d2('0x37')](_0x51eb95[_0xc1d2('0x33')]['fields']));_0x4713a6[_0xc1d2('0x36')]=_0x4713a6['attributes']['length']?_0x4713a6[_0xc1d2('0x36')]:_0x20201b[_0xc1d2('0x32')];_0x4713a6['order']=qs[_0xc1d2('0x3b')](_0x51eb95[_0xc1d2('0x33')][_0xc1d2('0x3b')]);_0x4713a6[_0xc1d2('0x3c')]=qs[_0xc1d2('0x34')](_[_0xc1d2('0x3d')](_0x51eb95[_0xc1d2('0x33')],_0x20201b[_0xc1d2('0x34')]));if(_0x51eb95['query'][_0xc1d2('0x3e')]){_0x4713a6['where']=_[_0xc1d2('0x3f')](_0x4713a6[_0xc1d2('0x3c')],{'$or':_[_0xc1d2('0x40')](_0x4713a6[_0xc1d2('0x36')],function(_0x179870){var _0x93f285={};_0x93f285[_0x179870]={'$like':'%'+_0x51eb95[_0xc1d2('0x33')][_0xc1d2('0x3e')]+'%'};return _0x93f285;})});}_0x4713a6=_['merge']({},_0x4713a6,_0x51eb95[_0xc1d2('0x4e')]);return _0x572529[_0xc1d2('0x52')](_0x4713a6);}})[_0xc1d2('0x28')](function(_0x5c28f5){if(_0x5c28f5){_0xeaf975=_0x5c28f5[_0xc1d2('0x38')];if(!_0x51eb95[_0xc1d2('0x33')][_0xc1d2('0x39')](_0xc1d2('0x3a'))){_0x4713a6[_0xc1d2('0x20')]=qs[_0xc1d2('0x20')](_0x51eb95[_0xc1d2('0x33')][_0xc1d2('0x20')]);_0x4713a6[_0xc1d2('0x1e')]=qs[_0xc1d2('0x1e')](_0x51eb95['query'][_0xc1d2('0x1e')]);}return _0x572529[_0xc1d2('0x52')](_0x4713a6);}})[_0xc1d2('0x28')](function(_0xfa6cf7){if(_0xfa6cf7){return _0xfa6cf7?{'count':_0xeaf975,'rows':_0xfa6cf7}:null;}})[_0xc1d2('0x28')](respondWithResult(_0x3ef561,null))[_0xc1d2('0x48')](handleError(_0x3ef561,null));};exports['setTags']=function(_0x5e4ad2,_0x1236cc,_0x9d9a14){if(_0x5e4ad2[_0xc1d2('0x4a')]['id']){delete _0x5e4ad2[_0xc1d2('0x4a')]['id'];}return db[_0xc1d2('0x2e')][_0xc1d2('0x4b')]({'where':{'id':_0x5e4ad2[_0xc1d2('0x46')]['id']}})[_0xc1d2('0x28')](handleEntityNotFound(_0x1236cc,null))[_0xc1d2('0x28')](function(_0x4c1aeb){if(_0x4c1aeb){return _0x4c1aeb['setTags'](_0x5e4ad2[_0xc1d2('0x4a')][_0xc1d2('0x53')]||[]);}return null;})[_0xc1d2('0x28')](respondWithResult(_0x1236cc,null))['catch'](handleError(_0x1236cc,null));}; \ No newline at end of file +var _0xd282=['fs-extra','lodash','squel','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','apply','save','destroy','then','error','stack','name','send','index','map','ZendeskConfiguration','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','update','body','getFields','ZendeskField','getSubjects','findOne','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0x20778c,_0x9c81a0){var _0x32d193=function(_0x43ece6){while(--_0x43ece6){_0x20778c['push'](_0x20778c['shift']());}};_0x32d193(++_0x9c81a0);}(_0xd282,0x1a4));var _0x2d28=function(_0x1ad81d,_0x47201f){_0x1ad81d=_0x1ad81d-0x0;var _0x1749ef=_0xd282[_0x1ad81d];return _0x1749ef;};'use strict';var emlformat=require(_0x2d28('0x0'));var rimraf=require(_0x2d28('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2d28('0x2'));var rp=require(_0x2d28('0x3'));var moment=require(_0x2d28('0x4'));var BPromise=require(_0x2d28('0x5'));var Mustache=require(_0x2d28('0x6'));var util=require(_0x2d28('0x7'));var path=require(_0x2d28('0x8'));var sox=require(_0x2d28('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2d28('0xa'));var _=require(_0x2d28('0xb'));var squel=require(_0x2d28('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2d28('0xd'));var toCsv=require(_0x2d28('0xe'));var querystring=require(_0x2d28('0xf'));var Papa=require('papaparse');var Redis=require(_0x2d28('0x10'));var authService=require(_0x2d28('0x11'));var qs=require(_0x2d28('0x12'));var as=require(_0x2d28('0x13'));var hardwareService=require(_0x2d28('0x14'));var logger=require(_0x2d28('0x15'))(_0x2d28('0x16'));var utils=require(_0x2d28('0x17'));var config=require(_0x2d28('0x18'));var licenseUtil=require(_0x2d28('0x19'));var db=require(_0x2d28('0x1a'))['db'];function respondWithStatusCode(_0x41b3c6,_0xa4ebb8){_0xa4ebb8=_0xa4ebb8||0xcc;return function(_0x3c711b){if(_0x3c711b){return _0x41b3c6[_0x2d28('0x1b')](_0xa4ebb8);}return _0x41b3c6[_0x2d28('0x1c')](_0xa4ebb8)[_0x2d28('0x1d')]();};}function respondWithResult(_0xf03315,_0x1155e5){_0x1155e5=_0x1155e5||0xc8;return function(_0x2bc0a8){if(_0x2bc0a8){return _0xf03315[_0x2d28('0x1c')](_0x1155e5)[_0x2d28('0x1e')](_0x2bc0a8);}};}function respondWithFilteredResult(_0x3068d3,_0x10d3f5){return function(_0x36aebf){if(_0x36aebf){var _0x5db1c4=typeof _0x10d3f5[_0x2d28('0x1f')]===_0x2d28('0x20')&&typeof _0x10d3f5['limit']===_0x2d28('0x20');var _0x113758=_0x36aebf[_0x2d28('0x21')];var _0x1f4133=_0x5db1c4?0x0:_0x10d3f5[_0x2d28('0x1f')];var _0x20044d=_0x5db1c4?_0x36aebf['count']:_0x10d3f5[_0x2d28('0x1f')]+_0x10d3f5['limit'];var _0x287557;if(_0x20044d>=_0x113758){_0x20044d=_0x113758;_0x287557=0xc8;}else{_0x287557=0xce;}_0x3068d3['status'](_0x287557);return _0x3068d3['set']('Content-Range',_0x1f4133+'-'+_0x20044d+'/'+_0x113758)['json'](_0x36aebf);}return null;};}function patchUpdates(_0x2b712b){return function(_0x1e4539){try{jsonpatch[_0x2d28('0x22')](_0x1e4539,_0x2b712b,!![]);}catch(_0x26d661){return BPromise['reject'](_0x26d661);}return _0x1e4539[_0x2d28('0x23')]();};}function saveUpdates(_0x16fec3,_0xe55aaa){return function(_0x586e04){if(_0x586e04){return _0x586e04['update'](_0x16fec3)['then'](function(_0x5664d3){return _0x5664d3;});}return null;};}function removeEntity(_0x5f148b,_0x4fedc1){return function(_0x126416){if(_0x126416){return _0x126416[_0x2d28('0x24')]()[_0x2d28('0x25')](function(){_0x5f148b[_0x2d28('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x17b221,_0x20a2e1){return function(_0x5d7795){if(!_0x5d7795){_0x17b221[_0x2d28('0x1b')](0x194);}return _0x5d7795;};}function handleError(_0x415485,_0x309fee){_0x309fee=_0x309fee||0x1f4;return function(_0x3f9179){logger[_0x2d28('0x26')](_0x3f9179[_0x2d28('0x27')]);if(_0x3f9179[_0x2d28('0x28')]){delete _0x3f9179['name'];}_0x415485['status'](_0x309fee)[_0x2d28('0x29')](_0x3f9179);};}exports[_0x2d28('0x2a')]=function(_0x1679c6,_0xc87dfc){var _0x535799={},_0x2642ba={},_0x306a0d={'count':0x0,'rows':[]};var _0x165052=_[_0x2d28('0x2b')](db[_0x2d28('0x2c')][_0x2d28('0x2d')],function(_0x7bbd80){return{'name':_0x7bbd80['fieldName'],'type':_0x7bbd80[_0x2d28('0x2e')]['key']};});_0x2642ba[_0x2d28('0x2f')]=_[_0x2d28('0x2b')](_0x165052,_0x2d28('0x28'));_0x2642ba[_0x2d28('0x30')]=_[_0x2d28('0x31')](_0x1679c6['query']);_0x2642ba[_0x2d28('0x32')]=_[_0x2d28('0x33')](_0x2642ba[_0x2d28('0x2f')],_0x2642ba[_0x2d28('0x30')]);_0x535799[_0x2d28('0x34')]=_[_0x2d28('0x33')](_0x2642ba[_0x2d28('0x2f')],qs['fields'](_0x1679c6[_0x2d28('0x30')][_0x2d28('0x35')]));_0x535799[_0x2d28('0x34')]=_0x535799['attributes'][_0x2d28('0x36')]?_0x535799[_0x2d28('0x34')]:_0x2642ba[_0x2d28('0x2f')];if(!_0x1679c6[_0x2d28('0x30')][_0x2d28('0x37')](_0x2d28('0x38'))){_0x535799['limit']=qs[_0x2d28('0x39')](_0x1679c6[_0x2d28('0x30')][_0x2d28('0x39')]);_0x535799[_0x2d28('0x1f')]=qs[_0x2d28('0x1f')](_0x1679c6[_0x2d28('0x30')][_0x2d28('0x1f')]);}_0x535799[_0x2d28('0x3a')]=qs[_0x2d28('0x3b')](_0x1679c6[_0x2d28('0x30')][_0x2d28('0x3b')]);_0x535799[_0x2d28('0x3c')]=qs[_0x2d28('0x32')](_[_0x2d28('0x3d')](_0x1679c6[_0x2d28('0x30')],_0x2642ba[_0x2d28('0x32')]),_0x165052);if(_0x1679c6[_0x2d28('0x30')][_0x2d28('0x3e')]){_0x535799[_0x2d28('0x3c')]=_['merge'](_0x535799[_0x2d28('0x3c')],{'$or':_[_0x2d28('0x2b')](_0x165052,function(_0x19f7a3){if(_0x19f7a3[_0x2d28('0x2e')]!==_0x2d28('0x3f')){var _0xdfacc8={};_0xdfacc8[_0x19f7a3[_0x2d28('0x28')]]={'$like':'%'+_0x1679c6['query'][_0x2d28('0x3e')]+'%'};return _0xdfacc8;}})});}_0x535799=_[_0x2d28('0x40')]({},_0x535799,_0x1679c6[_0x2d28('0x41')]);var _0x31f404={'where':_0x535799[_0x2d28('0x3c')]};return db['ZendeskConfiguration'][_0x2d28('0x21')](_0x31f404)['then'](function(_0x5eed9c){_0x306a0d[_0x2d28('0x21')]=_0x5eed9c;if(_0x1679c6[_0x2d28('0x30')][_0x2d28('0x42')]){_0x535799[_0x2d28('0x43')]=[{'all':!![]}];}return db[_0x2d28('0x2c')][_0x2d28('0x44')](_0x535799);})[_0x2d28('0x25')](function(_0xc5febe){_0x306a0d[_0x2d28('0x45')]=_0xc5febe;return _0x306a0d;})['then'](respondWithFilteredResult(_0xc87dfc,_0x535799))[_0x2d28('0x46')](handleError(_0xc87dfc,null));};exports[_0x2d28('0x47')]=function(_0x5ddefe,_0x531fca){var _0x24435a={'raw':![],'where':{'id':_0x5ddefe[_0x2d28('0x48')]['id']}},_0x2050ea={};_0x2050ea[_0x2d28('0x2f')]=_[_0x2d28('0x31')](db[_0x2d28('0x2c')][_0x2d28('0x2d')]);_0x2050ea[_0x2d28('0x30')]=_[_0x2d28('0x31')](_0x5ddefe[_0x2d28('0x30')]);_0x2050ea['filters']=_[_0x2d28('0x33')](_0x2050ea[_0x2d28('0x2f')],_0x2050ea[_0x2d28('0x30')]);_0x24435a['attributes']=_['intersection'](_0x2050ea['model'],qs[_0x2d28('0x35')](_0x5ddefe[_0x2d28('0x30')][_0x2d28('0x35')]));_0x24435a[_0x2d28('0x34')]=_0x24435a[_0x2d28('0x34')][_0x2d28('0x36')]?_0x24435a[_0x2d28('0x34')]:_0x2050ea['model'];if(_0x5ddefe[_0x2d28('0x30')]['includeAll']){_0x24435a['include']=[{'all':!![]}];}_0x24435a=_['merge']({},_0x24435a,_0x5ddefe[_0x2d28('0x41')]);return db[_0x2d28('0x2c')][_0x2d28('0x49')](_0x24435a)['then'](handleEntityNotFound(_0x531fca,null))[_0x2d28('0x25')](respondWithResult(_0x531fca,null))[_0x2d28('0x46')](handleError(_0x531fca,null));};exports[_0x2d28('0x4a')]=function(_0x25ac0c,_0x1b1f7d){return db[_0x2d28('0x2c')][_0x2d28('0x4a')](_0x25ac0c['body'],{})[_0x2d28('0x25')](respondWithResult(_0x1b1f7d,0xc9))[_0x2d28('0x46')](handleError(_0x1b1f7d,null));};exports[_0x2d28('0x4b')]=function(_0x19379b,_0x27ae92){if(_0x19379b[_0x2d28('0x4c')]['id']){delete _0x19379b[_0x2d28('0x4c')]['id'];}return db['ZendeskConfiguration'][_0x2d28('0x49')]({'where':{'id':_0x19379b[_0x2d28('0x48')]['id']}})[_0x2d28('0x25')](handleEntityNotFound(_0x27ae92,null))[_0x2d28('0x25')](saveUpdates(_0x19379b[_0x2d28('0x4c')],null))[_0x2d28('0x25')](respondWithResult(_0x27ae92,null))[_0x2d28('0x46')](handleError(_0x27ae92,null));};exports[_0x2d28('0x24')]=function(_0x334e36,_0x302c54){return db[_0x2d28('0x2c')][_0x2d28('0x49')]({'where':{'id':_0x334e36['params']['id']}})[_0x2d28('0x25')](handleEntityNotFound(_0x302c54,null))[_0x2d28('0x25')](removeEntity(_0x302c54,null))[_0x2d28('0x46')](handleError(_0x302c54,null));};exports[_0x2d28('0x4d')]=function(_0x2467e5,_0x239be4,_0xa20f08){var _0x1ac9ed={};var _0xd8b639={};var _0x10d60f;var _0x2c62b3;return db[_0x2d28('0x2c')]['findOne']({'where':{'id':_0x2467e5[_0x2d28('0x48')]['id']}})[_0x2d28('0x25')](handleEntityNotFound(_0x239be4,null))[_0x2d28('0x25')](function(_0x1f441f){if(_0x1f441f){_0x10d60f=_0x1f441f;_0xd8b639[_0x2d28('0x2f')]=_['keys'](db[_0x2d28('0x4e')][_0x2d28('0x2d')]);_0xd8b639['query']=_['keys'](_0x2467e5[_0x2d28('0x30')]);_0xd8b639[_0x2d28('0x32')]=_['intersection'](_0xd8b639['model'],_0xd8b639['query']);_0x1ac9ed[_0x2d28('0x34')]=_['intersection'](_0xd8b639[_0x2d28('0x2f')],qs[_0x2d28('0x35')](_0x2467e5[_0x2d28('0x30')][_0x2d28('0x35')]));_0x1ac9ed[_0x2d28('0x34')]=_0x1ac9ed[_0x2d28('0x34')][_0x2d28('0x36')]?_0x1ac9ed[_0x2d28('0x34')]:_0xd8b639[_0x2d28('0x2f')];_0x1ac9ed['order']=qs[_0x2d28('0x3b')](_0x2467e5['query']['sort']);_0x1ac9ed[_0x2d28('0x3c')]=qs[_0x2d28('0x32')](_[_0x2d28('0x3d')](_0x2467e5[_0x2d28('0x30')],_0xd8b639[_0x2d28('0x32')]));if(_0x2467e5[_0x2d28('0x30')][_0x2d28('0x3e')]){_0x1ac9ed[_0x2d28('0x3c')]=_[_0x2d28('0x40')](_0x1ac9ed[_0x2d28('0x3c')],{'$or':_['map'](_0x1ac9ed[_0x2d28('0x34')],function(_0x25408f){var _0x28d8b0={};_0x28d8b0[_0x25408f]={'$like':'%'+_0x2467e5[_0x2d28('0x30')][_0x2d28('0x3e')]+'%'};return _0x28d8b0;})});}_0x1ac9ed=_[_0x2d28('0x40')]({},_0x1ac9ed,_0x2467e5[_0x2d28('0x41')]);return _0x10d60f[_0x2d28('0x4d')](_0x1ac9ed);}})[_0x2d28('0x25')](function(_0xb3c90b){if(_0xb3c90b){_0x2c62b3=_0xb3c90b[_0x2d28('0x36')];if(!_0x2467e5['query'][_0x2d28('0x37')](_0x2d28('0x38'))){_0x1ac9ed[_0x2d28('0x39')]=qs[_0x2d28('0x39')](_0x2467e5['query'][_0x2d28('0x39')]);_0x1ac9ed['offset']=qs['offset'](_0x2467e5[_0x2d28('0x30')][_0x2d28('0x1f')]);}return _0x10d60f[_0x2d28('0x4d')](_0x1ac9ed);}})[_0x2d28('0x25')](function(_0xd78062){if(_0xd78062){return _0xd78062?{'count':_0x2c62b3,'rows':_0xd78062}:null;}})[_0x2d28('0x25')](respondWithResult(_0x239be4,null))[_0x2d28('0x46')](handleError(_0x239be4,null));};exports[_0x2d28('0x4f')]=function(_0x479760,_0x153401,_0x266890){var _0x2ed6a4={};var _0x3ae31f={};var _0x3a49f3;var _0x560059;return db[_0x2d28('0x2c')][_0x2d28('0x50')]({'where':{'id':_0x479760[_0x2d28('0x48')]['id']}})[_0x2d28('0x25')](handleEntityNotFound(_0x153401,null))[_0x2d28('0x25')](function(_0xc53438){if(_0xc53438){_0x3a49f3=_0xc53438;_0x3ae31f[_0x2d28('0x2f')]=_[_0x2d28('0x31')](db[_0x2d28('0x4e')]['rawAttributes']);_0x3ae31f['query']=_[_0x2d28('0x31')](_0x479760[_0x2d28('0x30')]);_0x3ae31f[_0x2d28('0x32')]=_[_0x2d28('0x33')](_0x3ae31f[_0x2d28('0x2f')],_0x3ae31f[_0x2d28('0x30')]);_0x2ed6a4['attributes']=_[_0x2d28('0x33')](_0x3ae31f[_0x2d28('0x2f')],qs['fields'](_0x479760[_0x2d28('0x30')]['fields']));_0x2ed6a4[_0x2d28('0x34')]=_0x2ed6a4[_0x2d28('0x34')]['length']?_0x2ed6a4[_0x2d28('0x34')]:_0x3ae31f[_0x2d28('0x2f')];_0x2ed6a4[_0x2d28('0x3a')]=qs[_0x2d28('0x3b')](_0x479760[_0x2d28('0x30')]['sort']);_0x2ed6a4[_0x2d28('0x3c')]=qs[_0x2d28('0x32')](_[_0x2d28('0x3d')](_0x479760[_0x2d28('0x30')],_0x3ae31f['filters']));if(_0x479760[_0x2d28('0x30')][_0x2d28('0x3e')]){_0x2ed6a4[_0x2d28('0x3c')]=_['merge'](_0x2ed6a4[_0x2d28('0x3c')],{'$or':_[_0x2d28('0x2b')](_0x2ed6a4[_0x2d28('0x34')],function(_0x57ad23){var _0x384e38={};_0x384e38[_0x57ad23]={'$like':'%'+_0x479760['query']['filter']+'%'};return _0x384e38;})});}_0x2ed6a4=_['merge']({},_0x2ed6a4,_0x479760[_0x2d28('0x41')]);return _0x3a49f3['getSubjects'](_0x2ed6a4);}})['then'](function(_0x580fb2){if(_0x580fb2){_0x560059=_0x580fb2['length'];if(!_0x479760['query']['hasOwnProperty']('nolimit')){_0x2ed6a4[_0x2d28('0x39')]=qs['limit'](_0x479760[_0x2d28('0x30')][_0x2d28('0x39')]);_0x2ed6a4['offset']=qs[_0x2d28('0x1f')](_0x479760['query']['offset']);}return _0x3a49f3[_0x2d28('0x4f')](_0x2ed6a4);}})[_0x2d28('0x25')](function(_0x3b0e77){if(_0x3b0e77){return _0x3b0e77?{'count':_0x560059,'rows':_0x3b0e77}:null;}})[_0x2d28('0x25')](respondWithResult(_0x153401,null))[_0x2d28('0x46')](handleError(_0x153401,null));};exports[_0x2d28('0x51')]=function(_0xcec034,_0x5c60fc,_0x5089c6){var _0x3c6afd={};var _0x38b34d={};var _0x3e3d99;var _0x897890;return db[_0x2d28('0x2c')]['findOne']({'where':{'id':_0xcec034[_0x2d28('0x48')]['id']}})[_0x2d28('0x25')](handleEntityNotFound(_0x5c60fc,null))[_0x2d28('0x25')](function(_0x24fc14){if(_0x24fc14){_0x3e3d99=_0x24fc14;_0x38b34d[_0x2d28('0x2f')]=_[_0x2d28('0x31')](db[_0x2d28('0x4e')][_0x2d28('0x2d')]);_0x38b34d[_0x2d28('0x30')]=_['keys'](_0xcec034['query']);_0x38b34d['filters']=_[_0x2d28('0x33')](_0x38b34d['model'],_0x38b34d[_0x2d28('0x30')]);_0x3c6afd[_0x2d28('0x34')]=_['intersection'](_0x38b34d[_0x2d28('0x2f')],qs[_0x2d28('0x35')](_0xcec034[_0x2d28('0x30')]['fields']));_0x3c6afd['attributes']=_0x3c6afd[_0x2d28('0x34')][_0x2d28('0x36')]?_0x3c6afd[_0x2d28('0x34')]:_0x38b34d[_0x2d28('0x2f')];_0x3c6afd[_0x2d28('0x3a')]=qs[_0x2d28('0x3b')](_0xcec034['query'][_0x2d28('0x3b')]);_0x3c6afd['where']=qs[_0x2d28('0x32')](_[_0x2d28('0x3d')](_0xcec034[_0x2d28('0x30')],_0x38b34d[_0x2d28('0x32')]));if(_0xcec034[_0x2d28('0x30')][_0x2d28('0x3e')]){_0x3c6afd['where']=_[_0x2d28('0x40')](_0x3c6afd[_0x2d28('0x3c')],{'$or':_[_0x2d28('0x2b')](_0x3c6afd[_0x2d28('0x34')],function(_0x5605de){var _0x110a44={};_0x110a44[_0x5605de]={'$like':'%'+_0xcec034[_0x2d28('0x30')]['filter']+'%'};return _0x110a44;})});}_0x3c6afd=_[_0x2d28('0x40')]({},_0x3c6afd,_0xcec034[_0x2d28('0x41')]);return _0x3e3d99[_0x2d28('0x51')](_0x3c6afd);}})[_0x2d28('0x25')](function(_0x1c952d){if(_0x1c952d){_0x897890=_0x1c952d[_0x2d28('0x36')];if(!_0xcec034[_0x2d28('0x30')]['hasOwnProperty'](_0x2d28('0x38'))){_0x3c6afd[_0x2d28('0x39')]=qs[_0x2d28('0x39')](_0xcec034[_0x2d28('0x30')][_0x2d28('0x39')]);_0x3c6afd['offset']=qs[_0x2d28('0x1f')](_0xcec034['query']['offset']);}return _0x3e3d99[_0x2d28('0x51')](_0x3c6afd);}})[_0x2d28('0x25')](function(_0x2d1416){if(_0x2d1416){return _0x2d1416?{'count':_0x897890,'rows':_0x2d1416}:null;}})[_0x2d28('0x25')](respondWithResult(_0x5c60fc,null))[_0x2d28('0x46')](handleError(_0x5c60fc,null));};exports[_0x2d28('0x52')]=function(_0x442543,_0x41e282,_0x540290){var _0x11ce53={};var _0x2cbe1a={};var _0x1ec516;var _0x57fd0e;return db[_0x2d28('0x2c')][_0x2d28('0x50')]({'where':{'id':_0x442543[_0x2d28('0x48')]['id']}})[_0x2d28('0x25')](handleEntityNotFound(_0x41e282,null))['then'](function(_0x271670){if(_0x271670){_0x1ec516=_0x271670;_0x2cbe1a['model']=_[_0x2d28('0x31')](db[_0x2d28('0x53')][_0x2d28('0x2d')]);_0x2cbe1a[_0x2d28('0x30')]=_[_0x2d28('0x31')](_0x442543[_0x2d28('0x30')]);_0x2cbe1a[_0x2d28('0x32')]=_[_0x2d28('0x33')](_0x2cbe1a[_0x2d28('0x2f')],_0x2cbe1a[_0x2d28('0x30')]);_0x11ce53[_0x2d28('0x34')]=_['intersection'](_0x2cbe1a['model'],qs['fields'](_0x442543[_0x2d28('0x30')][_0x2d28('0x35')]));_0x11ce53[_0x2d28('0x34')]=_0x11ce53['attributes'][_0x2d28('0x36')]?_0x11ce53[_0x2d28('0x34')]:_0x2cbe1a['model'];_0x11ce53['order']=qs[_0x2d28('0x3b')](_0x442543[_0x2d28('0x30')][_0x2d28('0x3b')]);_0x11ce53[_0x2d28('0x3c')]=qs[_0x2d28('0x32')](_[_0x2d28('0x3d')](_0x442543[_0x2d28('0x30')],_0x2cbe1a[_0x2d28('0x32')]));if(_0x442543[_0x2d28('0x30')][_0x2d28('0x3e')]){_0x11ce53[_0x2d28('0x3c')]=_[_0x2d28('0x40')](_0x11ce53[_0x2d28('0x3c')],{'$or':_[_0x2d28('0x2b')](_0x11ce53[_0x2d28('0x34')],function(_0x4d7398){var _0x1e7f2c={};_0x1e7f2c[_0x4d7398]={'$like':'%'+_0x442543[_0x2d28('0x30')][_0x2d28('0x3e')]+'%'};return _0x1e7f2c;})});}_0x11ce53=_['merge']({},_0x11ce53,_0x442543[_0x2d28('0x41')]);return _0x1ec516[_0x2d28('0x52')](_0x11ce53);}})['then'](function(_0x158da0){if(_0x158da0){_0x57fd0e=_0x158da0['length'];if(!_0x442543[_0x2d28('0x30')]['hasOwnProperty'](_0x2d28('0x38'))){_0x11ce53[_0x2d28('0x39')]=qs['limit'](_0x442543[_0x2d28('0x30')][_0x2d28('0x39')]);_0x11ce53[_0x2d28('0x1f')]=qs[_0x2d28('0x1f')](_0x442543[_0x2d28('0x30')][_0x2d28('0x1f')]);}return _0x1ec516['getTags'](_0x11ce53);}})[_0x2d28('0x25')](function(_0x219c5a){if(_0x219c5a){return _0x219c5a?{'count':_0x57fd0e,'rows':_0x219c5a}:null;}})[_0x2d28('0x25')](respondWithResult(_0x41e282,null))['catch'](handleError(_0x41e282,null));};exports[_0x2d28('0x54')]=function(_0x41b49a,_0x14a0cd,_0xc88b21){if(_0x41b49a['body']['id']){delete _0x41b49a[_0x2d28('0x4c')]['id'];}return db[_0x2d28('0x2c')][_0x2d28('0x50')]({'where':{'id':_0x41b49a[_0x2d28('0x48')]['id']}})[_0x2d28('0x25')](handleEntityNotFound(_0x14a0cd,null))[_0x2d28('0x25')](function(_0x1e0433){if(_0x1e0433){return _0x1e0433[_0x2d28('0x54')](_0x41b49a['body'][_0x2d28('0x55')]||[]);}return null;})['then'](respondWithResult(_0x14a0cd,null))[_0x2d28('0x46')](handleError(_0x14a0cd,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 9c8b05d..7322382 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 _0xda3f=['../../config/environment','exports','ZendeskConfiguration','int_zendesk_configurations','util','../../config/logger','request-promise','rimraf'];(function(_0x39fb6c,_0x5113f3){var _0x2192db=function(_0x267d61){while(--_0x267d61){_0x39fb6c['push'](_0x39fb6c['shift']());}};_0x2192db(++_0x5113f3);}(_0xda3f,0xec));var _0xfda3=function(_0x529a21,_0x5bcddf){_0x529a21=_0x529a21-0x0;var _0x2c3267=_0xda3f[_0x529a21];return _0x2c3267;};'use strict';var _=require('lodash');var util=require(_0xfda3('0x0'));var logger=require(_0xfda3('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xfda3('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfda3('0x3'));var config=require(_0xfda3('0x4'));var attributes=require('./intZendeskConfiguration.attributes');module[_0xfda3('0x5')]=function(_0x43a010,_0x47e7e2){return _0x43a010['define'](_0xfda3('0x6'),attributes,{'tableName':_0xfda3('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb62e=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','define','int_zendesk_configurations','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb62e,0x1de));var _0xeb62=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb62e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xeb62('0x0'));var util=require(_0xeb62('0x1'));var logger=require(_0xeb62('0x2'))(_0xeb62('0x3'));var moment=require('moment');var BPromise=require(_0xeb62('0x4'));var rp=require(_0xeb62('0x5'));var fs=require('fs');var path=require(_0xeb62('0x6'));var rimraf=require(_0xeb62('0x7'));var config=require(_0xeb62('0x8'));var attributes=require(_0xeb62('0x9'));module['exports']=function(_0x3ec879,_0x455e1a){return _0x3ec879[_0xeb62('0xa')]('ZendeskConfiguration',attributes,{'tableName':_0xeb62('0xb'),'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 28086d2..46fb56d 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 _0xbc28=['result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x5f53f3,_0x1c2d96){var _0x4f1458=function(_0x22fd82){while(--_0x22fd82){_0x5f53f3['push'](_0x5f53f3['shift']());}};_0x4f1458(++_0x1c2d96);}(_0xbc28,0x70));var _0x8bc2=function(_0x46de2c,_0x242db0){_0x46de2c=_0x46de2c-0x0;var _0x2c2449=_0xbc28[_0x46de2c];return _0x2c2449;};'use strict';var _=require(_0x8bc2('0x0'));var util=require('util');var moment=require(_0x8bc2('0x1'));var BPromise=require(_0x8bc2('0x2'));var rs=require(_0x8bc2('0x3'));var fs=require('fs');var Redis=require(_0x8bc2('0x4'));var db=require(_0x8bc2('0x5'))['db'];var utils=require(_0x8bc2('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x8bc2('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x8bc2('0x8')][_0x8bc2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x32034a,_0x39d2e2,_0x313bbe){return new BPromise(function(_0x383717,_0x3c23a0){return client[_0x8bc2('0xa')](_0x32034a,_0x313bbe)[_0x8bc2('0xb')](function(_0x3f6396){logger[_0x8bc2('0xc')](_0x8bc2('0xd'),_0x39d2e2,_0x8bc2('0xe'));logger[_0x8bc2('0xf')](_0x8bc2('0x10'),_0x39d2e2,'request\x20sent',JSON[_0x8bc2('0x11')](_0x3f6396));if(_0x3f6396[_0x8bc2('0x12')]){if(_0x3f6396[_0x8bc2('0x12')]['code']===0x1f4){logger[_0x8bc2('0x12')](_0x8bc2('0xd'),_0x39d2e2,_0x3f6396[_0x8bc2('0x12')][_0x8bc2('0x13')]);return _0x3c23a0(_0x3f6396[_0x8bc2('0x12')][_0x8bc2('0x13')]);}logger[_0x8bc2('0x12')](_0x8bc2('0xd'),_0x39d2e2,_0x3f6396[_0x8bc2('0x12')][_0x8bc2('0x13')]);return _0x383717(_0x3f6396[_0x8bc2('0x12')][_0x8bc2('0x13')]);}else{logger[_0x8bc2('0xc')](_0x8bc2('0xd'),_0x39d2e2,_0x8bc2('0xe'));_0x383717(_0x3f6396[_0x8bc2('0x14')]['message']);}})[_0x8bc2('0x15')](function(_0x3b2413){logger[_0x8bc2('0x12')](_0x8bc2('0xd'),_0x39d2e2,_0x3b2413);_0x3c23a0(_0x3b2413);});});} \ No newline at end of file +var _0xf1b9=['message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','error','code','ZendeskConfiguration,\x20%s,\x20%s'];(function(_0x172588,_0x230214){var _0x1f48ab=function(_0x23a10a){while(--_0x23a10a){_0x172588['push'](_0x172588['shift']());}};_0x1f48ab(++_0x230214);}(_0xf1b9,0x1a7));var _0x9f1b=function(_0x3f64eb,_0x4dda5e){_0x3f64eb=_0x3f64eb-0x0;var _0x5bf8d5=_0xf1b9[_0x3f64eb];return _0x5bf8d5;};'use strict';var _=require(_0x9f1b('0x0'));var util=require(_0x9f1b('0x1'));var moment=require(_0x9f1b('0x2'));var BPromise=require('bluebird');var rs=require(_0x9f1b('0x3'));var fs=require('fs');var Redis=require(_0x9f1b('0x4'));var db=require(_0x9f1b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9f1b('0x6'))('rpc');var config=require(_0x9f1b('0x7'));var jayson=require(_0x9f1b('0x8'));var client=jayson[_0x9f1b('0x9')][_0x9f1b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4dda6e,_0x57700b,_0x2915c7){return new BPromise(function(_0xbda96d,_0x147de3){return client[_0x9f1b('0xb')](_0x4dda6e,_0x2915c7)['then'](function(_0x210c92){logger[_0x9f1b('0xc')]('ZendeskConfiguration,\x20%s,\x20%s',_0x57700b,_0x9f1b('0xd'));logger[_0x9f1b('0xe')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x57700b,_0x9f1b('0xd'),JSON['stringify'](_0x210c92));if(_0x210c92[_0x9f1b('0xf')]){if(_0x210c92[_0x9f1b('0xf')][_0x9f1b('0x10')]===0x1f4){logger['error'](_0x9f1b('0x11'),_0x57700b,_0x210c92[_0x9f1b('0xf')][_0x9f1b('0x12')]);return _0x147de3(_0x210c92[_0x9f1b('0xf')]['message']);}logger[_0x9f1b('0xf')](_0x9f1b('0x11'),_0x57700b,_0x210c92[_0x9f1b('0xf')][_0x9f1b('0x12')]);return _0xbda96d(_0x210c92[_0x9f1b('0xf')][_0x9f1b('0x12')]);}else{logger[_0x9f1b('0xc')](_0x9f1b('0x11'),_0x57700b,_0x9f1b('0xd'));_0xbda96d(_0x210c92[_0x9f1b('0x13')]['message']);}})[_0x9f1b('0x14')](function(_0x3c0e16){logger[_0x9f1b('0xf')](_0x9f1b('0x11'),_0x57700b,_0x3c0e16);_0x147de3(_0x3c0e16);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 629b826..c1e9a34 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 _0x9cb4=['index','/:id','show','post','create','put','update','destroy','exports','multer','util','express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated'];(function(_0x475138,_0x4389e4){var _0x40a51c=function(_0x1ee297){while(--_0x1ee297){_0x475138['push'](_0x475138['shift']());}};_0x40a51c(++_0x4389e4);}(_0x9cb4,0x80));var _0x49cb=function(_0xe98a29,_0x52fde8){_0xe98a29=_0xe98a29-0x0;var _0x3b516a=_0x9cb4[_0xe98a29];return _0x3b516a;};'use strict';var multer=require(_0x49cb('0x0'));var util=require(_0x49cb('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x49cb('0x2'));var router=express['Router']();var fs_extra=require(_0x49cb('0x3'));var auth=require(_0x49cb('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x49cb('0x5'));var controller=require('./intZendeskField.controller');router[_0x49cb('0x6')]('/',auth[_0x49cb('0x7')](),controller[_0x49cb('0x8')]);router[_0x49cb('0x6')](_0x49cb('0x9'),auth[_0x49cb('0x7')](),controller[_0x49cb('0xa')]);router[_0x49cb('0xb')]('/',auth[_0x49cb('0x7')](),controller[_0x49cb('0xc')]);router[_0x49cb('0xd')](_0x49cb('0x9'),auth[_0x49cb('0x7')](),controller[_0x49cb('0xe')]);router['delete'](_0x49cb('0x9'),auth['isAuthenticated'](),controller[_0x49cb('0xf')]);module[_0x49cb('0x10')]=router; \ No newline at end of file +var _0x3f7b=['../../config/environment','./intZendeskField.controller','get','isAuthenticated','/:id','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x50fe80,_0x3bf3fb){var _0x255b75=function(_0x45faf3){while(--_0x45faf3){_0x50fe80['push'](_0x50fe80['shift']());}};_0x255b75(++_0x3bf3fb);}(_0x3f7b,0x197));var _0xb3f7=function(_0x56a871,_0x18b7fe){_0x56a871=_0x56a871-0x0;var _0x124954=_0x3f7b[_0x56a871];return _0x124954;};'use strict';var multer=require(_0xb3f7('0x0'));var util=require(_0xb3f7('0x1'));var path=require(_0xb3f7('0x2'));var timeout=require(_0xb3f7('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xb3f7('0x4'));var auth=require(_0xb3f7('0x5'));var interaction=require(_0xb3f7('0x6'));var config=require(_0xb3f7('0x7'));var controller=require(_0xb3f7('0x8'));router[_0xb3f7('0x9')]('/',auth[_0xb3f7('0xa')](),controller['index']);router['get'](_0xb3f7('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xb3f7('0xc')]('/',auth[_0xb3f7('0xa')](),controller[_0xb3f7('0xd')]);router[_0xb3f7('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xb3f7('0xf')]);router['delete'](_0xb3f7('0xb'),auth[_0xb3f7('0xa')](),controller[_0xb3f7('0x10')]);module[_0xb3f7('0x11')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index ed3c4ed..c51c11f 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 _0xf0e5=['customVariable','keyValue','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable'];(function(_0x5de944,_0x508cd5){var _0x4d55bc=function(_0x324277){while(--_0x324277){_0x5de944['push'](_0x5de944['shift']());}};_0x4d55bc(++_0x508cd5);}(_0xf0e5,0x124));var _0x5f0e=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0xf0e5[_0x5f0089];return _0x193892;};'use strict';var Sequelize=require(_0x5f0e('0x0'));module[_0x5f0e('0x1')]={'type':{'type':Sequelize[_0x5f0e('0x2')](_0x5f0e('0x3'),_0x5f0e('0x4'),_0x5f0e('0x5'),_0x5f0e('0x6'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x5f0e('0x7')]},'key':{'type':Sequelize[_0x5f0e('0x7')]},'keyType':{'type':Sequelize[_0x5f0e('0x2')](_0x5f0e('0x3'),_0x5f0e('0x4'),_0x5f0e('0x5'))},'keyContent':{'type':Sequelize[_0x5f0e('0x7')]},'idField':{'type':Sequelize[_0x5f0e('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x5f0e('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5f0e('0x7')]}}; \ No newline at end of file +var _0xb61c=['variable','BOOLEAN','sequelize','exports','ENUM','customVariable','picklist','string','STRING'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xb61c,0xd1));var _0xcb61=function(_0x1e82bb,_0x58fb15){_0x1e82bb=_0x1e82bb-0x0;var _0x9cffa3=_0xb61c[_0x1e82bb];return _0x9cffa3;};'use strict';var Sequelize=require(_0xcb61('0x0'));module[_0xcb61('0x1')]={'type':{'type':Sequelize[_0xcb61('0x2')]('string','variable',_0xcb61('0x3'),'keyValue',_0xcb61('0x4')),'defaultValue':_0xcb61('0x5')},'content':{'type':Sequelize[_0xcb61('0x6')]},'key':{'type':Sequelize[_0xcb61('0x6')]},'keyType':{'type':Sequelize[_0xcb61('0x2')](_0xcb61('0x5'),_0xcb61('0x7'),'customVariable')},'keyContent':{'type':Sequelize[_0xcb61('0x6')]},'idField':{'type':Sequelize[_0xcb61('0x6')]},'nameField':{'type':Sequelize[_0xcb61('0x6')]},'customField':{'type':Sequelize[_0xcb61('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xcb61('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 33b365f..58991f0 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 _0x770e=['path','to-csv','ejs','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','sendStatus','stack','name','send','map','ZendeskField','rawAttributes','fieldName','key','model','keys','query','filters','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','fields','find','create','body','catch','params','rimraf','fast-json-patch','moment','bluebird','mustache','util'];(function(_0x594cea,_0x1142c3){var _0xe0a5e4=function(_0x51933f){while(--_0x51933f){_0x594cea['push'](_0x594cea['shift']());}};_0xe0a5e4(++_0x1142c3);}(_0x770e,0x1b0));var _0xe770=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0x770e[_0x4fde08];return _0x12e725;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe770('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe770('0x1'));var rp=require('request-promise');var moment=require(_0xe770('0x2'));var BPromise=require(_0xe770('0x3'));var Mustache=require(_0xe770('0x4'));var util=require(_0xe770('0x5'));var path=require(_0xe770('0x6'));var sox=require('sox');var csv=require(_0xe770('0x7'));var ejs=require(_0xe770('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe770('0x9'));var deskjs=require(_0xe770('0xa'));var toCsv=require('to-csv');var querystring=require(_0xe770('0xb'));var Papa=require(_0xe770('0xc'));var Redis=require('ioredis');var authService=require(_0xe770('0xd'));var qs=require(_0xe770('0xe'));var as=require(_0xe770('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe770('0x10'))('api');var utils=require(_0xe770('0x11'));var config=require(_0xe770('0x12'));var licenseUtil=require(_0xe770('0x13'));var db=require(_0xe770('0x14'))['db'];function respondWithStatusCode(_0x3057c3,_0x47dc3c){_0x47dc3c=_0x47dc3c||0xcc;return function(_0x3c1f6c){if(_0x3c1f6c){return _0x3057c3['sendStatus'](_0x47dc3c);}return _0x3057c3[_0xe770('0x15')](_0x47dc3c)[_0xe770('0x16')]();};}function respondWithResult(_0x3d12e0,_0x43e70a){_0x43e70a=_0x43e70a||0xc8;return function(_0x150fc0){if(_0x150fc0){return _0x3d12e0[_0xe770('0x15')](_0x43e70a)[_0xe770('0x17')](_0x150fc0);}};}function respondWithFilteredResult(_0x47fcab,_0x70efc6){return function(_0x55ccde){if(_0x55ccde){var _0x208690=typeof _0x70efc6[_0xe770('0x18')]===_0xe770('0x19')&&typeof _0x70efc6['limit']===_0xe770('0x19');var _0x272965=_0x55ccde[_0xe770('0x1a')];var _0x5f5d8c=_0x208690?0x0:_0x70efc6['offset'];var _0x93b6e2=_0x208690?_0x55ccde[_0xe770('0x1a')]:_0x70efc6['offset']+_0x70efc6[_0xe770('0x1b')];var _0x14106a;if(_0x93b6e2>=_0x272965){_0x93b6e2=_0x272965;_0x14106a=0xc8;}else{_0x14106a=0xce;}_0x47fcab[_0xe770('0x15')](_0x14106a);return _0x47fcab[_0xe770('0x1c')](_0xe770('0x1d'),_0x5f5d8c+'-'+_0x93b6e2+'/'+_0x272965)[_0xe770('0x17')](_0x55ccde);}return null;};}function patchUpdates(_0x4fb8a4){return function(_0x325b40){try{jsonpatch[_0xe770('0x1e')](_0x325b40,_0x4fb8a4,!![]);}catch(_0x273b29){return BPromise[_0xe770('0x1f')](_0x273b29);}return _0x325b40['save']();};}function saveUpdates(_0x4ccd62,_0x3d4c50){return function(_0x136b59){if(_0x136b59){return _0x136b59[_0xe770('0x20')](_0x4ccd62)[_0xe770('0x21')](function(_0x164ff7){return _0x164ff7;});}return null;};}function removeEntity(_0x1cdae5,_0x81a553){return function(_0x4b20ae){if(_0x4b20ae){return _0x4b20ae[_0xe770('0x22')]()[_0xe770('0x21')](function(){_0x1cdae5['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xb053b7,_0xcc40c9){return function(_0x42d66f){if(!_0x42d66f){_0xb053b7[_0xe770('0x23')](0x194);}return _0x42d66f;};}function handleError(_0x2f9bc6,_0x3f2394){_0x3f2394=_0x3f2394||0x1f4;return function(_0x1905ca){logger['error'](_0x1905ca[_0xe770('0x24')]);if(_0x1905ca[_0xe770('0x25')]){delete _0x1905ca['name'];}_0x2f9bc6[_0xe770('0x15')](_0x3f2394)[_0xe770('0x26')](_0x1905ca);};}exports['index']=function(_0x4e445f,_0x30834e){var _0x28dca5={},_0x649dc6={},_0x57fcc4={'count':0x0,'rows':[]};var _0x3526fa=_[_0xe770('0x27')](db[_0xe770('0x28')][_0xe770('0x29')],function(_0x11bf10){return{'name':_0x11bf10[_0xe770('0x2a')],'type':_0x11bf10['type'][_0xe770('0x2b')]};});_0x649dc6[_0xe770('0x2c')]=_['map'](_0x3526fa,_0xe770('0x25'));_0x649dc6['query']=_[_0xe770('0x2d')](_0x4e445f[_0xe770('0x2e')]);_0x649dc6[_0xe770('0x2f')]=_['intersection'](_0x649dc6[_0xe770('0x2c')],_0x649dc6[_0xe770('0x2e')]);_0x28dca5[_0xe770('0x30')]=_[_0xe770('0x31')](_0x649dc6[_0xe770('0x2c')],qs['fields'](_0x4e445f[_0xe770('0x2e')]['fields']));_0x28dca5[_0xe770('0x30')]=_0x28dca5[_0xe770('0x30')][_0xe770('0x32')]?_0x28dca5[_0xe770('0x30')]:_0x649dc6[_0xe770('0x2c')];if(!_0x4e445f['query'][_0xe770('0x33')](_0xe770('0x34'))){_0x28dca5[_0xe770('0x1b')]=qs['limit'](_0x4e445f[_0xe770('0x2e')][_0xe770('0x1b')]);_0x28dca5[_0xe770('0x18')]=qs['offset'](_0x4e445f['query'][_0xe770('0x18')]);}_0x28dca5[_0xe770('0x35')]=qs[_0xe770('0x36')](_0x4e445f[_0xe770('0x2e')]['sort']);_0x28dca5['where']=qs[_0xe770('0x2f')](_[_0xe770('0x37')](_0x4e445f[_0xe770('0x2e')],_0x649dc6[_0xe770('0x2f')]),_0x3526fa);if(_0x4e445f[_0xe770('0x2e')]['filter']){_0x28dca5[_0xe770('0x38')]=_[_0xe770('0x39')](_0x28dca5[_0xe770('0x38')],{'$or':_[_0xe770('0x27')](_0x3526fa,function(_0x1ed45e){if(_0x1ed45e[_0xe770('0x3a')]!==_0xe770('0x3b')){var _0x4fbf0d={};_0x4fbf0d[_0x1ed45e[_0xe770('0x25')]]={'$like':'%'+_0x4e445f['query'][_0xe770('0x3c')]+'%'};return _0x4fbf0d;}})});}_0x28dca5=_[_0xe770('0x39')]({},_0x28dca5,_0x4e445f[_0xe770('0x3d')]);var _0x37febb={'where':_0x28dca5[_0xe770('0x38')]};return db[_0xe770('0x28')][_0xe770('0x1a')](_0x37febb)[_0xe770('0x21')](function(_0x3fe5a7){_0x57fcc4[_0xe770('0x1a')]=_0x3fe5a7;if(_0x4e445f[_0xe770('0x2e')][_0xe770('0x3e')]){_0x28dca5[_0xe770('0x3f')]=[{'all':!![]}];}return db[_0xe770('0x28')][_0xe770('0x40')](_0x28dca5);})[_0xe770('0x21')](function(_0x4b4215){_0x57fcc4[_0xe770('0x41')]=_0x4b4215;return _0x57fcc4;})[_0xe770('0x21')](respondWithFilteredResult(_0x30834e,_0x28dca5))['catch'](handleError(_0x30834e,null));};exports[_0xe770('0x42')]=function(_0x248178,_0x3050ca){var _0x3fa103={'raw':!![],'where':{'id':_0x248178['params']['id']}},_0x27451e={};_0x27451e[_0xe770('0x2c')]=_[_0xe770('0x2d')](db[_0xe770('0x28')][_0xe770('0x29')]);_0x27451e['query']=_['keys'](_0x248178['query']);_0x27451e[_0xe770('0x2f')]=_[_0xe770('0x31')](_0x27451e[_0xe770('0x2c')],_0x27451e[_0xe770('0x2e')]);_0x3fa103[_0xe770('0x30')]=_[_0xe770('0x31')](_0x27451e[_0xe770('0x2c')],qs['fields'](_0x248178[_0xe770('0x2e')][_0xe770('0x43')]));_0x3fa103['attributes']=_0x3fa103['attributes'][_0xe770('0x32')]?_0x3fa103[_0xe770('0x30')]:_0x27451e[_0xe770('0x2c')];if(_0x248178['query']['includeAll']){_0x3fa103[_0xe770('0x3f')]=[{'all':!![]}];}_0x3fa103=_['merge']({},_0x3fa103,_0x248178[_0xe770('0x3d')]);return db['ZendeskField'][_0xe770('0x44')](_0x3fa103)['then'](handleEntityNotFound(_0x3050ca,null))[_0xe770('0x21')](respondWithResult(_0x3050ca,null))['catch'](handleError(_0x3050ca,null));};exports['create']=function(_0x5e0f5f,_0x6c659b){return db[_0xe770('0x28')][_0xe770('0x45')](_0x5e0f5f[_0xe770('0x46')],{})[_0xe770('0x21')](respondWithResult(_0x6c659b,0xc9))[_0xe770('0x47')](handleError(_0x6c659b,null));};exports[_0xe770('0x20')]=function(_0x164ced,_0x84c9bd){if(_0x164ced[_0xe770('0x46')]['id']){delete _0x164ced[_0xe770('0x46')]['id'];}return db[_0xe770('0x28')]['find']({'where':{'id':_0x164ced[_0xe770('0x48')]['id']}})['then'](handleEntityNotFound(_0x84c9bd,null))[_0xe770('0x21')](saveUpdates(_0x164ced[_0xe770('0x46')],null))['then'](respondWithResult(_0x84c9bd,null))[_0xe770('0x47')](handleError(_0x84c9bd,null));};exports[_0xe770('0x22')]=function(_0x508f46,_0x309fc3){return db[_0xe770('0x28')][_0xe770('0x44')]({'where':{'id':_0x508f46[_0xe770('0x48')]['id']}})[_0xe770('0x21')](handleEntityNotFound(_0x309fc3,null))[_0xe770('0x21')](removeEntity(_0x309fc3,null))[_0xe770('0x47')](handleError(_0x309fc3,null));}; \ No newline at end of file +var _0x79e0=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','update','destroy','then','stack','name','index','map','ZendeskField','fieldName','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','params','rawAttributes','includeAll','create','body','find','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x1f8a72,_0x376e70){var _0x2e514b=function(_0x2247e1){while(--_0x2247e1){_0x1f8a72['push'](_0x1f8a72['shift']());}};_0x2e514b(++_0x376e70);}(_0x79e0,0x1f4));var _0x079e=function(_0x540dcb,_0x4eacb6){_0x540dcb=_0x540dcb-0x0;var _0x49353c=_0x79e0[_0x540dcb];return _0x49353c;};'use strict';var emlformat=require(_0x079e('0x0'));var rimraf=require(_0x079e('0x1'));var zipdir=require(_0x079e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x079e('0x3'));var BPromise=require(_0x079e('0x4'));var Mustache=require(_0x079e('0x5'));var util=require(_0x079e('0x6'));var path=require(_0x079e('0x7'));var sox=require(_0x079e('0x8'));var csv=require(_0x079e('0x9'));var ejs=require(_0x079e('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x079e('0xb'));var crypto=require('crypto');var jsforce=require(_0x079e('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x079e('0x9'));var querystring=require(_0x079e('0xd'));var Papa=require(_0x079e('0xe'));var Redis=require(_0x079e('0xf'));var authService=require(_0x079e('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x079e('0x11'));var hardwareService=require(_0x079e('0x12'));var logger=require(_0x079e('0x13'))(_0x079e('0x14'));var utils=require(_0x079e('0x15'));var config=require(_0x079e('0x16'));var licenseUtil=require(_0x079e('0x17'));var db=require(_0x079e('0x18'))['db'];function respondWithStatusCode(_0x20cb8d,_0x464dcd){_0x464dcd=_0x464dcd||0xcc;return function(_0x42b881){if(_0x42b881){return _0x20cb8d[_0x079e('0x19')](_0x464dcd);}return _0x20cb8d[_0x079e('0x1a')](_0x464dcd)[_0x079e('0x1b')]();};}function respondWithResult(_0x44ba1d,_0x3f42e4){_0x3f42e4=_0x3f42e4||0xc8;return function(_0x2519ce){if(_0x2519ce){return _0x44ba1d['status'](_0x3f42e4)[_0x079e('0x1c')](_0x2519ce);}};}function respondWithFilteredResult(_0x25994b,_0x4b4445){return function(_0x40837a){if(_0x40837a){var _0x4916e1=typeof _0x4b4445[_0x079e('0x1d')]===_0x079e('0x1e')&&typeof _0x4b4445['limit']===_0x079e('0x1e');var _0xf04dd4=_0x40837a[_0x079e('0x1f')];var _0xa86353=_0x4916e1?0x0:_0x4b4445[_0x079e('0x1d')];var _0x2f95fe=_0x4916e1?_0x40837a[_0x079e('0x1f')]:_0x4b4445[_0x079e('0x1d')]+_0x4b4445[_0x079e('0x20')];var _0x1837cf;if(_0x2f95fe>=_0xf04dd4){_0x2f95fe=_0xf04dd4;_0x1837cf=0xc8;}else{_0x1837cf=0xce;}_0x25994b[_0x079e('0x1a')](_0x1837cf);return _0x25994b[_0x079e('0x21')]('Content-Range',_0xa86353+'-'+_0x2f95fe+'/'+_0xf04dd4)[_0x079e('0x1c')](_0x40837a);}return null;};}function patchUpdates(_0x4d530e){return function(_0x600450){try{jsonpatch[_0x079e('0x22')](_0x600450,_0x4d530e,!![]);}catch(_0xca5f9e){return BPromise[_0x079e('0x23')](_0xca5f9e);}return _0x600450['save']();};}function saveUpdates(_0x1b8f5c,_0x6d07f4){return function(_0x5b21c6){if(_0x5b21c6){return _0x5b21c6[_0x079e('0x24')](_0x1b8f5c)['then'](function(_0x39a72a){return _0x39a72a;});}return null;};}function removeEntity(_0x3359d8,_0x1deb1f){return function(_0x230790){if(_0x230790){return _0x230790[_0x079e('0x25')]()[_0x079e('0x26')](function(){_0x3359d8[_0x079e('0x1a')](0xcc)[_0x079e('0x1b')]();});}};}function handleEntityNotFound(_0xd1b742,_0x200a06){return function(_0x41d456){if(!_0x41d456){_0xd1b742[_0x079e('0x19')](0x194);}return _0x41d456;};}function handleError(_0x11e352,_0xee90ef){_0xee90ef=_0xee90ef||0x1f4;return function(_0x469cd0){logger['error'](_0x469cd0[_0x079e('0x27')]);if(_0x469cd0[_0x079e('0x28')]){delete _0x469cd0['name'];}_0x11e352[_0x079e('0x1a')](_0xee90ef)['send'](_0x469cd0);};}exports[_0x079e('0x29')]=function(_0x49c52d,_0x26c4c5){var _0x484313={},_0x5dc8ce={},_0x4a88bb={'count':0x0,'rows':[]};var _0x3f567f=_[_0x079e('0x2a')](db[_0x079e('0x2b')]['rawAttributes'],function(_0x1d70a0){return{'name':_0x1d70a0[_0x079e('0x2c')],'type':_0x1d70a0['type'][_0x079e('0x2d')]};});_0x5dc8ce[_0x079e('0x2e')]=_[_0x079e('0x2a')](_0x3f567f,'name');_0x5dc8ce[_0x079e('0x2f')]=_[_0x079e('0x30')](_0x49c52d[_0x079e('0x2f')]);_0x5dc8ce[_0x079e('0x31')]=_[_0x079e('0x32')](_0x5dc8ce[_0x079e('0x2e')],_0x5dc8ce[_0x079e('0x2f')]);_0x484313['attributes']=_[_0x079e('0x32')](_0x5dc8ce[_0x079e('0x2e')],qs['fields'](_0x49c52d['query'][_0x079e('0x33')]));_0x484313[_0x079e('0x34')]=_0x484313[_0x079e('0x34')]['length']?_0x484313[_0x079e('0x34')]:_0x5dc8ce['model'];if(!_0x49c52d[_0x079e('0x2f')][_0x079e('0x35')]('nolimit')){_0x484313['limit']=qs[_0x079e('0x20')](_0x49c52d['query'][_0x079e('0x20')]);_0x484313[_0x079e('0x1d')]=qs['offset'](_0x49c52d[_0x079e('0x2f')][_0x079e('0x1d')]);}_0x484313[_0x079e('0x36')]=qs[_0x079e('0x37')](_0x49c52d[_0x079e('0x2f')][_0x079e('0x37')]);_0x484313[_0x079e('0x38')]=qs[_0x079e('0x31')](_[_0x079e('0x39')](_0x49c52d[_0x079e('0x2f')],_0x5dc8ce['filters']),_0x3f567f);if(_0x49c52d[_0x079e('0x2f')][_0x079e('0x3a')]){_0x484313['where']=_[_0x079e('0x3b')](_0x484313[_0x079e('0x38')],{'$or':_['map'](_0x3f567f,function(_0x4156da){if(_0x4156da[_0x079e('0x3c')]!==_0x079e('0x3d')){var _0x37c9b3={};_0x37c9b3[_0x4156da[_0x079e('0x28')]]={'$like':'%'+_0x49c52d[_0x079e('0x2f')][_0x079e('0x3a')]+'%'};return _0x37c9b3;}})});}_0x484313=_[_0x079e('0x3b')]({},_0x484313,_0x49c52d[_0x079e('0x3e')]);var _0x541179={'where':_0x484313[_0x079e('0x38')]};return db[_0x079e('0x2b')][_0x079e('0x1f')](_0x541179)['then'](function(_0x63fbc4){_0x4a88bb['count']=_0x63fbc4;if(_0x49c52d[_0x079e('0x2f')]['includeAll']){_0x484313[_0x079e('0x3f')]=[{'all':!![]}];}return db['ZendeskField'][_0x079e('0x40')](_0x484313);})[_0x079e('0x26')](function(_0x11e011){_0x4a88bb[_0x079e('0x41')]=_0x11e011;return _0x4a88bb;})[_0x079e('0x26')](respondWithFilteredResult(_0x26c4c5,_0x484313))[_0x079e('0x42')](handleError(_0x26c4c5,null));};exports[_0x079e('0x43')]=function(_0x1d30e7,_0x5cded6){var _0x24f533={'raw':!![],'where':{'id':_0x1d30e7[_0x079e('0x44')]['id']}},_0xb9598d={};_0xb9598d[_0x079e('0x2e')]=_[_0x079e('0x30')](db[_0x079e('0x2b')][_0x079e('0x45')]);_0xb9598d[_0x079e('0x2f')]=_[_0x079e('0x30')](_0x1d30e7[_0x079e('0x2f')]);_0xb9598d[_0x079e('0x31')]=_[_0x079e('0x32')](_0xb9598d[_0x079e('0x2e')],_0xb9598d[_0x079e('0x2f')]);_0x24f533[_0x079e('0x34')]=_[_0x079e('0x32')](_0xb9598d['model'],qs[_0x079e('0x33')](_0x1d30e7[_0x079e('0x2f')][_0x079e('0x33')]));_0x24f533[_0x079e('0x34')]=_0x24f533[_0x079e('0x34')]['length']?_0x24f533[_0x079e('0x34')]:_0xb9598d['model'];if(_0x1d30e7[_0x079e('0x2f')][_0x079e('0x46')]){_0x24f533[_0x079e('0x3f')]=[{'all':!![]}];}_0x24f533=_[_0x079e('0x3b')]({},_0x24f533,_0x1d30e7[_0x079e('0x3e')]);return db[_0x079e('0x2b')]['find'](_0x24f533)[_0x079e('0x26')](handleEntityNotFound(_0x5cded6,null))[_0x079e('0x26')](respondWithResult(_0x5cded6,null))[_0x079e('0x42')](handleError(_0x5cded6,null));};exports[_0x079e('0x47')]=function(_0xfe9890,_0x399c74){return db['ZendeskField'][_0x079e('0x47')](_0xfe9890[_0x079e('0x48')],{})['then'](respondWithResult(_0x399c74,0xc9))[_0x079e('0x42')](handleError(_0x399c74,null));};exports[_0x079e('0x24')]=function(_0x26148d,_0x16f857){if(_0x26148d[_0x079e('0x48')]['id']){delete _0x26148d['body']['id'];}return db['ZendeskField']['find']({'where':{'id':_0x26148d['params']['id']}})[_0x079e('0x26')](handleEntityNotFound(_0x16f857,null))['then'](saveUpdates(_0x26148d['body'],null))['then'](respondWithResult(_0x16f857,null))[_0x079e('0x42')](handleError(_0x16f857,null));};exports[_0x079e('0x25')]=function(_0x1df897,_0x8e8cf3){return db[_0x079e('0x2b')][_0x079e('0x49')]({'where':{'id':_0x1df897[_0x079e('0x44')]['id']}})[_0x079e('0x26')](handleEntityNotFound(_0x8e8cf3,null))[_0x079e('0x26')](removeEntity(_0x8e8cf3,null))[_0x079e('0x42')](handleError(_0x8e8cf3,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 41269b2..cc24f84 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 _0x33fd=['request-promise','rimraf','../../config/environment','./intZendeskField.attributes','exports','ZendeskField','int_zendesk_fields','idField','lodash','../../config/logger','api','bluebird'];(function(_0x1337be,_0x1e0176){var _0x5e4df9=function(_0x204027){while(--_0x204027){_0x1337be['push'](_0x1337be['shift']());}};_0x5e4df9(++_0x1e0176);}(_0x33fd,0x11c));var _0xd33f=function(_0x4a10a9,_0x27635f){_0x4a10a9=_0x4a10a9-0x0;var _0x1f60f9=_0x33fd[_0x4a10a9];return _0x1f60f9;};'use strict';var _=require(_0xd33f('0x0'));var util=require('util');var logger=require(_0xd33f('0x1'))(_0xd33f('0x2'));var moment=require('moment');var BPromise=require(_0xd33f('0x3'));var rp=require(_0xd33f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd33f('0x5'));var config=require(_0xd33f('0x6'));var attributes=require(_0xd33f('0x7'));module[_0xd33f('0x8')]=function(_0x142ac6,_0x56c1fc){return _0x142ac6['define'](_0xd33f('0x9'),attributes,{'tableName':_0xd33f('0xa'),'paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':[_0xd33f('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf76f=['path','rimraf','./intZendeskField.attributes','exports','define','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField','FieldId','lodash','util','../../config/logger','moment','request-promise'];(function(_0x4cce65,_0x40021e){var _0x4d1b45=function(_0x54d290){while(--_0x54d290){_0x4cce65['push'](_0x4cce65['shift']());}};_0x4d1b45(++_0x40021e);}(_0xf76f,0x172));var _0xff76=function(_0x16c6ad,_0x1de5c8){_0x16c6ad=_0x16c6ad-0x0;var _0x3fdde6=_0xf76f[_0x16c6ad];return _0x3fdde6;};'use strict';var _=require(_0xff76('0x0'));var util=require(_0xff76('0x1'));var logger=require(_0xff76('0x2'))('api');var moment=require(_0xff76('0x3'));var BPromise=require('bluebird');var rp=require(_0xff76('0x4'));var fs=require('fs');var path=require(_0xff76('0x5'));var rimraf=require(_0xff76('0x6'));var config=require('../../config/environment');var attributes=require(_0xff76('0x7'));module[_0xff76('0x8')]=function(_0x1f8ecc,_0x36cfc5){return _0x1f8ecc[_0xff76('0x9')](_0xff76('0xa'),attributes,{'tableName':_0xff76('0xb'),'paranoid':![],'indexes':[{'name':_0xff76('0xc'),'fields':[_0xff76('0xd'),_0xff76('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 04eef7c..0eda4b1 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 _0xd074=['ZendeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','info','ZendeskField,\x20%s,\x20%s','debug'];(function(_0x58719f,_0x42ed40){var _0x2d2b3c=function(_0xf4590d){while(--_0xf4590d){_0x58719f['push'](_0x58719f['shift']());}};_0x2d2b3c(++_0x42ed40);}(_0xd074,0x1d6));var _0x4d07=function(_0x137ae3,_0x4e93bf){_0x137ae3=_0x137ae3-0x0;var _0x3de34c=_0xd074[_0x137ae3];return _0x3de34c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4d07('0x0'));var BPromise=require(_0x4d07('0x1'));var rs=require(_0x4d07('0x2'));var fs=require('fs');var Redis=require(_0x4d07('0x3'));var db=require(_0x4d07('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4d07('0x5'))(_0x4d07('0x6'));var config=require(_0x4d07('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4d07('0x8')][_0x4d07('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x254d00,_0x4457ac,_0x48136a){return new BPromise(function(_0x349543,_0x583070){return client[_0x4d07('0xa')](_0x254d00,_0x48136a)['then'](function(_0x35738f){logger[_0x4d07('0xb')](_0x4d07('0xc'),_0x4457ac,'request\x20sent');logger[_0x4d07('0xd')](_0x4d07('0xe'),_0x4457ac,_0x4d07('0xf'),JSON[_0x4d07('0x10')](_0x35738f));if(_0x35738f['error']){if(_0x35738f[_0x4d07('0x11')][_0x4d07('0x12')]===0x1f4){logger[_0x4d07('0x11')](_0x4d07('0xc'),_0x4457ac,_0x35738f[_0x4d07('0x11')][_0x4d07('0x13')]);return _0x583070(_0x35738f[_0x4d07('0x11')]['message']);}logger[_0x4d07('0x11')](_0x4d07('0xc'),_0x4457ac,_0x35738f['error'][_0x4d07('0x13')]);return _0x349543(_0x35738f[_0x4d07('0x11')][_0x4d07('0x13')]);}else{logger[_0x4d07('0xb')]('ZendeskField,\x20%s,\x20%s',_0x4457ac,_0x4d07('0xf'));_0x349543(_0x35738f[_0x4d07('0x14')][_0x4d07('0x13')]);}})[_0x4d07('0x15')](function(_0xeef012){logger[_0x4d07('0x11')]('ZendeskField,\x20%s,\x20%s',_0x4457ac,_0xeef012);_0x583070(_0xeef012);});});} \ No newline at end of file +var _0x5173=['moment','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','ZendeskField,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash','util'];(function(_0x151e0b,_0x3bec86){var _0x5d4a5c=function(_0x1567f4){while(--_0x1567f4){_0x151e0b['push'](_0x151e0b['shift']());}};_0x5d4a5c(++_0x3bec86);}(_0x5173,0xe5));var _0x3517=function(_0x1a5822,_0x388ab8){_0x1a5822=_0x1a5822-0x0;var _0x25babf=_0x5173[_0x1a5822];return _0x25babf;};'use strict';var _=require(_0x3517('0x0'));var util=require(_0x3517('0x1'));var moment=require(_0x3517('0x2'));var BPromise=require('bluebird');var rs=require(_0x3517('0x3'));var fs=require('fs');var Redis=require(_0x3517('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3517('0x5'))('rpc');var config=require(_0x3517('0x6'));var jayson=require(_0x3517('0x7'));var client=jayson[_0x3517('0x8')][_0x3517('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1e96d9,_0xe1a21e,_0xd4ce8b){return new BPromise(function(_0x3f9440,_0x1cdd48){return client['request'](_0x1e96d9,_0xd4ce8b)[_0x3517('0xa')](function(_0x3db52e){logger[_0x3517('0xb')](_0x3517('0xc'),_0xe1a21e,'request\x20sent');logger[_0x3517('0xd')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0xe1a21e,_0x3517('0xe'),JSON[_0x3517('0xf')](_0x3db52e));if(_0x3db52e[_0x3517('0x10')]){if(_0x3db52e[_0x3517('0x10')][_0x3517('0x11')]===0x1f4){logger['error']('ZendeskField,\x20%s,\x20%s',_0xe1a21e,_0x3db52e['error'][_0x3517('0x12')]);return _0x1cdd48(_0x3db52e[_0x3517('0x10')]['message']);}logger[_0x3517('0x10')]('ZendeskField,\x20%s,\x20%s',_0xe1a21e,_0x3db52e[_0x3517('0x10')][_0x3517('0x12')]);return _0x3f9440(_0x3db52e['error'][_0x3517('0x12')]);}else{logger[_0x3517('0xb')]('ZendeskField,\x20%s,\x20%s',_0xe1a21e,'request\x20sent');_0x3f9440(_0x3db52e[_0x3517('0x13')][_0x3517('0x12')]);}})[_0x3517('0x14')](function(_0x290d3d){logger[_0x3517('0x10')](_0x3517('0xc'),_0xe1a21e,_0x290d3d);_0x1cdd48(_0x290d3d);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 37b1b08..41f2f9f 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 _0xe33c=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','index','show','getConfigurations','/:id/fields','getFields','post','/:id/configurations','addConfiguration','/:id','update','delete','destroy','exports','util','connect-timeout','express','Router'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xe33c,0xbc));var _0xce33=function(_0x22ff24,_0x26a5d0){_0x22ff24=_0x22ff24-0x0;var _0xd3d287=_0xe33c[_0x22ff24];return _0xd3d287;};'use strict';var multer=require('multer');var util=require(_0xce33('0x0'));var path=require('path');var timeout=require(_0xce33('0x1'));var express=require(_0xce33('0x2'));var router=express[_0xce33('0x3')]();var fs_extra=require(_0xce33('0x4'));var auth=require(_0xce33('0x5'));var interaction=require(_0xce33('0x6'));var config=require(_0xce33('0x7'));var controller=require(_0xce33('0x8'));router[_0xce33('0x9')]('/',auth[_0xce33('0xa')](),controller[_0xce33('0xb')]);router[_0xce33('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xce33('0xc')]);router[_0xce33('0x9')]('/:id/configurations',auth[_0xce33('0xa')](),controller[_0xce33('0xd')]);router[_0xce33('0x9')](_0xce33('0xe'),auth[_0xce33('0xa')](),controller[_0xce33('0xf')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xce33('0x10')](_0xce33('0x11'),auth[_0xce33('0xa')](),controller[_0xce33('0x12')]);router['put'](_0xce33('0x13'),auth[_0xce33('0xa')](),controller[_0xce33('0x14')]);router[_0xce33('0x15')](_0xce33('0x13'),auth[_0xce33('0xa')](),controller[_0xce33('0x16')]);module[_0xce33('0x17')]=router; \ No newline at end of file +var _0xc2bd=['create','post','/:id/configurations','addConfiguration','put','/:id','update','delete','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','./intZohoAccount.controller','get','isAuthenticated','index','show','getConfigurations','/:id/fields','getFields'];(function(_0x4571af,_0x23d0e0){var _0x425aa8=function(_0x2fc84c){while(--_0x2fc84c){_0x4571af['push'](_0x4571af['shift']());}};_0x425aa8(++_0x23d0e0);}(_0xc2bd,0x161));var _0xdc2b=function(_0x3c6bc1,_0x40b3c7){_0x3c6bc1=_0x3c6bc1-0x0;var _0x215adf=_0xc2bd[_0x3c6bc1];return _0x215adf;};'use strict';var multer=require(_0xdc2b('0x0'));var util=require(_0xdc2b('0x1'));var path=require(_0xdc2b('0x2'));var timeout=require(_0xdc2b('0x3'));var express=require(_0xdc2b('0x4'));var router=express['Router']();var fs_extra=require(_0xdc2b('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xdc2b('0x6'));var config=require('../../config/environment');var controller=require(_0xdc2b('0x7'));router[_0xdc2b('0x8')]('/',auth[_0xdc2b('0x9')](),controller[_0xdc2b('0xa')]);router[_0xdc2b('0x8')]('/:id',auth[_0xdc2b('0x9')](),controller[_0xdc2b('0xb')]);router[_0xdc2b('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0xdc2b('0xc')]);router['get'](_0xdc2b('0xd'),auth['isAuthenticated'](),controller[_0xdc2b('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xdc2b('0xf')]);router[_0xdc2b('0x10')](_0xdc2b('0x11'),auth[_0xdc2b('0x9')](),controller[_0xdc2b('0x12')]);router[_0xdc2b('0x13')](_0xdc2b('0x14'),auth['isAuthenticated'](),controller[_0xdc2b('0x15')]);router[_0xdc2b('0x16')](_0xdc2b('0x14'),auth[_0xdc2b('0x9')](),controller['destroy']);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 5c4bc02..50e61c1 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 _0xd64b=['STRING','sequelize'];(function(_0x4cd9c1,_0x5b2f7e){var _0x458183=function(_0xb696da){while(--_0xb696da){_0x4cd9c1['push'](_0x4cd9c1['shift']());}};_0x458183(++_0x5b2f7e);}(_0xd64b,0xc1));var _0xbd64=function(_0x24e3aa,_0x12af36){_0x24e3aa=_0x24e3aa-0x0;var _0x3d9a41=_0xd64b[_0x24e3aa];return _0x3d9a41;};'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 +var _0x2dae=['STRING','sequelize'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x2dae,0xc3));var _0xe2da=function(_0x3e2fcf,_0x579110){_0x3e2fcf=_0x3e2fcf-0x0;var _0x497db7=_0x2dae[_0x3e2fcf];return _0x497db7;};'use strict';var Sequelize=require(_0xe2da('0x0'));module['exports']={'name':{'type':Sequelize[_0xe2da('0x1')]},'description':{'type':Sequelize[_0xe2da('0x1')]},'host':{'type':Sequelize[_0xe2da('0x1')]},'zone':{'type':Sequelize[_0xe2da('0x1')]},'clientId':{'type':Sequelize[_0xe2da('0x1')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xe2da('0x1')],'allowNull':![]},'code':{'type':Sequelize[_0xe2da('0x1')]},'refreshToken':{'type':Sequelize[_0xe2da('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index ae5ddee..eff19ac 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 _0x5ba8=['lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','limit','undefined','count','offset','Content-Range','json','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','index','map','ZohoAccount','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','includeAll','find','create','body','params','getConfigurations','AccountId','Subjects','channel','getDescriptions','ZohoConfiguration','ZohoField','Descriptions','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','POST','/oauth/v2/token','refreshToken','clientId','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','zone','clientSecret','serverUrl','host','zoho.eu','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','message','Subject','Description','WhoId','Call_Result','Call_Start_Time','remove','includes','api_name','system_mandatory','push','display_label','pick_list_values','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','ejs','fs-extra'];(function(_0x45d691,_0x87e6fe){var _0x582b1b=function(_0x1bc8c2){while(--_0x1bc8c2){_0x45d691['push'](_0x45d691['shift']());}};_0x582b1b(++_0x87e6fe);}(_0x5ba8,0x79));var _0x85ba=function(_0x296359,_0x20d196){_0x296359=_0x296359-0x0;var _0x4b593d=_0x5ba8[_0x296359];return _0x4b593d;};'use strict';var emlformat=require(_0x85ba('0x0'));var rimraf=require(_0x85ba('0x1'));var zipdir=require(_0x85ba('0x2'));var jsonpatch=require(_0x85ba('0x3'));var rp=require('request-promise');var moment=require(_0x85ba('0x4'));var BPromise=require(_0x85ba('0x5'));var Mustache=require(_0x85ba('0x6'));var util=require(_0x85ba('0x7'));var path=require(_0x85ba('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x85ba('0x9'));var fs=require('fs');var fs_extra=require(_0x85ba('0xa'));var _=require(_0x85ba('0xb'));var squel=require(_0x85ba('0xc'));var crypto=require(_0x85ba('0xd'));var jsforce=require(_0x85ba('0xe'));var deskjs=require(_0x85ba('0xf'));var toCsv=require(_0x85ba('0x10'));var querystring=require(_0x85ba('0x11'));var Papa=require(_0x85ba('0x12'));var Redis=require(_0x85ba('0x13'));var authService=require(_0x85ba('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x85ba('0x15'));var hardwareService=require(_0x85ba('0x16'));var logger=require(_0x85ba('0x17'))(_0x85ba('0x18'));var utils=require('../../config/utils');var config=require(_0x85ba('0x19'));var licenseUtil=require(_0x85ba('0x1a'));var db=require(_0x85ba('0x1b'))['db'];var integrations=require(_0x85ba('0x1c'));function respondWithStatusCode(_0x3b9541,_0x43b953){_0x43b953=_0x43b953||0xcc;return function(_0x9cc258){if(_0x9cc258){return _0x3b9541['sendStatus'](_0x43b953);}return _0x3b9541[_0x85ba('0x1d')](_0x43b953)['end']();};}function respondWithResult(_0x279a41,_0x3d8d3e){_0x3d8d3e=_0x3d8d3e||0xc8;return function(_0x22070e){if(_0x22070e){return _0x279a41[_0x85ba('0x1d')](_0x3d8d3e)['json'](_0x22070e);}};}function respondWithFilteredResult(_0x43788f,_0x1dad9c){return function(_0x20fb6e){if(_0x20fb6e){var _0x5e3dc1=typeof _0x1dad9c['offset']==='undefined'&&typeof _0x1dad9c[_0x85ba('0x1e')]===_0x85ba('0x1f');var _0x128fc1=_0x20fb6e[_0x85ba('0x20')];var _0x33a59b=_0x5e3dc1?0x0:_0x1dad9c[_0x85ba('0x21')];var _0x4e806e=_0x5e3dc1?_0x20fb6e[_0x85ba('0x20')]:_0x1dad9c[_0x85ba('0x21')]+_0x1dad9c[_0x85ba('0x1e')];var _0x28919a;if(_0x4e806e>=_0x128fc1){_0x4e806e=_0x128fc1;_0x28919a=0xc8;}else{_0x28919a=0xce;}_0x43788f[_0x85ba('0x1d')](_0x28919a);return _0x43788f['set'](_0x85ba('0x22'),_0x33a59b+'-'+_0x4e806e+'/'+_0x128fc1)[_0x85ba('0x23')](_0x20fb6e);}return null;};}function patchUpdates(_0x15fb74){return function(_0x280bec){try{jsonpatch[_0x85ba('0x24')](_0x280bec,_0x15fb74,!![]);}catch(_0x287249){return BPromise[_0x85ba('0x25')](_0x287249);}return _0x280bec['save']();};}function saveUpdates(_0x530ffa,_0x167a52){return function(_0x14da1e){if(_0x14da1e){return _0x14da1e[_0x85ba('0x26')](_0x530ffa)[_0x85ba('0x27')](function(_0x276a88){return _0x276a88;});}return null;};}function removeEntity(_0xa6b7e9,_0x10fefe){return function(_0x40f219){if(_0x40f219){return _0x40f219[_0x85ba('0x28')]()[_0x85ba('0x27')](function(){_0xa6b7e9[_0x85ba('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x269ff3,_0x19bc03){return function(_0x2d257c){if(!_0x2d257c){_0x269ff3[_0x85ba('0x29')](0x194);}return _0x2d257c;};}function handleError(_0x294261,_0x152d55){_0x152d55=_0x152d55||0x1f4;return function(_0x292037){logger[_0x85ba('0x2a')](_0x292037[_0x85ba('0x2b')]);if(_0x292037[_0x85ba('0x2c')]){delete _0x292037[_0x85ba('0x2c')];}_0x294261[_0x85ba('0x1d')](_0x152d55)[_0x85ba('0x2d')](_0x292037);};}exports[_0x85ba('0x2e')]=function(_0x3132ef,_0x85f8b1){var _0x4baf69={},_0x367dc2={},_0x40cd26={'count':0x0,'rows':[]};var _0x55ec54=_[_0x85ba('0x2f')](db[_0x85ba('0x30')][_0x85ba('0x31')],function(_0x5bf363){return{'name':_0x5bf363[_0x85ba('0x32')],'type':_0x5bf363[_0x85ba('0x33')][_0x85ba('0x34')]};});_0x367dc2[_0x85ba('0x35')]=_['map'](_0x55ec54,_0x85ba('0x2c'));_0x367dc2[_0x85ba('0x36')]=_[_0x85ba('0x37')](_0x3132ef['query']);_0x367dc2['filters']=_[_0x85ba('0x38')](_0x367dc2[_0x85ba('0x35')],_0x367dc2['query']);_0x4baf69[_0x85ba('0x39')]=_[_0x85ba('0x38')](_0x367dc2[_0x85ba('0x35')],qs[_0x85ba('0x3a')](_0x3132ef[_0x85ba('0x36')][_0x85ba('0x3a')]));_0x4baf69[_0x85ba('0x39')]=_0x4baf69['attributes'][_0x85ba('0x3b')]?_0x4baf69[_0x85ba('0x39')]:_0x367dc2[_0x85ba('0x35')];if(!_0x3132ef[_0x85ba('0x36')][_0x85ba('0x3c')](_0x85ba('0x3d'))){_0x4baf69[_0x85ba('0x1e')]=qs[_0x85ba('0x1e')](_0x3132ef['query'][_0x85ba('0x1e')]);_0x4baf69[_0x85ba('0x21')]=qs[_0x85ba('0x21')](_0x3132ef['query'][_0x85ba('0x21')]);}_0x4baf69[_0x85ba('0x3e')]=qs['sort'](_0x3132ef[_0x85ba('0x36')][_0x85ba('0x3f')]);_0x4baf69[_0x85ba('0x40')]=qs[_0x85ba('0x41')](_[_0x85ba('0x42')](_0x3132ef[_0x85ba('0x36')],_0x367dc2[_0x85ba('0x41')]),_0x55ec54);if(_0x3132ef[_0x85ba('0x36')][_0x85ba('0x43')]){_0x4baf69[_0x85ba('0x40')]=_[_0x85ba('0x44')](_0x4baf69[_0x85ba('0x40')],{'$or':_[_0x85ba('0x2f')](_0x55ec54,function(_0x36a8bb){if(_0x36a8bb[_0x85ba('0x33')]!==_0x85ba('0x45')){var _0x4bb8f6={};_0x4bb8f6[_0x36a8bb[_0x85ba('0x2c')]]={'$like':'%'+_0x3132ef[_0x85ba('0x36')][_0x85ba('0x43')]+'%'};return _0x4bb8f6;}})});}_0x4baf69=_['merge']({},_0x4baf69,_0x3132ef[_0x85ba('0x46')]);var _0xabe352={'where':_0x4baf69[_0x85ba('0x40')]};return db[_0x85ba('0x30')][_0x85ba('0x20')](_0xabe352)['then'](function(_0x2c416b){_0x40cd26['count']=_0x2c416b;if(_0x3132ef[_0x85ba('0x36')]['includeAll']){_0x4baf69[_0x85ba('0x47')]=[{'all':!![]}];}return db[_0x85ba('0x30')][_0x85ba('0x48')](_0x4baf69);})[_0x85ba('0x27')](function(_0x12ef31){_0x40cd26[_0x85ba('0x49')]=_0x12ef31;return _0x40cd26;})[_0x85ba('0x27')](respondWithFilteredResult(_0x85f8b1,_0x4baf69))[_0x85ba('0x4a')](handleError(_0x85f8b1,null));};exports['show']=function(_0x193358,_0x2c5d6b){var _0x2ef8b0={'raw':![],'where':{'id':_0x193358['params']['id']}},_0x380ee0={};_0x380ee0[_0x85ba('0x35')]=_[_0x85ba('0x37')](db[_0x85ba('0x30')][_0x85ba('0x31')]);_0x380ee0['query']=_[_0x85ba('0x37')](_0x193358[_0x85ba('0x36')]);_0x380ee0['filters']=_[_0x85ba('0x38')](_0x380ee0[_0x85ba('0x35')],_0x380ee0[_0x85ba('0x36')]);_0x2ef8b0[_0x85ba('0x39')]=_['intersection'](_0x380ee0[_0x85ba('0x35')],qs[_0x85ba('0x3a')](_0x193358['query']['fields']));_0x2ef8b0['attributes']=_0x2ef8b0['attributes'][_0x85ba('0x3b')]?_0x2ef8b0[_0x85ba('0x39')]:_0x380ee0[_0x85ba('0x35')];if(_0x193358['query'][_0x85ba('0x4b')]){_0x2ef8b0[_0x85ba('0x47')]=[{'all':!![]}];}_0x2ef8b0=_[_0x85ba('0x44')]({},_0x2ef8b0,_0x193358['options']);return db[_0x85ba('0x30')][_0x85ba('0x4c')](_0x2ef8b0)['then'](handleEntityNotFound(_0x2c5d6b,null))[_0x85ba('0x27')](respondWithResult(_0x2c5d6b,null))[_0x85ba('0x4a')](handleError(_0x2c5d6b,null));};exports[_0x85ba('0x4d')]=function(_0x3d92ec,_0x2ad9de){return db[_0x85ba('0x30')][_0x85ba('0x4d')](_0x3d92ec['body'],{})['then'](respondWithResult(_0x2ad9de,0xc9))[_0x85ba('0x4a')](handleError(_0x2ad9de,null));};exports[_0x85ba('0x26')]=function(_0x5f31c2,_0x237da5){if(_0x5f31c2['body']['id']){delete _0x5f31c2[_0x85ba('0x4e')]['id'];}return db['ZohoAccount'][_0x85ba('0x4c')]({'where':{'id':_0x5f31c2['params']['id']}})[_0x85ba('0x27')](handleEntityNotFound(_0x237da5,null))[_0x85ba('0x27')](saveUpdates(_0x5f31c2[_0x85ba('0x4e')],null))[_0x85ba('0x27')](respondWithResult(_0x237da5,null))[_0x85ba('0x4a')](handleError(_0x237da5,null));};exports[_0x85ba('0x28')]=function(_0x549f05,_0x4a9d7d){return db[_0x85ba('0x30')][_0x85ba('0x4c')]({'where':{'id':_0x549f05[_0x85ba('0x4f')]['id']}})[_0x85ba('0x27')](handleEntityNotFound(_0x4a9d7d,null))[_0x85ba('0x27')](removeEntity(_0x4a9d7d,null))[_0x85ba('0x4a')](handleError(_0x4a9d7d,null));};exports[_0x85ba('0x50')]=function(_0x56a66b,_0x4ddf10,_0x3e7980){var _0x14fa0a={};var _0x457916={};var _0xe87209;var _0x180cd9;return db[_0x85ba('0x30')]['findOne']({'where':{'id':_0x56a66b[_0x85ba('0x4f')]['id']}})[_0x85ba('0x27')](handleEntityNotFound(_0x4ddf10,null))[_0x85ba('0x27')](function(_0x397fb6){if(_0x397fb6){_0xe87209=_0x397fb6;_0x457916['model']=_[_0x85ba('0x37')](db['ZohoConfiguration'][_0x85ba('0x31')]);_0x457916[_0x85ba('0x36')]=_[_0x85ba('0x37')](_0x56a66b[_0x85ba('0x36')]);_0x457916[_0x85ba('0x41')]=_[_0x85ba('0x38')](_0x457916[_0x85ba('0x35')],_0x457916[_0x85ba('0x36')]);_0x14fa0a[_0x85ba('0x39')]=_[_0x85ba('0x38')](_0x457916['model'],qs['fields'](_0x56a66b[_0x85ba('0x36')][_0x85ba('0x3a')]));_0x14fa0a[_0x85ba('0x39')]=_0x14fa0a[_0x85ba('0x39')][_0x85ba('0x3b')]?_0x14fa0a['attributes']:_0x457916[_0x85ba('0x35')];_0x14fa0a[_0x85ba('0x3e')]=qs['sort'](_0x56a66b[_0x85ba('0x36')][_0x85ba('0x3f')]);_0x14fa0a[_0x85ba('0x40')]=qs[_0x85ba('0x41')](_[_0x85ba('0x42')](_0x56a66b[_0x85ba('0x36')],_0x457916[_0x85ba('0x41')]));if(_0x56a66b[_0x85ba('0x36')]['filter']){_0x14fa0a[_0x85ba('0x40')]=_[_0x85ba('0x44')](_0x14fa0a[_0x85ba('0x40')],{'$or':_[_0x85ba('0x2f')](_0x14fa0a['attributes'],function(_0xa03eb0){var _0x211f97={};_0x211f97[_0xa03eb0]={'$like':'%'+_0x56a66b[_0x85ba('0x36')][_0x85ba('0x43')]+'%'};return _0x211f97;})});}_0x14fa0a=_['merge']({},_0x14fa0a,_0x56a66b[_0x85ba('0x46')]);return _0xe87209[_0x85ba('0x50')](_0x14fa0a);}})[_0x85ba('0x27')](function(_0x448d41){if(_0x448d41){_0x180cd9=_0x448d41[_0x85ba('0x3b')];if(!_0x56a66b[_0x85ba('0x36')]['hasOwnProperty']('nolimit')){_0x14fa0a[_0x85ba('0x1e')]=qs[_0x85ba('0x1e')](_0x56a66b[_0x85ba('0x36')]['limit']);_0x14fa0a[_0x85ba('0x21')]=qs[_0x85ba('0x21')](_0x56a66b[_0x85ba('0x36')][_0x85ba('0x21')]);}return _0xe87209['getConfigurations'](_0x14fa0a);}})['then'](function(_0x38e72f){if(_0x38e72f){return _0x38e72f?{'count':_0x180cd9,'rows':_0x38e72f}:null;}})['then'](respondWithResult(_0x4ddf10,null))['catch'](handleError(_0x4ddf10,null));};exports['addConfiguration']=function(_0x5b4e6c,_0x1ffcd5,_0x3b1b60){if(_0x5b4e6c[_0x85ba('0x4e')]['id']){delete _0x5b4e6c[_0x85ba('0x4e')]['id'];}return db[_0x85ba('0x30')]['findOne']({'where':{'id':_0x5b4e6c[_0x85ba('0x4f')]['id']}})['then'](handleEntityNotFound(_0x1ffcd5,null))[_0x85ba('0x27')](function(_0x39a43f){if(_0x39a43f){_0x5b4e6c[_0x85ba('0x4e')][_0x85ba('0x51')]=_0x39a43f['id'];_0x5b4e6c[_0x85ba('0x4e')][_0x85ba('0x52')]=integrations['getSubjects'](_0x5b4e6c[_0x85ba('0x4e')][_0x85ba('0x53')],_0x5b4e6c[_0x85ba('0x4e')][_0x85ba('0x33')]);_0x5b4e6c['body']['Descriptions']=integrations[_0x85ba('0x54')](_0x5b4e6c[_0x85ba('0x4e')][_0x85ba('0x53')],_0x5b4e6c[_0x85ba('0x4e')][_0x85ba('0x33')]);return db[_0x85ba('0x55')][_0x85ba('0x4d')](_0x5b4e6c[_0x85ba('0x4e')],{'include':[{'model':db[_0x85ba('0x56')],'as':_0x85ba('0x52')},{'model':db[_0x85ba('0x56')],'as':_0x85ba('0x57')}]});}return null;})[_0x85ba('0x27')](respondWithResult(_0x1ffcd5,null))[_0x85ba('0x4a')](handleError(_0x1ffcd5,null));};function getAccessToken(_0x236db6){return new Promise(function(_0x24beeb,_0x2dbc46){var _0x26069e;switch(_0x236db6['zone']){case'US':_0x26069e=_0x85ba('0x58');break;case'AU':_0x26069e=_0x85ba('0x59');break;case'EU':_0x26069e=_0x85ba('0x5a');break;case'IN':_0x26069e='https://accounts.zoho.in';break;case'CN':_0x26069e='https://accounts.zoho.com.cn';break;default:_0x26069e=_0x85ba('0x5a');break;}var _0xf96d36={'method':_0x85ba('0x5b'),'uri':_0x26069e+_0x85ba('0x5c'),'qs':{'refresh_token':_0x236db6[_0x85ba('0x5d')],'client_id':_0x236db6[_0x85ba('0x5e')],'client_secret':_0x236db6['clientSecret'],'grant_type':_0x85ba('0x5f')},'json':!![]};return rp(_0xf96d36)[_0x85ba('0x27')](function(_0x46b8b9){if(_0x46b8b9[_0x85ba('0x60')]){_0x24beeb(_0x46b8b9[_0x85ba('0x60')]);}else{_0x2dbc46(_0x85ba('0x61'));}})['catch'](function(_0x7545c6){_0x2dbc46(_0x7545c6);});});}exports[_0x85ba('0x62')]=function(_0x420cca,_0x5c4369,_0x38ed26){var _0x43a2a8,_0x3c0352,_0x330f7f,_0x4f11a0,_0x545f05;return db['ZohoAccount']['findOne']({'where':{'id':_0x420cca[_0x85ba('0x4f')]['id']},'attributes':['id','host',_0x85ba('0x63'),_0x85ba('0x5e'),_0x85ba('0x64'),_0x85ba('0x65'),'code',_0x85ba('0x5d')]})[_0x85ba('0x27')](handleEntityNotFound(_0x5c4369,null))[_0x85ba('0x27')](function(_0xa4f3fe){_0x545f05=_0xa4f3fe;_0x43a2a8=_0x545f05[_0x85ba('0x66')];_0x3c0352=_0x43a2a8===_0x85ba('0x67')?'eu':'com';_0x330f7f=_0x545f05['serverUrl'];var _0xede593=_0x330f7f[_0x85ba('0x68')](-0x1);if(_0xede593==='/'||_0xede593==='\x5c'||_0xede593===':'){_0x330f7f=_0x330f7f[_0x85ba('0x69')](0x0,_0x330f7f[_0x85ba('0x6a')](_0xede593));}if(!_0x545f05[_0x85ba('0x5d')]){throw new Error(_0x85ba('0x6b'));}return getAccessToken(_0x545f05);})[_0x85ba('0x27')](function(_0xd67821){if(_0xd67821){return rp({'method':_0x85ba('0x6c'),'uri':util[_0x85ba('0x6d')](_0x85ba('0x6e'),_0x3c0352),'qs':{'module':_0x85ba('0x6f')},'headers':{'Authorization':_0x85ba('0x70')+_0xd67821},'json':!![]});}})['then'](function(_0x11fe4f){if(_0x11fe4f){if(_0x11fe4f[_0x85ba('0x71')]&&_0x11fe4f['response'][_0x85ba('0x2a')]){throw new Error(_0x11fe4f['response'][_0x85ba('0x2a')][_0x85ba('0x72')]);}var _0xba6204=[];var _0x474c82=[];var _0x1a0f4d=['Owner',_0x85ba('0x73'),_0x85ba('0x74'),_0x85ba('0x75'),'Call_Duration',_0x85ba('0x76'),_0x85ba('0x77'),'Call_Type'];_0x474c82=_[_0x85ba('0x78')](_0x11fe4f[_0x85ba('0x3a')],function(_0x1e2755){return _0x1a0f4d[_0x85ba('0x79')](_0x1e2755[_0x85ba('0x7a')]);});for(var _0x2b3745=0x0;_0x2b3745<_0x474c82[_0x85ba('0x3b')];_0x2b3745++){if(_0x474c82[_0x2b3745][_0x85ba('0x7b')]===![]){_0xba6204[_0x85ba('0x7c')]({'id':_0x474c82[_0x2b3745]['id'],'name':_0x474c82[_0x2b3745][_0x85ba('0x7d')],'custom':_0x474c82[_0x2b3745]['custom_field'],'options':_0x474c82[_0x2b3745]['data_type']==='picklist'&&_0x474c82[_0x2b3745][_0x85ba('0x7e')][_0x85ba('0x3b')]>-0x1?_[_0x85ba('0x2f')](_0x474c82[_0x2b3745][_0x85ba('0x7e')],function(_0x20b2fc){return{'name':_0x20b2fc,'value':_0x20b2fc};}):[]});}}return{'count':_0xba6204[_0x85ba('0x3b')],'rows':_0xba6204};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x5c4369,null))[_0x85ba('0x4a')](function(_0x51f5ff){var _0x3606f8=_0x420cca['query']['test']?0x1f4:_0x51f5ff[_0x85ba('0x7f')]||0x1f4;logger[_0x85ba('0x2a')](_0x85ba('0x80'),'getFields',_0x3606f8,JSON[_0x85ba('0x81')](_0x51f5ff));delete _0x51f5ff['name'];if(_0x3606f8===0x191){_0x3606f8=0x190;}_0x5c4369[_0x85ba('0x1d')](_0x3606f8)[_0x85ba('0x2d')](_0x420cca[_0x85ba('0x36')][_0x85ba('0x82')]?{'message':_0x85ba('0x83'),'statusCode':_0x51f5ff[_0x85ba('0x7f')]}:_0x51f5ff);});}; \ No newline at end of file +var _0x0a25=['test','statusCode','getFields,\x20%s,\x20%s,\x20%s','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','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','undefined','count','offset','set','Content-Range','reject','update','then','error','stack','name','index','map','ZohoAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','destroy','getConfigurations','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','ZohoConfiguration','ZohoField','Subjects','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','findOne','host','clientSecret','serverUrl','zoho.eu','com','slice','substring','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','message','Owner','Subject','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','includes','system_mandatory','display_label','custom_field','picklist','pick_list_values'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0a25,0x8d));var _0x50a2=function(_0x583aa3,_0x16854){_0x583aa3=_0x583aa3-0x0;var _0x37a92c=_0x0a25[_0x583aa3];return _0x37a92c;};'use strict';var emlformat=require(_0x50a2('0x0'));var rimraf=require(_0x50a2('0x1'));var zipdir=require(_0x50a2('0x2'));var jsonpatch=require(_0x50a2('0x3'));var rp=require(_0x50a2('0x4'));var moment=require(_0x50a2('0x5'));var BPromise=require(_0x50a2('0x6'));var Mustache=require(_0x50a2('0x7'));var util=require(_0x50a2('0x8'));var path=require(_0x50a2('0x9'));var sox=require(_0x50a2('0xa'));var csv=require(_0x50a2('0xb'));var ejs=require(_0x50a2('0xc'));var fs=require('fs');var fs_extra=require(_0x50a2('0xd'));var _=require(_0x50a2('0xe'));var squel=require('squel');var crypto=require(_0x50a2('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x50a2('0x10'));var toCsv=require(_0x50a2('0xb'));var querystring=require(_0x50a2('0x11'));var Papa=require(_0x50a2('0x12'));var Redis=require(_0x50a2('0x13'));var authService=require(_0x50a2('0x14'));var qs=require(_0x50a2('0x15'));var as=require(_0x50a2('0x16'));var hardwareService=require(_0x50a2('0x17'));var logger=require(_0x50a2('0x18'))('api');var utils=require('../../config/utils');var config=require(_0x50a2('0x19'));var licenseUtil=require(_0x50a2('0x1a'));var db=require(_0x50a2('0x1b'))['db'];var integrations=require(_0x50a2('0x1c'));function respondWithStatusCode(_0x32aceb,_0x18b914){_0x18b914=_0x18b914||0xcc;return function(_0x2af142){if(_0x2af142){return _0x32aceb[_0x50a2('0x1d')](_0x18b914);}return _0x32aceb['status'](_0x18b914)[_0x50a2('0x1e')]();};}function respondWithResult(_0x12440b,_0x2d4050){_0x2d4050=_0x2d4050||0xc8;return function(_0x121f61){if(_0x121f61){return _0x12440b[_0x50a2('0x1f')](_0x2d4050)[_0x50a2('0x20')](_0x121f61);}};}function respondWithFilteredResult(_0x1411b5,_0x3ff3dc){return function(_0x27a4ce){if(_0x27a4ce){var _0x49b23a=typeof _0x3ff3dc['offset']===_0x50a2('0x21')&&typeof _0x3ff3dc['limit']===_0x50a2('0x21');var _0x27f7e1=_0x27a4ce[_0x50a2('0x22')];var _0xbcd3f7=_0x49b23a?0x0:_0x3ff3dc[_0x50a2('0x23')];var _0x456996=_0x49b23a?_0x27a4ce[_0x50a2('0x22')]:_0x3ff3dc[_0x50a2('0x23')]+_0x3ff3dc['limit'];var _0x367540;if(_0x456996>=_0x27f7e1){_0x456996=_0x27f7e1;_0x367540=0xc8;}else{_0x367540=0xce;}_0x1411b5[_0x50a2('0x1f')](_0x367540);return _0x1411b5[_0x50a2('0x24')](_0x50a2('0x25'),_0xbcd3f7+'-'+_0x456996+'/'+_0x27f7e1)[_0x50a2('0x20')](_0x27a4ce);}return null;};}function patchUpdates(_0xf826e3){return function(_0xce8b2f){try{jsonpatch['apply'](_0xce8b2f,_0xf826e3,!![]);}catch(_0x125aff){return BPromise[_0x50a2('0x26')](_0x125aff);}return _0xce8b2f['save']();};}function saveUpdates(_0x4ce89d,_0x34b0f8){return function(_0x2dc219){if(_0x2dc219){return _0x2dc219[_0x50a2('0x27')](_0x4ce89d)[_0x50a2('0x28')](function(_0x1d499d){return _0x1d499d;});}return null;};}function removeEntity(_0x142e0d,_0x2d7d58){return function(_0x116c46){if(_0x116c46){return _0x116c46['destroy']()['then'](function(){_0x142e0d[_0x50a2('0x1f')](0xcc)[_0x50a2('0x1e')]();});}};}function handleEntityNotFound(_0x1e59c8,_0x11a17b){return function(_0x2844b2){if(!_0x2844b2){_0x1e59c8[_0x50a2('0x1d')](0x194);}return _0x2844b2;};}function handleError(_0x30dc10,_0x53f5eb){_0x53f5eb=_0x53f5eb||0x1f4;return function(_0x2b654a){logger[_0x50a2('0x29')](_0x2b654a[_0x50a2('0x2a')]);if(_0x2b654a['name']){delete _0x2b654a[_0x50a2('0x2b')];}_0x30dc10[_0x50a2('0x1f')](_0x53f5eb)['send'](_0x2b654a);};}exports[_0x50a2('0x2c')]=function(_0x52a3c4,_0x4af897){var _0x4fda9c={},_0x5a49fc={},_0x551b66={'count':0x0,'rows':[]};var _0x5d1ff5=_[_0x50a2('0x2d')](db[_0x50a2('0x2e')][_0x50a2('0x2f')],function(_0x54ab9e){return{'name':_0x54ab9e[_0x50a2('0x30')],'type':_0x54ab9e[_0x50a2('0x31')][_0x50a2('0x32')]};});_0x5a49fc[_0x50a2('0x33')]=_[_0x50a2('0x2d')](_0x5d1ff5,'name');_0x5a49fc[_0x50a2('0x34')]=_[_0x50a2('0x35')](_0x52a3c4[_0x50a2('0x34')]);_0x5a49fc[_0x50a2('0x36')]=_[_0x50a2('0x37')](_0x5a49fc[_0x50a2('0x33')],_0x5a49fc[_0x50a2('0x34')]);_0x4fda9c[_0x50a2('0x38')]=_[_0x50a2('0x37')](_0x5a49fc[_0x50a2('0x33')],qs[_0x50a2('0x39')](_0x52a3c4[_0x50a2('0x34')][_0x50a2('0x39')]));_0x4fda9c[_0x50a2('0x38')]=_0x4fda9c[_0x50a2('0x38')][_0x50a2('0x3a')]?_0x4fda9c[_0x50a2('0x38')]:_0x5a49fc[_0x50a2('0x33')];if(!_0x52a3c4[_0x50a2('0x34')][_0x50a2('0x3b')](_0x50a2('0x3c'))){_0x4fda9c[_0x50a2('0x3d')]=qs[_0x50a2('0x3d')](_0x52a3c4[_0x50a2('0x34')][_0x50a2('0x3d')]);_0x4fda9c[_0x50a2('0x23')]=qs['offset'](_0x52a3c4[_0x50a2('0x34')]['offset']);}_0x4fda9c[_0x50a2('0x3e')]=qs['sort'](_0x52a3c4[_0x50a2('0x34')][_0x50a2('0x3f')]);_0x4fda9c[_0x50a2('0x40')]=qs[_0x50a2('0x36')](_[_0x50a2('0x41')](_0x52a3c4[_0x50a2('0x34')],_0x5a49fc['filters']),_0x5d1ff5);if(_0x52a3c4[_0x50a2('0x34')][_0x50a2('0x42')]){_0x4fda9c[_0x50a2('0x40')]=_[_0x50a2('0x43')](_0x4fda9c['where'],{'$or':_[_0x50a2('0x2d')](_0x5d1ff5,function(_0x2247b4){if(_0x2247b4[_0x50a2('0x31')]!=='VIRTUAL'){var _0x444d41={};_0x444d41[_0x2247b4[_0x50a2('0x2b')]]={'$like':'%'+_0x52a3c4[_0x50a2('0x34')][_0x50a2('0x42')]+'%'};return _0x444d41;}})});}_0x4fda9c=_[_0x50a2('0x43')]({},_0x4fda9c,_0x52a3c4[_0x50a2('0x44')]);var _0x2bc3b4={'where':_0x4fda9c[_0x50a2('0x40')]};return db[_0x50a2('0x2e')][_0x50a2('0x22')](_0x2bc3b4)['then'](function(_0x121c55){_0x551b66[_0x50a2('0x22')]=_0x121c55;if(_0x52a3c4[_0x50a2('0x34')][_0x50a2('0x45')]){_0x4fda9c[_0x50a2('0x46')]=[{'all':!![]}];}return db[_0x50a2('0x2e')][_0x50a2('0x47')](_0x4fda9c);})[_0x50a2('0x28')](function(_0x57a70a){_0x551b66[_0x50a2('0x48')]=_0x57a70a;return _0x551b66;})[_0x50a2('0x28')](respondWithFilteredResult(_0x4af897,_0x4fda9c))['catch'](handleError(_0x4af897,null));};exports[_0x50a2('0x49')]=function(_0x45e055,_0x204022){var _0x3fe914={'raw':![],'where':{'id':_0x45e055[_0x50a2('0x4a')]['id']}},_0x38bb86={};_0x38bb86[_0x50a2('0x33')]=_[_0x50a2('0x35')](db[_0x50a2('0x2e')][_0x50a2('0x2f')]);_0x38bb86[_0x50a2('0x34')]=_[_0x50a2('0x35')](_0x45e055[_0x50a2('0x34')]);_0x38bb86[_0x50a2('0x36')]=_[_0x50a2('0x37')](_0x38bb86[_0x50a2('0x33')],_0x38bb86[_0x50a2('0x34')]);_0x3fe914[_0x50a2('0x38')]=_[_0x50a2('0x37')](_0x38bb86['model'],qs[_0x50a2('0x39')](_0x45e055[_0x50a2('0x34')][_0x50a2('0x39')]));_0x3fe914['attributes']=_0x3fe914[_0x50a2('0x38')]['length']?_0x3fe914[_0x50a2('0x38')]:_0x38bb86[_0x50a2('0x33')];if(_0x45e055[_0x50a2('0x34')][_0x50a2('0x45')]){_0x3fe914[_0x50a2('0x46')]=[{'all':!![]}];}_0x3fe914=_['merge']({},_0x3fe914,_0x45e055[_0x50a2('0x44')]);return db[_0x50a2('0x2e')][_0x50a2('0x4b')](_0x3fe914)[_0x50a2('0x28')](handleEntityNotFound(_0x204022,null))[_0x50a2('0x28')](respondWithResult(_0x204022,null))[_0x50a2('0x4c')](handleError(_0x204022,null));};exports[_0x50a2('0x4d')]=function(_0x149967,_0x5f29e8){return db['ZohoAccount']['create'](_0x149967['body'],{})['then'](respondWithResult(_0x5f29e8,0xc9))['catch'](handleError(_0x5f29e8,null));};exports['update']=function(_0x3f28e1,_0x261efc){if(_0x3f28e1['body']['id']){delete _0x3f28e1['body']['id'];}return db['ZohoAccount']['find']({'where':{'id':_0x3f28e1[_0x50a2('0x4a')]['id']}})[_0x50a2('0x28')](handleEntityNotFound(_0x261efc,null))[_0x50a2('0x28')](saveUpdates(_0x3f28e1[_0x50a2('0x4e')],null))[_0x50a2('0x28')](respondWithResult(_0x261efc,null))[_0x50a2('0x4c')](handleError(_0x261efc,null));};exports[_0x50a2('0x4f')]=function(_0x3f0df6,_0x2347c3){return db['ZohoAccount']['find']({'where':{'id':_0x3f0df6[_0x50a2('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2347c3,null))[_0x50a2('0x28')](removeEntity(_0x2347c3,null))[_0x50a2('0x4c')](handleError(_0x2347c3,null));};exports[_0x50a2('0x50')]=function(_0x464b2b,_0x136003,_0x143984){var _0x523e74={};var _0xb6b034={};var _0x24ad76;var _0x38e3aa;return db[_0x50a2('0x2e')]['findOne']({'where':{'id':_0x464b2b['params']['id']}})['then'](handleEntityNotFound(_0x136003,null))[_0x50a2('0x28')](function(_0x52f3f7){if(_0x52f3f7){_0x24ad76=_0x52f3f7;_0xb6b034[_0x50a2('0x33')]=_['keys'](db['ZohoConfiguration'][_0x50a2('0x2f')]);_0xb6b034[_0x50a2('0x34')]=_[_0x50a2('0x35')](_0x464b2b[_0x50a2('0x34')]);_0xb6b034['filters']=_['intersection'](_0xb6b034[_0x50a2('0x33')],_0xb6b034[_0x50a2('0x34')]);_0x523e74['attributes']=_[_0x50a2('0x37')](_0xb6b034[_0x50a2('0x33')],qs[_0x50a2('0x39')](_0x464b2b[_0x50a2('0x34')][_0x50a2('0x39')]));_0x523e74['attributes']=_0x523e74[_0x50a2('0x38')][_0x50a2('0x3a')]?_0x523e74[_0x50a2('0x38')]:_0xb6b034[_0x50a2('0x33')];_0x523e74['order']=qs[_0x50a2('0x3f')](_0x464b2b[_0x50a2('0x34')]['sort']);_0x523e74[_0x50a2('0x40')]=qs[_0x50a2('0x36')](_[_0x50a2('0x41')](_0x464b2b['query'],_0xb6b034['filters']));if(_0x464b2b[_0x50a2('0x34')][_0x50a2('0x42')]){_0x523e74[_0x50a2('0x40')]=_[_0x50a2('0x43')](_0x523e74['where'],{'$or':_['map'](_0x523e74['attributes'],function(_0xa19181){var _0x2997f6={};_0x2997f6[_0xa19181]={'$like':'%'+_0x464b2b[_0x50a2('0x34')][_0x50a2('0x42')]+'%'};return _0x2997f6;})});}_0x523e74=_[_0x50a2('0x43')]({},_0x523e74,_0x464b2b[_0x50a2('0x44')]);return _0x24ad76[_0x50a2('0x50')](_0x523e74);}})[_0x50a2('0x28')](function(_0xf7b2c6){if(_0xf7b2c6){_0x38e3aa=_0xf7b2c6['length'];if(!_0x464b2b[_0x50a2('0x34')]['hasOwnProperty']('nolimit')){_0x523e74[_0x50a2('0x3d')]=qs[_0x50a2('0x3d')](_0x464b2b[_0x50a2('0x34')][_0x50a2('0x3d')]);_0x523e74['offset']=qs[_0x50a2('0x23')](_0x464b2b[_0x50a2('0x34')][_0x50a2('0x23')]);}return _0x24ad76[_0x50a2('0x50')](_0x523e74);}})['then'](function(_0x49afa4){if(_0x49afa4){return _0x49afa4?{'count':_0x38e3aa,'rows':_0x49afa4}:null;}})[_0x50a2('0x28')](respondWithResult(_0x136003,null))[_0x50a2('0x4c')](handleError(_0x136003,null));};exports[_0x50a2('0x51')]=function(_0x5f0081,_0x5cacd4,_0x2f7151){if(_0x5f0081['body']['id']){delete _0x5f0081[_0x50a2('0x4e')]['id'];}return db[_0x50a2('0x2e')]['findOne']({'where':{'id':_0x5f0081[_0x50a2('0x4a')]['id']}})[_0x50a2('0x28')](handleEntityNotFound(_0x5cacd4,null))[_0x50a2('0x28')](function(_0x10da47){if(_0x10da47){_0x5f0081[_0x50a2('0x4e')][_0x50a2('0x52')]=_0x10da47['id'];_0x5f0081['body']['Subjects']=integrations[_0x50a2('0x53')](_0x5f0081['body'][_0x50a2('0x54')],_0x5f0081[_0x50a2('0x4e')]['type']);_0x5f0081[_0x50a2('0x4e')][_0x50a2('0x55')]=integrations[_0x50a2('0x56')](_0x5f0081[_0x50a2('0x4e')][_0x50a2('0x54')],_0x5f0081[_0x50a2('0x4e')][_0x50a2('0x31')]);return db[_0x50a2('0x57')]['create'](_0x5f0081[_0x50a2('0x4e')],{'include':[{'model':db[_0x50a2('0x58')],'as':_0x50a2('0x59')},{'model':db[_0x50a2('0x58')],'as':_0x50a2('0x55')}]});}return null;})[_0x50a2('0x28')](respondWithResult(_0x5cacd4,null))[_0x50a2('0x4c')](handleError(_0x5cacd4,null));};function getAccessToken(_0x466030){return new Promise(function(_0xd298b3,_0x144f46){var _0x5d5d71;switch(_0x466030['zone']){case'US':_0x5d5d71=_0x50a2('0x5a');break;case'AU':_0x5d5d71=_0x50a2('0x5b');break;case'EU':_0x5d5d71=_0x50a2('0x5c');break;case'IN':_0x5d5d71=_0x50a2('0x5d');break;case'CN':_0x5d5d71=_0x50a2('0x5e');break;default:_0x5d5d71=_0x50a2('0x5c');break;}var _0x4afd09={'method':_0x50a2('0x5f'),'uri':_0x5d5d71+_0x50a2('0x60'),'qs':{'refresh_token':_0x466030[_0x50a2('0x61')],'client_id':_0x466030[_0x50a2('0x62')],'client_secret':_0x466030['clientSecret'],'grant_type':'refresh_token'},'json':!![]};return rp(_0x4afd09)[_0x50a2('0x28')](function(_0x458838){if(_0x458838['access_token']){_0xd298b3(_0x458838[_0x50a2('0x63')]);}else{_0x144f46(_0x50a2('0x64'));}})['catch'](function(_0x5f3c79){_0x144f46(_0x5f3c79);});});}exports[_0x50a2('0x65')]=function(_0x4a157f,_0x26fef2,_0x1be632){var _0x59532b,_0x2939d9,_0x47281d,_0x10c868,_0x7374b9;return db[_0x50a2('0x2e')][_0x50a2('0x66')]({'where':{'id':_0x4a157f['params']['id']},'attributes':['id',_0x50a2('0x67'),'zone',_0x50a2('0x62'),_0x50a2('0x68'),_0x50a2('0x69'),'code','refreshToken']})[_0x50a2('0x28')](handleEntityNotFound(_0x26fef2,null))['then'](function(_0x254a72){_0x7374b9=_0x254a72;_0x59532b=_0x7374b9[_0x50a2('0x67')];_0x2939d9=_0x59532b===_0x50a2('0x6a')?'eu':_0x50a2('0x6b');_0x47281d=_0x7374b9['serverUrl'];var _0x28370b=_0x47281d[_0x50a2('0x6c')](-0x1);if(_0x28370b==='/'||_0x28370b==='\x5c'||_0x28370b===':'){_0x47281d=_0x47281d[_0x50a2('0x6d')](0x0,_0x47281d['lastIndexOf'](_0x28370b));}if(!_0x7374b9[_0x50a2('0x61')]){throw new Error(_0x50a2('0x6e'));}return getAccessToken(_0x7374b9);})[_0x50a2('0x28')](function(_0xef773f){if(_0xef773f){return rp({'method':'GET','uri':util[_0x50a2('0x6f')](_0x50a2('0x70'),_0x2939d9),'qs':{'module':_0x50a2('0x71')},'headers':{'Authorization':_0x50a2('0x72')+_0xef773f},'json':!![]});}})['then'](function(_0x656948){if(_0x656948){if(_0x656948[_0x50a2('0x73')]&&_0x656948['response']['error']){throw new Error(_0x656948[_0x50a2('0x73')]['error'][_0x50a2('0x74')]);}var _0x3a0ace=[];var _0x489e0e=[];var _0x58ed45=[_0x50a2('0x75'),_0x50a2('0x76'),'Description',_0x50a2('0x77'),_0x50a2('0x78'),_0x50a2('0x79'),_0x50a2('0x7a'),_0x50a2('0x7b')];_0x489e0e=_[_0x50a2('0x7c')](_0x656948['fields'],function(_0x5d0e5a){return _0x58ed45[_0x50a2('0x7d')](_0x5d0e5a['api_name']);});for(var _0x371045=0x0;_0x371045<_0x489e0e[_0x50a2('0x3a')];_0x371045++){if(_0x489e0e[_0x371045][_0x50a2('0x7e')]===![]){_0x3a0ace['push']({'id':_0x489e0e[_0x371045]['id'],'name':_0x489e0e[_0x371045][_0x50a2('0x7f')],'custom':_0x489e0e[_0x371045][_0x50a2('0x80')],'options':_0x489e0e[_0x371045]['data_type']===_0x50a2('0x81')&&_0x489e0e[_0x371045]['pick_list_values']['length']>-0x1?_[_0x50a2('0x2d')](_0x489e0e[_0x371045][_0x50a2('0x82')],function(_0x4c92af){return{'name':_0x4c92af,'value':_0x4c92af};}):[]});}}return{'count':_0x3a0ace['length'],'rows':_0x3a0ace};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x26fef2,null))['catch'](function(_0x3981cb){var _0x3121aa=_0x4a157f[_0x50a2('0x34')][_0x50a2('0x83')]?0x1f4:_0x3981cb[_0x50a2('0x84')]||0x1f4;logger[_0x50a2('0x29')](_0x50a2('0x85'),'getFields',_0x3121aa,JSON['stringify'](_0x3981cb));delete _0x3981cb[_0x50a2('0x2b')];if(_0x3121aa===0x191){_0x3121aa=0x190;}_0x26fef2[_0x50a2('0x1f')](_0x3121aa)[_0x50a2('0x86')](_0x4a157f[_0x50a2('0x34')][_0x50a2('0x83')]?{'message':_0x50a2('0x87'),'statusCode':_0x3981cb['statusCode']}:_0x3981cb);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index c99daf7..0bf3f0a 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 _0xe378=['then','parse','refresh_token','refreshToken','info','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','format','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','authorization_code','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','int_zoho_accounts','changed','zone','serverUrl','clientSecret','code','host','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','clientId','application/x-www-form-urlencoded'];(function(_0x5c10fc,_0x1116d9){var _0x44391b=function(_0x2de5b2){while(--_0x2de5b2){_0x5c10fc['push'](_0x5c10fc['shift']());}};_0x44391b(++_0x1116d9);}(_0xe378,0x1d0));var _0x8e37=function(_0x3e6166,_0x25b64b){_0x3e6166=_0x3e6166-0x0;var _0x1d10f5=_0xe378[_0x3e6166];return _0x1d10f5;};'use strict';var _=require('lodash');var util=require(_0x8e37('0x0'));var logger=require(_0x8e37('0x1'))(_0x8e37('0x2'));var moment=require('moment');var BPromise=require(_0x8e37('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8e37('0x4'));var rimraf=require(_0x8e37('0x5'));var config=require(_0x8e37('0x6'));var attributes=require('./intZohoAccount.attributes');var integrations=require(_0x8e37('0x7'));module[_0x8e37('0x8')]=function(_0x21821a,_0x478d2e){return _0x21821a[_0x8e37('0x9')]('ZohoAccount',attributes,{'tableName':_0x8e37('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x490e79,_0x4a0f6d,_0x1efab7){if(_0x490e79[_0x8e37('0xb')](_0x8e37('0xc'))||_0x490e79['changed'](_0x8e37('0xd'))||_0x490e79[_0x8e37('0xb')]('clientId')||_0x490e79[_0x8e37('0xb')](_0x8e37('0xe'))||_0x490e79[_0x8e37('0xb')](_0x8e37('0xf'))||_0x490e79[_0x8e37('0xb')](_0x8e37('0x10'))){var _0x5e5446,_0x32a7b4;_0x5e5446=_0x490e79[_0x8e37('0xd')];var _0x23071e=_0x5e5446[_0x8e37('0x11')](-0x1);if(_0x23071e==='/'||_0x23071e==='\x5c'||_0x23071e===':'){_0x5e5446=_0x5e5446[_0x8e37('0x12')](0x0,_0x5e5446[_0x8e37('0x13')](_0x23071e));}switch(_0x490e79['zone']){case'US':_0x32a7b4=_0x8e37('0x14');break;case'AU':_0x32a7b4=_0x8e37('0x15');break;case'IN':_0x32a7b4=_0x8e37('0x16');break;case'CN':_0x32a7b4=_0x8e37('0x17');break;default:_0x32a7b4='https://accounts.zoho.eu';break;}var _0x3c7936={'method':_0x8e37('0x18'),'uri':_0x32a7b4+_0x8e37('0x19'),'form':{'grant_type':'authorization_code','client_id':_0x490e79[_0x8e37('0x1a')],'client_secret':_0x490e79[_0x8e37('0xe')],'redirect_uri':_0x490e79[_0x8e37('0xd')],'code':_0x490e79[_0x8e37('0xf')]},'headers':{'Content-Type':_0x8e37('0x1b')}};return rp(_0x3c7936)[_0x8e37('0x1c')](function(_0x5a2c7d){var _0x749484=JSON[_0x8e37('0x1d')](_0x5a2c7d);if(_0x749484[_0x8e37('0x1e')]){_0x490e79[_0x8e37('0x1f')]=_0x749484[_0x8e37('0x1e')];logger[_0x8e37('0x20')](util['format'](_0x8e37('0x21'),_0x490e79[_0x8e37('0x22')],_0x490e79['id']));}else{logger[_0x8e37('0x23')](util[_0x8e37('0x24')](_0x8e37('0x25'),_0x490e79['name'],_0x490e79['id']),util[_0x8e37('0x26')](_0x749484,{'showHidden':![],'depth':null}));}return _0x1efab7(null,_0x4a0f6d);})[_0x8e37('0x27')](function(_0xbc7c26){logger['error'](util[_0x8e37('0x24')](_0x8e37('0x25'),_0x490e79['name'],_0x490e79['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x1efab7(_0xbc7c26);});}else{return _0x1efab7(null,_0x4a0f6d);}},'beforeUpdate':function(_0x2b05a3,_0x32b778,_0x599ee1){if(_0x2b05a3[_0x8e37('0xb')](_0x8e37('0xc'))||_0x2b05a3[_0x8e37('0xb')]('serverUrl')||_0x2b05a3[_0x8e37('0xb')](_0x8e37('0x1a'))||_0x2b05a3['changed']('clientSecret')||_0x2b05a3['changed']('code')||_0x2b05a3[_0x8e37('0xb')]('host')){var _0x504991,_0x569321;_0x504991=_0x2b05a3[_0x8e37('0xd')];var _0x49879e=_0x504991[_0x8e37('0x11')](-0x1);if(_0x49879e==='/'||_0x49879e==='\x5c'||_0x49879e===':'){_0x504991=_0x504991[_0x8e37('0x12')](0x0,_0x504991[_0x8e37('0x13')](_0x49879e));}switch(_0x2b05a3['zone']){case'US':_0x569321=_0x8e37('0x14');break;case'AU':_0x569321='https://accounts.zoho.com.au';break;case'IN':_0x569321=_0x8e37('0x16');break;case'CN':_0x569321=_0x8e37('0x17');break;default:_0x569321='https://accounts.zoho.eu';break;}var _0x510b87={'method':_0x8e37('0x18'),'uri':_0x569321+'/oauth/v2/token','form':{'grant_type':_0x8e37('0x28'),'client_id':_0x2b05a3[_0x8e37('0x1a')],'client_secret':_0x2b05a3[_0x8e37('0xe')],'redirect_uri':_0x2b05a3[_0x8e37('0xd')],'code':_0x2b05a3[_0x8e37('0xf')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x510b87)[_0x8e37('0x1c')](function(_0x1a6561){var _0x2e79f4=JSON[_0x8e37('0x1d')](_0x1a6561);if(_0x2e79f4[_0x8e37('0x1e')]){_0x2b05a3[_0x8e37('0x1f')]=_0x2e79f4[_0x8e37('0x1e')];logger['info'](util[_0x8e37('0x24')](_0x8e37('0x21'),_0x2b05a3[_0x8e37('0x22')],_0x2b05a3['id']));}else{logger['error'](util[_0x8e37('0x24')](_0x8e37('0x25'),_0x2b05a3[_0x8e37('0x22')],_0x2b05a3['id']),util[_0x8e37('0x26')](_0x2e79f4,{'showHidden':![],'depth':null}));}return _0x599ee1(null,_0x32b778);})[_0x8e37('0x27')](function(_0x1350f2){logger[_0x8e37('0x23')](util[_0x8e37('0x24')](_0x8e37('0x25'),_0x2b05a3[_0x8e37('0x22')],_0x2b05a3['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x599ee1(_0x1350f2);});}else{return _0x599ee1(null,_0x32b778);}}}});}; \ No newline at end of file +var _0x4a20=['./intZohoAccount.attributes','../../components/integrations/configuration','define','ZohoAccount','int_zoho_accounts','changed','zone','clientId','clientSecret','code','host','slice','substring','https://accounts.zoho.com','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','authorization_code','serverUrl','application/x-www-form-urlencoded','then','parse','refresh_token','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','lastIndexOf','https://accounts.zoho.com.au','https://accounts.zoho.eu','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5517c0,_0x358609){var _0x33803b=function(_0x513c18){while(--_0x513c18){_0x5517c0['push'](_0x5517c0['shift']());}};_0x33803b(++_0x358609);}(_0x4a20,0x79));var _0x04a2=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x4a20[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x04a2('0x0'));var util=require('util');var logger=require(_0x04a2('0x1'))(_0x04a2('0x2'));var moment=require('moment');var BPromise=require(_0x04a2('0x3'));var rp=require(_0x04a2('0x4'));var fs=require('fs');var path=require(_0x04a2('0x5'));var rimraf=require(_0x04a2('0x6'));var config=require(_0x04a2('0x7'));var attributes=require(_0x04a2('0x8'));var integrations=require(_0x04a2('0x9'));module['exports']=function(_0x3e5619,_0x108977){return _0x3e5619[_0x04a2('0xa')](_0x04a2('0xb'),attributes,{'tableName':_0x04a2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1b649b,_0x46ec80,_0x4ed9f0){if(_0x1b649b[_0x04a2('0xd')](_0x04a2('0xe'))||_0x1b649b[_0x04a2('0xd')]('serverUrl')||_0x1b649b['changed'](_0x04a2('0xf'))||_0x1b649b['changed'](_0x04a2('0x10'))||_0x1b649b[_0x04a2('0xd')](_0x04a2('0x11'))||_0x1b649b[_0x04a2('0xd')](_0x04a2('0x12'))){var _0x54df8c,_0x5c57f6;_0x54df8c=_0x1b649b['serverUrl'];var _0x186807=_0x54df8c[_0x04a2('0x13')](-0x1);if(_0x186807==='/'||_0x186807==='\x5c'||_0x186807===':'){_0x54df8c=_0x54df8c[_0x04a2('0x14')](0x0,_0x54df8c['lastIndexOf'](_0x186807));}switch(_0x1b649b[_0x04a2('0xe')]){case'US':_0x5c57f6=_0x04a2('0x15');break;case'AU':_0x5c57f6='https://accounts.zoho.com.au';break;case'IN':_0x5c57f6=_0x04a2('0x16');break;case'CN':_0x5c57f6=_0x04a2('0x17');break;default:_0x5c57f6='https://accounts.zoho.eu';break;}var _0x425033={'method':_0x04a2('0x18'),'uri':_0x5c57f6+_0x04a2('0x19'),'form':{'grant_type':_0x04a2('0x1a'),'client_id':_0x1b649b[_0x04a2('0xf')],'client_secret':_0x1b649b['clientSecret'],'redirect_uri':_0x1b649b[_0x04a2('0x1b')],'code':_0x1b649b['code']},'headers':{'Content-Type':_0x04a2('0x1c')}};return rp(_0x425033)[_0x04a2('0x1d')](function(_0x483be6){var _0x7c731a=JSON[_0x04a2('0x1e')](_0x483be6);if(_0x7c731a[_0x04a2('0x1f')]){_0x1b649b['refreshToken']=_0x7c731a[_0x04a2('0x1f')];logger[_0x04a2('0x20')](util[_0x04a2('0x21')](_0x04a2('0x22'),_0x1b649b[_0x04a2('0x23')],_0x1b649b['id']));}else{logger[_0x04a2('0x24')](util['format'](_0x04a2('0x25'),_0x1b649b[_0x04a2('0x23')],_0x1b649b['id']),util[_0x04a2('0x26')](_0x7c731a,{'showHidden':![],'depth':null}));}return _0x4ed9f0(null,_0x46ec80);})[_0x04a2('0x27')](function(_0x55d7de){logger[_0x04a2('0x24')](util[_0x04a2('0x21')](_0x04a2('0x25'),_0x1b649b[_0x04a2('0x23')],_0x1b649b['id']),util[_0x04a2('0x26')](parsedResult,{'showHidden':![],'depth':null}));return _0x4ed9f0(_0x55d7de);});}else{return _0x4ed9f0(null,_0x46ec80);}},'beforeUpdate':function(_0x154192,_0x4c73f5,_0x3f31d4){if(_0x154192[_0x04a2('0xd')](_0x04a2('0xe'))||_0x154192[_0x04a2('0xd')]('serverUrl')||_0x154192[_0x04a2('0xd')]('clientId')||_0x154192[_0x04a2('0xd')](_0x04a2('0x10'))||_0x154192[_0x04a2('0xd')]('code')||_0x154192['changed'](_0x04a2('0x12'))){var _0x109972,_0x5eb2e2;_0x109972=_0x154192['serverUrl'];var _0xfb513e=_0x109972[_0x04a2('0x13')](-0x1);if(_0xfb513e==='/'||_0xfb513e==='\x5c'||_0xfb513e===':'){_0x109972=_0x109972[_0x04a2('0x14')](0x0,_0x109972[_0x04a2('0x28')](_0xfb513e));}switch(_0x154192[_0x04a2('0xe')]){case'US':_0x5eb2e2=_0x04a2('0x15');break;case'AU':_0x5eb2e2=_0x04a2('0x29');break;case'IN':_0x5eb2e2=_0x04a2('0x16');break;case'CN':_0x5eb2e2=_0x04a2('0x17');break;default:_0x5eb2e2=_0x04a2('0x2a');break;}var _0x285c38={'method':_0x04a2('0x18'),'uri':_0x5eb2e2+'/oauth/v2/token','form':{'grant_type':'authorization_code','client_id':_0x154192[_0x04a2('0xf')],'client_secret':_0x154192[_0x04a2('0x10')],'redirect_uri':_0x154192['serverUrl'],'code':_0x154192[_0x04a2('0x11')]},'headers':{'Content-Type':_0x04a2('0x1c')}};return rp(_0x285c38)[_0x04a2('0x1d')](function(_0x36a133){var _0xac0ea2=JSON[_0x04a2('0x1e')](_0x36a133);if(_0xac0ea2[_0x04a2('0x1f')]){_0x154192['refreshToken']=_0xac0ea2['refresh_token'];logger[_0x04a2('0x20')](util[_0x04a2('0x21')](_0x04a2('0x22'),_0x154192[_0x04a2('0x23')],_0x154192['id']));}else{logger[_0x04a2('0x24')](util[_0x04a2('0x21')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x154192[_0x04a2('0x23')],_0x154192['id']),util['inspect'](_0xac0ea2,{'showHidden':![],'depth':null}));}return _0x3f31d4(null,_0x4c73f5);})[_0x04a2('0x27')](function(_0x339a62){logger[_0x04a2('0x24')](util[_0x04a2('0x21')](_0x04a2('0x25'),_0x154192[_0x04a2('0x23')],_0x154192['id']),util[_0x04a2('0x26')](parsedResult,{'showHidden':![],'depth':null}));return _0x3f31d4(_0x339a62);});}else{return _0x3f31d4(null,_0x4c73f5);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 6ba0c1b..0302ae9 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 _0x8ff9=['model','then','ShowZohoAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetZohoAccount','ZohoAccount','findAll','options','raw','where','attributes','limit','include','map'];(function(_0x31117b,_0xc8183a){var _0x287cb7=function(_0x20b8d6){while(--_0x20b8d6){_0x31117b['push'](_0x31117b['shift']());}};_0x287cb7(++_0xc8183a);}(_0x8ff9,0x1a6));var _0x98ff=function(_0x4d91de,_0xc151ae){_0x4d91de=_0x4d91de-0x0;var _0x49da69=_0x8ff9[_0x4d91de];return _0x49da69;};'use strict';var _=require(_0x98ff('0x0'));var util=require(_0x98ff('0x1'));var moment=require(_0x98ff('0x2'));var BPromise=require(_0x98ff('0x3'));var rs=require(_0x98ff('0x4'));var fs=require('fs');var Redis=require(_0x98ff('0x5'));var db=require(_0x98ff('0x6'))['db'];var utils=require(_0x98ff('0x7'));var logger=require(_0x98ff('0x8'))(_0x98ff('0x9'));var config=require(_0x98ff('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x98ff('0xb')][_0x98ff('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x13537e,_0x21d840,_0x12d3fe){return new BPromise(function(_0xbe13f3,_0x51fbd8){return client[_0x98ff('0xd')](_0x13537e,_0x12d3fe)['then'](function(_0x4bbf37){logger[_0x98ff('0xe')](_0x98ff('0xf'),_0x21d840,_0x98ff('0x10'));logger[_0x98ff('0x11')](_0x98ff('0x12'),_0x21d840,'request\x20sent',JSON[_0x98ff('0x13')](_0x4bbf37));if(_0x4bbf37['error']){if(_0x4bbf37[_0x98ff('0x14')]['code']===0x1f4){logger['error'](_0x98ff('0xf'),_0x21d840,_0x4bbf37[_0x98ff('0x14')][_0x98ff('0x15')]);return _0x51fbd8(_0x4bbf37['error'][_0x98ff('0x15')]);}logger['error'](_0x98ff('0xf'),_0x21d840,_0x4bbf37[_0x98ff('0x14')][_0x98ff('0x15')]);return _0xbe13f3(_0x4bbf37[_0x98ff('0x14')][_0x98ff('0x15')]);}else{logger[_0x98ff('0xe')]('ZohoAccount,\x20%s,\x20%s',_0x21d840,_0x98ff('0x10'));_0xbe13f3(_0x4bbf37[_0x98ff('0x16')][_0x98ff('0x15')]);}})[_0x98ff('0x17')](function(_0x3751b9){logger[_0x98ff('0x14')](_0x98ff('0xf'),_0x21d840,_0x3751b9);_0x51fbd8(_0x3751b9);});});}exports[_0x98ff('0x18')]=function(_0x268121){var _0x3c04d4=this;return new Promise(function(_0x91e31c,_0x1611b5){return db[_0x98ff('0x19')][_0x98ff('0x1a')]({'raw':_0x268121['options']?_0x268121[_0x98ff('0x1b')][_0x98ff('0x1c')]===undefined?!![]:![]:!![],'where':_0x268121[_0x98ff('0x1b')]?_0x268121[_0x98ff('0x1b')][_0x98ff('0x1d')]||null:null,'attributes':_0x268121[_0x98ff('0x1b')]?_0x268121[_0x98ff('0x1b')][_0x98ff('0x1e')]||null:null,'limit':_0x268121[_0x98ff('0x1b')]?_0x268121[_0x98ff('0x1b')][_0x98ff('0x1f')]||null:null,'include':_0x268121[_0x98ff('0x1b')]?_0x268121[_0x98ff('0x1b')]['include']?_['map'](_0x268121['options'][_0x98ff('0x20')],function(_0x3ee01b){return{'model':db[_0x3ee01b['model']],'as':_0x3ee01b['as'],'attributes':_0x3ee01b[_0x98ff('0x1e')],'include':_0x3ee01b['include']?_[_0x98ff('0x21')](_0x3ee01b[_0x98ff('0x20')],function(_0x308efd){return{'model':db[_0x308efd[_0x98ff('0x22')]],'as':_0x308efd['as'],'attributes':_0x308efd[_0x98ff('0x1e')],'include':_0x308efd['include']?_['map'](_0x308efd[_0x98ff('0x20')],function(_0x1a4ebd){return{'model':db[_0x1a4ebd[_0x98ff('0x22')]],'as':_0x1a4ebd['as'],'attributes':_0x1a4ebd[_0x98ff('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x98ff('0x23')](function(_0x231e00){logger[_0x98ff('0xe')](_0x98ff('0x18'),_0x268121);logger[_0x98ff('0x11')](_0x98ff('0x18'),_0x268121,JSON['stringify'](_0x231e00));_0x91e31c(_0x231e00);})[_0x98ff('0x17')](function(_0x256823){logger[_0x98ff('0x14')](_0x98ff('0x18'),_0x256823[_0x98ff('0x15')],_0x268121);_0x1611b5(_0x3c04d4[_0x98ff('0x14')](0x1f4,_0x256823[_0x98ff('0x15')]));});});};exports[_0x98ff('0x24')]=function(_0x42213a){var _0x205d85=this;return new Promise(function(_0x3fa70c,_0x1472cb){return db[_0x98ff('0x19')][_0x98ff('0x25')]({'raw':_0x42213a[_0x98ff('0x1b')]?_0x42213a[_0x98ff('0x1b')][_0x98ff('0x1c')]===undefined?!![]:![]:!![],'where':_0x42213a[_0x98ff('0x1b')]?_0x42213a[_0x98ff('0x1b')][_0x98ff('0x1d')]||null:null,'attributes':_0x42213a[_0x98ff('0x1b')]?_0x42213a['options'][_0x98ff('0x1e')]||null:null,'include':_0x42213a[_0x98ff('0x1b')]?_0x42213a[_0x98ff('0x1b')][_0x98ff('0x20')]?_[_0x98ff('0x21')](_0x42213a['options'][_0x98ff('0x20')],function(_0x56b676){return{'model':db[_0x56b676[_0x98ff('0x22')]],'as':_0x56b676['as'],'attributes':_0x56b676[_0x98ff('0x1e')],'include':_0x56b676[_0x98ff('0x20')]?_[_0x98ff('0x21')](_0x56b676[_0x98ff('0x20')],function(_0x8dfe4d){return{'model':db[_0x8dfe4d[_0x98ff('0x22')]],'as':_0x8dfe4d['as'],'attributes':_0x8dfe4d[_0x98ff('0x1e')],'include':_0x8dfe4d[_0x98ff('0x20')]?_[_0x98ff('0x21')](_0x8dfe4d['include'],function(_0x20c907){return{'model':db[_0x20c907[_0x98ff('0x22')]],'as':_0x20c907['as'],'attributes':_0x20c907[_0x98ff('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x98ff('0x23')](function(_0x34219e){logger[_0x98ff('0xe')](_0x98ff('0x24'),_0x42213a);logger[_0x98ff('0x11')]('ShowZohoAccount',_0x42213a,JSON[_0x98ff('0x13')](_0x34219e));_0x3fa70c(_0x34219e);})['catch'](function(_0x13f7b1){logger[_0x98ff('0x14')](_0x98ff('0x24'),_0x13f7b1[_0x98ff('0x15')],_0x42213a);_0x1472cb(_0x205d85[_0x98ff('0x14')](0x1f4,_0x13f7b1['message']));});});}; \ No newline at end of file +var _0x3c8e=['then','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetZohoAccount','ZohoAccount','findAll','options','raw','where','attributes','limit','include','map','model','debug','ShowZohoAccount'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x3c8e,0x89));var _0xe3c8=function(_0x2410ab,_0x390f8c){_0x2410ab=_0x2410ab-0x0;var _0x2b15e2=_0x3c8e[_0x2410ab];return _0x2b15e2;};'use strict';var _=require(_0xe3c8('0x0'));var util=require(_0xe3c8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe3c8('0x2'));var fs=require('fs');var Redis=require(_0xe3c8('0x3'));var db=require(_0xe3c8('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe3c8('0x5'))(_0xe3c8('0x6'));var config=require(_0xe3c8('0x7'));var jayson=require(_0xe3c8('0x8'));var client=jayson['client'][_0xe3c8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x16acf1,_0x2fe9e5,_0x222f26){return new BPromise(function(_0xf4387f,_0x5f3375){return client[_0xe3c8('0xa')](_0x16acf1,_0x222f26)['then'](function(_0x1b6e5e){logger[_0xe3c8('0xb')](_0xe3c8('0xc'),_0x2fe9e5,_0xe3c8('0xd'));logger['debug'](_0xe3c8('0xe'),_0x2fe9e5,_0xe3c8('0xd'),JSON[_0xe3c8('0xf')](_0x1b6e5e));if(_0x1b6e5e['error']){if(_0x1b6e5e[_0xe3c8('0x10')]['code']===0x1f4){logger[_0xe3c8('0x10')]('ZohoAccount,\x20%s,\x20%s',_0x2fe9e5,_0x1b6e5e['error'][_0xe3c8('0x11')]);return _0x5f3375(_0x1b6e5e[_0xe3c8('0x10')][_0xe3c8('0x11')]);}logger['error'](_0xe3c8('0xc'),_0x2fe9e5,_0x1b6e5e[_0xe3c8('0x10')][_0xe3c8('0x11')]);return _0xf4387f(_0x1b6e5e[_0xe3c8('0x10')][_0xe3c8('0x11')]);}else{logger[_0xe3c8('0xb')]('ZohoAccount,\x20%s,\x20%s',_0x2fe9e5,_0xe3c8('0xd'));_0xf4387f(_0x1b6e5e[_0xe3c8('0x12')]['message']);}})[_0xe3c8('0x13')](function(_0x10d57b){logger[_0xe3c8('0x10')]('ZohoAccount,\x20%s,\x20%s',_0x2fe9e5,_0x10d57b);_0x5f3375(_0x10d57b);});});}exports[_0xe3c8('0x14')]=function(_0x1dc06e){var _0x36d454=this;return new Promise(function(_0x1677ef,_0x1142a3){return db[_0xe3c8('0x15')][_0xe3c8('0x16')]({'raw':_0x1dc06e['options']?_0x1dc06e[_0xe3c8('0x17')][_0xe3c8('0x18')]===undefined?!![]:![]:!![],'where':_0x1dc06e[_0xe3c8('0x17')]?_0x1dc06e[_0xe3c8('0x17')][_0xe3c8('0x19')]||null:null,'attributes':_0x1dc06e[_0xe3c8('0x17')]?_0x1dc06e['options'][_0xe3c8('0x1a')]||null:null,'limit':_0x1dc06e[_0xe3c8('0x17')]?_0x1dc06e['options'][_0xe3c8('0x1b')]||null:null,'include':_0x1dc06e[_0xe3c8('0x17')]?_0x1dc06e['options'][_0xe3c8('0x1c')]?_[_0xe3c8('0x1d')](_0x1dc06e['options'][_0xe3c8('0x1c')],function(_0x3f9460){return{'model':db[_0x3f9460[_0xe3c8('0x1e')]],'as':_0x3f9460['as'],'attributes':_0x3f9460[_0xe3c8('0x1a')],'include':_0x3f9460[_0xe3c8('0x1c')]?_['map'](_0x3f9460[_0xe3c8('0x1c')],function(_0x50a2ce){return{'model':db[_0x50a2ce['model']],'as':_0x50a2ce['as'],'attributes':_0x50a2ce['attributes'],'include':_0x50a2ce[_0xe3c8('0x1c')]?_['map'](_0x50a2ce[_0xe3c8('0x1c')],function(_0x27887a){return{'model':db[_0x27887a['model']],'as':_0x27887a['as'],'attributes':_0x27887a[_0xe3c8('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2941c2){logger[_0xe3c8('0xb')](_0xe3c8('0x14'),_0x1dc06e);logger[_0xe3c8('0x1f')](_0xe3c8('0x14'),_0x1dc06e,JSON[_0xe3c8('0xf')](_0x2941c2));_0x1677ef(_0x2941c2);})[_0xe3c8('0x13')](function(_0x497448){logger['error'](_0xe3c8('0x14'),_0x497448[_0xe3c8('0x11')],_0x1dc06e);_0x1142a3(_0x36d454[_0xe3c8('0x10')](0x1f4,_0x497448['message']));});});};exports[_0xe3c8('0x20')]=function(_0x266399){var _0x2c928a=this;return new Promise(function(_0x1d5da7,_0x4802a5){return db[_0xe3c8('0x15')]['find']({'raw':_0x266399[_0xe3c8('0x17')]?_0x266399[_0xe3c8('0x17')][_0xe3c8('0x18')]===undefined?!![]:![]:!![],'where':_0x266399[_0xe3c8('0x17')]?_0x266399['options'][_0xe3c8('0x19')]||null:null,'attributes':_0x266399[_0xe3c8('0x17')]?_0x266399[_0xe3c8('0x17')]['attributes']||null:null,'include':_0x266399[_0xe3c8('0x17')]?_0x266399[_0xe3c8('0x17')][_0xe3c8('0x1c')]?_[_0xe3c8('0x1d')](_0x266399[_0xe3c8('0x17')][_0xe3c8('0x1c')],function(_0x5411a3){return{'model':db[_0x5411a3[_0xe3c8('0x1e')]],'as':_0x5411a3['as'],'attributes':_0x5411a3['attributes'],'include':_0x5411a3[_0xe3c8('0x1c')]?_[_0xe3c8('0x1d')](_0x5411a3[_0xe3c8('0x1c')],function(_0xf4cea5){return{'model':db[_0xf4cea5[_0xe3c8('0x1e')]],'as':_0xf4cea5['as'],'attributes':_0xf4cea5[_0xe3c8('0x1a')],'include':_0xf4cea5[_0xe3c8('0x1c')]?_[_0xe3c8('0x1d')](_0xf4cea5['include'],function(_0xc78c55){return{'model':db[_0xc78c55['model']],'as':_0xc78c55['as'],'attributes':_0xc78c55['attributes']};}):[]};}):[]};}):[]:[]})[_0xe3c8('0x21')](function(_0x45df79){logger[_0xe3c8('0xb')](_0xe3c8('0x20'),_0x266399);logger['debug'](_0xe3c8('0x20'),_0x266399,JSON['stringify'](_0x45df79));_0x1d5da7(_0x45df79);})[_0xe3c8('0x13')](function(_0x4138c2){logger[_0xe3c8('0x10')](_0xe3c8('0x20'),_0x4138c2[_0xe3c8('0x11')],_0x266399);_0x4802a5(_0x2c928a[_0xe3c8('0x10')](0x1f4,_0x4138c2[_0xe3c8('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index bb855f4..c5bc0d0 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 _0xc0a2=['path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getSubjects','/:id/descriptions','getDescriptions','post','put','delete','destroy','exports','multer','util'];(function(_0x824a17,_0x3fa294){var _0x582c92=function(_0x5b26c7){while(--_0x5b26c7){_0x824a17['push'](_0x824a17['shift']());}};_0x582c92(++_0x3fa294);}(_0xc0a2,0xb6));var _0x2c0a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc0a2[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x2c0a('0x0'));var util=require(_0x2c0a('0x1'));var path=require(_0x2c0a('0x2'));var timeout=require(_0x2c0a('0x3'));var express=require('express');var router=express[_0x2c0a('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2c0a('0x5'));var interaction=require(_0x2c0a('0x6'));var config=require(_0x2c0a('0x7'));var controller=require(_0x2c0a('0x8'));router[_0x2c0a('0x9')]('/',auth[_0x2c0a('0xa')](),controller[_0x2c0a('0xb')]);router['get'](_0x2c0a('0xc'),auth[_0x2c0a('0xa')](),controller[_0x2c0a('0xd')]);router[_0x2c0a('0x9')](_0x2c0a('0xe'),auth[_0x2c0a('0xa')](),controller['getFields']);router[_0x2c0a('0x9')]('/:id/subjects',auth[_0x2c0a('0xa')](),controller[_0x2c0a('0xf')]);router[_0x2c0a('0x9')](_0x2c0a('0x10'),auth[_0x2c0a('0xa')](),controller[_0x2c0a('0x11')]);router[_0x2c0a('0x12')]('/',auth[_0x2c0a('0xa')](),controller['create']);router[_0x2c0a('0x13')]('/:id',auth[_0x2c0a('0xa')](),controller['update']);router[_0x2c0a('0x14')]('/:id',auth[_0x2c0a('0xa')](),controller[_0x2c0a('0x15')]);module[_0x2c0a('0x16')]=router; \ No newline at end of file +var _0x3bd5=['util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/:id','show','/:id/fields','isAuthenticated','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','put','delete','destroy','exports','multer'];(function(_0x46f5ad,_0x4950d7){var _0x128b3a=function(_0x627769){while(--_0x627769){_0x46f5ad['push'](_0x46f5ad['shift']());}};_0x128b3a(++_0x4950d7);}(_0x3bd5,0x19d));var _0x53bd=function(_0x52509a,_0x4e3bab){_0x52509a=_0x52509a-0x0;var _0x423c27=_0x3bd5[_0x52509a];return _0x423c27;};'use strict';var multer=require(_0x53bd('0x0'));var util=require(_0x53bd('0x1'));var path=require(_0x53bd('0x2'));var timeout=require(_0x53bd('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x53bd('0x4'));var interaction=require(_0x53bd('0x5'));var config=require(_0x53bd('0x6'));var controller=require('./intZohoConfiguration.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x53bd('0x7')]);router[_0x53bd('0x8')](_0x53bd('0x9'),auth['isAuthenticated'](),controller[_0x53bd('0xa')]);router[_0x53bd('0x8')](_0x53bd('0xb'),auth[_0x53bd('0xc')](),controller[_0x53bd('0xd')]);router[_0x53bd('0x8')](_0x53bd('0xe'),auth[_0x53bd('0xc')](),controller['getSubjects']);router[_0x53bd('0x8')](_0x53bd('0xf'),auth[_0x53bd('0xc')](),controller[_0x53bd('0x10')]);router[_0x53bd('0x11')]('/',auth[_0x53bd('0xc')](),controller[_0x53bd('0x12')]);router[_0x53bd('0x13')](_0x53bd('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x53bd('0x14')](_0x53bd('0x9'),auth['isAuthenticated'](),controller[_0x53bd('0x15')]);module[_0x53bd('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index dbcf666..d1bae96 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 _0x8435=['STRING','ENUM','lead','contact','nothing','contact_lead','sequelize','exports'];(function(_0x228abe,_0x446343){var _0x5e2475=function(_0x424f72){while(--_0x424f72){_0x228abe['push'](_0x228abe['shift']());}};_0x5e2475(++_0x446343);}(_0x8435,0xf6));var _0x5843=function(_0x128967,_0x51778b){_0x128967=_0x128967-0x0;var _0x3d49b4=_0x8435[_0x128967];return _0x3d49b4;};'use strict';var Sequelize=require(_0x5843('0x0'));module[_0x5843('0x1')]={'name':{'type':Sequelize[_0x5843('0x2')]},'moduleCreate':{'type':Sequelize[_0x5843('0x3')](_0x5843('0x4'),_0x5843('0x5'),_0x5843('0x6')),'defaultValue':_0x5843('0x4')},'moduleSearch':{'type':Sequelize[_0x5843('0x3')](_0x5843('0x7'),_0x5843('0x5'),_0x5843('0x4')),'defaultValue':_0x5843('0x7')},'description':{'type':Sequelize[_0x5843('0x2')]}}; \ No newline at end of file +var _0x657a=['ENUM','lead','contact','nothing','contact_lead','sequelize','exports','STRING'];(function(_0x1b7811,_0x55e039){var _0x20fea8=function(_0x56e208){while(--_0x56e208){_0x1b7811['push'](_0x1b7811['shift']());}};_0x20fea8(++_0x55e039);}(_0x657a,0x1dd));var _0xa657=function(_0x4e8efd,_0x46bc20){_0x4e8efd=_0x4e8efd-0x0;var _0x31e442=_0x657a[_0x4e8efd];return _0x31e442;};'use strict';var Sequelize=require(_0xa657('0x0'));module[_0xa657('0x1')]={'name':{'type':Sequelize[_0xa657('0x2')]},'moduleCreate':{'type':Sequelize[_0xa657('0x3')](_0xa657('0x4'),_0xa657('0x5'),_0xa657('0x6')),'defaultValue':_0xa657('0x4')},'moduleSearch':{'type':Sequelize[_0xa657('0x3')](_0xa657('0x7'),'contact','lead'),'defaultValue':'contact_lead'},'description':{'type':Sequelize[_0xa657('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 8808ca5..2a7785b 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 _0x0d73=['keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','filters','find','create','body','update','catch','order','pick','map','getFields','getSubjects','findOne','getDescriptions','ZohoField','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','apply','reject','save','destroy','then','end','sendStatus','error','stack','name','send','index','ZohoConfiguration','rawAttributes','type','key','model','query'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x0d73,0x74));var _0x30d7=function(_0x5e2750,_0x2596a4){_0x5e2750=_0x5e2750-0x0;var _0x4cf8b9=_0x0d73[_0x5e2750];return _0x4cf8b9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x30d7('0x0'));var zipdir=require(_0x30d7('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x30d7('0x2'));var moment=require(_0x30d7('0x3'));var BPromise=require(_0x30d7('0x4'));var Mustache=require('mustache');var util=require(_0x30d7('0x5'));var path=require(_0x30d7('0x6'));var sox=require(_0x30d7('0x7'));var csv=require(_0x30d7('0x8'));var ejs=require(_0x30d7('0x9'));var fs=require('fs');var fs_extra=require(_0x30d7('0xa'));var _=require(_0x30d7('0xb'));var squel=require(_0x30d7('0xc'));var crypto=require(_0x30d7('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x30d7('0xe'));var toCsv=require('to-csv');var querystring=require(_0x30d7('0xf'));var Papa=require(_0x30d7('0x10'));var Redis=require(_0x30d7('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x30d7('0x12'));var as=require(_0x30d7('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x30d7('0x14'))(_0x30d7('0x15'));var utils=require('../../config/utils');var config=require(_0x30d7('0x16'));var licenseUtil=require(_0x30d7('0x17'));var db=require(_0x30d7('0x18'))['db'];function respondWithStatusCode(_0x2ba6ca,_0xedd32f){_0xedd32f=_0xedd32f||0xcc;return function(_0x215a57){if(_0x215a57){return _0x2ba6ca['sendStatus'](_0xedd32f);}return _0x2ba6ca[_0x30d7('0x19')](_0xedd32f)['end']();};}function respondWithResult(_0x597138,_0x4af145){_0x4af145=_0x4af145||0xc8;return function(_0x1f5805){if(_0x1f5805){return _0x597138[_0x30d7('0x19')](_0x4af145)[_0x30d7('0x1a')](_0x1f5805);}};}function respondWithFilteredResult(_0x3c5193,_0x70b33f){return function(_0x555352){if(_0x555352){var _0x1a00b9=typeof _0x70b33f[_0x30d7('0x1b')]===_0x30d7('0x1c')&&typeof _0x70b33f[_0x30d7('0x1d')]===_0x30d7('0x1c');var _0x5c7a74=_0x555352[_0x30d7('0x1e')];var _0x4a4c3a=_0x1a00b9?0x0:_0x70b33f[_0x30d7('0x1b')];var _0xe78637=_0x1a00b9?_0x555352[_0x30d7('0x1e')]:_0x70b33f[_0x30d7('0x1b')]+_0x70b33f['limit'];var _0x3f404d;if(_0xe78637>=_0x5c7a74){_0xe78637=_0x5c7a74;_0x3f404d=0xc8;}else{_0x3f404d=0xce;}_0x3c5193[_0x30d7('0x19')](_0x3f404d);return _0x3c5193[_0x30d7('0x1f')]('Content-Range',_0x4a4c3a+'-'+_0xe78637+'/'+_0x5c7a74)[_0x30d7('0x1a')](_0x555352);}return null;};}function patchUpdates(_0x4b4573){return function(_0x39b59d){try{jsonpatch[_0x30d7('0x20')](_0x39b59d,_0x4b4573,!![]);}catch(_0x358c79){return BPromise[_0x30d7('0x21')](_0x358c79);}return _0x39b59d[_0x30d7('0x22')]();};}function saveUpdates(_0xb1e17f,_0x4752f6){return function(_0x3a4e30){if(_0x3a4e30){return _0x3a4e30['update'](_0xb1e17f)['then'](function(_0x5b2b73){return _0x5b2b73;});}return null;};}function removeEntity(_0x40b264,_0x541fb7){return function(_0x336a51){if(_0x336a51){return _0x336a51[_0x30d7('0x23')]()[_0x30d7('0x24')](function(){_0x40b264[_0x30d7('0x19')](0xcc)[_0x30d7('0x25')]();});}};}function handleEntityNotFound(_0x5a4e3c,_0x1bee27){return function(_0x3ef860){if(!_0x3ef860){_0x5a4e3c[_0x30d7('0x26')](0x194);}return _0x3ef860;};}function handleError(_0x57f114,_0x29f2e9){_0x29f2e9=_0x29f2e9||0x1f4;return function(_0x4f5095){logger[_0x30d7('0x27')](_0x4f5095[_0x30d7('0x28')]);if(_0x4f5095[_0x30d7('0x29')]){delete _0x4f5095[_0x30d7('0x29')];}_0x57f114['status'](_0x29f2e9)[_0x30d7('0x2a')](_0x4f5095);};}exports[_0x30d7('0x2b')]=function(_0x29fed6,_0x3a1158){var _0xb1f3de={},_0xba0e3d={},_0xee711e={'count':0x0,'rows':[]};var _0x19698b=_['map'](db[_0x30d7('0x2c')][_0x30d7('0x2d')],function(_0x2d42f5){return{'name':_0x2d42f5['fieldName'],'type':_0x2d42f5[_0x30d7('0x2e')][_0x30d7('0x2f')]};});_0xba0e3d[_0x30d7('0x30')]=_['map'](_0x19698b,_0x30d7('0x29'));_0xba0e3d[_0x30d7('0x31')]=_[_0x30d7('0x32')](_0x29fed6[_0x30d7('0x31')]);_0xba0e3d['filters']=_[_0x30d7('0x33')](_0xba0e3d[_0x30d7('0x30')],_0xba0e3d[_0x30d7('0x31')]);_0xb1f3de['attributes']=_['intersection'](_0xba0e3d[_0x30d7('0x30')],qs['fields'](_0x29fed6['query'][_0x30d7('0x34')]));_0xb1f3de[_0x30d7('0x35')]=_0xb1f3de[_0x30d7('0x35')][_0x30d7('0x36')]?_0xb1f3de[_0x30d7('0x35')]:_0xba0e3d[_0x30d7('0x30')];if(!_0x29fed6[_0x30d7('0x31')][_0x30d7('0x37')](_0x30d7('0x38'))){_0xb1f3de['limit']=qs[_0x30d7('0x1d')](_0x29fed6['query'][_0x30d7('0x1d')]);_0xb1f3de[_0x30d7('0x1b')]=qs[_0x30d7('0x1b')](_0x29fed6['query'][_0x30d7('0x1b')]);}_0xb1f3de['order']=qs[_0x30d7('0x39')](_0x29fed6[_0x30d7('0x31')][_0x30d7('0x39')]);_0xb1f3de[_0x30d7('0x3a')]=qs['filters'](_['pick'](_0x29fed6[_0x30d7('0x31')],_0xba0e3d['filters']),_0x19698b);if(_0x29fed6[_0x30d7('0x31')][_0x30d7('0x3b')]){_0xb1f3de['where']=_[_0x30d7('0x3c')](_0xb1f3de[_0x30d7('0x3a')],{'$or':_['map'](_0x19698b,function(_0xf66685){if(_0xf66685[_0x30d7('0x2e')]!==_0x30d7('0x3d')){var _0x68badb={};_0x68badb[_0xf66685[_0x30d7('0x29')]]={'$like':'%'+_0x29fed6[_0x30d7('0x31')][_0x30d7('0x3b')]+'%'};return _0x68badb;}})});}_0xb1f3de=_[_0x30d7('0x3c')]({},_0xb1f3de,_0x29fed6[_0x30d7('0x3e')]);var _0x940b3c={'where':_0xb1f3de[_0x30d7('0x3a')]};return db[_0x30d7('0x2c')][_0x30d7('0x1e')](_0x940b3c)[_0x30d7('0x24')](function(_0xdcc082){_0xee711e[_0x30d7('0x1e')]=_0xdcc082;if(_0x29fed6[_0x30d7('0x31')][_0x30d7('0x3f')]){_0xb1f3de[_0x30d7('0x40')]=[{'all':!![]}];}return db[_0x30d7('0x2c')][_0x30d7('0x41')](_0xb1f3de);})[_0x30d7('0x24')](function(_0x3026bb){_0xee711e[_0x30d7('0x42')]=_0x3026bb;return _0xee711e;})[_0x30d7('0x24')](respondWithFilteredResult(_0x3a1158,_0xb1f3de))['catch'](handleError(_0x3a1158,null));};exports[_0x30d7('0x43')]=function(_0x1a3d6e,_0x5add32){var _0x3bd064={'raw':![],'where':{'id':_0x1a3d6e[_0x30d7('0x44')]['id']}},_0x208788={};_0x208788['model']=_[_0x30d7('0x32')](db[_0x30d7('0x2c')][_0x30d7('0x2d')]);_0x208788[_0x30d7('0x31')]=_[_0x30d7('0x32')](_0x1a3d6e['query']);_0x208788[_0x30d7('0x45')]=_['intersection'](_0x208788[_0x30d7('0x30')],_0x208788[_0x30d7('0x31')]);_0x3bd064[_0x30d7('0x35')]=_[_0x30d7('0x33')](_0x208788['model'],qs['fields'](_0x1a3d6e[_0x30d7('0x31')]['fields']));_0x3bd064[_0x30d7('0x35')]=_0x3bd064['attributes'][_0x30d7('0x36')]?_0x3bd064[_0x30d7('0x35')]:_0x208788['model'];if(_0x1a3d6e[_0x30d7('0x31')][_0x30d7('0x3f')]){_0x3bd064[_0x30d7('0x40')]=[{'all':!![]}];}_0x3bd064=_[_0x30d7('0x3c')]({},_0x3bd064,_0x1a3d6e['options']);return db[_0x30d7('0x2c')][_0x30d7('0x46')](_0x3bd064)[_0x30d7('0x24')](handleEntityNotFound(_0x5add32,null))[_0x30d7('0x24')](respondWithResult(_0x5add32,null))['catch'](handleError(_0x5add32,null));};exports[_0x30d7('0x47')]=function(_0x50f100,_0x1d1928){return db[_0x30d7('0x2c')][_0x30d7('0x47')](_0x50f100[_0x30d7('0x48')],{})[_0x30d7('0x24')](respondWithResult(_0x1d1928,0xc9))['catch'](handleError(_0x1d1928,null));};exports[_0x30d7('0x49')]=function(_0x1a9701,_0x2d0d72){if(_0x1a9701[_0x30d7('0x48')]['id']){delete _0x1a9701[_0x30d7('0x48')]['id'];}return db[_0x30d7('0x2c')][_0x30d7('0x46')]({'where':{'id':_0x1a9701['params']['id']}})['then'](handleEntityNotFound(_0x2d0d72,null))[_0x30d7('0x24')](saveUpdates(_0x1a9701[_0x30d7('0x48')],null))[_0x30d7('0x24')](respondWithResult(_0x2d0d72,null))['catch'](handleError(_0x2d0d72,null));};exports['destroy']=function(_0x507727,_0x182d16){return db[_0x30d7('0x2c')][_0x30d7('0x46')]({'where':{'id':_0x507727[_0x30d7('0x44')]['id']}})[_0x30d7('0x24')](handleEntityNotFound(_0x182d16,null))[_0x30d7('0x24')](removeEntity(_0x182d16,null))[_0x30d7('0x4a')](handleError(_0x182d16,null));};exports['getFields']=function(_0x2c511f,_0x51f030,_0x3a99c3){var _0x11e5a6={};var _0x27477f={};var _0x3d13d8;var _0x30125c;return db[_0x30d7('0x2c')]['findOne']({'where':{'id':_0x2c511f[_0x30d7('0x44')]['id']}})['then'](handleEntityNotFound(_0x51f030,null))[_0x30d7('0x24')](function(_0xf5ceaa){if(_0xf5ceaa){_0x3d13d8=_0xf5ceaa;_0x27477f['model']=_[_0x30d7('0x32')](db['ZohoField'][_0x30d7('0x2d')]);_0x27477f[_0x30d7('0x31')]=_[_0x30d7('0x32')](_0x2c511f['query']);_0x27477f['filters']=_['intersection'](_0x27477f[_0x30d7('0x30')],_0x27477f[_0x30d7('0x31')]);_0x11e5a6['attributes']=_[_0x30d7('0x33')](_0x27477f[_0x30d7('0x30')],qs[_0x30d7('0x34')](_0x2c511f['query'][_0x30d7('0x34')]));_0x11e5a6[_0x30d7('0x35')]=_0x11e5a6['attributes'][_0x30d7('0x36')]?_0x11e5a6[_0x30d7('0x35')]:_0x27477f['model'];_0x11e5a6[_0x30d7('0x4b')]=qs[_0x30d7('0x39')](_0x2c511f[_0x30d7('0x31')][_0x30d7('0x39')]);_0x11e5a6[_0x30d7('0x3a')]=qs['filters'](_[_0x30d7('0x4c')](_0x2c511f[_0x30d7('0x31')],_0x27477f[_0x30d7('0x45')]));if(_0x2c511f[_0x30d7('0x31')][_0x30d7('0x3b')]){_0x11e5a6[_0x30d7('0x3a')]=_[_0x30d7('0x3c')](_0x11e5a6[_0x30d7('0x3a')],{'$or':_[_0x30d7('0x4d')](_0x11e5a6['attributes'],function(_0x1188ba){var _0x45d3cd={};_0x45d3cd[_0x1188ba]={'$like':'%'+_0x2c511f[_0x30d7('0x31')]['filter']+'%'};return _0x45d3cd;})});}_0x11e5a6=_[_0x30d7('0x3c')]({},_0x11e5a6,_0x2c511f[_0x30d7('0x3e')]);return _0x3d13d8[_0x30d7('0x4e')](_0x11e5a6);}})[_0x30d7('0x24')](function(_0x4c5edb){if(_0x4c5edb){_0x30125c=_0x4c5edb[_0x30d7('0x36')];if(!_0x2c511f[_0x30d7('0x31')][_0x30d7('0x37')]('nolimit')){_0x11e5a6[_0x30d7('0x1d')]=qs[_0x30d7('0x1d')](_0x2c511f[_0x30d7('0x31')]['limit']);_0x11e5a6[_0x30d7('0x1b')]=qs[_0x30d7('0x1b')](_0x2c511f['query'][_0x30d7('0x1b')]);}return _0x3d13d8[_0x30d7('0x4e')](_0x11e5a6);}})[_0x30d7('0x24')](function(_0x1125fa){if(_0x1125fa){return _0x1125fa?{'count':_0x30125c,'rows':_0x1125fa}:null;}})['then'](respondWithResult(_0x51f030,null))[_0x30d7('0x4a')](handleError(_0x51f030,null));};exports[_0x30d7('0x4f')]=function(_0x4e98d9,_0x193246,_0x2a42ff){var _0x2391eb={};var _0x469251={};var _0x35188e;var _0x59acd9;return db[_0x30d7('0x2c')][_0x30d7('0x50')]({'where':{'id':_0x4e98d9[_0x30d7('0x44')]['id']}})['then'](handleEntityNotFound(_0x193246,null))['then'](function(_0x24f5fd){if(_0x24f5fd){_0x35188e=_0x24f5fd;_0x469251[_0x30d7('0x30')]=_[_0x30d7('0x32')](db['ZohoField']['rawAttributes']);_0x469251[_0x30d7('0x31')]=_[_0x30d7('0x32')](_0x4e98d9['query']);_0x469251[_0x30d7('0x45')]=_[_0x30d7('0x33')](_0x469251[_0x30d7('0x30')],_0x469251[_0x30d7('0x31')]);_0x2391eb['attributes']=_[_0x30d7('0x33')](_0x469251[_0x30d7('0x30')],qs[_0x30d7('0x34')](_0x4e98d9[_0x30d7('0x31')][_0x30d7('0x34')]));_0x2391eb['attributes']=_0x2391eb[_0x30d7('0x35')][_0x30d7('0x36')]?_0x2391eb[_0x30d7('0x35')]:_0x469251['model'];_0x2391eb[_0x30d7('0x4b')]=qs[_0x30d7('0x39')](_0x4e98d9[_0x30d7('0x31')][_0x30d7('0x39')]);_0x2391eb[_0x30d7('0x3a')]=qs[_0x30d7('0x45')](_[_0x30d7('0x4c')](_0x4e98d9[_0x30d7('0x31')],_0x469251[_0x30d7('0x45')]));if(_0x4e98d9[_0x30d7('0x31')][_0x30d7('0x3b')]){_0x2391eb[_0x30d7('0x3a')]=_['merge'](_0x2391eb[_0x30d7('0x3a')],{'$or':_['map'](_0x2391eb[_0x30d7('0x35')],function(_0x2ba7ec){var _0x21f863={};_0x21f863[_0x2ba7ec]={'$like':'%'+_0x4e98d9['query']['filter']+'%'};return _0x21f863;})});}_0x2391eb=_['merge']({},_0x2391eb,_0x4e98d9['options']);return _0x35188e[_0x30d7('0x4f')](_0x2391eb);}})[_0x30d7('0x24')](function(_0x1bc93b){if(_0x1bc93b){_0x59acd9=_0x1bc93b[_0x30d7('0x36')];if(!_0x4e98d9[_0x30d7('0x31')][_0x30d7('0x37')](_0x30d7('0x38'))){_0x2391eb[_0x30d7('0x1d')]=qs[_0x30d7('0x1d')](_0x4e98d9[_0x30d7('0x31')][_0x30d7('0x1d')]);_0x2391eb[_0x30d7('0x1b')]=qs[_0x30d7('0x1b')](_0x4e98d9[_0x30d7('0x31')][_0x30d7('0x1b')]);}return _0x35188e[_0x30d7('0x4f')](_0x2391eb);}})[_0x30d7('0x24')](function(_0x2f7c0f){if(_0x2f7c0f){return _0x2f7c0f?{'count':_0x59acd9,'rows':_0x2f7c0f}:null;}})[_0x30d7('0x24')](respondWithResult(_0x193246,null))[_0x30d7('0x4a')](handleError(_0x193246,null));};exports[_0x30d7('0x51')]=function(_0x289a3e,_0x55ee1a,_0x4ea435){var _0xc4d8c={};var _0xc36ede={};var _0x11768c;var _0x4219bf;return db[_0x30d7('0x2c')][_0x30d7('0x50')]({'where':{'id':_0x289a3e[_0x30d7('0x44')]['id']}})['then'](handleEntityNotFound(_0x55ee1a,null))['then'](function(_0x292fb6){if(_0x292fb6){_0x11768c=_0x292fb6;_0xc36ede[_0x30d7('0x30')]=_[_0x30d7('0x32')](db[_0x30d7('0x52')]['rawAttributes']);_0xc36ede[_0x30d7('0x31')]=_[_0x30d7('0x32')](_0x289a3e[_0x30d7('0x31')]);_0xc36ede[_0x30d7('0x45')]=_['intersection'](_0xc36ede['model'],_0xc36ede[_0x30d7('0x31')]);_0xc4d8c[_0x30d7('0x35')]=_[_0x30d7('0x33')](_0xc36ede[_0x30d7('0x30')],qs['fields'](_0x289a3e[_0x30d7('0x31')][_0x30d7('0x34')]));_0xc4d8c['attributes']=_0xc4d8c['attributes'][_0x30d7('0x36')]?_0xc4d8c[_0x30d7('0x35')]:_0xc36ede[_0x30d7('0x30')];_0xc4d8c['order']=qs['sort'](_0x289a3e[_0x30d7('0x31')][_0x30d7('0x39')]);_0xc4d8c['where']=qs[_0x30d7('0x45')](_[_0x30d7('0x4c')](_0x289a3e['query'],_0xc36ede['filters']));if(_0x289a3e[_0x30d7('0x31')][_0x30d7('0x3b')]){_0xc4d8c[_0x30d7('0x3a')]=_[_0x30d7('0x3c')](_0xc4d8c[_0x30d7('0x3a')],{'$or':_[_0x30d7('0x4d')](_0xc4d8c[_0x30d7('0x35')],function(_0x2f9d12){var _0x4ee3c5={};_0x4ee3c5[_0x2f9d12]={'$like':'%'+_0x289a3e[_0x30d7('0x31')][_0x30d7('0x3b')]+'%'};return _0x4ee3c5;})});}_0xc4d8c=_[_0x30d7('0x3c')]({},_0xc4d8c,_0x289a3e[_0x30d7('0x3e')]);return _0x11768c[_0x30d7('0x51')](_0xc4d8c);}})['then'](function(_0x359cea){if(_0x359cea){_0x4219bf=_0x359cea[_0x30d7('0x36')];if(!_0x289a3e['query'][_0x30d7('0x37')]('nolimit')){_0xc4d8c['limit']=qs['limit'](_0x289a3e['query'][_0x30d7('0x1d')]);_0xc4d8c[_0x30d7('0x1b')]=qs['offset'](_0x289a3e[_0x30d7('0x31')][_0x30d7('0x1b')]);}return _0x11768c[_0x30d7('0x51')](_0xc4d8c);}})[_0x30d7('0x24')](function(_0x226373){if(_0x226373){return _0x226373?{'count':_0x4219bf,'rows':_0x226373}:null;}})[_0x30d7('0x24')](respondWithResult(_0x55ee1a,null))[_0x30d7('0x4a')](handleError(_0x55ee1a,null));}; \ No newline at end of file +var _0x7c98=['ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','reject','save','then','destroy','sendStatus','error','stack','name','index','map','ZohoConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','options','find','create','body','params','getFields','findOne','ZohoField','order','nolimit','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse'];(function(_0x15ddbc,_0x20db6d){var _0x21e9c0=function(_0x2a1be8){while(--_0x2a1be8){_0x15ddbc['push'](_0x15ddbc['shift']());}};_0x21e9c0(++_0x20db6d);}(_0x7c98,0x1d5));var _0x87c9=function(_0x1a9b94,_0x4d763e){_0x1a9b94=_0x1a9b94-0x0;var _0x379102=_0x7c98[_0x1a9b94];return _0x379102;};'use strict';var emlformat=require(_0x87c9('0x0'));var rimraf=require(_0x87c9('0x1'));var zipdir=require(_0x87c9('0x2'));var jsonpatch=require(_0x87c9('0x3'));var rp=require(_0x87c9('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x87c9('0x5'));var path=require(_0x87c9('0x6'));var sox=require(_0x87c9('0x7'));var csv=require(_0x87c9('0x8'));var ejs=require(_0x87c9('0x9'));var fs=require('fs');var fs_extra=require(_0x87c9('0xa'));var _=require(_0x87c9('0xb'));var squel=require(_0x87c9('0xc'));var crypto=require(_0x87c9('0xd'));var jsforce=require(_0x87c9('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x87c9('0x8'));var querystring=require(_0x87c9('0xf'));var Papa=require(_0x87c9('0x10'));var Redis=require(_0x87c9('0x11'));var authService=require(_0x87c9('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x87c9('0x13'));var hardwareService=require(_0x87c9('0x14'));var logger=require(_0x87c9('0x15'))(_0x87c9('0x16'));var utils=require('../../config/utils');var config=require(_0x87c9('0x17'));var licenseUtil=require(_0x87c9('0x18'));var db=require(_0x87c9('0x19'))['db'];function respondWithStatusCode(_0x492fdc,_0x247b7c){_0x247b7c=_0x247b7c||0xcc;return function(_0x14a629){if(_0x14a629){return _0x492fdc['sendStatus'](_0x247b7c);}return _0x492fdc[_0x87c9('0x1a')](_0x247b7c)[_0x87c9('0x1b')]();};}function respondWithResult(_0x6a7249,_0x4aea89){_0x4aea89=_0x4aea89||0xc8;return function(_0x1080a7){if(_0x1080a7){return _0x6a7249[_0x87c9('0x1a')](_0x4aea89)[_0x87c9('0x1c')](_0x1080a7);}};}function respondWithFilteredResult(_0x44f173,_0x407823){return function(_0x39a3ad){if(_0x39a3ad){var _0x3a30ae=typeof _0x407823[_0x87c9('0x1d')]===_0x87c9('0x1e')&&typeof _0x407823[_0x87c9('0x1f')]==='undefined';var _0x4d8bb0=_0x39a3ad[_0x87c9('0x20')];var _0x3a5650=_0x3a30ae?0x0:_0x407823[_0x87c9('0x1d')];var _0x5c75e6=_0x3a30ae?_0x39a3ad[_0x87c9('0x20')]:_0x407823[_0x87c9('0x1d')]+_0x407823['limit'];var _0x52878c;if(_0x5c75e6>=_0x4d8bb0){_0x5c75e6=_0x4d8bb0;_0x52878c=0xc8;}else{_0x52878c=0xce;}_0x44f173[_0x87c9('0x1a')](_0x52878c);return _0x44f173[_0x87c9('0x21')]('Content-Range',_0x3a5650+'-'+_0x5c75e6+'/'+_0x4d8bb0)[_0x87c9('0x1c')](_0x39a3ad);}return null;};}function patchUpdates(_0x4a7004){return function(_0x3e4fdc){try{jsonpatch['apply'](_0x3e4fdc,_0x4a7004,!![]);}catch(_0x3953c2){return BPromise[_0x87c9('0x22')](_0x3953c2);}return _0x3e4fdc[_0x87c9('0x23')]();};}function saveUpdates(_0x1ac1fc,_0x39ff53){return function(_0x5c2884){if(_0x5c2884){return _0x5c2884['update'](_0x1ac1fc)[_0x87c9('0x24')](function(_0x5af9b2){return _0x5af9b2;});}return null;};}function removeEntity(_0x21c877,_0x516c65){return function(_0x51f41c){if(_0x51f41c){return _0x51f41c[_0x87c9('0x25')]()[_0x87c9('0x24')](function(){_0x21c877[_0x87c9('0x1a')](0xcc)[_0x87c9('0x1b')]();});}};}function handleEntityNotFound(_0x2d4f72,_0x2ef83e){return function(_0x21be42){if(!_0x21be42){_0x2d4f72[_0x87c9('0x26')](0x194);}return _0x21be42;};}function handleError(_0x14147e,_0x1ca61c){_0x1ca61c=_0x1ca61c||0x1f4;return function(_0x427d3a){logger[_0x87c9('0x27')](_0x427d3a[_0x87c9('0x28')]);if(_0x427d3a[_0x87c9('0x29')]){delete _0x427d3a[_0x87c9('0x29')];}_0x14147e[_0x87c9('0x1a')](_0x1ca61c)['send'](_0x427d3a);};}exports[_0x87c9('0x2a')]=function(_0x1a07aa,_0x342705){var _0x42b516={},_0xf8e264={},_0xc5ec65={'count':0x0,'rows':[]};var _0x16dd48=_[_0x87c9('0x2b')](db[_0x87c9('0x2c')][_0x87c9('0x2d')],function(_0x5890d0){return{'name':_0x5890d0[_0x87c9('0x2e')],'type':_0x5890d0[_0x87c9('0x2f')][_0x87c9('0x30')]};});_0xf8e264[_0x87c9('0x31')]=_[_0x87c9('0x2b')](_0x16dd48,_0x87c9('0x29'));_0xf8e264[_0x87c9('0x32')]=_[_0x87c9('0x33')](_0x1a07aa[_0x87c9('0x32')]);_0xf8e264[_0x87c9('0x34')]=_['intersection'](_0xf8e264[_0x87c9('0x31')],_0xf8e264[_0x87c9('0x32')]);_0x42b516[_0x87c9('0x35')]=_[_0x87c9('0x36')](_0xf8e264['model'],qs[_0x87c9('0x37')](_0x1a07aa[_0x87c9('0x32')]['fields']));_0x42b516[_0x87c9('0x35')]=_0x42b516['attributes'][_0x87c9('0x38')]?_0x42b516[_0x87c9('0x35')]:_0xf8e264[_0x87c9('0x31')];if(!_0x1a07aa['query'][_0x87c9('0x39')]('nolimit')){_0x42b516[_0x87c9('0x1f')]=qs[_0x87c9('0x1f')](_0x1a07aa['query'][_0x87c9('0x1f')]);_0x42b516['offset']=qs['offset'](_0x1a07aa[_0x87c9('0x32')][_0x87c9('0x1d')]);}_0x42b516['order']=qs[_0x87c9('0x3a')](_0x1a07aa[_0x87c9('0x32')]['sort']);_0x42b516[_0x87c9('0x3b')]=qs['filters'](_[_0x87c9('0x3c')](_0x1a07aa[_0x87c9('0x32')],_0xf8e264['filters']),_0x16dd48);if(_0x1a07aa[_0x87c9('0x32')][_0x87c9('0x3d')]){_0x42b516['where']=_[_0x87c9('0x3e')](_0x42b516[_0x87c9('0x3b')],{'$or':_[_0x87c9('0x2b')](_0x16dd48,function(_0x310f1d){if(_0x310f1d[_0x87c9('0x2f')]!==_0x87c9('0x3f')){var _0xa91a23={};_0xa91a23[_0x310f1d[_0x87c9('0x29')]]={'$like':'%'+_0x1a07aa['query'][_0x87c9('0x3d')]+'%'};return _0xa91a23;}})});}_0x42b516=_[_0x87c9('0x3e')]({},_0x42b516,_0x1a07aa['options']);var _0x5d8963={'where':_0x42b516[_0x87c9('0x3b')]};return db['ZohoConfiguration'][_0x87c9('0x20')](_0x5d8963)[_0x87c9('0x24')](function(_0x263c9c){_0xc5ec65[_0x87c9('0x20')]=_0x263c9c;if(_0x1a07aa['query'][_0x87c9('0x40')]){_0x42b516[_0x87c9('0x41')]=[{'all':!![]}];}return db[_0x87c9('0x2c')][_0x87c9('0x42')](_0x42b516);})[_0x87c9('0x24')](function(_0x545c48){_0xc5ec65[_0x87c9('0x43')]=_0x545c48;return _0xc5ec65;})[_0x87c9('0x24')](respondWithFilteredResult(_0x342705,_0x42b516))[_0x87c9('0x44')](handleError(_0x342705,null));};exports['show']=function(_0xb1d333,_0x557ea9){var _0x1eb811={'raw':![],'where':{'id':_0xb1d333['params']['id']}},_0x251a04={};_0x251a04[_0x87c9('0x31')]=_[_0x87c9('0x33')](db['ZohoConfiguration'][_0x87c9('0x2d')]);_0x251a04[_0x87c9('0x32')]=_[_0x87c9('0x33')](_0xb1d333[_0x87c9('0x32')]);_0x251a04[_0x87c9('0x34')]=_[_0x87c9('0x36')](_0x251a04['model'],_0x251a04[_0x87c9('0x32')]);_0x1eb811[_0x87c9('0x35')]=_['intersection'](_0x251a04[_0x87c9('0x31')],qs[_0x87c9('0x37')](_0xb1d333[_0x87c9('0x32')][_0x87c9('0x37')]));_0x1eb811[_0x87c9('0x35')]=_0x1eb811[_0x87c9('0x35')][_0x87c9('0x38')]?_0x1eb811[_0x87c9('0x35')]:_0x251a04[_0x87c9('0x31')];if(_0xb1d333[_0x87c9('0x32')]['includeAll']){_0x1eb811[_0x87c9('0x41')]=[{'all':!![]}];}_0x1eb811=_[_0x87c9('0x3e')]({},_0x1eb811,_0xb1d333[_0x87c9('0x45')]);return db[_0x87c9('0x2c')][_0x87c9('0x46')](_0x1eb811)['then'](handleEntityNotFound(_0x557ea9,null))[_0x87c9('0x24')](respondWithResult(_0x557ea9,null))[_0x87c9('0x44')](handleError(_0x557ea9,null));};exports[_0x87c9('0x47')]=function(_0x2610fb,_0x406b97){return db[_0x87c9('0x2c')][_0x87c9('0x47')](_0x2610fb['body'],{})[_0x87c9('0x24')](respondWithResult(_0x406b97,0xc9))[_0x87c9('0x44')](handleError(_0x406b97,null));};exports['update']=function(_0x2d836e,_0x1ea677){if(_0x2d836e['body']['id']){delete _0x2d836e[_0x87c9('0x48')]['id'];}return db['ZohoConfiguration'][_0x87c9('0x46')]({'where':{'id':_0x2d836e[_0x87c9('0x49')]['id']}})[_0x87c9('0x24')](handleEntityNotFound(_0x1ea677,null))[_0x87c9('0x24')](saveUpdates(_0x2d836e[_0x87c9('0x48')],null))[_0x87c9('0x24')](respondWithResult(_0x1ea677,null))['catch'](handleError(_0x1ea677,null));};exports['destroy']=function(_0x2370c3,_0x38646c){return db['ZohoConfiguration'][_0x87c9('0x46')]({'where':{'id':_0x2370c3[_0x87c9('0x49')]['id']}})[_0x87c9('0x24')](handleEntityNotFound(_0x38646c,null))[_0x87c9('0x24')](removeEntity(_0x38646c,null))[_0x87c9('0x44')](handleError(_0x38646c,null));};exports[_0x87c9('0x4a')]=function(_0x5247f1,_0x486b0b,_0xdd60f6){var _0x672793={};var _0x2c4a20={};var _0xd05d99;var _0x14b608;return db['ZohoConfiguration'][_0x87c9('0x4b')]({'where':{'id':_0x5247f1[_0x87c9('0x49')]['id']}})[_0x87c9('0x24')](handleEntityNotFound(_0x486b0b,null))[_0x87c9('0x24')](function(_0x47e395){if(_0x47e395){_0xd05d99=_0x47e395;_0x2c4a20['model']=_['keys'](db[_0x87c9('0x4c')][_0x87c9('0x2d')]);_0x2c4a20[_0x87c9('0x32')]=_[_0x87c9('0x33')](_0x5247f1[_0x87c9('0x32')]);_0x2c4a20['filters']=_[_0x87c9('0x36')](_0x2c4a20['model'],_0x2c4a20[_0x87c9('0x32')]);_0x672793[_0x87c9('0x35')]=_[_0x87c9('0x36')](_0x2c4a20['model'],qs[_0x87c9('0x37')](_0x5247f1[_0x87c9('0x32')][_0x87c9('0x37')]));_0x672793['attributes']=_0x672793[_0x87c9('0x35')][_0x87c9('0x38')]?_0x672793[_0x87c9('0x35')]:_0x2c4a20[_0x87c9('0x31')];_0x672793[_0x87c9('0x4d')]=qs[_0x87c9('0x3a')](_0x5247f1[_0x87c9('0x32')][_0x87c9('0x3a')]);_0x672793[_0x87c9('0x3b')]=qs[_0x87c9('0x34')](_[_0x87c9('0x3c')](_0x5247f1[_0x87c9('0x32')],_0x2c4a20['filters']));if(_0x5247f1[_0x87c9('0x32')][_0x87c9('0x3d')]){_0x672793[_0x87c9('0x3b')]=_['merge'](_0x672793[_0x87c9('0x3b')],{'$or':_['map'](_0x672793[_0x87c9('0x35')],function(_0x32c878){var _0x47aab3={};_0x47aab3[_0x32c878]={'$like':'%'+_0x5247f1[_0x87c9('0x32')][_0x87c9('0x3d')]+'%'};return _0x47aab3;})});}_0x672793=_[_0x87c9('0x3e')]({},_0x672793,_0x5247f1[_0x87c9('0x45')]);return _0xd05d99[_0x87c9('0x4a')](_0x672793);}})[_0x87c9('0x24')](function(_0x5e9878){if(_0x5e9878){_0x14b608=_0x5e9878[_0x87c9('0x38')];if(!_0x5247f1[_0x87c9('0x32')][_0x87c9('0x39')](_0x87c9('0x4e'))){_0x672793[_0x87c9('0x1f')]=qs[_0x87c9('0x1f')](_0x5247f1[_0x87c9('0x32')][_0x87c9('0x1f')]);_0x672793[_0x87c9('0x1d')]=qs[_0x87c9('0x1d')](_0x5247f1[_0x87c9('0x32')][_0x87c9('0x1d')]);}return _0xd05d99[_0x87c9('0x4a')](_0x672793);}})[_0x87c9('0x24')](function(_0x508a10){if(_0x508a10){return _0x508a10?{'count':_0x14b608,'rows':_0x508a10}:null;}})[_0x87c9('0x24')](respondWithResult(_0x486b0b,null))[_0x87c9('0x44')](handleError(_0x486b0b,null));};exports[_0x87c9('0x4f')]=function(_0x533c72,_0x5ee06e,_0x2f9301){var _0xd485f9={};var _0x375c15={};var _0xbc53a1;var _0x5f0bfd;return db[_0x87c9('0x2c')][_0x87c9('0x4b')]({'where':{'id':_0x533c72[_0x87c9('0x49')]['id']}})[_0x87c9('0x24')](handleEntityNotFound(_0x5ee06e,null))[_0x87c9('0x24')](function(_0x26b3f2){if(_0x26b3f2){_0xbc53a1=_0x26b3f2;_0x375c15[_0x87c9('0x31')]=_[_0x87c9('0x33')](db['ZohoField'][_0x87c9('0x2d')]);_0x375c15['query']=_[_0x87c9('0x33')](_0x533c72[_0x87c9('0x32')]);_0x375c15['filters']=_[_0x87c9('0x36')](_0x375c15[_0x87c9('0x31')],_0x375c15[_0x87c9('0x32')]);_0xd485f9[_0x87c9('0x35')]=_['intersection'](_0x375c15['model'],qs['fields'](_0x533c72['query'][_0x87c9('0x37')]));_0xd485f9['attributes']=_0xd485f9[_0x87c9('0x35')][_0x87c9('0x38')]?_0xd485f9[_0x87c9('0x35')]:_0x375c15[_0x87c9('0x31')];_0xd485f9[_0x87c9('0x4d')]=qs[_0x87c9('0x3a')](_0x533c72[_0x87c9('0x32')][_0x87c9('0x3a')]);_0xd485f9[_0x87c9('0x3b')]=qs[_0x87c9('0x34')](_[_0x87c9('0x3c')](_0x533c72[_0x87c9('0x32')],_0x375c15[_0x87c9('0x34')]));if(_0x533c72[_0x87c9('0x32')][_0x87c9('0x3d')]){_0xd485f9[_0x87c9('0x3b')]=_[_0x87c9('0x3e')](_0xd485f9['where'],{'$or':_[_0x87c9('0x2b')](_0xd485f9[_0x87c9('0x35')],function(_0xa1e32e){var _0x245b07={};_0x245b07[_0xa1e32e]={'$like':'%'+_0x533c72['query']['filter']+'%'};return _0x245b07;})});}_0xd485f9=_[_0x87c9('0x3e')]({},_0xd485f9,_0x533c72[_0x87c9('0x45')]);return _0xbc53a1[_0x87c9('0x4f')](_0xd485f9);}})[_0x87c9('0x24')](function(_0x3624ff){if(_0x3624ff){_0x5f0bfd=_0x3624ff['length'];if(!_0x533c72['query']['hasOwnProperty']('nolimit')){_0xd485f9[_0x87c9('0x1f')]=qs[_0x87c9('0x1f')](_0x533c72[_0x87c9('0x32')][_0x87c9('0x1f')]);_0xd485f9[_0x87c9('0x1d')]=qs[_0x87c9('0x1d')](_0x533c72['query']['offset']);}return _0xbc53a1[_0x87c9('0x4f')](_0xd485f9);}})['then'](function(_0xa6e9bf){if(_0xa6e9bf){return _0xa6e9bf?{'count':_0x5f0bfd,'rows':_0xa6e9bf}:null;}})[_0x87c9('0x24')](respondWithResult(_0x5ee06e,null))[_0x87c9('0x44')](handleError(_0x5ee06e,null));};exports[_0x87c9('0x50')]=function(_0x9a3ae,_0x29059b,_0x1f19f1){var _0x338088={};var _0xe4e36c={};var _0x3f7ad2;var _0x4fcf67;return db[_0x87c9('0x2c')][_0x87c9('0x4b')]({'where':{'id':_0x9a3ae[_0x87c9('0x49')]['id']}})['then'](handleEntityNotFound(_0x29059b,null))[_0x87c9('0x24')](function(_0x3a51e3){if(_0x3a51e3){_0x3f7ad2=_0x3a51e3;_0xe4e36c[_0x87c9('0x31')]=_[_0x87c9('0x33')](db['ZohoField'][_0x87c9('0x2d')]);_0xe4e36c[_0x87c9('0x32')]=_['keys'](_0x9a3ae[_0x87c9('0x32')]);_0xe4e36c[_0x87c9('0x34')]=_['intersection'](_0xe4e36c[_0x87c9('0x31')],_0xe4e36c[_0x87c9('0x32')]);_0x338088[_0x87c9('0x35')]=_[_0x87c9('0x36')](_0xe4e36c[_0x87c9('0x31')],qs[_0x87c9('0x37')](_0x9a3ae[_0x87c9('0x32')][_0x87c9('0x37')]));_0x338088[_0x87c9('0x35')]=_0x338088[_0x87c9('0x35')][_0x87c9('0x38')]?_0x338088[_0x87c9('0x35')]:_0xe4e36c[_0x87c9('0x31')];_0x338088[_0x87c9('0x4d')]=qs[_0x87c9('0x3a')](_0x9a3ae[_0x87c9('0x32')][_0x87c9('0x3a')]);_0x338088[_0x87c9('0x3b')]=qs[_0x87c9('0x34')](_[_0x87c9('0x3c')](_0x9a3ae['query'],_0xe4e36c[_0x87c9('0x34')]));if(_0x9a3ae[_0x87c9('0x32')][_0x87c9('0x3d')]){_0x338088[_0x87c9('0x3b')]=_['merge'](_0x338088[_0x87c9('0x3b')],{'$or':_['map'](_0x338088[_0x87c9('0x35')],function(_0x2fa7f4){var _0x12d191={};_0x12d191[_0x2fa7f4]={'$like':'%'+_0x9a3ae['query'][_0x87c9('0x3d')]+'%'};return _0x12d191;})});}_0x338088=_[_0x87c9('0x3e')]({},_0x338088,_0x9a3ae['options']);return _0x3f7ad2[_0x87c9('0x50')](_0x338088);}})[_0x87c9('0x24')](function(_0x21b497){if(_0x21b497){_0x4fcf67=_0x21b497[_0x87c9('0x38')];if(!_0x9a3ae['query'][_0x87c9('0x39')](_0x87c9('0x4e'))){_0x338088[_0x87c9('0x1f')]=qs[_0x87c9('0x1f')](_0x9a3ae[_0x87c9('0x32')][_0x87c9('0x1f')]);_0x338088[_0x87c9('0x1d')]=qs[_0x87c9('0x1d')](_0x9a3ae[_0x87c9('0x32')][_0x87c9('0x1d')]);}return _0x3f7ad2['getDescriptions'](_0x338088);}})['then'](function(_0x29b7d3){if(_0x29b7d3){return _0x29b7d3?{'count':_0x4fcf67,'rows':_0x29b7d3}:null;}})[_0x87c9('0x24')](respondWithResult(_0x29059b,null))[_0x87c9('0x44')](handleError(_0x29059b,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 4be8ff2..720ce01 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 _0x948e=['../../config/environment','./intZohoConfiguration.attributes','exports','define','ZohoConfiguration','int_zoho_configurations','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x4f81c9,_0x141654){var _0x5e86ae=function(_0x348b70){while(--_0x348b70){_0x4f81c9['push'](_0x4f81c9['shift']());}};_0x5e86ae(++_0x141654);}(_0x948e,0x1f0));var _0xe948=function(_0x4345e2,_0x1df6dc){_0x4345e2=_0x4345e2-0x0;var _0x2a8718=_0x948e[_0x4345e2];return _0x2a8718;};'use strict';var _=require('lodash');var util=require(_0xe948('0x0'));var logger=require(_0xe948('0x1'))(_0xe948('0x2'));var moment=require(_0xe948('0x3'));var BPromise=require(_0xe948('0x4'));var rp=require(_0xe948('0x5'));var fs=require('fs');var path=require(_0xe948('0x6'));var rimraf=require(_0xe948('0x7'));var config=require(_0xe948('0x8'));var attributes=require(_0xe948('0x9'));module[_0xe948('0xa')]=function(_0xc001c4,_0x205594){return _0xc001c4[_0xe948('0xb')](_0xe948('0xc'),attributes,{'tableName':_0xe948('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0460=['path','rimraf','./intZohoConfiguration.attributes','exports','define','ZohoConfiguration','int_zoho_configurations','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x124298,_0x542004){var _0x35ac24=function(_0x49afe8){while(--_0x49afe8){_0x124298['push'](_0x124298['shift']());}};_0x35ac24(++_0x542004);}(_0x0460,0xe4));var _0x0046=function(_0x5b6965,_0x308536){_0x5b6965=_0x5b6965-0x0;var _0x3ac794=_0x0460[_0x5b6965];return _0x3ac794;};'use strict';var _=require(_0x0046('0x0'));var util=require(_0x0046('0x1'));var logger=require(_0x0046('0x2'))(_0x0046('0x3'));var moment=require('moment');var BPromise=require(_0x0046('0x4'));var rp=require(_0x0046('0x5'));var fs=require('fs');var path=require(_0x0046('0x6'));var rimraf=require(_0x0046('0x7'));var config=require('../../config/environment');var attributes=require(_0x0046('0x8'));module[_0x0046('0x9')]=function(_0x351a8a,_0x48dcce){return _0x351a8a[_0x0046('0xa')](_0x0046('0xb'),attributes,{'tableName':_0x0046('0xc'),'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 d2ca695..f7013d5 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 _0xa479=['code','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3da4b9,_0xe815f6){var _0x26d7d7=function(_0x177cdf){while(--_0x177cdf){_0x3da4b9['push'](_0x3da4b9['shift']());}};_0x26d7d7(++_0xe815f6);}(_0xa479,0x184));var _0x9a47=function(_0x4b13f8,_0x3ed4e1){_0x4b13f8=_0x4b13f8-0x0;var _0x2136d2=_0xa479[_0x4b13f8];return _0x2136d2;};'use strict';var _=require(_0x9a47('0x0'));var util=require(_0x9a47('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9a47('0x2'));var fs=require('fs');var Redis=require(_0x9a47('0x3'));var db=require(_0x9a47('0x4'))['db'];var utils=require(_0x9a47('0x5'));var logger=require(_0x9a47('0x6'))(_0x9a47('0x7'));var config=require(_0x9a47('0x8'));var jayson=require(_0x9a47('0x9'));var client=jayson['client'][_0x9a47('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4fc7d7,_0x346f7f,_0x517d31){return new BPromise(function(_0x5b923f,_0x263c90){return client[_0x9a47('0xb')](_0x4fc7d7,_0x517d31)[_0x9a47('0xc')](function(_0x411f92){logger[_0x9a47('0xd')](_0x9a47('0xe'),_0x346f7f,_0x9a47('0xf'));logger[_0x9a47('0x10')](_0x9a47('0x11'),_0x346f7f,_0x9a47('0xf'),JSON[_0x9a47('0x12')](_0x411f92));if(_0x411f92[_0x9a47('0x13')]){if(_0x411f92[_0x9a47('0x13')][_0x9a47('0x14')]===0x1f4){logger[_0x9a47('0x13')](_0x9a47('0xe'),_0x346f7f,_0x411f92[_0x9a47('0x13')][_0x9a47('0x15')]);return _0x263c90(_0x411f92[_0x9a47('0x13')]['message']);}logger[_0x9a47('0x13')](_0x9a47('0xe'),_0x346f7f,_0x411f92[_0x9a47('0x13')][_0x9a47('0x15')]);return _0x5b923f(_0x411f92['error']['message']);}else{logger['info'](_0x9a47('0xe'),_0x346f7f,_0x9a47('0xf'));_0x5b923f(_0x411f92[_0x9a47('0x16')][_0x9a47('0x15')]);}})[_0x9a47('0x17')](function(_0x9e03a1){logger[_0x9a47('0x13')](_0x9a47('0xe'),_0x346f7f,_0x9e03a1);_0x263c90(_0x9e03a1);});});} \ No newline at end of file +var _0x7020=['request','then','info','ZohoConfiguration,\x20%s,\x20%s','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x1ca85d,_0x3d0c45){var _0x347fc2=function(_0x57bfe8){while(--_0x57bfe8){_0x1ca85d['push'](_0x1ca85d['shift']());}};_0x347fc2(++_0x3d0c45);}(_0x7020,0x7c));var _0x0702=function(_0x58d6a6,_0x3864d8){_0x58d6a6=_0x58d6a6-0x0;var _0x2249fd=_0x7020[_0x58d6a6];return _0x2249fd;};'use strict';var _=require('lodash');var util=require(_0x0702('0x0'));var moment=require('moment');var BPromise=require(_0x0702('0x1'));var rs=require(_0x0702('0x2'));var fs=require('fs');var Redis=require(_0x0702('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0702('0x4'));var logger=require(_0x0702('0x5'))('rpc');var config=require(_0x0702('0x6'));var jayson=require(_0x0702('0x7'));var client=jayson[_0x0702('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x53656b,_0x298f61,_0x51ea87){return new BPromise(function(_0x30a7b4,_0x2b3dfe){return client[_0x0702('0x9')](_0x53656b,_0x51ea87)[_0x0702('0xa')](function(_0x302949){logger[_0x0702('0xb')](_0x0702('0xc'),_0x298f61,'request\x20sent');logger[_0x0702('0xd')](_0x0702('0xe'),_0x298f61,_0x0702('0xf'),JSON['stringify'](_0x302949));if(_0x302949[_0x0702('0x10')]){if(_0x302949[_0x0702('0x10')]['code']===0x1f4){logger[_0x0702('0x10')](_0x0702('0xc'),_0x298f61,_0x302949[_0x0702('0x10')]['message']);return _0x2b3dfe(_0x302949[_0x0702('0x10')]['message']);}logger[_0x0702('0x10')](_0x0702('0xc'),_0x298f61,_0x302949['error'][_0x0702('0x11')]);return _0x30a7b4(_0x302949[_0x0702('0x10')]['message']);}else{logger[_0x0702('0xb')]('ZohoConfiguration,\x20%s,\x20%s',_0x298f61,'request\x20sent');_0x30a7b4(_0x302949[_0x0702('0x12')][_0x0702('0x11')]);}})['catch'](function(_0x11b39a){logger[_0x0702('0x10')](_0x0702('0xc'),_0x298f61,_0x11b39a);_0x2b3dfe(_0x11b39a);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 74d71c2..2f6bb39 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 _0x1772=['fs-extra','../../components/auth/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','post','create','/:id','update','delete','destroy','exports','multer','util','path','express','Router'];(function(_0x731a26,_0x456ed7){var _0x5245fc=function(_0x2c179f){while(--_0x2c179f){_0x731a26['push'](_0x731a26['shift']());}};_0x5245fc(++_0x456ed7);}(_0x1772,0x12d));var _0x2177=function(_0x3d587f,_0x1b9be9){_0x3d587f=_0x3d587f-0x0;var _0x2ecac2=_0x1772[_0x3d587f];return _0x2ecac2;};'use strict';var multer=require(_0x2177('0x0'));var util=require(_0x2177('0x1'));var path=require(_0x2177('0x2'));var timeout=require('connect-timeout');var express=require(_0x2177('0x3'));var router=express[_0x2177('0x4')]();var fs_extra=require(_0x2177('0x5'));var auth=require(_0x2177('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x2177('0x7'));var controller=require(_0x2177('0x8'));router[_0x2177('0x9')]('/',auth[_0x2177('0xa')](),controller['index']);router[_0x2177('0x9')]('/:id',auth[_0x2177('0xa')](),controller['show']);router[_0x2177('0xb')]('/',auth[_0x2177('0xa')](),controller[_0x2177('0xc')]);router['put'](_0x2177('0xd'),auth[_0x2177('0xa')](),controller[_0x2177('0xe')]);router[_0x2177('0xf')](_0x2177('0xd'),auth[_0x2177('0xa')](),controller[_0x2177('0x10')]);module[_0x2177('0x11')]=router; \ No newline at end of file +var _0x43b5=['isAuthenticated','index','post','create','put','/:id','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZohoField.controller','get'];(function(_0x4ed3c5,_0x532923){var _0xc45b74=function(_0x445d60){while(--_0x445d60){_0x4ed3c5['push'](_0x4ed3c5['shift']());}};_0xc45b74(++_0x532923);}(_0x43b5,0x198));var _0x543b=function(_0x36f5be,_0x5487d2){_0x36f5be=_0x36f5be-0x0;var _0x231b5c=_0x43b5[_0x36f5be];return _0x231b5c;};'use strict';var multer=require(_0x543b('0x0'));var util=require(_0x543b('0x1'));var path=require('path');var timeout=require(_0x543b('0x2'));var express=require(_0x543b('0x3'));var router=express[_0x543b('0x4')]();var fs_extra=require(_0x543b('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x543b('0x6'));var config=require(_0x543b('0x7'));var controller=require(_0x543b('0x8'));router[_0x543b('0x9')]('/',auth[_0x543b('0xa')](),controller[_0x543b('0xb')]);router[_0x543b('0x9')]('/:id',auth[_0x543b('0xa')](),controller['show']);router[_0x543b('0xc')]('/',auth[_0x543b('0xa')](),controller[_0x543b('0xd')]);router[_0x543b('0xe')](_0x543b('0xf'),auth['isAuthenticated'](),controller[_0x543b('0x10')]);router[_0x543b('0x11')](_0x543b('0xf'),auth['isAuthenticated'](),controller[_0x543b('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index a9389e3..692e3c8 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 _0x2ae0=['ENUM','string','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports'];(function(_0x44a3e1,_0x4084b4){var _0x493faa=function(_0x406529){while(--_0x406529){_0x44a3e1['push'](_0x44a3e1['shift']());}};_0x493faa(++_0x4084b4);}(_0x2ae0,0x18a));var _0x02ae=function(_0x1d69ba,_0x4090c9){_0x1d69ba=_0x1d69ba-0x0;var _0x8bab8c=_0x2ae0[_0x1d69ba];return _0x8bab8c;};'use strict';var Sequelize=require(_0x02ae('0x0'));module[_0x02ae('0x1')]={'type':{'type':Sequelize[_0x02ae('0x2')](_0x02ae('0x3'),'variable',_0x02ae('0x4'),_0x02ae('0x5'),_0x02ae('0x6')),'defaultValue':_0x02ae('0x3')},'content':{'type':Sequelize[_0x02ae('0x7')]},'key':{'type':Sequelize[_0x02ae('0x7')]},'keyType':{'type':Sequelize[_0x02ae('0x2')](_0x02ae('0x3'),'variable',_0x02ae('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x02ae('0x7')]},'nameField':{'type':Sequelize[_0x02ae('0x7')]},'customField':{'type':Sequelize[_0x02ae('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x02ae('0x7')]}}; \ No newline at end of file +var _0x8df1=['keyValue','picklist','STRING','sequelize','ENUM','string','variable','customVariable'];(function(_0x2b13f6,_0x25e44c){var _0x14ea98=function(_0x55ac59){while(--_0x55ac59){_0x2b13f6['push'](_0x2b13f6['shift']());}};_0x14ea98(++_0x25e44c);}(_0x8df1,0xd3));var _0x18df=function(_0xa9ea60,_0xc1a150){_0xa9ea60=_0xa9ea60-0x0;var _0x25c12a=_0x8df1[_0xa9ea60];return _0x25c12a;};'use strict';var Sequelize=require(_0x18df('0x0'));module['exports']={'type':{'type':Sequelize[_0x18df('0x1')](_0x18df('0x2'),_0x18df('0x3'),_0x18df('0x4'),_0x18df('0x5'),_0x18df('0x6')),'defaultValue':_0x18df('0x2')},'content':{'type':Sequelize[_0x18df('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x18df('0x2'),_0x18df('0x3'),_0x18df('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x18df('0x7')]},'nameField':{'type':Sequelize[_0x18df('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x18df('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 018af50..0db2eb9 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 _0x8946=['where','pick','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','params','keys','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','index','map','ZohoField','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8946,0x130));var _0x6894=function(_0x42bc91,_0x41f40a){_0x42bc91=_0x42bc91-0x0;var _0x3f5507=_0x8946[_0x42bc91];return _0x3f5507;};'use strict';var emlformat=require(_0x6894('0x0'));var rimraf=require(_0x6894('0x1'));var zipdir=require(_0x6894('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6894('0x3'));var moment=require(_0x6894('0x4'));var BPromise=require(_0x6894('0x5'));var Mustache=require(_0x6894('0x6'));var util=require(_0x6894('0x7'));var path=require(_0x6894('0x8'));var sox=require(_0x6894('0x9'));var csv=require(_0x6894('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('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6894('0xa'));var querystring=require('querystring');var Papa=require(_0x6894('0xb'));var Redis=require(_0x6894('0xc'));var authService=require(_0x6894('0xd'));var qs=require(_0x6894('0xe'));var as=require(_0x6894('0xf'));var hardwareService=require(_0x6894('0x10'));var logger=require(_0x6894('0x11'))(_0x6894('0x12'));var utils=require(_0x6894('0x13'));var config=require(_0x6894('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x6894('0x15'))['db'];function respondWithStatusCode(_0x14abbb,_0x33c038){_0x33c038=_0x33c038||0xcc;return function(_0x486d81){if(_0x486d81){return _0x14abbb['sendStatus'](_0x33c038);}return _0x14abbb[_0x6894('0x16')](_0x33c038)[_0x6894('0x17')]();};}function respondWithResult(_0xe12efd,_0x242b4b){_0x242b4b=_0x242b4b||0xc8;return function(_0x5be040){if(_0x5be040){return _0xe12efd[_0x6894('0x16')](_0x242b4b)[_0x6894('0x18')](_0x5be040);}};}function respondWithFilteredResult(_0x1d9cac,_0x358eef){return function(_0x3aec8f){if(_0x3aec8f){var _0x45b9b7=typeof _0x358eef[_0x6894('0x19')]==='undefined'&&typeof _0x358eef[_0x6894('0x1a')]==='undefined';var _0x13d99c=_0x3aec8f[_0x6894('0x1b')];var _0x53e9f2=_0x45b9b7?0x0:_0x358eef['offset'];var _0x1960e6=_0x45b9b7?_0x3aec8f[_0x6894('0x1b')]:_0x358eef[_0x6894('0x19')]+_0x358eef[_0x6894('0x1a')];var _0x2d1064;if(_0x1960e6>=_0x13d99c){_0x1960e6=_0x13d99c;_0x2d1064=0xc8;}else{_0x2d1064=0xce;}_0x1d9cac[_0x6894('0x16')](_0x2d1064);return _0x1d9cac[_0x6894('0x1c')](_0x6894('0x1d'),_0x53e9f2+'-'+_0x1960e6+'/'+_0x13d99c)[_0x6894('0x18')](_0x3aec8f);}return null;};}function patchUpdates(_0x48d636){return function(_0xab6d62){try{jsonpatch[_0x6894('0x1e')](_0xab6d62,_0x48d636,!![]);}catch(_0x6be790){return BPromise[_0x6894('0x1f')](_0x6be790);}return _0xab6d62[_0x6894('0x20')]();};}function saveUpdates(_0x1da127,_0x36c589){return function(_0x19fd58){if(_0x19fd58){return _0x19fd58[_0x6894('0x21')](_0x1da127)['then'](function(_0x7e7703){return _0x7e7703;});}return null;};}function removeEntity(_0xbeede0,_0x4fb52e){return function(_0x1efa03){if(_0x1efa03){return _0x1efa03[_0x6894('0x22')]()[_0x6894('0x23')](function(){_0xbeede0[_0x6894('0x16')](0xcc)[_0x6894('0x17')]();});}};}function handleEntityNotFound(_0x57aa38,_0x44b453){return function(_0x241d46){if(!_0x241d46){_0x57aa38[_0x6894('0x24')](0x194);}return _0x241d46;};}function handleError(_0x305cc2,_0x5b0193){_0x5b0193=_0x5b0193||0x1f4;return function(_0x5826da){logger[_0x6894('0x25')](_0x5826da[_0x6894('0x26')]);if(_0x5826da[_0x6894('0x27')]){delete _0x5826da[_0x6894('0x27')];}_0x305cc2[_0x6894('0x16')](_0x5b0193)['send'](_0x5826da);};}exports[_0x6894('0x28')]=function(_0x46141e,_0x3b7716){var _0x4f56cd={},_0x278ff3={},_0x193954={'count':0x0,'rows':[]};var _0x890e75=_[_0x6894('0x29')](db[_0x6894('0x2a')][_0x6894('0x2b')],function(_0x219a2c){return{'name':_0x219a2c[_0x6894('0x2c')],'type':_0x219a2c['type'][_0x6894('0x2d')]};});_0x278ff3[_0x6894('0x2e')]=_[_0x6894('0x29')](_0x890e75,'name');_0x278ff3['query']=_['keys'](_0x46141e[_0x6894('0x2f')]);_0x278ff3[_0x6894('0x30')]=_[_0x6894('0x31')](_0x278ff3['model'],_0x278ff3[_0x6894('0x2f')]);_0x4f56cd[_0x6894('0x32')]=_['intersection'](_0x278ff3[_0x6894('0x2e')],qs[_0x6894('0x33')](_0x46141e['query'][_0x6894('0x33')]));_0x4f56cd[_0x6894('0x32')]=_0x4f56cd[_0x6894('0x32')][_0x6894('0x34')]?_0x4f56cd[_0x6894('0x32')]:_0x278ff3[_0x6894('0x2e')];if(!_0x46141e[_0x6894('0x2f')][_0x6894('0x35')]('nolimit')){_0x4f56cd[_0x6894('0x1a')]=qs[_0x6894('0x1a')](_0x46141e[_0x6894('0x2f')][_0x6894('0x1a')]);_0x4f56cd[_0x6894('0x19')]=qs['offset'](_0x46141e['query']['offset']);}_0x4f56cd[_0x6894('0x36')]=qs[_0x6894('0x37')](_0x46141e[_0x6894('0x2f')]['sort']);_0x4f56cd[_0x6894('0x38')]=qs[_0x6894('0x30')](_[_0x6894('0x39')](_0x46141e['query'],_0x278ff3[_0x6894('0x30')]),_0x890e75);if(_0x46141e[_0x6894('0x2f')]['filter']){_0x4f56cd['where']=_[_0x6894('0x3a')](_0x4f56cd[_0x6894('0x38')],{'$or':_[_0x6894('0x29')](_0x890e75,function(_0x3a1932){if(_0x3a1932[_0x6894('0x3b')]!==_0x6894('0x3c')){var _0x1d876a={};_0x1d876a[_0x3a1932[_0x6894('0x27')]]={'$like':'%'+_0x46141e[_0x6894('0x2f')]['filter']+'%'};return _0x1d876a;}})});}_0x4f56cd=_[_0x6894('0x3a')]({},_0x4f56cd,_0x46141e[_0x6894('0x3d')]);var _0x590052={'where':_0x4f56cd[_0x6894('0x38')]};return db[_0x6894('0x2a')]['count'](_0x590052)['then'](function(_0x3f0c26){_0x193954['count']=_0x3f0c26;if(_0x46141e[_0x6894('0x2f')]['includeAll']){_0x4f56cd[_0x6894('0x3e')]=[{'all':!![]}];}return db[_0x6894('0x2a')][_0x6894('0x3f')](_0x4f56cd);})[_0x6894('0x23')](function(_0x988a36){_0x193954[_0x6894('0x40')]=_0x988a36;return _0x193954;})['then'](respondWithFilteredResult(_0x3b7716,_0x4f56cd))[_0x6894('0x41')](handleError(_0x3b7716,null));};exports[_0x6894('0x42')]=function(_0x112dfc,_0x55795c){var _0x527dab={'raw':!![],'where':{'id':_0x112dfc[_0x6894('0x43')]['id']}},_0x5628c1={};_0x5628c1[_0x6894('0x2e')]=_[_0x6894('0x44')](db['ZohoField'][_0x6894('0x2b')]);_0x5628c1[_0x6894('0x2f')]=_[_0x6894('0x44')](_0x112dfc['query']);_0x5628c1[_0x6894('0x30')]=_['intersection'](_0x5628c1[_0x6894('0x2e')],_0x5628c1[_0x6894('0x2f')]);_0x527dab[_0x6894('0x32')]=_[_0x6894('0x31')](_0x5628c1['model'],qs['fields'](_0x112dfc['query'][_0x6894('0x33')]));_0x527dab['attributes']=_0x527dab['attributes']['length']?_0x527dab[_0x6894('0x32')]:_0x5628c1[_0x6894('0x2e')];if(_0x112dfc['query']['includeAll']){_0x527dab[_0x6894('0x3e')]=[{'all':!![]}];}_0x527dab=_[_0x6894('0x3a')]({},_0x527dab,_0x112dfc[_0x6894('0x3d')]);return db['ZohoField'][_0x6894('0x45')](_0x527dab)[_0x6894('0x23')](handleEntityNotFound(_0x55795c,null))['then'](respondWithResult(_0x55795c,null))['catch'](handleError(_0x55795c,null));};exports[_0x6894('0x46')]=function(_0x4884d5,_0x22ae94){return db[_0x6894('0x2a')][_0x6894('0x46')](_0x4884d5['body'],{})[_0x6894('0x23')](respondWithResult(_0x22ae94,0xc9))[_0x6894('0x41')](handleError(_0x22ae94,null));};exports['update']=function(_0x2b95c7,_0x144b93){if(_0x2b95c7[_0x6894('0x47')]['id']){delete _0x2b95c7['body']['id'];}return db['ZohoField'][_0x6894('0x45')]({'where':{'id':_0x2b95c7[_0x6894('0x43')]['id']}})[_0x6894('0x23')](handleEntityNotFound(_0x144b93,null))[_0x6894('0x23')](saveUpdates(_0x2b95c7[_0x6894('0x47')],null))['then'](respondWithResult(_0x144b93,null))[_0x6894('0x41')](handleError(_0x144b93,null));};exports[_0x6894('0x22')]=function(_0x3057c6,_0x5f049d){return db[_0x6894('0x2a')][_0x6894('0x45')]({'where':{'id':_0x3057c6[_0x6894('0x43')]['id']}})[_0x6894('0x23')](handleEntityNotFound(_0x5f049d,null))[_0x6894('0x23')](removeEntity(_0x5f049d,null))['catch'](handleError(_0x5f049d,null));}; \ No newline at end of file +var _0x6f33=['moment','bluebird','mustache','sox','to-csv','fs-extra','lodash','squel','crypto','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','json','offset','limit','undefined','count','Content-Range','apply','reject','save','then','error','stack','name','send','index','map','ZohoField','rawAttributes','fieldName','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','rows','show','params','keys','include','options','catch','create','body','update','find','rimraf','fast-json-patch','request-promise'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x6f33,0x1b9));var _0x36f3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6f33[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x36f3('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x36f3('0x1'));var rp=require(_0x36f3('0x2'));var moment=require(_0x36f3('0x3'));var BPromise=require(_0x36f3('0x4'));var Mustache=require(_0x36f3('0x5'));var util=require('util');var path=require('path');var sox=require(_0x36f3('0x6'));var csv=require(_0x36f3('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x36f3('0x8'));var _=require(_0x36f3('0x9'));var squel=require(_0x36f3('0xa'));var crypto=require(_0x36f3('0xb'));var jsforce=require(_0x36f3('0xc'));var deskjs=require(_0x36f3('0xd'));var toCsv=require(_0x36f3('0x7'));var querystring=require(_0x36f3('0xe'));var Papa=require('papaparse');var Redis=require(_0x36f3('0xf'));var authService=require(_0x36f3('0x10'));var qs=require(_0x36f3('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x36f3('0x12'));var logger=require(_0x36f3('0x13'))(_0x36f3('0x14'));var utils=require('../../config/utils');var config=require(_0x36f3('0x15'));var licenseUtil=require(_0x36f3('0x16'));var db=require(_0x36f3('0x17'))['db'];function respondWithStatusCode(_0x426fb6,_0x436fa5){_0x436fa5=_0x436fa5||0xcc;return function(_0x4884fa){if(_0x4884fa){return _0x426fb6[_0x36f3('0x18')](_0x436fa5);}return _0x426fb6['status'](_0x436fa5)[_0x36f3('0x19')]();};}function respondWithResult(_0x299e75,_0x2f24f7){_0x2f24f7=_0x2f24f7||0xc8;return function(_0x3674be){if(_0x3674be){return _0x299e75[_0x36f3('0x1a')](_0x2f24f7)[_0x36f3('0x1b')](_0x3674be);}};}function respondWithFilteredResult(_0x4b3089,_0x13f14d){return function(_0x20cc74){if(_0x20cc74){var _0x56c861=typeof _0x13f14d[_0x36f3('0x1c')]==='undefined'&&typeof _0x13f14d[_0x36f3('0x1d')]===_0x36f3('0x1e');var _0x1c53a6=_0x20cc74[_0x36f3('0x1f')];var _0x18e1c6=_0x56c861?0x0:_0x13f14d[_0x36f3('0x1c')];var _0x42e773=_0x56c861?_0x20cc74[_0x36f3('0x1f')]:_0x13f14d[_0x36f3('0x1c')]+_0x13f14d[_0x36f3('0x1d')];var _0x2c86aa;if(_0x42e773>=_0x1c53a6){_0x42e773=_0x1c53a6;_0x2c86aa=0xc8;}else{_0x2c86aa=0xce;}_0x4b3089[_0x36f3('0x1a')](_0x2c86aa);return _0x4b3089['set'](_0x36f3('0x20'),_0x18e1c6+'-'+_0x42e773+'/'+_0x1c53a6)['json'](_0x20cc74);}return null;};}function patchUpdates(_0x552adc){return function(_0x5d417e){try{jsonpatch[_0x36f3('0x21')](_0x5d417e,_0x552adc,!![]);}catch(_0x15dff9){return BPromise[_0x36f3('0x22')](_0x15dff9);}return _0x5d417e[_0x36f3('0x23')]();};}function saveUpdates(_0x47a968,_0x38aa15){return function(_0x4913d5){if(_0x4913d5){return _0x4913d5['update'](_0x47a968)[_0x36f3('0x24')](function(_0x18a6b0){return _0x18a6b0;});}return null;};}function removeEntity(_0x6444da,_0x46071a){return function(_0x4a2f2b){if(_0x4a2f2b){return _0x4a2f2b['destroy']()[_0x36f3('0x24')](function(){_0x6444da[_0x36f3('0x1a')](0xcc)[_0x36f3('0x19')]();});}};}function handleEntityNotFound(_0xcabc49,_0x24001a){return function(_0x443c45){if(!_0x443c45){_0xcabc49[_0x36f3('0x18')](0x194);}return _0x443c45;};}function handleError(_0x567e74,_0x3df02d){_0x3df02d=_0x3df02d||0x1f4;return function(_0x148caa){logger[_0x36f3('0x25')](_0x148caa[_0x36f3('0x26')]);if(_0x148caa[_0x36f3('0x27')]){delete _0x148caa['name'];}_0x567e74['status'](_0x3df02d)[_0x36f3('0x28')](_0x148caa);};}exports[_0x36f3('0x29')]=function(_0x636d48,_0x33651d){var _0x21f53f={},_0x151502={},_0x4c6e5d={'count':0x0,'rows':[]};var _0x13a5d7=_[_0x36f3('0x2a')](db[_0x36f3('0x2b')][_0x36f3('0x2c')],function(_0x19cd7b){return{'name':_0x19cd7b[_0x36f3('0x2d')],'type':_0x19cd7b[_0x36f3('0x2e')]['key']};});_0x151502[_0x36f3('0x2f')]=_[_0x36f3('0x2a')](_0x13a5d7,_0x36f3('0x27'));_0x151502['query']=_['keys'](_0x636d48[_0x36f3('0x30')]);_0x151502[_0x36f3('0x31')]=_[_0x36f3('0x32')](_0x151502[_0x36f3('0x2f')],_0x151502['query']);_0x21f53f['attributes']=_[_0x36f3('0x32')](_0x151502['model'],qs['fields'](_0x636d48[_0x36f3('0x30')][_0x36f3('0x33')]));_0x21f53f['attributes']=_0x21f53f[_0x36f3('0x34')][_0x36f3('0x35')]?_0x21f53f['attributes']:_0x151502[_0x36f3('0x2f')];if(!_0x636d48[_0x36f3('0x30')][_0x36f3('0x36')]('nolimit')){_0x21f53f[_0x36f3('0x1d')]=qs[_0x36f3('0x1d')](_0x636d48[_0x36f3('0x30')][_0x36f3('0x1d')]);_0x21f53f[_0x36f3('0x1c')]=qs[_0x36f3('0x1c')](_0x636d48['query'][_0x36f3('0x1c')]);}_0x21f53f[_0x36f3('0x37')]=qs[_0x36f3('0x38')](_0x636d48[_0x36f3('0x30')][_0x36f3('0x38')]);_0x21f53f[_0x36f3('0x39')]=qs[_0x36f3('0x31')](_[_0x36f3('0x3a')](_0x636d48[_0x36f3('0x30')],_0x151502[_0x36f3('0x31')]),_0x13a5d7);if(_0x636d48[_0x36f3('0x30')][_0x36f3('0x3b')]){_0x21f53f[_0x36f3('0x39')]=_[_0x36f3('0x3c')](_0x21f53f[_0x36f3('0x39')],{'$or':_['map'](_0x13a5d7,function(_0x445cdf){if(_0x445cdf[_0x36f3('0x2e')]!==_0x36f3('0x3d')){var _0x4e1570={};_0x4e1570[_0x445cdf[_0x36f3('0x27')]]={'$like':'%'+_0x636d48['query'][_0x36f3('0x3b')]+'%'};return _0x4e1570;}})});}_0x21f53f=_['merge']({},_0x21f53f,_0x636d48['options']);var _0x17af9c={'where':_0x21f53f['where']};return db[_0x36f3('0x2b')]['count'](_0x17af9c)[_0x36f3('0x24')](function(_0x2d3597){_0x4c6e5d[_0x36f3('0x1f')]=_0x2d3597;if(_0x636d48['query'][_0x36f3('0x3e')]){_0x21f53f['include']=[{'all':!![]}];}return db[_0x36f3('0x2b')]['findAll'](_0x21f53f);})[_0x36f3('0x24')](function(_0x5d664b){_0x4c6e5d[_0x36f3('0x3f')]=_0x5d664b;return _0x4c6e5d;})[_0x36f3('0x24')](respondWithFilteredResult(_0x33651d,_0x21f53f))['catch'](handleError(_0x33651d,null));};exports[_0x36f3('0x40')]=function(_0x4208cf,_0x524dce){var _0x281e52={'raw':!![],'where':{'id':_0x4208cf[_0x36f3('0x41')]['id']}},_0x287b65={};_0x287b65[_0x36f3('0x2f')]=_[_0x36f3('0x42')](db[_0x36f3('0x2b')][_0x36f3('0x2c')]);_0x287b65['query']=_['keys'](_0x4208cf[_0x36f3('0x30')]);_0x287b65[_0x36f3('0x31')]=_[_0x36f3('0x32')](_0x287b65[_0x36f3('0x2f')],_0x287b65['query']);_0x281e52['attributes']=_[_0x36f3('0x32')](_0x287b65[_0x36f3('0x2f')],qs[_0x36f3('0x33')](_0x4208cf[_0x36f3('0x30')][_0x36f3('0x33')]));_0x281e52['attributes']=_0x281e52[_0x36f3('0x34')][_0x36f3('0x35')]?_0x281e52['attributes']:_0x287b65['model'];if(_0x4208cf[_0x36f3('0x30')][_0x36f3('0x3e')]){_0x281e52[_0x36f3('0x43')]=[{'all':!![]}];}_0x281e52=_['merge']({},_0x281e52,_0x4208cf[_0x36f3('0x44')]);return db[_0x36f3('0x2b')]['find'](_0x281e52)[_0x36f3('0x24')](handleEntityNotFound(_0x524dce,null))['then'](respondWithResult(_0x524dce,null))[_0x36f3('0x45')](handleError(_0x524dce,null));};exports['create']=function(_0x3d5dda,_0x5aff06){return db['ZohoField'][_0x36f3('0x46')](_0x3d5dda[_0x36f3('0x47')],{})[_0x36f3('0x24')](respondWithResult(_0x5aff06,0xc9))['catch'](handleError(_0x5aff06,null));};exports[_0x36f3('0x48')]=function(_0x3b33bc,_0xe475e0){if(_0x3b33bc[_0x36f3('0x47')]['id']){delete _0x3b33bc[_0x36f3('0x47')]['id'];}return db['ZohoField'][_0x36f3('0x49')]({'where':{'id':_0x3b33bc[_0x36f3('0x41')]['id']}})[_0x36f3('0x24')](handleEntityNotFound(_0xe475e0,null))[_0x36f3('0x24')](saveUpdates(_0x3b33bc[_0x36f3('0x47')],null))[_0x36f3('0x24')](respondWithResult(_0xe475e0,null))[_0x36f3('0x45')](handleError(_0xe475e0,null));};exports['destroy']=function(_0x26f2ff,_0x252eef){return db[_0x36f3('0x2b')][_0x36f3('0x49')]({'where':{'id':_0x26f2ff[_0x36f3('0x41')]['id']}})['then'](handleEntityNotFound(_0x252eef,null))[_0x36f3('0x24')](removeEntity(_0x252eef,null))['catch'](handleError(_0x252eef,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index fe81e0d..1bc1485 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 _0x896e=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','zoho_unique_index','FieldId','lodash','util','../../config/logger','api'];(function(_0x2e3650,_0x9d261){var _0x475a09=function(_0xfe19bb){while(--_0xfe19bb){_0x2e3650['push'](_0x2e3650['shift']());}};_0x475a09(++_0x9d261);}(_0x896e,0x1e9));var _0xe896=function(_0x277c90,_0x105d19){_0x277c90=_0x277c90-0x0;var _0x28b283=_0x896e[_0x277c90];return _0x28b283;};'use strict';var _=require(_0xe896('0x0'));var util=require(_0xe896('0x1'));var logger=require(_0xe896('0x2'))(_0xe896('0x3'));var moment=require(_0xe896('0x4'));var BPromise=require(_0xe896('0x5'));var rp=require(_0xe896('0x6'));var fs=require('fs');var path=require(_0xe896('0x7'));var rimraf=require(_0xe896('0x8'));var config=require(_0xe896('0x9'));var attributes=require(_0xe896('0xa'));module[_0xe896('0xb')]=function(_0x52ac80,_0x24c430){return _0x52ac80[_0xe896('0xc')](_0xe896('0xd'),attributes,{'tableName':_0xe896('0xe'),'paranoid':![],'indexes':[{'name':_0xe896('0xf'),'fields':['idField',_0xe896('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x32f4=['int_zoho_fields','idField','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./intZohoField.attributes','exports','ZohoField'];(function(_0x33d9a6,_0x599dfa){var _0x2ed7fe=function(_0xca7625){while(--_0xca7625){_0x33d9a6['push'](_0x33d9a6['shift']());}};_0x2ed7fe(++_0x599dfa);}(_0x32f4,0x154));var _0x432f=function(_0x4972d7,_0x1896ba){_0x4972d7=_0x4972d7-0x0;var _0xb03ba5=_0x32f4[_0x4972d7];return _0xb03ba5;};'use strict';var _=require(_0x432f('0x0'));var util=require(_0x432f('0x1'));var logger=require(_0x432f('0x2'))(_0x432f('0x3'));var moment=require('moment');var BPromise=require(_0x432f('0x4'));var rp=require(_0x432f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x432f('0x6'));var config=require(_0x432f('0x7'));var attributes=require(_0x432f('0x8'));module[_0x432f('0x9')]=function(_0x2f5f03,_0x5d8cc0){return _0x2f5f03['define'](_0x432f('0xa'),attributes,{'tableName':_0x432f('0xb'),'paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':[_0x432f('0xc'),'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 f0687ea..58f0a86 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 _0x71c2=['moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','ZohoField,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','util'];(function(_0x508166,_0x342a28){var _0x2dafe0=function(_0x2f209b){while(--_0x2f209b){_0x508166['push'](_0x508166['shift']());}};_0x2dafe0(++_0x342a28);}(_0x71c2,0x112));var _0x271c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x71c2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x271c('0x0'));var util=require(_0x271c('0x1'));var moment=require(_0x271c('0x2'));var BPromise=require(_0x271c('0x3'));var rs=require(_0x271c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x271c('0x5'))(_0x271c('0x6'));var config=require(_0x271c('0x7'));var jayson=require(_0x271c('0x8'));var client=jayson[_0x271c('0x9')][_0x271c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xdd544a,_0x4a5e55,_0x5d3857){return new BPromise(function(_0x54e86c,_0x18c9c3){return client[_0x271c('0xb')](_0xdd544a,_0x5d3857)[_0x271c('0xc')](function(_0x441fec){logger[_0x271c('0xd')](_0x271c('0xe'),_0x4a5e55,_0x271c('0xf'));logger['debug'](_0x271c('0x10'),_0x4a5e55,_0x271c('0xf'),JSON[_0x271c('0x11')](_0x441fec));if(_0x441fec['error']){if(_0x441fec['error'][_0x271c('0x12')]===0x1f4){logger['error'](_0x271c('0xe'),_0x4a5e55,_0x441fec[_0x271c('0x13')][_0x271c('0x14')]);return _0x18c9c3(_0x441fec[_0x271c('0x13')][_0x271c('0x14')]);}logger[_0x271c('0x13')](_0x271c('0xe'),_0x4a5e55,_0x441fec['error'][_0x271c('0x14')]);return _0x54e86c(_0x441fec[_0x271c('0x13')][_0x271c('0x14')]);}else{logger['info'](_0x271c('0xe'),_0x4a5e55,_0x271c('0xf'));_0x54e86c(_0x441fec[_0x271c('0x15')][_0x271c('0x14')]);}})[_0x271c('0x16')](function(_0x165234){logger[_0x271c('0x13')]('ZohoField,\x20%s,\x20%s',_0x4a5e55,_0x165234);_0x18c9c3(_0x165234);});});} \ No newline at end of file +var _0x05ab=['ZohoField,\x20%s,\x20%s','message','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x59c1b1,_0x47c2f8){var _0x499e56=function(_0x76b21a){while(--_0x76b21a){_0x59c1b1['push'](_0x59c1b1['shift']());}};_0x499e56(++_0x47c2f8);}(_0x05ab,0x137));var _0xb05a=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x05ab[_0x167cc1];return _0x10bc4b;};'use strict';var _=require('lodash');var util=require(_0xb05a('0x0'));var moment=require('moment');var BPromise=require(_0xb05a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb05a('0x2'));var db=require(_0xb05a('0x3'))['db'];var utils=require(_0xb05a('0x4'));var logger=require(_0xb05a('0x5'))(_0xb05a('0x6'));var config=require(_0xb05a('0x7'));var jayson=require(_0xb05a('0x8'));var client=jayson[_0xb05a('0x9')][_0xb05a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x847151,_0x432004,_0x364b51){return new BPromise(function(_0x4c34d9,_0x4eb5dc){return client[_0xb05a('0xb')](_0x847151,_0x364b51)[_0xb05a('0xc')](function(_0x4388a8){logger[_0xb05a('0xd')]('ZohoField,\x20%s,\x20%s',_0x432004,_0xb05a('0xe'));logger['debug'](_0xb05a('0xf'),_0x432004,'request\x20sent',JSON[_0xb05a('0x10')](_0x4388a8));if(_0x4388a8['error']){if(_0x4388a8[_0xb05a('0x11')][_0xb05a('0x12')]===0x1f4){logger[_0xb05a('0x11')](_0xb05a('0x13'),_0x432004,_0x4388a8['error'][_0xb05a('0x14')]);return _0x4eb5dc(_0x4388a8['error']['message']);}logger[_0xb05a('0x11')](_0xb05a('0x13'),_0x432004,_0x4388a8[_0xb05a('0x11')]['message']);return _0x4c34d9(_0x4388a8['error'][_0xb05a('0x14')]);}else{logger[_0xb05a('0xd')](_0xb05a('0x13'),_0x432004,_0xb05a('0xe'));_0x4c34d9(_0x4388a8['result'][_0xb05a('0x14')]);}})[_0xb05a('0x15')](function(_0x374aa1){logger[_0xb05a('0x11')](_0xb05a('0x13'),_0x432004,_0x374aa1);_0x4eb5dc(_0x374aa1);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 1d89c81..7f53fc3 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x5c1b05,_0x213768){var _0x1a65e7=function(_0x2845d7){while(--_0x2845d7){_0x5c1b05['push'](_0x5c1b05['shift']());}};_0x1a65e7(++_0x213768);}(_0x9c44,0x178));var _0x49c4=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x9c44[_0x2641f9];return _0x585741;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x1602fd,_0x847115){var _0x1eaf42=function(_0x2e09f1){while(--_0x2e09f1){_0x1602fd['push'](_0x1602fd['shift']());}};_0x1eaf42(++_0x847115);}(_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 d215a73..23f398e 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 _0x1036=['STRING','INTEGER','BOOLEAN','sequelize','exports','unique_name_and_version'];(function(_0x311997,_0x4c2cc7){var _0x3be163=function(_0x289cfb){while(--_0x289cfb){_0x311997['push'](_0x311997['shift']());}};_0x3be163(++_0x4c2cc7);}(_0x1036,0x18f));var _0x6103=function(_0x58db59,_0x3844a5){_0x58db59=_0x58db59-0x0;var _0x439faa=_0x1036[_0x58db59];return _0x439faa;};'use strict';var Sequelize=require(_0x6103('0x0'));module[_0x6103('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x6103('0x2')},'version':{'type':Sequelize[_0x6103('0x3')],'allowNull':![],'unique':_0x6103('0x2')},'main':{'type':Sequelize[_0x6103('0x3')],'defaultValue':'app.js'},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize[_0x6103('0x3')]},'type':{'type':Sequelize[_0x6103('0x3')]},'size':{'type':Sequelize[_0x6103('0x4')]},'active':{'type':Sequelize[_0x6103('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0x6103('0x3')]},'logo':{'type':Sequelize[_0x6103('0x3')]},'state':{'type':Sequelize[_0x6103('0x3')],'unique':'state'},'description':{'type':Sequelize[_0x6103('0x3')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x6103('0x3')]},'link':{'type':Sequelize[_0x6103('0x3')],'defaultValue':'#'}}; \ No newline at end of file +var _0x6ee6=['INTEGER','sequelize','STRING','unique_name_and_version','app.js'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x6ee6,0x9c));var _0x66ee=function(_0x1f3aec,_0x24c18e){_0x1f3aec=_0x1f3aec-0x0;var _0x409f0d=_0x6ee6[_0x1f3aec];return _0x409f0d;};'use strict';var Sequelize=require(_0x66ee('0x0'));module['exports']={'name':{'type':Sequelize[_0x66ee('0x1')],'allowNull':![],'unique':_0x66ee('0x2')},'version':{'type':Sequelize[_0x66ee('0x1')],'allowNull':![],'unique':_0x66ee('0x2')},'main':{'type':Sequelize[_0x66ee('0x1')],'defaultValue':_0x66ee('0x3')},'filename':{'type':Sequelize[_0x66ee('0x1')]},'path':{'type':Sequelize[_0x66ee('0x1')]},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize[_0x66ee('0x4')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize[_0x66ee('0x1')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0x66ee('0x1')],'unique':'state'},'description':{'type':Sequelize[_0x66ee('0x1')]},'title':{'type':Sequelize[_0x66ee('0x1')]},'remoteUri':{'type':Sequelize[_0x66ee('0x1')]},'link':{'type':Sequelize[_0x66ee('0x1')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 06b855d..d0c7d8e 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 _0x7096=['offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','params','Integration','find','catch','create','body','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end'];(function(_0x2684d3,_0x464630){var _0x385a3e=function(_0x12f592){while(--_0x12f592){_0x2684d3['push'](_0x2684d3['shift']());}};_0x385a3e(++_0x464630);}(_0x7096,0x10c));var _0x6709=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0x7096[_0xc6be3a];return _0x56a310;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6709('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6709('0x1'));var rp=require('request-promise');var moment=require(_0x6709('0x2'));var BPromise=require(_0x6709('0x3'));var Mustache=require(_0x6709('0x4'));var util=require(_0x6709('0x5'));var path=require(_0x6709('0x6'));var sox=require(_0x6709('0x7'));var csv=require(_0x6709('0x8'));var ejs=require(_0x6709('0x9'));var fs=require('fs');var fs_extra=require(_0x6709('0xa'));var _=require(_0x6709('0xb'));var squel=require(_0x6709('0xc'));var crypto=require(_0x6709('0xd'));var jsforce=require(_0x6709('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6709('0xf'));var Papa=require(_0x6709('0x10'));var Redis=require(_0x6709('0x11'));var authService=require(_0x6709('0x12'));var qs=require(_0x6709('0x13'));var as=require(_0x6709('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6709('0x15'));var utils=require(_0x6709('0x16'));var config=require(_0x6709('0x17'));var licenseUtil=require(_0x6709('0x18'));var db=require(_0x6709('0x19'))['db'];function respondWithStatusCode(_0x288f51,_0x1d56a5){_0x1d56a5=_0x1d56a5||0xcc;return function(_0x1ac547){if(_0x1ac547){return _0x288f51['sendStatus'](_0x1d56a5);}return _0x288f51[_0x6709('0x1a')](_0x1d56a5)[_0x6709('0x1b')]();};}function respondWithResult(_0x4d5255,_0x3706e1){_0x3706e1=_0x3706e1||0xc8;return function(_0x4e4587){if(_0x4e4587){return _0x4d5255[_0x6709('0x1a')](_0x3706e1)['json'](_0x4e4587);}};}function respondWithFilteredResult(_0x41af1f,_0x4bc059){return function(_0x149233){if(_0x149233){var _0x28866a=typeof _0x4bc059[_0x6709('0x1c')]===_0x6709('0x1d')&&typeof _0x4bc059['limit']==='undefined';var _0x5c4f94=_0x149233[_0x6709('0x1e')];var _0x235a54=_0x28866a?0x0:_0x4bc059['offset'];var _0x9c1fd8=_0x28866a?_0x149233[_0x6709('0x1e')]:_0x4bc059[_0x6709('0x1c')]+_0x4bc059['limit'];var _0x13cf04;if(_0x9c1fd8>=_0x5c4f94){_0x9c1fd8=_0x5c4f94;_0x13cf04=0xc8;}else{_0x13cf04=0xce;}_0x41af1f[_0x6709('0x1a')](_0x13cf04);return _0x41af1f[_0x6709('0x1f')](_0x6709('0x20'),_0x235a54+'-'+_0x9c1fd8+'/'+_0x5c4f94)['json'](_0x149233);}return null;};}function patchUpdates(_0x3c4971){return function(_0x1edac3){try{jsonpatch[_0x6709('0x21')](_0x1edac3,_0x3c4971,!![]);}catch(_0x3cf882){return BPromise[_0x6709('0x22')](_0x3cf882);}return _0x1edac3[_0x6709('0x23')]();};}function saveUpdates(_0x45921e,_0x17763d){return function(_0x386224){if(_0x386224){return _0x386224[_0x6709('0x24')](_0x45921e)[_0x6709('0x25')](function(_0xa36371){return _0xa36371;});}return null;};}function removeEntity(_0x5cf48b,_0x29f25f){return function(_0x81138e){if(_0x81138e){return _0x81138e[_0x6709('0x26')]()['then'](function(){_0x5cf48b[_0x6709('0x1a')](0xcc)[_0x6709('0x1b')]();});}};}function handleEntityNotFound(_0x20a347,_0x44b465){return function(_0x588e00){if(!_0x588e00){_0x20a347[_0x6709('0x27')](0x194);}return _0x588e00;};}function handleError(_0x3076fe,_0x50f7d6){_0x50f7d6=_0x50f7d6||0x1f4;return function(_0x585073){logger[_0x6709('0x28')](_0x585073['stack']);if(_0x585073[_0x6709('0x29')]){delete _0x585073[_0x6709('0x29')];}_0x3076fe['status'](_0x50f7d6)[_0x6709('0x2a')](_0x585073);};}exports['index']=function(_0x46a325,_0x3cd555){var _0x5b6906={},_0x137137={},_0x4e6989={'count':0x0,'rows':[]};var _0xe066d8=_[_0x6709('0x2b')](db['Integration'][_0x6709('0x2c')],function(_0x5deff5){return{'name':_0x5deff5[_0x6709('0x2d')],'type':_0x5deff5[_0x6709('0x2e')]['key']};});_0x137137['model']=_[_0x6709('0x2b')](_0xe066d8,_0x6709('0x29'));_0x137137[_0x6709('0x2f')]=_[_0x6709('0x30')](_0x46a325[_0x6709('0x2f')]);_0x137137[_0x6709('0x31')]=_[_0x6709('0x32')](_0x137137[_0x6709('0x33')],_0x137137[_0x6709('0x2f')]);_0x5b6906['attributes']=_[_0x6709('0x32')](_0x137137[_0x6709('0x33')],qs[_0x6709('0x34')](_0x46a325[_0x6709('0x2f')]['fields']));_0x5b6906[_0x6709('0x35')]=_0x5b6906[_0x6709('0x35')][_0x6709('0x36')]?_0x5b6906[_0x6709('0x35')]:_0x137137['model'];if(!_0x46a325[_0x6709('0x2f')][_0x6709('0x37')]('nolimit')){_0x5b6906[_0x6709('0x38')]=qs[_0x6709('0x38')](_0x46a325['query'][_0x6709('0x38')]);_0x5b6906[_0x6709('0x1c')]=qs[_0x6709('0x1c')](_0x46a325[_0x6709('0x2f')][_0x6709('0x1c')]);}_0x5b6906[_0x6709('0x39')]=qs[_0x6709('0x3a')](_0x46a325['query'][_0x6709('0x3a')]);_0x5b6906[_0x6709('0x3b')]=qs['filters'](_[_0x6709('0x3c')](_0x46a325[_0x6709('0x2f')],_0x137137[_0x6709('0x31')]),_0xe066d8);if(_0x46a325[_0x6709('0x2f')][_0x6709('0x3d')]){_0x5b6906[_0x6709('0x3b')]=_['merge'](_0x5b6906[_0x6709('0x3b')],{'$or':_['map'](_0xe066d8,function(_0x31e05a){if(_0x31e05a[_0x6709('0x2e')]!==_0x6709('0x3e')){var _0x48492f={};_0x48492f[_0x31e05a[_0x6709('0x29')]]={'$like':'%'+_0x46a325[_0x6709('0x2f')][_0x6709('0x3d')]+'%'};return _0x48492f;}})});}_0x5b6906=_[_0x6709('0x3f')]({},_0x5b6906,_0x46a325[_0x6709('0x40')]);var _0x1030ee={'where':_0x5b6906[_0x6709('0x3b')]};return db['Integration'][_0x6709('0x1e')](_0x1030ee)[_0x6709('0x25')](function(_0x50fbcd){_0x4e6989[_0x6709('0x1e')]=_0x50fbcd;if(_0x46a325[_0x6709('0x2f')][_0x6709('0x41')]){_0x5b6906[_0x6709('0x42')]=[{'all':!![]}];}return db['Integration']['findAll'](_0x5b6906);})[_0x6709('0x25')](function(_0x3f0da1){_0x4e6989[_0x6709('0x43')]=_0x3f0da1;return _0x4e6989;})[_0x6709('0x25')](respondWithFilteredResult(_0x3cd555,_0x5b6906))['catch'](handleError(_0x3cd555,null));};exports['show']=function(_0x5af1fb,_0x3d4237){var _0x293577={'raw':![],'where':{'id':_0x5af1fb[_0x6709('0x44')]['id']}},_0x54f74e={};_0x54f74e[_0x6709('0x33')]=_['keys'](db['Integration'][_0x6709('0x2c')]);_0x54f74e[_0x6709('0x2f')]=_[_0x6709('0x30')](_0x5af1fb[_0x6709('0x2f')]);_0x54f74e[_0x6709('0x31')]=_['intersection'](_0x54f74e[_0x6709('0x33')],_0x54f74e['query']);_0x293577[_0x6709('0x35')]=_[_0x6709('0x32')](_0x54f74e[_0x6709('0x33')],qs['fields'](_0x5af1fb[_0x6709('0x2f')]['fields']));_0x293577['attributes']=_0x293577[_0x6709('0x35')][_0x6709('0x36')]?_0x293577[_0x6709('0x35')]:_0x54f74e[_0x6709('0x33')];if(_0x5af1fb[_0x6709('0x2f')][_0x6709('0x41')]){_0x293577[_0x6709('0x42')]=[{'all':!![]}];}_0x293577=_[_0x6709('0x3f')]({},_0x293577,_0x5af1fb[_0x6709('0x40')]);return db[_0x6709('0x45')][_0x6709('0x46')](_0x293577)[_0x6709('0x25')](handleEntityNotFound(_0x3d4237,null))[_0x6709('0x25')](respondWithResult(_0x3d4237,null))[_0x6709('0x47')](handleError(_0x3d4237,null));};exports[_0x6709('0x48')]=function(_0x4f82a0,_0xfbb810){return db['Integration']['create'](_0x4f82a0[_0x6709('0x49')],{})[_0x6709('0x25')](respondWithResult(_0xfbb810,0xc9))[_0x6709('0x47')](handleError(_0xfbb810,null));};exports[_0x6709('0x24')]=function(_0x22363b,_0x2b05dc){if(_0x22363b[_0x6709('0x49')]['id']){delete _0x22363b[_0x6709('0x49')]['id'];}return db['Integration'][_0x6709('0x46')]({'where':{'id':_0x22363b[_0x6709('0x44')]['id']}})[_0x6709('0x25')](handleEntityNotFound(_0x2b05dc,null))[_0x6709('0x25')](saveUpdates(_0x22363b['body'],null))[_0x6709('0x25')](respondWithResult(_0x2b05dc,null))['catch'](handleError(_0x2b05dc,null));};exports[_0x6709('0x26')]=function(_0x34a950,_0x2a563b){return db[_0x6709('0x45')][_0x6709('0x46')]({'where':{'id':_0x34a950['params']['id']}})[_0x6709('0x25')](handleEntityNotFound(_0x2a563b,null))[_0x6709('0x25')](removeEntity(_0x2a563b,null))[_0x6709('0x47')](handleError(_0x2a563b,null));}; \ No newline at end of file +var _0x6d38=['sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','keys','filters','intersection','create','catch','body','find','params','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','save','update','then','stack','name','send','index','map','Integration','rawAttributes','type','key','model','query','attributes','fields','length','hasOwnProperty','order'];(function(_0x353643,_0x568495){var _0x394b32=function(_0x3924ae){while(--_0x3924ae){_0x353643['push'](_0x353643['shift']());}};_0x394b32(++_0x568495);}(_0x6d38,0x1ef));var _0x86d3=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x6d38[_0x3ab9ee];return _0x82ee88;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x86d3('0x0'));var zipdir=require(_0x86d3('0x1'));var jsonpatch=require(_0x86d3('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x86d3('0x3'));var Mustache=require('mustache');var util=require(_0x86d3('0x4'));var path=require(_0x86d3('0x5'));var sox=require(_0x86d3('0x6'));var csv=require('to-csv');var ejs=require(_0x86d3('0x7'));var fs=require('fs');var fs_extra=require(_0x86d3('0x8'));var _=require(_0x86d3('0x9'));var squel=require(_0x86d3('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x86d3('0xb'));var toCsv=require(_0x86d3('0xc'));var querystring=require(_0x86d3('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x86d3('0xe'));var qs=require(_0x86d3('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x86d3('0x10'))(_0x86d3('0x11'));var utils=require('../../config/utils');var config=require(_0x86d3('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x86d3('0x13'))['db'];function respondWithStatusCode(_0x7d4d2e,_0x440a55){_0x440a55=_0x440a55||0xcc;return function(_0x26d64c){if(_0x26d64c){return _0x7d4d2e[_0x86d3('0x14')](_0x440a55);}return _0x7d4d2e[_0x86d3('0x15')](_0x440a55)[_0x86d3('0x16')]();};}function respondWithResult(_0x12ef4a,_0x5ce2ff){_0x5ce2ff=_0x5ce2ff||0xc8;return function(_0x1c1ba8){if(_0x1c1ba8){return _0x12ef4a[_0x86d3('0x15')](_0x5ce2ff)[_0x86d3('0x17')](_0x1c1ba8);}};}function respondWithFilteredResult(_0x207f6f,_0x1ea535){return function(_0x34fb3b){if(_0x34fb3b){var _0x1ff008=typeof _0x1ea535[_0x86d3('0x18')]==='undefined'&&typeof _0x1ea535[_0x86d3('0x19')]===_0x86d3('0x1a');var _0x431b3f=_0x34fb3b[_0x86d3('0x1b')];var _0x46feec=_0x1ff008?0x0:_0x1ea535[_0x86d3('0x18')];var _0x33e459=_0x1ff008?_0x34fb3b[_0x86d3('0x1b')]:_0x1ea535[_0x86d3('0x18')]+_0x1ea535['limit'];var _0x191ba5;if(_0x33e459>=_0x431b3f){_0x33e459=_0x431b3f;_0x191ba5=0xc8;}else{_0x191ba5=0xce;}_0x207f6f['status'](_0x191ba5);return _0x207f6f[_0x86d3('0x1c')]('Content-Range',_0x46feec+'-'+_0x33e459+'/'+_0x431b3f)['json'](_0x34fb3b);}return null;};}function patchUpdates(_0x41486a){return function(_0x1edb6d){try{jsonpatch[_0x86d3('0x1d')](_0x1edb6d,_0x41486a,!![]);}catch(_0x1720ae){return BPromise['reject'](_0x1720ae);}return _0x1edb6d[_0x86d3('0x1e')]();};}function saveUpdates(_0x55e1c3,_0x36e0fa){return function(_0x3fdf67){if(_0x3fdf67){return _0x3fdf67[_0x86d3('0x1f')](_0x55e1c3)['then'](function(_0x39d819){return _0x39d819;});}return null;};}function removeEntity(_0x72b3d4,_0x1fa4ac){return function(_0x4bf5b8){if(_0x4bf5b8){return _0x4bf5b8['destroy']()[_0x86d3('0x20')](function(){_0x72b3d4['status'](0xcc)[_0x86d3('0x16')]();});}};}function handleEntityNotFound(_0x1bea5e,_0x3dfecd){return function(_0x3c5fe4){if(!_0x3c5fe4){_0x1bea5e['sendStatus'](0x194);}return _0x3c5fe4;};}function handleError(_0x481077,_0x3359e4){_0x3359e4=_0x3359e4||0x1f4;return function(_0x611764){logger['error'](_0x611764[_0x86d3('0x21')]);if(_0x611764['name']){delete _0x611764[_0x86d3('0x22')];}_0x481077[_0x86d3('0x15')](_0x3359e4)[_0x86d3('0x23')](_0x611764);};}exports[_0x86d3('0x24')]=function(_0x11a6fd,_0x14c9ff){var _0x1f203e={},_0x35d708={},_0x303f13={'count':0x0,'rows':[]};var _0x44dacf=_[_0x86d3('0x25')](db[_0x86d3('0x26')][_0x86d3('0x27')],function(_0x28c25e){return{'name':_0x28c25e['fieldName'],'type':_0x28c25e[_0x86d3('0x28')][_0x86d3('0x29')]};});_0x35d708[_0x86d3('0x2a')]=_[_0x86d3('0x25')](_0x44dacf,_0x86d3('0x22'));_0x35d708[_0x86d3('0x2b')]=_['keys'](_0x11a6fd[_0x86d3('0x2b')]);_0x35d708['filters']=_['intersection'](_0x35d708[_0x86d3('0x2a')],_0x35d708[_0x86d3('0x2b')]);_0x1f203e[_0x86d3('0x2c')]=_['intersection'](_0x35d708[_0x86d3('0x2a')],qs[_0x86d3('0x2d')](_0x11a6fd['query'][_0x86d3('0x2d')]));_0x1f203e[_0x86d3('0x2c')]=_0x1f203e[_0x86d3('0x2c')][_0x86d3('0x2e')]?_0x1f203e[_0x86d3('0x2c')]:_0x35d708[_0x86d3('0x2a')];if(!_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x2f')]('nolimit')){_0x1f203e['limit']=qs['limit'](_0x11a6fd[_0x86d3('0x2b')]['limit']);_0x1f203e[_0x86d3('0x18')]=qs['offset'](_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x18')]);}_0x1f203e[_0x86d3('0x30')]=qs[_0x86d3('0x31')](_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x31')]);_0x1f203e[_0x86d3('0x32')]=qs['filters'](_[_0x86d3('0x33')](_0x11a6fd[_0x86d3('0x2b')],_0x35d708['filters']),_0x44dacf);if(_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x34')]){_0x1f203e[_0x86d3('0x32')]=_[_0x86d3('0x35')](_0x1f203e['where'],{'$or':_[_0x86d3('0x25')](_0x44dacf,function(_0x42ac0d){if(_0x42ac0d[_0x86d3('0x28')]!=='VIRTUAL'){var _0x5762ca={};_0x5762ca[_0x42ac0d[_0x86d3('0x22')]]={'$like':'%'+_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x34')]+'%'};return _0x5762ca;}})});}_0x1f203e=_[_0x86d3('0x35')]({},_0x1f203e,_0x11a6fd[_0x86d3('0x36')]);var _0x3666fc={'where':_0x1f203e[_0x86d3('0x32')]};return db['Integration'][_0x86d3('0x1b')](_0x3666fc)[_0x86d3('0x20')](function(_0x2bdc67){_0x303f13[_0x86d3('0x1b')]=_0x2bdc67;if(_0x11a6fd['query'][_0x86d3('0x37')]){_0x1f203e[_0x86d3('0x38')]=[{'all':!![]}];}return db[_0x86d3('0x26')][_0x86d3('0x39')](_0x1f203e);})['then'](function(_0x587747){_0x303f13[_0x86d3('0x3a')]=_0x587747;return _0x303f13;})['then'](respondWithFilteredResult(_0x14c9ff,_0x1f203e))['catch'](handleError(_0x14c9ff,null));};exports[_0x86d3('0x3b')]=function(_0x1385fc,_0x43490a){var _0x35d6fe={'raw':![],'where':{'id':_0x1385fc['params']['id']}},_0x23ef72={};_0x23ef72[_0x86d3('0x2a')]=_[_0x86d3('0x3c')](db[_0x86d3('0x26')]['rawAttributes']);_0x23ef72[_0x86d3('0x2b')]=_[_0x86d3('0x3c')](_0x1385fc['query']);_0x23ef72[_0x86d3('0x3d')]=_[_0x86d3('0x3e')](_0x23ef72['model'],_0x23ef72['query']);_0x35d6fe['attributes']=_[_0x86d3('0x3e')](_0x23ef72[_0x86d3('0x2a')],qs[_0x86d3('0x2d')](_0x1385fc[_0x86d3('0x2b')][_0x86d3('0x2d')]));_0x35d6fe[_0x86d3('0x2c')]=_0x35d6fe['attributes'][_0x86d3('0x2e')]?_0x35d6fe[_0x86d3('0x2c')]:_0x23ef72['model'];if(_0x1385fc[_0x86d3('0x2b')][_0x86d3('0x37')]){_0x35d6fe[_0x86d3('0x38')]=[{'all':!![]}];}_0x35d6fe=_[_0x86d3('0x35')]({},_0x35d6fe,_0x1385fc[_0x86d3('0x36')]);return db[_0x86d3('0x26')]['find'](_0x35d6fe)[_0x86d3('0x20')](handleEntityNotFound(_0x43490a,null))[_0x86d3('0x20')](respondWithResult(_0x43490a,null))['catch'](handleError(_0x43490a,null));};exports[_0x86d3('0x3f')]=function(_0x412d0e,_0xd20863){return db[_0x86d3('0x26')][_0x86d3('0x3f')](_0x412d0e['body'],{})[_0x86d3('0x20')](respondWithResult(_0xd20863,0xc9))[_0x86d3('0x40')](handleError(_0xd20863,null));};exports[_0x86d3('0x1f')]=function(_0x14fa58,_0x369b75){if(_0x14fa58[_0x86d3('0x41')]['id']){delete _0x14fa58[_0x86d3('0x41')]['id'];}return db[_0x86d3('0x26')][_0x86d3('0x42')]({'where':{'id':_0x14fa58[_0x86d3('0x43')]['id']}})[_0x86d3('0x20')](handleEntityNotFound(_0x369b75,null))[_0x86d3('0x20')](saveUpdates(_0x14fa58['body'],null))[_0x86d3('0x20')](respondWithResult(_0x369b75,null))[_0x86d3('0x40')](handleError(_0x369b75,null));};exports['destroy']=function(_0x43290d,_0x23a6ee){return db[_0x86d3('0x26')][_0x86d3('0x42')]({'where':{'id':_0x43290d[_0x86d3('0x43')]['id']}})[_0x86d3('0x20')](handleEntityNotFound(_0x23a6ee,null))['then'](removeEntity(_0x23a6ee,null))['catch'](handleError(_0x23a6ee,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index b277266..28c4398 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 _0xd25b=['request-promise','path','rimraf','../../config/environment','define','Integration','integrations','lodash','util','api','moment','bluebird'];(function(_0x3f7d2e,_0x3dc447){var _0x440c3f=function(_0x42b5bc){while(--_0x42b5bc){_0x3f7d2e['push'](_0x3f7d2e['shift']());}};_0x440c3f(++_0x3dc447);}(_0xd25b,0x1c3));var _0xbd25=function(_0x1d2e67,_0x1a7f78){_0x1d2e67=_0x1d2e67-0x0;var _0x486d3c=_0xd25b[_0x1d2e67];return _0x486d3c;};'use strict';var _=require(_0xbd25('0x0'));var util=require(_0xbd25('0x1'));var logger=require('../../config/logger')(_0xbd25('0x2'));var moment=require(_0xbd25('0x3'));var BPromise=require(_0xbd25('0x4'));var rp=require(_0xbd25('0x5'));var fs=require('fs');var path=require(_0xbd25('0x6'));var rimraf=require(_0xbd25('0x7'));var config=require(_0xbd25('0x8'));var attributes=require('./integration.attributes');module['exports']=function(_0x3c0552,_0x24f2d2){return _0x3c0552[_0xbd25('0x9')](_0xbd25('0xa'),attributes,{'tableName':_0xbd25('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdcff=['path','./integration.attributes','exports','define','Integration','integrations','lodash','util','../../config/logger','api','bluebird'];(function(_0x52c651,_0x4c1f4e){var _0x525ceb=function(_0x3043f7){while(--_0x3043f7){_0x52c651['push'](_0x52c651['shift']());}};_0x525ceb(++_0x4c1f4e);}(_0xdcff,0x10e));var _0xfdcf=function(_0x1d849d,_0x13bc83){_0x1d849d=_0x1d849d-0x0;var _0x4a5e18=_0xdcff[_0x1d849d];return _0x4a5e18;};'use strict';var _=require(_0xfdcf('0x0'));var util=require(_0xfdcf('0x1'));var logger=require(_0xfdcf('0x2'))(_0xfdcf('0x3'));var moment=require('moment');var BPromise=require(_0xfdcf('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfdcf('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xfdcf('0x6'));module[_0xfdcf('0x7')]=function(_0x2ae99d,_0x1a8bb4){return _0x2ae99d[_0xfdcf('0x8')](_0xfdcf('0x9'),attributes,{'tableName':_0xfdcf('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index 894aaca..325f35c 100644 --- a/server/api/integration/integration.rpc.js +++ b/server/api/integration/integration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd943=['info','request\x20sent','Integration,\x20%s,\x20%s,\x20%s','error','code','Integration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','then'];(function(_0x2cad63,_0x15a505){var _0x2ac69e=function(_0x5557d9){while(--_0x5557d9){_0x2cad63['push'](_0x2cad63['shift']());}};_0x2ac69e(++_0x15a505);}(_0xd943,0x15d));var _0x3d94=function(_0x29d60c,_0x1d9c2f){_0x29d60c=_0x29d60c-0x0;var _0x49c74c=_0xd943[_0x29d60c];return _0x49c74c;};'use strict';var _=require(_0x3d94('0x0'));var util=require(_0x3d94('0x1'));var moment=require(_0x3d94('0x2'));var BPromise=require(_0x3d94('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3d94('0x4'));var db=require(_0x3d94('0x5'))['db'];var utils=require(_0x3d94('0x6'));var logger=require(_0x3d94('0x7'))(_0x3d94('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3d94('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54e81f,_0x4d29e7,_0x20f4d1){return new BPromise(function(_0x35d36a,_0x5244c3){return client['request'](_0x54e81f,_0x20f4d1)[_0x3d94('0xa')](function(_0x27e381){logger[_0x3d94('0xb')]('Integration,\x20%s,\x20%s',_0x4d29e7,_0x3d94('0xc'));logger['debug'](_0x3d94('0xd'),_0x4d29e7,_0x3d94('0xc'),JSON['stringify'](_0x27e381));if(_0x27e381[_0x3d94('0xe')]){if(_0x27e381[_0x3d94('0xe')][_0x3d94('0xf')]===0x1f4){logger[_0x3d94('0xe')](_0x3d94('0x10'),_0x4d29e7,_0x27e381['error'][_0x3d94('0x11')]);return _0x5244c3(_0x27e381[_0x3d94('0xe')][_0x3d94('0x11')]);}logger['error'](_0x3d94('0x10'),_0x4d29e7,_0x27e381[_0x3d94('0xe')][_0x3d94('0x11')]);return _0x35d36a(_0x27e381['error'][_0x3d94('0x11')]);}else{logger[_0x3d94('0xb')](_0x3d94('0x10'),_0x4d29e7,_0x3d94('0xc'));_0x35d36a(_0x27e381[_0x3d94('0x12')][_0x3d94('0x11')]);}})[_0x3d94('0x13')](function(_0x9893cb){logger['error'](_0x3d94('0x10'),_0x4d29e7,_0x9893cb);_0x5244c3(_0x9893cb);});});} \ No newline at end of file +var _0x6d38=['request','then','Integration,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x294536,_0x15c37a){var _0x229b29=function(_0x1dcdee){while(--_0x1dcdee){_0x294536['push'](_0x294536['shift']());}};_0x229b29(++_0x15c37a);}(_0x6d38,0x1ef));var _0x86d3=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x6d38[_0x465028];return _0xb783d4;};'use strict';var _=require('lodash');var util=require(_0x86d3('0x0'));var moment=require(_0x86d3('0x1'));var BPromise=require(_0x86d3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x86d3('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x86d3('0x4'))(_0x86d3('0x5'));var config=require(_0x86d3('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x86d3('0x7')][_0x86d3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x33d4aa,_0x2eaa15,_0x47e654){return new BPromise(function(_0x552b07,_0x2aea31){return client[_0x86d3('0x9')](_0x33d4aa,_0x47e654)[_0x86d3('0xa')](function(_0x499640){logger['info'](_0x86d3('0xb'),_0x2eaa15,_0x86d3('0xc'));logger['debug']('Integration,\x20%s,\x20%s,\x20%s',_0x2eaa15,_0x86d3('0xc'),JSON[_0x86d3('0xd')](_0x499640));if(_0x499640['error']){if(_0x499640[_0x86d3('0xe')]['code']===0x1f4){logger[_0x86d3('0xe')](_0x86d3('0xb'),_0x2eaa15,_0x499640[_0x86d3('0xe')][_0x86d3('0xf')]);return _0x2aea31(_0x499640[_0x86d3('0xe')][_0x86d3('0xf')]);}logger[_0x86d3('0xe')](_0x86d3('0xb'),_0x2eaa15,_0x499640['error'][_0x86d3('0xf')]);return _0x552b07(_0x499640[_0x86d3('0xe')][_0x86d3('0xf')]);}else{logger[_0x86d3('0x10')](_0x86d3('0xb'),_0x2eaa15,_0x86d3('0xc'));_0x552b07(_0x499640[_0x86d3('0x11')][_0x86d3('0xf')]);}})['catch'](function(_0x2d5ba9){logger[_0x86d3('0xe')](_0x86d3('0xb'),_0x2eaa15,_0x2d5ba9);_0x2aea31(_0x2d5ba9);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index f849f68..c522185 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 _0x4975=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','destroy','exports','multer','path','connect-timeout','express'];(function(_0xbb4e02,_0x1cac95){var _0x50ac16=function(_0xa64de2){while(--_0xa64de2){_0xbb4e02['push'](_0xbb4e02['shift']());}};_0x50ac16(++_0x1cac95);}(_0x4975,0x86));var _0x5497=function(_0x1fe70c,_0x5f357d){_0x1fe70c=_0x1fe70c-0x0;var _0x57a4f5=_0x4975[_0x1fe70c];return _0x57a4f5;};'use strict';var multer=require(_0x5497('0x0'));var util=require('util');var path=require(_0x5497('0x1'));var timeout=require(_0x5497('0x2'));var express=require(_0x5497('0x3'));var router=express[_0x5497('0x4')]();var fs_extra=require(_0x5497('0x5'));var auth=require(_0x5497('0x6'));var interaction=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var controller=require(_0x5497('0x9'));router[_0x5497('0xa')]('/',auth['isAuthenticated'](),controller[_0x5497('0xb')]);router['get'](_0x5497('0xc'),auth[_0x5497('0xd')](),controller[_0x5497('0xe')]);router['get'](_0x5497('0xf'),auth['isAuthenticated'](),controller[_0x5497('0x10')]);router[_0x5497('0x11')]('/',auth[_0x5497('0xd')](),controller[_0x5497('0x12')]);router[_0x5497('0x13')](_0x5497('0xf'),auth[_0x5497('0xd')](),controller[_0x5497('0x14')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x5497('0x15')]);module[_0x5497('0x16')]=router; \ No newline at end of file +var _0x5f2f=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./integrationReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0x5f2f,0x73));var _0xf5f2=function(_0x29bfeb,_0x436be6){_0x29bfeb=_0x29bfeb-0x0;var _0x568121=_0x5f2f[_0x29bfeb];return _0x568121;};'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')]('/',auth[_0xf5f2('0xa')](),controller['create']);router[_0xf5f2('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xf5f2('0x12')]);router[_0xf5f2('0x13')]('/:id',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x14')]);module[_0xf5f2('0x15')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index df8a0af..de61bd2 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 _0x3c00=['TEXT','ENUM','SENT','SENDING','RECEIVED','sequelize','exports','STRING','DATE','INTEGER','BOOLEAN'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x3c00,0x73));var _0x03c0=function(_0x588d05,_0xd0060c){_0x588d05=_0x588d05-0x0;var _0x44a8f4=_0x3c00[_0x588d05];return _0x44a8f4;};'use strict';var Sequelize=require(_0x03c0('0x0'));module[_0x03c0('0x1')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0x03c0('0x2')]},'exitStatus':{'type':Sequelize[_0x03c0('0x2')]},'ticketId':{'type':Sequelize[_0x03c0('0x2')]},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize[_0x03c0('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x03c0('0x2')]},'calleridname':{'type':Sequelize[_0x03c0('0x2')]},'queue':{'type':Sequelize[_0x03c0('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x03c0('0x3')]},'holdtime':{'type':Sequelize[_0x03c0('0x4')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x03c0('0x3')]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x03c0('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x03c0('0x4')]},'reason':{'type':Sequelize[_0x03c0('0x2')]},'agentringnoanswer':{'type':Sequelize[_0x03c0('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x03c0('0x3')]},'agentdump':{'type':Sequelize[_0x03c0('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0x03c0('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x03c0('0x4')]},'channelstatedesc':{'type':Sequelize[_0x03c0('0x2')]},'connectedlinenum':{'type':Sequelize[_0x03c0('0x2')]},'connectedlinename':{'type':Sequelize[_0x03c0('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x03c0('0x2')]},'exten':{'type':Sequelize[_0x03c0('0x2')]},'priority':{'type':Sequelize[_0x03c0('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x03c0('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x03c0('0x2')]},'destcalleridnum':{'type':Sequelize[_0x03c0('0x2')]},'destcalleridname':{'type':Sequelize[_0x03c0('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x03c0('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x03c0('0x2')]},'destcontext':{'type':Sequelize[_0x03c0('0x2')]},'destexten':{'type':Sequelize[_0x03c0('0x2')]},'destpriority':{'type':Sequelize[_0x03c0('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0x03c0('0x2')]},'inReplyTo':{'type':Sequelize[_0x03c0('0x2')]},'subject':{'type':Sequelize[_0x03c0('0x2')]},'from':{'type':Sequelize[_0x03c0('0x2')]},'to':{'type':Sequelize[_0x03c0('0x2')]},'cc':{'type':Sequelize[_0x03c0('0x2')]},'attachment':{'type':Sequelize[_0x03c0('0x6')]},'html':{'type':Sequelize[_0x03c0('0x6')]},'text':{'type':Sequelize[_0x03c0('0x6')]},'status':{'type':Sequelize[_0x03c0('0x7')](_0x03c0('0x8'),_0x03c0('0x9'),_0x03c0('0xa'),'FAILED')},'url':{'type':Sequelize[_0x03c0('0x2')]},'app':{'type':Sequelize[_0x03c0('0x2')]},'appdata':{'type':Sequelize[_0x03c0('0x2')]},'projectId':{'type':Sequelize[_0x03c0('0x4')]}}; \ No newline at end of file +var _0x7773=['exports','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENT','FAILED','sequelize'];(function(_0x5e5705,_0x1f2d71){var _0x534bcf=function(_0x4588a2){while(--_0x4588a2){_0x5e5705['push'](_0x5e5705['shift']());}};_0x534bcf(++_0x1f2d71);}(_0x7773,0x1df));var _0x3777=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x7773[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0x3777('0x0'));module[_0x3777('0x1')]={'integration':{'type':Sequelize[_0x3777('0x2')]},'eventChannel':{'type':Sequelize[_0x3777('0x2')]},'exitStatus':{'type':Sequelize[_0x3777('0x2')]},'ticketId':{'type':Sequelize[_0x3777('0x2')]},'integrationId':{'type':Sequelize[_0x3777('0x3')]},'contacts':{'type':Sequelize[_0x3777('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x3777('0x2')]},'queue':{'type':Sequelize[_0x3777('0x2')]},'interface':{'type':Sequelize[_0x3777('0x2')]},'membername':{'type':Sequelize[_0x3777('0x2')]},'agentcalledAt':{'type':Sequelize[_0x3777('0x4')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x3777('0x3')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x3777('0x4')]},'talktime':{'type':Sequelize[_0x3777('0x3')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x3777('0x2')]},'agentringnoanswer':{'type':Sequelize[_0x3777('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x3777('0x4')]},'agentdump':{'type':Sequelize[_0x3777('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x3777('0x4')]},'lastevent':{'type':Sequelize[_0x3777('0x2')]},'channel':{'type':Sequelize[_0x3777('0x2')]},'channelstate':{'type':Sequelize[_0x3777('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x3777('0x2')]},'connectedlinename':{'type':Sequelize[_0x3777('0x2')]},'language':{'type':Sequelize[_0x3777('0x2')]},'accountcode':{'type':Sequelize[_0x3777('0x2')]},'context':{'type':Sequelize[_0x3777('0x2')]},'exten':{'type':Sequelize[_0x3777('0x2')]},'priority':{'type':Sequelize[_0x3777('0x2')]},'destchannel':{'type':Sequelize[_0x3777('0x2')]},'destchannelstate':{'type':Sequelize[_0x3777('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x3777('0x2')]},'destcalleridnum':{'type':Sequelize[_0x3777('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x3777('0x2')]},'destlanguage':{'type':Sequelize[_0x3777('0x2')]},'destaccountcode':{'type':Sequelize[_0x3777('0x2')]},'destcontext':{'type':Sequelize[_0x3777('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x3777('0x2')]},'destuniqueid':{'type':Sequelize[_0x3777('0x2')]},'messageId':{'type':Sequelize[_0x3777('0x2')]},'inReplyTo':{'type':Sequelize[_0x3777('0x2')]},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize[_0x3777('0x2')]},'to':{'type':Sequelize[_0x3777('0x2')]},'cc':{'type':Sequelize[_0x3777('0x2')]},'attachment':{'type':Sequelize[_0x3777('0x6')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0x3777('0x6')]},'status':{'type':Sequelize[_0x3777('0x7')](_0x3777('0x8'),'SENDING','RECEIVED',_0x3777('0x9'))},'url':{'type':Sequelize[_0x3777('0x2')]},'app':{'type':Sequelize[_0x3777('0x2')]},'appdata':{'type':Sequelize[_0x3777('0x2')]},'projectId':{'type':Sequelize[_0x3777('0x3')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index d6c8208..3ad0ec4 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 _0x2cd3=['rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','fields','find','catch','create','body','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','IntegrationReport'];(function(_0x18be13,_0x12f269){var _0x17317b=function(_0x449d31){while(--_0x449d31){_0x18be13['push'](_0x18be13['shift']());}};_0x17317b(++_0x12f269);}(_0x2cd3,0x6e));var _0x32cd=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0x2cd3[_0x139a3c];return _0x2b375b;};'use strict';var emlformat=require(_0x32cd('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x32cd('0x1'));var rp=require(_0x32cd('0x2'));var moment=require(_0x32cd('0x3'));var BPromise=require(_0x32cd('0x4'));var Mustache=require(_0x32cd('0x5'));var util=require('util');var path=require(_0x32cd('0x6'));var sox=require('sox');var csv=require(_0x32cd('0x7'));var ejs=require(_0x32cd('0x8'));var fs=require('fs');var fs_extra=require(_0x32cd('0x9'));var _=require(_0x32cd('0xa'));var squel=require(_0x32cd('0xb'));var crypto=require('crypto');var jsforce=require(_0x32cd('0xc'));var deskjs=require(_0x32cd('0xd'));var toCsv=require(_0x32cd('0x7'));var querystring=require(_0x32cd('0xe'));var Papa=require(_0x32cd('0xf'));var Redis=require(_0x32cd('0x10'));var authService=require(_0x32cd('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x32cd('0x12'));var hardwareService=require(_0x32cd('0x13'));var logger=require(_0x32cd('0x14'))(_0x32cd('0x15'));var utils=require(_0x32cd('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x32cd('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x130ab3,_0x371a98){_0x371a98=_0x371a98||0xcc;return function(_0x240b02){if(_0x240b02){return _0x130ab3[_0x32cd('0x18')](_0x371a98);}return _0x130ab3[_0x32cd('0x19')](_0x371a98)['end']();};}function respondWithResult(_0x1e1cdb,_0x4cbf05){_0x4cbf05=_0x4cbf05||0xc8;return function(_0x9662b8){if(_0x9662b8){return _0x1e1cdb[_0x32cd('0x19')](_0x4cbf05)[_0x32cd('0x1a')](_0x9662b8);}};}function respondWithFilteredResult(_0x10b0aa,_0x1f218a){return function(_0xcb76de){if(_0xcb76de){var _0x5aab84=typeof _0x1f218a['offset']===_0x32cd('0x1b')&&typeof _0x1f218a['limit']===_0x32cd('0x1b');var _0x29fac9=_0xcb76de[_0x32cd('0x1c')];var _0x48135c=_0x5aab84?0x0:_0x1f218a[_0x32cd('0x1d')];var _0x52b343=_0x5aab84?_0xcb76de[_0x32cd('0x1c')]:_0x1f218a[_0x32cd('0x1d')]+_0x1f218a[_0x32cd('0x1e')];var _0x224947;if(_0x52b343>=_0x29fac9){_0x52b343=_0x29fac9;_0x224947=0xc8;}else{_0x224947=0xce;}_0x10b0aa[_0x32cd('0x19')](_0x224947);return _0x10b0aa[_0x32cd('0x1f')](_0x32cd('0x20'),_0x48135c+'-'+_0x52b343+'/'+_0x29fac9)[_0x32cd('0x1a')](_0xcb76de);}return null;};}function patchUpdates(_0x142a3c){return function(_0x3eb6e9){try{jsonpatch[_0x32cd('0x21')](_0x3eb6e9,_0x142a3c,!![]);}catch(_0x3a3d7e){return BPromise[_0x32cd('0x22')](_0x3a3d7e);}return _0x3eb6e9[_0x32cd('0x23')]();};}function saveUpdates(_0x2a6354,_0x29e51b){return function(_0x392739){if(_0x392739){return _0x392739[_0x32cd('0x24')](_0x2a6354)[_0x32cd('0x25')](function(_0x5496d9){return _0x5496d9;});}return null;};}function removeEntity(_0x15477b,_0x4e39e5){return function(_0x1c5e25){if(_0x1c5e25){return _0x1c5e25[_0x32cd('0x26')]()[_0x32cd('0x25')](function(){_0x15477b[_0x32cd('0x19')](0xcc)[_0x32cd('0x27')]();});}};}function handleEntityNotFound(_0xeb78d8,_0x12beec){return function(_0x3c2211){if(!_0x3c2211){_0xeb78d8[_0x32cd('0x18')](0x194);}return _0x3c2211;};}function handleError(_0x2b4dab,_0x4210b5){_0x4210b5=_0x4210b5||0x1f4;return function(_0x160fea){logger[_0x32cd('0x28')](_0x160fea['stack']);if(_0x160fea[_0x32cd('0x29')]){delete _0x160fea[_0x32cd('0x29')];}_0x2b4dab[_0x32cd('0x19')](_0x4210b5)[_0x32cd('0x2a')](_0x160fea);};}exports[_0x32cd('0x2b')]=function(_0x31932a,_0x3add90){var _0x328abf={},_0xcda990={},_0x268a83={'count':0x0,'rows':[]};var _0x4d3570=_[_0x32cd('0x2c')](db[_0x32cd('0x2d')][_0x32cd('0x2e')],function(_0x12c45e){return{'name':_0x12c45e[_0x32cd('0x2f')],'type':_0x12c45e[_0x32cd('0x30')][_0x32cd('0x31')]};});_0xcda990[_0x32cd('0x32')]=_[_0x32cd('0x2c')](_0x4d3570,_0x32cd('0x29'));_0xcda990[_0x32cd('0x33')]=_[_0x32cd('0x34')](_0x31932a['query']);_0xcda990[_0x32cd('0x35')]=_['intersection'](_0xcda990[_0x32cd('0x32')],_0xcda990[_0x32cd('0x33')]);_0x328abf[_0x32cd('0x36')]=_[_0x32cd('0x37')](_0xcda990[_0x32cd('0x32')],qs['fields'](_0x31932a[_0x32cd('0x33')]['fields']));_0x328abf[_0x32cd('0x36')]=_0x328abf['attributes'][_0x32cd('0x38')]?_0x328abf['attributes']:_0xcda990['model'];if(!_0x31932a[_0x32cd('0x33')][_0x32cd('0x39')](_0x32cd('0x3a'))){_0x328abf[_0x32cd('0x1e')]=qs[_0x32cd('0x1e')](_0x31932a[_0x32cd('0x33')][_0x32cd('0x1e')]);_0x328abf[_0x32cd('0x1d')]=qs[_0x32cd('0x1d')](_0x31932a[_0x32cd('0x33')][_0x32cd('0x1d')]);}_0x328abf[_0x32cd('0x3b')]=qs[_0x32cd('0x3c')](_0x31932a[_0x32cd('0x33')][_0x32cd('0x3c')]);_0x328abf[_0x32cd('0x3d')]=qs[_0x32cd('0x35')](_['pick'](_0x31932a[_0x32cd('0x33')],_0xcda990[_0x32cd('0x35')]),_0x4d3570);if(_0x31932a[_0x32cd('0x33')][_0x32cd('0x3e')]){_0x328abf['where']=_[_0x32cd('0x3f')](_0x328abf[_0x32cd('0x3d')],{'$or':_['map'](_0x4d3570,function(_0x15c3b1){if(_0x15c3b1[_0x32cd('0x30')]!==_0x32cd('0x40')){var _0x1fbcbb={};_0x1fbcbb[_0x15c3b1['name']]={'$like':'%'+_0x31932a[_0x32cd('0x33')]['filter']+'%'};return _0x1fbcbb;}})});}_0x328abf=_[_0x32cd('0x3f')]({},_0x328abf,_0x31932a[_0x32cd('0x41')]);var _0x1036a9={'where':_0x328abf[_0x32cd('0x3d')]};return db[_0x32cd('0x2d')][_0x32cd('0x1c')](_0x1036a9)['then'](function(_0x27a40e){_0x268a83[_0x32cd('0x1c')]=_0x27a40e;if(_0x31932a[_0x32cd('0x33')][_0x32cd('0x42')]){_0x328abf[_0x32cd('0x43')]=[{'all':!![]}];}return db[_0x32cd('0x2d')][_0x32cd('0x44')](_0x328abf);})[_0x32cd('0x25')](function(_0x532760){_0x268a83[_0x32cd('0x45')]=_0x532760;return _0x268a83;})[_0x32cd('0x25')](respondWithFilteredResult(_0x3add90,_0x328abf))['catch'](handleError(_0x3add90,null));};exports[_0x32cd('0x46')]=function(_0x3bdf04,_0x1edb38){var _0x4970e0={'raw':![],'where':{'id':_0x3bdf04[_0x32cd('0x47')]['id']}},_0x583228={};_0x583228[_0x32cd('0x32')]=_[_0x32cd('0x34')](db[_0x32cd('0x2d')][_0x32cd('0x2e')]);_0x583228['query']=_[_0x32cd('0x34')](_0x3bdf04[_0x32cd('0x33')]);_0x583228[_0x32cd('0x35')]=_[_0x32cd('0x37')](_0x583228[_0x32cd('0x32')],_0x583228[_0x32cd('0x33')]);_0x4970e0['attributes']=_['intersection'](_0x583228[_0x32cd('0x32')],qs[_0x32cd('0x48')](_0x3bdf04[_0x32cd('0x33')][_0x32cd('0x48')]));_0x4970e0[_0x32cd('0x36')]=_0x4970e0['attributes']['length']?_0x4970e0[_0x32cd('0x36')]:_0x583228[_0x32cd('0x32')];if(_0x3bdf04[_0x32cd('0x33')]['includeAll']){_0x4970e0['include']=[{'all':!![]}];}_0x4970e0=_[_0x32cd('0x3f')]({},_0x4970e0,_0x3bdf04[_0x32cd('0x41')]);return db[_0x32cd('0x2d')][_0x32cd('0x49')](_0x4970e0)[_0x32cd('0x25')](handleEntityNotFound(_0x1edb38,null))['then'](respondWithResult(_0x1edb38,null))[_0x32cd('0x4a')](handleError(_0x1edb38,null));};exports[_0x32cd('0x4b')]=function(_0x4b0408,_0x28a37b){return db[_0x32cd('0x2d')]['create'](_0x4b0408[_0x32cd('0x4c')],{})[_0x32cd('0x25')](respondWithResult(_0x28a37b,0xc9))[_0x32cd('0x4a')](handleError(_0x28a37b,null));};exports[_0x32cd('0x24')]=function(_0x547780,_0x5498cc){if(_0x547780['body']['id']){delete _0x547780[_0x32cd('0x4c')]['id'];}return db[_0x32cd('0x2d')][_0x32cd('0x49')]({'where':{'id':_0x547780[_0x32cd('0x47')]['id']}})['then'](handleEntityNotFound(_0x5498cc,null))[_0x32cd('0x25')](saveUpdates(_0x547780[_0x32cd('0x4c')],null))[_0x32cd('0x25')](respondWithResult(_0x5498cc,null))[_0x32cd('0x4a')](handleError(_0x5498cc,null));};exports[_0x32cd('0x26')]=function(_0x5bf1ed,_0x5929de){return db[_0x32cd('0x2d')][_0x32cd('0x49')]({'where':{'id':_0x5bf1ed[_0x32cd('0x47')]['id']}})['then'](handleEntityNotFound(_0x5929de,null))['then'](removeEntity(_0x5929de,null))['catch'](handleError(_0x5929de,null));};exports[_0x32cd('0x4d')]=function(_0x1fe9c7,_0x9c2aa0){return db[_0x32cd('0x2d')][_0x32cd('0x4d')]()[_0x32cd('0x25')](respondWithResult(_0x9c2aa0,null))[_0x32cd('0x4a')](handleError(_0x9c2aa0,null));}; \ No newline at end of file +var _0x4faa=['../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','reject','save','update','then','sendStatus','error','stack','name','index','map','IntegrationReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','merge','filter','options','includeAll','include','findAll','rows','catch','show','create','body','find','destroy','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x211a10,_0x114dee){var _0x1a8c9d=function(_0x2ccffc){while(--_0x2ccffc){_0x211a10['push'](_0x211a10['shift']());}};_0x1a8c9d(++_0x114dee);}(_0x4faa,0x110));var _0xa4fa=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0x4faa[_0x4fc9e6];return _0x551d28;};'use strict';var emlformat=require(_0xa4fa('0x0'));var rimraf=require(_0xa4fa('0x1'));var zipdir=require(_0xa4fa('0x2'));var jsonpatch=require(_0xa4fa('0x3'));var rp=require(_0xa4fa('0x4'));var moment=require(_0xa4fa('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xa4fa('0x6'));var util=require(_0xa4fa('0x7'));var path=require(_0xa4fa('0x8'));var sox=require('sox');var csv=require(_0xa4fa('0x9'));var ejs=require(_0xa4fa('0xa'));var fs=require('fs');var fs_extra=require(_0xa4fa('0xb'));var _=require(_0xa4fa('0xc'));var squel=require(_0xa4fa('0xd'));var crypto=require('crypto');var jsforce=require(_0xa4fa('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa4fa('0x9'));var querystring=require(_0xa4fa('0xf'));var Papa=require(_0xa4fa('0x10'));var Redis=require(_0xa4fa('0x11'));var authService=require(_0xa4fa('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xa4fa('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xa4fa('0x14'));var licenseUtil=require(_0xa4fa('0x15'));var db=require(_0xa4fa('0x16'))['db'];function respondWithStatusCode(_0x11de72,_0x89892a){_0x89892a=_0x89892a||0xcc;return function(_0x5f33d8){if(_0x5f33d8){return _0x11de72['sendStatus'](_0x89892a);}return _0x11de72[_0xa4fa('0x17')](_0x89892a)[_0xa4fa('0x18')]();};}function respondWithResult(_0x50bf3f,_0x32fb2a){_0x32fb2a=_0x32fb2a||0xc8;return function(_0x1ff1ff){if(_0x1ff1ff){return _0x50bf3f[_0xa4fa('0x17')](_0x32fb2a)[_0xa4fa('0x19')](_0x1ff1ff);}};}function respondWithFilteredResult(_0x3a6c13,_0x4df511){return function(_0x730a37){if(_0x730a37){var _0x3d0cd1=typeof _0x4df511['offset']===_0xa4fa('0x1a')&&typeof _0x4df511[_0xa4fa('0x1b')]===_0xa4fa('0x1a');var _0x2b53d0=_0x730a37[_0xa4fa('0x1c')];var _0x4d07f5=_0x3d0cd1?0x0:_0x4df511[_0xa4fa('0x1d')];var _0x3559cc=_0x3d0cd1?_0x730a37['count']:_0x4df511[_0xa4fa('0x1d')]+_0x4df511[_0xa4fa('0x1b')];var _0x38e11b;if(_0x3559cc>=_0x2b53d0){_0x3559cc=_0x2b53d0;_0x38e11b=0xc8;}else{_0x38e11b=0xce;}_0x3a6c13[_0xa4fa('0x17')](_0x38e11b);return _0x3a6c13[_0xa4fa('0x1e')]('Content-Range',_0x4d07f5+'-'+_0x3559cc+'/'+_0x2b53d0)[_0xa4fa('0x19')](_0x730a37);}return null;};}function patchUpdates(_0x4b7470){return function(_0xc0c249){try{jsonpatch['apply'](_0xc0c249,_0x4b7470,!![]);}catch(_0x25e2ef){return BPromise[_0xa4fa('0x1f')](_0x25e2ef);}return _0xc0c249[_0xa4fa('0x20')]();};}function saveUpdates(_0x4febbc,_0x4e72b2){return function(_0x24648f){if(_0x24648f){return _0x24648f[_0xa4fa('0x21')](_0x4febbc)['then'](function(_0x313379){return _0x313379;});}return null;};}function removeEntity(_0x51ca0a,_0x2439f0){return function(_0x47a6f3){if(_0x47a6f3){return _0x47a6f3['destroy']()[_0xa4fa('0x22')](function(){_0x51ca0a[_0xa4fa('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfb572d,_0x284a12){return function(_0x3998f6){if(!_0x3998f6){_0xfb572d[_0xa4fa('0x23')](0x194);}return _0x3998f6;};}function handleError(_0x226daa,_0x317923){_0x317923=_0x317923||0x1f4;return function(_0x245e81){logger[_0xa4fa('0x24')](_0x245e81[_0xa4fa('0x25')]);if(_0x245e81[_0xa4fa('0x26')]){delete _0x245e81[_0xa4fa('0x26')];}_0x226daa['status'](_0x317923)['send'](_0x245e81);};}exports[_0xa4fa('0x27')]=function(_0x333003,_0x28fa16){var _0x5cac37={},_0x3fa758={},_0xcc4d1f={'count':0x0,'rows':[]};var _0x5104ba=_[_0xa4fa('0x28')](db[_0xa4fa('0x29')][_0xa4fa('0x2a')],function(_0x1b9114){return{'name':_0x1b9114[_0xa4fa('0x2b')],'type':_0x1b9114[_0xa4fa('0x2c')][_0xa4fa('0x2d')]};});_0x3fa758[_0xa4fa('0x2e')]=_[_0xa4fa('0x28')](_0x5104ba,_0xa4fa('0x26'));_0x3fa758[_0xa4fa('0x2f')]=_[_0xa4fa('0x30')](_0x333003[_0xa4fa('0x2f')]);_0x3fa758[_0xa4fa('0x31')]=_['intersection'](_0x3fa758['model'],_0x3fa758['query']);_0x5cac37[_0xa4fa('0x32')]=_[_0xa4fa('0x33')](_0x3fa758['model'],qs[_0xa4fa('0x34')](_0x333003['query'][_0xa4fa('0x34')]));_0x5cac37[_0xa4fa('0x32')]=_0x5cac37['attributes'][_0xa4fa('0x35')]?_0x5cac37['attributes']:_0x3fa758[_0xa4fa('0x2e')];if(!_0x333003[_0xa4fa('0x2f')]['hasOwnProperty'](_0xa4fa('0x36'))){_0x5cac37['limit']=qs['limit'](_0x333003[_0xa4fa('0x2f')][_0xa4fa('0x1b')]);_0x5cac37[_0xa4fa('0x1d')]=qs[_0xa4fa('0x1d')](_0x333003[_0xa4fa('0x2f')]['offset']);}_0x5cac37[_0xa4fa('0x37')]=qs[_0xa4fa('0x38')](_0x333003['query'][_0xa4fa('0x38')]);_0x5cac37[_0xa4fa('0x39')]=qs['filters'](_['pick'](_0x333003['query'],_0x3fa758['filters']),_0x5104ba);if(_0x333003[_0xa4fa('0x2f')]['filter']){_0x5cac37['where']=_[_0xa4fa('0x3a')](_0x5cac37[_0xa4fa('0x39')],{'$or':_[_0xa4fa('0x28')](_0x5104ba,function(_0x3a874c){if(_0x3a874c[_0xa4fa('0x2c')]!=='VIRTUAL'){var _0x5e9260={};_0x5e9260[_0x3a874c[_0xa4fa('0x26')]]={'$like':'%'+_0x333003[_0xa4fa('0x2f')][_0xa4fa('0x3b')]+'%'};return _0x5e9260;}})});}_0x5cac37=_[_0xa4fa('0x3a')]({},_0x5cac37,_0x333003[_0xa4fa('0x3c')]);var _0x28842f={'where':_0x5cac37[_0xa4fa('0x39')]};return db[_0xa4fa('0x29')][_0xa4fa('0x1c')](_0x28842f)['then'](function(_0x4fd86f){_0xcc4d1f['count']=_0x4fd86f;if(_0x333003[_0xa4fa('0x2f')][_0xa4fa('0x3d')]){_0x5cac37[_0xa4fa('0x3e')]=[{'all':!![]}];}return db[_0xa4fa('0x29')][_0xa4fa('0x3f')](_0x5cac37);})[_0xa4fa('0x22')](function(_0x35e68d){_0xcc4d1f[_0xa4fa('0x40')]=_0x35e68d;return _0xcc4d1f;})[_0xa4fa('0x22')](respondWithFilteredResult(_0x28fa16,_0x5cac37))[_0xa4fa('0x41')](handleError(_0x28fa16,null));};exports[_0xa4fa('0x42')]=function(_0x34b4b6,_0x237749){var _0x8d9d19={'raw':![],'where':{'id':_0x34b4b6['params']['id']}},_0x2b865f={};_0x2b865f['model']=_[_0xa4fa('0x30')](db[_0xa4fa('0x29')][_0xa4fa('0x2a')]);_0x2b865f[_0xa4fa('0x2f')]=_['keys'](_0x34b4b6[_0xa4fa('0x2f')]);_0x2b865f[_0xa4fa('0x31')]=_[_0xa4fa('0x33')](_0x2b865f[_0xa4fa('0x2e')],_0x2b865f['query']);_0x8d9d19['attributes']=_[_0xa4fa('0x33')](_0x2b865f[_0xa4fa('0x2e')],qs[_0xa4fa('0x34')](_0x34b4b6[_0xa4fa('0x2f')][_0xa4fa('0x34')]));_0x8d9d19['attributes']=_0x8d9d19[_0xa4fa('0x32')]['length']?_0x8d9d19['attributes']:_0x2b865f[_0xa4fa('0x2e')];if(_0x34b4b6[_0xa4fa('0x2f')][_0xa4fa('0x3d')]){_0x8d9d19[_0xa4fa('0x3e')]=[{'all':!![]}];}_0x8d9d19=_['merge']({},_0x8d9d19,_0x34b4b6[_0xa4fa('0x3c')]);return db[_0xa4fa('0x29')]['find'](_0x8d9d19)['then'](handleEntityNotFound(_0x237749,null))['then'](respondWithResult(_0x237749,null))[_0xa4fa('0x41')](handleError(_0x237749,null));};exports[_0xa4fa('0x43')]=function(_0x8b841e,_0x25621b){return db[_0xa4fa('0x29')][_0xa4fa('0x43')](_0x8b841e[_0xa4fa('0x44')],{})[_0xa4fa('0x22')](respondWithResult(_0x25621b,0xc9))[_0xa4fa('0x41')](handleError(_0x25621b,null));};exports[_0xa4fa('0x21')]=function(_0x5500e9,_0x1e8519){if(_0x5500e9[_0xa4fa('0x44')]['id']){delete _0x5500e9[_0xa4fa('0x44')]['id'];}return db[_0xa4fa('0x29')][_0xa4fa('0x45')]({'where':{'id':_0x5500e9['params']['id']}})['then'](handleEntityNotFound(_0x1e8519,null))[_0xa4fa('0x22')](saveUpdates(_0x5500e9[_0xa4fa('0x44')],null))['then'](respondWithResult(_0x1e8519,null))[_0xa4fa('0x41')](handleError(_0x1e8519,null));};exports[_0xa4fa('0x46')]=function(_0x13cb90,_0x4ed565){return db['IntegrationReport']['find']({'where':{'id':_0x13cb90[_0xa4fa('0x47')]['id']}})['then'](handleEntityNotFound(_0x4ed565,null))['then'](removeEntity(_0x4ed565,null))[_0xa4fa('0x41')](handleError(_0x4ed565,null));};exports['describe']=function(_0xb96046,_0x3598d7){return db[_0xa4fa('0x29')][_0xa4fa('0x48')]()[_0xa4fa('0x22')](respondWithResult(_0x3598d7,null))[_0xa4fa('0x41')](handleError(_0x3598d7,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 9d259bc..9e6b393 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 _0x0663=['bluebird','request-promise','rimraf','../../config/environment','exports','IntegrationReport','report_integration','lodash','util','../../config/logger','api','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0663,0x193));var _0x3066=function(_0xe554bf,_0x4d68fc){_0xe554bf=_0xe554bf-0x0;var _0x2ed500=_0x0663[_0xe554bf];return _0x2ed500;};'use strict';var _=require(_0x3066('0x0'));var util=require(_0x3066('0x1'));var logger=require(_0x3066('0x2'))(_0x3066('0x3'));var moment=require(_0x3066('0x4'));var BPromise=require(_0x3066('0x5'));var rp=require(_0x3066('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3066('0x7'));var config=require(_0x3066('0x8'));var attributes=require('./integrationReport.attributes');module[_0x3066('0x9')]=function(_0x47714c,_0xb3cf0f){return _0x47714c['define'](_0x3066('0xa'),attributes,{'tableName':_0x3066('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4052=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./integrationReport.attributes','exports','define','util','../../config/logger','api'];(function(_0xeaad17,_0xf6d4e8){var _0x2e4f6b=function(_0x52d30d){while(--_0x52d30d){_0xeaad17['push'](_0xeaad17['shift']());}};_0x2e4f6b(++_0xf6d4e8);}(_0x4052,0xf9));var _0x2405=function(_0x3d6aee,_0x42cf22){_0x3d6aee=_0x3d6aee-0x0;var _0x21f4a9=_0x4052[_0x3d6aee];return _0x21f4a9;};'use strict';var _=require('lodash');var util=require(_0x2405('0x0'));var logger=require(_0x2405('0x1'))(_0x2405('0x2'));var moment=require(_0x2405('0x3'));var BPromise=require(_0x2405('0x4'));var rp=require(_0x2405('0x5'));var fs=require('fs');var path=require(_0x2405('0x6'));var rimraf=require(_0x2405('0x7'));var config=require(_0x2405('0x8'));var attributes=require(_0x2405('0x9'));module[_0x2405('0xa')]=function(_0x41d603,_0x4358b9){return _0x41d603[_0x2405('0xb')]('IntegrationReport',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 91109f4..bca82e5 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 _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','IntegrationReport,\x20%s,\x20%s','IntegrationReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0xa7dd32,_0x35561f){var _0x20f2f8=function(_0xe228c1){while(--_0xe228c1){_0xa7dd32['push'](_0xa7dd32['shift']());}};_0x20f2f8(++_0x35561f);}(_0x2ef3,0xba));var _0x32ef=function(_0xe9b377,_0x2121b6){_0xe9b377=_0xe9b377-0x0;var _0x1734f7=_0x2ef3[_0xe9b377];return _0x1734f7;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('IntegrationReport,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('IntegrationReport,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ 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(_0x375721,_0x5bebd7){var _0x5ae0b1=function(_0x3b5b87){while(--_0x3b5b87){_0x375721['push'](_0x375721['shift']());}};_0x5ae0b1(++_0x5bebd7);}(_0x187d,0x93));var _0xd187=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0x187d[_0xbe200f];return _0x192597;};'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 bf38da2..a9bd576 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 _0xe57d=['../../components/interaction/service','./interval.controller','isAuthenticated','index','get','show','/:id/sub_intervals','getIntervals','post','addInterval','/:id','update','delete','destroy','exports','multer','path','connect-timeout','fs-extra','../../components/auth/service'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0xe57d,0xd7));var _0xde57=function(_0x3ee244,_0x2e67db){_0x3ee244=_0x3ee244-0x0;var _0x2e75ee=_0xe57d[_0x3ee244];return _0x2e75ee;};'use strict';var multer=require(_0xde57('0x0'));var util=require('util');var path=require(_0xde57('0x1'));var timeout=require(_0xde57('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xde57('0x3'));var auth=require(_0xde57('0x4'));var interaction=require(_0xde57('0x5'));var config=require('../../config/environment');var controller=require(_0xde57('0x6'));router['get']('/',auth[_0xde57('0x7')](),controller[_0xde57('0x8')]);router[_0xde57('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xde57('0xa')]);router['get'](_0xde57('0xb'),auth[_0xde57('0x7')](),controller[_0xde57('0xc')]);router['post']('/',auth[_0xde57('0x7')](),controller['create']);router[_0xde57('0xd')](_0xde57('0xb'),auth[_0xde57('0x7')](),controller[_0xde57('0xe')]);router['post']('/:id/sub_intervals/create_many',auth['isAuthenticated'](),controller['addIntervals']);router['put'](_0xde57('0xf'),auth[_0xde57('0x7')](),controller[_0xde57('0x10')]);router[_0xde57('0x11')]('/:id',auth[_0xde57('0x7')](),controller[_0xde57('0x12')]);module[_0xde57('0x13')]=router; \ No newline at end of file +var _0xdfe7=['get','/:id','show','/:id/sub_intervals','post','create','addInterval','/:id/sub_intervals/create_many','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./interval.controller','isAuthenticated','index'];(function(_0x40c8cc,_0x2eae97){var _0x5bb9e8=function(_0x526307){while(--_0x526307){_0x40c8cc['push'](_0x40c8cc['shift']());}};_0x5bb9e8(++_0x2eae97);}(_0xdfe7,0xc8));var _0x7dfe=function(_0x2f7695,_0x1719c8){_0x2f7695=_0x2f7695-0x0;var _0x5416f3=_0xdfe7[_0x2f7695];return _0x5416f3;};'use strict';var multer=require('multer');var util=require(_0x7dfe('0x0'));var path=require(_0x7dfe('0x1'));var timeout=require('connect-timeout');var express=require(_0x7dfe('0x2'));var router=express[_0x7dfe('0x3')]();var fs_extra=require(_0x7dfe('0x4'));var auth=require(_0x7dfe('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7dfe('0x6'));var controller=require(_0x7dfe('0x7'));router['get']('/',auth[_0x7dfe('0x8')](),controller[_0x7dfe('0x9')]);router[_0x7dfe('0xa')](_0x7dfe('0xb'),auth['isAuthenticated'](),controller[_0x7dfe('0xc')]);router[_0x7dfe('0xa')](_0x7dfe('0xd'),auth[_0x7dfe('0x8')](),controller['getIntervals']);router[_0x7dfe('0xe')]('/',auth[_0x7dfe('0x8')](),controller[_0x7dfe('0xf')]);router[_0x7dfe('0xe')](_0x7dfe('0xd'),auth['isAuthenticated'](),controller[_0x7dfe('0x10')]);router[_0x7dfe('0xe')](_0x7dfe('0x11'),auth[_0x7dfe('0x8')](),controller['addIntervals']);router['put'](_0x7dfe('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x7dfe('0x12')]('/:id',auth[_0x7dfe('0x8')](),controller[_0x7dfe('0x13')]);module[_0x7dfe('0x14')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index e9f2da4..b3f0ca4 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 _0xd111=['sequelize','exports','STRING'];(function(_0x4b3bf6,_0x96c151){var _0x4a1aa0=function(_0x3abf2b){while(--_0x3abf2b){_0x4b3bf6['push'](_0x4b3bf6['shift']());}};_0x4a1aa0(++_0x96c151);}(_0xd111,0x10e));var _0x1d11=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd111[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x1d11('0x0'));module[_0x1d11('0x1')]={'name':{'type':Sequelize[_0x1d11('0x2')]},'description':{'type':Sequelize[_0x1d11('0x2')]},'interval':{'type':Sequelize[_0x1d11('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x86ed=['STRING','sequelize','exports'];(function(_0x1073ad,_0x44bf0b){var _0x528474=function(_0x3450f7){while(--_0x3450f7){_0x1073ad['push'](_0x1073ad['shift']());}};_0x528474(++_0x44bf0b);}(_0x86ed,0xeb));var _0xd86e=function(_0x2fd42d,_0x1f2c07){_0x2fd42d=_0x2fd42d-0x0;var _0x139e2b=_0x86ed[_0x2fd42d];return _0x139e2b;};'use strict';var Sequelize=require(_0xd86e('0x0'));module[_0xd86e('0x1')]={'name':{'type':Sequelize[_0xd86e('0x2')]},'description':{'type':Sequelize[_0xd86e('0x2')]},'interval':{'type':Sequelize[_0xd86e('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 817386c..2d2c995 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 _0x8da1=['order','sort','where','pick','merge','VIRTUAL','options','Interval','includeAll','include','rows','catch','show','params','rawAttributes','find','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','create','error','body','IntervalId','findOne','length','filter','getIntervals','addIntervals','sequelize','transaction','bulkCreate','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../components/extensions/rewrite','status','json','offset','undefined','count','limit','apply','reject','save','update','then','destroy','get','Intervals','UserProfileResource','end','sendStatus','stack','name','send','index','map','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty'];(function(_0x32f562,_0x1543e2){var _0x4799b9=function(_0x40395c){while(--_0x40395c){_0x32f562['push'](_0x32f562['shift']());}};_0x4799b9(++_0x1543e2);}(_0x8da1,0x7a));var _0x18da=function(_0x3209f2,_0x5c51e2){_0x3209f2=_0x3209f2-0x0;var _0x56aabc=_0x8da1[_0x3209f2];return _0x56aabc;};'use strict';var emlformat=require(_0x18da('0x0'));var rimraf=require(_0x18da('0x1'));var zipdir=require(_0x18da('0x2'));var jsonpatch=require(_0x18da('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x18da('0x4'));var util=require(_0x18da('0x5'));var path=require(_0x18da('0x6'));var sox=require(_0x18da('0x7'));var csv=require(_0x18da('0x8'));var ejs=require(_0x18da('0x9'));var fs=require('fs');var fs_extra=require(_0x18da('0xa'));var _=require('lodash');var squel=require(_0x18da('0xb'));var crypto=require(_0x18da('0xc'));var jsforce=require(_0x18da('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x18da('0x8'));var querystring=require(_0x18da('0xe'));var Papa=require(_0x18da('0xf'));var Redis=require(_0x18da('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x18da('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x18da('0x12'))('api');var utils=require(_0x18da('0x13'));var config=require(_0x18da('0x14'));var licenseUtil=require(_0x18da('0x15'));var db=require('../../mysqldb')['db'];var extensions=require(_0x18da('0x16'));function respondWithStatusCode(_0x25f2ba,_0x5c1ca4){_0x5c1ca4=_0x5c1ca4||0xcc;return function(_0x150801){if(_0x150801){return _0x25f2ba['sendStatus'](_0x5c1ca4);}return _0x25f2ba[_0x18da('0x17')](_0x5c1ca4)['end']();};}function respondWithResult(_0x5ec917,_0xc1d62a){_0xc1d62a=_0xc1d62a||0xc8;return function(_0x3db3bf){if(_0x3db3bf){return _0x5ec917[_0x18da('0x17')](_0xc1d62a)[_0x18da('0x18')](_0x3db3bf);}};}function respondWithFilteredResult(_0x38c988,_0x34a727){return function(_0x21fba5){if(_0x21fba5){var _0x4052d4=typeof _0x34a727[_0x18da('0x19')]===_0x18da('0x1a')&&typeof _0x34a727['limit']===_0x18da('0x1a');var _0x383587=_0x21fba5[_0x18da('0x1b')];var _0x44c531=_0x4052d4?0x0:_0x34a727[_0x18da('0x19')];var _0x2b7501=_0x4052d4?_0x21fba5[_0x18da('0x1b')]:_0x34a727[_0x18da('0x19')]+_0x34a727[_0x18da('0x1c')];var _0x245744;if(_0x2b7501>=_0x383587){_0x2b7501=_0x383587;_0x245744=0xc8;}else{_0x245744=0xce;}_0x38c988[_0x18da('0x17')](_0x245744);return _0x38c988['set']('Content-Range',_0x44c531+'-'+_0x2b7501+'/'+_0x383587)['json'](_0x21fba5);}return null;};}function patchUpdates(_0x4c32a6){return function(_0x1d49cd){try{jsonpatch[_0x18da('0x1d')](_0x1d49cd,_0x4c32a6,!![]);}catch(_0x12d197){return BPromise[_0x18da('0x1e')](_0x12d197);}return _0x1d49cd[_0x18da('0x1f')]();};}function saveUpdates(_0x3d1ce6,_0x5e65bb){return function(_0x1600bb){if(_0x1600bb){return _0x1600bb[_0x18da('0x20')](_0x3d1ce6)[_0x18da('0x21')](function(_0x174ba5){return _0x174ba5;});}return null;};}function removeEntity(_0x3e602a,_0xb0deb9){return function(_0x2123fc){if(_0x2123fc){return _0x2123fc[_0x18da('0x22')]()[_0x18da('0x21')](function(){var _0x2df9d4=_0x2123fc[_0x18da('0x23')]({'plain':!![]});var _0x164318=_0x18da('0x24');return db[_0x18da('0x25')][_0x18da('0x22')]({'where':{'type':_0x164318,'resourceId':_0x2df9d4['id']}})['then'](function(){return _0x2123fc;});})[_0x18da('0x21')](function(){_0x3e602a[_0x18da('0x17')](0xcc)[_0x18da('0x26')]();});}};}function handleEntityNotFound(_0x14ec9e,_0xccb29){return function(_0x571b07){if(!_0x571b07){_0x14ec9e[_0x18da('0x27')](0x194);}return _0x571b07;};}function handleError(_0x4b29ba,_0x3e85cb){_0x3e85cb=_0x3e85cb||0x1f4;return function(_0x1762f6){logger['error'](_0x1762f6[_0x18da('0x28')]);if(_0x1762f6[_0x18da('0x29')]){delete _0x1762f6[_0x18da('0x29')];}_0x4b29ba[_0x18da('0x17')](_0x3e85cb)[_0x18da('0x2a')](_0x1762f6);};}exports[_0x18da('0x2b')]=function(_0x379d08,_0xe03e47){var _0x5a8d03={},_0x5c6e1d={},_0x464ce0={'count':0x0,'rows':[]};var _0x4101f0=_[_0x18da('0x2c')](db['Interval']['rawAttributes'],function(_0x5f060f){return{'name':_0x5f060f[_0x18da('0x2d')],'type':_0x5f060f[_0x18da('0x2e')][_0x18da('0x2f')]};});_0x5c6e1d[_0x18da('0x30')]=_[_0x18da('0x2c')](_0x4101f0,'name');_0x5c6e1d['query']=_[_0x18da('0x31')](_0x379d08[_0x18da('0x32')]);_0x5c6e1d[_0x18da('0x33')]=_[_0x18da('0x34')](_0x5c6e1d['model'],_0x5c6e1d[_0x18da('0x32')]);_0x5a8d03['attributes']=_[_0x18da('0x34')](_0x5c6e1d[_0x18da('0x30')],qs[_0x18da('0x35')](_0x379d08['query'][_0x18da('0x35')]));_0x5a8d03[_0x18da('0x36')]=_0x5a8d03[_0x18da('0x36')]['length']?_0x5a8d03[_0x18da('0x36')]:_0x5c6e1d[_0x18da('0x30')];if(!_0x379d08[_0x18da('0x32')][_0x18da('0x37')]('nolimit')){_0x5a8d03[_0x18da('0x1c')]=qs['limit'](_0x379d08[_0x18da('0x32')][_0x18da('0x1c')]);_0x5a8d03['offset']=qs[_0x18da('0x19')](_0x379d08['query'][_0x18da('0x19')]);}_0x5a8d03[_0x18da('0x38')]=qs[_0x18da('0x39')](_0x379d08[_0x18da('0x32')][_0x18da('0x39')]);_0x5a8d03[_0x18da('0x3a')]=qs[_0x18da('0x33')](_[_0x18da('0x3b')](_0x379d08[_0x18da('0x32')],_0x5c6e1d[_0x18da('0x33')]),_0x4101f0);if(_0x379d08['query']['filter']){_0x5a8d03['where']=_[_0x18da('0x3c')](_0x5a8d03['where'],{'$or':_[_0x18da('0x2c')](_0x4101f0,function(_0x3d5983){if(_0x3d5983[_0x18da('0x2e')]!==_0x18da('0x3d')){var _0x2907c2={};_0x2907c2[_0x3d5983[_0x18da('0x29')]]={'$like':'%'+_0x379d08[_0x18da('0x32')]['filter']+'%'};return _0x2907c2;}})});}_0x5a8d03=_[_0x18da('0x3c')]({},_0x5a8d03,_0x379d08[_0x18da('0x3e')]);var _0x30cec6={'where':_0x5a8d03[_0x18da('0x3a')]};return db[_0x18da('0x3f')]['count'](_0x30cec6)[_0x18da('0x21')](function(_0x899c51){_0x464ce0[_0x18da('0x1b')]=_0x899c51;if(_0x379d08[_0x18da('0x32')][_0x18da('0x40')]){_0x5a8d03[_0x18da('0x41')]=[{'all':!![]}];}return db[_0x18da('0x3f')]['findAll'](_0x5a8d03);})[_0x18da('0x21')](function(_0x4c210e){_0x464ce0[_0x18da('0x42')]=_0x4c210e;return _0x464ce0;})['then'](respondWithFilteredResult(_0xe03e47,_0x5a8d03))[_0x18da('0x43')](handleError(_0xe03e47,null));};exports[_0x18da('0x44')]=function(_0x1659a1,_0x169631){var _0x450539={'raw':!![],'where':{'id':_0x1659a1[_0x18da('0x45')]['id']}},_0x4bfafb={};_0x4bfafb['model']=_['keys'](db['Interval'][_0x18da('0x46')]);_0x4bfafb[_0x18da('0x32')]=_[_0x18da('0x31')](_0x1659a1[_0x18da('0x32')]);_0x4bfafb[_0x18da('0x33')]=_[_0x18da('0x34')](_0x4bfafb[_0x18da('0x30')],_0x4bfafb[_0x18da('0x32')]);_0x450539['attributes']=_[_0x18da('0x34')](_0x4bfafb[_0x18da('0x30')],qs[_0x18da('0x35')](_0x1659a1[_0x18da('0x32')][_0x18da('0x35')]));_0x450539[_0x18da('0x36')]=_0x450539['attributes']['length']?_0x450539[_0x18da('0x36')]:_0x4bfafb['model'];if(_0x1659a1[_0x18da('0x32')][_0x18da('0x40')]){_0x450539[_0x18da('0x41')]=[{'all':!![]}];}_0x450539=_[_0x18da('0x3c')]({},_0x450539,_0x1659a1['options']);return db[_0x18da('0x3f')][_0x18da('0x47')](_0x450539)[_0x18da('0x21')](handleEntityNotFound(_0x169631,null))[_0x18da('0x21')](respondWithResult(_0x169631,null))[_0x18da('0x43')](handleError(_0x169631,null));};exports['create']=function(_0x39d0ea,_0x1108ff){return db[_0x18da('0x3f')]['create'](_0x39d0ea['body'],{})['then'](function(_0x37da26){var _0x1a7b3b=_0x39d0ea['user'][_0x18da('0x23')]({'plain':!![]});if(!_0x1a7b3b)throw new Error(_0x18da('0x48'));if(_0x1a7b3b[_0x18da('0x49')]===_0x18da('0x4a')){var _0x2f5b7f=_0x37da26['get']({'plain':!![]});var _0x298de5='Intervals';return db[_0x18da('0x4b')][_0x18da('0x47')]({'where':{'name':_0x298de5,'userProfileId':_0x1a7b3b[_0x18da('0x4c')]},'raw':!![]})[_0x18da('0x21')](function(_0x3af336){if(_0x3af336&&_0x3af336['autoAssociation']===0x0){return db[_0x18da('0x25')][_0x18da('0x4d')]({'name':_0x2f5b7f[_0x18da('0x29')],'resourceId':_0x2f5b7f['id'],'type':_0x3af336[_0x18da('0x29')],'sectionId':_0x3af336['id']},{})[_0x18da('0x21')](function(){return _0x37da26;});}else{return _0x37da26;}})[_0x18da('0x43')](function(_0x4bc978){logger[_0x18da('0x4e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4bc978);throw _0x4bc978;});}return _0x37da26;})['then'](respondWithResult(_0x1108ff,0xc9))[_0x18da('0x43')](handleError(_0x1108ff,null));};exports[_0x18da('0x20')]=function(_0x3dc61c,_0x57e03b){if(_0x3dc61c['body']['id']){delete _0x3dc61c[_0x18da('0x4f')]['id'];}return db[_0x18da('0x3f')]['find']({'where':{'id':_0x3dc61c[_0x18da('0x45')]['id']}})[_0x18da('0x21')](handleEntityNotFound(_0x57e03b,null))[_0x18da('0x21')](saveUpdates(_0x3dc61c[_0x18da('0x4f')],null))[_0x18da('0x21')](respondWithResult(_0x57e03b,null))[_0x18da('0x43')](handleError(_0x57e03b,null));};exports[_0x18da('0x22')]=function(_0x5edb0f,_0x2bc0e7){return db[_0x18da('0x3f')]['find']({'where':{'id':_0x5edb0f['params']['id']}})[_0x18da('0x21')](handleEntityNotFound(_0x2bc0e7,null))[_0x18da('0x21')](removeEntity(_0x2bc0e7,null))[_0x18da('0x43')](handleError(_0x2bc0e7,null));};exports['addInterval']=function(_0x10088a,_0x4a129c,_0xf0258e){if(_0x10088a[_0x18da('0x4f')]['id']){delete _0x10088a['body']['id'];}return db[_0x18da('0x3f')]['find']({'where':{'id':_0x10088a[_0x18da('0x45')]['id']}})[_0x18da('0x21')](handleEntityNotFound(_0x4a129c,null))[_0x18da('0x21')](function(_0x183611){if(_0x183611){_0x10088a[_0x18da('0x4f')][_0x18da('0x50')]=_0x183611['id'];return db[_0x18da('0x3f')][_0x18da('0x4d')](_0x10088a[_0x18da('0x4f')]);}})['then'](respondWithResult(_0x4a129c,null))[_0x18da('0x43')](handleError(_0x4a129c,null));};exports['getIntervals']=function(_0x753683,_0x11113d,_0x1765b1){var _0x35b689={};var _0x414c83={};var _0xbca052;var _0xae305f;return db[_0x18da('0x3f')][_0x18da('0x51')]({'where':{'id':_0x753683['params']['id']}})['then'](handleEntityNotFound(_0x11113d,null))[_0x18da('0x21')](function(_0x1aedf1){if(_0x1aedf1){_0xbca052=_0x1aedf1;_0x414c83[_0x18da('0x30')]=_[_0x18da('0x31')](db['Interval']['rawAttributes']);_0x414c83[_0x18da('0x32')]=_[_0x18da('0x31')](_0x753683['query']);_0x414c83[_0x18da('0x33')]=_[_0x18da('0x34')](_0x414c83[_0x18da('0x30')],_0x414c83[_0x18da('0x32')]);_0x35b689[_0x18da('0x36')]=_[_0x18da('0x34')](_0x414c83['model'],qs[_0x18da('0x35')](_0x753683['query'][_0x18da('0x35')]));_0x35b689[_0x18da('0x36')]=_0x35b689['attributes'][_0x18da('0x52')]?_0x35b689[_0x18da('0x36')]:_0x414c83[_0x18da('0x30')];_0x35b689['order']=qs[_0x18da('0x39')](_0x753683[_0x18da('0x32')][_0x18da('0x39')]);_0x35b689[_0x18da('0x3a')]=qs[_0x18da('0x33')](_[_0x18da('0x3b')](_0x753683['query'],_0x414c83[_0x18da('0x33')]));if(_0x753683['query'][_0x18da('0x53')]){_0x35b689[_0x18da('0x3a')]=_['merge'](_0x35b689[_0x18da('0x3a')],{'$or':_['map'](_0x35b689['attributes'],function(_0x481183){var _0x489ccb={};_0x489ccb[_0x481183]={'$like':'%'+_0x753683[_0x18da('0x32')]['filter']+'%'};return _0x489ccb;})});}_0x35b689=_[_0x18da('0x3c')]({},_0x35b689,_0x753683[_0x18da('0x3e')]);return _0xbca052[_0x18da('0x54')](_0x35b689);}})['then'](function(_0x4b4dc9){if(_0x4b4dc9){_0xae305f=_0x4b4dc9[_0x18da('0x52')];if(!_0x753683['query'][_0x18da('0x37')]('nolimit')){_0x35b689[_0x18da('0x1c')]=qs[_0x18da('0x1c')](_0x753683[_0x18da('0x32')]['limit']);_0x35b689[_0x18da('0x19')]=qs[_0x18da('0x19')](_0x753683[_0x18da('0x32')][_0x18da('0x19')]);}return _0xbca052[_0x18da('0x54')](_0x35b689);}})[_0x18da('0x21')](function(_0x512594){if(_0x512594){return _0x512594?{'count':_0xae305f,'rows':_0x512594}:null;}})[_0x18da('0x21')](respondWithResult(_0x11113d,null))['catch'](handleError(_0x11113d,null));};exports[_0x18da('0x55')]=function(_0x223e40,_0x332d5e,_0x597411){return db[_0x18da('0x3f')][_0x18da('0x51')]({'where':{'id':_0x223e40[_0x18da('0x45')]['id']}})[_0x18da('0x21')](handleEntityNotFound(_0x332d5e,null))['then'](function(_0x2d3a62){if(_0x2d3a62){return db[_0x18da('0x56')][_0x18da('0x57')](function(_0x4ca33a){return db[_0x18da('0x3f')][_0x18da('0x22')]({'where':{'IntervalId':_0x223e40[_0x18da('0x45')]['id']},'transaction':_0x4ca33a})[_0x18da('0x21')](function(_0x1f5c64){var _0x2a643c=_[_0x18da('0x2c')](_0x223e40[_0x18da('0x4f')],function(_0x8d519f){delete _0x8d519f['id'];_0x8d519f[_0x18da('0x50')]=_0x223e40[_0x18da('0x45')]['id'];return _0x8d519f;});return db[_0x18da('0x3f')][_0x18da('0x58')](_0x2a643c,{'transaction':_0x4ca33a});});})[_0x18da('0x21')](function(){return db['Interval']['findAll']({'where':{'IntervalId':_0x223e40['params']['id']}});});}})[_0x18da('0x21')](respondWithResult(_0x332d5e,null))[_0x18da('0x43')](handleError(_0x332d5e,null));}; \ No newline at end of file +var _0xa227=['Intervals','destroy','sendStatus','error','stack','send','map','rawAttributes','fieldName','type','key','model','name','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick','filter','merge','where','VIRTUAL','Interval','includeAll','include','findAll','rows','show','params','length','options','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','UserProfileResource','addInterval','IntervalId','getIntervals','findOne','addIntervals','transaction','bulkCreate','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','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/utils','../../config/license/util','../../components/extensions/rewrite','status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','get'];(function(_0x57a072,_0x54c3d9){var _0x135a32=function(_0x372cec){while(--_0x372cec){_0x57a072['push'](_0x57a072['shift']());}};_0x135a32(++_0x54c3d9);}(_0xa227,0x95));var _0x7a22=function(_0x33af60,_0x3d031a){_0x33af60=_0x33af60-0x0;var _0x2f24e0=_0xa227[_0x33af60];return _0x2f24e0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7a22('0x0'));var zipdir=require(_0x7a22('0x1'));var jsonpatch=require(_0x7a22('0x2'));var rp=require(_0x7a22('0x3'));var moment=require(_0x7a22('0x4'));var BPromise=require(_0x7a22('0x5'));var Mustache=require(_0x7a22('0x6'));var util=require(_0x7a22('0x7'));var path=require(_0x7a22('0x8'));var sox=require(_0x7a22('0x9'));var csv=require('to-csv');var ejs=require(_0x7a22('0xa'));var fs=require('fs');var fs_extra=require(_0x7a22('0xb'));var _=require(_0x7a22('0xc'));var squel=require(_0x7a22('0xd'));var crypto=require(_0x7a22('0xe'));var jsforce=require(_0x7a22('0xf'));var deskjs=require(_0x7a22('0x10'));var toCsv=require(_0x7a22('0x11'));var querystring=require(_0x7a22('0x12'));var Papa=require(_0x7a22('0x13'));var Redis=require('ioredis');var authService=require(_0x7a22('0x14'));var qs=require(_0x7a22('0x15'));var as=require(_0x7a22('0x16'));var hardwareService=require(_0x7a22('0x17'));var logger=require(_0x7a22('0x18'))(_0x7a22('0x19'));var utils=require(_0x7a22('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0x7a22('0x1b'));var db=require('../../mysqldb')['db'];var extensions=require(_0x7a22('0x1c'));function respondWithStatusCode(_0x4b1955,_0x2f07ad){_0x2f07ad=_0x2f07ad||0xcc;return function(_0x352018){if(_0x352018){return _0x4b1955['sendStatus'](_0x2f07ad);}return _0x4b1955['status'](_0x2f07ad)['end']();};}function respondWithResult(_0x474e0f,_0x2dfa70){_0x2dfa70=_0x2dfa70||0xc8;return function(_0x52b3a5){if(_0x52b3a5){return _0x474e0f[_0x7a22('0x1d')](_0x2dfa70)[_0x7a22('0x1e')](_0x52b3a5);}};}function respondWithFilteredResult(_0x417a4a,_0x4817da){return function(_0x5c56c6){if(_0x5c56c6){var _0x3a027e=typeof _0x4817da[_0x7a22('0x1f')]===_0x7a22('0x20')&&typeof _0x4817da[_0x7a22('0x21')]===_0x7a22('0x20');var _0x3ff5c1=_0x5c56c6[_0x7a22('0x22')];var _0x3fb5fb=_0x3a027e?0x0:_0x4817da['offset'];var _0x35064c=_0x3a027e?_0x5c56c6['count']:_0x4817da[_0x7a22('0x1f')]+_0x4817da[_0x7a22('0x21')];var _0x2cb1b5;if(_0x35064c>=_0x3ff5c1){_0x35064c=_0x3ff5c1;_0x2cb1b5=0xc8;}else{_0x2cb1b5=0xce;}_0x417a4a[_0x7a22('0x1d')](_0x2cb1b5);return _0x417a4a['set'](_0x7a22('0x23'),_0x3fb5fb+'-'+_0x35064c+'/'+_0x3ff5c1)['json'](_0x5c56c6);}return null;};}function patchUpdates(_0x3276ee){return function(_0x51fd1e){try{jsonpatch[_0x7a22('0x24')](_0x51fd1e,_0x3276ee,!![]);}catch(_0x430f91){return BPromise[_0x7a22('0x25')](_0x430f91);}return _0x51fd1e['save']();};}function saveUpdates(_0x261a1b,_0x864c7a){return function(_0x3bd57a){if(_0x3bd57a){return _0x3bd57a[_0x7a22('0x26')](_0x261a1b)['then'](function(_0x1e7b69){return _0x1e7b69;});}return null;};}function removeEntity(_0x355b3e,_0x3c1e0e){return function(_0x1807f2){if(_0x1807f2){return _0x1807f2['destroy']()[_0x7a22('0x27')](function(){var _0x27dc11=_0x1807f2[_0x7a22('0x28')]({'plain':!![]});var _0x539bb8=_0x7a22('0x29');return db['UserProfileResource'][_0x7a22('0x2a')]({'where':{'type':_0x539bb8,'resourceId':_0x27dc11['id']}})['then'](function(){return _0x1807f2;});})[_0x7a22('0x27')](function(){_0x355b3e[_0x7a22('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1bb677,_0x1dbf2e){return function(_0x5143b3){if(!_0x5143b3){_0x1bb677[_0x7a22('0x2b')](0x194);}return _0x5143b3;};}function handleError(_0x2a51df,_0x451e1b){_0x451e1b=_0x451e1b||0x1f4;return function(_0x5c5775){logger[_0x7a22('0x2c')](_0x5c5775[_0x7a22('0x2d')]);if(_0x5c5775['name']){delete _0x5c5775['name'];}_0x2a51df[_0x7a22('0x1d')](_0x451e1b)[_0x7a22('0x2e')](_0x5c5775);};}exports['index']=function(_0x34c9e6,_0x3330bf){var _0x25d7be={},_0x186887={},_0x1c720f={'count':0x0,'rows':[]};var _0x46a512=_[_0x7a22('0x2f')](db['Interval'][_0x7a22('0x30')],function(_0xcadc29){return{'name':_0xcadc29[_0x7a22('0x31')],'type':_0xcadc29[_0x7a22('0x32')][_0x7a22('0x33')]};});_0x186887[_0x7a22('0x34')]=_[_0x7a22('0x2f')](_0x46a512,_0x7a22('0x35'));_0x186887[_0x7a22('0x36')]=_[_0x7a22('0x37')](_0x34c9e6['query']);_0x186887['filters']=_[_0x7a22('0x38')](_0x186887[_0x7a22('0x34')],_0x186887[_0x7a22('0x36')]);_0x25d7be[_0x7a22('0x39')]=_[_0x7a22('0x38')](_0x186887[_0x7a22('0x34')],qs[_0x7a22('0x3a')](_0x34c9e6[_0x7a22('0x36')][_0x7a22('0x3a')]));_0x25d7be[_0x7a22('0x39')]=_0x25d7be[_0x7a22('0x39')]['length']?_0x25d7be[_0x7a22('0x39')]:_0x186887[_0x7a22('0x34')];if(!_0x34c9e6[_0x7a22('0x36')][_0x7a22('0x3b')](_0x7a22('0x3c'))){_0x25d7be[_0x7a22('0x21')]=qs[_0x7a22('0x21')](_0x34c9e6[_0x7a22('0x36')]['limit']);_0x25d7be[_0x7a22('0x1f')]=qs['offset'](_0x34c9e6[_0x7a22('0x36')][_0x7a22('0x1f')]);}_0x25d7be[_0x7a22('0x3d')]=qs[_0x7a22('0x3e')](_0x34c9e6[_0x7a22('0x36')][_0x7a22('0x3e')]);_0x25d7be['where']=qs[_0x7a22('0x3f')](_[_0x7a22('0x40')](_0x34c9e6['query'],_0x186887[_0x7a22('0x3f')]),_0x46a512);if(_0x34c9e6[_0x7a22('0x36')][_0x7a22('0x41')]){_0x25d7be['where']=_[_0x7a22('0x42')](_0x25d7be[_0x7a22('0x43')],{'$or':_['map'](_0x46a512,function(_0x11d784){if(_0x11d784[_0x7a22('0x32')]!==_0x7a22('0x44')){var _0x1c51df={};_0x1c51df[_0x11d784[_0x7a22('0x35')]]={'$like':'%'+_0x34c9e6[_0x7a22('0x36')]['filter']+'%'};return _0x1c51df;}})});}_0x25d7be=_[_0x7a22('0x42')]({},_0x25d7be,_0x34c9e6['options']);var _0x150270={'where':_0x25d7be[_0x7a22('0x43')]};return db[_0x7a22('0x45')][_0x7a22('0x22')](_0x150270)[_0x7a22('0x27')](function(_0x56ddd7){_0x1c720f['count']=_0x56ddd7;if(_0x34c9e6[_0x7a22('0x36')][_0x7a22('0x46')]){_0x25d7be[_0x7a22('0x47')]=[{'all':!![]}];}return db[_0x7a22('0x45')][_0x7a22('0x48')](_0x25d7be);})[_0x7a22('0x27')](function(_0x280fb7){_0x1c720f[_0x7a22('0x49')]=_0x280fb7;return _0x1c720f;})['then'](respondWithFilteredResult(_0x3330bf,_0x25d7be))['catch'](handleError(_0x3330bf,null));};exports[_0x7a22('0x4a')]=function(_0x4a947e,_0xbf50a2){var _0x4e2fdf={'raw':!![],'where':{'id':_0x4a947e[_0x7a22('0x4b')]['id']}},_0x166d59={};_0x166d59[_0x7a22('0x34')]=_['keys'](db[_0x7a22('0x45')][_0x7a22('0x30')]);_0x166d59[_0x7a22('0x36')]=_[_0x7a22('0x37')](_0x4a947e[_0x7a22('0x36')]);_0x166d59[_0x7a22('0x3f')]=_['intersection'](_0x166d59[_0x7a22('0x34')],_0x166d59['query']);_0x4e2fdf['attributes']=_[_0x7a22('0x38')](_0x166d59[_0x7a22('0x34')],qs['fields'](_0x4a947e['query'][_0x7a22('0x3a')]));_0x4e2fdf[_0x7a22('0x39')]=_0x4e2fdf['attributes'][_0x7a22('0x4c')]?_0x4e2fdf[_0x7a22('0x39')]:_0x166d59['model'];if(_0x4a947e[_0x7a22('0x36')][_0x7a22('0x46')]){_0x4e2fdf[_0x7a22('0x47')]=[{'all':!![]}];}_0x4e2fdf=_[_0x7a22('0x42')]({},_0x4e2fdf,_0x4a947e[_0x7a22('0x4d')]);return db['Interval']['find'](_0x4e2fdf)[_0x7a22('0x27')](handleEntityNotFound(_0xbf50a2,null))['then'](respondWithResult(_0xbf50a2,null))[_0x7a22('0x4e')](handleError(_0xbf50a2,null));};exports[_0x7a22('0x4f')]=function(_0x2c2f1f,_0x4d86a0){return db['Interval']['create'](_0x2c2f1f[_0x7a22('0x50')],{})[_0x7a22('0x27')](function(_0x316985){var _0x10f21c=_0x2c2f1f[_0x7a22('0x51')]['get']({'plain':!![]});if(!_0x10f21c)throw new Error(_0x7a22('0x52'));if(_0x10f21c[_0x7a22('0x53')]===_0x7a22('0x51')){var _0x39bde1=_0x316985[_0x7a22('0x28')]({'plain':!![]});var _0x28ca48=_0x7a22('0x29');return db[_0x7a22('0x54')][_0x7a22('0x55')]({'where':{'name':_0x28ca48,'userProfileId':_0x10f21c['userProfileId']},'raw':!![]})['then'](function(_0x3bd270){if(_0x3bd270&&_0x3bd270[_0x7a22('0x56')]===0x0){return db[_0x7a22('0x57')]['create']({'name':_0x39bde1['name'],'resourceId':_0x39bde1['id'],'type':_0x3bd270[_0x7a22('0x35')],'sectionId':_0x3bd270['id']},{})[_0x7a22('0x27')](function(){return _0x316985;});}else{return _0x316985;}})[_0x7a22('0x4e')](function(_0x15b9b6){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x15b9b6);throw _0x15b9b6;});}return _0x316985;})[_0x7a22('0x27')](respondWithResult(_0x4d86a0,0xc9))['catch'](handleError(_0x4d86a0,null));};exports['update']=function(_0x481005,_0x29e8a8){if(_0x481005[_0x7a22('0x50')]['id']){delete _0x481005[_0x7a22('0x50')]['id'];}return db['Interval']['find']({'where':{'id':_0x481005['params']['id']}})[_0x7a22('0x27')](handleEntityNotFound(_0x29e8a8,null))[_0x7a22('0x27')](saveUpdates(_0x481005[_0x7a22('0x50')],null))[_0x7a22('0x27')](respondWithResult(_0x29e8a8,null))['catch'](handleError(_0x29e8a8,null));};exports[_0x7a22('0x2a')]=function(_0x390d0b,_0x3f10d6){return db[_0x7a22('0x45')][_0x7a22('0x55')]({'where':{'id':_0x390d0b[_0x7a22('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3f10d6,null))[_0x7a22('0x27')](removeEntity(_0x3f10d6,null))['catch'](handleError(_0x3f10d6,null));};exports[_0x7a22('0x58')]=function(_0x396d44,_0x86d4ba,_0x4a1ed5){if(_0x396d44[_0x7a22('0x50')]['id']){delete _0x396d44['body']['id'];}return db[_0x7a22('0x45')]['find']({'where':{'id':_0x396d44['params']['id']}})[_0x7a22('0x27')](handleEntityNotFound(_0x86d4ba,null))[_0x7a22('0x27')](function(_0x313686){if(_0x313686){_0x396d44['body'][_0x7a22('0x59')]=_0x313686['id'];return db[_0x7a22('0x45')][_0x7a22('0x4f')](_0x396d44[_0x7a22('0x50')]);}})[_0x7a22('0x27')](respondWithResult(_0x86d4ba,null))[_0x7a22('0x4e')](handleError(_0x86d4ba,null));};exports[_0x7a22('0x5a')]=function(_0x5845b1,_0x51acdd,_0x45bb8d){var _0x556de4={};var _0x4b6bfc={};var _0x5afb42;var _0x3f98f8;return db[_0x7a22('0x45')][_0x7a22('0x5b')]({'where':{'id':_0x5845b1[_0x7a22('0x4b')]['id']}})[_0x7a22('0x27')](handleEntityNotFound(_0x51acdd,null))[_0x7a22('0x27')](function(_0x533748){if(_0x533748){_0x5afb42=_0x533748;_0x4b6bfc['model']=_['keys'](db[_0x7a22('0x45')][_0x7a22('0x30')]);_0x4b6bfc['query']=_['keys'](_0x5845b1[_0x7a22('0x36')]);_0x4b6bfc[_0x7a22('0x3f')]=_[_0x7a22('0x38')](_0x4b6bfc[_0x7a22('0x34')],_0x4b6bfc[_0x7a22('0x36')]);_0x556de4['attributes']=_[_0x7a22('0x38')](_0x4b6bfc['model'],qs['fields'](_0x5845b1[_0x7a22('0x36')][_0x7a22('0x3a')]));_0x556de4[_0x7a22('0x39')]=_0x556de4['attributes']['length']?_0x556de4['attributes']:_0x4b6bfc[_0x7a22('0x34')];_0x556de4['order']=qs[_0x7a22('0x3e')](_0x5845b1[_0x7a22('0x36')][_0x7a22('0x3e')]);_0x556de4[_0x7a22('0x43')]=qs[_0x7a22('0x3f')](_['pick'](_0x5845b1[_0x7a22('0x36')],_0x4b6bfc['filters']));if(_0x5845b1[_0x7a22('0x36')][_0x7a22('0x41')]){_0x556de4['where']=_[_0x7a22('0x42')](_0x556de4[_0x7a22('0x43')],{'$or':_[_0x7a22('0x2f')](_0x556de4[_0x7a22('0x39')],function(_0x98da3b){var _0x65f6f3={};_0x65f6f3[_0x98da3b]={'$like':'%'+_0x5845b1[_0x7a22('0x36')][_0x7a22('0x41')]+'%'};return _0x65f6f3;})});}_0x556de4=_['merge']({},_0x556de4,_0x5845b1['options']);return _0x5afb42[_0x7a22('0x5a')](_0x556de4);}})[_0x7a22('0x27')](function(_0x4760bd){if(_0x4760bd){_0x3f98f8=_0x4760bd[_0x7a22('0x4c')];if(!_0x5845b1['query'][_0x7a22('0x3b')](_0x7a22('0x3c'))){_0x556de4[_0x7a22('0x21')]=qs['limit'](_0x5845b1[_0x7a22('0x36')][_0x7a22('0x21')]);_0x556de4[_0x7a22('0x1f')]=qs['offset'](_0x5845b1['query'][_0x7a22('0x1f')]);}return _0x5afb42[_0x7a22('0x5a')](_0x556de4);}})['then'](function(_0x15431d){if(_0x15431d){return _0x15431d?{'count':_0x3f98f8,'rows':_0x15431d}:null;}})[_0x7a22('0x27')](respondWithResult(_0x51acdd,null))[_0x7a22('0x4e')](handleError(_0x51acdd,null));};exports[_0x7a22('0x5c')]=function(_0xff1e51,_0x116c19,_0x35cfc6){return db[_0x7a22('0x45')]['findOne']({'where':{'id':_0xff1e51[_0x7a22('0x4b')]['id']}})[_0x7a22('0x27')](handleEntityNotFound(_0x116c19,null))[_0x7a22('0x27')](function(_0xb0e9e4){if(_0xb0e9e4){return db['sequelize'][_0x7a22('0x5d')](function(_0x453141){return db[_0x7a22('0x45')][_0x7a22('0x2a')]({'where':{'IntervalId':_0xff1e51[_0x7a22('0x4b')]['id']},'transaction':_0x453141})[_0x7a22('0x27')](function(_0x350f35){var _0x29e57c=_[_0x7a22('0x2f')](_0xff1e51['body'],function(_0x41748e){delete _0x41748e['id'];_0x41748e[_0x7a22('0x59')]=_0xff1e51[_0x7a22('0x4b')]['id'];return _0x41748e;});return db[_0x7a22('0x45')][_0x7a22('0x5e')](_0x29e57c,{'transaction':_0x453141});});})[_0x7a22('0x27')](function(){return db[_0x7a22('0x45')]['findAll']({'where':{'IntervalId':_0xff1e51[_0x7a22('0x4b')]['id']}});});}})[_0x7a22('0x27')](respondWithResult(_0x116c19,null))[_0x7a22('0x4e')](handleError(_0x116c19,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index bef9683..4602502 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 _0xcac3=['Interval','tools_intervals','rewrite','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./interval.attributes','../../components/extensions/rewrite','exports','define'];(function(_0x331bd7,_0x452028){var _0x5d025b=function(_0x39328e){while(--_0x39328e){_0x331bd7['push'](_0x331bd7['shift']());}};_0x5d025b(++_0x452028);}(_0xcac3,0x193));var _0x3cac=function(_0x47c53e,_0x35f7f3){_0x47c53e=_0x47c53e-0x0;var _0x306afd=_0xcac3[_0x47c53e];return _0x306afd;};'use strict';var _=require('lodash');var util=require(_0x3cac('0x0'));var logger=require(_0x3cac('0x1'))(_0x3cac('0x2'));var moment=require(_0x3cac('0x3'));var BPromise=require(_0x3cac('0x4'));var rp=require(_0x3cac('0x5'));var fs=require('fs');var path=require(_0x3cac('0x6'));var rimraf=require(_0x3cac('0x7'));var config=require(_0x3cac('0x8'));var attributes=require(_0x3cac('0x9'));var extensions=require(_0x3cac('0xa'));module[_0x3cac('0xb')]=function(_0x35c687,_0x1e2560){return _0x35c687[_0x3cac('0xc')](_0x3cac('0xd'),attributes,{'tableName':_0x3cac('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x55670d,_0x3cbf8d){extensions[_0x3cac('0xf')](_0x35c687,_0x55670d);},'afterBulkCreate':function(_0x3bcbed,_0x306664,_0x131e0d){_0x131e0d();extensions['rewrite'](_0x35c687,_0x3bcbed[0x0]);},'afterUpdate':function(_0x1e8fef,_0x169e39){extensions[_0x3cac('0xf')](_0x35c687,_0x1e8fef);},'afterDestroy':function(_0x2fa907,_0x1c5c70){extensions['rewrite'](_0x35c687,_0x2fa907);}}});}; \ No newline at end of file +var _0x94e7=['exports','Interval','tools_intervals','rewrite','util','../../config/logger','bluebird','request-promise','path','../../config/environment','./interval.attributes','../../components/extensions/rewrite'];(function(_0x3a8dc1,_0x2f03b8){var _0x4b3595=function(_0x1c19e7){while(--_0x1c19e7){_0x3a8dc1['push'](_0x3a8dc1['shift']());}};_0x4b3595(++_0x2f03b8);}(_0x94e7,0x7c));var _0x794e=function(_0xe8a98d,_0xd2293b){_0xe8a98d=_0xe8a98d-0x0;var _0x26f82a=_0x94e7[_0xe8a98d];return _0x26f82a;};'use strict';var _=require('lodash');var util=require(_0x794e('0x0'));var logger=require(_0x794e('0x1'))('api');var moment=require('moment');var BPromise=require(_0x794e('0x2'));var rp=require(_0x794e('0x3'));var fs=require('fs');var path=require(_0x794e('0x4'));var rimraf=require('rimraf');var config=require(_0x794e('0x5'));var attributes=require(_0x794e('0x6'));var extensions=require(_0x794e('0x7'));module[_0x794e('0x8')]=function(_0x2116a6,_0x307e36){return _0x2116a6['define'](_0x794e('0x9'),attributes,{'tableName':_0x794e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5db7d8,_0x3db399){extensions['rewrite'](_0x2116a6,_0x5db7d8);},'afterBulkCreate':function(_0xb64b4a,_0x513953,_0x359835){_0x359835();extensions[_0x794e('0xb')](_0x2116a6,_0xb64b4a[0x0]);},'afterUpdate':function(_0x69b4fb,_0x32fd9){extensions[_0x794e('0xb')](_0x2116a6,_0x69b4fb);},'afterDestroy':function(_0x8055c3,_0x3875a0){extensions[_0x794e('0xb')](_0x2116a6,_0x8055c3);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 394bf90..bb1d5ae 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(_0x202d24,_0x5e8641){var _0x2b3a8e=function(_0x4c7c4a){while(--_0x4c7c4a){_0x202d24['push'](_0x202d24['shift']());}};_0x2b3a8e(++_0x5e8641);}(_0xa9e0,0x123));var _0x0a9e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xa9e0[_0x49ca18];return _0x145d54;};'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(_0x5ef905,_0x564b87){var _0x367808=function(_0x14f487){while(--_0x14f487){_0x5ef905['push'](_0x5ef905['shift']());}};_0x367808(++_0x564b87);}(_0xa9e0,0x123));var _0x0a9e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa9e0[_0x31e29a];return _0x32d892;};'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 d71737b..54bd899 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 _0x2ef3=['./jira.controller','post','isAuthenticated','exports','express','Router','../../components/auth/service'];(function(_0x1969f4,_0x533bc3){var _0x1fc47b=function(_0x115a5b){while(--_0x115a5b){_0x1969f4['push'](_0x1969f4['shift']());}};_0x1fc47b(++_0x533bc3);}(_0x2ef3,0xba));var _0x32ef=function(_0x243829,_0x53a2db){_0x243829=_0x243829-0x0;var _0x452490=_0x2ef3[_0x243829];return _0x452490;};'use strict';var express=require(_0x32ef('0x0'));var router=express[_0x32ef('0x1')]();var auth=require(_0x32ef('0x2'));var controller=require(_0x32ef('0x3'));router[_0x32ef('0x4')]('/',auth[_0x32ef('0x5')](),controller['send']);module[_0x32ef('0x6')]=router; \ No newline at end of file +var _0x5f2f=['isAuthenticated','send','exports','express','Router','../../components/auth/service','./jira.controller','post'];(function(_0x14019a,_0x3dc483){var _0x34fe8e=function(_0x3d8f62){while(--_0x3d8f62){_0x14019a['push'](_0x14019a['shift']());}};_0x34fe8e(++_0x3dc483);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1c7d0d,_0x573610){_0x1c7d0d=_0x1c7d0d-0x0;var _0x36b5e6=_0x5f2f[_0x1c7d0d];return _0x36b5e6;};'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 ec127aa..51479d1 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 _0xfb3d=['../../config/logger','api','support','3eAmWpBVP0','key','MOTGUI','summary','Report','\x20from\x20','description','stringify','issuetype','Bug','fields','customfield_11500','email','customfield_11501','oldToken','newToken','name','reason','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','toString','base64','request','setEncoding','utf8','data','end','status','json','parse','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','write','send','body','x-forwarded-for','connection','remoteAddress','socket','bluebird','https'];(function(_0x1e5324,_0x7f93b5){var _0x45e348=function(_0x3e607b){while(--_0x3e607b){_0x1e5324['push'](_0x1e5324['shift']());}};_0x45e348(++_0x7f93b5);}(_0xfb3d,0x19c));var _0xdfb3=function(_0x50e63a,_0x564f77){_0x50e63a=_0x50e63a-0x0;var _0x534f37=_0xfb3d[_0x50e63a];return _0x534f37;};'use strict';var BPromise=require(_0xdfb3('0x0'));var https=require(_0xdfb3('0x1'));var logger=require(_0xdfb3('0x2'))(_0xdfb3('0x3'));var USERNAME=_0xdfb3('0x4');var PASSWORD=_0xdfb3('0x5');function openIssue(_0x29cc65,_0x460634){var _0x32d026={'fields':{'project':{'key':_0x29cc65[_0xdfb3('0x6')]||_0xdfb3('0x7')},'summary':(_0x29cc65[_0xdfb3('0x8')]||_0xdfb3('0x9'))+_0xdfb3('0xa')+_0x29cc65['ip'],'description':_0x29cc65[_0xdfb3('0xb')]||JSON[_0xdfb3('0xc')](_0x29cc65),'issuetype':{'name':_0x29cc65[_0xdfb3('0xd')]||_0xdfb3('0xe')}}};_0x32d026[_0xdfb3('0xf')][_0xdfb3('0x10')]=_0x29cc65[_0xdfb3('0x11')];_0x32d026[_0xdfb3('0xf')][_0xdfb3('0x12')]=_0x29cc65[_0xdfb3('0x13')];_0x32d026['fields']['customfield_11502']=_0x29cc65[_0xdfb3('0x14')];_0x32d026['fields']['customfield_11503']=_0x29cc65[_0xdfb3('0x15')];_0x32d026[_0xdfb3('0xf')]['customfield_11504']=_0x29cc65[_0xdfb3('0x16')];_0x32d026[_0xdfb3('0xf')]['customfield_10102']=_0x29cc65['ip'];var _0x484065={'host':_0xdfb3('0x17'),'port':0x1bb,'path':_0xdfb3('0x18'),'method':_0xdfb3('0x19'),'timeout':0x4e20,'headers':{'Content-Type':_0xdfb3('0x1a'),'Authorization':_0xdfb3('0x1b')+new Buffer(USERNAME+':'+PASSWORD)[_0xdfb3('0x1c')](_0xdfb3('0x1d'))}};var _0x2e03e5=JSON['stringify'](_0x32d026);var _0x2e8618=https[_0xdfb3('0x1e')](_0x484065,function(_0x39bc24){_0x39bc24[_0xdfb3('0x1f')](_0xdfb3('0x20'));var _0x644d52='';_0x39bc24['on'](_0xdfb3('0x21'),function(_0x485895){_0x644d52+=_0x485895;});_0x39bc24['on'](_0xdfb3('0x22'),function(){if(_0x460634){return _0x460634[_0xdfb3('0x23')](_0x39bc24['statusCode'])[_0xdfb3('0x24')](JSON[_0xdfb3('0x25')](_0x644d52));}});});_0x2e8618['on']('error',function(_0x1b976d){if(_0x460634){return _0x460634['status'](0x1f4)[_0xdfb3('0x24')]({'errors':[{'message':_0xdfb3('0x26'),'type':'api.jira'}]});}});_0x2e8618[_0xdfb3('0x27')](_0x2e03e5);_0x2e8618['end']();}exports['openIssue']=openIssue;exports[_0xdfb3('0x28')]=function(_0x1a9b85,_0x2ad6a1){_0x1a9b85[_0xdfb3('0x29')]['ip']=_0x1a9b85['headers'][_0xdfb3('0x2a')]||_0x1a9b85[_0xdfb3('0x2b')][_0xdfb3('0x2c')]||_0x1a9b85[_0xdfb3('0x2d')][_0xdfb3('0x2c')]||_0x1a9b85[_0xdfb3('0x2b')][_0xdfb3('0x2d')][_0xdfb3('0x2c')];return openIssue(_0x1a9b85[_0xdfb3('0x29')],_0x2ad6a1);}; \ No newline at end of file +var _0x8f8f=['end','status','statusCode','json','parse','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','write','openIssue','send','body','headers','remoteAddress','connection','socket','https','api','support','3eAmWpBVP0','key','MOTGUI','Report','\x20from\x20','description','stringify','issuetype','Bug','fields','email','customfield_11501','oldToken','customfield_11502','newToken','customfield_11503','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','POST','application/json','base64','setEncoding','utf8','data'];(function(_0x1f1511,_0x4ea911){var _0x1d9ab8=function(_0x53276a){while(--_0x53276a){_0x1f1511['push'](_0x1f1511['shift']());}};_0x1d9ab8(++_0x4ea911);}(_0x8f8f,0x92));var _0xf8f8=function(_0x4e00cc,_0x22e12c){_0x4e00cc=_0x4e00cc-0x0;var _0x501e11=_0x8f8f[_0x4e00cc];return _0x501e11;};'use strict';var BPromise=require('bluebird');var https=require(_0xf8f8('0x0'));var logger=require('../../config/logger')(_0xf8f8('0x1'));var USERNAME=_0xf8f8('0x2');var PASSWORD=_0xf8f8('0x3');function openIssue(_0x2d9c5b,_0x4e6b14){var _0x4eca61={'fields':{'project':{'key':_0x2d9c5b[_0xf8f8('0x4')]||_0xf8f8('0x5')},'summary':(_0x2d9c5b['summary']||_0xf8f8('0x6'))+_0xf8f8('0x7')+_0x2d9c5b['ip'],'description':_0x2d9c5b[_0xf8f8('0x8')]||JSON[_0xf8f8('0x9')](_0x2d9c5b),'issuetype':{'name':_0x2d9c5b[_0xf8f8('0xa')]||_0xf8f8('0xb')}}};_0x4eca61[_0xf8f8('0xc')]['customfield_11500']=_0x2d9c5b[_0xf8f8('0xd')];_0x4eca61[_0xf8f8('0xc')][_0xf8f8('0xe')]=_0x2d9c5b[_0xf8f8('0xf')];_0x4eca61['fields'][_0xf8f8('0x10')]=_0x2d9c5b[_0xf8f8('0x11')];_0x4eca61[_0xf8f8('0xc')][_0xf8f8('0x12')]=_0x2d9c5b[_0xf8f8('0x13')];_0x4eca61['fields'][_0xf8f8('0x14')]=_0x2d9c5b[_0xf8f8('0x15')];_0x4eca61[_0xf8f8('0xc')][_0xf8f8('0x16')]=_0x2d9c5b['ip'];var _0x364e78={'host':_0xf8f8('0x17'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0xf8f8('0x18'),'timeout':0x4e20,'headers':{'Content-Type':_0xf8f8('0x19'),'Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)['toString'](_0xf8f8('0x1a'))}};var _0x40ddd7=JSON['stringify'](_0x4eca61);var _0x1a87a8=https['request'](_0x364e78,function(_0x4917cb){_0x4917cb[_0xf8f8('0x1b')](_0xf8f8('0x1c'));var _0x3971ad='';_0x4917cb['on'](_0xf8f8('0x1d'),function(_0x327dfb){_0x3971ad+=_0x327dfb;});_0x4917cb['on'](_0xf8f8('0x1e'),function(){if(_0x4e6b14){return _0x4e6b14[_0xf8f8('0x1f')](_0x4917cb[_0xf8f8('0x20')])[_0xf8f8('0x21')](JSON[_0xf8f8('0x22')](_0x3971ad));}});});_0x1a87a8['on']('error',function(_0x33a458){if(_0x4e6b14){return _0x4e6b14['status'](0x1f4)[_0xf8f8('0x21')]({'errors':[{'message':_0xf8f8('0x23'),'type':'api.jira'}]});}});_0x1a87a8[_0xf8f8('0x24')](_0x40ddd7);_0x1a87a8[_0xf8f8('0x1e')]();}exports[_0xf8f8('0x25')]=openIssue;exports[_0xf8f8('0x26')]=function(_0x2a206e,_0x51a41a){_0x2a206e[_0xf8f8('0x27')]['ip']=_0x2a206e[_0xf8f8('0x28')]['x-forwarded-for']||_0x2a206e['connection'][_0xf8f8('0x29')]||_0x2a206e['socket'][_0xf8f8('0x29')]||_0x2a206e[_0xf8f8('0x2a')][_0xf8f8('0x2b')][_0xf8f8('0x29')];return openIssue(_0x2a206e[_0xf8f8('0x27')],_0x51a41a);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 3d16b5f..da5d5e7 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 _0x0bb5=['describe','show','post','put','/:id','update','delete','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','/describe','isAuthenticated'];(function(_0x3213bf,_0x1c32b6){var _0x1a62a9=function(_0x51edc8){while(--_0x51edc8){_0x3213bf['push'](_0x3213bf['shift']());}};_0x1a62a9(++_0x1c32b6);}(_0x0bb5,0x148));var _0x50bb=function(_0x4fd23c,_0x5b911e){_0x4fd23c=_0x4fd23c-0x0;var _0x24462f=_0x0bb5[_0x4fd23c];return _0x24462f;};'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',auth[_0x50bb('0xb')](),controller[_0x50bb('0xd')]);router[_0x50bb('0xe')]('/',auth[_0x50bb('0xb')](),controller['create']);router[_0x50bb('0xf')](_0x50bb('0x10'),auth[_0x50bb('0xb')](),controller[_0x50bb('0x11')]);router[_0x50bb('0x12')](_0x50bb('0x10'),auth[_0x50bb('0xb')](),controller['destroy']);module[_0x50bb('0x13')]=router; \ No newline at end of file +var _0xfd28=['show','put','delete','destroy','exports','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','get','isAuthenticated','index','describe','/:id'];(function(_0x5abb00,_0x342d70){var _0xf9b854=function(_0x43ac30){while(--_0x43ac30){_0x5abb00['push'](_0x5abb00['shift']());}};_0xf9b854(++_0x342d70);}(_0xfd28,0x148));var _0x8fd2=function(_0x31b5a5,_0x44376a){_0x31b5a5=_0x31b5a5-0x0;var _0x364cc9=_0xfd28[_0x31b5a5];return _0x364cc9;};'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')]('/describe',auth['isAuthenticated'](),controller[_0x8fd2('0xa')]);router[_0x8fd2('0x7')](_0x8fd2('0xb'),auth['isAuthenticated'](),controller[_0x8fd2('0xc')]);router['post']('/',auth[_0x8fd2('0x8')](),controller['create']);router[_0x8fd2('0xd')]('/:id',auth[_0x8fd2('0x8')](),controller['update']);router[_0x8fd2('0xe')]('/:id',auth[_0x8fd2('0x8')](),controller[_0x8fd2('0xf')]);module[_0x8fd2('0x10')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 2ed033d..c6caa02 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(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x7a54,0x106));var _0x47a5=function(_0x56538d,_0x382c90){_0x56538d=_0x56538d-0x0;var _0x258281=_0x7a54[_0x56538d];return _0x258281;};'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(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x7a54,0x106));var _0x47a5=function(_0x1e9a26,_0x1347f2){_0x1e9a26=_0x1e9a26-0x0;var _0x565384=_0x7a54[_0x1e9a26];return _0x565384;};'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 6ab166c..5f295e8 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 _0x565f=['JscriptyAnswerReport','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','filters','filter','merge','where','count','include','findAll','rows','catch','params','includeAll','create','body','find','describe','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','fs-extra','squel','crypto','jsforce','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','set','apply','reject','update','then','destroy','error','stack','name','send','index','map'];(function(_0x541ff1,_0x423d89){var _0x3f6f=function(_0x15b160){while(--_0x15b160){_0x541ff1['push'](_0x541ff1['shift']());}};_0x3f6f(++_0x423d89);}(_0x565f,0x68));var _0xf565=function(_0x2a82d3,_0x3d708d){_0x2a82d3=_0x2a82d3-0x0;var _0x46396b=_0x565f[_0x2a82d3];return _0x46396b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf565('0x0'));var zipdir=require(_0xf565('0x1'));var jsonpatch=require(_0xf565('0x2'));var rp=require('request-promise');var moment=require(_0xf565('0x3'));var BPromise=require(_0xf565('0x4'));var Mustache=require(_0xf565('0x5'));var util=require(_0xf565('0x6'));var path=require(_0xf565('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf565('0x8'));var _=require('lodash');var squel=require(_0xf565('0x9'));var crypto=require(_0xf565('0xa'));var jsforce=require(_0xf565('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xf565('0xc'));var querystring=require('querystring');var Papa=require(_0xf565('0xd'));var Redis=require('ioredis');var authService=require(_0xf565('0xe'));var qs=require(_0xf565('0xf'));var as=require(_0xf565('0x10'));var hardwareService=require(_0xf565('0x11'));var logger=require(_0xf565('0x12'))(_0xf565('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf565('0x14'));var db=require(_0xf565('0x15'))['db'];function respondWithStatusCode(_0xd29dae,_0xb66e55){_0xb66e55=_0xb66e55||0xcc;return function(_0xa56a8b){if(_0xa56a8b){return _0xd29dae[_0xf565('0x16')](_0xb66e55);}return _0xd29dae[_0xf565('0x17')](_0xb66e55)[_0xf565('0x18')]();};}function respondWithResult(_0x3b7abc,_0x366ac2){_0x366ac2=_0x366ac2||0xc8;return function(_0x4f926d){if(_0x4f926d){return _0x3b7abc[_0xf565('0x17')](_0x366ac2)[_0xf565('0x19')](_0x4f926d);}};}function respondWithFilteredResult(_0x4c209f,_0x394e33){return function(_0x2cd6a8){if(_0x2cd6a8){var _0x468d80=typeof _0x394e33[_0xf565('0x1a')]===_0xf565('0x1b')&&typeof _0x394e33['limit']===_0xf565('0x1b');var _0x4e7abb=_0x2cd6a8['count'];var _0x3d0412=_0x468d80?0x0:_0x394e33[_0xf565('0x1a')];var _0x4fb154=_0x468d80?_0x2cd6a8['count']:_0x394e33[_0xf565('0x1a')]+_0x394e33['limit'];var _0x248111;if(_0x4fb154>=_0x4e7abb){_0x4fb154=_0x4e7abb;_0x248111=0xc8;}else{_0x248111=0xce;}_0x4c209f[_0xf565('0x17')](_0x248111);return _0x4c209f[_0xf565('0x1c')]('Content-Range',_0x3d0412+'-'+_0x4fb154+'/'+_0x4e7abb)['json'](_0x2cd6a8);}return null;};}function patchUpdates(_0xb7b197){return function(_0x3a8a09){try{jsonpatch[_0xf565('0x1d')](_0x3a8a09,_0xb7b197,!![]);}catch(_0x4114d0){return BPromise[_0xf565('0x1e')](_0x4114d0);}return _0x3a8a09['save']();};}function saveUpdates(_0x436a7d,_0x24aa90){return function(_0x282f3a){if(_0x282f3a){return _0x282f3a[_0xf565('0x1f')](_0x436a7d)[_0xf565('0x20')](function(_0x2c67a6){return _0x2c67a6;});}return null;};}function removeEntity(_0xe23d61,_0x139915){return function(_0x11d948){if(_0x11d948){return _0x11d948[_0xf565('0x21')]()['then'](function(){_0xe23d61[_0xf565('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x46da9b,_0x2df868){return function(_0x50da32){if(!_0x50da32){_0x46da9b[_0xf565('0x16')](0x194);}return _0x50da32;};}function handleError(_0xe06651,_0x2e8f6b){_0x2e8f6b=_0x2e8f6b||0x1f4;return function(_0x33e81c){logger[_0xf565('0x22')](_0x33e81c[_0xf565('0x23')]);if(_0x33e81c[_0xf565('0x24')]){delete _0x33e81c[_0xf565('0x24')];}_0xe06651['status'](_0x2e8f6b)[_0xf565('0x25')](_0x33e81c);};}exports[_0xf565('0x26')]=function(_0x18082a,_0x2e41e7){var _0x28f75d={},_0x5ecd01={},_0x2288db={'count':0x0,'rows':[]};var _0x2ce91d=_[_0xf565('0x27')](db[_0xf565('0x28')][_0xf565('0x29')],function(_0x5a292c){return{'name':_0x5a292c[_0xf565('0x2a')],'type':_0x5a292c[_0xf565('0x2b')][_0xf565('0x2c')]};});_0x5ecd01[_0xf565('0x2d')]=_[_0xf565('0x27')](_0x2ce91d,_0xf565('0x24'));_0x5ecd01['query']=_[_0xf565('0x2e')](_0x18082a[_0xf565('0x2f')]);_0x5ecd01['filters']=_[_0xf565('0x30')](_0x5ecd01[_0xf565('0x2d')],_0x5ecd01[_0xf565('0x2f')]);_0x28f75d[_0xf565('0x31')]=_[_0xf565('0x30')](_0x5ecd01[_0xf565('0x2d')],qs[_0xf565('0x32')](_0x18082a[_0xf565('0x2f')]['fields']));_0x28f75d[_0xf565('0x31')]=_0x28f75d[_0xf565('0x31')][_0xf565('0x33')]?_0x28f75d['attributes']:_0x5ecd01[_0xf565('0x2d')];if(!_0x18082a[_0xf565('0x2f')][_0xf565('0x34')](_0xf565('0x35'))){_0x28f75d[_0xf565('0x36')]=qs['limit'](_0x18082a[_0xf565('0x2f')]['limit']);_0x28f75d[_0xf565('0x1a')]=qs[_0xf565('0x1a')](_0x18082a['query']['offset']);}_0x28f75d[_0xf565('0x37')]=qs[_0xf565('0x38')](_0x18082a['query'][_0xf565('0x38')]);_0x28f75d['where']=qs['filters'](_['pick'](_0x18082a['query'],_0x5ecd01[_0xf565('0x39')]),_0x2ce91d);if(_0x18082a[_0xf565('0x2f')][_0xf565('0x3a')]){_0x28f75d['where']=_[_0xf565('0x3b')](_0x28f75d[_0xf565('0x3c')],{'$or':_[_0xf565('0x27')](_0x2ce91d,function(_0x5e6c27){if(_0x5e6c27[_0xf565('0x2b')]!=='VIRTUAL'){var _0x2d09fb={};_0x2d09fb[_0x5e6c27[_0xf565('0x24')]]={'$like':'%'+_0x18082a[_0xf565('0x2f')]['filter']+'%'};return _0x2d09fb;}})});}_0x28f75d=_[_0xf565('0x3b')]({},_0x28f75d,_0x18082a['options']);var _0x1da55c={'where':_0x28f75d['where']};return db[_0xf565('0x28')][_0xf565('0x3d')](_0x1da55c)['then'](function(_0x36d030){_0x2288db[_0xf565('0x3d')]=_0x36d030;if(_0x18082a[_0xf565('0x2f')]['includeAll']){_0x28f75d[_0xf565('0x3e')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0xf565('0x3f')](_0x28f75d);})[_0xf565('0x20')](function(_0x3c43ff){_0x2288db[_0xf565('0x40')]=_0x3c43ff;return _0x2288db;})[_0xf565('0x20')](respondWithFilteredResult(_0x2e41e7,_0x28f75d))[_0xf565('0x41')](handleError(_0x2e41e7,null));};exports['show']=function(_0x58cea5,_0x42ebdd){var _0x27cc58={'raw':!![],'where':{'id':_0x58cea5[_0xf565('0x42')]['id']}},_0x40920b={};_0x40920b[_0xf565('0x2d')]=_['keys'](db[_0xf565('0x28')][_0xf565('0x29')]);_0x40920b[_0xf565('0x2f')]=_[_0xf565('0x2e')](_0x58cea5['query']);_0x40920b[_0xf565('0x39')]=_['intersection'](_0x40920b['model'],_0x40920b[_0xf565('0x2f')]);_0x27cc58[_0xf565('0x31')]=_['intersection'](_0x40920b['model'],qs['fields'](_0x58cea5[_0xf565('0x2f')][_0xf565('0x32')]));_0x27cc58[_0xf565('0x31')]=_0x27cc58[_0xf565('0x31')][_0xf565('0x33')]?_0x27cc58[_0xf565('0x31')]:_0x40920b[_0xf565('0x2d')];if(_0x58cea5[_0xf565('0x2f')][_0xf565('0x43')]){_0x27cc58[_0xf565('0x3e')]=[{'all':!![]}];}_0x27cc58=_[_0xf565('0x3b')]({},_0x27cc58,_0x58cea5['options']);return db['JscriptyAnswerReport']['find'](_0x27cc58)[_0xf565('0x20')](handleEntityNotFound(_0x42ebdd,null))[_0xf565('0x20')](respondWithResult(_0x42ebdd,null))[_0xf565('0x41')](handleError(_0x42ebdd,null));};exports['create']=function(_0x4ded10,_0xfd4b53){return db[_0xf565('0x28')][_0xf565('0x44')](_0x4ded10['body'],{})[_0xf565('0x20')](respondWithResult(_0xfd4b53,0xc9))[_0xf565('0x41')](handleError(_0xfd4b53,null));};exports[_0xf565('0x1f')]=function(_0x483632,_0x5b6cbb){if(_0x483632[_0xf565('0x45')]['id']){delete _0x483632['body']['id'];}return db[_0xf565('0x28')][_0xf565('0x46')]({'where':{'id':_0x483632[_0xf565('0x42')]['id']}})[_0xf565('0x20')](handleEntityNotFound(_0x5b6cbb,null))[_0xf565('0x20')](saveUpdates(_0x483632[_0xf565('0x45')],null))[_0xf565('0x20')](respondWithResult(_0x5b6cbb,null))[_0xf565('0x41')](handleError(_0x5b6cbb,null));};exports[_0xf565('0x21')]=function(_0x1a3751,_0x47464e){return db[_0xf565('0x28')][_0xf565('0x46')]({'where':{'id':_0x1a3751[_0xf565('0x42')]['id']}})['then'](handleEntityNotFound(_0x47464e,null))['then'](removeEntity(_0x47464e,null))[_0xf565('0x41')](handleError(_0x47464e,null));};exports[_0xf565('0x47')]=function(_0x567c8e,_0x186f3e){return db[_0xf565('0x28')]['describe']()['then'](respondWithResult(_0x186f3e,null))[_0xf565('0x41')](handleError(_0x186f3e,null));}; \ No newline at end of file +var _0xac9d=['fields','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','merge','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name','index','map','JscriptyAnswerReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xac9d,0x14d));var _0xdac9=function(_0x1a27f3,_0x1c082d){_0x1a27f3=_0x1a27f3-0x0;var _0x3ce222=_0xac9d[_0x1a27f3];return _0x3ce222;};'use strict';var emlformat=require(_0xdac9('0x0'));var rimraf=require(_0xdac9('0x1'));var zipdir=require(_0xdac9('0x2'));var jsonpatch=require(_0xdac9('0x3'));var rp=require(_0xdac9('0x4'));var moment=require(_0xdac9('0x5'));var BPromise=require(_0xdac9('0x6'));var Mustache=require(_0xdac9('0x7'));var util=require('util');var path=require(_0xdac9('0x8'));var sox=require('sox');var csv=require(_0xdac9('0x9'));var ejs=require(_0xdac9('0xa'));var fs=require('fs');var fs_extra=require(_0xdac9('0xb'));var _=require(_0xdac9('0xc'));var squel=require(_0xdac9('0xd'));var crypto=require(_0xdac9('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xdac9('0xf'));var toCsv=require('to-csv');var querystring=require(_0xdac9('0x10'));var Papa=require(_0xdac9('0x11'));var Redis=require(_0xdac9('0x12'));var authService=require(_0xdac9('0x13'));var qs=require(_0xdac9('0x14'));var as=require(_0xdac9('0x15'));var hardwareService=require(_0xdac9('0x16'));var logger=require(_0xdac9('0x17'))(_0xdac9('0x18'));var utils=require('../../config/utils');var config=require(_0xdac9('0x19'));var licenseUtil=require(_0xdac9('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3d8e97,_0xeddbc1){_0xeddbc1=_0xeddbc1||0xcc;return function(_0xbfe6d8){if(_0xbfe6d8){return _0x3d8e97['sendStatus'](_0xeddbc1);}return _0x3d8e97[_0xdac9('0x1b')](_0xeddbc1)[_0xdac9('0x1c')]();};}function respondWithResult(_0x9e1bf6,_0x5f0bbd){_0x5f0bbd=_0x5f0bbd||0xc8;return function(_0x5dd536){if(_0x5dd536){return _0x9e1bf6[_0xdac9('0x1b')](_0x5f0bbd)[_0xdac9('0x1d')](_0x5dd536);}};}function respondWithFilteredResult(_0x50f9fe,_0x76af7a){return function(_0x36cbe4){if(_0x36cbe4){var _0x152ea5=typeof _0x76af7a[_0xdac9('0x1e')]===_0xdac9('0x1f')&&typeof _0x76af7a[_0xdac9('0x20')]===_0xdac9('0x1f');var _0xec1016=_0x36cbe4['count'];var _0x283343=_0x152ea5?0x0:_0x76af7a[_0xdac9('0x1e')];var _0x571e07=_0x152ea5?_0x36cbe4[_0xdac9('0x21')]:_0x76af7a[_0xdac9('0x1e')]+_0x76af7a[_0xdac9('0x20')];var _0x181d11;if(_0x571e07>=_0xec1016){_0x571e07=_0xec1016;_0x181d11=0xc8;}else{_0x181d11=0xce;}_0x50f9fe['status'](_0x181d11);return _0x50f9fe['set'](_0xdac9('0x22'),_0x283343+'-'+_0x571e07+'/'+_0xec1016)[_0xdac9('0x1d')](_0x36cbe4);}return null;};}function patchUpdates(_0x2b9d91){return function(_0x395ec7){try{jsonpatch['apply'](_0x395ec7,_0x2b9d91,!![]);}catch(_0x23ee5e){return BPromise[_0xdac9('0x23')](_0x23ee5e);}return _0x395ec7[_0xdac9('0x24')]();};}function saveUpdates(_0xae680a,_0xe7bd10){return function(_0x42317c){if(_0x42317c){return _0x42317c[_0xdac9('0x25')](_0xae680a)[_0xdac9('0x26')](function(_0x419f0c){return _0x419f0c;});}return null;};}function removeEntity(_0x33de5c,_0x5a0fa2){return function(_0x2943f5){if(_0x2943f5){return _0x2943f5[_0xdac9('0x27')]()[_0xdac9('0x26')](function(){_0x33de5c[_0xdac9('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e631a,_0x5686db){return function(_0x3ce475){if(!_0x3ce475){_0x1e631a[_0xdac9('0x28')](0x194);}return _0x3ce475;};}function handleError(_0x566d8c,_0x433be9){_0x433be9=_0x433be9||0x1f4;return function(_0x5105f1){logger[_0xdac9('0x29')](_0x5105f1[_0xdac9('0x2a')]);if(_0x5105f1[_0xdac9('0x2b')]){delete _0x5105f1[_0xdac9('0x2b')];}_0x566d8c['status'](_0x433be9)['send'](_0x5105f1);};}exports[_0xdac9('0x2c')]=function(_0x170afd,_0x4fe3bd){var _0x4c4e21={},_0x3eed7a={},_0x3505c5={'count':0x0,'rows':[]};var _0x13efba=_[_0xdac9('0x2d')](db[_0xdac9('0x2e')][_0xdac9('0x2f')],function(_0xed99f9){return{'name':_0xed99f9[_0xdac9('0x30')],'type':_0xed99f9[_0xdac9('0x31')][_0xdac9('0x32')]};});_0x3eed7a[_0xdac9('0x33')]=_[_0xdac9('0x2d')](_0x13efba,_0xdac9('0x2b'));_0x3eed7a[_0xdac9('0x34')]=_[_0xdac9('0x35')](_0x170afd[_0xdac9('0x34')]);_0x3eed7a[_0xdac9('0x36')]=_[_0xdac9('0x37')](_0x3eed7a[_0xdac9('0x33')],_0x3eed7a[_0xdac9('0x34')]);_0x4c4e21[_0xdac9('0x38')]=_['intersection'](_0x3eed7a['model'],qs[_0xdac9('0x39')](_0x170afd[_0xdac9('0x34')][_0xdac9('0x39')]));_0x4c4e21[_0xdac9('0x38')]=_0x4c4e21[_0xdac9('0x38')]['length']?_0x4c4e21[_0xdac9('0x38')]:_0x3eed7a['model'];if(!_0x170afd[_0xdac9('0x34')][_0xdac9('0x3a')]('nolimit')){_0x4c4e21[_0xdac9('0x20')]=qs['limit'](_0x170afd['query'][_0xdac9('0x20')]);_0x4c4e21[_0xdac9('0x1e')]=qs[_0xdac9('0x1e')](_0x170afd[_0xdac9('0x34')][_0xdac9('0x1e')]);}_0x4c4e21[_0xdac9('0x3b')]=qs['sort'](_0x170afd[_0xdac9('0x34')][_0xdac9('0x3c')]);_0x4c4e21['where']=qs[_0xdac9('0x36')](_[_0xdac9('0x3d')](_0x170afd[_0xdac9('0x34')],_0x3eed7a[_0xdac9('0x36')]),_0x13efba);if(_0x170afd[_0xdac9('0x34')][_0xdac9('0x3e')]){_0x4c4e21[_0xdac9('0x3f')]=_['merge'](_0x4c4e21[_0xdac9('0x3f')],{'$or':_[_0xdac9('0x2d')](_0x13efba,function(_0x238769){if(_0x238769['type']!==_0xdac9('0x40')){var _0x338e4a={};_0x338e4a[_0x238769[_0xdac9('0x2b')]]={'$like':'%'+_0x170afd[_0xdac9('0x34')]['filter']+'%'};return _0x338e4a;}})});}_0x4c4e21=_['merge']({},_0x4c4e21,_0x170afd[_0xdac9('0x41')]);var _0xe47a3c={'where':_0x4c4e21[_0xdac9('0x3f')]};return db[_0xdac9('0x2e')][_0xdac9('0x21')](_0xe47a3c)['then'](function(_0x8435e8){_0x3505c5['count']=_0x8435e8;if(_0x170afd[_0xdac9('0x34')][_0xdac9('0x42')]){_0x4c4e21[_0xdac9('0x43')]=[{'all':!![]}];}return db[_0xdac9('0x2e')][_0xdac9('0x44')](_0x4c4e21);})[_0xdac9('0x26')](function(_0x413fb1){_0x3505c5[_0xdac9('0x45')]=_0x413fb1;return _0x3505c5;})[_0xdac9('0x26')](respondWithFilteredResult(_0x4fe3bd,_0x4c4e21))[_0xdac9('0x46')](handleError(_0x4fe3bd,null));};exports[_0xdac9('0x47')]=function(_0x24b570,_0x278826){var _0x441676={'raw':!![],'where':{'id':_0x24b570[_0xdac9('0x48')]['id']}},_0x5335ae={};_0x5335ae[_0xdac9('0x33')]=_['keys'](db[_0xdac9('0x2e')][_0xdac9('0x2f')]);_0x5335ae[_0xdac9('0x34')]=_[_0xdac9('0x35')](_0x24b570[_0xdac9('0x34')]);_0x5335ae[_0xdac9('0x36')]=_['intersection'](_0x5335ae[_0xdac9('0x33')],_0x5335ae['query']);_0x441676[_0xdac9('0x38')]=_[_0xdac9('0x37')](_0x5335ae[_0xdac9('0x33')],qs[_0xdac9('0x39')](_0x24b570['query']['fields']));_0x441676['attributes']=_0x441676[_0xdac9('0x38')]['length']?_0x441676['attributes']:_0x5335ae[_0xdac9('0x33')];if(_0x24b570[_0xdac9('0x34')]['includeAll']){_0x441676['include']=[{'all':!![]}];}_0x441676=_[_0xdac9('0x49')]({},_0x441676,_0x24b570[_0xdac9('0x41')]);return db[_0xdac9('0x2e')][_0xdac9('0x4a')](_0x441676)[_0xdac9('0x26')](handleEntityNotFound(_0x278826,null))[_0xdac9('0x26')](respondWithResult(_0x278826,null))[_0xdac9('0x46')](handleError(_0x278826,null));};exports[_0xdac9('0x4b')]=function(_0x5c008b,_0x621cf){return db[_0xdac9('0x2e')][_0xdac9('0x4b')](_0x5c008b[_0xdac9('0x4c')],{})[_0xdac9('0x26')](respondWithResult(_0x621cf,0xc9))[_0xdac9('0x46')](handleError(_0x621cf,null));};exports[_0xdac9('0x25')]=function(_0x37b498,_0x140dc5){if(_0x37b498[_0xdac9('0x4c')]['id']){delete _0x37b498[_0xdac9('0x4c')]['id'];}return db[_0xdac9('0x2e')][_0xdac9('0x4a')]({'where':{'id':_0x37b498[_0xdac9('0x48')]['id']}})['then'](handleEntityNotFound(_0x140dc5,null))['then'](saveUpdates(_0x37b498['body'],null))[_0xdac9('0x26')](respondWithResult(_0x140dc5,null))[_0xdac9('0x46')](handleError(_0x140dc5,null));};exports['destroy']=function(_0x2a60bd,_0x2843f2){return db[_0xdac9('0x2e')]['find']({'where':{'id':_0x2a60bd[_0xdac9('0x48')]['id']}})[_0xdac9('0x26')](handleEntityNotFound(_0x2843f2,null))['then'](removeEntity(_0x2843f2,null))['catch'](handleError(_0x2843f2,null));};exports[_0xdac9('0x4d')]=function(_0x4469d8,_0x222de9){return db[_0xdac9('0x2e')][_0xdac9('0x4d')]()[_0xdac9('0x26')](respondWithResult(_0x222de9,null))[_0xdac9('0x46')](handleError(_0x222de9,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 1bc30ce..74a0e33 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 _0xe5c7=['define','JscriptyAnswerReport','report_jscripty_answers','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xe5c7,0x18f));var _0x7e5c=function(_0xf2cc8e,_0x17a712){_0xf2cc8e=_0xf2cc8e-0x0;var _0x592804=_0xe5c7[_0xf2cc8e];return _0x592804;};'use strict';var _=require(_0x7e5c('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x7e5c('0x1'));var moment=require(_0x7e5c('0x2'));var BPromise=require(_0x7e5c('0x3'));var rp=require(_0x7e5c('0x4'));var fs=require('fs');var path=require(_0x7e5c('0x5'));var rimraf=require(_0x7e5c('0x6'));var config=require(_0x7e5c('0x7'));var attributes=require('./jscriptyAnswerReport.attributes');module['exports']=function(_0xd859dd,_0x3117c3){return _0xd859dd[_0x7e5c('0x8')](_0x7e5c('0x9'),attributes,{'tableName':_0x7e5c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa547=['path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','define','JscriptyAnswerReport','util','api','bluebird','request-promise'];(function(_0x1d2ef2,_0x1a7599){var _0x345183=function(_0x21384d){while(--_0x21384d){_0x1d2ef2['push'](_0x1d2ef2['shift']());}};_0x345183(++_0x1a7599);}(_0xa547,0xb0));var _0x7a54=function(_0x69ecfb,_0x1be9af){_0x69ecfb=_0x69ecfb-0x0;var _0x40487b=_0xa547[_0x69ecfb];return _0x40487b;};'use strict';var _=require('lodash');var util=require(_0x7a54('0x0'));var logger=require('../../config/logger')(_0x7a54('0x1'));var moment=require('moment');var BPromise=require(_0x7a54('0x2'));var rp=require(_0x7a54('0x3'));var fs=require('fs');var path=require(_0x7a54('0x4'));var rimraf=require(_0x7a54('0x5'));var config=require(_0x7a54('0x6'));var attributes=require(_0x7a54('0x7'));module['exports']=function(_0x1b0366,_0x2a6b1a){return _0x1b0366[_0x7a54('0x8')](_0x7a54('0x9'),attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index f02cd00..059b6d0 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 _0x889e=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','randomstring'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x889e,0x91));var _0xe889=function(_0x1b0343,_0x30d887){_0x1b0343=_0x1b0343-0x0;var _0x55bacd=_0x889e[_0x1b0343];return _0x55bacd;};'use strict';var _=require(_0xe889('0x0'));var util=require(_0xe889('0x1'));var moment=require(_0xe889('0x2'));var BPromise=require(_0xe889('0x3'));var rs=require(_0xe889('0x4'));var fs=require('fs');var Redis=require(_0xe889('0x5'));var db=require(_0xe889('0x6'))['db'];var utils=require(_0xe889('0x7'));var logger=require(_0xe889('0x8'))(_0xe889('0x9'));var config=require(_0xe889('0xa'));var jayson=require(_0xe889('0xb'));var client=jayson[_0xe889('0xc')][_0xe889('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x16b753,_0x2f9174,_0x3bc77c){return new BPromise(function(_0x50f926,_0x3b3ff1){return client[_0xe889('0xe')](_0x16b753,_0x3bc77c)[_0xe889('0xf')](function(_0xf23a2c){logger[_0xe889('0x10')](_0xe889('0x11'),_0x2f9174,_0xe889('0x12'));logger[_0xe889('0x13')](_0xe889('0x14'),_0x2f9174,_0xe889('0x12'),JSON[_0xe889('0x15')](_0xf23a2c));if(_0xf23a2c[_0xe889('0x16')]){if(_0xf23a2c[_0xe889('0x16')][_0xe889('0x17')]===0x1f4){logger[_0xe889('0x16')](_0xe889('0x11'),_0x2f9174,_0xf23a2c[_0xe889('0x16')][_0xe889('0x18')]);return _0x3b3ff1(_0xf23a2c[_0xe889('0x16')]['message']);}logger[_0xe889('0x16')](_0xe889('0x11'),_0x2f9174,_0xf23a2c[_0xe889('0x16')][_0xe889('0x18')]);return _0x50f926(_0xf23a2c[_0xe889('0x16')][_0xe889('0x18')]);}else{logger['info'](_0xe889('0x11'),_0x2f9174,_0xe889('0x12'));_0x50f926(_0xf23a2c['result'][_0xe889('0x18')]);}})['catch'](function(_0x361f21){logger[_0xe889('0x16')](_0xe889('0x11'),_0x2f9174,_0x361f21);_0x3b3ff1(_0x361f21);});});} \ No newline at end of file +var _0xcf35=['debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','JscriptyAnswerReport,\x20%s,\x20%s','message','result','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','request\x20sent'];(function(_0x1cc040,_0x40e0d7){var _0x3cd89e=function(_0x523e80){while(--_0x523e80){_0x1cc040['push'](_0x1cc040['shift']());}};_0x3cd89e(++_0x40e0d7);}(_0xcf35,0x1c1));var _0x5cf3=function(_0x39b801,_0x1fdd40){_0x39b801=_0x39b801-0x0;var _0x53acb1=_0xcf35[_0x39b801];return _0x53acb1;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x5cf3('0x0'));var rs=require(_0x5cf3('0x1'));var fs=require('fs');var Redis=require(_0x5cf3('0x2'));var db=require(_0x5cf3('0x3'))['db'];var utils=require(_0x5cf3('0x4'));var logger=require('../../config/logger')(_0x5cf3('0x5'));var config=require(_0x5cf3('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x5cf3('0x7')][_0x5cf3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2f2c1a,_0x904f4d,_0x5dcfb4){return new BPromise(function(_0x1c6a72,_0xc794d9){return client[_0x5cf3('0x9')](_0x2f2c1a,_0x5dcfb4)[_0x5cf3('0xa')](function(_0x126bf5){logger[_0x5cf3('0xb')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x904f4d,_0x5cf3('0xc'));logger[_0x5cf3('0xd')](_0x5cf3('0xe'),_0x904f4d,_0x5cf3('0xc'),JSON[_0x5cf3('0xf')](_0x126bf5));if(_0x126bf5[_0x5cf3('0x10')]){if(_0x126bf5['error'][_0x5cf3('0x11')]===0x1f4){logger[_0x5cf3('0x10')](_0x5cf3('0x12'),_0x904f4d,_0x126bf5[_0x5cf3('0x10')]['message']);return _0xc794d9(_0x126bf5[_0x5cf3('0x10')][_0x5cf3('0x13')]);}logger[_0x5cf3('0x10')](_0x5cf3('0x12'),_0x904f4d,_0x126bf5[_0x5cf3('0x10')]['message']);return _0x1c6a72(_0x126bf5[_0x5cf3('0x10')]['message']);}else{logger[_0x5cf3('0xb')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x904f4d,_0x5cf3('0xc'));_0x1c6a72(_0x126bf5[_0x5cf3('0x14')][_0x5cf3('0x13')]);}})['catch'](function(_0x4d44c2){logger[_0x5cf3('0x10')](_0x5cf3('0x12'),_0x904f4d,_0x4d44c2);_0xc794d9(_0x4d44c2);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index b4a8cf8..2a7476d 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 _0x7ec5=['/:id/clone','clone','put','update','destroy','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','/:id','show','/:id/sessions','getSessions','/:id/answers','/:id/summary','30s','post','create'];(function(_0x380307,_0x440ccd){var _0x9ea14b=function(_0x51024c){while(--_0x51024c){_0x380307['push'](_0x380307['shift']());}};_0x9ea14b(++_0x440ccd);}(_0x7ec5,0x185));var _0x57ec=function(_0x3a5248,_0x34e201){_0x3a5248=_0x3a5248-0x0;var _0x4175a1=_0x7ec5[_0x3a5248];return _0x4175a1;};'use strict';var multer=require(_0x57ec('0x0'));var util=require(_0x57ec('0x1'));var path=require('path');var timeout=require(_0x57ec('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x57ec('0x3'));var auth=require(_0x57ec('0x4'));var interaction=require(_0x57ec('0x5'));var config=require(_0x57ec('0x6'));var controller=require(_0x57ec('0x7'));router[_0x57ec('0x8')]('/',auth[_0x57ec('0x9')](),controller['index']);router[_0x57ec('0x8')](_0x57ec('0xa'),auth['isAuthenticated'](),controller[_0x57ec('0xb')]);router[_0x57ec('0x8')](_0x57ec('0xc'),auth[_0x57ec('0x9')](),controller[_0x57ec('0xd')]);router[_0x57ec('0x8')](_0x57ec('0xe'),auth['isAuthenticated'](),controller['getAnswers']);router[_0x57ec('0x8')](_0x57ec('0xf'),auth[_0x57ec('0x9')](),timeout(_0x57ec('0x10')),controller['getSummary']);router[_0x57ec('0x11')]('/',auth[_0x57ec('0x9')](),controller[_0x57ec('0x12')]);router[_0x57ec('0x11')](_0x57ec('0x13'),auth[_0x57ec('0x9')](),controller[_0x57ec('0x14')]);router[_0x57ec('0x15')](_0x57ec('0xa'),auth[_0x57ec('0x9')](),controller[_0x57ec('0x16')]);router['delete'](_0x57ec('0xa'),auth[_0x57ec('0x9')](),controller[_0x57ec('0x17')]);module['exports']=router; \ No newline at end of file +var _0xff4b=['get','isAuthenticated','/:id','show','getSessions','/:id/answers','/:id/summary','30s','getSummary','create','/:id/clone','update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyProject.controller'];(function(_0x2c55a9,_0x388a1b){var _0x2bd013=function(_0x4550ca){while(--_0x4550ca){_0x2c55a9['push'](_0x2c55a9['shift']());}};_0x2bd013(++_0x388a1b);}(_0xff4b,0x1c4));var _0xbff4=function(_0x40e0f3,_0x5c3956){_0x40e0f3=_0x40e0f3-0x0;var _0x9e6ff3=_0xff4b[_0x40e0f3];return _0x9e6ff3;};'use strict';var multer=require(_0xbff4('0x0'));var util=require(_0xbff4('0x1'));var path=require(_0xbff4('0x2'));var timeout=require(_0xbff4('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xbff4('0x4'));var auth=require(_0xbff4('0x5'));var interaction=require(_0xbff4('0x6'));var config=require('../../config/environment');var controller=require(_0xbff4('0x7'));router[_0xbff4('0x8')]('/',auth[_0xbff4('0x9')](),controller['index']);router['get'](_0xbff4('0xa'),auth[_0xbff4('0x9')](),controller[_0xbff4('0xb')]);router['get']('/:id/sessions',auth[_0xbff4('0x9')](),controller[_0xbff4('0xc')]);router[_0xbff4('0x8')](_0xbff4('0xd'),auth[_0xbff4('0x9')](),controller['getAnswers']);router['get'](_0xbff4('0xe'),auth[_0xbff4('0x9')](),timeout(_0xbff4('0xf')),controller[_0xbff4('0x10')]);router['post']('/',auth[_0xbff4('0x9')](),controller[_0xbff4('0x11')]);router['post'](_0xbff4('0x12'),auth[_0xbff4('0x9')](),controller['clone']);router['put'](_0xbff4('0xa'),auth[_0xbff4('0x9')](),controller[_0xbff4('0x13')]);router[_0xbff4('0x14')](_0xbff4('0xa'),auth[_0xbff4('0x9')](),controller[_0xbff4('0x15')]);module[_0xbff4('0x16')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 3dcf870..f053b80 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 _0x96e2=['setDataValue','formData','stringify','isString','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize','lodash','util','exports','STRING','name','TEXT','isObjectLike'];(function(_0x479aa5,_0x4cd458){var _0x4b6655=function(_0x4ca32){while(--_0x4ca32){_0x479aa5['push'](_0x479aa5['shift']());}};_0x4b6655(++_0x4cd458);}(_0x96e2,0xe6));var _0x296e=function(_0x48d007,_0x446953){_0x48d007=_0x48d007-0x0;var _0x412d80=_0x96e2[_0x48d007];return _0x412d80;};'use strict';var Sequelize=require(_0x296e('0x0'));var _=require(_0x296e('0x1'));var util=require(_0x296e('0x2'));module[_0x296e('0x3')]={'name':{'type':Sequelize[_0x296e('0x4')],'unique':_0x296e('0x5')},'description':{'type':Sequelize[_0x296e('0x4')]},'formData':{'type':Sequelize[_0x296e('0x6')]('long'),'set':function(_0x16ec2d){if(_[_0x296e('0x7')](_0x16ec2d)){this[_0x296e('0x8')](_0x296e('0x9'),JSON[_0x296e('0xa')](_0x16ec2d));}else if(_[_0x296e('0xb')](_0x16ec2d)){this[_0x296e('0x8')](_0x296e('0x9'),_0x16ec2d);}else{this[_0x296e('0x8')]('formData',util[_0x296e('0xc')](_0x296e('0xd'),this[_0x296e('0xe')](_0x296e('0x5'))||'',this[_0x296e('0xe')](_0x296e('0xf'))||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x296e('0x10')],'defaultValue':![]}}; \ No newline at end of file +var _0x7663=['isObjectLike','setDataValue','stringify','formData','format','getDataValue','BOOLEAN','sequelize','lodash','exports','STRING','name','TEXT','long'];(function(_0x224ca4,_0x32bf23){var _0x2e2fa7=function(_0x48410e){while(--_0x48410e){_0x224ca4['push'](_0x224ca4['shift']());}};_0x2e2fa7(++_0x32bf23);}(_0x7663,0xcb));var _0x3766=function(_0x2f2a43,_0x48043f){_0x2f2a43=_0x2f2a43-0x0;var _0x3a40a5=_0x7663[_0x2f2a43];return _0x3a40a5;};'use strict';var Sequelize=require(_0x3766('0x0'));var _=require(_0x3766('0x1'));var util=require('util');module[_0x3766('0x2')]={'name':{'type':Sequelize[_0x3766('0x3')],'unique':_0x3766('0x4')},'description':{'type':Sequelize[_0x3766('0x3')]},'formData':{'type':Sequelize[_0x3766('0x5')](_0x3766('0x6')),'set':function(_0x4c7ae1){if(_[_0x3766('0x7')](_0x4c7ae1)){this[_0x3766('0x8')]('formData',JSON[_0x3766('0x9')](_0x4c7ae1));}else if(_['isString'](_0x4c7ae1)){this[_0x3766('0x8')](_0x3766('0xa'),_0x4c7ae1);}else{this[_0x3766('0x8')](_0x3766('0xa'),util[_0x3766('0xb')]('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this['getDataValue'](_0x3766('0x4'))||'',this[_0x3766('0xc')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x3766('0xd')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index a1a987b..fa02c88 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 _0x8603=['params','find','catch','create','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','body','user','Projects','UserProfileSection','autoAssociation','getSessions','JscriptySessionReport','ProjectId','getAnswers','findOne','JscriptyAnswerReport','fromCharCode','toString','indexOf','replace','getSummary','startTime','parse','JscriptyQuestionReport','-createdAt','questionId','question','starttime','format','SessionId','answer','push','isEmpty','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','Content-disposition','Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-type','text/csv','download','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','keys','filters','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','VIRTUAL','options','where','JscriptyProject','includeAll','include','findAll','rows'];(function(_0x215692,_0x344ee3){var _0x2214fe=function(_0x41c809){while(--_0x41c809){_0x215692['push'](_0x215692['shift']());}};_0x2214fe(++_0x344ee3);}(_0x8603,0x190));var _0x3860=function(_0x250858,_0x4381dc){_0x250858=_0x250858-0x0;var _0x4ba9f8=_0x8603[_0x250858];return _0x4ba9f8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3860('0x0'));var zipdir=require(_0x3860('0x1'));var jsonpatch=require(_0x3860('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3860('0x3'));var Mustache=require(_0x3860('0x4'));var util=require(_0x3860('0x5'));var path=require('path');var sox=require(_0x3860('0x6'));var csv=require('to-csv');var ejs=require(_0x3860('0x7'));var fs=require('fs');var fs_extra=require(_0x3860('0x8'));var _=require(_0x3860('0x9'));var squel=require(_0x3860('0xa'));var crypto=require(_0x3860('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3860('0xc'));var Papa=require(_0x3860('0xd'));var Redis=require('ioredis');var authService=require(_0x3860('0xe'));var qs=require(_0x3860('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3860('0x10'));var logger=require(_0x3860('0x11'))('api');var utils=require(_0x3860('0x12'));var config=require(_0x3860('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x3860('0x14'))['db'];function respondWithStatusCode(_0x8ad61d,_0x2428f6){_0x2428f6=_0x2428f6||0xcc;return function(_0x1ea619){if(_0x1ea619){return _0x8ad61d[_0x3860('0x15')](_0x2428f6);}return _0x8ad61d[_0x3860('0x16')](_0x2428f6)[_0x3860('0x17')]();};}function respondWithResult(_0x12b23b,_0x465d8d){_0x465d8d=_0x465d8d||0xc8;return function(_0x46264d){if(_0x46264d){return _0x12b23b['status'](_0x465d8d)[_0x3860('0x18')](_0x46264d);}};}function respondWithFilteredResult(_0x21eaf1,_0x122e40){return function(_0x37d9ab){if(_0x37d9ab){var _0x1055b3=typeof _0x122e40[_0x3860('0x19')]===_0x3860('0x1a')&&typeof _0x122e40[_0x3860('0x1b')]===_0x3860('0x1a');var _0x3c0d91=_0x37d9ab[_0x3860('0x1c')];var _0x45b799=_0x1055b3?0x0:_0x122e40['offset'];var _0x4863bd=_0x1055b3?_0x37d9ab[_0x3860('0x1c')]:_0x122e40[_0x3860('0x19')]+_0x122e40[_0x3860('0x1b')];var _0x53fc63;if(_0x4863bd>=_0x3c0d91){_0x4863bd=_0x3c0d91;_0x53fc63=0xc8;}else{_0x53fc63=0xce;}_0x21eaf1[_0x3860('0x16')](_0x53fc63);return _0x21eaf1[_0x3860('0x1d')](_0x3860('0x1e'),_0x45b799+'-'+_0x4863bd+'/'+_0x3c0d91)[_0x3860('0x18')](_0x37d9ab);}return null;};}function patchUpdates(_0x20a5b0){return function(_0x45081f){try{jsonpatch[_0x3860('0x1f')](_0x45081f,_0x20a5b0,!![]);}catch(_0x1f8891){return BPromise[_0x3860('0x20')](_0x1f8891);}return _0x45081f[_0x3860('0x21')]();};}function saveUpdates(_0xacd57f,_0x2e0b6e){return function(_0x280ea9){if(_0x280ea9){return _0x280ea9[_0x3860('0x22')](_0xacd57f)[_0x3860('0x23')](function(_0x564efd){return _0x564efd;});}return null;};}function removeEntity(_0xfc10a5,_0x133093){return function(_0x2b91f2){if(_0x2b91f2){return _0x2b91f2[_0x3860('0x24')]()[_0x3860('0x23')](function(){var _0x56a6d1=_0x2b91f2[_0x3860('0x25')]({'plain':!![]});var _0x568515='Projects';return db[_0x3860('0x26')][_0x3860('0x24')]({'where':{'type':_0x568515,'resourceId':_0x56a6d1['id']}})['then'](function(){return _0x2b91f2;});})['then'](function(){_0xfc10a5['status'](0xcc)[_0x3860('0x17')]();});}};}function handleEntityNotFound(_0x3ebc5b,_0xb25cc2){return function(_0x371f3a){if(!_0x371f3a){_0x3ebc5b[_0x3860('0x15')](0x194);}return _0x371f3a;};}function handleError(_0x228d34,_0x544b9a){_0x544b9a=_0x544b9a||0x1f4;return function(_0x4c4314){logger[_0x3860('0x27')](_0x4c4314[_0x3860('0x28')]);if(_0x4c4314['name']){delete _0x4c4314[_0x3860('0x29')];}_0x228d34[_0x3860('0x16')](_0x544b9a)[_0x3860('0x2a')](_0x4c4314);};}exports[_0x3860('0x2b')]=function(_0x3628f7,_0x4bbae9){var _0x36ae2b={},_0xf624ba={},_0x367b14={'count':0x0,'rows':[]};var _0x4bd90c=_[_0x3860('0x2c')](db['JscriptyProject'][_0x3860('0x2d')],function(_0x4825f0){return{'name':_0x4825f0[_0x3860('0x2e')],'type':_0x4825f0[_0x3860('0x2f')][_0x3860('0x30')]};});_0xf624ba['model']=_[_0x3860('0x2c')](_0x4bd90c,_0x3860('0x29'));_0xf624ba['query']=_[_0x3860('0x31')](_0x3628f7['query']);_0xf624ba[_0x3860('0x32')]=_[_0x3860('0x33')](_0xf624ba[_0x3860('0x34')],_0xf624ba[_0x3860('0x35')]);_0x36ae2b[_0x3860('0x36')]=_[_0x3860('0x33')](_0xf624ba[_0x3860('0x34')],qs['fields'](_0x3628f7[_0x3860('0x35')][_0x3860('0x37')]));_0x36ae2b['attributes']=_0x36ae2b[_0x3860('0x36')][_0x3860('0x38')]?_0x36ae2b[_0x3860('0x36')]:_0xf624ba['model'];if(!_0x3628f7['query'][_0x3860('0x39')](_0x3860('0x3a'))){_0x36ae2b[_0x3860('0x1b')]=qs[_0x3860('0x1b')](_0x3628f7['query']['limit']);_0x36ae2b[_0x3860('0x19')]=qs[_0x3860('0x19')](_0x3628f7[_0x3860('0x35')][_0x3860('0x19')]);}_0x36ae2b[_0x3860('0x3b')]=qs['sort'](_0x3628f7[_0x3860('0x35')][_0x3860('0x3c')]);_0x36ae2b['where']=qs['filters'](_[_0x3860('0x3d')](_0x3628f7[_0x3860('0x35')],_0xf624ba[_0x3860('0x32')]),_0x4bd90c);if(_0x3628f7[_0x3860('0x35')][_0x3860('0x3e')]){_0x36ae2b['where']=_[_0x3860('0x3f')](_0x36ae2b['where'],{'$or':_[_0x3860('0x2c')](_0x4bd90c,function(_0x35bf7a){if(_0x35bf7a['type']!==_0x3860('0x40')){var _0x162e65={};_0x162e65[_0x35bf7a['name']]={'$like':'%'+_0x3628f7[_0x3860('0x35')][_0x3860('0x3e')]+'%'};return _0x162e65;}})});}_0x36ae2b=_[_0x3860('0x3f')]({},_0x36ae2b,_0x3628f7[_0x3860('0x41')]);var _0x4f486e={'where':_0x36ae2b[_0x3860('0x42')]};return db[_0x3860('0x43')][_0x3860('0x1c')](_0x4f486e)['then'](function(_0x3a87e5){_0x367b14['count']=_0x3a87e5;if(_0x3628f7[_0x3860('0x35')][_0x3860('0x44')]){_0x36ae2b[_0x3860('0x45')]=[{'all':!![]}];}return db[_0x3860('0x43')][_0x3860('0x46')](_0x36ae2b);})[_0x3860('0x23')](function(_0x4e0a44){_0x367b14[_0x3860('0x47')]=_0x4e0a44;return _0x367b14;})[_0x3860('0x23')](respondWithFilteredResult(_0x4bbae9,_0x36ae2b))['catch'](handleError(_0x4bbae9,null));};exports['show']=function(_0x2938d4,_0x5840f7){var _0x4f2f53={'raw':![],'where':{'id':_0x2938d4[_0x3860('0x48')]['id']}},_0x164a77={};_0x164a77['model']=_[_0x3860('0x31')](db[_0x3860('0x43')][_0x3860('0x2d')]);_0x164a77[_0x3860('0x35')]=_[_0x3860('0x31')](_0x2938d4[_0x3860('0x35')]);_0x164a77[_0x3860('0x32')]=_[_0x3860('0x33')](_0x164a77[_0x3860('0x34')],_0x164a77[_0x3860('0x35')]);_0x4f2f53[_0x3860('0x36')]=_[_0x3860('0x33')](_0x164a77[_0x3860('0x34')],qs['fields'](_0x2938d4[_0x3860('0x35')]['fields']));_0x4f2f53[_0x3860('0x36')]=_0x4f2f53[_0x3860('0x36')][_0x3860('0x38')]?_0x4f2f53[_0x3860('0x36')]:_0x164a77[_0x3860('0x34')];if(_0x2938d4[_0x3860('0x35')][_0x3860('0x44')]){_0x4f2f53[_0x3860('0x45')]=[{'all':!![]}];}_0x4f2f53=_['merge']({},_0x4f2f53,_0x2938d4[_0x3860('0x41')]);return db[_0x3860('0x43')][_0x3860('0x49')](_0x4f2f53)['then'](handleEntityNotFound(_0x5840f7,null))[_0x3860('0x23')](respondWithResult(_0x5840f7,null))[_0x3860('0x4a')](handleError(_0x5840f7,null));};exports[_0x3860('0x4b')]=function(_0x3dc957,_0x5ed2db){return db['JscriptyProject'][_0x3860('0x4b')](_0x3dc957['body'],{})[_0x3860('0x23')](function(_0x4226da){var _0x410dab=_0x3dc957['user'][_0x3860('0x25')]({'plain':!![]});if(!_0x410dab)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x410dab[_0x3860('0x4c')]==='user'){var _0xf9edb4=_0x4226da[_0x3860('0x25')]({'plain':!![]});var _0x39b2e0='Projects';return db['UserProfileSection'][_0x3860('0x49')]({'where':{'name':_0x39b2e0,'userProfileId':_0x410dab[_0x3860('0x4d')]},'raw':!![]})['then'](function(_0x3910f5){if(_0x3910f5&&_0x3910f5['autoAssociation']===0x0){return db[_0x3860('0x26')][_0x3860('0x4b')]({'name':_0xf9edb4[_0x3860('0x29')],'resourceId':_0xf9edb4['id'],'type':_0x3910f5[_0x3860('0x29')],'sectionId':_0x3910f5['id']},{})[_0x3860('0x23')](function(){return _0x4226da;});}else{return _0x4226da;}})[_0x3860('0x4a')](function(_0x3fad85){logger['error'](_0x3860('0x4e'),_0x3fad85);throw _0x3fad85;});}return _0x4226da;})[_0x3860('0x23')](respondWithResult(_0x5ed2db,0xc9))[_0x3860('0x4a')](handleError(_0x5ed2db,null));};exports[_0x3860('0x4f')]=function(_0x279e6f,_0x447163){var _0x47ff99={'where':{'id':_0x279e6f[_0x3860('0x48')]['id']}},_0x2cf48c={};_0x2cf48c[_0x3860('0x34')]=_[_0x3860('0x31')](db[_0x3860('0x43')][_0x3860('0x2d')]);_0x47ff99[_0x3860('0x36')]=_[_0x3860('0x33')](_0x2cf48c['model'],qs[_0x3860('0x37')](_0x279e6f[_0x3860('0x35')]['fields']));_0x47ff99[_0x3860('0x36')]=_0x47ff99[_0x3860('0x36')][_0x3860('0x38')]?_0x47ff99['attributes']:_0x2cf48c[_0x3860('0x34')];if(_0x279e6f['query'][_0x3860('0x44')]){_0x47ff99[_0x3860('0x45')]=[{'all':!![]}];}_0x47ff99=_[_0x3860('0x3f')]({},_0x47ff99,_0x279e6f[_0x3860('0x41')]);return db[_0x3860('0x43')][_0x3860('0x49')](_0x47ff99)[_0x3860('0x23')](handleEntityNotFound(_0x447163,null))[_0x3860('0x23')](function(_0x67e6b8){if(_0x67e6b8){var _0x151492=_0x67e6b8[_0x3860('0x25')]({'plain':!![]});_0x151492=qs[_0x3860('0x50')](_0x151492,['id','createdAt','updatedAt']);_0x279e6f['body']=_[_0x3860('0x50')](_0x279e6f['body'],['id','createdAt',_0x3860('0x51')]);return db[_0x3860('0x43')][_0x3860('0x4b')](_[_0x3860('0x3f')](_0x151492,_0x279e6f[_0x3860('0x52')]),{'include':_0x279e6f[_0x3860('0x35')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x4df47b){var _0x1d6c70=_0x279e6f[_0x3860('0x53')][_0x3860('0x25')]({'plain':!![]});if(!_0x1d6c70)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1d6c70[_0x3860('0x4c')]==='user'){var _0x4714c5=_0x4df47b[_0x3860('0x25')]({'plain':!![]});var _0x5176ff=_0x3860('0x54');return db[_0x3860('0x55')][_0x3860('0x49')]({'where':{'name':_0x5176ff,'userProfileId':_0x1d6c70[_0x3860('0x4d')]},'raw':!![]})['then'](function(_0x18cc37){if(_0x18cc37&&_0x18cc37[_0x3860('0x56')]===0x0){return db[_0x3860('0x26')]['create']({'name':_0x4714c5['name'],'resourceId':_0x4714c5['id'],'type':_0x18cc37[_0x3860('0x29')],'sectionId':_0x18cc37['id']},{})[_0x3860('0x23')](function(){return _0x4df47b;});}else{return _0x4df47b;}})[_0x3860('0x4a')](function(_0x1ca0e7){logger[_0x3860('0x27')](_0x3860('0x4e'),_0x1ca0e7);throw _0x1ca0e7;});}return _0x4df47b;});}})['then'](respondWithResult(_0x447163,0xc9))[_0x3860('0x4a')](handleError(_0x447163,null));};exports[_0x3860('0x22')]=function(_0x5db8f9,_0x15fa2d){if(_0x5db8f9[_0x3860('0x52')]['id']){delete _0x5db8f9[_0x3860('0x52')]['id'];}return db[_0x3860('0x43')][_0x3860('0x49')]({'where':{'id':_0x5db8f9[_0x3860('0x48')]['id']}})['then'](handleEntityNotFound(_0x15fa2d,null))[_0x3860('0x23')](saveUpdates(_0x5db8f9[_0x3860('0x52')],null))[_0x3860('0x23')](respondWithResult(_0x15fa2d,null))[_0x3860('0x4a')](handleError(_0x15fa2d,null));};exports[_0x3860('0x24')]=function(_0x2a5c06,_0x5f2c66){return db[_0x3860('0x43')][_0x3860('0x49')]({'where':{'id':_0x2a5c06[_0x3860('0x48')]['id']}})['then'](handleEntityNotFound(_0x5f2c66,null))['then'](removeEntity(_0x5f2c66,null))[_0x3860('0x4a')](handleError(_0x5f2c66,null));};exports[_0x3860('0x57')]=function(_0x11c2c8,_0x3b7a76,_0x3fe275){var _0x501ed0={'raw':!![],'where':{}};var _0x48ade7={};var _0x2db53f={'count':0x0,'rows':[]};return db[_0x3860('0x43')]['findOne']({'where':{'id':_0x11c2c8['params']['id']}})[_0x3860('0x23')](handleEntityNotFound(_0x3b7a76,null))[_0x3860('0x23')](function(_0x4ca6de){if(_0x4ca6de){_0x48ade7[_0x3860('0x34')]=_[_0x3860('0x31')](db[_0x3860('0x58')][_0x3860('0x2d')]);_0x48ade7['query']=_[_0x3860('0x31')](_0x11c2c8[_0x3860('0x35')]);_0x48ade7['filters']=_['intersection'](_0x48ade7[_0x3860('0x34')],_0x48ade7[_0x3860('0x35')]);_0x501ed0['attributes']=_[_0x3860('0x33')](_0x48ade7['model'],qs[_0x3860('0x37')](_0x11c2c8['query']['fields']));_0x501ed0[_0x3860('0x36')]=_0x501ed0['attributes'][_0x3860('0x38')]?_0x501ed0[_0x3860('0x36')]:_0x48ade7[_0x3860('0x34')];if(!_0x11c2c8[_0x3860('0x35')][_0x3860('0x39')](_0x3860('0x3a'))){_0x501ed0['limit']=qs[_0x3860('0x1b')](_0x11c2c8[_0x3860('0x35')][_0x3860('0x1b')]);_0x501ed0['offset']=qs[_0x3860('0x19')](_0x11c2c8['query'][_0x3860('0x19')]);}_0x501ed0[_0x3860('0x3b')]=qs['sort'](_0x11c2c8[_0x3860('0x35')][_0x3860('0x3c')]);_0x501ed0[_0x3860('0x42')]=qs['filters'](_['pick'](_0x11c2c8['query'],_0x48ade7['filters']));_0x501ed0[_0x3860('0x42')][_0x3860('0x59')]=_0x4ca6de['id'];if(_0x11c2c8[_0x3860('0x35')][_0x3860('0x3e')]){_0x501ed0['where']=_['merge'](_0x501ed0[_0x3860('0x42')],{'$or':_[_0x3860('0x2c')](_0x501ed0[_0x3860('0x36')],function(_0x61798b){var _0x4b0652={};_0x4b0652[_0x61798b]={'$like':'%'+_0x11c2c8[_0x3860('0x35')][_0x3860('0x3e')]+'%'};return _0x4b0652;})});}_0x501ed0=_['merge']({},_0x501ed0,_0x11c2c8['options']);return db[_0x3860('0x58')][_0x3860('0x1c')]({'where':_0x501ed0[_0x3860('0x42')]})[_0x3860('0x23')](function(_0x54739a){_0x2db53f['count']=_0x54739a;if(_0x11c2c8[_0x3860('0x35')]['includeAll']){_0x501ed0[_0x3860('0x45')]=[{'all':!![]}];}return db[_0x3860('0x58')]['findAll'](_0x501ed0);})['then'](function(_0x51b775){_0x2db53f[_0x3860('0x47')]=_0x51b775;return _0x2db53f;});}})[_0x3860('0x23')](respondWithFilteredResult(_0x3b7a76,_0x501ed0))['catch'](handleError(_0x3b7a76,null));};exports[_0x3860('0x5a')]=function(_0x1371b5,_0x2351fe,_0x3c5ad8){var _0x5b8867={'raw':!![],'where':{}};var _0x481e20={};var _0x1426c4={'count':0x0,'rows':[]};return db[_0x3860('0x43')][_0x3860('0x5b')]({'where':{'id':_0x1371b5[_0x3860('0x48')]['id']}})[_0x3860('0x23')](handleEntityNotFound(_0x2351fe,null))['then'](function(_0x313366){if(_0x313366){_0x481e20[_0x3860('0x34')]=_[_0x3860('0x31')](db[_0x3860('0x5c')][_0x3860('0x2d')]);_0x481e20['query']=_['keys'](_0x1371b5[_0x3860('0x35')]);_0x481e20[_0x3860('0x32')]=_[_0x3860('0x33')](_0x481e20[_0x3860('0x34')],_0x481e20[_0x3860('0x35')]);_0x5b8867[_0x3860('0x36')]=_[_0x3860('0x33')](_0x481e20['model'],qs[_0x3860('0x37')](_0x1371b5[_0x3860('0x35')]['fields']));_0x5b8867[_0x3860('0x36')]=_0x5b8867[_0x3860('0x36')][_0x3860('0x38')]?_0x5b8867['attributes']:_0x481e20[_0x3860('0x34')];if(!_0x1371b5[_0x3860('0x35')]['hasOwnProperty'](_0x3860('0x3a'))){_0x5b8867['limit']=qs[_0x3860('0x1b')](_0x1371b5[_0x3860('0x35')]['limit']);_0x5b8867[_0x3860('0x19')]=qs[_0x3860('0x19')](_0x1371b5[_0x3860('0x35')][_0x3860('0x19')]);}_0x5b8867[_0x3860('0x3b')]=qs['sort'](_0x1371b5[_0x3860('0x35')][_0x3860('0x3c')]);_0x5b8867[_0x3860('0x42')]=qs[_0x3860('0x32')](_[_0x3860('0x3d')](_0x1371b5['query'],_0x481e20['filters']));_0x5b8867[_0x3860('0x42')][_0x3860('0x59')]=_0x313366['id'];if(_0x1371b5['query'][_0x3860('0x3e')]){_0x5b8867[_0x3860('0x42')]=_[_0x3860('0x3f')](_0x5b8867[_0x3860('0x42')],{'$or':_['map'](_0x5b8867[_0x3860('0x36')],function(_0x5a2f99){var _0x1a0768={};_0x1a0768[_0x5a2f99]={'$like':'%'+_0x1371b5[_0x3860('0x35')][_0x3860('0x3e')]+'%'};return _0x1a0768;})});}_0x5b8867=_[_0x3860('0x3f')]({},_0x5b8867,_0x1371b5[_0x3860('0x41')]);return db[_0x3860('0x5c')][_0x3860('0x1c')]({'where':_0x5b8867['where']})[_0x3860('0x23')](function(_0x47396d){_0x1426c4['count']=_0x47396d;if(_0x1371b5['query']['includeAll']){_0x5b8867['include']=[{'all':!![]}];}return db[_0x3860('0x5c')][_0x3860('0x46')](_0x5b8867);})[_0x3860('0x23')](function(_0x1482cd){_0x1426c4[_0x3860('0x47')]=_0x1482cd;return _0x1426c4;});}})[_0x3860('0x23')](respondWithFilteredResult(_0x2351fe,_0x5b8867))['catch'](handleError(_0x2351fe,null));};function char(_0x204da6){return'number'===typeof _0x204da6?String[_0x3860('0x5d')][_0x3860('0x1f')](null,arguments):_0x204da6;}function needsEncapsulation(_0x897ea0){return!!_0x897ea0&&(_0x897ea0[_0x3860('0x5e')]()[_0x3860('0x5f')](char(0xd))>=0x0||_0x897ea0[_0x3860('0x5e')]()[_0x3860('0x5f')](char(0xa))>=0x0||_0x897ea0[_0x3860('0x5e')]()[_0x3860('0x5f')](char(0x2c))>=0x0||_0x897ea0[_0x3860('0x5e')]()[_0x3860('0x5f')](char(0x22))>=0x0);}function encapsulate(_0x5bdd94){var _0x1ab3fa=char(0x22),_0x304c95='\x5c'+char(0x22),_0x1c87bd=_0x5bdd94['toString']()[_0x3860('0x60')](new RegExp(_0x1ab3fa,'g'),_0x304c95);return _0x1ab3fa+_0x1c87bd+_0x1ab3fa;}exports[_0x3860('0x61')]=function(_0x1a9f4e,_0x3d4469,_0x4a3e1a){var _0x16a462,_0x19ace1;var _0x18e1ef={'where':{'ProjectId':_0x1a9f4e['params']['id']}};if(_0x1a9f4e[_0x3860('0x35')][_0x3860('0x62')]){_0x18e1ef[_0x3860('0x42')]['starttime']=JSON[_0x3860('0x63')](_0x1a9f4e[_0x3860('0x35')][_0x3860('0x62')]);}return db['JscriptySessionReport'][_0x3860('0x46')](_0x18e1ef)[_0x3860('0x23')](handleEntityNotFound(_0x3d4469,null))[_0x3860('0x23')](function(_0x5c2003){if(_0x5c2003){_0x16a462=_0x5c2003;return db[_0x3860('0x64')][_0x3860('0x46')]({'where':{'SessionId':{'$in':_[_0x3860('0x2c')](_0x16a462,'id')},'ProjectId':_0x1a9f4e['params']['id']},'order':_0x3860('0x65')});}})['then'](handleEntityNotFound(_0x3d4469,null))[_0x3860('0x23')](function(_0x581e7b){if(_0x581e7b){_0x19ace1=_0x581e7b;var _0x256156={};for(var _0x418bb1=0x0,_0x33e7c1=_0x19ace1[_0x3860('0x38')];_0x418bb1<_0x33e7c1;_0x418bb1++){if(!_0x256156[_0x3860('0x39')](_0x19ace1[_0x418bb1][_0x3860('0x66')])){_0x256156[_0x19ace1[_0x418bb1][_0x3860('0x66')]]=needsEncapsulation(_0x19ace1[_0x418bb1][_0x3860('0x67')])?encapsulate(_0x19ace1[_0x418bb1][_0x3860('0x67')]):_0x19ace1[_0x418bb1][_0x3860('0x67')];}}var _0x10b4e8=[],_0x33fed2={};for(var _0x300837=0x0,_0x192136=_0x16a462[_0x3860('0x38')];_0x300837<_0x192136;_0x300837++){_0x33fed2={'ProjectId':_0x1a9f4e[_0x3860('0x48')]['id'],'SessionId':_0x16a462[_0x300837]['id'],'StartTime':moment(_0x16a462[_0x300837][_0x3860('0x68')])[_0x3860('0x69')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x37575b=0x0,_0x1d6d2b=_0x19ace1[_0x3860('0x38')];_0x37575b<_0x1d6d2b;_0x37575b++){if(_0x19ace1[_0x37575b][_0x3860('0x6a')]==_0x16a462[_0x300837]['id']&&_0x256156[_0x3860('0x39')](_0x19ace1[_0x37575b][_0x3860('0x66')])){_0x33fed2[_0x256156[_0x19ace1[_0x37575b][_0x3860('0x66')]]]=_0x19ace1[_0x37575b][_0x3860('0x6b')];}}for(var _0x222e5a in _0x256156){if(!_0x33fed2[_0x3860('0x39')](_0x256156[_0x222e5a])){_0x33fed2[_0x256156[_0x222e5a]]=null;}}_0x10b4e8[_0x3860('0x6c')](_0x33fed2);}return _0x10b4e8;}})['then'](function(_0x252c19){if(!_[_0x3860('0x6d')](_0x252c19)){var _0x666daa=toCsv(_0x252c19);var _0x6334ca=Date['now']();fs[_0x3860('0x6e')](util[_0x3860('0x69')](_0x3860('0x6f'),_0x1a9f4e[_0x3860('0x48')]['id'],_0x6334ca),_0x666daa);_0x3d4469['setHeader'](_0x3860('0x70'),'attachment;\x20filename='+util['format'](_0x3860('0x71'),_0x1a9f4e[_0x3860('0x48')]['id'],_0x6334ca));_0x3d4469[_0x3860('0x72')](_0x3860('0x73'),_0x3860('0x74'));return _0x3d4469[_0x3860('0x75')](util[_0x3860('0x69')](_0x3860('0x6f'),_0x1a9f4e[_0x3860('0x48')]['id'],_0x6334ca));}else{return _0x3d4469[_0x3860('0x15')](0xcc);}})[_0x3860('0x4a')](handleError(_0x3d4469,null));}; \ No newline at end of file +var _0x95c3=['jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','merge','JscriptyProject','includeAll','findAll','rows','catch','show','keys','include','options','find','create','body','user','Projects','UserProfileSection','autoAssociation','clone','omit','updatedAt','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','getSessions','JscriptySessionReport','order','getAnswers','findOne','JscriptyAnswerReport','ProjectId','number','fromCharCode','indexOf','toString','replace','getSummary','startTime','starttime','parse','JscriptyQuestionReport','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','now','setHeader','Content-disposition','attachment;\x20filename=','text/csv','/tmp/Jscripty_Project_%d_Summary_%s.csv','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0x95c3,0x6d));var _0x395c=function(_0x18a436,_0x1dbe06){_0x18a436=_0x18a436-0x0;var _0x5c2cf8=_0x95c3[_0x18a436];return _0x5c2cf8;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x395c('0x0'));var jsonpatch=require(_0x395c('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x395c('0x2'));var Mustache=require(_0x395c('0x3'));var util=require(_0x395c('0x4'));var path=require(_0x395c('0x5'));var sox=require(_0x395c('0x6'));var csv=require('to-csv');var ejs=require(_0x395c('0x7'));var fs=require('fs');var fs_extra=require(_0x395c('0x8'));var _=require(_0x395c('0x9'));var squel=require(_0x395c('0xa'));var crypto=require(_0x395c('0xb'));var jsforce=require(_0x395c('0xc'));var deskjs=require(_0x395c('0xd'));var toCsv=require(_0x395c('0xe'));var querystring=require(_0x395c('0xf'));var Papa=require(_0x395c('0x10'));var Redis=require(_0x395c('0x11'));var authService=require(_0x395c('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x395c('0x13'));var hardwareService=require(_0x395c('0x14'));var logger=require(_0x395c('0x15'))(_0x395c('0x16'));var utils=require('../../config/utils');var config=require(_0x395c('0x17'));var licenseUtil=require(_0x395c('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1d8e2a,_0x3c4b54){_0x3c4b54=_0x3c4b54||0xcc;return function(_0x2d5125){if(_0x2d5125){return _0x1d8e2a[_0x395c('0x19')](_0x3c4b54);}return _0x1d8e2a['status'](_0x3c4b54)[_0x395c('0x1a')]();};}function respondWithResult(_0x50a8f3,_0x4a068a){_0x4a068a=_0x4a068a||0xc8;return function(_0x493e3b){if(_0x493e3b){return _0x50a8f3[_0x395c('0x1b')](_0x4a068a)[_0x395c('0x1c')](_0x493e3b);}};}function respondWithFilteredResult(_0x14631b,_0x174702){return function(_0x2a60d6){if(_0x2a60d6){var _0x5e498e=typeof _0x174702[_0x395c('0x1d')]===_0x395c('0x1e')&&typeof _0x174702[_0x395c('0x1f')]===_0x395c('0x1e');var _0x36db53=_0x2a60d6[_0x395c('0x20')];var _0x55516b=_0x5e498e?0x0:_0x174702['offset'];var _0x202efc=_0x5e498e?_0x2a60d6[_0x395c('0x20')]:_0x174702[_0x395c('0x1d')]+_0x174702[_0x395c('0x1f')];var _0x5d4161;if(_0x202efc>=_0x36db53){_0x202efc=_0x36db53;_0x5d4161=0xc8;}else{_0x5d4161=0xce;}_0x14631b['status'](_0x5d4161);return _0x14631b['set'](_0x395c('0x21'),_0x55516b+'-'+_0x202efc+'/'+_0x36db53)[_0x395c('0x1c')](_0x2a60d6);}return null;};}function patchUpdates(_0x32d669){return function(_0x34a782){try{jsonpatch[_0x395c('0x22')](_0x34a782,_0x32d669,!![]);}catch(_0x1c2e7a){return BPromise[_0x395c('0x23')](_0x1c2e7a);}return _0x34a782[_0x395c('0x24')]();};}function saveUpdates(_0x169b11,_0x11b802){return function(_0x160e3b){if(_0x160e3b){return _0x160e3b[_0x395c('0x25')](_0x169b11)[_0x395c('0x26')](function(_0x3f4672){return _0x3f4672;});}return null;};}function removeEntity(_0x28df82,_0x520ee6){return function(_0x404384){if(_0x404384){return _0x404384[_0x395c('0x27')]()['then'](function(){var _0x135d31=_0x404384[_0x395c('0x28')]({'plain':!![]});var _0x6e557f='Projects';return db[_0x395c('0x29')][_0x395c('0x27')]({'where':{'type':_0x6e557f,'resourceId':_0x135d31['id']}})[_0x395c('0x26')](function(){return _0x404384;});})[_0x395c('0x26')](function(){_0x28df82[_0x395c('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b4e48,_0x5c460b){return function(_0x2d4b54){if(!_0x2d4b54){_0x3b4e48[_0x395c('0x19')](0x194);}return _0x2d4b54;};}function handleError(_0xc609e5,_0x2f07ab){_0x2f07ab=_0x2f07ab||0x1f4;return function(_0x1c33f4){logger[_0x395c('0x2a')](_0x1c33f4[_0x395c('0x2b')]);if(_0x1c33f4[_0x395c('0x2c')]){delete _0x1c33f4[_0x395c('0x2c')];}_0xc609e5['status'](_0x2f07ab)[_0x395c('0x2d')](_0x1c33f4);};}exports[_0x395c('0x2e')]=function(_0x500e15,_0x37d82f){var _0x2625b7={},_0xdb4d05={},_0x453680={'count':0x0,'rows':[]};var _0x3f6a1d=_[_0x395c('0x2f')](db['JscriptyProject'][_0x395c('0x30')],function(_0x490eba){return{'name':_0x490eba[_0x395c('0x31')],'type':_0x490eba[_0x395c('0x32')][_0x395c('0x33')]};});_0xdb4d05['model']=_['map'](_0x3f6a1d,_0x395c('0x2c'));_0xdb4d05[_0x395c('0x34')]=_['keys'](_0x500e15[_0x395c('0x34')]);_0xdb4d05[_0x395c('0x35')]=_[_0x395c('0x36')](_0xdb4d05[_0x395c('0x37')],_0xdb4d05[_0x395c('0x34')]);_0x2625b7[_0x395c('0x38')]=_[_0x395c('0x36')](_0xdb4d05[_0x395c('0x37')],qs[_0x395c('0x39')](_0x500e15[_0x395c('0x34')][_0x395c('0x39')]));_0x2625b7[_0x395c('0x38')]=_0x2625b7[_0x395c('0x38')][_0x395c('0x3a')]?_0x2625b7['attributes']:_0xdb4d05['model'];if(!_0x500e15[_0x395c('0x34')][_0x395c('0x3b')](_0x395c('0x3c'))){_0x2625b7[_0x395c('0x1f')]=qs[_0x395c('0x1f')](_0x500e15[_0x395c('0x34')][_0x395c('0x1f')]);_0x2625b7['offset']=qs[_0x395c('0x1d')](_0x500e15[_0x395c('0x34')][_0x395c('0x1d')]);}_0x2625b7['order']=qs[_0x395c('0x3d')](_0x500e15[_0x395c('0x34')][_0x395c('0x3d')]);_0x2625b7['where']=qs['filters'](_[_0x395c('0x3e')](_0x500e15['query'],_0xdb4d05[_0x395c('0x35')]),_0x3f6a1d);if(_0x500e15[_0x395c('0x34')][_0x395c('0x3f')]){_0x2625b7['where']=_['merge'](_0x2625b7[_0x395c('0x40')],{'$or':_[_0x395c('0x2f')](_0x3f6a1d,function(_0x538f1f){if(_0x538f1f['type']!==_0x395c('0x41')){var _0x3eda71={};_0x3eda71[_0x538f1f[_0x395c('0x2c')]]={'$like':'%'+_0x500e15[_0x395c('0x34')][_0x395c('0x3f')]+'%'};return _0x3eda71;}})});}_0x2625b7=_[_0x395c('0x42')]({},_0x2625b7,_0x500e15['options']);var _0x53cc95={'where':_0x2625b7[_0x395c('0x40')]};return db[_0x395c('0x43')][_0x395c('0x20')](_0x53cc95)['then'](function(_0x232b36){_0x453680['count']=_0x232b36;if(_0x500e15[_0x395c('0x34')][_0x395c('0x44')]){_0x2625b7['include']=[{'all':!![]}];}return db[_0x395c('0x43')][_0x395c('0x45')](_0x2625b7);})[_0x395c('0x26')](function(_0x3d5283){_0x453680[_0x395c('0x46')]=_0x3d5283;return _0x453680;})[_0x395c('0x26')](respondWithFilteredResult(_0x37d82f,_0x2625b7))[_0x395c('0x47')](handleError(_0x37d82f,null));};exports[_0x395c('0x48')]=function(_0x3c373b,_0x1dd5b0){var _0x3c59a2={'raw':![],'where':{'id':_0x3c373b['params']['id']}},_0x5dfba4={};_0x5dfba4['model']=_['keys'](db[_0x395c('0x43')][_0x395c('0x30')]);_0x5dfba4[_0x395c('0x34')]=_[_0x395c('0x49')](_0x3c373b[_0x395c('0x34')]);_0x5dfba4['filters']=_['intersection'](_0x5dfba4[_0x395c('0x37')],_0x5dfba4['query']);_0x3c59a2[_0x395c('0x38')]=_[_0x395c('0x36')](_0x5dfba4[_0x395c('0x37')],qs[_0x395c('0x39')](_0x3c373b[_0x395c('0x34')][_0x395c('0x39')]));_0x3c59a2[_0x395c('0x38')]=_0x3c59a2[_0x395c('0x38')][_0x395c('0x3a')]?_0x3c59a2['attributes']:_0x5dfba4[_0x395c('0x37')];if(_0x3c373b[_0x395c('0x34')][_0x395c('0x44')]){_0x3c59a2[_0x395c('0x4a')]=[{'all':!![]}];}_0x3c59a2=_[_0x395c('0x42')]({},_0x3c59a2,_0x3c373b[_0x395c('0x4b')]);return db['JscriptyProject'][_0x395c('0x4c')](_0x3c59a2)['then'](handleEntityNotFound(_0x1dd5b0,null))[_0x395c('0x26')](respondWithResult(_0x1dd5b0,null))['catch'](handleError(_0x1dd5b0,null));};exports['create']=function(_0xb57e7f,_0x1c0d66){return db[_0x395c('0x43')][_0x395c('0x4d')](_0xb57e7f[_0x395c('0x4e')],{})[_0x395c('0x26')](function(_0x49f0f0){var _0x31ae9a=_0xb57e7f[_0x395c('0x4f')]['get']({'plain':!![]});if(!_0x31ae9a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x31ae9a['role']===_0x395c('0x4f')){var _0x152ea3=_0x49f0f0[_0x395c('0x28')]({'plain':!![]});var _0x52f975=_0x395c('0x50');return db[_0x395c('0x51')][_0x395c('0x4c')]({'where':{'name':_0x52f975,'userProfileId':_0x31ae9a['userProfileId']},'raw':!![]})[_0x395c('0x26')](function(_0x4aa6c1){if(_0x4aa6c1&&_0x4aa6c1[_0x395c('0x52')]===0x0){return db[_0x395c('0x29')][_0x395c('0x4d')]({'name':_0x152ea3[_0x395c('0x2c')],'resourceId':_0x152ea3['id'],'type':_0x4aa6c1['name'],'sectionId':_0x4aa6c1['id']},{})[_0x395c('0x26')](function(){return _0x49f0f0;});}else{return _0x49f0f0;}})[_0x395c('0x47')](function(_0x49431a){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x49431a);throw _0x49431a;});}return _0x49f0f0;})['then'](respondWithResult(_0x1c0d66,0xc9))[_0x395c('0x47')](handleError(_0x1c0d66,null));};exports[_0x395c('0x53')]=function(_0x5b849b,_0x49758e){var _0x5a8889={'where':{'id':_0x5b849b['params']['id']}},_0x31f41b={};_0x31f41b[_0x395c('0x37')]=_[_0x395c('0x49')](db[_0x395c('0x43')]['rawAttributes']);_0x5a8889[_0x395c('0x38')]=_[_0x395c('0x36')](_0x31f41b[_0x395c('0x37')],qs['fields'](_0x5b849b['query'][_0x395c('0x39')]));_0x5a8889['attributes']=_0x5a8889['attributes']['length']?_0x5a8889[_0x395c('0x38')]:_0x31f41b[_0x395c('0x37')];if(_0x5b849b[_0x395c('0x34')][_0x395c('0x44')]){_0x5a8889[_0x395c('0x4a')]=[{'all':!![]}];}_0x5a8889=_[_0x395c('0x42')]({},_0x5a8889,_0x5b849b['options']);return db[_0x395c('0x43')][_0x395c('0x4c')](_0x5a8889)['then'](handleEntityNotFound(_0x49758e,null))[_0x395c('0x26')](function(_0x1819e7){if(_0x1819e7){var _0xc6a834=_0x1819e7[_0x395c('0x28')]({'plain':!![]});_0xc6a834=qs[_0x395c('0x54')](_0xc6a834,['id','createdAt','updatedAt']);_0x5b849b[_0x395c('0x4e')]=_[_0x395c('0x54')](_0x5b849b[_0x395c('0x4e')],['id','createdAt',_0x395c('0x55')]);return db[_0x395c('0x43')]['create'](_[_0x395c('0x42')](_0xc6a834,_0x5b849b['body']),{'include':_0x5b849b[_0x395c('0x34')][_0x395c('0x44')]?[{'all':!![]}]:undefined})[_0x395c('0x26')](function(_0x286e17){var _0x32c356=_0x5b849b[_0x395c('0x4f')][_0x395c('0x28')]({'plain':!![]});if(!_0x32c356)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x32c356['role']==='user'){var _0x307a65=_0x286e17[_0x395c('0x28')]({'plain':!![]});var _0xbb1a7='Projects';return db[_0x395c('0x51')][_0x395c('0x4c')]({'where':{'name':_0xbb1a7,'userProfileId':_0x32c356[_0x395c('0x56')]},'raw':!![]})[_0x395c('0x26')](function(_0x556676){if(_0x556676&&_0x556676[_0x395c('0x52')]===0x0){return db[_0x395c('0x29')]['create']({'name':_0x307a65[_0x395c('0x2c')],'resourceId':_0x307a65['id'],'type':_0x556676[_0x395c('0x2c')],'sectionId':_0x556676['id']},{})[_0x395c('0x26')](function(){return _0x286e17;});}else{return _0x286e17;}})[_0x395c('0x47')](function(_0x361329){logger[_0x395c('0x2a')](_0x395c('0x57'),_0x361329);throw _0x361329;});}return _0x286e17;});}})[_0x395c('0x26')](respondWithResult(_0x49758e,0xc9))[_0x395c('0x47')](handleError(_0x49758e,null));};exports[_0x395c('0x25')]=function(_0x3bda2a,_0x227331){if(_0x3bda2a[_0x395c('0x4e')]['id']){delete _0x3bda2a[_0x395c('0x4e')]['id'];}return db[_0x395c('0x43')][_0x395c('0x4c')]({'where':{'id':_0x3bda2a[_0x395c('0x58')]['id']}})['then'](handleEntityNotFound(_0x227331,null))[_0x395c('0x26')](saveUpdates(_0x3bda2a[_0x395c('0x4e')],null))['then'](respondWithResult(_0x227331,null))[_0x395c('0x47')](handleError(_0x227331,null));};exports[_0x395c('0x27')]=function(_0x42429,_0x3f4522){return db['JscriptyProject']['find']({'where':{'id':_0x42429[_0x395c('0x58')]['id']}})[_0x395c('0x26')](handleEntityNotFound(_0x3f4522,null))['then'](removeEntity(_0x3f4522,null))[_0x395c('0x47')](handleError(_0x3f4522,null));};exports[_0x395c('0x59')]=function(_0x2ea19c,_0xd72304,_0xd5d955){var _0xa8d112={'raw':!![],'where':{}};var _0x21a9a={};var _0x561e5e={'count':0x0,'rows':[]};return db[_0x395c('0x43')]['findOne']({'where':{'id':_0x2ea19c[_0x395c('0x58')]['id']}})[_0x395c('0x26')](handleEntityNotFound(_0xd72304,null))['then'](function(_0x245104){if(_0x245104){_0x21a9a[_0x395c('0x37')]=_[_0x395c('0x49')](db[_0x395c('0x5a')][_0x395c('0x30')]);_0x21a9a[_0x395c('0x34')]=_[_0x395c('0x49')](_0x2ea19c[_0x395c('0x34')]);_0x21a9a[_0x395c('0x35')]=_['intersection'](_0x21a9a[_0x395c('0x37')],_0x21a9a['query']);_0xa8d112[_0x395c('0x38')]=_[_0x395c('0x36')](_0x21a9a[_0x395c('0x37')],qs[_0x395c('0x39')](_0x2ea19c[_0x395c('0x34')][_0x395c('0x39')]));_0xa8d112[_0x395c('0x38')]=_0xa8d112[_0x395c('0x38')][_0x395c('0x3a')]?_0xa8d112[_0x395c('0x38')]:_0x21a9a['model'];if(!_0x2ea19c[_0x395c('0x34')][_0x395c('0x3b')](_0x395c('0x3c'))){_0xa8d112[_0x395c('0x1f')]=qs[_0x395c('0x1f')](_0x2ea19c[_0x395c('0x34')][_0x395c('0x1f')]);_0xa8d112[_0x395c('0x1d')]=qs[_0x395c('0x1d')](_0x2ea19c[_0x395c('0x34')][_0x395c('0x1d')]);}_0xa8d112[_0x395c('0x5b')]=qs[_0x395c('0x3d')](_0x2ea19c[_0x395c('0x34')][_0x395c('0x3d')]);_0xa8d112[_0x395c('0x40')]=qs[_0x395c('0x35')](_[_0x395c('0x3e')](_0x2ea19c[_0x395c('0x34')],_0x21a9a['filters']));_0xa8d112[_0x395c('0x40')]['ProjectId']=_0x245104['id'];if(_0x2ea19c['query'][_0x395c('0x3f')]){_0xa8d112[_0x395c('0x40')]=_[_0x395c('0x42')](_0xa8d112[_0x395c('0x40')],{'$or':_[_0x395c('0x2f')](_0xa8d112[_0x395c('0x38')],function(_0x4449a7){var _0x16cfd9={};_0x16cfd9[_0x4449a7]={'$like':'%'+_0x2ea19c[_0x395c('0x34')][_0x395c('0x3f')]+'%'};return _0x16cfd9;})});}_0xa8d112=_[_0x395c('0x42')]({},_0xa8d112,_0x2ea19c[_0x395c('0x4b')]);return db[_0x395c('0x5a')]['count']({'where':_0xa8d112[_0x395c('0x40')]})[_0x395c('0x26')](function(_0x384d37){_0x561e5e[_0x395c('0x20')]=_0x384d37;if(_0x2ea19c[_0x395c('0x34')][_0x395c('0x44')]){_0xa8d112[_0x395c('0x4a')]=[{'all':!![]}];}return db[_0x395c('0x5a')][_0x395c('0x45')](_0xa8d112);})['then'](function(_0x429758){_0x561e5e[_0x395c('0x46')]=_0x429758;return _0x561e5e;});}})[_0x395c('0x26')](respondWithFilteredResult(_0xd72304,_0xa8d112))[_0x395c('0x47')](handleError(_0xd72304,null));};exports[_0x395c('0x5c')]=function(_0x2132af,_0x315a5d,_0x23b5fe){var _0x4cebe6={'raw':!![],'where':{}};var _0xfe7016={};var _0x5c3d60={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x395c('0x5d')]({'where':{'id':_0x2132af['params']['id']}})['then'](handleEntityNotFound(_0x315a5d,null))['then'](function(_0x16c4c8){if(_0x16c4c8){_0xfe7016['model']=_[_0x395c('0x49')](db[_0x395c('0x5e')][_0x395c('0x30')]);_0xfe7016['query']=_[_0x395c('0x49')](_0x2132af[_0x395c('0x34')]);_0xfe7016[_0x395c('0x35')]=_[_0x395c('0x36')](_0xfe7016['model'],_0xfe7016[_0x395c('0x34')]);_0x4cebe6['attributes']=_['intersection'](_0xfe7016[_0x395c('0x37')],qs['fields'](_0x2132af[_0x395c('0x34')][_0x395c('0x39')]));_0x4cebe6[_0x395c('0x38')]=_0x4cebe6[_0x395c('0x38')][_0x395c('0x3a')]?_0x4cebe6['attributes']:_0xfe7016[_0x395c('0x37')];if(!_0x2132af[_0x395c('0x34')][_0x395c('0x3b')]('nolimit')){_0x4cebe6[_0x395c('0x1f')]=qs[_0x395c('0x1f')](_0x2132af['query'][_0x395c('0x1f')]);_0x4cebe6['offset']=qs[_0x395c('0x1d')](_0x2132af[_0x395c('0x34')][_0x395c('0x1d')]);}_0x4cebe6[_0x395c('0x5b')]=qs['sort'](_0x2132af['query'][_0x395c('0x3d')]);_0x4cebe6[_0x395c('0x40')]=qs[_0x395c('0x35')](_[_0x395c('0x3e')](_0x2132af[_0x395c('0x34')],_0xfe7016[_0x395c('0x35')]));_0x4cebe6[_0x395c('0x40')][_0x395c('0x5f')]=_0x16c4c8['id'];if(_0x2132af[_0x395c('0x34')][_0x395c('0x3f')]){_0x4cebe6[_0x395c('0x40')]=_[_0x395c('0x42')](_0x4cebe6[_0x395c('0x40')],{'$or':_[_0x395c('0x2f')](_0x4cebe6[_0x395c('0x38')],function(_0x487d0a){var _0x2aec6d={};_0x2aec6d[_0x487d0a]={'$like':'%'+_0x2132af[_0x395c('0x34')][_0x395c('0x3f')]+'%'};return _0x2aec6d;})});}_0x4cebe6=_[_0x395c('0x42')]({},_0x4cebe6,_0x2132af['options']);return db[_0x395c('0x5e')][_0x395c('0x20')]({'where':_0x4cebe6[_0x395c('0x40')]})['then'](function(_0x52ecbf){_0x5c3d60[_0x395c('0x20')]=_0x52ecbf;if(_0x2132af[_0x395c('0x34')]['includeAll']){_0x4cebe6[_0x395c('0x4a')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x395c('0x45')](_0x4cebe6);})[_0x395c('0x26')](function(_0x5bb836){_0x5c3d60[_0x395c('0x46')]=_0x5bb836;return _0x5c3d60;});}})['then'](respondWithFilteredResult(_0x315a5d,_0x4cebe6))[_0x395c('0x47')](handleError(_0x315a5d,null));};function char(_0x509b94){return _0x395c('0x60')===typeof _0x509b94?String[_0x395c('0x61')][_0x395c('0x22')](null,arguments):_0x509b94;}function needsEncapsulation(_0x4f54bc){return!!_0x4f54bc&&(_0x4f54bc['toString']()[_0x395c('0x62')](char(0xd))>=0x0||_0x4f54bc[_0x395c('0x63')]()['indexOf'](char(0xa))>=0x0||_0x4f54bc[_0x395c('0x63')]()[_0x395c('0x62')](char(0x2c))>=0x0||_0x4f54bc['toString']()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x1ccfd8){var _0x4082b2=char(0x22),_0x3dd57b='\x5c'+char(0x22),_0x38dc7b=_0x1ccfd8[_0x395c('0x63')]()[_0x395c('0x64')](new RegExp(_0x4082b2,'g'),_0x3dd57b);return _0x4082b2+_0x38dc7b+_0x4082b2;}exports[_0x395c('0x65')]=function(_0x28a880,_0x1d5045,_0x591620){var _0x39e86f,_0xe726ab;var _0x5b5e94={'where':{'ProjectId':_0x28a880[_0x395c('0x58')]['id']}};if(_0x28a880[_0x395c('0x34')][_0x395c('0x66')]){_0x5b5e94[_0x395c('0x40')][_0x395c('0x67')]=JSON[_0x395c('0x68')](_0x28a880[_0x395c('0x34')]['startTime']);}return db[_0x395c('0x5a')]['findAll'](_0x5b5e94)['then'](handleEntityNotFound(_0x1d5045,null))[_0x395c('0x26')](function(_0x36005f){if(_0x36005f){_0x39e86f=_0x36005f;return db[_0x395c('0x69')][_0x395c('0x45')]({'where':{'SessionId':{'$in':_[_0x395c('0x2f')](_0x39e86f,'id')},'ProjectId':_0x28a880['params']['id']},'order':_0x395c('0x6a')});}})[_0x395c('0x26')](handleEntityNotFound(_0x1d5045,null))[_0x395c('0x26')](function(_0x1e5378){if(_0x1e5378){_0xe726ab=_0x1e5378;var _0x485e96={};for(var _0x4a4779=0x0,_0x4cc95e=_0xe726ab['length'];_0x4a4779<_0x4cc95e;_0x4a4779++){if(!_0x485e96[_0x395c('0x3b')](_0xe726ab[_0x4a4779][_0x395c('0x6b')])){_0x485e96[_0xe726ab[_0x4a4779]['questionId']]=needsEncapsulation(_0xe726ab[_0x4a4779][_0x395c('0x6c')])?encapsulate(_0xe726ab[_0x4a4779][_0x395c('0x6c')]):_0xe726ab[_0x4a4779][_0x395c('0x6c')];}}var _0x199e43=[],_0x20b810={};for(var _0x91735b=0x0,_0x586418=_0x39e86f[_0x395c('0x3a')];_0x91735b<_0x586418;_0x91735b++){_0x20b810={'ProjectId':_0x28a880['params']['id'],'SessionId':_0x39e86f[_0x91735b]['id'],'StartTime':moment(_0x39e86f[_0x91735b]['starttime'])[_0x395c('0x6d')](_0x395c('0x6e'))};for(var _0x4ec912=0x0,_0x531d3b=_0xe726ab[_0x395c('0x3a')];_0x4ec912<_0x531d3b;_0x4ec912++){if(_0xe726ab[_0x4ec912][_0x395c('0x6f')]==_0x39e86f[_0x91735b]['id']&&_0x485e96['hasOwnProperty'](_0xe726ab[_0x4ec912][_0x395c('0x6b')])){_0x20b810[_0x485e96[_0xe726ab[_0x4ec912][_0x395c('0x6b')]]]=_0xe726ab[_0x4ec912][_0x395c('0x70')];}}for(var _0x4ba4b8 in _0x485e96){if(!_0x20b810[_0x395c('0x3b')](_0x485e96[_0x4ba4b8])){_0x20b810[_0x485e96[_0x4ba4b8]]=null;}}_0x199e43[_0x395c('0x71')](_0x20b810);}return _0x199e43;}})[_0x395c('0x26')](function(_0x3b7b2a){if(!_[_0x395c('0x72')](_0x3b7b2a)){var _0x20e334=toCsv(_0x3b7b2a);var _0x526987=Date[_0x395c('0x73')]();fs['writeFileSync'](util[_0x395c('0x6d')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x28a880[_0x395c('0x58')]['id'],_0x526987),_0x20e334);_0x1d5045[_0x395c('0x74')](_0x395c('0x75'),_0x395c('0x76')+util[_0x395c('0x6d')]('Jscripty_Project_%d_Summary_%s.csv',_0x28a880[_0x395c('0x58')]['id'],_0x526987));_0x1d5045['setHeader']('Content-type',_0x395c('0x77'));return _0x1d5045['download'](util[_0x395c('0x6d')](_0x395c('0x78'),_0x28a880[_0x395c('0x58')]['id'],_0x526987));}else{return _0x1d5045[_0x395c('0x19')](0xcc);}})[_0x395c('0x47')](handleError(_0x1d5045,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 5ead04d..e81e8a8 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 _0xadf0=['JscriptyProject','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','define'];(function(_0x4067ac,_0x363603){var _0x53d74d=function(_0x492ad4){while(--_0x492ad4){_0x4067ac['push'](_0x4067ac['shift']());}};_0x53d74d(++_0x363603);}(_0xadf0,0x12d));var _0x0adf=function(_0x599a5e,_0x186da8){_0x599a5e=_0x599a5e-0x0;var _0x2c29e5=_0xadf0[_0x599a5e];return _0x2c29e5;};'use strict';var _=require('lodash');var util=require(_0x0adf('0x0'));var logger=require(_0x0adf('0x1'))(_0x0adf('0x2'));var moment=require(_0x0adf('0x3'));var BPromise=require(_0x0adf('0x4'));var rp=require(_0x0adf('0x5'));var fs=require('fs');var path=require(_0x0adf('0x6'));var rimraf=require('rimraf');var config=require(_0x0adf('0x7'));var attributes=require('./jscriptyProject.attributes');module['exports']=function(_0x5b01b9,_0x516b05){return _0x5b01b9[_0x0adf('0x8')](_0x0adf('0x9'),attributes,{'tableName':'jscripty_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6011=['jscripty_projects','bluebird','request-promise','rimraf','../../config/environment','./jscriptyProject.attributes','exports','define','JscriptyProject'];(function(_0x754ab4,_0x56daa7){var _0x34079a=function(_0x295ec1){while(--_0x295ec1){_0x754ab4['push'](_0x754ab4['shift']());}};_0x34079a(++_0x56daa7);}(_0x6011,0x196));var _0x1601=function(_0x25557,_0x17fb11){_0x25557=_0x25557-0x0;var _0x4b1815=_0x6011[_0x25557];return _0x4b1815;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x1601('0x0'));var rp=require(_0x1601('0x1'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1601('0x2'));var config=require(_0x1601('0x3'));var attributes=require(_0x1601('0x4'));module[_0x1601('0x5')]=function(_0x3c9c29,_0x38cc43){return _0x3c9c29[_0x1601('0x6')](_0x1601('0x7'),attributes,{'tableName':_0x1601('0x8'),'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 21f713c..f20828f 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 _0x54ef=['result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message'];(function(_0x4d1e90,_0x58536f){var _0x427263=function(_0x1d5f39){while(--_0x1d5f39){_0x4d1e90['push'](_0x4d1e90['shift']());}};_0x427263(++_0x58536f);}(_0x54ef,0x112));var _0xf54e=function(_0x3565c2,_0x41d17d){_0x3565c2=_0x3565c2-0x0;var _0x18a620=_0x54ef[_0x3565c2];return _0x18a620;};'use strict';var _=require(_0xf54e('0x0'));var util=require(_0xf54e('0x1'));var moment=require(_0xf54e('0x2'));var BPromise=require('bluebird');var rs=require(_0xf54e('0x3'));var fs=require('fs');var Redis=require(_0xf54e('0x4'));var db=require(_0xf54e('0x5'))['db'];var utils=require(_0xf54e('0x6'));var logger=require(_0xf54e('0x7'))(_0xf54e('0x8'));var config=require(_0xf54e('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf54e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x99cf9,_0x2464ae,_0x561870){return new BPromise(function(_0x27e69b,_0x57a1ce){return client[_0xf54e('0xb')](_0x99cf9,_0x561870)[_0xf54e('0xc')](function(_0x47c5e1){logger[_0xf54e('0xd')](_0xf54e('0xe'),_0x2464ae,_0xf54e('0xf'));logger[_0xf54e('0x10')]('JscriptyProject,\x20%s,\x20%s,\x20%s',_0x2464ae,_0xf54e('0xf'),JSON[_0xf54e('0x11')](_0x47c5e1));if(_0x47c5e1[_0xf54e('0x12')]){if(_0x47c5e1[_0xf54e('0x12')]['code']===0x1f4){logger[_0xf54e('0x12')]('JscriptyProject,\x20%s,\x20%s',_0x2464ae,_0x47c5e1['error'][_0xf54e('0x13')]);return _0x57a1ce(_0x47c5e1[_0xf54e('0x12')][_0xf54e('0x13')]);}logger[_0xf54e('0x12')]('JscriptyProject,\x20%s,\x20%s',_0x2464ae,_0x47c5e1[_0xf54e('0x12')][_0xf54e('0x13')]);return _0x27e69b(_0x47c5e1[_0xf54e('0x12')][_0xf54e('0x13')]);}else{logger['info'](_0xf54e('0xe'),_0x2464ae,_0xf54e('0xf'));_0x27e69b(_0x47c5e1[_0xf54e('0x14')]['message']);}})['catch'](function(_0xd87020){logger[_0xf54e('0x12')](_0xf54e('0xe'),_0x2464ae,_0xd87020);_0x57a1ce(_0xd87020);});});} \ No newline at end of file +var _0x54ef=['result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message'];(function(_0x51957b,_0x14fd19){var _0x397e68=function(_0x57a6f0){while(--_0x57a6f0){_0x51957b['push'](_0x51957b['shift']());}};_0x397e68(++_0x14fd19);}(_0x54ef,0x112));var _0xf54e=function(_0x2098c6,_0x4aacaa){_0x2098c6=_0x2098c6-0x0;var _0x52d251=_0x54ef[_0x2098c6];return _0x52d251;};'use strict';var _=require(_0xf54e('0x0'));var util=require(_0xf54e('0x1'));var moment=require(_0xf54e('0x2'));var BPromise=require('bluebird');var rs=require(_0xf54e('0x3'));var fs=require('fs');var Redis=require(_0xf54e('0x4'));var db=require(_0xf54e('0x5'))['db'];var utils=require(_0xf54e('0x6'));var logger=require(_0xf54e('0x7'))(_0xf54e('0x8'));var config=require(_0xf54e('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf54e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x99cf9,_0x2464ae,_0x561870){return new BPromise(function(_0x27e69b,_0x57a1ce){return client[_0xf54e('0xb')](_0x99cf9,_0x561870)[_0xf54e('0xc')](function(_0x47c5e1){logger[_0xf54e('0xd')](_0xf54e('0xe'),_0x2464ae,_0xf54e('0xf'));logger[_0xf54e('0x10')]('JscriptyProject,\x20%s,\x20%s,\x20%s',_0x2464ae,_0xf54e('0xf'),JSON[_0xf54e('0x11')](_0x47c5e1));if(_0x47c5e1[_0xf54e('0x12')]){if(_0x47c5e1[_0xf54e('0x12')]['code']===0x1f4){logger[_0xf54e('0x12')]('JscriptyProject,\x20%s,\x20%s',_0x2464ae,_0x47c5e1['error'][_0xf54e('0x13')]);return _0x57a1ce(_0x47c5e1[_0xf54e('0x12')][_0xf54e('0x13')]);}logger[_0xf54e('0x12')]('JscriptyProject,\x20%s,\x20%s',_0x2464ae,_0x47c5e1[_0xf54e('0x12')][_0xf54e('0x13')]);return _0x27e69b(_0x47c5e1[_0xf54e('0x12')][_0xf54e('0x13')]);}else{logger['info'](_0xf54e('0xe'),_0x2464ae,_0xf54e('0xf'));_0x27e69b(_0x47c5e1[_0xf54e('0x14')]['message']);}})['catch'](function(_0xd87020){logger[_0xf54e('0x12')](_0xf54e('0xe'),_0x2464ae,_0xd87020);_0x57a1ce(_0xd87020);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index c263b1e..8903f58 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 _0x76f2=['/:id','show','post','create','put','update','delete','destroy','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','/describe','describe'];(function(_0x5286b4,_0x1d0d05){var _0x2b7fa9=function(_0x45eb15){while(--_0x45eb15){_0x5286b4['push'](_0x5286b4['shift']());}};_0x2b7fa9(++_0x1d0d05);}(_0x76f2,0x184));var _0x276f=function(_0x3b0c7d,_0x366c62){_0x3b0c7d=_0x3b0c7d-0x0;var _0x342b64=_0x76f2[_0x3b0c7d];return _0x342b64;};'use strict';var multer=require('multer');var util=require(_0x276f('0x0'));var path=require(_0x276f('0x1'));var timeout=require(_0x276f('0x2'));var express=require('express');var router=express[_0x276f('0x3')]();var fs_extra=require(_0x276f('0x4'));var auth=require(_0x276f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x276f('0x6'));var controller=require('./jscriptyQuestionReport.controller');router['get']('/',auth[_0x276f('0x7')](),controller[_0x276f('0x8')]);router['get'](_0x276f('0x9'),auth[_0x276f('0x7')](),controller[_0x276f('0xa')]);router['get'](_0x276f('0xb'),auth[_0x276f('0x7')](),controller[_0x276f('0xc')]);router[_0x276f('0xd')]('/',auth['isAuthenticated'](),controller[_0x276f('0xe')]);router[_0x276f('0xf')]('/:id',auth[_0x276f('0x7')](),controller[_0x276f('0x10')]);router[_0x276f('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x276f('0x12')]);module['exports']=router; \ No newline at end of file +var _0xbbb4=['./jscriptyQuestionReport.controller','get','/describe','describe','isAuthenticated','show','post','put','delete','/:id','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x1cf3d9,_0x2a9ac0){var _0x48afba=function(_0x1ea106){while(--_0x1ea106){_0x1cf3d9['push'](_0x1cf3d9['shift']());}};_0x48afba(++_0x2a9ac0);}(_0xbbb4,0x19a));var _0x4bbb=function(_0x293be8,_0x1f43e1){_0x293be8=_0x293be8-0x0;var _0x10f4b8=_0xbbb4[_0x293be8];return _0x10f4b8;};'use strict';var multer=require(_0x4bbb('0x0'));var util=require(_0x4bbb('0x1'));var path=require(_0x4bbb('0x2'));var timeout=require(_0x4bbb('0x3'));var express=require(_0x4bbb('0x4'));var router=express['Router']();var fs_extra=require(_0x4bbb('0x5'));var auth=require(_0x4bbb('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4bbb('0x7'));var controller=require(_0x4bbb('0x8'));router[_0x4bbb('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x4bbb('0xa'),auth['isAuthenticated'](),controller[_0x4bbb('0xb')]);router['get']('/:id',auth[_0x4bbb('0xc')](),controller[_0x4bbb('0xd')]);router[_0x4bbb('0xe')]('/',auth[_0x4bbb('0xc')](),controller['create']);router[_0x4bbb('0xf')]('/:id',auth[_0x4bbb('0xc')](),controller['update']);router[_0x4bbb('0x10')](_0x4bbb('0x11'),auth[_0x4bbb('0xc')](),controller['destroy']);module[_0x4bbb('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 90ea25d..85b3c57 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(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x7a54,0x106));var _0x47a5=function(_0x537af8,_0x17d66e){_0x537af8=_0x537af8-0x0;var _0x25b234=_0x7a54[_0x537af8];return _0x25b234;};'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(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0x7a54,0x106));var _0x47a5=function(_0x2e93f7,_0x33e09a){_0x2e93f7=_0x2e93f7-0x0;var _0x163bc7=_0x7a54[_0x2e93f7];return _0x163bc7;};'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 23a9e86..af9198b 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 _0x0171=['body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','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','end','json','offset','limit','set','Content-Range','reject','update','then','destroy','error','name','send','map','rawAttributes','fieldName','type','query','filters','intersection','model','attributes','fields','order','where','filter','VIRTUAL','merge','options','count','includeAll','include','JscriptyQuestionReport','findAll','rows','show','params','keys','length','find','catch','create'];(function(_0x4a7b64,_0x16733c){var _0x500da6=function(_0x3454da){while(--_0x3454da){_0x4a7b64['push'](_0x4a7b64['shift']());}};_0x500da6(++_0x16733c);}(_0x0171,0xe0));var _0x1017=function(_0x497403,_0x14ae9b){_0x497403=_0x497403-0x0;var _0x14ace7=_0x0171[_0x497403];return _0x14ace7;};'use strict';var emlformat=require(_0x1017('0x0'));var rimraf=require(_0x1017('0x1'));var zipdir=require(_0x1017('0x2'));var jsonpatch=require(_0x1017('0x3'));var rp=require('request-promise');var moment=require(_0x1017('0x4'));var BPromise=require(_0x1017('0x5'));var Mustache=require(_0x1017('0x6'));var util=require(_0x1017('0x7'));var path=require(_0x1017('0x8'));var sox=require(_0x1017('0x9'));var csv=require(_0x1017('0xa'));var ejs=require(_0x1017('0xb'));var fs=require('fs');var fs_extra=require(_0x1017('0xc'));var _=require(_0x1017('0xd'));var squel=require(_0x1017('0xe'));var crypto=require(_0x1017('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1017('0xa'));var querystring=require(_0x1017('0x10'));var Papa=require(_0x1017('0x11'));var Redis=require(_0x1017('0x12'));var authService=require(_0x1017('0x13'));var qs=require(_0x1017('0x14'));var as=require(_0x1017('0x15'));var hardwareService=require(_0x1017('0x16'));var logger=require(_0x1017('0x17'))('api');var utils=require(_0x1017('0x18'));var config=require(_0x1017('0x19'));var licenseUtil=require(_0x1017('0x1a'));var db=require(_0x1017('0x1b'))['db'];function respondWithStatusCode(_0x3f3a7c,_0x4ffe8b){_0x4ffe8b=_0x4ffe8b||0xcc;return function(_0x394695){if(_0x394695){return _0x3f3a7c[_0x1017('0x1c')](_0x4ffe8b);}return _0x3f3a7c[_0x1017('0x1d')](_0x4ffe8b)[_0x1017('0x1e')]();};}function respondWithResult(_0x239e5d,_0xb98a50){_0xb98a50=_0xb98a50||0xc8;return function(_0xfe6927){if(_0xfe6927){return _0x239e5d[_0x1017('0x1d')](_0xb98a50)[_0x1017('0x1f')](_0xfe6927);}};}function respondWithFilteredResult(_0x379557,_0x32ba1f){return function(_0x4132b6){if(_0x4132b6){var _0x3d57a9=typeof _0x32ba1f[_0x1017('0x20')]==='undefined'&&typeof _0x32ba1f[_0x1017('0x21')]==='undefined';var _0x43a97a=_0x4132b6['count'];var _0x344020=_0x3d57a9?0x0:_0x32ba1f[_0x1017('0x20')];var _0x834cc3=_0x3d57a9?_0x4132b6['count']:_0x32ba1f[_0x1017('0x20')]+_0x32ba1f['limit'];var _0x33c78c;if(_0x834cc3>=_0x43a97a){_0x834cc3=_0x43a97a;_0x33c78c=0xc8;}else{_0x33c78c=0xce;}_0x379557['status'](_0x33c78c);return _0x379557[_0x1017('0x22')](_0x1017('0x23'),_0x344020+'-'+_0x834cc3+'/'+_0x43a97a)[_0x1017('0x1f')](_0x4132b6);}return null;};}function patchUpdates(_0x42d1d1){return function(_0x18f338){try{jsonpatch['apply'](_0x18f338,_0x42d1d1,!![]);}catch(_0x242b6c){return BPromise[_0x1017('0x24')](_0x242b6c);}return _0x18f338['save']();};}function saveUpdates(_0x2c2c67,_0x173f8c){return function(_0x3c4df4){if(_0x3c4df4){return _0x3c4df4[_0x1017('0x25')](_0x2c2c67)[_0x1017('0x26')](function(_0x3af002){return _0x3af002;});}return null;};}function removeEntity(_0x2f34a7,_0x4920fb){return function(_0x3d9741){if(_0x3d9741){return _0x3d9741[_0x1017('0x27')]()['then'](function(){_0x2f34a7[_0x1017('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ae7e4,_0x3cca3b){return function(_0x3e6d74){if(!_0x3e6d74){_0x4ae7e4['sendStatus'](0x194);}return _0x3e6d74;};}function handleError(_0x37028a,_0x32e420){_0x32e420=_0x32e420||0x1f4;return function(_0x2fd4ab){logger[_0x1017('0x28')](_0x2fd4ab['stack']);if(_0x2fd4ab[_0x1017('0x29')]){delete _0x2fd4ab[_0x1017('0x29')];}_0x37028a[_0x1017('0x1d')](_0x32e420)[_0x1017('0x2a')](_0x2fd4ab);};}exports['index']=function(_0x519ad7,_0x2cb2b4){var _0x55621b={},_0x27d349={},_0x81a020={'count':0x0,'rows':[]};var _0x5af889=_[_0x1017('0x2b')](db['JscriptyQuestionReport'][_0x1017('0x2c')],function(_0x5bdfee){return{'name':_0x5bdfee[_0x1017('0x2d')],'type':_0x5bdfee[_0x1017('0x2e')]['key']};});_0x27d349['model']=_[_0x1017('0x2b')](_0x5af889,_0x1017('0x29'));_0x27d349[_0x1017('0x2f')]=_['keys'](_0x519ad7[_0x1017('0x2f')]);_0x27d349[_0x1017('0x30')]=_[_0x1017('0x31')](_0x27d349[_0x1017('0x32')],_0x27d349['query']);_0x55621b[_0x1017('0x33')]=_[_0x1017('0x31')](_0x27d349['model'],qs[_0x1017('0x34')](_0x519ad7[_0x1017('0x2f')][_0x1017('0x34')]));_0x55621b['attributes']=_0x55621b[_0x1017('0x33')]['length']?_0x55621b[_0x1017('0x33')]:_0x27d349[_0x1017('0x32')];if(!_0x519ad7[_0x1017('0x2f')]['hasOwnProperty']('nolimit')){_0x55621b[_0x1017('0x21')]=qs[_0x1017('0x21')](_0x519ad7['query']['limit']);_0x55621b[_0x1017('0x20')]=qs['offset'](_0x519ad7['query'][_0x1017('0x20')]);}_0x55621b[_0x1017('0x35')]=qs['sort'](_0x519ad7['query']['sort']);_0x55621b[_0x1017('0x36')]=qs[_0x1017('0x30')](_['pick'](_0x519ad7[_0x1017('0x2f')],_0x27d349['filters']),_0x5af889);if(_0x519ad7[_0x1017('0x2f')][_0x1017('0x37')]){_0x55621b['where']=_['merge'](_0x55621b[_0x1017('0x36')],{'$or':_[_0x1017('0x2b')](_0x5af889,function(_0x496f97){if(_0x496f97[_0x1017('0x2e')]!==_0x1017('0x38')){var _0x45303b={};_0x45303b[_0x496f97['name']]={'$like':'%'+_0x519ad7['query']['filter']+'%'};return _0x45303b;}})});}_0x55621b=_[_0x1017('0x39')]({},_0x55621b,_0x519ad7[_0x1017('0x3a')]);var _0x10d1e3={'where':_0x55621b[_0x1017('0x36')]};return db['JscriptyQuestionReport'][_0x1017('0x3b')](_0x10d1e3)[_0x1017('0x26')](function(_0x36e518){_0x81a020['count']=_0x36e518;if(_0x519ad7[_0x1017('0x2f')][_0x1017('0x3c')]){_0x55621b[_0x1017('0x3d')]=[{'all':!![]}];}return db[_0x1017('0x3e')][_0x1017('0x3f')](_0x55621b);})['then'](function(_0x2995dd){_0x81a020[_0x1017('0x40')]=_0x2995dd;return _0x81a020;})[_0x1017('0x26')](respondWithFilteredResult(_0x2cb2b4,_0x55621b))['catch'](handleError(_0x2cb2b4,null));};exports[_0x1017('0x41')]=function(_0x15b60f,_0x411589){var _0x746469={'raw':!![],'where':{'id':_0x15b60f[_0x1017('0x42')]['id']}},_0xf4282d={};_0xf4282d[_0x1017('0x32')]=_[_0x1017('0x43')](db['JscriptyQuestionReport']['rawAttributes']);_0xf4282d[_0x1017('0x2f')]=_['keys'](_0x15b60f['query']);_0xf4282d['filters']=_[_0x1017('0x31')](_0xf4282d[_0x1017('0x32')],_0xf4282d[_0x1017('0x2f')]);_0x746469[_0x1017('0x33')]=_[_0x1017('0x31')](_0xf4282d[_0x1017('0x32')],qs['fields'](_0x15b60f[_0x1017('0x2f')][_0x1017('0x34')]));_0x746469[_0x1017('0x33')]=_0x746469[_0x1017('0x33')][_0x1017('0x44')]?_0x746469[_0x1017('0x33')]:_0xf4282d[_0x1017('0x32')];if(_0x15b60f['query'][_0x1017('0x3c')]){_0x746469[_0x1017('0x3d')]=[{'all':!![]}];}_0x746469=_['merge']({},_0x746469,_0x15b60f[_0x1017('0x3a')]);return db[_0x1017('0x3e')][_0x1017('0x45')](_0x746469)[_0x1017('0x26')](handleEntityNotFound(_0x411589,null))[_0x1017('0x26')](respondWithResult(_0x411589,null))[_0x1017('0x46')](handleError(_0x411589,null));};exports[_0x1017('0x47')]=function(_0x5f0cce,_0x501532){return db[_0x1017('0x3e')][_0x1017('0x47')](_0x5f0cce[_0x1017('0x48')],{})[_0x1017('0x26')](respondWithResult(_0x501532,0xc9))['catch'](handleError(_0x501532,null));};exports[_0x1017('0x25')]=function(_0x50eaf1,_0x1bf2c5){if(_0x50eaf1[_0x1017('0x48')]['id']){delete _0x50eaf1['body']['id'];}return db[_0x1017('0x3e')][_0x1017('0x45')]({'where':{'id':_0x50eaf1[_0x1017('0x42')]['id']}})[_0x1017('0x26')](handleEntityNotFound(_0x1bf2c5,null))[_0x1017('0x26')](saveUpdates(_0x50eaf1[_0x1017('0x48')],null))[_0x1017('0x26')](respondWithResult(_0x1bf2c5,null))[_0x1017('0x46')](handleError(_0x1bf2c5,null));};exports[_0x1017('0x27')]=function(_0x1214ed,_0x2d2dad){return db[_0x1017('0x3e')]['find']({'where':{'id':_0x1214ed[_0x1017('0x42')]['id']}})[_0x1017('0x26')](handleEntityNotFound(_0x2d2dad,null))[_0x1017('0x26')](removeEntity(_0x2d2dad,null))[_0x1017('0x46')](handleError(_0x2d2dad,null));};exports['describe']=function(_0x3fcb5e,_0x9286cc){return db[_0x1017('0x3e')][_0x1017('0x49')]()['then'](respondWithResult(_0x9286cc,null))[_0x1017('0x46')](handleError(_0x9286cc,null));}; \ No newline at end of file +var _0xd733=['intersection','fields','length','nolimit','sort','where','filters','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','create','body','find','describe','eml-format','fast-json-patch','request-promise','mustache','util','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','end','json','offset','limit','undefined','count','status','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','index','map','JscriptyQuestionReport','rawAttributes','key','model','query','attributes'];(function(_0x1d1aa9,_0x840a39){var _0x33f1d9=function(_0xd41ba5){while(--_0xd41ba5){_0x1d1aa9['push'](_0x1d1aa9['shift']());}};_0x33f1d9(++_0x840a39);}(_0xd733,0xeb));var _0x3d73=function(_0x4521e3,_0x10a8a4){_0x4521e3=_0x4521e3-0x0;var _0x46a272=_0xd733[_0x4521e3];return _0x46a272;};'use strict';var emlformat=require(_0x3d73('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3d73('0x1'));var rp=require(_0x3d73('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3d73('0x3'));var util=require(_0x3d73('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x3d73('0x5'));var ejs=require(_0x3d73('0x6'));var fs=require('fs');var fs_extra=require(_0x3d73('0x7'));var _=require(_0x3d73('0x8'));var squel=require(_0x3d73('0x9'));var crypto=require(_0x3d73('0xa'));var jsforce=require(_0x3d73('0xb'));var deskjs=require(_0x3d73('0xc'));var toCsv=require(_0x3d73('0x5'));var querystring=require(_0x3d73('0xd'));var Papa=require('papaparse');var Redis=require(_0x3d73('0xe'));var authService=require(_0x3d73('0xf'));var qs=require(_0x3d73('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3d73('0x11'));var logger=require(_0x3d73('0x12'))(_0x3d73('0x13'));var utils=require(_0x3d73('0x14'));var config=require(_0x3d73('0x15'));var licenseUtil=require(_0x3d73('0x16'));var db=require(_0x3d73('0x17'))['db'];function respondWithStatusCode(_0x1638b1,_0x2c171c){_0x2c171c=_0x2c171c||0xcc;return function(_0x1eb945){if(_0x1eb945){return _0x1638b1['sendStatus'](_0x2c171c);}return _0x1638b1['status'](_0x2c171c)[_0x3d73('0x18')]();};}function respondWithResult(_0x2a10e2,_0x1bb7ef){_0x1bb7ef=_0x1bb7ef||0xc8;return function(_0x33d588){if(_0x33d588){return _0x2a10e2['status'](_0x1bb7ef)[_0x3d73('0x19')](_0x33d588);}};}function respondWithFilteredResult(_0x292b75,_0x9cdae6){return function(_0x2e7dc8){if(_0x2e7dc8){var _0x5dd171=typeof _0x9cdae6[_0x3d73('0x1a')]==='undefined'&&typeof _0x9cdae6[_0x3d73('0x1b')]===_0x3d73('0x1c');var _0x5914c9=_0x2e7dc8[_0x3d73('0x1d')];var _0x1246f5=_0x5dd171?0x0:_0x9cdae6['offset'];var _0x5c86ca=_0x5dd171?_0x2e7dc8['count']:_0x9cdae6[_0x3d73('0x1a')]+_0x9cdae6[_0x3d73('0x1b')];var _0x22ff2b;if(_0x5c86ca>=_0x5914c9){_0x5c86ca=_0x5914c9;_0x22ff2b=0xc8;}else{_0x22ff2b=0xce;}_0x292b75[_0x3d73('0x1e')](_0x22ff2b);return _0x292b75['set'](_0x3d73('0x1f'),_0x1246f5+'-'+_0x5c86ca+'/'+_0x5914c9)[_0x3d73('0x19')](_0x2e7dc8);}return null;};}function patchUpdates(_0x260aee){return function(_0x2cf04a){try{jsonpatch[_0x3d73('0x20')](_0x2cf04a,_0x260aee,!![]);}catch(_0x3b1d4f){return BPromise[_0x3d73('0x21')](_0x3b1d4f);}return _0x2cf04a['save']();};}function saveUpdates(_0x5f77d1,_0x4fcd82){return function(_0x718bfe){if(_0x718bfe){return _0x718bfe[_0x3d73('0x22')](_0x5f77d1)[_0x3d73('0x23')](function(_0x3976dc){return _0x3976dc;});}return null;};}function removeEntity(_0x49693b,_0x2a22aa){return function(_0x4ca3e7){if(_0x4ca3e7){return _0x4ca3e7[_0x3d73('0x24')]()[_0x3d73('0x23')](function(){_0x49693b[_0x3d73('0x1e')](0xcc)[_0x3d73('0x18')]();});}};}function handleEntityNotFound(_0x5a2305,_0x111607){return function(_0x18e9bd){if(!_0x18e9bd){_0x5a2305[_0x3d73('0x25')](0x194);}return _0x18e9bd;};}function handleError(_0x1af58b,_0x37d238){_0x37d238=_0x37d238||0x1f4;return function(_0x82dfe9){logger[_0x3d73('0x26')](_0x82dfe9[_0x3d73('0x27')]);if(_0x82dfe9[_0x3d73('0x28')]){delete _0x82dfe9[_0x3d73('0x28')];}_0x1af58b[_0x3d73('0x1e')](_0x37d238)['send'](_0x82dfe9);};}exports[_0x3d73('0x29')]=function(_0x258cab,_0x352d92){var _0x7ffc0f={},_0x1f28a3={},_0x51ee78={'count':0x0,'rows':[]};var _0x2c5ae4=_[_0x3d73('0x2a')](db[_0x3d73('0x2b')][_0x3d73('0x2c')],function(_0x2e4112){return{'name':_0x2e4112['fieldName'],'type':_0x2e4112['type'][_0x3d73('0x2d')]};});_0x1f28a3[_0x3d73('0x2e')]=_[_0x3d73('0x2a')](_0x2c5ae4,_0x3d73('0x28'));_0x1f28a3[_0x3d73('0x2f')]=_['keys'](_0x258cab['query']);_0x1f28a3['filters']=_['intersection'](_0x1f28a3['model'],_0x1f28a3[_0x3d73('0x2f')]);_0x7ffc0f[_0x3d73('0x30')]=_[_0x3d73('0x31')](_0x1f28a3[_0x3d73('0x2e')],qs[_0x3d73('0x32')](_0x258cab[_0x3d73('0x2f')][_0x3d73('0x32')]));_0x7ffc0f[_0x3d73('0x30')]=_0x7ffc0f[_0x3d73('0x30')][_0x3d73('0x33')]?_0x7ffc0f[_0x3d73('0x30')]:_0x1f28a3[_0x3d73('0x2e')];if(!_0x258cab['query']['hasOwnProperty'](_0x3d73('0x34'))){_0x7ffc0f[_0x3d73('0x1b')]=qs[_0x3d73('0x1b')](_0x258cab[_0x3d73('0x2f')]['limit']);_0x7ffc0f['offset']=qs['offset'](_0x258cab[_0x3d73('0x2f')]['offset']);}_0x7ffc0f['order']=qs[_0x3d73('0x35')](_0x258cab['query'][_0x3d73('0x35')]);_0x7ffc0f[_0x3d73('0x36')]=qs['filters'](_['pick'](_0x258cab[_0x3d73('0x2f')],_0x1f28a3[_0x3d73('0x37')]),_0x2c5ae4);if(_0x258cab[_0x3d73('0x2f')][_0x3d73('0x38')]){_0x7ffc0f[_0x3d73('0x36')]=_[_0x3d73('0x39')](_0x7ffc0f['where'],{'$or':_[_0x3d73('0x2a')](_0x2c5ae4,function(_0x4fd6e7){if(_0x4fd6e7[_0x3d73('0x3a')]!==_0x3d73('0x3b')){var _0x23ea7a={};_0x23ea7a[_0x4fd6e7[_0x3d73('0x28')]]={'$like':'%'+_0x258cab[_0x3d73('0x2f')][_0x3d73('0x38')]+'%'};return _0x23ea7a;}})});}_0x7ffc0f=_['merge']({},_0x7ffc0f,_0x258cab[_0x3d73('0x3c')]);var _0x4b6c3f={'where':_0x7ffc0f['where']};return db[_0x3d73('0x2b')][_0x3d73('0x1d')](_0x4b6c3f)[_0x3d73('0x23')](function(_0x59d406){_0x51ee78['count']=_0x59d406;if(_0x258cab['query'][_0x3d73('0x3d')]){_0x7ffc0f[_0x3d73('0x3e')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x3d73('0x3f')](_0x7ffc0f);})[_0x3d73('0x23')](function(_0x35d7f2){_0x51ee78[_0x3d73('0x40')]=_0x35d7f2;return _0x51ee78;})[_0x3d73('0x23')](respondWithFilteredResult(_0x352d92,_0x7ffc0f))[_0x3d73('0x41')](handleError(_0x352d92,null));};exports['show']=function(_0x2aeb87,_0x212ec1){var _0x13d504={'raw':!![],'where':{'id':_0x2aeb87[_0x3d73('0x42')]['id']}},_0x173c9b={};_0x173c9b[_0x3d73('0x2e')]=_['keys'](db[_0x3d73('0x2b')][_0x3d73('0x2c')]);_0x173c9b['query']=_['keys'](_0x2aeb87['query']);_0x173c9b[_0x3d73('0x37')]=_['intersection'](_0x173c9b[_0x3d73('0x2e')],_0x173c9b[_0x3d73('0x2f')]);_0x13d504[_0x3d73('0x30')]=_[_0x3d73('0x31')](_0x173c9b[_0x3d73('0x2e')],qs[_0x3d73('0x32')](_0x2aeb87[_0x3d73('0x2f')][_0x3d73('0x32')]));_0x13d504['attributes']=_0x13d504[_0x3d73('0x30')]['length']?_0x13d504[_0x3d73('0x30')]:_0x173c9b[_0x3d73('0x2e')];if(_0x2aeb87[_0x3d73('0x2f')][_0x3d73('0x3d')]){_0x13d504[_0x3d73('0x3e')]=[{'all':!![]}];}_0x13d504=_[_0x3d73('0x39')]({},_0x13d504,_0x2aeb87[_0x3d73('0x3c')]);return db[_0x3d73('0x2b')]['find'](_0x13d504)['then'](handleEntityNotFound(_0x212ec1,null))['then'](respondWithResult(_0x212ec1,null))[_0x3d73('0x41')](handleError(_0x212ec1,null));};exports['create']=function(_0x40ccc2,_0x46409b){return db[_0x3d73('0x2b')][_0x3d73('0x43')](_0x40ccc2[_0x3d73('0x44')],{})[_0x3d73('0x23')](respondWithResult(_0x46409b,0xc9))[_0x3d73('0x41')](handleError(_0x46409b,null));};exports[_0x3d73('0x22')]=function(_0x2bf9b3,_0x3c1915){if(_0x2bf9b3['body']['id']){delete _0x2bf9b3['body']['id'];}return db[_0x3d73('0x2b')][_0x3d73('0x45')]({'where':{'id':_0x2bf9b3[_0x3d73('0x42')]['id']}})['then'](handleEntityNotFound(_0x3c1915,null))[_0x3d73('0x23')](saveUpdates(_0x2bf9b3[_0x3d73('0x44')],null))['then'](respondWithResult(_0x3c1915,null))[_0x3d73('0x41')](handleError(_0x3c1915,null));};exports[_0x3d73('0x24')]=function(_0x5b851e,_0x299530){return db[_0x3d73('0x2b')]['find']({'where':{'id':_0x5b851e[_0x3d73('0x42')]['id']}})[_0x3d73('0x23')](handleEntityNotFound(_0x299530,null))['then'](removeEntity(_0x299530,null))[_0x3d73('0x41')](handleError(_0x299530,null));};exports['describe']=function(_0x2eb5f2,_0x329bb5){return db[_0x3d73('0x2b')][_0x3d73('0x46')]()[_0x3d73('0x23')](respondWithResult(_0x329bb5,null))[_0x3d73('0x41')](handleError(_0x329bb5,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index dfd88a7..cc6ca7b 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 _0x0b0e=['./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5a726e,_0x165940){var _0x3c70e4=function(_0x11b65d){while(--_0x11b65d){_0x5a726e['push'](_0x5a726e['shift']());}};_0x3c70e4(++_0x165940);}(_0x0b0e,0x13c));var _0xe0b0=function(_0x1699e9,_0x1f2652){_0x1699e9=_0x1699e9-0x0;var _0x14b104=_0x0b0e[_0x1699e9];return _0x14b104;};'use strict';var _=require('lodash');var util=require(_0xe0b0('0x0'));var logger=require(_0xe0b0('0x1'))(_0xe0b0('0x2'));var moment=require(_0xe0b0('0x3'));var BPromise=require(_0xe0b0('0x4'));var rp=require(_0xe0b0('0x5'));var fs=require('fs');var path=require(_0xe0b0('0x6'));var rimraf=require(_0xe0b0('0x7'));var config=require(_0xe0b0('0x8'));var attributes=require(_0xe0b0('0x9'));module[_0xe0b0('0xa')]=function(_0x36de9e,_0x1efff9){return _0x36de9e[_0xe0b0('0xb')](_0xe0b0('0xc'),attributes,{'tableName':'report_jscripty_questions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x20ca=['JscriptyQuestionReport','report_jscripty_questions','lodash','util','../../config/logger','api','moment','bluebird','rimraf','./jscriptyQuestionReport.attributes','exports','define'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x20ca,0x9e));var _0xa20c=function(_0x2c2c0e,_0x42a636){_0x2c2c0e=_0x2c2c0e-0x0;var _0x126380=_0x20ca[_0x2c2c0e];return _0x126380;};'use strict';var _=require(_0xa20c('0x0'));var util=require(_0xa20c('0x1'));var logger=require(_0xa20c('0x2'))(_0xa20c('0x3'));var moment=require(_0xa20c('0x4'));var BPromise=require(_0xa20c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa20c('0x6'));var config=require('../../config/environment');var attributes=require(_0xa20c('0x7'));module[_0xa20c('0x8')]=function(_0x3f66c0,_0x1e0334){return _0x3f66c0[_0xa20c('0x9')](_0xa20c('0xa'),attributes,{'tableName':_0xa20c('0xb'),'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 a7fdaa2..2bf6ca8 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 _0x4aaf=['JscriptyQuestionReport,\x20%s,\x20%s','message','catch','util','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x73313f,_0x51ea6d){var _0x388218=function(_0x5943dd){while(--_0x5943dd){_0x73313f['push'](_0x73313f['shift']());}};_0x388218(++_0x51ea6d);}(_0x4aaf,0x1a7));var _0xf4aa=function(_0x1dd038,_0xc6ea1c){_0x1dd038=_0x1dd038-0x0;var _0x2ce62b=_0x4aaf[_0x1dd038];return _0x2ce62b;};'use strict';var _=require('lodash');var util=require(_0xf4aa('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf4aa('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0xf4aa('0x2'));var logger=require(_0xf4aa('0x3'))(_0xf4aa('0x4'));var config=require(_0xf4aa('0x5'));var jayson=require(_0xf4aa('0x6'));var client=jayson[_0xf4aa('0x7')][_0xf4aa('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x164b5e,_0x223231,_0x319eb4){return new BPromise(function(_0x4b86c6,_0x29c4d0){return client[_0xf4aa('0x9')](_0x164b5e,_0x319eb4)[_0xf4aa('0xa')](function(_0x563775){logger[_0xf4aa('0xb')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x223231,_0xf4aa('0xc'));logger[_0xf4aa('0xd')](_0xf4aa('0xe'),_0x223231,_0xf4aa('0xc'),JSON[_0xf4aa('0xf')](_0x563775));if(_0x563775[_0xf4aa('0x10')]){if(_0x563775[_0xf4aa('0x10')]['code']===0x1f4){logger[_0xf4aa('0x10')](_0xf4aa('0x11'),_0x223231,_0x563775['error'][_0xf4aa('0x12')]);return _0x29c4d0(_0x563775[_0xf4aa('0x10')][_0xf4aa('0x12')]);}logger[_0xf4aa('0x10')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x223231,_0x563775[_0xf4aa('0x10')][_0xf4aa('0x12')]);return _0x4b86c6(_0x563775[_0xf4aa('0x10')][_0xf4aa('0x12')]);}else{logger[_0xf4aa('0xb')](_0xf4aa('0x11'),_0x223231,_0xf4aa('0xc'));_0x4b86c6(_0x563775['result'][_0xf4aa('0x12')]);}})[_0xf4aa('0x13')](function(_0x2a621e){logger['error'](_0xf4aa('0x11'),_0x223231,_0x2a621e);_0x29c4d0(_0x2a621e);});});} \ No newline at end of file +var _0x9231=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util'];(function(_0x2cf084,_0x4c7b5b){var _0x3b35b7=function(_0xe9d208){while(--_0xe9d208){_0x2cf084['push'](_0x2cf084['shift']());}};_0x3b35b7(++_0x4c7b5b);}(_0x9231,0x144));var _0x1923=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9231[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x1923('0x0'));var moment=require(_0x1923('0x1'));var BPromise=require(_0x1923('0x2'));var rs=require(_0x1923('0x3'));var fs=require('fs');var Redis=require(_0x1923('0x4'));var db=require(_0x1923('0x5'))['db'];var utils=require(_0x1923('0x6'));var logger=require(_0x1923('0x7'))(_0x1923('0x8'));var config=require(_0x1923('0x9'));var jayson=require(_0x1923('0xa'));var client=jayson[_0x1923('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x44bcb2,_0x404193,_0x29ff45){return new BPromise(function(_0x3295ad,_0x21ef75){return client[_0x1923('0xc')](_0x44bcb2,_0x29ff45)[_0x1923('0xd')](function(_0x240fc9){logger[_0x1923('0xe')](_0x1923('0xf'),_0x404193,_0x1923('0x10'));logger[_0x1923('0x11')](_0x1923('0x12'),_0x404193,_0x1923('0x10'),JSON[_0x1923('0x13')](_0x240fc9));if(_0x240fc9[_0x1923('0x14')]){if(_0x240fc9['error'][_0x1923('0x15')]===0x1f4){logger[_0x1923('0x14')](_0x1923('0xf'),_0x404193,_0x240fc9['error'][_0x1923('0x16')]);return _0x21ef75(_0x240fc9['error'][_0x1923('0x16')]);}logger[_0x1923('0x14')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x404193,_0x240fc9[_0x1923('0x14')][_0x1923('0x16')]);return _0x3295ad(_0x240fc9[_0x1923('0x14')][_0x1923('0x16')]);}else{logger[_0x1923('0xe')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x404193,_0x1923('0x10'));_0x3295ad(_0x240fc9[_0x1923('0x17')]['message']);}})[_0x1923('0x18')](function(_0x278c02){logger['error'](_0x1923('0xf'),_0x404193,_0x278c02);_0x21ef75(_0x278c02);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 40ffd43..3c03712 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 _0x51dd=['create','update','delete','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/describe','/:id','show','/:id/questions'];(function(_0x1c62ab,_0x68fbdf){var _0x21c46c=function(_0x59608e){while(--_0x59608e){_0x1c62ab['push'](_0x1c62ab['shift']());}};_0x21c46c(++_0x68fbdf);}(_0x51dd,0x1f2));var _0xd51d=function(_0x4bbc3a,_0x3a6945){_0x4bbc3a=_0x4bbc3a-0x0;var _0x579d56=_0x51dd[_0x4bbc3a];return _0x579d56;};'use strict';var multer=require(_0xd51d('0x0'));var util=require(_0xd51d('0x1'));var path=require('path');var timeout=require(_0xd51d('0x2'));var express=require(_0xd51d('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xd51d('0x4'));var interaction=require(_0xd51d('0x5'));var config=require('../../config/environment');var controller=require('./jscriptySessionReport.controller');router[_0xd51d('0x6')]('/',auth[_0xd51d('0x7')](),controller['index']);router[_0xd51d('0x6')](_0xd51d('0x8'),auth['isAuthenticated'](),controller['describe']);router[_0xd51d('0x6')](_0xd51d('0x9'),auth['isAuthenticated'](),controller[_0xd51d('0xa')]);router['get'](_0xd51d('0xb'),auth[_0xd51d('0x7')](),controller['getQuestions']);router['post']('/',auth[_0xd51d('0x7')](),controller[_0xd51d('0xc')]);router['put'](_0xd51d('0x9'),auth[_0xd51d('0x7')](),controller[_0xd51d('0xd')]);router[_0xd51d('0xe')]('/:id',auth[_0xd51d('0x7')](),controller[_0xd51d('0xf')]);module[_0xd51d('0x10')]=router; \ No newline at end of file +var _0x19ae=['/:id','/:id/questions','post','create','put','update','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','./jscriptySessionReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0x19ae,0xdb));var _0xe19a=function(_0x1f4218,_0x237ef2){_0x1f4218=_0x1f4218-0x0;var _0x3aab14=_0x19ae[_0x1f4218];return _0x3aab14;};'use strict';var multer=require(_0xe19a('0x0'));var util=require('util');var path=require(_0xe19a('0x1'));var timeout=require('connect-timeout');var express=require(_0xe19a('0x2'));var router=express[_0xe19a('0x3')]();var fs_extra=require(_0xe19a('0x4'));var auth=require(_0xe19a('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xe19a('0x6'));router[_0xe19a('0x7')]('/',auth[_0xe19a('0x8')](),controller[_0xe19a('0x9')]);router[_0xe19a('0x7')](_0xe19a('0xa'),auth[_0xe19a('0x8')](),controller[_0xe19a('0xb')]);router['get'](_0xe19a('0xc'),auth[_0xe19a('0x8')](),controller['show']);router['get'](_0xe19a('0xd'),auth[_0xe19a('0x8')](),controller['getQuestions']);router[_0xe19a('0xe')]('/',auth[_0xe19a('0x8')](),controller[_0xe19a('0xf')]);router[_0xe19a('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xe19a('0x11')]);router[_0xe19a('0x12')](_0xe19a('0xc'),auth[_0xe19a('0x8')](),controller[_0xe19a('0x13')]);module[_0xe19a('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index c39d8e8..574a7ea 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 _0x8558=['DATE','STRING','BOOLEAN','moment','sequelize','exports','setDataValue','endtime','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x32cc8c,_0x45e37b){var _0xd9df6=function(_0x350b99){while(--_0x350b99){_0x32cc8c['push'](_0x32cc8c['shift']());}};_0xd9df6(++_0x45e37b);}(_0x8558,0x1b1));var _0x8855=function(_0xd9c06b,_0x43b095){_0xd9c06b=_0xd9c06b-0x0;var _0x393435=_0x8558[_0xd9c06b];return _0x393435;};'use strict';var moment=require(_0x8855('0x0'));var Sequelize=require(_0x8855('0x1'));module[_0x8855('0x2')]={'starttime':{'type':Sequelize['DATE'],'set':function(_0x40dad9){this[_0x8855('0x3')]('starttime',_0x40dad9);this['setDataValue'](_0x8855('0x4'),moment()[_0x8855('0x5')](_0x8855('0x6')));}},'endtime':{'type':Sequelize[_0x8855('0x7')]},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x8855('0x8')]},'calleridnum':{'type':Sequelize[_0x8855('0x8')]},'completed':{'type':Sequelize[_0x8855('0x9')],'defaultValue':![]}}; \ No newline at end of file +var _0xdb67=['starttime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','sequelize','exports','DATE','setDataValue'];(function(_0x3bdd2a,_0x194dca){var _0x27201a=function(_0xebebcd){while(--_0xebebcd){_0x3bdd2a['push'](_0x3bdd2a['shift']());}};_0x27201a(++_0x194dca);}(_0xdb67,0x15b));var _0x7db6=function(_0x3c1009,_0x50413f){_0x3c1009=_0x3c1009-0x0;var _0x2322ec=_0xdb67[_0x3c1009];return _0x2322ec;};'use strict';var moment=require('moment');var Sequelize=require(_0x7db6('0x0'));module[_0x7db6('0x1')]={'starttime':{'type':Sequelize[_0x7db6('0x2')],'set':function(_0x203169){this[_0x7db6('0x3')](_0x7db6('0x4'),_0x203169);this['setDataValue']('endtime',moment()[_0x7db6('0x5')](_0x7db6('0x6')));}},'endtime':{'type':Sequelize[_0x7db6('0x2')]},'membername':{'type':Sequelize[_0x7db6('0x7')]},'projectname':{'type':Sequelize[_0x7db6('0x7')]},'queue':{'type':Sequelize[_0x7db6('0x7')]},'uniqueid':{'type':Sequelize[_0x7db6('0x7')]},'calleridname':{'type':Sequelize[_0x7db6('0x7')]},'calleridnum':{'type':Sequelize[_0x7db6('0x7')]},'completed':{'type':Sequelize[_0x7db6('0x8')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 0f03d4d..c21f686 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 _0xd4c4=['model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','params','rawAttributes','find','catch','create','body','destroy','describe','getQuestions','findOne','JscriptyQuestionReport','hasOwnProperty','SessionId','include','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','limit','count','offset','set','Content-Range','reject','update','then','error','name','send','map','JscriptySessionReport','fieldName','type','key'];(function(_0x5f265e,_0x5f29c3){var _0x197592=function(_0x2b02d3){while(--_0x2b02d3){_0x5f265e['push'](_0x5f265e['shift']());}};_0x197592(++_0x5f29c3);}(_0xd4c4,0xb5));var _0x4d4c=function(_0x1e6e39,_0x3c98ed){_0x1e6e39=_0x1e6e39-0x0;var _0x2d9029=_0xd4c4[_0x1e6e39];return _0x2d9029;};'use strict';var emlformat=require(_0x4d4c('0x0'));var rimraf=require(_0x4d4c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4d4c('0x2'));var rp=require(_0x4d4c('0x3'));var moment=require(_0x4d4c('0x4'));var BPromise=require(_0x4d4c('0x5'));var Mustache=require(_0x4d4c('0x6'));var util=require(_0x4d4c('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4d4c('0x8'));var crypto=require(_0x4d4c('0x9'));var jsforce=require(_0x4d4c('0xa'));var deskjs=require(_0x4d4c('0xb'));var toCsv=require(_0x4d4c('0xc'));var querystring=require(_0x4d4c('0xd'));var Papa=require('papaparse');var Redis=require(_0x4d4c('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x4d4c('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4d4c('0x10'))(_0x4d4c('0x11'));var utils=require(_0x4d4c('0x12'));var config=require(_0x4d4c('0x13'));var licenseUtil=require(_0x4d4c('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1ca727,_0x4838be){_0x4838be=_0x4838be||0xcc;return function(_0x25b798){if(_0x25b798){return _0x1ca727[_0x4d4c('0x15')](_0x4838be);}return _0x1ca727[_0x4d4c('0x16')](_0x4838be)[_0x4d4c('0x17')]();};}function respondWithResult(_0x520bc6,_0x3430fb){_0x3430fb=_0x3430fb||0xc8;return function(_0x39551b){if(_0x39551b){return _0x520bc6[_0x4d4c('0x16')](_0x3430fb)[_0x4d4c('0x18')](_0x39551b);}};}function respondWithFilteredResult(_0xcf153f,_0x53038){return function(_0x17c134){if(_0x17c134){var _0x1143a6=typeof _0x53038['offset']==='undefined'&&typeof _0x53038[_0x4d4c('0x19')]==='undefined';var _0x3b460c=_0x17c134['count'];var _0x1d8140=_0x1143a6?0x0:_0x53038['offset'];var _0x4462fb=_0x1143a6?_0x17c134[_0x4d4c('0x1a')]:_0x53038[_0x4d4c('0x1b')]+_0x53038['limit'];var _0x3f7e23;if(_0x4462fb>=_0x3b460c){_0x4462fb=_0x3b460c;_0x3f7e23=0xc8;}else{_0x3f7e23=0xce;}_0xcf153f[_0x4d4c('0x16')](_0x3f7e23);return _0xcf153f[_0x4d4c('0x1c')](_0x4d4c('0x1d'),_0x1d8140+'-'+_0x4462fb+'/'+_0x3b460c)[_0x4d4c('0x18')](_0x17c134);}return null;};}function patchUpdates(_0x15c0ac){return function(_0x411aaf){try{jsonpatch['apply'](_0x411aaf,_0x15c0ac,!![]);}catch(_0x3eeaf2){return BPromise[_0x4d4c('0x1e')](_0x3eeaf2);}return _0x411aaf['save']();};}function saveUpdates(_0x445946,_0x11a470){return function(_0x5c76e1){if(_0x5c76e1){return _0x5c76e1[_0x4d4c('0x1f')](_0x445946)[_0x4d4c('0x20')](function(_0x35e320){return _0x35e320;});}return null;};}function removeEntity(_0x6f7ef7,_0x394f1b){return function(_0x55bc9e){if(_0x55bc9e){return _0x55bc9e['destroy']()[_0x4d4c('0x20')](function(){_0x6f7ef7['status'](0xcc)[_0x4d4c('0x17')]();});}};}function handleEntityNotFound(_0x3ab86a,_0x22fe8e){return function(_0x112805){if(!_0x112805){_0x3ab86a[_0x4d4c('0x15')](0x194);}return _0x112805;};}function handleError(_0x55beaa,_0x43cbd4){_0x43cbd4=_0x43cbd4||0x1f4;return function(_0x1e9e56){logger[_0x4d4c('0x21')](_0x1e9e56['stack']);if(_0x1e9e56[_0x4d4c('0x22')]){delete _0x1e9e56['name'];}_0x55beaa[_0x4d4c('0x16')](_0x43cbd4)[_0x4d4c('0x23')](_0x1e9e56);};}exports['index']=function(_0x3dbf72,_0x56e128){var _0x272933={},_0x274c8d={},_0x159967={'count':0x0,'rows':[]};var _0x28d9be=_[_0x4d4c('0x24')](db[_0x4d4c('0x25')]['rawAttributes'],function(_0x1726d5){return{'name':_0x1726d5[_0x4d4c('0x26')],'type':_0x1726d5[_0x4d4c('0x27')][_0x4d4c('0x28')]};});_0x274c8d[_0x4d4c('0x29')]=_[_0x4d4c('0x24')](_0x28d9be,'name');_0x274c8d[_0x4d4c('0x2a')]=_[_0x4d4c('0x2b')](_0x3dbf72[_0x4d4c('0x2a')]);_0x274c8d[_0x4d4c('0x2c')]=_[_0x4d4c('0x2d')](_0x274c8d['model'],_0x274c8d[_0x4d4c('0x2a')]);_0x272933[_0x4d4c('0x2e')]=_[_0x4d4c('0x2d')](_0x274c8d[_0x4d4c('0x29')],qs[_0x4d4c('0x2f')](_0x3dbf72['query'][_0x4d4c('0x2f')]));_0x272933[_0x4d4c('0x2e')]=_0x272933[_0x4d4c('0x2e')][_0x4d4c('0x30')]?_0x272933[_0x4d4c('0x2e')]:_0x274c8d[_0x4d4c('0x29')];if(!_0x3dbf72[_0x4d4c('0x2a')]['hasOwnProperty'](_0x4d4c('0x31'))){_0x272933[_0x4d4c('0x19')]=qs[_0x4d4c('0x19')](_0x3dbf72[_0x4d4c('0x2a')][_0x4d4c('0x19')]);_0x272933[_0x4d4c('0x1b')]=qs[_0x4d4c('0x1b')](_0x3dbf72[_0x4d4c('0x2a')]['offset']);}_0x272933[_0x4d4c('0x32')]=qs[_0x4d4c('0x33')](_0x3dbf72[_0x4d4c('0x2a')][_0x4d4c('0x33')]);_0x272933[_0x4d4c('0x34')]=qs['filters'](_[_0x4d4c('0x35')](_0x3dbf72[_0x4d4c('0x2a')],_0x274c8d['filters']),_0x28d9be);if(_0x3dbf72[_0x4d4c('0x2a')][_0x4d4c('0x36')]){_0x272933['where']=_[_0x4d4c('0x37')](_0x272933[_0x4d4c('0x34')],{'$or':_[_0x4d4c('0x24')](_0x28d9be,function(_0x676d13){if(_0x676d13['type']!==_0x4d4c('0x38')){var _0x519077={};_0x519077[_0x676d13[_0x4d4c('0x22')]]={'$like':'%'+_0x3dbf72[_0x4d4c('0x2a')][_0x4d4c('0x36')]+'%'};return _0x519077;}})});}_0x272933=_['merge']({},_0x272933,_0x3dbf72[_0x4d4c('0x39')]);var _0x30cc5c={'where':_0x272933['where']};return db[_0x4d4c('0x25')][_0x4d4c('0x1a')](_0x30cc5c)['then'](function(_0x3ff1ef){_0x159967[_0x4d4c('0x1a')]=_0x3ff1ef;if(_0x3dbf72[_0x4d4c('0x2a')][_0x4d4c('0x3a')]){_0x272933['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0x4d4c('0x3b')](_0x272933);})[_0x4d4c('0x20')](function(_0x5a4abe){_0x159967['rows']=_0x5a4abe;return _0x159967;})[_0x4d4c('0x20')](respondWithFilteredResult(_0x56e128,_0x272933))['catch'](handleError(_0x56e128,null));};exports['show']=function(_0x6c4a7a,_0x10cd38){var _0x285caa={'raw':!![],'where':{'id':_0x6c4a7a[_0x4d4c('0x3c')]['id']}},_0x5c3869={};_0x5c3869[_0x4d4c('0x29')]=_[_0x4d4c('0x2b')](db[_0x4d4c('0x25')][_0x4d4c('0x3d')]);_0x5c3869[_0x4d4c('0x2a')]=_[_0x4d4c('0x2b')](_0x6c4a7a[_0x4d4c('0x2a')]);_0x5c3869[_0x4d4c('0x2c')]=_[_0x4d4c('0x2d')](_0x5c3869[_0x4d4c('0x29')],_0x5c3869[_0x4d4c('0x2a')]);_0x285caa[_0x4d4c('0x2e')]=_[_0x4d4c('0x2d')](_0x5c3869[_0x4d4c('0x29')],qs[_0x4d4c('0x2f')](_0x6c4a7a['query'][_0x4d4c('0x2f')]));_0x285caa['attributes']=_0x285caa[_0x4d4c('0x2e')][_0x4d4c('0x30')]?_0x285caa[_0x4d4c('0x2e')]:_0x5c3869['model'];if(_0x6c4a7a[_0x4d4c('0x2a')][_0x4d4c('0x3a')]){_0x285caa['include']=[{'all':!![]}];}_0x285caa=_[_0x4d4c('0x37')]({},_0x285caa,_0x6c4a7a[_0x4d4c('0x39')]);return db[_0x4d4c('0x25')][_0x4d4c('0x3e')](_0x285caa)[_0x4d4c('0x20')](handleEntityNotFound(_0x10cd38,null))[_0x4d4c('0x20')](respondWithResult(_0x10cd38,null))[_0x4d4c('0x3f')](handleError(_0x10cd38,null));};exports['create']=function(_0x4335b4,_0x4d605d){return db['JscriptySessionReport'][_0x4d4c('0x40')](_0x4335b4[_0x4d4c('0x41')],{})['then'](respondWithResult(_0x4d605d,0xc9))[_0x4d4c('0x3f')](handleError(_0x4d605d,null));};exports['update']=function(_0x2fb267,_0x50c0e7){if(_0x2fb267['body']['id']){delete _0x2fb267[_0x4d4c('0x41')]['id'];}return db[_0x4d4c('0x25')][_0x4d4c('0x3e')]({'where':{'id':_0x2fb267['params']['id']}})[_0x4d4c('0x20')](handleEntityNotFound(_0x50c0e7,null))['then'](saveUpdates(_0x2fb267[_0x4d4c('0x41')],null))['then'](respondWithResult(_0x50c0e7,null))[_0x4d4c('0x3f')](handleError(_0x50c0e7,null));};exports[_0x4d4c('0x42')]=function(_0x2e15ba,_0x426ee8){return db[_0x4d4c('0x25')][_0x4d4c('0x3e')]({'where':{'id':_0x2e15ba[_0x4d4c('0x3c')]['id']}})[_0x4d4c('0x20')](handleEntityNotFound(_0x426ee8,null))[_0x4d4c('0x20')](removeEntity(_0x426ee8,null))[_0x4d4c('0x3f')](handleError(_0x426ee8,null));};exports['describe']=function(_0x4b42fb,_0xc673e6){return db['JscriptySessionReport'][_0x4d4c('0x43')]()[_0x4d4c('0x20')](respondWithResult(_0xc673e6,null))[_0x4d4c('0x3f')](handleError(_0xc673e6,null));};exports[_0x4d4c('0x44')]=function(_0x2992be,_0x5596c0,_0x191df4){var _0x357d8f={'raw':!![],'where':{}};var _0x3d4d34={};var _0x3b225a={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0x4d4c('0x45')]({'where':{'id':_0x2992be[_0x4d4c('0x3c')]['id']}})['then'](handleEntityNotFound(_0x5596c0,null))[_0x4d4c('0x20')](function(_0x32f997){if(_0x32f997){_0x3d4d34[_0x4d4c('0x29')]=_[_0x4d4c('0x2b')](db[_0x4d4c('0x46')][_0x4d4c('0x3d')]);_0x3d4d34['query']=_[_0x4d4c('0x2b')](_0x2992be['query']);_0x3d4d34[_0x4d4c('0x2c')]=_[_0x4d4c('0x2d')](_0x3d4d34['model'],_0x3d4d34[_0x4d4c('0x2a')]);_0x357d8f[_0x4d4c('0x2e')]=_[_0x4d4c('0x2d')](_0x3d4d34[_0x4d4c('0x29')],qs[_0x4d4c('0x2f')](_0x2992be[_0x4d4c('0x2a')][_0x4d4c('0x2f')]));_0x357d8f[_0x4d4c('0x2e')]=_0x357d8f[_0x4d4c('0x2e')]['length']?_0x357d8f[_0x4d4c('0x2e')]:_0x3d4d34[_0x4d4c('0x29')];if(!_0x2992be[_0x4d4c('0x2a')][_0x4d4c('0x47')]('nolimit')){_0x357d8f['limit']=qs[_0x4d4c('0x19')](_0x2992be['query'][_0x4d4c('0x19')]);_0x357d8f[_0x4d4c('0x1b')]=qs[_0x4d4c('0x1b')](_0x2992be[_0x4d4c('0x2a')][_0x4d4c('0x1b')]);}_0x357d8f[_0x4d4c('0x32')]=qs[_0x4d4c('0x33')](_0x2992be[_0x4d4c('0x2a')]['sort']);_0x357d8f[_0x4d4c('0x34')]=qs[_0x4d4c('0x2c')](_[_0x4d4c('0x35')](_0x2992be['query'],_0x3d4d34['filters']));_0x357d8f[_0x4d4c('0x34')][_0x4d4c('0x48')]=_0x32f997['id'];if(_0x2992be[_0x4d4c('0x2a')][_0x4d4c('0x36')]){_0x357d8f[_0x4d4c('0x34')]=_[_0x4d4c('0x37')](_0x357d8f['where'],{'$or':_[_0x4d4c('0x24')](_0x357d8f[_0x4d4c('0x2e')],function(_0x31682e){var _0x3a8e6e={};_0x3a8e6e[_0x31682e]={'$like':'%'+_0x2992be['query'][_0x4d4c('0x36')]+'%'};return _0x3a8e6e;})});}_0x357d8f=_['merge']({},_0x357d8f,_0x2992be[_0x4d4c('0x39')]);return db[_0x4d4c('0x46')][_0x4d4c('0x1a')]({'where':_0x357d8f[_0x4d4c('0x34')]})[_0x4d4c('0x20')](function(_0x401cce){_0x3b225a[_0x4d4c('0x1a')]=_0x401cce;if(_0x2992be['query'][_0x4d4c('0x3a')]){_0x357d8f[_0x4d4c('0x49')]=[{'all':!![]}];}return db[_0x4d4c('0x46')][_0x4d4c('0x3b')](_0x357d8f);})[_0x4d4c('0x20')](function(_0x1dd68d){_0x3b225a['rows']=_0x1dd68d;return _0x3b225a;});}})['then'](respondWithFilteredResult(_0x5596c0,_0x357d8f))[_0x4d4c('0x3f')](handleError(_0x5596c0,null));}; \ No newline at end of file +var _0x3578=['set','Content-Range','json','apply','save','then','sendStatus','error','stack','name','send','index','map','JscriptySessionReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','options','include','catch','show','params','includeAll','create','body','update','destroy','find','getQuestions','findOne','JscriptyQuestionReport','SessionId','filter','findAll','rows','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','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','status','end','undefined','limit','count','offset'];(function(_0x4c05da,_0x414720){var _0x1614db=function(_0xa19cf6){while(--_0xa19cf6){_0x4c05da['push'](_0x4c05da['shift']());}};_0x1614db(++_0x414720);}(_0x3578,0x1cc));var _0x8357=function(_0x19e57f,_0x4ae750){_0x19e57f=_0x19e57f-0x0;var _0x469556=_0x3578[_0x19e57f];return _0x469556;};'use strict';var emlformat=require(_0x8357('0x0'));var rimraf=require(_0x8357('0x1'));var zipdir=require(_0x8357('0x2'));var jsonpatch=require(_0x8357('0x3'));var rp=require('request-promise');var moment=require(_0x8357('0x4'));var BPromise=require(_0x8357('0x5'));var Mustache=require(_0x8357('0x6'));var util=require(_0x8357('0x7'));var path=require(_0x8357('0x8'));var sox=require(_0x8357('0x9'));var csv=require('to-csv');var ejs=require(_0x8357('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x8357('0xb'));var jsforce=require(_0x8357('0xc'));var deskjs=require(_0x8357('0xd'));var toCsv=require(_0x8357('0xe'));var querystring=require(_0x8357('0xf'));var Papa=require(_0x8357('0x10'));var Redis=require(_0x8357('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x8357('0x12'));var as=require(_0x8357('0x13'));var hardwareService=require(_0x8357('0x14'));var logger=require(_0x8357('0x15'))(_0x8357('0x16'));var utils=require(_0x8357('0x17'));var config=require(_0x8357('0x18'));var licenseUtil=require(_0x8357('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3cfc06,_0x336e21){_0x336e21=_0x336e21||0xcc;return function(_0x8e5d97){if(_0x8e5d97){return _0x3cfc06['sendStatus'](_0x336e21);}return _0x3cfc06[_0x8357('0x1a')](_0x336e21)[_0x8357('0x1b')]();};}function respondWithResult(_0x936398,_0x961728){_0x961728=_0x961728||0xc8;return function(_0x26c47c){if(_0x26c47c){return _0x936398[_0x8357('0x1a')](_0x961728)['json'](_0x26c47c);}};}function respondWithFilteredResult(_0x3a6bd,_0x46887d){return function(_0x2b6477){if(_0x2b6477){var _0x3cfb7b=typeof _0x46887d['offset']===_0x8357('0x1c')&&typeof _0x46887d[_0x8357('0x1d')]===_0x8357('0x1c');var _0x2dddde=_0x2b6477[_0x8357('0x1e')];var _0x4009e6=_0x3cfb7b?0x0:_0x46887d[_0x8357('0x1f')];var _0x3df45b=_0x3cfb7b?_0x2b6477['count']:_0x46887d['offset']+_0x46887d[_0x8357('0x1d')];var _0x3bfd4b;if(_0x3df45b>=_0x2dddde){_0x3df45b=_0x2dddde;_0x3bfd4b=0xc8;}else{_0x3bfd4b=0xce;}_0x3a6bd['status'](_0x3bfd4b);return _0x3a6bd[_0x8357('0x20')](_0x8357('0x21'),_0x4009e6+'-'+_0x3df45b+'/'+_0x2dddde)[_0x8357('0x22')](_0x2b6477);}return null;};}function patchUpdates(_0x2970e3){return function(_0xa208f5){try{jsonpatch[_0x8357('0x23')](_0xa208f5,_0x2970e3,!![]);}catch(_0x39b62b){return BPromise['reject'](_0x39b62b);}return _0xa208f5[_0x8357('0x24')]();};}function saveUpdates(_0x1112f3,_0x3bdd79){return function(_0x59751c){if(_0x59751c){return _0x59751c['update'](_0x1112f3)[_0x8357('0x25')](function(_0x38814a){return _0x38814a;});}return null;};}function removeEntity(_0x45e066,_0x10e91e){return function(_0x164c2d){if(_0x164c2d){return _0x164c2d['destroy']()['then'](function(){_0x45e066[_0x8357('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x485157,_0x401ea7){return function(_0x201a45){if(!_0x201a45){_0x485157[_0x8357('0x26')](0x194);}return _0x201a45;};}function handleError(_0x801bd1,_0x3d6838){_0x3d6838=_0x3d6838||0x1f4;return function(_0x7b5571){logger[_0x8357('0x27')](_0x7b5571[_0x8357('0x28')]);if(_0x7b5571[_0x8357('0x29')]){delete _0x7b5571[_0x8357('0x29')];}_0x801bd1[_0x8357('0x1a')](_0x3d6838)[_0x8357('0x2a')](_0x7b5571);};}exports[_0x8357('0x2b')]=function(_0x42e774,_0x5401cd){var _0x169746={},_0x80173d={},_0x327b2f={'count':0x0,'rows':[]};var _0x331c51=_[_0x8357('0x2c')](db[_0x8357('0x2d')][_0x8357('0x2e')],function(_0x44147f){return{'name':_0x44147f['fieldName'],'type':_0x44147f[_0x8357('0x2f')][_0x8357('0x30')]};});_0x80173d[_0x8357('0x31')]=_[_0x8357('0x2c')](_0x331c51,_0x8357('0x29'));_0x80173d[_0x8357('0x32')]=_[_0x8357('0x33')](_0x42e774[_0x8357('0x32')]);_0x80173d[_0x8357('0x34')]=_[_0x8357('0x35')](_0x80173d[_0x8357('0x31')],_0x80173d[_0x8357('0x32')]);_0x169746[_0x8357('0x36')]=_['intersection'](_0x80173d[_0x8357('0x31')],qs[_0x8357('0x37')](_0x42e774[_0x8357('0x32')][_0x8357('0x37')]));_0x169746[_0x8357('0x36')]=_0x169746['attributes'][_0x8357('0x38')]?_0x169746[_0x8357('0x36')]:_0x80173d['model'];if(!_0x42e774[_0x8357('0x32')][_0x8357('0x39')](_0x8357('0x3a'))){_0x169746[_0x8357('0x1d')]=qs[_0x8357('0x1d')](_0x42e774[_0x8357('0x32')][_0x8357('0x1d')]);_0x169746['offset']=qs[_0x8357('0x1f')](_0x42e774['query'][_0x8357('0x1f')]);}_0x169746[_0x8357('0x3b')]=qs[_0x8357('0x3c')](_0x42e774[_0x8357('0x32')][_0x8357('0x3c')]);_0x169746[_0x8357('0x3d')]=qs['filters'](_[_0x8357('0x3e')](_0x42e774[_0x8357('0x32')],_0x80173d[_0x8357('0x34')]),_0x331c51);if(_0x42e774[_0x8357('0x32')]['filter']){_0x169746[_0x8357('0x3d')]=_[_0x8357('0x3f')](_0x169746[_0x8357('0x3d')],{'$or':_[_0x8357('0x2c')](_0x331c51,function(_0x558b88){if(_0x558b88[_0x8357('0x2f')]!=='VIRTUAL'){var _0x3d5297={};_0x3d5297[_0x558b88['name']]={'$like':'%'+_0x42e774[_0x8357('0x32')]['filter']+'%'};return _0x3d5297;}})});}_0x169746=_[_0x8357('0x3f')]({},_0x169746,_0x42e774[_0x8357('0x40')]);var _0x5898b7={'where':_0x169746[_0x8357('0x3d')]};return db[_0x8357('0x2d')][_0x8357('0x1e')](_0x5898b7)[_0x8357('0x25')](function(_0x16d7f9){_0x327b2f[_0x8357('0x1e')]=_0x16d7f9;if(_0x42e774[_0x8357('0x32')]['includeAll']){_0x169746[_0x8357('0x41')]=[{'all':!![]}];}return db['JscriptySessionReport']['findAll'](_0x169746);})[_0x8357('0x25')](function(_0x14be23){_0x327b2f['rows']=_0x14be23;return _0x327b2f;})[_0x8357('0x25')](respondWithFilteredResult(_0x5401cd,_0x169746))[_0x8357('0x42')](handleError(_0x5401cd,null));};exports[_0x8357('0x43')]=function(_0x65d918,_0x4b5c6){var _0x458027={'raw':!![],'where':{'id':_0x65d918[_0x8357('0x44')]['id']}},_0xf66813={};_0xf66813['model']=_['keys'](db[_0x8357('0x2d')][_0x8357('0x2e')]);_0xf66813[_0x8357('0x32')]=_['keys'](_0x65d918[_0x8357('0x32')]);_0xf66813['filters']=_['intersection'](_0xf66813[_0x8357('0x31')],_0xf66813[_0x8357('0x32')]);_0x458027['attributes']=_[_0x8357('0x35')](_0xf66813[_0x8357('0x31')],qs[_0x8357('0x37')](_0x65d918[_0x8357('0x32')][_0x8357('0x37')]));_0x458027[_0x8357('0x36')]=_0x458027['attributes'][_0x8357('0x38')]?_0x458027[_0x8357('0x36')]:_0xf66813[_0x8357('0x31')];if(_0x65d918[_0x8357('0x32')][_0x8357('0x45')]){_0x458027['include']=[{'all':!![]}];}_0x458027=_['merge']({},_0x458027,_0x65d918['options']);return db[_0x8357('0x2d')]['find'](_0x458027)[_0x8357('0x25')](handleEntityNotFound(_0x4b5c6,null))['then'](respondWithResult(_0x4b5c6,null))[_0x8357('0x42')](handleError(_0x4b5c6,null));};exports[_0x8357('0x46')]=function(_0x2629a2,_0x5424cd){return db['JscriptySessionReport'][_0x8357('0x46')](_0x2629a2[_0x8357('0x47')],{})[_0x8357('0x25')](respondWithResult(_0x5424cd,0xc9))[_0x8357('0x42')](handleError(_0x5424cd,null));};exports[_0x8357('0x48')]=function(_0x5570a8,_0x4793c7){if(_0x5570a8['body']['id']){delete _0x5570a8['body']['id'];}return db[_0x8357('0x2d')]['find']({'where':{'id':_0x5570a8[_0x8357('0x44')]['id']}})[_0x8357('0x25')](handleEntityNotFound(_0x4793c7,null))[_0x8357('0x25')](saveUpdates(_0x5570a8[_0x8357('0x47')],null))[_0x8357('0x25')](respondWithResult(_0x4793c7,null))[_0x8357('0x42')](handleError(_0x4793c7,null));};exports[_0x8357('0x49')]=function(_0x139533,_0x56f480){return db[_0x8357('0x2d')][_0x8357('0x4a')]({'where':{'id':_0x139533['params']['id']}})[_0x8357('0x25')](handleEntityNotFound(_0x56f480,null))[_0x8357('0x25')](removeEntity(_0x56f480,null))[_0x8357('0x42')](handleError(_0x56f480,null));};exports['describe']=function(_0x37bab6,_0x197f27){return db[_0x8357('0x2d')]['describe']()[_0x8357('0x25')](respondWithResult(_0x197f27,null))[_0x8357('0x42')](handleError(_0x197f27,null));};exports[_0x8357('0x4b')]=function(_0x3db9fd,_0x127190,_0x549938){var _0x5f11da={'raw':!![],'where':{}};var _0x4c0f51={};var _0x43b9b3={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0x8357('0x4c')]({'where':{'id':_0x3db9fd[_0x8357('0x44')]['id']}})[_0x8357('0x25')](handleEntityNotFound(_0x127190,null))[_0x8357('0x25')](function(_0x20934a){if(_0x20934a){_0x4c0f51[_0x8357('0x31')]=_[_0x8357('0x33')](db[_0x8357('0x4d')][_0x8357('0x2e')]);_0x4c0f51[_0x8357('0x32')]=_[_0x8357('0x33')](_0x3db9fd[_0x8357('0x32')]);_0x4c0f51['filters']=_[_0x8357('0x35')](_0x4c0f51['model'],_0x4c0f51['query']);_0x5f11da[_0x8357('0x36')]=_[_0x8357('0x35')](_0x4c0f51[_0x8357('0x31')],qs['fields'](_0x3db9fd[_0x8357('0x32')][_0x8357('0x37')]));_0x5f11da[_0x8357('0x36')]=_0x5f11da[_0x8357('0x36')][_0x8357('0x38')]?_0x5f11da[_0x8357('0x36')]:_0x4c0f51['model'];if(!_0x3db9fd[_0x8357('0x32')][_0x8357('0x39')](_0x8357('0x3a'))){_0x5f11da['limit']=qs['limit'](_0x3db9fd[_0x8357('0x32')][_0x8357('0x1d')]);_0x5f11da[_0x8357('0x1f')]=qs['offset'](_0x3db9fd[_0x8357('0x32')][_0x8357('0x1f')]);}_0x5f11da[_0x8357('0x3b')]=qs[_0x8357('0x3c')](_0x3db9fd['query']['sort']);_0x5f11da[_0x8357('0x3d')]=qs['filters'](_[_0x8357('0x3e')](_0x3db9fd[_0x8357('0x32')],_0x4c0f51[_0x8357('0x34')]));_0x5f11da[_0x8357('0x3d')][_0x8357('0x4e')]=_0x20934a['id'];if(_0x3db9fd[_0x8357('0x32')][_0x8357('0x4f')]){_0x5f11da[_0x8357('0x3d')]=_['merge'](_0x5f11da['where'],{'$or':_[_0x8357('0x2c')](_0x5f11da[_0x8357('0x36')],function(_0x1f6a51){var _0x1d1fde={};_0x1d1fde[_0x1f6a51]={'$like':'%'+_0x3db9fd[_0x8357('0x32')]['filter']+'%'};return _0x1d1fde;})});}_0x5f11da=_[_0x8357('0x3f')]({},_0x5f11da,_0x3db9fd[_0x8357('0x40')]);return db[_0x8357('0x4d')][_0x8357('0x1e')]({'where':_0x5f11da['where']})[_0x8357('0x25')](function(_0x53ce41){_0x43b9b3[_0x8357('0x1e')]=_0x53ce41;if(_0x3db9fd['query'][_0x8357('0x45')]){_0x5f11da[_0x8357('0x41')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x8357('0x50')](_0x5f11da);})['then'](function(_0xae096f){_0x43b9b3[_0x8357('0x51')]=_0xae096f;return _0x43b9b3;});}})[_0x8357('0x25')](respondWithFilteredResult(_0x127190,_0x5f11da))[_0x8357('0x42')](handleError(_0x127190,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 0bd8899..71769c6 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 _0x5334=['moment','request-promise','rimraf','../../config/environment','lodash','util','../../config/logger','api'];(function(_0x3e5b04,_0x8aee4c){var _0x21a534=function(_0x3f4f1a){while(--_0x3f4f1a){_0x3e5b04['push'](_0x3e5b04['shift']());}};_0x21a534(++_0x8aee4c);}(_0x5334,0x84));var _0x4533=function(_0x50c642,_0x251984){_0x50c642=_0x50c642-0x0;var _0x15034d=_0x5334[_0x50c642];return _0x15034d;};'use strict';var _=require(_0x4533('0x0'));var util=require(_0x4533('0x1'));var logger=require(_0x4533('0x2'))(_0x4533('0x3'));var moment=require(_0x4533('0x4'));var BPromise=require('bluebird');var rp=require(_0x4533('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4533('0x6'));var config=require(_0x4533('0x7'));var attributes=require('./jscriptySessionReport.attributes');module['exports']=function(_0x51b4ce,_0x201673){return _0x51b4ce['define']('JscriptySessionReport',attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x277c=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','report_jscripty_sessions','lodash','../../config/logger'];(function(_0x4c5013,_0x4198a1){var _0x2d1a74=function(_0x6dd2a){while(--_0x6dd2a){_0x4c5013['push'](_0x4c5013['shift']());}};_0x2d1a74(++_0x4198a1);}(_0x277c,0x153));var _0xc277=function(_0x46f655,_0x52d438){_0x46f655=_0x46f655-0x0;var _0x34d9bc=_0x277c[_0x46f655];return _0x34d9bc;};'use strict';var _=require(_0xc277('0x0'));var util=require('util');var logger=require(_0xc277('0x1'))(_0xc277('0x2'));var moment=require(_0xc277('0x3'));var BPromise=require(_0xc277('0x4'));var rp=require(_0xc277('0x5'));var fs=require('fs');var path=require(_0xc277('0x6'));var rimraf=require(_0xc277('0x7'));var config=require(_0xc277('0x8'));var attributes=require('./jscriptySessionReport.attributes');module['exports']=function(_0x1a6582,_0x5a4f03){return _0x1a6582[_0xc277('0x9')]('JscriptySessionReport',attributes,{'tableName':_0xc277('0xa'),'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 481a96f..c61b46e 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 _0x1261=['then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','JscriptySessionReport,\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(_0x39ce5e,_0x3aae30){var _0x93b4f=function(_0x458426){while(--_0x458426){_0x39ce5e['push'](_0x39ce5e['shift']());}};_0x93b4f(++_0x3aae30);}(_0x1261,0x144));var _0x1126=function(_0xe7281f,_0x2d77c3){_0xe7281f=_0xe7281f-0x0;var _0x90dc99=_0x1261[_0xe7281f];return _0x90dc99;};'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')]('JscriptySessionReport,\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 +var _0xd943=['info','request\x20sent','JscriptySessionReport,\x20%s,\x20%s,\x20%s','error','code','JscriptySessionReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','then'];(function(_0x2ebe99,_0x21c11e){var _0x2c2f9f=function(_0x573ce7){while(--_0x573ce7){_0x2ebe99['push'](_0x2ebe99['shift']());}};_0x2c2f9f(++_0x21c11e);}(_0xd943,0x15d));var _0x3d94=function(_0x2de236,_0x48219b){_0x2de236=_0x2de236-0x0;var _0x26e6c1=_0xd943[_0x2de236];return _0x26e6c1;};'use strict';var _=require(_0x3d94('0x0'));var util=require(_0x3d94('0x1'));var moment=require(_0x3d94('0x2'));var BPromise=require(_0x3d94('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3d94('0x4'));var db=require(_0x3d94('0x5'))['db'];var utils=require(_0x3d94('0x6'));var logger=require(_0x3d94('0x7'))(_0x3d94('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3d94('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54e81f,_0x4d29e7,_0x20f4d1){return new BPromise(function(_0x35d36a,_0x5244c3){return client['request'](_0x54e81f,_0x20f4d1)[_0x3d94('0xa')](function(_0x27e381){logger[_0x3d94('0xb')]('JscriptySessionReport,\x20%s,\x20%s',_0x4d29e7,_0x3d94('0xc'));logger['debug'](_0x3d94('0xd'),_0x4d29e7,_0x3d94('0xc'),JSON['stringify'](_0x27e381));if(_0x27e381[_0x3d94('0xe')]){if(_0x27e381[_0x3d94('0xe')][_0x3d94('0xf')]===0x1f4){logger[_0x3d94('0xe')](_0x3d94('0x10'),_0x4d29e7,_0x27e381['error'][_0x3d94('0x11')]);return _0x5244c3(_0x27e381[_0x3d94('0xe')][_0x3d94('0x11')]);}logger['error'](_0x3d94('0x10'),_0x4d29e7,_0x27e381[_0x3d94('0xe')][_0x3d94('0x11')]);return _0x35d36a(_0x27e381['error'][_0x3d94('0x11')]);}else{logger[_0x3d94('0xb')](_0x3d94('0x10'),_0x4d29e7,_0x3d94('0xc'));_0x35d36a(_0x27e381[_0x3d94('0x12')][_0x3d94('0x11')]);}})[_0x3d94('0x13')](function(_0x9893cb){logger['error'](_0x3d94('0x10'),_0x4d29e7,_0x9893cb);_0x5244c3(_0x9893cb);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 14c51e5..cc8ecff 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 _0x607b=['index','isAuthenticated','update','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x47041d,_0x42153f){var _0x5022bd=function(_0x1dbb9a){while(--_0x1dbb9a){_0x47041d['push'](_0x47041d['shift']());}};_0x5022bd(++_0x42153f);}(_0x607b,0x18f));var _0xb607=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x607b[_0x1ac595];return _0x455fff;};'use strict';var multer=require(_0xb607('0x0'));var util=require('util');var path=require(_0xb607('0x1'));var timeout=require(_0xb607('0x2'));var express=require(_0xb607('0x3'));var router=express[_0xb607('0x4')]();var fs_extra=require(_0xb607('0x5'));var auth=require(_0xb607('0x6'));var interaction=require(_0xb607('0x7'));var config=require(_0xb607('0x8'));var controller=require('./license.controller');router['get']('/',controller[_0xb607('0x9')]);router['put']('/:id',auth[_0xb607('0xa')](),controller[_0xb607('0xb')]);module['exports']=router; \ No newline at end of file +var _0x2624=['multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./license.controller','put','/:id','isAuthenticated','update'];(function(_0x36daf6,_0x16e172){var _0x541618=function(_0x4ee62d){while(--_0x4ee62d){_0x36daf6['push'](_0x36daf6['shift']());}};_0x541618(++_0x16e172);}(_0x2624,0x75));var _0x4262=function(_0x4831be,_0x2a7bae){_0x4831be=_0x4831be-0x0;var _0x36c0d7=_0x2624[_0x4831be];return _0x36c0d7;};'use strict';var multer=require(_0x4262('0x0'));var util=require(_0x4262('0x1'));var path=require('path');var timeout=require(_0x4262('0x2'));var express=require(_0x4262('0x3'));var router=express[_0x4262('0x4')]();var fs_extra=require(_0x4262('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x4262('0x6'));var config=require(_0x4262('0x7'));var controller=require(_0x4262('0x8'));router['get']('/',controller['index']);router[_0x4262('0x9')](_0x4262('0xa'),auth[_0x4262('0xb')](),controller[_0x4262('0xc')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index a19bc1f..9244196 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 _0xca4b=['STRING','sequelize','TEXT'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0xca4b,0xdc));var _0xbca4=function(_0x1dc163,_0x502e0d){_0x1dc163=_0x1dc163-0x0;var _0x29dbaf=_0xca4b[_0x1dc163];return _0x29dbaf;};'use strict';var Sequelize=require(_0xbca4('0x0'));module['exports']={'license':{'type':Sequelize[_0xbca4('0x1')]},'data1':{'type':Sequelize[_0xbca4('0x2')]},'data2':{'type':Sequelize[_0xbca4('0x2')]},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x176d=['sequelize','exports','STRING'];(function(_0x2b950c,_0x57cc37){var _0x592648=function(_0x20b1f6){while(--_0x20b1f6){_0x2b950c['push'](_0x2b950c['shift']());}};_0x592648(++_0x57cc37);}(_0x176d,0x120));var _0xd176=function(_0x13242c,_0x2fa4cf){_0x13242c=_0x13242c-0x0;var _0x86b1bb=_0x176d[_0x13242c];return _0x86b1bb;};'use strict';var Sequelize=require(_0xd176('0x0'));module[_0xd176('0x1')]={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize[_0xd176('0x2')]},'data2':{'type':Sequelize[_0xd176('0x2')]},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index 60feb73..4a4e57c 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 _0x0295=['demo','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','../../config/license/util','model','keys','rawAttributes','query','filters','intersection','attributes','fields','merge','options','catch','body','License','find','checkLicense','key'];(function(_0x2642cb,_0x4b917f){var _0xe6e41=function(_0x281676){while(--_0x281676){_0x2642cb['push'](_0x2642cb['shift']());}};_0xe6e41(++_0x4b917f);}(_0x0295,0x1f0));var _0x5029=function(_0x273bb2,_0x319264){_0x273bb2=_0x273bb2-0x0;var _0x22f932=_0x0295[_0x273bb2];return _0x22f932;};'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);};}var utilLicense=require(_0x5029('0x25'));exports['index']=function(_0x32da06,_0x251f99){var _0xe5313e={'raw':!![],'where':{'id':0x1}},_0x4b6f92={};_0x4b6f92[_0x5029('0x26')]=_[_0x5029('0x27')](db['License'][_0x5029('0x28')]);_0x4b6f92[_0x5029('0x29')]=_[_0x5029('0x27')](_0x32da06[_0x5029('0x29')]);_0x4b6f92[_0x5029('0x2a')]=_[_0x5029('0x2b')](_0x4b6f92[_0x5029('0x26')],_0x4b6f92[_0x5029('0x29')]);_0xe5313e[_0x5029('0x2c')]=_[_0x5029('0x2b')](_0x4b6f92[_0x5029('0x26')],qs[_0x5029('0x2d')](_0x32da06['query'][_0x5029('0x2d')]));_0xe5313e['attributes']=_0xe5313e[_0x5029('0x2c')]['length']?_0xe5313e['attributes']:_0x4b6f92[_0x5029('0x26')];_0xe5313e=_[_0x5029('0x2e')]({},_0xe5313e,_0x32da06[_0x5029('0x2f')]);return utilLicense['getLicense'](_0xe5313e)[_0x5029('0x20')](respondWithResult(_0x251f99,null))[_0x5029('0x30')](handleError(_0x251f99,null));};exports[_0x5029('0x1f')]=function(_0x29c59a,_0x1bb896){if(_0x29c59a[_0x5029('0x31')]['id']){delete _0x29c59a[_0x5029('0x31')]['id'];}return db[_0x5029('0x32')][_0x5029('0x33')]({'where':{'id':_0x29c59a['params']['id']}})[_0x5029('0x20')](handleEntityNotFound(_0x1bb896,null))[_0x5029('0x20')](function(_0xc110e8){var _0x1b3817=_0xc110e8['get']({'plain':!![]});return utilLicense[_0x5029('0x34')](_0x1b3817,_0x29c59a[_0x5029('0x31')][_0x5029('0x35')]);})['then'](function(_0x4904cc){if(!_0x4904cc[_0x5029('0x36')]){return saveUpdates(_0x29c59a[_0x5029('0x31')],null);}return _0x4904cc;})['then'](respondWithResult(_0x1bb896,null))['catch'](handleError(_0x1bb896,null));}; \ No newline at end of file +var _0x0295=['demo','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','../../config/license/util','model','keys','rawAttributes','query','filters','intersection','attributes','fields','merge','options','catch','body','License','find','checkLicense','key'];(function(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0x0295,0x1f0));var _0x5029=function(_0x5ed65f,_0x23d121){_0x5ed65f=_0x5ed65f-0x0;var _0x1f43ae=_0x0295[_0x5ed65f];return _0x1f43ae;};'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);};}var utilLicense=require(_0x5029('0x25'));exports['index']=function(_0x32da06,_0x251f99){var _0xe5313e={'raw':!![],'where':{'id':0x1}},_0x4b6f92={};_0x4b6f92[_0x5029('0x26')]=_[_0x5029('0x27')](db['License'][_0x5029('0x28')]);_0x4b6f92[_0x5029('0x29')]=_[_0x5029('0x27')](_0x32da06[_0x5029('0x29')]);_0x4b6f92[_0x5029('0x2a')]=_[_0x5029('0x2b')](_0x4b6f92[_0x5029('0x26')],_0x4b6f92[_0x5029('0x29')]);_0xe5313e[_0x5029('0x2c')]=_[_0x5029('0x2b')](_0x4b6f92[_0x5029('0x26')],qs[_0x5029('0x2d')](_0x32da06['query'][_0x5029('0x2d')]));_0xe5313e['attributes']=_0xe5313e[_0x5029('0x2c')]['length']?_0xe5313e['attributes']:_0x4b6f92[_0x5029('0x26')];_0xe5313e=_[_0x5029('0x2e')]({},_0xe5313e,_0x32da06[_0x5029('0x2f')]);return utilLicense['getLicense'](_0xe5313e)[_0x5029('0x20')](respondWithResult(_0x251f99,null))[_0x5029('0x30')](handleError(_0x251f99,null));};exports[_0x5029('0x1f')]=function(_0x29c59a,_0x1bb896){if(_0x29c59a[_0x5029('0x31')]['id']){delete _0x29c59a[_0x5029('0x31')]['id'];}return db[_0x5029('0x32')][_0x5029('0x33')]({'where':{'id':_0x29c59a['params']['id']}})[_0x5029('0x20')](handleEntityNotFound(_0x1bb896,null))[_0x5029('0x20')](function(_0xc110e8){var _0x1b3817=_0xc110e8['get']({'plain':!![]});return utilLicense[_0x5029('0x34')](_0x1b3817,_0x29c59a[_0x5029('0x31')][_0x5029('0x35')]);})['then'](function(_0x4904cc){if(!_0x4904cc[_0x5029('0x36')]){return saveUpdates(_0x29c59a[_0x5029('0x31')],null);}return _0x4904cc;})['then'](respondWithResult(_0x1bb896,null))['catch'](handleError(_0x1bb896,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 933ae86..69c996a 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 _0xef9a=['bluebird','../../config/environment','define','License','license','util','../../config/logger','api','moment'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0xef9a,0x152));var _0xaef9=function(_0x3fc710,_0x6645c2){_0x3fc710=_0x3fc710-0x0;var _0x5727b7=_0xef9a[_0x3fc710];return _0x5727b7;};'use strict';var _=require('lodash');var util=require(_0xaef9('0x0'));var logger=require(_0xaef9('0x1'))(_0xaef9('0x2'));var moment=require(_0xaef9('0x3'));var BPromise=require(_0xaef9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xaef9('0x5'));var attributes=require('./license.attributes');module['exports']=function(_0x1d2d3a,_0x2f1495){return _0x1d2d3a[_0xaef9('0x6')](_0xaef9('0x7'),attributes,{'tableName':_0xaef9('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7fb1=['./license.attributes','License','license','lodash','util','request-promise','path','rimraf','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7fb1,0x1ce));var _0x17fb=function(_0x158d09,_0x53f5a8){_0x158d09=_0x158d09-0x0;var _0x738525=_0x7fb1[_0x158d09];return _0x738525;};'use strict';var _=require(_0x17fb('0x0'));var util=require(_0x17fb('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x17fb('0x2'));var fs=require('fs');var path=require(_0x17fb('0x3'));var rimraf=require(_0x17fb('0x4'));var config=require(_0x17fb('0x5'));var attributes=require(_0x17fb('0x6'));module['exports']=function(_0x4b5f66,_0x4e7706){return _0x4b5f66['define'](_0x17fb('0x7'),attributes,{'tableName':_0x17fb('0x8'),'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 28edc8f..39ee1f7 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 _0xd45b=['License,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','License,\x20%s,\x20%s','request\x20sent'];(function(_0x222d2d,_0x592278){var _0xb7cc9b=function(_0x5cf8e6){while(--_0x5cf8e6){_0x222d2d['push'](_0x222d2d['shift']());}};_0xb7cc9b(++_0x592278);}(_0xd45b,0xe1));var _0xbd45=function(_0x240e56,_0x4b71b9){_0x240e56=_0x240e56-0x0;var _0x2fd5b4=_0xd45b[_0x240e56];return _0x2fd5b4;};'use strict';var _=require('lodash');var util=require(_0xbd45('0x0'));var moment=require('moment');var BPromise=require(_0xbd45('0x1'));var rs=require(_0xbd45('0x2'));var fs=require('fs');var Redis=require(_0xbd45('0x3'));var db=require(_0xbd45('0x4'))['db'];var utils=require(_0xbd45('0x5'));var logger=require(_0xbd45('0x6'))(_0xbd45('0x7'));var config=require('../../config/environment');var jayson=require(_0xbd45('0x8'));var client=jayson[_0xbd45('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x516ac4,_0xbb5952,_0x392905){return new BPromise(function(_0x2ab2f9,_0xf1693a){return client[_0xbd45('0xa')](_0x516ac4,_0x392905)[_0xbd45('0xb')](function(_0x105949){logger[_0xbd45('0xc')](_0xbd45('0xd'),_0xbb5952,_0xbd45('0xe'));logger['debug'](_0xbd45('0xf'),_0xbb5952,'request\x20sent',JSON['stringify'](_0x105949));if(_0x105949[_0xbd45('0x10')]){if(_0x105949[_0xbd45('0x10')][_0xbd45('0x11')]===0x1f4){logger[_0xbd45('0x10')](_0xbd45('0xd'),_0xbb5952,_0x105949['error']['message']);return _0xf1693a(_0x105949[_0xbd45('0x10')][_0xbd45('0x12')]);}logger[_0xbd45('0x10')](_0xbd45('0xd'),_0xbb5952,_0x105949[_0xbd45('0x10')]['message']);return _0x2ab2f9(_0x105949[_0xbd45('0x10')][_0xbd45('0x12')]);}else{logger[_0xbd45('0xc')](_0xbd45('0xd'),_0xbb5952,_0xbd45('0xe'));_0x2ab2f9(_0x105949['result']['message']);}})[_0xbd45('0x13')](function(_0x13e2e3){logger[_0xbd45('0x10')](_0xbd45('0xd'),_0xbb5952,_0x13e2e3);_0xf1693a(_0x13e2e3);});});} \ No newline at end of file +var _0xdf38=['http','request','then','info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x439c9b,_0x523f09){var _0x30f989=function(_0x15721a){while(--_0x15721a){_0x439c9b['push'](_0x439c9b['shift']());}};_0x30f989(++_0x523f09);}(_0xdf38,0x147));var _0x8df3=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0xdf38[_0x422905];return _0x33dc6c;};'use strict';var _=require(_0x8df3('0x0'));var util=require(_0x8df3('0x1'));var moment=require(_0x8df3('0x2'));var BPromise=require(_0x8df3('0x3'));var rs=require(_0x8df3('0x4'));var fs=require('fs');var Redis=require(_0x8df3('0x5'));var db=require(_0x8df3('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x8df3('0x7'))(_0x8df3('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x8df3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4715ef,_0x3decea,_0x1c8b7d){return new BPromise(function(_0x1f73af,_0x403e99){return client[_0x8df3('0xa')](_0x4715ef,_0x1c8b7d)[_0x8df3('0xb')](function(_0x5449a){logger[_0x8df3('0xc')](_0x8df3('0xd'),_0x3decea,_0x8df3('0xe'));logger[_0x8df3('0xf')](_0x8df3('0x10'),_0x3decea,_0x8df3('0xe'),JSON[_0x8df3('0x11')](_0x5449a));if(_0x5449a[_0x8df3('0x12')]){if(_0x5449a[_0x8df3('0x12')][_0x8df3('0x13')]===0x1f4){logger[_0x8df3('0x12')]('License,\x20%s,\x20%s',_0x3decea,_0x5449a['error']['message']);return _0x403e99(_0x5449a[_0x8df3('0x12')][_0x8df3('0x14')]);}logger[_0x8df3('0x12')](_0x8df3('0xd'),_0x3decea,_0x5449a['error'][_0x8df3('0x14')]);return _0x1f73af(_0x5449a[_0x8df3('0x12')][_0x8df3('0x14')]);}else{logger[_0x8df3('0xc')](_0x8df3('0xd'),_0x3decea,_0x8df3('0xe'));_0x1f73af(_0x5449a['result'][_0x8df3('0x14')]);}})['catch'](function(_0x5b37d4){logger['error'](_0x8df3('0xd'),_0x3decea,_0x5b37d4);_0x403e99(_0x5b37d4);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index fd0a0f8..d29ae4f 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 _0xc96d=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailAccount.controller','get','isAuthenticated','index','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/in_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','verifySmtp','/:id/users','getAgents','post','addDisposition','addAnswer','addImap','addInteraction','addApplications','/:id/send','addAgents','put','delete','removeAnswers','removeImap','/:id/out_servers','/:id','destroy','removeAgents','exports','util','path','connect-timeout'];(function(_0x5da169,_0x50fa43){var _0x239a2b=function(_0xe64e17){while(--_0xe64e17){_0x5da169['push'](_0x5da169['shift']());}};_0x239a2b(++_0x50fa43);}(_0xc96d,0xad));var _0xdc96=function(_0x22c46e,_0x1b35e2){_0x22c46e=_0x22c46e-0x0;var _0x36a4c8=_0xc96d[_0x22c46e];return _0x36a4c8;};'use strict';var multer=require('multer');var util=require(_0xdc96('0x0'));var path=require(_0xdc96('0x1'));var timeout=require(_0xdc96('0x2'));var express=require('express');var router=express[_0xdc96('0x3')]();var fs_extra=require(_0xdc96('0x4'));var auth=require(_0xdc96('0x5'));var interaction=require(_0xdc96('0x6'));var config=require('../../config/environment');var controller=require(_0xdc96('0x7'));router[_0xdc96('0x8')]('/',auth[_0xdc96('0x9')](),controller[_0xdc96('0xa')]);router[_0xdc96('0x8')]('/describe',auth['isAuthenticated'](),controller[_0xdc96('0xb')]);router[_0xdc96('0x8')]('/:id',auth[_0xdc96('0x9')](),controller[_0xdc96('0xc')]);router[_0xdc96('0x8')](_0xdc96('0xd'),auth['isAuthenticated'](),controller[_0xdc96('0xe')]);router[_0xdc96('0x8')](_0xdc96('0xf'),auth['isAuthenticated'](),controller['getAnswers']);router[_0xdc96('0x8')](_0xdc96('0x10'),auth[_0xdc96('0x9')](),controller['getImap']);router[_0xdc96('0x8')]('/:id/out_servers',auth[_0xdc96('0x9')](),controller[_0xdc96('0x11')]);router[_0xdc96('0x8')](_0xdc96('0x12'),auth[_0xdc96('0x9')](),controller[_0xdc96('0x13')]);router[_0xdc96('0x8')](_0xdc96('0x14'),auth[_0xdc96('0x9')](),controller[_0xdc96('0x15')]);router['get'](_0xdc96('0x16'),auth[_0xdc96('0x9')](),controller[_0xdc96('0x17')]);router[_0xdc96('0x8')]('/:id/verify',auth[_0xdc96('0x9')](),controller[_0xdc96('0x18')]);router[_0xdc96('0x8')](_0xdc96('0x19'),auth[_0xdc96('0x9')](),controller[_0xdc96('0x1a')]);router[_0xdc96('0x1b')](_0xdc96('0xd'),auth[_0xdc96('0x9')](),controller[_0xdc96('0x1c')]);router[_0xdc96('0x1b')](_0xdc96('0xf'),auth['isAuthenticated'](),controller[_0xdc96('0x1d')]);router[_0xdc96('0x1b')]('/',auth[_0xdc96('0x9')](),controller['create']);router[_0xdc96('0x1b')](_0xdc96('0x10'),auth[_0xdc96('0x9')](),controller[_0xdc96('0x1e')]);router[_0xdc96('0x1b')]('/:id/out_servers',auth['isAuthenticated'](),controller['addSmtp']);router[_0xdc96('0x1b')](_0xdc96('0x12'),auth[_0xdc96('0x9')](),controller[_0xdc96('0x1f')]);router[_0xdc96('0x1b')]('/:id/applications',auth['isAuthenticated'](),controller[_0xdc96('0x20')]);router[_0xdc96('0x1b')](_0xdc96('0x21'),auth[_0xdc96('0x9')](),controller['send']);router[_0xdc96('0x1b')](_0xdc96('0x19'),auth[_0xdc96('0x9')](),controller[_0xdc96('0x22')]);router[_0xdc96('0x23')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xdc96('0x24')](_0xdc96('0xd'),auth[_0xdc96('0x9')](),controller['removeDispositions']);router['delete']('/:id/canned_answers',auth[_0xdc96('0x9')](),controller[_0xdc96('0x25')]);router[_0xdc96('0x24')]('/:id/in_servers',auth[_0xdc96('0x9')](),controller[_0xdc96('0x26')]);router[_0xdc96('0x24')](_0xdc96('0x27'),auth[_0xdc96('0x9')](),controller['removeSmtp']);router[_0xdc96('0x24')](_0xdc96('0x28'),auth['isAuthenticated'](),controller[_0xdc96('0x29')]);router[_0xdc96('0x24')](_0xdc96('0x19'),auth['isAuthenticated'](),controller[_0xdc96('0x2a')]);module[_0xdc96('0x2b')]=router; \ No newline at end of file +var _0xae2a=['addDisposition','post','addAnswer','addImap','addInteraction','addApplications','/:id/send','send','/:id/users','addAgents','put','update','delete','removeAnswers','removeImap','removeSmtp','removeAgents','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','/:id/interactions','/:id/messages','/:id/verify','verifySmtp','getAgents'];(function(_0x2a63e5,_0x1d76a2){var _0x491771=function(_0x10c899){while(--_0x10c899){_0x2a63e5['push'](_0x2a63e5['shift']());}};_0x491771(++_0x1d76a2);}(_0xae2a,0x154));var _0xaae2=function(_0x1e8bd1,_0x45fd5f){_0x1e8bd1=_0x1e8bd1-0x0;var _0x32840a=_0xae2a[_0x1e8bd1];return _0x32840a;};'use strict';var multer=require('multer');var util=require(_0xaae2('0x0'));var path=require(_0xaae2('0x1'));var timeout=require(_0xaae2('0x2'));var express=require(_0xaae2('0x3'));var router=express[_0xaae2('0x4')]();var fs_extra=require(_0xaae2('0x5'));var auth=require(_0xaae2('0x6'));var interaction=require(_0xaae2('0x7'));var config=require(_0xaae2('0x8'));var controller=require(_0xaae2('0x9'));router[_0xaae2('0xa')]('/',auth[_0xaae2('0xb')](),controller['index']);router['get'](_0xaae2('0xc'),auth[_0xaae2('0xb')](),controller[_0xaae2('0xd')]);router[_0xaae2('0xa')](_0xaae2('0xe'),auth['isAuthenticated'](),controller[_0xaae2('0xf')]);router['get'](_0xaae2('0x10'),auth[_0xaae2('0xb')](),controller[_0xaae2('0x11')]);router['get'](_0xaae2('0x12'),auth[_0xaae2('0xb')](),controller[_0xaae2('0x13')]);router[_0xaae2('0xa')](_0xaae2('0x14'),auth[_0xaae2('0xb')](),controller[_0xaae2('0x15')]);router['get'](_0xaae2('0x16'),auth[_0xaae2('0xb')](),controller['getSmtp']);router[_0xaae2('0xa')](_0xaae2('0x17'),auth['isAuthenticated'](),controller['getInteractions']);router[_0xaae2('0xa')]('/:id/applications',auth[_0xaae2('0xb')](),controller['getApplications']);router['get'](_0xaae2('0x18'),auth[_0xaae2('0xb')](),controller['getMessages']);router[_0xaae2('0xa')](_0xaae2('0x19'),auth['isAuthenticated'](),controller[_0xaae2('0x1a')]);router[_0xaae2('0xa')]('/:id/users',auth['isAuthenticated'](),controller[_0xaae2('0x1b')]);router['post'](_0xaae2('0x10'),auth[_0xaae2('0xb')](),controller[_0xaae2('0x1c')]);router[_0xaae2('0x1d')](_0xaae2('0x12'),auth[_0xaae2('0xb')](),controller[_0xaae2('0x1e')]);router[_0xaae2('0x1d')]('/',auth['isAuthenticated'](),controller['create']);router[_0xaae2('0x1d')]('/:id/in_servers',auth['isAuthenticated'](),controller[_0xaae2('0x1f')]);router['post'](_0xaae2('0x16'),auth['isAuthenticated'](),controller['addSmtp']);router[_0xaae2('0x1d')]('/:id/interactions',auth[_0xaae2('0xb')](),controller[_0xaae2('0x20')]);router[_0xaae2('0x1d')]('/:id/applications',auth[_0xaae2('0xb')](),controller[_0xaae2('0x21')]);router[_0xaae2('0x1d')](_0xaae2('0x22'),auth['isAuthenticated'](),controller[_0xaae2('0x23')]);router['post'](_0xaae2('0x24'),auth['isAuthenticated'](),controller[_0xaae2('0x25')]);router[_0xaae2('0x26')](_0xaae2('0xe'),auth[_0xaae2('0xb')](),controller[_0xaae2('0x27')]);router[_0xaae2('0x28')](_0xaae2('0x10'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0xaae2('0x28')](_0xaae2('0x12'),auth[_0xaae2('0xb')](),controller[_0xaae2('0x29')]);router[_0xaae2('0x28')](_0xaae2('0x14'),auth['isAuthenticated'](),controller[_0xaae2('0x2a')]);router[_0xaae2('0x28')]('/:id/out_servers',auth[_0xaae2('0xb')](),controller[_0xaae2('0x2b')]);router[_0xaae2('0x28')](_0xaae2('0xe'),auth[_0xaae2('0xb')](),controller['destroy']);router[_0xaae2('0x28')](_0xaae2('0x24'),auth[_0xaae2('0xb')](),controller[_0xaae2('0x2c')]);module[_0xaae2('0x2d')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index a39722e..209106e 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 _0x41c1=['outlook365','getDataValue','provider','custom','sequelize','exports','BOOLEAN','STRING','TEXT','Arial,Helvetica,sans-serif','INTEGER','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','mandatoryDisposition','gmail'];(function(_0x2c9c08,_0x3a81dc){var _0x4db51f=function(_0x42e730){while(--_0x42e730){_0x2c9c08['push'](_0x2c9c08['shift']());}};_0x4db51f(++_0x3a81dc);}(_0x41c1,0x1cf));var _0x141c=function(_0x4b4ce5,_0x573d2d){_0x4b4ce5=_0x4b4ce5-0x0;var _0x6522f3=_0x41c1[_0x4b4ce5];return _0x6522f3;};'use strict';var Sequelize=require(_0x141c('0x0'));module[_0x141c('0x1')]={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize[_0x141c('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x141c('0x3')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x141c('0x2')],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize[_0x141c('0x4')]},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x141c('0x5')},'fontSize':{'type':Sequelize[_0x141c('0x6')](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x141c('0x4')],'defaultValue':function(){return _0x141c('0x7');}},'notificationSound':{'type':Sequelize[_0x141c('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x141c('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x141c('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x141c('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x141c('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x141c('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0x141c('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x141c('0x2')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x3447d7){if(!_0x3447d7)this[_0x141c('0x9')](_0x141c('0xa'),null);this['setDataValue'](_0x141c('0xb'),_0x3447d7);}},'provider':{'type':Sequelize['ENUM'](_0x141c('0xc'),'hotmail','yahoo',_0x141c('0xd')),'defaultValue':null,'get':function(){if(!this[_0x141c('0xe')](_0x141c('0xf')))return _0x141c('0x10');return this[_0x141c('0xe')](_0x141c('0xf'));}}}; \ No newline at end of file +var _0xd089=['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}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','ENUM','hotmail','yahoo','outlook365','provider','custom','getDataValue','sequelize','STRING','BOOLEAN'];(function(_0x43da69,_0x7f3a5d){var _0x4e59ef=function(_0x336211){while(--_0x336211){_0x43da69['push'](_0x43da69['shift']());}};_0x4e59ef(++_0x7f3a5d);}(_0xd089,0x1bf));var _0x9d08=function(_0x36232b,_0x2782bf){_0x36232b=_0x36232b-0x0;var _0x169aa7=_0xd089[_0x36232b];return _0x169aa7;};'use strict';var Sequelize=require(_0x9d08('0x0'));module['exports']={'description':{'type':Sequelize[_0x9d08('0x1')]},'name':{'type':Sequelize[_0x9d08('0x1')],'allowNull':![]},'service':{'type':Sequelize[_0x9d08('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x9d08('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x9d08('0x2')],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize[_0x9d08('0x3')]},'markAsUnread':{'type':Sequelize[_0x9d08('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x9d08('0x1')],'allowNull':![],'defaultValue':_0x9d08('0x4')},'fontSize':{'type':Sequelize[_0x9d08('0x5')](0x2)[_0x9d08('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x9d08('0x7');}},'notificationSound':{'type':Sequelize[_0x9d08('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x9d08('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x9d08('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x9d08('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x9d08('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0x9d08('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x9d08('0x2')],'defaultValue':![],'comment':_0x9d08('0x9'),'set':function(_0x177448){if(!_0x177448)this[_0x9d08('0xa')]('mandatoryDispositionPauseId',null);this[_0x9d08('0xa')]('mandatoryDisposition',_0x177448);}},'provider':{'type':Sequelize[_0x9d08('0xb')]('gmail',_0x9d08('0xc'),_0x9d08('0xd'),_0x9d08('0xe')),'defaultValue':null,'get':function(){if(!this['getDataValue'](_0x9d08('0xf')))return _0x9d08('0x10');return this[_0x9d08('0x11')]('provider');}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index ca70c7a..396bf90 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 _0xba08=['key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','MailServerIn','Smtp','mandatoryDispositionPause','rawAttributes','includeAll','update','body','params','describe','addDisposition','find','MailAccountId','Disposition','getDispositions','findOne','order','removeDispositions','ids','addAnswer','create','getAnswers','nolimit','CannedAnswer','removeAnswers','provider','custom','active','description','user','username','password','pass','modernAuthentication','CloudProviderId','service','host','port','authentication','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','getSmtp','removeSmtp','setSmtp','MailInteraction','addInteraction','omit','getInteractions','Contact','User','fullname','internal','Tag','tag','addApplications','sequelize','Transaction','ISOLATION_LEVELS','MailApplication','bulkCreate','priority','finally','getApplications','getMessages','$gte','split','YYYY-MM-DD\x20HH:mm:ss','MailMessage','true','CmList','List','Contacts','updatedAt','DESC','isNil','from','format','email','attachments','join','root','auth','secure','SendMail','sendMail','List\x20not\x20found','CmContact','ListId','messageId','subject','attach','out','Interaction','Messages','verifySmtp','CloudProvider','OAuth2','data5','Sequelize','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','removeAgents','isArray','emit','userMailAccount:remove','getAgents','moment','bluebird','util','path','lodash','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','jayson/promise','http','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','status','end','offset','undefined','limit','count','set','json','destroy','get','MailAccounts','UserProfileResource','sendStatus','stack','name','send','index','Imap','MailServerOut','Pause','map','MailAccount','fieldName','type'];(function(_0x48c1bf,_0x2e76bf){var _0x3172b7=function(_0x1f2a6f){while(--_0x1f2a6f){_0x48c1bf['push'](_0x48c1bf['shift']());}};_0x3172b7(++_0x2e76bf);}(_0xba08,0x13d));var _0x8ba0=function(_0x28d6e2,_0x51fac0){_0x28d6e2=_0x28d6e2-0x0;var _0x7dc05b=_0xba08[_0x28d6e2];return _0x7dc05b;};'use strict';var moment=require(_0x8ba0('0x0'));var BPromise=require(_0x8ba0('0x1'));var util=require(_0x8ba0('0x2'));var path=require(_0x8ba0('0x3'));var _=require(_0x8ba0('0x4'));var juice=require(_0x8ba0('0x5'));var Redis=require(_0x8ba0('0x6'));var qs=require(_0x8ba0('0x7'));var logger=require(_0x8ba0('0x8'))(_0x8ba0('0x9'));var config=require(_0x8ba0('0xa'));var db=require(_0x8ba0('0xb'))['db'];config[_0x8ba0('0xc')]=_[_0x8ba0('0xd')](config[_0x8ba0('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x8ba0('0xe'))(new Redis(config[_0x8ba0('0xc')]));require('./mailAccount.socket')['register'](socket);var jayson=require(_0x8ba0('0xf'));var client=jayson['client'][_0x8ba0('0x10')]({'port':0x232b});function respondWithRpcPromise(_0x25f82c,_0x42499d,_0x51ade9,_0x44cf31){return new BPromise(function(_0x1fb742,_0x187e38){var _0x3c11dd=_0x44cf31||client;return _0x3c11dd[_0x8ba0('0x11')](_0x25f82c,_0x51ade9)[_0x8ba0('0x12')](function(_0x42d713){logger[_0x8ba0('0x13')](_0x8ba0('0x14'),_0x42499d,_0x8ba0('0x15'));logger[_0x8ba0('0x16')](_0x8ba0('0x17'),_0x42499d,'request\x20sent',JSON['stringify'](_0x42d713));if(_0x42d713[_0x8ba0('0x18')]){if(_0x42d713[_0x8ba0('0x18')][_0x8ba0('0x19')]===0x1f4){logger['error']('MailAccount,\x20%s,\x20%s',_0x42499d,_0x42d713[_0x8ba0('0x18')][_0x8ba0('0x1a')]);return _0x187e38(_0x42d713[_0x8ba0('0x18')]['message']);}logger[_0x8ba0('0x18')](_0x8ba0('0x14'),_0x42499d,_0x42d713[_0x8ba0('0x18')][_0x8ba0('0x1a')]);return _0x1fb742(_0x42d713[_0x8ba0('0x18')][_0x8ba0('0x1a')]);}else{logger[_0x8ba0('0x13')](_0x8ba0('0x14'),_0x42499d,_0x8ba0('0x15'));_0x1fb742(_0x42d713[_0x8ba0('0x1b')][_0x8ba0('0x1a')]);}})[_0x8ba0('0x1c')](function(_0xedaaef){logger[_0x8ba0('0x18')](_0x8ba0('0x14'),_0x42499d,_0xedaaef);_0x187e38(_0xedaaef);});});}function respondWithStatusCode(_0x5c4756,_0x323003){_0x323003=_0x323003||0xcc;return function(_0x54c191){if(_0x54c191){return _0x5c4756['sendStatus'](_0x323003);}return _0x5c4756[_0x8ba0('0x1d')](_0x323003)[_0x8ba0('0x1e')]();};}function respondWithResult(_0x465690,_0x1f12ec){_0x1f12ec=_0x1f12ec||0xc8;return function(_0x3cd6e0){if(_0x3cd6e0){return _0x465690[_0x8ba0('0x1d')](_0x1f12ec)['json'](_0x3cd6e0);}};}function respondWithFilteredResult(_0xe5ad69,_0x2970f8){return function(_0x2e4318){if(_0x2e4318){var _0x314f6c=typeof _0x2970f8[_0x8ba0('0x1f')]===_0x8ba0('0x20')&&typeof _0x2970f8[_0x8ba0('0x21')]===_0x8ba0('0x20');var _0x1fa800=_0x2e4318[_0x8ba0('0x22')];var _0x537745=_0x314f6c?0x0:_0x2970f8['offset'];var _0x48c78d=_0x314f6c?_0x2e4318[_0x8ba0('0x22')]:_0x2970f8['offset']+_0x2970f8[_0x8ba0('0x21')];var _0x284b8a;if(_0x48c78d>=_0x1fa800){_0x48c78d=_0x1fa800;_0x284b8a=0xc8;}else{_0x284b8a=0xce;}_0xe5ad69['status'](_0x284b8a);return _0xe5ad69[_0x8ba0('0x23')]('Content-Range',_0x537745+'-'+_0x48c78d+'/'+_0x1fa800)[_0x8ba0('0x24')](_0x2e4318);}return null;};}function saveUpdates(_0x52f537){return function(_0x19b441){if(_0x19b441){return _0x19b441['update'](_0x52f537)[_0x8ba0('0x12')](function(_0x17e5c6){return _0x17e5c6;});}return null;};}function removeEntity(_0x3ec601){return function(_0x5d8831){if(_0x5d8831){return _0x5d8831[_0x8ba0('0x25')]()['then'](function(){var _0x188cb4=_0x5d8831[_0x8ba0('0x26')]({'plain':!![]});var _0x34a3f3=_0x8ba0('0x27');return db[_0x8ba0('0x28')][_0x8ba0('0x25')]({'where':{'type':_0x34a3f3,'resourceId':_0x188cb4['id']}})[_0x8ba0('0x12')](function(){return _0x5d8831;});})[_0x8ba0('0x12')](function(){_0x3ec601[_0x8ba0('0x1d')](0xcc)[_0x8ba0('0x1e')]();});}};}function handleEntityNotFound(_0x1cb316){return function(_0x27bcfe){if(!_0x27bcfe){_0x1cb316[_0x8ba0('0x29')](0x194);}return _0x27bcfe;};}function handleError(_0x57b645,_0x2c258f){_0x2c258f=_0x2c258f||0x1f4;return function(_0x4cf5c4){logger['error'](_0x4cf5c4[_0x8ba0('0x2a')]);if(_0x4cf5c4[_0x8ba0('0x2b')]){delete _0x4cf5c4[_0x8ba0('0x2b')];}_0x57b645[_0x8ba0('0x1d')](_0x2c258f)[_0x8ba0('0x2c')](_0x4cf5c4);};}exports[_0x8ba0('0x2d')]=function(_0x50ed48,_0x35c5a1){var _0x7fe88e={'include':[{'model':db['MailServerIn'],'as':_0x8ba0('0x2e')},{'model':db[_0x8ba0('0x2f')],'as':'Smtp'},{'model':db[_0x8ba0('0x30')],'as':'mandatoryDispositionPause'}]},_0x561f4c={},_0x460889={'count':0x0,'rows':[]};var _0x502eb8=_[_0x8ba0('0x31')](db[_0x8ba0('0x32')]['rawAttributes'],function(_0x3e5817){return{'name':_0x3e5817[_0x8ba0('0x33')],'type':_0x3e5817[_0x8ba0('0x34')][_0x8ba0('0x35')]};});_0x561f4c[_0x8ba0('0x36')]=_[_0x8ba0('0x31')](_0x502eb8,_0x8ba0('0x2b'));_0x561f4c[_0x8ba0('0x37')]=_[_0x8ba0('0x38')](_0x50ed48[_0x8ba0('0x37')]);_0x561f4c[_0x8ba0('0x39')]=_[_0x8ba0('0x3a')](_0x561f4c[_0x8ba0('0x36')],_0x561f4c['query']);_0x7fe88e[_0x8ba0('0x3b')]=_['intersection'](_0x561f4c[_0x8ba0('0x36')],qs[_0x8ba0('0x3c')](_0x50ed48[_0x8ba0('0x37')][_0x8ba0('0x3c')]));_0x7fe88e[_0x8ba0('0x3b')]=_0x7fe88e['attributes'][_0x8ba0('0x3d')]?_0x7fe88e[_0x8ba0('0x3b')]:_0x561f4c[_0x8ba0('0x36')];if(!_0x50ed48[_0x8ba0('0x37')][_0x8ba0('0x3e')]('nolimit')){_0x7fe88e[_0x8ba0('0x21')]=qs[_0x8ba0('0x21')](_0x50ed48['query'][_0x8ba0('0x21')]);_0x7fe88e[_0x8ba0('0x1f')]=qs[_0x8ba0('0x1f')](_0x50ed48[_0x8ba0('0x37')]['offset']);}_0x7fe88e['order']=qs[_0x8ba0('0x3f')](_0x50ed48[_0x8ba0('0x37')][_0x8ba0('0x3f')]);_0x7fe88e['where']=qs[_0x8ba0('0x39')](_[_0x8ba0('0x40')](_0x50ed48[_0x8ba0('0x37')],_0x561f4c['filters']),_0x502eb8);if(_0x50ed48[_0x8ba0('0x37')][_0x8ba0('0x41')]){_0x7fe88e[_0x8ba0('0x42')]=_[_0x8ba0('0x43')](_0x7fe88e[_0x8ba0('0x42')],{'$or':_[_0x8ba0('0x31')](_0x502eb8,function(_0xde2089){if(_0xde2089[_0x8ba0('0x34')]!==_0x8ba0('0x44')){var _0x309a60={};_0x309a60[_0xde2089[_0x8ba0('0x2b')]]={'$like':'%'+_0x50ed48[_0x8ba0('0x37')][_0x8ba0('0x41')]+'%'};return _0x309a60;}})});}_0x7fe88e=_[_0x8ba0('0x43')]({},_0x7fe88e,_0x50ed48[_0x8ba0('0x45')]);var _0x3b2ba8={'where':_0x7fe88e[_0x8ba0('0x42')]};return db[_0x8ba0('0x32')][_0x8ba0('0x22')](_0x3b2ba8)[_0x8ba0('0x12')](function(_0x77c3a5){_0x460889[_0x8ba0('0x22')]=_0x77c3a5;if(_0x50ed48[_0x8ba0('0x37')]['includeAll']){_0x7fe88e[_0x8ba0('0x46')]=[{'all':!![]}];}return db['MailAccount'][_0x8ba0('0x47')](_0x7fe88e);})[_0x8ba0('0x12')](function(_0x55b5c1){_0x460889[_0x8ba0('0x48')]=_0x55b5c1;return _0x460889;})['then'](respondWithFilteredResult(_0x35c5a1,_0x7fe88e))[_0x8ba0('0x1c')](handleError(_0x35c5a1,null));};exports['show']=function(_0xd681e9,_0x1cc501){var _0x3dffcc={'raw':![],'where':{'id':_0xd681e9['params']['id']},'include':[{'model':db[_0x8ba0('0x49')],'as':'Imap'},{'model':db[_0x8ba0('0x2f')],'as':_0x8ba0('0x4a')},{'model':db[_0x8ba0('0x30')],'as':_0x8ba0('0x4b')}]},_0x2d0f47={};_0x2d0f47[_0x8ba0('0x36')]=_[_0x8ba0('0x38')](db[_0x8ba0('0x32')][_0x8ba0('0x4c')]);_0x2d0f47[_0x8ba0('0x37')]=_[_0x8ba0('0x38')](_0xd681e9['query']);_0x2d0f47[_0x8ba0('0x39')]=_['intersection'](_0x2d0f47[_0x8ba0('0x36')],_0x2d0f47[_0x8ba0('0x37')]);_0x3dffcc[_0x8ba0('0x3b')]=_[_0x8ba0('0x3a')](_0x2d0f47[_0x8ba0('0x36')],qs[_0x8ba0('0x3c')](_0xd681e9[_0x8ba0('0x37')][_0x8ba0('0x3c')]));_0x3dffcc[_0x8ba0('0x3b')]=_0x3dffcc[_0x8ba0('0x3b')]['length']?_0x3dffcc[_0x8ba0('0x3b')]:_0x2d0f47['model'];if(_0xd681e9[_0x8ba0('0x37')][_0x8ba0('0x4d')]){_0x3dffcc[_0x8ba0('0x46')]=[{'all':!![]}];}_0x3dffcc=_[_0x8ba0('0x43')]({},_0x3dffcc,_0xd681e9[_0x8ba0('0x45')]);return db[_0x8ba0('0x32')]['find'](_0x3dffcc)[_0x8ba0('0x12')](handleEntityNotFound(_0x1cc501,null))[_0x8ba0('0x12')](respondWithResult(_0x1cc501,null))[_0x8ba0('0x1c')](handleError(_0x1cc501,null));};exports[_0x8ba0('0x4e')]=function(_0x25feef,_0x24a00f){if(_0x25feef[_0x8ba0('0x4f')]['id']){delete _0x25feef[_0x8ba0('0x4f')]['id'];}return db[_0x8ba0('0x32')]['find']({'where':{'id':_0x25feef[_0x8ba0('0x50')]['id']},'include':[{'model':db[_0x8ba0('0x49')],'as':_0x8ba0('0x2e')},{'model':db[_0x8ba0('0x2f')],'as':_0x8ba0('0x4a')},{'model':db[_0x8ba0('0x30')],'as':_0x8ba0('0x4b')}]})['then'](handleEntityNotFound(_0x24a00f,null))['then'](saveUpdates(_0x25feef[_0x8ba0('0x4f')],null))['then'](function(_0x2aecc5){if(_0x2aecc5&&_0x25feef[_0x8ba0('0x4f')]['Imap']){return db['MailServerIn'][_0x8ba0('0x4e')](_0x25feef[_0x8ba0('0x4f')][_0x8ba0('0x2e')],{'where':{'MailAccountId':_0x2aecc5['id']}})[_0x8ba0('0x12')](function(){return _0x2aecc5;});}return _0x2aecc5;})['then'](function(_0x48f4ce){if(_0x48f4ce&&_0x25feef['body']['Smtp']){return db['MailServerOut'][_0x8ba0('0x4e')](_0x25feef[_0x8ba0('0x4f')][_0x8ba0('0x4a')],{'where':{'MailAccountId':_0x48f4ce['id']}})['then'](function(){return _0x48f4ce;});}return _0x48f4ce;})[_0x8ba0('0x12')](respondWithResult(_0x24a00f,null))[_0x8ba0('0x1c')](handleError(_0x24a00f,null));};exports[_0x8ba0('0x51')]=function(_0x5b7c23,_0x899fd7){return db[_0x8ba0('0x32')][_0x8ba0('0x51')]()['then'](respondWithResult(_0x899fd7,null))['catch'](handleError(_0x899fd7,null));};exports[_0x8ba0('0x52')]=function(_0x5a1de5,_0x5366db){if(_0x5a1de5[_0x8ba0('0x4f')]['id']){delete _0x5a1de5[_0x8ba0('0x4f')]['id'];}return db[_0x8ba0('0x32')][_0x8ba0('0x53')]({'where':{'id':_0x5a1de5['params']['id']}})[_0x8ba0('0x12')](handleEntityNotFound(_0x5366db,null))[_0x8ba0('0x12')](function(_0x5a649a){if(_0x5a649a){_0x5a1de5['body'][_0x8ba0('0x54')]=_0x5a649a['id'];return db[_0x8ba0('0x55')]['create'](_0x5a1de5[_0x8ba0('0x4f')]);}})[_0x8ba0('0x12')](respondWithResult(_0x5366db,null))[_0x8ba0('0x1c')](handleError(_0x5366db,null));};exports[_0x8ba0('0x56')]=function(_0x59c808,_0x1c6b2e){var _0x5a66a7={'raw':![],'where':{}};var _0x29b56a={};var _0x159fad={'count':0x0,'rows':[]};return db['MailAccount'][_0x8ba0('0x57')]({'where':{'id':_0x59c808['params']['id']}})[_0x8ba0('0x12')](handleEntityNotFound(_0x1c6b2e,null))['then'](function(_0x18a84e){if(_0x18a84e){_0x29b56a[_0x8ba0('0x36')]=_['keys'](db[_0x8ba0('0x55')][_0x8ba0('0x4c')]);_0x29b56a[_0x8ba0('0x37')]=_[_0x8ba0('0x38')](_0x59c808[_0x8ba0('0x37')]);_0x29b56a['filters']=_[_0x8ba0('0x3a')](_0x29b56a[_0x8ba0('0x36')],_0x29b56a[_0x8ba0('0x37')]);_0x5a66a7['attributes']=_['intersection'](_0x29b56a[_0x8ba0('0x36')],qs[_0x8ba0('0x3c')](_0x59c808['query'][_0x8ba0('0x3c')]));_0x5a66a7[_0x8ba0('0x3b')]=_0x5a66a7[_0x8ba0('0x3b')][_0x8ba0('0x3d')]?_0x5a66a7[_0x8ba0('0x3b')]:_0x29b56a[_0x8ba0('0x36')];if(!_0x59c808[_0x8ba0('0x37')][_0x8ba0('0x3e')]('nolimit')){_0x5a66a7['limit']=qs[_0x8ba0('0x21')](_0x59c808['query']['limit']);_0x5a66a7[_0x8ba0('0x1f')]=qs[_0x8ba0('0x1f')](_0x59c808[_0x8ba0('0x37')][_0x8ba0('0x1f')]);}_0x5a66a7[_0x8ba0('0x58')]=qs['sort'](_0x59c808[_0x8ba0('0x37')]['sort']);_0x5a66a7[_0x8ba0('0x42')]=qs['filters'](_[_0x8ba0('0x40')](_0x59c808['query'],_0x29b56a[_0x8ba0('0x39')]));_0x5a66a7[_0x8ba0('0x42')][_0x8ba0('0x54')]=_0x18a84e['id'];if(_0x59c808['query'][_0x8ba0('0x41')]){_0x5a66a7['where']=_['merge'](_0x5a66a7[_0x8ba0('0x42')],{'$or':_[_0x8ba0('0x31')](_0x5a66a7['attributes'],function(_0x176532){var _0xbedbb6={};_0xbedbb6[_0x176532]={'$like':'%'+_0x59c808[_0x8ba0('0x37')][_0x8ba0('0x41')]+'%'};return _0xbedbb6;})});}_0x5a66a7=_[_0x8ba0('0x43')]({},_0x5a66a7,_0x59c808[_0x8ba0('0x45')]);return db[_0x8ba0('0x55')][_0x8ba0('0x22')]({'where':_0x5a66a7[_0x8ba0('0x42')]})[_0x8ba0('0x12')](function(_0x592ab2){_0x159fad[_0x8ba0('0x22')]=_0x592ab2;if(_0x59c808[_0x8ba0('0x37')][_0x8ba0('0x4d')]){_0x5a66a7[_0x8ba0('0x46')]=[{'all':!![]}];}return db[_0x8ba0('0x55')][_0x8ba0('0x47')](_0x5a66a7);})['then'](function(_0x11f9cf){_0x159fad[_0x8ba0('0x48')]=_0x11f9cf;return _0x159fad;});}})[_0x8ba0('0x12')](respondWithFilteredResult(_0x1c6b2e,_0x5a66a7))[_0x8ba0('0x1c')](handleError(_0x1c6b2e,null));};exports[_0x8ba0('0x59')]=function(_0x241eee,_0x4146ec){return db[_0x8ba0('0x32')][_0x8ba0('0x53')]({'where':{'id':_0x241eee[_0x8ba0('0x50')]['id']}})['then'](handleEntityNotFound(_0x4146ec,null))[_0x8ba0('0x12')](function(_0x50a471){if(_0x50a471){return _0x50a471[_0x8ba0('0x59')](_0x241eee['query'][_0x8ba0('0x5a')]);}})['then'](respondWithStatusCode(_0x4146ec,null))['catch'](handleError(_0x4146ec,null));};exports[_0x8ba0('0x5b')]=function(_0x3617f5,_0x1ee33f){if(_0x3617f5[_0x8ba0('0x4f')]['id']){delete _0x3617f5[_0x8ba0('0x4f')]['id'];}return db['MailAccount'][_0x8ba0('0x53')]({'where':{'id':_0x3617f5[_0x8ba0('0x50')]['id']}})[_0x8ba0('0x12')](handleEntityNotFound(_0x1ee33f,null))['then'](function(_0x1cbe2c){if(_0x1cbe2c){_0x3617f5[_0x8ba0('0x4f')][_0x8ba0('0x54')]=_0x1cbe2c['id'];return db['CannedAnswer'][_0x8ba0('0x5c')](_0x3617f5[_0x8ba0('0x4f')]);}})[_0x8ba0('0x12')](respondWithResult(_0x1ee33f,null))[_0x8ba0('0x1c')](handleError(_0x1ee33f,null));};exports[_0x8ba0('0x5d')]=function(_0x4bfcfd,_0x3adcd4){var _0x420c3c={'raw':![],'where':{}};var _0x2a049c={};var _0x1d2136={'count':0x0,'rows':[]};return db[_0x8ba0('0x32')][_0x8ba0('0x57')]({'where':{'id':_0x4bfcfd['params']['id']}})[_0x8ba0('0x12')](handleEntityNotFound(_0x3adcd4,null))[_0x8ba0('0x12')](function(_0x18d9ab){if(_0x18d9ab){_0x2a049c[_0x8ba0('0x36')]=_[_0x8ba0('0x38')](db['CannedAnswer']['rawAttributes']);_0x2a049c['query']=_['keys'](_0x4bfcfd[_0x8ba0('0x37')]);_0x2a049c[_0x8ba0('0x39')]=_['intersection'](_0x2a049c[_0x8ba0('0x36')],_0x2a049c[_0x8ba0('0x37')]);_0x420c3c[_0x8ba0('0x3b')]=_[_0x8ba0('0x3a')](_0x2a049c[_0x8ba0('0x36')],qs[_0x8ba0('0x3c')](_0x4bfcfd['query']['fields']));_0x420c3c[_0x8ba0('0x3b')]=_0x420c3c[_0x8ba0('0x3b')][_0x8ba0('0x3d')]?_0x420c3c[_0x8ba0('0x3b')]:_0x2a049c[_0x8ba0('0x36')];if(!_0x4bfcfd[_0x8ba0('0x37')][_0x8ba0('0x3e')](_0x8ba0('0x5e'))){_0x420c3c[_0x8ba0('0x21')]=qs['limit'](_0x4bfcfd['query'][_0x8ba0('0x21')]);_0x420c3c['offset']=qs['offset'](_0x4bfcfd[_0x8ba0('0x37')][_0x8ba0('0x1f')]);}_0x420c3c['order']=qs['sort'](_0x4bfcfd['query'][_0x8ba0('0x3f')]);_0x420c3c[_0x8ba0('0x42')]=qs[_0x8ba0('0x39')](_[_0x8ba0('0x40')](_0x4bfcfd[_0x8ba0('0x37')],_0x2a049c[_0x8ba0('0x39')]));_0x420c3c[_0x8ba0('0x42')]['MailAccountId']=_0x18d9ab['id'];if(_0x4bfcfd[_0x8ba0('0x37')]['filter']){_0x420c3c[_0x8ba0('0x42')]=_[_0x8ba0('0x43')](_0x420c3c[_0x8ba0('0x42')],{'$or':_[_0x8ba0('0x31')](_0x420c3c[_0x8ba0('0x3b')],function(_0x3eb6bc){var _0x2808c1={};_0x2808c1[_0x3eb6bc]={'$like':'%'+_0x4bfcfd[_0x8ba0('0x37')][_0x8ba0('0x41')]+'%'};return _0x2808c1;})});}_0x420c3c=_[_0x8ba0('0x43')]({},_0x420c3c,_0x4bfcfd['options']);return db[_0x8ba0('0x5f')][_0x8ba0('0x22')]({'where':_0x420c3c[_0x8ba0('0x42')]})[_0x8ba0('0x12')](function(_0xa6afe1){_0x1d2136[_0x8ba0('0x22')]=_0xa6afe1;if(_0x4bfcfd['query'][_0x8ba0('0x4d')]){_0x420c3c['include']=[{'all':!![]}];}return db['CannedAnswer'][_0x8ba0('0x47')](_0x420c3c);})['then'](function(_0x595cef){_0x1d2136[_0x8ba0('0x48')]=_0x595cef;return _0x1d2136;});}})[_0x8ba0('0x12')](respondWithFilteredResult(_0x3adcd4,_0x420c3c))['catch'](handleError(_0x3adcd4,null));};exports[_0x8ba0('0x60')]=function(_0x1f4d57,_0x32048b){return db[_0x8ba0('0x32')][_0x8ba0('0x53')]({'where':{'id':_0x1f4d57[_0x8ba0('0x50')]['id']}})[_0x8ba0('0x12')](handleEntityNotFound(_0x32048b,null))['then'](function(_0x3ee342){if(_0x3ee342){return _0x3ee342['removeAnswers'](_0x1f4d57[_0x8ba0('0x37')]['ids']);}})['then'](respondWithStatusCode(_0x32048b,null))[_0x8ba0('0x1c')](handleError(_0x32048b,null));};exports[_0x8ba0('0x5c')]=function(_0x2c5667,_0x27c0f5){var _0x1b54a9={'name':_0x2c5667['body'][_0x8ba0('0x2b')],'key':_0x2c5667[_0x8ba0('0x4f')][_0x8ba0('0x35')],'provider':_0x2c5667[_0x8ba0('0x4f')][_0x8ba0('0x61')]===_0x8ba0('0x62')?null:_0x2c5667[_0x8ba0('0x4f')][_0x8ba0('0x61')],'email':_0x2c5667[_0x8ba0('0x4f')]['email'],'ListId':_0x2c5667[_0x8ba0('0x4f')]['ListId'],'active':!_['isNil'](_0x2c5667[_0x8ba0('0x4f')][_0x8ba0('0x63')])?_0x2c5667[_0x8ba0('0x4f')][_0x8ba0('0x63')]:!![],'description':_0x2c5667['body'][_0x8ba0('0x64')]||null,'Imap':{},'Smtp':{}};if(_0x1b54a9['provider']){_0x1b54a9[_0x8ba0('0x2e')]['user']=_0x1b54a9[_0x8ba0('0x4a')][_0x8ba0('0x65')]=_0x2c5667[_0x8ba0('0x4f')][_0x8ba0('0x66')];_0x1b54a9[_0x8ba0('0x2e')][_0x8ba0('0x67')]=_0x1b54a9[_0x8ba0('0x4a')][_0x8ba0('0x68')]=_0x2c5667[_0x8ba0('0x4f')]['password'];if(_0x2c5667[_0x8ba0('0x4f')][_0x8ba0('0x69')]){_0x1b54a9['Imap'][_0x8ba0('0x69')]=_0x1b54a9[_0x8ba0('0x4a')]['modernAuthentication']=!![];_0x1b54a9['Imap'][_0x8ba0('0x6a')]=_0x1b54a9[_0x8ba0('0x4a')][_0x8ba0('0x6a')]=_0x2c5667['body'][_0x8ba0('0x6a')];_0x1b54a9[_0x8ba0('0x2e')][_0x8ba0('0x65')]=_0x1b54a9['Smtp'][_0x8ba0('0x65')]=_0x2c5667[_0x8ba0('0x4f')]['username'];}_0x1b54a9[_0x8ba0('0x2e')][_0x8ba0('0x6b')]=_0x1b54a9['Smtp'][_0x8ba0('0x6b')]=null;_0x1b54a9[_0x8ba0('0x2e')][_0x8ba0('0x6c')]=_0x1b54a9[_0x8ba0('0x4a')][_0x8ba0('0x6c')]=null;_0x1b54a9[_0x8ba0('0x2e')][_0x8ba0('0x6d')]=_0x1b54a9[_0x8ba0('0x4a')][_0x8ba0('0x6d')]=null;}else{if(_0x2c5667[_0x8ba0('0x4f')][_0x8ba0('0x6e')]){_0x1b54a9['Imap'][_0x8ba0('0x65')]=_0x1b54a9[_0x8ba0('0x4a')][_0x8ba0('0x65')]=_0x2c5667['body']['username'];_0x1b54a9[_0x8ba0('0x2e')][_0x8ba0('0x67')]=_0x1b54a9[_0x8ba0('0x4a')]['pass']=_0x2c5667[_0x8ba0('0x4f')][_0x8ba0('0x67')];}else{_0x1b54a9[_0x8ba0('0x2e')][_0x8ba0('0x6e')]=_0x1b54a9[_0x8ba0('0x4a')][_0x8ba0('0x6e')]=![];}_0x1b54a9[_0x8ba0('0x2e')][_0x8ba0('0x6c')]=_0x2c5667[_0x8ba0('0x4f')]['Imap'][_0x8ba0('0x6c')];_0x1b54a9[_0x8ba0('0x2e')][_0x8ba0('0x6d')]=_0x2c5667[_0x8ba0('0x4f')][_0x8ba0('0x2e')][_0x8ba0('0x6d')];_0x1b54a9[_0x8ba0('0x4a')][_0x8ba0('0x6c')]=_0x2c5667[_0x8ba0('0x4f')][_0x8ba0('0x4a')][_0x8ba0('0x6c')];_0x1b54a9[_0x8ba0('0x4a')][_0x8ba0('0x6d')]=_0x2c5667[_0x8ba0('0x4f')][_0x8ba0('0x4a')]['port'];}return db[_0x8ba0('0x32')][_0x8ba0('0x5c')](_0x1b54a9,{'include':[{'model':db['MailServerOut'],'as':'Smtp'},{'model':db[_0x8ba0('0x49')],'as':'Imap'}]})[_0x8ba0('0x12')](function(_0x23e740){var _0x1f6f97=_0x2c5667['user'][_0x8ba0('0x26')]({'plain':!![]});if(!_0x1f6f97)throw new Error(_0x8ba0('0x6f'));if(_0x1f6f97[_0x8ba0('0x70')]===_0x8ba0('0x65')){var _0x6ce2cf=_0x23e740[_0x8ba0('0x26')]({'plain':!![]});return db[_0x8ba0('0x71')][_0x8ba0('0x53')]({'where':{'name':_0x8ba0('0x27'),'userProfileId':_0x1f6f97[_0x8ba0('0x72')]},'raw':!![]})[_0x8ba0('0x12')](function(_0x579e9f){if(_0x579e9f&&_0x579e9f[_0x8ba0('0x73')]===0x0){return db[_0x8ba0('0x28')]['create']({'name':_0x6ce2cf['name'],'resourceId':_0x6ce2cf['id'],'type':_0x579e9f[_0x8ba0('0x2b')],'sectionId':_0x579e9f['id']},{})['then'](function(){return _0x23e740;});}else{return _0x23e740;}})['catch'](function(_0x4196d9){logger[_0x8ba0('0x18')](_0x8ba0('0x74'),_0x4196d9);throw _0x4196d9;});}return _0x23e740;})['then'](respondWithResult(_0x27c0f5,0xc9))['catch'](handleError(_0x27c0f5,null));};exports['getImap']=function(_0xa2db53,_0x7187fd){return db[_0x8ba0('0x32')][_0x8ba0('0x57')]({'where':{'id':_0xa2db53['params']['id']}})[_0x8ba0('0x12')](handleEntityNotFound(_0x7187fd,null))[_0x8ba0('0x12')](function(_0x27dc09){if(_0x27dc09){return _0x27dc09[_0x8ba0('0x75')]();}return null;})['then'](respondWithResult(_0x7187fd,null))['catch'](handleError(_0x7187fd,null));};exports[_0x8ba0('0x76')]=function(_0x3c9248,_0x28372c){if(_0x3c9248[_0x8ba0('0x4f')]['id']){delete _0x3c9248[_0x8ba0('0x4f')]['id'];}return db[_0x8ba0('0x32')][_0x8ba0('0x53')]({'where':{'id':_0x3c9248[_0x8ba0('0x50')]['id']}})[_0x8ba0('0x12')](handleEntityNotFound(_0x28372c,null))['then'](function(_0x4fbed1){if(_0x4fbed1){_0x3c9248[_0x8ba0('0x4f')][_0x8ba0('0x54')]=_0x4fbed1['id'];return db[_0x8ba0('0x49')]['create'](_0x3c9248['body']);}})[_0x8ba0('0x12')](respondWithResult(_0x28372c,null))['catch'](handleError(_0x28372c,null));};exports['removeImap']=function(_0x21187e,_0x3a35a7){return db[_0x8ba0('0x32')][_0x8ba0('0x57')]({'where':{'id':_0x21187e[_0x8ba0('0x50')]['id']}})[_0x8ba0('0x12')](handleEntityNotFound(_0x3a35a7,null))[_0x8ba0('0x12')](function(_0x1d622c){if(_0x1d622c){return _0x1d622c['setImap'](null);}return null;})['then'](respondWithStatusCode(_0x3a35a7,null))[_0x8ba0('0x1c')](handleError(_0x3a35a7,null));};exports[_0x8ba0('0x77')]=function(_0xcb6ecc,_0x4fe789){return db['MailAccount'][_0x8ba0('0x57')]({'where':{'id':_0xcb6ecc[_0x8ba0('0x50')]['id']}})[_0x8ba0('0x12')](handleEntityNotFound(_0x4fe789,null))['then'](function(_0x514cd6){if(_0x514cd6){return _0x514cd6[_0x8ba0('0x77')]();}return null;})[_0x8ba0('0x12')](respondWithResult(_0x4fe789,null))['catch'](handleError(_0x4fe789,null));};exports['addSmtp']=function(_0x20245f,_0x3fe2fd){if(_0x20245f[_0x8ba0('0x4f')]['id']){delete _0x20245f['body']['id'];}return db[_0x8ba0('0x32')]['find']({'where':{'id':_0x20245f['params']['id']}})[_0x8ba0('0x12')](handleEntityNotFound(_0x3fe2fd,null))[_0x8ba0('0x12')](function(_0x1525f5){if(_0x1525f5){_0x20245f[_0x8ba0('0x4f')][_0x8ba0('0x54')]=_0x1525f5['id'];return db['MailServerOut'][_0x8ba0('0x5c')](_0x20245f['body']);}})['then'](respondWithResult(_0x3fe2fd,null))[_0x8ba0('0x1c')](handleError(_0x3fe2fd,null));};exports[_0x8ba0('0x78')]=function(_0x39b282,_0x306c23){return db['MailAccount'][_0x8ba0('0x57')]({'where':{'id':_0x39b282[_0x8ba0('0x50')]['id']}})['then'](handleEntityNotFound(_0x306c23,null))[_0x8ba0('0x12')](function(_0x644c5e){if(_0x644c5e){return _0x644c5e[_0x8ba0('0x79')](null);}return null;})[_0x8ba0('0x12')](respondWithStatusCode(_0x306c23,null))['catch'](handleError(_0x306c23,null));};exports['addInteraction']=function(_0x56a17e,_0x49ddfa){return db[_0x8ba0('0x7a')]['find']({'where':{'id':_0x56a17e[_0x8ba0('0x50')]['id']}})[_0x8ba0('0x12')](handleEntityNotFound(_0x49ddfa,null))[_0x8ba0('0x12')](function(_0x4a2142){if(_0x4a2142){return _0x4a2142[_0x8ba0('0x7b')](_0x56a17e[_0x8ba0('0x4f')][_0x8ba0('0x5a')],_[_0x8ba0('0x7c')](_0x56a17e['body'],[_0x8ba0('0x5a'),'id'])||{});}})['then'](respondWithResult(_0x49ddfa,null))['catch'](handleError(_0x49ddfa,null));};exports[_0x8ba0('0x7d')]=function(_0x123840,_0x2f6a8c){var _0x407a34={'raw':![],'where':{}};var _0x59b655={};var _0x22392c={'count':0x0,'rows':[]};return db[_0x8ba0('0x32')][_0x8ba0('0x57')]({'where':{'id':_0x123840['params']['id']}})['then'](handleEntityNotFound(_0x2f6a8c,null))[_0x8ba0('0x12')](function(_0x4a0c78){if(_0x4a0c78){_0x59b655[_0x8ba0('0x36')]=_['keys'](db[_0x8ba0('0x7a')]['rawAttributes']);_0x59b655[_0x8ba0('0x37')]=_[_0x8ba0('0x38')](_0x123840[_0x8ba0('0x37')]);_0x59b655[_0x8ba0('0x39')]=_[_0x8ba0('0x3a')](_0x59b655[_0x8ba0('0x36')],_0x59b655[_0x8ba0('0x37')]);_0x407a34[_0x8ba0('0x3b')]=_[_0x8ba0('0x3a')](_0x59b655['model'],qs[_0x8ba0('0x3c')](_0x123840[_0x8ba0('0x37')]['fields']));_0x407a34[_0x8ba0('0x3b')]=_0x407a34[_0x8ba0('0x3b')][_0x8ba0('0x3d')]?_0x407a34['attributes']:_0x59b655['model'];if(!_0x123840[_0x8ba0('0x37')][_0x8ba0('0x3e')](_0x8ba0('0x5e'))){_0x407a34[_0x8ba0('0x21')]=qs[_0x8ba0('0x21')](_0x123840['query'][_0x8ba0('0x21')]);_0x407a34[_0x8ba0('0x1f')]=qs['offset'](_0x123840[_0x8ba0('0x37')][_0x8ba0('0x1f')]);}_0x407a34[_0x8ba0('0x58')]=qs[_0x8ba0('0x3f')](_0x123840[_0x8ba0('0x37')][_0x8ba0('0x3f')]);_0x407a34[_0x8ba0('0x42')]=qs[_0x8ba0('0x39')](_[_0x8ba0('0x40')](_0x123840[_0x8ba0('0x37')],_0x59b655[_0x8ba0('0x39')]));_0x407a34[_0x8ba0('0x42')][_0x8ba0('0x54')]=_0x4a0c78['id'];if(_0x123840[_0x8ba0('0x37')][_0x8ba0('0x41')]){_0x407a34['where']=_[_0x8ba0('0x43')](_0x407a34[_0x8ba0('0x42')],{'$or':_[_0x8ba0('0x31')](_0x407a34[_0x8ba0('0x3b')],function(_0x5a1c48){var _0x121c18={};_0x121c18[_0x5a1c48]={'$like':'%'+_0x123840[_0x8ba0('0x37')][_0x8ba0('0x41')]+'%'};return _0x121c18;})});}_0x407a34=_[_0x8ba0('0x43')]({},_0x407a34,_0x123840[_0x8ba0('0x45')]);return db[_0x8ba0('0x7a')][_0x8ba0('0x22')]({'where':_0x407a34[_0x8ba0('0x42')]})[_0x8ba0('0x12')](function(_0x227856){_0x22392c['count']=_0x227856;if(_0x123840[_0x8ba0('0x37')][_0x8ba0('0x4d')]){_0x407a34[_0x8ba0('0x46')]=[{'model':db['CmContact'],'as':_0x8ba0('0x7e'),'required':![]},{'model':db[_0x8ba0('0x7f')],'as':'Owner','attributes':[_0x8ba0('0x2b'),_0x8ba0('0x80'),_0x8ba0('0x81')],'required':![]},{'model':db[_0x8ba0('0x82')],'as':'Tags','attributes':['id',_0x8ba0('0x2b'),'color'],'where':_0x123840[_0x8ba0('0x37')][_0x8ba0('0x83')]?{'id':_0x123840[_0x8ba0('0x37')]['tag']}:undefined,'required':_0x123840[_0x8ba0('0x37')][_0x8ba0('0x83')]?!![]:![]}];}return db[_0x8ba0('0x7a')][_0x8ba0('0x47')](_0x407a34);})['then'](function(_0x289f06){_0x22392c[_0x8ba0('0x48')]=_0x289f06;return _0x22392c;});}})[_0x8ba0('0x12')](respondWithFilteredResult(_0x2f6a8c,_0x407a34))[_0x8ba0('0x1c')](handleError(_0x2f6a8c,null));};exports[_0x8ba0('0x84')]=function addApplications(_0x48047b,_0x3f47fa){var _0x4b30ea=_0x48047b[_0x8ba0('0x50')]['id'];var _0x4e5edf=_0x48047b[_0x8ba0('0x4f')];var _0x356542=0xc8;var _0x118112=null;return db[_0x8ba0('0x85')]['transaction']({'isolationLevel':db[_0x8ba0('0x85')][_0x8ba0('0x86')][_0x8ba0('0x87')]['READ_COMMITTED']},function(_0x3e57e2){return db[_0x8ba0('0x32')][_0x8ba0('0x57')]({'where':{'id':_0x4b30ea},'transaction':_0x3e57e2})[_0x8ba0('0x12')](function(_0x4250f6){if(_0x4250f6){return db['MailApplication'][_0x8ba0('0x25')]({'where':{'MailAccountId':_0x4b30ea},'transaction':_0x3e57e2})[_0x8ba0('0x12')](function(){var _0x468ba9=_['map'](_0x4e5edf,function(_0x52ddc1){_0x52ddc1[_0x8ba0('0x54')]=_0x4b30ea;return _0x52ddc1;});return db[_0x8ba0('0x88')][_0x8ba0('0x89')](_0x468ba9,{'transaction':_0x3e57e2});});}else{_0x356542=0x194;_0x118112=[];}});})[_0x8ba0('0x12')](function(){if(_0x356542!==0x194){return db[_0x8ba0('0x88')]['findAndCountAll']({'where':{'MailAccountId':_0x4b30ea},'order':_0x8ba0('0x8a')})[_0x8ba0('0x12')](function(_0x24e82a){_0x118112=_0x24e82a;});}})[_0x8ba0('0x1c')](function(_0x9d11b1){_0x356542=0x1f4;logger[_0x8ba0('0x18')](_0x9d11b1[_0x8ba0('0x2a')]);if(_0x9d11b1['name']){delete _0x9d11b1[_0x8ba0('0x2b')];}_0x118112=_0x9d11b1;})[_0x8ba0('0x8b')](function(){if(_0x118112===null){_0x3f47fa[_0x8ba0('0x29')](_0x356542);}else{if(_0x356542===0x1f4){_0x3f47fa[_0x8ba0('0x1d')](_0x356542)['send'](_0x118112);}else{_0x3f47fa[_0x8ba0('0x1d')](_0x356542)['json'](_0x118112);}}});};exports['getApplications']=function(_0x1aba14,_0x4b5eab){var _0x3ee2a6={};var _0x5e7b5a={};var _0x3994ac;var _0x532464;return db[_0x8ba0('0x32')][_0x8ba0('0x57')]({'where':{'id':_0x1aba14[_0x8ba0('0x50')]['id']}})[_0x8ba0('0x12')](handleEntityNotFound(_0x4b5eab,null))['then'](function(_0x5a5d64){if(_0x5a5d64){_0x3994ac=_0x5a5d64;_0x5e7b5a[_0x8ba0('0x36')]=_[_0x8ba0('0x38')](db[_0x8ba0('0x88')][_0x8ba0('0x4c')]);_0x5e7b5a[_0x8ba0('0x37')]=_[_0x8ba0('0x38')](_0x1aba14['query']);_0x5e7b5a[_0x8ba0('0x39')]=_[_0x8ba0('0x3a')](_0x5e7b5a[_0x8ba0('0x36')],_0x5e7b5a[_0x8ba0('0x37')]);_0x3ee2a6['attributes']=_[_0x8ba0('0x3a')](_0x5e7b5a['model'],qs['fields'](_0x1aba14[_0x8ba0('0x37')][_0x8ba0('0x3c')]));_0x3ee2a6[_0x8ba0('0x3b')]=_0x3ee2a6['attributes']['length']?_0x3ee2a6[_0x8ba0('0x3b')]:_0x5e7b5a[_0x8ba0('0x36')];_0x3ee2a6[_0x8ba0('0x58')]=qs['sort'](_0x1aba14[_0x8ba0('0x37')][_0x8ba0('0x3f')]);_0x3ee2a6['where']=qs['filters'](_['pick'](_0x1aba14[_0x8ba0('0x37')],_0x5e7b5a['filters']));if(_0x1aba14[_0x8ba0('0x37')][_0x8ba0('0x41')]){_0x3ee2a6['where']=_[_0x8ba0('0x43')](_0x3ee2a6['where'],{'$or':_['map'](_0x3ee2a6['attributes'],function(_0x4c0242){var _0x434eca={};_0x434eca[_0x4c0242]={'$like':'%'+_0x1aba14[_0x8ba0('0x37')][_0x8ba0('0x41')]+'%'};return _0x434eca;})});}_0x3ee2a6=_['merge']({},_0x3ee2a6,_0x1aba14[_0x8ba0('0x45')]);return _0x3994ac[_0x8ba0('0x8c')](_0x3ee2a6);}})[_0x8ba0('0x12')](function(_0x37761d){if(_0x37761d){_0x532464=_0x37761d['length'];if(!_0x1aba14['query'][_0x8ba0('0x3e')]('nolimit')){_0x3ee2a6[_0x8ba0('0x21')]=qs[_0x8ba0('0x21')](_0x1aba14['query']['limit']);_0x3ee2a6[_0x8ba0('0x1f')]=qs[_0x8ba0('0x1f')](_0x1aba14[_0x8ba0('0x37')]['offset']);}return _0x3994ac['getApplications'](_0x3ee2a6);}})['then'](function(_0x53ceee){if(_0x53ceee){return _0x53ceee?{'count':_0x532464,'rows':_0x53ceee}:null;}})[_0x8ba0('0x12')](respondWithResult(_0x4b5eab,null))['catch'](handleError(_0x4b5eab,null));};exports[_0x8ba0('0x8d')]=function(_0x235b7c,_0x59d141){var _0x295fd8={'raw':!![],'where':{}};var _0x5a0b16={};var _0x2f10d8={'count':0x0,'rows':[]};return db[_0x8ba0('0x32')][_0x8ba0('0x57')]({'where':{'id':_0x235b7c[_0x8ba0('0x50')]['id']}})[_0x8ba0('0x12')](handleEntityNotFound(_0x59d141,null))[_0x8ba0('0x12')](function(_0x4563b0){if(_0x4563b0){_0x5a0b16[_0x8ba0('0x36')]=_[_0x8ba0('0x38')](db['MailMessage'][_0x8ba0('0x4c')]);_0x5a0b16[_0x8ba0('0x37')]=_['keys'](_0x235b7c[_0x8ba0('0x37')]);_0x5a0b16['filters']=_['intersection'](_0x5a0b16[_0x8ba0('0x36')],_0x5a0b16[_0x8ba0('0x37')]);_0x295fd8['attributes']=_['intersection'](_0x5a0b16[_0x8ba0('0x36')],qs[_0x8ba0('0x3c')](_0x235b7c['query'][_0x8ba0('0x3c')]));_0x295fd8['attributes']=_0x295fd8[_0x8ba0('0x3b')][_0x8ba0('0x3d')]?_0x295fd8[_0x8ba0('0x3b')]:_0x5a0b16[_0x8ba0('0x36')];if(!_0x235b7c[_0x8ba0('0x37')][_0x8ba0('0x3e')](_0x8ba0('0x5e'))){_0x295fd8['limit']=qs[_0x8ba0('0x21')](_0x235b7c[_0x8ba0('0x37')]['limit']);_0x295fd8[_0x8ba0('0x1f')]=qs[_0x8ba0('0x1f')](_0x235b7c[_0x8ba0('0x37')][_0x8ba0('0x1f')]);}_0x295fd8[_0x8ba0('0x58')]=qs[_0x8ba0('0x3f')](_0x235b7c[_0x8ba0('0x37')][_0x8ba0('0x3f')]);_0x295fd8['where']=qs[_0x8ba0('0x39')](_[_0x8ba0('0x40')](_0x235b7c[_0x8ba0('0x37')],_0x5a0b16[_0x8ba0('0x39')]));_0x295fd8[_0x8ba0('0x42')]['MailAccountId']=_0x4563b0['id'];if(_0x235b7c['query'][_0x8ba0('0x41')]){_0x295fd8[_0x8ba0('0x42')]=_['merge'](_0x295fd8[_0x8ba0('0x42')],{'$or':_[_0x8ba0('0x31')](_0x295fd8[_0x8ba0('0x3b')],function(_0x202155){var _0x3f6e8d={};_0x3f6e8d[_0x202155]={'$like':'%'+_0x235b7c[_0x8ba0('0x37')][_0x8ba0('0x41')]+'%'};return _0x3f6e8d;})});}if(_0x235b7c[_0x8ba0('0x37')]['$gte']){var _0x9c6a62=_0x235b7c[_0x8ba0('0x37')][_0x8ba0('0x8e')][_0x8ba0('0x8f')](',');var _0x31c2d0={};_0x31c2d0[_0x9c6a62[0x0]]={'$gte':moment(_0x9c6a62[0x1])['format'](_0x8ba0('0x90'))};_0x295fd8[_0x8ba0('0x42')]=_[_0x8ba0('0x43')](_0x295fd8['where'],_0x31c2d0);}_0x295fd8=_[_0x8ba0('0x43')]({},_0x295fd8,_0x235b7c[_0x8ba0('0x45')]);return db[_0x8ba0('0x91')]['count']({'where':_0x295fd8[_0x8ba0('0x42')]})[_0x8ba0('0x12')](function(_0x203ee7){_0x2f10d8[_0x8ba0('0x22')]=_0x203ee7;if(_0x235b7c['query'][_0x8ba0('0x4d')]){_0x295fd8[_0x8ba0('0x46')]=[{'all':!![]}];}return db[_0x8ba0('0x91')][_0x8ba0('0x47')](_0x295fd8);})[_0x8ba0('0x12')](function(_0x80f7c4){if(_0x235b7c[_0x8ba0('0x37')]['inlineCss']===_0x8ba0('0x92')){for(var _0x5e7934=0x0;_0x5e7934<_0x80f7c4[_0x8ba0('0x3d')];_0x5e7934++){_0x80f7c4[_0x5e7934][_0x8ba0('0x4f')]=juice(_0x80f7c4[_0x5e7934]['body']);}}_0x2f10d8['rows']=_0x80f7c4;return _0x2f10d8;});}})[_0x8ba0('0x12')](respondWithFilteredResult(_0x59d141,_0x295fd8))['catch'](handleError(_0x59d141,null));};exports['send']=function(_0x348fcb,_0x4c0f94){var _0x111a7f,_0x105248={},_0x147e36;if(_0x348fcb[_0x8ba0('0x4f')]['to']){_0x147e36=_0x348fcb[_0x8ba0('0x4f')]['to'][_0x8ba0('0x8f')](',')[0x0];}return db[_0x8ba0('0x32')]['find']({'where':{'id':_0x348fcb[_0x8ba0('0x50')]['id']},'include':[{'model':db[_0x8ba0('0x93')],'as':_0x8ba0('0x94'),'include':[{'model':db['CmContact'],'as':_0x8ba0('0x95'),'where':{'email':_0x147e36},'limit':0x1,'order':[[_0x8ba0('0x96'),_0x8ba0('0x97')]]}]},{'model':db[_0x8ba0('0x2f')],'as':_0x8ba0('0x4a'),'raw':!![]}]})['then'](handleEntityNotFound(_0x4c0f94,null))[_0x8ba0('0x12')](function(_0x490385){if(_0x490385){_0x111a7f=_0x490385;if(_0x490385[_0x8ba0('0x4a')]){if(_[_0x8ba0('0x98')](_0x348fcb['body'][_0x8ba0('0x99')])){_0x348fcb[_0x8ba0('0x4f')][_0x8ba0('0x99')]=util[_0x8ba0('0x9a')]('%s\x20<%s>',_0x490385[_0x8ba0('0x2b')],_0x490385[_0x8ba0('0x9b')]||_0x490385[_0x8ba0('0x4a')]['user']);}if(_0x348fcb[_0x8ba0('0x4f')][_0x8ba0('0x9c')]&&_0x348fcb['body']['attachments'][_0x8ba0('0x3d')]){for(var _0x12eef6=0x0;_0x12eef6<_0x348fcb[_0x8ba0('0x4f')][_0x8ba0('0x9c')][_0x8ba0('0x3d')];_0x12eef6+=0x1){_0x348fcb[_0x8ba0('0x4f')]['attachments'][_0x12eef6]={'filename':_0x348fcb['body'][_0x8ba0('0x9c')][_0x12eef6][_0x8ba0('0x2b')],'path':path[_0x8ba0('0x9d')](config[_0x8ba0('0x9e')],'server/files/attachments',_0x348fcb[_0x8ba0('0x4f')][_0x8ba0('0x9c')][_0x12eef6]['basename'])};}}var _0x3612dd={'tls':{'rejectUnauthorized':![]}};if(_[_0x8ba0('0x98')](_0x490385[_0x8ba0('0x4a')][_0x8ba0('0x6b')])){if(_0x490385[_0x8ba0('0x4a')]['authentication']){_0x3612dd[_0x8ba0('0x9f')]={'user':_0x490385['Smtp'][_0x8ba0('0x65')],'pass':_0x490385[_0x8ba0('0x4a')]['pass']};}_0x3612dd[_0x8ba0('0x6c')]=_0x490385[_0x8ba0('0x4a')][_0x8ba0('0x6c')];_0x3612dd['port']=_0x490385[_0x8ba0('0x4a')]['port'];_0x3612dd[_0x8ba0('0xa0')]=_0x490385[_0x8ba0('0x4a')]['secure'];}else{_0x3612dd[_0x8ba0('0x6b')]=_0x490385['Smtp']['service'];_0x3612dd[_0x8ba0('0x9f')]={'user':_0x490385[_0x8ba0('0x4a')][_0x8ba0('0x65')],'pass':_0x490385[_0x8ba0('0x4a')][_0x8ba0('0x68')]};}return respondWithRpcPromise(_0x8ba0('0xa1'),_0x8ba0('0xa2'),{'account':_0x3612dd,'message':_0x348fcb[_0x8ba0('0x4f')]});}else{throw new Error(_0x8ba0('0xa3'));}}})['then'](function(_0x54e39c){if(_0x54e39c){_0x105248=_0x54e39c;if(_0x111a7f[_0x8ba0('0x94')]){if(_0x111a7f[_0x8ba0('0x94')][_0x8ba0('0x95')][_0x8ba0('0x3d')]){return _0x111a7f[_0x8ba0('0x94')][_0x8ba0('0x95')][0x0];}else{return db[_0x8ba0('0xa4')][_0x8ba0('0x5c')](_[_0x8ba0('0xd')](_0x348fcb['body'],{'firstName':_0x348fcb[_0x8ba0('0x4f')]['to'],'email':_0x348fcb[_0x8ba0('0x4f')]['to'],'phone':_0x348fcb[_0x8ba0('0x4f')]['to'],'ListId':_0x111a7f[_0x8ba0('0xa5')]}));}}else{throw new Error(_0x8ba0('0xa3'));}}})[_0x8ba0('0x12')](function(_0x3fa555){if(_0x3fa555){var _0x12a6e9={'UserId':_0x348fcb[_0x8ba0('0x65')]['id'],'ContactId':_0x3fa555['id'],'MailAccountId':_0x111a7f['id'],'inReplyTo':_0x105248[_0x8ba0('0xa6')],'to':_0x348fcb['body'][_0x8ba0('0x99')],'cc':_0x348fcb[_0x8ba0('0x4f')]['cc'],'subject':_0x348fcb[_0x8ba0('0x4f')][_0x8ba0('0xa7')],'attach':_0x348fcb['body'][_0x8ba0('0xa8')],'firstMsgDirection':_0x8ba0('0xa9'),'lastMsgAt':moment()['format'](_0x8ba0('0x90')),'lastMsgDirection':_0x8ba0('0xa9'),'Messages':[_['merge'](_0x348fcb[_0x8ba0('0x4f')],{'messageId':_0x105248[_0x8ba0('0xa6')],'sentAt':moment()[_0x8ba0('0x9a')](_0x8ba0('0x90')),'read':!![],'MailAccountId':_0x111a7f['id'],'UserId':_0x348fcb['user']['id'],'ContactId':_0x3fa555['id']})]};if(_0x348fcb['body'][_0x8ba0('0xaa')]){_0x12a6e9=_[_0x8ba0('0x43')](_0x12a6e9,_0x348fcb['body']['Interaction']);}return db['MailInteraction'][_0x8ba0('0x5c')](_0x12a6e9,{'include':[{'model':db[_0x8ba0('0x91')],'as':_0x8ba0('0xab')}]});}})[_0x8ba0('0x12')](respondWithResult(_0x4c0f94,null))[_0x8ba0('0x1c')](handleError(_0x4c0f94,null));};exports[_0x8ba0('0xac')]=function(_0x477a46,_0x2ec815){return db['MailAccount'][_0x8ba0('0x53')]({'where':{'id':_0x477a46['params']['id']},'include':[{'model':db['MailServerOut'],'as':_0x8ba0('0x4a'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x8ba0('0xad'),'raw':!![]}]}]})[_0x8ba0('0x12')](handleEntityNotFound(_0x2ec815,null))['then'](function(_0x31d43d){if(_0x31d43d&&_0x31d43d[_0x8ba0('0x4a')]){var _0x186e22={'id':_0x31d43d['id'],'tls':{'rejectUnauthorized':![]}};if(_0x31d43d[_0x8ba0('0x4a')][_0x8ba0('0x6b')]){_0x186e22[_0x8ba0('0x6b')]=_0x31d43d[_0x8ba0('0x4a')][_0x8ba0('0x6b')];}else{_0x186e22['host']=_0x31d43d[_0x8ba0('0x4a')][_0x8ba0('0x6c')];_0x186e22[_0x8ba0('0x6d')]=_0x31d43d[_0x8ba0('0x4a')][_0x8ba0('0x6d')];_0x186e22['secure']=_0x31d43d[_0x8ba0('0x4a')][_0x8ba0('0xa0')];}if(_0x31d43d[_0x8ba0('0x4a')][_0x8ba0('0x6e')]){if(_0x31d43d['Smtp'][_0x8ba0('0x69')]){_0x186e22[_0x8ba0('0x9f')]={'type':_0x8ba0('0xae'),'user':_0x31d43d[_0x8ba0('0x4a')]['user'],'accessToken':_0x31d43d[_0x8ba0('0x4a')][_0x8ba0('0xad')][_0x8ba0('0xaf')]};}else{_0x186e22[_0x8ba0('0x9f')]={'user':_0x31d43d[_0x8ba0('0x4a')][_0x8ba0('0x65')],'pass':_0x31d43d[_0x8ba0('0x4a')]['pass']};}}return respondWithRpcPromise('VerifySmtp',_0x8ba0('0xac'),{'account':_0x186e22});}})[_0x8ba0('0x12')](respondWithResult(_0x2ec815,null))[_0x8ba0('0x1c')](handleError(_0x2ec815,null));};exports[_0x8ba0('0x25')]=function(_0xe9911d,_0x3498ad){return db[_0x8ba0('0x32')][_0x8ba0('0x53')]({'where':{'id':_0xe9911d['params']['id']}})['then'](handleEntityNotFound(_0x3498ad,null))[_0x8ba0('0x12')](function(_0x2767ac){if(_0x2767ac&&_0x2767ac[_0x8ba0('0x6b')]){throw new db[(_0x8ba0('0xb0'))]['ValidationError'](_0x8ba0('0xb1'));}return _0x2767ac;})['then'](removeEntity(_0x3498ad,null))[_0x8ba0('0x1c')](handleError(_0x3498ad,null));};exports['addAgents']=function(_0x1e49e3,_0x2b05e9){return db[_0x8ba0('0x32')][_0x8ba0('0x53')]({'where':{'id':_0x1e49e3[_0x8ba0('0x50')]['id']}})[_0x8ba0('0x12')](handleEntityNotFound(_0x2b05e9,null))['then'](function(_0x27974f){if(_0x27974f){return _0x27974f[_0x8ba0('0xb2')](_0x1e49e3[_0x8ba0('0x4f')][_0x8ba0('0x5a')],_[_0x8ba0('0x7c')](_0x1e49e3[_0x8ba0('0x4f')],[_0x8ba0('0x5a'),'id'])||{})[_0x8ba0('0xb3')](function(_0x3e7305){for(var _0x1d55d3=0x0;_0x1d55d3<_0x1e49e3[_0x8ba0('0x4f')][_0x8ba0('0x5a')][_0x8ba0('0x3d')];_0x1d55d3+=0x1){socket['emit']('userMailAccount:save',{'UserId':Number(_0x1e49e3['body'][_0x8ba0('0x5a')][_0x1d55d3]),'MailAccountId':Number(_0x1e49e3[_0x8ba0('0x50')]['id'])});}return _0x3e7305;});}})[_0x8ba0('0x12')](respondWithResult(_0x2b05e9,null))[_0x8ba0('0x1c')](handleError(_0x2b05e9,null));};exports[_0x8ba0('0xb4')]=function(_0x5e6ec4,_0x256c31){return db['MailAccount'][_0x8ba0('0x53')]({'where':{'id':_0x5e6ec4['params']['id']}})[_0x8ba0('0x12')](handleEntityNotFound(_0x256c31,null))[_0x8ba0('0x12')](function(_0x1a2bf6){if(_0x1a2bf6){return _0x1a2bf6[_0x8ba0('0xb4')](_0x5e6ec4[_0x8ba0('0x37')]['ids'])['then'](function(){if(_[_0x8ba0('0xb5')](_0x5e6ec4[_0x8ba0('0x37')][_0x8ba0('0x5a')])){for(var _0xde08aa=0x0;_0xde08aa<_0x5e6ec4[_0x8ba0('0x37')][_0x8ba0('0x5a')]['length'];_0xde08aa+=0x1){socket[_0x8ba0('0xb6')](_0x8ba0('0xb7'),{'UserId':Number(_0x5e6ec4[_0x8ba0('0x37')][_0x8ba0('0x5a')][_0xde08aa]),'MailAccountId':Number(_0x5e6ec4[_0x8ba0('0x50')]['id'])});}}else{socket[_0x8ba0('0xb6')](_0x8ba0('0xb7'),{'UserId':Number(_0x5e6ec4[_0x8ba0('0x37')][_0x8ba0('0x5a')]),'MailAccountId':Number(_0x5e6ec4['params']['id'])});}});}})['then'](respondWithStatusCode(_0x256c31,null))[_0x8ba0('0x1c')](handleError(_0x256c31,null));};exports['getAgents']=function(_0x10e853,_0x282bbd){var _0x16d71e={};var _0xca1082={};var _0x4ede78;var _0x24ffe6;return db[_0x8ba0('0x32')][_0x8ba0('0x57')]({'where':{'id':_0x10e853['params']['id']}})['then'](handleEntityNotFound(_0x282bbd,null))[_0x8ba0('0x12')](function(_0x28e721){if(_0x28e721){_0x4ede78=_0x28e721;_0xca1082[_0x8ba0('0x36')]=_[_0x8ba0('0x38')](db[_0x8ba0('0x7f')]['rawAttributes']);_0xca1082[_0x8ba0('0x37')]=_['keys'](_0x10e853[_0x8ba0('0x37')]);_0xca1082['filters']=_[_0x8ba0('0x3a')](_0xca1082['model'],_0xca1082[_0x8ba0('0x37')]);_0x16d71e[_0x8ba0('0x3b')]=_[_0x8ba0('0x3a')](_0xca1082['model'],qs[_0x8ba0('0x3c')](_0x10e853[_0x8ba0('0x37')][_0x8ba0('0x3c')]));_0x16d71e['attributes']=_0x16d71e[_0x8ba0('0x3b')][_0x8ba0('0x3d')]?_0x16d71e['attributes']:_0xca1082['model'];_0x16d71e[_0x8ba0('0x58')]=qs[_0x8ba0('0x3f')](_0x10e853[_0x8ba0('0x37')][_0x8ba0('0x3f')]);_0x16d71e[_0x8ba0('0x42')]=qs[_0x8ba0('0x39')](_['pick'](_0x10e853[_0x8ba0('0x37')],_0xca1082[_0x8ba0('0x39')]));if(_0x10e853[_0x8ba0('0x37')][_0x8ba0('0x41')]){_0x16d71e['where']=_['merge'](_0x16d71e[_0x8ba0('0x42')],{'$or':_['map'](_0x16d71e['attributes'],function(_0x3b7f01){var _0x5e33ac={};_0x5e33ac[_0x3b7f01]={'$like':'%'+_0x10e853[_0x8ba0('0x37')]['filter']+'%'};return _0x5e33ac;})});}_0x16d71e=_[_0x8ba0('0x43')]({},_0x16d71e,_0x10e853['options']);return _0x4ede78['getAgents'](_0x16d71e);}})['then'](function(_0x3cfad0){if(_0x3cfad0){_0x24ffe6=_0x3cfad0[_0x8ba0('0x3d')];if(!_0x10e853[_0x8ba0('0x37')][_0x8ba0('0x3e')](_0x8ba0('0x5e'))){_0x16d71e[_0x8ba0('0x21')]=qs['limit'](_0x10e853[_0x8ba0('0x37')][_0x8ba0('0x21')]);_0x16d71e[_0x8ba0('0x1f')]=qs[_0x8ba0('0x1f')](_0x10e853[_0x8ba0('0x37')]['offset']);}return _0x4ede78[_0x8ba0('0xb8')](_0x16d71e);}})[_0x8ba0('0x12')](function(_0x166bda){if(_0x166bda){return _0x166bda?{'count':_0x24ffe6,'rows':_0x166bda}:null;}})['then'](respondWithResult(_0x282bbd,null))[_0x8ba0('0x1c')](handleError(_0x282bbd,null));}; \ No newline at end of file +var _0x04ef=['show','params','Pause','include','find','update','body','Smtp','describe','addDisposition','MailAccountId','Disposition','findOne','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findAll','removeAnswers','provider','custom','email','ListId','isNil','active','user','username','password','pass','modernAuthentication','CloudProviderId','service','host','port','authentication','create','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addImap','removeImap','setImap','getSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','CmContact','Contact','fullname','internal','Tag','Tags','color','tag','addApplications','transaction','sequelize','Transaction','MailApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','getMessages','$gte','YYYY-MM-DD\x20HH:mm:ss','MailMessage','inlineCss','Contacts','updatedAt','DESC','from','format','%s\x20<%s>','attachments','join','root','server/files/attachments','basename','auth','secure','SendMail','sendMail','List\x20not\x20found','List','messageId','subject','out','Interaction','Messages','verifySmtp','CloudProvider','OAuth2','data5','VerifySmtp','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','spread','emit','userMailAccount:save','isArray','userMailAccount:remove','getAgents','User','moment','bluebird','util','path','juice','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','info','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','status','end','json','offset','undefined','limit','count','set','Content-Range','destroy','then','get','MailAccounts','UserProfileResource','sendStatus','stack','name','send','index','MailServerIn','Imap','MailServerOut','mandatoryDispositionPause','MailAccount','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch'];(function(_0x340a37,_0x24ca59){var _0x57a1ae=function(_0x320885){while(--_0x320885){_0x340a37['push'](_0x340a37['shift']());}};_0x57a1ae(++_0x24ca59);}(_0x04ef,0x6b));var _0xf04e=function(_0x12267a,_0x3dc541){_0x12267a=_0x12267a-0x0;var _0x2f1892=_0x04ef[_0x12267a];return _0x2f1892;};'use strict';var moment=require(_0xf04e('0x0'));var BPromise=require(_0xf04e('0x1'));var util=require(_0xf04e('0x2'));var path=require(_0xf04e('0x3'));var _=require('lodash');var juice=require(_0xf04e('0x4'));var Redis=require(_0xf04e('0x5'));var qs=require(_0xf04e('0x6'));var logger=require(_0xf04e('0x7'))('api');var config=require(_0xf04e('0x8'));var db=require('../../mysqldb')['db'];config[_0xf04e('0x9')]=_[_0xf04e('0xa')](config[_0xf04e('0x9')],{'host':_0xf04e('0xb'),'port':0x18eb});var socket=require(_0xf04e('0xc'))(new Redis(config[_0xf04e('0x9')]));require(_0xf04e('0xd'))[_0xf04e('0xe')](socket);var jayson=require(_0xf04e('0xf'));var client=jayson[_0xf04e('0x10')]['http']({'port':0x232b});function respondWithRpcPromise(_0x538100,_0x454f75,_0x3a838c,_0x505450){return new BPromise(function(_0x2f4614,_0xd9f612){var _0x137d91=_0x505450||client;return _0x137d91['request'](_0x538100,_0x3a838c)['then'](function(_0x34e11d){logger[_0xf04e('0x11')](_0xf04e('0x12'),_0x454f75,'request\x20sent');logger[_0xf04e('0x13')](_0xf04e('0x14'),_0x454f75,_0xf04e('0x15'),JSON[_0xf04e('0x16')](_0x34e11d));if(_0x34e11d[_0xf04e('0x17')]){if(_0x34e11d[_0xf04e('0x17')][_0xf04e('0x18')]===0x1f4){logger[_0xf04e('0x17')]('MailAccount,\x20%s,\x20%s',_0x454f75,_0x34e11d[_0xf04e('0x17')]['message']);return _0xd9f612(_0x34e11d[_0xf04e('0x17')][_0xf04e('0x19')]);}logger['error'](_0xf04e('0x12'),_0x454f75,_0x34e11d[_0xf04e('0x17')][_0xf04e('0x19')]);return _0x2f4614(_0x34e11d[_0xf04e('0x17')][_0xf04e('0x19')]);}else{logger[_0xf04e('0x11')](_0xf04e('0x12'),_0x454f75,_0xf04e('0x15'));_0x2f4614(_0x34e11d[_0xf04e('0x1a')]['message']);}})['catch'](function(_0x24f64e){logger[_0xf04e('0x17')](_0xf04e('0x12'),_0x454f75,_0x24f64e);_0xd9f612(_0x24f64e);});});}function respondWithStatusCode(_0x20e56a,_0x201fc1){_0x201fc1=_0x201fc1||0xcc;return function(_0x124065){if(_0x124065){return _0x20e56a['sendStatus'](_0x201fc1);}return _0x20e56a[_0xf04e('0x1b')](_0x201fc1)[_0xf04e('0x1c')]();};}function respondWithResult(_0x1d448f,_0x20a3e3){_0x20a3e3=_0x20a3e3||0xc8;return function(_0x323054){if(_0x323054){return _0x1d448f[_0xf04e('0x1b')](_0x20a3e3)[_0xf04e('0x1d')](_0x323054);}};}function respondWithFilteredResult(_0x4959c5,_0x168f4c){return function(_0x2fb18c){if(_0x2fb18c){var _0x32b129=typeof _0x168f4c[_0xf04e('0x1e')]===_0xf04e('0x1f')&&typeof _0x168f4c[_0xf04e('0x20')]==='undefined';var _0xd97007=_0x2fb18c[_0xf04e('0x21')];var _0xfe2e16=_0x32b129?0x0:_0x168f4c[_0xf04e('0x1e')];var _0x6bb081=_0x32b129?_0x2fb18c[_0xf04e('0x21')]:_0x168f4c[_0xf04e('0x1e')]+_0x168f4c[_0xf04e('0x20')];var _0xec6e0;if(_0x6bb081>=_0xd97007){_0x6bb081=_0xd97007;_0xec6e0=0xc8;}else{_0xec6e0=0xce;}_0x4959c5[_0xf04e('0x1b')](_0xec6e0);return _0x4959c5[_0xf04e('0x22')](_0xf04e('0x23'),_0xfe2e16+'-'+_0x6bb081+'/'+_0xd97007)[_0xf04e('0x1d')](_0x2fb18c);}return null;};}function saveUpdates(_0xb20938){return function(_0x3e87f9){if(_0x3e87f9){return _0x3e87f9['update'](_0xb20938)['then'](function(_0x2f7e59){return _0x2f7e59;});}return null;};}function removeEntity(_0x14a262){return function(_0x210f94){if(_0x210f94){return _0x210f94[_0xf04e('0x24')]()[_0xf04e('0x25')](function(){var _0x1c1a83=_0x210f94[_0xf04e('0x26')]({'plain':!![]});var _0x3a78f5=_0xf04e('0x27');return db[_0xf04e('0x28')][_0xf04e('0x24')]({'where':{'type':_0x3a78f5,'resourceId':_0x1c1a83['id']}})[_0xf04e('0x25')](function(){return _0x210f94;});})[_0xf04e('0x25')](function(){_0x14a262[_0xf04e('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3fb8d1){return function(_0xdae37c){if(!_0xdae37c){_0x3fb8d1[_0xf04e('0x29')](0x194);}return _0xdae37c;};}function handleError(_0x1c6a53,_0x4ccc4c){_0x4ccc4c=_0x4ccc4c||0x1f4;return function(_0x5eccde){logger[_0xf04e('0x17')](_0x5eccde[_0xf04e('0x2a')]);if(_0x5eccde['name']){delete _0x5eccde[_0xf04e('0x2b')];}_0x1c6a53['status'](_0x4ccc4c)[_0xf04e('0x2c')](_0x5eccde);};}exports[_0xf04e('0x2d')]=function(_0x105641,_0x1f0bbb){var _0x4ab348={'include':[{'model':db[_0xf04e('0x2e')],'as':_0xf04e('0x2f')},{'model':db[_0xf04e('0x30')],'as':'Smtp'},{'model':db['Pause'],'as':_0xf04e('0x31')}]},_0x5e58c6={},_0x94ba49={'count':0x0,'rows':[]};var _0x49681c=_['map'](db[_0xf04e('0x32')][_0xf04e('0x33')],function(_0x134c3d){return{'name':_0x134c3d[_0xf04e('0x34')],'type':_0x134c3d[_0xf04e('0x35')][_0xf04e('0x36')]};});_0x5e58c6[_0xf04e('0x37')]=_[_0xf04e('0x38')](_0x49681c,_0xf04e('0x2b'));_0x5e58c6[_0xf04e('0x39')]=_[_0xf04e('0x3a')](_0x105641[_0xf04e('0x39')]);_0x5e58c6[_0xf04e('0x3b')]=_['intersection'](_0x5e58c6[_0xf04e('0x37')],_0x5e58c6[_0xf04e('0x39')]);_0x4ab348[_0xf04e('0x3c')]=_[_0xf04e('0x3d')](_0x5e58c6[_0xf04e('0x37')],qs[_0xf04e('0x3e')](_0x105641['query']['fields']));_0x4ab348[_0xf04e('0x3c')]=_0x4ab348['attributes'][_0xf04e('0x3f')]?_0x4ab348[_0xf04e('0x3c')]:_0x5e58c6[_0xf04e('0x37')];if(!_0x105641[_0xf04e('0x39')][_0xf04e('0x40')](_0xf04e('0x41'))){_0x4ab348[_0xf04e('0x20')]=qs[_0xf04e('0x20')](_0x105641[_0xf04e('0x39')][_0xf04e('0x20')]);_0x4ab348['offset']=qs[_0xf04e('0x1e')](_0x105641[_0xf04e('0x39')][_0xf04e('0x1e')]);}_0x4ab348[_0xf04e('0x42')]=qs[_0xf04e('0x43')](_0x105641['query'][_0xf04e('0x43')]);_0x4ab348[_0xf04e('0x44')]=qs[_0xf04e('0x3b')](_[_0xf04e('0x45')](_0x105641[_0xf04e('0x39')],_0x5e58c6[_0xf04e('0x3b')]),_0x49681c);if(_0x105641['query'][_0xf04e('0x46')]){_0x4ab348['where']=_[_0xf04e('0x47')](_0x4ab348[_0xf04e('0x44')],{'$or':_[_0xf04e('0x38')](_0x49681c,function(_0x4148e5){if(_0x4148e5[_0xf04e('0x35')]!==_0xf04e('0x48')){var _0x29e262={};_0x29e262[_0x4148e5[_0xf04e('0x2b')]]={'$like':'%'+_0x105641[_0xf04e('0x39')][_0xf04e('0x46')]+'%'};return _0x29e262;}})});}_0x4ab348=_[_0xf04e('0x47')]({},_0x4ab348,_0x105641[_0xf04e('0x49')]);var _0x2d1781={'where':_0x4ab348[_0xf04e('0x44')]};return db['MailAccount'][_0xf04e('0x21')](_0x2d1781)[_0xf04e('0x25')](function(_0x4c4e32){_0x94ba49['count']=_0x4c4e32;if(_0x105641[_0xf04e('0x39')][_0xf04e('0x4a')]){_0x4ab348['include']=[{'all':!![]}];}return db[_0xf04e('0x32')]['findAll'](_0x4ab348);})[_0xf04e('0x25')](function(_0x20a052){_0x94ba49[_0xf04e('0x4b')]=_0x20a052;return _0x94ba49;})[_0xf04e('0x25')](respondWithFilteredResult(_0x1f0bbb,_0x4ab348))[_0xf04e('0x4c')](handleError(_0x1f0bbb,null));};exports[_0xf04e('0x4d')]=function(_0xdaa940,_0x2b598c){var _0x30b3fb={'raw':![],'where':{'id':_0xdaa940[_0xf04e('0x4e')]['id']},'include':[{'model':db[_0xf04e('0x2e')],'as':_0xf04e('0x2f')},{'model':db[_0xf04e('0x30')],'as':'Smtp'},{'model':db[_0xf04e('0x4f')],'as':_0xf04e('0x31')}]},_0x143f9b={};_0x143f9b[_0xf04e('0x37')]=_[_0xf04e('0x3a')](db[_0xf04e('0x32')][_0xf04e('0x33')]);_0x143f9b['query']=_[_0xf04e('0x3a')](_0xdaa940[_0xf04e('0x39')]);_0x143f9b['filters']=_[_0xf04e('0x3d')](_0x143f9b[_0xf04e('0x37')],_0x143f9b[_0xf04e('0x39')]);_0x30b3fb[_0xf04e('0x3c')]=_[_0xf04e('0x3d')](_0x143f9b[_0xf04e('0x37')],qs['fields'](_0xdaa940[_0xf04e('0x39')][_0xf04e('0x3e')]));_0x30b3fb[_0xf04e('0x3c')]=_0x30b3fb[_0xf04e('0x3c')][_0xf04e('0x3f')]?_0x30b3fb['attributes']:_0x143f9b[_0xf04e('0x37')];if(_0xdaa940['query'][_0xf04e('0x4a')]){_0x30b3fb[_0xf04e('0x50')]=[{'all':!![]}];}_0x30b3fb=_[_0xf04e('0x47')]({},_0x30b3fb,_0xdaa940[_0xf04e('0x49')]);return db[_0xf04e('0x32')][_0xf04e('0x51')](_0x30b3fb)[_0xf04e('0x25')](handleEntityNotFound(_0x2b598c,null))['then'](respondWithResult(_0x2b598c,null))[_0xf04e('0x4c')](handleError(_0x2b598c,null));};exports[_0xf04e('0x52')]=function(_0x2ef1bf,_0x18b803){if(_0x2ef1bf[_0xf04e('0x53')]['id']){delete _0x2ef1bf[_0xf04e('0x53')]['id'];}return db[_0xf04e('0x32')][_0xf04e('0x51')]({'where':{'id':_0x2ef1bf[_0xf04e('0x4e')]['id']},'include':[{'model':db[_0xf04e('0x2e')],'as':_0xf04e('0x2f')},{'model':db[_0xf04e('0x30')],'as':_0xf04e('0x54')},{'model':db[_0xf04e('0x4f')],'as':_0xf04e('0x31')}]})[_0xf04e('0x25')](handleEntityNotFound(_0x18b803,null))[_0xf04e('0x25')](saveUpdates(_0x2ef1bf[_0xf04e('0x53')],null))['then'](function(_0x384419){if(_0x384419&&_0x2ef1bf[_0xf04e('0x53')][_0xf04e('0x2f')]){return db[_0xf04e('0x2e')][_0xf04e('0x52')](_0x2ef1bf[_0xf04e('0x53')]['Imap'],{'where':{'MailAccountId':_0x384419['id']}})[_0xf04e('0x25')](function(){return _0x384419;});}return _0x384419;})['then'](function(_0x4ca02a){if(_0x4ca02a&&_0x2ef1bf['body'][_0xf04e('0x54')]){return db[_0xf04e('0x30')][_0xf04e('0x52')](_0x2ef1bf[_0xf04e('0x53')]['Smtp'],{'where':{'MailAccountId':_0x4ca02a['id']}})['then'](function(){return _0x4ca02a;});}return _0x4ca02a;})[_0xf04e('0x25')](respondWithResult(_0x18b803,null))['catch'](handleError(_0x18b803,null));};exports[_0xf04e('0x55')]=function(_0x43753c,_0x295c75){return db[_0xf04e('0x32')][_0xf04e('0x55')]()[_0xf04e('0x25')](respondWithResult(_0x295c75,null))[_0xf04e('0x4c')](handleError(_0x295c75,null));};exports[_0xf04e('0x56')]=function(_0x1f0313,_0x341c19){if(_0x1f0313['body']['id']){delete _0x1f0313[_0xf04e('0x53')]['id'];}return db[_0xf04e('0x32')][_0xf04e('0x51')]({'where':{'id':_0x1f0313[_0xf04e('0x4e')]['id']}})[_0xf04e('0x25')](handleEntityNotFound(_0x341c19,null))[_0xf04e('0x25')](function(_0x1c4e71){if(_0x1c4e71){_0x1f0313[_0xf04e('0x53')][_0xf04e('0x57')]=_0x1c4e71['id'];return db[_0xf04e('0x58')]['create'](_0x1f0313[_0xf04e('0x53')]);}})[_0xf04e('0x25')](respondWithResult(_0x341c19,null))[_0xf04e('0x4c')](handleError(_0x341c19,null));};exports['getDispositions']=function(_0x24e288,_0x405ef3){var _0x4cece4={'raw':![],'where':{}};var _0x5de8e6={};var _0x5c6b26={'count':0x0,'rows':[]};return db['MailAccount'][_0xf04e('0x59')]({'where':{'id':_0x24e288['params']['id']}})['then'](handleEntityNotFound(_0x405ef3,null))[_0xf04e('0x25')](function(_0x474095){if(_0x474095){_0x5de8e6[_0xf04e('0x37')]=_[_0xf04e('0x3a')](db[_0xf04e('0x58')][_0xf04e('0x33')]);_0x5de8e6[_0xf04e('0x39')]=_[_0xf04e('0x3a')](_0x24e288[_0xf04e('0x39')]);_0x5de8e6[_0xf04e('0x3b')]=_[_0xf04e('0x3d')](_0x5de8e6[_0xf04e('0x37')],_0x5de8e6[_0xf04e('0x39')]);_0x4cece4[_0xf04e('0x3c')]=_[_0xf04e('0x3d')](_0x5de8e6[_0xf04e('0x37')],qs[_0xf04e('0x3e')](_0x24e288['query'][_0xf04e('0x3e')]));_0x4cece4[_0xf04e('0x3c')]=_0x4cece4[_0xf04e('0x3c')]['length']?_0x4cece4[_0xf04e('0x3c')]:_0x5de8e6['model'];if(!_0x24e288[_0xf04e('0x39')][_0xf04e('0x40')](_0xf04e('0x41'))){_0x4cece4[_0xf04e('0x20')]=qs[_0xf04e('0x20')](_0x24e288['query']['limit']);_0x4cece4[_0xf04e('0x1e')]=qs[_0xf04e('0x1e')](_0x24e288[_0xf04e('0x39')][_0xf04e('0x1e')]);}_0x4cece4[_0xf04e('0x42')]=qs[_0xf04e('0x43')](_0x24e288['query']['sort']);_0x4cece4[_0xf04e('0x44')]=qs['filters'](_[_0xf04e('0x45')](_0x24e288[_0xf04e('0x39')],_0x5de8e6[_0xf04e('0x3b')]));_0x4cece4[_0xf04e('0x44')][_0xf04e('0x57')]=_0x474095['id'];if(_0x24e288['query'][_0xf04e('0x46')]){_0x4cece4[_0xf04e('0x44')]=_[_0xf04e('0x47')](_0x4cece4[_0xf04e('0x44')],{'$or':_['map'](_0x4cece4[_0xf04e('0x3c')],function(_0x4c9529){var _0x218981={};_0x218981[_0x4c9529]={'$like':'%'+_0x24e288[_0xf04e('0x39')][_0xf04e('0x46')]+'%'};return _0x218981;})});}_0x4cece4=_[_0xf04e('0x47')]({},_0x4cece4,_0x24e288[_0xf04e('0x49')]);return db[_0xf04e('0x58')][_0xf04e('0x21')]({'where':_0x4cece4[_0xf04e('0x44')]})[_0xf04e('0x25')](function(_0xe6ef3d){_0x5c6b26[_0xf04e('0x21')]=_0xe6ef3d;if(_0x24e288[_0xf04e('0x39')][_0xf04e('0x4a')]){_0x4cece4['include']=[{'all':!![]}];}return db['Disposition']['findAll'](_0x4cece4);})['then'](function(_0x2cd469){_0x5c6b26[_0xf04e('0x4b')]=_0x2cd469;return _0x5c6b26;});}})[_0xf04e('0x25')](respondWithFilteredResult(_0x405ef3,_0x4cece4))[_0xf04e('0x4c')](handleError(_0x405ef3,null));};exports['removeDispositions']=function(_0x5f408f,_0x4a6048){return db[_0xf04e('0x32')]['find']({'where':{'id':_0x5f408f['params']['id']}})['then'](handleEntityNotFound(_0x4a6048,null))['then'](function(_0x5af76f){if(_0x5af76f){return _0x5af76f[_0xf04e('0x5a')](_0x5f408f['query'][_0xf04e('0x5b')]);}})[_0xf04e('0x25')](respondWithStatusCode(_0x4a6048,null))[_0xf04e('0x4c')](handleError(_0x4a6048,null));};exports[_0xf04e('0x5c')]=function(_0x4f9e39,_0x29d908){if(_0x4f9e39[_0xf04e('0x53')]['id']){delete _0x4f9e39[_0xf04e('0x53')]['id'];}return db[_0xf04e('0x32')][_0xf04e('0x51')]({'where':{'id':_0x4f9e39[_0xf04e('0x4e')]['id']}})[_0xf04e('0x25')](handleEntityNotFound(_0x29d908,null))[_0xf04e('0x25')](function(_0x29f182){if(_0x29f182){_0x4f9e39[_0xf04e('0x53')][_0xf04e('0x57')]=_0x29f182['id'];return db[_0xf04e('0x5d')]['create'](_0x4f9e39['body']);}})[_0xf04e('0x25')](respondWithResult(_0x29d908,null))[_0xf04e('0x4c')](handleError(_0x29d908,null));};exports[_0xf04e('0x5e')]=function(_0x2bf397,_0x5902fd){var _0x196b08={'raw':![],'where':{}};var _0x4d9779={};var _0x2f043f={'count':0x0,'rows':[]};return db[_0xf04e('0x32')][_0xf04e('0x59')]({'where':{'id':_0x2bf397[_0xf04e('0x4e')]['id']}})['then'](handleEntityNotFound(_0x5902fd,null))[_0xf04e('0x25')](function(_0x574c4a){if(_0x574c4a){_0x4d9779[_0xf04e('0x37')]=_[_0xf04e('0x3a')](db[_0xf04e('0x5d')][_0xf04e('0x33')]);_0x4d9779['query']=_['keys'](_0x2bf397[_0xf04e('0x39')]);_0x4d9779['filters']=_['intersection'](_0x4d9779[_0xf04e('0x37')],_0x4d9779[_0xf04e('0x39')]);_0x196b08['attributes']=_['intersection'](_0x4d9779[_0xf04e('0x37')],qs[_0xf04e('0x3e')](_0x2bf397[_0xf04e('0x39')][_0xf04e('0x3e')]));_0x196b08[_0xf04e('0x3c')]=_0x196b08[_0xf04e('0x3c')][_0xf04e('0x3f')]?_0x196b08[_0xf04e('0x3c')]:_0x4d9779[_0xf04e('0x37')];if(!_0x2bf397[_0xf04e('0x39')]['hasOwnProperty']('nolimit')){_0x196b08[_0xf04e('0x20')]=qs[_0xf04e('0x20')](_0x2bf397[_0xf04e('0x39')][_0xf04e('0x20')]);_0x196b08[_0xf04e('0x1e')]=qs[_0xf04e('0x1e')](_0x2bf397[_0xf04e('0x39')]['offset']);}_0x196b08[_0xf04e('0x42')]=qs['sort'](_0x2bf397[_0xf04e('0x39')][_0xf04e('0x43')]);_0x196b08[_0xf04e('0x44')]=qs[_0xf04e('0x3b')](_[_0xf04e('0x45')](_0x2bf397['query'],_0x4d9779[_0xf04e('0x3b')]));_0x196b08[_0xf04e('0x44')][_0xf04e('0x57')]=_0x574c4a['id'];if(_0x2bf397[_0xf04e('0x39')][_0xf04e('0x46')]){_0x196b08[_0xf04e('0x44')]=_[_0xf04e('0x47')](_0x196b08[_0xf04e('0x44')],{'$or':_[_0xf04e('0x38')](_0x196b08[_0xf04e('0x3c')],function(_0x167a9e){var _0x41ebaf={};_0x41ebaf[_0x167a9e]={'$like':'%'+_0x2bf397[_0xf04e('0x39')][_0xf04e('0x46')]+'%'};return _0x41ebaf;})});}_0x196b08=_['merge']({},_0x196b08,_0x2bf397['options']);return db['CannedAnswer'][_0xf04e('0x21')]({'where':_0x196b08['where']})['then'](function(_0x2cdf29){_0x2f043f[_0xf04e('0x21')]=_0x2cdf29;if(_0x2bf397[_0xf04e('0x39')][_0xf04e('0x4a')]){_0x196b08[_0xf04e('0x50')]=[{'all':!![]}];}return db[_0xf04e('0x5d')][_0xf04e('0x5f')](_0x196b08);})[_0xf04e('0x25')](function(_0x3db337){_0x2f043f[_0xf04e('0x4b')]=_0x3db337;return _0x2f043f;});}})[_0xf04e('0x25')](respondWithFilteredResult(_0x5902fd,_0x196b08))['catch'](handleError(_0x5902fd,null));};exports[_0xf04e('0x60')]=function(_0x12d922,_0x4d6a57){return db[_0xf04e('0x32')][_0xf04e('0x51')]({'where':{'id':_0x12d922[_0xf04e('0x4e')]['id']}})['then'](handleEntityNotFound(_0x4d6a57,null))[_0xf04e('0x25')](function(_0x3315c6){if(_0x3315c6){return _0x3315c6[_0xf04e('0x60')](_0x12d922['query'][_0xf04e('0x5b')]);}})[_0xf04e('0x25')](respondWithStatusCode(_0x4d6a57,null))[_0xf04e('0x4c')](handleError(_0x4d6a57,null));};exports['create']=function(_0x343451,_0x2b5e8d){var _0x72ccf={'name':_0x343451[_0xf04e('0x53')][_0xf04e('0x2b')],'key':_0x343451['body'][_0xf04e('0x36')],'provider':_0x343451['body'][_0xf04e('0x61')]===_0xf04e('0x62')?null:_0x343451[_0xf04e('0x53')][_0xf04e('0x61')],'email':_0x343451[_0xf04e('0x53')][_0xf04e('0x63')],'ListId':_0x343451[_0xf04e('0x53')][_0xf04e('0x64')],'active':!_[_0xf04e('0x65')](_0x343451['body'][_0xf04e('0x66')])?_0x343451[_0xf04e('0x53')]['active']:!![],'description':_0x343451['body']['description']||null,'Imap':{},'Smtp':{}};if(_0x72ccf[_0xf04e('0x61')]){_0x72ccf['Imap'][_0xf04e('0x67')]=_0x72ccf[_0xf04e('0x54')][_0xf04e('0x67')]=_0x343451[_0xf04e('0x53')][_0xf04e('0x68')];_0x72ccf[_0xf04e('0x2f')][_0xf04e('0x69')]=_0x72ccf[_0xf04e('0x54')][_0xf04e('0x6a')]=_0x343451[_0xf04e('0x53')][_0xf04e('0x69')];if(_0x343451['body'][_0xf04e('0x6b')]){_0x72ccf[_0xf04e('0x2f')][_0xf04e('0x6b')]=_0x72ccf[_0xf04e('0x54')]['modernAuthentication']=!![];_0x72ccf[_0xf04e('0x2f')]['CloudProviderId']=_0x72ccf[_0xf04e('0x54')][_0xf04e('0x6c')]=_0x343451['body'][_0xf04e('0x6c')];_0x72ccf[_0xf04e('0x2f')][_0xf04e('0x67')]=_0x72ccf[_0xf04e('0x54')][_0xf04e('0x67')]=_0x343451[_0xf04e('0x53')][_0xf04e('0x68')];}_0x72ccf[_0xf04e('0x2f')]['service']=_0x72ccf[_0xf04e('0x54')][_0xf04e('0x6d')]=null;_0x72ccf[_0xf04e('0x2f')]['host']=_0x72ccf[_0xf04e('0x54')][_0xf04e('0x6e')]=null;_0x72ccf[_0xf04e('0x2f')][_0xf04e('0x6f')]=_0x72ccf[_0xf04e('0x54')][_0xf04e('0x6f')]=null;}else{if(_0x343451[_0xf04e('0x53')][_0xf04e('0x70')]){_0x72ccf[_0xf04e('0x2f')][_0xf04e('0x67')]=_0x72ccf[_0xf04e('0x54')][_0xf04e('0x67')]=_0x343451['body'][_0xf04e('0x68')];_0x72ccf[_0xf04e('0x2f')]['password']=_0x72ccf[_0xf04e('0x54')]['pass']=_0x343451[_0xf04e('0x53')][_0xf04e('0x69')];}else{_0x72ccf[_0xf04e('0x2f')][_0xf04e('0x70')]=_0x72ccf[_0xf04e('0x54')][_0xf04e('0x70')]=![];}_0x72ccf[_0xf04e('0x2f')]['host']=_0x343451[_0xf04e('0x53')][_0xf04e('0x2f')][_0xf04e('0x6e')];_0x72ccf[_0xf04e('0x2f')][_0xf04e('0x6f')]=_0x343451['body']['Imap'][_0xf04e('0x6f')];_0x72ccf[_0xf04e('0x54')][_0xf04e('0x6e')]=_0x343451[_0xf04e('0x53')]['Smtp'][_0xf04e('0x6e')];_0x72ccf[_0xf04e('0x54')][_0xf04e('0x6f')]=_0x343451['body'][_0xf04e('0x54')][_0xf04e('0x6f')];}return db[_0xf04e('0x32')][_0xf04e('0x71')](_0x72ccf,{'include':[{'model':db['MailServerOut'],'as':_0xf04e('0x54')},{'model':db[_0xf04e('0x2e')],'as':_0xf04e('0x2f')}]})[_0xf04e('0x25')](function(_0x125238){var _0x266e08=_0x343451['user']['get']({'plain':!![]});if(!_0x266e08)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x266e08['role']===_0xf04e('0x67')){var _0x422959=_0x125238[_0xf04e('0x26')]({'plain':!![]});return db['UserProfileSection'][_0xf04e('0x51')]({'where':{'name':_0xf04e('0x27'),'userProfileId':_0x266e08[_0xf04e('0x72')]},'raw':!![]})[_0xf04e('0x25')](function(_0x42e878){if(_0x42e878&&_0x42e878['autoAssociation']===0x0){return db['UserProfileResource'][_0xf04e('0x71')]({'name':_0x422959['name'],'resourceId':_0x422959['id'],'type':_0x42e878[_0xf04e('0x2b')],'sectionId':_0x42e878['id']},{})[_0xf04e('0x25')](function(){return _0x125238;});}else{return _0x125238;}})[_0xf04e('0x4c')](function(_0x441643){logger['error'](_0xf04e('0x73'),_0x441643);throw _0x441643;});}return _0x125238;})['then'](respondWithResult(_0x2b5e8d,0xc9))[_0xf04e('0x4c')](handleError(_0x2b5e8d,null));};exports['getImap']=function(_0x41357b,_0x235e54){return db[_0xf04e('0x32')][_0xf04e('0x59')]({'where':{'id':_0x41357b['params']['id']}})[_0xf04e('0x25')](handleEntityNotFound(_0x235e54,null))['then'](function(_0xffbb18){if(_0xffbb18){return _0xffbb18['getImap']();}return null;})['then'](respondWithResult(_0x235e54,null))[_0xf04e('0x4c')](handleError(_0x235e54,null));};exports[_0xf04e('0x74')]=function(_0x4db6e3,_0x4fea7f){if(_0x4db6e3[_0xf04e('0x53')]['id']){delete _0x4db6e3['body']['id'];}return db[_0xf04e('0x32')][_0xf04e('0x51')]({'where':{'id':_0x4db6e3['params']['id']}})[_0xf04e('0x25')](handleEntityNotFound(_0x4fea7f,null))['then'](function(_0x2a448e){if(_0x2a448e){_0x4db6e3[_0xf04e('0x53')]['MailAccountId']=_0x2a448e['id'];return db[_0xf04e('0x2e')][_0xf04e('0x71')](_0x4db6e3[_0xf04e('0x53')]);}})[_0xf04e('0x25')](respondWithResult(_0x4fea7f,null))[_0xf04e('0x4c')](handleError(_0x4fea7f,null));};exports[_0xf04e('0x75')]=function(_0x51c756,_0x20e87e){return db[_0xf04e('0x32')][_0xf04e('0x59')]({'where':{'id':_0x51c756[_0xf04e('0x4e')]['id']}})[_0xf04e('0x25')](handleEntityNotFound(_0x20e87e,null))['then'](function(_0x3f6635){if(_0x3f6635){return _0x3f6635[_0xf04e('0x76')](null);}return null;})[_0xf04e('0x25')](respondWithStatusCode(_0x20e87e,null))['catch'](handleError(_0x20e87e,null));};exports[_0xf04e('0x77')]=function(_0x4814ea,_0x4499b0){return db[_0xf04e('0x32')]['findOne']({'where':{'id':_0x4814ea['params']['id']}})['then'](handleEntityNotFound(_0x4499b0,null))['then'](function(_0xcd7b36){if(_0xcd7b36){return _0xcd7b36[_0xf04e('0x77')]();}return null;})['then'](respondWithResult(_0x4499b0,null))[_0xf04e('0x4c')](handleError(_0x4499b0,null));};exports['addSmtp']=function(_0x2d0a6c,_0x14b440){if(_0x2d0a6c[_0xf04e('0x53')]['id']){delete _0x2d0a6c[_0xf04e('0x53')]['id'];}return db['MailAccount'][_0xf04e('0x51')]({'where':{'id':_0x2d0a6c[_0xf04e('0x4e')]['id']}})[_0xf04e('0x25')](handleEntityNotFound(_0x14b440,null))[_0xf04e('0x25')](function(_0xede841){if(_0xede841){_0x2d0a6c[_0xf04e('0x53')][_0xf04e('0x57')]=_0xede841['id'];return db[_0xf04e('0x30')][_0xf04e('0x71')](_0x2d0a6c[_0xf04e('0x53')]);}})[_0xf04e('0x25')](respondWithResult(_0x14b440,null))[_0xf04e('0x4c')](handleError(_0x14b440,null));};exports[_0xf04e('0x78')]=function(_0x5744d4,_0x59c3bb){return db[_0xf04e('0x32')][_0xf04e('0x59')]({'where':{'id':_0x5744d4[_0xf04e('0x4e')]['id']}})[_0xf04e('0x25')](handleEntityNotFound(_0x59c3bb,null))['then'](function(_0x729a15){if(_0x729a15){return _0x729a15[_0xf04e('0x79')](null);}return null;})['then'](respondWithStatusCode(_0x59c3bb,null))[_0xf04e('0x4c')](handleError(_0x59c3bb,null));};exports[_0xf04e('0x7a')]=function(_0x4a6b78,_0x1da34d){return db[_0xf04e('0x7b')]['find']({'where':{'id':_0x4a6b78[_0xf04e('0x4e')]['id']}})[_0xf04e('0x25')](handleEntityNotFound(_0x1da34d,null))[_0xf04e('0x25')](function(_0x1bc104){if(_0x1bc104){return _0x1bc104[_0xf04e('0x7a')](_0x4a6b78[_0xf04e('0x53')]['ids'],_[_0xf04e('0x7c')](_0x4a6b78[_0xf04e('0x53')],[_0xf04e('0x5b'),'id'])||{});}})[_0xf04e('0x25')](respondWithResult(_0x1da34d,null))[_0xf04e('0x4c')](handleError(_0x1da34d,null));};exports[_0xf04e('0x7d')]=function(_0x1b950a,_0x401036){var _0x342bd0={'raw':![],'where':{}};var _0x3d16c5={};var _0x22feda={'count':0x0,'rows':[]};return db[_0xf04e('0x32')]['findOne']({'where':{'id':_0x1b950a[_0xf04e('0x4e')]['id']}})['then'](handleEntityNotFound(_0x401036,null))[_0xf04e('0x25')](function(_0x3f162f){if(_0x3f162f){_0x3d16c5[_0xf04e('0x37')]=_[_0xf04e('0x3a')](db[_0xf04e('0x7b')]['rawAttributes']);_0x3d16c5[_0xf04e('0x39')]=_[_0xf04e('0x3a')](_0x1b950a[_0xf04e('0x39')]);_0x3d16c5[_0xf04e('0x3b')]=_[_0xf04e('0x3d')](_0x3d16c5[_0xf04e('0x37')],_0x3d16c5[_0xf04e('0x39')]);_0x342bd0['attributes']=_[_0xf04e('0x3d')](_0x3d16c5[_0xf04e('0x37')],qs[_0xf04e('0x3e')](_0x1b950a['query'][_0xf04e('0x3e')]));_0x342bd0[_0xf04e('0x3c')]=_0x342bd0['attributes'][_0xf04e('0x3f')]?_0x342bd0[_0xf04e('0x3c')]:_0x3d16c5[_0xf04e('0x37')];if(!_0x1b950a['query'][_0xf04e('0x40')]('nolimit')){_0x342bd0[_0xf04e('0x20')]=qs[_0xf04e('0x20')](_0x1b950a[_0xf04e('0x39')][_0xf04e('0x20')]);_0x342bd0['offset']=qs[_0xf04e('0x1e')](_0x1b950a[_0xf04e('0x39')][_0xf04e('0x1e')]);}_0x342bd0[_0xf04e('0x42')]=qs[_0xf04e('0x43')](_0x1b950a['query']['sort']);_0x342bd0[_0xf04e('0x44')]=qs[_0xf04e('0x3b')](_['pick'](_0x1b950a['query'],_0x3d16c5[_0xf04e('0x3b')]));_0x342bd0[_0xf04e('0x44')][_0xf04e('0x57')]=_0x3f162f['id'];if(_0x1b950a['query']['filter']){_0x342bd0['where']=_['merge'](_0x342bd0[_0xf04e('0x44')],{'$or':_['map'](_0x342bd0[_0xf04e('0x3c')],function(_0x3a69ff){var _0x25e59e={};_0x25e59e[_0x3a69ff]={'$like':'%'+_0x1b950a[_0xf04e('0x39')]['filter']+'%'};return _0x25e59e;})});}_0x342bd0=_[_0xf04e('0x47')]({},_0x342bd0,_0x1b950a[_0xf04e('0x49')]);return db['MailInteraction'][_0xf04e('0x21')]({'where':_0x342bd0[_0xf04e('0x44')]})[_0xf04e('0x25')](function(_0xc7f8bf){_0x22feda[_0xf04e('0x21')]=_0xc7f8bf;if(_0x1b950a['query'][_0xf04e('0x4a')]){_0x342bd0[_0xf04e('0x50')]=[{'model':db[_0xf04e('0x7e')],'as':_0xf04e('0x7f'),'required':![]},{'model':db['User'],'as':'Owner','attributes':['name',_0xf04e('0x80'),_0xf04e('0x81')],'required':![]},{'model':db[_0xf04e('0x82')],'as':_0xf04e('0x83'),'attributes':['id','name',_0xf04e('0x84')],'where':_0x1b950a[_0xf04e('0x39')][_0xf04e('0x85')]?{'id':_0x1b950a['query'][_0xf04e('0x85')]}:undefined,'required':_0x1b950a[_0xf04e('0x39')]['tag']?!![]:![]}];}return db['MailInteraction'][_0xf04e('0x5f')](_0x342bd0);})['then'](function(_0x49edfe){_0x22feda[_0xf04e('0x4b')]=_0x49edfe;return _0x22feda;});}})[_0xf04e('0x25')](respondWithFilteredResult(_0x401036,_0x342bd0))['catch'](handleError(_0x401036,null));};exports[_0xf04e('0x86')]=function addApplications(_0x6d3ca8,_0x2d48fa){var _0xb4fd84=_0x6d3ca8[_0xf04e('0x4e')]['id'];var _0x3b011a=_0x6d3ca8[_0xf04e('0x53')];var _0x5a13dd=0xc8;var _0x4d1702=null;return db['sequelize'][_0xf04e('0x87')]({'isolationLevel':db[_0xf04e('0x88')][_0xf04e('0x89')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x1d48f0){return db[_0xf04e('0x32')]['findOne']({'where':{'id':_0xb4fd84},'transaction':_0x1d48f0})[_0xf04e('0x25')](function(_0x3ba2cd){if(_0x3ba2cd){return db[_0xf04e('0x8a')][_0xf04e('0x24')]({'where':{'MailAccountId':_0xb4fd84},'transaction':_0x1d48f0})[_0xf04e('0x25')](function(){var _0xd0b0d0=_[_0xf04e('0x38')](_0x3b011a,function(_0x23a061){_0x23a061[_0xf04e('0x57')]=_0xb4fd84;return _0x23a061;});return db[_0xf04e('0x8a')][_0xf04e('0x8b')](_0xd0b0d0,{'transaction':_0x1d48f0});});}else{_0x5a13dd=0x194;_0x4d1702=[];}});})[_0xf04e('0x25')](function(){if(_0x5a13dd!==0x194){return db[_0xf04e('0x8a')][_0xf04e('0x8c')]({'where':{'MailAccountId':_0xb4fd84},'order':_0xf04e('0x8d')})[_0xf04e('0x25')](function(_0x1bead8){_0x4d1702=_0x1bead8;});}})[_0xf04e('0x4c')](function(_0x1d8f51){_0x5a13dd=0x1f4;logger[_0xf04e('0x17')](_0x1d8f51['stack']);if(_0x1d8f51['name']){delete _0x1d8f51[_0xf04e('0x2b')];}_0x4d1702=_0x1d8f51;})[_0xf04e('0x8e')](function(){if(_0x4d1702===null){_0x2d48fa[_0xf04e('0x29')](_0x5a13dd);}else{if(_0x5a13dd===0x1f4){_0x2d48fa[_0xf04e('0x1b')](_0x5a13dd)[_0xf04e('0x2c')](_0x4d1702);}else{_0x2d48fa[_0xf04e('0x1b')](_0x5a13dd)[_0xf04e('0x1d')](_0x4d1702);}}});};exports['getApplications']=function(_0x2496c9,_0x5a6bd7){var _0x2a4b69={};var _0x61f851={};var _0x3a6242;var _0x157694;return db['MailAccount'][_0xf04e('0x59')]({'where':{'id':_0x2496c9[_0xf04e('0x4e')]['id']}})[_0xf04e('0x25')](handleEntityNotFound(_0x5a6bd7,null))[_0xf04e('0x25')](function(_0x53c79b){if(_0x53c79b){_0x3a6242=_0x53c79b;_0x61f851[_0xf04e('0x37')]=_[_0xf04e('0x3a')](db[_0xf04e('0x8a')][_0xf04e('0x33')]);_0x61f851[_0xf04e('0x39')]=_[_0xf04e('0x3a')](_0x2496c9[_0xf04e('0x39')]);_0x61f851[_0xf04e('0x3b')]=_[_0xf04e('0x3d')](_0x61f851[_0xf04e('0x37')],_0x61f851[_0xf04e('0x39')]);_0x2a4b69['attributes']=_[_0xf04e('0x3d')](_0x61f851['model'],qs[_0xf04e('0x3e')](_0x2496c9[_0xf04e('0x39')][_0xf04e('0x3e')]));_0x2a4b69[_0xf04e('0x3c')]=_0x2a4b69[_0xf04e('0x3c')][_0xf04e('0x3f')]?_0x2a4b69[_0xf04e('0x3c')]:_0x61f851[_0xf04e('0x37')];_0x2a4b69['order']=qs[_0xf04e('0x43')](_0x2496c9['query']['sort']);_0x2a4b69['where']=qs[_0xf04e('0x3b')](_[_0xf04e('0x45')](_0x2496c9['query'],_0x61f851['filters']));if(_0x2496c9[_0xf04e('0x39')]['filter']){_0x2a4b69[_0xf04e('0x44')]=_[_0xf04e('0x47')](_0x2a4b69[_0xf04e('0x44')],{'$or':_['map'](_0x2a4b69[_0xf04e('0x3c')],function(_0x1c9922){var _0x55c4e3={};_0x55c4e3[_0x1c9922]={'$like':'%'+_0x2496c9['query'][_0xf04e('0x46')]+'%'};return _0x55c4e3;})});}_0x2a4b69=_[_0xf04e('0x47')]({},_0x2a4b69,_0x2496c9[_0xf04e('0x49')]);return _0x3a6242[_0xf04e('0x8f')](_0x2a4b69);}})[_0xf04e('0x25')](function(_0x3e0a35){if(_0x3e0a35){_0x157694=_0x3e0a35[_0xf04e('0x3f')];if(!_0x2496c9[_0xf04e('0x39')][_0xf04e('0x40')]('nolimit')){_0x2a4b69[_0xf04e('0x20')]=qs[_0xf04e('0x20')](_0x2496c9[_0xf04e('0x39')][_0xf04e('0x20')]);_0x2a4b69[_0xf04e('0x1e')]=qs[_0xf04e('0x1e')](_0x2496c9[_0xf04e('0x39')][_0xf04e('0x1e')]);}return _0x3a6242[_0xf04e('0x8f')](_0x2a4b69);}})[_0xf04e('0x25')](function(_0x565153){if(_0x565153){return _0x565153?{'count':_0x157694,'rows':_0x565153}:null;}})[_0xf04e('0x25')](respondWithResult(_0x5a6bd7,null))['catch'](handleError(_0x5a6bd7,null));};exports[_0xf04e('0x90')]=function(_0x314edf,_0x4ce085){var _0x2ba80e={'raw':!![],'where':{}};var _0x2d0a05={};var _0x49afa7={'count':0x0,'rows':[]};return db[_0xf04e('0x32')]['findOne']({'where':{'id':_0x314edf[_0xf04e('0x4e')]['id']}})[_0xf04e('0x25')](handleEntityNotFound(_0x4ce085,null))[_0xf04e('0x25')](function(_0x48bd79){if(_0x48bd79){_0x2d0a05[_0xf04e('0x37')]=_[_0xf04e('0x3a')](db['MailMessage']['rawAttributes']);_0x2d0a05['query']=_[_0xf04e('0x3a')](_0x314edf[_0xf04e('0x39')]);_0x2d0a05['filters']=_['intersection'](_0x2d0a05['model'],_0x2d0a05[_0xf04e('0x39')]);_0x2ba80e[_0xf04e('0x3c')]=_[_0xf04e('0x3d')](_0x2d0a05['model'],qs['fields'](_0x314edf[_0xf04e('0x39')]['fields']));_0x2ba80e['attributes']=_0x2ba80e[_0xf04e('0x3c')][_0xf04e('0x3f')]?_0x2ba80e[_0xf04e('0x3c')]:_0x2d0a05[_0xf04e('0x37')];if(!_0x314edf['query']['hasOwnProperty'](_0xf04e('0x41'))){_0x2ba80e[_0xf04e('0x20')]=qs['limit'](_0x314edf[_0xf04e('0x39')][_0xf04e('0x20')]);_0x2ba80e['offset']=qs[_0xf04e('0x1e')](_0x314edf[_0xf04e('0x39')][_0xf04e('0x1e')]);}_0x2ba80e[_0xf04e('0x42')]=qs[_0xf04e('0x43')](_0x314edf[_0xf04e('0x39')][_0xf04e('0x43')]);_0x2ba80e[_0xf04e('0x44')]=qs[_0xf04e('0x3b')](_['pick'](_0x314edf[_0xf04e('0x39')],_0x2d0a05[_0xf04e('0x3b')]));_0x2ba80e[_0xf04e('0x44')][_0xf04e('0x57')]=_0x48bd79['id'];if(_0x314edf[_0xf04e('0x39')][_0xf04e('0x46')]){_0x2ba80e['where']=_[_0xf04e('0x47')](_0x2ba80e[_0xf04e('0x44')],{'$or':_['map'](_0x2ba80e[_0xf04e('0x3c')],function(_0x1d0873){var _0x5f2b53={};_0x5f2b53[_0x1d0873]={'$like':'%'+_0x314edf[_0xf04e('0x39')][_0xf04e('0x46')]+'%'};return _0x5f2b53;})});}if(_0x314edf['query'][_0xf04e('0x91')]){var _0x18d152=_0x314edf[_0xf04e('0x39')][_0xf04e('0x91')]['split'](',');var _0x5e96b1={};_0x5e96b1[_0x18d152[0x0]]={'$gte':moment(_0x18d152[0x1])['format'](_0xf04e('0x92'))};_0x2ba80e[_0xf04e('0x44')]=_[_0xf04e('0x47')](_0x2ba80e['where'],_0x5e96b1);}_0x2ba80e=_[_0xf04e('0x47')]({},_0x2ba80e,_0x314edf[_0xf04e('0x49')]);return db[_0xf04e('0x93')][_0xf04e('0x21')]({'where':_0x2ba80e['where']})[_0xf04e('0x25')](function(_0x43afe7){_0x49afa7['count']=_0x43afe7;if(_0x314edf[_0xf04e('0x39')]['includeAll']){_0x2ba80e['include']=[{'all':!![]}];}return db[_0xf04e('0x93')][_0xf04e('0x5f')](_0x2ba80e);})[_0xf04e('0x25')](function(_0x34c99c){if(_0x314edf[_0xf04e('0x39')][_0xf04e('0x94')]==='true'){for(var _0xaf9699=0x0;_0xaf9699<_0x34c99c['length'];_0xaf9699++){_0x34c99c[_0xaf9699][_0xf04e('0x53')]=juice(_0x34c99c[_0xaf9699][_0xf04e('0x53')]);}}_0x49afa7[_0xf04e('0x4b')]=_0x34c99c;return _0x49afa7;});}})[_0xf04e('0x25')](respondWithFilteredResult(_0x4ce085,_0x2ba80e))[_0xf04e('0x4c')](handleError(_0x4ce085,null));};exports[_0xf04e('0x2c')]=function(_0x21504c,_0x31d4b9){var _0x256ac4,_0x499f23={},_0xafbfd7;if(_0x21504c[_0xf04e('0x53')]['to']){_0xafbfd7=_0x21504c[_0xf04e('0x53')]['to']['split'](',')[0x0];}return db[_0xf04e('0x32')][_0xf04e('0x51')]({'where':{'id':_0x21504c[_0xf04e('0x4e')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0xf04e('0x7e')],'as':_0xf04e('0x95'),'where':{'email':_0xafbfd7},'limit':0x1,'order':[[_0xf04e('0x96'),_0xf04e('0x97')]]}]},{'model':db[_0xf04e('0x30')],'as':_0xf04e('0x54'),'raw':!![]}]})[_0xf04e('0x25')](handleEntityNotFound(_0x31d4b9,null))[_0xf04e('0x25')](function(_0x5dd232){if(_0x5dd232){_0x256ac4=_0x5dd232;if(_0x5dd232[_0xf04e('0x54')]){if(_[_0xf04e('0x65')](_0x21504c[_0xf04e('0x53')][_0xf04e('0x98')])){_0x21504c[_0xf04e('0x53')]['from']=util[_0xf04e('0x99')](_0xf04e('0x9a'),_0x5dd232[_0xf04e('0x2b')],_0x5dd232[_0xf04e('0x63')]||_0x5dd232[_0xf04e('0x54')][_0xf04e('0x67')]);}if(_0x21504c[_0xf04e('0x53')][_0xf04e('0x9b')]&&_0x21504c['body'][_0xf04e('0x9b')][_0xf04e('0x3f')]){for(var _0x5e42fe=0x0;_0x5e42fe<_0x21504c['body'][_0xf04e('0x9b')][_0xf04e('0x3f')];_0x5e42fe+=0x1){_0x21504c[_0xf04e('0x53')]['attachments'][_0x5e42fe]={'filename':_0x21504c[_0xf04e('0x53')][_0xf04e('0x9b')][_0x5e42fe][_0xf04e('0x2b')],'path':path[_0xf04e('0x9c')](config[_0xf04e('0x9d')],_0xf04e('0x9e'),_0x21504c[_0xf04e('0x53')][_0xf04e('0x9b')][_0x5e42fe][_0xf04e('0x9f')])};}}var _0x5d513b={'tls':{'rejectUnauthorized':![]}};if(_[_0xf04e('0x65')](_0x5dd232[_0xf04e('0x54')]['service'])){if(_0x5dd232[_0xf04e('0x54')][_0xf04e('0x70')]){_0x5d513b[_0xf04e('0xa0')]={'user':_0x5dd232[_0xf04e('0x54')][_0xf04e('0x67')],'pass':_0x5dd232['Smtp'][_0xf04e('0x6a')]};}_0x5d513b[_0xf04e('0x6e')]=_0x5dd232['Smtp'][_0xf04e('0x6e')];_0x5d513b[_0xf04e('0x6f')]=_0x5dd232[_0xf04e('0x54')][_0xf04e('0x6f')];_0x5d513b[_0xf04e('0xa1')]=_0x5dd232['Smtp'][_0xf04e('0xa1')];}else{_0x5d513b['service']=_0x5dd232[_0xf04e('0x54')][_0xf04e('0x6d')];_0x5d513b[_0xf04e('0xa0')]={'user':_0x5dd232[_0xf04e('0x54')][_0xf04e('0x67')],'pass':_0x5dd232[_0xf04e('0x54')]['pass']};}return respondWithRpcPromise(_0xf04e('0xa2'),_0xf04e('0xa3'),{'account':_0x5d513b,'message':_0x21504c[_0xf04e('0x53')]});}else{throw new Error(_0xf04e('0xa4'));}}})[_0xf04e('0x25')](function(_0x5d4840){if(_0x5d4840){_0x499f23=_0x5d4840;if(_0x256ac4[_0xf04e('0xa5')]){if(_0x256ac4[_0xf04e('0xa5')]['Contacts'][_0xf04e('0x3f')]){return _0x256ac4[_0xf04e('0xa5')][_0xf04e('0x95')][0x0];}else{return db['CmContact'][_0xf04e('0x71')](_['defaults'](_0x21504c[_0xf04e('0x53')],{'firstName':_0x21504c['body']['to'],'email':_0x21504c['body']['to'],'phone':_0x21504c[_0xf04e('0x53')]['to'],'ListId':_0x256ac4[_0xf04e('0x64')]}));}}else{throw new Error('List\x20not\x20found');}}})[_0xf04e('0x25')](function(_0x38c8eb){if(_0x38c8eb){var _0x35cbc5={'UserId':_0x21504c[_0xf04e('0x67')]['id'],'ContactId':_0x38c8eb['id'],'MailAccountId':_0x256ac4['id'],'inReplyTo':_0x499f23[_0xf04e('0xa6')],'to':_0x21504c[_0xf04e('0x53')][_0xf04e('0x98')],'cc':_0x21504c[_0xf04e('0x53')]['cc'],'subject':_0x21504c['body'][_0xf04e('0xa7')],'attach':_0x21504c[_0xf04e('0x53')]['attach'],'firstMsgDirection':_0xf04e('0xa8'),'lastMsgAt':moment()['format'](_0xf04e('0x92')),'lastMsgDirection':_0xf04e('0xa8'),'Messages':[_[_0xf04e('0x47')](_0x21504c[_0xf04e('0x53')],{'messageId':_0x499f23['messageId'],'sentAt':moment()[_0xf04e('0x99')](_0xf04e('0x92')),'read':!![],'MailAccountId':_0x256ac4['id'],'UserId':_0x21504c[_0xf04e('0x67')]['id'],'ContactId':_0x38c8eb['id']})]};if(_0x21504c[_0xf04e('0x53')][_0xf04e('0xa9')]){_0x35cbc5=_[_0xf04e('0x47')](_0x35cbc5,_0x21504c['body'][_0xf04e('0xa9')]);}return db['MailInteraction']['create'](_0x35cbc5,{'include':[{'model':db[_0xf04e('0x93')],'as':_0xf04e('0xaa')}]});}})[_0xf04e('0x25')](respondWithResult(_0x31d4b9,null))['catch'](handleError(_0x31d4b9,null));};exports[_0xf04e('0xab')]=function(_0x5c3724,_0x776dc){return db['MailAccount'][_0xf04e('0x51')]({'where':{'id':_0x5c3724[_0xf04e('0x4e')]['id']},'include':[{'model':db[_0xf04e('0x30')],'as':'Smtp','raw':!![],'include':[{'model':db[_0xf04e('0xac')],'as':_0xf04e('0xac'),'raw':!![]}]}]})[_0xf04e('0x25')](handleEntityNotFound(_0x776dc,null))[_0xf04e('0x25')](function(_0x38c39a){if(_0x38c39a&&_0x38c39a[_0xf04e('0x54')]){var _0x3aa9d6={'id':_0x38c39a['id'],'tls':{'rejectUnauthorized':![]}};if(_0x38c39a[_0xf04e('0x54')]['service']){_0x3aa9d6[_0xf04e('0x6d')]=_0x38c39a['Smtp'][_0xf04e('0x6d')];}else{_0x3aa9d6[_0xf04e('0x6e')]=_0x38c39a[_0xf04e('0x54')][_0xf04e('0x6e')];_0x3aa9d6[_0xf04e('0x6f')]=_0x38c39a[_0xf04e('0x54')]['port'];_0x3aa9d6[_0xf04e('0xa1')]=_0x38c39a['Smtp'][_0xf04e('0xa1')];}if(_0x38c39a[_0xf04e('0x54')]['authentication']){if(_0x38c39a[_0xf04e('0x54')][_0xf04e('0x6b')]){_0x3aa9d6['auth']={'type':_0xf04e('0xad'),'user':_0x38c39a[_0xf04e('0x54')][_0xf04e('0x67')],'accessToken':_0x38c39a[_0xf04e('0x54')][_0xf04e('0xac')][_0xf04e('0xae')]};}else{_0x3aa9d6[_0xf04e('0xa0')]={'user':_0x38c39a[_0xf04e('0x54')][_0xf04e('0x67')],'pass':_0x38c39a['Smtp'][_0xf04e('0x6a')]};}}return respondWithRpcPromise(_0xf04e('0xaf'),_0xf04e('0xab'),{'account':_0x3aa9d6});}})[_0xf04e('0x25')](respondWithResult(_0x776dc,null))[_0xf04e('0x4c')](handleError(_0x776dc,null));};exports[_0xf04e('0x24')]=function(_0x12576a,_0x198912){return db['MailAccount'][_0xf04e('0x51')]({'where':{'id':_0x12576a[_0xf04e('0x4e')]['id']}})[_0xf04e('0x25')](handleEntityNotFound(_0x198912,null))[_0xf04e('0x25')](function(_0xe37422){if(_0xe37422&&_0xe37422[_0xf04e('0x6d')]){throw new db['Sequelize']['ValidationError'](_0xf04e('0xb0'));}return _0xe37422;})[_0xf04e('0x25')](removeEntity(_0x198912,null))['catch'](handleError(_0x198912,null));};exports['addAgents']=function(_0x21870d,_0x469bed){return db[_0xf04e('0x32')][_0xf04e('0x51')]({'where':{'id':_0x21870d[_0xf04e('0x4e')]['id']}})['then'](handleEntityNotFound(_0x469bed,null))[_0xf04e('0x25')](function(_0xc6e3ef){if(_0xc6e3ef){return _0xc6e3ef['addAgents'](_0x21870d[_0xf04e('0x53')][_0xf04e('0x5b')],_[_0xf04e('0x7c')](_0x21870d[_0xf04e('0x53')],[_0xf04e('0x5b'),'id'])||{})[_0xf04e('0xb1')](function(_0x21d7ca){for(var _0x57dfe4=0x0;_0x57dfe4<_0x21870d['body'][_0xf04e('0x5b')][_0xf04e('0x3f')];_0x57dfe4+=0x1){socket[_0xf04e('0xb2')](_0xf04e('0xb3'),{'UserId':Number(_0x21870d[_0xf04e('0x53')][_0xf04e('0x5b')][_0x57dfe4]),'MailAccountId':Number(_0x21870d['params']['id'])});}return _0x21d7ca;});}})[_0xf04e('0x25')](respondWithResult(_0x469bed,null))[_0xf04e('0x4c')](handleError(_0x469bed,null));};exports['removeAgents']=function(_0x58f4d2,_0x15a6f2){return db[_0xf04e('0x32')][_0xf04e('0x51')]({'where':{'id':_0x58f4d2[_0xf04e('0x4e')]['id']}})['then'](handleEntityNotFound(_0x15a6f2,null))['then'](function(_0x15d2a3){if(_0x15d2a3){return _0x15d2a3['removeAgents'](_0x58f4d2[_0xf04e('0x39')][_0xf04e('0x5b')])[_0xf04e('0x25')](function(){if(_[_0xf04e('0xb4')](_0x58f4d2['query'][_0xf04e('0x5b')])){for(var _0x40baca=0x0;_0x40baca<_0x58f4d2[_0xf04e('0x39')][_0xf04e('0x5b')][_0xf04e('0x3f')];_0x40baca+=0x1){socket[_0xf04e('0xb2')](_0xf04e('0xb5'),{'UserId':Number(_0x58f4d2['query'][_0xf04e('0x5b')][_0x40baca]),'MailAccountId':Number(_0x58f4d2[_0xf04e('0x4e')]['id'])});}}else{socket[_0xf04e('0xb2')]('userMailAccount:remove',{'UserId':Number(_0x58f4d2[_0xf04e('0x39')][_0xf04e('0x5b')]),'MailAccountId':Number(_0x58f4d2['params']['id'])});}});}})[_0xf04e('0x25')](respondWithStatusCode(_0x15a6f2,null))['catch'](handleError(_0x15a6f2,null));};exports[_0xf04e('0xb6')]=function(_0x453784,_0xbed631){var _0xf03781={};var _0x5e8f34={};var _0x4f7e52;var _0x4844da;return db[_0xf04e('0x32')][_0xf04e('0x59')]({'where':{'id':_0x453784['params']['id']}})[_0xf04e('0x25')](handleEntityNotFound(_0xbed631,null))[_0xf04e('0x25')](function(_0x11209b){if(_0x11209b){_0x4f7e52=_0x11209b;_0x5e8f34['model']=_[_0xf04e('0x3a')](db[_0xf04e('0xb7')][_0xf04e('0x33')]);_0x5e8f34['query']=_['keys'](_0x453784['query']);_0x5e8f34[_0xf04e('0x3b')]=_[_0xf04e('0x3d')](_0x5e8f34[_0xf04e('0x37')],_0x5e8f34[_0xf04e('0x39')]);_0xf03781[_0xf04e('0x3c')]=_[_0xf04e('0x3d')](_0x5e8f34[_0xf04e('0x37')],qs[_0xf04e('0x3e')](_0x453784[_0xf04e('0x39')][_0xf04e('0x3e')]));_0xf03781[_0xf04e('0x3c')]=_0xf03781['attributes'][_0xf04e('0x3f')]?_0xf03781['attributes']:_0x5e8f34[_0xf04e('0x37')];_0xf03781[_0xf04e('0x42')]=qs[_0xf04e('0x43')](_0x453784[_0xf04e('0x39')]['sort']);_0xf03781['where']=qs[_0xf04e('0x3b')](_[_0xf04e('0x45')](_0x453784[_0xf04e('0x39')],_0x5e8f34['filters']));if(_0x453784[_0xf04e('0x39')][_0xf04e('0x46')]){_0xf03781['where']=_[_0xf04e('0x47')](_0xf03781[_0xf04e('0x44')],{'$or':_[_0xf04e('0x38')](_0xf03781[_0xf04e('0x3c')],function(_0x45306d){var _0x5cb8a1={};_0x5cb8a1[_0x45306d]={'$like':'%'+_0x453784[_0xf04e('0x39')]['filter']+'%'};return _0x5cb8a1;})});}_0xf03781=_['merge']({},_0xf03781,_0x453784['options']);return _0x4f7e52[_0xf04e('0xb6')](_0xf03781);}})[_0xf04e('0x25')](function(_0x14eeb5){if(_0x14eeb5){_0x4844da=_0x14eeb5[_0xf04e('0x3f')];if(!_0x453784['query']['hasOwnProperty'](_0xf04e('0x41'))){_0xf03781['limit']=qs['limit'](_0x453784['query']['limit']);_0xf03781[_0xf04e('0x1e')]=qs[_0xf04e('0x1e')](_0x453784[_0xf04e('0x39')]['offset']);}return _0x4f7e52['getAgents'](_0xf03781);}})[_0xf04e('0x25')](function(_0x46506b){if(_0x46506b){return _0x46506b?{'count':_0x4844da,'rows':_0x46506b}:null;}})[_0xf04e('0x25')](respondWithResult(_0xbed631,null))[_0xf04e('0x4c')](handleError(_0xbed631,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index af02295..a6281fa 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 _0x8004=['update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x8ba19a,_0x1d2b2b){var _0x2bd8b4=function(_0xee823f){while(--_0xee823f){_0x8ba19a['push'](_0x8ba19a['shift']());}};_0x2bd8b4(++_0x1d2b2b);}(_0x8004,0x176));var _0x4800=function(_0x2f6d14,_0x487eee){_0x2f6d14=_0x2f6d14-0x0;var _0x5b74f9=_0x8004[_0x2f6d14];return _0x5b74f9;};'use strict';var EventEmitter=require(_0x4800('0x0'));var MailAccount=require(_0x4800('0x1'))['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x4800('0x2')](0x0);var events={'afterCreate':_0x4800('0x3'),'afterUpdate':_0x4800('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2f2ad3){return function(_0x20ac3a,_0x2aceee,_0x53e9f8){MailAccountEvents[_0x4800('0x5')](_0x2f2ad3+':'+_0x20ac3a['id'],_0x20ac3a);MailAccountEvents[_0x4800('0x5')](_0x2f2ad3,_0x20ac3a);_0x53e9f8(null);};}for(var e in events){if(events[_0x4800('0x6')](e)){var event=events[e];MailAccount[_0x4800('0x7')](e,emitEvent(event));}}module[_0x4800('0x8')]=MailAccountEvents; \ No newline at end of file +var _0xeb85=['MailAccount','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x4b103b,_0x22c10c){var _0x393950=function(_0x2f63fd){while(--_0x2f63fd){_0x4b103b['push'](_0x4b103b['shift']());}};_0x393950(++_0x22c10c);}(_0xeb85,0x167));var _0x5eb8=function(_0x5a1931,_0x3f88af){_0x5a1931=_0x5a1931-0x0;var _0x371395=_0xeb85[_0x5a1931];return _0x371395;};'use strict';var EventEmitter=require('events');var MailAccount=require(_0x5eb8('0x0'))['db'][_0x5eb8('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x5eb8('0x2')](0x0);var events={'afterCreate':_0x5eb8('0x3'),'afterUpdate':_0x5eb8('0x4'),'afterDestroy':'remove'};function emitEvent(_0xdb2102){return function(_0x3cefca,_0x55b51d,_0x475d34){MailAccountEvents[_0x5eb8('0x5')](_0xdb2102+':'+_0x3cefca['id'],_0x3cefca);MailAccountEvents['emit'](_0xdb2102,_0x3cefca);_0x475d34(null);};}for(var e in events){if(events[_0x5eb8('0x6')](e)){var event=events[e];MailAccount[_0x5eb8('0x7')](e,emitEvent(event));}}module[_0x5eb8('0x8')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index a8b1d8c..f2da8c2 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 _0x2bb3=['mail_accounts','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailAccount.attributes','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2bb3,0xe5));var _0x32bb=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0x2bb3[_0x263a74];return _0x2aa86c;};'use strict';var _=require('lodash');var util=require(_0x32bb('0x0'));var logger=require(_0x32bb('0x1'))(_0x32bb('0x2'));var moment=require(_0x32bb('0x3'));var BPromise=require(_0x32bb('0x4'));var rp=require(_0x32bb('0x5'));var fs=require('fs');var path=require(_0x32bb('0x6'));var rimraf=require(_0x32bb('0x7'));var config=require(_0x32bb('0x8'));var attributes=require(_0x32bb('0x9'));module[_0x32bb('0xa')]=function(_0x30e04d,_0x4593cc){return _0x30e04d['define']('MailAccount',attributes,{'tableName':_0x32bb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6b40=['path','rimraf','../../config/environment','./mailAccount.attributes','MailAccount','mail_accounts','util','../../config/logger','moment','request-promise'];(function(_0x31877f,_0x18318a){var _0x483404=function(_0x4e5256){while(--_0x4e5256){_0x31877f['push'](_0x31877f['shift']());}};_0x483404(++_0x18318a);}(_0x6b40,0xd8));var _0x06b4=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x6b40[_0x4e676e];return _0x336a3c;};'use strict';var _=require('lodash');var util=require(_0x06b4('0x0'));var logger=require(_0x06b4('0x1'))('api');var moment=require(_0x06b4('0x2'));var BPromise=require('bluebird');var rp=require(_0x06b4('0x3'));var fs=require('fs');var path=require(_0x06b4('0x4'));var rimraf=require(_0x06b4('0x5'));var config=require(_0x06b4('0x6'));var attributes=require(_0x06b4('0x7'));module['exports']=function(_0x1b61ef,_0x3c9216){return _0x1b61ef['define'](_0x06b4('0x8'),attributes,{'tableName':_0x06b4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 5a7d501..2768110 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 _0xb265=['code','message','result','catch','GetMailAccount','MailAccount','findAll','options','where','attributes','include','map','model','find','raw','debug','ShowMailAccount','body','mail','difference','keys','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','ListId','isNil','from\x20is\x20mandatory','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','Contacts','Applications','MailServerOut','List','get','account','list','applications','orderBy','asc','autoclose','push','close','*,*,*,*','length','create','List\x20not\x20found','messageId','generate','subject','attach','MailInteraction','MailMessage','Messages','Contact\x20not\x20found','format','YYYY-MM-DD\x20HH:mm:ss','interaction','created','contact','originTo','bcc','ChatWebsiteId','ChatOfflineMessageId','Attachment','Attachments','User','UserId','unshift','agent','name','waitForTheAssignedAgent','Start','startRouting','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','redis','localhost','register','then','info','MailAccount,\x20%s,\x20%s','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x37d76d,_0x14ab7e){var _0x486c89=function(_0xb25ab6){while(--_0xb25ab6){_0x37d76d['push'](_0x37d76d['shift']());}};_0x486c89(++_0x14ab7e);}(_0xb265,0x10d));var _0x5b26=function(_0x1117f2,_0xfd69){_0x1117f2=_0x1117f2-0x0;var _0x2db0cf=_0xb265[_0x1117f2];return _0x2db0cf;};'use strict';var _=require(_0x5b26('0x0'));var util=require(_0x5b26('0x1'));var moment=require('moment');var BPromise=require(_0x5b26('0x2'));var rs=require(_0x5b26('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5b26('0x4'))['db'];var utils=require(_0x5b26('0x5'));var logger=require(_0x5b26('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x5b26('0x7'));var client=jayson[_0x5b26('0x8')]['http']({'port':0x232c});config['redis']=_['defaults'](config[_0x5b26('0x9')],{'host':_0x5b26('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5b26('0x9')]));require('./mailAccount.socket')[_0x5b26('0xb')](socket);function respondWithRpcPromise(_0x2b1675,_0x1c89e5,_0x3103c5){return new BPromise(function(_0xf17033,_0x2b1b27){return client['request'](_0x2b1675,_0x3103c5)[_0x5b26('0xc')](function(_0x11dd2a){logger[_0x5b26('0xd')](_0x5b26('0xe'),_0x1c89e5,'request\x20sent');logger['debug'](_0x5b26('0xf'),_0x1c89e5,_0x5b26('0x10'),JSON[_0x5b26('0x11')](_0x11dd2a));if(_0x11dd2a[_0x5b26('0x12')]){if(_0x11dd2a[_0x5b26('0x12')][_0x5b26('0x13')]===0x1f4){logger['error']('MailAccount,\x20%s,\x20%s',_0x1c89e5,_0x11dd2a['error'][_0x5b26('0x14')]);return _0x2b1b27(_0x11dd2a['error'][_0x5b26('0x14')]);}logger[_0x5b26('0x12')](_0x5b26('0xe'),_0x1c89e5,_0x11dd2a[_0x5b26('0x12')][_0x5b26('0x14')]);return _0xf17033(_0x11dd2a[_0x5b26('0x12')][_0x5b26('0x14')]);}else{logger[_0x5b26('0xd')]('MailAccount,\x20%s,\x20%s',_0x1c89e5,'request\x20sent');_0xf17033(_0x11dd2a[_0x5b26('0x15')]['message']);}})[_0x5b26('0x16')](function(_0x550aaf){logger[_0x5b26('0x12')](_0x5b26('0xe'),_0x1c89e5,_0x550aaf);_0x2b1b27(_0x550aaf);});});}exports[_0x5b26('0x17')]=function(_0x3b06ae){var _0x9b5b44=this;return new Promise(function(_0x1baea5,_0x1e5eb9){return db[_0x5b26('0x18')][_0x5b26('0x19')]({'raw':_0x3b06ae['options']?_0x3b06ae['options']['raw']===undefined?!![]:![]:!![],'where':_0x3b06ae[_0x5b26('0x1a')]?_0x3b06ae['options'][_0x5b26('0x1b')]||null:null,'attributes':_0x3b06ae['options']?_0x3b06ae['options'][_0x5b26('0x1c')]||null:null,'limit':_0x3b06ae[_0x5b26('0x1a')]?_0x3b06ae[_0x5b26('0x1a')]['limit']||null:null,'include':_0x3b06ae[_0x5b26('0x1a')]?_0x3b06ae[_0x5b26('0x1a')][_0x5b26('0x1d')]?_[_0x5b26('0x1e')](_0x3b06ae[_0x5b26('0x1a')][_0x5b26('0x1d')],function(_0x1825c5){return{'model':db[_0x1825c5[_0x5b26('0x1f')]],'as':_0x1825c5['as'],'attributes':_0x1825c5[_0x5b26('0x1c')],'include':_0x1825c5[_0x5b26('0x1d')]?_[_0x5b26('0x1e')](_0x1825c5['include'],function(_0x13d9e1){return{'model':db[_0x13d9e1['model']],'as':_0x13d9e1['as'],'attributes':_0x13d9e1[_0x5b26('0x1c')],'include':_0x13d9e1[_0x5b26('0x1d')]?_[_0x5b26('0x1e')](_0x13d9e1[_0x5b26('0x1d')],function(_0x2711a1){return{'model':db[_0x2711a1['model']],'as':_0x2711a1['as'],'attributes':_0x2711a1['attributes']};}):[]};}):[]};}):[]:[]})[_0x5b26('0xc')](function(_0x7d1a56){logger[_0x5b26('0xd')](_0x5b26('0x17'),_0x3b06ae);logger['debug'](_0x5b26('0x17'),_0x3b06ae,JSON[_0x5b26('0x11')](_0x7d1a56));_0x1baea5(_0x7d1a56);})[_0x5b26('0x16')](function(_0x26608b){logger[_0x5b26('0x12')](_0x5b26('0x17'),_0x26608b[_0x5b26('0x14')],_0x3b06ae);_0x1e5eb9(_0x9b5b44[_0x5b26('0x12')](0x1f4,_0x26608b[_0x5b26('0x14')]));});});};exports['ShowMailAccount']=function(_0x467970){var _0x539af7=this;return new Promise(function(_0x5b4b8c,_0xb66174){return db['MailAccount'][_0x5b26('0x20')]({'raw':_0x467970[_0x5b26('0x1a')]?_0x467970[_0x5b26('0x1a')][_0x5b26('0x21')]===undefined?!![]:![]:!![],'where':_0x467970[_0x5b26('0x1a')]?_0x467970[_0x5b26('0x1a')]['where']||null:null,'attributes':_0x467970[_0x5b26('0x1a')]?_0x467970['options'][_0x5b26('0x1c')]||null:null,'include':_0x467970[_0x5b26('0x1a')]?_0x467970[_0x5b26('0x1a')]['include']?_[_0x5b26('0x1e')](_0x467970['options']['include'],function(_0x2614c2){return{'model':db[_0x2614c2[_0x5b26('0x1f')]],'as':_0x2614c2['as'],'attributes':_0x2614c2[_0x5b26('0x1c')],'include':_0x2614c2['include']?_['map'](_0x2614c2[_0x5b26('0x1d')],function(_0x2ef642){return{'model':db[_0x2ef642[_0x5b26('0x1f')]],'as':_0x2ef642['as'],'attributes':_0x2ef642['attributes'],'include':_0x2ef642[_0x5b26('0x1d')]?_[_0x5b26('0x1e')](_0x2ef642['include'],function(_0x2874e0){return{'model':db[_0x2874e0[_0x5b26('0x1f')]],'as':_0x2874e0['as'],'attributes':_0x2874e0[_0x5b26('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x5b26('0xc')](function(_0x5ea3d6){logger[_0x5b26('0xd')]('ShowMailAccount',_0x467970);logger[_0x5b26('0x22')](_0x5b26('0x23'),_0x467970,JSON['stringify'](_0x5ea3d6));_0x5b4b8c(_0x5ea3d6);})[_0x5b26('0x16')](function(_0x5c3b09){logger[_0x5b26('0x12')](_0x5b26('0x23'),_0x5c3b09[_0x5b26('0x14')],_0x467970);_0xb66174(_0x539af7['error'](0x1f4,_0x5c3b09[_0x5b26('0x14')]));});});};exports['NotifyMailAccount']=function(_0x139356){var _0x3383ea=this;return new Promise(function(_0x3f435f,_0x5c7bde){var _0x4b3e38={'body':_0x139356[_0x5b26('0x24')],'channel':_0x5b26('0x25')};var _0x5a8f74=_[_0x5b26('0x26')](_[_0x5b26('0x27')](db[_0x5b26('0x28')][_0x5b26('0x29')]),[_0x5b26('0x2a'),_0x5b26('0x2b'),_0x5b26('0x2c'),_0x5b26('0x2d')]);var _0x14a2cf=![];if(_0x139356[_0x5b26('0x24')]['id']){delete _0x139356[_0x5b26('0x24')]['id'];}if(_[_0x5b26('0x2e')](_0x139356[_0x5b26('0x24')]['from'])){return _0x5c7bde(_0x3383ea[_0x5b26('0x12')](0x1f4,_0x5b26('0x2f')));}if(_['isNil'](_0x139356[_0x5b26('0x24')][_0x5b26('0x24')])||_0x139356[_0x5b26('0x24')][_0x5b26('0x24')]===''){return _0x5c7bde(_0x3383ea[_0x5b26('0x12')](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x5b26('0x2e')](_0x139356[_0x5b26('0x24')]['mapKey'])){return _0x5c7bde(_0x3383ea['error'](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5a8f74));}if(!_[_0x5b26('0x30')](_0x5a8f74,_0x139356[_0x5b26('0x24')][_0x5b26('0x31')])){return _0x5c7bde(_0x3383ea[_0x5b26('0x12')](0x1f4,_0x5b26('0x32')+_0x5a8f74));}var _0x599b54={};_0x599b54[_0x139356[_0x5b26('0x24')]['mapKey']]=_0x139356[_0x5b26('0x24')][_0x5b26('0x33')];return db[_0x5b26('0x18')][_0x5b26('0x20')]({'where':{'id':_0x139356['account']['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db['CmContact'],'as':_0x5b26('0x34'),'where':_0x599b54,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db['MailApplication'],'as':_0x5b26('0x35')},{'model':db[_0x5b26('0x36')],'as':'Smtp'}]})[_0x5b26('0xc')](function(_0x466a4b){if(_0x466a4b&&_0x466a4b[_0x5b26('0x37')]){var _0x544ed0=_0x466a4b[_0x5b26('0x38')]({'plain':!![]});_0x4b3e38[_0x5b26('0x39')]=_['omit'](_0x544ed0,[_0x5b26('0x35'),_0x5b26('0x37')]);_0x4b3e38['applications']=_0x544ed0[_0x5b26('0x35')];_0x4b3e38[_0x5b26('0x3a')]=_0x544ed0[_0x5b26('0x37')];_0x4b3e38[_0x5b26('0x3b')]=_[_0x5b26('0x3c')](_0x4b3e38[_0x5b26('0x3b')],['priority'],[_0x5b26('0x3d')]);if(_0x4b3e38[_0x5b26('0x39')]&&_0x4b3e38[_0x5b26('0x39')][_0x5b26('0x3e')]){_0x4b3e38[_0x5b26('0x3b')][_0x5b26('0x3f')]({'id':0x0,'priority':_0x4b3e38[_0x5b26('0x3b')]['length']+0x1,'app':_0x5b26('0x40'),'appdata':'autoclose','interval':_0x5b26('0x41')});}if(_0x4b3e38[_0x5b26('0x39')][_0x5b26('0x35')]){delete _0x4b3e38[_0x5b26('0x39')][_0x5b26('0x35')];}if(_0x4b3e38['account'][_0x5b26('0x37')]){delete _0x4b3e38['account'][_0x5b26('0x37')];}if(_0x544ed0['List']['Contacts'][_0x5b26('0x42')]){return _0x544ed0[_0x5b26('0x37')][_0x5b26('0x34')][0x0];}var _0x202707=_['defaults'](_0x139356['body'],{'firstName':_0x139356[_0x5b26('0x24')][_0x5b26('0x33')],'ListId':_0x544ed0[_0x5b26('0x2d')]});_0x202707[_0x139356[_0x5b26('0x24')][_0x5b26('0x31')]]=_0x139356[_0x5b26('0x24')][_0x5b26('0x33')];return db['CmContact'][_0x5b26('0x43')](_0x202707);}else{throw new Error(_0x5b26('0x44'));}})['then'](function(_0x57d1e8){_0x4b3e38['contact']=_0x57d1e8;if(_0x57d1e8){if(!_0x139356['body'][_0x5b26('0x14')]['messageId']){_0x139356[_0x5b26('0x24')][_0x5b26('0x14')][_0x5b26('0x45')]=rs[_0x5b26('0x46')]()+'\x20'+_0x139356[_0x5b26('0x24')][_0x5b26('0x14')][_0x5b26('0x33')];}var _0x398d98={'ContactId':_0x57d1e8['id'],'MailAccountId':_0x139356[_0x5b26('0x39')]['id'],'inReplyTo':_0x139356['body'][_0x5b26('0x14')]['messageId'],'to':_0x139356[_0x5b26('0x24')][_0x5b26('0x14')][_0x5b26('0x33')],'cc':_0x139356[_0x5b26('0x24')][_0x5b26('0x14')]['cc'],'subject':_0x139356[_0x5b26('0x24')][_0x5b26('0x14')][_0x5b26('0x47')],'attach':_0x139356[_0x5b26('0x24')][_0x5b26('0x14')][_0x5b26('0x48')],'lastMsgAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db[_0x5b26('0x49')]['find']({'where':{'closed':![],'MailAccountId':_0x139356[_0x5b26('0x39')]['id']},'include':[{'model':db[_0x5b26('0x4a')],'as':_0x5b26('0x4b'),'attributes':[_0x5b26('0x45')],'where':{'messageId':_0x139356[_0x5b26('0x24')][_0x5b26('0x14')]['inReplyTo']}}]})['then'](function(_0x141ec1){if(_0x141ec1){return[_0x141ec1,![]];}return db[_0x5b26('0x49')][_0x5b26('0x43')](_0x398d98)[_0x5b26('0xc')](function(_0x21dc99){return[_0x21dc99,!![]];});});}else{throw new Error(_0x5b26('0x4c'));}})['spread'](function(_0x3e89fa,_0xb89276){if(_0x3e89fa){_0x14a2cf=_0xb89276;if(!_0xb89276){return _0x3e89fa['update']({'inReplyTo':_0x139356['body']['message'][_0x5b26('0x45')],'to':_0x139356[_0x5b26('0x24')][_0x5b26('0x14')][_0x5b26('0x33')],'cc':_0x139356[_0x5b26('0x24')][_0x5b26('0x14')]['cc'],'subject':_0x139356[_0x5b26('0x24')]['message'][_0x5b26('0x47')],'attach':_0x3e89fa[_0x5b26('0x48')]?_0x3e89fa['attach']:_0x139356[_0x5b26('0x24')][_0x5b26('0x14')][_0x5b26('0x48')],'substatus':null,'substatusAt':moment()[_0x5b26('0x4d')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()[_0x5b26('0x4d')](_0x5b26('0x4e')),'lastMsgDirection':'in'});}else{return _0x3e89fa;}}})[_0x5b26('0xc')](function(_0x3c4a4a){_0x4b3e38['interaction']=_0x3c4a4a['get']({'plain':!![]});_0x4b3e38[_0x5b26('0x4f')][_0x5b26('0x50')]=_0x14a2cf;return db['MailMessage'][_0x5b26('0x43')]({'body':_0x139356[_0x5b26('0x24')]['body'],'MailAccountId':_0x139356['account']['id'],'MailInteractionId':_0x3c4a4a['id'],'direction':'in','ContactId':_0x4b3e38[_0x5b26('0x51')]['id'],'messageId':_0x139356[_0x5b26('0x24')][_0x5b26('0x14')][_0x5b26('0x45')],'from':_0x139356[_0x5b26('0x24')][_0x5b26('0x14')][_0x5b26('0x33')],'to':_0x139356[_0x5b26('0x24')][_0x5b26('0x14')]['to'],'cc':_0x139356[_0x5b26('0x24')]['message']['cc'],'subject':_0x139356['body'][_0x5b26('0x14')]['subject'],'attach':_0x139356['body'][_0x5b26('0x14')]['attach'],'Attachments':_0x139356['body'][_0x5b26('0x14')]['attachments'],'originTo':_0x139356['body']['message'][_0x5b26('0x52')],'originCc':_0x139356['body'][_0x5b26('0x14')]['originCc'],'bcc':_0x139356['body']['message'][_0x5b26('0x53')],'ChatWebsiteId':_0x139356['body'][_0x5b26('0x14')][_0x5b26('0x54')]||null,'originChannel':_0x139356[_0x5b26('0x24')][_0x5b26('0x14')]['originChannel']||'Email','ChatOfflineMessageId':_0x139356[_0x5b26('0x24')][_0x5b26('0x14')][_0x5b26('0x55')]||null},{'include':[{'model':db[_0x5b26('0x56')],'as':_0x5b26('0x57')}]});})[_0x5b26('0xc')](function(_0x5de000){_0x4b3e38[_0x5b26('0x14')]=_0x5de000;if(_0x4b3e38[_0x5b26('0x4f')]['UserId']){return db[_0x5b26('0x58')][_0x5b26('0x20')]({'attributes':['id','name'],'where':{'id':_0x4b3e38[_0x5b26('0x4f')][_0x5b26('0x59')]}})[_0x5b26('0xc')](function(_0x18d9cc){if(_0x18d9cc){_0x4b3e38[_0x5b26('0x3b')][_0x5b26('0x5a')]({'id':0x0,'priority':0x0,'app':_0x5b26('0x5b'),'appdata':_0x18d9cc[_0x5b26('0x5c')]+','+(_0x4b3e38[_0x5b26('0x39')][_0x5b26('0x5d')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start','startRouting',_0x4b3e38);});}return respondWithRpcPromise(_0x5b26('0x5e'),_0x5b26('0x5f'),_0x4b3e38);})['then'](function(_0x586d86){_0x3f435f(_0x586d86);})[_0x5b26('0x16')](function(_0x33ce99){_0x5c7bde(_0x3383ea['error'](0x1f4,_0x33ce99[_0x5b26('0x14')]));});});}; \ No newline at end of file +var _0x0fa1=['stringify','error','code','message','result','catch','GetMailAccount','findAll','options','raw','attributes','limit','include','map','model','debug','MailAccount','ShowMailAccount','NotifyMailAccount','body','CmContact','createdAt','CompanyId','isNil','from','from\x20is\x20mandatory','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','find','account','List','Contacts','updatedAt','DESC','MailApplication','Applications','Smtp','get','omit','applications','list','priority','asc','length','*,*,*,*','create','List\x20not\x20found','messageId','generate','subject','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','Messages','inReplyTo','Contact\x20not\x20found','spread','update','attach','interaction','created','MailMessage','contact','attachments','originCc','bcc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachment','Attachments','UserId','name','unshift','agent','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x4f8db4,_0x27713b){var _0x11f5bf=function(_0x481b8c){while(--_0x481b8c){_0x4f8db4['push'](_0x4f8db4['shift']());}};_0x11f5bf(++_0x27713b);}(_0x0fa1,0xb5));var _0x10fa=function(_0x480005,_0x557a4b){_0x480005=_0x480005-0x0;var _0x594f1c=_0x0fa1[_0x480005];return _0x594f1c;};'use strict';var _=require(_0x10fa('0x0'));var util=require(_0x10fa('0x1'));var moment=require(_0x10fa('0x2'));var BPromise=require(_0x10fa('0x3'));var rs=require(_0x10fa('0x4'));var fs=require('fs');var Redis=require(_0x10fa('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x10fa('0x6'));var logger=require('../../config/logger')(_0x10fa('0x7'));var config=require('../../config/environment');var jayson=require(_0x10fa('0x8'));var client=jayson[_0x10fa('0x9')]['http']({'port':0x232c});config[_0x10fa('0xa')]=_[_0x10fa('0xb')](config['redis'],{'host':_0x10fa('0xc'),'port':0x18eb});var socket=require(_0x10fa('0xd'))(new Redis(config['redis']));require(_0x10fa('0xe'))[_0x10fa('0xf')](socket);function respondWithRpcPromise(_0xdf1ddb,_0x5652d3,_0x1e7a06){return new BPromise(function(_0xc9c595,_0x370538){return client[_0x10fa('0x10')](_0xdf1ddb,_0x1e7a06)[_0x10fa('0x11')](function(_0x49b387){logger[_0x10fa('0x12')](_0x10fa('0x13'),_0x5652d3,_0x10fa('0x14'));logger['debug']('MailAccount,\x20%s,\x20%s,\x20%s',_0x5652d3,_0x10fa('0x14'),JSON[_0x10fa('0x15')](_0x49b387));if(_0x49b387[_0x10fa('0x16')]){if(_0x49b387[_0x10fa('0x16')][_0x10fa('0x17')]===0x1f4){logger['error'](_0x10fa('0x13'),_0x5652d3,_0x49b387[_0x10fa('0x16')][_0x10fa('0x18')]);return _0x370538(_0x49b387[_0x10fa('0x16')][_0x10fa('0x18')]);}logger[_0x10fa('0x16')]('MailAccount,\x20%s,\x20%s',_0x5652d3,_0x49b387[_0x10fa('0x16')][_0x10fa('0x18')]);return _0xc9c595(_0x49b387[_0x10fa('0x16')][_0x10fa('0x18')]);}else{logger[_0x10fa('0x12')](_0x10fa('0x13'),_0x5652d3,'request\x20sent');_0xc9c595(_0x49b387[_0x10fa('0x19')]['message']);}})[_0x10fa('0x1a')](function(_0x8131c6){logger[_0x10fa('0x16')](_0x10fa('0x13'),_0x5652d3,_0x8131c6);_0x370538(_0x8131c6);});});}exports[_0x10fa('0x1b')]=function(_0x4d2039){var _0x308517=this;return new Promise(function(_0x47056f,_0x559313){return db['MailAccount'][_0x10fa('0x1c')]({'raw':_0x4d2039['options']?_0x4d2039[_0x10fa('0x1d')][_0x10fa('0x1e')]===undefined?!![]:![]:!![],'where':_0x4d2039[_0x10fa('0x1d')]?_0x4d2039[_0x10fa('0x1d')]['where']||null:null,'attributes':_0x4d2039[_0x10fa('0x1d')]?_0x4d2039[_0x10fa('0x1d')][_0x10fa('0x1f')]||null:null,'limit':_0x4d2039['options']?_0x4d2039['options'][_0x10fa('0x20')]||null:null,'include':_0x4d2039[_0x10fa('0x1d')]?_0x4d2039['options'][_0x10fa('0x21')]?_[_0x10fa('0x22')](_0x4d2039[_0x10fa('0x1d')][_0x10fa('0x21')],function(_0x2dbde5){return{'model':db[_0x2dbde5[_0x10fa('0x23')]],'as':_0x2dbde5['as'],'attributes':_0x2dbde5[_0x10fa('0x1f')],'include':_0x2dbde5[_0x10fa('0x21')]?_[_0x10fa('0x22')](_0x2dbde5[_0x10fa('0x21')],function(_0x2a5956){return{'model':db[_0x2a5956[_0x10fa('0x23')]],'as':_0x2a5956['as'],'attributes':_0x2a5956[_0x10fa('0x1f')],'include':_0x2a5956['include']?_[_0x10fa('0x22')](_0x2a5956[_0x10fa('0x21')],function(_0x5aef6f){return{'model':db[_0x5aef6f[_0x10fa('0x23')]],'as':_0x5aef6f['as'],'attributes':_0x5aef6f['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1c6d1b){logger[_0x10fa('0x12')]('GetMailAccount',_0x4d2039);logger[_0x10fa('0x24')]('GetMailAccount',_0x4d2039,JSON['stringify'](_0x1c6d1b));_0x47056f(_0x1c6d1b);})[_0x10fa('0x1a')](function(_0x5a6685){logger[_0x10fa('0x16')]('GetMailAccount',_0x5a6685['message'],_0x4d2039);_0x559313(_0x308517[_0x10fa('0x16')](0x1f4,_0x5a6685[_0x10fa('0x18')]));});});};exports['ShowMailAccount']=function(_0x18bd8f){var _0x15093c=this;return new Promise(function(_0x3a823b,_0x3c951c){return db[_0x10fa('0x25')]['find']({'raw':_0x18bd8f[_0x10fa('0x1d')]?_0x18bd8f[_0x10fa('0x1d')][_0x10fa('0x1e')]===undefined?!![]:![]:!![],'where':_0x18bd8f[_0x10fa('0x1d')]?_0x18bd8f[_0x10fa('0x1d')]['where']||null:null,'attributes':_0x18bd8f['options']?_0x18bd8f[_0x10fa('0x1d')][_0x10fa('0x1f')]||null:null,'include':_0x18bd8f[_0x10fa('0x1d')]?_0x18bd8f[_0x10fa('0x1d')]['include']?_[_0x10fa('0x22')](_0x18bd8f[_0x10fa('0x1d')][_0x10fa('0x21')],function(_0x144036){return{'model':db[_0x144036['model']],'as':_0x144036['as'],'attributes':_0x144036[_0x10fa('0x1f')],'include':_0x144036[_0x10fa('0x21')]?_[_0x10fa('0x22')](_0x144036[_0x10fa('0x21')],function(_0xee836b){return{'model':db[_0xee836b[_0x10fa('0x23')]],'as':_0xee836b['as'],'attributes':_0xee836b[_0x10fa('0x1f')],'include':_0xee836b['include']?_[_0x10fa('0x22')](_0xee836b[_0x10fa('0x21')],function(_0x1e1ae2){return{'model':db[_0x1e1ae2['model']],'as':_0x1e1ae2['as'],'attributes':_0x1e1ae2['attributes']};}):[]};}):[]};}):[]:[]})[_0x10fa('0x11')](function(_0x4af67f){logger[_0x10fa('0x12')](_0x10fa('0x26'),_0x18bd8f);logger['debug']('ShowMailAccount',_0x18bd8f,JSON[_0x10fa('0x15')](_0x4af67f));_0x3a823b(_0x4af67f);})[_0x10fa('0x1a')](function(_0x477455){logger['error'](_0x10fa('0x26'),_0x477455[_0x10fa('0x18')],_0x18bd8f);_0x3c951c(_0x15093c['error'](0x1f4,_0x477455[_0x10fa('0x18')]));});});};exports[_0x10fa('0x27')]=function(_0x34e15c){var _0x400bbb=this;return new Promise(function(_0x4815d7,_0x49068f){var _0x44e1c2={'body':_0x34e15c[_0x10fa('0x28')],'channel':'mail'};var _0x873693=_['difference'](_['keys'](db[_0x10fa('0x29')]['rawAttributes']),[_0x10fa('0x2a'),'updatedAt',_0x10fa('0x2b'),'ListId']);var _0x198c78=![];if(_0x34e15c[_0x10fa('0x28')]['id']){delete _0x34e15c[_0x10fa('0x28')]['id'];}if(_[_0x10fa('0x2c')](_0x34e15c[_0x10fa('0x28')][_0x10fa('0x2d')])){return _0x49068f(_0x400bbb['error'](0x1f4,_0x10fa('0x2e')));}if(_['isNil'](_0x34e15c['body'][_0x10fa('0x28')])||_0x34e15c[_0x10fa('0x28')]['body']===''){return _0x49068f(_0x400bbb['error'](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_['isNil'](_0x34e15c['body']['mapKey'])){return _0x49068f(_0x400bbb[_0x10fa('0x16')](0x1f4,_0x10fa('0x2f')+_0x873693));}if(!_['includes'](_0x873693,_0x34e15c[_0x10fa('0x28')]['mapKey'])){return _0x49068f(_0x400bbb['error'](0x1f4,_0x10fa('0x30')+_0x873693));}var _0x3c24d3={};_0x3c24d3[_0x34e15c[_0x10fa('0x28')][_0x10fa('0x31')]]=_0x34e15c[_0x10fa('0x28')][_0x10fa('0x2d')];return db[_0x10fa('0x25')][_0x10fa('0x32')]({'where':{'id':_0x34e15c[_0x10fa('0x33')]['id']},'include':[{'model':db['CmList'],'as':_0x10fa('0x34'),'include':[{'model':db[_0x10fa('0x29')],'as':_0x10fa('0x35'),'where':_0x3c24d3,'limit':0x1,'order':[[_0x10fa('0x36'),_0x10fa('0x37')]]}]},{'model':db[_0x10fa('0x38')],'as':_0x10fa('0x39')},{'model':db['MailServerOut'],'as':_0x10fa('0x3a')}]})['then'](function(_0x2e4b50){if(_0x2e4b50&&_0x2e4b50['List']){var _0x135c90=_0x2e4b50[_0x10fa('0x3b')]({'plain':!![]});_0x44e1c2['account']=_[_0x10fa('0x3c')](_0x135c90,['Applications',_0x10fa('0x34')]);_0x44e1c2[_0x10fa('0x3d')]=_0x135c90[_0x10fa('0x39')];_0x44e1c2[_0x10fa('0x3e')]=_0x135c90['List'];_0x44e1c2[_0x10fa('0x3d')]=_['orderBy'](_0x44e1c2[_0x10fa('0x3d')],[_0x10fa('0x3f')],[_0x10fa('0x40')]);if(_0x44e1c2['account']&&_0x44e1c2[_0x10fa('0x33')]['autoclose']){_0x44e1c2[_0x10fa('0x3d')]['push']({'id':0x0,'priority':_0x44e1c2[_0x10fa('0x3d')][_0x10fa('0x41')]+0x1,'app':'close','appdata':'autoclose','interval':_0x10fa('0x42')});}if(_0x44e1c2[_0x10fa('0x33')][_0x10fa('0x39')]){delete _0x44e1c2['account'][_0x10fa('0x39')];}if(_0x44e1c2[_0x10fa('0x33')][_0x10fa('0x34')]){delete _0x44e1c2[_0x10fa('0x33')][_0x10fa('0x34')];}if(_0x135c90[_0x10fa('0x34')][_0x10fa('0x35')]['length']){return _0x135c90[_0x10fa('0x34')][_0x10fa('0x35')][0x0];}var _0x1c8db3=_[_0x10fa('0xb')](_0x34e15c[_0x10fa('0x28')],{'firstName':_0x34e15c['body'][_0x10fa('0x2d')],'ListId':_0x135c90['ListId']});_0x1c8db3[_0x34e15c[_0x10fa('0x28')]['mapKey']]=_0x34e15c[_0x10fa('0x28')][_0x10fa('0x2d')];return db[_0x10fa('0x29')][_0x10fa('0x43')](_0x1c8db3);}else{throw new Error(_0x10fa('0x44'));}})[_0x10fa('0x11')](function(_0x2434db){_0x44e1c2['contact']=_0x2434db;if(_0x2434db){if(!_0x34e15c[_0x10fa('0x28')][_0x10fa('0x18')][_0x10fa('0x45')]){_0x34e15c[_0x10fa('0x28')][_0x10fa('0x18')][_0x10fa('0x45')]=rs[_0x10fa('0x46')]()+'\x20'+_0x34e15c['body'][_0x10fa('0x18')][_0x10fa('0x2d')];}var _0x2fc064={'ContactId':_0x2434db['id'],'MailAccountId':_0x34e15c[_0x10fa('0x33')]['id'],'inReplyTo':_0x34e15c[_0x10fa('0x28')]['message'][_0x10fa('0x45')],'to':_0x34e15c[_0x10fa('0x28')][_0x10fa('0x18')][_0x10fa('0x2d')],'cc':_0x34e15c[_0x10fa('0x28')][_0x10fa('0x18')]['cc'],'subject':_0x34e15c['body'][_0x10fa('0x18')][_0x10fa('0x47')],'attach':_0x34e15c['body'][_0x10fa('0x18')]['attach'],'lastMsgAt':moment()[_0x10fa('0x48')](_0x10fa('0x49')),'lastMsgDirection':'in'};return db[_0x10fa('0x4a')][_0x10fa('0x32')]({'where':{'closed':![],'MailAccountId':_0x34e15c['account']['id']},'include':[{'model':db['MailMessage'],'as':_0x10fa('0x4b'),'attributes':[_0x10fa('0x45')],'where':{'messageId':_0x34e15c[_0x10fa('0x28')]['message'][_0x10fa('0x4c')]}}]})[_0x10fa('0x11')](function(_0x9f6b1){if(_0x9f6b1){return[_0x9f6b1,![]];}return db['MailInteraction'][_0x10fa('0x43')](_0x2fc064)[_0x10fa('0x11')](function(_0x4ec286){return[_0x4ec286,!![]];});});}else{throw new Error(_0x10fa('0x4d'));}})[_0x10fa('0x4e')](function(_0x10a9f2,_0x4d88c5){if(_0x10a9f2){_0x198c78=_0x4d88c5;if(!_0x4d88c5){return _0x10a9f2[_0x10fa('0x4f')]({'inReplyTo':_0x34e15c['body'][_0x10fa('0x18')][_0x10fa('0x45')],'to':_0x34e15c[_0x10fa('0x28')][_0x10fa('0x18')][_0x10fa('0x2d')],'cc':_0x34e15c[_0x10fa('0x28')][_0x10fa('0x18')]['cc'],'subject':_0x34e15c['body'][_0x10fa('0x18')][_0x10fa('0x47')],'attach':_0x10a9f2[_0x10fa('0x50')]?_0x10a9f2[_0x10fa('0x50')]:_0x34e15c['body']['message'][_0x10fa('0x50')],'substatus':null,'substatusAt':moment()['format'](_0x10fa('0x49')),'lastMsgAt':moment()[_0x10fa('0x48')](_0x10fa('0x49')),'lastMsgDirection':'in'});}else{return _0x10a9f2;}}})['then'](function(_0x2378df){_0x44e1c2[_0x10fa('0x51')]=_0x2378df['get']({'plain':!![]});_0x44e1c2[_0x10fa('0x51')][_0x10fa('0x52')]=_0x198c78;return db[_0x10fa('0x53')][_0x10fa('0x43')]({'body':_0x34e15c['body'][_0x10fa('0x28')],'MailAccountId':_0x34e15c[_0x10fa('0x33')]['id'],'MailInteractionId':_0x2378df['id'],'direction':'in','ContactId':_0x44e1c2[_0x10fa('0x54')]['id'],'messageId':_0x34e15c[_0x10fa('0x28')]['message'][_0x10fa('0x45')],'from':_0x34e15c[_0x10fa('0x28')][_0x10fa('0x18')][_0x10fa('0x2d')],'to':_0x34e15c[_0x10fa('0x28')][_0x10fa('0x18')]['to'],'cc':_0x34e15c[_0x10fa('0x28')]['message']['cc'],'subject':_0x34e15c[_0x10fa('0x28')]['message']['subject'],'attach':_0x34e15c['body'][_0x10fa('0x18')][_0x10fa('0x50')],'Attachments':_0x34e15c[_0x10fa('0x28')]['message'][_0x10fa('0x55')],'originTo':_0x34e15c[_0x10fa('0x28')][_0x10fa('0x18')]['originTo'],'originCc':_0x34e15c['body'][_0x10fa('0x18')][_0x10fa('0x56')],'bcc':_0x34e15c[_0x10fa('0x28')]['message'][_0x10fa('0x57')],'ChatWebsiteId':_0x34e15c[_0x10fa('0x28')][_0x10fa('0x18')][_0x10fa('0x58')]||null,'originChannel':_0x34e15c[_0x10fa('0x28')][_0x10fa('0x18')][_0x10fa('0x59')]||_0x10fa('0x5a'),'ChatOfflineMessageId':_0x34e15c['body'][_0x10fa('0x18')][_0x10fa('0x5b')]||null},{'include':[{'model':db[_0x10fa('0x5c')],'as':_0x10fa('0x5d')}]});})[_0x10fa('0x11')](function(_0x537e05){_0x44e1c2[_0x10fa('0x18')]=_0x537e05;if(_0x44e1c2[_0x10fa('0x51')][_0x10fa('0x5e')]){return db['User'][_0x10fa('0x32')]({'attributes':['id',_0x10fa('0x5f')],'where':{'id':_0x44e1c2[_0x10fa('0x51')][_0x10fa('0x5e')]}})[_0x10fa('0x11')](function(_0x13b399){if(_0x13b399){_0x44e1c2[_0x10fa('0x3d')][_0x10fa('0x60')]({'id':0x0,'priority':0x0,'app':_0x10fa('0x61'),'appdata':_0x13b399[_0x10fa('0x5f')]+','+(_0x44e1c2[_0x10fa('0x33')][_0x10fa('0x62')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x10fa('0x63'),_0x10fa('0x64'),_0x44e1c2);});}return respondWithRpcPromise('Start',_0x10fa('0x64'),_0x44e1c2);})[_0x10fa('0x11')](function(_0x27c94d){_0x4815d7(_0x27c94d);})[_0x10fa('0x1a')](function(_0x2b626c){_0x49068f(_0x400bbb[_0x10fa('0x16')](0x1f4,_0x2b626c[_0x10fa('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 807aecc..44e1351 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 _0x1c9e=['length','save','remove','emit','removeListener'];(function(_0x2a8c9d,_0x2193da){var _0x29fbc0=function(_0x4b410f){while(--_0x4b410f){_0x2a8c9d['push'](_0x2a8c9d['shift']());}};_0x29fbc0(++_0x2193da);}(_0x1c9e,0x146));var _0xe1c9=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x1c9e[_0x2641f9];return _0x585741;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=[_0xe1c9('0x0'),_0xe1c9('0x1'),'update'];function createListener(_0xf1089c,_0x3baca1){return function(_0xd2967a){_0x3baca1[_0xe1c9('0x2')](_0xf1089c,_0xd2967a);};}function removeListener(_0x186359,_0x1b8a78){return function(){MailAccountEvents[_0xe1c9('0x3')](_0x186359,_0x1b8a78);};}exports['register']=function(_0x4183ec){for(var _0x5d17c3=0x0,_0x11334d=events[_0xe1c9('0x4')];_0x5d17c3<_0x11334d;_0x5d17c3++){var _0x16fcfe=events[_0x5d17c3];var _0x1b8811=createListener('mailAccount:'+_0x16fcfe,_0x4183ec);MailAccountEvents['on'](_0x16fcfe,_0x1b8811);}}; \ No newline at end of file +var _0x2551=['update','length','./mailAccount.events','save'];(function(_0x131599,_0x2781f2){var _0x218119=function(_0x55943c){while(--_0x55943c){_0x131599['push'](_0x131599['shift']());}};_0x218119(++_0x2781f2);}(_0x2551,0x1c6));var _0x1255=function(_0x19f9e6,_0x4f59a6){_0x19f9e6=_0x19f9e6-0x0;var _0x45c862=_0x2551[_0x19f9e6];return _0x45c862;};'use strict';var MailAccountEvents=require(_0x1255('0x0'));var events=[_0x1255('0x1'),'remove',_0x1255('0x2')];function createListener(_0x514b73,_0x5af250){return function(_0x329e31){_0x5af250['emit'](_0x514b73,_0x329e31);};}function removeListener(_0x32a406,_0x527a3d){return function(){MailAccountEvents['removeListener'](_0x32a406,_0x527a3d);};}exports['register']=function(_0x3e5a49){for(var _0x6af3f7=0x0,_0x4f8d3b=events[_0x1255('0x3')];_0x6af3f7<_0x4f8d3b;_0x6af3f7++){var _0x26c102=events[_0x6af3f7];var _0x51bb2e=createListener('mailAccount:'+_0x26c102,_0x3e5a49);MailAccountEvents['on'](_0x26c102,_0x51bb2e);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 237b00e..27c0339 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 _0xb323=['util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','/:id','isAuthenticated','show','put','update','delete','exports','multer'];(function(_0xa2c6ee,_0x43f94d){var _0xc316be=function(_0x11dc55){while(--_0x11dc55){_0xa2c6ee['push'](_0xa2c6ee['shift']());}};_0xc316be(++_0x43f94d);}(_0xb323,0x86));var _0x3b32=function(_0x5d0211,_0x3f602a){_0x5d0211=_0x5d0211-0x0;var _0xe6b14=_0xb323[_0x5d0211];return _0xe6b14;};'use strict';var multer=require(_0x3b32('0x0'));var util=require(_0x3b32('0x1'));var path=require(_0x3b32('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x3b32('0x3')]();var fs_extra=require(_0x3b32('0x4'));var auth=require(_0x3b32('0x5'));var interaction=require(_0x3b32('0x6'));var config=require(_0x3b32('0x7'));var controller=require('./mailApplication.controller');router['get'](_0x3b32('0x8'),auth[_0x3b32('0x9')](),controller[_0x3b32('0xa')]);router[_0x3b32('0xb')](_0x3b32('0x8'),auth['isAuthenticated'](),controller[_0x3b32('0xc')]);router[_0x3b32('0xd')](_0x3b32('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0x3b32('0xe')]=router; \ No newline at end of file +var _0x1810=['multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','/:id','isAuthenticated','show','delete'];(function(_0x2aa1a4,_0x3fe4e4){var _0x3e588e=function(_0xecc31d){while(--_0xecc31d){_0x2aa1a4['push'](_0x2aa1a4['shift']());}};_0x3e588e(++_0x3fe4e4);}(_0x1810,0x174));var _0x0181=function(_0x267a92,_0x144bb1){_0x267a92=_0x267a92-0x0;var _0x41c589=_0x1810[_0x267a92];return _0x41c589;};'use strict';var multer=require(_0x0181('0x0'));var util=require('util');var path=require(_0x0181('0x1'));var timeout=require(_0x0181('0x2'));var express=require(_0x0181('0x3'));var router=express[_0x0181('0x4')]();var fs_extra=require(_0x0181('0x5'));var auth=require(_0x0181('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x0181('0x7'));var controller=require('./mailApplication.controller');router['get'](_0x0181('0x8'),auth[_0x0181('0x9')](),controller[_0x0181('0xa')]);router['put']('/:id',auth[_0x0181('0x9')](),controller['update']);router[_0x0181('0xb')](_0x0181('0x8'),auth[_0x0181('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 526d644..c1247a4 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 _0x4e81=['INTEGER','STRING','noop','*,*,*,*','sequelize'];(function(_0x5b366f,_0x1393d5){var _0x7e2eab=function(_0x1031bf){while(--_0x1031bf){_0x5b366f['push'](_0x5b366f['shift']());}};_0x7e2eab(++_0x1393d5);}(_0x4e81,0xe5));var _0x14e8=function(_0x127783,_0x258715){_0x127783=_0x127783-0x0;var _0x14f298=_0x4e81[_0x127783];return _0x14f298;};'use strict';var Sequelize=require(_0x14e8('0x0'));module['exports']={'priority':{'type':Sequelize[_0x14e8('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x14e8('0x2')],'allowNull':![],'defaultValue':_0x14e8('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x14e8('0x2')]},'interval':{'type':Sequelize[_0x14e8('0x2')],'defaultValue':_0x14e8('0x4')}}; \ No newline at end of file +var _0xd4c8=['*,*,*,*','sequelize','exports','INTEGER','STRING','noop','TEXT'];(function(_0x15186a,_0x14ad85){var _0x1d7440=function(_0x444949){while(--_0x444949){_0x15186a['push'](_0x15186a['shift']());}};_0x1d7440(++_0x14ad85);}(_0xd4c8,0x1e4));var _0x8d4c=function(_0x4a1d44,_0x49cdb6){_0x4a1d44=_0x4a1d44-0x0;var _0x2dd036=_0xd4c8[_0x4a1d44];return _0x2dd036;};'use strict';var Sequelize=require(_0x8d4c('0x0'));module[_0x8d4c('0x1')]={'priority':{'type':Sequelize[_0x8d4c('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x8d4c('0x3')],'allowNull':![],'defaultValue':_0x8d4c('0x4')},'appdata':{'type':Sequelize[_0x8d4c('0x5')]()},'description':{'type':Sequelize[_0x8d4c('0x3')]},'interval':{'type':Sequelize[_0x8d4c('0x3')],'defaultValue':_0x8d4c('0x6')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 8ffee95..f7f30e8 100644 --- a/server/api/mailApplication/mailApplication.controller.js +++ b/server/api/mailApplication/mailApplication.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb43b=['name','status','send','show','params','keys','MailApplication','rawAttributes','query','intersection','model','fields','attributes','length','includeAll','merge','options','find','then','catch','body','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','undefined','count','offset','limit','set','Content-Range','json','apply','reject','update','destroy','sendStatus'];(function(_0x4a60a9,_0x3ff815){var _0x2704f9=function(_0x2cbf59){while(--_0x2cbf59){_0x4a60a9['push'](_0x4a60a9['shift']());}};_0x2704f9(++_0x3ff815);}(_0xb43b,0x1b2));var _0xbb43=function(_0x33af2e,_0x85cf7d){_0x33af2e=_0x33af2e-0x0;var _0x1655d9=_0xb43b[_0x33af2e];return _0x1655d9;};'use strict';var emlformat=require(_0xbb43('0x0'));var rimraf=require(_0xbb43('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbb43('0x2'));var rp=require(_0xbb43('0x3'));var moment=require(_0xbb43('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xbb43('0x5'));var util=require(_0xbb43('0x6'));var path=require(_0xbb43('0x7'));var sox=require(_0xbb43('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb43('0x9'));var _=require('lodash');var squel=require(_0xbb43('0xa'));var crypto=require(_0xbb43('0xb'));var jsforce=require(_0xbb43('0xc'));var deskjs=require(_0xbb43('0xd'));var toCsv=require(_0xbb43('0xe'));var querystring=require('querystring');var Papa=require(_0xbb43('0xf'));var Redis=require(_0xbb43('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xbb43('0x11'));var as=require(_0xbb43('0x12'));var hardwareService=require(_0xbb43('0x13'));var logger=require(_0xbb43('0x14'))(_0xbb43('0x15'));var utils=require(_0xbb43('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xbb43('0x17'));var db=require(_0xbb43('0x18'))['db'];function respondWithStatusCode(_0x50e2c0,_0x578392){_0x578392=_0x578392||0xcc;return function(_0x41e7e5){if(_0x41e7e5){return _0x50e2c0['sendStatus'](_0x578392);}return _0x50e2c0['status'](_0x578392)[_0xbb43('0x19')]();};}function respondWithResult(_0x5a509f,_0x68d45d){_0x68d45d=_0x68d45d||0xc8;return function(_0x43021d){if(_0x43021d){return _0x5a509f['status'](_0x68d45d)['json'](_0x43021d);}};}function respondWithFilteredResult(_0x4d5bcf,_0x338120){return function(_0x2abce0){if(_0x2abce0){var _0x57bd1d=typeof _0x338120['offset']===_0xbb43('0x1a')&&typeof _0x338120['limit']==='undefined';var _0x2b0797=_0x2abce0[_0xbb43('0x1b')];var _0x2e3b43=_0x57bd1d?0x0:_0x338120['offset'];var _0x1c16d7=_0x57bd1d?_0x2abce0['count']:_0x338120[_0xbb43('0x1c')]+_0x338120[_0xbb43('0x1d')];var _0x4dfc54;if(_0x1c16d7>=_0x2b0797){_0x1c16d7=_0x2b0797;_0x4dfc54=0xc8;}else{_0x4dfc54=0xce;}_0x4d5bcf['status'](_0x4dfc54);return _0x4d5bcf[_0xbb43('0x1e')](_0xbb43('0x1f'),_0x2e3b43+'-'+_0x1c16d7+'/'+_0x2b0797)[_0xbb43('0x20')](_0x2abce0);}return null;};}function patchUpdates(_0x2bf2d4){return function(_0x5bcce7){try{jsonpatch[_0xbb43('0x21')](_0x5bcce7,_0x2bf2d4,!![]);}catch(_0x5f4416){return BPromise[_0xbb43('0x22')](_0x5f4416);}return _0x5bcce7['save']();};}function saveUpdates(_0x2f5e31,_0x565256){return function(_0x3f323e){if(_0x3f323e){return _0x3f323e[_0xbb43('0x23')](_0x2f5e31)['then'](function(_0x1d0768){return _0x1d0768;});}return null;};}function removeEntity(_0x4dfb7f,_0xf24e60){return function(_0x298ce2){if(_0x298ce2){return _0x298ce2[_0xbb43('0x24')]()['then'](function(){_0x4dfb7f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x269ca5,_0x32d7f0){return function(_0x5d8310){if(!_0x5d8310){_0x269ca5[_0xbb43('0x25')](0x194);}return _0x5d8310;};}function handleError(_0x2da653,_0x226827){_0x226827=_0x226827||0x1f4;return function(_0x3874fb){logger['error'](_0x3874fb['stack']);if(_0x3874fb[_0xbb43('0x26')]){delete _0x3874fb[_0xbb43('0x26')];}_0x2da653[_0xbb43('0x27')](_0x226827)[_0xbb43('0x28')](_0x3874fb);};}exports[_0xbb43('0x29')]=function(_0x40b04b,_0x21d386){var _0x473828={'raw':!![],'where':{'id':_0x40b04b[_0xbb43('0x2a')]['id']}},_0x539730={};_0x539730['model']=_[_0xbb43('0x2b')](db[_0xbb43('0x2c')][_0xbb43('0x2d')]);_0x539730[_0xbb43('0x2e')]=_['keys'](_0x40b04b[_0xbb43('0x2e')]);_0x539730['filters']=_['intersection'](_0x539730['model'],_0x539730[_0xbb43('0x2e')]);_0x473828['attributes']=_[_0xbb43('0x2f')](_0x539730[_0xbb43('0x30')],qs[_0xbb43('0x31')](_0x40b04b['query'][_0xbb43('0x31')]));_0x473828[_0xbb43('0x32')]=_0x473828[_0xbb43('0x32')][_0xbb43('0x33')]?_0x473828[_0xbb43('0x32')]:_0x539730[_0xbb43('0x30')];if(_0x40b04b[_0xbb43('0x2e')][_0xbb43('0x34')]){_0x473828['include']=[{'all':!![]}];}_0x473828=_[_0xbb43('0x35')]({},_0x473828,_0x40b04b[_0xbb43('0x36')]);return db[_0xbb43('0x2c')][_0xbb43('0x37')](_0x473828)[_0xbb43('0x38')](handleEntityNotFound(_0x21d386,null))[_0xbb43('0x38')](respondWithResult(_0x21d386,null))[_0xbb43('0x39')](handleError(_0x21d386,null));};exports[_0xbb43('0x23')]=function(_0x349a83,_0x57105c){if(_0x349a83[_0xbb43('0x3a')]['id']){delete _0x349a83[_0xbb43('0x3a')]['id'];}return db[_0xbb43('0x2c')][_0xbb43('0x37')]({'where':{'id':_0x349a83[_0xbb43('0x2a')]['id']}})[_0xbb43('0x38')](handleEntityNotFound(_0x57105c,null))['then'](saveUpdates(_0x349a83[_0xbb43('0x3a')],null))[_0xbb43('0x38')](respondWithResult(_0x57105c,null))['catch'](handleError(_0x57105c,null));};exports[_0xbb43('0x24')]=function(_0x2c9a7c,_0x11d384){return db['MailApplication']['find']({'where':{'id':_0x2c9a7c['params']['id']}})[_0xbb43('0x38')](handleEntityNotFound(_0x11d384,null))[_0xbb43('0x38')](removeEntity(_0x11d384,null))['catch'](handleError(_0x11d384,null));}; \ No newline at end of file +var _0xcb91=['send','show','params','keys','rawAttributes','query','intersection','attributes','fields','length','model','includeAll','include','merge','options','MailApplication','find','catch','body','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','error','stack','name'];(function(_0x2a6aa4,_0x34d667){var _0x493362=function(_0x1c00b4){while(--_0x1c00b4){_0x2a6aa4['push'](_0x2a6aa4['shift']());}};_0x493362(++_0x34d667);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x334f9a,_0x542f01){_0x334f9a=_0x334f9a-0x0;var _0x2b219d=_0xcb91[_0x334f9a];return _0x2b219d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1cb9('0x0'));var jsonpatch=require(_0x1cb9('0x1'));var rp=require(_0x1cb9('0x2'));var moment=require(_0x1cb9('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1cb9('0x4'));var util=require(_0x1cb9('0x5'));var path=require('path');var sox=require(_0x1cb9('0x6'));var csv=require(_0x1cb9('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1cb9('0x8'));var _=require(_0x1cb9('0x9'));var squel=require('squel');var crypto=require(_0x1cb9('0xa'));var jsforce=require(_0x1cb9('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1cb9('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1cb9('0xc'));var authService=require(_0x1cb9('0xd'));var qs=require(_0x1cb9('0xe'));var as=require(_0x1cb9('0xf'));var hardwareService=require(_0x1cb9('0x10'));var logger=require('../../config/logger')(_0x1cb9('0x11'));var utils=require(_0x1cb9('0x12'));var config=require(_0x1cb9('0x13'));var licenseUtil=require(_0x1cb9('0x14'));var db=require(_0x1cb9('0x15'))['db'];function respondWithStatusCode(_0x5445e1,_0x5e3c19){_0x5e3c19=_0x5e3c19||0xcc;return function(_0x59dec3){if(_0x59dec3){return _0x5445e1[_0x1cb9('0x16')](_0x5e3c19);}return _0x5445e1[_0x1cb9('0x17')](_0x5e3c19)[_0x1cb9('0x18')]();};}function respondWithResult(_0x1c714f,_0x56884d){_0x56884d=_0x56884d||0xc8;return function(_0x397727){if(_0x397727){return _0x1c714f[_0x1cb9('0x17')](_0x56884d)[_0x1cb9('0x19')](_0x397727);}};}function respondWithFilteredResult(_0x8dfa55,_0x3e2d11){return function(_0x5806d8){if(_0x5806d8){var _0x5572cb=typeof _0x3e2d11[_0x1cb9('0x1a')]===_0x1cb9('0x1b')&&typeof _0x3e2d11[_0x1cb9('0x1c')]===_0x1cb9('0x1b');var _0x3e21e0=_0x5806d8[_0x1cb9('0x1d')];var _0x23d3a9=_0x5572cb?0x0:_0x3e2d11['offset'];var _0x479d43=_0x5572cb?_0x5806d8[_0x1cb9('0x1d')]:_0x3e2d11[_0x1cb9('0x1a')]+_0x3e2d11[_0x1cb9('0x1c')];var _0x31481a;if(_0x479d43>=_0x3e21e0){_0x479d43=_0x3e21e0;_0x31481a=0xc8;}else{_0x31481a=0xce;}_0x8dfa55[_0x1cb9('0x17')](_0x31481a);return _0x8dfa55[_0x1cb9('0x1e')](_0x1cb9('0x1f'),_0x23d3a9+'-'+_0x479d43+'/'+_0x3e21e0)['json'](_0x5806d8);}return null;};}function patchUpdates(_0x559bcc){return function(_0x1a5a72){try{jsonpatch['apply'](_0x1a5a72,_0x559bcc,!![]);}catch(_0x4750b1){return BPromise[_0x1cb9('0x20')](_0x4750b1);}return _0x1a5a72['save']();};}function saveUpdates(_0x599275,_0x2e3854){return function(_0x325637){if(_0x325637){return _0x325637[_0x1cb9('0x21')](_0x599275)[_0x1cb9('0x22')](function(_0x45b8d3){return _0x45b8d3;});}return null;};}function removeEntity(_0x27db16,_0x59ebea){return function(_0x55b232){if(_0x55b232){return _0x55b232[_0x1cb9('0x23')]()['then'](function(){_0x27db16[_0x1cb9('0x17')](0xcc)[_0x1cb9('0x18')]();});}};}function handleEntityNotFound(_0x69b4c8,_0x44d3c4){return function(_0x43a100){if(!_0x43a100){_0x69b4c8['sendStatus'](0x194);}return _0x43a100;};}function handleError(_0x195f16,_0x9df250){_0x9df250=_0x9df250||0x1f4;return function(_0x4c8d76){logger[_0x1cb9('0x24')](_0x4c8d76[_0x1cb9('0x25')]);if(_0x4c8d76[_0x1cb9('0x26')]){delete _0x4c8d76[_0x1cb9('0x26')];}_0x195f16[_0x1cb9('0x17')](_0x9df250)[_0x1cb9('0x27')](_0x4c8d76);};}exports[_0x1cb9('0x28')]=function(_0xb644b3,_0x41e5c2){var _0x9de64b={'raw':!![],'where':{'id':_0xb644b3[_0x1cb9('0x29')]['id']}},_0x48888d={};_0x48888d['model']=_[_0x1cb9('0x2a')](db['MailApplication'][_0x1cb9('0x2b')]);_0x48888d[_0x1cb9('0x2c')]=_[_0x1cb9('0x2a')](_0xb644b3[_0x1cb9('0x2c')]);_0x48888d['filters']=_[_0x1cb9('0x2d')](_0x48888d['model'],_0x48888d[_0x1cb9('0x2c')]);_0x9de64b[_0x1cb9('0x2e')]=_[_0x1cb9('0x2d')](_0x48888d['model'],qs[_0x1cb9('0x2f')](_0xb644b3['query'][_0x1cb9('0x2f')]));_0x9de64b['attributes']=_0x9de64b[_0x1cb9('0x2e')][_0x1cb9('0x30')]?_0x9de64b[_0x1cb9('0x2e')]:_0x48888d[_0x1cb9('0x31')];if(_0xb644b3['query'][_0x1cb9('0x32')]){_0x9de64b[_0x1cb9('0x33')]=[{'all':!![]}];}_0x9de64b=_[_0x1cb9('0x34')]({},_0x9de64b,_0xb644b3[_0x1cb9('0x35')]);return db[_0x1cb9('0x36')][_0x1cb9('0x37')](_0x9de64b)[_0x1cb9('0x22')](handleEntityNotFound(_0x41e5c2,null))[_0x1cb9('0x22')](respondWithResult(_0x41e5c2,null))[_0x1cb9('0x38')](handleError(_0x41e5c2,null));};exports[_0x1cb9('0x21')]=function(_0x294eec,_0x26b950){if(_0x294eec[_0x1cb9('0x39')]['id']){delete _0x294eec['body']['id'];}return db['MailApplication'][_0x1cb9('0x37')]({'where':{'id':_0x294eec[_0x1cb9('0x29')]['id']}})[_0x1cb9('0x22')](handleEntityNotFound(_0x26b950,null))[_0x1cb9('0x22')](saveUpdates(_0x294eec[_0x1cb9('0x39')],null))[_0x1cb9('0x22')](respondWithResult(_0x26b950,null))[_0x1cb9('0x38')](handleError(_0x26b950,null));};exports[_0x1cb9('0x23')]=function(_0x4d3e39,_0x2aa59b){return db[_0x1cb9('0x36')][_0x1cb9('0x37')]({'where':{'id':_0x4d3e39['params']['id']}})[_0x1cb9('0x22')](handleEntityNotFound(_0x2aa59b,null))['then'](removeEntity(_0x2aa59b,null))[_0x1cb9('0x38')](handleError(_0x2aa59b,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index f8092fb..cc1ecc3 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 _0xdb03=['exports','define','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./mailApplication.attributes'];(function(_0x26fe07,_0x5d0f24){var _0x27fbfc=function(_0x23df0c){while(--_0x23df0c){_0x26fe07['push'](_0x26fe07['shift']());}};_0x27fbfc(++_0x5d0f24);}(_0xdb03,0xba));var _0x3db0=function(_0x1558e1,_0x1ea306){_0x1558e1=_0x1558e1-0x0;var _0x4c33d5=_0xdb03[_0x1558e1];return _0x4c33d5;};'use strict';var _=require('lodash');var util=require(_0x3db0('0x0'));var logger=require(_0x3db0('0x1'))(_0x3db0('0x2'));var moment=require(_0x3db0('0x3'));var BPromise=require(_0x3db0('0x4'));var rp=require(_0x3db0('0x5'));var fs=require('fs');var path=require(_0x3db0('0x6'));var rimraf=require(_0x3db0('0x7'));var config=require('../../config/environment');var attributes=require(_0x3db0('0x8'));module[_0x3db0('0x9')]=function(_0x74b89d,_0x36098c){return _0x74b89d[_0x3db0('0xa')](_0x3db0('0xb'),attributes,{'tableName':_0x3db0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3db0('0xd'),'collate':_0x3db0('0xe')});}; \ No newline at end of file +var _0x850a=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','request-promise','path','rimraf','./mailApplication.attributes','exports','define','mail_applications'];(function(_0x25d680,_0x30b44a){var _0x31786d=function(_0x182108){while(--_0x182108){_0x25d680['push'](_0x25d680['shift']());}};_0x31786d(++_0x30b44a);}(_0x850a,0x16e));var _0xa850=function(_0x47a349,_0x4699d9){_0x47a349=_0x47a349-0x0;var _0x18ab75=_0x850a[_0x47a349];return _0x18ab75;};'use strict';var _=require(_0xa850('0x0'));var util=require(_0xa850('0x1'));var logger=require(_0xa850('0x2'))(_0xa850('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa850('0x4'));var fs=require('fs');var path=require(_0xa850('0x5'));var rimraf=require(_0xa850('0x6'));var config=require('../../config/environment');var attributes=require(_0xa850('0x7'));module[_0xa850('0x8')]=function(_0x28faec,_0x43a1e8){return _0x28faec[_0xa850('0x9')]('MailApplication',attributes,{'tableName':_0xa850('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa850('0xb'),'collate':_0xa850('0xc')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 227bae3..c6e61c5 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 _0x57df=['MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateMailApplication','MailApplication','update','body','options','raw','where','attributes','limit','info','stringify','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x50d0dc,_0x23bcb0){var _0x49f2a9=function(_0x58cb36){while(--_0x58cb36){_0x50d0dc['push'](_0x50d0dc['shift']());}};_0x49f2a9(++_0x23bcb0);}(_0x57df,0xd4));var _0xf57d=function(_0x3052f0,_0x1ebfa3){_0x3052f0=_0x3052f0-0x0;var _0x20363a=_0x57df[_0x3052f0];return _0x20363a;};'use strict';var _=require(_0xf57d('0x0'));var util=require('util');var moment=require(_0xf57d('0x1'));var BPromise=require('bluebird');var rs=require(_0xf57d('0x2'));var fs=require('fs');var Redis=require(_0xf57d('0x3'));var db=require(_0xf57d('0x4'))['db'];var utils=require(_0xf57d('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xf57d('0x6'));var jayson=require(_0xf57d('0x7'));var client=jayson[_0xf57d('0x8')][_0xf57d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2c5f7b,_0x204be8,_0x12cf71){return new BPromise(function(_0x59979e,_0x17ce6c){return client[_0xf57d('0xa')](_0x2c5f7b,_0x12cf71)[_0xf57d('0xb')](function(_0x262deb){logger['info'](_0xf57d('0xc'),_0x204be8,_0xf57d('0xd'));logger[_0xf57d('0xe')](_0xf57d('0xf'),_0x204be8,_0xf57d('0xd'),JSON['stringify'](_0x262deb));if(_0x262deb[_0xf57d('0x10')]){if(_0x262deb[_0xf57d('0x10')][_0xf57d('0x11')]===0x1f4){logger[_0xf57d('0x10')](_0xf57d('0xc'),_0x204be8,_0x262deb[_0xf57d('0x10')][_0xf57d('0x12')]);return _0x17ce6c(_0x262deb[_0xf57d('0x10')][_0xf57d('0x12')]);}logger[_0xf57d('0x10')]('MailApplication,\x20%s,\x20%s',_0x204be8,_0x262deb[_0xf57d('0x10')][_0xf57d('0x12')]);return _0x59979e(_0x262deb[_0xf57d('0x10')][_0xf57d('0x12')]);}else{logger['info']('MailApplication,\x20%s,\x20%s',_0x204be8,_0xf57d('0xd'));_0x59979e(_0x262deb[_0xf57d('0x13')][_0xf57d('0x12')]);}})[_0xf57d('0x14')](function(_0x51b6dc){logger['error'](_0xf57d('0xc'),_0x204be8,_0x51b6dc);_0x17ce6c(_0x51b6dc);});});}exports[_0xf57d('0x15')]=function(_0x5971d3){var _0x46a907=this;return new Promise(function(_0x48b714,_0x5cd029){return db[_0xf57d('0x16')][_0xf57d('0x17')](_0x5971d3[_0xf57d('0x18')],{'raw':_0x5971d3['options']?_0x5971d3[_0xf57d('0x19')][_0xf57d('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5971d3[_0xf57d('0x19')]?_0x5971d3[_0xf57d('0x19')][_0xf57d('0x1b')]||null:null,'attributes':_0x5971d3['options']?_0x5971d3[_0xf57d('0x19')][_0xf57d('0x1c')]||null:null,'limit':_0x5971d3['options']?_0x5971d3[_0xf57d('0x19')][_0xf57d('0x1d')]||null:null})[_0xf57d('0xb')](function(_0x396557){logger[_0xf57d('0x1e')](_0xf57d('0x15'),_0x5971d3);logger[_0xf57d('0xe')]('UpdateMailApplication',_0x5971d3,JSON[_0xf57d('0x1f')](_0x396557));_0x48b714(_0x396557);})[_0xf57d('0x14')](function(_0x5e2daf){logger[_0xf57d('0x10')](_0xf57d('0x15'),_0x5e2daf['message'],_0x5971d3);_0x5cd029(_0x46a907[_0xf57d('0x10')](0x1f4,_0x5e2daf[_0xf57d('0x12')]));});});}; \ No newline at end of file +var _0x448e=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','MailApplication,\x20%s,\x20%s','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','UpdateMailApplication','MailApplication','body','options','raw','where','attributes','limit','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x4c26ac,_0x337e6c){var _0x5e25f0=function(_0x4709f9){while(--_0x4709f9){_0x4c26ac['push'](_0x4c26ac['shift']());}};_0x5e25f0(++_0x337e6c);}(_0x448e,0x1a7));var _0xe448=function(_0x5406ab,_0x10ddda){_0x5406ab=_0x5406ab-0x0;var _0x47e633=_0x448e[_0x5406ab];return _0x47e633;};'use strict';var _=require(_0xe448('0x0'));var util=require(_0xe448('0x1'));var moment=require(_0xe448('0x2'));var BPromise=require(_0xe448('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe448('0x4'));var db=require(_0xe448('0x5'))['db'];var utils=require(_0xe448('0x6'));var logger=require(_0xe448('0x7'))(_0xe448('0x8'));var config=require(_0xe448('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xe448('0xa')][_0xe448('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1edefe,_0x58f527,_0x27cb8c){return new BPromise(function(_0x31fa5f,_0x1b53e9){return client[_0xe448('0xc')](_0x1edefe,_0x27cb8c)[_0xe448('0xd')](function(_0x5de48e){logger[_0xe448('0xe')](_0xe448('0xf'),_0x58f527,'request\x20sent');logger['debug'](_0xe448('0x10'),_0x58f527,'request\x20sent',JSON[_0xe448('0x11')](_0x5de48e));if(_0x5de48e[_0xe448('0x12')]){if(_0x5de48e[_0xe448('0x12')][_0xe448('0x13')]===0x1f4){logger[_0xe448('0x12')](_0xe448('0xf'),_0x58f527,_0x5de48e[_0xe448('0x12')][_0xe448('0x14')]);return _0x1b53e9(_0x5de48e['error'][_0xe448('0x14')]);}logger['error'](_0xe448('0xf'),_0x58f527,_0x5de48e[_0xe448('0x12')][_0xe448('0x14')]);return _0x31fa5f(_0x5de48e[_0xe448('0x12')]['message']);}else{logger[_0xe448('0xe')](_0xe448('0xf'),_0x58f527,_0xe448('0x15'));_0x31fa5f(_0x5de48e[_0xe448('0x16')][_0xe448('0x14')]);}})[_0xe448('0x17')](function(_0x2a9cb8){logger[_0xe448('0x12')]('MailApplication,\x20%s,\x20%s',_0x58f527,_0x2a9cb8);_0x1b53e9(_0x2a9cb8);});});}exports[_0xe448('0x18')]=function(_0x12bfe2){var _0x1c57de=this;return new Promise(function(_0x489ed6,_0x2fb873){return db[_0xe448('0x19')]['update'](_0x12bfe2[_0xe448('0x1a')],{'raw':_0x12bfe2[_0xe448('0x1b')]?_0x12bfe2[_0xe448('0x1b')][_0xe448('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x12bfe2[_0xe448('0x1b')]?_0x12bfe2['options'][_0xe448('0x1d')]||null:null,'attributes':_0x12bfe2[_0xe448('0x1b')]?_0x12bfe2[_0xe448('0x1b')][_0xe448('0x1e')]||null:null,'limit':_0x12bfe2[_0xe448('0x1b')]?_0x12bfe2['options'][_0xe448('0x1f')]||null:null})[_0xe448('0xd')](function(_0x106bc0){logger[_0xe448('0xe')]('UpdateMailApplication',_0x12bfe2);logger[_0xe448('0x20')](_0xe448('0x18'),_0x12bfe2,JSON[_0xe448('0x11')](_0x106bc0));_0x489ed6(_0x106bc0);})[_0xe448('0x17')](function(_0x2a85e0){logger[_0xe448('0x12')](_0xe448('0x18'),_0x2a85e0[_0xe448('0x14')],_0x12bfe2);_0x2fb873(_0x1c57de[_0xe448('0x12')](0x1f4,_0x2a85e0['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 0f42f9c..5d2fff3 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 _0x74dd=['exports','express','Router','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','describe','/:id/messages','getMessages','/:id/download','download','post','addMessage','/:id/tags','tracked','mail','mailinteraction:addtags','put','mailinteraction:update','update','delete','/:id','mailinteraction:destroy','destroy'];(function(_0x19c61a,_0x54161a){var _0x57378e=function(_0x3ec8b0){while(--_0x3ec8b0){_0x19c61a['push'](_0x19c61a['shift']());}};_0x57378e(++_0x54161a);}(_0x74dd,0x9d));var _0xd74d=function(_0x4756d5,_0x20560a){_0x4756d5=_0x4756d5-0x0;var _0xf834a8=_0x74dd[_0x4756d5];return _0xf834a8;};'use strict';var express=require(_0xd74d('0x0'));var router=express[_0xd74d('0x1')]();var auth=require(_0xd74d('0x2'));var interaction=require(_0xd74d('0x3'));var controller=require('./mailInteraction.controller');router['get']('/',auth[_0xd74d('0x4')](),controller[_0xd74d('0x5')]);router[_0xd74d('0x6')]('/describe',auth[_0xd74d('0x4')](),controller[_0xd74d('0x7')]);router[_0xd74d('0x6')]('/:id',auth[_0xd74d('0x4')](),controller['show']);router['get'](_0xd74d('0x8'),auth[_0xd74d('0x4')](),controller[_0xd74d('0x9')]);router[_0xd74d('0x6')](_0xd74d('0xa'),auth[_0xd74d('0x4')](),controller[_0xd74d('0xb')]);router[_0xd74d('0xc')]('/',auth[_0xd74d('0x4')](),controller['create']);router['post'](_0xd74d('0x8'),auth['isAuthenticated'](),controller[_0xd74d('0xd')]);router[_0xd74d('0xc')](_0xd74d('0xe'),auth[_0xd74d('0x4')](),interaction[_0xd74d('0xf')](_0xd74d('0x10'),_0xd74d('0x11')),controller['addTags']);router[_0xd74d('0x12')]('/:id',auth[_0xd74d('0x4')](),interaction[_0xd74d('0xf')](_0xd74d('0x10'),_0xd74d('0x13')),controller[_0xd74d('0x14')]);router[_0xd74d('0x15')](_0xd74d('0x16'),auth[_0xd74d('0x4')](),interaction['tracked'](_0xd74d('0x10'),_0xd74d('0x17')),controller[_0xd74d('0x18')]);router[_0xd74d('0x15')](_0xd74d('0xe'),auth['isAuthenticated'](),controller['removeTags']);module[_0xd74d('0x19')]=router; \ No newline at end of file +var _0x92e0=['removeTags','exports','express','Router','../../components/auth/service','./mailInteraction.controller','isAuthenticated','index','get','/describe','describe','/:id','show','getMessages','/:id/download','download','post','create','/:id/messages','addMessage','tracked','mail','addTags','put','update','delete','destroy','/:id/tags'];(function(_0x2edd9a,_0x2e76a0){var _0x465071=function(_0x48bb2e){while(--_0x48bb2e){_0x2edd9a['push'](_0x2edd9a['shift']());}};_0x465071(++_0x2e76a0);}(_0x92e0,0xaa));var _0x092e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x92e0[_0x3dd15e];return _0x231fd0;};'use strict';var express=require(_0x092e('0x0'));var router=express[_0x092e('0x1')]();var auth=require(_0x092e('0x2'));var interaction=require('../../components/interaction/service');var controller=require(_0x092e('0x3'));router['get']('/',auth[_0x092e('0x4')](),controller[_0x092e('0x5')]);router[_0x092e('0x6')](_0x092e('0x7'),auth['isAuthenticated'](),controller[_0x092e('0x8')]);router[_0x092e('0x6')](_0x092e('0x9'),auth[_0x092e('0x4')](),controller[_0x092e('0xa')]);router[_0x092e('0x6')]('/:id/messages',auth[_0x092e('0x4')](),controller[_0x092e('0xb')]);router[_0x092e('0x6')](_0x092e('0xc'),auth[_0x092e('0x4')](),controller[_0x092e('0xd')]);router[_0x092e('0xe')]('/',auth['isAuthenticated'](),controller[_0x092e('0xf')]);router[_0x092e('0xe')](_0x092e('0x10'),auth['isAuthenticated'](),controller[_0x092e('0x11')]);router['post']('/:id/tags',auth[_0x092e('0x4')](),interaction[_0x092e('0x12')](_0x092e('0x13'),'mailinteraction:addtags'),controller[_0x092e('0x14')]);router[_0x092e('0x15')]('/:id',auth['isAuthenticated'](),interaction[_0x092e('0x12')](_0x092e('0x13'),'mailinteraction:update'),controller[_0x092e('0x16')]);router[_0x092e('0x17')](_0x092e('0x9'),auth['isAuthenticated'](),interaction[_0x092e('0x12')](_0x092e('0x13'),'mailinteraction:destroy'),controller[_0x092e('0x18')]);router['delete'](_0x092e('0x19'),auth[_0x092e('0x4')](),controller[_0x092e('0x1a')]);module[_0x092e('0x1b')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 55bbc8a..2507f7e 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 _0x802c=['STRING','TEXT','long','BOOLEAN','DATE','ENUM','out','sequelize','iconv','exports'];(function(_0x10a7da,_0x1c4002){var _0x5c13cb=function(_0x551eb1){while(--_0x551eb1){_0x10a7da['push'](_0x10a7da['shift']());}};_0x5c13cb(++_0x1c4002);}(_0x802c,0x1dd));var _0xc802=function(_0x4ea55b,_0x4e69a2){_0x4ea55b=_0x4ea55b-0x0;var _0x43bfef=_0x802c[_0x4ea55b];return _0x43bfef;};'use strict';var Sequelize=require(_0xc802('0x0'));var iconv=require(_0xc802('0x1'));module[_0xc802('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xc802('0x3')]},'secondDisposition':{'type':Sequelize[_0xc802('0x3')]},'thirdDisposition':{'type':Sequelize[_0xc802('0x3')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0xc802('0x3')](0x1fe)},'to':{'type':Sequelize[_0xc802('0x3')]},'cc':{'type':Sequelize[_0xc802('0x4')](_0xc802('0x5'))},'subject':{'type':Sequelize[_0xc802('0x4')]()},'attach':{'type':Sequelize[_0xc802('0x6')],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize[_0xc802('0x3')](0x3c)},'substatusAt':{'type':Sequelize[_0xc802('0x7')]},'firstMsgDirection':{'type':Sequelize[_0xc802('0x8')]('in',_0xc802('0x9')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xc802('0x7')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xc802('0x9')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x2a68=['BOOLEAN','STRING','long','DATE','ENUM','out','sequelize','iconv'];(function(_0x1ced4b,_0x3f32be){var _0x38120e=function(_0x41d4a5){while(--_0x41d4a5){_0x1ced4b['push'](_0x1ced4b['shift']());}};_0x38120e(++_0x3f32be);}(_0x2a68,0x8e));var _0x82a6=function(_0x352dc1,_0x18af1e){_0x352dc1=_0x352dc1-0x0;var _0x581c3f=_0x2a68[_0x352dc1];return _0x581c3f;};'use strict';var Sequelize=require(_0x82a6('0x0'));var iconv=require(_0x82a6('0x1'));module['exports']={'closed':{'type':Sequelize[_0x82a6('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x82a6('0x3')]},'secondDisposition':{'type':Sequelize[_0x82a6('0x3')]},'thirdDisposition':{'type':Sequelize[_0x82a6('0x3')]},'note':{'type':Sequelize[_0x82a6('0x3')]},'inReplyTo':{'type':Sequelize[_0x82a6('0x3')](0x1fe)},'to':{'type':Sequelize[_0x82a6('0x3')]},'cc':{'type':Sequelize['TEXT'](_0x82a6('0x4'))},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x82a6('0x5')]},'substatus':{'type':Sequelize[_0x82a6('0x3')](0x3c)},'substatusAt':{'type':Sequelize[_0x82a6('0x5')]},'firstMsgDirection':{'type':Sequelize[_0x82a6('0x6')]('in',_0x82a6('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x82a6('0x5')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x82a6('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x82a6('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 9b63b3b..8d4c38a 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 _0x6bac=['transcript-%d-%s.zip','Attachment','Attachments','bcc','subject','Messages','get','mkdirSync','each','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','attachments','readFileSync','build','message%d.eml','download','unlinkSync','eml-format','rimraf','moment','util','path','lodash','squel','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','redis','localhost','./mailInteraction.socket','register','status','end','offset','undefined','limit','count','json','update','destroy','then','name','Users','fullname','TagIds','split','forEach','Tags','push','findOne','out','-id','plainBody','lastMsgText','trimStart','catch','talking','answered','total','UserId','waiting','closed','unmanaged','MailInteraction','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','field','from','u.id','ui.MailInteractionId','user_has_mail_interactions','left_join','u.id\x20=\x20ui.UserId','cm_contacts','o.id\x20=\x20i.UserId','mail_accounts','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','sqlOperator','conditions','unreadMessages','value','having','`\x20=\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','buildExpression','keys','some','compact','isEmpty','MailAccountId','where','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','isEmail','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.id','QueryTypes','SELECT','order','contactName','DESC','resolve','i.MailAccountId\x20IS\x20NOT\x20NULL','user','role','agent','i.MailAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.createdAt','i.closed','i.closedAt','i.lastMsgAt','i.lastMsgDirection','i.disposition','i.secondDisposition','i.thirdDisposition','i.substatus','i.to','i.UserId','Contact.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','Setting','enableEmailPreview','rows','show','includeAll','include','create','body','params','describe','addMessage','MailMessage','ids','omit','getMessages','MailInteractionId','format','inlineCss','addTags','spread','findAll','color','mailInteractionTags:save','removeTags','unix','server','join','root','files'];(function(_0x9b46b9,_0x3f6df3){var _0x898d24=function(_0x2d9e48){while(--_0x2d9e48){_0x9b46b9['push'](_0x9b46b9['shift']());}};_0x898d24(++_0x3f6df3);}(_0x6bac,0xf1));var _0xc6ba=function(_0x5a8351,_0x39a736){_0x5a8351=_0x5a8351-0x0;var _0x5166ba=_0x6bac[_0x5a8351];return _0x5166ba;};'use strict';var emlformat=require(_0xc6ba('0x0'));var rimraf=require(_0xc6ba('0x1'));var zipdir=require('zip-dir');var moment=require(_0xc6ba('0x2'));var BPromise=require('bluebird');var util=require(_0xc6ba('0x3'));var path=require(_0xc6ba('0x4'));var fs=require('fs');var _=require(_0xc6ba('0x5'));var squel=require(_0xc6ba('0x6'));var juice=require('juice');var Redis=require(_0xc6ba('0x7'));var qs=require(_0xc6ba('0x8'));var as=require(_0xc6ba('0x9'));var logger=require('../../config/logger')(_0xc6ba('0xa'));var config=require(_0xc6ba('0xb'));var db=require('../../mysqldb')['db'];var htmlEntities=require('html-entities');config[_0xc6ba('0xc')]=_['defaults'](config[_0xc6ba('0xc')],{'host':_0xc6ba('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xc6ba('0xe'))[_0xc6ba('0xf')](socket);function respondWithStatusCode(_0x4ca215,_0x209eb0){_0x209eb0=_0x209eb0||0xcc;return function(_0x562e5b){if(_0x562e5b){return _0x4ca215['sendStatus'](_0x209eb0);}return _0x4ca215[_0xc6ba('0x10')](_0x209eb0)[_0xc6ba('0x11')]();};}function respondWithResult(_0x23f232,_0x294479){_0x294479=_0x294479||0xc8;return function(_0x2450d9){if(_0x2450d9){return _0x23f232[_0xc6ba('0x10')](_0x294479)['json'](_0x2450d9);}};}function respondWithFilteredResult(_0x1790d1,_0x85f881){return function(_0x42da5f){if(_0x42da5f){var _0x3262f2=typeof _0x85f881[_0xc6ba('0x12')]===_0xc6ba('0x13')&&typeof _0x85f881[_0xc6ba('0x14')]===_0xc6ba('0x13');var _0x77c71d=_0x42da5f['count'];var _0x173a66=_0x3262f2?0x0:_0x85f881[_0xc6ba('0x12')];var _0x52b308=_0x3262f2?_0x42da5f[_0xc6ba('0x15')]:_0x85f881[_0xc6ba('0x12')]+_0x85f881[_0xc6ba('0x14')];var _0x173e31;if(_0x52b308>=_0x77c71d){_0x52b308=_0x77c71d;_0x173e31=0xc8;}else{_0x173e31=0xce;}_0x1790d1['status'](_0x173e31);return _0x1790d1['set']('Content-Range',_0x173a66+'-'+_0x52b308+'/'+_0x77c71d)[_0xc6ba('0x16')](_0x42da5f);}return null;};}function saveUpdates(_0x2e9a96){return function(_0x2bd237){if(_0x2bd237){return _0x2bd237[_0xc6ba('0x17')](_0x2e9a96)['then'](function(_0x2f4cfd){return _0x2f4cfd;});}return null;};}function removeEntity(_0x576f8a){return function(_0x102f54){if(_0x102f54){return _0x102f54[_0xc6ba('0x18')]()[_0xc6ba('0x19')](function(){_0x576f8a[_0xc6ba('0x10')](0xcc)[_0xc6ba('0x11')]();});}};}function handleEntityNotFound(_0x527658){return function(_0x4c2a84){if(!_0x4c2a84){_0x527658['sendStatus'](0x194);}return _0x4c2a84;};}function handleError(_0x3a65dc,_0x5567fe){_0x5567fe=_0x5567fe||0x1f4;return function(_0x1bbb7a){logger['error'](_0x1bbb7a['stack']);if(_0x1bbb7a[_0xc6ba('0x1a')]){delete _0x1bbb7a[_0xc6ba('0x1a')];}_0x3a65dc[_0xc6ba('0x10')](_0x5567fe)['send'](_0x1bbb7a);};}function getInteractionUsers(_0x4d68f0,_0xbd14c7){return new BPromise(function(_0x2c61bc,_0x2ba99e){try{if(_0xbd14c7[_0x4d68f0['id']]){_0x4d68f0[_0xc6ba('0x1b')]=_['map'](_0xbd14c7[_0x4d68f0['id']],function(_0x4eb951){return{'id':_0x4eb951['id'],'fullname':_0x4eb951[_0xc6ba('0x1c')]};});}}catch(_0x4b2157){_0x2ba99e(_0x4b2157);}_0x2c61bc(_0x4d68f0);});}function getInteractionTags(_0xd30dce,_0x26ed02){return new BPromise(function(_0x459033,_0x4ee003){try{if(_0xd30dce[_0xc6ba('0x1d')]){_0xd30dce['Tags']=[];_0xd30dce[_0xc6ba('0x1d')][_0xc6ba('0x1e')](',')[_0xc6ba('0x1f')](function(_0x98e6d2){_0xd30dce[_0xc6ba('0x20')][_0xc6ba('0x21')](_0x26ed02[_0x98e6d2]);});}delete _0xd30dce[_0xc6ba('0x1d')];}catch(_0xc952da){_0x4ee003(_0xc952da);}_0x459033(_0xd30dce);});}function getLastMessageText(_0x3916d9){return new BPromise(function(_0x569329,_0x55c737){return db['MailMessage'][_0xc6ba('0x22')]({'where':{'$and':[{'MailInteractionId':_0x3916d9['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0xc6ba('0x23')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0xc6ba('0x24'),'raw':!![]})[_0xc6ba('0x19')](function(_0x2460c4){if(_0x2460c4&&_0x2460c4[_0xc6ba('0x25')]){_0x3916d9[_0xc6ba('0x26')]=_[_0xc6ba('0x27')](_0x2460c4[_0xc6ba('0x25')]);}_0x569329(_0x3916d9);})[_0xc6ba('0x28')](function(_0x20665c){_0x55c737(_0x20665c);});});}function updateMailInteraction(_0x274cd4,_0x2c55c3,_0x152e90,_0x29538c){return new BPromise(function(_0x5d9282,_0x1c0b68){return getInteractionUsers(_0x274cd4,_0x152e90)[_0xc6ba('0x19')](function(_0x2431f9){return getInteractionTags(_0x2431f9,_0x2c55c3);})[_0xc6ba('0x19')](function(_0x438b59){return getStateInteraction(_0x438b59);})['then'](function(_0x4ed8af){if(_0x29538c){_0x5d9282(getLastMessageText(_0x4ed8af));}else{_0x5d9282(_0x4ed8af);}})['catch'](function(_0x2939c1){_0x1c0b68(_0x2939c1);});});}function getStateInteraction(_0x198de6){return new BPromise(function(_0x8bc3b5){_0x198de6['waiting']=0x0;_0x198de6[_0xc6ba('0x29')]=0x0;_0x198de6[_0xc6ba('0x2a')]=0x0;_0x198de6['unmanaged']=0x0;_0x198de6[_0xc6ba('0x2b')]=0x0;if(!_0x198de6['closed']&&!_0x198de6[_0xc6ba('0x2c')]){_0x198de6[_0xc6ba('0x2d')]+=0x1;}if(!_0x198de6[_0xc6ba('0x2e')]&&_0x198de6['UserId']){_0x198de6[_0xc6ba('0x29')]+=0x1;if(_0x198de6[_0xc6ba('0x2d')]){_0x198de6['waiting']-=0x1;}}if(_0x198de6['closed']&&_0x198de6[_0xc6ba('0x2c')]){_0x198de6['answered']+=0x1;if(_0x198de6[_0xc6ba('0x29')]){_0x198de6[_0xc6ba('0x29')]-=0x1;}}if(_0x198de6[_0xc6ba('0x2e')]&&!_0x198de6['UserId']){_0x198de6[_0xc6ba('0x2f')]+=0x1;if(_0x198de6['waiting']){_0x198de6[_0xc6ba('0x2d')]-=0x1;}}_0x198de6[_0xc6ba('0x2b')]+=0x1;_0x8bc3b5(_0x198de6);});}exports['index']=function(_0x46d01f,_0x29ef15){var _0x4cce75={},_0x19dfe4={},_0x1d5f65={'count':0x0,'rows':[]};var _0x52077c=_['map'](db[_0xc6ba('0x30')][_0xc6ba('0x31')],function(_0x3b23af){return{'name':_0x3b23af[_0xc6ba('0x32')],'type':_0x3b23af[_0xc6ba('0x33')][_0xc6ba('0x34')]};});_0x19dfe4[_0xc6ba('0x35')]=_[_0xc6ba('0x36')](_0x52077c,_0xc6ba('0x1a'));_0x19dfe4[_0xc6ba('0x37')]=_['keys'](_0x46d01f[_0xc6ba('0x37')]);_0x19dfe4[_0xc6ba('0x38')]=_['intersection'](_0x19dfe4[_0xc6ba('0x35')],_0x19dfe4[_0xc6ba('0x37')]);_0x4cce75[_0xc6ba('0x39')]=_[_0xc6ba('0x3a')](_0x19dfe4['model'],qs[_0xc6ba('0x3b')](_0x46d01f[_0xc6ba('0x37')][_0xc6ba('0x3b')]));_0x4cce75[_0xc6ba('0x39')]=_0x4cce75['attributes'][_0xc6ba('0x3c')]?_0x4cce75[_0xc6ba('0x39')]:_0x19dfe4[_0xc6ba('0x35')];if(!_0x46d01f[_0xc6ba('0x37')][_0xc6ba('0x3d')](_0xc6ba('0x3e'))){_0x4cce75[_0xc6ba('0x14')]=qs[_0xc6ba('0x14')](_0x46d01f['query'][_0xc6ba('0x14')]);_0x4cce75['offset']=qs[_0xc6ba('0x12')](_0x46d01f[_0xc6ba('0x37')][_0xc6ba('0x12')]);}_0x4cce75['order']=qs[_0xc6ba('0x3f')](_0x46d01f[_0xc6ba('0x37')][_0xc6ba('0x3f')]);_0x4cce75['where']=qs[_0xc6ba('0x38')](_[_0xc6ba('0x40')](_0x46d01f['query'],_0x19dfe4[_0xc6ba('0x38')]),_0x52077c);var _0x44d20f=[];var _0x47c7fd=squel['select']()[_0xc6ba('0x41')]('id')[_0xc6ba('0x41')]('name')[_0xc6ba('0x41')]('color')[_0xc6ba('0x42')]('tools_tags');var _0x3120d8=squel['select']()[_0xc6ba('0x41')](_0xc6ba('0x43'))[_0xc6ba('0x41')]('u.fullname')[_0xc6ba('0x41')](_0xc6ba('0x44'))[_0xc6ba('0x42')](_0xc6ba('0x45'),'ui')[_0xc6ba('0x46')]('users','u',_0xc6ba('0x47'));var _0x45c567=squel['select']()[_0xc6ba('0x42')]('mail_interactions','i')[_0xc6ba('0x46')](_0xc6ba('0x48'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xc6ba('0x46')]('users','o',_0xc6ba('0x49'))[_0xc6ba('0x46')](_0xc6ba('0x4a'),'a',_0xc6ba('0x4b'))[_0xc6ba('0x46')](_0xc6ba('0x4c'),'me',_0xc6ba('0x4d'))[_0xc6ba('0x46')](_0xc6ba('0x4e'),'it',_0xc6ba('0x4f'))[_0xc6ba('0x46')]('tools_tags','t',_0xc6ba('0x50'));var _0x2a0d8b=squel[_0xc6ba('0x51')]();var _0x11cf9b=[];var _0x5f771e=squel[_0xc6ba('0x51')]();var _0x4dcf7e;if(_0x46d01f[_0xc6ba('0x37')]['search']){_0x4dcf7e=as['parseSearch'](_0x46d01f[_0xc6ba('0x37')]['search']);var _0x4211f3=_0x4dcf7e[_0xc6ba('0x52')];for(var _0x12a5e7=0x0;_0x12a5e7<_0x4dcf7e[_0xc6ba('0x53')]['length'];_0x12a5e7++){var _0x559d37=_0x4dcf7e[_0xc6ba('0x53')][_0x12a5e7];var _0x48ab9b='i';var _0x53864d=_['find'](_0x52077c,[_0xc6ba('0x1a'),_0x559d37[_0xc6ba('0x41')]]);if(!_0x53864d){switch(_0x559d37[_0xc6ba('0x41')]){case _0xc6ba('0x54'):if(_0x559d37[_0xc6ba('0x55')]==0x1){_0x45c567[_0xc6ba('0x56')]('`'+_0x559d37[_0xc6ba('0x41')]+_0xc6ba('0x57'));}else{_0x45c567[_0xc6ba('0x56')]('`'+_0x559d37[_0xc6ba('0x41')]+'`\x20>\x200');}break;case _0xc6ba('0x58'):if(_0x559d37[_0xc6ba('0x59')]===_0xc6ba('0x5a')){if(_0x559d37[_0xc6ba('0x55')]['split']('\x20')['length']>0x1){_0x2a0d8b[_0x4211f3](_0xc6ba('0x5b'),qs[_0xc6ba('0x5c')](_0x559d37[_0xc6ba('0x55')]),null);}else{var _0x450a32='%'+_0x559d37[_0xc6ba('0x55')]+'%';_0x2a0d8b[_0x4211f3](_0xc6ba('0x5d'),_0x450a32,_0x450a32,_0x450a32);}}else{_0x53864d=_[_0xc6ba('0x5e')](_0x52077c,['name',_0xc6ba('0x5f')]);_0x559d37['field']=_0xc6ba('0x5f');_0x37f009=as['buildExpression'](_0x48ab9b,_0x53864d[_0xc6ba('0x33')],_0x559d37);_0x2a0d8b[_0x4211f3](_0x37f009[_0xc6ba('0x60')],_0x37f009[_0xc6ba('0x55')][_0xc6ba('0x61')],_0x37f009[_0xc6ba('0x55')][_0xc6ba('0x11')]);}break;case _0xc6ba('0x62'):var _0x5a94b0=_0x559d37[_0xc6ba('0x55')]['split'](',')['map'](function(_0x198da4){return Number(_0x198da4);});_0x5a94b0[_0xc6ba('0x1f')](function(_0x1684ae){_0x5f771e['or'](_0xc6ba('0x63'),'%,'+_0x1684ae+',%');});_0x11cf9b=_[_0xc6ba('0x64')](_0x11cf9b,_0x5a94b0);break;case _0xc6ba('0x65'):if(_0x559d37[_0xc6ba('0x59')]==='$substring'){_0x2a0d8b[_0x4211f3]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x559d37['value']+'%',null);}else{_0x53864d=_['find'](_0x52077c,[_0xc6ba('0x1a'),_0xc6ba('0x2c')]);_0x559d37['field']='UserId';_0x37f009=as[_0xc6ba('0x66')](_0x48ab9b,_0x53864d[_0xc6ba('0x33')],_0x559d37);_0x2a0d8b[_0x4211f3](_0x37f009[_0xc6ba('0x60')],_0x37f009['value'][_0xc6ba('0x61')],_0x37f009[_0xc6ba('0x55')][_0xc6ba('0x11')]);}break;case _0xc6ba('0x25'):_0x37f009=as['buildExpression']('me',null,_0x559d37);_0x2a0d8b[_0x4211f3](_0x37f009[_0xc6ba('0x60')],_0x37f009[_0xc6ba('0x55')][_0xc6ba('0x61')],_0x37f009['value'][_0xc6ba('0x11')]);break;}}else{var _0x37f009=as[_0xc6ba('0x66')](_0x48ab9b,_0x53864d['type'],_0x559d37);_0x2a0d8b[_0x4211f3](_0x37f009['text'],_0x37f009[_0xc6ba('0x55')]['start'],_0x37f009[_0xc6ba('0x55')][_0xc6ba('0x11')]);}}}else{var _0xaaa750=_(_0x46d01f[_0xc6ba('0x37')])[_0xc6ba('0x67')]()[_0xc6ba('0x36')](function(_0x41610c){return _[_0xc6ba('0x68')](_0x52077c,['name',_0x41610c])?_0x41610c:undefined;})[_0xc6ba('0x69')]()[_0xc6ba('0x55')]();if(!_[_0xc6ba('0x6a')](_0xaaa750)){_0xaaa750[_0xc6ba('0x1f')](function(_0x3e08e9){if(_0x3e08e9===_0xc6ba('0x6b')){_0x45c567[_0xc6ba('0x6c')](_0xc6ba('0x6d'),[][_0xc6ba('0x6e')](_0x46d01f[_0xc6ba('0x37')][_0x3e08e9]));}else if(_0x3e08e9===_0xc6ba('0x6f')){var _0x5cc819=JSON[_0xc6ba('0x70')](_0x46d01f[_0xc6ba('0x37')][_0x3e08e9])[_0xc6ba('0x71')];var _0x230a74=JSON['parse'](_0x46d01f[_0xc6ba('0x37')][_0x3e08e9])[_0xc6ba('0x72')];_0x45c567[_0xc6ba('0x6c')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x5cc819,_0x230a74);}else{if(_0x46d01f[_0xc6ba('0x37')][_0x3e08e9]===_0xc6ba('0x73')){_0x45c567['where']('i.'+_0x3e08e9+_0xc6ba('0x74'));}else{_0x45c567[_0xc6ba('0x6c')]('i.'+_0x3e08e9+_0xc6ba('0x75'),_0x46d01f[_0xc6ba('0x37')][_0x3e08e9]);}}});}if(_0x46d01f[_0xc6ba('0x37')][_0xc6ba('0x76')]){if(_0x46d01f[_0xc6ba('0x37')][_0xc6ba('0x76')]==0x1){_0x45c567[_0xc6ba('0x56')](_0xc6ba('0x77'));}else{_0x45c567[_0xc6ba('0x56')](_0xc6ba('0x78'));}}if(_0x46d01f['query'][_0xc6ba('0x79')]){_0x11cf9b=_[_0xc6ba('0x7a')](_0x46d01f[_0xc6ba('0x37')]['tag'])?_0x46d01f[_0xc6ba('0x37')]['tag']:new Array(_0x46d01f[_0xc6ba('0x37')][_0xc6ba('0x79')]);_0x11cf9b[_0xc6ba('0x1f')](function(_0x315a28){_0x5f771e['or'](_0xc6ba('0x63'),'%,'+_0x315a28+',%');});}if(_0x46d01f[_0xc6ba('0x37')]['filter']){var _0x3c2b8d=_0x46d01f[_0xc6ba('0x37')][_0xc6ba('0x7b')][_0xc6ba('0x7c')]('\x5c','\x5c\x5c')[_0xc6ba('0x7c')](/'/g,'\x27\x27');if(qs[_0xc6ba('0x7d')](_0x3c2b8d)){_0x2a0d8b['or']('i.id\x20LIKE\x20?',_0x3c2b8d+'%');}else if(qs[_0xc6ba('0x7e')](_0x3c2b8d)){_0x2a0d8b['or']('c.email\x20LIKE\x20?',_0x3c2b8d+'%');}else{_0x2a0d8b['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xc6ba('0x5c')](_0x3c2b8d))['or'](_0xc6ba('0x7f'),qs[_0xc6ba('0x5c')](_0x3c2b8d));}}}_0x45c567['where'](_0x2a0d8b);_0x45c567['group'](_0xc6ba('0x80'));var _0x1a373e={'type':db['Sequelize'][_0xc6ba('0x81')][_0xc6ba('0x82')],'raw':!![]};var _0x35a119=_0x45c567['clone']();_0x35a119[_0xc6ba('0x41')](_0xc6ba('0x80'));_0x35a119['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xc6ba('0x54'));if(_0x4cce75[_0xc6ba('0x83')]){_0x4cce75['order'][_0xc6ba('0x1f')](function(_0x1248c5){var _0x5b7597=_0x1248c5[0x0]===_0xc6ba('0x84')?_0x1248c5[0x0]:'i.'+_0x1248c5[0x0];_0x45c567[_0xc6ba('0x83')](_0x5b7597,_0x1248c5[0x1]===_0xc6ba('0x85')?![]:!![]);});}if(!_['isEmpty'](_0x11cf9b)){_0x45c567['having'](_0x5f771e);_0x35a119['where']('t.id\x20IN\x20?',_0x11cf9b);}BPromise[_0xc6ba('0x86')]()[_0xc6ba('0x19')](function(){if(!_0x4dcf7e){if(_0x46d01f['query']['MailAccountId'])return;_0x35a119['where']('i.MailAccountId\x20IS\x20NOT\x20NULL');_0x45c567[_0xc6ba('0x6c')](_0xc6ba('0x87'));return;}if(_0x46d01f[_0xc6ba('0x88')][_0xc6ba('0x89')]!==_0xc6ba('0x8a'))return;return _0x46d01f[_0xc6ba('0x88')]['getMailAccounts']({'attributes':['id'],'raw':!![]})[_0xc6ba('0x19')](function(_0x4fd40f){if(_[_0xc6ba('0x6a')](_0x4fd40f)){_0x35a119[_0xc6ba('0x6c')](_0xc6ba('0x8b'));_0x45c567[_0xc6ba('0x6c')]('i.MailAccountId\x20IS\x20NULL');}else{_0x35a119['where'](_0xc6ba('0x6d'),_[_0xc6ba('0x36')](_0x4fd40f,'id'));_0x45c567[_0xc6ba('0x6c')](_0xc6ba('0x6d'),_[_0xc6ba('0x36')](_0x4fd40f,'id'));}});})[_0xc6ba('0x19')](function(){if(_0x46d01f[_0xc6ba('0x88')][_0xc6ba('0x89')]===_0xc6ba('0x8a')&&!_0x4dcf7e&&!_0x46d01f[_0xc6ba('0x37')]['MailAccountId'])return[];return db['sequelize']['query'](_0x35a119['toString'](),_0x1a373e);})[_0xc6ba('0x19')](function(_0x342a85){_0x1d5f65['count']=_0x342a85[_0xc6ba('0x3c')];if(_0x1d5f65['count']===0x0)return[];return db[_0xc6ba('0x8c')][_0xc6ba('0x37')](_0x47c7fd[_0xc6ba('0x8d')](),_0x1a373e)['then'](function(_0x11952b){_0x44d20f=_[_0xc6ba('0x8e')](_0x11952b,'id');_0x1a373e=_[_0xc6ba('0x8f')](_0x1a373e,{'model':db[_0xc6ba('0x30')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x46d01f['query'][_0xc6ba('0x3b')]){_0x4cce75['attributes'][_0xc6ba('0x1f')](function(_0x3011f6){_0x45c567[_0xc6ba('0x41')]('i.'+_0x3011f6);});}else{_0x45c567['field'](_0xc6ba('0x90'),_0xc6ba('0x54'));_0x45c567[_0xc6ba('0x41')](_0xc6ba('0x91'),'Account.key');_0x45c567[_0xc6ba('0x41')](_0xc6ba('0x92'),_0xc6ba('0x93'));_0x45c567[_0xc6ba('0x41')]('CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName');_0x45c567[_0xc6ba('0x41')]('i.id');_0x45c567['field'](_0xc6ba('0x94'));_0x45c567['field']('i.updatedAt');_0x45c567['field'](_0xc6ba('0x95'));_0x45c567[_0xc6ba('0x41')](_0xc6ba('0x96'));_0x45c567['field']('i.attach');_0x45c567[_0xc6ba('0x41')](_0xc6ba('0x97'));_0x45c567[_0xc6ba('0x41')](_0xc6ba('0x98'));_0x45c567[_0xc6ba('0x41')]('i.subject');_0x45c567[_0xc6ba('0x41')](_0xc6ba('0x99'));_0x45c567[_0xc6ba('0x41')](_0xc6ba('0x9a'));_0x45c567[_0xc6ba('0x41')](_0xc6ba('0x9b'));_0x45c567[_0xc6ba('0x41')](_0xc6ba('0x9c'));_0x45c567[_0xc6ba('0x41')](_0xc6ba('0x9d'));_0x45c567[_0xc6ba('0x41')]('i.ContactId');_0x45c567[_0xc6ba('0x41')]('i.MailAccountId');_0x45c567['field'](_0xc6ba('0x9e'));_0x45c567[_0xc6ba('0x41')]('c.firstName',_0xc6ba('0x9f'));_0x45c567['field'](_0xc6ba('0xa0'),_0xc6ba('0xa1'));_0x45c567[_0xc6ba('0x41')]('c.email',_0xc6ba('0xa2'));_0x45c567[_0xc6ba('0x41')](_0xc6ba('0xa3'),_0xc6ba('0xa4'));_0x45c567[_0xc6ba('0x41')](_0xc6ba('0xa5'),_0xc6ba('0xa6'));_0x45c567[_0xc6ba('0x41')](_0xc6ba('0xa7'),'Contact.fax');_0x45c567[_0xc6ba('0x41')](_0xc6ba('0xa8'),_0xc6ba('0xa9'));_0x45c567['field'](_0xc6ba('0xaa'),_0xc6ba('0xab'));_0x45c567[_0xc6ba('0x41')](_0xc6ba('0xac'),'TagIds');}if(_0x4cce75[_0xc6ba('0x14')])_0x45c567[_0xc6ba('0x14')](_0x4cce75[_0xc6ba('0x14')]);if(_0x4cce75[_0xc6ba('0x12')])_0x45c567[_0xc6ba('0x12')](_0x4cce75[_0xc6ba('0x12')]);return db['sequelize'][_0xc6ba('0x37')](_0x45c567[_0xc6ba('0x8d')](),_0x1a373e);})['then'](function(_0x24d251){if(_0x24d251['length']>0x0)_0x3120d8['where']('ui.MailInteractionId\x20IN\x20?',_['map'](_0x24d251,'id'));return db[_0xc6ba('0x8c')][_0xc6ba('0x37')](_0x3120d8[_0xc6ba('0x8d')](),_0x1a373e)[_0xc6ba('0x19')](function(_0x26e520){var _0x4ba8cd=_[_0xc6ba('0xad')](_0x26e520,'MailInteractionId');var _0x3ad8a8=[];return db[_0xc6ba('0xae')]['findOne']({'attributes':['enableEmailPreview'],'raw':!![]})[_0xc6ba('0x19')](function(_0x127a23){var _0x1a9b1c=_0x127a23[_0xc6ba('0xaf')];_0x24d251[_0xc6ba('0x1f')](function(_0x3defb5){_0x3ad8a8[_0xc6ba('0x21')](updateMailInteraction(_0x3defb5,_0x44d20f,_0x4ba8cd,_0x1a9b1c));});return BPromise['all'](_0x3ad8a8);});});});})[_0xc6ba('0x19')](function(_0x4fcb8f){_0x1d5f65[_0xc6ba('0xb0')]=_0x4fcb8f;return _0x1d5f65;})[_0xc6ba('0x19')](respondWithFilteredResult(_0x29ef15,_0x4cce75))[_0xc6ba('0x28')](handleError(_0x29ef15,null));};exports[_0xc6ba('0xb1')]=function(_0x3cca8f,_0x1ce26e){var _0x4a46e9={'raw':![],'where':{'id':_0x3cca8f['params']['id']}},_0x6b7745={};_0x6b7745[_0xc6ba('0x35')]=_['keys'](db[_0xc6ba('0x30')][_0xc6ba('0x31')]);_0x6b7745['query']=_[_0xc6ba('0x67')](_0x3cca8f[_0xc6ba('0x37')]);_0x6b7745[_0xc6ba('0x38')]=_['intersection'](_0x6b7745[_0xc6ba('0x35')],_0x6b7745[_0xc6ba('0x37')]);_0x4a46e9[_0xc6ba('0x39')]=_[_0xc6ba('0x3a')](_0x6b7745[_0xc6ba('0x35')],qs['fields'](_0x3cca8f[_0xc6ba('0x37')][_0xc6ba('0x3b')]));_0x4a46e9[_0xc6ba('0x39')]=_0x4a46e9[_0xc6ba('0x39')][_0xc6ba('0x3c')]?_0x4a46e9[_0xc6ba('0x39')]:_0x6b7745[_0xc6ba('0x35')];if(_0x3cca8f[_0xc6ba('0x37')][_0xc6ba('0xb2')]){_0x4a46e9[_0xc6ba('0xb3')]=[{'all':!![]}];}_0x4a46e9=_['merge']({},_0x4a46e9,_0x3cca8f['options']);return db[_0xc6ba('0x30')][_0xc6ba('0x5e')](_0x4a46e9)[_0xc6ba('0x19')](handleEntityNotFound(_0x1ce26e,null))[_0xc6ba('0x19')](respondWithResult(_0x1ce26e,null))[_0xc6ba('0x28')](handleError(_0x1ce26e,null));};exports[_0xc6ba('0xb4')]=function(_0x13e8fc,_0x3adf82){return db[_0xc6ba('0x30')]['create'](_0x13e8fc[_0xc6ba('0xb5')],{})[_0xc6ba('0x19')](respondWithResult(_0x3adf82,0xc9))['catch'](handleError(_0x3adf82,null));};exports[_0xc6ba('0x17')]=function(_0x9a6186,_0x5f2539){if(_0x9a6186[_0xc6ba('0xb5')]['id']){delete _0x9a6186[_0xc6ba('0xb5')]['id'];}return db[_0xc6ba('0x30')]['find']({'where':{'id':_0x9a6186['params']['id']}})['then'](handleEntityNotFound(_0x5f2539,null))['then'](saveUpdates(_0x9a6186[_0xc6ba('0xb5')],null))[_0xc6ba('0x19')](respondWithResult(_0x5f2539,null))[_0xc6ba('0x28')](handleError(_0x5f2539,null));};exports[_0xc6ba('0x18')]=function(_0x4e6e9f,_0xcb364f){return db[_0xc6ba('0x30')][_0xc6ba('0x5e')]({'where':{'id':_0x4e6e9f[_0xc6ba('0xb6')]['id']}})[_0xc6ba('0x19')](handleEntityNotFound(_0xcb364f,null))['then'](removeEntity(_0xcb364f,null))[_0xc6ba('0x28')](handleError(_0xcb364f,null));};exports[_0xc6ba('0xb7')]=function(_0x248660,_0x3374ba){return db[_0xc6ba('0x30')][_0xc6ba('0xb7')]()[_0xc6ba('0x19')](respondWithResult(_0x3374ba,null))[_0xc6ba('0x28')](handleError(_0x3374ba,null));};exports[_0xc6ba('0xb8')]=function(_0x35cac2,_0x23235e){return db[_0xc6ba('0xb9')][_0xc6ba('0x5e')]({'where':{'id':_0x35cac2[_0xc6ba('0xb6')]['id']}})[_0xc6ba('0x19')](handleEntityNotFound(_0x23235e,null))[_0xc6ba('0x19')](function(_0x1272e4){if(_0x1272e4){return _0x1272e4[_0xc6ba('0xb8')](_0x35cac2[_0xc6ba('0xb5')][_0xc6ba('0xba')],_[_0xc6ba('0xbb')](_0x35cac2[_0xc6ba('0xb5')],[_0xc6ba('0xba'),'id'])||{});}})['then'](respondWithResult(_0x23235e,null))[_0xc6ba('0x28')](handleError(_0x23235e,null));};exports[_0xc6ba('0xbc')]=function(_0x2aeaa7,_0x21cf92){var _0x13e238={'raw':![],'where':{}};var _0x1aba41={};var _0x175a6d={'count':0x0,'rows':[]};return db[_0xc6ba('0x30')][_0xc6ba('0x22')]({'where':{'id':_0x2aeaa7['params']['id']}})[_0xc6ba('0x19')](handleEntityNotFound(_0x21cf92,null))['then'](function(_0x5ad9be){if(_0x5ad9be){_0x1aba41[_0xc6ba('0x35')]=_[_0xc6ba('0x67')](db[_0xc6ba('0xb9')][_0xc6ba('0x31')]);_0x1aba41[_0xc6ba('0x37')]=_[_0xc6ba('0x67')](_0x2aeaa7['query']);_0x1aba41[_0xc6ba('0x38')]=_[_0xc6ba('0x3a')](_0x1aba41['model'],_0x1aba41[_0xc6ba('0x37')]);_0x13e238['attributes']=_[_0xc6ba('0x3a')](_0x1aba41[_0xc6ba('0x35')],qs[_0xc6ba('0x3b')](_0x2aeaa7['query'][_0xc6ba('0x3b')]));_0x13e238[_0xc6ba('0x39')]=_0x13e238[_0xc6ba('0x39')][_0xc6ba('0x3c')]?_0x13e238[_0xc6ba('0x39')]:_0x1aba41['model'];if(!_0x2aeaa7[_0xc6ba('0x37')][_0xc6ba('0x3d')](_0xc6ba('0x3e'))){_0x13e238['limit']=qs[_0xc6ba('0x14')](_0x2aeaa7[_0xc6ba('0x37')]['limit']);_0x13e238['offset']=qs[_0xc6ba('0x12')](_0x2aeaa7[_0xc6ba('0x37')]['offset']);}_0x13e238[_0xc6ba('0x83')]=qs['sort'](_0x2aeaa7[_0xc6ba('0x37')][_0xc6ba('0x3f')]);_0x13e238[_0xc6ba('0x6c')]=qs[_0xc6ba('0x38')](_['pick'](_0x2aeaa7[_0xc6ba('0x37')],_0x1aba41[_0xc6ba('0x38')]));_0x13e238[_0xc6ba('0x6c')][_0xc6ba('0xbd')]=_0x5ad9be['id'];if(_0x2aeaa7[_0xc6ba('0x37')][_0xc6ba('0x7b')]){_0x13e238[_0xc6ba('0x6c')]=_[_0xc6ba('0x8f')](_0x13e238['where'],{'$or':_[_0xc6ba('0x36')](_0x13e238[_0xc6ba('0x39')],function(_0x503719){var _0x6845e8={};_0x6845e8[_0x503719]={'$like':'%'+_0x2aeaa7[_0xc6ba('0x37')][_0xc6ba('0x7b')]+'%'};return _0x6845e8;})});}if(_0x2aeaa7['query'][_0xc6ba('0x71')]){var _0x2c42be=_0x2aeaa7['query'][_0xc6ba('0x71')][_0xc6ba('0x1e')](',');var _0x5aff57={};_0x5aff57[_0x2c42be[0x0]]={'$gte':moment(_0x2c42be[0x1])[_0xc6ba('0xbe')]('YYYY-MM-DD\x20HH:mm:ss')};_0x13e238[_0xc6ba('0x6c')]=_[_0xc6ba('0x8f')](_0x13e238[_0xc6ba('0x6c')],_0x5aff57);}_0x13e238=_[_0xc6ba('0x8f')]({},_0x13e238,_0x2aeaa7['options']);return db[_0xc6ba('0xb9')]['count']({'where':_0x13e238[_0xc6ba('0x6c')]})[_0xc6ba('0x19')](function(_0x27f1a8){_0x175a6d['count']=_0x27f1a8;if(_0x2aeaa7[_0xc6ba('0x37')][_0xc6ba('0xb2')]){_0x13e238[_0xc6ba('0xb3')]=[{'all':!![]}];}return db['MailMessage']['findAll'](_0x13e238);})[_0xc6ba('0x19')](function(_0x1a34d3){if(_0x2aeaa7[_0xc6ba('0x37')][_0xc6ba('0xbf')]==='true'){for(var _0x385448=0x0;_0x385448<_0x1a34d3[_0xc6ba('0x3c')];_0x385448++){_0x1a34d3[_0x385448]['body']=juice(_0x1a34d3[_0x385448][_0xc6ba('0xb5')]);}}_0x175a6d['rows']=_0x1a34d3;return _0x175a6d;});}})[_0xc6ba('0x19')](respondWithFilteredResult(_0x21cf92,_0x13e238))[_0xc6ba('0x28')](handleError(_0x21cf92,null));};exports[_0xc6ba('0xc0')]=function(_0x559d25,_0x13873c){return db[_0xc6ba('0x30')][_0xc6ba('0x5e')]({'where':{'id':_0x559d25['params']['id']}})[_0xc6ba('0x19')](handleEntityNotFound(_0x13873c,null))[_0xc6ba('0x19')](function(_0x2c24f3){if(_0x2c24f3){return _0x2c24f3['setTags'](_0x559d25[_0xc6ba('0xb5')][_0xc6ba('0xba')],_[_0xc6ba('0xbb')](_0x559d25['body'],[_0xc6ba('0xba'),'id'])||{})[_0xc6ba('0xc1')](function(){return db['Tag'][_0xc6ba('0xc2')]({'attributes':['id',_0xc6ba('0x1a'),_0xc6ba('0xc3')],'where':{'id':_0x559d25[_0xc6ba('0xb5')]['ids']}});})[_0xc6ba('0x19')](function(_0x79b32f){socket['emit'](_0xc6ba('0xc4'),{'id':Number(_0x559d25[_0xc6ba('0xb6')]['id']),'tags':_0x79b32f||[]});return{'id':Number(_0x559d25[_0xc6ba('0xb6')]['id']),'tags':_0x79b32f||[]};});}})['then'](respondWithResult(_0x13873c,null))['catch'](handleError(_0x13873c,null));};exports[_0xc6ba('0xc5')]=function(_0x5019d8,_0x544601){return db['MailInteraction'][_0xc6ba('0x5e')]({'where':{'id':_0x5019d8['params']['id']}})[_0xc6ba('0x19')](handleEntityNotFound(_0x544601,null))[_0xc6ba('0x19')](function(_0x39b9ff){if(_0x39b9ff){return _0x39b9ff[_0xc6ba('0xc5')](_0x5019d8[_0xc6ba('0x37')][_0xc6ba('0xba')]);}})[_0xc6ba('0x19')](respondWithStatusCode(_0x544601,null))[_0xc6ba('0x28')](handleError(_0x544601,null));};exports['download']=function(_0x1fe6c2,_0x364cba){var _0x3d24a6=moment()[_0xc6ba('0xc6')]()['toString']();var _0x485761=path['join'](config['root'],_0xc6ba('0xc7'),'files','tmp');var _0x136f44=path[_0xc6ba('0xc8')](config[_0xc6ba('0xc9')],'server',_0xc6ba('0xca'),'attachments');var _0x278722=path[_0xc6ba('0xc8')](_0x485761,_0x3d24a6);var _0x3821dc=util['format'](_0xc6ba('0xcb'),_0x1fe6c2[_0xc6ba('0xb6')]['id'],_0x3d24a6);var _0x3e3dc5=path[_0xc6ba('0xc8')](_0x485761,_0x3821dc);var _0x2da738=[];if(_0x1fe6c2[_0xc6ba('0x37')]['attachments']){_0x2da738[_0xc6ba('0x21')]({'model':db[_0xc6ba('0xcc')],'as':_0xc6ba('0xcd'),'raw':!![]});}var _0x133beb=[{'model':db[_0xc6ba('0xb9')],'as':'Messages','attributes':['id',_0xc6ba('0xb5'),'from','to','cc',_0xc6ba('0xce'),_0xc6ba('0xcf'),_0xc6ba('0x6f')],'where':{'secret':![]},'order':qs[_0xc6ba('0x3f')]('id'),'include':_0x2da738}];return db[_0xc6ba('0x30')][_0xc6ba('0x5e')]({'where':{'id':_0x1fe6c2[_0xc6ba('0xb6')]['id']},'include':_0x133beb})[_0xc6ba('0x19')](handleEntityNotFound(_0x364cba,null))[_0xc6ba('0x19')](function(_0x5a4572){if(_0x5a4572&&_0x5a4572[_0xc6ba('0xd0')]){var _0x4a671d=_0x5a4572[_0xc6ba('0xd1')]({'plain':!![]});fs[_0xc6ba('0xd2')](_0x278722);return BPromise[_0xc6ba('0xd3')](_0x4a671d[_0xc6ba('0xd0')],function(_0x28f129,_0x345aa3){var _0x234b90={'from':_0x28f129[_0xc6ba('0x42')],'to':_0x28f129['to'],'subject':_0x28f129[_0xc6ba('0xcf')],'html':htmlEntities['decode'](_0x28f129[_0xc6ba('0xb5')]),'headers':{'Date':moment(_0x28f129['createdAt'])[_0xc6ba('0xbe')](_0xc6ba('0xd4'))},'attachments':[]};if(_0x28f129['cc']){_0x234b90[_0xc6ba('0xd5')]['Cc']=_0x28f129['cc'];}if(_0x28f129[_0xc6ba('0xce')]){_0x234b90[_0xc6ba('0xd5')][_0xc6ba('0xd6')]=_0x28f129[_0xc6ba('0xce')];}return new BPromise(function(_0x4bcd4c,_0x1a8292){if(_0x28f129[_0xc6ba('0xcd')]){for(var _0x22750d=0x0;_0x22750d<_0x28f129['Attachments'][_0xc6ba('0x3c')];_0x22750d++){var _0x494e86=_0x28f129[_0xc6ba('0xcd')][_0x22750d];var _0x3ff809=path[_0xc6ba('0xc8')](_0x136f44,_0x494e86['basename']);if(fs[_0xc6ba('0xd7')](_0x3ff809)){_0x234b90[_0xc6ba('0xd8')][_0xc6ba('0x21')]({'name':_0x494e86[_0xc6ba('0x1a')],'contentType':_0x494e86[_0xc6ba('0x33')],'data':fs[_0xc6ba('0xd9')](_0x3ff809)});}}}emlformat[_0xc6ba('0xda')](_0x234b90,function(_0x42414f,_0x3d4b6e){if(_0x42414f)return _0x1a8292(_0x42414f);fs['writeFileSync'](path[_0xc6ba('0xc8')](_0x278722,util[_0xc6ba('0xbe')](_0xc6ba('0xdb'),_0x345aa3)),_0x3d4b6e);return _0x4bcd4c(_0x3d4b6e);});});})[_0xc6ba('0x19')](function(){return new BPromise(function(_0x33ce30,_0x2874e4){zipdir(_0x278722,{'saveTo':_0x3e3dc5},function(_0x12ec2b,_0x308e07){if(_0x12ec2b)return _0x2874e4(_0x12ec2b);return _0x33ce30(_0x308e07);});})[_0xc6ba('0x19')](function(){return new BPromise(function(_0x342309,_0x2be351){rimraf(_0x278722,function(_0xb10b72){if(_0xb10b72)_0x2be351(_0xb10b72);return _0x342309();});});})['then'](function(){return _0x364cba[_0xc6ba('0xdc')](_0x3e3dc5,_0x3821dc,function(_0x1b0c2f){if(!_0x1b0c2f)fs[_0xc6ba('0xdd')](_0x3e3dc5);});});});}else{return _0x364cba['sendStatus'](0xc8);}})[_0xc6ba('0x28')](handleError(_0x364cba,null));}; \ No newline at end of file +var _0x0f42=['tmp','root','transcript-%d-%s.zip','attachments','Attachment','Attachments','Messages','bcc','createdAt','mkdirSync','each','subject','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','basename','existsSync','build','writeFileSync','download','eml-format','moment','util','path','lodash','juice','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./mailInteraction.socket','sendStatus','status','json','offset','undefined','count','set','Content-Range','update','then','end','error','name','send','Users','map','fullname','TagIds','Tags','split','forEach','push','MailMessage','plainBody','-id','lastMsgText','trimStart','catch','waiting','talking','answered','unmanaged','total','closed','UserId','MailInteraction','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','field','from','select','user_has_mail_interactions','left_join','users','u.id\x20=\x20ui.UserId','mail_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','mail_accounts','a.id\x20=\x20i.MailAccountId','mail_messages','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','value','having','$substring','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','some','compact','MailAccountId','i.MailAccountId\x20IN\x20?','concat','parse','$gte','$lte','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','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)','group','i.id','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','DESC','isEmpty','resolve','i.MailAccountId\x20IS\x20NOT\x20NULL','user','role','getMailAccounts','i.MailAccountId\x20IS\x20NULL','agent','sequelize','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.createdAt','i.updatedAt','i.closed','i.attach','i.lastMsgAt','i.lastMsgDirection','i.subject','i.disposition','i.thirdDisposition','i.substatus','i.to','i.ContactId','i.MailAccountId','i.UserId','Contact.firstName','c.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy','Setting','findOne','enableEmailPreview','all','rows','show','params','rawAttributes','includeAll','include','create','body','destroy','describe','addMessage','ids','omit','getMessages','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','addTags','spread','Tag','color','emit','mailInteractionTags:save','removeTags','join','server','files'];(function(_0x5e238b,_0x17ae49){var _0x389bea=function(_0x3cc1c1){while(--_0x3cc1c1){_0x5e238b['push'](_0x5e238b['shift']());}};_0x389bea(++_0x17ae49);}(_0x0f42,0x1e3));var _0x20f4=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x0f42[_0x2b4411];return _0x8e41ef;};'use strict';var emlformat=require(_0x20f4('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var moment=require(_0x20f4('0x1'));var BPromise=require('bluebird');var util=require(_0x20f4('0x2'));var path=require(_0x20f4('0x3'));var fs=require('fs');var _=require(_0x20f4('0x4'));var squel=require('squel');var juice=require(_0x20f4('0x5'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var as=require(_0x20f4('0x6'));var logger=require(_0x20f4('0x7'))(_0x20f4('0x8'));var config=require(_0x20f4('0x9'));var db=require(_0x20f4('0xa'))['db'];var htmlEntities=require('html-entities');config['redis']=_['defaults'](config[_0x20f4('0xb')],{'host':_0x20f4('0xc'),'port':0x18eb});var socket=require(_0x20f4('0xd'))(new Redis(config[_0x20f4('0xb')]));require(_0x20f4('0xe'))['register'](socket);function respondWithStatusCode(_0x545747,_0x297da8){_0x297da8=_0x297da8||0xcc;return function(_0x3e5ac7){if(_0x3e5ac7){return _0x545747[_0x20f4('0xf')](_0x297da8);}return _0x545747[_0x20f4('0x10')](_0x297da8)['end']();};}function respondWithResult(_0x4234ae,_0x36fe84){_0x36fe84=_0x36fe84||0xc8;return function(_0x201253){if(_0x201253){return _0x4234ae[_0x20f4('0x10')](_0x36fe84)[_0x20f4('0x11')](_0x201253);}};}function respondWithFilteredResult(_0x28fb55,_0x53da9f){return function(_0x4c1e49){if(_0x4c1e49){var _0x117e70=typeof _0x53da9f[_0x20f4('0x12')]===_0x20f4('0x13')&&typeof _0x53da9f['limit']==='undefined';var _0x489154=_0x4c1e49[_0x20f4('0x14')];var _0x2a9b1c=_0x117e70?0x0:_0x53da9f['offset'];var _0x327716=_0x117e70?_0x4c1e49[_0x20f4('0x14')]:_0x53da9f[_0x20f4('0x12')]+_0x53da9f['limit'];var _0x4ec9ce;if(_0x327716>=_0x489154){_0x327716=_0x489154;_0x4ec9ce=0xc8;}else{_0x4ec9ce=0xce;}_0x28fb55[_0x20f4('0x10')](_0x4ec9ce);return _0x28fb55[_0x20f4('0x15')](_0x20f4('0x16'),_0x2a9b1c+'-'+_0x327716+'/'+_0x489154)[_0x20f4('0x11')](_0x4c1e49);}return null;};}function saveUpdates(_0x346dda){return function(_0x491f35){if(_0x491f35){return _0x491f35[_0x20f4('0x17')](_0x346dda)[_0x20f4('0x18')](function(_0x371d20){return _0x371d20;});}return null;};}function removeEntity(_0x39419d){return function(_0x2a548c){if(_0x2a548c){return _0x2a548c['destroy']()['then'](function(){_0x39419d['status'](0xcc)[_0x20f4('0x19')]();});}};}function handleEntityNotFound(_0x35feb6){return function(_0x2e5bad){if(!_0x2e5bad){_0x35feb6[_0x20f4('0xf')](0x194);}return _0x2e5bad;};}function handleError(_0x7e0617,_0x362aae){_0x362aae=_0x362aae||0x1f4;return function(_0x24f1ac){logger[_0x20f4('0x1a')](_0x24f1ac['stack']);if(_0x24f1ac[_0x20f4('0x1b')]){delete _0x24f1ac[_0x20f4('0x1b')];}_0x7e0617[_0x20f4('0x10')](_0x362aae)[_0x20f4('0x1c')](_0x24f1ac);};}function getInteractionUsers(_0x26e73c,_0x443779){return new BPromise(function(_0x234c26,_0x1c7aa2){try{if(_0x443779[_0x26e73c['id']]){_0x26e73c[_0x20f4('0x1d')]=_[_0x20f4('0x1e')](_0x443779[_0x26e73c['id']],function(_0x5db4b3){return{'id':_0x5db4b3['id'],'fullname':_0x5db4b3[_0x20f4('0x1f')]};});}}catch(_0x508fc3){_0x1c7aa2(_0x508fc3);}_0x234c26(_0x26e73c);});}function getInteractionTags(_0x32f401,_0x598bf6){return new BPromise(function(_0x42d79e,_0x883b03){try{if(_0x32f401[_0x20f4('0x20')]){_0x32f401[_0x20f4('0x21')]=[];_0x32f401[_0x20f4('0x20')][_0x20f4('0x22')](',')[_0x20f4('0x23')](function(_0x5a4bf5){_0x32f401[_0x20f4('0x21')][_0x20f4('0x24')](_0x598bf6[_0x5a4bf5]);});}delete _0x32f401[_0x20f4('0x20')];}catch(_0x40d16d){_0x883b03(_0x40d16d);}_0x42d79e(_0x32f401);});}function getLastMessageText(_0x57db1d){return new BPromise(function(_0xb9d02a,_0x1bb7f4){return db[_0x20f4('0x25')]['findOne']({'where':{'$and':[{'MailInteractionId':_0x57db1d['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':'out'},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x20f4('0x26')],'order':_0x20f4('0x27'),'raw':!![]})['then'](function(_0x4fa707){if(_0x4fa707&&_0x4fa707[_0x20f4('0x26')]){_0x57db1d[_0x20f4('0x28')]=_[_0x20f4('0x29')](_0x4fa707[_0x20f4('0x26')]);}_0xb9d02a(_0x57db1d);})[_0x20f4('0x2a')](function(_0x149f44){_0x1bb7f4(_0x149f44);});});}function updateMailInteraction(_0x3af3c6,_0x5f150d,_0x539f75,_0x245b0f){return new BPromise(function(_0x880301,_0x4cafb3){return getInteractionUsers(_0x3af3c6,_0x539f75)[_0x20f4('0x18')](function(_0x2e8467){return getInteractionTags(_0x2e8467,_0x5f150d);})['then'](function(_0x39ba32){return getStateInteraction(_0x39ba32);})[_0x20f4('0x18')](function(_0x3338b3){if(_0x245b0f){_0x880301(getLastMessageText(_0x3338b3));}else{_0x880301(_0x3338b3);}})['catch'](function(_0x59380a){_0x4cafb3(_0x59380a);});});}function getStateInteraction(_0x4733df){return new BPromise(function(_0x296d1f){_0x4733df[_0x20f4('0x2b')]=0x0;_0x4733df[_0x20f4('0x2c')]=0x0;_0x4733df[_0x20f4('0x2d')]=0x0;_0x4733df[_0x20f4('0x2e')]=0x0;_0x4733df[_0x20f4('0x2f')]=0x0;if(!_0x4733df[_0x20f4('0x30')]&&!_0x4733df[_0x20f4('0x31')]){_0x4733df['waiting']+=0x1;}if(!_0x4733df[_0x20f4('0x30')]&&_0x4733df[_0x20f4('0x31')]){_0x4733df[_0x20f4('0x2c')]+=0x1;if(_0x4733df[_0x20f4('0x2b')]){_0x4733df['waiting']-=0x1;}}if(_0x4733df[_0x20f4('0x30')]&&_0x4733df[_0x20f4('0x31')]){_0x4733df[_0x20f4('0x2d')]+=0x1;if(_0x4733df['talking']){_0x4733df[_0x20f4('0x2c')]-=0x1;}}if(_0x4733df['closed']&&!_0x4733df[_0x20f4('0x31')]){_0x4733df[_0x20f4('0x2e')]+=0x1;if(_0x4733df[_0x20f4('0x2b')]){_0x4733df[_0x20f4('0x2b')]-=0x1;}}_0x4733df[_0x20f4('0x2f')]+=0x1;_0x296d1f(_0x4733df);});}exports['index']=function(_0xf2ff6a,_0x371c6b){var _0x1deca8={},_0x5016cd={},_0x473f64={'count':0x0,'rows':[]};var _0x27c8a0=_['map'](db[_0x20f4('0x32')]['rawAttributes'],function(_0x6e68){return{'name':_0x6e68[_0x20f4('0x33')],'type':_0x6e68['type'][_0x20f4('0x34')]};});_0x5016cd[_0x20f4('0x35')]=_['map'](_0x27c8a0,_0x20f4('0x1b'));_0x5016cd[_0x20f4('0x36')]=_[_0x20f4('0x37')](_0xf2ff6a['query']);_0x5016cd[_0x20f4('0x38')]=_[_0x20f4('0x39')](_0x5016cd[_0x20f4('0x35')],_0x5016cd[_0x20f4('0x36')]);_0x1deca8[_0x20f4('0x3a')]=_['intersection'](_0x5016cd[_0x20f4('0x35')],qs[_0x20f4('0x3b')](_0xf2ff6a['query'][_0x20f4('0x3b')]));_0x1deca8[_0x20f4('0x3a')]=_0x1deca8[_0x20f4('0x3a')][_0x20f4('0x3c')]?_0x1deca8[_0x20f4('0x3a')]:_0x5016cd[_0x20f4('0x35')];if(!_0xf2ff6a[_0x20f4('0x36')][_0x20f4('0x3d')](_0x20f4('0x3e'))){_0x1deca8[_0x20f4('0x3f')]=qs[_0x20f4('0x3f')](_0xf2ff6a[_0x20f4('0x36')][_0x20f4('0x3f')]);_0x1deca8[_0x20f4('0x12')]=qs[_0x20f4('0x12')](_0xf2ff6a[_0x20f4('0x36')][_0x20f4('0x12')]);}_0x1deca8[_0x20f4('0x40')]=qs[_0x20f4('0x41')](_0xf2ff6a[_0x20f4('0x36')][_0x20f4('0x41')]);_0x1deca8[_0x20f4('0x42')]=qs[_0x20f4('0x38')](_[_0x20f4('0x43')](_0xf2ff6a[_0x20f4('0x36')],_0x5016cd[_0x20f4('0x38')]),_0x27c8a0);var _0x4a82d5=[];var _0x217e55=squel['select']()['field']('id')[_0x20f4('0x44')](_0x20f4('0x1b'))[_0x20f4('0x44')]('color')[_0x20f4('0x45')]('tools_tags');var _0x293d44=squel[_0x20f4('0x46')]()[_0x20f4('0x44')]('u.id')['field']('u.fullname')['field']('ui.MailInteractionId')['from'](_0x20f4('0x47'),'ui')[_0x20f4('0x48')](_0x20f4('0x49'),'u',_0x20f4('0x4a'));var _0x44468f=squel[_0x20f4('0x46')]()['from'](_0x20f4('0x4b'),'i')[_0x20f4('0x48')](_0x20f4('0x4c'),'c',_0x20f4('0x4d'))['left_join'](_0x20f4('0x49'),'o','o.id\x20=\x20i.UserId')[_0x20f4('0x48')](_0x20f4('0x4e'),'a',_0x20f4('0x4f'))[_0x20f4('0x48')](_0x20f4('0x50'),'me','me.MailInteractionId\x20=\x20i.id')[_0x20f4('0x48')](_0x20f4('0x51'),'it',_0x20f4('0x52'))[_0x20f4('0x48')](_0x20f4('0x53'),'t',_0x20f4('0x54'));var _0x5c226e=squel[_0x20f4('0x55')]();var _0x45492c=[];var _0x5e1571=squel[_0x20f4('0x55')]();var _0x76e514;if(_0xf2ff6a[_0x20f4('0x36')][_0x20f4('0x56')]){_0x76e514=as[_0x20f4('0x57')](_0xf2ff6a['query'][_0x20f4('0x56')]);var _0xeb9786=_0x76e514[_0x20f4('0x58')];for(var _0x50138c=0x0;_0x50138c<_0x76e514[_0x20f4('0x59')][_0x20f4('0x3c')];_0x50138c++){var _0xb6e6e9=_0x76e514[_0x20f4('0x59')][_0x50138c];var _0x5cec72='i';var _0x3c9bd2=_[_0x20f4('0x5a')](_0x27c8a0,[_0x20f4('0x1b'),_0xb6e6e9[_0x20f4('0x44')]]);if(!_0x3c9bd2){switch(_0xb6e6e9[_0x20f4('0x44')]){case'unreadMessages':if(_0xb6e6e9[_0x20f4('0x5b')]==0x1){_0x44468f[_0x20f4('0x5c')]('`'+_0xb6e6e9[_0x20f4('0x44')]+'`\x20=\x200');}else{_0x44468f[_0x20f4('0x5c')]('`'+_0xb6e6e9[_0x20f4('0x44')]+'`\x20>\x200');}break;case'Contact':if(_0xb6e6e9['operator']===_0x20f4('0x5d')){if(_0xb6e6e9[_0x20f4('0x5b')][_0x20f4('0x22')]('\x20')['length']>0x1){_0x5c226e[_0xeb9786]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x20f4('0x5e')](_0xb6e6e9[_0x20f4('0x5b')]),null);}else{var _0x12db94='%'+_0xb6e6e9[_0x20f4('0x5b')]+'%';_0x5c226e[_0xeb9786](_0x20f4('0x5f'),_0x12db94,_0x12db94,_0x12db94);}}else{_0x3c9bd2=_[_0x20f4('0x5a')](_0x27c8a0,['name',_0x20f4('0x60')]);_0xb6e6e9[_0x20f4('0x44')]=_0x20f4('0x60');_0x27d8c1=as[_0x20f4('0x61')](_0x5cec72,_0x3c9bd2[_0x20f4('0x62')],_0xb6e6e9);_0x5c226e[_0xeb9786](_0x27d8c1[_0x20f4('0x63')],_0x27d8c1[_0x20f4('0x5b')][_0x20f4('0x64')],_0x27d8c1[_0x20f4('0x5b')][_0x20f4('0x19')]);}break;case'Tag':var _0x542a63=_0xb6e6e9[_0x20f4('0x5b')][_0x20f4('0x22')](',')['map'](function(_0x3f49f3){return Number(_0x3f49f3);});_0x542a63[_0x20f4('0x23')](function(_0x47ab56){_0x5e1571['or'](_0x20f4('0x65'),'%,'+_0x47ab56+',%');});_0x45492c=_[_0x20f4('0x66')](_0x45492c,_0x542a63);break;case _0x20f4('0x67'):if(_0xb6e6e9[_0x20f4('0x68')]===_0x20f4('0x5d')){_0x5c226e[_0xeb9786](_0x20f4('0x69'),'%'+_0xb6e6e9['value']+'%',null);}else{_0x3c9bd2=_[_0x20f4('0x5a')](_0x27c8a0,[_0x20f4('0x1b'),_0x20f4('0x31')]);_0xb6e6e9[_0x20f4('0x44')]=_0x20f4('0x31');_0x27d8c1=as['buildExpression'](_0x5cec72,_0x3c9bd2[_0x20f4('0x62')],_0xb6e6e9);_0x5c226e[_0xeb9786](_0x27d8c1[_0x20f4('0x63')],_0x27d8c1[_0x20f4('0x5b')][_0x20f4('0x64')],_0x27d8c1['value'][_0x20f4('0x19')]);}break;case _0x20f4('0x26'):_0x27d8c1=as['buildExpression']('me',null,_0xb6e6e9);_0x5c226e[_0xeb9786](_0x27d8c1[_0x20f4('0x63')],_0x27d8c1[_0x20f4('0x5b')][_0x20f4('0x64')],_0x27d8c1[_0x20f4('0x5b')][_0x20f4('0x19')]);break;}}else{var _0x27d8c1=as[_0x20f4('0x61')](_0x5cec72,_0x3c9bd2[_0x20f4('0x62')],_0xb6e6e9);_0x5c226e[_0xeb9786](_0x27d8c1[_0x20f4('0x63')],_0x27d8c1[_0x20f4('0x5b')][_0x20f4('0x64')],_0x27d8c1[_0x20f4('0x5b')][_0x20f4('0x19')]);}}}else{var _0x3d79a1=_(_0xf2ff6a[_0x20f4('0x36')])[_0x20f4('0x37')]()['map'](function(_0x38a78f){return _[_0x20f4('0x6a')](_0x27c8a0,[_0x20f4('0x1b'),_0x38a78f])?_0x38a78f:undefined;})[_0x20f4('0x6b')]()[_0x20f4('0x5b')]();if(!_['isEmpty'](_0x3d79a1)){_0x3d79a1['forEach'](function(_0xc602e4){if(_0xc602e4===_0x20f4('0x6c')){_0x44468f[_0x20f4('0x42')](_0x20f4('0x6d'),[][_0x20f4('0x6e')](_0xf2ff6a[_0x20f4('0x36')][_0xc602e4]));}else if(_0xc602e4==='createdAt'){var _0x5bd8a4=JSON[_0x20f4('0x6f')](_0xf2ff6a['query'][_0xc602e4])[_0x20f4('0x70')];var _0x1442b8=JSON[_0x20f4('0x6f')](_0xf2ff6a[_0x20f4('0x36')][_0xc602e4])[_0x20f4('0x71')];_0x44468f[_0x20f4('0x42')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x5bd8a4,_0x1442b8);}else{if(_0xf2ff6a[_0x20f4('0x36')][_0xc602e4]==='null'){_0x44468f[_0x20f4('0x42')]('i.'+_0xc602e4+_0x20f4('0x72'));}else{_0x44468f[_0x20f4('0x42')]('i.'+_0xc602e4+'\x20=\x20?',_0xf2ff6a['query'][_0xc602e4]);}}});}if(_0xf2ff6a[_0x20f4('0x36')]['read']){if(_0xf2ff6a[_0x20f4('0x36')][_0x20f4('0x73')]==0x1){_0x44468f[_0x20f4('0x5c')](_0x20f4('0x74'));}else{_0x44468f['having'](_0x20f4('0x75'));}}if(_0xf2ff6a['query']['tag']){_0x45492c=_['isArray'](_0xf2ff6a['query']['tag'])?_0xf2ff6a[_0x20f4('0x36')][_0x20f4('0x76')]:new Array(_0xf2ff6a[_0x20f4('0x36')][_0x20f4('0x76')]);_0x45492c[_0x20f4('0x23')](function(_0x256df7){_0x5e1571['or'](_0x20f4('0x65'),'%,'+_0x256df7+',%');});}if(_0xf2ff6a[_0x20f4('0x36')][_0x20f4('0x77')]){var _0x38a5f2=_0xf2ff6a[_0x20f4('0x36')][_0x20f4('0x77')][_0x20f4('0x78')]('\x5c','\x5c\x5c')[_0x20f4('0x78')](/'/g,'\x27\x27');if(qs[_0x20f4('0x79')](_0x38a5f2)){_0x5c226e['or'](_0x20f4('0x7a'),_0x38a5f2+'%');}else if(qs['isEmail'](_0x38a5f2)){_0x5c226e['or'](_0x20f4('0x7b'),_0x38a5f2+'%');}else{_0x5c226e['or'](_0x20f4('0x7c'),qs[_0x20f4('0x5e')](_0x38a5f2))['or'](_0x20f4('0x7d'),qs['getFullTextValue'](_0x38a5f2));}}}_0x44468f[_0x20f4('0x42')](_0x5c226e);_0x44468f[_0x20f4('0x7e')](_0x20f4('0x7f'));var _0x2828ec={'type':db['Sequelize']['QueryTypes'][_0x20f4('0x80')],'raw':!![]};var _0x43e2ef=_0x44468f[_0x20f4('0x81')]();_0x43e2ef[_0x20f4('0x44')](_0x20f4('0x7f'));_0x43e2ef['field'](_0x20f4('0x82'),_0x20f4('0x83'));if(_0x1deca8['order']){_0x1deca8['order'][_0x20f4('0x23')](function(_0x5c40b0){var _0x2a4ff4=_0x5c40b0[0x0]==='contactName'?_0x5c40b0[0x0]:'i.'+_0x5c40b0[0x0];_0x44468f[_0x20f4('0x40')](_0x2a4ff4,_0x5c40b0[0x1]===_0x20f4('0x84')?![]:!![]);});}if(!_[_0x20f4('0x85')](_0x45492c)){_0x44468f[_0x20f4('0x5c')](_0x5e1571);_0x43e2ef[_0x20f4('0x42')]('t.id\x20IN\x20?',_0x45492c);}BPromise[_0x20f4('0x86')]()['then'](function(){if(!_0x76e514){if(_0xf2ff6a['query'][_0x20f4('0x6c')])return;_0x43e2ef[_0x20f4('0x42')]('i.MailAccountId\x20IS\x20NOT\x20NULL');_0x44468f[_0x20f4('0x42')](_0x20f4('0x87'));return;}if(_0xf2ff6a[_0x20f4('0x88')][_0x20f4('0x89')]!=='agent')return;return _0xf2ff6a[_0x20f4('0x88')][_0x20f4('0x8a')]({'attributes':['id'],'raw':!![]})[_0x20f4('0x18')](function(_0x3cf512){if(_[_0x20f4('0x85')](_0x3cf512)){_0x43e2ef['where'](_0x20f4('0x8b'));_0x44468f[_0x20f4('0x42')](_0x20f4('0x8b'));}else{_0x43e2ef['where'](_0x20f4('0x6d'),_['map'](_0x3cf512,'id'));_0x44468f['where'](_0x20f4('0x6d'),_['map'](_0x3cf512,'id'));}});})[_0x20f4('0x18')](function(){if(_0xf2ff6a[_0x20f4('0x88')]['role']===_0x20f4('0x8c')&&!_0x76e514&&!_0xf2ff6a['query'][_0x20f4('0x6c')])return[];return db[_0x20f4('0x8d')]['query'](_0x43e2ef[_0x20f4('0x8e')](),_0x2828ec);})['then'](function(_0x2978bf){_0x473f64[_0x20f4('0x14')]=_0x2978bf[_0x20f4('0x3c')];if(_0x473f64['count']===0x0)return[];return db[_0x20f4('0x8d')]['query'](_0x217e55[_0x20f4('0x8e')](),_0x2828ec)['then'](function(_0x2f4255){_0x4a82d5=_[_0x20f4('0x8f')](_0x2f4255,'id');_0x2828ec=_[_0x20f4('0x90')](_0x2828ec,{'model':db[_0x20f4('0x32')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xf2ff6a[_0x20f4('0x36')][_0x20f4('0x3b')]){_0x1deca8[_0x20f4('0x3a')]['forEach'](function(_0x21a00b){_0x44468f['field']('i.'+_0x21a00b);});}else{_0x44468f[_0x20f4('0x44')](_0x20f4('0x82'),_0x20f4('0x83'));_0x44468f[_0x20f4('0x44')](_0x20f4('0x91'),_0x20f4('0x92'));_0x44468f[_0x20f4('0x44')](_0x20f4('0x93'),_0x20f4('0x94'));_0x44468f['field'](_0x20f4('0x95'),'contactName');_0x44468f[_0x20f4('0x44')](_0x20f4('0x7f'));_0x44468f['field'](_0x20f4('0x96'));_0x44468f[_0x20f4('0x44')](_0x20f4('0x97'));_0x44468f[_0x20f4('0x44')](_0x20f4('0x98'));_0x44468f[_0x20f4('0x44')]('i.closedAt');_0x44468f[_0x20f4('0x44')](_0x20f4('0x99'));_0x44468f[_0x20f4('0x44')](_0x20f4('0x9a'));_0x44468f[_0x20f4('0x44')](_0x20f4('0x9b'));_0x44468f[_0x20f4('0x44')](_0x20f4('0x9c'));_0x44468f[_0x20f4('0x44')](_0x20f4('0x9d'));_0x44468f[_0x20f4('0x44')]('i.secondDisposition');_0x44468f[_0x20f4('0x44')](_0x20f4('0x9e'));_0x44468f[_0x20f4('0x44')](_0x20f4('0x9f'));_0x44468f['field'](_0x20f4('0xa0'));_0x44468f[_0x20f4('0x44')](_0x20f4('0xa1'));_0x44468f['field'](_0x20f4('0xa2'));_0x44468f['field'](_0x20f4('0xa3'));_0x44468f[_0x20f4('0x44')]('c.firstName',_0x20f4('0xa4'));_0x44468f['field'](_0x20f4('0xa5'),'Contact.lastName');_0x44468f[_0x20f4('0x44')](_0x20f4('0xa6'),_0x20f4('0xa7'));_0x44468f[_0x20f4('0x44')](_0x20f4('0xa8'),_0x20f4('0xa9'));_0x44468f[_0x20f4('0x44')](_0x20f4('0xaa'),_0x20f4('0xab'));_0x44468f[_0x20f4('0x44')]('c.fax','Contact.fax');_0x44468f['field']('o.fullname',_0x20f4('0xac'));_0x44468f['field'](_0x20f4('0xad'),_0x20f4('0xae'));_0x44468f[_0x20f4('0x44')](_0x20f4('0xaf'),_0x20f4('0x20'));}if(_0x1deca8[_0x20f4('0x3f')])_0x44468f[_0x20f4('0x3f')](_0x1deca8[_0x20f4('0x3f')]);if(_0x1deca8[_0x20f4('0x12')])_0x44468f[_0x20f4('0x12')](_0x1deca8[_0x20f4('0x12')]);return db[_0x20f4('0x8d')]['query'](_0x44468f[_0x20f4('0x8e')](),_0x2828ec);})['then'](function(_0x1c1a86){if(_0x1c1a86[_0x20f4('0x3c')]>0x0)_0x293d44[_0x20f4('0x42')](_0x20f4('0xb0'),_[_0x20f4('0x1e')](_0x1c1a86,'id'));return db[_0x20f4('0x8d')][_0x20f4('0x36')](_0x293d44[_0x20f4('0x8e')](),_0x2828ec)[_0x20f4('0x18')](function(_0x97a228){var _0x416d93=_[_0x20f4('0xb1')](_0x97a228,'MailInteractionId');var _0x243762=[];return db[_0x20f4('0xb2')][_0x20f4('0xb3')]({'attributes':[_0x20f4('0xb4')],'raw':!![]})[_0x20f4('0x18')](function(_0x21d0ee){var _0x2ef181=_0x21d0ee[_0x20f4('0xb4')];_0x1c1a86[_0x20f4('0x23')](function(_0x55c8d4){_0x243762['push'](updateMailInteraction(_0x55c8d4,_0x4a82d5,_0x416d93,_0x2ef181));});return BPromise[_0x20f4('0xb5')](_0x243762);});});});})['then'](function(_0x290d45){_0x473f64[_0x20f4('0xb6')]=_0x290d45;return _0x473f64;})[_0x20f4('0x18')](respondWithFilteredResult(_0x371c6b,_0x1deca8))[_0x20f4('0x2a')](handleError(_0x371c6b,null));};exports[_0x20f4('0xb7')]=function(_0x59550e,_0x3047f7){var _0x5a5ae1={'raw':![],'where':{'id':_0x59550e[_0x20f4('0xb8')]['id']}},_0x55626e={};_0x55626e[_0x20f4('0x35')]=_[_0x20f4('0x37')](db[_0x20f4('0x32')][_0x20f4('0xb9')]);_0x55626e['query']=_[_0x20f4('0x37')](_0x59550e[_0x20f4('0x36')]);_0x55626e[_0x20f4('0x38')]=_[_0x20f4('0x39')](_0x55626e[_0x20f4('0x35')],_0x55626e[_0x20f4('0x36')]);_0x5a5ae1['attributes']=_[_0x20f4('0x39')](_0x55626e[_0x20f4('0x35')],qs[_0x20f4('0x3b')](_0x59550e[_0x20f4('0x36')][_0x20f4('0x3b')]));_0x5a5ae1[_0x20f4('0x3a')]=_0x5a5ae1['attributes'][_0x20f4('0x3c')]?_0x5a5ae1[_0x20f4('0x3a')]:_0x55626e['model'];if(_0x59550e['query'][_0x20f4('0xba')]){_0x5a5ae1[_0x20f4('0xbb')]=[{'all':!![]}];}_0x5a5ae1=_['merge']({},_0x5a5ae1,_0x59550e['options']);return db[_0x20f4('0x32')]['find'](_0x5a5ae1)[_0x20f4('0x18')](handleEntityNotFound(_0x3047f7,null))['then'](respondWithResult(_0x3047f7,null))[_0x20f4('0x2a')](handleError(_0x3047f7,null));};exports[_0x20f4('0xbc')]=function(_0x44241e,_0x5143f7){return db[_0x20f4('0x32')][_0x20f4('0xbc')](_0x44241e[_0x20f4('0xbd')],{})['then'](respondWithResult(_0x5143f7,0xc9))['catch'](handleError(_0x5143f7,null));};exports[_0x20f4('0x17')]=function(_0x26aa49,_0x4aee33){if(_0x26aa49[_0x20f4('0xbd')]['id']){delete _0x26aa49[_0x20f4('0xbd')]['id'];}return db[_0x20f4('0x32')]['find']({'where':{'id':_0x26aa49[_0x20f4('0xb8')]['id']}})[_0x20f4('0x18')](handleEntityNotFound(_0x4aee33,null))['then'](saveUpdates(_0x26aa49[_0x20f4('0xbd')],null))[_0x20f4('0x18')](respondWithResult(_0x4aee33,null))[_0x20f4('0x2a')](handleError(_0x4aee33,null));};exports[_0x20f4('0xbe')]=function(_0x5b8dc6,_0x4a9010){return db[_0x20f4('0x32')][_0x20f4('0x5a')]({'where':{'id':_0x5b8dc6[_0x20f4('0xb8')]['id']}})[_0x20f4('0x18')](handleEntityNotFound(_0x4a9010,null))[_0x20f4('0x18')](removeEntity(_0x4a9010,null))['catch'](handleError(_0x4a9010,null));};exports[_0x20f4('0xbf')]=function(_0x46bbb3,_0x134c00){return db[_0x20f4('0x32')]['describe']()['then'](respondWithResult(_0x134c00,null))[_0x20f4('0x2a')](handleError(_0x134c00,null));};exports[_0x20f4('0xc0')]=function(_0x1903cc,_0x23acdf){return db[_0x20f4('0x25')]['find']({'where':{'id':_0x1903cc[_0x20f4('0xb8')]['id']}})[_0x20f4('0x18')](handleEntityNotFound(_0x23acdf,null))[_0x20f4('0x18')](function(_0x1f50b8){if(_0x1f50b8){return _0x1f50b8['addMessage'](_0x1903cc[_0x20f4('0xbd')][_0x20f4('0xc1')],_[_0x20f4('0xc2')](_0x1903cc[_0x20f4('0xbd')],['ids','id'])||{});}})[_0x20f4('0x18')](respondWithResult(_0x23acdf,null))[_0x20f4('0x2a')](handleError(_0x23acdf,null));};exports[_0x20f4('0xc3')]=function(_0x1dfd85,_0x53b097){var _0x5baee0={'raw':![],'where':{}};var _0x107149={};var _0x34f763={'count':0x0,'rows':[]};return db[_0x20f4('0x32')][_0x20f4('0xb3')]({'where':{'id':_0x1dfd85[_0x20f4('0xb8')]['id']}})[_0x20f4('0x18')](handleEntityNotFound(_0x53b097,null))[_0x20f4('0x18')](function(_0x17344a){if(_0x17344a){_0x107149['model']=_['keys'](db['MailMessage'][_0x20f4('0xb9')]);_0x107149[_0x20f4('0x36')]=_[_0x20f4('0x37')](_0x1dfd85[_0x20f4('0x36')]);_0x107149[_0x20f4('0x38')]=_[_0x20f4('0x39')](_0x107149[_0x20f4('0x35')],_0x107149[_0x20f4('0x36')]);_0x5baee0[_0x20f4('0x3a')]=_[_0x20f4('0x39')](_0x107149[_0x20f4('0x35')],qs[_0x20f4('0x3b')](_0x1dfd85['query'][_0x20f4('0x3b')]));_0x5baee0['attributes']=_0x5baee0['attributes'][_0x20f4('0x3c')]?_0x5baee0[_0x20f4('0x3a')]:_0x107149[_0x20f4('0x35')];if(!_0x1dfd85['query']['hasOwnProperty']('nolimit')){_0x5baee0['limit']=qs[_0x20f4('0x3f')](_0x1dfd85['query'][_0x20f4('0x3f')]);_0x5baee0[_0x20f4('0x12')]=qs[_0x20f4('0x12')](_0x1dfd85[_0x20f4('0x36')][_0x20f4('0x12')]);}_0x5baee0[_0x20f4('0x40')]=qs[_0x20f4('0x41')](_0x1dfd85[_0x20f4('0x36')][_0x20f4('0x41')]);_0x5baee0[_0x20f4('0x42')]=qs[_0x20f4('0x38')](_[_0x20f4('0x43')](_0x1dfd85[_0x20f4('0x36')],_0x107149[_0x20f4('0x38')]));_0x5baee0[_0x20f4('0x42')]['MailInteractionId']=_0x17344a['id'];if(_0x1dfd85[_0x20f4('0x36')][_0x20f4('0x77')]){_0x5baee0[_0x20f4('0x42')]=_[_0x20f4('0x90')](_0x5baee0[_0x20f4('0x42')],{'$or':_['map'](_0x5baee0[_0x20f4('0x3a')],function(_0x5809da){var _0x20add5={};_0x20add5[_0x5809da]={'$like':'%'+_0x1dfd85[_0x20f4('0x36')][_0x20f4('0x77')]+'%'};return _0x20add5;})});}if(_0x1dfd85[_0x20f4('0x36')][_0x20f4('0x70')]){var _0x1f6b2f=_0x1dfd85['query'][_0x20f4('0x70')][_0x20f4('0x22')](',');var _0xe73f6d={};_0xe73f6d[_0x1f6b2f[0x0]]={'$gte':moment(_0x1f6b2f[0x1])[_0x20f4('0xc4')](_0x20f4('0xc5'))};_0x5baee0[_0x20f4('0x42')]=_[_0x20f4('0x90')](_0x5baee0[_0x20f4('0x42')],_0xe73f6d);}_0x5baee0=_['merge']({},_0x5baee0,_0x1dfd85['options']);return db[_0x20f4('0x25')][_0x20f4('0x14')]({'where':_0x5baee0[_0x20f4('0x42')]})[_0x20f4('0x18')](function(_0x136a96){_0x34f763['count']=_0x136a96;if(_0x1dfd85['query']['includeAll']){_0x5baee0[_0x20f4('0xbb')]=[{'all':!![]}];}return db[_0x20f4('0x25')]['findAll'](_0x5baee0);})[_0x20f4('0x18')](function(_0x40b6ac){if(_0x1dfd85[_0x20f4('0x36')][_0x20f4('0xc6')]===_0x20f4('0xc7')){for(var _0x122d8=0x0;_0x122d8<_0x40b6ac[_0x20f4('0x3c')];_0x122d8++){_0x40b6ac[_0x122d8][_0x20f4('0xbd')]=juice(_0x40b6ac[_0x122d8]['body']);}}_0x34f763[_0x20f4('0xb6')]=_0x40b6ac;return _0x34f763;});}})['then'](respondWithFilteredResult(_0x53b097,_0x5baee0))[_0x20f4('0x2a')](handleError(_0x53b097,null));};exports[_0x20f4('0xc8')]=function(_0x23afe4,_0x1aed2c){return db[_0x20f4('0x32')][_0x20f4('0x5a')]({'where':{'id':_0x23afe4[_0x20f4('0xb8')]['id']}})[_0x20f4('0x18')](handleEntityNotFound(_0x1aed2c,null))[_0x20f4('0x18')](function(_0x3262f7){if(_0x3262f7){return _0x3262f7['setTags'](_0x23afe4[_0x20f4('0xbd')]['ids'],_['omit'](_0x23afe4[_0x20f4('0xbd')],[_0x20f4('0xc1'),'id'])||{})[_0x20f4('0xc9')](function(){return db[_0x20f4('0xca')]['findAll']({'attributes':['id',_0x20f4('0x1b'),_0x20f4('0xcb')],'where':{'id':_0x23afe4[_0x20f4('0xbd')]['ids']}});})['then'](function(_0x1e0e97){socket[_0x20f4('0xcc')](_0x20f4('0xcd'),{'id':Number(_0x23afe4['params']['id']),'tags':_0x1e0e97||[]});return{'id':Number(_0x23afe4[_0x20f4('0xb8')]['id']),'tags':_0x1e0e97||[]};});}})[_0x20f4('0x18')](respondWithResult(_0x1aed2c,null))['catch'](handleError(_0x1aed2c,null));};exports['removeTags']=function(_0x2ecf21,_0x5b6de5){return db[_0x20f4('0x32')][_0x20f4('0x5a')]({'where':{'id':_0x2ecf21[_0x20f4('0xb8')]['id']}})['then'](handleEntityNotFound(_0x5b6de5,null))[_0x20f4('0x18')](function(_0x10c32c){if(_0x10c32c){return _0x10c32c[_0x20f4('0xce')](_0x2ecf21['query']['ids']);}})['then'](respondWithStatusCode(_0x5b6de5,null))[_0x20f4('0x2a')](handleError(_0x5b6de5,null));};exports['download']=function(_0xa3f7d4,_0x999cdf){var _0x4e59e9=moment()['unix']()[_0x20f4('0x8e')]();var _0x51aae0=path[_0x20f4('0xcf')](config['root'],_0x20f4('0xd0'),_0x20f4('0xd1'),_0x20f4('0xd2'));var _0x41ffcb=path['join'](config[_0x20f4('0xd3')],'server','files','attachments');var _0x5dbb40=path[_0x20f4('0xcf')](_0x51aae0,_0x4e59e9);var _0x2d382f=util[_0x20f4('0xc4')](_0x20f4('0xd4'),_0xa3f7d4[_0x20f4('0xb8')]['id'],_0x4e59e9);var _0x2bdd53=path[_0x20f4('0xcf')](_0x51aae0,_0x2d382f);var _0x2d2dda=[];if(_0xa3f7d4['query'][_0x20f4('0xd5')]){_0x2d2dda[_0x20f4('0x24')]({'model':db[_0x20f4('0xd6')],'as':_0x20f4('0xd7'),'raw':!![]});}var _0x201c69=[{'model':db[_0x20f4('0x25')],'as':_0x20f4('0xd8'),'attributes':['id',_0x20f4('0xbd'),_0x20f4('0x45'),'to','cc',_0x20f4('0xd9'),'subject',_0x20f4('0xda')],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x2d2dda}];return db['MailInteraction']['find']({'where':{'id':_0xa3f7d4[_0x20f4('0xb8')]['id']},'include':_0x201c69})[_0x20f4('0x18')](handleEntityNotFound(_0x999cdf,null))[_0x20f4('0x18')](function(_0x365be6){if(_0x365be6&&_0x365be6[_0x20f4('0xd8')]){var _0x1af5bb=_0x365be6['get']({'plain':!![]});fs[_0x20f4('0xdb')](_0x5dbb40);return BPromise[_0x20f4('0xdc')](_0x1af5bb[_0x20f4('0xd8')],function(_0x3a5a17,_0x2ee517){var _0x1e56b0={'from':_0x3a5a17[_0x20f4('0x45')],'to':_0x3a5a17['to'],'subject':_0x3a5a17[_0x20f4('0xdd')],'html':htmlEntities[_0x20f4('0xde')](_0x3a5a17[_0x20f4('0xbd')]),'headers':{'Date':moment(_0x3a5a17[_0x20f4('0xda')])[_0x20f4('0xc4')](_0x20f4('0xdf'))},'attachments':[]};if(_0x3a5a17['cc']){_0x1e56b0[_0x20f4('0xe0')]['Cc']=_0x3a5a17['cc'];}if(_0x3a5a17['bcc']){_0x1e56b0[_0x20f4('0xe0')][_0x20f4('0xe1')]=_0x3a5a17[_0x20f4('0xd9')];}return new BPromise(function(_0x382900,_0x58d963){if(_0x3a5a17[_0x20f4('0xd7')]){for(var _0x313773=0x0;_0x313773<_0x3a5a17[_0x20f4('0xd7')][_0x20f4('0x3c')];_0x313773++){var _0x468898=_0x3a5a17[_0x20f4('0xd7')][_0x313773];var _0x12b030=path[_0x20f4('0xcf')](_0x41ffcb,_0x468898[_0x20f4('0xe2')]);if(fs[_0x20f4('0xe3')](_0x12b030)){_0x1e56b0[_0x20f4('0xd5')][_0x20f4('0x24')]({'name':_0x468898[_0x20f4('0x1b')],'contentType':_0x468898[_0x20f4('0x62')],'data':fs['readFileSync'](_0x12b030)});}}}emlformat[_0x20f4('0xe4')](_0x1e56b0,function(_0x4e34ac,_0x191704){if(_0x4e34ac)return _0x58d963(_0x4e34ac);fs[_0x20f4('0xe5')](path[_0x20f4('0xcf')](_0x5dbb40,util[_0x20f4('0xc4')]('message%d.eml',_0x2ee517)),_0x191704);return _0x382900(_0x191704);});});})[_0x20f4('0x18')](function(){return new BPromise(function(_0xa8a2cb,_0x1eb237){zipdir(_0x5dbb40,{'saveTo':_0x2bdd53},function(_0x5363db,_0x47a534){if(_0x5363db)return _0x1eb237(_0x5363db);return _0xa8a2cb(_0x47a534);});})['then'](function(){return new BPromise(function(_0x179859,_0x231eb7){rimraf(_0x5dbb40,function(_0x179464){if(_0x179464)_0x231eb7(_0x179464);return _0x179859();});});})['then'](function(){return _0x999cdf[_0x20f4('0xe6')](_0x2bdd53,_0x2d382f,function(_0x45fea2){if(!_0x45fea2)fs['unlinkSync'](_0x2bdd53);});});});}else{return _0x999cdf[_0x20f4('0xf')](0xc8);}})[_0x20f4('0x2a')](handleError(_0x999cdf,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 2242754..3a3191a 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 _0xf7eb=['Users','findAll','unreadMessages','length','emit','catch','hook','exports','events','MailInteraction','../../mysqldb','setMaxListeners','update','remove','getUsers','then','setDataValue'];(function(_0x4fb92f,_0x4ba277){var _0x479bef=function(_0x590789){while(--_0x590789){_0x4fb92f['push'](_0x4fb92f['shift']());}};_0x479bef(++_0x4ba277);}(_0xf7eb,0x13a));var _0xbf7e=function(_0x2cb39a,_0x161aa1){_0x2cb39a=_0x2cb39a-0x0;var _0x14f3b0=_0xf7eb[_0x2cb39a];return _0x14f3b0;};'use strict';var EventEmitter=require(_0xbf7e('0x0'));var MailInteraction=require('../../mysqldb')['db'][_0xbf7e('0x1')];var MailMessage=require(_0xbf7e('0x2'))['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xbf7e('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xbf7e('0x4'),'afterDestroy':_0xbf7e('0x5')};function emitEvent(_0x56887f){return function(_0x116882,_0x57b18b,_0xe66ae0){_0x116882[_0xbf7e('0x6')]({'attributes':['id'],'raw':!![]})[_0xbf7e('0x7')](function(_0x3e0c96){_0x116882[_0xbf7e('0x8')](_0xbf7e('0x9'),_0x3e0c96['map'](function(_0x1fbe36){return{'id':_0x1fbe36['id']};}));return MailMessage[_0xbf7e('0xa')]({'where':{'MailInteractionId':_0x116882['id'],'direction':'in','read':![]},'raw':!![]});})[_0xbf7e('0x7')](function(_0x1f959e){_0x116882['setDataValue'](_0xbf7e('0xb'),_0x1f959e[_0xbf7e('0xc')]);MailInteractionEvents[_0xbf7e('0xd')](_0x56887f+':'+_0x116882['id'],_0x116882);MailInteractionEvents[_0xbf7e('0xd')](_0x56887f,_0x116882);_0xe66ae0(null);})[_0xbf7e('0xe')](_0xe66ae0(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0xbf7e('0xf')](e,emitEvent(event));}}module[_0xbf7e('0x10')]=MailInteractionEvents; \ No newline at end of file +var _0x4cb7=['MailInteraction','../../mysqldb','MailMessage','setMaxListeners','save','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','hasOwnProperty','hook','exports','events'];(function(_0x3253ab,_0x342f55){var _0x267afc=function(_0x4701ef){while(--_0x4701ef){_0x3253ab['push'](_0x3253ab['shift']());}};_0x267afc(++_0x342f55);}(_0x4cb7,0x6b));var _0x74cb=function(_0xa472f1,_0x3da3b2){_0xa472f1=_0xa472f1-0x0;var _0x2f1df5=_0x4cb7[_0xa472f1];return _0x2f1df5;};'use strict';var EventEmitter=require(_0x74cb('0x0'));var MailInteraction=require('../../mysqldb')['db'][_0x74cb('0x1')];var MailMessage=require(_0x74cb('0x2'))['db'][_0x74cb('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x74cb('0x4')](0x0);var events={'afterCreate':_0x74cb('0x5'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x45fb9c){return function(_0x5b7167,_0x134948,_0x3e18a){_0x5b7167[_0x74cb('0x6')]({'attributes':['id'],'raw':!![]})[_0x74cb('0x7')](function(_0x55bbfe){_0x5b7167[_0x74cb('0x8')](_0x74cb('0x9'),_0x55bbfe[_0x74cb('0xa')](function(_0x38de19){return{'id':_0x38de19['id']};}));return MailMessage[_0x74cb('0xb')]({'where':{'MailInteractionId':_0x5b7167['id'],'direction':'in','read':![]},'raw':!![]});})[_0x74cb('0x7')](function(_0x3a272e){_0x5b7167['setDataValue'](_0x74cb('0xc'),_0x3a272e[_0x74cb('0xd')]);MailInteractionEvents[_0x74cb('0xe')](_0x45fb9c+':'+_0x5b7167['id'],_0x5b7167);MailInteractionEvents[_0x74cb('0xe')](_0x45fb9c,_0x5b7167);_0x3e18a(null);})['catch'](_0x3e18a(null));};}for(var e in events){if(events[_0x74cb('0xf')](e)){var event=events[e];MailInteraction[_0x74cb('0x10')](e,emitEvent(event));}}module[_0x74cb('0x11')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 385c0df..c24ccf4 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 _0x1f4c=['api','moment','bluebird','request-promise','path','rimraf','../../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','get','MailMessage','update','then','utf8mb4','utf8mb4_unicode_ci','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1f4c,0xfb));var _0xc1f4=function(_0x457175,_0x29e638){_0x457175=_0x457175-0x0;var _0x521db2=_0x1f4c[_0x457175];return _0x521db2;};'use strict';var _=require('lodash');var util=require(_0xc1f4('0x0'));var logger=require('../../config/logger')(_0xc1f4('0x1'));var moment=require(_0xc1f4('0x2'));var BPromise=require(_0xc1f4('0x3'));var rp=require(_0xc1f4('0x4'));var fs=require('fs');var path=require(_0xc1f4('0x5'));var rimraf=require(_0xc1f4('0x6'));var config=require(_0xc1f4('0x7'));var attributes=require(_0xc1f4('0x8'));module[_0xc1f4('0x9')]=function(_0x29b9f5,_0x394220){return _0x29b9f5[_0xc1f4('0xa')](_0xc1f4('0xb'),attributes,{'tableName':_0xc1f4('0xc'),'paranoid':![],'indexes':[{'name':_0xc1f4('0xd'),'fields':['subject','to'],'type':_0xc1f4('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0xe2f0c2,_0x81bb59,_0x5e9ecf){if(_0xe2f0c2[_0xc1f4('0xf')]){_0xe2f0c2[_0xc1f4('0x10')]=moment()[_0xc1f4('0x11')](_0xc1f4('0x12'));}if(_0xe2f0c2[_0xc1f4('0x13')]){_0xe2f0c2[_0xc1f4('0x14')]=moment()[_0xc1f4('0x11')]('YYYY-MM-DD\x20HH:mm:ss');}_0x5e9ecf(null,_0x81bb59);},'beforeUpdate':function(_0x26a44f,_0x2748b1,_0x3d618f){if(_0x26a44f[_0xc1f4('0x15')]('substatus')){_0x26a44f['substatusAt']=_0x26a44f['substatus']?moment()[_0xc1f4('0x11')]('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x26a44f[_0xc1f4('0x15')](_0xc1f4('0x13'))){_0x26a44f[_0xc1f4('0x14')]=moment()[_0xc1f4('0x11')](_0xc1f4('0x12'));_0x26a44f['substatus']=null;_0x26a44f[_0xc1f4('0x10')]=null;}_0x3d618f(null,_0x26a44f);},'afterUpdate':function(_0x1a5442,_0x4a84cd,_0x569ba0){var _0x40c45f=_0x29b9f5['models'];var _0x24cb5b=_0x1a5442[_0xc1f4('0x16')]({'plain':!![]});if(_0x24cb5b[_0xc1f4('0x13')]){return _0x40c45f[_0xc1f4('0x17')][_0xc1f4('0x18')]({'read':!![]},{'where':{'MailInteractionId':_0x24cb5b['id']}})[_0xc1f4('0x19')](function(){_0x569ba0();})['catch'](function(_0x3ee2a6){_0x569ba0(_0x3ee2a6);});}else{_0x569ba0();}}},'charset':_0xc1f4('0x1a'),'collate':_0xc1f4('0x1b')});}; \ No newline at end of file +var _0x51eb=['util','../../config/logger','api','moment','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','models','get','update','then','utf8mb4_unicode_ci','lodash'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x51eb,0xbc));var _0xb51e=function(_0x29d368,_0xb04795){_0x29d368=_0x29d368-0x0;var _0x80400a=_0x51eb[_0x29d368];return _0x80400a;};'use strict';var _=require(_0xb51e('0x0'));var util=require(_0xb51e('0x1'));var logger=require(_0xb51e('0x2'))(_0xb51e('0x3'));var moment=require(_0xb51e('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb51e('0x5'));var rimraf=require(_0xb51e('0x6'));var config=require(_0xb51e('0x7'));var attributes=require(_0xb51e('0x8'));module[_0xb51e('0x9')]=function(_0x315299,_0x348ed3){return _0x315299['define'](_0xb51e('0xa'),attributes,{'tableName':_0xb51e('0xb'),'paranoid':![],'indexes':[{'name':_0xb51e('0xc'),'fields':[_0xb51e('0xd'),'to'],'type':_0xb51e('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x5cb86d,_0x7bac3,_0x124a75){if(_0x5cb86d[_0xb51e('0xf')]){_0x5cb86d[_0xb51e('0x10')]=moment()[_0xb51e('0x11')](_0xb51e('0x12'));}if(_0x5cb86d[_0xb51e('0x13')]){_0x5cb86d[_0xb51e('0x14')]=moment()[_0xb51e('0x11')](_0xb51e('0x12'));}_0x124a75(null,_0x7bac3);},'beforeUpdate':function(_0x4aa8bf,_0x4bd137,_0x4cada7){if(_0x4aa8bf[_0xb51e('0x15')](_0xb51e('0xf'))){_0x4aa8bf[_0xb51e('0x10')]=_0x4aa8bf[_0xb51e('0xf')]?moment()[_0xb51e('0x11')](_0xb51e('0x12')):null;}if(_0x4aa8bf['changed']('closed')){_0x4aa8bf[_0xb51e('0x14')]=moment()[_0xb51e('0x11')](_0xb51e('0x12'));_0x4aa8bf[_0xb51e('0xf')]=null;_0x4aa8bf[_0xb51e('0x10')]=null;}_0x4cada7(null,_0x4aa8bf);},'afterUpdate':function(_0x4d67dc,_0x3bc099,_0x1e6cde){var _0x141557=_0x315299[_0xb51e('0x16')];var _0x48850f=_0x4d67dc[_0xb51e('0x17')]({'plain':!![]});if(_0x48850f[_0xb51e('0x13')]){return _0x141557['MailMessage'][_0xb51e('0x18')]({'read':!![]},{'where':{'MailInteractionId':_0x48850f['id']}})[_0xb51e('0x19')](function(){_0x1e6cde();})['catch'](function(_0x316f55){_0x1e6cde(_0x316f55);});}else{_0x1e6cde();}}},'charset':'utf8mb4','collate':_0xb51e('0x1a')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 3e5197b..ede9911 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 _0x7cbc=['lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','socket.io-emitter','./mailInteraction.socket','register','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','error','code','message','UpdateMailInteraction','update','body','options','raw','attributes','stringify','catch','AddTagsToMailInteraction','MailInteraction','find','where','addTags','ids','spread','AddTags'];(function(_0xd26500,_0xfa64ae){var _0x16cdba=function(_0x398c67){while(--_0x398c67){_0xd26500['push'](_0xd26500['shift']());}};_0x16cdba(++_0xfa64ae);}(_0x7cbc,0xa4));var _0xc7cb=function(_0x3eb04d,_0x10b9f9){_0x3eb04d=_0x3eb04d-0x0;var _0x1d8fd2=_0x7cbc[_0x3eb04d];return _0x1d8fd2;};'use strict';var _=require(_0xc7cb('0x0'));var util=require(_0xc7cb('0x1'));var moment=require(_0xc7cb('0x2'));var BPromise=require(_0xc7cb('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc7cb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc7cb('0x5'));var logger=require(_0xc7cb('0x6'))(_0xc7cb('0x7'));var config=require(_0xc7cb('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc7cb('0x9')]['http']({'port':0x232a});config[_0xc7cb('0xa')]=_[_0xc7cb('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xc7cb('0xc'))(new Redis(config[_0xc7cb('0xa')]));require(_0xc7cb('0xd'))[_0xc7cb('0xe')](socket);function respondWithRpcPromise(_0x3aa449,_0xbad7b4,_0x227a0e){return new BPromise(function(_0x10bd25,_0x87af64){return client[_0xc7cb('0xf')](_0x3aa449,_0x227a0e)[_0xc7cb('0x10')](function(_0x106c53){logger[_0xc7cb('0x11')](_0xc7cb('0x12'),_0xbad7b4,_0xc7cb('0x13'));logger[_0xc7cb('0x14')](_0xc7cb('0x15'),_0xbad7b4,_0xc7cb('0x13'),JSON['stringify'](_0x106c53));if(_0x106c53[_0xc7cb('0x16')]){if(_0x106c53[_0xc7cb('0x16')][_0xc7cb('0x17')]===0x1f4){logger[_0xc7cb('0x16')](_0xc7cb('0x12'),_0xbad7b4,_0x106c53[_0xc7cb('0x16')][_0xc7cb('0x18')]);return _0x87af64(_0x106c53[_0xc7cb('0x16')]['message']);}logger[_0xc7cb('0x16')](_0xc7cb('0x12'),_0xbad7b4,_0x106c53[_0xc7cb('0x16')][_0xc7cb('0x18')]);return _0x10bd25(_0x106c53[_0xc7cb('0x16')][_0xc7cb('0x18')]);}else{logger[_0xc7cb('0x11')]('MailInteraction,\x20%s,\x20%s',_0xbad7b4,_0xc7cb('0x13'));_0x10bd25(_0x106c53['result'][_0xc7cb('0x18')]);}})['catch'](function(_0x2f8aec){logger[_0xc7cb('0x16')](_0xc7cb('0x12'),_0xbad7b4,_0x2f8aec);_0x87af64(_0x2f8aec);});});}exports[_0xc7cb('0x19')]=function(_0x564de6){var _0x1b0ee8=this;return new Promise(function(_0x3eeb9c,_0x13ebe9){return db['MailInteraction'][_0xc7cb('0x1a')](_0x564de6[_0xc7cb('0x1b')],{'raw':_0x564de6[_0xc7cb('0x1c')]?_0x564de6[_0xc7cb('0x1c')][_0xc7cb('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x564de6[_0xc7cb('0x1c')]?_0x564de6[_0xc7cb('0x1c')]['where']||null:null,'attributes':_0x564de6[_0xc7cb('0x1c')]?_0x564de6[_0xc7cb('0x1c')][_0xc7cb('0x1e')]||null:null,'limit':_0x564de6[_0xc7cb('0x1c')]?_0x564de6[_0xc7cb('0x1c')]['limit']||null:null})[_0xc7cb('0x10')](function(_0x2f29c6){logger[_0xc7cb('0x11')](_0xc7cb('0x19'),_0x564de6);logger[_0xc7cb('0x14')](_0xc7cb('0x19'),_0x564de6,JSON[_0xc7cb('0x1f')](_0x2f29c6));_0x3eeb9c(_0x2f29c6);})[_0xc7cb('0x20')](function(_0x4d6a9a){logger[_0xc7cb('0x16')](_0xc7cb('0x19'),_0x4d6a9a[_0xc7cb('0x18')],_0x564de6);_0x13ebe9(_0x1b0ee8[_0xc7cb('0x16')](0x1f4,_0x4d6a9a[_0xc7cb('0x18')]));});});};exports[_0xc7cb('0x21')]=function(_0x1c1691){return new Promise(function(_0x3c59e3,_0x10273c){return db[_0xc7cb('0x22')][_0xc7cb('0x23')]({'where':_0x1c1691[_0xc7cb('0x1c')]?_0x1c1691[_0xc7cb('0x1c')][_0xc7cb('0x24')]||null:null})[_0xc7cb('0x10')](function(_0xf40af){if(_0xf40af){return _0xf40af[_0xc7cb('0x25')](_0x1c1691[_0xc7cb('0x1b')][_0xc7cb('0x26')],_['omit'](_0x1c1691[_0xc7cb('0x1b')],[_0xc7cb('0x26'),'id'])||{});}})[_0xc7cb('0x27')](function(_0xacf9a7){logger[_0xc7cb('0x11')](_0xc7cb('0x28'),_0x1c1691);logger[_0xc7cb('0x14')]('AddTags',_0x1c1691,JSON[_0xc7cb('0x1f')](_0xacf9a7));_0x3c59e3(_0xacf9a7);})['catch'](function(_0x13ffbc){logger['error'](_0xc7cb('0x28'),_0x13ffbc[_0xc7cb('0x18')],_0x1c1691);_0x10273c(_this[_0xc7cb('0x16')](0x1f4,_0x13ffbc['message']));});});}; \ No newline at end of file +var _0xad40=['raw','where','attributes','limit','then','UpdateMailInteraction','AddTagsToMailInteraction','ids','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','request','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','MailInteraction','body','options'];(function(_0x2f516f,_0x10197){var _0x5a57f1=function(_0x9e00b5){while(--_0x9e00b5){_0x2f516f['push'](_0x2f516f['shift']());}};_0x5a57f1(++_0x10197);}(_0xad40,0xfa));var _0x0ad4=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xad40[_0x4243a3];return _0x1b2a33;};'use strict';var _=require(_0x0ad4('0x0'));var util=require(_0x0ad4('0x1'));var moment=require(_0x0ad4('0x2'));var BPromise=require(_0x0ad4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0ad4('0x4'));var db=require(_0x0ad4('0x5'))['db'];var utils=require(_0x0ad4('0x6'));var logger=require(_0x0ad4('0x7'))(_0x0ad4('0x8'));var config=require(_0x0ad4('0x9'));var jayson=require(_0x0ad4('0xa'));var client=jayson['client'][_0x0ad4('0xb')]({'port':0x232a});config[_0x0ad4('0xc')]=_[_0x0ad4('0xd')](config[_0x0ad4('0xc')],{'host':_0x0ad4('0xe'),'port':0x18eb});var socket=require(_0x0ad4('0xf'))(new Redis(config[_0x0ad4('0xc')]));require('./mailInteraction.socket')[_0x0ad4('0x10')](socket);function respondWithRpcPromise(_0x3788e9,_0x90d11a,_0x2c5757){return new BPromise(function(_0x2a4ba5,_0xbbd2bd){return client[_0x0ad4('0x11')](_0x3788e9,_0x2c5757)['then'](function(_0x1b9921){logger[_0x0ad4('0x12')](_0x0ad4('0x13'),_0x90d11a,_0x0ad4('0x14'));logger[_0x0ad4('0x15')](_0x0ad4('0x16'),_0x90d11a,_0x0ad4('0x14'),JSON[_0x0ad4('0x17')](_0x1b9921));if(_0x1b9921[_0x0ad4('0x18')]){if(_0x1b9921[_0x0ad4('0x18')]['code']===0x1f4){logger[_0x0ad4('0x18')]('MailInteraction,\x20%s,\x20%s',_0x90d11a,_0x1b9921[_0x0ad4('0x18')]['message']);return _0xbbd2bd(_0x1b9921[_0x0ad4('0x18')]['message']);}logger[_0x0ad4('0x18')]('MailInteraction,\x20%s,\x20%s',_0x90d11a,_0x1b9921[_0x0ad4('0x18')]['message']);return _0x2a4ba5(_0x1b9921[_0x0ad4('0x18')][_0x0ad4('0x19')]);}else{logger['info'](_0x0ad4('0x13'),_0x90d11a,_0x0ad4('0x14'));_0x2a4ba5(_0x1b9921['result'][_0x0ad4('0x19')]);}})[_0x0ad4('0x1a')](function(_0xb7624f){logger[_0x0ad4('0x18')](_0x0ad4('0x13'),_0x90d11a,_0xb7624f);_0xbbd2bd(_0xb7624f);});});}exports['UpdateMailInteraction']=function(_0x5156dd){var _0x2e087d=this;return new Promise(function(_0x481893,_0x5394db){return db[_0x0ad4('0x1b')]['update'](_0x5156dd[_0x0ad4('0x1c')],{'raw':_0x5156dd[_0x0ad4('0x1d')]?_0x5156dd[_0x0ad4('0x1d')][_0x0ad4('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5156dd[_0x0ad4('0x1d')]?_0x5156dd[_0x0ad4('0x1d')][_0x0ad4('0x1f')]||null:null,'attributes':_0x5156dd[_0x0ad4('0x1d')]?_0x5156dd[_0x0ad4('0x1d')][_0x0ad4('0x20')]||null:null,'limit':_0x5156dd[_0x0ad4('0x1d')]?_0x5156dd[_0x0ad4('0x1d')][_0x0ad4('0x21')]||null:null})[_0x0ad4('0x22')](function(_0x594b3a){logger[_0x0ad4('0x12')]('UpdateMailInteraction',_0x5156dd);logger['debug'](_0x0ad4('0x23'),_0x5156dd,JSON[_0x0ad4('0x17')](_0x594b3a));_0x481893(_0x594b3a);})['catch'](function(_0x1da2fc){logger[_0x0ad4('0x18')](_0x0ad4('0x23'),_0x1da2fc[_0x0ad4('0x19')],_0x5156dd);_0x5394db(_0x2e087d['error'](0x1f4,_0x1da2fc[_0x0ad4('0x19')]));});});};exports[_0x0ad4('0x24')]=function(_0x4288cb){return new Promise(function(_0xcbf86e,_0x169555){return db[_0x0ad4('0x1b')]['find']({'where':_0x4288cb[_0x0ad4('0x1d')]?_0x4288cb[_0x0ad4('0x1d')]['where']||null:null})['then'](function(_0x15193d){if(_0x15193d){return _0x15193d['addTags'](_0x4288cb['body'][_0x0ad4('0x25')],_['omit'](_0x4288cb[_0x0ad4('0x1c')],[_0x0ad4('0x25'),'id'])||{});}})[_0x0ad4('0x26')](function(_0x4c4e01){logger[_0x0ad4('0x12')](_0x0ad4('0x27'),_0x4288cb);logger[_0x0ad4('0x15')](_0x0ad4('0x27'),_0x4288cb,JSON[_0x0ad4('0x17')](_0x4c4e01));_0xcbf86e(_0x4c4e01);})[_0x0ad4('0x1a')](function(_0x41a936){logger[_0x0ad4('0x18')]('AddTags',_0x41a936[_0x0ad4('0x19')],_0x4288cb);_0x169555(_this['error'](0x1f4,_0x41a936[_0x0ad4('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 686c213..e802dbe 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 _0xa496=['update','register','mailInteraction:','save','remove'];(function(_0x2b0a86,_0x2ecebd){var _0x955940=function(_0x1988f8){while(--_0x1988f8){_0x2b0a86['push'](_0x2b0a86['shift']());}};_0x955940(++_0x2ecebd);}(_0xa496,0x16b));var _0x6a49=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa496[_0x3dd15e];return _0x231fd0;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=[_0x6a49('0x0'),_0x6a49('0x1'),_0x6a49('0x2')];function createListener(_0x34cfe8,_0x5a5ee3){return function(_0x3a081f){_0x5a5ee3['emit'](_0x34cfe8,_0x3a081f);};}function removeListener(_0x22a111,_0x6c13da){return function(){MailInteractionEvents['removeListener'](_0x22a111,_0x6c13da);};}exports[_0x6a49('0x3')]=function(_0x4be477){for(var _0x311f27=0x0,_0x3399ac=events['length'];_0x311f27<_0x3399ac;_0x311f27++){var _0x5e42a9=events[_0x311f27];var _0xaab31=createListener(_0x6a49('0x4')+_0x5e42a9,_0x4be477);MailInteractionEvents['on'](_0x5e42a9,_0xaab31);}}; \ No newline at end of file +var _0x9eee=['length','mailInteraction:','./mailInteraction.events','save','remove','emit','removeListener','register'];(function(_0x3153ba,_0x5ad671){var _0x3c3321=function(_0x57ae92){while(--_0x57ae92){_0x3153ba['push'](_0x3153ba['shift']());}};_0x3c3321(++_0x5ad671);}(_0x9eee,0x13a));var _0xe9ee=function(_0x2c0a9e,_0x123f8b){_0x2c0a9e=_0x2c0a9e-0x0;var _0x32834b=_0x9eee[_0x2c0a9e];return _0x32834b;};'use strict';var MailInteractionEvents=require(_0xe9ee('0x0'));var events=[_0xe9ee('0x1'),_0xe9ee('0x2'),'update'];function createListener(_0x10d50b,_0x5dd7e7){return function(_0x2a0f01){_0x5dd7e7[_0xe9ee('0x3')](_0x10d50b,_0x2a0f01);};}function removeListener(_0x3271e0,_0x9b4530){return function(){MailInteractionEvents[_0xe9ee('0x4')](_0x3271e0,_0x9b4530);};}exports[_0xe9ee('0x5')]=function(_0x21833e){for(var _0x7208ae=0x0,_0x261f01=events[_0xe9ee('0x6')];_0x7208ae<_0x261f01;_0x7208ae++){var _0x296389=events[_0x7208ae];var _0x192c53=createListener(_0xe9ee('0x7')+_0x296389,_0x21833e);MailInteractionEvents['on'](_0x296389,_0x192c53);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 61fc16c..98136aa 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 _0xdadf=['delete','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','post','tracked','mail','mailmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject'];(function(_0x3bc35b,_0x3e6454){var _0x1e68a1=function(_0x4565c2){while(--_0x4565c2){_0x3bc35b['push'](_0x3bc35b['shift']());}};_0x1e68a1(++_0x3e6454);}(_0xdadf,0x175));var _0xfdad=function(_0x2671f0,_0x5709ec){_0x2671f0=_0x2671f0-0x0;var _0x50ea0e=_0xdadf[_0x2671f0];return _0x50ea0e;};'use strict';var multer=require(_0xfdad('0x0'));var util=require(_0xfdad('0x1'));var path=require('path');var timeout=require(_0xfdad('0x2'));var express=require(_0xfdad('0x3'));var router=express[_0xfdad('0x4')]();var fs_extra=require(_0xfdad('0x5'));var auth=require(_0xfdad('0x6'));var interaction=require(_0xfdad('0x7'));var config=require(_0xfdad('0x8'));var controller=require(_0xfdad('0x9'));router[_0xfdad('0xa')]('/',auth[_0xfdad('0xb')](),controller[_0xfdad('0xc')]);router[_0xfdad('0xa')](_0xfdad('0xd'),auth[_0xfdad('0xb')](),controller[_0xfdad('0xe')]);router[_0xfdad('0xa')](_0xfdad('0xf'),auth[_0xfdad('0xb')](),controller[_0xfdad('0x10')]);router[_0xfdad('0xa')](_0xfdad('0x11'),auth[_0xfdad('0xb')](),controller[_0xfdad('0x12')]);router[_0xfdad('0x13')]('/',auth[_0xfdad('0xb')](),interaction[_0xfdad('0x14')](_0xfdad('0x15'),_0xfdad('0x16')),controller[_0xfdad('0x17')]);router[_0xfdad('0x18')](_0xfdad('0xf'),auth['isAuthenticated'](),controller[_0xfdad('0x19')]);router['put'](_0xfdad('0x1a'),auth[_0xfdad('0xb')](),controller[_0xfdad('0x1b')]);router[_0xfdad('0x18')](_0xfdad('0x1c'),auth[_0xfdad('0xb')](),controller[_0xfdad('0x1d')]);router[_0xfdad('0x1e')]('/:id',auth[_0xfdad('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x3d76=['put','update','/:id/accept','accept','/:id/reject','reject','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','download','post','mailmessage:create','create'];(function(_0x3ab290,_0xbdb111){var _0x4afcf0=function(_0x581723){while(--_0x581723){_0x3ab290['push'](_0x3ab290['shift']());}};_0x4afcf0(++_0xbdb111);}(_0x3d76,0x13c));var _0x63d7=function(_0x11aee5,_0x27fa94){_0x11aee5=_0x11aee5-0x0;var _0x2e8c9d=_0x3d76[_0x11aee5];return _0x2e8c9d;};'use strict';var multer=require(_0x63d7('0x0'));var util=require(_0x63d7('0x1'));var path=require(_0x63d7('0x2'));var timeout=require(_0x63d7('0x3'));var express=require(_0x63d7('0x4'));var router=express[_0x63d7('0x5')]();var fs_extra=require(_0x63d7('0x6'));var auth=require(_0x63d7('0x7'));var interaction=require(_0x63d7('0x8'));var config=require(_0x63d7('0x9'));var controller=require('./mailMessage.controller');router[_0x63d7('0xa')]('/',auth[_0x63d7('0xb')](),controller[_0x63d7('0xc')]);router[_0x63d7('0xa')](_0x63d7('0xd'),auth[_0x63d7('0xb')](),controller['describe']);router[_0x63d7('0xa')](_0x63d7('0xe'),auth['isAuthenticated'](),controller[_0x63d7('0xf')]);router['get']('/:id/download',auth[_0x63d7('0xb')](),controller[_0x63d7('0x10')]);router[_0x63d7('0x11')]('/',auth[_0x63d7('0xb')](),interaction['tracked']('mail',_0x63d7('0x12')),controller[_0x63d7('0x13')]);router[_0x63d7('0x14')](_0x63d7('0xe'),auth[_0x63d7('0xb')](),controller[_0x63d7('0x15')]);router['put'](_0x63d7('0x16'),auth[_0x63d7('0xb')](),controller[_0x63d7('0x17')]);router[_0x63d7('0x14')](_0x63d7('0x18'),auth[_0x63d7('0xb')](),controller[_0x63d7('0x19')]);router['delete'](_0x63d7('0xe'),auth[_0x63d7('0xb')](),controller[_0x63d7('0x1a')]);module[_0x63d7('0x1b')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 9931e6e..f66cd0f 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 _0x314e=['DATE','Chat','Email','sequelize','exports','medium','BOOLEAN','ENUM','out','STRING','TEXT','long','INTEGER'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0x314e,0x12e));var _0xe314=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x314e[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xe314('0x0'));var _=require('lodash');module[_0xe314('0x1')]={'body':{'type':Sequelize['TEXT']('long'),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0xe314('0x2'))},'read':{'type':Sequelize[_0xe314('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xe314('0x4')]('in','out'),'defaultValue':_0xe314('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize[_0xe314('0x6')]},'to':{'type':Sequelize[_0xe314('0x7')](_0xe314('0x8'))},'cc':{'type':Sequelize[_0xe314('0x7')](_0xe314('0x8'))},'bcc':{'type':Sequelize[_0xe314('0x7')]('long')},'subject':{'type':Sequelize[_0xe314('0x7')]},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize[_0xe314('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize[_0xe314('0x3')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xe314('0xa')]},'originTo':{'type':Sequelize['TEXT'](_0xe314('0x8'))},'originCc':{'type':Sequelize[_0xe314('0x7')]('long')},'originChannel':{'type':Sequelize['ENUM']('Email',_0xe314('0xb')),'defaultValue':_0xe314('0xc'),'allowNull':![]}}; \ No newline at end of file +var _0x878c=['long','medium','BOOLEAN','out','STRING','DATE','INTEGER','Email','sequelize','TEXT'];(function(_0x12926a,_0xb3be90){var _0x2db765=function(_0x32e279){while(--_0x32e279){_0x12926a['push'](_0x12926a['shift']());}};_0x2db765(++_0xb3be90);}(_0x878c,0x1de));var _0xc878=function(_0x5d9555,_0x4dc7d1){_0x5d9555=_0x5d9555-0x0;var _0x39fe1e=_0x878c[_0x5d9555];return _0x39fe1e;};'use strict';var Sequelize=require(_0xc878('0x0'));var _=require('lodash');module['exports']={'body':{'type':Sequelize[_0xc878('0x1')](_0xc878('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xc878('0x1')](_0xc878('0x3'))},'read':{'type':Sequelize[_0xc878('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xc878('0x5')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xc878('0x6')](0x1fe)},'from':{'type':Sequelize[_0xc878('0x6')]},'to':{'type':Sequelize[_0xc878('0x1')](_0xc878('0x2'))},'cc':{'type':Sequelize[_0xc878('0x1')](_0xc878('0x2'))},'bcc':{'type':Sequelize[_0xc878('0x1')]('long')},'subject':{'type':Sequelize[_0xc878('0x1')]},'sentAt':{'type':Sequelize[_0xc878('0x7')]},'attach':{'type':Sequelize[_0xc878('0x8')],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize[_0xc878('0x7')]},'originTo':{'type':Sequelize['TEXT'](_0xc878('0x2'))},'originCc':{'type':Sequelize['TEXT']('long')},'originChannel':{'type':Sequelize['ENUM']('Email','Chat'),'defaultValue':_0xc878('0x9'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index f07c500..1e91b54 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 _0x5062=['options','includeAll','rows','params','keys','length','include','find','body','describe','create','direction','out','split','MailAccount','findOne','MailAccountId','List','Contacts','updatedAt','DESC','MailServerOut','Smtp','isNil','service','host','secure','authentication','auth','user','attachments','join','root','basename','CmContact','List\x20not\x20found','SendMail','sendMail','messageId','format','accept','mail','readAt','YYYY-MM-DD\x20HH:mm:ss','get','MailInteraction','MailInteractionId','UserId','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','User','internal','agent','manual','SIP/%s','channel','motionChannel','event','fromString','EventManager','acceptmessage','reject','RejectMessage','rejectMessage','Sequelize','fullname','email','interface','download','toString','server','tmp','message-%s.eml','from','bcc','subject','Attachments','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','push','readFileSync','writeFileSync','unlinkSync','eml-format','moment','util','path','ioredis','html-to-text','../../config/logger','mail-interactions','../../config/environment','redis','defaults','localhost','socket.io-emitter','html-entities','register','jayson/promise','client','http','request','info','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','json','offset','undefined','limit','count','Content-Range','update','then','destroy','end','stack','name','send','index','MailMessage','rawAttributes','fieldName','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL'];(function(_0x4105a8,_0x198324){var _0x553f0c=function(_0x3720f5){while(--_0x3720f5){_0x4105a8['push'](_0x4105a8['shift']());}};_0x553f0c(++_0x198324);}(_0x5062,0x19b));var _0x2506=function(_0x3ae237,_0xfb5aaf){_0x3ae237=_0x3ae237-0x0;var _0xa6d62a=_0x5062[_0x3ae237];return _0xa6d62a;};'use strict';var emlformat=require(_0x2506('0x0'));var moment=require(_0x2506('0x1'));var BPromise=require('bluebird');var util=require(_0x2506('0x2'));var path=require(_0x2506('0x3'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x2506('0x4'));var htmlToText=require(_0x2506('0x5'));var qs=require('../../components/parsers/qs');var logger=require(_0x2506('0x6'))('api');var interaction_log=require('../../config/logger')(_0x2506('0x7'));var config=require(_0x2506('0x8'));var db=require('../../mysqldb')['db'];config[_0x2506('0x9')]=_[_0x2506('0xa')](config[_0x2506('0x9')],{'host':_0x2506('0xb'),'port':0x18eb});var socket=require(_0x2506('0xc'))(new Redis(config[_0x2506('0x9')]));var htmlEntities=require(_0x2506('0xd'));require('./mailMessage.socket')[_0x2506('0xe')](socket);var jayson=require(_0x2506('0xf'));var client=jayson[_0x2506('0x10')][_0x2506('0x11')]({'port':0x232c});var client9003=jayson[_0x2506('0x10')][_0x2506('0x11')]({'port':0x232b});var client9002=jayson['client'][_0x2506('0x11')]({'port':0x232a});function respondWithRpcPromise(_0x2fcf5c,_0x5a44c2,_0x1dc445,_0x5cc04e){return new BPromise(function(_0xfea0d3,_0x457bbb){var _0x5d8ad6=_0x5cc04e||client;return _0x5d8ad6[_0x2506('0x12')](_0x2fcf5c,_0x1dc445)['then'](function(_0x1eb72f){logger[_0x2506('0x13')](_0x2506('0x14'),_0x5a44c2,_0x2506('0x15'));logger['debug'](_0x2506('0x16'),_0x5a44c2,_0x2506('0x15'),JSON[_0x2506('0x17')](_0x1eb72f));if(_0x1eb72f['error']){if(_0x1eb72f[_0x2506('0x18')][_0x2506('0x19')]===0x1f4){logger['error'](_0x2506('0x14'),_0x5a44c2,_0x1eb72f[_0x2506('0x18')][_0x2506('0x1a')]);return _0x457bbb(_0x1eb72f[_0x2506('0x18')]['message']);}logger[_0x2506('0x18')]('MailMessage,\x20%s,\x20%s',_0x5a44c2,_0x1eb72f[_0x2506('0x18')]['message']);return _0xfea0d3(_0x1eb72f[_0x2506('0x18')][_0x2506('0x1a')]);}else{logger['info'](_0x2506('0x14'),_0x5a44c2,_0x2506('0x15'));_0xfea0d3(_0x1eb72f[_0x2506('0x1b')][_0x2506('0x1a')]);}})[_0x2506('0x1c')](function(_0x2c83cb){logger[_0x2506('0x18')](_0x2506('0x14'),_0x5a44c2,_0x2c83cb);_0x457bbb(_0x2c83cb);});});}function respondWithResult(_0x2e68d0,_0x367f7f){_0x367f7f=_0x367f7f||0xc8;return function(_0x18f485){if(_0x18f485){return _0x2e68d0[_0x2506('0x1d')](_0x367f7f)[_0x2506('0x1e')](_0x18f485);}};}function respondWithFilteredResult(_0x13ec8b,_0x3eb938){return function(_0x3aade3){if(_0x3aade3){var _0x5a4ccd=typeof _0x3eb938[_0x2506('0x1f')]===_0x2506('0x20')&&typeof _0x3eb938[_0x2506('0x21')]==='undefined';var _0x3fcbef=_0x3aade3['count'];var _0x33c338=_0x5a4ccd?0x0:_0x3eb938[_0x2506('0x1f')];var _0x46841d=_0x5a4ccd?_0x3aade3[_0x2506('0x22')]:_0x3eb938[_0x2506('0x1f')]+_0x3eb938[_0x2506('0x21')];var _0x5daee9;if(_0x46841d>=_0x3fcbef){_0x46841d=_0x3fcbef;_0x5daee9=0xc8;}else{_0x5daee9=0xce;}_0x13ec8b[_0x2506('0x1d')](_0x5daee9);return _0x13ec8b['set'](_0x2506('0x23'),_0x33c338+'-'+_0x46841d+'/'+_0x3fcbef)[_0x2506('0x1e')](_0x3aade3);}return null;};}function saveUpdates(_0x47cd87){return function(_0x2413d5){if(_0x2413d5){return _0x2413d5[_0x2506('0x24')](_0x47cd87)[_0x2506('0x25')](function(_0x5c580e){return _0x5c580e;});}return null;};}function removeEntity(_0x429eb6){return function(_0x3e8d6b){if(_0x3e8d6b){return _0x3e8d6b[_0x2506('0x26')]()[_0x2506('0x25')](function(){_0x429eb6['status'](0xcc)[_0x2506('0x27')]();});}};}function handleEntityNotFound(_0x1bf46a){return function(_0x36451b){if(!_0x36451b){_0x1bf46a['sendStatus'](0x194);}return _0x36451b;};}function handleError(_0x2cbb00,_0x5c1a14){_0x5c1a14=_0x5c1a14||0x1f4;return function(_0x174b4b){logger[_0x2506('0x18')](_0x174b4b[_0x2506('0x28')]);if(_0x174b4b[_0x2506('0x29')]){delete _0x174b4b[_0x2506('0x29')];}_0x2cbb00['status'](_0x5c1a14)[_0x2506('0x2a')](_0x174b4b);};}exports[_0x2506('0x2b')]=function(_0x8d79b5,_0x58bc73){var _0x142650={},_0xf9ebc6={},_0x325039={'count':0x0,'rows':[]};var _0x22c910=_['map'](db[_0x2506('0x2c')][_0x2506('0x2d')],function(_0x50f3fa){return{'name':_0x50f3fa[_0x2506('0x2e')],'type':_0x50f3fa['type']['key']};});_0xf9ebc6[_0x2506('0x2f')]=_[_0x2506('0x30')](_0x22c910,_0x2506('0x29'));_0xf9ebc6['query']=_['keys'](_0x8d79b5[_0x2506('0x31')]);_0xf9ebc6[_0x2506('0x32')]=_[_0x2506('0x33')](_0xf9ebc6[_0x2506('0x2f')],_0xf9ebc6['query']);_0x142650[_0x2506('0x34')]=_[_0x2506('0x33')](_0xf9ebc6[_0x2506('0x2f')],qs[_0x2506('0x35')](_0x8d79b5[_0x2506('0x31')]['fields']));_0x142650[_0x2506('0x34')]=_0x142650[_0x2506('0x34')]['length']?_0x142650['attributes']:_0xf9ebc6['model'];if(!_0x8d79b5[_0x2506('0x31')][_0x2506('0x36')](_0x2506('0x37'))){_0x142650[_0x2506('0x21')]=qs['limit'](_0x8d79b5['query']['limit']);_0x142650[_0x2506('0x1f')]=qs['offset'](_0x8d79b5['query'][_0x2506('0x1f')]);}_0x142650[_0x2506('0x38')]=qs[_0x2506('0x39')](_0x8d79b5[_0x2506('0x31')]['sort']);_0x142650[_0x2506('0x3a')]=qs[_0x2506('0x32')](_['pick'](_0x8d79b5[_0x2506('0x31')],_0xf9ebc6[_0x2506('0x32')]),_0x22c910);if(_0x8d79b5['query'][_0x2506('0x3b')]){_0x142650[_0x2506('0x3a')]=_[_0x2506('0x3c')](_0x142650[_0x2506('0x3a')],{'$or':_['map'](_0x22c910,function(_0x492553){if(_0x492553[_0x2506('0x3d')]!==_0x2506('0x3e')){var _0x3d1130={};_0x3d1130[_0x492553[_0x2506('0x29')]]={'$like':'%'+_0x8d79b5['query'][_0x2506('0x3b')]+'%'};return _0x3d1130;}})});}_0x142650=_[_0x2506('0x3c')]({},_0x142650,_0x8d79b5[_0x2506('0x3f')]);var _0x308865={'where':_0x142650[_0x2506('0x3a')]};return db['MailMessage'][_0x2506('0x22')](_0x308865)[_0x2506('0x25')](function(_0x1ca46f){_0x325039[_0x2506('0x22')]=_0x1ca46f;if(_0x8d79b5[_0x2506('0x31')][_0x2506('0x40')]){_0x142650['include']=[{'all':!![]}];}return db[_0x2506('0x2c')]['findAll'](_0x142650);})[_0x2506('0x25')](function(_0x1d115e){_0x325039[_0x2506('0x41')]=_0x1d115e;return _0x325039;})['then'](respondWithFilteredResult(_0x58bc73,_0x142650))['catch'](handleError(_0x58bc73,null));};exports['show']=function(_0x41b581,_0x171976){var _0xbd226b={'raw':!![],'where':{'id':_0x41b581[_0x2506('0x42')]['id']}},_0x4d7b5d={};_0x4d7b5d[_0x2506('0x2f')]=_[_0x2506('0x43')](db[_0x2506('0x2c')][_0x2506('0x2d')]);_0x4d7b5d[_0x2506('0x31')]=_[_0x2506('0x43')](_0x41b581[_0x2506('0x31')]);_0x4d7b5d['filters']=_['intersection'](_0x4d7b5d['model'],_0x4d7b5d['query']);_0xbd226b[_0x2506('0x34')]=_[_0x2506('0x33')](_0x4d7b5d[_0x2506('0x2f')],qs[_0x2506('0x35')](_0x41b581['query'][_0x2506('0x35')]));_0xbd226b[_0x2506('0x34')]=_0xbd226b[_0x2506('0x34')][_0x2506('0x44')]?_0xbd226b[_0x2506('0x34')]:_0x4d7b5d[_0x2506('0x2f')];if(_0x41b581[_0x2506('0x31')][_0x2506('0x40')]){_0xbd226b[_0x2506('0x45')]=[{'all':!![]}];}_0xbd226b=_[_0x2506('0x3c')]({},_0xbd226b,_0x41b581[_0x2506('0x3f')]);return db[_0x2506('0x2c')][_0x2506('0x46')](_0xbd226b)[_0x2506('0x25')](handleEntityNotFound(_0x171976,null))['then'](respondWithResult(_0x171976,null))['catch'](handleError(_0x171976,null));};exports[_0x2506('0x24')]=function(_0x21ad19,_0x29c664){if(_0x21ad19['body']['id']){delete _0x21ad19[_0x2506('0x47')]['id'];}return db['MailMessage'][_0x2506('0x46')]({'where':{'id':_0x21ad19[_0x2506('0x42')]['id']}})['then'](handleEntityNotFound(_0x29c664,null))[_0x2506('0x25')](saveUpdates(_0x21ad19[_0x2506('0x47')],null))['then'](respondWithResult(_0x29c664,null))[_0x2506('0x1c')](handleError(_0x29c664,null));};exports[_0x2506('0x26')]=function(_0x37740f,_0x1df881){return db[_0x2506('0x2c')][_0x2506('0x46')]({'where':{'id':_0x37740f[_0x2506('0x42')]['id']}})[_0x2506('0x25')](handleEntityNotFound(_0x1df881,null))['then'](removeEntity(_0x1df881,null))[_0x2506('0x1c')](handleError(_0x1df881,null));};exports[_0x2506('0x48')]=function(_0x270d98,_0x1abcd1){return db['MailMessage'][_0x2506('0x48')]()['then'](respondWithResult(_0x1abcd1,null))['catch'](handleError(_0x1abcd1,null));};exports[_0x2506('0x49')]=function(_0x3c8ca2,_0x4a8fde){return db[_0x2506('0x2c')][_0x2506('0x49')](_0x3c8ca2[_0x2506('0x47')])[_0x2506('0x25')](function(_0x5f0957){if(_0x5f0957){if(_0x5f0957[_0x2506('0x4a')]===_0x2506('0x4b')&&!_0x5f0957['secret']){var _0x98690c,_0x51efe5,_0x314d0c;if(_0x3c8ca2['body']['to']){_0x51efe5=_0x3c8ca2['body']['to'][_0x2506('0x4c')](',')[0x0];}return db[_0x2506('0x4d')][_0x2506('0x4e')]({'where':{'id':_0x5f0957[_0x2506('0x4f')]},'include':[{'model':db['CmList'],'as':_0x2506('0x50'),'include':[{'model':db['CmContact'],'as':_0x2506('0x51'),'where':{'email':_0x51efe5},'limit':0x1,'order':[[_0x2506('0x52'),_0x2506('0x53')]]}]},{'model':db[_0x2506('0x54')],'as':'Smtp','raw':!![]}]})[_0x2506('0x25')](function(_0x43277d){_0x98690c=_0x43277d;if(_0x98690c&&_0x98690c[_0x2506('0x55')]){var _0x33065e={'tls':{'rejectUnauthorized':![]}};if(_[_0x2506('0x56')](_0x98690c[_0x2506('0x55')][_0x2506('0x57')])){_0x33065e[_0x2506('0x58')]=_0x98690c[_0x2506('0x55')][_0x2506('0x58')];_0x33065e['port']=_0x98690c[_0x2506('0x55')]['port'];_0x33065e['secure']=_0x98690c[_0x2506('0x55')][_0x2506('0x59')];if(_0x98690c[_0x2506('0x55')][_0x2506('0x5a')]){_0x33065e[_0x2506('0x5b')]={'user':_0x98690c[_0x2506('0x55')][_0x2506('0x5c')],'pass':_0x98690c[_0x2506('0x55')]['pass']};}}else{_0x33065e[_0x2506('0x57')]=_0x98690c['Smtp']['service'];_0x33065e[_0x2506('0x5b')]={'user':_0x98690c[_0x2506('0x55')][_0x2506('0x5c')],'pass':_0x98690c[_0x2506('0x55')]['pass']};_0x33065e[_0x2506('0x59')]=_0x98690c['Smtp'][_0x2506('0x59')];}if(_0x3c8ca2[_0x2506('0x47')][_0x2506('0x5d')]&&_0x3c8ca2[_0x2506('0x47')][_0x2506('0x5d')][_0x2506('0x44')]){for(var _0x45ced3=0x0;_0x45ced3<_0x3c8ca2[_0x2506('0x47')][_0x2506('0x5d')]['length'];_0x45ced3+=0x1){_0x3c8ca2['body'][_0x2506('0x5d')][_0x45ced3]={'filename':_0x3c8ca2['body'][_0x2506('0x5d')][_0x45ced3][_0x2506('0x29')],'path':path[_0x2506('0x5e')](config[_0x2506('0x5f')],'server/files/attachments',_0x3c8ca2[_0x2506('0x47')][_0x2506('0x5d')][_0x45ced3][_0x2506('0x60')])};}}_0x314d0c={'account':_0x33065e,'message':_0x3c8ca2[_0x2506('0x47')]};return;}})[_0x2506('0x25')](function(){if(_0x98690c[_0x2506('0x50')]){if(_0x98690c[_0x2506('0x50')][_0x2506('0x51')][_0x2506('0x44')]){return _0x98690c[_0x2506('0x50')][_0x2506('0x51')][0x0];}else{return db[_0x2506('0x61')]['create'](_[_0x2506('0xa')](_0x3c8ca2[_0x2506('0x47')],{'firstName':_0x3c8ca2['body']['to'],'email':_0x3c8ca2[_0x2506('0x47')]['to'],'phone':_0x3c8ca2[_0x2506('0x47')]['to'],'ListId':_0x98690c['ListId']}));}}else{throw new Error(_0x2506('0x62'));}})[_0x2506('0x25')](function(){if(_0x314d0c){return respondWithRpcPromise(_0x2506('0x63'),_0x2506('0x64'),_0x314d0c,client9003)[_0x2506('0x25')](function(_0x473f13){return _0x5f0957[_0x2506('0x24')]({'read':!![],'messageId':_0x473f13[_0x2506('0x65')],'sentAt':moment()[_0x2506('0x66')]('YYYY-MM-DD\x20HH:mm:ss')});})['catch'](function(_0x398878){logger[_0x2506('0x18')]('%s',JSON[_0x2506('0x17')](_0x398878));return _0x5f0957;});}return _0x5f0957;});}return _0x5f0957;}})[_0x2506('0x25')](respondWithResult(_0x4a8fde,0xc9))['catch'](handleError(_0x4a8fde,null));};exports[_0x2506('0x67')]=function(_0x47f0fc,_0x450d68){var _0x2c2bbe={'agent':{},'channel':_0x2506('0x68')};if(_0x47f0fc['body']['id']){delete _0x47f0fc[_0x2506('0x47')]['id'];}_0x47f0fc[_0x2506('0x47')]['read']=!![];_0x47f0fc[_0x2506('0x47')][_0x2506('0x69')]=moment()[_0x2506('0x66')](_0x2506('0x6a'));_0x47f0fc[_0x2506('0x47')]['UserId']=_0x47f0fc[_0x2506('0x47')]['UserId']||_0x47f0fc[_0x2506('0x5c')]['id'];_0x2c2bbe['agent']['id']=_0x47f0fc['body']['UserId'];return db['MailMessage']['find']({'where':{'id':_0x47f0fc[_0x2506('0x42')]['id'],'UserId':null}})[_0x2506('0x25')](handleEntityNotFound(_0x450d68,null))[_0x2506('0x25')](saveUpdates(_0x47f0fc['body'],null))[_0x2506('0x25')](function(_0x1b8824){if(_0x1b8824){_0x2c2bbe[_0x2506('0x1a')]=_0x1b8824[_0x2506('0x6b')]({'plain':!![]});return db[_0x2506('0x6c')][_0x2506('0x46')]({'where':{'id':_0x1b8824[_0x2506('0x6d')]}});}return null;})[_0x2506('0x25')](handleEntityNotFound(_0x450d68,null))[_0x2506('0x25')](function(_0x3c8787){if(_0x3c8787){return _0x3c8787[_0x2506('0x24')]({'UserId':_0x47f0fc[_0x2506('0x47')][_0x2506('0x6e')],'read1stAt':_['isNil'](_0x3c8787[_0x2506('0x6f')])?moment()[_0x2506('0x66')](_0x2506('0x6a')):undefined});}return null;})[_0x2506('0x25')](function(_0x5b1897){if(_0x5b1897){_0x2c2bbe[_0x2506('0x70')]=_0x5b1897[_0x2506('0x6b')]({'plain':!![]});interaction_log[_0x2506('0x13')](_0x2506('0x71'),_0x47f0fc[_0x2506('0x5c')]['id'],_0x47f0fc['user'][_0x2506('0x29')],_0x47f0fc['user'][_0x2506('0x72')],_0x2c2bbe['interaction']['id'],_0x47f0fc[_0x2506('0x47')]?JSON['stringify'](_0x47f0fc['body']):_0x2506('0x73'));return respondWithRpcPromise(_0x2506('0x74'),_0x2506('0x75'),_0x2c2bbe);}return null;})[_0x2506('0x25')](function(_0x3031c9){var _0x42a511=_0x2506('0x76')+_0x3031c9['message'][_0x2506('0x77')];return db[_0x2506('0x78')][_0x2506('0x31')](_0x42a511,{'type':db['Sequelize'][_0x2506('0x79')][_0x2506('0x7a')],'raw':!![]})[_0x2506('0x25')](function(_0x13c386){return _0x13c386;});})[_0x2506('0x25')](function(_0x39c1bc){if(_0x39c1bc){_0x2c2bbe[_0x2506('0x1a')][_0x2506('0x7b')]=_0x39c1bc[0x0];if(!_0x47f0fc[_0x2506('0x47')][_0x2506('0x6e')])return;return db[_0x2506('0x7c')][_0x2506('0x46')]({'where':{'id':_0x47f0fc[_0x2506('0x47')]['UserId'],'role':'agent'},'attributes':['id',_0x2506('0x29'),'fullname','email',_0x2506('0x7d')],'raw':!![]});}return null;})[_0x2506('0x25')](function(_0x188543){if(!_0x188543)return null;_0x2c2bbe[_0x2506('0x1a')][_0x2506('0x7e')]=_0x188543;return _0x2c2bbe;})['then'](function(_0x681280){if(_0x681280){if(_0x47f0fc['body'][_0x2506('0x7f')]){_0x2c2bbe[_0x2506('0x1a')]['interface']=util[_0x2506('0x66')](_0x2506('0x80'),_0x47f0fc[_0x2506('0x5c')][_0x2506('0x29')]);_0x2c2bbe[_0x2506('0x1a')][_0x2506('0x81')]=_0x2c2bbe['channel'];_0x2c2bbe[_0x2506('0x1a')][_0x2506('0x82')]=_0x2c2bbe[_0x2506('0x81')];_0x2c2bbe[_0x2506('0x1a')][_0x2506('0x83')]=_0x2506('0x67');_0x2c2bbe[_0x2506('0x1a')][_0x2506('0x47')]=htmlToText[_0x2506('0x84')](_0x2c2bbe['message'][_0x2506('0x47')]);return respondWithRpcPromise(_0x2506('0x85'),_0x2506('0x85'),{'event':_0x2506('0x86'),'message':_0x2c2bbe[_0x2506('0x1a')]},client9002)[_0x2506('0x25')](function(){return _0x2c2bbe;});}return _0x2c2bbe;}return null;})[_0x2506('0x25')](respondWithResult(_0x450d68,null))[_0x2506('0x1c')](handleError(_0x450d68,null));};exports[_0x2506('0x87')]=function(_0x1062ee,_0x16652c){var _0x118a54={'agent':{},'channel':_0x2506('0x68')};if(_0x1062ee[_0x2506('0x47')]['id']){delete _0x1062ee['body']['id'];}_0x1062ee['body'][_0x2506('0x6e')]=_0x1062ee[_0x2506('0x47')][_0x2506('0x6e')]||_0x1062ee[_0x2506('0x5c')]['id'];_0x118a54[_0x2506('0x7e')]['id']=_0x1062ee['body'][_0x2506('0x6e')];return db[_0x2506('0x2c')][_0x2506('0x46')]({'where':{'id':_0x1062ee[_0x2506('0x42')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x16652c,null))['then'](function(_0x5a9ba4){if(_0x5a9ba4){_0x118a54[_0x2506('0x1a')]=_0x5a9ba4[_0x2506('0x6b')]({'plain':!![]});return db['MailInteraction']['find']({'where':{'id':_0x5a9ba4[_0x2506('0x6d')]}});}return null;})[_0x2506('0x25')](handleEntityNotFound(_0x16652c,null))['then'](function(_0x342fb4){if(_0x342fb4){_0x118a54[_0x2506('0x70')]=_0x342fb4[_0x2506('0x6b')]({'plain':!![]});interaction_log[_0x2506('0x13')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1062ee[_0x2506('0x5c')]['id'],_0x1062ee[_0x2506('0x5c')][_0x2506('0x29')],_0x1062ee['user']['role'],_0x118a54[_0x2506('0x70')]['id'],_0x1062ee['body']?JSON[_0x2506('0x17')](_0x1062ee[_0x2506('0x47')]):_0x2506('0x73'));return respondWithRpcPromise(_0x2506('0x88'),_0x2506('0x89'),_0x118a54);}return null;})[_0x2506('0x25')](function(_0x27e891){var _0x44e511=_0x2506('0x76')+_0x27e891[_0x2506('0x1a')][_0x2506('0x77')];return db['sequelize'][_0x2506('0x31')](_0x44e511,{'type':db[_0x2506('0x8a')]['QueryTypes']['SELECT'],'raw':!![]})['then'](function(_0x2cab17){return _0x2cab17;});})[_0x2506('0x25')](function(_0x440815){if(_0x440815){_0x118a54[_0x2506('0x1a')][_0x2506('0x7b')]=_0x440815[0x0];if(!_0x1062ee[_0x2506('0x47')][_0x2506('0x6e')])return;return db[_0x2506('0x7c')][_0x2506('0x46')]({'where':{'id':_0x1062ee['body'][_0x2506('0x6e')],'role':_0x2506('0x7e')},'attributes':['id',_0x2506('0x29'),_0x2506('0x8b'),_0x2506('0x8c'),_0x2506('0x7d')],'raw':!![]});}return null;})[_0x2506('0x25')](function(_0x426560){if(!_0x426560)return null;_0x118a54['message'][_0x2506('0x7e')]=_0x426560;return _0x118a54;})[_0x2506('0x25')](function(_0x3b7652){if(_0x3b7652){_0x3b7652['message'][_0x2506('0x8d')]=util[_0x2506('0x66')](_0x2506('0x80'),_0x1062ee[_0x2506('0x5c')][_0x2506('0x29')]);_0x3b7652[_0x2506('0x1a')][_0x2506('0x81')]=_0x118a54['channel'];_0x3b7652[_0x2506('0x1a')][_0x2506('0x82')]=_0x118a54[_0x2506('0x81')];_0x3b7652[_0x2506('0x1a')][_0x2506('0x83')]='reject';_0x3b7652[_0x2506('0x1a')]['body']=htmlToText[_0x2506('0x84')](_0x118a54[_0x2506('0x1a')]['body']);respondWithRpcPromise(_0x2506('0x85'),_0x2506('0x85'),{'event':'rejectmessage','message':_0x3b7652['message']},client9002);return _0x118a54;}return null;})[_0x2506('0x25')](respondWithResult(_0x16652c,null))['catch'](handleError(_0x16652c,null));};exports[_0x2506('0x8e')]=function(_0x72614e,_0x24375a){var _0x2094f3=moment()['unix']()[_0x2506('0x8f')]();var _0x2551de=path['join'](config['root'],_0x2506('0x90'),'files',_0x2506('0x91'));var _0x123d31=path[_0x2506('0x5e')](config[_0x2506('0x5f')],_0x2506('0x90'),'files',_0x2506('0x5d'));var _0x25ee92=util[_0x2506('0x66')](_0x2506('0x92'),_0x2094f3);return db[_0x2506('0x2c')][_0x2506('0x46')]({'where':{'id':_0x72614e[_0x2506('0x42')]['id']},'attributes':['id',_0x2506('0x47'),_0x2506('0x93'),'to','cc',_0x2506('0x94'),_0x2506('0x95'),'createdAt'],'include':_0x72614e[_0x2506('0x31')][_0x2506('0x5d')]?[{'model':db['Attachment'],'as':_0x2506('0x96')}]:undefined})[_0x2506('0x25')](handleEntityNotFound(_0x24375a,null))[_0x2506('0x25')](function(_0x1ec2c5){if(_0x1ec2c5){var _0x365ab7=_0x1ec2c5;var _0x30a516={'from':_0x365ab7[_0x2506('0x93')],'to':_0x365ab7['to'],'subject':_0x365ab7['subject'],'html':htmlEntities[_0x2506('0x97')](_0x365ab7[_0x2506('0x47')]),'headers':{'Date':moment(_0x365ab7['createdAt'])[_0x2506('0x66')](_0x2506('0x98'))},'attachments':[]};if(_0x1ec2c5['cc']){_0x30a516['headers']['Cc']=_0x1ec2c5['cc'];}if(_0x1ec2c5[_0x2506('0x94')]){_0x30a516[_0x2506('0x99')]['Bcc']=_0x1ec2c5['bcc'];}return new BPromise(function(_0x2a2c5f,_0x302067){if(_0x1ec2c5[_0x2506('0x96')]){for(var _0x2a5e1b=0x0;_0x2a5e1b<_0x1ec2c5['Attachments'][_0x2506('0x44')];_0x2a5e1b++){var _0x461867=_0x1ec2c5[_0x2506('0x96')][_0x2a5e1b];var _0xf1ad34=path[_0x2506('0x5e')](_0x123d31,_0x461867[_0x2506('0x60')]);if(fs['existsSync'](_0xf1ad34)){_0x30a516['attachments'][_0x2506('0x9a')]({'name':_0x461867[_0x2506('0x29')],'contentType':_0x461867['type'],'data':fs[_0x2506('0x9b')](_0xf1ad34)});}}}emlformat['build'](_0x30a516,function(_0x4ed38f,_0x43c688){if(_0x4ed38f)return _0x302067(_0x4ed38f);fs[_0x2506('0x9c')](path[_0x2506('0x5e')](_0x2551de,_0x25ee92),_0x43c688);return _0x2a2c5f(_0x43c688);});});}})[_0x2506('0x25')](function(_0x55701a){if(_0x55701a){return _0x24375a[_0x2506('0x8e')](path[_0x2506('0x5e')](_0x2551de,_0x25ee92),_0x25ee92,function(_0x1fecdd){if(!_0x1fecdd)fs[_0x2506('0x9d')](path[_0x2506('0x5e')](_0x2551de,_0x25ee92));});}})[_0x2506('0x1c')](handleError(_0x24375a,null));}; \ No newline at end of file +var _0x85cd=['debug','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','MailMessage,\x20%s,\x20%s','result','catch','status','json','undefined','limit','count','offset','set','Content-Range','update','destroy','end','sendStatus','stack','name','send','index','MailMessage','rawAttributes','fieldName','key','model','map','keys','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','intersection','find','body','params','describe','create','out','split','MailAccount','findOne','MailAccountId','CmList','CmContact','Contacts','updatedAt','DESC','MailServerOut','Smtp','isNil','service','host','port','secure','authentication','auth','user','pass','attachments','join','root','server/files/attachments','List','ListId','List\x20not\x20found','SendMail','sendMail','accept','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','get','MailInteraction','MailInteractionId','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','agent','manual','interface','format','channel','event','fromString','EventManager','acceptmessage','reject','mail','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','sequelize','SIP/%s','rejectmessage','unix','toString','server','tmp','from','subject','Attachment','Attachments','decode','createdAt','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','basename','existsSync','push','readFileSync','build','writeFileSync','eml-format','moment','util','path','lodash','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','mail-interactions','../../config/environment','defaults','localhost','socket.io-emitter','redis','html-entities','register','jayson/promise','client','http','request','then','info'];(function(_0x3ce3c,_0x319337){var _0x55a2c9=function(_0x1568d0){while(--_0x1568d0){_0x3ce3c['push'](_0x3ce3c['shift']());}};_0x55a2c9(++_0x319337);}(_0x85cd,0x13f));var _0xd85c=function(_0x4115d7,_0x5574cc){_0x4115d7=_0x4115d7-0x0;var _0x41ddf5=_0x85cd[_0x4115d7];return _0x41ddf5;};'use strict';var emlformat=require(_0xd85c('0x0'));var moment=require(_0xd85c('0x1'));var BPromise=require('bluebird');var util=require(_0xd85c('0x2'));var path=require(_0xd85c('0x3'));var fs=require('fs');var _=require(_0xd85c('0x4'));var Redis=require(_0xd85c('0x5'));var htmlToText=require(_0xd85c('0x6'));var qs=require(_0xd85c('0x7'));var logger=require('../../config/logger')('api');var interaction_log=require(_0xd85c('0x8'))(_0xd85c('0x9'));var config=require(_0xd85c('0xa'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xd85c('0xb')](config['redis'],{'host':_0xd85c('0xc'),'port':0x18eb});var socket=require(_0xd85c('0xd'))(new Redis(config[_0xd85c('0xe')]));var htmlEntities=require(_0xd85c('0xf'));require('./mailMessage.socket')[_0xd85c('0x10')](socket);var jayson=require(_0xd85c('0x11'));var client=jayson[_0xd85c('0x12')][_0xd85c('0x13')]({'port':0x232c});var client9003=jayson[_0xd85c('0x12')][_0xd85c('0x13')]({'port':0x232b});var client9002=jayson['client'][_0xd85c('0x13')]({'port':0x232a});function respondWithRpcPromise(_0x49e614,_0x1c9adc,_0x1a75c7,_0x6a40a0){return new BPromise(function(_0xfed99f,_0x491b69){var _0x2dfa2b=_0x6a40a0||client;return _0x2dfa2b[_0xd85c('0x14')](_0x49e614,_0x1a75c7)[_0xd85c('0x15')](function(_0x260e5e){logger[_0xd85c('0x16')]('MailMessage,\x20%s,\x20%s',_0x1c9adc,'request\x20sent');logger[_0xd85c('0x17')](_0xd85c('0x18'),_0x1c9adc,_0xd85c('0x19'),JSON[_0xd85c('0x1a')](_0x260e5e));if(_0x260e5e['error']){if(_0x260e5e[_0xd85c('0x1b')][_0xd85c('0x1c')]===0x1f4){logger[_0xd85c('0x1b')]('MailMessage,\x20%s,\x20%s',_0x1c9adc,_0x260e5e[_0xd85c('0x1b')]['message']);return _0x491b69(_0x260e5e[_0xd85c('0x1b')][_0xd85c('0x1d')]);}logger['error'](_0xd85c('0x1e'),_0x1c9adc,_0x260e5e['error'][_0xd85c('0x1d')]);return _0xfed99f(_0x260e5e[_0xd85c('0x1b')][_0xd85c('0x1d')]);}else{logger['info']('MailMessage,\x20%s,\x20%s',_0x1c9adc,'request\x20sent');_0xfed99f(_0x260e5e[_0xd85c('0x1f')][_0xd85c('0x1d')]);}})[_0xd85c('0x20')](function(_0x4b044f){logger[_0xd85c('0x1b')](_0xd85c('0x1e'),_0x1c9adc,_0x4b044f);_0x491b69(_0x4b044f);});});}function respondWithResult(_0x29c0a3,_0x3f4c3b){_0x3f4c3b=_0x3f4c3b||0xc8;return function(_0x2cebf5){if(_0x2cebf5){return _0x29c0a3[_0xd85c('0x21')](_0x3f4c3b)[_0xd85c('0x22')](_0x2cebf5);}};}function respondWithFilteredResult(_0x3c2508,_0x2716f3){return function(_0x53e0e7){if(_0x53e0e7){var _0x3d31e9=typeof _0x2716f3['offset']===_0xd85c('0x23')&&typeof _0x2716f3[_0xd85c('0x24')]===_0xd85c('0x23');var _0xf7b65=_0x53e0e7[_0xd85c('0x25')];var _0x3f0610=_0x3d31e9?0x0:_0x2716f3['offset'];var _0x5527fc=_0x3d31e9?_0x53e0e7[_0xd85c('0x25')]:_0x2716f3[_0xd85c('0x26')]+_0x2716f3[_0xd85c('0x24')];var _0x5ee4ca;if(_0x5527fc>=_0xf7b65){_0x5527fc=_0xf7b65;_0x5ee4ca=0xc8;}else{_0x5ee4ca=0xce;}_0x3c2508[_0xd85c('0x21')](_0x5ee4ca);return _0x3c2508[_0xd85c('0x27')](_0xd85c('0x28'),_0x3f0610+'-'+_0x5527fc+'/'+_0xf7b65)[_0xd85c('0x22')](_0x53e0e7);}return null;};}function saveUpdates(_0x4cfb5c){return function(_0x53ccfa){if(_0x53ccfa){return _0x53ccfa[_0xd85c('0x29')](_0x4cfb5c)[_0xd85c('0x15')](function(_0x224bcc){return _0x224bcc;});}return null;};}function removeEntity(_0x2e326c){return function(_0x7e6bef){if(_0x7e6bef){return _0x7e6bef[_0xd85c('0x2a')]()[_0xd85c('0x15')](function(){_0x2e326c['status'](0xcc)[_0xd85c('0x2b')]();});}};}function handleEntityNotFound(_0x360377){return function(_0x2476f1){if(!_0x2476f1){_0x360377[_0xd85c('0x2c')](0x194);}return _0x2476f1;};}function handleError(_0x482f94,_0x54b43c){_0x54b43c=_0x54b43c||0x1f4;return function(_0x117626){logger[_0xd85c('0x1b')](_0x117626[_0xd85c('0x2d')]);if(_0x117626[_0xd85c('0x2e')]){delete _0x117626[_0xd85c('0x2e')];}_0x482f94[_0xd85c('0x21')](_0x54b43c)[_0xd85c('0x2f')](_0x117626);};}exports[_0xd85c('0x30')]=function(_0x11c478,_0x56d0b6){var _0x1b5d42={},_0x54507b={},_0x208a66={'count':0x0,'rows':[]};var _0x37352c=_['map'](db[_0xd85c('0x31')][_0xd85c('0x32')],function(_0x31dd6d){return{'name':_0x31dd6d[_0xd85c('0x33')],'type':_0x31dd6d['type'][_0xd85c('0x34')]};});_0x54507b[_0xd85c('0x35')]=_[_0xd85c('0x36')](_0x37352c,_0xd85c('0x2e'));_0x54507b['query']=_[_0xd85c('0x37')](_0x11c478[_0xd85c('0x38')]);_0x54507b[_0xd85c('0x39')]=_['intersection'](_0x54507b[_0xd85c('0x35')],_0x54507b[_0xd85c('0x38')]);_0x1b5d42[_0xd85c('0x3a')]=_['intersection'](_0x54507b[_0xd85c('0x35')],qs[_0xd85c('0x3b')](_0x11c478[_0xd85c('0x38')]['fields']));_0x1b5d42[_0xd85c('0x3a')]=_0x1b5d42[_0xd85c('0x3a')][_0xd85c('0x3c')]?_0x1b5d42['attributes']:_0x54507b[_0xd85c('0x35')];if(!_0x11c478[_0xd85c('0x38')][_0xd85c('0x3d')](_0xd85c('0x3e'))){_0x1b5d42[_0xd85c('0x24')]=qs[_0xd85c('0x24')](_0x11c478['query'][_0xd85c('0x24')]);_0x1b5d42['offset']=qs[_0xd85c('0x26')](_0x11c478['query']['offset']);}_0x1b5d42[_0xd85c('0x3f')]=qs[_0xd85c('0x40')](_0x11c478[_0xd85c('0x38')]['sort']);_0x1b5d42[_0xd85c('0x41')]=qs['filters'](_[_0xd85c('0x42')](_0x11c478[_0xd85c('0x38')],_0x54507b[_0xd85c('0x39')]),_0x37352c);if(_0x11c478[_0xd85c('0x38')][_0xd85c('0x43')]){_0x1b5d42['where']=_[_0xd85c('0x44')](_0x1b5d42[_0xd85c('0x41')],{'$or':_[_0xd85c('0x36')](_0x37352c,function(_0x178af0){if(_0x178af0['type']!==_0xd85c('0x45')){var _0x5b98bd={};_0x5b98bd[_0x178af0[_0xd85c('0x2e')]]={'$like':'%'+_0x11c478[_0xd85c('0x38')][_0xd85c('0x43')]+'%'};return _0x5b98bd;}})});}_0x1b5d42=_[_0xd85c('0x44')]({},_0x1b5d42,_0x11c478[_0xd85c('0x46')]);var _0x1370be={'where':_0x1b5d42[_0xd85c('0x41')]};return db[_0xd85c('0x31')][_0xd85c('0x25')](_0x1370be)[_0xd85c('0x15')](function(_0x36ac33){_0x208a66[_0xd85c('0x25')]=_0x36ac33;if(_0x11c478['query'][_0xd85c('0x47')]){_0x1b5d42[_0xd85c('0x48')]=[{'all':!![]}];}return db['MailMessage'][_0xd85c('0x49')](_0x1b5d42);})['then'](function(_0x241da2){_0x208a66[_0xd85c('0x4a')]=_0x241da2;return _0x208a66;})[_0xd85c('0x15')](respondWithFilteredResult(_0x56d0b6,_0x1b5d42))['catch'](handleError(_0x56d0b6,null));};exports[_0xd85c('0x4b')]=function(_0x438a9e,_0xa7f4bb){var _0x289317={'raw':!![],'where':{'id':_0x438a9e['params']['id']}},_0x288d02={};_0x288d02['model']=_[_0xd85c('0x37')](db['MailMessage'][_0xd85c('0x32')]);_0x288d02['query']=_[_0xd85c('0x37')](_0x438a9e[_0xd85c('0x38')]);_0x288d02['filters']=_['intersection'](_0x288d02[_0xd85c('0x35')],_0x288d02['query']);_0x289317[_0xd85c('0x3a')]=_[_0xd85c('0x4c')](_0x288d02[_0xd85c('0x35')],qs[_0xd85c('0x3b')](_0x438a9e['query'][_0xd85c('0x3b')]));_0x289317[_0xd85c('0x3a')]=_0x289317[_0xd85c('0x3a')][_0xd85c('0x3c')]?_0x289317[_0xd85c('0x3a')]:_0x288d02[_0xd85c('0x35')];if(_0x438a9e[_0xd85c('0x38')]['includeAll']){_0x289317[_0xd85c('0x48')]=[{'all':!![]}];}_0x289317=_[_0xd85c('0x44')]({},_0x289317,_0x438a9e['options']);return db[_0xd85c('0x31')][_0xd85c('0x4d')](_0x289317)['then'](handleEntityNotFound(_0xa7f4bb,null))[_0xd85c('0x15')](respondWithResult(_0xa7f4bb,null))['catch'](handleError(_0xa7f4bb,null));};exports['update']=function(_0x425842,_0x1396fa){if(_0x425842[_0xd85c('0x4e')]['id']){delete _0x425842[_0xd85c('0x4e')]['id'];}return db[_0xd85c('0x31')][_0xd85c('0x4d')]({'where':{'id':_0x425842[_0xd85c('0x4f')]['id']}})[_0xd85c('0x15')](handleEntityNotFound(_0x1396fa,null))[_0xd85c('0x15')](saveUpdates(_0x425842[_0xd85c('0x4e')],null))['then'](respondWithResult(_0x1396fa,null))[_0xd85c('0x20')](handleError(_0x1396fa,null));};exports[_0xd85c('0x2a')]=function(_0xb06032,_0x23087f){return db[_0xd85c('0x31')][_0xd85c('0x4d')]({'where':{'id':_0xb06032[_0xd85c('0x4f')]['id']}})[_0xd85c('0x15')](handleEntityNotFound(_0x23087f,null))['then'](removeEntity(_0x23087f,null))[_0xd85c('0x20')](handleError(_0x23087f,null));};exports['describe']=function(_0x188e3f,_0x10df20){return db[_0xd85c('0x31')][_0xd85c('0x50')]()['then'](respondWithResult(_0x10df20,null))[_0xd85c('0x20')](handleError(_0x10df20,null));};exports['create']=function(_0x8c9139,_0x194fe7){return db[_0xd85c('0x31')][_0xd85c('0x51')](_0x8c9139[_0xd85c('0x4e')])[_0xd85c('0x15')](function(_0x27c3ec){if(_0x27c3ec){if(_0x27c3ec['direction']===_0xd85c('0x52')&&!_0x27c3ec['secret']){var _0x252b56,_0xee4d54,_0x538941;if(_0x8c9139[_0xd85c('0x4e')]['to']){_0xee4d54=_0x8c9139[_0xd85c('0x4e')]['to'][_0xd85c('0x53')](',')[0x0];}return db[_0xd85c('0x54')][_0xd85c('0x55')]({'where':{'id':_0x27c3ec[_0xd85c('0x56')]},'include':[{'model':db[_0xd85c('0x57')],'as':'List','include':[{'model':db[_0xd85c('0x58')],'as':_0xd85c('0x59'),'where':{'email':_0xee4d54},'limit':0x1,'order':[[_0xd85c('0x5a'),_0xd85c('0x5b')]]}]},{'model':db[_0xd85c('0x5c')],'as':_0xd85c('0x5d'),'raw':!![]}]})['then'](function(_0x1b73e2){_0x252b56=_0x1b73e2;if(_0x252b56&&_0x252b56[_0xd85c('0x5d')]){var _0x512d78={'tls':{'rejectUnauthorized':![]}};if(_[_0xd85c('0x5e')](_0x252b56['Smtp'][_0xd85c('0x5f')])){_0x512d78['host']=_0x252b56[_0xd85c('0x5d')][_0xd85c('0x60')];_0x512d78[_0xd85c('0x61')]=_0x252b56[_0xd85c('0x5d')][_0xd85c('0x61')];_0x512d78[_0xd85c('0x62')]=_0x252b56[_0xd85c('0x5d')][_0xd85c('0x62')];if(_0x252b56[_0xd85c('0x5d')][_0xd85c('0x63')]){_0x512d78[_0xd85c('0x64')]={'user':_0x252b56[_0xd85c('0x5d')][_0xd85c('0x65')],'pass':_0x252b56[_0xd85c('0x5d')][_0xd85c('0x66')]};}}else{_0x512d78[_0xd85c('0x5f')]=_0x252b56[_0xd85c('0x5d')][_0xd85c('0x5f')];_0x512d78[_0xd85c('0x64')]={'user':_0x252b56[_0xd85c('0x5d')][_0xd85c('0x65')],'pass':_0x252b56['Smtp'][_0xd85c('0x66')]};_0x512d78[_0xd85c('0x62')]=_0x252b56[_0xd85c('0x5d')][_0xd85c('0x62')];}if(_0x8c9139[_0xd85c('0x4e')][_0xd85c('0x67')]&&_0x8c9139['body']['attachments'][_0xd85c('0x3c')]){for(var _0x3d68fc=0x0;_0x3d68fc<_0x8c9139[_0xd85c('0x4e')][_0xd85c('0x67')][_0xd85c('0x3c')];_0x3d68fc+=0x1){_0x8c9139[_0xd85c('0x4e')][_0xd85c('0x67')][_0x3d68fc]={'filename':_0x8c9139[_0xd85c('0x4e')][_0xd85c('0x67')][_0x3d68fc]['name'],'path':path[_0xd85c('0x68')](config[_0xd85c('0x69')],_0xd85c('0x6a'),_0x8c9139[_0xd85c('0x4e')]['attachments'][_0x3d68fc]['basename'])};}}_0x538941={'account':_0x512d78,'message':_0x8c9139[_0xd85c('0x4e')]};return;}})[_0xd85c('0x15')](function(){if(_0x252b56[_0xd85c('0x6b')]){if(_0x252b56[_0xd85c('0x6b')]['Contacts'][_0xd85c('0x3c')]){return _0x252b56[_0xd85c('0x6b')][_0xd85c('0x59')][0x0];}else{return db[_0xd85c('0x58')]['create'](_[_0xd85c('0xb')](_0x8c9139[_0xd85c('0x4e')],{'firstName':_0x8c9139[_0xd85c('0x4e')]['to'],'email':_0x8c9139[_0xd85c('0x4e')]['to'],'phone':_0x8c9139[_0xd85c('0x4e')]['to'],'ListId':_0x252b56[_0xd85c('0x6c')]}));}}else{throw new Error(_0xd85c('0x6d'));}})[_0xd85c('0x15')](function(){if(_0x538941){return respondWithRpcPromise(_0xd85c('0x6e'),_0xd85c('0x6f'),_0x538941,client9003)['then'](function(_0x1b2e03){return _0x27c3ec['update']({'read':!![],'messageId':_0x1b2e03['messageId'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});})[_0xd85c('0x20')](function(_0x40574f){logger[_0xd85c('0x1b')]('%s',JSON[_0xd85c('0x1a')](_0x40574f));return _0x27c3ec;});}return _0x27c3ec;});}return _0x27c3ec;}})[_0xd85c('0x15')](respondWithResult(_0x194fe7,0xc9))[_0xd85c('0x20')](handleError(_0x194fe7,null));};exports[_0xd85c('0x70')]=function(_0x19f04f,_0x14672d){var _0x2834bb={'agent':{},'channel':'mail'};if(_0x19f04f[_0xd85c('0x4e')]['id']){delete _0x19f04f[_0xd85c('0x4e')]['id'];}_0x19f04f[_0xd85c('0x4e')][_0xd85c('0x71')]=!![];_0x19f04f[_0xd85c('0x4e')][_0xd85c('0x72')]=moment()['format'](_0xd85c('0x73'));_0x19f04f[_0xd85c('0x4e')][_0xd85c('0x74')]=_0x19f04f[_0xd85c('0x4e')][_0xd85c('0x74')]||_0x19f04f[_0xd85c('0x65')]['id'];_0x2834bb['agent']['id']=_0x19f04f[_0xd85c('0x4e')]['UserId'];return db['MailMessage'][_0xd85c('0x4d')]({'where':{'id':_0x19f04f[_0xd85c('0x4f')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x14672d,null))[_0xd85c('0x15')](saveUpdates(_0x19f04f[_0xd85c('0x4e')],null))[_0xd85c('0x15')](function(_0x18883a){if(_0x18883a){_0x2834bb[_0xd85c('0x1d')]=_0x18883a[_0xd85c('0x75')]({'plain':!![]});return db[_0xd85c('0x76')][_0xd85c('0x4d')]({'where':{'id':_0x18883a[_0xd85c('0x77')]}});}return null;})[_0xd85c('0x15')](handleEntityNotFound(_0x14672d,null))[_0xd85c('0x15')](function(_0x1edde6){if(_0x1edde6){return _0x1edde6['update']({'UserId':_0x19f04f[_0xd85c('0x4e')][_0xd85c('0x74')],'read1stAt':_[_0xd85c('0x5e')](_0x1edde6['read1stAt'])?moment()['format'](_0xd85c('0x73')):undefined});}return null;})[_0xd85c('0x15')](function(_0x2848b6){if(_0x2848b6){_0x2834bb[_0xd85c('0x78')]=_0x2848b6[_0xd85c('0x75')]({'plain':!![]});interaction_log['info'](_0xd85c('0x79'),_0x19f04f[_0xd85c('0x65')]['id'],_0x19f04f[_0xd85c('0x65')][_0xd85c('0x2e')],_0x19f04f[_0xd85c('0x65')][_0xd85c('0x7a')],_0x2834bb['interaction']['id'],_0x19f04f['body']?JSON[_0xd85c('0x1a')](_0x19f04f[_0xd85c('0x4e')]):_0xd85c('0x7b'));return respondWithRpcPromise(_0xd85c('0x7c'),'acceptMessage',_0x2834bb);}return null;})[_0xd85c('0x15')](function(_0x22488e){var _0x1acfd9=_0xd85c('0x7d')+_0x22488e[_0xd85c('0x1d')][_0xd85c('0x7e')];return db['sequelize'][_0xd85c('0x38')](_0x1acfd9,{'type':db[_0xd85c('0x7f')][_0xd85c('0x80')][_0xd85c('0x81')],'raw':!![]})[_0xd85c('0x15')](function(_0x336c77){return _0x336c77;});})[_0xd85c('0x15')](function(_0x24f08c){if(_0x24f08c){_0x2834bb['message'][_0xd85c('0x82')]=_0x24f08c[0x0];if(!_0x19f04f['body'][_0xd85c('0x74')])return;return db[_0xd85c('0x83')][_0xd85c('0x4d')]({'where':{'id':_0x19f04f[_0xd85c('0x4e')][_0xd85c('0x74')],'role':'agent'},'attributes':['id',_0xd85c('0x2e'),_0xd85c('0x84'),_0xd85c('0x85'),_0xd85c('0x86')],'raw':!![]});}return null;})[_0xd85c('0x15')](function(_0x26300d){if(!_0x26300d)return null;_0x2834bb[_0xd85c('0x1d')][_0xd85c('0x87')]=_0x26300d;return _0x2834bb;})['then'](function(_0x41dd40){if(_0x41dd40){if(_0x19f04f['body'][_0xd85c('0x88')]){_0x2834bb[_0xd85c('0x1d')][_0xd85c('0x89')]=util[_0xd85c('0x8a')]('SIP/%s',_0x19f04f[_0xd85c('0x65')]['name']);_0x2834bb[_0xd85c('0x1d')][_0xd85c('0x8b')]=_0x2834bb[_0xd85c('0x8b')];_0x2834bb['message']['motionChannel']=_0x2834bb['channel'];_0x2834bb['message'][_0xd85c('0x8c')]=_0xd85c('0x70');_0x2834bb['message'][_0xd85c('0x4e')]=htmlToText[_0xd85c('0x8d')](_0x2834bb[_0xd85c('0x1d')][_0xd85c('0x4e')]);return respondWithRpcPromise('EventManager',_0xd85c('0x8e'),{'event':_0xd85c('0x8f'),'message':_0x2834bb[_0xd85c('0x1d')]},client9002)[_0xd85c('0x15')](function(){return _0x2834bb;});}return _0x2834bb;}return null;})[_0xd85c('0x15')](respondWithResult(_0x14672d,null))['catch'](handleError(_0x14672d,null));};exports[_0xd85c('0x90')]=function(_0x4f422f,_0x41be38){var _0x398003={'agent':{},'channel':_0xd85c('0x91')};if(_0x4f422f[_0xd85c('0x4e')]['id']){delete _0x4f422f[_0xd85c('0x4e')]['id'];}_0x4f422f['body'][_0xd85c('0x74')]=_0x4f422f[_0xd85c('0x4e')][_0xd85c('0x74')]||_0x4f422f[_0xd85c('0x65')]['id'];_0x398003[_0xd85c('0x87')]['id']=_0x4f422f[_0xd85c('0x4e')][_0xd85c('0x74')];return db[_0xd85c('0x31')][_0xd85c('0x4d')]({'where':{'id':_0x4f422f[_0xd85c('0x4f')]['id'],'UserId':null}})[_0xd85c('0x15')](handleEntityNotFound(_0x41be38,null))[_0xd85c('0x15')](function(_0x3eae93){if(_0x3eae93){_0x398003[_0xd85c('0x1d')]=_0x3eae93[_0xd85c('0x75')]({'plain':!![]});return db[_0xd85c('0x76')]['find']({'where':{'id':_0x3eae93[_0xd85c('0x77')]}});}return null;})[_0xd85c('0x15')](handleEntityNotFound(_0x41be38,null))['then'](function(_0x31ad2e){if(_0x31ad2e){_0x398003[_0xd85c('0x78')]=_0x31ad2e[_0xd85c('0x75')]({'plain':!![]});interaction_log[_0xd85c('0x16')](_0xd85c('0x92'),_0x4f422f[_0xd85c('0x65')]['id'],_0x4f422f[_0xd85c('0x65')][_0xd85c('0x2e')],_0x4f422f['user']['role'],_0x398003[_0xd85c('0x78')]['id'],_0x4f422f[_0xd85c('0x4e')]?JSON['stringify'](_0x4f422f[_0xd85c('0x4e')]):_0xd85c('0x7b'));return respondWithRpcPromise(_0xd85c('0x93'),_0xd85c('0x94'),_0x398003);}return null;})[_0xd85c('0x15')](function(_0x3f2a13){var _0x13a77c='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x3f2a13[_0xd85c('0x1d')][_0xd85c('0x7e')];return db[_0xd85c('0x95')][_0xd85c('0x38')](_0x13a77c,{'type':db[_0xd85c('0x7f')]['QueryTypes'][_0xd85c('0x81')],'raw':!![]})['then'](function(_0x2ead98){return _0x2ead98;});})[_0xd85c('0x15')](function(_0x7ba112){if(_0x7ba112){_0x398003[_0xd85c('0x1d')][_0xd85c('0x82')]=_0x7ba112[0x0];if(!_0x4f422f[_0xd85c('0x4e')][_0xd85c('0x74')])return;return db['User'][_0xd85c('0x4d')]({'where':{'id':_0x4f422f[_0xd85c('0x4e')]['UserId'],'role':_0xd85c('0x87')},'attributes':['id',_0xd85c('0x2e'),_0xd85c('0x84'),'email',_0xd85c('0x86')],'raw':!![]});}return null;})[_0xd85c('0x15')](function(_0x14faa6){if(!_0x14faa6)return null;_0x398003[_0xd85c('0x1d')][_0xd85c('0x87')]=_0x14faa6;return _0x398003;})[_0xd85c('0x15')](function(_0x9f6ee1){if(_0x9f6ee1){_0x9f6ee1['message'][_0xd85c('0x89')]=util['format'](_0xd85c('0x96'),_0x4f422f[_0xd85c('0x65')][_0xd85c('0x2e')]);_0x9f6ee1[_0xd85c('0x1d')][_0xd85c('0x8b')]=_0x398003[_0xd85c('0x8b')];_0x9f6ee1[_0xd85c('0x1d')]['motionChannel']=_0x398003['channel'];_0x9f6ee1['message'][_0xd85c('0x8c')]=_0xd85c('0x90');_0x9f6ee1[_0xd85c('0x1d')][_0xd85c('0x4e')]=htmlToText['fromString'](_0x398003[_0xd85c('0x1d')][_0xd85c('0x4e')]);respondWithRpcPromise(_0xd85c('0x8e'),_0xd85c('0x8e'),{'event':_0xd85c('0x97'),'message':_0x9f6ee1['message']},client9002);return _0x398003;}return null;})[_0xd85c('0x15')](respondWithResult(_0x41be38,null))['catch'](handleError(_0x41be38,null));};exports['download']=function(_0x1cc040,_0x3fd60d){var _0x720cc0=moment()[_0xd85c('0x98')]()[_0xd85c('0x99')]();var _0x282a10=path['join'](config[_0xd85c('0x69')],_0xd85c('0x9a'),'files',_0xd85c('0x9b'));var _0x1f8485=path[_0xd85c('0x68')](config[_0xd85c('0x69')],_0xd85c('0x9a'),'files',_0xd85c('0x67'));var _0x296e50=util['format']('message-%s.eml',_0x720cc0);return db[_0xd85c('0x31')]['find']({'where':{'id':_0x1cc040[_0xd85c('0x4f')]['id']},'attributes':['id',_0xd85c('0x4e'),_0xd85c('0x9c'),'to','cc','bcc',_0xd85c('0x9d'),'createdAt'],'include':_0x1cc040[_0xd85c('0x38')][_0xd85c('0x67')]?[{'model':db[_0xd85c('0x9e')],'as':_0xd85c('0x9f')}]:undefined})[_0xd85c('0x15')](handleEntityNotFound(_0x3fd60d,null))[_0xd85c('0x15')](function(_0x352da3){if(_0x352da3){var _0x4635bc=_0x352da3;var _0x2ae11c={'from':_0x4635bc[_0xd85c('0x9c')],'to':_0x4635bc['to'],'subject':_0x4635bc[_0xd85c('0x9d')],'html':htmlEntities[_0xd85c('0xa0')](_0x4635bc[_0xd85c('0x4e')]),'headers':{'Date':moment(_0x4635bc[_0xd85c('0xa1')])[_0xd85c('0x8a')](_0xd85c('0xa2'))},'attachments':[]};if(_0x352da3['cc']){_0x2ae11c[_0xd85c('0xa3')]['Cc']=_0x352da3['cc'];}if(_0x352da3[_0xd85c('0xa4')]){_0x2ae11c[_0xd85c('0xa3')]['Bcc']=_0x352da3[_0xd85c('0xa4')];}return new BPromise(function(_0x2ad3fd,_0x571961){if(_0x352da3[_0xd85c('0x9f')]){for(var _0x480a0d=0x0;_0x480a0d<_0x352da3[_0xd85c('0x9f')]['length'];_0x480a0d++){var _0x5dd79f=_0x352da3[_0xd85c('0x9f')][_0x480a0d];var _0x5a2440=path[_0xd85c('0x68')](_0x1f8485,_0x5dd79f[_0xd85c('0xa5')]);if(fs[_0xd85c('0xa6')](_0x5a2440)){_0x2ae11c[_0xd85c('0x67')][_0xd85c('0xa7')]({'name':_0x5dd79f[_0xd85c('0x2e')],'contentType':_0x5dd79f['type'],'data':fs[_0xd85c('0xa8')](_0x5a2440)});}}}emlformat[_0xd85c('0xa9')](_0x2ae11c,function(_0x510e93,_0x1ea30f){if(_0x510e93)return _0x571961(_0x510e93);fs[_0xd85c('0xaa')](path[_0xd85c('0x68')](_0x282a10,_0x296e50),_0x1ea30f);return _0x2ad3fd(_0x1ea30f);});});}})[_0xd85c('0x15')](function(_0x238cd6){if(_0x238cd6){return _0x3fd60d['download'](path[_0xd85c('0x68')](_0x282a10,_0x296e50),_0x296e50,function(_0x5905a5){if(!_0x5905a5)fs['unlinkSync'](path[_0xd85c('0x68')](_0x282a10,_0x296e50));});}})[_0xd85c('0x20')](handleError(_0x3fd60d,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index e464ddc..43ea27a 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 _0x98f0=['update','remove','emit','hook','exports','MailMessage','setMaxListeners','save'];(function(_0x34d635,_0x2784fc){var _0x3ab288=function(_0x41589b){while(--_0x41589b){_0x34d635['push'](_0x34d635['shift']());}};_0x3ab288(++_0x2784fc);}(_0x98f0,0x75));var _0x098f=function(_0x322139,_0x30bda7){_0x322139=_0x322139-0x0;var _0x3d433e=_0x98f0[_0x322139];return _0x3d433e;};'use strict';var EventEmitter=require('events');var MailMessage=require('../../mysqldb')['db'][_0x098f('0x0')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x098f('0x1')](0x0);var events={'afterCreate':_0x098f('0x2'),'afterUpdate':_0x098f('0x3'),'afterDestroy':_0x098f('0x4')};function emitEvent(_0x22cbee){return function(_0x3a2e59,_0x44c6ec,_0x220894){MailMessageEvents[_0x098f('0x5')](_0x22cbee+':'+_0x3a2e59['id'],_0x3a2e59);MailMessageEvents[_0x098f('0x5')](_0x22cbee,_0x3a2e59);_0x220894(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0x098f('0x6')](e,emitEvent(event));}}module[_0x098f('0x7')]=MailMessageEvents; \ No newline at end of file +var _0xfd91=['emit','hook','exports','events','../../mysqldb','MailMessage','setMaxListeners','save'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0xfd91,0x6b));var _0x1fd9=function(_0x42674d,_0x142bb2){_0x42674d=_0x42674d-0x0;var _0x537a2b=_0xfd91[_0x42674d];return _0x537a2b;};'use strict';var EventEmitter=require(_0x1fd9('0x0'));var MailMessage=require(_0x1fd9('0x1'))['db'][_0x1fd9('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x1fd9('0x3')](0x0);var events={'afterCreate':_0x1fd9('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x25f6ac){return function(_0xcd6618,_0x266af5,_0x2a1901){MailMessageEvents[_0x1fd9('0x5')](_0x25f6ac+':'+_0xcd6618['id'],_0xcd6618);MailMessageEvents[_0x1fd9('0x5')](_0x25f6ac,_0xcd6618);_0x2a1901(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0x1fd9('0x6')](e,emitEvent(event));}}module[_0x1fd9('0x7')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 7b291dd..72ca5bc 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 _0xf3f6=['request-promise','path','rimraf','../../config/environment','./mailMessage.attributes','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','direction','toLowerCase','out','UserId','findOne','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird'];(function(_0x85149b,_0x450b32){var _0x50f33c=function(_0x428f4a){while(--_0x428f4a){_0x85149b['push'](_0x85149b['shift']());}};_0x50f33c(++_0x450b32);}(_0xf3f6,0x12f));var _0x6f3f=function(_0x3473ae,_0xa2b419){_0x3473ae=_0x3473ae-0x0;var _0x22278c=_0xf3f6[_0x3473ae];return _0x22278c;};'use strict';var _=require(_0x6f3f('0x0'));var util=require(_0x6f3f('0x1'));var logger=require('../../config/logger')(_0x6f3f('0x2'));var moment=require(_0x6f3f('0x3'));var BPromise=require(_0x6f3f('0x4'));var rp=require(_0x6f3f('0x5'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0x6f3f('0x6'));var rimraf=require(_0x6f3f('0x7'));var config=require(_0x6f3f('0x8'));var attributes=require(_0x6f3f('0x9'));module['exports']=function(_0x14dfa3,_0x254cb5){return _0x14dfa3['define'](_0x6f3f('0xa'),attributes,{'tableName':_0x6f3f('0xb'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x6f3f('0xc')]},{'name':_0x6f3f('0xd'),'fields':[_0x6f3f('0xe'),_0x6f3f('0xf')],'type':_0x6f3f('0x10')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x53c83e,_0x59efef,_0xd3d9ba){if(_0x53c83e[_0x6f3f('0x11')]){_0x53c83e['plainBody']=htmlToText['fromString'](_0x53c83e[_0x6f3f('0x11')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0xd3d9ba(null,_0x59efef);},'afterCreate':function(_0x4bcf47,_0x4c4986,_0x23be7a){var _0x2c12e9=_0x14dfa3['models'];var _0x25c965=_0x4bcf47['get']({'plain':!![]});if(_0x25c965[_0x6f3f('0x12')][_0x6f3f('0x13')]()==='in'||_0x25c965[_0x6f3f('0x12')][_0x6f3f('0x13')]()===_0x6f3f('0x14')&&!_0x25c965['secret']&&!_['isNil'](_0x25c965[_0x6f3f('0x15')])){_0x2c12e9['MailInteraction'][_0x6f3f('0x16')]({'where':{'id':_0x25c965['MailInteractionId']}})['then'](function(_0x5e49a5){if(_0x5e49a5){_0x5e49a5['update']({'lastMsgAt':_0x25c965[_0x6f3f('0x17')],'lastMsgDirection':_0x25c965['direction'][_0x6f3f('0x13')]()});}})[_0x6f3f('0x18')](function(_0x3b8bfd){console[_0x6f3f('0x19')](_0x3b8bfd);});}_0x23be7a();}},'charset':_0x6f3f('0x1a'),'collate':_0x6f3f('0x1b')});}; \ No newline at end of file +var _0x4e1a=['MailInteractionId','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','html-to-text','path','rimraf','../../config/environment','exports','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','fromString','models','get','direction','toLowerCase','secret','isNil','UserId','MailInteraction','findOne'];(function(_0x101b04,_0x505fda){var _0x29bf70=function(_0x5d3bad){while(--_0x5d3bad){_0x101b04['push'](_0x101b04['shift']());}};_0x29bf70(++_0x505fda);}(_0x4e1a,0xaf));var _0xa4e1=function(_0x4aaf8e,_0x493969){_0x4aaf8e=_0x4aaf8e-0x0;var _0x52f0ed=_0x4e1a[_0x4aaf8e];return _0x52f0ed;};'use strict';var _=require(_0xa4e1('0x0'));var util=require(_0xa4e1('0x1'));var logger=require(_0xa4e1('0x2'))(_0xa4e1('0x3'));var moment=require(_0xa4e1('0x4'));var BPromise=require('bluebird');var rp=require(_0xa4e1('0x5'));var htmlToText=require(_0xa4e1('0x6'));var fs=require('fs');var path=require(_0xa4e1('0x7'));var rimraf=require(_0xa4e1('0x8'));var config=require(_0xa4e1('0x9'));var attributes=require('./mailMessage.attributes');module[_0xa4e1('0xa')]=function(_0x4d0817,_0xe35b7d){return _0x4d0817['define'](_0xa4e1('0xb'),attributes,{'tableName':_0xa4e1('0xc'),'paranoid':![],'indexes':[{'name':_0xa4e1('0xd'),'fields':[_0xa4e1('0xd')]},{'name':_0xa4e1('0xe'),'fields':[_0xa4e1('0xf'),_0xa4e1('0x10')],'type':_0xa4e1('0x11')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4f7092,_0x397d9d,_0x338226){if(_0x4f7092[_0xa4e1('0x12')]){_0x4f7092[_0xa4e1('0xf')]=htmlToText[_0xa4e1('0x13')](_0x4f7092[_0xa4e1('0x12')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x338226(null,_0x397d9d);},'afterCreate':function(_0x134ef7,_0x194d5b,_0x3b5be7){var _0x4424ab=_0x4d0817[_0xa4e1('0x14')];var _0x36e68f=_0x134ef7[_0xa4e1('0x15')]({'plain':!![]});if(_0x36e68f[_0xa4e1('0x16')][_0xa4e1('0x17')]()==='in'||_0x36e68f[_0xa4e1('0x16')][_0xa4e1('0x17')]()==='out'&&!_0x36e68f[_0xa4e1('0x18')]&&!_[_0xa4e1('0x19')](_0x36e68f[_0xa4e1('0x1a')])){_0x4424ab[_0xa4e1('0x1b')][_0xa4e1('0x1c')]({'where':{'id':_0x36e68f[_0xa4e1('0x1d')]}})[_0xa4e1('0x1e')](function(_0x381f86){if(_0x381f86){_0x381f86['update']({'lastMsgAt':_0x36e68f['createdAt'],'lastMsgDirection':_0x36e68f[_0xa4e1('0x16')][_0xa4e1('0x17')]()});}})[_0xa4e1('0x1f')](function(_0x54854f){console['error'](_0x54854f);});}_0x3b5be7();}},'charset':_0xa4e1('0x20'),'collate':_0xa4e1('0x21')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 83f2320..01fda36 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 _0x1775=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','register','request','then','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','MailMessage','create','body','options','raw','CreateMailMessage','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x1775,0x1db));var _0x5177=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1775[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x5177('0x0'));var moment=require(_0x5177('0x1'));var BPromise=require(_0x5177('0x2'));var rs=require(_0x5177('0x3'));var fs=require('fs');var Redis=require(_0x5177('0x4'));var db=require(_0x5177('0x5'))['db'];var utils=require(_0x5177('0x6'));var logger=require(_0x5177('0x7'))(_0x5177('0x8'));var config=require(_0x5177('0x9'));var jayson=require(_0x5177('0xa'));var client=jayson[_0x5177('0xb')][_0x5177('0xc')]({'port':0x232a});config[_0x5177('0xd')]=_[_0x5177('0xe')](config[_0x5177('0xd')],{'host':_0x5177('0xf'),'port':0x18eb});var socket=require(_0x5177('0x10'))(new Redis(config[_0x5177('0xd')]));require(_0x5177('0x11'))[_0x5177('0x12')](socket);function respondWithRpcPromise(_0x206035,_0x5bdca9,_0x4ae3d2){return new BPromise(function(_0x13c7f6,_0x1d7116){return client[_0x5177('0x13')](_0x206035,_0x4ae3d2)[_0x5177('0x14')](function(_0x301db2){logger['info'](_0x5177('0x15'),_0x5bdca9,_0x5177('0x16'));logger[_0x5177('0x17')](_0x5177('0x18'),_0x5bdca9,_0x5177('0x16'),JSON[_0x5177('0x19')](_0x301db2));if(_0x301db2[_0x5177('0x1a')]){if(_0x301db2[_0x5177('0x1a')][_0x5177('0x1b')]===0x1f4){logger[_0x5177('0x1a')](_0x5177('0x15'),_0x5bdca9,_0x301db2[_0x5177('0x1a')][_0x5177('0x1c')]);return _0x1d7116(_0x301db2[_0x5177('0x1a')][_0x5177('0x1c')]);}logger[_0x5177('0x1a')](_0x5177('0x15'),_0x5bdca9,_0x301db2[_0x5177('0x1a')][_0x5177('0x1c')]);return _0x13c7f6(_0x301db2['error'][_0x5177('0x1c')]);}else{logger[_0x5177('0x1d')](_0x5177('0x15'),_0x5bdca9,_0x5177('0x16'));_0x13c7f6(_0x301db2['result'][_0x5177('0x1c')]);}})[_0x5177('0x1e')](function(_0x13d5d4){logger['error'](_0x5177('0x15'),_0x5bdca9,_0x13d5d4);_0x1d7116(_0x13d5d4);});});}exports['CreateMailMessage']=function(_0xc2b2b5){var _0xe221b3=this;return new Promise(function(_0x219744,_0x27b732){return db[_0x5177('0x1f')][_0x5177('0x20')](_0xc2b2b5[_0x5177('0x21')],{'raw':_0xc2b2b5[_0x5177('0x22')]?_0xc2b2b5[_0x5177('0x22')][_0x5177('0x23')]===undefined?!![]:![]:!![]})[_0x5177('0x14')](function(_0x3b0c37){logger['info'](_0x5177('0x24'),_0xc2b2b5);logger['debug'](_0x5177('0x24'),_0xc2b2b5,JSON[_0x5177('0x19')](_0x3b0c37));_0x219744(_0x3b0c37);})[_0x5177('0x1e')](function(_0x2d51d0){logger['error'](_0x5177('0x24'),_0x2d51d0['message'],_0xc2b2b5);_0x27b732(_0xe221b3['error'](0x1f4,_0x2d51d0[_0x5177('0x1c')]));});});}; \ No newline at end of file +var _0x1c9a=['raw','CreateMailMessage','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','./mailMessage.socket','register','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','MailMessage','create','options'];(function(_0x5e5523,_0xa2f1e8){var _0x4c5529=function(_0x1193e7){while(--_0x1193e7){_0x5e5523['push'](_0x5e5523['shift']());}};_0x4c5529(++_0xa2f1e8);}(_0x1c9a,0x98));var _0xa1c9=function(_0x254401,_0x3da756){_0x254401=_0x254401-0x0;var _0x267036=_0x1c9a[_0x254401];return _0x267036;};'use strict';var _=require(_0xa1c9('0x0'));var util=require('util');var moment=require(_0xa1c9('0x1'));var BPromise=require('bluebird');var rs=require(_0xa1c9('0x2'));var fs=require('fs');var Redis=require(_0xa1c9('0x3'));var db=require(_0xa1c9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa1c9('0x5'))(_0xa1c9('0x6'));var config=require(_0xa1c9('0x7'));var jayson=require(_0xa1c9('0x8'));var client=jayson['client'][_0xa1c9('0x9')]({'port':0x232a});config['redis']=_[_0xa1c9('0xa')](config[_0xa1c9('0xb')],{'host':_0xa1c9('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa1c9('0xb')]));require(_0xa1c9('0xd'))[_0xa1c9('0xe')](socket);function respondWithRpcPromise(_0x1efbab,_0x493cf6,_0x27b020){return new BPromise(function(_0x4437f2,_0x29e24a){return client[_0xa1c9('0xf')](_0x1efbab,_0x27b020)[_0xa1c9('0x10')](function(_0xbb76ef){logger[_0xa1c9('0x11')](_0xa1c9('0x12'),_0x493cf6,_0xa1c9('0x13'));logger[_0xa1c9('0x14')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x493cf6,_0xa1c9('0x13'),JSON[_0xa1c9('0x15')](_0xbb76ef));if(_0xbb76ef[_0xa1c9('0x16')]){if(_0xbb76ef[_0xa1c9('0x16')][_0xa1c9('0x17')]===0x1f4){logger['error'](_0xa1c9('0x12'),_0x493cf6,_0xbb76ef[_0xa1c9('0x16')][_0xa1c9('0x18')]);return _0x29e24a(_0xbb76ef[_0xa1c9('0x16')][_0xa1c9('0x18')]);}logger[_0xa1c9('0x16')](_0xa1c9('0x12'),_0x493cf6,_0xbb76ef[_0xa1c9('0x16')][_0xa1c9('0x18')]);return _0x4437f2(_0xbb76ef[_0xa1c9('0x16')]['message']);}else{logger[_0xa1c9('0x11')](_0xa1c9('0x12'),_0x493cf6,_0xa1c9('0x13'));_0x4437f2(_0xbb76ef['result'][_0xa1c9('0x18')]);}})['catch'](function(_0x21cd35){logger[_0xa1c9('0x16')](_0xa1c9('0x12'),_0x493cf6,_0x21cd35);_0x29e24a(_0x21cd35);});});}exports['CreateMailMessage']=function(_0x3a1110){var _0x46b1e4=this;return new Promise(function(_0x128732,_0x4edf37){return db[_0xa1c9('0x19')][_0xa1c9('0x1a')](_0x3a1110['body'],{'raw':_0x3a1110[_0xa1c9('0x1b')]?_0x3a1110[_0xa1c9('0x1b')][_0xa1c9('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x29f1b1){logger[_0xa1c9('0x11')](_0xa1c9('0x1d'),_0x3a1110);logger[_0xa1c9('0x14')](_0xa1c9('0x1d'),_0x3a1110,JSON['stringify'](_0x29f1b1));_0x128732(_0x29f1b1);})['catch'](function(_0x200749){logger['error'](_0xa1c9('0x1d'),_0x200749[_0xa1c9('0x18')],_0x3a1110);_0x4edf37(_0x46b1e4[_0xa1c9('0x16')](0x1f4,_0x200749[_0xa1c9('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 832d218..dcafaf2 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 _0x5bac=['mailMessage:','remove','update','emit','register','length'];(function(_0x2bb5a7,_0x437c11){var _0x280d97=function(_0xcc7372){while(--_0xcc7372){_0x2bb5a7['push'](_0x2bb5a7['shift']());}};_0x280d97(++_0x437c11);}(_0x5bac,0x19f));var _0xc5ba=function(_0x495ae8,_0x3e4a1b){_0x495ae8=_0x495ae8-0x0;var _0x3eff9b=_0x5bac[_0x495ae8];return _0x3eff9b;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=['save',_0xc5ba('0x0'),_0xc5ba('0x1')];function createListener(_0x129c10,_0x858ce3){return function(_0x5d88ba){_0x858ce3[_0xc5ba('0x2')](_0x129c10,_0x5d88ba);};}function removeListener(_0xf23e8a,_0x5b6a3d){return function(){MailMessageEvents['removeListener'](_0xf23e8a,_0x5b6a3d);};}exports[_0xc5ba('0x3')]=function(_0xf7fb9a){for(var _0x25ca44=0x0,_0x4c211e=events[_0xc5ba('0x4')];_0x25ca44<_0x4c211e;_0x25ca44++){var _0x1ffd78=events[_0x25ca44];var _0x381332=createListener(_0xc5ba('0x5')+_0x1ffd78,_0xf7fb9a);MailMessageEvents['on'](_0x1ffd78,_0x381332);}}; \ No newline at end of file +var _0xb8f7=['emit','removeListener','register','mailMessage:','./mailMessage.events','remove','update'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xb8f7,0x1af));var _0x7b8f=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xb8f7[_0x126558];return _0x1f6d14;};'use strict';var MailMessageEvents=require(_0x7b8f('0x0'));var events=['save',_0x7b8f('0x1'),_0x7b8f('0x2')];function createListener(_0x3e0432,_0x493a9b){return function(_0x466c3a){_0x493a9b[_0x7b8f('0x3')](_0x3e0432,_0x466c3a);};}function removeListener(_0x424b41,_0x40060d){return function(){MailMessageEvents[_0x7b8f('0x4')](_0x424b41,_0x40060d);};}exports[_0x7b8f('0x5')]=function(_0x290a33){for(var _0x5162f2=0x0,_0x49441b=events['length'];_0x5162f2<_0x49441b;_0x5162f2++){var _0x196ab8=events[_0x5162f2];var _0x3bed04=createListener(_0x7b8f('0x6')+_0x196ab8,_0x290a33);MailMessageEvents['on'](_0x196ab8,_0x3bed04);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index fb844f9..9fcc748 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 _0x4025=['addTeams','addAgents','put','update','delete','removeTeams','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','create','post'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x4025,0x115));var _0x5402=function(_0x16ff45,_0x269e92){_0x16ff45=_0x16ff45-0x0;var _0x211adb=_0x4025[_0x16ff45];return _0x211adb;};'use strict';var multer=require(_0x5402('0x0'));var util=require(_0x5402('0x1'));var path=require(_0x5402('0x2'));var timeout=require(_0x5402('0x3'));var express=require(_0x5402('0x4'));var router=express[_0x5402('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x5402('0x6'));var interaction=require(_0x5402('0x7'));var config=require(_0x5402('0x8'));var controller=require(_0x5402('0x9'));router[_0x5402('0xa')]('/',auth[_0x5402('0xb')](),controller[_0x5402('0xc')]);router[_0x5402('0xa')](_0x5402('0xd'),auth['isAuthenticated'](),controller[_0x5402('0xe')]);router['get'](_0x5402('0xf'),auth['isAuthenticated'](),controller[_0x5402('0x10')]);router[_0x5402('0xa')](_0x5402('0x11'),auth[_0x5402('0xb')](),controller['getMembers']);router[_0x5402('0xa')](_0x5402('0x12'),auth[_0x5402('0xb')](),controller[_0x5402('0x13')]);router[_0x5402('0xa')](_0x5402('0x14'),auth['isAuthenticated'](),controller['getAgents']);router['post']('/',auth[_0x5402('0xb')](),controller[_0x5402('0x15')]);router[_0x5402('0x16')](_0x5402('0x12'),auth[_0x5402('0xb')](),controller[_0x5402('0x17')]);router[_0x5402('0x16')](_0x5402('0x14'),auth[_0x5402('0xb')](),controller[_0x5402('0x18')]);router[_0x5402('0x19')](_0x5402('0xf'),auth[_0x5402('0xb')](),controller[_0x5402('0x1a')]);router[_0x5402('0x1b')](_0x5402('0xf'),auth[_0x5402('0xb')](),controller['destroy']);router['delete'](_0x5402('0x12'),auth[_0x5402('0xb')](),controller[_0x5402('0x1c')]);router['delete'](_0x5402('0x14'),auth[_0x5402('0xb')](),controller['removeAgents']);module[_0x5402('0x1d')]=router; \ No newline at end of file +var _0x8bd3=['update','delete','removeTeams','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','/describe','describe','show','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id'];(function(_0x8ce355,_0x51b38c){var _0x4ba014=function(_0x289414){while(--_0x289414){_0x8ce355['push'](_0x8ce355['shift']());}};_0x4ba014(++_0x51b38c);}(_0x8bd3,0xcf));var _0x38bd=function(_0x8b8564,_0x162976){_0x8b8564=_0x8b8564-0x0;var _0x360c61=_0x8bd3[_0x8b8564];return _0x360c61;};'use strict';var multer=require(_0x38bd('0x0'));var util=require(_0x38bd('0x1'));var path=require(_0x38bd('0x2'));var timeout=require(_0x38bd('0x3'));var express=require(_0x38bd('0x4'));var router=express[_0x38bd('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x38bd('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x38bd('0x7'));var controller=require(_0x38bd('0x8'));router[_0x38bd('0x9')]('/',auth[_0x38bd('0xa')](),controller['index']);router['get'](_0x38bd('0xb'),auth[_0x38bd('0xa')](),controller[_0x38bd('0xc')]);router[_0x38bd('0x9')]('/:id',auth[_0x38bd('0xa')](),controller[_0x38bd('0xd')]);router[_0x38bd('0x9')](_0x38bd('0xe'),auth[_0x38bd('0xa')](),controller[_0x38bd('0xf')]);router[_0x38bd('0x9')](_0x38bd('0x10'),auth[_0x38bd('0xa')](),controller['getTeams']);router[_0x38bd('0x9')](_0x38bd('0x11'),auth['isAuthenticated'](),controller[_0x38bd('0x12')]);router[_0x38bd('0x13')]('/',auth[_0x38bd('0xa')](),controller[_0x38bd('0x14')]);router[_0x38bd('0x13')](_0x38bd('0x10'),auth['isAuthenticated'](),controller[_0x38bd('0x15')]);router['post'](_0x38bd('0x11'),auth['isAuthenticated'](),controller[_0x38bd('0x16')]);router[_0x38bd('0x17')](_0x38bd('0x18'),auth[_0x38bd('0xa')](),controller[_0x38bd('0x19')]);router[_0x38bd('0x1a')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0x38bd('0x1a')](_0x38bd('0x10'),auth[_0x38bd('0xa')](),controller[_0x38bd('0x1b')]);router[_0x38bd('0x1a')]('/:id/users',auth[_0x38bd('0xa')](),controller['removeAgents']);module[_0x38bd('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 1987bc9..729f72f 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 _0x5057=['INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','STRING'];(function(_0x34df21,_0x159374){var _0x596aa6=function(_0x4ac322){while(--_0x4ac322){_0x34df21['push'](_0x34df21['shift']());}};_0x596aa6(++_0x159374);}(_0x5057,0xb4));var _0x7505=function(_0x5b9dd7,_0x43a06e){_0x5b9dd7=_0x5b9dd7-0x0;var _0x49ec19=_0x5057[_0x5b9dd7];return _0x49ec19;};'use strict';var Sequelize=require(_0x7505('0x0'));module['exports']={'name':{'type':Sequelize[_0x7505('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x7505('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x7505('0x3')](_0x7505('0x4'),_0x7505('0x5'),_0x7505('0x6'))}}; \ No newline at end of file +var _0x0c4b=['INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING'];(function(_0x460fd7,_0x2012db){var _0x44d1c2=function(_0x545e11){while(--_0x545e11){_0x460fd7['push'](_0x460fd7['shift']());}};_0x44d1c2(++_0x2012db);}(_0x0c4b,0x11d));var _0xb0c4=function(_0x37539e,_0x4acf62){_0x37539e=_0x37539e-0x0;var _0x110bca=_0x0c4b[_0x37539e];return _0x110bca;};'use strict';var Sequelize=require(_0xb0c4('0x0'));module[_0xb0c4('0x1')]={'name':{'type':Sequelize[_0xb0c4('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xb0c4('0x2')]},'timeout':{'type':Sequelize[_0xb0c4('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xb0c4('0x4')](_0xb0c4('0x5'),_0xb0c4('0x6'),_0xb0c4('0x7'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index a80b1e1..3de1fc6 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 _0x92aa=['then','destroy','get','MailQueues','UserProfileResource','sendStatus','error','stack','name','send','MailQueue','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','merge','map','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','length','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','describe','getMembers','findOne','UserMailQueue','order','User','findAndCountAll','UserId','updatedAt','format','%s/%s','SIP','mailPause','createdAt','getTeams','Team','addTeams','ids','online','voicePause','interface','flatMap','Agents','findOrCreate','forEach','select','field','tq.TeamId','from','team_has_mail_queues','join','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','ut.UserId\x20=\x20?','sequelize','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','value','removeTeams','isEmpty','removeAgents','emit','userMailQueue:remove','addAgents','omit','spread','userMailQueue:save','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save'];(function(_0x934425,_0x5af72f){var _0x31d596=function(_0x219869){while(--_0x219869){_0x934425['push'](_0x934425['shift']());}};_0x31d596(++_0x5af72f);}(_0x92aa,0xf3));var _0xa92a=function(_0x3ec736,_0x4689a6){_0x3ec736=_0x3ec736-0x0;var _0xe934ba=_0x92aa[_0x3ec736];return _0xe934ba;};'use strict';var emlformat=require(_0xa92a('0x0'));var rimraf=require(_0xa92a('0x1'));var zipdir=require(_0xa92a('0x2'));var jsonpatch=require(_0xa92a('0x3'));var rp=require(_0xa92a('0x4'));var moment=require('moment');var BPromise=require(_0xa92a('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xa92a('0x6'));var sox=require('sox');var csv=require(_0xa92a('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa92a('0x8'));var squel=require(_0xa92a('0x9'));var crypto=require('crypto');var jsforce=require(_0xa92a('0xa'));var deskjs=require(_0xa92a('0xb'));var toCsv=require(_0xa92a('0x7'));var querystring=require(_0xa92a('0xc'));var Papa=require(_0xa92a('0xd'));var Redis=require('ioredis');var authService=require(_0xa92a('0xe'));var qs=require(_0xa92a('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa92a('0x10'));var logger=require(_0xa92a('0x11'))(_0xa92a('0x12'));var utils=require('../../config/utils');var config=require(_0xa92a('0x13'));var licenseUtil=require(_0xa92a('0x14'));var db=require(_0xa92a('0x15'))['db'];config[_0xa92a('0x16')]=_[_0xa92a('0x17')](config[_0xa92a('0x16')],{'host':_0xa92a('0x18'),'port':0x18eb});var socket=require(_0xa92a('0x19'))(new Redis(config[_0xa92a('0x16')]));require(_0xa92a('0x1a'))[_0xa92a('0x1b')](socket);function respondWithStatusCode(_0x3ae339,_0x4e09bd){_0x4e09bd=_0x4e09bd||0xcc;return function(_0x5ed07c){if(_0x5ed07c){return _0x3ae339['sendStatus'](_0x4e09bd);}return _0x3ae339[_0xa92a('0x1c')](_0x4e09bd)[_0xa92a('0x1d')]();};}function respondWithResult(_0x2508eb,_0x45f89c){_0x45f89c=_0x45f89c||0xc8;return function(_0x1a8c3d){if(_0x1a8c3d){return _0x2508eb[_0xa92a('0x1c')](_0x45f89c)[_0xa92a('0x1e')](_0x1a8c3d);}};}function respondWithFilteredResult(_0x296713,_0xf0665f){return function(_0x371f1a){if(_0x371f1a){var _0x5284de=typeof _0xf0665f[_0xa92a('0x1f')]===_0xa92a('0x20')&&typeof _0xf0665f['limit']==='undefined';var _0x3d0365=_0x371f1a[_0xa92a('0x21')];var _0x54a0da=_0x5284de?0x0:_0xf0665f[_0xa92a('0x1f')];var _0x49b393=_0x5284de?_0x371f1a[_0xa92a('0x21')]:_0xf0665f['offset']+_0xf0665f[_0xa92a('0x22')];var _0x394ddc;if(_0x49b393>=_0x3d0365){_0x49b393=_0x3d0365;_0x394ddc=0xc8;}else{_0x394ddc=0xce;}_0x296713[_0xa92a('0x1c')](_0x394ddc);return _0x296713[_0xa92a('0x23')](_0xa92a('0x24'),_0x54a0da+'-'+_0x49b393+'/'+_0x3d0365)[_0xa92a('0x1e')](_0x371f1a);}return null;};}function patchUpdates(_0x26f7f3){return function(_0x4b1c13){try{jsonpatch[_0xa92a('0x25')](_0x4b1c13,_0x26f7f3,!![]);}catch(_0x1596fc){return BPromise['reject'](_0x1596fc);}return _0x4b1c13[_0xa92a('0x26')]();};}function saveUpdates(_0x2f69c4,_0x4d44de){return function(_0x3fe260){if(_0x3fe260){return _0x3fe260['update'](_0x2f69c4)[_0xa92a('0x27')](function(_0x120508){return _0x120508;});}return null;};}function removeEntity(_0x3d54c0,_0x3c4ab6){return function(_0x2668ba){if(_0x2668ba){return _0x2668ba[_0xa92a('0x28')]()[_0xa92a('0x27')](function(){var _0x53d560=_0x2668ba[_0xa92a('0x29')]({'plain':!![]});var _0x52b039=_0xa92a('0x2a');return db[_0xa92a('0x2b')][_0xa92a('0x28')]({'where':{'type':_0x52b039,'resourceId':_0x53d560['id']}})[_0xa92a('0x27')](function(){return _0x2668ba;});})['then'](function(){_0x3d54c0[_0xa92a('0x1c')](0xcc)[_0xa92a('0x1d')]();});}};}function handleEntityNotFound(_0x3a88e5,_0x3c099b){return function(_0x45a77d){if(!_0x45a77d){_0x3a88e5[_0xa92a('0x2c')](0x194);}return _0x45a77d;};}function handleError(_0x2767b8,_0x14b096){_0x14b096=_0x14b096||0x1f4;return function(_0x1fc7fa){logger[_0xa92a('0x2d')](_0x1fc7fa[_0xa92a('0x2e')]);if(_0x1fc7fa[_0xa92a('0x2f')]){delete _0x1fc7fa['name'];}_0x2767b8[_0xa92a('0x1c')](_0x14b096)[_0xa92a('0x30')](_0x1fc7fa);};}exports['index']=function(_0x56aa62,_0x3a9ac1){var _0xfc97eb={},_0x2db05a={},_0x15fc49={'count':0x0,'rows':[]};var _0x32fef4=_['map'](db[_0xa92a('0x31')][_0xa92a('0x32')],function(_0x1d2d74){return{'name':_0x1d2d74['fieldName'],'type':_0x1d2d74[_0xa92a('0x33')][_0xa92a('0x34')]};});_0x2db05a[_0xa92a('0x35')]=_['map'](_0x32fef4,_0xa92a('0x2f'));_0x2db05a[_0xa92a('0x36')]=_[_0xa92a('0x37')](_0x56aa62[_0xa92a('0x36')]);_0x2db05a[_0xa92a('0x38')]=_[_0xa92a('0x39')](_0x2db05a[_0xa92a('0x35')],_0x2db05a['query']);_0xfc97eb['attributes']=_['intersection'](_0x2db05a[_0xa92a('0x35')],qs[_0xa92a('0x3a')](_0x56aa62[_0xa92a('0x36')]['fields']));_0xfc97eb[_0xa92a('0x3b')]=_0xfc97eb['attributes']['length']?_0xfc97eb['attributes']:_0x2db05a['model'];if(!_0x56aa62[_0xa92a('0x36')][_0xa92a('0x3c')](_0xa92a('0x3d'))){_0xfc97eb[_0xa92a('0x22')]=qs[_0xa92a('0x22')](_0x56aa62['query'][_0xa92a('0x22')]);_0xfc97eb[_0xa92a('0x1f')]=qs[_0xa92a('0x1f')](_0x56aa62[_0xa92a('0x36')][_0xa92a('0x1f')]);}_0xfc97eb['order']=qs[_0xa92a('0x3e')](_0x56aa62['query'][_0xa92a('0x3e')]);_0xfc97eb[_0xa92a('0x3f')]=qs[_0xa92a('0x38')](_[_0xa92a('0x40')](_0x56aa62[_0xa92a('0x36')],_0x2db05a['filters']),_0x32fef4);if(_0x56aa62[_0xa92a('0x36')]['filter']){_0xfc97eb[_0xa92a('0x3f')]=_[_0xa92a('0x41')](_0xfc97eb['where'],{'$or':_[_0xa92a('0x42')](_0x32fef4,function(_0x197aa9){if(_0x197aa9[_0xa92a('0x33')]!==_0xa92a('0x43')){var _0x4ef6ac={};_0x4ef6ac[_0x197aa9[_0xa92a('0x2f')]]={'$like':'%'+_0x56aa62['query'][_0xa92a('0x44')]+'%'};return _0x4ef6ac;}})});}_0xfc97eb=_[_0xa92a('0x41')]({},_0xfc97eb,_0x56aa62[_0xa92a('0x45')]);var _0x4c348c={'where':_0xfc97eb['where']};return db[_0xa92a('0x31')][_0xa92a('0x21')](_0x4c348c)['then'](function(_0x1945e1){_0x15fc49['count']=_0x1945e1;if(_0x56aa62['query'][_0xa92a('0x46')]){_0xfc97eb[_0xa92a('0x47')]=[{'all':!![]}];}return db['MailQueue'][_0xa92a('0x48')](_0xfc97eb);})[_0xa92a('0x27')](function(_0x2bbaa3){_0x15fc49[_0xa92a('0x49')]=_0x2bbaa3;return _0x15fc49;})[_0xa92a('0x27')](respondWithFilteredResult(_0x3a9ac1,_0xfc97eb))['catch'](handleError(_0x3a9ac1,null));};exports[_0xa92a('0x4a')]=function(_0x3990cd,_0x5a83ea){var _0x4187ee={'raw':!![],'where':{'id':_0x3990cd['params']['id']}},_0x15d843={};_0x15d843[_0xa92a('0x35')]=_[_0xa92a('0x37')](db[_0xa92a('0x31')][_0xa92a('0x32')]);_0x15d843['query']=_[_0xa92a('0x37')](_0x3990cd[_0xa92a('0x36')]);_0x15d843['filters']=_[_0xa92a('0x39')](_0x15d843[_0xa92a('0x35')],_0x15d843['query']);_0x4187ee[_0xa92a('0x3b')]=_[_0xa92a('0x39')](_0x15d843[_0xa92a('0x35')],qs[_0xa92a('0x3a')](_0x3990cd['query']['fields']));_0x4187ee[_0xa92a('0x3b')]=_0x4187ee[_0xa92a('0x3b')][_0xa92a('0x4b')]?_0x4187ee['attributes']:_0x15d843[_0xa92a('0x35')];if(_0x3990cd[_0xa92a('0x36')][_0xa92a('0x46')]){_0x4187ee[_0xa92a('0x47')]=[{'all':!![]}];}_0x4187ee=_['merge']({},_0x4187ee,_0x3990cd['options']);return db[_0xa92a('0x31')][_0xa92a('0x4c')](_0x4187ee)['then'](handleEntityNotFound(_0x5a83ea,null))['then'](respondWithResult(_0x5a83ea,null))[_0xa92a('0x4d')](handleError(_0x5a83ea,null));};exports[_0xa92a('0x4e')]=function(_0x57c05a,_0x396375){return db[_0xa92a('0x31')][_0xa92a('0x4e')](_0x57c05a['body'],{})[_0xa92a('0x27')](function(_0x41ab32){var _0x3c0ffa=_0x57c05a[_0xa92a('0x4f')]['get']({'plain':!![]});if(!_0x3c0ffa)throw new Error(_0xa92a('0x50'));if(_0x3c0ffa['role']==='user'){var _0x294094=_0x41ab32['get']({'plain':!![]});var _0x38d359=_0xa92a('0x2a');return db[_0xa92a('0x51')][_0xa92a('0x4c')]({'where':{'name':_0x38d359,'userProfileId':_0x3c0ffa['userProfileId']},'raw':!![]})[_0xa92a('0x27')](function(_0x134acb){if(_0x134acb&&_0x134acb[_0xa92a('0x52')]===0x0){return db[_0xa92a('0x2b')][_0xa92a('0x4e')]({'name':_0x294094[_0xa92a('0x2f')],'resourceId':_0x294094['id'],'type':_0x134acb[_0xa92a('0x2f')],'sectionId':_0x134acb['id']},{})[_0xa92a('0x27')](function(){return _0x41ab32;});}else{return _0x41ab32;}})['catch'](function(_0x3b1a12){logger[_0xa92a('0x2d')](_0xa92a('0x53'),_0x3b1a12);throw _0x3b1a12;});}return _0x41ab32;})[_0xa92a('0x27')](respondWithResult(_0x396375,0xc9))[_0xa92a('0x4d')](handleError(_0x396375,null));};exports[_0xa92a('0x54')]=function(_0x75e033,_0x2b61e2){if(_0x75e033['body']['id']){delete _0x75e033[_0xa92a('0x55')]['id'];}return db['MailQueue'][_0xa92a('0x4c')]({'where':{'id':_0x75e033[_0xa92a('0x56')]['id']}})[_0xa92a('0x27')](handleEntityNotFound(_0x2b61e2,null))[_0xa92a('0x27')](saveUpdates(_0x75e033[_0xa92a('0x55')],null))[_0xa92a('0x27')](respondWithResult(_0x2b61e2,null))['catch'](handleError(_0x2b61e2,null));};exports[_0xa92a('0x28')]=function(_0x329962,_0x442850){return db[_0xa92a('0x31')][_0xa92a('0x4c')]({'where':{'id':_0x329962[_0xa92a('0x56')]['id']}})[_0xa92a('0x27')](handleEntityNotFound(_0x442850,null))[_0xa92a('0x27')](removeEntity(_0x442850,null))['catch'](handleError(_0x442850,null));};exports[_0xa92a('0x57')]=function(_0x30eaca,_0x11d71b){return db[_0xa92a('0x31')][_0xa92a('0x57')]()[_0xa92a('0x27')](respondWithResult(_0x11d71b,null))['catch'](handleError(_0x11d71b,null));};exports[_0xa92a('0x58')]=function(_0x58cbfe,_0x211ed9,_0x2e94ff){var _0x23a71d={'raw':!![],'where':{}},_0x234821={},_0x29e9ef;return db[_0xa92a('0x31')][_0xa92a('0x59')]({'where':{'id':_0x58cbfe[_0xa92a('0x56')]['id']}})[_0xa92a('0x27')](handleEntityNotFound(_0x211ed9,null))['then'](function(_0x1b5d8d){if(_0x1b5d8d){_0x29e9ef=_0x1b5d8d[_0xa92a('0x29')]({'plain':!![]});_0x234821[_0xa92a('0x35')]=_[_0xa92a('0x37')](db[_0xa92a('0x5a')][_0xa92a('0x32')]);_0x234821[_0xa92a('0x36')]=_[_0xa92a('0x37')](_0x58cbfe[_0xa92a('0x36')]);_0x234821[_0xa92a('0x38')]=_[_0xa92a('0x39')](_0x234821['model'],_0x234821[_0xa92a('0x36')]);_0x23a71d['attributes']=_['intersection'](_0x234821[_0xa92a('0x35')],qs[_0xa92a('0x3a')](_0x58cbfe['query']['fields']));_0x23a71d[_0xa92a('0x3b')]=_0x23a71d[_0xa92a('0x3b')][_0xa92a('0x4b')]?_0x23a71d[_0xa92a('0x3b')]:_0x234821[_0xa92a('0x35')];if(!_0x58cbfe[_0xa92a('0x36')][_0xa92a('0x3c')](_0xa92a('0x3d'))){_0x23a71d[_0xa92a('0x22')]=qs[_0xa92a('0x22')](_0x58cbfe[_0xa92a('0x36')]['limit']);_0x23a71d['offset']=qs[_0xa92a('0x1f')](_0x58cbfe[_0xa92a('0x36')][_0xa92a('0x1f')]);}_0x23a71d[_0xa92a('0x5b')]=qs['sort'](_0x58cbfe[_0xa92a('0x36')]['sort']);_0x23a71d[_0xa92a('0x3f')]=qs['filters'](_[_0xa92a('0x40')](_0x58cbfe[_0xa92a('0x36')],_0x234821[_0xa92a('0x38')]));_0x23a71d[_0xa92a('0x3f')]['MailQueueId']=_0x1b5d8d['id'];if(_0x58cbfe[_0xa92a('0x36')]['filter']){_0x23a71d[_0xa92a('0x3f')]=_['merge'](_0x23a71d['where'],{'$or':_[_0xa92a('0x42')](_0x23a71d[_0xa92a('0x3b')],function(_0x255470){var _0x5e7490={};_0x5e7490[_0x255470]={'$like':'%'+_0x58cbfe[_0xa92a('0x36')][_0xa92a('0x44')]+'%'};return _0x5e7490;})});}_0x23a71d=_[_0xa92a('0x41')]({},_0x23a71d,_0x58cbfe[_0xa92a('0x45')]);return db[_0xa92a('0x5a')][_0xa92a('0x48')](_0x23a71d);}})[_0xa92a('0x27')](function(_0x397ac0){if(_0x397ac0){return db[_0xa92a('0x5c')][_0xa92a('0x5d')]({'where':{'id':_[_0xa92a('0x42')](_0x397ac0,_0xa92a('0x5e')),'role':'agent'},'attributes':['id','name','mailPause',_0xa92a('0x5f'),'createdAt']});}})['then'](function(_0x502076){if(_0x502076){return{'count':_0x502076[_0xa92a('0x21')],'rows':_['map'](_0x502076['rows'],function(_0x4a42a4){return{'membername':_0x4a42a4[_0xa92a('0x2f')],'UserId':_0x4a42a4['id'],'queue_name':_0x29e9ef[_0xa92a('0x2f')],'MailQueueId':_0x29e9ef['id'],'interface':util[_0xa92a('0x60')](_0xa92a('0x61'),_0xa92a('0x62'),_0x4a42a4[_0xa92a('0x2f')]),'penalty':0x0,'paused':_0x4a42a4[_0xa92a('0x63')],'createdAt':_0x4a42a4[_0xa92a('0x64')],'updatedAt':_0x4a42a4[_0xa92a('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xa92a('0x27')](respondWithFilteredResult(_0x211ed9,_0x23a71d))[_0xa92a('0x4d')](handleError(_0x211ed9,null));};exports[_0xa92a('0x65')]=function(_0x4a39ba,_0x3b2294,_0x23fd09){var _0x3e8d7d={};var _0x339ebf={};var _0x21dd17;var _0x40ae03;return db[_0xa92a('0x31')][_0xa92a('0x59')]({'where':{'id':_0x4a39ba[_0xa92a('0x56')]['id']}})['then'](handleEntityNotFound(_0x3b2294,null))[_0xa92a('0x27')](function(_0x499aa4){if(_0x499aa4){_0x21dd17=_0x499aa4;_0x339ebf[_0xa92a('0x35')]=_['keys'](db[_0xa92a('0x66')][_0xa92a('0x32')]);_0x339ebf['query']=_[_0xa92a('0x37')](_0x4a39ba[_0xa92a('0x36')]);_0x339ebf[_0xa92a('0x38')]=_[_0xa92a('0x39')](_0x339ebf['model'],_0x339ebf[_0xa92a('0x36')]);_0x3e8d7d[_0xa92a('0x3b')]=_[_0xa92a('0x39')](_0x339ebf['model'],qs[_0xa92a('0x3a')](_0x4a39ba[_0xa92a('0x36')]['fields']));_0x3e8d7d[_0xa92a('0x3b')]=_0x3e8d7d[_0xa92a('0x3b')][_0xa92a('0x4b')]?_0x3e8d7d[_0xa92a('0x3b')]:_0x339ebf[_0xa92a('0x35')];_0x3e8d7d[_0xa92a('0x5b')]=qs[_0xa92a('0x3e')](_0x4a39ba['query']['sort']);_0x3e8d7d['where']=qs['filters'](_[_0xa92a('0x40')](_0x4a39ba[_0xa92a('0x36')],_0x339ebf[_0xa92a('0x38')]));if(_0x4a39ba[_0xa92a('0x36')]['filter']){_0x3e8d7d['where']=_[_0xa92a('0x41')](_0x3e8d7d[_0xa92a('0x3f')],{'$or':_[_0xa92a('0x42')](_0x3e8d7d[_0xa92a('0x3b')],function(_0x4cce09){var _0x1f8a0b={};_0x1f8a0b[_0x4cce09]={'$like':'%'+_0x4a39ba['query']['filter']+'%'};return _0x1f8a0b;})});}_0x3e8d7d=_[_0xa92a('0x41')]({},_0x3e8d7d,_0x4a39ba['options']);return _0x21dd17['getTeams'](_0x3e8d7d);}})[_0xa92a('0x27')](function(_0x2ae688){if(_0x2ae688){_0x40ae03=_0x2ae688[_0xa92a('0x4b')];if(!_0x4a39ba[_0xa92a('0x36')][_0xa92a('0x3c')]('nolimit')){_0x3e8d7d[_0xa92a('0x22')]=qs['limit'](_0x4a39ba[_0xa92a('0x36')][_0xa92a('0x22')]);_0x3e8d7d[_0xa92a('0x1f')]=qs[_0xa92a('0x1f')](_0x4a39ba[_0xa92a('0x36')][_0xa92a('0x1f')]);}return _0x21dd17[_0xa92a('0x65')](_0x3e8d7d);}})[_0xa92a('0x27')](function(_0x475f45){if(_0x475f45){return _0x475f45?{'count':_0x40ae03,'rows':_0x475f45}:null;}})[_0xa92a('0x27')](respondWithResult(_0x3b2294,null))[_0xa92a('0x4d')](handleError(_0x3b2294,null));};exports[_0xa92a('0x67')]=function(_0x598fd9,_0x3224f5,_0x1ac685){var _0x5b32c0=_0x598fd9[_0xa92a('0x55')][_0xa92a('0x68')];return db[_0xa92a('0x66')][_0xa92a('0x48')]({'where':{'id':_0x5b32c0},'attributes':['id'],'include':[{'model':db[_0xa92a('0x5c')],'as':'Agents','attributes':['id','name',_0xa92a('0x69'),_0xa92a('0x6a'),_0xa92a('0x6b')],'raw':!![]}]})[_0xa92a('0x27')](function(_0x21759d){if(_0x21759d){var _0x348c2b=_[_0xa92a('0x6c')](_0x21759d,function(_0x35574b){var _0x49b4d8=_0x35574b[_0xa92a('0x29')]({'plain':!![]});return _0x49b4d8[_0xa92a('0x6d')];});return db['MailQueue'][_0xa92a('0x4c')]({'where':{'id':_0x598fd9['params']['id']}})['then'](function(_0x20053d){return db['sequelize']['transaction'](function(_0x2289d7){return _0x20053d[_0xa92a('0x67')](_0x5b32c0,{'transaction':_0x2289d7})[_0xa92a('0x27')](function(){return BPromise['each'](_0x348c2b,function(_0x48ad3b){return db[_0xa92a('0x5a')][_0xa92a('0x6e')]({'where':{'UserId':_0x48ad3b['id'],'MailQueueId':_0x598fd9['params']['id']},'transaction':_0x2289d7});});})[_0xa92a('0x27')](function(){_0x348c2b[_0xa92a('0x6f')](function(_0x20cea2){socket['emit']('userMailQueue:save',{'UserId':_0x20cea2['id'],'MailQueueId':_0x20053d['id']});});});});});}})[_0xa92a('0x27')](respondWithStatusCode(_0x3224f5,null))[_0xa92a('0x4d')](handleError(_0x3224f5,null));};exports['removeTeams']=function(_0x1d0ffb,_0x51d9c1,_0xc95e25){return db[_0xa92a('0x66')]['findAll']({'where':{'id':_0x1d0ffb[_0xa92a('0x36')][_0xa92a('0x68')]},'attributes':['id'],'include':[{'model':db[_0xa92a('0x5c')],'as':_0xa92a('0x6d'),'attributes':['id'],'raw':!![]}]})[_0xa92a('0x27')](handleEntityNotFound(_0x51d9c1,null))[_0xa92a('0x27')](function(_0x182392){var _0x22098c=_[_0xa92a('0x42')](_0x182392,'id');var _0x5dcb02=[];var _0x447174=[];var _0x854d34=squel[_0xa92a('0x70')]();_0x854d34[_0xa92a('0x71')](_0xa92a('0x72'))[_0xa92a('0x73')](_0xa92a('0x74'),'tq')[_0xa92a('0x75')]('user_has_teams','ut',_0xa92a('0x76'))[_0xa92a('0x3f')](_0xa92a('0x77'),_0x1d0ffb['params']['id']);for(var _0x45eb91=0x0;_0x45eb91<_0x182392['length'];_0x45eb91+=0x1){let _0x1227c9=_0x182392[_0x45eb91];for(var _0x422292=0x0;_0x422292<_0x1227c9[_0xa92a('0x6d')][_0xa92a('0x4b')];_0x422292+=0x1){let _0x140011=_0x1227c9['Agents'][_0x422292];var _0x4e08cd=_0x854d34['clone']();_0x4e08cd[_0xa92a('0x3f')](_0xa92a('0x78'),_0x140011['id']);_0x447174['push'](db[_0xa92a('0x79')]['query'](_0x4e08cd[_0xa92a('0x7a')](),{'type':db[_0xa92a('0x79')][_0xa92a('0x7b')][_0xa92a('0x7c')]})[_0xa92a('0x27')](function(_0xfbdc14){if(_0xfbdc14[_0xa92a('0x4b')]===0x1){return _0x140011['id'];}else{var _0x457589=_[_0xa92a('0x7d')](_[_0xa92a('0x42')](_0xfbdc14,_0xa92a('0x7e')),function(_0x45530c){return _['includes'](_0x22098c,_0x45530c);});if(_0x457589){return _0x140011['id'];}}}));}}return BPromise[_0xa92a('0x7f')](_0x447174)[_0xa92a('0x27')](function(_0x454856){_0x5dcb02=_(_0x5dcb02)[_0xa92a('0x80')](_0x454856)[_0xa92a('0x81')]()[_0xa92a('0x82')]();return db[_0xa92a('0x31')][_0xa92a('0x4c')]({'where':{'id':_0x1d0ffb['params']['id']}})[_0xa92a('0x27')](function(_0x42a03e){return db['sequelize']['transaction'](function(_0x59162a){return _0x42a03e[_0xa92a('0x83')](_0x1d0ffb['query'][_0xa92a('0x68')],{'transaction':_0x59162a})[_0xa92a('0x27')](function(){if(!_[_0xa92a('0x84')](_0x5dcb02)){return _0x42a03e[_0xa92a('0x85')](_0x5dcb02,{'transaction':_0x59162a});}})['then'](function(){_0x5dcb02['forEach'](function(_0xf87576){socket[_0xa92a('0x86')](_0xa92a('0x87'),{'UserId':_0xf87576,'MailQueueId':_0x42a03e['id']});});});});});});})[_0xa92a('0x27')](respondWithStatusCode(_0x51d9c1,null))[_0xa92a('0x4d')](handleError(_0x51d9c1,null));};exports[_0xa92a('0x88')]=function(_0x2f8b15,_0x54d9b1,_0x1c49ad){return db['MailQueue'][_0xa92a('0x4c')]({'where':{'id':_0x2f8b15[_0xa92a('0x56')]['id']}})[_0xa92a('0x27')](handleEntityNotFound(_0x54d9b1,null))[_0xa92a('0x27')](function(_0x1acdb7){if(_0x1acdb7){return _0x1acdb7['addAgents'](_0x2f8b15[_0xa92a('0x55')][_0xa92a('0x68')],_[_0xa92a('0x89')](_0x2f8b15[_0xa92a('0x55')],['ids','id'])||{})[_0xa92a('0x8a')](function(_0x47627d){for(var _0x51a10c=0x0;_0x51a10c<_0x2f8b15[_0xa92a('0x55')]['ids'][_0xa92a('0x4b')];_0x51a10c+=0x1){socket[_0xa92a('0x86')](_0xa92a('0x8b'),{'UserId':Number(_0x2f8b15[_0xa92a('0x55')][_0xa92a('0x68')][_0x51a10c]),'MailQueueId':Number(_0x2f8b15['params']['id'])});}return _0x47627d;});}})[_0xa92a('0x27')](respondWithResult(_0x54d9b1,null))['catch'](handleError(_0x54d9b1,null));};exports['removeAgents']=function(_0x2c66ae,_0x259647,_0x17e988){return db[_0xa92a('0x31')]['find']({'where':{'id':_0x2c66ae[_0xa92a('0x56')]['id']}})[_0xa92a('0x27')](handleEntityNotFound(_0x259647,null))[_0xa92a('0x27')](function(_0x32e31d){if(_0x32e31d){return _0x32e31d['removeAgents'](_0x2c66ae[_0xa92a('0x36')][_0xa92a('0x68')])[_0xa92a('0x27')](function(){if(_['isArray'](_0x2c66ae[_0xa92a('0x36')][_0xa92a('0x68')])){for(var _0x11785f=0x0;_0x11785f<_0x2c66ae['query'][_0xa92a('0x68')][_0xa92a('0x4b')];_0x11785f+=0x1){socket[_0xa92a('0x86')]('userMailQueue:remove',{'UserId':Number(_0x2c66ae[_0xa92a('0x36')][_0xa92a('0x68')][_0x11785f]),'MailQueueId':Number(_0x2c66ae[_0xa92a('0x56')]['id'])});}}else{socket['emit'](_0xa92a('0x87'),{'UserId':Number(_0x2c66ae[_0xa92a('0x36')]['ids']),'MailQueueId':Number(_0x2c66ae[_0xa92a('0x56')]['id'])});}});}})['then'](respondWithStatusCode(_0x259647,null))[_0xa92a('0x4d')](handleError(_0x259647,null));};exports[_0xa92a('0x8c')]=function(_0x4192ce,_0x4e47aa,_0x491cdc){var _0x14f2c7={};var _0x4f37b4={};var _0x38d2f5;var _0x37a446;return db['MailQueue'][_0xa92a('0x59')]({'where':{'id':_0x4192ce['params']['id']}})[_0xa92a('0x27')](handleEntityNotFound(_0x4e47aa,null))[_0xa92a('0x27')](function(_0x4ac9bb){if(_0x4ac9bb){_0x38d2f5=_0x4ac9bb;_0x4f37b4['model']=_[_0xa92a('0x37')](db[_0xa92a('0x5c')]['rawAttributes']);_0x4f37b4['query']=_['keys'](_0x4192ce[_0xa92a('0x36')]);_0x4f37b4[_0xa92a('0x38')]=_['intersection'](_0x4f37b4[_0xa92a('0x35')],_0x4f37b4[_0xa92a('0x36')]);_0x14f2c7[_0xa92a('0x3b')]=_[_0xa92a('0x39')](_0x4f37b4[_0xa92a('0x35')],qs[_0xa92a('0x3a')](_0x4192ce[_0xa92a('0x36')][_0xa92a('0x3a')]));_0x14f2c7['attributes']=_0x14f2c7[_0xa92a('0x3b')]['length']?_0x14f2c7['attributes']:_0x4f37b4[_0xa92a('0x35')];_0x14f2c7[_0xa92a('0x5b')]=qs[_0xa92a('0x3e')](_0x4192ce[_0xa92a('0x36')][_0xa92a('0x3e')]);_0x14f2c7[_0xa92a('0x3f')]=qs[_0xa92a('0x38')](_[_0xa92a('0x40')](_0x4192ce[_0xa92a('0x36')],_0x4f37b4[_0xa92a('0x38')]));if(_0x4192ce[_0xa92a('0x36')][_0xa92a('0x44')]){_0x14f2c7[_0xa92a('0x3f')]=_[_0xa92a('0x41')](_0x14f2c7['where'],{'$or':_[_0xa92a('0x42')](_0x14f2c7[_0xa92a('0x3b')],function(_0x42f105){var _0xffabc={};_0xffabc[_0x42f105]={'$like':'%'+_0x4192ce['query']['filter']+'%'};return _0xffabc;})});}_0x14f2c7=_['merge']({},_0x14f2c7,_0x4192ce[_0xa92a('0x45')]);return _0x38d2f5[_0xa92a('0x8c')](_0x14f2c7);}})[_0xa92a('0x27')](function(_0xace0ed){if(_0xace0ed){_0x37a446=_0xace0ed['length'];if(!_0x4192ce[_0xa92a('0x36')]['hasOwnProperty'](_0xa92a('0x3d'))){_0x14f2c7[_0xa92a('0x22')]=qs['limit'](_0x4192ce[_0xa92a('0x36')]['limit']);_0x14f2c7['offset']=qs[_0xa92a('0x1f')](_0x4192ce[_0xa92a('0x36')][_0xa92a('0x1f')]);}return _0x38d2f5[_0xa92a('0x8c')](_0x14f2c7);}})[_0xa92a('0x27')](function(_0xe86501){if(_0xe86501){return _0xe86501?{'count':_0x37a446,'rows':_0xe86501}:null;}})['then'](respondWithResult(_0x4e47aa,null))[_0xa92a('0x4d')](handleError(_0x4e47aa,null));}; \ No newline at end of file +var _0x22f6=['../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','json','undefined','limit','count','offset','status','set','Content-Range','apply','reject','save','destroy','then','get','MailQueues','end','error','stack','name','index','map','MailQueue','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','params','length','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserMailQueue','MailQueueId','User','UserId','agent','updatedAt','createdAt','%s/%s','SIP','mailPause','getTeams','Team','addTeams','ids','voicePause','interface','flatMap','Agents','sequelize','transaction','each','forEach','emit','removeTeams','tq.TeamId','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','includes','all','compact','value','isEmpty','removeAgents','userMailQueue:remove','addAgents','spread','userMailQueue:save','isArray','getAgents','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis'];(function(_0xc12d9c,_0x449772){var _0x11e7ad=function(_0x528058){while(--_0x528058){_0xc12d9c['push'](_0xc12d9c['shift']());}};_0x11e7ad(++_0x449772);}(_0x22f6,0x10e));var _0x622f=function(_0x332aea,_0x3b0bb9){_0x332aea=_0x332aea-0x0;var _0x58d26e=_0x22f6[_0x332aea];return _0x58d26e;};'use strict';var emlformat=require(_0x622f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x622f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x622f('0x2'));var moment=require(_0x622f('0x3'));var BPromise=require(_0x622f('0x4'));var Mustache=require(_0x622f('0x5'));var util=require(_0x622f('0x6'));var path=require(_0x622f('0x7'));var sox=require(_0x622f('0x8'));var csv=require(_0x622f('0x9'));var ejs=require(_0x622f('0xa'));var fs=require('fs');var fs_extra=require(_0x622f('0xb'));var _=require('lodash');var squel=require(_0x622f('0xc'));var crypto=require(_0x622f('0xd'));var jsforce=require(_0x622f('0xe'));var deskjs=require(_0x622f('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x622f('0x10'));var Redis=require(_0x622f('0x11'));var authService=require(_0x622f('0x12'));var qs=require(_0x622f('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x622f('0x14'));var logger=require(_0x622f('0x15'))(_0x622f('0x16'));var utils=require(_0x622f('0x17'));var config=require(_0x622f('0x18'));var licenseUtil=require(_0x622f('0x19'));var db=require(_0x622f('0x1a'))['db'];config[_0x622f('0x1b')]=_[_0x622f('0x1c')](config['redis'],{'host':_0x622f('0x1d'),'port':0x18eb});var socket=require(_0x622f('0x1e'))(new Redis(config[_0x622f('0x1b')]));require('./mailQueue.socket')[_0x622f('0x1f')](socket);function respondWithStatusCode(_0x4fc36c,_0xb80b29){_0xb80b29=_0xb80b29||0xcc;return function(_0x5231e4){if(_0x5231e4){return _0x4fc36c[_0x622f('0x20')](_0xb80b29);}return _0x4fc36c['status'](_0xb80b29)['end']();};}function respondWithResult(_0x66aac6,_0x280535){_0x280535=_0x280535||0xc8;return function(_0x372b9e){if(_0x372b9e){return _0x66aac6['status'](_0x280535)[_0x622f('0x21')](_0x372b9e);}};}function respondWithFilteredResult(_0x27dfe8,_0x27065f){return function(_0x2c84ca){if(_0x2c84ca){var _0x31a972=typeof _0x27065f['offset']===_0x622f('0x22')&&typeof _0x27065f[_0x622f('0x23')]==='undefined';var _0x186782=_0x2c84ca[_0x622f('0x24')];var _0x449937=_0x31a972?0x0:_0x27065f['offset'];var _0x12e0ce=_0x31a972?_0x2c84ca[_0x622f('0x24')]:_0x27065f[_0x622f('0x25')]+_0x27065f['limit'];var _0x436566;if(_0x12e0ce>=_0x186782){_0x12e0ce=_0x186782;_0x436566=0xc8;}else{_0x436566=0xce;}_0x27dfe8[_0x622f('0x26')](_0x436566);return _0x27dfe8[_0x622f('0x27')](_0x622f('0x28'),_0x449937+'-'+_0x12e0ce+'/'+_0x186782)[_0x622f('0x21')](_0x2c84ca);}return null;};}function patchUpdates(_0x3c4268){return function(_0x143410){try{jsonpatch[_0x622f('0x29')](_0x143410,_0x3c4268,!![]);}catch(_0x157d4e){return BPromise[_0x622f('0x2a')](_0x157d4e);}return _0x143410[_0x622f('0x2b')]();};}function saveUpdates(_0x35dd81,_0x11fd61){return function(_0x34a3f4){if(_0x34a3f4){return _0x34a3f4['update'](_0x35dd81)['then'](function(_0x1944b3){return _0x1944b3;});}return null;};}function removeEntity(_0x426d45,_0xac3283){return function(_0x5eaddb){if(_0x5eaddb){return _0x5eaddb[_0x622f('0x2c')]()[_0x622f('0x2d')](function(){var _0x1fe9c8=_0x5eaddb[_0x622f('0x2e')]({'plain':!![]});var _0x268882=_0x622f('0x2f');return db['UserProfileResource'][_0x622f('0x2c')]({'where':{'type':_0x268882,'resourceId':_0x1fe9c8['id']}})[_0x622f('0x2d')](function(){return _0x5eaddb;});})[_0x622f('0x2d')](function(){_0x426d45[_0x622f('0x26')](0xcc)[_0x622f('0x30')]();});}};}function handleEntityNotFound(_0x5ae346,_0x639538){return function(_0x251681){if(!_0x251681){_0x5ae346['sendStatus'](0x194);}return _0x251681;};}function handleError(_0x55ee1e,_0x52b5b3){_0x52b5b3=_0x52b5b3||0x1f4;return function(_0x36e331){logger[_0x622f('0x31')](_0x36e331[_0x622f('0x32')]);if(_0x36e331['name']){delete _0x36e331[_0x622f('0x33')];}_0x55ee1e[_0x622f('0x26')](_0x52b5b3)['send'](_0x36e331);};}exports[_0x622f('0x34')]=function(_0x41fb35,_0x4abf33){var _0x90373c={},_0x3c31a0={},_0x47487f={'count':0x0,'rows':[]};var _0x553d07=_[_0x622f('0x35')](db[_0x622f('0x36')][_0x622f('0x37')],function(_0x3c3c7d){return{'name':_0x3c3c7d[_0x622f('0x38')],'type':_0x3c3c7d[_0x622f('0x39')]['key']};});_0x3c31a0[_0x622f('0x3a')]=_[_0x622f('0x35')](_0x553d07,'name');_0x3c31a0['query']=_[_0x622f('0x3b')](_0x41fb35[_0x622f('0x3c')]);_0x3c31a0[_0x622f('0x3d')]=_[_0x622f('0x3e')](_0x3c31a0[_0x622f('0x3a')],_0x3c31a0['query']);_0x90373c[_0x622f('0x3f')]=_[_0x622f('0x3e')](_0x3c31a0[_0x622f('0x3a')],qs[_0x622f('0x40')](_0x41fb35[_0x622f('0x3c')][_0x622f('0x40')]));_0x90373c[_0x622f('0x3f')]=_0x90373c[_0x622f('0x3f')]['length']?_0x90373c[_0x622f('0x3f')]:_0x3c31a0[_0x622f('0x3a')];if(!_0x41fb35[_0x622f('0x3c')][_0x622f('0x41')](_0x622f('0x42'))){_0x90373c['limit']=qs[_0x622f('0x23')](_0x41fb35['query'][_0x622f('0x23')]);_0x90373c[_0x622f('0x25')]=qs[_0x622f('0x25')](_0x41fb35['query'][_0x622f('0x25')]);}_0x90373c[_0x622f('0x43')]=qs[_0x622f('0x44')](_0x41fb35[_0x622f('0x3c')][_0x622f('0x44')]);_0x90373c[_0x622f('0x45')]=qs[_0x622f('0x3d')](_[_0x622f('0x46')](_0x41fb35[_0x622f('0x3c')],_0x3c31a0['filters']),_0x553d07);if(_0x41fb35[_0x622f('0x3c')]['filter']){_0x90373c['where']=_[_0x622f('0x47')](_0x90373c[_0x622f('0x45')],{'$or':_[_0x622f('0x35')](_0x553d07,function(_0x57d35f){if(_0x57d35f['type']!==_0x622f('0x48')){var _0x2da723={};_0x2da723[_0x57d35f[_0x622f('0x33')]]={'$like':'%'+_0x41fb35[_0x622f('0x3c')][_0x622f('0x49')]+'%'};return _0x2da723;}})});}_0x90373c=_[_0x622f('0x47')]({},_0x90373c,_0x41fb35[_0x622f('0x4a')]);var _0x5aea90={'where':_0x90373c['where']};return db['MailQueue'][_0x622f('0x24')](_0x5aea90)[_0x622f('0x2d')](function(_0x2b9f75){_0x47487f[_0x622f('0x24')]=_0x2b9f75;if(_0x41fb35[_0x622f('0x3c')][_0x622f('0x4b')]){_0x90373c[_0x622f('0x4c')]=[{'all':!![]}];}return db[_0x622f('0x36')][_0x622f('0x4d')](_0x90373c);})[_0x622f('0x2d')](function(_0x57b158){_0x47487f[_0x622f('0x4e')]=_0x57b158;return _0x47487f;})[_0x622f('0x2d')](respondWithFilteredResult(_0x4abf33,_0x90373c))['catch'](handleError(_0x4abf33,null));};exports['show']=function(_0x51ea38,_0x716405){var _0x5407cc={'raw':!![],'where':{'id':_0x51ea38[_0x622f('0x4f')]['id']}},_0x342b2c={};_0x342b2c[_0x622f('0x3a')]=_['keys'](db[_0x622f('0x36')][_0x622f('0x37')]);_0x342b2c[_0x622f('0x3c')]=_[_0x622f('0x3b')](_0x51ea38[_0x622f('0x3c')]);_0x342b2c[_0x622f('0x3d')]=_['intersection'](_0x342b2c['model'],_0x342b2c['query']);_0x5407cc[_0x622f('0x3f')]=_[_0x622f('0x3e')](_0x342b2c[_0x622f('0x3a')],qs[_0x622f('0x40')](_0x51ea38[_0x622f('0x3c')][_0x622f('0x40')]));_0x5407cc[_0x622f('0x3f')]=_0x5407cc['attributes'][_0x622f('0x50')]?_0x5407cc[_0x622f('0x3f')]:_0x342b2c[_0x622f('0x3a')];if(_0x51ea38[_0x622f('0x3c')][_0x622f('0x4b')]){_0x5407cc[_0x622f('0x4c')]=[{'all':!![]}];}_0x5407cc=_[_0x622f('0x47')]({},_0x5407cc,_0x51ea38[_0x622f('0x4a')]);return db[_0x622f('0x36')][_0x622f('0x51')](_0x5407cc)[_0x622f('0x2d')](handleEntityNotFound(_0x716405,null))[_0x622f('0x2d')](respondWithResult(_0x716405,null))[_0x622f('0x52')](handleError(_0x716405,null));};exports[_0x622f('0x53')]=function(_0x67a3e8,_0x146a05){return db[_0x622f('0x36')][_0x622f('0x53')](_0x67a3e8[_0x622f('0x54')],{})[_0x622f('0x2d')](function(_0x43c34c){var _0x349489=_0x67a3e8[_0x622f('0x55')][_0x622f('0x2e')]({'plain':!![]});if(!_0x349489)throw new Error(_0x622f('0x56'));if(_0x349489[_0x622f('0x57')]==='user'){var _0x4c4190=_0x43c34c['get']({'plain':!![]});var _0x5a94c3=_0x622f('0x2f');return db[_0x622f('0x58')][_0x622f('0x51')]({'where':{'name':_0x5a94c3,'userProfileId':_0x349489[_0x622f('0x59')]},'raw':!![]})[_0x622f('0x2d')](function(_0x5c7f8a){if(_0x5c7f8a&&_0x5c7f8a[_0x622f('0x5a')]===0x0){return db['UserProfileResource'][_0x622f('0x53')]({'name':_0x4c4190[_0x622f('0x33')],'resourceId':_0x4c4190['id'],'type':_0x5c7f8a['name'],'sectionId':_0x5c7f8a['id']},{})[_0x622f('0x2d')](function(){return _0x43c34c;});}else{return _0x43c34c;}})['catch'](function(_0x35087d){logger[_0x622f('0x31')](_0x622f('0x5b'),_0x35087d);throw _0x35087d;});}return _0x43c34c;})[_0x622f('0x2d')](respondWithResult(_0x146a05,0xc9))[_0x622f('0x52')](handleError(_0x146a05,null));};exports['update']=function(_0x817e8f,_0x2660fd){if(_0x817e8f[_0x622f('0x54')]['id']){delete _0x817e8f['body']['id'];}return db['MailQueue'][_0x622f('0x51')]({'where':{'id':_0x817e8f[_0x622f('0x4f')]['id']}})['then'](handleEntityNotFound(_0x2660fd,null))['then'](saveUpdates(_0x817e8f[_0x622f('0x54')],null))['then'](respondWithResult(_0x2660fd,null))[_0x622f('0x52')](handleError(_0x2660fd,null));};exports[_0x622f('0x2c')]=function(_0x4a3424,_0x5e67d4){return db[_0x622f('0x36')][_0x622f('0x51')]({'where':{'id':_0x4a3424['params']['id']}})[_0x622f('0x2d')](handleEntityNotFound(_0x5e67d4,null))['then'](removeEntity(_0x5e67d4,null))[_0x622f('0x52')](handleError(_0x5e67d4,null));};exports[_0x622f('0x5c')]=function(_0x255284,_0x49b638){return db[_0x622f('0x36')]['describe']()[_0x622f('0x2d')](respondWithResult(_0x49b638,null))['catch'](handleError(_0x49b638,null));};exports[_0x622f('0x5d')]=function(_0x5a29da,_0x1a2c28,_0x547240){var _0x53f62f={'raw':!![],'where':{}},_0x110ea8={},_0x130f56;return db[_0x622f('0x36')][_0x622f('0x5e')]({'where':{'id':_0x5a29da[_0x622f('0x4f')]['id']}})[_0x622f('0x2d')](handleEntityNotFound(_0x1a2c28,null))[_0x622f('0x2d')](function(_0x2f43a3){if(_0x2f43a3){_0x130f56=_0x2f43a3['get']({'plain':!![]});_0x110ea8[_0x622f('0x3a')]=_[_0x622f('0x3b')](db[_0x622f('0x5f')]['rawAttributes']);_0x110ea8['query']=_[_0x622f('0x3b')](_0x5a29da[_0x622f('0x3c')]);_0x110ea8['filters']=_['intersection'](_0x110ea8[_0x622f('0x3a')],_0x110ea8[_0x622f('0x3c')]);_0x53f62f[_0x622f('0x3f')]=_[_0x622f('0x3e')](_0x110ea8[_0x622f('0x3a')],qs['fields'](_0x5a29da[_0x622f('0x3c')][_0x622f('0x40')]));_0x53f62f[_0x622f('0x3f')]=_0x53f62f[_0x622f('0x3f')][_0x622f('0x50')]?_0x53f62f[_0x622f('0x3f')]:_0x110ea8[_0x622f('0x3a')];if(!_0x5a29da['query'][_0x622f('0x41')]('nolimit')){_0x53f62f['limit']=qs[_0x622f('0x23')](_0x5a29da[_0x622f('0x3c')][_0x622f('0x23')]);_0x53f62f[_0x622f('0x25')]=qs[_0x622f('0x25')](_0x5a29da['query'][_0x622f('0x25')]);}_0x53f62f['order']=qs[_0x622f('0x44')](_0x5a29da[_0x622f('0x3c')]['sort']);_0x53f62f[_0x622f('0x45')]=qs['filters'](_[_0x622f('0x46')](_0x5a29da[_0x622f('0x3c')],_0x110ea8['filters']));_0x53f62f[_0x622f('0x45')][_0x622f('0x60')]=_0x2f43a3['id'];if(_0x5a29da['query']['filter']){_0x53f62f[_0x622f('0x45')]=_['merge'](_0x53f62f['where'],{'$or':_['map'](_0x53f62f[_0x622f('0x3f')],function(_0x4ad99e){var _0x3f3552={};_0x3f3552[_0x4ad99e]={'$like':'%'+_0x5a29da['query']['filter']+'%'};return _0x3f3552;})});}_0x53f62f=_[_0x622f('0x47')]({},_0x53f62f,_0x5a29da[_0x622f('0x4a')]);return db[_0x622f('0x5f')]['findAll'](_0x53f62f);}})[_0x622f('0x2d')](function(_0x425b56){if(_0x425b56){return db[_0x622f('0x61')]['findAndCountAll']({'where':{'id':_[_0x622f('0x35')](_0x425b56,_0x622f('0x62')),'role':_0x622f('0x63')},'attributes':['id',_0x622f('0x33'),'mailPause',_0x622f('0x64'),_0x622f('0x65')]});}})[_0x622f('0x2d')](function(_0x28c4b7){if(_0x28c4b7){return{'count':_0x28c4b7[_0x622f('0x24')],'rows':_['map'](_0x28c4b7[_0x622f('0x4e')],function(_0x50bc6e){return{'membername':_0x50bc6e['name'],'UserId':_0x50bc6e['id'],'queue_name':_0x130f56[_0x622f('0x33')],'MailQueueId':_0x130f56['id'],'interface':util['format'](_0x622f('0x66'),_0x622f('0x67'),_0x50bc6e['name']),'penalty':0x0,'paused':_0x50bc6e[_0x622f('0x68')],'createdAt':_0x50bc6e[_0x622f('0x65')],'updatedAt':_0x50bc6e['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x622f('0x2d')](respondWithFilteredResult(_0x1a2c28,_0x53f62f))[_0x622f('0x52')](handleError(_0x1a2c28,null));};exports[_0x622f('0x69')]=function(_0x390c31,_0x18c8b8,_0x513c8a){var _0x14b438={};var _0x1533d0={};var _0x24db11;var _0x2b16eb;return db['MailQueue'][_0x622f('0x5e')]({'where':{'id':_0x390c31[_0x622f('0x4f')]['id']}})['then'](handleEntityNotFound(_0x18c8b8,null))['then'](function(_0x5c006d){if(_0x5c006d){_0x24db11=_0x5c006d;_0x1533d0[_0x622f('0x3a')]=_[_0x622f('0x3b')](db[_0x622f('0x6a')]['rawAttributes']);_0x1533d0[_0x622f('0x3c')]=_[_0x622f('0x3b')](_0x390c31['query']);_0x1533d0[_0x622f('0x3d')]=_['intersection'](_0x1533d0[_0x622f('0x3a')],_0x1533d0[_0x622f('0x3c')]);_0x14b438[_0x622f('0x3f')]=_[_0x622f('0x3e')](_0x1533d0['model'],qs['fields'](_0x390c31[_0x622f('0x3c')][_0x622f('0x40')]));_0x14b438['attributes']=_0x14b438[_0x622f('0x3f')][_0x622f('0x50')]?_0x14b438[_0x622f('0x3f')]:_0x1533d0['model'];_0x14b438['order']=qs['sort'](_0x390c31['query']['sort']);_0x14b438[_0x622f('0x45')]=qs['filters'](_['pick'](_0x390c31['query'],_0x1533d0[_0x622f('0x3d')]));if(_0x390c31[_0x622f('0x3c')][_0x622f('0x49')]){_0x14b438['where']=_[_0x622f('0x47')](_0x14b438[_0x622f('0x45')],{'$or':_['map'](_0x14b438['attributes'],function(_0x1684c7){var _0x2e905a={};_0x2e905a[_0x1684c7]={'$like':'%'+_0x390c31[_0x622f('0x3c')][_0x622f('0x49')]+'%'};return _0x2e905a;})});}_0x14b438=_[_0x622f('0x47')]({},_0x14b438,_0x390c31['options']);return _0x24db11[_0x622f('0x69')](_0x14b438);}})[_0x622f('0x2d')](function(_0x2554a3){if(_0x2554a3){_0x2b16eb=_0x2554a3[_0x622f('0x50')];if(!_0x390c31[_0x622f('0x3c')]['hasOwnProperty'](_0x622f('0x42'))){_0x14b438[_0x622f('0x23')]=qs[_0x622f('0x23')](_0x390c31['query'][_0x622f('0x23')]);_0x14b438[_0x622f('0x25')]=qs['offset'](_0x390c31[_0x622f('0x3c')][_0x622f('0x25')]);}return _0x24db11[_0x622f('0x69')](_0x14b438);}})['then'](function(_0x33bd6d){if(_0x33bd6d){return _0x33bd6d?{'count':_0x2b16eb,'rows':_0x33bd6d}:null;}})[_0x622f('0x2d')](respondWithResult(_0x18c8b8,null))[_0x622f('0x52')](handleError(_0x18c8b8,null));};exports[_0x622f('0x6b')]=function(_0x222534,_0x2f6c20,_0x14d239){var _0x24b1dc=_0x222534['body'][_0x622f('0x6c')];return db[_0x622f('0x6a')][_0x622f('0x4d')]({'where':{'id':_0x24b1dc},'attributes':['id'],'include':[{'model':db[_0x622f('0x61')],'as':'Agents','attributes':['id',_0x622f('0x33'),'online',_0x622f('0x6d'),_0x622f('0x6e')],'raw':!![]}]})['then'](function(_0x795b12){if(_0x795b12){var _0x5765b6=_[_0x622f('0x6f')](_0x795b12,function(_0x692f38){var _0x31b550=_0x692f38['get']({'plain':!![]});return _0x31b550[_0x622f('0x70')];});return db[_0x622f('0x36')][_0x622f('0x51')]({'where':{'id':_0x222534[_0x622f('0x4f')]['id']}})[_0x622f('0x2d')](function(_0x55f992){return db[_0x622f('0x71')][_0x622f('0x72')](function(_0x4989be){return _0x55f992['addTeams'](_0x24b1dc,{'transaction':_0x4989be})['then'](function(){return BPromise[_0x622f('0x73')](_0x5765b6,function(_0x23e405){return db[_0x622f('0x5f')]['findOrCreate']({'where':{'UserId':_0x23e405['id'],'MailQueueId':_0x222534['params']['id']},'transaction':_0x4989be});});})[_0x622f('0x2d')](function(){_0x5765b6[_0x622f('0x74')](function(_0x8442d9){socket[_0x622f('0x75')]('userMailQueue:save',{'UserId':_0x8442d9['id'],'MailQueueId':_0x55f992['id']});});});});});}})[_0x622f('0x2d')](respondWithStatusCode(_0x2f6c20,null))[_0x622f('0x52')](handleError(_0x2f6c20,null));};exports[_0x622f('0x76')]=function(_0x4a989b,_0x4131cd,_0x53e385){return db[_0x622f('0x6a')]['findAll']({'where':{'id':_0x4a989b['query'][_0x622f('0x6c')]},'attributes':['id'],'include':[{'model':db[_0x622f('0x61')],'as':_0x622f('0x70'),'attributes':['id'],'raw':!![]}]})[_0x622f('0x2d')](handleEntityNotFound(_0x4131cd,null))[_0x622f('0x2d')](function(_0x5b8b75){var _0x555a39=_[_0x622f('0x35')](_0x5b8b75,'id');var _0x4e2b8c=[];var _0x13dd8d=[];var _0x271607=squel['select']();_0x271607['field'](_0x622f('0x77'))[_0x622f('0x78')](_0x622f('0x79'),'tq')[_0x622f('0x7a')](_0x622f('0x7b'),'ut',_0x622f('0x7c'))[_0x622f('0x45')](_0x622f('0x7d'),_0x4a989b[_0x622f('0x4f')]['id']);for(var _0x53e016=0x0;_0x53e016<_0x5b8b75['length'];_0x53e016+=0x1){let _0x39a697=_0x5b8b75[_0x53e016];for(var _0x5d54a3=0x0;_0x5d54a3<_0x39a697[_0x622f('0x70')][_0x622f('0x50')];_0x5d54a3+=0x1){let _0x350c46=_0x39a697[_0x622f('0x70')][_0x5d54a3];var _0x1cd1e0=_0x271607[_0x622f('0x7e')]();_0x1cd1e0[_0x622f('0x45')](_0x622f('0x7f'),_0x350c46['id']);_0x13dd8d[_0x622f('0x80')](db['sequelize'][_0x622f('0x3c')](_0x1cd1e0[_0x622f('0x81')](),{'type':db['sequelize'][_0x622f('0x82')][_0x622f('0x83')]})[_0x622f('0x2d')](function(_0x212014){if(_0x212014[_0x622f('0x50')]===0x1){return _0x350c46['id'];}else{var _0x3ff37a=_['every'](_['map'](_0x212014,'TeamId'),function(_0x138086){return _[_0x622f('0x84')](_0x555a39,_0x138086);});if(_0x3ff37a){return _0x350c46['id'];}}}));}}return BPromise[_0x622f('0x85')](_0x13dd8d)['then'](function(_0xdb2eb9){_0x4e2b8c=_(_0x4e2b8c)['union'](_0xdb2eb9)[_0x622f('0x86')]()[_0x622f('0x87')]();return db['MailQueue']['find']({'where':{'id':_0x4a989b['params']['id']}})[_0x622f('0x2d')](function(_0x944423){return db['sequelize'][_0x622f('0x72')](function(_0x1f0149){return _0x944423[_0x622f('0x76')](_0x4a989b['query'][_0x622f('0x6c')],{'transaction':_0x1f0149})[_0x622f('0x2d')](function(){if(!_[_0x622f('0x88')](_0x4e2b8c)){return _0x944423[_0x622f('0x89')](_0x4e2b8c,{'transaction':_0x1f0149});}})[_0x622f('0x2d')](function(){_0x4e2b8c[_0x622f('0x74')](function(_0x34ee5e){socket[_0x622f('0x75')](_0x622f('0x8a'),{'UserId':_0x34ee5e,'MailQueueId':_0x944423['id']});});});});});});})['then'](respondWithStatusCode(_0x4131cd,null))[_0x622f('0x52')](handleError(_0x4131cd,null));};exports['addAgents']=function(_0xf534b,_0x43cae4,_0x58254c){return db[_0x622f('0x36')][_0x622f('0x51')]({'where':{'id':_0xf534b[_0x622f('0x4f')]['id']}})['then'](handleEntityNotFound(_0x43cae4,null))[_0x622f('0x2d')](function(_0x448432){if(_0x448432){return _0x448432[_0x622f('0x8b')](_0xf534b[_0x622f('0x54')][_0x622f('0x6c')],_['omit'](_0xf534b[_0x622f('0x54')],['ids','id'])||{})[_0x622f('0x8c')](function(_0x2ae03c){for(var _0x52a19d=0x0;_0x52a19d<_0xf534b[_0x622f('0x54')][_0x622f('0x6c')][_0x622f('0x50')];_0x52a19d+=0x1){socket[_0x622f('0x75')](_0x622f('0x8d'),{'UserId':Number(_0xf534b[_0x622f('0x54')][_0x622f('0x6c')][_0x52a19d]),'MailQueueId':Number(_0xf534b['params']['id'])});}return _0x2ae03c;});}})[_0x622f('0x2d')](respondWithResult(_0x43cae4,null))[_0x622f('0x52')](handleError(_0x43cae4,null));};exports[_0x622f('0x89')]=function(_0x4fd233,_0x55b813,_0x54abb6){return db[_0x622f('0x36')][_0x622f('0x51')]({'where':{'id':_0x4fd233[_0x622f('0x4f')]['id']}})[_0x622f('0x2d')](handleEntityNotFound(_0x55b813,null))['then'](function(_0x1fbae8){if(_0x1fbae8){return _0x1fbae8[_0x622f('0x89')](_0x4fd233[_0x622f('0x3c')][_0x622f('0x6c')])[_0x622f('0x2d')](function(){if(_[_0x622f('0x8e')](_0x4fd233[_0x622f('0x3c')][_0x622f('0x6c')])){for(var _0x135733=0x0;_0x135733<_0x4fd233['query'][_0x622f('0x6c')]['length'];_0x135733+=0x1){socket[_0x622f('0x75')]('userMailQueue:remove',{'UserId':Number(_0x4fd233[_0x622f('0x3c')]['ids'][_0x135733]),'MailQueueId':Number(_0x4fd233[_0x622f('0x4f')]['id'])});}}else{socket['emit'](_0x622f('0x8a'),{'UserId':Number(_0x4fd233['query']['ids']),'MailQueueId':Number(_0x4fd233[_0x622f('0x4f')]['id'])});}});}})[_0x622f('0x2d')](respondWithStatusCode(_0x55b813,null))['catch'](handleError(_0x55b813,null));};exports[_0x622f('0x8f')]=function(_0x503f4a,_0x54e42b,_0x5f3e23){var _0x41cf9c={};var _0x357474={};var _0xd244c0;var _0x2c6b7f;return db[_0x622f('0x36')][_0x622f('0x5e')]({'where':{'id':_0x503f4a['params']['id']}})[_0x622f('0x2d')](handleEntityNotFound(_0x54e42b,null))[_0x622f('0x2d')](function(_0xc8c2f){if(_0xc8c2f){_0xd244c0=_0xc8c2f;_0x357474[_0x622f('0x3a')]=_['keys'](db[_0x622f('0x61')]['rawAttributes']);_0x357474[_0x622f('0x3c')]=_[_0x622f('0x3b')](_0x503f4a[_0x622f('0x3c')]);_0x357474[_0x622f('0x3d')]=_[_0x622f('0x3e')](_0x357474[_0x622f('0x3a')],_0x357474[_0x622f('0x3c')]);_0x41cf9c['attributes']=_[_0x622f('0x3e')](_0x357474['model'],qs[_0x622f('0x40')](_0x503f4a['query'][_0x622f('0x40')]));_0x41cf9c[_0x622f('0x3f')]=_0x41cf9c[_0x622f('0x3f')][_0x622f('0x50')]?_0x41cf9c['attributes']:_0x357474['model'];_0x41cf9c[_0x622f('0x43')]=qs[_0x622f('0x44')](_0x503f4a[_0x622f('0x3c')][_0x622f('0x44')]);_0x41cf9c[_0x622f('0x45')]=qs[_0x622f('0x3d')](_[_0x622f('0x46')](_0x503f4a[_0x622f('0x3c')],_0x357474['filters']));if(_0x503f4a[_0x622f('0x3c')]['filter']){_0x41cf9c[_0x622f('0x45')]=_['merge'](_0x41cf9c[_0x622f('0x45')],{'$or':_[_0x622f('0x35')](_0x41cf9c[_0x622f('0x3f')],function(_0xc45239){var _0x487dd6={};_0x487dd6[_0xc45239]={'$like':'%'+_0x503f4a['query']['filter']+'%'};return _0x487dd6;})});}_0x41cf9c=_[_0x622f('0x47')]({},_0x41cf9c,_0x503f4a['options']);return _0xd244c0[_0x622f('0x8f')](_0x41cf9c);}})[_0x622f('0x2d')](function(_0x38fbe1){if(_0x38fbe1){_0x2c6b7f=_0x38fbe1[_0x622f('0x50')];if(!_0x503f4a[_0x622f('0x3c')][_0x622f('0x41')]('nolimit')){_0x41cf9c[_0x622f('0x23')]=qs[_0x622f('0x23')](_0x503f4a[_0x622f('0x3c')][_0x622f('0x23')]);_0x41cf9c[_0x622f('0x25')]=qs[_0x622f('0x25')](_0x503f4a['query'][_0x622f('0x25')]);}return _0xd244c0[_0x622f('0x8f')](_0x41cf9c);}})['then'](function(_0x460f5e){if(_0x460f5e){return _0x460f5e?{'count':_0x2c6b7f,'rows':_0x460f5e}:null;}})['then'](respondWithResult(_0x54e42b,null))['catch'](handleError(_0x54e42b,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index fcb7c7a..77811dc 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 _0xcd8f=['save','remove','emit','hook','../../mysqldb','MailQueue','setMaxListeners'];(function(_0x3c22e0,_0x1dc6ea){var _0x215811=function(_0x1b453c){while(--_0x1b453c){_0x3c22e0['push'](_0x3c22e0['shift']());}};_0x215811(++_0x1dc6ea);}(_0xcd8f,0x15b));var _0xfcd8=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xcd8f[_0x1d1779];return _0x2377e9;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0xfcd8('0x0'))['db'][_0xfcd8('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xfcd8('0x2')](0x0);var events={'afterCreate':_0xfcd8('0x3'),'afterUpdate':'update','afterDestroy':_0xfcd8('0x4')};function emitEvent(_0x30397f){return function(_0x5b5f66,_0x190115,_0x176b0a){MailQueueEvents[_0xfcd8('0x5')](_0x30397f+':'+_0x5b5f66['id'],_0x5b5f66);MailQueueEvents[_0xfcd8('0x5')](_0x30397f,_0x5b5f66);_0x176b0a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0xfcd8('0x6')](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file +var _0x7d56=['../../mysqldb','MailQueue','setMaxListeners','save','remove','emit','hasOwnProperty','hook','events'];(function(_0x294e64,_0x4b09aa){var _0x3f7381=function(_0x58eedb){while(--_0x58eedb){_0x294e64['push'](_0x294e64['shift']());}};_0x3f7381(++_0x4b09aa);}(_0x7d56,0xe9));var _0x67d5=function(_0x217c29,_0x3ce8df){_0x217c29=_0x217c29-0x0;var _0x3af670=_0x7d56[_0x217c29];return _0x3af670;};'use strict';var EventEmitter=require(_0x67d5('0x0'));var MailQueue=require(_0x67d5('0x1'))['db'][_0x67d5('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x67d5('0x3')](0x0);var events={'afterCreate':_0x67d5('0x4'),'afterUpdate':'update','afterDestroy':_0x67d5('0x5')};function emitEvent(_0x3201cc){return function(_0x36e59f,_0x1732fb,_0x2aadfa){MailQueueEvents['emit'](_0x3201cc+':'+_0x36e59f['id'],_0x36e59f);MailQueueEvents[_0x67d5('0x6')](_0x3201cc,_0x36e59f);_0x2aadfa(null);};}for(var e in events){if(events[_0x67d5('0x7')](e)){var event=events[e];MailQueue[_0x67d5('0x8')](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 6d059bc..c6d66fb 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 _0x4044=['rimraf','exports','define','mail_queues','lodash','util','../../config/logger','moment','request-promise','path'];(function(_0x4dc313,_0x2cf543){var _0x38f09=function(_0xf2283c){while(--_0xf2283c){_0x4dc313['push'](_0x4dc313['shift']());}};_0x38f09(++_0x2cf543);}(_0x4044,0xe0));var _0x4404=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x4044[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x4404('0x0'));var util=require(_0x4404('0x1'));var logger=require(_0x4404('0x2'))('api');var moment=require(_0x4404('0x3'));var BPromise=require('bluebird');var rp=require(_0x4404('0x4'));var fs=require('fs');var path=require(_0x4404('0x5'));var rimraf=require(_0x4404('0x6'));var config=require('../../config/environment');var attributes=require('./mailQueue.attributes');module[_0x4404('0x7')]=function(_0x47217f,_0x42fae1){return _0x47217f[_0x4404('0x8')]('MailQueue',attributes,{'tableName':_0x4404('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf5c6=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','MailQueue','mail_queues','lodash','util','../../config/logger','api'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xf5c6,0x1f4));var _0x6f5c=function(_0x449833,_0x112d98){_0x449833=_0x449833-0x0;var _0x250181=_0xf5c6[_0x449833];return _0x250181;};'use strict';var _=require(_0x6f5c('0x0'));var util=require(_0x6f5c('0x1'));var logger=require(_0x6f5c('0x2'))(_0x6f5c('0x3'));var moment=require(_0x6f5c('0x4'));var BPromise=require(_0x6f5c('0x5'));var rp=require(_0x6f5c('0x6'));var fs=require('fs');var path=require(_0x6f5c('0x7'));var rimraf=require(_0x6f5c('0x8'));var config=require(_0x6f5c('0x9'));var attributes=require('./mailQueue.attributes');module[_0x6f5c('0xa')]=function(_0x53c764,_0x39ae5a){return _0x53c764[_0x6f5c('0xb')](_0x6f5c('0xc'),attributes,{'tableName':_0x6f5c('0xd'),'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 d1e29a5..3a817c2 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 _0xe35f=['MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetMailQueue','MailQueue','findAll','options','raw','where','limit','model','include','map','attributes','info','catch','ShowMailQueue','find','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','./mailQueue.socket','register','then'];(function(_0x35485a,_0x91cdd4){var _0x5148e6=function(_0x27ed1d){while(--_0x27ed1d){_0x35485a['push'](_0x35485a['shift']());}};_0x5148e6(++_0x91cdd4);}(_0xe35f,0x1a7));var _0xfe35=function(_0x1cde9b,_0xa137c6){_0x1cde9b=_0x1cde9b-0x0;var _0xe2d687=_0xe35f[_0x1cde9b];return _0xe2d687;};'use strict';var _=require(_0xfe35('0x0'));var util=require('util');var moment=require(_0xfe35('0x1'));var BPromise=require(_0xfe35('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfe35('0x3'));var db=require(_0xfe35('0x4'))['db'];var utils=require(_0xfe35('0x5'));var logger=require(_0xfe35('0x6'))(_0xfe35('0x7'));var config=require('../../config/environment');var jayson=require(_0xfe35('0x8'));var client=jayson[_0xfe35('0x9')][_0xfe35('0xa')]({'port':0x232a});config['redis']=_[_0xfe35('0xb')](config[_0xfe35('0xc')],{'host':_0xfe35('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfe35('0xc')]));require(_0xfe35('0xe'))[_0xfe35('0xf')](socket);function respondWithRpcPromise(_0x6616b5,_0x4f2c8a,_0x1b865a){return new BPromise(function(_0x4569de,_0x47696){return client['request'](_0x6616b5,_0x1b865a)[_0xfe35('0x10')](function(_0x2b285f){logger['info'](_0xfe35('0x11'),_0x4f2c8a,_0xfe35('0x12'));logger[_0xfe35('0x13')](_0xfe35('0x14'),_0x4f2c8a,'request\x20sent',JSON[_0xfe35('0x15')](_0x2b285f));if(_0x2b285f[_0xfe35('0x16')]){if(_0x2b285f['error']['code']===0x1f4){logger['error'](_0xfe35('0x11'),_0x4f2c8a,_0x2b285f[_0xfe35('0x16')][_0xfe35('0x17')]);return _0x47696(_0x2b285f[_0xfe35('0x16')][_0xfe35('0x17')]);}logger[_0xfe35('0x16')](_0xfe35('0x11'),_0x4f2c8a,_0x2b285f[_0xfe35('0x16')]['message']);return _0x4569de(_0x2b285f[_0xfe35('0x16')][_0xfe35('0x17')]);}else{logger['info'](_0xfe35('0x11'),_0x4f2c8a,_0xfe35('0x12'));_0x4569de(_0x2b285f[_0xfe35('0x18')]['message']);}})['catch'](function(_0x4becd5){logger[_0xfe35('0x16')](_0xfe35('0x11'),_0x4f2c8a,_0x4becd5);_0x47696(_0x4becd5);});});}exports[_0xfe35('0x19')]=function(_0x3094a0){var _0x249a57=this;return new Promise(function(_0x4ffc8e,_0x5069ff){return db[_0xfe35('0x1a')][_0xfe35('0x1b')]({'raw':_0x3094a0[_0xfe35('0x1c')]?_0x3094a0['options'][_0xfe35('0x1d')]===undefined?!![]:![]:!![],'where':_0x3094a0[_0xfe35('0x1c')]?_0x3094a0[_0xfe35('0x1c')][_0xfe35('0x1e')]||null:null,'attributes':_0x3094a0[_0xfe35('0x1c')]?_0x3094a0[_0xfe35('0x1c')]['attributes']||null:null,'limit':_0x3094a0[_0xfe35('0x1c')]?_0x3094a0['options'][_0xfe35('0x1f')]||null:null,'include':_0x3094a0[_0xfe35('0x1c')]?_0x3094a0[_0xfe35('0x1c')]['include']?_['map'](_0x3094a0[_0xfe35('0x1c')]['include'],function(_0x432c45){return{'model':db[_0x432c45[_0xfe35('0x20')]],'as':_0x432c45['as'],'attributes':_0x432c45['attributes'],'include':_0x432c45[_0xfe35('0x21')]?_[_0xfe35('0x22')](_0x432c45[_0xfe35('0x21')],function(_0x8e23b1){return{'model':db[_0x8e23b1[_0xfe35('0x20')]],'as':_0x8e23b1['as'],'attributes':_0x8e23b1[_0xfe35('0x23')],'include':_0x8e23b1[_0xfe35('0x21')]?_[_0xfe35('0x22')](_0x8e23b1['include'],function(_0x2ffdb0){return{'model':db[_0x2ffdb0[_0xfe35('0x20')]],'as':_0x2ffdb0['as'],'attributes':_0x2ffdb0[_0xfe35('0x23')]};}):[]};}):[]};}):[]:[]})[_0xfe35('0x10')](function(_0x97a7b5){logger[_0xfe35('0x24')]('GetMailQueue',_0x3094a0);logger[_0xfe35('0x13')](_0xfe35('0x19'),_0x3094a0,JSON[_0xfe35('0x15')](_0x97a7b5));_0x4ffc8e(_0x97a7b5);})[_0xfe35('0x25')](function(_0x5f53ac){logger['error'](_0xfe35('0x19'),_0x5f53ac[_0xfe35('0x17')],_0x3094a0);_0x5069ff(_0x249a57[_0xfe35('0x16')](0x1f4,_0x5f53ac[_0xfe35('0x17')]));});});};exports[_0xfe35('0x26')]=function(_0x619482){var _0x2ea0df=this;return new Promise(function(_0x1d89b8,_0xb8772e){return db[_0xfe35('0x1a')][_0xfe35('0x27')]({'raw':_0x619482[_0xfe35('0x1c')]?_0x619482[_0xfe35('0x1c')][_0xfe35('0x1d')]===undefined?!![]:![]:!![],'where':_0x619482[_0xfe35('0x1c')]?_0x619482[_0xfe35('0x1c')][_0xfe35('0x1e')]||null:null,'attributes':_0x619482[_0xfe35('0x1c')]?_0x619482[_0xfe35('0x1c')][_0xfe35('0x23')]||null:null,'include':_0x619482[_0xfe35('0x1c')]?_0x619482[_0xfe35('0x1c')]['include']?_[_0xfe35('0x22')](_0x619482[_0xfe35('0x1c')][_0xfe35('0x21')],function(_0x379969){return{'model':db[_0x379969[_0xfe35('0x20')]],'as':_0x379969['as'],'attributes':_0x379969['attributes'],'include':_0x379969[_0xfe35('0x21')]?_[_0xfe35('0x22')](_0x379969[_0xfe35('0x21')],function(_0xce086a){return{'model':db[_0xce086a[_0xfe35('0x20')]],'as':_0xce086a['as'],'attributes':_0xce086a['attributes'],'include':_0xce086a[_0xfe35('0x21')]?_[_0xfe35('0x22')](_0xce086a[_0xfe35('0x21')],function(_0x1f9252){return{'model':db[_0x1f9252['model']],'as':_0x1f9252['as'],'attributes':_0x1f9252[_0xfe35('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1db753){logger[_0xfe35('0x24')]('ShowMailQueue',_0x619482);logger[_0xfe35('0x13')](_0xfe35('0x26'),_0x619482,JSON['stringify'](_0x1db753));_0x1d89b8(_0x1db753);})[_0xfe35('0x25')](function(_0x491316){logger[_0xfe35('0x16')](_0xfe35('0x26'),_0x491316['message'],_0x619482);_0xb8772e(_0x2ea0df[_0xfe35('0x16')](0x1f4,_0x491316['message']));});});}; \ No newline at end of file +var _0x96cc=['MailQueue','findAll','options','raw','where','attributes','limit','include','map','model','catch','ShowMailQueue','find','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','GetMailQueue'];(function(_0x5f0bd6,_0x223381){var _0x25465b=function(_0x201b3e){while(--_0x201b3e){_0x5f0bd6['push'](_0x5f0bd6['shift']());}};_0x25465b(++_0x223381);}(_0x96cc,0x16c));var _0xc96c=function(_0x29bb51,_0x1fb819){_0x29bb51=_0x29bb51-0x0;var _0x2dbdb3=_0x96cc[_0x29bb51];return _0x2dbdb3;};'use strict';var _=require(_0xc96c('0x0'));var util=require('util');var moment=require(_0xc96c('0x1'));var BPromise=require('bluebird');var rs=require(_0xc96c('0x2'));var fs=require('fs');var Redis=require(_0xc96c('0x3'));var db=require(_0xc96c('0x4'))['db'];var utils=require(_0xc96c('0x5'));var logger=require(_0xc96c('0x6'))(_0xc96c('0x7'));var config=require(_0xc96c('0x8'));var jayson=require(_0xc96c('0x9'));var client=jayson[_0xc96c('0xa')]['http']({'port':0x232a});config[_0xc96c('0xb')]=_[_0xc96c('0xc')](config[_0xc96c('0xb')],{'host':_0xc96c('0xd'),'port':0x18eb});var socket=require(_0xc96c('0xe'))(new Redis(config[_0xc96c('0xb')]));require(_0xc96c('0xf'))['register'](socket);function respondWithRpcPromise(_0x29ee7b,_0x29bd30,_0x19f599){return new BPromise(function(_0x5ceddc,_0x95ce8e){return client['request'](_0x29ee7b,_0x19f599)[_0xc96c('0x10')](function(_0x559477){logger[_0xc96c('0x11')](_0xc96c('0x12'),_0x29bd30,_0xc96c('0x13'));logger[_0xc96c('0x14')]('MailQueue,\x20%s,\x20%s,\x20%s',_0x29bd30,_0xc96c('0x13'),JSON[_0xc96c('0x15')](_0x559477));if(_0x559477[_0xc96c('0x16')]){if(_0x559477[_0xc96c('0x16')]['code']===0x1f4){logger[_0xc96c('0x16')](_0xc96c('0x12'),_0x29bd30,_0x559477[_0xc96c('0x16')][_0xc96c('0x17')]);return _0x95ce8e(_0x559477[_0xc96c('0x16')][_0xc96c('0x17')]);}logger[_0xc96c('0x16')](_0xc96c('0x12'),_0x29bd30,_0x559477[_0xc96c('0x16')][_0xc96c('0x17')]);return _0x5ceddc(_0x559477[_0xc96c('0x16')]['message']);}else{logger['info'](_0xc96c('0x12'),_0x29bd30,_0xc96c('0x13'));_0x5ceddc(_0x559477[_0xc96c('0x18')][_0xc96c('0x17')]);}})['catch'](function(_0x2c4c83){logger[_0xc96c('0x16')](_0xc96c('0x12'),_0x29bd30,_0x2c4c83);_0x95ce8e(_0x2c4c83);});});}exports[_0xc96c('0x19')]=function(_0x184128){var _0x335910=this;return new Promise(function(_0x43cc22,_0x41daba){return db[_0xc96c('0x1a')][_0xc96c('0x1b')]({'raw':_0x184128[_0xc96c('0x1c')]?_0x184128[_0xc96c('0x1c')][_0xc96c('0x1d')]===undefined?!![]:![]:!![],'where':_0x184128[_0xc96c('0x1c')]?_0x184128[_0xc96c('0x1c')][_0xc96c('0x1e')]||null:null,'attributes':_0x184128[_0xc96c('0x1c')]?_0x184128['options'][_0xc96c('0x1f')]||null:null,'limit':_0x184128[_0xc96c('0x1c')]?_0x184128[_0xc96c('0x1c')][_0xc96c('0x20')]||null:null,'include':_0x184128[_0xc96c('0x1c')]?_0x184128[_0xc96c('0x1c')][_0xc96c('0x21')]?_[_0xc96c('0x22')](_0x184128[_0xc96c('0x1c')][_0xc96c('0x21')],function(_0x50fc07){return{'model':db[_0x50fc07[_0xc96c('0x23')]],'as':_0x50fc07['as'],'attributes':_0x50fc07[_0xc96c('0x1f')],'include':_0x50fc07[_0xc96c('0x21')]?_[_0xc96c('0x22')](_0x50fc07['include'],function(_0x5c00b6){return{'model':db[_0x5c00b6[_0xc96c('0x23')]],'as':_0x5c00b6['as'],'attributes':_0x5c00b6[_0xc96c('0x1f')],'include':_0x5c00b6[_0xc96c('0x21')]?_[_0xc96c('0x22')](_0x5c00b6[_0xc96c('0x21')],function(_0x5e1727){return{'model':db[_0x5e1727[_0xc96c('0x23')]],'as':_0x5e1727['as'],'attributes':_0x5e1727[_0xc96c('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xc96c('0x10')](function(_0x27925f){logger[_0xc96c('0x11')](_0xc96c('0x19'),_0x184128);logger[_0xc96c('0x14')](_0xc96c('0x19'),_0x184128,JSON['stringify'](_0x27925f));_0x43cc22(_0x27925f);})[_0xc96c('0x24')](function(_0x53c994){logger[_0xc96c('0x16')](_0xc96c('0x19'),_0x53c994[_0xc96c('0x17')],_0x184128);_0x41daba(_0x335910['error'](0x1f4,_0x53c994[_0xc96c('0x17')]));});});};exports[_0xc96c('0x25')]=function(_0x446e5c){var _0x26c5b7=this;return new Promise(function(_0x4da9b5,_0x54a454){return db[_0xc96c('0x1a')][_0xc96c('0x26')]({'raw':_0x446e5c[_0xc96c('0x1c')]?_0x446e5c['options'][_0xc96c('0x1d')]===undefined?!![]:![]:!![],'where':_0x446e5c[_0xc96c('0x1c')]?_0x446e5c[_0xc96c('0x1c')][_0xc96c('0x1e')]||null:null,'attributes':_0x446e5c['options']?_0x446e5c[_0xc96c('0x1c')][_0xc96c('0x1f')]||null:null,'include':_0x446e5c['options']?_0x446e5c[_0xc96c('0x1c')][_0xc96c('0x21')]?_[_0xc96c('0x22')](_0x446e5c[_0xc96c('0x1c')][_0xc96c('0x21')],function(_0x43d0ee){return{'model':db[_0x43d0ee['model']],'as':_0x43d0ee['as'],'attributes':_0x43d0ee[_0xc96c('0x1f')],'include':_0x43d0ee[_0xc96c('0x21')]?_[_0xc96c('0x22')](_0x43d0ee[_0xc96c('0x21')],function(_0x107fa2){return{'model':db[_0x107fa2[_0xc96c('0x23')]],'as':_0x107fa2['as'],'attributes':_0x107fa2['attributes'],'include':_0x107fa2['include']?_[_0xc96c('0x22')](_0x107fa2[_0xc96c('0x21')],function(_0x5006ec){return{'model':db[_0x5006ec['model']],'as':_0x5006ec['as'],'attributes':_0x5006ec[_0xc96c('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xc96c('0x10')](function(_0x2eedc4){logger[_0xc96c('0x11')](_0xc96c('0x25'),_0x446e5c);logger[_0xc96c('0x14')](_0xc96c('0x25'),_0x446e5c,JSON[_0xc96c('0x15')](_0x2eedc4));_0x4da9b5(_0x2eedc4);})[_0xc96c('0x24')](function(_0x1359c8){logger[_0xc96c('0x16')]('ShowMailQueue',_0x1359c8[_0xc96c('0x17')],_0x446e5c);_0x54a454(_0x26c5b7[_0xc96c('0x16')](0x1f4,_0x1359c8[_0xc96c('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index df9bcf6..4d08340 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 _0x6aec=['./mailQueue.events','remove','update','register','mailQueue:'];(function(_0x3aabef,_0x19c811){var _0x27b8f4=function(_0x2d19f9){while(--_0x2d19f9){_0x3aabef['push'](_0x3aabef['shift']());}};_0x27b8f4(++_0x19c811);}(_0x6aec,0x10e));var _0xc6ae=function(_0x4bb298,_0x39bf91){_0x4bb298=_0x4bb298-0x0;var _0xbb5177=_0x6aec[_0x4bb298];return _0xbb5177;};'use strict';var MailQueueEvents=require(_0xc6ae('0x0'));var events=['save',_0xc6ae('0x1'),_0xc6ae('0x2')];function createListener(_0x1fc238,_0xa62104){return function(_0x4e8724){_0xa62104['emit'](_0x1fc238,_0x4e8724);};}function removeListener(_0x2816cc,_0x59b530){return function(){MailQueueEvents['removeListener'](_0x2816cc,_0x59b530);};}exports[_0xc6ae('0x3')]=function(_0x4269df){for(var _0x305b8d=0x0,_0x56daf4=events['length'];_0x305b8d<_0x56daf4;_0x305b8d++){var _0x448296=events[_0x305b8d];var _0x369fbe=createListener(_0xc6ae('0x4')+_0x448296,_0x4269df);MailQueueEvents['on'](_0x448296,_0x369fbe);}}; \ No newline at end of file +var _0x79b0=['save','remove','update','emit','removeListener','register','length','./mailQueue.events'];(function(_0x3ce315,_0xa1cf5b){var _0x323ab7=function(_0xac2da){while(--_0xac2da){_0x3ce315['push'](_0x3ce315['shift']());}};_0x323ab7(++_0xa1cf5b);}(_0x79b0,0x9f));var _0x079b=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x79b0[_0x2dafbe];return _0x58a45a;};'use strict';var MailQueueEvents=require(_0x079b('0x0'));var events=[_0x079b('0x1'),_0x079b('0x2'),_0x079b('0x3')];function createListener(_0x4f66cc,_0x434f5e){return function(_0x4902e1){_0x434f5e[_0x079b('0x4')](_0x4f66cc,_0x4902e1);};}function removeListener(_0x5786bb,_0x347d2c){return function(){MailQueueEvents[_0x079b('0x5')](_0x5786bb,_0x347d2c);};}exports[_0x079b('0x6')]=function(_0x1d0e54){for(var _0x355332=0x0,_0x2fc98e=events[_0x079b('0x7')];_0x355332<_0x2fc98e;_0x355332++){var _0x3be1c0=events[_0x355332];var _0x22f900=createListener('mailQueue:'+_0x3be1c0,_0x1d0e54);MailQueueEvents['on'](_0x3be1c0,_0x22f900);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 64e7c66..87b7a30 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 _0xdaba=['index','/describe','describe','show','post','create','put','/:id','update','delete','destroy','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailQueueReport.controller','get','isAuthenticated'];(function(_0x35fabd,_0x825452){var _0x61a8ee=function(_0x218f4c){while(--_0x218f4c){_0x35fabd['push'](_0x35fabd['shift']());}};_0x61a8ee(++_0x825452);}(_0xdaba,0x1d9));var _0xadab=function(_0x2892fc,_0x3ec503){_0x2892fc=_0x2892fc-0x0;var _0x4e83a6=_0xdaba[_0x2892fc];return _0x4e83a6;};'use strict';var multer=require('multer');var util=require(_0xadab('0x0'));var path=require(_0xadab('0x1'));var timeout=require('connect-timeout');var express=require(_0xadab('0x2'));var router=express[_0xadab('0x3')]();var fs_extra=require(_0xadab('0x4'));var auth=require(_0xadab('0x5'));var interaction=require(_0xadab('0x6'));var config=require('../../config/environment');var controller=require(_0xadab('0x7'));router[_0xadab('0x8')]('/',auth[_0xadab('0x9')](),controller[_0xadab('0xa')]);router[_0xadab('0x8')](_0xadab('0xb'),auth['isAuthenticated'](),controller[_0xadab('0xc')]);router['get']('/:id',auth[_0xadab('0x9')](),controller[_0xadab('0xd')]);router[_0xadab('0xe')]('/',auth[_0xadab('0x9')](),controller[_0xadab('0xf')]);router[_0xadab('0x10')](_0xadab('0x11'),auth[_0xadab('0x9')](),controller[_0xadab('0x12')]);router[_0xadab('0x13')]('/:id',auth['isAuthenticated'](),controller[_0xadab('0x14')]);module['exports']=router; \ No newline at end of file +var _0x7236=['../../components/interaction/service','./mailQueueReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put','update','delete','/:id','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x197af0,_0x4dd631){var _0x276a3d=function(_0x2eec31){while(--_0x2eec31){_0x197af0['push'](_0x197af0['shift']());}};_0x276a3d(++_0x4dd631);}(_0x7236,0x189));var _0x6723=function(_0x2f03b6,_0x2cd436){_0x2f03b6=_0x2f03b6-0x0;var _0x3c8a2d=_0x7236[_0x2f03b6];return _0x3c8a2d;};'use strict';var multer=require('multer');var util=require(_0x6723('0x0'));var path=require(_0x6723('0x1'));var timeout=require(_0x6723('0x2'));var express=require('express');var router=express[_0x6723('0x3')]();var fs_extra=require(_0x6723('0x4'));var auth=require(_0x6723('0x5'));var interaction=require(_0x6723('0x6'));var config=require('../../config/environment');var controller=require(_0x6723('0x7'));router[_0x6723('0x8')]('/',auth[_0x6723('0x9')](),controller[_0x6723('0xa')]);router['get'](_0x6723('0xb'),auth[_0x6723('0x9')](),controller[_0x6723('0xc')]);router[_0x6723('0x8')]('/:id',auth[_0x6723('0x9')](),controller[_0x6723('0xd')]);router[_0x6723('0xe')]('/',auth[_0x6723('0x9')](),controller[_0x6723('0xf')]);router[_0x6723('0x10')]('/:id',auth[_0x6723('0x9')](),controller[_0x6723('0x11')]);router[_0x6723('0x12')](_0x6723('0x13'),auth[_0x6723('0x9')](),controller['destroy']);module[_0x6723('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index dd71281..bd0f7b0 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 _0x3c22=['moment','sequelize','STRING','DATE'];(function(_0x31cdf3,_0x4f2183){var _0x5623f8=function(_0x4377bc){while(--_0x4377bc){_0x31cdf3['push'](_0x31cdf3['shift']());}};_0x5623f8(++_0x4f2183);}(_0x3c22,0x184));var _0x23c2=function(_0x3776db,_0x436083){_0x3776db=_0x3776db-0x0;var _0x1ce854=_0x3c22[_0x3776db];return _0x1ce854;};'use strict';var moment=require(_0x23c2('0x0'));var Sequelize=require(_0x23c2('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x23c2('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x23c2('0x2')]},'joinAt':{'type':Sequelize[_0x23c2('0x3')]},'leaveAt':{'type':Sequelize[_0x23c2('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x23c2('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xaa48=['DATE','moment','sequelize','exports','STRING'];(function(_0x5f0bd8,_0x5bb5c3){var _0x11538d=function(_0x502607){while(--_0x502607){_0x5f0bd8['push'](_0x5f0bd8['shift']());}};_0x11538d(++_0x5bb5c3);}(_0xaa48,0x15a));var _0x8aa4=function(_0x30f3fc,_0x1ff08a){_0x30f3fc=_0x30f3fc-0x0;var _0x3c8ad4=_0xaa48[_0x30f3fc];return _0x3c8ad4;};'use strict';var moment=require(_0x8aa4('0x0'));var Sequelize=require(_0x8aa4('0x1'));module[_0x8aa4('0x2')]={'uniqueid':{'type':Sequelize[_0x8aa4('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x8aa4('0x3')]},'joinAt':{'type':Sequelize[_0x8aa4('0x4')]},'leaveAt':{'type':Sequelize[_0x8aa4('0x4')]},'acceptAt':{'type':Sequelize[_0x8aa4('0x4')]},'exitAt':{'type':Sequelize[_0x8aa4('0x4')]},'reason':{'type':Sequelize[_0x8aa4('0x3')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 98b27c0..80142db 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 _0x5b12=['options','includeAll','include','findAll','then','show','params','rawAttributes','catch','create','body','find','describe','eml-format','rimraf','zip-dir','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','error','name','index','map','MailQueueReport','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL'];(function(_0x1bf004,_0x484305){var _0x2ab10d=function(_0x4093a8){while(--_0x4093a8){_0x1bf004['push'](_0x1bf004['shift']());}};_0x2ab10d(++_0x484305);}(_0x5b12,0xa3));var _0x25b1=function(_0x4d3045,_0x1523bb){_0x4d3045=_0x4d3045-0x0;var _0x135d2a=_0x5b12[_0x4d3045];return _0x135d2a;};'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(){_0x26b555[_0x25b1('0x1a')](0xcc)[_0x25b1('0x1b')]();});}};}function handleEntityNotFound(_0xd22469,_0x282187){return function(_0x1f37ed){if(!_0x1f37ed){_0xd22469[_0x25b1('0x19')](0x194);}return _0x1f37ed;};}function handleError(_0x5d9ed7,_0x3c05c6){_0x3c05c6=_0x3c05c6||0x1f4;return function(_0x27dd68){logger[_0x25b1('0x24')](_0x27dd68['stack']);if(_0x27dd68[_0x25b1('0x25')]){delete _0x27dd68[_0x25b1('0x25')];}_0x5d9ed7[_0x25b1('0x1a')](_0x3c05c6)['send'](_0x27dd68);};}exports[_0x25b1('0x26')]=function(_0x54ce2d,_0x19ecd1){var _0x3febb8={},_0x3a4475={},_0x293413={'count':0x0,'rows':[]};var _0x362118=_[_0x25b1('0x27')](db[_0x25b1('0x28')]['rawAttributes'],function(_0x30d455){return{'name':_0x30d455[_0x25b1('0x29')],'type':_0x30d455[_0x25b1('0x2a')][_0x25b1('0x2b')]};});_0x3a4475[_0x25b1('0x2c')]=_['map'](_0x362118,_0x25b1('0x25'));_0x3a4475[_0x25b1('0x2d')]=_[_0x25b1('0x2e')](_0x54ce2d[_0x25b1('0x2d')]);_0x3a4475[_0x25b1('0x2f')]=_['intersection'](_0x3a4475['model'],_0x3a4475[_0x25b1('0x2d')]);_0x3febb8['attributes']=_[_0x25b1('0x30')](_0x3a4475[_0x25b1('0x2c')],qs[_0x25b1('0x31')](_0x54ce2d['query']['fields']));_0x3febb8[_0x25b1('0x32')]=_0x3febb8[_0x25b1('0x32')][_0x25b1('0x33')]?_0x3febb8['attributes']:_0x3a4475[_0x25b1('0x2c')];if(!_0x54ce2d[_0x25b1('0x2d')][_0x25b1('0x34')](_0x25b1('0x35'))){_0x3febb8['limit']=qs[_0x25b1('0x36')](_0x54ce2d[_0x25b1('0x2d')][_0x25b1('0x36')]);_0x3febb8['offset']=qs['offset'](_0x54ce2d[_0x25b1('0x2d')]['offset']);}_0x3febb8[_0x25b1('0x37')]=qs[_0x25b1('0x38')](_0x54ce2d[_0x25b1('0x2d')][_0x25b1('0x38')]);_0x3febb8[_0x25b1('0x39')]=qs[_0x25b1('0x2f')](_[_0x25b1('0x3a')](_0x54ce2d[_0x25b1('0x2d')],_0x3a4475[_0x25b1('0x2f')]),_0x362118);if(_0x54ce2d[_0x25b1('0x2d')][_0x25b1('0x3b')]){_0x3febb8[_0x25b1('0x39')]=_[_0x25b1('0x3c')](_0x3febb8[_0x25b1('0x39')],{'$or':_[_0x25b1('0x27')](_0x362118,function(_0x4837d5){if(_0x4837d5[_0x25b1('0x2a')]!==_0x25b1('0x3d')){var _0x53423d={};_0x53423d[_0x4837d5[_0x25b1('0x25')]]={'$like':'%'+_0x54ce2d[_0x25b1('0x2d')][_0x25b1('0x3b')]+'%'};return _0x53423d;}})});}_0x3febb8=_[_0x25b1('0x3c')]({},_0x3febb8,_0x54ce2d[_0x25b1('0x3e')]);var _0x5bdefd={'where':_0x3febb8[_0x25b1('0x39')]};return db['MailQueueReport'][_0x25b1('0x1d')](_0x5bdefd)['then'](function(_0x2e8747){_0x293413[_0x25b1('0x1d')]=_0x2e8747;if(_0x54ce2d[_0x25b1('0x2d')][_0x25b1('0x3f')]){_0x3febb8[_0x25b1('0x40')]=[{'all':!![]}];}return db[_0x25b1('0x28')][_0x25b1('0x41')](_0x3febb8);})[_0x25b1('0x42')](function(_0x3f9754){_0x293413['rows']=_0x3f9754;return _0x293413;})[_0x25b1('0x42')](respondWithFilteredResult(_0x19ecd1,_0x3febb8))['catch'](handleError(_0x19ecd1,null));};exports[_0x25b1('0x43')]=function(_0x2f56ac,_0x4d4e32){var _0x52d3f8={'raw':!![],'where':{'id':_0x2f56ac[_0x25b1('0x44')]['id']}},_0x39b4c7={};_0x39b4c7[_0x25b1('0x2c')]=_[_0x25b1('0x2e')](db[_0x25b1('0x28')][_0x25b1('0x45')]);_0x39b4c7[_0x25b1('0x2d')]=_[_0x25b1('0x2e')](_0x2f56ac[_0x25b1('0x2d')]);_0x39b4c7[_0x25b1('0x2f')]=_[_0x25b1('0x30')](_0x39b4c7[_0x25b1('0x2c')],_0x39b4c7[_0x25b1('0x2d')]);_0x52d3f8[_0x25b1('0x32')]=_[_0x25b1('0x30')](_0x39b4c7[_0x25b1('0x2c')],qs[_0x25b1('0x31')](_0x2f56ac['query']['fields']));_0x52d3f8['attributes']=_0x52d3f8[_0x25b1('0x32')]['length']?_0x52d3f8[_0x25b1('0x32')]:_0x39b4c7['model'];if(_0x2f56ac[_0x25b1('0x2d')][_0x25b1('0x3f')]){_0x52d3f8[_0x25b1('0x40')]=[{'all':!![]}];}_0x52d3f8=_[_0x25b1('0x3c')]({},_0x52d3f8,_0x2f56ac[_0x25b1('0x3e')]);return db[_0x25b1('0x28')]['find'](_0x52d3f8)[_0x25b1('0x42')](handleEntityNotFound(_0x4d4e32,null))[_0x25b1('0x42')](respondWithResult(_0x4d4e32,null))[_0x25b1('0x46')](handleError(_0x4d4e32,null));};exports[_0x25b1('0x47')]=function(_0x58ae67,_0x489f73){return db[_0x25b1('0x28')][_0x25b1('0x47')](_0x58ae67['body'],{})[_0x25b1('0x42')](respondWithResult(_0x489f73,0xc9))['catch'](handleError(_0x489f73,null));};exports[_0x25b1('0x22')]=function(_0x4b6181,_0x543f9b){if(_0x4b6181[_0x25b1('0x48')]['id']){delete _0x4b6181[_0x25b1('0x48')]['id'];}return db[_0x25b1('0x28')][_0x25b1('0x49')]({'where':{'id':_0x4b6181['params']['id']}})[_0x25b1('0x42')](handleEntityNotFound(_0x543f9b,null))['then'](saveUpdates(_0x4b6181[_0x25b1('0x48')],null))['then'](respondWithResult(_0x543f9b,null))[_0x25b1('0x46')](handleError(_0x543f9b,null));};exports[_0x25b1('0x23')]=function(_0x1fcc79,_0x4fb92e){return db[_0x25b1('0x28')][_0x25b1('0x49')]({'where':{'id':_0x1fcc79[_0x25b1('0x44')]['id']}})[_0x25b1('0x42')](handleEntityNotFound(_0x4fb92e,null))[_0x25b1('0x42')](removeEntity(_0x4fb92e,null))[_0x25b1('0x46')](handleError(_0x4fb92e,null));};exports['describe']=function(_0x134c64,_0x133f50){return db[_0x25b1('0x28')][_0x25b1('0x4a')]()[_0x25b1('0x42')](respondWithResult(_0x133f50,null))[_0x25b1('0x46')](handleError(_0x133f50,null));}; \ No newline at end of file +var _0x2a07=['index','map','MailQueueReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','include','catch','show','params','fields','includeAll','create','body','find','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','Content-Range','apply','reject','save','update','then','error','name','send'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2a07,0x74));var _0x72a0=function(_0x1f6e37,_0x560390){_0x1f6e37=_0x1f6e37-0x0;var _0x3d17ad=_0x2a07[_0x1f6e37];return _0x3d17ad;};'use strict';var emlformat=require(_0x72a0('0x0'));var rimraf=require(_0x72a0('0x1'));var zipdir=require(_0x72a0('0x2'));var jsonpatch=require(_0x72a0('0x3'));var rp=require(_0x72a0('0x4'));var moment=require('moment');var BPromise=require(_0x72a0('0x5'));var Mustache=require(_0x72a0('0x6'));var util=require(_0x72a0('0x7'));var path=require(_0x72a0('0x8'));var sox=require(_0x72a0('0x9'));var csv=require(_0x72a0('0xa'));var ejs=require(_0x72a0('0xb'));var fs=require('fs');var fs_extra=require(_0x72a0('0xc'));var _=require(_0x72a0('0xd'));var squel=require(_0x72a0('0xe'));var crypto=require(_0x72a0('0xf'));var jsforce=require(_0x72a0('0x10'));var deskjs=require(_0x72a0('0x11'));var toCsv=require(_0x72a0('0xa'));var querystring=require(_0x72a0('0x12'));var Papa=require(_0x72a0('0x13'));var Redis=require('ioredis');var authService=require(_0x72a0('0x14'));var qs=require(_0x72a0('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x72a0('0x16'));var logger=require(_0x72a0('0x17'))(_0x72a0('0x18'));var utils=require(_0x72a0('0x19'));var config=require(_0x72a0('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x72a0('0x1b'))['db'];function respondWithStatusCode(_0x335b9f,_0x123ca4){_0x123ca4=_0x123ca4||0xcc;return function(_0xf91a82){if(_0xf91a82){return _0x335b9f[_0x72a0('0x1c')](_0x123ca4);}return _0x335b9f[_0x72a0('0x1d')](_0x123ca4)[_0x72a0('0x1e')]();};}function respondWithResult(_0x5e0b5f,_0x4930c5){_0x4930c5=_0x4930c5||0xc8;return function(_0xe103dc){if(_0xe103dc){return _0x5e0b5f[_0x72a0('0x1d')](_0x4930c5)[_0x72a0('0x1f')](_0xe103dc);}};}function respondWithFilteredResult(_0x1d1133,_0x23b001){return function(_0x3f3d62){if(_0x3f3d62){var _0x4ab55e=typeof _0x23b001[_0x72a0('0x20')]===_0x72a0('0x21')&&typeof _0x23b001[_0x72a0('0x22')]===_0x72a0('0x21');var _0x2d1e95=_0x3f3d62['count'];var _0x100d8f=_0x4ab55e?0x0:_0x23b001[_0x72a0('0x20')];var _0x131b73=_0x4ab55e?_0x3f3d62['count']:_0x23b001[_0x72a0('0x20')]+_0x23b001[_0x72a0('0x22')];var _0x30899b;if(_0x131b73>=_0x2d1e95){_0x131b73=_0x2d1e95;_0x30899b=0xc8;}else{_0x30899b=0xce;}_0x1d1133[_0x72a0('0x1d')](_0x30899b);return _0x1d1133['set'](_0x72a0('0x23'),_0x100d8f+'-'+_0x131b73+'/'+_0x2d1e95)['json'](_0x3f3d62);}return null;};}function patchUpdates(_0x3d0607){return function(_0x315413){try{jsonpatch[_0x72a0('0x24')](_0x315413,_0x3d0607,!![]);}catch(_0x5c7479){return BPromise[_0x72a0('0x25')](_0x5c7479);}return _0x315413[_0x72a0('0x26')]();};}function saveUpdates(_0x1d22d8,_0x3d1965){return function(_0x5d6145){if(_0x5d6145){return _0x5d6145[_0x72a0('0x27')](_0x1d22d8)[_0x72a0('0x28')](function(_0x1ddd54){return _0x1ddd54;});}return null;};}function removeEntity(_0x23b918,_0x3022b0){return function(_0x174b1b){if(_0x174b1b){return _0x174b1b['destroy']()['then'](function(){_0x23b918[_0x72a0('0x1d')](0xcc)[_0x72a0('0x1e')]();});}};}function handleEntityNotFound(_0x123df4,_0x1504ed){return function(_0xf5cb49){if(!_0xf5cb49){_0x123df4[_0x72a0('0x1c')](0x194);}return _0xf5cb49;};}function handleError(_0xa5bda0,_0x15922a){_0x15922a=_0x15922a||0x1f4;return function(_0xee99e2){logger[_0x72a0('0x29')](_0xee99e2['stack']);if(_0xee99e2[_0x72a0('0x2a')]){delete _0xee99e2[_0x72a0('0x2a')];}_0xa5bda0[_0x72a0('0x1d')](_0x15922a)[_0x72a0('0x2b')](_0xee99e2);};}exports[_0x72a0('0x2c')]=function(_0x177a3a,_0x432179){var _0x12eda2={},_0x23c96a={},_0x916733={'count':0x0,'rows':[]};var _0x4ba037=_[_0x72a0('0x2d')](db[_0x72a0('0x2e')][_0x72a0('0x2f')],function(_0xfbe9b3){return{'name':_0xfbe9b3[_0x72a0('0x30')],'type':_0xfbe9b3[_0x72a0('0x31')][_0x72a0('0x32')]};});_0x23c96a['model']=_[_0x72a0('0x2d')](_0x4ba037,_0x72a0('0x2a'));_0x23c96a[_0x72a0('0x33')]=_[_0x72a0('0x34')](_0x177a3a[_0x72a0('0x33')]);_0x23c96a[_0x72a0('0x35')]=_[_0x72a0('0x36')](_0x23c96a[_0x72a0('0x37')],_0x23c96a['query']);_0x12eda2[_0x72a0('0x38')]=_[_0x72a0('0x36')](_0x23c96a[_0x72a0('0x37')],qs['fields'](_0x177a3a[_0x72a0('0x33')]['fields']));_0x12eda2[_0x72a0('0x38')]=_0x12eda2[_0x72a0('0x38')][_0x72a0('0x39')]?_0x12eda2[_0x72a0('0x38')]:_0x23c96a[_0x72a0('0x37')];if(!_0x177a3a[_0x72a0('0x33')][_0x72a0('0x3a')](_0x72a0('0x3b'))){_0x12eda2[_0x72a0('0x22')]=qs[_0x72a0('0x22')](_0x177a3a[_0x72a0('0x33')][_0x72a0('0x22')]);_0x12eda2['offset']=qs[_0x72a0('0x20')](_0x177a3a['query'][_0x72a0('0x20')]);}_0x12eda2[_0x72a0('0x3c')]=qs[_0x72a0('0x3d')](_0x177a3a[_0x72a0('0x33')][_0x72a0('0x3d')]);_0x12eda2[_0x72a0('0x3e')]=qs[_0x72a0('0x35')](_[_0x72a0('0x3f')](_0x177a3a[_0x72a0('0x33')],_0x23c96a['filters']),_0x4ba037);if(_0x177a3a['query'][_0x72a0('0x40')]){_0x12eda2[_0x72a0('0x3e')]=_[_0x72a0('0x41')](_0x12eda2[_0x72a0('0x3e')],{'$or':_[_0x72a0('0x2d')](_0x4ba037,function(_0x512a06){if(_0x512a06[_0x72a0('0x31')]!==_0x72a0('0x42')){var _0x582c90={};_0x582c90[_0x512a06[_0x72a0('0x2a')]]={'$like':'%'+_0x177a3a['query']['filter']+'%'};return _0x582c90;}})});}_0x12eda2=_['merge']({},_0x12eda2,_0x177a3a[_0x72a0('0x43')]);var _0x49633b={'where':_0x12eda2[_0x72a0('0x3e')]};return db[_0x72a0('0x2e')][_0x72a0('0x44')](_0x49633b)[_0x72a0('0x28')](function(_0x4bf56e){_0x916733['count']=_0x4bf56e;if(_0x177a3a['query']['includeAll']){_0x12eda2[_0x72a0('0x45')]=[{'all':!![]}];}return db[_0x72a0('0x2e')]['findAll'](_0x12eda2);})[_0x72a0('0x28')](function(_0x35d790){_0x916733['rows']=_0x35d790;return _0x916733;})[_0x72a0('0x28')](respondWithFilteredResult(_0x432179,_0x12eda2))[_0x72a0('0x46')](handleError(_0x432179,null));};exports[_0x72a0('0x47')]=function(_0xe4abe1,_0x340153){var _0x341451={'raw':!![],'where':{'id':_0xe4abe1[_0x72a0('0x48')]['id']}},_0x50eb7f={};_0x50eb7f['model']=_[_0x72a0('0x34')](db['MailQueueReport'][_0x72a0('0x2f')]);_0x50eb7f[_0x72a0('0x33')]=_['keys'](_0xe4abe1[_0x72a0('0x33')]);_0x50eb7f['filters']=_[_0x72a0('0x36')](_0x50eb7f[_0x72a0('0x37')],_0x50eb7f[_0x72a0('0x33')]);_0x341451['attributes']=_[_0x72a0('0x36')](_0x50eb7f[_0x72a0('0x37')],qs[_0x72a0('0x49')](_0xe4abe1['query']['fields']));_0x341451[_0x72a0('0x38')]=_0x341451['attributes'][_0x72a0('0x39')]?_0x341451[_0x72a0('0x38')]:_0x50eb7f[_0x72a0('0x37')];if(_0xe4abe1[_0x72a0('0x33')][_0x72a0('0x4a')]){_0x341451[_0x72a0('0x45')]=[{'all':!![]}];}_0x341451=_[_0x72a0('0x41')]({},_0x341451,_0xe4abe1[_0x72a0('0x43')]);return db[_0x72a0('0x2e')]['find'](_0x341451)[_0x72a0('0x28')](handleEntityNotFound(_0x340153,null))[_0x72a0('0x28')](respondWithResult(_0x340153,null))[_0x72a0('0x46')](handleError(_0x340153,null));};exports[_0x72a0('0x4b')]=function(_0x3a669d,_0x304400){return db[_0x72a0('0x2e')]['create'](_0x3a669d['body'],{})[_0x72a0('0x28')](respondWithResult(_0x304400,0xc9))[_0x72a0('0x46')](handleError(_0x304400,null));};exports[_0x72a0('0x27')]=function(_0x3cab6a,_0x35a6ad){if(_0x3cab6a[_0x72a0('0x4c')]['id']){delete _0x3cab6a[_0x72a0('0x4c')]['id'];}return db[_0x72a0('0x2e')][_0x72a0('0x4d')]({'where':{'id':_0x3cab6a[_0x72a0('0x48')]['id']}})['then'](handleEntityNotFound(_0x35a6ad,null))[_0x72a0('0x28')](saveUpdates(_0x3cab6a[_0x72a0('0x4c')],null))[_0x72a0('0x28')](respondWithResult(_0x35a6ad,null))[_0x72a0('0x46')](handleError(_0x35a6ad,null));};exports[_0x72a0('0x4e')]=function(_0x5c1570,_0x143410){return db['MailQueueReport']['find']({'where':{'id':_0x5c1570[_0x72a0('0x48')]['id']}})[_0x72a0('0x28')](handleEntityNotFound(_0x143410,null))[_0x72a0('0x28')](removeEntity(_0x143410,null))[_0x72a0('0x46')](handleError(_0x143410,null));};exports[_0x72a0('0x4f')]=function(_0x50c8d7,_0xc0f323){return db[_0x72a0('0x2e')]['describe']()['then'](respondWithResult(_0xc0f323,null))[_0x72a0('0x46')](handleError(_0xc0f323,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 3d28fed..8f340d3 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 _0x0a41=['rimraf','./mailQueueReport.attributes','define','report_mail_queue','uniqueid','util','moment','bluebird','path'];(function(_0x2e4dce,_0x43ad28){var _0x5966fa=function(_0x1d17ba){while(--_0x1d17ba){_0x2e4dce['push'](_0x2e4dce['shift']());}};_0x5966fa(++_0x43ad28);}(_0x0a41,0xe6));var _0x10a4=function(_0xeef94c,_0x1db3f7){_0xeef94c=_0xeef94c-0x0;var _0x447522=_0x0a41[_0xeef94c];return _0x447522;};'use strict';var _=require('lodash');var util=require(_0x10a4('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x10a4('0x1'));var BPromise=require(_0x10a4('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x10a4('0x3'));var rimraf=require(_0x10a4('0x4'));var config=require('../../config/environment');var attributes=require(_0x10a4('0x5'));module['exports']=function(_0x574b49,_0x115220){return _0x574b49[_0x10a4('0x6')]('MailQueueReport',attributes,{'tableName':_0x10a4('0x7'),'paranoid':![],'indexes':[{'name':_0x10a4('0x8'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x8d17=['../../config/logger','api','path','../../config/environment','./mailQueueReport.attributes','define','MailQueueReport','report_mail_queue','uniqueid','lodash'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x8d17,0x10d));var _0x78d1=function(_0x9ac546,_0xbbbdf6){_0x9ac546=_0x9ac546-0x0;var _0x43a810=_0x8d17[_0x9ac546];return _0x43a810;};'use strict';var _=require(_0x78d1('0x0'));var util=require('util');var logger=require(_0x78d1('0x1'))(_0x78d1('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x78d1('0x3'));var rimraf=require('rimraf');var config=require(_0x78d1('0x4'));var attributes=require(_0x78d1('0x5'));module['exports']=function(_0x255938,_0x1864c1){return _0x255938[_0x78d1('0x6')](_0x78d1('0x7'),attributes,{'tableName':_0x78d1('0x8'),'paranoid':![],'indexes':[{'name':_0x78d1('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 1f31c45..4c8a45f 100644 --- a/server/api/mailQueueReport/mailQueueReport.rpc.js +++ b/server/api/mailQueueReport/mailQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x326f=['error','code','message','result','catch','CreateMailQueueReport','MailQueueReport','options','raw','stringify','UpdateMailQueueReport','body','attributes','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1373c4,_0xbf80ac){var _0x330cd4=function(_0x24bb2d){while(--_0x24bb2d){_0x1373c4['push'](_0x1373c4['shift']());}};_0x330cd4(++_0xbf80ac);}(_0x326f,0xd1));var _0xf326=function(_0xe0b145,_0x234d44){_0xe0b145=_0xe0b145-0x0;var _0xeced22=_0x326f[_0xe0b145];return _0xeced22;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf326('0x1'));var rs=require(_0xf326('0x2'));var fs=require('fs');var Redis=require(_0xf326('0x3'));var db=require(_0xf326('0x4'))['db'];var utils=require(_0xf326('0x5'));var logger=require(_0xf326('0x6'))(_0xf326('0x7'));var config=require(_0xf326('0x8'));var jayson=require(_0xf326('0x9'));var client=jayson[_0xf326('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c254d,_0x3851eb,_0x165f95){return new BPromise(function(_0x1e7b8a,_0x515bfa){return client['request'](_0x3c254d,_0x165f95)['then'](function(_0x3bacf2){logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));logger[_0xf326('0xe')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x3851eb,_0xf326('0xd'),JSON['stringify'](_0x3bacf2));if(_0x3bacf2[_0xf326('0xf')]){if(_0x3bacf2['error'][_0xf326('0x10')]===0x1f4){logger['error'](_0xf326('0xc'),_0x3851eb,_0x3bacf2[_0xf326('0xf')]['message']);return _0x515bfa(_0x3bacf2[_0xf326('0xf')][_0xf326('0x11')]);}logger[_0xf326('0xf')](_0xf326('0xc'),_0x3851eb,_0x3bacf2['error'][_0xf326('0x11')]);return _0x1e7b8a(_0x3bacf2['error']['message']);}else{logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));_0x1e7b8a(_0x3bacf2[_0xf326('0x12')][_0xf326('0x11')]);}})[_0xf326('0x13')](function(_0x34128e){logger[_0xf326('0xf')]('MailQueueReport,\x20%s,\x20%s',_0x3851eb,_0x34128e);_0x515bfa(_0x34128e);});});}exports[_0xf326('0x14')]=function(_0x453100){var _0x18bee3=this;return new Promise(function(_0x31ffb9,_0xcef2b5){return db[_0xf326('0x15')]['create'](_0x453100['body'],{'raw':_0x453100['options']?_0x453100[_0xf326('0x16')][_0xf326('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x4cabce){logger[_0xf326('0xb')]('CreateMailQueueReport',_0x453100);logger['debug'](_0xf326('0x14'),_0x453100,JSON[_0xf326('0x18')](_0x4cabce));_0x31ffb9(_0x4cabce);})['catch'](function(_0x5aa184){logger[_0xf326('0xf')](_0xf326('0x14'),_0x5aa184['message'],_0x453100);_0xcef2b5(_0x18bee3[_0xf326('0xf')](0x1f4,_0x5aa184[_0xf326('0x11')]));});});};exports[_0xf326('0x19')]=function(_0x295752){var _0x17c157=this;return new Promise(function(_0x2049ec,_0x5ce532){return db['MailQueueReport']['update'](_0x295752[_0xf326('0x1a')],{'raw':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')][_0xf326('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')]['where']||null:null,'attributes':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')][_0xf326('0x1b')]||null:null,'limit':_0x295752['options']?_0x295752[_0xf326('0x16')]['limit']||null:null})['then'](function(_0x6a8e89){logger[_0xf326('0xb')](_0xf326('0x19'),_0x295752);logger['debug'](_0xf326('0x19'),_0x295752,JSON[_0xf326('0x18')](_0x6a8e89));_0x2049ec(_0x6a8e89);})['catch'](function(_0x225776){logger[_0xf326('0xf')](_0xf326('0x19'),_0x225776[_0xf326('0x11')],_0x295752);_0x5ce532(_0x17c157[_0xf326('0xf')](0x1f4,_0x225776[_0xf326('0x11')]));});});}; \ No newline at end of file +var _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(_0x4b86d9,_0x2b76da){var _0x2fe50c=function(_0x365a1c){while(--_0x365a1c){_0x4b86d9['push'](_0x4b86d9['shift']());}};_0x2fe50c(++_0x2b76da);}(_0x7a54,0x106));var _0x47a5=function(_0x2ed8eb,_0x1c3bd8){_0x2ed8eb=_0x2ed8eb-0x0;var _0x5ce3fd=_0x7a54[_0x2ed8eb];return _0x5ce3fd;};'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 34394a6..8d7a659 100644 --- a/server/api/mailServerIn/index.js +++ b/server/api/mailServerIn/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x21d562,_0x501e02){var _0x3b6c88=function(_0x18f396){while(--_0x18f396){_0x21d562['push'](_0x21d562['shift']());}};_0x3b6c88(++_0x501e02);}(_0x70e0,0x17b));var _0x070e=function(_0x45e11b,_0x4d1595){_0x45e11b=_0x45e11b-0x0;var _0x40bb7b=_0x70e0[_0x45e11b];return _0x40bb7b;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x5c7173,_0x473614){var _0x3319cc=function(_0x54e161){while(--_0x54e161){_0x5c7173['push'](_0x5c7173['shift']());}};_0x3319cc(++_0x473614);}(_0x70e0,0x17b));var _0x070e=function(_0x61652,_0x3d6161){_0x61652=_0x61652-0x0;var _0x5ae7eb=_0x70e0[_0x61652];return _0x5ae7eb;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index be3e1ee..ff6f38a 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 _0x26c1=['BOOLEAN','INTEGER','INBOX','exports','STRING'];(function(_0x5e0aa0,_0x106eca){var _0x52d133=function(_0xe7699b){while(--_0xe7699b){_0x5e0aa0['push'](_0x5e0aa0['shift']());}};_0x52d133(++_0x106eca);}(_0x26c1,0x161));var _0x126c=function(_0x28107d,_0x2ec8b3){_0x28107d=_0x28107d-0x0;var _0x2b1cbe=_0x26c1[_0x28107d];return _0x2b1cbe;};'use strict';var Sequelize=require('sequelize');module[_0x126c('0x0')]={'description':{'type':Sequelize[_0x126c('0x1')]},'host':{'type':Sequelize[_0x126c('0x1')]},'authentication':{'type':Sequelize[_0x126c('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0x126c('0x1')]},'password':{'type':Sequelize[_0x126c('0x1')]},'port':{'type':Sequelize[_0x126c('0x3')]},'tls':{'type':Sequelize[_0x126c('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x126c('0x1')],'defaultValue':_0x126c('0x4')},'connTimeout':{'type':Sequelize[_0x126c('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0x126c('0x1')]},'modernAuthentication':{'type':Sequelize[_0x126c('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xa4bc=['sequelize','STRING','BOOLEAN','INTEGER','INBOX'];(function(_0x7a8e8f,_0x488087){var _0x17c5f5=function(_0x3a32be){while(--_0x3a32be){_0x7a8e8f['push'](_0x7a8e8f['shift']());}};_0x17c5f5(++_0x488087);}(_0xa4bc,0xcd));var _0xca4b=function(_0x1eda20,_0x1149f4){_0x1eda20=_0x1eda20-0x0;var _0x31b953=_0xa4bc[_0x1eda20];return _0x31b953;};'use strict';var Sequelize=require(_0xca4b('0x0'));module['exports']={'description':{'type':Sequelize[_0xca4b('0x1')]},'host':{'type':Sequelize[_0xca4b('0x1')]},'authentication':{'type':Sequelize[_0xca4b('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0xca4b('0x1')]},'password':{'type':Sequelize[_0xca4b('0x1')]},'port':{'type':Sequelize[_0xca4b('0x3')]},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xca4b('0x1')],'defaultValue':_0xca4b('0x4')},'connTimeout':{'type':Sequelize[_0xca4b('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xca4b('0x3')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0xca4b('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 330f0ad..3a3e7fb 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 _0xec52=['lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','define','MailServerIn'];(function(_0x25ae1d,_0x31d03f){var _0x48cd67=function(_0x35367e){while(--_0x35367e){_0x25ae1d['push'](_0x25ae1d['shift']());}};_0x48cd67(++_0x31d03f);}(_0xec52,0x15e));var _0x2ec5=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xec52[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x2ec5('0x0'));var util=require('util');var logger=require(_0x2ec5('0x1'))(_0x2ec5('0x2'));var moment=require('moment');var BPromise=require(_0x2ec5('0x3'));var rp=require(_0x2ec5('0x4'));var fs=require('fs');var path=require(_0x2ec5('0x5'));var rimraf=require(_0x2ec5('0x6'));var config=require(_0x2ec5('0x7'));var attributes=require('./mailServerIn.attributes');module['exports']=function(_0x16e159,_0x3eee47){return _0x16e159[_0x2ec5('0x8')](_0x2ec5('0x9'),attributes,{'tableName':'mail_servers_in','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc5a0=['rimraf','../../config/environment','./mailServerIn.attributes','exports','define','MailServerIn','lodash','../../config/logger','api','request-promise','path'];(function(_0x4a8b0b,_0x3d4cf9){var _0x267962=function(_0x52636d){while(--_0x52636d){_0x4a8b0b['push'](_0x4a8b0b['shift']());}};_0x267962(++_0x3d4cf9);}(_0xc5a0,0x1c9));var _0x0c5a=function(_0x54e0c6,_0x5b69f1){_0x54e0c6=_0x54e0c6-0x0;var _0x83891d=_0xc5a0[_0x54e0c6];return _0x83891d;};'use strict';var _=require(_0x0c5a('0x0'));var util=require('util');var logger=require(_0x0c5a('0x1'))(_0x0c5a('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0c5a('0x3'));var fs=require('fs');var path=require(_0x0c5a('0x4'));var rimraf=require(_0x0c5a('0x5'));var config=require(_0x0c5a('0x6'));var attributes=require(_0x0c5a('0x7'));module[_0x0c5a('0x8')]=function(_0x474112,_0xbf619a){return _0x474112[_0x0c5a('0x9')](_0x0c5a('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 a75065f..1014350 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 _0xc16a=['MailServerIn','findAll','options','raw','where','attributes','limit','include','model','map','stringify','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then','info','MailServerIn,\x20%s,\x20%s','debug','MailServerIn,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','GetMailServerIn'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc16a,0x160));var _0xac16=function(_0x55c5d0,_0x52c8ae){_0x55c5d0=_0x55c5d0-0x0;var _0x18c701=_0xc16a[_0x55c5d0];return _0x18c701;};'use strict';var _=require(_0xac16('0x0'));var util=require(_0xac16('0x1'));var moment=require(_0xac16('0x2'));var BPromise=require(_0xac16('0x3'));var rs=require(_0xac16('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xac16('0x5'))['db'];var utils=require(_0xac16('0x6'));var logger=require(_0xac16('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xac16('0x8')][_0xac16('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x56c57d,_0x36cd59,_0x2778ec){return new BPromise(function(_0x14d622,_0x4afe86){return client[_0xac16('0xa')](_0x56c57d,_0x2778ec)[_0xac16('0xb')](function(_0x4f677c){logger[_0xac16('0xc')](_0xac16('0xd'),_0x36cd59,'request\x20sent');logger[_0xac16('0xe')](_0xac16('0xf'),_0x36cd59,'request\x20sent',JSON['stringify'](_0x4f677c));if(_0x4f677c[_0xac16('0x10')]){if(_0x4f677c[_0xac16('0x10')][_0xac16('0x11')]===0x1f4){logger[_0xac16('0x10')]('MailServerIn,\x20%s,\x20%s',_0x36cd59,_0x4f677c[_0xac16('0x10')][_0xac16('0x12')]);return _0x4afe86(_0x4f677c[_0xac16('0x10')][_0xac16('0x12')]);}logger[_0xac16('0x10')]('MailServerIn,\x20%s,\x20%s',_0x36cd59,_0x4f677c[_0xac16('0x10')][_0xac16('0x12')]);return _0x14d622(_0x4f677c[_0xac16('0x10')]['message']);}else{logger[_0xac16('0xc')](_0xac16('0xd'),_0x36cd59,_0xac16('0x13'));_0x14d622(_0x4f677c[_0xac16('0x14')][_0xac16('0x12')]);}})['catch'](function(_0xea3103){logger[_0xac16('0x10')](_0xac16('0xd'),_0x36cd59,_0xea3103);_0x4afe86(_0xea3103);});});}exports[_0xac16('0x15')]=function(_0x2326b5){var _0x410d75=this;return new Promise(function(_0x4cd874,_0x300362){return db[_0xac16('0x16')][_0xac16('0x17')]({'raw':_0x2326b5[_0xac16('0x18')]?_0x2326b5[_0xac16('0x18')][_0xac16('0x19')]===undefined?!![]:![]:!![],'where':_0x2326b5[_0xac16('0x18')]?_0x2326b5[_0xac16('0x18')][_0xac16('0x1a')]||null:null,'attributes':_0x2326b5['options']?_0x2326b5[_0xac16('0x18')][_0xac16('0x1b')]||null:null,'limit':_0x2326b5[_0xac16('0x18')]?_0x2326b5[_0xac16('0x18')][_0xac16('0x1c')]||null:null,'include':_0x2326b5[_0xac16('0x18')]?_0x2326b5[_0xac16('0x18')][_0xac16('0x1d')]?_['map'](_0x2326b5[_0xac16('0x18')][_0xac16('0x1d')],function(_0x409871){return{'model':db[_0x409871[_0xac16('0x1e')]],'as':_0x409871['as'],'attributes':_0x409871[_0xac16('0x1b')],'include':_0x409871['include']?_[_0xac16('0x1f')](_0x409871['include'],function(_0x38b577){return{'model':db[_0x38b577['model']],'as':_0x38b577['as'],'attributes':_0x38b577[_0xac16('0x1b')],'include':_0x38b577[_0xac16('0x1d')]?_[_0xac16('0x1f')](_0x38b577[_0xac16('0x1d')],function(_0x5a6bdd){return{'model':db[_0x5a6bdd[_0xac16('0x1e')]],'as':_0x5a6bdd['as'],'attributes':_0x5a6bdd[_0xac16('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1e587d){logger['info'](_0xac16('0x15'),_0x2326b5);logger[_0xac16('0xe')](_0xac16('0x15'),_0x2326b5,JSON[_0xac16('0x20')](_0x1e587d));_0x4cd874(_0x1e587d);})[_0xac16('0x21')](function(_0x5b7592){logger[_0xac16('0x10')](_0xac16('0x15'),_0x5b7592[_0xac16('0x12')],_0x2326b5);_0x300362(_0x410d75[_0xac16('0x10')](0x1f4,_0x5b7592[_0xac16('0x12')]));});});}; \ No newline at end of file +var _0x06a0=['MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMailServerIn','findAll','options','where','attributes','limit','include','map','model','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x49e6a9,_0x268fed){var _0x2bba9f=function(_0xd5e42f){while(--_0xd5e42f){_0x49e6a9['push'](_0x49e6a9['shift']());}};_0x2bba9f(++_0x268fed);}(_0x06a0,0x1e1));var _0x006a=function(_0x33aefe,_0x371ccd){_0x33aefe=_0x33aefe-0x0;var _0x471d19=_0x06a0[_0x33aefe];return _0x471d19;};'use strict';var _=require(_0x006a('0x0'));var util=require('util');var moment=require(_0x006a('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x006a('0x2'));var db=require(_0x006a('0x3'))['db'];var utils=require(_0x006a('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x006a('0x5'));var jayson=require(_0x006a('0x6'));var client=jayson[_0x006a('0x7')][_0x006a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x345c22,_0xb532f9,_0x4b1151){return new BPromise(function(_0x5f1077,_0xba9c3b){return client[_0x006a('0x9')](_0x345c22,_0x4b1151)[_0x006a('0xa')](function(_0x11f165){logger[_0x006a('0xb')](_0x006a('0xc'),_0xb532f9,_0x006a('0xd'));logger[_0x006a('0xe')](_0x006a('0xf'),_0xb532f9,_0x006a('0xd'),JSON[_0x006a('0x10')](_0x11f165));if(_0x11f165[_0x006a('0x11')]){if(_0x11f165[_0x006a('0x11')][_0x006a('0x12')]===0x1f4){logger[_0x006a('0x11')]('MailServerIn,\x20%s,\x20%s',_0xb532f9,_0x11f165['error'][_0x006a('0x13')]);return _0xba9c3b(_0x11f165[_0x006a('0x11')][_0x006a('0x13')]);}logger[_0x006a('0x11')](_0x006a('0xc'),_0xb532f9,_0x11f165[_0x006a('0x11')][_0x006a('0x13')]);return _0x5f1077(_0x11f165['error']['message']);}else{logger['info']('MailServerIn,\x20%s,\x20%s',_0xb532f9,_0x006a('0xd'));_0x5f1077(_0x11f165[_0x006a('0x14')][_0x006a('0x13')]);}})[_0x006a('0x15')](function(_0x18be31){logger['error'](_0x006a('0xc'),_0xb532f9,_0x18be31);_0xba9c3b(_0x18be31);});});}exports[_0x006a('0x16')]=function(_0x39d602){var _0x20a3d9=this;return new Promise(function(_0xc0baaa,_0x1001c2){return db['MailServerIn'][_0x006a('0x17')]({'raw':_0x39d602[_0x006a('0x18')]?_0x39d602['options']['raw']===undefined?!![]:![]:!![],'where':_0x39d602[_0x006a('0x18')]?_0x39d602[_0x006a('0x18')][_0x006a('0x19')]||null:null,'attributes':_0x39d602['options']?_0x39d602[_0x006a('0x18')][_0x006a('0x1a')]||null:null,'limit':_0x39d602[_0x006a('0x18')]?_0x39d602[_0x006a('0x18')][_0x006a('0x1b')]||null:null,'include':_0x39d602[_0x006a('0x18')]?_0x39d602[_0x006a('0x18')][_0x006a('0x1c')]?_[_0x006a('0x1d')](_0x39d602[_0x006a('0x18')][_0x006a('0x1c')],function(_0x2c64f5){return{'model':db[_0x2c64f5[_0x006a('0x1e')]],'as':_0x2c64f5['as'],'attributes':_0x2c64f5[_0x006a('0x1a')],'include':_0x2c64f5['include']?_[_0x006a('0x1d')](_0x2c64f5[_0x006a('0x1c')],function(_0x1558f0){return{'model':db[_0x1558f0[_0x006a('0x1e')]],'as':_0x1558f0['as'],'attributes':_0x1558f0[_0x006a('0x1a')],'include':_0x1558f0['include']?_[_0x006a('0x1d')](_0x1558f0[_0x006a('0x1c')],function(_0x115847){return{'model':db[_0x115847[_0x006a('0x1e')]],'as':_0x115847['as'],'attributes':_0x115847[_0x006a('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x006a('0xa')](function(_0x437092){logger[_0x006a('0xb')](_0x006a('0x16'),_0x39d602);logger[_0x006a('0xe')](_0x006a('0x16'),_0x39d602,JSON[_0x006a('0x10')](_0x437092));_0xc0baaa(_0x437092);})[_0x006a('0x15')](function(_0x2b2646){logger[_0x006a('0x11')]('GetMailServerIn',_0x2b2646[_0x006a('0x13')],_0x39d602);_0x1001c2(_0x20a3d9[_0x006a('0x11')](0x1f4,_0x2b2646[_0x006a('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 6883588..e9ea092 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(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0x7a54,0x106));var _0x47a5=function(_0x5a786e,_0x5375a9){_0x5a786e=_0x5a786e-0x0;var _0x65f8d=_0x7a54[_0x5a786e];return _0x65f8d;};'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(_0x4b4ca4,_0x5b5969){_0x4b4ca4=_0x4b4ca4-0x0;var _0xa59ca1=_0x7a54[_0x4b4ca4];return _0xa59ca1;};'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 a871d27..8ea1881 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 _0x3423=['INTEGER','BOOLEAN','STRING'];(function(_0x12a0a3,_0x2652d1){var _0x1c47c4=function(_0x22261b){while(--_0x22261b){_0x12a0a3['push'](_0x12a0a3['shift']());}};_0x1c47c4(++_0x2652d1);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize[_0x3342('0x0')]},'host':{'type':Sequelize[_0x3342('0x0')]},'user':{'type':Sequelize[_0x3342('0x0')]},'pass':{'type':Sequelize[_0x3342('0x0')]},'port':{'type':Sequelize[_0x3342('0x1')]},'secure':{'type':Sequelize[_0x3342('0x2')],'defaultValue':![]},'service':{'type':Sequelize[_0x3342('0x0')]},'authentication':{'type':Sequelize[_0x3342('0x2')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x3342('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x4024=['INTEGER','BOOLEAN','sequelize','exports','STRING'];(function(_0x47967b,_0x200081){var _0x53a06c=function(_0x46c24c){while(--_0x46c24c){_0x47967b['push'](_0x47967b['shift']());}};_0x53a06c(++_0x200081);}(_0x4024,0x89));var _0x4402=function(_0x140eef,_0x26d53b){_0x140eef=_0x140eef-0x0;var _0x133662=_0x4024[_0x140eef];return _0x133662;};'use strict';var Sequelize=require(_0x4402('0x0'));module[_0x4402('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x4402('0x2')]},'user':{'type':Sequelize[_0x4402('0x2')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x4402('0x3')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0x4402('0x2')]},'authentication':{'type':Sequelize[_0x4402('0x4')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 7ac6dcf..372fd4d 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 _0x702a=['offset','set','apply','reject','save','update','then','end','stack','name','send','index','map','MailServerOut','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','limit'];(function(_0x64bec,_0x37225c){var _0x46b9c6=function(_0x4cd9af){while(--_0x4cd9af){_0x64bec['push'](_0x64bec['shift']());}};_0x46b9c6(++_0x37225c);}(_0x702a,0x190));var _0xa702=function(_0x517931,_0x42877f){_0x517931=_0x517931-0x0;var _0x558bc5=_0x702a[_0x517931];return _0x558bc5;};'use strict';var emlformat=require(_0xa702('0x0'));var rimraf=require(_0xa702('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa702('0x2'));var rp=require(_0xa702('0x3'));var moment=require(_0xa702('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa702('0x5'));var util=require('util');var path=require('path');var sox=require(_0xa702('0x6'));var csv=require(_0xa702('0x7'));var ejs=require(_0xa702('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa702('0x9'));var squel=require(_0xa702('0xa'));var crypto=require(_0xa702('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xa702('0xc'));var toCsv=require(_0xa702('0x7'));var querystring=require(_0xa702('0xd'));var Papa=require(_0xa702('0xe'));var Redis=require(_0xa702('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xa702('0x10'));var as=require(_0xa702('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xa702('0x12'));var config=require(_0xa702('0x13'));var licenseUtil=require(_0xa702('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x38dccd,_0x42ef77){_0x42ef77=_0x42ef77||0xcc;return function(_0x336a47){if(_0x336a47){return _0x38dccd[_0xa702('0x15')](_0x42ef77);}return _0x38dccd[_0xa702('0x16')](_0x42ef77)['end']();};}function respondWithResult(_0x441ec5,_0x275e2a){_0x275e2a=_0x275e2a||0xc8;return function(_0x1abb85){if(_0x1abb85){return _0x441ec5[_0xa702('0x16')](_0x275e2a)[_0xa702('0x17')](_0x1abb85);}};}function respondWithFilteredResult(_0x4005be,_0x433878){return function(_0x314191){if(_0x314191){var _0xb15ce3=typeof _0x433878['offset']===_0xa702('0x18')&&typeof _0x433878[_0xa702('0x19')]===_0xa702('0x18');var _0x1ca80a=_0x314191['count'];var _0x33e95d=_0xb15ce3?0x0:_0x433878[_0xa702('0x1a')];var _0x329055=_0xb15ce3?_0x314191['count']:_0x433878['offset']+_0x433878['limit'];var _0x5e59d3;if(_0x329055>=_0x1ca80a){_0x329055=_0x1ca80a;_0x5e59d3=0xc8;}else{_0x5e59d3=0xce;}_0x4005be[_0xa702('0x16')](_0x5e59d3);return _0x4005be[_0xa702('0x1b')]('Content-Range',_0x33e95d+'-'+_0x329055+'/'+_0x1ca80a)[_0xa702('0x17')](_0x314191);}return null;};}function patchUpdates(_0x39ef09){return function(_0x303eef){try{jsonpatch[_0xa702('0x1c')](_0x303eef,_0x39ef09,!![]);}catch(_0x398386){return BPromise[_0xa702('0x1d')](_0x398386);}return _0x303eef[_0xa702('0x1e')]();};}function saveUpdates(_0x183ec5,_0x53ba98){return function(_0x5bb4d3){if(_0x5bb4d3){return _0x5bb4d3[_0xa702('0x1f')](_0x183ec5)[_0xa702('0x20')](function(_0x13e506){return _0x13e506;});}return null;};}function removeEntity(_0x385822,_0x53a4de){return function(_0x4c8050){if(_0x4c8050){return _0x4c8050['destroy']()[_0xa702('0x20')](function(){_0x385822[_0xa702('0x16')](0xcc)[_0xa702('0x21')]();});}};}function handleEntityNotFound(_0x5c3e0a,_0x193fba){return function(_0x875e9c){if(!_0x875e9c){_0x5c3e0a[_0xa702('0x15')](0x194);}return _0x875e9c;};}function handleError(_0x3c1e9e,_0x3db134){_0x3db134=_0x3db134||0x1f4;return function(_0xdb59fa){logger['error'](_0xdb59fa[_0xa702('0x22')]);if(_0xdb59fa[_0xa702('0x23')]){delete _0xdb59fa[_0xa702('0x23')];}_0x3c1e9e[_0xa702('0x16')](_0x3db134)[_0xa702('0x24')](_0xdb59fa);};}exports[_0xa702('0x25')]=function(_0x2594d3,_0x49b00d){var _0x4973d0={},_0x5a7f43={},_0x295c3b={'count':0x0,'rows':[]};var _0x57af88=_[_0xa702('0x26')](db[_0xa702('0x27')]['rawAttributes'],function(_0x49d948){return{'name':_0x49d948[_0xa702('0x28')],'type':_0x49d948[_0xa702('0x29')][_0xa702('0x2a')]};});_0x5a7f43[_0xa702('0x2b')]=_[_0xa702('0x26')](_0x57af88,'name');_0x5a7f43[_0xa702('0x2c')]=_[_0xa702('0x2d')](_0x2594d3['query']);_0x5a7f43[_0xa702('0x2e')]=_['intersection'](_0x5a7f43[_0xa702('0x2b')],_0x5a7f43[_0xa702('0x2c')]);_0x4973d0[_0xa702('0x2f')]=_[_0xa702('0x30')](_0x5a7f43[_0xa702('0x2b')],qs[_0xa702('0x31')](_0x2594d3[_0xa702('0x2c')][_0xa702('0x31')]));_0x4973d0['attributes']=_0x4973d0[_0xa702('0x2f')][_0xa702('0x32')]?_0x4973d0[_0xa702('0x2f')]:_0x5a7f43['model'];if(!_0x2594d3[_0xa702('0x2c')]['hasOwnProperty'](_0xa702('0x33'))){_0x4973d0[_0xa702('0x19')]=qs['limit'](_0x2594d3['query'][_0xa702('0x19')]);_0x4973d0[_0xa702('0x1a')]=qs[_0xa702('0x1a')](_0x2594d3['query'][_0xa702('0x1a')]);}_0x4973d0[_0xa702('0x34')]=qs['sort'](_0x2594d3['query'][_0xa702('0x35')]);_0x4973d0[_0xa702('0x36')]=qs[_0xa702('0x2e')](_[_0xa702('0x37')](_0x2594d3['query'],_0x5a7f43[_0xa702('0x2e')]),_0x57af88);if(_0x2594d3[_0xa702('0x2c')][_0xa702('0x38')]){_0x4973d0[_0xa702('0x36')]=_[_0xa702('0x39')](_0x4973d0[_0xa702('0x36')],{'$or':_['map'](_0x57af88,function(_0x57ced4){if(_0x57ced4[_0xa702('0x29')]!==_0xa702('0x3a')){var _0x27da50={};_0x27da50[_0x57ced4[_0xa702('0x23')]]={'$like':'%'+_0x2594d3[_0xa702('0x2c')][_0xa702('0x38')]+'%'};return _0x27da50;}})});}_0x4973d0=_[_0xa702('0x39')]({},_0x4973d0,_0x2594d3[_0xa702('0x3b')]);var _0x556889={'where':_0x4973d0[_0xa702('0x36')]};return db['MailServerOut']['count'](_0x556889)[_0xa702('0x20')](function(_0x12a631){_0x295c3b[_0xa702('0x3c')]=_0x12a631;if(_0x2594d3[_0xa702('0x2c')][_0xa702('0x3d')]){_0x4973d0[_0xa702('0x3e')]=[{'all':!![]}];}return db[_0xa702('0x27')]['findAll'](_0x4973d0);})[_0xa702('0x20')](function(_0x44ca7f){_0x295c3b[_0xa702('0x3f')]=_0x44ca7f;return _0x295c3b;})[_0xa702('0x20')](respondWithFilteredResult(_0x49b00d,_0x4973d0))[_0xa702('0x40')](handleError(_0x49b00d,null));};exports[_0xa702('0x41')]=function(_0x5b1f88,_0x36cc08){var _0x5d387e={'raw':!![],'where':{'id':_0x5b1f88[_0xa702('0x42')]['id']}},_0x4365a1={};_0x4365a1[_0xa702('0x2b')]=_[_0xa702('0x2d')](db[_0xa702('0x27')][_0xa702('0x43')]);_0x4365a1[_0xa702('0x2c')]=_[_0xa702('0x2d')](_0x5b1f88[_0xa702('0x2c')]);_0x4365a1[_0xa702('0x2e')]=_[_0xa702('0x30')](_0x4365a1[_0xa702('0x2b')],_0x4365a1[_0xa702('0x2c')]);_0x5d387e[_0xa702('0x2f')]=_[_0xa702('0x30')](_0x4365a1['model'],qs[_0xa702('0x31')](_0x5b1f88['query'][_0xa702('0x31')]));_0x5d387e[_0xa702('0x2f')]=_0x5d387e[_0xa702('0x2f')]['length']?_0x5d387e[_0xa702('0x2f')]:_0x4365a1[_0xa702('0x2b')];if(_0x5b1f88['query']['includeAll']){_0x5d387e[_0xa702('0x3e')]=[{'all':!![]}];}_0x5d387e=_[_0xa702('0x39')]({},_0x5d387e,_0x5b1f88['options']);return db[_0xa702('0x27')][_0xa702('0x44')](_0x5d387e)[_0xa702('0x20')](handleEntityNotFound(_0x36cc08,null))[_0xa702('0x20')](respondWithResult(_0x36cc08,null))[_0xa702('0x40')](handleError(_0x36cc08,null));};exports['create']=function(_0x31f8ea,_0x120fef){return db[_0xa702('0x27')][_0xa702('0x45')](_0x31f8ea[_0xa702('0x46')],{})[_0xa702('0x20')](respondWithResult(_0x120fef,0xc9))[_0xa702('0x40')](handleError(_0x120fef,null));};exports[_0xa702('0x1f')]=function(_0x19808d,_0x57a20b){if(_0x19808d['body']['id']){delete _0x19808d['body']['id'];}return db[_0xa702('0x27')][_0xa702('0x44')]({'where':{'id':_0x19808d[_0xa702('0x42')]['id']}})['then'](handleEntityNotFound(_0x57a20b,null))[_0xa702('0x20')](saveUpdates(_0x19808d[_0xa702('0x46')],null))[_0xa702('0x20')](respondWithResult(_0x57a20b,null))[_0xa702('0x40')](handleError(_0x57a20b,null));};exports['destroy']=function(_0xfa8ba7,_0x166293){return db[_0xa702('0x27')][_0xa702('0x44')]({'where':{'id':_0xfa8ba7['params']['id']}})[_0xa702('0x20')](handleEntityNotFound(_0x166293,null))['then'](removeEntity(_0x166293,null))[_0xa702('0x40')](handleError(_0x166293,null));}; \ No newline at end of file +var _0x0d41=['key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','VIRTUAL','options','include','findAll','rows','catch','show','params','rawAttributes','includeAll','merge','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','save','update','destroy','then','error','stack','name','send','index','map','MailServerOut','fieldName','type'];(function(_0x3ed73d,_0x1ff812){var _0xb1be50=function(_0x5f0799){while(--_0x5f0799){_0x3ed73d['push'](_0x3ed73d['shift']());}};_0xb1be50(++_0x1ff812);}(_0x0d41,0x154));var _0x10d4=function(_0x4c6780,_0x2f8f56){_0x4c6780=_0x4c6780-0x0;var _0x174249=_0x0d41[_0x4c6780];return _0x174249;};'use strict';var emlformat=require(_0x10d4('0x0'));var rimraf=require(_0x10d4('0x1'));var zipdir=require(_0x10d4('0x2'));var jsonpatch=require(_0x10d4('0x3'));var rp=require(_0x10d4('0x4'));var moment=require(_0x10d4('0x5'));var BPromise=require(_0x10d4('0x6'));var Mustache=require(_0x10d4('0x7'));var util=require(_0x10d4('0x8'));var path=require(_0x10d4('0x9'));var sox=require(_0x10d4('0xa'));var csv=require(_0x10d4('0xb'));var ejs=require(_0x10d4('0xc'));var fs=require('fs');var fs_extra=require(_0x10d4('0xd'));var _=require('lodash');var squel=require(_0x10d4('0xe'));var crypto=require(_0x10d4('0xf'));var jsforce=require(_0x10d4('0x10'));var deskjs=require(_0x10d4('0x11'));var toCsv=require(_0x10d4('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x10d4('0x12'));var authService=require(_0x10d4('0x13'));var qs=require(_0x10d4('0x14'));var as=require(_0x10d4('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x10d4('0x16'));var utils=require(_0x10d4('0x17'));var config=require(_0x10d4('0x18'));var licenseUtil=require(_0x10d4('0x19'));var db=require(_0x10d4('0x1a'))['db'];function respondWithStatusCode(_0x351f44,_0x5427e9){_0x5427e9=_0x5427e9||0xcc;return function(_0x13eabc){if(_0x13eabc){return _0x351f44[_0x10d4('0x1b')](_0x5427e9);}return _0x351f44[_0x10d4('0x1c')](_0x5427e9)[_0x10d4('0x1d')]();};}function respondWithResult(_0x3048ad,_0x53abd2){_0x53abd2=_0x53abd2||0xc8;return function(_0x475f05){if(_0x475f05){return _0x3048ad[_0x10d4('0x1c')](_0x53abd2)[_0x10d4('0x1e')](_0x475f05);}};}function respondWithFilteredResult(_0x4f13ec,_0x5481d7){return function(_0x266777){if(_0x266777){var _0x2ebf43=typeof _0x5481d7[_0x10d4('0x1f')]==='undefined'&&typeof _0x5481d7[_0x10d4('0x20')]==='undefined';var _0x1def47=_0x266777[_0x10d4('0x21')];var _0x5bd859=_0x2ebf43?0x0:_0x5481d7[_0x10d4('0x1f')];var _0xcb8e4f=_0x2ebf43?_0x266777[_0x10d4('0x21')]:_0x5481d7['offset']+_0x5481d7[_0x10d4('0x20')];var _0x2d52d8;if(_0xcb8e4f>=_0x1def47){_0xcb8e4f=_0x1def47;_0x2d52d8=0xc8;}else{_0x2d52d8=0xce;}_0x4f13ec[_0x10d4('0x1c')](_0x2d52d8);return _0x4f13ec[_0x10d4('0x22')](_0x10d4('0x23'),_0x5bd859+'-'+_0xcb8e4f+'/'+_0x1def47)[_0x10d4('0x1e')](_0x266777);}return null;};}function patchUpdates(_0xdced8f){return function(_0x4eaf8a){try{jsonpatch[_0x10d4('0x24')](_0x4eaf8a,_0xdced8f,!![]);}catch(_0x211607){return BPromise['reject'](_0x211607);}return _0x4eaf8a[_0x10d4('0x25')]();};}function saveUpdates(_0x8d70bf,_0x34f420){return function(_0x5a926b){if(_0x5a926b){return _0x5a926b[_0x10d4('0x26')](_0x8d70bf)['then'](function(_0xe4e0f4){return _0xe4e0f4;});}return null;};}function removeEntity(_0x4f9c88,_0x50c6a7){return function(_0x4fc20e){if(_0x4fc20e){return _0x4fc20e[_0x10d4('0x27')]()[_0x10d4('0x28')](function(){_0x4f9c88[_0x10d4('0x1c')](0xcc)[_0x10d4('0x1d')]();});}};}function handleEntityNotFound(_0x3cc3cf,_0x4ecb09){return function(_0x5d1e25){if(!_0x5d1e25){_0x3cc3cf[_0x10d4('0x1b')](0x194);}return _0x5d1e25;};}function handleError(_0x507891,_0x2a1e06){_0x2a1e06=_0x2a1e06||0x1f4;return function(_0x3a3f59){logger[_0x10d4('0x29')](_0x3a3f59[_0x10d4('0x2a')]);if(_0x3a3f59[_0x10d4('0x2b')]){delete _0x3a3f59[_0x10d4('0x2b')];}_0x507891[_0x10d4('0x1c')](_0x2a1e06)[_0x10d4('0x2c')](_0x3a3f59);};}exports[_0x10d4('0x2d')]=function(_0x29a5d8,_0x3ef1f0){var _0xc517db={},_0x322f20={},_0x289594={'count':0x0,'rows':[]};var _0x39dd3a=_[_0x10d4('0x2e')](db[_0x10d4('0x2f')]['rawAttributes'],function(_0x2afdd4){return{'name':_0x2afdd4[_0x10d4('0x30')],'type':_0x2afdd4[_0x10d4('0x31')][_0x10d4('0x32')]};});_0x322f20[_0x10d4('0x33')]=_['map'](_0x39dd3a,_0x10d4('0x2b'));_0x322f20[_0x10d4('0x34')]=_[_0x10d4('0x35')](_0x29a5d8[_0x10d4('0x34')]);_0x322f20[_0x10d4('0x36')]=_[_0x10d4('0x37')](_0x322f20[_0x10d4('0x33')],_0x322f20[_0x10d4('0x34')]);_0xc517db[_0x10d4('0x38')]=_[_0x10d4('0x37')](_0x322f20['model'],qs[_0x10d4('0x39')](_0x29a5d8[_0x10d4('0x34')][_0x10d4('0x39')]));_0xc517db[_0x10d4('0x38')]=_0xc517db[_0x10d4('0x38')][_0x10d4('0x3a')]?_0xc517db[_0x10d4('0x38')]:_0x322f20['model'];if(!_0x29a5d8[_0x10d4('0x34')]['hasOwnProperty'](_0x10d4('0x3b'))){_0xc517db[_0x10d4('0x20')]=qs[_0x10d4('0x20')](_0x29a5d8['query'][_0x10d4('0x20')]);_0xc517db[_0x10d4('0x1f')]=qs['offset'](_0x29a5d8[_0x10d4('0x34')]['offset']);}_0xc517db['order']=qs['sort'](_0x29a5d8['query'][_0x10d4('0x3c')]);_0xc517db[_0x10d4('0x3d')]=qs[_0x10d4('0x36')](_[_0x10d4('0x3e')](_0x29a5d8[_0x10d4('0x34')],_0x322f20[_0x10d4('0x36')]),_0x39dd3a);if(_0x29a5d8[_0x10d4('0x34')][_0x10d4('0x3f')]){_0xc517db[_0x10d4('0x3d')]=_['merge'](_0xc517db[_0x10d4('0x3d')],{'$or':_['map'](_0x39dd3a,function(_0x125fc8){if(_0x125fc8[_0x10d4('0x31')]!==_0x10d4('0x40')){var _0x531aa6={};_0x531aa6[_0x125fc8[_0x10d4('0x2b')]]={'$like':'%'+_0x29a5d8['query']['filter']+'%'};return _0x531aa6;}})});}_0xc517db=_['merge']({},_0xc517db,_0x29a5d8[_0x10d4('0x41')]);var _0x4cee51={'where':_0xc517db[_0x10d4('0x3d')]};return db[_0x10d4('0x2f')][_0x10d4('0x21')](_0x4cee51)[_0x10d4('0x28')](function(_0x131f6a){_0x289594[_0x10d4('0x21')]=_0x131f6a;if(_0x29a5d8['query']['includeAll']){_0xc517db[_0x10d4('0x42')]=[{'all':!![]}];}return db['MailServerOut'][_0x10d4('0x43')](_0xc517db);})[_0x10d4('0x28')](function(_0xe211b1){_0x289594[_0x10d4('0x44')]=_0xe211b1;return _0x289594;})[_0x10d4('0x28')](respondWithFilteredResult(_0x3ef1f0,_0xc517db))[_0x10d4('0x45')](handleError(_0x3ef1f0,null));};exports[_0x10d4('0x46')]=function(_0x2fc3f0,_0x32953c){var _0x28380e={'raw':!![],'where':{'id':_0x2fc3f0[_0x10d4('0x47')]['id']}},_0x1d1c39={};_0x1d1c39['model']=_[_0x10d4('0x35')](db[_0x10d4('0x2f')][_0x10d4('0x48')]);_0x1d1c39[_0x10d4('0x34')]=_['keys'](_0x2fc3f0[_0x10d4('0x34')]);_0x1d1c39[_0x10d4('0x36')]=_[_0x10d4('0x37')](_0x1d1c39[_0x10d4('0x33')],_0x1d1c39['query']);_0x28380e[_0x10d4('0x38')]=_[_0x10d4('0x37')](_0x1d1c39['model'],qs['fields'](_0x2fc3f0[_0x10d4('0x34')][_0x10d4('0x39')]));_0x28380e['attributes']=_0x28380e[_0x10d4('0x38')][_0x10d4('0x3a')]?_0x28380e[_0x10d4('0x38')]:_0x1d1c39[_0x10d4('0x33')];if(_0x2fc3f0[_0x10d4('0x34')][_0x10d4('0x49')]){_0x28380e['include']=[{'all':!![]}];}_0x28380e=_[_0x10d4('0x4a')]({},_0x28380e,_0x2fc3f0['options']);return db[_0x10d4('0x2f')][_0x10d4('0x4b')](_0x28380e)[_0x10d4('0x28')](handleEntityNotFound(_0x32953c,null))['then'](respondWithResult(_0x32953c,null))['catch'](handleError(_0x32953c,null));};exports[_0x10d4('0x4c')]=function(_0x3f6a84,_0x5cbd15){return db[_0x10d4('0x2f')][_0x10d4('0x4c')](_0x3f6a84[_0x10d4('0x4d')],{})[_0x10d4('0x28')](respondWithResult(_0x5cbd15,0xc9))[_0x10d4('0x45')](handleError(_0x5cbd15,null));};exports[_0x10d4('0x26')]=function(_0x326c6c,_0x3f242b){if(_0x326c6c['body']['id']){delete _0x326c6c[_0x10d4('0x4d')]['id'];}return db[_0x10d4('0x2f')][_0x10d4('0x4b')]({'where':{'id':_0x326c6c[_0x10d4('0x47')]['id']}})[_0x10d4('0x28')](handleEntityNotFound(_0x3f242b,null))['then'](saveUpdates(_0x326c6c[_0x10d4('0x4d')],null))[_0x10d4('0x28')](respondWithResult(_0x3f242b,null))['catch'](handleError(_0x3f242b,null));};exports[_0x10d4('0x27')]=function(_0xc06f27,_0x4df898){return db[_0x10d4('0x2f')][_0x10d4('0x4b')]({'where':{'id':_0xc06f27[_0x10d4('0x47')]['id']}})['then'](handleEntityNotFound(_0x4df898,null))['then'](removeEntity(_0x4df898,null))[_0x10d4('0x45')](handleError(_0x4df898,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index f91e828..3a2b39d 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 _0xf40e=['define','MailServerOut','mail_servers_out','util','api','moment','bluebird','request-promise','path','../../config/environment','./mailServerOut.attributes','exports'];(function(_0x83d0ad,_0x36efe7){var _0x5077aa=function(_0x240784){while(--_0x240784){_0x83d0ad['push'](_0x83d0ad['shift']());}};_0x5077aa(++_0x36efe7);}(_0xf40e,0xab));var _0xef40=function(_0x257b0e,_0x23d0eb){_0x257b0e=_0x257b0e-0x0;var _0x186f35=_0xf40e[_0x257b0e];return _0x186f35;};'use strict';var _=require('lodash');var util=require(_0xef40('0x0'));var logger=require('../../config/logger')(_0xef40('0x1'));var moment=require(_0xef40('0x2'));var BPromise=require(_0xef40('0x3'));var rp=require(_0xef40('0x4'));var fs=require('fs');var path=require(_0xef40('0x5'));var rimraf=require('rimraf');var config=require(_0xef40('0x6'));var attributes=require(_0xef40('0x7'));module[_0xef40('0x8')]=function(_0x5da240,_0xa0c311){return _0x5da240[_0xef40('0x9')](_0xef40('0xa'),attributes,{'tableName':_0xef40('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x86d6=['define','mail_servers_out','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment'];(function(_0x29a7ec,_0x4e3a9c){var _0x38ad00=function(_0x562b4a){while(--_0x562b4a){_0x29a7ec['push'](_0x29a7ec['shift']());}};_0x38ad00(++_0x4e3a9c);}(_0x86d6,0x107));var _0x686d=function(_0x1aef43,_0x574e03){_0x1aef43=_0x1aef43-0x0;var _0x148d8c=_0x86d6[_0x1aef43];return _0x148d8c;};'use strict';var _=require('lodash');var util=require(_0x686d('0x0'));var logger=require(_0x686d('0x1'))(_0x686d('0x2'));var moment=require(_0x686d('0x3'));var BPromise=require(_0x686d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x686d('0x5'));var config=require(_0x686d('0x6'));var attributes=require('./mailServerOut.attributes');module['exports']=function(_0x4801c1,_0x5ce1b7){return _0x4801c1[_0x686d('0x7')]('MailServerOut',attributes,{'tableName':_0x686d('0x8'),'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 ae27704..bcf1fbd 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(_0x25b0ca,_0x560c07){var _0x24e3ba=function(_0x1d3e66){while(--_0x1d3e66){_0x25b0ca['push'](_0x25b0ca['shift']());}};_0x24e3ba(++_0x560c07);}(_0xdb28,0x106));var _0x8db2=function(_0xda6589,_0x441a66){_0xda6589=_0xda6589-0x0;var _0x4beb52=_0xdb28[_0xda6589];return _0x4beb52;};'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 _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(_0x1d320e,_0x136cbc){var _0x54f9f5=function(_0x47e7b3){while(--_0x47e7b3){_0x1d320e['push'](_0x1d320e['shift']());}};_0x54f9f5(++_0x136cbc);}(_0xdb28,0x106));var _0x8db2=function(_0x2e3872,_0x18668c){_0x2e3872=_0x2e3872-0x0;var _0x52b5ba=_0xdb28[_0x2e3872];return _0x52b5ba;};'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 diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 36f9aec..e9c5c92 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 _0x0703=['/:id','create','put','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x49c771,_0x8abc21){var _0x29dd48=function(_0x1ac0cb){while(--_0x1ac0cb){_0x49c771['push'](_0x49c771['shift']());}};_0x29dd48(++_0x8abc21);}(_0x0703,0x11d));var _0x3070=function(_0x38ed84,_0x31718d){_0x38ed84=_0x38ed84-0x0;var _0x4bb181=_0x0703[_0x38ed84];return _0x4bb181;};'use strict';var multer=require(_0x3070('0x0'));var util=require(_0x3070('0x1'));var path=require(_0x3070('0x2'));var timeout=require(_0x3070('0x3'));var express=require(_0x3070('0x4'));var router=express[_0x3070('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x3070('0x6'));var interaction=require(_0x3070('0x7'));var config=require(_0x3070('0x8'));var controller=require(_0x3070('0x9'));router[_0x3070('0xa')]('/',auth[_0x3070('0xb')](),controller[_0x3070('0xc')]);router[_0x3070('0xa')](_0x3070('0xd'),auth[_0x3070('0xb')](),controller[_0x3070('0xe')]);router['get'](_0x3070('0xf'),auth[_0x3070('0xb')](),controller['show']);router['post']('/',auth[_0x3070('0xb')](),controller[_0x3070('0x10')]);router[_0x3070('0x11')](_0x3070('0xf'),auth[_0x3070('0xb')](),controller['update']);router['delete'](_0x3070('0xf'),auth[_0x3070('0xb')](),controller[_0x3070('0x12')]);module[_0x3070('0x13')]=router; \ No newline at end of file +var _0xb2af=['./mailSubstatus.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0xb2af,0x1f1));var _0xfb2a=function(_0x487101,_0x29404c){_0x487101=_0x487101-0x0;var _0x4bbcdd=_0xb2af[_0x487101];return _0x4bbcdd;};'use strict';var multer=require(_0xfb2a('0x0'));var util=require('util');var path=require(_0xfb2a('0x1'));var timeout=require(_0xfb2a('0x2'));var express=require('express');var router=express[_0xfb2a('0x3')]();var fs_extra=require(_0xfb2a('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xfb2a('0x5'));var config=require(_0xfb2a('0x6'));var controller=require(_0xfb2a('0x7'));router[_0xfb2a('0x8')]('/',auth[_0xfb2a('0x9')](),controller[_0xfb2a('0xa')]);router[_0xfb2a('0x8')](_0xfb2a('0xb'),auth[_0xfb2a('0x9')](),controller[_0xfb2a('0xc')]);router[_0xfb2a('0x8')](_0xfb2a('0xd'),auth[_0xfb2a('0x9')](),controller[_0xfb2a('0xe')]);router[_0xfb2a('0xf')]('/',auth[_0xfb2a('0x9')](),controller[_0xfb2a('0x10')]);router[_0xfb2a('0x11')](_0xfb2a('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xfb2a('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xfb2a('0x13')]);module[_0xfb2a('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 103c6ca..a880956 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 _0x2bd8=['name','sequelize','STRING'];(function(_0x4a10cc,_0x54d474){var _0xc8c61a=function(_0x15c93e){while(--_0x15c93e){_0x4a10cc['push'](_0x4a10cc['shift']());}};_0xc8c61a(++_0x54d474);}(_0x2bd8,0x130));var _0x82bd=function(_0x1695a3,_0x44f929){_0x1695a3=_0x1695a3-0x0;var _0x2f61de=_0x2bd8[_0x1695a3];return _0x2f61de;};'use strict';var Sequelize=require(_0x82bd('0x0'));module['exports']={'name':{'type':Sequelize[_0x82bd('0x1')],'unique':_0x82bd('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x82bd('0x1')]}}; \ No newline at end of file +var _0x9fd4=['sequelize','exports','STRING','name'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0x9fd4,0x16c));var _0x49fd=function(_0x29228b,_0x4801be){_0x29228b=_0x29228b-0x0;var _0x2acdce=_0x9fd4[_0x29228b];return _0x2acdce;};'use strict';var Sequelize=require(_0x49fd('0x0'));module[_0x49fd('0x1')]={'name':{'type':Sequelize[_0x49fd('0x2')],'unique':_0x49fd('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x49fd('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index e85b1f2..eb8f30a 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 _0x8d2a=['create','body','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','sendStatus','stack','name','send','index','map','MailSubstatus','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','sort','where','filters','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0x8d2a,0x1bf));var _0xa8d2=function(_0x5f2b46,_0x599333){_0x5f2b46=_0x5f2b46-0x0;var _0x33fe8b=_0x8d2a[_0x5f2b46];return _0x33fe8b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa8d2('0x0'));var zipdir=require(_0xa8d2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa8d2('0x2'));var moment=require(_0xa8d2('0x3'));var BPromise=require(_0xa8d2('0x4'));var Mustache=require(_0xa8d2('0x5'));var util=require('util');var path=require('path');var sox=require(_0xa8d2('0x6'));var csv=require(_0xa8d2('0x7'));var ejs=require(_0xa8d2('0x8'));var fs=require('fs');var fs_extra=require(_0xa8d2('0x9'));var _=require(_0xa8d2('0xa'));var squel=require(_0xa8d2('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa8d2('0xc'));var toCsv=require(_0xa8d2('0x7'));var querystring=require(_0xa8d2('0xd'));var Papa=require(_0xa8d2('0xe'));var Redis=require('ioredis');var authService=require(_0xa8d2('0xf'));var qs=require(_0xa8d2('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa8d2('0x11'));var logger=require(_0xa8d2('0x12'))(_0xa8d2('0x13'));var utils=require(_0xa8d2('0x14'));var config=require(_0xa8d2('0x15'));var licenseUtil=require(_0xa8d2('0x16'));var db=require(_0xa8d2('0x17'))['db'];function respondWithStatusCode(_0xeb8439,_0xd4294c){_0xd4294c=_0xd4294c||0xcc;return function(_0x1ee85a){if(_0x1ee85a){return _0xeb8439['sendStatus'](_0xd4294c);}return _0xeb8439[_0xa8d2('0x18')](_0xd4294c)[_0xa8d2('0x19')]();};}function respondWithResult(_0x49f79d,_0x5d43eb){_0x5d43eb=_0x5d43eb||0xc8;return function(_0x480fea){if(_0x480fea){return _0x49f79d[_0xa8d2('0x18')](_0x5d43eb)['json'](_0x480fea);}};}function respondWithFilteredResult(_0x5d22b5,_0x2cd40d){return function(_0xbacea3){if(_0xbacea3){var _0x423742=typeof _0x2cd40d[_0xa8d2('0x1a')]===_0xa8d2('0x1b')&&typeof _0x2cd40d[_0xa8d2('0x1c')]===_0xa8d2('0x1b');var _0x99a172=_0xbacea3[_0xa8d2('0x1d')];var _0x24e6e7=_0x423742?0x0:_0x2cd40d[_0xa8d2('0x1a')];var _0x24a785=_0x423742?_0xbacea3['count']:_0x2cd40d[_0xa8d2('0x1a')]+_0x2cd40d[_0xa8d2('0x1c')];var _0x49e386;if(_0x24a785>=_0x99a172){_0x24a785=_0x99a172;_0x49e386=0xc8;}else{_0x49e386=0xce;}_0x5d22b5['status'](_0x49e386);return _0x5d22b5[_0xa8d2('0x1e')](_0xa8d2('0x1f'),_0x24e6e7+'-'+_0x24a785+'/'+_0x99a172)['json'](_0xbacea3);}return null;};}function patchUpdates(_0x166a7c){return function(_0x5857de){try{jsonpatch[_0xa8d2('0x20')](_0x5857de,_0x166a7c,!![]);}catch(_0x51b643){return BPromise[_0xa8d2('0x21')](_0x51b643);}return _0x5857de['save']();};}function saveUpdates(_0x4291d9,_0x549e2b){return function(_0xb0580d){if(_0xb0580d){return _0xb0580d[_0xa8d2('0x22')](_0x4291d9)[_0xa8d2('0x23')](function(_0x193534){return _0x193534;});}return null;};}function removeEntity(_0x25af96,_0x5b8dec){return function(_0x2c4671){if(_0x2c4671){return _0x2c4671[_0xa8d2('0x24')]()[_0xa8d2('0x23')](function(){_0x25af96['status'](0xcc)[_0xa8d2('0x19')]();});}};}function handleEntityNotFound(_0x2d09b9,_0x318859){return function(_0x5f174e){if(!_0x5f174e){_0x2d09b9[_0xa8d2('0x25')](0x194);}return _0x5f174e;};}function handleError(_0x403337,_0x56fd71){_0x56fd71=_0x56fd71||0x1f4;return function(_0x2e81ad){logger['error'](_0x2e81ad[_0xa8d2('0x26')]);if(_0x2e81ad[_0xa8d2('0x27')]){delete _0x2e81ad[_0xa8d2('0x27')];}_0x403337[_0xa8d2('0x18')](_0x56fd71)[_0xa8d2('0x28')](_0x2e81ad);};}exports[_0xa8d2('0x29')]=function(_0x2439dc,_0x437963){var _0x265edd={},_0x380022={},_0x4059c8={'count':0x0,'rows':[]};var _0x450a71=_[_0xa8d2('0x2a')](db[_0xa8d2('0x2b')][_0xa8d2('0x2c')],function(_0xacaeb6){return{'name':_0xacaeb6[_0xa8d2('0x2d')],'type':_0xacaeb6[_0xa8d2('0x2e')][_0xa8d2('0x2f')]};});_0x380022[_0xa8d2('0x30')]=_[_0xa8d2('0x2a')](_0x450a71,_0xa8d2('0x27'));_0x380022[_0xa8d2('0x31')]=_[_0xa8d2('0x32')](_0x2439dc[_0xa8d2('0x31')]);_0x380022['filters']=_[_0xa8d2('0x33')](_0x380022[_0xa8d2('0x30')],_0x380022[_0xa8d2('0x31')]);_0x265edd[_0xa8d2('0x34')]=_[_0xa8d2('0x33')](_0x380022[_0xa8d2('0x30')],qs[_0xa8d2('0x35')](_0x2439dc[_0xa8d2('0x31')]['fields']));_0x265edd[_0xa8d2('0x34')]=_0x265edd[_0xa8d2('0x34')][_0xa8d2('0x36')]?_0x265edd[_0xa8d2('0x34')]:_0x380022[_0xa8d2('0x30')];if(!_0x2439dc[_0xa8d2('0x31')]['hasOwnProperty'](_0xa8d2('0x37'))){_0x265edd['limit']=qs[_0xa8d2('0x1c')](_0x2439dc[_0xa8d2('0x31')][_0xa8d2('0x1c')]);_0x265edd[_0xa8d2('0x1a')]=qs[_0xa8d2('0x1a')](_0x2439dc['query'][_0xa8d2('0x1a')]);}_0x265edd['order']=qs[_0xa8d2('0x38')](_0x2439dc[_0xa8d2('0x31')][_0xa8d2('0x38')]);_0x265edd[_0xa8d2('0x39')]=qs[_0xa8d2('0x3a')](_['pick'](_0x2439dc[_0xa8d2('0x31')],_0x380022[_0xa8d2('0x3a')]),_0x450a71);if(_0x2439dc[_0xa8d2('0x31')][_0xa8d2('0x3b')]){_0x265edd[_0xa8d2('0x39')]=_[_0xa8d2('0x3c')](_0x265edd['where'],{'$or':_['map'](_0x450a71,function(_0x8b028d){if(_0x8b028d[_0xa8d2('0x2e')]!==_0xa8d2('0x3d')){var _0x1874a9={};_0x1874a9[_0x8b028d[_0xa8d2('0x27')]]={'$like':'%'+_0x2439dc[_0xa8d2('0x31')]['filter']+'%'};return _0x1874a9;}})});}_0x265edd=_['merge']({},_0x265edd,_0x2439dc['options']);var _0x38d2d4={'where':_0x265edd['where']};return db[_0xa8d2('0x2b')][_0xa8d2('0x1d')](_0x38d2d4)['then'](function(_0x4a034a){_0x4059c8[_0xa8d2('0x1d')]=_0x4a034a;if(_0x2439dc[_0xa8d2('0x31')][_0xa8d2('0x3e')]){_0x265edd[_0xa8d2('0x3f')]=[{'all':!![]}];}return db[_0xa8d2('0x2b')][_0xa8d2('0x40')](_0x265edd);})['then'](function(_0x33e652){_0x4059c8[_0xa8d2('0x41')]=_0x33e652;return _0x4059c8;})[_0xa8d2('0x23')](respondWithFilteredResult(_0x437963,_0x265edd))[_0xa8d2('0x42')](handleError(_0x437963,null));};exports[_0xa8d2('0x43')]=function(_0x40b19d,_0x4b45ac){var _0x513368={'raw':!![],'where':{'id':_0x40b19d[_0xa8d2('0x44')]['id']}},_0x2822e5={};_0x2822e5[_0xa8d2('0x30')]=_['keys'](db[_0xa8d2('0x2b')][_0xa8d2('0x2c')]);_0x2822e5[_0xa8d2('0x31')]=_['keys'](_0x40b19d[_0xa8d2('0x31')]);_0x2822e5['filters']=_['intersection'](_0x2822e5['model'],_0x2822e5[_0xa8d2('0x31')]);_0x513368[_0xa8d2('0x34')]=_['intersection'](_0x2822e5[_0xa8d2('0x30')],qs[_0xa8d2('0x35')](_0x40b19d['query'][_0xa8d2('0x35')]));_0x513368[_0xa8d2('0x34')]=_0x513368['attributes'][_0xa8d2('0x36')]?_0x513368['attributes']:_0x2822e5[_0xa8d2('0x30')];if(_0x40b19d[_0xa8d2('0x31')][_0xa8d2('0x3e')]){_0x513368[_0xa8d2('0x3f')]=[{'all':!![]}];}_0x513368=_[_0xa8d2('0x3c')]({},_0x513368,_0x40b19d[_0xa8d2('0x45')]);return db[_0xa8d2('0x2b')][_0xa8d2('0x46')](_0x513368)[_0xa8d2('0x23')](handleEntityNotFound(_0x4b45ac,null))[_0xa8d2('0x23')](respondWithResult(_0x4b45ac,null))[_0xa8d2('0x42')](handleError(_0x4b45ac,null));};exports[_0xa8d2('0x47')]=function(_0x5779d4,_0x332197){return db['MailSubstatus'][_0xa8d2('0x47')](_0x5779d4[_0xa8d2('0x48')],{})['then'](respondWithResult(_0x332197,0xc9))[_0xa8d2('0x42')](handleError(_0x332197,null));};exports[_0xa8d2('0x22')]=function(_0xe45df6,_0xcb821d){if(_0xe45df6['body']['id']){delete _0xe45df6[_0xa8d2('0x48')]['id'];}return db[_0xa8d2('0x2b')][_0xa8d2('0x46')]({'where':{'id':_0xe45df6[_0xa8d2('0x44')]['id']}})[_0xa8d2('0x23')](handleEntityNotFound(_0xcb821d,null))[_0xa8d2('0x23')](saveUpdates(_0xe45df6[_0xa8d2('0x48')],null))['then'](respondWithResult(_0xcb821d,null))[_0xa8d2('0x42')](handleError(_0xcb821d,null));};exports[_0xa8d2('0x24')]=function(_0x1f0bc5,_0x52b197){return db[_0xa8d2('0x2b')]['find']({'where':{'id':_0x1f0bc5[_0xa8d2('0x44')]['id']}})['then'](handleEntityNotFound(_0x52b197,null))[_0xa8d2('0x23')](removeEntity(_0x52b197,null))[_0xa8d2('0x42')](handleError(_0x52b197,null));};exports[_0xa8d2('0x49')]=function(_0x16f9ba,_0x194bcb){return db['MailSubstatus'][_0xa8d2('0x49')]()[_0xa8d2('0x23')](respondWithResult(_0x194bcb,null))[_0xa8d2('0x42')](handleError(_0x194bcb,null));}; \ No newline at end of file +var _0x1b15=['../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','destroy','then','end','error','name','send','index','MailSubstatus','fieldName','type','key','model','map','query','intersection','attributes','fields','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','rows','catch','show','params','keys','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util'];(function(_0x10701a,_0x47d000){var _0x86de0b=function(_0x23b85c){while(--_0x23b85c){_0x10701a['push'](_0x10701a['shift']());}};_0x86de0b(++_0x47d000);}(_0x1b15,0x79));var _0x51b1=function(_0x283f0e,_0x121a56){_0x283f0e=_0x283f0e-0x0;var _0xebf915=_0x1b15[_0x283f0e];return _0xebf915;};'use strict';var emlformat=require(_0x51b1('0x0'));var rimraf=require(_0x51b1('0x1'));var zipdir=require(_0x51b1('0x2'));var jsonpatch=require(_0x51b1('0x3'));var rp=require(_0x51b1('0x4'));var moment=require(_0x51b1('0x5'));var BPromise=require(_0x51b1('0x6'));var Mustache=require('mustache');var util=require(_0x51b1('0x7'));var path=require(_0x51b1('0x8'));var sox=require('sox');var csv=require(_0x51b1('0x9'));var ejs=require(_0x51b1('0xa'));var fs=require('fs');var fs_extra=require(_0x51b1('0xb'));var _=require(_0x51b1('0xc'));var squel=require(_0x51b1('0xd'));var crypto=require('crypto');var jsforce=require(_0x51b1('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x51b1('0x9'));var querystring=require(_0x51b1('0xf'));var Papa=require(_0x51b1('0x10'));var Redis=require(_0x51b1('0x11'));var authService=require(_0x51b1('0x12'));var qs=require(_0x51b1('0x13'));var as=require(_0x51b1('0x14'));var hardwareService=require(_0x51b1('0x15'));var logger=require(_0x51b1('0x16'))('api');var utils=require(_0x51b1('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x51b1('0x18'));var db=require(_0x51b1('0x19'))['db'];function respondWithStatusCode(_0x1f5286,_0x2f9c72){_0x2f9c72=_0x2f9c72||0xcc;return function(_0x4b8069){if(_0x4b8069){return _0x1f5286[_0x51b1('0x1a')](_0x2f9c72);}return _0x1f5286[_0x51b1('0x1b')](_0x2f9c72)['end']();};}function respondWithResult(_0x24699e,_0x4e8903){_0x4e8903=_0x4e8903||0xc8;return function(_0x5cb333){if(_0x5cb333){return _0x24699e[_0x51b1('0x1b')](_0x4e8903)[_0x51b1('0x1c')](_0x5cb333);}};}function respondWithFilteredResult(_0x39ccb8,_0x5e7605){return function(_0x4c0a12){if(_0x4c0a12){var _0x213e2c=typeof _0x5e7605[_0x51b1('0x1d')]==='undefined'&&typeof _0x5e7605[_0x51b1('0x1e')]===_0x51b1('0x1f');var _0x2736d6=_0x4c0a12['count'];var _0xaee62a=_0x213e2c?0x0:_0x5e7605[_0x51b1('0x1d')];var _0x44d6d8=_0x213e2c?_0x4c0a12[_0x51b1('0x20')]:_0x5e7605[_0x51b1('0x1d')]+_0x5e7605[_0x51b1('0x1e')];var _0x1abdef;if(_0x44d6d8>=_0x2736d6){_0x44d6d8=_0x2736d6;_0x1abdef=0xc8;}else{_0x1abdef=0xce;}_0x39ccb8[_0x51b1('0x1b')](_0x1abdef);return _0x39ccb8['set'](_0x51b1('0x21'),_0xaee62a+'-'+_0x44d6d8+'/'+_0x2736d6)[_0x51b1('0x1c')](_0x4c0a12);}return null;};}function patchUpdates(_0x42dc6f){return function(_0x1271b6){try{jsonpatch[_0x51b1('0x22')](_0x1271b6,_0x42dc6f,!![]);}catch(_0x4e4d73){return BPromise[_0x51b1('0x23')](_0x4e4d73);}return _0x1271b6[_0x51b1('0x24')]();};}function saveUpdates(_0x4564aa,_0x55b399){return function(_0x11a01b){if(_0x11a01b){return _0x11a01b['update'](_0x4564aa)['then'](function(_0x4e4594){return _0x4e4594;});}return null;};}function removeEntity(_0x269883,_0x16ce9b){return function(_0xf1fcb4){if(_0xf1fcb4){return _0xf1fcb4[_0x51b1('0x25')]()[_0x51b1('0x26')](function(){_0x269883['status'](0xcc)[_0x51b1('0x27')]();});}};}function handleEntityNotFound(_0x2b62ae,_0x11e72f){return function(_0x35f663){if(!_0x35f663){_0x2b62ae[_0x51b1('0x1a')](0x194);}return _0x35f663;};}function handleError(_0x14593a,_0xf811e5){_0xf811e5=_0xf811e5||0x1f4;return function(_0x2ef001){logger[_0x51b1('0x28')](_0x2ef001['stack']);if(_0x2ef001['name']){delete _0x2ef001[_0x51b1('0x29')];}_0x14593a[_0x51b1('0x1b')](_0xf811e5)[_0x51b1('0x2a')](_0x2ef001);};}exports[_0x51b1('0x2b')]=function(_0x116630,_0x1b2f61){var _0x4da28f={},_0x1c495f={},_0x7920c0={'count':0x0,'rows':[]};var _0x3e771c=_['map'](db[_0x51b1('0x2c')]['rawAttributes'],function(_0x5da481){return{'name':_0x5da481[_0x51b1('0x2d')],'type':_0x5da481[_0x51b1('0x2e')][_0x51b1('0x2f')]};});_0x1c495f[_0x51b1('0x30')]=_[_0x51b1('0x31')](_0x3e771c,_0x51b1('0x29'));_0x1c495f['query']=_['keys'](_0x116630[_0x51b1('0x32')]);_0x1c495f['filters']=_[_0x51b1('0x33')](_0x1c495f[_0x51b1('0x30')],_0x1c495f[_0x51b1('0x32')]);_0x4da28f[_0x51b1('0x34')]=_[_0x51b1('0x33')](_0x1c495f[_0x51b1('0x30')],qs[_0x51b1('0x35')](_0x116630[_0x51b1('0x32')][_0x51b1('0x35')]));_0x4da28f['attributes']=_0x4da28f[_0x51b1('0x34')]['length']?_0x4da28f['attributes']:_0x1c495f['model'];if(!_0x116630[_0x51b1('0x32')]['hasOwnProperty'](_0x51b1('0x36'))){_0x4da28f[_0x51b1('0x1e')]=qs[_0x51b1('0x1e')](_0x116630[_0x51b1('0x32')][_0x51b1('0x1e')]);_0x4da28f[_0x51b1('0x1d')]=qs[_0x51b1('0x1d')](_0x116630[_0x51b1('0x32')][_0x51b1('0x1d')]);}_0x4da28f[_0x51b1('0x37')]=qs[_0x51b1('0x38')](_0x116630[_0x51b1('0x32')][_0x51b1('0x38')]);_0x4da28f[_0x51b1('0x39')]=qs[_0x51b1('0x3a')](_[_0x51b1('0x3b')](_0x116630['query'],_0x1c495f['filters']),_0x3e771c);if(_0x116630['query'][_0x51b1('0x3c')]){_0x4da28f[_0x51b1('0x39')]=_['merge'](_0x4da28f[_0x51b1('0x39')],{'$or':_[_0x51b1('0x31')](_0x3e771c,function(_0x3a770a){if(_0x3a770a['type']!=='VIRTUAL'){var _0x33659f={};_0x33659f[_0x3a770a[_0x51b1('0x29')]]={'$like':'%'+_0x116630[_0x51b1('0x32')][_0x51b1('0x3c')]+'%'};return _0x33659f;}})});}_0x4da28f=_[_0x51b1('0x3d')]({},_0x4da28f,_0x116630[_0x51b1('0x3e')]);var _0x29ec92={'where':_0x4da28f[_0x51b1('0x39')]};return db[_0x51b1('0x2c')][_0x51b1('0x20')](_0x29ec92)[_0x51b1('0x26')](function(_0x37744d){_0x7920c0[_0x51b1('0x20')]=_0x37744d;if(_0x116630[_0x51b1('0x32')][_0x51b1('0x3f')]){_0x4da28f['include']=[{'all':!![]}];}return db[_0x51b1('0x2c')]['findAll'](_0x4da28f);})['then'](function(_0x223df8){_0x7920c0[_0x51b1('0x40')]=_0x223df8;return _0x7920c0;})[_0x51b1('0x26')](respondWithFilteredResult(_0x1b2f61,_0x4da28f))[_0x51b1('0x41')](handleError(_0x1b2f61,null));};exports[_0x51b1('0x42')]=function(_0x404873,_0x22a45c){var _0x250a8a={'raw':!![],'where':{'id':_0x404873[_0x51b1('0x43')]['id']}},_0x136fef={};_0x136fef[_0x51b1('0x30')]=_[_0x51b1('0x44')](db[_0x51b1('0x2c')]['rawAttributes']);_0x136fef[_0x51b1('0x32')]=_[_0x51b1('0x44')](_0x404873[_0x51b1('0x32')]);_0x136fef['filters']=_[_0x51b1('0x33')](_0x136fef[_0x51b1('0x30')],_0x136fef['query']);_0x250a8a[_0x51b1('0x34')]=_['intersection'](_0x136fef['model'],qs[_0x51b1('0x35')](_0x404873[_0x51b1('0x32')][_0x51b1('0x35')]));_0x250a8a[_0x51b1('0x34')]=_0x250a8a['attributes']['length']?_0x250a8a[_0x51b1('0x34')]:_0x136fef[_0x51b1('0x30')];if(_0x404873[_0x51b1('0x32')][_0x51b1('0x3f')]){_0x250a8a['include']=[{'all':!![]}];}_0x250a8a=_[_0x51b1('0x3d')]({},_0x250a8a,_0x404873['options']);return db[_0x51b1('0x2c')][_0x51b1('0x45')](_0x250a8a)[_0x51b1('0x26')](handleEntityNotFound(_0x22a45c,null))['then'](respondWithResult(_0x22a45c,null))[_0x51b1('0x41')](handleError(_0x22a45c,null));};exports[_0x51b1('0x46')]=function(_0x27d1f5,_0x4e959f){return db[_0x51b1('0x2c')]['create'](_0x27d1f5['body'],{})[_0x51b1('0x26')](respondWithResult(_0x4e959f,0xc9))['catch'](handleError(_0x4e959f,null));};exports['update']=function(_0x136858,_0x392664){if(_0x136858[_0x51b1('0x47')]['id']){delete _0x136858[_0x51b1('0x47')]['id'];}return db['MailSubstatus'][_0x51b1('0x45')]({'where':{'id':_0x136858[_0x51b1('0x43')]['id']}})['then'](handleEntityNotFound(_0x392664,null))[_0x51b1('0x26')](saveUpdates(_0x136858[_0x51b1('0x47')],null))[_0x51b1('0x26')](respondWithResult(_0x392664,null))[_0x51b1('0x41')](handleError(_0x392664,null));};exports[_0x51b1('0x25')]=function(_0x2d922f,_0x4e2efb){return db[_0x51b1('0x2c')]['find']({'where':{'id':_0x2d922f['params']['id']}})[_0x51b1('0x26')](handleEntityNotFound(_0x4e2efb,null))['then'](removeEntity(_0x4e2efb,null))[_0x51b1('0x41')](handleError(_0x4e2efb,null));};exports[_0x51b1('0x48')]=function(_0x19e1cd,_0x2331e1){return db['MailSubstatus'][_0x51b1('0x48')]()[_0x51b1('0x26')](respondWithResult(_0x2331e1,null))['catch'](handleError(_0x2331e1,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index 27eefcf..6626868 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 _0x101c=['MailSubstatus','setMaxListeners','update','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x2b7389,_0x478af5){var _0x581223=function(_0x2afb34){while(--_0x2afb34){_0x2b7389['push'](_0x2b7389['shift']());}};_0x581223(++_0x478af5);}(_0x101c,0x66));var _0xc101=function(_0x210d7f,_0x2abe4f){_0x210d7f=_0x210d7f-0x0;var _0x42d687=_0x101c[_0x210d7f];return _0x42d687;};'use strict';var EventEmitter=require(_0xc101('0x0'));var MailSubstatus=require(_0xc101('0x1'))['db'][_0xc101('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0xc101('0x3')](0x0);var events={'afterUpdate':_0xc101('0x4')};function emitEvent(_0x3b505f){return function(_0x9c4c2c,_0x3e6011,_0x5cdf41){MailSubstatusEvents['emit'](_0x3b505f+':'+_0x9c4c2c['id'],_0x9c4c2c);MailSubstatusEvents['emit'](_0x3b505f,_0x9c4c2c);_0x5cdf41(null);};}for(var e in events){if(events[_0xc101('0x5')](e)){var event=events[e];MailSubstatus[_0xc101('0x6')](e,emitEvent(event));}}module[_0xc101('0x7')]=MailSubstatusEvents; \ No newline at end of file +var _0x676e=['emit','hook','exports','events','../../mysqldb','setMaxListeners','update'];(function(_0x16b95b,_0x50ce0c){var _0x3b420f=function(_0x495b3e){while(--_0x495b3e){_0x16b95b['push'](_0x16b95b['shift']());}};_0x3b420f(++_0x50ce0c);}(_0x676e,0x81));var _0xe676=function(_0x422ac3,_0x48bbd4){_0x422ac3=_0x422ac3-0x0;var _0x53c0d4=_0x676e[_0x422ac3];return _0x53c0d4;};'use strict';var EventEmitter=require(_0xe676('0x0'));var MailSubstatus=require(_0xe676('0x1'))['db']['MailSubstatus'];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0xe676('0x2')](0x0);var events={'afterUpdate':_0xe676('0x3')};function emitEvent(_0x1163a2){return function(_0x2bd924,_0x4abb74,_0x15b551){MailSubstatusEvents[_0xe676('0x4')](_0x1163a2+':'+_0x2bd924['id'],_0x2bd924);MailSubstatusEvents[_0xe676('0x4')](_0x1163a2,_0x2bd924);_0x15b551(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailSubstatus[_0xe676('0x5')](e,emitEvent(event));}}module[_0xe676('0x6')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index a94c0a9..717b285 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 _0xa264=['define','MailSubstatus','mail_substatuses','Condition','update','name','mailSubstatus','_previousDataValues','then','./mailSubstatus.attributes','models'];(function(_0x18d55e,_0x3aad08){var _0x22f977=function(_0x27d445){while(--_0x27d445){_0x18d55e['push'](_0x18d55e['shift']());}};_0x22f977(++_0x3aad08);}(_0xa264,0x148));var _0x4a26=function(_0x30033a,_0x5ce4a6){_0x30033a=_0x30033a-0x0;var _0x5e3518=_0xa264[_0x30033a];return _0x5e3518;};'use strict';var attributes=require(_0x4a26('0x0'));module['exports']=function(_0x3b356c){var _0xaffb93=_0x3b356c[_0x4a26('0x1')];return _0x3b356c[_0x4a26('0x2')](_0x4a26('0x3'),attributes,{'tableName':_0x4a26('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x511409,_0x9084fe,_0x17d652){return _0xaffb93[_0x4a26('0x5')][_0x4a26('0x6')]({'value':_0x511409[_0x4a26('0x7')]},{'where':{'field':_0x4a26('0x8'),'value':_0x511409[_0x4a26('0x9')]['name']}})[_0x4a26('0xa')](function(){_0x17d652();})['catch'](function(_0xca5fa8){_0x17d652(_0xca5fa8);});}}});}; \ No newline at end of file +var _0xc558=['catch','define','mail_substatuses','Condition','mailSubstatus','_previousDataValues','name','then'];(function(_0x284a61,_0x231686){var _0x220e3c=function(_0x104496){while(--_0x104496){_0x284a61['push'](_0x284a61['shift']());}};_0x220e3c(++_0x231686);}(_0xc558,0x79));var _0x8c55=function(_0x1b7364,_0x3aa902){_0x1b7364=_0x1b7364-0x0;var _0x586343=_0xc558[_0x1b7364];return _0x586343;};'use strict';var attributes=require('./mailSubstatus.attributes');module['exports']=function(_0x4c75ed){var _0x1b2c3d=_0x4c75ed['models'];return _0x4c75ed[_0x8c55('0x0')]('MailSubstatus',attributes,{'tableName':_0x8c55('0x1'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x3a2aea,_0x59d5b2,_0xd5a0f3){return _0x1b2c3d[_0x8c55('0x2')]['update']({'value':_0x3a2aea['name']},{'where':{'field':_0x8c55('0x3'),'value':_0x3a2aea[_0x8c55('0x4')][_0x8c55('0x5')]}})[_0x8c55('0x6')](function(){_0xd5a0f3();})[_0x8c55('0x7')](function(_0x316899){_0xd5a0f3(_0x316899);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 4367fb0..ad919ed 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 _0x548b=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','error','code','MailSubstatus,\x20%s,\x20%s','message','result','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x548b,0x14f));var _0xb548=function(_0x203cfe,_0x5064b1){_0x203cfe=_0x203cfe-0x0;var _0x5ae83e=_0x548b[_0x203cfe];return _0x5ae83e;};'use strict';var _=require(_0xb548('0x0'));var util=require('util');var moment=require(_0xb548('0x1'));var BPromise=require(_0xb548('0x2'));var rs=require(_0xb548('0x3'));var fs=require('fs');var Redis=require(_0xb548('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb548('0x5'))(_0xb548('0x6'));var config=require(_0xb548('0x7'));var jayson=require(_0xb548('0x8'));var client=jayson[_0xb548('0x9')][_0xb548('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x19b4bd,_0x235ca8,_0x37eac1){return new BPromise(function(_0x1aee82,_0x3b0a54){return client['request'](_0x19b4bd,_0x37eac1)[_0xb548('0xb')](function(_0x1e9a75){logger[_0xb548('0xc')]('MailSubstatus,\x20%s,\x20%s',_0x235ca8,_0xb548('0xd'));logger[_0xb548('0xe')]('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x235ca8,'request\x20sent',JSON['stringify'](_0x1e9a75));if(_0x1e9a75[_0xb548('0xf')]){if(_0x1e9a75[_0xb548('0xf')][_0xb548('0x10')]===0x1f4){logger['error'](_0xb548('0x11'),_0x235ca8,_0x1e9a75[_0xb548('0xf')]['message']);return _0x3b0a54(_0x1e9a75[_0xb548('0xf')][_0xb548('0x12')]);}logger[_0xb548('0xf')]('MailSubstatus,\x20%s,\x20%s',_0x235ca8,_0x1e9a75[_0xb548('0xf')][_0xb548('0x12')]);return _0x1aee82(_0x1e9a75[_0xb548('0xf')][_0xb548('0x12')]);}else{logger[_0xb548('0xc')]('MailSubstatus,\x20%s,\x20%s',_0x235ca8,'request\x20sent');_0x1aee82(_0x1e9a75[_0xb548('0x13')]['message']);}})['catch'](function(_0x48c6f4){logger[_0xb548('0xf')]('MailSubstatus,\x20%s,\x20%s',_0x235ca8,_0x48c6f4);_0x3b0a54(_0x48c6f4);});});} \ No newline at end of file +var _0x64c4=['http','request','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x64c4,0x13a));var _0x464c=function(_0x2835a9,_0x3699db){_0x2835a9=_0x2835a9-0x0;var _0x4e0f04=_0x64c4[_0x2835a9];return _0x4e0f04;};'use strict';var _=require('lodash');var util=require(_0x464c('0x0'));var moment=require('moment');var BPromise=require(_0x464c('0x1'));var rs=require(_0x464c('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x464c('0x3'))['db'];var utils=require(_0x464c('0x4'));var logger=require(_0x464c('0x5'))('rpc');var config=require(_0x464c('0x6'));var jayson=require(_0x464c('0x7'));var client=jayson[_0x464c('0x8')][_0x464c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xd8590a,_0x4c8894,_0x45c02e){return new BPromise(function(_0x2ccd7d,_0x1917bb){return client[_0x464c('0xa')](_0xd8590a,_0x45c02e)['then'](function(_0xab1303){logger[_0x464c('0xb')](_0x464c('0xc'),_0x4c8894,_0x464c('0xd'));logger[_0x464c('0xe')]('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x4c8894,_0x464c('0xd'),JSON['stringify'](_0xab1303));if(_0xab1303[_0x464c('0xf')]){if(_0xab1303[_0x464c('0xf')][_0x464c('0x10')]===0x1f4){logger['error']('MailSubstatus,\x20%s,\x20%s',_0x4c8894,_0xab1303['error'][_0x464c('0x11')]);return _0x1917bb(_0xab1303[_0x464c('0xf')]['message']);}logger[_0x464c('0xf')](_0x464c('0xc'),_0x4c8894,_0xab1303[_0x464c('0xf')][_0x464c('0x11')]);return _0x2ccd7d(_0xab1303['error']['message']);}else{logger[_0x464c('0xb')](_0x464c('0xc'),_0x4c8894,_0x464c('0xd'));_0x2ccd7d(_0xab1303['result']['message']);}})[_0x464c('0x12')](function(_0x264e69){logger[_0x464c('0xf')](_0x464c('0xc'),_0x4c8894,_0x264e69);_0x1917bb(_0x264e69);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 90a8b29..52ff1af 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 _0xdc91=['get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update','delete','destroy','exports','path','connect-timeout','express','../../components/auth/service','./mailTransferReport.controller'];(function(_0x12c8bd,_0x2110d0){var _0x2d5faf=function(_0x19434e){while(--_0x19434e){_0x12c8bd['push'](_0x12c8bd['shift']());}};_0x2d5faf(++_0x2110d0);}(_0xdc91,0x109));var _0x1dc9=function(_0x15117c,_0x1a6b3d){_0x15117c=_0x15117c-0x0;var _0x28a74f=_0xdc91[_0x15117c];return _0x28a74f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1dc9('0x0'));var timeout=require(_0x1dc9('0x1'));var express=require(_0x1dc9('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x1dc9('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1dc9('0x4'));router[_0x1dc9('0x5')]('/',auth[_0x1dc9('0x6')](),controller[_0x1dc9('0x7')]);router['get'](_0x1dc9('0x8'),auth[_0x1dc9('0x6')](),controller[_0x1dc9('0x9')]);router[_0x1dc9('0x5')](_0x1dc9('0xa'),auth['isAuthenticated'](),controller[_0x1dc9('0xb')]);router['post']('/',auth[_0x1dc9('0x6')](),controller[_0x1dc9('0xc')]);router[_0x1dc9('0xd')]('/:id',auth[_0x1dc9('0x6')](),controller[_0x1dc9('0xe')]);router[_0x1dc9('0xf')](_0x1dc9('0xa'),auth[_0x1dc9('0x6')](),controller[_0x1dc9('0x10')]);module[_0x1dc9('0x11')]=router; \ No newline at end of file +var _0x9a62=['delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./mailTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','update'];(function(_0x295898,_0x1c7f30){var _0x922943=function(_0x35cbe2){while(--_0x35cbe2){_0x295898['push'](_0x295898['shift']());}};_0x922943(++_0x1c7f30);}(_0x9a62,0x16c));var _0x29a6=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x9a62[_0x4a9fb1];return _0x348672;};'use strict';var multer=require(_0x29a6('0x0'));var util=require(_0x29a6('0x1'));var path=require(_0x29a6('0x2'));var timeout=require(_0x29a6('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x29a6('0x4'));var auth=require(_0x29a6('0x5'));var interaction=require(_0x29a6('0x6'));var config=require('../../config/environment');var controller=require(_0x29a6('0x7'));router[_0x29a6('0x8')]('/',auth[_0x29a6('0x9')](),controller[_0x29a6('0xa')]);router['get'](_0x29a6('0xb'),auth[_0x29a6('0x9')](),controller[_0x29a6('0xc')]);router[_0x29a6('0x8')](_0x29a6('0xd'),auth[_0x29a6('0x9')](),controller[_0x29a6('0xe')]);router['post']('/',auth[_0x29a6('0x9')](),controller['create']);router['put'](_0x29a6('0xd'),auth['isAuthenticated'](),controller[_0x29a6('0xf')]);router[_0x29a6('0x10')](_0x29a6('0xd'),auth[_0x29a6('0x9')](),controller[_0x29a6('0x11')]);module[_0x29a6('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 164cadf..8125e23 100644 --- a/server/api/mailTransferReport/mailTransferReport.attributes.js +++ b/server/api/mailTransferReport/mailTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0x9bde,0xe1));var _0xe9bd=function(_0x2c36ac,_0x246f01){_0x2c36ac=_0x2c36ac-0x0;var _0x29503e=_0x9bde[_0x2c36ac];return _0x29503e;};'use strict';var moment=require('moment');var Sequelize=require(_0xe9bd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe9bd('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe9bd('0x2'),_0xe9bd('0x3'),_0xe9bd('0x4')),'allowNull':![],'defaultValue':_0xe9bd('0x4')},'transferredAt':{'type':Sequelize[_0xe9bd('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xe9bd('0x6')]}}; \ No newline at end of file +var _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x1d7ca4,_0x1cd3cf){var _0x56e7f6=function(_0x47dbd3){while(--_0x47dbd3){_0x1d7ca4['push'](_0x1d7ca4['shift']());}};_0x56e7f6(++_0x1cd3cf);}(_0xf4eb,0xec));var _0xbf4e=function(_0xdc8a6,_0xf71c8c){_0xdc8a6=_0xdc8a6-0x0;var _0x5dced5=_0xf4eb[_0xdc8a6];return _0x5dced5;};'use strict';var moment=require(_0xbf4e('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbf4e('0x1'),'agent','queue'),'allowNull':![],'defaultValue':_0xbf4e('0x2')},'transferredAt':{'type':Sequelize[_0xbf4e('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xbf4e('0x4')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 4c6c959..5191f06 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 _0x2980=['fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','MailTransferReport','includeAll','findAll','rows','catch','params','include','find','create','body','update','describe','eml-format','zip-dir','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','json','offset','undefined','count','limit','status','set','apply','reject','then','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes'];(function(_0x590ed3,_0x4e3dcf){var _0x474362=function(_0x52db58){while(--_0x52db58){_0x590ed3['push'](_0x590ed3['shift']());}};_0x474362(++_0x4e3dcf);}(_0x2980,0x189));var _0x0298=function(_0x1b9a73,_0x5654b1){_0x1b9a73=_0x1b9a73-0x0;var _0x2f7a25=_0x2980[_0x1b9a73];return _0x2f7a25;};'use strict';var emlformat=require(_0x0298('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0298('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0298('0x2'));var BPromise=require(_0x0298('0x3'));var Mustache=require('mustache');var util=require(_0x0298('0x4'));var path=require(_0x0298('0x5'));var sox=require(_0x0298('0x6'));var csv=require(_0x0298('0x7'));var ejs=require(_0x0298('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0298('0x9'));var squel=require(_0x0298('0xa'));var crypto=require(_0x0298('0xb'));var jsforce=require(_0x0298('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x0298('0x7'));var querystring=require('querystring');var Papa=require(_0x0298('0xd'));var Redis=require(_0x0298('0xe'));var authService=require(_0x0298('0xf'));var qs=require(_0x0298('0x10'));var as=require(_0x0298('0x11'));var hardwareService=require(_0x0298('0x12'));var logger=require(_0x0298('0x13'))(_0x0298('0x14'));var utils=require(_0x0298('0x15'));var config=require(_0x0298('0x16'));var licenseUtil=require(_0x0298('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3b2bc3,_0xd5cc0a){_0xd5cc0a=_0xd5cc0a||0xcc;return function(_0x119c5c){if(_0x119c5c){return _0x3b2bc3[_0x0298('0x18')](_0xd5cc0a);}return _0x3b2bc3['status'](_0xd5cc0a)[_0x0298('0x19')]();};}function respondWithResult(_0x49ba9c,_0x417a81){_0x417a81=_0x417a81||0xc8;return function(_0x1230cf){if(_0x1230cf){return _0x49ba9c['status'](_0x417a81)[_0x0298('0x1a')](_0x1230cf);}};}function respondWithFilteredResult(_0xa37095,_0x26ff4e){return function(_0x3dd0f8){if(_0x3dd0f8){var _0x45bc24=typeof _0x26ff4e[_0x0298('0x1b')]===_0x0298('0x1c')&&typeof _0x26ff4e['limit']===_0x0298('0x1c');var _0x463954=_0x3dd0f8[_0x0298('0x1d')];var _0x4c2dc0=_0x45bc24?0x0:_0x26ff4e['offset'];var _0x71cf18=_0x45bc24?_0x3dd0f8[_0x0298('0x1d')]:_0x26ff4e[_0x0298('0x1b')]+_0x26ff4e[_0x0298('0x1e')];var _0x3af4fc;if(_0x71cf18>=_0x463954){_0x71cf18=_0x463954;_0x3af4fc=0xc8;}else{_0x3af4fc=0xce;}_0xa37095[_0x0298('0x1f')](_0x3af4fc);return _0xa37095[_0x0298('0x20')]('Content-Range',_0x4c2dc0+'-'+_0x71cf18+'/'+_0x463954)[_0x0298('0x1a')](_0x3dd0f8);}return null;};}function patchUpdates(_0x5371ab){return function(_0xc73064){try{jsonpatch[_0x0298('0x21')](_0xc73064,_0x5371ab,!![]);}catch(_0x3bb85c){return BPromise[_0x0298('0x22')](_0x3bb85c);}return _0xc73064['save']();};}function saveUpdates(_0x2b6ff1,_0xd8062e){return function(_0x231d4f){if(_0x231d4f){return _0x231d4f['update'](_0x2b6ff1)['then'](function(_0x5eb63e){return _0x5eb63e;});}return null;};}function removeEntity(_0x56f07a,_0x45b3f9){return function(_0x29c70b){if(_0x29c70b){return _0x29c70b['destroy']()[_0x0298('0x23')](function(){_0x56f07a[_0x0298('0x1f')](0xcc)[_0x0298('0x19')]();});}};}function handleEntityNotFound(_0x301f5c,_0x209f77){return function(_0x27654c){if(!_0x27654c){_0x301f5c[_0x0298('0x18')](0x194);}return _0x27654c;};}function handleError(_0x98886d,_0x7eb7ef){_0x7eb7ef=_0x7eb7ef||0x1f4;return function(_0x37b99b){logger[_0x0298('0x24')](_0x37b99b['stack']);if(_0x37b99b[_0x0298('0x25')]){delete _0x37b99b[_0x0298('0x25')];}_0x98886d[_0x0298('0x1f')](_0x7eb7ef)[_0x0298('0x26')](_0x37b99b);};}exports[_0x0298('0x27')]=function(_0x24e00f,_0x492141){var _0x5c286f={},_0x3370c0={},_0x5eb133={'count':0x0,'rows':[]};var _0x48c371=_[_0x0298('0x28')](db['MailTransferReport'][_0x0298('0x29')],function(_0x5daa57){return{'name':_0x5daa57[_0x0298('0x2a')],'type':_0x5daa57[_0x0298('0x2b')][_0x0298('0x2c')]};});_0x3370c0[_0x0298('0x2d')]=_[_0x0298('0x28')](_0x48c371,_0x0298('0x25'));_0x3370c0[_0x0298('0x2e')]=_[_0x0298('0x2f')](_0x24e00f[_0x0298('0x2e')]);_0x3370c0[_0x0298('0x30')]=_[_0x0298('0x31')](_0x3370c0['model'],_0x3370c0[_0x0298('0x2e')]);_0x5c286f[_0x0298('0x32')]=_['intersection'](_0x3370c0[_0x0298('0x2d')],qs[_0x0298('0x33')](_0x24e00f[_0x0298('0x2e')][_0x0298('0x33')]));_0x5c286f[_0x0298('0x32')]=_0x5c286f[_0x0298('0x32')][_0x0298('0x34')]?_0x5c286f[_0x0298('0x32')]:_0x3370c0[_0x0298('0x2d')];if(!_0x24e00f[_0x0298('0x2e')][_0x0298('0x35')](_0x0298('0x36'))){_0x5c286f[_0x0298('0x1e')]=qs[_0x0298('0x1e')](_0x24e00f[_0x0298('0x2e')][_0x0298('0x1e')]);_0x5c286f['offset']=qs['offset'](_0x24e00f[_0x0298('0x2e')][_0x0298('0x1b')]);}_0x5c286f[_0x0298('0x37')]=qs[_0x0298('0x38')](_0x24e00f[_0x0298('0x2e')][_0x0298('0x38')]);_0x5c286f[_0x0298('0x39')]=qs['filters'](_[_0x0298('0x3a')](_0x24e00f[_0x0298('0x2e')],_0x3370c0[_0x0298('0x30')]),_0x48c371);if(_0x24e00f[_0x0298('0x2e')][_0x0298('0x3b')]){_0x5c286f[_0x0298('0x39')]=_[_0x0298('0x3c')](_0x5c286f['where'],{'$or':_[_0x0298('0x28')](_0x48c371,function(_0x4e24a3){if(_0x4e24a3[_0x0298('0x2b')]!=='VIRTUAL'){var _0x2f39b7={};_0x2f39b7[_0x4e24a3[_0x0298('0x25')]]={'$like':'%'+_0x24e00f[_0x0298('0x2e')]['filter']+'%'};return _0x2f39b7;}})});}_0x5c286f=_[_0x0298('0x3c')]({},_0x5c286f,_0x24e00f[_0x0298('0x3d')]);var _0x222494={'where':_0x5c286f[_0x0298('0x39')]};return db[_0x0298('0x3e')][_0x0298('0x1d')](_0x222494)[_0x0298('0x23')](function(_0x113142){_0x5eb133[_0x0298('0x1d')]=_0x113142;if(_0x24e00f['query'][_0x0298('0x3f')]){_0x5c286f['include']=[{'all':!![]}];}return db[_0x0298('0x3e')][_0x0298('0x40')](_0x5c286f);})[_0x0298('0x23')](function(_0x3b54de){_0x5eb133[_0x0298('0x41')]=_0x3b54de;return _0x5eb133;})[_0x0298('0x23')](respondWithFilteredResult(_0x492141,_0x5c286f))[_0x0298('0x42')](handleError(_0x492141,null));};exports['show']=function(_0x1c859c,_0x39ee9b){var _0x35d343={'raw':!![],'where':{'id':_0x1c859c[_0x0298('0x43')]['id']}},_0x1f706b={};_0x1f706b[_0x0298('0x2d')]=_['keys'](db['MailTransferReport']['rawAttributes']);_0x1f706b[_0x0298('0x2e')]=_[_0x0298('0x2f')](_0x1c859c[_0x0298('0x2e')]);_0x1f706b[_0x0298('0x30')]=_['intersection'](_0x1f706b[_0x0298('0x2d')],_0x1f706b[_0x0298('0x2e')]);_0x35d343[_0x0298('0x32')]=_[_0x0298('0x31')](_0x1f706b['model'],qs[_0x0298('0x33')](_0x1c859c[_0x0298('0x2e')][_0x0298('0x33')]));_0x35d343[_0x0298('0x32')]=_0x35d343[_0x0298('0x32')]['length']?_0x35d343['attributes']:_0x1f706b[_0x0298('0x2d')];if(_0x1c859c['query'][_0x0298('0x3f')]){_0x35d343[_0x0298('0x44')]=[{'all':!![]}];}_0x35d343=_[_0x0298('0x3c')]({},_0x35d343,_0x1c859c['options']);return db[_0x0298('0x3e')][_0x0298('0x45')](_0x35d343)[_0x0298('0x23')](handleEntityNotFound(_0x39ee9b,null))['then'](respondWithResult(_0x39ee9b,null))['catch'](handleError(_0x39ee9b,null));};exports[_0x0298('0x46')]=function(_0x339e19,_0x13dd05){return db[_0x0298('0x3e')][_0x0298('0x46')](_0x339e19[_0x0298('0x47')],{})[_0x0298('0x23')](respondWithResult(_0x13dd05,0xc9))[_0x0298('0x42')](handleError(_0x13dd05,null));};exports[_0x0298('0x48')]=function(_0x3ba8ee,_0x46735a){if(_0x3ba8ee[_0x0298('0x47')]['id']){delete _0x3ba8ee[_0x0298('0x47')]['id'];}return db[_0x0298('0x3e')][_0x0298('0x45')]({'where':{'id':_0x3ba8ee[_0x0298('0x43')]['id']}})[_0x0298('0x23')](handleEntityNotFound(_0x46735a,null))[_0x0298('0x23')](saveUpdates(_0x3ba8ee[_0x0298('0x47')],null))['then'](respondWithResult(_0x46735a,null))[_0x0298('0x42')](handleError(_0x46735a,null));};exports['destroy']=function(_0x12d527,_0x1ad2cf){return db[_0x0298('0x3e')]['find']({'where':{'id':_0x12d527[_0x0298('0x43')]['id']}})[_0x0298('0x23')](handleEntityNotFound(_0x1ad2cf,null))['then'](removeEntity(_0x1ad2cf,null))[_0x0298('0x42')](handleError(_0x1ad2cf,null));};exports['describe']=function(_0x50a6d2,_0x3f7a50){return db[_0x0298('0x3e')][_0x0298('0x49')]()[_0x0298('0x23')](respondWithResult(_0x3f7a50,null))['catch'](handleError(_0x3f7a50,null));}; \ No newline at end of file +var _0x0d4d=['then','destroy','sendStatus','error','stack','name','index','map','MailTransferReport','rawAttributes','fieldName','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','create','body','params','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update'];(function(_0x525dca,_0x28762d){var _0x4b6db0=function(_0x2f3987){while(--_0x2f3987){_0x525dca['push'](_0x525dca['shift']());}};_0x4b6db0(++_0x28762d);}(_0x0d4d,0x1ef));var _0xd0d4=function(_0x4f05db,_0x245564){_0x4f05db=_0x4f05db-0x0;var _0xf23b25=_0x0d4d[_0x4f05db];return _0xf23b25;};'use strict';var emlformat=require(_0xd0d4('0x0'));var rimraf=require(_0xd0d4('0x1'));var zipdir=require(_0xd0d4('0x2'));var jsonpatch=require(_0xd0d4('0x3'));var rp=require(_0xd0d4('0x4'));var moment=require(_0xd0d4('0x5'));var BPromise=require(_0xd0d4('0x6'));var Mustache=require(_0xd0d4('0x7'));var util=require(_0xd0d4('0x8'));var path=require(_0xd0d4('0x9'));var sox=require(_0xd0d4('0xa'));var csv=require(_0xd0d4('0xb'));var ejs=require(_0xd0d4('0xc'));var fs=require('fs');var fs_extra=require(_0xd0d4('0xd'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xd0d4('0xe'));var jsforce=require(_0xd0d4('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xd0d4('0xb'));var querystring=require(_0xd0d4('0x10'));var Papa=require('papaparse');var Redis=require(_0xd0d4('0x11'));var authService=require(_0xd0d4('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd0d4('0x13'))(_0xd0d4('0x14'));var utils=require(_0xd0d4('0x15'));var config=require(_0xd0d4('0x16'));var licenseUtil=require(_0xd0d4('0x17'));var db=require(_0xd0d4('0x18'))['db'];function respondWithStatusCode(_0x6b61e4,_0x3644b3){_0x3644b3=_0x3644b3||0xcc;return function(_0x2d724f){if(_0x2d724f){return _0x6b61e4['sendStatus'](_0x3644b3);}return _0x6b61e4['status'](_0x3644b3)[_0xd0d4('0x19')]();};}function respondWithResult(_0x2512a6,_0x57c59e){_0x57c59e=_0x57c59e||0xc8;return function(_0x357463){if(_0x357463){return _0x2512a6[_0xd0d4('0x1a')](_0x57c59e)['json'](_0x357463);}};}function respondWithFilteredResult(_0x3c23d0,_0x55259c){return function(_0xcb6641){if(_0xcb6641){var _0x1ba8b5=typeof _0x55259c[_0xd0d4('0x1b')]===_0xd0d4('0x1c')&&typeof _0x55259c[_0xd0d4('0x1d')]===_0xd0d4('0x1c');var _0x3bef12=_0xcb6641[_0xd0d4('0x1e')];var _0x5eef89=_0x1ba8b5?0x0:_0x55259c[_0xd0d4('0x1b')];var _0x3f7280=_0x1ba8b5?_0xcb6641[_0xd0d4('0x1e')]:_0x55259c[_0xd0d4('0x1b')]+_0x55259c[_0xd0d4('0x1d')];var _0x250717;if(_0x3f7280>=_0x3bef12){_0x3f7280=_0x3bef12;_0x250717=0xc8;}else{_0x250717=0xce;}_0x3c23d0[_0xd0d4('0x1a')](_0x250717);return _0x3c23d0['set'](_0xd0d4('0x1f'),_0x5eef89+'-'+_0x3f7280+'/'+_0x3bef12)[_0xd0d4('0x20')](_0xcb6641);}return null;};}function patchUpdates(_0x4a6ed8){return function(_0x56c9c4){try{jsonpatch[_0xd0d4('0x21')](_0x56c9c4,_0x4a6ed8,!![]);}catch(_0x976ed){return BPromise[_0xd0d4('0x22')](_0x976ed);}return _0x56c9c4[_0xd0d4('0x23')]();};}function saveUpdates(_0xfdb4d7,_0x4bfd63){return function(_0x4df651){if(_0x4df651){return _0x4df651[_0xd0d4('0x24')](_0xfdb4d7)[_0xd0d4('0x25')](function(_0x29c2ea){return _0x29c2ea;});}return null;};}function removeEntity(_0x30ef25,_0x4e6e29){return function(_0xbc1180){if(_0xbc1180){return _0xbc1180[_0xd0d4('0x26')]()['then'](function(){_0x30ef25['status'](0xcc)[_0xd0d4('0x19')]();});}};}function handleEntityNotFound(_0x33f149,_0x4a3ca1){return function(_0x45c62c){if(!_0x45c62c){_0x33f149[_0xd0d4('0x27')](0x194);}return _0x45c62c;};}function handleError(_0x3428c7,_0x47cec2){_0x47cec2=_0x47cec2||0x1f4;return function(_0x29190d){logger[_0xd0d4('0x28')](_0x29190d[_0xd0d4('0x29')]);if(_0x29190d['name']){delete _0x29190d[_0xd0d4('0x2a')];}_0x3428c7['status'](_0x47cec2)['send'](_0x29190d);};}exports[_0xd0d4('0x2b')]=function(_0x1ff63c,_0x4fb09d){var _0x5da357={},_0x2999eb={},_0x151463={'count':0x0,'rows':[]};var _0x27f68b=_[_0xd0d4('0x2c')](db[_0xd0d4('0x2d')][_0xd0d4('0x2e')],function(_0xc110ad){return{'name':_0xc110ad[_0xd0d4('0x2f')],'type':_0xc110ad['type'][_0xd0d4('0x30')]};});_0x2999eb[_0xd0d4('0x31')]=_[_0xd0d4('0x2c')](_0x27f68b,_0xd0d4('0x2a'));_0x2999eb['query']=_[_0xd0d4('0x32')](_0x1ff63c[_0xd0d4('0x33')]);_0x2999eb[_0xd0d4('0x34')]=_[_0xd0d4('0x35')](_0x2999eb[_0xd0d4('0x31')],_0x2999eb[_0xd0d4('0x33')]);_0x5da357['attributes']=_['intersection'](_0x2999eb['model'],qs[_0xd0d4('0x36')](_0x1ff63c['query'][_0xd0d4('0x36')]));_0x5da357[_0xd0d4('0x37')]=_0x5da357[_0xd0d4('0x37')][_0xd0d4('0x38')]?_0x5da357[_0xd0d4('0x37')]:_0x2999eb[_0xd0d4('0x31')];if(!_0x1ff63c[_0xd0d4('0x33')][_0xd0d4('0x39')](_0xd0d4('0x3a'))){_0x5da357[_0xd0d4('0x1d')]=qs[_0xd0d4('0x1d')](_0x1ff63c[_0xd0d4('0x33')][_0xd0d4('0x1d')]);_0x5da357['offset']=qs[_0xd0d4('0x1b')](_0x1ff63c['query'][_0xd0d4('0x1b')]);}_0x5da357[_0xd0d4('0x3b')]=qs[_0xd0d4('0x3c')](_0x1ff63c[_0xd0d4('0x33')]['sort']);_0x5da357['where']=qs[_0xd0d4('0x34')](_[_0xd0d4('0x3d')](_0x1ff63c[_0xd0d4('0x33')],_0x2999eb[_0xd0d4('0x34')]),_0x27f68b);if(_0x1ff63c['query'][_0xd0d4('0x3e')]){_0x5da357[_0xd0d4('0x3f')]=_[_0xd0d4('0x40')](_0x5da357[_0xd0d4('0x3f')],{'$or':_[_0xd0d4('0x2c')](_0x27f68b,function(_0x5d80d1){if(_0x5d80d1['type']!==_0xd0d4('0x41')){var _0x22f833={};_0x22f833[_0x5d80d1[_0xd0d4('0x2a')]]={'$like':'%'+_0x1ff63c[_0xd0d4('0x33')]['filter']+'%'};return _0x22f833;}})});}_0x5da357=_['merge']({},_0x5da357,_0x1ff63c[_0xd0d4('0x42')]);var _0x18b096={'where':_0x5da357[_0xd0d4('0x3f')]};return db['MailTransferReport'][_0xd0d4('0x1e')](_0x18b096)[_0xd0d4('0x25')](function(_0x3a133d){_0x151463[_0xd0d4('0x1e')]=_0x3a133d;if(_0x1ff63c['query'][_0xd0d4('0x43')]){_0x5da357[_0xd0d4('0x44')]=[{'all':!![]}];}return db[_0xd0d4('0x2d')][_0xd0d4('0x45')](_0x5da357);})[_0xd0d4('0x25')](function(_0x551eb9){_0x151463['rows']=_0x551eb9;return _0x151463;})[_0xd0d4('0x25')](respondWithFilteredResult(_0x4fb09d,_0x5da357))['catch'](handleError(_0x4fb09d,null));};exports['show']=function(_0x95d2fa,_0x36ce03){var _0x3870a3={'raw':!![],'where':{'id':_0x95d2fa['params']['id']}},_0x449f43={};_0x449f43[_0xd0d4('0x31')]=_['keys'](db[_0xd0d4('0x2d')][_0xd0d4('0x2e')]);_0x449f43[_0xd0d4('0x33')]=_[_0xd0d4('0x32')](_0x95d2fa[_0xd0d4('0x33')]);_0x449f43['filters']=_[_0xd0d4('0x35')](_0x449f43['model'],_0x449f43[_0xd0d4('0x33')]);_0x3870a3['attributes']=_[_0xd0d4('0x35')](_0x449f43['model'],qs[_0xd0d4('0x36')](_0x95d2fa[_0xd0d4('0x33')][_0xd0d4('0x36')]));_0x3870a3['attributes']=_0x3870a3[_0xd0d4('0x37')][_0xd0d4('0x38')]?_0x3870a3['attributes']:_0x449f43['model'];if(_0x95d2fa[_0xd0d4('0x33')][_0xd0d4('0x43')]){_0x3870a3[_0xd0d4('0x44')]=[{'all':!![]}];}_0x3870a3=_[_0xd0d4('0x40')]({},_0x3870a3,_0x95d2fa['options']);return db[_0xd0d4('0x2d')]['find'](_0x3870a3)[_0xd0d4('0x25')](handleEntityNotFound(_0x36ce03,null))[_0xd0d4('0x25')](respondWithResult(_0x36ce03,null))[_0xd0d4('0x46')](handleError(_0x36ce03,null));};exports[_0xd0d4('0x47')]=function(_0x2b9418,_0x2b2ca5){return db[_0xd0d4('0x2d')][_0xd0d4('0x47')](_0x2b9418[_0xd0d4('0x48')],{})[_0xd0d4('0x25')](respondWithResult(_0x2b2ca5,0xc9))[_0xd0d4('0x46')](handleError(_0x2b2ca5,null));};exports[_0xd0d4('0x24')]=function(_0x3f007e,_0x36b3a7){if(_0x3f007e[_0xd0d4('0x48')]['id']){delete _0x3f007e[_0xd0d4('0x48')]['id'];}return db['MailTransferReport']['find']({'where':{'id':_0x3f007e[_0xd0d4('0x49')]['id']}})[_0xd0d4('0x25')](handleEntityNotFound(_0x36b3a7,null))['then'](saveUpdates(_0x3f007e[_0xd0d4('0x48')],null))[_0xd0d4('0x25')](respondWithResult(_0x36b3a7,null))[_0xd0d4('0x46')](handleError(_0x36b3a7,null));};exports[_0xd0d4('0x26')]=function(_0x54a187,_0x54b9e0){return db[_0xd0d4('0x2d')][_0xd0d4('0x4a')]({'where':{'id':_0x54a187[_0xd0d4('0x49')]['id']}})[_0xd0d4('0x25')](handleEntityNotFound(_0x54b9e0,null))['then'](removeEntity(_0x54b9e0,null))[_0xd0d4('0x46')](handleError(_0x54b9e0,null));};exports[_0xd0d4('0x4b')]=function(_0x5b38e4,_0x507790){return db[_0xd0d4('0x2d')][_0xd0d4('0x4b')]()[_0xd0d4('0x25')](respondWithResult(_0x507790,null))[_0xd0d4('0x46')](handleError(_0x507790,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 6866f56..b13ed46 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 _0xa990=['exports','define','MailTransferReport','report_mail_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./mailTransferReport.attributes'];(function(_0x324e1a,_0x4577ad){var _0x23d252=function(_0x557a85){while(--_0x557a85){_0x324e1a['push'](_0x324e1a['shift']());}};_0x23d252(++_0x4577ad);}(_0xa990,0xc9));var _0x0a99=function(_0x53eaf8,_0x218d42){_0x53eaf8=_0x53eaf8-0x0;var _0x2d76b2=_0xa990[_0x53eaf8];return _0x2d76b2;};'use strict';var _=require(_0x0a99('0x0'));var util=require(_0x0a99('0x1'));var logger=require(_0x0a99('0x2'))(_0x0a99('0x3'));var moment=require(_0x0a99('0x4'));var BPromise=require(_0x0a99('0x5'));var rp=require(_0x0a99('0x6'));var fs=require('fs');var path=require(_0x0a99('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0a99('0x8'));module[_0x0a99('0x9')]=function(_0xfdb594,_0x320560){return _0xfdb594[_0x0a99('0xa')](_0x0a99('0xb'),attributes,{'tableName':_0x0a99('0xc'),'paranoid':![],'indexes':[{'name':_0x0a99('0xd'),'fields':[_0x0a99('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x31e7=['request-promise','path','rimraf','../../config/environment','./mailTransferReport.attributes','MailTransferReport','report_mail_transfer','uniqueid','util','api','moment','bluebird'];(function(_0x5397a9,_0x597576){var _0x57c26f=function(_0x16af8d){while(--_0x16af8d){_0x5397a9['push'](_0x5397a9['shift']());}};_0x57c26f(++_0x597576);}(_0x31e7,0x74));var _0x731e=function(_0x485f0b,_0x2921ff){_0x485f0b=_0x485f0b-0x0;var _0x3c6518=_0x31e7[_0x485f0b];return _0x3c6518;};'use strict';var _=require('lodash');var util=require(_0x731e('0x0'));var logger=require('../../config/logger')(_0x731e('0x1'));var moment=require(_0x731e('0x2'));var BPromise=require(_0x731e('0x3'));var rp=require(_0x731e('0x4'));var fs=require('fs');var path=require(_0x731e('0x5'));var rimraf=require(_0x731e('0x6'));var config=require(_0x731e('0x7'));var attributes=require(_0x731e('0x8'));module['exports']=function(_0x1a2461,_0x5e12ce){return _0x1a2461['define'](_0x731e('0x9'),attributes,{'tableName':_0x731e('0xa'),'paranoid':![],'indexes':[{'name':_0x731e('0xb'),'fields':[_0x731e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index b8d2a67..fb6bc2f 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 _0x0552=['error','code','MailTransferReport,\x20%s,\x20%s','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x33275b,_0xfd4b17){var _0x59addf=function(_0x17da09){while(--_0x17da09){_0x33275b['push'](_0x33275b['shift']());}};_0x59addf(++_0xfd4b17);}(_0x0552,0x142));var _0x2055=function(_0x35f0bb,_0x1b00f4){_0x35f0bb=_0x35f0bb-0x0;var _0x479e9d=_0x0552[_0x35f0bb];return _0x479e9d;};'use strict';var _=require('lodash');var util=require(_0x2055('0x0'));var moment=require(_0x2055('0x1'));var BPromise=require(_0x2055('0x2'));var rs=require(_0x2055('0x3'));var fs=require('fs');var Redis=require(_0x2055('0x4'));var db=require(_0x2055('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2055('0x6'))('rpc');var config=require(_0x2055('0x7'));var jayson=require(_0x2055('0x8'));var client=jayson['client'][_0x2055('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3869aa,_0x21c4fd,_0x49762f){return new BPromise(function(_0x2f644a,_0x8b2bf3){return client[_0x2055('0xa')](_0x3869aa,_0x49762f)['then'](function(_0x21f340){logger['info']('MailTransferReport,\x20%s,\x20%s',_0x21c4fd,_0x2055('0xb'));logger[_0x2055('0xc')](_0x2055('0xd'),_0x21c4fd,_0x2055('0xb'),JSON['stringify'](_0x21f340));if(_0x21f340[_0x2055('0xe')]){if(_0x21f340['error'][_0x2055('0xf')]===0x1f4){logger['error'](_0x2055('0x10'),_0x21c4fd,_0x21f340[_0x2055('0xe')]['message']);return _0x8b2bf3(_0x21f340[_0x2055('0xe')][_0x2055('0x11')]);}logger['error']('MailTransferReport,\x20%s,\x20%s',_0x21c4fd,_0x21f340[_0x2055('0xe')]['message']);return _0x2f644a(_0x21f340[_0x2055('0xe')][_0x2055('0x11')]);}else{logger[_0x2055('0x12')](_0x2055('0x10'),_0x21c4fd,_0x2055('0xb'));_0x2f644a(_0x21f340[_0x2055('0x13')][_0x2055('0x11')]);}})[_0x2055('0x14')](function(_0x37184d){logger['error'](_0x2055('0x10'),_0x21c4fd,_0x37184d);_0x8b2bf3(_0x37184d);});});} \ No newline at end of file +var _0x8d8f=['message','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x868b7c,_0xfa438b){var _0x21683c=function(_0x21bc66){while(--_0x21bc66){_0x868b7c['push'](_0x868b7c['shift']());}};_0x21683c(++_0xfa438b);}(_0x8d8f,0xdd));var _0xf8d8=function(_0x5e325c,_0x5d6183){_0x5e325c=_0x5e325c-0x0;var _0x54585b=_0x8d8f[_0x5e325c];return _0x54585b;};'use strict';var _=require('lodash');var util=require(_0xf8d8('0x0'));var moment=require(_0xf8d8('0x1'));var BPromise=require(_0xf8d8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf8d8('0x3'))['db'];var utils=require(_0xf8d8('0x4'));var logger=require(_0xf8d8('0x5'))(_0xf8d8('0x6'));var config=require(_0xf8d8('0x7'));var jayson=require(_0xf8d8('0x8'));var client=jayson['client'][_0xf8d8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1cc5e2,_0x3d4ff4,_0x589a9b){return new BPromise(function(_0x3a764a,_0x27a8d1){return client[_0xf8d8('0xa')](_0x1cc5e2,_0x589a9b)['then'](function(_0x3576dc){logger[_0xf8d8('0xb')](_0xf8d8('0xc'),_0x3d4ff4,_0xf8d8('0xd'));logger[_0xf8d8('0xe')](_0xf8d8('0xf'),_0x3d4ff4,_0xf8d8('0xd'),JSON[_0xf8d8('0x10')](_0x3576dc));if(_0x3576dc[_0xf8d8('0x11')]){if(_0x3576dc[_0xf8d8('0x11')][_0xf8d8('0x12')]===0x1f4){logger['error'](_0xf8d8('0xc'),_0x3d4ff4,_0x3576dc[_0xf8d8('0x11')][_0xf8d8('0x13')]);return _0x27a8d1(_0x3576dc[_0xf8d8('0x11')]['message']);}logger[_0xf8d8('0x11')](_0xf8d8('0xc'),_0x3d4ff4,_0x3576dc['error'][_0xf8d8('0x13')]);return _0x3a764a(_0x3576dc[_0xf8d8('0x11')][_0xf8d8('0x13')]);}else{logger[_0xf8d8('0xb')](_0xf8d8('0xc'),_0x3d4ff4,'request\x20sent');_0x3a764a(_0x3576dc['result'][_0xf8d8('0x13')]);}})['catch'](function(_0x18df3b){logger[_0xf8d8('0x11')](_0xf8d8('0xc'),_0x3d4ff4,_0x18df3b);_0x27a8d1(_0x18df3b);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index b8330ba..dab63ef 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 _0x215b=['/:id','show','create','update','delete','multer','express','Router','fs-extra','../../config/environment','get','isAuthenticated','index','/describe','describe'];(function(_0x2e4c68,_0x7b9d88){var _0x45fe22=function(_0x5bde9b){while(--_0x5bde9b){_0x2e4c68['push'](_0x2e4c68['shift']());}};_0x45fe22(++_0x7b9d88);}(_0x215b,0xf5));var _0xb215=function(_0x3edf3f,_0x33f781){_0x3edf3f=_0x3edf3f-0x0;var _0x4f6820=_0x215b[_0x3edf3f];return _0x4f6820;};'use strict';var multer=require(_0xb215('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb215('0x1'));var router=express[_0xb215('0x2')]();var fs_extra=require(_0xb215('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb215('0x4'));var controller=require('./memberReport.controller');router[_0xb215('0x5')]('/',auth[_0xb215('0x6')](),controller[_0xb215('0x7')]);router[_0xb215('0x5')](_0xb215('0x8'),auth['isAuthenticated'](),controller[_0xb215('0x9')]);router['get'](_0xb215('0xa'),auth[_0xb215('0x6')](),controller[_0xb215('0xb')]);router['post']('/',auth[_0xb215('0x6')](),controller[_0xb215('0xc')]);router['put'](_0xb215('0xa'),auth['isAuthenticated'](),controller[_0xb215('0xd')]);router[_0xb215('0xe')](_0xb215('0xa'),auth[_0xb215('0x6')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x00dc=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./memberReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','destroy','multer'];(function(_0x247e14,_0x1b3a5e){var _0xf34c35=function(_0x3eb4bd){while(--_0x3eb4bd){_0x247e14['push'](_0x247e14['shift']());}};_0xf34c35(++_0x1b3a5e);}(_0x00dc,0x155));var _0xc00d=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x00dc[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0xc00d('0x0'));var util=require('util');var path=require(_0xc00d('0x1'));var timeout=require(_0xc00d('0x2'));var express=require(_0xc00d('0x3'));var router=express[_0xc00d('0x4')]();var fs_extra=require(_0xc00d('0x5'));var auth=require(_0xc00d('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc00d('0x7'));var controller=require(_0xc00d('0x8'));router[_0xc00d('0x9')]('/',auth[_0xc00d('0xa')](),controller['index']);router[_0xc00d('0x9')](_0xc00d('0xb'),auth[_0xc00d('0xa')](),controller[_0xc00d('0xc')]);router[_0xc00d('0x9')](_0xc00d('0xd'),auth['isAuthenticated'](),controller[_0xc00d('0xe')]);router[_0xc00d('0xf')]('/',auth[_0xc00d('0xa')](),controller[_0xc00d('0x10')]);router[_0xc00d('0x11')](_0xc00d('0xd'),auth[_0xc00d('0xa')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xc00d('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 e36c948..da88c72 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 _0x9501=['talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','moment','STRING','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','seconds','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]'];(function(_0x43214e,_0x3a8f04){var _0x14e0c8=function(_0x17c739){while(--_0x17c739){_0x43214e['push'](_0x43214e['shift']());}};_0x14e0c8(++_0x3a8f04);}(_0x9501,0xe0));var _0x1950=function(_0x5f556a,_0x1e7458){_0x5f556a=_0x5f556a-0x0;var _0xa02e51=_0x9501[_0x5f556a];return _0xa02e51;};'use strict';var Sequelize=require(_0x1950('0x0'));var moment=require(_0x1950('0x1'));module['exports']={'channel':{'type':Sequelize[_0x1950('0x2')]},'membername':{'type':Sequelize[_0x1950('0x2')]},'interface':{'type':Sequelize[_0x1950('0x2')]},'type':{'type':Sequelize[_0x1950('0x2')],'defaultValue':'DEFAULT\x20PAUSE','comment':_0x1950('0x3')},'duration':{'type':Sequelize[_0x1950('0x4')]},'enterAt':{'type':Sequelize[_0x1950('0x5')]},'exitAt':{'type':Sequelize[_0x1950('0x5')],'set':function(_0x4a81ef){var _0xced548=moment(_0x4a81ef);var _0x28070c=moment(this[_0x1950('0x6')](_0x1950('0x7')));var _0x3ea22f=_0xced548['diff'](_0x28070c,_0x1950('0x8'));this[_0x1950('0x9')](_0x1950('0xa'),_0x4a81ef);this[_0x1950('0x9')](_0x1950('0xb'),_0x3ea22f>=0x0?_0x3ea22f:null);}},'data1':{'type':Sequelize[_0x1950('0x2')],'comment':_0x1950('0xc')},'data2':{'type':Sequelize['STRING'],'comment':_0x1950('0xd')},'data3':{'type':Sequelize['STRING'],'comment':_0x1950('0xe')},'data4':{'type':Sequelize['STRING'],'comment':_0x1950('0xf')},'data5':{'type':Sequelize[_0x1950('0x2')],'comment':_0x1950('0x10')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0x1950('0x4')]},'uniqueid':{'type':Sequelize[_0x1950('0x2')]}}; \ No newline at end of file +var _0xa26d=['talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','diff','seconds','setDataValue','exitAt','duration'];(function(_0x7c78b1,_0x191cbe){var _0x5c76a0=function(_0xb54c80){while(--_0xb54c80){_0x7c78b1['push'](_0x7c78b1['shift']());}};_0x5c76a0(++_0x191cbe);}(_0xa26d,0xbf));var _0xda26=function(_0x5111ed,_0x2ac333){_0x5111ed=_0x5111ed-0x0;var _0x1cda76=_0xa26d[_0x5111ed];return _0x1cda76;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xda26('0x0'));module[_0xda26('0x1')]={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xda26('0x2')]},'interface':{'type':Sequelize[_0xda26('0x2')]},'type':{'type':Sequelize[_0xda26('0x2')],'defaultValue':_0xda26('0x3'),'comment':_0xda26('0x4')},'duration':{'type':Sequelize[_0xda26('0x5')]},'enterAt':{'type':Sequelize[_0xda26('0x6')]},'exitAt':{'type':Sequelize[_0xda26('0x6')],'set':function(_0x154061){var _0x193bb5=moment(_0x154061);var _0x1a2a0f=moment(this[_0xda26('0x7')]('enterAt'));var _0x2e04c1=_0x193bb5[_0xda26('0x8')](_0x1a2a0f,_0xda26('0x9'));this[_0xda26('0xa')](_0xda26('0xb'),_0x154061);this[_0xda26('0xa')](_0xda26('0xc'),_0x2e04c1>=0x0?_0x2e04c1:null);}},'data1':{'type':Sequelize[_0xda26('0x2')],'comment':_0xda26('0xd')},'data2':{'type':Sequelize[_0xda26('0x2')],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0xda26('0x2')],'comment':_0xda26('0xe')},'data4':{'type':Sequelize[_0xda26('0x2')],'comment':_0xda26('0xf')},'data5':{'type':Sequelize[_0xda26('0x2')],'comment':_0xda26('0x10')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize['INTEGER']},'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 82c4e8e..0fc3e01 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 _0x9957=['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','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','MemberReport','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache'];(function(_0x45bee0,_0x42bf09){var _0x1fcfd5=function(_0x235b6a){while(--_0x235b6a){_0x45bee0['push'](_0x45bee0['shift']());}};_0x1fcfd5(++_0x42bf09);}(_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){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['MemberReport']['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['MemberReport'][_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['MemberReport'][_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('0x40')][_0x7995('0x47')]({'where':{'id':_0x4ffc8a['params']['id']}})['then'](handleEntityNotFound(_0x19da63,null))['then'](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x4c')]=function(_0x4cf5db,_0x1cd85){return db[_0x7995('0x40')][_0x7995('0x4c')]()[_0x7995('0x26')](respondWithResult(_0x1cd85,null))[_0x7995('0x49')](handleError(_0x1cd85,null));}; \ No newline at end of file +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(_0xe8554f,_0x4d11de){var _0x45c795=function(_0x30cb99){while(--_0x30cb99){_0xe8554f['push'](_0xe8554f['shift']());}};_0x45c795(++_0x4d11de);}(_0x9c44,0x178));var _0x49c4=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x9c44[_0x3ab51d];return _0x29a04e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x49c4('0x0'));var jsonpatch=require(_0x49c4('0x1'));var rp=require(_0x49c4('0x2'));var moment=require(_0x49c4('0x3'));var BPromise=require(_0x49c4('0x4'));var Mustache=require(_0x49c4('0x5'));var util=require('util');var path=require('path');var sox=require(_0x49c4('0x6'));var csv=require('to-csv');var ejs=require(_0x49c4('0x7'));var fs=require('fs');var fs_extra=require(_0x49c4('0x8'));var _=require(_0x49c4('0x9'));var squel=require(_0x49c4('0xa'));var crypto=require(_0x49c4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x49c4('0xc'));var toCsv=require(_0x49c4('0xd'));var querystring=require(_0x49c4('0xe'));var Papa=require(_0x49c4('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49c4('0x10'));var as=require(_0x49c4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49c4('0x12'))(_0x49c4('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x49c4('0x14'));var db=require(_0x49c4('0x15'))['db'];function respondWithStatusCode(_0x5487cd,_0x7df3a9){_0x7df3a9=_0x7df3a9||0xcc;return function(_0x403bfb){if(_0x403bfb){return _0x5487cd['sendStatus'](_0x7df3a9);}return _0x5487cd[_0x49c4('0x16')](_0x7df3a9)[_0x49c4('0x17')]();};}function respondWithResult(_0x21f15a,_0x2decee){_0x2decee=_0x2decee||0xc8;return function(_0x12777c){if(_0x12777c){return _0x21f15a[_0x49c4('0x16')](_0x2decee)[_0x49c4('0x18')](_0x12777c);}};}function respondWithFilteredResult(_0x3de397,_0x58d177){return function(_0x3acd06){if(_0x3acd06){var _0x141003=typeof _0x58d177[_0x49c4('0x19')]===_0x49c4('0x1a')&&typeof _0x58d177[_0x49c4('0x1b')]==='undefined';var _0x44e607=_0x3acd06[_0x49c4('0x1c')];var _0x4c3253=_0x141003?0x0:_0x58d177['offset'];var _0x3c782d=_0x141003?_0x3acd06[_0x49c4('0x1c')]:_0x58d177[_0x49c4('0x19')]+_0x58d177['limit'];var _0x24856d;if(_0x3c782d>=_0x44e607){_0x3c782d=_0x44e607;_0x24856d=0xc8;}else{_0x24856d=0xce;}_0x3de397['status'](_0x24856d);return _0x3de397[_0x49c4('0x1d')](_0x49c4('0x1e'),_0x4c3253+'-'+_0x3c782d+'/'+_0x44e607)[_0x49c4('0x18')](_0x3acd06);}return null;};}function patchUpdates(_0x291526){return function(_0x382040){try{jsonpatch[_0x49c4('0x1f')](_0x382040,_0x291526,!![]);}catch(_0x280893){return BPromise[_0x49c4('0x20')](_0x280893);}return _0x382040[_0x49c4('0x21')]();};}function saveUpdates(_0x578447,_0x527126){return function(_0x57f502){if(_0x57f502){return _0x57f502[_0x49c4('0x22')](_0x578447)['then'](function(_0x592bb8){return _0x592bb8;});}return null;};}function removeEntity(_0x2263ae,_0x15581b){return function(_0x26c640){if(_0x26c640){return _0x26c640[_0x49c4('0x23')]()['then'](function(){_0x2263ae['status'](0xcc)[_0x49c4('0x17')]();});}};}function handleEntityNotFound(_0x9cb797,_0x565423){return function(_0x207358){if(!_0x207358){_0x9cb797[_0x49c4('0x24')](0x194);}return _0x207358;};}function handleError(_0x210159,_0xa7a826){_0xa7a826=_0xa7a826||0x1f4;return function(_0x531d92){logger['error'](_0x531d92[_0x49c4('0x25')]);if(_0x531d92['name']){delete _0x531d92[_0x49c4('0x26')];}_0x210159[_0x49c4('0x16')](_0xa7a826)[_0x49c4('0x27')](_0x531d92);};}exports[_0x49c4('0x28')]=function(_0x5987ae,_0x889909){var _0x2b2793={},_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 diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index d3fd4d0..1e9f0eb 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 _0xf8cc=['./memberReport.attributes','report_member','membername_interface','interface','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x14cb91,_0x569fa7){var _0x16af91=function(_0x509be9){while(--_0x509be9){_0x14cb91['push'](_0x14cb91['shift']());}};_0x16af91(++_0x569fa7);}(_0xf8cc,0x1e4));var _0xcf8c=function(_0x168230,_0x696a35){_0x168230=_0x168230-0x0;var _0x3daa18=_0xf8cc[_0x168230];return _0x3daa18;};'use strict';var _=require(_0xcf8c('0x0'));var util=require(_0xcf8c('0x1'));var logger=require(_0xcf8c('0x2'))('api');var moment=require(_0xcf8c('0x3'));var BPromise=require(_0xcf8c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcf8c('0x5'));var rimraf=require(_0xcf8c('0x6'));var config=require(_0xcf8c('0x7'));var attributes=require(_0xcf8c('0x8'));module['exports']=function(_0x4d9b27,_0x5a2c60){return _0x4d9b27['define']('MemberReport',attributes,{'tableName':_0xcf8c('0x9'),'paranoid':![],'indexes':[{'name':_0xcf8c('0xa'),'fields':['membername',_0xcf8c('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4607=['membername','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./memberReport.attributes','exports','define','MemberReport','report_member','membername_interface'];(function(_0x737f2c,_0x243e0f){var _0x2e0d90=function(_0x161ad1){while(--_0x161ad1){_0x737f2c['push'](_0x737f2c['shift']());}};_0x2e0d90(++_0x243e0f);}(_0x4607,0x121));var _0x7460=function(_0x3ca36c,_0x5f41e8){_0x3ca36c=_0x3ca36c-0x0;var _0x4de960=_0x4607[_0x3ca36c];return _0x4de960;};'use strict';var _=require(_0x7460('0x0'));var util=require(_0x7460('0x1'));var logger=require(_0x7460('0x2'))(_0x7460('0x3'));var moment=require(_0x7460('0x4'));var BPromise=require(_0x7460('0x5'));var rp=require(_0x7460('0x6'));var fs=require('fs');var path=require(_0x7460('0x7'));var rimraf=require(_0x7460('0x8'));var config=require('../../config/environment');var attributes=require(_0x7460('0x9'));module[_0x7460('0xa')]=function(_0x628a49,_0x4179ac){return _0x628a49[_0x7460('0xb')](_0x7460('0xc'),attributes,{'tableName':_0x7460('0xd'),'paranoid':![],'indexes':[{'name':_0x7460('0xe'),'fields':[_0x7460('0xf'),'interface']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index f7c3956..18057e4 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 _0x522b=['CreateMemberReport','create','body','then','UpdateMemberReport','update','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','error','code','MemberReport,\x20%s,\x20%s','message','MemberReport','findAll','options','raw','attributes','limit','include','map','model','GetMemberReport','stringify'];(function(_0x2de26f,_0x54ca77){var _0x40827c=function(_0x61a812){while(--_0x61a812){_0x2de26f['push'](_0x2de26f['shift']());}};_0x40827c(++_0x54ca77);}(_0x522b,0x1c3));var _0xb522=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0x522b[_0x32d457];return _0x338386;};'use strict';var _=require(_0xb522('0x0'));var util=require(_0xb522('0x1'));var moment=require('moment');var BPromise=require(_0xb522('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb522('0x3'))['db'];var utils=require(_0xb522('0x4'));var logger=require('../../config/logger')(_0xb522('0x5'));var config=require(_0xb522('0x6'));var jayson=require(_0xb522('0x7'));var client=jayson[_0xb522('0x8')][_0xb522('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x55a5f0,_0x446229,_0x2f289f){return new BPromise(function(_0x5a5cd3,_0x55259d){return client[_0xb522('0xa')](_0x55a5f0,_0x2f289f)['then'](function(_0x3f4f63){logger[_0xb522('0xb')]('MemberReport,\x20%s,\x20%s',_0x446229,_0xb522('0xc'));logger[_0xb522('0xd')](_0xb522('0xe'),_0x446229,'request\x20sent',JSON['stringify'](_0x3f4f63));if(_0x3f4f63[_0xb522('0xf')]){if(_0x3f4f63[_0xb522('0xf')][_0xb522('0x10')]===0x1f4){logger['error'](_0xb522('0x11'),_0x446229,_0x3f4f63['error'][_0xb522('0x12')]);return _0x55259d(_0x3f4f63[_0xb522('0xf')]['message']);}logger[_0xb522('0xf')]('MemberReport,\x20%s,\x20%s',_0x446229,_0x3f4f63[_0xb522('0xf')][_0xb522('0x12')]);return _0x5a5cd3(_0x3f4f63[_0xb522('0xf')][_0xb522('0x12')]);}else{logger[_0xb522('0xb')](_0xb522('0x11'),_0x446229,_0xb522('0xc'));_0x5a5cd3(_0x3f4f63['result'][_0xb522('0x12')]);}})['catch'](function(_0x435f25){logger[_0xb522('0xf')](_0xb522('0x11'),_0x446229,_0x435f25);_0x55259d(_0x435f25);});});}exports['GetMemberReport']=function(_0x2077e8){var _0x49a898=this;return new Promise(function(_0x2bdf4f,_0x27c6eb){return db[_0xb522('0x13')][_0xb522('0x14')]({'raw':_0x2077e8[_0xb522('0x15')]?_0x2077e8[_0xb522('0x15')][_0xb522('0x16')]===undefined?!![]:![]:!![],'where':_0x2077e8['options']?_0x2077e8['options']['where']||null:null,'attributes':_0x2077e8[_0xb522('0x15')]?_0x2077e8[_0xb522('0x15')][_0xb522('0x17')]||null:null,'limit':_0x2077e8[_0xb522('0x15')]?_0x2077e8[_0xb522('0x15')][_0xb522('0x18')]||null:null,'include':_0x2077e8[_0xb522('0x15')]?_0x2077e8[_0xb522('0x15')][_0xb522('0x19')]?_[_0xb522('0x1a')](_0x2077e8[_0xb522('0x15')][_0xb522('0x19')],function(_0x3799ec){return{'model':db[_0x3799ec['model']],'as':_0x3799ec['as'],'attributes':_0x3799ec[_0xb522('0x17')],'include':_0x3799ec[_0xb522('0x19')]?_['map'](_0x3799ec[_0xb522('0x19')],function(_0x149abf){return{'model':db[_0x149abf[_0xb522('0x1b')]],'as':_0x149abf['as'],'attributes':_0x149abf['attributes'],'include':_0x149abf[_0xb522('0x19')]?_['map'](_0x149abf[_0xb522('0x19')],function(_0x313c8d){return{'model':db[_0x313c8d[_0xb522('0x1b')]],'as':_0x313c8d['as'],'attributes':_0x313c8d[_0xb522('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x518f56){logger[_0xb522('0xb')]('GetMemberReport',_0x2077e8);logger[_0xb522('0xd')](_0xb522('0x1c'),_0x2077e8,JSON[_0xb522('0x1d')](_0x518f56));_0x2bdf4f(_0x518f56);})['catch'](function(_0x1a5f9d){logger[_0xb522('0xf')]('GetMemberReport',_0x1a5f9d[_0xb522('0x12')],_0x2077e8);_0x27c6eb(_0x49a898[_0xb522('0xf')](0x1f4,_0x1a5f9d[_0xb522('0x12')]));});});};exports[_0xb522('0x1e')]=function(_0x139a9a){var _0x5bc250=this;return new Promise(function(_0x162ac7,_0x2e7449){return db[_0xb522('0x13')][_0xb522('0x1f')](_0x139a9a[_0xb522('0x20')],{'raw':_0x139a9a[_0xb522('0x15')]?_0x139a9a[_0xb522('0x15')]['raw']===undefined?!![]:![]:!![]})[_0xb522('0x21')](function(_0x15c4af){logger[_0xb522('0xb')]('CreateMemberReport',_0x139a9a);logger[_0xb522('0xd')](_0xb522('0x1e'),_0x139a9a,JSON['stringify'](_0x15c4af));_0x162ac7(_0x15c4af);})['catch'](function(_0xbfedfb){logger[_0xb522('0xf')](_0xb522('0x1e'),_0xbfedfb[_0xb522('0x12')],_0x139a9a);_0x2e7449(_0x5bc250[_0xb522('0xf')](0x1f4,_0xbfedfb[_0xb522('0x12')]));});});};exports[_0xb522('0x22')]=function(_0x13527e){var _0x2824f6=this;return new Promise(function(_0x187f57,_0x392d50){return db[_0xb522('0x13')][_0xb522('0x23')](_0x13527e[_0xb522('0x20')],{'raw':_0x13527e[_0xb522('0x15')]?_0x13527e[_0xb522('0x15')][_0xb522('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x13527e[_0xb522('0x15')]?_0x13527e[_0xb522('0x15')]['where']||null:null,'attributes':_0x13527e['options']?_0x13527e['options'][_0xb522('0x17')]||null:null,'limit':_0x13527e[_0xb522('0x15')]?_0x13527e[_0xb522('0x15')][_0xb522('0x18')]||null:null})[_0xb522('0x21')](function(_0x2cc288){logger[_0xb522('0xb')]('UpdateMemberReport',_0x13527e);logger['debug'](_0xb522('0x22'),_0x13527e,JSON['stringify'](_0x2cc288));_0x187f57(_0x2cc288);})[_0xb522('0x24')](function(_0x2257f4){logger[_0xb522('0xf')](_0xb522('0x22'),_0x2257f4[_0xb522('0x12')],_0x13527e);_0x392d50(_0x2824f6[_0xb522('0xf')](0x1f4,_0x2257f4[_0xb522('0x12')]));});});}; \ No newline at end of file +var _0xaaee=['then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','MemberReport','findAll','options','raw','where','include','map','model','attributes','GetMemberReport','create','CreateMemberReport','UpdateMemberReport','update','limit','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x24861b,_0x4cde1d){var _0x17b688=function(_0x935f48){while(--_0x935f48){_0x24861b['push'](_0x24861b['shift']());}};_0x17b688(++_0x4cde1d);}(_0xaaee,0x132));var _0xeaae=function(_0x3a1d6c,_0x417610){_0x3a1d6c=_0x3a1d6c-0x0;var _0x7d7ab2=_0xaaee[_0x3a1d6c];return _0x7d7ab2;};'use strict';var _=require(_0xeaae('0x0'));var util=require(_0xeaae('0x1'));var moment=require(_0xeaae('0x2'));var BPromise=require(_0xeaae('0x3'));var rs=require(_0xeaae('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xeaae('0x5'))['db'];var utils=require(_0xeaae('0x6'));var logger=require(_0xeaae('0x7'))(_0xeaae('0x8'));var config=require(_0xeaae('0x9'));var jayson=require(_0xeaae('0xa'));var client=jayson[_0xeaae('0xb')][_0xeaae('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x113fa9,_0x13023a,_0x33afb9){return new BPromise(function(_0x1ad467,_0x5072b9){return client[_0xeaae('0xd')](_0x113fa9,_0x33afb9)[_0xeaae('0xe')](function(_0x58f501){logger[_0xeaae('0xf')](_0xeaae('0x10'),_0x13023a,_0xeaae('0x11'));logger[_0xeaae('0x12')]('MemberReport,\x20%s,\x20%s,\x20%s',_0x13023a,'request\x20sent',JSON[_0xeaae('0x13')](_0x58f501));if(_0x58f501[_0xeaae('0x14')]){if(_0x58f501['error'][_0xeaae('0x15')]===0x1f4){logger[_0xeaae('0x14')](_0xeaae('0x10'),_0x13023a,_0x58f501[_0xeaae('0x14')]['message']);return _0x5072b9(_0x58f501[_0xeaae('0x14')]['message']);}logger[_0xeaae('0x14')](_0xeaae('0x10'),_0x13023a,_0x58f501[_0xeaae('0x14')][_0xeaae('0x16')]);return _0x1ad467(_0x58f501[_0xeaae('0x14')][_0xeaae('0x16')]);}else{logger[_0xeaae('0xf')](_0xeaae('0x10'),_0x13023a,_0xeaae('0x11'));_0x1ad467(_0x58f501[_0xeaae('0x17')][_0xeaae('0x16')]);}})[_0xeaae('0x18')](function(_0x8bc041){logger['error'](_0xeaae('0x10'),_0x13023a,_0x8bc041);_0x5072b9(_0x8bc041);});});}exports['GetMemberReport']=function(_0x3ace1f){var _0x10b6bf=this;return new Promise(function(_0x2b4fd3,_0x3220c0){return db[_0xeaae('0x19')][_0xeaae('0x1a')]({'raw':_0x3ace1f[_0xeaae('0x1b')]?_0x3ace1f['options'][_0xeaae('0x1c')]===undefined?!![]:![]:!![],'where':_0x3ace1f[_0xeaae('0x1b')]?_0x3ace1f[_0xeaae('0x1b')][_0xeaae('0x1d')]||null:null,'attributes':_0x3ace1f[_0xeaae('0x1b')]?_0x3ace1f[_0xeaae('0x1b')]['attributes']||null:null,'limit':_0x3ace1f[_0xeaae('0x1b')]?_0x3ace1f[_0xeaae('0x1b')]['limit']||null:null,'include':_0x3ace1f[_0xeaae('0x1b')]?_0x3ace1f['options'][_0xeaae('0x1e')]?_[_0xeaae('0x1f')](_0x3ace1f[_0xeaae('0x1b')][_0xeaae('0x1e')],function(_0x5970df){return{'model':db[_0x5970df[_0xeaae('0x20')]],'as':_0x5970df['as'],'attributes':_0x5970df[_0xeaae('0x21')],'include':_0x5970df[_0xeaae('0x1e')]?_['map'](_0x5970df['include'],function(_0x4129ed){return{'model':db[_0x4129ed[_0xeaae('0x20')]],'as':_0x4129ed['as'],'attributes':_0x4129ed[_0xeaae('0x21')],'include':_0x4129ed[_0xeaae('0x1e')]?_[_0xeaae('0x1f')](_0x4129ed['include'],function(_0x162311){return{'model':db[_0x162311[_0xeaae('0x20')]],'as':_0x162311['as'],'attributes':_0x162311['attributes']};}):[]};}):[]};}):[]:[]})[_0xeaae('0xe')](function(_0x3bd47a){logger[_0xeaae('0xf')](_0xeaae('0x22'),_0x3ace1f);logger['debug'](_0xeaae('0x22'),_0x3ace1f,JSON[_0xeaae('0x13')](_0x3bd47a));_0x2b4fd3(_0x3bd47a);})[_0xeaae('0x18')](function(_0x4db82c){logger[_0xeaae('0x14')](_0xeaae('0x22'),_0x4db82c[_0xeaae('0x16')],_0x3ace1f);_0x3220c0(_0x10b6bf[_0xeaae('0x14')](0x1f4,_0x4db82c[_0xeaae('0x16')]));});});};exports['CreateMemberReport']=function(_0x1a9967){var _0x3b73fa=this;return new Promise(function(_0x516289,_0x2f23c2){return db['MemberReport'][_0xeaae('0x23')](_0x1a9967['body'],{'raw':_0x1a9967[_0xeaae('0x1b')]?_0x1a9967[_0xeaae('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0xeaae('0xe')](function(_0x2bd911){logger[_0xeaae('0xf')](_0xeaae('0x24'),_0x1a9967);logger['debug'](_0xeaae('0x24'),_0x1a9967,JSON[_0xeaae('0x13')](_0x2bd911));_0x516289(_0x2bd911);})['catch'](function(_0x58846b){logger[_0xeaae('0x14')](_0xeaae('0x24'),_0x58846b[_0xeaae('0x16')],_0x1a9967);_0x2f23c2(_0x3b73fa['error'](0x1f4,_0x58846b[_0xeaae('0x16')]));});});};exports[_0xeaae('0x25')]=function(_0x221bd4){var _0x2827a6=this;return new Promise(function(_0x436a94,_0x26f417){return db['MemberReport'][_0xeaae('0x26')](_0x221bd4['body'],{'raw':_0x221bd4[_0xeaae('0x1b')]?_0x221bd4[_0xeaae('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x221bd4[_0xeaae('0x1b')]?_0x221bd4[_0xeaae('0x1b')][_0xeaae('0x1d')]||null:null,'attributes':_0x221bd4['options']?_0x221bd4[_0xeaae('0x1b')][_0xeaae('0x21')]||null:null,'limit':_0x221bd4[_0xeaae('0x1b')]?_0x221bd4[_0xeaae('0x1b')][_0xeaae('0x27')]||null:null})[_0xeaae('0xe')](function(_0x460da9){logger['info'](_0xeaae('0x25'),_0x221bd4);logger[_0xeaae('0x12')](_0xeaae('0x25'),_0x221bd4,JSON[_0xeaae('0x13')](_0x460da9));_0x436a94(_0x460da9);})[_0xeaae('0x18')](function(_0x390055){logger['error']('UpdateMemberReport',_0x390055[_0xeaae('0x16')],_0x221bd4);_0x26f417(_0x2827a6[_0xeaae('0x14')](0x1f4,_0x390055[_0xeaae('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 496bc8c..ce54ee6 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 _0x2d66=['fs-extra','../../components/interaction/service','../../config/environment','./migration.controller','get','exports','util','path','connect-timeout','Router'];(function(_0x181bac,_0x2efb40){var _0x2d2693=function(_0x592af7){while(--_0x592af7){_0x181bac['push'](_0x181bac['shift']());}};_0x2d2693(++_0x2efb40);}(_0x2d66,0x18c));var _0x62d6=function(_0x50fc13,_0x1eb5f0){_0x50fc13=_0x50fc13-0x0;var _0x242f8a=_0x2d66[_0x50fc13];return _0x242f8a;};'use strict';var multer=require('multer');var util=require(_0x62d6('0x0'));var path=require(_0x62d6('0x1'));var timeout=require(_0x62d6('0x2'));var express=require('express');var router=express[_0x62d6('0x3')]();var fs_extra=require(_0x62d6('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x62d6('0x5'));var config=require(_0x62d6('0x6'));var controller=require(_0x62d6('0x7'));router[_0x62d6('0x8')]('/',controller['index']);module[_0x62d6('0x9')]=router; \ No newline at end of file +var _0x323a=['../../components/interaction/service','./migration.controller','index','exports','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x160980,_0x29750d){var _0x5313ca=function(_0x566923){while(--_0x566923){_0x160980['push'](_0x160980['shift']());}};_0x5313ca(++_0x29750d);}(_0x323a,0x68));var _0xa323=function(_0x1f9bcc,_0x400cb8){_0x1f9bcc=_0x1f9bcc-0x0;var _0x12831a=_0x323a[_0x1f9bcc];return _0x12831a;};'use strict';var multer=require('multer');var util=require(_0xa323('0x0'));var path=require(_0xa323('0x1'));var timeout=require(_0xa323('0x2'));var express=require(_0xa323('0x3'));var router=express[_0xa323('0x4')]();var fs_extra=require(_0xa323('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa323('0x6'));var config=require('../../config/environment');var controller=require(_0xa323('0x7'));router['get']('/',controller[_0xa323('0x8')]);module[_0xa323('0x9')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 7dc2273..0df53eb 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 _0x0a64=['version','exports','STRING'];(function(_0x343c93,_0x172d05){var _0x82b3f5=function(_0x583fe5){while(--_0x583fe5){_0x343c93['push'](_0x343c93['shift']());}};_0x82b3f5(++_0x172d05);}(_0x0a64,0x1f3));var _0x40a6=function(_0x3b8d3d,_0x22758b){_0x3b8d3d=_0x3b8d3d-0x0;var _0x4f10aa=_0x0a64[_0x3b8d3d];return _0x4f10aa;};'use strict';var Sequelize=require('sequelize');module[_0x40a6('0x0')]={'version':{'type':Sequelize[_0x40a6('0x1')],'unique':_0x40a6('0x2')}}; \ No newline at end of file +var _0x477c=['STRING','version','sequelize'];(function(_0x1eebb9,_0x3f5752){var _0x5b5bed=function(_0xcfc56a){while(--_0xcfc56a){_0x1eebb9['push'](_0x1eebb9['shift']());}};_0x5b5bed(++_0x3f5752);}(_0x477c,0xc5));var _0xc477=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x477c[_0x27af45];return _0x18df21;};'use strict';var Sequelize=require(_0xc477('0x0'));module['exports']={'version':{'type':Sequelize[_0xc477('0x1')],'unique':_0xc477('0x2')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 7623c1b..281dbf1 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 _0xd9e9=['query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','then','includeAll','rows','catch','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','end','json','undefined','count','offset','limit','status','set','Content-Range','apply','save','update','error','stack','name','send','map','Migration','fieldName','type','key','model'];(function(_0x40e91f,_0x363e6e){var _0x1ff001=function(_0x3ad0b4){while(--_0x3ad0b4){_0x40e91f['push'](_0x40e91f['shift']());}};_0x1ff001(++_0x363e6e);}(_0xd9e9,0x1a0));var _0x9d9e=function(_0x544e45,_0x10a5b3){_0x544e45=_0x544e45-0x0;var _0x43daa3=_0xd9e9[_0x544e45];return _0x43daa3;};'use strict';var emlformat=require(_0x9d9e('0x0'));var rimraf=require(_0x9d9e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9d9e('0x2'));var moment=require(_0x9d9e('0x3'));var BPromise=require(_0x9d9e('0x4'));var Mustache=require(_0x9d9e('0x5'));var util=require(_0x9d9e('0x6'));var path=require('path');var sox=require(_0x9d9e('0x7'));var csv=require(_0x9d9e('0x8'));var ejs=require(_0x9d9e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9d9e('0xa'));var squel=require(_0x9d9e('0xb'));var crypto=require(_0x9d9e('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x9d9e('0xd'));var toCsv=require('to-csv');var querystring=require(_0x9d9e('0xe'));var Papa=require(_0x9d9e('0xf'));var Redis=require(_0x9d9e('0x10'));var authService=require(_0x9d9e('0x11'));var qs=require(_0x9d9e('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9d9e('0x13'));var logger=require('../../config/logger')(_0x9d9e('0x14'));var utils=require('../../config/utils');var config=require(_0x9d9e('0x15'));var licenseUtil=require(_0x9d9e('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xaef0fe,_0x16405a){_0x16405a=_0x16405a||0xcc;return function(_0x594ac4){if(_0x594ac4){return _0xaef0fe[_0x9d9e('0x17')](_0x16405a);}return _0xaef0fe['status'](_0x16405a)[_0x9d9e('0x18')]();};}function respondWithResult(_0x2c8b26,_0x3ead01){_0x3ead01=_0x3ead01||0xc8;return function(_0x3ecec6){if(_0x3ecec6){return _0x2c8b26['status'](_0x3ead01)[_0x9d9e('0x19')](_0x3ecec6);}};}function respondWithFilteredResult(_0x4ab24f,_0xc0ad7d){return function(_0x2b326f){if(_0x2b326f){var _0x248a2b=typeof _0xc0ad7d['offset']==='undefined'&&typeof _0xc0ad7d['limit']===_0x9d9e('0x1a');var _0x22d53f=_0x2b326f[_0x9d9e('0x1b')];var _0x2705f9=_0x248a2b?0x0:_0xc0ad7d[_0x9d9e('0x1c')];var _0x3ca4d4=_0x248a2b?_0x2b326f[_0x9d9e('0x1b')]:_0xc0ad7d['offset']+_0xc0ad7d[_0x9d9e('0x1d')];var _0x4d3fdb;if(_0x3ca4d4>=_0x22d53f){_0x3ca4d4=_0x22d53f;_0x4d3fdb=0xc8;}else{_0x4d3fdb=0xce;}_0x4ab24f[_0x9d9e('0x1e')](_0x4d3fdb);return _0x4ab24f[_0x9d9e('0x1f')](_0x9d9e('0x20'),_0x2705f9+'-'+_0x3ca4d4+'/'+_0x22d53f)[_0x9d9e('0x19')](_0x2b326f);}return null;};}function patchUpdates(_0x3788cc){return function(_0x54fdfc){try{jsonpatch[_0x9d9e('0x21')](_0x54fdfc,_0x3788cc,!![]);}catch(_0x2af27c){return BPromise['reject'](_0x2af27c);}return _0x54fdfc[_0x9d9e('0x22')]();};}function saveUpdates(_0x2634c9,_0x3c72e7){return function(_0x4e3a21){if(_0x4e3a21){return _0x4e3a21[_0x9d9e('0x23')](_0x2634c9)['then'](function(_0x416b3f){return _0x416b3f;});}return null;};}function removeEntity(_0x2fe695,_0x4347c1){return function(_0x118744){if(_0x118744){return _0x118744['destroy']()['then'](function(){_0x2fe695[_0x9d9e('0x1e')](0xcc)[_0x9d9e('0x18')]();});}};}function handleEntityNotFound(_0x5f4ddd,_0x3ee0d3){return function(_0xca42f1){if(!_0xca42f1){_0x5f4ddd[_0x9d9e('0x17')](0x194);}return _0xca42f1;};}function handleError(_0x464f29,_0x49f75f){_0x49f75f=_0x49f75f||0x1f4;return function(_0x2968d1){logger[_0x9d9e('0x24')](_0x2968d1[_0x9d9e('0x25')]);if(_0x2968d1[_0x9d9e('0x26')]){delete _0x2968d1[_0x9d9e('0x26')];}_0x464f29[_0x9d9e('0x1e')](_0x49f75f)[_0x9d9e('0x27')](_0x2968d1);};}exports['index']=function(_0x47a08b,_0x5e86e9){var _0x401306={},_0x1ea146={},_0x42b1a7={'count':0x0,'rows':[]};var _0x55b20c=_[_0x9d9e('0x28')](db[_0x9d9e('0x29')]['rawAttributes'],function(_0x48d5c1){return{'name':_0x48d5c1[_0x9d9e('0x2a')],'type':_0x48d5c1[_0x9d9e('0x2b')][_0x9d9e('0x2c')]};});_0x1ea146[_0x9d9e('0x2d')]=_['map'](_0x55b20c,_0x9d9e('0x26'));_0x1ea146[_0x9d9e('0x2e')]=_[_0x9d9e('0x2f')](_0x47a08b[_0x9d9e('0x2e')]);_0x1ea146['filters']=_[_0x9d9e('0x30')](_0x1ea146[_0x9d9e('0x2d')],_0x1ea146['query']);_0x401306[_0x9d9e('0x31')]=_[_0x9d9e('0x30')](_0x1ea146['model'],qs[_0x9d9e('0x32')](_0x47a08b[_0x9d9e('0x2e')]['fields']));_0x401306[_0x9d9e('0x31')]=_0x401306[_0x9d9e('0x31')]['length']?_0x401306['attributes']:_0x1ea146[_0x9d9e('0x2d')];if(!_0x47a08b[_0x9d9e('0x2e')][_0x9d9e('0x33')](_0x9d9e('0x34'))){_0x401306[_0x9d9e('0x1d')]=qs[_0x9d9e('0x1d')](_0x47a08b[_0x9d9e('0x2e')][_0x9d9e('0x1d')]);_0x401306['offset']=qs[_0x9d9e('0x1c')](_0x47a08b['query'][_0x9d9e('0x1c')]);}_0x401306[_0x9d9e('0x35')]=qs[_0x9d9e('0x36')](_0x47a08b[_0x9d9e('0x2e')][_0x9d9e('0x36')]);_0x401306[_0x9d9e('0x37')]=qs[_0x9d9e('0x38')](_[_0x9d9e('0x39')](_0x47a08b[_0x9d9e('0x2e')],_0x1ea146[_0x9d9e('0x38')]),_0x55b20c);if(_0x47a08b[_0x9d9e('0x2e')][_0x9d9e('0x3a')]){_0x401306[_0x9d9e('0x37')]=_[_0x9d9e('0x3b')](_0x401306[_0x9d9e('0x37')],{'$or':_['map'](_0x55b20c,function(_0x34b27f){if(_0x34b27f[_0x9d9e('0x2b')]!==_0x9d9e('0x3c')){var _0x3421c3={};_0x3421c3[_0x34b27f[_0x9d9e('0x26')]]={'$like':'%'+_0x47a08b[_0x9d9e('0x2e')]['filter']+'%'};return _0x3421c3;}})});}_0x401306=_[_0x9d9e('0x3b')]({},_0x401306,_0x47a08b[_0x9d9e('0x3d')]);var _0xee6b37={'where':_0x401306[_0x9d9e('0x37')]};return db[_0x9d9e('0x29')][_0x9d9e('0x1b')](_0xee6b37)[_0x9d9e('0x3e')](function(_0x3763a8){_0x42b1a7[_0x9d9e('0x1b')]=_0x3763a8;if(_0x47a08b[_0x9d9e('0x2e')][_0x9d9e('0x3f')]){_0x401306['include']=[{'all':!![]}];}return db[_0x9d9e('0x29')]['findAll'](_0x401306);})[_0x9d9e('0x3e')](function(_0x7b40ef){_0x42b1a7[_0x9d9e('0x40')]=_0x7b40ef;return _0x42b1a7;})[_0x9d9e('0x3e')](respondWithFilteredResult(_0x5e86e9,_0x401306))[_0x9d9e('0x41')](handleError(_0x5e86e9,null));}; \ No newline at end of file +var _0x20af=['lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','undefined','count','limit','Content-Range','reject','save','update','then','destroy','end','error','stack','name','index','map','Migration','fieldName','type','key','keys','query','filters','intersection','attributes','model','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','include','rows','catch','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','fs-extra'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x20af,0x7b));var _0xf20a=function(_0x47bdb3,_0x3c5fcf){_0x47bdb3=_0x47bdb3-0x0;var _0x169d1c=_0x20af[_0x47bdb3];return _0x169d1c;};'use strict';var emlformat=require(_0xf20a('0x0'));var rimraf=require(_0xf20a('0x1'));var zipdir=require(_0xf20a('0x2'));var jsonpatch=require(_0xf20a('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf20a('0x4'));var Mustache=require(_0xf20a('0x5'));var util=require(_0xf20a('0x6'));var path=require(_0xf20a('0x7'));var sox=require(_0xf20a('0x8'));var csv=require(_0xf20a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf20a('0xa'));var _=require(_0xf20a('0xb'));var squel=require('squel');var crypto=require(_0xf20a('0xc'));var jsforce=require(_0xf20a('0xd'));var deskjs=require(_0xf20a('0xe'));var toCsv=require(_0xf20a('0x9'));var querystring=require(_0xf20a('0xf'));var Papa=require(_0xf20a('0x10'));var Redis=require(_0xf20a('0x11'));var authService=require(_0xf20a('0x12'));var qs=require(_0xf20a('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf20a('0x14'));var logger=require('../../config/logger')(_0xf20a('0x15'));var utils=require(_0xf20a('0x16'));var config=require(_0xf20a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xf20a('0x18'))['db'];function respondWithStatusCode(_0x283a75,_0x4c14ae){_0x4c14ae=_0x4c14ae||0xcc;return function(_0x17132f){if(_0x17132f){return _0x283a75['sendStatus'](_0x4c14ae);}return _0x283a75[_0xf20a('0x19')](_0x4c14ae)['end']();};}function respondWithResult(_0x4d5075,_0x2221a4){_0x2221a4=_0x2221a4||0xc8;return function(_0x83aaa3){if(_0x83aaa3){return _0x4d5075[_0xf20a('0x19')](_0x2221a4)[_0xf20a('0x1a')](_0x83aaa3);}};}function respondWithFilteredResult(_0x27e347,_0x48e88f){return function(_0x33a2be){if(_0x33a2be){var _0x5ae4e4=typeof _0x48e88f[_0xf20a('0x1b')]===_0xf20a('0x1c')&&typeof _0x48e88f['limit']===_0xf20a('0x1c');var _0x320256=_0x33a2be['count'];var _0x315497=_0x5ae4e4?0x0:_0x48e88f[_0xf20a('0x1b')];var _0x240ac2=_0x5ae4e4?_0x33a2be[_0xf20a('0x1d')]:_0x48e88f['offset']+_0x48e88f[_0xf20a('0x1e')];var _0x1a5b73;if(_0x240ac2>=_0x320256){_0x240ac2=_0x320256;_0x1a5b73=0xc8;}else{_0x1a5b73=0xce;}_0x27e347[_0xf20a('0x19')](_0x1a5b73);return _0x27e347['set'](_0xf20a('0x1f'),_0x315497+'-'+_0x240ac2+'/'+_0x320256)[_0xf20a('0x1a')](_0x33a2be);}return null;};}function patchUpdates(_0x3ce48d){return function(_0x452c66){try{jsonpatch['apply'](_0x452c66,_0x3ce48d,!![]);}catch(_0x3129fc){return BPromise[_0xf20a('0x20')](_0x3129fc);}return _0x452c66[_0xf20a('0x21')]();};}function saveUpdates(_0x47392e,_0x251e43){return function(_0x5e1967){if(_0x5e1967){return _0x5e1967[_0xf20a('0x22')](_0x47392e)[_0xf20a('0x23')](function(_0x2252bc){return _0x2252bc;});}return null;};}function removeEntity(_0x6a589b,_0xb00c1c){return function(_0x5e08f9){if(_0x5e08f9){return _0x5e08f9[_0xf20a('0x24')]()[_0xf20a('0x23')](function(){_0x6a589b['status'](0xcc)[_0xf20a('0x25')]();});}};}function handleEntityNotFound(_0x4a1edb,_0x5b601e){return function(_0x2e7cfd){if(!_0x2e7cfd){_0x4a1edb['sendStatus'](0x194);}return _0x2e7cfd;};}function handleError(_0x2460ed,_0x2f6996){_0x2f6996=_0x2f6996||0x1f4;return function(_0x234c11){logger[_0xf20a('0x26')](_0x234c11[_0xf20a('0x27')]);if(_0x234c11[_0xf20a('0x28')]){delete _0x234c11[_0xf20a('0x28')];}_0x2460ed[_0xf20a('0x19')](_0x2f6996)['send'](_0x234c11);};}exports[_0xf20a('0x29')]=function(_0x5e6aa6,_0x28f74b){var _0x1fb527={},_0x20dbf1={},_0x1d0286={'count':0x0,'rows':[]};var _0x2a95f8=_[_0xf20a('0x2a')](db[_0xf20a('0x2b')]['rawAttributes'],function(_0x120ede){return{'name':_0x120ede[_0xf20a('0x2c')],'type':_0x120ede[_0xf20a('0x2d')][_0xf20a('0x2e')]};});_0x20dbf1['model']=_['map'](_0x2a95f8,_0xf20a('0x28'));_0x20dbf1['query']=_[_0xf20a('0x2f')](_0x5e6aa6[_0xf20a('0x30')]);_0x20dbf1[_0xf20a('0x31')]=_[_0xf20a('0x32')](_0x20dbf1['model'],_0x20dbf1['query']);_0x1fb527[_0xf20a('0x33')]=_['intersection'](_0x20dbf1[_0xf20a('0x34')],qs['fields'](_0x5e6aa6[_0xf20a('0x30')][_0xf20a('0x35')]));_0x1fb527[_0xf20a('0x33')]=_0x1fb527['attributes'][_0xf20a('0x36')]?_0x1fb527[_0xf20a('0x33')]:_0x20dbf1['model'];if(!_0x5e6aa6['query']['hasOwnProperty'](_0xf20a('0x37'))){_0x1fb527['limit']=qs['limit'](_0x5e6aa6[_0xf20a('0x30')]['limit']);_0x1fb527[_0xf20a('0x1b')]=qs[_0xf20a('0x1b')](_0x5e6aa6[_0xf20a('0x30')][_0xf20a('0x1b')]);}_0x1fb527[_0xf20a('0x38')]=qs[_0xf20a('0x39')](_0x5e6aa6[_0xf20a('0x30')][_0xf20a('0x39')]);_0x1fb527['where']=qs['filters'](_[_0xf20a('0x3a')](_0x5e6aa6[_0xf20a('0x30')],_0x20dbf1[_0xf20a('0x31')]),_0x2a95f8);if(_0x5e6aa6[_0xf20a('0x30')][_0xf20a('0x3b')]){_0x1fb527[_0xf20a('0x3c')]=_[_0xf20a('0x3d')](_0x1fb527[_0xf20a('0x3c')],{'$or':_[_0xf20a('0x2a')](_0x2a95f8,function(_0x103f62){if(_0x103f62['type']!==_0xf20a('0x3e')){var _0x145068={};_0x145068[_0x103f62[_0xf20a('0x28')]]={'$like':'%'+_0x5e6aa6[_0xf20a('0x30')][_0xf20a('0x3b')]+'%'};return _0x145068;}})});}_0x1fb527=_[_0xf20a('0x3d')]({},_0x1fb527,_0x5e6aa6[_0xf20a('0x3f')]);var _0x205699={'where':_0x1fb527[_0xf20a('0x3c')]};return db[_0xf20a('0x2b')][_0xf20a('0x1d')](_0x205699)['then'](function(_0x4cf812){_0x1d0286[_0xf20a('0x1d')]=_0x4cf812;if(_0x5e6aa6[_0xf20a('0x30')]['includeAll']){_0x1fb527[_0xf20a('0x40')]=[{'all':!![]}];}return db[_0xf20a('0x2b')]['findAll'](_0x1fb527);})[_0xf20a('0x23')](function(_0x171674){_0x1d0286[_0xf20a('0x41')]=_0x171674;return _0x1d0286;})[_0xf20a('0x23')](respondWithFilteredResult(_0x28f74b,_0x1fb527))[_0xf20a('0x42')](handleError(_0x28f74b,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index e2ad1de..8770393 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 _0xf3f1=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./migration.attributes','Migration','lodash','util'];(function(_0x57318d,_0x16bc7e){var _0x28c146=function(_0x40b0f9){while(--_0x40b0f9){_0x57318d['push'](_0x57318d['shift']());}};_0x28c146(++_0x16bc7e);}(_0xf3f1,0x169));var _0x1f3f=function(_0x368587,_0x1b6554){_0x368587=_0x368587-0x0;var _0x42d33c=_0xf3f1[_0x368587];return _0x42d33c;};'use strict';var _=require(_0x1f3f('0x0'));var util=require(_0x1f3f('0x1'));var logger=require(_0x1f3f('0x2'))(_0x1f3f('0x3'));var moment=require('moment');var BPromise=require(_0x1f3f('0x4'));var rp=require(_0x1f3f('0x5'));var fs=require('fs');var path=require(_0x1f3f('0x6'));var rimraf=require(_0x1f3f('0x7'));var config=require(_0x1f3f('0x8'));var attributes=require(_0x1f3f('0x9'));module['exports']=function(_0x517aa1,_0x28a2d8){return _0x517aa1['define'](_0x1f3f('0xa'),attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9e56=['./migration.attributes','exports','define','Migration','migrations','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x45b7d3,_0x32f9da){var _0x342d3c=function(_0x19fa67){while(--_0x19fa67){_0x45b7d3['push'](_0x45b7d3['shift']());}};_0x342d3c(++_0x32f9da);}(_0x9e56,0x1b5));var _0x69e5=function(_0x2bf5d1,_0x14e28f){_0x2bf5d1=_0x2bf5d1-0x0;var _0x3472c6=_0x9e56[_0x2bf5d1];return _0x3472c6;};'use strict';var _=require(_0x69e5('0x0'));var util=require('util');var logger=require(_0x69e5('0x1'))('api');var moment=require(_0x69e5('0x2'));var BPromise=require(_0x69e5('0x3'));var rp=require(_0x69e5('0x4'));var fs=require('fs');var path=require(_0x69e5('0x5'));var rimraf=require(_0x69e5('0x6'));var config=require('../../config/environment');var attributes=require(_0x69e5('0x7'));module[_0x69e5('0x8')]=function(_0x3795e0,_0x12f181){return _0x3795e0[_0x69e5('0x9')](_0x69e5('0xa'),attributes,{'tableName':_0x69e5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index f7508bb..7ed5beb 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 _0x7fce=['Migration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','client','then','info','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','error'];(function(_0xe299ae,_0x494c4b){var _0x258685=function(_0x598a46){while(--_0x598a46){_0xe299ae['push'](_0xe299ae['shift']());}};_0x258685(++_0x494c4b);}(_0x7fce,0xdc));var _0xe7fc=function(_0x14b44c,_0x5056ca){_0x14b44c=_0x14b44c-0x0;var _0x1c205f=_0x7fce[_0x14b44c];return _0x1c205f;};'use strict';var _=require(_0xe7fc('0x0'));var util=require(_0xe7fc('0x1'));var moment=require(_0xe7fc('0x2'));var BPromise=require('bluebird');var rs=require(_0xe7fc('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe7fc('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe7fc('0x5'))(_0xe7fc('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe7fc('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4665f6,_0x161dca,_0x296b2e){return new BPromise(function(_0x19eeef,_0x22fabf){return client['request'](_0x4665f6,_0x296b2e)[_0xe7fc('0x8')](function(_0x4a1209){logger[_0xe7fc('0x9')]('Migration,\x20%s,\x20%s',_0x161dca,_0xe7fc('0xa'));logger[_0xe7fc('0xb')](_0xe7fc('0xc'),_0x161dca,_0xe7fc('0xa'),JSON['stringify'](_0x4a1209));if(_0x4a1209[_0xe7fc('0xd')]){if(_0x4a1209[_0xe7fc('0xd')]['code']===0x1f4){logger['error'](_0xe7fc('0xe'),_0x161dca,_0x4a1209['error'][_0xe7fc('0xf')]);return _0x22fabf(_0x4a1209['error']['message']);}logger[_0xe7fc('0xd')](_0xe7fc('0xe'),_0x161dca,_0x4a1209[_0xe7fc('0xd')][_0xe7fc('0xf')]);return _0x19eeef(_0x4a1209[_0xe7fc('0xd')]['message']);}else{logger[_0xe7fc('0x9')]('Migration,\x20%s,\x20%s',_0x161dca,'request\x20sent');_0x19eeef(_0x4a1209[_0xe7fc('0x10')][_0xe7fc('0xf')]);}})[_0xe7fc('0x11')](function(_0x3a44a6){logger['error']('Migration,\x20%s,\x20%s',_0x161dca,_0x3a44a6);_0x22fabf(_0x3a44a6);});});} \ No newline at end of file +var _0x938c=['catch','lodash','util','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','Migration,\x20%s,\x20%s','message','info','result'];(function(_0x20f5f4,_0x1df8a7){var _0x1f1ffc=function(_0x451058){while(--_0x451058){_0x20f5f4['push'](_0x20f5f4['shift']());}};_0x1f1ffc(++_0x1df8a7);}(_0x938c,0x11f));var _0xc938=function(_0x20384b,_0x49bd10){_0x20384b=_0x20384b-0x0;var _0x32733e=_0x938c[_0x20384b];return _0x32733e;};'use strict';var _=require(_0xc938('0x0'));var util=require(_0xc938('0x1'));var moment=require('moment');var BPromise=require(_0xc938('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc938('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xc938('0x4'))(_0xc938('0x5'));var config=require(_0xc938('0x6'));var jayson=require(_0xc938('0x7'));var client=jayson[_0xc938('0x8')][_0xc938('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5c08fe,_0x384ff3,_0x6e8871){return new BPromise(function(_0x52fbb1,_0x3037f1){return client[_0xc938('0xa')](_0x5c08fe,_0x6e8871)['then'](function(_0x1bfe72){logger['info']('Migration,\x20%s,\x20%s',_0x384ff3,_0xc938('0xb'));logger[_0xc938('0xc')](_0xc938('0xd'),_0x384ff3,'request\x20sent',JSON[_0xc938('0xe')](_0x1bfe72));if(_0x1bfe72[_0xc938('0xf')]){if(_0x1bfe72['error'][_0xc938('0x10')]===0x1f4){logger['error'](_0xc938('0x11'),_0x384ff3,_0x1bfe72[_0xc938('0xf')][_0xc938('0x12')]);return _0x3037f1(_0x1bfe72['error'][_0xc938('0x12')]);}logger[_0xc938('0xf')](_0xc938('0x11'),_0x384ff3,_0x1bfe72['error']['message']);return _0x52fbb1(_0x1bfe72['error'][_0xc938('0x12')]);}else{logger[_0xc938('0x13')](_0xc938('0x11'),_0x384ff3,'request\x20sent');_0x52fbb1(_0x1bfe72[_0xc938('0x14')]['message']);}})[_0xc938('0x15')](function(_0x4b68be){logger['error'](_0xc938('0x11'),_0x384ff3,_0x4b68be);_0x3037f1(_0x4b68be);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 8f8ce2e..f4b42be 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 _0x078a=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','post','create','update','delete','destroy'];(function(_0x2db237,_0x2f4dfa){var _0xae6db8=function(_0x2cf86a){while(--_0x2cf86a){_0x2db237['push'](_0x2db237['shift']());}};_0xae6db8(++_0x2f4dfa);}(_0x078a,0x12d));var _0xa078=function(_0x141eff,_0x16776c){_0x141eff=_0x141eff-0x0;var _0x35841f=_0x078a[_0x141eff];return _0x35841f;};'use strict';var multer=require(_0xa078('0x0'));var util=require(_0xa078('0x1'));var path=require(_0xa078('0x2'));var timeout=require(_0xa078('0x3'));var express=require(_0xa078('0x4'));var router=express[_0xa078('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xa078('0x6'));var interaction=require(_0xa078('0x7'));var config=require(_0xa078('0x8'));var controller=require('./network.controller');router[_0xa078('0x9')]('/',auth['isAuthenticated'](),controller[_0xa078('0xa')]);router[_0xa078('0x9')](_0xa078('0xb'),auth[_0xa078('0xc')](),controller[_0xa078('0xd')]);router[_0xa078('0xe')]('/',auth[_0xa078('0xc')](),controller[_0xa078('0xf')]);router['put'](_0xa078('0xb'),auth[_0xa078('0xc')](),controller[_0xa078('0x10')]);router[_0xa078('0x11')]('/:id',auth[_0xa078('0xc')](),controller[_0xa078('0x12')]);module[_0xa078('0x13')]=router; \ No newline at end of file +var _0x4dcb=['isAuthenticated','get','/:id','show','post','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x53acc9,_0x468a45){var _0x10cd02=function(_0x536b3f){while(--_0x536b3f){_0x53acc9['push'](_0x53acc9['shift']());}};_0x10cd02(++_0x468a45);}(_0x4dcb,0x186));var _0xb4dc=function(_0x22d034,_0x1c203b){_0x22d034=_0x22d034-0x0;var _0x2a38a0=_0x4dcb[_0x22d034];return _0x2a38a0;};'use strict';var multer=require('multer');var util=require(_0xb4dc('0x0'));var path=require(_0xb4dc('0x1'));var timeout=require(_0xb4dc('0x2'));var express=require(_0xb4dc('0x3'));var router=express[_0xb4dc('0x4')]();var fs_extra=require(_0xb4dc('0x5'));var auth=require(_0xb4dc('0x6'));var interaction=require(_0xb4dc('0x7'));var config=require(_0xb4dc('0x8'));var controller=require('./network.controller');router['get']('/',auth[_0xb4dc('0x9')](),controller['index']);router[_0xb4dc('0xa')](_0xb4dc('0xb'),auth[_0xb4dc('0x9')](),controller[_0xb4dc('0xc')]);router[_0xb4dc('0xd')]('/',auth[_0xb4dc('0x9')](),controller['create']);router[_0xb4dc('0xe')](_0xb4dc('0xb'),auth[_0xb4dc('0x9')](),controller[_0xb4dc('0xf')]);router[_0xb4dc('0x10')](_0xb4dc('0xb'),auth[_0xb4dc('0x9')](),controller[_0xb4dc('0x11')]);module[_0xb4dc('0x12')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 32569f5..2011fbb 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 _0x9b1d=['turn','STRING','sequelize','exports','ENUM','localnet','externip','stun'];(function(_0x49bd66,_0x114f96){var _0x7a7c08=function(_0x96a3d1){while(--_0x96a3d1){_0x49bd66['push'](_0x49bd66['shift']());}};_0x7a7c08(++_0x114f96);}(_0x9b1d,0x9a));var _0xd9b1=function(_0x12e020,_0x3e35cb){_0x12e020=_0x12e020-0x0;var _0x37d087=_0x9b1d[_0x12e020];return _0x37d087;};'use strict';var Sequelize=require(_0xd9b1('0x0'));module[_0xd9b1('0x1')]={'type':{'type':Sequelize[_0xd9b1('0x2')](_0xd9b1('0x3'),_0xd9b1('0x4'),_0xd9b1('0x5'),_0xd9b1('0x6'))},'value':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xd9b1('0x7')]},'password':{'type':Sequelize[_0xd9b1('0x7')]}}; \ No newline at end of file +var _0x5c91=['STRING','sequelize','externip','stun'];(function(_0x298f26,_0x20cbf2){var _0x4bd7a8=function(_0x20b180){while(--_0x20b180){_0x298f26['push'](_0x298f26['shift']());}};_0x4bd7a8(++_0x20cbf2);}(_0x5c91,0x1e9));var _0x15c9=function(_0x546a62,_0x5def7c){_0x546a62=_0x546a62-0x0;var _0x381628=_0x5c91[_0x546a62];return _0x381628;};'use strict';var Sequelize=require(_0x15c9('0x0'));module['exports']={'type':{'type':Sequelize['ENUM']('localnet',_0x15c9('0x1'),_0x15c9('0x2'),'turn')},'value':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x15c9('0x3')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index c9c877c..5342817 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 _0x1d1a=['rimraf','zip-dir','fast-json-patch','moment','util','to-csv','fs-extra','lodash','squel','jsforce','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','http','request','then','Network,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','stack','name','index','map','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','Network','includeAll','include','findAll','rows','show','params','keys','find','create','transaction','body','toUpperCase','STUN','root','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','TURN','readFileSync','/etc/asterisk/turn_xcally.conf','res_stun_monitor.so','join','server/files/templates/network.ejs','format','chan_sip.so','update','sequelize','server/files/templates/stun_multiple.ejs','server/files/templates/turn_multiple.ejs','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','destroy','eml-format'];(function(_0x23d2f1,_0x265017){var _0x4aa0a6=function(_0x1499bc){while(--_0x1499bc){_0x23d2f1['push'](_0x23d2f1['shift']());}};_0x4aa0a6(++_0x265017);}(_0x1d1a,0x1da));var _0xa1d1=function(_0x110b70,_0x41e5a2){_0x110b70=_0x110b70-0x0;var _0x46297d=_0x1d1a[_0x110b70];return _0x46297d;};'use strict';var emlformat=require(_0xa1d1('0x0'));var rimraf=require(_0xa1d1('0x1'));var zipdir=require(_0xa1d1('0x2'));var jsonpatch=require(_0xa1d1('0x3'));var rp=require('request-promise');var moment=require(_0xa1d1('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa1d1('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xa1d1('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa1d1('0x7'));var _=require(_0xa1d1('0x8'));var squel=require(_0xa1d1('0x9'));var crypto=require('crypto');var jsforce=require(_0xa1d1('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xa1d1('0x6'));var querystring=require(_0xa1d1('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa1d1('0xc'));var as=require(_0xa1d1('0xd'));var hardwareService=require(_0xa1d1('0xe'));var logger=require(_0xa1d1('0xf'))('api');var utils=require(_0xa1d1('0x10'));var config=require(_0xa1d1('0x11'));var licenseUtil=require(_0xa1d1('0x12'));var db=require('../../mysqldb')['db'];var jayson=require(_0xa1d1('0x13'));var client=jayson[_0xa1d1('0x14')][_0xa1d1('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x55d7f2,_0x5c5aa8,_0xd5ba9,_0x5e1ee4){return new BPromise(function(_0x9d333f,_0x1ca2bf){var _0x4548d2=_0x5e1ee4||client;return _0x4548d2[_0xa1d1('0x16')](_0x55d7f2,_0xd5ba9)[_0xa1d1('0x17')](function(_0x252bdd){logger['info'](_0xa1d1('0x18'),_0x5c5aa8,'request\x20sent');logger['debug']('Network,\x20%s,\x20%s,\x20%s',_0x5c5aa8,_0xa1d1('0x19'),JSON[_0xa1d1('0x1a')](_0x252bdd));if(_0x252bdd[_0xa1d1('0x1b')]){if(_0x252bdd['error']['code']===0x1f4){logger[_0xa1d1('0x1b')](_0xa1d1('0x18'),_0x5c5aa8,_0x252bdd[_0xa1d1('0x1b')][_0xa1d1('0x1c')]);return _0x1ca2bf(_0x252bdd[_0xa1d1('0x1b')]['message']);}logger[_0xa1d1('0x1b')]('Network,\x20%s,\x20%s',_0x5c5aa8,_0x252bdd[_0xa1d1('0x1b')]['message']);return _0x9d333f(_0x252bdd[_0xa1d1('0x1b')][_0xa1d1('0x1c')]);}else{logger['info'](_0xa1d1('0x18'),_0x5c5aa8,_0xa1d1('0x19'));_0x9d333f(_0x252bdd['result'][_0xa1d1('0x1c')]);}})[_0xa1d1('0x1d')](function(_0x340874){logger[_0xa1d1('0x1b')](_0xa1d1('0x18'),_0x5c5aa8,_0x340874);_0x1ca2bf(_0x340874);});});}function respondWithStatusCode(_0x330dda,_0x1553bb){_0x1553bb=_0x1553bb||0xcc;return function(_0x2607f3){if(_0x2607f3){return _0x330dda['sendStatus'](_0x1553bb);}return _0x330dda[_0xa1d1('0x1e')](_0x1553bb)[_0xa1d1('0x1f')]();};}function respondWithResult(_0xe9dff1,_0x331ef5){_0x331ef5=_0x331ef5||0xc8;return function(_0x394005){if(_0x394005){return _0xe9dff1['status'](_0x331ef5)[_0xa1d1('0x20')](_0x394005);}};}function respondWithFilteredResult(_0x5296da,_0x2d0fad){return function(_0x307188){if(_0x307188){var _0x120aa6=typeof _0x2d0fad[_0xa1d1('0x21')]===_0xa1d1('0x22')&&typeof _0x2d0fad[_0xa1d1('0x23')]==='undefined';var _0xe9af53=_0x307188[_0xa1d1('0x24')];var _0x1a89fe=_0x120aa6?0x0:_0x2d0fad[_0xa1d1('0x21')];var _0x629cb7=_0x120aa6?_0x307188[_0xa1d1('0x24')]:_0x2d0fad[_0xa1d1('0x21')]+_0x2d0fad[_0xa1d1('0x23')];var _0x33efe0;if(_0x629cb7>=_0xe9af53){_0x629cb7=_0xe9af53;_0x33efe0=0xc8;}else{_0x33efe0=0xce;}_0x5296da[_0xa1d1('0x1e')](_0x33efe0);return _0x5296da[_0xa1d1('0x25')](_0xa1d1('0x26'),_0x1a89fe+'-'+_0x629cb7+'/'+_0xe9af53)[_0xa1d1('0x20')](_0x307188);}return null;};}function patchUpdates(_0x16c386){return function(_0x286103){try{jsonpatch['apply'](_0x286103,_0x16c386,!![]);}catch(_0x3244c2){return BPromise[_0xa1d1('0x27')](_0x3244c2);}return _0x286103[_0xa1d1('0x28')]();};}function saveUpdates(_0x1055c6,_0x74903e){return function(_0x3bdba6){if(_0x3bdba6){return _0x3bdba6['update'](_0x1055c6)[_0xa1d1('0x17')](function(_0x3bcf35){return _0x3bcf35;});}return null;};}function removeEntity(_0x11e02b,_0x3ec4bc){return function(_0x5d775c){if(_0x5d775c){return _0x5d775c['destroy']()[_0xa1d1('0x17')](function(){_0x11e02b['status'](0xcc)[_0xa1d1('0x1f')]();});}};}function handleEntityNotFound(_0x2a4108,_0x2ada48){return function(_0x5b9465){if(!_0x5b9465){_0x2a4108['sendStatus'](0x194);}return _0x5b9465;};}function handleError(_0x29b6c5,_0x127e37){_0x127e37=_0x127e37||0x1f4;return function(_0x2e7087){logger[_0xa1d1('0x1b')](_0x2e7087[_0xa1d1('0x29')]);if(_0x2e7087[_0xa1d1('0x2a')]){delete _0x2e7087[_0xa1d1('0x2a')];}_0x29b6c5[_0xa1d1('0x1e')](_0x127e37)['send'](_0x2e7087);};}exports[_0xa1d1('0x2b')]=function(_0x5347c8,_0x23d2f4){var _0x7ada9c={},_0x491ccc={},_0x20f4f5={'count':0x0,'rows':[]};var _0x9e49c8=_[_0xa1d1('0x2c')](db['Network'][_0xa1d1('0x2d')],function(_0x2fabbf){return{'name':_0x2fabbf['fieldName'],'type':_0x2fabbf[_0xa1d1('0x2e')][_0xa1d1('0x2f')]};});_0x491ccc[_0xa1d1('0x30')]=_['map'](_0x9e49c8,_0xa1d1('0x2a'));_0x491ccc['query']=_['keys'](_0x5347c8[_0xa1d1('0x31')]);_0x491ccc[_0xa1d1('0x32')]=_[_0xa1d1('0x33')](_0x491ccc[_0xa1d1('0x30')],_0x491ccc['query']);_0x7ada9c[_0xa1d1('0x34')]=_['intersection'](_0x491ccc[_0xa1d1('0x30')],qs[_0xa1d1('0x35')](_0x5347c8[_0xa1d1('0x31')][_0xa1d1('0x35')]));_0x7ada9c['attributes']=_0x7ada9c['attributes'][_0xa1d1('0x36')]?_0x7ada9c['attributes']:_0x491ccc['model'];if(!_0x5347c8['query'][_0xa1d1('0x37')]('nolimit')){_0x7ada9c[_0xa1d1('0x23')]=qs[_0xa1d1('0x23')](_0x5347c8[_0xa1d1('0x31')][_0xa1d1('0x23')]);_0x7ada9c[_0xa1d1('0x21')]=qs[_0xa1d1('0x21')](_0x5347c8[_0xa1d1('0x31')][_0xa1d1('0x21')]);}_0x7ada9c[_0xa1d1('0x38')]=qs['sort'](_0x5347c8['query'][_0xa1d1('0x39')]);_0x7ada9c[_0xa1d1('0x3a')]=qs[_0xa1d1('0x32')](_['pick'](_0x5347c8[_0xa1d1('0x31')],_0x491ccc[_0xa1d1('0x32')]),_0x9e49c8);if(_0x5347c8[_0xa1d1('0x31')][_0xa1d1('0x3b')]){_0x7ada9c[_0xa1d1('0x3a')]=_['merge'](_0x7ada9c['where'],{'$or':_[_0xa1d1('0x2c')](_0x9e49c8,function(_0xa03ebd){if(_0xa03ebd[_0xa1d1('0x2e')]!=='VIRTUAL'){var _0x2c8f18={};_0x2c8f18[_0xa03ebd['name']]={'$like':'%'+_0x5347c8[_0xa1d1('0x31')][_0xa1d1('0x3b')]+'%'};return _0x2c8f18;}})});}_0x7ada9c=_['merge']({},_0x7ada9c,_0x5347c8['options']);var _0x2cab09={'where':_0x7ada9c[_0xa1d1('0x3a')]};return db[_0xa1d1('0x3c')][_0xa1d1('0x24')](_0x2cab09)[_0xa1d1('0x17')](function(_0x5dee14){_0x20f4f5[_0xa1d1('0x24')]=_0x5dee14;if(_0x5347c8[_0xa1d1('0x31')][_0xa1d1('0x3d')]){_0x7ada9c[_0xa1d1('0x3e')]=[{'all':!![]}];}return db[_0xa1d1('0x3c')][_0xa1d1('0x3f')](_0x7ada9c);})['then'](function(_0x2f0140){_0x20f4f5[_0xa1d1('0x40')]=_0x2f0140;return _0x20f4f5;})[_0xa1d1('0x17')](respondWithFilteredResult(_0x23d2f4,_0x7ada9c))[_0xa1d1('0x1d')](handleError(_0x23d2f4,null));};exports[_0xa1d1('0x41')]=function(_0x17201d,_0xf845ee){var _0x1c637c={'raw':!![],'where':{'id':_0x17201d[_0xa1d1('0x42')]['id']}},_0x237bc4={};_0x237bc4['model']=_[_0xa1d1('0x43')](db[_0xa1d1('0x3c')][_0xa1d1('0x2d')]);_0x237bc4[_0xa1d1('0x31')]=_['keys'](_0x17201d[_0xa1d1('0x31')]);_0x237bc4[_0xa1d1('0x32')]=_['intersection'](_0x237bc4[_0xa1d1('0x30')],_0x237bc4[_0xa1d1('0x31')]);_0x1c637c['attributes']=_[_0xa1d1('0x33')](_0x237bc4[_0xa1d1('0x30')],qs[_0xa1d1('0x35')](_0x17201d[_0xa1d1('0x31')][_0xa1d1('0x35')]));_0x1c637c[_0xa1d1('0x34')]=_0x1c637c[_0xa1d1('0x34')][_0xa1d1('0x36')]?_0x1c637c[_0xa1d1('0x34')]:_0x237bc4[_0xa1d1('0x30')];if(_0x17201d[_0xa1d1('0x31')][_0xa1d1('0x3d')]){_0x1c637c['include']=[{'all':!![]}];}_0x1c637c=_['merge']({},_0x1c637c,_0x17201d['options']);return db['Network'][_0xa1d1('0x44')](_0x1c637c)['then'](handleEntityNotFound(_0xf845ee,null))[_0xa1d1('0x17')](respondWithResult(_0xf845ee,null))['catch'](handleError(_0xf845ee,null));};exports[_0xa1d1('0x45')]=function(_0x475bf8,_0x5c1c23,_0x5dcb6b){var _0x1f05c7;return db['sequelize'][_0xa1d1('0x46')](function(_0x290918){return db[_0xa1d1('0x3c')][_0xa1d1('0x45')](_0x475bf8[_0xa1d1('0x47')],{'raw':!![]})[_0xa1d1('0x17')](function(_0x495fd8){_0x1f05c7=_0x495fd8;return db[_0xa1d1('0x3c')][_0xa1d1('0x3f')]({'where':{'type':_0x475bf8['body'][_0xa1d1('0x2e')]},'raw':!![]});})[_0xa1d1('0x17')](function(_0x495426){if(_0x1f05c7['type'][_0xa1d1('0x48')]()==_0xa1d1('0x49')){var _0xd74d99=fs['readFileSync'](path['join'](config[_0xa1d1('0x4a')],'server/files/templates/stun_multiple.ejs'),_0xa1d1('0x4b'));var _0x56d77=ejs[_0xa1d1('0x4c')](_0xd74d99,{'networks':_0x495426||[]});fs[_0xa1d1('0x4d')](_0xa1d1('0x4e'),_0x56d77);return respondWithRpcPromise(_0xa1d1('0x4f'),_0xa1d1('0x45'),{'module':'res_stun_monitor.so'});}else if(_0x1f05c7[_0xa1d1('0x2e')]['toUpperCase']()==_0xa1d1('0x50')){var _0x599cf7=fs[_0xa1d1('0x51')](path['join'](config[_0xa1d1('0x4a')],'server/files/templates/turn_multiple.ejs'),_0xa1d1('0x4b'));var _0x45799a=ejs[_0xa1d1('0x4c')](_0x599cf7,{'networks':_0x495426||[]});fs[_0xa1d1('0x4d')](_0xa1d1('0x52'),_0x45799a);return respondWithRpcPromise(_0xa1d1('0x4f'),'create',{'module':_0xa1d1('0x53')});}else{var _0x436577=fs[_0xa1d1('0x51')](path[_0xa1d1('0x54')](config[_0xa1d1('0x4a')],_0xa1d1('0x55')),_0xa1d1('0x4b'));var _0x2b17b1=ejs[_0xa1d1('0x4c')](_0x436577,{'networks':_0x495426||[]});fs[_0xa1d1('0x4d')](util[_0xa1d1('0x56')]('/etc/asterisk/sip_xcally_%s.conf',_0x475bf8[_0xa1d1('0x47')][_0xa1d1('0x2e')]['toLowerCase']()),_0x2b17b1);return respondWithRpcPromise('Reload',_0xa1d1('0x45'),{'module':_0xa1d1('0x57')});}return null;})[_0xa1d1('0x17')](function(){return _0x1f05c7;});})[_0xa1d1('0x17')](respondWithResult(_0x5c1c23,0xc9))[_0xa1d1('0x1d')](handleError(_0x5c1c23,null));};exports[_0xa1d1('0x58')]=function(_0x291caa,_0x1a905c,_0x5f54f1){var _0x2fab26;return db[_0xa1d1('0x59')][_0xa1d1('0x46')](function(_0x7a6a7d){return db[_0xa1d1('0x3c')][_0xa1d1('0x44')]({'where':{'id':_0x291caa[_0xa1d1('0x42')]['id']}})[_0xa1d1('0x17')](handleEntityNotFound(_0x1a905c,null))[_0xa1d1('0x17')](saveUpdates(_0x291caa[_0xa1d1('0x47')],null))[_0xa1d1('0x17')](function(_0x1d527d){if(_0x1d527d){_0x2fab26=_0x1d527d;return db[_0xa1d1('0x3c')][_0xa1d1('0x3f')]({'where':{'type':_0x2fab26[_0xa1d1('0x2e')]},'raw':!![]});}return null;})[_0xa1d1('0x17')](function(_0x3deeff){if(_0x2fab26[_0xa1d1('0x2e')][_0xa1d1('0x48')]()==_0xa1d1('0x49')){var _0x185df9=fs[_0xa1d1('0x51')](path[_0xa1d1('0x54')](config[_0xa1d1('0x4a')],_0xa1d1('0x5a')),_0xa1d1('0x4b'));var _0x4b507d=ejs[_0xa1d1('0x4c')](_0x185df9,{'networks':_0x3deeff||[]});fs[_0xa1d1('0x4d')](_0xa1d1('0x4e'),_0x4b507d);return respondWithRpcPromise(_0xa1d1('0x4f'),_0xa1d1('0x58'),{'module':_0xa1d1('0x53')});}else if(_0x2fab26['type']['toUpperCase']()=='TURN'){var _0x22f455=fs[_0xa1d1('0x51')](path[_0xa1d1('0x54')](config[_0xa1d1('0x4a')],_0xa1d1('0x5b')),_0xa1d1('0x4b'));var _0x335843=ejs[_0xa1d1('0x4c')](_0x22f455,{'networks':_0x3deeff||[]});fs[_0xa1d1('0x4d')](_0xa1d1('0x52'),_0x335843);return respondWithRpcPromise(_0xa1d1('0x4f'),'update',{'module':_0xa1d1('0x53')});}else{var _0x41c6dc=fs['readFileSync'](path[_0xa1d1('0x54')](config[_0xa1d1('0x4a')],'server/files/templates/network.ejs'),_0xa1d1('0x4b'));var _0x5eac24=ejs[_0xa1d1('0x4c')](_0x41c6dc,{'networks':_0x3deeff||[]});fs[_0xa1d1('0x4d')](util[_0xa1d1('0x56')](_0xa1d1('0x5c'),_0x291caa[_0xa1d1('0x47')]['type'][_0xa1d1('0x5d')]()),_0x5eac24);return respondWithRpcPromise(_0xa1d1('0x4f'),_0xa1d1('0x58'),{'module':_0xa1d1('0x57')});}return null;})[_0xa1d1('0x17')](function(_0x44278a){if(_0x44278a){return _0x2fab26;}return null;});})[_0xa1d1('0x17')](respondWithResult(_0x1a905c,null))[_0xa1d1('0x1d')](handleError(_0x1a905c,null));};exports[_0xa1d1('0x5e')]=function(_0x103650,_0x343f5a,_0x9f74f){var _0x3e22b7;return db['Network']['find']({'where':{'id':_0x103650[_0xa1d1('0x42')]['id']}})[_0xa1d1('0x17')](function(_0x4d76ae){_0x3e22b7=_0x4d76ae;return _0x4d76ae;})['then'](handleEntityNotFound(_0x343f5a,null))[_0xa1d1('0x17')](removeEntity(_0x343f5a,null))[_0xa1d1('0x17')](function(){if(_0x3e22b7){return db['Network']['findAll']({'where':{'type':_0x3e22b7['type']},'raw':!![]});}})[_0xa1d1('0x17')](function(_0x3ff0a8){if(_0x3e22b7['type'][_0xa1d1('0x48')]()==_0xa1d1('0x49')){var _0x22cc7a=fs['readFileSync'](path['join'](config[_0xa1d1('0x4a')],'server/files/templates/stun_multiple.ejs'),_0xa1d1('0x4b'));var _0xc92087=ejs[_0xa1d1('0x4c')](_0x22cc7a,{'networks':_0x3ff0a8||[]});fs[_0xa1d1('0x4d')](_0xa1d1('0x4e'),_0xc92087);return respondWithRpcPromise(_0xa1d1('0x4f'),_0xa1d1('0x5e'),{'module':_0xa1d1('0x53')});}else if(_0x3e22b7['type']['toUpperCase']()=='TURN'){var _0xcf3092=fs[_0xa1d1('0x51')](path[_0xa1d1('0x54')](config[_0xa1d1('0x4a')],'server/files/templates/turn_multiple.ejs'),_0xa1d1('0x4b'));var _0x2aecf3=ejs[_0xa1d1('0x4c')](_0xcf3092,{'networks':_0x3ff0a8||[]});fs['writeFileSync'](_0xa1d1('0x52'),_0x2aecf3);return respondWithRpcPromise(_0xa1d1('0x4f'),_0xa1d1('0x5e'),{'module':'res_stun_monitor.so'});}else{var _0x4fb913=fs[_0xa1d1('0x51')](path[_0xa1d1('0x54')](config[_0xa1d1('0x4a')],_0xa1d1('0x55')),_0xa1d1('0x4b'));var _0xc1791b=ejs['render'](_0x4fb913,{'networks':_0x3ff0a8||[]});fs['writeFileSync'](util['format'](_0xa1d1('0x5c'),_0x103650[_0xa1d1('0x47')]['type'][_0xa1d1('0x5d')]()),_0xc1791b);return respondWithRpcPromise(_0xa1d1('0x4f'),_0xa1d1('0x5e'),{'module':'chan_sip.so'});}return null;})[_0xa1d1('0x1d')](handleError(_0x343f5a,null));}; \ No newline at end of file +var _0xd4cc=['fieldName','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','findAll','rows','show','params','include','find','create','body','toUpperCase','STUN','readFileSync','join','server/files/templates/stun_multiple.ejs','utf8','writeFileSync','/etc/asterisk/stun_xcally.conf','TURN','root','render','/etc/asterisk/turn_xcally.conf','Reload','res_stun_monitor.so','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','sequelize','transaction','server/files/templates/turn_multiple.ejs','server/files/templates/network.ejs','destroy','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','jayson/promise','request','then','info','Network,\x20%s,\x20%s','debug','Network,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','send','index','map','Network','rawAttributes'];(function(_0x45fc6a,_0x166adb){var _0x14bcfd=function(_0x3ba718){while(--_0x3ba718){_0x45fc6a['push'](_0x45fc6a['shift']());}};_0x14bcfd(++_0x166adb);}(_0xd4cc,0x114));var _0xcd4c=function(_0x1e4a81,_0x469a98){_0x1e4a81=_0x1e4a81-0x0;var _0xb8d6e7=_0xd4cc[_0x1e4a81];return _0xb8d6e7;};'use strict';var emlformat=require(_0xcd4c('0x0'));var rimraf=require(_0xcd4c('0x1'));var zipdir=require(_0xcd4c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcd4c('0x3'));var moment=require('moment');var BPromise=require(_0xcd4c('0x4'));var Mustache=require(_0xcd4c('0x5'));var util=require(_0xcd4c('0x6'));var path=require(_0xcd4c('0x7'));var sox=require(_0xcd4c('0x8'));var csv=require(_0xcd4c('0x9'));var ejs=require(_0xcd4c('0xa'));var fs=require('fs');var fs_extra=require(_0xcd4c('0xb'));var _=require(_0xcd4c('0xc'));var squel=require('squel');var crypto=require(_0xcd4c('0xd'));var jsforce=require(_0xcd4c('0xe'));var deskjs=require(_0xcd4c('0xf'));var toCsv=require(_0xcd4c('0x9'));var querystring=require(_0xcd4c('0x10'));var Papa=require(_0xcd4c('0x11'));var Redis=require(_0xcd4c('0x12'));var authService=require(_0xcd4c('0x13'));var qs=require(_0xcd4c('0x14'));var as=require(_0xcd4c('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcd4c('0x16'))(_0xcd4c('0x17'));var utils=require(_0xcd4c('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xcd4c('0x19'));var db=require('../../mysqldb')['db'];var jayson=require(_0xcd4c('0x1a'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4473d0,_0x4aa400,_0x101e1f,_0x352fe4){return new BPromise(function(_0x494b43,_0x4db6ca){var _0x4a0240=_0x352fe4||client;return _0x4a0240[_0xcd4c('0x1b')](_0x4473d0,_0x101e1f)[_0xcd4c('0x1c')](function(_0x2a5d03){logger[_0xcd4c('0x1d')](_0xcd4c('0x1e'),_0x4aa400,'request\x20sent');logger[_0xcd4c('0x1f')](_0xcd4c('0x20'),_0x4aa400,_0xcd4c('0x21'),JSON[_0xcd4c('0x22')](_0x2a5d03));if(_0x2a5d03[_0xcd4c('0x23')]){if(_0x2a5d03[_0xcd4c('0x23')][_0xcd4c('0x24')]===0x1f4){logger['error']('Network,\x20%s,\x20%s',_0x4aa400,_0x2a5d03[_0xcd4c('0x23')]['message']);return _0x4db6ca(_0x2a5d03['error']['message']);}logger[_0xcd4c('0x23')](_0xcd4c('0x1e'),_0x4aa400,_0x2a5d03[_0xcd4c('0x23')][_0xcd4c('0x25')]);return _0x494b43(_0x2a5d03['error'][_0xcd4c('0x25')]);}else{logger['info'](_0xcd4c('0x1e'),_0x4aa400,_0xcd4c('0x21'));_0x494b43(_0x2a5d03['result'][_0xcd4c('0x25')]);}})[_0xcd4c('0x26')](function(_0x4eb775){logger[_0xcd4c('0x23')](_0xcd4c('0x1e'),_0x4aa400,_0x4eb775);_0x4db6ca(_0x4eb775);});});}function respondWithStatusCode(_0x51d264,_0x454f26){_0x454f26=_0x454f26||0xcc;return function(_0x19c7e1){if(_0x19c7e1){return _0x51d264['sendStatus'](_0x454f26);}return _0x51d264['status'](_0x454f26)[_0xcd4c('0x27')]();};}function respondWithResult(_0x23537d,_0xdd2df1){_0xdd2df1=_0xdd2df1||0xc8;return function(_0x27cf3a){if(_0x27cf3a){return _0x23537d[_0xcd4c('0x28')](_0xdd2df1)[_0xcd4c('0x29')](_0x27cf3a);}};}function respondWithFilteredResult(_0x1e7b0d,_0x218542){return function(_0x256b08){if(_0x256b08){var _0x135db3=typeof _0x218542[_0xcd4c('0x2a')]===_0xcd4c('0x2b')&&typeof _0x218542['limit']==='undefined';var _0xf10f98=_0x256b08[_0xcd4c('0x2c')];var _0x5b703d=_0x135db3?0x0:_0x218542['offset'];var _0x35df2b=_0x135db3?_0x256b08[_0xcd4c('0x2c')]:_0x218542['offset']+_0x218542[_0xcd4c('0x2d')];var _0x2569e6;if(_0x35df2b>=_0xf10f98){_0x35df2b=_0xf10f98;_0x2569e6=0xc8;}else{_0x2569e6=0xce;}_0x1e7b0d[_0xcd4c('0x28')](_0x2569e6);return _0x1e7b0d[_0xcd4c('0x2e')](_0xcd4c('0x2f'),_0x5b703d+'-'+_0x35df2b+'/'+_0xf10f98)[_0xcd4c('0x29')](_0x256b08);}return null;};}function patchUpdates(_0x58eb17){return function(_0x2a5f13){try{jsonpatch[_0xcd4c('0x30')](_0x2a5f13,_0x58eb17,!![]);}catch(_0x5cfc67){return BPromise[_0xcd4c('0x31')](_0x5cfc67);}return _0x2a5f13[_0xcd4c('0x32')]();};}function saveUpdates(_0xce05e1,_0x161540){return function(_0x1c7247){if(_0x1c7247){return _0x1c7247[_0xcd4c('0x33')](_0xce05e1)[_0xcd4c('0x1c')](function(_0x923fae){return _0x923fae;});}return null;};}function removeEntity(_0xb3664,_0x43f4bf){return function(_0x4dba9b){if(_0x4dba9b){return _0x4dba9b['destroy']()[_0xcd4c('0x1c')](function(){_0xb3664[_0xcd4c('0x28')](0xcc)[_0xcd4c('0x27')]();});}};}function handleEntityNotFound(_0x4a9973,_0x4667cd){return function(_0x53a03c){if(!_0x53a03c){_0x4a9973['sendStatus'](0x194);}return _0x53a03c;};}function handleError(_0x121f57,_0x301ae8){_0x301ae8=_0x301ae8||0x1f4;return function(_0x4b15b4){logger[_0xcd4c('0x23')](_0x4b15b4['stack']);if(_0x4b15b4['name']){delete _0x4b15b4['name'];}_0x121f57[_0xcd4c('0x28')](_0x301ae8)[_0xcd4c('0x34')](_0x4b15b4);};}exports[_0xcd4c('0x35')]=function(_0x3c8f2a,_0x1a8808){var _0x4070be={},_0x2dc012={},_0x403028={'count':0x0,'rows':[]};var _0x534ae6=_[_0xcd4c('0x36')](db[_0xcd4c('0x37')][_0xcd4c('0x38')],function(_0x1f81f1){return{'name':_0x1f81f1[_0xcd4c('0x39')],'type':_0x1f81f1['type'][_0xcd4c('0x3a')]};});_0x2dc012[_0xcd4c('0x3b')]=_['map'](_0x534ae6,_0xcd4c('0x3c'));_0x2dc012[_0xcd4c('0x3d')]=_[_0xcd4c('0x3e')](_0x3c8f2a[_0xcd4c('0x3d')]);_0x2dc012[_0xcd4c('0x3f')]=_[_0xcd4c('0x40')](_0x2dc012[_0xcd4c('0x3b')],_0x2dc012[_0xcd4c('0x3d')]);_0x4070be[_0xcd4c('0x41')]=_[_0xcd4c('0x40')](_0x2dc012['model'],qs['fields'](_0x3c8f2a[_0xcd4c('0x3d')][_0xcd4c('0x42')]));_0x4070be['attributes']=_0x4070be[_0xcd4c('0x41')][_0xcd4c('0x43')]?_0x4070be['attributes']:_0x2dc012[_0xcd4c('0x3b')];if(!_0x3c8f2a[_0xcd4c('0x3d')][_0xcd4c('0x44')](_0xcd4c('0x45'))){_0x4070be[_0xcd4c('0x2d')]=qs[_0xcd4c('0x2d')](_0x3c8f2a['query']['limit']);_0x4070be[_0xcd4c('0x2a')]=qs[_0xcd4c('0x2a')](_0x3c8f2a[_0xcd4c('0x3d')][_0xcd4c('0x2a')]);}_0x4070be[_0xcd4c('0x46')]=qs[_0xcd4c('0x47')](_0x3c8f2a[_0xcd4c('0x3d')]['sort']);_0x4070be[_0xcd4c('0x48')]=qs[_0xcd4c('0x3f')](_[_0xcd4c('0x49')](_0x3c8f2a[_0xcd4c('0x3d')],_0x2dc012['filters']),_0x534ae6);if(_0x3c8f2a[_0xcd4c('0x3d')]['filter']){_0x4070be['where']=_[_0xcd4c('0x4a')](_0x4070be[_0xcd4c('0x48')],{'$or':_[_0xcd4c('0x36')](_0x534ae6,function(_0x1c80b8){if(_0x1c80b8[_0xcd4c('0x4b')]!==_0xcd4c('0x4c')){var _0xb2484c={};_0xb2484c[_0x1c80b8['name']]={'$like':'%'+_0x3c8f2a[_0xcd4c('0x3d')][_0xcd4c('0x4d')]+'%'};return _0xb2484c;}})});}_0x4070be=_['merge']({},_0x4070be,_0x3c8f2a[_0xcd4c('0x4e')]);var _0x1fb250={'where':_0x4070be[_0xcd4c('0x48')]};return db[_0xcd4c('0x37')][_0xcd4c('0x2c')](_0x1fb250)[_0xcd4c('0x1c')](function(_0x1a09d0){_0x403028['count']=_0x1a09d0;if(_0x3c8f2a[_0xcd4c('0x3d')][_0xcd4c('0x4f')]){_0x4070be['include']=[{'all':!![]}];}return db[_0xcd4c('0x37')][_0xcd4c('0x50')](_0x4070be);})[_0xcd4c('0x1c')](function(_0x12c978){_0x403028[_0xcd4c('0x51')]=_0x12c978;return _0x403028;})['then'](respondWithFilteredResult(_0x1a8808,_0x4070be))[_0xcd4c('0x26')](handleError(_0x1a8808,null));};exports[_0xcd4c('0x52')]=function(_0x381e4e,_0x509b7d){var _0x5514ec={'raw':!![],'where':{'id':_0x381e4e[_0xcd4c('0x53')]['id']}},_0x215a69={};_0x215a69[_0xcd4c('0x3b')]=_['keys'](db[_0xcd4c('0x37')][_0xcd4c('0x38')]);_0x215a69['query']=_[_0xcd4c('0x3e')](_0x381e4e[_0xcd4c('0x3d')]);_0x215a69[_0xcd4c('0x3f')]=_[_0xcd4c('0x40')](_0x215a69[_0xcd4c('0x3b')],_0x215a69[_0xcd4c('0x3d')]);_0x5514ec[_0xcd4c('0x41')]=_[_0xcd4c('0x40')](_0x215a69['model'],qs['fields'](_0x381e4e['query']['fields']));_0x5514ec[_0xcd4c('0x41')]=_0x5514ec['attributes'][_0xcd4c('0x43')]?_0x5514ec[_0xcd4c('0x41')]:_0x215a69[_0xcd4c('0x3b')];if(_0x381e4e[_0xcd4c('0x3d')][_0xcd4c('0x4f')]){_0x5514ec[_0xcd4c('0x54')]=[{'all':!![]}];}_0x5514ec=_[_0xcd4c('0x4a')]({},_0x5514ec,_0x381e4e[_0xcd4c('0x4e')]);return db[_0xcd4c('0x37')][_0xcd4c('0x55')](_0x5514ec)[_0xcd4c('0x1c')](handleEntityNotFound(_0x509b7d,null))[_0xcd4c('0x1c')](respondWithResult(_0x509b7d,null))[_0xcd4c('0x26')](handleError(_0x509b7d,null));};exports[_0xcd4c('0x56')]=function(_0x92c529,_0x22f515,_0x356831){var _0x46378e;return db['sequelize']['transaction'](function(_0x2d02da){return db[_0xcd4c('0x37')][_0xcd4c('0x56')](_0x92c529[_0xcd4c('0x57')],{'raw':!![]})['then'](function(_0x49e9d2){_0x46378e=_0x49e9d2;return db['Network'][_0xcd4c('0x50')]({'where':{'type':_0x92c529[_0xcd4c('0x57')]['type']},'raw':!![]});})[_0xcd4c('0x1c')](function(_0xb84d8e){if(_0x46378e[_0xcd4c('0x4b')][_0xcd4c('0x58')]()==_0xcd4c('0x59')){var _0x2c2aa6=fs[_0xcd4c('0x5a')](path[_0xcd4c('0x5b')](config['root'],_0xcd4c('0x5c')),_0xcd4c('0x5d'));var _0x4f2420=ejs['render'](_0x2c2aa6,{'networks':_0xb84d8e||[]});fs[_0xcd4c('0x5e')](_0xcd4c('0x5f'),_0x4f2420);return respondWithRpcPromise('Reload',_0xcd4c('0x56'),{'module':'res_stun_monitor.so'});}else if(_0x46378e[_0xcd4c('0x4b')][_0xcd4c('0x58')]()==_0xcd4c('0x60')){var _0x158db6=fs[_0xcd4c('0x5a')](path[_0xcd4c('0x5b')](config[_0xcd4c('0x61')],'server/files/templates/turn_multiple.ejs'),'utf8');var _0x3fbb2e=ejs[_0xcd4c('0x62')](_0x158db6,{'networks':_0xb84d8e||[]});fs[_0xcd4c('0x5e')](_0xcd4c('0x63'),_0x3fbb2e);return respondWithRpcPromise(_0xcd4c('0x64'),_0xcd4c('0x56'),{'module':_0xcd4c('0x65')});}else{var _0x33e2c5=fs[_0xcd4c('0x5a')](path['join'](config[_0xcd4c('0x61')],'server/files/templates/network.ejs'),_0xcd4c('0x5d'));var _0x259202=ejs[_0xcd4c('0x62')](_0x33e2c5,{'networks':_0xb84d8e||[]});fs['writeFileSync'](util[_0xcd4c('0x66')](_0xcd4c('0x67'),_0x92c529[_0xcd4c('0x57')][_0xcd4c('0x4b')][_0xcd4c('0x68')]()),_0x259202);return respondWithRpcPromise('Reload',_0xcd4c('0x56'),{'module':_0xcd4c('0x69')});}return null;})[_0xcd4c('0x1c')](function(){return _0x46378e;});})[_0xcd4c('0x1c')](respondWithResult(_0x22f515,0xc9))[_0xcd4c('0x26')](handleError(_0x22f515,null));};exports[_0xcd4c('0x33')]=function(_0x20a162,_0xc6efd7,_0x171cd3){var _0x1179cd;return db[_0xcd4c('0x6a')][_0xcd4c('0x6b')](function(_0x384eee){return db[_0xcd4c('0x37')][_0xcd4c('0x55')]({'where':{'id':_0x20a162[_0xcd4c('0x53')]['id']}})[_0xcd4c('0x1c')](handleEntityNotFound(_0xc6efd7,null))['then'](saveUpdates(_0x20a162[_0xcd4c('0x57')],null))['then'](function(_0x1b5959){if(_0x1b5959){_0x1179cd=_0x1b5959;return db[_0xcd4c('0x37')]['findAll']({'where':{'type':_0x1179cd[_0xcd4c('0x4b')]},'raw':!![]});}return null;})[_0xcd4c('0x1c')](function(_0x715c7c){if(_0x1179cd[_0xcd4c('0x4b')]['toUpperCase']()=='STUN'){var _0x786f12=fs[_0xcd4c('0x5a')](path[_0xcd4c('0x5b')](config[_0xcd4c('0x61')],_0xcd4c('0x5c')),_0xcd4c('0x5d'));var _0x635c98=ejs['render'](_0x786f12,{'networks':_0x715c7c||[]});fs['writeFileSync'](_0xcd4c('0x5f'),_0x635c98);return respondWithRpcPromise(_0xcd4c('0x64'),_0xcd4c('0x33'),{'module':_0xcd4c('0x65')});}else if(_0x1179cd[_0xcd4c('0x4b')][_0xcd4c('0x58')]()==_0xcd4c('0x60')){var _0x3ecec6=fs['readFileSync'](path['join'](config[_0xcd4c('0x61')],_0xcd4c('0x6c')),_0xcd4c('0x5d'));var _0x5603da=ejs[_0xcd4c('0x62')](_0x3ecec6,{'networks':_0x715c7c||[]});fs[_0xcd4c('0x5e')](_0xcd4c('0x63'),_0x5603da);return respondWithRpcPromise(_0xcd4c('0x64'),_0xcd4c('0x33'),{'module':_0xcd4c('0x65')});}else{var _0x358076=fs['readFileSync'](path[_0xcd4c('0x5b')](config[_0xcd4c('0x61')],_0xcd4c('0x6d')),_0xcd4c('0x5d'));var _0x5deb03=ejs[_0xcd4c('0x62')](_0x358076,{'networks':_0x715c7c||[]});fs[_0xcd4c('0x5e')](util[_0xcd4c('0x66')](_0xcd4c('0x67'),_0x20a162[_0xcd4c('0x57')][_0xcd4c('0x4b')]['toLowerCase']()),_0x5deb03);return respondWithRpcPromise(_0xcd4c('0x64'),_0xcd4c('0x33'),{'module':'chan_sip.so'});}return null;})['then'](function(_0x3c01f9){if(_0x3c01f9){return _0x1179cd;}return null;});})[_0xcd4c('0x1c')](respondWithResult(_0xc6efd7,null))[_0xcd4c('0x26')](handleError(_0xc6efd7,null));};exports[_0xcd4c('0x6e')]=function(_0x4daa1e,_0x31f269,_0x342710){var _0xbc22c5;return db[_0xcd4c('0x37')]['find']({'where':{'id':_0x4daa1e['params']['id']}})[_0xcd4c('0x1c')](function(_0x3bb566){_0xbc22c5=_0x3bb566;return _0x3bb566;})[_0xcd4c('0x1c')](handleEntityNotFound(_0x31f269,null))[_0xcd4c('0x1c')](removeEntity(_0x31f269,null))[_0xcd4c('0x1c')](function(){if(_0xbc22c5){return db[_0xcd4c('0x37')][_0xcd4c('0x50')]({'where':{'type':_0xbc22c5[_0xcd4c('0x4b')]},'raw':!![]});}})[_0xcd4c('0x1c')](function(_0x44fe2d){if(_0xbc22c5[_0xcd4c('0x4b')][_0xcd4c('0x58')]()==_0xcd4c('0x59')){var _0x3f1639=fs[_0xcd4c('0x5a')](path['join'](config[_0xcd4c('0x61')],_0xcd4c('0x5c')),_0xcd4c('0x5d'));var _0x5094af=ejs[_0xcd4c('0x62')](_0x3f1639,{'networks':_0x44fe2d||[]});fs[_0xcd4c('0x5e')](_0xcd4c('0x5f'),_0x5094af);return respondWithRpcPromise(_0xcd4c('0x64'),'destroy',{'module':_0xcd4c('0x65')});}else if(_0xbc22c5[_0xcd4c('0x4b')][_0xcd4c('0x58')]()==_0xcd4c('0x60')){var _0x1b6bda=fs[_0xcd4c('0x5a')](path[_0xcd4c('0x5b')](config[_0xcd4c('0x61')],_0xcd4c('0x6c')),_0xcd4c('0x5d'));var _0x133d51=ejs[_0xcd4c('0x62')](_0x1b6bda,{'networks':_0x44fe2d||[]});fs[_0xcd4c('0x5e')]('/etc/asterisk/turn_xcally.conf',_0x133d51);return respondWithRpcPromise(_0xcd4c('0x64'),_0xcd4c('0x6e'),{'module':_0xcd4c('0x65')});}else{var _0x5c9142=fs['readFileSync'](path[_0xcd4c('0x5b')](config['root'],'server/files/templates/network.ejs'),'utf8');var _0x5a28d7=ejs['render'](_0x5c9142,{'networks':_0x44fe2d||[]});fs[_0xcd4c('0x5e')](util[_0xcd4c('0x66')](_0xcd4c('0x67'),_0x4daa1e[_0xcd4c('0x57')][_0xcd4c('0x4b')][_0xcd4c('0x68')]()),_0x5a28d7);return respondWithRpcPromise(_0xcd4c('0x64'),_0xcd4c('0x6e'),{'module':_0xcd4c('0x69')});}return null;})[_0xcd4c('0x26')](handleError(_0x31f269,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 01c2ffc..569edb3 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 _0x0db9=['network','lodash','moment','bluebird','path','../../config/environment','./network.attributes','define','Network'];(function(_0x578801,_0x20ed8b){var _0x55eaf7=function(_0x3f2df2){while(--_0x3f2df2){_0x578801['push'](_0x578801['shift']());}};_0x55eaf7(++_0x20ed8b);}(_0x0db9,0xa3));var _0x90db=function(_0x1ab180,_0x382b2c){_0x1ab180=_0x1ab180-0x0;var _0xfb2c2d=_0x0db9[_0x1ab180];return _0xfb2c2d;};'use strict';var _=require(_0x90db('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x90db('0x1'));var BPromise=require(_0x90db('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x90db('0x3'));var rimraf=require('rimraf');var config=require(_0x90db('0x4'));var attributes=require(_0x90db('0x5'));module['exports']=function(_0x2d02a1,_0x242774){return _0x2d02a1[_0x90db('0x6')](_0x90db('0x7'),attributes,{'tableName':_0x90db('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1ba2=['./network.attributes','exports','Network','network','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x8806f6,_0x5b7a78){var _0x39b458=function(_0x43a9af){while(--_0x43a9af){_0x8806f6['push'](_0x8806f6['shift']());}};_0x39b458(++_0x5b7a78);}(_0x1ba2,0xb4));var _0x21ba=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1ba2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x21ba('0x0'));var util=require('util');var logger=require(_0x21ba('0x1'))('api');var moment=require(_0x21ba('0x2'));var BPromise=require(_0x21ba('0x3'));var rp=require(_0x21ba('0x4'));var fs=require('fs');var path=require(_0x21ba('0x5'));var rimraf=require(_0x21ba('0x6'));var config=require('../../config/environment');var attributes=require(_0x21ba('0x7'));module[_0x21ba('0x8')]=function(_0x4a07e8,_0x10dae1){return _0x4a07e8['define'](_0x21ba('0x9'),attributes,{'tableName':_0x21ba('0xa'),'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 bd3e99d..269c10b 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(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x7a54,0x106));var _0x47a5=function(_0x5c5198,_0x443deb){_0x5c5198=_0x5c5198-0x0;var _0x38a349=_0x7a54[_0x5c5198];return _0x38a349;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x7a54,0x106));var _0x47a5=function(_0xa1c108,_0x48410f){_0xa1c108=_0xa1c108-0x0;var _0x22b292=_0x7a54[_0xa1c108];return _0x22b292;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index d1674dd..df436b6 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 _0x616e=['addAnswer','addAgents','/:id/send','send','put','update','delete','destroy','removeDispositions','removeAgents','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','/:id/interactions','getInteractions','/:id/users','getAgents','post','addDisposition'];(function(_0x20589d,_0x55d5bf){var _0x422de9=function(_0x44cbbb){while(--_0x44cbbb){_0x20589d['push'](_0x20589d['shift']());}};_0x422de9(++_0x55d5bf);}(_0x616e,0x1ae));var _0xe616=function(_0x4bcf38,_0x3c12be){_0x4bcf38=_0x4bcf38-0x0;var _0x4a89be=_0x616e[_0x4bcf38];return _0x4a89be;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe616('0x0'));var timeout=require(_0xe616('0x1'));var express=require('express');var router=express[_0xe616('0x2')]();var fs_extra=require(_0xe616('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xe616('0x4'));var config=require(_0xe616('0x5'));var controller=require(_0xe616('0x6'));router[_0xe616('0x7')]('/',auth[_0xe616('0x8')](),controller[_0xe616('0x9')]);router[_0xe616('0x7')](_0xe616('0xa'),auth['isAuthenticated'](),controller[_0xe616('0xb')]);router[_0xe616('0x7')](_0xe616('0xc'),auth[_0xe616('0x8')](),controller[_0xe616('0xd')]);router[_0xe616('0x7')](_0xe616('0xe'),auth['isAuthenticated'](),controller[_0xe616('0xf')]);router[_0xe616('0x7')](_0xe616('0x10'),auth['isAuthenticated'](),controller[_0xe616('0x11')]);router[_0xe616('0x7')](_0xe616('0x12'),auth['isAuthenticated'](),controller['getApplications']);router['get'](_0xe616('0x13'),auth['isAuthenticated'](),controller[_0xe616('0x14')]);router[_0xe616('0x7')](_0xe616('0x15'),auth[_0xe616('0x8')](),controller[_0xe616('0x16')]);router[_0xe616('0x17')]('/',auth['isAuthenticated'](),controller['create']);router[_0xe616('0x17')](_0xe616('0xe'),auth[_0xe616('0x8')](),controller[_0xe616('0x18')]);router[_0xe616('0x17')]('/:id/canned_answers',auth[_0xe616('0x8')](),controller[_0xe616('0x19')]);router[_0xe616('0x17')]('/:id/notify',controller['notify']);router[_0xe616('0x17')](_0xe616('0x12'),auth[_0xe616('0x8')](),controller['addApplications']);router[_0xe616('0x17')]('/:id/users',auth[_0xe616('0x8')](),controller[_0xe616('0x1a')]);router[_0xe616('0x17')](_0xe616('0x1b'),auth[_0xe616('0x8')](),controller[_0xe616('0x1c')]);router[_0xe616('0x1d')](_0xe616('0xc'),auth['isAuthenticated'](),controller[_0xe616('0x1e')]);router[_0xe616('0x1f')](_0xe616('0xc'),auth[_0xe616('0x8')](),controller[_0xe616('0x20')]);router[_0xe616('0x1f')](_0xe616('0xe'),auth[_0xe616('0x8')](),controller[_0xe616('0x21')]);router[_0xe616('0x1f')](_0xe616('0x10'),auth['isAuthenticated'](),controller['removeAnswers']);router[_0xe616('0x1f')](_0xe616('0x15'),auth['isAuthenticated'](),controller[_0xe616('0x22')]);module['exports']=router; \ No newline at end of file +var _0x3539=['update','destroy','delete','removeAnswers','removeAgents','exports','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','post','addDisposition','addAnswer','/:id/notify','notify','/:id/applications','addApplications','addAgents','/:id/send','send','put'];(function(_0x157170,_0x1adff2){var _0x41dfc4=function(_0x8bb93b){while(--_0x8bb93b){_0x157170['push'](_0x157170['shift']());}};_0x41dfc4(++_0x1adff2);}(_0x3539,0xbf));var _0x9353=function(_0x507239,_0x122b03){_0x507239=_0x507239-0x0;var _0xb6bcd8=_0x3539[_0x507239];return _0xb6bcd8;};'use strict';var multer=require('multer');var util=require(_0x9353('0x0'));var path=require(_0x9353('0x1'));var timeout=require('connect-timeout');var express=require(_0x9353('0x2'));var router=express[_0x9353('0x3')]();var fs_extra=require(_0x9353('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x9353('0x5'));var config=require(_0x9353('0x6'));var controller=require('./openchannelAccount.controller');router[_0x9353('0x7')]('/',auth[_0x9353('0x8')](),controller[_0x9353('0x9')]);router[_0x9353('0x7')]('/describe',auth[_0x9353('0x8')](),controller['describe']);router['get'](_0x9353('0xa'),auth['isAuthenticated'](),controller[_0x9353('0xb')]);router['get'](_0x9353('0xc'),auth[_0x9353('0x8')](),controller['getDispositions']);router[_0x9353('0x7')](_0x9353('0xd'),auth[_0x9353('0x8')](),controller[_0x9353('0xe')]);router[_0x9353('0x7')]('/:id/applications',auth[_0x9353('0x8')](),controller[_0x9353('0xf')]);router['get'](_0x9353('0x10'),auth[_0x9353('0x8')](),controller[_0x9353('0x11')]);router[_0x9353('0x7')](_0x9353('0x12'),auth[_0x9353('0x8')](),controller[_0x9353('0x13')]);router[_0x9353('0x14')]('/',auth['isAuthenticated'](),controller['create']);router[_0x9353('0x14')](_0x9353('0xc'),auth[_0x9353('0x8')](),controller[_0x9353('0x15')]);router[_0x9353('0x14')](_0x9353('0xd'),auth[_0x9353('0x8')](),controller[_0x9353('0x16')]);router[_0x9353('0x14')](_0x9353('0x17'),controller[_0x9353('0x18')]);router['post'](_0x9353('0x19'),auth[_0x9353('0x8')](),controller[_0x9353('0x1a')]);router['post'](_0x9353('0x12'),auth[_0x9353('0x8')](),controller[_0x9353('0x1b')]);router[_0x9353('0x14')](_0x9353('0x1c'),auth[_0x9353('0x8')](),controller[_0x9353('0x1d')]);router[_0x9353('0x1e')]('/:id',auth['isAuthenticated'](),controller[_0x9353('0x1f')]);router['delete'](_0x9353('0xa'),auth[_0x9353('0x8')](),controller[_0x9353('0x20')]);router[_0x9353('0x21')]('/:id/dispositions',auth[_0x9353('0x8')](),controller['removeDispositions']);router[_0x9353('0x21')](_0x9353('0xd'),auth[_0x9353('0x8')](),controller[_0x9353('0x22')]);router['delete'](_0x9353('0x12'),auth[_0x9353('0x8')](),controller[_0x9353('0x23')]);module[_0x9353('0x24')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index a67046d..67d6a4a 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 _0xfa9b=['generate','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','STRING'];(function(_0x14dee7,_0x3df77f){var _0xa683e2=function(_0x6c0bd1){while(--_0x6c0bd1){_0x14dee7['push'](_0x14dee7['shift']());}};_0xa683e2(++_0x3df77f);}(_0xfa9b,0x1dc));var _0xbfa9=function(_0x195451,_0x4ffff4){_0x195451=_0x195451-0x0;var _0x4ad12e=_0xfa9b[_0x195451];return _0x4ad12e;};'use strict';var Sequelize=require(_0xbfa9('0x0'));var rs=require(_0xbfa9('0x1'));module[_0xbfa9('0x2')]={'name':{'type':Sequelize[_0xbfa9('0x3')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xbfa9('0x3')]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xbfa9('0x4')]();}},'replyUri':{'type':Sequelize[_0xbfa9('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xbfa9('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xbfa9('0x5')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xbfa9('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize[_0xbfa9('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xbfa9('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xbfa9('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xbfa9('0x8')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xbfa9('0x9'),'set':function(_0x24815c){if(!_0x24815c)this[_0xbfa9('0xa')]('mandatoryDispositionPauseId',null);this[_0xbfa9('0xa')](_0xbfa9('0xb'),_0x24815c);}}}; \ No newline at end of file +var _0x8c0e=['mandatoryDispositionPauseId','mandatoryDisposition','sequelize','STRING','name','generate','TEXT','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue'];(function(_0x57f62d,_0x2c3e71){var _0x12d610=function(_0x42cbc6){while(--_0x42cbc6){_0x57f62d['push'](_0x57f62d['shift']());}};_0x12d610(++_0x2c3e71);}(_0x8c0e,0x183));var _0xe8c0=function(_0x43aea3,_0xc8b030){_0x43aea3=_0x43aea3-0x0;var _0x3f438d=_0x8c0e[_0x43aea3];return _0x3f438d;};'use strict';var Sequelize=require(_0xe8c0('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize[_0xe8c0('0x1')],'unique':_0xe8c0('0x2'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xe8c0('0x3')]();}},'replyUri':{'type':Sequelize[_0xe8c0('0x1')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xe8c0('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xe8c0('0x4')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xe8c0('0x5')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xe8c0('0x5')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xe8c0('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xe8c0('0x1')]},'queueTransfer':{'type':Sequelize[_0xe8c0('0x5')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xe8c0('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xe8c0('0x5')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xe8c0('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xe8c0('0x6')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xe8c0('0x5')],'defaultValue':![],'comment':_0xe8c0('0x7'),'set':function(_0xb13767){if(!_0xb13767)this[_0xe8c0('0x8')](_0xe8c0('0x9'),null);this[_0xe8c0('0x8')](_0xe8c0('0xa'),_0xb13767);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index c9ade1d..cefe2ad 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 _0x7a68=['dataValues','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','client','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','destroy','get','OpenchannelAccounts','name','send','index','Pause','map','OpenchannelAccount','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','count','includeAll','include','rows','show','params','mandatoryDispositionPause','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','OpenchannelAccountId','getDispositions','rawAttributes','Disposition','findAll','addAnswer','findOne','CannedAnswer','removeAnswers','ids','notify','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','Contacts','DESC','OpenchannelApplication','List','account','applications','orderBy','priority','asc','Applications','ListId','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','spread','messageId','interaction','created','push','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','forcedOwnership','Start','startRouting','EventManager','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','stack','finally','getApplications','options','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','CmList','out','Messages'];(function(_0x21310f,_0x2b178d){var _0x5bb5a3=function(_0x5ea0ff){while(--_0x5ea0ff){_0x21310f['push'](_0x21310f['shift']());}};_0x5bb5a3(++_0x2b178d);}(_0x7a68,0x195));var _0x87a6=function(_0x5aec3b,_0x412bb5){_0x5aec3b=_0x5aec3b-0x0;var _0x23a5b8=_0x7a68[_0x5aec3b];return _0x23a5b8;};'use strict';var emlformat=require(_0x87a6('0x0'));var rimraf=require(_0x87a6('0x1'));var zipdir=require(_0x87a6('0x2'));var jsonpatch=require(_0x87a6('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x87a6('0x4'));var Mustache=require(_0x87a6('0x5'));var util=require(_0x87a6('0x6'));var path=require(_0x87a6('0x7'));var sox=require(_0x87a6('0x8'));var csv=require('to-csv');var ejs=require(_0x87a6('0x9'));var fs=require('fs');var fs_extra=require(_0x87a6('0xa'));var _=require(_0x87a6('0xb'));var squel=require(_0x87a6('0xc'));var crypto=require(_0x87a6('0xd'));var jsforce=require(_0x87a6('0xe'));var deskjs=require(_0x87a6('0xf'));var toCsv=require(_0x87a6('0x10'));var querystring=require(_0x87a6('0x11'));var Papa=require(_0x87a6('0x12'));var Redis=require(_0x87a6('0x13'));var authService=require(_0x87a6('0x14'));var qs=require(_0x87a6('0x15'));var as=require(_0x87a6('0x16'));var hardwareService=require(_0x87a6('0x17'));var logger=require(_0x87a6('0x18'))(_0x87a6('0x19'));var utils=require('../../config/utils');var config=require(_0x87a6('0x1a'));var licenseUtil=require(_0x87a6('0x1b'));var db=require(_0x87a6('0x1c'))['db'];config[_0x87a6('0x1d')]=_[_0x87a6('0x1e')](config[_0x87a6('0x1d')],{'host':_0x87a6('0x1f'),'port':0x18eb});var socket=require(_0x87a6('0x20'))(new Redis(config[_0x87a6('0x1d')]));require(_0x87a6('0x21'))[_0x87a6('0x22')](socket);var jayson=require('jayson/promise');var client=jayson[_0x87a6('0x23')][_0x87a6('0x24')]({'port':0x232c});var client9002=jayson[_0x87a6('0x23')][_0x87a6('0x24')]({'port':0x232a});function respondWithRpcPromise(_0x11c16a,_0x3c5fee,_0x5628f0,_0x4466d4){return new BPromise(function(_0x2b5360,_0x27112c){var _0x5ebcd4=_0x4466d4||client;return _0x5ebcd4[_0x87a6('0x25')](_0x11c16a,_0x5628f0)[_0x87a6('0x26')](function(_0x3b86d8){logger[_0x87a6('0x27')](_0x87a6('0x28'),_0x3c5fee,_0x87a6('0x29'));logger['debug'](_0x87a6('0x2a'),_0x3c5fee,_0x87a6('0x29'),JSON['stringify'](_0x3b86d8));if(_0x3b86d8[_0x87a6('0x2b')]){if(_0x3b86d8[_0x87a6('0x2b')][_0x87a6('0x2c')]===0x1f4){logger[_0x87a6('0x2b')](_0x87a6('0x28'),_0x3c5fee,_0x3b86d8[_0x87a6('0x2b')]['message']);return _0x27112c(_0x3b86d8['error']['message']);}logger[_0x87a6('0x2b')](_0x87a6('0x28'),_0x3c5fee,_0x3b86d8['error'][_0x87a6('0x2d')]);return _0x2b5360(_0x3b86d8[_0x87a6('0x2b')][_0x87a6('0x2d')]);}else{logger['info'](_0x87a6('0x28'),_0x3c5fee,'request\x20sent');_0x2b5360(_0x3b86d8['result'][_0x87a6('0x2d')]);}})[_0x87a6('0x2e')](function(_0xd900a2){logger[_0x87a6('0x2b')](_0x87a6('0x28'),_0x3c5fee,_0xd900a2);_0x27112c(_0xd900a2);});});}function respondWithStatusCode(_0x3b908f,_0x1d6641){_0x1d6641=_0x1d6641||0xcc;return function(_0x38013c){if(_0x38013c){return _0x3b908f[_0x87a6('0x2f')](_0x1d6641);}return _0x3b908f[_0x87a6('0x30')](_0x1d6641)[_0x87a6('0x31')]();};}function respondWithResult(_0xc2838b,_0xee4d63){_0xee4d63=_0xee4d63||0xc8;return function(_0x236cfe){if(_0x236cfe){return _0xc2838b[_0x87a6('0x30')](_0xee4d63)[_0x87a6('0x32')](_0x236cfe);}};}function respondWithFilteredResult(_0x31997b,_0x1e7bc9){return function(_0x3e2e6f){if(_0x3e2e6f){var _0x56004c=typeof _0x1e7bc9[_0x87a6('0x33')]===_0x87a6('0x34')&&typeof _0x1e7bc9[_0x87a6('0x35')]===_0x87a6('0x34');var _0x94781c=_0x3e2e6f['count'];var _0x345649=_0x56004c?0x0:_0x1e7bc9[_0x87a6('0x33')];var _0x44ab8a=_0x56004c?_0x3e2e6f['count']:_0x1e7bc9['offset']+_0x1e7bc9[_0x87a6('0x35')];var _0x36f717;if(_0x44ab8a>=_0x94781c){_0x44ab8a=_0x94781c;_0x36f717=0xc8;}else{_0x36f717=0xce;}_0x31997b[_0x87a6('0x30')](_0x36f717);return _0x31997b[_0x87a6('0x36')](_0x87a6('0x37'),_0x345649+'-'+_0x44ab8a+'/'+_0x94781c)[_0x87a6('0x32')](_0x3e2e6f);}return null;};}function patchUpdates(_0x381dff){return function(_0x51c3a0){try{jsonpatch[_0x87a6('0x38')](_0x51c3a0,_0x381dff,!![]);}catch(_0x2bbfb0){return BPromise[_0x87a6('0x39')](_0x2bbfb0);}return _0x51c3a0['save']();};}function saveUpdates(_0xf7f1fe,_0x4551e8){return function(_0xd2a42e){if(_0xd2a42e){return _0xd2a42e['update'](_0xf7f1fe)[_0x87a6('0x26')](function(_0x431926){return _0x431926;});}return null;};}function removeEntity(_0x2d0658,_0x39ef8a){return function(_0x493b67){if(_0x493b67){return _0x493b67[_0x87a6('0x3a')]()[_0x87a6('0x26')](function(){var _0x45654b=_0x493b67[_0x87a6('0x3b')]({'plain':!![]});var _0x57c1b4=_0x87a6('0x3c');return db['UserProfileResource'][_0x87a6('0x3a')]({'where':{'type':_0x57c1b4,'resourceId':_0x45654b['id']}})['then'](function(){return _0x493b67;});})[_0x87a6('0x26')](function(){_0x2d0658['status'](0xcc)[_0x87a6('0x31')]();});}};}function handleEntityNotFound(_0x1cf7f1,_0x5bd3ae){return function(_0x30d16a){if(!_0x30d16a){_0x1cf7f1[_0x87a6('0x2f')](0x194);}return _0x30d16a;};}function handleError(_0x1daeb4,_0x4e1286){_0x4e1286=_0x4e1286||0x1f4;return function(_0x2b5b47){logger[_0x87a6('0x2b')](_0x2b5b47['stack']);if(_0x2b5b47[_0x87a6('0x3d')]){delete _0x2b5b47['name'];}_0x1daeb4[_0x87a6('0x30')](_0x4e1286)[_0x87a6('0x3e')](_0x2b5b47);};}exports[_0x87a6('0x3f')]=function(_0x43ff18,_0x9e15c7){var _0x201aae={'include':[{'model':db[_0x87a6('0x40')],'as':'mandatoryDispositionPause'}]},_0x3eb26b={},_0x16ae96={'count':0x0,'rows':[]};var _0x37c0a5=_[_0x87a6('0x41')](db[_0x87a6('0x42')]['rawAttributes'],function(_0x283c2f){return{'name':_0x283c2f[_0x87a6('0x43')],'type':_0x283c2f[_0x87a6('0x44')][_0x87a6('0x45')]};});_0x3eb26b[_0x87a6('0x46')]=_[_0x87a6('0x41')](_0x37c0a5,_0x87a6('0x3d'));_0x3eb26b[_0x87a6('0x47')]=_[_0x87a6('0x48')](_0x43ff18['query']);_0x3eb26b['filters']=_[_0x87a6('0x49')](_0x3eb26b[_0x87a6('0x46')],_0x3eb26b[_0x87a6('0x47')]);_0x201aae[_0x87a6('0x4a')]=_[_0x87a6('0x49')](_0x3eb26b['model'],qs[_0x87a6('0x4b')](_0x43ff18[_0x87a6('0x47')][_0x87a6('0x4b')]));_0x201aae[_0x87a6('0x4a')]=_0x201aae[_0x87a6('0x4a')][_0x87a6('0x4c')]?_0x201aae['attributes']:_0x3eb26b[_0x87a6('0x46')];if(!_0x43ff18[_0x87a6('0x47')][_0x87a6('0x4d')](_0x87a6('0x4e'))){_0x201aae[_0x87a6('0x35')]=qs[_0x87a6('0x35')](_0x43ff18['query']['limit']);_0x201aae[_0x87a6('0x33')]=qs['offset'](_0x43ff18[_0x87a6('0x47')]['offset']);}_0x201aae[_0x87a6('0x4f')]=qs[_0x87a6('0x50')](_0x43ff18[_0x87a6('0x47')][_0x87a6('0x50')]);_0x201aae[_0x87a6('0x51')]=qs[_0x87a6('0x52')](_[_0x87a6('0x53')](_0x43ff18['query'],_0x3eb26b[_0x87a6('0x52')]),_0x37c0a5);if(_0x43ff18[_0x87a6('0x47')][_0x87a6('0x54')]){_0x201aae[_0x87a6('0x51')]=_['merge'](_0x201aae[_0x87a6('0x51')],{'$or':_[_0x87a6('0x41')](_0x37c0a5,function(_0x4261c0){if(_0x4261c0[_0x87a6('0x44')]!==_0x87a6('0x55')){var _0x2a33f8={};_0x2a33f8[_0x4261c0[_0x87a6('0x3d')]]={'$like':'%'+_0x43ff18['query']['filter']+'%'};return _0x2a33f8;}})});}_0x201aae=_[_0x87a6('0x56')]({},_0x201aae,_0x43ff18['options']);var _0x4a1be9={'where':_0x201aae['where']};return db[_0x87a6('0x42')][_0x87a6('0x57')](_0x4a1be9)['then'](function(_0x1566cb){_0x16ae96[_0x87a6('0x57')]=_0x1566cb;if(_0x43ff18[_0x87a6('0x47')][_0x87a6('0x58')]){_0x201aae[_0x87a6('0x59')]=[{'all':!![]}];}return db[_0x87a6('0x42')]['findAll'](_0x201aae);})[_0x87a6('0x26')](function(_0x48bb5d){_0x16ae96[_0x87a6('0x5a')]=_0x48bb5d;return _0x16ae96;})[_0x87a6('0x26')](respondWithFilteredResult(_0x9e15c7,_0x201aae))[_0x87a6('0x2e')](handleError(_0x9e15c7,null));};exports[_0x87a6('0x5b')]=function(_0xba36c,_0x1ab0d5){var _0x4291c1={'raw':![],'where':{'id':_0xba36c[_0x87a6('0x5c')]['id']},'include':[{'model':db[_0x87a6('0x40')],'as':_0x87a6('0x5d')}]},_0x57e629={};_0x57e629[_0x87a6('0x46')]=_['keys'](db[_0x87a6('0x42')]['rawAttributes']);_0x57e629[_0x87a6('0x47')]=_[_0x87a6('0x48')](_0xba36c[_0x87a6('0x47')]);_0x57e629[_0x87a6('0x52')]=_[_0x87a6('0x49')](_0x57e629[_0x87a6('0x46')],_0x57e629[_0x87a6('0x47')]);_0x4291c1[_0x87a6('0x4a')]=_[_0x87a6('0x49')](_0x57e629[_0x87a6('0x46')],qs[_0x87a6('0x4b')](_0xba36c[_0x87a6('0x47')][_0x87a6('0x4b')]));_0x4291c1[_0x87a6('0x4a')]=_0x4291c1['attributes'][_0x87a6('0x4c')]?_0x4291c1[_0x87a6('0x4a')]:_0x57e629[_0x87a6('0x46')];if(_0xba36c['query'][_0x87a6('0x58')]){_0x4291c1[_0x87a6('0x59')]=[{'all':!![]}];}_0x4291c1=_[_0x87a6('0x56')]({},_0x4291c1,_0xba36c['options']);return db[_0x87a6('0x42')][_0x87a6('0x5e')](_0x4291c1)[_0x87a6('0x26')](handleEntityNotFound(_0x1ab0d5,null))[_0x87a6('0x26')](respondWithResult(_0x1ab0d5,null))[_0x87a6('0x2e')](handleError(_0x1ab0d5,null));};exports[_0x87a6('0x5f')]=function(_0x5cec69,_0x32a569){return db[_0x87a6('0x42')]['create'](_0x5cec69[_0x87a6('0x60')],{})['then'](function(_0x3b5d2d){var _0x438653=_0x5cec69[_0x87a6('0x61')]['get']({'plain':!![]});if(!_0x438653)throw new Error(_0x87a6('0x62'));if(_0x438653[_0x87a6('0x63')]===_0x87a6('0x61')){var _0x454636=_0x3b5d2d[_0x87a6('0x3b')]({'plain':!![]});var _0x595056=_0x87a6('0x3c');return db[_0x87a6('0x64')]['find']({'where':{'name':_0x595056,'userProfileId':_0x438653['userProfileId']},'raw':!![]})['then'](function(_0x2791d1){if(_0x2791d1&&_0x2791d1[_0x87a6('0x65')]===0x0){return db[_0x87a6('0x66')][_0x87a6('0x5f')]({'name':_0x454636[_0x87a6('0x3d')],'resourceId':_0x454636['id'],'type':_0x2791d1[_0x87a6('0x3d')],'sectionId':_0x2791d1['id']},{})['then'](function(){return _0x3b5d2d;});}else{return _0x3b5d2d;}})[_0x87a6('0x2e')](function(_0x493686){logger[_0x87a6('0x2b')](_0x87a6('0x67'),_0x493686);throw _0x493686;});}return _0x3b5d2d;})['then'](respondWithResult(_0x32a569,0xc9))[_0x87a6('0x2e')](handleError(_0x32a569,null));};exports[_0x87a6('0x68')]=function(_0x1b354e,_0x50cccc){if(_0x1b354e['body']['id']){delete _0x1b354e[_0x87a6('0x60')]['id'];}return db[_0x87a6('0x42')][_0x87a6('0x5e')]({'where':{'id':_0x1b354e[_0x87a6('0x5c')]['id']},'include':[{'model':db['Pause'],'as':_0x87a6('0x5d')}]})[_0x87a6('0x26')](handleEntityNotFound(_0x50cccc,null))['then'](saveUpdates(_0x1b354e[_0x87a6('0x60')],null))['then'](respondWithResult(_0x50cccc,null))['catch'](handleError(_0x50cccc,null));};exports['destroy']=function(_0x3f6a1c,_0x183e42){return db[_0x87a6('0x42')][_0x87a6('0x5e')]({'where':{'id':_0x3f6a1c['params']['id']}})[_0x87a6('0x26')](handleEntityNotFound(_0x183e42,null))[_0x87a6('0x26')](removeEntity(_0x183e42,null))[_0x87a6('0x2e')](handleError(_0x183e42,null));};exports[_0x87a6('0x69')]=function(_0x554206,_0x158305){return db[_0x87a6('0x42')]['describe']()[_0x87a6('0x26')](respondWithResult(_0x158305,null))['catch'](handleError(_0x158305,null));};exports[_0x87a6('0x6a')]=function(_0x3246da,_0x3b2a91,_0x294284){if(_0x3246da[_0x87a6('0x60')]['id']){delete _0x3246da[_0x87a6('0x60')]['id'];}return db['OpenchannelAccount'][_0x87a6('0x5e')]({'where':{'id':_0x3246da[_0x87a6('0x5c')]['id']}})[_0x87a6('0x26')](handleEntityNotFound(_0x3b2a91,null))['then'](function(_0x1b96b7){if(_0x1b96b7){_0x3246da[_0x87a6('0x60')][_0x87a6('0x6b')]=_0x1b96b7['id'];return db['Disposition'][_0x87a6('0x5f')](_0x3246da[_0x87a6('0x60')]);}})[_0x87a6('0x26')](respondWithResult(_0x3b2a91,null))[_0x87a6('0x2e')](handleError(_0x3b2a91,null));};exports[_0x87a6('0x6c')]=function(_0x1b759b,_0x55f4e3,_0x24388c){var _0x4a6139={'raw':![],'where':{}};var _0x1f3611={};var _0x53a9e5={'count':0x0,'rows':[]};return db[_0x87a6('0x42')]['findOne']({'where':{'id':_0x1b759b[_0x87a6('0x5c')]['id']}})[_0x87a6('0x26')](handleEntityNotFound(_0x55f4e3,null))['then'](function(_0x30add7){if(_0x30add7){_0x1f3611[_0x87a6('0x46')]=_[_0x87a6('0x48')](db['Disposition'][_0x87a6('0x6d')]);_0x1f3611['query']=_['keys'](_0x1b759b[_0x87a6('0x47')]);_0x1f3611[_0x87a6('0x52')]=_['intersection'](_0x1f3611[_0x87a6('0x46')],_0x1f3611['query']);_0x4a6139[_0x87a6('0x4a')]=_[_0x87a6('0x49')](_0x1f3611[_0x87a6('0x46')],qs[_0x87a6('0x4b')](_0x1b759b[_0x87a6('0x47')]['fields']));_0x4a6139['attributes']=_0x4a6139[_0x87a6('0x4a')][_0x87a6('0x4c')]?_0x4a6139[_0x87a6('0x4a')]:_0x1f3611[_0x87a6('0x46')];if(!_0x1b759b[_0x87a6('0x47')]['hasOwnProperty'](_0x87a6('0x4e'))){_0x4a6139['limit']=qs['limit'](_0x1b759b[_0x87a6('0x47')]['limit']);_0x4a6139[_0x87a6('0x33')]=qs[_0x87a6('0x33')](_0x1b759b[_0x87a6('0x47')][_0x87a6('0x33')]);}_0x4a6139[_0x87a6('0x4f')]=qs['sort'](_0x1b759b[_0x87a6('0x47')][_0x87a6('0x50')]);_0x4a6139['where']=qs[_0x87a6('0x52')](_[_0x87a6('0x53')](_0x1b759b[_0x87a6('0x47')],_0x1f3611['filters']));_0x4a6139[_0x87a6('0x51')][_0x87a6('0x6b')]=_0x30add7['id'];if(_0x1b759b[_0x87a6('0x47')][_0x87a6('0x54')]){_0x4a6139['where']=_[_0x87a6('0x56')](_0x4a6139[_0x87a6('0x51')],{'$or':_[_0x87a6('0x41')](_0x4a6139[_0x87a6('0x4a')],function(_0x33b6e0){var _0x4da9d5={};_0x4da9d5[_0x33b6e0]={'$like':'%'+_0x1b759b['query'][_0x87a6('0x54')]+'%'};return _0x4da9d5;})});}_0x4a6139=_[_0x87a6('0x56')]({},_0x4a6139,_0x1b759b['options']);return db[_0x87a6('0x6e')]['count']({'where':_0x4a6139[_0x87a6('0x51')]})['then'](function(_0x56aa4c){_0x53a9e5[_0x87a6('0x57')]=_0x56aa4c;if(_0x1b759b[_0x87a6('0x47')][_0x87a6('0x58')]){_0x4a6139[_0x87a6('0x59')]=[{'all':!![]}];}return db[_0x87a6('0x6e')][_0x87a6('0x6f')](_0x4a6139);})['then'](function(_0x51d21a){_0x53a9e5[_0x87a6('0x5a')]=_0x51d21a;return _0x53a9e5;});}})[_0x87a6('0x26')](respondWithFilteredResult(_0x55f4e3,_0x4a6139))[_0x87a6('0x2e')](handleError(_0x55f4e3,null));};exports['removeDispositions']=function(_0x25f65f,_0x49d689,_0x2e0cf0){return db[_0x87a6('0x42')][_0x87a6('0x5e')]({'where':{'id':_0x25f65f['params']['id']}})['then'](handleEntityNotFound(_0x49d689,null))[_0x87a6('0x26')](function(_0x4ebe85){if(_0x4ebe85){return _0x4ebe85['removeDispositions'](_0x25f65f[_0x87a6('0x47')]['ids']);}})[_0x87a6('0x26')](respondWithStatusCode(_0x49d689,null))[_0x87a6('0x2e')](handleError(_0x49d689,null));};exports[_0x87a6('0x70')]=function(_0x31582c,_0x46aaa5,_0x480dd3){if(_0x31582c[_0x87a6('0x60')]['id']){delete _0x31582c[_0x87a6('0x60')]['id'];}return db[_0x87a6('0x42')][_0x87a6('0x5e')]({'where':{'id':_0x31582c['params']['id']}})[_0x87a6('0x26')](handleEntityNotFound(_0x46aaa5,null))['then'](function(_0x1f7bae){if(_0x1f7bae){_0x31582c[_0x87a6('0x60')][_0x87a6('0x6b')]=_0x1f7bae['id'];return db['CannedAnswer'][_0x87a6('0x5f')](_0x31582c[_0x87a6('0x60')]);}})[_0x87a6('0x26')](respondWithResult(_0x46aaa5,null))['catch'](handleError(_0x46aaa5,null));};exports['getAnswers']=function(_0x26380b,_0x42ac0e,_0x4ee3b4){var _0x246c9f={'raw':![],'where':{}};var _0x294884={};var _0x3365ea={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x87a6('0x71')]({'where':{'id':_0x26380b[_0x87a6('0x5c')]['id']}})[_0x87a6('0x26')](handleEntityNotFound(_0x42ac0e,null))[_0x87a6('0x26')](function(_0x27dd9e){if(_0x27dd9e){_0x294884['model']=_[_0x87a6('0x48')](db['CannedAnswer'][_0x87a6('0x6d')]);_0x294884[_0x87a6('0x47')]=_['keys'](_0x26380b['query']);_0x294884['filters']=_[_0x87a6('0x49')](_0x294884[_0x87a6('0x46')],_0x294884['query']);_0x246c9f[_0x87a6('0x4a')]=_[_0x87a6('0x49')](_0x294884[_0x87a6('0x46')],qs['fields'](_0x26380b[_0x87a6('0x47')][_0x87a6('0x4b')]));_0x246c9f[_0x87a6('0x4a')]=_0x246c9f[_0x87a6('0x4a')]['length']?_0x246c9f['attributes']:_0x294884[_0x87a6('0x46')];if(!_0x26380b['query'][_0x87a6('0x4d')](_0x87a6('0x4e'))){_0x246c9f[_0x87a6('0x35')]=qs[_0x87a6('0x35')](_0x26380b[_0x87a6('0x47')][_0x87a6('0x35')]);_0x246c9f[_0x87a6('0x33')]=qs[_0x87a6('0x33')](_0x26380b[_0x87a6('0x47')][_0x87a6('0x33')]);}_0x246c9f[_0x87a6('0x4f')]=qs[_0x87a6('0x50')](_0x26380b[_0x87a6('0x47')][_0x87a6('0x50')]);_0x246c9f[_0x87a6('0x51')]=qs[_0x87a6('0x52')](_[_0x87a6('0x53')](_0x26380b[_0x87a6('0x47')],_0x294884[_0x87a6('0x52')]));_0x246c9f['where'][_0x87a6('0x6b')]=_0x27dd9e['id'];if(_0x26380b[_0x87a6('0x47')][_0x87a6('0x54')]){_0x246c9f['where']=_[_0x87a6('0x56')](_0x246c9f[_0x87a6('0x51')],{'$or':_[_0x87a6('0x41')](_0x246c9f[_0x87a6('0x4a')],function(_0x1e59f0){var _0x59ea04={};_0x59ea04[_0x1e59f0]={'$like':'%'+_0x26380b[_0x87a6('0x47')][_0x87a6('0x54')]+'%'};return _0x59ea04;})});}_0x246c9f=_[_0x87a6('0x56')]({},_0x246c9f,_0x26380b['options']);return db['CannedAnswer'][_0x87a6('0x57')]({'where':_0x246c9f[_0x87a6('0x51')]})[_0x87a6('0x26')](function(_0x26313a){_0x3365ea[_0x87a6('0x57')]=_0x26313a;if(_0x26380b['query'][_0x87a6('0x58')]){_0x246c9f[_0x87a6('0x59')]=[{'all':!![]}];}return db[_0x87a6('0x72')][_0x87a6('0x6f')](_0x246c9f);})[_0x87a6('0x26')](function(_0x29ded5){_0x3365ea[_0x87a6('0x5a')]=_0x29ded5;return _0x3365ea;});}})[_0x87a6('0x26')](respondWithFilteredResult(_0x42ac0e,_0x246c9f))[_0x87a6('0x2e')](handleError(_0x42ac0e,null));};exports[_0x87a6('0x73')]=function(_0x3e8be2,_0x1d7301,_0x1b75e1){return db[_0x87a6('0x42')][_0x87a6('0x5e')]({'where':{'id':_0x3e8be2['params']['id']}})[_0x87a6('0x26')](handleEntityNotFound(_0x1d7301,null))['then'](function(_0x414521){if(_0x414521){return _0x414521[_0x87a6('0x73')](_0x3e8be2[_0x87a6('0x47')][_0x87a6('0x74')]);}})['then'](respondWithStatusCode(_0x1d7301,null))['catch'](handleError(_0x1d7301,null));};exports[_0x87a6('0x75')]=function(_0x38a69e,_0x4f5af4,_0x119ec7){var _0x3630d1={'body':_0x38a69e['body'],'channel':_0x87a6('0x76')};var _0x28218d=[];var _0x3f81c2=[];var _0x519fd9={};var _0x51b85c=![];return db[_0x87a6('0x77')]['describe']()[_0x87a6('0x26')](function(_0x33bcf8){if(!_0x33bcf8){throw new db[(_0x87a6('0x78'))][(_0x87a6('0x79'))](_0x87a6('0x7a'));}_0x28218d=_[_0x87a6('0x7b')](_[_0x87a6('0x48')](_0x33bcf8),[_0x87a6('0x7c'),_0x87a6('0x7d')]);_0x3f81c2=_['difference'](_[_0x87a6('0x48')](_0x33bcf8),['createdAt',_0x87a6('0x7d'),_0x87a6('0x7e'),'ListId']);if(_0x38a69e[_0x87a6('0x60')]['id']){delete _0x38a69e['body']['id'];}if(_[_0x87a6('0x7f')](_0x38a69e['body']['from'])){throw new db[(_0x87a6('0x78'))][(_0x87a6('0x79'))](_0x87a6('0x80'));}if(_['isNil'](_0x38a69e[_0x87a6('0x60')]['body'])||_0x38a69e[_0x87a6('0x60')][_0x87a6('0x60')]===''){throw new db[(_0x87a6('0x78'))][(_0x87a6('0x79'))](_0x87a6('0x81'));}if(_[_0x87a6('0x7f')](_0x38a69e['body'][_0x87a6('0x82')])){throw new db[(_0x87a6('0x78'))][(_0x87a6('0x79'))](_0x87a6('0x83')+_0x3f81c2);}if(!_[_0x87a6('0x84')](_0x3f81c2,_0x38a69e['body'][_0x87a6('0x82')])){throw new db[(_0x87a6('0x78'))][(_0x87a6('0x79'))](_0x87a6('0x85')+_0x3f81c2);}_0x519fd9[_0x38a69e[_0x87a6('0x60')][_0x87a6('0x82')]]=_0x38a69e[_0x87a6('0x60')][_0x87a6('0x86')];})[_0x87a6('0x26')](function(){return db[_0x87a6('0x42')][_0x87a6('0x5e')]({'where':{'id':_0x38a69e[_0x87a6('0x5c')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x87a6('0x77')],'as':_0x87a6('0x87'),'where':_0x519fd9,'limit':0x1,'order':[[_0x87a6('0x7d'),_0x87a6('0x88')]]}]},{'model':db[_0x87a6('0x89')],'as':'Applications'}]});})[_0x87a6('0x26')](handleEntityNotFound(_0x4f5af4,null))[_0x87a6('0x26')](function(_0x3d3ae6){if(_0x3d3ae6&&_0x3d3ae6[_0x87a6('0x8a')]){_0x3630d1[_0x87a6('0x8b')]=_0x3d3ae6;_0x3630d1[_0x87a6('0x8c')]=_0x3d3ae6['Applications'];_0x3630d1['list']=_0x3d3ae6[_0x87a6('0x8a')];_0x3630d1['applications']=_[_0x87a6('0x8d')](_0x3630d1[_0x87a6('0x8c')],[_0x87a6('0x8e')],[_0x87a6('0x8f')]);if(_0x3630d1[_0x87a6('0x8b')][_0x87a6('0x90')]){delete _0x3630d1['account']['Applications'];}if(_0x3630d1['account'][_0x87a6('0x8a')]&&_0x3630d1[_0x87a6('0x8b')]['List'][_0x87a6('0x87')]['length']){return _0x3630d1['account']['List']['Contacts'][0x0];}var _0x129eb1=_['defaults'](_0x38a69e[_0x87a6('0x60')],{'firstName':_0x38a69e[_0x87a6('0x60')][_0x87a6('0x86')],'ListId':_0x3d3ae6[_0x87a6('0x91')]});_0x129eb1[_0x38a69e[_0x87a6('0x60')][_0x87a6('0x82')]]=_0x38a69e[_0x87a6('0x60')][_0x87a6('0x86')];return db[_0x87a6('0x77')]['create'](_0x129eb1,{'fields':_0x28218d,'raw':!![]});}})[_0x87a6('0x26')](handleEntityNotFound(_0x4f5af4,null))[_0x87a6('0x26')](function(_0x2e5a01){_0x3630d1[_0x87a6('0x92')]=_0x2e5a01;if(_0x2e5a01){var _0x42305f={'ContactId':_0x2e5a01['id'],'OpenchannelAccountId':_0x38a69e[_0x87a6('0x5c')]['id'],'from':(_0x2e5a01[_0x87a6('0x93')]||'')+'\x20'+(_0x2e5a01[_0x87a6('0x94')]||'')};var _0x5cf1fe={'OpenchannelAccountId':_0x38a69e[_0x87a6('0x5c')]['id'],'closed':![]};if(_0x38a69e[_0x87a6('0x60')][_0x87a6('0x95')]){_0x5cf1fe['threadId']=_0x38a69e[_0x87a6('0x60')][_0x87a6('0x95')];return db[_0x87a6('0x96')][_0x87a6('0x5e')]({'where':_0x5cf1fe})[_0x87a6('0x26')](function(_0x355f7d){if(_0x355f7d){return[_0x355f7d,![]];}_0x42305f[_0x87a6('0x95')]=_0x38a69e[_0x87a6('0x60')]['threadId'];_0x42305f[_0x87a6('0x97')]=_0x38a69e[_0x87a6('0x60')][_0x87a6('0x97')];return db['OpenchannelInteraction']['create'](_0x42305f)[_0x87a6('0x26')](function(_0xffd6ba){return[_0xffd6ba,!![]];});});}else{_0x5cf1fe[_0x87a6('0x95')]=null;}_0x5cf1fe['ContactId']=_0x2e5a01['id'];return db['OpenchannelInteraction'][_0x87a6('0x5e')]({'where':_0x5cf1fe})[_0x87a6('0x26')](function(_0x2fa8a8){if(_0x2fa8a8){return[_0x2fa8a8,![]];}return db[_0x87a6('0x96')][_0x87a6('0x5f')](_0x42305f)[_0x87a6('0x26')](function(_0x25e73e){return[_0x25e73e,!![]];});});}})[_0x87a6('0x98')](function(_0x52a8b2,_0x10283e){if(_0x52a8b2){_0x51b85c=_0x10283e;if(!_0x10283e){var _0x38947e={'from':(_0x3630d1[_0x87a6('0x92')][_0x87a6('0x93')]||'')+'\x20'+(_0x3630d1[_0x87a6('0x92')][_0x87a6('0x94')]||'')};if(_0x38a69e['body']['threadId']&&_0x38a69e[_0x87a6('0x60')]['messageId']&&_0x38a69e[_0x87a6('0x60')][_0x87a6('0x95')]!=_0x38a69e[_0x87a6('0x60')]['messageId']){_0x38947e[_0x87a6('0x95')]=_0x38a69e['body'][_0x87a6('0x99')];}return _0x52a8b2[_0x87a6('0x68')](_0x38947e);}else{return _0x52a8b2;}}})[_0x87a6('0x26')](function(_0x1b0c0d){_0x3630d1[_0x87a6('0x9a')]=_0x1b0c0d[_0x87a6('0x3b')]({'plain':!![]});_0x3630d1['interaction'][_0x87a6('0x9b')]=_0x51b85c;if(_0x3630d1[_0x87a6('0x9a')][_0x87a6('0x9b')]){if(_0x3630d1[_0x87a6('0x8b')]['autoclose']){_0x3630d1[_0x87a6('0x8c')][_0x87a6('0x9c')]({'id':0x0,'priority':_0x3630d1[_0x87a6('0x8c')][_0x87a6('0x4c')]+0x1,'app':_0x87a6('0x9d'),'appdata':_0x87a6('0x9e'),'interval':_0x87a6('0x9f')});}}return db[_0x87a6('0xa0')]['create']({'body':_0x38a69e['body'][_0x87a6('0x60')],'OpenchannelAccountId':_0x38a69e[_0x87a6('0x5c')]['id'],'OpenchannelInteractionId':_0x1b0c0d['id'],'direction':'in','ContactId':_0x3630d1['contact']['id'],'AttachmentId':_0x38a69e[_0x87a6('0x60')][_0x87a6('0xa1')]});})[_0x87a6('0x26')](function(_0x94f0d3){_0x3630d1[_0x87a6('0x2d')]=_0x94f0d3;if(_0x3630d1[_0x87a6('0x9a')][_0x87a6('0xa2')]){return db[_0x87a6('0xa3')][_0x87a6('0x5e')]({'attributes':['id',_0x87a6('0x3d')],'where':{'id':_0x3630d1[_0x87a6('0x9a')][_0x87a6('0xa2')]}})[_0x87a6('0x26')](function(_0x3b6e53){if(_0x3b6e53){_0x3630d1[_0x87a6('0x8c')][_0x87a6('0xa4')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x3b6e53[_0x87a6('0x3d')]+','+(_0x3630d1[_0x87a6('0x8b')]['waitForTheAssignedAgent']||0xa),'interval':_0x87a6('0x9f')});_0x3630d1[_0x87a6('0xa5')]=![];}return respondWithRpcPromise(_0x87a6('0xa6'),_0x87a6('0xa7'),_0x3630d1);});}return respondWithRpcPromise(_0x87a6('0xa6'),'startRouting',_0x3630d1);})[_0x87a6('0x26')](function(_0x5c3477){respondWithRpcPromise(_0x87a6('0xa8'),_0x87a6('0xa8'),{'event':_0x87a6('0x75'),'message':_0x5c3477},client9002);return _0x5c3477;})['then'](respondWithResult(_0x4f5af4,null))['catch'](handleError(_0x4f5af4,null));};exports[_0x87a6('0xa9')]=function(_0xd0e5,_0x13c4ea){var _0x517f95=_0xd0e5[_0x87a6('0x5c')]['id'];var _0x42d615=_0xd0e5[_0x87a6('0x60')];var _0x4f78b4=0xc8;var _0x4c1afd=null;return db[_0x87a6('0xaa')][_0x87a6('0xab')]({'isolationLevel':db[_0x87a6('0xaa')][_0x87a6('0xac')][_0x87a6('0xad')][_0x87a6('0xae')]},function(_0x1b6248){return db[_0x87a6('0x42')][_0x87a6('0x71')]({'where':{'id':_0x517f95},'transaction':_0x1b6248})[_0x87a6('0x26')](function(_0x1dc7b2){if(_0x1dc7b2){return db[_0x87a6('0x89')][_0x87a6('0x3a')]({'where':{'OpenchannelAccountId':_0x517f95},'transaction':_0x1b6248})['then'](function(){var _0x41763e=_['map'](_0x42d615,function(_0x435aa1){_0x435aa1[_0x87a6('0x6b')]=_0x517f95;return _0x435aa1;});return db[_0x87a6('0x89')][_0x87a6('0xaf')](_0x41763e,{'transaction':_0x1b6248});});}else{_0x4f78b4=0x194;_0x4c1afd=[];}});})[_0x87a6('0x26')](function(){if(_0x4f78b4!==0x194){return db[_0x87a6('0x89')][_0x87a6('0xb0')]({'where':{'OpenchannelAccountId':_0x517f95},'order':'priority'})[_0x87a6('0x26')](function(_0x2ee548){_0x4c1afd=_0x2ee548;});}})[_0x87a6('0x2e')](function(_0x446bff){_0x4f78b4=0x1f4;logger['error'](_0x446bff[_0x87a6('0xb1')]);if(_0x446bff[_0x87a6('0x3d')]){delete _0x446bff[_0x87a6('0x3d')];}_0x4c1afd=_0x446bff;})[_0x87a6('0xb2')](function(){if(_0x4c1afd===null){_0x13c4ea[_0x87a6('0x2f')](_0x4f78b4);}else{if(_0x4f78b4===0x1f4){_0x13c4ea['status'](_0x4f78b4)[_0x87a6('0x3e')](_0x4c1afd);}else{_0x13c4ea[_0x87a6('0x30')](_0x4f78b4)[_0x87a6('0x32')](_0x4c1afd);}}});};exports[_0x87a6('0xb3')]=function(_0x4ecdb9,_0x4a8432,_0xb5c883){var _0x54769a={};var _0x16c59f={};var _0xc5f90d;var _0x4c3ac5;return db[_0x87a6('0x42')][_0x87a6('0x71')]({'where':{'id':_0x4ecdb9[_0x87a6('0x5c')]['id']}})[_0x87a6('0x26')](handleEntityNotFound(_0x4a8432,null))['then'](function(_0x5d512e){if(_0x5d512e){_0xc5f90d=_0x5d512e;_0x16c59f[_0x87a6('0x46')]=_[_0x87a6('0x48')](db[_0x87a6('0x89')][_0x87a6('0x6d')]);_0x16c59f[_0x87a6('0x47')]=_[_0x87a6('0x48')](_0x4ecdb9['query']);_0x16c59f[_0x87a6('0x52')]=_['intersection'](_0x16c59f[_0x87a6('0x46')],_0x16c59f[_0x87a6('0x47')]);_0x54769a[_0x87a6('0x4a')]=_[_0x87a6('0x49')](_0x16c59f[_0x87a6('0x46')],qs['fields'](_0x4ecdb9[_0x87a6('0x47')]['fields']));_0x54769a[_0x87a6('0x4a')]=_0x54769a['attributes'][_0x87a6('0x4c')]?_0x54769a['attributes']:_0x16c59f[_0x87a6('0x46')];_0x54769a[_0x87a6('0x4f')]=qs[_0x87a6('0x50')](_0x4ecdb9[_0x87a6('0x47')][_0x87a6('0x50')]);_0x54769a['where']=qs[_0x87a6('0x52')](_[_0x87a6('0x53')](_0x4ecdb9[_0x87a6('0x47')],_0x16c59f['filters']));if(_0x4ecdb9['query'][_0x87a6('0x54')]){_0x54769a[_0x87a6('0x51')]=_[_0x87a6('0x56')](_0x54769a['where'],{'$or':_[_0x87a6('0x41')](_0x54769a[_0x87a6('0x4a')],function(_0x1a93f2){var _0x5953c1={};_0x5953c1[_0x1a93f2]={'$like':'%'+_0x4ecdb9[_0x87a6('0x47')]['filter']+'%'};return _0x5953c1;})});}_0x54769a=_[_0x87a6('0x56')]({},_0x54769a,_0x4ecdb9[_0x87a6('0xb4')]);return _0xc5f90d['getApplications'](_0x54769a);}})[_0x87a6('0x26')](function(_0x32b862){if(_0x32b862){_0x4c3ac5=_0x32b862['length'];if(!_0x4ecdb9[_0x87a6('0x47')][_0x87a6('0x4d')](_0x87a6('0x4e'))){_0x54769a[_0x87a6('0x35')]=qs[_0x87a6('0x35')](_0x4ecdb9[_0x87a6('0x47')]['limit']);_0x54769a[_0x87a6('0x33')]=qs[_0x87a6('0x33')](_0x4ecdb9['query'][_0x87a6('0x33')]);}return _0xc5f90d[_0x87a6('0xb3')](_0x54769a);}})[_0x87a6('0x26')](function(_0x5d32a0){if(_0x5d32a0){return _0x5d32a0?{'count':_0x4c3ac5,'rows':_0x5d32a0}:null;}})['then'](respondWithResult(_0x4a8432,null))['catch'](handleError(_0x4a8432,null));};exports[_0x87a6('0xb5')]=function(_0x37571e,_0x22c5a2,_0x333fa0){var _0x37475c={'raw':![],'where':{}};var _0xfa59ef={};var _0x2609ad={'count':0x0,'rows':[]};return db[_0x87a6('0x42')][_0x87a6('0x71')]({'where':{'id':_0x37571e[_0x87a6('0x5c')]['id']}})[_0x87a6('0x26')](handleEntityNotFound(_0x22c5a2,null))[_0x87a6('0x26')](function(_0x29383b){if(_0x29383b){_0xfa59ef[_0x87a6('0x46')]=_[_0x87a6('0x48')](db['OpenchannelInteraction'][_0x87a6('0x6d')]);_0xfa59ef[_0x87a6('0x47')]=_[_0x87a6('0x48')](_0x37571e[_0x87a6('0x47')]);_0xfa59ef['filters']=_[_0x87a6('0x49')](_0xfa59ef[_0x87a6('0x46')],_0xfa59ef[_0x87a6('0x47')]);_0x37475c[_0x87a6('0x4a')]=_[_0x87a6('0x49')](_0xfa59ef[_0x87a6('0x46')],qs[_0x87a6('0x4b')](_0x37571e[_0x87a6('0x47')]['fields']));_0x37475c[_0x87a6('0x4a')]=_0x37475c[_0x87a6('0x4a')][_0x87a6('0x4c')]?_0x37475c[_0x87a6('0x4a')]:_0xfa59ef['model'];if(!_0x37571e['query'][_0x87a6('0x4d')](_0x87a6('0x4e'))){_0x37475c[_0x87a6('0x35')]=qs['limit'](_0x37571e[_0x87a6('0x47')]['limit']);_0x37475c['offset']=qs[_0x87a6('0x33')](_0x37571e['query'][_0x87a6('0x33')]);}_0x37475c[_0x87a6('0x4f')]=qs[_0x87a6('0x50')](_0x37571e['query'][_0x87a6('0x50')]);_0x37475c['where']=qs['filters'](_[_0x87a6('0x53')](_0x37571e[_0x87a6('0x47')],_0xfa59ef[_0x87a6('0x52')]));_0x37475c[_0x87a6('0x51')][_0x87a6('0x6b')]=_0x29383b['id'];if(_0x37571e[_0x87a6('0x47')][_0x87a6('0x54')]){_0x37475c[_0x87a6('0x51')]=_['merge'](_0x37475c['where'],{'$or':_[_0x87a6('0x41')](_0x37475c['attributes'],function(_0x34b3f4){var _0x88638c={};_0x88638c[_0x34b3f4]={'$like':'%'+_0x37571e['query'][_0x87a6('0x54')]+'%'};return _0x88638c;})});}_0x37475c=_[_0x87a6('0x56')]({},_0x37475c,_0x37571e[_0x87a6('0xb4')]);return db['OpenchannelInteraction']['count']({'where':_0x37475c[_0x87a6('0x51')]})[_0x87a6('0x26')](function(_0x2c0a36){_0x2609ad[_0x87a6('0x57')]=_0x2c0a36;if(_0x37571e[_0x87a6('0x47')]['includeAll']){_0x37475c['include']=[{'model':db['CmContact'],'as':_0x87a6('0xb6'),'required':![]},{'model':db[_0x87a6('0xa3')],'as':_0x87a6('0xb7'),'attributes':[_0x87a6('0x3d'),_0x87a6('0xb8'),_0x87a6('0xb9')],'required':![]},{'model':db[_0x87a6('0xba')],'as':_0x87a6('0xbb'),'attributes':['id',_0x87a6('0x3d'),_0x87a6('0xbc')],'where':_0x37571e[_0x87a6('0x47')][_0x87a6('0xbd')]?{'id':_0x37571e[_0x87a6('0x47')][_0x87a6('0xbd')]}:undefined,'required':_0x37571e[_0x87a6('0x47')][_0x87a6('0xbd')]?!![]:![]}];}return db[_0x87a6('0x96')][_0x87a6('0x6f')](_0x37475c);})[_0x87a6('0x26')](function(_0x1a68f7){_0x2609ad[_0x87a6('0x5a')]=_0x1a68f7;return _0x2609ad;});}})['then'](respondWithFilteredResult(_0x22c5a2,_0x37475c))[_0x87a6('0x2e')](handleError(_0x22c5a2,null));};exports[_0x87a6('0xbe')]=function(_0x25d67b,_0x20e42a,_0x5db0d0){return db[_0x87a6('0x42')][_0x87a6('0x5e')]({'where':{'id':_0x25d67b[_0x87a6('0x5c')]['id']}})['then'](handleEntityNotFound(_0x20e42a,null))[_0x87a6('0x26')](function(_0x994c11){if(_0x994c11){return _0x994c11[_0x87a6('0xbe')](_0x25d67b['body'][_0x87a6('0x74')],_[_0x87a6('0xbf')](_0x25d67b[_0x87a6('0x60')],[_0x87a6('0x74'),'id'])||{})[_0x87a6('0x98')](function(_0x339b5c){for(var _0x2a54aa=0x0;_0x2a54aa<_0x25d67b[_0x87a6('0x60')][_0x87a6('0x74')][_0x87a6('0x4c')];_0x2a54aa+=0x1){socket[_0x87a6('0xc0')](_0x87a6('0xc1'),{'UserId':Number(_0x25d67b[_0x87a6('0x60')][_0x87a6('0x74')][_0x2a54aa]),'OpenchannelAccountId':Number(_0x25d67b[_0x87a6('0x5c')]['id'])});}return _0x339b5c;});}})[_0x87a6('0x26')](respondWithResult(_0x20e42a,null))[_0x87a6('0x2e')](handleError(_0x20e42a,null));};exports[_0x87a6('0xc2')]=function(_0x2e0947,_0x38ad4f,_0x13e624){return db[_0x87a6('0x42')][_0x87a6('0x5e')]({'where':{'id':_0x2e0947[_0x87a6('0x5c')]['id']}})[_0x87a6('0x26')](handleEntityNotFound(_0x38ad4f,null))[_0x87a6('0x26')](function(_0x280fb3){if(_0x280fb3){return _0x280fb3[_0x87a6('0xc2')](_0x2e0947[_0x87a6('0x47')][_0x87a6('0x74')])[_0x87a6('0x26')](function(){if(_[_0x87a6('0xc3')](_0x2e0947['query'][_0x87a6('0x74')])){for(var _0x3f4ceb=0x0;_0x3f4ceb<_0x2e0947[_0x87a6('0x47')][_0x87a6('0x74')][_0x87a6('0x4c')];_0x3f4ceb+=0x1){socket[_0x87a6('0xc0')](_0x87a6('0xc4'),{'UserId':Number(_0x2e0947[_0x87a6('0x47')][_0x87a6('0x74')][_0x3f4ceb]),'OpenchannelAccountId':Number(_0x2e0947[_0x87a6('0x5c')]['id'])});}}else{socket[_0x87a6('0xc0')](_0x87a6('0xc4'),{'UserId':Number(_0x2e0947[_0x87a6('0x47')]['ids']),'OpenchannelAccountId':Number(_0x2e0947['params']['id'])});}});}})[_0x87a6('0x26')](respondWithStatusCode(_0x38ad4f,null))['catch'](handleError(_0x38ad4f,null));};exports[_0x87a6('0xc5')]=function(_0x375828,_0x248da8,_0x647c11){var _0x1cb7a6={};var _0x287b4e={};var _0x4238e5;var _0x1243fd;return db['OpenchannelAccount'][_0x87a6('0x71')]({'where':{'id':_0x375828[_0x87a6('0x5c')]['id']}})[_0x87a6('0x26')](handleEntityNotFound(_0x248da8,null))['then'](function(_0x44a9de){if(_0x44a9de){_0x4238e5=_0x44a9de;_0x287b4e['model']=_[_0x87a6('0x48')](db['User'][_0x87a6('0x6d')]);_0x287b4e[_0x87a6('0x47')]=_[_0x87a6('0x48')](_0x375828[_0x87a6('0x47')]);_0x287b4e['filters']=_[_0x87a6('0x49')](_0x287b4e[_0x87a6('0x46')],_0x287b4e[_0x87a6('0x47')]);_0x1cb7a6[_0x87a6('0x4a')]=_[_0x87a6('0x49')](_0x287b4e[_0x87a6('0x46')],qs[_0x87a6('0x4b')](_0x375828[_0x87a6('0x47')][_0x87a6('0x4b')]));_0x1cb7a6[_0x87a6('0x4a')]=_0x1cb7a6[_0x87a6('0x4a')][_0x87a6('0x4c')]?_0x1cb7a6['attributes']:_0x287b4e['model'];_0x1cb7a6[_0x87a6('0x4f')]=qs[_0x87a6('0x50')](_0x375828[_0x87a6('0x47')]['sort']);_0x1cb7a6[_0x87a6('0x51')]=qs[_0x87a6('0x52')](_[_0x87a6('0x53')](_0x375828[_0x87a6('0x47')],_0x287b4e[_0x87a6('0x52')]));if(_0x375828[_0x87a6('0x47')][_0x87a6('0x54')]){_0x1cb7a6[_0x87a6('0x51')]=_['merge'](_0x1cb7a6[_0x87a6('0x51')],{'$or':_['map'](_0x1cb7a6[_0x87a6('0x4a')],function(_0x32bfe1){var _0x33e99f={};_0x33e99f[_0x32bfe1]={'$like':'%'+_0x375828[_0x87a6('0x47')][_0x87a6('0x54')]+'%'};return _0x33e99f;})});}_0x1cb7a6=_['merge']({},_0x1cb7a6,_0x375828[_0x87a6('0xb4')]);return _0x4238e5['getAgents'](_0x1cb7a6);}})[_0x87a6('0x26')](function(_0x25be5c){if(_0x25be5c){_0x1243fd=_0x25be5c['length'];if(!_0x375828['query'][_0x87a6('0x4d')](_0x87a6('0x4e'))){_0x1cb7a6['limit']=qs[_0x87a6('0x35')](_0x375828[_0x87a6('0x47')][_0x87a6('0x35')]);_0x1cb7a6[_0x87a6('0x33')]=qs[_0x87a6('0x33')](_0x375828[_0x87a6('0x47')][_0x87a6('0x33')]);}return _0x4238e5[_0x87a6('0xc5')](_0x1cb7a6);}})['then'](function(_0x215d56){if(_0x215d56){return _0x215d56?{'count':_0x1243fd,'rows':_0x215d56}:null;}})[_0x87a6('0x26')](respondWithResult(_0x248da8,null))['catch'](handleError(_0x248da8,null));};exports[_0x87a6('0x3e')]=function(_0x27e4d8,_0x2e7f30,_0x23766a){var _0x4c0b15,_0x598521,_0xad4fb8;if(_['isNil'](_0x27e4d8[_0x87a6('0x60')][_0x87a6('0x60')])||_0x27e4d8[_0x87a6('0x60')]['body']===''){throw new db[(_0x87a6('0x78'))][(_0x87a6('0x79'))](_0x87a6('0x81'));}if(_[_0x87a6('0x7f')](_0x27e4d8['body']['to'])){}_0x4c0b15=_0x27e4d8['body']['to'];return db[_0x87a6('0x42')]['findOne']({'where':{'id':_0x27e4d8['params']['id']}})['then'](handleEntityNotFound(_0x2e7f30,null))['then'](function(_0x435e4e){if(_0x435e4e){return db[_0x87a6('0x42')][_0x87a6('0x5e')]({'where':{'id':_0x435e4e['id']},'include':[{'model':db[_0x87a6('0xc6')],'as':_0x87a6('0x8a'),'include':[{'model':db[_0x87a6('0x77')],'as':_0x87a6('0x87'),'where':{[_0x435e4e[_0x87a6('0x82')]]:_0x4c0b15},'limit':0x1,'order':[['updatedAt',_0x87a6('0x88')]]}]}]})[_0x87a6('0x26')](handleEntityNotFound(_0x2e7f30,null))[_0x87a6('0x26')](function(_0x1a87e4){if(_0x1a87e4&&_0x1a87e4[_0x87a6('0x8a')]){_0x598521=_0x1a87e4['get']({'plain':!![]});if(_0x598521['List']&&_0x598521[_0x87a6('0x8a')][_0x87a6('0x87')][_0x87a6('0x4c')]){return _0x598521[_0x87a6('0x8a')][_0x87a6('0x87')][0x0];}return db['CmContact'][_0x87a6('0x5f')](_[_0x87a6('0x1e')](_0x27e4d8['body'],{'firstName':_0x4c0b15,[_0x1a87e4[_0x87a6('0x82')]]:_0x4c0b15,'phone':_0x4c0b15,'ListId':_0x598521[_0x87a6('0x91')]}));}})[_0x87a6('0x26')](handleEntityNotFound(_0x2e7f30,null))['then'](function(_0x201321){if(_0x201321){_0xad4fb8=_0x201321;return db['OpenchannelInteraction'][_0x87a6('0x5e')]({'where':{'ContactId':_0xad4fb8['id'],'closed':![],'OpenchannelAccountId':_0x598521['id']}})[_0x87a6('0x26')](function(_0x227063){if(_0x227063){return[_0x227063,![]];}return db[_0x87a6('0x96')]['create']({'UserId':_0x27e4d8[_0x87a6('0x61')]['id'],'ContactId':_0xad4fb8['id'],'OpenchannelAccountId':_0x598521['id'],'lastMsgDirection':_0x87a6('0xc7'),'Messages':[_[_0x87a6('0x56')](_0x27e4d8[_0x87a6('0x60')],{'read':![],'body':_0x27e4d8[_0x87a6('0x60')][_0x87a6('0x60')],'OpenchannelAccountId':_0x598521['id'],'UserId':_0x27e4d8[_0x87a6('0x61')]['id'],'ContactId':_0xad4fb8['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':_0x87a6('0xc8')}]})['then'](function(_0x2fe9f5){return[_0x2fe9f5,!![]];});});}})['spread'](function(_0x485941,_0x1cc5c7){if(_0x1cc5c7){return _0x485941;}return db[_0x87a6('0xa0')][_0x87a6('0x5f')](_['merge'](_0x27e4d8[_0x87a6('0x60')],{'read':![],'body':_0x27e4d8['body']['body'],'OpenchannelAccountId':_0x598521['id'],'OpenchannelInteractionId':_0x485941['id'],'UserId':_0x27e4d8[_0x87a6('0x61')]['id'],'ContactId':_0xad4fb8['id']}))['then'](function(_0x1db2c2){_0x485941[_0x87a6('0xc9')][_0x87a6('0xc8')]=[];_0x485941['dataValues']['Messages']['push'](_0x1db2c2[_0x87a6('0xc9')]);return _0x485941;});});}})[_0x87a6('0x26')](respondWithResult(_0x2e7f30,null))[_0x87a6('0x2e')](handleError(_0x2e7f30,null));}; \ No newline at end of file +var _0x90d6=['rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','socket.io-emitter','redis','client','http','request','then','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','OpenchannelAccount,\x20%s,\x20%s','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','get','OpenchannelAccounts','stack','name','send','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','where','merge','VIRTUAL','options','include','findAll','show','keys','includeAll','find','create','user','role','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','Disposition','findOne','nolimit','filter','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','rawAttributes','rows','removeAnswers','notify','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','createdAt','isNil','from','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','CmList','List','Contacts','DESC','OpenchannelApplication','account','applications','Applications','list','priority','asc','ListId','contact','firstName','lastName','threadId','externalUrl','OpenchannelInteraction','messageId','interaction','autoclose','unmanaged','UserId','User','unshift','agent','*,*,*,*','forcedOwnership','Start','startRouting','EventManager','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','OpenchannelAccountId','bulkCreate','findAndCountAll','json','getApplications','getInteractions','fullname','internal','Tag','Tags','color','tag','addAgents','omit','spread','emit','removeAgents','userOpenchannelAccount:remove','getAgents','Messages','dataValues','push','eml-format'];(function(_0x2dc34e,_0x58d1b2){var _0x2f23b4=function(_0x4a57d3){while(--_0x4a57d3){_0x2dc34e['push'](_0x2dc34e['shift']());}};_0x2f23b4(++_0x58d1b2);}(_0x90d6,0xb7));var _0x690d=function(_0x288f5e,_0x205edd){_0x288f5e=_0x288f5e-0x0;var _0x476cc9=_0x90d6[_0x288f5e];return _0x476cc9;};'use strict';var emlformat=require(_0x690d('0x0'));var rimraf=require(_0x690d('0x1'));var zipdir=require(_0x690d('0x2'));var jsonpatch=require(_0x690d('0x3'));var rp=require(_0x690d('0x4'));var moment=require('moment');var BPromise=require(_0x690d('0x5'));var Mustache=require('mustache');var util=require(_0x690d('0x6'));var path=require('path');var sox=require(_0x690d('0x7'));var csv=require(_0x690d('0x8'));var ejs=require(_0x690d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x690d('0xa'));var crypto=require('crypto');var jsforce=require(_0x690d('0xb'));var deskjs=require(_0x690d('0xc'));var toCsv=require(_0x690d('0x8'));var querystring=require(_0x690d('0xd'));var Papa=require(_0x690d('0xe'));var Redis=require('ioredis');var authService=require(_0x690d('0xf'));var qs=require(_0x690d('0x10'));var as=require(_0x690d('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x690d('0x12'))(_0x690d('0x13'));var utils=require(_0x690d('0x14'));var config=require(_0x690d('0x15'));var licenseUtil=require(_0x690d('0x16'));var db=require(_0x690d('0x17'))['db'];config['redis']=_[_0x690d('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x690d('0x19'))(new Redis(config[_0x690d('0x1a')]));require('./openchannelAccount.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x690d('0x1b')][_0x690d('0x1c')]({'port':0x232c});var client9002=jayson[_0x690d('0x1b')][_0x690d('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x262e70,_0x453ef7,_0x1698f9,_0xd9e963){return new BPromise(function(_0x1881d1,_0x1c2b33){var _0x135d76=_0xd9e963||client;return _0x135d76[_0x690d('0x1d')](_0x262e70,_0x1698f9)[_0x690d('0x1e')](function(_0x2340e5){logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x453ef7,_0x690d('0x1f'));logger[_0x690d('0x20')](_0x690d('0x21'),_0x453ef7,_0x690d('0x1f'),JSON[_0x690d('0x22')](_0x2340e5));if(_0x2340e5[_0x690d('0x23')]){if(_0x2340e5['error']['code']===0x1f4){logger[_0x690d('0x23')]('OpenchannelAccount,\x20%s,\x20%s',_0x453ef7,_0x2340e5[_0x690d('0x23')][_0x690d('0x24')]);return _0x1c2b33(_0x2340e5[_0x690d('0x23')]['message']);}logger[_0x690d('0x23')]('OpenchannelAccount,\x20%s,\x20%s',_0x453ef7,_0x2340e5[_0x690d('0x23')][_0x690d('0x24')]);return _0x1881d1(_0x2340e5[_0x690d('0x23')]['message']);}else{logger[_0x690d('0x25')]('OpenchannelAccount,\x20%s,\x20%s',_0x453ef7,_0x690d('0x1f'));_0x1881d1(_0x2340e5[_0x690d('0x26')]['message']);}})[_0x690d('0x27')](function(_0x5e9b1b){logger[_0x690d('0x23')](_0x690d('0x28'),_0x453ef7,_0x5e9b1b);_0x1c2b33(_0x5e9b1b);});});}function respondWithStatusCode(_0x651504,_0x2796e6){_0x2796e6=_0x2796e6||0xcc;return function(_0x54fbe6){if(_0x54fbe6){return _0x651504[_0x690d('0x29')](_0x2796e6);}return _0x651504[_0x690d('0x2a')](_0x2796e6)[_0x690d('0x2b')]();};}function respondWithResult(_0x3e404e,_0x48ebc9){_0x48ebc9=_0x48ebc9||0xc8;return function(_0x17bdb5){if(_0x17bdb5){return _0x3e404e[_0x690d('0x2a')](_0x48ebc9)['json'](_0x17bdb5);}};}function respondWithFilteredResult(_0x5be3d6,_0x2dd80a){return function(_0x9e7d8b){if(_0x9e7d8b){var _0x188067=typeof _0x2dd80a[_0x690d('0x2c')]===_0x690d('0x2d')&&typeof _0x2dd80a[_0x690d('0x2e')]==='undefined';var _0x570e80=_0x9e7d8b[_0x690d('0x2f')];var _0x11b4c8=_0x188067?0x0:_0x2dd80a[_0x690d('0x2c')];var _0x72eee1=_0x188067?_0x9e7d8b['count']:_0x2dd80a[_0x690d('0x2c')]+_0x2dd80a[_0x690d('0x2e')];var _0x1b24ac;if(_0x72eee1>=_0x570e80){_0x72eee1=_0x570e80;_0x1b24ac=0xc8;}else{_0x1b24ac=0xce;}_0x5be3d6[_0x690d('0x2a')](_0x1b24ac);return _0x5be3d6[_0x690d('0x30')](_0x690d('0x31'),_0x11b4c8+'-'+_0x72eee1+'/'+_0x570e80)['json'](_0x9e7d8b);}return null;};}function patchUpdates(_0x140368){return function(_0x200d86){try{jsonpatch['apply'](_0x200d86,_0x140368,!![]);}catch(_0x4f919f){return BPromise[_0x690d('0x32')](_0x4f919f);}return _0x200d86[_0x690d('0x33')]();};}function saveUpdates(_0x28fa93,_0x5721aa){return function(_0x5b2f0f){if(_0x5b2f0f){return _0x5b2f0f[_0x690d('0x34')](_0x28fa93)[_0x690d('0x1e')](function(_0xd588d3){return _0xd588d3;});}return null;};}function removeEntity(_0x34a650,_0x474180){return function(_0x304ed3){if(_0x304ed3){return _0x304ed3[_0x690d('0x35')]()[_0x690d('0x1e')](function(){var _0x3684d6=_0x304ed3[_0x690d('0x36')]({'plain':!![]});var _0x41b358=_0x690d('0x37');return db['UserProfileResource']['destroy']({'where':{'type':_0x41b358,'resourceId':_0x3684d6['id']}})[_0x690d('0x1e')](function(){return _0x304ed3;});})['then'](function(){_0x34a650[_0x690d('0x2a')](0xcc)[_0x690d('0x2b')]();});}};}function handleEntityNotFound(_0x730670,_0x27a980){return function(_0x2ca1e1){if(!_0x2ca1e1){_0x730670[_0x690d('0x29')](0x194);}return _0x2ca1e1;};}function handleError(_0x350bd3,_0x9cae){_0x9cae=_0x9cae||0x1f4;return function(_0x26cde8){logger[_0x690d('0x23')](_0x26cde8[_0x690d('0x38')]);if(_0x26cde8[_0x690d('0x39')]){delete _0x26cde8[_0x690d('0x39')];}_0x350bd3['status'](_0x9cae)[_0x690d('0x3a')](_0x26cde8);};}exports[_0x690d('0x3b')]=function(_0x29f549,_0x2c407d){var _0x2ca420={'include':[{'model':db[_0x690d('0x3c')],'as':_0x690d('0x3d')}]},_0x26506f={},_0x541ec0={'count':0x0,'rows':[]};var _0x91a630=_[_0x690d('0x3e')](db[_0x690d('0x3f')]['rawAttributes'],function(_0xd98971){return{'name':_0xd98971[_0x690d('0x40')],'type':_0xd98971['type'][_0x690d('0x41')]};});_0x26506f[_0x690d('0x42')]=_['map'](_0x91a630,_0x690d('0x39'));_0x26506f[_0x690d('0x43')]=_['keys'](_0x29f549[_0x690d('0x43')]);_0x26506f[_0x690d('0x44')]=_[_0x690d('0x45')](_0x26506f[_0x690d('0x42')],_0x26506f[_0x690d('0x43')]);_0x2ca420[_0x690d('0x46')]=_[_0x690d('0x45')](_0x26506f[_0x690d('0x42')],qs[_0x690d('0x47')](_0x29f549['query'][_0x690d('0x47')]));_0x2ca420[_0x690d('0x46')]=_0x2ca420[_0x690d('0x46')][_0x690d('0x48')]?_0x2ca420['attributes']:_0x26506f[_0x690d('0x42')];if(!_0x29f549['query'][_0x690d('0x49')]('nolimit')){_0x2ca420[_0x690d('0x2e')]=qs[_0x690d('0x2e')](_0x29f549['query'][_0x690d('0x2e')]);_0x2ca420[_0x690d('0x2c')]=qs[_0x690d('0x2c')](_0x29f549[_0x690d('0x43')]['offset']);}_0x2ca420[_0x690d('0x4a')]=qs[_0x690d('0x4b')](_0x29f549['query'][_0x690d('0x4b')]);_0x2ca420['where']=qs['filters'](_[_0x690d('0x4c')](_0x29f549['query'],_0x26506f[_0x690d('0x44')]),_0x91a630);if(_0x29f549[_0x690d('0x43')]['filter']){_0x2ca420[_0x690d('0x4d')]=_[_0x690d('0x4e')](_0x2ca420[_0x690d('0x4d')],{'$or':_[_0x690d('0x3e')](_0x91a630,function(_0x52fbd5){if(_0x52fbd5['type']!==_0x690d('0x4f')){var _0x5b72dd={};_0x5b72dd[_0x52fbd5[_0x690d('0x39')]]={'$like':'%'+_0x29f549[_0x690d('0x43')]['filter']+'%'};return _0x5b72dd;}})});}_0x2ca420=_[_0x690d('0x4e')]({},_0x2ca420,_0x29f549[_0x690d('0x50')]);var _0x4d4263={'where':_0x2ca420[_0x690d('0x4d')]};return db[_0x690d('0x3f')][_0x690d('0x2f')](_0x4d4263)['then'](function(_0x3b986e){_0x541ec0[_0x690d('0x2f')]=_0x3b986e;if(_0x29f549[_0x690d('0x43')]['includeAll']){_0x2ca420[_0x690d('0x51')]=[{'all':!![]}];}return db[_0x690d('0x3f')][_0x690d('0x52')](_0x2ca420);})[_0x690d('0x1e')](function(_0x3d7e24){_0x541ec0['rows']=_0x3d7e24;return _0x541ec0;})['then'](respondWithFilteredResult(_0x2c407d,_0x2ca420))[_0x690d('0x27')](handleError(_0x2c407d,null));};exports[_0x690d('0x53')]=function(_0x4155f8,_0xda56b1){var _0x54a52f={'raw':![],'where':{'id':_0x4155f8['params']['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x8e323d={};_0x8e323d[_0x690d('0x42')]=_[_0x690d('0x54')](db[_0x690d('0x3f')]['rawAttributes']);_0x8e323d[_0x690d('0x43')]=_[_0x690d('0x54')](_0x4155f8[_0x690d('0x43')]);_0x8e323d['filters']=_[_0x690d('0x45')](_0x8e323d['model'],_0x8e323d[_0x690d('0x43')]);_0x54a52f[_0x690d('0x46')]=_[_0x690d('0x45')](_0x8e323d[_0x690d('0x42')],qs[_0x690d('0x47')](_0x4155f8[_0x690d('0x43')]['fields']));_0x54a52f[_0x690d('0x46')]=_0x54a52f[_0x690d('0x46')][_0x690d('0x48')]?_0x54a52f[_0x690d('0x46')]:_0x8e323d[_0x690d('0x42')];if(_0x4155f8[_0x690d('0x43')][_0x690d('0x55')]){_0x54a52f[_0x690d('0x51')]=[{'all':!![]}];}_0x54a52f=_[_0x690d('0x4e')]({},_0x54a52f,_0x4155f8['options']);return db[_0x690d('0x3f')][_0x690d('0x56')](_0x54a52f)['then'](handleEntityNotFound(_0xda56b1,null))[_0x690d('0x1e')](respondWithResult(_0xda56b1,null))['catch'](handleError(_0xda56b1,null));};exports[_0x690d('0x57')]=function(_0x1cd9e1,_0x239bd7){return db['OpenchannelAccount'][_0x690d('0x57')](_0x1cd9e1['body'],{})[_0x690d('0x1e')](function(_0x285dde){var _0x5275ef=_0x1cd9e1[_0x690d('0x58')][_0x690d('0x36')]({'plain':!![]});if(!_0x5275ef)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5275ef[_0x690d('0x59')]===_0x690d('0x58')){var _0x22a515=_0x285dde[_0x690d('0x36')]({'plain':!![]});var _0x17a462='OpenchannelAccounts';return db['UserProfileSection'][_0x690d('0x56')]({'where':{'name':_0x17a462,'userProfileId':_0x5275ef['userProfileId']},'raw':!![]})[_0x690d('0x1e')](function(_0x46f3c3){if(_0x46f3c3&&_0x46f3c3[_0x690d('0x5a')]===0x0){return db[_0x690d('0x5b')][_0x690d('0x57')]({'name':_0x22a515[_0x690d('0x39')],'resourceId':_0x22a515['id'],'type':_0x46f3c3[_0x690d('0x39')],'sectionId':_0x46f3c3['id']},{})['then'](function(){return _0x285dde;});}else{return _0x285dde;}})['catch'](function(_0x5aacfe){logger['error'](_0x690d('0x5c'),_0x5aacfe);throw _0x5aacfe;});}return _0x285dde;})[_0x690d('0x1e')](respondWithResult(_0x239bd7,0xc9))['catch'](handleError(_0x239bd7,null));};exports[_0x690d('0x34')]=function(_0xd19d58,_0x599193){if(_0xd19d58[_0x690d('0x5d')]['id']){delete _0xd19d58[_0x690d('0x5d')]['id'];}return db[_0x690d('0x3f')][_0x690d('0x56')]({'where':{'id':_0xd19d58['params']['id']},'include':[{'model':db[_0x690d('0x3c')],'as':_0x690d('0x3d')}]})[_0x690d('0x1e')](handleEntityNotFound(_0x599193,null))[_0x690d('0x1e')](saveUpdates(_0xd19d58['body'],null))[_0x690d('0x1e')](respondWithResult(_0x599193,null))[_0x690d('0x27')](handleError(_0x599193,null));};exports['destroy']=function(_0x501b0a,_0x11e3ae){return db[_0x690d('0x3f')][_0x690d('0x56')]({'where':{'id':_0x501b0a[_0x690d('0x5e')]['id']}})[_0x690d('0x1e')](handleEntityNotFound(_0x11e3ae,null))[_0x690d('0x1e')](removeEntity(_0x11e3ae,null))['catch'](handleError(_0x11e3ae,null));};exports[_0x690d('0x5f')]=function(_0xf41943,_0x308ae2){return db[_0x690d('0x3f')]['describe']()['then'](respondWithResult(_0x308ae2,null))['catch'](handleError(_0x308ae2,null));};exports['addDisposition']=function(_0x5036f3,_0x520ea3,_0x2e49f1){if(_0x5036f3[_0x690d('0x5d')]['id']){delete _0x5036f3[_0x690d('0x5d')]['id'];}return db[_0x690d('0x3f')][_0x690d('0x56')]({'where':{'id':_0x5036f3['params']['id']}})[_0x690d('0x1e')](handleEntityNotFound(_0x520ea3,null))['then'](function(_0x2bb7fa){if(_0x2bb7fa){_0x5036f3[_0x690d('0x5d')]['OpenchannelAccountId']=_0x2bb7fa['id'];return db[_0x690d('0x60')]['create'](_0x5036f3[_0x690d('0x5d')]);}})[_0x690d('0x1e')](respondWithResult(_0x520ea3,null))[_0x690d('0x27')](handleError(_0x520ea3,null));};exports['getDispositions']=function(_0x12d260,_0x178b28,_0xec2148){var _0x822bf={'raw':![],'where':{}};var _0x17f231={};var _0x1d49a1={'count':0x0,'rows':[]};return db[_0x690d('0x3f')][_0x690d('0x61')]({'where':{'id':_0x12d260['params']['id']}})[_0x690d('0x1e')](handleEntityNotFound(_0x178b28,null))[_0x690d('0x1e')](function(_0x475e30){if(_0x475e30){_0x17f231['model']=_[_0x690d('0x54')](db[_0x690d('0x60')]['rawAttributes']);_0x17f231[_0x690d('0x43')]=_[_0x690d('0x54')](_0x12d260['query']);_0x17f231[_0x690d('0x44')]=_[_0x690d('0x45')](_0x17f231[_0x690d('0x42')],_0x17f231[_0x690d('0x43')]);_0x822bf[_0x690d('0x46')]=_['intersection'](_0x17f231[_0x690d('0x42')],qs[_0x690d('0x47')](_0x12d260['query'][_0x690d('0x47')]));_0x822bf['attributes']=_0x822bf[_0x690d('0x46')][_0x690d('0x48')]?_0x822bf[_0x690d('0x46')]:_0x17f231[_0x690d('0x42')];if(!_0x12d260['query'][_0x690d('0x49')](_0x690d('0x62'))){_0x822bf[_0x690d('0x2e')]=qs[_0x690d('0x2e')](_0x12d260['query'][_0x690d('0x2e')]);_0x822bf[_0x690d('0x2c')]=qs[_0x690d('0x2c')](_0x12d260[_0x690d('0x43')][_0x690d('0x2c')]);}_0x822bf[_0x690d('0x4a')]=qs[_0x690d('0x4b')](_0x12d260[_0x690d('0x43')]['sort']);_0x822bf[_0x690d('0x4d')]=qs['filters'](_[_0x690d('0x4c')](_0x12d260['query'],_0x17f231['filters']));_0x822bf[_0x690d('0x4d')]['OpenchannelAccountId']=_0x475e30['id'];if(_0x12d260['query']['filter']){_0x822bf['where']=_[_0x690d('0x4e')](_0x822bf[_0x690d('0x4d')],{'$or':_[_0x690d('0x3e')](_0x822bf['attributes'],function(_0x27d239){var _0xfae6c5={};_0xfae6c5[_0x27d239]={'$like':'%'+_0x12d260['query'][_0x690d('0x63')]+'%'};return _0xfae6c5;})});}_0x822bf=_[_0x690d('0x4e')]({},_0x822bf,_0x12d260[_0x690d('0x50')]);return db['Disposition']['count']({'where':_0x822bf['where']})['then'](function(_0x23f3dd){_0x1d49a1[_0x690d('0x2f')]=_0x23f3dd;if(_0x12d260[_0x690d('0x43')][_0x690d('0x55')]){_0x822bf[_0x690d('0x51')]=[{'all':!![]}];}return db[_0x690d('0x60')][_0x690d('0x52')](_0x822bf);})[_0x690d('0x1e')](function(_0x1c7cf5){_0x1d49a1['rows']=_0x1c7cf5;return _0x1d49a1;});}})[_0x690d('0x1e')](respondWithFilteredResult(_0x178b28,_0x822bf))[_0x690d('0x27')](handleError(_0x178b28,null));};exports['removeDispositions']=function(_0x1a96be,_0x368c7d,_0x338c67){return db[_0x690d('0x3f')][_0x690d('0x56')]({'where':{'id':_0x1a96be['params']['id']}})[_0x690d('0x1e')](handleEntityNotFound(_0x368c7d,null))[_0x690d('0x1e')](function(_0x5d249e){if(_0x5d249e){return _0x5d249e[_0x690d('0x64')](_0x1a96be[_0x690d('0x43')][_0x690d('0x65')]);}})[_0x690d('0x1e')](respondWithStatusCode(_0x368c7d,null))[_0x690d('0x27')](handleError(_0x368c7d,null));};exports[_0x690d('0x66')]=function(_0x4cd501,_0x155820,_0x583d24){if(_0x4cd501[_0x690d('0x5d')]['id']){delete _0x4cd501[_0x690d('0x5d')]['id'];}return db[_0x690d('0x3f')][_0x690d('0x56')]({'where':{'id':_0x4cd501[_0x690d('0x5e')]['id']}})[_0x690d('0x1e')](handleEntityNotFound(_0x155820,null))[_0x690d('0x1e')](function(_0x44ffea){if(_0x44ffea){_0x4cd501[_0x690d('0x5d')]['OpenchannelAccountId']=_0x44ffea['id'];return db[_0x690d('0x67')][_0x690d('0x57')](_0x4cd501[_0x690d('0x5d')]);}})['then'](respondWithResult(_0x155820,null))[_0x690d('0x27')](handleError(_0x155820,null));};exports[_0x690d('0x68')]=function(_0x36fc25,_0x38ace3,_0x1996c0){var _0x26af90={'raw':![],'where':{}};var _0x19ca24={};var _0x591224={'count':0x0,'rows':[]};return db[_0x690d('0x3f')][_0x690d('0x61')]({'where':{'id':_0x36fc25[_0x690d('0x5e')]['id']}})[_0x690d('0x1e')](handleEntityNotFound(_0x38ace3,null))[_0x690d('0x1e')](function(_0x59af05){if(_0x59af05){_0x19ca24['model']=_[_0x690d('0x54')](db['CannedAnswer'][_0x690d('0x69')]);_0x19ca24[_0x690d('0x43')]=_[_0x690d('0x54')](_0x36fc25[_0x690d('0x43')]);_0x19ca24[_0x690d('0x44')]=_[_0x690d('0x45')](_0x19ca24[_0x690d('0x42')],_0x19ca24[_0x690d('0x43')]);_0x26af90[_0x690d('0x46')]=_[_0x690d('0x45')](_0x19ca24['model'],qs[_0x690d('0x47')](_0x36fc25[_0x690d('0x43')][_0x690d('0x47')]));_0x26af90['attributes']=_0x26af90[_0x690d('0x46')][_0x690d('0x48')]?_0x26af90['attributes']:_0x19ca24['model'];if(!_0x36fc25[_0x690d('0x43')]['hasOwnProperty'](_0x690d('0x62'))){_0x26af90[_0x690d('0x2e')]=qs['limit'](_0x36fc25[_0x690d('0x43')][_0x690d('0x2e')]);_0x26af90[_0x690d('0x2c')]=qs[_0x690d('0x2c')](_0x36fc25[_0x690d('0x43')][_0x690d('0x2c')]);}_0x26af90[_0x690d('0x4a')]=qs['sort'](_0x36fc25[_0x690d('0x43')]['sort']);_0x26af90[_0x690d('0x4d')]=qs['filters'](_['pick'](_0x36fc25[_0x690d('0x43')],_0x19ca24[_0x690d('0x44')]));_0x26af90[_0x690d('0x4d')]['OpenchannelAccountId']=_0x59af05['id'];if(_0x36fc25[_0x690d('0x43')][_0x690d('0x63')]){_0x26af90['where']=_[_0x690d('0x4e')](_0x26af90[_0x690d('0x4d')],{'$or':_[_0x690d('0x3e')](_0x26af90[_0x690d('0x46')],function(_0x3def3f){var _0x3415af={};_0x3415af[_0x3def3f]={'$like':'%'+_0x36fc25['query']['filter']+'%'};return _0x3415af;})});}_0x26af90=_['merge']({},_0x26af90,_0x36fc25['options']);return db[_0x690d('0x67')][_0x690d('0x2f')]({'where':_0x26af90[_0x690d('0x4d')]})[_0x690d('0x1e')](function(_0xbfc77e){_0x591224[_0x690d('0x2f')]=_0xbfc77e;if(_0x36fc25[_0x690d('0x43')][_0x690d('0x55')]){_0x26af90[_0x690d('0x51')]=[{'all':!![]}];}return db[_0x690d('0x67')]['findAll'](_0x26af90);})[_0x690d('0x1e')](function(_0x5dff2e){_0x591224[_0x690d('0x6a')]=_0x5dff2e;return _0x591224;});}})[_0x690d('0x1e')](respondWithFilteredResult(_0x38ace3,_0x26af90))[_0x690d('0x27')](handleError(_0x38ace3,null));};exports[_0x690d('0x6b')]=function(_0x22555e,_0x3ce1e8,_0x35fe38){return db[_0x690d('0x3f')]['find']({'where':{'id':_0x22555e[_0x690d('0x5e')]['id']}})['then'](handleEntityNotFound(_0x3ce1e8,null))[_0x690d('0x1e')](function(_0xa6cdf0){if(_0xa6cdf0){return _0xa6cdf0['removeAnswers'](_0x22555e[_0x690d('0x43')][_0x690d('0x65')]);}})['then'](respondWithStatusCode(_0x3ce1e8,null))[_0x690d('0x27')](handleError(_0x3ce1e8,null));};exports[_0x690d('0x6c')]=function(_0x2549d3,_0x430927,_0x219393){var _0x404ea8={'body':_0x2549d3[_0x690d('0x5d')],'channel':_0x690d('0x6d')};var _0x2fa22f=[];var _0x51d030=[];var _0x2cfe63={};var _0x36d5fe=![];return db[_0x690d('0x6e')][_0x690d('0x5f')]()[_0x690d('0x1e')](function(_0x22ba71){if(!_0x22ba71){throw new db[(_0x690d('0x6f'))][(_0x690d('0x70'))](_0x690d('0x71'));}_0x2fa22f=_[_0x690d('0x72')](_['keys'](_0x22ba71),['createdAt',_0x690d('0x73')]);_0x51d030=_[_0x690d('0x72')](_[_0x690d('0x54')](_0x22ba71),[_0x690d('0x74'),'updatedAt','CompanyId','ListId']);if(_0x2549d3[_0x690d('0x5d')]['id']){delete _0x2549d3['body']['id'];}if(_[_0x690d('0x75')](_0x2549d3[_0x690d('0x5d')][_0x690d('0x76')])){throw new db['Sequelize'][(_0x690d('0x70'))](_0x690d('0x77'));}if(_[_0x690d('0x75')](_0x2549d3['body'][_0x690d('0x5d')])||_0x2549d3[_0x690d('0x5d')][_0x690d('0x5d')]===''){throw new db[(_0x690d('0x6f'))]['ValidationError'](_0x690d('0x78'));}if(_['isNil'](_0x2549d3[_0x690d('0x5d')]['mapKey'])){throw new db['Sequelize']['ValidationError'](_0x690d('0x79')+_0x51d030);}if(!_[_0x690d('0x7a')](_0x51d030,_0x2549d3[_0x690d('0x5d')]['mapKey'])){throw new db[(_0x690d('0x6f'))][(_0x690d('0x70'))](_0x690d('0x7b')+_0x51d030);}_0x2cfe63[_0x2549d3[_0x690d('0x5d')][_0x690d('0x7c')]]=_0x2549d3['body'][_0x690d('0x76')];})['then'](function(){return db[_0x690d('0x3f')][_0x690d('0x56')]({'where':{'id':_0x2549d3[_0x690d('0x5e')]['id']},'include':[{'model':db[_0x690d('0x7d')],'as':_0x690d('0x7e'),'include':[{'model':db[_0x690d('0x6e')],'as':_0x690d('0x7f'),'where':_0x2cfe63,'limit':0x1,'order':[[_0x690d('0x73'),_0x690d('0x80')]]}]},{'model':db[_0x690d('0x81')],'as':'Applications'}]});})[_0x690d('0x1e')](handleEntityNotFound(_0x430927,null))['then'](function(_0x2cc9ba){if(_0x2cc9ba&&_0x2cc9ba[_0x690d('0x7e')]){_0x404ea8[_0x690d('0x82')]=_0x2cc9ba;_0x404ea8[_0x690d('0x83')]=_0x2cc9ba[_0x690d('0x84')];_0x404ea8[_0x690d('0x85')]=_0x2cc9ba[_0x690d('0x7e')];_0x404ea8[_0x690d('0x83')]=_['orderBy'](_0x404ea8['applications'],[_0x690d('0x86')],[_0x690d('0x87')]);if(_0x404ea8[_0x690d('0x82')][_0x690d('0x84')]){delete _0x404ea8[_0x690d('0x82')][_0x690d('0x84')];}if(_0x404ea8[_0x690d('0x82')]['List']&&_0x404ea8[_0x690d('0x82')]['List'][_0x690d('0x7f')][_0x690d('0x48')]){return _0x404ea8[_0x690d('0x82')]['List'][_0x690d('0x7f')][0x0];}var _0x12da2c=_[_0x690d('0x18')](_0x2549d3[_0x690d('0x5d')],{'firstName':_0x2549d3[_0x690d('0x5d')][_0x690d('0x76')],'ListId':_0x2cc9ba[_0x690d('0x88')]});_0x12da2c[_0x2549d3[_0x690d('0x5d')][_0x690d('0x7c')]]=_0x2549d3['body'][_0x690d('0x76')];return db[_0x690d('0x6e')][_0x690d('0x57')](_0x12da2c,{'fields':_0x2fa22f,'raw':!![]});}})[_0x690d('0x1e')](handleEntityNotFound(_0x430927,null))[_0x690d('0x1e')](function(_0x12ba54){_0x404ea8[_0x690d('0x89')]=_0x12ba54;if(_0x12ba54){var _0x36585c={'ContactId':_0x12ba54['id'],'OpenchannelAccountId':_0x2549d3[_0x690d('0x5e')]['id'],'from':(_0x12ba54[_0x690d('0x8a')]||'')+'\x20'+(_0x12ba54[_0x690d('0x8b')]||'')};var _0x5ce4d6={'OpenchannelAccountId':_0x2549d3['params']['id'],'closed':![]};if(_0x2549d3['body'][_0x690d('0x8c')]){_0x5ce4d6[_0x690d('0x8c')]=_0x2549d3['body']['threadId'];return db['OpenchannelInteraction'][_0x690d('0x56')]({'where':_0x5ce4d6})[_0x690d('0x1e')](function(_0x14ab6e){if(_0x14ab6e){return[_0x14ab6e,![]];}_0x36585c[_0x690d('0x8c')]=_0x2549d3[_0x690d('0x5d')][_0x690d('0x8c')];_0x36585c[_0x690d('0x8d')]=_0x2549d3[_0x690d('0x5d')][_0x690d('0x8d')];return db['OpenchannelInteraction'][_0x690d('0x57')](_0x36585c)[_0x690d('0x1e')](function(_0x50a51a){return[_0x50a51a,!![]];});});}else{_0x5ce4d6['threadId']=null;}_0x5ce4d6['ContactId']=_0x12ba54['id'];return db[_0x690d('0x8e')][_0x690d('0x56')]({'where':_0x5ce4d6})[_0x690d('0x1e')](function(_0x3b36fd){if(_0x3b36fd){return[_0x3b36fd,![]];}return db[_0x690d('0x8e')][_0x690d('0x57')](_0x36585c)[_0x690d('0x1e')](function(_0x5b8d0f){return[_0x5b8d0f,!![]];});});}})['spread'](function(_0x23e30f,_0x4cc53b){if(_0x23e30f){_0x36d5fe=_0x4cc53b;if(!_0x4cc53b){var _0x32ae15={'from':(_0x404ea8['contact'][_0x690d('0x8a')]||'')+'\x20'+(_0x404ea8[_0x690d('0x89')][_0x690d('0x8b')]||'')};if(_0x2549d3[_0x690d('0x5d')][_0x690d('0x8c')]&&_0x2549d3[_0x690d('0x5d')]['messageId']&&_0x2549d3[_0x690d('0x5d')][_0x690d('0x8c')]!=_0x2549d3['body']['messageId']){_0x32ae15[_0x690d('0x8c')]=_0x2549d3['body'][_0x690d('0x8f')];}return _0x23e30f[_0x690d('0x34')](_0x32ae15);}else{return _0x23e30f;}}})[_0x690d('0x1e')](function(_0x5100e7){_0x404ea8['interaction']=_0x5100e7[_0x690d('0x36')]({'plain':!![]});_0x404ea8['interaction']['created']=_0x36d5fe;if(_0x404ea8[_0x690d('0x90')]['created']){if(_0x404ea8[_0x690d('0x82')][_0x690d('0x91')]){_0x404ea8[_0x690d('0x83')]['push']({'id':0x0,'priority':_0x404ea8['applications']['length']+0x1,'app':'close','appdata':_0x690d('0x92'),'interval':'*,*,*,*'});}}return db['OpenchannelMessage'][_0x690d('0x57')]({'body':_0x2549d3[_0x690d('0x5d')][_0x690d('0x5d')],'OpenchannelAccountId':_0x2549d3['params']['id'],'OpenchannelInteractionId':_0x5100e7['id'],'direction':'in','ContactId':_0x404ea8[_0x690d('0x89')]['id'],'AttachmentId':_0x2549d3['body']['AttachmentId']});})[_0x690d('0x1e')](function(_0x507305){_0x404ea8[_0x690d('0x24')]=_0x507305;if(_0x404ea8['interaction'][_0x690d('0x93')]){return db[_0x690d('0x94')][_0x690d('0x56')]({'attributes':['id',_0x690d('0x39')],'where':{'id':_0x404ea8[_0x690d('0x90')][_0x690d('0x93')]}})[_0x690d('0x1e')](function(_0x48897e){if(_0x48897e){_0x404ea8[_0x690d('0x83')][_0x690d('0x95')]({'id':0x0,'priority':0x0,'app':_0x690d('0x96'),'appdata':_0x48897e['name']+','+(_0x404ea8[_0x690d('0x82')]['waitForTheAssignedAgent']||0xa),'interval':_0x690d('0x97')});_0x404ea8[_0x690d('0x98')]=![];}return respondWithRpcPromise(_0x690d('0x99'),_0x690d('0x9a'),_0x404ea8);});}return respondWithRpcPromise(_0x690d('0x99'),_0x690d('0x9a'),_0x404ea8);})['then'](function(_0x4806de){respondWithRpcPromise(_0x690d('0x9b'),_0x690d('0x9b'),{'event':_0x690d('0x6c'),'message':_0x4806de},client9002);return _0x4806de;})[_0x690d('0x1e')](respondWithResult(_0x430927,null))[_0x690d('0x27')](handleError(_0x430927,null));};exports[_0x690d('0x9c')]=function(_0x3b52f5,_0x2f3f41){var _0x44e719=_0x3b52f5['params']['id'];var _0x17f99a=_0x3b52f5[_0x690d('0x5d')];var _0x912451=0xc8;var _0x22a149=null;return db[_0x690d('0x9d')][_0x690d('0x9e')]({'isolationLevel':db[_0x690d('0x9d')][_0x690d('0x9f')][_0x690d('0xa0')][_0x690d('0xa1')]},function(_0x485c9f){return db[_0x690d('0x3f')]['findOne']({'where':{'id':_0x44e719},'transaction':_0x485c9f})[_0x690d('0x1e')](function(_0x3af2da){if(_0x3af2da){return db[_0x690d('0x81')]['destroy']({'where':{'OpenchannelAccountId':_0x44e719},'transaction':_0x485c9f})[_0x690d('0x1e')](function(){var _0x329c08=_['map'](_0x17f99a,function(_0x3bab56){_0x3bab56[_0x690d('0xa2')]=_0x44e719;return _0x3bab56;});return db['OpenchannelApplication'][_0x690d('0xa3')](_0x329c08,{'transaction':_0x485c9f});});}else{_0x912451=0x194;_0x22a149=[];}});})[_0x690d('0x1e')](function(){if(_0x912451!==0x194){return db['OpenchannelApplication'][_0x690d('0xa4')]({'where':{'OpenchannelAccountId':_0x44e719},'order':_0x690d('0x86')})['then'](function(_0x4dc45c){_0x22a149=_0x4dc45c;});}})['catch'](function(_0x35f0fb){_0x912451=0x1f4;logger[_0x690d('0x23')](_0x35f0fb[_0x690d('0x38')]);if(_0x35f0fb[_0x690d('0x39')]){delete _0x35f0fb['name'];}_0x22a149=_0x35f0fb;})['finally'](function(){if(_0x22a149===null){_0x2f3f41[_0x690d('0x29')](_0x912451);}else{if(_0x912451===0x1f4){_0x2f3f41['status'](_0x912451)['send'](_0x22a149);}else{_0x2f3f41['status'](_0x912451)[_0x690d('0xa5')](_0x22a149);}}});};exports[_0x690d('0xa6')]=function(_0xc5d224,_0x5329c3,_0x2a0f0e){var _0x5e61eb={};var _0xfd1963={};var _0x7c995;var _0xafc88f;return db[_0x690d('0x3f')][_0x690d('0x61')]({'where':{'id':_0xc5d224[_0x690d('0x5e')]['id']}})[_0x690d('0x1e')](handleEntityNotFound(_0x5329c3,null))[_0x690d('0x1e')](function(_0x274fb0){if(_0x274fb0){_0x7c995=_0x274fb0;_0xfd1963[_0x690d('0x42')]=_[_0x690d('0x54')](db[_0x690d('0x81')][_0x690d('0x69')]);_0xfd1963[_0x690d('0x43')]=_[_0x690d('0x54')](_0xc5d224['query']);_0xfd1963[_0x690d('0x44')]=_['intersection'](_0xfd1963[_0x690d('0x42')],_0xfd1963[_0x690d('0x43')]);_0x5e61eb[_0x690d('0x46')]=_['intersection'](_0xfd1963[_0x690d('0x42')],qs['fields'](_0xc5d224[_0x690d('0x43')]['fields']));_0x5e61eb[_0x690d('0x46')]=_0x5e61eb[_0x690d('0x46')][_0x690d('0x48')]?_0x5e61eb[_0x690d('0x46')]:_0xfd1963[_0x690d('0x42')];_0x5e61eb[_0x690d('0x4a')]=qs[_0x690d('0x4b')](_0xc5d224[_0x690d('0x43')][_0x690d('0x4b')]);_0x5e61eb[_0x690d('0x4d')]=qs['filters'](_['pick'](_0xc5d224['query'],_0xfd1963['filters']));if(_0xc5d224[_0x690d('0x43')][_0x690d('0x63')]){_0x5e61eb[_0x690d('0x4d')]=_[_0x690d('0x4e')](_0x5e61eb[_0x690d('0x4d')],{'$or':_[_0x690d('0x3e')](_0x5e61eb[_0x690d('0x46')],function(_0x3d2abc){var _0x3cd0dd={};_0x3cd0dd[_0x3d2abc]={'$like':'%'+_0xc5d224['query'][_0x690d('0x63')]+'%'};return _0x3cd0dd;})});}_0x5e61eb=_[_0x690d('0x4e')]({},_0x5e61eb,_0xc5d224[_0x690d('0x50')]);return _0x7c995[_0x690d('0xa6')](_0x5e61eb);}})[_0x690d('0x1e')](function(_0x527844){if(_0x527844){_0xafc88f=_0x527844[_0x690d('0x48')];if(!_0xc5d224[_0x690d('0x43')][_0x690d('0x49')](_0x690d('0x62'))){_0x5e61eb[_0x690d('0x2e')]=qs[_0x690d('0x2e')](_0xc5d224['query'][_0x690d('0x2e')]);_0x5e61eb[_0x690d('0x2c')]=qs[_0x690d('0x2c')](_0xc5d224[_0x690d('0x43')]['offset']);}return _0x7c995[_0x690d('0xa6')](_0x5e61eb);}})[_0x690d('0x1e')](function(_0x3fa96c){if(_0x3fa96c){return _0x3fa96c?{'count':_0xafc88f,'rows':_0x3fa96c}:null;}})['then'](respondWithResult(_0x5329c3,null))['catch'](handleError(_0x5329c3,null));};exports[_0x690d('0xa7')]=function(_0x2ab9c6,_0xb5f73a,_0x2c4ec7){var _0x48c039={'raw':![],'where':{}};var _0x2fa7f5={};var _0x1f2c43={'count':0x0,'rows':[]};return db[_0x690d('0x3f')][_0x690d('0x61')]({'where':{'id':_0x2ab9c6['params']['id']}})[_0x690d('0x1e')](handleEntityNotFound(_0xb5f73a,null))[_0x690d('0x1e')](function(_0x51798c){if(_0x51798c){_0x2fa7f5[_0x690d('0x42')]=_['keys'](db[_0x690d('0x8e')][_0x690d('0x69')]);_0x2fa7f5[_0x690d('0x43')]=_['keys'](_0x2ab9c6[_0x690d('0x43')]);_0x2fa7f5[_0x690d('0x44')]=_[_0x690d('0x45')](_0x2fa7f5[_0x690d('0x42')],_0x2fa7f5['query']);_0x48c039['attributes']=_[_0x690d('0x45')](_0x2fa7f5[_0x690d('0x42')],qs[_0x690d('0x47')](_0x2ab9c6['query'][_0x690d('0x47')]));_0x48c039[_0x690d('0x46')]=_0x48c039[_0x690d('0x46')]['length']?_0x48c039['attributes']:_0x2fa7f5[_0x690d('0x42')];if(!_0x2ab9c6[_0x690d('0x43')]['hasOwnProperty'](_0x690d('0x62'))){_0x48c039['limit']=qs[_0x690d('0x2e')](_0x2ab9c6['query']['limit']);_0x48c039[_0x690d('0x2c')]=qs[_0x690d('0x2c')](_0x2ab9c6[_0x690d('0x43')][_0x690d('0x2c')]);}_0x48c039[_0x690d('0x4a')]=qs[_0x690d('0x4b')](_0x2ab9c6[_0x690d('0x43')][_0x690d('0x4b')]);_0x48c039['where']=qs[_0x690d('0x44')](_[_0x690d('0x4c')](_0x2ab9c6['query'],_0x2fa7f5[_0x690d('0x44')]));_0x48c039[_0x690d('0x4d')]['OpenchannelAccountId']=_0x51798c['id'];if(_0x2ab9c6['query']['filter']){_0x48c039[_0x690d('0x4d')]=_[_0x690d('0x4e')](_0x48c039[_0x690d('0x4d')],{'$or':_[_0x690d('0x3e')](_0x48c039[_0x690d('0x46')],function(_0x2e6514){var _0x331024={};_0x331024[_0x2e6514]={'$like':'%'+_0x2ab9c6[_0x690d('0x43')][_0x690d('0x63')]+'%'};return _0x331024;})});}_0x48c039=_[_0x690d('0x4e')]({},_0x48c039,_0x2ab9c6[_0x690d('0x50')]);return db[_0x690d('0x8e')][_0x690d('0x2f')]({'where':_0x48c039[_0x690d('0x4d')]})['then'](function(_0x3c0578){_0x1f2c43[_0x690d('0x2f')]=_0x3c0578;if(_0x2ab9c6[_0x690d('0x43')][_0x690d('0x55')]){_0x48c039[_0x690d('0x51')]=[{'model':db[_0x690d('0x6e')],'as':'Contact','required':![]},{'model':db[_0x690d('0x94')],'as':'Owner','attributes':['name',_0x690d('0xa8'),_0x690d('0xa9')],'required':![]},{'model':db[_0x690d('0xaa')],'as':_0x690d('0xab'),'attributes':['id',_0x690d('0x39'),_0x690d('0xac')],'where':_0x2ab9c6['query']['tag']?{'id':_0x2ab9c6[_0x690d('0x43')][_0x690d('0xad')]}:undefined,'required':_0x2ab9c6[_0x690d('0x43')][_0x690d('0xad')]?!![]:![]}];}return db['OpenchannelInteraction'][_0x690d('0x52')](_0x48c039);})['then'](function(_0x102264){_0x1f2c43['rows']=_0x102264;return _0x1f2c43;});}})[_0x690d('0x1e')](respondWithFilteredResult(_0xb5f73a,_0x48c039))[_0x690d('0x27')](handleError(_0xb5f73a,null));};exports[_0x690d('0xae')]=function(_0x45f488,_0xd4fad9,_0x529f99){return db[_0x690d('0x3f')]['find']({'where':{'id':_0x45f488['params']['id']}})[_0x690d('0x1e')](handleEntityNotFound(_0xd4fad9,null))[_0x690d('0x1e')](function(_0x35ba0d){if(_0x35ba0d){return _0x35ba0d[_0x690d('0xae')](_0x45f488[_0x690d('0x5d')][_0x690d('0x65')],_[_0x690d('0xaf')](_0x45f488[_0x690d('0x5d')],[_0x690d('0x65'),'id'])||{})[_0x690d('0xb0')](function(_0x389a65){for(var _0x1b681e=0x0;_0x1b681e<_0x45f488[_0x690d('0x5d')][_0x690d('0x65')][_0x690d('0x48')];_0x1b681e+=0x1){socket[_0x690d('0xb1')]('userOpenchannelAccount:save',{'UserId':Number(_0x45f488[_0x690d('0x5d')][_0x690d('0x65')][_0x1b681e]),'OpenchannelAccountId':Number(_0x45f488[_0x690d('0x5e')]['id'])});}return _0x389a65;});}})['then'](respondWithResult(_0xd4fad9,null))[_0x690d('0x27')](handleError(_0xd4fad9,null));};exports['removeAgents']=function(_0xd40c52,_0x437628,_0xebba70){return db[_0x690d('0x3f')]['find']({'where':{'id':_0xd40c52[_0x690d('0x5e')]['id']}})[_0x690d('0x1e')](handleEntityNotFound(_0x437628,null))['then'](function(_0x1ce912){if(_0x1ce912){return _0x1ce912[_0x690d('0xb2')](_0xd40c52[_0x690d('0x43')][_0x690d('0x65')])[_0x690d('0x1e')](function(){if(_['isArray'](_0xd40c52[_0x690d('0x43')][_0x690d('0x65')])){for(var _0x5deb79=0x0;_0x5deb79<_0xd40c52[_0x690d('0x43')][_0x690d('0x65')][_0x690d('0x48')];_0x5deb79+=0x1){socket['emit'](_0x690d('0xb3'),{'UserId':Number(_0xd40c52[_0x690d('0x43')][_0x690d('0x65')][_0x5deb79]),'OpenchannelAccountId':Number(_0xd40c52[_0x690d('0x5e')]['id'])});}}else{socket[_0x690d('0xb1')]('userOpenchannelAccount:remove',{'UserId':Number(_0xd40c52[_0x690d('0x43')][_0x690d('0x65')]),'OpenchannelAccountId':Number(_0xd40c52[_0x690d('0x5e')]['id'])});}});}})[_0x690d('0x1e')](respondWithStatusCode(_0x437628,null))[_0x690d('0x27')](handleError(_0x437628,null));};exports[_0x690d('0xb4')]=function(_0x809583,_0x1cee60,_0x106bd8){var _0x3403d8={};var _0x12ac5b={};var _0x28e64e;var _0x228cd0;return db['OpenchannelAccount']['findOne']({'where':{'id':_0x809583[_0x690d('0x5e')]['id']}})[_0x690d('0x1e')](handleEntityNotFound(_0x1cee60,null))['then'](function(_0x198554){if(_0x198554){_0x28e64e=_0x198554;_0x12ac5b[_0x690d('0x42')]=_[_0x690d('0x54')](db[_0x690d('0x94')][_0x690d('0x69')]);_0x12ac5b[_0x690d('0x43')]=_['keys'](_0x809583[_0x690d('0x43')]);_0x12ac5b[_0x690d('0x44')]=_[_0x690d('0x45')](_0x12ac5b[_0x690d('0x42')],_0x12ac5b[_0x690d('0x43')]);_0x3403d8[_0x690d('0x46')]=_[_0x690d('0x45')](_0x12ac5b['model'],qs[_0x690d('0x47')](_0x809583[_0x690d('0x43')][_0x690d('0x47')]));_0x3403d8[_0x690d('0x46')]=_0x3403d8[_0x690d('0x46')][_0x690d('0x48')]?_0x3403d8[_0x690d('0x46')]:_0x12ac5b['model'];_0x3403d8['order']=qs[_0x690d('0x4b')](_0x809583[_0x690d('0x43')][_0x690d('0x4b')]);_0x3403d8[_0x690d('0x4d')]=qs['filters'](_[_0x690d('0x4c')](_0x809583[_0x690d('0x43')],_0x12ac5b[_0x690d('0x44')]));if(_0x809583[_0x690d('0x43')][_0x690d('0x63')]){_0x3403d8[_0x690d('0x4d')]=_[_0x690d('0x4e')](_0x3403d8[_0x690d('0x4d')],{'$or':_['map'](_0x3403d8[_0x690d('0x46')],function(_0x3503fc){var _0x2902a6={};_0x2902a6[_0x3503fc]={'$like':'%'+_0x809583[_0x690d('0x43')]['filter']+'%'};return _0x2902a6;})});}_0x3403d8=_[_0x690d('0x4e')]({},_0x3403d8,_0x809583['options']);return _0x28e64e[_0x690d('0xb4')](_0x3403d8);}})[_0x690d('0x1e')](function(_0x31aa37){if(_0x31aa37){_0x228cd0=_0x31aa37[_0x690d('0x48')];if(!_0x809583['query']['hasOwnProperty'](_0x690d('0x62'))){_0x3403d8[_0x690d('0x2e')]=qs[_0x690d('0x2e')](_0x809583[_0x690d('0x43')][_0x690d('0x2e')]);_0x3403d8[_0x690d('0x2c')]=qs['offset'](_0x809583[_0x690d('0x43')][_0x690d('0x2c')]);}return _0x28e64e[_0x690d('0xb4')](_0x3403d8);}})['then'](function(_0x1dc21d){if(_0x1dc21d){return _0x1dc21d?{'count':_0x228cd0,'rows':_0x1dc21d}:null;}})[_0x690d('0x1e')](respondWithResult(_0x1cee60,null))[_0x690d('0x27')](handleError(_0x1cee60,null));};exports[_0x690d('0x3a')]=function(_0x5f173c,_0x44d6f1,_0x2ed53d){var _0x134c1a,_0xf06fd0,_0x302325;if(_[_0x690d('0x75')](_0x5f173c[_0x690d('0x5d')][_0x690d('0x5d')])||_0x5f173c[_0x690d('0x5d')][_0x690d('0x5d')]===''){throw new db[(_0x690d('0x6f'))][(_0x690d('0x70'))](_0x690d('0x78'));}if(_['isNil'](_0x5f173c['body']['to'])){}_0x134c1a=_0x5f173c['body']['to'];return db[_0x690d('0x3f')]['findOne']({'where':{'id':_0x5f173c[_0x690d('0x5e')]['id']}})[_0x690d('0x1e')](handleEntityNotFound(_0x44d6f1,null))[_0x690d('0x1e')](function(_0x5515fe){if(_0x5515fe){return db[_0x690d('0x3f')]['find']({'where':{'id':_0x5515fe['id']},'include':[{'model':db[_0x690d('0x7d')],'as':_0x690d('0x7e'),'include':[{'model':db[_0x690d('0x6e')],'as':_0x690d('0x7f'),'where':{[_0x5515fe[_0x690d('0x7c')]]:_0x134c1a},'limit':0x1,'order':[[_0x690d('0x73'),_0x690d('0x80')]]}]}]})[_0x690d('0x1e')](handleEntityNotFound(_0x44d6f1,null))[_0x690d('0x1e')](function(_0x2bb3c9){if(_0x2bb3c9&&_0x2bb3c9[_0x690d('0x7e')]){_0xf06fd0=_0x2bb3c9[_0x690d('0x36')]({'plain':!![]});if(_0xf06fd0[_0x690d('0x7e')]&&_0xf06fd0[_0x690d('0x7e')]['Contacts'][_0x690d('0x48')]){return _0xf06fd0[_0x690d('0x7e')][_0x690d('0x7f')][0x0];}return db[_0x690d('0x6e')]['create'](_[_0x690d('0x18')](_0x5f173c[_0x690d('0x5d')],{'firstName':_0x134c1a,[_0x2bb3c9[_0x690d('0x7c')]]:_0x134c1a,'phone':_0x134c1a,'ListId':_0xf06fd0[_0x690d('0x88')]}));}})['then'](handleEntityNotFound(_0x44d6f1,null))[_0x690d('0x1e')](function(_0x4c9df7){if(_0x4c9df7){_0x302325=_0x4c9df7;return db[_0x690d('0x8e')][_0x690d('0x56')]({'where':{'ContactId':_0x302325['id'],'closed':![],'OpenchannelAccountId':_0xf06fd0['id']}})[_0x690d('0x1e')](function(_0x3616ba){if(_0x3616ba){return[_0x3616ba,![]];}return db['OpenchannelInteraction']['create']({'UserId':_0x5f173c[_0x690d('0x58')]['id'],'ContactId':_0x302325['id'],'OpenchannelAccountId':_0xf06fd0['id'],'lastMsgDirection':'out','Messages':[_[_0x690d('0x4e')](_0x5f173c[_0x690d('0x5d')],{'read':![],'body':_0x5f173c[_0x690d('0x5d')][_0x690d('0x5d')],'OpenchannelAccountId':_0xf06fd0['id'],'UserId':_0x5f173c[_0x690d('0x58')]['id'],'ContactId':_0x302325['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':_0x690d('0xb5')}]})[_0x690d('0x1e')](function(_0x2d5c6b){return[_0x2d5c6b,!![]];});});}})[_0x690d('0xb0')](function(_0x5e0149,_0x38f257){if(_0x38f257){return _0x5e0149;}return db['OpenchannelMessage']['create'](_[_0x690d('0x4e')](_0x5f173c[_0x690d('0x5d')],{'read':![],'body':_0x5f173c[_0x690d('0x5d')]['body'],'OpenchannelAccountId':_0xf06fd0['id'],'OpenchannelInteractionId':_0x5e0149['id'],'UserId':_0x5f173c[_0x690d('0x58')]['id'],'ContactId':_0x302325['id']}))[_0x690d('0x1e')](function(_0x4c2018){_0x5e0149[_0x690d('0xb6')]['Messages']=[];_0x5e0149[_0x690d('0xb6')][_0x690d('0xb5')][_0x690d('0xb7')](_0x4c2018[_0x690d('0xb6')]);return _0x5e0149;});});}})['then'](respondWithResult(_0x44d6f1,null))[_0x690d('0x27')](handleError(_0x44d6f1,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index add697e..134442e 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 _0x1339=['update','remove','emit','hasOwnProperty','exports','OpenchannelAccount','setMaxListeners','save'];(function(_0x2d92e7,_0xb16f8c){var _0x467b42=function(_0x22f926){while(--_0x22f926){_0x2d92e7['push'](_0x2d92e7['shift']());}};_0x467b42(++_0xb16f8c);}(_0x1339,0x1ed));var _0x9133=function(_0x228134,_0x3be2fa){_0x228134=_0x228134-0x0;var _0x88e326=_0x1339[_0x228134];return _0x88e326;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require('../../mysqldb')['db'][_0x9133('0x0')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x9133('0x1')](0x0);var events={'afterCreate':_0x9133('0x2'),'afterUpdate':_0x9133('0x3'),'afterDestroy':_0x9133('0x4')};function emitEvent(_0x192d48){return function(_0x176e80,_0x110c51,_0x558345){OpenchannelAccountEvents[_0x9133('0x5')](_0x192d48+':'+_0x176e80['id'],_0x176e80);OpenchannelAccountEvents[_0x9133('0x5')](_0x192d48,_0x176e80);_0x558345(null);};}for(var e in events){if(events[_0x9133('0x6')](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module[_0x9133('0x7')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x3c81=['hook','exports','events','../../mysqldb','setMaxListeners','save','emit','hasOwnProperty'];(function(_0x5e7634,_0x5356a1){var _0x563eb3=function(_0x1f73f7){while(--_0x1f73f7){_0x5e7634['push'](_0x5e7634['shift']());}};_0x563eb3(++_0x5356a1);}(_0x3c81,0x102));var _0x13c8=function(_0x19c6f4,_0x32ad41){_0x19c6f4=_0x19c6f4-0x0;var _0x1481a3=_0x3c81[_0x19c6f4];return _0x1481a3;};'use strict';var EventEmitter=require(_0x13c8('0x0'));var OpenchannelAccount=require(_0x13c8('0x1'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x13c8('0x2')](0x0);var events={'afterCreate':_0x13c8('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x5c3ba4){return function(_0x548599,_0x101d4f,_0x3ec886){OpenchannelAccountEvents[_0x13c8('0x4')](_0x5c3ba4+':'+_0x548599['id'],_0x548599);OpenchannelAccountEvents[_0x13c8('0x4')](_0x5c3ba4,_0x548599);_0x3ec886(null);};}for(var e in events){if(events[_0x13c8('0x5')](e)){var event=events[e];OpenchannelAccount[_0x13c8('0x6')](e,emitEvent(event));}}module[_0x13c8('0x7')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 6f86c93..835506e 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(_0x36b969,_0xb8b479){var _0x6678e6=function(_0x13f763){while(--_0x13f763){_0x36b969['push'](_0x36b969['shift']());}};_0x6678e6(++_0xb8b479);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xa9e0[_0x3c2a69];return _0x596bc8;};'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(_0x1471e2,_0x4ee512){var _0x595e43=function(_0x459a91){while(--_0x459a91){_0x1471e2['push'](_0x1471e2['shift']());}};_0x595e43(++_0x4ee512);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'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 2f7575e..a9e83b7 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 _0x44a3=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','socket.io-emitter','redis','./openchannelAccount.socket','register','request','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch'];(function(_0x4f06b6,_0x2cc180){var _0x1aee24=function(_0x4c2ca6){while(--_0x4c2ca6){_0x4f06b6['push'](_0x4f06b6['shift']());}};_0x1aee24(++_0x2cc180);}(_0x44a3,0x1a9));var _0x344a=function(_0x5be8cc,_0x4a6037){_0x5be8cc=_0x5be8cc-0x0;var _0x5f1b7e=_0x44a3[_0x5be8cc];return _0x5f1b7e;};'use strict';var _=require(_0x344a('0x0'));var util=require(_0x344a('0x1'));var moment=require(_0x344a('0x2'));var BPromise=require(_0x344a('0x3'));var rs=require(_0x344a('0x4'));var fs=require('fs');var Redis=require(_0x344a('0x5'));var db=require(_0x344a('0x6'))['db'];var utils=require(_0x344a('0x7'));var logger=require('../../config/logger')(_0x344a('0x8'));var config=require(_0x344a('0x9'));var jayson=require(_0x344a('0xa'));var client=jayson[_0x344a('0xb')][_0x344a('0xc')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x344a('0xd'))(new Redis(config[_0x344a('0xe')]));require(_0x344a('0xf'))[_0x344a('0x10')](socket);function respondWithRpcPromise(_0x2afc37,_0x54288d,_0x6e04a9){return new BPromise(function(_0x13588c,_0x559406){return client[_0x344a('0x11')](_0x2afc37,_0x6e04a9)['then'](function(_0x397476){logger['info'](_0x344a('0x12'),_0x54288d,_0x344a('0x13'));logger['debug']('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x54288d,_0x344a('0x13'),JSON[_0x344a('0x14')](_0x397476));if(_0x397476[_0x344a('0x15')]){if(_0x397476[_0x344a('0x15')][_0x344a('0x16')]===0x1f4){logger[_0x344a('0x15')]('OpenchannelAccount,\x20%s,\x20%s',_0x54288d,_0x397476[_0x344a('0x15')][_0x344a('0x17')]);return _0x559406(_0x397476[_0x344a('0x15')][_0x344a('0x17')]);}logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x54288d,_0x397476[_0x344a('0x15')][_0x344a('0x17')]);return _0x13588c(_0x397476[_0x344a('0x15')][_0x344a('0x17')]);}else{logger['info'](_0x344a('0x12'),_0x54288d,_0x344a('0x13'));_0x13588c(_0x397476['result'][_0x344a('0x17')]);}})[_0x344a('0x18')](function(_0x3e936c){logger[_0x344a('0x15')](_0x344a('0x12'),_0x54288d,_0x3e936c);_0x559406(_0x3e936c);});});} \ No newline at end of file +var _0x80ed=['../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x272648,_0x1a019f){var _0x420280=function(_0x562659){while(--_0x562659){_0x272648['push'](_0x272648['shift']());}};_0x420280(++_0x1a019f);}(_0x80ed,0x11c));var _0xd80e=function(_0x49acdc,_0x287562){_0x49acdc=_0x49acdc-0x0;var _0x479fa7=_0x80ed[_0x49acdc];return _0x479fa7;};'use strict';var _=require(_0xd80e('0x0'));var util=require('util');var moment=require(_0xd80e('0x1'));var BPromise=require(_0xd80e('0x2'));var rs=require(_0xd80e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd80e('0x4'))['db'];var utils=require(_0xd80e('0x5'));var logger=require(_0xd80e('0x6'))(_0xd80e('0x7'));var config=require('../../config/environment');var jayson=require(_0xd80e('0x8'));var client=jayson[_0xd80e('0x9')][_0xd80e('0xa')]({'port':0x232a});config['redis']=_[_0xd80e('0xb')](config[_0xd80e('0xc')],{'host':_0xd80e('0xd'),'port':0x18eb});var socket=require(_0xd80e('0xe'))(new Redis(config[_0xd80e('0xc')]));require(_0xd80e('0xf'))[_0xd80e('0x10')](socket);function respondWithRpcPromise(_0x2457f5,_0x68625,_0x7f93b4){return new BPromise(function(_0x4eee08,_0x450b44){return client[_0xd80e('0x11')](_0x2457f5,_0x7f93b4)[_0xd80e('0x12')](function(_0x30c9d0){logger[_0xd80e('0x13')](_0xd80e('0x14'),_0x68625,_0xd80e('0x15'));logger[_0xd80e('0x16')](_0xd80e('0x17'),_0x68625,'request\x20sent',JSON['stringify'](_0x30c9d0));if(_0x30c9d0['error']){if(_0x30c9d0['error'][_0xd80e('0x18')]===0x1f4){logger[_0xd80e('0x19')](_0xd80e('0x14'),_0x68625,_0x30c9d0[_0xd80e('0x19')][_0xd80e('0x1a')]);return _0x450b44(_0x30c9d0['error'][_0xd80e('0x1a')]);}logger[_0xd80e('0x19')](_0xd80e('0x14'),_0x68625,_0x30c9d0[_0xd80e('0x19')][_0xd80e('0x1a')]);return _0x4eee08(_0x30c9d0[_0xd80e('0x19')][_0xd80e('0x1a')]);}else{logger[_0xd80e('0x13')]('OpenchannelAccount,\x20%s,\x20%s',_0x68625,_0xd80e('0x15'));_0x4eee08(_0x30c9d0[_0xd80e('0x1b')][_0xd80e('0x1a')]);}})[_0xd80e('0x1c')](function(_0x593af6){logger[_0xd80e('0x19')](_0xd80e('0x14'),_0x68625,_0x593af6);_0x450b44(_0x593af6);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index fefc81f..56dab47 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 _0x97a2=['remove','update','emit','register','length','openchannelAccount:','./openchannelAccount.events'];(function(_0x574db4,_0x50d15a){var _0x310b28=function(_0x4165bd){while(--_0x4165bd){_0x574db4['push'](_0x574db4['shift']());}};_0x310b28(++_0x50d15a);}(_0x97a2,0x1b1));var _0x297a=function(_0x3fc5e7,_0x3883a7){_0x3fc5e7=_0x3fc5e7-0x0;var _0x35c2dc=_0x97a2[_0x3fc5e7];return _0x35c2dc;};'use strict';var OpenchannelAccountEvents=require(_0x297a('0x0'));var events=['save',_0x297a('0x1'),_0x297a('0x2')];function createListener(_0x25fc7c,_0xfb9aa2){return function(_0x14d6d3){_0xfb9aa2[_0x297a('0x3')](_0x25fc7c,_0x14d6d3);};}function removeListener(_0x2cf730,_0x42a0a0){return function(){OpenchannelAccountEvents['removeListener'](_0x2cf730,_0x42a0a0);};}exports[_0x297a('0x4')]=function(_0x2a420b){for(var _0x2c1f41=0x0,_0x8cbc92=events[_0x297a('0x5')];_0x2c1f41<_0x8cbc92;_0x2c1f41++){var _0x3d9c6a=events[_0x2c1f41];var _0x5ab57b=createListener(_0x297a('0x6')+_0x3d9c6a,_0x2a420b);OpenchannelAccountEvents['on'](_0x3d9c6a,_0x5ab57b);}}; \ No newline at end of file +var _0x2e31=['./openchannelAccount.events','save','remove','removeListener','openchannelAccount:'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0x2e31,0x145));var _0x12e3=function(_0x10d1e4,_0x2547e5){_0x10d1e4=_0x10d1e4-0x0;var _0x475a7f=_0x2e31[_0x10d1e4];return _0x475a7f;};'use strict';var OpenchannelAccountEvents=require(_0x12e3('0x0'));var events=[_0x12e3('0x1'),_0x12e3('0x2'),'update'];function createListener(_0x152c5f,_0x217ada){return function(_0x503380){_0x217ada['emit'](_0x152c5f,_0x503380);};}function removeListener(_0x146b6b,_0x3d2ac0){return function(){OpenchannelAccountEvents[_0x12e3('0x3')](_0x146b6b,_0x3d2ac0);};}exports['register']=function(_0x3173f9){for(var _0x16ed6b=0x0,_0x5aefcf=events['length'];_0x16ed6b<_0x5aefcf;_0x16ed6b++){var _0x37f287=events[_0x16ed6b];var _0x403cc5=createListener(_0x12e3('0x4')+_0x37f287,_0x3173f9);OpenchannelAccountEvents['on'](_0x37f287,_0x403cc5);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 65c5edd..3f5a714 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 _0x4409=['create','put','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','/:id','post'];(function(_0x4a47a3,_0x4a6cf1){var _0x3a9702=function(_0x38afa9){while(--_0x38afa9){_0x4a47a3['push'](_0x4a47a3['shift']());}};_0x3a9702(++_0x4a6cf1);}(_0x4409,0x16e));var _0x9440=function(_0x3029bc,_0x4f6bb4){_0x3029bc=_0x3029bc-0x0;var _0x847f3a=_0x4409[_0x3029bc];return _0x847f3a;};'use strict';var multer=require('multer');var util=require(_0x9440('0x0'));var path=require(_0x9440('0x1'));var timeout=require(_0x9440('0x2'));var express=require(_0x9440('0x3'));var router=express[_0x9440('0x4')]();var fs_extra=require(_0x9440('0x5'));var auth=require(_0x9440('0x6'));var interaction=require(_0x9440('0x7'));var config=require(_0x9440('0x8'));var controller=require(_0x9440('0x9'));router[_0x9440('0xa')]('/',auth[_0x9440('0xb')](),controller['index']);router['get'](_0x9440('0xc'),auth[_0x9440('0xb')](),controller['show']);router[_0x9440('0xd')]('/',auth[_0x9440('0xb')](),controller[_0x9440('0xe')]);router[_0x9440('0xf')]('/:id',auth[_0x9440('0xb')](),controller[_0x9440('0x10')]);router['delete'](_0x9440('0xc'),auth[_0x9440('0xb')](),controller[_0x9440('0x11')]);module[_0x9440('0x12')]=router; \ No newline at end of file +var _0x620e=['express','Router','../../components/auth/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','/:id','put','update','delete','destroy','multer','connect-timeout'];(function(_0x3584e7,_0x46c4b7){var _0x162528=function(_0x5f52f8){while(--_0x5f52f8){_0x3584e7['push'](_0x3584e7['shift']());}};_0x162528(++_0x46c4b7);}(_0x620e,0x116));var _0xe620=function(_0x754ff7,_0x14c264){_0x754ff7=_0x754ff7-0x0;var _0x43a57a=_0x620e[_0x754ff7];return _0x43a57a;};'use strict';var multer=require(_0xe620('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xe620('0x1'));var express=require(_0xe620('0x2'));var router=express[_0xe620('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xe620('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xe620('0x5'));var controller=require(_0xe620('0x6'));router[_0xe620('0x7')]('/',auth[_0xe620('0x8')](),controller['index']);router[_0xe620('0x7')](_0xe620('0x9'),auth[_0xe620('0x8')](),controller['show']);router['post']('/',auth[_0xe620('0x8')](),controller['create']);router[_0xe620('0xa')]('/:id',auth[_0xe620('0x8')](),controller[_0xe620('0xb')]);router[_0xe620('0xc')](_0xe620('0x9'),auth[_0xe620('0x8')](),controller[_0xe620('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 370fa0e..7f855b6 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 _0x39da=['noop','INTEGER','STRING'];(function(_0x70cf13,_0x5a64b1){var _0x58510c=function(_0x3155d1){while(--_0x3155d1){_0x70cf13['push'](_0x70cf13['shift']());}};_0x58510c(++_0x5a64b1);}(_0x39da,0x88));var _0xa39d=function(_0x299dc3,_0x7dcb8c){_0x299dc3=_0x299dc3-0x0;var _0x49530d=_0x39da[_0x299dc3];return _0x49530d;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0xa39d('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0xa39d('0x1')],'allowNull':![],'defaultValue':_0xa39d('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xa39d('0x1')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xb5ea=['sequelize','exports','INTEGER','STRING','noop','*,*,*,*'];(function(_0x417b1a,_0x3cfce5){var _0x1e41af=function(_0xe2e44e){while(--_0xe2e44e){_0x417b1a['push'](_0x417b1a['shift']());}};_0x1e41af(++_0x3cfce5);}(_0xb5ea,0x168));var _0xab5e=function(_0x22a237,_0x312e92){_0x22a237=_0x22a237-0x0;var _0x15c510=_0xb5ea[_0x22a237];return _0x15c510;};'use strict';var Sequelize=require(_0xab5e('0x0'));module[_0xab5e('0x1')]={'priority':{'type':Sequelize[_0xab5e('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xab5e('0x3')],'allowNull':![],'defaultValue':_0xab5e('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xab5e('0x3')],'defaultValue':_0xab5e('0x5')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 8ef1143..47c964c 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 _0xbabf=['end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','OpenchannelApplication','rawAttributes','type','model','map','query','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','keys','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status'];(function(_0x2d6e7d,_0x9c7588){var _0x401986=function(_0x5ad450){while(--_0x5ad450){_0x2d6e7d['push'](_0x2d6e7d['shift']());}};_0x401986(++_0x9c7588);}(_0xbabf,0x110));var _0xfbab=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xbabf[_0x13d07a];return _0x5ee0ee;};'use strict';var emlformat=require(_0xfbab('0x0'));var rimraf=require(_0xfbab('0x1'));var zipdir=require(_0xfbab('0x2'));var jsonpatch=require(_0xfbab('0x3'));var rp=require(_0xfbab('0x4'));var moment=require(_0xfbab('0x5'));var BPromise=require(_0xfbab('0x6'));var Mustache=require('mustache');var util=require(_0xfbab('0x7'));var path=require('path');var sox=require(_0xfbab('0x8'));var csv=require(_0xfbab('0x9'));var ejs=require(_0xfbab('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfbab('0xb'));var squel=require(_0xfbab('0xc'));var crypto=require(_0xfbab('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xfbab('0xe'));var toCsv=require('to-csv');var querystring=require(_0xfbab('0xf'));var Papa=require('papaparse');var Redis=require(_0xfbab('0x10'));var authService=require(_0xfbab('0x11'));var qs=require(_0xfbab('0x12'));var as=require(_0xfbab('0x13'));var hardwareService=require(_0xfbab('0x14'));var logger=require(_0xfbab('0x15'))(_0xfbab('0x16'));var utils=require(_0xfbab('0x17'));var config=require(_0xfbab('0x18'));var licenseUtil=require(_0xfbab('0x19'));var db=require(_0xfbab('0x1a'))['db'];function respondWithStatusCode(_0x2c88b3,_0x26fd3a){_0x26fd3a=_0x26fd3a||0xcc;return function(_0x2fca92){if(_0x2fca92){return _0x2c88b3['sendStatus'](_0x26fd3a);}return _0x2c88b3[_0xfbab('0x1b')](_0x26fd3a)[_0xfbab('0x1c')]();};}function respondWithResult(_0x1dc41d,_0x2c717a){_0x2c717a=_0x2c717a||0xc8;return function(_0x43a642){if(_0x43a642){return _0x1dc41d[_0xfbab('0x1b')](_0x2c717a)[_0xfbab('0x1d')](_0x43a642);}};}function respondWithFilteredResult(_0x2f0ead,_0x2d4ff2){return function(_0x519f5b){if(_0x519f5b){var _0x52b957=typeof _0x2d4ff2['offset']===_0xfbab('0x1e')&&typeof _0x2d4ff2[_0xfbab('0x1f')]==='undefined';var _0x19168f=_0x519f5b[_0xfbab('0x20')];var _0x49c717=_0x52b957?0x0:_0x2d4ff2[_0xfbab('0x21')];var _0x42fcc3=_0x52b957?_0x519f5b['count']:_0x2d4ff2[_0xfbab('0x21')]+_0x2d4ff2['limit'];var _0x37bbcd;if(_0x42fcc3>=_0x19168f){_0x42fcc3=_0x19168f;_0x37bbcd=0xc8;}else{_0x37bbcd=0xce;}_0x2f0ead[_0xfbab('0x1b')](_0x37bbcd);return _0x2f0ead[_0xfbab('0x22')](_0xfbab('0x23'),_0x49c717+'-'+_0x42fcc3+'/'+_0x19168f)[_0xfbab('0x1d')](_0x519f5b);}return null;};}function patchUpdates(_0x37ea68){return function(_0x28eae2){try{jsonpatch['apply'](_0x28eae2,_0x37ea68,!![]);}catch(_0x3ce4c6){return BPromise[_0xfbab('0x24')](_0x3ce4c6);}return _0x28eae2[_0xfbab('0x25')]();};}function saveUpdates(_0x2e6cfa,_0x470153){return function(_0x312a98){if(_0x312a98){return _0x312a98[_0xfbab('0x26')](_0x2e6cfa)[_0xfbab('0x27')](function(_0x5d2a77){return _0x5d2a77;});}return null;};}function removeEntity(_0x27f019,_0xb53e3b){return function(_0x374d95){if(_0x374d95){return _0x374d95[_0xfbab('0x28')]()[_0xfbab('0x27')](function(){_0x27f019[_0xfbab('0x1b')](0xcc)[_0xfbab('0x1c')]();});}};}function handleEntityNotFound(_0x4b0d60,_0x2e3d9e){return function(_0x2ca57d){if(!_0x2ca57d){_0x4b0d60['sendStatus'](0x194);}return _0x2ca57d;};}function handleError(_0x4451c1,_0x1ce78d){_0x1ce78d=_0x1ce78d||0x1f4;return function(_0x104f70){logger[_0xfbab('0x29')](_0x104f70[_0xfbab('0x2a')]);if(_0x104f70[_0xfbab('0x2b')]){delete _0x104f70['name'];}_0x4451c1[_0xfbab('0x1b')](_0x1ce78d)[_0xfbab('0x2c')](_0x104f70);};}exports['index']=function(_0x2d753e,_0x42c1c6){var _0x540a79={},_0x2f6578={},_0x324504={'count':0x0,'rows':[]};var _0x5a1c16=_['map'](db[_0xfbab('0x2d')][_0xfbab('0x2e')],function(_0x1ffc2a){return{'name':_0x1ffc2a['fieldName'],'type':_0x1ffc2a[_0xfbab('0x2f')]['key']};});_0x2f6578[_0xfbab('0x30')]=_[_0xfbab('0x31')](_0x5a1c16,_0xfbab('0x2b'));_0x2f6578['query']=_['keys'](_0x2d753e[_0xfbab('0x32')]);_0x2f6578['filters']=_['intersection'](_0x2f6578[_0xfbab('0x30')],_0x2f6578[_0xfbab('0x32')]);_0x540a79[_0xfbab('0x33')]=_[_0xfbab('0x34')](_0x2f6578[_0xfbab('0x30')],qs[_0xfbab('0x35')](_0x2d753e[_0xfbab('0x32')][_0xfbab('0x35')]));_0x540a79[_0xfbab('0x33')]=_0x540a79[_0xfbab('0x33')][_0xfbab('0x36')]?_0x540a79['attributes']:_0x2f6578['model'];if(!_0x2d753e[_0xfbab('0x32')][_0xfbab('0x37')]('nolimit')){_0x540a79[_0xfbab('0x1f')]=qs[_0xfbab('0x1f')](_0x2d753e[_0xfbab('0x32')][_0xfbab('0x1f')]);_0x540a79['offset']=qs[_0xfbab('0x21')](_0x2d753e['query'][_0xfbab('0x21')]);}_0x540a79[_0xfbab('0x38')]=qs[_0xfbab('0x39')](_0x2d753e[_0xfbab('0x32')][_0xfbab('0x39')]);_0x540a79[_0xfbab('0x3a')]=qs[_0xfbab('0x3b')](_[_0xfbab('0x3c')](_0x2d753e[_0xfbab('0x32')],_0x2f6578[_0xfbab('0x3b')]),_0x5a1c16);if(_0x2d753e[_0xfbab('0x32')]['filter']){_0x540a79['where']=_[_0xfbab('0x3d')](_0x540a79[_0xfbab('0x3a')],{'$or':_[_0xfbab('0x31')](_0x5a1c16,function(_0x503fec){if(_0x503fec[_0xfbab('0x2f')]!==_0xfbab('0x3e')){var _0x193722={};_0x193722[_0x503fec[_0xfbab('0x2b')]]={'$like':'%'+_0x2d753e[_0xfbab('0x32')][_0xfbab('0x3f')]+'%'};return _0x193722;}})});}_0x540a79=_[_0xfbab('0x3d')]({},_0x540a79,_0x2d753e['options']);var _0x48b6cf={'where':_0x540a79[_0xfbab('0x3a')]};return db[_0xfbab('0x2d')][_0xfbab('0x20')](_0x48b6cf)[_0xfbab('0x27')](function(_0x4c7f25){_0x324504[_0xfbab('0x20')]=_0x4c7f25;if(_0x2d753e[_0xfbab('0x32')][_0xfbab('0x40')]){_0x540a79[_0xfbab('0x41')]=[{'all':!![]}];}return db[_0xfbab('0x2d')][_0xfbab('0x42')](_0x540a79);})[_0xfbab('0x27')](function(_0x729e53){_0x324504[_0xfbab('0x43')]=_0x729e53;return _0x324504;})[_0xfbab('0x27')](respondWithFilteredResult(_0x42c1c6,_0x540a79))[_0xfbab('0x44')](handleError(_0x42c1c6,null));};exports[_0xfbab('0x45')]=function(_0x544f7d,_0x41a2dc){var _0x5ea02d={'raw':!![],'where':{'id':_0x544f7d['params']['id']}},_0x1f11c7={};_0x1f11c7[_0xfbab('0x30')]=_['keys'](db['OpenchannelApplication'][_0xfbab('0x2e')]);_0x1f11c7[_0xfbab('0x32')]=_[_0xfbab('0x46')](_0x544f7d[_0xfbab('0x32')]);_0x1f11c7[_0xfbab('0x3b')]=_[_0xfbab('0x34')](_0x1f11c7['model'],_0x1f11c7[_0xfbab('0x32')]);_0x5ea02d[_0xfbab('0x33')]=_[_0xfbab('0x34')](_0x1f11c7[_0xfbab('0x30')],qs['fields'](_0x544f7d[_0xfbab('0x32')]['fields']));_0x5ea02d[_0xfbab('0x33')]=_0x5ea02d[_0xfbab('0x33')]['length']?_0x5ea02d[_0xfbab('0x33')]:_0x1f11c7['model'];if(_0x544f7d[_0xfbab('0x32')][_0xfbab('0x40')]){_0x5ea02d[_0xfbab('0x41')]=[{'all':!![]}];}_0x5ea02d=_[_0xfbab('0x3d')]({},_0x5ea02d,_0x544f7d['options']);return db[_0xfbab('0x2d')][_0xfbab('0x47')](_0x5ea02d)['then'](handleEntityNotFound(_0x41a2dc,null))['then'](respondWithResult(_0x41a2dc,null))[_0xfbab('0x44')](handleError(_0x41a2dc,null));};exports[_0xfbab('0x48')]=function(_0x5d4465,_0x1eae08){return db['OpenchannelApplication'][_0xfbab('0x48')](_0x5d4465['body'],{})[_0xfbab('0x27')](respondWithResult(_0x1eae08,0xc9))[_0xfbab('0x44')](handleError(_0x1eae08,null));};exports[_0xfbab('0x26')]=function(_0x2392a7,_0x1fcd2f){if(_0x2392a7['body']['id']){delete _0x2392a7[_0xfbab('0x49')]['id'];}return db[_0xfbab('0x2d')]['find']({'where':{'id':_0x2392a7['params']['id']}})[_0xfbab('0x27')](handleEntityNotFound(_0x1fcd2f,null))[_0xfbab('0x27')](saveUpdates(_0x2392a7[_0xfbab('0x49')],null))['then'](respondWithResult(_0x1fcd2f,null))[_0xfbab('0x44')](handleError(_0x1fcd2f,null));};exports['destroy']=function(_0x57b442,_0x3e997b){return db[_0xfbab('0x2d')][_0xfbab('0x47')]({'where':{'id':_0x57b442[_0xfbab('0x4a')]['id']}})[_0xfbab('0x27')](handleEntityNotFound(_0x3e997b,null))[_0xfbab('0x27')](removeEntity(_0x3e997b,null))[_0xfbab('0x44')](handleError(_0x3e997b,null));}; \ No newline at end of file +var _0xc32a=['nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','rawAttributes','include','find','catch','create','body','params','destroy','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','name','send','index','map','OpenchannelApplication','fieldName','type','key','model','keys','filters','intersection','fields','query','attributes','length','hasOwnProperty'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc32a,0x14c));var _0xac32=function(_0x3a7a9c,_0x24f7d6){_0x3a7a9c=_0x3a7a9c-0x0;var _0x59156e=_0xc32a[_0x3a7a9c];return _0x59156e;};'use strict';var emlformat=require(_0xac32('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xac32('0x1'));var jsonpatch=require(_0xac32('0x2'));var rp=require(_0xac32('0x3'));var moment=require('moment');var BPromise=require(_0xac32('0x4'));var Mustache=require(_0xac32('0x5'));var util=require(_0xac32('0x6'));var path=require(_0xac32('0x7'));var sox=require(_0xac32('0x8'));var csv=require('to-csv');var ejs=require(_0xac32('0x9'));var fs=require('fs');var fs_extra=require(_0xac32('0xa'));var _=require(_0xac32('0xb'));var squel=require(_0xac32('0xc'));var crypto=require(_0xac32('0xd'));var jsforce=require(_0xac32('0xe'));var deskjs=require(_0xac32('0xf'));var toCsv=require(_0xac32('0x10'));var querystring=require(_0xac32('0x11'));var Papa=require('papaparse');var Redis=require(_0xac32('0x12'));var authService=require(_0xac32('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xac32('0x14'));var hardwareService=require(_0xac32('0x15'));var logger=require(_0xac32('0x16'))(_0xac32('0x17'));var utils=require('../../config/utils');var config=require(_0xac32('0x18'));var licenseUtil=require(_0xac32('0x19'));var db=require(_0xac32('0x1a'))['db'];function respondWithStatusCode(_0x30a5c7,_0x4e0bc2){_0x4e0bc2=_0x4e0bc2||0xcc;return function(_0x433917){if(_0x433917){return _0x30a5c7[_0xac32('0x1b')](_0x4e0bc2);}return _0x30a5c7[_0xac32('0x1c')](_0x4e0bc2)[_0xac32('0x1d')]();};}function respondWithResult(_0x279d38,_0x55aed0){_0x55aed0=_0x55aed0||0xc8;return function(_0x4a6121){if(_0x4a6121){return _0x279d38[_0xac32('0x1c')](_0x55aed0)[_0xac32('0x1e')](_0x4a6121);}};}function respondWithFilteredResult(_0x18916a,_0x589346){return function(_0x48884b){if(_0x48884b){var _0x5991d3=typeof _0x589346[_0xac32('0x1f')]===_0xac32('0x20')&&typeof _0x589346[_0xac32('0x21')]===_0xac32('0x20');var _0x1b909a=_0x48884b['count'];var _0x284a2e=_0x5991d3?0x0:_0x589346['offset'];var _0x1988c9=_0x5991d3?_0x48884b[_0xac32('0x22')]:_0x589346[_0xac32('0x1f')]+_0x589346['limit'];var _0x3153e9;if(_0x1988c9>=_0x1b909a){_0x1988c9=_0x1b909a;_0x3153e9=0xc8;}else{_0x3153e9=0xce;}_0x18916a[_0xac32('0x1c')](_0x3153e9);return _0x18916a[_0xac32('0x23')](_0xac32('0x24'),_0x284a2e+'-'+_0x1988c9+'/'+_0x1b909a)[_0xac32('0x1e')](_0x48884b);}return null;};}function patchUpdates(_0x23b9bc){return function(_0x40cb33){try{jsonpatch[_0xac32('0x25')](_0x40cb33,_0x23b9bc,!![]);}catch(_0x1180aa){return BPromise['reject'](_0x1180aa);}return _0x40cb33[_0xac32('0x26')]();};}function saveUpdates(_0x1fea3d,_0xaa8f13){return function(_0x1244b6){if(_0x1244b6){return _0x1244b6[_0xac32('0x27')](_0x1fea3d)['then'](function(_0x23f865){return _0x23f865;});}return null;};}function removeEntity(_0x4dcbb2,_0x4a57dc){return function(_0x57857b){if(_0x57857b){return _0x57857b['destroy']()[_0xac32('0x28')](function(){_0x4dcbb2['status'](0xcc)[_0xac32('0x1d')]();});}};}function handleEntityNotFound(_0x11705c,_0x39b98c){return function(_0x25010c){if(!_0x25010c){_0x11705c[_0xac32('0x1b')](0x194);}return _0x25010c;};}function handleError(_0x50a269,_0x48c837){_0x48c837=_0x48c837||0x1f4;return function(_0x4ea2cf){logger['error'](_0x4ea2cf['stack']);if(_0x4ea2cf[_0xac32('0x29')]){delete _0x4ea2cf[_0xac32('0x29')];}_0x50a269[_0xac32('0x1c')](_0x48c837)[_0xac32('0x2a')](_0x4ea2cf);};}exports[_0xac32('0x2b')]=function(_0x5e610d,_0x1807d6){var _0x2dcdf0={},_0x297657={},_0x104cf1={'count':0x0,'rows':[]};var _0x18f1a1=_[_0xac32('0x2c')](db[_0xac32('0x2d')]['rawAttributes'],function(_0x159317){return{'name':_0x159317[_0xac32('0x2e')],'type':_0x159317[_0xac32('0x2f')][_0xac32('0x30')]};});_0x297657[_0xac32('0x31')]=_[_0xac32('0x2c')](_0x18f1a1,_0xac32('0x29'));_0x297657['query']=_[_0xac32('0x32')](_0x5e610d['query']);_0x297657[_0xac32('0x33')]=_[_0xac32('0x34')](_0x297657['model'],_0x297657['query']);_0x2dcdf0['attributes']=_[_0xac32('0x34')](_0x297657[_0xac32('0x31')],qs[_0xac32('0x35')](_0x5e610d[_0xac32('0x36')][_0xac32('0x35')]));_0x2dcdf0[_0xac32('0x37')]=_0x2dcdf0[_0xac32('0x37')][_0xac32('0x38')]?_0x2dcdf0[_0xac32('0x37')]:_0x297657['model'];if(!_0x5e610d[_0xac32('0x36')][_0xac32('0x39')](_0xac32('0x3a'))){_0x2dcdf0[_0xac32('0x21')]=qs['limit'](_0x5e610d['query'][_0xac32('0x21')]);_0x2dcdf0['offset']=qs['offset'](_0x5e610d[_0xac32('0x36')][_0xac32('0x1f')]);}_0x2dcdf0[_0xac32('0x3b')]=qs['sort'](_0x5e610d[_0xac32('0x36')][_0xac32('0x3c')]);_0x2dcdf0[_0xac32('0x3d')]=qs['filters'](_['pick'](_0x5e610d[_0xac32('0x36')],_0x297657['filters']),_0x18f1a1);if(_0x5e610d[_0xac32('0x36')][_0xac32('0x3e')]){_0x2dcdf0[_0xac32('0x3d')]=_[_0xac32('0x3f')](_0x2dcdf0[_0xac32('0x3d')],{'$or':_['map'](_0x18f1a1,function(_0x438a61){if(_0x438a61['type']!==_0xac32('0x40')){var _0x2fe98f={};_0x2fe98f[_0x438a61[_0xac32('0x29')]]={'$like':'%'+_0x5e610d[_0xac32('0x36')][_0xac32('0x3e')]+'%'};return _0x2fe98f;}})});}_0x2dcdf0=_[_0xac32('0x3f')]({},_0x2dcdf0,_0x5e610d[_0xac32('0x41')]);var _0x262b81={'where':_0x2dcdf0[_0xac32('0x3d')]};return db[_0xac32('0x2d')]['count'](_0x262b81)[_0xac32('0x28')](function(_0x20fdcc){_0x104cf1[_0xac32('0x22')]=_0x20fdcc;if(_0x5e610d[_0xac32('0x36')][_0xac32('0x42')]){_0x2dcdf0['include']=[{'all':!![]}];}return db['OpenchannelApplication'][_0xac32('0x43')](_0x2dcdf0);})[_0xac32('0x28')](function(_0x310097){_0x104cf1[_0xac32('0x44')]=_0x310097;return _0x104cf1;})['then'](respondWithFilteredResult(_0x1807d6,_0x2dcdf0))['catch'](handleError(_0x1807d6,null));};exports[_0xac32('0x45')]=function(_0x3c3465,_0x490bc3){var _0x3b8a93={'raw':!![],'where':{'id':_0x3c3465['params']['id']}},_0x2213e9={};_0x2213e9[_0xac32('0x31')]=_[_0xac32('0x32')](db[_0xac32('0x2d')][_0xac32('0x46')]);_0x2213e9[_0xac32('0x36')]=_[_0xac32('0x32')](_0x3c3465[_0xac32('0x36')]);_0x2213e9[_0xac32('0x33')]=_[_0xac32('0x34')](_0x2213e9[_0xac32('0x31')],_0x2213e9[_0xac32('0x36')]);_0x3b8a93['attributes']=_[_0xac32('0x34')](_0x2213e9[_0xac32('0x31')],qs[_0xac32('0x35')](_0x3c3465['query']['fields']));_0x3b8a93[_0xac32('0x37')]=_0x3b8a93['attributes']['length']?_0x3b8a93['attributes']:_0x2213e9[_0xac32('0x31')];if(_0x3c3465['query'][_0xac32('0x42')]){_0x3b8a93[_0xac32('0x47')]=[{'all':!![]}];}_0x3b8a93=_[_0xac32('0x3f')]({},_0x3b8a93,_0x3c3465[_0xac32('0x41')]);return db[_0xac32('0x2d')][_0xac32('0x48')](_0x3b8a93)[_0xac32('0x28')](handleEntityNotFound(_0x490bc3,null))[_0xac32('0x28')](respondWithResult(_0x490bc3,null))[_0xac32('0x49')](handleError(_0x490bc3,null));};exports['create']=function(_0x48bce8,_0x1a441d){return db[_0xac32('0x2d')][_0xac32('0x4a')](_0x48bce8[_0xac32('0x4b')],{})['then'](respondWithResult(_0x1a441d,0xc9))['catch'](handleError(_0x1a441d,null));};exports['update']=function(_0x47b393,_0x4959bf){if(_0x47b393[_0xac32('0x4b')]['id']){delete _0x47b393['body']['id'];}return db[_0xac32('0x2d')][_0xac32('0x48')]({'where':{'id':_0x47b393[_0xac32('0x4c')]['id']}})[_0xac32('0x28')](handleEntityNotFound(_0x4959bf,null))[_0xac32('0x28')](saveUpdates(_0x47b393[_0xac32('0x4b')],null))['then'](respondWithResult(_0x4959bf,null))[_0xac32('0x49')](handleError(_0x4959bf,null));};exports[_0xac32('0x4d')]=function(_0x56a1b0,_0x59dcb9){return db[_0xac32('0x2d')][_0xac32('0x48')]({'where':{'id':_0x56a1b0['params']['id']}})[_0xac32('0x28')](handleEntityNotFound(_0x59dcb9,null))[_0xac32('0x28')](removeEntity(_0x59dcb9,null))['catch'](handleError(_0x59dcb9,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index feeeeb9..83851dc 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 _0x9479=['exports','OpenchannelApplication','openchannel_applications','utf8mb4_unicode_ci','lodash','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelApplication.attributes'];(function(_0x352180,_0x2b23c1){var _0x5eeb9a=function(_0x1cc9ea){while(--_0x1cc9ea){_0x352180['push'](_0x352180['shift']());}};_0x5eeb9a(++_0x2b23c1);}(_0x9479,0x1b4));var _0x9947=function(_0xdeb064,_0x2bd0eb){_0xdeb064=_0xdeb064-0x0;var _0x191b7d=_0x9479[_0xdeb064];return _0x191b7d;};'use strict';var _=require(_0x9947('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x9947('0x1'));var BPromise=require(_0x9947('0x2'));var rp=require(_0x9947('0x3'));var fs=require('fs');var path=require(_0x9947('0x4'));var rimraf=require(_0x9947('0x5'));var config=require(_0x9947('0x6'));var attributes=require(_0x9947('0x7'));module[_0x9947('0x8')]=function(_0x550636,_0x4542d0){return _0x550636['define'](_0x9947('0x9'),attributes,{'tableName':_0x9947('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x9947('0xb')});}; \ No newline at end of file +var _0xd395=['util','../../config/logger','api','moment','rimraf','../../config/environment','./openchannelApplication.attributes','exports','define','OpenchannelApplication','openchannel_applications','utf8mb4_unicode_ci','lodash'];(function(_0x5794e0,_0x436efa){var _0x3630f5=function(_0x2d7ceb){while(--_0x2d7ceb){_0x5794e0['push'](_0x5794e0['shift']());}};_0x3630f5(++_0x436efa);}(_0xd395,0x1d3));var _0x5d39=function(_0x41c190,_0x4f6981){_0x41c190=_0x41c190-0x0;var _0x5c6137=_0xd395[_0x41c190];return _0x5c6137;};'use strict';var _=require(_0x5d39('0x0'));var util=require(_0x5d39('0x1'));var logger=require(_0x5d39('0x2'))(_0x5d39('0x3'));var moment=require(_0x5d39('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5d39('0x5'));var config=require(_0x5d39('0x6'));var attributes=require(_0x5d39('0x7'));module[_0x5d39('0x8')]=function(_0x287c8e,_0x37c630){return _0x287c8e[_0x5d39('0x9')](_0x5d39('0xa'),attributes,{'tableName':_0x5d39('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x5d39('0xc')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index b100f82..e201d1e 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 _0xfc1a=['jayson/promise','client','http','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','OpenchannelApplication','update','body','options','raw','attributes','UpdateOpenchannelApplication','debug','stringify','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3ab687,_0x2f3a18){var _0x512596=function(_0x981ef2){while(--_0x981ef2){_0x3ab687['push'](_0x3ab687['shift']());}};_0x512596(++_0x2f3a18);}(_0xfc1a,0x141));var _0xafc1=function(_0x53980c,_0x3ab14a){_0x53980c=_0x53980c-0x0;var _0x13822a=_0xfc1a[_0x53980c];return _0x13822a;};'use strict';var _=require(_0xafc1('0x0'));var util=require(_0xafc1('0x1'));var moment=require(_0xafc1('0x2'));var BPromise=require(_0xafc1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xafc1('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xafc1('0x5'));var logger=require(_0xafc1('0x6'))(_0xafc1('0x7'));var config=require(_0xafc1('0x8'));var jayson=require(_0xafc1('0x9'));var client=jayson[_0xafc1('0xa')][_0xafc1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4235ed,_0x492ee9,_0x1ff776){return new BPromise(function(_0x3cb7d7,_0x397ce3){return client['request'](_0x4235ed,_0x1ff776)[_0xafc1('0xc')](function(_0x4d2380){logger[_0xafc1('0xd')](_0xafc1('0xe'),_0x492ee9,_0xafc1('0xf'));logger['debug']('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x492ee9,_0xafc1('0xf'),JSON['stringify'](_0x4d2380));if(_0x4d2380[_0xafc1('0x10')]){if(_0x4d2380[_0xafc1('0x10')][_0xafc1('0x11')]===0x1f4){logger['error'](_0xafc1('0xe'),_0x492ee9,_0x4d2380[_0xafc1('0x10')][_0xafc1('0x12')]);return _0x397ce3(_0x4d2380[_0xafc1('0x10')]['message']);}logger['error'](_0xafc1('0xe'),_0x492ee9,_0x4d2380[_0xafc1('0x10')][_0xafc1('0x12')]);return _0x3cb7d7(_0x4d2380[_0xafc1('0x10')][_0xafc1('0x12')]);}else{logger[_0xafc1('0xd')](_0xafc1('0xe'),_0x492ee9,_0xafc1('0xf'));_0x3cb7d7(_0x4d2380[_0xafc1('0x13')][_0xafc1('0x12')]);}})[_0xafc1('0x14')](function(_0x554c83){logger['error'](_0xafc1('0xe'),_0x492ee9,_0x554c83);_0x397ce3(_0x554c83);});});}exports['UpdateOpenchannelApplication']=function(_0x2ff8bb){var _0x59cc4c=this;return new Promise(function(_0x214c2f,_0x9c183b){return db[_0xafc1('0x15')][_0xafc1('0x16')](_0x2ff8bb[_0xafc1('0x17')],{'raw':_0x2ff8bb[_0xafc1('0x18')]?_0x2ff8bb['options'][_0xafc1('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ff8bb['options']?_0x2ff8bb[_0xafc1('0x18')]['where']||null:null,'attributes':_0x2ff8bb[_0xafc1('0x18')]?_0x2ff8bb['options'][_0xafc1('0x1a')]||null:null,'limit':_0x2ff8bb[_0xafc1('0x18')]?_0x2ff8bb[_0xafc1('0x18')]['limit']||null:null})['then'](function(_0x35d068){logger[_0xafc1('0xd')](_0xafc1('0x1b'),_0x2ff8bb);logger[_0xafc1('0x1c')](_0xafc1('0x1b'),_0x2ff8bb,JSON[_0xafc1('0x1d')](_0x35d068));_0x214c2f(_0x35d068);})[_0xafc1('0x14')](function(_0x4fb16a){logger[_0xafc1('0x10')](_0xafc1('0x1b'),_0x4fb16a[_0xafc1('0x12')],_0x2ff8bb);_0x9c183b(_0x59cc4c['error'](0x1f4,_0x4fb16a[_0xafc1('0x12')]));});});}; \ No newline at end of file +var _0xc95a=['options','raw','attributes','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','UpdateOpenchannelApplication','update','body'];(function(_0x494160,_0xadfa3f){var _0x5934b2=function(_0x2413de){while(--_0x2413de){_0x494160['push'](_0x494160['shift']());}};_0x5934b2(++_0xadfa3f);}(_0xc95a,0xbe));var _0xac95=function(_0x153f7b,_0x3d2df4){_0x153f7b=_0x153f7b-0x0;var _0x212994=_0xc95a[_0x153f7b];return _0x212994;};'use strict';var _=require(_0xac95('0x0'));var util=require(_0xac95('0x1'));var moment=require(_0xac95('0x2'));var BPromise=require(_0xac95('0x3'));var rs=require(_0xac95('0x4'));var fs=require('fs');var Redis=require(_0xac95('0x5'));var db=require(_0xac95('0x6'))['db'];var utils=require(_0xac95('0x7'));var logger=require('../../config/logger')(_0xac95('0x8'));var config=require(_0xac95('0x9'));var jayson=require(_0xac95('0xa'));var client=jayson[_0xac95('0xb')][_0xac95('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x162d7c,_0x3b80c0,_0x56451c){return new BPromise(function(_0x51008c,_0x1baa07){return client[_0xac95('0xd')](_0x162d7c,_0x56451c)['then'](function(_0x293e10){logger[_0xac95('0xe')](_0xac95('0xf'),_0x3b80c0,_0xac95('0x10'));logger['debug'](_0xac95('0x11'),_0x3b80c0,_0xac95('0x10'),JSON[_0xac95('0x12')](_0x293e10));if(_0x293e10['error']){if(_0x293e10['error'][_0xac95('0x13')]===0x1f4){logger[_0xac95('0x14')](_0xac95('0xf'),_0x3b80c0,_0x293e10[_0xac95('0x14')][_0xac95('0x15')]);return _0x1baa07(_0x293e10[_0xac95('0x14')]['message']);}logger[_0xac95('0x14')](_0xac95('0xf'),_0x3b80c0,_0x293e10[_0xac95('0x14')][_0xac95('0x15')]);return _0x51008c(_0x293e10['error'][_0xac95('0x15')]);}else{logger['info'](_0xac95('0xf'),_0x3b80c0,_0xac95('0x10'));_0x51008c(_0x293e10[_0xac95('0x16')][_0xac95('0x15')]);}})[_0xac95('0x17')](function(_0x57e0b7){logger[_0xac95('0x14')](_0xac95('0xf'),_0x3b80c0,_0x57e0b7);_0x1baa07(_0x57e0b7);});});}exports[_0xac95('0x18')]=function(_0x4558a1){var _0x3dc65d=this;return new Promise(function(_0x36a05f,_0x387e82){return db['OpenchannelApplication'][_0xac95('0x19')](_0x4558a1[_0xac95('0x1a')],{'raw':_0x4558a1[_0xac95('0x1b')]?_0x4558a1[_0xac95('0x1b')][_0xac95('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4558a1[_0xac95('0x1b')]?_0x4558a1['options']['where']||null:null,'attributes':_0x4558a1[_0xac95('0x1b')]?_0x4558a1[_0xac95('0x1b')][_0xac95('0x1d')]||null:null,'limit':_0x4558a1[_0xac95('0x1b')]?_0x4558a1[_0xac95('0x1b')]['limit']||null:null})[_0xac95('0x1e')](function(_0xdbaa59){logger['info']('UpdateOpenchannelApplication',_0x4558a1);logger['debug'](_0xac95('0x18'),_0x4558a1,JSON[_0xac95('0x12')](_0xdbaa59));_0x36a05f(_0xdbaa59);})[_0xac95('0x17')](function(_0xaf6017){logger[_0xac95('0x14')]('UpdateOpenchannelApplication',_0xaf6017[_0xac95('0x15')],_0x4558a1);_0x387e82(_0x3dc65d[_0xac95('0x14')](0x1f4,_0xaf6017[_0xac95('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 181c83e..2324ab6 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 _0xc733=['/:id','show','/:id/messages','/:id/download','download','post','create','addMessage','/:id/tags','openchannel','openchannelinteraction:addtags','addTags','put','openchannelinteraction:update','delete','tracked','removeTags','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelInteraction.controller','get','isAuthenticated','describe'];(function(_0x42e2a0,_0xd2a7e1){var _0x3dbf06=function(_0x1a8ed6){while(--_0x1a8ed6){_0x42e2a0['push'](_0x42e2a0['shift']());}};_0x3dbf06(++_0xd2a7e1);}(_0xc733,0xc6));var _0x3c73=function(_0xfa2938,_0xa81fa7){_0xfa2938=_0xfa2938-0x0;var _0x5b5bdb=_0xc733[_0xfa2938];return _0x5b5bdb;};'use strict';var multer=require(_0x3c73('0x0'));var util=require(_0x3c73('0x1'));var path=require(_0x3c73('0x2'));var timeout=require(_0x3c73('0x3'));var express=require('express');var router=express[_0x3c73('0x4')]();var fs_extra=require(_0x3c73('0x5'));var auth=require(_0x3c73('0x6'));var interaction=require(_0x3c73('0x7'));var config=require('../../config/environment');var controller=require(_0x3c73('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x3c73('0x9')]('/describe',auth[_0x3c73('0xa')](),controller[_0x3c73('0xb')]);router[_0x3c73('0x9')](_0x3c73('0xc'),auth[_0x3c73('0xa')](),controller[_0x3c73('0xd')]);router[_0x3c73('0x9')](_0x3c73('0xe'),auth[_0x3c73('0xa')](),controller['getMessages']);router[_0x3c73('0x9')](_0x3c73('0xf'),auth['isAuthenticated'](),controller[_0x3c73('0x10')]);router[_0x3c73('0x11')]('/',auth[_0x3c73('0xa')](),controller[_0x3c73('0x12')]);router[_0x3c73('0x11')](_0x3c73('0xe'),auth[_0x3c73('0xa')](),controller[_0x3c73('0x13')]);router[_0x3c73('0x11')](_0x3c73('0x14'),auth[_0x3c73('0xa')](),interaction['tracked'](_0x3c73('0x15'),_0x3c73('0x16')),controller[_0x3c73('0x17')]);router[_0x3c73('0x18')](_0x3c73('0xc'),auth['isAuthenticated'](),interaction['tracked']('openchannel',_0x3c73('0x19')),controller['update']);router[_0x3c73('0x1a')](_0x3c73('0xc'),auth[_0x3c73('0xa')](),interaction[_0x3c73('0x1b')](_0x3c73('0x15'),'openchannelinteraction:destroy'),controller['destroy']);router['delete'](_0x3c73('0x14'),auth[_0x3c73('0xa')](),controller[_0x3c73('0x1c')]);module[_0x3c73('0x1d')]=router; \ No newline at end of file +var _0xefb0=['/:id/messages','getMessages','post','addMessage','tracked','openchannel','openchannelinteraction:addtags','put','/:id','openchannelinteraction:update','update','destroy','/:id/tags','removeTags','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./openchannelInteraction.controller','index','get','/describe','isAuthenticated','describe','show'];(function(_0x109e02,_0x4d4eec){var _0x572ecb=function(_0x3bd684){while(--_0x3bd684){_0x109e02['push'](_0x109e02['shift']());}};_0x572ecb(++_0x4d4eec);}(_0xefb0,0x114));var _0x0efb=function(_0x559b2d,_0x18cc0f){_0x559b2d=_0x559b2d-0x0;var _0x16f956=_0xefb0[_0x559b2d];return _0x16f956;};'use strict';var multer=require(_0x0efb('0x0'));var util=require(_0x0efb('0x1'));var path=require('path');var timeout=require(_0x0efb('0x2'));var express=require(_0x0efb('0x3'));var router=express[_0x0efb('0x4')]();var fs_extra=require(_0x0efb('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0efb('0x6'));var config=require('../../config/environment');var controller=require(_0x0efb('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x0efb('0x8')]);router[_0x0efb('0x9')](_0x0efb('0xa'),auth[_0x0efb('0xb')](),controller[_0x0efb('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x0efb('0xd')]);router[_0x0efb('0x9')](_0x0efb('0xe'),auth['isAuthenticated'](),controller[_0x0efb('0xf')]);router['get']('/:id/download',auth[_0x0efb('0xb')](),controller['download']);router[_0x0efb('0x10')]('/',auth[_0x0efb('0xb')](),controller['create']);router['post'](_0x0efb('0xe'),auth[_0x0efb('0xb')](),controller[_0x0efb('0x11')]);router[_0x0efb('0x10')]('/:id/tags',auth['isAuthenticated'](),interaction[_0x0efb('0x12')](_0x0efb('0x13'),_0x0efb('0x14')),controller['addTags']);router[_0x0efb('0x15')](_0x0efb('0x16'),auth['isAuthenticated'](),interaction[_0x0efb('0x12')](_0x0efb('0x13'),_0x0efb('0x17')),controller[_0x0efb('0x18')]);router['delete'](_0x0efb('0x16'),auth[_0x0efb('0xb')](),interaction['tracked']('openchannel','openchannelinteraction:destroy'),controller[_0x0efb('0x19')]);router['delete'](_0x0efb('0x1a'),auth[_0x0efb('0xb')](),controller[_0x0efb('0x1b')]);module[_0x0efb('0x1c')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 487ba88..a556eeb 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 _0x3204=['out','sequelize','exports','BOOLEAN','DATE','STRING','ENUM'];(function(_0x219536,_0x8e0b9b){var _0x231e4d=function(_0x37b376){while(--_0x37b376){_0x219536['push'](_0x219536['shift']());}};_0x231e4d(++_0x8e0b9b);}(_0x3204,0x12e));var _0x4320=function(_0x3acc63,_0x290eac){_0x3acc63=_0x3acc63-0x0;var _0x47502b=_0x3204[_0x3acc63];return _0x47502b;};'use strict';var Sequelize=require(_0x4320('0x0'));module[_0x4320('0x1')]={'closed':{'type':Sequelize[_0x4320('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x4320('0x3')]},'disposition':{'type':Sequelize[_0x4320('0x4')]},'secondDisposition':{'type':Sequelize[_0x4320('0x4')]},'thirdDisposition':{'type':Sequelize[_0x4320('0x4')]},'note':{'type':Sequelize[_0x4320('0x4')]},'read1stAt':{'type':Sequelize[_0x4320('0x3')]},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize[_0x4320('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x4320('0x5')]('in',_0x4320('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x4320('0x4')]},'autoreplyExecuted':{'type':Sequelize[_0x4320('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xd347=['out','sequelize','exports','BOOLEAN','STRING','DATE','ENUM'];(function(_0x1c2131,_0x15cf45){var _0x5acd2a=function(_0x2b14eb){while(--_0x2b14eb){_0x1c2131['push'](_0x1c2131['shift']());}};_0x5acd2a(++_0x15cf45);}(_0xd347,0x182));var _0x7d34=function(_0x3e33df,_0x2ef528){_0x3e33df=_0x3e33df-0x0;var _0x2a884d=_0xd347[_0x3e33df];return _0x2a884d;};'use strict';var Sequelize=require(_0x7d34('0x0'));module[_0x7d34('0x1')]={'closed':{'type':Sequelize[_0x7d34('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x7d34('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x7d34('0x3')]},'read1stAt':{'type':Sequelize[_0x7d34('0x4')]},'threadId':{'type':Sequelize[_0x7d34('0x3')]},'externalUrl':{'type':Sequelize[_0x7d34('0x3')]},'lastMsgAt':{'type':Sequelize[_0x7d34('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x7d34('0x5')]('in',_0x7d34('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x7d34('0x3')]},'autoreplyExecuted':{'type':Sequelize[_0x7d34('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index ed7e973..ec5893d 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 _0x4a12=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','sendStatus','status','json','offset','undefined','count','limit','set','apply','reject','save','update','then','end','stack','name','send','Users','map','split','forEach','Tags','push','TagIds','catch','waiting','answered','unmanaged','total','closed','UserId','talking','OpenchannelInteraction','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','select','field','color','u.fullname','ui.OpenchannelInteractionId','from','user_has_openchannel_interactions','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','find','unreadMessages','value','`\x20=\x200','having','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','body','compact','isEmpty','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','t.id\x20IN\x20?','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','agent','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','role','sequelize','toString','keyBy','a.key','Account.key','a.mandatoryDisposition','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','Contact.mobile','c.fax','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','all','show','params','includeAll','include','merge','options','create','destroy','describe','addMessage','OpenchannelMessage','ids','omit','getMessages','findOne','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','addTags','spread','emit','removeTags','download','unix','join','root','files','server','attachments','transcript-%d-%s.zip','fullname','CmContact','firstName','lastName','Attachment','direction','secret','Account','Owner','mkdirSync','Openchannel','N.A.','createdAt','disposition','threadId','Public','basename','existsSync','createReadStream','pipe','createWriteStream','out','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','desk.js','to-csv'];(function(_0x4e23a8,_0x5e76c0){var _0x1c8947=function(_0x1f5b0e){while(--_0x1f5b0e){_0x4e23a8['push'](_0x4e23a8['shift']());}};_0x1c8947(++_0x5e76c0);}(_0x4a12,0x1d6));var _0x24a1=function(_0x602436,_0xbf433){_0x602436=_0x602436-0x0;var _0x504c33=_0x4a12[_0x602436];return _0x504c33;};'use strict';var emlformat=require(_0x24a1('0x0'));var rimraf=require(_0x24a1('0x1'));var zipdir=require(_0x24a1('0x2'));var jsonpatch=require(_0x24a1('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x24a1('0x4'));var Mustache=require(_0x24a1('0x5'));var util=require(_0x24a1('0x6'));var path=require(_0x24a1('0x7'));var sox=require(_0x24a1('0x8'));var csv=require('to-csv');var ejs=require(_0x24a1('0x9'));var fs=require('fs');var fs_extra=require(_0x24a1('0xa'));var _=require('lodash');var squel=require(_0x24a1('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x24a1('0xc'));var toCsv=require(_0x24a1('0xd'));var querystring=require(_0x24a1('0xe'));var Papa=require(_0x24a1('0xf'));var Redis=require(_0x24a1('0x10'));var authService=require(_0x24a1('0x11'));var qs=require(_0x24a1('0x12'));var as=require(_0x24a1('0x13'));var pdf=require(_0x24a1('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x24a1('0x15'))(_0x24a1('0x16'));var utils=require(_0x24a1('0x17'));var config=require(_0x24a1('0x18'));var licenseUtil=require(_0x24a1('0x19'));var db=require(_0x24a1('0x1a'))['db'];config['redis']=_[_0x24a1('0x1b')](config[_0x24a1('0x1c')],{'host':_0x24a1('0x1d'),'port':0x18eb});var socket=require(_0x24a1('0x1e'))(new Redis(config[_0x24a1('0x1c')]));require(_0x24a1('0x1f'))['register'](socket);function respondWithStatusCode(_0x81764f,_0x25a60a){_0x25a60a=_0x25a60a||0xcc;return function(_0x114cbc){if(_0x114cbc){return _0x81764f[_0x24a1('0x20')](_0x25a60a);}return _0x81764f[_0x24a1('0x21')](_0x25a60a)['end']();};}function respondWithResult(_0x463e73,_0x415a72){_0x415a72=_0x415a72||0xc8;return function(_0x441fe9){if(_0x441fe9){return _0x463e73[_0x24a1('0x21')](_0x415a72)[_0x24a1('0x22')](_0x441fe9);}};}function respondWithFilteredResult(_0x33e74f,_0x660f35){return function(_0x512aca){if(_0x512aca){var _0x36785d=typeof _0x660f35[_0x24a1('0x23')]===_0x24a1('0x24')&&typeof _0x660f35['limit']==='undefined';var _0x3b3ddc=_0x512aca[_0x24a1('0x25')];var _0x34e292=_0x36785d?0x0:_0x660f35[_0x24a1('0x23')];var _0x412a0d=_0x36785d?_0x512aca[_0x24a1('0x25')]:_0x660f35[_0x24a1('0x23')]+_0x660f35[_0x24a1('0x26')];var _0x43d1cc;if(_0x412a0d>=_0x3b3ddc){_0x412a0d=_0x3b3ddc;_0x43d1cc=0xc8;}else{_0x43d1cc=0xce;}_0x33e74f[_0x24a1('0x21')](_0x43d1cc);return _0x33e74f[_0x24a1('0x27')]('Content-Range',_0x34e292+'-'+_0x412a0d+'/'+_0x3b3ddc)['json'](_0x512aca);}return null;};}function patchUpdates(_0x16ec9a){return function(_0x253611){try{jsonpatch[_0x24a1('0x28')](_0x253611,_0x16ec9a,!![]);}catch(_0x51399f){return BPromise[_0x24a1('0x29')](_0x51399f);}return _0x253611[_0x24a1('0x2a')]();};}function saveUpdates(_0x19bf04,_0x6afa8e){return function(_0x1e1dca){if(_0x1e1dca){return _0x1e1dca[_0x24a1('0x2b')](_0x19bf04)[_0x24a1('0x2c')](function(_0x1f8be0){return _0x1f8be0;});}return null;};}function removeEntity(_0x4216f1,_0x390327){return function(_0x262530){if(_0x262530){return _0x262530['destroy']()['then'](function(){_0x4216f1['status'](0xcc)[_0x24a1('0x2d')]();});}};}function handleEntityNotFound(_0xb5c4d7,_0x1b03f0){return function(_0x45956d){if(!_0x45956d){_0xb5c4d7[_0x24a1('0x20')](0x194);}return _0x45956d;};}function handleError(_0x3a04fa,_0x4e1510){_0x4e1510=_0x4e1510||0x1f4;return function(_0x408218){logger['error'](_0x408218[_0x24a1('0x2e')]);if(_0x408218[_0x24a1('0x2f')]){delete _0x408218[_0x24a1('0x2f')];}_0x3a04fa[_0x24a1('0x21')](_0x4e1510)[_0x24a1('0x30')](_0x408218);};}function getInteractionUsers(_0x5a21f5,_0x50b9de){return new BPromise(function(_0x44fa7c,_0x5c34d3){try{if(_0x50b9de[_0x5a21f5['id']]){_0x5a21f5[_0x24a1('0x31')]=_[_0x24a1('0x32')](_0x50b9de[_0x5a21f5['id']],function(_0x16480d){return{'id':_0x16480d['id'],'fullname':_0x16480d['fullname']};});}}catch(_0x2447fa){_0x5c34d3(_0x2447fa);}_0x44fa7c(_0x5a21f5);});}function getInteractionTags(_0x2a99d4,_0x4ec0f7){return new BPromise(function(_0x564532,_0x2d343c){try{if(_0x2a99d4['TagIds']){_0x2a99d4['Tags']=[];_0x2a99d4['TagIds'][_0x24a1('0x33')](',')[_0x24a1('0x34')](function(_0x1830e0){_0x2a99d4[_0x24a1('0x35')][_0x24a1('0x36')](_0x4ec0f7[_0x1830e0]);});}delete _0x2a99d4[_0x24a1('0x37')];}catch(_0x5ac9b0){_0x2d343c(_0x5ac9b0);}_0x564532(_0x2a99d4);});}function updateOpenchannelInteraction(_0x3cc8b9,_0x509ce3,_0x57a4ea){return new BPromise(function(_0x2caf66,_0x306bd4){return getInteractionUsers(_0x3cc8b9,_0x57a4ea)[_0x24a1('0x2c')](function(_0x3c02a0){return getInteractionTags(_0x3c02a0,_0x509ce3);})[_0x24a1('0x2c')](function(_0x1fa3b3){return getStateInteraction(_0x1fa3b3);})['then'](function(_0x2f980f){_0x2caf66(_0x2f980f);})[_0x24a1('0x38')](function(_0x264cd2){_0x306bd4(_0x264cd2);});});}function getStateInteraction(_0x3c46db){return new BPromise(function(_0x271480){_0x3c46db[_0x24a1('0x39')]=0x0;_0x3c46db['talking']=0x0;_0x3c46db[_0x24a1('0x3a')]=0x0;_0x3c46db[_0x24a1('0x3b')]=0x0;_0x3c46db[_0x24a1('0x3c')]=0x0;if(!_0x3c46db[_0x24a1('0x3d')]&&!_0x3c46db[_0x24a1('0x3e')]){_0x3c46db[_0x24a1('0x39')]+=0x1;}if(!_0x3c46db[_0x24a1('0x3d')]&&_0x3c46db[_0x24a1('0x3e')]){_0x3c46db['talking']+=0x1;ids['push'](_0x3c46db['id']);if(_0x3c46db['waiting']){_0x3c46db['waiting']-=0x1;}}if(_0x3c46db[_0x24a1('0x3d')]&&_0x3c46db[_0x24a1('0x3e')]){_0x3c46db[_0x24a1('0x3a')]+=0x1;if(_0x3c46db[_0x24a1('0x3f')]){_0x3c46db[_0x24a1('0x3f')]-=0x1;}}if(_0x3c46db[_0x24a1('0x3d')]&&!_0x3c46db['UserId']){_0x3c46db[_0x24a1('0x3b')]+=0x1;if(_0x3c46db['waiting']){_0x3c46db[_0x24a1('0x39')]-=0x1;}}_0x3c46db[_0x24a1('0x3c')]+=0x1;_0x271480(_0x3c46db);});}exports['index']=function(_0x1de44e,_0x1c5ae0){var _0x490fdf={},_0xf54678={},_0x3bbddf={'count':0x0,'rows':[]};var _0x2563c0=_['map'](db[_0x24a1('0x40')][_0x24a1('0x41')],function(_0x5638cb){return{'name':_0x5638cb[_0x24a1('0x42')],'type':_0x5638cb[_0x24a1('0x43')]['key']};});_0xf54678[_0x24a1('0x44')]=_['map'](_0x2563c0,_0x24a1('0x2f'));_0xf54678[_0x24a1('0x45')]=_[_0x24a1('0x46')](_0x1de44e[_0x24a1('0x45')]);_0xf54678[_0x24a1('0x47')]=_['intersection'](_0xf54678['model'],_0xf54678[_0x24a1('0x45')]);_0x490fdf[_0x24a1('0x48')]=_[_0x24a1('0x49')](_0xf54678[_0x24a1('0x44')],qs[_0x24a1('0x4a')](_0x1de44e['query'][_0x24a1('0x4a')]));_0x490fdf[_0x24a1('0x48')]=_0x490fdf['attributes'][_0x24a1('0x4b')]?_0x490fdf[_0x24a1('0x48')]:_0xf54678[_0x24a1('0x44')];if(!_0x1de44e['query']['hasOwnProperty'](_0x24a1('0x4c'))){_0x490fdf[_0x24a1('0x26')]=qs[_0x24a1('0x26')](_0x1de44e[_0x24a1('0x45')]['limit']);_0x490fdf[_0x24a1('0x23')]=qs['offset'](_0x1de44e['query'][_0x24a1('0x23')]);}_0x490fdf[_0x24a1('0x4d')]=qs[_0x24a1('0x4e')](_0x1de44e[_0x24a1('0x45')][_0x24a1('0x4e')]);_0x490fdf[_0x24a1('0x4f')]=qs[_0x24a1('0x47')](_[_0x24a1('0x50')](_0x1de44e[_0x24a1('0x45')],_0xf54678[_0x24a1('0x47')]),_0x2563c0);var _0x152a20=[];var _0x24165f=squel[_0x24a1('0x51')]()[_0x24a1('0x52')]('id')[_0x24a1('0x52')](_0x24a1('0x2f'))['field'](_0x24a1('0x53'))['from']('tools_tags');var _0x130269=squel[_0x24a1('0x51')]()['field']('u.id')['field'](_0x24a1('0x54'))[_0x24a1('0x52')](_0x24a1('0x55'))[_0x24a1('0x56')](_0x24a1('0x57'),'ui')[_0x24a1('0x58')](_0x24a1('0x59'),'u',_0x24a1('0x5a'));var _0x33e5a8=squel['select']()[_0x24a1('0x56')]('openchannel_interactions','i')['left_join'](_0x24a1('0x5b'),'c',_0x24a1('0x5c'))[_0x24a1('0x58')]('users','o',_0x24a1('0x5d'))[_0x24a1('0x58')]('openchannel_accounts','a',_0x24a1('0x5e'))[_0x24a1('0x58')](_0x24a1('0x5f'),'me',_0x24a1('0x60'))[_0x24a1('0x58')](_0x24a1('0x61'),'it',_0x24a1('0x62'))[_0x24a1('0x58')]('tools_tags','t',_0x24a1('0x63'));var _0x39845c=squel['expr']();var _0x1643fd=[];var _0x43487d=squel[_0x24a1('0x64')]();var _0x4d255d;if(_0x1de44e[_0x24a1('0x45')][_0x24a1('0x65')]){_0x4d255d=as[_0x24a1('0x66')](_0x1de44e[_0x24a1('0x45')][_0x24a1('0x65')]);var _0x428270=_0x4d255d['sqlOperator'];for(var _0x1aeeef=0x0;_0x1aeeef<_0x4d255d[_0x24a1('0x67')][_0x24a1('0x4b')];_0x1aeeef++){var _0x79af29=_0x4d255d[_0x24a1('0x67')][_0x1aeeef];var _0x259d46='i';var _0x570670=_[_0x24a1('0x68')](_0x2563c0,[_0x24a1('0x2f'),_0x79af29[_0x24a1('0x52')]]);if(!_0x570670){switch(_0x79af29['field']){case _0x24a1('0x69'):if(_0x79af29[_0x24a1('0x6a')]==0x1){_0x33e5a8['having']('`'+_0x79af29['field']+_0x24a1('0x6b'));}else{_0x33e5a8[_0x24a1('0x6c')]('`'+_0x79af29[_0x24a1('0x52')]+_0x24a1('0x6d'));}break;case _0x24a1('0x6e'):if(_0x79af29[_0x24a1('0x6f')]===_0x24a1('0x70')){if(_0x79af29[_0x24a1('0x6a')][_0x24a1('0x33')]('\x20')['length']>0x1){_0x39845c[_0x428270](_0x24a1('0x71'),qs[_0x24a1('0x72')](_0x79af29[_0x24a1('0x6a')]),null);}else{var _0x498177='%'+_0x79af29[_0x24a1('0x6a')]+'%';_0x39845c[_0x428270](_0x24a1('0x73'),_0x498177,_0x498177,_0x498177);}}else{_0x570670=_['find'](_0x2563c0,[_0x24a1('0x2f'),_0x24a1('0x74')]);_0x79af29['field']=_0x24a1('0x74');_0x566a9a=as[_0x24a1('0x75')](_0x259d46,_0x570670[_0x24a1('0x43')],_0x79af29);_0x39845c[_0x428270](_0x566a9a[_0x24a1('0x76')],_0x566a9a['value'][_0x24a1('0x77')],_0x566a9a[_0x24a1('0x6a')][_0x24a1('0x2d')]);}break;case _0x24a1('0x78'):var _0x2eee58=_0x79af29['value'][_0x24a1('0x33')](',')[_0x24a1('0x32')](function(_0x16bdb4){return Number(_0x16bdb4);});_0x2eee58[_0x24a1('0x34')](function(_0x408009){_0x43487d['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x408009+',%');});_0x1643fd=_['union'](_0x1643fd,_0x2eee58);break;case _0x24a1('0x79'):if(_0x79af29[_0x24a1('0x6f')]===_0x24a1('0x70')){_0x39845c[_0x428270](_0x24a1('0x7a'),'%'+_0x79af29[_0x24a1('0x6a')]+'%',null);}else{_0x570670=_[_0x24a1('0x68')](_0x2563c0,[_0x24a1('0x2f'),_0x24a1('0x3e')]);_0x79af29['field']='UserId';_0x566a9a=as['buildExpression'](_0x259d46,_0x570670[_0x24a1('0x43')],_0x79af29);_0x39845c[_0x428270](_0x566a9a[_0x24a1('0x76')],_0x566a9a[_0x24a1('0x6a')][_0x24a1('0x77')],_0x566a9a[_0x24a1('0x6a')][_0x24a1('0x2d')]);}break;case _0x24a1('0x7b'):_0x566a9a=as[_0x24a1('0x75')]('me',null,_0x79af29);_0x39845c[_0x428270](_0x566a9a[_0x24a1('0x76')],_0x566a9a['value'][_0x24a1('0x77')],_0x566a9a[_0x24a1('0x6a')][_0x24a1('0x2d')]);break;}}else{var _0x566a9a=as['buildExpression'](_0x259d46,_0x570670[_0x24a1('0x43')],_0x79af29);_0x39845c[_0x428270](_0x566a9a[_0x24a1('0x76')],_0x566a9a[_0x24a1('0x6a')][_0x24a1('0x77')],_0x566a9a[_0x24a1('0x6a')][_0x24a1('0x2d')]);}}}else{var _0x31aead=_(_0x1de44e[_0x24a1('0x45')])[_0x24a1('0x46')]()[_0x24a1('0x32')](function(_0x44dc36){return _['some'](_0x2563c0,['name',_0x44dc36])?_0x44dc36:undefined;})[_0x24a1('0x7c')]()[_0x24a1('0x6a')]();if(!_[_0x24a1('0x7d')](_0x31aead)){_0x31aead['forEach'](function(_0x360a9c){if(_0x360a9c===_0x24a1('0x7e')){_0x33e5a8[_0x24a1('0x4f')](_0x24a1('0x7f'),[]['concat'](_0x1de44e[_0x24a1('0x45')][_0x360a9c]));}else if(_0x360a9c==='createdAt'){var _0x11c525=JSON[_0x24a1('0x80')](_0x1de44e[_0x24a1('0x45')][_0x360a9c])['$gte'];var _0x505bd2=JSON[_0x24a1('0x80')](_0x1de44e[_0x24a1('0x45')][_0x360a9c])['$lte'];_0x33e5a8[_0x24a1('0x4f')](_0x24a1('0x81'),_0x11c525,_0x505bd2);}else{if(_0x1de44e[_0x24a1('0x45')][_0x360a9c]===_0x24a1('0x82')){_0x33e5a8[_0x24a1('0x4f')]('i.'+_0x360a9c+_0x24a1('0x83'));}else{_0x33e5a8['where']('i.'+_0x360a9c+'\x20=\x20?',_0x1de44e[_0x24a1('0x45')][_0x360a9c]);}}});}if(_0x1de44e['query'][_0x24a1('0x84')]){if(_0x1de44e[_0x24a1('0x45')][_0x24a1('0x84')]==0x1){_0x33e5a8['having'](_0x24a1('0x85'));}else{_0x33e5a8[_0x24a1('0x6c')]('`unreadMessages`\x20>\x200');}}if(_0x1de44e[_0x24a1('0x45')][_0x24a1('0x86')]){_0x1643fd=_[_0x24a1('0x87')](_0x1de44e[_0x24a1('0x45')][_0x24a1('0x86')])?_0x1de44e[_0x24a1('0x45')][_0x24a1('0x86')]:new Array(_0x1de44e['query'][_0x24a1('0x86')]);_0x1643fd[_0x24a1('0x34')](function(_0x55579a){_0x43487d['or'](_0x24a1('0x88'),'%,'+_0x55579a+',%');});}if(_0x1de44e[_0x24a1('0x45')][_0x24a1('0x89')]){var _0x3a4fa=_0x1de44e[_0x24a1('0x45')][_0x24a1('0x89')]['replace']('\x5c','\x5c\x5c')[_0x24a1('0x8a')](/'/g,'\x27\x27');if(qs[_0x24a1('0x8b')](_0x3a4fa)){_0x39845c['or'](_0x24a1('0x8c'),_0x3a4fa+'%');}else{_0x39845c['or'](_0x24a1('0x8d'),qs[_0x24a1('0x72')](_0x3a4fa))['or']('i.from\x20LIKE\x20?',_0x3a4fa+'%')['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x3a4fa+'%');}}}_0x33e5a8[_0x24a1('0x4f')](_0x39845c);_0x33e5a8[_0x24a1('0x8e')](_0x24a1('0x8f'));var _0x303db2={'type':db[_0x24a1('0x90')][_0x24a1('0x91')]['SELECT'],'raw':!![]};var _0x2ff18d=_0x33e5a8[_0x24a1('0x92')]();_0x2ff18d[_0x24a1('0x52')](_0x24a1('0x8f'));_0x2ff18d[_0x24a1('0x52')](_0x24a1('0x93'),_0x24a1('0x69'));if(_0x490fdf[_0x24a1('0x4d')]){_0x490fdf[_0x24a1('0x4d')][_0x24a1('0x34')](function(_0x225143){var _0x408812=_0x225143[0x0]===_0x24a1('0x94')?_0x225143[0x0]:'i.'+_0x225143[0x0];_0x33e5a8[_0x24a1('0x4d')](_0x408812,_0x225143[0x1]==='DESC'?![]:!![]);});}if(!_[_0x24a1('0x7d')](_0x1643fd)){_0x33e5a8['having'](_0x43487d);_0x2ff18d[_0x24a1('0x4f')](_0x24a1('0x95'),_0x1643fd);}BPromise['resolve']()[_0x24a1('0x2c')](function(){if(!_0x4d255d){if(_0x1de44e['query'][_0x24a1('0x7e')])return;_0x2ff18d['where'](_0x24a1('0x96'));_0x33e5a8[_0x24a1('0x4f')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x1de44e[_0x24a1('0x97')]['role']!==_0x24a1('0x98'))return;return _0x1de44e[_0x24a1('0x97')][_0x24a1('0x99')]({'attributes':['id'],'raw':!![]})[_0x24a1('0x2c')](function(_0x11e634){if(_[_0x24a1('0x7d')](_0x11e634)){_0x2ff18d[_0x24a1('0x4f')](_0x24a1('0x9a'));_0x33e5a8[_0x24a1('0x4f')](_0x24a1('0x9a'));}else{_0x2ff18d[_0x24a1('0x4f')](_0x24a1('0x7f'),_['map'](_0x11e634,'id'));_0x33e5a8[_0x24a1('0x4f')](_0x24a1('0x7f'),_[_0x24a1('0x32')](_0x11e634,'id'));}});})['then'](function(){if(_0x1de44e[_0x24a1('0x97')][_0x24a1('0x9b')]===_0x24a1('0x98')&&!_0x4d255d&&!_0x1de44e[_0x24a1('0x45')][_0x24a1('0x7e')])return[];return db[_0x24a1('0x9c')]['query'](_0x2ff18d['toString'](),_0x303db2);})[_0x24a1('0x2c')](function(_0x547c98){_0x3bbddf['count']=_0x547c98[_0x24a1('0x4b')];if(_0x3bbddf['count']===0x0)return[];return db['sequelize'][_0x24a1('0x45')](_0x24165f[_0x24a1('0x9d')](),_0x303db2)[_0x24a1('0x2c')](function(_0x2a3617){_0x152a20=_[_0x24a1('0x9e')](_0x2a3617,'id');_0x303db2=_['merge'](_0x303db2,{'model':db[_0x24a1('0x40')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1de44e[_0x24a1('0x45')][_0x24a1('0x4a')]){_0x490fdf[_0x24a1('0x48')][_0x24a1('0x34')](function(_0x3243c2){_0x33e5a8[_0x24a1('0x52')]('i.'+_0x3243c2);});}else{_0x33e5a8[_0x24a1('0x52')](_0x24a1('0x93'),_0x24a1('0x69'));_0x33e5a8[_0x24a1('0x52')](_0x24a1('0x9f'),_0x24a1('0xa0'));_0x33e5a8[_0x24a1('0x52')](_0x24a1('0xa1'),'Account.mandatoryDisposition');_0x33e5a8['field']('CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0x24a1('0x94'));_0x33e5a8['field'](_0x24a1('0xa2'));_0x33e5a8[_0x24a1('0x52')](_0x24a1('0xa3'),_0x24a1('0xa4'));_0x33e5a8[_0x24a1('0x52')]('c.lastName',_0x24a1('0xa5'));_0x33e5a8[_0x24a1('0x52')](_0x24a1('0xa6'),_0x24a1('0xa7'));_0x33e5a8[_0x24a1('0x52')](_0x24a1('0xa8'),_0x24a1('0xa9'));_0x33e5a8[_0x24a1('0x52')]('c.mobile',_0x24a1('0xaa'));_0x33e5a8[_0x24a1('0x52')](_0x24a1('0xab'),'Contact.fax');_0x33e5a8[_0x24a1('0x52')](_0x24a1('0xac'),_0x24a1('0xad'));_0x33e5a8[_0x24a1('0x52')]('o.internal',_0x24a1('0xae'));_0x33e5a8[_0x24a1('0x52')](_0x24a1('0xaf'),_0x24a1('0x37'));}if(_0x490fdf[_0x24a1('0x26')])_0x33e5a8[_0x24a1('0x26')](_0x490fdf[_0x24a1('0x26')]);if(_0x490fdf[_0x24a1('0x23')])_0x33e5a8['offset'](_0x490fdf[_0x24a1('0x23')]);return db[_0x24a1('0x9c')][_0x24a1('0x45')](_0x33e5a8[_0x24a1('0x9d')](),_0x303db2);})[_0x24a1('0x2c')](function(_0xf1d946){if(_0xf1d946[_0x24a1('0x4b')]>0x0)_0x130269[_0x24a1('0x4f')](_0x24a1('0xb0'),_[_0x24a1('0x32')](_0xf1d946,'id'));return db[_0x24a1('0x9c')][_0x24a1('0x45')](_0x130269[_0x24a1('0x9d')](),_0x303db2)['then'](function(_0x896930){var _0x10785a=_[_0x24a1('0xb1')](_0x896930,_0x24a1('0xb2'));var _0x8ecade=[];_0xf1d946[_0x24a1('0x34')](function(_0x5c9e7a){_0x8ecade[_0x24a1('0x36')](updateOpenchannelInteraction(_0x5c9e7a,_0x152a20,_0x10785a));});return BPromise[_0x24a1('0xb3')](_0x8ecade);});});})[_0x24a1('0x2c')](function(_0x3ff694){_0x3bbddf['rows']=_0x3ff694;return _0x3bbddf;})['then'](respondWithFilteredResult(_0x1c5ae0,_0x490fdf))[_0x24a1('0x38')](handleError(_0x1c5ae0,null));};exports[_0x24a1('0xb4')]=function(_0x16a8ba,_0x347f1f){var _0x4307a3={};if(_0x16a8ba[_0x24a1('0x45')][_0x24a1('0x43')]&&_0x16a8ba[_0x24a1('0x45')][_0x24a1('0x43')]===_0x24a1('0x56')){_0x4307a3[_0x24a1('0x56')]=_0x16a8ba[_0x24a1('0xb5')]['id'];}else{_0x4307a3['id']=_0x16a8ba[_0x24a1('0xb5')]['id'];}var _0x34c639={'raw':![],'where':_0x4307a3},_0x39edee={};_0x39edee['model']=_['keys'](db[_0x24a1('0x40')][_0x24a1('0x41')]);_0x39edee[_0x24a1('0x45')]=_[_0x24a1('0x46')](_0x16a8ba[_0x24a1('0x45')]);_0x39edee[_0x24a1('0x47')]=_[_0x24a1('0x49')](_0x39edee[_0x24a1('0x44')],_0x39edee[_0x24a1('0x45')]);_0x34c639[_0x24a1('0x48')]=_[_0x24a1('0x49')](_0x39edee[_0x24a1('0x44')],qs[_0x24a1('0x4a')](_0x16a8ba['query'][_0x24a1('0x4a')]));_0x34c639[_0x24a1('0x48')]=_0x34c639[_0x24a1('0x48')]['length']?_0x34c639[_0x24a1('0x48')]:_0x39edee[_0x24a1('0x44')];if(_0x16a8ba[_0x24a1('0x45')][_0x24a1('0xb6')]){_0x34c639[_0x24a1('0xb7')]=[{'all':!![]}];}_0x34c639=_[_0x24a1('0xb8')]({},_0x34c639,_0x16a8ba[_0x24a1('0xb9')]);return db[_0x24a1('0x40')][_0x24a1('0x68')](_0x34c639)['then'](handleEntityNotFound(_0x347f1f,null))[_0x24a1('0x2c')](respondWithResult(_0x347f1f,null))[_0x24a1('0x38')](handleError(_0x347f1f,null));};exports[_0x24a1('0xba')]=function(_0x306200,_0x5846c4){return db[_0x24a1('0x40')][_0x24a1('0xba')](_0x306200[_0x24a1('0x7b')],{})[_0x24a1('0x2c')](respondWithResult(_0x5846c4,0xc9))[_0x24a1('0x38')](handleError(_0x5846c4,null));};exports[_0x24a1('0x2b')]=function(_0x2078fa,_0x5e86fb){if(_0x2078fa['body']['id']){delete _0x2078fa[_0x24a1('0x7b')]['id'];}return db[_0x24a1('0x40')][_0x24a1('0x68')]({'where':{'id':_0x2078fa[_0x24a1('0xb5')]['id']}})[_0x24a1('0x2c')](handleEntityNotFound(_0x5e86fb,null))[_0x24a1('0x2c')](saveUpdates(_0x2078fa['body'],null))[_0x24a1('0x2c')](respondWithResult(_0x5e86fb,null))[_0x24a1('0x38')](handleError(_0x5e86fb,null));};exports[_0x24a1('0xbb')]=function(_0x4ac65b,_0x11f899){return db['OpenchannelInteraction']['find']({'where':{'id':_0x4ac65b[_0x24a1('0xb5')]['id']}})['then'](handleEntityNotFound(_0x11f899,null))[_0x24a1('0x2c')](removeEntity(_0x11f899,null))[_0x24a1('0x38')](handleError(_0x11f899,null));};exports['describe']=function(_0x3ae278,_0x22e520){return db['OpenchannelInteraction'][_0x24a1('0xbc')]()['then'](respondWithResult(_0x22e520,null))[_0x24a1('0x38')](handleError(_0x22e520,null));};exports[_0x24a1('0xbd')]=function(_0x192404,_0x293ecb,_0x53ec3c){return db[_0x24a1('0xbe')]['find']({'where':{'id':_0x192404[_0x24a1('0xb5')]['id']}})[_0x24a1('0x2c')](handleEntityNotFound(_0x293ecb,null))[_0x24a1('0x2c')](function(_0x25ae10){if(_0x25ae10){return _0x25ae10['addMessage'](_0x192404['body'][_0x24a1('0xbf')],_[_0x24a1('0xc0')](_0x192404[_0x24a1('0x7b')],[_0x24a1('0xbf'),'id'])||{});}})['then'](respondWithResult(_0x293ecb,null))[_0x24a1('0x38')](handleError(_0x293ecb,null));};exports[_0x24a1('0xc1')]=function(_0x50c0c5,_0x47e5ba,_0x561b32){var _0x4f6482={'raw':![],'where':{}};var _0x5f0ff4={};var _0x21729e={'count':0x0,'rows':[]};return db[_0x24a1('0x40')][_0x24a1('0xc2')]({'where':{'id':_0x50c0c5[_0x24a1('0xb5')]['id']}})[_0x24a1('0x2c')](handleEntityNotFound(_0x47e5ba,null))[_0x24a1('0x2c')](function(_0x40a20e){if(_0x40a20e){_0x5f0ff4['model']=_[_0x24a1('0x46')](db[_0x24a1('0xbe')][_0x24a1('0x41')]);_0x5f0ff4['query']=_[_0x24a1('0x46')](_0x50c0c5[_0x24a1('0x45')]);_0x5f0ff4['filters']=_[_0x24a1('0x49')](_0x5f0ff4[_0x24a1('0x44')],_0x5f0ff4[_0x24a1('0x45')]);_0x4f6482[_0x24a1('0x48')]=_['intersection'](_0x5f0ff4[_0x24a1('0x44')],qs[_0x24a1('0x4a')](_0x50c0c5[_0x24a1('0x45')][_0x24a1('0x4a')]));_0x4f6482[_0x24a1('0x48')]=_0x4f6482['attributes'][_0x24a1('0x4b')]?_0x4f6482[_0x24a1('0x48')]:_0x5f0ff4['model'];if(!_0x50c0c5['query']['hasOwnProperty'](_0x24a1('0x4c'))){_0x4f6482[_0x24a1('0x26')]=qs['limit'](_0x50c0c5[_0x24a1('0x45')][_0x24a1('0x26')]);_0x4f6482[_0x24a1('0x23')]=qs[_0x24a1('0x23')](_0x50c0c5[_0x24a1('0x45')]['offset']);}_0x4f6482['order']=qs[_0x24a1('0x4e')](_0x50c0c5[_0x24a1('0x45')][_0x24a1('0x4e')]);_0x4f6482[_0x24a1('0x4f')]=qs[_0x24a1('0x47')](_[_0x24a1('0x50')](_0x50c0c5['query'],_0x5f0ff4['filters']));_0x4f6482[_0x24a1('0x4f')][_0x24a1('0xb2')]=_0x40a20e['id'];if(_0x50c0c5[_0x24a1('0x45')]['filter']){_0x4f6482['where']=_[_0x24a1('0xb8')](_0x4f6482['where'],{'$or':_[_0x24a1('0x32')](_0x4f6482[_0x24a1('0x48')],function(_0xc3b288){var _0x5b9270={};_0x5b9270[_0xc3b288]={'$like':'%'+_0x50c0c5[_0x24a1('0x45')][_0x24a1('0x89')]+'%'};return _0x5b9270;})});}if(_0x50c0c5[_0x24a1('0x45')][_0x24a1('0xc3')]){var _0x4426b2=_0x50c0c5['query']['$gte']['split'](',');var _0x446464={};_0x446464[_0x4426b2[0x0]]={'$gte':moment(_0x4426b2[0x1])[_0x24a1('0xc4')](_0x24a1('0xc5'))};_0x4f6482['where']=_[_0x24a1('0xb8')](_0x4f6482[_0x24a1('0x4f')],_0x446464);}_0x4f6482=_[_0x24a1('0xb8')]({},_0x4f6482,_0x50c0c5[_0x24a1('0xb9')]);return db[_0x24a1('0xbe')][_0x24a1('0x25')]({'where':_0x4f6482['where']})[_0x24a1('0x2c')](function(_0x403354){_0x21729e[_0x24a1('0x25')]=_0x403354;if(_0x50c0c5[_0x24a1('0x45')][_0x24a1('0xb6')]){_0x4f6482[_0x24a1('0xb7')]=[{'all':!![]}];}return db[_0x24a1('0xbe')][_0x24a1('0xc6')](_0x4f6482);})[_0x24a1('0x2c')](function(_0x35421c){_0x21729e[_0x24a1('0xc7')]=_0x35421c;return _0x21729e;});}})[_0x24a1('0x2c')](respondWithFilteredResult(_0x47e5ba,_0x4f6482))[_0x24a1('0x38')](handleError(_0x47e5ba,null));};exports[_0x24a1('0xc8')]=function(_0x323c4b,_0x21b84b,_0x3b8f2a){return db[_0x24a1('0x40')][_0x24a1('0x68')]({'where':{'id':_0x323c4b[_0x24a1('0xb5')]['id']}})['then'](handleEntityNotFound(_0x21b84b,null))[_0x24a1('0x2c')](function(_0x1f53b5){if(_0x1f53b5){return _0x1f53b5['setTags'](_0x323c4b['body'][_0x24a1('0xbf')],_[_0x24a1('0xc0')](_0x323c4b[_0x24a1('0x7b')],[_0x24a1('0xbf'),'id'])||{})[_0x24a1('0xc9')](function(){return db[_0x24a1('0x78')][_0x24a1('0xc6')]({'attributes':['id',_0x24a1('0x2f'),_0x24a1('0x53')],'where':{'id':_0x323c4b[_0x24a1('0x7b')][_0x24a1('0xbf')]}});})[_0x24a1('0x2c')](function(_0x32f924){socket[_0x24a1('0xca')]('openchannelInteractionTags:save',{'id':Number(_0x323c4b[_0x24a1('0xb5')]['id']),'tags':_0x32f924||[]});return{'id':Number(_0x323c4b[_0x24a1('0xb5')]['id']),'tags':_0x32f924||[]};});}})[_0x24a1('0x2c')](respondWithResult(_0x21b84b,null))[_0x24a1('0x38')](handleError(_0x21b84b,null));};exports[_0x24a1('0xcb')]=function(_0x34a6ef,_0x3a4a80,_0x120c32){return db[_0x24a1('0x40')]['find']({'where':{'id':_0x34a6ef[_0x24a1('0xb5')]['id']}})[_0x24a1('0x2c')](handleEntityNotFound(_0x3a4a80,null))[_0x24a1('0x2c')](function(_0x13e588){if(_0x13e588){return _0x13e588[_0x24a1('0xcb')](_0x34a6ef[_0x24a1('0x45')][_0x24a1('0xbf')]);}})[_0x24a1('0x2c')](respondWithStatusCode(_0x3a4a80,null))[_0x24a1('0x38')](handleError(_0x3a4a80,null));};exports[_0x24a1('0xcc')]=function(_0x346cf2,_0x5f542b){var _0x4475c2=moment()[_0x24a1('0xcd')]()[_0x24a1('0x9d')]();var _0x3e5490=path[_0x24a1('0xce')](config[_0x24a1('0xcf')],'server',_0x24a1('0xd0'),'tmp');var _0x35f05c=path[_0x24a1('0xce')](config[_0x24a1('0xcf')],_0x24a1('0xd1'),_0x24a1('0xd0'),_0x24a1('0xd2'));var _0x38ad13=path[_0x24a1('0xce')](_0x3e5490,_0x4475c2);var _0x255da6=util[_0x24a1('0xc4')](_0x24a1('0xd3'),_0x346cf2[_0x24a1('0xb5')]['id'],_0x4475c2);var _0x397c63=path[_0x24a1('0xce')](_0x3e5490,_0x255da6);var _0x4439bc=[];_0x4439bc[_0x24a1('0x36')]({'model':db[_0x24a1('0x79')],'as':_0x24a1('0x79'),'attributes':['id',_0x24a1('0xd4')],'raw':!![]});_0x4439bc[_0x24a1('0x36')]({'model':db[_0x24a1('0xd5')],'as':_0x24a1('0x6e'),'attributes':['id',_0x24a1('0xd6'),_0x24a1('0xd7')],'raw':!![]});if(_0x346cf2[_0x24a1('0x45')][_0x24a1('0xd2')]){_0x4439bc[_0x24a1('0x36')]({'model':db[_0x24a1('0xd8')],'as':_0x24a1('0xd8'),'raw':!![]});}var _0x54c95c=[{'model':db['OpenchannelMessage'],'as':'Messages','attributes':['id',_0x24a1('0x7b'),'createdAt',_0x24a1('0xd9'),_0x24a1('0xda'),_0x24a1('0x84')],'include':_0x4439bc}];_0x54c95c['push']({'model':db['OpenchannelAccount'],'as':_0x24a1('0xdb'),'attributes':['id','name']});_0x54c95c[_0x24a1('0x36')]({'model':db[_0x24a1('0x79')],'as':_0x24a1('0xdc'),'attributes':['id',_0x24a1('0xd4')]});return db[_0x24a1('0x40')]['find']({'where':{'id':_0x346cf2[_0x24a1('0xb5')]['id']},'include':_0x54c95c})[_0x24a1('0x2c')](handleEntityNotFound(_0x5f542b,null))[_0x24a1('0x2c')](function(_0x128d16){if(_0x128d16){var _0x24bbec=_0x128d16['get']({'plain':!![]});fs[_0x24a1('0xdd')](_0x38ad13);var _0x49ad4f={'channel':_0x24a1('0xde'),'account':_0x24bbec[_0x24a1('0xdb')][_0x24a1('0x2f')],'agent':_0x24bbec[_0x24a1('0xdc')]?_0x24bbec[_0x24a1('0xdc')][_0x24a1('0xd4')]:_0x24a1('0xdf'),'createdAt':moment(_0x24bbec[_0x24a1('0xe0')])[_0x24a1('0xc4')](_0x24a1('0xc5'))[_0x24a1('0x9d')](),'closedAt':_0x24bbec['closed']?moment(_0x24bbec['closedAt'])[_0x24a1('0xc4')](_0x24a1('0xc5'))[_0x24a1('0x9d')]():'','disposition':_0x24bbec[_0x24a1('0xe1')],'visibility':_0x24bbec[_0x24a1('0xe2')]?_0x24a1('0xe3'):'Private','messages':_(_0x24bbec['Messages'])['filter']({'secret':![]})[_0x24a1('0x32')](function(_0x28f8dc){if(_0x28f8dc[_0x24a1('0xd8')]){var _0x389c52=path[_0x24a1('0xce')](_0x35f05c,_0x28f8dc['Attachment'][_0x24a1('0xe4')]);if(fs[_0x24a1('0xe5')](_0x389c52)){fs[_0x24a1('0xe6')](_0x389c52)[_0x24a1('0xe7')](fs[_0x24a1('0xe8')](path['join'](_0x38ad13,_0x28f8dc[_0x24a1('0xd8')][_0x24a1('0xe4')])));}}return{'date':moment(_0x28f8dc['createdAt'])[_0x24a1('0xc4')](_0x24a1('0xc5'))[_0x24a1('0x9d')](),'sender':_0x28f8dc[_0x24a1('0xd9')]===_0x24a1('0xe9')?_0x28f8dc[_0x24a1('0x79')]?_0x28f8dc[_0x24a1('0x79')][_0x24a1('0xd4')]:'System':_0x28f8dc[_0x24a1('0x6e')][_0x24a1('0xd6')]+(_0x28f8dc['Contact'][_0x24a1('0xd7')]?'\x20'+_0x28f8dc[_0x24a1('0x6e')][_0x24a1('0xd7')]:''),'body':_0x28f8dc[_0x24a1('0xd8')]?_0x28f8dc[_0x24a1('0xd8')][_0x24a1('0xe4')]:_0x28f8dc[_0x24a1('0x7b')],'direction':_0x28f8dc[_0x24a1('0xd9')]===_0x24a1('0xe9')?'A':'C','secret':_0x28f8dc[_0x24a1('0xda')],'read':_0x28f8dc[_0x24a1('0x84')],'attachment':_0x28f8dc['Attachment']};})['value']()};return ejs[_0x24a1('0xea')](path[_0x24a1('0xce')](config[_0x24a1('0xcf')],_0x24a1('0xd1'),_0x24a1('0xeb'),_0x24a1('0xec')),{'interaction':_0x49ad4f})[_0x24a1('0x2c')](function(_0x2b980c){var _0x362f95=path[_0x24a1('0xce')](_0x38ad13,_0x24a1('0xed')+_0x24bbec['id']+'-'+_0x4475c2+_0x24a1('0xee'));var _0xccc084={'path':_0x362f95,'channel':_0x24a1('0xde'),'interactionId':_0x24bbec['id']};return pdf[_0x24a1('0xef')](_0x2b980c,_0xccc084);})[_0x24a1('0x2c')](function(){return new BPromise(function(_0x456ac7,_0x1a2987){zipdir(_0x38ad13,{'saveTo':_0x397c63},function(_0x1f8b2d,_0x11b209){if(_0x1f8b2d)return _0x1a2987(_0x1f8b2d);return _0x456ac7(_0x11b209);});})[_0x24a1('0x2c')](function(){return new BPromise(function(_0x27b9f8,_0x5407ec){rimraf(_0x38ad13,function(_0x58af36){if(_0x58af36)_0x5407ec(_0x58af36);return _0x27b9f8();});});})['then'](function(){return _0x5f542b['download'](_0x397c63,_0x255da6,function(_0x42a40e){if(_0x42a40e){console['log'](_0x24a1('0xf0'),_0x42a40e);}else{fs[_0x24a1('0xf1')](_0x397c63);}});});});}else{return _0x5f542b[_0x24a1('0x20')](0xc8);}})[_0x24a1('0x38')](handleError(_0x5f542b,null));}; \ No newline at end of file +var _0xf6b4=['value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','body','keys','some','isEmpty','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','resolve','OpenchannelAccountId','role','agent','user','i.OpenchannelAccountId\x20IS\x20NULL','sequelize','toString','length','merge','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','c.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','rows','show','params','include','create','describe','addMessage','omit','ids','getMessages','findOne','OpenchannelMessage','format','includeAll','findAll','addTags','setTags','spread','openchannelInteractionTags:save','removeTags','download','join','server','files','attachments','transcript-%d-%s.zip','firstName','lastName','secret','OpenchannelAccount','Owner','Account','N.A.','YYYY-MM-DD\x20HH:mm:ss','disposition','threadId','Messages','Attachment','basename','existsSync','createWriteStream','direction','out','System','root','transcript-','.pdf','Openchannel','createPdfFromHTML','log','unlinkSync','sendStatus','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/utils','../../config/license/util','redis','defaults','localhost','./openchannelInteraction.socket','register','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','error','stack','name','Users','fullname','TagIds','Tags','split','forEach','push','then','catch','waiting','talking','answered','unmanaged','total','UserId','closed','index','map','OpenchannelInteraction','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','tools_tags','u.id','u.fullname','left_join','users','u.id\x20=\x20ui.UserId','openchannel_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','me.OpenchannelInteractionId\x20=\x20i.id','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages'];(function(_0x2b40ef,_0x240506){var _0x297b45=function(_0x355167){while(--_0x355167){_0x2b40ef['push'](_0x2b40ef['shift']());}};_0x297b45(++_0x240506);}(_0xf6b4,0x178));var _0x4f6b=function(_0x3c3ec7,_0x309339){_0x3c3ec7=_0x3c3ec7-0x0;var _0x23e52c=_0xf6b4[_0x3c3ec7];return _0x23e52c;};'use strict';var emlformat=require(_0x4f6b('0x0'));var rimraf=require(_0x4f6b('0x1'));var zipdir=require(_0x4f6b('0x2'));var jsonpatch=require(_0x4f6b('0x3'));var rp=require(_0x4f6b('0x4'));var moment=require(_0x4f6b('0x5'));var BPromise=require(_0x4f6b('0x6'));var Mustache=require(_0x4f6b('0x7'));var util=require(_0x4f6b('0x8'));var path=require(_0x4f6b('0x9'));var sox=require(_0x4f6b('0xa'));var csv=require('to-csv');var ejs=require(_0x4f6b('0xb'));var fs=require('fs');var fs_extra=require(_0x4f6b('0xc'));var _=require(_0x4f6b('0xd'));var squel=require(_0x4f6b('0xe'));var crypto=require(_0x4f6b('0xf'));var jsforce=require(_0x4f6b('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x4f6b('0x11'));var querystring=require(_0x4f6b('0x12'));var Papa=require(_0x4f6b('0x13'));var Redis=require(_0x4f6b('0x14'));var authService=require(_0x4f6b('0x15'));var qs=require(_0x4f6b('0x16'));var as=require(_0x4f6b('0x17'));var pdf=require(_0x4f6b('0x18'));var hardwareService=require(_0x4f6b('0x19'));var logger=require('../../config/logger')('api');var utils=require(_0x4f6b('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0x4f6b('0x1b'));var db=require('../../mysqldb')['db'];config[_0x4f6b('0x1c')]=_[_0x4f6b('0x1d')](config[_0x4f6b('0x1c')],{'host':_0x4f6b('0x1e'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4f6b('0x1c')]));require(_0x4f6b('0x1f'))[_0x4f6b('0x20')](socket);function respondWithStatusCode(_0x44f396,_0x489f39){_0x489f39=_0x489f39||0xcc;return function(_0x3dbbe4){if(_0x3dbbe4){return _0x44f396['sendStatus'](_0x489f39);}return _0x44f396['status'](_0x489f39)[_0x4f6b('0x21')]();};}function respondWithResult(_0x4a523f,_0x9c04f8){_0x9c04f8=_0x9c04f8||0xc8;return function(_0x9dac16){if(_0x9dac16){return _0x4a523f[_0x4f6b('0x22')](_0x9c04f8)[_0x4f6b('0x23')](_0x9dac16);}};}function respondWithFilteredResult(_0x215945,_0x4b6e87){return function(_0x55623d){if(_0x55623d){var _0x5edc63=typeof _0x4b6e87[_0x4f6b('0x24')]===_0x4f6b('0x25')&&typeof _0x4b6e87[_0x4f6b('0x26')]===_0x4f6b('0x25');var _0xf673ac=_0x55623d[_0x4f6b('0x27')];var _0x58a948=_0x5edc63?0x0:_0x4b6e87[_0x4f6b('0x24')];var _0x263b79=_0x5edc63?_0x55623d[_0x4f6b('0x27')]:_0x4b6e87[_0x4f6b('0x24')]+_0x4b6e87['limit'];var _0x4e0258;if(_0x263b79>=_0xf673ac){_0x263b79=_0xf673ac;_0x4e0258=0xc8;}else{_0x4e0258=0xce;}_0x215945[_0x4f6b('0x22')](_0x4e0258);return _0x215945['set'](_0x4f6b('0x28'),_0x58a948+'-'+_0x263b79+'/'+_0xf673ac)[_0x4f6b('0x23')](_0x55623d);}return null;};}function patchUpdates(_0x4197e4){return function(_0x5f03df){try{jsonpatch[_0x4f6b('0x29')](_0x5f03df,_0x4197e4,!![]);}catch(_0x12cb01){return BPromise[_0x4f6b('0x2a')](_0x12cb01);}return _0x5f03df[_0x4f6b('0x2b')]();};}function saveUpdates(_0x1c3877,_0x4dd839){return function(_0x56a6f9){if(_0x56a6f9){return _0x56a6f9[_0x4f6b('0x2c')](_0x1c3877)['then'](function(_0x10f5fd){return _0x10f5fd;});}return null;};}function removeEntity(_0x1b56a8,_0x3f9d78){return function(_0x1a192a){if(_0x1a192a){return _0x1a192a[_0x4f6b('0x2d')]()['then'](function(){_0x1b56a8[_0x4f6b('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x19b4ef,_0x1958fc){return function(_0x55cddd){if(!_0x55cddd){_0x19b4ef['sendStatus'](0x194);}return _0x55cddd;};}function handleError(_0x1754ea,_0x1b6fc0){_0x1b6fc0=_0x1b6fc0||0x1f4;return function(_0x455de1){logger[_0x4f6b('0x2e')](_0x455de1[_0x4f6b('0x2f')]);if(_0x455de1[_0x4f6b('0x30')]){delete _0x455de1[_0x4f6b('0x30')];}_0x1754ea[_0x4f6b('0x22')](_0x1b6fc0)['send'](_0x455de1);};}function getInteractionUsers(_0x1627dd,_0x3556c6){return new BPromise(function(_0x1f5fcb,_0x1ed248){try{if(_0x3556c6[_0x1627dd['id']]){_0x1627dd[_0x4f6b('0x31')]=_['map'](_0x3556c6[_0x1627dd['id']],function(_0x271306){return{'id':_0x271306['id'],'fullname':_0x271306[_0x4f6b('0x32')]};});}}catch(_0x244e80){_0x1ed248(_0x244e80);}_0x1f5fcb(_0x1627dd);});}function getInteractionTags(_0xd25729,_0x31700a){return new BPromise(function(_0x331d37,_0xd37cb0){try{if(_0xd25729[_0x4f6b('0x33')]){_0xd25729[_0x4f6b('0x34')]=[];_0xd25729[_0x4f6b('0x33')][_0x4f6b('0x35')](',')[_0x4f6b('0x36')](function(_0x544628){_0xd25729[_0x4f6b('0x34')][_0x4f6b('0x37')](_0x31700a[_0x544628]);});}delete _0xd25729[_0x4f6b('0x33')];}catch(_0xfbbcf){_0xd37cb0(_0xfbbcf);}_0x331d37(_0xd25729);});}function updateOpenchannelInteraction(_0x25e8f3,_0x171650,_0xcd19e2){return new BPromise(function(_0x2ab749,_0x562455){return getInteractionUsers(_0x25e8f3,_0xcd19e2)[_0x4f6b('0x38')](function(_0x479810){return getInteractionTags(_0x479810,_0x171650);})[_0x4f6b('0x38')](function(_0x438af7){return getStateInteraction(_0x438af7);})[_0x4f6b('0x38')](function(_0x23489b){_0x2ab749(_0x23489b);})[_0x4f6b('0x39')](function(_0x76033){_0x562455(_0x76033);});});}function getStateInteraction(_0x588072){return new BPromise(function(_0x17c825){_0x588072[_0x4f6b('0x3a')]=0x0;_0x588072[_0x4f6b('0x3b')]=0x0;_0x588072[_0x4f6b('0x3c')]=0x0;_0x588072[_0x4f6b('0x3d')]=0x0;_0x588072[_0x4f6b('0x3e')]=0x0;if(!_0x588072['closed']&&!_0x588072[_0x4f6b('0x3f')]){_0x588072[_0x4f6b('0x3a')]+=0x1;}if(!_0x588072[_0x4f6b('0x40')]&&_0x588072[_0x4f6b('0x3f')]){_0x588072[_0x4f6b('0x3b')]+=0x1;ids[_0x4f6b('0x37')](_0x588072['id']);if(_0x588072['waiting']){_0x588072[_0x4f6b('0x3a')]-=0x1;}}if(_0x588072[_0x4f6b('0x40')]&&_0x588072['UserId']){_0x588072[_0x4f6b('0x3c')]+=0x1;if(_0x588072[_0x4f6b('0x3b')]){_0x588072[_0x4f6b('0x3b')]-=0x1;}}if(_0x588072[_0x4f6b('0x40')]&&!_0x588072[_0x4f6b('0x3f')]){_0x588072[_0x4f6b('0x3d')]+=0x1;if(_0x588072[_0x4f6b('0x3a')]){_0x588072[_0x4f6b('0x3a')]-=0x1;}}_0x588072[_0x4f6b('0x3e')]+=0x1;_0x17c825(_0x588072);});}exports[_0x4f6b('0x41')]=function(_0x2eae77,_0x1a96bc){var _0x31d5fd={},_0x2db70f={},_0xa5998f={'count':0x0,'rows':[]};var _0xd14de8=_[_0x4f6b('0x42')](db[_0x4f6b('0x43')][_0x4f6b('0x44')],function(_0x562785){return{'name':_0x562785['fieldName'],'type':_0x562785[_0x4f6b('0x45')][_0x4f6b('0x46')]};});_0x2db70f[_0x4f6b('0x47')]=_['map'](_0xd14de8,_0x4f6b('0x30'));_0x2db70f['query']=_['keys'](_0x2eae77[_0x4f6b('0x48')]);_0x2db70f[_0x4f6b('0x49')]=_[_0x4f6b('0x4a')](_0x2db70f[_0x4f6b('0x47')],_0x2db70f[_0x4f6b('0x48')]);_0x31d5fd[_0x4f6b('0x4b')]=_[_0x4f6b('0x4a')](_0x2db70f[_0x4f6b('0x47')],qs[_0x4f6b('0x4c')](_0x2eae77[_0x4f6b('0x48')][_0x4f6b('0x4c')]));_0x31d5fd[_0x4f6b('0x4b')]=_0x31d5fd[_0x4f6b('0x4b')]['length']?_0x31d5fd[_0x4f6b('0x4b')]:_0x2db70f['model'];if(!_0x2eae77['query'][_0x4f6b('0x4d')](_0x4f6b('0x4e'))){_0x31d5fd[_0x4f6b('0x26')]=qs['limit'](_0x2eae77[_0x4f6b('0x48')]['limit']);_0x31d5fd[_0x4f6b('0x24')]=qs[_0x4f6b('0x24')](_0x2eae77[_0x4f6b('0x48')]['offset']);}_0x31d5fd[_0x4f6b('0x4f')]=qs[_0x4f6b('0x50')](_0x2eae77[_0x4f6b('0x48')][_0x4f6b('0x50')]);_0x31d5fd[_0x4f6b('0x51')]=qs[_0x4f6b('0x49')](_[_0x4f6b('0x52')](_0x2eae77[_0x4f6b('0x48')],_0x2db70f[_0x4f6b('0x49')]),_0xd14de8);var _0x4c4902=[];var _0x2b29fd=squel[_0x4f6b('0x53')]()[_0x4f6b('0x54')]('id')[_0x4f6b('0x54')](_0x4f6b('0x30'))[_0x4f6b('0x54')](_0x4f6b('0x55'))[_0x4f6b('0x56')](_0x4f6b('0x57'));var _0xf9ba3b=squel[_0x4f6b('0x53')]()['field'](_0x4f6b('0x58'))[_0x4f6b('0x54')](_0x4f6b('0x59'))[_0x4f6b('0x54')]('ui.OpenchannelInteractionId')[_0x4f6b('0x56')]('user_has_openchannel_interactions','ui')[_0x4f6b('0x5a')](_0x4f6b('0x5b'),'u',_0x4f6b('0x5c'));var _0x2b887f=squel[_0x4f6b('0x53')]()[_0x4f6b('0x56')](_0x4f6b('0x5d'),'i')['left_join'](_0x4f6b('0x5e'),'c',_0x4f6b('0x5f'))[_0x4f6b('0x5a')]('users','o','o.id\x20=\x20i.UserId')[_0x4f6b('0x5a')](_0x4f6b('0x60'),'a',_0x4f6b('0x61'))[_0x4f6b('0x5a')]('openchannel_messages','me',_0x4f6b('0x62'))[_0x4f6b('0x5a')]('openchannel_interaction_has_tags','it',_0x4f6b('0x63'))[_0x4f6b('0x5a')](_0x4f6b('0x57'),'t',_0x4f6b('0x64'));var _0x156fa2=squel[_0x4f6b('0x65')]();var _0x15defb=[];var _0x1e97b9=squel[_0x4f6b('0x65')]();var _0x452a61;if(_0x2eae77[_0x4f6b('0x48')][_0x4f6b('0x66')]){_0x452a61=as[_0x4f6b('0x67')](_0x2eae77[_0x4f6b('0x48')]['search']);var _0x2b5b39=_0x452a61[_0x4f6b('0x68')];for(var _0x141617=0x0;_0x141617<_0x452a61[_0x4f6b('0x69')]['length'];_0x141617++){var _0x3004e1=_0x452a61[_0x4f6b('0x69')][_0x141617];var _0x23d9c2='i';var _0x51a8eb=_[_0x4f6b('0x6a')](_0xd14de8,[_0x4f6b('0x30'),_0x3004e1[_0x4f6b('0x54')]]);if(!_0x51a8eb){switch(_0x3004e1[_0x4f6b('0x54')]){case _0x4f6b('0x6b'):if(_0x3004e1[_0x4f6b('0x6c')]==0x1){_0x2b887f[_0x4f6b('0x6d')]('`'+_0x3004e1['field']+_0x4f6b('0x6e'));}else{_0x2b887f[_0x4f6b('0x6d')]('`'+_0x3004e1[_0x4f6b('0x54')]+_0x4f6b('0x6f'));}break;case _0x4f6b('0x70'):if(_0x3004e1[_0x4f6b('0x71')]===_0x4f6b('0x72')){if(_0x3004e1['value'][_0x4f6b('0x35')]('\x20')['length']>0x1){_0x156fa2[_0x2b5b39](_0x4f6b('0x73'),qs[_0x4f6b('0x74')](_0x3004e1[_0x4f6b('0x6c')]),null);}else{var _0x3b01b5='%'+_0x3004e1[_0x4f6b('0x6c')]+'%';_0x156fa2[_0x2b5b39]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x3b01b5,_0x3b01b5,_0x3b01b5);}}else{_0x51a8eb=_[_0x4f6b('0x6a')](_0xd14de8,['name',_0x4f6b('0x75')]);_0x3004e1['field']=_0x4f6b('0x75');_0x33c164=as[_0x4f6b('0x76')](_0x23d9c2,_0x51a8eb[_0x4f6b('0x45')],_0x3004e1);_0x156fa2[_0x2b5b39](_0x33c164[_0x4f6b('0x77')],_0x33c164[_0x4f6b('0x6c')][_0x4f6b('0x78')],_0x33c164[_0x4f6b('0x6c')][_0x4f6b('0x21')]);}break;case _0x4f6b('0x79'):var _0xdd9c32=_0x3004e1[_0x4f6b('0x6c')][_0x4f6b('0x35')](',')[_0x4f6b('0x42')](function(_0x876e8c){return Number(_0x876e8c);});_0xdd9c32[_0x4f6b('0x36')](function(_0x2b5944){_0x1e97b9['or'](_0x4f6b('0x7a'),'%,'+_0x2b5944+',%');});_0x15defb=_[_0x4f6b('0x7b')](_0x15defb,_0xdd9c32);break;case _0x4f6b('0x7c'):if(_0x3004e1['operator']===_0x4f6b('0x72')){_0x156fa2[_0x2b5b39](_0x4f6b('0x7d'),'%'+_0x3004e1[_0x4f6b('0x6c')]+'%',null);}else{_0x51a8eb=_['find'](_0xd14de8,[_0x4f6b('0x30'),_0x4f6b('0x3f')]);_0x3004e1[_0x4f6b('0x54')]=_0x4f6b('0x3f');_0x33c164=as[_0x4f6b('0x76')](_0x23d9c2,_0x51a8eb[_0x4f6b('0x45')],_0x3004e1);_0x156fa2[_0x2b5b39](_0x33c164[_0x4f6b('0x77')],_0x33c164[_0x4f6b('0x6c')][_0x4f6b('0x78')],_0x33c164[_0x4f6b('0x6c')][_0x4f6b('0x21')]);}break;case _0x4f6b('0x7e'):_0x33c164=as[_0x4f6b('0x76')]('me',null,_0x3004e1);_0x156fa2[_0x2b5b39](_0x33c164[_0x4f6b('0x77')],_0x33c164['value'][_0x4f6b('0x78')],_0x33c164[_0x4f6b('0x6c')][_0x4f6b('0x21')]);break;}}else{var _0x33c164=as[_0x4f6b('0x76')](_0x23d9c2,_0x51a8eb['type'],_0x3004e1);_0x156fa2[_0x2b5b39](_0x33c164[_0x4f6b('0x77')],_0x33c164[_0x4f6b('0x6c')][_0x4f6b('0x78')],_0x33c164[_0x4f6b('0x6c')]['end']);}}}else{var _0x428d33=_(_0x2eae77['query'])[_0x4f6b('0x7f')]()[_0x4f6b('0x42')](function(_0x14100d){return _[_0x4f6b('0x80')](_0xd14de8,[_0x4f6b('0x30'),_0x14100d])?_0x14100d:undefined;})['compact']()[_0x4f6b('0x6c')]();if(!_[_0x4f6b('0x81')](_0x428d33)){_0x428d33['forEach'](function(_0x37e801){if(_0x37e801==='OpenchannelAccountId'){_0x2b887f[_0x4f6b('0x51')](_0x4f6b('0x82'),[][_0x4f6b('0x83')](_0x2eae77[_0x4f6b('0x48')][_0x37e801]));}else if(_0x37e801===_0x4f6b('0x84')){var _0x45014e=JSON[_0x4f6b('0x85')](_0x2eae77[_0x4f6b('0x48')][_0x37e801])[_0x4f6b('0x86')];var _0x1e3ddd=JSON[_0x4f6b('0x85')](_0x2eae77[_0x4f6b('0x48')][_0x37e801])[_0x4f6b('0x87')];_0x2b887f[_0x4f6b('0x51')](_0x4f6b('0x88'),_0x45014e,_0x1e3ddd);}else{if(_0x2eae77[_0x4f6b('0x48')][_0x37e801]===_0x4f6b('0x89')){_0x2b887f[_0x4f6b('0x51')]('i.'+_0x37e801+_0x4f6b('0x8a'));}else{_0x2b887f[_0x4f6b('0x51')]('i.'+_0x37e801+_0x4f6b('0x8b'),_0x2eae77[_0x4f6b('0x48')][_0x37e801]);}}});}if(_0x2eae77['query'][_0x4f6b('0x8c')]){if(_0x2eae77[_0x4f6b('0x48')][_0x4f6b('0x8c')]==0x1){_0x2b887f[_0x4f6b('0x6d')](_0x4f6b('0x8d'));}else{_0x2b887f[_0x4f6b('0x6d')](_0x4f6b('0x8e'));}}if(_0x2eae77[_0x4f6b('0x48')][_0x4f6b('0x8f')]){_0x15defb=_[_0x4f6b('0x90')](_0x2eae77[_0x4f6b('0x48')][_0x4f6b('0x8f')])?_0x2eae77[_0x4f6b('0x48')][_0x4f6b('0x8f')]:new Array(_0x2eae77[_0x4f6b('0x48')][_0x4f6b('0x8f')]);_0x15defb[_0x4f6b('0x36')](function(_0x102a97){_0x1e97b9['or'](_0x4f6b('0x7a'),'%,'+_0x102a97+',%');});}if(_0x2eae77[_0x4f6b('0x48')]['filter']){var _0x1a90ba=_0x2eae77[_0x4f6b('0x48')][_0x4f6b('0x91')]['replace']('\x5c','\x5c\x5c')[_0x4f6b('0x92')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x1a90ba)){_0x156fa2['or'](_0x4f6b('0x93'),_0x1a90ba+'%');}else{_0x156fa2['or'](_0x4f6b('0x94'),qs[_0x4f6b('0x74')](_0x1a90ba))['or']('i.from\x20LIKE\x20?',_0x1a90ba+'%')['or'](_0x4f6b('0x95'),_0x1a90ba+'%');}}}_0x2b887f[_0x4f6b('0x51')](_0x156fa2);_0x2b887f[_0x4f6b('0x96')](_0x4f6b('0x97'));var _0x467a7e={'type':db['Sequelize'][_0x4f6b('0x98')][_0x4f6b('0x99')],'raw':!![]};var _0x4d0eb2=_0x2b887f[_0x4f6b('0x9a')]();_0x4d0eb2[_0x4f6b('0x54')](_0x4f6b('0x97'));_0x4d0eb2[_0x4f6b('0x54')](_0x4f6b('0x9b'),_0x4f6b('0x6b'));if(_0x31d5fd[_0x4f6b('0x4f')]){_0x31d5fd[_0x4f6b('0x4f')][_0x4f6b('0x36')](function(_0x3e6173){var _0x6813b=_0x3e6173[0x0]==='contactName'?_0x3e6173[0x0]:'i.'+_0x3e6173[0x0];_0x2b887f[_0x4f6b('0x4f')](_0x6813b,_0x3e6173[0x1]===_0x4f6b('0x9c')?![]:!![]);});}if(!_[_0x4f6b('0x81')](_0x15defb)){_0x2b887f[_0x4f6b('0x6d')](_0x1e97b9);_0x4d0eb2[_0x4f6b('0x51')]('t.id\x20IN\x20?',_0x15defb);}BPromise[_0x4f6b('0x9d')]()['then'](function(){if(!_0x452a61){if(_0x2eae77[_0x4f6b('0x48')][_0x4f6b('0x9e')])return;_0x4d0eb2[_0x4f6b('0x51')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');_0x2b887f[_0x4f6b('0x51')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x2eae77['user'][_0x4f6b('0x9f')]!==_0x4f6b('0xa0'))return;return _0x2eae77[_0x4f6b('0xa1')]['getOpenchannelAccounts']({'attributes':['id'],'raw':!![]})[_0x4f6b('0x38')](function(_0xa7076d){if(_[_0x4f6b('0x81')](_0xa7076d)){_0x4d0eb2[_0x4f6b('0x51')](_0x4f6b('0xa2'));_0x2b887f[_0x4f6b('0x51')](_0x4f6b('0xa2'));}else{_0x4d0eb2[_0x4f6b('0x51')]('i.OpenchannelAccountId\x20IN\x20?',_[_0x4f6b('0x42')](_0xa7076d,'id'));_0x2b887f['where'](_0x4f6b('0x82'),_[_0x4f6b('0x42')](_0xa7076d,'id'));}});})['then'](function(){if(_0x2eae77['user'][_0x4f6b('0x9f')]===_0x4f6b('0xa0')&&!_0x452a61&&!_0x2eae77['query']['OpenchannelAccountId'])return[];return db[_0x4f6b('0xa3')][_0x4f6b('0x48')](_0x4d0eb2[_0x4f6b('0xa4')](),_0x467a7e);})['then'](function(_0x2ad9b8){_0xa5998f[_0x4f6b('0x27')]=_0x2ad9b8[_0x4f6b('0xa5')];if(_0xa5998f[_0x4f6b('0x27')]===0x0)return[];return db[_0x4f6b('0xa3')]['query'](_0x2b29fd['toString'](),_0x467a7e)[_0x4f6b('0x38')](function(_0x380d1d){_0x4c4902=_['keyBy'](_0x380d1d,'id');_0x467a7e=_[_0x4f6b('0xa6')](_0x467a7e,{'model':db['OpenchannelInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2eae77['query']['fields']){_0x31d5fd[_0x4f6b('0x4b')]['forEach'](function(_0x45680c){_0x2b887f[_0x4f6b('0x54')]('i.'+_0x45680c);});}else{_0x2b887f['field'](_0x4f6b('0x9b'),'unreadMessages');_0x2b887f[_0x4f6b('0x54')](_0x4f6b('0xa7'),'Account.key');_0x2b887f[_0x4f6b('0x54')](_0x4f6b('0xa8'),_0x4f6b('0xa9'));_0x2b887f[_0x4f6b('0x54')](_0x4f6b('0xaa'),_0x4f6b('0xab'));_0x2b887f[_0x4f6b('0x54')](_0x4f6b('0xac'));_0x2b887f['field'](_0x4f6b('0xad'),_0x4f6b('0xae'));_0x2b887f[_0x4f6b('0x54')](_0x4f6b('0xaf'),_0x4f6b('0xb0'));_0x2b887f[_0x4f6b('0x54')](_0x4f6b('0xb1'),'Contact.email');_0x2b887f[_0x4f6b('0x54')](_0x4f6b('0xb2'),'Contact.phone');_0x2b887f[_0x4f6b('0x54')](_0x4f6b('0xb3'),_0x4f6b('0xb4'));_0x2b887f[_0x4f6b('0x54')](_0x4f6b('0xb5'),_0x4f6b('0xb6'));_0x2b887f[_0x4f6b('0x54')](_0x4f6b('0xb7'),_0x4f6b('0xb8'));_0x2b887f[_0x4f6b('0x54')](_0x4f6b('0xb9'),_0x4f6b('0xba'));_0x2b887f[_0x4f6b('0x54')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x31d5fd['limit'])_0x2b887f[_0x4f6b('0x26')](_0x31d5fd[_0x4f6b('0x26')]);if(_0x31d5fd[_0x4f6b('0x24')])_0x2b887f[_0x4f6b('0x24')](_0x31d5fd['offset']);return db['sequelize'][_0x4f6b('0x48')](_0x2b887f['toString'](),_0x467a7e);})[_0x4f6b('0x38')](function(_0x33458a){if(_0x33458a['length']>0x0)_0xf9ba3b[_0x4f6b('0x51')](_0x4f6b('0xbb'),_[_0x4f6b('0x42')](_0x33458a,'id'));return db[_0x4f6b('0xa3')]['query'](_0xf9ba3b[_0x4f6b('0xa4')](),_0x467a7e)[_0x4f6b('0x38')](function(_0x3053cf){var _0x43d7d4=_[_0x4f6b('0xbc')](_0x3053cf,_0x4f6b('0xbd'));var _0x328e10=[];_0x33458a[_0x4f6b('0x36')](function(_0x269297){_0x328e10['push'](updateOpenchannelInteraction(_0x269297,_0x4c4902,_0x43d7d4));});return BPromise['all'](_0x328e10);});});})['then'](function(_0x235d59){_0xa5998f[_0x4f6b('0xbe')]=_0x235d59;return _0xa5998f;})[_0x4f6b('0x38')](respondWithFilteredResult(_0x1a96bc,_0x31d5fd))['catch'](handleError(_0x1a96bc,null));};exports[_0x4f6b('0xbf')]=function(_0x553d70,_0x36e6d3){var _0x44a4c9={};if(_0x553d70['query']['type']&&_0x553d70[_0x4f6b('0x48')][_0x4f6b('0x45')]===_0x4f6b('0x56')){_0x44a4c9['from']=_0x553d70['params']['id'];}else{_0x44a4c9['id']=_0x553d70[_0x4f6b('0xc0')]['id'];}var _0x2c6ab6={'raw':![],'where':_0x44a4c9},_0x26196a={};_0x26196a[_0x4f6b('0x47')]=_['keys'](db[_0x4f6b('0x43')][_0x4f6b('0x44')]);_0x26196a[_0x4f6b('0x48')]=_[_0x4f6b('0x7f')](_0x553d70[_0x4f6b('0x48')]);_0x26196a[_0x4f6b('0x49')]=_[_0x4f6b('0x4a')](_0x26196a[_0x4f6b('0x47')],_0x26196a[_0x4f6b('0x48')]);_0x2c6ab6[_0x4f6b('0x4b')]=_[_0x4f6b('0x4a')](_0x26196a[_0x4f6b('0x47')],qs[_0x4f6b('0x4c')](_0x553d70[_0x4f6b('0x48')][_0x4f6b('0x4c')]));_0x2c6ab6[_0x4f6b('0x4b')]=_0x2c6ab6[_0x4f6b('0x4b')]['length']?_0x2c6ab6[_0x4f6b('0x4b')]:_0x26196a[_0x4f6b('0x47')];if(_0x553d70[_0x4f6b('0x48')]['includeAll']){_0x2c6ab6[_0x4f6b('0xc1')]=[{'all':!![]}];}_0x2c6ab6=_[_0x4f6b('0xa6')]({},_0x2c6ab6,_0x553d70['options']);return db[_0x4f6b('0x43')]['find'](_0x2c6ab6)['then'](handleEntityNotFound(_0x36e6d3,null))['then'](respondWithResult(_0x36e6d3,null))[_0x4f6b('0x39')](handleError(_0x36e6d3,null));};exports[_0x4f6b('0xc2')]=function(_0x3106ce,_0x46dbe0){return db[_0x4f6b('0x43')][_0x4f6b('0xc2')](_0x3106ce[_0x4f6b('0x7e')],{})[_0x4f6b('0x38')](respondWithResult(_0x46dbe0,0xc9))[_0x4f6b('0x39')](handleError(_0x46dbe0,null));};exports['update']=function(_0x2ab937,_0x3c1c39){if(_0x2ab937['body']['id']){delete _0x2ab937[_0x4f6b('0x7e')]['id'];}return db[_0x4f6b('0x43')]['find']({'where':{'id':_0x2ab937[_0x4f6b('0xc0')]['id']}})[_0x4f6b('0x38')](handleEntityNotFound(_0x3c1c39,null))[_0x4f6b('0x38')](saveUpdates(_0x2ab937[_0x4f6b('0x7e')],null))[_0x4f6b('0x38')](respondWithResult(_0x3c1c39,null))['catch'](handleError(_0x3c1c39,null));};exports[_0x4f6b('0x2d')]=function(_0x4595de,_0x145e6c){return db[_0x4f6b('0x43')]['find']({'where':{'id':_0x4595de[_0x4f6b('0xc0')]['id']}})[_0x4f6b('0x38')](handleEntityNotFound(_0x145e6c,null))[_0x4f6b('0x38')](removeEntity(_0x145e6c,null))[_0x4f6b('0x39')](handleError(_0x145e6c,null));};exports[_0x4f6b('0xc3')]=function(_0x23575f,_0x2a825c){return db[_0x4f6b('0x43')][_0x4f6b('0xc3')]()[_0x4f6b('0x38')](respondWithResult(_0x2a825c,null))[_0x4f6b('0x39')](handleError(_0x2a825c,null));};exports[_0x4f6b('0xc4')]=function(_0x1a669c,_0x5d906a,_0xa40179){return db['OpenchannelMessage'][_0x4f6b('0x6a')]({'where':{'id':_0x1a669c[_0x4f6b('0xc0')]['id']}})[_0x4f6b('0x38')](handleEntityNotFound(_0x5d906a,null))[_0x4f6b('0x38')](function(_0xb76ac2){if(_0xb76ac2){return _0xb76ac2['addMessage'](_0x1a669c[_0x4f6b('0x7e')]['ids'],_[_0x4f6b('0xc5')](_0x1a669c['body'],[_0x4f6b('0xc6'),'id'])||{});}})[_0x4f6b('0x38')](respondWithResult(_0x5d906a,null))['catch'](handleError(_0x5d906a,null));};exports[_0x4f6b('0xc7')]=function(_0x243f65,_0x11fad7,_0x2b1b45){var _0x3c6f2e={'raw':![],'where':{}};var _0x53e4ed={};var _0x3b1f17={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0x4f6b('0xc8')]({'where':{'id':_0x243f65[_0x4f6b('0xc0')]['id']}})[_0x4f6b('0x38')](handleEntityNotFound(_0x11fad7,null))['then'](function(_0x31f84b){if(_0x31f84b){_0x53e4ed[_0x4f6b('0x47')]=_[_0x4f6b('0x7f')](db[_0x4f6b('0xc9')]['rawAttributes']);_0x53e4ed[_0x4f6b('0x48')]=_[_0x4f6b('0x7f')](_0x243f65[_0x4f6b('0x48')]);_0x53e4ed['filters']=_[_0x4f6b('0x4a')](_0x53e4ed[_0x4f6b('0x47')],_0x53e4ed[_0x4f6b('0x48')]);_0x3c6f2e['attributes']=_[_0x4f6b('0x4a')](_0x53e4ed[_0x4f6b('0x47')],qs[_0x4f6b('0x4c')](_0x243f65[_0x4f6b('0x48')][_0x4f6b('0x4c')]));_0x3c6f2e[_0x4f6b('0x4b')]=_0x3c6f2e['attributes'][_0x4f6b('0xa5')]?_0x3c6f2e[_0x4f6b('0x4b')]:_0x53e4ed['model'];if(!_0x243f65[_0x4f6b('0x48')][_0x4f6b('0x4d')](_0x4f6b('0x4e'))){_0x3c6f2e[_0x4f6b('0x26')]=qs['limit'](_0x243f65[_0x4f6b('0x48')]['limit']);_0x3c6f2e[_0x4f6b('0x24')]=qs[_0x4f6b('0x24')](_0x243f65[_0x4f6b('0x48')]['offset']);}_0x3c6f2e[_0x4f6b('0x4f')]=qs[_0x4f6b('0x50')](_0x243f65[_0x4f6b('0x48')][_0x4f6b('0x50')]);_0x3c6f2e['where']=qs[_0x4f6b('0x49')](_[_0x4f6b('0x52')](_0x243f65[_0x4f6b('0x48')],_0x53e4ed[_0x4f6b('0x49')]));_0x3c6f2e['where'][_0x4f6b('0xbd')]=_0x31f84b['id'];if(_0x243f65[_0x4f6b('0x48')]['filter']){_0x3c6f2e[_0x4f6b('0x51')]=_[_0x4f6b('0xa6')](_0x3c6f2e[_0x4f6b('0x51')],{'$or':_[_0x4f6b('0x42')](_0x3c6f2e['attributes'],function(_0xa0f52a){var _0x426e2a={};_0x426e2a[_0xa0f52a]={'$like':'%'+_0x243f65[_0x4f6b('0x48')][_0x4f6b('0x91')]+'%'};return _0x426e2a;})});}if(_0x243f65['query'][_0x4f6b('0x86')]){var _0x5de20d=_0x243f65[_0x4f6b('0x48')][_0x4f6b('0x86')][_0x4f6b('0x35')](',');var _0x4af715={};_0x4af715[_0x5de20d[0x0]]={'$gte':moment(_0x5de20d[0x1])[_0x4f6b('0xca')]('YYYY-MM-DD\x20HH:mm:ss')};_0x3c6f2e[_0x4f6b('0x51')]=_['merge'](_0x3c6f2e[_0x4f6b('0x51')],_0x4af715);}_0x3c6f2e=_[_0x4f6b('0xa6')]({},_0x3c6f2e,_0x243f65['options']);return db[_0x4f6b('0xc9')][_0x4f6b('0x27')]({'where':_0x3c6f2e[_0x4f6b('0x51')]})['then'](function(_0x544a53){_0x3b1f17[_0x4f6b('0x27')]=_0x544a53;if(_0x243f65[_0x4f6b('0x48')][_0x4f6b('0xcb')]){_0x3c6f2e['include']=[{'all':!![]}];}return db[_0x4f6b('0xc9')][_0x4f6b('0xcc')](_0x3c6f2e);})[_0x4f6b('0x38')](function(_0x1bf9f5){_0x3b1f17[_0x4f6b('0xbe')]=_0x1bf9f5;return _0x3b1f17;});}})[_0x4f6b('0x38')](respondWithFilteredResult(_0x11fad7,_0x3c6f2e))[_0x4f6b('0x39')](handleError(_0x11fad7,null));};exports[_0x4f6b('0xcd')]=function(_0x50c87e,_0x35754f,_0x4807e6){return db[_0x4f6b('0x43')]['find']({'where':{'id':_0x50c87e['params']['id']}})['then'](handleEntityNotFound(_0x35754f,null))[_0x4f6b('0x38')](function(_0x206460){if(_0x206460){return _0x206460[_0x4f6b('0xce')](_0x50c87e[_0x4f6b('0x7e')][_0x4f6b('0xc6')],_['omit'](_0x50c87e[_0x4f6b('0x7e')],['ids','id'])||{})[_0x4f6b('0xcf')](function(){return db['Tag'][_0x4f6b('0xcc')]({'attributes':['id','name',_0x4f6b('0x55')],'where':{'id':_0x50c87e[_0x4f6b('0x7e')]['ids']}});})[_0x4f6b('0x38')](function(_0x51424c){socket['emit'](_0x4f6b('0xd0'),{'id':Number(_0x50c87e[_0x4f6b('0xc0')]['id']),'tags':_0x51424c||[]});return{'id':Number(_0x50c87e[_0x4f6b('0xc0')]['id']),'tags':_0x51424c||[]};});}})[_0x4f6b('0x38')](respondWithResult(_0x35754f,null))[_0x4f6b('0x39')](handleError(_0x35754f,null));};exports['removeTags']=function(_0x353673,_0x47fbea,_0x3c2650){return db['OpenchannelInteraction'][_0x4f6b('0x6a')]({'where':{'id':_0x353673[_0x4f6b('0xc0')]['id']}})['then'](handleEntityNotFound(_0x47fbea,null))[_0x4f6b('0x38')](function(_0x17598f){if(_0x17598f){return _0x17598f[_0x4f6b('0xd1')](_0x353673[_0x4f6b('0x48')][_0x4f6b('0xc6')]);}})[_0x4f6b('0x38')](respondWithStatusCode(_0x47fbea,null))[_0x4f6b('0x39')](handleError(_0x47fbea,null));};exports[_0x4f6b('0xd2')]=function(_0x3ba9d3,_0x29e078){var _0x16320e=moment()['unix']()['toString']();var _0x5efd13=path[_0x4f6b('0xd3')](config['root'],_0x4f6b('0xd4'),_0x4f6b('0xd5'),'tmp');var _0x2f28e9=path['join'](config['root'],_0x4f6b('0xd4'),'files',_0x4f6b('0xd6'));var _0x321cde=path['join'](_0x5efd13,_0x16320e);var _0x189b0e=util['format'](_0x4f6b('0xd7'),_0x3ba9d3['params']['id'],_0x16320e);var _0x1c81c8=path['join'](_0x5efd13,_0x189b0e);var _0x21743b=[];_0x21743b[_0x4f6b('0x37')]({'model':db[_0x4f6b('0x7c')],'as':_0x4f6b('0x7c'),'attributes':['id','fullname'],'raw':!![]});_0x21743b[_0x4f6b('0x37')]({'model':db['CmContact'],'as':_0x4f6b('0x70'),'attributes':['id',_0x4f6b('0xd8'),_0x4f6b('0xd9')],'raw':!![]});if(_0x3ba9d3[_0x4f6b('0x48')]['attachments']){_0x21743b[_0x4f6b('0x37')]({'model':db['Attachment'],'as':'Attachment','raw':!![]});}var _0x45c724=[{'model':db[_0x4f6b('0xc9')],'as':'Messages','attributes':['id',_0x4f6b('0x7e'),'createdAt','direction',_0x4f6b('0xda'),_0x4f6b('0x8c')],'include':_0x21743b}];_0x45c724[_0x4f6b('0x37')]({'model':db[_0x4f6b('0xdb')],'as':'Account','attributes':['id',_0x4f6b('0x30')]});_0x45c724[_0x4f6b('0x37')]({'model':db[_0x4f6b('0x7c')],'as':_0x4f6b('0xdc'),'attributes':['id',_0x4f6b('0x32')]});return db[_0x4f6b('0x43')][_0x4f6b('0x6a')]({'where':{'id':_0x3ba9d3[_0x4f6b('0xc0')]['id']},'include':_0x45c724})[_0x4f6b('0x38')](handleEntityNotFound(_0x29e078,null))[_0x4f6b('0x38')](function(_0x45889a){if(_0x45889a){var _0x976a4f=_0x45889a['get']({'plain':!![]});fs['mkdirSync'](_0x321cde);var _0x2d0dec={'channel':'Openchannel','account':_0x976a4f[_0x4f6b('0xdd')][_0x4f6b('0x30')],'agent':_0x976a4f[_0x4f6b('0xdc')]?_0x976a4f[_0x4f6b('0xdc')][_0x4f6b('0x32')]:_0x4f6b('0xde'),'createdAt':moment(_0x976a4f['createdAt'])[_0x4f6b('0xca')](_0x4f6b('0xdf'))['toString'](),'closedAt':_0x976a4f['closed']?moment(_0x976a4f['closedAt'])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x4f6b('0xa4')]():'','disposition':_0x976a4f[_0x4f6b('0xe0')],'visibility':_0x976a4f[_0x4f6b('0xe1')]?'Public':'Private','messages':_(_0x976a4f[_0x4f6b('0xe2')])[_0x4f6b('0x91')]({'secret':![]})[_0x4f6b('0x42')](function(_0x33a40b){if(_0x33a40b[_0x4f6b('0xe3')]){var _0x1e8545=path[_0x4f6b('0xd3')](_0x2f28e9,_0x33a40b['Attachment'][_0x4f6b('0xe4')]);if(fs[_0x4f6b('0xe5')](_0x1e8545)){fs['createReadStream'](_0x1e8545)['pipe'](fs[_0x4f6b('0xe6')](path[_0x4f6b('0xd3')](_0x321cde,_0x33a40b[_0x4f6b('0xe3')][_0x4f6b('0xe4')])));}}return{'date':moment(_0x33a40b[_0x4f6b('0x84')])[_0x4f6b('0xca')](_0x4f6b('0xdf'))['toString'](),'sender':_0x33a40b[_0x4f6b('0xe7')]===_0x4f6b('0xe8')?_0x33a40b[_0x4f6b('0x7c')]?_0x33a40b['User']['fullname']:_0x4f6b('0xe9'):_0x33a40b[_0x4f6b('0x70')][_0x4f6b('0xd8')]+(_0x33a40b[_0x4f6b('0x70')][_0x4f6b('0xd9')]?'\x20'+_0x33a40b[_0x4f6b('0x70')][_0x4f6b('0xd9')]:''),'body':_0x33a40b[_0x4f6b('0xe3')]?_0x33a40b[_0x4f6b('0xe3')][_0x4f6b('0xe4')]:_0x33a40b[_0x4f6b('0x7e')],'direction':_0x33a40b['direction']==='out'?'A':'C','secret':_0x33a40b[_0x4f6b('0xda')],'read':_0x33a40b[_0x4f6b('0x8c')],'attachment':_0x33a40b[_0x4f6b('0xe3')]};})['value']()};return ejs['renderFile'](path[_0x4f6b('0xd3')](config[_0x4f6b('0xea')],'server','views','downloadInteraction.ejs'),{'interaction':_0x2d0dec})[_0x4f6b('0x38')](function(_0x54922c){var _0x2b3a68=path[_0x4f6b('0xd3')](_0x321cde,_0x4f6b('0xeb')+_0x976a4f['id']+'-'+_0x16320e+_0x4f6b('0xec'));var _0x3bd6d7={'path':_0x2b3a68,'channel':_0x4f6b('0xed'),'interactionId':_0x976a4f['id']};return pdf[_0x4f6b('0xee')](_0x54922c,_0x3bd6d7);})[_0x4f6b('0x38')](function(){return new BPromise(function(_0x49051c,_0x136cdc){zipdir(_0x321cde,{'saveTo':_0x1c81c8},function(_0x12f692,_0x33ad64){if(_0x12f692)return _0x136cdc(_0x12f692);return _0x49051c(_0x33ad64);});})[_0x4f6b('0x38')](function(){return new BPromise(function(_0x127527,_0x5a0f8a){rimraf(_0x321cde,function(_0x3c0a5a){if(_0x3c0a5a)_0x5a0f8a(_0x3c0a5a);return _0x127527();});});})[_0x4f6b('0x38')](function(){return _0x29e078[_0x4f6b('0xd2')](_0x1c81c8,_0x189b0e,function(_0x69cdce){if(_0x69cdce){console[_0x4f6b('0xef')]('err',_0x69cdce);}else{fs[_0x4f6b('0xf0')](_0x1c81c8);}});});});}else{return _0x29e078[_0x4f6b('0xf1')](0xc8);}})['catch'](handleError(_0x29e078,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index ee5e011..48171fe 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 _0xcf33=['exports','events','OpenchannelInteraction','../../mysqldb','OpenchannelMessage','setMaxListeners','save','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','emit','catch','hasOwnProperty','hook'];(function(_0x120ce0,_0x445485){var _0x236062=function(_0x4fc7e6){while(--_0x4fc7e6){_0x120ce0['push'](_0x120ce0['shift']());}};_0x236062(++_0x445485);}(_0xcf33,0x1dc));var _0x3cf3=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xcf33[_0x4565bf];return _0x5610ba;};'use strict';var EventEmitter=require(_0x3cf3('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db'][_0x3cf3('0x1')];var OpenchannelMessage=require(_0x3cf3('0x2'))['db'][_0x3cf3('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x3cf3('0x4')](0x0);var events={'afterCreate':_0x3cf3('0x5'),'afterUpdate':'update','afterDestroy':_0x3cf3('0x6')};function emitEvent(_0xdb9d52){return function(_0x435ef9,_0x3a37d2,_0x46c498){_0x435ef9[_0x3cf3('0x7')]({'attributes':['id'],'raw':!![]})[_0x3cf3('0x8')](function(_0xba9522){_0x435ef9[_0x3cf3('0x9')](_0x3cf3('0xa'),_0xba9522[_0x3cf3('0xb')](function(_0x4b7274){return{'id':_0x4b7274['id']};}));return OpenchannelMessage[_0x3cf3('0xc')]({'where':{'OpenchannelInteractionId':_0x435ef9['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x5b09ad){_0x435ef9['setDataValue'](_0x3cf3('0xd'),_0x5b09ad['length']);OpenchannelInteractionEvents[_0x3cf3('0xe')](_0xdb9d52+':'+_0x435ef9['id'],_0x435ef9);OpenchannelInteractionEvents[_0x3cf3('0xe')](_0xdb9d52,_0x435ef9);_0x46c498(null);})[_0x3cf3('0xf')](_0x46c498(null));};}for(var e in events){if(events[_0x3cf3('0x10')](e)){var event=events[e];OpenchannelInteraction[_0x3cf3('0x11')](e,emitEvent(event));}}module[_0x3cf3('0x12')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x5c9e=['remove','getUsers','setDataValue','Users','map','then','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelMessage','setMaxListeners','update'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x5c9e,0x67));var _0xe5c9=function(_0x134557,_0x57e6ff){_0x134557=_0x134557-0x0;var _0x5df218=_0x5c9e[_0x134557];return _0x5df218;};'use strict';var EventEmitter=require(_0xe5c9('0x0'));var OpenchannelInteraction=require(_0xe5c9('0x1'))['db']['OpenchannelInteraction'];var OpenchannelMessage=require(_0xe5c9('0x1'))['db'][_0xe5c9('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xe5c9('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe5c9('0x4'),'afterDestroy':_0xe5c9('0x5')};function emitEvent(_0x5beb96){return function(_0x1d06e6,_0x271096,_0x241ed3){_0x1d06e6[_0xe5c9('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x471fdd){_0x1d06e6[_0xe5c9('0x7')](_0xe5c9('0x8'),_0x471fdd[_0xe5c9('0x9')](function(_0x443aa8){return{'id':_0x443aa8['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x1d06e6['id'],'direction':'in','read':![]},'raw':!![]});})[_0xe5c9('0xa')](function(_0x364708){_0x1d06e6[_0xe5c9('0x7')](_0xe5c9('0xb'),_0x364708[_0xe5c9('0xc')]);OpenchannelInteractionEvents[_0xe5c9('0xd')](_0x5beb96+':'+_0x1d06e6['id'],_0x1d06e6);OpenchannelInteractionEvents[_0xe5c9('0xd')](_0x5beb96,_0x1d06e6);_0x241ed3(null);})[_0xe5c9('0xe')](_0x241ed3(null));};}for(var e in events){if(events[_0xe5c9('0xf')](e)){var event=events[e];OpenchannelInteraction[_0xe5c9('0x10')](e,emitEvent(event));}}module[_0xe5c9('0x11')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 4b41da7..f14f151 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 _0x323f=['rimraf','../../config/environment','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','api','moment','bluebird','request-promise','path'];(function(_0x159eab,_0x22d972){var _0x47e933=function(_0x58e802){while(--_0x58e802){_0x159eab['push'](_0x159eab['shift']());}};_0x47e933(++_0x22d972);}(_0x323f,0x1ee));var _0xf323=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x323f[_0x1facfa];return _0x9ec701;};'use strict';var _=require('lodash');var util=require(_0xf323('0x0'));var logger=require('../../config/logger')(_0xf323('0x1'));var moment=require(_0xf323('0x2'));var BPromise=require(_0xf323('0x3'));var rp=require(_0xf323('0x4'));var fs=require('fs');var path=require(_0xf323('0x5'));var rimraf=require(_0xf323('0x6'));var config=require(_0xf323('0x7'));var attributes=require(_0xf323('0x8'));module[_0xf323('0x9')]=function(_0x371707,_0x5d7d60){return _0x371707[_0xf323('0xa')](_0xf323('0xb'),attributes,{'tableName':_0xf323('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf323('0xd'),'collate':_0xf323('0xe'),'hooks':{'beforeUpdate':function(_0x3c416a,_0x105b93,_0x2b24a2){if(_0x3c416a[_0xf323('0xf')](_0xf323('0x10'))){_0x3c416a[_0xf323('0x11')]=moment()[_0xf323('0x12')](_0xf323('0x13'));}_0x2b24a2(null,_0x3c416a);}}});}; \ No newline at end of file +var _0xbc4c=['api','moment','bluebird','path','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','define','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger'];(function(_0x299d14,_0x1901ce){var _0x20a659=function(_0x4f03c5){while(--_0x4f03c5){_0x299d14['push'](_0x299d14['shift']());}};_0x20a659(++_0x1901ce);}(_0xbc4c,0x1b2));var _0xcbc4=function(_0x5a9c0c,_0x4ec485){_0x5a9c0c=_0x5a9c0c-0x0;var _0x53c77d=_0xbc4c[_0x5a9c0c];return _0x53c77d;};'use strict';var _=require(_0xcbc4('0x0'));var util=require(_0xcbc4('0x1'));var logger=require(_0xcbc4('0x2'))(_0xcbc4('0x3'));var moment=require(_0xcbc4('0x4'));var BPromise=require(_0xcbc4('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcbc4('0x6'));var rimraf=require(_0xcbc4('0x7'));var config=require(_0xcbc4('0x8'));var attributes=require(_0xcbc4('0x9'));module[_0xcbc4('0xa')]=function(_0x23301d,_0x316f36){return _0x23301d[_0xcbc4('0xb')]('OpenchannelInteraction',attributes,{'tableName':_0xcbc4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xcbc4('0xd'),'collate':_0xcbc4('0xe'),'hooks':{'beforeUpdate':function(_0x33081a,_0x521040,_0x4b6a32){if(_0x33081a[_0xcbc4('0xf')](_0xcbc4('0x10'))){_0x33081a[_0xcbc4('0x11')]=moment()['format'](_0xcbc4('0x12'));}_0x4b6a32(null,_0x33081a);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 6d94b8e..319fb08 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 _0xbdef=['http','redis','socket.io-emitter','register','request','then','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','error','code','message','info','result','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','raw','where','limit','stringify','AddTagsToOpenchannelInteraction','find','addTags','ids','omit','spread','AddTags','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x13250b,_0x1db5d7){var _0x2d0e53=function(_0x59db27){while(--_0x59db27){_0x13250b['push'](_0x13250b['shift']());}};_0x2d0e53(++_0x1db5d7);}(_0xbdef,0x1a3));var _0xfbde=function(_0x41348e,_0x2d14a2){_0x41348e=_0x41348e-0x0;var _0x27891e=_0xbdef[_0x41348e];return _0x27891e;};'use strict';var _=require(_0xfbde('0x0'));var util=require(_0xfbde('0x1'));var moment=require(_0xfbde('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfbde('0x3'));var db=require(_0xfbde('0x4'))['db'];var utils=require(_0xfbde('0x5'));var logger=require(_0xfbde('0x6'))(_0xfbde('0x7'));var config=require(_0xfbde('0x8'));var jayson=require(_0xfbde('0x9'));var client=jayson[_0xfbde('0xa')][_0xfbde('0xb')]({'port':0x232a});config[_0xfbde('0xc')]=_['defaults'](config[_0xfbde('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xfbde('0xd'))(new Redis(config[_0xfbde('0xc')]));require('./openchannelInteraction.socket')[_0xfbde('0xe')](socket);function respondWithRpcPromise(_0x36dcc0,_0x4836b7,_0x2b3d9b){return new BPromise(function(_0x19f7c0,_0x2b1bd6){return client[_0xfbde('0xf')](_0x36dcc0,_0x2b3d9b)[_0xfbde('0x10')](function(_0x1ac8dc){logger['info'](_0xfbde('0x11'),_0x4836b7,_0xfbde('0x12'));logger[_0xfbde('0x13')](_0xfbde('0x14'),_0x4836b7,'request\x20sent',JSON['stringify'](_0x1ac8dc));if(_0x1ac8dc[_0xfbde('0x15')]){if(_0x1ac8dc['error'][_0xfbde('0x16')]===0x1f4){logger['error'](_0xfbde('0x11'),_0x4836b7,_0x1ac8dc[_0xfbde('0x15')]['message']);return _0x2b1bd6(_0x1ac8dc[_0xfbde('0x15')][_0xfbde('0x17')]);}logger[_0xfbde('0x15')]('OpenchannelInteraction,\x20%s,\x20%s',_0x4836b7,_0x1ac8dc[_0xfbde('0x15')][_0xfbde('0x17')]);return _0x19f7c0(_0x1ac8dc[_0xfbde('0x15')][_0xfbde('0x17')]);}else{logger[_0xfbde('0x18')](_0xfbde('0x11'),_0x4836b7,_0xfbde('0x12'));_0x19f7c0(_0x1ac8dc[_0xfbde('0x19')][_0xfbde('0x17')]);}})['catch'](function(_0x2f7618){logger[_0xfbde('0x15')]('OpenchannelInteraction,\x20%s,\x20%s',_0x4836b7,_0x2f7618);_0x2b1bd6(_0x2f7618);});});}exports[_0xfbde('0x1a')]=function(_0x401274){var _0x2fc055=this;return new Promise(function(_0x4ab321,_0x9e1d5e){return db[_0xfbde('0x1b')][_0xfbde('0x1c')](_0x401274[_0xfbde('0x1d')],{'raw':_0x401274[_0xfbde('0x1e')]?_0x401274['options'][_0xfbde('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x401274['options']?_0x401274[_0xfbde('0x1e')][_0xfbde('0x20')]||null:null,'attributes':_0x401274['options']?_0x401274[_0xfbde('0x1e')]['attributes']||null:null,'limit':_0x401274[_0xfbde('0x1e')]?_0x401274[_0xfbde('0x1e')][_0xfbde('0x21')]||null:null})['then'](function(_0x3125fa){logger[_0xfbde('0x18')](_0xfbde('0x1a'),_0x401274);logger[_0xfbde('0x13')](_0xfbde('0x1a'),_0x401274,JSON[_0xfbde('0x22')](_0x3125fa));_0x4ab321(_0x3125fa);})['catch'](function(_0x6bdc0c){logger['error'](_0xfbde('0x1a'),_0x6bdc0c['message'],_0x401274);_0x9e1d5e(_0x2fc055['error'](0x1f4,_0x6bdc0c[_0xfbde('0x17')]));});});};exports[_0xfbde('0x23')]=function(_0x52ea7b){return new Promise(function(_0x4e280f,_0x559a69){return db['OpenchannelInteraction'][_0xfbde('0x24')]({'where':_0x52ea7b[_0xfbde('0x1e')]?_0x52ea7b[_0xfbde('0x1e')][_0xfbde('0x20')]||null:null})[_0xfbde('0x10')](function(_0x1be7fd){if(_0x1be7fd){return _0x1be7fd[_0xfbde('0x25')](_0x52ea7b[_0xfbde('0x1d')][_0xfbde('0x26')],_[_0xfbde('0x27')](_0x52ea7b['body'],[_0xfbde('0x26'),'id'])||{});}})[_0xfbde('0x28')](function(_0x1e6a25){logger[_0xfbde('0x18')](_0xfbde('0x29'),_0x52ea7b);logger[_0xfbde('0x13')](_0xfbde('0x29'),_0x52ea7b,JSON[_0xfbde('0x22')](_0x1e6a25));_0x4e280f(_0x1e6a25);})[_0xfbde('0x2a')](function(_0x393199){logger[_0xfbde('0x15')]('AddTags',_0x393199['message'],_0x52ea7b);_0x559a69(_this['error'](0x1f4,_0x393199['message']));});});}; \ No newline at end of file +var _0xcbe2=['socket.io-emitter','./openchannelInteraction.socket','then','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','raw','attributes','limit','info','find','where','addTags','ids','spread','AddTags','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost'];(function(_0x59985f,_0x4f3ba2){var _0x2f9260=function(_0x56f540){while(--_0x56f540){_0x59985f['push'](_0x59985f['shift']());}};_0x2f9260(++_0x4f3ba2);}(_0xcbe2,0x13a));var _0x2cbe=function(_0x54a1ef,_0x225d1b){_0x54a1ef=_0x54a1ef-0x0;var _0x4c5626=_0xcbe2[_0x54a1ef];return _0x4c5626;};'use strict';var _=require(_0x2cbe('0x0'));var util=require(_0x2cbe('0x1'));var moment=require(_0x2cbe('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2cbe('0x3'));var db=require(_0x2cbe('0x4'))['db'];var utils=require(_0x2cbe('0x5'));var logger=require(_0x2cbe('0x6'))(_0x2cbe('0x7'));var config=require(_0x2cbe('0x8'));var jayson=require(_0x2cbe('0x9'));var client=jayson[_0x2cbe('0xa')][_0x2cbe('0xb')]({'port':0x232a});config[_0x2cbe('0xc')]=_['defaults'](config['redis'],{'host':_0x2cbe('0xd'),'port':0x18eb});var socket=require(_0x2cbe('0xe'))(new Redis(config[_0x2cbe('0xc')]));require(_0x2cbe('0xf'))['register'](socket);function respondWithRpcPromise(_0x1732f3,_0x544c2d,_0x63b3fe){return new BPromise(function(_0xd38d9,_0x5a24e5){return client['request'](_0x1732f3,_0x63b3fe)[_0x2cbe('0x10')](function(_0x126486){logger['info'](_0x2cbe('0x11'),_0x544c2d,_0x2cbe('0x12'));logger[_0x2cbe('0x13')](_0x2cbe('0x14'),_0x544c2d,_0x2cbe('0x12'),JSON[_0x2cbe('0x15')](_0x126486));if(_0x126486['error']){if(_0x126486[_0x2cbe('0x16')][_0x2cbe('0x17')]===0x1f4){logger['error'](_0x2cbe('0x11'),_0x544c2d,_0x126486[_0x2cbe('0x16')][_0x2cbe('0x18')]);return _0x5a24e5(_0x126486['error'][_0x2cbe('0x18')]);}logger[_0x2cbe('0x16')](_0x2cbe('0x11'),_0x544c2d,_0x126486[_0x2cbe('0x16')]['message']);return _0xd38d9(_0x126486[_0x2cbe('0x16')]['message']);}else{logger['info'](_0x2cbe('0x11'),_0x544c2d,_0x2cbe('0x12'));_0xd38d9(_0x126486['result']['message']);}})[_0x2cbe('0x19')](function(_0x98975){logger[_0x2cbe('0x16')](_0x2cbe('0x11'),_0x544c2d,_0x98975);_0x5a24e5(_0x98975);});});}exports[_0x2cbe('0x1a')]=function(_0x6010c9){var _0x34a404=this;return new Promise(function(_0x532128,_0x5856e2){return db[_0x2cbe('0x1b')][_0x2cbe('0x1c')](_0x6010c9[_0x2cbe('0x1d')],{'raw':_0x6010c9[_0x2cbe('0x1e')]?_0x6010c9[_0x2cbe('0x1e')][_0x2cbe('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x6010c9[_0x2cbe('0x1e')]?_0x6010c9[_0x2cbe('0x1e')]['where']||null:null,'attributes':_0x6010c9[_0x2cbe('0x1e')]?_0x6010c9[_0x2cbe('0x1e')][_0x2cbe('0x20')]||null:null,'limit':_0x6010c9[_0x2cbe('0x1e')]?_0x6010c9[_0x2cbe('0x1e')][_0x2cbe('0x21')]||null:null})[_0x2cbe('0x10')](function(_0x5c1402){logger[_0x2cbe('0x22')]('UpdateOpenchannelInteraction',_0x6010c9);logger['debug']('UpdateOpenchannelInteraction',_0x6010c9,JSON[_0x2cbe('0x15')](_0x5c1402));_0x532128(_0x5c1402);})[_0x2cbe('0x19')](function(_0x213ed9){logger[_0x2cbe('0x16')](_0x2cbe('0x1a'),_0x213ed9[_0x2cbe('0x18')],_0x6010c9);_0x5856e2(_0x34a404['error'](0x1f4,_0x213ed9[_0x2cbe('0x18')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x3679d2){return new Promise(function(_0x2b0566,_0x159838){return db['OpenchannelInteraction'][_0x2cbe('0x23')]({'where':_0x3679d2['options']?_0x3679d2[_0x2cbe('0x1e')][_0x2cbe('0x24')]||null:null})[_0x2cbe('0x10')](function(_0x46d3aa){if(_0x46d3aa){return _0x46d3aa[_0x2cbe('0x25')](_0x3679d2[_0x2cbe('0x1d')][_0x2cbe('0x26')],_['omit'](_0x3679d2[_0x2cbe('0x1d')],[_0x2cbe('0x26'),'id'])||{});}})[_0x2cbe('0x27')](function(_0x416fd5){logger['info']('AddTags',_0x3679d2);logger[_0x2cbe('0x13')](_0x2cbe('0x28'),_0x3679d2,JSON[_0x2cbe('0x15')](_0x416fd5));_0x2b0566(_0x416fd5);})['catch'](function(_0x23cd80){logger[_0x2cbe('0x16')](_0x2cbe('0x28'),_0x23cd80[_0x2cbe('0x18')],_0x3679d2);_0x159838(_this[_0x2cbe('0x16')](0x1f4,_0x23cd80[_0x2cbe('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 83161f2..c879bc4 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 _0x59c7=['remove','update','removeListener','openchannelInteraction:','./openchannelInteraction.events','save'];(function(_0x28732e,_0x4d734a){var _0x45bc15=function(_0xd21122){while(--_0xd21122){_0x28732e['push'](_0x28732e['shift']());}};_0x45bc15(++_0x4d734a);}(_0x59c7,0x1c6));var _0x759c=function(_0x2edd80,_0xfb96bb){_0x2edd80=_0x2edd80-0x0;var _0x10f6df=_0x59c7[_0x2edd80];return _0x10f6df;};'use strict';var OpenchannelInteractionEvents=require(_0x759c('0x0'));var events=[_0x759c('0x1'),_0x759c('0x2'),_0x759c('0x3')];function createListener(_0x54ebbc,_0x37cb98){return function(_0x4c42fa){_0x37cb98['emit'](_0x54ebbc,_0x4c42fa);};}function removeListener(_0xa179ca,_0x392096){return function(){OpenchannelInteractionEvents[_0x759c('0x4')](_0xa179ca,_0x392096);};}exports['register']=function(_0x210902){for(var _0x6df109=0x0,_0x92a556=events['length'];_0x6df109<_0x92a556;_0x6df109++){var _0x5a7ce5=events[_0x6df109];var _0x4bc777=createListener(_0x759c('0x5')+_0x5a7ce5,_0x210902);OpenchannelInteractionEvents['on'](_0x5a7ce5,_0x4bc777);}}; \ No newline at end of file +var _0x3a81=['length','openchannelInteraction:','./openchannelInteraction.events','save','remove','update','emit','removeListener','register'];(function(_0xdc1a85,_0x396464){var _0xa3a9b6=function(_0x326317){while(--_0x326317){_0xdc1a85['push'](_0xdc1a85['shift']());}};_0xa3a9b6(++_0x396464);}(_0x3a81,0x18e));var _0x13a8=function(_0x6d394d,_0x185b80){_0x6d394d=_0x6d394d-0x0;var _0x1f0621=_0x3a81[_0x6d394d];return _0x1f0621;};'use strict';var OpenchannelInteractionEvents=require(_0x13a8('0x0'));var events=[_0x13a8('0x1'),_0x13a8('0x2'),_0x13a8('0x3')];function createListener(_0x4b9b95,_0x3da69b){return function(_0x177d90){_0x3da69b[_0x13a8('0x4')](_0x4b9b95,_0x177d90);};}function removeListener(_0x5ec9a9,_0x540d69){return function(){OpenchannelInteractionEvents[_0x13a8('0x5')](_0x5ec9a9,_0x540d69);};}exports[_0x13a8('0x6')]=function(_0x41c7d5){for(var _0x42ee7a=0x0,_0x451e2b=events[_0x13a8('0x7')];_0x42ee7a<_0x451e2b;_0x42ee7a++){var _0x529e0d=events[_0x42ee7a];var _0x29ccb6=createListener(_0x13a8('0x8')+_0x529e0d,_0x41c7d5);OpenchannelInteractionEvents['on'](_0x529e0d,_0x29ccb6);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 3fa0746..7d51505 100644 --- a/server/api/openchannelMessage/index.js +++ b/server/api/openchannelMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['index','get','/describe','/:id','show','tracked','openchannel','create','put','update','accept','/:id/reject','reject','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./openchannelMessage.controller','isAuthenticated'];(function(_0x5e84cd,_0xb0d9f3){var _0xafd3e6=function(_0x2babeb){while(--_0x2babeb){_0x5e84cd['push'](_0x5e84cd['shift']());}};_0xafd3e6(++_0xb0d9f3);}(_0x9c44,0x178));var _0x49c4=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0x9c44[_0x4d613c];return _0x301fe3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x49c4('0x6'));router['get']('/',auth[_0x49c4('0x7')](),controller[_0x49c4('0x8')]);router[_0x49c4('0x9')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller['describe']);router[_0x49c4('0x9')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0xc')]);router['post']('/',auth['isAuthenticated'](),interaction[_0x49c4('0xd')](_0x49c4('0xe'),'openchannelmessage:create'),controller[_0x49c4('0xf')]);router[_0x49c4('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x49c4('0x11')]);router[_0x49c4('0x10')]('/:id/accept',auth[_0x49c4('0x7')](),controller[_0x49c4('0x12')]);router['put'](_0x49c4('0x13'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x14')]);router[_0x49c4('0x15')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x16')]);module[_0x49c4('0x17')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','tracked','openchannel','openchannelmessage:create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util'];(function(_0x422994,_0x99047b){var _0x43ad8f=function(_0x5ae30d){while(--_0x5ae30d){_0x422994['push'](_0x422994['shift']());}};_0x43ad8f(++_0x99047b);}(_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('./openchannelMessage.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),interaction[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x0d8b('0x10')),controller['create']);router[_0x0d8b('0x11')]('/:id',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x12')]);router[_0x0d8b('0x11')](_0x0d8b('0x13'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x14')]);router[_0x0d8b('0x11')](_0x0d8b('0x15'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x16')]);router[_0x0d8b('0x17')](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index ebfdc17..30cb495 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 _0x8383=['sequelize','medium','BOOLEAN','ENUM','out','DATE','STRING','TEXT'];(function(_0x3872df,_0x1c56a3){var _0x43bf44=function(_0x1dca13){while(--_0x1dca13){_0x3872df['push'](_0x3872df['shift']());}};_0x43bf44(++_0x1c56a3);}(_0x8383,0x98));var _0x3838=function(_0x5d145f,_0x5a789b){_0x5d145f=_0x5d145f-0x0;var _0x44a343=_0x8383[_0x5d145f];return _0x44a343;};'use strict';var Sequelize=require(_0x3838('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0x3838('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x3838('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0x3838('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x3838('0x3')]('in',_0x3838('0x4')),'defaultValue':_0x3838('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0x3838('0x5')]},'providerName':{'type':Sequelize[_0x3838('0x6')]},'providerResponse':{'type':Sequelize[_0x3838('0x7')]}}; \ No newline at end of file +var _0x1678=['out','DATE','STRING','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x5ac091,_0x3bd473){var _0x2da2c3=function(_0x11644f){while(--_0x11644f){_0x5ac091['push'](_0x5ac091['shift']());}};_0x2da2c3(++_0x3bd473);}(_0x1678,0x17b));var _0x8167=function(_0x2f65d0,_0x54797b){_0x2f65d0=_0x2f65d0-0x0;var _0x5c02c5=_0x1678[_0x2f65d0];return _0x5c02c5;};'use strict';var Sequelize=require(_0x8167('0x0'));module[_0x8167('0x1')]={'body':{'type':Sequelize[_0x8167('0x2')](_0x8167('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x8167('0x4')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x8167('0x5')),'defaultValue':_0x8167('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x8167('0x6')]},'providerName':{'type':Sequelize[_0x8167('0x7')]},'providerResponse':{'type':Sequelize[_0x8167('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 8a747ac..a53af6b 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 _0xcd3b=['length','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','find','create','body','describe','openchannel-interactions','accept','openchannel','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','read1stAt','interaction','get','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','QueryTypes','SELECT','contact','User','agent','fullname','email','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','OpenchannelInteraction','OpenchannelInteractionId','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','sequelize','internal','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','jayson/promise','http','client','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','update','destroy','stack','name','send','index','map','OpenchannelMessage','rawAttributes','fieldName','type','key','model','filters','intersection','query','attributes'];(function(_0x4fcbbe,_0x55a068){var _0x2ac729=function(_0x44aa09){while(--_0x44aa09){_0x4fcbbe['push'](_0x4fcbbe['shift']());}};_0x2ac729(++_0x55a068);}(_0xcd3b,0x145));var _0xbcd3=function(_0x3657bd,_0x10afb8){_0x3657bd=_0x3657bd-0x0;var _0x4f808a=_0xcd3b[_0x3657bd];return _0x4f808a;};'use strict';var emlformat=require(_0xbcd3('0x0'));var rimraf=require(_0xbcd3('0x1'));var zipdir=require(_0xbcd3('0x2'));var jsonpatch=require(_0xbcd3('0x3'));var rp=require(_0xbcd3('0x4'));var moment=require(_0xbcd3('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xbcd3('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xbcd3('0x7'));var ejs=require(_0xbcd3('0x8'));var fs=require('fs');var fs_extra=require(_0xbcd3('0x9'));var _=require(_0xbcd3('0xa'));var squel=require(_0xbcd3('0xb'));var crypto=require(_0xbcd3('0xc'));var jsforce=require(_0xbcd3('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xbcd3('0x7'));var querystring=require(_0xbcd3('0xe'));var Papa=require(_0xbcd3('0xf'));var Redis=require(_0xbcd3('0x10'));var authService=require(_0xbcd3('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xbcd3('0x12'));var hardwareService=require(_0xbcd3('0x13'));var logger=require(_0xbcd3('0x14'))(_0xbcd3('0x15'));var utils=require(_0xbcd3('0x16'));var config=require(_0xbcd3('0x17'));var licenseUtil=require(_0xbcd3('0x18'));var db=require(_0xbcd3('0x19'))['db'];config[_0xbcd3('0x1a')]=_[_0xbcd3('0x1b')](config[_0xbcd3('0x1a')],{'host':_0xbcd3('0x1c'),'port':0x18eb});var socket=require(_0xbcd3('0x1d'))(new Redis(config[_0xbcd3('0x1a')]));require(_0xbcd3('0x1e'))['register'](socket);var jayson=require(_0xbcd3('0x1f'));var client=jayson['client'][_0xbcd3('0x20')]({'port':0x232c});var client9002=jayson[_0xbcd3('0x21')][_0xbcd3('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x5e4ac8,_0x27dbfc,_0x2a0b6a,_0x2ad7e6){return new BPromise(function(_0x3387fc,_0x2adb52){var _0x24051f=_0x2ad7e6||client;return _0x24051f[_0xbcd3('0x22')](_0x5e4ac8,_0x2a0b6a)[_0xbcd3('0x23')](function(_0x202981){logger[_0xbcd3('0x24')](_0xbcd3('0x25'),_0x27dbfc,_0xbcd3('0x26'));logger[_0xbcd3('0x27')](_0xbcd3('0x28'),_0x27dbfc,'request\x20sent',JSON['stringify'](_0x202981));if(_0x202981[_0xbcd3('0x29')]){if(_0x202981[_0xbcd3('0x29')][_0xbcd3('0x2a')]===0x1f4){logger['error'](_0xbcd3('0x25'),_0x27dbfc,_0x202981[_0xbcd3('0x29')]['message']);return _0x2adb52(_0x202981['error']['message']);}logger[_0xbcd3('0x29')](_0xbcd3('0x25'),_0x27dbfc,_0x202981[_0xbcd3('0x29')][_0xbcd3('0x2b')]);return _0x3387fc(_0x202981[_0xbcd3('0x29')][_0xbcd3('0x2b')]);}else{logger[_0xbcd3('0x24')]('OpenchannelMessage,\x20%s,\x20%s',_0x27dbfc,'request\x20sent');_0x3387fc(_0x202981[_0xbcd3('0x2c')][_0xbcd3('0x2b')]);}})[_0xbcd3('0x2d')](function(_0x8017ab){logger[_0xbcd3('0x29')](_0xbcd3('0x25'),_0x27dbfc,_0x8017ab);_0x2adb52(_0x8017ab);});});}function respondWithStatusCode(_0x46e3e7,_0x232637){_0x232637=_0x232637||0xcc;return function(_0x18410){if(_0x18410){return _0x46e3e7[_0xbcd3('0x2e')](_0x232637);}return _0x46e3e7[_0xbcd3('0x2f')](_0x232637)[_0xbcd3('0x30')]();};}function respondWithResult(_0x2c13bf,_0x29935b){_0x29935b=_0x29935b||0xc8;return function(_0x11bf4f){if(_0x11bf4f){return _0x2c13bf[_0xbcd3('0x2f')](_0x29935b)[_0xbcd3('0x31')](_0x11bf4f);}};}function respondWithFilteredResult(_0xda1bbf,_0x571874){return function(_0x4a639d){if(_0x4a639d){var _0x219309=typeof _0x571874[_0xbcd3('0x32')]===_0xbcd3('0x33')&&typeof _0x571874['limit']===_0xbcd3('0x33');var _0x8e5a4=_0x4a639d[_0xbcd3('0x34')];var _0x3cbfc4=_0x219309?0x0:_0x571874[_0xbcd3('0x32')];var _0x4abe50=_0x219309?_0x4a639d[_0xbcd3('0x34')]:_0x571874[_0xbcd3('0x32')]+_0x571874[_0xbcd3('0x35')];var _0x45f40a;if(_0x4abe50>=_0x8e5a4){_0x4abe50=_0x8e5a4;_0x45f40a=0xc8;}else{_0x45f40a=0xce;}_0xda1bbf[_0xbcd3('0x2f')](_0x45f40a);return _0xda1bbf['set'](_0xbcd3('0x36'),_0x3cbfc4+'-'+_0x4abe50+'/'+_0x8e5a4)['json'](_0x4a639d);}return null;};}function patchUpdates(_0x40ed60){return function(_0x206a77){try{jsonpatch[_0xbcd3('0x37')](_0x206a77,_0x40ed60,!![]);}catch(_0x387b69){return BPromise[_0xbcd3('0x38')](_0x387b69);}return _0x206a77['save']();};}function saveUpdates(_0x3c00f1,_0x4eb6c5){return function(_0x43d551){if(_0x43d551){return _0x43d551[_0xbcd3('0x39')](_0x3c00f1)[_0xbcd3('0x23')](function(_0x8c2255){return _0x8c2255;});}return null;};}function removeEntity(_0x223834,_0x1876d1){return function(_0x51866a){if(_0x51866a){return _0x51866a[_0xbcd3('0x3a')]()[_0xbcd3('0x23')](function(){_0x223834[_0xbcd3('0x2f')](0xcc)[_0xbcd3('0x30')]();});}};}function handleEntityNotFound(_0x3f1ead,_0x90e55d){return function(_0x17e4f5){if(!_0x17e4f5){_0x3f1ead[_0xbcd3('0x2e')](0x194);}return _0x17e4f5;};}function handleError(_0x2a0653,_0xd249ec){_0xd249ec=_0xd249ec||0x1f4;return function(_0x4d18ea){logger[_0xbcd3('0x29')](_0x4d18ea[_0xbcd3('0x3b')]);if(_0x4d18ea[_0xbcd3('0x3c')]){delete _0x4d18ea[_0xbcd3('0x3c')];}_0x2a0653[_0xbcd3('0x2f')](_0xd249ec)[_0xbcd3('0x3d')](_0x4d18ea);};}exports[_0xbcd3('0x3e')]=function(_0x32cd0d,_0x20dd02){var _0x1ac999={},_0x4d41e3={},_0x543548={'count':0x0,'rows':[]};var _0xc56d5=_[_0xbcd3('0x3f')](db[_0xbcd3('0x40')][_0xbcd3('0x41')],function(_0x44c3ff){return{'name':_0x44c3ff[_0xbcd3('0x42')],'type':_0x44c3ff[_0xbcd3('0x43')][_0xbcd3('0x44')]};});_0x4d41e3[_0xbcd3('0x45')]=_[_0xbcd3('0x3f')](_0xc56d5,'name');_0x4d41e3['query']=_['keys'](_0x32cd0d['query']);_0x4d41e3[_0xbcd3('0x46')]=_[_0xbcd3('0x47')](_0x4d41e3[_0xbcd3('0x45')],_0x4d41e3[_0xbcd3('0x48')]);_0x1ac999[_0xbcd3('0x49')]=_[_0xbcd3('0x47')](_0x4d41e3[_0xbcd3('0x45')],qs['fields'](_0x32cd0d[_0xbcd3('0x48')]['fields']));_0x1ac999[_0xbcd3('0x49')]=_0x1ac999['attributes'][_0xbcd3('0x4a')]?_0x1ac999[_0xbcd3('0x49')]:_0x4d41e3[_0xbcd3('0x45')];if(!_0x32cd0d['query']['hasOwnProperty']('nolimit')){_0x1ac999[_0xbcd3('0x35')]=qs[_0xbcd3('0x35')](_0x32cd0d['query'][_0xbcd3('0x35')]);_0x1ac999[_0xbcd3('0x32')]=qs[_0xbcd3('0x32')](_0x32cd0d['query'][_0xbcd3('0x32')]);}_0x1ac999['order']=qs[_0xbcd3('0x4b')](_0x32cd0d[_0xbcd3('0x48')][_0xbcd3('0x4b')]);_0x1ac999[_0xbcd3('0x4c')]=qs['filters'](_[_0xbcd3('0x4d')](_0x32cd0d[_0xbcd3('0x48')],_0x4d41e3[_0xbcd3('0x46')]),_0xc56d5);if(_0x32cd0d['query'][_0xbcd3('0x4e')]){_0x1ac999[_0xbcd3('0x4c')]=_[_0xbcd3('0x4f')](_0x1ac999[_0xbcd3('0x4c')],{'$or':_[_0xbcd3('0x3f')](_0xc56d5,function(_0x3808a6){if(_0x3808a6['type']!==_0xbcd3('0x50')){var _0x39a673={};_0x39a673[_0x3808a6[_0xbcd3('0x3c')]]={'$like':'%'+_0x32cd0d[_0xbcd3('0x48')]['filter']+'%'};return _0x39a673;}})});}_0x1ac999=_['merge']({},_0x1ac999,_0x32cd0d[_0xbcd3('0x51')]);var _0x3a15c1={'where':_0x1ac999[_0xbcd3('0x4c')]};return db[_0xbcd3('0x40')][_0xbcd3('0x34')](_0x3a15c1)[_0xbcd3('0x23')](function(_0x1f2596){_0x543548[_0xbcd3('0x34')]=_0x1f2596;if(_0x32cd0d['query'][_0xbcd3('0x52')]){_0x1ac999[_0xbcd3('0x53')]=[{'all':!![]}];}return db[_0xbcd3('0x40')][_0xbcd3('0x54')](_0x1ac999);})[_0xbcd3('0x23')](function(_0x42d04a){_0x543548[_0xbcd3('0x55')]=_0x42d04a;return _0x543548;})[_0xbcd3('0x23')](respondWithFilteredResult(_0x20dd02,_0x1ac999))[_0xbcd3('0x2d')](handleError(_0x20dd02,null));};exports[_0xbcd3('0x56')]=function(_0x18fe2b,_0x92fe4){var _0x51e928={'raw':!![],'where':{'id':_0x18fe2b[_0xbcd3('0x57')]['id']}},_0x2c0195={};_0x2c0195[_0xbcd3('0x45')]=_[_0xbcd3('0x58')](db[_0xbcd3('0x40')][_0xbcd3('0x41')]);_0x2c0195[_0xbcd3('0x48')]=_[_0xbcd3('0x58')](_0x18fe2b[_0xbcd3('0x48')]);_0x2c0195[_0xbcd3('0x46')]=_[_0xbcd3('0x47')](_0x2c0195['model'],_0x2c0195[_0xbcd3('0x48')]);_0x51e928[_0xbcd3('0x49')]=_[_0xbcd3('0x47')](_0x2c0195[_0xbcd3('0x45')],qs['fields'](_0x18fe2b['query']['fields']));_0x51e928[_0xbcd3('0x49')]=_0x51e928[_0xbcd3('0x49')]['length']?_0x51e928[_0xbcd3('0x49')]:_0x2c0195[_0xbcd3('0x45')];if(_0x18fe2b['query'][_0xbcd3('0x52')]){_0x51e928[_0xbcd3('0x53')]=[{'all':!![]}];}_0x51e928=_[_0xbcd3('0x4f')]({},_0x51e928,_0x18fe2b[_0xbcd3('0x51')]);return db['OpenchannelMessage'][_0xbcd3('0x59')](_0x51e928)['then'](handleEntityNotFound(_0x92fe4,null))['then'](respondWithResult(_0x92fe4,null))[_0xbcd3('0x2d')](handleError(_0x92fe4,null));};exports[_0xbcd3('0x5a')]=function(_0x15eb58,_0x558fb0){return db['OpenchannelMessage'][_0xbcd3('0x5a')](_0x15eb58[_0xbcd3('0x5b')],{})['then'](respondWithResult(_0x558fb0,0xc9))[_0xbcd3('0x2d')](handleError(_0x558fb0,null));};exports['update']=function(_0x323d0e,_0x368506){if(_0x323d0e[_0xbcd3('0x5b')]['id']){delete _0x323d0e[_0xbcd3('0x5b')]['id'];}return db[_0xbcd3('0x40')][_0xbcd3('0x59')]({'where':{'id':_0x323d0e[_0xbcd3('0x57')]['id']}})[_0xbcd3('0x23')](handleEntityNotFound(_0x368506,null))[_0xbcd3('0x23')](saveUpdates(_0x323d0e[_0xbcd3('0x5b')],null))['then'](respondWithResult(_0x368506,null))[_0xbcd3('0x2d')](handleError(_0x368506,null));};exports[_0xbcd3('0x3a')]=function(_0x469c8e,_0x3daeb0){return db[_0xbcd3('0x40')][_0xbcd3('0x59')]({'where':{'id':_0x469c8e['params']['id']}})[_0xbcd3('0x23')](handleEntityNotFound(_0x3daeb0,null))[_0xbcd3('0x23')](removeEntity(_0x3daeb0,null))['catch'](handleError(_0x3daeb0,null));};exports[_0xbcd3('0x5c')]=function(_0x1870ef,_0x1e1141){return db[_0xbcd3('0x40')][_0xbcd3('0x5c')]()['then'](respondWithResult(_0x1e1141,null))['catch'](handleError(_0x1e1141,null));};var interaction_log=require(_0xbcd3('0x14'))(_0xbcd3('0x5d'));exports[_0xbcd3('0x5e')]=function(_0x2324b8,_0x805df4,_0x1e2eb9){var _0x2a4aba={'agent':{},'channel':_0xbcd3('0x5f')};if(_0x2324b8[_0xbcd3('0x5b')]['id']){delete _0x2324b8['body']['id'];}_0x2324b8['body']['read']=!![];_0x2324b8[_0xbcd3('0x5b')][_0xbcd3('0x60')]=moment()[_0xbcd3('0x61')](_0xbcd3('0x62'));_0x2324b8[_0xbcd3('0x5b')][_0xbcd3('0x63')]=_0x2324b8['body']['UserId']||_0x2324b8[_0xbcd3('0x64')]['id'];_0x2a4aba['agent']['id']=_0x2324b8[_0xbcd3('0x5b')]['UserId'];return db[_0xbcd3('0x40')][_0xbcd3('0x59')]({'where':{'id':_0x2324b8[_0xbcd3('0x57')]['id'],'UserId':null}})[_0xbcd3('0x23')](handleEntityNotFound(_0x805df4,null))[_0xbcd3('0x23')](saveUpdates(_0x2324b8[_0xbcd3('0x5b')],null))['then'](function(_0x2dd46a){if(_0x2dd46a){_0x2a4aba[_0xbcd3('0x2b')]=_0x2dd46a['get']({'plain':!![]});return db['OpenchannelInteraction'][_0xbcd3('0x59')]({'where':{'id':_0x2dd46a['OpenchannelInteractionId']}});}return null;})[_0xbcd3('0x23')](handleEntityNotFound(_0x805df4,null))[_0xbcd3('0x23')](function(_0x4fb211){if(_0x4fb211){return _0x4fb211[_0xbcd3('0x39')]({'UserId':_0x2324b8['body']['UserId'],'read1stAt':_['isNil'](_0x4fb211[_0xbcd3('0x65')])?moment()[_0xbcd3('0x61')](_0xbcd3('0x62')):undefined});}return null;})[_0xbcd3('0x23')](function(_0x3d3c87){if(_0x3d3c87){_0x2a4aba[_0xbcd3('0x66')]=_0x3d3c87[_0xbcd3('0x67')]({'plain':!![]});interaction_log[_0xbcd3('0x24')](_0xbcd3('0x68'),_0x2324b8['user']['id'],_0x2324b8[_0xbcd3('0x64')][_0xbcd3('0x3c')],_0x2324b8[_0xbcd3('0x64')][_0xbcd3('0x69')],_0x2a4aba[_0xbcd3('0x66')]['id'],_0x2324b8['body']?JSON[_0xbcd3('0x6a')](_0x2324b8[_0xbcd3('0x5b')]):_0xbcd3('0x6b'));return respondWithRpcPromise('AcceptMessage',_0xbcd3('0x6c'),_0x2a4aba);}return null;})[_0xbcd3('0x23')](function(_0x349472){var _0x312ee0=_0xbcd3('0x6d')+_0x349472[_0xbcd3('0x2b')][_0xbcd3('0x6e')];return db['sequelize'][_0xbcd3('0x48')](_0x312ee0,{'type':db['Sequelize'][_0xbcd3('0x6f')][_0xbcd3('0x70')],'raw':!![]})[_0xbcd3('0x23')](function(_0x31efcd){return _0x31efcd;});})[_0xbcd3('0x23')](function(_0x529422){if(_0x529422){_0x2a4aba['message'][_0xbcd3('0x71')]=_0x529422[0x0];if(!_0x2324b8['body']['UserId'])return;return db[_0xbcd3('0x72')][_0xbcd3('0x59')]({'where':{'id':_0x2324b8[_0xbcd3('0x5b')]['UserId'],'role':_0xbcd3('0x73')},'attributes':['id',_0xbcd3('0x3c'),_0xbcd3('0x74'),_0xbcd3('0x75'),'internal'],'raw':!![]});}return null;})[_0xbcd3('0x23')](function(_0x529f7d){if(!_0x529f7d)return null;_0x2a4aba[_0xbcd3('0x2b')][_0xbcd3('0x73')]=_0x529f7d;return _0x2a4aba;})['then'](function(_0x23a7d1){if(_0x23a7d1){if(_0x2324b8[_0xbcd3('0x5b')][_0xbcd3('0x76')]){_0x2a4aba['message'][_0xbcd3('0x77')]=util['format'](_0xbcd3('0x78'),_0x2324b8[_0xbcd3('0x64')][_0xbcd3('0x3c')]);_0x2a4aba[_0xbcd3('0x2b')][_0xbcd3('0x79')]=_0x2a4aba[_0xbcd3('0x79')];_0x2a4aba[_0xbcd3('0x2b')][_0xbcd3('0x7a')]=_0x2a4aba[_0xbcd3('0x79')];_0x2a4aba[_0xbcd3('0x2b')][_0xbcd3('0x7b')]='accept';return respondWithRpcPromise(_0xbcd3('0x7c'),_0xbcd3('0x7c'),{'event':_0xbcd3('0x7d'),'message':_0x2a4aba[_0xbcd3('0x2b')]},client9002)['then'](function(){return _0x2a4aba;});}return _0x2a4aba;}return null;})[_0xbcd3('0x23')](respondWithResult(_0x805df4,null))[_0xbcd3('0x2d')](handleError(_0x805df4,null));};var interaction_log=require(_0xbcd3('0x14'))(_0xbcd3('0x5d'));exports[_0xbcd3('0x38')]=function(_0x2234f9,_0x41b318,_0x14fd07){var _0x23000d={'agent':{},'channel':_0xbcd3('0x5f')};if(_0x2234f9[_0xbcd3('0x5b')]['id']){delete _0x2234f9[_0xbcd3('0x5b')]['id'];}_0x2234f9[_0xbcd3('0x5b')]['UserId']=_0x2234f9[_0xbcd3('0x5b')]['UserId']||_0x2234f9[_0xbcd3('0x64')]['id'];_0x23000d['agent']['id']=_0x2234f9['body'][_0xbcd3('0x63')];return db[_0xbcd3('0x40')]['find']({'where':{'id':_0x2234f9[_0xbcd3('0x57')]['id'],'UserId':null}})[_0xbcd3('0x23')](handleEntityNotFound(_0x41b318,null))['then'](function(_0xab5d3e){if(_0xab5d3e){_0x23000d['message']=_0xab5d3e[_0xbcd3('0x67')]({'plain':!![]});return db[_0xbcd3('0x7e')][_0xbcd3('0x59')]({'where':{'id':_0xab5d3e[_0xbcd3('0x7f')]}});}return null;})[_0xbcd3('0x23')](handleEntityNotFound(_0x41b318,null))[_0xbcd3('0x23')](function(_0x30f8d8){if(_0x30f8d8){_0x23000d[_0xbcd3('0x66')]=_0x30f8d8[_0xbcd3('0x67')]({'plain':!![]});interaction_log[_0xbcd3('0x24')](_0xbcd3('0x80'),_0x2234f9[_0xbcd3('0x64')]['id'],_0x2234f9['user'][_0xbcd3('0x3c')],_0x2234f9[_0xbcd3('0x64')][_0xbcd3('0x69')],_0x23000d[_0xbcd3('0x66')]['id'],_0x2234f9[_0xbcd3('0x5b')]?JSON[_0xbcd3('0x6a')](_0x2234f9[_0xbcd3('0x5b')]):_0xbcd3('0x6b'));return respondWithRpcPromise(_0xbcd3('0x81'),_0xbcd3('0x82'),_0x23000d);}return null;})[_0xbcd3('0x23')](function(_0x35c433){var _0x10ad35='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x35c433[_0xbcd3('0x2b')][_0xbcd3('0x6e')];return db[_0xbcd3('0x83')][_0xbcd3('0x48')](_0x10ad35,{'type':db['Sequelize'][_0xbcd3('0x6f')][_0xbcd3('0x70')],'raw':!![]})[_0xbcd3('0x23')](function(_0x50eab1){return _0x50eab1;});})[_0xbcd3('0x23')](function(_0x26f2a4){if(_0x26f2a4){_0x23000d[_0xbcd3('0x2b')][_0xbcd3('0x71')]=_0x26f2a4[0x0];if(!_0x2234f9[_0xbcd3('0x5b')][_0xbcd3('0x63')])return;return db[_0xbcd3('0x72')][_0xbcd3('0x59')]({'where':{'id':_0x2234f9['body'][_0xbcd3('0x63')],'role':_0xbcd3('0x73')},'attributes':['id',_0xbcd3('0x3c'),_0xbcd3('0x74'),'email',_0xbcd3('0x84')],'raw':!![]});}return null;})[_0xbcd3('0x23')](function(_0x17cb43){if(!_0x17cb43)return null;_0x23000d[_0xbcd3('0x2b')][_0xbcd3('0x73')]=_0x17cb43;return _0x23000d;})['then'](function(_0x37f1d3){if(_0x37f1d3){_0x37f1d3[_0xbcd3('0x2b')][_0xbcd3('0x77')]=util[_0xbcd3('0x61')]('SIP/%s',_0x2234f9[_0xbcd3('0x64')][_0xbcd3('0x3c')]);_0x37f1d3['message']['channel']=_0x23000d[_0xbcd3('0x79')];_0x37f1d3[_0xbcd3('0x2b')][_0xbcd3('0x7a')]=_0x23000d[_0xbcd3('0x79')];_0x37f1d3[_0xbcd3('0x2b')]['event']='reject';respondWithRpcPromise('EventManager','EventManager',{'event':'rejectmessage','message':_0x37f1d3[_0xbcd3('0x2b')]},client9002);return _0x23000d;}return null;})[_0xbcd3('0x23')](respondWithResult(_0x41b318,null))[_0xbcd3('0x2d')](handleError(_0x41b318,null));}; \ No newline at end of file +var _0xe78d=['eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./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','sendStatus','end','status','json','undefined','count','offset','set','apply','reject','save','update','destroy','name','send','index','map','OpenchannelMessage','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','params','keys','catch','create','body','find','describe','openchannel-interactions','openchannel','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','OpenchannelInteractionId','isNil','read1stAt','interaction','user','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','SELECT','contact','User','email','manual','interface','SIP/%s','channel','motionChannel','accept','EventManager','OpenchannelInteraction','RejectMessage','rejectMessage','ContactId','Sequelize','internal','event','rejectmessage'];(function(_0x35aeda,_0x264a31){var _0x40498c=function(_0x25f8fc){while(--_0x25f8fc){_0x35aeda['push'](_0x35aeda['shift']());}};_0x40498c(++_0x264a31);}(_0xe78d,0x81));var _0xde78=function(_0x20589d,_0x55d5bf){_0x20589d=_0x20589d-0x0;var _0x422de9=_0xe78d[_0x20589d];return _0x422de9;};'use strict';var emlformat=require(_0xde78('0x0'));var rimraf=require(_0xde78('0x1'));var zipdir=require(_0xde78('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xde78('0x3'));var BPromise=require(_0xde78('0x4'));var Mustache=require(_0xde78('0x5'));var util=require(_0xde78('0x6'));var path=require(_0xde78('0x7'));var sox=require(_0xde78('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xde78('0x9'));var squel=require('squel');var crypto=require(_0xde78('0xa'));var jsforce=require(_0xde78('0xb'));var deskjs=require(_0xde78('0xc'));var toCsv=require('to-csv');var querystring=require(_0xde78('0xd'));var Papa=require(_0xde78('0xe'));var Redis=require(_0xde78('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xde78('0x10'));var as=require(_0xde78('0x11'));var hardwareService=require(_0xde78('0x12'));var logger=require(_0xde78('0x13'))(_0xde78('0x14'));var utils=require(_0xde78('0x15'));var config=require(_0xde78('0x16'));var licenseUtil=require(_0xde78('0x17'));var db=require(_0xde78('0x18'))['db'];config[_0xde78('0x19')]=_[_0xde78('0x1a')](config['redis'],{'host':_0xde78('0x1b'),'port':0x18eb});var socket=require(_0xde78('0x1c'))(new Redis(config[_0xde78('0x19')]));require(_0xde78('0x1d'))[_0xde78('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0xde78('0x1f')][_0xde78('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x292375,_0x11d9c9,_0x10b4fc,_0x32d209){return new BPromise(function(_0xea087a,_0x172885){var _0x2637d0=_0x32d209||client;return _0x2637d0[_0xde78('0x21')](_0x292375,_0x10b4fc)[_0xde78('0x22')](function(_0x14032c){logger[_0xde78('0x23')](_0xde78('0x24'),_0x11d9c9,_0xde78('0x25'));logger[_0xde78('0x26')](_0xde78('0x27'),_0x11d9c9,_0xde78('0x25'),JSON[_0xde78('0x28')](_0x14032c));if(_0x14032c[_0xde78('0x29')]){if(_0x14032c[_0xde78('0x29')][_0xde78('0x2a')]===0x1f4){logger[_0xde78('0x29')]('OpenchannelMessage,\x20%s,\x20%s',_0x11d9c9,_0x14032c[_0xde78('0x29')][_0xde78('0x2b')]);return _0x172885(_0x14032c[_0xde78('0x29')]['message']);}logger[_0xde78('0x29')](_0xde78('0x24'),_0x11d9c9,_0x14032c['error']['message']);return _0xea087a(_0x14032c[_0xde78('0x29')][_0xde78('0x2b')]);}else{logger[_0xde78('0x23')](_0xde78('0x24'),_0x11d9c9,_0xde78('0x25'));_0xea087a(_0x14032c[_0xde78('0x2c')][_0xde78('0x2b')]);}})['catch'](function(_0x2fc06e){logger[_0xde78('0x29')](_0xde78('0x24'),_0x11d9c9,_0x2fc06e);_0x172885(_0x2fc06e);});});}function respondWithStatusCode(_0x4ce743,_0x487112){_0x487112=_0x487112||0xcc;return function(_0x4a39e6){if(_0x4a39e6){return _0x4ce743[_0xde78('0x2d')](_0x487112);}return _0x4ce743['status'](_0x487112)[_0xde78('0x2e')]();};}function respondWithResult(_0x335940,_0x1f8874){_0x1f8874=_0x1f8874||0xc8;return function(_0x4521ae){if(_0x4521ae){return _0x335940[_0xde78('0x2f')](_0x1f8874)[_0xde78('0x30')](_0x4521ae);}};}function respondWithFilteredResult(_0x10121e,_0x23fd09){return function(_0x5166e2){if(_0x5166e2){var _0x50700a=typeof _0x23fd09['offset']===_0xde78('0x31')&&typeof _0x23fd09['limit']===_0xde78('0x31');var _0x11fdbf=_0x5166e2[_0xde78('0x32')];var _0x56e64e=_0x50700a?0x0:_0x23fd09['offset'];var _0x334bb0=_0x50700a?_0x5166e2[_0xde78('0x32')]:_0x23fd09[_0xde78('0x33')]+_0x23fd09['limit'];var _0xa18204;if(_0x334bb0>=_0x11fdbf){_0x334bb0=_0x11fdbf;_0xa18204=0xc8;}else{_0xa18204=0xce;}_0x10121e[_0xde78('0x2f')](_0xa18204);return _0x10121e[_0xde78('0x34')]('Content-Range',_0x56e64e+'-'+_0x334bb0+'/'+_0x11fdbf)[_0xde78('0x30')](_0x5166e2);}return null;};}function patchUpdates(_0x1bc518){return function(_0x48d892){try{jsonpatch[_0xde78('0x35')](_0x48d892,_0x1bc518,!![]);}catch(_0x5f321d){return BPromise[_0xde78('0x36')](_0x5f321d);}return _0x48d892[_0xde78('0x37')]();};}function saveUpdates(_0x2652f9,_0x38ffc4){return function(_0x2ca2e8){if(_0x2ca2e8){return _0x2ca2e8[_0xde78('0x38')](_0x2652f9)[_0xde78('0x22')](function(_0x5a9cd1){return _0x5a9cd1;});}return null;};}function removeEntity(_0x5dd0ae,_0x44e3e9){return function(_0x5046ab){if(_0x5046ab){return _0x5046ab[_0xde78('0x39')]()[_0xde78('0x22')](function(){_0x5dd0ae[_0xde78('0x2f')](0xcc)[_0xde78('0x2e')]();});}};}function handleEntityNotFound(_0x429549,_0x31cce3){return function(_0x4610b5){if(!_0x4610b5){_0x429549[_0xde78('0x2d')](0x194);}return _0x4610b5;};}function handleError(_0x17b46a,_0x44790c){_0x44790c=_0x44790c||0x1f4;return function(_0x1e8175){logger[_0xde78('0x29')](_0x1e8175['stack']);if(_0x1e8175[_0xde78('0x3a')]){delete _0x1e8175[_0xde78('0x3a')];}_0x17b46a[_0xde78('0x2f')](_0x44790c)[_0xde78('0x3b')](_0x1e8175);};}exports[_0xde78('0x3c')]=function(_0x10a819,_0x329cfe){var _0x54f548={},_0x4eb8e9={},_0x3cf374={'count':0x0,'rows':[]};var _0x3e134d=_[_0xde78('0x3d')](db[_0xde78('0x3e')]['rawAttributes'],function(_0x46ccad){return{'name':_0x46ccad[_0xde78('0x3f')],'type':_0x46ccad[_0xde78('0x40')][_0xde78('0x41')]};});_0x4eb8e9[_0xde78('0x42')]=_['map'](_0x3e134d,_0xde78('0x3a'));_0x4eb8e9[_0xde78('0x43')]=_['keys'](_0x10a819[_0xde78('0x43')]);_0x4eb8e9[_0xde78('0x44')]=_[_0xde78('0x45')](_0x4eb8e9['model'],_0x4eb8e9[_0xde78('0x43')]);_0x54f548['attributes']=_[_0xde78('0x45')](_0x4eb8e9[_0xde78('0x42')],qs[_0xde78('0x46')](_0x10a819[_0xde78('0x43')][_0xde78('0x46')]));_0x54f548['attributes']=_0x54f548[_0xde78('0x47')][_0xde78('0x48')]?_0x54f548[_0xde78('0x47')]:_0x4eb8e9['model'];if(!_0x10a819[_0xde78('0x43')]['hasOwnProperty'](_0xde78('0x49'))){_0x54f548[_0xde78('0x4a')]=qs[_0xde78('0x4a')](_0x10a819[_0xde78('0x43')]['limit']);_0x54f548['offset']=qs[_0xde78('0x33')](_0x10a819[_0xde78('0x43')][_0xde78('0x33')]);}_0x54f548[_0xde78('0x4b')]=qs[_0xde78('0x4c')](_0x10a819[_0xde78('0x43')]['sort']);_0x54f548[_0xde78('0x4d')]=qs[_0xde78('0x44')](_['pick'](_0x10a819['query'],_0x4eb8e9['filters']),_0x3e134d);if(_0x10a819[_0xde78('0x43')][_0xde78('0x4e')]){_0x54f548[_0xde78('0x4d')]=_[_0xde78('0x4f')](_0x54f548[_0xde78('0x4d')],{'$or':_[_0xde78('0x3d')](_0x3e134d,function(_0x542e80){if(_0x542e80[_0xde78('0x40')]!==_0xde78('0x50')){var _0x1f3f9e={};_0x1f3f9e[_0x542e80[_0xde78('0x3a')]]={'$like':'%'+_0x10a819['query']['filter']+'%'};return _0x1f3f9e;}})});}_0x54f548=_['merge']({},_0x54f548,_0x10a819[_0xde78('0x51')]);var _0x18fe4a={'where':_0x54f548['where']};return db[_0xde78('0x3e')]['count'](_0x18fe4a)[_0xde78('0x22')](function(_0x1ac962){_0x3cf374[_0xde78('0x32')]=_0x1ac962;if(_0x10a819[_0xde78('0x43')][_0xde78('0x52')]){_0x54f548[_0xde78('0x53')]=[{'all':!![]}];}return db[_0xde78('0x3e')][_0xde78('0x54')](_0x54f548);})['then'](function(_0x221a23){_0x3cf374['rows']=_0x221a23;return _0x3cf374;})[_0xde78('0x22')](respondWithFilteredResult(_0x329cfe,_0x54f548))['catch'](handleError(_0x329cfe,null));};exports['show']=function(_0x24a88c,_0x2b2571){var _0x25a5e2={'raw':!![],'where':{'id':_0x24a88c[_0xde78('0x55')]['id']}},_0x687552={};_0x687552[_0xde78('0x42')]=_[_0xde78('0x56')](db[_0xde78('0x3e')]['rawAttributes']);_0x687552['query']=_['keys'](_0x24a88c[_0xde78('0x43')]);_0x687552[_0xde78('0x44')]=_[_0xde78('0x45')](_0x687552[_0xde78('0x42')],_0x687552[_0xde78('0x43')]);_0x25a5e2[_0xde78('0x47')]=_[_0xde78('0x45')](_0x687552[_0xde78('0x42')],qs[_0xde78('0x46')](_0x24a88c['query'][_0xde78('0x46')]));_0x25a5e2[_0xde78('0x47')]=_0x25a5e2[_0xde78('0x47')][_0xde78('0x48')]?_0x25a5e2[_0xde78('0x47')]:_0x687552[_0xde78('0x42')];if(_0x24a88c[_0xde78('0x43')]['includeAll']){_0x25a5e2[_0xde78('0x53')]=[{'all':!![]}];}_0x25a5e2=_['merge']({},_0x25a5e2,_0x24a88c['options']);return db['OpenchannelMessage']['find'](_0x25a5e2)['then'](handleEntityNotFound(_0x2b2571,null))['then'](respondWithResult(_0x2b2571,null))[_0xde78('0x57')](handleError(_0x2b2571,null));};exports['create']=function(_0x58bb53,_0x1cfe2a){return db['OpenchannelMessage'][_0xde78('0x58')](_0x58bb53[_0xde78('0x59')],{})[_0xde78('0x22')](respondWithResult(_0x1cfe2a,0xc9))[_0xde78('0x57')](handleError(_0x1cfe2a,null));};exports[_0xde78('0x38')]=function(_0x58cda0,_0x4679f5){if(_0x58cda0[_0xde78('0x59')]['id']){delete _0x58cda0[_0xde78('0x59')]['id'];}return db[_0xde78('0x3e')][_0xde78('0x5a')]({'where':{'id':_0x58cda0['params']['id']}})[_0xde78('0x22')](handleEntityNotFound(_0x4679f5,null))[_0xde78('0x22')](saveUpdates(_0x58cda0[_0xde78('0x59')],null))['then'](respondWithResult(_0x4679f5,null))['catch'](handleError(_0x4679f5,null));};exports[_0xde78('0x39')]=function(_0x16cd09,_0x553d33){return db['OpenchannelMessage'][_0xde78('0x5a')]({'where':{'id':_0x16cd09[_0xde78('0x55')]['id']}})['then'](handleEntityNotFound(_0x553d33,null))['then'](removeEntity(_0x553d33,null))[_0xde78('0x57')](handleError(_0x553d33,null));};exports[_0xde78('0x5b')]=function(_0x607cd4,_0x2a716b){return db[_0xde78('0x3e')][_0xde78('0x5b')]()[_0xde78('0x22')](respondWithResult(_0x2a716b,null))['catch'](handleError(_0x2a716b,null));};var interaction_log=require(_0xde78('0x13'))(_0xde78('0x5c'));exports['accept']=function(_0x580e6e,_0x3c4239,_0x24ffa5){var _0x3cdc88={'agent':{},'channel':_0xde78('0x5d')};if(_0x580e6e['body']['id']){delete _0x580e6e[_0xde78('0x59')]['id'];}_0x580e6e['body']['read']=!![];_0x580e6e['body']['readAt']=moment()[_0xde78('0x5e')](_0xde78('0x5f'));_0x580e6e[_0xde78('0x59')][_0xde78('0x60')]=_0x580e6e[_0xde78('0x59')][_0xde78('0x60')]||_0x580e6e['user']['id'];_0x3cdc88[_0xde78('0x61')]['id']=_0x580e6e['body'][_0xde78('0x60')];return db['OpenchannelMessage']['find']({'where':{'id':_0x580e6e[_0xde78('0x55')]['id'],'UserId':null}})[_0xde78('0x22')](handleEntityNotFound(_0x3c4239,null))[_0xde78('0x22')](saveUpdates(_0x580e6e[_0xde78('0x59')],null))[_0xde78('0x22')](function(_0x2e878e){if(_0x2e878e){_0x3cdc88[_0xde78('0x2b')]=_0x2e878e[_0xde78('0x62')]({'plain':!![]});return db['OpenchannelInteraction']['find']({'where':{'id':_0x2e878e[_0xde78('0x63')]}});}return null;})[_0xde78('0x22')](handleEntityNotFound(_0x3c4239,null))[_0xde78('0x22')](function(_0xcf06d9){if(_0xcf06d9){return _0xcf06d9[_0xde78('0x38')]({'UserId':_0x580e6e[_0xde78('0x59')][_0xde78('0x60')],'read1stAt':_[_0xde78('0x64')](_0xcf06d9[_0xde78('0x65')])?moment()[_0xde78('0x5e')](_0xde78('0x5f')):undefined});}return null;})[_0xde78('0x22')](function(_0x4a2f33){if(_0x4a2f33){_0x3cdc88[_0xde78('0x66')]=_0x4a2f33[_0xde78('0x62')]({'plain':!![]});interaction_log[_0xde78('0x23')]('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x580e6e[_0xde78('0x67')]['id'],_0x580e6e[_0xde78('0x67')][_0xde78('0x3a')],_0x580e6e[_0xde78('0x67')][_0xde78('0x68')],_0x3cdc88[_0xde78('0x66')]['id'],_0x580e6e['body']?JSON[_0xde78('0x28')](_0x580e6e['body']):_0xde78('0x69'));return respondWithRpcPromise(_0xde78('0x6a'),_0xde78('0x6b'),_0x3cdc88);}return null;})[_0xde78('0x22')](function(_0x479328){var _0x441c22=_0xde78('0x6c')+_0x479328[_0xde78('0x2b')]['ContactId'];return db[_0xde78('0x6d')][_0xde78('0x43')](_0x441c22,{'type':db['Sequelize']['QueryTypes'][_0xde78('0x6e')],'raw':!![]})[_0xde78('0x22')](function(_0x3f02a2){return _0x3f02a2;});})[_0xde78('0x22')](function(_0x12505c){if(_0x12505c){_0x3cdc88['message'][_0xde78('0x6f')]=_0x12505c[0x0];if(!_0x580e6e[_0xde78('0x59')][_0xde78('0x60')])return;return db[_0xde78('0x70')][_0xde78('0x5a')]({'where':{'id':_0x580e6e[_0xde78('0x59')]['UserId'],'role':_0xde78('0x61')},'attributes':['id',_0xde78('0x3a'),'fullname',_0xde78('0x71'),'internal'],'raw':!![]});}return null;})[_0xde78('0x22')](function(_0x4e01b0){if(!_0x4e01b0)return null;_0x3cdc88['message'][_0xde78('0x61')]=_0x4e01b0;return _0x3cdc88;})[_0xde78('0x22')](function(_0x548adc){if(_0x548adc){if(_0x580e6e['body'][_0xde78('0x72')]){_0x3cdc88[_0xde78('0x2b')][_0xde78('0x73')]=util['format'](_0xde78('0x74'),_0x580e6e[_0xde78('0x67')][_0xde78('0x3a')]);_0x3cdc88[_0xde78('0x2b')][_0xde78('0x75')]=_0x3cdc88[_0xde78('0x75')];_0x3cdc88['message'][_0xde78('0x76')]=_0x3cdc88[_0xde78('0x75')];_0x3cdc88['message']['event']=_0xde78('0x77');return respondWithRpcPromise('EventManager',_0xde78('0x78'),{'event':'acceptmessage','message':_0x3cdc88[_0xde78('0x2b')]},client9002)[_0xde78('0x22')](function(){return _0x3cdc88;});}return _0x3cdc88;}return null;})[_0xde78('0x22')](respondWithResult(_0x3c4239,null))[_0xde78('0x57')](handleError(_0x3c4239,null));};var interaction_log=require('../../config/logger')(_0xde78('0x5c'));exports[_0xde78('0x36')]=function(_0x54abfa,_0x3970ec,_0x113e80){var _0x388963={'agent':{},'channel':_0xde78('0x5d')};if(_0x54abfa[_0xde78('0x59')]['id']){delete _0x54abfa[_0xde78('0x59')]['id'];}_0x54abfa['body'][_0xde78('0x60')]=_0x54abfa[_0xde78('0x59')][_0xde78('0x60')]||_0x54abfa['user']['id'];_0x388963[_0xde78('0x61')]['id']=_0x54abfa['body'][_0xde78('0x60')];return db[_0xde78('0x3e')][_0xde78('0x5a')]({'where':{'id':_0x54abfa[_0xde78('0x55')]['id'],'UserId':null}})[_0xde78('0x22')](handleEntityNotFound(_0x3970ec,null))[_0xde78('0x22')](function(_0x3b2b9b){if(_0x3b2b9b){_0x388963[_0xde78('0x2b')]=_0x3b2b9b[_0xde78('0x62')]({'plain':!![]});return db[_0xde78('0x79')][_0xde78('0x5a')]({'where':{'id':_0x3b2b9b[_0xde78('0x63')]}});}return null;})[_0xde78('0x22')](handleEntityNotFound(_0x3970ec,null))[_0xde78('0x22')](function(_0x5efcb2){if(_0x5efcb2){_0x388963[_0xde78('0x66')]=_0x5efcb2['get']({'plain':!![]});interaction_log[_0xde78('0x23')]('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x54abfa[_0xde78('0x67')]['id'],_0x54abfa[_0xde78('0x67')][_0xde78('0x3a')],_0x54abfa[_0xde78('0x67')][_0xde78('0x68')],_0x388963['interaction']['id'],_0x54abfa[_0xde78('0x59')]?JSON[_0xde78('0x28')](_0x54abfa[_0xde78('0x59')]):_0xde78('0x69'));return respondWithRpcPromise(_0xde78('0x7a'),_0xde78('0x7b'),_0x388963);}return null;})[_0xde78('0x22')](function(_0x1aa7ce){var _0x346495=_0xde78('0x6c')+_0x1aa7ce['message'][_0xde78('0x7c')];return db[_0xde78('0x6d')][_0xde78('0x43')](_0x346495,{'type':db[_0xde78('0x7d')]['QueryTypes'][_0xde78('0x6e')],'raw':!![]})[_0xde78('0x22')](function(_0x4ba1fd){return _0x4ba1fd;});})[_0xde78('0x22')](function(_0x433c64){if(_0x433c64){_0x388963[_0xde78('0x2b')][_0xde78('0x6f')]=_0x433c64[0x0];if(!_0x54abfa[_0xde78('0x59')][_0xde78('0x60')])return;return db['User'][_0xde78('0x5a')]({'where':{'id':_0x54abfa['body'][_0xde78('0x60')],'role':_0xde78('0x61')},'attributes':['id',_0xde78('0x3a'),'fullname',_0xde78('0x71'),_0xde78('0x7e')],'raw':!![]});}return null;})['then'](function(_0x2b796a){if(!_0x2b796a)return null;_0x388963[_0xde78('0x2b')]['agent']=_0x2b796a;return _0x388963;})['then'](function(_0x306862){if(_0x306862){_0x306862['message'][_0xde78('0x73')]=util[_0xde78('0x5e')](_0xde78('0x74'),_0x54abfa[_0xde78('0x67')][_0xde78('0x3a')]);_0x306862['message']['channel']=_0x388963[_0xde78('0x75')];_0x306862[_0xde78('0x2b')][_0xde78('0x76')]=_0x388963['channel'];_0x306862[_0xde78('0x2b')][_0xde78('0x7f')]=_0xde78('0x36');respondWithRpcPromise('EventManager','EventManager',{'event':_0xde78('0x80'),'message':_0x306862[_0xde78('0x2b')]},client9002);return _0x388963;}return null;})[_0xde78('0x22')](respondWithResult(_0x3970ec,null))['catch'](handleError(_0x3970ec,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 0987b24..98abf57 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 _0x8d0b=['hasOwnProperty','hook','exports','../../mysqldb','save','update','emit'];(function(_0x4a6fa3,_0x3ac68d){var _0xe2f728=function(_0x4cc05b){while(--_0x4cc05b){_0x4a6fa3['push'](_0x4a6fa3['shift']());}};_0xe2f728(++_0x3ac68d);}(_0x8d0b,0xea));var _0xb8d0=function(_0x2f9467,_0x40576f){_0x2f9467=_0x2f9467-0x0;var _0x39894c=_0x8d0b[_0x2f9467];return _0x39894c;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0xb8d0('0x0'))['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb8d0('0x1'),'afterUpdate':_0xb8d0('0x2'),'afterDestroy':'remove'};function emitEvent(_0x419283){return function(_0x221fef,_0xe6ea93,_0x2d4eaf){OpenchannelMessageEvents[_0xb8d0('0x3')](_0x419283+':'+_0x221fef['id'],_0x221fef);OpenchannelMessageEvents[_0xb8d0('0x3')](_0x419283,_0x221fef);_0x2d4eaf(null);};}for(var e in events){if(events[_0xb8d0('0x4')](e)){var event=events[e];OpenchannelMessage[_0xb8d0('0x5')](e,emitEvent(event));}}module[_0xb8d0('0x6')]=OpenchannelMessageEvents; \ No newline at end of file +var _0xb1c8=['hasOwnProperty','events','../../mysqldb','OpenchannelMessage','save','update','emit'];(function(_0x57695a,_0x3140bd){var _0x4d72c8=function(_0x37d2d5){while(--_0x37d2d5){_0x57695a['push'](_0x57695a['shift']());}};_0x4d72c8(++_0x3140bd);}(_0xb1c8,0x1cf));var _0x8b1c=function(_0x3074f3,_0x4f2c03){_0x3074f3=_0x3074f3-0x0;var _0x53f112=_0xb1c8[_0x3074f3];return _0x53f112;};'use strict';var EventEmitter=require(_0x8b1c('0x0'));var OpenchannelMessage=require(_0x8b1c('0x1'))['db'][_0x8b1c('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8b1c('0x3'),'afterUpdate':_0x8b1c('0x4'),'afterDestroy':'remove'};function emitEvent(_0x453d1f){return function(_0x34d7c9,_0x492ed8,_0x779cad){OpenchannelMessageEvents['emit'](_0x453d1f+':'+_0x34d7c9['id'],_0x34d7c9);OpenchannelMessageEvents[_0x8b1c('0x5')](_0x453d1f,_0x34d7c9);_0x779cad(null);};}for(var e in events){if(events[_0x8b1c('0x6')](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 4f8f345..1ec571a 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 _0x9348=['catch','error','CmContact','describe','find','Interactions','Contact','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','omit','method','GET','Message\x20%d\x20forwarded\x20to\x20%s','threadId','update','inspect','finally','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./openchannelMessage.attributes','exports','define','openchannel_messages','fti_openchannel_messages','body','get','direction','toLowerCase','out','secret','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','createdAt'];(function(_0x48679e,_0x27cfd9){var _0xf6ebf1=function(_0xae0ef0){while(--_0xae0ef0){_0x48679e['push'](_0x48679e['shift']());}};_0xf6ebf1(++_0x27cfd9);}(_0x9348,0x10d));var _0x8934=function(_0x13b80b,_0x170454){_0x13b80b=_0x13b80b-0x0;var _0xf3430a=_0x9348[_0x13b80b];return _0xf3430a;};'use strict';var _=require(_0x8934('0x0'));var util=require(_0x8934('0x1'));var logger=require(_0x8934('0x2'))(_0x8934('0x3'));var moment=require(_0x8934('0x4'));var BPromise=require('bluebird');var rp=require(_0x8934('0x5'));var fs=require('fs');var path=require(_0x8934('0x6'));var rimraf=require('rimraf');var config=require(_0x8934('0x7'));var attributes=require(_0x8934('0x8'));module[_0x8934('0x9')]=function(_0x2bce03,_0x4c70d7){return _0x2bce03[_0x8934('0xa')]('OpenchannelMessage',attributes,{'tableName':_0x8934('0xb'),'paranoid':![],'indexes':[{'name':_0x8934('0xc'),'fields':[_0x8934('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4b470d,_0x5ec16d,_0x5336f0){var _0x2c722b=_0x2bce03['models'];var _0xe1adf4=_0x4b470d[_0x8934('0xe')]({'plain':!![]});if(_0xe1adf4[_0x8934('0xf')][_0x8934('0x10')]()==='in'||_0xe1adf4[_0x8934('0xf')][_0x8934('0x10')]()===_0x8934('0x11')&&!_0xe1adf4[_0x8934('0x12')]&&!_['isNil'](_0xe1adf4[_0x8934('0x13')])){_0x2c722b[_0x8934('0x14')][_0x8934('0x15')]({'where':{'id':_0xe1adf4[_0x8934('0x16')]}})[_0x8934('0x17')](function(_0xdf59f4){if(_0xdf59f4){_0xdf59f4['update']({'lastMsgAt':_0xe1adf4[_0x8934('0x18')],'lastMsgDirection':_0xe1adf4[_0x8934('0xf')][_0x8934('0x10')]()});}})[_0x8934('0x19')](function(_0x34d4dc){console[_0x8934('0x1a')](_0x34d4dc);});}if(_0xe1adf4[_0x8934('0xf')]===_0x8934('0x11')&&!_0xe1adf4['secret']){var _0xb86bc9;_0x2c722b[_0x8934('0x1b')][_0x8934('0x1c')]()['then'](function(_0x47f25e){return _0x2c722b['OpenchannelAccount'][_0x8934('0x1d')]({'where':{'id':_0xe1adf4['OpenchannelAccountId']},'include':[{'model':_0x2c722b[_0x8934('0x14')],'as':_0x8934('0x1e'),'where':{'id':_0xe1adf4[_0x8934('0x16')]},'limit':0x1,'include':[{'model':_0x2c722b[_0x8934('0x1b')],'as':_0x8934('0x1f'),'attributes':_['keys'](_0x47f25e)}]}]});})[_0x8934('0x17')](function(_0x5ae49f){_0xb86bc9=_0x5ae49f[_0x8934('0xe')]({'plain':!![]});if(_0xb86bc9&&_0xb86bc9[_0x8934('0x20')]){logger[_0x8934('0x21')](_0x8934('0x22'),_0x8934('0x23'),util[_0x8934('0x24')](_0x8934('0x25'),_0xe1adf4['id'],_0xb86bc9['replyUri']));if(_0xb86bc9[_0x8934('0x1e')]&&_0xb86bc9[_0x8934('0x1e')][_0x8934('0x26')]){_0xe1adf4[_0x8934('0x27')]=_[_0x8934('0x28')](_0xb86bc9['Interactions'][0x0],_0x8934('0x1f'));_0xe1adf4[_0x8934('0x1f')]=_0xb86bc9[_0x8934('0x1e')][0x0]['Contact'];}var _0x5ec16d={'method':'POST','uri':encodeURI(_0xb86bc9[_0x8934('0x20')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x5ec16d[_0x8934('0x29')]){case _0x8934('0x2a'):_0x5ec16d['qs']=_0xe1adf4;break;case'POST':_0x5ec16d[_0x8934('0xd')]=_0xe1adf4;break;}return rp(_0x5ec16d)[_0x8934('0x17')](function(_0x310454){logger[_0x8934('0x21')]('OpenchannelMessage,\x20%s,\x20%s',_0x8934('0x23'),util[_0x8934('0x24')](_0x8934('0x2b'),_0xe1adf4['id'],_0xb86bc9[_0x8934('0x20')]));if(_0x310454[_0x8934('0xd')][_0x8934('0x2c')]&&_0x310454[_0x8934('0xd')][_0x8934('0x2c')]!=_0xe1adf4[_0x8934('0x27')][_0x8934('0x2c')]){return _0x2c722b['OpenchannelInteraction'][_0x8934('0x2d')]({'threadId':_0x310454[_0x8934('0xd')]['threadId']},{'logging':!![],'where':{'id':_0xe1adf4[_0x8934('0x27')]['id']}});}else{return;}})[_0x8934('0x17')](function(){return _0x4b470d[_0x8934('0x2d')]({'read':!![]});})[_0x8934('0x19')](function(_0x4b3cb9){logger[_0x8934('0x1a')](_0x8934('0x22'),_0x8934('0x23'),util[_0x8934('0x2e')](_0x4b3cb9,{'showHidden':![],'depth':null}));_0x5336f0();});}else{_0x5336f0();}})[_0x8934('0x2f')](function(){_0x5336f0();});}else{_0x5336f0();}}},'charset':'utf8mb4','collate':_0x8934('0x30')});}; \ No newline at end of file +var _0xb7e7=['../../config/environment','./openchannelMessage.attributes','define','OpenchannelMessage','fti_openchannel_messages','body','FULLTEXT','get','direction','toLowerCase','out','secret','isNil','OpenchannelInteraction','findOne','then','createdAt','catch','CmContact','describe','OpenchannelAccount','find','OpenchannelAccountId','Interactions','OpenchannelInteractionId','Contact','keys','replyUri','info','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','method','GET','POST','OpenchannelMessage,\x20%s,\x20%s','threadId','update','inspect','finally','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','request-promise','rimraf'];(function(_0x241388,_0x48e64c){var _0x137e70=function(_0x509b46){while(--_0x509b46){_0x241388['push'](_0x241388['shift']());}};_0x137e70(++_0x48e64c);}(_0xb7e7,0x121));var _0x7b7e=function(_0x1abb09,_0x18ee91){_0x1abb09=_0x1abb09-0x0;var _0xea1c07=_0xb7e7[_0x1abb09];return _0xea1c07;};'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':'openchannel_messages','paranoid':![],'indexes':[{'name':_0x7b7e('0x9'),'fields':[_0x7b7e('0xa')],'type':_0x7b7e('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1647e5,_0x148964,_0x26bb8d){var _0x242e70=_0x53ed64['models'];var _0x299519=_0x1647e5[_0x7b7e('0xc')]({'plain':!![]});if(_0x299519[_0x7b7e('0xd')][_0x7b7e('0xe')]()==='in'||_0x299519[_0x7b7e('0xd')][_0x7b7e('0xe')]()===_0x7b7e('0xf')&&!_0x299519[_0x7b7e('0x10')]&&!_[_0x7b7e('0x11')](_0x299519['UserId'])){_0x242e70[_0x7b7e('0x12')][_0x7b7e('0x13')]({'where':{'id':_0x299519['OpenchannelInteractionId']}})[_0x7b7e('0x14')](function(_0x5976ac){if(_0x5976ac){_0x5976ac['update']({'lastMsgAt':_0x299519[_0x7b7e('0x15')],'lastMsgDirection':_0x299519[_0x7b7e('0xd')][_0x7b7e('0xe')]()});}})[_0x7b7e('0x16')](function(_0x3d2fb2){console['error'](_0x3d2fb2);});}if(_0x299519['direction']===_0x7b7e('0xf')&&!_0x299519[_0x7b7e('0x10')]){var _0x27f999;_0x242e70[_0x7b7e('0x17')][_0x7b7e('0x18')]()[_0x7b7e('0x14')](function(_0x242368){return _0x242e70[_0x7b7e('0x19')][_0x7b7e('0x1a')]({'where':{'id':_0x299519[_0x7b7e('0x1b')]},'include':[{'model':_0x242e70[_0x7b7e('0x12')],'as':_0x7b7e('0x1c'),'where':{'id':_0x299519[_0x7b7e('0x1d')]},'limit':0x1,'include':[{'model':_0x242e70[_0x7b7e('0x17')],'as':_0x7b7e('0x1e'),'attributes':_[_0x7b7e('0x1f')](_0x242368)}]}]});})[_0x7b7e('0x14')](function(_0x49eddb){_0x27f999=_0x49eddb[_0x7b7e('0xc')]({'plain':!![]});if(_0x27f999&&_0x27f999[_0x7b7e('0x20')]){logger[_0x7b7e('0x21')]('OpenchannelMessage,\x20%s,\x20%s',_0x7b7e('0x22'),util[_0x7b7e('0x23')](_0x7b7e('0x24'),_0x299519['id'],_0x27f999[_0x7b7e('0x20')]));if(_0x27f999[_0x7b7e('0x1c')]&&_0x27f999[_0x7b7e('0x1c')][_0x7b7e('0x25')]){_0x299519[_0x7b7e('0x26')]=_['omit'](_0x27f999['Interactions'][0x0],'Contact');_0x299519[_0x7b7e('0x1e')]=_0x27f999[_0x7b7e('0x1c')][0x0][_0x7b7e('0x1e')];}var _0x148964={'method':'POST','uri':encodeURI(_0x27f999['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x148964[_0x7b7e('0x27')]){case _0x7b7e('0x28'):_0x148964['qs']=_0x299519;break;case _0x7b7e('0x29'):_0x148964[_0x7b7e('0xa')]=_0x299519;break;}return rp(_0x148964)[_0x7b7e('0x14')](function(_0x48fad1){logger[_0x7b7e('0x21')](_0x7b7e('0x2a'),'afterCreate',util['format']('Message\x20%d\x20forwarded\x20to\x20%s',_0x299519['id'],_0x27f999[_0x7b7e('0x20')]));if(_0x48fad1[_0x7b7e('0xa')]['threadId']&&_0x48fad1[_0x7b7e('0xa')]['threadId']!=_0x299519[_0x7b7e('0x26')][_0x7b7e('0x2b')]){return _0x242e70[_0x7b7e('0x12')]['update']({'threadId':_0x48fad1[_0x7b7e('0xa')][_0x7b7e('0x2b')]},{'logging':!![],'where':{'id':_0x299519[_0x7b7e('0x26')]['id']}});}else{return;}})[_0x7b7e('0x14')](function(){return _0x1647e5[_0x7b7e('0x2c')]({'read':!![]});})['catch'](function(_0x41af57){logger['error'](_0x7b7e('0x2a'),_0x7b7e('0x22'),util[_0x7b7e('0x2d')](_0x41af57,{'showHidden':![],'depth':null}));_0x26bb8d();});}else{_0x26bb8d();}})[_0x7b7e('0x2e')](function(){_0x26bb8d();});}else{_0x26bb8d();}}},'charset':_0x7b7e('0x2f'),'collate':_0x7b7e('0x30')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 20ffef9..33aefdb 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(_0x443947,_0x20911f){var _0x392ee6=function(_0x36c6b6){while(--_0x36c6b6){_0x443947['push'](_0x443947['shift']());}};_0x392ee6(++_0x20911f);}(_0x7a54,0x106));var _0x47a5=function(_0x527afc,_0x2a0fd1){_0x527afc=_0x527afc-0x0;var _0x45239d=_0x7a54[_0x527afc];return _0x45239d;};'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 _0x1261=['../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','localhost','socket.io-emitter','./openchannelMessage.socket','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','OpenchannelMessage','options','raw','then','CreateOpenchannelMessage','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x2ccf5e,_0x3ce224){var _0x63e859=function(_0x54f996){while(--_0x54f996){_0x2ccf5e['push'](_0x2ccf5e['shift']());}};_0x63e859(++_0x3ce224);}(_0x1261,0x144));var _0x1126=function(_0x25df80,_0xa2aec5){_0x25df80=_0x25df80-0x0;var _0x17b6d0=_0x1261[_0x25df80];return _0x17b6d0;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});config[_0x1126('0xb')]=_['defaults'](config[_0x1126('0xb')],{'host':_0x1126('0xc'),'port':0x18eb});var socket=require(_0x1126('0xd'))(new Redis(config[_0x1126('0xb')]));require(_0x1126('0xe'))['register'](socket);function respondWithRpcPromise(_0x3f09ac,_0x18dbe6,_0x167ef1){return new BPromise(function(_0x5e72e2,_0x34571c){return client['request'](_0x3f09ac,_0x167ef1)['then'](function(_0x15c071){logger['info'](_0x1126('0xf'),_0x18dbe6,_0x1126('0x10'));logger[_0x1126('0x11')](_0x1126('0x12'),_0x18dbe6,_0x1126('0x10'),JSON[_0x1126('0x13')](_0x15c071));if(_0x15c071[_0x1126('0x14')]){if(_0x15c071[_0x1126('0x14')][_0x1126('0x15')]===0x1f4){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x18dbe6,_0x15c071[_0x1126('0x14')][_0x1126('0x16')]);return _0x34571c(_0x15c071[_0x1126('0x14')]['message']);}logger[_0x1126('0x14')]('OpenchannelMessage,\x20%s,\x20%s',_0x18dbe6,_0x15c071[_0x1126('0x14')][_0x1126('0x16')]);return _0x5e72e2(_0x15c071[_0x1126('0x14')]['message']);}else{logger[_0x1126('0x17')](_0x1126('0xf'),_0x18dbe6,'request\x20sent');_0x5e72e2(_0x15c071['result'][_0x1126('0x16')]);}})[_0x1126('0x18')](function(_0x58d11a){logger['error'](_0x1126('0xf'),_0x18dbe6,_0x58d11a);_0x34571c(_0x58d11a);});});}exports['CreateOpenchannelMessage']=function(_0x22ed37){var _0x1d6d19=this;return new Promise(function(_0x2f70ac,_0x54400a){return db[_0x1126('0x19')]['create'](_0x22ed37['body'],{'raw':_0x22ed37[_0x1126('0x1a')]?_0x22ed37[_0x1126('0x1a')][_0x1126('0x1b')]===undefined?!![]:![]:!![]})[_0x1126('0x1c')](function(_0x526ca1){logger[_0x1126('0x17')](_0x1126('0x1d'),_0x22ed37);logger['debug'](_0x1126('0x1d'),_0x22ed37,JSON['stringify'](_0x526ca1));_0x2f70ac(_0x526ca1);})['catch'](function(_0x4b57ab){logger[_0x1126('0x14')](_0x1126('0x1d'),_0x4b57ab[_0x1126('0x16')],_0x22ed37);_0x54400a(_0x1d6d19[_0x1126('0x14')](0x1f4,_0x4b57ab[_0x1126('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 9a67728..c075bc8 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 _0xdd48=['openchannelMessage:','./openchannelMessage.events','save','update','register'];(function(_0x1315e2,_0xd8ae26){var _0x45dbe6=function(_0x3c3964){while(--_0x3c3964){_0x1315e2['push'](_0x1315e2['shift']());}};_0x45dbe6(++_0xd8ae26);}(_0xdd48,0xec));var _0x8dd4=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xdd48[_0x59ee6f];return _0x4c0979;};'use strict';var OpenchannelMessageEvents=require(_0x8dd4('0x0'));var events=[_0x8dd4('0x1'),'remove',_0x8dd4('0x2')];function createListener(_0x488cd7,_0x20bd32){return function(_0x320d62){_0x20bd32['emit'](_0x488cd7,_0x320d62);};}function removeListener(_0x3201a5,_0x34ac5f){return function(){OpenchannelMessageEvents['removeListener'](_0x3201a5,_0x34ac5f);};}exports[_0x8dd4('0x3')]=function(_0x12d1c3){for(var _0x3d495e=0x0,_0x33b6db=events['length'];_0x3d495e<_0x33b6db;_0x3d495e++){var _0x1d8571=events[_0x3d495e];var _0x460b2f=createListener(_0x8dd4('0x4')+_0x1d8571,_0x12d1c3);OpenchannelMessageEvents['on'](_0x1d8571,_0x460b2f);}}; \ No newline at end of file +var _0x43ce=['length','openchannelMessage:','./openchannelMessage.events','save','remove','update','emit','register'];(function(_0x141819,_0x15bc75){var _0x4165bc=function(_0xe48ae5){while(--_0xe48ae5){_0x141819['push'](_0x141819['shift']());}};_0x4165bc(++_0x15bc75);}(_0x43ce,0x16a));var _0xe43c=function(_0x578b76,_0x4e649f){_0x578b76=_0x578b76-0x0;var _0x597e94=_0x43ce[_0x578b76];return _0x597e94;};'use strict';var OpenchannelMessageEvents=require(_0xe43c('0x0'));var events=[_0xe43c('0x1'),_0xe43c('0x2'),_0xe43c('0x3')];function createListener(_0xcd05b4,_0x5be0ec){return function(_0x4e03f6){_0x5be0ec[_0xe43c('0x4')](_0xcd05b4,_0x4e03f6);};}function removeListener(_0x46ac17,_0x816a6){return function(){OpenchannelMessageEvents['removeListener'](_0x46ac17,_0x816a6);};}exports[_0xe43c('0x5')]=function(_0x3e7fe3){for(var _0x1bf07c=0x0,_0x5e2003=events[_0xe43c('0x6')];_0x1bf07c<_0x5e2003;_0x1bf07c++){var _0x26cd4c=events[_0x1bf07c];var _0x50de32=createListener(_0xe43c('0x7')+_0x26cd4c,_0x3e7fe3);OpenchannelMessageEvents['on'](_0x26cd4c,_0x50de32);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 79ce276..da47e45 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 _0xc676=['/describe','describe','/:id','show','/:id/members','/:id/users','getAgents','post','create','/:id/teams','addTeams','addAgents','delete','destroy','removeAgents','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','./openchannelQueue.controller','get','isAuthenticated','index'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc676,0xe0));var _0x6c67=function(_0x5526ed,_0x21fef8){_0x5526ed=_0x5526ed-0x0;var _0x5dd4c4=_0xc676[_0x5526ed];return _0x5dd4c4;};'use strict';var multer=require(_0x6c67('0x0'));var util=require('util');var path=require(_0x6c67('0x1'));var timeout=require(_0x6c67('0x2'));var express=require(_0x6c67('0x3'));var router=express[_0x6c67('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6c67('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6c67('0x6'));router[_0x6c67('0x7')]('/',auth[_0x6c67('0x8')](),controller[_0x6c67('0x9')]);router[_0x6c67('0x7')](_0x6c67('0xa'),auth[_0x6c67('0x8')](),controller[_0x6c67('0xb')]);router[_0x6c67('0x7')](_0x6c67('0xc'),auth[_0x6c67('0x8')](),controller[_0x6c67('0xd')]);router['get'](_0x6c67('0xe'),auth[_0x6c67('0x8')](),controller['getMembers']);router[_0x6c67('0x7')]('/:id/teams',auth[_0x6c67('0x8')](),controller['getTeams']);router['get'](_0x6c67('0xf'),auth[_0x6c67('0x8')](),controller[_0x6c67('0x10')]);router[_0x6c67('0x11')]('/',auth[_0x6c67('0x8')](),controller[_0x6c67('0x12')]);router[_0x6c67('0x11')](_0x6c67('0x13'),auth[_0x6c67('0x8')](),controller[_0x6c67('0x14')]);router[_0x6c67('0x11')](_0x6c67('0xf'),auth[_0x6c67('0x8')](),controller[_0x6c67('0x15')]);router['put'](_0x6c67('0xc'),auth[_0x6c67('0x8')](),controller['update']);router[_0x6c67('0x16')](_0x6c67('0xc'),auth[_0x6c67('0x8')](),controller[_0x6c67('0x17')]);router[_0x6c67('0x16')](_0x6c67('0x13'),auth[_0x6c67('0x8')](),controller['removeTeams']);router[_0x6c67('0x16')](_0x6c67('0xf'),auth[_0x6c67('0x8')](),controller[_0x6c67('0x18')]);module[_0x6c67('0x19')]=router; \ No newline at end of file +var _0x6985=['connect-timeout','express','Router','fs-extra','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','/describe','describe','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','addTeams','/:id','update','delete','destroy','/:id/teams','removeTeams','removeAgents','exports','multer','util','path'];(function(_0x2c0bd0,_0x53d4b8){var _0x45ad30=function(_0x4bee1c){while(--_0x4bee1c){_0x2c0bd0['push'](_0x2c0bd0['shift']());}};_0x45ad30(++_0x53d4b8);}(_0x6985,0xb7));var _0x5698=function(_0x23267c,_0x1287ad){_0x23267c=_0x23267c-0x0;var _0x46deff=_0x6985[_0x23267c];return _0x46deff;};'use strict';var multer=require(_0x5698('0x0'));var util=require(_0x5698('0x1'));var path=require(_0x5698('0x2'));var timeout=require(_0x5698('0x3'));var express=require(_0x5698('0x4'));var router=express[_0x5698('0x5')]();var fs_extra=require(_0x5698('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5698('0x7'));var controller=require(_0x5698('0x8'));router[_0x5698('0x9')]('/',auth[_0x5698('0xa')](),controller[_0x5698('0xb')]);router['get'](_0x5698('0xc'),auth[_0x5698('0xa')](),controller[_0x5698('0xd')]);router[_0x5698('0x9')]('/:id',auth[_0x5698('0xa')](),controller[_0x5698('0xe')]);router[_0x5698('0x9')](_0x5698('0xf'),auth[_0x5698('0xa')](),controller[_0x5698('0x10')]);router[_0x5698('0x9')]('/:id/teams',auth[_0x5698('0xa')](),controller[_0x5698('0x11')]);router[_0x5698('0x9')](_0x5698('0x12'),auth[_0x5698('0xa')](),controller[_0x5698('0x13')]);router[_0x5698('0x14')]('/',auth[_0x5698('0xa')](),controller[_0x5698('0x15')]);router[_0x5698('0x14')]('/:id/teams',auth[_0x5698('0xa')](),controller[_0x5698('0x16')]);router['post'](_0x5698('0x12'),auth[_0x5698('0xa')](),controller['addAgents']);router['put'](_0x5698('0x17'),auth[_0x5698('0xa')](),controller[_0x5698('0x18')]);router[_0x5698('0x19')](_0x5698('0x17'),auth[_0x5698('0xa')](),controller[_0x5698('0x1a')]);router[_0x5698('0x19')](_0x5698('0x1b'),auth[_0x5698('0xa')](),controller[_0x5698('0x1c')]);router[_0x5698('0x19')](_0x5698('0x12'),auth[_0x5698('0xa')](),controller[_0x5698('0x1d')]);module[_0x5698('0x1e')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 668baea..19e4b6f 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 _0xcaf8=['INTEGER','beepall','STRING','name'];(function(_0x159c2f,_0xd39d20){var _0x591f68=function(_0x161ba6){while(--_0x161ba6){_0x159c2f['push'](_0x159c2f['shift']());}};_0x591f68(++_0xd39d20);}(_0xcaf8,0x11a));var _0x8caf=function(_0x4a17f7,_0x50e32c){_0x4a17f7=_0x4a17f7-0x0;var _0x58a045=_0xcaf8[_0x4a17f7];return _0x58a045;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x8caf('0x0')],'unique':_0x8caf('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x8caf('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0x8caf('0x3'),'roundrobin')}}; \ No newline at end of file +var _0x4b7b=['name','INTEGER','rrmemory','beepall','roundrobin','sequelize','exports','STRING'];(function(_0x32997d,_0x225578){var _0x401446=function(_0x2a7aa8){while(--_0x2a7aa8){_0x32997d['push'](_0x32997d['shift']());}};_0x401446(++_0x225578);}(_0x4b7b,0x19d));var _0xb4b7=function(_0x4d4e37,_0x183b97){_0x4d4e37=_0x4d4e37-0x0;var _0x3b7e2c=_0x4b7b[_0x4d4e37];return _0x3b7e2c;};'use strict';var Sequelize=require(_0xb4b7('0x0'));module[_0xb4b7('0x1')]={'name':{'type':Sequelize[_0xb4b7('0x2')],'unique':_0xb4b7('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xb4b7('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xb4b7('0x5'),_0xb4b7('0x6'),_0xb4b7('0x7'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 35b15c3..a73716d 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 _0xe568=['ut.UserId\x20=\x20?','push','sequelize','QueryTypes','SELECT','every','union','value','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','omit','spread','isArray','getAgents','order','zip-dir','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/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','status','end','json','offset','limit','undefined','Content-Range','reject','save','update','destroy','then','get','UserProfileResource','stack','name','send','index','map','fieldName','type','query','intersection','model','attributes','fields','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','OpenchannelQueue','count','includeAll','include','findAll','rows','catch','keys','length','find','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','OpenchannelQueues','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','rawAttributes','hasOwnProperty','OpenchannelQueueId','UserOpenchannelQueue','User','UserId','agent','openchannelPause','updatedAt','createdAt','%s/%s','SIP','getTeams','ids','Team','Agents','online','voicePause','interface','transaction','addTeams','each','forEach','emit','userOpenchannelQueue:save','removeTeams','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone'];(function(_0x5da7e1,_0x2ae2f8){var _0x4737d9=function(_0x240d89){while(--_0x240d89){_0x5da7e1['push'](_0x5da7e1['shift']());}};_0x4737d9(++_0x2ae2f8);}(_0xe568,0x12f));var _0x8e56=function(_0x3f52a1,_0x1aaa20){_0x3f52a1=_0x3f52a1-0x0;var _0xf98fb7=_0xe568[_0x3f52a1];return _0xf98fb7;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8e56('0x0'));var jsonpatch=require(_0x8e56('0x1'));var rp=require(_0x8e56('0x2'));var moment=require(_0x8e56('0x3'));var BPromise=require(_0x8e56('0x4'));var Mustache=require(_0x8e56('0x5'));var util=require(_0x8e56('0x6'));var path=require(_0x8e56('0x7'));var sox=require(_0x8e56('0x8'));var csv=require('to-csv');var ejs=require(_0x8e56('0x9'));var fs=require('fs');var fs_extra=require(_0x8e56('0xa'));var _=require(_0x8e56('0xb'));var squel=require(_0x8e56('0xc'));var crypto=require(_0x8e56('0xd'));var jsforce=require(_0x8e56('0xe'));var deskjs=require(_0x8e56('0xf'));var toCsv=require(_0x8e56('0x10'));var querystring=require(_0x8e56('0x11'));var Papa=require(_0x8e56('0x12'));var Redis=require(_0x8e56('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8e56('0x14'));var hardwareService=require(_0x8e56('0x15'));var logger=require(_0x8e56('0x16'))(_0x8e56('0x17'));var utils=require(_0x8e56('0x18'));var config=require(_0x8e56('0x19'));var licenseUtil=require(_0x8e56('0x1a'));var db=require(_0x8e56('0x1b'))['db'];config[_0x8e56('0x1c')]=_[_0x8e56('0x1d')](config[_0x8e56('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0x8e56('0x1e'))(new Redis(config[_0x8e56('0x1c')]));require('./openchannelQueue.socket')[_0x8e56('0x1f')](socket);function respondWithStatusCode(_0x14b8a0,_0x3b2418){_0x3b2418=_0x3b2418||0xcc;return function(_0x332dd2){if(_0x332dd2){return _0x14b8a0[_0x8e56('0x20')](_0x3b2418);}return _0x14b8a0[_0x8e56('0x21')](_0x3b2418)[_0x8e56('0x22')]();};}function respondWithResult(_0x4adb49,_0x12aaf9){_0x12aaf9=_0x12aaf9||0xc8;return function(_0x5b697c){if(_0x5b697c){return _0x4adb49[_0x8e56('0x21')](_0x12aaf9)[_0x8e56('0x23')](_0x5b697c);}};}function respondWithFilteredResult(_0x17e4f9,_0x3d8432){return function(_0x5659f0){if(_0x5659f0){var _0x5cd64b=typeof _0x3d8432[_0x8e56('0x24')]==='undefined'&&typeof _0x3d8432[_0x8e56('0x25')]===_0x8e56('0x26');var _0x356ff2=_0x5659f0['count'];var _0x2bf2a7=_0x5cd64b?0x0:_0x3d8432[_0x8e56('0x24')];var _0x41da8d=_0x5cd64b?_0x5659f0['count']:_0x3d8432[_0x8e56('0x24')]+_0x3d8432[_0x8e56('0x25')];var _0x319f91;if(_0x41da8d>=_0x356ff2){_0x41da8d=_0x356ff2;_0x319f91=0xc8;}else{_0x319f91=0xce;}_0x17e4f9['status'](_0x319f91);return _0x17e4f9['set'](_0x8e56('0x27'),_0x2bf2a7+'-'+_0x41da8d+'/'+_0x356ff2)['json'](_0x5659f0);}return null;};}function patchUpdates(_0x1d8f9d){return function(_0xb52d96){try{jsonpatch['apply'](_0xb52d96,_0x1d8f9d,!![]);}catch(_0x335356){return BPromise[_0x8e56('0x28')](_0x335356);}return _0xb52d96[_0x8e56('0x29')]();};}function saveUpdates(_0x5c1cb7,_0x16e1dc){return function(_0x36b10c){if(_0x36b10c){return _0x36b10c[_0x8e56('0x2a')](_0x5c1cb7)['then'](function(_0x5742f6){return _0x5742f6;});}return null;};}function removeEntity(_0x133d6a,_0x35dce1){return function(_0xcd731a){if(_0xcd731a){return _0xcd731a[_0x8e56('0x2b')]()[_0x8e56('0x2c')](function(){var _0x11f86e=_0xcd731a[_0x8e56('0x2d')]({'plain':!![]});var _0x3fa0ff='OpenchannelQueues';return db[_0x8e56('0x2e')][_0x8e56('0x2b')]({'where':{'type':_0x3fa0ff,'resourceId':_0x11f86e['id']}})[_0x8e56('0x2c')](function(){return _0xcd731a;});})[_0x8e56('0x2c')](function(){_0x133d6a[_0x8e56('0x21')](0xcc)[_0x8e56('0x22')]();});}};}function handleEntityNotFound(_0x481c9d,_0x397cfa){return function(_0x51dd8c){if(!_0x51dd8c){_0x481c9d[_0x8e56('0x20')](0x194);}return _0x51dd8c;};}function handleError(_0x2d79fe,_0x3fdee2){_0x3fdee2=_0x3fdee2||0x1f4;return function(_0x370525){logger['error'](_0x370525[_0x8e56('0x2f')]);if(_0x370525['name']){delete _0x370525[_0x8e56('0x30')];}_0x2d79fe[_0x8e56('0x21')](_0x3fdee2)[_0x8e56('0x31')](_0x370525);};}exports[_0x8e56('0x32')]=function(_0x21bab9,_0x270690){var _0x29c561={},_0x1f0fe2={},_0xdaec17={'count':0x0,'rows':[]};var _0x11252d=_[_0x8e56('0x33')](db['OpenchannelQueue']['rawAttributes'],function(_0x15d0be){return{'name':_0x15d0be[_0x8e56('0x34')],'type':_0x15d0be[_0x8e56('0x35')]['key']};});_0x1f0fe2['model']=_['map'](_0x11252d,'name');_0x1f0fe2[_0x8e56('0x36')]=_['keys'](_0x21bab9['query']);_0x1f0fe2['filters']=_[_0x8e56('0x37')](_0x1f0fe2[_0x8e56('0x38')],_0x1f0fe2[_0x8e56('0x36')]);_0x29c561[_0x8e56('0x39')]=_[_0x8e56('0x37')](_0x1f0fe2[_0x8e56('0x38')],qs[_0x8e56('0x3a')](_0x21bab9[_0x8e56('0x36')][_0x8e56('0x3a')]));_0x29c561[_0x8e56('0x39')]=_0x29c561['attributes']['length']?_0x29c561[_0x8e56('0x39')]:_0x1f0fe2[_0x8e56('0x38')];if(!_0x21bab9['query']['hasOwnProperty'](_0x8e56('0x3b'))){_0x29c561[_0x8e56('0x25')]=qs[_0x8e56('0x25')](_0x21bab9['query'][_0x8e56('0x25')]);_0x29c561[_0x8e56('0x24')]=qs[_0x8e56('0x24')](_0x21bab9['query'][_0x8e56('0x24')]);}_0x29c561['order']=qs[_0x8e56('0x3c')](_0x21bab9[_0x8e56('0x36')][_0x8e56('0x3c')]);_0x29c561[_0x8e56('0x3d')]=qs[_0x8e56('0x3e')](_[_0x8e56('0x3f')](_0x21bab9[_0x8e56('0x36')],_0x1f0fe2[_0x8e56('0x3e')]),_0x11252d);if(_0x21bab9[_0x8e56('0x36')][_0x8e56('0x40')]){_0x29c561[_0x8e56('0x3d')]=_[_0x8e56('0x41')](_0x29c561[_0x8e56('0x3d')],{'$or':_[_0x8e56('0x33')](_0x11252d,function(_0x4da3e0){if(_0x4da3e0['type']!==_0x8e56('0x42')){var _0x498f16={};_0x498f16[_0x4da3e0['name']]={'$like':'%'+_0x21bab9[_0x8e56('0x36')][_0x8e56('0x40')]+'%'};return _0x498f16;}})});}_0x29c561=_['merge']({},_0x29c561,_0x21bab9[_0x8e56('0x43')]);var _0x1ba9b2={'where':_0x29c561['where']};return db[_0x8e56('0x44')][_0x8e56('0x45')](_0x1ba9b2)[_0x8e56('0x2c')](function(_0x1e86c2){_0xdaec17['count']=_0x1e86c2;if(_0x21bab9[_0x8e56('0x36')][_0x8e56('0x46')]){_0x29c561[_0x8e56('0x47')]=[{'all':!![]}];}return db[_0x8e56('0x44')][_0x8e56('0x48')](_0x29c561);})['then'](function(_0x468001){_0xdaec17[_0x8e56('0x49')]=_0x468001;return _0xdaec17;})[_0x8e56('0x2c')](respondWithFilteredResult(_0x270690,_0x29c561))[_0x8e56('0x4a')](handleError(_0x270690,null));};exports['show']=function(_0x3e24f0,_0x561758){var _0x686d03={'raw':!![],'where':{'id':_0x3e24f0['params']['id']}},_0x1b7000={};_0x1b7000[_0x8e56('0x38')]=_['keys'](db[_0x8e56('0x44')]['rawAttributes']);_0x1b7000[_0x8e56('0x36')]=_[_0x8e56('0x4b')](_0x3e24f0[_0x8e56('0x36')]);_0x1b7000['filters']=_[_0x8e56('0x37')](_0x1b7000[_0x8e56('0x38')],_0x1b7000['query']);_0x686d03[_0x8e56('0x39')]=_['intersection'](_0x1b7000[_0x8e56('0x38')],qs[_0x8e56('0x3a')](_0x3e24f0[_0x8e56('0x36')][_0x8e56('0x3a')]));_0x686d03[_0x8e56('0x39')]=_0x686d03[_0x8e56('0x39')][_0x8e56('0x4c')]?_0x686d03[_0x8e56('0x39')]:_0x1b7000['model'];if(_0x3e24f0['query'][_0x8e56('0x46')]){_0x686d03['include']=[{'all':!![]}];}_0x686d03=_[_0x8e56('0x41')]({},_0x686d03,_0x3e24f0[_0x8e56('0x43')]);return db['OpenchannelQueue'][_0x8e56('0x4d')](_0x686d03)[_0x8e56('0x2c')](handleEntityNotFound(_0x561758,null))[_0x8e56('0x2c')](respondWithResult(_0x561758,null))[_0x8e56('0x4a')](handleError(_0x561758,null));};exports['create']=function(_0x1a9d24,_0x3a5699){return db['OpenchannelQueue']['create'](_0x1a9d24[_0x8e56('0x4e')],{})['then'](function(_0x515e27){var _0x2806c1=_0x1a9d24['user']['get']({'plain':!![]});if(!_0x2806c1)throw new Error(_0x8e56('0x4f'));if(_0x2806c1[_0x8e56('0x50')]===_0x8e56('0x51')){var _0x3bbc27=_0x515e27['get']({'plain':!![]});var _0x2ae1b3=_0x8e56('0x52');return db[_0x8e56('0x53')][_0x8e56('0x4d')]({'where':{'name':_0x2ae1b3,'userProfileId':_0x2806c1['userProfileId']},'raw':!![]})[_0x8e56('0x2c')](function(_0xbc0364){if(_0xbc0364&&_0xbc0364[_0x8e56('0x54')]===0x0){return db[_0x8e56('0x2e')]['create']({'name':_0x3bbc27[_0x8e56('0x30')],'resourceId':_0x3bbc27['id'],'type':_0xbc0364[_0x8e56('0x30')],'sectionId':_0xbc0364['id']},{})[_0x8e56('0x2c')](function(){return _0x515e27;});}else{return _0x515e27;}})[_0x8e56('0x4a')](function(_0x1c2ce6){logger[_0x8e56('0x55')](_0x8e56('0x56'),_0x1c2ce6);throw _0x1c2ce6;});}return _0x515e27;})['then'](respondWithResult(_0x3a5699,0xc9))[_0x8e56('0x4a')](handleError(_0x3a5699,null));};exports[_0x8e56('0x2a')]=function(_0x12b379,_0xaafef2){if(_0x12b379['body']['id']){delete _0x12b379[_0x8e56('0x4e')]['id'];}return db['OpenchannelQueue'][_0x8e56('0x4d')]({'where':{'id':_0x12b379[_0x8e56('0x57')]['id']}})[_0x8e56('0x2c')](handleEntityNotFound(_0xaafef2,null))[_0x8e56('0x2c')](saveUpdates(_0x12b379[_0x8e56('0x4e')],null))[_0x8e56('0x2c')](respondWithResult(_0xaafef2,null))[_0x8e56('0x4a')](handleError(_0xaafef2,null));};exports['destroy']=function(_0x2f68b4,_0x55a4af){return db[_0x8e56('0x44')][_0x8e56('0x4d')]({'where':{'id':_0x2f68b4[_0x8e56('0x57')]['id']}})[_0x8e56('0x2c')](handleEntityNotFound(_0x55a4af,null))[_0x8e56('0x2c')](removeEntity(_0x55a4af,null))['catch'](handleError(_0x55a4af,null));};exports[_0x8e56('0x58')]=function(_0x47d1e6,_0x557c7c){return db[_0x8e56('0x44')][_0x8e56('0x58')]()[_0x8e56('0x2c')](respondWithResult(_0x557c7c,null))[_0x8e56('0x4a')](handleError(_0x557c7c,null));};exports[_0x8e56('0x59')]=function(_0x11b07b,_0x5d6d1e,_0x5675f1){var _0x4e19e0={'raw':!![],'where':{}},_0x2e82bb={},_0x4f18f0;return db[_0x8e56('0x44')][_0x8e56('0x5a')]({'where':{'id':_0x11b07b[_0x8e56('0x57')]['id']}})['then'](handleEntityNotFound(_0x5d6d1e,null))[_0x8e56('0x2c')](function(_0x1b6e37){if(_0x1b6e37){_0x4f18f0=_0x1b6e37['get']({'plain':!![]});_0x2e82bb[_0x8e56('0x38')]=_[_0x8e56('0x4b')](db['UserOpenchannelQueue'][_0x8e56('0x5b')]);_0x2e82bb[_0x8e56('0x36')]=_[_0x8e56('0x4b')](_0x11b07b[_0x8e56('0x36')]);_0x2e82bb['filters']=_['intersection'](_0x2e82bb[_0x8e56('0x38')],_0x2e82bb[_0x8e56('0x36')]);_0x4e19e0[_0x8e56('0x39')]=_[_0x8e56('0x37')](_0x2e82bb[_0x8e56('0x38')],qs[_0x8e56('0x3a')](_0x11b07b[_0x8e56('0x36')]['fields']));_0x4e19e0[_0x8e56('0x39')]=_0x4e19e0[_0x8e56('0x39')][_0x8e56('0x4c')]?_0x4e19e0[_0x8e56('0x39')]:_0x2e82bb['model'];if(!_0x11b07b[_0x8e56('0x36')][_0x8e56('0x5c')](_0x8e56('0x3b'))){_0x4e19e0[_0x8e56('0x25')]=qs['limit'](_0x11b07b['query'][_0x8e56('0x25')]);_0x4e19e0[_0x8e56('0x24')]=qs[_0x8e56('0x24')](_0x11b07b[_0x8e56('0x36')]['offset']);}_0x4e19e0['order']=qs[_0x8e56('0x3c')](_0x11b07b[_0x8e56('0x36')]['sort']);_0x4e19e0[_0x8e56('0x3d')]=qs[_0x8e56('0x3e')](_[_0x8e56('0x3f')](_0x11b07b[_0x8e56('0x36')],_0x2e82bb[_0x8e56('0x3e')]));_0x4e19e0[_0x8e56('0x3d')][_0x8e56('0x5d')]=_0x1b6e37['id'];if(_0x11b07b[_0x8e56('0x36')]['filter']){_0x4e19e0['where']=_[_0x8e56('0x41')](_0x4e19e0['where'],{'$or':_[_0x8e56('0x33')](_0x4e19e0['attributes'],function(_0x3cb1e7){var _0x346f30={};_0x346f30[_0x3cb1e7]={'$like':'%'+_0x11b07b[_0x8e56('0x36')][_0x8e56('0x40')]+'%'};return _0x346f30;})});}_0x4e19e0=_[_0x8e56('0x41')]({},_0x4e19e0,_0x11b07b['options']);return db[_0x8e56('0x5e')][_0x8e56('0x48')](_0x4e19e0);}})[_0x8e56('0x2c')](function(_0x2356da){if(_0x2356da){return db[_0x8e56('0x5f')]['findAndCountAll']({'where':{'id':_[_0x8e56('0x33')](_0x2356da,_0x8e56('0x60')),'role':_0x8e56('0x61')},'attributes':['id',_0x8e56('0x30'),_0x8e56('0x62'),_0x8e56('0x63'),_0x8e56('0x64')]});}})[_0x8e56('0x2c')](function(_0x5885f6){if(_0x5885f6){return{'count':_0x5885f6[_0x8e56('0x45')],'rows':_[_0x8e56('0x33')](_0x5885f6[_0x8e56('0x49')],function(_0xc808ad){return{'membername':_0xc808ad['name'],'UserId':_0xc808ad['id'],'queue_name':_0x4f18f0[_0x8e56('0x30')],'OpenchannelQueueId':_0x4f18f0['id'],'interface':util['format'](_0x8e56('0x65'),_0x8e56('0x66'),_0xc808ad['name']),'penalty':0x0,'paused':_0xc808ad['openchannelPause'],'createdAt':_0xc808ad[_0x8e56('0x64')],'updatedAt':_0xc808ad[_0x8e56('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x5d6d1e,_0x4e19e0))[_0x8e56('0x4a')](handleError(_0x5d6d1e,null));};exports[_0x8e56('0x67')]=function(_0xb94e55,_0x491e95,_0x394b82){var _0x455285={};var _0x3d625d={};var _0x419a35;var _0x36242d;return db[_0x8e56('0x44')][_0x8e56('0x5a')]({'where':{'id':_0xb94e55[_0x8e56('0x57')]['id']}})[_0x8e56('0x2c')](handleEntityNotFound(_0x491e95,null))[_0x8e56('0x2c')](function(_0x3829e2){if(_0x3829e2){_0x419a35=_0x3829e2;_0x3d625d[_0x8e56('0x38')]=_[_0x8e56('0x4b')](db['Team'][_0x8e56('0x5b')]);_0x3d625d[_0x8e56('0x36')]=_['keys'](_0xb94e55[_0x8e56('0x36')]);_0x3d625d[_0x8e56('0x3e')]=_[_0x8e56('0x37')](_0x3d625d[_0x8e56('0x38')],_0x3d625d[_0x8e56('0x36')]);_0x455285[_0x8e56('0x39')]=_['intersection'](_0x3d625d[_0x8e56('0x38')],qs[_0x8e56('0x3a')](_0xb94e55['query'][_0x8e56('0x3a')]));_0x455285['attributes']=_0x455285[_0x8e56('0x39')][_0x8e56('0x4c')]?_0x455285[_0x8e56('0x39')]:_0x3d625d[_0x8e56('0x38')];_0x455285['order']=qs[_0x8e56('0x3c')](_0xb94e55[_0x8e56('0x36')][_0x8e56('0x3c')]);_0x455285['where']=qs['filters'](_[_0x8e56('0x3f')](_0xb94e55['query'],_0x3d625d[_0x8e56('0x3e')]));if(_0xb94e55[_0x8e56('0x36')][_0x8e56('0x40')]){_0x455285[_0x8e56('0x3d')]=_['merge'](_0x455285[_0x8e56('0x3d')],{'$or':_['map'](_0x455285[_0x8e56('0x39')],function(_0x42b2c8){var _0x31b7df={};_0x31b7df[_0x42b2c8]={'$like':'%'+_0xb94e55[_0x8e56('0x36')][_0x8e56('0x40')]+'%'};return _0x31b7df;})});}_0x455285=_[_0x8e56('0x41')]({},_0x455285,_0xb94e55[_0x8e56('0x43')]);return _0x419a35[_0x8e56('0x67')](_0x455285);}})[_0x8e56('0x2c')](function(_0x174cbf){if(_0x174cbf){_0x36242d=_0x174cbf[_0x8e56('0x4c')];if(!_0xb94e55[_0x8e56('0x36')][_0x8e56('0x5c')](_0x8e56('0x3b'))){_0x455285['limit']=qs[_0x8e56('0x25')](_0xb94e55[_0x8e56('0x36')][_0x8e56('0x25')]);_0x455285[_0x8e56('0x24')]=qs[_0x8e56('0x24')](_0xb94e55[_0x8e56('0x36')]['offset']);}return _0x419a35[_0x8e56('0x67')](_0x455285);}})['then'](function(_0x6bee63){if(_0x6bee63){return _0x6bee63?{'count':_0x36242d,'rows':_0x6bee63}:null;}})[_0x8e56('0x2c')](respondWithResult(_0x491e95,null))[_0x8e56('0x4a')](handleError(_0x491e95,null));};exports['addTeams']=function(_0x33550e,_0x3161e7,_0x61bd58){var _0x4948c9=_0x33550e[_0x8e56('0x4e')][_0x8e56('0x68')];return db[_0x8e56('0x69')][_0x8e56('0x48')]({'where':{'id':_0x4948c9},'attributes':['id'],'include':[{'model':db[_0x8e56('0x5f')],'as':_0x8e56('0x6a'),'attributes':['id','name',_0x8e56('0x6b'),_0x8e56('0x6c'),_0x8e56('0x6d')],'raw':!![]}]})[_0x8e56('0x2c')](function(_0x101d8c){if(_0x101d8c){var _0x51e15c=_['flatMap'](_0x101d8c,function(_0x42f242){var _0x3f6d2b=_0x42f242[_0x8e56('0x2d')]({'plain':!![]});return _0x3f6d2b['Agents'];});return db[_0x8e56('0x44')][_0x8e56('0x4d')]({'where':{'id':_0x33550e['params']['id']}})[_0x8e56('0x2c')](function(_0x5f0441){return db['sequelize'][_0x8e56('0x6e')](function(_0x550885){return _0x5f0441[_0x8e56('0x6f')](_0x4948c9,{'transaction':_0x550885})['then'](function(){return BPromise[_0x8e56('0x70')](_0x51e15c,function(_0x5695eb){return db['UserOpenchannelQueue']['findOrCreate']({'where':{'UserId':_0x5695eb['id'],'OpenchannelQueueId':_0x33550e[_0x8e56('0x57')]['id']},'transaction':_0x550885});});})['then'](function(){_0x51e15c[_0x8e56('0x71')](function(_0x8a4156){socket[_0x8e56('0x72')](_0x8e56('0x73'),{'UserId':_0x8a4156['id'],'OpenchannelQueueId':_0x5f0441['id']});});});});});}})[_0x8e56('0x2c')](respondWithStatusCode(_0x3161e7,null))[_0x8e56('0x4a')](handleError(_0x3161e7,null));};exports[_0x8e56('0x74')]=function(_0xda6e03,_0x54fbac,_0x1bca27){return db[_0x8e56('0x69')][_0x8e56('0x48')]({'where':{'id':_0xda6e03[_0x8e56('0x36')][_0x8e56('0x68')]},'attributes':['id'],'include':[{'model':db[_0x8e56('0x5f')],'as':_0x8e56('0x6a'),'attributes':['id'],'raw':!![]}]})[_0x8e56('0x2c')](handleEntityNotFound(_0x54fbac,null))['then'](function(_0x4dafcf){var _0x12112f=_[_0x8e56('0x33')](_0x4dafcf,'id');var _0x9bab47=[];var _0x254c45=[];var _0x9589eb=squel[_0x8e56('0x75')]();_0x9589eb[_0x8e56('0x76')](_0x8e56('0x77'))[_0x8e56('0x78')]('team_has_openchannel_queues','tq')[_0x8e56('0x79')](_0x8e56('0x7a'),'ut',_0x8e56('0x7b'))[_0x8e56('0x3d')](_0x8e56('0x7c'),_0xda6e03[_0x8e56('0x57')]['id']);for(var _0x35368c=0x0;_0x35368c<_0x4dafcf[_0x8e56('0x4c')];_0x35368c+=0x1){let _0x1905fa=_0x4dafcf[_0x35368c];for(var _0x53745e=0x0;_0x53745e<_0x1905fa[_0x8e56('0x6a')][_0x8e56('0x4c')];_0x53745e+=0x1){let _0x406f0e=_0x1905fa['Agents'][_0x53745e];var _0x4e4c1b=_0x9589eb[_0x8e56('0x7d')]();_0x4e4c1b[_0x8e56('0x3d')](_0x8e56('0x7e'),_0x406f0e['id']);_0x254c45[_0x8e56('0x7f')](db[_0x8e56('0x80')][_0x8e56('0x36')](_0x4e4c1b['toString'](),{'type':db[_0x8e56('0x80')][_0x8e56('0x81')][_0x8e56('0x82')]})['then'](function(_0x37dae6){if(_0x37dae6[_0x8e56('0x4c')]===0x1){return _0x406f0e['id'];}else{var _0x4ceb82=_[_0x8e56('0x83')](_[_0x8e56('0x33')](_0x37dae6,'TeamId'),function(_0x61d4cf){return _['includes'](_0x12112f,_0x61d4cf);});if(_0x4ceb82){return _0x406f0e['id'];}}}));}}return BPromise['all'](_0x254c45)[_0x8e56('0x2c')](function(_0x535852){_0x9bab47=_(_0x9bab47)[_0x8e56('0x84')](_0x535852)['compact']()[_0x8e56('0x85')]();return db['OpenchannelQueue'][_0x8e56('0x4d')]({'where':{'id':_0xda6e03[_0x8e56('0x57')]['id']}})[_0x8e56('0x2c')](function(_0x339fe5){return db[_0x8e56('0x80')]['transaction'](function(_0x205a6d){return _0x339fe5[_0x8e56('0x74')](_0xda6e03[_0x8e56('0x36')][_0x8e56('0x68')],{'transaction':_0x205a6d})[_0x8e56('0x2c')](function(){if(!_[_0x8e56('0x86')](_0x9bab47)){return _0x339fe5[_0x8e56('0x87')](_0x9bab47,{'transaction':_0x205a6d});}})[_0x8e56('0x2c')](function(){_0x9bab47[_0x8e56('0x71')](function(_0x33c2b4){socket[_0x8e56('0x72')](_0x8e56('0x88'),{'UserId':_0x33c2b4,'OpenchannelQueueId':_0x339fe5['id']});});});});});});})['then'](respondWithStatusCode(_0x54fbac,null))[_0x8e56('0x4a')](handleError(_0x54fbac,null));};exports[_0x8e56('0x89')]=function(_0xcbcc6f,_0x3598d2,_0x27e1d7){return db[_0x8e56('0x44')][_0x8e56('0x4d')]({'where':{'id':_0xcbcc6f[_0x8e56('0x57')]['id']}})['then'](handleEntityNotFound(_0x3598d2,null))[_0x8e56('0x2c')](function(_0x41f1de){if(_0x41f1de){return _0x41f1de['addAgents'](_0xcbcc6f[_0x8e56('0x4e')][_0x8e56('0x68')],_[_0x8e56('0x8a')](_0xcbcc6f[_0x8e56('0x4e')],[_0x8e56('0x68'),'id'])||{})[_0x8e56('0x8b')](function(_0x488147){for(var _0xf61325=0x0;_0xf61325<_0xcbcc6f['body'][_0x8e56('0x68')][_0x8e56('0x4c')];_0xf61325+=0x1){socket['emit']('userOpenchannelQueue:save',{'UserId':Number(_0xcbcc6f[_0x8e56('0x4e')][_0x8e56('0x68')][_0xf61325]),'OpenchannelQueueId':Number(_0xcbcc6f[_0x8e56('0x57')]['id'])});}return _0x488147;});}})[_0x8e56('0x2c')](respondWithResult(_0x3598d2,null))[_0x8e56('0x4a')](handleError(_0x3598d2,null));};exports[_0x8e56('0x87')]=function(_0x80200d,_0x15da60,_0x2af053){return db['OpenchannelQueue'][_0x8e56('0x4d')]({'where':{'id':_0x80200d[_0x8e56('0x57')]['id']}})[_0x8e56('0x2c')](handleEntityNotFound(_0x15da60,null))[_0x8e56('0x2c')](function(_0x3cb6cb){if(_0x3cb6cb){return _0x3cb6cb[_0x8e56('0x87')](_0x80200d['query']['ids'])['then'](function(){if(_[_0x8e56('0x8c')](_0x80200d[_0x8e56('0x36')]['ids'])){for(var _0x525d9e=0x0;_0x525d9e<_0x80200d['query'][_0x8e56('0x68')][_0x8e56('0x4c')];_0x525d9e+=0x1){socket[_0x8e56('0x72')]('userOpenchannelQueue:remove',{'UserId':Number(_0x80200d['query'][_0x8e56('0x68')][_0x525d9e]),'OpenchannelQueueId':Number(_0x80200d['params']['id'])});}}else{socket['emit'](_0x8e56('0x88'),{'UserId':Number(_0x80200d[_0x8e56('0x36')][_0x8e56('0x68')]),'OpenchannelQueueId':Number(_0x80200d[_0x8e56('0x57')]['id'])});}});}})['then'](respondWithStatusCode(_0x15da60,null))['catch'](handleError(_0x15da60,null));};exports[_0x8e56('0x8d')]=function(_0x643cb5,_0x5bfcd2,_0xf7224){var _0x87491e={};var _0x3041fe={};var _0x30b742;var _0x27a0c3;return db[_0x8e56('0x44')][_0x8e56('0x5a')]({'where':{'id':_0x643cb5[_0x8e56('0x57')]['id']}})['then'](handleEntityNotFound(_0x5bfcd2,null))[_0x8e56('0x2c')](function(_0x5b9142){if(_0x5b9142){_0x30b742=_0x5b9142;_0x3041fe[_0x8e56('0x38')]=_[_0x8e56('0x4b')](db[_0x8e56('0x5f')]['rawAttributes']);_0x3041fe[_0x8e56('0x36')]=_[_0x8e56('0x4b')](_0x643cb5[_0x8e56('0x36')]);_0x3041fe['filters']=_[_0x8e56('0x37')](_0x3041fe['model'],_0x3041fe['query']);_0x87491e['attributes']=_[_0x8e56('0x37')](_0x3041fe[_0x8e56('0x38')],qs[_0x8e56('0x3a')](_0x643cb5[_0x8e56('0x36')][_0x8e56('0x3a')]));_0x87491e[_0x8e56('0x39')]=_0x87491e[_0x8e56('0x39')][_0x8e56('0x4c')]?_0x87491e['attributes']:_0x3041fe[_0x8e56('0x38')];_0x87491e[_0x8e56('0x8e')]=qs[_0x8e56('0x3c')](_0x643cb5[_0x8e56('0x36')][_0x8e56('0x3c')]);_0x87491e[_0x8e56('0x3d')]=qs['filters'](_[_0x8e56('0x3f')](_0x643cb5[_0x8e56('0x36')],_0x3041fe[_0x8e56('0x3e')]));if(_0x643cb5[_0x8e56('0x36')][_0x8e56('0x40')]){_0x87491e[_0x8e56('0x3d')]=_[_0x8e56('0x41')](_0x87491e[_0x8e56('0x3d')],{'$or':_['map'](_0x87491e[_0x8e56('0x39')],function(_0x15e549){var _0x55ad46={};_0x55ad46[_0x15e549]={'$like':'%'+_0x643cb5[_0x8e56('0x36')][_0x8e56('0x40')]+'%'};return _0x55ad46;})});}_0x87491e=_[_0x8e56('0x41')]({},_0x87491e,_0x643cb5[_0x8e56('0x43')]);return _0x30b742['getAgents'](_0x87491e);}})[_0x8e56('0x2c')](function(_0x54b514){if(_0x54b514){_0x27a0c3=_0x54b514[_0x8e56('0x4c')];if(!_0x643cb5[_0x8e56('0x36')][_0x8e56('0x5c')](_0x8e56('0x3b'))){_0x87491e[_0x8e56('0x25')]=qs[_0x8e56('0x25')](_0x643cb5['query']['limit']);_0x87491e[_0x8e56('0x24')]=qs[_0x8e56('0x24')](_0x643cb5[_0x8e56('0x36')][_0x8e56('0x24')]);}return _0x30b742['getAgents'](_0x87491e);}})[_0x8e56('0x2c')](function(_0x10ca83){if(_0x10ca83){return _0x10ca83?{'count':_0x27a0c3,'rows':_0x10ca83}:null;}})[_0x8e56('0x2c')](respondWithResult(_0x5bfcd2,null))[_0x8e56('0x4a')](handleError(_0x5bfcd2,null));}; \ No newline at end of file +var _0x8513=['include','options','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserOpenchannelQueue','nolimit','order','filter','User','findAndCountAll','UserId','agent','openchannelPause','createdAt','format','%s/%s','SIP','findOne','getTeams','ids','Team','interface','flatMap','Agents','sequelize','transaction','addTeams','each','findOrCreate','forEach','userOpenchannelQueue:save','removeTeams','select','from','user_has_teams','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','emit','userOpenchannelQueue:remove','addAgents','body','omit','getAgents','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','defaults','redis','localhost','./openchannelQueue.socket','register','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','get','OpenchannelQueues','UserProfileResource','destroy','end','error','stack','name','send','index','map','OpenchannelQueue','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','filters','pick','VIRTUAL','merge','includeAll','findAll','rows','show','params'];(function(_0x2df0d4,_0x488fd1){var _0xac3b87=function(_0x20b1cb){while(--_0x20b1cb){_0x2df0d4['push'](_0x2df0d4['shift']());}};_0xac3b87(++_0x488fd1);}(_0x8513,0xc8));var _0x3851=function(_0x292de9,_0x1b07d2){_0x292de9=_0x292de9-0x0;var _0x12a72a=_0x8513[_0x292de9];return _0x12a72a;};'use strict';var emlformat=require(_0x3851('0x0'));var rimraf=require(_0x3851('0x1'));var zipdir=require(_0x3851('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3851('0x3'));var Mustache=require(_0x3851('0x4'));var util=require(_0x3851('0x5'));var path=require(_0x3851('0x6'));var sox=require(_0x3851('0x7'));var csv=require(_0x3851('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3851('0x9'));var _=require(_0x3851('0xa'));var squel=require('squel');var crypto=require(_0x3851('0xb'));var jsforce=require(_0x3851('0xc'));var deskjs=require(_0x3851('0xd'));var toCsv=require(_0x3851('0x8'));var querystring=require(_0x3851('0xe'));var Papa=require('papaparse');var Redis=require(_0x3851('0xf'));var authService=require(_0x3851('0x10'));var qs=require(_0x3851('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3851('0x12'));var logger=require(_0x3851('0x13'))(_0x3851('0x14'));var utils=require('../../config/utils');var config=require(_0x3851('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x3851('0x16')](config[_0x3851('0x17')],{'host':_0x3851('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3851('0x17')]));require(_0x3851('0x19'))[_0x3851('0x1a')](socket);function respondWithStatusCode(_0x2420e7,_0x448c51){_0x448c51=_0x448c51||0xcc;return function(_0x3d426e){if(_0x3d426e){return _0x2420e7[_0x3851('0x1b')](_0x448c51);}return _0x2420e7[_0x3851('0x1c')](_0x448c51)['end']();};}function respondWithResult(_0x583580,_0x2077d0){_0x2077d0=_0x2077d0||0xc8;return function(_0x46046d){if(_0x46046d){return _0x583580[_0x3851('0x1c')](_0x2077d0)['json'](_0x46046d);}};}function respondWithFilteredResult(_0x44a8f6,_0x1f62e8){return function(_0x53ad48){if(_0x53ad48){var _0x153154=typeof _0x1f62e8[_0x3851('0x1d')]===_0x3851('0x1e')&&typeof _0x1f62e8[_0x3851('0x1f')]==='undefined';var _0x4b879a=_0x53ad48['count'];var _0x3ef5f2=_0x153154?0x0:_0x1f62e8['offset'];var _0x1cf43c=_0x153154?_0x53ad48[_0x3851('0x20')]:_0x1f62e8[_0x3851('0x1d')]+_0x1f62e8['limit'];var _0x4c0158;if(_0x1cf43c>=_0x4b879a){_0x1cf43c=_0x4b879a;_0x4c0158=0xc8;}else{_0x4c0158=0xce;}_0x44a8f6[_0x3851('0x1c')](_0x4c0158);return _0x44a8f6[_0x3851('0x21')](_0x3851('0x22'),_0x3ef5f2+'-'+_0x1cf43c+'/'+_0x4b879a)[_0x3851('0x23')](_0x53ad48);}return null;};}function patchUpdates(_0xfa65d0){return function(_0x9281a4){try{jsonpatch['apply'](_0x9281a4,_0xfa65d0,!![]);}catch(_0x16636e){return BPromise[_0x3851('0x24')](_0x16636e);}return _0x9281a4[_0x3851('0x25')]();};}function saveUpdates(_0x352a2d,_0x456ca0){return function(_0x3c0732){if(_0x3c0732){return _0x3c0732[_0x3851('0x26')](_0x352a2d)[_0x3851('0x27')](function(_0x52e21e){return _0x52e21e;});}return null;};}function removeEntity(_0x1f6206,_0xe6c5c0){return function(_0x1efcaa){if(_0x1efcaa){return _0x1efcaa['destroy']()[_0x3851('0x27')](function(){var _0x9b76fb=_0x1efcaa[_0x3851('0x28')]({'plain':!![]});var _0x1c120b=_0x3851('0x29');return db[_0x3851('0x2a')][_0x3851('0x2b')]({'where':{'type':_0x1c120b,'resourceId':_0x9b76fb['id']}})[_0x3851('0x27')](function(){return _0x1efcaa;});})[_0x3851('0x27')](function(){_0x1f6206[_0x3851('0x1c')](0xcc)[_0x3851('0x2c')]();});}};}function handleEntityNotFound(_0x4151d0,_0x31c6ba){return function(_0x3190ca){if(!_0x3190ca){_0x4151d0['sendStatus'](0x194);}return _0x3190ca;};}function handleError(_0x500fdb,_0x4c97d7){_0x4c97d7=_0x4c97d7||0x1f4;return function(_0x55917c){logger[_0x3851('0x2d')](_0x55917c[_0x3851('0x2e')]);if(_0x55917c['name']){delete _0x55917c[_0x3851('0x2f')];}_0x500fdb[_0x3851('0x1c')](_0x4c97d7)[_0x3851('0x30')](_0x55917c);};}exports[_0x3851('0x31')]=function(_0x4eb337,_0xfe1c07){var _0x218b97={},_0x2f400d={},_0x9ab08e={'count':0x0,'rows':[]};var _0x3a985f=_[_0x3851('0x32')](db[_0x3851('0x33')][_0x3851('0x34')],function(_0x23e15c){return{'name':_0x23e15c[_0x3851('0x35')],'type':_0x23e15c[_0x3851('0x36')]['key']};});_0x2f400d['model']=_[_0x3851('0x32')](_0x3a985f,_0x3851('0x2f'));_0x2f400d[_0x3851('0x37')]=_[_0x3851('0x38')](_0x4eb337[_0x3851('0x37')]);_0x2f400d['filters']=_[_0x3851('0x39')](_0x2f400d[_0x3851('0x3a')],_0x2f400d[_0x3851('0x37')]);_0x218b97[_0x3851('0x3b')]=_['intersection'](_0x2f400d[_0x3851('0x3a')],qs[_0x3851('0x3c')](_0x4eb337[_0x3851('0x37')]['fields']));_0x218b97[_0x3851('0x3b')]=_0x218b97[_0x3851('0x3b')][_0x3851('0x3d')]?_0x218b97[_0x3851('0x3b')]:_0x2f400d['model'];if(!_0x4eb337['query'][_0x3851('0x3e')]('nolimit')){_0x218b97[_0x3851('0x1f')]=qs[_0x3851('0x1f')](_0x4eb337['query']['limit']);_0x218b97['offset']=qs[_0x3851('0x1d')](_0x4eb337[_0x3851('0x37')][_0x3851('0x1d')]);}_0x218b97['order']=qs[_0x3851('0x3f')](_0x4eb337[_0x3851('0x37')][_0x3851('0x3f')]);_0x218b97[_0x3851('0x40')]=qs[_0x3851('0x41')](_[_0x3851('0x42')](_0x4eb337[_0x3851('0x37')],_0x2f400d[_0x3851('0x41')]),_0x3a985f);if(_0x4eb337[_0x3851('0x37')]['filter']){_0x218b97[_0x3851('0x40')]=_['merge'](_0x218b97[_0x3851('0x40')],{'$or':_[_0x3851('0x32')](_0x3a985f,function(_0x1273b4){if(_0x1273b4['type']!==_0x3851('0x43')){var _0x1c760e={};_0x1c760e[_0x1273b4[_0x3851('0x2f')]]={'$like':'%'+_0x4eb337[_0x3851('0x37')]['filter']+'%'};return _0x1c760e;}})});}_0x218b97=_[_0x3851('0x44')]({},_0x218b97,_0x4eb337['options']);var _0x3c8753={'where':_0x218b97[_0x3851('0x40')]};return db[_0x3851('0x33')][_0x3851('0x20')](_0x3c8753)[_0x3851('0x27')](function(_0x30fc05){_0x9ab08e[_0x3851('0x20')]=_0x30fc05;if(_0x4eb337[_0x3851('0x37')][_0x3851('0x45')]){_0x218b97['include']=[{'all':!![]}];}return db[_0x3851('0x33')][_0x3851('0x46')](_0x218b97);})['then'](function(_0xad3351){_0x9ab08e[_0x3851('0x47')]=_0xad3351;return _0x9ab08e;})['then'](respondWithFilteredResult(_0xfe1c07,_0x218b97))['catch'](handleError(_0xfe1c07,null));};exports[_0x3851('0x48')]=function(_0x29bb07,_0xe55ed9){var _0x207a03={'raw':!![],'where':{'id':_0x29bb07[_0x3851('0x49')]['id']}},_0x3314e1={};_0x3314e1[_0x3851('0x3a')]=_[_0x3851('0x38')](db[_0x3851('0x33')][_0x3851('0x34')]);_0x3314e1[_0x3851('0x37')]=_[_0x3851('0x38')](_0x29bb07[_0x3851('0x37')]);_0x3314e1[_0x3851('0x41')]=_[_0x3851('0x39')](_0x3314e1[_0x3851('0x3a')],_0x3314e1[_0x3851('0x37')]);_0x207a03[_0x3851('0x3b')]=_['intersection'](_0x3314e1[_0x3851('0x3a')],qs['fields'](_0x29bb07[_0x3851('0x37')][_0x3851('0x3c')]));_0x207a03[_0x3851('0x3b')]=_0x207a03[_0x3851('0x3b')][_0x3851('0x3d')]?_0x207a03[_0x3851('0x3b')]:_0x3314e1['model'];if(_0x29bb07[_0x3851('0x37')][_0x3851('0x45')]){_0x207a03[_0x3851('0x4a')]=[{'all':!![]}];}_0x207a03=_[_0x3851('0x44')]({},_0x207a03,_0x29bb07[_0x3851('0x4b')]);return db[_0x3851('0x33')][_0x3851('0x4c')](_0x207a03)[_0x3851('0x27')](handleEntityNotFound(_0xe55ed9,null))[_0x3851('0x27')](respondWithResult(_0xe55ed9,null))[_0x3851('0x4d')](handleError(_0xe55ed9,null));};exports[_0x3851('0x4e')]=function(_0x329d08,_0x5acd26){return db['OpenchannelQueue'][_0x3851('0x4e')](_0x329d08['body'],{})[_0x3851('0x27')](function(_0x360099){var _0x5b3309=_0x329d08[_0x3851('0x4f')]['get']({'plain':!![]});if(!_0x5b3309)throw new Error(_0x3851('0x50'));if(_0x5b3309[_0x3851('0x51')]===_0x3851('0x4f')){var _0xe56189=_0x360099['get']({'plain':!![]});var _0x1f5eb1=_0x3851('0x29');return db['UserProfileSection']['find']({'where':{'name':_0x1f5eb1,'userProfileId':_0x5b3309[_0x3851('0x52')]},'raw':!![]})[_0x3851('0x27')](function(_0x1bbf10){if(_0x1bbf10&&_0x1bbf10['autoAssociation']===0x0){return db['UserProfileResource'][_0x3851('0x4e')]({'name':_0xe56189[_0x3851('0x2f')],'resourceId':_0xe56189['id'],'type':_0x1bbf10[_0x3851('0x2f')],'sectionId':_0x1bbf10['id']},{})[_0x3851('0x27')](function(){return _0x360099;});}else{return _0x360099;}})['catch'](function(_0x325f29){logger[_0x3851('0x2d')](_0x3851('0x53'),_0x325f29);throw _0x325f29;});}return _0x360099;})[_0x3851('0x27')](respondWithResult(_0x5acd26,0xc9))[_0x3851('0x4d')](handleError(_0x5acd26,null));};exports['update']=function(_0x374f51,_0x1b4c00){if(_0x374f51['body']['id']){delete _0x374f51['body']['id'];}return db[_0x3851('0x33')]['find']({'where':{'id':_0x374f51[_0x3851('0x49')]['id']}})[_0x3851('0x27')](handleEntityNotFound(_0x1b4c00,null))[_0x3851('0x27')](saveUpdates(_0x374f51['body'],null))[_0x3851('0x27')](respondWithResult(_0x1b4c00,null))['catch'](handleError(_0x1b4c00,null));};exports['destroy']=function(_0x127647,_0x32d78a){return db['OpenchannelQueue'][_0x3851('0x4c')]({'where':{'id':_0x127647[_0x3851('0x49')]['id']}})[_0x3851('0x27')](handleEntityNotFound(_0x32d78a,null))[_0x3851('0x27')](removeEntity(_0x32d78a,null))['catch'](handleError(_0x32d78a,null));};exports[_0x3851('0x54')]=function(_0xbf3c93,_0xdf78e7){return db['OpenchannelQueue'][_0x3851('0x54')]()[_0x3851('0x27')](respondWithResult(_0xdf78e7,null))['catch'](handleError(_0xdf78e7,null));};exports[_0x3851('0x55')]=function(_0x3f5bc0,_0x5c033e,_0x2bd32e){var _0x5e5042={'raw':!![],'where':{}},_0x263ed8={},_0x553d40;return db[_0x3851('0x33')]['findOne']({'where':{'id':_0x3f5bc0[_0x3851('0x49')]['id']}})['then'](handleEntityNotFound(_0x5c033e,null))['then'](function(_0x5f5865){if(_0x5f5865){_0x553d40=_0x5f5865[_0x3851('0x28')]({'plain':!![]});_0x263ed8[_0x3851('0x3a')]=_[_0x3851('0x38')](db[_0x3851('0x56')]['rawAttributes']);_0x263ed8['query']=_[_0x3851('0x38')](_0x3f5bc0[_0x3851('0x37')]);_0x263ed8[_0x3851('0x41')]=_[_0x3851('0x39')](_0x263ed8['model'],_0x263ed8['query']);_0x5e5042[_0x3851('0x3b')]=_[_0x3851('0x39')](_0x263ed8['model'],qs['fields'](_0x3f5bc0[_0x3851('0x37')]['fields']));_0x5e5042[_0x3851('0x3b')]=_0x5e5042['attributes'][_0x3851('0x3d')]?_0x5e5042[_0x3851('0x3b')]:_0x263ed8[_0x3851('0x3a')];if(!_0x3f5bc0[_0x3851('0x37')][_0x3851('0x3e')](_0x3851('0x57'))){_0x5e5042['limit']=qs[_0x3851('0x1f')](_0x3f5bc0[_0x3851('0x37')]['limit']);_0x5e5042['offset']=qs[_0x3851('0x1d')](_0x3f5bc0['query'][_0x3851('0x1d')]);}_0x5e5042[_0x3851('0x58')]=qs[_0x3851('0x3f')](_0x3f5bc0[_0x3851('0x37')][_0x3851('0x3f')]);_0x5e5042[_0x3851('0x40')]=qs[_0x3851('0x41')](_[_0x3851('0x42')](_0x3f5bc0[_0x3851('0x37')],_0x263ed8[_0x3851('0x41')]));_0x5e5042[_0x3851('0x40')]['OpenchannelQueueId']=_0x5f5865['id'];if(_0x3f5bc0[_0x3851('0x37')]['filter']){_0x5e5042['where']=_[_0x3851('0x44')](_0x5e5042[_0x3851('0x40')],{'$or':_[_0x3851('0x32')](_0x5e5042[_0x3851('0x3b')],function(_0x4efb41){var _0x2d457f={};_0x2d457f[_0x4efb41]={'$like':'%'+_0x3f5bc0[_0x3851('0x37')][_0x3851('0x59')]+'%'};return _0x2d457f;})});}_0x5e5042=_['merge']({},_0x5e5042,_0x3f5bc0['options']);return db[_0x3851('0x56')][_0x3851('0x46')](_0x5e5042);}})[_0x3851('0x27')](function(_0x1b8106){if(_0x1b8106){return db[_0x3851('0x5a')][_0x3851('0x5b')]({'where':{'id':_[_0x3851('0x32')](_0x1b8106,_0x3851('0x5c')),'role':_0x3851('0x5d')},'attributes':['id','name',_0x3851('0x5e'),'updatedAt',_0x3851('0x5f')]});}})[_0x3851('0x27')](function(_0x50a9e0){if(_0x50a9e0){return{'count':_0x50a9e0[_0x3851('0x20')],'rows':_['map'](_0x50a9e0[_0x3851('0x47')],function(_0x1a5773){return{'membername':_0x1a5773[_0x3851('0x2f')],'UserId':_0x1a5773['id'],'queue_name':_0x553d40[_0x3851('0x2f')],'OpenchannelQueueId':_0x553d40['id'],'interface':util[_0x3851('0x60')](_0x3851('0x61'),_0x3851('0x62'),_0x1a5773[_0x3851('0x2f')]),'penalty':0x0,'paused':_0x1a5773['openchannelPause'],'createdAt':_0x1a5773[_0x3851('0x5f')],'updatedAt':_0x1a5773['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x3851('0x27')](respondWithFilteredResult(_0x5c033e,_0x5e5042))['catch'](handleError(_0x5c033e,null));};exports['getTeams']=function(_0x3d8c98,_0x2adcb8,_0x12a4d0){var _0x1efa5c={};var _0x34143a={};var _0x404f26;var _0x3e9724;return db['OpenchannelQueue'][_0x3851('0x63')]({'where':{'id':_0x3d8c98['params']['id']}})['then'](handleEntityNotFound(_0x2adcb8,null))[_0x3851('0x27')](function(_0xe5c712){if(_0xe5c712){_0x404f26=_0xe5c712;_0x34143a[_0x3851('0x3a')]=_[_0x3851('0x38')](db['Team'][_0x3851('0x34')]);_0x34143a[_0x3851('0x37')]=_[_0x3851('0x38')](_0x3d8c98['query']);_0x34143a[_0x3851('0x41')]=_[_0x3851('0x39')](_0x34143a[_0x3851('0x3a')],_0x34143a[_0x3851('0x37')]);_0x1efa5c[_0x3851('0x3b')]=_[_0x3851('0x39')](_0x34143a[_0x3851('0x3a')],qs[_0x3851('0x3c')](_0x3d8c98[_0x3851('0x37')][_0x3851('0x3c')]));_0x1efa5c[_0x3851('0x3b')]=_0x1efa5c[_0x3851('0x3b')]['length']?_0x1efa5c[_0x3851('0x3b')]:_0x34143a['model'];_0x1efa5c['order']=qs[_0x3851('0x3f')](_0x3d8c98[_0x3851('0x37')][_0x3851('0x3f')]);_0x1efa5c[_0x3851('0x40')]=qs['filters'](_[_0x3851('0x42')](_0x3d8c98[_0x3851('0x37')],_0x34143a[_0x3851('0x41')]));if(_0x3d8c98['query']['filter']){_0x1efa5c[_0x3851('0x40')]=_[_0x3851('0x44')](_0x1efa5c[_0x3851('0x40')],{'$or':_[_0x3851('0x32')](_0x1efa5c['attributes'],function(_0x4fe167){var _0x176ad6={};_0x176ad6[_0x4fe167]={'$like':'%'+_0x3d8c98[_0x3851('0x37')][_0x3851('0x59')]+'%'};return _0x176ad6;})});}_0x1efa5c=_[_0x3851('0x44')]({},_0x1efa5c,_0x3d8c98[_0x3851('0x4b')]);return _0x404f26[_0x3851('0x64')](_0x1efa5c);}})['then'](function(_0x8804dc){if(_0x8804dc){_0x3e9724=_0x8804dc[_0x3851('0x3d')];if(!_0x3d8c98[_0x3851('0x37')]['hasOwnProperty']('nolimit')){_0x1efa5c[_0x3851('0x1f')]=qs[_0x3851('0x1f')](_0x3d8c98[_0x3851('0x37')][_0x3851('0x1f')]);_0x1efa5c[_0x3851('0x1d')]=qs[_0x3851('0x1d')](_0x3d8c98['query'][_0x3851('0x1d')]);}return _0x404f26[_0x3851('0x64')](_0x1efa5c);}})[_0x3851('0x27')](function(_0x54a865){if(_0x54a865){return _0x54a865?{'count':_0x3e9724,'rows':_0x54a865}:null;}})['then'](respondWithResult(_0x2adcb8,null))[_0x3851('0x4d')](handleError(_0x2adcb8,null));};exports['addTeams']=function(_0x47bc66,_0xaadc69,_0x54cb25){var _0x2118cf=_0x47bc66['body'][_0x3851('0x65')];return db[_0x3851('0x66')][_0x3851('0x46')]({'where':{'id':_0x2118cf},'attributes':['id'],'include':[{'model':db[_0x3851('0x5a')],'as':'Agents','attributes':['id',_0x3851('0x2f'),'online','voicePause',_0x3851('0x67')],'raw':!![]}]})[_0x3851('0x27')](function(_0x3aa991){if(_0x3aa991){var _0x584d4b=_[_0x3851('0x68')](_0x3aa991,function(_0x21eeca){var _0x239120=_0x21eeca[_0x3851('0x28')]({'plain':!![]});return _0x239120[_0x3851('0x69')];});return db[_0x3851('0x33')][_0x3851('0x4c')]({'where':{'id':_0x47bc66[_0x3851('0x49')]['id']}})['then'](function(_0x4f0717){return db[_0x3851('0x6a')][_0x3851('0x6b')](function(_0x1d8da9){return _0x4f0717[_0x3851('0x6c')](_0x2118cf,{'transaction':_0x1d8da9})[_0x3851('0x27')](function(){return BPromise[_0x3851('0x6d')](_0x584d4b,function(_0x356935){return db[_0x3851('0x56')][_0x3851('0x6e')]({'where':{'UserId':_0x356935['id'],'OpenchannelQueueId':_0x47bc66[_0x3851('0x49')]['id']},'transaction':_0x1d8da9});});})[_0x3851('0x27')](function(){_0x584d4b[_0x3851('0x6f')](function(_0x2fd811){socket['emit'](_0x3851('0x70'),{'UserId':_0x2fd811['id'],'OpenchannelQueueId':_0x4f0717['id']});});});});});}})['then'](respondWithStatusCode(_0xaadc69,null))['catch'](handleError(_0xaadc69,null));};exports[_0x3851('0x71')]=function(_0x22031b,_0x261609,_0x3d0310){return db[_0x3851('0x66')][_0x3851('0x46')]({'where':{'id':_0x22031b[_0x3851('0x37')]['ids']},'attributes':['id'],'include':[{'model':db[_0x3851('0x5a')],'as':_0x3851('0x69'),'attributes':['id'],'raw':!![]}]})[_0x3851('0x27')](handleEntityNotFound(_0x261609,null))['then'](function(_0x4f4d2f){var _0xee4e0c=_['map'](_0x4f4d2f,'id');var _0x2a2137=[];var _0x346300=[];var _0x51a46a=squel[_0x3851('0x72')]();_0x51a46a['field']('tq.TeamId')[_0x3851('0x73')]('team_has_openchannel_queues','tq')['join'](_0x3851('0x74'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x3851('0x40')](_0x3851('0x75'),_0x22031b['params']['id']);for(var _0x19d47f=0x0;_0x19d47f<_0x4f4d2f['length'];_0x19d47f+=0x1){let _0x48c7be=_0x4f4d2f[_0x19d47f];for(var _0x1d045f=0x0;_0x1d045f<_0x48c7be[_0x3851('0x69')][_0x3851('0x3d')];_0x1d045f+=0x1){let _0x8df448=_0x48c7be[_0x3851('0x69')][_0x1d045f];var _0x857a65=_0x51a46a[_0x3851('0x76')]();_0x857a65[_0x3851('0x40')](_0x3851('0x77'),_0x8df448['id']);_0x346300['push'](db['sequelize'][_0x3851('0x37')](_0x857a65[_0x3851('0x78')](),{'type':db['sequelize'][_0x3851('0x79')][_0x3851('0x7a')]})[_0x3851('0x27')](function(_0x702df5){if(_0x702df5[_0x3851('0x3d')]===0x1){return _0x8df448['id'];}else{var _0x12f40b=_['every'](_[_0x3851('0x32')](_0x702df5,_0x3851('0x7b')),function(_0x2847f2){return _[_0x3851('0x7c')](_0xee4e0c,_0x2847f2);});if(_0x12f40b){return _0x8df448['id'];}}}));}}return BPromise[_0x3851('0x7d')](_0x346300)[_0x3851('0x27')](function(_0x4a0e7b){_0x2a2137=_(_0x2a2137)[_0x3851('0x7e')](_0x4a0e7b)[_0x3851('0x7f')]()[_0x3851('0x80')]();return db['OpenchannelQueue'][_0x3851('0x4c')]({'where':{'id':_0x22031b[_0x3851('0x49')]['id']}})['then'](function(_0x4713db){return db[_0x3851('0x6a')][_0x3851('0x6b')](function(_0x1cb95d){return _0x4713db[_0x3851('0x71')](_0x22031b['query'][_0x3851('0x65')],{'transaction':_0x1cb95d})[_0x3851('0x27')](function(){if(!_[_0x3851('0x81')](_0x2a2137)){return _0x4713db[_0x3851('0x82')](_0x2a2137,{'transaction':_0x1cb95d});}})[_0x3851('0x27')](function(){_0x2a2137['forEach'](function(_0x5ada20){socket[_0x3851('0x83')](_0x3851('0x84'),{'UserId':_0x5ada20,'OpenchannelQueueId':_0x4713db['id']});});});});});});})[_0x3851('0x27')](respondWithStatusCode(_0x261609,null))['catch'](handleError(_0x261609,null));};exports[_0x3851('0x85')]=function(_0x51abdb,_0x20bcfa,_0x238423){return db[_0x3851('0x33')][_0x3851('0x4c')]({'where':{'id':_0x51abdb['params']['id']}})['then'](handleEntityNotFound(_0x20bcfa,null))[_0x3851('0x27')](function(_0x3fb7c2){if(_0x3fb7c2){return _0x3fb7c2['addAgents'](_0x51abdb[_0x3851('0x86')]['ids'],_[_0x3851('0x87')](_0x51abdb['body'],[_0x3851('0x65'),'id'])||{})['spread'](function(_0xa3ee15){for(var _0x41dfa5=0x0;_0x41dfa5<_0x51abdb[_0x3851('0x86')][_0x3851('0x65')][_0x3851('0x3d')];_0x41dfa5+=0x1){socket['emit'](_0x3851('0x70'),{'UserId':Number(_0x51abdb[_0x3851('0x86')]['ids'][_0x41dfa5]),'OpenchannelQueueId':Number(_0x51abdb[_0x3851('0x49')]['id'])});}return _0xa3ee15;});}})[_0x3851('0x27')](respondWithResult(_0x20bcfa,null))['catch'](handleError(_0x20bcfa,null));};exports['removeAgents']=function(_0x3eeed9,_0x13a590,_0x483d95){return db[_0x3851('0x33')]['find']({'where':{'id':_0x3eeed9[_0x3851('0x49')]['id']}})['then'](handleEntityNotFound(_0x13a590,null))[_0x3851('0x27')](function(_0x5a3f64){if(_0x5a3f64){return _0x5a3f64['removeAgents'](_0x3eeed9['query'][_0x3851('0x65')])['then'](function(){if(_['isArray'](_0x3eeed9[_0x3851('0x37')][_0x3851('0x65')])){for(var _0xf6353d=0x0;_0xf6353d<_0x3eeed9[_0x3851('0x37')][_0x3851('0x65')][_0x3851('0x3d')];_0xf6353d+=0x1){socket[_0x3851('0x83')](_0x3851('0x84'),{'UserId':Number(_0x3eeed9[_0x3851('0x37')][_0x3851('0x65')][_0xf6353d]),'OpenchannelQueueId':Number(_0x3eeed9[_0x3851('0x49')]['id'])});}}else{socket[_0x3851('0x83')](_0x3851('0x84'),{'UserId':Number(_0x3eeed9[_0x3851('0x37')][_0x3851('0x65')]),'OpenchannelQueueId':Number(_0x3eeed9[_0x3851('0x49')]['id'])});}});}})[_0x3851('0x27')](respondWithStatusCode(_0x13a590,null))[_0x3851('0x4d')](handleError(_0x13a590,null));};exports['getAgents']=function(_0xff1772,_0x32793b,_0x169d90){var _0x3feca5={};var _0x31d538={};var _0x214153;var _0xeba059;return db[_0x3851('0x33')]['findOne']({'where':{'id':_0xff1772[_0x3851('0x49')]['id']}})[_0x3851('0x27')](handleEntityNotFound(_0x32793b,null))[_0x3851('0x27')](function(_0x5aa13f){if(_0x5aa13f){_0x214153=_0x5aa13f;_0x31d538[_0x3851('0x3a')]=_[_0x3851('0x38')](db[_0x3851('0x5a')][_0x3851('0x34')]);_0x31d538[_0x3851('0x37')]=_[_0x3851('0x38')](_0xff1772[_0x3851('0x37')]);_0x31d538[_0x3851('0x41')]=_['intersection'](_0x31d538[_0x3851('0x3a')],_0x31d538[_0x3851('0x37')]);_0x3feca5[_0x3851('0x3b')]=_[_0x3851('0x39')](_0x31d538['model'],qs['fields'](_0xff1772[_0x3851('0x37')]['fields']));_0x3feca5[_0x3851('0x3b')]=_0x3feca5['attributes']['length']?_0x3feca5[_0x3851('0x3b')]:_0x31d538[_0x3851('0x3a')];_0x3feca5[_0x3851('0x58')]=qs[_0x3851('0x3f')](_0xff1772['query']['sort']);_0x3feca5[_0x3851('0x40')]=qs[_0x3851('0x41')](_[_0x3851('0x42')](_0xff1772[_0x3851('0x37')],_0x31d538[_0x3851('0x41')]));if(_0xff1772[_0x3851('0x37')][_0x3851('0x59')]){_0x3feca5[_0x3851('0x40')]=_['merge'](_0x3feca5['where'],{'$or':_[_0x3851('0x32')](_0x3feca5[_0x3851('0x3b')],function(_0x3ddee4){var _0x1d13d0={};_0x1d13d0[_0x3ddee4]={'$like':'%'+_0xff1772['query'][_0x3851('0x59')]+'%'};return _0x1d13d0;})});}_0x3feca5=_[_0x3851('0x44')]({},_0x3feca5,_0xff1772[_0x3851('0x4b')]);return _0x214153['getAgents'](_0x3feca5);}})[_0x3851('0x27')](function(_0x71c72e){if(_0x71c72e){_0xeba059=_0x71c72e[_0x3851('0x3d')];if(!_0xff1772[_0x3851('0x37')][_0x3851('0x3e')](_0x3851('0x57'))){_0x3feca5[_0x3851('0x1f')]=qs[_0x3851('0x1f')](_0xff1772['query'][_0x3851('0x1f')]);_0x3feca5[_0x3851('0x1d')]=qs[_0x3851('0x1d')](_0xff1772['query']['offset']);}return _0x214153[_0x3851('0x88')](_0x3feca5);}})['then'](function(_0x286aa2){if(_0x286aa2){return _0x286aa2?{'count':_0xeba059,'rows':_0x286aa2}:null;}})[_0x3851('0x27')](respondWithResult(_0x32793b,null))[_0x3851('0x4d')](handleError(_0x32793b,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 51e4774..90310ad 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 _0x2222=['remove','emit','exports','events','../../mysqldb','OpenchannelQueue','setMaxListeners','save'];(function(_0x311246,_0x49c786){var _0xe92782=function(_0x1e58e7){while(--_0x1e58e7){_0x311246['push'](_0x311246['shift']());}};_0xe92782(++_0x49c786);}(_0x2222,0x113));var _0x2222=function(_0xddd7e4,_0x5d3706){_0xddd7e4=_0xddd7e4-0x0;var _0x56f1b9=_0x2222[_0xddd7e4];return _0x56f1b9;};'use strict';var EventEmitter=require(_0x2222('0x0'));var OpenchannelQueue=require(_0x2222('0x1'))['db'][_0x2222('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x2222('0x3')](0x0);var events={'afterCreate':_0x2222('0x4'),'afterUpdate':'update','afterDestroy':_0x2222('0x5')};function emitEvent(_0x44b57b){return function(_0x4c1907,_0x4da4a0,_0x126b7a){OpenchannelQueueEvents['emit'](_0x44b57b+':'+_0x4c1907['id'],_0x4c1907);OpenchannelQueueEvents[_0x2222('0x6')](_0x44b57b,_0x4c1907);_0x126b7a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue['hook'](e,emitEvent(event));}}module[_0x2222('0x7')]=OpenchannelQueueEvents; \ No newline at end of file +var _0xc034=['OpenchannelQueue','setMaxListeners','save','update','remove','emit','hook','exports','events'];(function(_0x5534ce,_0x26ef5e){var _0x33042b=function(_0x48c033){while(--_0x48c033){_0x5534ce['push'](_0x5534ce['shift']());}};_0x33042b(++_0x26ef5e);}(_0xc034,0x170));var _0x4c03=function(_0x17da11,_0x4ce76a){_0x17da11=_0x17da11-0x0;var _0x38adf2=_0xc034[_0x17da11];return _0x38adf2;};'use strict';var EventEmitter=require(_0x4c03('0x0'));var OpenchannelQueue=require('../../mysqldb')['db'][_0x4c03('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x4c03('0x2')](0x0);var events={'afterCreate':_0x4c03('0x3'),'afterUpdate':_0x4c03('0x4'),'afterDestroy':_0x4c03('0x5')};function emitEvent(_0x1a7a06){return function(_0x3d6310,_0x3eb7f1,_0x38ce35){OpenchannelQueueEvents[_0x4c03('0x6')](_0x1a7a06+':'+_0x3d6310['id'],_0x3d6310);OpenchannelQueueEvents[_0x4c03('0x6')](_0x1a7a06,_0x3d6310);_0x38ce35(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0x4c03('0x7')](e,emitEvent(event));}}module[_0x4c03('0x8')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 838588e..2393421 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 _0xf484=['openchannel_queues','lodash','api','moment','request-promise','path','rimraf','../../config/environment','./openchannelQueue.attributes','exports','define','OpenchannelQueue'];(function(_0x4c440b,_0x3ea627){var _0x2d48cf=function(_0x56bac7){while(--_0x56bac7){_0x4c440b['push'](_0x4c440b['shift']());}};_0x2d48cf(++_0x3ea627);}(_0xf484,0xa9));var _0x4f48=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf484[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x4f48('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x4f48('0x1'));var moment=require(_0x4f48('0x2'));var BPromise=require('bluebird');var rp=require(_0x4f48('0x3'));var fs=require('fs');var path=require(_0x4f48('0x4'));var rimraf=require(_0x4f48('0x5'));var config=require(_0x4f48('0x6'));var attributes=require(_0x4f48('0x7'));module[_0x4f48('0x8')]=function(_0x28365b,_0x55ec47){return _0x28365b[_0x4f48('0x9')](_0x4f48('0xa'),attributes,{'tableName':_0x4f48('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xabf4=['moment','request-promise','path','../../config/environment','./openchannelQueue.attributes','exports','define','OpenchannelQueue','openchannel_queues','lodash','../../config/logger','api'];(function(_0x44f7e9,_0x3158d7){var _0x414d23=function(_0x2b49f3){while(--_0x2b49f3){_0x44f7e9['push'](_0x44f7e9['shift']());}};_0x414d23(++_0x3158d7);}(_0xabf4,0xe1));var _0x4abf=function(_0x3c1ef8,_0x511108){_0x3c1ef8=_0x3c1ef8-0x0;var _0x185def=_0xabf4[_0x3c1ef8];return _0x185def;};'use strict';var _=require(_0x4abf('0x0'));var util=require('util');var logger=require(_0x4abf('0x1'))(_0x4abf('0x2'));var moment=require(_0x4abf('0x3'));var BPromise=require('bluebird');var rp=require(_0x4abf('0x4'));var fs=require('fs');var path=require(_0x4abf('0x5'));var rimraf=require('rimraf');var config=require(_0x4abf('0x6'));var attributes=require(_0x4abf('0x7'));module[_0x4abf('0x8')]=function(_0x7736ff,_0x56df24){return _0x7736ff[_0x4abf('0x9')](_0x4abf('0xa'),attributes,{'tableName':_0x4abf('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index b1b4e00..32b50e0 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 _0x34e1=['GetOpenchannelQueue','OpenchannelQueue','findAll','options','where','attributes','limit','map','include','model','ShowOpenchannelQueue','find','then','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch'];(function(_0x24679e,_0x22d9d7){var _0x291f21=function(_0x329529){while(--_0x329529){_0x24679e['push'](_0x24679e['shift']());}};_0x291f21(++_0x22d9d7);}(_0x34e1,0x1c5));var _0x134e=function(_0x3eac77,_0x3153c1){_0x3eac77=_0x3eac77-0x0;var _0x180cf2=_0x34e1[_0x3eac77];return _0x180cf2;};'use strict';var _=require(_0x134e('0x0'));var util=require(_0x134e('0x1'));var moment=require(_0x134e('0x2'));var BPromise=require(_0x134e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x134e('0x4'))['db'];var utils=require(_0x134e('0x5'));var logger=require(_0x134e('0x6'))(_0x134e('0x7'));var config=require(_0x134e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x134e('0x9')][_0x134e('0xa')]({'port':0x232a});config[_0x134e('0xb')]=_[_0x134e('0xc')](config['redis'],{'host':_0x134e('0xd'),'port':0x18eb});var socket=require(_0x134e('0xe'))(new Redis(config[_0x134e('0xb')]));require(_0x134e('0xf'))[_0x134e('0x10')](socket);function respondWithRpcPromise(_0x16a1f3,_0x2a1e95,_0x55d9fd){return new BPromise(function(_0x43f21d,_0x2e6e44){return client[_0x134e('0x11')](_0x16a1f3,_0x55d9fd)['then'](function(_0x1eb15f){logger[_0x134e('0x12')](_0x134e('0x13'),_0x2a1e95,_0x134e('0x14'));logger[_0x134e('0x15')]('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x2a1e95,'request\x20sent',JSON[_0x134e('0x16')](_0x1eb15f));if(_0x1eb15f[_0x134e('0x17')]){if(_0x1eb15f[_0x134e('0x17')][_0x134e('0x18')]===0x1f4){logger['error'](_0x134e('0x13'),_0x2a1e95,_0x1eb15f[_0x134e('0x17')]['message']);return _0x2e6e44(_0x1eb15f[_0x134e('0x17')][_0x134e('0x19')]);}logger[_0x134e('0x17')]('OpenchannelQueue,\x20%s,\x20%s',_0x2a1e95,_0x1eb15f[_0x134e('0x17')][_0x134e('0x19')]);return _0x43f21d(_0x1eb15f[_0x134e('0x17')][_0x134e('0x19')]);}else{logger[_0x134e('0x12')](_0x134e('0x13'),_0x2a1e95,_0x134e('0x14'));_0x43f21d(_0x1eb15f['result'][_0x134e('0x19')]);}})[_0x134e('0x1a')](function(_0x61c4b1){logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x2a1e95,_0x61c4b1);_0x2e6e44(_0x61c4b1);});});}exports[_0x134e('0x1b')]=function(_0x4c76f6){var _0xaf09ed=this;return new Promise(function(_0x37f942,_0x470ef1){return db[_0x134e('0x1c')][_0x134e('0x1d')]({'raw':_0x4c76f6[_0x134e('0x1e')]?_0x4c76f6['options']['raw']===undefined?!![]:![]:!![],'where':_0x4c76f6[_0x134e('0x1e')]?_0x4c76f6[_0x134e('0x1e')][_0x134e('0x1f')]||null:null,'attributes':_0x4c76f6['options']?_0x4c76f6[_0x134e('0x1e')][_0x134e('0x20')]||null:null,'limit':_0x4c76f6[_0x134e('0x1e')]?_0x4c76f6[_0x134e('0x1e')][_0x134e('0x21')]||null:null,'include':_0x4c76f6['options']?_0x4c76f6[_0x134e('0x1e')]['include']?_[_0x134e('0x22')](_0x4c76f6[_0x134e('0x1e')][_0x134e('0x23')],function(_0x4b5007){return{'model':db[_0x4b5007['model']],'as':_0x4b5007['as'],'attributes':_0x4b5007[_0x134e('0x20')],'include':_0x4b5007[_0x134e('0x23')]?_['map'](_0x4b5007['include'],function(_0x100fb2){return{'model':db[_0x100fb2['model']],'as':_0x100fb2['as'],'attributes':_0x100fb2['attributes'],'include':_0x100fb2['include']?_[_0x134e('0x22')](_0x100fb2[_0x134e('0x23')],function(_0x2e4c16){return{'model':db[_0x2e4c16[_0x134e('0x24')]],'as':_0x2e4c16['as'],'attributes':_0x2e4c16[_0x134e('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x8b26f){logger[_0x134e('0x12')](_0x134e('0x1b'),_0x4c76f6);logger[_0x134e('0x15')]('GetOpenchannelQueue',_0x4c76f6,JSON[_0x134e('0x16')](_0x8b26f));_0x37f942(_0x8b26f);})[_0x134e('0x1a')](function(_0x1364a0){logger['error'](_0x134e('0x1b'),_0x1364a0[_0x134e('0x19')],_0x4c76f6);_0x470ef1(_0xaf09ed[_0x134e('0x17')](0x1f4,_0x1364a0[_0x134e('0x19')]));});});};exports[_0x134e('0x25')]=function(_0x2f75c4){var _0x2ccbaa=this;return new Promise(function(_0x525f5c,_0x5b591b){return db[_0x134e('0x1c')][_0x134e('0x26')]({'raw':_0x2f75c4[_0x134e('0x1e')]?_0x2f75c4[_0x134e('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x2f75c4[_0x134e('0x1e')]?_0x2f75c4[_0x134e('0x1e')]['where']||null:null,'attributes':_0x2f75c4[_0x134e('0x1e')]?_0x2f75c4['options'][_0x134e('0x20')]||null:null,'include':_0x2f75c4[_0x134e('0x1e')]?_0x2f75c4[_0x134e('0x1e')][_0x134e('0x23')]?_[_0x134e('0x22')](_0x2f75c4[_0x134e('0x1e')]['include'],function(_0x46068e){return{'model':db[_0x46068e[_0x134e('0x24')]],'as':_0x46068e['as'],'attributes':_0x46068e[_0x134e('0x20')],'include':_0x46068e[_0x134e('0x23')]?_[_0x134e('0x22')](_0x46068e[_0x134e('0x23')],function(_0x8bf28d){return{'model':db[_0x8bf28d[_0x134e('0x24')]],'as':_0x8bf28d['as'],'attributes':_0x8bf28d[_0x134e('0x20')],'include':_0x8bf28d[_0x134e('0x23')]?_[_0x134e('0x22')](_0x8bf28d[_0x134e('0x23')],function(_0x459819){return{'model':db[_0x459819[_0x134e('0x24')]],'as':_0x459819['as'],'attributes':_0x459819[_0x134e('0x20')]};}):[]};}):[]};}):[]:[]})[_0x134e('0x27')](function(_0x4afa1f){logger[_0x134e('0x12')](_0x134e('0x25'),_0x2f75c4);logger[_0x134e('0x15')](_0x134e('0x25'),_0x2f75c4,JSON[_0x134e('0x16')](_0x4afa1f));_0x525f5c(_0x4afa1f);})[_0x134e('0x1a')](function(_0x115405){logger[_0x134e('0x17')](_0x134e('0x25'),_0x115405[_0x134e('0x19')],_0x2f75c4);_0x5b591b(_0x2ccbaa['error'](0x1f4,_0x115405[_0x134e('0x19')]));});});}; \ No newline at end of file +var _0xcfdd=['model','attributes','ShowOpenchannelQueue','OpenchannelQueue','find','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','request','then','info','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelQueue,\x20%s,\x20%s','message','result','catch','GetOpenchannelQueue','options','raw','where','include','map'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0xcfdd,0x1f3));var _0xdcfd=function(_0x4247e5,_0x30b7bb){_0x4247e5=_0x4247e5-0x0;var _0x5ee3d5=_0xcfdd[_0x4247e5];return _0x5ee3d5;};'use strict';var _=require(_0xdcfd('0x0'));var util=require(_0xdcfd('0x1'));var moment=require(_0xdcfd('0x2'));var BPromise=require(_0xdcfd('0x3'));var rs=require(_0xdcfd('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xdcfd('0x5'));var logger=require(_0xdcfd('0x6'))('rpc');var config=require(_0xdcfd('0x7'));var jayson=require(_0xdcfd('0x8'));var client=jayson[_0xdcfd('0x9')][_0xdcfd('0xa')]({'port':0x232a});config[_0xdcfd('0xb')]=_['defaults'](config['redis'],{'host':_0xdcfd('0xc'),'port':0x18eb});var socket=require(_0xdcfd('0xd'))(new Redis(config['redis']));require('./openchannelQueue.socket')['register'](socket);function respondWithRpcPromise(_0x237859,_0xfc7cee,_0x5daed1){return new BPromise(function(_0x384670,_0x1dd39b){return client[_0xdcfd('0xe')](_0x237859,_0x5daed1)[_0xdcfd('0xf')](function(_0x25e0df){logger[_0xdcfd('0x10')]('OpenchannelQueue,\x20%s,\x20%s',_0xfc7cee,_0xdcfd('0x11'));logger[_0xdcfd('0x12')](_0xdcfd('0x13'),_0xfc7cee,'request\x20sent',JSON[_0xdcfd('0x14')](_0x25e0df));if(_0x25e0df[_0xdcfd('0x15')]){if(_0x25e0df[_0xdcfd('0x15')][_0xdcfd('0x16')]===0x1f4){logger[_0xdcfd('0x15')](_0xdcfd('0x17'),_0xfc7cee,_0x25e0df[_0xdcfd('0x15')][_0xdcfd('0x18')]);return _0x1dd39b(_0x25e0df['error'][_0xdcfd('0x18')]);}logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0xfc7cee,_0x25e0df[_0xdcfd('0x15')][_0xdcfd('0x18')]);return _0x384670(_0x25e0df[_0xdcfd('0x15')][_0xdcfd('0x18')]);}else{logger[_0xdcfd('0x10')](_0xdcfd('0x17'),_0xfc7cee,_0xdcfd('0x11'));_0x384670(_0x25e0df[_0xdcfd('0x19')][_0xdcfd('0x18')]);}})[_0xdcfd('0x1a')](function(_0x1f3fbf){logger[_0xdcfd('0x15')](_0xdcfd('0x17'),_0xfc7cee,_0x1f3fbf);_0x1dd39b(_0x1f3fbf);});});}exports[_0xdcfd('0x1b')]=function(_0x24769e){var _0x1ad1ae=this;return new Promise(function(_0x2294b7,_0x38e772){return db['OpenchannelQueue']['findAll']({'raw':_0x24769e[_0xdcfd('0x1c')]?_0x24769e[_0xdcfd('0x1c')][_0xdcfd('0x1d')]===undefined?!![]:![]:!![],'where':_0x24769e[_0xdcfd('0x1c')]?_0x24769e['options'][_0xdcfd('0x1e')]||null:null,'attributes':_0x24769e[_0xdcfd('0x1c')]?_0x24769e[_0xdcfd('0x1c')]['attributes']||null:null,'limit':_0x24769e[_0xdcfd('0x1c')]?_0x24769e['options']['limit']||null:null,'include':_0x24769e[_0xdcfd('0x1c')]?_0x24769e[_0xdcfd('0x1c')][_0xdcfd('0x1f')]?_[_0xdcfd('0x20')](_0x24769e[_0xdcfd('0x1c')][_0xdcfd('0x1f')],function(_0x438179){return{'model':db[_0x438179[_0xdcfd('0x21')]],'as':_0x438179['as'],'attributes':_0x438179[_0xdcfd('0x22')],'include':_0x438179[_0xdcfd('0x1f')]?_[_0xdcfd('0x20')](_0x438179[_0xdcfd('0x1f')],function(_0xa5c974){return{'model':db[_0xa5c974['model']],'as':_0xa5c974['as'],'attributes':_0xa5c974[_0xdcfd('0x22')],'include':_0xa5c974['include']?_[_0xdcfd('0x20')](_0xa5c974[_0xdcfd('0x1f')],function(_0x299817){return{'model':db[_0x299817['model']],'as':_0x299817['as'],'attributes':_0x299817[_0xdcfd('0x22')]};}):[]};}):[]};}):[]:[]})[_0xdcfd('0xf')](function(_0x5dcadc){logger[_0xdcfd('0x10')](_0xdcfd('0x1b'),_0x24769e);logger[_0xdcfd('0x12')](_0xdcfd('0x1b'),_0x24769e,JSON[_0xdcfd('0x14')](_0x5dcadc));_0x2294b7(_0x5dcadc);})[_0xdcfd('0x1a')](function(_0x54a39b){logger['error']('GetOpenchannelQueue',_0x54a39b[_0xdcfd('0x18')],_0x24769e);_0x38e772(_0x1ad1ae[_0xdcfd('0x15')](0x1f4,_0x54a39b['message']));});});};exports[_0xdcfd('0x23')]=function(_0x17cafb){var _0x55382c=this;return new Promise(function(_0x18eae6,_0x4668c3){return db[_0xdcfd('0x24')][_0xdcfd('0x25')]({'raw':_0x17cafb['options']?_0x17cafb['options']['raw']===undefined?!![]:![]:!![],'where':_0x17cafb[_0xdcfd('0x1c')]?_0x17cafb[_0xdcfd('0x1c')]['where']||null:null,'attributes':_0x17cafb[_0xdcfd('0x1c')]?_0x17cafb[_0xdcfd('0x1c')][_0xdcfd('0x22')]||null:null,'include':_0x17cafb['options']?_0x17cafb[_0xdcfd('0x1c')]['include']?_[_0xdcfd('0x20')](_0x17cafb[_0xdcfd('0x1c')][_0xdcfd('0x1f')],function(_0x9f6358){return{'model':db[_0x9f6358[_0xdcfd('0x21')]],'as':_0x9f6358['as'],'attributes':_0x9f6358[_0xdcfd('0x22')],'include':_0x9f6358[_0xdcfd('0x1f')]?_[_0xdcfd('0x20')](_0x9f6358[_0xdcfd('0x1f')],function(_0x1e1b32){return{'model':db[_0x1e1b32[_0xdcfd('0x21')]],'as':_0x1e1b32['as'],'attributes':_0x1e1b32[_0xdcfd('0x22')],'include':_0x1e1b32['include']?_[_0xdcfd('0x20')](_0x1e1b32[_0xdcfd('0x1f')],function(_0x57783c){return{'model':db[_0x57783c[_0xdcfd('0x21')]],'as':_0x57783c['as'],'attributes':_0x57783c[_0xdcfd('0x22')]};}):[]};}):[]};}):[]:[]})[_0xdcfd('0xf')](function(_0x22c4b8){logger['info'](_0xdcfd('0x23'),_0x17cafb);logger['debug']('ShowOpenchannelQueue',_0x17cafb,JSON[_0xdcfd('0x14')](_0x22c4b8));_0x18eae6(_0x22c4b8);})['catch'](function(_0x459a4e){logger[_0xdcfd('0x15')](_0xdcfd('0x23'),_0x459a4e[_0xdcfd('0x18')],_0x17cafb);_0x4668c3(_0x55382c[_0xdcfd('0x15')](0x1f4,_0x459a4e['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 5e06b23..48a27b2 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 _0x5e64=['update','emit','removeListener','register','openchannelQueue:','./openchannelQueue.events','save'];(function(_0x3d1867,_0x42339a){var _0xc07c65=function(_0x1779b5){while(--_0x1779b5){_0x3d1867['push'](_0x3d1867['shift']());}};_0xc07c65(++_0x42339a);}(_0x5e64,0x15c));var _0x45e6=function(_0x22de63,_0x1c83ae){_0x22de63=_0x22de63-0x0;var _0x466811=_0x5e64[_0x22de63];return _0x466811;};'use strict';var OpenchannelQueueEvents=require(_0x45e6('0x0'));var events=[_0x45e6('0x1'),'remove',_0x45e6('0x2')];function createListener(_0xf3bd2d,_0x42dde5){return function(_0x402ef5){_0x42dde5[_0x45e6('0x3')](_0xf3bd2d,_0x402ef5);};}function removeListener(_0x587538,_0x437922){return function(){OpenchannelQueueEvents[_0x45e6('0x4')](_0x587538,_0x437922);};}exports[_0x45e6('0x5')]=function(_0x21dd07){for(var _0x5c4606=0x0,_0x1abd54=events['length'];_0x5c4606<_0x1abd54;_0x5c4606++){var _0x4ef5bf=events[_0x5c4606];var _0x25aef2=createListener(_0x45e6('0x6')+_0x4ef5bf,_0x21dd07);OpenchannelQueueEvents['on'](_0x4ef5bf,_0x25aef2);}}; \ No newline at end of file +var _0xe4e7=['removeListener','openchannelQueue:','./openchannelQueue.events','save','remove','update','emit'];(function(_0x595604,_0x2cc998){var _0x1466f3=function(_0x4e1d9b){while(--_0x4e1d9b){_0x595604['push'](_0x595604['shift']());}};_0x1466f3(++_0x2cc998);}(_0xe4e7,0x9c));var _0x7e4e=function(_0x4e22e8,_0x4e29d6){_0x4e22e8=_0x4e22e8-0x0;var _0x4b3e6f=_0xe4e7[_0x4e22e8];return _0x4b3e6f;};'use strict';var OpenchannelQueueEvents=require(_0x7e4e('0x0'));var events=[_0x7e4e('0x1'),_0x7e4e('0x2'),_0x7e4e('0x3')];function createListener(_0x53731d,_0x3c082c){return function(_0x1e6c3b){_0x3c082c[_0x7e4e('0x4')](_0x53731d,_0x1e6c3b);};}function removeListener(_0x16f178,_0x4ff5d5){return function(){OpenchannelQueueEvents[_0x7e4e('0x5')](_0x16f178,_0x4ff5d5);};}exports['register']=function(_0xe217d9){for(var _0x386c1a=0x0,_0x3ee99c=events['length'];_0x386c1a<_0x3ee99c;_0x386c1a++){var _0x5684f9=events[_0x386c1a];var _0x2f7d76=createListener(_0x7e4e('0x6')+_0x5684f9,_0xe217d9);OpenchannelQueueEvents['on'](_0x5684f9,_0x2f7d76);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 0c4b6b9..d4a209b 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 _0x76f4=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout'];(function(_0x5d8502,_0x3a7146){var _0x58804c=function(_0x4cbd38){while(--_0x4cbd38){_0x5d8502['push'](_0x5d8502['shift']());}};_0x58804c(++_0x3a7146);}(_0x76f4,0xb5));var _0x476f=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x76f4[_0x618414];return _0x21c19a;};'use strict';var multer=require(_0x476f('0x0'));var util=require('util');var path=require(_0x476f('0x1'));var timeout=require(_0x476f('0x2'));var express=require(_0x476f('0x3'));var router=express[_0x476f('0x4')]();var fs_extra=require(_0x476f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x476f('0x6'));var config=require(_0x476f('0x7'));var controller=require(_0x476f('0x8'));router[_0x476f('0x9')]('/',auth[_0x476f('0xa')](),controller[_0x476f('0xb')]);router[_0x476f('0x9')](_0x476f('0xc'),auth[_0x476f('0xa')](),controller[_0x476f('0xd')]);router['get'](_0x476f('0xe'),auth['isAuthenticated'](),controller[_0x476f('0xf')]);router[_0x476f('0x10')]('/',auth[_0x476f('0xa')](),controller[_0x476f('0x11')]);router[_0x476f('0x12')]('/:id',auth[_0x476f('0xa')](),controller[_0x476f('0x13')]);router[_0x476f('0x14')](_0x476f('0xe'),auth[_0x476f('0xa')](),controller[_0x476f('0x15')]);module[_0x476f('0x16')]=router; \ No newline at end of file +var _0x00c5=['fs-extra','../../components/auth/service','get','isAuthenticated','/describe','/:id','show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x49835e,_0x3cfc98){var _0x3a7149=function(_0x327566){while(--_0x327566){_0x49835e['push'](_0x49835e['shift']());}};_0x3a7149(++_0x3cfc98);}(_0x00c5,0x176));var _0x500c=function(_0x2fbdbb,_0x22e7a2){_0x2fbdbb=_0x2fbdbb-0x0;var _0x30d5cb=_0x00c5[_0x2fbdbb];return _0x30d5cb;};'use strict';var multer=require(_0x500c('0x0'));var util=require(_0x500c('0x1'));var path=require(_0x500c('0x2'));var timeout=require(_0x500c('0x3'));var express=require(_0x500c('0x4'));var router=express[_0x500c('0x5')]();var fs_extra=require(_0x500c('0x6'));var auth=require(_0x500c('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./openchannelQueueReport.controller');router[_0x500c('0x8')]('/',auth[_0x500c('0x9')](),controller['index']);router['get'](_0x500c('0xa'),auth[_0x500c('0x9')](),controller['describe']);router[_0x500c('0x8')](_0x500c('0xb'),auth[_0x500c('0x9')](),controller[_0x500c('0xc')]);router[_0x500c('0xd')]('/',auth[_0x500c('0x9')](),controller['create']);router[_0x500c('0xe')](_0x500c('0xb'),auth['isAuthenticated'](),controller[_0x500c('0xf')]);router[_0x500c('0x10')](_0x500c('0xb'),auth['isAuthenticated'](),controller[_0x500c('0x11')]);module[_0x500c('0x12')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 729e53d..285dcda 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 _0xef2e=['DATE','sequelize','exports','STRING'];(function(_0x3bef2c,_0x5a86fd){var _0x331503=function(_0x463430){while(--_0x463430){_0x3bef2c['push'](_0x3bef2c['shift']());}};_0x331503(++_0x5a86fd);}(_0xef2e,0x141));var _0xeef2=function(_0x1e3923,_0x477ce9){_0x1e3923=_0x1e3923-0x0;var _0x36cd0f=_0xef2e[_0x1e3923];return _0x36cd0f;};'use strict';var moment=require('moment');var Sequelize=require(_0xeef2('0x0'));module[_0xeef2('0x1')]={'uniqueid':{'type':Sequelize[_0xeef2('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xeef2('0x2')]},'joinAt':{'type':Sequelize[_0xeef2('0x3')]},'leaveAt':{'type':Sequelize[_0xeef2('0x3')]},'acceptAt':{'type':Sequelize[_0xeef2('0x3')]},'exitAt':{'type':Sequelize[_0xeef2('0x3')]},'reason':{'type':Sequelize[_0xeef2('0x2')]}}; \ No newline at end of file +var _0x4301=['STRING','DATE','moment','exports'];(function(_0x5064fb,_0x186fc7){var _0x79c73=function(_0x37f89d){while(--_0x37f89d){_0x5064fb['push'](_0x5064fb['shift']());}};_0x79c73(++_0x186fc7);}(_0x4301,0x17a));var _0x1430=function(_0x315e20,_0x2c7d81){_0x315e20=_0x315e20-0x0;var _0x179e39=_0x4301[_0x315e20];return _0x179e39;};'use strict';var moment=require(_0x1430('0x0'));var Sequelize=require('sequelize');module[_0x1430('0x1')]={'uniqueid':{'type':Sequelize[_0x1430('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x1430('0x2')]},'joinAt':{'type':Sequelize[_0x1430('0x3')]},'leaveAt':{'type':Sequelize[_0x1430('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'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 8544913..100b081 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 _0xecbb=['sendStatus','error','name','send','index','map','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','filters','where','merge','type','VIRTUAL','filter','options','OpenchannelQueueReport','includeAll','include','catch','params','rawAttributes','create','body','find','describe','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/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','end','json','undefined','count','offset','limit','status','set','Content-Range','apply','reject','update','then','destroy'];(function(_0x5a5dd3,_0x440504){var _0x22f0ce=function(_0x459960){while(--_0x459960){_0x5a5dd3['push'](_0x5a5dd3['shift']());}};_0x22f0ce(++_0x440504);}(_0xecbb,0x1e9));var _0xbecb=function(_0xc5b0a0,_0x1eb174){_0xc5b0a0=_0xc5b0a0-0x0;var _0x39148f=_0xecbb[_0xc5b0a0];return _0x39148f;};'use strict';var emlformat=require(_0xbecb('0x0'));var rimraf=require(_0xbecb('0x1'));var zipdir=require(_0xbecb('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbecb('0x3'));var moment=require(_0xbecb('0x4'));var BPromise=require(_0xbecb('0x5'));var Mustache=require(_0xbecb('0x6'));var util=require(_0xbecb('0x7'));var path=require(_0xbecb('0x8'));var sox=require(_0xbecb('0x9'));var csv=require(_0xbecb('0xa'));var ejs=require(_0xbecb('0xb'));var fs=require('fs');var fs_extra=require(_0xbecb('0xc'));var _=require(_0xbecb('0xd'));var squel=require(_0xbecb('0xe'));var crypto=require(_0xbecb('0xf'));var jsforce=require(_0xbecb('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xbecb('0xa'));var querystring=require(_0xbecb('0x11'));var Papa=require(_0xbecb('0x12'));var Redis=require(_0xbecb('0x13'));var authService=require(_0xbecb('0x14'));var qs=require(_0xbecb('0x15'));var as=require(_0xbecb('0x16'));var hardwareService=require(_0xbecb('0x17'));var logger=require(_0xbecb('0x18'))(_0xbecb('0x19'));var utils=require(_0xbecb('0x1a'));var config=require(_0xbecb('0x1b'));var licenseUtil=require(_0xbecb('0x1c'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3fd1fa,_0x448380){_0x448380=_0x448380||0xcc;return function(_0x576110){if(_0x576110){return _0x3fd1fa['sendStatus'](_0x448380);}return _0x3fd1fa['status'](_0x448380)[_0xbecb('0x1d')]();};}function respondWithResult(_0x5072d7,_0x3b4911){_0x3b4911=_0x3b4911||0xc8;return function(_0x2c545f){if(_0x2c545f){return _0x5072d7['status'](_0x3b4911)[_0xbecb('0x1e')](_0x2c545f);}};}function respondWithFilteredResult(_0x52930e,_0x41182c){return function(_0x153cce){if(_0x153cce){var _0x1d6e7c=typeof _0x41182c['offset']==='undefined'&&typeof _0x41182c['limit']===_0xbecb('0x1f');var _0x531449=_0x153cce[_0xbecb('0x20')];var _0x7b41cd=_0x1d6e7c?0x0:_0x41182c[_0xbecb('0x21')];var _0x52dfb1=_0x1d6e7c?_0x153cce[_0xbecb('0x20')]:_0x41182c['offset']+_0x41182c[_0xbecb('0x22')];var _0x313e19;if(_0x52dfb1>=_0x531449){_0x52dfb1=_0x531449;_0x313e19=0xc8;}else{_0x313e19=0xce;}_0x52930e[_0xbecb('0x23')](_0x313e19);return _0x52930e[_0xbecb('0x24')](_0xbecb('0x25'),_0x7b41cd+'-'+_0x52dfb1+'/'+_0x531449)[_0xbecb('0x1e')](_0x153cce);}return null;};}function patchUpdates(_0x2ecec6){return function(_0x1fc17f){try{jsonpatch[_0xbecb('0x26')](_0x1fc17f,_0x2ecec6,!![]);}catch(_0xcdaef1){return BPromise[_0xbecb('0x27')](_0xcdaef1);}return _0x1fc17f['save']();};}function saveUpdates(_0x356e16,_0x5ef48b){return function(_0x1b9c48){if(_0x1b9c48){return _0x1b9c48[_0xbecb('0x28')](_0x356e16)[_0xbecb('0x29')](function(_0x1e7771){return _0x1e7771;});}return null;};}function removeEntity(_0x136ddb,_0x2fc3b6){return function(_0xf55100){if(_0xf55100){return _0xf55100[_0xbecb('0x2a')]()[_0xbecb('0x29')](function(){_0x136ddb[_0xbecb('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b43ff,_0x43f2fa){return function(_0x5a2853){if(!_0x5a2853){_0x2b43ff[_0xbecb('0x2b')](0x194);}return _0x5a2853;};}function handleError(_0x2c5893,_0x1172dd){_0x1172dd=_0x1172dd||0x1f4;return function(_0x470fb1){logger[_0xbecb('0x2c')](_0x470fb1['stack']);if(_0x470fb1[_0xbecb('0x2d')]){delete _0x470fb1[_0xbecb('0x2d')];}_0x2c5893[_0xbecb('0x23')](_0x1172dd)[_0xbecb('0x2e')](_0x470fb1);};}exports[_0xbecb('0x2f')]=function(_0x59dc0b,_0x176632){var _0x1959b6={},_0x5e0aa1={},_0x228ab9={'count':0x0,'rows':[]};var _0xb68823=_[_0xbecb('0x30')](db['OpenchannelQueueReport']['rawAttributes'],function(_0x5dd7de){return{'name':_0x5dd7de['fieldName'],'type':_0x5dd7de['type']['key']};});_0x5e0aa1[_0xbecb('0x31')]=_[_0xbecb('0x30')](_0xb68823,_0xbecb('0x2d'));_0x5e0aa1[_0xbecb('0x32')]=_[_0xbecb('0x33')](_0x59dc0b[_0xbecb('0x32')]);_0x5e0aa1['filters']=_['intersection'](_0x5e0aa1[_0xbecb('0x31')],_0x5e0aa1['query']);_0x1959b6['attributes']=_[_0xbecb('0x34')](_0x5e0aa1[_0xbecb('0x31')],qs[_0xbecb('0x35')](_0x59dc0b[_0xbecb('0x32')][_0xbecb('0x35')]));_0x1959b6[_0xbecb('0x36')]=_0x1959b6['attributes'][_0xbecb('0x37')]?_0x1959b6[_0xbecb('0x36')]:_0x5e0aa1[_0xbecb('0x31')];if(!_0x59dc0b['query'][_0xbecb('0x38')](_0xbecb('0x39'))){_0x1959b6['limit']=qs['limit'](_0x59dc0b[_0xbecb('0x32')][_0xbecb('0x22')]);_0x1959b6[_0xbecb('0x21')]=qs['offset'](_0x59dc0b[_0xbecb('0x32')][_0xbecb('0x21')]);}_0x1959b6['order']=qs['sort'](_0x59dc0b[_0xbecb('0x32')][_0xbecb('0x3a')]);_0x1959b6['where']=qs[_0xbecb('0x3b')](_['pick'](_0x59dc0b[_0xbecb('0x32')],_0x5e0aa1[_0xbecb('0x3b')]),_0xb68823);if(_0x59dc0b['query']['filter']){_0x1959b6[_0xbecb('0x3c')]=_[_0xbecb('0x3d')](_0x1959b6['where'],{'$or':_[_0xbecb('0x30')](_0xb68823,function(_0x534a31){if(_0x534a31[_0xbecb('0x3e')]!==_0xbecb('0x3f')){var _0x10ebe9={};_0x10ebe9[_0x534a31[_0xbecb('0x2d')]]={'$like':'%'+_0x59dc0b[_0xbecb('0x32')][_0xbecb('0x40')]+'%'};return _0x10ebe9;}})});}_0x1959b6=_[_0xbecb('0x3d')]({},_0x1959b6,_0x59dc0b[_0xbecb('0x41')]);var _0x550523={'where':_0x1959b6['where']};return db[_0xbecb('0x42')][_0xbecb('0x20')](_0x550523)[_0xbecb('0x29')](function(_0x5b3535){_0x228ab9[_0xbecb('0x20')]=_0x5b3535;if(_0x59dc0b[_0xbecb('0x32')][_0xbecb('0x43')]){_0x1959b6[_0xbecb('0x44')]=[{'all':!![]}];}return db[_0xbecb('0x42')]['findAll'](_0x1959b6);})[_0xbecb('0x29')](function(_0x196f02){_0x228ab9['rows']=_0x196f02;return _0x228ab9;})[_0xbecb('0x29')](respondWithFilteredResult(_0x176632,_0x1959b6))[_0xbecb('0x45')](handleError(_0x176632,null));};exports['show']=function(_0x1de797,_0x50cd2c){var _0x318350={'raw':!![],'where':{'id':_0x1de797[_0xbecb('0x46')]['id']}},_0x2a29bc={};_0x2a29bc[_0xbecb('0x31')]=_[_0xbecb('0x33')](db[_0xbecb('0x42')][_0xbecb('0x47')]);_0x2a29bc[_0xbecb('0x32')]=_[_0xbecb('0x33')](_0x1de797[_0xbecb('0x32')]);_0x2a29bc['filters']=_['intersection'](_0x2a29bc[_0xbecb('0x31')],_0x2a29bc[_0xbecb('0x32')]);_0x318350[_0xbecb('0x36')]=_[_0xbecb('0x34')](_0x2a29bc[_0xbecb('0x31')],qs[_0xbecb('0x35')](_0x1de797[_0xbecb('0x32')]['fields']));_0x318350['attributes']=_0x318350['attributes'][_0xbecb('0x37')]?_0x318350[_0xbecb('0x36')]:_0x2a29bc['model'];if(_0x1de797[_0xbecb('0x32')][_0xbecb('0x43')]){_0x318350['include']=[{'all':!![]}];}_0x318350=_[_0xbecb('0x3d')]({},_0x318350,_0x1de797[_0xbecb('0x41')]);return db[_0xbecb('0x42')]['find'](_0x318350)[_0xbecb('0x29')](handleEntityNotFound(_0x50cd2c,null))[_0xbecb('0x29')](respondWithResult(_0x50cd2c,null))[_0xbecb('0x45')](handleError(_0x50cd2c,null));};exports['create']=function(_0x495f7d,_0x53528f){return db[_0xbecb('0x42')][_0xbecb('0x48')](_0x495f7d[_0xbecb('0x49')],{})[_0xbecb('0x29')](respondWithResult(_0x53528f,0xc9))['catch'](handleError(_0x53528f,null));};exports['update']=function(_0x220795,_0x42876b){if(_0x220795[_0xbecb('0x49')]['id']){delete _0x220795[_0xbecb('0x49')]['id'];}return db[_0xbecb('0x42')]['find']({'where':{'id':_0x220795[_0xbecb('0x46')]['id']}})[_0xbecb('0x29')](handleEntityNotFound(_0x42876b,null))['then'](saveUpdates(_0x220795[_0xbecb('0x49')],null))['then'](respondWithResult(_0x42876b,null))['catch'](handleError(_0x42876b,null));};exports[_0xbecb('0x2a')]=function(_0x284640,_0x4d1da8){return db['OpenchannelQueueReport'][_0xbecb('0x4a')]({'where':{'id':_0x284640[_0xbecb('0x46')]['id']}})[_0xbecb('0x29')](handleEntityNotFound(_0x4d1da8,null))['then'](removeEntity(_0x4d1da8,null))[_0xbecb('0x45')](handleError(_0x4d1da8,null));};exports['describe']=function(_0x7f3e1f,_0x333cd5){return db[_0xbecb('0x42')][_0xbecb('0x4b')]()[_0xbecb('0x29')](respondWithResult(_0x333cd5,null))[_0xbecb('0x45')](handleError(_0x333cd5,null));}; \ No newline at end of file +var _0x4318=['body','catch','find','destroy','describe','rimraf','zip-dir','request-promise','mustache','path','sox','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','sendStatus','stack','name','send','index','map','OpenchannelQueueReport','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','options','include','findAll','rows','params','rawAttributes','includeAll','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4318,0x172));var _0x8431=function(_0x109aa1,_0x5c7736){_0x109aa1=_0x109aa1-0x0;var _0x477618=_0x4318[_0x109aa1];return _0x477618;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8431('0x0'));var zipdir=require(_0x8431('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8431('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8431('0x3'));var util=require('util');var path=require(_0x8431('0x4'));var sox=require(_0x8431('0x5'));var csv=require(_0x8431('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8431('0x7'));var _=require('lodash');var squel=require(_0x8431('0x8'));var crypto=require(_0x8431('0x9'));var jsforce=require(_0x8431('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x8431('0x6'));var querystring=require(_0x8431('0xb'));var Papa=require(_0x8431('0xc'));var Redis=require(_0x8431('0xd'));var authService=require(_0x8431('0xe'));var qs=require(_0x8431('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8431('0x10'));var logger=require(_0x8431('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x8431('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x8431('0x13'))['db'];function respondWithStatusCode(_0xf278fb,_0x70c05){_0x70c05=_0x70c05||0xcc;return function(_0x4b53a5){if(_0x4b53a5){return _0xf278fb['sendStatus'](_0x70c05);}return _0xf278fb['status'](_0x70c05)[_0x8431('0x14')]();};}function respondWithResult(_0x1297ca,_0x3ec12b){_0x3ec12b=_0x3ec12b||0xc8;return function(_0x598db4){if(_0x598db4){return _0x1297ca[_0x8431('0x15')](_0x3ec12b)[_0x8431('0x16')](_0x598db4);}};}function respondWithFilteredResult(_0x5a2a85,_0x117fdc){return function(_0x1fee47){if(_0x1fee47){var _0x23891f=typeof _0x117fdc[_0x8431('0x17')]===_0x8431('0x18')&&typeof _0x117fdc[_0x8431('0x19')]===_0x8431('0x18');var _0xe01dbc=_0x1fee47['count'];var _0x945d10=_0x23891f?0x0:_0x117fdc[_0x8431('0x17')];var _0x2c8107=_0x23891f?_0x1fee47[_0x8431('0x1a')]:_0x117fdc[_0x8431('0x17')]+_0x117fdc[_0x8431('0x19')];var _0x5ed34b;if(_0x2c8107>=_0xe01dbc){_0x2c8107=_0xe01dbc;_0x5ed34b=0xc8;}else{_0x5ed34b=0xce;}_0x5a2a85[_0x8431('0x15')](_0x5ed34b);return _0x5a2a85[_0x8431('0x1b')](_0x8431('0x1c'),_0x945d10+'-'+_0x2c8107+'/'+_0xe01dbc)[_0x8431('0x16')](_0x1fee47);}return null;};}function patchUpdates(_0x20bfb6){return function(_0x1c5d39){try{jsonpatch[_0x8431('0x1d')](_0x1c5d39,_0x20bfb6,!![]);}catch(_0x5ee8ac){return BPromise[_0x8431('0x1e')](_0x5ee8ac);}return _0x1c5d39[_0x8431('0x1f')]();};}function saveUpdates(_0x170921,_0x2df195){return function(_0x43f0d7){if(_0x43f0d7){return _0x43f0d7[_0x8431('0x20')](_0x170921)[_0x8431('0x21')](function(_0x505618){return _0x505618;});}return null;};}function removeEntity(_0x5f3a9d,_0x28fbcc){return function(_0x30274c){if(_0x30274c){return _0x30274c['destroy']()['then'](function(){_0x5f3a9d['status'](0xcc)[_0x8431('0x14')]();});}};}function handleEntityNotFound(_0xf72d94,_0x504d29){return function(_0x2f706c){if(!_0x2f706c){_0xf72d94[_0x8431('0x22')](0x194);}return _0x2f706c;};}function handleError(_0x18fb9d,_0xa3dc65){_0xa3dc65=_0xa3dc65||0x1f4;return function(_0x165f04){logger['error'](_0x165f04[_0x8431('0x23')]);if(_0x165f04['name']){delete _0x165f04[_0x8431('0x24')];}_0x18fb9d[_0x8431('0x15')](_0xa3dc65)[_0x8431('0x25')](_0x165f04);};}exports[_0x8431('0x26')]=function(_0x357de7,_0x243bbd){var _0x651f17={},_0x4ef462={},_0x212f75={'count':0x0,'rows':[]};var _0x42e4a9=_[_0x8431('0x27')](db[_0x8431('0x28')]['rawAttributes'],function(_0x24244c){return{'name':_0x24244c[_0x8431('0x29')],'type':_0x24244c[_0x8431('0x2a')][_0x8431('0x2b')]};});_0x4ef462['model']=_[_0x8431('0x27')](_0x42e4a9,_0x8431('0x24'));_0x4ef462[_0x8431('0x2c')]=_[_0x8431('0x2d')](_0x357de7[_0x8431('0x2c')]);_0x4ef462[_0x8431('0x2e')]=_[_0x8431('0x2f')](_0x4ef462['model'],_0x4ef462['query']);_0x651f17[_0x8431('0x30')]=_[_0x8431('0x2f')](_0x4ef462[_0x8431('0x31')],qs[_0x8431('0x32')](_0x357de7[_0x8431('0x2c')][_0x8431('0x32')]));_0x651f17[_0x8431('0x30')]=_0x651f17[_0x8431('0x30')][_0x8431('0x33')]?_0x651f17[_0x8431('0x30')]:_0x4ef462['model'];if(!_0x357de7[_0x8431('0x2c')][_0x8431('0x34')](_0x8431('0x35'))){_0x651f17[_0x8431('0x19')]=qs[_0x8431('0x19')](_0x357de7['query'][_0x8431('0x19')]);_0x651f17[_0x8431('0x17')]=qs[_0x8431('0x17')](_0x357de7[_0x8431('0x2c')][_0x8431('0x17')]);}_0x651f17[_0x8431('0x36')]=qs['sort'](_0x357de7[_0x8431('0x2c')][_0x8431('0x37')]);_0x651f17['where']=qs[_0x8431('0x2e')](_[_0x8431('0x38')](_0x357de7[_0x8431('0x2c')],_0x4ef462[_0x8431('0x2e')]),_0x42e4a9);if(_0x357de7[_0x8431('0x2c')][_0x8431('0x39')]){_0x651f17[_0x8431('0x3a')]=_['merge'](_0x651f17[_0x8431('0x3a')],{'$or':_[_0x8431('0x27')](_0x42e4a9,function(_0x59800e){if(_0x59800e[_0x8431('0x2a')]!==_0x8431('0x3b')){var _0x1920f2={};_0x1920f2[_0x59800e[_0x8431('0x24')]]={'$like':'%'+_0x357de7['query'][_0x8431('0x39')]+'%'};return _0x1920f2;}})});}_0x651f17=_['merge']({},_0x651f17,_0x357de7[_0x8431('0x3c')]);var _0x1d0058={'where':_0x651f17[_0x8431('0x3a')]};return db[_0x8431('0x28')][_0x8431('0x1a')](_0x1d0058)[_0x8431('0x21')](function(_0x29e822){_0x212f75[_0x8431('0x1a')]=_0x29e822;if(_0x357de7[_0x8431('0x2c')]['includeAll']){_0x651f17[_0x8431('0x3d')]=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0x8431('0x3e')](_0x651f17);})['then'](function(_0x3afae7){_0x212f75[_0x8431('0x3f')]=_0x3afae7;return _0x212f75;})['then'](respondWithFilteredResult(_0x243bbd,_0x651f17))['catch'](handleError(_0x243bbd,null));};exports['show']=function(_0x16162d,_0x8fb9db){var _0x575c31={'raw':!![],'where':{'id':_0x16162d[_0x8431('0x40')]['id']}},_0x5c9234={};_0x5c9234[_0x8431('0x31')]=_[_0x8431('0x2d')](db[_0x8431('0x28')][_0x8431('0x41')]);_0x5c9234[_0x8431('0x2c')]=_[_0x8431('0x2d')](_0x16162d[_0x8431('0x2c')]);_0x5c9234[_0x8431('0x2e')]=_[_0x8431('0x2f')](_0x5c9234['model'],_0x5c9234['query']);_0x575c31[_0x8431('0x30')]=_[_0x8431('0x2f')](_0x5c9234['model'],qs['fields'](_0x16162d['query'][_0x8431('0x32')]));_0x575c31[_0x8431('0x30')]=_0x575c31[_0x8431('0x30')][_0x8431('0x33')]?_0x575c31[_0x8431('0x30')]:_0x5c9234['model'];if(_0x16162d[_0x8431('0x2c')][_0x8431('0x42')]){_0x575c31[_0x8431('0x3d')]=[{'all':!![]}];}_0x575c31=_['merge']({},_0x575c31,_0x16162d[_0x8431('0x3c')]);return db['OpenchannelQueueReport']['find'](_0x575c31)[_0x8431('0x21')](handleEntityNotFound(_0x8fb9db,null))[_0x8431('0x21')](respondWithResult(_0x8fb9db,null))['catch'](handleError(_0x8fb9db,null));};exports[_0x8431('0x43')]=function(_0xda3566,_0x14371d){return db[_0x8431('0x28')][_0x8431('0x43')](_0xda3566[_0x8431('0x44')],{})[_0x8431('0x21')](respondWithResult(_0x14371d,0xc9))[_0x8431('0x45')](handleError(_0x14371d,null));};exports[_0x8431('0x20')]=function(_0x6d8f43,_0x5764c9){if(_0x6d8f43[_0x8431('0x44')]['id']){delete _0x6d8f43[_0x8431('0x44')]['id'];}return db['OpenchannelQueueReport'][_0x8431('0x46')]({'where':{'id':_0x6d8f43['params']['id']}})[_0x8431('0x21')](handleEntityNotFound(_0x5764c9,null))[_0x8431('0x21')](saveUpdates(_0x6d8f43[_0x8431('0x44')],null))[_0x8431('0x21')](respondWithResult(_0x5764c9,null))['catch'](handleError(_0x5764c9,null));};exports[_0x8431('0x47')]=function(_0x42c169,_0x2067a3){return db[_0x8431('0x28')][_0x8431('0x46')]({'where':{'id':_0x42c169['params']['id']}})[_0x8431('0x21')](handleEntityNotFound(_0x2067a3,null))[_0x8431('0x21')](removeEntity(_0x2067a3,null))[_0x8431('0x45')](handleError(_0x2067a3,null));};exports['describe']=function(_0x4a8545,_0x25b4e3){return db[_0x8431('0x28')][_0x8431('0x48')]()[_0x8431('0x21')](respondWithResult(_0x25b4e3,null))[_0x8431('0x45')](handleError(_0x25b4e3,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index cd8a3cf..6f32bbf 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 _0x814b=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','uniqueid','lodash','util'];(function(_0x3c4737,_0x2329ec){var _0x2bb926=function(_0x3b9605){while(--_0x3b9605){_0x3c4737['push'](_0x3c4737['shift']());}};_0x2bb926(++_0x2329ec);}(_0x814b,0x1a2));var _0xb814=function(_0x30c649,_0x2ebbac){_0x30c649=_0x30c649-0x0;var _0x3edfb9=_0x814b[_0x30c649];return _0x3edfb9;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var logger=require(_0xb814('0x2'))(_0xb814('0x3'));var moment=require(_0xb814('0x4'));var BPromise=require(_0xb814('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb814('0x6'));var rimraf=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var attributes=require(_0xb814('0x9'));module[_0xb814('0xa')]=function(_0x322a70,_0x53e507){return _0x322a70[_0xb814('0xb')](_0xb814('0xc'),attributes,{'tableName':'report_openchannel_queue','paranoid':![],'indexes':[{'name':_0xb814('0xd'),'fields':[_0xb814('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe14b=['bluebird','path','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','lodash','util','moment'];(function(_0x5935ad,_0x53dcfb){var _0x8b73e7=function(_0x3234ca){while(--_0x3234ca){_0x5935ad['push'](_0x5935ad['shift']());}};_0x8b73e7(++_0x53dcfb);}(_0xe14b,0x93));var _0xbe14=function(_0x40ccd8,_0x5bec28){_0x40ccd8=_0x40ccd8-0x0;var _0x59bf62=_0xe14b[_0x40ccd8];return _0x59bf62;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));module[_0xbe14('0x6')]=function(_0x1fe204,_0x1ff100){return _0x1fe204[_0xbe14('0x7')](_0xbe14('0x8'),attributes,{'tableName':_0xbe14('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index eb80dcf..4f8a322 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 _0x0abf=['debug','lodash','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','OpenchannelQueueReport,\x20%s,\x20%s','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw','then','UpdateOpenchannelQueueReport','where','attributes','limit'];(function(_0x3b583,_0x17b2c4){var _0x5b3e66=function(_0x3052e2){while(--_0x3052e2){_0x3b583['push'](_0x3b583['shift']());}};_0x5b3e66(++_0x17b2c4);}(_0x0abf,0xe8));var _0xf0ab=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x0abf[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0xf0ab('0x0'));var util=require('util');var moment=require(_0xf0ab('0x1'));var BPromise=require(_0xf0ab('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf0ab('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xf0ab('0x4'))(_0xf0ab('0x5'));var config=require(_0xf0ab('0x6'));var jayson=require(_0xf0ab('0x7'));var client=jayson[_0xf0ab('0x8')][_0xf0ab('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x233afe,_0x57ff3b,_0x2c4628){return new BPromise(function(_0x3f7e2b,_0x3ca099){return client[_0xf0ab('0xa')](_0x233afe,_0x2c4628)['then'](function(_0x472508){logger[_0xf0ab('0xb')](_0xf0ab('0xc'),_0x57ff3b,'request\x20sent');logger['debug'](_0xf0ab('0xd'),_0x57ff3b,'request\x20sent',JSON[_0xf0ab('0xe')](_0x472508));if(_0x472508[_0xf0ab('0xf')]){if(_0x472508[_0xf0ab('0xf')][_0xf0ab('0x10')]===0x1f4){logger[_0xf0ab('0xf')](_0xf0ab('0xc'),_0x57ff3b,_0x472508[_0xf0ab('0xf')]['message']);return _0x3ca099(_0x472508[_0xf0ab('0xf')][_0xf0ab('0x11')]);}logger[_0xf0ab('0xf')](_0xf0ab('0xc'),_0x57ff3b,_0x472508[_0xf0ab('0xf')][_0xf0ab('0x11')]);return _0x3f7e2b(_0x472508[_0xf0ab('0xf')][_0xf0ab('0x11')]);}else{logger[_0xf0ab('0xb')](_0xf0ab('0xc'),_0x57ff3b,_0xf0ab('0x12'));_0x3f7e2b(_0x472508[_0xf0ab('0x13')][_0xf0ab('0x11')]);}})[_0xf0ab('0x14')](function(_0x230f40){logger['error'](_0xf0ab('0xc'),_0x57ff3b,_0x230f40);_0x3ca099(_0x230f40);});});}exports[_0xf0ab('0x15')]=function(_0x1803f0){var _0x1ffeb5=this;return new Promise(function(_0x776619,_0xb9a33){return db[_0xf0ab('0x16')][_0xf0ab('0x17')](_0x1803f0[_0xf0ab('0x18')],{'raw':_0x1803f0[_0xf0ab('0x19')]?_0x1803f0[_0xf0ab('0x19')][_0xf0ab('0x1a')]===undefined?!![]:![]:!![]})[_0xf0ab('0x1b')](function(_0x22a205){logger[_0xf0ab('0xb')](_0xf0ab('0x15'),_0x1803f0);logger['debug'](_0xf0ab('0x15'),_0x1803f0,JSON[_0xf0ab('0xe')](_0x22a205));_0x776619(_0x22a205);})[_0xf0ab('0x14')](function(_0x11ab3a){logger[_0xf0ab('0xf')](_0xf0ab('0x15'),_0x11ab3a[_0xf0ab('0x11')],_0x1803f0);_0xb9a33(_0x1ffeb5[_0xf0ab('0xf')](0x1f4,_0x11ab3a[_0xf0ab('0x11')]));});});};exports[_0xf0ab('0x1c')]=function(_0x43119f){var _0x5645b2=this;return new Promise(function(_0x585841,_0x4eee21){return db[_0xf0ab('0x16')]['update'](_0x43119f[_0xf0ab('0x18')],{'raw':_0x43119f[_0xf0ab('0x19')]?_0x43119f['options'][_0xf0ab('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x43119f[_0xf0ab('0x19')]?_0x43119f[_0xf0ab('0x19')][_0xf0ab('0x1d')]||null:null,'attributes':_0x43119f[_0xf0ab('0x19')]?_0x43119f['options'][_0xf0ab('0x1e')]||null:null,'limit':_0x43119f['options']?_0x43119f['options'][_0xf0ab('0x1f')]||null:null})[_0xf0ab('0x1b')](function(_0x1b223d){logger[_0xf0ab('0xb')](_0xf0ab('0x1c'),_0x43119f);logger[_0xf0ab('0x20')](_0xf0ab('0x1c'),_0x43119f,JSON[_0xf0ab('0xe')](_0x1b223d));_0x585841(_0x1b223d);})[_0xf0ab('0x14')](function(_0x2f0fcd){logger[_0xf0ab('0xf')](_0xf0ab('0x1c'),_0x2f0fcd['message'],_0x43119f);_0x4eee21(_0x5645b2[_0xf0ab('0xf')](0x1f4,_0x2f0fcd[_0xf0ab('0x11')]));});});}; \ No newline at end of file +var _0x8a5c=['attributes','UpdateOpenchannelQueueReport','stringify','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateOpenchannelQueueReport','create','options','OpenchannelQueueReport','update','body','where'];(function(_0x215a97,_0x260828){var _0x18b929=function(_0x491685){while(--_0x491685){_0x215a97['push'](_0x215a97['shift']());}};_0x18b929(++_0x260828);}(_0x8a5c,0x136));var _0xc8a5=function(_0x2bd2f8,_0x30d042){_0x2bd2f8=_0x2bd2f8-0x0;var _0xe97db6=_0x8a5c[_0x2bd2f8];return _0xe97db6;};'use strict';var _=require(_0xc8a5('0x0'));var util=require(_0xc8a5('0x1'));var moment=require(_0xc8a5('0x2'));var BPromise=require(_0xc8a5('0x3'));var rs=require(_0xc8a5('0x4'));var fs=require('fs');var Redis=require(_0xc8a5('0x5'));var db=require(_0xc8a5('0x6'))['db'];var utils=require(_0xc8a5('0x7'));var logger=require(_0xc8a5('0x8'))('rpc');var config=require(_0xc8a5('0x9'));var jayson=require(_0xc8a5('0xa'));var client=jayson['client'][_0xc8a5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xcee97e,_0xd6de78,_0xa9f42c){return new BPromise(function(_0x4d25e4,_0x3ecf08){return client[_0xc8a5('0xc')](_0xcee97e,_0xa9f42c)[_0xc8a5('0xd')](function(_0x2c1fe9){logger[_0xc8a5('0xe')](_0xc8a5('0xf'),_0xd6de78,_0xc8a5('0x10'));logger[_0xc8a5('0x11')](_0xc8a5('0x12'),_0xd6de78,'request\x20sent',JSON['stringify'](_0x2c1fe9));if(_0x2c1fe9[_0xc8a5('0x13')]){if(_0x2c1fe9['error'][_0xc8a5('0x14')]===0x1f4){logger[_0xc8a5('0x13')](_0xc8a5('0xf'),_0xd6de78,_0x2c1fe9[_0xc8a5('0x13')][_0xc8a5('0x15')]);return _0x3ecf08(_0x2c1fe9['error'][_0xc8a5('0x15')]);}logger[_0xc8a5('0x13')]('OpenchannelQueueReport,\x20%s,\x20%s',_0xd6de78,_0x2c1fe9[_0xc8a5('0x13')][_0xc8a5('0x15')]);return _0x4d25e4(_0x2c1fe9[_0xc8a5('0x13')][_0xc8a5('0x15')]);}else{logger[_0xc8a5('0xe')](_0xc8a5('0xf'),_0xd6de78,'request\x20sent');_0x4d25e4(_0x2c1fe9[_0xc8a5('0x16')][_0xc8a5('0x15')]);}})['catch'](function(_0x36a78b){logger[_0xc8a5('0x13')]('OpenchannelQueueReport,\x20%s,\x20%s',_0xd6de78,_0x36a78b);_0x3ecf08(_0x36a78b);});});}exports[_0xc8a5('0x17')]=function(_0x3ef8d3){var _0x12a441=this;return new Promise(function(_0x1326e2,_0x1ea105){return db['OpenchannelQueueReport'][_0xc8a5('0x18')](_0x3ef8d3['body'],{'raw':_0x3ef8d3[_0xc8a5('0x19')]?_0x3ef8d3[_0xc8a5('0x19')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x866737){logger[_0xc8a5('0xe')](_0xc8a5('0x17'),_0x3ef8d3);logger[_0xc8a5('0x11')](_0xc8a5('0x17'),_0x3ef8d3,JSON['stringify'](_0x866737));_0x1326e2(_0x866737);})['catch'](function(_0x3e2058){logger[_0xc8a5('0x13')](_0xc8a5('0x17'),_0x3e2058[_0xc8a5('0x15')],_0x3ef8d3);_0x1ea105(_0x12a441[_0xc8a5('0x13')](0x1f4,_0x3e2058[_0xc8a5('0x15')]));});});};exports['UpdateOpenchannelQueueReport']=function(_0x1b3870){var _0x3beb20=this;return new Promise(function(_0x266c59,_0x1e522c){return db[_0xc8a5('0x1a')][_0xc8a5('0x1b')](_0x1b3870[_0xc8a5('0x1c')],{'raw':_0x1b3870[_0xc8a5('0x19')]?_0x1b3870[_0xc8a5('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b3870[_0xc8a5('0x19')]?_0x1b3870[_0xc8a5('0x19')][_0xc8a5('0x1d')]||null:null,'attributes':_0x1b3870[_0xc8a5('0x19')]?_0x1b3870[_0xc8a5('0x19')][_0xc8a5('0x1e')]||null:null,'limit':_0x1b3870[_0xc8a5('0x19')]?_0x1b3870['options']['limit']||null:null})[_0xc8a5('0xd')](function(_0x4e0a4b){logger['info'](_0xc8a5('0x1f'),_0x1b3870);logger[_0xc8a5('0x11')](_0xc8a5('0x1f'),_0x1b3870,JSON[_0xc8a5('0x20')](_0x4e0a4b));_0x266c59(_0x4e0a4b);})[_0xc8a5('0x21')](function(_0x31c416){logger['error'](_0xc8a5('0x1f'),_0x31c416[_0xc8a5('0x15')],_0x1b3870);_0x1e522c(_0x3beb20[_0xc8a5('0x13')](0x1f4,_0x31c416[_0xc8a5('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 448368c..25e06c1 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 _0x49e7=['create','put','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelTransferReport.controller','isAuthenticated','get','/describe','describe','/:id','show','post'];(function(_0x506d83,_0x1899e9){var _0x335e8b=function(_0x4a7044){while(--_0x4a7044){_0x506d83['push'](_0x506d83['shift']());}};_0x335e8b(++_0x1899e9);}(_0x49e7,0x194));var _0x749e=function(_0x570b34,_0x537c5c){_0x570b34=_0x570b34-0x0;var _0x325f61=_0x49e7[_0x570b34];return _0x325f61;};'use strict';var multer=require(_0x749e('0x0'));var util=require(_0x749e('0x1'));var path=require('path');var timeout=require(_0x749e('0x2'));var express=require(_0x749e('0x3'));var router=express[_0x749e('0x4')]();var fs_extra=require(_0x749e('0x5'));var auth=require(_0x749e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x749e('0x7'));var controller=require(_0x749e('0x8'));router['get']('/',auth[_0x749e('0x9')](),controller['index']);router[_0x749e('0xa')](_0x749e('0xb'),auth['isAuthenticated'](),controller[_0x749e('0xc')]);router[_0x749e('0xa')](_0x749e('0xd'),auth['isAuthenticated'](),controller[_0x749e('0xe')]);router[_0x749e('0xf')]('/',auth[_0x749e('0x9')](),controller[_0x749e('0x10')]);router[_0x749e('0x11')](_0x749e('0xd'),auth[_0x749e('0x9')](),controller[_0x749e('0x12')]);router[_0x749e('0x13')](_0x749e('0xd'),auth[_0x749e('0x9')](),controller['destroy']);module[_0x749e('0x14')]=router; \ No newline at end of file +var _0x45c6=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','show','post','put','/:id','update','destroy','multer','util','path'];(function(_0x1e53b2,_0x191d2b){var _0x4680f6=function(_0x1221a4){while(--_0x1221a4){_0x1e53b2['push'](_0x1e53b2['shift']());}};_0x4680f6(++_0x191d2b);}(_0x45c6,0x6f));var _0x645c=function(_0x148cd4,_0x3bb783){_0x148cd4=_0x148cd4-0x0;var _0x1b8338=_0x45c6[_0x148cd4];return _0x1b8338;};'use strict';var multer=require(_0x645c('0x0'));var util=require(_0x645c('0x1'));var path=require(_0x645c('0x2'));var timeout=require('connect-timeout');var express=require(_0x645c('0x3'));var router=express[_0x645c('0x4')]();var fs_extra=require(_0x645c('0x5'));var auth=require(_0x645c('0x6'));var interaction=require(_0x645c('0x7'));var config=require(_0x645c('0x8'));var controller=require('./openchannelTransferReport.controller');router[_0x645c('0x9')]('/',auth[_0x645c('0xa')](),controller['index']);router['get'](_0x645c('0xb'),auth[_0x645c('0xa')](),controller[_0x645c('0xc')]);router[_0x645c('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x645c('0xd')]);router[_0x645c('0xe')]('/',auth[_0x645c('0xa')](),controller['create']);router[_0x645c('0xf')](_0x645c('0x10'),auth[_0x645c('0xa')](),controller[_0x645c('0x11')]);router['delete'](_0x645c('0x10'),auth['isAuthenticated'](),controller[_0x645c('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 63c3eab..594505e 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 _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0x5235dd,_0x3f91cf){var _0x13059d=function(_0x355a98){while(--_0x355a98){_0x5235dd['push'](_0x5235dd['shift']());}};_0x13059d(++_0x3f91cf);}(_0x9bde,0xe1));var _0xe9bd=function(_0xb1e0e6,_0x5bb567){_0xb1e0e6=_0xb1e0e6-0x0;var _0x5af99b=_0x9bde[_0xb1e0e6];return _0x5af99b;};'use strict';var moment=require('moment');var Sequelize=require(_0xe9bd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe9bd('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe9bd('0x2'),_0xe9bd('0x3'),_0xe9bd('0x4')),'allowNull':![],'defaultValue':_0xe9bd('0x4')},'transferredAt':{'type':Sequelize[_0xe9bd('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xe9bd('0x6')]}}; \ No newline at end of file +var _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x5a80db,_0x260ce5){var _0x39c515=function(_0x5c7a4d){while(--_0x5c7a4d){_0x5a80db['push'](_0x5a80db['shift']());}};_0x39c515(++_0x260ce5);}(_0xf4eb,0xec));var _0xbf4e=function(_0x311672,_0x2f36e6){_0x311672=_0x311672-0x0;var _0x995323=_0xf4eb[_0x311672];return _0x995323;};'use strict';var moment=require(_0xbf4e('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbf4e('0x1'),'agent','queue'),'allowNull':![],'defaultValue':_0xbf4e('0x2')},'transferredAt':{'type':Sequelize[_0xbf4e('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xbf4e('0x4')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 630f925..69c2375 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 _0x71d1=['../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','offset','undefined','limit','count','Content-Range','reject','save','update','destroy','then','error','stack','name','send','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','filter','map','VIRTUAL','merge','options','OpenchannelTransferReport','includeAll','include','findAll','rows','catch','show','length','find','create','body','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x2b1d64,_0x26cf26){var _0x564387=function(_0x8e63dc){while(--_0x8e63dc){_0x2b1d64['push'](_0x2b1d64['shift']());}};_0x564387(++_0x26cf26);}(_0x71d1,0x110));var _0x171d=function(_0x233cb1,_0x8ca9a2){_0x233cb1=_0x233cb1-0x0;var _0x29ee7e=_0x71d1[_0x233cb1];return _0x29ee7e;};'use strict';var emlformat=require(_0x171d('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x171d('0x1'));var rp=require(_0x171d('0x2'));var moment=require(_0x171d('0x3'));var BPromise=require(_0x171d('0x4'));var Mustache=require(_0x171d('0x5'));var util=require(_0x171d('0x6'));var path=require('path');var sox=require(_0x171d('0x7'));var csv=require(_0x171d('0x8'));var ejs=require(_0x171d('0x9'));var fs=require('fs');var fs_extra=require(_0x171d('0xa'));var _=require(_0x171d('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x171d('0xc'));var deskjs=require(_0x171d('0xd'));var toCsv=require('to-csv');var querystring=require(_0x171d('0xe'));var Papa=require(_0x171d('0xf'));var Redis=require(_0x171d('0x10'));var authService=require(_0x171d('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x171d('0x12'));var hardwareService=require(_0x171d('0x13'));var logger=require(_0x171d('0x14'))(_0x171d('0x15'));var utils=require(_0x171d('0x16'));var config=require(_0x171d('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1ef23f,_0x5f1823){_0x5f1823=_0x5f1823||0xcc;return function(_0x39b908){if(_0x39b908){return _0x1ef23f[_0x171d('0x18')](_0x5f1823);}return _0x1ef23f[_0x171d('0x19')](_0x5f1823)[_0x171d('0x1a')]();};}function respondWithResult(_0x1bf8d8,_0xdb685f){_0xdb685f=_0xdb685f||0xc8;return function(_0x3796d4){if(_0x3796d4){return _0x1bf8d8[_0x171d('0x19')](_0xdb685f)['json'](_0x3796d4);}};}function respondWithFilteredResult(_0x16acd5,_0x931093){return function(_0x288c86){if(_0x288c86){var _0xc67a42=typeof _0x931093[_0x171d('0x1b')]===_0x171d('0x1c')&&typeof _0x931093[_0x171d('0x1d')]===_0x171d('0x1c');var _0x5a0cc0=_0x288c86[_0x171d('0x1e')];var _0x239281=_0xc67a42?0x0:_0x931093['offset'];var _0x30acbf=_0xc67a42?_0x288c86[_0x171d('0x1e')]:_0x931093[_0x171d('0x1b')]+_0x931093['limit'];var _0x28f9c3;if(_0x30acbf>=_0x5a0cc0){_0x30acbf=_0x5a0cc0;_0x28f9c3=0xc8;}else{_0x28f9c3=0xce;}_0x16acd5['status'](_0x28f9c3);return _0x16acd5['set'](_0x171d('0x1f'),_0x239281+'-'+_0x30acbf+'/'+_0x5a0cc0)['json'](_0x288c86);}return null;};}function patchUpdates(_0x3b9791){return function(_0x4b84d2){try{jsonpatch['apply'](_0x4b84d2,_0x3b9791,!![]);}catch(_0x5e620c){return BPromise[_0x171d('0x20')](_0x5e620c);}return _0x4b84d2[_0x171d('0x21')]();};}function saveUpdates(_0x43b8eb,_0x5563ee){return function(_0x4b67ea){if(_0x4b67ea){return _0x4b67ea[_0x171d('0x22')](_0x43b8eb)['then'](function(_0x36b662){return _0x36b662;});}return null;};}function removeEntity(_0x18f968,_0x2f0b09){return function(_0x42d528){if(_0x42d528){return _0x42d528[_0x171d('0x23')]()[_0x171d('0x24')](function(){_0x18f968[_0x171d('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9ab80,_0x1a69c3){return function(_0x36d1d4){if(!_0x36d1d4){_0x9ab80['sendStatus'](0x194);}return _0x36d1d4;};}function handleError(_0x343656,_0x9ea33a){_0x9ea33a=_0x9ea33a||0x1f4;return function(_0x47ef37){logger[_0x171d('0x25')](_0x47ef37[_0x171d('0x26')]);if(_0x47ef37[_0x171d('0x27')]){delete _0x47ef37[_0x171d('0x27')];}_0x343656[_0x171d('0x19')](_0x9ea33a)[_0x171d('0x28')](_0x47ef37);};}exports['index']=function(_0x5d7754,_0x303b60){var _0x4a85ac={},_0x1999e5={},_0x25c80b={'count':0x0,'rows':[]};var _0x5e15b0=_['map'](db['OpenchannelTransferReport'][_0x171d('0x29')],function(_0x2c00e3){return{'name':_0x2c00e3[_0x171d('0x2a')],'type':_0x2c00e3[_0x171d('0x2b')][_0x171d('0x2c')]};});_0x1999e5[_0x171d('0x2d')]=_['map'](_0x5e15b0,_0x171d('0x27'));_0x1999e5[_0x171d('0x2e')]=_[_0x171d('0x2f')](_0x5d7754[_0x171d('0x2e')]);_0x1999e5['filters']=_['intersection'](_0x1999e5['model'],_0x1999e5[_0x171d('0x2e')]);_0x4a85ac['attributes']=_[_0x171d('0x30')](_0x1999e5[_0x171d('0x2d')],qs[_0x171d('0x31')](_0x5d7754[_0x171d('0x2e')][_0x171d('0x31')]));_0x4a85ac[_0x171d('0x32')]=_0x4a85ac[_0x171d('0x32')]['length']?_0x4a85ac[_0x171d('0x32')]:_0x1999e5[_0x171d('0x2d')];if(!_0x5d7754[_0x171d('0x2e')][_0x171d('0x33')](_0x171d('0x34'))){_0x4a85ac[_0x171d('0x1d')]=qs['limit'](_0x5d7754[_0x171d('0x2e')]['limit']);_0x4a85ac['offset']=qs[_0x171d('0x1b')](_0x5d7754[_0x171d('0x2e')]['offset']);}_0x4a85ac[_0x171d('0x35')]=qs[_0x171d('0x36')](_0x5d7754[_0x171d('0x2e')][_0x171d('0x36')]);_0x4a85ac[_0x171d('0x37')]=qs[_0x171d('0x38')](_['pick'](_0x5d7754[_0x171d('0x2e')],_0x1999e5[_0x171d('0x38')]),_0x5e15b0);if(_0x5d7754[_0x171d('0x2e')][_0x171d('0x39')]){_0x4a85ac[_0x171d('0x37')]=_['merge'](_0x4a85ac[_0x171d('0x37')],{'$or':_[_0x171d('0x3a')](_0x5e15b0,function(_0x3968ee){if(_0x3968ee[_0x171d('0x2b')]!==_0x171d('0x3b')){var _0x56c4e0={};_0x56c4e0[_0x3968ee[_0x171d('0x27')]]={'$like':'%'+_0x5d7754['query'][_0x171d('0x39')]+'%'};return _0x56c4e0;}})});}_0x4a85ac=_[_0x171d('0x3c')]({},_0x4a85ac,_0x5d7754[_0x171d('0x3d')]);var _0x280422={'where':_0x4a85ac[_0x171d('0x37')]};return db[_0x171d('0x3e')][_0x171d('0x1e')](_0x280422)['then'](function(_0x1c0d36){_0x25c80b[_0x171d('0x1e')]=_0x1c0d36;if(_0x5d7754[_0x171d('0x2e')][_0x171d('0x3f')]){_0x4a85ac[_0x171d('0x40')]=[{'all':!![]}];}return db['OpenchannelTransferReport'][_0x171d('0x41')](_0x4a85ac);})['then'](function(_0x38f7a1){_0x25c80b[_0x171d('0x42')]=_0x38f7a1;return _0x25c80b;})[_0x171d('0x24')](respondWithFilteredResult(_0x303b60,_0x4a85ac))[_0x171d('0x43')](handleError(_0x303b60,null));};exports[_0x171d('0x44')]=function(_0x201223,_0x2cdb2d){var _0x3a043d={'raw':!![],'where':{'id':_0x201223['params']['id']}},_0xc4e3ca={};_0xc4e3ca[_0x171d('0x2d')]=_['keys'](db[_0x171d('0x3e')][_0x171d('0x29')]);_0xc4e3ca[_0x171d('0x2e')]=_[_0x171d('0x2f')](_0x201223[_0x171d('0x2e')]);_0xc4e3ca[_0x171d('0x38')]=_[_0x171d('0x30')](_0xc4e3ca[_0x171d('0x2d')],_0xc4e3ca[_0x171d('0x2e')]);_0x3a043d[_0x171d('0x32')]=_[_0x171d('0x30')](_0xc4e3ca[_0x171d('0x2d')],qs[_0x171d('0x31')](_0x201223[_0x171d('0x2e')][_0x171d('0x31')]));_0x3a043d['attributes']=_0x3a043d[_0x171d('0x32')][_0x171d('0x45')]?_0x3a043d['attributes']:_0xc4e3ca[_0x171d('0x2d')];if(_0x201223['query'][_0x171d('0x3f')]){_0x3a043d[_0x171d('0x40')]=[{'all':!![]}];}_0x3a043d=_['merge']({},_0x3a043d,_0x201223[_0x171d('0x3d')]);return db['OpenchannelTransferReport'][_0x171d('0x46')](_0x3a043d)[_0x171d('0x24')](handleEntityNotFound(_0x2cdb2d,null))[_0x171d('0x24')](respondWithResult(_0x2cdb2d,null))[_0x171d('0x43')](handleError(_0x2cdb2d,null));};exports[_0x171d('0x47')]=function(_0x12818b,_0x1af0bb){return db[_0x171d('0x3e')][_0x171d('0x47')](_0x12818b[_0x171d('0x48')],{})[_0x171d('0x24')](respondWithResult(_0x1af0bb,0xc9))['catch'](handleError(_0x1af0bb,null));};exports['update']=function(_0x3c3406,_0x4dc7a1){if(_0x3c3406[_0x171d('0x48')]['id']){delete _0x3c3406[_0x171d('0x48')]['id'];}return db['OpenchannelTransferReport'][_0x171d('0x46')]({'where':{'id':_0x3c3406['params']['id']}})[_0x171d('0x24')](handleEntityNotFound(_0x4dc7a1,null))[_0x171d('0x24')](saveUpdates(_0x3c3406[_0x171d('0x48')],null))[_0x171d('0x24')](respondWithResult(_0x4dc7a1,null))[_0x171d('0x43')](handleError(_0x4dc7a1,null));};exports['destroy']=function(_0x44fa1f,_0x163c30){return db[_0x171d('0x3e')][_0x171d('0x46')]({'where':{'id':_0x44fa1f['params']['id']}})[_0x171d('0x24')](handleEntityNotFound(_0x163c30,null))['then'](removeEntity(_0x163c30,null))['catch'](handleError(_0x163c30,null));};exports['describe']=function(_0xd08a1c,_0x40c28b){return db[_0x171d('0x3e')]['describe']()[_0x171d('0x24')](respondWithResult(_0x40c28b,null))[_0x171d('0x43')](handleError(_0x40c28b,null));}; \ No newline at end of file +var _0x03d2=['options','includeAll','include','findAll','catch','show','find','create','body','params','describe','eml-format','rimraf','zip-dir','moment','bluebird','mustache','sox','fs-extra','lodash','desk.js','querystring','papaparse','../../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','Content-Range','apply','reject','save','then','destroy','error','name','send','index','OpenchannelTransferReport','rawAttributes','fieldName','type','model','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','query','order','sort','where','pick','filter','merge','map','VIRTUAL'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0x03d2,0xe3));var _0x203d=function(_0x116538,_0x1d9449){_0x116538=_0x116538-0x0;var _0x521263=_0x03d2[_0x116538];return _0x521263;};'use strict';var emlformat=require(_0x203d('0x0'));var rimraf=require(_0x203d('0x1'));var zipdir=require(_0x203d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x203d('0x3'));var BPromise=require(_0x203d('0x4'));var Mustache=require(_0x203d('0x5'));var util=require('util');var path=require('path');var sox=require(_0x203d('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x203d('0x7'));var _=require(_0x203d('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x203d('0x9'));var toCsv=require('to-csv');var querystring=require(_0x203d('0xa'));var Papa=require(_0x203d('0xb'));var Redis=require('ioredis');var authService=require(_0x203d('0xc'));var qs=require(_0x203d('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x203d('0xe'));var logger=require(_0x203d('0xf'))(_0x203d('0x10'));var utils=require('../../config/utils');var config=require(_0x203d('0x11'));var licenseUtil=require(_0x203d('0x12'));var db=require(_0x203d('0x13'))['db'];function respondWithStatusCode(_0xed2b2b,_0x12f9ba){_0x12f9ba=_0x12f9ba||0xcc;return function(_0x1fbd04){if(_0x1fbd04){return _0xed2b2b[_0x203d('0x14')](_0x12f9ba);}return _0xed2b2b[_0x203d('0x15')](_0x12f9ba)[_0x203d('0x16')]();};}function respondWithResult(_0x1ff3b5,_0x3efc25){_0x3efc25=_0x3efc25||0xc8;return function(_0x23f69e){if(_0x23f69e){return _0x1ff3b5['status'](_0x3efc25)[_0x203d('0x17')](_0x23f69e);}};}function respondWithFilteredResult(_0x5e7c7f,_0x4c3e54){return function(_0x144ef5){if(_0x144ef5){var _0x1eabfb=typeof _0x4c3e54[_0x203d('0x18')]==='undefined'&&typeof _0x4c3e54[_0x203d('0x19')]===_0x203d('0x1a');var _0x33b4ba=_0x144ef5[_0x203d('0x1b')];var _0x135716=_0x1eabfb?0x0:_0x4c3e54[_0x203d('0x18')];var _0x5e92fd=_0x1eabfb?_0x144ef5[_0x203d('0x1b')]:_0x4c3e54[_0x203d('0x18')]+_0x4c3e54[_0x203d('0x19')];var _0x33c8cd;if(_0x5e92fd>=_0x33b4ba){_0x5e92fd=_0x33b4ba;_0x33c8cd=0xc8;}else{_0x33c8cd=0xce;}_0x5e7c7f[_0x203d('0x15')](_0x33c8cd);return _0x5e7c7f[_0x203d('0x1c')](_0x203d('0x1d'),_0x135716+'-'+_0x5e92fd+'/'+_0x33b4ba)[_0x203d('0x17')](_0x144ef5);}return null;};}function patchUpdates(_0x175c98){return function(_0x4c4645){try{jsonpatch[_0x203d('0x1e')](_0x4c4645,_0x175c98,!![]);}catch(_0x24f97a){return BPromise[_0x203d('0x1f')](_0x24f97a);}return _0x4c4645[_0x203d('0x20')]();};}function saveUpdates(_0x5c64f7,_0x12c331){return function(_0x76f08){if(_0x76f08){return _0x76f08['update'](_0x5c64f7)[_0x203d('0x21')](function(_0x3c723b){return _0x3c723b;});}return null;};}function removeEntity(_0xa7db45,_0x2c1306){return function(_0x57795c){if(_0x57795c){return _0x57795c[_0x203d('0x22')]()[_0x203d('0x21')](function(){_0xa7db45[_0x203d('0x15')](0xcc)[_0x203d('0x16')]();});}};}function handleEntityNotFound(_0x93387f,_0x5c2c98){return function(_0x55a70e){if(!_0x55a70e){_0x93387f[_0x203d('0x14')](0x194);}return _0x55a70e;};}function handleError(_0x215852,_0x1e976c){_0x1e976c=_0x1e976c||0x1f4;return function(_0x45c113){logger[_0x203d('0x23')](_0x45c113['stack']);if(_0x45c113[_0x203d('0x24')]){delete _0x45c113[_0x203d('0x24')];}_0x215852[_0x203d('0x15')](_0x1e976c)[_0x203d('0x25')](_0x45c113);};}exports[_0x203d('0x26')]=function(_0x1efddb,_0x30181e){var _0x22f7ea={},_0x39c731={},_0x4f358e={'count':0x0,'rows':[]};var _0x42fc61=_['map'](db[_0x203d('0x27')][_0x203d('0x28')],function(_0x205fc4){return{'name':_0x205fc4[_0x203d('0x29')],'type':_0x205fc4[_0x203d('0x2a')]['key']};});_0x39c731[_0x203d('0x2b')]=_['map'](_0x42fc61,'name');_0x39c731['query']=_[_0x203d('0x2c')](_0x1efddb['query']);_0x39c731[_0x203d('0x2d')]=_[_0x203d('0x2e')](_0x39c731[_0x203d('0x2b')],_0x39c731['query']);_0x22f7ea[_0x203d('0x2f')]=_[_0x203d('0x2e')](_0x39c731[_0x203d('0x2b')],qs[_0x203d('0x30')](_0x1efddb['query'][_0x203d('0x30')]));_0x22f7ea['attributes']=_0x22f7ea[_0x203d('0x2f')][_0x203d('0x31')]?_0x22f7ea[_0x203d('0x2f')]:_0x39c731['model'];if(!_0x1efddb['query'][_0x203d('0x32')](_0x203d('0x33'))){_0x22f7ea['limit']=qs[_0x203d('0x19')](_0x1efddb[_0x203d('0x34')][_0x203d('0x19')]);_0x22f7ea[_0x203d('0x18')]=qs[_0x203d('0x18')](_0x1efddb[_0x203d('0x34')][_0x203d('0x18')]);}_0x22f7ea[_0x203d('0x35')]=qs[_0x203d('0x36')](_0x1efddb['query']['sort']);_0x22f7ea[_0x203d('0x37')]=qs[_0x203d('0x2d')](_[_0x203d('0x38')](_0x1efddb['query'],_0x39c731['filters']),_0x42fc61);if(_0x1efddb[_0x203d('0x34')][_0x203d('0x39')]){_0x22f7ea[_0x203d('0x37')]=_[_0x203d('0x3a')](_0x22f7ea[_0x203d('0x37')],{'$or':_[_0x203d('0x3b')](_0x42fc61,function(_0x4456a3){if(_0x4456a3[_0x203d('0x2a')]!==_0x203d('0x3c')){var _0xf38556={};_0xf38556[_0x4456a3[_0x203d('0x24')]]={'$like':'%'+_0x1efddb[_0x203d('0x34')][_0x203d('0x39')]+'%'};return _0xf38556;}})});}_0x22f7ea=_[_0x203d('0x3a')]({},_0x22f7ea,_0x1efddb[_0x203d('0x3d')]);var _0x3370f5={'where':_0x22f7ea[_0x203d('0x37')]};return db[_0x203d('0x27')][_0x203d('0x1b')](_0x3370f5)[_0x203d('0x21')](function(_0xf905ea){_0x4f358e['count']=_0xf905ea;if(_0x1efddb[_0x203d('0x34')][_0x203d('0x3e')]){_0x22f7ea[_0x203d('0x3f')]=[{'all':!![]}];}return db[_0x203d('0x27')][_0x203d('0x40')](_0x22f7ea);})[_0x203d('0x21')](function(_0x302477){_0x4f358e['rows']=_0x302477;return _0x4f358e;})['then'](respondWithFilteredResult(_0x30181e,_0x22f7ea))[_0x203d('0x41')](handleError(_0x30181e,null));};exports[_0x203d('0x42')]=function(_0xf9285d,_0xc72b77){var _0x182016={'raw':!![],'where':{'id':_0xf9285d['params']['id']}},_0x1b78a8={};_0x1b78a8[_0x203d('0x2b')]=_[_0x203d('0x2c')](db[_0x203d('0x27')][_0x203d('0x28')]);_0x1b78a8[_0x203d('0x34')]=_[_0x203d('0x2c')](_0xf9285d['query']);_0x1b78a8['filters']=_[_0x203d('0x2e')](_0x1b78a8[_0x203d('0x2b')],_0x1b78a8[_0x203d('0x34')]);_0x182016['attributes']=_['intersection'](_0x1b78a8['model'],qs[_0x203d('0x30')](_0xf9285d[_0x203d('0x34')][_0x203d('0x30')]));_0x182016[_0x203d('0x2f')]=_0x182016[_0x203d('0x2f')][_0x203d('0x31')]?_0x182016[_0x203d('0x2f')]:_0x1b78a8[_0x203d('0x2b')];if(_0xf9285d[_0x203d('0x34')][_0x203d('0x3e')]){_0x182016[_0x203d('0x3f')]=[{'all':!![]}];}_0x182016=_[_0x203d('0x3a')]({},_0x182016,_0xf9285d[_0x203d('0x3d')]);return db['OpenchannelTransferReport'][_0x203d('0x43')](_0x182016)[_0x203d('0x21')](handleEntityNotFound(_0xc72b77,null))[_0x203d('0x21')](respondWithResult(_0xc72b77,null))[_0x203d('0x41')](handleError(_0xc72b77,null));};exports[_0x203d('0x44')]=function(_0x5674aa,_0x24de74){return db[_0x203d('0x27')][_0x203d('0x44')](_0x5674aa[_0x203d('0x45')],{})[_0x203d('0x21')](respondWithResult(_0x24de74,0xc9))[_0x203d('0x41')](handleError(_0x24de74,null));};exports['update']=function(_0x248680,_0x176db9){if(_0x248680['body']['id']){delete _0x248680[_0x203d('0x45')]['id'];}return db[_0x203d('0x27')][_0x203d('0x43')]({'where':{'id':_0x248680[_0x203d('0x46')]['id']}})['then'](handleEntityNotFound(_0x176db9,null))[_0x203d('0x21')](saveUpdates(_0x248680['body'],null))[_0x203d('0x21')](respondWithResult(_0x176db9,null))[_0x203d('0x41')](handleError(_0x176db9,null));};exports[_0x203d('0x22')]=function(_0xe11fe8,_0x3d55c4){return db['OpenchannelTransferReport']['find']({'where':{'id':_0xe11fe8[_0x203d('0x46')]['id']}})[_0x203d('0x21')](handleEntityNotFound(_0x3d55c4,null))[_0x203d('0x21')](removeEntity(_0x3d55c4,null))['catch'](handleError(_0x3d55c4,null));};exports[_0x203d('0x47')]=function(_0xa0bcff,_0x2e1623){return db[_0x203d('0x27')][_0x203d('0x47')]()['then'](respondWithResult(_0x2e1623,null))['catch'](handleError(_0x2e1623,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index be6b24d..37d5e9e 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 _0x483f=['../../config/environment','./openchannelTransferReport.attributes','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x5471ec,_0x1ce81a){var _0x121d4c=function(_0xefb655){while(--_0xefb655){_0x5471ec['push'](_0x5471ec['shift']());}};_0x121d4c(++_0x1ce81a);}(_0x483f,0x1c6));var _0xf483=function(_0x125adf,_0x2b49f8){_0x125adf=_0x125adf-0x0;var _0x4231de=_0x483f[_0x125adf];return _0x4231de;};'use strict';var _=require(_0xf483('0x0'));var util=require(_0xf483('0x1'));var logger=require('../../config/logger')(_0xf483('0x2'));var moment=require(_0xf483('0x3'));var BPromise=require(_0xf483('0x4'));var rp=require(_0xf483('0x5'));var fs=require('fs');var path=require(_0xf483('0x6'));var rimraf=require(_0xf483('0x7'));var config=require(_0xf483('0x8'));var attributes=require(_0xf483('0x9'));module['exports']=function(_0x119fe7,_0x622499){return _0x119fe7[_0xf483('0xa')](_0xf483('0xb'),attributes,{'tableName':_0xf483('0xc'),'paranoid':![],'indexes':[{'name':_0xf483('0xd'),'fields':[_0xf483('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd736=['path','../../config/environment','./openchannelTransferReport.attributes','exports','report_openchannel_transfer','uniqueid','util','../../config/logger','bluebird','request-promise'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xd736,0xd8));var _0x6d73=function(_0x5e527c,_0x201442){_0x5e527c=_0x5e527c-0x0;var _0x58865f=_0xd736[_0x5e527c];return _0x58865f;};'use strict';var _=require('lodash');var util=require(_0x6d73('0x0'));var logger=require(_0x6d73('0x1'))('api');var moment=require('moment');var BPromise=require(_0x6d73('0x2'));var rp=require(_0x6d73('0x3'));var fs=require('fs');var path=require(_0x6d73('0x4'));var rimraf=require('rimraf');var config=require(_0x6d73('0x5'));var attributes=require(_0x6d73('0x6'));module[_0x6d73('0x7')]=function(_0x260cf6,_0x1ac085){return _0x260cf6['define']('OpenchannelTransferReport',attributes,{'tableName':_0x6d73('0x8'),'paranoid':![],'indexes':[{'name':_0x6d73('0x9'),'fields':[_0x6d73('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 255e6d7..7b4bed2 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 _0x2975=['http','request','then','info','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','OpenchannelTransferReport,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client'];(function(_0x26224c,_0x1a354c){var _0x4c2bc5=function(_0x179343){while(--_0x179343){_0x26224c['push'](_0x26224c['shift']());}};_0x4c2bc5(++_0x1a354c);}(_0x2975,0x1c5));var _0x5297=function(_0x2be399,_0x14aeff){_0x2be399=_0x2be399-0x0;var _0x2fd8bc=_0x2975[_0x2be399];return _0x2fd8bc;};'use strict';var _=require('lodash');var util=require(_0x5297('0x0'));var moment=require(_0x5297('0x1'));var BPromise=require(_0x5297('0x2'));var rs=require(_0x5297('0x3'));var fs=require('fs');var Redis=require(_0x5297('0x4'));var db=require(_0x5297('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x5297('0x6'));var jayson=require(_0x5297('0x7'));var client=jayson[_0x5297('0x8')][_0x5297('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4d1d2c,_0x1f6762,_0x1b72a7){return new BPromise(function(_0x4f12b0,_0x2c015c){return client[_0x5297('0xa')](_0x4d1d2c,_0x1b72a7)[_0x5297('0xb')](function(_0x2f3b24){logger[_0x5297('0xc')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x1f6762,_0x5297('0xd'));logger[_0x5297('0xe')](_0x5297('0xf'),_0x1f6762,'request\x20sent',JSON[_0x5297('0x10')](_0x2f3b24));if(_0x2f3b24[_0x5297('0x11')]){if(_0x2f3b24[_0x5297('0x11')]['code']===0x1f4){logger[_0x5297('0x11')](_0x5297('0x12'),_0x1f6762,_0x2f3b24['error']['message']);return _0x2c015c(_0x2f3b24[_0x5297('0x11')][_0x5297('0x13')]);}logger['error'](_0x5297('0x12'),_0x1f6762,_0x2f3b24['error'][_0x5297('0x13')]);return _0x4f12b0(_0x2f3b24[_0x5297('0x11')]['message']);}else{logger[_0x5297('0xc')](_0x5297('0x12'),_0x1f6762,_0x5297('0xd'));_0x4f12b0(_0x2f3b24[_0x5297('0x14')][_0x5297('0x13')]);}})[_0x5297('0x15')](function(_0x1fb138){logger[_0x5297('0x11')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x1f6762,_0x1fb138);_0x2c015c(_0x1fb138);});});} \ No newline at end of file +var _0x5183=['../../config/utils','../../config/logger','jayson/promise','client','http','request','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','moment','ioredis','../../mysqldb'];(function(_0x595604,_0x2cc998){var _0x1466f3=function(_0x4e1d9b){while(--_0x4e1d9b){_0x595604['push'](_0x595604['shift']());}};_0x1466f3(++_0x2cc998);}(_0x5183,0x13e));var _0x3518=function(_0x43dea6,_0x34bef7){_0x43dea6=_0x43dea6-0x0;var _0x35c208=_0x5183[_0x43dea6];return _0x35c208;};'use strict';var _=require(_0x3518('0x0'));var util=require(_0x3518('0x1'));var moment=require(_0x3518('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3518('0x3'));var db=require(_0x3518('0x4'))['db'];var utils=require(_0x3518('0x5'));var logger=require(_0x3518('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3518('0x7'));var client=jayson[_0x3518('0x8')][_0x3518('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x482b2d,_0x5cd139,_0x488c52){return new BPromise(function(_0x147b59,_0x33e66c){return client[_0x3518('0xa')](_0x482b2d,_0x488c52)['then'](function(_0x12530b){logger['info'](_0x3518('0xb'),_0x5cd139,_0x3518('0xc'));logger[_0x3518('0xd')]('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x5cd139,_0x3518('0xc'),JSON[_0x3518('0xe')](_0x12530b));if(_0x12530b['error']){if(_0x12530b[_0x3518('0xf')][_0x3518('0x10')]===0x1f4){logger[_0x3518('0xf')](_0x3518('0xb'),_0x5cd139,_0x12530b['error']['message']);return _0x33e66c(_0x12530b[_0x3518('0xf')][_0x3518('0x11')]);}logger[_0x3518('0xf')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x5cd139,_0x12530b['error'][_0x3518('0x11')]);return _0x147b59(_0x12530b[_0x3518('0xf')][_0x3518('0x11')]);}else{logger['info'](_0x3518('0xb'),_0x5cd139,_0x3518('0xc'));_0x147b59(_0x12530b[_0x3518('0x12')][_0x3518('0x11')]);}})['catch'](function(_0xc7f658){logger['error'](_0x3518('0xb'),_0x5cd139,_0xc7f658);_0x33e66c(_0xc7f658);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 8f3e2c4..8a9b13f 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 _0x34eb=['put','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x200bd1,_0x4b8663){var _0x3af85d=function(_0x1e8b5f){while(--_0x1e8b5f){_0x200bd1['push'](_0x200bd1['shift']());}};_0x3af85d(++_0x4b8663);}(_0x34eb,0x180));var _0xb34e=function(_0x16f5db,_0x281a74){_0x16f5db=_0x16f5db-0x0;var _0x152def=_0x34eb[_0x16f5db];return _0x152def;};'use strict';var multer=require(_0xb34e('0x0'));var util=require(_0xb34e('0x1'));var path=require(_0xb34e('0x2'));var timeout=require(_0xb34e('0x3'));var express=require('express');var router=express[_0xb34e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb34e('0x5'));var interaction=require(_0xb34e('0x6'));var config=require(_0xb34e('0x7'));var controller=require(_0xb34e('0x8'));router[_0xb34e('0x9')]('/',auth[_0xb34e('0xa')](),controller[_0xb34e('0xb')]);router['get'](_0xb34e('0xc'),auth[_0xb34e('0xa')](),controller[_0xb34e('0xd')]);router[_0xb34e('0xe')]('/',auth[_0xb34e('0xa')](),controller[_0xb34e('0xf')]);router[_0xb34e('0x10')](_0xb34e('0xc'),auth[_0xb34e('0xa')](),controller[_0xb34e('0x11')]);router[_0xb34e('0x12')](_0xb34e('0xc'),auth[_0xb34e('0xa')](),controller['destroy']);module[_0xb34e('0x13')]=router; \ No newline at end of file +var _0x3815=['../../components/auth/service','./pause.controller','isAuthenticated','index','/:id','post','destroy','multer','util','path','connect-timeout','fs-extra'];(function(_0x51a307,_0x59611c){var _0x203737=function(_0x57a1e9){while(--_0x57a1e9){_0x51a307['push'](_0x51a307['shift']());}};_0x203737(++_0x59611c);}(_0x3815,0xf7));var _0x5381=function(_0x387d1a,_0x23237f){_0x387d1a=_0x387d1a-0x0;var _0xe7674=_0x3815[_0x387d1a];return _0xe7674;};'use strict';var multer=require(_0x5381('0x0'));var util=require(_0x5381('0x1'));var path=require(_0x5381('0x2'));var timeout=require(_0x5381('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x5381('0x4'));var auth=require(_0x5381('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5381('0x6'));router['get']('/',auth[_0x5381('0x7')](),controller[_0x5381('0x8')]);router['get'](_0x5381('0x9'),auth[_0x5381('0x7')](),controller['show']);router[_0x5381('0xa')]('/',auth[_0x5381('0x7')](),controller['create']);router['put']('/:id',auth[_0x5381('0x7')](),controller['update']);router['delete'](_0x5381('0x9'),auth['isAuthenticated'](),controller[_0x5381('0xb')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 0df3794..0987d33 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 _0x7b8c=['sequelize','exports','STRING','name'];(function(_0x5093e9,_0x5154d0){var _0x4c9a22=function(_0x15176d){while(--_0x15176d){_0x5093e9['push'](_0x5093e9['shift']());}};_0x4c9a22(++_0x5154d0);}(_0x7b8c,0x144));var _0xc7b8=function(_0x21e7c5,_0x53f50e){_0x21e7c5=_0x21e7c5-0x0;var _0x209c26=_0x7b8c[_0x21e7c5];return _0x209c26;};'use strict';var Sequelize=require(_0xc7b8('0x0'));module[_0xc7b8('0x1')]={'name':{'type':Sequelize[_0xc7b8('0x2')],'unique':_0xc7b8('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xc7b8('0x2')]}}; \ No newline at end of file +var _0xe460=['exports','STRING'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe460,0xfc));var _0x0e46=function(_0x23c73d,_0x357b21){_0x23c73d=_0x23c73d-0x0;var _0x36ba47=_0xe460[_0x23c73d];return _0x36ba47;};'use strict';var Sequelize=require('sequelize');module[_0x0e46('0x0')]={'name':{'type':Sequelize[_0x0e46('0x1')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x0e46('0x1')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 4f3d12f..275570c 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 _0xf076=['stack','name','Pause','rawAttributes','fieldName','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','includeAll','include','findAll','rows','catch','params','options','find','create','body','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','update','then','get','Pauses','UserProfileResource','destroy','error'];(function(_0x46ad22,_0x5dd46e){var _0x20fe9c=function(_0x5b7aff){while(--_0x5b7aff){_0x46ad22['push'](_0x46ad22['shift']());}};_0x20fe9c(++_0x5dd46e);}(_0xf076,0x72));var _0x6f07=function(_0x182d1a,_0x20981e){_0x182d1a=_0x182d1a-0x0;var _0xf1e587=_0xf076[_0x182d1a];return _0xf1e587;};'use strict';var emlformat=require(_0x6f07('0x0'));var rimraf=require(_0x6f07('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6f07('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6f07('0x3'));var util=require(_0x6f07('0x4'));var path=require(_0x6f07('0x5'));var sox=require(_0x6f07('0x6'));var csv=require(_0x6f07('0x7'));var ejs=require(_0x6f07('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6f07('0x9'));var squel=require('squel');var crypto=require(_0x6f07('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x6f07('0xb'));var toCsv=require(_0x6f07('0x7'));var querystring=require(_0x6f07('0xc'));var Papa=require(_0x6f07('0xd'));var Redis=require(_0x6f07('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x6f07('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6f07('0x10'));var logger=require(_0x6f07('0x11'))(_0x6f07('0x12'));var utils=require('../../config/utils');var config=require(_0x6f07('0x13'));var licenseUtil=require(_0x6f07('0x14'));var db=require(_0x6f07('0x15'))['db'];function respondWithStatusCode(_0xca11a5,_0x24c5e1){_0x24c5e1=_0x24c5e1||0xcc;return function(_0xa2bad5){if(_0xa2bad5){return _0xca11a5[_0x6f07('0x16')](_0x24c5e1);}return _0xca11a5[_0x6f07('0x17')](_0x24c5e1)[_0x6f07('0x18')]();};}function respondWithResult(_0x1540e3,_0x1317dd){_0x1317dd=_0x1317dd||0xc8;return function(_0x191188){if(_0x191188){return _0x1540e3[_0x6f07('0x17')](_0x1317dd)['json'](_0x191188);}};}function respondWithFilteredResult(_0x255ede,_0x5355c5){return function(_0x40e1be){if(_0x40e1be){var _0x1e5a74=typeof _0x5355c5[_0x6f07('0x19')]===_0x6f07('0x1a')&&typeof _0x5355c5[_0x6f07('0x1b')]==='undefined';var _0x3e2e35=_0x40e1be[_0x6f07('0x1c')];var _0x15cd4e=_0x1e5a74?0x0:_0x5355c5[_0x6f07('0x19')];var _0x238713=_0x1e5a74?_0x40e1be[_0x6f07('0x1c')]:_0x5355c5[_0x6f07('0x19')]+_0x5355c5[_0x6f07('0x1b')];var _0x4c9b51;if(_0x238713>=_0x3e2e35){_0x238713=_0x3e2e35;_0x4c9b51=0xc8;}else{_0x4c9b51=0xce;}_0x255ede[_0x6f07('0x17')](_0x4c9b51);return _0x255ede[_0x6f07('0x1d')](_0x6f07('0x1e'),_0x15cd4e+'-'+_0x238713+'/'+_0x3e2e35)[_0x6f07('0x1f')](_0x40e1be);}return null;};}function patchUpdates(_0x475326){return function(_0x41b9bc){try{jsonpatch['apply'](_0x41b9bc,_0x475326,!![]);}catch(_0x19297f){return BPromise[_0x6f07('0x20')](_0x19297f);}return _0x41b9bc['save']();};}function saveUpdates(_0x291d08,_0x558a3b){return function(_0x3b3fd6){if(_0x3b3fd6){return _0x3b3fd6[_0x6f07('0x21')](_0x291d08)[_0x6f07('0x22')](function(_0x57528f){return _0x57528f;});}return null;};}function removeEntity(_0x3a9670,_0x1cd1df){return function(_0x57b0bb){if(_0x57b0bb){return _0x57b0bb['destroy']()[_0x6f07('0x22')](function(){var _0x585963=_0x57b0bb[_0x6f07('0x23')]({'plain':!![]});var _0xd19440=_0x6f07('0x24');return db[_0x6f07('0x25')][_0x6f07('0x26')]({'where':{'type':_0xd19440,'resourceId':_0x585963['id']}})[_0x6f07('0x22')](function(){return _0x57b0bb;});})[_0x6f07('0x22')](function(){_0x3a9670[_0x6f07('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4717ba,_0x555fd5){return function(_0x3b7ff4){if(!_0x3b7ff4){_0x4717ba[_0x6f07('0x16')](0x194);}return _0x3b7ff4;};}function handleError(_0x672611,_0x209c48){_0x209c48=_0x209c48||0x1f4;return function(_0x33ba02){logger[_0x6f07('0x27')](_0x33ba02[_0x6f07('0x28')]);if(_0x33ba02[_0x6f07('0x29')]){delete _0x33ba02[_0x6f07('0x29')];}_0x672611[_0x6f07('0x17')](_0x209c48)['send'](_0x33ba02);};}exports['index']=function(_0x5ec30b,_0x462161){var _0x57bed2={},_0x2baa00={},_0x530a03={'count':0x0,'rows':[]};var _0x865f7c=_['map'](db[_0x6f07('0x2a')][_0x6f07('0x2b')],function(_0x3e86f6){return{'name':_0x3e86f6[_0x6f07('0x2c')],'type':_0x3e86f6['type']['key']};});_0x2baa00[_0x6f07('0x2d')]=_[_0x6f07('0x2e')](_0x865f7c,_0x6f07('0x29'));_0x2baa00[_0x6f07('0x2f')]=_[_0x6f07('0x30')](_0x5ec30b['query']);_0x2baa00[_0x6f07('0x31')]=_[_0x6f07('0x32')](_0x2baa00[_0x6f07('0x2d')],_0x2baa00['query']);_0x57bed2[_0x6f07('0x33')]=_[_0x6f07('0x32')](_0x2baa00[_0x6f07('0x2d')],qs[_0x6f07('0x34')](_0x5ec30b['query']['fields']));_0x57bed2[_0x6f07('0x33')]=_0x57bed2['attributes'][_0x6f07('0x35')]?_0x57bed2[_0x6f07('0x33')]:_0x2baa00[_0x6f07('0x2d')];if(!_0x5ec30b[_0x6f07('0x2f')][_0x6f07('0x36')](_0x6f07('0x37'))){_0x57bed2[_0x6f07('0x1b')]=qs['limit'](_0x5ec30b[_0x6f07('0x2f')]['limit']);_0x57bed2[_0x6f07('0x19')]=qs['offset'](_0x5ec30b['query'][_0x6f07('0x19')]);}_0x57bed2[_0x6f07('0x38')]=qs[_0x6f07('0x39')](_0x5ec30b[_0x6f07('0x2f')][_0x6f07('0x39')]);_0x57bed2['where']=qs[_0x6f07('0x31')](_[_0x6f07('0x3a')](_0x5ec30b[_0x6f07('0x2f')],_0x2baa00[_0x6f07('0x31')]),_0x865f7c);if(_0x5ec30b[_0x6f07('0x2f')][_0x6f07('0x3b')]){_0x57bed2['where']=_[_0x6f07('0x3c')](_0x57bed2[_0x6f07('0x3d')],{'$or':_['map'](_0x865f7c,function(_0x16cbb2){if(_0x16cbb2['type']!==_0x6f07('0x3e')){var _0x29e093={};_0x29e093[_0x16cbb2[_0x6f07('0x29')]]={'$like':'%'+_0x5ec30b['query'][_0x6f07('0x3b')]+'%'};return _0x29e093;}})});}_0x57bed2=_[_0x6f07('0x3c')]({},_0x57bed2,_0x5ec30b['options']);var _0x52ecbd={'where':_0x57bed2[_0x6f07('0x3d')]};return db[_0x6f07('0x2a')][_0x6f07('0x1c')](_0x52ecbd)[_0x6f07('0x22')](function(_0x59e6d9){_0x530a03[_0x6f07('0x1c')]=_0x59e6d9;if(_0x5ec30b[_0x6f07('0x2f')][_0x6f07('0x3f')]){_0x57bed2[_0x6f07('0x40')]=[{'all':!![]}];}return db['Pause'][_0x6f07('0x41')](_0x57bed2);})[_0x6f07('0x22')](function(_0x38833d){_0x530a03[_0x6f07('0x42')]=_0x38833d;return _0x530a03;})[_0x6f07('0x22')](respondWithFilteredResult(_0x462161,_0x57bed2))[_0x6f07('0x43')](handleError(_0x462161,null));};exports['show']=function(_0x327582,_0x367790){var _0xe6963a={'raw':!![],'where':{'id':_0x327582[_0x6f07('0x44')]['id']}},_0x456396={};_0x456396['model']=_[_0x6f07('0x30')](db[_0x6f07('0x2a')][_0x6f07('0x2b')]);_0x456396[_0x6f07('0x2f')]=_[_0x6f07('0x30')](_0x327582[_0x6f07('0x2f')]);_0x456396[_0x6f07('0x31')]=_[_0x6f07('0x32')](_0x456396[_0x6f07('0x2d')],_0x456396[_0x6f07('0x2f')]);_0xe6963a[_0x6f07('0x33')]=_[_0x6f07('0x32')](_0x456396['model'],qs[_0x6f07('0x34')](_0x327582[_0x6f07('0x2f')][_0x6f07('0x34')]));_0xe6963a[_0x6f07('0x33')]=_0xe6963a[_0x6f07('0x33')][_0x6f07('0x35')]?_0xe6963a[_0x6f07('0x33')]:_0x456396[_0x6f07('0x2d')];if(_0x327582[_0x6f07('0x2f')][_0x6f07('0x3f')]){_0xe6963a[_0x6f07('0x40')]=[{'all':!![]}];}_0xe6963a=_[_0x6f07('0x3c')]({},_0xe6963a,_0x327582[_0x6f07('0x45')]);return db[_0x6f07('0x2a')][_0x6f07('0x46')](_0xe6963a)['then'](handleEntityNotFound(_0x367790,null))[_0x6f07('0x22')](respondWithResult(_0x367790,null))['catch'](handleError(_0x367790,null));};exports['create']=function(_0x57ae68,_0xe0ace){return db['Pause'][_0x6f07('0x47')](_0x57ae68[_0x6f07('0x48')],{})[_0x6f07('0x22')](function(_0x129283){var _0x43bf97=_0x57ae68[_0x6f07('0x49')]['get']({'plain':!![]});if(!_0x43bf97)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x43bf97['role']===_0x6f07('0x49')){var _0x29150f=_0x129283[_0x6f07('0x23')]({'plain':!![]});var _0x29aa81=_0x6f07('0x24');return db[_0x6f07('0x4a')]['find']({'where':{'name':_0x29aa81,'userProfileId':_0x43bf97['userProfileId']},'raw':!![]})['then'](function(_0x166bc9){if(_0x166bc9&&_0x166bc9[_0x6f07('0x4b')]===0x0){return db['UserProfileResource'][_0x6f07('0x47')]({'name':_0x29150f['name'],'resourceId':_0x29150f['id'],'type':_0x166bc9[_0x6f07('0x29')],'sectionId':_0x166bc9['id']},{})['then'](function(){return _0x129283;});}else{return _0x129283;}})[_0x6f07('0x43')](function(_0x5c53f0){logger[_0x6f07('0x27')](_0x6f07('0x4c'),_0x5c53f0);throw _0x5c53f0;});}return _0x129283;})[_0x6f07('0x22')](respondWithResult(_0xe0ace,0xc9))[_0x6f07('0x43')](handleError(_0xe0ace,null));};exports['update']=function(_0x17ca43,_0x44cd1d){if(_0x17ca43['body']['id']){delete _0x17ca43[_0x6f07('0x48')]['id'];}return db[_0x6f07('0x2a')][_0x6f07('0x46')]({'where':{'id':_0x17ca43[_0x6f07('0x44')]['id']}})[_0x6f07('0x22')](handleEntityNotFound(_0x44cd1d,null))[_0x6f07('0x22')](saveUpdates(_0x17ca43['body'],null))[_0x6f07('0x22')](respondWithResult(_0x44cd1d,null))[_0x6f07('0x43')](handleError(_0x44cd1d,null));};exports[_0x6f07('0x26')]=function(_0x4a3b51,_0x578004){return db[_0x6f07('0x2a')][_0x6f07('0x46')]({'where':{'id':_0x4a3b51[_0x6f07('0x44')]['id']}})[_0x6f07('0x22')](handleEntityNotFound(_0x578004,null))[_0x6f07('0x22')](removeEntity(_0x578004,null))[_0x6f07('0x43')](handleError(_0x578004,null));}; \ No newline at end of file +var _0xfdda=['map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','count','includeAll','findAll','rows','catch','params','keys','Pause','options','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','set','Content-Range','apply','reject','update','destroy','then','Pauses','UserProfileResource','end','error','stack','name','send','index','rawAttributes','key','model'];(function(_0x1719d6,_0x342358){var _0x333446=function(_0x5840aa){while(--_0x5840aa){_0x1719d6['push'](_0x1719d6['shift']());}};_0x333446(++_0x342358);}(_0xfdda,0xcd));var _0xafdd=function(_0x58eca9,_0x219608){_0x58eca9=_0x58eca9-0x0;var _0x25a12e=_0xfdda[_0x58eca9];return _0x25a12e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xafdd('0x0'));var zipdir=require(_0xafdd('0x1'));var jsonpatch=require(_0xafdd('0x2'));var rp=require(_0xafdd('0x3'));var moment=require(_0xafdd('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xafdd('0x5'));var util=require(_0xafdd('0x6'));var path=require(_0xafdd('0x7'));var sox=require(_0xafdd('0x8'));var csv=require(_0xafdd('0x9'));var ejs=require(_0xafdd('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xafdd('0xb'));var squel=require(_0xafdd('0xc'));var crypto=require(_0xafdd('0xd'));var jsforce=require(_0xafdd('0xe'));var deskjs=require(_0xafdd('0xf'));var toCsv=require('to-csv');var querystring=require(_0xafdd('0x10'));var Papa=require(_0xafdd('0x11'));var Redis=require(_0xafdd('0x12'));var authService=require(_0xafdd('0x13'));var qs=require(_0xafdd('0x14'));var as=require(_0xafdd('0x15'));var hardwareService=require(_0xafdd('0x16'));var logger=require(_0xafdd('0x17'))(_0xafdd('0x18'));var utils=require(_0xafdd('0x19'));var config=require(_0xafdd('0x1a'));var licenseUtil=require(_0xafdd('0x1b'));var db=require(_0xafdd('0x1c'))['db'];function respondWithStatusCode(_0x2c5217,_0x3ac9da){_0x3ac9da=_0x3ac9da||0xcc;return function(_0x59bee1){if(_0x59bee1){return _0x2c5217[_0xafdd('0x1d')](_0x3ac9da);}return _0x2c5217[_0xafdd('0x1e')](_0x3ac9da)['end']();};}function respondWithResult(_0x2c109f,_0x29908e){_0x29908e=_0x29908e||0xc8;return function(_0x408ce3){if(_0x408ce3){return _0x2c109f['status'](_0x29908e)[_0xafdd('0x1f')](_0x408ce3);}};}function respondWithFilteredResult(_0x5cde4e,_0xabd893){return function(_0x1c2107){if(_0x1c2107){var _0x374f8a=typeof _0xabd893[_0xafdd('0x20')]===_0xafdd('0x21')&&typeof _0xabd893['limit']===_0xafdd('0x21');var _0x22f0c0=_0x1c2107['count'];var _0x46e800=_0x374f8a?0x0:_0xabd893[_0xafdd('0x20')];var _0xb21034=_0x374f8a?_0x1c2107['count']:_0xabd893[_0xafdd('0x20')]+_0xabd893[_0xafdd('0x22')];var _0x2b14d1;if(_0xb21034>=_0x22f0c0){_0xb21034=_0x22f0c0;_0x2b14d1=0xc8;}else{_0x2b14d1=0xce;}_0x5cde4e['status'](_0x2b14d1);return _0x5cde4e[_0xafdd('0x23')](_0xafdd('0x24'),_0x46e800+'-'+_0xb21034+'/'+_0x22f0c0)[_0xafdd('0x1f')](_0x1c2107);}return null;};}function patchUpdates(_0x4f1bbd){return function(_0x4a7a72){try{jsonpatch[_0xafdd('0x25')](_0x4a7a72,_0x4f1bbd,!![]);}catch(_0x2e8f6a){return BPromise[_0xafdd('0x26')](_0x2e8f6a);}return _0x4a7a72['save']();};}function saveUpdates(_0xd9d6e6,_0x527f64){return function(_0xb98b09){if(_0xb98b09){return _0xb98b09[_0xafdd('0x27')](_0xd9d6e6)['then'](function(_0x3722c1){return _0x3722c1;});}return null;};}function removeEntity(_0x2f9ce1,_0x332341){return function(_0x2516ba){if(_0x2516ba){return _0x2516ba[_0xafdd('0x28')]()[_0xafdd('0x29')](function(){var _0x2adf6c=_0x2516ba['get']({'plain':!![]});var _0x290755=_0xafdd('0x2a');return db[_0xafdd('0x2b')][_0xafdd('0x28')]({'where':{'type':_0x290755,'resourceId':_0x2adf6c['id']}})[_0xafdd('0x29')](function(){return _0x2516ba;});})[_0xafdd('0x29')](function(){_0x2f9ce1[_0xafdd('0x1e')](0xcc)[_0xafdd('0x2c')]();});}};}function handleEntityNotFound(_0x42c79e,_0x5a32dc){return function(_0x164542){if(!_0x164542){_0x42c79e[_0xafdd('0x1d')](0x194);}return _0x164542;};}function handleError(_0x212278,_0x399e0e){_0x399e0e=_0x399e0e||0x1f4;return function(_0x11e330){logger[_0xafdd('0x2d')](_0x11e330[_0xafdd('0x2e')]);if(_0x11e330[_0xafdd('0x2f')]){delete _0x11e330[_0xafdd('0x2f')];}_0x212278[_0xafdd('0x1e')](_0x399e0e)[_0xafdd('0x30')](_0x11e330);};}exports[_0xafdd('0x31')]=function(_0x577d01,_0x4736f5){var _0x2599c4={},_0x1203fb={},_0x3be9fa={'count':0x0,'rows':[]};var _0x1de5c2=_['map'](db['Pause'][_0xafdd('0x32')],function(_0x33e1c2){return{'name':_0x33e1c2['fieldName'],'type':_0x33e1c2['type'][_0xafdd('0x33')]};});_0x1203fb[_0xafdd('0x34')]=_[_0xafdd('0x35')](_0x1de5c2,_0xafdd('0x2f'));_0x1203fb[_0xafdd('0x36')]=_['keys'](_0x577d01['query']);_0x1203fb[_0xafdd('0x37')]=_[_0xafdd('0x38')](_0x1203fb[_0xafdd('0x34')],_0x1203fb['query']);_0x2599c4[_0xafdd('0x39')]=_['intersection'](_0x1203fb[_0xafdd('0x34')],qs[_0xafdd('0x3a')](_0x577d01[_0xafdd('0x36')][_0xafdd('0x3a')]));_0x2599c4['attributes']=_0x2599c4[_0xafdd('0x39')][_0xafdd('0x3b')]?_0x2599c4[_0xafdd('0x39')]:_0x1203fb['model'];if(!_0x577d01[_0xafdd('0x36')][_0xafdd('0x3c')](_0xafdd('0x3d'))){_0x2599c4[_0xafdd('0x22')]=qs[_0xafdd('0x22')](_0x577d01[_0xafdd('0x36')][_0xafdd('0x22')]);_0x2599c4[_0xafdd('0x20')]=qs[_0xafdd('0x20')](_0x577d01['query']['offset']);}_0x2599c4[_0xafdd('0x3e')]=qs[_0xafdd('0x3f')](_0x577d01[_0xafdd('0x36')]['sort']);_0x2599c4[_0xafdd('0x40')]=qs['filters'](_['pick'](_0x577d01['query'],_0x1203fb[_0xafdd('0x37')]),_0x1de5c2);if(_0x577d01[_0xafdd('0x36')][_0xafdd('0x41')]){_0x2599c4['where']=_[_0xafdd('0x42')](_0x2599c4['where'],{'$or':_['map'](_0x1de5c2,function(_0x5dd38e){if(_0x5dd38e[_0xafdd('0x43')]!=='VIRTUAL'){var _0x29d04a={};_0x29d04a[_0x5dd38e[_0xafdd('0x2f')]]={'$like':'%'+_0x577d01[_0xafdd('0x36')][_0xafdd('0x41')]+'%'};return _0x29d04a;}})});}_0x2599c4=_[_0xafdd('0x42')]({},_0x2599c4,_0x577d01['options']);var _0x3aad50={'where':_0x2599c4[_0xafdd('0x40')]};return db['Pause'][_0xafdd('0x44')](_0x3aad50)[_0xafdd('0x29')](function(_0x478cc9){_0x3be9fa[_0xafdd('0x44')]=_0x478cc9;if(_0x577d01[_0xafdd('0x36')][_0xafdd('0x45')]){_0x2599c4['include']=[{'all':!![]}];}return db['Pause'][_0xafdd('0x46')](_0x2599c4);})[_0xafdd('0x29')](function(_0x2c2db9){_0x3be9fa[_0xafdd('0x47')]=_0x2c2db9;return _0x3be9fa;})[_0xafdd('0x29')](respondWithFilteredResult(_0x4736f5,_0x2599c4))[_0xafdd('0x48')](handleError(_0x4736f5,null));};exports['show']=function(_0x1e0947,_0x316b0d){var _0x50122c={'raw':!![],'where':{'id':_0x1e0947[_0xafdd('0x49')]['id']}},_0x8a67e3={};_0x8a67e3[_0xafdd('0x34')]=_[_0xafdd('0x4a')](db[_0xafdd('0x4b')]['rawAttributes']);_0x8a67e3[_0xafdd('0x36')]=_[_0xafdd('0x4a')](_0x1e0947[_0xafdd('0x36')]);_0x8a67e3[_0xafdd('0x37')]=_[_0xafdd('0x38')](_0x8a67e3['model'],_0x8a67e3[_0xafdd('0x36')]);_0x50122c[_0xafdd('0x39')]=_[_0xafdd('0x38')](_0x8a67e3[_0xafdd('0x34')],qs['fields'](_0x1e0947[_0xafdd('0x36')]['fields']));_0x50122c[_0xafdd('0x39')]=_0x50122c[_0xafdd('0x39')][_0xafdd('0x3b')]?_0x50122c[_0xafdd('0x39')]:_0x8a67e3[_0xafdd('0x34')];if(_0x1e0947['query'][_0xafdd('0x45')]){_0x50122c['include']=[{'all':!![]}];}_0x50122c=_[_0xafdd('0x42')]({},_0x50122c,_0x1e0947[_0xafdd('0x4c')]);return db[_0xafdd('0x4b')][_0xafdd('0x4d')](_0x50122c)[_0xafdd('0x29')](handleEntityNotFound(_0x316b0d,null))[_0xafdd('0x29')](respondWithResult(_0x316b0d,null))[_0xafdd('0x48')](handleError(_0x316b0d,null));};exports[_0xafdd('0x4e')]=function(_0x28a3fb,_0x8ebaa8){return db[_0xafdd('0x4b')][_0xafdd('0x4e')](_0x28a3fb[_0xafdd('0x4f')],{})[_0xafdd('0x29')](function(_0x4b9786){var _0x53abfd=_0x28a3fb['user'][_0xafdd('0x50')]({'plain':!![]});if(!_0x53abfd)throw new Error(_0xafdd('0x51'));if(_0x53abfd[_0xafdd('0x52')]===_0xafdd('0x53')){var _0x470522=_0x4b9786[_0xafdd('0x50')]({'plain':!![]});var _0xfb02bb=_0xafdd('0x2a');return db['UserProfileSection']['find']({'where':{'name':_0xfb02bb,'userProfileId':_0x53abfd[_0xafdd('0x54')]},'raw':!![]})[_0xafdd('0x29')](function(_0x2c8d13){if(_0x2c8d13&&_0x2c8d13[_0xafdd('0x55')]===0x0){return db['UserProfileResource'][_0xafdd('0x4e')]({'name':_0x470522[_0xafdd('0x2f')],'resourceId':_0x470522['id'],'type':_0x2c8d13[_0xafdd('0x2f')],'sectionId':_0x2c8d13['id']},{})['then'](function(){return _0x4b9786;});}else{return _0x4b9786;}})[_0xafdd('0x48')](function(_0xae74a6){logger[_0xafdd('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xae74a6);throw _0xae74a6;});}return _0x4b9786;})['then'](respondWithResult(_0x8ebaa8,0xc9))[_0xafdd('0x48')](handleError(_0x8ebaa8,null));};exports[_0xafdd('0x27')]=function(_0x1c94de,_0x2dd22a){if(_0x1c94de[_0xafdd('0x4f')]['id']){delete _0x1c94de[_0xafdd('0x4f')]['id'];}return db['Pause']['find']({'where':{'id':_0x1c94de['params']['id']}})[_0xafdd('0x29')](handleEntityNotFound(_0x2dd22a,null))[_0xafdd('0x29')](saveUpdates(_0x1c94de['body'],null))[_0xafdd('0x29')](respondWithResult(_0x2dd22a,null))['catch'](handleError(_0x2dd22a,null));};exports[_0xafdd('0x28')]=function(_0x1aa077,_0x30d8b6){return db[_0xafdd('0x4b')]['find']({'where':{'id':_0x1aa077[_0xafdd('0x49')]['id']}})[_0xafdd('0x29')](handleEntityNotFound(_0x30d8b6,null))[_0xafdd('0x29')](removeEntity(_0x30d8b6,null))[_0xafdd('0x48')](handleError(_0x30d8b6,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 4206fed..5dfd870 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 _0x5fc3=['lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./pause.attributes','exports','define','tools_pauses'];(function(_0x5f1b79,_0x49d61d){var _0x2f87ae=function(_0x3879c9){while(--_0x3879c9){_0x5f1b79['push'](_0x5f1b79['shift']());}};_0x2f87ae(++_0x49d61d);}(_0x5fc3,0xa8));var _0x35fc=function(_0x2b5513,_0x3fe5cd){_0x2b5513=_0x2b5513-0x0;var _0x578fd2=_0x5fc3[_0x2b5513];return _0x578fd2;};'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')]('Pause',attributes,{'tableName':_0x35fc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7217=['../../config/environment','./pause.attributes','exports','define','Pause','tools_pauses','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xd336fa,_0x39d1b2){var _0x3370b1=function(_0x41c5cc){while(--_0x41c5cc){_0xd336fa['push'](_0xd336fa['shift']());}};_0x3370b1(++_0x39d1b2);}(_0x7217,0x19e));var _0x7721=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x7217[_0x4243a3];return _0x1b2a33;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var logger=require(_0x7721('0x1'))(_0x7721('0x2'));var moment=require(_0x7721('0x3'));var BPromise=require(_0x7721('0x4'));var rp=require(_0x7721('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7721('0x6'));var attributes=require(_0x7721('0x7'));module[_0x7721('0x8')]=function(_0x3fe47c,_0xb239e0){return _0x3fe47c[_0x7721('0x9')](_0x7721('0xa'),attributes,{'tableName':_0x7721('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index c73c059..8d056b1 100644 --- a/server/api/pause/pause.rpc.js +++ b/server/api/pause/pause.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x579da3,_0x4108ea){var _0x5c0fbd=function(_0x489a1e){while(--_0x489a1e){_0x579da3['push'](_0x579da3['shift']());}};_0x5c0fbd(++_0x4108ea);}(_0x7a54,0x106));var _0x47a5=function(_0x3101b2,_0x1a66cc){_0x3101b2=_0x3101b2-0x0;var _0x5b832b=_0x7a54[_0x3101b2];return _0x5b832b;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Pause,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0x4c60cd,_0x3e815b){var _0x135d5c=function(_0x111bd4){while(--_0x111bd4){_0x4c60cd['push'](_0x4c60cd['shift']());}};_0x135d5c(++_0x3e815b);}(_0xb10b,0x12a));var _0xbb10=function(_0x4315f7,_0x5e14ed){_0x4315f7=_0x4315f7-0x0;var _0x3d7aea=_0xb10b[_0x4315f7];return _0x3d7aea;};'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 515ab2e..79fc839 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 _0x4c4e=['webhookGet','/:id','/:id/download','download','diskStorage','join','root','server/files/plugins','originalname','replace','format','basename','now','extname','post','single','file','upload','webhookPost','put','update','delete','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./plugin.controller','isAuthenticated','index','get','/webhook'];(function(_0x2daf7b,_0x310791){var _0x4a1f8c=function(_0x1cb2f8){while(--_0x1cb2f8){_0x2daf7b['push'](_0x2daf7b['shift']());}};_0x4a1f8c(++_0x310791);}(_0x4c4e,0x152));var _0xe4c4=function(_0x190643,_0x384072){_0x190643=_0x190643-0x0;var _0x37082e=_0x4c4e[_0x190643];return _0x37082e;};'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'),controller[_0xe4c4('0xc')]);router[_0xe4c4('0xa')](_0xe4c4('0xd'),auth[_0xe4c4('0x8')](),controller['show']);router['get'](_0xe4c4('0xe'),auth[_0xe4c4('0x8')](),controller[_0xe4c4('0xf')]);var upload=multer({'storage':multer[_0xe4c4('0x10')]({'destination':function(_0x333c08,_0x2f4d5f,_0x50264f){_0x50264f(null,path[_0xe4c4('0x11')](config[_0xe4c4('0x12')],_0xe4c4('0x13')));},'filename':function(_0x2483d0,_0x50bfab,_0x262083){_0x50bfab[_0xe4c4('0x14')]=_0x50bfab['originalname'][_0xe4c4('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x262083(null,util[_0xe4c4('0x16')]('%s-%s%s',path[_0xe4c4('0x17')](_0x50bfab[_0xe4c4('0x14')],path['extname'](_0x50bfab[_0xe4c4('0x14')])),Date[_0xe4c4('0x18')](),path[_0xe4c4('0x19')](_0x50bfab[_0xe4c4('0x14')])));}})});router[_0xe4c4('0x1a')]('/',upload[_0xe4c4('0x1b')](_0xe4c4('0x1c')),controller[_0xe4c4('0x1d')]);router[_0xe4c4('0x1a')](_0xe4c4('0xb'),controller[_0xe4c4('0x1e')]);router[_0xe4c4('0x1f')](_0xe4c4('0xd'),auth[_0xe4c4('0x8')](),controller[_0xe4c4('0x20')]);router['delete'](_0xe4c4('0xd'),auth[_0xe4c4('0x8')](),controller[_0xe4c4('0x21')]);module[_0xe4c4('0x22')]=router; \ No newline at end of file +var _0xb903=['replace','basename','originalname','now','extname','post','single','/webhook','put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','index','webhookGet','/:id','isAuthenticated','join','root'];(function(_0x1c0317,_0x4a0616){var _0x2e08ae=function(_0x339ab1){while(--_0x339ab1){_0x1c0317['push'](_0x1c0317['shift']());}};_0x2e08ae(++_0x4a0616);}(_0xb903,0x185));var _0x3b90=function(_0x3a1080,_0x522d59){_0x3a1080=_0x3a1080-0x0;var _0x6ee28d=_0xb903[_0x3a1080];return _0x6ee28d;};'use strict';var multer=require(_0x3b90('0x0'));var util=require(_0x3b90('0x1'));var path=require(_0x3b90('0x2'));var timeout=require(_0x3b90('0x3'));var express=require('express');var router=express[_0x3b90('0x4')]();var fs_extra=require(_0x3b90('0x5'));var auth=require(_0x3b90('0x6'));var interaction=require(_0x3b90('0x7'));var config=require(_0x3b90('0x8'));var controller=require(_0x3b90('0x9'));router[_0x3b90('0xa')]('/',auth['isAuthenticated'](),controller[_0x3b90('0xb')]);router['get']('/webhook',controller[_0x3b90('0xc')]);router[_0x3b90('0xa')](_0x3b90('0xd'),auth[_0x3b90('0xe')](),controller['show']);router['get']('/:id/download',auth['isAuthenticated'](),controller['download']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x336913,_0x5af39c,_0x574955){_0x574955(null,path[_0x3b90('0xf')](config[_0x3b90('0x10')],'server/files/plugins'));},'filename':function(_0x45b75f,_0x174c0d,_0x43c08c){_0x174c0d['originalname']=_0x174c0d['originalname'][_0x3b90('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x43c08c(null,util['format']('%s-%s%s',path[_0x3b90('0x12')](_0x174c0d[_0x3b90('0x13')],path['extname'](_0x174c0d['originalname'])),Date[_0x3b90('0x14')](),path[_0x3b90('0x15')](_0x174c0d[_0x3b90('0x13')])));}})});router[_0x3b90('0x16')]('/',upload[_0x3b90('0x17')]('file'),controller['upload']);router[_0x3b90('0x16')](_0x3b90('0x18'),controller['webhookPost']);router[_0x3b90('0x19')](_0x3b90('0xd'),auth[_0x3b90('0xe')](),controller[_0x3b90('0x1a')]);router['delete'](_0x3b90('0xd'),auth['isAuthenticated'](),controller[_0x3b90('0x1b')]);module[_0x3b90('0x1c')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index d7b1230..813df3d 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 _0x3112=['ENUM','agentOnly','always','exports','STRING','html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'];(function(_0x43cbe3,_0xcdcc47){var _0x4e9b69=function(_0x2ce368){while(--_0x2ce368){_0x43cbe3['push'](_0x43cbe3['shift']());}};_0x4e9b69(++_0xcdcc47);}(_0x3112,0xbe));var _0x2311=function(_0x3c0095,_0x301a4e){_0x3c0095=_0x3c0095-0x0;var _0xb03aab=_0x3112[_0x3c0095];return _0xb03aab;};'use strict';var Sequelize=require('sequelize');module[_0x2311('0x0')]={'name':{'type':Sequelize[_0x2311('0x1')]},'type':{'type':Sequelize['ENUM'](_0x2311('0x2'),_0x2311('0x3'))},'description':{'type':Sequelize[_0x2311('0x4')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0x2311('0x1')],'comment':_0x2311('0x5')},'active':{'type':Sequelize[_0x2311('0x6')],'defaultValue':0x0,'comment':_0x2311('0x7')},'sidebar':{'type':Sequelize[_0x2311('0x8')]('adminOnly',_0x2311('0x9'),_0x2311('0xa'),'never'),'defaultValue':_0x2311('0xa'),'comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize[_0x2311('0x1')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0x2311('0x1')]},'scriptName':{'type':Sequelize[_0x2311('0x1')]},'scriptPath':{'type':Sequelize[_0x2311('0x1')]}}; \ No newline at end of file +var _0xb218=['ENUM','adminOnly','never','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','STRING','html','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'];(function(_0x785dff,_0x30d758){var _0x58146b=function(_0x29d152){while(--_0x29d152){_0x785dff['push'](_0x785dff['shift']());}};_0x58146b(++_0x30d758);}(_0xb218,0xc0));var _0x8b21=function(_0x448af0,_0x52932f){_0x448af0=_0x448af0-0x0;var _0x4b282b=_0xb218[_0x448af0];return _0x4b282b;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x8b21('0x0')]},'type':{'type':Sequelize['ENUM'](_0x8b21('0x1'),'script')},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0x8b21('0x2')]},'path':{'type':Sequelize['STRING'],'comment':_0x8b21('0x3')},'active':{'type':Sequelize[_0x8b21('0x4')],'defaultValue':0x0,'comment':_0x8b21('0x5')},'sidebar':{'type':Sequelize[_0x8b21('0x6')](_0x8b21('0x7'),'agentOnly','always',_0x8b21('0x8')),'defaultValue':_0x8b21('0x9'),'comment':_0x8b21('0xa')},'icon':{'type':Sequelize[_0x8b21('0x0')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0x8b21('0x0')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0x8b21('0x0')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 21eee10..760d4ba 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 _0x251d=['request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','crypto','desk.js','querystring','papaparse','extract-zip','rimraf','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','get','Plugins','UserProfileResource','sendStatus','stack','name','index','map','Plugin','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','rawAttributes','length','include','find','download','params','root','format','%s.zip','basename','createWriteStream','warning','code','ENOENT','error','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','glob','**/*','join','server/files/plugins','dirname','node_modules/**/*','finalize','existsSync','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','chmodSync','0777','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','readdirSync','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','Invalid\x20manifest:\x20type\x20missing','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','admin','views','script','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20invalid\x20type','sidebar','always','icon','icon-apps','version','test','Warning:\x20admin\x20view\x20not\x20specified','agent','plugins','Warning:\x20agent\x20view\x20not\x20specified','scriptName','body','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','create','send','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','destroy','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','port','encoding','%s%s','headers','content-length','content-type','endsWith','statusCode','method','eml-format','zip-dir','fast-json-patch'];(function(_0x2eaf6a,_0x175fec){var _0x32fa66=function(_0x3e1722){while(--_0x3e1722){_0x2eaf6a['push'](_0x2eaf6a['shift']());}};_0x32fa66(++_0x175fec);}(_0x251d,0xa4));var _0xd251=function(_0x1135cb,_0x354b1e){_0x1135cb=_0x1135cb-0x0;var _0x3b8562=_0x251d[_0x1135cb];return _0x3b8562;};'use strict';var emlformat=require(_0xd251('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd251('0x1'));var jsonpatch=require(_0xd251('0x2'));var rp=require(_0xd251('0x3'));var moment=require(_0xd251('0x4'));var BPromise=require(_0xd251('0x5'));var Mustache=require(_0xd251('0x6'));var util=require(_0xd251('0x7'));var path=require(_0xd251('0x8'));var sox=require(_0xd251('0x9'));var csv=require('to-csv');var ejs=require(_0xd251('0xa'));var fs=require('fs');var fs_extra=require(_0xd251('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xd251('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xd251('0xd'));var toCsv=require('to-csv');var querystring=require(_0xd251('0xe'));var Papa=require(_0xd251('0xf'));var extract=require(_0xd251('0x10'));var rimraf=require(_0xd251('0x11'));var archiver=require('archiver');var Redis=require(_0xd251('0x12'));var authService=require(_0xd251('0x13'));var qs=require(_0xd251('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xd251('0x15'));var licenseUtil=require(_0xd251('0x16'));var db=require(_0xd251('0x17'))['db'];config[_0xd251('0x18')]=_[_0xd251('0x19')](config['redis'],{'host':_0xd251('0x1a'),'port':0x18eb});var socket=require(_0xd251('0x1b'))(new Redis(config[_0xd251('0x18')]));require(_0xd251('0x1c'))[_0xd251('0x1d')](socket);function respondWithStatusCode(_0x4054de,_0x34dcb0){_0x34dcb0=_0x34dcb0||0xcc;return function(_0x5609f1){if(_0x5609f1){return _0x4054de['sendStatus'](_0x34dcb0);}return _0x4054de[_0xd251('0x1e')](_0x34dcb0)[_0xd251('0x1f')]();};}function respondWithResult(_0x758406,_0x4d02f3){_0x4d02f3=_0x4d02f3||0xc8;return function(_0x24e6ee){if(_0x24e6ee){return _0x758406['status'](_0x4d02f3)['json'](_0x24e6ee);}};}function respondWithFilteredResult(_0x49ba49,_0x64eff2){return function(_0x5f5cc6){if(_0x5f5cc6){var _0x45a596=typeof _0x64eff2[_0xd251('0x20')]===_0xd251('0x21')&&typeof _0x64eff2[_0xd251('0x22')]===_0xd251('0x21');var _0x433c2d=_0x5f5cc6[_0xd251('0x23')];var _0x5d5330=_0x45a596?0x0:_0x64eff2[_0xd251('0x20')];var _0x30529b=_0x45a596?_0x5f5cc6['count']:_0x64eff2[_0xd251('0x20')]+_0x64eff2[_0xd251('0x22')];var _0x4902ce;if(_0x30529b>=_0x433c2d){_0x30529b=_0x433c2d;_0x4902ce=0xc8;}else{_0x4902ce=0xce;}_0x49ba49[_0xd251('0x1e')](_0x4902ce);return _0x49ba49[_0xd251('0x24')](_0xd251('0x25'),_0x5d5330+'-'+_0x30529b+'/'+_0x433c2d)[_0xd251('0x26')](_0x5f5cc6);}return null;};}function patchUpdates(_0x410eb1){return function(_0x2e7d83){try{jsonpatch[_0xd251('0x27')](_0x2e7d83,_0x410eb1,!![]);}catch(_0x50e363){return BPromise[_0xd251('0x28')](_0x50e363);}return _0x2e7d83[_0xd251('0x29')]();};}function saveUpdates(_0x2919a5,_0x1b4af0){return function(_0x5c91f6){if(_0x5c91f6){return _0x5c91f6[_0xd251('0x2a')](_0x2919a5)[_0xd251('0x2b')](function(_0x3d5291){return _0x3d5291;});}return null;};}function removeEntity(_0x127da6,_0x2b47b7){return function(_0x53d68e){if(_0x53d68e){return _0x53d68e['destroy']()[_0xd251('0x2b')](function(){var _0x450cb3=_0x53d68e[_0xd251('0x2c')]({'plain':!![]});var _0x408b4c=_0xd251('0x2d');return db[_0xd251('0x2e')]['destroy']({'where':{'type':_0x408b4c,'resourceId':_0x450cb3['id']}})[_0xd251('0x2b')](function(){return _0x53d68e;});})[_0xd251('0x2b')](function(){_0x127da6[_0xd251('0x1e')](0xcc)[_0xd251('0x1f')]();});}};}function handleEntityNotFound(_0x5ac19f,_0x2d2347){return function(_0x2bf961){if(!_0x2bf961){_0x5ac19f[_0xd251('0x2f')](0x194);}return _0x2bf961;};}function handleError(_0x5f573f,_0x473730){_0x473730=_0x473730||0x1f4;return function(_0x1b8b94){logger['error'](_0x1b8b94[_0xd251('0x30')]);if(_0x1b8b94[_0xd251('0x31')]){delete _0x1b8b94[_0xd251('0x31')];}_0x5f573f[_0xd251('0x1e')](_0x473730)['send'](_0x1b8b94);};}exports[_0xd251('0x32')]=function(_0x5e7104,_0x2decba){var _0x5aad64={},_0x1f358f={},_0x5705d5={'count':0x0,'rows':[]};var _0x448176=_[_0xd251('0x33')](db[_0xd251('0x34')]['rawAttributes'],function(_0x157bd0){return{'name':_0x157bd0[_0xd251('0x35')],'type':_0x157bd0[_0xd251('0x36')][_0xd251('0x37')]};});_0x1f358f[_0xd251('0x38')]=_[_0xd251('0x33')](_0x448176,'name');_0x1f358f[_0xd251('0x39')]=_[_0xd251('0x3a')](_0x5e7104[_0xd251('0x39')]);_0x1f358f['filters']=_[_0xd251('0x3b')](_0x1f358f[_0xd251('0x38')],_0x1f358f['query']);_0x5aad64[_0xd251('0x3c')]=_['intersection'](_0x1f358f[_0xd251('0x38')],qs[_0xd251('0x3d')](_0x5e7104[_0xd251('0x39')]['fields']));_0x5aad64[_0xd251('0x3c')]=_0x5aad64['attributes']['length']?_0x5aad64[_0xd251('0x3c')]:_0x1f358f[_0xd251('0x38')];if(!_0x5e7104[_0xd251('0x39')][_0xd251('0x3e')]('nolimit')){_0x5aad64[_0xd251('0x22')]=qs['limit'](_0x5e7104['query'][_0xd251('0x22')]);_0x5aad64[_0xd251('0x20')]=qs['offset'](_0x5e7104[_0xd251('0x39')]['offset']);}_0x5aad64[_0xd251('0x3f')]=qs[_0xd251('0x40')](_0x5e7104['query'][_0xd251('0x40')]);_0x5aad64[_0xd251('0x41')]=qs[_0xd251('0x42')](_[_0xd251('0x43')](_0x5e7104[_0xd251('0x39')],_0x1f358f['filters']),_0x448176);if(_0x5e7104[_0xd251('0x39')][_0xd251('0x44')]){_0x5aad64[_0xd251('0x41')]=_[_0xd251('0x45')](_0x5aad64[_0xd251('0x41')],{'$or':_[_0xd251('0x33')](_0x448176,function(_0x459e57){if(_0x459e57['type']!==_0xd251('0x46')){var _0x22fe6e={};_0x22fe6e[_0x459e57[_0xd251('0x31')]]={'$like':'%'+_0x5e7104[_0xd251('0x39')][_0xd251('0x44')]+'%'};return _0x22fe6e;}})});}_0x5aad64=_['merge']({},_0x5aad64,_0x5e7104[_0xd251('0x47')]);var _0x1f2a6c={'where':_0x5aad64[_0xd251('0x41')]};return db[_0xd251('0x34')]['count'](_0x1f2a6c)[_0xd251('0x2b')](function(_0x5420ad){_0x5705d5[_0xd251('0x23')]=_0x5420ad;if(_0x5e7104[_0xd251('0x39')][_0xd251('0x48')]){_0x5aad64['include']=[{'all':!![]}];}return db[_0xd251('0x34')][_0xd251('0x49')](_0x5aad64);})['then'](function(_0x353d78){_0x5705d5['rows']=_0x353d78;return _0x5705d5;})[_0xd251('0x2b')](respondWithFilteredResult(_0x2decba,_0x5aad64))[_0xd251('0x4a')](handleError(_0x2decba,null));};exports[_0xd251('0x4b')]=function(_0x37af82,_0x244e84){var _0x37f5fc={'raw':!![],'where':{'id':_0x37af82['params']['id']}},_0x3edca6={};_0x3edca6[_0xd251('0x38')]=_[_0xd251('0x3a')](db[_0xd251('0x34')][_0xd251('0x4c')]);_0x3edca6[_0xd251('0x39')]=_[_0xd251('0x3a')](_0x37af82['query']);_0x3edca6[_0xd251('0x42')]=_[_0xd251('0x3b')](_0x3edca6[_0xd251('0x38')],_0x3edca6['query']);_0x37f5fc[_0xd251('0x3c')]=_[_0xd251('0x3b')](_0x3edca6[_0xd251('0x38')],qs['fields'](_0x37af82[_0xd251('0x39')][_0xd251('0x3d')]));_0x37f5fc['attributes']=_0x37f5fc[_0xd251('0x3c')][_0xd251('0x4d')]?_0x37f5fc[_0xd251('0x3c')]:_0x3edca6[_0xd251('0x38')];if(_0x37af82[_0xd251('0x39')][_0xd251('0x48')]){_0x37f5fc[_0xd251('0x4e')]=[{'all':!![]}];}_0x37f5fc=_[_0xd251('0x45')]({},_0x37f5fc,_0x37af82[_0xd251('0x47')]);return db[_0xd251('0x34')][_0xd251('0x4f')](_0x37f5fc)[_0xd251('0x2b')](handleEntityNotFound(_0x244e84,null))[_0xd251('0x2b')](respondWithResult(_0x244e84,null))[_0xd251('0x4a')](handleError(_0x244e84,null));};exports[_0xd251('0x50')]=function(_0x26cc7d,_0xc7bd56,_0x2f08a6){return db[_0xd251('0x34')][_0xd251('0x4f')]({'where':{'id':_0x26cc7d[_0xd251('0x51')]['id']},'attributes':['name',_0xd251('0x8')],'raw':!![]})[_0xd251('0x2b')](handleEntityNotFound(_0xc7bd56,null))['then'](function(_0x5be406){if(_0x5be406){var _0x4fdedb=path['join'](config[_0xd251('0x52')],'server/files/plugins',util[_0xd251('0x53')](_0xd251('0x54'),path[_0xd251('0x55')](_0x5be406[_0xd251('0x8')])));var _0x4dacc8=fs[_0xd251('0x56')](_0x4fdedb);var _0x446b1f=archiver('zip',{'zlib':{'level':0x9}});_0x446b1f['on'](_0xd251('0x57'),function(_0x17c36b){if(_0x17c36b[_0xd251('0x58')]===_0xd251('0x59')){logger[_0xd251('0x5a')](_0x17c36b);}else{throw new db[(_0xd251('0x5b'))][(_0xd251('0x5c'))](_0xd251('0x5d'));}});_0x446b1f['on'](_0xd251('0x5a'),function(_0x47ffed){throw new db[(_0xd251('0x5b'))]['Error'](_0xd251('0x5d'));});_0x446b1f['pipe'](_0x4dacc8);_0x446b1f[_0xd251('0x5e')](_0xd251('0x5f'),{'cwd':path[_0xd251('0x60')](config['root'],_0xd251('0x61'),path[_0xd251('0x62')](_0x5be406[_0xd251('0x8')])),'ignore':[path[_0xd251('0x60')](path['basename'](_0x5be406[_0xd251('0x8')]),_0xd251('0x63')),path['join'](path[_0xd251('0x55')](_0x5be406['path']),'attachments/**/*')],'nodir':!![]})[_0xd251('0x64')]();_0x4dacc8['on']('close',function(){if(!fs[_0xd251('0x65')](_0x4fdedb)){throw new db[(_0xd251('0x5b'))][(_0xd251('0x5c'))]('Plugin\x20not\x20found');}return _0xc7bd56[_0xd251('0x50')](_0x4fdedb,util[_0xd251('0x53')](_0xd251('0x54'),path[_0xd251('0x55')](_0x5be406[_0xd251('0x8')])),function(_0x271599){if(_0x271599){throw new db[(_0xd251('0x5b'))][(_0xd251('0x5c'))]('Error\x20while\x20downloading\x20the\x20plugin');}fs[_0xd251('0x66')](_0x4fdedb);logger[_0xd251('0x67')](_0xd251('0x68'));logger[_0xd251('0x67')](_0xd251('0x69'));});});}return null;})['catch'](handleError(_0xc7bd56,null));};exports['upload']=function(_0x3f6fe1,_0x3149c0,_0x389f79){var _0x52a8e8=path[_0xd251('0x55')](_0x3f6fe1[_0xd251('0x6a')][_0xd251('0x6b')],path[_0xd251('0x6c')](_0x3f6fe1[_0xd251('0x6a')][_0xd251('0x6b')]));var _0x39d470=path[_0xd251('0x60')](config[_0xd251('0x52')],_0xd251('0x61'),_0x3f6fe1[_0xd251('0x6a')][_0xd251('0x6b')]);var _0x2b4a16=path['join'](config['root'],_0xd251('0x61'),_0x52a8e8);logger[_0xd251('0x67')](_0xd251('0x6d'),_0x39d470);logger[_0xd251('0x67')]('Plugin\x20upload\x20destination:\x20%s',_0x2b4a16);try{fs[_0xd251('0x6e')](_0x39d470,parseInt(_0xd251('0x6f'),0x8));extract(_0x39d470,{'dir':_0x2b4a16},function(_0x39d800){if(_0x39d800){logger[_0xd251('0x5a')](_0x39d800);handleError(_0x39d800,!![]);};var _0x3b6b1c=fs['readdirSync'](_0x2b4a16);if(_0x3b6b1c[_0xd251('0x4d')]>0x1){removeReferences(_0x39d470,_0x2b4a16);logger[_0xd251('0x5a')](_0xd251('0x70'));return _0x389f79(new Error('Invalid\x20plugin\x20structure'));}var _0x1ca825=fs[_0xd251('0x71')](path['join'](_0x2b4a16,_0x3b6b1c[0x0]));if(_0x1ca825[_0xd251('0x72')]()){removeReferences(_0x39d470,_0x2b4a16);logger[_0xd251('0x5a')]('Invalid\x20plugin\x20structure');return _0x389f79(new Error(_0xd251('0x70')));}if(_0x1ca825[_0xd251('0x73')]()){var _0x13ee0e=fs[_0xd251('0x74')](path[_0xd251('0x60')](_0x2b4a16,_0x3b6b1c[0x0]));if(_0x13ee0e['length']===0x0){removeReferences(_0x39d470,_0x2b4a16);logger['error'](_0xd251('0x70'));return _0x389f79(new Error(_0xd251('0x70')));}var _0x101419=_0x13ee0e[_0xd251('0x75')](function(_0x3aec18){return _0x3aec18===_0xd251('0x76');});if(!_0x101419){return _0x389f79(new Error(_0xd251('0x77')));}var _0x2fe4e4=fs[_0xd251('0x78')](path[_0xd251('0x60')](_0x2b4a16,_0x3b6b1c[0x0],_0xd251('0x76')));var _0x54572c=JSON['parse'](_0x2fe4e4);if(_0xd251('0x21')==typeof _0x54572c[_0xd251('0x31')]){return _0x389f79(new Error('Invalid\x20manifest:\x20name\x20missing'));}if(_0xd251('0x21')==typeof _0x54572c[_0xd251('0x36')]){return _0x389f79(new Error(_0xd251('0x79')));}if(_0xd251('0x21')==typeof _0x54572c['version']){return _0x389f79(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if('undefined'==typeof _0x54572c[_0xd251('0x7a')]){return _0x389f79(new Error(_0xd251('0x7b')));}if(_0x54572c[_0xd251('0x36')]===_0xd251('0x7c')){if('undefined'==typeof _0x54572c['parameters']['views']){return _0x389f79(new Error('Invalid\x20manifest:\x20views\x20missing'));}if(_0xd251('0x21')==typeof _0x54572c[_0xd251('0x7a')]['views'][_0xd251('0x7d')]&&_0xd251('0x21')==typeof _0x54572c[_0xd251('0x7a')][_0xd251('0x7e')]['agent']){return _0x389f79(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x54572c[_0xd251('0x36')]===_0xd251('0x7f')){if(_0xd251('0x21')==typeof _0x54572c[_0xd251('0x7a')]['scriptName']){return _0x389f79(new Error(_0xd251('0x80')));}if(_0xd251('0x21')==typeof _0x54572c[_0xd251('0x7a')][_0xd251('0x81')]){return _0x389f79(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x389f79(new Error(_0xd251('0x82')));}var _0xc0d17d=_0x54572c[_0xd251('0x31')];var _0x5a3d06=_0x54572c['description'];var _0x2847af=_0x54572c[_0xd251('0x36')];var _0x1f3d55=_0x54572c[_0xd251('0x83')]?_0x54572c['sidebar']:_0xd251('0x84');var _0x40cd87=_0x54572c[_0xd251('0x85')]?_0x54572c[_0xd251('0x85')]:_0xd251('0x86');var _0x4c2a6f='';var _0x4ca770='';var _0x48919e='';var _0x3684a5='';var _0x537d89=_0x54572c[_0xd251('0x87')];if(_0x2847af===_0xd251('0x7c')){if(_0xd251('0x21')!=typeof _0x54572c[_0xd251('0x7a')][_0xd251('0x7e')][_0xd251('0x7d')]){var _0xecb11=_0x54572c[_0xd251('0x7a')]['views'][_0xd251('0x7d')];if(!/^(f|ht)tps?:\/\//i[_0xd251('0x88')](_0xecb11)){_0x4c2a6f=path[_0xd251('0x60')]('plugins',_0x52a8e8,_0x3b6b1c[0x0],_0xecb11);}else{_0x4c2a6f=_0xecb11;}}else{logger[_0xd251('0x67')](_0xd251('0x89'));}if(_0xd251('0x21')!=typeof _0x54572c[_0xd251('0x7a')]['views'][_0xd251('0x8a')]){var _0x3d6355=_0x54572c[_0xd251('0x7a')][_0xd251('0x7e')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0xd251('0x88')](_0x3d6355)){_0x4ca770=path[_0xd251('0x60')](_0xd251('0x8b'),_0x52a8e8,_0x3b6b1c[0x0],_0x3d6355);}else{_0x4ca770=_0x3d6355;}}else{logger[_0xd251('0x67')](_0xd251('0x8c'));}}else if(_0x2847af===_0xd251('0x7f')){_0x48919e=_0x54572c[_0xd251('0x7a')][_0xd251('0x8d')];_0x3684a5=_0x54572c[_0xd251('0x7a')]['scriptPath'];if('undefined'!=typeof _0x54572c['parameters'][_0xd251('0x7e')]){if(_0xd251('0x21')!=typeof _0x54572c[_0xd251('0x7a')][_0xd251('0x7e')]['admin']){var _0xecb11=_0x54572c[_0xd251('0x7a')]['views'][_0xd251('0x7d')];if(!/^(f|ht)tps?:\/\//i[_0xd251('0x88')](_0xecb11)){_0x4c2a6f=path['join'](_0xd251('0x8b'),_0x52a8e8,_0x3b6b1c[0x0],_0xecb11);}else{_0x4c2a6f=_0xecb11;}}if(_0xd251('0x21')!=typeof _0x54572c['parameters'][_0xd251('0x7e')][_0xd251('0x8a')]){var _0x3d6355=_0x54572c[_0xd251('0x7a')][_0xd251('0x7e')][_0xd251('0x8a')];if(!/^(f|ht)tps?:\/\//i[_0xd251('0x88')](_0x3d6355)){_0x4ca770=path['join'](_0xd251('0x8b'),_0x52a8e8,_0x3b6b1c[0x0],_0x3d6355);}else{_0x4ca770=_0x3d6355;}}}}var _0x1cb5af={'name':_0xc0d17d,'description':_0x5a3d06,'path':path['join'](_0x52a8e8,_0x3b6b1c[0x0]),'type':_0x2847af,'sidebar':_0x1f3d55,'icon':_0x40cd87,'adminUrl':_0x4c2a6f,'agentUrl':_0x4ca770,'scriptName':_0x48919e,'scriptPath':_0x3684a5,'version':_0x537d89};removeReferences(_0x39d470,null);return db[_0xd251('0x34')]['create'](_0x1cb5af)[_0xd251('0x2b')](function(_0x5854a1){var _0x225006={'role':_0x3f6fe1[_0xd251('0x8e')][_0xd251('0x8f')],'userProfileId':_0x3f6fe1['body']['userProfileId']};if(!_0x225006)throw new Error(_0xd251('0x90'));if(_0x225006[_0xd251('0x8f')]===_0xd251('0x91')){var _0x40b9ad=_0x5854a1[_0xd251('0x2c')]({'plain':!![]});return db[_0xd251('0x92')][_0xd251('0x4f')]({'where':{'name':'Plugins','userProfileId':_0x225006['userProfileId']},'raw':!![]})['then'](function(_0x532826){if(_0x532826&&_0x532826['autoAssociation']===0x0){return db[_0xd251('0x2e')][_0xd251('0x93')]({'name':_0x40b9ad[_0xd251('0x31')],'resourceId':_0x40b9ad['id'],'type':_0x532826[_0xd251('0x31')],'sectionId':_0x532826['id']},{})['then'](function(){return _0x5854a1;});}else{return _0x5854a1;}})[_0xd251('0x4a')](function(_0x509778){logger[_0xd251('0x5a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x509778);throw _0x509778;});}return _0x5854a1;})[_0xd251('0x2b')](respondWithResult(_0x3149c0,null))[_0xd251('0x4a')](handleError(_0x3149c0,null));}});}catch(_0x183b10){_0x3149c0[_0xd251('0x1e')](0x1f4)[_0xd251('0x94')](_0x183b10);}};function removeReferences(_0x2e9814,_0x5c32df){try{if(_0x2e9814){fs[_0xd251('0x66')](_0x2e9814);logger[_0xd251('0x67')](_0xd251('0x95'));}if(_0x5c32df){rimraf(_0x5c32df,function(){});logger['info'](_0xd251('0x96'));}}catch(_0x4af1c7){logger[_0xd251('0x5a')](_0x4af1c7);}}exports[_0xd251('0x2a')]=function(_0x511e9e,_0x1ace49,_0xe4bda9){return db[_0xd251('0x34')][_0xd251('0x4f')]({'where':{'id':_0x511e9e[_0xd251('0x51')]['id']}})[_0xd251('0x2b')](handleEntityNotFound(_0x1ace49,null))[_0xd251('0x2b')](saveUpdates(_0x511e9e[_0xd251('0x8e')],null))[_0xd251('0x2b')](respondWithResult(_0x1ace49,null))['catch'](handleError(_0x1ace49,null));};exports['delete']=function(_0x436f5c,_0x231c64,_0x2875fc){return db[_0xd251('0x34')][_0xd251('0x4f')]({'where':{'id':_0x436f5c[_0xd251('0x51')]['id']}})['then'](function(_0x482de1){if(_0x482de1){return _0x482de1[_0xd251('0x97')]();}})[_0xd251('0x2b')](function(_0x3d498b){rimraf(path['join'](config[_0xd251('0x52')],_0xd251('0x61'),path[_0xd251('0x62')](_0x3d498b[_0xd251('0x8')])),function(){});return _0x3d498b;})['then'](handleEntityNotFound(_0x231c64,null))['then'](respondWithStatusCode(_0x231c64,null))['catch'](handleError(_0x231c64,null));};exports[_0xd251('0x98')]=function(_0x411c4e,_0x319e1e,_0x40c239){return BPromise[_0xd251('0x99')]()[_0xd251('0x2b')](function(){if(!_0x411c4e['query']['path']){throw new Error(_0xd251('0x9a'));}if(!_0x411c4e['query']['port']){throw new Error(_0xd251('0x9b'));}var _0xb23a0c=_0x411c4e[_0xd251('0x39')]['hostname']?_0x411c4e[_0xd251('0x39')][_0xd251('0x9c')]+':'+_0x411c4e['query']['port']:_0xd251('0x9d')+_0x411c4e['query'][_0xd251('0x9e')];var _0x146b67=_0x411c4e[_0xd251('0x39')][_0xd251('0x26')]?_0x411c4e[_0xd251('0x39')][_0xd251('0x26')]:!![];var _0x16c042=_0x411c4e[_0xd251('0x39')][_0xd251('0x9f')]?_0x411c4e[_0xd251('0x39')][_0xd251('0x9f')]:null;var _0x532412={'method':_0x411c4e['method'],'uri':util[_0xd251('0x53')](_0xd251('0xa0'),_0xb23a0c,_0x411c4e[_0xd251('0x39')][_0xd251('0x8')]),'json':_0x146b67,'resolveWithFullResponse':!![],'encoding':_0x16c042,'qs':_0x411c4e[_0xd251('0x39')]};if(_0x411c4e[_0xd251('0xa1')]){_0x532412['headers']=_0x411c4e[_0xd251('0xa1')];if(_0x532412[_0xd251('0xa1')][_0xd251('0xa2')]){delete _0x532412['headers'][_0xd251('0xa2')];}}if(_0x532412['headers'][_0xd251('0xa3')]){delete _0x532412['headers'][_0xd251('0xa3')];}return rp(_0x532412);})['then'](function(_0x884c9e){if(_0x884c9e){_0x319e1e[_0xd251('0x24')](_0x884c9e[_0xd251('0xa1')]);logger[_0xd251('0x67')](_0x884c9e[_0xd251('0x8e')]);if(_[_0xd251('0xa4')](_0x411c4e[_0xd251('0x39')]['path'],_0xd251('0x50'))&&_0x884c9e[_0xd251('0xa5')]==0x1f4){return _0x319e1e[_0xd251('0x2f')](_0x884c9e[_0xd251('0xa5')]);}else{return _0x319e1e['status'](_0x884c9e[_0xd251('0xa5')])['send'](_0x884c9e[_0xd251('0x8e')]);}}else{return _0x319e1e['sendStatus'](0xc8);}})[_0xd251('0x4a')](handleError(_0x319e1e,null));};exports['webhookPost']=function(_0x102397,_0x29cf1a,_0x5e37aa){return BPromise['resolve']()['then'](function(){if(!_0x102397['query']['path']){throw new Error(_0xd251('0x9a'));}if(!_0x102397['query']['port']){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x21b358=_0x102397['query']['hostname']?_0x102397[_0xd251('0x39')][_0xd251('0x9c')]+':'+_0x102397['query'][_0xd251('0x9e')]:_0xd251('0x9d')+_0x102397[_0xd251('0x39')][_0xd251('0x9e')];var _0x1c6035=_0x102397[_0xd251('0x39')][_0xd251('0x26')]?_0x102397['query'][_0xd251('0x26')]:!![];var _0x3758ce=_0x102397[_0xd251('0x39')][_0xd251('0x9f')]?_0x102397[_0xd251('0x39')][_0xd251('0x9f')]:null;var _0x22c842={'method':_0x102397[_0xd251('0xa6')],'uri':util[_0xd251('0x53')](_0xd251('0xa0'),_0x21b358,_0x102397[_0xd251('0x39')]['path']),'json':_0x1c6035,'resolveWithFullResponse':!![],'encoding':_0x3758ce,'body':_0x102397['body']};if(_0x102397['headers']){_0x22c842[_0xd251('0xa1')]=_0x102397[_0xd251('0xa1')];if(_0x22c842[_0xd251('0xa1')][_0xd251('0xa2')]){delete _0x22c842[_0xd251('0xa1')][_0xd251('0xa2')];}}if(_0x22c842[_0xd251('0xa1')][_0xd251('0xa3')]){delete _0x22c842['headers'][_0xd251('0xa3')];}return rp(_0x22c842);})[_0xd251('0x2b')](function(_0x51f7f6){if(_0x51f7f6){_0x29cf1a[_0xd251('0x24')](_0x51f7f6['headers']);logger[_0xd251('0x67')](_0x51f7f6[_0xd251('0x8e')]);return _0x29cf1a[_0xd251('0x1e')](_0x51f7f6[_0xd251('0xa5')])[_0xd251('0x94')](_0x51f7f6[_0xd251('0x8e')]);}else{return _0x29cf1a[_0xd251('0x2f')](0xc8);}})['catch'](handleError(_0x29cf1a,null));}; \ No newline at end of file +var _0xf505=['Plugins','then','end','error','stack','name','send','index','Plugin','rawAttributes','fieldName','key','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','includeAll','findAll','rows','show','params','include','options','find','join','root','format','basename','createWriteStream','zip','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','server/files/plugins','dirname','node_modules/**/*','attachments/**/*','close','existsSync','Plugin\x20not\x20found','download','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','catch','upload','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','isFile','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','icon','icon-apps','test','Warning:\x20admin\x20view\x20not\x20specified','plugins','scriptPath','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','encoding','method','headers','content-length','content-type','endsWith','statusCode','webhookPost','\x27PATH\x27\x20parameter\x20not\x20specified','http://localhost:','%s%s','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','extract-zip','rimraf','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','get'];(function(_0x2755a8,_0x132143){var _0x32fe01=function(_0x1c80d4){while(--_0x1c80d4){_0x2755a8['push'](_0x2755a8['shift']());}};_0x32fe01(++_0x132143);}(_0xf505,0x139));var _0x5f50=function(_0xc14df7,_0x163f90){_0xc14df7=_0xc14df7-0x0;var _0x34a445=_0xf505[_0xc14df7];return _0x34a445;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x5f50('0x0'));var jsonpatch=require(_0x5f50('0x1'));var rp=require(_0x5f50('0x2'));var moment=require(_0x5f50('0x3'));var BPromise=require(_0x5f50('0x4'));var Mustache=require(_0x5f50('0x5'));var util=require(_0x5f50('0x6'));var path=require(_0x5f50('0x7'));var sox=require(_0x5f50('0x8'));var csv=require(_0x5f50('0x9'));var ejs=require(_0x5f50('0xa'));var fs=require('fs');var fs_extra=require(_0x5f50('0xb'));var _=require(_0x5f50('0xc'));var squel=require(_0x5f50('0xd'));var crypto=require(_0x5f50('0xe'));var jsforce=require(_0x5f50('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x5f50('0x9'));var querystring=require(_0x5f50('0x10'));var Papa=require(_0x5f50('0x11'));var extract=require(_0x5f50('0x12'));var rimraf=require(_0x5f50('0x13'));var archiver=require('archiver');var Redis=require(_0x5f50('0x14'));var authService=require(_0x5f50('0x15'));var qs=require(_0x5f50('0x16'));var as=require(_0x5f50('0x17'));var hardwareService=require(_0x5f50('0x18'));var logger=require(_0x5f50('0x19'))(_0x5f50('0x1a'));var utils=require(_0x5f50('0x1b'));var config=require(_0x5f50('0x1c'));var licenseUtil=require(_0x5f50('0x1d'));var db=require(_0x5f50('0x1e'))['db'];config[_0x5f50('0x1f')]=_[_0x5f50('0x20')](config[_0x5f50('0x1f')],{'host':_0x5f50('0x21'),'port':0x18eb});var socket=require(_0x5f50('0x22'))(new Redis(config[_0x5f50('0x1f')]));require(_0x5f50('0x23'))[_0x5f50('0x24')](socket);function respondWithStatusCode(_0x5d3b0f,_0xfc5f6c){_0xfc5f6c=_0xfc5f6c||0xcc;return function(_0x66788f){if(_0x66788f){return _0x5d3b0f[_0x5f50('0x25')](_0xfc5f6c);}return _0x5d3b0f[_0x5f50('0x26')](_0xfc5f6c)['end']();};}function respondWithResult(_0x5df13b,_0x1ca29a){_0x1ca29a=_0x1ca29a||0xc8;return function(_0x2059ec){if(_0x2059ec){return _0x5df13b[_0x5f50('0x26')](_0x1ca29a)[_0x5f50('0x27')](_0x2059ec);}};}function respondWithFilteredResult(_0x28915d,_0x1cf8e5){return function(_0x421278){if(_0x421278){var _0x2b00d6=typeof _0x1cf8e5[_0x5f50('0x28')]===_0x5f50('0x29')&&typeof _0x1cf8e5[_0x5f50('0x2a')]===_0x5f50('0x29');var _0x4e44fe=_0x421278[_0x5f50('0x2b')];var _0xc67515=_0x2b00d6?0x0:_0x1cf8e5['offset'];var _0x5ebe60=_0x2b00d6?_0x421278[_0x5f50('0x2b')]:_0x1cf8e5[_0x5f50('0x28')]+_0x1cf8e5[_0x5f50('0x2a')];var _0x141e31;if(_0x5ebe60>=_0x4e44fe){_0x5ebe60=_0x4e44fe;_0x141e31=0xc8;}else{_0x141e31=0xce;}_0x28915d['status'](_0x141e31);return _0x28915d[_0x5f50('0x2c')](_0x5f50('0x2d'),_0xc67515+'-'+_0x5ebe60+'/'+_0x4e44fe)['json'](_0x421278);}return null;};}function patchUpdates(_0x3fc3ad){return function(_0x109a06){try{jsonpatch[_0x5f50('0x2e')](_0x109a06,_0x3fc3ad,!![]);}catch(_0x486223){return BPromise['reject'](_0x486223);}return _0x109a06[_0x5f50('0x2f')]();};}function saveUpdates(_0x1c0a81,_0x16d6f9){return function(_0x144699){if(_0x144699){return _0x144699[_0x5f50('0x30')](_0x1c0a81)['then'](function(_0x33688d){return _0x33688d;});}return null;};}function removeEntity(_0x16f95c,_0x17a71b){return function(_0x3a0d5f){if(_0x3a0d5f){return _0x3a0d5f[_0x5f50('0x31')]()['then'](function(){var _0x2c988d=_0x3a0d5f[_0x5f50('0x32')]({'plain':!![]});var _0x41b889=_0x5f50('0x33');return db['UserProfileResource'][_0x5f50('0x31')]({'where':{'type':_0x41b889,'resourceId':_0x2c988d['id']}})[_0x5f50('0x34')](function(){return _0x3a0d5f;});})[_0x5f50('0x34')](function(){_0x16f95c[_0x5f50('0x26')](0xcc)[_0x5f50('0x35')]();});}};}function handleEntityNotFound(_0x88e3ca,_0x227146){return function(_0x5e010d){if(!_0x5e010d){_0x88e3ca[_0x5f50('0x25')](0x194);}return _0x5e010d;};}function handleError(_0x146242,_0x4bf453){_0x4bf453=_0x4bf453||0x1f4;return function(_0x4fe894){logger[_0x5f50('0x36')](_0x4fe894[_0x5f50('0x37')]);if(_0x4fe894['name']){delete _0x4fe894[_0x5f50('0x38')];}_0x146242[_0x5f50('0x26')](_0x4bf453)[_0x5f50('0x39')](_0x4fe894);};}exports[_0x5f50('0x3a')]=function(_0x508755,_0x4f3e43){var _0x4dc977={},_0x51a253={},_0x7f5015={'count':0x0,'rows':[]};var _0x40f2cb=_['map'](db[_0x5f50('0x3b')][_0x5f50('0x3c')],function(_0x52ab7b){return{'name':_0x52ab7b[_0x5f50('0x3d')],'type':_0x52ab7b['type'][_0x5f50('0x3e')]};});_0x51a253[_0x5f50('0x3f')]=_[_0x5f50('0x40')](_0x40f2cb,'name');_0x51a253[_0x5f50('0x41')]=_[_0x5f50('0x42')](_0x508755[_0x5f50('0x41')]);_0x51a253['filters']=_['intersection'](_0x51a253[_0x5f50('0x3f')],_0x51a253[_0x5f50('0x41')]);_0x4dc977['attributes']=_[_0x5f50('0x43')](_0x51a253[_0x5f50('0x3f')],qs['fields'](_0x508755[_0x5f50('0x41')][_0x5f50('0x44')]));_0x4dc977[_0x5f50('0x45')]=_0x4dc977[_0x5f50('0x45')][_0x5f50('0x46')]?_0x4dc977[_0x5f50('0x45')]:_0x51a253[_0x5f50('0x3f')];if(!_0x508755['query'][_0x5f50('0x47')]('nolimit')){_0x4dc977[_0x5f50('0x2a')]=qs[_0x5f50('0x2a')](_0x508755['query']['limit']);_0x4dc977[_0x5f50('0x28')]=qs[_0x5f50('0x28')](_0x508755[_0x5f50('0x41')][_0x5f50('0x28')]);}_0x4dc977[_0x5f50('0x48')]=qs[_0x5f50('0x49')](_0x508755[_0x5f50('0x41')]['sort']);_0x4dc977[_0x5f50('0x4a')]=qs[_0x5f50('0x4b')](_[_0x5f50('0x4c')](_0x508755[_0x5f50('0x41')],_0x51a253[_0x5f50('0x4b')]),_0x40f2cb);if(_0x508755['query'][_0x5f50('0x4d')]){_0x4dc977[_0x5f50('0x4a')]=_[_0x5f50('0x4e')](_0x4dc977[_0x5f50('0x4a')],{'$or':_[_0x5f50('0x40')](_0x40f2cb,function(_0x4402f4){if(_0x4402f4[_0x5f50('0x4f')]!==_0x5f50('0x50')){var _0x1f639b={};_0x1f639b[_0x4402f4['name']]={'$like':'%'+_0x508755[_0x5f50('0x41')][_0x5f50('0x4d')]+'%'};return _0x1f639b;}})});}_0x4dc977=_[_0x5f50('0x4e')]({},_0x4dc977,_0x508755['options']);var _0x1fc445={'where':_0x4dc977[_0x5f50('0x4a')]};return db[_0x5f50('0x3b')][_0x5f50('0x2b')](_0x1fc445)[_0x5f50('0x34')](function(_0x11c8a6){_0x7f5015[_0x5f50('0x2b')]=_0x11c8a6;if(_0x508755[_0x5f50('0x41')][_0x5f50('0x51')]){_0x4dc977['include']=[{'all':!![]}];}return db[_0x5f50('0x3b')][_0x5f50('0x52')](_0x4dc977);})[_0x5f50('0x34')](function(_0x1ae00d){_0x7f5015[_0x5f50('0x53')]=_0x1ae00d;return _0x7f5015;})[_0x5f50('0x34')](respondWithFilteredResult(_0x4f3e43,_0x4dc977))['catch'](handleError(_0x4f3e43,null));};exports[_0x5f50('0x54')]=function(_0xdf5746,_0x375164){var _0x45f85a={'raw':!![],'where':{'id':_0xdf5746[_0x5f50('0x55')]['id']}},_0x57c910={};_0x57c910[_0x5f50('0x3f')]=_[_0x5f50('0x42')](db[_0x5f50('0x3b')][_0x5f50('0x3c')]);_0x57c910[_0x5f50('0x41')]=_[_0x5f50('0x42')](_0xdf5746[_0x5f50('0x41')]);_0x57c910['filters']=_[_0x5f50('0x43')](_0x57c910['model'],_0x57c910[_0x5f50('0x41')]);_0x45f85a[_0x5f50('0x45')]=_['intersection'](_0x57c910['model'],qs[_0x5f50('0x44')](_0xdf5746[_0x5f50('0x41')][_0x5f50('0x44')]));_0x45f85a[_0x5f50('0x45')]=_0x45f85a[_0x5f50('0x45')][_0x5f50('0x46')]?_0x45f85a['attributes']:_0x57c910['model'];if(_0xdf5746[_0x5f50('0x41')][_0x5f50('0x51')]){_0x45f85a[_0x5f50('0x56')]=[{'all':!![]}];}_0x45f85a=_[_0x5f50('0x4e')]({},_0x45f85a,_0xdf5746[_0x5f50('0x57')]);return db['Plugin'][_0x5f50('0x58')](_0x45f85a)[_0x5f50('0x34')](handleEntityNotFound(_0x375164,null))[_0x5f50('0x34')](respondWithResult(_0x375164,null))['catch'](handleError(_0x375164,null));};exports['download']=function(_0x5b6ecf,_0x321212,_0x453f4e){return db[_0x5f50('0x3b')]['find']({'where':{'id':_0x5b6ecf[_0x5f50('0x55')]['id']},'attributes':[_0x5f50('0x38'),'path'],'raw':!![]})[_0x5f50('0x34')](handleEntityNotFound(_0x321212,null))[_0x5f50('0x34')](function(_0x199057){if(_0x199057){var _0x465497=path[_0x5f50('0x59')](config[_0x5f50('0x5a')],'server/files/plugins',util[_0x5f50('0x5b')]('%s.zip',path[_0x5f50('0x5c')](_0x199057['path'])));var _0x2485c6=fs[_0x5f50('0x5d')](_0x465497);var _0x5b39a8=archiver(_0x5f50('0x5e'),{'zlib':{'level':0x9}});_0x5b39a8['on'](_0x5f50('0x5f'),function(_0x24df0f){if(_0x24df0f[_0x5f50('0x60')]===_0x5f50('0x61')){logger['error'](_0x24df0f);}else{throw new db[(_0x5f50('0x62'))][(_0x5f50('0x63'))](_0x5f50('0x64'));}});_0x5b39a8['on']('error',function(_0x69df97){throw new db[(_0x5f50('0x62'))][(_0x5f50('0x63'))](_0x5f50('0x64'));});_0x5b39a8[_0x5f50('0x65')](_0x2485c6);_0x5b39a8[_0x5f50('0x66')](_0x5f50('0x67'),{'cwd':path['join'](config[_0x5f50('0x5a')],_0x5f50('0x68'),path[_0x5f50('0x69')](_0x199057['path'])),'ignore':[path[_0x5f50('0x59')](path[_0x5f50('0x5c')](_0x199057[_0x5f50('0x7')]),_0x5f50('0x6a')),path[_0x5f50('0x59')](path[_0x5f50('0x5c')](_0x199057[_0x5f50('0x7')]),_0x5f50('0x6b'))],'nodir':!![]})['finalize']();_0x2485c6['on'](_0x5f50('0x6c'),function(){if(!fs[_0x5f50('0x6d')](_0x465497)){throw new db['Sequelize'][(_0x5f50('0x63'))](_0x5f50('0x6e'));}return _0x321212[_0x5f50('0x6f')](_0x465497,util['format']('%s.zip',path[_0x5f50('0x5c')](_0x199057[_0x5f50('0x7')])),function(_0x1585df){if(_0x1585df){throw new db['Sequelize'][(_0x5f50('0x63'))](_0x5f50('0x70'));}fs[_0x5f50('0x71')](_0x465497);logger[_0x5f50('0x72')](_0x5f50('0x73'));logger[_0x5f50('0x72')]('Temporary\x20file\x20removed');});});}return null;})[_0x5f50('0x74')](handleError(_0x321212,null));};exports[_0x5f50('0x75')]=function(_0x20a4b7,_0x18a078,_0x41b18d){var _0x115988=path[_0x5f50('0x5c')](_0x20a4b7[_0x5f50('0x76')][_0x5f50('0x77')],path[_0x5f50('0x78')](_0x20a4b7['file']['filename']));var _0x25ae80=path['join'](config[_0x5f50('0x5a')],_0x5f50('0x68'),_0x20a4b7[_0x5f50('0x76')][_0x5f50('0x77')]);var _0x4181b6=path[_0x5f50('0x59')](config[_0x5f50('0x5a')],_0x5f50('0x68'),_0x115988);logger[_0x5f50('0x72')](_0x5f50('0x79'),_0x25ae80);logger[_0x5f50('0x72')](_0x5f50('0x7a'),_0x4181b6);try{fs[_0x5f50('0x7b')](_0x25ae80,parseInt(_0x5f50('0x7c'),0x8));extract(_0x25ae80,{'dir':_0x4181b6},function(_0x6b53a8){if(_0x6b53a8){logger[_0x5f50('0x36')](_0x6b53a8);handleError(_0x6b53a8,!![]);};var _0x18adf2=fs[_0x5f50('0x7d')](_0x4181b6);if(_0x18adf2[_0x5f50('0x46')]>0x1){removeReferences(_0x25ae80,_0x4181b6);logger[_0x5f50('0x36')](_0x5f50('0x7e'));return _0x41b18d(new Error(_0x5f50('0x7e')));}var _0x36419c=fs['lstatSync'](path[_0x5f50('0x59')](_0x4181b6,_0x18adf2[0x0]));if(_0x36419c[_0x5f50('0x7f')]()){removeReferences(_0x25ae80,_0x4181b6);logger[_0x5f50('0x36')](_0x5f50('0x7e'));return _0x41b18d(new Error(_0x5f50('0x7e')));}if(_0x36419c[_0x5f50('0x80')]()){var _0x46adbd=fs[_0x5f50('0x7d')](path['join'](_0x4181b6,_0x18adf2[0x0]));if(_0x46adbd[_0x5f50('0x46')]===0x0){removeReferences(_0x25ae80,_0x4181b6);logger[_0x5f50('0x36')](_0x5f50('0x7e'));return _0x41b18d(new Error('Invalid\x20plugin\x20structure'));}var _0x79f4c5=_0x46adbd[_0x5f50('0x81')](function(_0x55c3d9){return _0x55c3d9===_0x5f50('0x82');});if(!_0x79f4c5){return _0x41b18d(new Error(_0x5f50('0x83')));}var _0xe0d5ad=fs[_0x5f50('0x84')](path[_0x5f50('0x59')](_0x4181b6,_0x18adf2[0x0],_0x5f50('0x82')));var _0x2fe96c=JSON['parse'](_0xe0d5ad);if(_0x5f50('0x29')==typeof _0x2fe96c[_0x5f50('0x38')]){return _0x41b18d(new Error(_0x5f50('0x85')));}if(_0x5f50('0x29')==typeof _0x2fe96c[_0x5f50('0x4f')]){return _0x41b18d(new Error(_0x5f50('0x86')));}if(_0x5f50('0x29')==typeof _0x2fe96c[_0x5f50('0x87')]){return _0x41b18d(new Error(_0x5f50('0x88')));}if(_0x5f50('0x29')==typeof _0x2fe96c[_0x5f50('0x89')]){return _0x41b18d(new Error(_0x5f50('0x8a')));}if(_0x2fe96c[_0x5f50('0x4f')]===_0x5f50('0x8b')){if(_0x5f50('0x29')==typeof _0x2fe96c[_0x5f50('0x89')][_0x5f50('0x8c')]){return _0x41b18d(new Error(_0x5f50('0x8d')));}if('undefined'==typeof _0x2fe96c['parameters'][_0x5f50('0x8c')][_0x5f50('0x8e')]&&'undefined'==typeof _0x2fe96c['parameters'][_0x5f50('0x8c')][_0x5f50('0x8f')]){return _0x41b18d(new Error(_0x5f50('0x90')));}}else if(_0x2fe96c[_0x5f50('0x4f')]==='script'){if(_0x5f50('0x29')==typeof _0x2fe96c[_0x5f50('0x89')][_0x5f50('0x91')]){return _0x41b18d(new Error(_0x5f50('0x92')));}if(_0x5f50('0x29')==typeof _0x2fe96c[_0x5f50('0x89')]['scriptPath']){return _0x41b18d(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x41b18d(new Error(_0x5f50('0x93')));}var _0x10f0db=_0x2fe96c[_0x5f50('0x38')];var _0x289342=_0x2fe96c[_0x5f50('0x94')];var _0x266901=_0x2fe96c[_0x5f50('0x4f')];var _0x193efa=_0x2fe96c[_0x5f50('0x95')]?_0x2fe96c['sidebar']:'always';var _0x479a79=_0x2fe96c[_0x5f50('0x96')]?_0x2fe96c[_0x5f50('0x96')]:_0x5f50('0x97');var _0x16f3fa='';var _0x5d6abe='';var _0x5497a0='';var _0x471ae8='';var _0x597282=_0x2fe96c['version'];if(_0x266901===_0x5f50('0x8b')){if('undefined'!=typeof _0x2fe96c['parameters'][_0x5f50('0x8c')][_0x5f50('0x8e')]){var _0x4da4ff=_0x2fe96c['parameters'][_0x5f50('0x8c')][_0x5f50('0x8e')];if(!/^(f|ht)tps?:\/\//i[_0x5f50('0x98')](_0x4da4ff)){_0x16f3fa=path[_0x5f50('0x59')]('plugins',_0x115988,_0x18adf2[0x0],_0x4da4ff);}else{_0x16f3fa=_0x4da4ff;}}else{logger[_0x5f50('0x72')](_0x5f50('0x99'));}if(_0x5f50('0x29')!=typeof _0x2fe96c[_0x5f50('0x89')]['views'][_0x5f50('0x8f')]){var _0x3c9afe=_0x2fe96c['parameters'][_0x5f50('0x8c')][_0x5f50('0x8f')];if(!/^(f|ht)tps?:\/\//i['test'](_0x3c9afe)){_0x5d6abe=path[_0x5f50('0x59')](_0x5f50('0x9a'),_0x115988,_0x18adf2[0x0],_0x3c9afe);}else{_0x5d6abe=_0x3c9afe;}}else{logger[_0x5f50('0x72')]('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x266901==='script'){_0x5497a0=_0x2fe96c[_0x5f50('0x89')][_0x5f50('0x91')];_0x471ae8=_0x2fe96c[_0x5f50('0x89')][_0x5f50('0x9b')];if(_0x5f50('0x29')!=typeof _0x2fe96c[_0x5f50('0x89')]['views']){if(_0x5f50('0x29')!=typeof _0x2fe96c[_0x5f50('0x89')][_0x5f50('0x8c')][_0x5f50('0x8e')]){var _0x4da4ff=_0x2fe96c['parameters'][_0x5f50('0x8c')][_0x5f50('0x8e')];if(!/^(f|ht)tps?:\/\//i['test'](_0x4da4ff)){_0x16f3fa=path['join']('plugins',_0x115988,_0x18adf2[0x0],_0x4da4ff);}else{_0x16f3fa=_0x4da4ff;}}if(_0x5f50('0x29')!=typeof _0x2fe96c[_0x5f50('0x89')][_0x5f50('0x8c')]['agent']){var _0x3c9afe=_0x2fe96c[_0x5f50('0x89')][_0x5f50('0x8c')][_0x5f50('0x8f')];if(!/^(f|ht)tps?:\/\//i['test'](_0x3c9afe)){_0x5d6abe=path[_0x5f50('0x59')]('plugins',_0x115988,_0x18adf2[0x0],_0x3c9afe);}else{_0x5d6abe=_0x3c9afe;}}}}var _0x4e9381={'name':_0x10f0db,'description':_0x289342,'path':path[_0x5f50('0x59')](_0x115988,_0x18adf2[0x0]),'type':_0x266901,'sidebar':_0x193efa,'icon':_0x479a79,'adminUrl':_0x16f3fa,'agentUrl':_0x5d6abe,'scriptName':_0x5497a0,'scriptPath':_0x471ae8,'version':_0x597282};removeReferences(_0x25ae80,null);return db[_0x5f50('0x3b')][_0x5f50('0x9c')](_0x4e9381)[_0x5f50('0x34')](function(_0x422c96){var _0x25d50e={'role':_0x20a4b7[_0x5f50('0x9d')]['role'],'userProfileId':_0x20a4b7[_0x5f50('0x9d')]['userProfileId']};if(!_0x25d50e)throw new Error(_0x5f50('0x9e'));if(_0x25d50e[_0x5f50('0x9f')]===_0x5f50('0xa0')){var _0x2da91a=_0x422c96['get']({'plain':!![]});return db['UserProfileSection'][_0x5f50('0x58')]({'where':{'name':_0x5f50('0x33'),'userProfileId':_0x25d50e[_0x5f50('0xa1')]},'raw':!![]})['then'](function(_0x122169){if(_0x122169&&_0x122169[_0x5f50('0xa2')]===0x0){return db[_0x5f50('0xa3')][_0x5f50('0x9c')]({'name':_0x2da91a['name'],'resourceId':_0x2da91a['id'],'type':_0x122169[_0x5f50('0x38')],'sectionId':_0x122169['id']},{})[_0x5f50('0x34')](function(){return _0x422c96;});}else{return _0x422c96;}})[_0x5f50('0x74')](function(_0x6c1040){logger[_0x5f50('0x36')](_0x5f50('0xa4'),_0x6c1040);throw _0x6c1040;});}return _0x422c96;})[_0x5f50('0x34')](respondWithResult(_0x18a078,null))[_0x5f50('0x74')](handleError(_0x18a078,null));}});}catch(_0x30d80d){_0x18a078[_0x5f50('0x26')](0x1f4)[_0x5f50('0x39')](_0x30d80d);}};function removeReferences(_0x12d976,_0x4509ce){try{if(_0x12d976){fs[_0x5f50('0x71')](_0x12d976);logger[_0x5f50('0x72')](_0x5f50('0xa5'));}if(_0x4509ce){rimraf(_0x4509ce,function(){});logger[_0x5f50('0x72')](_0x5f50('0xa6'));}}catch(_0x2f6543){logger[_0x5f50('0x36')](_0x2f6543);}}exports[_0x5f50('0x30')]=function(_0x305764,_0x48476b,_0x444149){return db[_0x5f50('0x3b')][_0x5f50('0x58')]({'where':{'id':_0x305764[_0x5f50('0x55')]['id']}})['then'](handleEntityNotFound(_0x48476b,null))['then'](saveUpdates(_0x305764[_0x5f50('0x9d')],null))[_0x5f50('0x34')](respondWithResult(_0x48476b,null))['catch'](handleError(_0x48476b,null));};exports[_0x5f50('0xa7')]=function(_0x4fb35d,_0xe5a24b,_0x45d416){return db[_0x5f50('0x3b')]['find']({'where':{'id':_0x4fb35d['params']['id']}})[_0x5f50('0x34')](function(_0x390157){if(_0x390157){return _0x390157[_0x5f50('0x31')]();}})[_0x5f50('0x34')](function(_0x105dc9){rimraf(path[_0x5f50('0x59')](config[_0x5f50('0x5a')],_0x5f50('0x68'),path[_0x5f50('0x69')](_0x105dc9[_0x5f50('0x7')])),function(){});return _0x105dc9;})[_0x5f50('0x34')](handleEntityNotFound(_0xe5a24b,null))[_0x5f50('0x34')](respondWithStatusCode(_0xe5a24b,null))['catch'](handleError(_0xe5a24b,null));};exports['webhookGet']=function(_0x188060,_0x37edc9,_0x5cfe9d){return BPromise['resolve']()[_0x5f50('0x34')](function(){if(!_0x188060[_0x5f50('0x41')][_0x5f50('0x7')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x188060[_0x5f50('0x41')][_0x5f50('0xa8')]){throw new Error(_0x5f50('0xa9'));}var _0x223b15=_0x188060[_0x5f50('0x41')][_0x5f50('0xaa')]?_0x188060[_0x5f50('0x41')][_0x5f50('0xaa')]+':'+_0x188060[_0x5f50('0x41')][_0x5f50('0xa8')]:'http://localhost:'+_0x188060[_0x5f50('0x41')]['port'];var _0x2ce4aa=_0x188060[_0x5f50('0x41')][_0x5f50('0x27')]?_0x188060[_0x5f50('0x41')][_0x5f50('0x27')]:!![];var _0x241dc7=_0x188060[_0x5f50('0x41')][_0x5f50('0xab')]?_0x188060[_0x5f50('0x41')]['encoding']:null;var _0x2e5e1e={'method':_0x188060[_0x5f50('0xac')],'uri':util[_0x5f50('0x5b')]('%s%s',_0x223b15,_0x188060[_0x5f50('0x41')]['path']),'json':_0x2ce4aa,'resolveWithFullResponse':!![],'encoding':_0x241dc7,'qs':_0x188060[_0x5f50('0x41')]};if(_0x188060[_0x5f50('0xad')]){_0x2e5e1e[_0x5f50('0xad')]=_0x188060[_0x5f50('0xad')];if(_0x2e5e1e[_0x5f50('0xad')]['content-length']){delete _0x2e5e1e[_0x5f50('0xad')][_0x5f50('0xae')];}}if(_0x2e5e1e[_0x5f50('0xad')][_0x5f50('0xaf')]){delete _0x2e5e1e[_0x5f50('0xad')]['content-type'];}return rp(_0x2e5e1e);})[_0x5f50('0x34')](function(_0x150592){if(_0x150592){_0x37edc9[_0x5f50('0x2c')](_0x150592['headers']);logger[_0x5f50('0x72')](_0x150592[_0x5f50('0x9d')]);if(_[_0x5f50('0xb0')](_0x188060[_0x5f50('0x41')]['path'],_0x5f50('0x6f'))&&_0x150592[_0x5f50('0xb1')]==0x1f4){return _0x37edc9['sendStatus'](_0x150592[_0x5f50('0xb1')]);}else{return _0x37edc9[_0x5f50('0x26')](_0x150592['statusCode'])[_0x5f50('0x39')](_0x150592[_0x5f50('0x9d')]);}}else{return _0x37edc9[_0x5f50('0x25')](0xc8);}})['catch'](handleError(_0x37edc9,null));};exports[_0x5f50('0xb2')]=function(_0x3eeebb,_0x3107cb,_0x2bed26){return BPromise['resolve']()[_0x5f50('0x34')](function(){if(!_0x3eeebb[_0x5f50('0x41')][_0x5f50('0x7')]){throw new Error(_0x5f50('0xb3'));}if(!_0x3eeebb[_0x5f50('0x41')][_0x5f50('0xa8')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0xd9ed51=_0x3eeebb[_0x5f50('0x41')]['hostname']?_0x3eeebb['query']['hostname']+':'+_0x3eeebb['query'][_0x5f50('0xa8')]:_0x5f50('0xb4')+_0x3eeebb[_0x5f50('0x41')][_0x5f50('0xa8')];var _0x22e77b=_0x3eeebb[_0x5f50('0x41')][_0x5f50('0x27')]?_0x3eeebb[_0x5f50('0x41')][_0x5f50('0x27')]:!![];var _0x1381ca=_0x3eeebb[_0x5f50('0x41')][_0x5f50('0xab')]?_0x3eeebb[_0x5f50('0x41')]['encoding']:null;var _0x2f191b={'method':_0x3eeebb[_0x5f50('0xac')],'uri':util[_0x5f50('0x5b')](_0x5f50('0xb5'),_0xd9ed51,_0x3eeebb[_0x5f50('0x41')][_0x5f50('0x7')]),'json':_0x22e77b,'resolveWithFullResponse':!![],'encoding':_0x1381ca,'body':_0x3eeebb['body']};if(_0x3eeebb[_0x5f50('0xad')]){_0x2f191b[_0x5f50('0xad')]=_0x3eeebb['headers'];if(_0x2f191b[_0x5f50('0xad')][_0x5f50('0xae')]){delete _0x2f191b[_0x5f50('0xad')][_0x5f50('0xae')];}}if(_0x2f191b['headers'][_0x5f50('0xaf')]){delete _0x2f191b[_0x5f50('0xad')]['content-type'];}return rp(_0x2f191b);})[_0x5f50('0x34')](function(_0x24238c){if(_0x24238c){_0x3107cb[_0x5f50('0x2c')](_0x24238c[_0x5f50('0xad')]);logger['info'](_0x24238c[_0x5f50('0x9d')]);return _0x3107cb['status'](_0x24238c[_0x5f50('0xb1')])[_0x5f50('0x39')](_0x24238c[_0x5f50('0x9d')]);}else{return _0x3107cb['sendStatus'](0xc8);}})['catch'](handleError(_0x3107cb,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 8f8ec39..4771d62 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 _0xc627=['update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','Plugin','setMaxListeners'];(function(_0x44582d,_0x2c15c1){var _0x50a8ad=function(_0x2ab522){while(--_0x2ab522){_0x44582d['push'](_0x44582d['shift']());}};_0x50a8ad(++_0x2c15c1);}(_0xc627,0x14a));var _0x7c62=function(_0x38aa65,_0x161fd2){_0x38aa65=_0x38aa65-0x0;var _0x5d9b55=_0xc627[_0x38aa65];return _0x5d9b55;};'use strict';var EventEmitter=require('events');var Plugin=require(_0x7c62('0x0'))['db'][_0x7c62('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0x7c62('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7c62('0x3'),'afterDestroy':_0x7c62('0x4')};function emitEvent(_0x2f79e5){return function(_0x313d80,_0x121766,_0x35859a){PluginEvents[_0x7c62('0x5')](_0x2f79e5+':'+_0x313d80['id'],_0x313d80);PluginEvents[_0x7c62('0x5')](_0x2f79e5,_0x313d80);_0x35859a(null);};}for(var e in events){if(events[_0x7c62('0x6')](e)){var event=events[e];Plugin[_0x7c62('0x7')](e,emitEvent(event));}}module[_0x7c62('0x8')]=PluginEvents; \ No newline at end of file +var _0x553a=['emit','hook','exports','../../mysqldb','setMaxListeners','save','update'];(function(_0x25a45a,_0x156e4b){var _0x237f87=function(_0x17c9e5){while(--_0x17c9e5){_0x25a45a['push'](_0x25a45a['shift']());}};_0x237f87(++_0x156e4b);}(_0x553a,0x192));var _0xa553=function(_0x3f994d,_0x249d72){_0x3f994d=_0x3f994d-0x0;var _0x5309b4=_0x553a[_0x3f994d];return _0x5309b4;};'use strict';var EventEmitter=require('events');var Plugin=require(_0xa553('0x0'))['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents[_0xa553('0x1')](0x0);var events={'afterCreate':_0xa553('0x2'),'afterUpdate':_0xa553('0x3'),'afterDestroy':'remove'};function emitEvent(_0x4d5106){return function(_0x367421,_0x50ecee,_0x4b0e9b){PluginEvents[_0xa553('0x4')](_0x4d5106+':'+_0x367421['id'],_0x367421);PluginEvents['emit'](_0x4d5106,_0x367421);_0x4b0e9b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin[_0xa553('0x5')](e,emitEvent(event));}}module[_0xa553('0x6')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index afac1f7..a1c9075 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 _0xa8db=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./plugin.attributes','Plugin','plugins','lodash','util'];(function(_0x588ed0,_0x53dc09){var _0x5d23cc=function(_0x153884){while(--_0x153884){_0x588ed0['push'](_0x588ed0['shift']());}};_0x5d23cc(++_0x53dc09);}(_0xa8db,0x12a));var _0xba8d=function(_0x4c4037,_0x15054b){_0x4c4037=_0x4c4037-0x0;var _0x357862=_0xa8db[_0x4c4037];return _0x357862;};'use strict';var _=require(_0xba8d('0x0'));var util=require(_0xba8d('0x1'));var logger=require(_0xba8d('0x2'))(_0xba8d('0x3'));var moment=require(_0xba8d('0x4'));var BPromise=require('bluebird');var rp=require(_0xba8d('0x5'));var fs=require('fs');var path=require(_0xba8d('0x6'));var rimraf=require(_0xba8d('0x7'));var config=require(_0xba8d('0x8'));var attributes=require(_0xba8d('0x9'));module['exports']=function(_0x5dd30,_0x51f070){return _0x5dd30['define'](_0xba8d('0xa'),attributes,{'tableName':_0xba8d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x151c=['define','Plugin','plugins','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./plugin.attributes','exports'];(function(_0x30f6c1,_0x385793){var _0x9c6adb=function(_0x3f3569){while(--_0x3f3569){_0x30f6c1['push'](_0x30f6c1['shift']());}};_0x9c6adb(++_0x385793);}(_0x151c,0x92));var _0xc151=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x151c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xc151('0x0'));var logger=require(_0xc151('0x1'))(_0xc151('0x2'));var moment=require(_0xc151('0x3'));var BPromise=require(_0xc151('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc151('0x5'));var rimraf=require(_0xc151('0x6'));var config=require(_0xc151('0x7'));var attributes=require(_0xc151('0x8'));module[_0xc151('0x9')]=function(_0xd572ae,_0x5968db){return _0xd572ae[_0xc151('0xa')](_0xc151('0xb'),attributes,{'tableName':_0xc151('0xc'),'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 0d958ae..35de9fa 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 _0x1588=['moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','error','message','Plugin','create','body','options','raw','CreatePlugin','stringify','catch','util'];(function(_0xa54510,_0x213db3){var _0x210dd3=function(_0x305ca3){while(--_0x305ca3){_0xa54510['push'](_0xa54510['shift']());}};_0x210dd3(++_0x213db3);}(_0x1588,0x195));var _0x8158=function(_0x26de0a,_0x1e5f07){_0x26de0a=_0x26de0a-0x0;var _0x5f3a00=_0x1588[_0x26de0a];return _0x5f3a00;};'use strict';var _=require('lodash');var util=require(_0x8158('0x0'));var moment=require(_0x8158('0x1'));var BPromise=require(_0x8158('0x2'));var rs=require(_0x8158('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8158('0x4'));var logger=require(_0x8158('0x5'))(_0x8158('0x6'));var config=require(_0x8158('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x8158('0x8')][_0x8158('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0x8158('0xa')],{'host':_0x8158('0xb'),'port':0x18eb});var socket=require(_0x8158('0xc'))(new Redis(config[_0x8158('0xa')]));require('./plugin.socket')['register'](socket);function respondWithRpcPromise(_0x468a20,_0x5a40bc,_0x166952){return new BPromise(function(_0x6a30b7,_0x47eee3){return client['request'](_0x468a20,_0x166952)[_0x8158('0xd')](function(_0x31589b){logger[_0x8158('0xe')](_0x8158('0xf'),_0x5a40bc,_0x8158('0x10'));logger[_0x8158('0x11')](_0x8158('0x12'),_0x5a40bc,'request\x20sent',JSON['stringify'](_0x31589b));if(_0x31589b[_0x8158('0x13')]){if(_0x31589b[_0x8158('0x13')]['code']===0x1f4){logger[_0x8158('0x13')](_0x8158('0xf'),_0x5a40bc,_0x31589b[_0x8158('0x13')][_0x8158('0x14')]);return _0x47eee3(_0x31589b[_0x8158('0x13')][_0x8158('0x14')]);}logger[_0x8158('0x13')](_0x8158('0xf'),_0x5a40bc,_0x31589b[_0x8158('0x13')][_0x8158('0x14')]);return _0x6a30b7(_0x31589b[_0x8158('0x13')]['message']);}else{logger[_0x8158('0xe')](_0x8158('0xf'),_0x5a40bc,'request\x20sent');_0x6a30b7(_0x31589b['result'][_0x8158('0x14')]);}})['catch'](function(_0x13191d){logger['error'](_0x8158('0xf'),_0x5a40bc,_0x13191d);_0x47eee3(_0x13191d);});});}exports['CreatePlugin']=function(_0x38c0e2){var _0x23ec99=this;return new Promise(function(_0x2ae2e4,_0x1cc9e6){return db[_0x8158('0x15')][_0x8158('0x16')](_0x38c0e2[_0x8158('0x17')],{'raw':_0x38c0e2[_0x8158('0x18')]?_0x38c0e2['options'][_0x8158('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x2988b0){logger['info'](_0x8158('0x1a'),_0x38c0e2);logger[_0x8158('0x11')](_0x8158('0x1a'),_0x38c0e2,JSON[_0x8158('0x1b')](_0x2988b0));_0x2ae2e4(_0x2988b0);})[_0x8158('0x1c')](function(_0x3459fe){logger[_0x8158('0x13')](_0x8158('0x1a'),_0x3459fe[_0x8158('0x14')],_0x38c0e2);_0x1cc9e6(_0x23ec99[_0x8158('0x13')](0x1f4,_0x3459fe[_0x8158('0x14')]));});});}; \ No newline at end of file +var _0x139a=['message','info','result','catch','CreatePlugin','Plugin','create','options','raw','debug','lodash','util','moment','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','socket.io-emitter','./plugin.socket','register','then','Plugin,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x281684,_0x1eae63){var _0x513920=function(_0x3f80e8){while(--_0x3f80e8){_0x281684['push'](_0x281684['shift']());}};_0x513920(++_0x1eae63);}(_0x139a,0x1a0));var _0xa139=function(_0x3850de,_0x2acfca){_0x3850de=_0x3850de-0x0;var _0x3c405f=_0x139a[_0x3850de];return _0x3c405f;};'use strict';var _=require(_0xa139('0x0'));var util=require(_0xa139('0x1'));var moment=require(_0xa139('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa139('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa139('0x4'))(_0xa139('0x5'));var config=require(_0xa139('0x6'));var jayson=require(_0xa139('0x7'));var client=jayson[_0xa139('0x8')]['http']({'port':0x232a});config['redis']=_[_0xa139('0x9')](config[_0xa139('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xa139('0xb'))(new Redis(config[_0xa139('0xa')]));require(_0xa139('0xc'))[_0xa139('0xd')](socket);function respondWithRpcPromise(_0x1f7115,_0x40120b,_0x371233){return new BPromise(function(_0x4c487c,_0x2ec3a7){return client['request'](_0x1f7115,_0x371233)[_0xa139('0xe')](function(_0x56708f){logger['info'](_0xa139('0xf'),_0x40120b,_0xa139('0x10'));logger['debug']('Plugin,\x20%s,\x20%s,\x20%s',_0x40120b,'request\x20sent',JSON['stringify'](_0x56708f));if(_0x56708f[_0xa139('0x11')]){if(_0x56708f[_0xa139('0x11')][_0xa139('0x12')]===0x1f4){logger[_0xa139('0x11')](_0xa139('0xf'),_0x40120b,_0x56708f[_0xa139('0x11')][_0xa139('0x13')]);return _0x2ec3a7(_0x56708f[_0xa139('0x11')][_0xa139('0x13')]);}logger[_0xa139('0x11')]('Plugin,\x20%s,\x20%s',_0x40120b,_0x56708f['error']['message']);return _0x4c487c(_0x56708f[_0xa139('0x11')]['message']);}else{logger[_0xa139('0x14')]('Plugin,\x20%s,\x20%s',_0x40120b,'request\x20sent');_0x4c487c(_0x56708f[_0xa139('0x15')][_0xa139('0x13')]);}})[_0xa139('0x16')](function(_0x470513){logger['error']('Plugin,\x20%s,\x20%s',_0x40120b,_0x470513);_0x2ec3a7(_0x470513);});});}exports[_0xa139('0x17')]=function(_0x927dc4){var _0x299385=this;return new Promise(function(_0x377d3e,_0x4ede4e){return db[_0xa139('0x18')][_0xa139('0x19')](_0x927dc4['body'],{'raw':_0x927dc4[_0xa139('0x1a')]?_0x927dc4['options'][_0xa139('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x462736){logger[_0xa139('0x14')](_0xa139('0x17'),_0x927dc4);logger[_0xa139('0x1c')](_0xa139('0x17'),_0x927dc4,JSON['stringify'](_0x462736));_0x377d3e(_0x462736);})['catch'](function(_0x3723df){logger[_0xa139('0x11')]('CreatePlugin',_0x3723df[_0xa139('0x13')],_0x927dc4);_0x4ede4e(_0x299385[_0xa139('0x11')](0x1f4,_0x3723df['message']));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index f209ae2..6287122 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 _0xa458=['removeListener','register','length','plugin:','save','remove','emit'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa458,0x185));var _0x8a45=function(_0x301a0a,_0x46839e){_0x301a0a=_0x301a0a-0x0;var _0x19bda4=_0xa458[_0x301a0a];return _0x19bda4;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0x8a45('0x0'),_0x8a45('0x1'),'update'];function createListener(_0x476fca,_0xc03f3b){return function(_0x13e880){_0xc03f3b[_0x8a45('0x2')](_0x476fca,_0x13e880);};}function removeListener(_0x55e5f8,_0x6b1dc2){return function(){PluginEvents[_0x8a45('0x3')](_0x55e5f8,_0x6b1dc2);};}exports[_0x8a45('0x4')]=function(_0x573285){for(var _0x286cf9=0x0,_0x52aa57=events[_0x8a45('0x5')];_0x286cf9<_0x52aa57;_0x286cf9++){var _0x8134ac=events[_0x286cf9];var _0x2c5b0a=createListener(_0x8a45('0x6')+_0x8134ac,_0x573285);PluginEvents['on'](_0x8134ac,_0x2c5b0a);}}; \ No newline at end of file +var _0x0c23=['./plugin.events','save','remove','update','length','plugin:'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x0c23,0x180));var _0x30c2=function(_0x362d7c,_0x3d44fe){_0x362d7c=_0x362d7c-0x0;var _0x11cbea=_0x0c23[_0x362d7c];return _0x11cbea;};'use strict';var PluginEvents=require(_0x30c2('0x0'));var events=[_0x30c2('0x1'),_0x30c2('0x2'),_0x30c2('0x3')];function createListener(_0x3d1b2d,_0x443e4d){return function(_0x253ab4){_0x443e4d['emit'](_0x3d1b2d,_0x253ab4);};}function removeListener(_0x2c0c98,_0x4b106b){return function(){PluginEvents['removeListener'](_0x2c0c98,_0x4b106b);};}exports['register']=function(_0x3f5ca1){for(var _0x3c1215=0x0,_0x14470c=events[_0x30c2('0x4')];_0x3c1215<_0x14470c;_0x3c1215++){var _0x473d87=events[_0x3c1215];var _0x540bd8=createListener(_0x30c2('0x5')+_0x473d87,_0x3f5ca1);PluginEvents['on'](_0x473d87,_0x540bd8);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 43390d6..9e043d3 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(_0x59ae95,_0x5c3671){var _0x5276f7=function(_0x4094ee){while(--_0x4094ee){_0x59ae95['push'](_0x59ae95['shift']());}};_0x5276f7(++_0x5c3671);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'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(_0x3abc15,_0x3931a3){var _0x1d8785=function(_0x4f1e51){while(--_0x4f1e51){_0x3abc15['push'](_0x3abc15['shift']());}};_0x1d8785(++_0x3931a3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xa9e0[_0x6131cd];return _0x47e916;};'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 69e7bdc..a20157f 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 _0xf72b=['hasOwnProperty','Unknown\x20status','destroy','params','delete','lodash','../../config/logger','path','child_process','bluebird','sendStatus','status','json','stack','name','npm\x20install','info','index','then','express','motion2','length','catch','show','describe','create','body','script','join','../../files/plugins','cwd','dirname','start','dump','send','Missing\x20name\x20and/or\x20path','update','restart','stop'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xf72b,0x1d9));var _0xbf72=function(_0x3c8315,_0x2b014e){_0x3c8315=_0x3c8315-0x0;var _0x1c9df5=_0xf72b[_0x3c8315];return _0x1c9df5;};'use strict';var _=require(_0xbf72('0x0'));var pm2=require('../../config/pm2');var logger=require(_0xbf72('0x1'))('api');var path=require(_0xbf72('0x2'));var exec=require(_0xbf72('0x3'))['exec'];var BPromise=require(_0xbf72('0x4'));function handleEntityNotFound(_0x550a9e,_0x37afc8){return function(_0x3d3a6f){if(!_0x3d3a6f){_0x550a9e[_0xbf72('0x5')](0x194);;}return _0x3d3a6f;};}function respondWithResult(_0x2b8440,_0x5ee060){_0x5ee060=_0x5ee060||0xc8;return function(_0x41c11d){if(_0x41c11d){return _0x2b8440[_0xbf72('0x6')](_0x5ee060)[_0xbf72('0x7')](_0x41c11d);}return null;};}function handleError(_0xd0402c,_0xdd6177){_0xdd6177=_0xdd6177||0x1f4;return function(_0x1b6d38){logger['error'](_0x1b6d38[_0xbf72('0x8')]);if(_0x1b6d38['name']){delete _0x1b6d38[_0xbf72('0x9')];}_0xd0402c[_0xbf72('0x6')](_0xdd6177)['send'](_0x1b6d38);};}function execChildProcess(){return new BPromise(function(_0xaec095,_0x1c3453){exec(_0xbf72('0xa'),function(_0x145acb,_0x2957c5,_0x44ce73){logger[_0xbf72('0xb')](_0x2957c5);logger[_0xbf72('0xb')](_0x44ce73);if(_0x145acb){logger['error'](_0x145acb);return _0x1c3453(_0x145acb);}return _0xaec095(_0x2957c5);});});}exports[_0xbf72('0xc')]=function(_0x227a35,_0x57cccf){return pm2['list']()[_0xbf72('0xd')](function(_0x4f4fa5){if(_0x4f4fa5){var _0x5625b3=_['reject'](_0x4f4fa5,function(_0x32a0a5){return _0x32a0a5[_0xbf72('0x9')]===_0xbf72('0xe')||_0x32a0a5[_0xbf72('0x9')]===_0xbf72('0xf');});return{'rows':_0x5625b3,'count':_0x5625b3[_0xbf72('0x10')]};}return null;})['then'](respondWithResult(_0x57cccf,null))[_0xbf72('0x11')](handleError(_0x57cccf,null));};exports[_0xbf72('0x12')]=function(_0x2a8609,_0x3d4dea){return pm2[_0xbf72('0x13')](_0x2a8609['params']['id'])['then'](respondWithResult(_0x3d4dea,null))[_0xbf72('0xd')](handleEntityNotFound(_0x3d4dea,null))[_0xbf72('0x11')](handleError(_0x3d4dea,null));};exports[_0xbf72('0x14')]=function(_0x2584d9,_0x27e58e){if(_0x2584d9[_0xbf72('0x15')][_0xbf72('0x9')]&&_0x2584d9['body'][_0xbf72('0x16')]){var _0x42a193=path[_0xbf72('0x17')](__dirname,_0xbf72('0x18'),_0x2584d9[_0xbf72('0x15')]['script']);var _0x3cd181=process[_0xbf72('0x19')]();process['chdir'](path[_0xbf72('0x1a')](_0x42a193));return execChildProcess()[_0xbf72('0xd')](function(_0x267c41){process['chdir'](_0x3cd181);return pm2[_0xbf72('0x1b')]({'name':_0x2584d9[_0xbf72('0x15')][_0xbf72('0x9')],'script':_0x42a193});})[_0xbf72('0xd')](function(_0x4f4dc0){pm2[_0xbf72('0x1c')]();return _0x4f4dc0[0x0];})[_0xbf72('0xd')](respondWithResult(_0x27e58e,0xc9))[_0xbf72('0x11')](handleError(_0x27e58e,null));}else{return _0x27e58e['status'](0x1f4)[_0xbf72('0x1d')]({'message':_0xbf72('0x1e')});}};exports[_0xbf72('0x1f')]=function(_0x1a2f55,_0x15d60d){if(_0x1a2f55[_0xbf72('0x15')]['id']){delete _0x1a2f55[_0xbf72('0x15')]['id'];}var _0x25ecdf={'online':_0xbf72('0x20'),'stopped':_0xbf72('0x21')};if(_0x25ecdf[_0xbf72('0x22')](_0x1a2f55[_0xbf72('0x15')][_0xbf72('0x6')])){return pm2[_0x25ecdf[_0x1a2f55[_0xbf72('0x15')][_0xbf72('0x6')]]](_0x1a2f55['params']['id'])[_0xbf72('0xd')](respondWithResult(_0x15d60d,0xc8))[_0xbf72('0x11')](handleError(_0x15d60d,null));}else{return _0x15d60d[_0xbf72('0x6')](0x1f4)[_0xbf72('0x1d')]({'message':_0xbf72('0x23')});}};exports[_0xbf72('0x24')]=function(_0x35ecdc,_0x209b2b){if(_0x35ecdc[_0xbf72('0x15')]['id']){delete _0x35ecdc[_0xbf72('0x15')]['id'];}if(_0x35ecdc[_0xbf72('0x25')]['id']){return pm2[_0xbf72('0x26')](_0x35ecdc[_0xbf72('0x25')]['id'])[_0xbf72('0xd')](function(_0x4e2472){pm2[_0xbf72('0x1c')]();return _0x4e2472[0x0];})[_0xbf72('0xd')](respondWithResult(_0x209b2b,null))[_0xbf72('0x11')](handleError(_0x209b2b,null));}else{return _0x209b2b['status'](0x1f4)['send']({'message':'Unknown\x20id'});}}; \ No newline at end of file +var _0x34e5=['info','error','list','then','reject','motion2','catch','show','describe','params','create','body','script','join','../../files/plugins','cwd','dirname','chdir','start','dump','send','Missing\x20name\x20and/or\x20path','update','restart','hasOwnProperty','Unknown\x20status','destroy','delete','../../config/pm2','api','path','child_process','exec','bluebird','sendStatus','status','name','npm\x20install'];(function(_0x358493,_0x2d3bcf){var _0x2431c0=function(_0x59b951){while(--_0x59b951){_0x358493['push'](_0x358493['shift']());}};_0x2431c0(++_0x2d3bcf);}(_0x34e5,0x172));var _0x534e=function(_0x2559c2,_0x1e9b98){_0x2559c2=_0x2559c2-0x0;var _0x432e29=_0x34e5[_0x2559c2];return _0x432e29;};'use strict';var _=require('lodash');var pm2=require(_0x534e('0x0'));var logger=require('../../config/logger')(_0x534e('0x1'));var path=require(_0x534e('0x2'));var exec=require(_0x534e('0x3'))[_0x534e('0x4')];var BPromise=require(_0x534e('0x5'));function handleEntityNotFound(_0x50b790,_0x11a158){return function(_0x3d8287){if(!_0x3d8287){_0x50b790[_0x534e('0x6')](0x194);;}return _0x3d8287;};}function respondWithResult(_0x117f0c,_0x436a92){_0x436a92=_0x436a92||0xc8;return function(_0x2d0370){if(_0x2d0370){return _0x117f0c[_0x534e('0x7')](_0x436a92)['json'](_0x2d0370);}return null;};}function handleError(_0x24d562,_0x929597){_0x929597=_0x929597||0x1f4;return function(_0xa836bb){logger['error'](_0xa836bb['stack']);if(_0xa836bb[_0x534e('0x8')]){delete _0xa836bb['name'];}_0x24d562[_0x534e('0x7')](_0x929597)['send'](_0xa836bb);};}function execChildProcess(){return new BPromise(function(_0xb30dd6,_0x310b6d){exec(_0x534e('0x9'),function(_0x529726,_0x1b7a5a,_0x229352){logger[_0x534e('0xa')](_0x1b7a5a);logger[_0x534e('0xa')](_0x229352);if(_0x529726){logger[_0x534e('0xb')](_0x529726);return _0x310b6d(_0x529726);}return _0xb30dd6(_0x1b7a5a);});});}exports['index']=function(_0x31d764,_0x23c11c){return pm2[_0x534e('0xc')]()[_0x534e('0xd')](function(_0x359565){if(_0x359565){var _0x478027=_[_0x534e('0xe')](_0x359565,function(_0x17c068){return _0x17c068[_0x534e('0x8')]==='express'||_0x17c068[_0x534e('0x8')]===_0x534e('0xf');});return{'rows':_0x478027,'count':_0x478027['length']};}return null;})['then'](respondWithResult(_0x23c11c,null))[_0x534e('0x10')](handleError(_0x23c11c,null));};exports[_0x534e('0x11')]=function(_0x9297b6,_0x16ad40){return pm2[_0x534e('0x12')](_0x9297b6[_0x534e('0x13')]['id'])[_0x534e('0xd')](respondWithResult(_0x16ad40,null))['then'](handleEntityNotFound(_0x16ad40,null))[_0x534e('0x10')](handleError(_0x16ad40,null));};exports[_0x534e('0x14')]=function(_0x466d74,_0x1bef0a){if(_0x466d74[_0x534e('0x15')]['name']&&_0x466d74[_0x534e('0x15')][_0x534e('0x16')]){var _0x5f9ae9=path[_0x534e('0x17')](__dirname,_0x534e('0x18'),_0x466d74[_0x534e('0x15')][_0x534e('0x16')]);var _0x85188b=process[_0x534e('0x19')]();process['chdir'](path[_0x534e('0x1a')](_0x5f9ae9));return execChildProcess()[_0x534e('0xd')](function(_0x39466c){process[_0x534e('0x1b')](_0x85188b);return pm2[_0x534e('0x1c')]({'name':_0x466d74[_0x534e('0x15')][_0x534e('0x8')],'script':_0x5f9ae9});})[_0x534e('0xd')](function(_0x53a6ef){pm2[_0x534e('0x1d')]();return _0x53a6ef[0x0];})['then'](respondWithResult(_0x1bef0a,0xc9))[_0x534e('0x10')](handleError(_0x1bef0a,null));}else{return _0x1bef0a[_0x534e('0x7')](0x1f4)[_0x534e('0x1e')]({'message':_0x534e('0x1f')});}};exports[_0x534e('0x20')]=function(_0x57b216,_0x743974){if(_0x57b216[_0x534e('0x15')]['id']){delete _0x57b216['body']['id'];}var _0x4bd073={'online':_0x534e('0x21'),'stopped':'stop'};if(_0x4bd073[_0x534e('0x22')](_0x57b216[_0x534e('0x15')][_0x534e('0x7')])){return pm2[_0x4bd073[_0x57b216[_0x534e('0x15')][_0x534e('0x7')]]](_0x57b216[_0x534e('0x13')]['id'])[_0x534e('0xd')](respondWithResult(_0x743974,0xc8))['catch'](handleError(_0x743974,null));}else{return _0x743974['status'](0x1f4)[_0x534e('0x1e')]({'message':_0x534e('0x23')});}};exports[_0x534e('0x24')]=function(_0x2f1c49,_0x423502){if(_0x2f1c49[_0x534e('0x15')]['id']){delete _0x2f1c49[_0x534e('0x15')]['id'];}if(_0x2f1c49[_0x534e('0x13')]['id']){return pm2[_0x534e('0x25')](_0x2f1c49[_0x534e('0x13')]['id'])[_0x534e('0xd')](function(_0x1d6fb1){pm2['dump']();return _0x1d6fb1[0x0];})[_0x534e('0xd')](respondWithResult(_0x423502,null))[_0x534e('0x10')](handleError(_0x423502,null));}else{return _0x423502['status'](0x1f4)[_0x534e('0x1e')]({'message':'Unknown\x20id'});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 74b0ed1..16a91dd 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 _0xf833=['./realtime.controller','get','isAuthenticated','getAgents','/queues','exports'];(function(_0x40f4d3,_0x2c163c){var _0x342be1=function(_0x26c186){while(--_0x26c186){_0x40f4d3['push'](_0x40f4d3['shift']());}};_0x342be1(++_0x2c163c);}(_0xf833,0x1ec));var _0x3f83=function(_0x35a552,_0x56629b){_0x35a552=_0x35a552-0x0;var _0x457ea2=_0xf833[_0x35a552];return _0x457ea2;};'use strict';var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0x3f83('0x0'));router[_0x3f83('0x1')]('/agents',auth[_0x3f83('0x2')](),controller[_0x3f83('0x3')]);router[_0x3f83('0x1')](_0x3f83('0x4'),auth[_0x3f83('0x2')](),controller['getQueues']);module[_0x3f83('0x5')]=router; \ No newline at end of file +var _0x0512=['./realtime.controller','get','/agents','getAgents','/queues','isAuthenticated','exports','../../components/auth/service'];(function(_0x2681bb,_0x19e9aa){var _0x268684=function(_0x1e2f4c){while(--_0x1e2f4c){_0x2681bb['push'](_0x2681bb['shift']());}};_0x268684(++_0x19e9aa);}(_0x0512,0x9f));var _0x2051=function(_0x5315d7,_0x189245){_0x5315d7=_0x5315d7-0x0;var _0x5b31b0=_0x0512[_0x5315d7];return _0x5b31b0;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x2051('0x0'));var controller=require(_0x2051('0x1'));router[_0x2051('0x2')](_0x2051('0x3'),auth['isAuthenticated'](),controller[_0x2051('0x4')]);router[_0x2051('0x2')](_0x2051('0x5'),auth[_0x2051('0x6')](),controller['getQueues']);module[_0x2051('0x7')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index 1afa562..c9aefa6 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 _0x299d=['mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','chatStatus','openchannelStatus','mailStatus','chatStatusTime','openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','voiceStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','rawAttributes','fieldName','type','key','query','agent','getOptions','raw','user','role','nolimit','sort','UserProfile','getResources','findAndCountAll','rows','omit','globalStatus','globalStatusFilter','pauseTypeFilter','getQueues','mail','chat','sms','openchannel','whatsapp','toLowerCase','Invalid\x20channel','map','QueueCampaigns','all','jayson/promise','../../components/parsers/qs','../../config/logger','api','http','offset','undefined','count','limit','set','Content-Range','error','stack','name','status','send','Agents','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','request','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','catch','voice','startCase','Queues','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','VoiceQueuesChannels','Unable\x20to\x20retrieve\x20voice\x20queues\x20channels','available','waiting','talking','paused','outbound','push','originated','message','dialActive','dialMethod','Trunk','startProgressive','erlangCalls','erlangCallToSecond','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','get','agents','loggedInDb','loggedIn','busy','pTalking','find','merge','pick','filter','some','connectedlinenum','internal','toString','getMembers','length','UserId','accountcode','online','voiceStatus','User','Queue','findAll','QueueId','idle','unavailable','ringing','isNil','chatPause','mailPause','smsPause','whatsappPause','every','voicePause','pause','faxStatus','smsStatus','whatsappStatus','unknown','*pause','userpic','lastLoginAt','lastPauseAt','pauseType','openchannelPause','faxPause','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity'];(function(_0x929c7e,_0x38c4cc){var _0x5de099=function(_0xc4e8d8){while(--_0xc4e8d8){_0x929c7e['push'](_0x929c7e['shift']());}};_0x5de099(++_0x38c4cc);}(_0x299d,0x168));var _0xd299=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x299d[_0x15bc81];return _0x59440e;};'use strict';var util=require('util');var _=require('lodash');var jayson=require(_0xd299('0x0'));var qs=require(_0xd299('0x1'));var logger=require(_0xd299('0x2'))(_0xd299('0x3'));var db=require('../../mysqldb')['db'];var amiClient=jayson['client']['http']({'port':0x232a});var routingClient=jayson['client'][_0xd299('0x4')]({'port':0x232c});function respondWithFilteredResult(_0x32a8d6,_0x29b113){return function(_0x4a6b4d){if(_0x4a6b4d){var _0x138ec7=typeof _0x29b113[_0xd299('0x5')]===_0xd299('0x6')&&typeof _0x29b113['limit']===_0xd299('0x6');var _0x4bfa65=_0x4a6b4d[_0xd299('0x7')];var _0x311ccc=_0x138ec7?0x0:_0x29b113[_0xd299('0x5')];var _0x26a6f0=_0x138ec7?_0x4a6b4d[_0xd299('0x7')]:_0x29b113['offset']+_0x29b113[_0xd299('0x8')];var _0x32deb9;if(_0x26a6f0>=_0x4bfa65){_0x26a6f0=_0x4bfa65;_0x32deb9=0xc8;}else{_0x32deb9=0xce;}_0x32a8d6['status'](_0x32deb9);return _0x32a8d6[_0xd299('0x9')](_0xd299('0xa'),_0x311ccc+'-'+_0x26a6f0+'/'+_0x4bfa65)['json'](_0x4a6b4d);}return null;};}function handleError(_0x1591d5,_0x5d656e){_0x5d656e=_0x5d656e||0x1f4;return function(_0x4cfbc6){logger[_0xd299('0xb')](_0x4cfbc6[_0xd299('0xc')]);if(_0x4cfbc6[_0xd299('0xd')]){delete _0x4cfbc6[_0xd299('0xd')];}_0x1591d5[_0xd299('0xe')](_0x5d656e)[_0xd299('0xf')](_0x4cfbc6);};}function getRealtimeAgents(){return new Promise(function(_0x5fe55f,_0xe45c22){return amiClient['request'](_0xd299('0x10'),{})[_0xd299('0x11')](function(_0x54a4ff){if(_0x54a4ff[_0xd299('0xb')])throw new Error(_0xd299('0x12'));var _0x46bacd=_0x54a4ff[_0xd299('0x13')];return routingClient[_0xd299('0x14')](_0xd299('0x10'),{})[_0xd299('0x11')](function(_0x1cb63e){if(_0x1cb63e[_0xd299('0xb')])throw new Error(_0xd299('0x15'));var _0x410016=_0x1cb63e[_0xd299('0x13')];return _0x5fe55f(_['merge']({},_0x46bacd,_0x410016));});})[_0xd299('0x16')](function(_0x17aca4){_0xe45c22(_0x17aca4);});});}function getRealtimeQueues(_0x32f17e,_0x3e91fb){return new Promise(function(_0x403a5f,_0x2bd3f2){var _0x2767e8=_0x3e91fb===_0xd299('0x17')?amiClient:routingClient;return _0x2767e8['request'](_[_0xd299('0x18')](_0x3e91fb)+_0xd299('0x19'),_0x32f17e)[_0xd299('0x11')](function(_0x2ddd06){if(_0x2ddd06[_0xd299('0xb')])throw new Error(util['format'](_0xd299('0x1a'),_0x3e91fb));return _0x403a5f(_0x2ddd06['result']);})[_0xd299('0x16')](function(_0x4a2e6c){_0x2bd3f2(_0x4a2e6c);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x5914ab,_0x5e54e1){return amiClient['request'](_0xd299('0x1b'),{})[_0xd299('0x11')](function(_0x56595e){if(_0x56595e[_0xd299('0xb')])throw new Error(_0xd299('0x1c'));return _0x5914ab(_0x56595e['result']);})[_0xd299('0x16')](function(_0x2063ca){_0x5e54e1(_0x2063ca);});});}function initializeQueues(_0xab115b,_0x52cbc6,_0x186c92,_0x21a171){var _0x2b81bc=['loggedIn',_0xd299('0x1d'),_0xd299('0x1e'),_0xd299('0x1f'),_0xd299('0x20')];if(_0x186c92===_0xd299('0x17')&&_0x21a171===_0xd299('0x21')){_0x2b81bc[_0xd299('0x22')]('pTalking',_0xd299('0x23'),_0xd299('0x24'),_0xd299('0x25'),_0xd299('0x26'),_0xd299('0x27'),'startPredictive',_0xd299('0x28'),_0xd299('0x29'),_0xd299('0x2a'),'erlangAbandonmentRate',_0xd299('0x2b'),_0xd299('0x2c'),_0xd299('0x2d'),_0xd299('0x2e'),_0xd299('0x2f'),_0xd299('0x30'),_0xd299('0x31'),_0xd299('0x32'),_0xd299('0x33'),_0xd299('0x34'),'predictiveIntervalAvgTalktime');}return _0xab115b['map'](function(_0x1f5c8f){var _0x5ba803=_0x1f5c8f[_0xd299('0x35')]({'plain':!![]});_0x5ba803[_0xd299('0x36')]=[];_0x5ba803['paused']=0x0;_0x5ba803[_0xd299('0x37')]=0x0;_0x5ba803[_0xd299('0x38')]=0x0;_0x5ba803[_0xd299('0x1d')]=0x0;_0x5ba803[_0xd299('0x1e')]=0x0;if(_0x186c92===_0xd299('0x17')){_0x5ba803[_0xd299('0x1f')]=0x0;_0x5ba803[_0xd299('0x39')]=0x0;if(_0x21a171===_0xd299('0x21')){_0x5ba803[_0xd299('0x3a')]=0x0;_0x5ba803['originated']=0x0;}}var _0x3dc5dd=_[_0xd299('0x3b')](_0x52cbc6,['id',_0x5ba803['id']]);if(_0x3dc5dd)_[_0xd299('0x3c')](_0x5ba803,_[_0xd299('0x3d')](_0x3dc5dd,_0x2b81bc));return _0x5ba803;});}function updateAgentVoiceStatus(_0xfc9dc3,_0x1f559a,_0x38d07e){var _0x9d5b41=_[_0xd299('0x3e')](_0x38d07e,['queue',_0x1f559a[_0xd299('0xd')]]);if(_0x9d5b41['length']===0x0)return _0xfc9dc3[_0xd299('0x39')]=!![];if(_[_0xd299('0x3f')](_0x9d5b41,[_0xd299('0x40'),_0xfc9dc3[_0xd299('0x41')][_0xd299('0x42')]()]))return _0xfc9dc3[_0xd299('0x1f')]=!![];if(!_0xfc9dc3[_0xd299('0x1f')])return _0xfc9dc3[_0xd299('0x39')]=!![];}function getVoiceQueueAgents(_0x4a8dc1,_0x5c23aa,_0x3e85cc,_0x3ff46d){var _0x58096e=_[_0xd299('0x3b')](_0x5c23aa,['id',_0x4a8dc1['id']]);if(!_0x58096e)return _0x4a8dc1;return _0x58096e[_0xd299('0x43')]({'raw':!![]})[_0xd299('0x11')](function(_0x262324){for(var _0xee101a=0x0;_0xee101a<_0x262324[_0xd299('0x44')];_0xee101a++){var _0x368ee7=_['find'](_0x3e85cc,['id',_0x262324[_0xee101a]['UserId']]);if(!_0x368ee7){_0x368ee7={'id':_0x262324[_0xee101a][_0xd299('0x45')],'name':_0x262324[_0xee101a]['UserId'],'accountcode':'','online':![]};}var _0x38e089={'id':_0x368ee7['id'],'name':_0x368ee7['name'],'internal':_0x368ee7[_0xd299('0x46')],'online':Boolean(_0x368ee7[_0xd299('0x47')]),'paused':Boolean(_0x262324[_0xee101a]['paused'])};if(_0x368ee7[_0xd299('0x48')]===_0xd299('0x1f'))updateAgentVoiceStatus(_0x38e089,_0x4a8dc1,_0x3ff46d);if(_0x38e089['online'])_0x4a8dc1[_0xd299('0x37')]++;if(_0x38e089[_0xd299('0x39')])_0x4a8dc1[_0xd299('0x39')]++;if(_0x38e089[_0xd299('0x20')]&&!_0x38e089[_0xd299('0x39')]&&!_0x38e089[_0xd299('0x1f')])_0x4a8dc1[_0xd299('0x20')]++;_0x4a8dc1[_0xd299('0x36')]['push'](_0x38e089);}return _0x4a8dc1;});}function getQueueAgents(_0x172ae6,_0x5e5895,_0x4c7f9e){var _0x5c1a9f=_0xd299('0x49')+_['startCase'](_0x4c7f9e)+_0xd299('0x4a');var _0x221762=_0x4c7f9e+'Pause';return db[_0x5c1a9f][_0xd299('0x4b')]({'where':{[_[_0xd299('0x18')](_0x4c7f9e)+_0xd299('0x4c')]:_0x172ae6['id']},'raw':!![]})[_0xd299('0x11')](function(_0x538c72){for(var _0x38dc45=0x0;_0x38dc45<_0x538c72[_0xd299('0x44')];_0x38dc45++){var _0x41d601=_[_0xd299('0x3b')](_0x5e5895,['id',_0x538c72[_0x38dc45][_0xd299('0x45')]]);if(!_0x41d601){_0x41d601={'id':_0x538c72[_0x38dc45]['UserId'],'name':_0x538c72[_0x38dc45][_0xd299('0x45')],'online':![],['pauseField']:![]};}var _0x51c0d9={'id':_0x41d601['id'],'name':_0x41d601[_0xd299('0xd')],'online':Boolean(_0x41d601[_0xd299('0x47')]),'paused':Boolean(_0x41d601[_0x221762])};if(_0x51c0d9[_0xd299('0x47')])_0x172ae6[_0xd299('0x37')]++;_0x172ae6['agents'][_0xd299('0x22')](_0x51c0d9);}return _0x172ae6;});}function isIdle(_0x141d5c){return _0x141d5c===_0xd299('0x4d')||_0x141d5c==='unknown'||_0x141d5c===_0xd299('0x4e')||_0x141d5c===_0xd299('0x4f')||_[_0xd299('0x50')](_0x141d5c);}function isAgentPaused(_0x2de93b,_0x535d07){var _0x128ff2=[_0x2de93b[_0xd299('0x51')],_0x2de93b['faxPause'],_0x2de93b[_0xd299('0x52')],_0x2de93b['openchannelPause'],_0x2de93b[_0xd299('0x53')],_0x2de93b['voicePause'],_0x2de93b[_0xd299('0x54')]];if(!_0x535d07)return _[_0xd299('0x55')](_0x128ff2);var _0x2f604c=_[_0xd299('0x3e')](_0x128ff2);return _0x2f604c['length']>0x0&&_0x2f604c[_0xd299('0x44')]<_0x128ff2['length']?!![]:![];}function isAgentIdle(_0x54e988){if(_0x54e988[_0xd299('0x48')]!==_0xd299('0x4d')&&_0x54e988[_0xd299('0x56')]){_0x54e988[_0xd299('0x48')]=_0xd299('0x57');return![];}return _[_0xd299('0x55')]([_0x54e988['chatStatus'],_0x54e988[_0xd299('0x58')],_0x54e988['mailStatus'],_0x54e988['openchannelStatus'],_0x54e988[_0xd299('0x59')],_0x54e988[_0xd299('0x48')],_0x54e988[_0xd299('0x5a')]],isIdle);}function getAgentStatus(_0x31f635){var _0x184526=_0xd299('0x5b');if(isAgentPaused(_0x31f635))_0x184526='pause';else if(isAgentPaused(_0x31f635,!![]))_0x184526=_0xd299('0x5c');else if(isAgentIdle(_0x31f635))_0x184526=_0xd299('0x4d');else _0x184526=_0xd299('0x39');return _0x184526;}exports['getAgents']=function(_0x4cf8fb,_0x3a85c0){var _0x1da15c={'count':0x0,'rows':[]},_0x2aac36={},_0x4d517b,_0x619911,_0x2f4f4f=[_0xd299('0x5d'),_0xd299('0x47'),_0xd299('0x5e'),_0xd299('0x5f'),_0xd299('0x60'),_0xd299('0x5f'),_0xd299('0x41'),'address','chatPause',_0xd299('0x61'),_0xd299('0x52'),_0xd299('0x53'),_0xd299('0x54'),_0xd299('0x62'),_0xd299('0x56'),'chatCapacity',_0xd299('0x63'),_0xd299('0x64'),_0xd299('0x65'),_0xd299('0x66'),_0xd299('0x67'),_0xd299('0x68'),'openchannelCurrentCapacity',_0xd299('0x69'),_0xd299('0x6a'),_0xd299('0x6b'),_0xd299('0x6c'),_0xd299('0x6d'),_0xd299('0x6e'),_0xd299('0x6f'),_0xd299('0x59'),_0xd299('0x5a'),_0xd299('0x58'),_0xd299('0x48'),_0xd299('0x70'),_0xd299('0x71'),_0xd299('0x72'),_0xd299('0x73'),_0xd299('0x74'),'faxStatusTime',_0xd299('0x75'),_0xd299('0x76'),_0xd299('0x77'),_0xd299('0x78'),_0xd299('0x79'),_0xd299('0x7a'),_0xd299('0x7b')],_0x3b6069=[_0xd299('0x51'),_0xd299('0x61'),_0xd299('0x52'),'smsPause',_0xd299('0x54'),_0xd299('0x62'),_0xd299('0x56'),'online'];Promise['resolve']()[_0xd299('0x11')](function(){var _0x428cab=_['map'](db[_0xd299('0x49')][_0xd299('0x7c')],function(_0x9ca007){return{'name':_0x9ca007[_0xd299('0x7d')],'type':_0x9ca007[_0xd299('0x7e')][_0xd299('0x7f')]};});_0x4cf8fb[_0xd299('0x80')]['role']=_0xd299('0x81');_0x4cf8fb[_0xd299('0x80')][_0xd299('0x47')]=!![];_0x2aac36=qs[_0xd299('0x82')](_0x428cab,_0x4cf8fb);_0x2aac36[_0xd299('0x83')]=!![];if(_0x4cf8fb[_0xd299('0x84')][_0xd299('0x85')]===_0xd299('0x84')){var _0x1eca79={'params':{'id':_0x4cf8fb['user']['userProfileId']},'query':{'section':_0xd299('0x10'),'role':'agent','online':!![],'nolimit':_0x4cf8fb[_0xd299('0x80')][_0xd299('0x86')],'sort':_0x4cf8fb[_0xd299('0x80')][_0xd299('0x87')],'filter':_0x4cf8fb[_0xd299('0x80')][_0xd299('0x3e')]},'raw':!![]};return db[_0xd299('0x88')][_0xd299('0x89')](_0x1eca79);}return db[_0xd299('0x49')][_0xd299('0x8a')](_0x2aac36);})[_0xd299('0x11')](function(_0x53d172){_0x1da15c['count']=_0x53d172[_0xd299('0x7')];_0x4d517b=_0x53d172[_0xd299('0x8b')];return getRealtimeAgents();})[_0xd299('0x11')](function(_0xd06694){_0x619911=_0xd06694[_0xd299('0x8b')];return _0x4d517b['map'](function(_0x583c03){var _0x1b2762=_[_0xd299('0x3b')](_0x619911,['id',_0x583c03['id']]);if(_0x1b2762)_[_0xd299('0x3c')](_0x583c03,_[_0xd299('0x3d')](_[_0xd299('0x8c')](_0x1b2762,_0x3b6069),_0x2f4f4f));_0x583c03[_0xd299('0x8d')]=getAgentStatus(_0x583c03);return _0x583c03;});})[_0xd299('0x11')](function(_0x4185ed){if(_0x4cf8fb['query']['globalStatusFilter']){var _0x1ea128=_[_0xd299('0x3e')](_0x4185ed,[_0xd299('0x8d'),_0x4cf8fb[_0xd299('0x80')][_0xd299('0x8e')]]);if(_0x4cf8fb[_0xd299('0x80')]['pauseTypeFilter']){_0x1ea128=_[_0xd299('0x3e')](_0x1ea128,[_0xd299('0x60'),_0x4cf8fb[_0xd299('0x80')][_0xd299('0x8f')]]);}}_0x1da15c[_0xd299('0x8b')]=_0x1ea128||_0x4185ed;return _0x1da15c;})[_0xd299('0x11')](respondWithFilteredResult(_0x3a85c0,_0x2aac36))[_0xd299('0x16')](handleError(_0x3a85c0,null));};exports[_0xd299('0x90')]=function(_0x249580,_0x5aa0ce){var _0x53f29f=[_0xd299('0x91'),_0xd299('0x92'),_0xd299('0x93'),_0xd299('0x94'),'fax',_0xd299('0x95'),_0xd299('0x17')];var _0x5ca065={'count':0x0,'rows':[]},_0xb0afc9={},_0x8f4a09,_0x38c873,_0x1de8ea,_0x4861d4,_0x34cde6;Promise['resolve']()[_0xd299('0x11')](function(){if(_0x249580[_0xd299('0x80')]['channel']){if(!_['includes'](_0x53f29f,_0x249580[_0xd299('0x80')]['channel'][_0xd299('0x96')]()))throw new Error(_0xd299('0x97'));_0x8f4a09=_0x249580['query']['channel'][_0xd299('0x96')]();}var _0x27403c=_[_0xd299('0x18')](_0x8f4a09)+_0xd299('0x4a');var _0x25e397=_[_0xd299('0x98')](db[_0x27403c][_0xd299('0x7c')],function(_0xfbefff){return{'name':_0xfbefff[_0xd299('0x7d')],'type':_0xfbefff[_0xd299('0x7e')][_0xd299('0x7f')]};});_0xb0afc9=qs[_0xd299('0x82')](_0x25e397,_0x249580);if(_0x249580['user']['role']===_0xd299('0x84')){var _0x4e4b70={'params':{'id':_0x249580['user']['userProfileId']},'query':{'section':_0x8f4a09===_0xd299('0x17')&&_0x249580[_0xd299('0x80')]['type']==='outbound'?_0xd299('0x99'):_['startCase'](_0x8f4a09)+_0xd299('0x19'),'type':_0x249580[_0xd299('0x80')][_0xd299('0x7e')],'nolimit':!![],'sort':_0xd299('0xd'),'filter':_0x249580[_0xd299('0x80')][_0xd299('0x3e')]}};return db[_0xd299('0x88')][_0xd299('0x89')](_0x4e4b70);}return db[_0x27403c][_0xd299('0x8a')](_0xb0afc9);})[_0xd299('0x11')](function(_0x26043e){_0x5ca065['count']=_0x26043e[_0xd299('0x7')];_0x38c873=_0x26043e[_0xd299('0x8b')];return getRealtimeQueues(_0x249580,_0x8f4a09);})[_0xd299('0x11')](function(_0x54ea7a){_0x4861d4=_0x54ea7a[_0xd299('0x8b')];return getRealtimeAgents();})[_0xd299('0x11')](function(_0x383507){_0x1de8ea=_0x383507[_0xd299('0x8b')];if(_0x8f4a09!=_0xd299('0x17'))return;return getRealtimeVoiceQueueChannels();})[_0xd299('0x11')](function(_0x5d8e29){_0x34cde6=_0x5d8e29?_0x5d8e29['rows']:[];return initializeQueues(_0x38c873,_0x4861d4,_0x8f4a09,_0x249580[_0xd299('0x80')]['type']);})[_0xd299('0x11')](function(_0x525db4){var _0x1f65dc=_0x525db4[_0xd299('0x98')](function(_0x1f516f){if(_0x8f4a09==='voice')return getVoiceQueueAgents(_0x1f516f,_0x38c873,_0x1de8ea,_0x34cde6);else return getQueueAgents(_0x1f516f,_0x1de8ea,_0x8f4a09);});return Promise[_0xd299('0x9a')](_0x1f65dc);})[_0xd299('0x11')](function(_0x2ce6a2){_0x5ca065[_0xd299('0x8b')]=_0x2ce6a2;return _0x5ca065;})[_0xd299('0x11')](respondWithFilteredResult(_0x5aa0ce,_0xb0afc9))['catch'](handleError(_0x5aa0ce,null));}; \ No newline at end of file +var _0x38ac=['loggedInDb','unknown','unavailable','chatPause','faxPause','mailPause','openchannelPause','smsPause','voicePause','whatsappPause','voiceStatus','idle','every','chatStatus','mailStatus','openchannelStatus','smsStatus','whatsappStatus','getAgents','lastLoginAt','lastPauseAt','pauseType','internal','address','openchannelCapacity','smsCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','faxCurrentCapacity','faxStatus','chatStatusTime','openchannelStatusTime','mailStatusTime','whatsappStatusTime','destconnectedlinenum','screenrecording','routealias','resolve','rawAttributes','type','key','query','role','agent','getOptions','raw','user','userProfileId','nolimit','UserProfile','rows','globalStatusFilter','globalStatus','pauseTypeFilter','getQueues','mail','chat','sms','openchannel','whatsapp','includes','channel','toLowerCase','fieldName','QueueCampaigns','getResources','findAndCountAll','all','util','lodash','api','client','http','offset','limit','undefined','count','status','set','Content-Range','json','error','stack','name','Agents','then','request','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','result','merge','catch','voice','startCase','Queues','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','Unable\x20to\x20retrieve\x20voice\x20queues\x20channels','loggedIn','available','waiting','talking','paused','outbound','push','pTalking','originated','message','Trunk','startProgressive','erlangCalls','erlangCallToSecond','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMinThreshold','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','map','get','agents','busy','find','pick','filter','queue','length','some','connectedlinenum','toString','UserId','accountcode','online','User','Queue','Pause','findAll'];(function(_0x136619,_0x31c9b2){var _0x38c4a5=function(_0x10b74d){while(--_0x10b74d){_0x136619['push'](_0x136619['shift']());}};_0x38c4a5(++_0x31c9b2);}(_0x38ac,0x161));var _0xc38a=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x38ac[_0x2641f9];return _0x585741;};'use strict';var util=require(_0xc38a('0x0'));var _=require(_0xc38a('0x1'));var jayson=require('jayson/promise');var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xc38a('0x2'));var db=require('../../mysqldb')['db'];var amiClient=jayson[_0xc38a('0x3')][_0xc38a('0x4')]({'port':0x232a});var routingClient=jayson[_0xc38a('0x3')][_0xc38a('0x4')]({'port':0x232c});function respondWithFilteredResult(_0xaaf2ac,_0x4463d7){return function(_0x232e23){if(_0x232e23){var _0x32354b=typeof _0x4463d7[_0xc38a('0x5')]==='undefined'&&typeof _0x4463d7[_0xc38a('0x6')]===_0xc38a('0x7');var _0x52bbf4=_0x232e23['count'];var _0x3b2d1d=_0x32354b?0x0:_0x4463d7[_0xc38a('0x5')];var _0x52260a=_0x32354b?_0x232e23[_0xc38a('0x8')]:_0x4463d7[_0xc38a('0x5')]+_0x4463d7[_0xc38a('0x6')];var _0x1b829b;if(_0x52260a>=_0x52bbf4){_0x52260a=_0x52bbf4;_0x1b829b=0xc8;}else{_0x1b829b=0xce;}_0xaaf2ac[_0xc38a('0x9')](_0x1b829b);return _0xaaf2ac[_0xc38a('0xa')](_0xc38a('0xb'),_0x3b2d1d+'-'+_0x52260a+'/'+_0x52bbf4)[_0xc38a('0xc')](_0x232e23);}return null;};}function handleError(_0x2cbdc4,_0x434e66){_0x434e66=_0x434e66||0x1f4;return function(_0x5d2e4d){logger[_0xc38a('0xd')](_0x5d2e4d[_0xc38a('0xe')]);if(_0x5d2e4d[_0xc38a('0xf')]){delete _0x5d2e4d[_0xc38a('0xf')];}_0x2cbdc4['status'](_0x434e66)['send'](_0x5d2e4d);};}function getRealtimeAgents(){return new Promise(function(_0x3afbc6,_0x292904){return amiClient['request'](_0xc38a('0x10'),{})[_0xc38a('0x11')](function(_0x1e842a){if(_0x1e842a[_0xc38a('0xd')])throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)');var _0x67e1a0=_0x1e842a['result'];return routingClient[_0xc38a('0x12')](_0xc38a('0x10'),{})[_0xc38a('0x11')](function(_0x1f097d){if(_0x1f097d[_0xc38a('0xd')])throw new Error(_0xc38a('0x13'));var _0xa0f37f=_0x1f097d[_0xc38a('0x14')];return _0x3afbc6(_[_0xc38a('0x15')]({},_0x67e1a0,_0xa0f37f));});})[_0xc38a('0x16')](function(_0xd7ffe4){_0x292904(_0xd7ffe4);});});}function getRealtimeQueues(_0x54870d,_0x570728){return new Promise(function(_0x324d39,_0x5b20d9){var _0x381064=_0x570728===_0xc38a('0x17')?amiClient:routingClient;return _0x381064[_0xc38a('0x12')](_[_0xc38a('0x18')](_0x570728)+_0xc38a('0x19'),_0x54870d)[_0xc38a('0x11')](function(_0x3ce96a){if(_0x3ce96a[_0xc38a('0xd')])throw new Error(util['format'](_0xc38a('0x1a'),_0x570728));return _0x324d39(_0x3ce96a[_0xc38a('0x14')]);})[_0xc38a('0x16')](function(_0x4680a5){_0x5b20d9(_0x4680a5);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x481cb3,_0x3f2756){return amiClient['request']('VoiceQueuesChannels',{})[_0xc38a('0x11')](function(_0x4bac28){if(_0x4bac28[_0xc38a('0xd')])throw new Error(_0xc38a('0x1b'));return _0x481cb3(_0x4bac28[_0xc38a('0x14')]);})[_0xc38a('0x16')](function(_0x142740){_0x3f2756(_0x142740);});});}function initializeQueues(_0x2b21d0,_0xab9642,_0x421d7b,_0x1418d8){var _0x339e76=[_0xc38a('0x1c'),_0xc38a('0x1d'),_0xc38a('0x1e'),_0xc38a('0x1f'),_0xc38a('0x20')];if(_0x421d7b===_0xc38a('0x17')&&_0x1418d8===_0xc38a('0x21')){_0x339e76[_0xc38a('0x22')](_0xc38a('0x23'),_0xc38a('0x24'),_0xc38a('0x25'),'dialActive','dialMethod',_0xc38a('0x26'),'startPredictive',_0xc38a('0x27'),_0xc38a('0x28'),_0xc38a('0x29'),'erlangAbandonmentRate',_0xc38a('0x2a'),_0xc38a('0x2b'),'dialPredictiveIntervalMaxThreshold',_0xc38a('0x2c'),'predictiveIntervalAvailable',_0xc38a('0x2d'),_0xc38a('0x2e'),_0xc38a('0x2f'),_0xc38a('0x30'),_0xc38a('0x31'),_0xc38a('0x32'));}return _0x2b21d0[_0xc38a('0x33')](function(_0x2d8a40){var _0x2d6d2d=_0x2d8a40[_0xc38a('0x34')]({'plain':!![]});_0x2d6d2d[_0xc38a('0x35')]=[];_0x2d6d2d['paused']=0x0;_0x2d6d2d['loggedInDb']=0x0;_0x2d6d2d[_0xc38a('0x1c')]=0x0;_0x2d6d2d['available']=0x0;_0x2d6d2d[_0xc38a('0x1e')]=0x0;if(_0x421d7b===_0xc38a('0x17')){_0x2d6d2d[_0xc38a('0x1f')]=0x0;_0x2d6d2d[_0xc38a('0x36')]=0x0;if(_0x1418d8==='outbound'){_0x2d6d2d[_0xc38a('0x23')]=0x0;_0x2d6d2d['originated']=0x0;}}var _0x1103c0=_[_0xc38a('0x37')](_0xab9642,['id',_0x2d6d2d['id']]);if(_0x1103c0)_['merge'](_0x2d6d2d,_[_0xc38a('0x38')](_0x1103c0,_0x339e76));return _0x2d6d2d;});}function updateAgentVoiceStatus(_0x1ba9db,_0x7ea62b,_0x42888a){var _0x20cb77=_[_0xc38a('0x39')](_0x42888a,[_0xc38a('0x3a'),_0x7ea62b['name']]);if(_0x20cb77[_0xc38a('0x3b')]===0x0)return _0x1ba9db[_0xc38a('0x36')]=!![];if(_[_0xc38a('0x3c')](_0x20cb77,[_0xc38a('0x3d'),_0x1ba9db['internal'][_0xc38a('0x3e')]()]))return _0x1ba9db[_0xc38a('0x1f')]=!![];if(!_0x1ba9db[_0xc38a('0x1f')])return _0x1ba9db[_0xc38a('0x36')]=!![];}function getVoiceQueueAgents(_0xe7c9ce,_0x3d65f3,_0x12da28,_0x497d27){var _0x56e562=_[_0xc38a('0x37')](_0x3d65f3,['id',_0xe7c9ce['id']]);if(!_0x56e562)return _0xe7c9ce;return _0x56e562['getMembers']({'raw':!![]})['then'](function(_0x3ca05f){for(var _0x1a9d69=0x0;_0x1a9d69<_0x3ca05f['length'];_0x1a9d69++){var _0x2d4999=_[_0xc38a('0x37')](_0x12da28,['id',_0x3ca05f[_0x1a9d69]['UserId']]);if(!_0x2d4999){_0x2d4999={'id':_0x3ca05f[_0x1a9d69][_0xc38a('0x3f')],'name':_0x3ca05f[_0x1a9d69]['UserId'],'accountcode':'','online':![]};}var _0x58aa9a={'id':_0x2d4999['id'],'name':_0x2d4999['name'],'internal':_0x2d4999[_0xc38a('0x40')],'online':Boolean(_0x2d4999[_0xc38a('0x41')]),'paused':Boolean(_0x3ca05f[_0x1a9d69][_0xc38a('0x20')])};if(_0x2d4999['voiceStatus']===_0xc38a('0x1f'))updateAgentVoiceStatus(_0x58aa9a,_0xe7c9ce,_0x497d27);if(_0x58aa9a[_0xc38a('0x41')])_0xe7c9ce['loggedInDb']++;if(_0x58aa9a[_0xc38a('0x36')])_0xe7c9ce['busy']++;if(_0x58aa9a[_0xc38a('0x20')]&&!_0x58aa9a[_0xc38a('0x36')]&&!_0x58aa9a[_0xc38a('0x1f')])_0xe7c9ce[_0xc38a('0x20')]++;_0xe7c9ce[_0xc38a('0x35')][_0xc38a('0x22')](_0x58aa9a);}return _0xe7c9ce;});}function getQueueAgents(_0x5a4151,_0x53e06a,_0x3ed78e){var _0x5b1f16=_0xc38a('0x42')+_[_0xc38a('0x18')](_0x3ed78e)+_0xc38a('0x43');var _0x5f16a0=_0x3ed78e+_0xc38a('0x44');return db[_0x5b1f16][_0xc38a('0x45')]({'where':{[_[_0xc38a('0x18')](_0x3ed78e)+'QueueId']:_0x5a4151['id']},'raw':!![]})[_0xc38a('0x11')](function(_0x5691eb){for(var _0x2f5a0a=0x0;_0x2f5a0a<_0x5691eb[_0xc38a('0x3b')];_0x2f5a0a++){var _0x523dd0=_[_0xc38a('0x37')](_0x53e06a,['id',_0x5691eb[_0x2f5a0a][_0xc38a('0x3f')]]);if(!_0x523dd0){_0x523dd0={'id':_0x5691eb[_0x2f5a0a][_0xc38a('0x3f')],'name':_0x5691eb[_0x2f5a0a]['UserId'],'online':![],['pauseField']:![]};}var _0x14bfac={'id':_0x523dd0['id'],'name':_0x523dd0[_0xc38a('0xf')],'online':Boolean(_0x523dd0[_0xc38a('0x41')]),'paused':Boolean(_0x523dd0[_0x5f16a0])};if(_0x14bfac[_0xc38a('0x41')])_0x5a4151[_0xc38a('0x46')]++;_0x5a4151['agents']['push'](_0x14bfac);}return _0x5a4151;});}function isIdle(_0x5f32f7){return _0x5f32f7==='idle'||_0x5f32f7===_0xc38a('0x47')||_0x5f32f7===_0xc38a('0x48')||_0x5f32f7==='ringing'||_['isNil'](_0x5f32f7);}function isAgentPaused(_0x1bb027,_0x51f71e){var _0x3dea0d=[_0x1bb027[_0xc38a('0x49')],_0x1bb027[_0xc38a('0x4a')],_0x1bb027[_0xc38a('0x4b')],_0x1bb027[_0xc38a('0x4c')],_0x1bb027[_0xc38a('0x4d')],_0x1bb027[_0xc38a('0x4e')],_0x1bb027[_0xc38a('0x4f')]];if(!_0x51f71e)return _['every'](_0x3dea0d);var _0x4eb089=_[_0xc38a('0x39')](_0x3dea0d);return _0x4eb089[_0xc38a('0x3b')]>0x0&&_0x4eb089[_0xc38a('0x3b')]<_0x3dea0d[_0xc38a('0x3b')]?!![]:![];}function isAgentIdle(_0x29cd40){if(_0x29cd40[_0xc38a('0x50')]!==_0xc38a('0x51')&&_0x29cd40[_0xc38a('0x4e')]){_0x29cd40[_0xc38a('0x50')]='pause';return![];}return _[_0xc38a('0x52')]([_0x29cd40[_0xc38a('0x53')],_0x29cd40['faxStatus'],_0x29cd40[_0xc38a('0x54')],_0x29cd40[_0xc38a('0x55')],_0x29cd40[_0xc38a('0x56')],_0x29cd40['voiceStatus'],_0x29cd40[_0xc38a('0x57')]],isIdle);}function getAgentStatus(_0x238c47){var _0x265e37=_0xc38a('0x47');if(isAgentPaused(_0x238c47))_0x265e37='pause';else if(isAgentPaused(_0x238c47,!![]))_0x265e37='*pause';else if(isAgentIdle(_0x238c47))_0x265e37=_0xc38a('0x51');else _0x265e37='busy';return _0x265e37;}exports[_0xc38a('0x58')]=function(_0x2f7220,_0x2bf57b){var _0x2f5f6d={'count':0x0,'rows':[]},_0x262807={},_0x8e13de,_0x2b5cad,_0x667500=['userpic',_0xc38a('0x41'),_0xc38a('0x59'),_0xc38a('0x5a'),_0xc38a('0x5b'),_0xc38a('0x5a'),_0xc38a('0x5c'),_0xc38a('0x5d'),_0xc38a('0x49'),'openchannelPause',_0xc38a('0x4b'),_0xc38a('0x4d'),'whatsappPause','faxPause',_0xc38a('0x4e'),'chatCapacity',_0xc38a('0x5e'),'mailCapacity',_0xc38a('0x5f'),'whatsappCapacity',_0xc38a('0x60'),_0xc38a('0x61'),_0xc38a('0x62'),_0xc38a('0x63'),_0xc38a('0x64'),'whatsappCurrentCapacity',_0xc38a('0x65'),_0xc38a('0x53'),'openchannelStatus','mailStatus',_0xc38a('0x56'),_0xc38a('0x57'),_0xc38a('0x66'),_0xc38a('0x50'),_0xc38a('0x67'),_0xc38a('0x68'),_0xc38a('0x69'),'smsStatusTime',_0xc38a('0x6a'),'faxStatusTime','voiceStatusTime',_0xc38a('0x3a'),_0xc38a('0x6b'),_0xc38a('0x6c'),'phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording',_0xc38a('0x6d')],_0x44f556=[_0xc38a('0x49'),'openchannelPause',_0xc38a('0x4b'),_0xc38a('0x4d'),_0xc38a('0x4f'),_0xc38a('0x4a'),_0xc38a('0x4e'),'online'];Promise[_0xc38a('0x6e')]()[_0xc38a('0x11')](function(){var _0x4aaa7c=_[_0xc38a('0x33')](db['User'][_0xc38a('0x6f')],function(_0xf77c97){return{'name':_0xf77c97['fieldName'],'type':_0xf77c97[_0xc38a('0x70')][_0xc38a('0x71')]};});_0x2f7220[_0xc38a('0x72')][_0xc38a('0x73')]=_0xc38a('0x74');_0x2f7220['query']['online']=!![];_0x262807=qs[_0xc38a('0x75')](_0x4aaa7c,_0x2f7220);_0x262807[_0xc38a('0x76')]=!![];if(_0x2f7220[_0xc38a('0x77')][_0xc38a('0x73')]===_0xc38a('0x77')){var _0x381cf9={'params':{'id':_0x2f7220[_0xc38a('0x77')][_0xc38a('0x78')]},'query':{'section':'Agents','role':'agent','online':!![],'nolimit':_0x2f7220[_0xc38a('0x72')][_0xc38a('0x79')],'sort':_0x2f7220['query']['sort'],'filter':_0x2f7220['query'][_0xc38a('0x39')]},'raw':!![]};return db[_0xc38a('0x7a')]['getResources'](_0x381cf9);}return db[_0xc38a('0x42')]['findAndCountAll'](_0x262807);})[_0xc38a('0x11')](function(_0xbaeebd){_0x2f5f6d[_0xc38a('0x8')]=_0xbaeebd[_0xc38a('0x8')];_0x8e13de=_0xbaeebd[_0xc38a('0x7b')];return getRealtimeAgents();})['then'](function(_0x2b7931){_0x2b5cad=_0x2b7931[_0xc38a('0x7b')];return _0x8e13de[_0xc38a('0x33')](function(_0x50f055){var _0x301d13=_[_0xc38a('0x37')](_0x2b5cad,['id',_0x50f055['id']]);if(_0x301d13)_[_0xc38a('0x15')](_0x50f055,_[_0xc38a('0x38')](_['omit'](_0x301d13,_0x44f556),_0x667500));_0x50f055['globalStatus']=getAgentStatus(_0x50f055);return _0x50f055;});})[_0xc38a('0x11')](function(_0x514182){if(_0x2f7220[_0xc38a('0x72')][_0xc38a('0x7c')]){var _0x4fdd32=_[_0xc38a('0x39')](_0x514182,[_0xc38a('0x7d'),_0x2f7220[_0xc38a('0x72')]['globalStatusFilter']]);if(_0x2f7220['query'][_0xc38a('0x7e')]){_0x4fdd32=_['filter'](_0x4fdd32,[_0xc38a('0x5b'),_0x2f7220[_0xc38a('0x72')][_0xc38a('0x7e')]]);}}_0x2f5f6d[_0xc38a('0x7b')]=_0x4fdd32||_0x514182;return _0x2f5f6d;})[_0xc38a('0x11')](respondWithFilteredResult(_0x2bf57b,_0x262807))[_0xc38a('0x16')](handleError(_0x2bf57b,null));};exports[_0xc38a('0x7f')]=function(_0xdbfe67,_0x1eae70){var _0x4d6cae=[_0xc38a('0x80'),_0xc38a('0x81'),_0xc38a('0x82'),_0xc38a('0x83'),'fax',_0xc38a('0x84'),_0xc38a('0x17')];var _0x4578f6={'count':0x0,'rows':[]},_0x2783a4={},_0x4ba901,_0xed4a3d,_0x66cae7,_0x40f25f,_0x25628c;Promise[_0xc38a('0x6e')]()['then'](function(){if(_0xdbfe67[_0xc38a('0x72')]['channel']){if(!_[_0xc38a('0x85')](_0x4d6cae,_0xdbfe67['query'][_0xc38a('0x86')]['toLowerCase']()))throw new Error('Invalid\x20channel');_0x4ba901=_0xdbfe67[_0xc38a('0x72')][_0xc38a('0x86')][_0xc38a('0x87')]();}var _0x5dfa99=_[_0xc38a('0x18')](_0x4ba901)+_0xc38a('0x43');var _0x42f45c=_[_0xc38a('0x33')](db[_0x5dfa99]['rawAttributes'],function(_0x4e03fb){return{'name':_0x4e03fb[_0xc38a('0x88')],'type':_0x4e03fb[_0xc38a('0x70')][_0xc38a('0x71')]};});_0x2783a4=qs[_0xc38a('0x75')](_0x42f45c,_0xdbfe67);if(_0xdbfe67[_0xc38a('0x77')][_0xc38a('0x73')]===_0xc38a('0x77')){var _0x2c7c51={'params':{'id':_0xdbfe67['user'][_0xc38a('0x78')]},'query':{'section':_0x4ba901===_0xc38a('0x17')&&_0xdbfe67[_0xc38a('0x72')][_0xc38a('0x70')]===_0xc38a('0x21')?_0xc38a('0x89'):_['startCase'](_0x4ba901)+_0xc38a('0x19'),'type':_0xdbfe67['query'][_0xc38a('0x70')],'nolimit':!![],'sort':_0xc38a('0xf'),'filter':_0xdbfe67[_0xc38a('0x72')]['filter']}};return db['UserProfile'][_0xc38a('0x8a')](_0x2c7c51);}return db[_0x5dfa99][_0xc38a('0x8b')](_0x2783a4);})[_0xc38a('0x11')](function(_0xc96080){_0x4578f6[_0xc38a('0x8')]=_0xc96080[_0xc38a('0x8')];_0xed4a3d=_0xc96080[_0xc38a('0x7b')];return getRealtimeQueues(_0xdbfe67,_0x4ba901);})[_0xc38a('0x11')](function(_0x36220c){_0x40f25f=_0x36220c[_0xc38a('0x7b')];return getRealtimeAgents();})[_0xc38a('0x11')](function(_0x1c3cb3){_0x66cae7=_0x1c3cb3[_0xc38a('0x7b')];if(_0x4ba901!='voice')return;return getRealtimeVoiceQueueChannels();})[_0xc38a('0x11')](function(_0x15f204){_0x25628c=_0x15f204?_0x15f204[_0xc38a('0x7b')]:[];return initializeQueues(_0xed4a3d,_0x40f25f,_0x4ba901,_0xdbfe67[_0xc38a('0x72')][_0xc38a('0x70')]);})['then'](function(_0x372f01){var _0x47d1d6=_0x372f01['map'](function(_0x31ab1a){if(_0x4ba901===_0xc38a('0x17'))return getVoiceQueueAgents(_0x31ab1a,_0xed4a3d,_0x66cae7,_0x25628c);else return getQueueAgents(_0x31ab1a,_0x66cae7,_0x4ba901);});return Promise[_0xc38a('0x8c')](_0x47d1d6);})['then'](function(_0x4328a7){_0x4578f6['rows']=_0x4328a7;return _0x4578f6;})['then'](respondWithFilteredResult(_0x1eae70,_0x2783a4))[_0xc38a('0x16')](handleError(_0x1eae70,null));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index fe9c26e..baa8aba 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(_0x4d150a,_0x25f904){var _0x885bd4=function(_0x552a7d){while(--_0x552a7d){_0x4d150a['push'](_0x4d150a['shift']());}};_0x885bd4(++_0x25f904);}(_0xa9e0,0x123));var _0x0a9e=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xa9e0[_0x220dbb];return _0x2b77de;};'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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x23c9b4,_0x5a2935){var _0xf441b6=function(_0x2e1adb){while(--_0x2e1adb){_0x23c9b4['push'](_0x23c9b4['shift']());}};_0xf441b6(++_0x5a2935);}(_0xe706,0xa3));var _0x6e70=function(_0x1f1bf8,_0x48c57d){_0x1f1bf8=_0x1f1bf8-0x0;var _0xcefd99=_0xe706[_0x1f1bf8];return _0xcefd99;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index e84137f..dc9d775 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 _0x3c94=['sequelize','exports','INTEGER','STRING','DATE'];(function(_0x596234,_0x19d3f0){var _0x247b5f=function(_0x5b8ae7){while(--_0x5b8ae7){_0x596234['push'](_0x596234['shift']());}};_0x247b5f(++_0x19d3f0);}(_0x3c94,0xcd));var _0x43c9=function(_0x1f5d35,_0x13db91){_0x1f5d35=_0x1f5d35-0x0;var _0x27355a=_0x3c94[_0x1f5d35];return _0x27355a;};'use strict';var Sequelize=require(_0x43c9('0x0'));module[_0x43c9('0x1')]={'state':{'type':Sequelize[_0x43c9('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x43c9('0x3')]},'scheduledat':{'type':Sequelize[_0x43c9('0x4')]},'uniqueid':{'type':Sequelize[_0x43c9('0x3')]},'starttime':{'type':Sequelize[_0x43c9('0x4')]},'responsetime':{'type':Sequelize[_0x43c9('0x4')]},'ringtime':{'type':Sequelize[_0x43c9('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x43c9('0x3')]},'campaigntype':{'type':Sequelize[_0x43c9('0x3')]},'membername':{'type':Sequelize[_0x43c9('0x3')]}}; \ No newline at end of file +var _0xe4d9=['STRING','sequelize','exports','INTEGER','DATE'];(function(_0xf4356f,_0x478f6d){var _0x3c304c=function(_0x1a08dc){while(--_0x1a08dc){_0xf4356f['push'](_0xf4356f['shift']());}};_0x3c304c(++_0x478f6d);}(_0xe4d9,0x141));var _0x9e4d=function(_0x52b577,_0x102394){_0x52b577=_0x52b577-0x0;var _0x59e606=_0xe4d9[_0x52b577];return _0x59e606;};'use strict';var Sequelize=require(_0x9e4d('0x0'));module[_0x9e4d('0x1')]={'state':{'type':Sequelize[_0x9e4d('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x9e4d('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x9e4d('0x3')]},'ringtime':{'type':Sequelize[_0x9e4d('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x9e4d('0x4')]},'membername':{'type':Sequelize[_0x9e4d('0x4')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 9e61ec4..94303b8 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 _0xaee4=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./reportAgentPreview.attributes','exports','define','ReportAgentPreview','report_agent_preview'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaee4,0x1ad));var _0x4aee=function(_0x306cbf,_0x5dbf2b){_0x306cbf=_0x306cbf-0x0;var _0x3e62=_0xaee4[_0x306cbf];return _0x3e62;};'use strict';var _=require('lodash');var util=require(_0x4aee('0x0'));var logger=require(_0x4aee('0x1'))(_0x4aee('0x2'));var moment=require(_0x4aee('0x3'));var BPromise=require(_0x4aee('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4aee('0x5'));var rimraf=require(_0x4aee('0x6'));var config=require(_0x4aee('0x7'));var attributes=require(_0x4aee('0x8'));module[_0x4aee('0x9')]=function(_0x256d6c,_0x230c8e){return _0x256d6c[_0x4aee('0xa')](_0x4aee('0xb'),attributes,{'tableName':_0x4aee('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x85f5=['report_agent_preview','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./reportAgentPreview.attributes','exports','define','ReportAgentPreview'];(function(_0x3ed64c,_0x4272c6){var _0x411370=function(_0x197079){while(--_0x197079){_0x3ed64c['push'](_0x3ed64c['shift']());}};_0x411370(++_0x4272c6);}(_0x85f5,0x1a1));var _0x585f=function(_0x2f8805,_0x2f1d21){_0x2f8805=_0x2f8805-0x0;var _0xa16375=_0x85f5[_0x2f8805];return _0xa16375;};'use strict';var _=require(_0x585f('0x0'));var util=require(_0x585f('0x1'));var logger=require(_0x585f('0x2'))(_0x585f('0x3'));var moment=require(_0x585f('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x585f('0x5'));var rimraf=require(_0x585f('0x6'));var config=require(_0x585f('0x7'));var attributes=require(_0x585f('0x8'));module[_0x585f('0x9')]=function(_0xce9373,_0xccb446){return _0xce9373[_0x585f('0xa')](_0x585f('0xb'),attributes,{'tableName':_0x585f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.rpc.js b/server/api/reportAgentPreview/reportAgentPreview.rpc.js index 19d8f2e..c5f7d8a 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 _0x2b29=['options','raw','info','CreateReportAgentPreview','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ReportAgentPreview','create','body'];(function(_0x3353a8,_0x185497){var _0x32c9b8=function(_0x1b377b){while(--_0x1b377b){_0x3353a8['push'](_0x3353a8['shift']());}};_0x32c9b8(++_0x185497);}(_0x2b29,0x160));var _0x92b2=function(_0x539665,_0x4f631d){_0x539665=_0x539665-0x0;var _0x522bdf=_0x2b29[_0x539665];return _0x522bdf;};'use strict';var _=require(_0x92b2('0x0'));var util=require(_0x92b2('0x1'));var moment=require('moment');var BPromise=require(_0x92b2('0x2'));var rs=require(_0x92b2('0x3'));var fs=require('fs');var Redis=require(_0x92b2('0x4'));var db=require(_0x92b2('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x92b2('0x6'))(_0x92b2('0x7'));var config=require(_0x92b2('0x8'));var jayson=require(_0x92b2('0x9'));var client=jayson['client'][_0x92b2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2b93be,_0x4fd42f,_0x5ba3e8){return new BPromise(function(_0x551275,_0x17da0d){return client[_0x92b2('0xb')](_0x2b93be,_0x5ba3e8)['then'](function(_0x468ada){logger['info'](_0x92b2('0xc'),_0x4fd42f,_0x92b2('0xd'));logger[_0x92b2('0xe')](_0x92b2('0xf'),_0x4fd42f,'request\x20sent',JSON[_0x92b2('0x10')](_0x468ada));if(_0x468ada[_0x92b2('0x11')]){if(_0x468ada['error'][_0x92b2('0x12')]===0x1f4){logger[_0x92b2('0x11')](_0x92b2('0xc'),_0x4fd42f,_0x468ada['error'][_0x92b2('0x13')]);return _0x17da0d(_0x468ada['error'][_0x92b2('0x13')]);}logger[_0x92b2('0x11')](_0x92b2('0xc'),_0x4fd42f,_0x468ada[_0x92b2('0x11')][_0x92b2('0x13')]);return _0x551275(_0x468ada[_0x92b2('0x11')][_0x92b2('0x13')]);}else{logger['info']('ReportAgentPreview,\x20%s,\x20%s',_0x4fd42f,'request\x20sent');_0x551275(_0x468ada[_0x92b2('0x14')]['message']);}})[_0x92b2('0x15')](function(_0x250730){logger[_0x92b2('0x11')](_0x92b2('0xc'),_0x4fd42f,_0x250730);_0x17da0d(_0x250730);});});}exports['CreateReportAgentPreview']=function(_0x58f535){var _0xc3dfe9=this;return new Promise(function(_0x5bbb4c,_0x535136){return db[_0x92b2('0x16')][_0x92b2('0x17')](_0x58f535[_0x92b2('0x18')],{'raw':_0x58f535[_0x92b2('0x19')]?_0x58f535[_0x92b2('0x19')][_0x92b2('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0xbe1b78){logger[_0x92b2('0x1b')](_0x92b2('0x1c'),_0x58f535);logger[_0x92b2('0xe')](_0x92b2('0x1c'),_0x58f535,JSON[_0x92b2('0x10')](_0xbe1b78));_0x5bbb4c(_0xbe1b78);})['catch'](function(_0x42f765){logger['error'](_0x92b2('0x1c'),_0x42f765[_0x92b2('0x13')],_0x58f535);_0x535136(_0xc3dfe9[_0x92b2('0x11')](0x1f4,_0x42f765['message']));});});}; \ No newline at end of file +var _0xa183=['catch','CreateReportAgentPreview','create','body','options','raw','then','stringify','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','error','code','message','info','result'];(function(_0x9f8471,_0x79e91d){var _0x3a522d=function(_0x11f9c2){while(--_0x11f9c2){_0x9f8471['push'](_0x9f8471['shift']());}};_0x3a522d(++_0x79e91d);}(_0xa183,0x7c));var _0x3a18=function(_0x206d52,_0x2585b3){_0x206d52=_0x206d52-0x0;var _0x1f2681=_0xa183[_0x206d52];return _0x1f2681;};'use strict';var _=require(_0x3a18('0x0'));var util=require('util');var moment=require(_0x3a18('0x1'));var BPromise=require(_0x3a18('0x2'));var rs=require(_0x3a18('0x3'));var fs=require('fs');var Redis=require(_0x3a18('0x4'));var db=require(_0x3a18('0x5'))['db'];var utils=require(_0x3a18('0x6'));var logger=require(_0x3a18('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3a18('0x8'));var client=jayson[_0x3a18('0x9')][_0x3a18('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2c4bb1,_0x2fe5d3,_0x4632d0){return new BPromise(function(_0x2f5dad,_0x288465){return client[_0x3a18('0xb')](_0x2c4bb1,_0x4632d0)['then'](function(_0x1deebd){logger['info'](_0x3a18('0xc'),_0x2fe5d3,_0x3a18('0xd'));logger[_0x3a18('0xe')](_0x3a18('0xf'),_0x2fe5d3,_0x3a18('0xd'),JSON['stringify'](_0x1deebd));if(_0x1deebd[_0x3a18('0x10')]){if(_0x1deebd[_0x3a18('0x10')][_0x3a18('0x11')]===0x1f4){logger[_0x3a18('0x10')](_0x3a18('0xc'),_0x2fe5d3,_0x1deebd[_0x3a18('0x10')][_0x3a18('0x12')]);return _0x288465(_0x1deebd[_0x3a18('0x10')][_0x3a18('0x12')]);}logger[_0x3a18('0x10')]('ReportAgentPreview,\x20%s,\x20%s',_0x2fe5d3,_0x1deebd[_0x3a18('0x10')][_0x3a18('0x12')]);return _0x2f5dad(_0x1deebd['error'][_0x3a18('0x12')]);}else{logger[_0x3a18('0x13')](_0x3a18('0xc'),_0x2fe5d3,_0x3a18('0xd'));_0x2f5dad(_0x1deebd[_0x3a18('0x14')][_0x3a18('0x12')]);}})[_0x3a18('0x15')](function(_0xfb2cd4){logger[_0x3a18('0x10')]('ReportAgentPreview,\x20%s,\x20%s',_0x2fe5d3,_0xfb2cd4);_0x288465(_0xfb2cd4);});});}exports[_0x3a18('0x16')]=function(_0x4b3e15){var _0x211e0b=this;return new Promise(function(_0x1d02f9,_0xb29272){return db['ReportAgentPreview'][_0x3a18('0x17')](_0x4b3e15[_0x3a18('0x18')],{'raw':_0x4b3e15[_0x3a18('0x19')]?_0x4b3e15[_0x3a18('0x19')][_0x3a18('0x1a')]===undefined?!![]:![]:!![]})[_0x3a18('0x1b')](function(_0xfa21e6){logger[_0x3a18('0x13')](_0x3a18('0x16'),_0x4b3e15);logger['debug'](_0x3a18('0x16'),_0x4b3e15,JSON[_0x3a18('0x1c')](_0xfa21e6));_0x1d02f9(_0xfa21e6);})['catch'](function(_0x4bac72){logger[_0x3a18('0x10')](_0x3a18('0x16'),_0x4bac72[_0x3a18('0x12')],_0x4b3e15);_0xb29272(_0x211e0b[_0x3a18('0x10')](0x1f4,_0x4bac72['message']));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index f943d27..66f8739 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 _0xd05a=['path','get','/voice/channels','isAuthenticated','voiceChannels','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','voiceQueuesChannelHangup','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','/outbound','outbound','/outbound/channels','/agents','agents','/agents/:id/capacity','/telephones','telephones','trunks','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','showSmsQueues','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','util'];(function(_0x460f81,_0x553431){var _0x423f0d=function(_0x267a6b){while(--_0x267a6b){_0x460f81['push'](_0x460f81['shift']());}};_0x423f0d(++_0x553431);}(_0xd05a,0x143));var _0xad05=function(_0x2ec72f,_0x30ec10){_0x2ec72f=_0x2ec72f-0x0;var _0x365c2a=_0xd05a[_0x2ec72f];return _0x365c2a;};'use strict';var multer=require('multer');var util=require(_0xad05('0x0'));var path=require(_0xad05('0x1'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var controller=require('./rpc.controller');router[_0xad05('0x2')](_0xad05('0x3'),auth[_0xad05('0x4')](),controller[_0xad05('0x5')]);router[_0xad05('0x2')]('/voice/channels/:uniqueid/mixmonitor',auth['isAuthenticated'](),controller[_0xad05('0x6')]);router[_0xad05('0x2')](_0xad05('0x7'),auth['isAuthenticated'](),controller[_0xad05('0x8')]);router[_0xad05('0x2')](_0xad05('0x9'),auth['isAuthenticated'](),controller['voiceQueues']);router[_0xad05('0x2')]('/chat/queues',auth[_0xad05('0x4')](),controller[_0xad05('0xa')]);router[_0xad05('0x2')](_0xad05('0xb'),auth[_0xad05('0x4')](),controller[_0xad05('0xc')]);router[_0xad05('0x2')](_0xad05('0xd'),auth[_0xad05('0x4')](),controller[_0xad05('0xe')]);router['get'](_0xad05('0xf'),auth['isAuthenticated'](),controller[_0xad05('0x10')]);router['get'](_0xad05('0x11'),auth[_0xad05('0x4')](),controller[_0xad05('0x12')]);router['get'](_0xad05('0x13'),auth['isAuthenticated'](),controller[_0xad05('0x14')]);router[_0xad05('0x2')](_0xad05('0x15'),auth[_0xad05('0x4')](),controller[_0xad05('0x16')]);router[_0xad05('0x2')]('/voice/queues/preview/:id',auth[_0xad05('0x4')](),controller[_0xad05('0x17')]);router[_0xad05('0x2')](_0xad05('0x18'),auth[_0xad05('0x4')](),controller[_0xad05('0x19')]);router[_0xad05('0x2')](_0xad05('0x1a'),auth[_0xad05('0x4')](),controller[_0xad05('0x1b')]);router[_0xad05('0x2')]('/voice/queues/channels/:uniqueid/hangup',auth[_0xad05('0x4')](),controller[_0xad05('0x1c')]);router[_0xad05('0x2')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth[_0xad05('0x4')](),controller['voiceQueuesChannelRedirect']);router[_0xad05('0x2')](_0xad05('0x1d'),auth[_0xad05('0x4')](),controller[_0xad05('0x1e')]);router[_0xad05('0x1f')](_0xad05('0x1d'),auth[_0xad05('0x4')](),controller[_0xad05('0x20')]);router[_0xad05('0x2')](_0xad05('0x21'),auth['isAuthenticated'](),controller[_0xad05('0x22')]);router[_0xad05('0x2')](_0xad05('0x23'),auth[_0xad05('0x4')](),controller['outboundChannels']);router[_0xad05('0x2')](_0xad05('0x24'),auth[_0xad05('0x4')](),controller[_0xad05('0x25')]);router[_0xad05('0x1f')](_0xad05('0x26'),auth[_0xad05('0x4')](),controller['agentCapacity']);router['get'](_0xad05('0x27'),auth[_0xad05('0x4')](),controller[_0xad05('0x28')]);router['get']('/trunks',auth[_0xad05('0x4')](),controller[_0xad05('0x29')]);router[_0xad05('0x2')]('/campaigns',auth[_0xad05('0x4')](),controller[_0xad05('0x2a')]);router['get'](_0xad05('0x2b'),auth[_0xad05('0x4')](),controller[_0xad05('0x2c')]);router[_0xad05('0x2')](_0xad05('0x2d'),auth[_0xad05('0x4')](),controller[_0xad05('0x2e')]);router['get'](_0xad05('0x2f'),auth[_0xad05('0x4')](),controller['mailQueuesWaitingInteractions']);router[_0xad05('0x2')](_0xad05('0x30'),auth['isAuthenticated'](),controller[_0xad05('0x31')]);router[_0xad05('0x2')](_0xad05('0x32'),auth[_0xad05('0x4')](),controller[_0xad05('0x33')]);router[_0xad05('0x2')](_0xad05('0x34'),auth[_0xad05('0x4')](),controller[_0xad05('0x35')]);router[_0xad05('0x2')](_0xad05('0x36'),auth['isAuthenticated'](),controller['whatsappQueuesWaitingInteractions']);router['get']('/fax/queues/waitinginteractions',auth[_0xad05('0x4')](),controller[_0xad05('0x37')]);router[_0xad05('0x38')](_0xad05('0x39'),auth['isAuthenticated'](),controller[_0xad05('0x3a')](_0xad05('0x3b')));router[_0xad05('0x2')](_0xad05('0x3c'),auth['isAuthenticated'](),controller[_0xad05('0x3d')]);router['post'](_0xad05('0x3e'),auth[_0xad05('0x4')](),controller[_0xad05('0x3a')]('chat'));router[_0xad05('0x2')](_0xad05('0x3f'),auth[_0xad05('0x4')](),controller[_0xad05('0x40')]);router[_0xad05('0x38')](_0xad05('0x41'),auth[_0xad05('0x4')](),controller[_0xad05('0x3a')]('fax'));router[_0xad05('0x2')](_0xad05('0x42'),auth[_0xad05('0x4')](),controller[_0xad05('0x43')]);router[_0xad05('0x38')](_0xad05('0x44'),auth[_0xad05('0x4')](),controller[_0xad05('0x3a')](_0xad05('0x45')));router['get'](_0xad05('0x46'),auth[_0xad05('0x4')](),controller[_0xad05('0x47')]);router[_0xad05('0x38')](_0xad05('0x48'),auth[_0xad05('0x4')](),controller[_0xad05('0x3a')](_0xad05('0x49')));router['post'](_0xad05('0x4a'),auth[_0xad05('0x4')](),controller['queueNotify'](_0xad05('0x4b')));router[_0xad05('0x2')]('/sms/queues/:id',auth[_0xad05('0x4')](),controller[_0xad05('0x4c')]);router[_0xad05('0x2')]('/whatsapp/queues/:id',auth[_0xad05('0x4')](),controller[_0xad05('0x4d')]);router[_0xad05('0x38')](_0xad05('0x4e'),auth['isAuthenticated'](),controller[_0xad05('0x4f')]);module[_0xad05('0x50')]=router; \ No newline at end of file +var _0x1e36=['openchannelQueues','/sms/queues','whatsappQueues','/fax/queues','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','outbound','outboundChannels','/agents','/agents/:id/capacity','agentCapacity','/telephones','telephones','trunks','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','fax','/fax/queues/:id','openchannel','/openchannel/queues/:id','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','multer','path','express','../../components/auth/service','/voice/channels','isAuthenticated','voiceChannels','get','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','chatQueues','/mail/queues','mailQueues','mailAccounts','/openchannel/queues'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1e36,0x1c2));var _0x61e3=function(_0x19115e,_0x507bab){_0x19115e=_0x19115e-0x0;var _0x45bbd4=_0x1e36[_0x19115e];return _0x45bbd4;};'use strict';var multer=require(_0x61e3('0x0'));var util=require('util');var path=require(_0x61e3('0x1'));var express=require(_0x61e3('0x2'));var router=express['Router']();var auth=require(_0x61e3('0x3'));var controller=require('./rpc.controller');router['get'](_0x61e3('0x4'),auth[_0x61e3('0x5')](),controller[_0x61e3('0x6')]);router[_0x61e3('0x7')]('/voice/channels/:uniqueid/mixmonitor',auth['isAuthenticated'](),controller[_0x61e3('0x8')]);router[_0x61e3('0x7')](_0x61e3('0x9'),auth[_0x61e3('0x5')](),controller[_0x61e3('0xa')]);router[_0x61e3('0x7')](_0x61e3('0xb'),auth[_0x61e3('0x5')](),controller[_0x61e3('0xc')]);router[_0x61e3('0x7')]('/chat/queues',auth[_0x61e3('0x5')](),controller[_0x61e3('0xd')]);router[_0x61e3('0x7')](_0x61e3('0xe'),auth[_0x61e3('0x5')](),controller[_0x61e3('0xf')]);router[_0x61e3('0x7')]('/mail/accounts',auth[_0x61e3('0x5')](),controller[_0x61e3('0x10')]);router[_0x61e3('0x7')](_0x61e3('0x11'),auth['isAuthenticated'](),controller[_0x61e3('0x12')]);router['get'](_0x61e3('0x13'),auth[_0x61e3('0x5')](),controller['smsQueues']);router[_0x61e3('0x7')]('/whatsapp/queues',auth['isAuthenticated'](),controller[_0x61e3('0x14')]);router[_0x61e3('0x7')](_0x61e3('0x15'),auth[_0x61e3('0x5')](),controller['faxQueues']);router[_0x61e3('0x7')]('/voice/queues/preview/:id',auth[_0x61e3('0x5')](),controller[_0x61e3('0x16')]);router['get'](_0x61e3('0x17'),auth['isAuthenticated'](),controller[_0x61e3('0x18')]);router[_0x61e3('0x7')]('/voice/queues/channels/:uniqueid',auth[_0x61e3('0x5')](),controller['voiceQueuesChannel']);router['get']('/voice/queues/channels/:uniqueid/hangup',auth['isAuthenticated'](),controller[_0x61e3('0x19')]);router['get'](_0x61e3('0x1a'),auth[_0x61e3('0x5')](),controller['voiceQueuesChannelRedirect']);router[_0x61e3('0x7')](_0x61e3('0x1b'),auth['isAuthenticated'](),controller[_0x61e3('0x1c')]);router[_0x61e3('0x1d')](_0x61e3('0x1b'),auth[_0x61e3('0x5')](),controller[_0x61e3('0x1e')]);router['get']('/outbound',auth[_0x61e3('0x5')](),controller[_0x61e3('0x1f')]);router[_0x61e3('0x7')]('/outbound/channels',auth[_0x61e3('0x5')](),controller[_0x61e3('0x20')]);router[_0x61e3('0x7')](_0x61e3('0x21'),auth[_0x61e3('0x5')](),controller['agents']);router[_0x61e3('0x1d')](_0x61e3('0x22'),auth[_0x61e3('0x5')](),controller[_0x61e3('0x23')]);router['get'](_0x61e3('0x24'),auth['isAuthenticated'](),controller[_0x61e3('0x25')]);router[_0x61e3('0x7')]('/trunks',auth['isAuthenticated'](),controller[_0x61e3('0x26')]);router[_0x61e3('0x7')]('/campaigns',auth['isAuthenticated'](),controller[_0x61e3('0x27')]);router[_0x61e3('0x7')](_0x61e3('0x28'),auth[_0x61e3('0x5')](),controller[_0x61e3('0x29')]);router[_0x61e3('0x7')](_0x61e3('0x2a'),auth[_0x61e3('0x5')](),controller[_0x61e3('0x2b')]);router[_0x61e3('0x7')](_0x61e3('0x2c'),auth[_0x61e3('0x5')](),controller[_0x61e3('0x2d')]);router['get'](_0x61e3('0x2e'),auth[_0x61e3('0x5')](),controller[_0x61e3('0x2f')]);router[_0x61e3('0x7')](_0x61e3('0x30'),auth[_0x61e3('0x5')](),controller[_0x61e3('0x31')]);router[_0x61e3('0x7')](_0x61e3('0x32'),auth[_0x61e3('0x5')](),controller[_0x61e3('0x33')]);router[_0x61e3('0x7')](_0x61e3('0x34'),auth['isAuthenticated'](),controller[_0x61e3('0x35')]);router[_0x61e3('0x7')](_0x61e3('0x36'),auth[_0x61e3('0x5')](),controller[_0x61e3('0x37')]);router[_0x61e3('0x38')](_0x61e3('0x39'),auth[_0x61e3('0x5')](),controller[_0x61e3('0x3a')](_0x61e3('0x3b')));router[_0x61e3('0x7')]('/mail/queues/:id',auth[_0x61e3('0x5')](),controller[_0x61e3('0x3c')]);router['post'](_0x61e3('0x3d'),auth[_0x61e3('0x5')](),controller['queueNotify'](_0x61e3('0x3e')));router[_0x61e3('0x7')](_0x61e3('0x3f'),auth['isAuthenticated'](),controller[_0x61e3('0x40')]);router[_0x61e3('0x38')]('/fax/queues/:id/notify',auth[_0x61e3('0x5')](),controller[_0x61e3('0x3a')](_0x61e3('0x41')));router[_0x61e3('0x7')](_0x61e3('0x42'),auth[_0x61e3('0x5')](),controller['showFaxQueues']);router['post']('/openchannel/queues/:id/notify',auth[_0x61e3('0x5')](),controller[_0x61e3('0x3a')](_0x61e3('0x43')));router[_0x61e3('0x7')](_0x61e3('0x44'),auth[_0x61e3('0x5')](),controller['showOpenchannelQueues']);router['post'](_0x61e3('0x45'),auth[_0x61e3('0x5')](),controller[_0x61e3('0x3a')](_0x61e3('0x46')));router['post'](_0x61e3('0x47'),auth[_0x61e3('0x5')](),controller[_0x61e3('0x3a')](_0x61e3('0x48')));router[_0x61e3('0x7')]('/sms/queues/:id',auth[_0x61e3('0x5')](),controller[_0x61e3('0x49')]);router[_0x61e3('0x7')](_0x61e3('0x4a'),auth[_0x61e3('0x5')](),controller[_0x61e3('0x4b')]);router[_0x61e3('0x38')](_0x61e3('0x4c'),auth[_0x61e3('0x5')](),controller[_0x61e3('0x4d')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 57f7224..24797ac 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 _0x7bae=['agent','capacity','Telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','mailQueues','showMailQueues','MailQueues','mailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','showSmsQueues','SmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','rows','filter','map','queue_id','uniq','indexOf','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','FaxQueuesWaitingInteractions','capitalize','chat','Website','Account','Queue','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','\x20Message\x20not\x20found','update','InteractionId','QueueId','TransferReport','queue','queueTransferTimeout','Channel\x20field\x20is\x20mandatory','channel','User','Agent\x20not\x20found','MessageId','From','Start','agentTransferTimeout','*,*,*,*','lodash','util','../../config/logger','jayson/promise','client','http','request','error','code','message','result','status','json','sendStatus','stack','name','isNil','voiceChannels','VoiceChannels','then','catch','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','query','showVoiceQueues','VoiceQueues','UpdateVoiceQueue','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','outbound','Outbound','outboundChannels','agents','Agents','agentCapacity','body','interaction','user','hasOwnProperty','findAll','INTERACTION','format','YYYY-MM-DD\x20HH:mm:ss','length','MemberReport','findOrCreate','interface','SIP/%s'];(function(_0x5056b6,_0x49fdcf){var _0x2d448f=function(_0x14dd86){while(--_0x14dd86){_0x5056b6['push'](_0x5056b6['shift']());}};_0x2d448f(++_0x49fdcf);}(_0x7bae,0x13b));var _0xe7ba=function(_0x288f5e,_0x205edd){_0x288f5e=_0x288f5e-0x0;var _0x476cc9=_0x7bae[_0x288f5e];return _0x476cc9;};'use strict';var BPromise=require('bluebird');var moment=require('moment');var _=require(_0xe7ba('0x0'));var util=require(_0xe7ba('0x1'));var db=require('../../mysqldb')['db'];var logger=require(_0xe7ba('0x2'))('api');var jayson=require(_0xe7ba('0x3'));var amiClient=jayson[_0xe7ba('0x4')][_0xe7ba('0x5')]({'port':0x232a});var mailClient=jayson[_0xe7ba('0x4')][_0xe7ba('0x5')]({'port':0x232b});var routingClient=jayson[_0xe7ba('0x4')][_0xe7ba('0x5')]({'port':0x232c});function respondWithRpcPromise(_0x3c5e59,_0x10b307,_0x34fb18){return new BPromise(function(_0x160565,_0x27b1d5){var _0x41c39d=_0x34fb18?_0x34fb18:amiClient;return _0x41c39d[_0xe7ba('0x6')](_0x3c5e59,_0x10b307)['then'](function(_0x3df8bf){if(_0x3df8bf[_0xe7ba('0x7')]){if(_0x3df8bf[_0xe7ba('0x7')][_0xe7ba('0x8')]===0x1f4){return _0x27b1d5(_0x3df8bf[_0xe7ba('0x7')][_0xe7ba('0x9')]);}return _0x160565(_0x3df8bf[_0xe7ba('0x7')][_0xe7ba('0x9')]);}else{_0x160565(_0x3df8bf[_0xe7ba('0xa')]);}})['catch'](function(_0xf4fcb0){_0x27b1d5(_0xf4fcb0);});});}function respondWithResult(_0x588c8b,_0x602b1){_0x602b1=_0x602b1||0xc8;return function(_0x45229c){if(_0x45229c){return _0x588c8b[_0xe7ba('0xb')](_0x602b1)[_0xe7ba('0xc')](_0x45229c);}return _0x588c8b[_0xe7ba('0xd')](0x194);};}function handleError(_0x41369f,_0x561dbb){_0x561dbb=_0x561dbb||0x1f4;return function(_0x561c48){logger[_0xe7ba('0x7')](_0x561c48[_0xe7ba('0xe')]);if(_0x561c48[_0xe7ba('0xf')]){delete _0x561c48['name'];}_0x41369f[_0xe7ba('0xb')](_0x561dbb)['send'](_0x561c48);};}function findById(_0x590bab){return function(_0x5e9176){if(!_[_0xe7ba('0x10')](_0x590bab)&&!_['isNil'](_0x5e9176)&&!_[_0xe7ba('0x10')](_0x5e9176['rows'])){return _['find'](_0x5e9176['rows'],function(_0x3f326a){return _0x3f326a['id']==_0x590bab;});}return null;};}exports[_0xe7ba('0x11')]=function(_0x39ca38,_0x3c06c3){return respondWithRpcPromise(_0xe7ba('0x12'),_0x39ca38['query'])[_0xe7ba('0x13')](respondWithResult(_0x3c06c3,null))[_0xe7ba('0x14')](handleError(_0x3c06c3,null));};exports[_0xe7ba('0x15')]=function(_0x136ec6,_0x4aaf35){return respondWithRpcPromise(_0xe7ba('0x16'),_[_0xe7ba('0x17')](_0x136ec6['query'],_0x136ec6[_0xe7ba('0x18')]))[_0xe7ba('0x13')](respondWithResult(_0x4aaf35,null))[_0xe7ba('0x14')](handleError(_0x4aaf35,null));};exports[_0xe7ba('0x19')]=function(_0x394b69,_0x2acfc2){return respondWithRpcPromise(_0xe7ba('0x1a'),_[_0xe7ba('0x17')](_0x394b69[_0xe7ba('0x1b')],_0x394b69[_0xe7ba('0x18')]))['then'](respondWithResult(_0x2acfc2,null))['catch'](handleError(_0x2acfc2,null));};exports['voiceQueues']=function(_0x4cd124,_0x4363a8){return respondWithRpcPromise('VoiceQueues',_0x4cd124['query'])['then'](respondWithResult(_0x4363a8,null))[_0xe7ba('0x14')](handleError(_0x4363a8,null));};exports[_0xe7ba('0x1c')]=function(_0xe32862,_0x2ea78a){return respondWithRpcPromise(_0xe7ba('0x1d'),_0xe32862[_0xe7ba('0x1b')])[_0xe7ba('0x13')](findById(_0xe32862[_0xe7ba('0x18')]['id']))['then'](respondWithResult(_0x2ea78a,null))[_0xe7ba('0x14')](handleError(_0x2ea78a,null));};exports['updateVoiceQueue']=function(_0x102925,_0x92fe7){return respondWithRpcPromise(_0xe7ba('0x1e'),_['merge'](_0x102925['body'],_0x102925[_0xe7ba('0x18')]))[_0xe7ba('0x13')](respondWithResult(_0x92fe7,null))[_0xe7ba('0x14')](handleError(_0x92fe7,null));};exports[_0xe7ba('0x1f')]=function(_0x268308,_0x5279dd){return respondWithRpcPromise(_0xe7ba('0x20'),_[_0xe7ba('0x17')](_0x268308['query'],_0x268308[_0xe7ba('0x18')]))['then'](respondWithResult(_0x5279dd,null))['catch'](handleError(_0x5279dd,null));};exports[_0xe7ba('0x21')]=function(_0x134f21,_0x1be947){return respondWithRpcPromise('VoiceQueuesChannels',_0x134f21[_0xe7ba('0x1b')])['then'](respondWithResult(_0x1be947,null))[_0xe7ba('0x14')](handleError(_0x1be947,null));};exports[_0xe7ba('0x22')]=function(_0x3b0a69,_0x27a8d4){return respondWithRpcPromise(_0xe7ba('0x23'),_['merge'](_0x3b0a69[_0xe7ba('0x1b')],_0x3b0a69[_0xe7ba('0x18')]))['then'](respondWithResult(_0x27a8d4,null))[_0xe7ba('0x14')](handleError(_0x27a8d4,null));};exports[_0xe7ba('0x24')]=function(_0x499d3b,_0x524726){return respondWithRpcPromise(_0xe7ba('0x25'),_[_0xe7ba('0x17')](_0x499d3b['query'],_0x499d3b[_0xe7ba('0x18')]))[_0xe7ba('0x13')](respondWithResult(_0x524726,null))[_0xe7ba('0x14')](handleError(_0x524726,null));};exports['voiceQueuesChannelRedirect']=function(_0x3e6eb7,_0x43b313){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_[_0xe7ba('0x17')](_0x3e6eb7[_0xe7ba('0x1b')],_0x3e6eb7[_0xe7ba('0x18')]))['then'](respondWithResult(_0x43b313,null))['catch'](handleError(_0x43b313,null));};exports[_0xe7ba('0x26')]=function(_0x2ebb27,_0x58d2a){return respondWithRpcPromise(_0xe7ba('0x27'),_0x2ebb27[_0xe7ba('0x1b')])['then'](respondWithResult(_0x58d2a,null))[_0xe7ba('0x14')](handleError(_0x58d2a,null));};exports[_0xe7ba('0x28')]=function(_0x3139a6,_0x23a912){return respondWithRpcPromise('OutboundChannels',_0x3139a6[_0xe7ba('0x1b')])[_0xe7ba('0x13')](respondWithResult(_0x23a912,null))[_0xe7ba('0x14')](handleError(_0x23a912,null));};exports[_0xe7ba('0x29')]=function(_0x35a5f3,_0x3793c6){var _0x124cc4;return respondWithRpcPromise('Agents',_0x35a5f3[_0xe7ba('0x1b')])[_0xe7ba('0x13')](function(_0x359a4d){_0x124cc4=_0x359a4d;return respondWithRpcPromise(_0xe7ba('0x2a'),_0x35a5f3[_0xe7ba('0x1b')],routingClient);})[_0xe7ba('0x13')](function(_0x220c3b){return _[_0xe7ba('0x17')]({},_0x220c3b,_0x124cc4);})[_0xe7ba('0x13')](respondWithResult(_0x3793c6,null))['catch'](handleError(_0x3793c6,null));};exports[_0xe7ba('0x2b')]=function(_0x417734,_0x5d4be2){if(_0x417734['body']&&_0x417734[_0xe7ba('0x2c')][_0xe7ba('0x2d')]&&_0x417734[_0xe7ba('0x2e')]&&_0x417734['user'][_0xe7ba('0xf')]){for(var _0x82246e in _0x417734[_0xe7ba('0x2c')][_0xe7ba('0x2d')]){if(_0x417734[_0xe7ba('0x2c')]['interaction'][_0xe7ba('0x2f')](_0x82246e)){db['MemberReport'][_0xe7ba('0x30')]({'where':{'channel':_0x82246e,'membername':_0x417734[_0xe7ba('0x2e')][_0xe7ba('0xf')],'type':_0xe7ba('0x31'),'exitAt':null,'uniqueid':_0x417734[_0xe7ba('0x2c')][_0xe7ba('0x2d')][_0x82246e]&&_0x417734[_0xe7ba('0x2c')][_0xe7ba('0x2d')][_0x82246e]['length']?{'$notIn':_0x417734[_0xe7ba('0x2c')][_0xe7ba('0x2d')][_0x82246e]}:{'$ne':null}}})[_0xe7ba('0x13')](function(_0x37dcaa){var _0x3620bc=moment()[_0xe7ba('0x32')](_0xe7ba('0x33'));for(var _0x2c54ac=0x0,_0x45f49a=_0x37dcaa[_0xe7ba('0x34')];_0x2c54ac<_0x45f49a;_0x2c54ac+=0x1){_0x37dcaa[_0x2c54ac]['updateAttributes']({'exitAt':_0x3620bc});}});for(var _0x19ccde=0x0;_0x19ccde<_0x417734['body'][_0xe7ba('0x2d')][_0x82246e][_0xe7ba('0x34')];_0x19ccde+=0x1){db[_0xe7ba('0x35')][_0xe7ba('0x36')]({'where':{'channel':_0x82246e,'membername':_0x417734[_0xe7ba('0x2e')][_0xe7ba('0xf')],'type':'INTERACTION','uniqueid':_0x417734[_0xe7ba('0x2c')][_0xe7ba('0x2d')][_0x82246e][_0x19ccde],'exitAt':null},'defaults':{'channel':_0x82246e,'membername':_0x417734[_0xe7ba('0x2e')][_0xe7ba('0xf')],'interface':_[_0xe7ba('0x10')](_0x417734[_0xe7ba('0x2e')][_0xe7ba('0x37')])?util[_0xe7ba('0x32')](_0xe7ba('0x38'),_0x417734[_0xe7ba('0x2e')][_0xe7ba('0xf')]):_0x417734['user'][_0xe7ba('0x37')],'type':_0xe7ba('0x31'),'enterAt':moment()[_0xe7ba('0x32')](_0xe7ba('0x33')),'role':_0xe7ba('0x39'),'internal':_0x417734[_0xe7ba('0x2e')]['internal'],'uniqueid':_0x417734[_0xe7ba('0x2c')][_0xe7ba('0x2d')][_0x82246e][_0x19ccde]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x417734[_0xe7ba('0x18')]['id'],'capacity':_0x417734[_0xe7ba('0x2c')][_0xe7ba('0x3a')]},routingClient)[_0xe7ba('0x13')](respondWithResult(_0x5d4be2,null))['catch'](handleError(_0x5d4be2,null));};exports['telephones']=function(_0xa80cf,_0x2cfdc3){return respondWithRpcPromise(_0xe7ba('0x3b'),_0xa80cf['query'])[_0xe7ba('0x13')](respondWithResult(_0x2cfdc3,null))[_0xe7ba('0x14')](handleError(_0x2cfdc3,null));};exports[_0xe7ba('0x3c')]=function(_0x45bcbd,_0x14beb3){return respondWithRpcPromise(_0xe7ba('0x3d'),_0x45bcbd[_0xe7ba('0x1b')])['then'](respondWithResult(_0x14beb3,null))[_0xe7ba('0x14')](handleError(_0x14beb3,null));};exports[_0xe7ba('0x3e')]=function(_0x316b51,_0x5863c8){return respondWithRpcPromise(_0xe7ba('0x3f'),_0x316b51[_0xe7ba('0x1b')])['then'](respondWithResult(_0x5863c8,null))[_0xe7ba('0x14')](handleError(_0x5863c8,null));};exports[_0xe7ba('0x40')]=function(_0x4da728,_0x3b4ae4){return respondWithRpcPromise('ChatQueues',_0x4da728[_0xe7ba('0x1b')],routingClient)[_0xe7ba('0x13')](respondWithResult(_0x3b4ae4,null))[_0xe7ba('0x14')](handleError(_0x3b4ae4,null));};exports['showChatQueues']=function(_0x38829a,_0x1128be){return respondWithRpcPromise(_0xe7ba('0x41'),_0x38829a[_0xe7ba('0x1b')],routingClient)[_0xe7ba('0x13')](findById(_0x38829a['params']['id']))[_0xe7ba('0x13')](respondWithResult(_0x1128be,null))[_0xe7ba('0x14')](handleError(_0x1128be,null));};exports[_0xe7ba('0x42')]=function(_0x19159c,_0x435dee){return respondWithRpcPromise('MailQueues',_0x19159c[_0xe7ba('0x1b')],routingClient)[_0xe7ba('0x13')](respondWithResult(_0x435dee,null))[_0xe7ba('0x14')](handleError(_0x435dee,null));};exports[_0xe7ba('0x43')]=function(_0x57b23e,_0x3e31c1){return respondWithRpcPromise(_0xe7ba('0x44'),_0x57b23e[_0xe7ba('0x1b')],routingClient)[_0xe7ba('0x13')](findById(_0x57b23e[_0xe7ba('0x18')]['id']))[_0xe7ba('0x13')](respondWithResult(_0x3e31c1,null))['catch'](handleError(_0x3e31c1,null));};exports[_0xe7ba('0x45')]=function(_0x103762,_0x3bd82f){return respondWithRpcPromise('MailAccounts',_0x103762[_0xe7ba('0x1b')],mailClient)[_0xe7ba('0x13')](respondWithResult(_0x3bd82f,null))[_0xe7ba('0x14')](handleError(_0x3bd82f,null));};exports[_0xe7ba('0x46')]=function(_0x45fb0f,_0x162d7f){return respondWithRpcPromise(_0xe7ba('0x47'),_0x45fb0f[_0xe7ba('0x1b')],routingClient)[_0xe7ba('0x13')](respondWithResult(_0x162d7f,null))[_0xe7ba('0x14')](handleError(_0x162d7f,null));};exports[_0xe7ba('0x48')]=function(_0x27422d,_0x4a5c8c){return respondWithRpcPromise(_0xe7ba('0x47'),_0x27422d[_0xe7ba('0x1b')],routingClient)[_0xe7ba('0x13')](findById(_0x27422d['params']['id']))[_0xe7ba('0x13')](respondWithResult(_0x4a5c8c,null))['catch'](handleError(_0x4a5c8c,null));};exports[_0xe7ba('0x49')]=function(_0x194dff,_0x781e04){return respondWithRpcPromise('SmsQueues',_0x194dff['query'],routingClient)[_0xe7ba('0x13')](respondWithResult(_0x781e04,null))[_0xe7ba('0x14')](handleError(_0x781e04,null));};exports[_0xe7ba('0x4a')]=function(_0x4de4c9,_0x3ba4fd){return respondWithRpcPromise(_0xe7ba('0x4b'),_0x4de4c9[_0xe7ba('0x1b')],routingClient)[_0xe7ba('0x13')](findById(_0x4de4c9[_0xe7ba('0x18')]['id']))['then'](respondWithResult(_0x3ba4fd,null))[_0xe7ba('0x14')](handleError(_0x3ba4fd,null));};exports[_0xe7ba('0x4c')]=function(_0x70ce9c,_0x50cc8b){return respondWithRpcPromise(_0xe7ba('0x4d'),_0x70ce9c[_0xe7ba('0x1b')],routingClient)[_0xe7ba('0x13')](respondWithResult(_0x50cc8b,null))[_0xe7ba('0x14')](handleError(_0x50cc8b,null));};exports[_0xe7ba('0x4e')]=function(_0x29c046,_0x6c8738){return respondWithRpcPromise(_0xe7ba('0x4d'),_0x29c046[_0xe7ba('0x1b')],routingClient)[_0xe7ba('0x13')](findById(_0x29c046['params']['id']))[_0xe7ba('0x13')](respondWithResult(_0x6c8738,null))[_0xe7ba('0x14')](handleError(_0x6c8738,null));};exports[_0xe7ba('0x4f')]=function(_0xa6da9e,_0x4d8773){return respondWithRpcPromise('FaxQueues',_0xa6da9e[_0xe7ba('0x1b')],routingClient)[_0xe7ba('0x13')](respondWithResult(_0x4d8773,null))[_0xe7ba('0x14')](handleError(_0x4d8773,null));};exports['showFaxQueues']=function(_0x53ebd1,_0x5561cc){return respondWithRpcPromise(_0xe7ba('0x50'),_0x53ebd1[_0xe7ba('0x1b')],routingClient)['then'](findById(_0x53ebd1[_0xe7ba('0x18')]['id']))['then'](respondWithResult(_0x5561cc,null))[_0xe7ba('0x14')](handleError(_0x5561cc,null));};exports['faxAccounts']=function(_0x11aded,_0x4ebe4a){return respondWithRpcPromise('FaxAccounts',_0x11aded[_0xe7ba('0x1b')])[_0xe7ba('0x13')](respondWithResult(_0x4ebe4a,null))[_0xe7ba('0x14')](handleError(_0x4ebe4a,null));};exports[_0xe7ba('0x51')]=function(_0x157d41,_0x35b755){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x157d41['query'],routingClient)[_0xe7ba('0x13')](respondWithResult(_0x35b755,null))[_0xe7ba('0x14')](handleError(_0x35b755,null));};exports[_0xe7ba('0x52')]=function(_0x2e6e90,_0x18f23e){return respondWithRpcPromise(_0xe7ba('0x53'),_0x2e6e90[_0xe7ba('0x1b')],routingClient)[_0xe7ba('0x13')](respondWithResult(_0x18f23e,null))[_0xe7ba('0x14')](handleError(_0x18f23e,null));};exports[_0xe7ba('0x54')]=function(_0x325ecb,_0x246f91){return respondWithRpcPromise(_0xe7ba('0x55'),_0x325ecb[_0xe7ba('0x1b')],routingClient)[_0xe7ba('0x13')](respondWithResult(_0x246f91,null))['catch'](handleError(_0x246f91,null));};exports[_0xe7ba('0x56')]=function(_0x3acb1a,_0x5e16f1){return respondWithRpcPromise(_0xe7ba('0x55'),_0x3acb1a[_0xe7ba('0x1b')],routingClient)[_0xe7ba('0x13')](function(_0x2471c8){if(_0x3acb1a[_0xe7ba('0x1b')][_0xe7ba('0x57')]!==undefined){var _0x24c94a=_(_0x2471c8[_0xe7ba('0x58')])[_0xe7ba('0x59')]([_0x3acb1a['query'][_0xe7ba('0x57')],_0x3acb1a['params']['id']])[_0xe7ba('0x5a')](_0xe7ba('0x5b'))[_0xe7ba('0x5c')]()['value']();return _0x2471c8[_0xe7ba('0x58')][_0xe7ba('0x59')](function(_0x2f1938){return _0x24c94a[_0xe7ba('0x5d')](_0x2f1938['queue_id'])>-0x1;});}else{return _0x2471c8[_0xe7ba('0x58')][_0xe7ba('0x59')](function(_0x433644){return _0x433644[_0xe7ba('0x5b')]===parseInt(_0x3acb1a['params']['id']);});}})[_0xe7ba('0x13')](respondWithResult(_0x5e16f1,null))[_0xe7ba('0x14')](handleError(_0x5e16f1,null));};exports[_0xe7ba('0x5e')]=function(_0x1bfb80,_0x16af73){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x1bfb80['query'],routingClient)['then'](respondWithResult(_0x16af73,null))[_0xe7ba('0x14')](handleError(_0x16af73,null));};exports[_0xe7ba('0x5f')]=function(_0x41a346,_0x27e7a5){return respondWithRpcPromise(_0xe7ba('0x60'),_0x41a346[_0xe7ba('0x1b')],routingClient)['then'](respondWithResult(_0x27e7a5,null))[_0xe7ba('0x14')](handleError(_0x27e7a5,null));};exports['faxQueuesWaitingInteractions']=function(_0x439c96,_0x2e3e28){return respondWithRpcPromise(_0xe7ba('0x61'),_0x439c96[_0xe7ba('0x1b')],routingClient)[_0xe7ba('0x13')](respondWithResult(_0x2e3e28,null))[_0xe7ba('0x14')](handleError(_0x2e3e28,null));};exports['queueNotify']=function(_0x44563b){return function(_0x4904d2,_0x8cba2c){var _0x18e715,_0x1d3035;var _0x5e70d9=_[_0xe7ba('0x62')](_0x44563b);var _0x52d73a=_0x44563b===_0xe7ba('0x63')?_0xe7ba('0x64'):_0xe7ba('0x65');return db[_0x5e70d9+_0xe7ba('0x66')][_0xe7ba('0x67')]({'raw':!![],'where':{'id':_0x4904d2[_0xe7ba('0x18')]['id']}})[_0xe7ba('0x13')](function(_0x3bf6b8){if(_[_0xe7ba('0x10')](_0x3bf6b8)){throw new Error(_0x5e70d9+_0xe7ba('0x68'));}_0x18e715=_0x3bf6b8;return db[_0x5e70d9+_0xe7ba('0x69')][_0xe7ba('0x67')]({'where':{'id':_0x4904d2[_0xe7ba('0x2c')][_0xe7ba('0x6a')]},'include':[{'model':db[_0x5e70d9+_0xe7ba('0x6b')],'as':_0xe7ba('0x6b')},{'model':db[_0x5e70d9+_0x52d73a],'as':_0xe7ba('0x65')}]});})[_0xe7ba('0x13')](function(_0x691f8c){if(_[_0xe7ba('0x10')](_0x691f8c)){throw new Error(_0x5e70d9+_0xe7ba('0x6c'));}_0x1d3035=_0x691f8c;return _0x691f8c[_0xe7ba('0x6d')]({'read':0x0,'readAt':null,'UserId':null});})[_0xe7ba('0x13')](function(){var _0x36cf6d={'uniqueid':_0x44563b+'.'+_0x1d3035['id']+'.'+_0x1d3035[_0xe7ba('0x6b')]['id'],'FromUserId':_0x4904d2['user']['id'],'type':'queue'};_0x36cf6d[_0x5e70d9+'MessageId']=_0x1d3035['id'];_0x36cf6d[_0x5e70d9+_0xe7ba('0x6e')]=_0x1d3035[_0xe7ba('0x6b')]['id'];_0x36cf6d['From'+_0x5e70d9+_0x52d73a+'Id']=_0x1d3035['Account']['id'];_0x36cf6d['To'+_0x5e70d9+_0xe7ba('0x6f')]=_0x18e715['id'];return db[_0x5e70d9+_0xe7ba('0x70')]['create'](_0x36cf6d);})[_0xe7ba('0x13')](function(){return respondWithRpcPromise('Start',{'channel':_0x44563b,'interaction':_0x1d3035['Interaction'],'message':_0x1d3035,'account':_0x1d3035['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0xe7ba('0x71'),'appdata':_0x18e715[_0xe7ba('0xf')]+','+(_0x1d3035[_0xe7ba('0x65')][_0xe7ba('0x72')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0xe7ba('0x13')](respondWithResult(_0x8cba2c,null))[_0xe7ba('0x14')](handleError(_0x8cba2c,null));};};exports['agentNotify']=function(_0x575170,_0x459b0c){var _0x5d5722,_0x40ae10;if(_[_0xe7ba('0x10')](_0x575170[_0xe7ba('0x2c')]['channel'])){throw new Error(_0xe7ba('0x73'));}var _0x17391f=_0x575170[_0xe7ba('0x2c')][_0xe7ba('0x74')];var _0x34b5d8=_[_0xe7ba('0x62')](_0x17391f);var _0x44c657=_0x17391f===_0xe7ba('0x63')?_0xe7ba('0x64'):_0xe7ba('0x65');return db[_0xe7ba('0x75')][_0xe7ba('0x67')]({'raw':!![],'where':{'id':_0x575170[_0xe7ba('0x18')]['id'],'role':_0xe7ba('0x39')}})[_0xe7ba('0x13')](function(_0x16b3df){if(_[_0xe7ba('0x10')](_0x16b3df)){throw new Error(_0xe7ba('0x76'));}_0x5d5722=_0x16b3df;return db[_0x34b5d8+_0xe7ba('0x69')][_0xe7ba('0x67')]({'where':{'id':_0x575170[_0xe7ba('0x2c')]['messageId']},'include':[{'model':db[_0x34b5d8+'Interaction'],'as':'Interaction'},{'model':db[_0x34b5d8+_0x44c657],'as':_0xe7ba('0x65')}]});})[_0xe7ba('0x13')](function(_0x34f0f9){if(_[_0xe7ba('0x10')](_0x34f0f9)){throw new Error(_0x34b5d8+_0xe7ba('0x6c'));}_0x40ae10=_0x34f0f9;return _0x34f0f9['update']({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x2c86d2={'uniqueid':_0x17391f+'.'+_0x40ae10['id']+'.'+_0x40ae10['Interaction']['id'],'FromUserId':_0x575170[_0xe7ba('0x2e')]['id'],'type':_0xe7ba('0x71'),'ToUserId':_0x5d5722['id']};_0x2c86d2[_0x34b5d8+_0xe7ba('0x77')]=_0x40ae10['id'];_0x2c86d2[_0x34b5d8+_0xe7ba('0x6e')]=_0x40ae10[_0xe7ba('0x6b')]['id'];_0x2c86d2[_0xe7ba('0x78')+_0x34b5d8+_0x44c657+'Id']=_0x40ae10[_0xe7ba('0x65')]['id'];return db[_0x34b5d8+_0xe7ba('0x70')]['create'](_0x2c86d2);})[_0xe7ba('0x13')](function(){return respondWithRpcPromise(_0xe7ba('0x79'),{'channel':_0x17391f,'interaction':_0x40ae10[_0xe7ba('0x6b')],'message':_0x40ae10,'account':_0x40ae10['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x5d5722[_0xe7ba('0xf')]+','+(_0x40ae10[_0xe7ba('0x65')][_0xe7ba('0x7a')]||0x12c),'interval':_0xe7ba('0x7b')}]},routingClient);})['then'](respondWithResult(_0x459b0c,null))[_0xe7ba('0x14')](handleError(_0x459b0c,null));}; \ No newline at end of file +var _0x2d17=['jayson/promise','http','request','then','error','code','message','result','catch','status','json','sendStatus','stack','name','send','isNil','find','rows','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','merge','params','voiceQueues','VoiceQueues','UpdateVoiceQueue','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','Agents','agentCapacity','interaction','user','body','MemberReport','findAll','length','findOrCreate','INTERACTION','interface','SIP/%s','format','YYYY-MM-DD\x20HH:mm:ss','internal','capacity','telephones','Telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','whatsappQueues','WhatsappQueues','faxQueues','FaxQueues','faxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','map','queue_id','uniq','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','FaxQueuesWaitingInteractions','capitalize','chat','Account','Queue','\x20Queue\x20not\x20found','findOne','messageId','Interaction','\x20Message\x20not\x20found','update','queue','InteractionId','From','QueueId','TransferReport','create','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','Website','User','agent','Agent\x20not\x20found','Message','agentTransferTimeout','bluebird','moment','util','../../mysqldb','api'];(function(_0x52e70d,_0x2c3c0e){var _0x2cafc9=function(_0x154037){while(--_0x154037){_0x52e70d['push'](_0x52e70d['shift']());}};_0x2cafc9(++_0x2c3c0e);}(_0x2d17,0x17e));var _0x72d1=function(_0xdc050,_0x39719c){_0xdc050=_0xdc050-0x0;var _0x2fc1dd=_0x2d17[_0xdc050];return _0x2fc1dd;};'use strict';var BPromise=require(_0x72d1('0x0'));var moment=require(_0x72d1('0x1'));var _=require('lodash');var util=require(_0x72d1('0x2'));var db=require(_0x72d1('0x3'))['db'];var logger=require('../../config/logger')(_0x72d1('0x4'));var jayson=require(_0x72d1('0x5'));var amiClient=jayson['client'][_0x72d1('0x6')]({'port':0x232a});var mailClient=jayson['client'][_0x72d1('0x6')]({'port':0x232b});var routingClient=jayson['client'][_0x72d1('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x239d1f,_0x5b40a9,_0x477264){return new BPromise(function(_0x422f5a,_0x19e248){var _0x4e7f3e=_0x477264?_0x477264:amiClient;return _0x4e7f3e[_0x72d1('0x7')](_0x239d1f,_0x5b40a9)[_0x72d1('0x8')](function(_0x283775){if(_0x283775['error']){if(_0x283775[_0x72d1('0x9')][_0x72d1('0xa')]===0x1f4){return _0x19e248(_0x283775[_0x72d1('0x9')][_0x72d1('0xb')]);}return _0x422f5a(_0x283775[_0x72d1('0x9')][_0x72d1('0xb')]);}else{_0x422f5a(_0x283775[_0x72d1('0xc')]);}})[_0x72d1('0xd')](function(_0x273ccf){_0x19e248(_0x273ccf);});});}function respondWithResult(_0x2f5a78,_0x5ad4df){_0x5ad4df=_0x5ad4df||0xc8;return function(_0x3cd1ae){if(_0x3cd1ae){return _0x2f5a78[_0x72d1('0xe')](_0x5ad4df)[_0x72d1('0xf')](_0x3cd1ae);}return _0x2f5a78[_0x72d1('0x10')](0x194);};}function handleError(_0x22ac6f,_0x685a27){_0x685a27=_0x685a27||0x1f4;return function(_0x143718){logger[_0x72d1('0x9')](_0x143718[_0x72d1('0x11')]);if(_0x143718[_0x72d1('0x12')]){delete _0x143718[_0x72d1('0x12')];}_0x22ac6f[_0x72d1('0xe')](_0x685a27)[_0x72d1('0x13')](_0x143718);};}function findById(_0x491af4){return function(_0x46fa3d){if(!_['isNil'](_0x491af4)&&!_[_0x72d1('0x14')](_0x46fa3d)&&!_[_0x72d1('0x14')](_0x46fa3d['rows'])){return _[_0x72d1('0x15')](_0x46fa3d[_0x72d1('0x16')],function(_0x1ca18d){return _0x1ca18d['id']==_0x491af4;});}return null;};}exports['voiceChannels']=function(_0x4925f6,_0x313d7b){return respondWithRpcPromise(_0x72d1('0x17'),_0x4925f6[_0x72d1('0x18')])[_0x72d1('0x8')](respondWithResult(_0x313d7b,null))[_0x72d1('0xd')](handleError(_0x313d7b,null));};exports[_0x72d1('0x19')]=function(_0x1e2411,_0x5c7982){return respondWithRpcPromise(_0x72d1('0x1a'),_['merge'](_0x1e2411['query'],_0x1e2411['params']))['then'](respondWithResult(_0x5c7982,null))[_0x72d1('0xd')](handleError(_0x5c7982,null));};exports[_0x72d1('0x1b')]=function(_0x573c98,_0x2a421a){return respondWithRpcPromise(_0x72d1('0x1c'),_[_0x72d1('0x1d')](_0x573c98[_0x72d1('0x18')],_0x573c98[_0x72d1('0x1e')]))['then'](respondWithResult(_0x2a421a,null))['catch'](handleError(_0x2a421a,null));};exports[_0x72d1('0x1f')]=function(_0x36bc65,_0x2f661){return respondWithRpcPromise(_0x72d1('0x20'),_0x36bc65[_0x72d1('0x18')])[_0x72d1('0x8')](respondWithResult(_0x2f661,null))[_0x72d1('0xd')](handleError(_0x2f661,null));};exports['showVoiceQueues']=function(_0x57ec9e,_0x1ba258){return respondWithRpcPromise('VoiceQueues',_0x57ec9e[_0x72d1('0x18')])[_0x72d1('0x8')](findById(_0x57ec9e[_0x72d1('0x1e')]['id']))['then'](respondWithResult(_0x1ba258,null))[_0x72d1('0xd')](handleError(_0x1ba258,null));};exports['updateVoiceQueue']=function(_0x707cd0,_0x20055f){return respondWithRpcPromise(_0x72d1('0x21'),_[_0x72d1('0x1d')](_0x707cd0['body'],_0x707cd0[_0x72d1('0x1e')]))['then'](respondWithResult(_0x20055f,null))[_0x72d1('0xd')](handleError(_0x20055f,null));};exports[_0x72d1('0x22')]=function(_0x5cec3f,_0x14d653){return respondWithRpcPromise(_0x72d1('0x23'),_[_0x72d1('0x1d')](_0x5cec3f[_0x72d1('0x18')],_0x5cec3f[_0x72d1('0x1e')]))['then'](respondWithResult(_0x14d653,null))[_0x72d1('0xd')](handleError(_0x14d653,null));};exports[_0x72d1('0x24')]=function(_0x9efc2f,_0x482033){return respondWithRpcPromise(_0x72d1('0x25'),_0x9efc2f[_0x72d1('0x18')])['then'](respondWithResult(_0x482033,null))[_0x72d1('0xd')](handleError(_0x482033,null));};exports[_0x72d1('0x26')]=function(_0x437d79,_0x5a63d9){return respondWithRpcPromise(_0x72d1('0x27'),_['merge'](_0x437d79[_0x72d1('0x18')],_0x437d79[_0x72d1('0x1e')]))[_0x72d1('0x8')](respondWithResult(_0x5a63d9,null))[_0x72d1('0xd')](handleError(_0x5a63d9,null));};exports[_0x72d1('0x28')]=function(_0xc9798a,_0x3ed5de){return respondWithRpcPromise(_0x72d1('0x29'),_[_0x72d1('0x1d')](_0xc9798a[_0x72d1('0x18')],_0xc9798a[_0x72d1('0x1e')]))['then'](respondWithResult(_0x3ed5de,null))[_0x72d1('0xd')](handleError(_0x3ed5de,null));};exports[_0x72d1('0x2a')]=function(_0x4acab,_0x325209){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_[_0x72d1('0x1d')](_0x4acab[_0x72d1('0x18')],_0x4acab[_0x72d1('0x1e')]))['then'](respondWithResult(_0x325209,null))[_0x72d1('0xd')](handleError(_0x325209,null));};exports[_0x72d1('0x2b')]=function(_0x163538,_0x5b897f){return respondWithRpcPromise(_0x72d1('0x2c'),_0x163538[_0x72d1('0x18')])[_0x72d1('0x8')](respondWithResult(_0x5b897f,null))['catch'](handleError(_0x5b897f,null));};exports[_0x72d1('0x2d')]=function(_0x40cdbd,_0x1e083e){return respondWithRpcPromise(_0x72d1('0x2e'),_0x40cdbd[_0x72d1('0x18')])[_0x72d1('0x8')](respondWithResult(_0x1e083e,null))[_0x72d1('0xd')](handleError(_0x1e083e,null));};exports['agents']=function(_0x12646c,_0x3ae4b5){var _0x440ac5;return respondWithRpcPromise(_0x72d1('0x2f'),_0x12646c[_0x72d1('0x18')])[_0x72d1('0x8')](function(_0x2f3080){_0x440ac5=_0x2f3080;return respondWithRpcPromise(_0x72d1('0x2f'),_0x12646c['query'],routingClient);})[_0x72d1('0x8')](function(_0x1a6dd4){return _[_0x72d1('0x1d')]({},_0x1a6dd4,_0x440ac5);})[_0x72d1('0x8')](respondWithResult(_0x3ae4b5,null))[_0x72d1('0xd')](handleError(_0x3ae4b5,null));};exports[_0x72d1('0x30')]=function(_0xb911fa,_0x3620df){if(_0xb911fa['body']&&_0xb911fa['body'][_0x72d1('0x31')]&&_0xb911fa[_0x72d1('0x32')]&&_0xb911fa[_0x72d1('0x32')][_0x72d1('0x12')]){for(var _0x5a6bc4 in _0xb911fa[_0x72d1('0x33')][_0x72d1('0x31')]){if(_0xb911fa['body'][_0x72d1('0x31')]['hasOwnProperty'](_0x5a6bc4)){db[_0x72d1('0x34')][_0x72d1('0x35')]({'where':{'channel':_0x5a6bc4,'membername':_0xb911fa['user'][_0x72d1('0x12')],'type':'INTERACTION','exitAt':null,'uniqueid':_0xb911fa['body']['interaction'][_0x5a6bc4]&&_0xb911fa[_0x72d1('0x33')]['interaction'][_0x5a6bc4][_0x72d1('0x36')]?{'$notIn':_0xb911fa[_0x72d1('0x33')][_0x72d1('0x31')][_0x5a6bc4]}:{'$ne':null}}})['then'](function(_0x4a5c1c){var _0x263fcb=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');for(var _0x2cb03d=0x0,_0x397f31=_0x4a5c1c[_0x72d1('0x36')];_0x2cb03d<_0x397f31;_0x2cb03d+=0x1){_0x4a5c1c[_0x2cb03d]['updateAttributes']({'exitAt':_0x263fcb});}});for(var _0x4f772d=0x0;_0x4f772d<_0xb911fa['body']['interaction'][_0x5a6bc4][_0x72d1('0x36')];_0x4f772d+=0x1){db[_0x72d1('0x34')][_0x72d1('0x37')]({'where':{'channel':_0x5a6bc4,'membername':_0xb911fa[_0x72d1('0x32')][_0x72d1('0x12')],'type':_0x72d1('0x38'),'uniqueid':_0xb911fa[_0x72d1('0x33')][_0x72d1('0x31')][_0x5a6bc4][_0x4f772d],'exitAt':null},'defaults':{'channel':_0x5a6bc4,'membername':_0xb911fa[_0x72d1('0x32')]['name'],'interface':_[_0x72d1('0x14')](_0xb911fa[_0x72d1('0x32')][_0x72d1('0x39')])?util['format'](_0x72d1('0x3a'),_0xb911fa[_0x72d1('0x32')][_0x72d1('0x12')]):_0xb911fa['user'][_0x72d1('0x39')],'type':_0x72d1('0x38'),'enterAt':moment()[_0x72d1('0x3b')](_0x72d1('0x3c')),'role':'agent','internal':_0xb911fa['user'][_0x72d1('0x3d')],'uniqueid':_0xb911fa[_0x72d1('0x33')][_0x72d1('0x31')][_0x5a6bc4][_0x4f772d]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0xb911fa[_0x72d1('0x1e')]['id'],'capacity':_0xb911fa[_0x72d1('0x33')][_0x72d1('0x3e')]},routingClient)[_0x72d1('0x8')](respondWithResult(_0x3620df,null))[_0x72d1('0xd')](handleError(_0x3620df,null));};exports[_0x72d1('0x3f')]=function(_0x3146cf,_0xebe855){return respondWithRpcPromise(_0x72d1('0x40'),_0x3146cf[_0x72d1('0x18')])[_0x72d1('0x8')](respondWithResult(_0xebe855,null))['catch'](handleError(_0xebe855,null));};exports[_0x72d1('0x41')]=function(_0x50d4d4,_0x5dd7b0){return respondWithRpcPromise(_0x72d1('0x42'),_0x50d4d4['query'])[_0x72d1('0x8')](respondWithResult(_0x5dd7b0,null))[_0x72d1('0xd')](handleError(_0x5dd7b0,null));};exports[_0x72d1('0x43')]=function(_0x162248,_0x473a7b){return respondWithRpcPromise(_0x72d1('0x44'),_0x162248[_0x72d1('0x18')])[_0x72d1('0x8')](respondWithResult(_0x473a7b,null))[_0x72d1('0xd')](handleError(_0x473a7b,null));};exports[_0x72d1('0x45')]=function(_0x14f9de,_0x52102e){return respondWithRpcPromise(_0x72d1('0x46'),_0x14f9de[_0x72d1('0x18')],routingClient)[_0x72d1('0x8')](respondWithResult(_0x52102e,null))['catch'](handleError(_0x52102e,null));};exports['showChatQueues']=function(_0x32f1ea,_0x140f0b){return respondWithRpcPromise(_0x72d1('0x46'),_0x32f1ea[_0x72d1('0x18')],routingClient)[_0x72d1('0x8')](findById(_0x32f1ea['params']['id']))[_0x72d1('0x8')](respondWithResult(_0x140f0b,null))['catch'](handleError(_0x140f0b,null));};exports[_0x72d1('0x47')]=function(_0x41c6a6,_0x20daf0){return respondWithRpcPromise(_0x72d1('0x48'),_0x41c6a6[_0x72d1('0x18')],routingClient)[_0x72d1('0x8')](respondWithResult(_0x20daf0,null))[_0x72d1('0xd')](handleError(_0x20daf0,null));};exports[_0x72d1('0x49')]=function(_0x384f0a,_0x3a2dfe){return respondWithRpcPromise(_0x72d1('0x48'),_0x384f0a[_0x72d1('0x18')],routingClient)[_0x72d1('0x8')](findById(_0x384f0a[_0x72d1('0x1e')]['id']))[_0x72d1('0x8')](respondWithResult(_0x3a2dfe,null))[_0x72d1('0xd')](handleError(_0x3a2dfe,null));};exports[_0x72d1('0x4a')]=function(_0x5e63cc,_0x1b40e8){return respondWithRpcPromise(_0x72d1('0x4b'),_0x5e63cc[_0x72d1('0x18')],mailClient)[_0x72d1('0x8')](respondWithResult(_0x1b40e8,null))[_0x72d1('0xd')](handleError(_0x1b40e8,null));};exports[_0x72d1('0x4c')]=function(_0x4e2d85,_0x1aec3d){return respondWithRpcPromise(_0x72d1('0x4d'),_0x4e2d85[_0x72d1('0x18')],routingClient)['then'](respondWithResult(_0x1aec3d,null))['catch'](handleError(_0x1aec3d,null));};exports[_0x72d1('0x4e')]=function(_0x5f4614,_0x28896f){return respondWithRpcPromise(_0x72d1('0x4d'),_0x5f4614[_0x72d1('0x18')],routingClient)[_0x72d1('0x8')](findById(_0x5f4614[_0x72d1('0x1e')]['id']))[_0x72d1('0x8')](respondWithResult(_0x28896f,null))[_0x72d1('0xd')](handleError(_0x28896f,null));};exports[_0x72d1('0x4f')]=function(_0x28e42b,_0x48cd1e){return respondWithRpcPromise('SmsQueues',_0x28e42b[_0x72d1('0x18')],routingClient)[_0x72d1('0x8')](respondWithResult(_0x48cd1e,null))[_0x72d1('0xd')](handleError(_0x48cd1e,null));};exports['showSmsQueues']=function(_0x31bfda,_0x333671){return respondWithRpcPromise('SmsQueues',_0x31bfda[_0x72d1('0x18')],routingClient)[_0x72d1('0x8')](findById(_0x31bfda[_0x72d1('0x1e')]['id']))[_0x72d1('0x8')](respondWithResult(_0x333671,null))[_0x72d1('0xd')](handleError(_0x333671,null));};exports[_0x72d1('0x50')]=function(_0x102574,_0x7925ec){return respondWithRpcPromise(_0x72d1('0x51'),_0x102574[_0x72d1('0x18')],routingClient)[_0x72d1('0x8')](respondWithResult(_0x7925ec,null))[_0x72d1('0xd')](handleError(_0x7925ec,null));};exports['showWhatsappQueues']=function(_0x55f49f,_0x15e0e0){return respondWithRpcPromise(_0x72d1('0x51'),_0x55f49f[_0x72d1('0x18')],routingClient)[_0x72d1('0x8')](findById(_0x55f49f[_0x72d1('0x1e')]['id']))[_0x72d1('0x8')](respondWithResult(_0x15e0e0,null))[_0x72d1('0xd')](handleError(_0x15e0e0,null));};exports[_0x72d1('0x52')]=function(_0x488a14,_0x837b6b){return respondWithRpcPromise('FaxQueues',_0x488a14[_0x72d1('0x18')],routingClient)[_0x72d1('0x8')](respondWithResult(_0x837b6b,null))['catch'](handleError(_0x837b6b,null));};exports['showFaxQueues']=function(_0xfd39ab,_0x14d59b){return respondWithRpcPromise(_0x72d1('0x53'),_0xfd39ab[_0x72d1('0x18')],routingClient)[_0x72d1('0x8')](findById(_0xfd39ab[_0x72d1('0x1e')]['id']))[_0x72d1('0x8')](respondWithResult(_0x14d59b,null))['catch'](handleError(_0x14d59b,null));};exports[_0x72d1('0x54')]=function(_0x24bd82,_0x336ca3){return respondWithRpcPromise('FaxAccounts',_0x24bd82[_0x72d1('0x18')])['then'](respondWithResult(_0x336ca3,null))[_0x72d1('0xd')](handleError(_0x336ca3,null));};exports[_0x72d1('0x55')]=function(_0x5158ff,_0x3c0a7e){return respondWithRpcPromise(_0x72d1('0x56'),_0x5158ff['query'],routingClient)[_0x72d1('0x8')](respondWithResult(_0x3c0a7e,null))[_0x72d1('0xd')](handleError(_0x3c0a7e,null));};exports[_0x72d1('0x57')]=function(_0x132a43,_0x4a52ec){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x132a43['query'],routingClient)[_0x72d1('0x8')](respondWithResult(_0x4a52ec,null))[_0x72d1('0xd')](handleError(_0x4a52ec,null));};exports[_0x72d1('0x58')]=function(_0x240159,_0x146b06){return respondWithRpcPromise(_0x72d1('0x59'),_0x240159['query'],routingClient)['then'](respondWithResult(_0x146b06,null))[_0x72d1('0xd')](handleError(_0x146b06,null));};exports[_0x72d1('0x5a')]=function(_0x36827e,_0x3ef7a3){return respondWithRpcPromise(_0x72d1('0x59'),_0x36827e[_0x72d1('0x18')],routingClient)['then'](function(_0x23f0e3){if(_0x36827e[_0x72d1('0x18')][_0x72d1('0x5b')]!==undefined){var _0x53e57b=_(_0x23f0e3[_0x72d1('0x16')])[_0x72d1('0x5c')]([_0x36827e[_0x72d1('0x18')][_0x72d1('0x5b')],_0x36827e[_0x72d1('0x1e')]['id']])[_0x72d1('0x5d')](_0x72d1('0x5e'))[_0x72d1('0x5f')]()['value']();return _0x23f0e3[_0x72d1('0x16')][_0x72d1('0x5c')](function(_0x24f5eb){return _0x53e57b[_0x72d1('0x60')](_0x24f5eb['queue_id'])>-0x1;});}else{return _0x23f0e3['rows'][_0x72d1('0x5c')](function(_0x2932bb){return _0x2932bb['queue_id']===parseInt(_0x36827e[_0x72d1('0x1e')]['id']);});}})[_0x72d1('0x8')](respondWithResult(_0x3ef7a3,null))[_0x72d1('0xd')](handleError(_0x3ef7a3,null));};exports[_0x72d1('0x61')]=function(_0x35b9bb,_0x1d1e22){return respondWithRpcPromise(_0x72d1('0x62'),_0x35b9bb[_0x72d1('0x18')],routingClient)['then'](respondWithResult(_0x1d1e22,null))[_0x72d1('0xd')](handleError(_0x1d1e22,null));};exports[_0x72d1('0x63')]=function(_0x38bfd3,_0x3cbe00){return respondWithRpcPromise(_0x72d1('0x64'),_0x38bfd3[_0x72d1('0x18')],routingClient)[_0x72d1('0x8')](respondWithResult(_0x3cbe00,null))[_0x72d1('0xd')](handleError(_0x3cbe00,null));};exports['faxQueuesWaitingInteractions']=function(_0x47585e,_0x466634){return respondWithRpcPromise(_0x72d1('0x65'),_0x47585e[_0x72d1('0x18')],routingClient)[_0x72d1('0x8')](respondWithResult(_0x466634,null))[_0x72d1('0xd')](handleError(_0x466634,null));};exports['queueNotify']=function(_0x1c6547){return function(_0x369153,_0x4a6607){var _0x266fbc,_0x4057ec;var _0x239cdb=_[_0x72d1('0x66')](_0x1c6547);var _0x27c651=_0x1c6547===_0x72d1('0x67')?'Website':_0x72d1('0x68');return db[_0x239cdb+_0x72d1('0x69')]['findOne']({'raw':!![],'where':{'id':_0x369153['params']['id']}})[_0x72d1('0x8')](function(_0x291b67){if(_[_0x72d1('0x14')](_0x291b67)){throw new Error(_0x239cdb+_0x72d1('0x6a'));}_0x266fbc=_0x291b67;return db[_0x239cdb+'Message'][_0x72d1('0x6b')]({'where':{'id':_0x369153[_0x72d1('0x33')][_0x72d1('0x6c')]},'include':[{'model':db[_0x239cdb+_0x72d1('0x6d')],'as':_0x72d1('0x6d')},{'model':db[_0x239cdb+_0x27c651],'as':_0x72d1('0x68')}]});})[_0x72d1('0x8')](function(_0x14a215){if(_['isNil'](_0x14a215)){throw new Error(_0x239cdb+_0x72d1('0x6e'));}_0x4057ec=_0x14a215;return _0x14a215[_0x72d1('0x6f')]({'read':0x0,'readAt':null,'UserId':null});})[_0x72d1('0x8')](function(){var _0x1b06f3={'uniqueid':_0x1c6547+'.'+_0x4057ec['id']+'.'+_0x4057ec['Interaction']['id'],'FromUserId':_0x369153[_0x72d1('0x32')]['id'],'type':_0x72d1('0x70')};_0x1b06f3[_0x239cdb+'MessageId']=_0x4057ec['id'];_0x1b06f3[_0x239cdb+_0x72d1('0x71')]=_0x4057ec['Interaction']['id'];_0x1b06f3[_0x72d1('0x72')+_0x239cdb+_0x27c651+'Id']=_0x4057ec['Account']['id'];_0x1b06f3['To'+_0x239cdb+_0x72d1('0x73')]=_0x266fbc['id'];return db[_0x239cdb+_0x72d1('0x74')][_0x72d1('0x75')](_0x1b06f3);})[_0x72d1('0x8')](function(){return respondWithRpcPromise(_0x72d1('0x76'),{'channel':_0x1c6547,'interaction':_0x4057ec['Interaction'],'message':_0x4057ec,'account':_0x4057ec[_0x72d1('0x68')],'applications':[{'id':0x0,'priority':0x1,'app':_0x72d1('0x70'),'appdata':_0x266fbc[_0x72d1('0x12')]+','+(_0x4057ec['Account'][_0x72d1('0x77')]||0x12c),'interval':_0x72d1('0x78')}]},routingClient);})['then'](respondWithResult(_0x4a6607,null))[_0x72d1('0xd')](handleError(_0x4a6607,null));};};exports[_0x72d1('0x79')]=function(_0x8d4f0d,_0x5c262e){var _0x1d0db0,_0x39d961;if(_[_0x72d1('0x14')](_0x8d4f0d['body'][_0x72d1('0x7a')])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x38a32c=_0x8d4f0d['body'][_0x72d1('0x7a')];var _0x2d45c9=_[_0x72d1('0x66')](_0x38a32c);var _0x21ad86=_0x38a32c==='chat'?_0x72d1('0x7b'):_0x72d1('0x68');return db[_0x72d1('0x7c')][_0x72d1('0x6b')]({'raw':!![],'where':{'id':_0x8d4f0d['params']['id'],'role':_0x72d1('0x7d')}})[_0x72d1('0x8')](function(_0x430905){if(_[_0x72d1('0x14')](_0x430905)){throw new Error(_0x72d1('0x7e'));}_0x1d0db0=_0x430905;return db[_0x2d45c9+_0x72d1('0x7f')][_0x72d1('0x6b')]({'where':{'id':_0x8d4f0d['body']['messageId']},'include':[{'model':db[_0x2d45c9+'Interaction'],'as':_0x72d1('0x6d')},{'model':db[_0x2d45c9+_0x21ad86],'as':'Account'}]});})[_0x72d1('0x8')](function(_0x8f4603){if(_['isNil'](_0x8f4603)){throw new Error(_0x2d45c9+_0x72d1('0x6e'));}_0x39d961=_0x8f4603;return _0x8f4603['update']({'read':0x0,'readAt':null,'UserId':null});})[_0x72d1('0x8')](function(){var _0x378cf0={'uniqueid':_0x38a32c+'.'+_0x39d961['id']+'.'+_0x39d961[_0x72d1('0x6d')]['id'],'FromUserId':_0x8d4f0d[_0x72d1('0x32')]['id'],'type':'queue','ToUserId':_0x1d0db0['id']};_0x378cf0[_0x2d45c9+'MessageId']=_0x39d961['id'];_0x378cf0[_0x2d45c9+_0x72d1('0x71')]=_0x39d961['Interaction']['id'];_0x378cf0['From'+_0x2d45c9+_0x21ad86+'Id']=_0x39d961['Account']['id'];return db[_0x2d45c9+_0x72d1('0x74')][_0x72d1('0x75')](_0x378cf0);})[_0x72d1('0x8')](function(){return respondWithRpcPromise(_0x72d1('0x76'),{'channel':_0x38a32c,'interaction':_0x39d961[_0x72d1('0x6d')],'message':_0x39d961,'account':_0x39d961[_0x72d1('0x68')],'applications':[{'id':0x0,'priority':0x1,'app':_0x72d1('0x7d'),'appdata':_0x1d0db0['name']+','+(_0x39d961['Account'][_0x72d1('0x80')]||0x12c),'interval':_0x72d1('0x78')}]},routingClient);})['then'](respondWithResult(_0x5c262e,null))[_0x72d1('0xd')](handleError(_0x5c262e,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 0b66b28..5ed1194 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 _0xe876=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','get','index','/:id','isAuthenticated','show','/:id/run','run','put','delete','destroy','multer','util','path','connect-timeout'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe876,0x152));var _0x6e87=function(_0x430c7e,_0x289fba){_0x430c7e=_0x430c7e-0x0;var _0x21e758=_0xe876[_0x430c7e];return _0x21e758;};'use strict';var multer=require(_0x6e87('0x0'));var util=require(_0x6e87('0x1'));var path=require(_0x6e87('0x2'));var timeout=require(_0x6e87('0x3'));var express=require(_0x6e87('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x6e87('0x5'));var interaction=require(_0x6e87('0x6'));var config=require(_0x6e87('0x7'));var controller=require(_0x6e87('0x8'));router[_0x6e87('0x9')]('/',auth['isAuthenticated'](),controller[_0x6e87('0xa')]);router[_0x6e87('0x9')](_0x6e87('0xb'),auth[_0x6e87('0xc')](),controller[_0x6e87('0xd')]);router[_0x6e87('0x9')](_0x6e87('0xe'),auth[_0x6e87('0xc')](),controller[_0x6e87('0xf')]);router['post']('/',auth[_0x6e87('0xc')](),controller['create']);router[_0x6e87('0x10')](_0x6e87('0xb'),auth[_0x6e87('0xc')](),controller['update']);router[_0x6e87('0x11')]('/:id',auth[_0x6e87('0xc')](),controller[_0x6e87('0x12')]);module['exports']=router; \ No newline at end of file +var _0x7742=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','isAuthenticated','index','get','/:id','show','run','post','create','put','update','delete','destroy','multer','util','connect-timeout'];(function(_0x385686,_0x253201){var _0x489c2b=function(_0x4078c9){while(--_0x4078c9){_0x385686['push'](_0x385686['shift']());}};_0x489c2b(++_0x253201);}(_0x7742,0x66));var _0x2774=function(_0x5e3d2f,_0x4e023d){_0x5e3d2f=_0x5e3d2f-0x0;var _0x53a35b=_0x7742[_0x5e3d2f];return _0x53a35b;};'use strict';var multer=require(_0x2774('0x0'));var util=require(_0x2774('0x1'));var path=require('path');var timeout=require(_0x2774('0x2'));var express=require('express');var router=express[_0x2774('0x3')]();var fs_extra=require(_0x2774('0x4'));var auth=require(_0x2774('0x5'));var interaction=require(_0x2774('0x6'));var config=require(_0x2774('0x7'));var controller=require(_0x2774('0x8'));router['get']('/',auth[_0x2774('0x9')](),controller[_0x2774('0xa')]);router[_0x2774('0xb')](_0x2774('0xc'),auth['isAuthenticated'](),controller[_0x2774('0xd')]);router['get']('/:id/run',auth['isAuthenticated'](),controller[_0x2774('0xe')]);router[_0x2774('0xf')]('/',auth[_0x2774('0x9')](),controller[_0x2774('0x10')]);router[_0x2774('0x11')](_0x2774('0xc'),auth['isAuthenticated'](),controller[_0x2774('0x12')]);router[_0x2774('0x13')](_0x2774('0xc'),auth[_0x2774('0x9')](),controller[_0x2774('0x14')]);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 8f3ee23..d49f35d 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 _0x8c8c=['STRING','BOOLEAN','DATE','INTEGER','ENUM','years','quarters','weeks','days','hours','minutes','csv','custom','default','TEXT','sequelize'];(function(_0x46cc44,_0x52b73c){var _0x54d8f0=function(_0x4d8584){while(--_0x4d8584){_0x46cc44['push'](_0x46cc44['shift']());}};_0x54d8f0(++_0x52b73c);}(_0x8c8c,0x7f));var _0xc8c8=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x8c8c[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0xc8c8('0x0'));module['exports']={'name':{'type':Sequelize[_0xc8c8('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xc8c8('0x1')]},'active':{'type':Sequelize[_0xc8c8('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xc8c8('0x1')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize[_0xc8c8('0x3')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xc8c8('0x4')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xc8c8('0x5')](_0xc8c8('0x6'),_0xc8c8('0x7'),'months',_0xc8c8('0x8'),_0xc8c8('0x9'),_0xc8c8('0xa'),_0xc8c8('0xb')),'allowNull':![],'defaultValue':_0xc8c8('0x9')},'output':{'type':Sequelize['ENUM'](_0xc8c8('0xc'),'pdf','xlsx'),'allowNull':![],'defaultValue':_0xc8c8('0xc')},'type':{'type':Sequelize[_0xc8c8('0x5')](_0xc8c8('0xd'),_0xc8c8('0xe')),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize[_0xc8c8('0x2')],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xc8c8('0xf')]},'bcc':{'type':Sequelize[_0xc8c8('0xf')]},'sendIfEmpty':{'type':Sequelize[_0xc8c8('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0x641f=['years','quarters','months','days','minutes','pdf','xlsx','csv','custom','default','TEXT','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x641f,0x173));var _0xf641=function(_0x3bff37,_0x210609){_0x3bff37=_0x3bff37-0x0;var _0x253c49=_0x641f[_0x3bff37];return _0x253c49;};'use strict';var Sequelize=require('sequelize');module[_0xf641('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xf641('0x1')]},'active':{'type':Sequelize[_0xf641('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xf641('0x1')],'allowNull':![],'defaultValue':_0xf641('0x3')},'startAt':{'type':Sequelize[_0xf641('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0xf641('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xf641('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xf641('0x6')](_0xf641('0x7'),_0xf641('0x8'),_0xf641('0x9'),'weeks',_0xf641('0xa'),'hours',_0xf641('0xb')),'allowNull':![],'defaultValue':_0xf641('0xa')},'output':{'type':Sequelize[_0xf641('0x6')]('csv',_0xf641('0xc'),_0xf641('0xd')),'allowNull':![],'defaultValue':_0xf641('0xe')},'type':{'type':Sequelize[_0xf641('0x6')](_0xf641('0xf'),_0xf641('0x10')),'allowNull':![],'defaultValue':_0xf641('0xf')},'sendMail':{'type':Sequelize[_0xf641('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0xf641('0x1')]},'cc':{'type':Sequelize[_0xf641('0x11')]},'bcc':{'type':Sequelize[_0xf641('0x11')]},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 53ade66..1af30ef 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 _0x282d=['jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','end','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','destroy','get','Scheduler','UserProfileResource','then','error','stack','name','send','map','Schedule','fieldName','type','key','model','query','intersection','attributes','fields','nolimit','sort','where','filters','filter','merge','VIRTUAL','options','count','include','findAll','rows','catch','show','params','keys','rawAttributes','includeAll','create','body','user','role','find','userProfileId','autoAssociation','update','run','../../config/schedule','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto'];(function(_0x4f3efa,_0xa7d512){var _0x5622ab=function(_0x212b1c){while(--_0x212b1c){_0x4f3efa['push'](_0x4f3efa['shift']());}};_0x5622ab(++_0xa7d512);}(_0x282d,0x1d3));var _0xd282=function(_0x285716,_0x42c462){_0x285716=_0x285716-0x0;var _0x44e6c9=_0x282d[_0x285716];return _0x44e6c9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd282('0x0'));var zipdir=require(_0xd282('0x1'));var jsonpatch=require(_0xd282('0x2'));var rp=require(_0xd282('0x3'));var moment=require(_0xd282('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd282('0x5'));var util=require(_0xd282('0x6'));var path=require(_0xd282('0x7'));var sox=require(_0xd282('0x8'));var csv=require(_0xd282('0x9'));var ejs=require(_0xd282('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xd282('0xb'));var crypto=require(_0xd282('0xc'));var jsforce=require(_0xd282('0xd'));var deskjs=require(_0xd282('0xe'));var toCsv=require(_0xd282('0x9'));var querystring=require(_0xd282('0xf'));var Papa=require('papaparse');var Redis=require(_0xd282('0x10'));var authService=require(_0xd282('0x11'));var qs=require(_0xd282('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd282('0x13'));var logger=require(_0xd282('0x14'))('api');var utils=require(_0xd282('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x286005,_0x5ccb3a){_0x5ccb3a=_0x5ccb3a||0xcc;return function(_0x287a0c){if(_0x287a0c){return _0x286005['sendStatus'](_0x5ccb3a);}return _0x286005['status'](_0x5ccb3a)[_0xd282('0x16')]();};}function respondWithResult(_0x33db5a,_0x594020){_0x594020=_0x594020||0xc8;return function(_0x569b13){if(_0x569b13){return _0x33db5a[_0xd282('0x17')](_0x594020)[_0xd282('0x18')](_0x569b13);}};}function respondWithFilteredResult(_0x357174,_0x174604){return function(_0x3de674){if(_0x3de674){var _0x4c8ace=typeof _0x174604[_0xd282('0x19')]===_0xd282('0x1a')&&typeof _0x174604[_0xd282('0x1b')]===_0xd282('0x1a');var _0xeb622e=_0x3de674['count'];var _0x5ddb18=_0x4c8ace?0x0:_0x174604[_0xd282('0x19')];var _0x1f75bb=_0x4c8ace?_0x3de674['count']:_0x174604[_0xd282('0x19')]+_0x174604[_0xd282('0x1b')];var _0x24d393;if(_0x1f75bb>=_0xeb622e){_0x1f75bb=_0xeb622e;_0x24d393=0xc8;}else{_0x24d393=0xce;}_0x357174[_0xd282('0x17')](_0x24d393);return _0x357174[_0xd282('0x1c')](_0xd282('0x1d'),_0x5ddb18+'-'+_0x1f75bb+'/'+_0xeb622e)['json'](_0x3de674);}return null;};}function patchUpdates(_0x514e40){return function(_0x185640){try{jsonpatch[_0xd282('0x1e')](_0x185640,_0x514e40,!![]);}catch(_0x3586dd){return BPromise[_0xd282('0x1f')](_0x3586dd);}return _0x185640[_0xd282('0x20')]();};}function saveUpdates(_0x1e0ffe,_0x40755e){return function(_0x102de7){if(_0x102de7){return _0x102de7['update'](_0x1e0ffe)['then'](function(_0x1fb5b7){return _0x1fb5b7;});}return null;};}function removeEntity(_0x5ccba7,_0x2de86e){return function(_0x438332){if(_0x438332){return _0x438332[_0xd282('0x21')]()['then'](function(){var _0x12a77f=_0x438332[_0xd282('0x22')]({'plain':!![]});var _0x46c38f=_0xd282('0x23');return db[_0xd282('0x24')][_0xd282('0x21')]({'where':{'type':_0x46c38f,'resourceId':_0x12a77f['id']}})['then'](function(){return _0x438332;});})[_0xd282('0x25')](function(){_0x5ccba7[_0xd282('0x17')](0xcc)[_0xd282('0x16')]();});}};}function handleEntityNotFound(_0x141931,_0x1b401d){return function(_0xd584e9){if(!_0xd584e9){_0x141931['sendStatus'](0x194);}return _0xd584e9;};}function handleError(_0x3954cb,_0x4c3a5d){_0x4c3a5d=_0x4c3a5d||0x1f4;return function(_0x1b7a27){logger[_0xd282('0x26')](_0x1b7a27[_0xd282('0x27')]);if(_0x1b7a27[_0xd282('0x28')]){delete _0x1b7a27[_0xd282('0x28')];}_0x3954cb[_0xd282('0x17')](_0x4c3a5d)[_0xd282('0x29')](_0x1b7a27);};}exports['index']=function(_0x50486c,_0x52ab78){var _0x344a50={},_0x73d2d8={},_0x3e4cea={'count':0x0,'rows':[]};var _0x57eaac=_[_0xd282('0x2a')](db[_0xd282('0x2b')]['rawAttributes'],function(_0x3c367b){return{'name':_0x3c367b[_0xd282('0x2c')],'type':_0x3c367b[_0xd282('0x2d')][_0xd282('0x2e')]};});_0x73d2d8[_0xd282('0x2f')]=_[_0xd282('0x2a')](_0x57eaac,_0xd282('0x28'));_0x73d2d8['query']=_['keys'](_0x50486c[_0xd282('0x30')]);_0x73d2d8['filters']=_[_0xd282('0x31')](_0x73d2d8['model'],_0x73d2d8[_0xd282('0x30')]);_0x344a50[_0xd282('0x32')]=_[_0xd282('0x31')](_0x73d2d8['model'],qs[_0xd282('0x33')](_0x50486c[_0xd282('0x30')]['fields']));_0x344a50[_0xd282('0x32')]=_0x344a50[_0xd282('0x32')]['length']?_0x344a50[_0xd282('0x32')]:_0x73d2d8['model'];if(!_0x50486c[_0xd282('0x30')]['hasOwnProperty'](_0xd282('0x34'))){_0x344a50['limit']=qs[_0xd282('0x1b')](_0x50486c[_0xd282('0x30')][_0xd282('0x1b')]);_0x344a50[_0xd282('0x19')]=qs[_0xd282('0x19')](_0x50486c[_0xd282('0x30')]['offset']);}_0x344a50['order']=qs['sort'](_0x50486c[_0xd282('0x30')][_0xd282('0x35')]);_0x344a50[_0xd282('0x36')]=qs[_0xd282('0x37')](_['pick'](_0x50486c[_0xd282('0x30')],_0x73d2d8[_0xd282('0x37')]),_0x57eaac);if(_0x50486c['query'][_0xd282('0x38')]){_0x344a50[_0xd282('0x36')]=_[_0xd282('0x39')](_0x344a50['where'],{'$or':_[_0xd282('0x2a')](_0x57eaac,function(_0x5267dd){if(_0x5267dd[_0xd282('0x2d')]!==_0xd282('0x3a')){var _0x53bee0={};_0x53bee0[_0x5267dd[_0xd282('0x28')]]={'$like':'%'+_0x50486c[_0xd282('0x30')][_0xd282('0x38')]+'%'};return _0x53bee0;}})});}_0x344a50=_[_0xd282('0x39')]({},_0x344a50,_0x50486c[_0xd282('0x3b')]);var _0x550f13={'where':_0x344a50[_0xd282('0x36')]};return db[_0xd282('0x2b')][_0xd282('0x3c')](_0x550f13)[_0xd282('0x25')](function(_0x402015){_0x3e4cea['count']=_0x402015;if(_0x50486c['query']['includeAll']){_0x344a50[_0xd282('0x3d')]=[{'all':!![]}];}return db[_0xd282('0x2b')][_0xd282('0x3e')](_0x344a50);})[_0xd282('0x25')](function(_0x36ed2a){_0x3e4cea[_0xd282('0x3f')]=_0x36ed2a;return _0x3e4cea;})[_0xd282('0x25')](respondWithFilteredResult(_0x52ab78,_0x344a50))[_0xd282('0x40')](handleError(_0x52ab78,null));};exports[_0xd282('0x41')]=function(_0x79390e,_0x24778e){var _0x1ac688={'raw':![],'where':{'id':_0x79390e[_0xd282('0x42')]['id']}},_0x2a0f8a={};_0x2a0f8a[_0xd282('0x2f')]=_[_0xd282('0x43')](db[_0xd282('0x2b')][_0xd282('0x44')]);_0x2a0f8a[_0xd282('0x30')]=_['keys'](_0x79390e[_0xd282('0x30')]);_0x2a0f8a[_0xd282('0x37')]=_['intersection'](_0x2a0f8a['model'],_0x2a0f8a['query']);_0x1ac688['attributes']=_[_0xd282('0x31')](_0x2a0f8a[_0xd282('0x2f')],qs['fields'](_0x79390e[_0xd282('0x30')][_0xd282('0x33')]));_0x1ac688['attributes']=_0x1ac688['attributes']['length']?_0x1ac688[_0xd282('0x32')]:_0x2a0f8a[_0xd282('0x2f')];if(_0x79390e[_0xd282('0x30')][_0xd282('0x45')]){_0x1ac688[_0xd282('0x3d')]=[{'all':!![]}];}_0x1ac688=_['merge']({},_0x1ac688,_0x79390e['options']);return db['Schedule']['find'](_0x1ac688)['then'](handleEntityNotFound(_0x24778e,null))['then'](respondWithResult(_0x24778e,null))[_0xd282('0x40')](handleError(_0x24778e,null));};exports[_0xd282('0x46')]=function(_0xf43234,_0x5b6125){return db[_0xd282('0x2b')][_0xd282('0x46')](_0xf43234[_0xd282('0x47')],{})[_0xd282('0x25')](function(_0x2b02b0){var _0x39e88d=_0xf43234[_0xd282('0x48')][_0xd282('0x22')]({'plain':!![]});if(!_0x39e88d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x39e88d[_0xd282('0x49')]===_0xd282('0x48')){var _0x531f41=_0x2b02b0[_0xd282('0x22')]({'plain':!![]});var _0x2796d1=_0xd282('0x23');return db['UserProfileSection'][_0xd282('0x4a')]({'where':{'name':_0x2796d1,'userProfileId':_0x39e88d[_0xd282('0x4b')]},'raw':!![]})[_0xd282('0x25')](function(_0x43f779){if(_0x43f779&&_0x43f779[_0xd282('0x4c')]===0x0){return db[_0xd282('0x24')]['create']({'name':_0x531f41[_0xd282('0x28')],'resourceId':_0x531f41['id'],'type':_0x43f779['name'],'sectionId':_0x43f779['id']},{})[_0xd282('0x25')](function(){return _0x2b02b0;});}else{return _0x2b02b0;}})[_0xd282('0x40')](function(_0x3108e1){logger[_0xd282('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3108e1);throw _0x3108e1;});}return _0x2b02b0;})[_0xd282('0x25')](respondWithResult(_0x5b6125,0xc9))[_0xd282('0x40')](handleError(_0x5b6125,null));};exports[_0xd282('0x4d')]=function(_0x2b05eb,_0x3cca89){if(_0x2b05eb[_0xd282('0x47')]['id']){delete _0x2b05eb['body']['id'];}return db[_0xd282('0x2b')][_0xd282('0x4a')]({'where':{'id':_0x2b05eb['params']['id']}})['then'](handleEntityNotFound(_0x3cca89,null))[_0xd282('0x25')](saveUpdates(_0x2b05eb[_0xd282('0x47')],null))[_0xd282('0x25')](respondWithResult(_0x3cca89,null))['catch'](handleError(_0x3cca89,null));};exports[_0xd282('0x21')]=function(_0x436ffc,_0x3763d9){return db[_0xd282('0x2b')]['find']({'where':{'id':_0x436ffc[_0xd282('0x42')]['id']}})[_0xd282('0x25')](handleEntityNotFound(_0x3763d9,null))['then'](removeEntity(_0x3763d9,null))[_0xd282('0x40')](handleError(_0x3763d9,null));};exports[_0xd282('0x4e')]=function(_0x649bb6,_0x37e42a,_0x1372b1){var _0x19b374=require(_0xd282('0x4f'));return db[_0xd282('0x2b')][_0xd282('0x4a')]({'where':{'id':_0x649bb6[_0xd282('0x42')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x37e42a,null))[_0xd282('0x25')](function(){_0x19b374['run'](_0x649bb6['params']['id']);})[_0xd282('0x25')](respondWithStatusCode(_0x37e42a,null))[_0xd282('0x40')](handleError(_0x37e42a,null));}; \ No newline at end of file +var _0xd366=['Unable\x20to\x20retrieve\x20the\x20current\x20user','Scheduler','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','../../config/schedule','run','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','fs-extra','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','end','sendStatus','error','stack','name','index','map','Schedule','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','params','find','create','user'];(function(_0x1b734f,_0x33f10b){var _0x147dc7=function(_0x242470){while(--_0x242470){_0x1b734f['push'](_0x1b734f['shift']());}};_0x147dc7(++_0x33f10b);}(_0xd366,0x1a3));var _0x6d36=function(_0x37b7b6,_0x165a5c){_0x37b7b6=_0x37b7b6-0x0;var _0x10c4c3=_0xd366[_0x37b7b6];return _0x10c4c3;};'use strict';var emlformat=require(_0x6d36('0x0'));var rimraf=require(_0x6d36('0x1'));var zipdir=require(_0x6d36('0x2'));var jsonpatch=require(_0x6d36('0x3'));var rp=require(_0x6d36('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6d36('0x5'));var util=require(_0x6d36('0x6'));var path=require(_0x6d36('0x7'));var sox=require(_0x6d36('0x8'));var csv=require(_0x6d36('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6d36('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x6d36('0xb'));var jsforce=require(_0x6d36('0xc'));var deskjs=require(_0x6d36('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6d36('0xe'));var Redis=require(_0x6d36('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x6d36('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6d36('0x11'));var logger=require(_0x6d36('0x12'))(_0x6d36('0x13'));var utils=require(_0x6d36('0x14'));var config=require(_0x6d36('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xd78027,_0x305f13){_0x305f13=_0x305f13||0xcc;return function(_0x2e6137){if(_0x2e6137){return _0xd78027['sendStatus'](_0x305f13);}return _0xd78027[_0x6d36('0x16')](_0x305f13)['end']();};}function respondWithResult(_0x16e80c,_0x4459c2){_0x4459c2=_0x4459c2||0xc8;return function(_0x37cc73){if(_0x37cc73){return _0x16e80c['status'](_0x4459c2)[_0x6d36('0x17')](_0x37cc73);}};}function respondWithFilteredResult(_0x1fc08c,_0x23d861){return function(_0x3952aa){if(_0x3952aa){var _0x14ab71=typeof _0x23d861[_0x6d36('0x18')]==='undefined'&&typeof _0x23d861[_0x6d36('0x19')]===_0x6d36('0x1a');var _0x208c73=_0x3952aa[_0x6d36('0x1b')];var _0x51f097=_0x14ab71?0x0:_0x23d861[_0x6d36('0x18')];var _0x12b4a5=_0x14ab71?_0x3952aa[_0x6d36('0x1b')]:_0x23d861[_0x6d36('0x18')]+_0x23d861[_0x6d36('0x19')];var _0x4ed3e7;if(_0x12b4a5>=_0x208c73){_0x12b4a5=_0x208c73;_0x4ed3e7=0xc8;}else{_0x4ed3e7=0xce;}_0x1fc08c['status'](_0x4ed3e7);return _0x1fc08c[_0x6d36('0x1c')](_0x6d36('0x1d'),_0x51f097+'-'+_0x12b4a5+'/'+_0x208c73)[_0x6d36('0x17')](_0x3952aa);}return null;};}function patchUpdates(_0x47ec86){return function(_0x2a3b93){try{jsonpatch[_0x6d36('0x1e')](_0x2a3b93,_0x47ec86,!![]);}catch(_0x4ab836){return BPromise[_0x6d36('0x1f')](_0x4ab836);}return _0x2a3b93[_0x6d36('0x20')]();};}function saveUpdates(_0x274984,_0x34d129){return function(_0xae4153){if(_0xae4153){return _0xae4153[_0x6d36('0x21')](_0x274984)[_0x6d36('0x22')](function(_0x43a3e8){return _0x43a3e8;});}return null;};}function removeEntity(_0x57b6cc,_0x541949){return function(_0x9fc059){if(_0x9fc059){return _0x9fc059[_0x6d36('0x23')]()['then'](function(){var _0x492004=_0x9fc059[_0x6d36('0x24')]({'plain':!![]});var _0x173235='Scheduler';return db['UserProfileResource'][_0x6d36('0x23')]({'where':{'type':_0x173235,'resourceId':_0x492004['id']}})[_0x6d36('0x22')](function(){return _0x9fc059;});})[_0x6d36('0x22')](function(){_0x57b6cc[_0x6d36('0x16')](0xcc)[_0x6d36('0x25')]();});}};}function handleEntityNotFound(_0x260cbb,_0x5d2089){return function(_0x1c3beb){if(!_0x1c3beb){_0x260cbb[_0x6d36('0x26')](0x194);}return _0x1c3beb;};}function handleError(_0x477c5d,_0x351d28){_0x351d28=_0x351d28||0x1f4;return function(_0x2728a5){logger[_0x6d36('0x27')](_0x2728a5[_0x6d36('0x28')]);if(_0x2728a5[_0x6d36('0x29')]){delete _0x2728a5['name'];}_0x477c5d[_0x6d36('0x16')](_0x351d28)['send'](_0x2728a5);};}exports[_0x6d36('0x2a')]=function(_0x191824,_0x2578e3){var _0x7f2584={},_0x552cd4={},_0x45a831={'count':0x0,'rows':[]};var _0x4bda39=_[_0x6d36('0x2b')](db[_0x6d36('0x2c')][_0x6d36('0x2d')],function(_0x565ad2){return{'name':_0x565ad2[_0x6d36('0x2e')],'type':_0x565ad2[_0x6d36('0x2f')][_0x6d36('0x30')]};});_0x552cd4[_0x6d36('0x31')]=_['map'](_0x4bda39,_0x6d36('0x29'));_0x552cd4[_0x6d36('0x32')]=_[_0x6d36('0x33')](_0x191824[_0x6d36('0x32')]);_0x552cd4[_0x6d36('0x34')]=_[_0x6d36('0x35')](_0x552cd4[_0x6d36('0x31')],_0x552cd4[_0x6d36('0x32')]);_0x7f2584['attributes']=_[_0x6d36('0x35')](_0x552cd4[_0x6d36('0x31')],qs[_0x6d36('0x36')](_0x191824[_0x6d36('0x32')][_0x6d36('0x36')]));_0x7f2584[_0x6d36('0x37')]=_0x7f2584['attributes'][_0x6d36('0x38')]?_0x7f2584[_0x6d36('0x37')]:_0x552cd4[_0x6d36('0x31')];if(!_0x191824[_0x6d36('0x32')][_0x6d36('0x39')](_0x6d36('0x3a'))){_0x7f2584[_0x6d36('0x19')]=qs[_0x6d36('0x19')](_0x191824[_0x6d36('0x32')]['limit']);_0x7f2584[_0x6d36('0x18')]=qs[_0x6d36('0x18')](_0x191824[_0x6d36('0x32')][_0x6d36('0x18')]);}_0x7f2584['order']=qs['sort'](_0x191824[_0x6d36('0x32')]['sort']);_0x7f2584[_0x6d36('0x3b')]=qs['filters'](_[_0x6d36('0x3c')](_0x191824[_0x6d36('0x32')],_0x552cd4[_0x6d36('0x34')]),_0x4bda39);if(_0x191824[_0x6d36('0x32')]['filter']){_0x7f2584[_0x6d36('0x3b')]=_[_0x6d36('0x3d')](_0x7f2584[_0x6d36('0x3b')],{'$or':_[_0x6d36('0x2b')](_0x4bda39,function(_0x5adb92){if(_0x5adb92[_0x6d36('0x2f')]!==_0x6d36('0x3e')){var _0xab2126={};_0xab2126[_0x5adb92[_0x6d36('0x29')]]={'$like':'%'+_0x191824['query'][_0x6d36('0x3f')]+'%'};return _0xab2126;}})});}_0x7f2584=_['merge']({},_0x7f2584,_0x191824[_0x6d36('0x40')]);var _0x3c6a91={'where':_0x7f2584[_0x6d36('0x3b')]};return db[_0x6d36('0x2c')][_0x6d36('0x1b')](_0x3c6a91)[_0x6d36('0x22')](function(_0x30f7f8){_0x45a831['count']=_0x30f7f8;if(_0x191824['query'][_0x6d36('0x41')]){_0x7f2584[_0x6d36('0x42')]=[{'all':!![]}];}return db['Schedule']['findAll'](_0x7f2584);})[_0x6d36('0x22')](function(_0x419a3f){_0x45a831[_0x6d36('0x43')]=_0x419a3f;return _0x45a831;})[_0x6d36('0x22')](respondWithFilteredResult(_0x2578e3,_0x7f2584))[_0x6d36('0x44')](handleError(_0x2578e3,null));};exports['show']=function(_0x51a870,_0x3972f4){var _0x429d14={'raw':![],'where':{'id':_0x51a870[_0x6d36('0x45')]['id']}},_0x19aee3={};_0x19aee3[_0x6d36('0x31')]=_[_0x6d36('0x33')](db[_0x6d36('0x2c')]['rawAttributes']);_0x19aee3[_0x6d36('0x32')]=_[_0x6d36('0x33')](_0x51a870['query']);_0x19aee3[_0x6d36('0x34')]=_[_0x6d36('0x35')](_0x19aee3['model'],_0x19aee3[_0x6d36('0x32')]);_0x429d14[_0x6d36('0x37')]=_[_0x6d36('0x35')](_0x19aee3[_0x6d36('0x31')],qs[_0x6d36('0x36')](_0x51a870['query']['fields']));_0x429d14['attributes']=_0x429d14[_0x6d36('0x37')][_0x6d36('0x38')]?_0x429d14['attributes']:_0x19aee3[_0x6d36('0x31')];if(_0x51a870['query'][_0x6d36('0x41')]){_0x429d14[_0x6d36('0x42')]=[{'all':!![]}];}_0x429d14=_[_0x6d36('0x3d')]({},_0x429d14,_0x51a870['options']);return db[_0x6d36('0x2c')][_0x6d36('0x46')](_0x429d14)['then'](handleEntityNotFound(_0x3972f4,null))['then'](respondWithResult(_0x3972f4,null))['catch'](handleError(_0x3972f4,null));};exports[_0x6d36('0x47')]=function(_0x1f8fe0,_0x417b00){return db[_0x6d36('0x2c')][_0x6d36('0x47')](_0x1f8fe0['body'],{})[_0x6d36('0x22')](function(_0x545539){var _0x754bbc=_0x1f8fe0[_0x6d36('0x48')][_0x6d36('0x24')]({'plain':!![]});if(!_0x754bbc)throw new Error(_0x6d36('0x49'));if(_0x754bbc['role']===_0x6d36('0x48')){var _0x455d99=_0x545539[_0x6d36('0x24')]({'plain':!![]});var _0x30caf8=_0x6d36('0x4a');return db['UserProfileSection'][_0x6d36('0x46')]({'where':{'name':_0x30caf8,'userProfileId':_0x754bbc[_0x6d36('0x4b')]},'raw':!![]})['then'](function(_0x299db3){if(_0x299db3&&_0x299db3[_0x6d36('0x4c')]===0x0){return db[_0x6d36('0x4d')][_0x6d36('0x47')]({'name':_0x455d99[_0x6d36('0x29')],'resourceId':_0x455d99['id'],'type':_0x299db3[_0x6d36('0x29')],'sectionId':_0x299db3['id']},{})['then'](function(){return _0x545539;});}else{return _0x545539;}})['catch'](function(_0x3687b4){logger[_0x6d36('0x27')](_0x6d36('0x4e'),_0x3687b4);throw _0x3687b4;});}return _0x545539;})['then'](respondWithResult(_0x417b00,0xc9))[_0x6d36('0x44')](handleError(_0x417b00,null));};exports[_0x6d36('0x21')]=function(_0x3e5d81,_0x10540d){if(_0x3e5d81[_0x6d36('0x4f')]['id']){delete _0x3e5d81[_0x6d36('0x4f')]['id'];}return db['Schedule'][_0x6d36('0x46')]({'where':{'id':_0x3e5d81[_0x6d36('0x45')]['id']}})['then'](handleEntityNotFound(_0x10540d,null))[_0x6d36('0x22')](saveUpdates(_0x3e5d81[_0x6d36('0x4f')],null))[_0x6d36('0x22')](respondWithResult(_0x10540d,null))[_0x6d36('0x44')](handleError(_0x10540d,null));};exports['destroy']=function(_0x1b197a,_0x5f69c6){return db['Schedule']['find']({'where':{'id':_0x1b197a['params']['id']}})[_0x6d36('0x22')](handleEntityNotFound(_0x5f69c6,null))[_0x6d36('0x22')](removeEntity(_0x5f69c6,null))[_0x6d36('0x44')](handleError(_0x5f69c6,null));};exports['run']=function(_0x393559,_0x40a936,_0x2fefdb){var _0x25e75d=require(_0x6d36('0x50'));return db['Schedule']['find']({'where':{'id':_0x393559[_0x6d36('0x45')]['id']},'raw':!![]})[_0x6d36('0x22')](handleEntityNotFound(_0x40a936,null))[_0x6d36('0x22')](function(){_0x25e75d[_0x6d36('0x51')](_0x393559[_0x6d36('0x45')]['id']);})[_0x6d36('0x22')](respondWithStatusCode(_0x40a936,null))[_0x6d36('0x44')](handleError(_0x40a936,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 907d391..44f9fb7 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 _0x622f=['moment','bluebird','path','rimraf','../../config/environment','exports','define','Schedule','tools_schedules','lodash','api'];(function(_0x5dfc06,_0x11a761){var _0x5824be=function(_0x3d4df0){while(--_0x3d4df0){_0x5dfc06['push'](_0x5dfc06['shift']());}};_0x5824be(++_0x11a761);}(_0x622f,0x1b6));var _0xf622=function(_0x4a3f01,_0x20687d){_0x4a3f01=_0x4a3f01-0x0;var _0x14fd54=_0x622f[_0x4a3f01];return _0x14fd54;};'use strict';var _=require(_0xf622('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf622('0x1'));var moment=require(_0xf622('0x2'));var BPromise=require(_0xf622('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf622('0x4'));var rimraf=require(_0xf622('0x5'));var config=require(_0xf622('0x6'));var attributes=require('./schedule.attributes');module[_0xf622('0x7')]=function(_0xd97e1d,_0x11e81d){return _0xd97e1d[_0xf622('0x8')](_0xf622('0x9'),attributes,{'tableName':_0xf622('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5c53=['moment','bluebird','path','rimraf','exports','define','Schedule','util','../../config/logger','api'];(function(_0x2ac2dc,_0x5f4b74){var _0x44029d=function(_0x2d522b){while(--_0x2d522b){_0x2ac2dc['push'](_0x2ac2dc['shift']());}};_0x44029d(++_0x5f4b74);}(_0x5c53,0xc5));var _0x35c5=function(_0x4d2786,_0x482295){_0x4d2786=_0x4d2786-0x0;var _0x4a426d=_0x5c53[_0x4d2786];return _0x4a426d;};'use strict';var _=require('lodash');var util=require(_0x35c5('0x0'));var logger=require(_0x35c5('0x1'))(_0x35c5('0x2'));var moment=require(_0x35c5('0x3'));var BPromise=require(_0x35c5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x35c5('0x5'));var rimraf=require(_0x35c5('0x6'));var config=require('../../config/environment');var attributes=require('./schedule.attributes');module[_0x35c5('0x7')]=function(_0x1ca209,_0x56bbc2){return _0x1ca209[_0x35c5('0x8')](_0x35c5('0x9'),attributes,{'tableName':'tools_schedules','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 00ef454..489eafd 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 _0x4853=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','client','http','Schedule,\x20%s,\x20%s','request\x20sent','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch'];(function(_0x1b3101,_0x337dce){var _0x5e7fc6=function(_0x22854c){while(--_0x22854c){_0x1b3101['push'](_0x1b3101['shift']());}};_0x5e7fc6(++_0x337dce);}(_0x4853,0x120));var _0x3485=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4853[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x3485('0x0'));var moment=require(_0x3485('0x1'));var BPromise=require(_0x3485('0x2'));var rs=require(_0x3485('0x3'));var fs=require('fs');var Redis=require(_0x3485('0x4'));var db=require(_0x3485('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3485('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3485('0x7')][_0x3485('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5477b2,_0x6735d6,_0x42c9e3){return new BPromise(function(_0x2469ce,_0x359863){return client['request'](_0x5477b2,_0x42c9e3)['then'](function(_0x4edf35){logger['info'](_0x3485('0x9'),_0x6735d6,_0x3485('0xa'));logger['debug'](_0x3485('0xb'),_0x6735d6,'request\x20sent',JSON[_0x3485('0xc')](_0x4edf35));if(_0x4edf35['error']){if(_0x4edf35[_0x3485('0xd')][_0x3485('0xe')]===0x1f4){logger[_0x3485('0xd')](_0x3485('0x9'),_0x6735d6,_0x4edf35[_0x3485('0xd')][_0x3485('0xf')]);return _0x359863(_0x4edf35[_0x3485('0xd')][_0x3485('0xf')]);}logger[_0x3485('0xd')](_0x3485('0x9'),_0x6735d6,_0x4edf35['error']['message']);return _0x2469ce(_0x4edf35[_0x3485('0xd')]['message']);}else{logger[_0x3485('0x10')]('Schedule,\x20%s,\x20%s',_0x6735d6,_0x3485('0xa'));_0x2469ce(_0x4edf35['result'][_0x3485('0xf')]);}})[_0x3485('0x11')](function(_0x44eb9a){logger['error']('Schedule,\x20%s,\x20%s',_0x6735d6,_0x44eb9a);_0x359863(_0x44eb9a);});});} \ No newline at end of file +var _0xacd2=['info','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','Schedule,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x346226,_0x3a0a0d){var _0x5bc810=function(_0x570e5b){while(--_0x570e5b){_0x346226['push'](_0x346226['shift']());}};_0x5bc810(++_0x3a0a0d);}(_0xacd2,0xa1));var _0x2acd=function(_0x1b7fcc,_0x442329){_0x1b7fcc=_0x1b7fcc-0x0;var _0x25eee3=_0xacd2[_0x1b7fcc];return _0x25eee3;};'use strict';var _=require(_0x2acd('0x0'));var util=require(_0x2acd('0x1'));var moment=require(_0x2acd('0x2'));var BPromise=require(_0x2acd('0x3'));var rs=require(_0x2acd('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2acd('0x5'))['db'];var utils=require(_0x2acd('0x6'));var logger=require(_0x2acd('0x7'))('rpc');var config=require(_0x2acd('0x8'));var jayson=require(_0x2acd('0x9'));var client=jayson[_0x2acd('0xa')][_0x2acd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x40dc81,_0x4ee5bf,_0x528f1f){return new BPromise(function(_0x4967d0,_0x2f7cfc){return client[_0x2acd('0xc')](_0x40dc81,_0x528f1f)[_0x2acd('0xd')](function(_0x2a2914){logger[_0x2acd('0xe')]('Schedule,\x20%s,\x20%s',_0x4ee5bf,_0x2acd('0xf'));logger[_0x2acd('0x10')](_0x2acd('0x11'),_0x4ee5bf,_0x2acd('0xf'),JSON[_0x2acd('0x12')](_0x2a2914));if(_0x2a2914[_0x2acd('0x13')]){if(_0x2a2914[_0x2acd('0x13')][_0x2acd('0x14')]===0x1f4){logger[_0x2acd('0x13')](_0x2acd('0x15'),_0x4ee5bf,_0x2a2914[_0x2acd('0x13')][_0x2acd('0x16')]);return _0x2f7cfc(_0x2a2914[_0x2acd('0x13')]['message']);}logger[_0x2acd('0x13')](_0x2acd('0x15'),_0x4ee5bf,_0x2a2914['error'][_0x2acd('0x16')]);return _0x4967d0(_0x2a2914[_0x2acd('0x13')][_0x2acd('0x16')]);}else{logger['info'](_0x2acd('0x15'),_0x4ee5bf,_0x2acd('0xf'));_0x4967d0(_0x2a2914[_0x2acd('0x17')][_0x2acd('0x16')]);}})[_0x2acd('0x18')](function(_0x53f1ee){logger[_0x2acd('0x13')](_0x2acd('0x15'),_0x4ee5bf,_0x53f1ee);_0x2f7cfc(_0x53f1ee);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index eef6678..074f741 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 _0x1b25=['destroy','exports','util','connect-timeout','express','Router','fs-extra','../../config/environment','get','isAuthenticated','index','/:id','show','download','put','update','delete'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x1b25,0x79));var _0x51b2=function(_0x3b48ee,_0x47ff10){_0x3b48ee=_0x3b48ee-0x0;var _0x50023d=_0x1b25[_0x3b48ee];return _0x50023d;};'use strict';var multer=require('multer');var util=require(_0x51b2('0x0'));var path=require('path');var timeout=require(_0x51b2('0x1'));var express=require(_0x51b2('0x2'));var router=express[_0x51b2('0x3')]();var fs_extra=require(_0x51b2('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x51b2('0x5'));var controller=require('./screenRecording.controller');router[_0x51b2('0x6')]('/',auth[_0x51b2('0x7')](),controller[_0x51b2('0x8')]);router[_0x51b2('0x6')]('/describe',auth[_0x51b2('0x7')](),controller['describe']);router[_0x51b2('0x6')](_0x51b2('0x9'),auth[_0x51b2('0x7')](),controller[_0x51b2('0xa')]);router['get']('/:id/download',auth[_0x51b2('0x7')](),controller[_0x51b2('0xb')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x51b2('0xc')]('/:id',auth[_0x51b2('0x7')](),controller[_0x51b2('0xd')]);router[_0x51b2('0xe')](_0x51b2('0x9'),auth[_0x51b2('0x7')](),controller[_0x51b2('0xf')]);module[_0x51b2('0x10')]=router; \ No newline at end of file +var _0xfb2f=['delete','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','index','/describe','/:id','isAuthenticated','show','/:id/download','create'];(function(_0x83c716,_0x25152d){var _0xab9893=function(_0x9b3f0a){while(--_0x9b3f0a){_0x83c716['push'](_0x83c716['shift']());}};_0xab9893(++_0x25152d);}(_0xfb2f,0x112));var _0xffb2=function(_0x4f6464,_0x40b3e9){_0x4f6464=_0x4f6464-0x0;var _0x303f74=_0xfb2f[_0x4f6464];return _0x303f74;};'use strict';var multer=require(_0xffb2('0x0'));var util=require('util');var path=require(_0xffb2('0x1'));var timeout=require('connect-timeout');var express=require(_0xffb2('0x2'));var router=express[_0xffb2('0x3')]();var fs_extra=require(_0xffb2('0x4'));var auth=require(_0xffb2('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xffb2('0x6'));var controller=require('./screenRecording.controller');router[_0xffb2('0x7')]('/',auth['isAuthenticated'](),controller[_0xffb2('0x8')]);router['get'](_0xffb2('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0xffb2('0x7')](_0xffb2('0xa'),auth[_0xffb2('0xb')](),controller[_0xffb2('0xc')]);router['get'](_0xffb2('0xd'),auth[_0xffb2('0xb')](),controller['download']);router['post']('/',auth['isAuthenticated'](),controller[_0xffb2('0xe')]);router['put'](_0xffb2('0xa'),auth[_0xffb2('0xb')](),controller['update']);router[_0xffb2('0xf')](_0xffb2('0xa'),auth[_0xffb2('0xb')](),controller[_0xffb2('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 7f81f0a..9111edf 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 _0x18c9=['createdAt','sequelize','moment','path','../../config/environment','exports','VIRTUAL','value','extname','STRING','replace','setDataValue','startedAt','subtract','closedAt','duration','format','MM-DD-YYYY\x20HH:mm','toString','DATE','getDataValue'];(function(_0x3be7ff,_0x12e714){var _0x186721=function(_0x2bc9e1){while(--_0x2bc9e1){_0x3be7ff['push'](_0x3be7ff['shift']());}};_0x186721(++_0x12e714);}(_0x18c9,0x13c));var _0x918c=function(_0x3f4891,_0x4e6f62){_0x3f4891=_0x3f4891-0x0;var _0x54f2d8=_0x18c9[_0x3f4891];return _0x54f2d8;};'use strict';var Sequelize=require(_0x918c('0x0'));var moment=require(_0x918c('0x1'));var path=require(_0x918c('0x2'));var config=require(_0x918c('0x3'));module[_0x918c('0x4')]={'format':{'type':Sequelize[_0x918c('0x5')],'get':function(){return this['getDataValue'](_0x918c('0x6'))?path[_0x918c('0x7')](this['getDataValue'](_0x918c('0x6'))):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x918c('0x8')]},'value':{'type':Sequelize[_0x918c('0x8')],'set':function(_0x467d0b){var _0x2aa435=_0x467d0b[_0x918c('0x9')](/\\/g,'/');this['setDataValue'](_0x918c('0x6'),_0x2aa435);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0xc0b338){this[_0x918c('0xa')](_0x918c('0xb'),moment()[_0x918c('0xc')](_0xc0b338,'ms'));this[_0x918c('0xa')](_0x918c('0xd'),moment());this[_0x918c('0xa')](_0x918c('0xe'),_0xc0b338);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0x918c('0xb')))[_0x918c('0xf')](_0x918c('0x10'))[_0x918c('0x11')]();}},'closedAt':{'type':Sequelize[_0x918c('0x12')],'get':function(){return moment(this['getDataValue'](_0x918c('0xd')))[_0x918c('0xf')](_0x918c('0x10'))[_0x918c('0x11')]();}},'createdAt':{'type':Sequelize[_0x918c('0x12')],'get':function(){return moment(this[_0x918c('0x13')](_0x918c('0x14')))[_0x918c('0xf')](_0x918c('0x10'))['toString']();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue']('updatedAt'))['format'](_0x918c('0x10'))['toString']();}}}; \ No newline at end of file +var _0xc177=['extname','STRING','replace','setDataValue','INTEGER','startedAt','subtract','duration','DATE','format','MM-DD-YYYY\x20HH:mm','toString','closedAt','updatedAt','sequelize','moment','path','../../config/environment','exports','getDataValue','value'];(function(_0x1c4ce6,_0x2ff5d0){var _0x51f934=function(_0x10cd2d){while(--_0x10cd2d){_0x1c4ce6['push'](_0x1c4ce6['shift']());}};_0x51f934(++_0x2ff5d0);}(_0xc177,0x1b2));var _0x7c17=function(_0x2cc0f4,_0x7b29f1){_0x2cc0f4=_0x2cc0f4-0x0;var _0x21073a=_0xc177[_0x2cc0f4];return _0x21073a;};'use strict';var Sequelize=require(_0x7c17('0x0'));var moment=require(_0x7c17('0x1'));var path=require(_0x7c17('0x2'));var config=require(_0x7c17('0x3'));module[_0x7c17('0x4')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x7c17('0x5')](_0x7c17('0x6'))?path[_0x7c17('0x7')](this[_0x7c17('0x5')]('value')):undefined;}},'interactionid':{'type':Sequelize[_0x7c17('0x8')]},'channel':{'type':Sequelize[_0x7c17('0x8')]},'value':{'type':Sequelize[_0x7c17('0x8')],'set':function(_0x4810b7){var _0x3ab87c=_0x4810b7[_0x7c17('0x9')](/\\/g,'/');this[_0x7c17('0xa')](_0x7c17('0x6'),_0x3ab87c);}},'rating':{'type':Sequelize[_0x7c17('0xb')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x7c17('0xb')],'set':function(_0x44e782){this[_0x7c17('0xa')](_0x7c17('0xc'),moment()[_0x7c17('0xd')](_0x44e782,'ms'));this['setDataValue']('closedAt',moment());this['setDataValue'](_0x7c17('0xe'),_0x44e782);}},'startedAt':{'type':Sequelize[_0x7c17('0xf')],'get':function(){return moment(this[_0x7c17('0x5')]('startedAt'))[_0x7c17('0x10')](_0x7c17('0x11'))[_0x7c17('0x12')]();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0x7c17('0x13')))[_0x7c17('0x10')]('MM-DD-YYYY\x20HH:mm')[_0x7c17('0x12')]();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x7c17('0x5')]('createdAt'))[_0x7c17('0x10')](_0x7c17('0x11'))[_0x7c17('0x12')]();}},'updatedAt':{'type':Sequelize[_0x7c17('0xf')],'get':function(){return moment(this[_0x7c17('0x5')](_0x7c17('0x14')))[_0x7c17('0x10')](_0x7c17('0x11'))[_0x7c17('0x12')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 6755cad..7316fef 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 _0x5fd1=['body','duration','createdAt','closedAt','describe','../../components/encryptor','uniqueid','join','value','format','%s.cypher','decryptFile','secrets','recording','root','server/files/screen_recordings','existsSync','Sequelize','filename','download','extname','unlink','message','ScreenRecording\x20not\x20found','Not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','offset','set','Content-Range','apply','update','then','destroy','end','error','name','send','index','map','ScreenRecording','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','type','VIRTUAL','filter','options','count','include','findAll','rows','catch','show','params','rawAttributes','merge','find','create'];(function(_0x4668a6,_0x4e8a1f){var _0x23215d=function(_0x4f4cfc){while(--_0x4f4cfc){_0x4668a6['push'](_0x4668a6['shift']());}};_0x23215d(++_0x4e8a1f);}(_0x5fd1,0x155));var _0x15fd=function(_0x55a046,_0x2d0ad1){_0x55a046=_0x55a046-0x0;var _0x2489b0=_0x5fd1[_0x55a046];return _0x2489b0;};'use strict';var emlformat=require(_0x15fd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x15fd('0x1'));var jsonpatch=require(_0x15fd('0x2'));var rp=require(_0x15fd('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x15fd('0x4'));var util=require(_0x15fd('0x5'));var path=require(_0x15fd('0x6'));var sox=require('sox');var csv=require(_0x15fd('0x7'));var ejs=require(_0x15fd('0x8'));var fs=require('fs');var fs_extra=require(_0x15fd('0x9'));var _=require(_0x15fd('0xa'));var squel=require(_0x15fd('0xb'));var crypto=require('crypto');var jsforce=require(_0x15fd('0xc'));var deskjs=require(_0x15fd('0xd'));var toCsv=require(_0x15fd('0x7'));var querystring=require('querystring');var Papa=require(_0x15fd('0xe'));var Redis=require('ioredis');var authService=require(_0x15fd('0xf'));var qs=require(_0x15fd('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x15fd('0x11'));var utils=require(_0x15fd('0x12'));var config=require(_0x15fd('0x13'));var licenseUtil=require(_0x15fd('0x14'));var db=require(_0x15fd('0x15'))['db'];function respondWithStatusCode(_0x2e18ec,_0x346ab1){_0x346ab1=_0x346ab1||0xcc;return function(_0x2660db){if(_0x2660db){return _0x2e18ec[_0x15fd('0x16')](_0x346ab1);}return _0x2e18ec['status'](_0x346ab1)['end']();};}function respondWithResult(_0x5784a3,_0x3fda60){_0x3fda60=_0x3fda60||0xc8;return function(_0x135a15){if(_0x135a15){return _0x5784a3[_0x15fd('0x17')](_0x3fda60)[_0x15fd('0x18')](_0x135a15);}};}function respondWithFilteredResult(_0x44eae6,_0x2ffa03){return function(_0x2c5375){if(_0x2c5375){var _0x44a63a=typeof _0x2ffa03['offset']==='undefined'&&typeof _0x2ffa03[_0x15fd('0x19')]==='undefined';var _0x7afe9c=_0x2c5375['count'];var _0x917fe4=_0x44a63a?0x0:_0x2ffa03[_0x15fd('0x1a')];var _0x855bae=_0x44a63a?_0x2c5375['count']:_0x2ffa03[_0x15fd('0x1a')]+_0x2ffa03[_0x15fd('0x19')];var _0x8b7b9e;if(_0x855bae>=_0x7afe9c){_0x855bae=_0x7afe9c;_0x8b7b9e=0xc8;}else{_0x8b7b9e=0xce;}_0x44eae6[_0x15fd('0x17')](_0x8b7b9e);return _0x44eae6[_0x15fd('0x1b')](_0x15fd('0x1c'),_0x917fe4+'-'+_0x855bae+'/'+_0x7afe9c)[_0x15fd('0x18')](_0x2c5375);}return null;};}function patchUpdates(_0x2f46f1){return function(_0x1b8b9f){try{jsonpatch[_0x15fd('0x1d')](_0x1b8b9f,_0x2f46f1,!![]);}catch(_0x3ff307){return BPromise['reject'](_0x3ff307);}return _0x1b8b9f['save']();};}function saveUpdates(_0x293d7b,_0x36b21e){return function(_0x252a1c){if(_0x252a1c){return _0x252a1c[_0x15fd('0x1e')](_0x293d7b)[_0x15fd('0x1f')](function(_0x11496a){return _0x11496a;});}return null;};}function removeEntity(_0x2073da,_0x50d493){return function(_0x40d43){if(_0x40d43){return _0x40d43[_0x15fd('0x20')]()[_0x15fd('0x1f')](function(){_0x2073da['status'](0xcc)[_0x15fd('0x21')]();});}};}function handleEntityNotFound(_0x49062f,_0x3d1835){return function(_0x1fc24f){if(!_0x1fc24f){_0x49062f[_0x15fd('0x16')](0x194);}return _0x1fc24f;};}function handleError(_0x4c9708,_0x16b87c){_0x16b87c=_0x16b87c||0x1f4;return function(_0x1cbf2c){logger[_0x15fd('0x22')](_0x1cbf2c['stack']);if(_0x1cbf2c[_0x15fd('0x23')]){delete _0x1cbf2c['name'];}_0x4c9708[_0x15fd('0x17')](_0x16b87c)[_0x15fd('0x24')](_0x1cbf2c);};}exports[_0x15fd('0x25')]=function(_0x27d2c4,_0x233ed3){var _0x6c213b={},_0x218034={},_0xe650a3={'count':0x0,'rows':[]};var _0x4590a1=_[_0x15fd('0x26')](db[_0x15fd('0x27')]['rawAttributes'],function(_0x47c22c){return{'name':_0x47c22c[_0x15fd('0x28')],'type':_0x47c22c['type'][_0x15fd('0x29')]};});_0x218034[_0x15fd('0x2a')]=_['differenceBy'](_[_0x15fd('0x26')](_0x4590a1,_0x15fd('0x23')),['format']);_0x218034[_0x15fd('0x2b')]=_[_0x15fd('0x2c')](_0x27d2c4[_0x15fd('0x2b')]);_0x218034[_0x15fd('0x2d')]=_[_0x15fd('0x2e')](_0x218034[_0x15fd('0x2a')],_0x218034['query']);_0x6c213b[_0x15fd('0x2f')]=_[_0x15fd('0x2e')](_0x218034[_0x15fd('0x2a')],qs[_0x15fd('0x30')](_0x27d2c4['query'][_0x15fd('0x30')]));_0x6c213b[_0x15fd('0x2f')]=_0x6c213b[_0x15fd('0x2f')][_0x15fd('0x31')]?_0x6c213b[_0x15fd('0x2f')]:_0x218034[_0x15fd('0x2a')];if(!_0x27d2c4['query'][_0x15fd('0x32')](_0x15fd('0x33'))){_0x6c213b['limit']=qs[_0x15fd('0x19')](_0x27d2c4[_0x15fd('0x2b')][_0x15fd('0x19')]);_0x6c213b['offset']=qs[_0x15fd('0x1a')](_0x27d2c4[_0x15fd('0x2b')][_0x15fd('0x1a')]);}_0x6c213b[_0x15fd('0x34')]=qs[_0x15fd('0x35')](_0x27d2c4[_0x15fd('0x2b')]['sort']);_0x6c213b['where']=qs['filters'](_[_0x15fd('0x36')](_0x27d2c4[_0x15fd('0x2b')],_0x218034[_0x15fd('0x2d')]),_0x4590a1);if(_0x27d2c4['query']['filter']){_0x6c213b[_0x15fd('0x37')]=_['merge'](_0x6c213b['where'],{'$or':_['map'](_0x4590a1,function(_0x2edb0d){if(_0x2edb0d[_0x15fd('0x38')]!==_0x15fd('0x39')){var _0x59d0d7={};_0x59d0d7[_0x2edb0d[_0x15fd('0x23')]]={'$like':'%'+_0x27d2c4[_0x15fd('0x2b')][_0x15fd('0x3a')]+'%'};return _0x59d0d7;}})});}_0x6c213b=_['merge']({},_0x6c213b,_0x27d2c4[_0x15fd('0x3b')]);var _0x1c4d40={'where':_0x6c213b[_0x15fd('0x37')]};return db[_0x15fd('0x27')][_0x15fd('0x3c')](_0x1c4d40)[_0x15fd('0x1f')](function(_0x19a29f){_0xe650a3[_0x15fd('0x3c')]=_0x19a29f;if(_0x27d2c4[_0x15fd('0x2b')]['includeAll']){_0x6c213b[_0x15fd('0x3d')]=[{'all':!![]}];}return db[_0x15fd('0x27')][_0x15fd('0x3e')](_0x6c213b);})[_0x15fd('0x1f')](function(_0x2d2b6f){_0xe650a3[_0x15fd('0x3f')]=_0x2d2b6f;return _0xe650a3;})[_0x15fd('0x1f')](respondWithFilteredResult(_0x233ed3,_0x6c213b))[_0x15fd('0x40')](handleError(_0x233ed3,null));};exports[_0x15fd('0x41')]=function(_0x104eef,_0x2eb6b6){var _0x145eab={'raw':![],'where':{'id':_0x104eef[_0x15fd('0x42')]['id']}},_0x269aae={};_0x269aae[_0x15fd('0x2a')]=_['keys'](db[_0x15fd('0x27')][_0x15fd('0x43')]);_0x269aae[_0x15fd('0x2b')]=_[_0x15fd('0x2c')](_0x104eef[_0x15fd('0x2b')]);_0x269aae[_0x15fd('0x2d')]=_[_0x15fd('0x2e')](_0x269aae[_0x15fd('0x2a')],_0x269aae['query']);_0x145eab['attributes']=_[_0x15fd('0x2e')](_0x269aae['model'],qs[_0x15fd('0x30')](_0x104eef[_0x15fd('0x2b')]['fields']));_0x145eab[_0x15fd('0x2f')]=_0x145eab[_0x15fd('0x2f')][_0x15fd('0x31')]?_0x145eab[_0x15fd('0x2f')]:_0x269aae[_0x15fd('0x2a')];if(_0x104eef[_0x15fd('0x2b')]['includeAll']){_0x145eab[_0x15fd('0x3d')]=[{'all':!![]}];}_0x145eab=_[_0x15fd('0x44')]({},_0x145eab,_0x104eef[_0x15fd('0x3b')]);return db[_0x15fd('0x27')][_0x15fd('0x45')](_0x145eab)[_0x15fd('0x1f')](handleEntityNotFound(_0x2eb6b6,null))[_0x15fd('0x1f')](respondWithResult(_0x2eb6b6,null))[_0x15fd('0x40')](handleError(_0x2eb6b6,null));};exports[_0x15fd('0x46')]=function(_0x1d3beb,_0x16b4f5){return db[_0x15fd('0x27')]['create'](_0x1d3beb[_0x15fd('0x47')],{})['then'](respondWithResult(_0x16b4f5,0xc9))[_0x15fd('0x40')](handleError(_0x16b4f5,null));};exports[_0x15fd('0x1e')]=function(_0xeb1e06,_0x5a1f32){if(_0xeb1e06[_0x15fd('0x47')]['id']){delete _0xeb1e06[_0x15fd('0x47')]['id'];}delete _0xeb1e06[_0x15fd('0x47')][_0x15fd('0x48')];delete _0xeb1e06['body'][_0x15fd('0x49')];delete _0xeb1e06[_0x15fd('0x47')][_0x15fd('0x4a')];delete _0xeb1e06[_0x15fd('0x47')]['value'];return db[_0x15fd('0x27')][_0x15fd('0x45')]({'where':{'id':_0xeb1e06['params']['id']}})['then'](handleEntityNotFound(_0x5a1f32,null))['then'](saveUpdates(_0xeb1e06[_0x15fd('0x47')],null))[_0x15fd('0x1f')](respondWithResult(_0x5a1f32,null))[_0x15fd('0x40')](handleError(_0x5a1f32,null));};exports[_0x15fd('0x4b')]=function(_0x292174,_0x33a128){return db['ScreenRecording'][_0x15fd('0x4b')]()[_0x15fd('0x1f')](respondWithResult(_0x33a128,null))[_0x15fd('0x40')](handleError(_0x33a128,null));};exports['download']=function(_0x30c4e3,_0x4dd1d5,_0x3a48e7){var _0x2886e3=require(_0x15fd('0x4c'));var _0x42d4de=![];var _0x332df7={};if(_0x30c4e3[_0x15fd('0x2b')][_0x15fd('0x38')]&&_0x30c4e3[_0x15fd('0x2b')][_0x15fd('0x38')]===_0x15fd('0x4d')){_0x332df7[_0x15fd('0x4d')]=_0x30c4e3[_0x15fd('0x42')]['id'];}else{_0x332df7['id']=_0x30c4e3[_0x15fd('0x42')]['id'];}return db['ScreenRecording'][_0x15fd('0x45')]({'where':_0x332df7,'attributes':['id','value'],'raw':!![]})[_0x15fd('0x1f')](handleEntityNotFound(_0x4dd1d5,null))['then'](function(_0x25bdea){if(_0x25bdea){var _0x1fac7f=path[_0x15fd('0x4e')](config['root'],'server/files/screen_recordings',_0x25bdea[_0x15fd('0x4f')]);var _0xc9c5ef=util[_0x15fd('0x50')](_0x15fd('0x51'),_0x1fac7f);if(fs['existsSync'](_0xc9c5ef)){_0x42d4de=!![];return _0x2886e3[_0x15fd('0x52')](_0xc9c5ef,_0x1fac7f,config[_0x15fd('0x53')][_0x15fd('0x54')])[_0x15fd('0x1f')](function(){return _0x25bdea;});}return _0x25bdea;}})[_0x15fd('0x1f')](function(_0x321fe7){if(_0x321fe7){var _0x59b3b4=path[_0x15fd('0x4e')](config[_0x15fd('0x55')],_0x15fd('0x56'),_0x321fe7[_0x15fd('0x4f')]);if(!fs[_0x15fd('0x57')](_0x59b3b4)){throw new db[(_0x15fd('0x58'))]['ValidationError']('ScreenRecording\x20not\x20found');}if(_0x321fe7[_0x15fd('0x59')]){return _0x4dd1d5[_0x15fd('0x5a')](_0x59b3b4,_0x321fe7['filename']+path[_0x15fd('0x5b')](_0x59b3b4),function(){if(_0x42d4de){fs[_0x15fd('0x5c')](_0x59b3b4);}});}else{return _0x4dd1d5['download'](_0x59b3b4,function(_0x285fd5){if(_0x42d4de){fs[_0x15fd('0x5c')](_0x59b3b4);}});}}})[_0x15fd('0x40')](function(_0x53bfd7){if(_0x53bfd7[_0x15fd('0x5d')]===_0x15fd('0x5e')){_0x4dd1d5[_0x15fd('0x17')](0x194)[_0x15fd('0x24')](_0x15fd('0x5f'));}else{return handleError(_0x4dd1d5,null);}});};exports[_0x15fd('0x20')]=function(_0xa1bb5c,_0x290497){return db[_0x15fd('0x27')][_0x15fd('0x45')]({'where':{'id':_0xa1bb5c['params']['id']}})[_0x15fd('0x1f')](function(_0x3a26c8){if(_['isNil'](_0x3a26c8)){throw new ReferenceError('Entity\x20not\x20found');}return _0x3a26c8;})[_0x15fd('0x1f')](function(_0x39e6ee){var _0x2bd6ef=path[_0x15fd('0x4e')](config[_0x15fd('0x55')],_0x15fd('0x56'),_0x39e6ee['value']);logger[_0x15fd('0x60')](_0x15fd('0x61'),_0x2bd6ef);if(!_[_0x15fd('0x62')](_0x39e6ee[_0x15fd('0x4f')])&&fs[_0x15fd('0x57')](_0x2bd6ef)){logger[_0x15fd('0x60')](_0x15fd('0x63')+_0x2bd6ef+_0x15fd('0x64'));fs[_0x15fd('0x65')](_0x2bd6ef);}_0x2bd6ef=_0x2bd6ef+_0x15fd('0x66');if(!_[_0x15fd('0x62')](_0x39e6ee['value'])&&fs['existsSync'](_0x2bd6ef)){logger[_0x15fd('0x60')](_0x15fd('0x63')+_0x2bd6ef+_0x15fd('0x64'));fs[_0x15fd('0x65')](_0x2bd6ef);}return _0x39e6ee;})[_0x15fd('0x1f')](function(_0xfa3aa1){if(!_0xfa3aa1)throw new InternalError();return _0xfa3aa1[_0x15fd('0x20')]();})['then'](function(){_0x290497[_0x15fd('0x17')](0xcc)['end']();})[_0x15fd('0x40')](handleError(_0x290497,null));}; \ No newline at end of file +var _0x9c5a=['ScreenRecording','includeAll','findAll','rows','catch','params','include','find','create','body','duration','createdAt','closedAt','value','describe','download','uniqueid','join','root','server/files/screen_recordings','%s.cypher','decryptFile','recording','existsSync','Sequelize','ScreenRecording\x20not\x20found','filename','unlink','message','Not\x20found','destroy','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','stack','name','send','map','rawAttributes','fieldName','key','model','format','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0xc27d55,_0x542b08){_0xc27d55=_0xc27d55-0x0;var _0x4dffe8=_0x9c5a[_0xc27d55];return _0x4dffe8;};'use strict';var emlformat=require(_0xa9c5('0x0'));var rimraf=require(_0xa9c5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa9c5('0x2'));var rp=require(_0xa9c5('0x3'));var moment=require(_0xa9c5('0x4'));var BPromise=require(_0xa9c5('0x5'));var Mustache=require('mustache');var util=require(_0xa9c5('0x6'));var path=require(_0xa9c5('0x7'));var sox=require('sox');var csv=require(_0xa9c5('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa9c5('0x9'));var _=require(_0xa9c5('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa9c5('0xb'));var deskjs=require(_0xa9c5('0xc'));var toCsv=require('to-csv');var querystring=require(_0xa9c5('0xd'));var Papa=require(_0xa9c5('0xe'));var Redis=require('ioredis');var authService=require(_0xa9c5('0xf'));var qs=require(_0xa9c5('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa9c5('0x11'))(_0xa9c5('0x12'));var utils=require(_0xa9c5('0x13'));var config=require(_0xa9c5('0x14'));var licenseUtil=require(_0xa9c5('0x15'));var db=require(_0xa9c5('0x16'))['db'];function respondWithStatusCode(_0x51c8d,_0x42d5cf){_0x42d5cf=_0x42d5cf||0xcc;return function(_0x3c5ac7){if(_0x3c5ac7){return _0x51c8d[_0xa9c5('0x17')](_0x42d5cf);}return _0x51c8d['status'](_0x42d5cf)[_0xa9c5('0x18')]();};}function respondWithResult(_0x1276d2,_0x7df76d){_0x7df76d=_0x7df76d||0xc8;return function(_0x3806c4){if(_0x3806c4){return _0x1276d2[_0xa9c5('0x19')](_0x7df76d)[_0xa9c5('0x1a')](_0x3806c4);}};}function respondWithFilteredResult(_0x251099,_0x40b001){return function(_0x19a43e){if(_0x19a43e){var _0xcf13f2=typeof _0x40b001['offset']===_0xa9c5('0x1b')&&typeof _0x40b001[_0xa9c5('0x1c')]===_0xa9c5('0x1b');var _0x55cce5=_0x19a43e[_0xa9c5('0x1d')];var _0x1142d9=_0xcf13f2?0x0:_0x40b001[_0xa9c5('0x1e')];var _0x3b8cf7=_0xcf13f2?_0x19a43e[_0xa9c5('0x1d')]:_0x40b001[_0xa9c5('0x1e')]+_0x40b001[_0xa9c5('0x1c')];var _0x1e5ce6;if(_0x3b8cf7>=_0x55cce5){_0x3b8cf7=_0x55cce5;_0x1e5ce6=0xc8;}else{_0x1e5ce6=0xce;}_0x251099[_0xa9c5('0x19')](_0x1e5ce6);return _0x251099[_0xa9c5('0x1f')](_0xa9c5('0x20'),_0x1142d9+'-'+_0x3b8cf7+'/'+_0x55cce5)[_0xa9c5('0x1a')](_0x19a43e);}return null;};}function patchUpdates(_0x54f8b9){return function(_0x1115ad){try{jsonpatch[_0xa9c5('0x21')](_0x1115ad,_0x54f8b9,!![]);}catch(_0x541c77){return BPromise['reject'](_0x541c77);}return _0x1115ad[_0xa9c5('0x22')]();};}function saveUpdates(_0x366f5c,_0x10b208){return function(_0x3b497a){if(_0x3b497a){return _0x3b497a[_0xa9c5('0x23')](_0x366f5c)[_0xa9c5('0x24')](function(_0x48e2cb){return _0x48e2cb;});}return null;};}function removeEntity(_0x4fa280,_0x3d4e1b){return function(_0x11d395){if(_0x11d395){return _0x11d395['destroy']()[_0xa9c5('0x24')](function(){_0x4fa280[_0xa9c5('0x19')](0xcc)[_0xa9c5('0x18')]();});}};}function handleEntityNotFound(_0x32fc7d,_0x4cbba1){return function(_0x40f08b){if(!_0x40f08b){_0x32fc7d[_0xa9c5('0x17')](0x194);}return _0x40f08b;};}function handleError(_0x51b64a,_0x4e8a7f){_0x4e8a7f=_0x4e8a7f||0x1f4;return function(_0x242771){logger['error'](_0x242771[_0xa9c5('0x25')]);if(_0x242771[_0xa9c5('0x26')]){delete _0x242771['name'];}_0x51b64a[_0xa9c5('0x19')](_0x4e8a7f)[_0xa9c5('0x27')](_0x242771);};}exports['index']=function(_0x413edf,_0x32baf9){var _0x198cdf={},_0x185eb8={},_0x325c65={'count':0x0,'rows':[]};var _0x4f6e70=_[_0xa9c5('0x28')](db['ScreenRecording'][_0xa9c5('0x29')],function(_0x1ef388){return{'name':_0x1ef388[_0xa9c5('0x2a')],'type':_0x1ef388['type'][_0xa9c5('0x2b')]};});_0x185eb8[_0xa9c5('0x2c')]=_['differenceBy'](_[_0xa9c5('0x28')](_0x4f6e70,_0xa9c5('0x26')),[_0xa9c5('0x2d')]);_0x185eb8[_0xa9c5('0x2e')]=_[_0xa9c5('0x2f')](_0x413edf[_0xa9c5('0x2e')]);_0x185eb8[_0xa9c5('0x30')]=_['intersection'](_0x185eb8[_0xa9c5('0x2c')],_0x185eb8[_0xa9c5('0x2e')]);_0x198cdf[_0xa9c5('0x31')]=_[_0xa9c5('0x32')](_0x185eb8[_0xa9c5('0x2c')],qs[_0xa9c5('0x33')](_0x413edf[_0xa9c5('0x2e')][_0xa9c5('0x33')]));_0x198cdf['attributes']=_0x198cdf['attributes'][_0xa9c5('0x34')]?_0x198cdf[_0xa9c5('0x31')]:_0x185eb8[_0xa9c5('0x2c')];if(!_0x413edf[_0xa9c5('0x2e')][_0xa9c5('0x35')](_0xa9c5('0x36'))){_0x198cdf['limit']=qs['limit'](_0x413edf['query'][_0xa9c5('0x1c')]);_0x198cdf[_0xa9c5('0x1e')]=qs['offset'](_0x413edf[_0xa9c5('0x2e')]['offset']);}_0x198cdf[_0xa9c5('0x37')]=qs[_0xa9c5('0x38')](_0x413edf[_0xa9c5('0x2e')][_0xa9c5('0x38')]);_0x198cdf['where']=qs[_0xa9c5('0x30')](_[_0xa9c5('0x39')](_0x413edf[_0xa9c5('0x2e')],_0x185eb8[_0xa9c5('0x30')]),_0x4f6e70);if(_0x413edf[_0xa9c5('0x2e')][_0xa9c5('0x3a')]){_0x198cdf[_0xa9c5('0x3b')]=_[_0xa9c5('0x3c')](_0x198cdf['where'],{'$or':_[_0xa9c5('0x28')](_0x4f6e70,function(_0x46e5d2){if(_0x46e5d2[_0xa9c5('0x3d')]!==_0xa9c5('0x3e')){var _0x1132e0={};_0x1132e0[_0x46e5d2[_0xa9c5('0x26')]]={'$like':'%'+_0x413edf['query'][_0xa9c5('0x3a')]+'%'};return _0x1132e0;}})});}_0x198cdf=_['merge']({},_0x198cdf,_0x413edf[_0xa9c5('0x3f')]);var _0x5c89e7={'where':_0x198cdf[_0xa9c5('0x3b')]};return db[_0xa9c5('0x40')][_0xa9c5('0x1d')](_0x5c89e7)['then'](function(_0x12e19c){_0x325c65[_0xa9c5('0x1d')]=_0x12e19c;if(_0x413edf[_0xa9c5('0x2e')][_0xa9c5('0x41')]){_0x198cdf['include']=[{'all':!![]}];}return db[_0xa9c5('0x40')][_0xa9c5('0x42')](_0x198cdf);})[_0xa9c5('0x24')](function(_0x45668e){_0x325c65[_0xa9c5('0x43')]=_0x45668e;return _0x325c65;})['then'](respondWithFilteredResult(_0x32baf9,_0x198cdf))[_0xa9c5('0x44')](handleError(_0x32baf9,null));};exports['show']=function(_0x1de605,_0x397614){var _0x2998ad={'raw':![],'where':{'id':_0x1de605[_0xa9c5('0x45')]['id']}},_0xc8fca4={};_0xc8fca4[_0xa9c5('0x2c')]=_[_0xa9c5('0x2f')](db[_0xa9c5('0x40')][_0xa9c5('0x29')]);_0xc8fca4[_0xa9c5('0x2e')]=_['keys'](_0x1de605[_0xa9c5('0x2e')]);_0xc8fca4[_0xa9c5('0x30')]=_[_0xa9c5('0x32')](_0xc8fca4[_0xa9c5('0x2c')],_0xc8fca4[_0xa9c5('0x2e')]);_0x2998ad[_0xa9c5('0x31')]=_['intersection'](_0xc8fca4[_0xa9c5('0x2c')],qs[_0xa9c5('0x33')](_0x1de605['query']['fields']));_0x2998ad['attributes']=_0x2998ad['attributes']['length']?_0x2998ad[_0xa9c5('0x31')]:_0xc8fca4[_0xa9c5('0x2c')];if(_0x1de605[_0xa9c5('0x2e')][_0xa9c5('0x41')]){_0x2998ad[_0xa9c5('0x46')]=[{'all':!![]}];}_0x2998ad=_[_0xa9c5('0x3c')]({},_0x2998ad,_0x1de605[_0xa9c5('0x3f')]);return db[_0xa9c5('0x40')][_0xa9c5('0x47')](_0x2998ad)[_0xa9c5('0x24')](handleEntityNotFound(_0x397614,null))[_0xa9c5('0x24')](respondWithResult(_0x397614,null))[_0xa9c5('0x44')](handleError(_0x397614,null));};exports[_0xa9c5('0x48')]=function(_0x4bf8b4,_0x1108f0){return db['ScreenRecording'][_0xa9c5('0x48')](_0x4bf8b4[_0xa9c5('0x49')],{})['then'](respondWithResult(_0x1108f0,0xc9))['catch'](handleError(_0x1108f0,null));};exports[_0xa9c5('0x23')]=function(_0x32e64a,_0xeb0720){if(_0x32e64a['body']['id']){delete _0x32e64a['body']['id'];}delete _0x32e64a[_0xa9c5('0x49')][_0xa9c5('0x4a')];delete _0x32e64a['body'][_0xa9c5('0x4b')];delete _0x32e64a[_0xa9c5('0x49')][_0xa9c5('0x4c')];delete _0x32e64a[_0xa9c5('0x49')][_0xa9c5('0x4d')];return db[_0xa9c5('0x40')]['find']({'where':{'id':_0x32e64a['params']['id']}})['then'](handleEntityNotFound(_0xeb0720,null))[_0xa9c5('0x24')](saveUpdates(_0x32e64a[_0xa9c5('0x49')],null))[_0xa9c5('0x24')](respondWithResult(_0xeb0720,null))[_0xa9c5('0x44')](handleError(_0xeb0720,null));};exports[_0xa9c5('0x4e')]=function(_0x15d044,_0x56bc1d){return db[_0xa9c5('0x40')][_0xa9c5('0x4e')]()[_0xa9c5('0x24')](respondWithResult(_0x56bc1d,null))[_0xa9c5('0x44')](handleError(_0x56bc1d,null));};exports[_0xa9c5('0x4f')]=function(_0x242e8a,_0x547654,_0x4fcc44){var _0x10ff6b=require('../../components/encryptor');var _0x1b158f=![];var _0x5ea9b0={};if(_0x242e8a[_0xa9c5('0x2e')][_0xa9c5('0x3d')]&&_0x242e8a[_0xa9c5('0x2e')]['type']===_0xa9c5('0x50')){_0x5ea9b0[_0xa9c5('0x50')]=_0x242e8a[_0xa9c5('0x45')]['id'];}else{_0x5ea9b0['id']=_0x242e8a[_0xa9c5('0x45')]['id'];}return db['ScreenRecording']['find']({'where':_0x5ea9b0,'attributes':['id',_0xa9c5('0x4d')],'raw':!![]})[_0xa9c5('0x24')](handleEntityNotFound(_0x547654,null))[_0xa9c5('0x24')](function(_0x5b4323){if(_0x5b4323){var _0x31e12e=path[_0xa9c5('0x51')](config[_0xa9c5('0x52')],_0xa9c5('0x53'),_0x5b4323[_0xa9c5('0x4d')]);var _0x29b198=util[_0xa9c5('0x2d')](_0xa9c5('0x54'),_0x31e12e);if(fs['existsSync'](_0x29b198)){_0x1b158f=!![];return _0x10ff6b[_0xa9c5('0x55')](_0x29b198,_0x31e12e,config['secrets'][_0xa9c5('0x56')])[_0xa9c5('0x24')](function(){return _0x5b4323;});}return _0x5b4323;}})[_0xa9c5('0x24')](function(_0x4dfe3a){if(_0x4dfe3a){var _0x4d475a=path[_0xa9c5('0x51')](config['root'],_0xa9c5('0x53'),_0x4dfe3a[_0xa9c5('0x4d')]);if(!fs[_0xa9c5('0x57')](_0x4d475a)){throw new db[(_0xa9c5('0x58'))]['ValidationError'](_0xa9c5('0x59'));}if(_0x4dfe3a[_0xa9c5('0x5a')]){return _0x547654[_0xa9c5('0x4f')](_0x4d475a,_0x4dfe3a[_0xa9c5('0x5a')]+path['extname'](_0x4d475a),function(){if(_0x1b158f){fs['unlink'](_0x4d475a);}});}else{return _0x547654[_0xa9c5('0x4f')](_0x4d475a,function(_0x3deb64){if(_0x1b158f){fs[_0xa9c5('0x5b')](_0x4d475a);}});}}})[_0xa9c5('0x44')](function(_0x279a26){if(_0x279a26[_0xa9c5('0x5c')]==='ScreenRecording\x20not\x20found'){_0x547654[_0xa9c5('0x19')](0x194)[_0xa9c5('0x27')](_0xa9c5('0x5d'));}else{return handleError(_0x547654,null);}});};exports[_0xa9c5('0x5e')]=function(_0x2b8575,_0x372ab9){return db[_0xa9c5('0x40')][_0xa9c5('0x47')]({'where':{'id':_0x2b8575[_0xa9c5('0x45')]['id']}})[_0xa9c5('0x24')](function(_0x50d438){if(_['isNil'](_0x50d438)){throw new ReferenceError(_0xa9c5('0x5f'));}return _0x50d438;})[_0xa9c5('0x24')](function(_0x3322cc){var _0x47afaa=path['join'](config[_0xa9c5('0x52')],'server/files/screen_recordings',_0x3322cc[_0xa9c5('0x4d')]);logger[_0xa9c5('0x60')](_0xa9c5('0x61'),_0x47afaa);if(!_[_0xa9c5('0x62')](_0x3322cc[_0xa9c5('0x4d')])&&fs[_0xa9c5('0x57')](_0x47afaa)){logger[_0xa9c5('0x60')](_0xa9c5('0x63')+_0x47afaa+_0xa9c5('0x64'));fs[_0xa9c5('0x65')](_0x47afaa);}_0x47afaa=_0x47afaa+_0xa9c5('0x66');if(!_[_0xa9c5('0x62')](_0x3322cc['value'])&&fs[_0xa9c5('0x57')](_0x47afaa)){logger[_0xa9c5('0x60')](_0xa9c5('0x63')+_0x47afaa+_0xa9c5('0x64'));fs[_0xa9c5('0x65')](_0x47afaa);}return _0x3322cc;})[_0xa9c5('0x24')](function(_0x28ba54){if(!_0x28ba54)throw new InternalError();return _0x28ba54['destroy']();})['then'](function(){_0x372ab9[_0xa9c5('0x19')](0xcc)['end']();})[_0xa9c5('0x44')](handleError(_0x372ab9,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index b9e4fde..78e8a19 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 _0x6298=['screen_recordings','interactionid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./screenRecording.attributes','exports','define','ScreenRecording'];(function(_0x45d879,_0x8ecd5d){var _0x40e469=function(_0x3c017c){while(--_0x3c017c){_0x45d879['push'](_0x45d879['shift']());}};_0x40e469(++_0x8ecd5d);}(_0x6298,0xd2));var _0x8629=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6298[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8629('0x0'));var util=require(_0x8629('0x1'));var logger=require(_0x8629('0x2'))(_0x8629('0x3'));var moment=require(_0x8629('0x4'));var BPromise=require(_0x8629('0x5'));var rp=require(_0x8629('0x6'));var fs=require('fs');var path=require(_0x8629('0x7'));var rimraf=require(_0x8629('0x8'));var config=require(_0x8629('0x9'));var attributes=require(_0x8629('0xa'));module[_0x8629('0xb')]=function(_0x18d992,_0x56a8f2){return _0x18d992[_0x8629('0xc')](_0x8629('0xd'),attributes,{'tableName':_0x8629('0xe'),'paranoid':![],'indexes':[{'name':_0x8629('0xf'),'fields':[_0x8629('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa70d=['bluebird','request-promise','path','rimraf','../../config/environment','./screenRecording.attributes','ScreenRecording','screen_recordings','interactionid','lodash','../../config/logger','api','moment'];(function(_0x471c6e,_0x17e77e){var _0x117bb9=function(_0x256db3){while(--_0x256db3){_0x471c6e['push'](_0x471c6e['shift']());}};_0x117bb9(++_0x17e77e);}(_0xa70d,0xe6));var _0xda70=function(_0x106b64,_0x5d9881){_0x106b64=_0x106b64-0x0;var _0x332274=_0xa70d[_0x106b64];return _0x332274;};'use strict';var _=require(_0xda70('0x0'));var util=require('util');var logger=require(_0xda70('0x1'))(_0xda70('0x2'));var moment=require(_0xda70('0x3'));var BPromise=require(_0xda70('0x4'));var rp=require(_0xda70('0x5'));var fs=require('fs');var path=require(_0xda70('0x6'));var rimraf=require(_0xda70('0x7'));var config=require(_0xda70('0x8'));var attributes=require(_0xda70('0x9'));module['exports']=function(_0x98ce76,_0x54ef6a){return _0x98ce76['define'](_0xda70('0xa'),attributes,{'tableName':_0xda70('0xb'),'paranoid':![],'indexes':[{'name':_0xda70('0xc'),'fields':[_0xda70('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 d6e45b4..f517b11 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 _0xb07a=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ScreenRecording,\x20%s,\x20%s','result','catch','lodash'];(function(_0x113fa0,_0xa3bb7){var _0xf6e9af=function(_0x42c987){while(--_0x42c987){_0x113fa0['push'](_0x113fa0['shift']());}};_0xf6e9af(++_0xa3bb7);}(_0xb07a,0x11f));var _0xab07=function(_0x296db4,_0x3244dc){_0x296db4=_0x296db4-0x0;var _0x44e41c=_0xb07a[_0x296db4];return _0x44e41c;};'use strict';var _=require(_0xab07('0x0'));var util=require(_0xab07('0x1'));var moment=require(_0xab07('0x2'));var BPromise=require(_0xab07('0x3'));var rs=require(_0xab07('0x4'));var fs=require('fs');var Redis=require(_0xab07('0x5'));var db=require(_0xab07('0x6'))['db'];var utils=require(_0xab07('0x7'));var logger=require(_0xab07('0x8'))('rpc');var config=require(_0xab07('0x9'));var jayson=require(_0xab07('0xa'));var client=jayson[_0xab07('0xb')][_0xab07('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x55bf56,_0x451f73,_0x3efe31){return new BPromise(function(_0x53f08c,_0x39849b){return client['request'](_0x55bf56,_0x3efe31)[_0xab07('0xd')](function(_0x43b0c0){logger[_0xab07('0xe')]('ScreenRecording,\x20%s,\x20%s',_0x451f73,_0xab07('0xf'));logger['debug'](_0xab07('0x10'),_0x451f73,_0xab07('0xf'),JSON[_0xab07('0x11')](_0x43b0c0));if(_0x43b0c0[_0xab07('0x12')]){if(_0x43b0c0[_0xab07('0x12')][_0xab07('0x13')]===0x1f4){logger[_0xab07('0x12')]('ScreenRecording,\x20%s,\x20%s',_0x451f73,_0x43b0c0['error']['message']);return _0x39849b(_0x43b0c0['error'][_0xab07('0x14')]);}logger[_0xab07('0x12')](_0xab07('0x15'),_0x451f73,_0x43b0c0['error'][_0xab07('0x14')]);return _0x53f08c(_0x43b0c0['error'][_0xab07('0x14')]);}else{logger[_0xab07('0xe')](_0xab07('0x15'),_0x451f73,_0xab07('0xf'));_0x53f08c(_0x43b0c0[_0xab07('0x16')][_0xab07('0x14')]);}})[_0xab07('0x17')](function(_0x1fc4fe){logger[_0xab07('0x12')](_0xab07('0x15'),_0x451f73,_0x1fc4fe);_0x39849b(_0x1fc4fe);});});} \ No newline at end of file +var _0xf367=['error','code','message','info','request\x20sent','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','ScreenRecording,\x20%s,\x20%s','debug','stringify'];(function(_0x5b2800,_0x3d3313){var _0x492614=function(_0x2494b6){while(--_0x2494b6){_0x5b2800['push'](_0x5b2800['shift']());}};_0x492614(++_0x3d3313);}(_0xf367,0xc4));var _0x7f36=function(_0x296915,_0x1d10c5){_0x296915=_0x296915-0x0;var _0x16388f=_0xf367[_0x296915];return _0x16388f;};'use strict';var _=require(_0x7f36('0x0'));var util=require(_0x7f36('0x1'));var moment=require('moment');var BPromise=require(_0x7f36('0x2'));var rs=require(_0x7f36('0x3'));var fs=require('fs');var Redis=require(_0x7f36('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7f36('0x5'));var logger=require(_0x7f36('0x6'))(_0x7f36('0x7'));var config=require(_0x7f36('0x8'));var jayson=require(_0x7f36('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x57f18d,_0x47682b,_0x4beb1f){return new BPromise(function(_0x446617,_0x38c72f){return client['request'](_0x57f18d,_0x4beb1f)[_0x7f36('0xa')](function(_0x59ad93){logger['info'](_0x7f36('0xb'),_0x47682b,'request\x20sent');logger[_0x7f36('0xc')]('ScreenRecording,\x20%s,\x20%s,\x20%s',_0x47682b,'request\x20sent',JSON[_0x7f36('0xd')](_0x59ad93));if(_0x59ad93[_0x7f36('0xe')]){if(_0x59ad93[_0x7f36('0xe')][_0x7f36('0xf')]===0x1f4){logger['error'](_0x7f36('0xb'),_0x47682b,_0x59ad93[_0x7f36('0xe')]['message']);return _0x38c72f(_0x59ad93[_0x7f36('0xe')][_0x7f36('0x10')]);}logger[_0x7f36('0xe')](_0x7f36('0xb'),_0x47682b,_0x59ad93['error'][_0x7f36('0x10')]);return _0x446617(_0x59ad93[_0x7f36('0xe')]['message']);}else{logger[_0x7f36('0x11')](_0x7f36('0xb'),_0x47682b,_0x7f36('0x12'));_0x446617(_0x59ad93[_0x7f36('0x13')][_0x7f36('0x10')]);}})[_0x7f36('0x14')](function(_0x20a634){logger['error']('ScreenRecording,\x20%s,\x20%s',_0x47682b,_0x20a634);_0x38c72f(_0x20a634);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 1ed8075..c7a4d52 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 _0xc424=['/now','getDate','/:id','show','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','diskStorage','join','root','server/files/images/logos/','format','extname','originalname','post','single','file','addLogo','%s%s','addLogoLogin','preferred','addPreferred','favicon','addFavicon','update','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./setting.controller','get','isAuthenticated','index'];(function(_0x53b89e,_0x271dba){var _0xfade=function(_0x56b93b){while(--_0x56b93b){_0x53b89e['push'](_0x53b89e['shift']());}};_0xfade(++_0x271dba);}(_0xc424,0x1ab));var _0x4c42=function(_0x15f32f,_0x2521e9){_0x15f32f=_0x15f32f-0x0;var _0x5cc53c=_0xc424[_0x15f32f];return _0x5cc53c;};'use strict';var multer=require(_0x4c42('0x0'));var util=require(_0x4c42('0x1'));var path=require(_0x4c42('0x2'));var timeout=require(_0x4c42('0x3'));var express=require(_0x4c42('0x4'));var router=express[_0x4c42('0x5')]();var fs_extra=require(_0x4c42('0x6'));var auth=require(_0x4c42('0x7'));var interaction=require(_0x4c42('0x8'));var config=require('../../config/environment');var controller=require(_0x4c42('0x9'));router[_0x4c42('0xa')]('/',auth[_0x4c42('0xb')](),controller[_0x4c42('0xc')]);router[_0x4c42('0xa')](_0x4c42('0xd'),controller[_0x4c42('0xe')]);router[_0x4c42('0xa')](_0x4c42('0xf'),controller[_0x4c42('0x10')]);router[_0x4c42('0xa')](_0x4c42('0x11'),controller[_0x4c42('0x12')]);router[_0x4c42('0xa')](_0x4c42('0x13'),controller[_0x4c42('0x14')]);router[_0x4c42('0xa')](_0x4c42('0x15'),controller['gdpr']);router['get'](_0x4c42('0x16'),controller[_0x4c42('0x17')]);router[_0x4c42('0xa')](_0x4c42('0x18'),controller[_0x4c42('0x19')]);var upload=multer({'storage':multer[_0x4c42('0x1a')]({'destination':function(_0x18e5d9,_0xf2da7,_0x2e5517){_0x2e5517(null,path[_0x4c42('0x1b')](config[_0x4c42('0x1c')],_0x4c42('0x1d')));},'filename':function(_0xf10d44,_0x3a85c8,_0xe9938){_0xe9938(null,util[_0x4c42('0x1e')]('%s%s','logo',path[_0x4c42('0x1f')](_0x3a85c8[_0x4c42('0x20')])));}})});router[_0x4c42('0x21')](_0x4c42('0x11'),upload[_0x4c42('0x22')](_0x4c42('0x23')),controller[_0x4c42('0x24')]);var upload=multer({'storage':multer[_0x4c42('0x1a')]({'destination':function(_0x4512df,_0x420f37,_0x12137c){_0x12137c(null,path[_0x4c42('0x1b')](config['root'],_0x4c42('0x1d')));},'filename':function(_0x178044,_0x1fc7f5,_0x3081c8){_0x3081c8(null,util['format'](_0x4c42('0x25'),'logologin',path[_0x4c42('0x1f')](_0x1fc7f5['originalname'])));}})});router['post'](_0x4c42('0x13'),upload[_0x4c42('0x22')](_0x4c42('0x23')),controller[_0x4c42('0x26')]);var upload=multer({'storage':multer[_0x4c42('0x1a')]({'destination':function(_0x1f9796,_0x2d3b81,_0x38d665){_0x38d665(null,path[_0x4c42('0x1b')](config[_0x4c42('0x1c')],_0x4c42('0x1d')));},'filename':function(_0x21be86,_0x277db1,_0x142662){_0x142662(null,util[_0x4c42('0x1e')](_0x4c42('0x25'),_0x4c42('0x27'),path[_0x4c42('0x1f')](_0x277db1['originalname'])));}})});router[_0x4c42('0x21')](_0x4c42('0x16'),upload['single'](_0x4c42('0x23')),controller[_0x4c42('0x28')]);var upload=multer({'storage':multer[_0x4c42('0x1a')]({'destination':function(_0x14ea7f,_0x17cc93,_0x2da606){_0x2da606(null,path[_0x4c42('0x1b')](config['root'],_0x4c42('0x1d')));},'filename':function(_0x18ab13,_0x31cf74,_0x354b6a){_0x354b6a(null,util[_0x4c42('0x1e')]('%s%s',_0x4c42('0x29'),path['extname'](_0x31cf74[_0x4c42('0x20')])));}})});router[_0x4c42('0x21')](_0x4c42('0x18'),upload[_0x4c42('0x22')](_0x4c42('0x23')),controller[_0x4c42('0x2a')]);router['put'](_0x4c42('0xf'),auth['isAuthenticated'](),controller[_0x4c42('0x2b')]);module['exports']=router; \ No newline at end of file +var _0xc490=['/:id','update','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./setting.controller','get','isAuthenticated','getDate','show','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','/:id/favicon','diskStorage','server/files/images/logos/','format','%s%s','extname','originalname','post','/:id/logo','single','file','addLogo','join','root','addLogoLogin','preferred','addPreferred'];(function(_0x58b28b,_0x528710){var _0x22a632=function(_0x39df3a){while(--_0x39df3a){_0x58b28b['push'](_0x58b28b['shift']());}};_0x22a632(++_0x528710);}(_0xc490,0x1bf));var _0x0c49=function(_0x68859f,_0x56c187){_0x68859f=_0x68859f-0x0;var _0x4db739=_0xc490[_0x68859f];return _0x4db739;};'use strict';var multer=require(_0x0c49('0x0'));var util=require(_0x0c49('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0c49('0x2'));var router=express[_0x0c49('0x3')]();var fs_extra=require(_0x0c49('0x4'));var auth=require(_0x0c49('0x5'));var interaction=require(_0x0c49('0x6'));var config=require('../../config/environment');var controller=require(_0x0c49('0x7'));router[_0x0c49('0x8')]('/',auth[_0x0c49('0x9')](),controller['index']);router['get']('/now',controller[_0x0c49('0xa')]);router['get']('/:id',controller[_0x0c49('0xb')]);router[_0x0c49('0x8')]('/:id/logo',controller['getLogo']);router[_0x0c49('0x8')](_0x0c49('0xc'),controller[_0x0c49('0xd')]);router[_0x0c49('0x8')](_0x0c49('0xe'),controller[_0x0c49('0xf')]);router[_0x0c49('0x8')](_0x0c49('0x10'),controller['getPreferred']);router[_0x0c49('0x8')](_0x0c49('0x11'),controller['getFavicon']);var upload=multer({'storage':multer[_0x0c49('0x12')]({'destination':function(_0x485a6c,_0xcb0603,_0x92b9d5){_0x92b9d5(null,path['join'](config['root'],_0x0c49('0x13')));},'filename':function(_0x3dd661,_0x19dbfb,_0x5e7281){_0x5e7281(null,util[_0x0c49('0x14')](_0x0c49('0x15'),'logo',path[_0x0c49('0x16')](_0x19dbfb[_0x0c49('0x17')])));}})});router[_0x0c49('0x18')](_0x0c49('0x19'),upload[_0x0c49('0x1a')](_0x0c49('0x1b')),controller[_0x0c49('0x1c')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5a57a8,_0x2cd07c,_0x3ba7ec){_0x3ba7ec(null,path[_0x0c49('0x1d')](config[_0x0c49('0x1e')],_0x0c49('0x13')));},'filename':function(_0x2c13bc,_0xdbf724,_0x53349a){_0x53349a(null,util['format'](_0x0c49('0x15'),'logologin',path['extname'](_0xdbf724[_0x0c49('0x17')])));}})});router['post']('/:id/logo_login',upload[_0x0c49('0x1a')](_0x0c49('0x1b')),controller[_0x0c49('0x1f')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x521320,_0x5ca6bf,_0x2eb536){_0x2eb536(null,path[_0x0c49('0x1d')](config[_0x0c49('0x1e')],_0x0c49('0x13')));},'filename':function(_0xb7abb4,_0x2bbb10,_0x51406d){_0x51406d(null,util['format']('%s%s',_0x0c49('0x20'),path[_0x0c49('0x16')](_0x2bbb10['originalname'])));}})});router['post'](_0x0c49('0x10'),upload['single'](_0x0c49('0x1b')),controller[_0x0c49('0x21')]);var upload=multer({'storage':multer[_0x0c49('0x12')]({'destination':function(_0x299507,_0x5b573f,_0x4b4636){_0x4b4636(null,path[_0x0c49('0x1d')](config['root'],'server/files/images/logos/'));},'filename':function(_0x1125bf,_0x1deb37,_0x2a6b9d){_0x2a6b9d(null,util[_0x0c49('0x14')](_0x0c49('0x15'),'favicon',path[_0x0c49('0x16')](_0x1deb37[_0x0c49('0x17')])));}})});router[_0x0c49('0x18')](_0x0c49('0x11'),upload[_0x0c49('0x1a')]('file'),controller['addFavicon']);router['put'](_0x0c49('0x22'),auth[_0x0c49('0x9')](),controller[_0x0c49('0x23')]);module[_0x0c49('0x24')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index a7c6deb..9f45b2e 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 _0xd8b0=['alternate','UNSIGNED','sequelize','exports','min_mailbox','INTEGER','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'min_internal':{'type':Sequelize['INTEGER'](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0d8b('0x2'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x0d8b('0x3')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0d8b('0x4')],'defaultValue':_0x0d8b('0x5')},'logo':{'type':Sequelize[_0x0d8b('0x4')]},'defaultLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginLogo':{'type':Sequelize['STRING']},'defaultLoginLogo':{'type':Sequelize[_0x0d8b('0x6')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0d8b('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0d8b('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x0d8b('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x0d8b('0x4')]},'turnaddr':{'type':Sequelize['STRING']},'turnusername':{'type':Sequelize[_0x0d8b('0x4')]},'turnpassword':{'type':Sequelize[_0x0d8b('0x4')]},'pageTitle':{'type':Sequelize[_0x0d8b('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0d8b('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0d8b('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0d8b('0x3')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0d8b('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0d8b('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize[_0x0d8b('0x6')],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x0d8b('0x3')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0d8b('0x3')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0d8b('0x3')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0d8b('0x4')],'defaultValue':_0x0d8b('0x7')},'chatTimeout':{'type':Sequelize[_0x0d8b('0x3')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0d8b('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x0d8b('0x4')]},'defaultPreferred':{'type':Sequelize[_0x0d8b('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0d8b('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0d8b('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0d8b('0x3')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0d8b('0x3')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0d8b('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0d8b('0x3')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x0d8b('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0d8b('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x0d8b('0x3')]},'transcribeRegion':{'type':Sequelize[_0x0d8b('0x4')]},'sentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x0d8b('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0d8b('0x3')]},'sentimentRegion':{'type':Sequelize[_0x0d8b('0x4')]},'language':{'type':Sequelize[_0x0d8b('0x4')]},'bucket':{'type':Sequelize[_0x0d8b('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0d8b('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0d8b('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0d8b('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)[_0x0d8b('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0d8b('0x3')](0x2)[_0x0d8b('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0d8b('0x3')](0x2)[_0x0d8b('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0d8b('0x3')](0x2)[_0x0d8b('0x8')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0d8b('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0d8b('0x3')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0d8b('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0d8b('0x6')],'defaultValue':!![]}}; \ No newline at end of file +var _0xd8b0=['alternate','UNSIGNED','sequelize','exports','min_mailbox','INTEGER','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'min_internal':{'type':Sequelize['INTEGER'](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0d8b('0x2'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x0d8b('0x3')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0d8b('0x4')],'defaultValue':_0x0d8b('0x5')},'logo':{'type':Sequelize[_0x0d8b('0x4')]},'defaultLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginLogo':{'type':Sequelize['STRING']},'defaultLoginLogo':{'type':Sequelize[_0x0d8b('0x6')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0d8b('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0d8b('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x0d8b('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x0d8b('0x4')]},'turnaddr':{'type':Sequelize['STRING']},'turnusername':{'type':Sequelize[_0x0d8b('0x4')]},'turnpassword':{'type':Sequelize[_0x0d8b('0x4')]},'pageTitle':{'type':Sequelize[_0x0d8b('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0d8b('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0d8b('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0d8b('0x3')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0d8b('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0d8b('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize[_0x0d8b('0x6')],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x0d8b('0x3')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0d8b('0x3')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0d8b('0x3')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0d8b('0x4')],'defaultValue':_0x0d8b('0x7')},'chatTimeout':{'type':Sequelize[_0x0d8b('0x3')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0d8b('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x0d8b('0x4')]},'defaultPreferred':{'type':Sequelize[_0x0d8b('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0d8b('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0d8b('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0d8b('0x3')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0d8b('0x3')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0d8b('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0d8b('0x3')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x0d8b('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0d8b('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x0d8b('0x3')]},'transcribeRegion':{'type':Sequelize[_0x0d8b('0x4')]},'sentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x0d8b('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0d8b('0x3')]},'sentimentRegion':{'type':Sequelize[_0x0d8b('0x4')]},'language':{'type':Sequelize[_0x0d8b('0x4')]},'bucket':{'type':Sequelize[_0x0d8b('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0d8b('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0d8b('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0d8b('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)[_0x0d8b('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0d8b('0x3')](0x2)[_0x0d8b('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0d8b('0x3')](0x2)[_0x0d8b('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0d8b('0x3')](0x2)[_0x0d8b('0x8')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0d8b('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0d8b('0x3')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0d8b('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0d8b('0x6')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 8bd9199..7c33e13 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 _0x0dec=['server/files/images/logos','getLicense','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','toLower','default_logo.svg','default','upperFirst','custom','root','Sequelize','\x20not\x20found','download','getLogoLogin','preferred','default_loginLogo.svg','ValidationError','gdpr','securePassword','addPreferred','getPreferred','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','utcOffset','now','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','http','request','then','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','status','end','json','offset','undefined','count','set','apply','save','update','destroy','sendStatus','stack','name','send','index','map','Setting','rawAttributes','fieldName','type','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','limit','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','show','params','include','find','body','addLogo','file','logo','addLogoLogin','filename','loginLogo','getLogo'];(function(_0x4d07cc,_0x587613){var _0x42de3b=function(_0x201f78){while(--_0x201f78){_0x4d07cc['push'](_0x4d07cc['shift']());}};_0x42de3b(++_0x587613);}(_0x0dec,0x11c));var _0xc0de=function(_0x4a7871,_0x53087f){_0x4a7871=_0x4a7871-0x0;var _0x2573fc=_0x0dec[_0x4a7871];return _0x2573fc;};'use strict';var emlformat=require(_0xc0de('0x0'));var rimraf=require(_0xc0de('0x1'));var zipdir=require(_0xc0de('0x2'));var jsonpatch=require(_0xc0de('0x3'));var rp=require('request-promise');var moment=require(_0xc0de('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc0de('0x5'));var path=require(_0xc0de('0x6'));var sox=require(_0xc0de('0x7'));var csv=require(_0xc0de('0x8'));var ejs=require(_0xc0de('0x9'));var fs=require('fs');var fs_extra=require(_0xc0de('0xa'));var _=require(_0xc0de('0xb'));var squel=require(_0xc0de('0xc'));var crypto=require(_0xc0de('0xd'));var jsforce=require(_0xc0de('0xe'));var deskjs=require(_0xc0de('0xf'));var toCsv=require(_0xc0de('0x8'));var querystring=require(_0xc0de('0x10'));var Papa=require(_0xc0de('0x11'));var Redis=require(_0xc0de('0x12'));var authService=require(_0xc0de('0x13'));var qs=require(_0xc0de('0x14'));var as=require(_0xc0de('0x15'));var hardwareService=require(_0xc0de('0x16'));var logger=require(_0xc0de('0x17'))(_0xc0de('0x18'));var utils=require(_0xc0de('0x19'));var config=require(_0xc0de('0x1a'));var licenseUtil=require(_0xc0de('0x1b'));var db=require(_0xc0de('0x1c'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xc0de('0x1d')][_0xc0de('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x386133,_0x258c5a,_0x173756,_0x7fae0c){return new BPromise(function(_0x297171,_0x3330e0){var _0x3546f4=_0x7fae0c||client;return _0x3546f4[_0xc0de('0x1f')](_0x386133,_0x173756)[_0xc0de('0x20')](function(_0x7f1e4d){logger['info'](_0xc0de('0x21'),_0x258c5a,_0xc0de('0x22'));logger['debug'](_0xc0de('0x23'),_0x258c5a,_0xc0de('0x22'),JSON[_0xc0de('0x24')](_0x7f1e4d));if(_0x7f1e4d['error']){if(_0x7f1e4d[_0xc0de('0x25')]['code']===0x1f4){logger[_0xc0de('0x25')]('Setting,\x20%s,\x20%s',_0x258c5a,_0x7f1e4d[_0xc0de('0x25')][_0xc0de('0x26')]);return _0x3330e0(_0x7f1e4d['error'][_0xc0de('0x26')]);}logger[_0xc0de('0x25')](_0xc0de('0x21'),_0x258c5a,_0x7f1e4d[_0xc0de('0x25')][_0xc0de('0x26')]);return _0x297171(_0x7f1e4d[_0xc0de('0x25')][_0xc0de('0x26')]);}else{logger[_0xc0de('0x27')]('Setting,\x20%s,\x20%s',_0x258c5a,_0xc0de('0x22'));_0x297171(_0x7f1e4d[_0xc0de('0x28')][_0xc0de('0x26')]);}})[_0xc0de('0x29')](function(_0x337342){logger['error'](_0xc0de('0x21'),_0x258c5a,_0x337342);_0x3330e0(_0x337342);});});}function respondWithStatusCode(_0xf5a756,_0x11252c){_0x11252c=_0x11252c||0xcc;return function(_0x27243b){if(_0x27243b){return _0xf5a756['sendStatus'](_0x11252c);}return _0xf5a756[_0xc0de('0x2a')](_0x11252c)[_0xc0de('0x2b')]();};}function respondWithResult(_0x2d8f43,_0x1f6ef1){_0x1f6ef1=_0x1f6ef1||0xc8;return function(_0x301d65){if(_0x301d65){return _0x2d8f43[_0xc0de('0x2a')](_0x1f6ef1)[_0xc0de('0x2c')](_0x301d65);}};}function respondWithFilteredResult(_0x2d62a0,_0x3a80e6){return function(_0x304660){if(_0x304660){var _0x32fb9d=typeof _0x3a80e6[_0xc0de('0x2d')]===_0xc0de('0x2e')&&typeof _0x3a80e6['limit']==='undefined';var _0x285669=_0x304660[_0xc0de('0x2f')];var _0x59fed0=_0x32fb9d?0x0:_0x3a80e6['offset'];var _0x6022ed=_0x32fb9d?_0x304660[_0xc0de('0x2f')]:_0x3a80e6['offset']+_0x3a80e6['limit'];var _0x428089;if(_0x6022ed>=_0x285669){_0x6022ed=_0x285669;_0x428089=0xc8;}else{_0x428089=0xce;}_0x2d62a0[_0xc0de('0x2a')](_0x428089);return _0x2d62a0[_0xc0de('0x30')]('Content-Range',_0x59fed0+'-'+_0x6022ed+'/'+_0x285669)[_0xc0de('0x2c')](_0x304660);}return null;};}function patchUpdates(_0x4eb14d){return function(_0x1d6a49){try{jsonpatch[_0xc0de('0x31')](_0x1d6a49,_0x4eb14d,!![]);}catch(_0x61c92e){return BPromise['reject'](_0x61c92e);}return _0x1d6a49[_0xc0de('0x32')]();};}function saveUpdates(_0x542801,_0x44b8a5){return function(_0x2fea76){if(_0x2fea76){return _0x2fea76[_0xc0de('0x33')](_0x542801)['then'](function(_0xfee0be){return _0xfee0be;});}return null;};}function removeEntity(_0x10a4d4,_0x104730){return function(_0x2e317a){if(_0x2e317a){return _0x2e317a[_0xc0de('0x34')]()[_0xc0de('0x20')](function(){_0x10a4d4[_0xc0de('0x2a')](0xcc)[_0xc0de('0x2b')]();});}};}function handleEntityNotFound(_0x197807,_0xe2a4f){return function(_0x47a8b9){if(!_0x47a8b9){_0x197807[_0xc0de('0x35')](0x194);}return _0x47a8b9;};}function handleError(_0x5f4949,_0xaca7e7){_0xaca7e7=_0xaca7e7||0x1f4;return function(_0x11dc25){logger[_0xc0de('0x25')](_0x11dc25[_0xc0de('0x36')]);if(_0x11dc25[_0xc0de('0x37')]){delete _0x11dc25[_0xc0de('0x37')];}_0x5f4949[_0xc0de('0x2a')](_0xaca7e7)[_0xc0de('0x38')](_0x11dc25);};}exports[_0xc0de('0x39')]=function(_0x270708,_0x4499e6){var _0x2fd83e={},_0x52303d={},_0x534069={'count':0x0,'rows':[]};var _0x199aff=_[_0xc0de('0x3a')](db[_0xc0de('0x3b')][_0xc0de('0x3c')],function(_0x1ab3c8){return{'name':_0x1ab3c8[_0xc0de('0x3d')],'type':_0x1ab3c8[_0xc0de('0x3e')]['key']};});_0x52303d['model']=_['map'](_0x199aff,_0xc0de('0x37'));_0x52303d[_0xc0de('0x3f')]=_[_0xc0de('0x40')](_0x270708[_0xc0de('0x3f')]);_0x52303d[_0xc0de('0x41')]=_[_0xc0de('0x42')](_0x52303d['model'],_0x52303d[_0xc0de('0x3f')]);_0x2fd83e[_0xc0de('0x43')]=_['intersection'](_0x52303d[_0xc0de('0x44')],qs['fields'](_0x270708[_0xc0de('0x3f')][_0xc0de('0x45')]));_0x2fd83e[_0xc0de('0x43')]=_0x2fd83e[_0xc0de('0x43')][_0xc0de('0x46')]?_0x2fd83e[_0xc0de('0x43')]:_0x52303d[_0xc0de('0x44')];if(!_0x270708[_0xc0de('0x3f')][_0xc0de('0x47')](_0xc0de('0x48'))){_0x2fd83e[_0xc0de('0x49')]=qs['limit'](_0x270708[_0xc0de('0x3f')][_0xc0de('0x49')]);_0x2fd83e[_0xc0de('0x2d')]=qs[_0xc0de('0x2d')](_0x270708[_0xc0de('0x3f')]['offset']);}_0x2fd83e['order']=qs[_0xc0de('0x4a')](_0x270708[_0xc0de('0x3f')][_0xc0de('0x4a')]);_0x2fd83e[_0xc0de('0x4b')]=qs['filters'](_['pick'](_0x270708['query'],_0x52303d[_0xc0de('0x41')]),_0x199aff);if(_0x270708['query'][_0xc0de('0x4c')]){_0x2fd83e[_0xc0de('0x4b')]=_[_0xc0de('0x4d')](_0x2fd83e[_0xc0de('0x4b')],{'$or':_[_0xc0de('0x3a')](_0x199aff,function(_0x2e772f){if(_0x2e772f['type']!==_0xc0de('0x4e')){var _0x393966={};_0x393966[_0x2e772f[_0xc0de('0x37')]]={'$like':'%'+_0x270708[_0xc0de('0x3f')]['filter']+'%'};return _0x393966;}})});}_0x2fd83e=_[_0xc0de('0x4d')]({},_0x2fd83e,_0x270708[_0xc0de('0x4f')]);var _0x408314={'where':_0x2fd83e['where']};return db[_0xc0de('0x3b')][_0xc0de('0x2f')](_0x408314)[_0xc0de('0x20')](function(_0x523c87){_0x534069[_0xc0de('0x2f')]=_0x523c87;if(_0x270708['query'][_0xc0de('0x50')]){_0x2fd83e['include']=[{'all':!![]}];}return db[_0xc0de('0x3b')][_0xc0de('0x51')](_0x2fd83e);})[_0xc0de('0x20')](function(_0x3814f8){_0x534069['rows']=_0x3814f8;return _0x534069;})[_0xc0de('0x20')](respondWithFilteredResult(_0x4499e6,_0x2fd83e))[_0xc0de('0x29')](handleError(_0x4499e6,null));};exports[_0xc0de('0x52')]=function(_0x3b2447,_0x4490a4){var _0x2974b0={'raw':![],'where':{'id':_0x3b2447[_0xc0de('0x53')]['id']}},_0x36d8be={};_0x36d8be[_0xc0de('0x44')]=_['keys'](db[_0xc0de('0x3b')][_0xc0de('0x3c')]);_0x36d8be[_0xc0de('0x3f')]=_['keys'](_0x3b2447[_0xc0de('0x3f')]);_0x36d8be[_0xc0de('0x41')]=_[_0xc0de('0x42')](_0x36d8be['model'],_0x36d8be[_0xc0de('0x3f')]);_0x2974b0[_0xc0de('0x43')]=_[_0xc0de('0x42')](_0x36d8be['model'],qs['fields'](_0x3b2447[_0xc0de('0x3f')]['fields']));_0x2974b0[_0xc0de('0x43')]=_0x2974b0[_0xc0de('0x43')]['length']?_0x2974b0['attributes']:_0x36d8be['model'];if(_0x3b2447[_0xc0de('0x3f')][_0xc0de('0x50')]){_0x2974b0[_0xc0de('0x54')]=[{'all':!![]}];}_0x2974b0=_[_0xc0de('0x4d')]({},_0x2974b0,_0x3b2447['options']);return db[_0xc0de('0x3b')][_0xc0de('0x55')](_0x2974b0)[_0xc0de('0x20')](handleEntityNotFound(_0x4490a4,null))[_0xc0de('0x20')](respondWithResult(_0x4490a4,null))[_0xc0de('0x29')](handleError(_0x4490a4,null));};exports[_0xc0de('0x33')]=function(_0x338db3,_0x5f09a0){if(_0x338db3[_0xc0de('0x56')]['id']){delete _0x338db3[_0xc0de('0x56')]['id'];}return db[_0xc0de('0x3b')][_0xc0de('0x55')]({'where':{'id':_0x338db3['params']['id']}})['then'](handleEntityNotFound(_0x5f09a0,null))[_0xc0de('0x20')](saveUpdates(_0x338db3[_0xc0de('0x56')],null))[_0xc0de('0x20')](respondWithResult(_0x5f09a0,null))[_0xc0de('0x29')](handleError(_0x5f09a0,null));};exports[_0xc0de('0x57')]=function(_0x13b76f,_0x18faa0,_0x1c5110){if(_0x13b76f[_0xc0de('0x58')]&&_0x13b76f[_0xc0de('0x58')]['filename']){_0x13b76f[_0xc0de('0x56')][_0xc0de('0x59')]=_0x13b76f['file']['filename'];}return db['Setting']['find']({'where':{'id':_0x13b76f[_0xc0de('0x53')]['id']}})[_0xc0de('0x20')](handleEntityNotFound(_0x18faa0,null))['then'](saveUpdates(_0x13b76f['body'],null))[_0xc0de('0x20')](respondWithResult(_0x18faa0,null))[_0xc0de('0x29')](handleError(_0x18faa0,null));};exports[_0xc0de('0x5a')]=function(_0x3be584,_0x329adb,_0x3bb525){if(_0x3be584['file']&&_0x3be584[_0xc0de('0x58')][_0xc0de('0x5b')]){_0x3be584[_0xc0de('0x56')][_0xc0de('0x5c')]=_0x3be584[_0xc0de('0x58')][_0xc0de('0x5b')];}return db[_0xc0de('0x3b')][_0xc0de('0x55')]({'where':{'id':_0x3be584[_0xc0de('0x53')]['id']}})['then'](handleEntityNotFound(_0x329adb,null))['then'](saveUpdates(_0x3be584[_0xc0de('0x56')],null))[_0xc0de('0x20')](respondWithResult(_0x329adb,null))[_0xc0de('0x29')](handleError(_0x329adb,null));};var utilLicense=require(_0xc0de('0x1b'));exports[_0xc0de('0x5d')]=function(_0x534674,_0x170621,_0x2060b2){var _0x230665=_0xc0de('0x5e');var _0x313759={'custom':![]};return utilLicense[_0xc0de('0x5f')]()[_0xc0de('0x20')](function(_0x365edb){if(_0x365edb){_0x313759=_0x365edb;}return db[_0xc0de('0x3b')][_0xc0de('0x55')]({'where':{'id':_0x534674['params']['id']},'attributes':[_0xc0de('0x59'),'loginLogo','preferred',_0xc0de('0x60'),_0xc0de('0x61'),_0xc0de('0x62'),_0xc0de('0x63'),_0xc0de('0x64')],'raw':!![]});})[_0xc0de('0x20')](handleEntityNotFound(_0x170621,null))[_0xc0de('0x20')](function(_0x185ae3){if(_0x185ae3){var _0x21a936=_0x185ae3['logo']&&fs[_0xc0de('0x65')](path[_0xc0de('0x66')](config['root'],_0x230665,_['toLower'](_0x185ae3['logo'])))?path[_0xc0de('0x66')](config['root'],_0x230665,_[_0xc0de('0x67')](_0x185ae3['logo'])):path['join'](config['root'],_0x230665,_[_0xc0de('0x67')](_0xc0de('0x68')));var _0xfecd2b=_0xc0de('0x69')+_[_0xc0de('0x6a')](_0xc0de('0x59'));if(_0x185ae3[_0xfecd2b]||!_0x313759[_0xc0de('0x6b')]){_0x21a936=path[_0xc0de('0x66')](config[_0xc0de('0x6c')],_0x230665,_[_0xc0de('0x67')](_0xc0de('0x68')));}if(!fs[_0xc0de('0x65')](_0x21a936)){throw new db[(_0xc0de('0x6d'))]['ValidationError'](_['upperFirst']('logo')+_0xc0de('0x6e'));}return _0x170621[_0xc0de('0x6f')](_0x21a936);}})[_0xc0de('0x29')](handleError(_0x170621,null));};var utilLicense=require(_0xc0de('0x1b'));exports[_0xc0de('0x70')]=function(_0x530eeb,_0x23e03b,_0x3c808c){var _0x168505=_0xc0de('0x5e');var _0x492809={'custom':![]};return utilLicense['getLicense']()[_0xc0de('0x20')](function(_0x50911e){if(_0x50911e){_0x492809=_0x50911e;}return db[_0xc0de('0x3b')]['find']({'where':{'id':_0x530eeb[_0xc0de('0x53')]['id']},'attributes':['logo',_0xc0de('0x5c'),_0xc0de('0x71'),_0xc0de('0x60'),'defaultLogo','defaultLoginLogo',_0xc0de('0x63'),_0xc0de('0x64')],'raw':!![]});})[_0xc0de('0x20')](handleEntityNotFound(_0x23e03b,null))[_0xc0de('0x20')](function(_0x9b7bab){if(_0x9b7bab){var _0x31443c=_0x9b7bab[_0xc0de('0x5c')]&&fs['existsSync'](path[_0xc0de('0x66')](config[_0xc0de('0x6c')],_0x168505,_['toLower'](_0x9b7bab[_0xc0de('0x5c')])))?path[_0xc0de('0x66')](config['root'],_0x168505,_[_0xc0de('0x67')](_0x9b7bab['loginLogo'])):path[_0xc0de('0x66')](config['root'],_0x168505,_[_0xc0de('0x67')](_0xc0de('0x72')));var _0x140630=_0xc0de('0x69')+_['upperFirst']('loginLogo');if(_0x9b7bab[_0x140630]||!_0x492809['custom']){_0x31443c=path[_0xc0de('0x66')](config[_0xc0de('0x6c')],_0x168505,_[_0xc0de('0x67')](_0xc0de('0x72')));}if(!fs[_0xc0de('0x65')](_0x31443c)){throw new db['Sequelize'][(_0xc0de('0x73'))](_[_0xc0de('0x6a')](_0xc0de('0x5c'))+_0xc0de('0x6e'));}return _0x23e03b['download'](_0x31443c);}})[_0xc0de('0x29')](handleError(_0x23e03b,null));};exports[_0xc0de('0x74')]=function(_0x5925dd,_0x2038af){return db[_0xc0de('0x3b')][_0xc0de('0x55')]({'where':{'id':_0x5925dd[_0xc0de('0x53')]['id']},'attributes':[_0xc0de('0x75')]})[_0xc0de('0x20')](respondWithResult(_0x2038af,null))['catch'](handleError(_0x2038af,null));};exports[_0xc0de('0x76')]=function(_0x2b0595,_0x3fa856,_0x5acb8){if(_0x2b0595[_0xc0de('0x58')]&&_0x2b0595[_0xc0de('0x58')][_0xc0de('0x5b')]){_0x2b0595['body'][_0xc0de('0x71')]=_0x2b0595['file'][_0xc0de('0x5b')];}return db[_0xc0de('0x3b')][_0xc0de('0x55')]({'where':{'id':_0x2b0595[_0xc0de('0x53')]['id']}})[_0xc0de('0x20')](handleEntityNotFound(_0x3fa856,null))[_0xc0de('0x20')](saveUpdates(_0x2b0595[_0xc0de('0x56')],null))[_0xc0de('0x20')](respondWithResult(_0x3fa856,null))[_0xc0de('0x29')](handleError(_0x3fa856,null));};var utilLicense=require(_0xc0de('0x1b'));exports[_0xc0de('0x77')]=function(_0xad2202,_0x4465b0,_0x12bac6){var _0x1979ee=_0xc0de('0x5e');var _0x5719e1={'custom':![]};return utilLicense[_0xc0de('0x5f')]()[_0xc0de('0x20')](function(_0x4aa9fc){if(_0x4aa9fc){_0x5719e1=_0x4aa9fc;}return db['Setting'][_0xc0de('0x55')]({'where':{'id':_0xad2202[_0xc0de('0x53')]['id']},'attributes':[_0xc0de('0x59'),_0xc0de('0x5c'),_0xc0de('0x71'),_0xc0de('0x60'),_0xc0de('0x61'),_0xc0de('0x62'),'defaultPreferred','defaultFavicon'],'raw':!![]});})[_0xc0de('0x20')](handleEntityNotFound(_0x4465b0,null))[_0xc0de('0x20')](function(_0x4e623a){if(_0x4e623a){var _0x206ddc=_0x4e623a[_0xc0de('0x71')]&&fs['existsSync'](path[_0xc0de('0x66')](config[_0xc0de('0x6c')],_0x1979ee,_[_0xc0de('0x67')](_0x4e623a[_0xc0de('0x71')])))?path[_0xc0de('0x66')](config['root'],_0x1979ee,_[_0xc0de('0x67')](_0x4e623a[_0xc0de('0x71')])):path[_0xc0de('0x66')](config[_0xc0de('0x6c')],_0x1979ee,_[_0xc0de('0x67')](_0xc0de('0x78')));var _0x42c321=_0xc0de('0x69')+_['upperFirst'](_0xc0de('0x71'));if(_0x4e623a[_0x42c321]||!_0x5719e1['custom']||!_0x5719e1[_0xc0de('0x71')]){_0x206ddc=path[_0xc0de('0x66')](config[_0xc0de('0x6c')],_0x1979ee,_[_0xc0de('0x67')]('default_preferred.png'));}if(!fs['existsSync'](_0x206ddc)){throw new db['Sequelize'][(_0xc0de('0x73'))](_['upperFirst'](_0xc0de('0x71'))+'\x20not\x20found');}return _0x4465b0[_0xc0de('0x6f')](_0x206ddc);}})[_0xc0de('0x29')](handleError(_0x4465b0,null));};exports[_0xc0de('0x79')]=function(_0x180636,_0xbc78b5,_0xf0c8e1){if(_0x180636[_0xc0de('0x58')]&&_0x180636[_0xc0de('0x58')]['filename']){_0x180636[_0xc0de('0x56')][_0xc0de('0x60')]=_0x180636[_0xc0de('0x58')]['filename'];}return db[_0xc0de('0x3b')]['find']({'where':{'id':_0x180636[_0xc0de('0x53')]['id']}})[_0xc0de('0x20')](handleEntityNotFound(_0xbc78b5,null))[_0xc0de('0x20')](saveUpdates(_0x180636[_0xc0de('0x56')],null))[_0xc0de('0x20')](respondWithResult(_0xbc78b5,null))['catch'](handleError(_0xbc78b5,null));};var utilLicense=require(_0xc0de('0x1b'));exports[_0xc0de('0x7a')]=function(_0x330a1b,_0x405bbe,_0x1e6f94){var _0x132935='server/files/images/logos';var _0x430054={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x11160a){if(_0x11160a){_0x430054=_0x11160a;}return db['Setting']['find']({'where':{'id':_0x330a1b['params']['id']},'attributes':[_0xc0de('0x59'),_0xc0de('0x5c'),_0xc0de('0x71'),_0xc0de('0x60'),'defaultLogo',_0xc0de('0x62'),'defaultPreferred','defaultFavicon'],'raw':!![]});})[_0xc0de('0x20')](handleEntityNotFound(_0x405bbe,null))['then'](function(_0x627533){if(_0x627533){var _0x57755e=_0x627533[_0xc0de('0x60')]&&fs['existsSync'](path[_0xc0de('0x66')](config['root'],_0x132935,_[_0xc0de('0x67')](_0x627533['favicon'])))?path[_0xc0de('0x66')](config[_0xc0de('0x6c')],_0x132935,_[_0xc0de('0x67')](_0x627533[_0xc0de('0x60')])):path[_0xc0de('0x66')](config[_0xc0de('0x6c')],_0x132935,_[_0xc0de('0x67')](_0xc0de('0x7b')));var _0x2dff2d=_0xc0de('0x69')+_['upperFirst']('favicon');if(_0x627533[_0x2dff2d]||!_0x430054['custom']){_0x57755e=path['join'](config[_0xc0de('0x6c')],_0x132935,_['toLower']('default_favicon.ico'));}if(!fs['existsSync'](_0x57755e)){throw new db[(_0xc0de('0x6d'))][(_0xc0de('0x73'))](_[_0xc0de('0x6a')](_0xc0de('0x60'))+_0xc0de('0x6e'));}return _0x405bbe[_0xc0de('0x6f')](_0x57755e);}})[_0xc0de('0x29')](handleError(_0x405bbe,null));};exports['getDate']=function(_0xfb63e4,_0x5dbc1a){var _0x106106={'offset':moment()[_0xc0de('0x7c')]()};_0x106106[_0xc0de('0x7d')]=moment()[_0xc0de('0x7c')](_0x106106[_0xc0de('0x2d')])['format']('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0x5dbc1a[_0xc0de('0x2a')](0xc8)['send'](_0x106106);}; \ No newline at end of file +var _0xfd76=['favicon','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','now','format','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','fs-extra','lodash','squel','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','jayson/promise','client','http','request','then','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','fields','length','attributes','nolimit','order','sort','where','pick','filter','options','includeAll','Setting','findAll','rows','params','include','merge','body','addLogo','file','logo','filename','find','../../config/license/util','server/files/images/logos','getLicense','loginLogo','preferred','defaultLogo','defaultPreferred','join','root','default_logo.svg','default','custom','toLower','Sequelize','ValidationError','upperFirst','\x20not\x20found','getLogoLogin','defaultLoginLogo','defaultFavicon','existsSync','default_loginLogo.svg','download','gdpr','securePassword','getPreferred'];(function(_0x1bd19d,_0x55af87){var _0x1dfac0=function(_0x41f3aa){while(--_0x41f3aa){_0x1bd19d['push'](_0x1bd19d['shift']());}};_0x1dfac0(++_0x55af87);}(_0xfd76,0x101));var _0x6fd7=function(_0x1aa3fe,_0x27c5fa){_0x1aa3fe=_0x1aa3fe-0x0;var _0x163cee=_0xfd76[_0x1aa3fe];return _0x163cee;};'use strict';var emlformat=require(_0x6fd7('0x0'));var rimraf=require(_0x6fd7('0x1'));var zipdir=require(_0x6fd7('0x2'));var jsonpatch=require(_0x6fd7('0x3'));var rp=require(_0x6fd7('0x4'));var moment=require('moment');var BPromise=require(_0x6fd7('0x5'));var Mustache=require('mustache');var util=require(_0x6fd7('0x6'));var path=require('path');var sox=require(_0x6fd7('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6fd7('0x8'));var _=require(_0x6fd7('0x9'));var squel=require(_0x6fd7('0xa'));var crypto=require(_0x6fd7('0xb'));var jsforce=require(_0x6fd7('0xc'));var deskjs=require(_0x6fd7('0xd'));var toCsv=require(_0x6fd7('0xe'));var querystring=require(_0x6fd7('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6fd7('0x10'));var qs=require(_0x6fd7('0x11'));var as=require(_0x6fd7('0x12'));var hardwareService=require(_0x6fd7('0x13'));var logger=require(_0x6fd7('0x14'))(_0x6fd7('0x15'));var utils=require(_0x6fd7('0x16'));var config=require(_0x6fd7('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x6fd7('0x18'))['db'];var jayson=require(_0x6fd7('0x19'));var client=jayson[_0x6fd7('0x1a')][_0x6fd7('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0xd73927,_0x199181,_0x4170d5,_0x193d1){return new BPromise(function(_0x3a2817,_0x2fa118){var _0x5b13bb=_0x193d1||client;return _0x5b13bb[_0x6fd7('0x1c')](_0xd73927,_0x4170d5)[_0x6fd7('0x1d')](function(_0x1c2172){logger['info'](_0x6fd7('0x1e'),_0x199181,_0x6fd7('0x1f'));logger[_0x6fd7('0x20')](_0x6fd7('0x21'),_0x199181,_0x6fd7('0x1f'),JSON[_0x6fd7('0x22')](_0x1c2172));if(_0x1c2172['error']){if(_0x1c2172['error']['code']===0x1f4){logger['error'](_0x6fd7('0x1e'),_0x199181,_0x1c2172[_0x6fd7('0x23')]['message']);return _0x2fa118(_0x1c2172[_0x6fd7('0x23')][_0x6fd7('0x24')]);}logger[_0x6fd7('0x23')](_0x6fd7('0x1e'),_0x199181,_0x1c2172[_0x6fd7('0x23')][_0x6fd7('0x24')]);return _0x3a2817(_0x1c2172[_0x6fd7('0x23')][_0x6fd7('0x24')]);}else{logger['info'](_0x6fd7('0x1e'),_0x199181,'request\x20sent');_0x3a2817(_0x1c2172[_0x6fd7('0x25')][_0x6fd7('0x24')]);}})[_0x6fd7('0x26')](function(_0x27abab){logger['error'](_0x6fd7('0x1e'),_0x199181,_0x27abab);_0x2fa118(_0x27abab);});});}function respondWithStatusCode(_0x3e5e8f,_0x196846){_0x196846=_0x196846||0xcc;return function(_0x4c9d99){if(_0x4c9d99){return _0x3e5e8f[_0x6fd7('0x27')](_0x196846);}return _0x3e5e8f[_0x6fd7('0x28')](_0x196846)[_0x6fd7('0x29')]();};}function respondWithResult(_0x4f0b8d,_0x1adcc0){_0x1adcc0=_0x1adcc0||0xc8;return function(_0x57e3bd){if(_0x57e3bd){return _0x4f0b8d[_0x6fd7('0x28')](_0x1adcc0)[_0x6fd7('0x2a')](_0x57e3bd);}};}function respondWithFilteredResult(_0x5b43be,_0x58d550){return function(_0x25cb78){if(_0x25cb78){var _0x5cd1a0=typeof _0x58d550[_0x6fd7('0x2b')]===_0x6fd7('0x2c')&&typeof _0x58d550[_0x6fd7('0x2d')]===_0x6fd7('0x2c');var _0x368855=_0x25cb78['count'];var _0x719936=_0x5cd1a0?0x0:_0x58d550[_0x6fd7('0x2b')];var _0x203269=_0x5cd1a0?_0x25cb78[_0x6fd7('0x2e')]:_0x58d550[_0x6fd7('0x2b')]+_0x58d550[_0x6fd7('0x2d')];var _0x5adb55;if(_0x203269>=_0x368855){_0x203269=_0x368855;_0x5adb55=0xc8;}else{_0x5adb55=0xce;}_0x5b43be[_0x6fd7('0x28')](_0x5adb55);return _0x5b43be[_0x6fd7('0x2f')](_0x6fd7('0x30'),_0x719936+'-'+_0x203269+'/'+_0x368855)[_0x6fd7('0x2a')](_0x25cb78);}return null;};}function patchUpdates(_0x5605d9){return function(_0x49beb3){try{jsonpatch[_0x6fd7('0x31')](_0x49beb3,_0x5605d9,!![]);}catch(_0x478c6b){return BPromise[_0x6fd7('0x32')](_0x478c6b);}return _0x49beb3['save']();};}function saveUpdates(_0x1a1542,_0x562337){return function(_0x433304){if(_0x433304){return _0x433304[_0x6fd7('0x33')](_0x1a1542)[_0x6fd7('0x1d')](function(_0x5da057){return _0x5da057;});}return null;};}function removeEntity(_0x4cf7e5,_0x496038){return function(_0x5842aa){if(_0x5842aa){return _0x5842aa[_0x6fd7('0x34')]()['then'](function(){_0x4cf7e5[_0x6fd7('0x28')](0xcc)[_0x6fd7('0x29')]();});}};}function handleEntityNotFound(_0x170ad4,_0x5cc10f){return function(_0x47f533){if(!_0x47f533){_0x170ad4['sendStatus'](0x194);}return _0x47f533;};}function handleError(_0x6d1ff5,_0x4d721){_0x4d721=_0x4d721||0x1f4;return function(_0x5237ed){logger[_0x6fd7('0x23')](_0x5237ed[_0x6fd7('0x35')]);if(_0x5237ed[_0x6fd7('0x36')]){delete _0x5237ed[_0x6fd7('0x36')];}_0x6d1ff5[_0x6fd7('0x28')](_0x4d721)[_0x6fd7('0x37')](_0x5237ed);};}exports[_0x6fd7('0x38')]=function(_0x435b14,_0x2d8cad){var _0x28ffc4={},_0x2115b8={},_0x289c91={'count':0x0,'rows':[]};var _0x416991=_[_0x6fd7('0x39')](db['Setting'][_0x6fd7('0x3a')],function(_0x4eb084){return{'name':_0x4eb084['fieldName'],'type':_0x4eb084[_0x6fd7('0x3b')][_0x6fd7('0x3c')]};});_0x2115b8[_0x6fd7('0x3d')]=_['map'](_0x416991,_0x6fd7('0x36'));_0x2115b8[_0x6fd7('0x3e')]=_[_0x6fd7('0x3f')](_0x435b14[_0x6fd7('0x3e')]);_0x2115b8[_0x6fd7('0x40')]=_[_0x6fd7('0x41')](_0x2115b8['model'],_0x2115b8[_0x6fd7('0x3e')]);_0x28ffc4['attributes']=_[_0x6fd7('0x41')](_0x2115b8[_0x6fd7('0x3d')],qs[_0x6fd7('0x42')](_0x435b14[_0x6fd7('0x3e')][_0x6fd7('0x42')]));_0x28ffc4['attributes']=_0x28ffc4['attributes'][_0x6fd7('0x43')]?_0x28ffc4[_0x6fd7('0x44')]:_0x2115b8['model'];if(!_0x435b14[_0x6fd7('0x3e')]['hasOwnProperty'](_0x6fd7('0x45'))){_0x28ffc4['limit']=qs[_0x6fd7('0x2d')](_0x435b14[_0x6fd7('0x3e')][_0x6fd7('0x2d')]);_0x28ffc4['offset']=qs['offset'](_0x435b14[_0x6fd7('0x3e')][_0x6fd7('0x2b')]);}_0x28ffc4[_0x6fd7('0x46')]=qs[_0x6fd7('0x47')](_0x435b14[_0x6fd7('0x3e')]['sort']);_0x28ffc4[_0x6fd7('0x48')]=qs[_0x6fd7('0x40')](_[_0x6fd7('0x49')](_0x435b14[_0x6fd7('0x3e')],_0x2115b8[_0x6fd7('0x40')]),_0x416991);if(_0x435b14[_0x6fd7('0x3e')][_0x6fd7('0x4a')]){_0x28ffc4[_0x6fd7('0x48')]=_['merge'](_0x28ffc4[_0x6fd7('0x48')],{'$or':_[_0x6fd7('0x39')](_0x416991,function(_0x5748f0){if(_0x5748f0['type']!=='VIRTUAL'){var _0x5b1268={};_0x5b1268[_0x5748f0[_0x6fd7('0x36')]]={'$like':'%'+_0x435b14[_0x6fd7('0x3e')][_0x6fd7('0x4a')]+'%'};return _0x5b1268;}})});}_0x28ffc4=_['merge']({},_0x28ffc4,_0x435b14[_0x6fd7('0x4b')]);var _0x49ded4={'where':_0x28ffc4[_0x6fd7('0x48')]};return db['Setting'][_0x6fd7('0x2e')](_0x49ded4)[_0x6fd7('0x1d')](function(_0x182031){_0x289c91[_0x6fd7('0x2e')]=_0x182031;if(_0x435b14[_0x6fd7('0x3e')][_0x6fd7('0x4c')]){_0x28ffc4['include']=[{'all':!![]}];}return db[_0x6fd7('0x4d')][_0x6fd7('0x4e')](_0x28ffc4);})['then'](function(_0xc37db1){_0x289c91[_0x6fd7('0x4f')]=_0xc37db1;return _0x289c91;})[_0x6fd7('0x1d')](respondWithFilteredResult(_0x2d8cad,_0x28ffc4))['catch'](handleError(_0x2d8cad,null));};exports['show']=function(_0x422af0,_0x2ea332){var _0x1ce1e6={'raw':![],'where':{'id':_0x422af0[_0x6fd7('0x50')]['id']}},_0x4c71cb={};_0x4c71cb[_0x6fd7('0x3d')]=_[_0x6fd7('0x3f')](db[_0x6fd7('0x4d')][_0x6fd7('0x3a')]);_0x4c71cb[_0x6fd7('0x3e')]=_['keys'](_0x422af0['query']);_0x4c71cb['filters']=_[_0x6fd7('0x41')](_0x4c71cb[_0x6fd7('0x3d')],_0x4c71cb[_0x6fd7('0x3e')]);_0x1ce1e6[_0x6fd7('0x44')]=_[_0x6fd7('0x41')](_0x4c71cb[_0x6fd7('0x3d')],qs[_0x6fd7('0x42')](_0x422af0[_0x6fd7('0x3e')][_0x6fd7('0x42')]));_0x1ce1e6[_0x6fd7('0x44')]=_0x1ce1e6[_0x6fd7('0x44')][_0x6fd7('0x43')]?_0x1ce1e6[_0x6fd7('0x44')]:_0x4c71cb[_0x6fd7('0x3d')];if(_0x422af0[_0x6fd7('0x3e')]['includeAll']){_0x1ce1e6[_0x6fd7('0x51')]=[{'all':!![]}];}_0x1ce1e6=_[_0x6fd7('0x52')]({},_0x1ce1e6,_0x422af0[_0x6fd7('0x4b')]);return db[_0x6fd7('0x4d')]['find'](_0x1ce1e6)['then'](handleEntityNotFound(_0x2ea332,null))[_0x6fd7('0x1d')](respondWithResult(_0x2ea332,null))[_0x6fd7('0x26')](handleError(_0x2ea332,null));};exports[_0x6fd7('0x33')]=function(_0x274320,_0x2d6a6f){if(_0x274320[_0x6fd7('0x53')]['id']){delete _0x274320[_0x6fd7('0x53')]['id'];}return db[_0x6fd7('0x4d')]['find']({'where':{'id':_0x274320[_0x6fd7('0x50')]['id']}})[_0x6fd7('0x1d')](handleEntityNotFound(_0x2d6a6f,null))[_0x6fd7('0x1d')](saveUpdates(_0x274320[_0x6fd7('0x53')],null))[_0x6fd7('0x1d')](respondWithResult(_0x2d6a6f,null))[_0x6fd7('0x26')](handleError(_0x2d6a6f,null));};exports[_0x6fd7('0x54')]=function(_0x5f57da,_0x39ae32,_0x384e57){if(_0x5f57da[_0x6fd7('0x55')]&&_0x5f57da[_0x6fd7('0x55')]['filename']){_0x5f57da[_0x6fd7('0x53')][_0x6fd7('0x56')]=_0x5f57da[_0x6fd7('0x55')][_0x6fd7('0x57')];}return db[_0x6fd7('0x4d')]['find']({'where':{'id':_0x5f57da[_0x6fd7('0x50')]['id']}})[_0x6fd7('0x1d')](handleEntityNotFound(_0x39ae32,null))[_0x6fd7('0x1d')](saveUpdates(_0x5f57da[_0x6fd7('0x53')],null))[_0x6fd7('0x1d')](respondWithResult(_0x39ae32,null))[_0x6fd7('0x26')](handleError(_0x39ae32,null));};exports['addLogoLogin']=function(_0x34ee7b,_0x2fded6,_0x490e54){if(_0x34ee7b[_0x6fd7('0x55')]&&_0x34ee7b[_0x6fd7('0x55')]['filename']){_0x34ee7b[_0x6fd7('0x53')]['loginLogo']=_0x34ee7b['file']['filename'];}return db[_0x6fd7('0x4d')][_0x6fd7('0x58')]({'where':{'id':_0x34ee7b[_0x6fd7('0x50')]['id']}})[_0x6fd7('0x1d')](handleEntityNotFound(_0x2fded6,null))[_0x6fd7('0x1d')](saveUpdates(_0x34ee7b['body'],null))[_0x6fd7('0x1d')](respondWithResult(_0x2fded6,null))[_0x6fd7('0x26')](handleError(_0x2fded6,null));};var utilLicense=require(_0x6fd7('0x59'));exports['getLogo']=function(_0xc8b004,_0x457688,_0x34245d){var _0x18c313=_0x6fd7('0x5a');var _0x94ee02={'custom':![]};return utilLicense[_0x6fd7('0x5b')]()[_0x6fd7('0x1d')](function(_0x315ce2){if(_0x315ce2){_0x94ee02=_0x315ce2;}return db['Setting'][_0x6fd7('0x58')]({'where':{'id':_0xc8b004[_0x6fd7('0x50')]['id']},'attributes':[_0x6fd7('0x56'),_0x6fd7('0x5c'),_0x6fd7('0x5d'),'favicon',_0x6fd7('0x5e'),'defaultLoginLogo',_0x6fd7('0x5f'),'defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x457688,null))[_0x6fd7('0x1d')](function(_0x529b1e){if(_0x529b1e){var _0x1b5892=_0x529b1e[_0x6fd7('0x56')]&&fs['existsSync'](path[_0x6fd7('0x60')](config[_0x6fd7('0x61')],_0x18c313,_['toLower'](_0x529b1e[_0x6fd7('0x56')])))?path[_0x6fd7('0x60')](config[_0x6fd7('0x61')],_0x18c313,_['toLower'](_0x529b1e['logo'])):path[_0x6fd7('0x60')](config[_0x6fd7('0x61')],_0x18c313,_['toLower'](_0x6fd7('0x62')));var _0x4968a4=_0x6fd7('0x63')+_['upperFirst'](_0x6fd7('0x56'));if(_0x529b1e[_0x4968a4]||!_0x94ee02[_0x6fd7('0x64')]){_0x1b5892=path[_0x6fd7('0x60')](config[_0x6fd7('0x61')],_0x18c313,_[_0x6fd7('0x65')](_0x6fd7('0x62')));}if(!fs['existsSync'](_0x1b5892)){throw new db[(_0x6fd7('0x66'))][(_0x6fd7('0x67'))](_[_0x6fd7('0x68')](_0x6fd7('0x56'))+_0x6fd7('0x69'));}return _0x457688['download'](_0x1b5892);}})[_0x6fd7('0x26')](handleError(_0x457688,null));};var utilLicense=require('../../config/license/util');exports[_0x6fd7('0x6a')]=function(_0x23c1ba,_0x47d1ad,_0x34fb20){var _0x1a2084=_0x6fd7('0x5a');var _0x1f68b3={'custom':![]};return utilLicense[_0x6fd7('0x5b')]()['then'](function(_0x4afeed){if(_0x4afeed){_0x1f68b3=_0x4afeed;}return db['Setting']['find']({'where':{'id':_0x23c1ba[_0x6fd7('0x50')]['id']},'attributes':['logo',_0x6fd7('0x5c'),'preferred','favicon',_0x6fd7('0x5e'),_0x6fd7('0x6b'),_0x6fd7('0x5f'),_0x6fd7('0x6c')],'raw':!![]});})[_0x6fd7('0x1d')](handleEntityNotFound(_0x47d1ad,null))[_0x6fd7('0x1d')](function(_0x28dcd6){if(_0x28dcd6){var _0x1b84fb=_0x28dcd6['loginLogo']&&fs[_0x6fd7('0x6d')](path[_0x6fd7('0x60')](config[_0x6fd7('0x61')],_0x1a2084,_[_0x6fd7('0x65')](_0x28dcd6[_0x6fd7('0x5c')])))?path[_0x6fd7('0x60')](config[_0x6fd7('0x61')],_0x1a2084,_['toLower'](_0x28dcd6[_0x6fd7('0x5c')])):path[_0x6fd7('0x60')](config['root'],_0x1a2084,_['toLower']('default_loginLogo.svg'));var _0x199970=_0x6fd7('0x63')+_['upperFirst'](_0x6fd7('0x5c'));if(_0x28dcd6[_0x199970]||!_0x1f68b3[_0x6fd7('0x64')]){_0x1b84fb=path[_0x6fd7('0x60')](config['root'],_0x1a2084,_[_0x6fd7('0x65')](_0x6fd7('0x6e')));}if(!fs[_0x6fd7('0x6d')](_0x1b84fb)){throw new db[(_0x6fd7('0x66'))]['ValidationError'](_[_0x6fd7('0x68')]('loginLogo')+_0x6fd7('0x69'));}return _0x47d1ad[_0x6fd7('0x6f')](_0x1b84fb);}})[_0x6fd7('0x26')](handleError(_0x47d1ad,null));};exports[_0x6fd7('0x70')]=function(_0x1c7a0d,_0x49ccd7){return db[_0x6fd7('0x4d')][_0x6fd7('0x58')]({'where':{'id':_0x1c7a0d[_0x6fd7('0x50')]['id']},'attributes':[_0x6fd7('0x71')]})[_0x6fd7('0x1d')](respondWithResult(_0x49ccd7,null))['catch'](handleError(_0x49ccd7,null));};exports['addPreferred']=function(_0x16d622,_0x22ff75,_0x54ad04){if(_0x16d622['file']&&_0x16d622['file']['filename']){_0x16d622[_0x6fd7('0x53')][_0x6fd7('0x5d')]=_0x16d622[_0x6fd7('0x55')]['filename'];}return db[_0x6fd7('0x4d')][_0x6fd7('0x58')]({'where':{'id':_0x16d622[_0x6fd7('0x50')]['id']}})[_0x6fd7('0x1d')](handleEntityNotFound(_0x22ff75,null))[_0x6fd7('0x1d')](saveUpdates(_0x16d622['body'],null))[_0x6fd7('0x1d')](respondWithResult(_0x22ff75,null))['catch'](handleError(_0x22ff75,null));};var utilLicense=require(_0x6fd7('0x59'));exports[_0x6fd7('0x72')]=function(_0xe4640d,_0x461fc5,_0x10dd48){var _0x1fe3b5=_0x6fd7('0x5a');var _0x1e9995={'custom':![]};return utilLicense['getLicense']()['then'](function(_0xf51939){if(_0xf51939){_0x1e9995=_0xf51939;}return db['Setting'][_0x6fd7('0x58')]({'where':{'id':_0xe4640d[_0x6fd7('0x50')]['id']},'attributes':[_0x6fd7('0x56'),_0x6fd7('0x5c'),_0x6fd7('0x5d'),_0x6fd7('0x73'),_0x6fd7('0x5e'),_0x6fd7('0x6b'),_0x6fd7('0x5f'),_0x6fd7('0x6c')],'raw':!![]});})[_0x6fd7('0x1d')](handleEntityNotFound(_0x461fc5,null))[_0x6fd7('0x1d')](function(_0x17ec64){if(_0x17ec64){var _0x240d42=_0x17ec64[_0x6fd7('0x5d')]&&fs[_0x6fd7('0x6d')](path[_0x6fd7('0x60')](config[_0x6fd7('0x61')],_0x1fe3b5,_['toLower'](_0x17ec64[_0x6fd7('0x5d')])))?path[_0x6fd7('0x60')](config[_0x6fd7('0x61')],_0x1fe3b5,_[_0x6fd7('0x65')](_0x17ec64[_0x6fd7('0x5d')])):path[_0x6fd7('0x60')](config[_0x6fd7('0x61')],_0x1fe3b5,_['toLower']('default_preferred.png'));var _0x1293ac=_0x6fd7('0x63')+_['upperFirst']('preferred');if(_0x17ec64[_0x1293ac]||!_0x1e9995[_0x6fd7('0x64')]||!_0x1e9995['preferred']){_0x240d42=path[_0x6fd7('0x60')](config[_0x6fd7('0x61')],_0x1fe3b5,_[_0x6fd7('0x65')](_0x6fd7('0x74')));}if(!fs['existsSync'](_0x240d42)){throw new db[(_0x6fd7('0x66'))][(_0x6fd7('0x67'))](_[_0x6fd7('0x68')](_0x6fd7('0x5d'))+'\x20not\x20found');}return _0x461fc5[_0x6fd7('0x6f')](_0x240d42);}})[_0x6fd7('0x26')](handleError(_0x461fc5,null));};exports[_0x6fd7('0x75')]=function(_0x23bd73,_0x537784,_0x1937b1){if(_0x23bd73[_0x6fd7('0x55')]&&_0x23bd73[_0x6fd7('0x55')][_0x6fd7('0x57')]){_0x23bd73['body']['favicon']=_0x23bd73[_0x6fd7('0x55')][_0x6fd7('0x57')];}return db['Setting']['find']({'where':{'id':_0x23bd73[_0x6fd7('0x50')]['id']}})[_0x6fd7('0x1d')](handleEntityNotFound(_0x537784,null))[_0x6fd7('0x1d')](saveUpdates(_0x23bd73[_0x6fd7('0x53')],null))[_0x6fd7('0x1d')](respondWithResult(_0x537784,null))[_0x6fd7('0x26')](handleError(_0x537784,null));};var utilLicense=require('../../config/license/util');exports[_0x6fd7('0x76')]=function(_0x3b44b9,_0x145cf1,_0x5377bb){var _0x544c4f='server/files/images/logos';var _0x512b08={'custom':![]};return utilLicense[_0x6fd7('0x5b')]()[_0x6fd7('0x1d')](function(_0x203499){if(_0x203499){_0x512b08=_0x203499;}return db[_0x6fd7('0x4d')][_0x6fd7('0x58')]({'where':{'id':_0x3b44b9[_0x6fd7('0x50')]['id']},'attributes':[_0x6fd7('0x56'),_0x6fd7('0x5c'),_0x6fd7('0x5d'),_0x6fd7('0x73'),_0x6fd7('0x5e'),_0x6fd7('0x6b'),_0x6fd7('0x5f'),_0x6fd7('0x6c')],'raw':!![]});})[_0x6fd7('0x1d')](handleEntityNotFound(_0x145cf1,null))[_0x6fd7('0x1d')](function(_0x41583f){if(_0x41583f){var _0xd735e9=_0x41583f[_0x6fd7('0x73')]&&fs['existsSync'](path[_0x6fd7('0x60')](config['root'],_0x544c4f,_['toLower'](_0x41583f[_0x6fd7('0x73')])))?path[_0x6fd7('0x60')](config[_0x6fd7('0x61')],_0x544c4f,_['toLower'](_0x41583f[_0x6fd7('0x73')])):path[_0x6fd7('0x60')](config[_0x6fd7('0x61')],_0x544c4f,_['toLower'](_0x6fd7('0x77')));var _0x92a32b=_0x6fd7('0x63')+_[_0x6fd7('0x68')](_0x6fd7('0x73'));if(_0x41583f[_0x92a32b]||!_0x512b08[_0x6fd7('0x64')]){_0xd735e9=path['join'](config['root'],_0x544c4f,_[_0x6fd7('0x65')](_0x6fd7('0x77')));}if(!fs[_0x6fd7('0x6d')](_0xd735e9)){throw new db[(_0x6fd7('0x66'))][(_0x6fd7('0x67'))](_[_0x6fd7('0x68')](_0x6fd7('0x73'))+_0x6fd7('0x69'));}return _0x145cf1[_0x6fd7('0x6f')](_0xd735e9);}})[_0x6fd7('0x26')](handleError(_0x145cf1,null));};exports[_0x6fd7('0x78')]=function(_0x4b6a56,_0x166f86){var _0x475a73={'offset':moment()[_0x6fd7('0x79')]()};_0x475a73[_0x6fd7('0x7a')]=moment()[_0x6fd7('0x79')](_0x475a73['offset'])[_0x6fd7('0x7b')]('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0x166f86[_0x6fd7('0x28')](0xc8)[_0x6fd7('0x37')](_0x475a73);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index cff03f2..e761e23 100644 --- a/server/api/setting/setting.model.js +++ b/server/api/setting/setting.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['settings','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./setting.attributes','exports','Setting'];(function(_0x217940,_0x986fc2){var _0x3df61d=function(_0x15b946){while(--_0x15b946){_0x217940['push'](_0x217940['shift']());}};_0x3df61d(++_0x986fc2);}(_0x34e8,0x12c));var _0x834e=function(_0x2c22a9,_0x2c9bb8){_0x2c22a9=_0x2c22a9-0x0;var _0x3b3e22=_0x34e8[_0x2c22a9];return _0x3b3e22;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var logger=require(_0x834e('0x2'))(_0x834e('0x3'));var moment=require('moment');var BPromise=require(_0x834e('0x4'));var rp=require(_0x834e('0x5'));var fs=require('fs');var path=require(_0x834e('0x6'));var rimraf=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var attributes=require(_0x834e('0x9'));module[_0x834e('0xa')]=function(_0x4a2018,_0x858aa1){return _0x4a2018['define'](_0x834e('0xb'),attributes,{'tableName':_0x834e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x34e8=['settings','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./setting.attributes','exports','Setting'];(function(_0x1c7bfc,_0x4324e6){var _0x65a67b=function(_0x4ad8bd){while(--_0x4ad8bd){_0x1c7bfc['push'](_0x1c7bfc['shift']());}};_0x65a67b(++_0x4324e6);}(_0x34e8,0x12c));var _0x834e=function(_0x44e042,_0x2acc47){_0x44e042=_0x44e042-0x0;var _0x6044ac=_0x34e8[_0x44e042];return _0x6044ac;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var logger=require(_0x834e('0x2'))(_0x834e('0x3'));var moment=require('moment');var BPromise=require(_0x834e('0x4'));var rp=require(_0x834e('0x5'));var fs=require('fs');var path=require(_0x834e('0x6'));var rimraf=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var attributes=require(_0x834e('0x9'));module[_0x834e('0xa')]=function(_0x4a2018,_0x858aa1){return _0x4a2018['define'](_0x834e('0xb'),attributes,{'tableName':_0x834e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 25f493c..0ffbc94 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 _0x3295=['info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','ShowSetting','options','where','attributes','include','map','model','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x3295,0x1f2));var _0x5329=function(_0x383356,_0x33d2f5){_0x383356=_0x383356-0x0;var _0x32ee5a=_0x3295[_0x383356];return _0x32ee5a;};'use strict';var _=require(_0x5329('0x0'));var util=require(_0x5329('0x1'));var moment=require(_0x5329('0x2'));var BPromise=require(_0x5329('0x3'));var rs=require(_0x5329('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5329('0x5'))['db'];var utils=require(_0x5329('0x6'));var logger=require(_0x5329('0x7'))(_0x5329('0x8'));var config=require(_0x5329('0x9'));var jayson=require(_0x5329('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4ee10a,_0x5c0b31,_0x28a99c){return new BPromise(function(_0x3307df,_0x565862){return client['request'](_0x4ee10a,_0x28a99c)[_0x5329('0xb')](function(_0x1fd9fc){logger[_0x5329('0xc')](_0x5329('0xd'),_0x5c0b31,_0x5329('0xe'));logger[_0x5329('0xf')](_0x5329('0x10'),_0x5c0b31,_0x5329('0xe'),JSON[_0x5329('0x11')](_0x1fd9fc));if(_0x1fd9fc['error']){if(_0x1fd9fc['error'][_0x5329('0x12')]===0x1f4){logger[_0x5329('0x13')](_0x5329('0xd'),_0x5c0b31,_0x1fd9fc[_0x5329('0x13')][_0x5329('0x14')]);return _0x565862(_0x1fd9fc[_0x5329('0x13')]['message']);}logger[_0x5329('0x13')](_0x5329('0xd'),_0x5c0b31,_0x1fd9fc['error']['message']);return _0x3307df(_0x1fd9fc['error']['message']);}else{logger[_0x5329('0xc')](_0x5329('0xd'),_0x5c0b31,_0x5329('0xe'));_0x3307df(_0x1fd9fc[_0x5329('0x15')]['message']);}})[_0x5329('0x16')](function(_0x3d87e5){logger[_0x5329('0x13')]('Setting,\x20%s,\x20%s',_0x5c0b31,_0x3d87e5);_0x565862(_0x3d87e5);});});}exports[_0x5329('0x17')]=function(_0x5987fb){var _0x30ecc0=this;return new Promise(function(_0x3b406f,_0xbb5081){return db['Setting']['find']({'raw':_0x5987fb[_0x5329('0x18')]?_0x5987fb[_0x5329('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x5987fb[_0x5329('0x18')]?_0x5987fb[_0x5329('0x18')][_0x5329('0x19')]||null:null,'attributes':_0x5987fb[_0x5329('0x18')]?_0x5987fb[_0x5329('0x18')][_0x5329('0x1a')]||null:null,'include':_0x5987fb['options']?_0x5987fb[_0x5329('0x18')][_0x5329('0x1b')]?_[_0x5329('0x1c')](_0x5987fb[_0x5329('0x18')][_0x5329('0x1b')],function(_0x3bd1e4){return{'model':db[_0x3bd1e4[_0x5329('0x1d')]],'as':_0x3bd1e4['as'],'attributes':_0x3bd1e4[_0x5329('0x1a')],'include':_0x3bd1e4[_0x5329('0x1b')]?_[_0x5329('0x1c')](_0x3bd1e4[_0x5329('0x1b')],function(_0x4666ea){return{'model':db[_0x4666ea[_0x5329('0x1d')]],'as':_0x4666ea['as'],'attributes':_0x4666ea[_0x5329('0x1a')],'include':_0x4666ea['include']?_[_0x5329('0x1c')](_0x4666ea['include'],function(_0x50d93a){return{'model':db[_0x50d93a[_0x5329('0x1d')]],'as':_0x50d93a['as'],'attributes':_0x50d93a[_0x5329('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x223f9d){logger[_0x5329('0xc')]('ShowSetting',_0x5987fb);logger[_0x5329('0xf')](_0x5329('0x17'),_0x5987fb,JSON[_0x5329('0x11')](_0x223f9d));_0x3b406f(_0x223f9d);})[_0x5329('0x16')](function(_0x489a7d){logger[_0x5329('0x13')](_0x5329('0x17'),_0x489a7d[_0x5329('0x14')],_0x5987fb);_0xbb5081(_0x30ecc0[_0x5329('0x13')](0x1f4,_0x489a7d['message']));});});}; \ No newline at end of file +var _0xff10=['Setting,\x20%s,\x20%s','message','request\x20sent','result','catch','ShowSetting','find','options','where','map','include','model','attributes','stringify','util','moment','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','Setting,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x5037ab,_0x43209e){var _0x512adb=function(_0x261783){while(--_0x261783){_0x5037ab['push'](_0x5037ab['shift']());}};_0x512adb(++_0x43209e);}(_0xff10,0x158));var _0x0ff1=function(_0x245643,_0x3e2322){_0x245643=_0x245643-0x0;var _0x4ff8af=_0xff10[_0x245643];return _0x4ff8af;};'use strict';var _=require('lodash');var util=require(_0x0ff1('0x0'));var moment=require(_0x0ff1('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0ff1('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0ff1('0x3'))(_0x0ff1('0x4'));var config=require(_0x0ff1('0x5'));var jayson=require(_0x0ff1('0x6'));var client=jayson[_0x0ff1('0x7')][_0x0ff1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1f7444,_0x55b0c6,_0x138561){return new BPromise(function(_0x6f4701,_0x3ac78a){return client[_0x0ff1('0x9')](_0x1f7444,_0x138561)[_0x0ff1('0xa')](function(_0x24766d){logger[_0x0ff1('0xb')]('Setting,\x20%s,\x20%s',_0x55b0c6,'request\x20sent');logger[_0x0ff1('0xc')](_0x0ff1('0xd'),_0x55b0c6,'request\x20sent',JSON['stringify'](_0x24766d));if(_0x24766d[_0x0ff1('0xe')]){if(_0x24766d[_0x0ff1('0xe')][_0x0ff1('0xf')]===0x1f4){logger[_0x0ff1('0xe')](_0x0ff1('0x10'),_0x55b0c6,_0x24766d[_0x0ff1('0xe')][_0x0ff1('0x11')]);return _0x3ac78a(_0x24766d['error']['message']);}logger['error'](_0x0ff1('0x10'),_0x55b0c6,_0x24766d[_0x0ff1('0xe')][_0x0ff1('0x11')]);return _0x6f4701(_0x24766d[_0x0ff1('0xe')][_0x0ff1('0x11')]);}else{logger[_0x0ff1('0xb')](_0x0ff1('0x10'),_0x55b0c6,_0x0ff1('0x12'));_0x6f4701(_0x24766d[_0x0ff1('0x13')][_0x0ff1('0x11')]);}})[_0x0ff1('0x14')](function(_0x253161){logger[_0x0ff1('0xe')](_0x0ff1('0x10'),_0x55b0c6,_0x253161);_0x3ac78a(_0x253161);});});}exports[_0x0ff1('0x15')]=function(_0x2bd029){var _0x554be0=this;return new Promise(function(_0x3621a9,_0x41a3a5){return db['Setting'][_0x0ff1('0x16')]({'raw':_0x2bd029[_0x0ff1('0x17')]?_0x2bd029[_0x0ff1('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x2bd029['options']?_0x2bd029[_0x0ff1('0x17')][_0x0ff1('0x18')]||null:null,'attributes':_0x2bd029[_0x0ff1('0x17')]?_0x2bd029['options']['attributes']||null:null,'include':_0x2bd029[_0x0ff1('0x17')]?_0x2bd029[_0x0ff1('0x17')]['include']?_[_0x0ff1('0x19')](_0x2bd029[_0x0ff1('0x17')][_0x0ff1('0x1a')],function(_0x472d4e){return{'model':db[_0x472d4e[_0x0ff1('0x1b')]],'as':_0x472d4e['as'],'attributes':_0x472d4e[_0x0ff1('0x1c')],'include':_0x472d4e[_0x0ff1('0x1a')]?_[_0x0ff1('0x19')](_0x472d4e[_0x0ff1('0x1a')],function(_0x442450){return{'model':db[_0x442450[_0x0ff1('0x1b')]],'as':_0x442450['as'],'attributes':_0x442450[_0x0ff1('0x1c')],'include':_0x442450[_0x0ff1('0x1a')]?_[_0x0ff1('0x19')](_0x442450[_0x0ff1('0x1a')],function(_0x5f18cb){return{'model':db[_0x5f18cb[_0x0ff1('0x1b')]],'as':_0x5f18cb['as'],'attributes':_0x5f18cb[_0x0ff1('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x0ff1('0xa')](function(_0x4a7d65){logger[_0x0ff1('0xb')](_0x0ff1('0x15'),_0x2bd029);logger[_0x0ff1('0xc')](_0x0ff1('0x15'),_0x2bd029,JSON[_0x0ff1('0x1d')](_0x4a7d65));_0x3621a9(_0x4a7d65);})[_0x0ff1('0x14')](function(_0x5344ca){logger[_0x0ff1('0xe')]('ShowSetting',_0x5344ca[_0x0ff1('0x11')],_0x2bd029);_0x41a3a5(_0x554be0[_0x0ff1('0xe')](0x1f4,_0x5344ca[_0x0ff1('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index fb9c071..8e98155 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 _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(_0x5219bf,_0x1a4a45){var _0x46c790=function(_0x52d2b4){while(--_0x52d2b4){_0x5219bf['push'](_0x5219bf['shift']());}};_0x46c790(++_0x1a4a45);}(_0x8ef6,0xf2));var _0x68ef=function(_0x479d95,_0x2d03d7){_0x479d95=_0x479d95-0x0;var _0x35137c=_0x8ef6[_0x479d95];return _0x35137c;};'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 +var _0x6aa7=['create','addDisposition','addAnswer','addApplications','/:id/send','send','status','addAgents','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status','/:id/users','getAgents','post'];(function(_0xc0813c,_0x3bb69d){var _0x453787=function(_0x1ec927){while(--_0x1ec927){_0xc0813c['push'](_0xc0813c['shift']());}};_0x453787(++_0x3bb69d);}(_0x6aa7,0x178));var _0x76aa=function(_0x529591,_0x282912){_0x529591=_0x529591-0x0;var _0x38dc1a=_0x6aa7[_0x529591];return _0x38dc1a;};'use strict';var multer=require(_0x76aa('0x0'));var util=require('util');var path=require(_0x76aa('0x1'));var timeout=require(_0x76aa('0x2'));var express=require(_0x76aa('0x3'));var router=express[_0x76aa('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x76aa('0x5'));var interaction=require(_0x76aa('0x6'));var config=require(_0x76aa('0x7'));var controller=require('./smsAccount.controller');router['get']('/',auth[_0x76aa('0x8')](),controller['index']);router[_0x76aa('0x9')](_0x76aa('0xa'),auth[_0x76aa('0x8')](),controller['describe']);router[_0x76aa('0x9')](_0x76aa('0xb'),auth[_0x76aa('0x8')](),controller['show']);router[_0x76aa('0x9')](_0x76aa('0xc'),auth[_0x76aa('0x8')](),controller[_0x76aa('0xd')]);router[_0x76aa('0x9')](_0x76aa('0xe'),auth[_0x76aa('0x8')](),controller[_0x76aa('0xf')]);router[_0x76aa('0x9')](_0x76aa('0x10'),auth['isAuthenticated'](),controller[_0x76aa('0x11')]);router['get'](_0x76aa('0x12'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x13')]);router[_0x76aa('0x9')](_0x76aa('0x14'),controller['statusGet']);router['get'](_0x76aa('0x15'),auth['isAuthenticated'](),controller[_0x76aa('0x16')]);router[_0x76aa('0x17')]('/',auth['isAuthenticated'](),controller[_0x76aa('0x18')]);router['post'](_0x76aa('0xc'),auth['isAuthenticated'](),controller[_0x76aa('0x19')]);router[_0x76aa('0x17')](_0x76aa('0xe'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x1a')]);router[_0x76aa('0x17')]('/:id/notify',controller['notify']);router[_0x76aa('0x17')](_0x76aa('0x10'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x1b')]);router[_0x76aa('0x17')](_0x76aa('0x1c'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x1d')]);router[_0x76aa('0x17')]('/:id/status',controller[_0x76aa('0x1e')]);router[_0x76aa('0x17')](_0x76aa('0x15'),auth['isAuthenticated'](),controller[_0x76aa('0x1f')]);router[_0x76aa('0x20')](_0x76aa('0xb'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x21')]);router[_0x76aa('0x22')](_0x76aa('0xb'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x23')]);router[_0x76aa('0x22')](_0x76aa('0xc'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x24')]);router['delete'](_0x76aa('0xe'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x25')]);router[_0x76aa('0x22')](_0x76aa('0x15'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x26')]);module[_0x76aa('0x27')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 26d8f2b..3ce4bde 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 _0x5c6d=['plivo','clickatell','bandwidth','infobip','intelepeer','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','exports','name','STRING','generate','twilio','skebby','connectel','clicksend'];(function(_0x1ca7a1,_0x167f46){var _0x50f711=function(_0x1cfdb2){while(--_0x1cfdb2){_0x1ca7a1['push'](_0x1ca7a1['shift']());}};_0x50f711(++_0x167f46);}(_0x5c6d,0xf4));var _0xd5c6=function(_0x219e37,_0x4d94fa){_0x219e37=_0x219e37-0x0;var _0x27fd77=_0x5c6d[_0x219e37];return _0x27fd77;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0xd5c6('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xd5c6('0x1'),'allowNull':![]},'key':{'type':Sequelize[_0xd5c6('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0xd5c6('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0xd5c6('0x2')],'defaultValue':function(){return rs[_0xd5c6('0x3')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM'](_0xd5c6('0x4'),_0xd5c6('0x5'),_0xd5c6('0x6'),_0xd5c6('0x7'),_0xd5c6('0x8'),_0xd5c6('0x9'),_0xd5c6('0xa'),'csc',_0xd5c6('0xb'),_0xd5c6('0xc'))},'accountSid':{'type':Sequelize[_0xd5c6('0x2')]},'authId':{'type':Sequelize[_0xd5c6('0x2')]},'authToken':{'type':Sequelize[_0xd5c6('0x2')]},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xd5c6('0x2')]},'apiKey':{'type':Sequelize['STRING']},'applicationId':{'type':Sequelize[_0xd5c6('0x2')]},'accountId':{'type':Sequelize[_0xd5c6('0x2')]},'senderString':{'type':Sequelize[_0xd5c6('0x2')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xd5c6('0xd');}},'notificationSound':{'type':Sequelize[_0xd5c6('0xe')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xd5c6('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xd5c6('0xe')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xd5c6('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xd5c6('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xd5c6('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xd5c6('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xd5c6('0xf')],'comment':_0xd5c6('0x10')},'mandatoryDisposition':{'type':Sequelize[_0xd5c6('0xe')],'defaultValue':![],'comment':_0xd5c6('0x11'),'set':function(_0x2002a7){if(!_0x2002a7)this[_0xd5c6('0x12')](_0xd5c6('0x13'),null);this[_0xd5c6('0x12')](_0xd5c6('0x14'),_0x2002a7);}}}; \ No newline at end of file +var _0x8333=['plivo','clickatell','bandwidth','csc','infobip','intelepeer','BOOLEAN','TEXT','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','randomstring','exports','STRING','name','generate','ENUM','connectel'];(function(_0x2c1845,_0x55954e){var _0x2e1433=function(_0x2573b2){while(--_0x2573b2){_0x2c1845['push'](_0x2c1845['shift']());}};_0x2e1433(++_0x55954e);}(_0x8333,0x19b));var _0x3833=function(_0x4c360f,_0x228ac8){_0x4c360f=_0x4c360f-0x0;var _0x222f5f=_0x8333[_0x4c360f];return _0x222f5f;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x3833('0x0'));module[_0x3833('0x1')]={'name':{'type':Sequelize[_0x3833('0x2')],'unique':_0x3833('0x3'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x3833('0x2')],'defaultValue':function(){return rs[_0x3833('0x4')]();}},'phone':{'type':Sequelize[_0x3833('0x2')]},'type':{'type':Sequelize[_0x3833('0x5')]('twilio','skebby',_0x3833('0x6'),'clicksend',_0x3833('0x7'),_0x3833('0x8'),_0x3833('0x9'),_0x3833('0xa'),_0x3833('0xb'),_0x3833('0xc'))},'accountSid':{'type':Sequelize[_0x3833('0x2')]},'authId':{'type':Sequelize[_0x3833('0x2')]},'authToken':{'type':Sequelize[_0x3833('0x2')]},'smsMethod':{'type':Sequelize[_0x3833('0x5')]('SI','TI','GP')},'username':{'type':Sequelize[_0x3833('0x2')]},'password':{'type':Sequelize[_0x3833('0x2')]},'apiKey':{'type':Sequelize[_0x3833('0x2')]},'applicationId':{'type':Sequelize[_0x3833('0x2')]},'accountId':{'type':Sequelize[_0x3833('0x2')]},'senderString':{'type':Sequelize[_0x3833('0x2')]},'deliveryReport':{'type':Sequelize[_0x3833('0xd')],'defaultValue':![]},'description':{'type':Sequelize[_0x3833('0x2')]},'notificationTemplate':{'type':Sequelize[_0x3833('0xe')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x3833('0xd')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x3833('0xd')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x3833('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x3833('0xd')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x3833('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x3833('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x3833('0xf')],'comment':_0x3833('0x10')},'mandatoryDisposition':{'type':Sequelize[_0x3833('0xd')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x4de97e){if(!_0x4de97e)this[_0x3833('0x11')](_0x3833('0x12'),null);this['setDataValue']('mandatoryDisposition',_0x4de97e);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 17cc309..794d1de 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 _0x4dbc=['catch','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','then','destroy','get','SmsAccounts','UserProfileResource','stack','name','send','mandatoryDispositionPause','rawAttributes','fieldName','model','map','query','keys','filters','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','SmsAccount','includeAll','findAll','rows','Pause','attributes','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','SmsAccountId','Disposition','getDispositions','findOne','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','notify','sms','SmsApplication','Applications','account','applications','orderBy','priority','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','from','From','Body','MessageSid','skebby','sender','text','clicksend','Text','messageId','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','replyMessageId','intelepeer','refid','isNil','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','SmsInteraction','spread','interaction','autoclose','push','close','unmanaged','*,*,*,*','created','ContactId','AttachmentId','UserId','User','unshift','agent','Start','startRouting','receiveMessage','entity\x20found','debug','text/xml','\x0a','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','to\x20is\x20mandatory','List','out','Messages','SmsMessage','received\x20delivery\x20report\x20from','skebby_dispatch_id','connectel','requestid','statusInt','message_id','status_code','groupName','bandwidth','redif','DELIVERED','inspect','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','ACCEPTD','message-id','state','addAgents','omit','emit','userSmsAccount:save','removeAgents','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','http','request','info','SmsAccount,\x20%s,\x20%s','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x368e31,_0x17280a){var _0xe762a4=function(_0x5ea1f2){while(--_0x5ea1f2){_0x368e31['push'](_0x368e31['shift']());}};_0xe762a4(++_0x17280a);}(_0x4dbc,0x1a7));var _0xc4db=function(_0x58d528,_0xadd2c4){_0x58d528=_0x58d528-0x0;var _0xf6b6c5=_0x4dbc[_0x58d528];return _0xf6b6c5;};'use strict';var emlformat=require(_0xc4db('0x0'));var rimraf=require(_0xc4db('0x1'));var zipdir=require(_0xc4db('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc4db('0x3'));var moment=require(_0xc4db('0x4'));var BPromise=require(_0xc4db('0x5'));var Mustache=require(_0xc4db('0x6'));var util=require(_0xc4db('0x7'));var path=require(_0xc4db('0x8'));var sox=require(_0xc4db('0x9'));var csv=require(_0xc4db('0xa'));var ejs=require(_0xc4db('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xc4db('0xc'));var crypto=require(_0xc4db('0xd'));var jsforce=require(_0xc4db('0xe'));var deskjs=require(_0xc4db('0xf'));var toCsv=require(_0xc4db('0xa'));var querystring=require(_0xc4db('0x10'));var Papa=require(_0xc4db('0x11'));var Redis=require(_0xc4db('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xc4db('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc4db('0x14'));var logger=require('../../config/logger')(_0xc4db('0x15'));var utils=require(_0xc4db('0x16'));var config=require(_0xc4db('0x17'));var licenseUtil=require(_0xc4db('0x18'));var db=require(_0xc4db('0x19'))['db'];config['redis']=_[_0xc4db('0x1a')](config[_0xc4db('0x1b')],{'host':_0xc4db('0x1c'),'port':0x18eb});var socket=require(_0xc4db('0x1d'))(new Redis(config[_0xc4db('0x1b')]));require(_0xc4db('0x1e'))[_0xc4db('0x1f')](socket);var jayson=require(_0xc4db('0x20'));var client=jayson[_0xc4db('0x21')][_0xc4db('0x22')]({'port':0x232c});function respondWithRpcPromise(_0x343b27,_0x3b3e73,_0x429b18,_0x1b561a){return new BPromise(function(_0x323882,_0x1def5c){var _0x1b61f9=_0x1b561a||client;return _0x1b61f9[_0xc4db('0x23')](_0x343b27,_0x429b18)['then'](function(_0x1ee968){logger[_0xc4db('0x24')](_0xc4db('0x25'),_0x3b3e73,'request\x20sent');logger['debug'](_0xc4db('0x26'),_0x3b3e73,_0xc4db('0x27'),JSON[_0xc4db('0x28')](_0x1ee968));if(_0x1ee968[_0xc4db('0x29')]){if(_0x1ee968[_0xc4db('0x29')][_0xc4db('0x2a')]===0x1f4){logger['error'](_0xc4db('0x25'),_0x3b3e73,_0x1ee968[_0xc4db('0x29')][_0xc4db('0x2b')]);return _0x1def5c(_0x1ee968['error'][_0xc4db('0x2b')]);}logger[_0xc4db('0x29')](_0xc4db('0x25'),_0x3b3e73,_0x1ee968[_0xc4db('0x29')][_0xc4db('0x2b')]);return _0x323882(_0x1ee968[_0xc4db('0x29')][_0xc4db('0x2b')]);}else{logger[_0xc4db('0x24')](_0xc4db('0x25'),_0x3b3e73,_0xc4db('0x27'));_0x323882(_0x1ee968[_0xc4db('0x2c')][_0xc4db('0x2b')]);}})[_0xc4db('0x2d')](function(_0x42d4f8){logger['error'](_0xc4db('0x25'),_0x3b3e73,_0x42d4f8);_0x1def5c(_0x42d4f8);});});}function respondWithStatusCode(_0xda21ca,_0x32b6a9){_0x32b6a9=_0x32b6a9||0xcc;return function(_0x5c64b1){if(_0x5c64b1){return _0xda21ca[_0xc4db('0x2e')](_0x32b6a9);}return _0xda21ca[_0xc4db('0x2f')](_0x32b6a9)[_0xc4db('0x30')]();};}function respondWithResult(_0x36f6e4,_0x4ab9ce){_0x4ab9ce=_0x4ab9ce||0xc8;return function(_0x27b215){if(_0x27b215){return _0x36f6e4[_0xc4db('0x2f')](_0x4ab9ce)[_0xc4db('0x31')](_0x27b215);}};}function respondWithFilteredResult(_0x2883e0,_0x271936){return function(_0x11cb96){if(_0x11cb96){var _0x5688c8=typeof _0x271936['offset']===_0xc4db('0x32')&&typeof _0x271936[_0xc4db('0x33')]===_0xc4db('0x32');var _0x114cc6=_0x11cb96[_0xc4db('0x34')];var _0x5108ae=_0x5688c8?0x0:_0x271936[_0xc4db('0x35')];var _0x44292f=_0x5688c8?_0x11cb96[_0xc4db('0x34')]:_0x271936[_0xc4db('0x35')]+_0x271936[_0xc4db('0x33')];var _0x59e936;if(_0x44292f>=_0x114cc6){_0x44292f=_0x114cc6;_0x59e936=0xc8;}else{_0x59e936=0xce;}_0x2883e0[_0xc4db('0x2f')](_0x59e936);return _0x2883e0[_0xc4db('0x36')](_0xc4db('0x37'),_0x5108ae+'-'+_0x44292f+'/'+_0x114cc6)['json'](_0x11cb96);}return null;};}function patchUpdates(_0x30d093){return function(_0x23f2f1){try{jsonpatch[_0xc4db('0x38')](_0x23f2f1,_0x30d093,!![]);}catch(_0xeec3fe){return BPromise['reject'](_0xeec3fe);}return _0x23f2f1[_0xc4db('0x39')]();};}function saveUpdates(_0x2e958d,_0x51e9aa){return function(_0x3b8153){if(_0x3b8153){return _0x3b8153['update'](_0x2e958d)[_0xc4db('0x3a')](function(_0x33869c){return _0x33869c;});}return null;};}function removeEntity(_0x4d56a0,_0x255400){return function(_0x976527){if(_0x976527){return _0x976527[_0xc4db('0x3b')]()[_0xc4db('0x3a')](function(){var _0x486ad0=_0x976527[_0xc4db('0x3c')]({'plain':!![]});var _0x354c10=_0xc4db('0x3d');return db[_0xc4db('0x3e')]['destroy']({'where':{'type':_0x354c10,'resourceId':_0x486ad0['id']}})[_0xc4db('0x3a')](function(){return _0x976527;});})[_0xc4db('0x3a')](function(){_0x4d56a0[_0xc4db('0x2f')](0xcc)[_0xc4db('0x30')]();});}};}function handleEntityNotFound(_0x599974,_0x49f532){return function(_0x37d5fb){if(!_0x37d5fb){_0x599974[_0xc4db('0x2e')](0x194);}return _0x37d5fb;};}function handleError(_0x2d2c60,_0x512ad9){_0x512ad9=_0x512ad9||0x1f4;return function(_0x504f6e){logger[_0xc4db('0x29')](_0x504f6e[_0xc4db('0x3f')]);if(_0x504f6e['name']){delete _0x504f6e[_0xc4db('0x40')];}_0x2d2c60[_0xc4db('0x2f')](_0x512ad9)[_0xc4db('0x41')](_0x504f6e);};}exports['index']=function(_0x1ff510,_0xad12eb){var _0x5d6e4a={'include':[{'model':db['Pause'],'as':_0xc4db('0x42')}]},_0x2e95b4={},_0x585326={'count':0x0,'rows':[]};var _0x5b31d6=_['map'](db['SmsAccount'][_0xc4db('0x43')],function(_0x253e84){return{'name':_0x253e84[_0xc4db('0x44')],'type':_0x253e84['type']['key']};});_0x2e95b4[_0xc4db('0x45')]=_[_0xc4db('0x46')](_0x5b31d6,'name');_0x2e95b4[_0xc4db('0x47')]=_[_0xc4db('0x48')](_0x1ff510[_0xc4db('0x47')]);_0x2e95b4[_0xc4db('0x49')]=_[_0xc4db('0x4a')](_0x2e95b4[_0xc4db('0x45')],_0x2e95b4[_0xc4db('0x47')]);_0x5d6e4a['attributes']=_['intersection'](_0x2e95b4[_0xc4db('0x45')],qs[_0xc4db('0x4b')](_0x1ff510[_0xc4db('0x47')][_0xc4db('0x4b')]));_0x5d6e4a['attributes']=_0x5d6e4a['attributes'][_0xc4db('0x4c')]?_0x5d6e4a['attributes']:_0x2e95b4[_0xc4db('0x45')];if(!_0x1ff510[_0xc4db('0x47')][_0xc4db('0x4d')](_0xc4db('0x4e'))){_0x5d6e4a[_0xc4db('0x33')]=qs['limit'](_0x1ff510[_0xc4db('0x47')]['limit']);_0x5d6e4a[_0xc4db('0x35')]=qs['offset'](_0x1ff510[_0xc4db('0x47')]['offset']);}_0x5d6e4a[_0xc4db('0x4f')]=qs[_0xc4db('0x50')](_0x1ff510[_0xc4db('0x47')][_0xc4db('0x50')]);_0x5d6e4a[_0xc4db('0x51')]=qs[_0xc4db('0x49')](_[_0xc4db('0x52')](_0x1ff510[_0xc4db('0x47')],_0x2e95b4[_0xc4db('0x49')]),_0x5b31d6);if(_0x1ff510[_0xc4db('0x47')]['filter']){_0x5d6e4a[_0xc4db('0x51')]=_[_0xc4db('0x53')](_0x5d6e4a[_0xc4db('0x51')],{'$or':_[_0xc4db('0x46')](_0x5b31d6,function(_0x2592f2){if(_0x2592f2[_0xc4db('0x54')]!==_0xc4db('0x55')){var _0x31ae42={};_0x31ae42[_0x2592f2[_0xc4db('0x40')]]={'$like':'%'+_0x1ff510[_0xc4db('0x47')][_0xc4db('0x56')]+'%'};return _0x31ae42;}})});}_0x5d6e4a=_[_0xc4db('0x53')]({},_0x5d6e4a,_0x1ff510[_0xc4db('0x57')]);var _0x3b9df6={'where':_0x5d6e4a['where']};return db[_0xc4db('0x58')][_0xc4db('0x34')](_0x3b9df6)['then'](function(_0x4a921e){_0x585326[_0xc4db('0x34')]=_0x4a921e;if(_0x1ff510[_0xc4db('0x47')][_0xc4db('0x59')]){_0x5d6e4a['include']=[{'all':!![]}];}return db[_0xc4db('0x58')][_0xc4db('0x5a')](_0x5d6e4a);})[_0xc4db('0x3a')](function(_0x2ebe48){_0x585326[_0xc4db('0x5b')]=_0x2ebe48;return _0x585326;})[_0xc4db('0x3a')](respondWithFilteredResult(_0xad12eb,_0x5d6e4a))[_0xc4db('0x2d')](handleError(_0xad12eb,null));};exports['show']=function(_0x5c48f0,_0x312d82){var _0x42f149={'raw':![],'where':{'id':_0x5c48f0['params']['id']},'include':[{'model':db[_0xc4db('0x5c')],'as':_0xc4db('0x42')}]},_0x2f9bb0={};_0x2f9bb0['model']=_[_0xc4db('0x48')](db[_0xc4db('0x58')][_0xc4db('0x43')]);_0x2f9bb0['query']=_['keys'](_0x5c48f0[_0xc4db('0x47')]);_0x2f9bb0[_0xc4db('0x49')]=_[_0xc4db('0x4a')](_0x2f9bb0['model'],_0x2f9bb0[_0xc4db('0x47')]);_0x42f149[_0xc4db('0x5d')]=_[_0xc4db('0x4a')](_0x2f9bb0[_0xc4db('0x45')],qs['fields'](_0x5c48f0['query'][_0xc4db('0x4b')]));_0x42f149['attributes']=_0x42f149[_0xc4db('0x5d')][_0xc4db('0x4c')]?_0x42f149[_0xc4db('0x5d')]:_0x2f9bb0[_0xc4db('0x45')];if(_0x5c48f0[_0xc4db('0x47')][_0xc4db('0x59')]){_0x42f149[_0xc4db('0x5e')]=[{'all':!![]}];}_0x42f149=_[_0xc4db('0x53')]({},_0x42f149,_0x5c48f0['options']);return db[_0xc4db('0x58')][_0xc4db('0x5f')](_0x42f149)[_0xc4db('0x3a')](handleEntityNotFound(_0x312d82,null))['then'](respondWithResult(_0x312d82,null))['catch'](handleError(_0x312d82,null));};exports[_0xc4db('0x60')]=function(_0x4d3f27,_0x2508b8){return db['SmsAccount'][_0xc4db('0x60')](_0x4d3f27[_0xc4db('0x61')],{})[_0xc4db('0x3a')](function(_0x300ca6){var _0x2d308b=_0x4d3f27['user']['get']({'plain':!![]});if(!_0x2d308b)throw new Error(_0xc4db('0x62'));if(_0x2d308b[_0xc4db('0x63')]===_0xc4db('0x64')){var _0x56ca6b=_0x300ca6['get']({'plain':!![]});var _0x1c132b=_0xc4db('0x3d');return db['UserProfileSection']['find']({'where':{'name':_0x1c132b,'userProfileId':_0x2d308b[_0xc4db('0x65')]},'raw':!![]})[_0xc4db('0x3a')](function(_0x5d0ae0){if(_0x5d0ae0&&_0x5d0ae0[_0xc4db('0x66')]===0x0){return db[_0xc4db('0x3e')][_0xc4db('0x60')]({'name':_0x56ca6b[_0xc4db('0x40')],'resourceId':_0x56ca6b['id'],'type':_0x5d0ae0[_0xc4db('0x40')],'sectionId':_0x5d0ae0['id']},{})['then'](function(){return _0x300ca6;});}else{return _0x300ca6;}})['catch'](function(_0x5f3ea9){logger[_0xc4db('0x29')](_0xc4db('0x67'),_0x5f3ea9);throw _0x5f3ea9;});}return _0x300ca6;})['then'](respondWithResult(_0x2508b8,0xc9))[_0xc4db('0x2d')](handleError(_0x2508b8,null));};exports[_0xc4db('0x68')]=function(_0x75d5f0,_0x3bced9){if(_0x75d5f0[_0xc4db('0x61')]['id']){delete _0x75d5f0['body']['id'];}return db[_0xc4db('0x58')][_0xc4db('0x5f')]({'where':{'id':_0x75d5f0[_0xc4db('0x69')]['id']},'include':[{'model':db[_0xc4db('0x5c')],'as':_0xc4db('0x42')}]})['then'](handleEntityNotFound(_0x3bced9,null))['then'](saveUpdates(_0x75d5f0[_0xc4db('0x61')],null))[_0xc4db('0x3a')](respondWithResult(_0x3bced9,null))['catch'](handleError(_0x3bced9,null));};exports[_0xc4db('0x3b')]=function(_0x4c639d,_0x5bb965){return db[_0xc4db('0x58')][_0xc4db('0x5f')]({'where':{'id':_0x4c639d[_0xc4db('0x69')]['id']}})[_0xc4db('0x3a')](handleEntityNotFound(_0x5bb965,null))[_0xc4db('0x3a')](removeEntity(_0x5bb965,null))[_0xc4db('0x2d')](handleError(_0x5bb965,null));};exports[_0xc4db('0x6a')]=function(_0x95f683,_0x297c1d){return db[_0xc4db('0x58')][_0xc4db('0x6a')]()['then'](respondWithResult(_0x297c1d,null))[_0xc4db('0x2d')](handleError(_0x297c1d,null));};exports['addDisposition']=function(_0x173822,_0xdd3e1e,_0x162ef4){if(_0x173822[_0xc4db('0x61')]['id']){delete _0x173822['body']['id'];}return db[_0xc4db('0x58')][_0xc4db('0x5f')]({'where':{'id':_0x173822[_0xc4db('0x69')]['id']}})[_0xc4db('0x3a')](handleEntityNotFound(_0xdd3e1e,null))[_0xc4db('0x3a')](function(_0x5a6380){if(_0x5a6380){_0x173822[_0xc4db('0x61')][_0xc4db('0x6b')]=_0x5a6380['id'];return db[_0xc4db('0x6c')]['create'](_0x173822[_0xc4db('0x61')]);}})[_0xc4db('0x3a')](respondWithResult(_0xdd3e1e,null))[_0xc4db('0x2d')](handleError(_0xdd3e1e,null));};exports[_0xc4db('0x6d')]=function(_0x1636dc,_0x38e0ea,_0x43cbf9){var _0x324683={'raw':![],'where':{}};var _0x11d2f9={};var _0x42be7c={'count':0x0,'rows':[]};return db[_0xc4db('0x58')][_0xc4db('0x6e')]({'where':{'id':_0x1636dc[_0xc4db('0x69')]['id']}})[_0xc4db('0x3a')](handleEntityNotFound(_0x38e0ea,null))['then'](function(_0xa52679){if(_0xa52679){_0x11d2f9['model']=_[_0xc4db('0x48')](db['Disposition'][_0xc4db('0x43')]);_0x11d2f9['query']=_['keys'](_0x1636dc[_0xc4db('0x47')]);_0x11d2f9[_0xc4db('0x49')]=_[_0xc4db('0x4a')](_0x11d2f9['model'],_0x11d2f9['query']);_0x324683['attributes']=_[_0xc4db('0x4a')](_0x11d2f9[_0xc4db('0x45')],qs[_0xc4db('0x4b')](_0x1636dc['query'][_0xc4db('0x4b')]));_0x324683['attributes']=_0x324683[_0xc4db('0x5d')]['length']?_0x324683[_0xc4db('0x5d')]:_0x11d2f9[_0xc4db('0x45')];if(!_0x1636dc[_0xc4db('0x47')]['hasOwnProperty'](_0xc4db('0x4e'))){_0x324683['limit']=qs[_0xc4db('0x33')](_0x1636dc[_0xc4db('0x47')]['limit']);_0x324683[_0xc4db('0x35')]=qs[_0xc4db('0x35')](_0x1636dc[_0xc4db('0x47')][_0xc4db('0x35')]);}_0x324683[_0xc4db('0x4f')]=qs[_0xc4db('0x50')](_0x1636dc[_0xc4db('0x47')][_0xc4db('0x50')]);_0x324683[_0xc4db('0x51')]=qs[_0xc4db('0x49')](_['pick'](_0x1636dc[_0xc4db('0x47')],_0x11d2f9[_0xc4db('0x49')]));_0x324683[_0xc4db('0x51')]['SmsAccountId']=_0xa52679['id'];if(_0x1636dc[_0xc4db('0x47')][_0xc4db('0x56')]){_0x324683['where']=_['merge'](_0x324683['where'],{'$or':_[_0xc4db('0x46')](_0x324683['attributes'],function(_0x1710b5){var _0x5cb02a={};_0x5cb02a[_0x1710b5]={'$like':'%'+_0x1636dc[_0xc4db('0x47')]['filter']+'%'};return _0x5cb02a;})});}_0x324683=_[_0xc4db('0x53')]({},_0x324683,_0x1636dc[_0xc4db('0x57')]);return db[_0xc4db('0x6c')][_0xc4db('0x34')]({'where':_0x324683[_0xc4db('0x51')]})['then'](function(_0x273acc){_0x42be7c['count']=_0x273acc;if(_0x1636dc[_0xc4db('0x47')]['includeAll']){_0x324683['include']=[{'all':!![]}];}return db[_0xc4db('0x6c')][_0xc4db('0x5a')](_0x324683);})['then'](function(_0x43501e){_0x42be7c[_0xc4db('0x5b')]=_0x43501e;return _0x42be7c;});}})[_0xc4db('0x3a')](respondWithFilteredResult(_0x38e0ea,_0x324683))['catch'](handleError(_0x38e0ea,null));};exports[_0xc4db('0x6f')]=function(_0x1f6cb7,_0x555252,_0x367680){return db[_0xc4db('0x58')]['find']({'where':{'id':_0x1f6cb7[_0xc4db('0x69')]['id']}})[_0xc4db('0x3a')](handleEntityNotFound(_0x555252,null))[_0xc4db('0x3a')](function(_0x4f28c7){if(_0x4f28c7){return _0x4f28c7[_0xc4db('0x6f')](_0x1f6cb7[_0xc4db('0x47')][_0xc4db('0x70')]);}})['then'](respondWithStatusCode(_0x555252,null))['catch'](handleError(_0x555252,null));};exports['addAnswer']=function(_0x236a41,_0x5425ee,_0x383332){if(_0x236a41[_0xc4db('0x61')]['id']){delete _0x236a41[_0xc4db('0x61')]['id'];}return db[_0xc4db('0x58')][_0xc4db('0x5f')]({'where':{'id':_0x236a41[_0xc4db('0x69')]['id']}})[_0xc4db('0x3a')](handleEntityNotFound(_0x5425ee,null))['then'](function(_0xfb1979){if(_0xfb1979){_0x236a41[_0xc4db('0x61')][_0xc4db('0x6b')]=_0xfb1979['id'];return db[_0xc4db('0x71')]['create'](_0x236a41[_0xc4db('0x61')]);}})['then'](respondWithResult(_0x5425ee,null))[_0xc4db('0x2d')](handleError(_0x5425ee,null));};exports[_0xc4db('0x72')]=function(_0x39b0a0,_0x2380c3,_0x34ed4b){var _0x3e63c3={'raw':![],'where':{}};var _0x5335ad={};var _0x25f6fa={'count':0x0,'rows':[]};return db[_0xc4db('0x58')][_0xc4db('0x6e')]({'where':{'id':_0x39b0a0[_0xc4db('0x69')]['id']}})[_0xc4db('0x3a')](handleEntityNotFound(_0x2380c3,null))[_0xc4db('0x3a')](function(_0x5e8755){if(_0x5e8755){_0x5335ad[_0xc4db('0x45')]=_['keys'](db[_0xc4db('0x71')][_0xc4db('0x43')]);_0x5335ad[_0xc4db('0x47')]=_[_0xc4db('0x48')](_0x39b0a0[_0xc4db('0x47')]);_0x5335ad[_0xc4db('0x49')]=_[_0xc4db('0x4a')](_0x5335ad[_0xc4db('0x45')],_0x5335ad[_0xc4db('0x47')]);_0x3e63c3[_0xc4db('0x5d')]=_[_0xc4db('0x4a')](_0x5335ad[_0xc4db('0x45')],qs[_0xc4db('0x4b')](_0x39b0a0['query'][_0xc4db('0x4b')]));_0x3e63c3[_0xc4db('0x5d')]=_0x3e63c3['attributes'][_0xc4db('0x4c')]?_0x3e63c3[_0xc4db('0x5d')]:_0x5335ad['model'];if(!_0x39b0a0[_0xc4db('0x47')][_0xc4db('0x4d')](_0xc4db('0x4e'))){_0x3e63c3[_0xc4db('0x33')]=qs[_0xc4db('0x33')](_0x39b0a0[_0xc4db('0x47')][_0xc4db('0x33')]);_0x3e63c3[_0xc4db('0x35')]=qs[_0xc4db('0x35')](_0x39b0a0[_0xc4db('0x47')][_0xc4db('0x35')]);}_0x3e63c3[_0xc4db('0x4f')]=qs[_0xc4db('0x50')](_0x39b0a0[_0xc4db('0x47')][_0xc4db('0x50')]);_0x3e63c3[_0xc4db('0x51')]=qs[_0xc4db('0x49')](_['pick'](_0x39b0a0[_0xc4db('0x47')],_0x5335ad[_0xc4db('0x49')]));_0x3e63c3[_0xc4db('0x51')]['SmsAccountId']=_0x5e8755['id'];if(_0x39b0a0['query']['filter']){_0x3e63c3[_0xc4db('0x51')]=_[_0xc4db('0x53')](_0x3e63c3['where'],{'$or':_['map'](_0x3e63c3['attributes'],function(_0x4d2de1){var _0x1af530={};_0x1af530[_0x4d2de1]={'$like':'%'+_0x39b0a0[_0xc4db('0x47')][_0xc4db('0x56')]+'%'};return _0x1af530;})});}_0x3e63c3=_['merge']({},_0x3e63c3,_0x39b0a0[_0xc4db('0x57')]);return db[_0xc4db('0x71')][_0xc4db('0x34')]({'where':_0x3e63c3[_0xc4db('0x51')]})[_0xc4db('0x3a')](function(_0x3d6d8b){_0x25f6fa[_0xc4db('0x34')]=_0x3d6d8b;if(_0x39b0a0[_0xc4db('0x47')][_0xc4db('0x59')]){_0x3e63c3['include']=[{'all':!![]}];}return db[_0xc4db('0x71')]['findAll'](_0x3e63c3);})['then'](function(_0x3018f2){_0x25f6fa[_0xc4db('0x5b')]=_0x3018f2;return _0x25f6fa;});}})[_0xc4db('0x3a')](respondWithFilteredResult(_0x2380c3,_0x3e63c3))[_0xc4db('0x2d')](handleError(_0x2380c3,null));};exports[_0xc4db('0x73')]=function(_0x596cac,_0x178ec8,_0x454b14){return db['SmsAccount'][_0xc4db('0x5f')]({'where':{'id':_0x596cac['params']['id']}})[_0xc4db('0x3a')](handleEntityNotFound(_0x178ec8,null))[_0xc4db('0x3a')](function(_0x4d09e9){if(_0x4d09e9){return _0x4d09e9[_0xc4db('0x73')](_0x596cac[_0xc4db('0x47')][_0xc4db('0x70')]);}})[_0xc4db('0x3a')](respondWithStatusCode(_0x178ec8,null))['catch'](handleError(_0x178ec8,null));};exports[_0xc4db('0x74')]=function(_0x4a50e9,_0x302c20,_0x11a2c4){var _0x19fc18={'channel':_0xc4db('0x75')};var _0x8a30f2=[];var _0x322117=[];var _0x3e3fbc={};return db[_0xc4db('0x58')][_0xc4db('0x5f')]({'where':{'id':_0x4a50e9[_0xc4db('0x69')]['id']},'include':[{'model':db[_0xc4db('0x76')],'as':_0xc4db('0x77')}]})[_0xc4db('0x3a')](handleEntityNotFound(_0x302c20,null))[_0xc4db('0x3a')](function(_0x5d8095){_0x19fc18[_0xc4db('0x78')]=_0x5d8095;_0x19fc18[_0xc4db('0x79')]=_[_0xc4db('0x7a')](_0x5d8095[_0xc4db('0x77')],[_0xc4db('0x7b')],['asc']);if(_0x19fc18['account']['Applications']){delete _0x19fc18[_0xc4db('0x78')][_0xc4db('0x77')];}return db[_0xc4db('0x7c')][_0xc4db('0x6a')]();})[_0xc4db('0x3a')](function(_0x2540d0){if(!_0x2540d0){throw new db[(_0xc4db('0x7d'))]['ValidationError'](_0xc4db('0x7e'));}_0x8a30f2=_[_0xc4db('0x7f')](_['keys'](_0x2540d0),[_0xc4db('0x80'),_0xc4db('0x81')]);_0x322117=_[_0xc4db('0x7f')](_[_0xc4db('0x48')](_0x2540d0),['createdAt','updatedAt','CompanyId',_0xc4db('0x82')]);_0x19fc18[_0xc4db('0x61')]={'mapKey':'mobile'};if(_0x19fc18[_0xc4db('0x78')][_0xc4db('0x54')]){switch(_0x19fc18['account'][_0xc4db('0x54')]){case'twilio':_0x19fc18['body'][_0xc4db('0x83')]=_0x4a50e9[_0xc4db('0x61')][_0xc4db('0x84')];_0x19fc18['body'][_0xc4db('0x61')]=_0x4a50e9[_0xc4db('0x61')][_0xc4db('0x85')];_0x19fc18[_0xc4db('0x61')]['messageId']=_0x4a50e9['body'][_0xc4db('0x86')];break;case _0xc4db('0x87'):_0x19fc18[_0xc4db('0x61')][_0xc4db('0x83')]='+'+_0x4a50e9[_0xc4db('0x61')][_0xc4db('0x88')];_0x19fc18[_0xc4db('0x61')][_0xc4db('0x61')]=_0x4a50e9['body'][_0xc4db('0x89')];break;case'connectel':_0x19fc18[_0xc4db('0x61')][_0xc4db('0x83')]=_0x4a50e9[_0xc4db('0x61')][_0xc4db('0x83')];_0x19fc18['body'][_0xc4db('0x61')]=_0x4a50e9[_0xc4db('0x61')][_0xc4db('0x2b')];break;case _0xc4db('0x8a'):_0x19fc18[_0xc4db('0x61')][_0xc4db('0x83')]=_0x4a50e9['body'][_0xc4db('0x83')];_0x19fc18['body'][_0xc4db('0x61')]=_0x4a50e9[_0xc4db('0x61')][_0xc4db('0x61')];_0x19fc18[_0xc4db('0x61')]['messageId']=_0x4a50e9[_0xc4db('0x61')]['message_id'];break;case'plivo':_0x19fc18[_0xc4db('0x61')][_0xc4db('0x83')]=_0x4a50e9[_0xc4db('0x61')][_0xc4db('0x84')];_0x19fc18[_0xc4db('0x61')][_0xc4db('0x61')]=_0x4a50e9[_0xc4db('0x61')][_0xc4db('0x8b')];_0x19fc18[_0xc4db('0x61')][_0xc4db('0x8c')]=_0x4a50e9['body'][_0xc4db('0x8d')];break;case _0xc4db('0x8e'):_0x19fc18[_0xc4db('0x61')][_0xc4db('0x83')]='+'+_0x4a50e9['body'][_0xc4db('0x8f')][0x0][_0xc4db('0x83')];_0x19fc18[_0xc4db('0x61')][_0xc4db('0x61')]=_0x4a50e9[_0xc4db('0x61')][_0xc4db('0x8f')][0x0][_0xc4db('0x89')];_0x19fc18[_0xc4db('0x61')]['messageId']=_0x4a50e9['body']['results'][0x0]['messageId'];break;case _0xc4db('0x90'):_0x19fc18[_0xc4db('0x61')][_0xc4db('0x83')]=_0x4a50e9[_0xc4db('0x61')][_0xc4db('0x91')];_0x19fc18[_0xc4db('0x61')][_0xc4db('0x61')]=_0x4a50e9[_0xc4db('0x61')][_0xc4db('0x92')][_0xc4db('0x2b')];break;case _0xc4db('0x93'):_0x19fc18[_0xc4db('0x61')][_0xc4db('0x83')]=_0x4a50e9[_0xc4db('0x61')]['fromNumber'];_0x19fc18['body']['body']=_0x4a50e9['body'][_0xc4db('0x89')];_0x19fc18[_0xc4db('0x61')][_0xc4db('0x8c')]=_0x4a50e9[_0xc4db('0x61')][_0xc4db('0x94')];break;case'bandwidth':_0x19fc18[_0xc4db('0x61')][_0xc4db('0x8c')]=_0x4a50e9[_0xc4db('0x61')][0x0][_0xc4db('0x2b')]['id'];_0x19fc18[_0xc4db('0x61')][_0xc4db('0x83')]=_0x4a50e9[_0xc4db('0x61')][0x0][_0xc4db('0x2b')][_0xc4db('0x83')];_0x19fc18[_0xc4db('0x61')][_0xc4db('0x61')]=_0x4a50e9['body'][0x0][_0xc4db('0x2b')][_0xc4db('0x89')];break;case _0xc4db('0x95'):_0x19fc18[_0xc4db('0x61')]['from']=_0x4a50e9[_0xc4db('0x61')][_0xc4db('0x83')];_0x19fc18[_0xc4db('0x61')][_0xc4db('0x61')]=_0x4a50e9['body'][_0xc4db('0x2b')];_0x19fc18[_0xc4db('0x61')][_0xc4db('0x8c')]=_0x4a50e9[_0xc4db('0x61')][_0xc4db('0x96')];break;}}if(_0x19fc18['body']['id']){delete _0x19fc18[_0xc4db('0x61')]['id'];}if(_[_0xc4db('0x97')](_0x19fc18[_0xc4db('0x61')][_0xc4db('0x83')])){throw new db[(_0xc4db('0x7d'))][(_0xc4db('0x98'))](_0xc4db('0x99'));}if(_[_0xc4db('0x97')](_0x19fc18['body'][_0xc4db('0x61')])||_0x19fc18['body'][_0xc4db('0x61')]===''){throw new db[(_0xc4db('0x7d'))][(_0xc4db('0x98'))](_0xc4db('0x9a'));}if(_[_0xc4db('0x97')](_0x19fc18[_0xc4db('0x61')][_0xc4db('0x9b')])){throw new db[(_0xc4db('0x7d'))][(_0xc4db('0x98'))](_0xc4db('0x9c')+_0x322117);}if(!_[_0xc4db('0x9d')](_0x322117,_0x19fc18[_0xc4db('0x61')][_0xc4db('0x9b')])){throw new db[(_0xc4db('0x7d'))][(_0xc4db('0x98'))](_0xc4db('0x9e')+_0x322117);}_0x3e3fbc[_0x19fc18[_0xc4db('0x61')][_0xc4db('0x9b')]]=_0x19fc18['body'][_0xc4db('0x83')];return db[_0xc4db('0x9f')][_0xc4db('0x5f')]({'where':{'id':_0x19fc18[_0xc4db('0x78')][_0xc4db('0x82')]},'include':[{'model':db[_0xc4db('0x7c')],'as':_0xc4db('0xa0'),'where':_0x3e3fbc,'limit':0x1,'order':[[_0xc4db('0x81'),_0xc4db('0xa1')]]}]});})['then'](handleEntityNotFound(_0x302c20,null))['then'](function(_0x1cc8d7){if(_0x1cc8d7){_0x19fc18[_0xc4db('0xa2')]=_['omit'](_0x1cc8d7,[_0xc4db('0xa0')]);if(_0x1cc8d7[_0xc4db('0xa0')][_0xc4db('0x4c')]){return _0x1cc8d7['Contacts'][0x0];}var _0x25ed37=_['defaults'](_0x19fc18['body'],{'firstName':_0x19fc18['body'][_0xc4db('0x83')],'ListId':_0x1cc8d7['id']});_0x25ed37[_0x19fc18[_0xc4db('0x61')][_0xc4db('0x9b')]]=_0x19fc18[_0xc4db('0x61')][_0xc4db('0x83')];return db['CmContact'][_0xc4db('0x60')](_0x25ed37,{'fields':_0x8a30f2,'raw':!![]});}})[_0xc4db('0x3a')](handleEntityNotFound(_0x302c20,null))['then'](function(_0x4f0219){if(_0x4f0219){_0x19fc18['contact']=_0x4f0219;var _0x4cf1d0={'ContactId':_0x4f0219['id'],'phone':_0x19fc18[_0xc4db('0x61')]['from'],'SmsAccountId':_0x4a50e9[_0xc4db('0x69')]['id']};var _0x4bcdac={'ContactId':_0x4f0219['id'],'SmsAccountId':_0x4a50e9[_0xc4db('0x69')]['id'],'closed':![]};return db[_0xc4db('0xa3')]['find']({'where':_0x4bcdac})[_0xc4db('0x3a')](function(_0x551993){if(_0x551993){return[_0x551993,![]];}return db[_0xc4db('0xa3')][_0xc4db('0x60')](_0x4cf1d0)['then'](function(_0x55db35){return[_0x55db35,!![]];});});}})[_0xc4db('0xa4')](function(_0x382894,_0x1c9369){_0x19fc18[_0xc4db('0xa5')]=_0x382894[_0xc4db('0x3c')]({'plain':!![]});_0x19fc18[_0xc4db('0xa5')]['created']=![];if(_0x1c9369){if(_0x19fc18[_0xc4db('0x78')][_0xc4db('0xa6')]){_0x19fc18[_0xc4db('0x79')][_0xc4db('0xa7')]({'id':0x0,'priority':_0x19fc18[_0xc4db('0x79')][_0xc4db('0x4c')]+0x1,'app':_0xc4db('0xa8'),'appdata':_0xc4db('0xa9'),'interval':_0xc4db('0xaa')});}_0x19fc18[_0xc4db('0xa5')][_0xc4db('0xab')]=!![];}return db['SmsMessage']['create']({'phone':_0x19fc18[_0xc4db('0x61')][_0xc4db('0x83')],'messageId':_0x19fc18[_0xc4db('0x61')][_0xc4db('0x8c')],'body':_0x19fc18['body'][_0xc4db('0x61')],'SmsAccountId':_0x4a50e9[_0xc4db('0x69')]['id'],'SmsInteractionId':_0x382894['id'],'direction':'in','ContactId':_0x382894[_0xc4db('0xac')],'AttachmentId':_0x19fc18['body'][_0xc4db('0xad')]});})['then'](function(_0x2bbc85){_0x19fc18['message']=_0x2bbc85;if(_0x19fc18[_0xc4db('0xa5')][_0xc4db('0xae')]){return db[_0xc4db('0xaf')][_0xc4db('0x5f')]({'attributes':['id',_0xc4db('0x40')],'where':{'id':_0x19fc18[_0xc4db('0xa5')][_0xc4db('0xae')]}})[_0xc4db('0x3a')](function(_0x45f560){if(_0x45f560){_0x19fc18[_0xc4db('0x79')][_0xc4db('0xb0')]({'id':0x0,'priority':0x0,'app':_0xc4db('0xb1'),'appdata':_0x45f560[_0xc4db('0x40')]+','+(_0x19fc18[_0xc4db('0x78')]['waitForTheAssignedAgent']||0xa),'interval':_0xc4db('0xaa')});}return respondWithRpcPromise(_0xc4db('0xb2'),_0xc4db('0xb3'),_0x19fc18);});}return respondWithRpcPromise(_0xc4db('0xb2'),_0xc4db('0xb3'),_0x19fc18);})[_0xc4db('0x3a')](function(_0x5b13ec){if(_0x5b13ec){var _0xfd1f7=0xc8;var _0x1be09c=_0xc4db('0xb4');logger[_0xc4db('0x24')](_0xc4db('0x26'),_0x1be09c,_0xfd1f7,_0xc4db('0xb5'));logger[_0xc4db('0xb6')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x1be09c,_0xfd1f7,_0xc4db('0xb5'),JSON[_0xc4db('0x28')](_0x5b13ec));if(_0x19fc18['account'][_0xc4db('0x54')]==='twilio'){return _0x302c20[_0xc4db('0x2f')](_0xfd1f7)['set']('Content-Type',_0xc4db('0xb7'))[_0xc4db('0x41')](_0xc4db('0xb8'));}else{return _0x302c20[_0xc4db('0x2f')](_0xfd1f7)[_0xc4db('0x31')](_0x5b13ec);}}})['catch'](handleError(_0x302c20,null));};exports[_0xc4db('0xb9')]=function(_0x142786,_0x513e95){var _0x3ac07b=_0x142786[_0xc4db('0x69')]['id'];var _0x2331c4=_0x142786['body'];var _0x26eaeb=0xc8;var _0x321334=null;return db[_0xc4db('0xba')][_0xc4db('0xbb')]({'isolationLevel':db[_0xc4db('0xba')][_0xc4db('0xbc')][_0xc4db('0xbd')][_0xc4db('0xbe')]},function(_0x472288){return db[_0xc4db('0x58')][_0xc4db('0x6e')]({'where':{'id':_0x3ac07b},'transaction':_0x472288})['then'](function(_0x48710c){if(_0x48710c){return db[_0xc4db('0x76')][_0xc4db('0x3b')]({'where':{'SmsAccountId':_0x3ac07b},'transaction':_0x472288})['then'](function(){var _0x394a05=_[_0xc4db('0x46')](_0x2331c4,function(_0x36759f){_0x36759f[_0xc4db('0x6b')]=_0x3ac07b;return _0x36759f;});return db[_0xc4db('0x76')][_0xc4db('0xbf')](_0x394a05,{'transaction':_0x472288});});}else{_0x26eaeb=0x194;_0x321334=[];}});})[_0xc4db('0x3a')](function(){if(_0x26eaeb!==0x194){return db[_0xc4db('0x76')][_0xc4db('0xc0')]({'where':{'SmsAccountId':_0x3ac07b},'order':_0xc4db('0x7b')})[_0xc4db('0x3a')](function(_0x77216b){_0x321334=_0x77216b;});}})[_0xc4db('0x2d')](function(_0x507e57){_0x26eaeb=0x1f4;logger[_0xc4db('0x29')](_0x507e57[_0xc4db('0x3f')]);if(_0x507e57[_0xc4db('0x40')]){delete _0x507e57[_0xc4db('0x40')];}_0x321334=_0x507e57;})['finally'](function(){if(_0x321334===null){_0x513e95[_0xc4db('0x2e')](_0x26eaeb);}else{if(_0x26eaeb===0x1f4){_0x513e95[_0xc4db('0x2f')](_0x26eaeb)[_0xc4db('0x41')](_0x321334);}else{_0x513e95[_0xc4db('0x2f')](_0x26eaeb)[_0xc4db('0x31')](_0x321334);}}});};exports[_0xc4db('0xc1')]=function(_0x11b993,_0x1b0774,_0x54f5d5){var _0x27a382={};var _0x1532a5={};var _0x5eb999;var _0x291ecc;return db['SmsAccount'][_0xc4db('0x6e')]({'where':{'id':_0x11b993[_0xc4db('0x69')]['id']}})['then'](handleEntityNotFound(_0x1b0774,null))['then'](function(_0x472557){if(_0x472557){_0x5eb999=_0x472557;_0x1532a5[_0xc4db('0x45')]=_[_0xc4db('0x48')](db[_0xc4db('0x76')][_0xc4db('0x43')]);_0x1532a5[_0xc4db('0x47')]=_['keys'](_0x11b993[_0xc4db('0x47')]);_0x1532a5[_0xc4db('0x49')]=_[_0xc4db('0x4a')](_0x1532a5[_0xc4db('0x45')],_0x1532a5[_0xc4db('0x47')]);_0x27a382['attributes']=_[_0xc4db('0x4a')](_0x1532a5[_0xc4db('0x45')],qs['fields'](_0x11b993[_0xc4db('0x47')][_0xc4db('0x4b')]));_0x27a382[_0xc4db('0x5d')]=_0x27a382[_0xc4db('0x5d')][_0xc4db('0x4c')]?_0x27a382[_0xc4db('0x5d')]:_0x1532a5['model'];_0x27a382[_0xc4db('0x4f')]=qs[_0xc4db('0x50')](_0x11b993['query'][_0xc4db('0x50')]);_0x27a382['where']=qs['filters'](_[_0xc4db('0x52')](_0x11b993[_0xc4db('0x47')],_0x1532a5[_0xc4db('0x49')]));if(_0x11b993[_0xc4db('0x47')][_0xc4db('0x56')]){_0x27a382[_0xc4db('0x51')]=_[_0xc4db('0x53')](_0x27a382[_0xc4db('0x51')],{'$or':_[_0xc4db('0x46')](_0x27a382[_0xc4db('0x5d')],function(_0x3bf772){var _0x2e24ed={};_0x2e24ed[_0x3bf772]={'$like':'%'+_0x11b993['query'][_0xc4db('0x56')]+'%'};return _0x2e24ed;})});}_0x27a382=_[_0xc4db('0x53')]({},_0x27a382,_0x11b993[_0xc4db('0x57')]);return _0x5eb999[_0xc4db('0xc1')](_0x27a382);}})['then'](function(_0x3a3643){if(_0x3a3643){_0x291ecc=_0x3a3643['length'];if(!_0x11b993[_0xc4db('0x47')][_0xc4db('0x4d')](_0xc4db('0x4e'))){_0x27a382[_0xc4db('0x33')]=qs[_0xc4db('0x33')](_0x11b993[_0xc4db('0x47')][_0xc4db('0x33')]);_0x27a382[_0xc4db('0x35')]=qs['offset'](_0x11b993[_0xc4db('0x47')][_0xc4db('0x35')]);}return _0x5eb999['getApplications'](_0x27a382);}})[_0xc4db('0x3a')](function(_0x3e9d55){if(_0x3e9d55){return _0x3e9d55?{'count':_0x291ecc,'rows':_0x3e9d55}:null;}})[_0xc4db('0x3a')](respondWithResult(_0x1b0774,null))['catch'](handleError(_0x1b0774,null));};exports[_0xc4db('0xc2')]=function(_0x500e5d,_0x333049,_0x3258f1){var _0x4ad966={'raw':![],'where':{}};var _0x395d92={};var _0x16c2fd={'count':0x0,'rows':[]};return db[_0xc4db('0x58')][_0xc4db('0x6e')]({'where':{'id':_0x500e5d[_0xc4db('0x69')]['id']}})[_0xc4db('0x3a')](handleEntityNotFound(_0x333049,null))[_0xc4db('0x3a')](function(_0x267e4c){if(_0x267e4c){_0x395d92['model']=_[_0xc4db('0x48')](db[_0xc4db('0xa3')][_0xc4db('0x43')]);_0x395d92['query']=_[_0xc4db('0x48')](_0x500e5d[_0xc4db('0x47')]);_0x395d92['filters']=_[_0xc4db('0x4a')](_0x395d92['model'],_0x395d92[_0xc4db('0x47')]);_0x4ad966[_0xc4db('0x5d')]=_[_0xc4db('0x4a')](_0x395d92['model'],qs[_0xc4db('0x4b')](_0x500e5d[_0xc4db('0x47')]['fields']));_0x4ad966[_0xc4db('0x5d')]=_0x4ad966['attributes']['length']?_0x4ad966[_0xc4db('0x5d')]:_0x395d92[_0xc4db('0x45')];if(!_0x500e5d[_0xc4db('0x47')][_0xc4db('0x4d')](_0xc4db('0x4e'))){_0x4ad966[_0xc4db('0x33')]=qs['limit'](_0x500e5d['query'][_0xc4db('0x33')]);_0x4ad966[_0xc4db('0x35')]=qs['offset'](_0x500e5d[_0xc4db('0x47')][_0xc4db('0x35')]);}_0x4ad966[_0xc4db('0x4f')]=qs['sort'](_0x500e5d['query'][_0xc4db('0x50')]);_0x4ad966[_0xc4db('0x51')]=qs[_0xc4db('0x49')](_[_0xc4db('0x52')](_0x500e5d['query'],_0x395d92['filters']));_0x4ad966[_0xc4db('0x51')][_0xc4db('0x6b')]=_0x267e4c['id'];if(_0x500e5d['query'][_0xc4db('0x56')]){_0x4ad966[_0xc4db('0x51')]=_['merge'](_0x4ad966[_0xc4db('0x51')],{'$or':_[_0xc4db('0x46')](_0x4ad966['attributes'],function(_0xa05ca7){var _0x4105e6={};_0x4105e6[_0xa05ca7]={'$like':'%'+_0x500e5d[_0xc4db('0x47')][_0xc4db('0x56')]+'%'};return _0x4105e6;})});}_0x4ad966=_['merge']({},_0x4ad966,_0x500e5d['options']);return db[_0xc4db('0xa3')][_0xc4db('0x34')]({'where':_0x4ad966[_0xc4db('0x51')]})[_0xc4db('0x3a')](function(_0x119144){_0x16c2fd[_0xc4db('0x34')]=_0x119144;if(_0x500e5d[_0xc4db('0x47')][_0xc4db('0x59')]){_0x4ad966[_0xc4db('0x5e')]=[{'model':db[_0xc4db('0x7c')],'as':_0xc4db('0xc3'),'required':![]},{'model':db[_0xc4db('0xaf')],'as':_0xc4db('0xc4'),'attributes':[_0xc4db('0x40'),_0xc4db('0xc5'),_0xc4db('0xc6')],'required':![]},{'model':db[_0xc4db('0xc7')],'as':_0xc4db('0xc8'),'attributes':['id',_0xc4db('0x40'),_0xc4db('0xc9')],'where':_0x500e5d['query'][_0xc4db('0xca')]?{'id':_0x500e5d[_0xc4db('0x47')][_0xc4db('0xca')]}:undefined,'required':_0x500e5d['query'][_0xc4db('0xca')]?!![]:![]}];}return db[_0xc4db('0xa3')][_0xc4db('0x5a')](_0x4ad966);})['then'](function(_0x59b6a4){_0x16c2fd[_0xc4db('0x5b')]=_0x59b6a4;return _0x16c2fd;});}})['then'](respondWithFilteredResult(_0x333049,_0x4ad966))[_0xc4db('0x2d')](handleError(_0x333049,null));};exports[_0xc4db('0x41')]=function(_0x337b34,_0x2763ef,_0x564583){var _0x3f0757,_0x55363b,_0x1b2644;if(_['isNil'](_0x337b34[_0xc4db('0x61')][_0xc4db('0x61')])||_0x337b34['body'][_0xc4db('0x61')]===''){throw new db['Sequelize'][(_0xc4db('0x98'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xc4db('0x97')](_0x337b34['body']['to'])){throw new db[(_0xc4db('0x7d'))][(_0xc4db('0x98'))](_0xc4db('0xcb'));}_0x3f0757=_0x337b34['body']['to'];return db['SmsAccount'][_0xc4db('0x5f')]({'where':{'id':_0x337b34[_0xc4db('0x69')]['id']},'include':[{'model':db[_0xc4db('0x9f')],'as':_0xc4db('0xcc'),'include':[{'model':db[_0xc4db('0x7c')],'as':'Contacts','where':{'mobile':_0x3f0757},'limit':0x1,'order':[[_0xc4db('0x81'),'DESC']]}]}]})[_0xc4db('0x3a')](handleEntityNotFound(_0x2763ef,null))[_0xc4db('0x3a')](function(_0x1cb70f){if(_0x1cb70f&&_0x1cb70f['List']){_0x55363b=_0x1cb70f[_0xc4db('0x3c')]({'plain':!![]});if(_0x55363b['List']&&_0x55363b[_0xc4db('0xcc')][_0xc4db('0xa0')][_0xc4db('0x4c')]){return _0x55363b['List'][_0xc4db('0xa0')][0x0];}return db[_0xc4db('0x7c')][_0xc4db('0x60')](_[_0xc4db('0x1a')](_0x337b34[_0xc4db('0x61')],{'firstName':_0x3f0757,'mobile':_0x3f0757,'phone':_0x3f0757,'ListId':_0x55363b['ListId']}));}})[_0xc4db('0x3a')](handleEntityNotFound(_0x2763ef,null))['then'](function(_0x3ce1e8){if(_0x3ce1e8){_0x1b2644=_0x3ce1e8;return db[_0xc4db('0xa3')][_0xc4db('0x5f')]({'where':{'ContactId':_0x1b2644['id'],'closed':![],'SmsAccountId':_0x55363b['id']}})[_0xc4db('0x3a')](function(_0x4e52c3){if(_0x4e52c3){return[_0x4e52c3,![]];}return db[_0xc4db('0xa3')][_0xc4db('0x60')]({'UserId':_0x337b34[_0xc4db('0x64')]['id'],'ContactId':_0x1b2644['id'],'SmsAccountId':_0x55363b['id'],'phone':_0x3f0757,'firstMsgDirection':_0xc4db('0xcd'),'Messages':[_[_0xc4db('0x53')](_0x337b34[_0xc4db('0x61')],{'read':![],'body':_0x337b34[_0xc4db('0x61')]['body'],'phone':_0x3f0757,'SmsAccountId':_0x55363b['id'],'UserId':_0x337b34[_0xc4db('0x64')]['id'],'ContactId':_0x1b2644['id']})]},{'include':[{'model':db['SmsMessage'],'as':_0xc4db('0xce')}]})[_0xc4db('0x3a')](function(_0x29a0b7){return[_0x29a0b7,!![]];});});}})[_0xc4db('0xa4')](function(_0x559be6,_0x46e188){if(_0x46e188){return _0x559be6;}return db[_0xc4db('0xcf')][_0xc4db('0x60')](_[_0xc4db('0x53')](_0x337b34[_0xc4db('0x61')],{'read':![],'body':_0x337b34[_0xc4db('0x61')][_0xc4db('0x61')],'phone':_0x3f0757,'SmsAccountId':_0x55363b['id'],'SmsInteractionId':_0x559be6['id'],'UserId':_0x337b34[_0xc4db('0x64')]['id'],'ContactId':_0x1b2644['id']}))[_0xc4db('0x3a')](function(_0x397dc2){_0x559be6['dataValues']['Messages']=[];_0x559be6['dataValues']['Messages']['push'](_0x397dc2['dataValues']);return _0x559be6;});})[_0xc4db('0x3a')](respondWithResult(_0x2763ef,null))['catch'](handleError(_0x2763ef,null));};exports[_0xc4db('0x2f')]=function(_0x39c827,_0x2449fe,_0x15203c){if(_0x39c827['body']['id']){delete _0x39c827['body']['id'];}var _0x7f33b,_0x43cae6,_0x51f51a;return db[_0xc4db('0x58')]['find']({'where':{'id':_0x39c827[_0xc4db('0x69')]['id']}})[_0xc4db('0x3a')](handleEntityNotFound(_0x2449fe,null))[_0xc4db('0x3a')](function(_0x518ee0){if(_0x518ee0){_0x51f51a=_0x518ee0;logger[_0xc4db('0xb6')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0xc4db('0xd0'),_0x518ee0[_0xc4db('0x54')],util['inspect'](_0x39c827[_0xc4db('0x61')],{'showHidden':![],'depth':null}));switch(_0x518ee0[_0xc4db('0x54')]){case'skebby':if(_0x39c827['body'][_0xc4db('0xd1')]&&_0x39c827[_0xc4db('0x61')][_0xc4db('0x2f')]){_0x43cae6=_0x39c827[_0xc4db('0x61')][_0xc4db('0x2f')];return db[_0xc4db('0xcf')]['find']({'where':{'messageId':_0x39c827[_0xc4db('0x61')][_0xc4db('0xd1')]}});}break;case _0xc4db('0xd2'):if(_0x39c827[_0xc4db('0x61')][_0xc4db('0xd3')]&&_0x39c827[_0xc4db('0x61')]['statusInt']){_0x43cae6=_0x39c827['body'][_0xc4db('0xd4')];return db[_0xc4db('0xcf')]['find']({'where':{'messageId':_0x39c827[_0xc4db('0x61')][_0xc4db('0xd3')]}});}break;case _0xc4db('0x8a'):if(_0x39c827[_0xc4db('0x61')][_0xc4db('0xd5')]&&_0x39c827['body'][_0xc4db('0xd6')]){_0x43cae6=_0x39c827[_0xc4db('0x61')][_0xc4db('0xd6')];return db[_0xc4db('0xcf')]['find']({'where':{'messageId':_0x39c827[_0xc4db('0x61')][_0xc4db('0xd5')]}});}break;case _0xc4db('0x8e'):var _0x57d45f=_0x39c827['body']['results'][0x0];if(_0x57d45f['messageId']&&_0x57d45f[_0xc4db('0x2f')]['groupName']==='DELIVERED'){_0x43cae6=_0x57d45f[_0xc4db('0x2f')][_0xc4db('0xd7')];return db[_0xc4db('0xcf')][_0xc4db('0x5f')]({'where':{'messageId':_0x57d45f[_0xc4db('0x8c')]}});}break;case _0xc4db('0x93'):if(_0x39c827[_0xc4db('0x61')][_0xc4db('0x8c')]&&_0x39c827[_0xc4db('0x61')][_0xc4db('0x2f')]){_0x43cae6=_0x39c827[_0xc4db('0x61')][_0xc4db('0x2f')];return db[_0xc4db('0xcf')][_0xc4db('0x5f')]({'where':{'messageId':_0x39c827[_0xc4db('0x61')][_0xc4db('0x8c')]}});}break;case _0xc4db('0xd8'):if(_0x39c827[_0xc4db('0x61')][0x0][_0xc4db('0x2b')]['id']){_0x43cae6=_0x39c827[_0xc4db('0x61')][0x0][_0xc4db('0x54')];return db[_0xc4db('0xcf')][_0xc4db('0x5f')]({'where':{'messageId':_0x39c827['body'][0x0][_0xc4db('0x2b')]['id']}});}break;case _0xc4db('0x95'):if(_0x39c827[_0xc4db('0x61')][_0xc4db('0xd9')]&&_0x39c827['body'][_0xc4db('0x2f')]){_0x43cae6=_0x39c827[_0xc4db('0x61')]['status'];return db['SmsMessage'][_0xc4db('0x5f')]({'where':{'messageId':_0x39c827[_0xc4db('0x61')][_0xc4db('0xd9')]}});}break;}}})['then'](handleEntityNotFound(_0x2449fe,null))[_0xc4db('0x3a')](function(_0x33ae8c){if(_0x33ae8c){_0x7f33b=_0x33ae8c;switch(_0x51f51a[_0xc4db('0x54')]){case _0xc4db('0x87'):if(_0x43cae6===_0xc4db('0xda')){return _0x7f33b['update']({'read':!![]});}else{logger['error'](_0xc4db('0x26'),_0xc4db('0x2f'),_0xc4db('0x87'),util['inspect'](_0x39c827[_0xc4db('0x61')],{'showHidden':![],'depth':null}));}break;case _0xc4db('0xd2'):if(_0x43cae6==='1'){return _0x7f33b[_0xc4db('0x68')]({'read':!![]});}else{logger[_0xc4db('0x29')](_0xc4db('0x26'),_0xc4db('0x2f'),_0xc4db('0x87'),util[_0xc4db('0xdb')](_0x39c827[_0xc4db('0x61')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x39c827['body'][_0xc4db('0xdc')]&&_0x43cae6>=0xc8&&_0x43cae6<=0xce){return _0x7f33b[_0xc4db('0x68')]({'read':!![]});}else{logger[_0xc4db('0x29')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xc4db('0x2f'),_0xc4db('0x8a'),util[_0xc4db('0xdb')](_0x39c827[_0xc4db('0x61')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x12703c=_0x39c827[_0xc4db('0x61')][_0xc4db('0x8f')][0x0];if(_0x12703c[_0xc4db('0x2f')][_0xc4db('0xd7')]===_0xc4db('0xda')){return _0x7f33b['update']({'read':!![]});}else{logger[_0xc4db('0x29')](_0xc4db('0x26'),_0xc4db('0x2f'),_0xc4db('0x8e'),util[_0xc4db('0xdb')](_0x39c827[_0xc4db('0x61')],{'showHidden':![],'depth':null}));}break;case _0xc4db('0x93'):if(_0x43cae6==_0xc4db('0xdd')||_0x43cae6==_0xc4db('0xde')){return _0x7f33b[_0xc4db('0x68')]({'read':!![]});}else{logger['error'](_0xc4db('0x26'),_0xc4db('0x2f'),_0xc4db('0x93'),util[_0xc4db('0xdb')](_0x39c827[_0xc4db('0x61')],{'showHidden':![],'depth':null}));}break;case _0xc4db('0xd8'):if(_0x43cae6==_0xc4db('0xdf')){return _0x7f33b['update']({'read':!![]});}else{logger[_0xc4db('0x29')](_0xc4db('0x26'),_0xc4db('0x2f'),_0xc4db('0xd8'),util['inspect'](_0x39c827['body'],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x43cae6==='DELIVRD'||_0x43cae6===_0xc4db('0xe0')){return _0x7f33b[_0xc4db('0x68')]({'read':!![]});}else{logger[_0xc4db('0x29')](_0xc4db('0x26'),_0xc4db('0x2f'),'intelepeer',util[_0xc4db('0xdb')](_0x39c827[_0xc4db('0x61')],{'showHidden':![],'depth':null}));}break;}return _0x7f33b;}})[_0xc4db('0x3a')](respondWithResult(_0x2449fe,null))['catch'](handleError(_0x2449fe,null));};exports['statusGet']=function(_0x5ca659,_0x374621,_0x923c15){var _0x34d37f,_0xa24cc5,_0x1af88d;return db[_0xc4db('0x58')][_0xc4db('0x5f')]({'where':{'id':_0x5ca659[_0xc4db('0x69')]['id']}})['then'](handleEntityNotFound(_0x374621,null))[_0xc4db('0x3a')](function(_0x1eb84e){if(_0x1eb84e){_0x1af88d=_0x1eb84e;logger['debug'](_0xc4db('0x26'),'status',_0xc4db('0xd0'),_0x1eb84e[_0xc4db('0x54')],util['inspect'](_0x5ca659[_0xc4db('0x47')],{'showHidden':![],'depth':null}));switch(_0x1eb84e[_0xc4db('0x54')]){case _0xc4db('0x90'):if(_0x5ca659[_0xc4db('0x47')][_0xc4db('0xe1')]&&_0x5ca659[_0xc4db('0x47')][_0xc4db('0xe2')]){_0xa24cc5=_0x5ca659[_0xc4db('0x47')][_0xc4db('0xe2')];return db['SmsMessage'][_0xc4db('0x5f')]({'where':{'messageId':_0x5ca659[_0xc4db('0x47')][_0xc4db('0xe1')]}});}break;}}})['then'](handleEntityNotFound(_0x374621,null))['then'](function(_0xc1bc67){if(_0xc1bc67){_0x34d37f=_0xc1bc67;switch(_0x1af88d[_0xc4db('0x54')]){case _0xc4db('0x90'):if(_0xa24cc5==='2'||_0xa24cc5==='6'){return _0x34d37f[_0xc4db('0x68')]({'read':!![]});}else{logger[_0xc4db('0x29')](_0xc4db('0x26'),'status','csc',util[_0xc4db('0xdb')](_0x5ca659[_0xc4db('0x47')],{'showHidden':![],'depth':null}));};break;}return _0x34d37f;}})['then'](respondWithResult(_0x374621,null))[_0xc4db('0x2d')](handleError(_0x374621,null));};exports[_0xc4db('0xe3')]=function(_0x1bc124,_0x469b21,_0x5368d9){return db[_0xc4db('0x58')][_0xc4db('0x5f')]({'where':{'id':_0x1bc124[_0xc4db('0x69')]['id']}})[_0xc4db('0x3a')](handleEntityNotFound(_0x469b21,null))[_0xc4db('0x3a')](function(_0x213892){if(_0x213892){return _0x213892[_0xc4db('0xe3')](_0x1bc124[_0xc4db('0x61')][_0xc4db('0x70')],_[_0xc4db('0xe4')](_0x1bc124[_0xc4db('0x61')],[_0xc4db('0x70'),'id'])||{})[_0xc4db('0xa4')](function(_0x1f6269){for(var _0x17ba39=0x0;_0x17ba39<_0x1bc124[_0xc4db('0x61')][_0xc4db('0x70')]['length'];_0x17ba39+=0x1){socket[_0xc4db('0xe5')](_0xc4db('0xe6'),{'UserId':Number(_0x1bc124[_0xc4db('0x61')]['ids'][_0x17ba39]),'SmsAccountId':Number(_0x1bc124[_0xc4db('0x69')]['id'])});}return _0x1f6269;});}})[_0xc4db('0x3a')](respondWithResult(_0x469b21,null))[_0xc4db('0x2d')](handleError(_0x469b21,null));};exports[_0xc4db('0xe7')]=function(_0x37aa06,_0x368d6a,_0x8a72d8){return db[_0xc4db('0x58')][_0xc4db('0x5f')]({'where':{'id':_0x37aa06['params']['id']}})['then'](handleEntityNotFound(_0x368d6a,null))['then'](function(_0x44846a){if(_0x44846a){return _0x44846a[_0xc4db('0xe7')](_0x37aa06[_0xc4db('0x47')]['ids'])[_0xc4db('0x3a')](function(){if(_['isArray'](_0x37aa06[_0xc4db('0x47')]['ids'])){for(var _0x2eb3f8=0x0;_0x2eb3f8<_0x37aa06[_0xc4db('0x47')][_0xc4db('0x70')][_0xc4db('0x4c')];_0x2eb3f8+=0x1){socket[_0xc4db('0xe5')]('userSmsAccount:remove',{'UserId':Number(_0x37aa06['query'][_0xc4db('0x70')][_0x2eb3f8]),'SmsAccountId':Number(_0x37aa06[_0xc4db('0x69')]['id'])});}}else{socket[_0xc4db('0xe5')](_0xc4db('0xe8'),{'UserId':Number(_0x37aa06[_0xc4db('0x47')][_0xc4db('0x70')]),'SmsAccountId':Number(_0x37aa06[_0xc4db('0x69')]['id'])});}});}})[_0xc4db('0x3a')](respondWithStatusCode(_0x368d6a,null))['catch'](handleError(_0x368d6a,null));};exports[_0xc4db('0xe9')]=function(_0x37f6a6,_0x53758d,_0x2d7f4c){var _0x9399c9={};var _0x155944={};var _0x55b31a;var _0x49537a;return db[_0xc4db('0x58')][_0xc4db('0x6e')]({'where':{'id':_0x37f6a6[_0xc4db('0x69')]['id']}})['then'](handleEntityNotFound(_0x53758d,null))['then'](function(_0x10d95d){if(_0x10d95d){_0x55b31a=_0x10d95d;_0x155944[_0xc4db('0x45')]=_[_0xc4db('0x48')](db[_0xc4db('0xaf')][_0xc4db('0x43')]);_0x155944[_0xc4db('0x47')]=_[_0xc4db('0x48')](_0x37f6a6[_0xc4db('0x47')]);_0x155944[_0xc4db('0x49')]=_[_0xc4db('0x4a')](_0x155944['model'],_0x155944[_0xc4db('0x47')]);_0x9399c9[_0xc4db('0x5d')]=_['intersection'](_0x155944[_0xc4db('0x45')],qs[_0xc4db('0x4b')](_0x37f6a6[_0xc4db('0x47')][_0xc4db('0x4b')]));_0x9399c9['attributes']=_0x9399c9[_0xc4db('0x5d')][_0xc4db('0x4c')]?_0x9399c9[_0xc4db('0x5d')]:_0x155944['model'];_0x9399c9[_0xc4db('0x4f')]=qs[_0xc4db('0x50')](_0x37f6a6['query'][_0xc4db('0x50')]);_0x9399c9['where']=qs[_0xc4db('0x49')](_[_0xc4db('0x52')](_0x37f6a6['query'],_0x155944[_0xc4db('0x49')]));if(_0x37f6a6['query']['filter']){_0x9399c9['where']=_[_0xc4db('0x53')](_0x9399c9[_0xc4db('0x51')],{'$or':_[_0xc4db('0x46')](_0x9399c9[_0xc4db('0x5d')],function(_0x32bfe2){var _0xd0ceb1={};_0xd0ceb1[_0x32bfe2]={'$like':'%'+_0x37f6a6[_0xc4db('0x47')]['filter']+'%'};return _0xd0ceb1;})});}_0x9399c9=_[_0xc4db('0x53')]({},_0x9399c9,_0x37f6a6[_0xc4db('0x57')]);return _0x55b31a['getAgents'](_0x9399c9);}})[_0xc4db('0x3a')](function(_0x1c03f3){if(_0x1c03f3){_0x49537a=_0x1c03f3[_0xc4db('0x4c')];if(!_0x37f6a6['query'][_0xc4db('0x4d')](_0xc4db('0x4e'))){_0x9399c9[_0xc4db('0x33')]=qs[_0xc4db('0x33')](_0x37f6a6[_0xc4db('0x47')]['limit']);_0x9399c9[_0xc4db('0x35')]=qs['offset'](_0x37f6a6[_0xc4db('0x47')][_0xc4db('0x35')]);}return _0x55b31a['getAgents'](_0x9399c9);}})[_0xc4db('0x3a')](function(_0x483547){if(_0x483547){return _0x483547?{'count':_0x49537a,'rows':_0x483547}:null;}})[_0xc4db('0x3a')](respondWithResult(_0x53758d,null))['catch'](handleError(_0x53758d,null));}; \ No newline at end of file +var _0xa055=['socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','SmsAccount,\x20%s,\x20%s','message','result','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','get','SmsAccounts','UserProfileResource','destroy','stack','name','send','index','Pause','mandatoryDispositionPause','SmsAccount','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','VIRTUAL','filter','options','includeAll','findAll','rows','catch','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','SmsAccountId','getDispositions','findOne','pick','merge','Disposition','removeDispositions','addAnswer','CannedAnswer','getAnswers','hasOwnProperty','removeAnswers','ids','notify','sms','SmsApplication','account','orderBy','Applications','priority','asc','CmContact','Sequelize','ValidationError','createdAt','difference','ListId','mobile','twilio','From','Body','messageId','MessageSid','sender','text','from','clicksend','message_id','MessageUUID','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','intelepeer','refid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','updatedAt','DESC','omit','Contacts','contact','SmsInteraction','spread','interaction','created','autoclose','applications','push','close','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','Start','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','set','Content-Type','\x0a','addApplications','sequelize','transaction','READ_COMMITTED','bulkCreate','findAndCountAll','finally','order','getApplications','Contact','Owner','fullname','Tag','color','tag','List','out','Messages','dataValues','debug','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','connectel','requestid','statusInt','status_code','infobip','groupName','bandwidth','redif','skebby','DELIVERED','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','state','message-id','addAgents','userSmsAccount:save','isArray','userSmsAccount:remove','emit','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xa055,0x1bd));var _0x5a05=function(_0x44714c,_0x2ac454){_0x44714c=_0x44714c-0x0;var _0x57d4d5=_0xa055[_0x44714c];return _0x57d4d5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5a05('0x0'));var zipdir=require(_0x5a05('0x1'));var jsonpatch=require(_0x5a05('0x2'));var rp=require(_0x5a05('0x3'));var moment=require('moment');var BPromise=require(_0x5a05('0x4'));var Mustache=require(_0x5a05('0x5'));var util=require(_0x5a05('0x6'));var path=require(_0x5a05('0x7'));var sox=require(_0x5a05('0x8'));var csv=require(_0x5a05('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5a05('0xa'));var _=require(_0x5a05('0xb'));var squel=require(_0x5a05('0xc'));var crypto=require(_0x5a05('0xd'));var jsforce=require(_0x5a05('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5a05('0x9'));var querystring=require(_0x5a05('0xf'));var Papa=require(_0x5a05('0x10'));var Redis=require(_0x5a05('0x11'));var authService=require(_0x5a05('0x12'));var qs=require(_0x5a05('0x13'));var as=require(_0x5a05('0x14'));var hardwareService=require(_0x5a05('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x5a05('0x16'));var config=require(_0x5a05('0x17'));var licenseUtil=require(_0x5a05('0x18'));var db=require(_0x5a05('0x19'))['db'];config['redis']=_[_0x5a05('0x1a')](config[_0x5a05('0x1b')],{'host':_0x5a05('0x1c'),'port':0x18eb});var socket=require(_0x5a05('0x1d'))(new Redis(config['redis']));require(_0x5a05('0x1e'))[_0x5a05('0x1f')](socket);var jayson=require(_0x5a05('0x20'));var client=jayson[_0x5a05('0x21')][_0x5a05('0x22')]({'port':0x232c});function respondWithRpcPromise(_0x25e1a7,_0x5161cb,_0x1fc86d,_0xcedc6e){return new BPromise(function(_0x5df655,_0x30b0cc){var _0x560a59=_0xcedc6e||client;return _0x560a59[_0x5a05('0x23')](_0x25e1a7,_0x1fc86d)[_0x5a05('0x24')](function(_0x1fbb3c){logger[_0x5a05('0x25')]('SmsAccount,\x20%s,\x20%s',_0x5161cb,_0x5a05('0x26'));logger['debug'](_0x5a05('0x27'),_0x5161cb,_0x5a05('0x26'),JSON['stringify'](_0x1fbb3c));if(_0x1fbb3c[_0x5a05('0x28')]){if(_0x1fbb3c[_0x5a05('0x28')][_0x5a05('0x29')]===0x1f4){logger[_0x5a05('0x28')](_0x5a05('0x2a'),_0x5161cb,_0x1fbb3c['error'][_0x5a05('0x2b')]);return _0x30b0cc(_0x1fbb3c[_0x5a05('0x28')][_0x5a05('0x2b')]);}logger[_0x5a05('0x28')](_0x5a05('0x2a'),_0x5161cb,_0x1fbb3c[_0x5a05('0x28')][_0x5a05('0x2b')]);return _0x5df655(_0x1fbb3c[_0x5a05('0x28')]['message']);}else{logger['info'](_0x5a05('0x2a'),_0x5161cb,_0x5a05('0x26'));_0x5df655(_0x1fbb3c[_0x5a05('0x2c')][_0x5a05('0x2b')]);}})['catch'](function(_0x5b4454){logger['error']('SmsAccount,\x20%s,\x20%s',_0x5161cb,_0x5b4454);_0x30b0cc(_0x5b4454);});});}function respondWithStatusCode(_0x2d4283,_0x5beda4){_0x5beda4=_0x5beda4||0xcc;return function(_0x2305a9){if(_0x2305a9){return _0x2d4283[_0x5a05('0x2d')](_0x5beda4);}return _0x2d4283[_0x5a05('0x2e')](_0x5beda4)[_0x5a05('0x2f')]();};}function respondWithResult(_0x573c56,_0x507ce7){_0x507ce7=_0x507ce7||0xc8;return function(_0x3e186c){if(_0x3e186c){return _0x573c56['status'](_0x507ce7)[_0x5a05('0x30')](_0x3e186c);}};}function respondWithFilteredResult(_0x2b3499,_0x1d1a17){return function(_0x2d5234){if(_0x2d5234){var _0x23b982=typeof _0x1d1a17[_0x5a05('0x31')]===_0x5a05('0x32')&&typeof _0x1d1a17[_0x5a05('0x33')]==='undefined';var _0x321cc2=_0x2d5234[_0x5a05('0x34')];var _0x239c42=_0x23b982?0x0:_0x1d1a17[_0x5a05('0x31')];var _0x1cff31=_0x23b982?_0x2d5234[_0x5a05('0x34')]:_0x1d1a17[_0x5a05('0x31')]+_0x1d1a17[_0x5a05('0x33')];var _0x3e2093;if(_0x1cff31>=_0x321cc2){_0x1cff31=_0x321cc2;_0x3e2093=0xc8;}else{_0x3e2093=0xce;}_0x2b3499[_0x5a05('0x2e')](_0x3e2093);return _0x2b3499['set'](_0x5a05('0x35'),_0x239c42+'-'+_0x1cff31+'/'+_0x321cc2)[_0x5a05('0x30')](_0x2d5234);}return null;};}function patchUpdates(_0x558e43){return function(_0x353cd7){try{jsonpatch['apply'](_0x353cd7,_0x558e43,!![]);}catch(_0x59d571){return BPromise[_0x5a05('0x36')](_0x59d571);}return _0x353cd7[_0x5a05('0x37')]();};}function saveUpdates(_0x4bcf5d,_0x5bf7e6){return function(_0x1b4e9f){if(_0x1b4e9f){return _0x1b4e9f[_0x5a05('0x38')](_0x4bcf5d)[_0x5a05('0x24')](function(_0x3fafb5){return _0x3fafb5;});}return null;};}function removeEntity(_0x24bf80,_0x59c092){return function(_0x28ce65){if(_0x28ce65){return _0x28ce65['destroy']()[_0x5a05('0x24')](function(){var _0x58b92d=_0x28ce65[_0x5a05('0x39')]({'plain':!![]});var _0x247e53=_0x5a05('0x3a');return db[_0x5a05('0x3b')][_0x5a05('0x3c')]({'where':{'type':_0x247e53,'resourceId':_0x58b92d['id']}})[_0x5a05('0x24')](function(){return _0x28ce65;});})['then'](function(){_0x24bf80['status'](0xcc)[_0x5a05('0x2f')]();});}};}function handleEntityNotFound(_0x3b0498,_0x16c448){return function(_0x374f3f){if(!_0x374f3f){_0x3b0498['sendStatus'](0x194);}return _0x374f3f;};}function handleError(_0x1d7a32,_0xe9346c){_0xe9346c=_0xe9346c||0x1f4;return function(_0x1fdd7f){logger['error'](_0x1fdd7f[_0x5a05('0x3d')]);if(_0x1fdd7f[_0x5a05('0x3e')]){delete _0x1fdd7f['name'];}_0x1d7a32[_0x5a05('0x2e')](_0xe9346c)[_0x5a05('0x3f')](_0x1fdd7f);};}exports[_0x5a05('0x40')]=function(_0x45e9b2,_0x29a686){var _0x4df95d={'include':[{'model':db[_0x5a05('0x41')],'as':_0x5a05('0x42')}]},_0x4862c9={},_0x118313={'count':0x0,'rows':[]};var _0x362234=_['map'](db[_0x5a05('0x43')][_0x5a05('0x44')],function(_0x3630d5){return{'name':_0x3630d5[_0x5a05('0x45')],'type':_0x3630d5[_0x5a05('0x46')][_0x5a05('0x47')]};});_0x4862c9[_0x5a05('0x48')]=_[_0x5a05('0x49')](_0x362234,_0x5a05('0x3e'));_0x4862c9[_0x5a05('0x4a')]=_[_0x5a05('0x4b')](_0x45e9b2['query']);_0x4862c9[_0x5a05('0x4c')]=_[_0x5a05('0x4d')](_0x4862c9['model'],_0x4862c9['query']);_0x4df95d[_0x5a05('0x4e')]=_['intersection'](_0x4862c9[_0x5a05('0x48')],qs[_0x5a05('0x4f')](_0x45e9b2[_0x5a05('0x4a')][_0x5a05('0x4f')]));_0x4df95d['attributes']=_0x4df95d['attributes'][_0x5a05('0x50')]?_0x4df95d[_0x5a05('0x4e')]:_0x4862c9[_0x5a05('0x48')];if(!_0x45e9b2[_0x5a05('0x4a')]['hasOwnProperty'](_0x5a05('0x51'))){_0x4df95d[_0x5a05('0x33')]=qs[_0x5a05('0x33')](_0x45e9b2[_0x5a05('0x4a')]['limit']);_0x4df95d['offset']=qs[_0x5a05('0x31')](_0x45e9b2[_0x5a05('0x4a')]['offset']);}_0x4df95d['order']=qs[_0x5a05('0x52')](_0x45e9b2[_0x5a05('0x4a')][_0x5a05('0x52')]);_0x4df95d[_0x5a05('0x53')]=qs[_0x5a05('0x4c')](_['pick'](_0x45e9b2['query'],_0x4862c9[_0x5a05('0x4c')]),_0x362234);if(_0x45e9b2[_0x5a05('0x4a')]['filter']){_0x4df95d['where']=_['merge'](_0x4df95d[_0x5a05('0x53')],{'$or':_['map'](_0x362234,function(_0x3a25f7){if(_0x3a25f7['type']!==_0x5a05('0x54')){var _0x25cb93={};_0x25cb93[_0x3a25f7[_0x5a05('0x3e')]]={'$like':'%'+_0x45e9b2[_0x5a05('0x4a')][_0x5a05('0x55')]+'%'};return _0x25cb93;}})});}_0x4df95d=_['merge']({},_0x4df95d,_0x45e9b2[_0x5a05('0x56')]);var _0x447bea={'where':_0x4df95d[_0x5a05('0x53')]};return db[_0x5a05('0x43')][_0x5a05('0x34')](_0x447bea)[_0x5a05('0x24')](function(_0x4acb75){_0x118313[_0x5a05('0x34')]=_0x4acb75;if(_0x45e9b2[_0x5a05('0x4a')][_0x5a05('0x57')]){_0x4df95d['include']=[{'all':!![]}];}return db[_0x5a05('0x43')][_0x5a05('0x58')](_0x4df95d);})['then'](function(_0x19d6d3){_0x118313[_0x5a05('0x59')]=_0x19d6d3;return _0x118313;})[_0x5a05('0x24')](respondWithFilteredResult(_0x29a686,_0x4df95d))[_0x5a05('0x5a')](handleError(_0x29a686,null));};exports['show']=function(_0x28065d,_0xe4c83b){var _0x5b2e87={'raw':![],'where':{'id':_0x28065d[_0x5a05('0x5b')]['id']},'include':[{'model':db[_0x5a05('0x41')],'as':_0x5a05('0x42')}]},_0x472d8c={};_0x472d8c[_0x5a05('0x48')]=_[_0x5a05('0x4b')](db['SmsAccount'][_0x5a05('0x44')]);_0x472d8c[_0x5a05('0x4a')]=_[_0x5a05('0x4b')](_0x28065d[_0x5a05('0x4a')]);_0x472d8c[_0x5a05('0x4c')]=_[_0x5a05('0x4d')](_0x472d8c[_0x5a05('0x48')],_0x472d8c['query']);_0x5b2e87['attributes']=_['intersection'](_0x472d8c['model'],qs['fields'](_0x28065d[_0x5a05('0x4a')]['fields']));_0x5b2e87[_0x5a05('0x4e')]=_0x5b2e87['attributes'][_0x5a05('0x50')]?_0x5b2e87[_0x5a05('0x4e')]:_0x472d8c['model'];if(_0x28065d[_0x5a05('0x4a')][_0x5a05('0x57')]){_0x5b2e87[_0x5a05('0x5c')]=[{'all':!![]}];}_0x5b2e87=_['merge']({},_0x5b2e87,_0x28065d[_0x5a05('0x56')]);return db[_0x5a05('0x43')][_0x5a05('0x5d')](_0x5b2e87)[_0x5a05('0x24')](handleEntityNotFound(_0xe4c83b,null))['then'](respondWithResult(_0xe4c83b,null))[_0x5a05('0x5a')](handleError(_0xe4c83b,null));};exports[_0x5a05('0x5e')]=function(_0x3cdced,_0x5c0cb6){return db[_0x5a05('0x43')][_0x5a05('0x5e')](_0x3cdced[_0x5a05('0x5f')],{})[_0x5a05('0x24')](function(_0x3f3404){var _0x50d268=_0x3cdced[_0x5a05('0x60')][_0x5a05('0x39')]({'plain':!![]});if(!_0x50d268)throw new Error(_0x5a05('0x61'));if(_0x50d268[_0x5a05('0x62')]===_0x5a05('0x60')){var _0x1bacb4=_0x3f3404[_0x5a05('0x39')]({'plain':!![]});var _0x29d49c=_0x5a05('0x3a');return db[_0x5a05('0x63')][_0x5a05('0x5d')]({'where':{'name':_0x29d49c,'userProfileId':_0x50d268[_0x5a05('0x64')]},'raw':!![]})[_0x5a05('0x24')](function(_0x22aa68){if(_0x22aa68&&_0x22aa68[_0x5a05('0x65')]===0x0){return db['UserProfileResource'][_0x5a05('0x5e')]({'name':_0x1bacb4[_0x5a05('0x3e')],'resourceId':_0x1bacb4['id'],'type':_0x22aa68['name'],'sectionId':_0x22aa68['id']},{})[_0x5a05('0x24')](function(){return _0x3f3404;});}else{return _0x3f3404;}})[_0x5a05('0x5a')](function(_0x237867){logger[_0x5a05('0x28')](_0x5a05('0x66'),_0x237867);throw _0x237867;});}return _0x3f3404;})[_0x5a05('0x24')](respondWithResult(_0x5c0cb6,0xc9))[_0x5a05('0x5a')](handleError(_0x5c0cb6,null));};exports[_0x5a05('0x38')]=function(_0x977721,_0x58a728){if(_0x977721[_0x5a05('0x5f')]['id']){delete _0x977721['body']['id'];}return db['SmsAccount'][_0x5a05('0x5d')]({'where':{'id':_0x977721[_0x5a05('0x5b')]['id']},'include':[{'model':db[_0x5a05('0x41')],'as':_0x5a05('0x42')}]})[_0x5a05('0x24')](handleEntityNotFound(_0x58a728,null))[_0x5a05('0x24')](saveUpdates(_0x977721[_0x5a05('0x5f')],null))[_0x5a05('0x24')](respondWithResult(_0x58a728,null))[_0x5a05('0x5a')](handleError(_0x58a728,null));};exports[_0x5a05('0x3c')]=function(_0x1a8bbb,_0x108e11){return db[_0x5a05('0x43')]['find']({'where':{'id':_0x1a8bbb[_0x5a05('0x5b')]['id']}})['then'](handleEntityNotFound(_0x108e11,null))[_0x5a05('0x24')](removeEntity(_0x108e11,null))[_0x5a05('0x5a')](handleError(_0x108e11,null));};exports[_0x5a05('0x67')]=function(_0x2bcfa9,_0x2e15c7){return db[_0x5a05('0x43')]['describe']()['then'](respondWithResult(_0x2e15c7,null))['catch'](handleError(_0x2e15c7,null));};exports[_0x5a05('0x68')]=function(_0x4028fb,_0x1d40a8,_0xe021b5){if(_0x4028fb['body']['id']){delete _0x4028fb[_0x5a05('0x5f')]['id'];}return db[_0x5a05('0x43')][_0x5a05('0x5d')]({'where':{'id':_0x4028fb[_0x5a05('0x5b')]['id']}})['then'](handleEntityNotFound(_0x1d40a8,null))[_0x5a05('0x24')](function(_0x3c8d0d){if(_0x3c8d0d){_0x4028fb[_0x5a05('0x5f')][_0x5a05('0x69')]=_0x3c8d0d['id'];return db['Disposition'][_0x5a05('0x5e')](_0x4028fb[_0x5a05('0x5f')]);}})[_0x5a05('0x24')](respondWithResult(_0x1d40a8,null))[_0x5a05('0x5a')](handleError(_0x1d40a8,null));};exports[_0x5a05('0x6a')]=function(_0x370b6a,_0x14d221,_0x1a5189){var _0x59faa5={'raw':![],'where':{}};var _0x415713={};var _0x136af8={'count':0x0,'rows':[]};return db[_0x5a05('0x43')][_0x5a05('0x6b')]({'where':{'id':_0x370b6a['params']['id']}})['then'](handleEntityNotFound(_0x14d221,null))[_0x5a05('0x24')](function(_0x2f6cca){if(_0x2f6cca){_0x415713[_0x5a05('0x48')]=_['keys'](db['Disposition'][_0x5a05('0x44')]);_0x415713[_0x5a05('0x4a')]=_[_0x5a05('0x4b')](_0x370b6a[_0x5a05('0x4a')]);_0x415713[_0x5a05('0x4c')]=_['intersection'](_0x415713[_0x5a05('0x48')],_0x415713[_0x5a05('0x4a')]);_0x59faa5[_0x5a05('0x4e')]=_[_0x5a05('0x4d')](_0x415713['model'],qs[_0x5a05('0x4f')](_0x370b6a[_0x5a05('0x4a')][_0x5a05('0x4f')]));_0x59faa5[_0x5a05('0x4e')]=_0x59faa5[_0x5a05('0x4e')]['length']?_0x59faa5['attributes']:_0x415713['model'];if(!_0x370b6a['query']['hasOwnProperty'](_0x5a05('0x51'))){_0x59faa5[_0x5a05('0x33')]=qs['limit'](_0x370b6a[_0x5a05('0x4a')][_0x5a05('0x33')]);_0x59faa5[_0x5a05('0x31')]=qs['offset'](_0x370b6a[_0x5a05('0x4a')][_0x5a05('0x31')]);}_0x59faa5['order']=qs[_0x5a05('0x52')](_0x370b6a['query'][_0x5a05('0x52')]);_0x59faa5[_0x5a05('0x53')]=qs[_0x5a05('0x4c')](_[_0x5a05('0x6c')](_0x370b6a[_0x5a05('0x4a')],_0x415713['filters']));_0x59faa5[_0x5a05('0x53')][_0x5a05('0x69')]=_0x2f6cca['id'];if(_0x370b6a['query'][_0x5a05('0x55')]){_0x59faa5[_0x5a05('0x53')]=_[_0x5a05('0x6d')](_0x59faa5[_0x5a05('0x53')],{'$or':_[_0x5a05('0x49')](_0x59faa5[_0x5a05('0x4e')],function(_0xc3fcdb){var _0x36006b={};_0x36006b[_0xc3fcdb]={'$like':'%'+_0x370b6a[_0x5a05('0x4a')][_0x5a05('0x55')]+'%'};return _0x36006b;})});}_0x59faa5=_[_0x5a05('0x6d')]({},_0x59faa5,_0x370b6a['options']);return db[_0x5a05('0x6e')][_0x5a05('0x34')]({'where':_0x59faa5[_0x5a05('0x53')]})[_0x5a05('0x24')](function(_0x194193){_0x136af8['count']=_0x194193;if(_0x370b6a['query']['includeAll']){_0x59faa5['include']=[{'all':!![]}];}return db[_0x5a05('0x6e')][_0x5a05('0x58')](_0x59faa5);})['then'](function(_0x2770a8){_0x136af8[_0x5a05('0x59')]=_0x2770a8;return _0x136af8;});}})['then'](respondWithFilteredResult(_0x14d221,_0x59faa5))[_0x5a05('0x5a')](handleError(_0x14d221,null));};exports[_0x5a05('0x6f')]=function(_0x858c86,_0x21db15,_0x518bed){return db[_0x5a05('0x43')]['find']({'where':{'id':_0x858c86[_0x5a05('0x5b')]['id']}})['then'](handleEntityNotFound(_0x21db15,null))[_0x5a05('0x24')](function(_0x1719a5){if(_0x1719a5){return _0x1719a5[_0x5a05('0x6f')](_0x858c86['query']['ids']);}})[_0x5a05('0x24')](respondWithStatusCode(_0x21db15,null))[_0x5a05('0x5a')](handleError(_0x21db15,null));};exports[_0x5a05('0x70')]=function(_0x4490db,_0x3f1333,_0x3f3549){if(_0x4490db['body']['id']){delete _0x4490db[_0x5a05('0x5f')]['id'];}return db[_0x5a05('0x43')][_0x5a05('0x5d')]({'where':{'id':_0x4490db[_0x5a05('0x5b')]['id']}})[_0x5a05('0x24')](handleEntityNotFound(_0x3f1333,null))[_0x5a05('0x24')](function(_0x3feb28){if(_0x3feb28){_0x4490db[_0x5a05('0x5f')]['SmsAccountId']=_0x3feb28['id'];return db[_0x5a05('0x71')]['create'](_0x4490db[_0x5a05('0x5f')]);}})[_0x5a05('0x24')](respondWithResult(_0x3f1333,null))[_0x5a05('0x5a')](handleError(_0x3f1333,null));};exports[_0x5a05('0x72')]=function(_0x3a17c0,_0x5ba209,_0x388ca2){var _0x17a625={'raw':![],'where':{}};var _0x134377={};var _0x420299={'count':0x0,'rows':[]};return db[_0x5a05('0x43')][_0x5a05('0x6b')]({'where':{'id':_0x3a17c0[_0x5a05('0x5b')]['id']}})[_0x5a05('0x24')](handleEntityNotFound(_0x5ba209,null))[_0x5a05('0x24')](function(_0x5e96f7){if(_0x5e96f7){_0x134377[_0x5a05('0x48')]=_[_0x5a05('0x4b')](db[_0x5a05('0x71')][_0x5a05('0x44')]);_0x134377[_0x5a05('0x4a')]=_[_0x5a05('0x4b')](_0x3a17c0[_0x5a05('0x4a')]);_0x134377[_0x5a05('0x4c')]=_['intersection'](_0x134377[_0x5a05('0x48')],_0x134377[_0x5a05('0x4a')]);_0x17a625[_0x5a05('0x4e')]=_[_0x5a05('0x4d')](_0x134377[_0x5a05('0x48')],qs[_0x5a05('0x4f')](_0x3a17c0[_0x5a05('0x4a')][_0x5a05('0x4f')]));_0x17a625['attributes']=_0x17a625[_0x5a05('0x4e')][_0x5a05('0x50')]?_0x17a625[_0x5a05('0x4e')]:_0x134377[_0x5a05('0x48')];if(!_0x3a17c0['query'][_0x5a05('0x73')]('nolimit')){_0x17a625['limit']=qs[_0x5a05('0x33')](_0x3a17c0[_0x5a05('0x4a')][_0x5a05('0x33')]);_0x17a625[_0x5a05('0x31')]=qs[_0x5a05('0x31')](_0x3a17c0['query'][_0x5a05('0x31')]);}_0x17a625['order']=qs['sort'](_0x3a17c0[_0x5a05('0x4a')][_0x5a05('0x52')]);_0x17a625[_0x5a05('0x53')]=qs[_0x5a05('0x4c')](_[_0x5a05('0x6c')](_0x3a17c0[_0x5a05('0x4a')],_0x134377[_0x5a05('0x4c')]));_0x17a625[_0x5a05('0x53')]['SmsAccountId']=_0x5e96f7['id'];if(_0x3a17c0[_0x5a05('0x4a')][_0x5a05('0x55')]){_0x17a625[_0x5a05('0x53')]=_['merge'](_0x17a625[_0x5a05('0x53')],{'$or':_['map'](_0x17a625['attributes'],function(_0x1fc893){var _0x458809={};_0x458809[_0x1fc893]={'$like':'%'+_0x3a17c0['query'][_0x5a05('0x55')]+'%'};return _0x458809;})});}_0x17a625=_[_0x5a05('0x6d')]({},_0x17a625,_0x3a17c0['options']);return db[_0x5a05('0x71')][_0x5a05('0x34')]({'where':_0x17a625[_0x5a05('0x53')]})['then'](function(_0x132d6d){_0x420299[_0x5a05('0x34')]=_0x132d6d;if(_0x3a17c0[_0x5a05('0x4a')][_0x5a05('0x57')]){_0x17a625[_0x5a05('0x5c')]=[{'all':!![]}];}return db['CannedAnswer'][_0x5a05('0x58')](_0x17a625);})[_0x5a05('0x24')](function(_0x277f41){_0x420299[_0x5a05('0x59')]=_0x277f41;return _0x420299;});}})[_0x5a05('0x24')](respondWithFilteredResult(_0x5ba209,_0x17a625))[_0x5a05('0x5a')](handleError(_0x5ba209,null));};exports[_0x5a05('0x74')]=function(_0x2ba57d,_0x437a4e,_0x211150){return db[_0x5a05('0x43')][_0x5a05('0x5d')]({'where':{'id':_0x2ba57d['params']['id']}})['then'](handleEntityNotFound(_0x437a4e,null))[_0x5a05('0x24')](function(_0xcf71bf){if(_0xcf71bf){return _0xcf71bf[_0x5a05('0x74')](_0x2ba57d[_0x5a05('0x4a')][_0x5a05('0x75')]);}})[_0x5a05('0x24')](respondWithStatusCode(_0x437a4e,null))[_0x5a05('0x5a')](handleError(_0x437a4e,null));};exports[_0x5a05('0x76')]=function(_0xab3649,_0x3595c4,_0x38e4ca){var _0x49d0c9={'channel':_0x5a05('0x77')};var _0x141721=[];var _0x4acf13=[];var _0x2e784d={};return db['SmsAccount']['find']({'where':{'id':_0xab3649[_0x5a05('0x5b')]['id']},'include':[{'model':db[_0x5a05('0x78')],'as':'Applications'}]})['then'](handleEntityNotFound(_0x3595c4,null))[_0x5a05('0x24')](function(_0x530dd3){_0x49d0c9[_0x5a05('0x79')]=_0x530dd3;_0x49d0c9['applications']=_[_0x5a05('0x7a')](_0x530dd3[_0x5a05('0x7b')],[_0x5a05('0x7c')],[_0x5a05('0x7d')]);if(_0x49d0c9[_0x5a05('0x79')][_0x5a05('0x7b')]){delete _0x49d0c9[_0x5a05('0x79')][_0x5a05('0x7b')];}return db[_0x5a05('0x7e')][_0x5a05('0x67')]();})[_0x5a05('0x24')](function(_0x20059f){if(!_0x20059f){throw new db[(_0x5a05('0x7f'))][(_0x5a05('0x80'))]('no\x20available\x20attributes');}_0x141721=_['difference'](_['keys'](_0x20059f),[_0x5a05('0x81'),'updatedAt']);_0x4acf13=_[_0x5a05('0x82')](_[_0x5a05('0x4b')](_0x20059f),[_0x5a05('0x81'),'updatedAt','CompanyId',_0x5a05('0x83')]);_0x49d0c9[_0x5a05('0x5f')]={'mapKey':_0x5a05('0x84')};if(_0x49d0c9[_0x5a05('0x79')][_0x5a05('0x46')]){switch(_0x49d0c9[_0x5a05('0x79')]['type']){case _0x5a05('0x85'):_0x49d0c9[_0x5a05('0x5f')]['from']=_0xab3649[_0x5a05('0x5f')][_0x5a05('0x86')];_0x49d0c9[_0x5a05('0x5f')][_0x5a05('0x5f')]=_0xab3649['body'][_0x5a05('0x87')];_0x49d0c9[_0x5a05('0x5f')][_0x5a05('0x88')]=_0xab3649[_0x5a05('0x5f')][_0x5a05('0x89')];break;case'skebby':_0x49d0c9[_0x5a05('0x5f')]['from']='+'+_0xab3649['body'][_0x5a05('0x8a')];_0x49d0c9[_0x5a05('0x5f')][_0x5a05('0x5f')]=_0xab3649['body'][_0x5a05('0x8b')];break;case'connectel':_0x49d0c9[_0x5a05('0x5f')][_0x5a05('0x8c')]=_0xab3649[_0x5a05('0x5f')][_0x5a05('0x8c')];_0x49d0c9['body']['body']=_0xab3649['body'][_0x5a05('0x2b')];break;case _0x5a05('0x8d'):_0x49d0c9[_0x5a05('0x5f')]['from']=_0xab3649['body'][_0x5a05('0x8c')];_0x49d0c9[_0x5a05('0x5f')][_0x5a05('0x5f')]=_0xab3649[_0x5a05('0x5f')][_0x5a05('0x5f')];_0x49d0c9[_0x5a05('0x5f')][_0x5a05('0x88')]=_0xab3649[_0x5a05('0x5f')][_0x5a05('0x8e')];break;case'plivo':_0x49d0c9[_0x5a05('0x5f')][_0x5a05('0x8c')]=_0xab3649['body'][_0x5a05('0x86')];_0x49d0c9[_0x5a05('0x5f')][_0x5a05('0x5f')]=_0xab3649[_0x5a05('0x5f')]['Text'];_0x49d0c9['body'][_0x5a05('0x88')]=_0xab3649[_0x5a05('0x5f')][_0x5a05('0x8f')];break;case'infobip':_0x49d0c9[_0x5a05('0x5f')]['from']='+'+_0xab3649[_0x5a05('0x5f')][_0x5a05('0x90')][0x0][_0x5a05('0x8c')];_0x49d0c9[_0x5a05('0x5f')][_0x5a05('0x5f')]=_0xab3649[_0x5a05('0x5f')]['results'][0x0][_0x5a05('0x8b')];_0x49d0c9[_0x5a05('0x5f')][_0x5a05('0x88')]=_0xab3649[_0x5a05('0x5f')][_0x5a05('0x90')][0x0]['messageId'];break;case _0x5a05('0x91'):_0x49d0c9[_0x5a05('0x5f')]['from']=_0xab3649[_0x5a05('0x5f')][_0x5a05('0x92')];_0x49d0c9[_0x5a05('0x5f')]['body']=_0xab3649[_0x5a05('0x5f')][_0x5a05('0x93')][_0x5a05('0x2b')];break;case _0x5a05('0x94'):_0x49d0c9[_0x5a05('0x5f')][_0x5a05('0x8c')]=_0xab3649[_0x5a05('0x5f')][_0x5a05('0x95')];_0x49d0c9[_0x5a05('0x5f')][_0x5a05('0x5f')]=_0xab3649[_0x5a05('0x5f')][_0x5a05('0x8b')];_0x49d0c9[_0x5a05('0x5f')]['messageId']=_0xab3649[_0x5a05('0x5f')][_0x5a05('0x96')];break;case'bandwidth':_0x49d0c9['body'][_0x5a05('0x88')]=_0xab3649[_0x5a05('0x5f')][0x0][_0x5a05('0x2b')]['id'];_0x49d0c9['body'][_0x5a05('0x8c')]=_0xab3649[_0x5a05('0x5f')][0x0][_0x5a05('0x2b')][_0x5a05('0x8c')];_0x49d0c9[_0x5a05('0x5f')]['body']=_0xab3649[_0x5a05('0x5f')][0x0][_0x5a05('0x2b')][_0x5a05('0x8b')];break;case _0x5a05('0x97'):_0x49d0c9[_0x5a05('0x5f')][_0x5a05('0x8c')]=_0xab3649['body'][_0x5a05('0x8c')];_0x49d0c9[_0x5a05('0x5f')][_0x5a05('0x5f')]=_0xab3649['body'][_0x5a05('0x2b')];_0x49d0c9[_0x5a05('0x5f')]['messageId']=_0xab3649[_0x5a05('0x5f')][_0x5a05('0x98')];break;}}if(_0x49d0c9[_0x5a05('0x5f')]['id']){delete _0x49d0c9[_0x5a05('0x5f')]['id'];}if(_[_0x5a05('0x99')](_0x49d0c9[_0x5a05('0x5f')][_0x5a05('0x8c')])){throw new db[(_0x5a05('0x7f'))]['ValidationError'](_0x5a05('0x9a'));}if(_[_0x5a05('0x99')](_0x49d0c9[_0x5a05('0x5f')][_0x5a05('0x5f')])||_0x49d0c9[_0x5a05('0x5f')][_0x5a05('0x5f')]===''){throw new db[(_0x5a05('0x7f'))][(_0x5a05('0x80'))](_0x5a05('0x9b'));}if(_['isNil'](_0x49d0c9[_0x5a05('0x5f')][_0x5a05('0x9c')])){throw new db[(_0x5a05('0x7f'))][(_0x5a05('0x80'))](_0x5a05('0x9d')+_0x4acf13);}if(!_[_0x5a05('0x9e')](_0x4acf13,_0x49d0c9['body'][_0x5a05('0x9c')])){throw new db[(_0x5a05('0x7f'))][(_0x5a05('0x80'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4acf13);}_0x2e784d[_0x49d0c9['body'][_0x5a05('0x9c')]]=_0x49d0c9[_0x5a05('0x5f')][_0x5a05('0x8c')];return db[_0x5a05('0x9f')][_0x5a05('0x5d')]({'where':{'id':_0x49d0c9[_0x5a05('0x79')][_0x5a05('0x83')]},'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x2e784d,'limit':0x1,'order':[[_0x5a05('0xa0'),_0x5a05('0xa1')]]}]});})[_0x5a05('0x24')](handleEntityNotFound(_0x3595c4,null))[_0x5a05('0x24')](function(_0x37ef6f){if(_0x37ef6f){_0x49d0c9['list']=_[_0x5a05('0xa2')](_0x37ef6f,[_0x5a05('0xa3')]);if(_0x37ef6f[_0x5a05('0xa3')][_0x5a05('0x50')]){return _0x37ef6f['Contacts'][0x0];}var _0x5bdce6=_[_0x5a05('0x1a')](_0x49d0c9[_0x5a05('0x5f')],{'firstName':_0x49d0c9[_0x5a05('0x5f')][_0x5a05('0x8c')],'ListId':_0x37ef6f['id']});_0x5bdce6[_0x49d0c9[_0x5a05('0x5f')][_0x5a05('0x9c')]]=_0x49d0c9['body'][_0x5a05('0x8c')];return db[_0x5a05('0x7e')]['create'](_0x5bdce6,{'fields':_0x141721,'raw':!![]});}})['then'](handleEntityNotFound(_0x3595c4,null))[_0x5a05('0x24')](function(_0x10b32d){if(_0x10b32d){_0x49d0c9[_0x5a05('0xa4')]=_0x10b32d;var _0x308d36={'ContactId':_0x10b32d['id'],'phone':_0x49d0c9['body']['from'],'SmsAccountId':_0xab3649[_0x5a05('0x5b')]['id']};var _0x3cdbe1={'ContactId':_0x10b32d['id'],'SmsAccountId':_0xab3649[_0x5a05('0x5b')]['id'],'closed':![]};return db[_0x5a05('0xa5')]['find']({'where':_0x3cdbe1})['then'](function(_0x4d8066){if(_0x4d8066){return[_0x4d8066,![]];}return db['SmsInteraction']['create'](_0x308d36)[_0x5a05('0x24')](function(_0x137b4a){return[_0x137b4a,!![]];});});}})[_0x5a05('0xa6')](function(_0x5d62eb,_0x25b2b7){_0x49d0c9[_0x5a05('0xa7')]=_0x5d62eb[_0x5a05('0x39')]({'plain':!![]});_0x49d0c9[_0x5a05('0xa7')][_0x5a05('0xa8')]=![];if(_0x25b2b7){if(_0x49d0c9[_0x5a05('0x79')][_0x5a05('0xa9')]){_0x49d0c9[_0x5a05('0xaa')][_0x5a05('0xab')]({'id':0x0,'priority':_0x49d0c9[_0x5a05('0xaa')][_0x5a05('0x50')]+0x1,'app':_0x5a05('0xac'),'appdata':'unmanaged','interval':_0x5a05('0xad')});}_0x49d0c9[_0x5a05('0xa7')][_0x5a05('0xa8')]=!![];}return db[_0x5a05('0xae')][_0x5a05('0x5e')]({'phone':_0x49d0c9[_0x5a05('0x5f')][_0x5a05('0x8c')],'messageId':_0x49d0c9[_0x5a05('0x5f')][_0x5a05('0x88')],'body':_0x49d0c9[_0x5a05('0x5f')][_0x5a05('0x5f')],'SmsAccountId':_0xab3649[_0x5a05('0x5b')]['id'],'SmsInteractionId':_0x5d62eb['id'],'direction':'in','ContactId':_0x5d62eb[_0x5a05('0xaf')],'AttachmentId':_0x49d0c9['body'][_0x5a05('0xb0')]});})['then'](function(_0x16b0b3){_0x49d0c9[_0x5a05('0x2b')]=_0x16b0b3;if(_0x49d0c9[_0x5a05('0xa7')][_0x5a05('0xb1')]){return db[_0x5a05('0xb2')]['find']({'attributes':['id',_0x5a05('0x3e')],'where':{'id':_0x49d0c9[_0x5a05('0xa7')][_0x5a05('0xb1')]}})[_0x5a05('0x24')](function(_0x3d600b){if(_0x3d600b){_0x49d0c9[_0x5a05('0xaa')][_0x5a05('0xb3')]({'id':0x0,'priority':0x0,'app':_0x5a05('0xb4'),'appdata':_0x3d600b[_0x5a05('0x3e')]+','+(_0x49d0c9[_0x5a05('0x79')][_0x5a05('0xb5')]||0xa),'interval':_0x5a05('0xad')});}return respondWithRpcPromise(_0x5a05('0xb6'),'startRouting',_0x49d0c9);});}return respondWithRpcPromise(_0x5a05('0xb6'),'startRouting',_0x49d0c9);})[_0x5a05('0x24')](function(_0x5d29fb){if(_0x5d29fb){var _0x1a2c1b=0xc8;var _0x21e543=_0x5a05('0xb7');logger[_0x5a05('0x25')](_0x5a05('0x27'),_0x21e543,_0x1a2c1b,_0x5a05('0xb8'));logger['debug'](_0x5a05('0xb9'),_0x21e543,_0x1a2c1b,_0x5a05('0xb8'),JSON[_0x5a05('0xba')](_0x5d29fb));if(_0x49d0c9[_0x5a05('0x79')][_0x5a05('0x46')]===_0x5a05('0x85')){return _0x3595c4[_0x5a05('0x2e')](_0x1a2c1b)[_0x5a05('0xbb')](_0x5a05('0xbc'),'text/xml')[_0x5a05('0x3f')](_0x5a05('0xbd'));}else{return _0x3595c4[_0x5a05('0x2e')](_0x1a2c1b)[_0x5a05('0x30')](_0x5d29fb);}}})[_0x5a05('0x5a')](handleError(_0x3595c4,null));};exports[_0x5a05('0xbe')]=function(_0xd4beb,_0x4654e5){var _0x5d6ab2=_0xd4beb[_0x5a05('0x5b')]['id'];var _0x536d7c=_0xd4beb['body'];var _0x19005c=0xc8;var _0xf8d7c7=null;return db[_0x5a05('0xbf')][_0x5a05('0xc0')]({'isolationLevel':db['sequelize']['Transaction']['ISOLATION_LEVELS'][_0x5a05('0xc1')]},function(_0x247132){return db['SmsAccount'][_0x5a05('0x6b')]({'where':{'id':_0x5d6ab2},'transaction':_0x247132})[_0x5a05('0x24')](function(_0x1a14f0){if(_0x1a14f0){return db['SmsApplication'][_0x5a05('0x3c')]({'where':{'SmsAccountId':_0x5d6ab2},'transaction':_0x247132})[_0x5a05('0x24')](function(){var _0x547562=_['map'](_0x536d7c,function(_0x21ef5b){_0x21ef5b[_0x5a05('0x69')]=_0x5d6ab2;return _0x21ef5b;});return db[_0x5a05('0x78')][_0x5a05('0xc2')](_0x547562,{'transaction':_0x247132});});}else{_0x19005c=0x194;_0xf8d7c7=[];}});})['then'](function(){if(_0x19005c!==0x194){return db['SmsApplication'][_0x5a05('0xc3')]({'where':{'SmsAccountId':_0x5d6ab2},'order':'priority'})[_0x5a05('0x24')](function(_0x5187e2){_0xf8d7c7=_0x5187e2;});}})[_0x5a05('0x5a')](function(_0x21540f){_0x19005c=0x1f4;logger[_0x5a05('0x28')](_0x21540f[_0x5a05('0x3d')]);if(_0x21540f[_0x5a05('0x3e')]){delete _0x21540f[_0x5a05('0x3e')];}_0xf8d7c7=_0x21540f;})[_0x5a05('0xc4')](function(){if(_0xf8d7c7===null){_0x4654e5[_0x5a05('0x2d')](_0x19005c);}else{if(_0x19005c===0x1f4){_0x4654e5['status'](_0x19005c)[_0x5a05('0x3f')](_0xf8d7c7);}else{_0x4654e5[_0x5a05('0x2e')](_0x19005c)[_0x5a05('0x30')](_0xf8d7c7);}}});};exports['getApplications']=function(_0x282f02,_0x3e24a2,_0x5ef272){var _0x32f72a={};var _0x31a867={};var _0x522857;var _0x1a214a;return db[_0x5a05('0x43')][_0x5a05('0x6b')]({'where':{'id':_0x282f02[_0x5a05('0x5b')]['id']}})[_0x5a05('0x24')](handleEntityNotFound(_0x3e24a2,null))[_0x5a05('0x24')](function(_0x20adab){if(_0x20adab){_0x522857=_0x20adab;_0x31a867[_0x5a05('0x48')]=_[_0x5a05('0x4b')](db['SmsApplication'][_0x5a05('0x44')]);_0x31a867[_0x5a05('0x4a')]=_[_0x5a05('0x4b')](_0x282f02[_0x5a05('0x4a')]);_0x31a867[_0x5a05('0x4c')]=_[_0x5a05('0x4d')](_0x31a867[_0x5a05('0x48')],_0x31a867[_0x5a05('0x4a')]);_0x32f72a[_0x5a05('0x4e')]=_[_0x5a05('0x4d')](_0x31a867['model'],qs[_0x5a05('0x4f')](_0x282f02[_0x5a05('0x4a')][_0x5a05('0x4f')]));_0x32f72a[_0x5a05('0x4e')]=_0x32f72a['attributes'][_0x5a05('0x50')]?_0x32f72a['attributes']:_0x31a867[_0x5a05('0x48')];_0x32f72a[_0x5a05('0xc5')]=qs[_0x5a05('0x52')](_0x282f02['query'][_0x5a05('0x52')]);_0x32f72a[_0x5a05('0x53')]=qs[_0x5a05('0x4c')](_[_0x5a05('0x6c')](_0x282f02['query'],_0x31a867['filters']));if(_0x282f02[_0x5a05('0x4a')][_0x5a05('0x55')]){_0x32f72a[_0x5a05('0x53')]=_['merge'](_0x32f72a[_0x5a05('0x53')],{'$or':_[_0x5a05('0x49')](_0x32f72a[_0x5a05('0x4e')],function(_0x5b3c8f){var _0x421eb1={};_0x421eb1[_0x5b3c8f]={'$like':'%'+_0x282f02[_0x5a05('0x4a')][_0x5a05('0x55')]+'%'};return _0x421eb1;})});}_0x32f72a=_[_0x5a05('0x6d')]({},_0x32f72a,_0x282f02[_0x5a05('0x56')]);return _0x522857['getApplications'](_0x32f72a);}})['then'](function(_0x143781){if(_0x143781){_0x1a214a=_0x143781[_0x5a05('0x50')];if(!_0x282f02['query']['hasOwnProperty']('nolimit')){_0x32f72a[_0x5a05('0x33')]=qs[_0x5a05('0x33')](_0x282f02[_0x5a05('0x4a')][_0x5a05('0x33')]);_0x32f72a[_0x5a05('0x31')]=qs[_0x5a05('0x31')](_0x282f02[_0x5a05('0x4a')]['offset']);}return _0x522857[_0x5a05('0xc6')](_0x32f72a);}})[_0x5a05('0x24')](function(_0x543437){if(_0x543437){return _0x543437?{'count':_0x1a214a,'rows':_0x543437}:null;}})[_0x5a05('0x24')](respondWithResult(_0x3e24a2,null))['catch'](handleError(_0x3e24a2,null));};exports['getInteractions']=function(_0x23a886,_0x495d91,_0x2e2a6f){var _0x2e1a7d={'raw':![],'where':{}};var _0x3953cc={};var _0x2da34e={'count':0x0,'rows':[]};return db['SmsAccount']['findOne']({'where':{'id':_0x23a886['params']['id']}})[_0x5a05('0x24')](handleEntityNotFound(_0x495d91,null))[_0x5a05('0x24')](function(_0x28322c){if(_0x28322c){_0x3953cc[_0x5a05('0x48')]=_[_0x5a05('0x4b')](db['SmsInteraction']['rawAttributes']);_0x3953cc[_0x5a05('0x4a')]=_[_0x5a05('0x4b')](_0x23a886[_0x5a05('0x4a')]);_0x3953cc[_0x5a05('0x4c')]=_[_0x5a05('0x4d')](_0x3953cc[_0x5a05('0x48')],_0x3953cc[_0x5a05('0x4a')]);_0x2e1a7d[_0x5a05('0x4e')]=_[_0x5a05('0x4d')](_0x3953cc[_0x5a05('0x48')],qs['fields'](_0x23a886[_0x5a05('0x4a')][_0x5a05('0x4f')]));_0x2e1a7d['attributes']=_0x2e1a7d[_0x5a05('0x4e')]['length']?_0x2e1a7d[_0x5a05('0x4e')]:_0x3953cc[_0x5a05('0x48')];if(!_0x23a886[_0x5a05('0x4a')][_0x5a05('0x73')](_0x5a05('0x51'))){_0x2e1a7d[_0x5a05('0x33')]=qs['limit'](_0x23a886[_0x5a05('0x4a')][_0x5a05('0x33')]);_0x2e1a7d[_0x5a05('0x31')]=qs[_0x5a05('0x31')](_0x23a886[_0x5a05('0x4a')][_0x5a05('0x31')]);}_0x2e1a7d[_0x5a05('0xc5')]=qs['sort'](_0x23a886[_0x5a05('0x4a')]['sort']);_0x2e1a7d[_0x5a05('0x53')]=qs['filters'](_[_0x5a05('0x6c')](_0x23a886[_0x5a05('0x4a')],_0x3953cc['filters']));_0x2e1a7d[_0x5a05('0x53')]['SmsAccountId']=_0x28322c['id'];if(_0x23a886['query'][_0x5a05('0x55')]){_0x2e1a7d[_0x5a05('0x53')]=_[_0x5a05('0x6d')](_0x2e1a7d[_0x5a05('0x53')],{'$or':_['map'](_0x2e1a7d[_0x5a05('0x4e')],function(_0x24fe31){var _0x3b2d7c={};_0x3b2d7c[_0x24fe31]={'$like':'%'+_0x23a886[_0x5a05('0x4a')][_0x5a05('0x55')]+'%'};return _0x3b2d7c;})});}_0x2e1a7d=_[_0x5a05('0x6d')]({},_0x2e1a7d,_0x23a886[_0x5a05('0x56')]);return db['SmsInteraction'][_0x5a05('0x34')]({'where':_0x2e1a7d[_0x5a05('0x53')]})[_0x5a05('0x24')](function(_0x1dddbd){_0x2da34e[_0x5a05('0x34')]=_0x1dddbd;if(_0x23a886[_0x5a05('0x4a')]['includeAll']){_0x2e1a7d[_0x5a05('0x5c')]=[{'model':db[_0x5a05('0x7e')],'as':_0x5a05('0xc7'),'required':![]},{'model':db[_0x5a05('0xb2')],'as':_0x5a05('0xc8'),'attributes':['name',_0x5a05('0xc9'),'internal'],'required':![]},{'model':db[_0x5a05('0xca')],'as':'Tags','attributes':['id','name',_0x5a05('0xcb')],'where':_0x23a886[_0x5a05('0x4a')][_0x5a05('0xcc')]?{'id':_0x23a886[_0x5a05('0x4a')][_0x5a05('0xcc')]}:undefined,'required':_0x23a886[_0x5a05('0x4a')][_0x5a05('0xcc')]?!![]:![]}];}return db[_0x5a05('0xa5')][_0x5a05('0x58')](_0x2e1a7d);})['then'](function(_0x1b2b0b){_0x2da34e[_0x5a05('0x59')]=_0x1b2b0b;return _0x2da34e;});}})[_0x5a05('0x24')](respondWithFilteredResult(_0x495d91,_0x2e1a7d))[_0x5a05('0x5a')](handleError(_0x495d91,null));};exports[_0x5a05('0x3f')]=function(_0x3ee022,_0x1f466e,_0x8e9b7e){var _0x2095fd,_0x107ced,_0x49f2bb;if(_[_0x5a05('0x99')](_0x3ee022['body'][_0x5a05('0x5f')])||_0x3ee022[_0x5a05('0x5f')][_0x5a05('0x5f')]===''){throw new db['Sequelize'][(_0x5a05('0x80'))](_0x5a05('0x9b'));}if(_[_0x5a05('0x99')](_0x3ee022[_0x5a05('0x5f')]['to'])){throw new db[(_0x5a05('0x7f'))]['ValidationError']('to\x20is\x20mandatory');}_0x2095fd=_0x3ee022[_0x5a05('0x5f')]['to'];return db['SmsAccount']['find']({'where':{'id':_0x3ee022['params']['id']},'include':[{'model':db[_0x5a05('0x9f')],'as':_0x5a05('0xcd'),'include':[{'model':db[_0x5a05('0x7e')],'as':'Contacts','where':{'mobile':_0x2095fd},'limit':0x1,'order':[[_0x5a05('0xa0'),_0x5a05('0xa1')]]}]}]})[_0x5a05('0x24')](handleEntityNotFound(_0x1f466e,null))[_0x5a05('0x24')](function(_0x5da6be){if(_0x5da6be&&_0x5da6be[_0x5a05('0xcd')]){_0x107ced=_0x5da6be[_0x5a05('0x39')]({'plain':!![]});if(_0x107ced[_0x5a05('0xcd')]&&_0x107ced[_0x5a05('0xcd')][_0x5a05('0xa3')][_0x5a05('0x50')]){return _0x107ced[_0x5a05('0xcd')]['Contacts'][0x0];}return db[_0x5a05('0x7e')][_0x5a05('0x5e')](_[_0x5a05('0x1a')](_0x3ee022[_0x5a05('0x5f')],{'firstName':_0x2095fd,'mobile':_0x2095fd,'phone':_0x2095fd,'ListId':_0x107ced[_0x5a05('0x83')]}));}})['then'](handleEntityNotFound(_0x1f466e,null))[_0x5a05('0x24')](function(_0xaf3f5c){if(_0xaf3f5c){_0x49f2bb=_0xaf3f5c;return db[_0x5a05('0xa5')]['find']({'where':{'ContactId':_0x49f2bb['id'],'closed':![],'SmsAccountId':_0x107ced['id']}})['then'](function(_0x395abd){if(_0x395abd){return[_0x395abd,![]];}return db[_0x5a05('0xa5')][_0x5a05('0x5e')]({'UserId':_0x3ee022[_0x5a05('0x60')]['id'],'ContactId':_0x49f2bb['id'],'SmsAccountId':_0x107ced['id'],'phone':_0x2095fd,'firstMsgDirection':_0x5a05('0xce'),'Messages':[_[_0x5a05('0x6d')](_0x3ee022[_0x5a05('0x5f')],{'read':![],'body':_0x3ee022['body'][_0x5a05('0x5f')],'phone':_0x2095fd,'SmsAccountId':_0x107ced['id'],'UserId':_0x3ee022[_0x5a05('0x60')]['id'],'ContactId':_0x49f2bb['id']})]},{'include':[{'model':db[_0x5a05('0xae')],'as':_0x5a05('0xcf')}]})['then'](function(_0x59da1d){return[_0x59da1d,!![]];});});}})[_0x5a05('0xa6')](function(_0x6e974c,_0x33f3c7){if(_0x33f3c7){return _0x6e974c;}return db[_0x5a05('0xae')][_0x5a05('0x5e')](_[_0x5a05('0x6d')](_0x3ee022[_0x5a05('0x5f')],{'read':![],'body':_0x3ee022['body'][_0x5a05('0x5f')],'phone':_0x2095fd,'SmsAccountId':_0x107ced['id'],'SmsInteractionId':_0x6e974c['id'],'UserId':_0x3ee022['user']['id'],'ContactId':_0x49f2bb['id']}))[_0x5a05('0x24')](function(_0x2a96e0){_0x6e974c[_0x5a05('0xd0')][_0x5a05('0xcf')]=[];_0x6e974c[_0x5a05('0xd0')][_0x5a05('0xcf')][_0x5a05('0xab')](_0x2a96e0[_0x5a05('0xd0')]);return _0x6e974c;});})[_0x5a05('0x24')](respondWithResult(_0x1f466e,null))[_0x5a05('0x5a')](handleError(_0x1f466e,null));};exports['status']=function(_0x2123d3,_0x34438c,_0x47aa9f){if(_0x2123d3[_0x5a05('0x5f')]['id']){delete _0x2123d3[_0x5a05('0x5f')]['id'];}var _0x3e865d,_0x4d5a52,_0x405b87;return db['SmsAccount'][_0x5a05('0x5d')]({'where':{'id':_0x2123d3[_0x5a05('0x5b')]['id']}})[_0x5a05('0x24')](handleEntityNotFound(_0x34438c,null))[_0x5a05('0x24')](function(_0x3b2d7f){if(_0x3b2d7f){_0x405b87=_0x3b2d7f;logger[_0x5a05('0xd1')](_0x5a05('0x27'),_0x5a05('0x2e'),_0x5a05('0xd2'),_0x3b2d7f[_0x5a05('0x46')],util[_0x5a05('0xd3')](_0x2123d3[_0x5a05('0x5f')],{'showHidden':![],'depth':null}));switch(_0x3b2d7f[_0x5a05('0x46')]){case'skebby':if(_0x2123d3['body'][_0x5a05('0xd4')]&&_0x2123d3[_0x5a05('0x5f')][_0x5a05('0x2e')]){_0x4d5a52=_0x2123d3[_0x5a05('0x5f')][_0x5a05('0x2e')];return db[_0x5a05('0xae')][_0x5a05('0x5d')]({'where':{'messageId':_0x2123d3['body'][_0x5a05('0xd4')]}});}break;case _0x5a05('0xd5'):if(_0x2123d3[_0x5a05('0x5f')][_0x5a05('0xd6')]&&_0x2123d3[_0x5a05('0x5f')][_0x5a05('0xd7')]){_0x4d5a52=_0x2123d3[_0x5a05('0x5f')][_0x5a05('0xd7')];return db[_0x5a05('0xae')][_0x5a05('0x5d')]({'where':{'messageId':_0x2123d3[_0x5a05('0x5f')]['requestid']}});}break;case _0x5a05('0x8d'):if(_0x2123d3[_0x5a05('0x5f')]['message_id']&&_0x2123d3[_0x5a05('0x5f')][_0x5a05('0xd8')]){_0x4d5a52=_0x2123d3[_0x5a05('0x5f')]['status_code'];return db['SmsMessage'][_0x5a05('0x5d')]({'where':{'messageId':_0x2123d3['body'][_0x5a05('0x8e')]}});}break;case _0x5a05('0xd9'):var _0x2341a1=_0x2123d3['body']['results'][0x0];if(_0x2341a1[_0x5a05('0x88')]&&_0x2341a1[_0x5a05('0x2e')][_0x5a05('0xda')]==='DELIVERED'){_0x4d5a52=_0x2341a1['status'][_0x5a05('0xda')];return db[_0x5a05('0xae')][_0x5a05('0x5d')]({'where':{'messageId':_0x2341a1[_0x5a05('0x88')]}});}break;case _0x5a05('0x94'):if(_0x2123d3[_0x5a05('0x5f')]['messageId']&&_0x2123d3[_0x5a05('0x5f')][_0x5a05('0x2e')]){_0x4d5a52=_0x2123d3[_0x5a05('0x5f')][_0x5a05('0x2e')];return db['SmsMessage'][_0x5a05('0x5d')]({'where':{'messageId':_0x2123d3[_0x5a05('0x5f')]['messageId']}});}break;case _0x5a05('0xdb'):if(_0x2123d3[_0x5a05('0x5f')][0x0][_0x5a05('0x2b')]['id']){_0x4d5a52=_0x2123d3[_0x5a05('0x5f')][0x0][_0x5a05('0x46')];return db['SmsMessage'][_0x5a05('0x5d')]({'where':{'messageId':_0x2123d3[_0x5a05('0x5f')][0x0]['message']['id']}});}break;case _0x5a05('0x97'):if(_0x2123d3['body'][_0x5a05('0xdc')]&&_0x2123d3[_0x5a05('0x5f')][_0x5a05('0x2e')]){_0x4d5a52=_0x2123d3['body'][_0x5a05('0x2e')];return db['SmsMessage'][_0x5a05('0x5d')]({'where':{'messageId':_0x2123d3[_0x5a05('0x5f')][_0x5a05('0xdc')]}});}break;}}})[_0x5a05('0x24')](handleEntityNotFound(_0x34438c,null))[_0x5a05('0x24')](function(_0x596079){if(_0x596079){_0x3e865d=_0x596079;switch(_0x405b87[_0x5a05('0x46')]){case _0x5a05('0xdd'):if(_0x4d5a52===_0x5a05('0xde')){return _0x3e865d[_0x5a05('0x38')]({'read':!![]});}else{logger[_0x5a05('0x28')](_0x5a05('0x27'),_0x5a05('0x2e'),'skebby',util[_0x5a05('0xd3')](_0x2123d3[_0x5a05('0x5f')],{'showHidden':![],'depth':null}));}break;case _0x5a05('0xd5'):if(_0x4d5a52==='1'){return _0x3e865d[_0x5a05('0x38')]({'read':!![]});}else{logger[_0x5a05('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x5a05('0xdd'),util[_0x5a05('0xd3')](_0x2123d3[_0x5a05('0x5f')],{'showHidden':![],'depth':null}));}break;case _0x5a05('0x8d'):if(!_0x2123d3[_0x5a05('0x5f')][_0x5a05('0xdf')]&&_0x4d5a52>=0xc8&&_0x4d5a52<=0xce){return _0x3e865d[_0x5a05('0x38')]({'read':!![]});}else{logger[_0x5a05('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x5a05('0x2e'),'clicksend',util[_0x5a05('0xd3')](_0x2123d3[_0x5a05('0x5f')],{'showHidden':![],'depth':null}));}break;case _0x5a05('0xd9'):var _0x429a86=_0x2123d3[_0x5a05('0x5f')][_0x5a05('0x90')][0x0];if(_0x429a86[_0x5a05('0x2e')][_0x5a05('0xda')]===_0x5a05('0xde')){return _0x3e865d[_0x5a05('0x38')]({'read':!![]});}else{logger[_0x5a05('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x5a05('0xd9'),util[_0x5a05('0xd3')](_0x2123d3['body'],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x4d5a52==_0x5a05('0xe0')||_0x4d5a52==_0x5a05('0xe1')){return _0x3e865d[_0x5a05('0x38')]({'read':!![]});}else{logger[_0x5a05('0x28')](_0x5a05('0x27'),_0x5a05('0x2e'),'clickatell',util[_0x5a05('0xd3')](_0x2123d3[_0x5a05('0x5f')],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0x4d5a52==_0x5a05('0xe2')){return _0x3e865d['update']({'read':!![]});}else{logger[_0x5a05('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x5a05('0xdb'),util['inspect'](_0x2123d3[_0x5a05('0x5f')],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x4d5a52===_0x5a05('0xe3')||_0x4d5a52===_0x5a05('0xe4')){return _0x3e865d[_0x5a05('0x38')]({'read':!![]});}else{logger[_0x5a05('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x5a05('0x2e'),'intelepeer',util['inspect'](_0x2123d3[_0x5a05('0x5f')],{'showHidden':![],'depth':null}));}break;}return _0x3e865d;}})[_0x5a05('0x24')](respondWithResult(_0x34438c,null))[_0x5a05('0x5a')](handleError(_0x34438c,null));};exports['statusGet']=function(_0x12ba46,_0x5c06e5,_0x6b0185){var _0x1c5929,_0xba0cef,_0x2b54c2;return db[_0x5a05('0x43')]['find']({'where':{'id':_0x12ba46['params']['id']}})[_0x5a05('0x24')](handleEntityNotFound(_0x5c06e5,null))[_0x5a05('0x24')](function(_0x493e22){if(_0x493e22){_0x2b54c2=_0x493e22;logger['debug'](_0x5a05('0x27'),_0x5a05('0x2e'),'received\x20delivery\x20report\x20from',_0x493e22[_0x5a05('0x46')],util['inspect'](_0x12ba46[_0x5a05('0x4a')],{'showHidden':![],'depth':null}));switch(_0x493e22[_0x5a05('0x46')]){case'csc':if(_0x12ba46[_0x5a05('0x4a')]['message-id']&&_0x12ba46[_0x5a05('0x4a')][_0x5a05('0xe5')]){_0xba0cef=_0x12ba46[_0x5a05('0x4a')]['state'];return db[_0x5a05('0xae')][_0x5a05('0x5d')]({'where':{'messageId':_0x12ba46[_0x5a05('0x4a')][_0x5a05('0xe6')]}});}break;}}})[_0x5a05('0x24')](handleEntityNotFound(_0x5c06e5,null))['then'](function(_0x1d55e3){if(_0x1d55e3){_0x1c5929=_0x1d55e3;switch(_0x2b54c2[_0x5a05('0x46')]){case _0x5a05('0x91'):if(_0xba0cef==='2'||_0xba0cef==='6'){return _0x1c5929['update']({'read':!![]});}else{logger[_0x5a05('0x28')](_0x5a05('0x27'),_0x5a05('0x2e'),'csc',util[_0x5a05('0xd3')](_0x12ba46[_0x5a05('0x4a')],{'showHidden':![],'depth':null}));};break;}return _0x1c5929;}})[_0x5a05('0x24')](respondWithResult(_0x5c06e5,null))[_0x5a05('0x5a')](handleError(_0x5c06e5,null));};exports[_0x5a05('0xe7')]=function(_0x3aac0e,_0x424e59,_0x5ee69f){return db[_0x5a05('0x43')][_0x5a05('0x5d')]({'where':{'id':_0x3aac0e[_0x5a05('0x5b')]['id']}})[_0x5a05('0x24')](handleEntityNotFound(_0x424e59,null))['then'](function(_0x355296){if(_0x355296){return _0x355296['addAgents'](_0x3aac0e[_0x5a05('0x5f')][_0x5a05('0x75')],_[_0x5a05('0xa2')](_0x3aac0e[_0x5a05('0x5f')],[_0x5a05('0x75'),'id'])||{})[_0x5a05('0xa6')](function(_0x31c2bc){for(var _0x13dc11=0x0;_0x13dc11<_0x3aac0e[_0x5a05('0x5f')][_0x5a05('0x75')][_0x5a05('0x50')];_0x13dc11+=0x1){socket['emit'](_0x5a05('0xe8'),{'UserId':Number(_0x3aac0e[_0x5a05('0x5f')][_0x5a05('0x75')][_0x13dc11]),'SmsAccountId':Number(_0x3aac0e[_0x5a05('0x5b')]['id'])});}return _0x31c2bc;});}})[_0x5a05('0x24')](respondWithResult(_0x424e59,null))[_0x5a05('0x5a')](handleError(_0x424e59,null));};exports['removeAgents']=function(_0x2f0c5b,_0x58410c,_0x559fcb){return db[_0x5a05('0x43')][_0x5a05('0x5d')]({'where':{'id':_0x2f0c5b[_0x5a05('0x5b')]['id']}})[_0x5a05('0x24')](handleEntityNotFound(_0x58410c,null))[_0x5a05('0x24')](function(_0x366360){if(_0x366360){return _0x366360['removeAgents'](_0x2f0c5b[_0x5a05('0x4a')][_0x5a05('0x75')])['then'](function(){if(_[_0x5a05('0xe9')](_0x2f0c5b[_0x5a05('0x4a')][_0x5a05('0x75')])){for(var _0x323906=0x0;_0x323906<_0x2f0c5b['query'][_0x5a05('0x75')][_0x5a05('0x50')];_0x323906+=0x1){socket['emit'](_0x5a05('0xea'),{'UserId':Number(_0x2f0c5b['query'][_0x5a05('0x75')][_0x323906]),'SmsAccountId':Number(_0x2f0c5b[_0x5a05('0x5b')]['id'])});}}else{socket[_0x5a05('0xeb')](_0x5a05('0xea'),{'UserId':Number(_0x2f0c5b[_0x5a05('0x4a')]['ids']),'SmsAccountId':Number(_0x2f0c5b['params']['id'])});}});}})['then'](respondWithStatusCode(_0x58410c,null))['catch'](handleError(_0x58410c,null));};exports[_0x5a05('0xec')]=function(_0x32b592,_0x32e6cb,_0x339e26){var _0x5c4635={};var _0x103464={};var _0x4fa88f;var _0x100059;return db[_0x5a05('0x43')]['findOne']({'where':{'id':_0x32b592[_0x5a05('0x5b')]['id']}})[_0x5a05('0x24')](handleEntityNotFound(_0x32e6cb,null))['then'](function(_0x4a186b){if(_0x4a186b){_0x4fa88f=_0x4a186b;_0x103464[_0x5a05('0x48')]=_[_0x5a05('0x4b')](db[_0x5a05('0xb2')][_0x5a05('0x44')]);_0x103464['query']=_[_0x5a05('0x4b')](_0x32b592[_0x5a05('0x4a')]);_0x103464['filters']=_[_0x5a05('0x4d')](_0x103464[_0x5a05('0x48')],_0x103464[_0x5a05('0x4a')]);_0x5c4635['attributes']=_[_0x5a05('0x4d')](_0x103464[_0x5a05('0x48')],qs[_0x5a05('0x4f')](_0x32b592['query'][_0x5a05('0x4f')]));_0x5c4635['attributes']=_0x5c4635[_0x5a05('0x4e')][_0x5a05('0x50')]?_0x5c4635['attributes']:_0x103464[_0x5a05('0x48')];_0x5c4635[_0x5a05('0xc5')]=qs[_0x5a05('0x52')](_0x32b592[_0x5a05('0x4a')][_0x5a05('0x52')]);_0x5c4635[_0x5a05('0x53')]=qs[_0x5a05('0x4c')](_['pick'](_0x32b592[_0x5a05('0x4a')],_0x103464['filters']));if(_0x32b592['query'][_0x5a05('0x55')]){_0x5c4635[_0x5a05('0x53')]=_[_0x5a05('0x6d')](_0x5c4635[_0x5a05('0x53')],{'$or':_[_0x5a05('0x49')](_0x5c4635[_0x5a05('0x4e')],function(_0x204427){var _0x424699={};_0x424699[_0x204427]={'$like':'%'+_0x32b592[_0x5a05('0x4a')][_0x5a05('0x55')]+'%'};return _0x424699;})});}_0x5c4635=_['merge']({},_0x5c4635,_0x32b592[_0x5a05('0x56')]);return _0x4fa88f['getAgents'](_0x5c4635);}})[_0x5a05('0x24')](function(_0x1c79bc){if(_0x1c79bc){_0x100059=_0x1c79bc[_0x5a05('0x50')];if(!_0x32b592['query'][_0x5a05('0x73')](_0x5a05('0x51'))){_0x5c4635['limit']=qs[_0x5a05('0x33')](_0x32b592[_0x5a05('0x4a')]['limit']);_0x5c4635[_0x5a05('0x31')]=qs[_0x5a05('0x31')](_0x32b592[_0x5a05('0x4a')]['offset']);}return _0x4fa88f[_0x5a05('0xec')](_0x5c4635);}})[_0x5a05('0x24')](function(_0x48c0d9){if(_0x48c0d9){return _0x48c0d9?{'count':_0x100059,'rows':_0x48c0d9}:null;}})[_0x5a05('0x24')](respondWithResult(_0x32e6cb,null))['catch'](handleError(_0x32e6cb,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 360160b..78bf66c 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 _0xeb2d=['emit','hook','exports','../../mysqldb','SmsAccount','setMaxListeners','save','update','remove'];(function(_0x313e3d,_0x2d149f){var _0x3989d0=function(_0x91af6a){while(--_0x91af6a){_0x313e3d['push'](_0x313e3d['shift']());}};_0x3989d0(++_0x2d149f);}(_0xeb2d,0xb7));var _0xdeb2=function(_0x34a71e,_0x2194a3){_0x34a71e=_0x34a71e-0x0;var _0x398769=_0xeb2d[_0x34a71e];return _0x398769;};'use strict';var EventEmitter=require('events');var SmsAccount=require(_0xdeb2('0x0'))['db'][_0xdeb2('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xdeb2('0x2')](0x0);var events={'afterCreate':_0xdeb2('0x3'),'afterUpdate':_0xdeb2('0x4'),'afterDestroy':_0xdeb2('0x5')};function emitEvent(_0x23cbdc){return function(_0x5f632,_0x313bbb,_0x3c066e){SmsAccountEvents[_0xdeb2('0x6')](_0x23cbdc+':'+_0x5f632['id'],_0x5f632);SmsAccountEvents[_0xdeb2('0x6')](_0x23cbdc,_0x5f632);_0x3c066e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount[_0xdeb2('0x7')](e,emitEvent(event));}}module[_0xdeb2('0x8')]=SmsAccountEvents; \ No newline at end of file +var _0xe1f0=['events','../../mysqldb','SmsAccount','setMaxListeners','update','remove','emit','hook'];(function(_0x38a660,_0x3a6593){var _0x5a601c=function(_0x2190a8){while(--_0x2190a8){_0x38a660['push'](_0x38a660['shift']());}};_0x5a601c(++_0x3a6593);}(_0xe1f0,0x108));var _0x0e1f=function(_0x1a9233,_0x4d83fd){_0x1a9233=_0x1a9233-0x0;var _0xbb4739=_0xe1f0[_0x1a9233];return _0xbb4739;};'use strict';var EventEmitter=require(_0x0e1f('0x0'));var SmsAccount=require(_0x0e1f('0x1'))['db'][_0x0e1f('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x0e1f('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0e1f('0x4'),'afterDestroy':_0x0e1f('0x5')};function emitEvent(_0x2473ca){return function(_0x39a83f,_0x31fac9,_0x19e6b8){SmsAccountEvents[_0x0e1f('0x6')](_0x2473ca+':'+_0x39a83f['id'],_0x39a83f);SmsAccountEvents[_0x0e1f('0x6')](_0x2473ca,_0x39a83f);_0x19e6b8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount[_0x0e1f('0x7')](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 b8990ff..315fe1e 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 _0x28f7=['SmsAccount','lodash','util','api','bluebird','request-promise','rimraf','./smsAccount.attributes','exports','define'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x28f7,0x141));var _0x728f=function(_0x41e718,_0x39b86f){_0x41e718=_0x41e718-0x0;var _0x330585=_0x28f7[_0x41e718];return _0x330585;};'use strict';var _=require(_0x728f('0x0'));var util=require(_0x728f('0x1'));var logger=require('../../config/logger')(_0x728f('0x2'));var moment=require('moment');var BPromise=require(_0x728f('0x3'));var rp=require(_0x728f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x728f('0x5'));var config=require('../../config/environment');var attributes=require(_0x728f('0x6'));module[_0x728f('0x7')]=function(_0x101b76,_0x4a463f){return _0x101b76[_0x728f('0x8')](_0x728f('0x9'),attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6d6f=['exports','define','SmsAccount','util','../../config/logger','api','moment','bluebird','request-promise','path','./smsAccount.attributes'];(function(_0x17a61e,_0x513c78){var _0x1bc283=function(_0x54c1a3){while(--_0x54c1a3){_0x17a61e['push'](_0x17a61e['shift']());}};_0x1bc283(++_0x513c78);}(_0x6d6f,0xea));var _0xf6d6=function(_0x247fa1,_0x4ec37c){_0x247fa1=_0x247fa1-0x0;var _0x244f35=_0x6d6f[_0x247fa1];return _0x244f35;};'use strict';var _=require('lodash');var util=require(_0xf6d6('0x0'));var logger=require(_0xf6d6('0x1'))(_0xf6d6('0x2'));var moment=require(_0xf6d6('0x3'));var BPromise=require(_0xf6d6('0x4'));var rp=require(_0xf6d6('0x5'));var fs=require('fs');var path=require(_0xf6d6('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf6d6('0x7'));module[_0xf6d6('0x8')]=function(_0x2a25f6,_0x3c537f){return _0x2a25f6[_0xf6d6('0x9')](_0xf6d6('0xa'),attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index 5066bd2..7f1d718 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 _0xda6e=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','defaults','redis','localhost','./smsAccount.socket','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','SmsAccount','find','raw','options','where','include','map','model','attributes','ShowSmsAccount','catch','util','bluebird','randomstring','ioredis'];(function(_0xb31f66,_0x2a0fa4){var _0x9634b0=function(_0x11d6ae){while(--_0x11d6ae){_0xb31f66['push'](_0xb31f66['shift']());}};_0x9634b0(++_0x2a0fa4);}(_0xda6e,0x124));var _0xeda6=function(_0x732635,_0x1f1c24){_0x732635=_0x732635-0x0;var _0x4b6fff=_0xda6e[_0x732635];return _0x4b6fff;};'use strict';var _=require('lodash');var util=require(_0xeda6('0x0'));var moment=require('moment');var BPromise=require(_0xeda6('0x1'));var rs=require(_0xeda6('0x2'));var fs=require('fs');var Redis=require(_0xeda6('0x3'));var db=require(_0xeda6('0x4'))['db'];var utils=require(_0xeda6('0x5'));var logger=require(_0xeda6('0x6'))('rpc');var config=require(_0xeda6('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xeda6('0x8')][_0xeda6('0x9')]({'port':0x232a});config['redis']=_[_0xeda6('0xa')](config[_0xeda6('0xb')],{'host':_0xeda6('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xeda6('0xb')]));require(_0xeda6('0xd'))['register'](socket);function respondWithRpcPromise(_0x2f4dc9,_0xab8fc6,_0x1adeda){return new BPromise(function(_0x1dd414,_0x5de411){return client[_0xeda6('0xe')](_0x2f4dc9,_0x1adeda)[_0xeda6('0xf')](function(_0x717a76){logger[_0xeda6('0x10')](_0xeda6('0x11'),_0xab8fc6,_0xeda6('0x12'));logger[_0xeda6('0x13')](_0xeda6('0x14'),_0xab8fc6,_0xeda6('0x12'),JSON[_0xeda6('0x15')](_0x717a76));if(_0x717a76['error']){if(_0x717a76[_0xeda6('0x16')][_0xeda6('0x17')]===0x1f4){logger['error'](_0xeda6('0x11'),_0xab8fc6,_0x717a76[_0xeda6('0x16')][_0xeda6('0x18')]);return _0x5de411(_0x717a76[_0xeda6('0x16')][_0xeda6('0x18')]);}logger['error'](_0xeda6('0x11'),_0xab8fc6,_0x717a76[_0xeda6('0x16')][_0xeda6('0x18')]);return _0x1dd414(_0x717a76[_0xeda6('0x16')]['message']);}else{logger[_0xeda6('0x10')](_0xeda6('0x11'),_0xab8fc6,_0xeda6('0x12'));_0x1dd414(_0x717a76[_0xeda6('0x19')][_0xeda6('0x18')]);}})['catch'](function(_0x42638c){logger[_0xeda6('0x16')](_0xeda6('0x11'),_0xab8fc6,_0x42638c);_0x5de411(_0x42638c);});});}exports['ShowSmsAccount']=function(_0x205ca2){var _0x1928c3=this;return new Promise(function(_0x1e7df6,_0x3bb3b6){return db[_0xeda6('0x1a')][_0xeda6('0x1b')]({'raw':_0x205ca2['options']?_0x205ca2['options'][_0xeda6('0x1c')]===undefined?!![]:![]:!![],'where':_0x205ca2[_0xeda6('0x1d')]?_0x205ca2[_0xeda6('0x1d')][_0xeda6('0x1e')]||null:null,'attributes':_0x205ca2[_0xeda6('0x1d')]?_0x205ca2[_0xeda6('0x1d')]['attributes']||null:null,'include':_0x205ca2[_0xeda6('0x1d')]?_0x205ca2[_0xeda6('0x1d')][_0xeda6('0x1f')]?_[_0xeda6('0x20')](_0x205ca2[_0xeda6('0x1d')][_0xeda6('0x1f')],function(_0x13625b){return{'model':db[_0x13625b[_0xeda6('0x21')]],'as':_0x13625b['as'],'attributes':_0x13625b[_0xeda6('0x22')],'include':_0x13625b[_0xeda6('0x1f')]?_[_0xeda6('0x20')](_0x13625b[_0xeda6('0x1f')],function(_0x3f2575){return{'model':db[_0x3f2575[_0xeda6('0x21')]],'as':_0x3f2575['as'],'attributes':_0x3f2575['attributes'],'include':_0x3f2575[_0xeda6('0x1f')]?_[_0xeda6('0x20')](_0x3f2575[_0xeda6('0x1f')],function(_0x19dcd7){return{'model':db[_0x19dcd7[_0xeda6('0x21')]],'as':_0x19dcd7['as'],'attributes':_0x19dcd7[_0xeda6('0x22')]};}):[]};}):[]};}):[]:[]})[_0xeda6('0xf')](function(_0x553967){logger['info'](_0xeda6('0x23'),_0x205ca2);logger[_0xeda6('0x13')](_0xeda6('0x23'),_0x205ca2,JSON[_0xeda6('0x15')](_0x553967));_0x1e7df6(_0x553967);})[_0xeda6('0x24')](function(_0x2a33e7){logger[_0xeda6('0x16')](_0xeda6('0x23'),_0x2a33e7[_0xeda6('0x18')],_0x205ca2);_0x3bb3b6(_0x1928c3['error'](0x1f4,_0x2a33e7[_0xeda6('0x18')]));});});}; \ No newline at end of file +var _0x776a=['./smsAccount.socket','request','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error','message','SmsAccount','find','raw','options','attributes','map','model','include','then','ShowSmsAccount','stringify','catch','lodash','util','moment','bluebird','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x2e5f9c,_0x134a52){var _0x538b44=function(_0x38ef13){while(--_0x38ef13){_0x2e5f9c['push'](_0x2e5f9c['shift']());}};_0x538b44(++_0x134a52);}(_0x776a,0x1f1));var _0xa776=function(_0x51c398,_0x252d11){_0x51c398=_0x51c398-0x0;var _0x2bf9e8=_0x776a[_0x51c398];return _0x2bf9e8;};'use strict';var _=require(_0xa776('0x0'));var util=require(_0xa776('0x1'));var moment=require(_0xa776('0x2'));var BPromise=require(_0xa776('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(_0xa776('0x4'))(_0xa776('0x5'));var config=require('../../config/environment');var jayson=require(_0xa776('0x6'));var client=jayson[_0xa776('0x7')][_0xa776('0x8')]({'port':0x232a});config[_0xa776('0x9')]=_[_0xa776('0xa')](config[_0xa776('0x9')],{'host':_0xa776('0xb'),'port':0x18eb});var socket=require(_0xa776('0xc'))(new Redis(config[_0xa776('0x9')]));require(_0xa776('0xd'))['register'](socket);function respondWithRpcPromise(_0x2c8824,_0x161ce2,_0x379ea5){return new BPromise(function(_0x4e4c29,_0x4dbf5c){return client[_0xa776('0xe')](_0x2c8824,_0x379ea5)['then'](function(_0x2a915e){logger[_0xa776('0xf')](_0xa776('0x10'),_0x161ce2,_0xa776('0x11'));logger[_0xa776('0x12')](_0xa776('0x13'),_0x161ce2,'request\x20sent',JSON['stringify'](_0x2a915e));if(_0x2a915e['error']){if(_0x2a915e[_0xa776('0x14')]['code']===0x1f4){logger[_0xa776('0x14')]('SmsAccount,\x20%s,\x20%s',_0x161ce2,_0x2a915e[_0xa776('0x14')][_0xa776('0x15')]);return _0x4dbf5c(_0x2a915e[_0xa776('0x14')]['message']);}logger[_0xa776('0x14')]('SmsAccount,\x20%s,\x20%s',_0x161ce2,_0x2a915e[_0xa776('0x14')]['message']);return _0x4e4c29(_0x2a915e['error'][_0xa776('0x15')]);}else{logger[_0xa776('0xf')](_0xa776('0x10'),_0x161ce2,_0xa776('0x11'));_0x4e4c29(_0x2a915e['result']['message']);}})['catch'](function(_0x368ec8){logger['error']('SmsAccount,\x20%s,\x20%s',_0x161ce2,_0x368ec8);_0x4dbf5c(_0x368ec8);});});}exports['ShowSmsAccount']=function(_0x195f7e){var _0x5e15c8=this;return new Promise(function(_0x3e34c0,_0x46b17e){return db[_0xa776('0x16')][_0xa776('0x17')]({'raw':_0x195f7e['options']?_0x195f7e['options'][_0xa776('0x18')]===undefined?!![]:![]:!![],'where':_0x195f7e[_0xa776('0x19')]?_0x195f7e[_0xa776('0x19')]['where']||null:null,'attributes':_0x195f7e[_0xa776('0x19')]?_0x195f7e['options'][_0xa776('0x1a')]||null:null,'include':_0x195f7e[_0xa776('0x19')]?_0x195f7e[_0xa776('0x19')]['include']?_[_0xa776('0x1b')](_0x195f7e['options']['include'],function(_0x36d80b){return{'model':db[_0x36d80b[_0xa776('0x1c')]],'as':_0x36d80b['as'],'attributes':_0x36d80b[_0xa776('0x1a')],'include':_0x36d80b[_0xa776('0x1d')]?_[_0xa776('0x1b')](_0x36d80b[_0xa776('0x1d')],function(_0x1db731){return{'model':db[_0x1db731[_0xa776('0x1c')]],'as':_0x1db731['as'],'attributes':_0x1db731[_0xa776('0x1a')],'include':_0x1db731[_0xa776('0x1d')]?_[_0xa776('0x1b')](_0x1db731[_0xa776('0x1d')],function(_0x48ca90){return{'model':db[_0x48ca90[_0xa776('0x1c')]],'as':_0x48ca90['as'],'attributes':_0x48ca90['attributes']};}):[]};}):[]};}):[]:[]})[_0xa776('0x1e')](function(_0x3a6aac){logger[_0xa776('0xf')](_0xa776('0x1f'),_0x195f7e);logger[_0xa776('0x12')](_0xa776('0x1f'),_0x195f7e,JSON[_0xa776('0x20')](_0x3a6aac));_0x3e34c0(_0x3a6aac);})[_0xa776('0x21')](function(_0x9e9099){logger['error'](_0xa776('0x1f'),_0x9e9099['message'],_0x195f7e);_0x46b17e(_0x5e15c8[_0xa776('0x14')](0x1f4,_0x9e9099[_0xa776('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 3dedf43..86f8d74 100644 --- a/server/api/smsAccount/smsAccount.socket.js +++ b/server/api/smsAccount/smsAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'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(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'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 e1a9467..bd36950 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 _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x387777,_0x356171){var _0x3f84c0=function(_0x4d4423){while(--_0x4d4423){_0x387777['push'](_0x387777['shift']());}};_0x3f84c0(++_0x356171);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file +var _0x008c=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','post','put','/:id'];(function(_0x43f1e8,_0x58493b){var _0x141fae=function(_0x448722){while(--_0x448722){_0x43f1e8['push'](_0x43f1e8['shift']());}};_0x141fae(++_0x58493b);}(_0x008c,0x188));var _0xc008=function(_0x11dfbb,_0x1f4c8a){_0x11dfbb=_0x11dfbb-0x0;var _0x22d016=_0x008c[_0x11dfbb];return _0x22d016;};'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('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc008('0xe')](_0xc008('0xf'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xc008('0xf'),auth[_0xc008('0xb')](),controller['destroy']);module[_0xc008('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 0cac7ef..ebbf4cf 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 _0xb836=['INTEGER','STRING','noop','TEXT','exports'];(function(_0x206d06,_0x4962bc){var _0x21505f=function(_0x20bc21){while(--_0x20bc21){_0x206d06['push'](_0x206d06['shift']());}};_0x21505f(++_0x4962bc);}(_0xb836,0x153));var _0x6b83=function(_0x362b59,_0x31ce8f){_0x362b59=_0x362b59-0x0;var _0x3016b2=_0xb836[_0x362b59];return _0x3016b2;};'use strict';var Sequelize=require('sequelize');module[_0x6b83('0x0')]={'priority':{'type':Sequelize[_0x6b83('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x6b83('0x2')],'allowNull':![],'defaultValue':_0x6b83('0x3')},'appdata':{'type':Sequelize[_0x6b83('0x4')]()},'description':{'type':Sequelize[_0x6b83('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x4f25=['*,*,*,*','sequelize','exports','INTEGER','STRING','noop','TEXT'];(function(_0x2f1133,_0x9554f9){var _0x15b963=function(_0xa24078){while(--_0xa24078){_0x2f1133['push'](_0x2f1133['shift']());}};_0x15b963(++_0x9554f9);}(_0x4f25,0x19e));var _0x54f2=function(_0x26bf51,_0x5e261a){_0x26bf51=_0x26bf51-0x0;var _0x503415=_0x4f25[_0x26bf51];return _0x503415;};'use strict';var Sequelize=require(_0x54f2('0x0'));module[_0x54f2('0x1')]={'priority':{'type':Sequelize[_0x54f2('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x54f2('0x3')],'allowNull':![],'defaultValue':_0x54f2('0x4')},'appdata':{'type':Sequelize[_0x54f2('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x54f2('0x3')],'defaultValue':_0x54f2('0x6')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 1bc936d..43febd4 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 _0x90c3=['save','update','then','destroy','sendStatus','error','stack','name','index','map','SmsApplication','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','count','includeAll','include','findAll','catch','show','params','length','create','body','find','eml-format','rimraf','zip-dir','moment','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','set','apply','reject'];(function(_0x404f57,_0x2a468c){var _0xdeb5e9=function(_0x402e13){while(--_0x402e13){_0x404f57['push'](_0x404f57['shift']());}};_0xdeb5e9(++_0x2a468c);}(_0x90c3,0xbd));var _0x390c=function(_0x18229f,_0x2f70e1){_0x18229f=_0x18229f-0x0;var _0x290070=_0x90c3[_0x18229f];return _0x290070;};'use strict';var emlformat=require(_0x390c('0x0'));var rimraf=require(_0x390c('0x1'));var zipdir=require(_0x390c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x390c('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x390c('0x4'));var path=require('path');var sox=require(_0x390c('0x5'));var csv=require(_0x390c('0x6'));var ejs=require(_0x390c('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x390c('0x8'));var squel=require(_0x390c('0x9'));var crypto=require(_0x390c('0xa'));var jsforce=require(_0x390c('0xb'));var deskjs=require(_0x390c('0xc'));var toCsv=require(_0x390c('0x6'));var querystring=require(_0x390c('0xd'));var Papa=require(_0x390c('0xe'));var Redis=require('ioredis');var authService=require(_0x390c('0xf'));var qs=require(_0x390c('0x10'));var as=require(_0x390c('0x11'));var hardwareService=require(_0x390c('0x12'));var logger=require(_0x390c('0x13'))('api');var utils=require(_0x390c('0x14'));var config=require(_0x390c('0x15'));var licenseUtil=require(_0x390c('0x16'));var db=require(_0x390c('0x17'))['db'];function respondWithStatusCode(_0x156df6,_0x4a19df){_0x4a19df=_0x4a19df||0xcc;return function(_0x14f913){if(_0x14f913){return _0x156df6['sendStatus'](_0x4a19df);}return _0x156df6['status'](_0x4a19df)[_0x390c('0x18')]();};}function respondWithResult(_0x3269a5,_0x2403f8){_0x2403f8=_0x2403f8||0xc8;return function(_0x39fca2){if(_0x39fca2){return _0x3269a5[_0x390c('0x19')](_0x2403f8)[_0x390c('0x1a')](_0x39fca2);}};}function respondWithFilteredResult(_0xda1026,_0x21e793){return function(_0x5ad039){if(_0x5ad039){var _0xabd216=typeof _0x21e793[_0x390c('0x1b')]===_0x390c('0x1c')&&typeof _0x21e793[_0x390c('0x1d')]===_0x390c('0x1c');var _0x13c8a3=_0x5ad039['count'];var _0x52f71f=_0xabd216?0x0:_0x21e793[_0x390c('0x1b')];var _0x44e5e1=_0xabd216?_0x5ad039['count']:_0x21e793[_0x390c('0x1b')]+_0x21e793[_0x390c('0x1d')];var _0x36b176;if(_0x44e5e1>=_0x13c8a3){_0x44e5e1=_0x13c8a3;_0x36b176=0xc8;}else{_0x36b176=0xce;}_0xda1026[_0x390c('0x19')](_0x36b176);return _0xda1026[_0x390c('0x1e')]('Content-Range',_0x52f71f+'-'+_0x44e5e1+'/'+_0x13c8a3)[_0x390c('0x1a')](_0x5ad039);}return null;};}function patchUpdates(_0x33718a){return function(_0x59adfc){try{jsonpatch[_0x390c('0x1f')](_0x59adfc,_0x33718a,!![]);}catch(_0x44b36b){return BPromise[_0x390c('0x20')](_0x44b36b);}return _0x59adfc[_0x390c('0x21')]();};}function saveUpdates(_0xfaae28,_0x2fa787){return function(_0x3da9c2){if(_0x3da9c2){return _0x3da9c2[_0x390c('0x22')](_0xfaae28)[_0x390c('0x23')](function(_0x566baf){return _0x566baf;});}return null;};}function removeEntity(_0x57c1a5,_0x4ffb2c){return function(_0x5350b4){if(_0x5350b4){return _0x5350b4[_0x390c('0x24')]()[_0x390c('0x23')](function(){_0x57c1a5[_0x390c('0x19')](0xcc)[_0x390c('0x18')]();});}};}function handleEntityNotFound(_0x46e0de,_0x104719){return function(_0x211184){if(!_0x211184){_0x46e0de[_0x390c('0x25')](0x194);}return _0x211184;};}function handleError(_0x3892f5,_0x4cb2c0){_0x4cb2c0=_0x4cb2c0||0x1f4;return function(_0x1c81c2){logger[_0x390c('0x26')](_0x1c81c2[_0x390c('0x27')]);if(_0x1c81c2[_0x390c('0x28')]){delete _0x1c81c2[_0x390c('0x28')];}_0x3892f5[_0x390c('0x19')](_0x4cb2c0)['send'](_0x1c81c2);};}exports[_0x390c('0x29')]=function(_0x3a92b3,_0x1cc006){var _0x517a51={},_0x18d48b={},_0x3ff784={'count':0x0,'rows':[]};var _0x333bea=_[_0x390c('0x2a')](db[_0x390c('0x2b')][_0x390c('0x2c')],function(_0x111392){return{'name':_0x111392[_0x390c('0x2d')],'type':_0x111392[_0x390c('0x2e')][_0x390c('0x2f')]};});_0x18d48b['model']=_[_0x390c('0x2a')](_0x333bea,_0x390c('0x28'));_0x18d48b[_0x390c('0x30')]=_[_0x390c('0x31')](_0x3a92b3[_0x390c('0x30')]);_0x18d48b[_0x390c('0x32')]=_['intersection'](_0x18d48b[_0x390c('0x33')],_0x18d48b[_0x390c('0x30')]);_0x517a51[_0x390c('0x34')]=_[_0x390c('0x35')](_0x18d48b[_0x390c('0x33')],qs[_0x390c('0x36')](_0x3a92b3['query']['fields']));_0x517a51[_0x390c('0x34')]=_0x517a51[_0x390c('0x34')]['length']?_0x517a51[_0x390c('0x34')]:_0x18d48b['model'];if(!_0x3a92b3['query'][_0x390c('0x37')](_0x390c('0x38'))){_0x517a51[_0x390c('0x1d')]=qs['limit'](_0x3a92b3['query'][_0x390c('0x1d')]);_0x517a51[_0x390c('0x1b')]=qs[_0x390c('0x1b')](_0x3a92b3[_0x390c('0x30')][_0x390c('0x1b')]);}_0x517a51['order']=qs[_0x390c('0x39')](_0x3a92b3[_0x390c('0x30')][_0x390c('0x39')]);_0x517a51[_0x390c('0x3a')]=qs[_0x390c('0x32')](_[_0x390c('0x3b')](_0x3a92b3[_0x390c('0x30')],_0x18d48b[_0x390c('0x32')]),_0x333bea);if(_0x3a92b3[_0x390c('0x30')][_0x390c('0x3c')]){_0x517a51[_0x390c('0x3a')]=_[_0x390c('0x3d')](_0x517a51['where'],{'$or':_[_0x390c('0x2a')](_0x333bea,function(_0x20c1a0){if(_0x20c1a0[_0x390c('0x2e')]!=='VIRTUAL'){var _0x3c5684={};_0x3c5684[_0x20c1a0[_0x390c('0x28')]]={'$like':'%'+_0x3a92b3['query'][_0x390c('0x3c')]+'%'};return _0x3c5684;}})});}_0x517a51=_[_0x390c('0x3d')]({},_0x517a51,_0x3a92b3[_0x390c('0x3e')]);var _0x27d4c4={'where':_0x517a51[_0x390c('0x3a')]};return db[_0x390c('0x2b')]['count'](_0x27d4c4)[_0x390c('0x23')](function(_0xf6237){_0x3ff784[_0x390c('0x3f')]=_0xf6237;if(_0x3a92b3[_0x390c('0x30')][_0x390c('0x40')]){_0x517a51[_0x390c('0x41')]=[{'all':!![]}];}return db['SmsApplication'][_0x390c('0x42')](_0x517a51);})[_0x390c('0x23')](function(_0x3764e6){_0x3ff784['rows']=_0x3764e6;return _0x3ff784;})[_0x390c('0x23')](respondWithFilteredResult(_0x1cc006,_0x517a51))[_0x390c('0x43')](handleError(_0x1cc006,null));};exports[_0x390c('0x44')]=function(_0x4cd377,_0x3f4294){var _0x56b391={'raw':!![],'where':{'id':_0x4cd377[_0x390c('0x45')]['id']}},_0x282b54={};_0x282b54[_0x390c('0x33')]=_['keys'](db[_0x390c('0x2b')][_0x390c('0x2c')]);_0x282b54[_0x390c('0x30')]=_[_0x390c('0x31')](_0x4cd377[_0x390c('0x30')]);_0x282b54[_0x390c('0x32')]=_['intersection'](_0x282b54[_0x390c('0x33')],_0x282b54[_0x390c('0x30')]);_0x56b391['attributes']=_[_0x390c('0x35')](_0x282b54['model'],qs[_0x390c('0x36')](_0x4cd377['query'][_0x390c('0x36')]));_0x56b391['attributes']=_0x56b391[_0x390c('0x34')][_0x390c('0x46')]?_0x56b391[_0x390c('0x34')]:_0x282b54[_0x390c('0x33')];if(_0x4cd377['query'][_0x390c('0x40')]){_0x56b391[_0x390c('0x41')]=[{'all':!![]}];}_0x56b391=_[_0x390c('0x3d')]({},_0x56b391,_0x4cd377['options']);return db[_0x390c('0x2b')]['find'](_0x56b391)[_0x390c('0x23')](handleEntityNotFound(_0x3f4294,null))[_0x390c('0x23')](respondWithResult(_0x3f4294,null))[_0x390c('0x43')](handleError(_0x3f4294,null));};exports[_0x390c('0x47')]=function(_0x425681,_0x3b9cdc){return db[_0x390c('0x2b')]['create'](_0x425681[_0x390c('0x48')],{})[_0x390c('0x23')](respondWithResult(_0x3b9cdc,0xc9))[_0x390c('0x43')](handleError(_0x3b9cdc,null));};exports['update']=function(_0x12050a,_0x211340){if(_0x12050a[_0x390c('0x48')]['id']){delete _0x12050a[_0x390c('0x48')]['id'];}return db[_0x390c('0x2b')][_0x390c('0x49')]({'where':{'id':_0x12050a[_0x390c('0x45')]['id']}})[_0x390c('0x23')](handleEntityNotFound(_0x211340,null))[_0x390c('0x23')](saveUpdates(_0x12050a[_0x390c('0x48')],null))[_0x390c('0x23')](respondWithResult(_0x211340,null))['catch'](handleError(_0x211340,null));};exports['destroy']=function(_0x19ad77,_0x29fa44){return db[_0x390c('0x2b')][_0x390c('0x49')]({'where':{'id':_0x19ad77[_0x390c('0x45')]['id']}})[_0x390c('0x23')](handleEntityNotFound(_0x29fa44,null))[_0x390c('0x23')](removeEntity(_0x29fa44,null))['catch'](handleError(_0x29fa44,null));}; \ No newline at end of file +var _0xfc20=['limit','count','offset','reject','save','then','error','stack','name','send','index','SmsApplication','rawAttributes','fieldName','key','map','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','findAll','rows','catch','show','params','includeAll','include','find','create','update','body','destroy','eml-format','zip-dir','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined'];(function(_0x58b073,_0x2988f5){var _0x385741=function(_0x1aa315){while(--_0x1aa315){_0x58b073['push'](_0x58b073['shift']());}};_0x385741(++_0x2988f5);}(_0xfc20,0x156));var _0x0fc2=function(_0x12ce70,_0x45a795){_0x12ce70=_0x12ce70-0x0;var _0xa47da5=_0xfc20[_0x12ce70];return _0xa47da5;};'use strict';var emlformat=require(_0x0fc2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0fc2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0fc2('0x2'));var moment=require(_0x0fc2('0x3'));var BPromise=require(_0x0fc2('0x4'));var Mustache=require(_0x0fc2('0x5'));var util=require('util');var path=require('path');var sox=require(_0x0fc2('0x6'));var csv=require('to-csv');var ejs=require(_0x0fc2('0x7'));var fs=require('fs');var fs_extra=require(_0x0fc2('0x8'));var _=require('lodash');var squel=require(_0x0fc2('0x9'));var crypto=require('crypto');var jsforce=require(_0x0fc2('0xa'));var deskjs=require(_0x0fc2('0xb'));var toCsv=require(_0x0fc2('0xc'));var querystring=require(_0x0fc2('0xd'));var Papa=require(_0x0fc2('0xe'));var Redis=require(_0x0fc2('0xf'));var authService=require(_0x0fc2('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0fc2('0x11'));var logger=require(_0x0fc2('0x12'))(_0x0fc2('0x13'));var utils=require('../../config/utils');var config=require(_0x0fc2('0x14'));var licenseUtil=require(_0x0fc2('0x15'));var db=require(_0x0fc2('0x16'))['db'];function respondWithStatusCode(_0x4905d5,_0x51551d){_0x51551d=_0x51551d||0xcc;return function(_0x29b1d3){if(_0x29b1d3){return _0x4905d5[_0x0fc2('0x17')](_0x51551d);}return _0x4905d5[_0x0fc2('0x18')](_0x51551d)[_0x0fc2('0x19')]();};}function respondWithResult(_0x2d6af,_0x570722){_0x570722=_0x570722||0xc8;return function(_0x320f16){if(_0x320f16){return _0x2d6af[_0x0fc2('0x18')](_0x570722)[_0x0fc2('0x1a')](_0x320f16);}};}function respondWithFilteredResult(_0x52ea84,_0x3c583e){return function(_0x191a8e){if(_0x191a8e){var _0x157cc3=typeof _0x3c583e['offset']===_0x0fc2('0x1b')&&typeof _0x3c583e[_0x0fc2('0x1c')]==='undefined';var _0x54ece4=_0x191a8e[_0x0fc2('0x1d')];var _0x3e35b5=_0x157cc3?0x0:_0x3c583e[_0x0fc2('0x1e')];var _0x5ac206=_0x157cc3?_0x191a8e[_0x0fc2('0x1d')]:_0x3c583e[_0x0fc2('0x1e')]+_0x3c583e[_0x0fc2('0x1c')];var _0x454e2c;if(_0x5ac206>=_0x54ece4){_0x5ac206=_0x54ece4;_0x454e2c=0xc8;}else{_0x454e2c=0xce;}_0x52ea84[_0x0fc2('0x18')](_0x454e2c);return _0x52ea84['set']('Content-Range',_0x3e35b5+'-'+_0x5ac206+'/'+_0x54ece4)['json'](_0x191a8e);}return null;};}function patchUpdates(_0x5be68f){return function(_0x80ba0d){try{jsonpatch['apply'](_0x80ba0d,_0x5be68f,!![]);}catch(_0x1f2ffe){return BPromise[_0x0fc2('0x1f')](_0x1f2ffe);}return _0x80ba0d[_0x0fc2('0x20')]();};}function saveUpdates(_0x10b0ec,_0x422042){return function(_0x2e1286){if(_0x2e1286){return _0x2e1286['update'](_0x10b0ec)['then'](function(_0xaabc0f){return _0xaabc0f;});}return null;};}function removeEntity(_0x41f122,_0x39f77b){return function(_0x106418){if(_0x106418){return _0x106418['destroy']()[_0x0fc2('0x21')](function(){_0x41f122[_0x0fc2('0x18')](0xcc)[_0x0fc2('0x19')]();});}};}function handleEntityNotFound(_0x47779d,_0x4745f){return function(_0xdc4f83){if(!_0xdc4f83){_0x47779d[_0x0fc2('0x17')](0x194);}return _0xdc4f83;};}function handleError(_0x5d747c,_0x51c14c){_0x51c14c=_0x51c14c||0x1f4;return function(_0x2814bc){logger[_0x0fc2('0x22')](_0x2814bc[_0x0fc2('0x23')]);if(_0x2814bc[_0x0fc2('0x24')]){delete _0x2814bc['name'];}_0x5d747c['status'](_0x51c14c)[_0x0fc2('0x25')](_0x2814bc);};}exports[_0x0fc2('0x26')]=function(_0x21e438,_0x3beedd){var _0x41c280={},_0x2aa1d9={},_0x2a5ec7={'count':0x0,'rows':[]};var _0x1ff7b2=_['map'](db[_0x0fc2('0x27')][_0x0fc2('0x28')],function(_0x4e65c7){return{'name':_0x4e65c7[_0x0fc2('0x29')],'type':_0x4e65c7['type'][_0x0fc2('0x2a')]};});_0x2aa1d9['model']=_[_0x0fc2('0x2b')](_0x1ff7b2,_0x0fc2('0x24'));_0x2aa1d9[_0x0fc2('0x2c')]=_[_0x0fc2('0x2d')](_0x21e438[_0x0fc2('0x2c')]);_0x2aa1d9['filters']=_[_0x0fc2('0x2e')](_0x2aa1d9[_0x0fc2('0x2f')],_0x2aa1d9[_0x0fc2('0x2c')]);_0x41c280[_0x0fc2('0x30')]=_[_0x0fc2('0x2e')](_0x2aa1d9[_0x0fc2('0x2f')],qs['fields'](_0x21e438[_0x0fc2('0x2c')][_0x0fc2('0x31')]));_0x41c280[_0x0fc2('0x30')]=_0x41c280[_0x0fc2('0x30')][_0x0fc2('0x32')]?_0x41c280[_0x0fc2('0x30')]:_0x2aa1d9[_0x0fc2('0x2f')];if(!_0x21e438['query']['hasOwnProperty'](_0x0fc2('0x33'))){_0x41c280['limit']=qs[_0x0fc2('0x1c')](_0x21e438['query'][_0x0fc2('0x1c')]);_0x41c280[_0x0fc2('0x1e')]=qs[_0x0fc2('0x1e')](_0x21e438[_0x0fc2('0x2c')][_0x0fc2('0x1e')]);}_0x41c280[_0x0fc2('0x34')]=qs[_0x0fc2('0x35')](_0x21e438[_0x0fc2('0x2c')][_0x0fc2('0x35')]);_0x41c280[_0x0fc2('0x36')]=qs[_0x0fc2('0x37')](_[_0x0fc2('0x38')](_0x21e438[_0x0fc2('0x2c')],_0x2aa1d9[_0x0fc2('0x37')]),_0x1ff7b2);if(_0x21e438[_0x0fc2('0x2c')][_0x0fc2('0x39')]){_0x41c280[_0x0fc2('0x36')]=_[_0x0fc2('0x3a')](_0x41c280['where'],{'$or':_['map'](_0x1ff7b2,function(_0x1a4889){if(_0x1a4889[_0x0fc2('0x3b')]!==_0x0fc2('0x3c')){var _0x3bf27c={};_0x3bf27c[_0x1a4889[_0x0fc2('0x24')]]={'$like':'%'+_0x21e438[_0x0fc2('0x2c')]['filter']+'%'};return _0x3bf27c;}})});}_0x41c280=_['merge']({},_0x41c280,_0x21e438[_0x0fc2('0x3d')]);var _0xa5a024={'where':_0x41c280[_0x0fc2('0x36')]};return db[_0x0fc2('0x27')][_0x0fc2('0x1d')](_0xa5a024)[_0x0fc2('0x21')](function(_0x20db43){_0x2a5ec7['count']=_0x20db43;if(_0x21e438[_0x0fc2('0x2c')]['includeAll']){_0x41c280['include']=[{'all':!![]}];}return db['SmsApplication'][_0x0fc2('0x3e')](_0x41c280);})[_0x0fc2('0x21')](function(_0x1e1e56){_0x2a5ec7[_0x0fc2('0x3f')]=_0x1e1e56;return _0x2a5ec7;})['then'](respondWithFilteredResult(_0x3beedd,_0x41c280))[_0x0fc2('0x40')](handleError(_0x3beedd,null));};exports[_0x0fc2('0x41')]=function(_0x1f805e,_0xe1b0bf){var _0x231126={'raw':!![],'where':{'id':_0x1f805e[_0x0fc2('0x42')]['id']}},_0x569f93={};_0x569f93[_0x0fc2('0x2f')]=_[_0x0fc2('0x2d')](db[_0x0fc2('0x27')][_0x0fc2('0x28')]);_0x569f93[_0x0fc2('0x2c')]=_[_0x0fc2('0x2d')](_0x1f805e[_0x0fc2('0x2c')]);_0x569f93['filters']=_[_0x0fc2('0x2e')](_0x569f93[_0x0fc2('0x2f')],_0x569f93[_0x0fc2('0x2c')]);_0x231126[_0x0fc2('0x30')]=_['intersection'](_0x569f93['model'],qs[_0x0fc2('0x31')](_0x1f805e[_0x0fc2('0x2c')]['fields']));_0x231126[_0x0fc2('0x30')]=_0x231126[_0x0fc2('0x30')]['length']?_0x231126[_0x0fc2('0x30')]:_0x569f93['model'];if(_0x1f805e[_0x0fc2('0x2c')][_0x0fc2('0x43')]){_0x231126[_0x0fc2('0x44')]=[{'all':!![]}];}_0x231126=_[_0x0fc2('0x3a')]({},_0x231126,_0x1f805e[_0x0fc2('0x3d')]);return db[_0x0fc2('0x27')][_0x0fc2('0x45')](_0x231126)[_0x0fc2('0x21')](handleEntityNotFound(_0xe1b0bf,null))['then'](respondWithResult(_0xe1b0bf,null))['catch'](handleError(_0xe1b0bf,null));};exports['create']=function(_0x4120f3,_0x537c3e){return db['SmsApplication'][_0x0fc2('0x46')](_0x4120f3['body'],{})['then'](respondWithResult(_0x537c3e,0xc9))[_0x0fc2('0x40')](handleError(_0x537c3e,null));};exports[_0x0fc2('0x47')]=function(_0x4ffe29,_0x5348a7){if(_0x4ffe29[_0x0fc2('0x48')]['id']){delete _0x4ffe29[_0x0fc2('0x48')]['id'];}return db['SmsApplication'][_0x0fc2('0x45')]({'where':{'id':_0x4ffe29[_0x0fc2('0x42')]['id']}})[_0x0fc2('0x21')](handleEntityNotFound(_0x5348a7,null))['then'](saveUpdates(_0x4ffe29[_0x0fc2('0x48')],null))[_0x0fc2('0x21')](respondWithResult(_0x5348a7,null))[_0x0fc2('0x40')](handleError(_0x5348a7,null));};exports[_0x0fc2('0x49')]=function(_0x1b19c8,_0x5d151){return db[_0x0fc2('0x27')][_0x0fc2('0x45')]({'where':{'id':_0x1b19c8[_0x0fc2('0x42')]['id']}})[_0x0fc2('0x21')](handleEntityNotFound(_0x5d151,null))[_0x0fc2('0x21')](removeEntity(_0x5d151,null))[_0x0fc2('0x40')](handleError(_0x5d151,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index b852eb0..514be52 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 _0x0ee7=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','exports','define','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0ee7,0xe3));var _0x70ee=function(_0x19f8b6,_0x2b4e8c){_0x19f8b6=_0x19f8b6-0x0;var _0x213ebc=_0x0ee7[_0x19f8b6];return _0x213ebc;};'use strict';var _=require(_0x70ee('0x0'));var util=require(_0x70ee('0x1'));var logger=require(_0x70ee('0x2'))(_0x70ee('0x3'));var moment=require(_0x70ee('0x4'));var BPromise=require(_0x70ee('0x5'));var rp=require(_0x70ee('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x70ee('0x7'));var config=require('../../config/environment');var attributes=require('./smsApplication.attributes');module[_0x70ee('0x8')]=function(_0x58b388,_0x15eed0){return _0x58b388[_0x70ee('0x9')]('SmsApplication',attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x70ee('0xa'),'collate':_0x70ee('0xb')});}; \ No newline at end of file +var _0xccde=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsApplication.attributes','exports','define','SmsApplication','sms_applications','utf8mb4','lodash','util'];(function(_0x427217,_0x4039b1){var _0x5b28fb=function(_0x3eaa08){while(--_0x3eaa08){_0x427217['push'](_0x427217['shift']());}};_0x5b28fb(++_0x4039b1);}(_0xccde,0x139));var _0xeccd=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xccde[_0xbb091];return _0x467a04;};'use strict';var _=require(_0xeccd('0x0'));var util=require(_0xeccd('0x1'));var logger=require(_0xeccd('0x2'))('api');var moment=require(_0xeccd('0x3'));var BPromise=require(_0xeccd('0x4'));var rp=require(_0xeccd('0x5'));var fs=require('fs');var path=require(_0xeccd('0x6'));var rimraf=require(_0xeccd('0x7'));var config=require(_0xeccd('0x8'));var attributes=require(_0xeccd('0x9'));module[_0xeccd('0xa')]=function(_0x356b83,_0x125d44){return _0x356b83[_0xeccd('0xb')](_0xeccd('0xc'),attributes,{'tableName':_0xeccd('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xeccd('0xe'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index b088e30..e952cf4 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 _0x8cda=['../../config/environment','client','http','request','SmsApplication,\x20%s,\x20%s','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','info','request\x20sent','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x39ea42,_0x3c1f50){var _0x33f5b7=function(_0x5d8e73){while(--_0x5d8e73){_0x39ea42['push'](_0x39ea42['shift']());}};_0x33f5b7(++_0x3c1f50);}(_0x8cda,0x1db));var _0xa8cd=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8cda[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0xa8cd('0x0'));var moment=require(_0xa8cd('0x1'));var BPromise=require(_0xa8cd('0x2'));var rs=require(_0xa8cd('0x3'));var fs=require('fs');var Redis=require(_0xa8cd('0x4'));var db=require(_0xa8cd('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa8cd('0x6'))(_0xa8cd('0x7'));var config=require(_0xa8cd('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa8cd('0x9')][_0xa8cd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1362c3,_0x273d2f,_0x2b9b51){return new BPromise(function(_0x2481ba,_0x13f394){return client[_0xa8cd('0xb')](_0x1362c3,_0x2b9b51)['then'](function(_0x50b8ee){logger['info'](_0xa8cd('0xc'),_0x273d2f,'request\x20sent');logger[_0xa8cd('0xd')](_0xa8cd('0xe'),_0x273d2f,'request\x20sent',JSON[_0xa8cd('0xf')](_0x50b8ee));if(_0x50b8ee[_0xa8cd('0x10')]){if(_0x50b8ee['error']['code']===0x1f4){logger[_0xa8cd('0x10')](_0xa8cd('0xc'),_0x273d2f,_0x50b8ee[_0xa8cd('0x10')][_0xa8cd('0x11')]);return _0x13f394(_0x50b8ee[_0xa8cd('0x10')]['message']);}logger[_0xa8cd('0x10')]('SmsApplication,\x20%s,\x20%s',_0x273d2f,_0x50b8ee[_0xa8cd('0x10')]['message']);return _0x2481ba(_0x50b8ee[_0xa8cd('0x10')]['message']);}else{logger[_0xa8cd('0x12')](_0xa8cd('0xc'),_0x273d2f,_0xa8cd('0x13'));_0x2481ba(_0x50b8ee['result']['message']);}})[_0xa8cd('0x14')](function(_0x6d5f40){logger[_0xa8cd('0x10')](_0xa8cd('0xc'),_0x273d2f,_0x6d5f40);_0x13f394(_0x6d5f40);});});} \ No newline at end of file +var _0xaafc=['../../config/environment','client','request','SmsApplication,\x20%s,\x20%s','debug','SmsApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x3e2226,_0x19e5df){var _0x553a9b=function(_0x1dea42){while(--_0x1dea42){_0x3e2226['push'](_0x3e2226['shift']());}};_0x553a9b(++_0x19e5df);}(_0xaafc,0x176));var _0xcaaf=function(_0x67d572,_0x564f1d){_0x67d572=_0x67d572-0x0;var _0x1f654f=_0xaafc[_0x67d572];return _0x1f654f;};'use strict';var _=require('lodash');var util=require(_0xcaaf('0x0'));var moment=require(_0xcaaf('0x1'));var BPromise=require(_0xcaaf('0x2'));var rs=require(_0xcaaf('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcaaf('0x4'))['db'];var utils=require(_0xcaaf('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xcaaf('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xcaaf('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x31e6bb,_0x19d453,_0x22d1b2){return new BPromise(function(_0xdccf0d,_0x4c3e09){return client[_0xcaaf('0x8')](_0x31e6bb,_0x22d1b2)['then'](function(_0x4211c6){logger['info'](_0xcaaf('0x9'),_0x19d453,'request\x20sent');logger[_0xcaaf('0xa')](_0xcaaf('0xb'),_0x19d453,_0xcaaf('0xc'),JSON[_0xcaaf('0xd')](_0x4211c6));if(_0x4211c6[_0xcaaf('0xe')]){if(_0x4211c6[_0xcaaf('0xe')][_0xcaaf('0xf')]===0x1f4){logger[_0xcaaf('0xe')](_0xcaaf('0x9'),_0x19d453,_0x4211c6['error'][_0xcaaf('0x10')]);return _0x4c3e09(_0x4211c6[_0xcaaf('0xe')][_0xcaaf('0x10')]);}logger[_0xcaaf('0xe')](_0xcaaf('0x9'),_0x19d453,_0x4211c6[_0xcaaf('0xe')][_0xcaaf('0x10')]);return _0xdccf0d(_0x4211c6[_0xcaaf('0xe')][_0xcaaf('0x10')]);}else{logger[_0xcaaf('0x11')](_0xcaaf('0x9'),_0x19d453,'request\x20sent');_0xdccf0d(_0x4211c6[_0xcaaf('0x12')][_0xcaaf('0x10')]);}})[_0xcaaf('0x13')](function(_0x3bb678){logger[_0xcaaf('0xe')](_0xcaaf('0x9'),_0x19d453,_0x3bb678);_0x4c3e09(_0x3bb678);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 1dd2ab6..509e06d 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 _0x93e9=['update','delete','smsinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/messages','/:id/download','post','create','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','put','smsinteraction:update'];(function(_0x301b92,_0x19b335){var _0x4ae712=function(_0x52d89b){while(--_0x52d89b){_0x301b92['push'](_0x301b92['shift']());}};_0x4ae712(++_0x19b335);}(_0x93e9,0xcc));var _0x993e=function(_0xa0b432,_0x55f6c9){_0xa0b432=_0xa0b432-0x0;var _0x4a35ed=_0x93e9[_0xa0b432];return _0x4a35ed;};'use strict';var multer=require(_0x993e('0x0'));var util=require(_0x993e('0x1'));var path=require(_0x993e('0x2'));var timeout=require(_0x993e('0x3'));var express=require(_0x993e('0x4'));var router=express[_0x993e('0x5')]();var fs_extra=require(_0x993e('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x993e('0x7'));var controller=require(_0x993e('0x8'));router[_0x993e('0x9')]('/',auth[_0x993e('0xa')](),controller[_0x993e('0xb')]);router[_0x993e('0x9')](_0x993e('0xc'),auth[_0x993e('0xa')](),controller['describe']);router[_0x993e('0x9')](_0x993e('0xd'),auth[_0x993e('0xa')](),controller[_0x993e('0xe')]);router[_0x993e('0x9')](_0x993e('0xf'),auth[_0x993e('0xa')](),controller['getMessages']);router[_0x993e('0x9')](_0x993e('0x10'),auth['isAuthenticated'](),controller['download']);router[_0x993e('0x11')]('/',auth['isAuthenticated'](),controller[_0x993e('0x12')]);router['post']('/:id/messages',auth[_0x993e('0xa')](),controller[_0x993e('0x13')]);router[_0x993e('0x11')](_0x993e('0x14'),auth[_0x993e('0xa')](),interaction[_0x993e('0x15')](_0x993e('0x16'),_0x993e('0x17')),controller[_0x993e('0x18')]);router[_0x993e('0x19')](_0x993e('0xd'),auth[_0x993e('0xa')](),interaction[_0x993e('0x15')](_0x993e('0x16'),_0x993e('0x1a')),controller[_0x993e('0x1b')]);router[_0x993e('0x1c')]('/:id',auth[_0x993e('0xa')](),interaction[_0x993e('0x15')](_0x993e('0x16'),_0x993e('0x1d')),controller[_0x993e('0x1e')]);router[_0x993e('0x1c')]('/:id/tags',auth[_0x993e('0xa')](),controller[_0x993e('0x1f')]);module[_0x993e('0x20')]=router; \ No newline at end of file +var _0x0b0e=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','describe','/:id','/:id/messages','getMessages','download','post','create','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','put','smsinteraction:update','delete','exports','multer'];(function(_0x3976f0,_0x105007){var _0x5043f7=function(_0x51f400){while(--_0x51f400){_0x3976f0['push'](_0x3976f0['shift']());}};_0x5043f7(++_0x105007);}(_0x0b0e,0x187));var _0xe0b0=function(_0x334f9a,_0x542f01){_0x334f9a=_0x334f9a-0x0;var _0x2b219d=_0x0b0e[_0x334f9a];return _0x2b219d;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0x9')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['show']);router[_0xe0b0('0x9')](_0xe0b0('0xe'),auth['isAuthenticated'](),controller[_0xe0b0('0xf')]);router[_0xe0b0('0x9')]('/:id/download',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x10')]);router[_0xe0b0('0x11')]('/',auth['isAuthenticated'](),controller[_0xe0b0('0x12')]);router[_0xe0b0('0x11')](_0xe0b0('0xe'),auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x13')]);router['post'](_0xe0b0('0x14'),auth[_0xe0b0('0xa')](),interaction[_0xe0b0('0x15')](_0xe0b0('0x16'),_0xe0b0('0x17')),controller['addTags']);router[_0xe0b0('0x18')]('/:id',auth[_0xe0b0('0xa')](),interaction[_0xe0b0('0x15')]('sms',_0xe0b0('0x19')),controller['update']);router[_0xe0b0('0x1a')](_0xe0b0('0xd'),auth['isAuthenticated'](),interaction['tracked'](_0xe0b0('0x16'),'smsinteraction:destroy'),controller['destroy']);router['delete'](_0xe0b0('0x14'),auth['isAuthenticated'](),controller['removeTags']);module[_0xe0b0('0x1b')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index f671b18..2d563da 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 _0x23f4=['DATE','STRING','ENUM','out','moment'];(function(_0x390cf3,_0x5e5863){var _0x4baa33=function(_0x5370c9){while(--_0x5370c9){_0x390cf3['push'](_0x390cf3['shift']());}};_0x4baa33(++_0x5e5863);}(_0x23f4,0x1ee));var _0x423f=function(_0x45e7bf,_0x4e68c4){_0x45e7bf=_0x45e7bf-0x0;var _0x60d281=_0x23f4[_0x45e7bf];return _0x60d281;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x423f('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x423f('0x1')]},'disposition':{'type':Sequelize[_0x423f('0x2')]},'secondDisposition':{'type':Sequelize[_0x423f('0x2')]},'thirdDisposition':{'type':Sequelize[_0x423f('0x2')]},'note':{'type':Sequelize[_0x423f('0x2')]},'phone':{'type':Sequelize[_0x423f('0x2')]},'read1stAt':{'type':Sequelize[_0x423f('0x1')]},'firstMsgDirection':{'type':Sequelize[_0x423f('0x3')]('in',_0x423f('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x423f('0x3')]('in',_0x423f('0x4')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x25fa=['exports','BOOLEAN','STRING','DATE','out','ENUM','sequelize'];(function(_0x384b63,_0x1f47d5){var _0x523bb6=function(_0x187614){while(--_0x187614){_0x384b63['push'](_0x384b63['shift']());}};_0x523bb6(++_0x1f47d5);}(_0x25fa,0x109));var _0xa25f=function(_0x58bea8,_0x1d0203){_0x58bea8=_0x58bea8-0x0;var _0x2b9b6a=_0x25fa[_0x58bea8];return _0x2b9b6a;};'use strict';var Sequelize=require(_0xa25f('0x0'));var moment=require('moment');module[_0xa25f('0x1')]={'closed':{'type':Sequelize[_0xa25f('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xa25f('0x3')]},'secondDisposition':{'type':Sequelize[_0xa25f('0x3')]},'thirdDisposition':{'type':Sequelize[_0xa25f('0x3')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xa25f('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xa25f('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xa25f('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xa25f('0x6')]('in',_0xa25f('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xa25f('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 8f6b55f..b382e57 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 _0xfe20=['some','forEach','SmsAccountId','where','i.SmsAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','contactName','DESC','isEmpty','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','a.key','Account.key','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.firstName','c.lastName','Contact.lastName','c.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','all','rows','includeAll','include','options','SmsInteraction','create','body','params','describe','addMessage','SmsMessage','ids','findOne','pick','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','spread','color','emit','smsInteractionTags:save','removeTags','download','unix','join','root','server','files','attachments','transcript-%d-%s.zip','CmContact','firstName','Messages','direction','secret','SmsAccount','Owner','get','mkdirSync','Account','closedAt','disposition','out','System','lastName','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','localhost','socket.io-emitter','redis','./smsInteraction.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','then','name','send','Users','map','fullname','TagIds','Tags','push','catch','waiting','total','closed','UserId','talking','answered','unmanaged','index','rawAttributes','fieldName','type','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','select','field','from','u.id','u.fullname','user_has_sms_interactions','left_join','users','u.id\x20=\x20ui.UserId','sms_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','sms_messages','me.SmsInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','find','value','having','`\x20=\x200','Contact','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','split','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','keys'];(function(_0x1361fd,_0x1e7dae){var _0x12211d=function(_0x59ba07){while(--_0x59ba07){_0x1361fd['push'](_0x1361fd['shift']());}};_0x12211d(++_0x1e7dae);}(_0xfe20,0x7a));var _0x0fe2=function(_0x580369,_0x47eed1){_0x580369=_0x580369-0x0;var _0x138d13=_0xfe20[_0x580369];return _0x138d13;};'use strict';var emlformat=require(_0x0fe2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0fe2('0x1'));var jsonpatch=require(_0x0fe2('0x2'));var rp=require(_0x0fe2('0x3'));var moment=require(_0x0fe2('0x4'));var BPromise=require(_0x0fe2('0x5'));var Mustache=require(_0x0fe2('0x6'));var util=require(_0x0fe2('0x7'));var path=require(_0x0fe2('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0fe2('0x9'));var fs=require('fs');var fs_extra=require(_0x0fe2('0xa'));var _=require(_0x0fe2('0xb'));var squel=require(_0x0fe2('0xc'));var crypto=require(_0x0fe2('0xd'));var jsforce=require(_0x0fe2('0xe'));var deskjs=require(_0x0fe2('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0fe2('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x0fe2('0x11'));var as=require(_0x0fe2('0x12'));var pdf=require(_0x0fe2('0x13'));var hardwareService=require(_0x0fe2('0x14'));var logger=require(_0x0fe2('0x15'))(_0x0fe2('0x16'));var utils=require(_0x0fe2('0x17'));var config=require(_0x0fe2('0x18'));var licenseUtil=require(_0x0fe2('0x19'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x0fe2('0x1a'),'port':0x18eb});var socket=require(_0x0fe2('0x1b'))(new Redis(config[_0x0fe2('0x1c')]));require(_0x0fe2('0x1d'))[_0x0fe2('0x1e')](socket);function respondWithStatusCode(_0x271370,_0x41f551){_0x41f551=_0x41f551||0xcc;return function(_0x24706f){if(_0x24706f){return _0x271370['sendStatus'](_0x41f551);}return _0x271370[_0x0fe2('0x1f')](_0x41f551)[_0x0fe2('0x20')]();};}function respondWithResult(_0x4f1d6b,_0x2d19da){_0x2d19da=_0x2d19da||0xc8;return function(_0xe741d8){if(_0xe741d8){return _0x4f1d6b[_0x0fe2('0x1f')](_0x2d19da)[_0x0fe2('0x21')](_0xe741d8);}};}function respondWithFilteredResult(_0x25bd17,_0x5d3bda){return function(_0x495e46){if(_0x495e46){var _0x4bf751=typeof _0x5d3bda[_0x0fe2('0x22')]===_0x0fe2('0x23')&&typeof _0x5d3bda[_0x0fe2('0x24')]===_0x0fe2('0x23');var _0x20ac2e=_0x495e46[_0x0fe2('0x25')];var _0x3a0f28=_0x4bf751?0x0:_0x5d3bda[_0x0fe2('0x22')];var _0x3ab72a=_0x4bf751?_0x495e46[_0x0fe2('0x25')]:_0x5d3bda[_0x0fe2('0x22')]+_0x5d3bda[_0x0fe2('0x24')];var _0x6d089b;if(_0x3ab72a>=_0x20ac2e){_0x3ab72a=_0x20ac2e;_0x6d089b=0xc8;}else{_0x6d089b=0xce;}_0x25bd17[_0x0fe2('0x1f')](_0x6d089b);return _0x25bd17[_0x0fe2('0x26')](_0x0fe2('0x27'),_0x3a0f28+'-'+_0x3ab72a+'/'+_0x20ac2e)[_0x0fe2('0x21')](_0x495e46);}return null;};}function patchUpdates(_0x150389){return function(_0x440320){try{jsonpatch[_0x0fe2('0x28')](_0x440320,_0x150389,!![]);}catch(_0x2d98ea){return BPromise[_0x0fe2('0x29')](_0x2d98ea);}return _0x440320['save']();};}function saveUpdates(_0x4ad989,_0x489972){return function(_0x475796){if(_0x475796){return _0x475796[_0x0fe2('0x2a')](_0x4ad989)['then'](function(_0x53bd7d){return _0x53bd7d;});}return null;};}function removeEntity(_0x15c111,_0x50e322){return function(_0x24e49e){if(_0x24e49e){return _0x24e49e[_0x0fe2('0x2b')]()[_0x0fe2('0x2c')](function(){_0x15c111[_0x0fe2('0x1f')](0xcc)[_0x0fe2('0x20')]();});}};}function handleEntityNotFound(_0x11d436,_0xf7aeb8){return function(_0x10676c){if(!_0x10676c){_0x11d436['sendStatus'](0x194);}return _0x10676c;};}function handleError(_0x128701,_0x474e22){_0x474e22=_0x474e22||0x1f4;return function(_0x523513){logger['error'](_0x523513['stack']);if(_0x523513['name']){delete _0x523513[_0x0fe2('0x2d')];}_0x128701['status'](_0x474e22)[_0x0fe2('0x2e')](_0x523513);};}function getInteractionUsers(_0x1c198f,_0x2e27cf){return new BPromise(function(_0x4ae63a,_0x5532e6){try{if(_0x2e27cf[_0x1c198f['id']]){_0x1c198f[_0x0fe2('0x2f')]=_[_0x0fe2('0x30')](_0x2e27cf[_0x1c198f['id']],function(_0x5a4c54){return{'id':_0x5a4c54['id'],'fullname':_0x5a4c54[_0x0fe2('0x31')]};});}}catch(_0x22ff7f){_0x5532e6(_0x22ff7f);}_0x4ae63a(_0x1c198f);});}function getInteractionTags(_0x58a620,_0x2e6995){return new BPromise(function(_0x1f8358,_0x274204){try{if(_0x58a620[_0x0fe2('0x32')]){_0x58a620[_0x0fe2('0x33')]=[];_0x58a620[_0x0fe2('0x32')]['split'](',')['forEach'](function(_0x4dd50b){_0x58a620[_0x0fe2('0x33')][_0x0fe2('0x34')](_0x2e6995[_0x4dd50b]);});}delete _0x58a620['TagIds'];}catch(_0x24ac3b){_0x274204(_0x24ac3b);}_0x1f8358(_0x58a620);});}function updateSmsInteraction(_0x31dd90,_0x552553,_0x2fe47d){return new BPromise(function(_0x5f1872,_0x4f01e6){return getInteractionUsers(_0x31dd90,_0x2fe47d)['then'](function(_0xb40d87){return getInteractionTags(_0xb40d87,_0x552553);})['then'](function(_0x302fdf){return getStateInteraction(_0x302fdf);})[_0x0fe2('0x2c')](function(_0x87ca80){_0x5f1872(_0x87ca80);})[_0x0fe2('0x35')](function(_0x54bb4f){_0x4f01e6(_0x54bb4f);});});}function getStateInteraction(_0x5b147f){return new BPromise(function(_0x35216f){_0x5b147f[_0x0fe2('0x36')]=0x0;_0x5b147f['talking']=0x0;_0x5b147f['answered']=0x0;_0x5b147f['unmanaged']=0x0;_0x5b147f[_0x0fe2('0x37')]=0x0;if(!_0x5b147f[_0x0fe2('0x38')]&&!_0x5b147f['UserId']){_0x5b147f[_0x0fe2('0x36')]+=0x1;}if(!_0x5b147f['closed']&&_0x5b147f[_0x0fe2('0x39')]){_0x5b147f[_0x0fe2('0x3a')]+=0x1;if(_0x5b147f['waiting']){_0x5b147f['waiting']-=0x1;}}if(_0x5b147f[_0x0fe2('0x38')]&&_0x5b147f['UserId']){_0x5b147f[_0x0fe2('0x3b')]+=0x1;if(_0x5b147f['talking']){_0x5b147f['talking']-=0x1;}}if(_0x5b147f['closed']&&!_0x5b147f[_0x0fe2('0x39')]){_0x5b147f[_0x0fe2('0x3c')]+=0x1;if(_0x5b147f[_0x0fe2('0x36')]){_0x5b147f[_0x0fe2('0x36')]-=0x1;}}_0x5b147f['total']+=0x1;_0x35216f(_0x5b147f);});}exports[_0x0fe2('0x3d')]=function(_0x959002,_0x2d8e6c){var _0x1da01b={},_0x303bad={},_0x500616={'count':0x0,'rows':[]};var _0x4395f1=_['map'](db['SmsInteraction'][_0x0fe2('0x3e')],function(_0x36576a){return{'name':_0x36576a[_0x0fe2('0x3f')],'type':_0x36576a[_0x0fe2('0x40')]['key']};});_0x303bad['model']=_[_0x0fe2('0x30')](_0x4395f1,_0x0fe2('0x2d'));_0x303bad[_0x0fe2('0x41')]=_['keys'](_0x959002[_0x0fe2('0x41')]);_0x303bad[_0x0fe2('0x42')]=_[_0x0fe2('0x43')](_0x303bad[_0x0fe2('0x44')],_0x303bad[_0x0fe2('0x41')]);_0x1da01b['attributes']=_[_0x0fe2('0x43')](_0x303bad[_0x0fe2('0x44')],qs['fields'](_0x959002[_0x0fe2('0x41')][_0x0fe2('0x45')]));_0x1da01b[_0x0fe2('0x46')]=_0x1da01b['attributes'][_0x0fe2('0x47')]?_0x1da01b[_0x0fe2('0x46')]:_0x303bad[_0x0fe2('0x44')];if(!_0x959002[_0x0fe2('0x41')][_0x0fe2('0x48')](_0x0fe2('0x49'))){_0x1da01b[_0x0fe2('0x24')]=qs[_0x0fe2('0x24')](_0x959002['query'][_0x0fe2('0x24')]);_0x1da01b['offset']=qs[_0x0fe2('0x22')](_0x959002[_0x0fe2('0x41')][_0x0fe2('0x22')]);}_0x1da01b[_0x0fe2('0x4a')]=qs[_0x0fe2('0x4b')](_0x959002['query'][_0x0fe2('0x4b')]);_0x1da01b['where']=qs['filters'](_['pick'](_0x959002['query'],_0x303bad['filters']),_0x4395f1);var _0x1da15d=[];var _0x14d33f=squel[_0x0fe2('0x4c')]()[_0x0fe2('0x4d')]('id')[_0x0fe2('0x4d')](_0x0fe2('0x2d'))[_0x0fe2('0x4d')]('color')[_0x0fe2('0x4e')]('tools_tags');var _0xa36148=squel[_0x0fe2('0x4c')]()['field'](_0x0fe2('0x4f'))[_0x0fe2('0x4d')](_0x0fe2('0x50'))[_0x0fe2('0x4d')]('ui.SmsInteractionId')[_0x0fe2('0x4e')](_0x0fe2('0x51'),'ui')[_0x0fe2('0x52')](_0x0fe2('0x53'),'u',_0x0fe2('0x54'));var _0x9540c=squel[_0x0fe2('0x4c')]()[_0x0fe2('0x4e')](_0x0fe2('0x55'),'i')[_0x0fe2('0x52')]('cm_contacts','c',_0x0fe2('0x56'))[_0x0fe2('0x52')](_0x0fe2('0x53'),'o','o.id\x20=\x20i.UserId')[_0x0fe2('0x52')]('sms_accounts','a','a.id\x20=\x20i.SmsAccountId')[_0x0fe2('0x52')](_0x0fe2('0x57'),'me',_0x0fe2('0x58'))[_0x0fe2('0x52')]('sms_interaction_has_tags','it','it.SmsInteractionId\x20=\x20i.id')[_0x0fe2('0x52')](_0x0fe2('0x59'),'t',_0x0fe2('0x5a'));var _0x50b523=squel[_0x0fe2('0x5b')]();var _0x777d5f=[];var _0x132c0d=squel[_0x0fe2('0x5b')]();var _0x1d609e;if(_0x959002[_0x0fe2('0x41')]['search']){_0x1d609e=as[_0x0fe2('0x5c')](_0x959002[_0x0fe2('0x41')][_0x0fe2('0x5d')]);var _0x108fa7=_0x1d609e[_0x0fe2('0x5e')];for(var _0x4f157e=0x0;_0x4f157e<_0x1d609e[_0x0fe2('0x5f')]['length'];_0x4f157e++){var _0x361451=_0x1d609e[_0x0fe2('0x5f')][_0x4f157e];var _0x1aacb6='i';var _0x129559=_[_0x0fe2('0x60')](_0x4395f1,[_0x0fe2('0x2d'),_0x361451[_0x0fe2('0x4d')]]);if(!_0x129559){switch(_0x361451['field']){case'unreadMessages':if(_0x361451[_0x0fe2('0x61')]==0x1){_0x9540c[_0x0fe2('0x62')]('`'+_0x361451[_0x0fe2('0x4d')]+_0x0fe2('0x63'));}else{_0x9540c[_0x0fe2('0x62')]('`'+_0x361451['field']+'`\x20>\x200');}break;case _0x0fe2('0x64'):if(_0x361451[_0x0fe2('0x65')]==='$substring'){if(_0x361451[_0x0fe2('0x61')]['split']('\x20')['length']>0x1){_0x50b523[_0x108fa7](_0x0fe2('0x66'),qs['getFullTextValue'](_0x361451[_0x0fe2('0x61')]),null);}else{var _0x3770ac='%'+_0x361451[_0x0fe2('0x61')]+'%';_0x50b523[_0x108fa7](_0x0fe2('0x67'),_0x3770ac,_0x3770ac,_0x3770ac);}}else{_0x129559=_['find'](_0x4395f1,[_0x0fe2('0x2d'),_0x0fe2('0x68')]);_0x361451['field']='ContactId';_0xfe6f01=as[_0x0fe2('0x69')](_0x1aacb6,_0x129559[_0x0fe2('0x40')],_0x361451);_0x50b523[_0x108fa7](_0xfe6f01[_0x0fe2('0x6a')],_0xfe6f01['value'][_0x0fe2('0x6b')],_0xfe6f01[_0x0fe2('0x61')][_0x0fe2('0x20')]);}break;case _0x0fe2('0x6c'):var _0x464d02=_0x361451[_0x0fe2('0x61')][_0x0fe2('0x6d')](',')[_0x0fe2('0x30')](function(_0x6443bc){return Number(_0x6443bc);});_0x464d02['forEach'](function(_0x24f71a){_0x132c0d['or'](_0x0fe2('0x6e'),'%,'+_0x24f71a+',%');});_0x777d5f=_['union'](_0x777d5f,_0x464d02);break;case _0x0fe2('0x6f'):if(_0x361451[_0x0fe2('0x65')]==='$substring'){_0x50b523[_0x108fa7](_0x0fe2('0x70'),'%'+_0x361451[_0x0fe2('0x61')]+'%',null);}else{_0x129559=_[_0x0fe2('0x60')](_0x4395f1,['name',_0x0fe2('0x39')]);_0x361451['field']=_0x0fe2('0x39');_0xfe6f01=as['buildExpression'](_0x1aacb6,_0x129559[_0x0fe2('0x40')],_0x361451);_0x50b523[_0x108fa7](_0xfe6f01[_0x0fe2('0x6a')],_0xfe6f01[_0x0fe2('0x61')][_0x0fe2('0x6b')],_0xfe6f01['value'][_0x0fe2('0x20')]);}break;case'body':_0xfe6f01=as[_0x0fe2('0x69')]('me',null,_0x361451);_0x50b523[_0x108fa7](_0xfe6f01['text'],_0xfe6f01[_0x0fe2('0x61')][_0x0fe2('0x6b')],_0xfe6f01[_0x0fe2('0x61')]['end']);break;}}else{var _0xfe6f01=as['buildExpression'](_0x1aacb6,_0x129559[_0x0fe2('0x40')],_0x361451);_0x50b523[_0x108fa7](_0xfe6f01[_0x0fe2('0x6a')],_0xfe6f01['value'][_0x0fe2('0x6b')],_0xfe6f01[_0x0fe2('0x61')]['end']);}}}else{var _0x12ded5=_(_0x959002[_0x0fe2('0x41')])[_0x0fe2('0x71')]()[_0x0fe2('0x30')](function(_0x3bae9e){return _[_0x0fe2('0x72')](_0x4395f1,['name',_0x3bae9e])?_0x3bae9e:undefined;})['compact']()[_0x0fe2('0x61')]();if(!_['isEmpty'](_0x12ded5)){_0x12ded5[_0x0fe2('0x73')](function(_0x51b7a1){if(_0x51b7a1===_0x0fe2('0x74')){_0x9540c[_0x0fe2('0x75')](_0x0fe2('0x76'),[][_0x0fe2('0x77')](_0x959002[_0x0fe2('0x41')][_0x51b7a1]));}else if(_0x51b7a1===_0x0fe2('0x78')){var _0x176382=JSON[_0x0fe2('0x79')](_0x959002[_0x0fe2('0x41')][_0x51b7a1])[_0x0fe2('0x7a')];var _0x825226=JSON['parse'](_0x959002['query'][_0x51b7a1])[_0x0fe2('0x7b')];_0x9540c[_0x0fe2('0x75')](_0x0fe2('0x7c'),_0x176382,_0x825226);}else{if(_0x959002[_0x0fe2('0x41')][_0x51b7a1]===_0x0fe2('0x7d')){_0x9540c['where']('i.'+_0x51b7a1+'\x20IS\x20NULL');}else{_0x9540c['where']('i.'+_0x51b7a1+'\x20=\x20?',_0x959002[_0x0fe2('0x41')][_0x51b7a1]);}}});}if(_0x959002['query'][_0x0fe2('0x7e')]){if(_0x959002['query'][_0x0fe2('0x7e')]==0x1){_0x9540c['having'](_0x0fe2('0x7f'));}else{_0x9540c[_0x0fe2('0x62')](_0x0fe2('0x80'));}}if(_0x959002[_0x0fe2('0x41')][_0x0fe2('0x81')]){_0x777d5f=_[_0x0fe2('0x82')](_0x959002[_0x0fe2('0x41')][_0x0fe2('0x81')])?_0x959002['query'][_0x0fe2('0x81')]:new Array(_0x959002['query'][_0x0fe2('0x81')]);_0x777d5f[_0x0fe2('0x73')](function(_0x433fd3){_0x132c0d['or'](_0x0fe2('0x6e'),'%,'+_0x433fd3+',%');});}if(_0x959002['query']['filter']){var _0x25b6a1=_0x959002[_0x0fe2('0x41')][_0x0fe2('0x83')][_0x0fe2('0x84')]('\x5c','\x5c\x5c')[_0x0fe2('0x84')](/'/g,'\x27\x27');if(qs[_0x0fe2('0x85')](_0x25b6a1)){_0x50b523['or']('i.id\x20LIKE\x20?',_0x25b6a1+'%')['or']('i.phone\x20LIKE\x20?',_0x25b6a1+'%');}else{_0x50b523['or'](_0x0fe2('0x86'),qs[_0x0fe2('0x87')](_0x25b6a1))['or'](_0x0fe2('0x88'),_0x25b6a1+'%');}}}_0x9540c[_0x0fe2('0x75')](_0x50b523);_0x9540c[_0x0fe2('0x89')]('i.id');var _0x3cce43={'type':db[_0x0fe2('0x8a')]['QueryTypes'][_0x0fe2('0x8b')],'raw':!![]};var _0x59e89f=_0x9540c[_0x0fe2('0x8c')]();_0x59e89f['field'](_0x0fe2('0x8d'));_0x59e89f[_0x0fe2('0x4d')](_0x0fe2('0x8e'),_0x0fe2('0x8f'));if(_0x1da01b[_0x0fe2('0x4a')]){_0x1da01b[_0x0fe2('0x4a')][_0x0fe2('0x73')](function(_0x47ec1a){var _0x207ebd=_0x47ec1a[0x0]===_0x0fe2('0x90')?_0x47ec1a[0x0]:'i.'+_0x47ec1a[0x0];_0x9540c[_0x0fe2('0x4a')](_0x207ebd,_0x47ec1a[0x1]===_0x0fe2('0x91')?![]:!![]);});}if(!_[_0x0fe2('0x92')](_0x777d5f)){_0x9540c[_0x0fe2('0x62')](_0x132c0d);_0x59e89f['where'](_0x0fe2('0x93'),_0x777d5f);}BPromise[_0x0fe2('0x94')]()[_0x0fe2('0x2c')](function(){if(!_0x1d609e){if(_0x959002[_0x0fe2('0x41')][_0x0fe2('0x74')])return;_0x59e89f[_0x0fe2('0x75')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');_0x9540c[_0x0fe2('0x75')](_0x0fe2('0x95'));return;}if(_0x959002[_0x0fe2('0x96')][_0x0fe2('0x97')]!==_0x0fe2('0x98'))return;return _0x959002[_0x0fe2('0x96')][_0x0fe2('0x99')]({'attributes':['id'],'raw':!![]})[_0x0fe2('0x2c')](function(_0x30a973){if(_['isEmpty'](_0x30a973)){_0x59e89f[_0x0fe2('0x75')](_0x0fe2('0x9a'));_0x9540c[_0x0fe2('0x75')]('i.SmsAccountId\x20IS\x20NULL');}else{_0x59e89f[_0x0fe2('0x75')](_0x0fe2('0x76'),_[_0x0fe2('0x30')](_0x30a973,'id'));_0x9540c[_0x0fe2('0x75')](_0x0fe2('0x76'),_[_0x0fe2('0x30')](_0x30a973,'id'));}});})[_0x0fe2('0x2c')](function(){if(_0x959002[_0x0fe2('0x96')][_0x0fe2('0x97')]===_0x0fe2('0x98')&&!_0x1d609e&&!_0x959002['query']['SmsAccountId'])return[];return db[_0x0fe2('0x9b')][_0x0fe2('0x41')](_0x59e89f[_0x0fe2('0x9c')](),_0x3cce43);})[_0x0fe2('0x2c')](function(_0x438ac7){_0x500616[_0x0fe2('0x25')]=_0x438ac7[_0x0fe2('0x47')];if(_0x500616[_0x0fe2('0x25')]===0x0)return[];return db[_0x0fe2('0x9b')][_0x0fe2('0x41')](_0x14d33f['toString'](),_0x3cce43)[_0x0fe2('0x2c')](function(_0x46ae9e){_0x1da15d=_[_0x0fe2('0x9d')](_0x46ae9e,'id');_0x3cce43=_[_0x0fe2('0x9e')](_0x3cce43,{'model':db['SmsInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x959002['query']['fields']){_0x1da01b[_0x0fe2('0x46')][_0x0fe2('0x73')](function(_0x5a5f64){_0x9540c['field']('i.'+_0x5a5f64);});}else{_0x9540c[_0x0fe2('0x4d')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x0fe2('0x8f'));_0x9540c[_0x0fe2('0x4d')](_0x0fe2('0x9f'),_0x0fe2('0xa0'));_0x9540c[_0x0fe2('0x4d')]('a.mandatoryDisposition',_0x0fe2('0xa1'));_0x9540c[_0x0fe2('0x4d')](_0x0fe2('0xa2'),_0x0fe2('0x90'));_0x9540c[_0x0fe2('0x4d')]('i.*');_0x9540c[_0x0fe2('0x4d')](_0x0fe2('0xa3'),'Contact.firstName');_0x9540c[_0x0fe2('0x4d')](_0x0fe2('0xa4'),_0x0fe2('0xa5'));_0x9540c[_0x0fe2('0x4d')](_0x0fe2('0xa6'),'Contact.email');_0x9540c[_0x0fe2('0x4d')](_0x0fe2('0xa7'),_0x0fe2('0xa8'));_0x9540c[_0x0fe2('0x4d')](_0x0fe2('0xa9'),'Contact.mobile');_0x9540c[_0x0fe2('0x4d')](_0x0fe2('0xaa'),_0x0fe2('0xab'));_0x9540c[_0x0fe2('0x4d')](_0x0fe2('0xac'),_0x0fe2('0xad'));_0x9540c['field'](_0x0fe2('0xae'),'Owner.internal');_0x9540c[_0x0fe2('0x4d')](_0x0fe2('0xaf'),_0x0fe2('0x32'));}if(_0x1da01b['limit'])_0x9540c['limit'](_0x1da01b[_0x0fe2('0x24')]);if(_0x1da01b['offset'])_0x9540c[_0x0fe2('0x22')](_0x1da01b[_0x0fe2('0x22')]);return db[_0x0fe2('0x9b')][_0x0fe2('0x41')](_0x9540c[_0x0fe2('0x9c')](),_0x3cce43);})[_0x0fe2('0x2c')](function(_0x543c72){if(_0x543c72[_0x0fe2('0x47')]>0x0)_0xa36148[_0x0fe2('0x75')](_0x0fe2('0xb0'),_[_0x0fe2('0x30')](_0x543c72,'id'));return db[_0x0fe2('0x9b')]['query'](_0xa36148['toString'](),_0x3cce43)[_0x0fe2('0x2c')](function(_0x17009a){var _0x3e1450=_[_0x0fe2('0xb1')](_0x17009a,_0x0fe2('0xb2'));var _0x333ad0=[];_0x543c72['forEach'](function(_0x4142a2){_0x333ad0[_0x0fe2('0x34')](updateSmsInteraction(_0x4142a2,_0x1da15d,_0x3e1450));});return BPromise[_0x0fe2('0xb3')](_0x333ad0);});});})[_0x0fe2('0x2c')](function(_0xac7f2b){_0x500616[_0x0fe2('0xb4')]=_0xac7f2b;return _0x500616;})['then'](respondWithFilteredResult(_0x2d8e6c,_0x1da01b))[_0x0fe2('0x35')](handleError(_0x2d8e6c,null));};exports['show']=function(_0x12a9f3,_0x3b2b48){var _0x20cc08={'raw':![],'where':{'id':_0x12a9f3['params']['id']}},_0xbcfaae={};_0xbcfaae[_0x0fe2('0x44')]=_['keys'](db['SmsInteraction'][_0x0fe2('0x3e')]);_0xbcfaae[_0x0fe2('0x41')]=_[_0x0fe2('0x71')](_0x12a9f3['query']);_0xbcfaae[_0x0fe2('0x42')]=_['intersection'](_0xbcfaae[_0x0fe2('0x44')],_0xbcfaae[_0x0fe2('0x41')]);_0x20cc08[_0x0fe2('0x46')]=_[_0x0fe2('0x43')](_0xbcfaae[_0x0fe2('0x44')],qs[_0x0fe2('0x45')](_0x12a9f3[_0x0fe2('0x41')][_0x0fe2('0x45')]));_0x20cc08[_0x0fe2('0x46')]=_0x20cc08[_0x0fe2('0x46')][_0x0fe2('0x47')]?_0x20cc08[_0x0fe2('0x46')]:_0xbcfaae['model'];if(_0x12a9f3['query'][_0x0fe2('0xb5')]){_0x20cc08[_0x0fe2('0xb6')]=[{'all':!![]}];}_0x20cc08=_[_0x0fe2('0x9e')]({},_0x20cc08,_0x12a9f3[_0x0fe2('0xb7')]);return db[_0x0fe2('0xb8')]['find'](_0x20cc08)[_0x0fe2('0x2c')](handleEntityNotFound(_0x3b2b48,null))[_0x0fe2('0x2c')](respondWithResult(_0x3b2b48,null))[_0x0fe2('0x35')](handleError(_0x3b2b48,null));};exports[_0x0fe2('0xb9')]=function(_0x295472,_0x1e2e78){return db['SmsInteraction'][_0x0fe2('0xb9')](_0x295472[_0x0fe2('0xba')],{})['then'](respondWithResult(_0x1e2e78,0xc9))[_0x0fe2('0x35')](handleError(_0x1e2e78,null));};exports[_0x0fe2('0x2a')]=function(_0x3f20fc,_0xcf0545){if(_0x3f20fc[_0x0fe2('0xba')]['id']){delete _0x3f20fc['body']['id'];}return db[_0x0fe2('0xb8')][_0x0fe2('0x60')]({'where':{'id':_0x3f20fc['params']['id']}})[_0x0fe2('0x2c')](handleEntityNotFound(_0xcf0545,null))['then'](saveUpdates(_0x3f20fc[_0x0fe2('0xba')],null))[_0x0fe2('0x2c')](respondWithResult(_0xcf0545,null))['catch'](handleError(_0xcf0545,null));};exports[_0x0fe2('0x2b')]=function(_0x338221,_0x5b89a1){return db[_0x0fe2('0xb8')]['find']({'where':{'id':_0x338221[_0x0fe2('0xbb')]['id']}})[_0x0fe2('0x2c')](handleEntityNotFound(_0x5b89a1,null))[_0x0fe2('0x2c')](removeEntity(_0x5b89a1,null))['catch'](handleError(_0x5b89a1,null));};exports[_0x0fe2('0xbc')]=function(_0x3a51f1,_0x46eaa8){return db[_0x0fe2('0xb8')][_0x0fe2('0xbc')]()[_0x0fe2('0x2c')](respondWithResult(_0x46eaa8,null))[_0x0fe2('0x35')](handleError(_0x46eaa8,null));};exports[_0x0fe2('0xbd')]=function(_0x64be3b,_0x42d4b9,_0xc0f9a8){return db[_0x0fe2('0xbe')]['find']({'where':{'id':_0x64be3b[_0x0fe2('0xbb')]['id']}})['then'](handleEntityNotFound(_0x42d4b9,null))[_0x0fe2('0x2c')](function(_0x55820){if(_0x55820){return _0x55820[_0x0fe2('0xbd')](_0x64be3b[_0x0fe2('0xba')][_0x0fe2('0xbf')],_['omit'](_0x64be3b[_0x0fe2('0xba')],['ids','id'])||{});}})[_0x0fe2('0x2c')](respondWithResult(_0x42d4b9,null))['catch'](handleError(_0x42d4b9,null));};exports['getMessages']=function(_0xfd5572,_0x2fe5d2,_0x379f30){var _0x54cb77={'raw':![],'where':{}};var _0xcefb3c={};var _0x262e0c={'count':0x0,'rows':[]};return db[_0x0fe2('0xb8')][_0x0fe2('0xc0')]({'where':{'id':_0xfd5572[_0x0fe2('0xbb')]['id']}})['then'](handleEntityNotFound(_0x2fe5d2,null))[_0x0fe2('0x2c')](function(_0x192056){if(_0x192056){_0xcefb3c[_0x0fe2('0x44')]=_['keys'](db[_0x0fe2('0xbe')][_0x0fe2('0x3e')]);_0xcefb3c['query']=_[_0x0fe2('0x71')](_0xfd5572[_0x0fe2('0x41')]);_0xcefb3c['filters']=_[_0x0fe2('0x43')](_0xcefb3c[_0x0fe2('0x44')],_0xcefb3c[_0x0fe2('0x41')]);_0x54cb77['attributes']=_[_0x0fe2('0x43')](_0xcefb3c[_0x0fe2('0x44')],qs[_0x0fe2('0x45')](_0xfd5572[_0x0fe2('0x41')][_0x0fe2('0x45')]));_0x54cb77[_0x0fe2('0x46')]=_0x54cb77[_0x0fe2('0x46')][_0x0fe2('0x47')]?_0x54cb77[_0x0fe2('0x46')]:_0xcefb3c['model'];if(!_0xfd5572['query'][_0x0fe2('0x48')](_0x0fe2('0x49'))){_0x54cb77['limit']=qs['limit'](_0xfd5572[_0x0fe2('0x41')][_0x0fe2('0x24')]);_0x54cb77[_0x0fe2('0x22')]=qs[_0x0fe2('0x22')](_0xfd5572[_0x0fe2('0x41')]['offset']);}_0x54cb77[_0x0fe2('0x4a')]=qs[_0x0fe2('0x4b')](_0xfd5572[_0x0fe2('0x41')][_0x0fe2('0x4b')]);_0x54cb77['where']=qs['filters'](_[_0x0fe2('0xc1')](_0xfd5572[_0x0fe2('0x41')],_0xcefb3c['filters']));_0x54cb77[_0x0fe2('0x75')][_0x0fe2('0xb2')]=_0x192056['id'];if(_0xfd5572[_0x0fe2('0x41')]['filter']){_0x54cb77[_0x0fe2('0x75')]=_[_0x0fe2('0x9e')](_0x54cb77[_0x0fe2('0x75')],{'$or':_['map'](_0x54cb77[_0x0fe2('0x46')],function(_0xe976c2){var _0x362b0c={};_0x362b0c[_0xe976c2]={'$like':'%'+_0xfd5572[_0x0fe2('0x41')][_0x0fe2('0x83')]+'%'};return _0x362b0c;})});}if(_0xfd5572['query']['$gte']){var _0x1dd5df=_0xfd5572['query']['$gte'][_0x0fe2('0x6d')](',');var _0x457bbf={};_0x457bbf[_0x1dd5df[0x0]]={'$gte':moment(_0x1dd5df[0x1])[_0x0fe2('0xc2')](_0x0fe2('0xc3'))};_0x54cb77[_0x0fe2('0x75')]=_['merge'](_0x54cb77[_0x0fe2('0x75')],_0x457bbf);}_0x54cb77=_[_0x0fe2('0x9e')]({},_0x54cb77,_0xfd5572[_0x0fe2('0xb7')]);return db[_0x0fe2('0xbe')][_0x0fe2('0x25')]({'where':_0x54cb77['where']})[_0x0fe2('0x2c')](function(_0x2978ad){_0x262e0c['count']=_0x2978ad;if(_0xfd5572['query'][_0x0fe2('0xb5')]){_0x54cb77['include']=[{'all':!![]}];}return db[_0x0fe2('0xbe')][_0x0fe2('0xc4')](_0x54cb77);})[_0x0fe2('0x2c')](function(_0x3a09c4){_0x262e0c[_0x0fe2('0xb4')]=_0x3a09c4;return _0x262e0c;});}})['then'](respondWithFilteredResult(_0x2fe5d2,_0x54cb77))['catch'](handleError(_0x2fe5d2,null));};exports[_0x0fe2('0xc5')]=function(_0x27df77,_0xc1272c,_0x320ac8){return db[_0x0fe2('0xb8')][_0x0fe2('0x60')]({'where':{'id':_0x27df77[_0x0fe2('0xbb')]['id']}})[_0x0fe2('0x2c')](handleEntityNotFound(_0xc1272c,null))[_0x0fe2('0x2c')](function(_0x4a6d20){if(_0x4a6d20){return _0x4a6d20[_0x0fe2('0xc6')](_0x27df77[_0x0fe2('0xba')][_0x0fe2('0xbf')],_['omit'](_0x27df77['body'],[_0x0fe2('0xbf'),'id'])||{})[_0x0fe2('0xc7')](function(){return db[_0x0fe2('0x6c')][_0x0fe2('0xc4')]({'attributes':['id',_0x0fe2('0x2d'),_0x0fe2('0xc8')],'where':{'id':_0x27df77[_0x0fe2('0xba')][_0x0fe2('0xbf')]}});})[_0x0fe2('0x2c')](function(_0x148b2d){socket[_0x0fe2('0xc9')](_0x0fe2('0xca'),{'id':Number(_0x27df77[_0x0fe2('0xbb')]['id']),'tags':_0x148b2d||[]});return{'id':Number(_0x27df77['params']['id']),'tags':_0x148b2d||[]};});}})['then'](respondWithResult(_0xc1272c,null))[_0x0fe2('0x35')](handleError(_0xc1272c,null));};exports[_0x0fe2('0xcb')]=function(_0x3acae4,_0x1a8e7d,_0x401e7d){return db[_0x0fe2('0xb8')]['find']({'where':{'id':_0x3acae4['params']['id']}})['then'](handleEntityNotFound(_0x1a8e7d,null))['then'](function(_0x53514b){if(_0x53514b){return _0x53514b[_0x0fe2('0xcb')](_0x3acae4[_0x0fe2('0x41')][_0x0fe2('0xbf')]);}})['then'](respondWithStatusCode(_0x1a8e7d,null))[_0x0fe2('0x35')](handleError(_0x1a8e7d,null));};exports[_0x0fe2('0xcc')]=function(_0x29883f,_0x4deec9){var _0x15dc19=moment()[_0x0fe2('0xcd')]()[_0x0fe2('0x9c')]();var _0x5efb47=path[_0x0fe2('0xce')](config[_0x0fe2('0xcf')],_0x0fe2('0xd0'),_0x0fe2('0xd1'),'tmp');var _0x5a9217=path['join'](config['root'],'server',_0x0fe2('0xd1'),_0x0fe2('0xd2'));var _0x1b0d49=path[_0x0fe2('0xce')](_0x5efb47,_0x15dc19);var _0x2a841b=util[_0x0fe2('0xc2')](_0x0fe2('0xd3'),_0x29883f['params']['id'],_0x15dc19);var _0x550bce=path[_0x0fe2('0xce')](_0x5efb47,_0x2a841b);var _0x4f7cdd=[];_0x4f7cdd['push']({'model':db[_0x0fe2('0x6f')],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x4f7cdd['push']({'model':db[_0x0fe2('0xd4')],'as':_0x0fe2('0x64'),'attributes':['id',_0x0fe2('0xd5'),'lastName'],'raw':!![]});var _0x2f43a5=[{'model':db[_0x0fe2('0xbe')],'as':_0x0fe2('0xd6'),'attributes':['id','body',_0x0fe2('0x78'),_0x0fe2('0xd7'),_0x0fe2('0xd8'),_0x0fe2('0x7e')],'include':_0x4f7cdd}];_0x2f43a5[_0x0fe2('0x34')]({'model':db[_0x0fe2('0xd9')],'as':'Account','attributes':['id',_0x0fe2('0x2d')]});_0x2f43a5[_0x0fe2('0x34')]({'model':db['User'],'as':_0x0fe2('0xda'),'attributes':['id',_0x0fe2('0x31')]});return db[_0x0fe2('0xb8')][_0x0fe2('0x60')]({'where':{'id':_0x29883f[_0x0fe2('0xbb')]['id']},'include':_0x2f43a5})[_0x0fe2('0x2c')](handleEntityNotFound(_0x4deec9,null))[_0x0fe2('0x2c')](function(_0xb483e0){if(_0xb483e0){var _0x452214=_0xb483e0[_0x0fe2('0xdb')]({'plain':!![]});fs[_0x0fe2('0xdc')](_0x1b0d49);var _0x3fda07={'channel':'Sms','account':_0x452214[_0x0fe2('0xdd')][_0x0fe2('0x2d')],'agent':_0x452214[_0x0fe2('0xda')]?_0x452214[_0x0fe2('0xda')][_0x0fe2('0x31')]:'N.A.','createdAt':moment(_0x452214[_0x0fe2('0x78')])['format'](_0x0fe2('0xc3'))[_0x0fe2('0x9c')](),'closedAt':_0x452214[_0x0fe2('0x38')]?moment(_0x452214[_0x0fe2('0xde')])['format'](_0x0fe2('0xc3'))[_0x0fe2('0x9c')]():'','disposition':_0x452214[_0x0fe2('0xdf')],'messages':_(_0x452214[_0x0fe2('0xd6')])[_0x0fe2('0x83')]({'secret':![]})[_0x0fe2('0x30')](function(_0x562d86){return{'date':moment(_0x562d86[_0x0fe2('0x78')])[_0x0fe2('0xc2')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x562d86[_0x0fe2('0xd7')]===_0x0fe2('0xe0')?_0x562d86[_0x0fe2('0x6f')]?_0x562d86[_0x0fe2('0x6f')][_0x0fe2('0x31')]:_0x0fe2('0xe1'):_0x562d86[_0x0fe2('0x64')][_0x0fe2('0xd5')]+(_0x562d86[_0x0fe2('0x64')][_0x0fe2('0xe2')]?'\x20'+_0x562d86['Contact'][_0x0fe2('0xe2')]:''),'body':_0x562d86[_0x0fe2('0xba')],'direction':_0x562d86[_0x0fe2('0xd7')]==='out'?'A':'C','secret':_0x562d86[_0x0fe2('0xd8')],'read':_0x562d86[_0x0fe2('0x7e')]};})[_0x0fe2('0x61')]()};return ejs[_0x0fe2('0xe3')](path['join'](config['root'],_0x0fe2('0xd0'),_0x0fe2('0xe4'),_0x0fe2('0xe5')),{'interaction':_0x3fda07})[_0x0fe2('0x2c')](function(_0x36e653){var _0x4db940=path[_0x0fe2('0xce')](_0x1b0d49,_0x0fe2('0xe6')+_0x452214['id']+'-'+_0x15dc19+_0x0fe2('0xe7'));var _0x36357e={'path':_0x4db940,'channel':'Sms','interactionId':_0x452214['id']};return pdf[_0x0fe2('0xe8')](_0x36e653,_0x36357e);})['then'](function(){return new BPromise(function(_0x57129f,_0x30793f){zipdir(_0x1b0d49,{'saveTo':_0x550bce},function(_0x258a58,_0x50298d){if(_0x258a58)return _0x30793f(_0x258a58);return _0x57129f(_0x50298d);});})['then'](function(){return new BPromise(function(_0x482e22,_0x1dd515){rimraf(_0x1b0d49,function(_0x52644b){if(_0x52644b)_0x1dd515(_0x52644b);return _0x482e22();});});})[_0x0fe2('0x2c')](function(){return _0x4deec9[_0x0fe2('0xcc')](_0x550bce,_0x2a841b,function(_0x559145){if(_0x559145){console[_0x0fe2('0xe9')](_0x0fe2('0xea'),_0x559145);}else{fs[_0x0fe2('0xeb')](_0x550bce);}});});});}else{return _0x4deec9['sendStatus'](0xc8);}})[_0x0fe2('0x35')](handleError(_0x4deec9,null));}; \ No newline at end of file +var _0x366d=['ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','sendStatus','stack','name','send','Users','fullname','TagIds','Tags','split','catch','waiting','unmanaged','total','closed','UserId','answered','talking','index','map','SmsInteraction','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','select','field','u.fullname','ui.SmsInteractionId','from','left_join','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','sms_accounts','a.id\x20=\x20i.SmsAccountId','sms_messages','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','having','`\x20>\x200','Contact','$substring','value','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','text','start','Tag','forEach','union','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','find','buildExpression','body','some','compact','SmsAccountId','where','i.SmsAccountId\x20IN\x20?','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','isEmpty','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','agent','user','i.SmsAccountId\x20IS\x20NULL','role','sequelize','toString','keyBy','merge','unreadMessages','a.key','Account.key','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','SmsInteractionId','push','all','show','params','includeAll','include','options','create','describe','addMessage','SmsMessage','ids','omit','findOne','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','setTags','spread','color','emit','smsInteractionTags:save','removeTags','download','unix','root','server','files','tmp','join','attachments','format','transcript-%d-%s.zip','User','firstName','lastName','Messages','direction','secret','SmsAccount','Account','Owner','get','mkdirSync','N.A.','closedAt','disposition','out','System','renderFile','views','downloadInteraction.ejs','Sms','createPdfFromHTML','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x273c39,_0x1052e6){var _0x46d6b5=function(_0x44f1fb){while(--_0x44f1fb){_0x273c39['push'](_0x273c39['shift']());}};_0x46d6b5(++_0x1052e6);}(_0x366d,0xde));var _0xd366=function(_0x3e8021,_0x281cd3){_0x3e8021=_0x3e8021-0x0;var _0x4310a9=_0x366d[_0x3e8021];return _0x4310a9;};'use strict';var emlformat=require(_0xd366('0x0'));var rimraf=require(_0xd366('0x1'));var zipdir=require(_0xd366('0x2'));var jsonpatch=require(_0xd366('0x3'));var rp=require(_0xd366('0x4'));var moment=require(_0xd366('0x5'));var BPromise=require(_0xd366('0x6'));var Mustache=require(_0xd366('0x7'));var util=require(_0xd366('0x8'));var path=require(_0xd366('0x9'));var sox=require(_0xd366('0xa'));var csv=require(_0xd366('0xb'));var ejs=require(_0xd366('0xc'));var fs=require('fs');var fs_extra=require(_0xd366('0xd'));var _=require(_0xd366('0xe'));var squel=require(_0xd366('0xf'));var crypto=require(_0xd366('0x10'));var jsforce=require(_0xd366('0x11'));var deskjs=require(_0xd366('0x12'));var toCsv=require(_0xd366('0xb'));var querystring=require(_0xd366('0x13'));var Papa=require(_0xd366('0x14'));var Redis=require(_0xd366('0x15'));var authService=require(_0xd366('0x16'));var qs=require(_0xd366('0x17'));var as=require('../../components/parsers/advancedSearch');var pdf=require('../../components/export/pdf');var hardwareService=require(_0xd366('0x18'));var logger=require(_0xd366('0x19'))(_0xd366('0x1a'));var utils=require(_0xd366('0x1b'));var config=require(_0xd366('0x1c'));var licenseUtil=require('../../config/license/util');var db=require(_0xd366('0x1d'))['db'];config[_0xd366('0x1e')]=_['defaults'](config[_0xd366('0x1e')],{'host':_0xd366('0x1f'),'port':0x18eb});var socket=require(_0xd366('0x20'))(new Redis(config[_0xd366('0x1e')]));require(_0xd366('0x21'))[_0xd366('0x22')](socket);function respondWithStatusCode(_0x193c72,_0x3e6619){_0x3e6619=_0x3e6619||0xcc;return function(_0x459d68){if(_0x459d68){return _0x193c72['sendStatus'](_0x3e6619);}return _0x193c72['status'](_0x3e6619)[_0xd366('0x23')]();};}function respondWithResult(_0x31fc49,_0xa7d330){_0xa7d330=_0xa7d330||0xc8;return function(_0x733901){if(_0x733901){return _0x31fc49[_0xd366('0x24')](_0xa7d330)[_0xd366('0x25')](_0x733901);}};}function respondWithFilteredResult(_0x112fd3,_0x526cfb){return function(_0xe9cf29){if(_0xe9cf29){var _0x160324=typeof _0x526cfb[_0xd366('0x26')]===_0xd366('0x27')&&typeof _0x526cfb[_0xd366('0x28')]===_0xd366('0x27');var _0x540f91=_0xe9cf29[_0xd366('0x29')];var _0xb82466=_0x160324?0x0:_0x526cfb['offset'];var _0x1c2a49=_0x160324?_0xe9cf29[_0xd366('0x29')]:_0x526cfb[_0xd366('0x26')]+_0x526cfb[_0xd366('0x28')];var _0x22a33c;if(_0x1c2a49>=_0x540f91){_0x1c2a49=_0x540f91;_0x22a33c=0xc8;}else{_0x22a33c=0xce;}_0x112fd3['status'](_0x22a33c);return _0x112fd3[_0xd366('0x2a')](_0xd366('0x2b'),_0xb82466+'-'+_0x1c2a49+'/'+_0x540f91)['json'](_0xe9cf29);}return null;};}function patchUpdates(_0x49922a){return function(_0x23958f){try{jsonpatch['apply'](_0x23958f,_0x49922a,!![]);}catch(_0x1694fb){return BPromise[_0xd366('0x2c')](_0x1694fb);}return _0x23958f[_0xd366('0x2d')]();};}function saveUpdates(_0x2cd972,_0xfdf761){return function(_0x277bca){if(_0x277bca){return _0x277bca[_0xd366('0x2e')](_0x2cd972)[_0xd366('0x2f')](function(_0x5a61f4){return _0x5a61f4;});}return null;};}function removeEntity(_0x296fc1,_0x1c9dd9){return function(_0x2402e2){if(_0x2402e2){return _0x2402e2[_0xd366('0x30')]()['then'](function(){_0x296fc1[_0xd366('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0xb68d1,_0x44be06){return function(_0x3a535b){if(!_0x3a535b){_0xb68d1[_0xd366('0x31')](0x194);}return _0x3a535b;};}function handleError(_0x198abc,_0x5c0e1a){_0x5c0e1a=_0x5c0e1a||0x1f4;return function(_0x1833f9){logger['error'](_0x1833f9[_0xd366('0x32')]);if(_0x1833f9[_0xd366('0x33')]){delete _0x1833f9[_0xd366('0x33')];}_0x198abc[_0xd366('0x24')](_0x5c0e1a)[_0xd366('0x34')](_0x1833f9);};}function getInteractionUsers(_0x4bbe40,_0x5b6c3e){return new BPromise(function(_0x467c79,_0x9472c5){try{if(_0x5b6c3e[_0x4bbe40['id']]){_0x4bbe40[_0xd366('0x35')]=_['map'](_0x5b6c3e[_0x4bbe40['id']],function(_0x52d602){return{'id':_0x52d602['id'],'fullname':_0x52d602[_0xd366('0x36')]};});}}catch(_0x102ae0){_0x9472c5(_0x102ae0);}_0x467c79(_0x4bbe40);});}function getInteractionTags(_0x101f6e,_0x421b4b){return new BPromise(function(_0x4b8699,_0x8c55e9){try{if(_0x101f6e[_0xd366('0x37')]){_0x101f6e[_0xd366('0x38')]=[];_0x101f6e[_0xd366('0x37')][_0xd366('0x39')](',')['forEach'](function(_0x25c55b){_0x101f6e['Tags']['push'](_0x421b4b[_0x25c55b]);});}delete _0x101f6e[_0xd366('0x37')];}catch(_0x2d9374){_0x8c55e9(_0x2d9374);}_0x4b8699(_0x101f6e);});}function updateSmsInteraction(_0x32102f,_0x118b69,_0x533ab9){return new BPromise(function(_0x80aba7,_0x1f6e72){return getInteractionUsers(_0x32102f,_0x533ab9)['then'](function(_0x549dea){return getInteractionTags(_0x549dea,_0x118b69);})[_0xd366('0x2f')](function(_0x4f25c3){return getStateInteraction(_0x4f25c3);})[_0xd366('0x2f')](function(_0x5cf123){_0x80aba7(_0x5cf123);})[_0xd366('0x3a')](function(_0x1e014f){_0x1f6e72(_0x1e014f);});});}function getStateInteraction(_0x2d9cce){return new BPromise(function(_0x2e075a){_0x2d9cce[_0xd366('0x3b')]=0x0;_0x2d9cce['talking']=0x0;_0x2d9cce['answered']=0x0;_0x2d9cce[_0xd366('0x3c')]=0x0;_0x2d9cce[_0xd366('0x3d')]=0x0;if(!_0x2d9cce[_0xd366('0x3e')]&&!_0x2d9cce[_0xd366('0x3f')]){_0x2d9cce[_0xd366('0x3b')]+=0x1;}if(!_0x2d9cce[_0xd366('0x3e')]&&_0x2d9cce['UserId']){_0x2d9cce['talking']+=0x1;if(_0x2d9cce[_0xd366('0x3b')]){_0x2d9cce[_0xd366('0x3b')]-=0x1;}}if(_0x2d9cce[_0xd366('0x3e')]&&_0x2d9cce[_0xd366('0x3f')]){_0x2d9cce[_0xd366('0x40')]+=0x1;if(_0x2d9cce[_0xd366('0x41')]){_0x2d9cce[_0xd366('0x41')]-=0x1;}}if(_0x2d9cce[_0xd366('0x3e')]&&!_0x2d9cce[_0xd366('0x3f')]){_0x2d9cce[_0xd366('0x3c')]+=0x1;if(_0x2d9cce[_0xd366('0x3b')]){_0x2d9cce[_0xd366('0x3b')]-=0x1;}}_0x2d9cce[_0xd366('0x3d')]+=0x1;_0x2e075a(_0x2d9cce);});}exports[_0xd366('0x42')]=function(_0x1cd6a8,_0x2eeec5){var _0x34191a={},_0x34cfe7={},_0x5b6172={'count':0x0,'rows':[]};var _0x52a820=_[_0xd366('0x43')](db[_0xd366('0x44')][_0xd366('0x45')],function(_0x26e3e2){return{'name':_0x26e3e2[_0xd366('0x46')],'type':_0x26e3e2[_0xd366('0x47')][_0xd366('0x48')]};});_0x34cfe7[_0xd366('0x49')]=_[_0xd366('0x43')](_0x52a820,'name');_0x34cfe7[_0xd366('0x4a')]=_[_0xd366('0x4b')](_0x1cd6a8[_0xd366('0x4a')]);_0x34cfe7[_0xd366('0x4c')]=_[_0xd366('0x4d')](_0x34cfe7[_0xd366('0x49')],_0x34cfe7[_0xd366('0x4a')]);_0x34191a[_0xd366('0x4e')]=_['intersection'](_0x34cfe7[_0xd366('0x49')],qs[_0xd366('0x4f')](_0x1cd6a8[_0xd366('0x4a')][_0xd366('0x4f')]));_0x34191a[_0xd366('0x4e')]=_0x34191a[_0xd366('0x4e')][_0xd366('0x50')]?_0x34191a['attributes']:_0x34cfe7['model'];if(!_0x1cd6a8[_0xd366('0x4a')][_0xd366('0x51')](_0xd366('0x52'))){_0x34191a[_0xd366('0x28')]=qs['limit'](_0x1cd6a8['query'][_0xd366('0x28')]);_0x34191a[_0xd366('0x26')]=qs['offset'](_0x1cd6a8['query'][_0xd366('0x26')]);}_0x34191a[_0xd366('0x53')]=qs[_0xd366('0x54')](_0x1cd6a8[_0xd366('0x4a')][_0xd366('0x54')]);_0x34191a['where']=qs[_0xd366('0x4c')](_[_0xd366('0x55')](_0x1cd6a8['query'],_0x34cfe7[_0xd366('0x4c')]),_0x52a820);var _0x58e881=[];var _0x2057d9=squel[_0xd366('0x56')]()['field']('id')['field'](_0xd366('0x33'))[_0xd366('0x57')]('color')['from']('tools_tags');var _0x2e8bb7=squel[_0xd366('0x56')]()[_0xd366('0x57')]('u.id')[_0xd366('0x57')](_0xd366('0x58'))[_0xd366('0x57')](_0xd366('0x59'))[_0xd366('0x5a')]('user_has_sms_interactions','ui')[_0xd366('0x5b')]('users','u',_0xd366('0x5c'));var _0x56c845=squel[_0xd366('0x56')]()[_0xd366('0x5a')]('sms_interactions','i')[_0xd366('0x5b')](_0xd366('0x5d'),'c',_0xd366('0x5e'))[_0xd366('0x5b')](_0xd366('0x5f'),'o','o.id\x20=\x20i.UserId')[_0xd366('0x5b')](_0xd366('0x60'),'a',_0xd366('0x61'))[_0xd366('0x5b')](_0xd366('0x62'),'me','me.SmsInteractionId\x20=\x20i.id')[_0xd366('0x5b')]('sms_interaction_has_tags','it',_0xd366('0x63'))[_0xd366('0x5b')]('tools_tags','t',_0xd366('0x64'));var _0x1ec180=squel['expr']();var _0x41516a=[];var _0x33390b=squel[_0xd366('0x65')]();var _0x5735ce;if(_0x1cd6a8[_0xd366('0x4a')][_0xd366('0x66')]){_0x5735ce=as[_0xd366('0x67')](_0x1cd6a8[_0xd366('0x4a')][_0xd366('0x66')]);var _0xd80293=_0x5735ce[_0xd366('0x68')];for(var _0x59fbae=0x0;_0x59fbae<_0x5735ce[_0xd366('0x69')][_0xd366('0x50')];_0x59fbae++){var _0x4732fc=_0x5735ce[_0xd366('0x69')][_0x59fbae];var _0x337727='i';var _0x138ce6=_['find'](_0x52a820,[_0xd366('0x33'),_0x4732fc[_0xd366('0x57')]]);if(!_0x138ce6){switch(_0x4732fc[_0xd366('0x57')]){case'unreadMessages':if(_0x4732fc['value']==0x1){_0x56c845['having']('`'+_0x4732fc[_0xd366('0x57')]+'`\x20=\x200');}else{_0x56c845[_0xd366('0x6a')]('`'+_0x4732fc['field']+_0xd366('0x6b'));}break;case _0xd366('0x6c'):if(_0x4732fc['operator']===_0xd366('0x6d')){if(_0x4732fc[_0xd366('0x6e')][_0xd366('0x39')]('\x20')[_0xd366('0x50')]>0x1){_0x1ec180[_0xd80293]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xd366('0x6f')](_0x4732fc['value']),null);}else{var _0x76555f='%'+_0x4732fc[_0xd366('0x6e')]+'%';_0x1ec180[_0xd80293](_0xd366('0x70'),_0x76555f,_0x76555f,_0x76555f);}}else{_0x138ce6=_['find'](_0x52a820,[_0xd366('0x33'),'ContactId']);_0x4732fc[_0xd366('0x57')]='ContactId';_0x4542f7=as['buildExpression'](_0x337727,_0x138ce6[_0xd366('0x47')],_0x4732fc);_0x1ec180[_0xd80293](_0x4542f7[_0xd366('0x71')],_0x4542f7[_0xd366('0x6e')][_0xd366('0x72')],_0x4542f7[_0xd366('0x6e')][_0xd366('0x23')]);}break;case _0xd366('0x73'):var _0x386374=_0x4732fc['value'][_0xd366('0x39')](',')[_0xd366('0x43')](function(_0x53edaf){return Number(_0x53edaf);});_0x386374[_0xd366('0x74')](function(_0x6ceccc){_0x33390b['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x6ceccc+',%');});_0x41516a=_[_0xd366('0x75')](_0x41516a,_0x386374);break;case'User':if(_0x4732fc[_0xd366('0x76')]===_0xd366('0x6d')){_0x1ec180[_0xd80293](_0xd366('0x77'),'%'+_0x4732fc[_0xd366('0x6e')]+'%',null);}else{_0x138ce6=_[_0xd366('0x78')](_0x52a820,['name',_0xd366('0x3f')]);_0x4732fc[_0xd366('0x57')]='UserId';_0x4542f7=as[_0xd366('0x79')](_0x337727,_0x138ce6[_0xd366('0x47')],_0x4732fc);_0x1ec180[_0xd80293](_0x4542f7[_0xd366('0x71')],_0x4542f7[_0xd366('0x6e')][_0xd366('0x72')],_0x4542f7[_0xd366('0x6e')][_0xd366('0x23')]);}break;case _0xd366('0x7a'):_0x4542f7=as[_0xd366('0x79')]('me',null,_0x4732fc);_0x1ec180[_0xd80293](_0x4542f7[_0xd366('0x71')],_0x4542f7[_0xd366('0x6e')][_0xd366('0x72')],_0x4542f7[_0xd366('0x6e')][_0xd366('0x23')]);break;}}else{var _0x4542f7=as[_0xd366('0x79')](_0x337727,_0x138ce6['type'],_0x4732fc);_0x1ec180[_0xd80293](_0x4542f7[_0xd366('0x71')],_0x4542f7['value']['start'],_0x4542f7[_0xd366('0x6e')][_0xd366('0x23')]);}}}else{var _0x422cb8=_(_0x1cd6a8['query'])[_0xd366('0x4b')]()[_0xd366('0x43')](function(_0x30c892){return _[_0xd366('0x7b')](_0x52a820,[_0xd366('0x33'),_0x30c892])?_0x30c892:undefined;})[_0xd366('0x7c')]()['value']();if(!_['isEmpty'](_0x422cb8)){_0x422cb8[_0xd366('0x74')](function(_0x23f619){if(_0x23f619===_0xd366('0x7d')){_0x56c845[_0xd366('0x7e')](_0xd366('0x7f'),[]['concat'](_0x1cd6a8[_0xd366('0x4a')][_0x23f619]));}else if(_0x23f619===_0xd366('0x80')){var _0x2ca9d8=JSON[_0xd366('0x81')](_0x1cd6a8[_0xd366('0x4a')][_0x23f619])[_0xd366('0x82')];var _0xa52e21=JSON[_0xd366('0x81')](_0x1cd6a8[_0xd366('0x4a')][_0x23f619])[_0xd366('0x83')];_0x56c845['where'](_0xd366('0x84'),_0x2ca9d8,_0xa52e21);}else{if(_0x1cd6a8[_0xd366('0x4a')][_0x23f619]==='null'){_0x56c845[_0xd366('0x7e')]('i.'+_0x23f619+_0xd366('0x85'));}else{_0x56c845[_0xd366('0x7e')]('i.'+_0x23f619+_0xd366('0x86'),_0x1cd6a8[_0xd366('0x4a')][_0x23f619]);}}});}if(_0x1cd6a8[_0xd366('0x4a')]['read']){if(_0x1cd6a8[_0xd366('0x4a')][_0xd366('0x87')]==0x1){_0x56c845['having'](_0xd366('0x88'));}else{_0x56c845[_0xd366('0x6a')](_0xd366('0x89'));}}if(_0x1cd6a8[_0xd366('0x4a')][_0xd366('0x8a')]){_0x41516a=_['isArray'](_0x1cd6a8[_0xd366('0x4a')][_0xd366('0x8a')])?_0x1cd6a8['query'][_0xd366('0x8a')]:new Array(_0x1cd6a8[_0xd366('0x4a')][_0xd366('0x8a')]);_0x41516a[_0xd366('0x74')](function(_0x412a91){_0x33390b['or'](_0xd366('0x8b'),'%,'+_0x412a91+',%');});}if(_0x1cd6a8['query'][_0xd366('0x8c')]){var _0x54e618=_0x1cd6a8[_0xd366('0x4a')][_0xd366('0x8c')][_0xd366('0x8d')]('\x5c','\x5c\x5c')[_0xd366('0x8d')](/'/g,'\x27\x27');if(qs[_0xd366('0x8e')](_0x54e618)){_0x1ec180['or'](_0xd366('0x8f'),_0x54e618+'%')['or'](_0xd366('0x90'),_0x54e618+'%');}else{_0x1ec180['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xd366('0x6f')](_0x54e618))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x54e618+'%');}}}_0x56c845[_0xd366('0x7e')](_0x1ec180);_0x56c845['group'](_0xd366('0x91'));var _0x195edb={'type':db[_0xd366('0x92')][_0xd366('0x93')][_0xd366('0x94')],'raw':!![]};var _0x3aa92b=_0x56c845[_0xd366('0x95')]();_0x3aa92b[_0xd366('0x57')](_0xd366('0x91'));_0x3aa92b[_0xd366('0x57')](_0xd366('0x96'),'unreadMessages');if(_0x34191a['order']){_0x34191a[_0xd366('0x53')][_0xd366('0x74')](function(_0x3515b5){var _0x4b35f0=_0x3515b5[0x0]===_0xd366('0x97')?_0x3515b5[0x0]:'i.'+_0x3515b5[0x0];_0x56c845[_0xd366('0x53')](_0x4b35f0,_0x3515b5[0x1]===_0xd366('0x98')?![]:!![]);});}if(!_[_0xd366('0x99')](_0x41516a)){_0x56c845['having'](_0x33390b);_0x3aa92b[_0xd366('0x7e')](_0xd366('0x9a'),_0x41516a);}BPromise[_0xd366('0x9b')]()[_0xd366('0x2f')](function(){if(!_0x5735ce){if(_0x1cd6a8[_0xd366('0x4a')][_0xd366('0x7d')])return;_0x3aa92b[_0xd366('0x7e')](_0xd366('0x9c'));_0x56c845[_0xd366('0x7e')](_0xd366('0x9c'));return;}if(_0x1cd6a8['user']['role']!==_0xd366('0x9d'))return;return _0x1cd6a8[_0xd366('0x9e')]['getSmsAccounts']({'attributes':['id'],'raw':!![]})[_0xd366('0x2f')](function(_0x2bc8bc){if(_[_0xd366('0x99')](_0x2bc8bc)){_0x3aa92b['where'](_0xd366('0x9f'));_0x56c845[_0xd366('0x7e')](_0xd366('0x9f'));}else{_0x3aa92b[_0xd366('0x7e')](_0xd366('0x7f'),_['map'](_0x2bc8bc,'id'));_0x56c845[_0xd366('0x7e')](_0xd366('0x7f'),_[_0xd366('0x43')](_0x2bc8bc,'id'));}});})[_0xd366('0x2f')](function(){if(_0x1cd6a8['user'][_0xd366('0xa0')]===_0xd366('0x9d')&&!_0x5735ce&&!_0x1cd6a8['query'][_0xd366('0x7d')])return[];return db[_0xd366('0xa1')][_0xd366('0x4a')](_0x3aa92b['toString'](),_0x195edb);})['then'](function(_0x1b6d6f){_0x5b6172[_0xd366('0x29')]=_0x1b6d6f[_0xd366('0x50')];if(_0x5b6172['count']===0x0)return[];return db['sequelize'][_0xd366('0x4a')](_0x2057d9[_0xd366('0xa2')](),_0x195edb)[_0xd366('0x2f')](function(_0x14109e){_0x58e881=_[_0xd366('0xa3')](_0x14109e,'id');_0x195edb=_[_0xd366('0xa4')](_0x195edb,{'model':db[_0xd366('0x44')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1cd6a8[_0xd366('0x4a')]['fields']){_0x34191a[_0xd366('0x4e')][_0xd366('0x74')](function(_0x164ff0){_0x56c845[_0xd366('0x57')]('i.'+_0x164ff0);});}else{_0x56c845['field'](_0xd366('0x96'),_0xd366('0xa5'));_0x56c845[_0xd366('0x57')](_0xd366('0xa6'),_0xd366('0xa7'));_0x56c845['field']('a.mandatoryDisposition',_0xd366('0xa8'));_0x56c845[_0xd366('0x57')](_0xd366('0xa9'),'contactName');_0x56c845[_0xd366('0x57')]('i.*');_0x56c845[_0xd366('0x57')](_0xd366('0xaa'),_0xd366('0xab'));_0x56c845[_0xd366('0x57')](_0xd366('0xac'),_0xd366('0xad'));_0x56c845[_0xd366('0x57')](_0xd366('0xae'),_0xd366('0xaf'));_0x56c845[_0xd366('0x57')](_0xd366('0xb0'),_0xd366('0xb1'));_0x56c845[_0xd366('0x57')](_0xd366('0xb2'),_0xd366('0xb3'));_0x56c845[_0xd366('0x57')](_0xd366('0xb4'),'Contact.fax');_0x56c845[_0xd366('0x57')]('o.fullname',_0xd366('0xb5'));_0x56c845[_0xd366('0x57')](_0xd366('0xb6'),_0xd366('0xb7'));_0x56c845['field'](_0xd366('0xb8'),_0xd366('0x37'));}if(_0x34191a[_0xd366('0x28')])_0x56c845[_0xd366('0x28')](_0x34191a[_0xd366('0x28')]);if(_0x34191a[_0xd366('0x26')])_0x56c845[_0xd366('0x26')](_0x34191a[_0xd366('0x26')]);return db[_0xd366('0xa1')][_0xd366('0x4a')](_0x56c845[_0xd366('0xa2')](),_0x195edb);})[_0xd366('0x2f')](function(_0x56b5fe){if(_0x56b5fe[_0xd366('0x50')]>0x0)_0x2e8bb7[_0xd366('0x7e')]('ui.SmsInteractionId\x20IN\x20?',_[_0xd366('0x43')](_0x56b5fe,'id'));return db[_0xd366('0xa1')][_0xd366('0x4a')](_0x2e8bb7[_0xd366('0xa2')](),_0x195edb)[_0xd366('0x2f')](function(_0x4dda99){var _0x85823=_[_0xd366('0xb9')](_0x4dda99,_0xd366('0xba'));var _0x4ac154=[];_0x56b5fe[_0xd366('0x74')](function(_0x4e7475){_0x4ac154[_0xd366('0xbb')](updateSmsInteraction(_0x4e7475,_0x58e881,_0x85823));});return BPromise[_0xd366('0xbc')](_0x4ac154);});});})[_0xd366('0x2f')](function(_0x2dfb9f){_0x5b6172['rows']=_0x2dfb9f;return _0x5b6172;})[_0xd366('0x2f')](respondWithFilteredResult(_0x2eeec5,_0x34191a))[_0xd366('0x3a')](handleError(_0x2eeec5,null));};exports[_0xd366('0xbd')]=function(_0x2c5105,_0x11ded0){var _0x264813={'raw':![],'where':{'id':_0x2c5105[_0xd366('0xbe')]['id']}},_0x50b62b={};_0x50b62b['model']=_[_0xd366('0x4b')](db[_0xd366('0x44')][_0xd366('0x45')]);_0x50b62b[_0xd366('0x4a')]=_['keys'](_0x2c5105[_0xd366('0x4a')]);_0x50b62b[_0xd366('0x4c')]=_['intersection'](_0x50b62b[_0xd366('0x49')],_0x50b62b[_0xd366('0x4a')]);_0x264813[_0xd366('0x4e')]=_[_0xd366('0x4d')](_0x50b62b[_0xd366('0x49')],qs[_0xd366('0x4f')](_0x2c5105[_0xd366('0x4a')][_0xd366('0x4f')]));_0x264813[_0xd366('0x4e')]=_0x264813[_0xd366('0x4e')][_0xd366('0x50')]?_0x264813[_0xd366('0x4e')]:_0x50b62b['model'];if(_0x2c5105['query'][_0xd366('0xbf')]){_0x264813[_0xd366('0xc0')]=[{'all':!![]}];}_0x264813=_[_0xd366('0xa4')]({},_0x264813,_0x2c5105[_0xd366('0xc1')]);return db[_0xd366('0x44')][_0xd366('0x78')](_0x264813)['then'](handleEntityNotFound(_0x11ded0,null))['then'](respondWithResult(_0x11ded0,null))[_0xd366('0x3a')](handleError(_0x11ded0,null));};exports[_0xd366('0xc2')]=function(_0x145865,_0x4f8302){return db[_0xd366('0x44')][_0xd366('0xc2')](_0x145865['body'],{})['then'](respondWithResult(_0x4f8302,0xc9))[_0xd366('0x3a')](handleError(_0x4f8302,null));};exports[_0xd366('0x2e')]=function(_0x59e9e9,_0x3dce94){if(_0x59e9e9['body']['id']){delete _0x59e9e9[_0xd366('0x7a')]['id'];}return db['SmsInteraction']['find']({'where':{'id':_0x59e9e9['params']['id']}})[_0xd366('0x2f')](handleEntityNotFound(_0x3dce94,null))[_0xd366('0x2f')](saveUpdates(_0x59e9e9[_0xd366('0x7a')],null))['then'](respondWithResult(_0x3dce94,null))[_0xd366('0x3a')](handleError(_0x3dce94,null));};exports[_0xd366('0x30')]=function(_0x1a4949,_0x3872cc){return db[_0xd366('0x44')][_0xd366('0x78')]({'where':{'id':_0x1a4949[_0xd366('0xbe')]['id']}})['then'](handleEntityNotFound(_0x3872cc,null))[_0xd366('0x2f')](removeEntity(_0x3872cc,null))['catch'](handleError(_0x3872cc,null));};exports['describe']=function(_0x2997d6,_0x212f5b){return db['SmsInteraction'][_0xd366('0xc3')]()[_0xd366('0x2f')](respondWithResult(_0x212f5b,null))[_0xd366('0x3a')](handleError(_0x212f5b,null));};exports[_0xd366('0xc4')]=function(_0x30f0d0,_0x540025,_0x4d4d0c){return db[_0xd366('0xc5')]['find']({'where':{'id':_0x30f0d0[_0xd366('0xbe')]['id']}})[_0xd366('0x2f')](handleEntityNotFound(_0x540025,null))[_0xd366('0x2f')](function(_0x13ebdb){if(_0x13ebdb){return _0x13ebdb[_0xd366('0xc4')](_0x30f0d0[_0xd366('0x7a')][_0xd366('0xc6')],_[_0xd366('0xc7')](_0x30f0d0[_0xd366('0x7a')],['ids','id'])||{});}})[_0xd366('0x2f')](respondWithResult(_0x540025,null))[_0xd366('0x3a')](handleError(_0x540025,null));};exports['getMessages']=function(_0x42e668,_0x380fda,_0x50d823){var _0x5210bc={'raw':![],'where':{}};var _0x521a6b={};var _0x25b475={'count':0x0,'rows':[]};return db['SmsInteraction'][_0xd366('0xc8')]({'where':{'id':_0x42e668[_0xd366('0xbe')]['id']}})[_0xd366('0x2f')](handleEntityNotFound(_0x380fda,null))[_0xd366('0x2f')](function(_0xf7a315){if(_0xf7a315){_0x521a6b['model']=_['keys'](db[_0xd366('0xc5')][_0xd366('0x45')]);_0x521a6b['query']=_[_0xd366('0x4b')](_0x42e668[_0xd366('0x4a')]);_0x521a6b[_0xd366('0x4c')]=_['intersection'](_0x521a6b['model'],_0x521a6b['query']);_0x5210bc[_0xd366('0x4e')]=_['intersection'](_0x521a6b[_0xd366('0x49')],qs[_0xd366('0x4f')](_0x42e668[_0xd366('0x4a')]['fields']));_0x5210bc[_0xd366('0x4e')]=_0x5210bc[_0xd366('0x4e')][_0xd366('0x50')]?_0x5210bc[_0xd366('0x4e')]:_0x521a6b['model'];if(!_0x42e668[_0xd366('0x4a')][_0xd366('0x51')](_0xd366('0x52'))){_0x5210bc[_0xd366('0x28')]=qs['limit'](_0x42e668[_0xd366('0x4a')][_0xd366('0x28')]);_0x5210bc[_0xd366('0x26')]=qs[_0xd366('0x26')](_0x42e668[_0xd366('0x4a')][_0xd366('0x26')]);}_0x5210bc['order']=qs[_0xd366('0x54')](_0x42e668[_0xd366('0x4a')]['sort']);_0x5210bc[_0xd366('0x7e')]=qs[_0xd366('0x4c')](_[_0xd366('0x55')](_0x42e668[_0xd366('0x4a')],_0x521a6b[_0xd366('0x4c')]));_0x5210bc[_0xd366('0x7e')][_0xd366('0xba')]=_0xf7a315['id'];if(_0x42e668[_0xd366('0x4a')]['filter']){_0x5210bc[_0xd366('0x7e')]=_['merge'](_0x5210bc[_0xd366('0x7e')],{'$or':_['map'](_0x5210bc[_0xd366('0x4e')],function(_0x492e74){var _0x22d4f3={};_0x22d4f3[_0x492e74]={'$like':'%'+_0x42e668[_0xd366('0x4a')][_0xd366('0x8c')]+'%'};return _0x22d4f3;})});}if(_0x42e668[_0xd366('0x4a')]['$gte']){var _0x5cdb78=_0x42e668[_0xd366('0x4a')][_0xd366('0x82')][_0xd366('0x39')](',');var _0x388fee={};_0x388fee[_0x5cdb78[0x0]]={'$gte':moment(_0x5cdb78[0x1])['format'](_0xd366('0xc9'))};_0x5210bc['where']=_[_0xd366('0xa4')](_0x5210bc[_0xd366('0x7e')],_0x388fee);}_0x5210bc=_[_0xd366('0xa4')]({},_0x5210bc,_0x42e668[_0xd366('0xc1')]);return db['SmsMessage']['count']({'where':_0x5210bc[_0xd366('0x7e')]})[_0xd366('0x2f')](function(_0x2c8d5c){_0x25b475[_0xd366('0x29')]=_0x2c8d5c;if(_0x42e668['query'][_0xd366('0xbf')]){_0x5210bc[_0xd366('0xc0')]=[{'all':!![]}];}return db[_0xd366('0xc5')][_0xd366('0xca')](_0x5210bc);})[_0xd366('0x2f')](function(_0x49fa60){_0x25b475[_0xd366('0xcb')]=_0x49fa60;return _0x25b475;});}})[_0xd366('0x2f')](respondWithFilteredResult(_0x380fda,_0x5210bc))[_0xd366('0x3a')](handleError(_0x380fda,null));};exports['addTags']=function(_0xd15ad3,_0x39afd1,_0x371ac3){return db[_0xd366('0x44')][_0xd366('0x78')]({'where':{'id':_0xd15ad3[_0xd366('0xbe')]['id']}})['then'](handleEntityNotFound(_0x39afd1,null))[_0xd366('0x2f')](function(_0x32fca2){if(_0x32fca2){return _0x32fca2[_0xd366('0xcc')](_0xd15ad3['body'][_0xd366('0xc6')],_[_0xd366('0xc7')](_0xd15ad3[_0xd366('0x7a')],['ids','id'])||{})[_0xd366('0xcd')](function(){return db[_0xd366('0x73')]['findAll']({'attributes':['id',_0xd366('0x33'),_0xd366('0xce')],'where':{'id':_0xd15ad3[_0xd366('0x7a')][_0xd366('0xc6')]}});})[_0xd366('0x2f')](function(_0x1a6cfc){socket[_0xd366('0xcf')](_0xd366('0xd0'),{'id':Number(_0xd15ad3[_0xd366('0xbe')]['id']),'tags':_0x1a6cfc||[]});return{'id':Number(_0xd15ad3[_0xd366('0xbe')]['id']),'tags':_0x1a6cfc||[]};});}})[_0xd366('0x2f')](respondWithResult(_0x39afd1,null))[_0xd366('0x3a')](handleError(_0x39afd1,null));};exports[_0xd366('0xd1')]=function(_0x31f632,_0x142eb1,_0x459787){return db['SmsInteraction'][_0xd366('0x78')]({'where':{'id':_0x31f632[_0xd366('0xbe')]['id']}})[_0xd366('0x2f')](handleEntityNotFound(_0x142eb1,null))[_0xd366('0x2f')](function(_0x1c9ec1){if(_0x1c9ec1){return _0x1c9ec1['removeTags'](_0x31f632[_0xd366('0x4a')]['ids']);}})[_0xd366('0x2f')](respondWithStatusCode(_0x142eb1,null))[_0xd366('0x3a')](handleError(_0x142eb1,null));};exports[_0xd366('0xd2')]=function(_0x398bfd,_0x58b81c){var _0x51c8b2=moment()[_0xd366('0xd3')]()['toString']();var _0x5b82ce=path['join'](config[_0xd366('0xd4')],_0xd366('0xd5'),_0xd366('0xd6'),_0xd366('0xd7'));var _0x1cc485=path[_0xd366('0xd8')](config['root'],_0xd366('0xd5'),_0xd366('0xd6'),_0xd366('0xd9'));var _0x2a8742=path[_0xd366('0xd8')](_0x5b82ce,_0x51c8b2);var _0x58984b=util[_0xd366('0xda')](_0xd366('0xdb'),_0x398bfd['params']['id'],_0x51c8b2);var _0x91907b=path['join'](_0x5b82ce,_0x58984b);var _0x36d0bb=[];_0x36d0bb[_0xd366('0xbb')]({'model':db[_0xd366('0xdc')],'as':_0xd366('0xdc'),'attributes':['id',_0xd366('0x36')],'raw':!![]});_0x36d0bb[_0xd366('0xbb')]({'model':db['CmContact'],'as':'Contact','attributes':['id',_0xd366('0xdd'),_0xd366('0xde')],'raw':!![]});var _0x3eab0b=[{'model':db[_0xd366('0xc5')],'as':_0xd366('0xdf'),'attributes':['id','body',_0xd366('0x80'),_0xd366('0xe0'),_0xd366('0xe1'),'read'],'include':_0x36d0bb}];_0x3eab0b[_0xd366('0xbb')]({'model':db[_0xd366('0xe2')],'as':_0xd366('0xe3'),'attributes':['id','name']});_0x3eab0b[_0xd366('0xbb')]({'model':db[_0xd366('0xdc')],'as':_0xd366('0xe4'),'attributes':['id',_0xd366('0x36')]});return db[_0xd366('0x44')][_0xd366('0x78')]({'where':{'id':_0x398bfd[_0xd366('0xbe')]['id']},'include':_0x3eab0b})[_0xd366('0x2f')](handleEntityNotFound(_0x58b81c,null))[_0xd366('0x2f')](function(_0x3bf821){if(_0x3bf821){var _0x5dfd72=_0x3bf821[_0xd366('0xe5')]({'plain':!![]});fs[_0xd366('0xe6')](_0x2a8742);var _0x272903={'channel':'Sms','account':_0x5dfd72['Account'][_0xd366('0x33')],'agent':_0x5dfd72[_0xd366('0xe4')]?_0x5dfd72[_0xd366('0xe4')][_0xd366('0x36')]:_0xd366('0xe7'),'createdAt':moment(_0x5dfd72[_0xd366('0x80')])[_0xd366('0xda')](_0xd366('0xc9'))[_0xd366('0xa2')](),'closedAt':_0x5dfd72['closed']?moment(_0x5dfd72[_0xd366('0xe8')])[_0xd366('0xda')]('YYYY-MM-DD\x20HH:mm:ss')[_0xd366('0xa2')]():'','disposition':_0x5dfd72[_0xd366('0xe9')],'messages':_(_0x5dfd72[_0xd366('0xdf')])[_0xd366('0x8c')]({'secret':![]})[_0xd366('0x43')](function(_0x93793d){return{'date':moment(_0x93793d[_0xd366('0x80')])['format'](_0xd366('0xc9'))[_0xd366('0xa2')](),'sender':_0x93793d[_0xd366('0xe0')]===_0xd366('0xea')?_0x93793d['User']?_0x93793d[_0xd366('0xdc')][_0xd366('0x36')]:_0xd366('0xeb'):_0x93793d[_0xd366('0x6c')]['firstName']+(_0x93793d['Contact'][_0xd366('0xde')]?'\x20'+_0x93793d[_0xd366('0x6c')][_0xd366('0xde')]:''),'body':_0x93793d[_0xd366('0x7a')],'direction':_0x93793d['direction']===_0xd366('0xea')?'A':'C','secret':_0x93793d[_0xd366('0xe1')],'read':_0x93793d[_0xd366('0x87')]};})[_0xd366('0x6e')]()};return ejs[_0xd366('0xec')](path[_0xd366('0xd8')](config[_0xd366('0xd4')],_0xd366('0xd5'),_0xd366('0xed'),_0xd366('0xee')),{'interaction':_0x272903})[_0xd366('0x2f')](function(_0x28c702){var _0x26191d=path[_0xd366('0xd8')](_0x2a8742,'transcript-'+_0x5dfd72['id']+'-'+_0x51c8b2+'.pdf');var _0x2ce6ed={'path':_0x26191d,'channel':_0xd366('0xef'),'interactionId':_0x5dfd72['id']};return pdf[_0xd366('0xf0')](_0x28c702,_0x2ce6ed);})[_0xd366('0x2f')](function(){return new BPromise(function(_0x4dfee5,_0x14ed12){zipdir(_0x2a8742,{'saveTo':_0x91907b},function(_0xc07369,_0x1a4ec8){if(_0xc07369)return _0x14ed12(_0xc07369);return _0x4dfee5(_0x1a4ec8);});})[_0xd366('0x2f')](function(){return new BPromise(function(_0x1b20aa,_0x465481){rimraf(_0x2a8742,function(_0x579035){if(_0x579035)_0x465481(_0x579035);return _0x1b20aa();});});})['then'](function(){return _0x58b81c[_0xd366('0xd2')](_0x91907b,_0x58984b,function(_0x1405b6){if(_0x1405b6){console['log'](_0xd366('0xf1'),_0x1405b6);}else{fs[_0xd366('0xf2')](_0x91907b);}});});});}else{return _0x58b81c[_0xd366('0x31')](0xc8);}})['catch'](handleError(_0x58b81c,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index c644651..a1654c7 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 _0x02ce=['setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','SmsInteraction','SmsMessage','save','update','remove','getUsers','then','Users','map','findAll'];(function(_0x56da1e,_0x4fd91e){var _0x6d71b5=function(_0x477db1){while(--_0x477db1){_0x56da1e['push'](_0x56da1e['shift']());}};_0x6d71b5(++_0x4fd91e);}(_0x02ce,0x1ac));var _0xe02c=function(_0x145524,_0x493257){_0x145524=_0x145524-0x0;var _0x49c702=_0x02ce[_0x145524];return _0x49c702;};'use strict';var EventEmitter=require(_0xe02c('0x0'));var SmsInteraction=require(_0xe02c('0x1'))['db'][_0xe02c('0x2')];var SmsMessage=require('../../mysqldb')['db'][_0xe02c('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe02c('0x4'),'afterUpdate':_0xe02c('0x5'),'afterDestroy':_0xe02c('0x6')};function emitEvent(_0xf4b764){return function(_0x41b41c,_0x229653,_0x3f7436){_0x41b41c[_0xe02c('0x7')]({'attributes':['id'],'raw':!![]})[_0xe02c('0x8')](function(_0x4fecb3){_0x41b41c['setDataValue'](_0xe02c('0x9'),_0x4fecb3[_0xe02c('0xa')](function(_0x469932){return{'id':_0x469932['id']};}));return SmsMessage[_0xe02c('0xb')]({'where':{'SmsInteractionId':_0x41b41c['id'],'direction':'in','read':![]},'raw':!![]});})[_0xe02c('0x8')](function(_0x18a398){_0x41b41c[_0xe02c('0xc')](_0xe02c('0xd'),_0x18a398[_0xe02c('0xe')]);SmsInteractionEvents[_0xe02c('0xf')](_0xf4b764+':'+_0x41b41c['id'],_0x41b41c);SmsInteractionEvents[_0xe02c('0xf')](_0xf4b764,_0x41b41c);_0x3f7436(null);})[_0xe02c('0x10')](_0x3f7436(null));};}for(var e in events){if(events[_0xe02c('0x11')](e)){var event=events[e];SmsInteraction[_0xe02c('0x12')](e,emitEvent(event));}}module[_0xe02c('0x13')]=SmsInteractionEvents; \ No newline at end of file +var _0xcf2f=['setDataValue','Users','map','unreadMessages','emit','catch','hasOwnProperty','events','../../mysqldb','SmsInteraction','SmsMessage','save','update','remove','getUsers','then'];(function(_0x3c6dce,_0x5424dd){var _0x1450e9=function(_0xd51b5c){while(--_0xd51b5c){_0x3c6dce['push'](_0x3c6dce['shift']());}};_0x1450e9(++_0x5424dd);}(_0xcf2f,0xa7));var _0xfcf2=function(_0x413883,_0x55b686){_0x413883=_0x413883-0x0;var _0x3df331=_0xcf2f[_0x413883];return _0x3df331;};'use strict';var EventEmitter=require(_0xfcf2('0x0'));var SmsInteraction=require(_0xfcf2('0x1'))['db'][_0xfcf2('0x2')];var SmsMessage=require(_0xfcf2('0x1'))['db'][_0xfcf2('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xfcf2('0x4'),'afterUpdate':_0xfcf2('0x5'),'afterDestroy':_0xfcf2('0x6')};function emitEvent(_0x34bcaf){return function(_0x179e60,_0x167a77,_0x1e6d99){_0x179e60[_0xfcf2('0x7')]({'attributes':['id'],'raw':!![]})[_0xfcf2('0x8')](function(_0x157f48){_0x179e60[_0xfcf2('0x9')](_0xfcf2('0xa'),_0x157f48[_0xfcf2('0xb')](function(_0x13ce18){return{'id':_0x13ce18['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x179e60['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x4d6fc9){_0x179e60[_0xfcf2('0x9')](_0xfcf2('0xc'),_0x4d6fc9['length']);SmsInteractionEvents[_0xfcf2('0xd')](_0x34bcaf+':'+_0x179e60['id'],_0x179e60);SmsInteractionEvents[_0xfcf2('0xd')](_0x34bcaf,_0x179e60);_0x1e6d99(null);})[_0xfcf2('0xe')](_0x1e6d99(null));};}for(var e in events){if(events[_0xfcf2('0xf')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 7a301f3..84fbe1a 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 _0x2e67=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes','define','SmsInteraction','sms_interactions','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','../../config/logger'];(function(_0x3cb8d6,_0x8190da){var _0x200e3f=function(_0x97560){while(--_0x97560){_0x3cb8d6['push'](_0x3cb8d6['shift']());}};_0x200e3f(++_0x8190da);}(_0x2e67,0x1a3));var _0x72e6=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2e67[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x72e6('0x0'))(_0x72e6('0x1'));var moment=require(_0x72e6('0x2'));var BPromise=require(_0x72e6('0x3'));var rp=require(_0x72e6('0x4'));var fs=require('fs');var path=require(_0x72e6('0x5'));var rimraf=require(_0x72e6('0x6'));var config=require(_0x72e6('0x7'));var attributes=require(_0x72e6('0x8'));module['exports']=function(_0x1e645f,_0x4dd0f2){return _0x1e645f[_0x72e6('0x9')](_0x72e6('0xa'),attributes,{'tableName':_0x72e6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3d8a61,_0xab394c,_0x3353ee){if(_0x3d8a61['changed'](_0x72e6('0xc'))){_0x3d8a61[_0x72e6('0xd')]=moment()['format'](_0x72e6('0xe'));}_0x3353ee(null,_0x3d8a61);}}});}; \ No newline at end of file +var _0x73e9=['../../config/environment','./smsInteraction.attributes','define','sms_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment','bluebird','rimraf'];(function(_0x19a3c1,_0xbe36b2){var _0x31e234=function(_0xe5253d){while(--_0xe5253d){_0x19a3c1['push'](_0x19a3c1['shift']());}};_0x31e234(++_0xbe36b2);}(_0x73e9,0xae));var _0x973e=function(_0x2f50ab,_0x4dfe90){_0x2f50ab=_0x2f50ab-0x0;var _0x1e9b19=_0x73e9[_0x2f50ab];return _0x1e9b19;};'use strict';var _=require('lodash');var util=require(_0x973e('0x0'));var logger=require(_0x973e('0x1'))(_0x973e('0x2'));var moment=require(_0x973e('0x3'));var BPromise=require(_0x973e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x973e('0x5'));var config=require(_0x973e('0x6'));var attributes=require(_0x973e('0x7'));module['exports']=function(_0x43d407,_0x5b0ae5){return _0x43d407[_0x973e('0x8')]('SmsInteraction',attributes,{'tableName':_0x973e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x156894,_0x5e06fc,_0x1ee2ea){if(_0x156894[_0x973e('0xa')](_0x973e('0xb'))){_0x156894[_0x973e('0xc')]=moment()[_0x973e('0xd')](_0x973e('0xe'));}_0x1ee2ea(null,_0x156894);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index a509bd2..1794373 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 _0xd05e=['find','addTags','ids','omit','spread','AddTags','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','register','request','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','UpdateSmsInteraction','update','body','options','raw','where','attributes','limit','AddTagsToSmsInteraction','SmsInteraction'];(function(_0x53cf8e,_0x3d290f){var _0x459197=function(_0x67073c){while(--_0x67073c){_0x53cf8e['push'](_0x53cf8e['shift']());}};_0x459197(++_0x3d290f);}(_0xd05e,0x11e));var _0xed05=function(_0x592e7e,_0x1aac28){_0x592e7e=_0x592e7e-0x0;var _0x41ede4=_0xd05e[_0x592e7e];return _0x41ede4;};'use strict';var _=require(_0xed05('0x0'));var util=require('util');var moment=require(_0xed05('0x1'));var BPromise=require('bluebird');var rs=require(_0xed05('0x2'));var fs=require('fs');var Redis=require(_0xed05('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xed05('0x4'));var logger=require(_0xed05('0x5'))(_0xed05('0x6'));var config=require('../../config/environment');var jayson=require(_0xed05('0x7'));var client=jayson['client'][_0xed05('0x8')]({'port':0x232a});config[_0xed05('0x9')]=_[_0xed05('0xa')](config[_0xed05('0x9')],{'host':_0xed05('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xed05('0x9')]));require('./smsInteraction.socket')[_0xed05('0xc')](socket);function respondWithRpcPromise(_0x1516bc,_0x594cac,_0xf16931){return new BPromise(function(_0xe78a71,_0x1522f9){return client[_0xed05('0xd')](_0x1516bc,_0xf16931)[_0xed05('0xe')](function(_0x355efc){logger[_0xed05('0xf')](_0xed05('0x10'),_0x594cac,_0xed05('0x11'));logger[_0xed05('0x12')]('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x594cac,_0xed05('0x11'),JSON[_0xed05('0x13')](_0x355efc));if(_0x355efc['error']){if(_0x355efc[_0xed05('0x14')]['code']===0x1f4){logger[_0xed05('0x14')]('SmsInteraction,\x20%s,\x20%s',_0x594cac,_0x355efc[_0xed05('0x14')][_0xed05('0x15')]);return _0x1522f9(_0x355efc[_0xed05('0x14')]['message']);}logger[_0xed05('0x14')](_0xed05('0x10'),_0x594cac,_0x355efc[_0xed05('0x14')][_0xed05('0x15')]);return _0xe78a71(_0x355efc['error'][_0xed05('0x15')]);}else{logger[_0xed05('0xf')](_0xed05('0x10'),_0x594cac,_0xed05('0x11'));_0xe78a71(_0x355efc[_0xed05('0x16')]['message']);}})[_0xed05('0x17')](function(_0x26a1a1){logger[_0xed05('0x14')](_0xed05('0x10'),_0x594cac,_0x26a1a1);_0x1522f9(_0x26a1a1);});});}exports[_0xed05('0x18')]=function(_0x1ed957){var _0x166687=this;return new Promise(function(_0x175a66,_0x360910){return db['SmsInteraction'][_0xed05('0x19')](_0x1ed957[_0xed05('0x1a')],{'raw':_0x1ed957[_0xed05('0x1b')]?_0x1ed957[_0xed05('0x1b')][_0xed05('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1ed957[_0xed05('0x1b')]?_0x1ed957[_0xed05('0x1b')][_0xed05('0x1d')]||null:null,'attributes':_0x1ed957[_0xed05('0x1b')]?_0x1ed957[_0xed05('0x1b')][_0xed05('0x1e')]||null:null,'limit':_0x1ed957[_0xed05('0x1b')]?_0x1ed957[_0xed05('0x1b')][_0xed05('0x1f')]||null:null})[_0xed05('0xe')](function(_0x4044d1){logger[_0xed05('0xf')](_0xed05('0x18'),_0x1ed957);logger[_0xed05('0x12')](_0xed05('0x18'),_0x1ed957,JSON[_0xed05('0x13')](_0x4044d1));_0x175a66(_0x4044d1);})[_0xed05('0x17')](function(_0x3b3250){logger['error'](_0xed05('0x18'),_0x3b3250['message'],_0x1ed957);_0x360910(_0x166687['error'](0x1f4,_0x3b3250[_0xed05('0x15')]));});});};exports[_0xed05('0x20')]=function(_0x22a7eb){return new Promise(function(_0x12195e,_0x239e5a){return db[_0xed05('0x21')][_0xed05('0x22')]({'where':_0x22a7eb[_0xed05('0x1b')]?_0x22a7eb[_0xed05('0x1b')][_0xed05('0x1d')]||null:null})['then'](function(_0x15d61f){if(_0x15d61f){return _0x15d61f[_0xed05('0x23')](_0x22a7eb[_0xed05('0x1a')][_0xed05('0x24')],_[_0xed05('0x25')](_0x22a7eb[_0xed05('0x1a')],[_0xed05('0x24'),'id'])||{});}})[_0xed05('0x26')](function(_0x39341f){logger[_0xed05('0xf')](_0xed05('0x27'),_0x22a7eb);logger[_0xed05('0x12')](_0xed05('0x27'),_0x22a7eb,JSON[_0xed05('0x13')](_0x39341f));_0x12195e(_0x39341f);})['catch'](function(_0x5a1553){logger[_0xed05('0x14')]('AddTags',_0x5a1553[_0xed05('0x15')],_0x22a7eb);_0x239e5a(_this[_0xed05('0x14')](0x1f4,_0x5a1553[_0xed05('0x15')]));});});}; \ No newline at end of file +var _0xeb15=['catch','UpdateSmsInteraction','SmsInteraction','update','body','options','raw','where','attributes','limit','debug','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','request','then','request\x20sent','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsInteraction,\x20%s,\x20%s','message','info','result'];(function(_0x5c3c0b,_0x4ee35e){var _0x52ecd2=function(_0x3cf575){while(--_0x3cf575){_0x5c3c0b['push'](_0x5c3c0b['shift']());}};_0x52ecd2(++_0x4ee35e);}(_0xeb15,0x1d3));var _0x5eb1=function(_0x312ad6,_0x5dcca8){_0x312ad6=_0x312ad6-0x0;var _0x1069dc=_0xeb15[_0x312ad6];return _0x1069dc;};'use strict';var _=require(_0x5eb1('0x0'));var util=require(_0x5eb1('0x1'));var moment=require(_0x5eb1('0x2'));var BPromise=require(_0x5eb1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5eb1('0x4'));var db=require(_0x5eb1('0x5'))['db'];var utils=require(_0x5eb1('0x6'));var logger=require(_0x5eb1('0x7'))(_0x5eb1('0x8'));var config=require(_0x5eb1('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x5eb1('0xa')][_0x5eb1('0xb')]({'port':0x232a});config[_0x5eb1('0xc')]=_[_0x5eb1('0xd')](config[_0x5eb1('0xc')],{'host':_0x5eb1('0xe'),'port':0x18eb});var socket=require(_0x5eb1('0xf'))(new Redis(config[_0x5eb1('0xc')]));require(_0x5eb1('0x10'))['register'](socket);function respondWithRpcPromise(_0x2e1b75,_0x4307e2,_0x217c9d){return new BPromise(function(_0x11a788,_0x24c0d6){return client[_0x5eb1('0x11')](_0x2e1b75,_0x217c9d)[_0x5eb1('0x12')](function(_0x4d2801){logger['info']('SmsInteraction,\x20%s,\x20%s',_0x4307e2,_0x5eb1('0x13'));logger['debug'](_0x5eb1('0x14'),_0x4307e2,_0x5eb1('0x13'),JSON[_0x5eb1('0x15')](_0x4d2801));if(_0x4d2801['error']){if(_0x4d2801[_0x5eb1('0x16')][_0x5eb1('0x17')]===0x1f4){logger[_0x5eb1('0x16')](_0x5eb1('0x18'),_0x4307e2,_0x4d2801[_0x5eb1('0x16')]['message']);return _0x24c0d6(_0x4d2801['error'][_0x5eb1('0x19')]);}logger['error'](_0x5eb1('0x18'),_0x4307e2,_0x4d2801['error']['message']);return _0x11a788(_0x4d2801[_0x5eb1('0x16')][_0x5eb1('0x19')]);}else{logger[_0x5eb1('0x1a')]('SmsInteraction,\x20%s,\x20%s',_0x4307e2,_0x5eb1('0x13'));_0x11a788(_0x4d2801[_0x5eb1('0x1b')][_0x5eb1('0x19')]);}})[_0x5eb1('0x1c')](function(_0x49c767){logger['error']('SmsInteraction,\x20%s,\x20%s',_0x4307e2,_0x49c767);_0x24c0d6(_0x49c767);});});}exports[_0x5eb1('0x1d')]=function(_0x6709ac){var _0x1bbff5=this;return new Promise(function(_0x2382fb,_0x8347d8){return db[_0x5eb1('0x1e')][_0x5eb1('0x1f')](_0x6709ac[_0x5eb1('0x20')],{'raw':_0x6709ac[_0x5eb1('0x21')]?_0x6709ac[_0x5eb1('0x21')][_0x5eb1('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x6709ac[_0x5eb1('0x21')]?_0x6709ac[_0x5eb1('0x21')][_0x5eb1('0x23')]||null:null,'attributes':_0x6709ac[_0x5eb1('0x21')]?_0x6709ac[_0x5eb1('0x21')][_0x5eb1('0x24')]||null:null,'limit':_0x6709ac[_0x5eb1('0x21')]?_0x6709ac['options'][_0x5eb1('0x25')]||null:null})[_0x5eb1('0x12')](function(_0x1bd766){logger[_0x5eb1('0x1a')](_0x5eb1('0x1d'),_0x6709ac);logger[_0x5eb1('0x26')](_0x5eb1('0x1d'),_0x6709ac,JSON['stringify'](_0x1bd766));_0x2382fb(_0x1bd766);})[_0x5eb1('0x1c')](function(_0x4fb14c){logger[_0x5eb1('0x16')](_0x5eb1('0x1d'),_0x4fb14c[_0x5eb1('0x19')],_0x6709ac);_0x8347d8(_0x1bbff5[_0x5eb1('0x16')](0x1f4,_0x4fb14c[_0x5eb1('0x19')]));});});};exports['AddTagsToSmsInteraction']=function(_0x4832e3){return new Promise(function(_0x365c54,_0x39eba6){return db[_0x5eb1('0x1e')][_0x5eb1('0x27')]({'where':_0x4832e3['options']?_0x4832e3[_0x5eb1('0x21')][_0x5eb1('0x23')]||null:null})[_0x5eb1('0x12')](function(_0x40ca1e){if(_0x40ca1e){return _0x40ca1e[_0x5eb1('0x28')](_0x4832e3['body'][_0x5eb1('0x29')],_[_0x5eb1('0x2a')](_0x4832e3[_0x5eb1('0x20')],[_0x5eb1('0x29'),'id'])||{});}})[_0x5eb1('0x2b')](function(_0x35a61e){logger['info'](_0x5eb1('0x2c'),_0x4832e3);logger[_0x5eb1('0x26')]('AddTags',_0x4832e3,JSON[_0x5eb1('0x15')](_0x35a61e));_0x365c54(_0x35a61e);})['catch'](function(_0x504dc6){logger[_0x5eb1('0x16')]('AddTags',_0x504dc6[_0x5eb1('0x19')],_0x4832e3);_0x39eba6(_this[_0x5eb1('0x16')](0x1f4,_0x504dc6[_0x5eb1('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 2c32419..e922bea 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 _0xc52d=['remove','update','removeListener','register','length','./smsInteraction.events'];(function(_0xb13527,_0x37c392){var _0x23a645=function(_0x3607ff){while(--_0x3607ff){_0xb13527['push'](_0xb13527['shift']());}};_0x23a645(++_0x37c392);}(_0xc52d,0xb9));var _0xdc52=function(_0x295cc3,_0x29338c){_0x295cc3=_0x295cc3-0x0;var _0x454942=_0xc52d[_0x295cc3];return _0x454942;};'use strict';var SmsInteractionEvents=require(_0xdc52('0x0'));var events=['save',_0xdc52('0x1'),_0xdc52('0x2')];function createListener(_0x2391a6,_0x3f3582){return function(_0x4ec665){_0x3f3582['emit'](_0x2391a6,_0x4ec665);};}function removeListener(_0x2debff,_0x4cddf9){return function(){SmsInteractionEvents[_0xdc52('0x3')](_0x2debff,_0x4cddf9);};}exports[_0xdc52('0x4')]=function(_0x273b78){for(var _0x17f96a=0x0,_0x1fc18e=events[_0xdc52('0x5')];_0x17f96a<_0x1fc18e;_0x17f96a++){var _0x1bd515=events[_0x17f96a];var _0x2e981c=createListener('smsInteraction:'+_0x1bd515,_0x273b78);SmsInteractionEvents['on'](_0x1bd515,_0x2e981c);}}; \ No newline at end of file +var _0xe432=['remove','update','emit','length','smsInteraction:','./smsInteraction.events','save'];(function(_0x2a8860,_0x2da926){var _0x2f47a4=function(_0x3b7f54){while(--_0x3b7f54){_0x2a8860['push'](_0x2a8860['shift']());}};_0x2f47a4(++_0x2da926);}(_0xe432,0x18d));var _0x2e43=function(_0x54bb75,_0x356f7e){_0x54bb75=_0x54bb75-0x0;var _0x3625e7=_0xe432[_0x54bb75];return _0x3625e7;};'use strict';var SmsInteractionEvents=require(_0x2e43('0x0'));var events=[_0x2e43('0x1'),_0x2e43('0x2'),_0x2e43('0x3')];function createListener(_0x1f10a1,_0x183c8a){return function(_0x4fb8d1){_0x183c8a[_0x2e43('0x4')](_0x1f10a1,_0x4fb8d1);};}function removeListener(_0x52cd3e,_0x30a620){return function(){SmsInteractionEvents['removeListener'](_0x52cd3e,_0x30a620);};}exports['register']=function(_0x438ce5){for(var _0x3c5108=0x0,_0x4cefbc=events[_0x2e43('0x5')];_0x3c5108<_0x4cefbc;_0x3c5108++){var _0x2c4859=events[_0x3c5108];var _0x5e369b=createListener(_0x2e43('0x6')+_0x2c4859,_0x438ce5);SmsInteractionEvents['on'](_0x2c4859,_0x5e369b);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 2d22f67..d2651ba 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 _0x22f3=['../../config/environment','get','index','/describe','describe','/:id','isAuthenticated','show','post','tracked','sms','smsmessage:create','create','/:id/status','status','put','update','accept','/:id/reject','reject','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service'];(function(_0x484f81,_0x3e18d4){var _0x3d262f=function(_0x523e6f){while(--_0x523e6f){_0x484f81['push'](_0x484f81['shift']());}};_0x3d262f(++_0x3e18d4);}(_0x22f3,0x155));var _0x322f=function(_0x57619a,_0xe16536){_0x57619a=_0x57619a-0x0;var _0xb177c8=_0x22f3[_0x57619a];return _0xb177c8;};'use strict';var multer=require(_0x322f('0x0'));var util=require(_0x322f('0x1'));var path=require(_0x322f('0x2'));var timeout=require(_0x322f('0x3'));var express=require(_0x322f('0x4'));var router=express['Router']();var fs_extra=require(_0x322f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x322f('0x6'));var config=require(_0x322f('0x7'));var controller=require('./smsMessage.controller');router[_0x322f('0x8')]('/',auth['isAuthenticated'](),controller[_0x322f('0x9')]);router['get'](_0x322f('0xa'),auth['isAuthenticated'](),controller[_0x322f('0xb')]);router[_0x322f('0x8')](_0x322f('0xc'),auth[_0x322f('0xd')](),controller[_0x322f('0xe')]);router[_0x322f('0xf')]('/',auth[_0x322f('0xd')](),interaction[_0x322f('0x10')](_0x322f('0x11'),_0x322f('0x12')),controller[_0x322f('0x13')]);router['post'](_0x322f('0x14'),controller[_0x322f('0x15')]);router[_0x322f('0x16')](_0x322f('0xc'),auth[_0x322f('0xd')](),controller[_0x322f('0x17')]);router[_0x322f('0x16')]('/:id/accept',auth[_0x322f('0xd')](),controller[_0x322f('0x18')]);router[_0x322f('0x16')](_0x322f('0x19'),auth[_0x322f('0xd')](),controller[_0x322f('0x1a')]);router[_0x322f('0x1b')](_0x322f('0xc'),auth['isAuthenticated'](),controller[_0x322f('0x1c')]);module['exports']=router; \ No newline at end of file +var _0xefdf=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./smsMessage.controller','isAuthenticated','get','/describe','describe','sms','smsmessage:create','post','/:id/status','status','/:id','update','put','/:id/reject','reject','delete','util','path'];(function(_0x32b248,_0x4e4850){var _0x1634c4=function(_0x7bee1e){while(--_0x7bee1e){_0x32b248['push'](_0x32b248['shift']());}};_0x1634c4(++_0x4e4850);}(_0xefdf,0x129));var _0xfefd=function(_0x45e725,_0x452382){_0x45e725=_0x45e725-0x0;var _0x1346a1=_0xefdf[_0x45e725];return _0x1346a1;};'use strict';var multer=require('multer');var util=require(_0xfefd('0x0'));var path=require(_0xfefd('0x1'));var timeout=require(_0xfefd('0x2'));var express=require(_0xfefd('0x3'));var router=express[_0xfefd('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xfefd('0x5'));var interaction=require(_0xfefd('0x6'));var config=require('../../config/environment');var controller=require(_0xfefd('0x7'));router['get']('/',auth[_0xfefd('0x8')](),controller['index']);router[_0xfefd('0x9')](_0xfefd('0xa'),auth[_0xfefd('0x8')](),controller[_0xfefd('0xb')]);router[_0xfefd('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xfefd('0x8')](),interaction['tracked'](_0xfefd('0xc'),_0xfefd('0xd')),controller['create']);router[_0xfefd('0xe')](_0xfefd('0xf'),controller[_0xfefd('0x10')]);router['put'](_0xfefd('0x11'),auth['isAuthenticated'](),controller[_0xfefd('0x12')]);router[_0xfefd('0x13')]('/:id/accept',auth['isAuthenticated'](),controller['accept']);router[_0xfefd('0x13')](_0xfefd('0x14'),auth[_0xfefd('0x8')](),controller[_0xfefd('0x15')]);router[_0xfefd('0x16')](_0xfefd('0x11'),auth[_0xfefd('0x8')](),controller['destroy']);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 4ee56a4..cc6a43e 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 _0x8be6=['out','STRING','DATE','sequelize','exports','TEXT','medium','BOOLEAN','ENUM'];(function(_0x3f59b1,_0x25cdbe){var _0x11d2e8=function(_0x37b3fc){while(--_0x37b3fc){_0x3f59b1['push'](_0x3f59b1['shift']());}};_0x11d2e8(++_0x25cdbe);}(_0x8be6,0x1e9));var _0x68be=function(_0x1a9e9e,_0x3a4d89){_0x1a9e9e=_0x1a9e9e-0x0;var _0x57cee2=_0x8be6[_0x1a9e9e];return _0x57cee2;};'use strict';var Sequelize=require(_0x68be('0x0'));module[_0x68be('0x1')]={'body':{'type':Sequelize[_0x68be('0x2')](_0x68be('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x68be('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x68be('0x5')]('in',_0x68be('0x6')),'defaultValue':_0x68be('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x68be('0x7')](0xbe)},'phone':{'type':Sequelize[_0x68be('0x7')]},'readAt':{'type':Sequelize[_0x68be('0x8')]},'secret':{'type':Sequelize[_0x68be('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x68be('0x7')]},'providerResponse':{'type':Sequelize[_0x68be('0x2')]}}; \ No newline at end of file +var _0x5243=['medium','BOOLEAN','out','STRING','DATE','sequelize'];(function(_0x3357b8,_0xeb406){var _0x50737a=function(_0x43a94b){while(--_0x43a94b){_0x3357b8['push'](_0x3357b8['shift']());}};_0x50737a(++_0xeb406);}(_0x5243,0x71));var _0x3524=function(_0x4ea9cd,_0x3463f5){_0x4ea9cd=_0x4ea9cd-0x0;var _0x24beb5=_0x5243[_0x4ea9cd];return _0x24beb5;};'use strict';var Sequelize=require(_0x3524('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0x3524('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x3524('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x3524('0x3'),'allowNull':![]},'messageId':{'type':Sequelize[_0x3524('0x4')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x3524('0x5')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0x3524('0x4')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index afa127c..5c27e92 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 _0xa30a=['findAll','rows','show','params','keys','rawAttributes','includeAll','find','create','body','destroy','describe','../../config/logger','accept','sms','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','read1stAt','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','fullname','email','manual','SIP/%s','channel','motionChannel','event','EventManager','sms-interactions','SmsInteractionId','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','User','internal','interface','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','MessageSid','SmsAccount,\x20%s,\x20%s,\x20%s','twilio','inspect','plivo','MessageUUID','indexOf','sent','delivered','plivio','infobip','results','groupName','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','request','SmsMessage,\x20%s,\x20%s','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','sendStatus','stack','name','send','map','fieldName','type','model','query','filters','intersection','fields','attributes','length','order','sort','where','pick','filter','merge','options','SmsMessage','include'];(function(_0x50ce0c,_0x541b68){var _0x3c988c=function(_0x1684ee){while(--_0x1684ee){_0x50ce0c['push'](_0x50ce0c['shift']());}};_0x3c988c(++_0x541b68);}(_0xa30a,0xd7));var _0xaa30=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa30a[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0xaa30('0x0'));var rimraf=require(_0xaa30('0x1'));var zipdir=require(_0xaa30('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaa30('0x3'));var moment=require(_0xaa30('0x4'));var BPromise=require(_0xaa30('0x5'));var Mustache=require(_0xaa30('0x6'));var util=require(_0xaa30('0x7'));var path=require(_0xaa30('0x8'));var sox=require(_0xaa30('0x9'));var csv=require('to-csv');var ejs=require(_0xaa30('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaa30('0xb'));var squel=require(_0xaa30('0xc'));var crypto=require(_0xaa30('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xaa30('0xe'));var toCsv=require(_0xaa30('0xf'));var querystring=require(_0xaa30('0x10'));var Papa=require(_0xaa30('0x11'));var Redis=require(_0xaa30('0x12'));var authService=require(_0xaa30('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaa30('0x14'));var logger=require('../../config/logger')(_0xaa30('0x15'));var utils=require(_0xaa30('0x16'));var config=require(_0xaa30('0x17'));var licenseUtil=require(_0xaa30('0x18'));var db=require('../../mysqldb')['db'];config[_0xaa30('0x19')]=_[_0xaa30('0x1a')](config[_0xaa30('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xaa30('0x1b'))(new Redis(config[_0xaa30('0x19')]));require(_0xaa30('0x1c'))[_0xaa30('0x1d')](socket);var jayson=require(_0xaa30('0x1e'));var client=jayson[_0xaa30('0x1f')][_0xaa30('0x20')]({'port':0x232c});var client9002=jayson[_0xaa30('0x1f')][_0xaa30('0x20')]({'port':0x232a});function respondWithRpcPromise(_0xfae724,_0x519518,_0x91839d,_0x591478){return new BPromise(function(_0x5eb356,_0x3247ea){var _0x153939=_0x591478||client;return _0x153939[_0xaa30('0x21')](_0xfae724,_0x91839d)['then'](function(_0x54fa49){logger['info'](_0xaa30('0x22'),_0x519518,'request\x20sent');logger[_0xaa30('0x23')](_0xaa30('0x24'),_0x519518,'request\x20sent',JSON['stringify'](_0x54fa49));if(_0x54fa49['error']){if(_0x54fa49[_0xaa30('0x25')][_0xaa30('0x26')]===0x1f4){logger[_0xaa30('0x25')](_0xaa30('0x22'),_0x519518,_0x54fa49[_0xaa30('0x25')]['message']);return _0x3247ea(_0x54fa49[_0xaa30('0x25')][_0xaa30('0x27')]);}logger[_0xaa30('0x25')](_0xaa30('0x22'),_0x519518,_0x54fa49[_0xaa30('0x25')]['message']);return _0x5eb356(_0x54fa49[_0xaa30('0x25')][_0xaa30('0x27')]);}else{logger[_0xaa30('0x28')](_0xaa30('0x22'),_0x519518,'request\x20sent');_0x5eb356(_0x54fa49[_0xaa30('0x29')][_0xaa30('0x27')]);}})[_0xaa30('0x2a')](function(_0x12da2f){logger[_0xaa30('0x25')](_0xaa30('0x22'),_0x519518,_0x12da2f);_0x3247ea(_0x12da2f);});});}function respondWithStatusCode(_0x55cccb,_0x467850){_0x467850=_0x467850||0xcc;return function(_0x465701){if(_0x465701){return _0x55cccb['sendStatus'](_0x467850);}return _0x55cccb[_0xaa30('0x2b')](_0x467850)['end']();};}function respondWithResult(_0x2da4da,_0x33a0c9){_0x33a0c9=_0x33a0c9||0xc8;return function(_0x2aabf8){if(_0x2aabf8){return _0x2da4da[_0xaa30('0x2b')](_0x33a0c9)[_0xaa30('0x2c')](_0x2aabf8);}};}function respondWithFilteredResult(_0xc10b8f,_0x6ff09a){return function(_0x39f708){if(_0x39f708){var _0x1f288c=typeof _0x6ff09a[_0xaa30('0x2d')]===_0xaa30('0x2e')&&typeof _0x6ff09a[_0xaa30('0x2f')]===_0xaa30('0x2e');var _0x46abb9=_0x39f708[_0xaa30('0x30')];var _0x1a3f64=_0x1f288c?0x0:_0x6ff09a[_0xaa30('0x2d')];var _0x1fa8d4=_0x1f288c?_0x39f708['count']:_0x6ff09a[_0xaa30('0x2d')]+_0x6ff09a[_0xaa30('0x2f')];var _0x3bc22f;if(_0x1fa8d4>=_0x46abb9){_0x1fa8d4=_0x46abb9;_0x3bc22f=0xc8;}else{_0x3bc22f=0xce;}_0xc10b8f[_0xaa30('0x2b')](_0x3bc22f);return _0xc10b8f[_0xaa30('0x31')](_0xaa30('0x32'),_0x1a3f64+'-'+_0x1fa8d4+'/'+_0x46abb9)['json'](_0x39f708);}return null;};}function patchUpdates(_0x5addbf){return function(_0x5b99ca){try{jsonpatch[_0xaa30('0x33')](_0x5b99ca,_0x5addbf,!![]);}catch(_0x407090){return BPromise[_0xaa30('0x34')](_0x407090);}return _0x5b99ca[_0xaa30('0x35')]();};}function saveUpdates(_0x1d6d83,_0x559013){return function(_0x499af0){if(_0x499af0){return _0x499af0[_0xaa30('0x36')](_0x1d6d83)[_0xaa30('0x37')](function(_0x4e004e){return _0x4e004e;});}return null;};}function removeEntity(_0xc81d7e,_0x4c83dd){return function(_0x3ca2b5){if(_0x3ca2b5){return _0x3ca2b5['destroy']()[_0xaa30('0x37')](function(){_0xc81d7e[_0xaa30('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x167a66,_0x2bc6f2){return function(_0x3dd1ed){if(!_0x3dd1ed){_0x167a66[_0xaa30('0x38')](0x194);}return _0x3dd1ed;};}function handleError(_0x285b68,_0x61c959){_0x61c959=_0x61c959||0x1f4;return function(_0x5cfc85){logger[_0xaa30('0x25')](_0x5cfc85[_0xaa30('0x39')]);if(_0x5cfc85['name']){delete _0x5cfc85[_0xaa30('0x3a')];}_0x285b68[_0xaa30('0x2b')](_0x61c959)[_0xaa30('0x3b')](_0x5cfc85);};}exports['index']=function(_0x4add3e,_0x28e256){var _0x21ffb0={},_0x1b41b2={},_0x1b22ed={'count':0x0,'rows':[]};var _0x1ec3cf=_[_0xaa30('0x3c')](db['SmsMessage']['rawAttributes'],function(_0x120c43){return{'name':_0x120c43[_0xaa30('0x3d')],'type':_0x120c43[_0xaa30('0x3e')]['key']};});_0x1b41b2[_0xaa30('0x3f')]=_[_0xaa30('0x3c')](_0x1ec3cf,_0xaa30('0x3a'));_0x1b41b2[_0xaa30('0x40')]=_['keys'](_0x4add3e[_0xaa30('0x40')]);_0x1b41b2[_0xaa30('0x41')]=_[_0xaa30('0x42')](_0x1b41b2[_0xaa30('0x3f')],_0x1b41b2[_0xaa30('0x40')]);_0x21ffb0['attributes']=_[_0xaa30('0x42')](_0x1b41b2[_0xaa30('0x3f')],qs[_0xaa30('0x43')](_0x4add3e[_0xaa30('0x40')][_0xaa30('0x43')]));_0x21ffb0[_0xaa30('0x44')]=_0x21ffb0[_0xaa30('0x44')][_0xaa30('0x45')]?_0x21ffb0['attributes']:_0x1b41b2['model'];if(!_0x4add3e[_0xaa30('0x40')]['hasOwnProperty']('nolimit')){_0x21ffb0['limit']=qs[_0xaa30('0x2f')](_0x4add3e['query'][_0xaa30('0x2f')]);_0x21ffb0['offset']=qs[_0xaa30('0x2d')](_0x4add3e[_0xaa30('0x40')][_0xaa30('0x2d')]);}_0x21ffb0[_0xaa30('0x46')]=qs[_0xaa30('0x47')](_0x4add3e[_0xaa30('0x40')][_0xaa30('0x47')]);_0x21ffb0[_0xaa30('0x48')]=qs[_0xaa30('0x41')](_[_0xaa30('0x49')](_0x4add3e[_0xaa30('0x40')],_0x1b41b2['filters']),_0x1ec3cf);if(_0x4add3e[_0xaa30('0x40')][_0xaa30('0x4a')]){_0x21ffb0[_0xaa30('0x48')]=_[_0xaa30('0x4b')](_0x21ffb0[_0xaa30('0x48')],{'$or':_['map'](_0x1ec3cf,function(_0x539a33){if(_0x539a33[_0xaa30('0x3e')]!=='VIRTUAL'){var _0x6ad83e={};_0x6ad83e[_0x539a33[_0xaa30('0x3a')]]={'$like':'%'+_0x4add3e[_0xaa30('0x40')][_0xaa30('0x4a')]+'%'};return _0x6ad83e;}})});}_0x21ffb0=_[_0xaa30('0x4b')]({},_0x21ffb0,_0x4add3e[_0xaa30('0x4c')]);var _0x2787a8={'where':_0x21ffb0['where']};return db[_0xaa30('0x4d')][_0xaa30('0x30')](_0x2787a8)[_0xaa30('0x37')](function(_0x5cacee){_0x1b22ed[_0xaa30('0x30')]=_0x5cacee;if(_0x4add3e[_0xaa30('0x40')]['includeAll']){_0x21ffb0[_0xaa30('0x4e')]=[{'all':!![]}];}return db['SmsMessage'][_0xaa30('0x4f')](_0x21ffb0);})['then'](function(_0x4b68d5){_0x1b22ed[_0xaa30('0x50')]=_0x4b68d5;return _0x1b22ed;})['then'](respondWithFilteredResult(_0x28e256,_0x21ffb0))['catch'](handleError(_0x28e256,null));};exports[_0xaa30('0x51')]=function(_0x1083e2,_0x2574f5){var _0x66c644={'raw':!![],'where':{'id':_0x1083e2[_0xaa30('0x52')]['id']}},_0x3f80fd={};_0x3f80fd['model']=_[_0xaa30('0x53')](db[_0xaa30('0x4d')][_0xaa30('0x54')]);_0x3f80fd['query']=_['keys'](_0x1083e2['query']);_0x3f80fd['filters']=_[_0xaa30('0x42')](_0x3f80fd[_0xaa30('0x3f')],_0x3f80fd[_0xaa30('0x40')]);_0x66c644[_0xaa30('0x44')]=_[_0xaa30('0x42')](_0x3f80fd[_0xaa30('0x3f')],qs['fields'](_0x1083e2[_0xaa30('0x40')][_0xaa30('0x43')]));_0x66c644[_0xaa30('0x44')]=_0x66c644[_0xaa30('0x44')]['length']?_0x66c644[_0xaa30('0x44')]:_0x3f80fd[_0xaa30('0x3f')];if(_0x1083e2[_0xaa30('0x40')][_0xaa30('0x55')]){_0x66c644[_0xaa30('0x4e')]=[{'all':!![]}];}_0x66c644=_['merge']({},_0x66c644,_0x1083e2['options']);return db[_0xaa30('0x4d')][_0xaa30('0x56')](_0x66c644)[_0xaa30('0x37')](handleEntityNotFound(_0x2574f5,null))['then'](respondWithResult(_0x2574f5,null))[_0xaa30('0x2a')](handleError(_0x2574f5,null));};exports['create']=function(_0x2fafda,_0x13171f){return db['SmsMessage'][_0xaa30('0x57')](_0x2fafda[_0xaa30('0x58')],{})['then'](respondWithResult(_0x13171f,0xc9))[_0xaa30('0x2a')](handleError(_0x13171f,null));};exports['update']=function(_0x5b227d,_0x16cb58){if(_0x5b227d[_0xaa30('0x58')]['id']){delete _0x5b227d[_0xaa30('0x58')]['id'];}return db['SmsMessage'][_0xaa30('0x56')]({'where':{'id':_0x5b227d[_0xaa30('0x52')]['id']}})[_0xaa30('0x37')](handleEntityNotFound(_0x16cb58,null))[_0xaa30('0x37')](saveUpdates(_0x5b227d[_0xaa30('0x58')],null))[_0xaa30('0x37')](respondWithResult(_0x16cb58,null))[_0xaa30('0x2a')](handleError(_0x16cb58,null));};exports[_0xaa30('0x59')]=function(_0x242b5a,_0x426b90){return db[_0xaa30('0x4d')][_0xaa30('0x56')]({'where':{'id':_0x242b5a[_0xaa30('0x52')]['id']}})['then'](handleEntityNotFound(_0x426b90,null))[_0xaa30('0x37')](removeEntity(_0x426b90,null))[_0xaa30('0x2a')](handleError(_0x426b90,null));};exports[_0xaa30('0x5a')]=function(_0x5b6e3d,_0x248300){return db[_0xaa30('0x4d')][_0xaa30('0x5a')]()[_0xaa30('0x37')](respondWithResult(_0x248300,null))[_0xaa30('0x2a')](handleError(_0x248300,null));};var interaction_log=require(_0xaa30('0x5b'))('sms-interactions');exports[_0xaa30('0x5c')]=function(_0x4f5222,_0x36242e,_0x4121fb){var _0x315303={'agent':{},'channel':_0xaa30('0x5d')};if(_0x4f5222['body']['id']){delete _0x4f5222[_0xaa30('0x58')]['id'];}_0x4f5222[_0xaa30('0x58')]['read']=!![];_0x4f5222[_0xaa30('0x58')][_0xaa30('0x5e')]=moment()[_0xaa30('0x5f')](_0xaa30('0x60'));_0x4f5222[_0xaa30('0x58')][_0xaa30('0x61')]=_0x4f5222['body'][_0xaa30('0x61')]||_0x4f5222[_0xaa30('0x62')]['id'];_0x315303[_0xaa30('0x63')]['id']=_0x4f5222[_0xaa30('0x58')][_0xaa30('0x61')];return db[_0xaa30('0x4d')][_0xaa30('0x56')]({'where':{'id':_0x4f5222[_0xaa30('0x52')]['id'],'UserId':null}})[_0xaa30('0x37')](handleEntityNotFound(_0x36242e,null))[_0xaa30('0x37')](saveUpdates(_0x4f5222[_0xaa30('0x58')],null))[_0xaa30('0x37')](function(_0x37537e){if(_0x37537e){_0x315303['message']=_0x37537e[_0xaa30('0x64')]({'plain':!![]});return db['SmsInteraction'][_0xaa30('0x56')]({'where':{'id':_0x37537e['SmsInteractionId']}});}return null;})[_0xaa30('0x37')](handleEntityNotFound(_0x36242e,null))[_0xaa30('0x37')](function(_0x211a83){if(_0x211a83){return _0x211a83['update']({'UserId':_0x4f5222[_0xaa30('0x58')][_0xaa30('0x61')],'read1stAt':_['isNil'](_0x211a83[_0xaa30('0x65')])?moment()['format'](_0xaa30('0x60')):undefined});}return null;})['then'](function(_0x4f134e){if(_0x4f134e){_0x315303[_0xaa30('0x66')]=_0x4f134e[_0xaa30('0x64')]({'plain':!![]});interaction_log[_0xaa30('0x28')](_0xaa30('0x67'),_0x4f5222[_0xaa30('0x62')]['id'],_0x4f5222[_0xaa30('0x62')][_0xaa30('0x3a')],_0x4f5222['user'][_0xaa30('0x68')],_0x315303[_0xaa30('0x66')]['id'],_0x4f5222[_0xaa30('0x58')]?JSON['stringify'](_0x4f5222[_0xaa30('0x58')]):_0xaa30('0x69'));return respondWithRpcPromise(_0xaa30('0x6a'),'acceptMessage',_0x315303);}return null;})[_0xaa30('0x37')](function(_0x5a2004){var _0x406c71='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5a2004['message'][_0xaa30('0x6b')];return db[_0xaa30('0x6c')]['query'](_0x406c71,{'type':db[_0xaa30('0x6d')][_0xaa30('0x6e')][_0xaa30('0x6f')],'raw':!![]})['then'](function(_0x37768b){return _0x37768b;});})[_0xaa30('0x37')](function(_0x23daeb){if(_0x23daeb){_0x315303[_0xaa30('0x27')][_0xaa30('0x70')]=_0x23daeb[0x0];if(!_0x4f5222[_0xaa30('0x58')][_0xaa30('0x61')])return;return db['User'][_0xaa30('0x56')]({'where':{'id':_0x4f5222[_0xaa30('0x58')][_0xaa30('0x61')],'role':_0xaa30('0x63')},'attributes':['id','name',_0xaa30('0x71'),_0xaa30('0x72'),'internal'],'raw':!![]});}return null;})[_0xaa30('0x37')](function(_0x2d9dd8){if(!_0x2d9dd8)return null;_0x315303[_0xaa30('0x27')][_0xaa30('0x63')]=_0x2d9dd8;return _0x315303;})[_0xaa30('0x37')](function(_0x297d92){if(_0x297d92){if(_0x4f5222['body'][_0xaa30('0x73')]){_0x315303[_0xaa30('0x27')]['interface']=util[_0xaa30('0x5f')](_0xaa30('0x74'),_0x4f5222[_0xaa30('0x62')][_0xaa30('0x3a')]);_0x315303[_0xaa30('0x27')]['channel']=_0x315303[_0xaa30('0x75')];_0x315303[_0xaa30('0x27')][_0xaa30('0x76')]=_0x315303[_0xaa30('0x75')];_0x315303[_0xaa30('0x27')][_0xaa30('0x77')]='accept';return respondWithRpcPromise(_0xaa30('0x78'),_0xaa30('0x78'),{'event':'acceptmessage','message':_0x315303['message']},client9002)[_0xaa30('0x37')](function(){return _0x315303;});}return _0x315303;}return null;})[_0xaa30('0x37')](respondWithResult(_0x36242e,null))[_0xaa30('0x2a')](handleError(_0x36242e,null));};var interaction_log=require(_0xaa30('0x5b'))(_0xaa30('0x79'));exports[_0xaa30('0x34')]=function(_0x2548be,_0x49c3ab,_0x4ba590){var _0x5d3646={'agent':{},'channel':_0xaa30('0x5d')};if(_0x2548be[_0xaa30('0x58')]['id']){delete _0x2548be[_0xaa30('0x58')]['id'];}_0x2548be[_0xaa30('0x58')][_0xaa30('0x61')]=_0x2548be['body'][_0xaa30('0x61')]||_0x2548be[_0xaa30('0x62')]['id'];_0x5d3646[_0xaa30('0x63')]['id']=_0x2548be[_0xaa30('0x58')][_0xaa30('0x61')];return db[_0xaa30('0x4d')][_0xaa30('0x56')]({'where':{'id':_0x2548be[_0xaa30('0x52')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x49c3ab,null))['then'](function(_0x57a96c){if(_0x57a96c){_0x5d3646[_0xaa30('0x27')]=_0x57a96c[_0xaa30('0x64')]({'plain':!![]});return db['SmsInteraction'][_0xaa30('0x56')]({'where':{'id':_0x57a96c[_0xaa30('0x7a')]}});}return null;})[_0xaa30('0x37')](handleEntityNotFound(_0x49c3ab,null))[_0xaa30('0x37')](function(_0x404f82){if(_0x404f82){_0x5d3646['interaction']=_0x404f82[_0xaa30('0x64')]({'plain':!![]});interaction_log[_0xaa30('0x28')](_0xaa30('0x7b'),_0x2548be['user']['id'],_0x2548be[_0xaa30('0x62')][_0xaa30('0x3a')],_0x2548be[_0xaa30('0x62')][_0xaa30('0x68')],_0x5d3646[_0xaa30('0x66')]['id'],_0x2548be[_0xaa30('0x58')]?JSON[_0xaa30('0x7c')](_0x2548be['body']):_0xaa30('0x69'));return respondWithRpcPromise(_0xaa30('0x7d'),_0xaa30('0x7e'),_0x5d3646);}return null;})[_0xaa30('0x37')](function(_0x24012d){var _0x42ea47=_0xaa30('0x7f')+_0x24012d[_0xaa30('0x27')][_0xaa30('0x6b')];return db[_0xaa30('0x6c')][_0xaa30('0x40')](_0x42ea47,{'type':db[_0xaa30('0x6d')][_0xaa30('0x6e')]['SELECT'],'raw':!![]})[_0xaa30('0x37')](function(_0x4c6bef){return _0x4c6bef;});})[_0xaa30('0x37')](function(_0xed4f27){if(_0xed4f27){_0x5d3646[_0xaa30('0x27')][_0xaa30('0x70')]=_0xed4f27[0x0];if(!_0x2548be[_0xaa30('0x58')][_0xaa30('0x61')])return;return db[_0xaa30('0x80')][_0xaa30('0x56')]({'where':{'id':_0x2548be[_0xaa30('0x58')][_0xaa30('0x61')],'role':_0xaa30('0x63')},'attributes':['id',_0xaa30('0x3a'),_0xaa30('0x71'),_0xaa30('0x72'),_0xaa30('0x81')],'raw':!![]});}return null;})[_0xaa30('0x37')](function(_0x35a47f){if(!_0x35a47f)return null;_0x5d3646[_0xaa30('0x27')][_0xaa30('0x63')]=_0x35a47f;return _0x5d3646;})['then'](function(_0x42987d){if(_0x42987d){_0x42987d[_0xaa30('0x27')][_0xaa30('0x82')]=util[_0xaa30('0x5f')](_0xaa30('0x74'),_0x2548be[_0xaa30('0x62')][_0xaa30('0x3a')]);_0x42987d['message'][_0xaa30('0x75')]=_0x5d3646[_0xaa30('0x75')];_0x42987d['message'][_0xaa30('0x76')]=_0x5d3646[_0xaa30('0x75')];_0x42987d['message'][_0xaa30('0x77')]=_0xaa30('0x34');respondWithRpcPromise(_0xaa30('0x78'),_0xaa30('0x78'),{'event':'rejectmessage','message':_0x42987d[_0xaa30('0x27')]},client9002);return _0x5d3646;}return null;})['then'](respondWithResult(_0x49c3ab,null))[_0xaa30('0x2a')](handleError(_0x49c3ab,null));};exports[_0xaa30('0x2b')]=function(_0x24f60f,_0x3fb561,_0x24a3af){if(_0x24f60f[_0xaa30('0x58')]['id']){delete _0x24f60f[_0xaa30('0x58')]['id'];}var _0x2e73e1;return db[_0xaa30('0x4d')]['find']({'where':{'id':_0x24f60f[_0xaa30('0x52')]['id']}})[_0xaa30('0x37')](handleEntityNotFound(_0x3fb561,null))['then'](function(_0x1f48c1){if(_0x1f48c1){_0x2e73e1=_0x1f48c1;return db[_0xaa30('0x83')]['find']({'where':{'id':_0x1f48c1[_0xaa30('0x84')]}});}})[_0xaa30('0x37')](handleEntityNotFound(_0x3fb561,null))['then'](function(_0x44b202){if(_0x44b202){logger['debug']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xaa30('0x2b'),_0xaa30('0x85'),_0x44b202['type'],util['inspect'](_0x24f60f[_0xaa30('0x58')],{'showHidden':![],'depth':null}));switch(_0x44b202[_0xaa30('0x3e')]){case'twilio':if(_0x24f60f[_0xaa30('0x58')]['MessageSid']&&_0x24f60f['body'][_0xaa30('0x86')]===_0x2e73e1['messageId']){return _0x2e73e1[_0xaa30('0x36')]({'read':!![]});}else{logger['error'](_0xaa30('0x87'),_0xaa30('0x2b'),_0xaa30('0x88'),util[_0xaa30('0x89')](_0x24f60f[_0xaa30('0x58')],{'showHidden':![],'depth':null}));}break;case _0xaa30('0x8a'):if(_0x24f60f[_0xaa30('0x58')][_0xaa30('0x8b')]&&_0x24f60f[_0xaa30('0x58')]['MessageUUID']===_0x2e73e1['messageId']&&_[_0xaa30('0x8c')]([_0xaa30('0x8d'),_0xaa30('0x8e')],_0x24f60f['body']['Status'])>=0x0){return _0x2e73e1[_0xaa30('0x36')]({'read':!![]});}else{logger['error'](_0xaa30('0x87'),_0xaa30('0x2b'),_0xaa30('0x8f'),util[_0xaa30('0x89')](_0x24f60f['body'],{'showHidden':![],'depth':null}));}break;case _0xaa30('0x90'):var _0x5d061b=_0x24f60f[_0xaa30('0x58')][_0xaa30('0x91')][0x0];if(_0x5d061b[_0xaa30('0x2b')][_0xaa30('0x92')]==='DELIVERED'){return _0x2e73e1[_0xaa30('0x36')]({'read':!![]});}else{logger[_0xaa30('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xaa30('0x2b'),'infobip',util[_0xaa30('0x89')](_0x24f60f['body'],{'showHidden':![],'depth':null}));}break;}return _0x2e73e1;}})[_0xaa30('0x37')](respondWithResult(_0x3fb561,null))[_0xaa30('0x2a')](handleError(_0x3fb561,null));}; \ No newline at end of file +var _0xd2ed=['user','null','AcceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','interface','SIP/%s','channel','motionChannel','event','EventManager','SmsInteractionId','role','RejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','internal','rejectmessage','SmsAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','plivo','MessageUUID','sent','delivered','Status','SmsAccount,\x20%s,\x20%s,\x20%s','infobip','results','groupName','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./smsMessage.socket','register','jayson/promise','client','request','then','info','debug','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','SmsMessage,\x20%s,\x20%s','message','result','catch','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','sendStatus','name','send','index','SmsMessage','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','findAll','rows','show','params','keys','find','create','body','describe','../../config/logger','sms-interactions','accept','sms','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','SmsInteraction','read1stAt','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd2ed,0x14d));var _0xdd2e=function(_0x43c0d8,_0x59449e){_0x43c0d8=_0x43c0d8-0x0;var _0x255aaf=_0xd2ed[_0x43c0d8];return _0x255aaf;};'use strict';var emlformat=require(_0xdd2e('0x0'));var rimraf=require(_0xdd2e('0x1'));var zipdir=require(_0xdd2e('0x2'));var jsonpatch=require(_0xdd2e('0x3'));var rp=require(_0xdd2e('0x4'));var moment=require(_0xdd2e('0x5'));var BPromise=require(_0xdd2e('0x6'));var Mustache=require(_0xdd2e('0x7'));var util=require('util');var path=require(_0xdd2e('0x8'));var sox=require('sox');var csv=require(_0xdd2e('0x9'));var ejs=require(_0xdd2e('0xa'));var fs=require('fs');var fs_extra=require(_0xdd2e('0xb'));var _=require(_0xdd2e('0xc'));var squel=require('squel');var crypto=require(_0xdd2e('0xd'));var jsforce=require(_0xdd2e('0xe'));var deskjs=require(_0xdd2e('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xdd2e('0x10'));var Redis=require('ioredis');var authService=require(_0xdd2e('0x11'));var qs=require(_0xdd2e('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdd2e('0x13'));var logger=require('../../config/logger')(_0xdd2e('0x14'));var utils=require(_0xdd2e('0x15'));var config=require(_0xdd2e('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xdd2e('0x17'))['db'];config[_0xdd2e('0x18')]=_[_0xdd2e('0x19')](config[_0xdd2e('0x18')],{'host':_0xdd2e('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdd2e('0x18')]));require(_0xdd2e('0x1b'))[_0xdd2e('0x1c')](socket);var jayson=require(_0xdd2e('0x1d'));var client=jayson[_0xdd2e('0x1e')]['http']({'port':0x232c});var client9002=jayson[_0xdd2e('0x1e')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5edf6c,_0x4778fa,_0xdfd5d2,_0x5884c9){return new BPromise(function(_0x41aef6,_0x1face0){var _0xc727f5=_0x5884c9||client;return _0xc727f5[_0xdd2e('0x1f')](_0x5edf6c,_0xdfd5d2)[_0xdd2e('0x20')](function(_0x1b7483){logger[_0xdd2e('0x21')]('SmsMessage,\x20%s,\x20%s',_0x4778fa,'request\x20sent');logger[_0xdd2e('0x22')](_0xdd2e('0x23'),_0x4778fa,_0xdd2e('0x24'),JSON[_0xdd2e('0x25')](_0x1b7483));if(_0x1b7483['error']){if(_0x1b7483['error'][_0xdd2e('0x26')]===0x1f4){logger[_0xdd2e('0x27')](_0xdd2e('0x28'),_0x4778fa,_0x1b7483[_0xdd2e('0x27')][_0xdd2e('0x29')]);return _0x1face0(_0x1b7483['error']['message']);}logger['error'](_0xdd2e('0x28'),_0x4778fa,_0x1b7483[_0xdd2e('0x27')][_0xdd2e('0x29')]);return _0x41aef6(_0x1b7483['error']['message']);}else{logger[_0xdd2e('0x21')](_0xdd2e('0x28'),_0x4778fa,'request\x20sent');_0x41aef6(_0x1b7483[_0xdd2e('0x2a')][_0xdd2e('0x29')]);}})[_0xdd2e('0x2b')](function(_0xd3ff3d){logger[_0xdd2e('0x27')]('SmsMessage,\x20%s,\x20%s',_0x4778fa,_0xd3ff3d);_0x1face0(_0xd3ff3d);});});}function respondWithStatusCode(_0x3e1c38,_0x2886fb){_0x2886fb=_0x2886fb||0xcc;return function(_0x4423de){if(_0x4423de){return _0x3e1c38['sendStatus'](_0x2886fb);}return _0x3e1c38['status'](_0x2886fb)[_0xdd2e('0x2c')]();};}function respondWithResult(_0x6a9fe9,_0x4592c1){_0x4592c1=_0x4592c1||0xc8;return function(_0x478837){if(_0x478837){return _0x6a9fe9[_0xdd2e('0x2d')](_0x4592c1)[_0xdd2e('0x2e')](_0x478837);}};}function respondWithFilteredResult(_0x342199,_0x5ac143){return function(_0x1ff68c){if(_0x1ff68c){var _0x5db678=typeof _0x5ac143[_0xdd2e('0x2f')]===_0xdd2e('0x30')&&typeof _0x5ac143[_0xdd2e('0x31')]===_0xdd2e('0x30');var _0x4269ed=_0x1ff68c['count'];var _0x489a40=_0x5db678?0x0:_0x5ac143['offset'];var _0x57749e=_0x5db678?_0x1ff68c[_0xdd2e('0x32')]:_0x5ac143[_0xdd2e('0x2f')]+_0x5ac143[_0xdd2e('0x31')];var _0x4fb364;if(_0x57749e>=_0x4269ed){_0x57749e=_0x4269ed;_0x4fb364=0xc8;}else{_0x4fb364=0xce;}_0x342199[_0xdd2e('0x2d')](_0x4fb364);return _0x342199[_0xdd2e('0x33')](_0xdd2e('0x34'),_0x489a40+'-'+_0x57749e+'/'+_0x4269ed)[_0xdd2e('0x2e')](_0x1ff68c);}return null;};}function patchUpdates(_0x5a7e57){return function(_0x7c3b7e){try{jsonpatch[_0xdd2e('0x35')](_0x7c3b7e,_0x5a7e57,!![]);}catch(_0x237d9c){return BPromise[_0xdd2e('0x36')](_0x237d9c);}return _0x7c3b7e[_0xdd2e('0x37')]();};}function saveUpdates(_0x5ae745,_0xa03be){return function(_0x38f885){if(_0x38f885){return _0x38f885[_0xdd2e('0x38')](_0x5ae745)[_0xdd2e('0x20')](function(_0x1ddb3e){return _0x1ddb3e;});}return null;};}function removeEntity(_0x26590d,_0x278f4c){return function(_0x55eb8e){if(_0x55eb8e){return _0x55eb8e[_0xdd2e('0x39')]()[_0xdd2e('0x20')](function(){_0x26590d['status'](0xcc)[_0xdd2e('0x2c')]();});}};}function handleEntityNotFound(_0x468afb,_0x272d7f){return function(_0x16a93f){if(!_0x16a93f){_0x468afb[_0xdd2e('0x3a')](0x194);}return _0x16a93f;};}function handleError(_0x1b5f42,_0x2a8555){_0x2a8555=_0x2a8555||0x1f4;return function(_0x589a34){logger['error'](_0x589a34['stack']);if(_0x589a34[_0xdd2e('0x3b')]){delete _0x589a34[_0xdd2e('0x3b')];}_0x1b5f42[_0xdd2e('0x2d')](_0x2a8555)[_0xdd2e('0x3c')](_0x589a34);};}exports[_0xdd2e('0x3d')]=function(_0x57f9c7,_0x473bb6){var _0x1913f7={},_0x2f4882={},_0x2fcf23={'count':0x0,'rows':[]};var _0x3f5a17=_['map'](db[_0xdd2e('0x3e')][_0xdd2e('0x3f')],function(_0x6939f2){return{'name':_0x6939f2[_0xdd2e('0x40')],'type':_0x6939f2[_0xdd2e('0x41')][_0xdd2e('0x42')]};});_0x2f4882[_0xdd2e('0x43')]=_[_0xdd2e('0x44')](_0x3f5a17,_0xdd2e('0x3b'));_0x2f4882['query']=_['keys'](_0x57f9c7[_0xdd2e('0x45')]);_0x2f4882[_0xdd2e('0x46')]=_['intersection'](_0x2f4882[_0xdd2e('0x43')],_0x2f4882[_0xdd2e('0x45')]);_0x1913f7[_0xdd2e('0x47')]=_[_0xdd2e('0x48')](_0x2f4882[_0xdd2e('0x43')],qs[_0xdd2e('0x49')](_0x57f9c7['query'][_0xdd2e('0x49')]));_0x1913f7[_0xdd2e('0x47')]=_0x1913f7[_0xdd2e('0x47')][_0xdd2e('0x4a')]?_0x1913f7[_0xdd2e('0x47')]:_0x2f4882[_0xdd2e('0x43')];if(!_0x57f9c7['query'][_0xdd2e('0x4b')]('nolimit')){_0x1913f7[_0xdd2e('0x31')]=qs[_0xdd2e('0x31')](_0x57f9c7[_0xdd2e('0x45')]['limit']);_0x1913f7[_0xdd2e('0x2f')]=qs[_0xdd2e('0x2f')](_0x57f9c7['query']['offset']);}_0x1913f7[_0xdd2e('0x4c')]=qs[_0xdd2e('0x4d')](_0x57f9c7[_0xdd2e('0x45')][_0xdd2e('0x4d')]);_0x1913f7[_0xdd2e('0x4e')]=qs[_0xdd2e('0x46')](_[_0xdd2e('0x4f')](_0x57f9c7[_0xdd2e('0x45')],_0x2f4882[_0xdd2e('0x46')]),_0x3f5a17);if(_0x57f9c7['query'][_0xdd2e('0x50')]){_0x1913f7['where']=_['merge'](_0x1913f7['where'],{'$or':_[_0xdd2e('0x44')](_0x3f5a17,function(_0x2a0027){if(_0x2a0027[_0xdd2e('0x41')]!==_0xdd2e('0x51')){var _0x51c624={};_0x51c624[_0x2a0027['name']]={'$like':'%'+_0x57f9c7[_0xdd2e('0x45')][_0xdd2e('0x50')]+'%'};return _0x51c624;}})});}_0x1913f7=_[_0xdd2e('0x52')]({},_0x1913f7,_0x57f9c7[_0xdd2e('0x53')]);var _0x191e0d={'where':_0x1913f7['where']};return db[_0xdd2e('0x3e')][_0xdd2e('0x32')](_0x191e0d)['then'](function(_0x591a66){_0x2fcf23[_0xdd2e('0x32')]=_0x591a66;if(_0x57f9c7['query']['includeAll']){_0x1913f7['include']=[{'all':!![]}];}return db['SmsMessage'][_0xdd2e('0x54')](_0x1913f7);})[_0xdd2e('0x20')](function(_0x2c4f7c){_0x2fcf23[_0xdd2e('0x55')]=_0x2c4f7c;return _0x2fcf23;})[_0xdd2e('0x20')](respondWithFilteredResult(_0x473bb6,_0x1913f7))[_0xdd2e('0x2b')](handleError(_0x473bb6,null));};exports[_0xdd2e('0x56')]=function(_0x4dd85b,_0x1cf5d3){var _0x31e756={'raw':!![],'where':{'id':_0x4dd85b[_0xdd2e('0x57')]['id']}},_0x27e420={};_0x27e420[_0xdd2e('0x43')]=_[_0xdd2e('0x58')](db[_0xdd2e('0x3e')]['rawAttributes']);_0x27e420['query']=_[_0xdd2e('0x58')](_0x4dd85b['query']);_0x27e420[_0xdd2e('0x46')]=_['intersection'](_0x27e420[_0xdd2e('0x43')],_0x27e420[_0xdd2e('0x45')]);_0x31e756[_0xdd2e('0x47')]=_[_0xdd2e('0x48')](_0x27e420[_0xdd2e('0x43')],qs['fields'](_0x4dd85b[_0xdd2e('0x45')][_0xdd2e('0x49')]));_0x31e756[_0xdd2e('0x47')]=_0x31e756[_0xdd2e('0x47')][_0xdd2e('0x4a')]?_0x31e756[_0xdd2e('0x47')]:_0x27e420['model'];if(_0x4dd85b[_0xdd2e('0x45')]['includeAll']){_0x31e756['include']=[{'all':!![]}];}_0x31e756=_[_0xdd2e('0x52')]({},_0x31e756,_0x4dd85b[_0xdd2e('0x53')]);return db[_0xdd2e('0x3e')][_0xdd2e('0x59')](_0x31e756)[_0xdd2e('0x20')](handleEntityNotFound(_0x1cf5d3,null))['then'](respondWithResult(_0x1cf5d3,null))[_0xdd2e('0x2b')](handleError(_0x1cf5d3,null));};exports[_0xdd2e('0x5a')]=function(_0x27ff0,_0x5d91b6){return db[_0xdd2e('0x3e')][_0xdd2e('0x5a')](_0x27ff0[_0xdd2e('0x5b')],{})[_0xdd2e('0x20')](respondWithResult(_0x5d91b6,0xc9))[_0xdd2e('0x2b')](handleError(_0x5d91b6,null));};exports[_0xdd2e('0x38')]=function(_0x550431,_0x465dae){if(_0x550431[_0xdd2e('0x5b')]['id']){delete _0x550431[_0xdd2e('0x5b')]['id'];}return db[_0xdd2e('0x3e')][_0xdd2e('0x59')]({'where':{'id':_0x550431['params']['id']}})[_0xdd2e('0x20')](handleEntityNotFound(_0x465dae,null))['then'](saveUpdates(_0x550431[_0xdd2e('0x5b')],null))['then'](respondWithResult(_0x465dae,null))[_0xdd2e('0x2b')](handleError(_0x465dae,null));};exports[_0xdd2e('0x39')]=function(_0x4713fd,_0x98892){return db[_0xdd2e('0x3e')][_0xdd2e('0x59')]({'where':{'id':_0x4713fd[_0xdd2e('0x57')]['id']}})[_0xdd2e('0x20')](handleEntityNotFound(_0x98892,null))[_0xdd2e('0x20')](removeEntity(_0x98892,null))['catch'](handleError(_0x98892,null));};exports[_0xdd2e('0x5c')]=function(_0x25464f,_0x1e2a45){return db[_0xdd2e('0x3e')][_0xdd2e('0x5c')]()[_0xdd2e('0x20')](respondWithResult(_0x1e2a45,null))[_0xdd2e('0x2b')](handleError(_0x1e2a45,null));};var interaction_log=require(_0xdd2e('0x5d'))(_0xdd2e('0x5e'));exports[_0xdd2e('0x5f')]=function(_0xcb86e,_0x1925c9,_0x4c4ee0){var _0x2e9951={'agent':{},'channel':_0xdd2e('0x60')};if(_0xcb86e[_0xdd2e('0x5b')]['id']){delete _0xcb86e['body']['id'];}_0xcb86e[_0xdd2e('0x5b')][_0xdd2e('0x61')]=!![];_0xcb86e[_0xdd2e('0x5b')][_0xdd2e('0x62')]=moment()[_0xdd2e('0x63')](_0xdd2e('0x64'));_0xcb86e[_0xdd2e('0x5b')][_0xdd2e('0x65')]=_0xcb86e[_0xdd2e('0x5b')]['UserId']||_0xcb86e['user']['id'];_0x2e9951[_0xdd2e('0x66')]['id']=_0xcb86e[_0xdd2e('0x5b')][_0xdd2e('0x65')];return db[_0xdd2e('0x3e')][_0xdd2e('0x59')]({'where':{'id':_0xcb86e['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x1925c9,null))[_0xdd2e('0x20')](saveUpdates(_0xcb86e['body'],null))[_0xdd2e('0x20')](function(_0x49e27f){if(_0x49e27f){_0x2e9951[_0xdd2e('0x29')]=_0x49e27f[_0xdd2e('0x67')]({'plain':!![]});return db[_0xdd2e('0x68')][_0xdd2e('0x59')]({'where':{'id':_0x49e27f['SmsInteractionId']}});}return null;})[_0xdd2e('0x20')](handleEntityNotFound(_0x1925c9,null))[_0xdd2e('0x20')](function(_0x2b63c0){if(_0x2b63c0){return _0x2b63c0[_0xdd2e('0x38')]({'UserId':_0xcb86e['body'][_0xdd2e('0x65')],'read1stAt':_['isNil'](_0x2b63c0[_0xdd2e('0x69')])?moment()[_0xdd2e('0x63')](_0xdd2e('0x64')):undefined});}return null;})[_0xdd2e('0x20')](function(_0x54047b){if(_0x54047b){_0x2e9951[_0xdd2e('0x6a')]=_0x54047b[_0xdd2e('0x67')]({'plain':!![]});interaction_log[_0xdd2e('0x21')](_0xdd2e('0x6b'),_0xcb86e[_0xdd2e('0x6c')]['id'],_0xcb86e[_0xdd2e('0x6c')][_0xdd2e('0x3b')],_0xcb86e['user']['role'],_0x2e9951[_0xdd2e('0x6a')]['id'],_0xcb86e[_0xdd2e('0x5b')]?JSON[_0xdd2e('0x25')](_0xcb86e[_0xdd2e('0x5b')]):_0xdd2e('0x6d'));return respondWithRpcPromise(_0xdd2e('0x6e'),'acceptMessage',_0x2e9951);}return null;})[_0xdd2e('0x20')](function(_0x5b6259){var _0x46db7e='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5b6259[_0xdd2e('0x29')][_0xdd2e('0x6f')];return db[_0xdd2e('0x70')]['query'](_0x46db7e,{'type':db[_0xdd2e('0x71')][_0xdd2e('0x72')][_0xdd2e('0x73')],'raw':!![]})['then'](function(_0x2baab6){return _0x2baab6;});})[_0xdd2e('0x20')](function(_0x12f330){if(_0x12f330){_0x2e9951[_0xdd2e('0x29')][_0xdd2e('0x74')]=_0x12f330[0x0];if(!_0xcb86e[_0xdd2e('0x5b')][_0xdd2e('0x65')])return;return db[_0xdd2e('0x75')][_0xdd2e('0x59')]({'where':{'id':_0xcb86e[_0xdd2e('0x5b')][_0xdd2e('0x65')],'role':_0xdd2e('0x66')},'attributes':['id','name',_0xdd2e('0x76'),_0xdd2e('0x77'),'internal'],'raw':!![]});}return null;})['then'](function(_0x343010){if(!_0x343010)return null;_0x2e9951[_0xdd2e('0x29')][_0xdd2e('0x66')]=_0x343010;return _0x2e9951;})[_0xdd2e('0x20')](function(_0x104d74){if(_0x104d74){if(_0xcb86e[_0xdd2e('0x5b')]['manual']){_0x2e9951['message'][_0xdd2e('0x78')]=util[_0xdd2e('0x63')](_0xdd2e('0x79'),_0xcb86e['user'][_0xdd2e('0x3b')]);_0x2e9951[_0xdd2e('0x29')][_0xdd2e('0x7a')]=_0x2e9951['channel'];_0x2e9951['message'][_0xdd2e('0x7b')]=_0x2e9951['channel'];_0x2e9951[_0xdd2e('0x29')][_0xdd2e('0x7c')]=_0xdd2e('0x5f');return respondWithRpcPromise(_0xdd2e('0x7d'),_0xdd2e('0x7d'),{'event':'acceptmessage','message':_0x2e9951[_0xdd2e('0x29')]},client9002)[_0xdd2e('0x20')](function(){return _0x2e9951;});}return _0x2e9951;}return null;})[_0xdd2e('0x20')](respondWithResult(_0x1925c9,null))['catch'](handleError(_0x1925c9,null));};var interaction_log=require(_0xdd2e('0x5d'))(_0xdd2e('0x5e'));exports[_0xdd2e('0x36')]=function(_0x6a6c2d,_0x2f7304,_0x1b05ba){var _0x17a965={'agent':{},'channel':_0xdd2e('0x60')};if(_0x6a6c2d['body']['id']){delete _0x6a6c2d[_0xdd2e('0x5b')]['id'];}_0x6a6c2d[_0xdd2e('0x5b')][_0xdd2e('0x65')]=_0x6a6c2d['body'][_0xdd2e('0x65')]||_0x6a6c2d['user']['id'];_0x17a965['agent']['id']=_0x6a6c2d[_0xdd2e('0x5b')][_0xdd2e('0x65')];return db['SmsMessage'][_0xdd2e('0x59')]({'where':{'id':_0x6a6c2d[_0xdd2e('0x57')]['id'],'UserId':null}})[_0xdd2e('0x20')](handleEntityNotFound(_0x2f7304,null))[_0xdd2e('0x20')](function(_0x2750df){if(_0x2750df){_0x17a965[_0xdd2e('0x29')]=_0x2750df[_0xdd2e('0x67')]({'plain':!![]});return db['SmsInteraction'][_0xdd2e('0x59')]({'where':{'id':_0x2750df[_0xdd2e('0x7e')]}});}return null;})['then'](handleEntityNotFound(_0x2f7304,null))[_0xdd2e('0x20')](function(_0x321710){if(_0x321710){_0x17a965[_0xdd2e('0x6a')]=_0x321710[_0xdd2e('0x67')]({'plain':!![]});interaction_log[_0xdd2e('0x21')]('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x6a6c2d[_0xdd2e('0x6c')]['id'],_0x6a6c2d[_0xdd2e('0x6c')][_0xdd2e('0x3b')],_0x6a6c2d['user'][_0xdd2e('0x7f')],_0x17a965[_0xdd2e('0x6a')]['id'],_0x6a6c2d[_0xdd2e('0x5b')]?JSON[_0xdd2e('0x25')](_0x6a6c2d[_0xdd2e('0x5b')]):_0xdd2e('0x6d'));return respondWithRpcPromise(_0xdd2e('0x80'),'rejectMessage',_0x17a965);}return null;})['then'](function(_0x4b6af8){var _0x1fed0f=_0xdd2e('0x81')+_0x4b6af8[_0xdd2e('0x29')][_0xdd2e('0x6f')];return db['sequelize'][_0xdd2e('0x45')](_0x1fed0f,{'type':db['Sequelize'][_0xdd2e('0x72')][_0xdd2e('0x73')],'raw':!![]})['then'](function(_0x268cab){return _0x268cab;});})[_0xdd2e('0x20')](function(_0x50caeb){if(_0x50caeb){_0x17a965[_0xdd2e('0x29')][_0xdd2e('0x74')]=_0x50caeb[0x0];if(!_0x6a6c2d['body'][_0xdd2e('0x65')])return;return db[_0xdd2e('0x75')][_0xdd2e('0x59')]({'where':{'id':_0x6a6c2d[_0xdd2e('0x5b')]['UserId'],'role':'agent'},'attributes':['id',_0xdd2e('0x3b'),_0xdd2e('0x76'),_0xdd2e('0x77'),_0xdd2e('0x82')],'raw':!![]});}return null;})[_0xdd2e('0x20')](function(_0x5a3380){if(!_0x5a3380)return null;_0x17a965['message'][_0xdd2e('0x66')]=_0x5a3380;return _0x17a965;})[_0xdd2e('0x20')](function(_0x57c76a){if(_0x57c76a){_0x57c76a['message'][_0xdd2e('0x78')]=util[_0xdd2e('0x63')](_0xdd2e('0x79'),_0x6a6c2d['user'][_0xdd2e('0x3b')]);_0x57c76a[_0xdd2e('0x29')][_0xdd2e('0x7a')]=_0x17a965[_0xdd2e('0x7a')];_0x57c76a[_0xdd2e('0x29')][_0xdd2e('0x7b')]=_0x17a965['channel'];_0x57c76a['message'][_0xdd2e('0x7c')]='reject';respondWithRpcPromise(_0xdd2e('0x7d'),'EventManager',{'event':_0xdd2e('0x83'),'message':_0x57c76a['message']},client9002);return _0x17a965;}return null;})[_0xdd2e('0x20')](respondWithResult(_0x2f7304,null))[_0xdd2e('0x2b')](handleError(_0x2f7304,null));};exports['status']=function(_0x2c89d8,_0x541e10,_0x11128e){if(_0x2c89d8[_0xdd2e('0x5b')]['id']){delete _0x2c89d8[_0xdd2e('0x5b')]['id'];}var _0x390ed1;return db[_0xdd2e('0x3e')]['find']({'where':{'id':_0x2c89d8[_0xdd2e('0x57')]['id']}})[_0xdd2e('0x20')](handleEntityNotFound(_0x541e10,null))['then'](function(_0x11282f){if(_0x11282f){_0x390ed1=_0x11282f;return db['SmsAccount'][_0xdd2e('0x59')]({'where':{'id':_0x11282f[_0xdd2e('0x84')]}});}})[_0xdd2e('0x20')](handleEntityNotFound(_0x541e10,null))[_0xdd2e('0x20')](function(_0x5553b8){if(_0x5553b8){logger[_0xdd2e('0x22')]('SmsMessage,\x20%s,\x20%s,\x20%s','status',_0xdd2e('0x85'),_0x5553b8[_0xdd2e('0x41')],util[_0xdd2e('0x86')](_0x2c89d8[_0xdd2e('0x5b')],{'showHidden':![],'depth':null}));switch(_0x5553b8[_0xdd2e('0x41')]){case _0xdd2e('0x87'):if(_0x2c89d8['body']['MessageSid']&&_0x2c89d8[_0xdd2e('0x5b')][_0xdd2e('0x88')]===_0x390ed1[_0xdd2e('0x89')]){return _0x390ed1[_0xdd2e('0x38')]({'read':!![]});}else{logger[_0xdd2e('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xdd2e('0x2d'),_0xdd2e('0x87'),util['inspect'](_0x2c89d8[_0xdd2e('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xdd2e('0x8a'):if(_0x2c89d8[_0xdd2e('0x5b')][_0xdd2e('0x8b')]&&_0x2c89d8[_0xdd2e('0x5b')][_0xdd2e('0x8b')]===_0x390ed1[_0xdd2e('0x89')]&&_['indexOf']([_0xdd2e('0x8c'),_0xdd2e('0x8d')],_0x2c89d8[_0xdd2e('0x5b')][_0xdd2e('0x8e')])>=0x0){return _0x390ed1[_0xdd2e('0x38')]({'read':!![]});}else{logger[_0xdd2e('0x27')](_0xdd2e('0x8f'),'status','plivio',util[_0xdd2e('0x86')](_0x2c89d8[_0xdd2e('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xdd2e('0x90'):var _0x30152f=_0x2c89d8[_0xdd2e('0x5b')][_0xdd2e('0x91')][0x0];if(_0x30152f[_0xdd2e('0x2d')][_0xdd2e('0x92')]==='DELIVERED'){return _0x390ed1[_0xdd2e('0x38')]({'read':!![]});}else{logger[_0xdd2e('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0xdd2e('0x90'),util[_0xdd2e('0x86')](_0x2c89d8[_0xdd2e('0x5b')],{'showHidden':![],'depth':null}));}break;}return _0x390ed1;}})[_0xdd2e('0x20')](respondWithResult(_0x541e10,null))['catch'](handleError(_0x541e10,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 0baba7f..302c286 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 _0xb069=['update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x271b61,_0xbd7fe){var _0xd4dff6=function(_0x461106){while(--_0x461106){_0x271b61['push'](_0x271b61['shift']());}};_0xd4dff6(++_0xbd7fe);}(_0xb069,0x15b));var _0x9b06=function(_0x2c06ad,_0x347cf8){_0x2c06ad=_0x2c06ad-0x0;var _0x5d0b8e=_0xb069[_0x2c06ad];return _0x5d0b8e;};'use strict';var EventEmitter=require(_0x9b06('0x0'));var SmsMessage=require(_0x9b06('0x1'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x9b06('0x2')](0x0);var events={'afterCreate':_0x9b06('0x3'),'afterUpdate':_0x9b06('0x4'),'afterDestroy':_0x9b06('0x5')};function emitEvent(_0x3e1689){return function(_0x32604e,_0x491685,_0x1202dc){SmsMessageEvents[_0x9b06('0x6')](_0x3e1689+':'+_0x32604e['id'],_0x32604e);SmsMessageEvents[_0x9b06('0x6')](_0x3e1689,_0x32604e);_0x1202dc(null);};}for(var e in events){if(events[_0x9b06('0x7')](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module[_0x9b06('0x8')]=SmsMessageEvents; \ No newline at end of file +var _0xdadf=['hook','exports','events','../../mysqldb','SmsMessage','setMaxListeners','save','emit'];(function(_0x19b1ad,_0x199b85){var _0x429d26=function(_0x5273c4){while(--_0x5273c4){_0x19b1ad['push'](_0x19b1ad['shift']());}};_0x429d26(++_0x199b85);}(_0xdadf,0xaa));var _0xfdad=function(_0x5379e1,_0x3866cf){_0x5379e1=_0x5379e1-0x0;var _0x39b310=_0xdadf[_0x5379e1];return _0x39b310;};'use strict';var EventEmitter=require(_0xfdad('0x0'));var SmsMessage=require(_0xfdad('0x1'))['db'][_0xfdad('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xfdad('0x3')](0x0);var events={'afterCreate':_0xfdad('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x3a146a){return function(_0x256956,_0x2e2bb7,_0x42a403){SmsMessageEvents['emit'](_0x3a146a+':'+_0x256956['id'],_0x256956);SmsMessageEvents[_0xfdad('0x5')](_0x3a146a,_0x256956);_0x42a403(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0xfdad('0x6')](e,emitEvent(event));}}module[_0xfdad('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 df254b6..ab25ef1 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 _0xed5d=['SmsInteraction','findOne','update','createdAt','error','secret','SmsAccount','find','SmsAccountId','then','type','twilio','accountSid','phone','create','remote','/api/sms/messages/','/status?token=','token','sid','catch','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','https://api.skebby.it/API/v1.0/REST/','password','smsMethod','sender','&password=','GET','sms','user_key','total_sent','internal_order_id','deliveryReport','skebby','Missing\x20parameters:\x20username,\x20password','connectel','authToken','https://smsapi.connectel.se/api/v2/send/','requestid','read','Missing\x20parameters:\x20authToken','username','xCALLY\x20Motion','senderString','format','%s:%s','POST','https://rest.clicksend.com/v3/sms/send','base64','http_code','data','queued_count','head','messages','message_id','clickSend','plivo','authId','https://api.plivo.com/v1/Account/%s/Message/','toString','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','baseUrl','application/json','IBSSO\x20','infobip','Missing\x20parameters:\x20base_url','csc','apiKey','text','timestamp','keys','sort','length','md5','digest','signature=','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','clickatell','uuid','UTF-8','apiMessageId','bandwidth','https://messaging.bandwidth.com/api/v2/users/','/messages','applicationId','Basic\x20%s','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','intelepeer','Token\x20not\x20received','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','bluebird','request-promise','path','rimraf','./smsMessage.attributes','SmsMessage','messageId','fti_sms_messages','body','FULLTEXT','get','direction','toLowerCase','isNil','SmsInteractionId'];(function(_0xd532a6,_0x3696cc){var _0x3665fe=function(_0x552525){while(--_0x552525){_0xd532a6['push'](_0xd532a6['shift']());}};_0x3665fe(++_0x3696cc);}(_0xed5d,0x157));var _0xded5=function(_0x24895c,_0x519282){_0x24895c=_0x24895c-0x0;var _0x47f286=_0xed5d[_0x24895c];return _0x47f286;};'use strict';var _=require('lodash');var util=require(_0xded5('0x0'));var logger=require(_0xded5('0x1'))('api');var moment=require('moment');var BPromise=require(_0xded5('0x2'));var rp=require(_0xded5('0x3'));var fs=require('fs');var path=require(_0xded5('0x4'));var rimraf=require(_0xded5('0x5'));var config=require('../../config/environment');var attributes=require(_0xded5('0x6'));module['exports']=function(_0x4efa2c,_0x5c23cd){return _0x4efa2c['define'](_0xded5('0x7'),attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0xded5('0x8'),'fields':[_0xded5('0x8')]},{'name':_0xded5('0x9'),'fields':[_0xded5('0xa')],'type':_0xded5('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x318ded,_0x4d7a39,_0x46a992){var _0x2d89e5=_0x4efa2c['models'];var _0x23ee1b=_0x318ded[_0xded5('0xc')]({'plain':!![]});if(_0x23ee1b[_0xded5('0xd')][_0xded5('0xe')]()==='in'||_0x23ee1b['direction'][_0xded5('0xe')]()==='out'&&!_0x23ee1b['secret']&&!_[_0xded5('0xf')](_0x23ee1b['UserId'])&&!_['isNil'](_0x23ee1b[_0xded5('0x10')])){_0x2d89e5[_0xded5('0x11')][_0xded5('0x12')]({'where':{'id':_0x23ee1b[_0xded5('0x10')]}})['then'](function(_0x16282d){if(_0x16282d){_0x16282d[_0xded5('0x13')]({'lastMsgAt':_0x23ee1b[_0xded5('0x14')],'lastMsgDirection':_0x23ee1b[_0xded5('0xd')][_0xded5('0xe')]()});}})['catch'](function(_0x55e3a5){console[_0xded5('0x15')](_0x55e3a5);});}if(_0x23ee1b['direction']==='out'&&!_0x23ee1b[_0xded5('0x16')]){var _0x3b1a27;_0x2d89e5[_0xded5('0x17')][_0xded5('0x18')]({'where':{'id':_0x23ee1b[_0xded5('0x19')]},'raw':!![]})[_0xded5('0x1a')](function(_0x1b39d3){_0x3b1a27=_0x1b39d3;if(_0x3b1a27&&_0x3b1a27[_0xded5('0x1b')]){switch(_0x3b1a27[_0xded5('0x1b')]){case _0xded5('0x1c'):var _0x249e8c=require(_0xded5('0x1c'));if(_0x3b1a27[_0xded5('0x1d')]&&_0x3b1a27['authToken']&&_0x3b1a27[_0xded5('0x1e')]){var _0x5ae055=new _0x249e8c(_0x3b1a27[_0xded5('0x1d')],_0x3b1a27['authToken']);_0x5ae055['messages'][_0xded5('0x1f')]({'body':_0x23ee1b['body'],'to':_0x23ee1b['phone'],'from':_0x3b1a27[_0xded5('0x1e')],'statusCallback':_0x3b1a27[_0xded5('0x20')]+_0xded5('0x21')+_0x23ee1b['id']+_0xded5('0x22')+_0x3b1a27[_0xded5('0x23')]})['then'](function(_0x39d34d){if(_0x39d34d['sid']){return _0x318ded['update']({'messageId':_0x39d34d[_0xded5('0x24')]});}})[_0xded5('0x25')](function(_0x4f6c55){logger[_0xded5('0x15')](_0xded5('0x26'),_0xded5('0x27'),_0xded5('0x1c'),util[_0xded5('0x28')](_0x4f6c55,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xded5('0x26'),_0xded5('0x27'),_0xded5('0x1c'),_0xded5('0x29'));}break;case'skebby':var _0x2258ce=_0xded5('0x2a');if(_0x3b1a27['username']&&_0x3b1a27[_0xded5('0x2b')]){var _0xd19c5d={'recipient':[_0x23ee1b[_0xded5('0x1e')]],'message':_0x23ee1b['body'],'message_type':_0x3b1a27['smsMethod']};if(_0x3b1a27[_0xded5('0x2c')]&&_0x3b1a27[_0xded5('0x2c')]!=='SI'){_0xd19c5d[_0xded5('0x2d')]=_0x3b1a27[_0xded5('0x1e')];}var _0x3c4c44={'url':_0x2258ce+'login?username='+_0x3b1a27['username']+_0xded5('0x2e')+_0x3b1a27[_0xded5('0x2b')],'method':_0xded5('0x2f')};rp(_0x3c4c44)[_0xded5('0x1a')](function(_0x5a1601){var _0x3dfb20=_0x5a1601['split'](';');var _0x45f544={'user_key':_0x3dfb20[0x0],'session_key':_0x3dfb20[0x1]};_0x3c4c44={'url':_0x2258ce+_0xded5('0x30'),'method':'POST','headers':{'user_key':_0x45f544[_0xded5('0x31')],'Session_key':_0x45f544['session_key']},'json':!![],'body':_0xd19c5d};return rp(_0x3c4c44);})[_0xded5('0x1a')](function(_0x18c39c){if(_0x18c39c[_0xded5('0x32')]>=0x1){var _0x15c363={'messageId':_0x18c39c[_0xded5('0x33')]};if(_0x3b1a27[_0xded5('0x2c')]!=='GP'||!_0x3b1a27[_0xded5('0x34')]){_0x15c363['read']=!![];}return _0x318ded['update'](_0x15c363);}else{return logger[_0xded5('0x15')](_0xded5('0x26'),'afterCreate',_0xded5('0x35'),util[_0xded5('0x28')](_0x18c39c,{'showHidden':![],'depth':null}));}})[_0xded5('0x25')](function(_0x5845d7){return logger['error'](_0xded5('0x26'),_0xded5('0x27'),_0xded5('0x35'),util[_0xded5('0x28')](_0x5845d7,{'showHidden':![],'depth':null}));});}else{logger[_0xded5('0x15')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xded5('0x27'),_0xded5('0x35'),_0xded5('0x36'));}break;case _0xded5('0x37'):if(_0x3b1a27['authToken']){var _0x126239={'recipient':_0x23ee1b[_0xded5('0x1e')],'message':_0x23ee1b[_0xded5('0xa')],'sender':_0x3b1a27['senderString']||_0x3b1a27[_0xded5('0x1e')],'authorization':_0x3b1a27[_0xded5('0x38')]};var _0x4d7a39={'method':'POST','uri':_0xded5('0x39'),'body':_0x126239,'json':!![]};rp(_0x4d7a39)[_0xded5('0x1a')](function(_0x110e91){var _0x1052e7={'messageId':_0x110e91[_0xded5('0x3a')]};if(!_0x3b1a27[_0xded5('0x34')]){_0x1052e7[_0xded5('0x3b')]=!![];}return _0x318ded[_0xded5('0x13')](_0x1052e7);})[_0xded5('0x25')](function(_0x5aa134){logger[_0xded5('0x15')](_0xded5('0x26'),_0xded5('0x27'),_0xded5('0x37'),util[_0xded5('0x28')](_0x5aa134,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xded5('0x26'),'afterCreate',_0xded5('0x37'),_0xded5('0x3c'));}break;case'clicksend':if(_0x3b1a27[_0xded5('0x3d')]&&_0x3b1a27[_0xded5('0x2b')]){var _0x126239={'messages':[{'source':_0xded5('0x3e'),'to':_0x23ee1b[_0xded5('0x1e')],'body':_0x23ee1b['body'],'from':_0x3b1a27[_0xded5('0x3f')]||_0x3b1a27[_0xded5('0x1e')]}]};var _0x209fc9=util[_0xded5('0x40')](_0xded5('0x41'),_0x3b1a27[_0xded5('0x3d')],_0x3b1a27[_0xded5('0x2b')]);var _0x4d7a39={'method':_0xded5('0x42'),'uri':_0xded5('0x43'),'body':_0x126239,'headers':{'Authorization':util[_0xded5('0x40')]('Basic\x20%s',new Buffer(_0x209fc9)['toString'](_0xded5('0x44')))},'json':!![]};rp(_0x4d7a39)[_0xded5('0x1a')](function(_0x4f4575){if(_0x4f4575['http_code']>=0xc8&&_0x4f4575[_0xded5('0x45')]<=0xce){if(_0x4f4575['data']&&_0x4f4575[_0xded5('0x46')][_0xded5('0x47')]>0x0){var _0x57d1df=_[_0xded5('0x48')](_0x4f4575['data'][_0xded5('0x49')]);var _0x23fd93={'messageId':_0x57d1df[_0xded5('0x4a')]};if(!_0x3b1a27['deliveryReport']){_0x23fd93[_0xded5('0x3b')]=!![];}return _0x318ded[_0xded5('0x13')](_0x23fd93);}else{logger[_0xded5('0x15')](_0xded5('0x26'),'afterCreate','clickSend',util[_0xded5('0x28')](_0x4f4575,{'showHidden':![],'depth':null}));}}else{logger[_0xded5('0x15')](_0xded5('0x26'),_0xded5('0x27'),_0xded5('0x4b'),util[_0xded5('0x28')](_0x4f4575,{'showHidden':![],'depth':null}));}})['catch'](function(_0x1888ee){logger[_0xded5('0x15')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xded5('0x27'),_0xded5('0x4b'),util[_0xded5('0x28')](_0x1888ee,{'showHidden':![],'depth':null}));});}else{logger[_0xded5('0x15')](_0xded5('0x26'),_0xded5('0x27'),_0xded5('0x4b'),_0xded5('0x36'));}break;case _0xded5('0x4c'):if(_0x3b1a27[_0xded5('0x4d')]&&_0x3b1a27[_0xded5('0x38')]){var _0x126239={'dst':_0x23ee1b[_0xded5('0x1e')],'text':_0x23ee1b[_0xded5('0xa')],'src':_0x3b1a27[_0xded5('0x3f')]||_0x3b1a27['phone'],'url':_0x3b1a27[_0xded5('0x20')]+_0xded5('0x21')+_0x23ee1b['id']+_0xded5('0x22')+_0x3b1a27['token']};var _0x209fc9=util[_0xded5('0x40')](_0xded5('0x41'),_0x3b1a27['authId'],_0x3b1a27[_0xded5('0x38')]);var _0x4d7a39={'method':_0xded5('0x42'),'uri':util[_0xded5('0x40')](_0xded5('0x4e'),_0x3b1a27[_0xded5('0x4d')]),'body':_0x126239,'headers':{'Authorization':util[_0xded5('0x40')]('Basic\x20%s',new Buffer(_0x209fc9)[_0xded5('0x4f')](_0xded5('0x44')))},'json':!![]};rp(_0x4d7a39)['then'](function(_0x103a45){var _0x5a4047={'messageId':_0x103a45[_0xded5('0x50')][0x0]};return _0x318ded[_0xded5('0x13')](_0x5a4047);})['catch'](function(_0x42ac32){logger[_0xded5('0x15')](_0xded5('0x26'),'afterCreate',_0xded5('0x4c'),util['inspect'](_0x42ac32,{'showHidden':![],'depth':null}));});}else{logger[_0xded5('0x15')](_0xded5('0x26'),_0xded5('0x27'),_0xded5('0x4c'),_0xded5('0x51'));}break;case'infobip':if(_0x3b1a27['username']&&_0x3b1a27[_0xded5('0x2b')]){if(_0x3b1a27[_0xded5('0x52')]){var _0x19f4a5={'method':'POST','uri':_0x3b1a27[_0xded5('0x52')]+'/auth/1/session','body':{'username':_0x3b1a27[_0xded5('0x3d')],'password':_0x3b1a27['password']},'json':!![]};return rp(_0x19f4a5)[_0xded5('0x1a')](function(_0xddc201){var _0x101bae={'method':_0xded5('0x42'),'uri':_0x3b1a27[_0xded5('0x52')]+'/sms/2/text/advanced','body':{'messages':[{'from':_0x3b1a27[_0xded5('0x1e')],'destinations':[{'to':_0x23ee1b['phone']}],'text':_0x23ee1b['body'],'notifyUrl':_0x3b1a27['remote']+_0xded5('0x21')+_0x23ee1b['id']+_0xded5('0x22')+_0x3b1a27['token'],'notifyContentType':_0xded5('0x53'),'callbackData':_0x3b1a27[_0xded5('0x1e')]+';'+_0x23ee1b['body']}]},'headers':{'Authorization':_0xded5('0x54')+_0xddc201[_0xded5('0x23')]},'json':!![]};return rp(_0x101bae)[_0xded5('0x1a')](function(_0x2eabde){if(_0x2eabde[_0xded5('0x49')]){var _0x5a9f7c={'messageId':_0x2eabde[_0xded5('0x49')][0x0][_0xded5('0x8')]};if(!_0x3b1a27[_0xded5('0x34')]){_0x5a9f7c[_0xded5('0x3b')]=!![];}return _0x318ded[_0xded5('0x13')](_0x5a9f7c);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xded5('0x27'),'infobip',util[_0xded5('0x28')](_0x2eabde,{'showHidden':![],'depth':null}));}});})[_0xded5('0x25')](function(_0x283080){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xded5('0x27'),_0xded5('0x55'),util[_0xded5('0x28')](_0x283080,{'showHidden':![],'depth':null}));});}else{logger[_0xded5('0x15')](_0xded5('0x26'),_0xded5('0x27'),_0xded5('0x55'),_0xded5('0x56'));}}else{logger[_0xded5('0x15')](_0xded5('0x26'),_0xded5('0x27'),_0xded5('0x55'),_0xded5('0x36'));}break;case _0xded5('0x57'):var _0xf9bb8c=require('crypto');if(_0x3b1a27[_0xded5('0x58')]){var _0x5c7604={};_0x5c7604['login']=_0x3b1a27[_0xded5('0x3d')];_0x5c7604[_0xded5('0x1e')]=_0x23ee1b[_0xded5('0x1e')];_0x5c7604['sender']=_0x3b1a27[_0xded5('0x1e')];_0x5c7604[_0xded5('0x59')]=_0x23ee1b[_0xded5('0xa')];_0x5c7604[_0xded5('0x5a')]=+new Date();var _0x588335='';var _0x2eeced='';var _0x544f52=Object[_0xded5('0x5b')](_0x5c7604);_0x544f52[_0xded5('0x5c')]();for(var _0x37fb88=0x0;_0x37fb88<_0x544f52[_0xded5('0x5d')];_0x37fb88++){if(_0x588335!=''){_0x588335+='&';}_0x588335+=_0x544f52[_0x37fb88]+'='+encodeURIComponent(_0x5c7604[_0x544f52[_0x37fb88]]);_0x2eeced+=_0x5c7604[_0x544f52[_0x37fb88]];}_0x2eeced+=_0x3b1a27[_0xded5('0x58')];_0x2eeced=_0xf9bb8c['createHash'](_0xded5('0x5e'))[_0xded5('0x13')](_0x2eeced)[_0xded5('0x5f')]('hex');if(_0x588335!==''){_0x588335+='&';}_0x588335+=_0xded5('0x60')+_0x2eeced;var _0x3c4c44={'method':'GET','uri':_0x3b1a27['baseUrl']+_0xded5('0x61')+_0x588335,'json':!![]};return rp(_0x3c4c44)[_0xded5('0x1a')](function(_0xa6f526){var _0x3e3bab=Object[_0xded5('0x5b')](_0xa6f526);if(_0xa6f526[_0x3e3bab[0x0]][_0xded5('0x15')]&&parseInt(_0xa6f526[_0x3e3bab[0x0]][_0xded5('0x15')])===0x0){var _0x1ccd14={'messageId':_0xa6f526[_0x3e3bab[0x0]][_0xded5('0x62')]};if(!_0x3b1a27['deliveryReport']){_0x1ccd14[_0xded5('0x3b')]=!![];}return _0x318ded['update'](_0x1ccd14);}else{return logger[_0xded5('0x15')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xded5('0x27'),_0xded5('0x57'),util[_0xded5('0x28')](_0xa6f526['error'],{'showHidden':![],'depth':null}));}})[_0xded5('0x25')](function(_0x2892f8){return logger[_0xded5('0x15')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xded5('0x27'),'csc',util[_0xded5('0x28')](_0x2892f8,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xded5('0x27'),'csc',_0xded5('0x63'));}break;case _0xded5('0x64'):if(_0x3b1a27[_0xded5('0x58')]){var _0x5deac6={'method':_0xded5('0x42'),'uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x3b1a27[_0xded5('0x58')]},'body':{'content':_0x23ee1b['body'],'to':[_0x23ee1b[_0xded5('0x1e')]],'from':_0x3b1a27[_0xded5('0x1e')],'binary':![],'clientMessageId':_0xded5('0x65'),'charset':_0xded5('0x66')},'json':!![]};rp(_0x5deac6)[_0xded5('0x1a')](function(_0x2aac63){if(!_0x2aac63['error']){var _0x500206={'messageId':_0x2aac63['messages'][0x0][_0xded5('0x67')]};if(!_0x3b1a27[_0xded5('0x34')]){_0x500206[_0xded5('0x3b')]=!![];}return _0x318ded['update'](_0x500206);}else{return logger[_0xded5('0x15')](_0xded5('0x26'),_0xded5('0x27'),_0xded5('0x64'),util[_0xded5('0x28')](_0x2aac63[_0xded5('0x15')],{'showHidden':![],'depth':null}));}})[_0xded5('0x25')](function(_0xa75db5){return logger[_0xded5('0x15')](_0xded5('0x26'),'afterCreate','clickatell',util[_0xded5('0x28')](_0xa75db5,{'showHidden':![],'depth':null}));});}else{logger[_0xded5('0x15')](_0xded5('0x26'),_0xded5('0x27'),_0xded5('0x64'),_0xded5('0x63'));}break;case _0xded5('0x68'):if(_0x3b1a27[_0xded5('0x3d')]&&_0x3b1a27[_0xded5('0x2b')]){var _0x209fc9=util[_0xded5('0x40')](_0xded5('0x41'),_0x3b1a27[_0xded5('0x3d')],_0x3b1a27['password']);var _0x4d7a39={'method':_0xded5('0x42'),'uri':_0xded5('0x69')+_0x3b1a27['accountId']+_0xded5('0x6a'),'body':{'to':[_0x23ee1b[_0xded5('0x1e')]],'text':_0x23ee1b[_0xded5('0xa')],'from':_0x3b1a27[_0xded5('0x1e')],'applicationId':_0x3b1a27[_0xded5('0x6b')]},'headers':{'Authorization':util['format'](_0xded5('0x6c'),new Buffer(_0x209fc9)[_0xded5('0x4f')](_0xded5('0x44')))},'json':!![]};rp(_0x4d7a39)[_0xded5('0x1a')](function(_0x49b4d5){if(_0x49b4d5['id']){var _0x456ae0={'messageId':_0x49b4d5['id']};return _0x318ded['update'](_0x456ae0);}else{logger[_0xded5('0x15')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xded5('0x27'),_0xded5('0x68'),util[_0xded5('0x28')](_0x49b4d5,{'showHidden':![],'depth':null}));}})[_0xded5('0x25')](function(_0x5f4e81){logger[_0xded5('0x15')](_0xded5('0x26'),_0xded5('0x27'),'bandwidth',util['inspect'](_0x5f4e81,{'showHidden':![],'depth':null}));});}else{logger[_0xded5('0x15')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xded5('0x27'),_0xded5('0x68'),_0xded5('0x36'));}break;case'intelepeer':if(_0x3b1a27[_0xded5('0x58')]){var _0x66d0c0={};var _0x3c4c44={'method':_0xded5('0x42'),'uri':_0xded5('0x6d'),'headers':{'Authorization':_0xded5('0x6e')+_0x3b1a27['apiKey'],'Content-Type':_0xded5('0x53')},'body':{'from':_0x3b1a27[_0xded5('0x1e')],'to':_0x23ee1b['phone'],'text':_0x23ee1b[_0xded5('0xa')]},'json':!![]};return rp(_0x3c4c44)['then'](function(_0x4750f4){if(_0x4750f4[_0xded5('0x6f')]==0xca){_0x66d0c0[_0xded5('0x70')]=_0x4750f4;var _0x52d2c5={'method':_0xded5('0x42'),'uri':_0xded5('0x71'),'headers':{'Authorization':_0xded5('0x6e')+_0x3b1a27['apiKey'],'Content-Type':_0xded5('0x53')},'body':{'refid':_0x66d0c0[_0xded5('0x70')][_0xded5('0x72')]},'json':!![]};return rp(_0x52d2c5)[_0xded5('0x1a')](function(_0x3b6424){_0x66d0c0[_0xded5('0x73')]=_0x3b6424;var _0x421d33={'messageId':_0x66d0c0[_0xded5('0x70')][_0xded5('0x72')],'read':!![]};return _0x318ded[_0xded5('0x13')](_0x421d33);});}else{return logger[_0xded5('0x15')](_0xded5('0x26'),_0xded5('0x27'),'intelepeer',util[_0xded5('0x28')](_0x4750f4,{'showHidden':![],'depth':null}));}})[_0xded5('0x25')](function(_0x479799){return logger['error'](_0xded5('0x26'),'afterCreate',_0xded5('0x74'),util[_0xded5('0x28')](_0x479799,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0xded5('0x26'),_0xded5('0x27'),'intelepeer',_0xded5('0x75'));}break;}}})['finally'](function(){_0x46a992();});}else{_0x46a992();}}},'charset':_0xded5('0x76'),'collate':_0xded5('0x77')});}; \ No newline at end of file +var _0xce62=['bandwidth','%s:%s','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','intelepeer','Bearer\x20','code','https://api.intelepeer.com/_rest/v4/app/sms/mdr','message','refid','status','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','path','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','SmsInteractionId','SmsInteraction','findOne','then','update','createdAt','SmsAccount','SmsAccountId','type','twilio','accountSid','authToken','phone','messages','create','remote','/status?token=','token','sid','catch','error','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','skebby','https://api.skebby.it/API/v1.0/REST/','username','sender','login?username=','&password=','GET','sms','user_key','session_key','total_sent','internal_order_id','smsMethod','deliveryReport','read','Missing\x20parameters:\x20username,\x20password','connectel','https://smsapi.connectel.se/api/v2/send/','requestid','clicksend','password','xCALLY\x20Motion','format','POST','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','message_id','clickSend','authId','senderString','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/sms/2/text/advanced','/api/sms/messages/','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','text','keys','sort','length','apiKey','createHash','md5','digest','hex','signature=','/external/get/send.php?','id_sms','csc','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xce62,0x188));var _0x2ce6=function(_0x10dee7,_0x1fe502){_0x10dee7=_0x10dee7-0x0;var _0x147729=_0xce62[_0x10dee7];return _0x147729;};'use strict';var _=require(_0x2ce6('0x0'));var util=require(_0x2ce6('0x1'));var logger=require(_0x2ce6('0x2'))(_0x2ce6('0x3'));var moment=require(_0x2ce6('0x4'));var BPromise=require(_0x2ce6('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2ce6('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./smsMessage.attributes');module['exports']=function(_0x335cb2,_0x125a43){return _0x335cb2[_0x2ce6('0x7')](_0x2ce6('0x8'),attributes,{'tableName':_0x2ce6('0x9'),'paranoid':![],'indexes':[{'name':_0x2ce6('0xa'),'fields':[_0x2ce6('0xa')]},{'name':_0x2ce6('0xb'),'fields':[_0x2ce6('0xc')],'type':_0x2ce6('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3d78d2,_0x3a6805,_0x5e80a6){var _0x4f1047=_0x335cb2[_0x2ce6('0xe')];var _0x162fef=_0x3d78d2[_0x2ce6('0xf')]({'plain':!![]});if(_0x162fef[_0x2ce6('0x10')][_0x2ce6('0x11')]()==='in'||_0x162fef[_0x2ce6('0x10')][_0x2ce6('0x11')]()===_0x2ce6('0x12')&&!_0x162fef[_0x2ce6('0x13')]&&!_[_0x2ce6('0x14')](_0x162fef[_0x2ce6('0x15')])&&!_[_0x2ce6('0x14')](_0x162fef[_0x2ce6('0x16')])){_0x4f1047[_0x2ce6('0x17')][_0x2ce6('0x18')]({'where':{'id':_0x162fef[_0x2ce6('0x16')]}})[_0x2ce6('0x19')](function(_0x1dc3fe){if(_0x1dc3fe){_0x1dc3fe[_0x2ce6('0x1a')]({'lastMsgAt':_0x162fef[_0x2ce6('0x1b')],'lastMsgDirection':_0x162fef['direction'][_0x2ce6('0x11')]()});}})['catch'](function(_0x107e22){console['error'](_0x107e22);});}if(_0x162fef[_0x2ce6('0x10')]==='out'&&!_0x162fef[_0x2ce6('0x13')]){var _0x3ef4b5;_0x4f1047[_0x2ce6('0x1c')]['find']({'where':{'id':_0x162fef[_0x2ce6('0x1d')]},'raw':!![]})[_0x2ce6('0x19')](function(_0x4e0008){_0x3ef4b5=_0x4e0008;if(_0x3ef4b5&&_0x3ef4b5[_0x2ce6('0x1e')]){switch(_0x3ef4b5[_0x2ce6('0x1e')]){case _0x2ce6('0x1f'):var _0x1c73df=require('twilio');if(_0x3ef4b5[_0x2ce6('0x20')]&&_0x3ef4b5[_0x2ce6('0x21')]&&_0x3ef4b5[_0x2ce6('0x22')]){var _0x29e3f0=new _0x1c73df(_0x3ef4b5['accountSid'],_0x3ef4b5[_0x2ce6('0x21')]);_0x29e3f0[_0x2ce6('0x23')][_0x2ce6('0x24')]({'body':_0x162fef[_0x2ce6('0xc')],'to':_0x162fef['phone'],'from':_0x3ef4b5[_0x2ce6('0x22')],'statusCallback':_0x3ef4b5[_0x2ce6('0x25')]+'/api/sms/messages/'+_0x162fef['id']+_0x2ce6('0x26')+_0x3ef4b5[_0x2ce6('0x27')]})['then'](function(_0x192623){if(_0x192623[_0x2ce6('0x28')]){return _0x3d78d2[_0x2ce6('0x1a')]({'messageId':_0x192623[_0x2ce6('0x28')]});}})[_0x2ce6('0x29')](function(_0x1cc90d){logger[_0x2ce6('0x2a')](_0x2ce6('0x2b'),_0x2ce6('0x2c'),_0x2ce6('0x1f'),util[_0x2ce6('0x2d')](_0x1cc90d,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x2ce6('0x2b'),_0x2ce6('0x2c'),_0x2ce6('0x1f'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x2ce6('0x2e'):var _0x2114e8=_0x2ce6('0x2f');if(_0x3ef4b5[_0x2ce6('0x30')]&&_0x3ef4b5['password']){var _0x57781b={'recipient':[_0x162fef[_0x2ce6('0x22')]],'message':_0x162fef['body'],'message_type':_0x3ef4b5['smsMethod']};if(_0x3ef4b5['smsMethod']&&_0x3ef4b5['smsMethod']!=='SI'){_0x57781b[_0x2ce6('0x31')]=_0x3ef4b5[_0x2ce6('0x22')];}var _0x2ada7c={'url':_0x2114e8+_0x2ce6('0x32')+_0x3ef4b5[_0x2ce6('0x30')]+_0x2ce6('0x33')+_0x3ef4b5['password'],'method':_0x2ce6('0x34')};rp(_0x2ada7c)[_0x2ce6('0x19')](function(_0x270ea8){var _0x21fef4=_0x270ea8['split'](';');var _0x1b2973={'user_key':_0x21fef4[0x0],'session_key':_0x21fef4[0x1]};_0x2ada7c={'url':_0x2114e8+_0x2ce6('0x35'),'method':'POST','headers':{'user_key':_0x1b2973[_0x2ce6('0x36')],'Session_key':_0x1b2973[_0x2ce6('0x37')]},'json':!![],'body':_0x57781b};return rp(_0x2ada7c);})[_0x2ce6('0x19')](function(_0x1d3653){if(_0x1d3653[_0x2ce6('0x38')]>=0x1){var _0x386d1a={'messageId':_0x1d3653[_0x2ce6('0x39')]};if(_0x3ef4b5[_0x2ce6('0x3a')]!=='GP'||!_0x3ef4b5[_0x2ce6('0x3b')]){_0x386d1a[_0x2ce6('0x3c')]=!![];}return _0x3d78d2[_0x2ce6('0x1a')](_0x386d1a);}else{return logger[_0x2ce6('0x2a')](_0x2ce6('0x2b'),_0x2ce6('0x2c'),_0x2ce6('0x2e'),util[_0x2ce6('0x2d')](_0x1d3653,{'showHidden':![],'depth':null}));}})[_0x2ce6('0x29')](function(_0x47b879){return logger['error'](_0x2ce6('0x2b'),_0x2ce6('0x2c'),'skebby',util[_0x2ce6('0x2d')](_0x47b879,{'showHidden':![],'depth':null}));});}else{logger[_0x2ce6('0x2a')](_0x2ce6('0x2b'),'afterCreate',_0x2ce6('0x2e'),_0x2ce6('0x3d'));}break;case _0x2ce6('0x3e'):if(_0x3ef4b5[_0x2ce6('0x21')]){var _0x383c2b={'recipient':_0x162fef['phone'],'message':_0x162fef[_0x2ce6('0xc')],'sender':_0x3ef4b5['senderString']||_0x3ef4b5[_0x2ce6('0x22')],'authorization':_0x3ef4b5[_0x2ce6('0x21')]};var _0x3a6805={'method':'POST','uri':_0x2ce6('0x3f'),'body':_0x383c2b,'json':!![]};rp(_0x3a6805)['then'](function(_0x5cf143){var _0x1f9048={'messageId':_0x5cf143[_0x2ce6('0x40')]};if(!_0x3ef4b5[_0x2ce6('0x3b')]){_0x1f9048[_0x2ce6('0x3c')]=!![];}return _0x3d78d2[_0x2ce6('0x1a')](_0x1f9048);})[_0x2ce6('0x29')](function(_0x53aa47){logger['error'](_0x2ce6('0x2b'),_0x2ce6('0x2c'),_0x2ce6('0x3e'),util[_0x2ce6('0x2d')](_0x53aa47,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x2ce6('0x2b'),_0x2ce6('0x2c'),_0x2ce6('0x3e'),'Missing\x20parameters:\x20authToken');}break;case _0x2ce6('0x41'):if(_0x3ef4b5[_0x2ce6('0x30')]&&_0x3ef4b5[_0x2ce6('0x42')]){var _0x383c2b={'messages':[{'source':_0x2ce6('0x43'),'to':_0x162fef[_0x2ce6('0x22')],'body':_0x162fef[_0x2ce6('0xc')],'from':_0x3ef4b5['senderString']||_0x3ef4b5[_0x2ce6('0x22')]}]};var _0x5ab75f=util[_0x2ce6('0x44')]('%s:%s',_0x3ef4b5[_0x2ce6('0x30')],_0x3ef4b5[_0x2ce6('0x42')]);var _0x3a6805={'method':_0x2ce6('0x45'),'uri':_0x2ce6('0x46'),'body':_0x383c2b,'headers':{'Authorization':util['format'](_0x2ce6('0x47'),new Buffer(_0x5ab75f)[_0x2ce6('0x48')](_0x2ce6('0x49')))},'json':!![]};rp(_0x3a6805)[_0x2ce6('0x19')](function(_0xf34e6a){if(_0xf34e6a[_0x2ce6('0x4a')]>=0xc8&&_0xf34e6a[_0x2ce6('0x4a')]<=0xce){if(_0xf34e6a[_0x2ce6('0x4b')]&&_0xf34e6a['data']['queued_count']>0x0){var _0x52b099=_['head'](_0xf34e6a['data']['messages']);var _0x3718dc={'messageId':_0x52b099[_0x2ce6('0x4c')]};if(!_0x3ef4b5['deliveryReport']){_0x3718dc[_0x2ce6('0x3c')]=!![];}return _0x3d78d2[_0x2ce6('0x1a')](_0x3718dc);}else{logger['error'](_0x2ce6('0x2b'),_0x2ce6('0x2c'),'clickSend',util[_0x2ce6('0x2d')](_0xf34e6a,{'showHidden':![],'depth':null}));}}else{logger[_0x2ce6('0x2a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2ce6('0x2c'),_0x2ce6('0x4d'),util[_0x2ce6('0x2d')](_0xf34e6a,{'showHidden':![],'depth':null}));}})['catch'](function(_0x4d8bd2){logger[_0x2ce6('0x2a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2ce6('0x2c'),_0x2ce6('0x4d'),util[_0x2ce6('0x2d')](_0x4d8bd2,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x2ce6('0x2b'),_0x2ce6('0x2c'),_0x2ce6('0x4d'),_0x2ce6('0x3d'));}break;case'plivo':if(_0x3ef4b5[_0x2ce6('0x4e')]&&_0x3ef4b5['authToken']){var _0x383c2b={'dst':_0x162fef['phone'],'text':_0x162fef[_0x2ce6('0xc')],'src':_0x3ef4b5[_0x2ce6('0x4f')]||_0x3ef4b5['phone'],'url':_0x3ef4b5[_0x2ce6('0x25')]+'/api/sms/messages/'+_0x162fef['id']+_0x2ce6('0x26')+_0x3ef4b5['token']};var _0x5ab75f=util[_0x2ce6('0x44')]('%s:%s',_0x3ef4b5[_0x2ce6('0x4e')],_0x3ef4b5['authToken']);var _0x3a6805={'method':_0x2ce6('0x45'),'uri':util['format']('https://api.plivo.com/v1/Account/%s/Message/',_0x3ef4b5[_0x2ce6('0x4e')]),'body':_0x383c2b,'headers':{'Authorization':util[_0x2ce6('0x44')]('Basic\x20%s',new Buffer(_0x5ab75f)[_0x2ce6('0x48')]('base64'))},'json':!![]};rp(_0x3a6805)[_0x2ce6('0x19')](function(_0x399781){var _0x49a291={'messageId':_0x399781[_0x2ce6('0x50')][0x0]};return _0x3d78d2[_0x2ce6('0x1a')](_0x49a291);})['catch'](function(_0x5f219c){logger[_0x2ce6('0x2a')](_0x2ce6('0x2b'),_0x2ce6('0x2c'),'plivo',util[_0x2ce6('0x2d')](_0x5f219c,{'showHidden':![],'depth':null}));});}else{logger[_0x2ce6('0x2a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2ce6('0x2c'),'plivo',_0x2ce6('0x51'));}break;case _0x2ce6('0x52'):if(_0x3ef4b5['username']&&_0x3ef4b5[_0x2ce6('0x42')]){if(_0x3ef4b5[_0x2ce6('0x53')]){var _0x4f42e8={'method':_0x2ce6('0x45'),'uri':_0x3ef4b5[_0x2ce6('0x53')]+'/auth/1/session','body':{'username':_0x3ef4b5[_0x2ce6('0x30')],'password':_0x3ef4b5[_0x2ce6('0x42')]},'json':!![]};return rp(_0x4f42e8)[_0x2ce6('0x19')](function(_0x568bae){var _0x431c99={'method':_0x2ce6('0x45'),'uri':_0x3ef4b5['baseUrl']+_0x2ce6('0x54'),'body':{'messages':[{'from':_0x3ef4b5[_0x2ce6('0x22')],'destinations':[{'to':_0x162fef['phone']}],'text':_0x162fef[_0x2ce6('0xc')],'notifyUrl':_0x3ef4b5[_0x2ce6('0x25')]+_0x2ce6('0x55')+_0x162fef['id']+_0x2ce6('0x26')+_0x3ef4b5[_0x2ce6('0x27')],'notifyContentType':_0x2ce6('0x56'),'callbackData':_0x3ef4b5[_0x2ce6('0x22')]+';'+_0x162fef[_0x2ce6('0xc')]}]},'headers':{'Authorization':_0x2ce6('0x57')+_0x568bae[_0x2ce6('0x27')]},'json':!![]};return rp(_0x431c99)['then'](function(_0x29090d){if(_0x29090d[_0x2ce6('0x23')]){var _0x249a23={'messageId':_0x29090d[_0x2ce6('0x23')][0x0][_0x2ce6('0xa')]};if(!_0x3ef4b5[_0x2ce6('0x3b')]){_0x249a23['read']=!![];}return _0x3d78d2[_0x2ce6('0x1a')](_0x249a23);}else{return logger[_0x2ce6('0x2a')](_0x2ce6('0x2b'),_0x2ce6('0x2c'),_0x2ce6('0x52'),util[_0x2ce6('0x2d')](_0x29090d,{'showHidden':![],'depth':null}));}});})[_0x2ce6('0x29')](function(_0xb015fc){return logger[_0x2ce6('0x2a')](_0x2ce6('0x2b'),'afterCreate','infobip',util['inspect'](_0xb015fc,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2ce6('0x2c'),_0x2ce6('0x52'),_0x2ce6('0x58'));}}else{logger['error'](_0x2ce6('0x2b'),_0x2ce6('0x2c'),_0x2ce6('0x52'),_0x2ce6('0x3d'));}break;case'csc':var _0x1838d6=require('crypto');if(_0x3ef4b5['apiKey']){var _0xfeb20a={};_0xfeb20a['login']=_0x3ef4b5[_0x2ce6('0x30')];_0xfeb20a[_0x2ce6('0x22')]=_0x162fef[_0x2ce6('0x22')];_0xfeb20a['sender']=_0x3ef4b5[_0x2ce6('0x22')];_0xfeb20a[_0x2ce6('0x59')]=_0x162fef[_0x2ce6('0xc')];_0xfeb20a['timestamp']=+new Date();var _0x38296d='';var _0x3af08a='';var _0x281057=Object[_0x2ce6('0x5a')](_0xfeb20a);_0x281057[_0x2ce6('0x5b')]();for(var _0x12db10=0x0;_0x12db10<_0x281057[_0x2ce6('0x5c')];_0x12db10++){if(_0x38296d!=''){_0x38296d+='&';}_0x38296d+=_0x281057[_0x12db10]+'='+encodeURIComponent(_0xfeb20a[_0x281057[_0x12db10]]);_0x3af08a+=_0xfeb20a[_0x281057[_0x12db10]];}_0x3af08a+=_0x3ef4b5[_0x2ce6('0x5d')];_0x3af08a=_0x1838d6[_0x2ce6('0x5e')](_0x2ce6('0x5f'))['update'](_0x3af08a)[_0x2ce6('0x60')](_0x2ce6('0x61'));if(_0x38296d!==''){_0x38296d+='&';}_0x38296d+=_0x2ce6('0x62')+_0x3af08a;var _0x2ada7c={'method':'GET','uri':_0x3ef4b5['baseUrl']+_0x2ce6('0x63')+_0x38296d,'json':!![]};return rp(_0x2ada7c)[_0x2ce6('0x19')](function(_0x48ec0a){var _0x5c0d03=Object[_0x2ce6('0x5a')](_0x48ec0a);if(_0x48ec0a[_0x5c0d03[0x0]][_0x2ce6('0x2a')]&&parseInt(_0x48ec0a[_0x5c0d03[0x0]]['error'])===0x0){var _0x591965={'messageId':_0x48ec0a[_0x5c0d03[0x0]][_0x2ce6('0x64')]};if(!_0x3ef4b5[_0x2ce6('0x3b')]){_0x591965[_0x2ce6('0x3c')]=!![];}return _0x3d78d2[_0x2ce6('0x1a')](_0x591965);}else{return logger[_0x2ce6('0x2a')](_0x2ce6('0x2b'),_0x2ce6('0x2c'),_0x2ce6('0x65'),util[_0x2ce6('0x2d')](_0x48ec0a[_0x2ce6('0x2a')],{'showHidden':![],'depth':null}));}})[_0x2ce6('0x29')](function(_0x2dc641){return logger[_0x2ce6('0x2a')](_0x2ce6('0x2b'),'afterCreate',_0x2ce6('0x65'),util['inspect'](_0x2dc641,{'showHidden':![],'depth':null}));});}else{logger[_0x2ce6('0x2a')](_0x2ce6('0x2b'),_0x2ce6('0x2c'),_0x2ce6('0x65'),_0x2ce6('0x66'));}break;case _0x2ce6('0x67'):if(_0x3ef4b5[_0x2ce6('0x5d')]){var _0x126a8d={'method':_0x2ce6('0x45'),'uri':_0x2ce6('0x68'),'headers':{'Authorization':_0x3ef4b5[_0x2ce6('0x5d')]},'body':{'content':_0x162fef[_0x2ce6('0xc')],'to':[_0x162fef[_0x2ce6('0x22')]],'from':_0x3ef4b5[_0x2ce6('0x22')],'binary':![],'clientMessageId':_0x2ce6('0x69'),'charset':_0x2ce6('0x6a')},'json':!![]};rp(_0x126a8d)['then'](function(_0x25d030){if(!_0x25d030[_0x2ce6('0x2a')]){var _0x2da860={'messageId':_0x25d030['messages'][0x0][_0x2ce6('0x6b')]};if(!_0x3ef4b5[_0x2ce6('0x3b')]){_0x2da860[_0x2ce6('0x3c')]=!![];}return _0x3d78d2['update'](_0x2da860);}else{return logger[_0x2ce6('0x2a')](_0x2ce6('0x2b'),_0x2ce6('0x2c'),_0x2ce6('0x67'),util[_0x2ce6('0x2d')](_0x25d030[_0x2ce6('0x2a')],{'showHidden':![],'depth':null}));}})[_0x2ce6('0x29')](function(_0x58f842){return logger['error'](_0x2ce6('0x2b'),_0x2ce6('0x2c'),'clickatell',util[_0x2ce6('0x2d')](_0x58f842,{'showHidden':![],'depth':null}));});}else{logger[_0x2ce6('0x2a')](_0x2ce6('0x2b'),_0x2ce6('0x2c'),_0x2ce6('0x67'),_0x2ce6('0x66'));}break;case _0x2ce6('0x6c'):if(_0x3ef4b5[_0x2ce6('0x30')]&&_0x3ef4b5[_0x2ce6('0x42')]){var _0x5ab75f=util[_0x2ce6('0x44')](_0x2ce6('0x6d'),_0x3ef4b5[_0x2ce6('0x30')],_0x3ef4b5[_0x2ce6('0x42')]);var _0x3a6805={'method':_0x2ce6('0x45'),'uri':_0x2ce6('0x6e')+_0x3ef4b5[_0x2ce6('0x6f')]+_0x2ce6('0x70'),'body':{'to':[_0x162fef['phone']],'text':_0x162fef[_0x2ce6('0xc')],'from':_0x3ef4b5['phone'],'applicationId':_0x3ef4b5[_0x2ce6('0x71')]},'headers':{'Authorization':util[_0x2ce6('0x44')](_0x2ce6('0x47'),new Buffer(_0x5ab75f)[_0x2ce6('0x48')]('base64'))},'json':!![]};rp(_0x3a6805)[_0x2ce6('0x19')](function(_0x96eba4){if(_0x96eba4['id']){var _0x74e8ed={'messageId':_0x96eba4['id']};return _0x3d78d2[_0x2ce6('0x1a')](_0x74e8ed);}else{logger['error'](_0x2ce6('0x2b'),_0x2ce6('0x2c'),_0x2ce6('0x6c'),util['inspect'](_0x96eba4,{'showHidden':![],'depth':null}));}})[_0x2ce6('0x29')](function(_0x17e3d7){logger[_0x2ce6('0x2a')](_0x2ce6('0x2b'),_0x2ce6('0x2c'),'bandwidth',util[_0x2ce6('0x2d')](_0x17e3d7,{'showHidden':![],'depth':null}));});}else{logger[_0x2ce6('0x2a')](_0x2ce6('0x2b'),_0x2ce6('0x2c'),_0x2ce6('0x6c'),_0x2ce6('0x3d'));}break;case _0x2ce6('0x72'):if(_0x3ef4b5[_0x2ce6('0x5d')]){var _0x1f0463={};var _0x2ada7c={'method':'POST','uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':_0x2ce6('0x73')+_0x3ef4b5[_0x2ce6('0x5d')],'Content-Type':_0x2ce6('0x56')},'body':{'from':_0x3ef4b5['phone'],'to':_0x162fef[_0x2ce6('0x22')],'text':_0x162fef[_0x2ce6('0xc')]},'json':!![]};return rp(_0x2ada7c)[_0x2ce6('0x19')](function(_0x2b850f){if(_0x2b850f[_0x2ce6('0x74')]==0xca){_0x1f0463['message']=_0x2b850f;var _0x48dab7={'method':_0x2ce6('0x45'),'uri':_0x2ce6('0x75'),'headers':{'Authorization':_0x2ce6('0x73')+_0x3ef4b5['apiKey'],'Content-Type':_0x2ce6('0x56')},'body':{'refid':_0x1f0463[_0x2ce6('0x76')][_0x2ce6('0x77')]},'json':!![]};return rp(_0x48dab7)[_0x2ce6('0x19')](function(_0x5d3438){_0x1f0463[_0x2ce6('0x78')]=_0x5d3438;var _0x69bbe6={'messageId':_0x1f0463['message']['refid'],'read':!![]};return _0x3d78d2[_0x2ce6('0x1a')](_0x69bbe6);});}else{return logger[_0x2ce6('0x2a')](_0x2ce6('0x2b'),_0x2ce6('0x2c'),_0x2ce6('0x72'),util[_0x2ce6('0x2d')](_0x2b850f,{'showHidden':![],'depth':null}));}})[_0x2ce6('0x29')](function(_0x428fa4){return logger[_0x2ce6('0x2a')](_0x2ce6('0x2b'),_0x2ce6('0x2c'),_0x2ce6('0x72'),util[_0x2ce6('0x2d')](_0x428fa4,{'showHidden':![],'depth':null}));});}else{return logger[_0x2ce6('0x2a')](_0x2ce6('0x2b'),_0x2ce6('0x2c'),_0x2ce6('0x72'),_0x2ce6('0x79'));}break;}}})[_0x2ce6('0x7a')](function(){_0x5e80a6();});}else{_0x5e80a6();}}},'charset':_0x2ce6('0x7b'),'collate':_0x2ce6('0x7c')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 5f67f27..bdc1771 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 _0xce0a=['client','http','defaults','redis','localhost','socket.io-emitter','register','then','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','SmsMessage,\x20%s,\x20%s','message','info','result','SmsMessage','create','body','options','raw','CreateSmsMessage','debug','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x270bef,_0x523245){var _0x45100e=function(_0x45c0e8){while(--_0x45c0e8){_0x270bef['push'](_0x270bef['shift']());}};_0x45100e(++_0x523245);}(_0xce0a,0x1c5));var _0xace0=function(_0x3f8647,_0x39c233){_0x3f8647=_0x3f8647-0x0;var _0x39d095=_0xce0a[_0x3f8647];return _0x39d095;};'use strict';var _=require('lodash');var util=require(_0xace0('0x0'));var moment=require(_0xace0('0x1'));var BPromise=require(_0xace0('0x2'));var rs=require(_0xace0('0x3'));var fs=require('fs');var Redis=require(_0xace0('0x4'));var db=require(_0xace0('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xace0('0x6'))(_0xace0('0x7'));var config=require(_0xace0('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xace0('0x9')][_0xace0('0xa')]({'port':0x232a});config['redis']=_[_0xace0('0xb')](config[_0xace0('0xc')],{'host':_0xace0('0xd'),'port':0x18eb});var socket=require(_0xace0('0xe'))(new Redis(config[_0xace0('0xc')]));require('./smsMessage.socket')[_0xace0('0xf')](socket);function respondWithRpcPromise(_0x3b3a86,_0x2444dd,_0x4d9e6a){return new BPromise(function(_0x18c785,_0x386a97){return client['request'](_0x3b3a86,_0x4d9e6a)[_0xace0('0x10')](function(_0x5bfc6e){logger['info']('SmsMessage,\x20%s,\x20%s',_0x2444dd,'request\x20sent');logger['debug'](_0xace0('0x11'),_0x2444dd,_0xace0('0x12'),JSON[_0xace0('0x13')](_0x5bfc6e));if(_0x5bfc6e[_0xace0('0x14')]){if(_0x5bfc6e[_0xace0('0x14')]['code']===0x1f4){logger[_0xace0('0x14')](_0xace0('0x15'),_0x2444dd,_0x5bfc6e[_0xace0('0x14')][_0xace0('0x16')]);return _0x386a97(_0x5bfc6e[_0xace0('0x14')]['message']);}logger[_0xace0('0x14')](_0xace0('0x15'),_0x2444dd,_0x5bfc6e[_0xace0('0x14')][_0xace0('0x16')]);return _0x18c785(_0x5bfc6e['error'][_0xace0('0x16')]);}else{logger[_0xace0('0x17')](_0xace0('0x15'),_0x2444dd,'request\x20sent');_0x18c785(_0x5bfc6e[_0xace0('0x18')]['message']);}})['catch'](function(_0x42007e){logger[_0xace0('0x14')](_0xace0('0x15'),_0x2444dd,_0x42007e);_0x386a97(_0x42007e);});});}exports['CreateSmsMessage']=function(_0x185652){var _0x4da23c=this;return new Promise(function(_0xf719a5,_0x57253c){return db[_0xace0('0x19')][_0xace0('0x1a')](_0x185652[_0xace0('0x1b')],{'raw':_0x185652[_0xace0('0x1c')]?_0x185652[_0xace0('0x1c')][_0xace0('0x1d')]===undefined?!![]:![]:!![]})[_0xace0('0x10')](function(_0x3456d1){logger[_0xace0('0x17')](_0xace0('0x1e'),_0x185652);logger[_0xace0('0x1f')](_0xace0('0x1e'),_0x185652,JSON[_0xace0('0x13')](_0x3456d1));_0xf719a5(_0x3456d1);})[_0xace0('0x20')](function(_0x313c1f){logger[_0xace0('0x14')](_0xace0('0x1e'),_0x313c1f[_0xace0('0x16')],_0x185652);_0x57253c(_0x4da23c[_0xace0('0x14')](0x1f4,_0x313c1f[_0xace0('0x16')]));});});}; \ No newline at end of file +var _0xc3f0=['socket.io-emitter','./smsMessage.socket','register','request','SmsMessage,\x20%s,\x20%s','debug','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','CreateSmsMessage','SmsMessage','create','options','raw','info','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','localhost'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc3f0,0x173));var _0x0c3f=function(_0x4d8ab2,_0x4df37d){_0x4d8ab2=_0x4d8ab2-0x0;var _0x7397d3=_0xc3f0[_0x4d8ab2];return _0x7397d3;};'use strict';var _=require('lodash');var util=require(_0x0c3f('0x0'));var moment=require(_0x0c3f('0x1'));var BPromise=require('bluebird');var rs=require(_0x0c3f('0x2'));var fs=require('fs');var Redis=require(_0x0c3f('0x3'));var db=require(_0x0c3f('0x4'))['db'];var utils=require(_0x0c3f('0x5'));var logger=require('../../config/logger')(_0x0c3f('0x6'));var config=require('../../config/environment');var jayson=require(_0x0c3f('0x7'));var client=jayson[_0x0c3f('0x8')][_0x0c3f('0x9')]({'port':0x232a});config[_0x0c3f('0xa')]=_[_0x0c3f('0xb')](config[_0x0c3f('0xa')],{'host':_0x0c3f('0xc'),'port':0x18eb});var socket=require(_0x0c3f('0xd'))(new Redis(config[_0x0c3f('0xa')]));require(_0x0c3f('0xe'))[_0x0c3f('0xf')](socket);function respondWithRpcPromise(_0x4dba38,_0x493e64,_0x5cc08a){return new BPromise(function(_0xf944e8,_0x422f31){return client[_0x0c3f('0x10')](_0x4dba38,_0x5cc08a)['then'](function(_0x880d46){logger['info'](_0x0c3f('0x11'),_0x493e64,'request\x20sent');logger[_0x0c3f('0x12')](_0x0c3f('0x13'),_0x493e64,_0x0c3f('0x14'),JSON[_0x0c3f('0x15')](_0x880d46));if(_0x880d46['error']){if(_0x880d46[_0x0c3f('0x16')]['code']===0x1f4){logger[_0x0c3f('0x16')](_0x0c3f('0x11'),_0x493e64,_0x880d46[_0x0c3f('0x16')]['message']);return _0x422f31(_0x880d46[_0x0c3f('0x16')][_0x0c3f('0x17')]);}logger[_0x0c3f('0x16')]('SmsMessage,\x20%s,\x20%s',_0x493e64,_0x880d46[_0x0c3f('0x16')]['message']);return _0xf944e8(_0x880d46[_0x0c3f('0x16')][_0x0c3f('0x17')]);}else{logger['info'](_0x0c3f('0x11'),_0x493e64,_0x0c3f('0x14'));_0xf944e8(_0x880d46[_0x0c3f('0x18')][_0x0c3f('0x17')]);}})[_0x0c3f('0x19')](function(_0x277532){logger[_0x0c3f('0x16')](_0x0c3f('0x11'),_0x493e64,_0x277532);_0x422f31(_0x277532);});});}exports[_0x0c3f('0x1a')]=function(_0x55bbc9){var _0x5167fd=this;return new Promise(function(_0x178d59,_0x2eb5fb){return db[_0x0c3f('0x1b')][_0x0c3f('0x1c')](_0x55bbc9['body'],{'raw':_0x55bbc9[_0x0c3f('0x1d')]?_0x55bbc9[_0x0c3f('0x1d')][_0x0c3f('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x550501){logger[_0x0c3f('0x1f')](_0x0c3f('0x1a'),_0x55bbc9);logger['debug'](_0x0c3f('0x1a'),_0x55bbc9,JSON[_0x0c3f('0x15')](_0x550501));_0x178d59(_0x550501);})[_0x0c3f('0x19')](function(_0x4324be){logger['error'](_0x0c3f('0x1a'),_0x4324be[_0x0c3f('0x17')],_0x55bbc9);_0x2eb5fb(_0x5167fd[_0x0c3f('0x16')](0x1f4,_0x4324be[_0x0c3f('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index c0fc982..edb2d1f 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 _0xa56f=['emit','removeListener','length','./smsMessage.events','save','remove','update'];(function(_0xd50b7f,_0x53c16c){var _0x380972=function(_0x4865d8){while(--_0x4865d8){_0xd50b7f['push'](_0xd50b7f['shift']());}};_0x380972(++_0x53c16c);}(_0xa56f,0x1bc));var _0xfa56=function(_0x3413ac,_0x483942){_0x3413ac=_0x3413ac-0x0;var _0x323e4e=_0xa56f[_0x3413ac];return _0x323e4e;};'use strict';var SmsMessageEvents=require(_0xfa56('0x0'));var events=[_0xfa56('0x1'),_0xfa56('0x2'),_0xfa56('0x3')];function createListener(_0xfc29f9,_0xda516c){return function(_0x25ecd6){_0xda516c[_0xfa56('0x4')](_0xfc29f9,_0x25ecd6);};}function removeListener(_0x4c238e,_0x2b2979){return function(){SmsMessageEvents[_0xfa56('0x5')](_0x4c238e,_0x2b2979);};}exports['register']=function(_0x4c2e17){for(var _0x253f08=0x0,_0x508108=events[_0xfa56('0x6')];_0x253f08<_0x508108;_0x253f08++){var _0x309518=events[_0x253f08];var _0x3f033a=createListener('smsMessage:'+_0x309518,_0x4c2e17);SmsMessageEvents['on'](_0x309518,_0x3f033a);}}; \ No newline at end of file +var _0xe7bd=['length','./smsMessage.events','save','update','removeListener','register'];(function(_0x58729e,_0xc0e2a5){var _0x43c69e=function(_0x2794cd){while(--_0x2794cd){_0x58729e['push'](_0x58729e['shift']());}};_0x43c69e(++_0xc0e2a5);}(_0xe7bd,0x18d));var _0xde7b=function(_0x48961c,_0x280e9d){_0x48961c=_0x48961c-0x0;var _0x1d895d=_0xe7bd[_0x48961c];return _0x1d895d;};'use strict';var SmsMessageEvents=require(_0xde7b('0x0'));var events=[_0xde7b('0x1'),'remove',_0xde7b('0x2')];function createListener(_0x3e9f7f,_0x4de4cd){return function(_0x4bc412){_0x4de4cd['emit'](_0x3e9f7f,_0x4bc412);};}function removeListener(_0x5f2d60,_0x321c32){return function(){SmsMessageEvents[_0xde7b('0x3')](_0x5f2d60,_0x321c32);};}exports[_0xde7b('0x4')]=function(_0x36b8bf){for(var _0x3a4469=0x0,_0xc7eeb3=events[_0xde7b('0x5')];_0x3a4469<_0xc7eeb3;_0x3a4469++){var _0x306ebd=events[_0x3a4469];var _0x2f688f=createListener('smsMessage:'+_0x306ebd,_0x36b8bf);SmsMessageEvents['on'](_0x306ebd,_0x2f688f);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index c220a1b..f189b14 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 _0xe0f6=['../../components/interaction/service','./smsQueue.controller','isAuthenticated','index','get','describe','/:id','show','/:id/members','getMembers','/:id/teams','getAgents','post','create','addTeams','/:id/users','addAgents','update','delete','removeTeams','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service'];(function(_0x4c67e1,_0xbfa4f){var _0x53ef74=function(_0x3fc9b2){while(--_0x3fc9b2){_0x4c67e1['push'](_0x4c67e1['shift']());}};_0x53ef74(++_0xbfa4f);}(_0xe0f6,0xf6));var _0x6e0f=function(_0xc6ae0a,_0x2e9abf){_0xc6ae0a=_0xc6ae0a-0x0;var _0x3a0c2c=_0xe0f6[_0xc6ae0a];return _0x3a0c2c;};'use strict';var multer=require(_0x6e0f('0x0'));var util=require(_0x6e0f('0x1'));var path=require(_0x6e0f('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e0f('0x3'));var router=express[_0x6e0f('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6e0f('0x5'));var interaction=require(_0x6e0f('0x6'));var config=require('../../config/environment');var controller=require(_0x6e0f('0x7'));router['get']('/',auth[_0x6e0f('0x8')](),controller[_0x6e0f('0x9')]);router[_0x6e0f('0xa')]('/describe',auth[_0x6e0f('0x8')](),controller[_0x6e0f('0xb')]);router[_0x6e0f('0xa')](_0x6e0f('0xc'),auth[_0x6e0f('0x8')](),controller[_0x6e0f('0xd')]);router[_0x6e0f('0xa')](_0x6e0f('0xe'),auth[_0x6e0f('0x8')](),controller[_0x6e0f('0xf')]);router[_0x6e0f('0xa')](_0x6e0f('0x10'),auth[_0x6e0f('0x8')](),controller['getTeams']);router[_0x6e0f('0xa')]('/:id/users',auth[_0x6e0f('0x8')](),controller[_0x6e0f('0x11')]);router[_0x6e0f('0x12')]('/',auth[_0x6e0f('0x8')](),controller[_0x6e0f('0x13')]);router[_0x6e0f('0x12')](_0x6e0f('0x10'),auth[_0x6e0f('0x8')](),controller[_0x6e0f('0x14')]);router['post'](_0x6e0f('0x15'),auth[_0x6e0f('0x8')](),controller[_0x6e0f('0x16')]);router['put']('/:id',auth[_0x6e0f('0x8')](),controller[_0x6e0f('0x17')]);router['delete'](_0x6e0f('0xc'),auth['isAuthenticated'](),controller['destroy']);router[_0x6e0f('0x18')](_0x6e0f('0x10'),auth[_0x6e0f('0x8')](),controller[_0x6e0f('0x19')]);router['delete'](_0x6e0f('0x15'),auth[_0x6e0f('0x8')](),controller[_0x6e0f('0x1a')]);module[_0x6e0f('0x1b')]=router; \ No newline at end of file +var _0xadcc=['exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','put','update','delete','removeAgents'];(function(_0x48e6f1,_0x1bd3e8){var _0x154ae1=function(_0x253b58){while(--_0x253b58){_0x48e6f1['push'](_0x48e6f1['shift']());}};_0x154ae1(++_0x1bd3e8);}(_0xadcc,0x1d1));var _0xcadc=function(_0x58596c,_0x5144a6){_0x58596c=_0x58596c-0x0;var _0x4f666f=_0xadcc[_0x58596c];return _0x4f666f;};'use strict';var multer=require(_0xcadc('0x0'));var util=require(_0xcadc('0x1'));var path=require(_0xcadc('0x2'));var timeout=require(_0xcadc('0x3'));var express=require('express');var router=express[_0xcadc('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xcadc('0x5'));var interaction=require(_0xcadc('0x6'));var config=require(_0xcadc('0x7'));var controller=require(_0xcadc('0x8'));router[_0xcadc('0x9')]('/',auth[_0xcadc('0xa')](),controller[_0xcadc('0xb')]);router['get'](_0xcadc('0xc'),auth[_0xcadc('0xa')](),controller['describe']);router['get'](_0xcadc('0xd'),auth[_0xcadc('0xa')](),controller[_0xcadc('0xe')]);router['get'](_0xcadc('0xf'),auth[_0xcadc('0xa')](),controller[_0xcadc('0x10')]);router['get'](_0xcadc('0x11'),auth[_0xcadc('0xa')](),controller[_0xcadc('0x12')]);router[_0xcadc('0x9')](_0xcadc('0x13'),auth['isAuthenticated'](),controller[_0xcadc('0x14')]);router[_0xcadc('0x15')]('/',auth['isAuthenticated'](),controller[_0xcadc('0x16')]);router[_0xcadc('0x15')]('/:id/teams',auth[_0xcadc('0xa')](),controller[_0xcadc('0x17')]);router['post'](_0xcadc('0x13'),auth[_0xcadc('0xa')](),controller['addAgents']);router[_0xcadc('0x18')]('/:id',auth[_0xcadc('0xa')](),controller[_0xcadc('0x19')]);router[_0xcadc('0x1a')](_0xcadc('0xd'),auth[_0xcadc('0xa')](),controller['destroy']);router[_0xcadc('0x1a')](_0xcadc('0x11'),auth[_0xcadc('0xa')](),controller['removeTeams']);router[_0xcadc('0x1a')]('/:id/users',auth[_0xcadc('0xa')](),controller[_0xcadc('0x1b')]);module[_0xcadc('0x1c')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index f0d212e..707697f 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 _0x16a4=['exports','STRING','name','INTEGER','ENUM','rrmemory'];(function(_0x201c83,_0x57759c){var _0x23299a=function(_0x5128ab){while(--_0x5128ab){_0x201c83['push'](_0x201c83['shift']());}};_0x23299a(++_0x57759c);}(_0x16a4,0x10e));var _0x416a=function(_0x17ee31,_0x4bd5dc){_0x17ee31=_0x17ee31-0x0;var _0x52ae83=_0x16a4[_0x17ee31];return _0x52ae83;};'use strict';var Sequelize=require('sequelize');module[_0x416a('0x0')]={'name':{'type':Sequelize[_0x416a('0x1')],'unique':_0x416a('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x416a('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x416a('0x4')](_0x416a('0x5'),'beepall','roundrobin')}}; \ No newline at end of file +var _0x5100=['STRING','name','INTEGER','ENUM','rrmemory','roundrobin','sequelize'];(function(_0x54b326,_0x3969fb){var _0x3ebac3=function(_0x2fc4aa){while(--_0x2fc4aa){_0x54b326['push'](_0x54b326['shift']());}};_0x3ebac3(++_0x3969fb);}(_0x5100,0x1a3));var _0x0510=function(_0x105878,_0x7eb9c6){_0x105878=_0x105878-0x0;var _0x202398=_0x5100[_0x105878];return _0x202398;};'use strict';var Sequelize=require(_0x0510('0x0'));module['exports']={'name':{'type':Sequelize[_0x0510('0x1')],'unique':_0x0510('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x0510('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x0510('0x4')](_0x0510('0x5'),'beepall',_0x0510('0x6'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 908db63..109e4e3 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 _0x6fd1=['smsPause','updatedAt','createdAt','format','%s/%s','SIP','Team','getTeams','length','hasOwnProperty','addTeams','ids','voicePause','interface','flatMap','sequelize','each','findOrCreate','emit','userSmsQueue:save','removeTeams','select','field','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','Agents','clone','ut.UserId\x20=\x20?','QueryTypes','SELECT','every','all','union','compact','value','isEmpty','forEach','userSmsQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./smsQueue.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','then','get','SmsQueues','UserProfileResource','error','stack','name','send','SmsQueue','rawAttributes','fieldName','type','model','map','query','keys','attributes','fields','nolimit','sort','filters','pick','where','VIRTUAL','filter','options','include','findAll','rows','intersection','includeAll','find','catch','create','body','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','UserSmsQueue','order','SmsQueueId','merge','User','agent'];(function(_0xdb5808,_0x58c067){var _0x111072=function(_0x3c3f27){while(--_0x3c3f27){_0xdb5808['push'](_0xdb5808['shift']());}};_0x111072(++_0x58c067);}(_0x6fd1,0x14b));var _0x16fd=function(_0x43c3a3,_0x44dac3){_0x43c3a3=_0x43c3a3-0x0;var _0x3ec1de=_0x6fd1[_0x43c3a3];return _0x3ec1de;};'use strict';var emlformat=require(_0x16fd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x16fd('0x1'));var jsonpatch=require(_0x16fd('0x2'));var rp=require('request-promise');var moment=require(_0x16fd('0x3'));var BPromise=require(_0x16fd('0x4'));var Mustache=require(_0x16fd('0x5'));var util=require('util');var path=require(_0x16fd('0x6'));var sox=require(_0x16fd('0x7'));var csv=require(_0x16fd('0x8'));var ejs=require(_0x16fd('0x9'));var fs=require('fs');var fs_extra=require(_0x16fd('0xa'));var _=require(_0x16fd('0xb'));var squel=require(_0x16fd('0xc'));var crypto=require(_0x16fd('0xd'));var jsforce=require(_0x16fd('0xe'));var deskjs=require(_0x16fd('0xf'));var toCsv=require('to-csv');var querystring=require(_0x16fd('0x10'));var Papa=require(_0x16fd('0x11'));var Redis=require('ioredis');var authService=require(_0x16fd('0x12'));var qs=require(_0x16fd('0x13'));var as=require(_0x16fd('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x16fd('0x15'))(_0x16fd('0x16'));var utils=require(_0x16fd('0x17'));var config=require(_0x16fd('0x18'));var licenseUtil=require(_0x16fd('0x19'));var db=require(_0x16fd('0x1a'))['db'];config['redis']=_[_0x16fd('0x1b')](config[_0x16fd('0x1c')],{'host':_0x16fd('0x1d'),'port':0x18eb});var socket=require(_0x16fd('0x1e'))(new Redis(config['redis']));require(_0x16fd('0x1f'))['register'](socket);function respondWithStatusCode(_0x2648f3,_0x74853){_0x74853=_0x74853||0xcc;return function(_0x15b2ab){if(_0x15b2ab){return _0x2648f3[_0x16fd('0x20')](_0x74853);}return _0x2648f3[_0x16fd('0x21')](_0x74853)[_0x16fd('0x22')]();};}function respondWithResult(_0x5e303b,_0x2a0feb){_0x2a0feb=_0x2a0feb||0xc8;return function(_0x579900){if(_0x579900){return _0x5e303b['status'](_0x2a0feb)[_0x16fd('0x23')](_0x579900);}};}function respondWithFilteredResult(_0x54cab7,_0x59cd1){return function(_0x12c4a8){if(_0x12c4a8){var _0x3dbf2a=typeof _0x59cd1[_0x16fd('0x24')]===_0x16fd('0x25')&&typeof _0x59cd1[_0x16fd('0x26')]===_0x16fd('0x25');var _0x21300f=_0x12c4a8['count'];var _0x3da761=_0x3dbf2a?0x0:_0x59cd1[_0x16fd('0x24')];var _0x14a541=_0x3dbf2a?_0x12c4a8[_0x16fd('0x27')]:_0x59cd1[_0x16fd('0x24')]+_0x59cd1[_0x16fd('0x26')];var _0x28b16e;if(_0x14a541>=_0x21300f){_0x14a541=_0x21300f;_0x28b16e=0xc8;}else{_0x28b16e=0xce;}_0x54cab7[_0x16fd('0x21')](_0x28b16e);return _0x54cab7[_0x16fd('0x28')](_0x16fd('0x29'),_0x3da761+'-'+_0x14a541+'/'+_0x21300f)[_0x16fd('0x23')](_0x12c4a8);}return null;};}function patchUpdates(_0x52f77e){return function(_0x374ef5){try{jsonpatch[_0x16fd('0x2a')](_0x374ef5,_0x52f77e,!![]);}catch(_0x576c82){return BPromise[_0x16fd('0x2b')](_0x576c82);}return _0x374ef5['save']();};}function saveUpdates(_0x2f602d,_0x5e51c3){return function(_0x1a37f0){if(_0x1a37f0){return _0x1a37f0[_0x16fd('0x2c')](_0x2f602d)['then'](function(_0xd30049){return _0xd30049;});}return null;};}function removeEntity(_0x5d7682,_0x5ac90b){return function(_0x1c96a7){if(_0x1c96a7){return _0x1c96a7[_0x16fd('0x2d')]()[_0x16fd('0x2e')](function(){var _0x197188=_0x1c96a7[_0x16fd('0x2f')]({'plain':!![]});var _0x1724e2=_0x16fd('0x30');return db[_0x16fd('0x31')][_0x16fd('0x2d')]({'where':{'type':_0x1724e2,'resourceId':_0x197188['id']}})[_0x16fd('0x2e')](function(){return _0x1c96a7;});})[_0x16fd('0x2e')](function(){_0x5d7682[_0x16fd('0x21')](0xcc)[_0x16fd('0x22')]();});}};}function handleEntityNotFound(_0x60f426,_0x19fee6){return function(_0x2557eb){if(!_0x2557eb){_0x60f426[_0x16fd('0x20')](0x194);}return _0x2557eb;};}function handleError(_0x1854f4,_0x56c459){_0x56c459=_0x56c459||0x1f4;return function(_0x59e806){logger[_0x16fd('0x32')](_0x59e806[_0x16fd('0x33')]);if(_0x59e806[_0x16fd('0x34')]){delete _0x59e806[_0x16fd('0x34')];}_0x1854f4['status'](_0x56c459)[_0x16fd('0x35')](_0x59e806);};}exports['index']=function(_0xb35c4d,_0x5ebd8e){var _0x3abc49={},_0x464a92={},_0x39bb9b={'count':0x0,'rows':[]};var _0x5bfe46=_['map'](db[_0x16fd('0x36')][_0x16fd('0x37')],function(_0x30eda9){return{'name':_0x30eda9[_0x16fd('0x38')],'type':_0x30eda9[_0x16fd('0x39')]['key']};});_0x464a92[_0x16fd('0x3a')]=_[_0x16fd('0x3b')](_0x5bfe46,'name');_0x464a92[_0x16fd('0x3c')]=_[_0x16fd('0x3d')](_0xb35c4d[_0x16fd('0x3c')]);_0x464a92['filters']=_['intersection'](_0x464a92['model'],_0x464a92[_0x16fd('0x3c')]);_0x3abc49[_0x16fd('0x3e')]=_['intersection'](_0x464a92[_0x16fd('0x3a')],qs[_0x16fd('0x3f')](_0xb35c4d[_0x16fd('0x3c')]['fields']));_0x3abc49[_0x16fd('0x3e')]=_0x3abc49['attributes']['length']?_0x3abc49[_0x16fd('0x3e')]:_0x464a92[_0x16fd('0x3a')];if(!_0xb35c4d[_0x16fd('0x3c')]['hasOwnProperty'](_0x16fd('0x40'))){_0x3abc49[_0x16fd('0x26')]=qs[_0x16fd('0x26')](_0xb35c4d[_0x16fd('0x3c')][_0x16fd('0x26')]);_0x3abc49[_0x16fd('0x24')]=qs[_0x16fd('0x24')](_0xb35c4d['query'][_0x16fd('0x24')]);}_0x3abc49['order']=qs[_0x16fd('0x41')](_0xb35c4d[_0x16fd('0x3c')][_0x16fd('0x41')]);_0x3abc49['where']=qs[_0x16fd('0x42')](_[_0x16fd('0x43')](_0xb35c4d[_0x16fd('0x3c')],_0x464a92['filters']),_0x5bfe46);if(_0xb35c4d[_0x16fd('0x3c')]['filter']){_0x3abc49[_0x16fd('0x44')]=_['merge'](_0x3abc49['where'],{'$or':_['map'](_0x5bfe46,function(_0x41c0c0){if(_0x41c0c0[_0x16fd('0x39')]!==_0x16fd('0x45')){var _0x3457e9={};_0x3457e9[_0x41c0c0[_0x16fd('0x34')]]={'$like':'%'+_0xb35c4d[_0x16fd('0x3c')][_0x16fd('0x46')]+'%'};return _0x3457e9;}})});}_0x3abc49=_['merge']({},_0x3abc49,_0xb35c4d[_0x16fd('0x47')]);var _0x12e655={'where':_0x3abc49[_0x16fd('0x44')]};return db[_0x16fd('0x36')][_0x16fd('0x27')](_0x12e655)[_0x16fd('0x2e')](function(_0x455126){_0x39bb9b[_0x16fd('0x27')]=_0x455126;if(_0xb35c4d[_0x16fd('0x3c')]['includeAll']){_0x3abc49[_0x16fd('0x48')]=[{'all':!![]}];}return db['SmsQueue'][_0x16fd('0x49')](_0x3abc49);})[_0x16fd('0x2e')](function(_0x37ec8c){_0x39bb9b[_0x16fd('0x4a')]=_0x37ec8c;return _0x39bb9b;})['then'](respondWithFilteredResult(_0x5ebd8e,_0x3abc49))['catch'](handleError(_0x5ebd8e,null));};exports['show']=function(_0x8171e9,_0x4b8e89){var _0x527b8c={'raw':!![],'where':{'id':_0x8171e9['params']['id']}},_0x3fe79d={};_0x3fe79d[_0x16fd('0x3a')]=_[_0x16fd('0x3d')](db['SmsQueue'][_0x16fd('0x37')]);_0x3fe79d['query']=_[_0x16fd('0x3d')](_0x8171e9[_0x16fd('0x3c')]);_0x3fe79d[_0x16fd('0x42')]=_[_0x16fd('0x4b')](_0x3fe79d[_0x16fd('0x3a')],_0x3fe79d[_0x16fd('0x3c')]);_0x527b8c[_0x16fd('0x3e')]=_[_0x16fd('0x4b')](_0x3fe79d[_0x16fd('0x3a')],qs[_0x16fd('0x3f')](_0x8171e9[_0x16fd('0x3c')]['fields']));_0x527b8c[_0x16fd('0x3e')]=_0x527b8c['attributes']['length']?_0x527b8c[_0x16fd('0x3e')]:_0x3fe79d[_0x16fd('0x3a')];if(_0x8171e9[_0x16fd('0x3c')][_0x16fd('0x4c')]){_0x527b8c['include']=[{'all':!![]}];}_0x527b8c=_['merge']({},_0x527b8c,_0x8171e9[_0x16fd('0x47')]);return db[_0x16fd('0x36')][_0x16fd('0x4d')](_0x527b8c)[_0x16fd('0x2e')](handleEntityNotFound(_0x4b8e89,null))[_0x16fd('0x2e')](respondWithResult(_0x4b8e89,null))[_0x16fd('0x4e')](handleError(_0x4b8e89,null));};exports[_0x16fd('0x4f')]=function(_0x35937c,_0x143fa0){return db[_0x16fd('0x36')][_0x16fd('0x4f')](_0x35937c[_0x16fd('0x50')],{})[_0x16fd('0x2e')](function(_0x2020a0){var _0x13ec6a=_0x35937c['user']['get']({'plain':!![]});if(!_0x13ec6a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x13ec6a['role']===_0x16fd('0x51')){var _0x21dfdc=_0x2020a0[_0x16fd('0x2f')]({'plain':!![]});var _0x13075d=_0x16fd('0x30');return db['UserProfileSection'][_0x16fd('0x4d')]({'where':{'name':_0x13075d,'userProfileId':_0x13ec6a[_0x16fd('0x52')]},'raw':!![]})[_0x16fd('0x2e')](function(_0x22a6c5){if(_0x22a6c5&&_0x22a6c5[_0x16fd('0x53')]===0x0){return db[_0x16fd('0x31')][_0x16fd('0x4f')]({'name':_0x21dfdc[_0x16fd('0x34')],'resourceId':_0x21dfdc['id'],'type':_0x22a6c5[_0x16fd('0x34')],'sectionId':_0x22a6c5['id']},{})['then'](function(){return _0x2020a0;});}else{return _0x2020a0;}})[_0x16fd('0x4e')](function(_0x2069e0){logger[_0x16fd('0x32')](_0x16fd('0x54'),_0x2069e0);throw _0x2069e0;});}return _0x2020a0;})[_0x16fd('0x2e')](respondWithResult(_0x143fa0,0xc9))[_0x16fd('0x4e')](handleError(_0x143fa0,null));};exports[_0x16fd('0x2c')]=function(_0x1fe349,_0x3bfb9d){if(_0x1fe349[_0x16fd('0x50')]['id']){delete _0x1fe349[_0x16fd('0x50')]['id'];}return db['SmsQueue']['find']({'where':{'id':_0x1fe349[_0x16fd('0x55')]['id']}})[_0x16fd('0x2e')](handleEntityNotFound(_0x3bfb9d,null))[_0x16fd('0x2e')](saveUpdates(_0x1fe349['body'],null))[_0x16fd('0x2e')](respondWithResult(_0x3bfb9d,null))[_0x16fd('0x4e')](handleError(_0x3bfb9d,null));};exports[_0x16fd('0x2d')]=function(_0x22e589,_0x217542){return db[_0x16fd('0x36')][_0x16fd('0x4d')]({'where':{'id':_0x22e589[_0x16fd('0x55')]['id']}})[_0x16fd('0x2e')](handleEntityNotFound(_0x217542,null))[_0x16fd('0x2e')](removeEntity(_0x217542,null))['catch'](handleError(_0x217542,null));};exports[_0x16fd('0x56')]=function(_0x42b06b,_0x25389d){return db[_0x16fd('0x36')][_0x16fd('0x56')]()[_0x16fd('0x2e')](respondWithResult(_0x25389d,null))['catch'](handleError(_0x25389d,null));};exports[_0x16fd('0x57')]=function(_0x52cdd0,_0x16e936,_0x5ead5c){var _0x1f03c0={'raw':!![],'where':{}},_0x3c40a1={},_0x42c722;return db[_0x16fd('0x36')][_0x16fd('0x58')]({'where':{'id':_0x52cdd0[_0x16fd('0x55')]['id']}})[_0x16fd('0x2e')](handleEntityNotFound(_0x16e936,null))[_0x16fd('0x2e')](function(_0x3d1ef8){if(_0x3d1ef8){_0x42c722=_0x3d1ef8[_0x16fd('0x2f')]({'plain':!![]});_0x3c40a1[_0x16fd('0x3a')]=_[_0x16fd('0x3d')](db[_0x16fd('0x59')][_0x16fd('0x37')]);_0x3c40a1['query']=_[_0x16fd('0x3d')](_0x52cdd0[_0x16fd('0x3c')]);_0x3c40a1[_0x16fd('0x42')]=_['intersection'](_0x3c40a1[_0x16fd('0x3a')],_0x3c40a1[_0x16fd('0x3c')]);_0x1f03c0[_0x16fd('0x3e')]=_[_0x16fd('0x4b')](_0x3c40a1[_0x16fd('0x3a')],qs['fields'](_0x52cdd0[_0x16fd('0x3c')][_0x16fd('0x3f')]));_0x1f03c0[_0x16fd('0x3e')]=_0x1f03c0['attributes']['length']?_0x1f03c0['attributes']:_0x3c40a1[_0x16fd('0x3a')];if(!_0x52cdd0[_0x16fd('0x3c')]['hasOwnProperty']('nolimit')){_0x1f03c0[_0x16fd('0x26')]=qs[_0x16fd('0x26')](_0x52cdd0['query'][_0x16fd('0x26')]);_0x1f03c0[_0x16fd('0x24')]=qs[_0x16fd('0x24')](_0x52cdd0[_0x16fd('0x3c')][_0x16fd('0x24')]);}_0x1f03c0[_0x16fd('0x5a')]=qs['sort'](_0x52cdd0[_0x16fd('0x3c')][_0x16fd('0x41')]);_0x1f03c0[_0x16fd('0x44')]=qs[_0x16fd('0x42')](_['pick'](_0x52cdd0[_0x16fd('0x3c')],_0x3c40a1['filters']));_0x1f03c0[_0x16fd('0x44')][_0x16fd('0x5b')]=_0x3d1ef8['id'];if(_0x52cdd0[_0x16fd('0x3c')][_0x16fd('0x46')]){_0x1f03c0[_0x16fd('0x44')]=_[_0x16fd('0x5c')](_0x1f03c0[_0x16fd('0x44')],{'$or':_[_0x16fd('0x3b')](_0x1f03c0[_0x16fd('0x3e')],function(_0x1863fb){var _0x28a446={};_0x28a446[_0x1863fb]={'$like':'%'+_0x52cdd0[_0x16fd('0x3c')]['filter']+'%'};return _0x28a446;})});}_0x1f03c0=_[_0x16fd('0x5c')]({},_0x1f03c0,_0x52cdd0[_0x16fd('0x47')]);return db[_0x16fd('0x59')][_0x16fd('0x49')](_0x1f03c0);}})[_0x16fd('0x2e')](function(_0x46667b){if(_0x46667b){return db[_0x16fd('0x5d')]['findAndCountAll']({'where':{'id':_[_0x16fd('0x3b')](_0x46667b,'UserId'),'role':_0x16fd('0x5e')},'attributes':['id',_0x16fd('0x34'),_0x16fd('0x5f'),_0x16fd('0x60'),_0x16fd('0x61')]});}})[_0x16fd('0x2e')](function(_0x193ad2){if(_0x193ad2){return{'count':_0x193ad2[_0x16fd('0x27')],'rows':_[_0x16fd('0x3b')](_0x193ad2[_0x16fd('0x4a')],function(_0x91e87){return{'membername':_0x91e87[_0x16fd('0x34')],'UserId':_0x91e87['id'],'queue_name':_0x42c722[_0x16fd('0x34')],'SmsQueueId':_0x42c722['id'],'interface':util[_0x16fd('0x62')](_0x16fd('0x63'),_0x16fd('0x64'),_0x91e87[_0x16fd('0x34')]),'penalty':0x0,'paused':_0x91e87[_0x16fd('0x5f')],'createdAt':_0x91e87['createdAt'],'updatedAt':_0x91e87[_0x16fd('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x16fd('0x2e')](respondWithFilteredResult(_0x16e936,_0x1f03c0))[_0x16fd('0x4e')](handleError(_0x16e936,null));};exports['getTeams']=function(_0x47a8a5,_0x5d07cd,_0x53a4ce){var _0x13e960={};var _0x24c3a8={};var _0x25887e;var _0x44a08c;return db[_0x16fd('0x36')][_0x16fd('0x58')]({'where':{'id':_0x47a8a5['params']['id']}})[_0x16fd('0x2e')](handleEntityNotFound(_0x5d07cd,null))[_0x16fd('0x2e')](function(_0x1c7710){if(_0x1c7710){_0x25887e=_0x1c7710;_0x24c3a8['model']=_[_0x16fd('0x3d')](db[_0x16fd('0x65')]['rawAttributes']);_0x24c3a8[_0x16fd('0x3c')]=_[_0x16fd('0x3d')](_0x47a8a5[_0x16fd('0x3c')]);_0x24c3a8[_0x16fd('0x42')]=_['intersection'](_0x24c3a8[_0x16fd('0x3a')],_0x24c3a8['query']);_0x13e960[_0x16fd('0x3e')]=_[_0x16fd('0x4b')](_0x24c3a8[_0x16fd('0x3a')],qs['fields'](_0x47a8a5[_0x16fd('0x3c')]['fields']));_0x13e960['attributes']=_0x13e960[_0x16fd('0x3e')]['length']?_0x13e960[_0x16fd('0x3e')]:_0x24c3a8[_0x16fd('0x3a')];_0x13e960['order']=qs['sort'](_0x47a8a5[_0x16fd('0x3c')][_0x16fd('0x41')]);_0x13e960[_0x16fd('0x44')]=qs[_0x16fd('0x42')](_[_0x16fd('0x43')](_0x47a8a5['query'],_0x24c3a8['filters']));if(_0x47a8a5[_0x16fd('0x3c')]['filter']){_0x13e960['where']=_[_0x16fd('0x5c')](_0x13e960[_0x16fd('0x44')],{'$or':_[_0x16fd('0x3b')](_0x13e960[_0x16fd('0x3e')],function(_0x32db48){var _0xa24c3f={};_0xa24c3f[_0x32db48]={'$like':'%'+_0x47a8a5[_0x16fd('0x3c')][_0x16fd('0x46')]+'%'};return _0xa24c3f;})});}_0x13e960=_[_0x16fd('0x5c')]({},_0x13e960,_0x47a8a5[_0x16fd('0x47')]);return _0x25887e[_0x16fd('0x66')](_0x13e960);}})[_0x16fd('0x2e')](function(_0x1c4f37){if(_0x1c4f37){_0x44a08c=_0x1c4f37[_0x16fd('0x67')];if(!_0x47a8a5[_0x16fd('0x3c')][_0x16fd('0x68')](_0x16fd('0x40'))){_0x13e960['limit']=qs[_0x16fd('0x26')](_0x47a8a5[_0x16fd('0x3c')][_0x16fd('0x26')]);_0x13e960[_0x16fd('0x24')]=qs[_0x16fd('0x24')](_0x47a8a5[_0x16fd('0x3c')][_0x16fd('0x24')]);}return _0x25887e['getTeams'](_0x13e960);}})['then'](function(_0x1b280b){if(_0x1b280b){return _0x1b280b?{'count':_0x44a08c,'rows':_0x1b280b}:null;}})[_0x16fd('0x2e')](respondWithResult(_0x5d07cd,null))['catch'](handleError(_0x5d07cd,null));};exports[_0x16fd('0x69')]=function(_0x250a27,_0x8f8789,_0x1be739){var _0x531c43=_0x250a27[_0x16fd('0x50')][_0x16fd('0x6a')];return db[_0x16fd('0x65')][_0x16fd('0x49')]({'where':{'id':_0x531c43},'attributes':['id'],'include':[{'model':db[_0x16fd('0x5d')],'as':'Agents','attributes':['id','name','online',_0x16fd('0x6b'),_0x16fd('0x6c')],'raw':!![]}]})[_0x16fd('0x2e')](function(_0xa0271e){if(_0xa0271e){var _0x4438a5=_[_0x16fd('0x6d')](_0xa0271e,function(_0x451432){var _0x2ec6b8=_0x451432[_0x16fd('0x2f')]({'plain':!![]});return _0x2ec6b8['Agents'];});return db[_0x16fd('0x36')]['find']({'where':{'id':_0x250a27[_0x16fd('0x55')]['id']}})[_0x16fd('0x2e')](function(_0x2260fc){return db[_0x16fd('0x6e')]['transaction'](function(_0x3b1a09){return _0x2260fc[_0x16fd('0x69')](_0x531c43,{'transaction':_0x3b1a09})[_0x16fd('0x2e')](function(){return BPromise[_0x16fd('0x6f')](_0x4438a5,function(_0x1e0083){return db[_0x16fd('0x59')][_0x16fd('0x70')]({'where':{'UserId':_0x1e0083['id'],'SmsQueueId':_0x250a27[_0x16fd('0x55')]['id']},'transaction':_0x3b1a09});});})['then'](function(){_0x4438a5['forEach'](function(_0x5e1160){socket[_0x16fd('0x71')](_0x16fd('0x72'),{'UserId':_0x5e1160['id'],'SmsQueueId':_0x2260fc['id']});});});});});}})[_0x16fd('0x2e')](respondWithStatusCode(_0x8f8789,null))['catch'](handleError(_0x8f8789,null));};exports[_0x16fd('0x73')]=function(_0x3a9f90,_0x265d1e,_0x1abafc){return db['Team'][_0x16fd('0x49')]({'where':{'id':_0x3a9f90[_0x16fd('0x3c')][_0x16fd('0x6a')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x16fd('0x2e')](handleEntityNotFound(_0x265d1e,null))[_0x16fd('0x2e')](function(_0x4c2da2){var _0x33cd4b=_['map'](_0x4c2da2,'id');var _0x4dcb93=[];var _0x4b623e=[];var _0x208f49=squel[_0x16fd('0x74')]();_0x208f49[_0x16fd('0x75')]('tq.TeamId')[_0x16fd('0x76')](_0x16fd('0x77'),'tq')[_0x16fd('0x78')](_0x16fd('0x79'),'ut',_0x16fd('0x7a'))['where'](_0x16fd('0x7b'),_0x3a9f90[_0x16fd('0x55')]['id']);for(var _0xa58dc8=0x0;_0xa58dc8<_0x4c2da2['length'];_0xa58dc8+=0x1){let _0x1705be=_0x4c2da2[_0xa58dc8];for(var _0x40989f=0x0;_0x40989f<_0x1705be['Agents'][_0x16fd('0x67')];_0x40989f+=0x1){let _0x250509=_0x1705be[_0x16fd('0x7c')][_0x40989f];var _0x4cdc07=_0x208f49[_0x16fd('0x7d')]();_0x4cdc07[_0x16fd('0x44')](_0x16fd('0x7e'),_0x250509['id']);_0x4b623e['push'](db['sequelize']['query'](_0x4cdc07['toString'](),{'type':db[_0x16fd('0x6e')][_0x16fd('0x7f')][_0x16fd('0x80')]})[_0x16fd('0x2e')](function(_0x52bc04){if(_0x52bc04[_0x16fd('0x67')]===0x1){return _0x250509['id'];}else{var _0x3602c3=_[_0x16fd('0x81')](_['map'](_0x52bc04,'TeamId'),function(_0x5938ea){return _['includes'](_0x33cd4b,_0x5938ea);});if(_0x3602c3){return _0x250509['id'];}}}));}}return BPromise[_0x16fd('0x82')](_0x4b623e)[_0x16fd('0x2e')](function(_0x3f99c0){_0x4dcb93=_(_0x4dcb93)[_0x16fd('0x83')](_0x3f99c0)[_0x16fd('0x84')]()[_0x16fd('0x85')]();return db['SmsQueue'][_0x16fd('0x4d')]({'where':{'id':_0x3a9f90[_0x16fd('0x55')]['id']}})[_0x16fd('0x2e')](function(_0x52caef){return db[_0x16fd('0x6e')]['transaction'](function(_0x4067d8){return _0x52caef['removeTeams'](_0x3a9f90[_0x16fd('0x3c')][_0x16fd('0x6a')],{'transaction':_0x4067d8})[_0x16fd('0x2e')](function(){if(!_[_0x16fd('0x86')](_0x4dcb93)){return _0x52caef['removeAgents'](_0x4dcb93,{'transaction':_0x4067d8});}})[_0x16fd('0x2e')](function(){_0x4dcb93[_0x16fd('0x87')](function(_0x333244){socket[_0x16fd('0x71')](_0x16fd('0x88'),{'UserId':_0x333244,'SmsQueueId':_0x52caef['id']});});});});});});})['then'](respondWithStatusCode(_0x265d1e,null))['catch'](handleError(_0x265d1e,null));};exports[_0x16fd('0x89')]=function(_0x48fa3e,_0x5709a0,_0x9f643a){return db[_0x16fd('0x36')][_0x16fd('0x4d')]({'where':{'id':_0x48fa3e[_0x16fd('0x55')]['id']}})[_0x16fd('0x2e')](handleEntityNotFound(_0x5709a0,null))[_0x16fd('0x2e')](function(_0x250d3e){if(_0x250d3e){return _0x250d3e[_0x16fd('0x89')](_0x48fa3e[_0x16fd('0x50')][_0x16fd('0x6a')],_[_0x16fd('0x8a')](_0x48fa3e[_0x16fd('0x50')],['ids','id'])||{})[_0x16fd('0x8b')](function(_0x51bd17){for(var _0x1ab985=0x0;_0x1ab985<_0x48fa3e[_0x16fd('0x50')][_0x16fd('0x6a')]['length'];_0x1ab985+=0x1){socket[_0x16fd('0x71')](_0x16fd('0x72'),{'UserId':Number(_0x48fa3e['body'][_0x16fd('0x6a')][_0x1ab985]),'SmsQueueId':Number(_0x48fa3e['params']['id'])});}return _0x51bd17;});}})['then'](respondWithResult(_0x5709a0,null))[_0x16fd('0x4e')](handleError(_0x5709a0,null));};exports['removeAgents']=function(_0x3eb849,_0x59c2db,_0x2dc4f3){return db[_0x16fd('0x36')][_0x16fd('0x4d')]({'where':{'id':_0x3eb849[_0x16fd('0x55')]['id']}})[_0x16fd('0x2e')](handleEntityNotFound(_0x59c2db,null))[_0x16fd('0x2e')](function(_0x38ec81){if(_0x38ec81){return _0x38ec81['removeAgents'](_0x3eb849['query'][_0x16fd('0x6a')])[_0x16fd('0x2e')](function(){if(_[_0x16fd('0x8c')](_0x3eb849[_0x16fd('0x3c')][_0x16fd('0x6a')])){for(var _0x4728df=0x0;_0x4728df<_0x3eb849[_0x16fd('0x3c')]['ids'][_0x16fd('0x67')];_0x4728df+=0x1){socket['emit'](_0x16fd('0x88'),{'UserId':Number(_0x3eb849[_0x16fd('0x3c')][_0x16fd('0x6a')][_0x4728df]),'SmsQueueId':Number(_0x3eb849[_0x16fd('0x55')]['id'])});}}else{socket[_0x16fd('0x71')](_0x16fd('0x88'),{'UserId':Number(_0x3eb849[_0x16fd('0x3c')][_0x16fd('0x6a')]),'SmsQueueId':Number(_0x3eb849['params']['id'])});}});}})['then'](respondWithStatusCode(_0x59c2db,null))['catch'](handleError(_0x59c2db,null));};exports[_0x16fd('0x8d')]=function(_0x1549ee,_0x11da8a,_0x3e5056){var _0x21cb67={};var _0x5ac39={};var _0x200a76;var _0x5aaec8;return db[_0x16fd('0x36')][_0x16fd('0x58')]({'where':{'id':_0x1549ee[_0x16fd('0x55')]['id']}})[_0x16fd('0x2e')](handleEntityNotFound(_0x11da8a,null))['then'](function(_0x4c037a){if(_0x4c037a){_0x200a76=_0x4c037a;_0x5ac39[_0x16fd('0x3a')]=_[_0x16fd('0x3d')](db[_0x16fd('0x5d')][_0x16fd('0x37')]);_0x5ac39[_0x16fd('0x3c')]=_[_0x16fd('0x3d')](_0x1549ee[_0x16fd('0x3c')]);_0x5ac39[_0x16fd('0x42')]=_[_0x16fd('0x4b')](_0x5ac39[_0x16fd('0x3a')],_0x5ac39['query']);_0x21cb67[_0x16fd('0x3e')]=_[_0x16fd('0x4b')](_0x5ac39[_0x16fd('0x3a')],qs['fields'](_0x1549ee[_0x16fd('0x3c')]['fields']));_0x21cb67[_0x16fd('0x3e')]=_0x21cb67['attributes'][_0x16fd('0x67')]?_0x21cb67['attributes']:_0x5ac39['model'];_0x21cb67[_0x16fd('0x5a')]=qs[_0x16fd('0x41')](_0x1549ee[_0x16fd('0x3c')]['sort']);_0x21cb67[_0x16fd('0x44')]=qs['filters'](_[_0x16fd('0x43')](_0x1549ee[_0x16fd('0x3c')],_0x5ac39[_0x16fd('0x42')]));if(_0x1549ee['query'][_0x16fd('0x46')]){_0x21cb67[_0x16fd('0x44')]=_[_0x16fd('0x5c')](_0x21cb67[_0x16fd('0x44')],{'$or':_[_0x16fd('0x3b')](_0x21cb67[_0x16fd('0x3e')],function(_0x3103c2){var _0x5b3a67={};_0x5b3a67[_0x3103c2]={'$like':'%'+_0x1549ee[_0x16fd('0x3c')][_0x16fd('0x46')]+'%'};return _0x5b3a67;})});}_0x21cb67=_[_0x16fd('0x5c')]({},_0x21cb67,_0x1549ee[_0x16fd('0x47')]);return _0x200a76[_0x16fd('0x8d')](_0x21cb67);}})[_0x16fd('0x2e')](function(_0x845332){if(_0x845332){_0x5aaec8=_0x845332[_0x16fd('0x67')];if(!_0x1549ee[_0x16fd('0x3c')][_0x16fd('0x68')]('nolimit')){_0x21cb67[_0x16fd('0x26')]=qs[_0x16fd('0x26')](_0x1549ee['query'][_0x16fd('0x26')]);_0x21cb67[_0x16fd('0x24')]=qs[_0x16fd('0x24')](_0x1549ee['query'][_0x16fd('0x24')]);}return _0x200a76[_0x16fd('0x8d')](_0x21cb67);}})['then'](function(_0x45c9db){if(_0x45c9db){return _0x45c9db?{'count':_0x5aaec8,'rows':_0x45c9db}:null;}})['then'](respondWithResult(_0x11da8a,null))['catch'](handleError(_0x11da8a,null));}; \ No newline at end of file +var _0x1eb4=['hasOwnProperty','nolimit','order','sort','where','pick','type','filter','includeAll','include','findAll','rows','catch','params','merge','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','UserSmsQueue','rawAttributes','findAndCountAll','updatedAt','createdAt','format','%s/%s','SIP','smsPause','getTeams','findOne','addTeams','ids','Team','online','voicePause','interface','flatMap','Agents','sequelize','transaction','forEach','userSmsQueue:save','User','select','field','tq.TeamId','from','team_has_sms_queues','join','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','value','removeTeams','isEmpty','removeAgents','userSmsQueue:remove','addAgents','omit','spread','emit','isArray','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./smsQueue.socket','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','then','destroy','get','SmsQueues','name','index','map','SmsQueue','fieldName','model','query','keys','filters','attributes','intersection','fields','length'];(function(_0xc80e7,_0x39aaca){var _0x29a0e2=function(_0x3d27cf){while(--_0x3d27cf){_0xc80e7['push'](_0xc80e7['shift']());}};_0x29a0e2(++_0x39aaca);}(_0x1eb4,0x158));var _0x41eb=function(_0x3bc138,_0x4cd60b){_0x3bc138=_0x3bc138-0x0;var _0x3f6dac=_0x1eb4[_0x3bc138];return _0x3f6dac;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x41eb('0x0'));var zipdir=require(_0x41eb('0x1'));var jsonpatch=require(_0x41eb('0x2'));var rp=require(_0x41eb('0x3'));var moment=require(_0x41eb('0x4'));var BPromise=require(_0x41eb('0x5'));var Mustache=require(_0x41eb('0x6'));var util=require(_0x41eb('0x7'));var path=require(_0x41eb('0x8'));var sox=require('sox');var csv=require(_0x41eb('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x41eb('0xa'));var _=require('lodash');var squel=require(_0x41eb('0xb'));var crypto=require(_0x41eb('0xc'));var jsforce=require(_0x41eb('0xd'));var deskjs=require(_0x41eb('0xe'));var toCsv=require('to-csv');var querystring=require(_0x41eb('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x41eb('0x10'));var logger=require('../../config/logger')(_0x41eb('0x11'));var utils=require('../../config/utils');var config=require(_0x41eb('0x12'));var licenseUtil=require(_0x41eb('0x13'));var db=require(_0x41eb('0x14'))['db'];config['redis']=_[_0x41eb('0x15')](config[_0x41eb('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x41eb('0x17'))(new Redis(config['redis']));require(_0x41eb('0x18'))['register'](socket);function respondWithStatusCode(_0x3294b9,_0x578e32){_0x578e32=_0x578e32||0xcc;return function(_0x230c07){if(_0x230c07){return _0x3294b9['sendStatus'](_0x578e32);}return _0x3294b9[_0x41eb('0x19')](_0x578e32)[_0x41eb('0x1a')]();};}function respondWithResult(_0x8b3a7,_0x5c9974){_0x5c9974=_0x5c9974||0xc8;return function(_0x49eb77){if(_0x49eb77){return _0x8b3a7[_0x41eb('0x19')](_0x5c9974)[_0x41eb('0x1b')](_0x49eb77);}};}function respondWithFilteredResult(_0x592499,_0x1eb6ca){return function(_0x51772a){if(_0x51772a){var _0x345697=typeof _0x1eb6ca[_0x41eb('0x1c')]===_0x41eb('0x1d')&&typeof _0x1eb6ca[_0x41eb('0x1e')]==='undefined';var _0x7a469f=_0x51772a[_0x41eb('0x1f')];var _0x203e3e=_0x345697?0x0:_0x1eb6ca['offset'];var _0x1b0077=_0x345697?_0x51772a[_0x41eb('0x1f')]:_0x1eb6ca[_0x41eb('0x1c')]+_0x1eb6ca['limit'];var _0x407116;if(_0x1b0077>=_0x7a469f){_0x1b0077=_0x7a469f;_0x407116=0xc8;}else{_0x407116=0xce;}_0x592499['status'](_0x407116);return _0x592499[_0x41eb('0x20')](_0x41eb('0x21'),_0x203e3e+'-'+_0x1b0077+'/'+_0x7a469f)['json'](_0x51772a);}return null;};}function patchUpdates(_0x586a9b){return function(_0x3fd947){try{jsonpatch[_0x41eb('0x22')](_0x3fd947,_0x586a9b,!![]);}catch(_0x18103d){return BPromise['reject'](_0x18103d);}return _0x3fd947['save']();};}function saveUpdates(_0x207c43,_0x31dba6){return function(_0x12eba1){if(_0x12eba1){return _0x12eba1['update'](_0x207c43)[_0x41eb('0x23')](function(_0x2fe05d){return _0x2fe05d;});}return null;};}function removeEntity(_0x77d73b,_0x36e040){return function(_0x2f4319){if(_0x2f4319){return _0x2f4319[_0x41eb('0x24')]()[_0x41eb('0x23')](function(){var _0x3d9d7d=_0x2f4319[_0x41eb('0x25')]({'plain':!![]});var _0x570949=_0x41eb('0x26');return db['UserProfileResource'][_0x41eb('0x24')]({'where':{'type':_0x570949,'resourceId':_0x3d9d7d['id']}})[_0x41eb('0x23')](function(){return _0x2f4319;});})['then'](function(){_0x77d73b['status'](0xcc)[_0x41eb('0x1a')]();});}};}function handleEntityNotFound(_0x59ed31,_0x14361c){return function(_0x5d1a4b){if(!_0x5d1a4b){_0x59ed31['sendStatus'](0x194);}return _0x5d1a4b;};}function handleError(_0xf62a61,_0x49d0a0){_0x49d0a0=_0x49d0a0||0x1f4;return function(_0x281e88){logger['error'](_0x281e88['stack']);if(_0x281e88[_0x41eb('0x27')]){delete _0x281e88[_0x41eb('0x27')];}_0xf62a61[_0x41eb('0x19')](_0x49d0a0)['send'](_0x281e88);};}exports[_0x41eb('0x28')]=function(_0x3b546e,_0x801bd){var _0x30c7d8={},_0x23e7e5={},_0x439d2e={'count':0x0,'rows':[]};var _0x2b4719=_[_0x41eb('0x29')](db[_0x41eb('0x2a')]['rawAttributes'],function(_0x240a9f){return{'name':_0x240a9f[_0x41eb('0x2b')],'type':_0x240a9f['type']['key']};});_0x23e7e5[_0x41eb('0x2c')]=_[_0x41eb('0x29')](_0x2b4719,'name');_0x23e7e5[_0x41eb('0x2d')]=_[_0x41eb('0x2e')](_0x3b546e[_0x41eb('0x2d')]);_0x23e7e5[_0x41eb('0x2f')]=_['intersection'](_0x23e7e5[_0x41eb('0x2c')],_0x23e7e5[_0x41eb('0x2d')]);_0x30c7d8[_0x41eb('0x30')]=_[_0x41eb('0x31')](_0x23e7e5[_0x41eb('0x2c')],qs[_0x41eb('0x32')](_0x3b546e[_0x41eb('0x2d')][_0x41eb('0x32')]));_0x30c7d8[_0x41eb('0x30')]=_0x30c7d8[_0x41eb('0x30')][_0x41eb('0x33')]?_0x30c7d8[_0x41eb('0x30')]:_0x23e7e5[_0x41eb('0x2c')];if(!_0x3b546e[_0x41eb('0x2d')][_0x41eb('0x34')](_0x41eb('0x35'))){_0x30c7d8[_0x41eb('0x1e')]=qs[_0x41eb('0x1e')](_0x3b546e[_0x41eb('0x2d')][_0x41eb('0x1e')]);_0x30c7d8[_0x41eb('0x1c')]=qs[_0x41eb('0x1c')](_0x3b546e[_0x41eb('0x2d')]['offset']);}_0x30c7d8[_0x41eb('0x36')]=qs['sort'](_0x3b546e[_0x41eb('0x2d')][_0x41eb('0x37')]);_0x30c7d8[_0x41eb('0x38')]=qs[_0x41eb('0x2f')](_[_0x41eb('0x39')](_0x3b546e[_0x41eb('0x2d')],_0x23e7e5[_0x41eb('0x2f')]),_0x2b4719);if(_0x3b546e[_0x41eb('0x2d')]['filter']){_0x30c7d8[_0x41eb('0x38')]=_['merge'](_0x30c7d8[_0x41eb('0x38')],{'$or':_[_0x41eb('0x29')](_0x2b4719,function(_0x4ebd40){if(_0x4ebd40[_0x41eb('0x3a')]!=='VIRTUAL'){var _0x466a86={};_0x466a86[_0x4ebd40['name']]={'$like':'%'+_0x3b546e[_0x41eb('0x2d')][_0x41eb('0x3b')]+'%'};return _0x466a86;}})});}_0x30c7d8=_['merge']({},_0x30c7d8,_0x3b546e['options']);var _0x1ec0f2={'where':_0x30c7d8[_0x41eb('0x38')]};return db[_0x41eb('0x2a')][_0x41eb('0x1f')](_0x1ec0f2)['then'](function(_0x4f5be4){_0x439d2e['count']=_0x4f5be4;if(_0x3b546e['query'][_0x41eb('0x3c')]){_0x30c7d8[_0x41eb('0x3d')]=[{'all':!![]}];}return db[_0x41eb('0x2a')][_0x41eb('0x3e')](_0x30c7d8);})[_0x41eb('0x23')](function(_0x4c4ca1){_0x439d2e[_0x41eb('0x3f')]=_0x4c4ca1;return _0x439d2e;})[_0x41eb('0x23')](respondWithFilteredResult(_0x801bd,_0x30c7d8))[_0x41eb('0x40')](handleError(_0x801bd,null));};exports['show']=function(_0x16053a,_0x4331c1){var _0x97c6cc={'raw':!![],'where':{'id':_0x16053a[_0x41eb('0x41')]['id']}},_0x170cdc={};_0x170cdc[_0x41eb('0x2c')]=_[_0x41eb('0x2e')](db[_0x41eb('0x2a')]['rawAttributes']);_0x170cdc[_0x41eb('0x2d')]=_[_0x41eb('0x2e')](_0x16053a[_0x41eb('0x2d')]);_0x170cdc[_0x41eb('0x2f')]=_[_0x41eb('0x31')](_0x170cdc[_0x41eb('0x2c')],_0x170cdc[_0x41eb('0x2d')]);_0x97c6cc[_0x41eb('0x30')]=_[_0x41eb('0x31')](_0x170cdc[_0x41eb('0x2c')],qs['fields'](_0x16053a[_0x41eb('0x2d')][_0x41eb('0x32')]));_0x97c6cc['attributes']=_0x97c6cc[_0x41eb('0x30')][_0x41eb('0x33')]?_0x97c6cc[_0x41eb('0x30')]:_0x170cdc['model'];if(_0x16053a[_0x41eb('0x2d')][_0x41eb('0x3c')]){_0x97c6cc[_0x41eb('0x3d')]=[{'all':!![]}];}_0x97c6cc=_[_0x41eb('0x42')]({},_0x97c6cc,_0x16053a[_0x41eb('0x43')]);return db[_0x41eb('0x2a')][_0x41eb('0x44')](_0x97c6cc)[_0x41eb('0x23')](handleEntityNotFound(_0x4331c1,null))['then'](respondWithResult(_0x4331c1,null))[_0x41eb('0x40')](handleError(_0x4331c1,null));};exports[_0x41eb('0x45')]=function(_0x38c029,_0x5ee001){return db[_0x41eb('0x2a')]['create'](_0x38c029[_0x41eb('0x46')],{})[_0x41eb('0x23')](function(_0x25d73a){var _0x202782=_0x38c029['user'][_0x41eb('0x25')]({'plain':!![]});if(!_0x202782)throw new Error(_0x41eb('0x47'));if(_0x202782[_0x41eb('0x48')]==='user'){var _0x2ca8cf=_0x25d73a[_0x41eb('0x25')]({'plain':!![]});var _0x34e6ea=_0x41eb('0x26');return db[_0x41eb('0x49')][_0x41eb('0x44')]({'where':{'name':_0x34e6ea,'userProfileId':_0x202782['userProfileId']},'raw':!![]})[_0x41eb('0x23')](function(_0x41172e){if(_0x41172e&&_0x41172e[_0x41eb('0x4a')]===0x0){return db[_0x41eb('0x4b')][_0x41eb('0x45')]({'name':_0x2ca8cf[_0x41eb('0x27')],'resourceId':_0x2ca8cf['id'],'type':_0x41172e['name'],'sectionId':_0x41172e['id']},{})[_0x41eb('0x23')](function(){return _0x25d73a;});}else{return _0x25d73a;}})['catch'](function(_0x46414f){logger['error'](_0x41eb('0x4c'),_0x46414f);throw _0x46414f;});}return _0x25d73a;})['then'](respondWithResult(_0x5ee001,0xc9))['catch'](handleError(_0x5ee001,null));};exports[_0x41eb('0x4d')]=function(_0x1a34a8,_0x388665){if(_0x1a34a8[_0x41eb('0x46')]['id']){delete _0x1a34a8['body']['id'];}return db[_0x41eb('0x2a')][_0x41eb('0x44')]({'where':{'id':_0x1a34a8['params']['id']}})[_0x41eb('0x23')](handleEntityNotFound(_0x388665,null))[_0x41eb('0x23')](saveUpdates(_0x1a34a8['body'],null))[_0x41eb('0x23')](respondWithResult(_0x388665,null))[_0x41eb('0x40')](handleError(_0x388665,null));};exports['destroy']=function(_0x73ea37,_0x31752b){return db['SmsQueue']['find']({'where':{'id':_0x73ea37[_0x41eb('0x41')]['id']}})['then'](handleEntityNotFound(_0x31752b,null))[_0x41eb('0x23')](removeEntity(_0x31752b,null))['catch'](handleError(_0x31752b,null));};exports['describe']=function(_0x2916b4,_0x92d0db){return db[_0x41eb('0x2a')][_0x41eb('0x4e')]()[_0x41eb('0x23')](respondWithResult(_0x92d0db,null))['catch'](handleError(_0x92d0db,null));};exports['getMembers']=function(_0x36ce5a,_0x19f8ab,_0x1b0ae3){var _0xc37050={'raw':!![],'where':{}},_0x5853b9={},_0x1a980b;return db[_0x41eb('0x2a')]['findOne']({'where':{'id':_0x36ce5a[_0x41eb('0x41')]['id']}})['then'](handleEntityNotFound(_0x19f8ab,null))[_0x41eb('0x23')](function(_0x235e36){if(_0x235e36){_0x1a980b=_0x235e36[_0x41eb('0x25')]({'plain':!![]});_0x5853b9[_0x41eb('0x2c')]=_[_0x41eb('0x2e')](db[_0x41eb('0x4f')][_0x41eb('0x50')]);_0x5853b9[_0x41eb('0x2d')]=_['keys'](_0x36ce5a[_0x41eb('0x2d')]);_0x5853b9['filters']=_[_0x41eb('0x31')](_0x5853b9['model'],_0x5853b9['query']);_0xc37050[_0x41eb('0x30')]=_[_0x41eb('0x31')](_0x5853b9[_0x41eb('0x2c')],qs[_0x41eb('0x32')](_0x36ce5a['query'][_0x41eb('0x32')]));_0xc37050[_0x41eb('0x30')]=_0xc37050['attributes'][_0x41eb('0x33')]?_0xc37050[_0x41eb('0x30')]:_0x5853b9[_0x41eb('0x2c')];if(!_0x36ce5a['query']['hasOwnProperty']('nolimit')){_0xc37050['limit']=qs[_0x41eb('0x1e')](_0x36ce5a[_0x41eb('0x2d')]['limit']);_0xc37050[_0x41eb('0x1c')]=qs[_0x41eb('0x1c')](_0x36ce5a[_0x41eb('0x2d')][_0x41eb('0x1c')]);}_0xc37050[_0x41eb('0x36')]=qs[_0x41eb('0x37')](_0x36ce5a[_0x41eb('0x2d')]['sort']);_0xc37050[_0x41eb('0x38')]=qs[_0x41eb('0x2f')](_[_0x41eb('0x39')](_0x36ce5a[_0x41eb('0x2d')],_0x5853b9[_0x41eb('0x2f')]));_0xc37050[_0x41eb('0x38')]['SmsQueueId']=_0x235e36['id'];if(_0x36ce5a[_0x41eb('0x2d')][_0x41eb('0x3b')]){_0xc37050['where']=_[_0x41eb('0x42')](_0xc37050['where'],{'$or':_[_0x41eb('0x29')](_0xc37050[_0x41eb('0x30')],function(_0xde626d){var _0x18c50c={};_0x18c50c[_0xde626d]={'$like':'%'+_0x36ce5a[_0x41eb('0x2d')][_0x41eb('0x3b')]+'%'};return _0x18c50c;})});}_0xc37050=_[_0x41eb('0x42')]({},_0xc37050,_0x36ce5a[_0x41eb('0x43')]);return db['UserSmsQueue'][_0x41eb('0x3e')](_0xc37050);}})[_0x41eb('0x23')](function(_0x2f70fb){if(_0x2f70fb){return db['User'][_0x41eb('0x51')]({'where':{'id':_[_0x41eb('0x29')](_0x2f70fb,'UserId'),'role':'agent'},'attributes':['id',_0x41eb('0x27'),'smsPause',_0x41eb('0x52'),_0x41eb('0x53')]});}})['then'](function(_0x3ff6d4){if(_0x3ff6d4){return{'count':_0x3ff6d4[_0x41eb('0x1f')],'rows':_['map'](_0x3ff6d4[_0x41eb('0x3f')],function(_0x54a9ae){return{'membername':_0x54a9ae[_0x41eb('0x27')],'UserId':_0x54a9ae['id'],'queue_name':_0x1a980b[_0x41eb('0x27')],'SmsQueueId':_0x1a980b['id'],'interface':util[_0x41eb('0x54')](_0x41eb('0x55'),_0x41eb('0x56'),_0x54a9ae[_0x41eb('0x27')]),'penalty':0x0,'paused':_0x54a9ae[_0x41eb('0x57')],'createdAt':_0x54a9ae['createdAt'],'updatedAt':_0x54a9ae[_0x41eb('0x52')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x19f8ab,_0xc37050))[_0x41eb('0x40')](handleError(_0x19f8ab,null));};exports[_0x41eb('0x58')]=function(_0x47a470,_0x5ed7e7,_0x5e3d03){var _0x2904c7={};var _0x4d5b66={};var _0x4e42d3;var _0x470e8b;return db[_0x41eb('0x2a')][_0x41eb('0x59')]({'where':{'id':_0x47a470['params']['id']}})[_0x41eb('0x23')](handleEntityNotFound(_0x5ed7e7,null))[_0x41eb('0x23')](function(_0x27b654){if(_0x27b654){_0x4e42d3=_0x27b654;_0x4d5b66[_0x41eb('0x2c')]=_[_0x41eb('0x2e')](db['Team'][_0x41eb('0x50')]);_0x4d5b66['query']=_[_0x41eb('0x2e')](_0x47a470[_0x41eb('0x2d')]);_0x4d5b66['filters']=_['intersection'](_0x4d5b66['model'],_0x4d5b66['query']);_0x2904c7[_0x41eb('0x30')]=_[_0x41eb('0x31')](_0x4d5b66['model'],qs['fields'](_0x47a470['query']['fields']));_0x2904c7[_0x41eb('0x30')]=_0x2904c7['attributes']['length']?_0x2904c7[_0x41eb('0x30')]:_0x4d5b66[_0x41eb('0x2c')];_0x2904c7[_0x41eb('0x36')]=qs[_0x41eb('0x37')](_0x47a470[_0x41eb('0x2d')][_0x41eb('0x37')]);_0x2904c7['where']=qs['filters'](_[_0x41eb('0x39')](_0x47a470[_0x41eb('0x2d')],_0x4d5b66[_0x41eb('0x2f')]));if(_0x47a470[_0x41eb('0x2d')][_0x41eb('0x3b')]){_0x2904c7['where']=_['merge'](_0x2904c7['where'],{'$or':_[_0x41eb('0x29')](_0x2904c7['attributes'],function(_0x1f1052){var _0x1aa2e5={};_0x1aa2e5[_0x1f1052]={'$like':'%'+_0x47a470[_0x41eb('0x2d')][_0x41eb('0x3b')]+'%'};return _0x1aa2e5;})});}_0x2904c7=_[_0x41eb('0x42')]({},_0x2904c7,_0x47a470[_0x41eb('0x43')]);return _0x4e42d3['getTeams'](_0x2904c7);}})[_0x41eb('0x23')](function(_0xf4e617){if(_0xf4e617){_0x470e8b=_0xf4e617[_0x41eb('0x33')];if(!_0x47a470[_0x41eb('0x2d')]['hasOwnProperty'](_0x41eb('0x35'))){_0x2904c7['limit']=qs['limit'](_0x47a470[_0x41eb('0x2d')][_0x41eb('0x1e')]);_0x2904c7['offset']=qs[_0x41eb('0x1c')](_0x47a470[_0x41eb('0x2d')][_0x41eb('0x1c')]);}return _0x4e42d3[_0x41eb('0x58')](_0x2904c7);}})[_0x41eb('0x23')](function(_0x10c182){if(_0x10c182){return _0x10c182?{'count':_0x470e8b,'rows':_0x10c182}:null;}})[_0x41eb('0x23')](respondWithResult(_0x5ed7e7,null))[_0x41eb('0x40')](handleError(_0x5ed7e7,null));};exports[_0x41eb('0x5a')]=function(_0x82219c,_0x35f63d,_0x1adf26){var _0x15643c=_0x82219c[_0x41eb('0x46')][_0x41eb('0x5b')];return db[_0x41eb('0x5c')][_0x41eb('0x3e')]({'where':{'id':_0x15643c},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x41eb('0x27'),_0x41eb('0x5d'),_0x41eb('0x5e'),_0x41eb('0x5f')],'raw':!![]}]})[_0x41eb('0x23')](function(_0x32e52f){if(_0x32e52f){var _0x36f200=_[_0x41eb('0x60')](_0x32e52f,function(_0x1e6bf2){var _0x281093=_0x1e6bf2[_0x41eb('0x25')]({'plain':!![]});return _0x281093[_0x41eb('0x61')];});return db[_0x41eb('0x2a')][_0x41eb('0x44')]({'where':{'id':_0x82219c[_0x41eb('0x41')]['id']}})[_0x41eb('0x23')](function(_0x3bc71f){return db[_0x41eb('0x62')][_0x41eb('0x63')](function(_0x4454b4){return _0x3bc71f['addTeams'](_0x15643c,{'transaction':_0x4454b4})[_0x41eb('0x23')](function(){return BPromise['each'](_0x36f200,function(_0x241a63){return db[_0x41eb('0x4f')]['findOrCreate']({'where':{'UserId':_0x241a63['id'],'SmsQueueId':_0x82219c['params']['id']},'transaction':_0x4454b4});});})[_0x41eb('0x23')](function(){_0x36f200[_0x41eb('0x64')](function(_0x5d12d8){socket['emit'](_0x41eb('0x65'),{'UserId':_0x5d12d8['id'],'SmsQueueId':_0x3bc71f['id']});});});});});}})[_0x41eb('0x23')](respondWithStatusCode(_0x35f63d,null))[_0x41eb('0x40')](handleError(_0x35f63d,null));};exports['removeTeams']=function(_0x52d97a,_0x374b63,_0x3db4f6){return db[_0x41eb('0x5c')][_0x41eb('0x3e')]({'where':{'id':_0x52d97a['query'][_0x41eb('0x5b')]},'attributes':['id'],'include':[{'model':db[_0x41eb('0x66')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x41eb('0x23')](handleEntityNotFound(_0x374b63,null))[_0x41eb('0x23')](function(_0x41185f){var _0x5cb01d=_[_0x41eb('0x29')](_0x41185f,'id');var _0x53ca9f=[];var _0x27e616=[];var _0x20708e=squel[_0x41eb('0x67')]();_0x20708e[_0x41eb('0x68')](_0x41eb('0x69'))[_0x41eb('0x6a')](_0x41eb('0x6b'),'tq')[_0x41eb('0x6c')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0x41eb('0x38')](_0x41eb('0x6d'),_0x52d97a['params']['id']);for(var _0x9d3f25=0x0;_0x9d3f25<_0x41185f[_0x41eb('0x33')];_0x9d3f25+=0x1){let _0x21a081=_0x41185f[_0x9d3f25];for(var _0x59204b=0x0;_0x59204b<_0x21a081[_0x41eb('0x61')][_0x41eb('0x33')];_0x59204b+=0x1){let _0x5b53c9=_0x21a081[_0x41eb('0x61')][_0x59204b];var _0x4e70c7=_0x20708e[_0x41eb('0x6e')]();_0x4e70c7[_0x41eb('0x38')](_0x41eb('0x6f'),_0x5b53c9['id']);_0x27e616[_0x41eb('0x70')](db[_0x41eb('0x62')][_0x41eb('0x2d')](_0x4e70c7[_0x41eb('0x71')](),{'type':db[_0x41eb('0x62')][_0x41eb('0x72')][_0x41eb('0x73')]})[_0x41eb('0x23')](function(_0x24d026){if(_0x24d026[_0x41eb('0x33')]===0x1){return _0x5b53c9['id'];}else{var _0x3027cf=_[_0x41eb('0x74')](_[_0x41eb('0x29')](_0x24d026,_0x41eb('0x75')),function(_0x422c46){return _[_0x41eb('0x76')](_0x5cb01d,_0x422c46);});if(_0x3027cf){return _0x5b53c9['id'];}}}));}}return BPromise[_0x41eb('0x77')](_0x27e616)[_0x41eb('0x23')](function(_0x2d7a11){_0x53ca9f=_(_0x53ca9f)[_0x41eb('0x78')](_0x2d7a11)['compact']()[_0x41eb('0x79')]();return db['SmsQueue']['find']({'where':{'id':_0x52d97a[_0x41eb('0x41')]['id']}})[_0x41eb('0x23')](function(_0x47712e){return db[_0x41eb('0x62')]['transaction'](function(_0x2237fb){return _0x47712e[_0x41eb('0x7a')](_0x52d97a[_0x41eb('0x2d')][_0x41eb('0x5b')],{'transaction':_0x2237fb})[_0x41eb('0x23')](function(){if(!_[_0x41eb('0x7b')](_0x53ca9f)){return _0x47712e[_0x41eb('0x7c')](_0x53ca9f,{'transaction':_0x2237fb});}})[_0x41eb('0x23')](function(){_0x53ca9f[_0x41eb('0x64')](function(_0x201b0d){socket['emit'](_0x41eb('0x7d'),{'UserId':_0x201b0d,'SmsQueueId':_0x47712e['id']});});});});});});})[_0x41eb('0x23')](respondWithStatusCode(_0x374b63,null))[_0x41eb('0x40')](handleError(_0x374b63,null));};exports[_0x41eb('0x7e')]=function(_0x486df0,_0x510d41,_0x5dd29f){return db['SmsQueue'][_0x41eb('0x44')]({'where':{'id':_0x486df0['params']['id']}})[_0x41eb('0x23')](handleEntityNotFound(_0x510d41,null))['then'](function(_0x123d45){if(_0x123d45){return _0x123d45[_0x41eb('0x7e')](_0x486df0[_0x41eb('0x46')][_0x41eb('0x5b')],_[_0x41eb('0x7f')](_0x486df0[_0x41eb('0x46')],[_0x41eb('0x5b'),'id'])||{})[_0x41eb('0x80')](function(_0x2f2a85){for(var _0x267684=0x0;_0x267684<_0x486df0['body'][_0x41eb('0x5b')][_0x41eb('0x33')];_0x267684+=0x1){socket[_0x41eb('0x81')](_0x41eb('0x65'),{'UserId':Number(_0x486df0[_0x41eb('0x46')]['ids'][_0x267684]),'SmsQueueId':Number(_0x486df0[_0x41eb('0x41')]['id'])});}return _0x2f2a85;});}})[_0x41eb('0x23')](respondWithResult(_0x510d41,null))[_0x41eb('0x40')](handleError(_0x510d41,null));};exports['removeAgents']=function(_0xd3790e,_0x54531c,_0x3e178e){return db[_0x41eb('0x2a')]['find']({'where':{'id':_0xd3790e['params']['id']}})[_0x41eb('0x23')](handleEntityNotFound(_0x54531c,null))[_0x41eb('0x23')](function(_0x444b8c){if(_0x444b8c){return _0x444b8c['removeAgents'](_0xd3790e[_0x41eb('0x2d')]['ids'])['then'](function(){if(_[_0x41eb('0x82')](_0xd3790e[_0x41eb('0x2d')]['ids'])){for(var _0x3b205f=0x0;_0x3b205f<_0xd3790e[_0x41eb('0x2d')][_0x41eb('0x5b')][_0x41eb('0x33')];_0x3b205f+=0x1){socket[_0x41eb('0x81')](_0x41eb('0x7d'),{'UserId':Number(_0xd3790e['query']['ids'][_0x3b205f]),'SmsQueueId':Number(_0xd3790e[_0x41eb('0x41')]['id'])});}}else{socket[_0x41eb('0x81')]('userSmsQueue:remove',{'UserId':Number(_0xd3790e['query']['ids']),'SmsQueueId':Number(_0xd3790e['params']['id'])});}});}})[_0x41eb('0x23')](respondWithStatusCode(_0x54531c,null))[_0x41eb('0x40')](handleError(_0x54531c,null));};exports[_0x41eb('0x83')]=function(_0x3162b9,_0x104c6a,_0x2d333f){var _0x5bc225={};var _0x122add={};var _0x829c9b;var _0x182fbf;return db[_0x41eb('0x2a')][_0x41eb('0x59')]({'where':{'id':_0x3162b9[_0x41eb('0x41')]['id']}})[_0x41eb('0x23')](handleEntityNotFound(_0x104c6a,null))['then'](function(_0x501eb8){if(_0x501eb8){_0x829c9b=_0x501eb8;_0x122add[_0x41eb('0x2c')]=_['keys'](db[_0x41eb('0x66')]['rawAttributes']);_0x122add['query']=_[_0x41eb('0x2e')](_0x3162b9[_0x41eb('0x2d')]);_0x122add[_0x41eb('0x2f')]=_[_0x41eb('0x31')](_0x122add[_0x41eb('0x2c')],_0x122add[_0x41eb('0x2d')]);_0x5bc225['attributes']=_[_0x41eb('0x31')](_0x122add['model'],qs[_0x41eb('0x32')](_0x3162b9['query'][_0x41eb('0x32')]));_0x5bc225['attributes']=_0x5bc225[_0x41eb('0x30')][_0x41eb('0x33')]?_0x5bc225['attributes']:_0x122add[_0x41eb('0x2c')];_0x5bc225['order']=qs[_0x41eb('0x37')](_0x3162b9[_0x41eb('0x2d')][_0x41eb('0x37')]);_0x5bc225[_0x41eb('0x38')]=qs[_0x41eb('0x2f')](_[_0x41eb('0x39')](_0x3162b9[_0x41eb('0x2d')],_0x122add[_0x41eb('0x2f')]));if(_0x3162b9[_0x41eb('0x2d')][_0x41eb('0x3b')]){_0x5bc225[_0x41eb('0x38')]=_[_0x41eb('0x42')](_0x5bc225[_0x41eb('0x38')],{'$or':_['map'](_0x5bc225['attributes'],function(_0x42330e){var _0x17a62c={};_0x17a62c[_0x42330e]={'$like':'%'+_0x3162b9[_0x41eb('0x2d')][_0x41eb('0x3b')]+'%'};return _0x17a62c;})});}_0x5bc225=_['merge']({},_0x5bc225,_0x3162b9['options']);return _0x829c9b[_0x41eb('0x83')](_0x5bc225);}})[_0x41eb('0x23')](function(_0x4d678e){if(_0x4d678e){_0x182fbf=_0x4d678e[_0x41eb('0x33')];if(!_0x3162b9['query'][_0x41eb('0x34')](_0x41eb('0x35'))){_0x5bc225['limit']=qs['limit'](_0x3162b9['query'][_0x41eb('0x1e')]);_0x5bc225['offset']=qs[_0x41eb('0x1c')](_0x3162b9[_0x41eb('0x2d')][_0x41eb('0x1c')]);}return _0x829c9b[_0x41eb('0x83')](_0x5bc225);}})['then'](function(_0x125a80){if(_0x125a80){return _0x125a80?{'count':_0x182fbf,'rows':_0x125a80}:null;}})['then'](respondWithResult(_0x104c6a,null))[_0x41eb('0x40')](handleError(_0x104c6a,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 4c031c3..36ba7f8 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 _0xe462=['save','update','remove','emit','hook','exports','events','../../mysqldb'];(function(_0x3f3ad8,_0x4bc014){var _0x3a2667=function(_0x4fe7e0){while(--_0x4fe7e0){_0x3f3ad8['push'](_0x3f3ad8['shift']());}};_0x3a2667(++_0x4bc014);}(_0xe462,0x126));var _0x2e46=function(_0x2e8802,_0x59ad8c){_0x2e8802=_0x2e8802-0x0;var _0x4617aa=_0xe462[_0x2e8802];return _0x4617aa;};'use strict';var EventEmitter=require(_0x2e46('0x0'));var SmsQueue=require(_0x2e46('0x1'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2e46('0x2'),'afterUpdate':_0x2e46('0x3'),'afterDestroy':_0x2e46('0x4')};function emitEvent(_0x38be7e){return function(_0x36a901,_0x424a14,_0x3b3cb6){SmsQueueEvents[_0x2e46('0x5')](_0x38be7e+':'+_0x36a901['id'],_0x36a901);SmsQueueEvents[_0x2e46('0x5')](_0x38be7e,_0x36a901);_0x3b3cb6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue[_0x2e46('0x6')](e,emitEvent(event));}}module[_0x2e46('0x7')]=SmsQueueEvents; \ No newline at end of file +var _0x3e29=['../../mysqldb','SmsQueue','save','update','remove','emit','hasOwnProperty','exports','events'];(function(_0x5ce10e,_0x251e46){var _0x3a333e=function(_0x39f4af){while(--_0x39f4af){_0x5ce10e['push'](_0x5ce10e['shift']());}};_0x3a333e(++_0x251e46);}(_0x3e29,0x8f));var _0x93e2=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x3e29[_0xa464c9];return _0x3d73c4;};'use strict';var EventEmitter=require(_0x93e2('0x0'));var SmsQueue=require(_0x93e2('0x1'))['db'][_0x93e2('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x93e2('0x3'),'afterUpdate':_0x93e2('0x4'),'afterDestroy':_0x93e2('0x5')};function emitEvent(_0x35cf5a){return function(_0x3aed2d,_0x38120c,_0x1b1109){SmsQueueEvents[_0x93e2('0x6')](_0x35cf5a+':'+_0x3aed2d['id'],_0x3aed2d);SmsQueueEvents[_0x93e2('0x6')](_0x35cf5a,_0x3aed2d);_0x1b1109(null);};}for(var e in events){if(events[_0x93e2('0x7')](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0x93e2('0x8')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 4139fc6..a39b908 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 _0x2217=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','sms_queues'];(function(_0x30bd4d,_0x50eb60){var _0x306915=function(_0x5ae782){while(--_0x5ae782){_0x30bd4d['push'](_0x30bd4d['shift']());}};_0x306915(++_0x50eb60);}(_0x2217,0x1d6));var _0x7221=function(_0x5f4557,_0x2a44a7){_0x5f4557=_0x5f4557-0x0;var _0x2a2a05=_0x2217[_0x5f4557];return _0x2a2a05;};'use strict';var _=require(_0x7221('0x0'));var util=require('util');var logger=require(_0x7221('0x1'))(_0x7221('0x2'));var moment=require(_0x7221('0x3'));var BPromise=require(_0x7221('0x4'));var rp=require(_0x7221('0x5'));var fs=require('fs');var path=require(_0x7221('0x6'));var rimraf=require(_0x7221('0x7'));var config=require('../../config/environment');var attributes=require('./smsQueue.attributes');module[_0x7221('0x8')]=function(_0x300e0f,_0x150ae2){return _0x300e0f['define']('SmsQueue',attributes,{'tableName':_0x7221('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x692d=['exports','define','SmsQueue','sms_queues','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueue.attributes'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x692d,0x100));var _0xd692=function(_0x5f0c71,_0x411d03){_0x5f0c71=_0x5f0c71-0x0;var _0x2e0100=_0x692d[_0x5f0c71];return _0x2e0100;};'use strict';var _=require(_0xd692('0x0'));var util=require(_0xd692('0x1'));var logger=require(_0xd692('0x2'))('api');var moment=require(_0xd692('0x3'));var BPromise=require(_0xd692('0x4'));var rp=require(_0xd692('0x5'));var fs=require('fs');var path=require(_0xd692('0x6'));var rimraf=require(_0xd692('0x7'));var config=require(_0xd692('0x8'));var attributes=require(_0xd692('0x9'));module[_0xd692('0xa')]=function(_0x15ff55,_0x4d1ce9){return _0x15ff55[_0xd692('0xb')](_0xd692('0xc'),attributes,{'tableName':_0xd692('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.rpc.js b/server/api/smsQueue/smsQueue.rpc.js index 165e83a..f3c2935 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 _0x9fcf=['model','catch','ShowSmsQueue','stringify','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','register','info','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','error','code','SmsQueue,\x20%s,\x20%s','message','result','GetSmsQueue','findAll','options','raw','where','attributes','limit','include','map'];(function(_0x154940,_0x4a448a){var _0x401409=function(_0x45cdcf){while(--_0x45cdcf){_0x154940['push'](_0x154940['shift']());}};_0x401409(++_0x4a448a);}(_0x9fcf,0x19b));var _0xf9fc=function(_0x9dfc10,_0x19c2d5){_0x9dfc10=_0x9dfc10-0x0;var _0x4f938a=_0x9fcf[_0x9dfc10];return _0x4f938a;};'use strict';var _=require(_0xf9fc('0x0'));var util=require(_0xf9fc('0x1'));var moment=require('moment');var BPromise=require(_0xf9fc('0x2'));var rs=require(_0xf9fc('0x3'));var fs=require('fs');var Redis=require(_0xf9fc('0x4'));var db=require(_0xf9fc('0x5'))['db'];var utils=require(_0xf9fc('0x6'));var logger=require(_0xf9fc('0x7'))(_0xf9fc('0x8'));var config=require('../../config/environment');var jayson=require(_0xf9fc('0x9'));var client=jayson[_0xf9fc('0xa')][_0xf9fc('0xb')]({'port':0x232a});config[_0xf9fc('0xc')]=_['defaults'](config['redis'],{'host':_0xf9fc('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf9fc('0xc')]));require('./smsQueue.socket')[_0xf9fc('0xe')](socket);function respondWithRpcPromise(_0x458339,_0x430590,_0x3b97df){return new BPromise(function(_0x1c61c9,_0x2644e8){return client['request'](_0x458339,_0x3b97df)['then'](function(_0x17baf5){logger[_0xf9fc('0xf')]('SmsQueue,\x20%s,\x20%s',_0x430590,_0xf9fc('0x10'));logger[_0xf9fc('0x11')](_0xf9fc('0x12'),_0x430590,'request\x20sent',JSON['stringify'](_0x17baf5));if(_0x17baf5[_0xf9fc('0x13')]){if(_0x17baf5['error'][_0xf9fc('0x14')]===0x1f4){logger[_0xf9fc('0x13')](_0xf9fc('0x15'),_0x430590,_0x17baf5['error'][_0xf9fc('0x16')]);return _0x2644e8(_0x17baf5[_0xf9fc('0x13')][_0xf9fc('0x16')]);}logger[_0xf9fc('0x13')](_0xf9fc('0x15'),_0x430590,_0x17baf5[_0xf9fc('0x13')][_0xf9fc('0x16')]);return _0x1c61c9(_0x17baf5[_0xf9fc('0x13')]['message']);}else{logger[_0xf9fc('0xf')]('SmsQueue,\x20%s,\x20%s',_0x430590,_0xf9fc('0x10'));_0x1c61c9(_0x17baf5[_0xf9fc('0x17')][_0xf9fc('0x16')]);}})['catch'](function(_0x4ef70b){logger[_0xf9fc('0x13')]('SmsQueue,\x20%s,\x20%s',_0x430590,_0x4ef70b);_0x2644e8(_0x4ef70b);});});}exports[_0xf9fc('0x18')]=function(_0x5f47cb){var _0x20ab13=this;return new Promise(function(_0x5e1f69,_0x3fb628){return db['SmsQueue'][_0xf9fc('0x19')]({'raw':_0x5f47cb[_0xf9fc('0x1a')]?_0x5f47cb[_0xf9fc('0x1a')][_0xf9fc('0x1b')]===undefined?!![]:![]:!![],'where':_0x5f47cb[_0xf9fc('0x1a')]?_0x5f47cb[_0xf9fc('0x1a')][_0xf9fc('0x1c')]||null:null,'attributes':_0x5f47cb['options']?_0x5f47cb[_0xf9fc('0x1a')][_0xf9fc('0x1d')]||null:null,'limit':_0x5f47cb[_0xf9fc('0x1a')]?_0x5f47cb[_0xf9fc('0x1a')][_0xf9fc('0x1e')]||null:null,'include':_0x5f47cb[_0xf9fc('0x1a')]?_0x5f47cb[_0xf9fc('0x1a')][_0xf9fc('0x1f')]?_[_0xf9fc('0x20')](_0x5f47cb[_0xf9fc('0x1a')][_0xf9fc('0x1f')],function(_0x9e01){return{'model':db[_0x9e01['model']],'as':_0x9e01['as'],'attributes':_0x9e01[_0xf9fc('0x1d')],'include':_0x9e01[_0xf9fc('0x1f')]?_[_0xf9fc('0x20')](_0x9e01[_0xf9fc('0x1f')],function(_0x1be35a){return{'model':db[_0x1be35a[_0xf9fc('0x21')]],'as':_0x1be35a['as'],'attributes':_0x1be35a[_0xf9fc('0x1d')],'include':_0x1be35a[_0xf9fc('0x1f')]?_['map'](_0x1be35a[_0xf9fc('0x1f')],function(_0xfe8839){return{'model':db[_0xfe8839['model']],'as':_0xfe8839['as'],'attributes':_0xfe8839[_0xf9fc('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x432a12){logger[_0xf9fc('0xf')](_0xf9fc('0x18'),_0x5f47cb);logger[_0xf9fc('0x11')](_0xf9fc('0x18'),_0x5f47cb,JSON['stringify'](_0x432a12));_0x5e1f69(_0x432a12);})[_0xf9fc('0x22')](function(_0x20b584){logger['error'](_0xf9fc('0x18'),_0x20b584[_0xf9fc('0x16')],_0x5f47cb);_0x3fb628(_0x20ab13[_0xf9fc('0x13')](0x1f4,_0x20b584[_0xf9fc('0x16')]));});});};exports[_0xf9fc('0x23')]=function(_0x3cbfb7){var _0x3dc95e=this;return new Promise(function(_0x43455b,_0x18f3ea){return db['SmsQueue']['find']({'raw':_0x3cbfb7[_0xf9fc('0x1a')]?_0x3cbfb7[_0xf9fc('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x3cbfb7[_0xf9fc('0x1a')]?_0x3cbfb7[_0xf9fc('0x1a')][_0xf9fc('0x1c')]||null:null,'attributes':_0x3cbfb7[_0xf9fc('0x1a')]?_0x3cbfb7['options'][_0xf9fc('0x1d')]||null:null,'include':_0x3cbfb7[_0xf9fc('0x1a')]?_0x3cbfb7['options'][_0xf9fc('0x1f')]?_[_0xf9fc('0x20')](_0x3cbfb7['options']['include'],function(_0x296cfa){return{'model':db[_0x296cfa['model']],'as':_0x296cfa['as'],'attributes':_0x296cfa['attributes'],'include':_0x296cfa['include']?_['map'](_0x296cfa[_0xf9fc('0x1f')],function(_0x5eef30){return{'model':db[_0x5eef30['model']],'as':_0x5eef30['as'],'attributes':_0x5eef30[_0xf9fc('0x1d')],'include':_0x5eef30['include']?_['map'](_0x5eef30[_0xf9fc('0x1f')],function(_0x567e8c){return{'model':db[_0x567e8c[_0xf9fc('0x21')]],'as':_0x567e8c['as'],'attributes':_0x567e8c[_0xf9fc('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4dbaaf){logger[_0xf9fc('0xf')](_0xf9fc('0x23'),_0x3cbfb7);logger[_0xf9fc('0x11')]('ShowSmsQueue',_0x3cbfb7,JSON[_0xf9fc('0x24')](_0x4dbaaf));_0x43455b(_0x4dbaaf);})[_0xf9fc('0x22')](function(_0x5631a9){logger[_0xf9fc('0x13')](_0xf9fc('0x23'),_0x5631a9['message'],_0x3cbfb7);_0x18f3ea(_0x3dc95e[_0xf9fc('0x13')](0x1f4,_0x5631a9[_0xf9fc('0x16')]));});});}; \ No newline at end of file +var _0x04a1=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetSmsQueue','SmsQueue','options','attributes','limit','include','map','model','find','raw','where','ShowSmsQueue','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0x04a1,0x1c8));var _0x104a=function(_0x5e154e,_0x13ea47){_0x5e154e=_0x5e154e-0x0;var _0x4e5a6a=_0x04a1[_0x5e154e];return _0x4e5a6a;};'use strict';var _=require(_0x104a('0x0'));var util=require('util');var moment=require(_0x104a('0x1'));var BPromise=require(_0x104a('0x2'));var rs=require(_0x104a('0x3'));var fs=require('fs');var Redis=require(_0x104a('0x4'));var db=require(_0x104a('0x5'))['db'];var utils=require(_0x104a('0x6'));var logger=require(_0x104a('0x7'))(_0x104a('0x8'));var config=require(_0x104a('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x104a('0xa')][_0x104a('0xb')]({'port':0x232a});config[_0x104a('0xc')]=_[_0x104a('0xd')](config[_0x104a('0xc')],{'host':_0x104a('0xe'),'port':0x18eb});var socket=require(_0x104a('0xf'))(new Redis(config[_0x104a('0xc')]));require(_0x104a('0x10'))[_0x104a('0x11')](socket);function respondWithRpcPromise(_0x3713e1,_0x20d391,_0x5d9e73){return new BPromise(function(_0x174712,_0x3ff459){return client[_0x104a('0x12')](_0x3713e1,_0x5d9e73)[_0x104a('0x13')](function(_0x58fd08){logger[_0x104a('0x14')](_0x104a('0x15'),_0x20d391,_0x104a('0x16'));logger[_0x104a('0x17')](_0x104a('0x18'),_0x20d391,_0x104a('0x16'),JSON[_0x104a('0x19')](_0x58fd08));if(_0x58fd08[_0x104a('0x1a')]){if(_0x58fd08[_0x104a('0x1a')]['code']===0x1f4){logger[_0x104a('0x1a')]('SmsQueue,\x20%s,\x20%s',_0x20d391,_0x58fd08[_0x104a('0x1a')][_0x104a('0x1b')]);return _0x3ff459(_0x58fd08[_0x104a('0x1a')]['message']);}logger[_0x104a('0x1a')](_0x104a('0x15'),_0x20d391,_0x58fd08['error']['message']);return _0x174712(_0x58fd08['error'][_0x104a('0x1b')]);}else{logger['info'](_0x104a('0x15'),_0x20d391,'request\x20sent');_0x174712(_0x58fd08[_0x104a('0x1c')][_0x104a('0x1b')]);}})[_0x104a('0x1d')](function(_0x23212c){logger[_0x104a('0x1a')](_0x104a('0x15'),_0x20d391,_0x23212c);_0x3ff459(_0x23212c);});});}exports[_0x104a('0x1e')]=function(_0x3bc7ca){var _0x14af4c=this;return new Promise(function(_0x36478e,_0x4ae6ca){return db[_0x104a('0x1f')]['findAll']({'raw':_0x3bc7ca[_0x104a('0x20')]?_0x3bc7ca['options']['raw']===undefined?!![]:![]:!![],'where':_0x3bc7ca['options']?_0x3bc7ca[_0x104a('0x20')]['where']||null:null,'attributes':_0x3bc7ca[_0x104a('0x20')]?_0x3bc7ca[_0x104a('0x20')][_0x104a('0x21')]||null:null,'limit':_0x3bc7ca[_0x104a('0x20')]?_0x3bc7ca['options'][_0x104a('0x22')]||null:null,'include':_0x3bc7ca[_0x104a('0x20')]?_0x3bc7ca[_0x104a('0x20')][_0x104a('0x23')]?_[_0x104a('0x24')](_0x3bc7ca[_0x104a('0x20')][_0x104a('0x23')],function(_0x384164){return{'model':db[_0x384164['model']],'as':_0x384164['as'],'attributes':_0x384164['attributes'],'include':_0x384164[_0x104a('0x23')]?_[_0x104a('0x24')](_0x384164[_0x104a('0x23')],function(_0x7538d1){return{'model':db[_0x7538d1['model']],'as':_0x7538d1['as'],'attributes':_0x7538d1[_0x104a('0x21')],'include':_0x7538d1[_0x104a('0x23')]?_[_0x104a('0x24')](_0x7538d1[_0x104a('0x23')],function(_0x2d5399){return{'model':db[_0x2d5399[_0x104a('0x25')]],'as':_0x2d5399['as'],'attributes':_0x2d5399[_0x104a('0x21')]};}):[]};}):[]};}):[]:[]})[_0x104a('0x13')](function(_0x2a80b2){logger[_0x104a('0x14')](_0x104a('0x1e'),_0x3bc7ca);logger[_0x104a('0x17')](_0x104a('0x1e'),_0x3bc7ca,JSON[_0x104a('0x19')](_0x2a80b2));_0x36478e(_0x2a80b2);})[_0x104a('0x1d')](function(_0x4374ea){logger[_0x104a('0x1a')](_0x104a('0x1e'),_0x4374ea[_0x104a('0x1b')],_0x3bc7ca);_0x4ae6ca(_0x14af4c[_0x104a('0x1a')](0x1f4,_0x4374ea[_0x104a('0x1b')]));});});};exports['ShowSmsQueue']=function(_0x109a7b){var _0x111f80=this;return new Promise(function(_0xe9354f,_0x2724fb){return db[_0x104a('0x1f')][_0x104a('0x26')]({'raw':_0x109a7b[_0x104a('0x20')]?_0x109a7b[_0x104a('0x20')][_0x104a('0x27')]===undefined?!![]:![]:!![],'where':_0x109a7b[_0x104a('0x20')]?_0x109a7b[_0x104a('0x20')][_0x104a('0x28')]||null:null,'attributes':_0x109a7b[_0x104a('0x20')]?_0x109a7b[_0x104a('0x20')][_0x104a('0x21')]||null:null,'include':_0x109a7b[_0x104a('0x20')]?_0x109a7b['options'][_0x104a('0x23')]?_['map'](_0x109a7b[_0x104a('0x20')][_0x104a('0x23')],function(_0x49bb36){return{'model':db[_0x49bb36[_0x104a('0x25')]],'as':_0x49bb36['as'],'attributes':_0x49bb36[_0x104a('0x21')],'include':_0x49bb36[_0x104a('0x23')]?_[_0x104a('0x24')](_0x49bb36[_0x104a('0x23')],function(_0x33f5f4){return{'model':db[_0x33f5f4[_0x104a('0x25')]],'as':_0x33f5f4['as'],'attributes':_0x33f5f4[_0x104a('0x21')],'include':_0x33f5f4[_0x104a('0x23')]?_[_0x104a('0x24')](_0x33f5f4[_0x104a('0x23')],function(_0x352feb){return{'model':db[_0x352feb[_0x104a('0x25')]],'as':_0x352feb['as'],'attributes':_0x352feb[_0x104a('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x25665c){logger[_0x104a('0x14')]('ShowSmsQueue',_0x109a7b);logger[_0x104a('0x17')]('ShowSmsQueue',_0x109a7b,JSON[_0x104a('0x19')](_0x25665c));_0xe9354f(_0x25665c);})[_0x104a('0x1d')](function(_0x386a50){logger[_0x104a('0x1a')](_0x104a('0x29'),_0x386a50[_0x104a('0x1b')],_0x109a7b);_0x2724fb(_0x111f80[_0x104a('0x1a')](0x1f4,_0x386a50['message']));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 28a861d..387c53f 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 _0x228a=['remove','emit','removeListener','length','smsQueue:','./smsQueue.events','save'];(function(_0xd8aad0,_0x4da2cd){var _0x570860=function(_0x1acc03){while(--_0x1acc03){_0xd8aad0['push'](_0xd8aad0['shift']());}};_0x570860(++_0x4da2cd);}(_0x228a,0x1b0));var _0xa228=function(_0x2d240e,_0xee105){_0x2d240e=_0x2d240e-0x0;var _0x5aba4e=_0x228a[_0x2d240e];return _0x5aba4e;};'use strict';var SmsQueueEvents=require(_0xa228('0x0'));var events=[_0xa228('0x1'),_0xa228('0x2'),'update'];function createListener(_0x38480e,_0xaad44){return function(_0x391732){_0xaad44[_0xa228('0x3')](_0x38480e,_0x391732);};}function removeListener(_0x1fb2dc,_0x3adcc2){return function(){SmsQueueEvents[_0xa228('0x4')](_0x1fb2dc,_0x3adcc2);};}exports['register']=function(_0x67d12a){for(var _0x2a669a=0x0,_0x38b819=events[_0xa228('0x5')];_0x2a669a<_0x38b819;_0x2a669a++){var _0x13c715=events[_0x2a669a];var _0x1c3a3c=createListener(_0xa228('0x6')+_0x13c715,_0x67d12a);SmsQueueEvents['on'](_0x13c715,_0x1c3a3c);}}; \ No newline at end of file +var _0xf772=['emit','removeListener','length','smsQueue:','./smsQueue.events','remove','update'];(function(_0x3994eb,_0x17c5d1){var _0x4effec=function(_0x107e62){while(--_0x107e62){_0x3994eb['push'](_0x3994eb['shift']());}};_0x4effec(++_0x17c5d1);}(_0xf772,0x185));var _0x2f77=function(_0x1783c3,_0x1bf456){_0x1783c3=_0x1783c3-0x0;var _0x23a146=_0xf772[_0x1783c3];return _0x23a146;};'use strict';var SmsQueueEvents=require(_0x2f77('0x0'));var events=['save',_0x2f77('0x1'),_0x2f77('0x2')];function createListener(_0x2bb299,_0x539a18){return function(_0x6093f4){_0x539a18[_0x2f77('0x3')](_0x2bb299,_0x6093f4);};}function removeListener(_0x40441e,_0x338a70){return function(){SmsQueueEvents[_0x2f77('0x4')](_0x40441e,_0x338a70);};}exports['register']=function(_0x4ea258){for(var _0x2188a9=0x0,_0x7f5f2=events[_0x2f77('0x5')];_0x2188a9<_0x7f5f2;_0x2188a9++){var _0x4aa3df=events[_0x2188a9];var _0x435ca3=createListener(_0x2f77('0x6')+_0x4aa3df,_0x4ea258);SmsQueueEvents['on'](_0x4aa3df,_0x435ca3);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index d5e5b53..c19ff07 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 _0xd837=['fs-extra','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put','/:id','delete','destroy','exports','util','connect-timeout','express'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xd837,0x1a1));var _0x7d83=function(_0x32a767,_0x4e3e76){_0x32a767=_0x32a767-0x0;var _0x2b4e6d=_0xd837[_0x32a767];return _0x2b4e6d;};'use strict';var multer=require('multer');var util=require(_0x7d83('0x0'));var path=require('path');var timeout=require(_0x7d83('0x1'));var express=require(_0x7d83('0x2'));var router=express['Router']();var fs_extra=require(_0x7d83('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x7d83('0x4'));var config=require(_0x7d83('0x5'));var controller=require(_0x7d83('0x6'));router[_0x7d83('0x7')]('/',auth[_0x7d83('0x8')](),controller[_0x7d83('0x9')]);router[_0x7d83('0x7')](_0x7d83('0xa'),auth[_0x7d83('0x8')](),controller[_0x7d83('0xb')]);router['get']('/:id',auth[_0x7d83('0x8')](),controller[_0x7d83('0xc')]);router[_0x7d83('0xd')]('/',auth[_0x7d83('0x8')](),controller[_0x7d83('0xe')]);router[_0x7d83('0xf')](_0x7d83('0x10'),auth[_0x7d83('0x8')](),controller['update']);router[_0x7d83('0x11')](_0x7d83('0x10'),auth[_0x7d83('0x8')](),controller[_0x7d83('0x12')]);module[_0x7d83('0x13')]=router; \ No newline at end of file +var _0x75d2=['/:id','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./smsQueueReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x1f7201,_0x141b79){var _0x289fd2=function(_0x20ce23){while(--_0x20ce23){_0x1f7201['push'](_0x1f7201['shift']());}};_0x289fd2(++_0x141b79);}(_0x75d2,0x152));var _0x275d=function(_0x22377a,_0x3397cb){_0x22377a=_0x22377a-0x0;var _0x36f105=_0x75d2[_0x22377a];return _0x36f105;};'use strict';var multer=require(_0x275d('0x0'));var util=require(_0x275d('0x1'));var path=require(_0x275d('0x2'));var timeout=require(_0x275d('0x3'));var express=require(_0x275d('0x4'));var router=express[_0x275d('0x5')]();var fs_extra=require(_0x275d('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x275d('0x7'));var config=require('../../config/environment');var controller=require(_0x275d('0x8'));router[_0x275d('0x9')]('/',auth[_0x275d('0xa')](),controller[_0x275d('0xb')]);router[_0x275d('0x9')](_0x275d('0xc'),auth['isAuthenticated'](),controller[_0x275d('0xd')]);router[_0x275d('0x9')](_0x275d('0xe'),auth[_0x275d('0xa')](),controller['show']);router[_0x275d('0xf')]('/',auth[_0x275d('0xa')](),controller[_0x275d('0x10')]);router[_0x275d('0x11')](_0x275d('0xe'),auth[_0x275d('0xa')](),controller[_0x275d('0x12')]);router[_0x275d('0x13')](_0x275d('0xe'),auth[_0x275d('0xa')](),controller[_0x275d('0x14')]);module[_0x275d('0x15')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 65dd577..4d46bef 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 _0xe715=['exports','STRING','DATE','moment'];(function(_0x332b3c,_0x3d89f2){var _0x406a5c=function(_0x45ccbf){while(--_0x45ccbf){_0x332b3c['push'](_0x332b3c['shift']());}};_0x406a5c(++_0x3d89f2);}(_0xe715,0x153));var _0x5e71=function(_0x544cf8,_0x4b8cd0){_0x544cf8=_0x544cf8-0x0;var _0x9c3066=_0xe715[_0x544cf8];return _0x9c3066;};'use strict';var moment=require(_0x5e71('0x0'));var Sequelize=require('sequelize');module[_0x5e71('0x1')]={'uniqueid':{'type':Sequelize[_0x5e71('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x5e71('0x2')]},'joinAt':{'type':Sequelize[_0x5e71('0x3')]},'leaveAt':{'type':Sequelize[_0x5e71('0x3')]},'acceptAt':{'type':Sequelize[_0x5e71('0x3')]},'exitAt':{'type':Sequelize[_0x5e71('0x3')]},'reason':{'type':Sequelize[_0x5e71('0x2')]}}; \ No newline at end of file +var _0x74ce=['exports','DATE','STRING','moment','sequelize'];(function(_0x114b20,_0x55cedd){var _0x3d1edf=function(_0x5d2bd1){while(--_0x5d2bd1){_0x114b20['push'](_0x114b20['shift']());}};_0x3d1edf(++_0x55cedd);}(_0x74ce,0x18e));var _0xe74c=function(_0x354ff0,_0x2f880e){_0x354ff0=_0x354ff0-0x0;var _0xcf1f95=_0x74ce[_0x354ff0];return _0xcf1f95;};'use strict';var moment=require(_0xe74c('0x0'));var Sequelize=require(_0xe74c('0x1'));module[_0xe74c('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xe74c('0x3')]},'leaveAt':{'type':Sequelize[_0xe74c('0x3')]},'acceptAt':{'type':Sequelize[_0xe74c('0x3')]},'exitAt':{'type':Sequelize[_0xe74c('0x3')]},'reason':{'type':Sequelize[_0xe74c('0x4')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 341e03a..28ead5d 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 _0x627f=['body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','name','send','index','SmsQueueReport','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','pick','merge','map','filter','options','include','rows','catch','params','includeAll','find','create'];(function(_0x3204fc,_0x2d74a4){var _0x2c9784=function(_0x1847b6){while(--_0x1847b6){_0x3204fc['push'](_0x3204fc['shift']());}};_0x2c9784(++_0x2d74a4);}(_0x627f,0x1c4));var _0xf627=function(_0x5a3fb6,_0x3e584c){_0x5a3fb6=_0x5a3fb6-0x0;var _0x48735d=_0x627f[_0x5a3fb6];return _0x48735d;};'use strict';var emlformat=require(_0xf627('0x0'));var rimraf=require(_0xf627('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf627('0x2'));var rp=require(_0xf627('0x3'));var moment=require(_0xf627('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf627('0x5'));var util=require('util');var path=require(_0xf627('0x6'));var sox=require(_0xf627('0x7'));var csv=require(_0xf627('0x8'));var ejs=require(_0xf627('0x9'));var fs=require('fs');var fs_extra=require(_0xf627('0xa'));var _=require(_0xf627('0xb'));var squel=require(_0xf627('0xc'));var crypto=require(_0xf627('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xf627('0xe'));var toCsv=require(_0xf627('0x8'));var querystring=require('querystring');var Papa=require(_0xf627('0xf'));var Redis=require(_0xf627('0x10'));var authService=require(_0xf627('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xf627('0x12'));var hardwareService=require(_0xf627('0x13'));var logger=require(_0xf627('0x14'))(_0xf627('0x15'));var utils=require(_0xf627('0x16'));var config=require(_0xf627('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xf627('0x18'))['db'];function respondWithStatusCode(_0x523f00,_0x17800f){_0x17800f=_0x17800f||0xcc;return function(_0x33752d){if(_0x33752d){return _0x523f00[_0xf627('0x19')](_0x17800f);}return _0x523f00[_0xf627('0x1a')](_0x17800f)[_0xf627('0x1b')]();};}function respondWithResult(_0x13f6b1,_0x4f8a59){_0x4f8a59=_0x4f8a59||0xc8;return function(_0x19e2c6){if(_0x19e2c6){return _0x13f6b1[_0xf627('0x1a')](_0x4f8a59)[_0xf627('0x1c')](_0x19e2c6);}};}function respondWithFilteredResult(_0x397ec3,_0x5a037f){return function(_0x5ed01b){if(_0x5ed01b){var _0x372db5=typeof _0x5a037f[_0xf627('0x1d')]===_0xf627('0x1e')&&typeof _0x5a037f[_0xf627('0x1f')]===_0xf627('0x1e');var _0xcfe843=_0x5ed01b[_0xf627('0x20')];var _0x19ebd8=_0x372db5?0x0:_0x5a037f[_0xf627('0x1d')];var _0x5bcc2a=_0x372db5?_0x5ed01b['count']:_0x5a037f[_0xf627('0x1d')]+_0x5a037f['limit'];var _0xf49fa0;if(_0x5bcc2a>=_0xcfe843){_0x5bcc2a=_0xcfe843;_0xf49fa0=0xc8;}else{_0xf49fa0=0xce;}_0x397ec3[_0xf627('0x1a')](_0xf49fa0);return _0x397ec3[_0xf627('0x21')](_0xf627('0x22'),_0x19ebd8+'-'+_0x5bcc2a+'/'+_0xcfe843)[_0xf627('0x1c')](_0x5ed01b);}return null;};}function patchUpdates(_0x509f30){return function(_0x33f301){try{jsonpatch[_0xf627('0x23')](_0x33f301,_0x509f30,!![]);}catch(_0xd8d056){return BPromise[_0xf627('0x24')](_0xd8d056);}return _0x33f301['save']();};}function saveUpdates(_0x2c5494,_0x40a531){return function(_0x1aa2a6){if(_0x1aa2a6){return _0x1aa2a6[_0xf627('0x25')](_0x2c5494)[_0xf627('0x26')](function(_0x572e75){return _0x572e75;});}return null;};}function removeEntity(_0x35af0b,_0x3e6840){return function(_0x429183){if(_0x429183){return _0x429183[_0xf627('0x27')]()['then'](function(){_0x35af0b[_0xf627('0x1a')](0xcc)[_0xf627('0x1b')]();});}};}function handleEntityNotFound(_0x35adbb,_0x3031ea){return function(_0x5511d0){if(!_0x5511d0){_0x35adbb[_0xf627('0x19')](0x194);}return _0x5511d0;};}function handleError(_0x2b9353,_0x55ad61){_0x55ad61=_0x55ad61||0x1f4;return function(_0x2e1d6b){logger[_0xf627('0x28')](_0x2e1d6b['stack']);if(_0x2e1d6b[_0xf627('0x29')]){delete _0x2e1d6b[_0xf627('0x29')];}_0x2b9353['status'](_0x55ad61)[_0xf627('0x2a')](_0x2e1d6b);};}exports[_0xf627('0x2b')]=function(_0x45dcdc,_0x4c9246){var _0x2204c3={},_0x5e2bc6={},_0x51077e={'count':0x0,'rows':[]};var _0x13b08e=_['map'](db[_0xf627('0x2c')][_0xf627('0x2d')],function(_0x45348d){return{'name':_0x45348d[_0xf627('0x2e')],'type':_0x45348d[_0xf627('0x2f')][_0xf627('0x30')]};});_0x5e2bc6[_0xf627('0x31')]=_['map'](_0x13b08e,_0xf627('0x29'));_0x5e2bc6[_0xf627('0x32')]=_[_0xf627('0x33')](_0x45dcdc[_0xf627('0x32')]);_0x5e2bc6['filters']=_['intersection'](_0x5e2bc6[_0xf627('0x31')],_0x5e2bc6[_0xf627('0x32')]);_0x2204c3[_0xf627('0x34')]=_[_0xf627('0x35')](_0x5e2bc6[_0xf627('0x31')],qs[_0xf627('0x36')](_0x45dcdc[_0xf627('0x32')][_0xf627('0x36')]));_0x2204c3['attributes']=_0x2204c3[_0xf627('0x34')][_0xf627('0x37')]?_0x2204c3[_0xf627('0x34')]:_0x5e2bc6[_0xf627('0x31')];if(!_0x45dcdc[_0xf627('0x32')][_0xf627('0x38')]('nolimit')){_0x2204c3[_0xf627('0x1f')]=qs['limit'](_0x45dcdc['query']['limit']);_0x2204c3[_0xf627('0x1d')]=qs[_0xf627('0x1d')](_0x45dcdc[_0xf627('0x32')][_0xf627('0x1d')]);}_0x2204c3[_0xf627('0x39')]=qs['sort'](_0x45dcdc[_0xf627('0x32')][_0xf627('0x3a')]);_0x2204c3[_0xf627('0x3b')]=qs[_0xf627('0x3c')](_[_0xf627('0x3d')](_0x45dcdc[_0xf627('0x32')],_0x5e2bc6[_0xf627('0x3c')]),_0x13b08e);if(_0x45dcdc[_0xf627('0x32')]['filter']){_0x2204c3['where']=_[_0xf627('0x3e')](_0x2204c3[_0xf627('0x3b')],{'$or':_[_0xf627('0x3f')](_0x13b08e,function(_0x31aa6f){if(_0x31aa6f[_0xf627('0x2f')]!=='VIRTUAL'){var _0x5a5953={};_0x5a5953[_0x31aa6f['name']]={'$like':'%'+_0x45dcdc[_0xf627('0x32')][_0xf627('0x40')]+'%'};return _0x5a5953;}})});}_0x2204c3=_['merge']({},_0x2204c3,_0x45dcdc[_0xf627('0x41')]);var _0x9be629={'where':_0x2204c3[_0xf627('0x3b')]};return db[_0xf627('0x2c')][_0xf627('0x20')](_0x9be629)[_0xf627('0x26')](function(_0x37a000){_0x51077e['count']=_0x37a000;if(_0x45dcdc[_0xf627('0x32')]['includeAll']){_0x2204c3[_0xf627('0x42')]=[{'all':!![]}];}return db[_0xf627('0x2c')]['findAll'](_0x2204c3);})[_0xf627('0x26')](function(_0x5021c6){_0x51077e[_0xf627('0x43')]=_0x5021c6;return _0x51077e;})[_0xf627('0x26')](respondWithFilteredResult(_0x4c9246,_0x2204c3))[_0xf627('0x44')](handleError(_0x4c9246,null));};exports['show']=function(_0x5ea340,_0x213462){var _0xc50379={'raw':!![],'where':{'id':_0x5ea340[_0xf627('0x45')]['id']}},_0x47500d={};_0x47500d[_0xf627('0x31')]=_[_0xf627('0x33')](db[_0xf627('0x2c')][_0xf627('0x2d')]);_0x47500d['query']=_[_0xf627('0x33')](_0x5ea340[_0xf627('0x32')]);_0x47500d[_0xf627('0x3c')]=_['intersection'](_0x47500d['model'],_0x47500d[_0xf627('0x32')]);_0xc50379[_0xf627('0x34')]=_['intersection'](_0x47500d[_0xf627('0x31')],qs[_0xf627('0x36')](_0x5ea340[_0xf627('0x32')]['fields']));_0xc50379[_0xf627('0x34')]=_0xc50379[_0xf627('0x34')][_0xf627('0x37')]?_0xc50379[_0xf627('0x34')]:_0x47500d['model'];if(_0x5ea340['query'][_0xf627('0x46')]){_0xc50379[_0xf627('0x42')]=[{'all':!![]}];}_0xc50379=_[_0xf627('0x3e')]({},_0xc50379,_0x5ea340[_0xf627('0x41')]);return db[_0xf627('0x2c')][_0xf627('0x47')](_0xc50379)[_0xf627('0x26')](handleEntityNotFound(_0x213462,null))[_0xf627('0x26')](respondWithResult(_0x213462,null))['catch'](handleError(_0x213462,null));};exports[_0xf627('0x48')]=function(_0x5c8ef6,_0x285406){return db[_0xf627('0x2c')][_0xf627('0x48')](_0x5c8ef6[_0xf627('0x49')],{})[_0xf627('0x26')](respondWithResult(_0x285406,0xc9))[_0xf627('0x44')](handleError(_0x285406,null));};exports['update']=function(_0x537169,_0x3b2e8b){if(_0x537169['body']['id']){delete _0x537169[_0xf627('0x49')]['id'];}return db[_0xf627('0x2c')]['find']({'where':{'id':_0x537169['params']['id']}})[_0xf627('0x26')](handleEntityNotFound(_0x3b2e8b,null))[_0xf627('0x26')](saveUpdates(_0x537169[_0xf627('0x49')],null))[_0xf627('0x26')](respondWithResult(_0x3b2e8b,null))[_0xf627('0x44')](handleError(_0x3b2e8b,null));};exports['destroy']=function(_0x800b02,_0x1604f9){return db['SmsQueueReport'][_0xf627('0x47')]({'where':{'id':_0x800b02[_0xf627('0x45')]['id']}})[_0xf627('0x26')](handleEntityNotFound(_0x1604f9,null))['then'](removeEntity(_0x1604f9,null))[_0xf627('0x44')](handleError(_0x1604f9,null));};exports[_0xf627('0x4a')]=function(_0x44e9b6,_0x2c479e){return db['SmsQueueReport'][_0xf627('0x4a')]()[_0xf627('0x26')](respondWithResult(_0x2c479e,null))[_0xf627('0x44')](handleError(_0x2c479e,null));}; \ No newline at end of file +var _0x7a6f=['options','includeAll','include','findAll','rows','show','params','find','catch','create','body','describe','eml-format','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','SmsQueueReport','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter'];(function(_0x5e312c,_0x327669){var _0x296d81=function(_0x4a5882){while(--_0x4a5882){_0x5e312c['push'](_0x5e312c['shift']());}};_0x296d81(++_0x327669);}(_0x7a6f,0x148));var _0xf7a6=function(_0x3cc039,_0x1ea503){_0x3cc039=_0x3cc039-0x0;var _0x5e374f=_0x7a6f[_0x3cc039];return _0x5e374f;};'use strict';var emlformat=require(_0xf7a6('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf7a6('0x1'));var rp=require(_0xf7a6('0x2'));var moment=require(_0xf7a6('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xf7a6('0x4'));var util=require(_0xf7a6('0x5'));var path=require(_0xf7a6('0x6'));var sox=require(_0xf7a6('0x7'));var csv=require(_0xf7a6('0x8'));var ejs=require(_0xf7a6('0x9'));var fs=require('fs');var fs_extra=require(_0xf7a6('0xa'));var _=require(_0xf7a6('0xb'));var squel=require(_0xf7a6('0xc'));var crypto=require(_0xf7a6('0xd'));var jsforce=require(_0xf7a6('0xe'));var deskjs=require(_0xf7a6('0xf'));var toCsv=require(_0xf7a6('0x8'));var querystring=require(_0xf7a6('0x10'));var Papa=require(_0xf7a6('0x11'));var Redis=require(_0xf7a6('0x12'));var authService=require(_0xf7a6('0x13'));var qs=require(_0xf7a6('0x14'));var as=require(_0xf7a6('0x15'));var hardwareService=require(_0xf7a6('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0xf7a6('0x17'));var config=require(_0xf7a6('0x18'));var licenseUtil=require(_0xf7a6('0x19'));var db=require(_0xf7a6('0x1a'))['db'];function respondWithStatusCode(_0x42c144,_0x5c81f9){_0x5c81f9=_0x5c81f9||0xcc;return function(_0x5b10f0){if(_0x5b10f0){return _0x42c144[_0xf7a6('0x1b')](_0x5c81f9);}return _0x42c144[_0xf7a6('0x1c')](_0x5c81f9)[_0xf7a6('0x1d')]();};}function respondWithResult(_0x15008b,_0xb90f4a){_0xb90f4a=_0xb90f4a||0xc8;return function(_0x3411f5){if(_0x3411f5){return _0x15008b[_0xf7a6('0x1c')](_0xb90f4a)[_0xf7a6('0x1e')](_0x3411f5);}};}function respondWithFilteredResult(_0x4e3458,_0x5b07c2){return function(_0x354a2a){if(_0x354a2a){var _0x1cb0d3=typeof _0x5b07c2[_0xf7a6('0x1f')]===_0xf7a6('0x20')&&typeof _0x5b07c2[_0xf7a6('0x21')]===_0xf7a6('0x20');var _0x48b0b3=_0x354a2a[_0xf7a6('0x22')];var _0x163b23=_0x1cb0d3?0x0:_0x5b07c2['offset'];var _0x58836d=_0x1cb0d3?_0x354a2a['count']:_0x5b07c2[_0xf7a6('0x1f')]+_0x5b07c2[_0xf7a6('0x21')];var _0x47609c;if(_0x58836d>=_0x48b0b3){_0x58836d=_0x48b0b3;_0x47609c=0xc8;}else{_0x47609c=0xce;}_0x4e3458[_0xf7a6('0x1c')](_0x47609c);return _0x4e3458['set']('Content-Range',_0x163b23+'-'+_0x58836d+'/'+_0x48b0b3)['json'](_0x354a2a);}return null;};}function patchUpdates(_0x336beb){return function(_0x12ece2){try{jsonpatch[_0xf7a6('0x23')](_0x12ece2,_0x336beb,!![]);}catch(_0x55a675){return BPromise[_0xf7a6('0x24')](_0x55a675);}return _0x12ece2[_0xf7a6('0x25')]();};}function saveUpdates(_0xb5cd51,_0x178768){return function(_0x1d4ef6){if(_0x1d4ef6){return _0x1d4ef6[_0xf7a6('0x26')](_0xb5cd51)[_0xf7a6('0x27')](function(_0x8692cb){return _0x8692cb;});}return null;};}function removeEntity(_0x121cbe,_0x35cea4){return function(_0x385732){if(_0x385732){return _0x385732[_0xf7a6('0x28')]()[_0xf7a6('0x27')](function(){_0x121cbe[_0xf7a6('0x1c')](0xcc)[_0xf7a6('0x1d')]();});}};}function handleEntityNotFound(_0x2cc975,_0x521d96){return function(_0x109825){if(!_0x109825){_0x2cc975[_0xf7a6('0x1b')](0x194);}return _0x109825;};}function handleError(_0x300c50,_0x3cf1d7){_0x3cf1d7=_0x3cf1d7||0x1f4;return function(_0x17affd){logger[_0xf7a6('0x29')](_0x17affd[_0xf7a6('0x2a')]);if(_0x17affd[_0xf7a6('0x2b')]){delete _0x17affd[_0xf7a6('0x2b')];}_0x300c50[_0xf7a6('0x1c')](_0x3cf1d7)[_0xf7a6('0x2c')](_0x17affd);};}exports[_0xf7a6('0x2d')]=function(_0x38be45,_0xc4db3d){var _0x4a06c2={},_0x3e8d36={},_0x158a88={'count':0x0,'rows':[]};var _0x569ddc=_[_0xf7a6('0x2e')](db[_0xf7a6('0x2f')]['rawAttributes'],function(_0x49d9b2){return{'name':_0x49d9b2['fieldName'],'type':_0x49d9b2['type'][_0xf7a6('0x30')]};});_0x3e8d36[_0xf7a6('0x31')]=_[_0xf7a6('0x2e')](_0x569ddc,_0xf7a6('0x2b'));_0x3e8d36[_0xf7a6('0x32')]=_[_0xf7a6('0x33')](_0x38be45['query']);_0x3e8d36[_0xf7a6('0x34')]=_[_0xf7a6('0x35')](_0x3e8d36['model'],_0x3e8d36[_0xf7a6('0x32')]);_0x4a06c2[_0xf7a6('0x36')]=_[_0xf7a6('0x35')](_0x3e8d36[_0xf7a6('0x31')],qs['fields'](_0x38be45[_0xf7a6('0x32')][_0xf7a6('0x37')]));_0x4a06c2[_0xf7a6('0x36')]=_0x4a06c2[_0xf7a6('0x36')][_0xf7a6('0x38')]?_0x4a06c2[_0xf7a6('0x36')]:_0x3e8d36['model'];if(!_0x38be45[_0xf7a6('0x32')][_0xf7a6('0x39')](_0xf7a6('0x3a'))){_0x4a06c2['limit']=qs[_0xf7a6('0x21')](_0x38be45[_0xf7a6('0x32')][_0xf7a6('0x21')]);_0x4a06c2[_0xf7a6('0x1f')]=qs[_0xf7a6('0x1f')](_0x38be45[_0xf7a6('0x32')]['offset']);}_0x4a06c2[_0xf7a6('0x3b')]=qs[_0xf7a6('0x3c')](_0x38be45['query'][_0xf7a6('0x3c')]);_0x4a06c2[_0xf7a6('0x3d')]=qs[_0xf7a6('0x34')](_[_0xf7a6('0x3e')](_0x38be45[_0xf7a6('0x32')],_0x3e8d36[_0xf7a6('0x34')]),_0x569ddc);if(_0x38be45['query']['filter']){_0x4a06c2['where']=_[_0xf7a6('0x3f')](_0x4a06c2[_0xf7a6('0x3d')],{'$or':_['map'](_0x569ddc,function(_0x7dfab8){if(_0x7dfab8[_0xf7a6('0x40')]!==_0xf7a6('0x41')){var _0x21ff12={};_0x21ff12[_0x7dfab8[_0xf7a6('0x2b')]]={'$like':'%'+_0x38be45[_0xf7a6('0x32')][_0xf7a6('0x42')]+'%'};return _0x21ff12;}})});}_0x4a06c2=_[_0xf7a6('0x3f')]({},_0x4a06c2,_0x38be45[_0xf7a6('0x43')]);var _0x1ddd14={'where':_0x4a06c2[_0xf7a6('0x3d')]};return db[_0xf7a6('0x2f')][_0xf7a6('0x22')](_0x1ddd14)[_0xf7a6('0x27')](function(_0x337af5){_0x158a88['count']=_0x337af5;if(_0x38be45['query'][_0xf7a6('0x44')]){_0x4a06c2[_0xf7a6('0x45')]=[{'all':!![]}];}return db[_0xf7a6('0x2f')][_0xf7a6('0x46')](_0x4a06c2);})['then'](function(_0x40c38f){_0x158a88[_0xf7a6('0x47')]=_0x40c38f;return _0x158a88;})[_0xf7a6('0x27')](respondWithFilteredResult(_0xc4db3d,_0x4a06c2))['catch'](handleError(_0xc4db3d,null));};exports[_0xf7a6('0x48')]=function(_0x3c03ce,_0x154d20){var _0x3f84e5={'raw':!![],'where':{'id':_0x3c03ce[_0xf7a6('0x49')]['id']}},_0x438d80={};_0x438d80[_0xf7a6('0x31')]=_[_0xf7a6('0x33')](db['SmsQueueReport']['rawAttributes']);_0x438d80[_0xf7a6('0x32')]=_[_0xf7a6('0x33')](_0x3c03ce[_0xf7a6('0x32')]);_0x438d80[_0xf7a6('0x34')]=_[_0xf7a6('0x35')](_0x438d80[_0xf7a6('0x31')],_0x438d80[_0xf7a6('0x32')]);_0x3f84e5[_0xf7a6('0x36')]=_['intersection'](_0x438d80[_0xf7a6('0x31')],qs[_0xf7a6('0x37')](_0x3c03ce[_0xf7a6('0x32')][_0xf7a6('0x37')]));_0x3f84e5['attributes']=_0x3f84e5[_0xf7a6('0x36')][_0xf7a6('0x38')]?_0x3f84e5['attributes']:_0x438d80[_0xf7a6('0x31')];if(_0x3c03ce[_0xf7a6('0x32')][_0xf7a6('0x44')]){_0x3f84e5[_0xf7a6('0x45')]=[{'all':!![]}];}_0x3f84e5=_[_0xf7a6('0x3f')]({},_0x3f84e5,_0x3c03ce[_0xf7a6('0x43')]);return db[_0xf7a6('0x2f')][_0xf7a6('0x4a')](_0x3f84e5)[_0xf7a6('0x27')](handleEntityNotFound(_0x154d20,null))['then'](respondWithResult(_0x154d20,null))[_0xf7a6('0x4b')](handleError(_0x154d20,null));};exports[_0xf7a6('0x4c')]=function(_0x31c0a9,_0x3578b4){return db[_0xf7a6('0x2f')][_0xf7a6('0x4c')](_0x31c0a9['body'],{})['then'](respondWithResult(_0x3578b4,0xc9))[_0xf7a6('0x4b')](handleError(_0x3578b4,null));};exports[_0xf7a6('0x26')]=function(_0x3a4a8d,_0x5519e3){if(_0x3a4a8d[_0xf7a6('0x4d')]['id']){delete _0x3a4a8d['body']['id'];}return db['SmsQueueReport']['find']({'where':{'id':_0x3a4a8d[_0xf7a6('0x49')]['id']}})[_0xf7a6('0x27')](handleEntityNotFound(_0x5519e3,null))[_0xf7a6('0x27')](saveUpdates(_0x3a4a8d[_0xf7a6('0x4d')],null))[_0xf7a6('0x27')](respondWithResult(_0x5519e3,null))[_0xf7a6('0x4b')](handleError(_0x5519e3,null));};exports[_0xf7a6('0x28')]=function(_0x5dfeca,_0x459049){return db[_0xf7a6('0x2f')][_0xf7a6('0x4a')]({'where':{'id':_0x5dfeca[_0xf7a6('0x49')]['id']}})[_0xf7a6('0x27')](handleEntityNotFound(_0x459049,null))[_0xf7a6('0x27')](removeEntity(_0x459049,null))[_0xf7a6('0x4b')](handleError(_0x459049,null));};exports[_0xf7a6('0x4e')]=function(_0x491dfd,_0x4b7e3d){return db[_0xf7a6('0x2f')][_0xf7a6('0x4e')]()['then'](respondWithResult(_0x4b7e3d,null))[_0xf7a6('0x4b')](handleError(_0x4b7e3d,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index eeae4bd..784d33a 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 _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid'];(function(_0x4b7e4d,_0x82d2ab){var _0x38d6af=function(_0x227432){while(--_0x227432){_0x4b7e4d['push'](_0x4b7e4d['shift']());}};_0x38d6af(++_0x82d2ab);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[{'name':_0x3071('0xc'),'fields':[_0x3071('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid'];(function(_0x40822a,_0x582b60){var _0x357420=function(_0x6cee0b){while(--_0x6cee0b){_0x40822a['push'](_0x40822a['shift']());}};_0x357420(++_0x582b60);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[{'name':_0x3071('0xc'),'fields':[_0x3071('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 3434159..8b7b54b 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 _0xe012=['message','result','catch','CreateSmsQueueReport','create','body','options','UpdateSmsQueueReport','SmsQueueReport','update','where','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x379a88,_0x2aee53){var _0x415f48=function(_0x582fd0){while(--_0x582fd0){_0x379a88['push'](_0x379a88['shift']());}};_0x415f48(++_0x2aee53);}(_0xe012,0x78));var _0x2e01=function(_0x453a05,_0x102018){_0x453a05=_0x453a05-0x0;var _0xc42c7d=_0xe012[_0x453a05];return _0xc42c7d;};'use strict';var _=require(_0x2e01('0x0'));var util=require(_0x2e01('0x1'));var moment=require(_0x2e01('0x2'));var BPromise=require(_0x2e01('0x3'));var rs=require(_0x2e01('0x4'));var fs=require('fs');var Redis=require(_0x2e01('0x5'));var db=require(_0x2e01('0x6'))['db'];var utils=require(_0x2e01('0x7'));var logger=require(_0x2e01('0x8'))(_0x2e01('0x9'));var config=require(_0x2e01('0xa'));var jayson=require(_0x2e01('0xb'));var client=jayson[_0x2e01('0xc')][_0x2e01('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x98dd37,_0x354236,_0x248a47){return new BPromise(function(_0x295baa,_0x5453d4){return client[_0x2e01('0xe')](_0x98dd37,_0x248a47)[_0x2e01('0xf')](function(_0x38fd09){logger[_0x2e01('0x10')](_0x2e01('0x11'),_0x354236,_0x2e01('0x12'));logger[_0x2e01('0x13')](_0x2e01('0x14'),_0x354236,'request\x20sent',JSON[_0x2e01('0x15')](_0x38fd09));if(_0x38fd09[_0x2e01('0x16')]){if(_0x38fd09[_0x2e01('0x16')][_0x2e01('0x17')]===0x1f4){logger['error'](_0x2e01('0x11'),_0x354236,_0x38fd09[_0x2e01('0x16')][_0x2e01('0x18')]);return _0x5453d4(_0x38fd09['error'][_0x2e01('0x18')]);}logger[_0x2e01('0x16')](_0x2e01('0x11'),_0x354236,_0x38fd09[_0x2e01('0x16')][_0x2e01('0x18')]);return _0x295baa(_0x38fd09[_0x2e01('0x16')]['message']);}else{logger[_0x2e01('0x10')](_0x2e01('0x11'),_0x354236,_0x2e01('0x12'));_0x295baa(_0x38fd09[_0x2e01('0x19')]['message']);}})[_0x2e01('0x1a')](function(_0x3f0e71){logger[_0x2e01('0x16')]('SmsQueueReport,\x20%s,\x20%s',_0x354236,_0x3f0e71);_0x5453d4(_0x3f0e71);});});}exports[_0x2e01('0x1b')]=function(_0x1cfa9e){var _0x190564=this;return new Promise(function(_0x54b404,_0x362b12){return db['SmsQueueReport'][_0x2e01('0x1c')](_0x1cfa9e[_0x2e01('0x1d')],{'raw':_0x1cfa9e[_0x2e01('0x1e')]?_0x1cfa9e[_0x2e01('0x1e')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x57b558){logger[_0x2e01('0x10')]('CreateSmsQueueReport',_0x1cfa9e);logger[_0x2e01('0x13')](_0x2e01('0x1b'),_0x1cfa9e,JSON[_0x2e01('0x15')](_0x57b558));_0x54b404(_0x57b558);})[_0x2e01('0x1a')](function(_0xa237b7){logger[_0x2e01('0x16')]('CreateSmsQueueReport',_0xa237b7['message'],_0x1cfa9e);_0x362b12(_0x190564[_0x2e01('0x16')](0x1f4,_0xa237b7[_0x2e01('0x18')]));});});};exports[_0x2e01('0x1f')]=function(_0x43f062){var _0x15a560=this;return new Promise(function(_0x4cad74,_0x34bb98){return db[_0x2e01('0x20')][_0x2e01('0x21')](_0x43f062[_0x2e01('0x1d')],{'raw':_0x43f062['options']?_0x43f062[_0x2e01('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x43f062['options']?_0x43f062['options'][_0x2e01('0x22')]||null:null,'attributes':_0x43f062[_0x2e01('0x1e')]?_0x43f062[_0x2e01('0x1e')][_0x2e01('0x23')]||null:null,'limit':_0x43f062[_0x2e01('0x1e')]?_0x43f062[_0x2e01('0x1e')]['limit']||null:null})[_0x2e01('0xf')](function(_0x1dff7b){logger[_0x2e01('0x10')](_0x2e01('0x1f'),_0x43f062);logger['debug'](_0x2e01('0x1f'),_0x43f062,JSON[_0x2e01('0x15')](_0x1dff7b));_0x4cad74(_0x1dff7b);})[_0x2e01('0x1a')](function(_0x19e5d8){logger[_0x2e01('0x16')]('UpdateSmsQueueReport',_0x19e5d8[_0x2e01('0x18')],_0x43f062);_0x34bb98(_0x15a560['error'](0x1f4,_0x19e5d8[_0x2e01('0x18')]));});});}; \ No newline at end of file +var _0x3253=['request','then','info','request\x20sent','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','SmsQueueReport,\x20%s,\x20%s','message','result','catch','create','body','options','CreateSmsQueueReport','UpdateSmsQueueReport','SmsQueueReport','update','where','attributes','limit','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','http'];(function(_0x96f74c,_0xfc30a4){var _0x379222=function(_0x1bbde9){while(--_0x1bbde9){_0x96f74c['push'](_0x96f74c['shift']());}};_0x379222(++_0xfc30a4);}(_0x3253,0xd0));var _0x3325=function(_0x4f4c53,_0x58ba7b){_0x4f4c53=_0x4f4c53-0x0;var _0x568ff1=_0x3253[_0x4f4c53];return _0x568ff1;};'use strict';var _=require(_0x3325('0x0'));var util=require(_0x3325('0x1'));var moment=require(_0x3325('0x2'));var BPromise=require(_0x3325('0x3'));var rs=require(_0x3325('0x4'));var fs=require('fs');var Redis=require(_0x3325('0x5'));var db=require(_0x3325('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3325('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x3325('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x12297b,_0x4259a6,_0x150d8e){return new BPromise(function(_0x2ae325,_0xabc4f0){return client[_0x3325('0x9')](_0x12297b,_0x150d8e)[_0x3325('0xa')](function(_0x402804){logger[_0x3325('0xb')]('SmsQueueReport,\x20%s,\x20%s',_0x4259a6,_0x3325('0xc'));logger['debug'](_0x3325('0xd'),_0x4259a6,_0x3325('0xc'),JSON[_0x3325('0xe')](_0x402804));if(_0x402804['error']){if(_0x402804[_0x3325('0xf')]['code']===0x1f4){logger['error'](_0x3325('0x10'),_0x4259a6,_0x402804['error'][_0x3325('0x11')]);return _0xabc4f0(_0x402804[_0x3325('0xf')][_0x3325('0x11')]);}logger[_0x3325('0xf')](_0x3325('0x10'),_0x4259a6,_0x402804[_0x3325('0xf')]['message']);return _0x2ae325(_0x402804[_0x3325('0xf')][_0x3325('0x11')]);}else{logger[_0x3325('0xb')](_0x3325('0x10'),_0x4259a6,_0x3325('0xc'));_0x2ae325(_0x402804[_0x3325('0x12')][_0x3325('0x11')]);}})[_0x3325('0x13')](function(_0x324aca){logger[_0x3325('0xf')]('SmsQueueReport,\x20%s,\x20%s',_0x4259a6,_0x324aca);_0xabc4f0(_0x324aca);});});}exports['CreateSmsQueueReport']=function(_0x1be3fa){var _0x475ed4=this;return new Promise(function(_0x52597b,_0x2a1b34){return db['SmsQueueReport'][_0x3325('0x14')](_0x1be3fa[_0x3325('0x15')],{'raw':_0x1be3fa[_0x3325('0x16')]?_0x1be3fa[_0x3325('0x16')]['raw']===undefined?!![]:![]:!![]})[_0x3325('0xa')](function(_0x453e04){logger[_0x3325('0xb')]('CreateSmsQueueReport',_0x1be3fa);logger['debug'](_0x3325('0x17'),_0x1be3fa,JSON[_0x3325('0xe')](_0x453e04));_0x52597b(_0x453e04);})['catch'](function(_0x3e78ef){logger[_0x3325('0xf')](_0x3325('0x17'),_0x3e78ef[_0x3325('0x11')],_0x1be3fa);_0x2a1b34(_0x475ed4[_0x3325('0xf')](0x1f4,_0x3e78ef[_0x3325('0x11')]));});});};exports[_0x3325('0x18')]=function(_0x3ba2cf){var _0x1a5b83=this;return new Promise(function(_0x4a01ee,_0x435f6c){return db[_0x3325('0x19')][_0x3325('0x1a')](_0x3ba2cf['body'],{'raw':_0x3ba2cf[_0x3325('0x16')]?_0x3ba2cf[_0x3325('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3ba2cf['options']?_0x3ba2cf[_0x3325('0x16')][_0x3325('0x1b')]||null:null,'attributes':_0x3ba2cf[_0x3325('0x16')]?_0x3ba2cf[_0x3325('0x16')][_0x3325('0x1c')]||null:null,'limit':_0x3ba2cf['options']?_0x3ba2cf[_0x3325('0x16')][_0x3325('0x1d')]||null:null})[_0x3325('0xa')](function(_0x4aeed6){logger[_0x3325('0xb')](_0x3325('0x18'),_0x3ba2cf);logger[_0x3325('0x1e')]('UpdateSmsQueueReport',_0x3ba2cf,JSON[_0x3325('0xe')](_0x4aeed6));_0x4a01ee(_0x4aeed6);})['catch'](function(_0x36fb9f){logger[_0x3325('0xf')](_0x3325('0x18'),_0x36fb9f[_0x3325('0x11')],_0x3ba2cf);_0x435f6c(_0x1a5b83[_0x3325('0xf')](0x1f4,_0x36fb9f[_0x3325('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index e536862..c74d4cb 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 _0xcb66=['../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','/describe','isAuthenticated','describe','/:id','show','post','create','put','destroy','exports','util','path','connect-timeout','express','Router'];(function(_0x12aca6,_0x1cd87b){var _0x2fe931=function(_0x50169a){while(--_0x50169a){_0x12aca6['push'](_0x12aca6['shift']());}};_0x2fe931(++_0x1cd87b);}(_0xcb66,0x19f));var _0x6cb6=function(_0x589aee,_0x140a03){_0x589aee=_0x589aee-0x0;var _0x2f5ed4=_0xcb66[_0x589aee];return _0x2f5ed4;};'use strict';var multer=require('multer');var util=require(_0x6cb6('0x0'));var path=require(_0x6cb6('0x1'));var timeout=require(_0x6cb6('0x2'));var express=require(_0x6cb6('0x3'));var router=express[_0x6cb6('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6cb6('0x5'));var interaction=require(_0x6cb6('0x6'));var config=require(_0x6cb6('0x7'));var controller=require(_0x6cb6('0x8'));router[_0x6cb6('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x6cb6('0x9')](_0x6cb6('0xa'),auth[_0x6cb6('0xb')](),controller[_0x6cb6('0xc')]);router[_0x6cb6('0x9')](_0x6cb6('0xd'),auth[_0x6cb6('0xb')](),controller[_0x6cb6('0xe')]);router[_0x6cb6('0xf')]('/',auth[_0x6cb6('0xb')](),controller[_0x6cb6('0x10')]);router[_0x6cb6('0x11')](_0x6cb6('0xd'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x6cb6('0xb')](),controller[_0x6cb6('0x12')]);module[_0x6cb6('0x13')]=router; \ No newline at end of file +var _0x6b8f=['destroy','exports','util','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./smsTransferReport.controller','get','index','/describe','isAuthenticated','/:id','show','post','create','put'];(function(_0x3f6381,_0x518409){var _0x398bde=function(_0x5591fc){while(--_0x5591fc){_0x3f6381['push'](_0x3f6381['shift']());}};_0x398bde(++_0x518409);}(_0x6b8f,0x1bc));var _0xf6b8=function(_0x3f5e89,_0x207c2e){_0x3f5e89=_0x3f5e89-0x0;var _0x54fe56=_0x6b8f[_0x3f5e89];return _0x54fe56;};'use strict';var multer=require('multer');var util=require(_0xf6b8('0x0'));var path=require('path');var timeout=require(_0xf6b8('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xf6b8('0x2'));var auth=require(_0xf6b8('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xf6b8('0x4'));var controller=require(_0xf6b8('0x5'));router[_0xf6b8('0x6')]('/',auth['isAuthenticated'](),controller[_0xf6b8('0x7')]);router[_0xf6b8('0x6')](_0xf6b8('0x8'),auth[_0xf6b8('0x9')](),controller['describe']);router['get'](_0xf6b8('0xa'),auth['isAuthenticated'](),controller[_0xf6b8('0xb')]);router[_0xf6b8('0xc')]('/',auth[_0xf6b8('0x9')](),controller[_0xf6b8('0xd')]);router[_0xf6b8('0xe')](_0xf6b8('0xa'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xf6b8('0xa'),auth[_0xf6b8('0x9')](),controller[_0xf6b8('0xf')]);module[_0xf6b8('0x10')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index f913a92..7e13407 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 _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x15a0e8,_0x4cee4c){var _0x569013=function(_0x5625b2){while(--_0x5625b2){_0x15a0e8['push'](_0x15a0e8['shift']());}};_0x569013(++_0x4cee4c);}(_0x00bb,0x1d8));var _0xb00b=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0x00bb[_0x28947d];return _0x12d2ee;};'use strict';var moment=require(_0xb00b('0x0'));var Sequelize=require(_0xb00b('0x1'));module[_0xb00b('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb00b('0x3')]('account',_0xb00b('0x4'),_0xb00b('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xb00b('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xb00b('0x7')]}}; \ No newline at end of file +var _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x59c10a,_0x2b617b){var _0xc6934f=function(_0x428e1c){while(--_0x428e1c){_0x59c10a['push'](_0x59c10a['shift']());}};_0xc6934f(++_0x2b617b);}(_0x00bb,0x1d8));var _0xb00b=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x00bb[_0x56482c];return _0x5aae7a;};'use strict';var moment=require(_0xb00b('0x0'));var Sequelize=require(_0xb00b('0x1'));module[_0xb00b('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb00b('0x3')]('account',_0xb00b('0x4'),_0xb00b('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xb00b('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xb00b('0x7')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index bcac80d..a280d11 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 _0xe492=['keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','options','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','params','destroy','describe','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','ejs','fs-extra','lodash','squel','crypto','to-csv','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','count','offset','limit','set','Content-Range','save','update','then','error','stack','name','send','index','map','SmsTransferReport','type','model','query'];(function(_0x237546,_0xa81b26){var _0x233e29=function(_0x728aa4){while(--_0x728aa4){_0x237546['push'](_0x237546['shift']());}};_0x233e29(++_0xa81b26);}(_0xe492,0x173));var _0x2e49=function(_0x145aef,_0x371dd5){_0x145aef=_0x145aef-0x0;var _0x114246=_0xe492[_0x145aef];return _0x114246;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2e49('0x0'));var zipdir=require(_0x2e49('0x1'));var jsonpatch=require(_0x2e49('0x2'));var rp=require('request-promise');var moment=require(_0x2e49('0x3'));var BPromise=require(_0x2e49('0x4'));var Mustache=require(_0x2e49('0x5'));var util=require(_0x2e49('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2e49('0x7'));var fs=require('fs');var fs_extra=require(_0x2e49('0x8'));var _=require(_0x2e49('0x9'));var squel=require(_0x2e49('0xa'));var crypto=require(_0x2e49('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2e49('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2e49('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2e49('0xe'));var logger=require('../../config/logger')(_0x2e49('0xf'));var utils=require(_0x2e49('0x10'));var config=require(_0x2e49('0x11'));var licenseUtil=require(_0x2e49('0x12'));var db=require(_0x2e49('0x13'))['db'];function respondWithStatusCode(_0x52186c,_0x5a2843){_0x5a2843=_0x5a2843||0xcc;return function(_0x21b82a){if(_0x21b82a){return _0x52186c[_0x2e49('0x14')](_0x5a2843);}return _0x52186c['status'](_0x5a2843)[_0x2e49('0x15')]();};}function respondWithResult(_0x184d73,_0x560681){_0x560681=_0x560681||0xc8;return function(_0x185726){if(_0x185726){return _0x184d73[_0x2e49('0x16')](_0x560681)[_0x2e49('0x17')](_0x185726);}};}function respondWithFilteredResult(_0x259108,_0x55d5ca){return function(_0x163ffc){if(_0x163ffc){var _0x596a09=typeof _0x55d5ca['offset']===_0x2e49('0x18')&&typeof _0x55d5ca['limit']==='undefined';var _0x237a3f=_0x163ffc[_0x2e49('0x19')];var _0x4a19e6=_0x596a09?0x0:_0x55d5ca[_0x2e49('0x1a')];var _0x253297=_0x596a09?_0x163ffc[_0x2e49('0x19')]:_0x55d5ca['offset']+_0x55d5ca[_0x2e49('0x1b')];var _0x5235be;if(_0x253297>=_0x237a3f){_0x253297=_0x237a3f;_0x5235be=0xc8;}else{_0x5235be=0xce;}_0x259108[_0x2e49('0x16')](_0x5235be);return _0x259108[_0x2e49('0x1c')](_0x2e49('0x1d'),_0x4a19e6+'-'+_0x253297+'/'+_0x237a3f)[_0x2e49('0x17')](_0x163ffc);}return null;};}function patchUpdates(_0x2c4197){return function(_0x3a7d71){try{jsonpatch['apply'](_0x3a7d71,_0x2c4197,!![]);}catch(_0x312f8f){return BPromise['reject'](_0x312f8f);}return _0x3a7d71[_0x2e49('0x1e')]();};}function saveUpdates(_0x35ddaa,_0x2cd6e2){return function(_0x1d9980){if(_0x1d9980){return _0x1d9980[_0x2e49('0x1f')](_0x35ddaa)[_0x2e49('0x20')](function(_0x3d046c){return _0x3d046c;});}return null;};}function removeEntity(_0x504613,_0x3c3d0d){return function(_0x4b197f){if(_0x4b197f){return _0x4b197f['destroy']()[_0x2e49('0x20')](function(){_0x504613[_0x2e49('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5aa86e,_0x4d5279){return function(_0x503b39){if(!_0x503b39){_0x5aa86e[_0x2e49('0x14')](0x194);}return _0x503b39;};}function handleError(_0x3bfb03,_0x58100f){_0x58100f=_0x58100f||0x1f4;return function(_0x24203d){logger[_0x2e49('0x21')](_0x24203d[_0x2e49('0x22')]);if(_0x24203d[_0x2e49('0x23')]){delete _0x24203d[_0x2e49('0x23')];}_0x3bfb03[_0x2e49('0x16')](_0x58100f)[_0x2e49('0x24')](_0x24203d);};}exports[_0x2e49('0x25')]=function(_0x436116,_0x39c10a){var _0x223539={},_0x2013e4={},_0x1dd2ec={'count':0x0,'rows':[]};var _0x512b64=_[_0x2e49('0x26')](db[_0x2e49('0x27')]['rawAttributes'],function(_0x4fc939){return{'name':_0x4fc939['fieldName'],'type':_0x4fc939[_0x2e49('0x28')]['key']};});_0x2013e4[_0x2e49('0x29')]=_['map'](_0x512b64,_0x2e49('0x23'));_0x2013e4[_0x2e49('0x2a')]=_[_0x2e49('0x2b')](_0x436116[_0x2e49('0x2a')]);_0x2013e4[_0x2e49('0x2c')]=_[_0x2e49('0x2d')](_0x2013e4[_0x2e49('0x29')],_0x2013e4[_0x2e49('0x2a')]);_0x223539[_0x2e49('0x2e')]=_[_0x2e49('0x2d')](_0x2013e4[_0x2e49('0x29')],qs[_0x2e49('0x2f')](_0x436116['query'][_0x2e49('0x2f')]));_0x223539[_0x2e49('0x2e')]=_0x223539[_0x2e49('0x2e')][_0x2e49('0x30')]?_0x223539['attributes']:_0x2013e4[_0x2e49('0x29')];if(!_0x436116['query'][_0x2e49('0x31')](_0x2e49('0x32'))){_0x223539[_0x2e49('0x1b')]=qs['limit'](_0x436116['query'][_0x2e49('0x1b')]);_0x223539['offset']=qs[_0x2e49('0x1a')](_0x436116[_0x2e49('0x2a')][_0x2e49('0x1a')]);}_0x223539['order']=qs['sort'](_0x436116[_0x2e49('0x2a')][_0x2e49('0x33')]);_0x223539[_0x2e49('0x34')]=qs[_0x2e49('0x2c')](_['pick'](_0x436116[_0x2e49('0x2a')],_0x2013e4[_0x2e49('0x2c')]),_0x512b64);if(_0x436116[_0x2e49('0x2a')][_0x2e49('0x35')]){_0x223539[_0x2e49('0x34')]=_[_0x2e49('0x36')](_0x223539[_0x2e49('0x34')],{'$or':_['map'](_0x512b64,function(_0x3bacda){if(_0x3bacda[_0x2e49('0x28')]!=='VIRTUAL'){var _0x339564={};_0x339564[_0x3bacda[_0x2e49('0x23')]]={'$like':'%'+_0x436116[_0x2e49('0x2a')][_0x2e49('0x35')]+'%'};return _0x339564;}})});}_0x223539=_[_0x2e49('0x36')]({},_0x223539,_0x436116[_0x2e49('0x37')]);var _0x481895={'where':_0x223539[_0x2e49('0x34')]};return db[_0x2e49('0x27')][_0x2e49('0x19')](_0x481895)['then'](function(_0x1a9d74){_0x1dd2ec['count']=_0x1a9d74;if(_0x436116['query'][_0x2e49('0x38')]){_0x223539[_0x2e49('0x39')]=[{'all':!![]}];}return db[_0x2e49('0x27')][_0x2e49('0x3a')](_0x223539);})[_0x2e49('0x20')](function(_0x13655){_0x1dd2ec[_0x2e49('0x3b')]=_0x13655;return _0x1dd2ec;})[_0x2e49('0x20')](respondWithFilteredResult(_0x39c10a,_0x223539))[_0x2e49('0x3c')](handleError(_0x39c10a,null));};exports[_0x2e49('0x3d')]=function(_0x27ab4c,_0x53d673){var _0x18dd58={'raw':!![],'where':{'id':_0x27ab4c['params']['id']}},_0x3ab2a4={};_0x3ab2a4[_0x2e49('0x29')]=_['keys'](db[_0x2e49('0x27')][_0x2e49('0x3e')]);_0x3ab2a4['query']=_['keys'](_0x27ab4c[_0x2e49('0x2a')]);_0x3ab2a4[_0x2e49('0x2c')]=_[_0x2e49('0x2d')](_0x3ab2a4[_0x2e49('0x29')],_0x3ab2a4[_0x2e49('0x2a')]);_0x18dd58[_0x2e49('0x2e')]=_['intersection'](_0x3ab2a4[_0x2e49('0x29')],qs[_0x2e49('0x2f')](_0x27ab4c[_0x2e49('0x2a')]['fields']));_0x18dd58[_0x2e49('0x2e')]=_0x18dd58[_0x2e49('0x2e')]['length']?_0x18dd58[_0x2e49('0x2e')]:_0x3ab2a4[_0x2e49('0x29')];if(_0x27ab4c[_0x2e49('0x2a')][_0x2e49('0x38')]){_0x18dd58[_0x2e49('0x39')]=[{'all':!![]}];}_0x18dd58=_[_0x2e49('0x36')]({},_0x18dd58,_0x27ab4c[_0x2e49('0x37')]);return db[_0x2e49('0x27')][_0x2e49('0x3f')](_0x18dd58)['then'](handleEntityNotFound(_0x53d673,null))[_0x2e49('0x20')](respondWithResult(_0x53d673,null))[_0x2e49('0x3c')](handleError(_0x53d673,null));};exports[_0x2e49('0x40')]=function(_0x4dbf17,_0x15c032){return db['SmsTransferReport'][_0x2e49('0x40')](_0x4dbf17['body'],{})[_0x2e49('0x20')](respondWithResult(_0x15c032,0xc9))[_0x2e49('0x3c')](handleError(_0x15c032,null));};exports[_0x2e49('0x1f')]=function(_0x2fb2f9,_0x4eca6a){if(_0x2fb2f9[_0x2e49('0x41')]['id']){delete _0x2fb2f9[_0x2e49('0x41')]['id'];}return db[_0x2e49('0x27')][_0x2e49('0x3f')]({'where':{'id':_0x2fb2f9[_0x2e49('0x42')]['id']}})[_0x2e49('0x20')](handleEntityNotFound(_0x4eca6a,null))['then'](saveUpdates(_0x2fb2f9['body'],null))[_0x2e49('0x20')](respondWithResult(_0x4eca6a,null))[_0x2e49('0x3c')](handleError(_0x4eca6a,null));};exports[_0x2e49('0x43')]=function(_0x4e9a04,_0x1ed2c4){return db[_0x2e49('0x27')][_0x2e49('0x3f')]({'where':{'id':_0x4e9a04[_0x2e49('0x42')]['id']}})[_0x2e49('0x20')](handleEntityNotFound(_0x1ed2c4,null))[_0x2e49('0x20')](removeEntity(_0x1ed2c4,null))[_0x2e49('0x3c')](handleError(_0x1ed2c4,null));};exports[_0x2e49('0x44')]=function(_0x23ce4b,_0x780955){return db['SmsTransferReport'][_0x2e49('0x44')]()['then'](respondWithResult(_0x780955,null))[_0x2e49('0x3c')](handleError(_0x780955,null));}; \ No newline at end of file +var _0x51d9=['sort','where','pick','filter','VIRTUAL','merge','options','SmsTransferReport','findAll','rows','catch','show','params','length','includeAll','include','create','body','find','describe','eml-format','rimraf','fast-json-patch','request-promise','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit'];(function(_0x3c441f,_0x160bd8){var _0x228640=function(_0x57bae2){while(--_0x57bae2){_0x3c441f['push'](_0x3c441f['shift']());}};_0x228640(++_0x160bd8);}(_0x51d9,0x1ee));var _0x951d=function(_0x5623f5,_0x3f69ab){_0x5623f5=_0x5623f5-0x0;var _0x8eab20=_0x51d9[_0x5623f5];return _0x8eab20;};'use strict';var emlformat=require(_0x951d('0x0'));var rimraf=require(_0x951d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x951d('0x2'));var rp=require(_0x951d('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x951d('0x4'));var util=require('util');var path=require(_0x951d('0x5'));var sox=require(_0x951d('0x6'));var csv=require(_0x951d('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x951d('0x8'));var _=require(_0x951d('0x9'));var squel=require(_0x951d('0xa'));var crypto=require(_0x951d('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x951d('0xc'));var toCsv=require(_0x951d('0x7'));var querystring=require(_0x951d('0xd'));var Papa=require(_0x951d('0xe'));var Redis=require('ioredis');var authService=require(_0x951d('0xf'));var qs=require(_0x951d('0x10'));var as=require(_0x951d('0x11'));var hardwareService=require(_0x951d('0x12'));var logger=require(_0x951d('0x13'))(_0x951d('0x14'));var utils=require(_0x951d('0x15'));var config=require(_0x951d('0x16'));var licenseUtil=require(_0x951d('0x17'));var db=require(_0x951d('0x18'))['db'];function respondWithStatusCode(_0x704195,_0x3c6415){_0x3c6415=_0x3c6415||0xcc;return function(_0x401ec2){if(_0x401ec2){return _0x704195[_0x951d('0x19')](_0x3c6415);}return _0x704195[_0x951d('0x1a')](_0x3c6415)[_0x951d('0x1b')]();};}function respondWithResult(_0x30e7ca,_0x240fb5){_0x240fb5=_0x240fb5||0xc8;return function(_0x2e63cc){if(_0x2e63cc){return _0x30e7ca[_0x951d('0x1a')](_0x240fb5)[_0x951d('0x1c')](_0x2e63cc);}};}function respondWithFilteredResult(_0x4396c9,_0x42a117){return function(_0x31534f){if(_0x31534f){var _0x7e6124=typeof _0x42a117[_0x951d('0x1d')]===_0x951d('0x1e')&&typeof _0x42a117[_0x951d('0x1f')]===_0x951d('0x1e');var _0xae5daa=_0x31534f[_0x951d('0x20')];var _0x268912=_0x7e6124?0x0:_0x42a117[_0x951d('0x1d')];var _0x27fe9f=_0x7e6124?_0x31534f[_0x951d('0x20')]:_0x42a117[_0x951d('0x1d')]+_0x42a117[_0x951d('0x1f')];var _0xb0ea33;if(_0x27fe9f>=_0xae5daa){_0x27fe9f=_0xae5daa;_0xb0ea33=0xc8;}else{_0xb0ea33=0xce;}_0x4396c9['status'](_0xb0ea33);return _0x4396c9[_0x951d('0x21')]('Content-Range',_0x268912+'-'+_0x27fe9f+'/'+_0xae5daa)[_0x951d('0x1c')](_0x31534f);}return null;};}function patchUpdates(_0x1c6b8f){return function(_0x161549){try{jsonpatch[_0x951d('0x22')](_0x161549,_0x1c6b8f,!![]);}catch(_0x9f3d5d){return BPromise[_0x951d('0x23')](_0x9f3d5d);}return _0x161549[_0x951d('0x24')]();};}function saveUpdates(_0x13e0b5,_0x42a602){return function(_0x1ab4e2){if(_0x1ab4e2){return _0x1ab4e2[_0x951d('0x25')](_0x13e0b5)[_0x951d('0x26')](function(_0x3c1ca7){return _0x3c1ca7;});}return null;};}function removeEntity(_0x563d2e,_0x4653fe){return function(_0xeb5725){if(_0xeb5725){return _0xeb5725[_0x951d('0x27')]()['then'](function(){_0x563d2e[_0x951d('0x1a')](0xcc)[_0x951d('0x1b')]();});}};}function handleEntityNotFound(_0x506145,_0x2053ad){return function(_0x2b3b6a){if(!_0x2b3b6a){_0x506145[_0x951d('0x19')](0x194);}return _0x2b3b6a;};}function handleError(_0x82d842,_0x4d8743){_0x4d8743=_0x4d8743||0x1f4;return function(_0x57a62d){logger[_0x951d('0x28')](_0x57a62d[_0x951d('0x29')]);if(_0x57a62d[_0x951d('0x2a')]){delete _0x57a62d[_0x951d('0x2a')];}_0x82d842['status'](_0x4d8743)[_0x951d('0x2b')](_0x57a62d);};}exports[_0x951d('0x2c')]=function(_0x589e54,_0x4e9cac){var _0x3150d6={},_0xfed39={},_0xbc3743={'count':0x0,'rows':[]};var _0x34ae1e=_[_0x951d('0x2d')](db['SmsTransferReport'][_0x951d('0x2e')],function(_0x36501d){return{'name':_0x36501d[_0x951d('0x2f')],'type':_0x36501d[_0x951d('0x30')][_0x951d('0x31')]};});_0xfed39[_0x951d('0x32')]=_[_0x951d('0x2d')](_0x34ae1e,'name');_0xfed39[_0x951d('0x33')]=_[_0x951d('0x34')](_0x589e54[_0x951d('0x33')]);_0xfed39[_0x951d('0x35')]=_['intersection'](_0xfed39[_0x951d('0x32')],_0xfed39[_0x951d('0x33')]);_0x3150d6[_0x951d('0x36')]=_[_0x951d('0x37')](_0xfed39[_0x951d('0x32')],qs[_0x951d('0x38')](_0x589e54[_0x951d('0x33')][_0x951d('0x38')]));_0x3150d6['attributes']=_0x3150d6[_0x951d('0x36')]['length']?_0x3150d6[_0x951d('0x36')]:_0xfed39[_0x951d('0x32')];if(!_0x589e54[_0x951d('0x33')][_0x951d('0x39')](_0x951d('0x3a'))){_0x3150d6[_0x951d('0x1f')]=qs[_0x951d('0x1f')](_0x589e54[_0x951d('0x33')][_0x951d('0x1f')]);_0x3150d6[_0x951d('0x1d')]=qs['offset'](_0x589e54[_0x951d('0x33')][_0x951d('0x1d')]);}_0x3150d6['order']=qs[_0x951d('0x3b')](_0x589e54[_0x951d('0x33')]['sort']);_0x3150d6[_0x951d('0x3c')]=qs['filters'](_[_0x951d('0x3d')](_0x589e54[_0x951d('0x33')],_0xfed39['filters']),_0x34ae1e);if(_0x589e54['query'][_0x951d('0x3e')]){_0x3150d6[_0x951d('0x3c')]=_['merge'](_0x3150d6[_0x951d('0x3c')],{'$or':_[_0x951d('0x2d')](_0x34ae1e,function(_0x223083){if(_0x223083[_0x951d('0x30')]!==_0x951d('0x3f')){var _0xbfb490={};_0xbfb490[_0x223083['name']]={'$like':'%'+_0x589e54['query']['filter']+'%'};return _0xbfb490;}})});}_0x3150d6=_[_0x951d('0x40')]({},_0x3150d6,_0x589e54[_0x951d('0x41')]);var _0x3fe7fd={'where':_0x3150d6[_0x951d('0x3c')]};return db['SmsTransferReport'][_0x951d('0x20')](_0x3fe7fd)[_0x951d('0x26')](function(_0x142e34){_0xbc3743[_0x951d('0x20')]=_0x142e34;if(_0x589e54['query']['includeAll']){_0x3150d6['include']=[{'all':!![]}];}return db[_0x951d('0x42')][_0x951d('0x43')](_0x3150d6);})['then'](function(_0x33d36a){_0xbc3743[_0x951d('0x44')]=_0x33d36a;return _0xbc3743;})['then'](respondWithFilteredResult(_0x4e9cac,_0x3150d6))[_0x951d('0x45')](handleError(_0x4e9cac,null));};exports[_0x951d('0x46')]=function(_0x59dcea,_0xe6f075){var _0x1ba926={'raw':!![],'where':{'id':_0x59dcea[_0x951d('0x47')]['id']}},_0xd6a146={};_0xd6a146[_0x951d('0x32')]=_[_0x951d('0x34')](db[_0x951d('0x42')]['rawAttributes']);_0xd6a146[_0x951d('0x33')]=_[_0x951d('0x34')](_0x59dcea[_0x951d('0x33')]);_0xd6a146[_0x951d('0x35')]=_['intersection'](_0xd6a146[_0x951d('0x32')],_0xd6a146[_0x951d('0x33')]);_0x1ba926['attributes']=_[_0x951d('0x37')](_0xd6a146['model'],qs[_0x951d('0x38')](_0x59dcea['query']['fields']));_0x1ba926[_0x951d('0x36')]=_0x1ba926[_0x951d('0x36')][_0x951d('0x48')]?_0x1ba926['attributes']:_0xd6a146[_0x951d('0x32')];if(_0x59dcea[_0x951d('0x33')][_0x951d('0x49')]){_0x1ba926[_0x951d('0x4a')]=[{'all':!![]}];}_0x1ba926=_[_0x951d('0x40')]({},_0x1ba926,_0x59dcea[_0x951d('0x41')]);return db[_0x951d('0x42')]['find'](_0x1ba926)[_0x951d('0x26')](handleEntityNotFound(_0xe6f075,null))[_0x951d('0x26')](respondWithResult(_0xe6f075,null))['catch'](handleError(_0xe6f075,null));};exports[_0x951d('0x4b')]=function(_0x3d800d,_0x3586fe){return db[_0x951d('0x42')][_0x951d('0x4b')](_0x3d800d['body'],{})['then'](respondWithResult(_0x3586fe,0xc9))[_0x951d('0x45')](handleError(_0x3586fe,null));};exports['update']=function(_0x40dca6,_0x37af57){if(_0x40dca6['body']['id']){delete _0x40dca6[_0x951d('0x4c')]['id'];}return db[_0x951d('0x42')][_0x951d('0x4d')]({'where':{'id':_0x40dca6[_0x951d('0x47')]['id']}})[_0x951d('0x26')](handleEntityNotFound(_0x37af57,null))[_0x951d('0x26')](saveUpdates(_0x40dca6[_0x951d('0x4c')],null))[_0x951d('0x26')](respondWithResult(_0x37af57,null))[_0x951d('0x45')](handleError(_0x37af57,null));};exports[_0x951d('0x27')]=function(_0x56405e,_0x3d01e3){return db[_0x951d('0x42')]['find']({'where':{'id':_0x56405e['params']['id']}})[_0x951d('0x26')](handleEntityNotFound(_0x3d01e3,null))['then'](removeEntity(_0x3d01e3,null))[_0x951d('0x45')](handleError(_0x3d01e3,null));};exports[_0x951d('0x4e')]=function(_0x3ecdf3,_0x472d2c){return db[_0x951d('0x42')][_0x951d('0x4e')]()['then'](respondWithResult(_0x472d2c,null))[_0x951d('0x45')](handleError(_0x472d2c,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index ccc7c4d..00dacbb 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 _0x2e1a=['./smsTransferReport.attributes','exports','define','SmsTransferReport','report_sms_transfer','uniqueid','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2d3b71,_0xb95421){var _0x352192=function(_0x5295a3){while(--_0x5295a3){_0x2d3b71['push'](_0x2d3b71['shift']());}};_0x352192(++_0xb95421);}(_0x2e1a,0xd6));var _0xa2e1=function(_0x485f35,_0x45a0fc){_0x485f35=_0x485f35-0x0;var _0x2ad118=_0x2e1a[_0x485f35];return _0x2ad118;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa2e1('0x0'))(_0xa2e1('0x1'));var moment=require('moment');var BPromise=require(_0xa2e1('0x2'));var rp=require(_0xa2e1('0x3'));var fs=require('fs');var path=require(_0xa2e1('0x4'));var rimraf=require(_0xa2e1('0x5'));var config=require(_0xa2e1('0x6'));var attributes=require(_0xa2e1('0x7'));module[_0xa2e1('0x8')]=function(_0x4d534c,_0x4428a9){return _0x4d534c[_0xa2e1('0x9')](_0xa2e1('0xa'),attributes,{'tableName':_0xa2e1('0xb'),'paranoid':![],'indexes':[{'name':_0xa2e1('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x1d50=['./smsTransferReport.attributes','exports','define','SmsTransferReport','uniqueid','lodash','util','request-promise','path','rimraf'];(function(_0x128a30,_0x2da511){var _0x50a7ba=function(_0x220c3e){while(--_0x220c3e){_0x128a30['push'](_0x128a30['shift']());}};_0x50a7ba(++_0x2da511);}(_0x1d50,0x1c7));var _0x01d5=function(_0x39499e,_0x4c9d36){_0x39499e=_0x39499e-0x0;var _0x1f6e28=_0x1d50[_0x39499e];return _0x1f6e28;};'use strict';var _=require(_0x01d5('0x0'));var util=require(_0x01d5('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x01d5('0x2'));var fs=require('fs');var path=require(_0x01d5('0x3'));var rimraf=require(_0x01d5('0x4'));var config=require('../../config/environment');var attributes=require(_0x01d5('0x5'));module[_0x01d5('0x6')]=function(_0x3d76e5,_0x468113){return _0x3d76e5[_0x01d5('0x7')](_0x01d5('0x8'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0x01d5('0x9'),'fields':[_0x01d5('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 606e07e..529ab86 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 _0xc15b=['SmsTransferReport,\x20%s,\x20%s','request\x20sent','SmsTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','then','info'];(function(_0x139de7,_0x5dee55){var _0x51d94c=function(_0x3e968d){while(--_0x3e968d){_0x139de7['push'](_0x139de7['shift']());}};_0x51d94c(++_0x5dee55);}(_0xc15b,0xe4));var _0xbc15=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0xc15b[_0x5a776b];return _0xbbef59;};'use strict';var _=require(_0xbc15('0x0'));var util=require('util');var moment=require(_0xbc15('0x1'));var BPromise=require(_0xbc15('0x2'));var rs=require(_0xbc15('0x3'));var fs=require('fs');var Redis=require(_0xbc15('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbc15('0x5'))(_0xbc15('0x6'));var config=require(_0xbc15('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1231f0,_0x22576c,_0x3cb4b5){return new BPromise(function(_0x50a276,_0x5c6269){return client['request'](_0x1231f0,_0x3cb4b5)[_0xbc15('0x8')](function(_0x571348){logger[_0xbc15('0x9')](_0xbc15('0xa'),_0x22576c,_0xbc15('0xb'));logger['debug'](_0xbc15('0xc'),_0x22576c,_0xbc15('0xb'),JSON['stringify'](_0x571348));if(_0x571348[_0xbc15('0xd')]){if(_0x571348[_0xbc15('0xd')][_0xbc15('0xe')]===0x1f4){logger['error']('SmsTransferReport,\x20%s,\x20%s',_0x22576c,_0x571348['error'][_0xbc15('0xf')]);return _0x5c6269(_0x571348[_0xbc15('0xd')][_0xbc15('0xf')]);}logger[_0xbc15('0xd')](_0xbc15('0xa'),_0x22576c,_0x571348[_0xbc15('0xd')][_0xbc15('0xf')]);return _0x50a276(_0x571348[_0xbc15('0xd')][_0xbc15('0xf')]);}else{logger[_0xbc15('0x9')](_0xbc15('0xa'),_0x22576c,_0xbc15('0xb'));_0x50a276(_0x571348[_0xbc15('0x10')][_0xbc15('0xf')]);}})['catch'](function(_0x41a3e9){logger['error'](_0xbc15('0xa'),_0x22576c,_0x41a3e9);_0x5c6269(_0x41a3e9);});});} \ No newline at end of file +var _0x8558=['debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','request','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x8558,0x103));var _0x8855=function(_0x580f24,_0x35d32c){_0x580f24=_0x580f24-0x0;var _0x5b5f68=_0x8558[_0x580f24];return _0x5b5f68;};'use strict';var _=require('lodash');var util=require(_0x8855('0x0'));var moment=require(_0x8855('0x1'));var BPromise=require(_0x8855('0x2'));var rs=require(_0x8855('0x3'));var fs=require('fs');var Redis=require(_0x8855('0x4'));var db=require(_0x8855('0x5'))['db'];var utils=require(_0x8855('0x6'));var logger=require('../../config/logger')(_0x8855('0x7'));var config=require('../../config/environment');var jayson=require(_0x8855('0x8'));var client=jayson['client'][_0x8855('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2039d5,_0x24041c,_0x175e9c){return new BPromise(function(_0x2811d7,_0xef1e1){return client[_0x8855('0xa')](_0x2039d5,_0x175e9c)['then'](function(_0x325a35){logger[_0x8855('0xb')](_0x8855('0xc'),_0x24041c,_0x8855('0xd'));logger[_0x8855('0xe')](_0x8855('0xf'),_0x24041c,_0x8855('0xd'),JSON[_0x8855('0x10')](_0x325a35));if(_0x325a35['error']){if(_0x325a35[_0x8855('0x11')][_0x8855('0x12')]===0x1f4){logger['error'](_0x8855('0xc'),_0x24041c,_0x325a35[_0x8855('0x11')]['message']);return _0xef1e1(_0x325a35[_0x8855('0x11')][_0x8855('0x13')]);}logger[_0x8855('0x11')](_0x8855('0xc'),_0x24041c,_0x325a35['error'][_0x8855('0x13')]);return _0x2811d7(_0x325a35['error'][_0x8855('0x13')]);}else{logger['info'](_0x8855('0xc'),_0x24041c,_0x8855('0xd'));_0x2811d7(_0x325a35[_0x8855('0x14')][_0x8855('0x13')]);}})['catch'](function(_0x3b8975){logger['error'](_0x8855('0xc'),_0x24041c,_0x3b8975);_0xef1e1(_0x3b8975);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index a42f4bd..214d373 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 _0xcb3b=['../../config/environment','./sound.controller','get','isAuthenticated','index','show','download','join','root','server/files/sounds/original/','originalname','replace','format','%s-%s%s','basename','now','extname','post','single','put','/:id','update','delete','multer','util','connect-timeout','fs-extra','../../components/auth/service'];(function(_0x22808b,_0x329b6a){var _0x42cbd2=function(_0x256a8d){while(--_0x256a8d){_0x22808b['push'](_0x22808b['shift']());}};_0x42cbd2(++_0x329b6a);}(_0xcb3b,0x12f));var _0xbcb3=function(_0x4758a7,_0x47bfed){_0x4758a7=_0x4758a7-0x0;var _0x3876d4=_0xcb3b[_0x4758a7];return _0x3876d4;};'use strict';var multer=require(_0xbcb3('0x0'));var util=require(_0xbcb3('0x1'));var path=require('path');var timeout=require(_0xbcb3('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xbcb3('0x3'));var auth=require(_0xbcb3('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xbcb3('0x5'));var controller=require(_0xbcb3('0x6'));router[_0xbcb3('0x7')]('/',auth[_0xbcb3('0x8')](),controller[_0xbcb3('0x9')]);router['get']('/:id',auth[_0xbcb3('0x8')](),controller[_0xbcb3('0xa')]);router[_0xbcb3('0x7')]('/:id/download',auth[_0xbcb3('0x8')](),controller[_0xbcb3('0xb')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3f7c5c,_0x15bddf,_0x19b380){_0x19b380(null,path[_0xbcb3('0xc')](config[_0xbcb3('0xd')],_0xbcb3('0xe')));},'filename':function(_0x11372d,_0x2ca390,_0x406e6f){_0x2ca390[_0xbcb3('0xf')]=_0x2ca390[_0xbcb3('0xf')][_0xbcb3('0x10')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x406e6f(null,util[_0xbcb3('0x11')](_0xbcb3('0x12'),path[_0xbcb3('0x13')](_0x2ca390['originalname'],path['extname'](_0x2ca390[_0xbcb3('0xf')])),Date[_0xbcb3('0x14')](),path[_0xbcb3('0x15')](_0x2ca390['originalname'])));}})});router[_0xbcb3('0x16')]('/',upload[_0xbcb3('0x17')]('file'),controller['create']);router[_0xbcb3('0x18')](_0xbcb3('0x19'),auth['isAuthenticated'](),controller[_0xbcb3('0x1a')]);router[_0xbcb3('0x1b')](_0xbcb3('0x19'),auth[_0xbcb3('0x8')](),controller[_0xbcb3('0x1b')]);module['exports']=router; \ No newline at end of file +var _0x8444=['show','download','join','root','server/files/sounds/original/','originalname','replace','format','basename','extname','now','create','put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0x13c9b4,_0x4cf95a){var _0x44451a=function(_0x1d9de9){while(--_0x1d9de9){_0x13c9b4['push'](_0x13c9b4['shift']());}};_0x44451a(++_0x4cf95a);}(_0x8444,0x189));var _0x4844=function(_0x4c0082,_0x46c3f8){_0x4c0082=_0x4c0082-0x0;var _0x55bdf5=_0x8444[_0x4c0082];return _0x55bdf5;};'use strict';var multer=require(_0x4844('0x0'));var util=require(_0x4844('0x1'));var path=require(_0x4844('0x2'));var timeout=require(_0x4844('0x3'));var express=require('express');var router=express[_0x4844('0x4')]();var fs_extra=require(_0x4844('0x5'));var auth=require(_0x4844('0x6'));var interaction=require(_0x4844('0x7'));var config=require(_0x4844('0x8'));var controller=require('./sound.controller');router[_0x4844('0x9')]('/',auth[_0x4844('0xa')](),controller[_0x4844('0xb')]);router[_0x4844('0x9')](_0x4844('0xc'),auth[_0x4844('0xa')](),controller[_0x4844('0xd')]);router['get']('/:id/download',auth[_0x4844('0xa')](),controller[_0x4844('0xe')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2b48c7,_0x5a75a5,_0xacb98c){_0xacb98c(null,path[_0x4844('0xf')](config[_0x4844('0x10')],_0x4844('0x11')));},'filename':function(_0x6cc269,_0x522a3d,_0x4bc32d){_0x522a3d[_0x4844('0x12')]=_0x522a3d[_0x4844('0x12')][_0x4844('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4bc32d(null,util[_0x4844('0x14')]('%s-%s%s',path[_0x4844('0x15')](_0x522a3d['originalname'],path[_0x4844('0x16')](_0x522a3d[_0x4844('0x12')])),Date[_0x4844('0x17')](),path[_0x4844('0x16')](_0x522a3d[_0x4844('0x12')])));}})});router['post']('/',upload['single']('file'),controller[_0x4844('0x18')]);router[_0x4844('0x19')](_0x4844('0xc'),auth[_0x4844('0xa')](),controller[_0x4844('0x1a')]);router[_0x4844('0x1b')](_0x4844('0xc'),auth[_0x4844('0xa')](),controller[_0x4844('0x1b')]);module[_0x4844('0x1c')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 018508d..2d7aa61 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 _0x8cf7=['name','FLOAT','BIGINT','INTEGER','sequelize','STRING'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0x8cf7,0x1a8));var _0x78cf=function(_0x5d9c67,_0x2b58c6){_0x5d9c67=_0x5d9c67-0x0;var _0x542a8f=_0x8cf7[_0x5d9c67];return _0x542a8f;};'use strict';var Sequelize=require(_0x78cf('0x0'));module['exports']={'name':{'type':Sequelize[_0x78cf('0x1')],'unique':_0x78cf('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0x78cf('0x1')]},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize[_0x78cf('0x1')]},'original_format':{'type':Sequelize[_0x78cf('0x1')]},'original_duration':{'type':Sequelize[_0x78cf('0x3')]},'original_sampleCount':{'type':Sequelize[_0x78cf('0x4')]},'original_channelCount':{'type':Sequelize[_0x78cf('0x5')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0x78cf('0x5')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize[_0x78cf('0x3')]},'converted_sampleCount':{'type':Sequelize[_0x78cf('0x4')]},'converted_channelCount':{'type':Sequelize[_0x78cf('0x5')]},'converted_bitRate':{'type':Sequelize[_0x78cf('0x4')]},'converted_sampleRate':{'type':Sequelize[_0x78cf('0x5')]}}; \ No newline at end of file +var _0xd4cc=['sequelize','exports','STRING','FLOAT','BIGINT','INTEGER'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xd4cc,0x114));var _0xcd4c=function(_0x2382f2,_0x2c621c){_0x2382f2=_0x2382f2-0x0;var _0x2c72ac=_0xd4cc[_0x2382f2];return _0x2c72ac;};'use strict';var Sequelize=require(_0xcd4c('0x0'));module[_0xcd4c('0x1')]={'name':{'type':Sequelize[_0xcd4c('0x2')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0xcd4c('0x2')]},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize[_0xcd4c('0x2')]},'original_format':{'type':Sequelize[_0xcd4c('0x2')]},'original_duration':{'type':Sequelize[_0xcd4c('0x3')]},'original_sampleCount':{'type':Sequelize[_0xcd4c('0x4')]},'original_channelCount':{'type':Sequelize[_0xcd4c('0x5')]},'original_bitRate':{'type':Sequelize[_0xcd4c('0x4')]},'original_sampleRate':{'type':Sequelize[_0xcd4c('0x5')]},'converted_format':{'type':Sequelize[_0xcd4c('0x2')]},'converted_duration':{'type':Sequelize[_0xcd4c('0x3')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize[_0xcd4c('0x5')]},'converted_bitRate':{'type':Sequelize[_0xcd4c('0x4')]},'converted_sampleRate':{'type':Sequelize[_0xcd4c('0x5')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 194ff7c..2b20f94 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 _0xcafa=['api','../../mysqldb','status','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','get','Sounds','end','sendStatus','error','stack','name','send','index','map','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','options','Sound','includeAll','include','findAll','rows','catch','show','params','rawAttributes','download','find','save_name','converted_format','join','root','Sequelize','ValidationError','Sound\x20not\x20found','%s.%s','format','create','basename','file','extname','originalname','filename','substring','wav','server/files/sounds/original','server/files/sounds/converted','info','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_channelCount','converted_bitRate','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','pick','description','destroy','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger'];(function(_0x4555b1,_0x27e831){var _0x3a08b1=function(_0x5cc68a){while(--_0x5cc68a){_0x4555b1['push'](_0x4555b1['shift']());}};_0x3a08b1(++_0x27e831);}(_0xcafa,0x68));var _0xacaf=function(_0x2ce75a,_0x2471fa){_0x2ce75a=_0x2ce75a-0x0;var _0x5b3d3b=_0xcafa[_0x2ce75a];return _0x5b3d3b;};'use strict';var emlformat=require(_0xacaf('0x0'));var rimraf=require(_0xacaf('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xacaf('0x2'));var rp=require(_0xacaf('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xacaf('0x4'));var util=require(_0xacaf('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xacaf('0x6'));var ejs=require(_0xacaf('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xacaf('0x8'));var crypto=require(_0xacaf('0x9'));var jsforce=require(_0xacaf('0xa'));var deskjs=require(_0xacaf('0xb'));var toCsv=require(_0xacaf('0x6'));var querystring=require(_0xacaf('0xc'));var Papa=require(_0xacaf('0xd'));var Redis=require(_0xacaf('0xe'));var authService=require(_0xacaf('0xf'));var qs=require(_0xacaf('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xacaf('0x11'));var logger=require(_0xacaf('0x12'))(_0xacaf('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xacaf('0x14'))['db'];function respondWithStatusCode(_0x51bf04,_0x14a979){_0x14a979=_0x14a979||0xcc;return function(_0x3b6e62){if(_0x3b6e62){return _0x51bf04['sendStatus'](_0x14a979);}return _0x51bf04[_0xacaf('0x15')](_0x14a979)['end']();};}function respondWithResult(_0x7d72b0,_0x11617f){_0x11617f=_0x11617f||0xc8;return function(_0x2fe0b8){if(_0x2fe0b8){return _0x7d72b0['status'](_0x11617f)[_0xacaf('0x16')](_0x2fe0b8);}};}function respondWithFilteredResult(_0x53327d,_0x202fb4){return function(_0x4c0c71){if(_0x4c0c71){var _0x294cd8=typeof _0x202fb4[_0xacaf('0x17')]==='undefined'&&typeof _0x202fb4[_0xacaf('0x18')]===_0xacaf('0x19');var _0x4585a1=_0x4c0c71[_0xacaf('0x1a')];var _0x28397c=_0x294cd8?0x0:_0x202fb4[_0xacaf('0x17')];var _0x8342f4=_0x294cd8?_0x4c0c71[_0xacaf('0x1a')]:_0x202fb4[_0xacaf('0x17')]+_0x202fb4[_0xacaf('0x18')];var _0x3a1ece;if(_0x8342f4>=_0x4585a1){_0x8342f4=_0x4585a1;_0x3a1ece=0xc8;}else{_0x3a1ece=0xce;}_0x53327d[_0xacaf('0x15')](_0x3a1ece);return _0x53327d[_0xacaf('0x1b')](_0xacaf('0x1c'),_0x28397c+'-'+_0x8342f4+'/'+_0x4585a1)[_0xacaf('0x16')](_0x4c0c71);}return null;};}function patchUpdates(_0x4c5ef4){return function(_0x34e39f){try{jsonpatch[_0xacaf('0x1d')](_0x34e39f,_0x4c5ef4,!![]);}catch(_0x1d7561){return BPromise['reject'](_0x1d7561);}return _0x34e39f[_0xacaf('0x1e')]();};}function saveUpdates(_0x1224ce,_0x2f2666){return function(_0x37cb28){if(_0x37cb28){return _0x37cb28[_0xacaf('0x1f')](_0x1224ce)[_0xacaf('0x20')](function(_0x55abfc){return _0x55abfc;});}return null;};}function removeEntity(_0xe06244,_0x503d2){return function(_0x998e27){if(_0x998e27){return _0x998e27['destroy']()[_0xacaf('0x20')](function(){var _0x1a3fa4=_0x998e27[_0xacaf('0x21')]({'plain':!![]});var _0x599884=_0xacaf('0x22');return db['UserProfileResource']['destroy']({'where':{'type':_0x599884,'resourceId':_0x1a3fa4['id']}})[_0xacaf('0x20')](function(){return _0x998e27;});})[_0xacaf('0x20')](function(){_0xe06244[_0xacaf('0x15')](0xcc)[_0xacaf('0x23')]();});}};}function handleEntityNotFound(_0x2eb9bd,_0x468a4f){return function(_0x29f1a3){if(!_0x29f1a3){_0x2eb9bd[_0xacaf('0x24')](0x194);}return _0x29f1a3;};}function handleError(_0x2246f8,_0x32fd55){_0x32fd55=_0x32fd55||0x1f4;return function(_0x1e6982){logger[_0xacaf('0x25')](_0x1e6982[_0xacaf('0x26')]);if(_0x1e6982[_0xacaf('0x27')]){delete _0x1e6982[_0xacaf('0x27')];}_0x2246f8[_0xacaf('0x15')](_0x32fd55)[_0xacaf('0x28')](_0x1e6982);};}exports[_0xacaf('0x29')]=function(_0x322a4f,_0x68b964){var _0x4c03cb={},_0x7d61={},_0x59f930={'count':0x0,'rows':[]};var _0x23fd56=_[_0xacaf('0x2a')](db['Sound']['rawAttributes'],function(_0x34091c){return{'name':_0x34091c['fieldName'],'type':_0x34091c[_0xacaf('0x2b')][_0xacaf('0x2c')]};});_0x7d61['model']=_[_0xacaf('0x2a')](_0x23fd56,_0xacaf('0x27'));_0x7d61[_0xacaf('0x2d')]=_[_0xacaf('0x2e')](_0x322a4f[_0xacaf('0x2d')]);_0x7d61[_0xacaf('0x2f')]=_[_0xacaf('0x30')](_0x7d61[_0xacaf('0x31')],_0x7d61['query']);_0x4c03cb[_0xacaf('0x32')]=_[_0xacaf('0x30')](_0x7d61[_0xacaf('0x31')],qs[_0xacaf('0x33')](_0x322a4f[_0xacaf('0x2d')][_0xacaf('0x33')]));_0x4c03cb[_0xacaf('0x32')]=_0x4c03cb[_0xacaf('0x32')][_0xacaf('0x34')]?_0x4c03cb[_0xacaf('0x32')]:_0x7d61['model'];if(!_0x322a4f[_0xacaf('0x2d')][_0xacaf('0x35')](_0xacaf('0x36'))){_0x4c03cb[_0xacaf('0x18')]=qs[_0xacaf('0x18')](_0x322a4f[_0xacaf('0x2d')][_0xacaf('0x18')]);_0x4c03cb[_0xacaf('0x17')]=qs[_0xacaf('0x17')](_0x322a4f[_0xacaf('0x2d')]['offset']);}_0x4c03cb[_0xacaf('0x37')]=qs['sort'](_0x322a4f['query'][_0xacaf('0x38')]);_0x4c03cb['where']=qs[_0xacaf('0x2f')](_['pick'](_0x322a4f[_0xacaf('0x2d')],_0x7d61['filters']),_0x23fd56);if(_0x322a4f['query'][_0xacaf('0x39')]){_0x4c03cb[_0xacaf('0x3a')]=_[_0xacaf('0x3b')](_0x4c03cb[_0xacaf('0x3a')],{'$or':_['map'](_0x23fd56,function(_0x3bf393){if(_0x3bf393[_0xacaf('0x2b')]!=='VIRTUAL'){var _0x389f41={};_0x389f41[_0x3bf393[_0xacaf('0x27')]]={'$like':'%'+_0x322a4f[_0xacaf('0x2d')][_0xacaf('0x39')]+'%'};return _0x389f41;}})});}_0x4c03cb=_[_0xacaf('0x3b')]({},_0x4c03cb,_0x322a4f[_0xacaf('0x3c')]);var _0x11a4a8={'where':_0x4c03cb[_0xacaf('0x3a')]};return db[_0xacaf('0x3d')][_0xacaf('0x1a')](_0x11a4a8)[_0xacaf('0x20')](function(_0x3393df){_0x59f930[_0xacaf('0x1a')]=_0x3393df;if(_0x322a4f[_0xacaf('0x2d')][_0xacaf('0x3e')]){_0x4c03cb[_0xacaf('0x3f')]=[{'all':!![]}];}return db[_0xacaf('0x3d')][_0xacaf('0x40')](_0x4c03cb);})[_0xacaf('0x20')](function(_0x4cfbb3){_0x59f930[_0xacaf('0x41')]=_0x4cfbb3;return _0x59f930;})[_0xacaf('0x20')](respondWithFilteredResult(_0x68b964,_0x4c03cb))[_0xacaf('0x42')](handleError(_0x68b964,null));};exports[_0xacaf('0x43')]=function(_0x4a99af,_0x1904d8){var _0x3079e0={'raw':!![],'where':{'id':_0x4a99af[_0xacaf('0x44')]['id']}},_0x477f0e={};_0x477f0e[_0xacaf('0x31')]=_[_0xacaf('0x2e')](db[_0xacaf('0x3d')][_0xacaf('0x45')]);_0x477f0e[_0xacaf('0x2d')]=_[_0xacaf('0x2e')](_0x4a99af[_0xacaf('0x2d')]);_0x477f0e[_0xacaf('0x2f')]=_[_0xacaf('0x30')](_0x477f0e['model'],_0x477f0e['query']);_0x3079e0[_0xacaf('0x32')]=_[_0xacaf('0x30')](_0x477f0e[_0xacaf('0x31')],qs['fields'](_0x4a99af['query'][_0xacaf('0x33')]));_0x3079e0['attributes']=_0x3079e0[_0xacaf('0x32')][_0xacaf('0x34')]?_0x3079e0['attributes']:_0x477f0e[_0xacaf('0x31')];if(_0x4a99af[_0xacaf('0x2d')][_0xacaf('0x3e')]){_0x3079e0[_0xacaf('0x3f')]=[{'all':!![]}];}_0x3079e0=_[_0xacaf('0x3b')]({},_0x3079e0,_0x4a99af[_0xacaf('0x3c')]);return db['Sound']['find'](_0x3079e0)[_0xacaf('0x20')](handleEntityNotFound(_0x1904d8,null))[_0xacaf('0x20')](respondWithResult(_0x1904d8,null))[_0xacaf('0x42')](handleError(_0x1904d8,null));};exports[_0xacaf('0x46')]=function(_0x35e12a,_0x557482,_0x11f254){return db['Sound'][_0xacaf('0x47')]({'where':{'id':_0x35e12a['params']['id']},'attributes':['name',_0xacaf('0x48'),_0xacaf('0x49')],'raw':!![]})[_0xacaf('0x20')](handleEntityNotFound(_0x557482,null))['then'](function(_0x1c395e){if(_0x1c395e){if(!fs['existsSync'](path[_0xacaf('0x4a')](config[_0xacaf('0x4b')],'server/files/sounds/converted',_0x1c395e['save_name']+'.'+_0x1c395e[_0xacaf('0x49')]))){throw new db[(_0xacaf('0x4c'))][(_0xacaf('0x4d'))](_0xacaf('0x4e'));}return _0x557482['download'](path[_0xacaf('0x4a')](config['root'],'server/files/sounds/converted',util['format'](_0xacaf('0x4f'),_0x1c395e[_0xacaf('0x48')],_0x1c395e[_0xacaf('0x49')])),util[_0xacaf('0x50')](_0xacaf('0x4f'),_0x1c395e['name'],_0x1c395e['converted_format']));}return null;})['catch'](handleError(_0x557482,null));};exports[_0xacaf('0x51')]=function(_0x61c066,_0x5ba1f7,_0xebbafd){var _0x3171b2={'name':path[_0xacaf('0x52')](_0x61c066[_0xacaf('0x53')]['originalname'],path[_0xacaf('0x54')](_0x61c066[_0xacaf('0x53')][_0xacaf('0x55')])),'save_name':path['basename'](_0x61c066['file'][_0xacaf('0x56')],path[_0xacaf('0x54')](_0x61c066['file']['filename'])),'original_format':path[_0xacaf('0x54')](_0x61c066[_0xacaf('0x53')]['originalname'])[_0xacaf('0x57')](0x1),'converted_format':_0xacaf('0x58')};var _0x44fa31=path['join'](config[_0xacaf('0x4b')],_0xacaf('0x59'),_0x61c066[_0xacaf('0x53')][_0xacaf('0x56')]);var _0x82e1f9=path[_0xacaf('0x4a')](config[_0xacaf('0x4b')],_0xacaf('0x5a'),util[_0xacaf('0x50')]('%s.%s',path['basename'](_0x61c066['file'][_0xacaf('0x56')],path[_0xacaf('0x54')](_0x61c066[_0xacaf('0x53')][_0xacaf('0x56')])),_0x3171b2[_0xacaf('0x49')]));logger['info']('Sound\x20upload\x20filepath:\x20%s',_0x44fa31);logger[_0xacaf('0x5b')](_0xacaf('0x5c'),_0x82e1f9);try{fs[_0xacaf('0x5d')](_0x44fa31,parseInt(_0xacaf('0x5e'),0x8));var _0x407380=sox[_0xacaf('0x5f')](_0x44fa31,_0x82e1f9,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x407380['on'](_0xacaf('0x25'),function(_0x440536){fs[_0xacaf('0x60')](_0x44fa31);_0x5ba1f7[_0xacaf('0x15')](0x1f4)[_0xacaf('0x28')](_0x440536);});_0x407380['on'](_0xacaf('0x61'),function(_0x50d32b){_0x3171b2[_0xacaf('0x62')]=isNaN(_0x50d32b[_0xacaf('0x63')])?null:_0x50d32b[_0xacaf('0x63')]*0x3e8;_0x3171b2[_0xacaf('0x64')]=isNaN(_0x50d32b[_0xacaf('0x65')])?null:_0x50d32b[_0xacaf('0x65')];_0x3171b2[_0xacaf('0x66')]=isNaN(_0x50d32b[_0xacaf('0x67')])?null:_0x50d32b['channelCount'];_0x3171b2[_0xacaf('0x68')]=isNaN(_0x50d32b[_0xacaf('0x69')])?null:_0x50d32b[_0xacaf('0x69')];_0x3171b2[_0xacaf('0x6a')]=isNaN(_0x50d32b[_0xacaf('0x6b')])?null:_0x50d32b['sampleRate'];});_0x407380['on'](_0xacaf('0x6c'),function(_0x14c148){_0x3171b2[_0xacaf('0x6d')]=isNaN(_0x14c148[_0xacaf('0x63')])?null:_0x14c148[_0xacaf('0x63')]*0x3e8;_0x3171b2['converted_sampleCount']=isNaN(_0x14c148[_0xacaf('0x65')])?null:_0x14c148[_0xacaf('0x65')];_0x3171b2[_0xacaf('0x6e')]=isNaN(_0x14c148[_0xacaf('0x67')])?null:_0x14c148[_0xacaf('0x67')];_0x3171b2[_0xacaf('0x6f')]=isNaN(_0x14c148[_0xacaf('0x69')])?null:_0x14c148[_0xacaf('0x69')];_0x3171b2['converted_sampleRate']=isNaN(_0x14c148[_0xacaf('0x6b')])?null:_0x14c148[_0xacaf('0x6b')];});_0x407380['on'](_0xacaf('0x23'),function(){fs[_0xacaf('0x5d')](_0x82e1f9,parseInt('0777',0x8));return db[_0xacaf('0x3d')][_0xacaf('0x51')](_0x3171b2)[_0xacaf('0x20')](function(_0x2e3a66){var _0x508cea={'role':_0x61c066[_0xacaf('0x70')][_0xacaf('0x71')],'userProfileId':_0x61c066[_0xacaf('0x70')][_0xacaf('0x72')]};if(!_0x508cea)throw new Error(_0xacaf('0x73'));if(_0x508cea[_0xacaf('0x71')]==='user'){var _0x43c4b9=_0x2e3a66[_0xacaf('0x21')]({'plain':!![]});return db['UserProfileSection'][_0xacaf('0x47')]({'where':{'name':_0xacaf('0x22'),'userProfileId':_0x508cea['userProfileId']},'raw':!![]})[_0xacaf('0x20')](function(_0x49d7fe){if(_0x49d7fe&&_0x49d7fe[_0xacaf('0x74')]===0x0){return db[_0xacaf('0x75')][_0xacaf('0x51')]({'name':_0x43c4b9['name'],'resourceId':_0x43c4b9['id'],'type':_0x49d7fe[_0xacaf('0x27')],'sectionId':_0x49d7fe['id']},{})[_0xacaf('0x20')](function(){return _0x2e3a66;});}else{return _0x2e3a66;}})[_0xacaf('0x42')](function(_0x38db56){logger[_0xacaf('0x25')](_0xacaf('0x76'),_0x38db56);throw _0x38db56;});}return _0x2e3a66;})[_0xacaf('0x20')](respondWithResult(_0x5ba1f7,null))['catch'](handleError(_0x5ba1f7,null));});_0x407380[_0xacaf('0x77')]();}catch(_0x3eb9c4){_0x5ba1f7[_0xacaf('0x15')](0x1f4)[_0xacaf('0x28')](_0x3eb9c4);}};exports[_0xacaf('0x1f')]=function(_0x38f321,_0x6ad40a,_0x37d7b2){return db[_0xacaf('0x3d')][_0xacaf('0x47')]({'where':{'id':_0x38f321['params']['id']}})['then'](handleEntityNotFound(_0x6ad40a,null))['then'](saveUpdates(_[_0xacaf('0x78')](_0x38f321[_0xacaf('0x70')],[_0xacaf('0x27'),_0xacaf('0x79')]),null))[_0xacaf('0x20')](respondWithResult(_0x6ad40a,null))[_0xacaf('0x42')](handleError(_0x6ad40a,null));};exports['delete']=function(_0x3481ba,_0xb6678,_0x5f112c){return db[_0xacaf('0x3d')][_0xacaf('0x47')]({'where':{'id':_0x3481ba[_0xacaf('0x44')]['id']}})['then'](function(_0x1086f6){if(_0x1086f6){return _0x1086f6[_0xacaf('0x7a')]();}})[_0xacaf('0x20')](function(_0x2de37d){var _0x564c55=path[_0xacaf('0x4a')](config['root'],_0xacaf('0x59'),util[_0xacaf('0x50')](_0xacaf('0x4f'),_0x2de37d['save_name'],_0x2de37d['original_format']));var _0x18755b=path[_0xacaf('0x4a')](config[_0xacaf('0x4b')],_0xacaf('0x5a'),util[_0xacaf('0x50')](_0xacaf('0x4f'),_0x2de37d['save_name'],_0x2de37d['converted_format']));fs[_0xacaf('0x60')](_0x564c55);fs[_0xacaf('0x60')](_0x18755b);return _0x2de37d;})[_0xacaf('0x20')](function(_0x4cccbc){if(_0x4cccbc){return _0xb6678[_0xacaf('0x15')](0xcc)[_0xacaf('0x23')]();}})[_0xacaf('0x20')](handleEntityNotFound(_0xb6678,null))[_0xacaf('0x42')](handleError(_0xb6678,null));}; \ No newline at end of file +var _0x86c0=['pick','filter','type','merge','options','includeAll','rows','catch','show','params','rawAttributes','include','find','download','save_name','converted_format','existsSync','root','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','format','%s.%s','create','basename','file','originalname','filename','extname','substring','wav','join','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','transcode','unlinkSync','send','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','0777','body','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','start','description','delete','original_format','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','fs-extra','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Sounds','UserProfileResource','error','stack','name','map','Sound','fieldName','key','query','keys','filters','intersection','model','attributes','fields','nolimit','order','sort','where'];(function(_0x3b4dd9,_0x21be95){var _0x32b6b6=function(_0x598ead){while(--_0x598ead){_0x3b4dd9['push'](_0x3b4dd9['shift']());}};_0x32b6b6(++_0x21be95);}(_0x86c0,0x146));var _0x086c=function(_0x595e19,_0x53b559){_0x595e19=_0x595e19-0x0;var _0x27ceae=_0x86c0[_0x595e19];return _0x27ceae;};'use strict';var emlformat=require(_0x086c('0x0'));var rimraf=require(_0x086c('0x1'));var zipdir=require(_0x086c('0x2'));var jsonpatch=require(_0x086c('0x3'));var rp=require('request-promise');var moment=require(_0x086c('0x4'));var BPromise=require(_0x086c('0x5'));var Mustache=require(_0x086c('0x6'));var util=require(_0x086c('0x7'));var path=require(_0x086c('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x086c('0x9'));var _=require('lodash');var squel=require(_0x086c('0xa'));var crypto=require('crypto');var jsforce=require(_0x086c('0xb'));var deskjs=require(_0x086c('0xc'));var toCsv=require(_0x086c('0xd'));var querystring=require(_0x086c('0xe'));var Papa=require('papaparse');var Redis=require(_0x086c('0xf'));var authService=require(_0x086c('0x10'));var qs=require(_0x086c('0x11'));var as=require(_0x086c('0x12'));var hardwareService=require(_0x086c('0x13'));var logger=require('../../config/logger')(_0x086c('0x14'));var utils=require('../../config/utils');var config=require(_0x086c('0x15'));var licenseUtil=require(_0x086c('0x16'));var db=require(_0x086c('0x17'))['db'];function respondWithStatusCode(_0x47c0ed,_0x7d4496){_0x7d4496=_0x7d4496||0xcc;return function(_0x269c07){if(_0x269c07){return _0x47c0ed[_0x086c('0x18')](_0x7d4496);}return _0x47c0ed['status'](_0x7d4496)[_0x086c('0x19')]();};}function respondWithResult(_0x22d6dc,_0x133869){_0x133869=_0x133869||0xc8;return function(_0x478ea3){if(_0x478ea3){return _0x22d6dc[_0x086c('0x1a')](_0x133869)[_0x086c('0x1b')](_0x478ea3);}};}function respondWithFilteredResult(_0x29accd,_0x28b24b){return function(_0x85e6c4){if(_0x85e6c4){var _0x614f6b=typeof _0x28b24b[_0x086c('0x1c')]===_0x086c('0x1d')&&typeof _0x28b24b[_0x086c('0x1e')]===_0x086c('0x1d');var _0x58cd88=_0x85e6c4['count'];var _0x5393e2=_0x614f6b?0x0:_0x28b24b[_0x086c('0x1c')];var _0x42df76=_0x614f6b?_0x85e6c4[_0x086c('0x1f')]:_0x28b24b[_0x086c('0x1c')]+_0x28b24b[_0x086c('0x1e')];var _0x58afd8;if(_0x42df76>=_0x58cd88){_0x42df76=_0x58cd88;_0x58afd8=0xc8;}else{_0x58afd8=0xce;}_0x29accd['status'](_0x58afd8);return _0x29accd[_0x086c('0x20')](_0x086c('0x21'),_0x5393e2+'-'+_0x42df76+'/'+_0x58cd88)[_0x086c('0x1b')](_0x85e6c4);}return null;};}function patchUpdates(_0x553d70){return function(_0x9405b4){try{jsonpatch[_0x086c('0x22')](_0x9405b4,_0x553d70,!![]);}catch(_0x575760){return BPromise[_0x086c('0x23')](_0x575760);}return _0x9405b4[_0x086c('0x24')]();};}function saveUpdates(_0x535cb9,_0x5c8d8e){return function(_0x32811e){if(_0x32811e){return _0x32811e[_0x086c('0x25')](_0x535cb9)[_0x086c('0x26')](function(_0x43f712){return _0x43f712;});}return null;};}function removeEntity(_0x3d176d,_0x1c6c30){return function(_0x502dd7){if(_0x502dd7){return _0x502dd7[_0x086c('0x27')]()[_0x086c('0x26')](function(){var _0x5c5007=_0x502dd7[_0x086c('0x28')]({'plain':!![]});var _0x12271e=_0x086c('0x29');return db[_0x086c('0x2a')][_0x086c('0x27')]({'where':{'type':_0x12271e,'resourceId':_0x5c5007['id']}})[_0x086c('0x26')](function(){return _0x502dd7;});})[_0x086c('0x26')](function(){_0x3d176d['status'](0xcc)[_0x086c('0x19')]();});}};}function handleEntityNotFound(_0x4c3f60,_0x3b0f38){return function(_0x2ac76b){if(!_0x2ac76b){_0x4c3f60['sendStatus'](0x194);}return _0x2ac76b;};}function handleError(_0x1ddae5,_0x489ace){_0x489ace=_0x489ace||0x1f4;return function(_0x54ad4e){logger[_0x086c('0x2b')](_0x54ad4e[_0x086c('0x2c')]);if(_0x54ad4e[_0x086c('0x2d')]){delete _0x54ad4e['name'];}_0x1ddae5[_0x086c('0x1a')](_0x489ace)['send'](_0x54ad4e);};}exports['index']=function(_0x4575e1,_0x258b50){var _0x1a7d36={},_0x2fa741={},_0x154272={'count':0x0,'rows':[]};var _0x1f4608=_[_0x086c('0x2e')](db[_0x086c('0x2f')]['rawAttributes'],function(_0x168a06){return{'name':_0x168a06[_0x086c('0x30')],'type':_0x168a06['type'][_0x086c('0x31')]};});_0x2fa741['model']=_[_0x086c('0x2e')](_0x1f4608,_0x086c('0x2d'));_0x2fa741[_0x086c('0x32')]=_[_0x086c('0x33')](_0x4575e1[_0x086c('0x32')]);_0x2fa741[_0x086c('0x34')]=_[_0x086c('0x35')](_0x2fa741[_0x086c('0x36')],_0x2fa741[_0x086c('0x32')]);_0x1a7d36[_0x086c('0x37')]=_['intersection'](_0x2fa741[_0x086c('0x36')],qs['fields'](_0x4575e1[_0x086c('0x32')][_0x086c('0x38')]));_0x1a7d36[_0x086c('0x37')]=_0x1a7d36[_0x086c('0x37')]['length']?_0x1a7d36['attributes']:_0x2fa741[_0x086c('0x36')];if(!_0x4575e1[_0x086c('0x32')]['hasOwnProperty'](_0x086c('0x39'))){_0x1a7d36[_0x086c('0x1e')]=qs[_0x086c('0x1e')](_0x4575e1[_0x086c('0x32')]['limit']);_0x1a7d36[_0x086c('0x1c')]=qs[_0x086c('0x1c')](_0x4575e1[_0x086c('0x32')][_0x086c('0x1c')]);}_0x1a7d36[_0x086c('0x3a')]=qs[_0x086c('0x3b')](_0x4575e1[_0x086c('0x32')][_0x086c('0x3b')]);_0x1a7d36[_0x086c('0x3c')]=qs['filters'](_[_0x086c('0x3d')](_0x4575e1[_0x086c('0x32')],_0x2fa741['filters']),_0x1f4608);if(_0x4575e1[_0x086c('0x32')][_0x086c('0x3e')]){_0x1a7d36[_0x086c('0x3c')]=_['merge'](_0x1a7d36['where'],{'$or':_[_0x086c('0x2e')](_0x1f4608,function(_0x2b92b7){if(_0x2b92b7[_0x086c('0x3f')]!=='VIRTUAL'){var _0xbb5920={};_0xbb5920[_0x2b92b7[_0x086c('0x2d')]]={'$like':'%'+_0x4575e1['query']['filter']+'%'};return _0xbb5920;}})});}_0x1a7d36=_[_0x086c('0x40')]({},_0x1a7d36,_0x4575e1[_0x086c('0x41')]);var _0x5c1770={'where':_0x1a7d36[_0x086c('0x3c')]};return db[_0x086c('0x2f')][_0x086c('0x1f')](_0x5c1770)[_0x086c('0x26')](function(_0x309ddd){_0x154272[_0x086c('0x1f')]=_0x309ddd;if(_0x4575e1[_0x086c('0x32')][_0x086c('0x42')]){_0x1a7d36['include']=[{'all':!![]}];}return db[_0x086c('0x2f')]['findAll'](_0x1a7d36);})[_0x086c('0x26')](function(_0xc15460){_0x154272[_0x086c('0x43')]=_0xc15460;return _0x154272;})['then'](respondWithFilteredResult(_0x258b50,_0x1a7d36))[_0x086c('0x44')](handleError(_0x258b50,null));};exports[_0x086c('0x45')]=function(_0x5eaab6,_0x111ac1){var _0x58665e={'raw':!![],'where':{'id':_0x5eaab6[_0x086c('0x46')]['id']}},_0x5d1c0c={};_0x5d1c0c['model']=_['keys'](db[_0x086c('0x2f')][_0x086c('0x47')]);_0x5d1c0c['query']=_[_0x086c('0x33')](_0x5eaab6[_0x086c('0x32')]);_0x5d1c0c[_0x086c('0x34')]=_[_0x086c('0x35')](_0x5d1c0c['model'],_0x5d1c0c['query']);_0x58665e[_0x086c('0x37')]=_['intersection'](_0x5d1c0c[_0x086c('0x36')],qs[_0x086c('0x38')](_0x5eaab6[_0x086c('0x32')][_0x086c('0x38')]));_0x58665e[_0x086c('0x37')]=_0x58665e['attributes']['length']?_0x58665e['attributes']:_0x5d1c0c[_0x086c('0x36')];if(_0x5eaab6[_0x086c('0x32')]['includeAll']){_0x58665e[_0x086c('0x48')]=[{'all':!![]}];}_0x58665e=_[_0x086c('0x40')]({},_0x58665e,_0x5eaab6['options']);return db['Sound'][_0x086c('0x49')](_0x58665e)[_0x086c('0x26')](handleEntityNotFound(_0x111ac1,null))[_0x086c('0x26')](respondWithResult(_0x111ac1,null))[_0x086c('0x44')](handleError(_0x111ac1,null));};exports[_0x086c('0x4a')]=function(_0x3cc1ce,_0x12bc88,_0x3dfe4d){return db[_0x086c('0x2f')][_0x086c('0x49')]({'where':{'id':_0x3cc1ce['params']['id']},'attributes':['name',_0x086c('0x4b'),_0x086c('0x4c')],'raw':!![]})[_0x086c('0x26')](handleEntityNotFound(_0x12bc88,null))[_0x086c('0x26')](function(_0x59b163){if(_0x59b163){if(!fs[_0x086c('0x4d')](path['join'](config[_0x086c('0x4e')],_0x086c('0x4f'),_0x59b163['save_name']+'.'+_0x59b163[_0x086c('0x4c')]))){throw new db[(_0x086c('0x50'))][(_0x086c('0x51'))](_0x086c('0x52'));}return _0x12bc88[_0x086c('0x4a')](path['join'](config['root'],_0x086c('0x4f'),util[_0x086c('0x53')](_0x086c('0x54'),_0x59b163[_0x086c('0x4b')],_0x59b163['converted_format'])),util['format']('%s.%s',_0x59b163['name'],_0x59b163[_0x086c('0x4c')]));}return null;})[_0x086c('0x44')](handleError(_0x12bc88,null));};exports[_0x086c('0x55')]=function(_0x16fd76,_0x467c3f,_0x275c51){var _0x406acd={'name':path[_0x086c('0x56')](_0x16fd76[_0x086c('0x57')][_0x086c('0x58')],path['extname'](_0x16fd76[_0x086c('0x57')][_0x086c('0x58')])),'save_name':path[_0x086c('0x56')](_0x16fd76['file'][_0x086c('0x59')],path[_0x086c('0x5a')](_0x16fd76[_0x086c('0x57')]['filename'])),'original_format':path[_0x086c('0x5a')](_0x16fd76[_0x086c('0x57')][_0x086c('0x58')])[_0x086c('0x5b')](0x1),'converted_format':_0x086c('0x5c')};var _0x2402ed=path[_0x086c('0x5d')](config[_0x086c('0x4e')],_0x086c('0x5e'),_0x16fd76[_0x086c('0x57')][_0x086c('0x59')]);var _0x5cbe32=path['join'](config[_0x086c('0x4e')],_0x086c('0x4f'),util[_0x086c('0x53')](_0x086c('0x54'),path[_0x086c('0x56')](_0x16fd76[_0x086c('0x57')][_0x086c('0x59')],path[_0x086c('0x5a')](_0x16fd76['file'][_0x086c('0x59')])),_0x406acd[_0x086c('0x4c')]));logger[_0x086c('0x5f')](_0x086c('0x60'),_0x2402ed);logger[_0x086c('0x5f')](_0x086c('0x61'),_0x5cbe32);try{fs[_0x086c('0x62')](_0x2402ed,parseInt('0777',0x8));var _0x7a97cf=sox[_0x086c('0x63')](_0x2402ed,_0x5cbe32,{'sampleRate':0x1f40,'format':_0x086c('0x5c'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x7a97cf['on'](_0x086c('0x2b'),function(_0x1e8c97){fs[_0x086c('0x64')](_0x2402ed);_0x467c3f[_0x086c('0x1a')](0x1f4)[_0x086c('0x65')](_0x1e8c97);});_0x7a97cf['on'](_0x086c('0x66'),function(_0x1cca7e){_0x406acd[_0x086c('0x67')]=isNaN(_0x1cca7e[_0x086c('0x68')])?null:_0x1cca7e['duration']*0x3e8;_0x406acd[_0x086c('0x69')]=isNaN(_0x1cca7e[_0x086c('0x6a')])?null:_0x1cca7e[_0x086c('0x6a')];_0x406acd[_0x086c('0x6b')]=isNaN(_0x1cca7e[_0x086c('0x6c')])?null:_0x1cca7e['channelCount'];_0x406acd['original_bitRate']=isNaN(_0x1cca7e[_0x086c('0x6d')])?null:_0x1cca7e[_0x086c('0x6d')];_0x406acd[_0x086c('0x6e')]=isNaN(_0x1cca7e[_0x086c('0x6f')])?null:_0x1cca7e[_0x086c('0x6f')];});_0x7a97cf['on'](_0x086c('0x70'),function(_0x22cc6c){_0x406acd[_0x086c('0x71')]=isNaN(_0x22cc6c['duration'])?null:_0x22cc6c[_0x086c('0x68')]*0x3e8;_0x406acd[_0x086c('0x72')]=isNaN(_0x22cc6c[_0x086c('0x6a')])?null:_0x22cc6c[_0x086c('0x6a')];_0x406acd[_0x086c('0x73')]=isNaN(_0x22cc6c[_0x086c('0x6c')])?null:_0x22cc6c[_0x086c('0x6c')];_0x406acd[_0x086c('0x74')]=isNaN(_0x22cc6c['bitRate'])?null:_0x22cc6c[_0x086c('0x6d')];_0x406acd['converted_sampleRate']=isNaN(_0x22cc6c['sampleRate'])?null:_0x22cc6c['sampleRate'];});_0x7a97cf['on'](_0x086c('0x19'),function(){fs['chmodSync'](_0x5cbe32,parseInt(_0x086c('0x75'),0x8));return db[_0x086c('0x2f')][_0x086c('0x55')](_0x406acd)[_0x086c('0x26')](function(_0x896329){var _0x2ecd3b={'role':_0x16fd76[_0x086c('0x76')][_0x086c('0x77')],'userProfileId':_0x16fd76['body']['userProfileId']};if(!_0x2ecd3b)throw new Error(_0x086c('0x78'));if(_0x2ecd3b[_0x086c('0x77')]===_0x086c('0x79')){var _0x38486b=_0x896329[_0x086c('0x28')]({'plain':!![]});return db[_0x086c('0x7a')][_0x086c('0x49')]({'where':{'name':'Sounds','userProfileId':_0x2ecd3b[_0x086c('0x7b')]},'raw':!![]})[_0x086c('0x26')](function(_0x5c4883){if(_0x5c4883&&_0x5c4883[_0x086c('0x7c')]===0x0){return db[_0x086c('0x2a')][_0x086c('0x55')]({'name':_0x38486b[_0x086c('0x2d')],'resourceId':_0x38486b['id'],'type':_0x5c4883[_0x086c('0x2d')],'sectionId':_0x5c4883['id']},{})['then'](function(){return _0x896329;});}else{return _0x896329;}})['catch'](function(_0x7b9abd){logger[_0x086c('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x7b9abd);throw _0x7b9abd;});}return _0x896329;})['then'](respondWithResult(_0x467c3f,null))[_0x086c('0x44')](handleError(_0x467c3f,null));});_0x7a97cf[_0x086c('0x7d')]();}catch(_0x388dfb){_0x467c3f[_0x086c('0x1a')](0x1f4)[_0x086c('0x65')](_0x388dfb);}};exports[_0x086c('0x25')]=function(_0x15bfe9,_0x18a03f,_0x449827){return db[_0x086c('0x2f')][_0x086c('0x49')]({'where':{'id':_0x15bfe9[_0x086c('0x46')]['id']}})[_0x086c('0x26')](handleEntityNotFound(_0x18a03f,null))[_0x086c('0x26')](saveUpdates(_['pick'](_0x15bfe9['body'],[_0x086c('0x2d'),_0x086c('0x7e')]),null))[_0x086c('0x26')](respondWithResult(_0x18a03f,null))[_0x086c('0x44')](handleError(_0x18a03f,null));};exports[_0x086c('0x7f')]=function(_0x207043,_0x4d39f3,_0x3b36ae){return db[_0x086c('0x2f')][_0x086c('0x49')]({'where':{'id':_0x207043[_0x086c('0x46')]['id']}})[_0x086c('0x26')](function(_0x195e5d){if(_0x195e5d){return _0x195e5d[_0x086c('0x27')]();}})[_0x086c('0x26')](function(_0x47a98e){var _0x27125e=path[_0x086c('0x5d')](config[_0x086c('0x4e')],_0x086c('0x5e'),util[_0x086c('0x53')](_0x086c('0x54'),_0x47a98e['save_name'],_0x47a98e[_0x086c('0x80')]));var _0x180f0f=path[_0x086c('0x5d')](config['root'],_0x086c('0x4f'),util[_0x086c('0x53')](_0x086c('0x54'),_0x47a98e[_0x086c('0x4b')],_0x47a98e[_0x086c('0x4c')]));fs[_0x086c('0x64')](_0x27125e);fs[_0x086c('0x64')](_0x180f0f);return _0x47a98e;})[_0x086c('0x26')](function(_0x46d8a9){if(_0x46d8a9){return _0x4d39f3[_0x086c('0x1a')](0xcc)[_0x086c('0x19')]();}})[_0x086c('0x26')](handleEntityNotFound(_0x4d39f3,null))[_0x086c('0x44')](handleError(_0x4d39f3,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index d87994a..cdca369 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 _0x01d2=['rimraf','exports','define','Sound','tools_sounds','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x6abd55,_0x2ccc21){var _0x212484=function(_0x16bcbf){while(--_0x16bcbf){_0x6abd55['push'](_0x6abd55['shift']());}};_0x212484(++_0x2ccc21);}(_0x01d2,0x9b));var _0x201d=function(_0x1dd75e,_0x471222){_0x1dd75e=_0x1dd75e-0x0;var _0x10981b=_0x01d2[_0x1dd75e];return _0x10981b;};'use strict';var _=require(_0x201d('0x0'));var util=require('util');var logger=require(_0x201d('0x1'))(_0x201d('0x2'));var moment=require('moment');var BPromise=require(_0x201d('0x3'));var rp=require(_0x201d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x201d('0x5'));var config=require('../../config/environment');var attributes=require('./sound.attributes');module[_0x201d('0x6')]=function(_0x10e90d,_0x1c271b){return _0x10e90d[_0x201d('0x7')](_0x201d('0x8'),attributes,{'tableName':_0x201d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3527=['exports','Sound','tools_sounds','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2b5eae,_0x55010d){var _0x5f3ac9=function(_0x397bfc){while(--_0x397bfc){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x5f3ac9(++_0x55010d);}(_0x3527,0x12c));var _0x7352=function(_0x5cb97e,_0x132a39){_0x5cb97e=_0x5cb97e-0x0;var _0x1714b4=_0x3527[_0x5cb97e];return _0x1714b4;};'use strict';var _=require('lodash');var util=require(_0x7352('0x0'));var logger=require(_0x7352('0x1'))('api');var moment=require(_0x7352('0x2'));var BPromise=require(_0x7352('0x3'));var rp=require(_0x7352('0x4'));var fs=require('fs');var path=require(_0x7352('0x5'));var rimraf=require(_0x7352('0x6'));var config=require(_0x7352('0x7'));var attributes=require('./sound.attributes');module[_0x7352('0x8')]=function(_0x3e7585,_0x182ecc){return _0x3e7585['define'](_0x7352('0x9'),attributes,{'tableName':_0x7352('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index f18979b..932e7de 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 _0xe510=['debug','stringify','error','code','Sound,\x20%s,\x20%s','message','result','catch','ShowSound','find','options','raw','where','include','model','map','attributes','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','request','info','request\x20sent'];(function(_0x3ff450,_0x4fa9d9){var _0x38c58f=function(_0xb87ade){while(--_0xb87ade){_0x3ff450['push'](_0x3ff450['shift']());}};_0x38c58f(++_0x4fa9d9);}(_0xe510,0xcc));var _0x0e51=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0xe510[_0x25e7cb];return _0x375d92;};'use strict';var _=require(_0x0e51('0x0'));var util=require(_0x0e51('0x1'));var moment=require(_0x0e51('0x2'));var BPromise=require(_0x0e51('0x3'));var rs=require(_0x0e51('0x4'));var fs=require('fs');var Redis=require(_0x0e51('0x5'));var db=require(_0x0e51('0x6'))['db'];var utils=require(_0x0e51('0x7'));var logger=require(_0x0e51('0x8'))(_0x0e51('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4b1bc9,_0x2ee3d6,_0x151356){return new BPromise(function(_0x59489e,_0x4e9dc1){return client[_0x0e51('0xa')](_0x4b1bc9,_0x151356)['then'](function(_0x2b0afa){logger[_0x0e51('0xb')]('Sound,\x20%s,\x20%s',_0x2ee3d6,_0x0e51('0xc'));logger[_0x0e51('0xd')]('Sound,\x20%s,\x20%s,\x20%s',_0x2ee3d6,'request\x20sent',JSON[_0x0e51('0xe')](_0x2b0afa));if(_0x2b0afa['error']){if(_0x2b0afa[_0x0e51('0xf')][_0x0e51('0x10')]===0x1f4){logger[_0x0e51('0xf')](_0x0e51('0x11'),_0x2ee3d6,_0x2b0afa[_0x0e51('0xf')][_0x0e51('0x12')]);return _0x4e9dc1(_0x2b0afa[_0x0e51('0xf')][_0x0e51('0x12')]);}logger[_0x0e51('0xf')]('Sound,\x20%s,\x20%s',_0x2ee3d6,_0x2b0afa['error'][_0x0e51('0x12')]);return _0x59489e(_0x2b0afa[_0x0e51('0xf')][_0x0e51('0x12')]);}else{logger[_0x0e51('0xb')](_0x0e51('0x11'),_0x2ee3d6,_0x0e51('0xc'));_0x59489e(_0x2b0afa[_0x0e51('0x13')][_0x0e51('0x12')]);}})[_0x0e51('0x14')](function(_0x639507){logger[_0x0e51('0xf')](_0x0e51('0x11'),_0x2ee3d6,_0x639507);_0x4e9dc1(_0x639507);});});}exports[_0x0e51('0x15')]=function(_0x24363b){var _0x53eda3=this;return new Promise(function(_0x16977a,_0x3f97cf){return db['Sound'][_0x0e51('0x16')]({'raw':_0x24363b['options']?_0x24363b[_0x0e51('0x17')][_0x0e51('0x18')]===undefined?!![]:![]:!![],'where':_0x24363b[_0x0e51('0x17')]?_0x24363b['options'][_0x0e51('0x19')]||null:null,'attributes':_0x24363b[_0x0e51('0x17')]?_0x24363b[_0x0e51('0x17')]['attributes']||null:null,'include':_0x24363b['options']?_0x24363b['options'][_0x0e51('0x1a')]?_['map'](_0x24363b[_0x0e51('0x17')]['include'],function(_0x31f5d4){return{'model':db[_0x31f5d4[_0x0e51('0x1b')]],'as':_0x31f5d4['as'],'attributes':_0x31f5d4['attributes'],'include':_0x31f5d4['include']?_[_0x0e51('0x1c')](_0x31f5d4[_0x0e51('0x1a')],function(_0xd89bb0){return{'model':db[_0xd89bb0['model']],'as':_0xd89bb0['as'],'attributes':_0xd89bb0['attributes'],'include':_0xd89bb0[_0x0e51('0x1a')]?_[_0x0e51('0x1c')](_0xd89bb0['include'],function(_0x1b9924){return{'model':db[_0x1b9924[_0x0e51('0x1b')]],'as':_0x1b9924['as'],'attributes':_0x1b9924[_0x0e51('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x0e51('0x1e')](function(_0x4dd83f){logger[_0x0e51('0xb')](_0x0e51('0x15'),_0x24363b);logger[_0x0e51('0xd')](_0x0e51('0x15'),_0x24363b,JSON[_0x0e51('0xe')](_0x4dd83f));_0x16977a(_0x4dd83f);})[_0x0e51('0x14')](function(_0x4e1088){logger[_0x0e51('0xf')]('ShowSound',_0x4e1088[_0x0e51('0x12')],_0x24363b);_0x3f97cf(_0x53eda3[_0x0e51('0xf')](0x1f4,_0x4e1088['message']));});});}; \ No newline at end of file +var _0x6f93=['../../config/logger','../../config/environment','jayson/promise','client','http','info','request\x20sent','Sound,\x20%s,\x20%s,\x20%s','error','code','Sound,\x20%s,\x20%s','message','catch','ShowSound','options','where','include','map','attributes','then','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x43c478,_0xc7e72a){var _0x5f4e0e=function(_0x371d67){while(--_0x371d67){_0x43c478['push'](_0x43c478['shift']());}};_0x5f4e0e(++_0xc7e72a);}(_0x6f93,0xa6));var _0x36f9=function(_0x11d99e,_0x4e9990){_0x11d99e=_0x11d99e-0x0;var _0x543926=_0x6f93[_0x11d99e];return _0x543926;};'use strict';var _=require(_0x36f9('0x0'));var util=require(_0x36f9('0x1'));var moment=require(_0x36f9('0x2'));var BPromise=require(_0x36f9('0x3'));var rs=require(_0x36f9('0x4'));var fs=require('fs');var Redis=require(_0x36f9('0x5'));var db=require(_0x36f9('0x6'))['db'];var utils=require(_0x36f9('0x7'));var logger=require(_0x36f9('0x8'))('rpc');var config=require(_0x36f9('0x9'));var jayson=require(_0x36f9('0xa'));var client=jayson[_0x36f9('0xb')][_0x36f9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x32ad7c,_0x2f1977,_0x401e81){return new BPromise(function(_0x442f36,_0xf15d57){return client['request'](_0x32ad7c,_0x401e81)['then'](function(_0x10f883){logger[_0x36f9('0xd')]('Sound,\x20%s,\x20%s',_0x2f1977,_0x36f9('0xe'));logger['debug'](_0x36f9('0xf'),_0x2f1977,'request\x20sent',JSON['stringify'](_0x10f883));if(_0x10f883[_0x36f9('0x10')]){if(_0x10f883['error'][_0x36f9('0x11')]===0x1f4){logger[_0x36f9('0x10')](_0x36f9('0x12'),_0x2f1977,_0x10f883[_0x36f9('0x10')][_0x36f9('0x13')]);return _0xf15d57(_0x10f883[_0x36f9('0x10')][_0x36f9('0x13')]);}logger[_0x36f9('0x10')]('Sound,\x20%s,\x20%s',_0x2f1977,_0x10f883[_0x36f9('0x10')][_0x36f9('0x13')]);return _0x442f36(_0x10f883[_0x36f9('0x10')][_0x36f9('0x13')]);}else{logger[_0x36f9('0xd')](_0x36f9('0x12'),_0x2f1977,_0x36f9('0xe'));_0x442f36(_0x10f883['result'][_0x36f9('0x13')]);}})[_0x36f9('0x14')](function(_0x449ac2){logger[_0x36f9('0x10')]('Sound,\x20%s,\x20%s',_0x2f1977,_0x449ac2);_0xf15d57(_0x449ac2);});});}exports[_0x36f9('0x15')]=function(_0x2af0ed){var _0x5af0ea=this;return new Promise(function(_0x2e694d,_0x3a9137){return db['Sound']['find']({'raw':_0x2af0ed[_0x36f9('0x16')]?_0x2af0ed[_0x36f9('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x2af0ed[_0x36f9('0x16')]?_0x2af0ed[_0x36f9('0x16')][_0x36f9('0x17')]||null:null,'attributes':_0x2af0ed[_0x36f9('0x16')]?_0x2af0ed['options']['attributes']||null:null,'include':_0x2af0ed[_0x36f9('0x16')]?_0x2af0ed[_0x36f9('0x16')][_0x36f9('0x18')]?_[_0x36f9('0x19')](_0x2af0ed['options']['include'],function(_0x501c67){return{'model':db[_0x501c67['model']],'as':_0x501c67['as'],'attributes':_0x501c67['attributes'],'include':_0x501c67[_0x36f9('0x18')]?_['map'](_0x501c67[_0x36f9('0x18')],function(_0x4e3124){return{'model':db[_0x4e3124['model']],'as':_0x4e3124['as'],'attributes':_0x4e3124['attributes'],'include':_0x4e3124['include']?_[_0x36f9('0x19')](_0x4e3124[_0x36f9('0x18')],function(_0x5f1e07){return{'model':db[_0x5f1e07['model']],'as':_0x5f1e07['as'],'attributes':_0x5f1e07[_0x36f9('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x36f9('0x1b')](function(_0x5a3441){logger[_0x36f9('0xd')](_0x36f9('0x15'),_0x2af0ed);logger['debug'](_0x36f9('0x15'),_0x2af0ed,JSON[_0x36f9('0x1c')](_0x5a3441));_0x2e694d(_0x5a3441);})['catch'](function(_0x54b80b){logger[_0x36f9('0x10')](_0x36f9('0x15'),_0x54b80b['message'],_0x2af0ed);_0x3a9137(_0x5af0ea[_0x36f9('0x10')](0x1f4,_0x54b80b['message']));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index cffbc27..2d00424 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 _0x4fc2=['show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./squareMessage.controller','isAuthenticated','index','/:id'];(function(_0x554292,_0x82948a){var _0x3dd555=function(_0xab7590){while(--_0xab7590){_0x554292['push'](_0x554292['shift']());}};_0x3dd555(++_0x82948a);}(_0x4fc2,0x111));var _0x24fc=function(_0x414fde,_0x153cf2){_0x414fde=_0x414fde-0x0;var _0x143152=_0x4fc2[_0x414fde];return _0x143152;};'use strict';var multer=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var path=require(_0x24fc('0x2'));var timeout=require(_0x24fc('0x3'));var express=require('express');var router=express[_0x24fc('0x4')]();var fs_extra=require(_0x24fc('0x5'));var auth=require(_0x24fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x24fc('0x7'));var controller=require(_0x24fc('0x8'));router['get']('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0xa')]);router['get'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0xc')]);router[_0x24fc('0xd')]('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0xe')]);router['put'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0xf')]);router[_0x24fc('0x10')](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x11')]);module[_0x24fc('0x12')]=router; \ No newline at end of file +var _0xac4a=['express','Router','../../components/interaction/service','../../config/environment','./squareMessage.controller','isAuthenticated','get','show','create','/:id','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x1d4f0a,_0x5c0077){var _0x46d0fb=function(_0x2b4588){while(--_0x2b4588){_0x1d4f0a['push'](_0x1d4f0a['shift']());}};_0x46d0fb(++_0x5c0077);}(_0xac4a,0x13f));var _0xaac4=function(_0x442239,_0x5350f1){_0x442239=_0x442239-0x0;var _0x5eb681=_0xac4a[_0x442239];return _0x5eb681;};'use strict';var multer=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var path=require(_0xaac4('0x2'));var timeout=require(_0xaac4('0x3'));var express=require(_0xaac4('0x4'));var router=express[_0xaac4('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xaac4('0x6'));var config=require(_0xaac4('0x7'));var controller=require(_0xaac4('0x8'));router['get']('/',auth[_0xaac4('0x9')](),controller['index']);router[_0xaac4('0xa')]('/:id',auth[_0xaac4('0x9')](),controller[_0xaac4('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xaac4('0xc')]);router['put'](_0xaac4('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xaac4('0xe')](_0xaac4('0xd'),auth[_0xaac4('0x9')](),controller[_0xaac4('0xf')]);module[_0xaac4('0x10')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index a9ce1b8..25ef6e7 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 _0xfbf9=['exports','TEXT','medium','ENUM','out','sequelize'];(function(_0x1ca12f,_0x267e27){var _0x395a43=function(_0x9c2f2){while(--_0x9c2f2){_0x1ca12f['push'](_0x1ca12f['shift']());}};_0x395a43(++_0x267e27);}(_0xfbf9,0x17f));var _0x9fbf=function(_0x2272b5,_0x362458){_0x2272b5=_0x2272b5-0x0;var _0x110156=_0xfbf9[_0x2272b5];return _0x110156;};'use strict';var Sequelize=require(_0x9fbf('0x0'));module[_0x9fbf('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize[_0x9fbf('0x2')](_0x9fbf('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0x9fbf('0x4')]('in',_0x9fbf('0x5')),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x9fbf('0x2')]}}; \ No newline at end of file +var _0xdf21=['exports','STRING','medium','ENUM','TEXT','sequelize'];(function(_0x5794f9,_0xf181f5){var _0x3675d9=function(_0x2efa89){while(--_0x2efa89){_0x5794f9['push'](_0x5794f9['shift']());}};_0x3675d9(++_0xf181f5);}(_0xdf21,0x179));var _0x1df2=function(_0x4c9108,_0x5d8c39){_0x4c9108=_0x4c9108-0x0;var _0xab17e0=_0xdf21[_0x4c9108];return _0xab17e0;};'use strict';var Sequelize=require(_0x1df2('0x0'));module[_0x1df2('0x1')]={'uniqueid':{'type':Sequelize[_0x1df2('0x2')]},'body':{'type':Sequelize['TEXT'](_0x1df2('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0x1df2('0x4')]('in','out'),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize[_0x1df2('0x2')]},'providerResponse':{'type':Sequelize[_0x1df2('0x5')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index c833d8e..8e881c6 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 _0xe1f0=['catch','show','params','keys','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','limit','count','Content-Range','reject','update','then','destroy','name','send','index','rawAttributes','type','key','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','SquareMessage','findAll','rows'];(function(_0x212fcc,_0x11ae02){var _0xdbfd64=function(_0xccf2c5){while(--_0xccf2c5){_0x212fcc['push'](_0x212fcc['shift']());}};_0xdbfd64(++_0x11ae02);}(_0xe1f0,0x1ea));var _0x0e1f=function(_0x543569,_0x28be0e){_0x543569=_0x543569-0x0;var _0x2558b0=_0xe1f0[_0x543569];return _0x2558b0;};'use strict';var emlformat=require(_0x0e1f('0x0'));var rimraf=require(_0x0e1f('0x1'));var zipdir=require(_0x0e1f('0x2'));var jsonpatch=require(_0x0e1f('0x3'));var rp=require(_0x0e1f('0x4'));var moment=require(_0x0e1f('0x5'));var BPromise=require(_0x0e1f('0x6'));var Mustache=require(_0x0e1f('0x7'));var util=require(_0x0e1f('0x8'));var path=require(_0x0e1f('0x9'));var sox=require(_0x0e1f('0xa'));var csv=require(_0x0e1f('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0e1f('0xc'));var squel=require('squel');var crypto=require(_0x0e1f('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x0e1f('0xe'));var toCsv=require(_0x0e1f('0xb'));var querystring=require(_0x0e1f('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x0e1f('0x10'));var as=require(_0x0e1f('0x11'));var hardwareService=require(_0x0e1f('0x12'));var logger=require('../../config/logger')(_0x0e1f('0x13'));var utils=require(_0x0e1f('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x0e1f('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x124cec,_0xc2abd8){_0xc2abd8=_0xc2abd8||0xcc;return function(_0x4bd123){if(_0x4bd123){return _0x124cec[_0x0e1f('0x16')](_0xc2abd8);}return _0x124cec[_0x0e1f('0x17')](_0xc2abd8)[_0x0e1f('0x18')]();};}function respondWithResult(_0x4e0d54,_0x5c235d){_0x5c235d=_0x5c235d||0xc8;return function(_0xc59f20){if(_0xc59f20){return _0x4e0d54[_0x0e1f('0x17')](_0x5c235d)[_0x0e1f('0x19')](_0xc59f20);}};}function respondWithFilteredResult(_0x3bd237,_0x59ece2){return function(_0x5a9ee8){if(_0x5a9ee8){var _0x2f6f20=typeof _0x59ece2[_0x0e1f('0x1a')]==='undefined'&&typeof _0x59ece2[_0x0e1f('0x1b')]==='undefined';var _0x2af45d=_0x5a9ee8['count'];var _0x5f04c9=_0x2f6f20?0x0:_0x59ece2['offset'];var _0x37ffd2=_0x2f6f20?_0x5a9ee8[_0x0e1f('0x1c')]:_0x59ece2['offset']+_0x59ece2[_0x0e1f('0x1b')];var _0x81c9c5;if(_0x37ffd2>=_0x2af45d){_0x37ffd2=_0x2af45d;_0x81c9c5=0xc8;}else{_0x81c9c5=0xce;}_0x3bd237[_0x0e1f('0x17')](_0x81c9c5);return _0x3bd237['set'](_0x0e1f('0x1d'),_0x5f04c9+'-'+_0x37ffd2+'/'+_0x2af45d)[_0x0e1f('0x19')](_0x5a9ee8);}return null;};}function patchUpdates(_0x4d52bc){return function(_0x4dd689){try{jsonpatch['apply'](_0x4dd689,_0x4d52bc,!![]);}catch(_0x278504){return BPromise[_0x0e1f('0x1e')](_0x278504);}return _0x4dd689['save']();};}function saveUpdates(_0x1c402a,_0x5bbaa8){return function(_0x2d751b){if(_0x2d751b){return _0x2d751b[_0x0e1f('0x1f')](_0x1c402a)[_0x0e1f('0x20')](function(_0x1a1b11){return _0x1a1b11;});}return null;};}function removeEntity(_0x4aa0f7,_0x2a328c){return function(_0x15d0e3){if(_0x15d0e3){return _0x15d0e3[_0x0e1f('0x21')]()[_0x0e1f('0x20')](function(){_0x4aa0f7[_0x0e1f('0x17')](0xcc)[_0x0e1f('0x18')]();});}};}function handleEntityNotFound(_0x4a61dd,_0x4f49da){return function(_0x2c3d19){if(!_0x2c3d19){_0x4a61dd[_0x0e1f('0x16')](0x194);}return _0x2c3d19;};}function handleError(_0x18eb9b,_0x41c47e){_0x41c47e=_0x41c47e||0x1f4;return function(_0x4d1e2c){logger['error'](_0x4d1e2c['stack']);if(_0x4d1e2c[_0x0e1f('0x22')]){delete _0x4d1e2c['name'];}_0x18eb9b[_0x0e1f('0x17')](_0x41c47e)[_0x0e1f('0x23')](_0x4d1e2c);};}exports[_0x0e1f('0x24')]=function(_0x4b6596,_0x4ae5ae){var _0x4ba73f={},_0x2dd563={},_0xd29787={'count':0x0,'rows':[]};var _0x14b7d9=_['map'](db['SquareMessage'][_0x0e1f('0x25')],function(_0x4b31e4){return{'name':_0x4b31e4['fieldName'],'type':_0x4b31e4[_0x0e1f('0x26')][_0x0e1f('0x27')]};});_0x2dd563['model']=_[_0x0e1f('0x28')](_0x14b7d9,'name');_0x2dd563[_0x0e1f('0x29')]=_['keys'](_0x4b6596[_0x0e1f('0x29')]);_0x2dd563[_0x0e1f('0x2a')]=_[_0x0e1f('0x2b')](_0x2dd563[_0x0e1f('0x2c')],_0x2dd563[_0x0e1f('0x29')]);_0x4ba73f[_0x0e1f('0x2d')]=_[_0x0e1f('0x2b')](_0x2dd563['model'],qs['fields'](_0x4b6596[_0x0e1f('0x29')][_0x0e1f('0x2e')]));_0x4ba73f[_0x0e1f('0x2d')]=_0x4ba73f[_0x0e1f('0x2d')][_0x0e1f('0x2f')]?_0x4ba73f['attributes']:_0x2dd563['model'];if(!_0x4b6596[_0x0e1f('0x29')][_0x0e1f('0x30')](_0x0e1f('0x31'))){_0x4ba73f[_0x0e1f('0x1b')]=qs[_0x0e1f('0x1b')](_0x4b6596[_0x0e1f('0x29')]['limit']);_0x4ba73f[_0x0e1f('0x1a')]=qs[_0x0e1f('0x1a')](_0x4b6596[_0x0e1f('0x29')][_0x0e1f('0x1a')]);}_0x4ba73f['order']=qs['sort'](_0x4b6596[_0x0e1f('0x29')][_0x0e1f('0x32')]);_0x4ba73f['where']=qs[_0x0e1f('0x2a')](_[_0x0e1f('0x33')](_0x4b6596[_0x0e1f('0x29')],_0x2dd563[_0x0e1f('0x2a')]),_0x14b7d9);if(_0x4b6596[_0x0e1f('0x29')][_0x0e1f('0x34')]){_0x4ba73f[_0x0e1f('0x35')]=_[_0x0e1f('0x36')](_0x4ba73f[_0x0e1f('0x35')],{'$or':_[_0x0e1f('0x28')](_0x14b7d9,function(_0x27c717){if(_0x27c717[_0x0e1f('0x26')]!==_0x0e1f('0x37')){var _0x32859f={};_0x32859f[_0x27c717[_0x0e1f('0x22')]]={'$like':'%'+_0x4b6596[_0x0e1f('0x29')]['filter']+'%'};return _0x32859f;}})});}_0x4ba73f=_[_0x0e1f('0x36')]({},_0x4ba73f,_0x4b6596[_0x0e1f('0x38')]);var _0x3b51ef={'where':_0x4ba73f[_0x0e1f('0x35')]};return db['SquareMessage'][_0x0e1f('0x1c')](_0x3b51ef)['then'](function(_0x2187ae){_0xd29787['count']=_0x2187ae;if(_0x4b6596[_0x0e1f('0x29')][_0x0e1f('0x39')]){_0x4ba73f[_0x0e1f('0x3a')]=[{'all':!![]}];}return db[_0x0e1f('0x3b')][_0x0e1f('0x3c')](_0x4ba73f);})[_0x0e1f('0x20')](function(_0x228013){_0xd29787[_0x0e1f('0x3d')]=_0x228013;return _0xd29787;})[_0x0e1f('0x20')](respondWithFilteredResult(_0x4ae5ae,_0x4ba73f))[_0x0e1f('0x3e')](handleError(_0x4ae5ae,null));};exports[_0x0e1f('0x3f')]=function(_0x5e26b5,_0x11f9e8){var _0x4d7374={'raw':!![],'where':{'id':_0x5e26b5[_0x0e1f('0x40')]['id']}},_0xf13325={};_0xf13325[_0x0e1f('0x2c')]=_[_0x0e1f('0x41')](db[_0x0e1f('0x3b')][_0x0e1f('0x25')]);_0xf13325[_0x0e1f('0x29')]=_[_0x0e1f('0x41')](_0x5e26b5['query']);_0xf13325['filters']=_[_0x0e1f('0x2b')](_0xf13325[_0x0e1f('0x2c')],_0xf13325[_0x0e1f('0x29')]);_0x4d7374['attributes']=_[_0x0e1f('0x2b')](_0xf13325['model'],qs['fields'](_0x5e26b5[_0x0e1f('0x29')][_0x0e1f('0x2e')]));_0x4d7374['attributes']=_0x4d7374['attributes'][_0x0e1f('0x2f')]?_0x4d7374[_0x0e1f('0x2d')]:_0xf13325[_0x0e1f('0x2c')];if(_0x5e26b5['query'][_0x0e1f('0x39')]){_0x4d7374[_0x0e1f('0x3a')]=[{'all':!![]}];}_0x4d7374=_[_0x0e1f('0x36')]({},_0x4d7374,_0x5e26b5[_0x0e1f('0x38')]);return db[_0x0e1f('0x3b')]['find'](_0x4d7374)[_0x0e1f('0x20')](handleEntityNotFound(_0x11f9e8,null))[_0x0e1f('0x20')](respondWithResult(_0x11f9e8,null))['catch'](handleError(_0x11f9e8,null));};exports[_0x0e1f('0x42')]=function(_0xa166ed,_0x244d97){return db[_0x0e1f('0x3b')][_0x0e1f('0x42')](_0xa166ed['body'],{})['then'](respondWithResult(_0x244d97,0xc9))[_0x0e1f('0x3e')](handleError(_0x244d97,null));};exports[_0x0e1f('0x1f')]=function(_0x208c15,_0x22ff97){if(_0x208c15[_0x0e1f('0x43')]['id']){delete _0x208c15[_0x0e1f('0x43')]['id'];}return db[_0x0e1f('0x3b')][_0x0e1f('0x44')]({'where':{'id':_0x208c15[_0x0e1f('0x40')]['id']}})['then'](handleEntityNotFound(_0x22ff97,null))[_0x0e1f('0x20')](saveUpdates(_0x208c15[_0x0e1f('0x43')],null))[_0x0e1f('0x20')](respondWithResult(_0x22ff97,null))[_0x0e1f('0x3e')](handleError(_0x22ff97,null));};exports['destroy']=function(_0x28d058,_0xab1e60){return db[_0x0e1f('0x3b')]['find']({'where':{'id':_0x28d058[_0x0e1f('0x40')]['id']}})['then'](handleEntityNotFound(_0xab1e60,null))[_0x0e1f('0x20')](removeEntity(_0xab1e60,null))[_0x0e1f('0x3e')](handleError(_0xab1e60,null));}; \ No newline at end of file +var _0x676c=['sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','json','apply','update','destroy','then','error','stack','name','index','map','SquareMessage','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','rawAttributes','find','catch','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x58dc25,_0x49b9d5){var _0x21b0a7=function(_0x38a186){while(--_0x38a186){_0x58dc25['push'](_0x58dc25['shift']());}};_0x21b0a7(++_0x49b9d5);}(_0x676c,0x198));var _0xc676=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x676c[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xc676('0x0'));var rimraf=require(_0xc676('0x1'));var zipdir=require(_0xc676('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc676('0x3'));var moment=require(_0xc676('0x4'));var BPromise=require(_0xc676('0x5'));var Mustache=require(_0xc676('0x6'));var util=require(_0xc676('0x7'));var path=require(_0xc676('0x8'));var sox=require('sox');var csv=require(_0xc676('0x9'));var ejs=require(_0xc676('0xa'));var fs=require('fs');var fs_extra=require(_0xc676('0xb'));var _=require(_0xc676('0xc'));var squel=require(_0xc676('0xd'));var crypto=require('crypto');var jsforce=require(_0xc676('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc676('0xf'));var Papa=require(_0xc676('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc676('0x11'));var as=require(_0xc676('0x12'));var hardwareService=require(_0xc676('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xc676('0x14'));var config=require(_0xc676('0x15'));var licenseUtil=require(_0xc676('0x16'));var db=require(_0xc676('0x17'))['db'];function respondWithStatusCode(_0x5e8565,_0xc15629){_0xc15629=_0xc15629||0xcc;return function(_0xfb2c57){if(_0xfb2c57){return _0x5e8565[_0xc676('0x18')](_0xc15629);}return _0x5e8565[_0xc676('0x19')](_0xc15629)[_0xc676('0x1a')]();};}function respondWithResult(_0xcee1c5,_0xa07c6d){_0xa07c6d=_0xa07c6d||0xc8;return function(_0x4f8832){if(_0x4f8832){return _0xcee1c5[_0xc676('0x19')](_0xa07c6d)['json'](_0x4f8832);}};}function respondWithFilteredResult(_0x59deda,_0x2ea1e0){return function(_0x4e0f49){if(_0x4e0f49){var _0x51e6d4=typeof _0x2ea1e0['offset']===_0xc676('0x1b')&&typeof _0x2ea1e0['limit']===_0xc676('0x1b');var _0x1468bc=_0x4e0f49[_0xc676('0x1c')];var _0x3b3215=_0x51e6d4?0x0:_0x2ea1e0[_0xc676('0x1d')];var _0x215ea6=_0x51e6d4?_0x4e0f49['count']:_0x2ea1e0[_0xc676('0x1d')]+_0x2ea1e0[_0xc676('0x1e')];var _0x4fe489;if(_0x215ea6>=_0x1468bc){_0x215ea6=_0x1468bc;_0x4fe489=0xc8;}else{_0x4fe489=0xce;}_0x59deda[_0xc676('0x19')](_0x4fe489);return _0x59deda[_0xc676('0x1f')](_0xc676('0x20'),_0x3b3215+'-'+_0x215ea6+'/'+_0x1468bc)[_0xc676('0x21')](_0x4e0f49);}return null;};}function patchUpdates(_0x26a00b){return function(_0x87b27d){try{jsonpatch[_0xc676('0x22')](_0x87b27d,_0x26a00b,!![]);}catch(_0xc533a9){return BPromise['reject'](_0xc533a9);}return _0x87b27d['save']();};}function saveUpdates(_0x502e6f,_0x399461){return function(_0x5ca0a2){if(_0x5ca0a2){return _0x5ca0a2[_0xc676('0x23')](_0x502e6f)['then'](function(_0x54389a){return _0x54389a;});}return null;};}function removeEntity(_0x3b55c5,_0x575de4){return function(_0x113ec5){if(_0x113ec5){return _0x113ec5[_0xc676('0x24')]()[_0xc676('0x25')](function(){_0x3b55c5[_0xc676('0x19')](0xcc)[_0xc676('0x1a')]();});}};}function handleEntityNotFound(_0x4ca666,_0x187960){return function(_0x24f330){if(!_0x24f330){_0x4ca666[_0xc676('0x18')](0x194);}return _0x24f330;};}function handleError(_0x56215c,_0x36bd5b){_0x36bd5b=_0x36bd5b||0x1f4;return function(_0x4b61aa){logger[_0xc676('0x26')](_0x4b61aa[_0xc676('0x27')]);if(_0x4b61aa['name']){delete _0x4b61aa[_0xc676('0x28')];}_0x56215c[_0xc676('0x19')](_0x36bd5b)['send'](_0x4b61aa);};}exports[_0xc676('0x29')]=function(_0x230b36,_0x32056c){var _0x4e4834={},_0x278ccc={},_0x2d521d={'count':0x0,'rows':[]};var _0x181e3d=_[_0xc676('0x2a')](db[_0xc676('0x2b')]['rawAttributes'],function(_0x1bd277){return{'name':_0x1bd277[_0xc676('0x2c')],'type':_0x1bd277[_0xc676('0x2d')][_0xc676('0x2e')]};});_0x278ccc[_0xc676('0x2f')]=_['map'](_0x181e3d,_0xc676('0x28'));_0x278ccc[_0xc676('0x30')]=_[_0xc676('0x31')](_0x230b36[_0xc676('0x30')]);_0x278ccc['filters']=_[_0xc676('0x32')](_0x278ccc[_0xc676('0x2f')],_0x278ccc[_0xc676('0x30')]);_0x4e4834[_0xc676('0x33')]=_[_0xc676('0x32')](_0x278ccc[_0xc676('0x2f')],qs[_0xc676('0x34')](_0x230b36[_0xc676('0x30')][_0xc676('0x34')]));_0x4e4834['attributes']=_0x4e4834['attributes']['length']?_0x4e4834[_0xc676('0x33')]:_0x278ccc[_0xc676('0x2f')];if(!_0x230b36[_0xc676('0x30')][_0xc676('0x35')]('nolimit')){_0x4e4834[_0xc676('0x1e')]=qs[_0xc676('0x1e')](_0x230b36[_0xc676('0x30')][_0xc676('0x1e')]);_0x4e4834[_0xc676('0x1d')]=qs[_0xc676('0x1d')](_0x230b36['query']['offset']);}_0x4e4834[_0xc676('0x36')]=qs['sort'](_0x230b36[_0xc676('0x30')][_0xc676('0x37')]);_0x4e4834[_0xc676('0x38')]=qs[_0xc676('0x39')](_['pick'](_0x230b36['query'],_0x278ccc['filters']),_0x181e3d);if(_0x230b36[_0xc676('0x30')][_0xc676('0x3a')]){_0x4e4834[_0xc676('0x38')]=_[_0xc676('0x3b')](_0x4e4834[_0xc676('0x38')],{'$or':_[_0xc676('0x2a')](_0x181e3d,function(_0x30148a){if(_0x30148a[_0xc676('0x2d')]!==_0xc676('0x3c')){var _0x45fad7={};_0x45fad7[_0x30148a[_0xc676('0x28')]]={'$like':'%'+_0x230b36[_0xc676('0x30')][_0xc676('0x3a')]+'%'};return _0x45fad7;}})});}_0x4e4834=_[_0xc676('0x3b')]({},_0x4e4834,_0x230b36[_0xc676('0x3d')]);var _0x2cba1a={'where':_0x4e4834[_0xc676('0x38')]};return db['SquareMessage'][_0xc676('0x1c')](_0x2cba1a)[_0xc676('0x25')](function(_0x2020d7){_0x2d521d['count']=_0x2020d7;if(_0x230b36[_0xc676('0x30')][_0xc676('0x3e')]){_0x4e4834[_0xc676('0x3f')]=[{'all':!![]}];}return db[_0xc676('0x2b')][_0xc676('0x40')](_0x4e4834);})[_0xc676('0x25')](function(_0x18bd1a){_0x2d521d['rows']=_0x18bd1a;return _0x2d521d;})[_0xc676('0x25')](respondWithFilteredResult(_0x32056c,_0x4e4834))['catch'](handleError(_0x32056c,null));};exports[_0xc676('0x41')]=function(_0x1e7bb5,_0x5dcfd8){var _0x3fc05b={'raw':!![],'where':{'id':_0x1e7bb5[_0xc676('0x42')]['id']}},_0x3869f6={};_0x3869f6[_0xc676('0x2f')]=_[_0xc676('0x31')](db['SquareMessage'][_0xc676('0x43')]);_0x3869f6[_0xc676('0x30')]=_[_0xc676('0x31')](_0x1e7bb5['query']);_0x3869f6[_0xc676('0x39')]=_[_0xc676('0x32')](_0x3869f6[_0xc676('0x2f')],_0x3869f6[_0xc676('0x30')]);_0x3fc05b['attributes']=_[_0xc676('0x32')](_0x3869f6['model'],qs[_0xc676('0x34')](_0x1e7bb5[_0xc676('0x30')][_0xc676('0x34')]));_0x3fc05b['attributes']=_0x3fc05b[_0xc676('0x33')]['length']?_0x3fc05b['attributes']:_0x3869f6[_0xc676('0x2f')];if(_0x1e7bb5['query'][_0xc676('0x3e')]){_0x3fc05b['include']=[{'all':!![]}];}_0x3fc05b=_['merge']({},_0x3fc05b,_0x1e7bb5[_0xc676('0x3d')]);return db['SquareMessage'][_0xc676('0x44')](_0x3fc05b)['then'](handleEntityNotFound(_0x5dcfd8,null))[_0xc676('0x25')](respondWithResult(_0x5dcfd8,null))[_0xc676('0x45')](handleError(_0x5dcfd8,null));};exports[_0xc676('0x46')]=function(_0xf2d3a0,_0x4d8d1d){return db['SquareMessage'][_0xc676('0x46')](_0xf2d3a0[_0xc676('0x47')],{})['then'](respondWithResult(_0x4d8d1d,0xc9))[_0xc676('0x45')](handleError(_0x4d8d1d,null));};exports[_0xc676('0x23')]=function(_0x59be1a,_0x38d1bc){if(_0x59be1a[_0xc676('0x47')]['id']){delete _0x59be1a[_0xc676('0x47')]['id'];}return db[_0xc676('0x2b')][_0xc676('0x44')]({'where':{'id':_0x59be1a['params']['id']}})[_0xc676('0x25')](handleEntityNotFound(_0x38d1bc,null))[_0xc676('0x25')](saveUpdates(_0x59be1a['body'],null))[_0xc676('0x25')](respondWithResult(_0x38d1bc,null))[_0xc676('0x45')](handleError(_0x38d1bc,null));};exports[_0xc676('0x24')]=function(_0x238ebf,_0x5c643e){return db[_0xc676('0x2b')][_0xc676('0x44')]({'where':{'id':_0x238ebf[_0xc676('0x42')]['id']}})[_0xc676('0x25')](handleEntityNotFound(_0x5c643e,null))['then'](removeEntity(_0x5c643e,null))[_0xc676('0x45')](handleError(_0x5c643e,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index fd660cf..096b32f 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 _0x0813=['bluebird','path','../../config/environment','define','SquareMessage','square_messages','lodash','util','../../config/logger','moment'];(function(_0x2ec440,_0xa3a6df){var _0x6d1861=function(_0x3b7195){while(--_0x3b7195){_0x2ec440['push'](_0x2ec440['shift']());}};_0x6d1861(++_0xa3a6df);}(_0x0813,0xd8));var _0x3081=function(_0x2f5df3,_0x1be008){_0x2f5df3=_0x2f5df3-0x0;var _0x2db629=_0x0813[_0x2f5df3];return _0x2db629;};'use strict';var _=require(_0x3081('0x0'));var util=require(_0x3081('0x1'));var logger=require(_0x3081('0x2'))('api');var moment=require(_0x3081('0x3'));var BPromise=require(_0x3081('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3081('0x5'));var rimraf=require('rimraf');var config=require(_0x3081('0x6'));var attributes=require('./squareMessage.attributes');module['exports']=function(_0x44cfa5,_0x7080a5){return _0x44cfa5[_0x3081('0x7')](_0x3081('0x8'),attributes,{'tableName':_0x3081('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x12a6=['bluebird','rimraf','../../config/environment','exports','define','SquareMessage','square_messages','lodash','util','../../config/logger','moment'];(function(_0x578f2b,_0x25d644){var _0x114bb4=function(_0x5b108d){while(--_0x5b108d){_0x578f2b['push'](_0x578f2b['shift']());}};_0x114bb4(++_0x25d644);}(_0x12a6,0xe3));var _0x612a=function(_0x2a6571,_0xf1567c){_0x2a6571=_0x2a6571-0x0;var _0xdf7731=_0x12a6[_0x2a6571];return _0xdf7731;};'use strict';var _=require(_0x612a('0x0'));var util=require(_0x612a('0x1'));var logger=require(_0x612a('0x2'))('api');var moment=require(_0x612a('0x3'));var BPromise=require(_0x612a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x612a('0x5'));var config=require(_0x612a('0x6'));var attributes=require('./squareMessage.attributes');module[_0x612a('0x7')]=function(_0x1323ae,_0x414faf){return _0x1323ae[_0x612a('0x8')](_0x612a('0x9'),attributes,{'tableName':_0x612a('0xa'),'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 abb4ae8..c84a354 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 _0x63d0=['SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','CreateSquareMessage','SquareMessage','create','body','options','raw','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','then','info'];(function(_0x2d64b8,_0x62f97f){var _0x5e0fa0=function(_0x4f9737){while(--_0x4f9737){_0x2d64b8['push'](_0x2d64b8['shift']());}};_0x5e0fa0(++_0x62f97f);}(_0x63d0,0x6e));var _0x063d=function(_0x1faba8,_0x37cfb8){_0x1faba8=_0x1faba8-0x0;var _0x1ded2d=_0x63d0[_0x1faba8];return _0x1ded2d;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x063d('0x0'));var rs=require(_0x063d('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x063d('0x2'))['db'];var utils=require(_0x063d('0x3'));var logger=require(_0x063d('0x4'))(_0x063d('0x5'));var config=require('../../config/environment');var jayson=require(_0x063d('0x6'));var client=jayson[_0x063d('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x11c177,_0x9f7fe2,_0x48d2fb){return new BPromise(function(_0x2ecee3,_0x4b13f5){return client['request'](_0x11c177,_0x48d2fb)[_0x063d('0x8')](function(_0x3f9edf){logger[_0x063d('0x9')](_0x063d('0xa'),_0x9f7fe2,_0x063d('0xb'));logger[_0x063d('0xc')](_0x063d('0xd'),_0x9f7fe2,_0x063d('0xb'),JSON[_0x063d('0xe')](_0x3f9edf));if(_0x3f9edf[_0x063d('0xf')]){if(_0x3f9edf[_0x063d('0xf')]['code']===0x1f4){logger[_0x063d('0xf')]('SquareMessage,\x20%s,\x20%s',_0x9f7fe2,_0x3f9edf['error']['message']);return _0x4b13f5(_0x3f9edf['error'][_0x063d('0x10')]);}logger[_0x063d('0xf')]('SquareMessage,\x20%s,\x20%s',_0x9f7fe2,_0x3f9edf['error'][_0x063d('0x10')]);return _0x2ecee3(_0x3f9edf[_0x063d('0xf')]['message']);}else{logger[_0x063d('0x9')]('SquareMessage,\x20%s,\x20%s',_0x9f7fe2,_0x063d('0xb'));_0x2ecee3(_0x3f9edf[_0x063d('0x11')]['message']);}})['catch'](function(_0x6ee01d){logger[_0x063d('0xf')](_0x063d('0xa'),_0x9f7fe2,_0x6ee01d);_0x4b13f5(_0x6ee01d);});});}exports[_0x063d('0x12')]=function(_0x2f3972){var _0x331522=this;return new Promise(function(_0x22c414,_0x36481c){return db[_0x063d('0x13')][_0x063d('0x14')](_0x2f3972[_0x063d('0x15')],{'raw':_0x2f3972[_0x063d('0x16')]?_0x2f3972['options'][_0x063d('0x17')]===undefined?!![]:![]:!![]})[_0x063d('0x8')](function(_0x23a97c){logger['info'](_0x063d('0x12'),_0x2f3972);logger[_0x063d('0xc')](_0x063d('0x12'),_0x2f3972,JSON[_0x063d('0xe')](_0x23a97c));_0x22c414(_0x23a97c);})['catch'](function(_0x3aeda0){logger[_0x063d('0xf')]('CreateSquareMessage',_0x3aeda0[_0x063d('0x10')],_0x2f3972);_0x36481c(_0x331522[_0x063d('0xf')](0x1f4,_0x3aeda0[_0x063d('0x10')]));});});}; \ No newline at end of file +var _0x450b=['then','CreateSquareMessage','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','info','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareMessage,\x20%s,\x20%s','message','catch','create','body','options'];(function(_0x3e1a1a,_0x5a0ebd){var _0x2512c2=function(_0x1d7edb){while(--_0x1d7edb){_0x3e1a1a['push'](_0x3e1a1a['shift']());}};_0x2512c2(++_0x5a0ebd);}(_0x450b,0xfc));var _0xb450=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x450b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xb450('0x0'));var rs=require(_0xb450('0x1'));var fs=require('fs');var Redis=require(_0xb450('0x2'));var db=require(_0xb450('0x3'))['db'];var utils=require(_0xb450('0x4'));var logger=require('../../config/logger')(_0xb450('0x5'));var config=require(_0xb450('0x6'));var jayson=require(_0xb450('0x7'));var client=jayson[_0xb450('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x18367e,_0x556479,_0x381008){return new BPromise(function(_0x5c5823,_0x31d769){return client[_0xb450('0x9')](_0x18367e,_0x381008)['then'](function(_0x3a6354){logger[_0xb450('0xa')]('SquareMessage,\x20%s,\x20%s',_0x556479,_0xb450('0xb'));logger[_0xb450('0xc')](_0xb450('0xd'),_0x556479,_0xb450('0xb'),JSON[_0xb450('0xe')](_0x3a6354));if(_0x3a6354[_0xb450('0xf')]){if(_0x3a6354[_0xb450('0xf')][_0xb450('0x10')]===0x1f4){logger[_0xb450('0xf')](_0xb450('0x11'),_0x556479,_0x3a6354[_0xb450('0xf')][_0xb450('0x12')]);return _0x31d769(_0x3a6354[_0xb450('0xf')]['message']);}logger['error'](_0xb450('0x11'),_0x556479,_0x3a6354['error'][_0xb450('0x12')]);return _0x5c5823(_0x3a6354[_0xb450('0xf')][_0xb450('0x12')]);}else{logger['info'](_0xb450('0x11'),_0x556479,'request\x20sent');_0x5c5823(_0x3a6354['result']['message']);}})[_0xb450('0x13')](function(_0x1949b4){logger[_0xb450('0xf')]('SquareMessage,\x20%s,\x20%s',_0x556479,_0x1949b4);_0x31d769(_0x1949b4);});});}exports['CreateSquareMessage']=function(_0x331edf){var _0x1aaae3=this;return new Promise(function(_0x509b7f,_0x4e7ff5){return db['SquareMessage'][_0xb450('0x14')](_0x331edf[_0xb450('0x15')],{'raw':_0x331edf[_0xb450('0x16')]?_0x331edf[_0xb450('0x16')]['raw']===undefined?!![]:![]:!![]})[_0xb450('0x17')](function(_0x30566e){logger[_0xb450('0xa')](_0xb450('0x18'),_0x331edf);logger['debug'](_0xb450('0x18'),_0x331edf,JSON['stringify'](_0x30566e));_0x509b7f(_0x30566e);})[_0xb450('0x13')](function(_0x21ecbe){logger['error'](_0xb450('0x18'),_0x21ecbe['message'],_0x331edf);_0x4e7ff5(_0x1aaae3[_0xb450('0xf')](0x1f4,_0x21ecbe[_0xb450('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 23d3b70..cd93826 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 _0xca82=['destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/test','15s','test','create','put','update','delete'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xca82,0x116));var _0x2ca8=function(_0x141486,_0x58ed56){_0x141486=_0x141486-0x0;var _0x1b5fb9=_0xca82[_0x141486];return _0x1b5fb9;};'use strict';var multer=require(_0x2ca8('0x0'));var util=require(_0x2ca8('0x1'));var path=require('path');var timeout=require(_0x2ca8('0x2'));var express=require(_0x2ca8('0x3'));var router=express[_0x2ca8('0x4')]();var fs_extra=require(_0x2ca8('0x5'));var auth=require(_0x2ca8('0x6'));var interaction=require(_0x2ca8('0x7'));var config=require(_0x2ca8('0x8'));var controller=require('./squareOdbc.controller');router[_0x2ca8('0x9')]('/',auth[_0x2ca8('0xa')](),controller[_0x2ca8('0xb')]);router[_0x2ca8('0x9')](_0x2ca8('0xc'),auth[_0x2ca8('0xa')](),controller[_0x2ca8('0xd')]);router[_0x2ca8('0x9')](_0x2ca8('0xe'),auth['isAuthenticated'](),timeout(_0x2ca8('0xf')),controller[_0x2ca8('0x10')]);router['post']('/',auth[_0x2ca8('0xa')](),controller[_0x2ca8('0x11')]);router[_0x2ca8('0x12')](_0x2ca8('0xc'),auth[_0x2ca8('0xa')](),controller[_0x2ca8('0x13')]);router[_0x2ca8('0x14')](_0x2ca8('0xc'),auth[_0x2ca8('0xa')](),controller[_0x2ca8('0x15')]);module[_0x2ca8('0x16')]=router; \ No newline at end of file +var _0x2ccd=['/:id/test','15s','test','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','/:id','show'];(function(_0x2e3107,_0x25f970){var _0x833d69=function(_0x420e78){while(--_0x420e78){_0x2e3107['push'](_0x2e3107['shift']());}};_0x833d69(++_0x25f970);}(_0x2ccd,0x111));var _0xd2cc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2ccd[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xd2cc('0x0'));var util=require(_0xd2cc('0x1'));var path=require(_0xd2cc('0x2'));var timeout=require(_0xd2cc('0x3'));var express=require(_0xd2cc('0x4'));var router=express[_0xd2cc('0x5')]();var fs_extra=require(_0xd2cc('0x6'));var auth=require(_0xd2cc('0x7'));var interaction=require(_0xd2cc('0x8'));var config=require(_0xd2cc('0x9'));var controller=require(_0xd2cc('0xa'));router[_0xd2cc('0xb')]('/',auth[_0xd2cc('0xc')](),controller['index']);router[_0xd2cc('0xb')](_0xd2cc('0xd'),auth[_0xd2cc('0xc')](),controller[_0xd2cc('0xe')]);router[_0xd2cc('0xb')](_0xd2cc('0xf'),auth[_0xd2cc('0xc')](),timeout(_0xd2cc('0x10')),controller[_0xd2cc('0x11')]);router[_0xd2cc('0x12')]('/',auth['isAuthenticated'](),controller[_0xd2cc('0x13')]);router[_0xd2cc('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xd2cc('0x15')]);router[_0xd2cc('0x16')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xd2cc('0x17')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 19aa43b..e62ea02 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 _0x1bb1=['STRING','sequelize','exports'];(function(_0x3f6bcf,_0x531e79){var _0x1c5350=function(_0x282fc5){while(--_0x282fc5){_0x3f6bcf['push'](_0x3f6bcf['shift']());}};_0x1c5350(++_0x531e79);}(_0x1bb1,0xb2));var _0x11bb=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x1bb1[_0x46698a];return _0x356db0;};'use strict';var Sequelize=require(_0x11bb('0x0'));module[_0x11bb('0x1')]={'name':{'type':Sequelize[_0x11bb('0x2')],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize[_0x11bb('0x2')]},'description':{'type':Sequelize[_0x11bb('0x2')]}}; \ No newline at end of file +var _0x7418=['name','exports','STRING'];(function(_0x3bc77e,_0x2a4ee7){var _0x5aa819=function(_0x22e82c){while(--_0x22e82c){_0x3bc77e['push'](_0x3bc77e['shift']());}};_0x5aa819(++_0x2a4ee7);}(_0x7418,0x1b4));var _0x8741=function(_0x22ab4c,_0x8c5123){_0x22ab4c=_0x22ab4c-0x0;var _0x14b938=_0x7418[_0x22ab4c];return _0x14b938;};'use strict';var Sequelize=require('sequelize');module[_0x8741('0x0')]={'name':{'type':Sequelize[_0x8741('0x1')],'unique':_0x8741('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0x8741('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index e427626..3152ace 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 _0xc440=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','get','ODBC','UserProfileResource','destroy','error','stack','name','map','SquareOdbc','rawAttributes','fieldName','key','model','keys','filters','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','params','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','dsn','openSync','closeSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','to-csv','querystring','ioredis','../../components/parsers/qs'];(function(_0x25110a,_0x3b3852){var _0xe42822=function(_0x283a82){while(--_0x283a82){_0x25110a['push'](_0x25110a['shift']());}};_0xe42822(++_0x3b3852);}(_0xc440,0xa0));var _0x0c44=function(_0x1fb977,_0x1efdea){_0x1fb977=_0x1fb977-0x0;var _0x37fb64=_0xc440[_0x1fb977];return _0x37fb64;};'use strict';var emlformat=require(_0x0c44('0x0'));var rimraf=require(_0x0c44('0x1'));var zipdir=require(_0x0c44('0x2'));var jsonpatch=require(_0x0c44('0x3'));var rp=require(_0x0c44('0x4'));var moment=require(_0x0c44('0x5'));var BPromise=require(_0x0c44('0x6'));var Mustache=require(_0x0c44('0x7'));var util=require(_0x0c44('0x8'));var path=require('path');var sox=require(_0x0c44('0x9'));var csv=require('to-csv');var ejs=require(_0x0c44('0xa'));var fs=require('fs');var fs_extra=require(_0x0c44('0xb'));var _=require(_0x0c44('0xc'));var squel=require(_0x0c44('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0c44('0xe'));var querystring=require(_0x0c44('0xf'));var Papa=require('papaparse');var Redis=require(_0x0c44('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x0c44('0x11'));var as=require(_0x0c44('0x12'));var hardwareService=require(_0x0c44('0x13'));var logger=require('../../config/logger')(_0x0c44('0x14'));var utils=require(_0x0c44('0x15'));var config=require(_0x0c44('0x16'));var licenseUtil=require(_0x0c44('0x17'));var db=require(_0x0c44('0x18'))['db'];function respondWithStatusCode(_0x4b403d,_0x5df441){_0x5df441=_0x5df441||0xcc;return function(_0x494c21){if(_0x494c21){return _0x4b403d[_0x0c44('0x19')](_0x5df441);}return _0x4b403d[_0x0c44('0x1a')](_0x5df441)[_0x0c44('0x1b')]();};}function respondWithResult(_0x401df9,_0x386e4a){_0x386e4a=_0x386e4a||0xc8;return function(_0x40c2c1){if(_0x40c2c1){return _0x401df9['status'](_0x386e4a)[_0x0c44('0x1c')](_0x40c2c1);}};}function respondWithFilteredResult(_0x4d501a,_0x278fe3){return function(_0xc8caab){if(_0xc8caab){var _0xe1c9c5=typeof _0x278fe3[_0x0c44('0x1d')]===_0x0c44('0x1e')&&typeof _0x278fe3[_0x0c44('0x1f')]===_0x0c44('0x1e');var _0x467928=_0xc8caab[_0x0c44('0x20')];var _0x10e88d=_0xe1c9c5?0x0:_0x278fe3[_0x0c44('0x1d')];var _0x580cae=_0xe1c9c5?_0xc8caab['count']:_0x278fe3[_0x0c44('0x1d')]+_0x278fe3[_0x0c44('0x1f')];var _0x3fc545;if(_0x580cae>=_0x467928){_0x580cae=_0x467928;_0x3fc545=0xc8;}else{_0x3fc545=0xce;}_0x4d501a[_0x0c44('0x1a')](_0x3fc545);return _0x4d501a[_0x0c44('0x21')](_0x0c44('0x22'),_0x10e88d+'-'+_0x580cae+'/'+_0x467928)[_0x0c44('0x1c')](_0xc8caab);}return null;};}function patchUpdates(_0x2d013a){return function(_0xedab5d){try{jsonpatch[_0x0c44('0x23')](_0xedab5d,_0x2d013a,!![]);}catch(_0x2bee74){return BPromise[_0x0c44('0x24')](_0x2bee74);}return _0xedab5d['save']();};}function saveUpdates(_0x21aa89,_0x239b1e){return function(_0x46ef27){if(_0x46ef27){return _0x46ef27[_0x0c44('0x25')](_0x21aa89)[_0x0c44('0x26')](function(_0x2a86f6){return _0x2a86f6;});}return null;};}function removeEntity(_0x3f8700,_0x4f6528){return function(_0x5bf9a6){if(_0x5bf9a6){return _0x5bf9a6['destroy']()['then'](function(){var _0x336505=_0x5bf9a6[_0x0c44('0x27')]({'plain':!![]});var _0x4d6dfe=_0x0c44('0x28');return db[_0x0c44('0x29')][_0x0c44('0x2a')]({'where':{'type':_0x4d6dfe,'resourceId':_0x336505['id']}})[_0x0c44('0x26')](function(){return _0x5bf9a6;});})['then'](function(){_0x3f8700[_0x0c44('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e798d,_0x17b91c){return function(_0x1e51fc){if(!_0x1e51fc){_0x5e798d[_0x0c44('0x19')](0x194);}return _0x1e51fc;};}function handleError(_0x256577,_0x35be85){_0x35be85=_0x35be85||0x1f4;return function(_0x47e6a6){logger[_0x0c44('0x2b')](_0x47e6a6[_0x0c44('0x2c')]);if(_0x47e6a6[_0x0c44('0x2d')]){delete _0x47e6a6[_0x0c44('0x2d')];}_0x256577['status'](_0x35be85)['send'](_0x47e6a6);};}exports['index']=function(_0x4eb00b,_0x591aad){var _0x2fe5f4={},_0x470f33={},_0x2b6402={'count':0x0,'rows':[]};var _0x585430=_[_0x0c44('0x2e')](db[_0x0c44('0x2f')][_0x0c44('0x30')],function(_0x5542c5){return{'name':_0x5542c5[_0x0c44('0x31')],'type':_0x5542c5['type'][_0x0c44('0x32')]};});_0x470f33[_0x0c44('0x33')]=_[_0x0c44('0x2e')](_0x585430,_0x0c44('0x2d'));_0x470f33['query']=_[_0x0c44('0x34')](_0x4eb00b['query']);_0x470f33[_0x0c44('0x35')]=_['intersection'](_0x470f33[_0x0c44('0x33')],_0x470f33[_0x0c44('0x36')]);_0x2fe5f4[_0x0c44('0x37')]=_[_0x0c44('0x38')](_0x470f33[_0x0c44('0x33')],qs['fields'](_0x4eb00b[_0x0c44('0x36')][_0x0c44('0x39')]));_0x2fe5f4[_0x0c44('0x37')]=_0x2fe5f4[_0x0c44('0x37')][_0x0c44('0x3a')]?_0x2fe5f4[_0x0c44('0x37')]:_0x470f33['model'];if(!_0x4eb00b['query'][_0x0c44('0x3b')](_0x0c44('0x3c'))){_0x2fe5f4[_0x0c44('0x1f')]=qs[_0x0c44('0x1f')](_0x4eb00b[_0x0c44('0x36')][_0x0c44('0x1f')]);_0x2fe5f4[_0x0c44('0x1d')]=qs['offset'](_0x4eb00b[_0x0c44('0x36')][_0x0c44('0x1d')]);}_0x2fe5f4[_0x0c44('0x3d')]=qs[_0x0c44('0x3e')](_0x4eb00b['query'][_0x0c44('0x3e')]);_0x2fe5f4[_0x0c44('0x3f')]=qs[_0x0c44('0x35')](_[_0x0c44('0x40')](_0x4eb00b[_0x0c44('0x36')],_0x470f33[_0x0c44('0x35')]),_0x585430);if(_0x4eb00b[_0x0c44('0x36')][_0x0c44('0x41')]){_0x2fe5f4['where']=_[_0x0c44('0x42')](_0x2fe5f4[_0x0c44('0x3f')],{'$or':_['map'](_0x585430,function(_0x50e825){if(_0x50e825[_0x0c44('0x43')]!==_0x0c44('0x44')){var _0x2a340d={};_0x2a340d[_0x50e825[_0x0c44('0x2d')]]={'$like':'%'+_0x4eb00b[_0x0c44('0x36')][_0x0c44('0x41')]+'%'};return _0x2a340d;}})});}_0x2fe5f4=_[_0x0c44('0x42')]({},_0x2fe5f4,_0x4eb00b['options']);var _0x35021={'where':_0x2fe5f4[_0x0c44('0x3f')]};return db[_0x0c44('0x2f')][_0x0c44('0x20')](_0x35021)[_0x0c44('0x26')](function(_0xbe37ca){_0x2b6402[_0x0c44('0x20')]=_0xbe37ca;if(_0x4eb00b[_0x0c44('0x36')][_0x0c44('0x45')]){_0x2fe5f4[_0x0c44('0x46')]=[{'all':!![]}];}return db[_0x0c44('0x2f')][_0x0c44('0x47')](_0x2fe5f4);})['then'](function(_0x57d54d){_0x2b6402[_0x0c44('0x48')]=_0x57d54d;return _0x2b6402;})['then'](respondWithFilteredResult(_0x591aad,_0x2fe5f4))['catch'](handleError(_0x591aad,null));};exports['show']=function(_0x233ed2,_0x241516){var _0x521b47={'raw':!![],'where':{'id':_0x233ed2[_0x0c44('0x49')]['id']}},_0xb37552={};_0xb37552[_0x0c44('0x33')]=_[_0x0c44('0x34')](db['SquareOdbc'][_0x0c44('0x30')]);_0xb37552[_0x0c44('0x36')]=_[_0x0c44('0x34')](_0x233ed2['query']);_0xb37552[_0x0c44('0x35')]=_[_0x0c44('0x38')](_0xb37552[_0x0c44('0x33')],_0xb37552[_0x0c44('0x36')]);_0x521b47['attributes']=_[_0x0c44('0x38')](_0xb37552[_0x0c44('0x33')],qs[_0x0c44('0x39')](_0x233ed2[_0x0c44('0x36')][_0x0c44('0x39')]));_0x521b47[_0x0c44('0x37')]=_0x521b47[_0x0c44('0x37')][_0x0c44('0x3a')]?_0x521b47['attributes']:_0xb37552[_0x0c44('0x33')];if(_0x233ed2[_0x0c44('0x36')][_0x0c44('0x45')]){_0x521b47[_0x0c44('0x46')]=[{'all':!![]}];}_0x521b47=_[_0x0c44('0x42')]({},_0x521b47,_0x233ed2[_0x0c44('0x4a')]);return db[_0x0c44('0x2f')][_0x0c44('0x4b')](_0x521b47)[_0x0c44('0x26')](handleEntityNotFound(_0x241516,null))[_0x0c44('0x26')](respondWithResult(_0x241516,null))['catch'](handleError(_0x241516,null));};exports['create']=function(_0xd1b9ef,_0x468434){return db[_0x0c44('0x2f')][_0x0c44('0x4c')](_0xd1b9ef[_0x0c44('0x4d')],{})[_0x0c44('0x26')](function(_0x310acc){var _0x591ef8=_0xd1b9ef[_0x0c44('0x4e')][_0x0c44('0x27')]({'plain':!![]});if(!_0x591ef8)throw new Error(_0x0c44('0x4f'));if(_0x591ef8[_0x0c44('0x50')]==='user'){var _0x2cb51e=_0x310acc[_0x0c44('0x27')]({'plain':!![]});var _0x2f5b91=_0x0c44('0x28');return db[_0x0c44('0x51')]['find']({'where':{'name':_0x2f5b91,'userProfileId':_0x591ef8['userProfileId']},'raw':!![]})[_0x0c44('0x26')](function(_0x50bcb7){if(_0x50bcb7&&_0x50bcb7[_0x0c44('0x52')]===0x0){return db[_0x0c44('0x29')][_0x0c44('0x4c')]({'name':_0x2cb51e[_0x0c44('0x2d')],'resourceId':_0x2cb51e['id'],'type':_0x50bcb7[_0x0c44('0x2d')],'sectionId':_0x50bcb7['id']},{})[_0x0c44('0x26')](function(){return _0x310acc;});}else{return _0x310acc;}})[_0x0c44('0x53')](function(_0x2b455f){logger[_0x0c44('0x2b')](_0x0c44('0x54'),_0x2b455f);throw _0x2b455f;});}return _0x310acc;})[_0x0c44('0x26')](respondWithResult(_0x468434,0xc9))[_0x0c44('0x53')](handleError(_0x468434,null));};exports[_0x0c44('0x25')]=function(_0x17c22c,_0x5e2ec3){if(_0x17c22c['body']['id']){delete _0x17c22c[_0x0c44('0x4d')]['id'];}return db[_0x0c44('0x2f')][_0x0c44('0x4b')]({'where':{'id':_0x17c22c[_0x0c44('0x49')]['id']}})[_0x0c44('0x26')](handleEntityNotFound(_0x5e2ec3,null))[_0x0c44('0x26')](saveUpdates(_0x17c22c['body'],null))[_0x0c44('0x26')](respondWithResult(_0x5e2ec3,null))['catch'](handleError(_0x5e2ec3,null));};exports[_0x0c44('0x2a')]=function(_0x2406a3,_0x387d83){return db[_0x0c44('0x2f')][_0x0c44('0x4b')]({'where':{'id':_0x2406a3[_0x0c44('0x49')]['id']}})[_0x0c44('0x26')](handleEntityNotFound(_0x387d83,null))[_0x0c44('0x26')](removeEntity(_0x387d83,null))[_0x0c44('0x53')](handleError(_0x387d83,null));};exports[_0x0c44('0x55')]=function(_0x341efb,_0x2b50a9,_0x1bdd97){var _0x1c3c61;return db[_0x0c44('0x2f')][_0x0c44('0x4b')]({'where':{'id':_0x341efb[_0x0c44('0x49')]['id']},'attributes':['id',_0x0c44('0x56')]})['then'](handleEntityNotFound(_0x2b50a9,null))[_0x0c44('0x26')](function(_0x44ee02){if(_0x44ee02){var _0x39e141=require('odbc')();_0x39e141[_0x0c44('0x57')](_0x44ee02['dsn']);_0x39e141[_0x0c44('0x58')]();return _0x44ee02;}})[_0x0c44('0x26')](respondWithResult(_0x2b50a9,null))[_0x0c44('0x53')](handleError(_0x2b50a9,null));}; \ No newline at end of file +var _0xfb53=['request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','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','end','json','undefined','limit','count','offset','set','Content-Range','save','update','then','destroy','get','UserProfileResource','sendStatus','error','stack','name','send','index','map','SquareOdbc','rawAttributes','fieldName','type','key','model','query','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','params','keys','intersection','length','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ODBC','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','dsn','openSync','closeSync','eml-format','rimraf'];(function(_0x175d14,_0x203d88){var _0x41829d=function(_0xe13c2c){while(--_0xe13c2c){_0x175d14['push'](_0x175d14['shift']());}};_0x41829d(++_0x203d88);}(_0xfb53,0x1bb));var _0x3fb5=function(_0x368dbc,_0x1b3ddc){_0x368dbc=_0x368dbc-0x0;var _0x257b6b=_0xfb53[_0x368dbc];return _0x257b6b;};'use strict';var emlformat=require(_0x3fb5('0x0'));var rimraf=require(_0x3fb5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3fb5('0x2'));var moment=require(_0x3fb5('0x3'));var BPromise=require(_0x3fb5('0x4'));var Mustache=require(_0x3fb5('0x5'));var util=require(_0x3fb5('0x6'));var path=require(_0x3fb5('0x7'));var sox=require(_0x3fb5('0x8'));var csv=require(_0x3fb5('0x9'));var ejs=require(_0x3fb5('0xa'));var fs=require('fs');var fs_extra=require(_0x3fb5('0xb'));var _=require(_0x3fb5('0xc'));var squel=require(_0x3fb5('0xd'));var crypto=require('crypto');var jsforce=require(_0x3fb5('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x3fb5('0x9'));var querystring=require('querystring');var Papa=require(_0x3fb5('0xf'));var Redis=require(_0x3fb5('0x10'));var authService=require(_0x3fb5('0x11'));var qs=require(_0x3fb5('0x12'));var as=require(_0x3fb5('0x13'));var hardwareService=require(_0x3fb5('0x14'));var logger=require('../../config/logger')(_0x3fb5('0x15'));var utils=require(_0x3fb5('0x16'));var config=require(_0x3fb5('0x17'));var licenseUtil=require(_0x3fb5('0x18'));var db=require(_0x3fb5('0x19'))['db'];function respondWithStatusCode(_0x1eb44d,_0x508f12){_0x508f12=_0x508f12||0xcc;return function(_0x979f12){if(_0x979f12){return _0x1eb44d['sendStatus'](_0x508f12);}return _0x1eb44d[_0x3fb5('0x1a')](_0x508f12)[_0x3fb5('0x1b')]();};}function respondWithResult(_0x296a28,_0x658683){_0x658683=_0x658683||0xc8;return function(_0x5b807e){if(_0x5b807e){return _0x296a28[_0x3fb5('0x1a')](_0x658683)[_0x3fb5('0x1c')](_0x5b807e);}};}function respondWithFilteredResult(_0xe14b52,_0x2814c7){return function(_0x217c17){if(_0x217c17){var _0x43052d=typeof _0x2814c7['offset']===_0x3fb5('0x1d')&&typeof _0x2814c7[_0x3fb5('0x1e')]===_0x3fb5('0x1d');var _0x1ee81d=_0x217c17[_0x3fb5('0x1f')];var _0x70afc0=_0x43052d?0x0:_0x2814c7[_0x3fb5('0x20')];var _0x193b1f=_0x43052d?_0x217c17[_0x3fb5('0x1f')]:_0x2814c7['offset']+_0x2814c7[_0x3fb5('0x1e')];var _0x4649e3;if(_0x193b1f>=_0x1ee81d){_0x193b1f=_0x1ee81d;_0x4649e3=0xc8;}else{_0x4649e3=0xce;}_0xe14b52[_0x3fb5('0x1a')](_0x4649e3);return _0xe14b52[_0x3fb5('0x21')](_0x3fb5('0x22'),_0x70afc0+'-'+_0x193b1f+'/'+_0x1ee81d)['json'](_0x217c17);}return null;};}function patchUpdates(_0x7531e2){return function(_0x5ea90c){try{jsonpatch['apply'](_0x5ea90c,_0x7531e2,!![]);}catch(_0x494f93){return BPromise['reject'](_0x494f93);}return _0x5ea90c[_0x3fb5('0x23')]();};}function saveUpdates(_0x95de3f,_0x1f5059){return function(_0x265eaf){if(_0x265eaf){return _0x265eaf[_0x3fb5('0x24')](_0x95de3f)[_0x3fb5('0x25')](function(_0xae4fb8){return _0xae4fb8;});}return null;};}function removeEntity(_0x43b7b5,_0x1ace52){return function(_0x3af7ba){if(_0x3af7ba){return _0x3af7ba[_0x3fb5('0x26')]()['then'](function(){var _0x589261=_0x3af7ba[_0x3fb5('0x27')]({'plain':!![]});var _0x3261af='ODBC';return db[_0x3fb5('0x28')][_0x3fb5('0x26')]({'where':{'type':_0x3261af,'resourceId':_0x589261['id']}})[_0x3fb5('0x25')](function(){return _0x3af7ba;});})['then'](function(){_0x43b7b5[_0x3fb5('0x1a')](0xcc)[_0x3fb5('0x1b')]();});}};}function handleEntityNotFound(_0x15eee4,_0xcae3d){return function(_0xea09b1){if(!_0xea09b1){_0x15eee4[_0x3fb5('0x29')](0x194);}return _0xea09b1;};}function handleError(_0x11c57f,_0x22f411){_0x22f411=_0x22f411||0x1f4;return function(_0x7df318){logger[_0x3fb5('0x2a')](_0x7df318[_0x3fb5('0x2b')]);if(_0x7df318[_0x3fb5('0x2c')]){delete _0x7df318['name'];}_0x11c57f[_0x3fb5('0x1a')](_0x22f411)[_0x3fb5('0x2d')](_0x7df318);};}exports[_0x3fb5('0x2e')]=function(_0x495f41,_0x51674b){var _0x58f0ca={},_0x5cbfd3={},_0x2eae77={'count':0x0,'rows':[]};var _0x715501=_[_0x3fb5('0x2f')](db[_0x3fb5('0x30')][_0x3fb5('0x31')],function(_0x54a1eb){return{'name':_0x54a1eb[_0x3fb5('0x32')],'type':_0x54a1eb[_0x3fb5('0x33')][_0x3fb5('0x34')]};});_0x5cbfd3[_0x3fb5('0x35')]=_[_0x3fb5('0x2f')](_0x715501,_0x3fb5('0x2c'));_0x5cbfd3['query']=_['keys'](_0x495f41[_0x3fb5('0x36')]);_0x5cbfd3[_0x3fb5('0x37')]=_['intersection'](_0x5cbfd3[_0x3fb5('0x35')],_0x5cbfd3['query']);_0x58f0ca[_0x3fb5('0x38')]=_['intersection'](_0x5cbfd3['model'],qs[_0x3fb5('0x39')](_0x495f41[_0x3fb5('0x36')]['fields']));_0x58f0ca[_0x3fb5('0x38')]=_0x58f0ca['attributes']['length']?_0x58f0ca['attributes']:_0x5cbfd3[_0x3fb5('0x35')];if(!_0x495f41[_0x3fb5('0x36')][_0x3fb5('0x3a')](_0x3fb5('0x3b'))){_0x58f0ca[_0x3fb5('0x1e')]=qs[_0x3fb5('0x1e')](_0x495f41[_0x3fb5('0x36')]['limit']);_0x58f0ca[_0x3fb5('0x20')]=qs['offset'](_0x495f41[_0x3fb5('0x36')][_0x3fb5('0x20')]);}_0x58f0ca[_0x3fb5('0x3c')]=qs['sort'](_0x495f41[_0x3fb5('0x36')][_0x3fb5('0x3d')]);_0x58f0ca[_0x3fb5('0x3e')]=qs['filters'](_[_0x3fb5('0x3f')](_0x495f41[_0x3fb5('0x36')],_0x5cbfd3['filters']),_0x715501);if(_0x495f41[_0x3fb5('0x36')][_0x3fb5('0x40')]){_0x58f0ca[_0x3fb5('0x3e')]=_[_0x3fb5('0x41')](_0x58f0ca[_0x3fb5('0x3e')],{'$or':_['map'](_0x715501,function(_0x294222){if(_0x294222[_0x3fb5('0x33')]!==_0x3fb5('0x42')){var _0x2fa1ba={};_0x2fa1ba[_0x294222[_0x3fb5('0x2c')]]={'$like':'%'+_0x495f41[_0x3fb5('0x36')][_0x3fb5('0x40')]+'%'};return _0x2fa1ba;}})});}_0x58f0ca=_[_0x3fb5('0x41')]({},_0x58f0ca,_0x495f41[_0x3fb5('0x43')]);var _0xf73122={'where':_0x58f0ca[_0x3fb5('0x3e')]};return db[_0x3fb5('0x30')][_0x3fb5('0x1f')](_0xf73122)[_0x3fb5('0x25')](function(_0x7e850f){_0x2eae77[_0x3fb5('0x1f')]=_0x7e850f;if(_0x495f41[_0x3fb5('0x36')][_0x3fb5('0x44')]){_0x58f0ca['include']=[{'all':!![]}];}return db[_0x3fb5('0x30')]['findAll'](_0x58f0ca);})['then'](function(_0xa50e9b){_0x2eae77[_0x3fb5('0x45')]=_0xa50e9b;return _0x2eae77;})['then'](respondWithFilteredResult(_0x51674b,_0x58f0ca))[_0x3fb5('0x46')](handleError(_0x51674b,null));};exports['show']=function(_0x210664,_0x15a799){var _0xf2b081={'raw':!![],'where':{'id':_0x210664[_0x3fb5('0x47')]['id']}},_0x5e3faa={};_0x5e3faa[_0x3fb5('0x35')]=_[_0x3fb5('0x48')](db['SquareOdbc']['rawAttributes']);_0x5e3faa['query']=_['keys'](_0x210664['query']);_0x5e3faa[_0x3fb5('0x37')]=_['intersection'](_0x5e3faa[_0x3fb5('0x35')],_0x5e3faa[_0x3fb5('0x36')]);_0xf2b081[_0x3fb5('0x38')]=_[_0x3fb5('0x49')](_0x5e3faa[_0x3fb5('0x35')],qs['fields'](_0x210664[_0x3fb5('0x36')][_0x3fb5('0x39')]));_0xf2b081[_0x3fb5('0x38')]=_0xf2b081[_0x3fb5('0x38')][_0x3fb5('0x4a')]?_0xf2b081['attributes']:_0x5e3faa[_0x3fb5('0x35')];if(_0x210664[_0x3fb5('0x36')][_0x3fb5('0x44')]){_0xf2b081[_0x3fb5('0x4b')]=[{'all':!![]}];}_0xf2b081=_['merge']({},_0xf2b081,_0x210664[_0x3fb5('0x43')]);return db['SquareOdbc']['find'](_0xf2b081)[_0x3fb5('0x25')](handleEntityNotFound(_0x15a799,null))['then'](respondWithResult(_0x15a799,null))[_0x3fb5('0x46')](handleError(_0x15a799,null));};exports[_0x3fb5('0x4c')]=function(_0x51903c,_0x520403){return db[_0x3fb5('0x30')][_0x3fb5('0x4c')](_0x51903c[_0x3fb5('0x4d')],{})[_0x3fb5('0x25')](function(_0x11a5f0){var _0x2f6212=_0x51903c[_0x3fb5('0x4e')][_0x3fb5('0x27')]({'plain':!![]});if(!_0x2f6212)throw new Error(_0x3fb5('0x4f'));if(_0x2f6212[_0x3fb5('0x50')]===_0x3fb5('0x4e')){var _0x25e8a9=_0x11a5f0[_0x3fb5('0x27')]({'plain':!![]});var _0x2cc69c=_0x3fb5('0x51');return db[_0x3fb5('0x52')][_0x3fb5('0x53')]({'where':{'name':_0x2cc69c,'userProfileId':_0x2f6212[_0x3fb5('0x54')]},'raw':!![]})[_0x3fb5('0x25')](function(_0x45f9f5){if(_0x45f9f5&&_0x45f9f5['autoAssociation']===0x0){return db[_0x3fb5('0x28')][_0x3fb5('0x4c')]({'name':_0x25e8a9[_0x3fb5('0x2c')],'resourceId':_0x25e8a9['id'],'type':_0x45f9f5['name'],'sectionId':_0x45f9f5['id']},{})[_0x3fb5('0x25')](function(){return _0x11a5f0;});}else{return _0x11a5f0;}})[_0x3fb5('0x46')](function(_0x344641){logger['error'](_0x3fb5('0x55'),_0x344641);throw _0x344641;});}return _0x11a5f0;})['then'](respondWithResult(_0x520403,0xc9))['catch'](handleError(_0x520403,null));};exports['update']=function(_0x406d4b,_0x56944a){if(_0x406d4b[_0x3fb5('0x4d')]['id']){delete _0x406d4b[_0x3fb5('0x4d')]['id'];}return db[_0x3fb5('0x30')][_0x3fb5('0x53')]({'where':{'id':_0x406d4b['params']['id']}})[_0x3fb5('0x25')](handleEntityNotFound(_0x56944a,null))[_0x3fb5('0x25')](saveUpdates(_0x406d4b[_0x3fb5('0x4d')],null))[_0x3fb5('0x25')](respondWithResult(_0x56944a,null))[_0x3fb5('0x46')](handleError(_0x56944a,null));};exports[_0x3fb5('0x26')]=function(_0x15d8a7,_0x1ea1ac){return db['SquareOdbc']['find']({'where':{'id':_0x15d8a7[_0x3fb5('0x47')]['id']}})[_0x3fb5('0x25')](handleEntityNotFound(_0x1ea1ac,null))['then'](removeEntity(_0x1ea1ac,null))[_0x3fb5('0x46')](handleError(_0x1ea1ac,null));};exports['test']=function(_0x19b5d1,_0x1204fa,_0x5b3b9b){var _0x58a853;return db[_0x3fb5('0x30')][_0x3fb5('0x53')]({'where':{'id':_0x19b5d1[_0x3fb5('0x47')]['id']},'attributes':['id',_0x3fb5('0x56')]})['then'](handleEntityNotFound(_0x1204fa,null))[_0x3fb5('0x25')](function(_0x56b2cb){if(_0x56b2cb){var _0x4bab7e=require('odbc')();_0x4bab7e[_0x3fb5('0x57')](_0x56b2cb['dsn']);_0x4bab7e[_0x3fb5('0x58')]();return _0x56b2cb;}})[_0x3fb5('0x25')](respondWithResult(_0x1204fa,null))[_0x3fb5('0x46')](handleError(_0x1204fa,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 1af8a89..a052434 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 _0xb6e5=['request-promise','path','rimraf','../../config/environment','./squareOdbc.attributes','exports','define','SquareOdbc','square_odbc','lodash','../../config/logger','moment','bluebird'];(function(_0x2d4661,_0x2da65c){var _0x42ed1e=function(_0x263c50){while(--_0x263c50){_0x2d4661['push'](_0x2d4661['shift']());}};_0x42ed1e(++_0x2da65c);}(_0xb6e5,0x1c3));var _0x5b6e=function(_0x27b1c5,_0x1effcc){_0x27b1c5=_0x27b1c5-0x0;var _0x2915a2=_0xb6e5[_0x27b1c5];return _0x2915a2;};'use strict';var _=require(_0x5b6e('0x0'));var util=require('util');var logger=require(_0x5b6e('0x1'))('api');var moment=require(_0x5b6e('0x2'));var BPromise=require(_0x5b6e('0x3'));var rp=require(_0x5b6e('0x4'));var fs=require('fs');var path=require(_0x5b6e('0x5'));var rimraf=require(_0x5b6e('0x6'));var config=require(_0x5b6e('0x7'));var attributes=require(_0x5b6e('0x8'));module[_0x5b6e('0x9')]=function(_0x1ffe0f,_0x5a3d06){return _0x1ffe0f[_0x5b6e('0xa')](_0x5b6e('0xb'),attributes,{'tableName':_0x5b6e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x06a2=['./squareOdbc.attributes','define','SquareOdbc','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x06a2,0xab));var _0x206a=function(_0x2192db,_0x480c18){_0x2192db=_0x2192db-0x0;var _0x29bb31=_0x06a2[_0x2192db];return _0x29bb31;};'use strict';var _=require(_0x206a('0x0'));var util=require(_0x206a('0x1'));var logger=require(_0x206a('0x2'))(_0x206a('0x3'));var moment=require(_0x206a('0x4'));var BPromise=require(_0x206a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x206a('0x6'));var rimraf=require(_0x206a('0x7'));var config=require(_0x206a('0x8'));var attributes=require(_0x206a('0x9'));module['exports']=function(_0x5542bb,_0x91a0a7){return _0x5542bb[_0x206a('0xa')](_0x206a('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 0e6a239..e52696d 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 _0x77de=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','request\x20sent','debug','stringify','error','code','message','result','catch','SquareOdbc,\x20%s,\x20%s','ShowSquareOdbc','find','options','raw','where','attributes','include','map','model','lodash','util','moment'];(function(_0x3e7e17,_0x39822f){var _0x195697=function(_0xbbe020){while(--_0xbbe020){_0x3e7e17['push'](_0x3e7e17['shift']());}};_0x195697(++_0x39822f);}(_0x77de,0x17d));var _0xe77d=function(_0x3d2d6f,_0x368872){_0x3d2d6f=_0x3d2d6f-0x0;var _0x5c0022=_0x77de[_0x3d2d6f];return _0x5c0022;};'use strict';var _=require(_0xe77d('0x0'));var util=require(_0xe77d('0x1'));var moment=require(_0xe77d('0x2'));var BPromise=require(_0xe77d('0x3'));var rs=require(_0xe77d('0x4'));var fs=require('fs');var Redis=require(_0xe77d('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xe77d('0x6'));var logger=require(_0xe77d('0x7'))(_0xe77d('0x8'));var config=require('../../config/environment');var jayson=require(_0xe77d('0x9'));var client=jayson[_0xe77d('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x370430,_0x3100ae,_0x2ca3e4){return new BPromise(function(_0x4eb288,_0x1a3600){return client[_0xe77d('0xb')](_0x370430,_0x2ca3e4)[_0xe77d('0xc')](function(_0x5485fc){logger[_0xe77d('0xd')]('SquareOdbc,\x20%s,\x20%s',_0x3100ae,_0xe77d('0xe'));logger[_0xe77d('0xf')]('SquareOdbc,\x20%s,\x20%s,\x20%s',_0x3100ae,'request\x20sent',JSON[_0xe77d('0x10')](_0x5485fc));if(_0x5485fc[_0xe77d('0x11')]){if(_0x5485fc['error'][_0xe77d('0x12')]===0x1f4){logger[_0xe77d('0x11')]('SquareOdbc,\x20%s,\x20%s',_0x3100ae,_0x5485fc['error']['message']);return _0x1a3600(_0x5485fc[_0xe77d('0x11')][_0xe77d('0x13')]);}logger[_0xe77d('0x11')]('SquareOdbc,\x20%s,\x20%s',_0x3100ae,_0x5485fc[_0xe77d('0x11')][_0xe77d('0x13')]);return _0x4eb288(_0x5485fc[_0xe77d('0x11')][_0xe77d('0x13')]);}else{logger['info']('SquareOdbc,\x20%s,\x20%s',_0x3100ae,_0xe77d('0xe'));_0x4eb288(_0x5485fc[_0xe77d('0x14')]['message']);}})[_0xe77d('0x15')](function(_0x3d03cd){logger[_0xe77d('0x11')](_0xe77d('0x16'),_0x3100ae,_0x3d03cd);_0x1a3600(_0x3d03cd);});});}exports[_0xe77d('0x17')]=function(_0x385436){var _0x5590fd=this;return new Promise(function(_0x2f57c5,_0x154258){return db['SquareOdbc'][_0xe77d('0x18')]({'raw':_0x385436[_0xe77d('0x19')]?_0x385436[_0xe77d('0x19')][_0xe77d('0x1a')]===undefined?!![]:![]:!![],'where':_0x385436[_0xe77d('0x19')]?_0x385436[_0xe77d('0x19')][_0xe77d('0x1b')]||null:null,'attributes':_0x385436[_0xe77d('0x19')]?_0x385436['options'][_0xe77d('0x1c')]||null:null,'include':_0x385436['options']?_0x385436[_0xe77d('0x19')][_0xe77d('0x1d')]?_[_0xe77d('0x1e')](_0x385436[_0xe77d('0x19')][_0xe77d('0x1d')],function(_0xe24e20){return{'model':db[_0xe24e20['model']],'as':_0xe24e20['as'],'attributes':_0xe24e20[_0xe77d('0x1c')],'include':_0xe24e20['include']?_[_0xe77d('0x1e')](_0xe24e20[_0xe77d('0x1d')],function(_0x1cdd42){return{'model':db[_0x1cdd42[_0xe77d('0x1f')]],'as':_0x1cdd42['as'],'attributes':_0x1cdd42['attributes'],'include':_0x1cdd42['include']?_[_0xe77d('0x1e')](_0x1cdd42['include'],function(_0x3b3a15){return{'model':db[_0x3b3a15[_0xe77d('0x1f')]],'as':_0x3b3a15['as'],'attributes':_0x3b3a15['attributes']};}):[]};}):[]};}):[]:[]})[_0xe77d('0xc')](function(_0x50aa1b){logger[_0xe77d('0xd')](_0xe77d('0x17'),_0x385436);logger['debug']('ShowSquareOdbc',_0x385436,JSON[_0xe77d('0x10')](_0x50aa1b));_0x2f57c5(_0x50aa1b);})[_0xe77d('0x15')](function(_0x13d452){logger[_0xe77d('0x11')](_0xe77d('0x17'),_0x13d452[_0xe77d('0x13')],_0x385436);_0x154258(_0x5590fd['error'](0x1f4,_0x13d452[_0xe77d('0x13')]));});});}; \ No newline at end of file +var _0x86d1=['stringify','error','code','message','result','catch','ShowSquareOdbc','SquareOdbc','options','raw','attributes','include','model','map','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s'];(function(_0x29ea15,_0x2acd73){var _0x2687d4=function(_0x21a7e1){while(--_0x21a7e1){_0x29ea15['push'](_0x29ea15['shift']());}};_0x2687d4(++_0x2acd73);}(_0x86d1,0x19a));var _0x186d=function(_0x247d6c,_0x5c40dd){_0x247d6c=_0x247d6c-0x0;var _0x598f3e=_0x86d1[_0x247d6c];return _0x598f3e;};'use strict';var _=require(_0x186d('0x0'));var util=require(_0x186d('0x1'));var moment=require('moment');var BPromise=require(_0x186d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x186d('0x3'));var db=require(_0x186d('0x4'))['db'];var utils=require(_0x186d('0x5'));var logger=require(_0x186d('0x6'))(_0x186d('0x7'));var config=require(_0x186d('0x8'));var jayson=require(_0x186d('0x9'));var client=jayson[_0x186d('0xa')][_0x186d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x426550,_0x1c73b9,_0x5bfb5b){return new BPromise(function(_0x3fd680,_0x2415d6){return client[_0x186d('0xc')](_0x426550,_0x5bfb5b)[_0x186d('0xd')](function(_0x68b4d){logger[_0x186d('0xe')](_0x186d('0xf'),_0x1c73b9,_0x186d('0x10'));logger[_0x186d('0x11')](_0x186d('0x12'),_0x1c73b9,_0x186d('0x10'),JSON[_0x186d('0x13')](_0x68b4d));if(_0x68b4d[_0x186d('0x14')]){if(_0x68b4d[_0x186d('0x14')][_0x186d('0x15')]===0x1f4){logger[_0x186d('0x14')]('SquareOdbc,\x20%s,\x20%s',_0x1c73b9,_0x68b4d[_0x186d('0x14')]['message']);return _0x2415d6(_0x68b4d[_0x186d('0x14')][_0x186d('0x16')]);}logger[_0x186d('0x14')](_0x186d('0xf'),_0x1c73b9,_0x68b4d[_0x186d('0x14')][_0x186d('0x16')]);return _0x3fd680(_0x68b4d['error']['message']);}else{logger[_0x186d('0xe')](_0x186d('0xf'),_0x1c73b9,_0x186d('0x10'));_0x3fd680(_0x68b4d[_0x186d('0x17')][_0x186d('0x16')]);}})[_0x186d('0x18')](function(_0x40beb9){logger[_0x186d('0x14')](_0x186d('0xf'),_0x1c73b9,_0x40beb9);_0x2415d6(_0x40beb9);});});}exports[_0x186d('0x19')]=function(_0x12b0fa){var _0xc51abd=this;return new Promise(function(_0x3b28af,_0x35113b){return db[_0x186d('0x1a')]['find']({'raw':_0x12b0fa[_0x186d('0x1b')]?_0x12b0fa['options'][_0x186d('0x1c')]===undefined?!![]:![]:!![],'where':_0x12b0fa[_0x186d('0x1b')]?_0x12b0fa[_0x186d('0x1b')]['where']||null:null,'attributes':_0x12b0fa[_0x186d('0x1b')]?_0x12b0fa['options'][_0x186d('0x1d')]||null:null,'include':_0x12b0fa[_0x186d('0x1b')]?_0x12b0fa['options'][_0x186d('0x1e')]?_['map'](_0x12b0fa['options']['include'],function(_0x4211b3){return{'model':db[_0x4211b3[_0x186d('0x1f')]],'as':_0x4211b3['as'],'attributes':_0x4211b3[_0x186d('0x1d')],'include':_0x4211b3[_0x186d('0x1e')]?_[_0x186d('0x20')](_0x4211b3['include'],function(_0x319f8e){return{'model':db[_0x319f8e[_0x186d('0x1f')]],'as':_0x319f8e['as'],'attributes':_0x319f8e[_0x186d('0x1d')],'include':_0x319f8e['include']?_[_0x186d('0x20')](_0x319f8e[_0x186d('0x1e')],function(_0xae3d97){return{'model':db[_0xae3d97[_0x186d('0x1f')]],'as':_0xae3d97['as'],'attributes':_0xae3d97[_0x186d('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x186d('0xd')](function(_0x240fbe){logger[_0x186d('0xe')](_0x186d('0x19'),_0x12b0fa);logger[_0x186d('0x11')]('ShowSquareOdbc',_0x12b0fa,JSON['stringify'](_0x240fbe));_0x3b28af(_0x240fbe);})[_0x186d('0x18')](function(_0x110ca9){logger[_0x186d('0x14')]('ShowSquareOdbc',_0x110ca9[_0x186d('0x16')],_0x12b0fa);_0x35113b(_0xc51abd[_0x186d('0x14')](0x1f4,_0x110ca9[_0x186d('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 29f7f70..5da11a8 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 _0x10d6=['update','destroy','removeUsers','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','get','index','/:id','isAuthenticated','show','/:id/users','getUsers','post','create','addUsers','put'];(function(_0x36ed3c,_0x44a00a){var _0x52a2e0=function(_0x3f7af9){while(--_0x3f7af9){_0x36ed3c['push'](_0x36ed3c['shift']());}};_0x52a2e0(++_0x44a00a);}(_0x10d6,0x145));var _0x610d=function(_0x15ba11,_0xbfc55){_0x15ba11=_0x15ba11-0x0;var _0x2f0018=_0x10d6[_0x15ba11];return _0x2f0018;};'use strict';var multer=require('multer');var util=require(_0x610d('0x0'));var path=require(_0x610d('0x1'));var timeout=require(_0x610d('0x2'));var express=require('express');var router=express[_0x610d('0x3')]();var fs_extra=require(_0x610d('0x4'));var auth=require(_0x610d('0x5'));var interaction=require(_0x610d('0x6'));var config=require(_0x610d('0x7'));var controller=require(_0x610d('0x8'));router[_0x610d('0x9')]('/',auth['isAuthenticated'](),controller[_0x610d('0xa')]);router[_0x610d('0x9')](_0x610d('0xb'),auth[_0x610d('0xc')](),controller[_0x610d('0xd')]);router[_0x610d('0x9')](_0x610d('0xe'),auth[_0x610d('0xc')](),controller[_0x610d('0xf')]);router[_0x610d('0x10')]('/',auth[_0x610d('0xc')](),controller[_0x610d('0x11')]);router[_0x610d('0x10')](_0x610d('0xe'),auth['isAuthenticated'](),controller[_0x610d('0x12')]);router[_0x610d('0x13')]('/:id',auth[_0x610d('0xc')](),controller[_0x610d('0x14')]);router['delete'](_0x610d('0xb'),auth[_0x610d('0xc')](),controller[_0x610d('0x15')]);router['delete'](_0x610d('0xe'),auth[_0x610d('0xc')](),controller[_0x610d('0x16')]);module['exports']=router; \ No newline at end of file +var _0x5454=['create','addUsers','put','delete','destroy','removeUsers','exports','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','isAuthenticated','index','get','/:id','show','/:id/users','getUsers','post'];(function(_0x45acf1,_0x34f23f){var _0xf38e77=function(_0x26ad7e){while(--_0x26ad7e){_0x45acf1['push'](_0x45acf1['shift']());}};_0xf38e77(++_0x34f23f);}(_0x5454,0x15b));var _0x4545=function(_0x29744f,_0x55ea8a){_0x29744f=_0x29744f-0x0;var _0x23622b=_0x5454[_0x29744f];return _0x23622b;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x4545('0x0'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4545('0x1'));var interaction=require(_0x4545('0x2'));var config=require(_0x4545('0x3'));var controller=require(_0x4545('0x4'));router['get']('/',auth[_0x4545('0x5')](),controller[_0x4545('0x6')]);router[_0x4545('0x7')](_0x4545('0x8'),auth[_0x4545('0x5')](),controller[_0x4545('0x9')]);router[_0x4545('0x7')](_0x4545('0xa'),auth[_0x4545('0x5')](),controller[_0x4545('0xb')]);router[_0x4545('0xc')]('/',auth[_0x4545('0x5')](),controller[_0x4545('0xd')]);router['post'](_0x4545('0xa'),auth[_0x4545('0x5')](),controller[_0x4545('0xe')]);router[_0x4545('0xf')](_0x4545('0x8'),auth[_0x4545('0x5')](),controller['update']);router[_0x4545('0x10')](_0x4545('0x8'),auth[_0x4545('0x5')](),controller[_0x4545('0x11')]);router[_0x4545('0x10')](_0x4545('0xa'),auth[_0x4545('0x5')](),controller[_0x4545('0x12')]);module[_0x4545('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 8f8214c..4236067 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 _0x2c06=['utf8','production','DATE','sequelize','exports','STRING','BLOB','preproduction','getDataValue','toString'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0x2c06,0x1cf));var _0x62c0=function(_0x4fdc4c,_0x1cade6){_0x4fdc4c=_0x4fdc4c-0x0;var _0x3e08a1=_0x2c06[_0x4fdc4c];return _0x3e08a1;};'use strict';var Sequelize=require(_0x62c0('0x0'));module[_0x62c0('0x1')]={'name':{'type':Sequelize[_0x62c0('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x62c0('0x2')]},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize[_0x62c0('0x3')]('long'),'get':function(){if(this['getDataValue'](_0x62c0('0x4'))){return this[_0x62c0('0x5')](_0x62c0('0x4'))[_0x62c0('0x6')](_0x62c0('0x7'));}}},'production':{'type':Sequelize[_0x62c0('0x3')]('long'),'get':function(){if(this[_0x62c0('0x5')]('production')){return this['getDataValue'](_0x62c0('0x8'))[_0x62c0('0x6')](_0x62c0('0x7'));}}},'savedAt':{'type':Sequelize['DATE']},'publishedAt':{'type':Sequelize[_0x62c0('0x9')]}}; \ No newline at end of file +var _0x9192=['long','preproduction','toString','getDataValue','production','utf8','DATE','sequelize','exports','STRING','name','TEXT','BLOB'];(function(_0x246688,_0x4c1507){var _0x2558c6=function(_0x56fae2){while(--_0x56fae2){_0x246688['push'](_0x246688['shift']());}};_0x2558c6(++_0x4c1507);}(_0x9192,0x1a7));var _0x2919=function(_0x4105a8,_0x198324){_0x4105a8=_0x4105a8-0x0;var _0x553f0c=_0x9192[_0x4105a8];return _0x553f0c;};'use strict';var Sequelize=require(_0x2919('0x0'));module[_0x2919('0x1')]={'name':{'type':Sequelize[_0x2919('0x2')],'unique':_0x2919('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x2919('0x2')]},'notes':{'type':Sequelize[_0x2919('0x4')]},'preproduction':{'type':Sequelize[_0x2919('0x5')](_0x2919('0x6')),'get':function(){if(this['getDataValue'](_0x2919('0x7'))){return this['getDataValue'](_0x2919('0x7'))[_0x2919('0x8')]('utf8');}}},'production':{'type':Sequelize[_0x2919('0x5')](_0x2919('0x6')),'get':function(){if(this[_0x2919('0x9')](_0x2919('0xa'))){return this[_0x2919('0x9')](_0x2919('0xa'))['toString'](_0x2919('0xb'));}}},'savedAt':{'type':Sequelize[_0x2919('0xc')]},'publishedAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index d81ecca..62d5cf8 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 _0x1506=['addUsers','omit','removeUsers','ids','emit','userSquareProject:remove','findOne','User','order','getUsers','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','redis','defaults','localhost','./squareProject.socket','register','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','reject','update','then','destroy','get','SquareProjects','UserProfileResource','error','name','send','index','map','SquareProject','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','show','length','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','create','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params'];(function(_0x44cd4d,_0x40b938){var _0x1575d3=function(_0x25c24a){while(--_0x25c24a){_0x44cd4d['push'](_0x44cd4d['shift']());}};_0x1575d3(++_0x40b938);}(_0x1506,0xc0));var _0x6150=function(_0x2f2020,_0xab1788){_0x2f2020=_0x2f2020-0x0;var _0x11b320=_0x1506[_0x2f2020];return _0x11b320;};'use strict';var emlformat=require(_0x6150('0x0'));var rimraf=require(_0x6150('0x1'));var zipdir=require(_0x6150('0x2'));var jsonpatch=require(_0x6150('0x3'));var rp=require(_0x6150('0x4'));var moment=require(_0x6150('0x5'));var BPromise=require(_0x6150('0x6'));var Mustache=require('mustache');var util=require(_0x6150('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x6150('0x8'));var ejs=require(_0x6150('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6150('0xa'));var squel=require('squel');var crypto=require(_0x6150('0xb'));var jsforce=require(_0x6150('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x6150('0x8'));var querystring=require(_0x6150('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6150('0xe'));var qs=require(_0x6150('0xf'));var as=require(_0x6150('0x10'));var hardwareService=require(_0x6150('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x6150('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x6150('0x13'));var db=require('../../mysqldb')['db'];config[_0x6150('0x14')]=_[_0x6150('0x15')](config[_0x6150('0x14')],{'host':_0x6150('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6150('0x14')]));require(_0x6150('0x17'))[_0x6150('0x18')](socket);function respondWithStatusCode(_0x80a60e,_0x1f67d1){_0x1f67d1=_0x1f67d1||0xcc;return function(_0x38c315){if(_0x38c315){return _0x80a60e[_0x6150('0x19')](_0x1f67d1);}return _0x80a60e[_0x6150('0x1a')](_0x1f67d1)[_0x6150('0x1b')]();};}function respondWithResult(_0x370372,_0x397d8c){_0x397d8c=_0x397d8c||0xc8;return function(_0x288f9b){if(_0x288f9b){return _0x370372[_0x6150('0x1a')](_0x397d8c)[_0x6150('0x1c')](_0x288f9b);}};}function respondWithFilteredResult(_0x1fce9b,_0x30c9d8){return function(_0x2a39c1){if(_0x2a39c1){var _0x3ff48d=typeof _0x30c9d8[_0x6150('0x1d')]===_0x6150('0x1e')&&typeof _0x30c9d8[_0x6150('0x1f')]===_0x6150('0x1e');var _0x3afff0=_0x2a39c1['count'];var _0xabf261=_0x3ff48d?0x0:_0x30c9d8[_0x6150('0x1d')];var _0xf97332=_0x3ff48d?_0x2a39c1['count']:_0x30c9d8['offset']+_0x30c9d8['limit'];var _0x23d26c;if(_0xf97332>=_0x3afff0){_0xf97332=_0x3afff0;_0x23d26c=0xc8;}else{_0x23d26c=0xce;}_0x1fce9b[_0x6150('0x1a')](_0x23d26c);return _0x1fce9b[_0x6150('0x20')](_0x6150('0x21'),_0xabf261+'-'+_0xf97332+'/'+_0x3afff0)['json'](_0x2a39c1);}return null;};}function patchUpdates(_0x31fb4f){return function(_0x5b1be7){try{jsonpatch['apply'](_0x5b1be7,_0x31fb4f,!![]);}catch(_0x5a9728){return BPromise[_0x6150('0x22')](_0x5a9728);}return _0x5b1be7['save']();};}function saveUpdates(_0x37861b,_0x2d5682){return function(_0x5d4b57){if(_0x5d4b57){return _0x5d4b57[_0x6150('0x23')](_0x37861b)[_0x6150('0x24')](function(_0x4cf16c){return _0x4cf16c;});}return null;};}function removeEntity(_0x374cfa,_0x869034){return function(_0x26e1a9){if(_0x26e1a9){return _0x26e1a9[_0x6150('0x25')]()[_0x6150('0x24')](function(){var _0x4704b1=_0x26e1a9[_0x6150('0x26')]({'plain':!![]});var _0x5c8dc1=_0x6150('0x27');return db[_0x6150('0x28')][_0x6150('0x25')]({'where':{'type':_0x5c8dc1,'resourceId':_0x4704b1['id']}})[_0x6150('0x24')](function(){return _0x26e1a9;});})[_0x6150('0x24')](function(){_0x374cfa[_0x6150('0x1a')](0xcc)[_0x6150('0x1b')]();});}};}function handleEntityNotFound(_0xb101ae,_0x271443){return function(_0x51543d){if(!_0x51543d){_0xb101ae[_0x6150('0x19')](0x194);}return _0x51543d;};}function handleError(_0x5cccb5,_0x3b94d7){_0x3b94d7=_0x3b94d7||0x1f4;return function(_0x39dd7a){logger[_0x6150('0x29')](_0x39dd7a['stack']);if(_0x39dd7a[_0x6150('0x2a')]){delete _0x39dd7a[_0x6150('0x2a')];}_0x5cccb5[_0x6150('0x1a')](_0x3b94d7)[_0x6150('0x2b')](_0x39dd7a);};}exports[_0x6150('0x2c')]=function(_0x39288d,_0x181d0f){var _0x978197={},_0x5e95cb={},_0x15a9a4={'count':0x0,'rows':[]};var _0x191b94=_[_0x6150('0x2d')](db[_0x6150('0x2e')][_0x6150('0x2f')],function(_0x330d4f){return{'name':_0x330d4f['fieldName'],'type':_0x330d4f[_0x6150('0x30')]['key']};});_0x5e95cb[_0x6150('0x31')]=_['map'](_0x191b94,_0x6150('0x2a'));_0x5e95cb[_0x6150('0x32')]=_[_0x6150('0x33')](_0x39288d[_0x6150('0x32')]);_0x5e95cb[_0x6150('0x34')]=_[_0x6150('0x35')](_0x5e95cb[_0x6150('0x31')],_0x5e95cb[_0x6150('0x32')]);_0x978197[_0x6150('0x36')]=_['intersection'](_0x5e95cb[_0x6150('0x31')],qs[_0x6150('0x37')](_0x39288d[_0x6150('0x32')][_0x6150('0x37')]));_0x978197[_0x6150('0x36')]=_0x978197[_0x6150('0x36')]['length']?_0x978197['attributes']:_0x5e95cb[_0x6150('0x31')];if(!_0x39288d[_0x6150('0x32')][_0x6150('0x38')](_0x6150('0x39'))){_0x978197[_0x6150('0x1f')]=qs['limit'](_0x39288d[_0x6150('0x32')][_0x6150('0x1f')]);_0x978197['offset']=qs[_0x6150('0x1d')](_0x39288d['query'][_0x6150('0x1d')]);}_0x978197['order']=qs[_0x6150('0x3a')](_0x39288d[_0x6150('0x32')][_0x6150('0x3a')]);_0x978197[_0x6150('0x3b')]=qs[_0x6150('0x34')](_[_0x6150('0x3c')](_0x39288d[_0x6150('0x32')],_0x5e95cb[_0x6150('0x34')]),_0x191b94);if(_0x39288d[_0x6150('0x32')][_0x6150('0x3d')]){_0x978197[_0x6150('0x3b')]=_[_0x6150('0x3e')](_0x978197[_0x6150('0x3b')],{'$or':_['map'](_0x191b94,function(_0x4c5d2f){if(_0x4c5d2f[_0x6150('0x30')]!==_0x6150('0x3f')){var _0x5ae0d9={};_0x5ae0d9[_0x4c5d2f[_0x6150('0x2a')]]={'$like':'%'+_0x39288d[_0x6150('0x32')][_0x6150('0x3d')]+'%'};return _0x5ae0d9;}})});}_0x978197=_[_0x6150('0x3e')]({},_0x978197,_0x39288d[_0x6150('0x40')]);var _0x22f9c1={'where':_0x978197[_0x6150('0x3b')]};return db[_0x6150('0x2e')]['count'](_0x22f9c1)[_0x6150('0x24')](function(_0x1bb099){_0x15a9a4[_0x6150('0x41')]=_0x1bb099;if(_0x39288d[_0x6150('0x32')][_0x6150('0x42')]){_0x978197[_0x6150('0x43')]=[{'all':!![]}];}return db[_0x6150('0x2e')][_0x6150('0x44')](_0x978197);})[_0x6150('0x24')](function(_0x4e3d73){_0x15a9a4[_0x6150('0x45')]=_0x4e3d73;return _0x15a9a4;})['then'](respondWithFilteredResult(_0x181d0f,_0x978197))['catch'](handleError(_0x181d0f,null));};exports[_0x6150('0x46')]=function(_0x2afa93,_0x146377){var _0x2db80f={'raw':![],'where':{'id':_0x2afa93['params']['id']}},_0xc8ce31={};_0xc8ce31['model']=_['keys'](db[_0x6150('0x2e')][_0x6150('0x2f')]);_0xc8ce31['query']=_[_0x6150('0x33')](_0x2afa93['query']);_0xc8ce31[_0x6150('0x34')]=_['intersection'](_0xc8ce31['model'],_0xc8ce31['query']);_0x2db80f['attributes']=_[_0x6150('0x35')](_0xc8ce31[_0x6150('0x31')],qs[_0x6150('0x37')](_0x2afa93[_0x6150('0x32')]['fields']));_0x2db80f[_0x6150('0x36')]=_0x2db80f[_0x6150('0x36')][_0x6150('0x47')]?_0x2db80f[_0x6150('0x36')]:_0xc8ce31[_0x6150('0x31')];if(_0x2afa93[_0x6150('0x32')][_0x6150('0x42')]){_0x2db80f['include']=[{'all':!![]}];}_0x2db80f=_['merge']({},_0x2db80f,_0x2afa93[_0x6150('0x40')]);return db['SquareProject']['find'](_0x2db80f)[_0x6150('0x24')](handleEntityNotFound(_0x146377,null))[_0x6150('0x24')](respondWithResult(_0x146377,null))['catch'](handleError(_0x146377,null));};exports['create']=function(_0x101e32,_0x5a1435){return db[_0x6150('0x2e')]['create'](_0x101e32[_0x6150('0x48')],{})[_0x6150('0x24')](function(_0x20e3a1){var _0x5b34d3=_0x101e32['user'][_0x6150('0x26')]({'plain':!![]});if(!_0x5b34d3)throw new Error(_0x6150('0x49'));if(_0x5b34d3[_0x6150('0x4a')]==='user'){var _0x4f7315=_0x20e3a1[_0x6150('0x26')]({'plain':!![]});var _0x5c6d8d='SquareProjects';return db['UserProfileSection'][_0x6150('0x4b')]({'where':{'name':_0x5c6d8d,'userProfileId':_0x5b34d3[_0x6150('0x4c')]},'raw':!![]})['then'](function(_0xc52080){if(_0xc52080&&_0xc52080['autoAssociation']===0x0){return db['UserProfileResource'][_0x6150('0x4d')]({'name':_0x4f7315[_0x6150('0x2a')],'resourceId':_0x4f7315['id'],'type':_0xc52080[_0x6150('0x2a')],'sectionId':_0xc52080['id']},{})[_0x6150('0x24')](function(){return _0x20e3a1;});}else{return _0x20e3a1;}})[_0x6150('0x4e')](function(_0x242224){logger[_0x6150('0x29')](_0x6150('0x4f'),_0x242224);throw _0x242224;});}return _0x20e3a1;})[_0x6150('0x24')](respondWithResult(_0x5a1435,0xc9))['catch'](handleError(_0x5a1435,null));};exports[_0x6150('0x23')]=function(_0x160e39,_0x5b5638){if(_0x160e39['body']['id']){delete _0x160e39[_0x6150('0x48')]['id'];}return db[_0x6150('0x2e')][_0x6150('0x4b')]({'where':{'id':_0x160e39[_0x6150('0x50')]['id']}})[_0x6150('0x24')](handleEntityNotFound(_0x5b5638,null))[_0x6150('0x24')](saveUpdates(_0x160e39[_0x6150('0x48')],null))[_0x6150('0x24')](respondWithResult(_0x5b5638,null))[_0x6150('0x4e')](handleError(_0x5b5638,null));};exports[_0x6150('0x25')]=function(_0x5d8671,_0x209ce1){return db[_0x6150('0x2e')][_0x6150('0x4b')]({'where':{'id':_0x5d8671['params']['id']}})[_0x6150('0x24')](handleEntityNotFound(_0x209ce1,null))[_0x6150('0x24')](removeEntity(_0x209ce1,null))[_0x6150('0x4e')](handleError(_0x209ce1,null));};exports['addUsers']=function(_0x3961d2,_0x15b76e,_0x335554){return db[_0x6150('0x2e')][_0x6150('0x4b')]({'where':{'id':_0x3961d2[_0x6150('0x50')]['id']}})[_0x6150('0x24')](handleEntityNotFound(_0x15b76e,null))['then'](function(_0x4c9a6a){if(_0x4c9a6a){return _0x4c9a6a[_0x6150('0x51')](_0x3961d2[_0x6150('0x48')]['ids'],_[_0x6150('0x52')](_0x3961d2['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x15b76e,null))[_0x6150('0x4e')](handleError(_0x15b76e,null));};exports[_0x6150('0x53')]=function(_0x10eed9,_0x31d2f8,_0x34161f){return db[_0x6150('0x2e')][_0x6150('0x4b')]({'where':{'id':_0x10eed9[_0x6150('0x50')]['id']}})[_0x6150('0x24')](handleEntityNotFound(_0x31d2f8,null))[_0x6150('0x24')](function(_0xe05acf){if(_0xe05acf){return _0xe05acf[_0x6150('0x53')](_0x10eed9[_0x6150('0x32')][_0x6150('0x54')])[_0x6150('0x24')](function(){if(_['isArray'](_0x10eed9[_0x6150('0x32')][_0x6150('0x54')])){for(var _0x725e7c=0x0;_0x725e7c<_0x10eed9[_0x6150('0x32')][_0x6150('0x54')]['length'];_0x725e7c+=0x1){socket['emit']('userSquareProject:remove',{'UserId':Number(_0x10eed9[_0x6150('0x32')][_0x6150('0x54')][_0x725e7c]),'SquareProjectId':Number(_0x10eed9[_0x6150('0x50')]['id'])});}}else{socket[_0x6150('0x55')](_0x6150('0x56'),{'UserId':Number(_0x10eed9[_0x6150('0x32')][_0x6150('0x54')]),'SquareProjectId':Number(_0x10eed9[_0x6150('0x50')]['id'])});}});}})[_0x6150('0x24')](respondWithStatusCode(_0x31d2f8,null))[_0x6150('0x4e')](handleError(_0x31d2f8,null));};exports['getUsers']=function(_0x3391a2,_0x3016ce,_0x5b9789){var _0x162941={};var _0x42decc={};var _0x340055;var _0x11c2ac;return db['SquareProject'][_0x6150('0x57')]({'where':{'id':_0x3391a2[_0x6150('0x50')]['id']}})['then'](handleEntityNotFound(_0x3016ce,null))[_0x6150('0x24')](function(_0x21cc3e){if(_0x21cc3e){_0x340055=_0x21cc3e;_0x42decc[_0x6150('0x31')]=_[_0x6150('0x33')](db[_0x6150('0x58')][_0x6150('0x2f')]);_0x42decc['query']=_['keys'](_0x3391a2[_0x6150('0x32')]);_0x42decc[_0x6150('0x34')]=_[_0x6150('0x35')](_0x42decc[_0x6150('0x31')],_0x42decc['query']);_0x162941[_0x6150('0x36')]=_[_0x6150('0x35')](_0x42decc[_0x6150('0x31')],qs[_0x6150('0x37')](_0x3391a2[_0x6150('0x32')][_0x6150('0x37')]));_0x162941[_0x6150('0x36')]=_0x162941[_0x6150('0x36')][_0x6150('0x47')]?_0x162941[_0x6150('0x36')]:_0x42decc['model'];_0x162941[_0x6150('0x59')]=qs[_0x6150('0x3a')](_0x3391a2[_0x6150('0x32')][_0x6150('0x3a')]);_0x162941[_0x6150('0x3b')]=qs[_0x6150('0x34')](_[_0x6150('0x3c')](_0x3391a2[_0x6150('0x32')],_0x42decc['filters']));if(_0x3391a2[_0x6150('0x32')]['filter']){_0x162941[_0x6150('0x3b')]=_['merge'](_0x162941[_0x6150('0x3b')],{'$or':_[_0x6150('0x2d')](_0x162941[_0x6150('0x36')],function(_0x1ecb29){var _0x368e50={};_0x368e50[_0x1ecb29]={'$like':'%'+_0x3391a2[_0x6150('0x32')]['filter']+'%'};return _0x368e50;})});}_0x162941=_[_0x6150('0x3e')]({},_0x162941,_0x3391a2['options']);return _0x340055['getUsers'](_0x162941);}})[_0x6150('0x24')](function(_0x3b590d){if(_0x3b590d){_0x11c2ac=_0x3b590d[_0x6150('0x47')];if(!_0x3391a2['query']['hasOwnProperty']('nolimit')){_0x162941['limit']=qs[_0x6150('0x1f')](_0x3391a2['query'][_0x6150('0x1f')]);_0x162941[_0x6150('0x1d')]=qs[_0x6150('0x1d')](_0x3391a2['query'][_0x6150('0x1d')]);}return _0x340055[_0x6150('0x5a')](_0x162941);}})['then'](function(_0x2e0f4b){if(_0x2e0f4b){return _0x2e0f4b?{'count':_0x11c2ac,'rows':_0x2e0f4b}:null;}})[_0x6150('0x24')](respondWithResult(_0x3016ce,null))['catch'](handleError(_0x3016ce,null));}; \ No newline at end of file +var _0x3c40=['then','destroy','SquareProjects','UserProfileResource','sendStatus','stack','name','send','index','map','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','SquareProject','includeAll','include','findAll','rows','params','keys','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','body','addUsers','ids','omit','removeUsers','isArray','emit','userSquareProject:remove','getUsers','hasOwnProperty','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','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','redis','localhost','./squareProject.socket','register','end','status','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update'];(function(_0x209ec9,_0x30378c){var _0x129b1b=function(_0x2f2b9e){while(--_0x2f2b9e){_0x209ec9['push'](_0x209ec9['shift']());}};_0x129b1b(++_0x30378c);}(_0x3c40,0x9b));var _0x03c4=function(_0x292600,_0x120a55){_0x292600=_0x292600-0x0;var _0x2ef83b=_0x3c40[_0x292600];return _0x2ef83b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x03c4('0x0'));var zipdir=require(_0x03c4('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x03c4('0x2'));var moment=require(_0x03c4('0x3'));var BPromise=require(_0x03c4('0x4'));var Mustache=require(_0x03c4('0x5'));var util=require(_0x03c4('0x6'));var path=require(_0x03c4('0x7'));var sox=require(_0x03c4('0x8'));var csv=require('to-csv');var ejs=require(_0x03c4('0x9'));var fs=require('fs');var fs_extra=require(_0x03c4('0xa'));var _=require('lodash');var squel=require(_0x03c4('0xb'));var crypto=require(_0x03c4('0xc'));var jsforce=require(_0x03c4('0xd'));var deskjs=require(_0x03c4('0xe'));var toCsv=require(_0x03c4('0xf'));var querystring=require(_0x03c4('0x10'));var Papa=require(_0x03c4('0x11'));var Redis=require(_0x03c4('0x12'));var authService=require(_0x03c4('0x13'));var qs=require(_0x03c4('0x14'));var as=require(_0x03c4('0x15'));var hardwareService=require(_0x03c4('0x16'));var logger=require(_0x03c4('0x17'))(_0x03c4('0x18'));var utils=require(_0x03c4('0x19'));var config=require(_0x03c4('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x03c4('0x1b')]=_['defaults'](config[_0x03c4('0x1b')],{'host':_0x03c4('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x03c4('0x1d'))[_0x03c4('0x1e')](socket);function respondWithStatusCode(_0x2e52ef,_0x255cdb){_0x255cdb=_0x255cdb||0xcc;return function(_0x278e5d){if(_0x278e5d){return _0x2e52ef['sendStatus'](_0x255cdb);}return _0x2e52ef['status'](_0x255cdb)[_0x03c4('0x1f')]();};}function respondWithResult(_0x51d1d7,_0x3d5fd6){_0x3d5fd6=_0x3d5fd6||0xc8;return function(_0x2998e9){if(_0x2998e9){return _0x51d1d7[_0x03c4('0x20')](_0x3d5fd6)[_0x03c4('0x21')](_0x2998e9);}};}function respondWithFilteredResult(_0x433408,_0x2b0528){return function(_0x1611cf){if(_0x1611cf){var _0x2b5400=typeof _0x2b0528['offset']===_0x03c4('0x22')&&typeof _0x2b0528[_0x03c4('0x23')]===_0x03c4('0x22');var _0x18f28a=_0x1611cf[_0x03c4('0x24')];var _0x2b6143=_0x2b5400?0x0:_0x2b0528[_0x03c4('0x25')];var _0x38007d=_0x2b5400?_0x1611cf[_0x03c4('0x24')]:_0x2b0528[_0x03c4('0x25')]+_0x2b0528['limit'];var _0x444b92;if(_0x38007d>=_0x18f28a){_0x38007d=_0x18f28a;_0x444b92=0xc8;}else{_0x444b92=0xce;}_0x433408[_0x03c4('0x20')](_0x444b92);return _0x433408['set'](_0x03c4('0x26'),_0x2b6143+'-'+_0x38007d+'/'+_0x18f28a)['json'](_0x1611cf);}return null;};}function patchUpdates(_0x9b4fa1){return function(_0x2f6730){try{jsonpatch[_0x03c4('0x27')](_0x2f6730,_0x9b4fa1,!![]);}catch(_0x5f367b){return BPromise[_0x03c4('0x28')](_0x5f367b);}return _0x2f6730[_0x03c4('0x29')]();};}function saveUpdates(_0x3e06a4,_0x350c60){return function(_0x2141f0){if(_0x2141f0){return _0x2141f0[_0x03c4('0x2a')](_0x3e06a4)[_0x03c4('0x2b')](function(_0x562e82){return _0x562e82;});}return null;};}function removeEntity(_0x2b70d2,_0x16aff8){return function(_0x560224){if(_0x560224){return _0x560224[_0x03c4('0x2c')]()[_0x03c4('0x2b')](function(){var _0xc31811=_0x560224['get']({'plain':!![]});var _0x582fcc=_0x03c4('0x2d');return db[_0x03c4('0x2e')][_0x03c4('0x2c')]({'where':{'type':_0x582fcc,'resourceId':_0xc31811['id']}})[_0x03c4('0x2b')](function(){return _0x560224;});})[_0x03c4('0x2b')](function(){_0x2b70d2['status'](0xcc)[_0x03c4('0x1f')]();});}};}function handleEntityNotFound(_0x2031fb,_0x2cb057){return function(_0x469613){if(!_0x469613){_0x2031fb[_0x03c4('0x2f')](0x194);}return _0x469613;};}function handleError(_0x24ac7e,_0x1a7df5){_0x1a7df5=_0x1a7df5||0x1f4;return function(_0x358452){logger['error'](_0x358452[_0x03c4('0x30')]);if(_0x358452[_0x03c4('0x31')]){delete _0x358452[_0x03c4('0x31')];}_0x24ac7e['status'](_0x1a7df5)[_0x03c4('0x32')](_0x358452);};}exports[_0x03c4('0x33')]=function(_0xd8ca83,_0x1f8572){var _0x56d693={},_0x4a77f4={},_0x500306={'count':0x0,'rows':[]};var _0x581885=_[_0x03c4('0x34')](db['SquareProject'][_0x03c4('0x35')],function(_0x551dba){return{'name':_0x551dba['fieldName'],'type':_0x551dba[_0x03c4('0x36')][_0x03c4('0x37')]};});_0x4a77f4[_0x03c4('0x38')]=_[_0x03c4('0x34')](_0x581885,_0x03c4('0x31'));_0x4a77f4[_0x03c4('0x39')]=_['keys'](_0xd8ca83['query']);_0x4a77f4[_0x03c4('0x3a')]=_[_0x03c4('0x3b')](_0x4a77f4[_0x03c4('0x38')],_0x4a77f4[_0x03c4('0x39')]);_0x56d693[_0x03c4('0x3c')]=_[_0x03c4('0x3b')](_0x4a77f4[_0x03c4('0x38')],qs[_0x03c4('0x3d')](_0xd8ca83[_0x03c4('0x39')][_0x03c4('0x3d')]));_0x56d693[_0x03c4('0x3c')]=_0x56d693[_0x03c4('0x3c')][_0x03c4('0x3e')]?_0x56d693[_0x03c4('0x3c')]:_0x4a77f4[_0x03c4('0x38')];if(!_0xd8ca83[_0x03c4('0x39')]['hasOwnProperty'](_0x03c4('0x3f'))){_0x56d693['limit']=qs['limit'](_0xd8ca83['query'][_0x03c4('0x23')]);_0x56d693[_0x03c4('0x25')]=qs[_0x03c4('0x25')](_0xd8ca83['query'][_0x03c4('0x25')]);}_0x56d693[_0x03c4('0x40')]=qs[_0x03c4('0x41')](_0xd8ca83[_0x03c4('0x39')][_0x03c4('0x41')]);_0x56d693[_0x03c4('0x42')]=qs[_0x03c4('0x3a')](_[_0x03c4('0x43')](_0xd8ca83[_0x03c4('0x39')],_0x4a77f4[_0x03c4('0x3a')]),_0x581885);if(_0xd8ca83[_0x03c4('0x39')]['filter']){_0x56d693[_0x03c4('0x42')]=_[_0x03c4('0x44')](_0x56d693[_0x03c4('0x42')],{'$or':_[_0x03c4('0x34')](_0x581885,function(_0x38dea5){if(_0x38dea5['type']!==_0x03c4('0x45')){var _0x1aaef4={};_0x1aaef4[_0x38dea5[_0x03c4('0x31')]]={'$like':'%'+_0xd8ca83[_0x03c4('0x39')][_0x03c4('0x46')]+'%'};return _0x1aaef4;}})});}_0x56d693=_[_0x03c4('0x44')]({},_0x56d693,_0xd8ca83[_0x03c4('0x47')]);var _0x230721={'where':_0x56d693[_0x03c4('0x42')]};return db[_0x03c4('0x48')]['count'](_0x230721)[_0x03c4('0x2b')](function(_0x574463){_0x500306[_0x03c4('0x24')]=_0x574463;if(_0xd8ca83['query'][_0x03c4('0x49')]){_0x56d693[_0x03c4('0x4a')]=[{'all':!![]}];}return db['SquareProject'][_0x03c4('0x4b')](_0x56d693);})[_0x03c4('0x2b')](function(_0x3fb4a1){_0x500306[_0x03c4('0x4c')]=_0x3fb4a1;return _0x500306;})[_0x03c4('0x2b')](respondWithFilteredResult(_0x1f8572,_0x56d693))['catch'](handleError(_0x1f8572,null));};exports['show']=function(_0x432c71,_0xea19cb){var _0x363807={'raw':![],'where':{'id':_0x432c71[_0x03c4('0x4d')]['id']}},_0x34c5b6={};_0x34c5b6[_0x03c4('0x38')]=_[_0x03c4('0x4e')](db['SquareProject'][_0x03c4('0x35')]);_0x34c5b6[_0x03c4('0x39')]=_['keys'](_0x432c71['query']);_0x34c5b6['filters']=_[_0x03c4('0x3b')](_0x34c5b6[_0x03c4('0x38')],_0x34c5b6[_0x03c4('0x39')]);_0x363807[_0x03c4('0x3c')]=_[_0x03c4('0x3b')](_0x34c5b6[_0x03c4('0x38')],qs[_0x03c4('0x3d')](_0x432c71[_0x03c4('0x39')][_0x03c4('0x3d')]));_0x363807[_0x03c4('0x3c')]=_0x363807[_0x03c4('0x3c')][_0x03c4('0x3e')]?_0x363807[_0x03c4('0x3c')]:_0x34c5b6[_0x03c4('0x38')];if(_0x432c71[_0x03c4('0x39')][_0x03c4('0x49')]){_0x363807[_0x03c4('0x4a')]=[{'all':!![]}];}_0x363807=_[_0x03c4('0x44')]({},_0x363807,_0x432c71[_0x03c4('0x47')]);return db['SquareProject'][_0x03c4('0x4f')](_0x363807)[_0x03c4('0x2b')](handleEntityNotFound(_0xea19cb,null))[_0x03c4('0x2b')](respondWithResult(_0xea19cb,null))['catch'](handleError(_0xea19cb,null));};exports[_0x03c4('0x50')]=function(_0x117da9,_0x5a68cc){return db[_0x03c4('0x48')][_0x03c4('0x50')](_0x117da9['body'],{})['then'](function(_0x56a866){var _0x3bd2df=_0x117da9[_0x03c4('0x51')][_0x03c4('0x52')]({'plain':!![]});if(!_0x3bd2df)throw new Error(_0x03c4('0x53'));if(_0x3bd2df[_0x03c4('0x54')]===_0x03c4('0x51')){var _0x2cebf6=_0x56a866[_0x03c4('0x52')]({'plain':!![]});var _0x4448be=_0x03c4('0x2d');return db[_0x03c4('0x55')][_0x03c4('0x4f')]({'where':{'name':_0x4448be,'userProfileId':_0x3bd2df['userProfileId']},'raw':!![]})['then'](function(_0x5a584e){if(_0x5a584e&&_0x5a584e['autoAssociation']===0x0){return db[_0x03c4('0x2e')][_0x03c4('0x50')]({'name':_0x2cebf6[_0x03c4('0x31')],'resourceId':_0x2cebf6['id'],'type':_0x5a584e[_0x03c4('0x31')],'sectionId':_0x5a584e['id']},{})[_0x03c4('0x2b')](function(){return _0x56a866;});}else{return _0x56a866;}})['catch'](function(_0x21ca84){logger[_0x03c4('0x56')](_0x03c4('0x57'),_0x21ca84);throw _0x21ca84;});}return _0x56a866;})[_0x03c4('0x2b')](respondWithResult(_0x5a68cc,0xc9))[_0x03c4('0x58')](handleError(_0x5a68cc,null));};exports[_0x03c4('0x2a')]=function(_0x3a935e,_0x41b63f){if(_0x3a935e[_0x03c4('0x59')]['id']){delete _0x3a935e[_0x03c4('0x59')]['id'];}return db[_0x03c4('0x48')]['find']({'where':{'id':_0x3a935e[_0x03c4('0x4d')]['id']}})['then'](handleEntityNotFound(_0x41b63f,null))[_0x03c4('0x2b')](saveUpdates(_0x3a935e[_0x03c4('0x59')],null))[_0x03c4('0x2b')](respondWithResult(_0x41b63f,null))[_0x03c4('0x58')](handleError(_0x41b63f,null));};exports[_0x03c4('0x2c')]=function(_0x23b9bc,_0x769ebc){return db['SquareProject'][_0x03c4('0x4f')]({'where':{'id':_0x23b9bc[_0x03c4('0x4d')]['id']}})['then'](handleEntityNotFound(_0x769ebc,null))[_0x03c4('0x2b')](removeEntity(_0x769ebc,null))['catch'](handleError(_0x769ebc,null));};exports[_0x03c4('0x5a')]=function(_0x2f467f,_0x12ce14,_0x294d90){return db['SquareProject'][_0x03c4('0x4f')]({'where':{'id':_0x2f467f['params']['id']}})[_0x03c4('0x2b')](handleEntityNotFound(_0x12ce14,null))[_0x03c4('0x2b')](function(_0x90304b){if(_0x90304b){return _0x90304b[_0x03c4('0x5a')](_0x2f467f[_0x03c4('0x59')][_0x03c4('0x5b')],_[_0x03c4('0x5c')](_0x2f467f[_0x03c4('0x59')],['ids','id'])||{});}})[_0x03c4('0x2b')](respondWithResult(_0x12ce14,null))[_0x03c4('0x58')](handleError(_0x12ce14,null));};exports[_0x03c4('0x5d')]=function(_0x50d92e,_0x48e7e0,_0x5e7185){return db[_0x03c4('0x48')][_0x03c4('0x4f')]({'where':{'id':_0x50d92e[_0x03c4('0x4d')]['id']}})[_0x03c4('0x2b')](handleEntityNotFound(_0x48e7e0,null))['then'](function(_0x4703b0){if(_0x4703b0){return _0x4703b0[_0x03c4('0x5d')](_0x50d92e['query'][_0x03c4('0x5b')])['then'](function(){if(_[_0x03c4('0x5e')](_0x50d92e['query'][_0x03c4('0x5b')])){for(var _0x311472=0x0;_0x311472<_0x50d92e[_0x03c4('0x39')]['ids']['length'];_0x311472+=0x1){socket[_0x03c4('0x5f')]('userSquareProject:remove',{'UserId':Number(_0x50d92e[_0x03c4('0x39')][_0x03c4('0x5b')][_0x311472]),'SquareProjectId':Number(_0x50d92e[_0x03c4('0x4d')]['id'])});}}else{socket['emit'](_0x03c4('0x60'),{'UserId':Number(_0x50d92e[_0x03c4('0x39')][_0x03c4('0x5b')]),'SquareProjectId':Number(_0x50d92e['params']['id'])});}});}})['then'](respondWithStatusCode(_0x48e7e0,null))[_0x03c4('0x58')](handleError(_0x48e7e0,null));};exports['getUsers']=function(_0x4a2d1c,_0x2ab7de,_0x10c708){var _0x29b6d5={};var _0x2d04c9={};var _0x251e8d;var _0x271b5c;return db[_0x03c4('0x48')]['findOne']({'where':{'id':_0x4a2d1c[_0x03c4('0x4d')]['id']}})[_0x03c4('0x2b')](handleEntityNotFound(_0x2ab7de,null))[_0x03c4('0x2b')](function(_0xf53208){if(_0xf53208){_0x251e8d=_0xf53208;_0x2d04c9[_0x03c4('0x38')]=_[_0x03c4('0x4e')](db['User'][_0x03c4('0x35')]);_0x2d04c9[_0x03c4('0x39')]=_['keys'](_0x4a2d1c[_0x03c4('0x39')]);_0x2d04c9[_0x03c4('0x3a')]=_[_0x03c4('0x3b')](_0x2d04c9[_0x03c4('0x38')],_0x2d04c9[_0x03c4('0x39')]);_0x29b6d5[_0x03c4('0x3c')]=_[_0x03c4('0x3b')](_0x2d04c9[_0x03c4('0x38')],qs[_0x03c4('0x3d')](_0x4a2d1c['query'][_0x03c4('0x3d')]));_0x29b6d5['attributes']=_0x29b6d5[_0x03c4('0x3c')][_0x03c4('0x3e')]?_0x29b6d5['attributes']:_0x2d04c9[_0x03c4('0x38')];_0x29b6d5[_0x03c4('0x40')]=qs[_0x03c4('0x41')](_0x4a2d1c[_0x03c4('0x39')]['sort']);_0x29b6d5[_0x03c4('0x42')]=qs[_0x03c4('0x3a')](_[_0x03c4('0x43')](_0x4a2d1c[_0x03c4('0x39')],_0x2d04c9[_0x03c4('0x3a')]));if(_0x4a2d1c['query'][_0x03c4('0x46')]){_0x29b6d5['where']=_[_0x03c4('0x44')](_0x29b6d5[_0x03c4('0x42')],{'$or':_['map'](_0x29b6d5[_0x03c4('0x3c')],function(_0x45a3fb){var _0x5d7c7b={};_0x5d7c7b[_0x45a3fb]={'$like':'%'+_0x4a2d1c[_0x03c4('0x39')][_0x03c4('0x46')]+'%'};return _0x5d7c7b;})});}_0x29b6d5=_[_0x03c4('0x44')]({},_0x29b6d5,_0x4a2d1c[_0x03c4('0x47')]);return _0x251e8d[_0x03c4('0x61')](_0x29b6d5);}})[_0x03c4('0x2b')](function(_0xfcb377){if(_0xfcb377){_0x271b5c=_0xfcb377[_0x03c4('0x3e')];if(!_0x4a2d1c['query'][_0x03c4('0x62')](_0x03c4('0x3f'))){_0x29b6d5[_0x03c4('0x23')]=qs[_0x03c4('0x23')](_0x4a2d1c[_0x03c4('0x39')]['limit']);_0x29b6d5[_0x03c4('0x25')]=qs[_0x03c4('0x25')](_0x4a2d1c[_0x03c4('0x39')][_0x03c4('0x25')]);}return _0x251e8d[_0x03c4('0x61')](_0x29b6d5);}})[_0x03c4('0x2b')](function(_0x850ce5){if(_0x850ce5){return _0x850ce5?{'count':_0x271b5c,'rows':_0x850ce5}:null;}})[_0x03c4('0x2b')](respondWithResult(_0x2ab7de,null))[_0x03c4('0x58')](handleError(_0x2ab7de,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 3eab766..23912dc 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 _0x59e3=['emit','hook','../../mysqldb','SquareProject','setMaxListeners','save','update','remove'];(function(_0x1c0d4d,_0x2353e2){var _0x31b392=function(_0x4dbfc9){while(--_0x4dbfc9){_0x1c0d4d['push'](_0x1c0d4d['shift']());}};_0x31b392(++_0x2353e2);}(_0x59e3,0xca));var _0x359e=function(_0x238702,_0x7ff8f6){_0x238702=_0x238702-0x0;var _0x478153=_0x59e3[_0x238702];return _0x478153;};'use strict';var EventEmitter=require('events');var SquareProject=require(_0x359e('0x0'))['db'][_0x359e('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x359e('0x2')](0x0);var events={'afterCreate':_0x359e('0x3'),'afterUpdate':_0x359e('0x4'),'afterDestroy':_0x359e('0x5')};function emitEvent(_0x545127){return function(_0x1a5f33,_0x4cdf23,_0x3eb59b){SquareProjectEvents[_0x359e('0x6')](_0x545127+':'+_0x1a5f33['id'],_0x1a5f33);SquareProjectEvents[_0x359e('0x6')](_0x545127,_0x1a5f33);_0x3eb59b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0x359e('0x7')](e,emitEvent(event));}}module['exports']=SquareProjectEvents; \ No newline at end of file +var _0xa077=['save','remove','emit','exports','../../mysqldb','SquareProject','setMaxListeners'];(function(_0x4d54b8,_0x14b291){var _0x1b1d19=function(_0x15b9c7){while(--_0x15b9c7){_0x4d54b8['push'](_0x4d54b8['shift']());}};_0x1b1d19(++_0x14b291);}(_0xa077,0x1c4));var _0x7a07=function(_0x221115,_0x4999e4){_0x221115=_0x221115-0x0;var _0x462feb=_0xa077[_0x221115];return _0x462feb;};'use strict';var EventEmitter=require('events');var SquareProject=require(_0x7a07('0x0'))['db'][_0x7a07('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x7a07('0x2')](0x0);var events={'afterCreate':_0x7a07('0x3'),'afterUpdate':'update','afterDestroy':_0x7a07('0x4')};function emitEvent(_0x224ede){return function(_0x54ce0f,_0x21e0ef,_0x471e1b){SquareProjectEvents['emit'](_0x224ede+':'+_0x54ce0f['id'],_0x54ce0f);SquareProjectEvents[_0x7a07('0x5')](_0x224ede,_0x54ce0f);_0x471e1b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module[_0x7a07('0x6')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 48813d2..5244a0a 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 _0x1ed1=['moment','bluebird','request-promise','rimraf','../../config/environment','define','SquareProject','square_projects','changed','preproduction','savedAt','YYYY-MM-DD\x20HH:mm:ss','format','lodash','util','api'];(function(_0x5a04b5,_0x5b220c){var _0x5958df=function(_0xcf66b6){while(--_0xcf66b6){_0x5a04b5['push'](_0x5a04b5['shift']());}};_0x5958df(++_0x5b220c);}(_0x1ed1,0xad));var _0x11ed=function(_0x158683,_0x135173){_0x158683=_0x158683-0x0;var _0x38d930=_0x1ed1[_0x158683];return _0x38d930;};'use strict';var _=require(_0x11ed('0x0'));var util=require(_0x11ed('0x1'));var logger=require('../../config/logger')(_0x11ed('0x2'));var moment=require(_0x11ed('0x3'));var BPromise=require(_0x11ed('0x4'));var rp=require(_0x11ed('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x11ed('0x6'));var config=require(_0x11ed('0x7'));var attributes=require('./squareProject.attributes');module['exports']=function(_0x1d4f7c,_0x1aa42e){return _0x1d4f7c[_0x11ed('0x8')](_0x11ed('0x9'),attributes,{'tableName':_0x11ed('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3ff938,_0xdee2f6,_0x2f6628){if(_0x3ff938[_0x11ed('0xb')](_0x11ed('0xc'))){_0x3ff938[_0x11ed('0xd')]=moment()['format'](_0x11ed('0xe'));}if(_0x3ff938[_0x11ed('0xb')]('production')){_0x3ff938['publishedAt']=moment()[_0x11ed('0xf')](_0x11ed('0xe'));}_0x2f6628(null,_0x3ff938);}}});}; \ No newline at end of file +var _0x2e65=['define','changed','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','lodash','util','api','moment','request-promise','path','rimraf','./squareProject.attributes','exports'];(function(_0x208b8b,_0x506eba){var _0x4a3b4e=function(_0x3d205e){while(--_0x3d205e){_0x208b8b['push'](_0x208b8b['shift']());}};_0x4a3b4e(++_0x506eba);}(_0x2e65,0xc3));var _0x52e6=function(_0x5e6cb8,_0x16cf56){_0x5e6cb8=_0x5e6cb8-0x0;var _0x3faeb3=_0x2e65[_0x5e6cb8];return _0x3faeb3;};'use strict';var _=require(_0x52e6('0x0'));var util=require(_0x52e6('0x1'));var logger=require('../../config/logger')(_0x52e6('0x2'));var moment=require(_0x52e6('0x3'));var BPromise=require('bluebird');var rp=require(_0x52e6('0x4'));var fs=require('fs');var path=require(_0x52e6('0x5'));var rimraf=require(_0x52e6('0x6'));var config=require('../../config/environment');var attributes=require(_0x52e6('0x7'));module[_0x52e6('0x8')]=function(_0x438de6,_0x12a64b){return _0x438de6[_0x52e6('0x9')]('SquareProject',attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5e932e,_0x2c77a0,_0x341bbb){if(_0x5e932e[_0x52e6('0xa')](_0x52e6('0xb'))){_0x5e932e[_0x52e6('0xc')]=moment()[_0x52e6('0xd')](_0x52e6('0xe'));}if(_0x5e932e[_0x52e6('0xa')](_0x52e6('0xf'))){_0x5e932e[_0x52e6('0x10')]=moment()['format'](_0x52e6('0xe'));}_0x341bbb(null,_0x5e932e);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 7212834..3e86d3e 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 _0x6689=['stringify','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','localhost','socket.io-emitter','redis','register','request','then','SquareProject,\x20%s,\x20%s','request\x20sent','debug','error','message','info','result','ShowSquareProject','SquareProject','find','options','raw','attributes','include','map','model'];(function(_0x499015,_0x4140cb){var _0x345c68=function(_0x45a69d){while(--_0x45a69d){_0x499015['push'](_0x499015['shift']());}};_0x345c68(++_0x4140cb);}(_0x6689,0x146));var _0x9668=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6689[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9668('0x0'));var util=require(_0x9668('0x1'));var moment=require(_0x9668('0x2'));var BPromise=require(_0x9668('0x3'));var rs=require(_0x9668('0x4'));var fs=require('fs');var Redis=require(_0x9668('0x5'));var db=require(_0x9668('0x6'))['db'];var utils=require(_0x9668('0x7'));var logger=require(_0x9668('0x8'))(_0x9668('0x9'));var config=require(_0x9668('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x9668('0xb')]['http']({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x9668('0xc'),'port':0x18eb});var socket=require(_0x9668('0xd'))(new Redis(config[_0x9668('0xe')]));require('./squareProject.socket')[_0x9668('0xf')](socket);function respondWithRpcPromise(_0xc651b5,_0x52848f,_0x3b55fb){return new BPromise(function(_0x2bb55a,_0x25d6af){return client[_0x9668('0x10')](_0xc651b5,_0x3b55fb)[_0x9668('0x11')](function(_0x22c380){logger['info'](_0x9668('0x12'),_0x52848f,_0x9668('0x13'));logger[_0x9668('0x14')]('SquareProject,\x20%s,\x20%s,\x20%s',_0x52848f,_0x9668('0x13'),JSON['stringify'](_0x22c380));if(_0x22c380['error']){if(_0x22c380[_0x9668('0x15')]['code']===0x1f4){logger[_0x9668('0x15')](_0x9668('0x12'),_0x52848f,_0x22c380[_0x9668('0x15')][_0x9668('0x16')]);return _0x25d6af(_0x22c380[_0x9668('0x15')][_0x9668('0x16')]);}logger[_0x9668('0x15')]('SquareProject,\x20%s,\x20%s',_0x52848f,_0x22c380[_0x9668('0x15')][_0x9668('0x16')]);return _0x2bb55a(_0x22c380[_0x9668('0x15')][_0x9668('0x16')]);}else{logger[_0x9668('0x17')](_0x9668('0x12'),_0x52848f,_0x9668('0x13'));_0x2bb55a(_0x22c380[_0x9668('0x18')][_0x9668('0x16')]);}})['catch'](function(_0x262f40){logger[_0x9668('0x15')](_0x9668('0x12'),_0x52848f,_0x262f40);_0x25d6af(_0x262f40);});});}exports[_0x9668('0x19')]=function(_0x1c60d3){var _0x1c092e=this;return new Promise(function(_0x5cc6a2,_0x24c580){return db[_0x9668('0x1a')][_0x9668('0x1b')]({'raw':_0x1c60d3[_0x9668('0x1c')]?_0x1c60d3[_0x9668('0x1c')][_0x9668('0x1d')]===undefined?!![]:![]:!![],'where':_0x1c60d3[_0x9668('0x1c')]?_0x1c60d3[_0x9668('0x1c')]['where']||null:null,'attributes':_0x1c60d3[_0x9668('0x1c')]?_0x1c60d3[_0x9668('0x1c')][_0x9668('0x1e')]||null:null,'include':_0x1c60d3[_0x9668('0x1c')]?_0x1c60d3[_0x9668('0x1c')][_0x9668('0x1f')]?_[_0x9668('0x20')](_0x1c60d3['options']['include'],function(_0x1cd8cf){return{'model':db[_0x1cd8cf[_0x9668('0x21')]],'as':_0x1cd8cf['as'],'attributes':_0x1cd8cf[_0x9668('0x1e')],'include':_0x1cd8cf['include']?_[_0x9668('0x20')](_0x1cd8cf[_0x9668('0x1f')],function(_0x36cf5f){return{'model':db[_0x36cf5f[_0x9668('0x21')]],'as':_0x36cf5f['as'],'attributes':_0x36cf5f[_0x9668('0x1e')],'include':_0x36cf5f['include']?_[_0x9668('0x20')](_0x36cf5f[_0x9668('0x1f')],function(_0x3dcbe8){return{'model':db[_0x3dcbe8[_0x9668('0x21')]],'as':_0x3dcbe8['as'],'attributes':_0x3dcbe8[_0x9668('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x9668('0x11')](function(_0xb97a33){logger[_0x9668('0x17')](_0x9668('0x19'),_0x1c60d3);logger['debug'](_0x9668('0x19'),_0x1c60d3,JSON[_0x9668('0x22')](_0xb97a33));_0x5cc6a2(_0xb97a33);})[_0x9668('0x23')](function(_0x42933b){logger[_0x9668('0x15')](_0x9668('0x19'),_0x42933b['message'],_0x1c60d3);_0x24c580(_0x1c092e[_0x9668('0x15')](0x1f4,_0x42933b[_0x9668('0x16')]));});});}; \ No newline at end of file +var _0xe093=['../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','request','then','info','SquareProject,\x20%s,\x20%s','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','ShowSquareProject','SquareProject','find','options','raw','where','attributes','include','map','model','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x45456c,_0x4a3780){var _0x172697=function(_0x579fbd){while(--_0x579fbd){_0x45456c['push'](_0x45456c['shift']());}};_0x172697(++_0x4a3780);}(_0xe093,0x6f));var _0x3e09=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0xe093[_0x40220a];return _0x3903cc;};'use strict';var _=require('lodash');var util=require(_0x3e09('0x0'));var moment=require(_0x3e09('0x1'));var BPromise=require(_0x3e09('0x2'));var rs=require(_0x3e09('0x3'));var fs=require('fs');var Redis=require(_0x3e09('0x4'));var db=require(_0x3e09('0x5'))['db'];var utils=require(_0x3e09('0x6'));var logger=require(_0x3e09('0x7'))(_0x3e09('0x8'));var config=require(_0x3e09('0x9'));var jayson=require(_0x3e09('0xa'));var client=jayson[_0x3e09('0xb')]['http']({'port':0x232a});config[_0x3e09('0xc')]=_[_0x3e09('0xd')](config[_0x3e09('0xc')],{'host':_0x3e09('0xe'),'port':0x18eb});var socket=require(_0x3e09('0xf'))(new Redis(config[_0x3e09('0xc')]));require(_0x3e09('0x10'))[_0x3e09('0x11')](socket);function respondWithRpcPromise(_0x5661b9,_0x3d905d,_0x4af48d){return new BPromise(function(_0x4f58aa,_0x2ce796){return client[_0x3e09('0x12')](_0x5661b9,_0x4af48d)[_0x3e09('0x13')](function(_0x2b713c){logger[_0x3e09('0x14')](_0x3e09('0x15'),_0x3d905d,_0x3e09('0x16'));logger[_0x3e09('0x17')](_0x3e09('0x18'),_0x3d905d,_0x3e09('0x16'),JSON[_0x3e09('0x19')](_0x2b713c));if(_0x2b713c['error']){if(_0x2b713c[_0x3e09('0x1a')][_0x3e09('0x1b')]===0x1f4){logger['error'](_0x3e09('0x15'),_0x3d905d,_0x2b713c[_0x3e09('0x1a')][_0x3e09('0x1c')]);return _0x2ce796(_0x2b713c[_0x3e09('0x1a')]['message']);}logger[_0x3e09('0x1a')](_0x3e09('0x15'),_0x3d905d,_0x2b713c[_0x3e09('0x1a')]['message']);return _0x4f58aa(_0x2b713c['error'][_0x3e09('0x1c')]);}else{logger[_0x3e09('0x14')](_0x3e09('0x15'),_0x3d905d,_0x3e09('0x16'));_0x4f58aa(_0x2b713c['result'][_0x3e09('0x1c')]);}})[_0x3e09('0x1d')](function(_0x3d5861){logger[_0x3e09('0x1a')]('SquareProject,\x20%s,\x20%s',_0x3d905d,_0x3d5861);_0x2ce796(_0x3d5861);});});}exports[_0x3e09('0x1e')]=function(_0x111e5f){var _0x1a1f19=this;return new Promise(function(_0x5d12f7,_0x2b97c2){return db[_0x3e09('0x1f')][_0x3e09('0x20')]({'raw':_0x111e5f[_0x3e09('0x21')]?_0x111e5f['options'][_0x3e09('0x22')]===undefined?!![]:![]:!![],'where':_0x111e5f['options']?_0x111e5f[_0x3e09('0x21')][_0x3e09('0x23')]||null:null,'attributes':_0x111e5f[_0x3e09('0x21')]?_0x111e5f[_0x3e09('0x21')][_0x3e09('0x24')]||null:null,'include':_0x111e5f[_0x3e09('0x21')]?_0x111e5f['options'][_0x3e09('0x25')]?_['map'](_0x111e5f['options'][_0x3e09('0x25')],function(_0x6c2fb2){return{'model':db[_0x6c2fb2['model']],'as':_0x6c2fb2['as'],'attributes':_0x6c2fb2[_0x3e09('0x24')],'include':_0x6c2fb2[_0x3e09('0x25')]?_[_0x3e09('0x26')](_0x6c2fb2[_0x3e09('0x25')],function(_0x46be87){return{'model':db[_0x46be87[_0x3e09('0x27')]],'as':_0x46be87['as'],'attributes':_0x46be87[_0x3e09('0x24')],'include':_0x46be87[_0x3e09('0x25')]?_[_0x3e09('0x26')](_0x46be87['include'],function(_0x5f1be3){return{'model':db[_0x5f1be3[_0x3e09('0x27')]],'as':_0x5f1be3['as'],'attributes':_0x5f1be3[_0x3e09('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5acffc){logger[_0x3e09('0x14')](_0x3e09('0x1e'),_0x111e5f);logger['debug'](_0x3e09('0x1e'),_0x111e5f,JSON[_0x3e09('0x19')](_0x5acffc));_0x5d12f7(_0x5acffc);})[_0x3e09('0x1d')](function(_0x333594){logger[_0x3e09('0x1a')](_0x3e09('0x1e'),_0x333594[_0x3e09('0x1c')],_0x111e5f);_0x2b97c2(_0x1a1f19[_0x3e09('0x1a')](0x1f4,_0x333594[_0x3e09('0x1c')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 92a45cb..8bf863f 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 _0x9aa9=['register','length','squareProject:','save','remove','emit'];(function(_0x523012,_0x55ed89){var _0x14dab3=function(_0x7fc04f){while(--_0x7fc04f){_0x523012['push'](_0x523012['shift']());}};_0x14dab3(++_0x55ed89);}(_0x9aa9,0x16b));var _0x99aa=function(_0x2909e0,_0x9a3311){_0x2909e0=_0x2909e0-0x0;var _0x348b70=_0x9aa9[_0x2909e0];return _0x348b70;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0x99aa('0x0'),_0x99aa('0x1'),'update'];function createListener(_0x53d1d8,_0x1eff23){return function(_0x36b0be){_0x1eff23[_0x99aa('0x2')](_0x53d1d8,_0x36b0be);};}function removeListener(_0x1a1ac2,_0x1d3c7c){return function(){SquareProjectEvents['removeListener'](_0x1a1ac2,_0x1d3c7c);};}exports[_0x99aa('0x3')]=function(_0x1d9913){for(var _0x221f9d=0x0,_0x304b4c=events[_0x99aa('0x4')];_0x221f9d<_0x304b4c;_0x221f9d++){var _0x23011a=events[_0x221f9d];var _0x3d7410=createListener(_0x99aa('0x5')+_0x23011a,_0x1d9913);SquareProjectEvents['on'](_0x23011a,_0x3d7410);}}; \ No newline at end of file +var _0xdd59=['save','remove','update','emit','removeListener','register','length','squareProject:','./squareProject.events'];(function(_0x304b67,_0x31cb39){var _0x493afb=function(_0x21dce3){while(--_0x21dce3){_0x304b67['push'](_0x304b67['shift']());}};_0x493afb(++_0x31cb39);}(_0xdd59,0xfb));var _0x9dd5=function(_0x732d43,_0x52065c){_0x732d43=_0x732d43-0x0;var _0x3c90fd=_0xdd59[_0x732d43];return _0x3c90fd;};'use strict';var SquareProjectEvents=require(_0x9dd5('0x0'));var events=[_0x9dd5('0x1'),_0x9dd5('0x2'),_0x9dd5('0x3')];function createListener(_0x2b0b17,_0xbe1b7a){return function(_0x324c33){_0xbe1b7a[_0x9dd5('0x4')](_0x2b0b17,_0x324c33);};}function removeListener(_0x504155,_0x100da1){return function(){SquareProjectEvents[_0x9dd5('0x5')](_0x504155,_0x100da1);};}exports[_0x9dd5('0x6')]=function(_0x5de156){for(var _0x780b5=0x0,_0x19da9f=events[_0x9dd5('0x7')];_0x780b5<_0x19da9f;_0x780b5++){var _0x2c0124=events[_0x780b5];var _0x45aefc=createListener(_0x9dd5('0x8')+_0x2c0124,_0x5de156);SquareProjectEvents['on'](_0x2c0124,_0x45aefc);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 480a7fa..f3ccc6d 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 _0x5fc3=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','show','/:id/download','download','post','create','put','update','/:id','multer','util','connect-timeout'];(function(_0x4ae864,_0x46fc0c){var _0x2ead9a=function(_0x55f9a0){while(--_0x55f9a0){_0x4ae864['push'](_0x4ae864['shift']());}};_0x2ead9a(++_0x46fc0c);}(_0x5fc3,0xa8));var _0x35fc=function(_0x2e5f9c,_0x134a52){_0x2e5f9c=_0x2e5f9c-0x0;var _0x538b44=_0x5fc3[_0x2e5f9c];return _0x538b44;};'use strict';var multer=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var path=require('path');var timeout=require(_0x35fc('0x2'));var express=require(_0x35fc('0x3'));var router=express[_0x35fc('0x4')]();var fs_extra=require(_0x35fc('0x5'));var auth=require(_0x35fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x35fc('0x7'));var controller=require(_0x35fc('0x8'));router[_0x35fc('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x35fc('0x9')]('/:id',auth[_0x35fc('0xa')](),controller[_0x35fc('0xb')]);router[_0x35fc('0x9')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0xd')]);router[_0x35fc('0xe')]('/',auth['isAuthenticated'](),controller[_0x35fc('0xf')]);router[_0x35fc('0x10')]('/:id',auth[_0x35fc('0xa')](),controller[_0x35fc('0x11')]);router['delete'](_0x35fc('0x12'),auth[_0x35fc('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x7a54=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','index','/:id','isAuthenticated','post','put','update','delete','destroy','exports','multer','util','path','express'];(function(_0x52c6ad,_0x109c7a){var _0x229b81=function(_0x23b378){while(--_0x23b378){_0x52c6ad['push'](_0x52c6ad['shift']());}};_0x229b81(++_0x109c7a);}(_0x7a54,0x106));var _0x47a5=function(_0x223b86,_0x192c0c){_0x223b86=_0x223b86-0x0;var _0x4bf015=_0x7a54[_0x223b86];return _0x4bf015;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0x9')]('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0x47a5('0xd')]('/',auth[_0x47a5('0xc')](),controller['create']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);router[_0x47a5('0x10')](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);module[_0x47a5('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index feeae38..fd85c95 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 _0x207c=['savePath','substring','exports','STRING','VIRTUAL','getDataValue'];(function(_0x2b50ba,_0x59ba7a){var _0x367510=function(_0x39213b){while(--_0x39213b){_0x2b50ba['push'](_0x2b50ba['shift']());}};_0x367510(++_0x59ba7a);}(_0x207c,0x1e8));var _0xc207=function(_0x59b533,_0x59fdcc){_0x59b533=_0x59b533-0x0;var _0x2beced=_0x207c[_0x59b533];return _0x2beced;};'use strict';var Sequelize=require('sequelize');module[_0xc207('0x0')]={'uniqueid':{'type':Sequelize[_0xc207('0x1')]},'callerid':{'type':Sequelize[_0xc207('0x1')]},'calleridname':{'type':Sequelize[_0xc207('0x1')]},'context':{'type':Sequelize[_0xc207('0x1')]},'extension':{'type':Sequelize[_0xc207('0x1')]},'priority':{'type':Sequelize[_0xc207('0x1')]},'accountcode':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0xc207('0x1')]},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize[_0xc207('0x1')]},'format':{'type':Sequelize[_0xc207('0x2')],'get':function(){var _0x3395e4='';var _0x59ff6f=this[_0xc207('0x3')](_0xc207('0x4'));if(_0x59ff6f){_0x3395e4=_0x59ff6f[_0xc207('0x5')](_0x59ff6f['lastIndexOf']('.'));}return _0x3395e4;}}}; \ No newline at end of file +var _0xac9d=['VIRTUAL','savePath','lastIndexOf','sequelize','exports','STRING'];(function(_0x25d7d6,_0x5c3f34){var _0x53fbbb=function(_0x26a422){while(--_0x26a422){_0x25d7d6['push'](_0x25d7d6['shift']());}};_0x53fbbb(++_0x5c3f34);}(_0xac9d,0x14d));var _0xdac9=function(_0x18f137,_0x5e06b4){_0x18f137=_0x18f137-0x0;var _0x147221=_0xac9d[_0x18f137];return _0x147221;};'use strict';var Sequelize=require(_0xdac9('0x0'));module[_0xdac9('0x1')]={'uniqueid':{'type':Sequelize[_0xdac9('0x2')]},'callerid':{'type':Sequelize[_0xdac9('0x2')]},'calleridname':{'type':Sequelize[_0xdac9('0x2')]},'context':{'type':Sequelize[_0xdac9('0x2')]},'extension':{'type':Sequelize[_0xdac9('0x2')]},'priority':{'type':Sequelize[_0xdac9('0x2')]},'accountcode':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0xdac9('0x2')]},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize[_0xdac9('0x2')]},'filename':{'type':Sequelize[_0xdac9('0x2')]},'savePath':{'type':Sequelize[_0xdac9('0x2')]},'format':{'type':Sequelize[_0xdac9('0x3')],'get':function(){var _0x1c78c5='';var _0x39f560=this['getDataValue'](_0xdac9('0x4'));if(_0x39f560){_0x1c78c5=_0x39f560['substring'](_0x39f560[_0xdac9('0x5')]('.'));}return _0x1c78c5;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index f4f3788..c303d04 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 _0x9ccd=['order','sort','filters','pick','filter','merge','where','type','VIRTUAL','SquareRecording','includeAll','findAll','rows','catch','params','include','options','find','create','body','../../components/encryptor','savePath','format','%s.cypher','decryptFile','secrets','recording','existsSync','Sequelize','ValidationError','SquareRecording\x20not\x20found','filename','extname','download','unlink','message','Not\x20found','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','isNil','File:\x20\x22','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty'];(function(_0x544c8d,_0xb33a92){var _0x266c38=function(_0x32ecc2){while(--_0x32ecc2){_0x544c8d['push'](_0x544c8d['shift']());}};_0x266c38(++_0xb33a92);}(_0x9ccd,0x8e));var _0xd9cc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9ccd[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xd9cc('0x0'));var rimraf=require(_0xd9cc('0x1'));var zipdir=require(_0xd9cc('0x2'));var jsonpatch=require(_0xd9cc('0x3'));var rp=require(_0xd9cc('0x4'));var moment=require(_0xd9cc('0x5'));var BPromise=require(_0xd9cc('0x6'));var Mustache=require('mustache');var util=require(_0xd9cc('0x7'));var path=require(_0xd9cc('0x8'));var sox=require(_0xd9cc('0x9'));var csv=require(_0xd9cc('0xa'));var ejs=require(_0xd9cc('0xb'));var fs=require('fs');var fs_extra=require(_0xd9cc('0xc'));var _=require(_0xd9cc('0xd'));var squel=require(_0xd9cc('0xe'));var crypto=require(_0xd9cc('0xf'));var jsforce=require(_0xd9cc('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xd9cc('0xa'));var querystring=require(_0xd9cc('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd9cc('0x12'));var qs=require(_0xd9cc('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd9cc('0x14'));var logger=require(_0xd9cc('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xd9cc('0x16'))['db'];function respondWithStatusCode(_0x4e6343,_0x3d8d14){_0x3d8d14=_0x3d8d14||0xcc;return function(_0xf51544){if(_0xf51544){return _0x4e6343['sendStatus'](_0x3d8d14);}return _0x4e6343[_0xd9cc('0x17')](_0x3d8d14)[_0xd9cc('0x18')]();};}function respondWithResult(_0x54b60d,_0x380d01){_0x380d01=_0x380d01||0xc8;return function(_0x2f2e3e){if(_0x2f2e3e){return _0x54b60d[_0xd9cc('0x17')](_0x380d01)['json'](_0x2f2e3e);}};}function respondWithFilteredResult(_0xd57c23,_0x343e7b){return function(_0x215c0e){if(_0x215c0e){var _0x4a87ab=typeof _0x343e7b[_0xd9cc('0x19')]===_0xd9cc('0x1a')&&typeof _0x343e7b[_0xd9cc('0x1b')]===_0xd9cc('0x1a');var _0x7a7da=_0x215c0e[_0xd9cc('0x1c')];var _0x5632c9=_0x4a87ab?0x0:_0x343e7b[_0xd9cc('0x19')];var _0x540648=_0x4a87ab?_0x215c0e[_0xd9cc('0x1c')]:_0x343e7b[_0xd9cc('0x19')]+_0x343e7b[_0xd9cc('0x1b')];var _0x305a4a;if(_0x540648>=_0x7a7da){_0x540648=_0x7a7da;_0x305a4a=0xc8;}else{_0x305a4a=0xce;}_0xd57c23[_0xd9cc('0x17')](_0x305a4a);return _0xd57c23[_0xd9cc('0x1d')](_0xd9cc('0x1e'),_0x5632c9+'-'+_0x540648+'/'+_0x7a7da)[_0xd9cc('0x1f')](_0x215c0e);}return null;};}function patchUpdates(_0x247c2a){return function(_0x26d115){try{jsonpatch['apply'](_0x26d115,_0x247c2a,!![]);}catch(_0x34f519){return BPromise['reject'](_0x34f519);}return _0x26d115[_0xd9cc('0x20')]();};}function saveUpdates(_0x4d0e4c,_0x364c98){return function(_0xba09c3){if(_0xba09c3){return _0xba09c3[_0xd9cc('0x21')](_0x4d0e4c)[_0xd9cc('0x22')](function(_0x416dc5){return _0x416dc5;});}return null;};}function removeEntity(_0x4d0b8a,_0x5021aa){return function(_0x1fbda9){if(_0x1fbda9){return _0x1fbda9[_0xd9cc('0x23')]()[_0xd9cc('0x22')](function(){_0x4d0b8a[_0xd9cc('0x17')](0xcc)[_0xd9cc('0x18')]();});}};}function handleEntityNotFound(_0x30a4de,_0x319aa8){return function(_0x4bbfb2){if(!_0x4bbfb2){_0x30a4de[_0xd9cc('0x24')](0x194);}return _0x4bbfb2;};}function handleError(_0x41826f,_0x306be3){_0x306be3=_0x306be3||0x1f4;return function(_0x53b273){logger[_0xd9cc('0x25')](_0x53b273[_0xd9cc('0x26')]);if(_0x53b273[_0xd9cc('0x27')]){delete _0x53b273['name'];}_0x41826f[_0xd9cc('0x17')](_0x306be3)[_0xd9cc('0x28')](_0x53b273);};}exports[_0xd9cc('0x29')]=function(_0x229ed8,_0x17d8bd){var _0x39859b={},_0x244709={},_0x2874b6={'count':0x0,'rows':[]};var _0x5b7f11=_[_0xd9cc('0x2a')](db['SquareRecording'][_0xd9cc('0x2b')],function(_0xfe6c72){return{'name':_0xfe6c72[_0xd9cc('0x2c')],'type':_0xfe6c72['type'][_0xd9cc('0x2d')]};});_0x244709[_0xd9cc('0x2e')]=_['map'](_0x5b7f11,'name');_0x244709[_0xd9cc('0x2f')]=_[_0xd9cc('0x30')](_0x229ed8[_0xd9cc('0x2f')]);_0x244709['filters']=_[_0xd9cc('0x31')](_0x244709[_0xd9cc('0x2e')],_0x244709[_0xd9cc('0x2f')]);_0x39859b['attributes']=_[_0xd9cc('0x31')](_0x244709['model'],qs[_0xd9cc('0x32')](_0x229ed8[_0xd9cc('0x2f')]['fields']));_0x39859b[_0xd9cc('0x33')]=_0x39859b[_0xd9cc('0x33')][_0xd9cc('0x34')]?_0x39859b[_0xd9cc('0x33')]:_0x244709['model'];if(!_0x229ed8[_0xd9cc('0x2f')][_0xd9cc('0x35')]('nolimit')){_0x39859b[_0xd9cc('0x1b')]=qs[_0xd9cc('0x1b')](_0x229ed8[_0xd9cc('0x2f')][_0xd9cc('0x1b')]);_0x39859b[_0xd9cc('0x19')]=qs[_0xd9cc('0x19')](_0x229ed8[_0xd9cc('0x2f')][_0xd9cc('0x19')]);}_0x39859b[_0xd9cc('0x36')]=qs[_0xd9cc('0x37')](_0x229ed8['query'][_0xd9cc('0x37')]);_0x39859b['where']=qs[_0xd9cc('0x38')](_[_0xd9cc('0x39')](_0x229ed8[_0xd9cc('0x2f')],_0x244709[_0xd9cc('0x38')]),_0x5b7f11);if(_0x229ed8[_0xd9cc('0x2f')][_0xd9cc('0x3a')]){_0x39859b['where']=_[_0xd9cc('0x3b')](_0x39859b[_0xd9cc('0x3c')],{'$or':_[_0xd9cc('0x2a')](_0x5b7f11,function(_0x2a3438){if(_0x2a3438[_0xd9cc('0x3d')]!==_0xd9cc('0x3e')){var _0x2bd24b={};_0x2bd24b[_0x2a3438[_0xd9cc('0x27')]]={'$like':'%'+_0x229ed8[_0xd9cc('0x2f')][_0xd9cc('0x3a')]+'%'};return _0x2bd24b;}})});}_0x39859b=_[_0xd9cc('0x3b')]({},_0x39859b,_0x229ed8['options']);var _0x145e55={'where':_0x39859b['where']};return db[_0xd9cc('0x3f')][_0xd9cc('0x1c')](_0x145e55)['then'](function(_0x1f136a){_0x2874b6[_0xd9cc('0x1c')]=_0x1f136a;if(_0x229ed8[_0xd9cc('0x2f')][_0xd9cc('0x40')]){_0x39859b['include']=[{'all':!![]}];}return db[_0xd9cc('0x3f')][_0xd9cc('0x41')](_0x39859b);})['then'](function(_0x159510){_0x2874b6[_0xd9cc('0x42')]=_0x159510;return _0x2874b6;})[_0xd9cc('0x22')](respondWithFilteredResult(_0x17d8bd,_0x39859b))[_0xd9cc('0x43')](handleError(_0x17d8bd,null));};exports['show']=function(_0x3b0401,_0x2f7710){var _0x462262={'raw':!![],'where':{'id':_0x3b0401[_0xd9cc('0x44')]['id']}},_0x1ff377={};_0x1ff377[_0xd9cc('0x2e')]=_[_0xd9cc('0x30')](db['SquareRecording']['rawAttributes']);_0x1ff377[_0xd9cc('0x2f')]=_[_0xd9cc('0x30')](_0x3b0401[_0xd9cc('0x2f')]);_0x1ff377[_0xd9cc('0x38')]=_['intersection'](_0x1ff377[_0xd9cc('0x2e')],_0x1ff377[_0xd9cc('0x2f')]);_0x462262['attributes']=_['intersection'](_0x1ff377[_0xd9cc('0x2e')],qs[_0xd9cc('0x32')](_0x3b0401['query'][_0xd9cc('0x32')]));_0x462262[_0xd9cc('0x33')]=_0x462262[_0xd9cc('0x33')]['length']?_0x462262[_0xd9cc('0x33')]:_0x1ff377[_0xd9cc('0x2e')];if(_0x3b0401[_0xd9cc('0x2f')][_0xd9cc('0x40')]){_0x462262[_0xd9cc('0x45')]=[{'all':!![]}];}_0x462262=_['merge']({},_0x462262,_0x3b0401[_0xd9cc('0x46')]);return db[_0xd9cc('0x3f')][_0xd9cc('0x47')](_0x462262)[_0xd9cc('0x22')](handleEntityNotFound(_0x2f7710,null))[_0xd9cc('0x22')](respondWithResult(_0x2f7710,null))[_0xd9cc('0x43')](handleError(_0x2f7710,null));};exports[_0xd9cc('0x48')]=function(_0x456b87,_0x1acb7b){return db[_0xd9cc('0x3f')][_0xd9cc('0x48')](_0x456b87['body'],{})[_0xd9cc('0x22')](respondWithResult(_0x1acb7b,0xc9))[_0xd9cc('0x43')](handleError(_0x1acb7b,null));};exports['update']=function(_0x9bf4c3,_0x727518){if(_0x9bf4c3[_0xd9cc('0x49')]['id']){delete _0x9bf4c3[_0xd9cc('0x49')]['id'];}return db[_0xd9cc('0x3f')][_0xd9cc('0x47')]({'where':{'id':_0x9bf4c3[_0xd9cc('0x44')]['id']}})[_0xd9cc('0x22')](handleEntityNotFound(_0x727518,null))[_0xd9cc('0x22')](saveUpdates(_0x9bf4c3[_0xd9cc('0x49')],null))[_0xd9cc('0x22')](respondWithResult(_0x727518,null))['catch'](handleError(_0x727518,null));};exports['download']=function(_0x109ef4,_0x924061,_0xc8f64b){var _0x543e1d=require(_0xd9cc('0x4a'));var _0x1bcfd4=![];var _0x27095f={};if(_0x109ef4[_0xd9cc('0x2f')]['type']&&_0x109ef4['query'][_0xd9cc('0x3d')]==='uniqueid'){_0x27095f['uniqueid']=_0x109ef4[_0xd9cc('0x44')]['id'];}else{_0x27095f['id']=_0x109ef4[_0xd9cc('0x44')]['id'];}return db['SquareRecording'][_0xd9cc('0x47')]({'where':_0x27095f,'attributes':['id',_0xd9cc('0x4b'),'filename'],'raw':!![]})[_0xd9cc('0x22')](handleEntityNotFound(_0x924061,null))[_0xd9cc('0x22')](function(_0x262089){if(_0x262089){var _0xe97ef1=_0x262089[_0xd9cc('0x4b')];var _0x37a35b=util[_0xd9cc('0x4c')](_0xd9cc('0x4d'),_0xe97ef1);if(fs['existsSync'](_0x37a35b)){_0x1bcfd4=!![];return _0x543e1d[_0xd9cc('0x4e')](_0x37a35b,_0xe97ef1,config[_0xd9cc('0x4f')][_0xd9cc('0x50')])['then'](function(){return _0x262089;});}return _0x262089;}})[_0xd9cc('0x22')](function(_0x179885){if(_0x179885){var _0x420f80=_0x179885[_0xd9cc('0x4b')];if(!fs[_0xd9cc('0x51')](_0x420f80)){throw new db[(_0xd9cc('0x52'))][(_0xd9cc('0x53'))](_0xd9cc('0x54'));}if(_0x179885[_0xd9cc('0x55')]){return _0x924061['download'](_0x420f80,_0x179885[_0xd9cc('0x55')]+path[_0xd9cc('0x56')](_0x420f80),function(){if(_0x1bcfd4){fs['unlink'](_0x420f80);}});}else{return _0x924061[_0xd9cc('0x57')](_0x420f80,function(_0x272481){if(_0x1bcfd4){fs[_0xd9cc('0x58')](_0x420f80);}});}}})[_0xd9cc('0x43')](function(_0x510889){if(_0x510889[_0xd9cc('0x59')]===_0xd9cc('0x54')){_0x924061['status'](0x194)['send'](_0xd9cc('0x5a'));}else{return handleError(_0x924061,null);}});};exports[_0xd9cc('0x23')]=function(_0x48775c,_0x4e9631){return db[_0xd9cc('0x3f')][_0xd9cc('0x47')]({'where':{'id':_0x48775c[_0xd9cc('0x44')]['id']}})[_0xd9cc('0x22')](function(_0x4b5086){if(_['isNil'](_0x4b5086)){throw new ReferenceError(_0xd9cc('0x5b'));}return _0x4b5086;})[_0xd9cc('0x22')](function(_0x18a034){var _0x3aa95a=_0x18a034['savePath'];logger[_0xd9cc('0x5c')](_0xd9cc('0x5d'),_0x3aa95a);if(!_['isNil'](_0x18a034['savePath'])&&fs['existsSync'](_0x3aa95a)){logger[_0xd9cc('0x5c')]('File:\x20\x22'+_0x3aa95a+_0xd9cc('0x5e'));fs[_0xd9cc('0x5f')](_0x3aa95a);}_0x3aa95a=_0x3aa95a+'.cypher';if(!_[_0xd9cc('0x60')](_0x18a034['savePath'])&&fs[_0xd9cc('0x51')](_0x3aa95a)){logger['info'](_0xd9cc('0x61')+_0x3aa95a+_0xd9cc('0x5e'));fs[_0xd9cc('0x5f')](_0x3aa95a);}return _0x18a034;})[_0xd9cc('0x22')](function(_0xb81464){if(!_0xb81464)throw new InternalError();return _0xb81464[_0xd9cc('0x23')]();})[_0xd9cc('0x22')](function(){_0x4e9631['status'](0xcc)[_0xd9cc('0x18')]();})[_0xd9cc('0x43')](handleError(_0x4e9631,null));}; \ No newline at end of file +var _0x63de=['options','SquareRecording','includeAll','include','findAll','rows','show','params','rawAttributes','fields','length','find','catch','create','body','update','download','../../components/encryptor','uniqueid','savePath','filename','existsSync','decryptFile','recording','ValidationError','SquareRecording\x20not\x20found','extname','unlink','message','send','Not\x20found','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','isNil','unlinkSync','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','limit','undefined','count','set','Content-Range','reject','save','then','destroy','end','error','name','fieldName','type','key','model','map','query','keys','attributes','intersection','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL'];(function(_0x14b62e,_0x3b8096){var _0x42ad69=function(_0x1d537a){while(--_0x1d537a){_0x14b62e['push'](_0x14b62e['shift']());}};_0x42ad69(++_0x3b8096);}(_0x63de,0x141));var _0xe63d=function(_0x445260,_0x2b5efd){_0x445260=_0x445260-0x0;var _0x2309b0=_0x63de[_0x445260];return _0x2309b0;};'use strict';var emlformat=require(_0xe63d('0x0'));var rimraf=require(_0xe63d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe63d('0x2'));var rp=require(_0xe63d('0x3'));var moment=require(_0xe63d('0x4'));var BPromise=require(_0xe63d('0x5'));var Mustache=require('mustache');var util=require(_0xe63d('0x6'));var path=require('path');var sox=require(_0xe63d('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe63d('0x8'));var _=require(_0xe63d('0x9'));var squel=require('squel');var crypto=require(_0xe63d('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xe63d('0xb'));var toCsv=require('to-csv');var querystring=require(_0xe63d('0xc'));var Papa=require('papaparse');var Redis=require(_0xe63d('0xd'));var authService=require(_0xe63d('0xe'));var qs=require(_0xe63d('0xf'));var as=require(_0xe63d('0x10'));var hardwareService=require(_0xe63d('0x11'));var logger=require(_0xe63d('0x12'))(_0xe63d('0x13'));var utils=require(_0xe63d('0x14'));var config=require(_0xe63d('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xe63d('0x16'))['db'];function respondWithStatusCode(_0x2aef3b,_0x2e48ae){_0x2e48ae=_0x2e48ae||0xcc;return function(_0x2a3988){if(_0x2a3988){return _0x2aef3b[_0xe63d('0x17')](_0x2e48ae);}return _0x2aef3b['status'](_0x2e48ae)['end']();};}function respondWithResult(_0x490c76,_0x2289eb){_0x2289eb=_0x2289eb||0xc8;return function(_0x3410c4){if(_0x3410c4){return _0x490c76[_0xe63d('0x18')](_0x2289eb)['json'](_0x3410c4);}};}function respondWithFilteredResult(_0x29c275,_0x2b80d1){return function(_0x564bbf){if(_0x564bbf){var _0x223ee9=typeof _0x2b80d1[_0xe63d('0x19')]==='undefined'&&typeof _0x2b80d1[_0xe63d('0x1a')]===_0xe63d('0x1b');var _0x4e2ee5=_0x564bbf['count'];var _0x1b64fb=_0x223ee9?0x0:_0x2b80d1[_0xe63d('0x19')];var _0x4f9b32=_0x223ee9?_0x564bbf[_0xe63d('0x1c')]:_0x2b80d1[_0xe63d('0x19')]+_0x2b80d1['limit'];var _0x5bb959;if(_0x4f9b32>=_0x4e2ee5){_0x4f9b32=_0x4e2ee5;_0x5bb959=0xc8;}else{_0x5bb959=0xce;}_0x29c275[_0xe63d('0x18')](_0x5bb959);return _0x29c275[_0xe63d('0x1d')](_0xe63d('0x1e'),_0x1b64fb+'-'+_0x4f9b32+'/'+_0x4e2ee5)['json'](_0x564bbf);}return null;};}function patchUpdates(_0x1be834){return function(_0xfc2df7){try{jsonpatch['apply'](_0xfc2df7,_0x1be834,!![]);}catch(_0x24f164){return BPromise[_0xe63d('0x1f')](_0x24f164);}return _0xfc2df7[_0xe63d('0x20')]();};}function saveUpdates(_0x5fd970,_0x4ae52b){return function(_0x10201d){if(_0x10201d){return _0x10201d['update'](_0x5fd970)[_0xe63d('0x21')](function(_0xcad6c6){return _0xcad6c6;});}return null;};}function removeEntity(_0x534d75,_0x1adb31){return function(_0x383d4c){if(_0x383d4c){return _0x383d4c[_0xe63d('0x22')]()['then'](function(){_0x534d75[_0xe63d('0x18')](0xcc)[_0xe63d('0x23')]();});}};}function handleEntityNotFound(_0x4ac093,_0x5c38cd){return function(_0x48080b){if(!_0x48080b){_0x4ac093[_0xe63d('0x17')](0x194);}return _0x48080b;};}function handleError(_0x2d8485,_0x3dc4e1){_0x3dc4e1=_0x3dc4e1||0x1f4;return function(_0x3de600){logger[_0xe63d('0x24')](_0x3de600['stack']);if(_0x3de600[_0xe63d('0x25')]){delete _0x3de600[_0xe63d('0x25')];}_0x2d8485[_0xe63d('0x18')](_0x3dc4e1)['send'](_0x3de600);};}exports['index']=function(_0xcd5df2,_0x2e114e){var _0x598a3c={},_0x56f385={},_0x53f1ea={'count':0x0,'rows':[]};var _0x48725d=_['map'](db['SquareRecording']['rawAttributes'],function(_0x467c5c){return{'name':_0x467c5c[_0xe63d('0x26')],'type':_0x467c5c[_0xe63d('0x27')][_0xe63d('0x28')]};});_0x56f385[_0xe63d('0x29')]=_[_0xe63d('0x2a')](_0x48725d,_0xe63d('0x25'));_0x56f385[_0xe63d('0x2b')]=_[_0xe63d('0x2c')](_0xcd5df2[_0xe63d('0x2b')]);_0x56f385['filters']=_['intersection'](_0x56f385[_0xe63d('0x29')],_0x56f385[_0xe63d('0x2b')]);_0x598a3c[_0xe63d('0x2d')]=_[_0xe63d('0x2e')](_0x56f385['model'],qs['fields'](_0xcd5df2[_0xe63d('0x2b')]['fields']));_0x598a3c['attributes']=_0x598a3c[_0xe63d('0x2d')]['length']?_0x598a3c[_0xe63d('0x2d')]:_0x56f385[_0xe63d('0x29')];if(!_0xcd5df2[_0xe63d('0x2b')][_0xe63d('0x2f')](_0xe63d('0x30'))){_0x598a3c[_0xe63d('0x1a')]=qs[_0xe63d('0x1a')](_0xcd5df2['query'][_0xe63d('0x1a')]);_0x598a3c['offset']=qs[_0xe63d('0x19')](_0xcd5df2[_0xe63d('0x2b')]['offset']);}_0x598a3c[_0xe63d('0x31')]=qs[_0xe63d('0x32')](_0xcd5df2[_0xe63d('0x2b')][_0xe63d('0x32')]);_0x598a3c[_0xe63d('0x33')]=qs['filters'](_['pick'](_0xcd5df2[_0xe63d('0x2b')],_0x56f385[_0xe63d('0x34')]),_0x48725d);if(_0xcd5df2[_0xe63d('0x2b')][_0xe63d('0x35')]){_0x598a3c[_0xe63d('0x33')]=_['merge'](_0x598a3c[_0xe63d('0x33')],{'$or':_[_0xe63d('0x2a')](_0x48725d,function(_0x53f9de){if(_0x53f9de[_0xe63d('0x27')]!==_0xe63d('0x36')){var _0x50d4a6={};_0x50d4a6[_0x53f9de[_0xe63d('0x25')]]={'$like':'%'+_0xcd5df2[_0xe63d('0x2b')][_0xe63d('0x35')]+'%'};return _0x50d4a6;}})});}_0x598a3c=_['merge']({},_0x598a3c,_0xcd5df2[_0xe63d('0x37')]);var _0x15debf={'where':_0x598a3c['where']};return db[_0xe63d('0x38')][_0xe63d('0x1c')](_0x15debf)[_0xe63d('0x21')](function(_0x17ff01){_0x53f1ea[_0xe63d('0x1c')]=_0x17ff01;if(_0xcd5df2[_0xe63d('0x2b')][_0xe63d('0x39')]){_0x598a3c[_0xe63d('0x3a')]=[{'all':!![]}];}return db[_0xe63d('0x38')][_0xe63d('0x3b')](_0x598a3c);})['then'](function(_0x204c4e){_0x53f1ea[_0xe63d('0x3c')]=_0x204c4e;return _0x53f1ea;})[_0xe63d('0x21')](respondWithFilteredResult(_0x2e114e,_0x598a3c))['catch'](handleError(_0x2e114e,null));};exports[_0xe63d('0x3d')]=function(_0x5c0990,_0xe17828){var _0x54ec9e={'raw':!![],'where':{'id':_0x5c0990[_0xe63d('0x3e')]['id']}},_0xdca684={};_0xdca684[_0xe63d('0x29')]=_[_0xe63d('0x2c')](db[_0xe63d('0x38')][_0xe63d('0x3f')]);_0xdca684[_0xe63d('0x2b')]=_[_0xe63d('0x2c')](_0x5c0990[_0xe63d('0x2b')]);_0xdca684[_0xe63d('0x34')]=_[_0xe63d('0x2e')](_0xdca684[_0xe63d('0x29')],_0xdca684[_0xe63d('0x2b')]);_0x54ec9e[_0xe63d('0x2d')]=_[_0xe63d('0x2e')](_0xdca684[_0xe63d('0x29')],qs['fields'](_0x5c0990[_0xe63d('0x2b')][_0xe63d('0x40')]));_0x54ec9e[_0xe63d('0x2d')]=_0x54ec9e[_0xe63d('0x2d')][_0xe63d('0x41')]?_0x54ec9e['attributes']:_0xdca684[_0xe63d('0x29')];if(_0x5c0990['query']['includeAll']){_0x54ec9e[_0xe63d('0x3a')]=[{'all':!![]}];}_0x54ec9e=_['merge']({},_0x54ec9e,_0x5c0990[_0xe63d('0x37')]);return db[_0xe63d('0x38')][_0xe63d('0x42')](_0x54ec9e)[_0xe63d('0x21')](handleEntityNotFound(_0xe17828,null))['then'](respondWithResult(_0xe17828,null))[_0xe63d('0x43')](handleError(_0xe17828,null));};exports[_0xe63d('0x44')]=function(_0x566190,_0x551dd6){return db[_0xe63d('0x38')][_0xe63d('0x44')](_0x566190[_0xe63d('0x45')],{})['then'](respondWithResult(_0x551dd6,0xc9))[_0xe63d('0x43')](handleError(_0x551dd6,null));};exports[_0xe63d('0x46')]=function(_0x32f8c7,_0x58af70){if(_0x32f8c7[_0xe63d('0x45')]['id']){delete _0x32f8c7['body']['id'];}return db[_0xe63d('0x38')]['find']({'where':{'id':_0x32f8c7['params']['id']}})[_0xe63d('0x21')](handleEntityNotFound(_0x58af70,null))[_0xe63d('0x21')](saveUpdates(_0x32f8c7[_0xe63d('0x45')],null))[_0xe63d('0x21')](respondWithResult(_0x58af70,null))[_0xe63d('0x43')](handleError(_0x58af70,null));};exports[_0xe63d('0x47')]=function(_0x13088c,_0x1e1d8f,_0x27c493){var _0x535dc8=require(_0xe63d('0x48'));var _0x1da85f=![];var _0x3f226e={};if(_0x13088c[_0xe63d('0x2b')][_0xe63d('0x27')]&&_0x13088c['query'][_0xe63d('0x27')]===_0xe63d('0x49')){_0x3f226e[_0xe63d('0x49')]=_0x13088c[_0xe63d('0x3e')]['id'];}else{_0x3f226e['id']=_0x13088c['params']['id'];}return db[_0xe63d('0x38')][_0xe63d('0x42')]({'where':_0x3f226e,'attributes':['id',_0xe63d('0x4a'),_0xe63d('0x4b')],'raw':!![]})['then'](handleEntityNotFound(_0x1e1d8f,null))[_0xe63d('0x21')](function(_0x126f4f){if(_0x126f4f){var _0x315a26=_0x126f4f[_0xe63d('0x4a')];var _0x2182d9=util['format']('%s.cypher',_0x315a26);if(fs[_0xe63d('0x4c')](_0x2182d9)){_0x1da85f=!![];return _0x535dc8[_0xe63d('0x4d')](_0x2182d9,_0x315a26,config['secrets'][_0xe63d('0x4e')])[_0xe63d('0x21')](function(){return _0x126f4f;});}return _0x126f4f;}})[_0xe63d('0x21')](function(_0x1b6ea1){if(_0x1b6ea1){var _0x55a07f=_0x1b6ea1[_0xe63d('0x4a')];if(!fs['existsSync'](_0x55a07f)){throw new db['Sequelize'][(_0xe63d('0x4f'))](_0xe63d('0x50'));}if(_0x1b6ea1[_0xe63d('0x4b')]){return _0x1e1d8f[_0xe63d('0x47')](_0x55a07f,_0x1b6ea1[_0xe63d('0x4b')]+path[_0xe63d('0x51')](_0x55a07f),function(){if(_0x1da85f){fs[_0xe63d('0x52')](_0x55a07f);}});}else{return _0x1e1d8f[_0xe63d('0x47')](_0x55a07f,function(_0x125484){if(_0x1da85f){fs[_0xe63d('0x52')](_0x55a07f);}});}}})['catch'](function(_0x5748c1){if(_0x5748c1[_0xe63d('0x53')]===_0xe63d('0x50')){_0x1e1d8f[_0xe63d('0x18')](0x194)[_0xe63d('0x54')](_0xe63d('0x55'));}else{return handleError(_0x1e1d8f,null);}});};exports[_0xe63d('0x22')]=function(_0x7b26c9,_0x473411){return db[_0xe63d('0x38')][_0xe63d('0x42')]({'where':{'id':_0x7b26c9['params']['id']}})[_0xe63d('0x21')](function(_0x459398){if(_['isNil'](_0x459398)){throw new ReferenceError(_0xe63d('0x56'));}return _0x459398;})[_0xe63d('0x21')](function(_0x5ee652){var _0x59305e=_0x5ee652[_0xe63d('0x4a')];logger['info'](_0xe63d('0x57'),_0x59305e);if(!_['isNil'](_0x5ee652['savePath'])&&fs[_0xe63d('0x4c')](_0x59305e)){logger[_0xe63d('0x58')](_0xe63d('0x59')+_0x59305e+_0xe63d('0x5a'));fs['unlinkSync'](_0x59305e);}_0x59305e=_0x59305e+_0xe63d('0x5b');if(!_[_0xe63d('0x5c')](_0x5ee652[_0xe63d('0x4a')])&&fs[_0xe63d('0x4c')](_0x59305e)){logger[_0xe63d('0x58')]('File:\x20\x22'+_0x59305e+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xe63d('0x5d')](_0x59305e);}return _0x5ee652;})['then'](function(_0x4615e9){if(!_0x4615e9)throw new InternalError();return _0x4615e9['destroy']();})['then'](function(){_0x473411[_0xe63d('0x18')](0xcc)[_0xe63d('0x23')]();})['catch'](handleError(_0x473411,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 36fe58c..b5767f0 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 _0x4bd3=['exports','define','SquareRecording','lodash','../../config/logger','api','path','rimraf','../../config/environment'];(function(_0x973279,_0xef77d6){var _0x585045=function(_0x362bbe){while(--_0x362bbe){_0x973279['push'](_0x973279['shift']());}};_0x585045(++_0xef77d6);}(_0x4bd3,0x174));var _0x34bd=function(_0x596a88,_0x210a4e){_0x596a88=_0x596a88-0x0;var _0xc5cb5d=_0x4bd3[_0x596a88];return _0xc5cb5d;};'use strict';var _=require(_0x34bd('0x0'));var util=require('util');var logger=require(_0x34bd('0x1'))(_0x34bd('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x34bd('0x3'));var rimraf=require(_0x34bd('0x4'));var config=require(_0x34bd('0x5'));var attributes=require('./squareRecording.attributes');module[_0x34bd('0x6')]=function(_0x2a15a2,_0x5c2a7a){return _0x2a15a2[_0x34bd('0x7')](_0x34bd('0x8'),attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6afc=['lodash','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./squareRecording.attributes','define','SquareRecording','square_recordings'];(function(_0x48fc6c,_0x316632){var _0xbb3ba1=function(_0x41dbbc){while(--_0x41dbbc){_0x48fc6c['push'](_0x48fc6c['shift']());}};_0xbb3ba1(++_0x316632);}(_0x6afc,0x16b));var _0xc6af=function(_0x42f602,_0x1a09d0){_0x42f602=_0x42f602-0x0;var _0x27b174=_0x6afc[_0x42f602];return _0x27b174;};'use strict';var _=require(_0xc6af('0x0'));var util=require('util');var logger=require(_0xc6af('0x1'))('api');var moment=require(_0xc6af('0x2'));var BPromise=require(_0xc6af('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc6af('0x4'));var rimraf=require(_0xc6af('0x5'));var config=require(_0xc6af('0x6'));var attributes=require(_0xc6af('0x7'));module['exports']=function(_0x3beacd,_0x2bca8e){return _0x3beacd[_0xc6af('0x8')](_0xc6af('0x9'),attributes,{'tableName':_0xc6af('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.rpc.js b/server/api/squareRecording/squareRecording.rpc.js index f11982a..06b049d 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 _0x87b4=['../../config/utils','../../config/logger','rpc','client','http','request','info','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','error','code','SquareRecording,\x20%s,\x20%s','message','catch','CreateSquareRecording','body','options','raw','then','stringify','lodash','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x5b4a94,_0x39e9ae){var _0x97d164=function(_0x490f24){while(--_0x490f24){_0x5b4a94['push'](_0x5b4a94['shift']());}};_0x97d164(++_0x39e9ae);}(_0x87b4,0x167));var _0x487b=function(_0x4b4ff3,_0x16b82f){_0x4b4ff3=_0x4b4ff3-0x0;var _0x335c70=_0x87b4[_0x4b4ff3];return _0x335c70;};'use strict';var _=require(_0x487b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x487b('0x1'));var rs=require(_0x487b('0x2'));var fs=require('fs');var Redis=require(_0x487b('0x3'));var db=require(_0x487b('0x4'))['db'];var utils=require(_0x487b('0x5'));var logger=require(_0x487b('0x6'))(_0x487b('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x487b('0x8')][_0x487b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3c14e2,_0x399890,_0x3bfca5){return new BPromise(function(_0x4f1da9,_0x22a81a){return client[_0x487b('0xa')](_0x3c14e2,_0x3bfca5)['then'](function(_0x490fdb){logger[_0x487b('0xb')]('SquareRecording,\x20%s,\x20%s',_0x399890,_0x487b('0xc'));logger[_0x487b('0xd')](_0x487b('0xe'),_0x399890,_0x487b('0xc'),JSON['stringify'](_0x490fdb));if(_0x490fdb[_0x487b('0xf')]){if(_0x490fdb[_0x487b('0xf')][_0x487b('0x10')]===0x1f4){logger[_0x487b('0xf')](_0x487b('0x11'),_0x399890,_0x490fdb[_0x487b('0xf')][_0x487b('0x12')]);return _0x22a81a(_0x490fdb[_0x487b('0xf')][_0x487b('0x12')]);}logger[_0x487b('0xf')](_0x487b('0x11'),_0x399890,_0x490fdb['error'][_0x487b('0x12')]);return _0x4f1da9(_0x490fdb['error']['message']);}else{logger[_0x487b('0xb')]('SquareRecording,\x20%s,\x20%s',_0x399890,'request\x20sent');_0x4f1da9(_0x490fdb['result'][_0x487b('0x12')]);}})[_0x487b('0x13')](function(_0x2b39e6){logger[_0x487b('0xf')](_0x487b('0x11'),_0x399890,_0x2b39e6);_0x22a81a(_0x2b39e6);});});}exports[_0x487b('0x14')]=function(_0x335fb2){var _0x2ddedd=this;return new Promise(function(_0x206882,_0x313868){return db['SquareRecording']['create'](_0x335fb2[_0x487b('0x15')],{'raw':_0x335fb2['options']?_0x335fb2[_0x487b('0x16')][_0x487b('0x17')]===undefined?!![]:![]:!![]})[_0x487b('0x18')](function(_0x38c793){logger['info'](_0x487b('0x14'),_0x335fb2);logger[_0x487b('0xd')](_0x487b('0x14'),_0x335fb2,JSON[_0x487b('0x19')](_0x38c793));_0x206882(_0x38c793);})[_0x487b('0x13')](function(_0x29a04c){logger[_0x487b('0xf')](_0x487b('0x14'),_0x29a04c['message'],_0x335fb2);_0x313868(_0x2ddedd[_0x487b('0xf')](0x1f4,_0x29a04c['message']));});});}; \ No newline at end of file +var _0xacc2=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','create','body','options','CreateSquareRecording','lodash','util','moment','bluebird','../../mysqldb','../../config/logger'];(function(_0x3bd1fb,_0x4beb4c){var _0x37b18a=function(_0xecb1ea){while(--_0xecb1ea){_0x3bd1fb['push'](_0x3bd1fb['shift']());}};_0x37b18a(++_0x4beb4c);}(_0xacc2,0xed));var _0x2acc=function(_0xfe056b,_0x3c32bb){_0xfe056b=_0xfe056b-0x0;var _0x5a9ad5=_0xacc2[_0xfe056b];return _0x5a9ad5;};'use strict';var _=require(_0x2acc('0x0'));var util=require(_0x2acc('0x1'));var moment=require(_0x2acc('0x2'));var BPromise=require(_0x2acc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2acc('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2acc('0x5'))(_0x2acc('0x6'));var config=require(_0x2acc('0x7'));var jayson=require(_0x2acc('0x8'));var client=jayson[_0x2acc('0x9')][_0x2acc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4eeb44,_0x4df124,_0x548e07){return new BPromise(function(_0x282605,_0xc528fc){return client[_0x2acc('0xb')](_0x4eeb44,_0x548e07)[_0x2acc('0xc')](function(_0x547f04){logger[_0x2acc('0xd')](_0x2acc('0xe'),_0x4df124,_0x2acc('0xf'));logger[_0x2acc('0x10')](_0x2acc('0x11'),_0x4df124,_0x2acc('0xf'),JSON[_0x2acc('0x12')](_0x547f04));if(_0x547f04[_0x2acc('0x13')]){if(_0x547f04['error'][_0x2acc('0x14')]===0x1f4){logger[_0x2acc('0x13')](_0x2acc('0xe'),_0x4df124,_0x547f04[_0x2acc('0x13')][_0x2acc('0x15')]);return _0xc528fc(_0x547f04[_0x2acc('0x13')][_0x2acc('0x15')]);}logger[_0x2acc('0x13')](_0x2acc('0xe'),_0x4df124,_0x547f04[_0x2acc('0x13')]['message']);return _0x282605(_0x547f04[_0x2acc('0x13')][_0x2acc('0x15')]);}else{logger[_0x2acc('0xd')]('SquareRecording,\x20%s,\x20%s',_0x4df124,_0x2acc('0xf'));_0x282605(_0x547f04['result'][_0x2acc('0x15')]);}})[_0x2acc('0x16')](function(_0x3dc46a){logger['error']('SquareRecording,\x20%s,\x20%s',_0x4df124,_0x3dc46a);_0xc528fc(_0x3dc46a);});});}exports['CreateSquareRecording']=function(_0x200f2a){var _0x574828=this;return new Promise(function(_0x2c97dd,_0x458e42){return db['SquareRecording'][_0x2acc('0x17')](_0x200f2a[_0x2acc('0x18')],{'raw':_0x200f2a['options']?_0x200f2a[_0x2acc('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x2acc('0xc')](function(_0x2c6a41){logger[_0x2acc('0xd')](_0x2acc('0x1a'),_0x200f2a);logger[_0x2acc('0x10')](_0x2acc('0x1a'),_0x200f2a,JSON[_0x2acc('0x12')](_0x2c6a41));_0x2c97dd(_0x2c6a41);})[_0x2acc('0x16')](function(_0xe5ba95){logger[_0x2acc('0x13')](_0x2acc('0x1a'),_0xe5ba95[_0x2acc('0x15')],_0x200f2a);_0x458e42(_0x574828[_0x2acc('0x13')](0x1f4,_0xe5ba95[_0x2acc('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index cb1c05b..f8d8d13 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(_0x3cc05d,_0x4b8f88){var _0x28b736=function(_0x369b0e){while(--_0x369b0e){_0x3cc05d['push'](_0x3cc05d['shift']());}};_0x28b736(++_0x4b8f88);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./squareReport.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +var _0xe706=['/describe','describe','/:id','show','post','create','put','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index'];(function(_0x41c4b2,_0x5dba7e){var _0x42dfe=function(_0x36b435){while(--_0x36b435){_0x41c4b2['push'](_0x41c4b2['shift']());}};_0x42dfe(++_0x5dba7e);}(_0xe706,0xa3));var _0x6e70=function(_0x5ebf85,_0x598413){_0x5ebf85=_0x5ebf85-0x0;var _0x5b175a=_0xe706[_0x5ebf85];return _0x5b175a;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0x12')]);router[_0x6e70('0x13')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller['update']);router['delete'](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x14')]);module[_0x6e70('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 26dc25a..bb87113 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 _0x0510=['DATE','sequelize','exports','STRING'];(function(_0xc2e3f3,_0x11160e){var _0x56f403=function(_0x475a3){while(--_0x475a3){_0xc2e3f3['push'](_0xc2e3f3['shift']());}};_0x56f403(++_0x11160e);}(_0x0510,0x121));var _0x0051=function(_0x170779,_0x23671d){_0x170779=_0x170779-0x0;var _0x2d126f=_0x0510[_0x170779];return _0x2d126f;};'use strict';var Sequelize=require(_0x0051('0x0'));module[_0x0051('0x1')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0x0051('0x2')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x0051('0x2')]},'language':{'type':Sequelize[_0x0051('0x2')]},'type':{'type':Sequelize[_0x0051('0x2')]},'uniqueid':{'type':Sequelize[_0x0051('0x2')]},'version':{'type':Sequelize[_0x0051('0x2')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x0051('0x2')]},'callingpres':{'type':Sequelize[_0x0051('0x2')]},'callingani2':{'type':Sequelize[_0x0051('0x2')]},'callington':{'type':Sequelize[_0x0051('0x2')]},'callingtns':{'type':Sequelize[_0x0051('0x2')]},'dnid':{'type':Sequelize[_0x0051('0x2')]},'rdnis':{'type':Sequelize[_0x0051('0x2')]},'context':{'type':Sequelize[_0x0051('0x2')]},'extension':{'type':Sequelize[_0x0051('0x2')]},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0x0051('0x2')]},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize[_0x0051('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x0051('0x3')]},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xff8a=['STRING','DATE','BOOLEAN','exports'];(function(_0x5180c3,_0x4b35f7){var _0x55c975=function(_0x4746cb){while(--_0x4746cb){_0x5180c3['push'](_0x5180c3['shift']());}};_0x55c975(++_0x4b35f7);}(_0xff8a,0x17f));var _0xaff8=function(_0x5123ca,_0x16157e){_0x5123ca=_0x5123ca-0x0;var _0x4705ed=_0xff8a[_0x5123ca];return _0x4705ed;};'use strict';var Sequelize=require('sequelize');module[_0xaff8('0x0')]={'network':{'type':Sequelize[_0xaff8('0x1')]},'network_script':{'type':Sequelize[_0xaff8('0x1')]},'request':{'type':Sequelize[_0xaff8('0x1')]},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xaff8('0x1')]},'type':{'type':Sequelize[_0xaff8('0x1')]},'uniqueid':{'type':Sequelize[_0xaff8('0x1')]},'version':{'type':Sequelize[_0xaff8('0x1')]},'callerid':{'type':Sequelize[_0xaff8('0x1')]},'calleridname':{'type':Sequelize[_0xaff8('0x1')]},'callingpres':{'type':Sequelize[_0xaff8('0x1')]},'callingani2':{'type':Sequelize[_0xaff8('0x1')]},'callington':{'type':Sequelize[_0xaff8('0x1')]},'callingtns':{'type':Sequelize[_0xaff8('0x1')]},'dnid':{'type':Sequelize[_0xaff8('0x1')]},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xaff8('0x1')]},'extension':{'type':Sequelize[_0xaff8('0x1')]},'priority':{'type':Sequelize[_0xaff8('0x1')]},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xaff8('0x1')]},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize[_0xaff8('0x1')]},'joinAt':{'type':Sequelize[_0xaff8('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0xaff8('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 0e3a727..06b14e0 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 _0x27e8=['fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','SquareReport','includeAll','include','rows','catch','params','find','create','body','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','apply','reject','save','update','then','name','send','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes'];(function(_0x25e90f,_0x1ec0eb){var _0x294e14=function(_0x2c32af){while(--_0x2c32af){_0x25e90f['push'](_0x25e90f['shift']());}};_0x294e14(++_0x1ec0eb);}(_0x27e8,0x1ba));var _0x827e=function(_0x407afa,_0x500d19){_0x407afa=_0x407afa-0x0;var _0x463816=_0x27e8[_0x407afa];return _0x463816;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x827e('0x0'));var zipdir=require(_0x827e('0x1'));var jsonpatch=require(_0x827e('0x2'));var rp=require(_0x827e('0x3'));var moment=require('moment');var BPromise=require(_0x827e('0x4'));var Mustache=require(_0x827e('0x5'));var util=require('util');var path=require('path');var sox=require(_0x827e('0x6'));var csv=require(_0x827e('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x827e('0x8'));var _=require(_0x827e('0x9'));var squel=require('squel');var crypto=require(_0x827e('0xa'));var jsforce=require(_0x827e('0xb'));var deskjs=require(_0x827e('0xc'));var toCsv=require(_0x827e('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x827e('0xd'));var authService=require(_0x827e('0xe'));var qs=require(_0x827e('0xf'));var as=require(_0x827e('0x10'));var hardwareService=require(_0x827e('0x11'));var logger=require(_0x827e('0x12'))(_0x827e('0x13'));var utils=require(_0x827e('0x14'));var config=require(_0x827e('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x827e('0x16'))['db'];function respondWithStatusCode(_0x4ff4b2,_0x482033){_0x482033=_0x482033||0xcc;return function(_0x1de8f2){if(_0x1de8f2){return _0x4ff4b2[_0x827e('0x17')](_0x482033);}return _0x4ff4b2['status'](_0x482033)[_0x827e('0x18')]();};}function respondWithResult(_0x599ed5,_0x31e827){_0x31e827=_0x31e827||0xc8;return function(_0x32470e){if(_0x32470e){return _0x599ed5[_0x827e('0x19')](_0x31e827)[_0x827e('0x1a')](_0x32470e);}};}function respondWithFilteredResult(_0x37c7bc,_0x372e5d){return function(_0x1fcbfc){if(_0x1fcbfc){var _0x5358dc=typeof _0x372e5d[_0x827e('0x1b')]===_0x827e('0x1c')&&typeof _0x372e5d[_0x827e('0x1d')]===_0x827e('0x1c');var _0x2eac05=_0x1fcbfc[_0x827e('0x1e')];var _0x2735eb=_0x5358dc?0x0:_0x372e5d['offset'];var _0x30f7a8=_0x5358dc?_0x1fcbfc['count']:_0x372e5d[_0x827e('0x1b')]+_0x372e5d['limit'];var _0x476df0;if(_0x30f7a8>=_0x2eac05){_0x30f7a8=_0x2eac05;_0x476df0=0xc8;}else{_0x476df0=0xce;}_0x37c7bc[_0x827e('0x19')](_0x476df0);return _0x37c7bc['set']('Content-Range',_0x2735eb+'-'+_0x30f7a8+'/'+_0x2eac05)['json'](_0x1fcbfc);}return null;};}function patchUpdates(_0x365a97){return function(_0x35ef29){try{jsonpatch[_0x827e('0x1f')](_0x35ef29,_0x365a97,!![]);}catch(_0x481842){return BPromise[_0x827e('0x20')](_0x481842);}return _0x35ef29[_0x827e('0x21')]();};}function saveUpdates(_0x201202,_0x1d3adb){return function(_0x45d9a1){if(_0x45d9a1){return _0x45d9a1[_0x827e('0x22')](_0x201202)[_0x827e('0x23')](function(_0xdb0ab7){return _0xdb0ab7;});}return null;};}function removeEntity(_0x9b5a33,_0xa7d110){return function(_0x31943e){if(_0x31943e){return _0x31943e['destroy']()['then'](function(){_0x9b5a33[_0x827e('0x19')](0xcc)[_0x827e('0x18')]();});}};}function handleEntityNotFound(_0x575598,_0x547bac){return function(_0x427d6c){if(!_0x427d6c){_0x575598[_0x827e('0x17')](0x194);}return _0x427d6c;};}function handleError(_0x30d777,_0x28bb46){_0x28bb46=_0x28bb46||0x1f4;return function(_0x321714){logger['error'](_0x321714['stack']);if(_0x321714[_0x827e('0x24')]){delete _0x321714[_0x827e('0x24')];}_0x30d777[_0x827e('0x19')](_0x28bb46)[_0x827e('0x25')](_0x321714);};}exports['index']=function(_0x3ca20b,_0x555287){var _0x145940={},_0x1829ee={},_0x2339c2={'count':0x0,'rows':[]};var _0x31336d=_[_0x827e('0x26')](db['SquareReport'][_0x827e('0x27')],function(_0x4aea1a){return{'name':_0x4aea1a[_0x827e('0x28')],'type':_0x4aea1a['type'][_0x827e('0x29')]};});_0x1829ee[_0x827e('0x2a')]=_[_0x827e('0x26')](_0x31336d,_0x827e('0x24'));_0x1829ee[_0x827e('0x2b')]=_[_0x827e('0x2c')](_0x3ca20b[_0x827e('0x2b')]);_0x1829ee[_0x827e('0x2d')]=_[_0x827e('0x2e')](_0x1829ee['model'],_0x1829ee[_0x827e('0x2b')]);_0x145940[_0x827e('0x2f')]=_['intersection'](_0x1829ee['model'],qs['fields'](_0x3ca20b[_0x827e('0x2b')][_0x827e('0x30')]));_0x145940[_0x827e('0x2f')]=_0x145940[_0x827e('0x2f')][_0x827e('0x31')]?_0x145940[_0x827e('0x2f')]:_0x1829ee[_0x827e('0x2a')];if(!_0x3ca20b[_0x827e('0x2b')]['hasOwnProperty'](_0x827e('0x32'))){_0x145940[_0x827e('0x1d')]=qs['limit'](_0x3ca20b[_0x827e('0x2b')]['limit']);_0x145940['offset']=qs['offset'](_0x3ca20b[_0x827e('0x2b')][_0x827e('0x1b')]);}_0x145940[_0x827e('0x33')]=qs[_0x827e('0x34')](_0x3ca20b[_0x827e('0x2b')]['sort']);_0x145940[_0x827e('0x35')]=qs[_0x827e('0x2d')](_[_0x827e('0x36')](_0x3ca20b[_0x827e('0x2b')],_0x1829ee[_0x827e('0x2d')]),_0x31336d);if(_0x3ca20b[_0x827e('0x2b')][_0x827e('0x37')]){_0x145940[_0x827e('0x35')]=_[_0x827e('0x38')](_0x145940[_0x827e('0x35')],{'$or':_[_0x827e('0x26')](_0x31336d,function(_0x126112){if(_0x126112['type']!==_0x827e('0x39')){var _0x266de2={};_0x266de2[_0x126112[_0x827e('0x24')]]={'$like':'%'+_0x3ca20b['query'][_0x827e('0x37')]+'%'};return _0x266de2;}})});}_0x145940=_['merge']({},_0x145940,_0x3ca20b[_0x827e('0x3a')]);var _0x56680f={'where':_0x145940[_0x827e('0x35')]};return db[_0x827e('0x3b')][_0x827e('0x1e')](_0x56680f)['then'](function(_0x324655){_0x2339c2[_0x827e('0x1e')]=_0x324655;if(_0x3ca20b[_0x827e('0x2b')][_0x827e('0x3c')]){_0x145940[_0x827e('0x3d')]=[{'all':!![]}];}return db[_0x827e('0x3b')]['findAll'](_0x145940);})[_0x827e('0x23')](function(_0x22fe69){_0x2339c2[_0x827e('0x3e')]=_0x22fe69;return _0x2339c2;})[_0x827e('0x23')](respondWithFilteredResult(_0x555287,_0x145940))[_0x827e('0x3f')](handleError(_0x555287,null));};exports['show']=function(_0x56c4ab,_0x4204d4){var _0x2049ef={'raw':!![],'where':{'id':_0x56c4ab[_0x827e('0x40')]['id']}},_0xadc8cd={};_0xadc8cd[_0x827e('0x2a')]=_[_0x827e('0x2c')](db[_0x827e('0x3b')][_0x827e('0x27')]);_0xadc8cd[_0x827e('0x2b')]=_[_0x827e('0x2c')](_0x56c4ab[_0x827e('0x2b')]);_0xadc8cd[_0x827e('0x2d')]=_[_0x827e('0x2e')](_0xadc8cd[_0x827e('0x2a')],_0xadc8cd[_0x827e('0x2b')]);_0x2049ef[_0x827e('0x2f')]=_['intersection'](_0xadc8cd[_0x827e('0x2a')],qs[_0x827e('0x30')](_0x56c4ab[_0x827e('0x2b')]['fields']));_0x2049ef[_0x827e('0x2f')]=_0x2049ef[_0x827e('0x2f')][_0x827e('0x31')]?_0x2049ef[_0x827e('0x2f')]:_0xadc8cd['model'];if(_0x56c4ab[_0x827e('0x2b')][_0x827e('0x3c')]){_0x2049ef[_0x827e('0x3d')]=[{'all':!![]}];}_0x2049ef=_[_0x827e('0x38')]({},_0x2049ef,_0x56c4ab['options']);return db[_0x827e('0x3b')][_0x827e('0x41')](_0x2049ef)['then'](handleEntityNotFound(_0x4204d4,null))['then'](respondWithResult(_0x4204d4,null))[_0x827e('0x3f')](handleError(_0x4204d4,null));};exports[_0x827e('0x42')]=function(_0x186d27,_0x358239){return db[_0x827e('0x3b')][_0x827e('0x42')](_0x186d27[_0x827e('0x43')],{})['then'](respondWithResult(_0x358239,0xc9))[_0x827e('0x3f')](handleError(_0x358239,null));};exports[_0x827e('0x22')]=function(_0x1e6e7b,_0x4ab199){if(_0x1e6e7b['body']['id']){delete _0x1e6e7b[_0x827e('0x43')]['id'];}return db[_0x827e('0x3b')][_0x827e('0x41')]({'where':{'id':_0x1e6e7b[_0x827e('0x40')]['id']}})['then'](handleEntityNotFound(_0x4ab199,null))[_0x827e('0x23')](saveUpdates(_0x1e6e7b['body'],null))['then'](respondWithResult(_0x4ab199,null))[_0x827e('0x3f')](handleError(_0x4ab199,null));};exports[_0x827e('0x44')]=function(_0x512592,_0x2390b7){return db[_0x827e('0x3b')]['find']({'where':{'id':_0x512592[_0x827e('0x40')]['id']}})['then'](handleEntityNotFound(_0x2390b7,null))['then'](removeEntity(_0x2390b7,null))[_0x827e('0x3f')](handleError(_0x2390b7,null));};exports[_0x827e('0x45')]=function(_0x2aa8ac,_0x5c2198){return db['SquareReport'][_0x827e('0x45')]()[_0x827e('0x23')](respondWithResult(_0x5c2198,null))[_0x827e('0x3f')](handleError(_0x5c2198,null));}; \ No newline at end of file +var _0x08b8=['destroy','describe','eml-format','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','sendStatus','status','json','offset','undefined','count','limit','Content-Range','reject','then','end','name','send','index','map','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','filter','type','merge','options','SquareReport','includeAll','include','findAll','rows','catch','params','rawAttributes','find','create','body','update'];(function(_0x507bde,_0x180aef){var _0x4159a1=function(_0x4c3f79){while(--_0x4c3f79){_0x507bde['push'](_0x507bde['shift']());}};_0x4159a1(++_0x180aef);}(_0x08b8,0x11a));var _0x808b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x08b8[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x808b('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x808b('0x1'));var moment=require(_0x808b('0x2'));var BPromise=require(_0x808b('0x3'));var Mustache=require(_0x808b('0x4'));var util=require(_0x808b('0x5'));var path=require(_0x808b('0x6'));var sox=require(_0x808b('0x7'));var csv=require(_0x808b('0x8'));var ejs=require(_0x808b('0x9'));var fs=require('fs');var fs_extra=require(_0x808b('0xa'));var _=require('lodash');var squel=require(_0x808b('0xb'));var crypto=require('crypto');var jsforce=require(_0x808b('0xc'));var deskjs=require(_0x808b('0xd'));var toCsv=require('to-csv');var querystring=require(_0x808b('0xe'));var Papa=require(_0x808b('0xf'));var Redis=require(_0x808b('0x10'));var authService=require(_0x808b('0x11'));var qs=require(_0x808b('0x12'));var as=require(_0x808b('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x808b('0x14'))(_0x808b('0x15'));var utils=require('../../config/utils');var config=require(_0x808b('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x58d132,_0x3753c7){_0x3753c7=_0x3753c7||0xcc;return function(_0x54413d){if(_0x54413d){return _0x58d132[_0x808b('0x17')](_0x3753c7);}return _0x58d132[_0x808b('0x18')](_0x3753c7)['end']();};}function respondWithResult(_0x2ae040,_0x5d5307){_0x5d5307=_0x5d5307||0xc8;return function(_0x591a29){if(_0x591a29){return _0x2ae040[_0x808b('0x18')](_0x5d5307)[_0x808b('0x19')](_0x591a29);}};}function respondWithFilteredResult(_0x53c94f,_0x146203){return function(_0xce2647){if(_0xce2647){var _0x3baa18=typeof _0x146203[_0x808b('0x1a')]===_0x808b('0x1b')&&typeof _0x146203['limit']===_0x808b('0x1b');var _0x1483e8=_0xce2647['count'];var _0x4bc374=_0x3baa18?0x0:_0x146203['offset'];var _0x179087=_0x3baa18?_0xce2647[_0x808b('0x1c')]:_0x146203[_0x808b('0x1a')]+_0x146203[_0x808b('0x1d')];var _0x16e6c2;if(_0x179087>=_0x1483e8){_0x179087=_0x1483e8;_0x16e6c2=0xc8;}else{_0x16e6c2=0xce;}_0x53c94f[_0x808b('0x18')](_0x16e6c2);return _0x53c94f['set'](_0x808b('0x1e'),_0x4bc374+'-'+_0x179087+'/'+_0x1483e8)[_0x808b('0x19')](_0xce2647);}return null;};}function patchUpdates(_0x347880){return function(_0x27c0e9){try{jsonpatch['apply'](_0x27c0e9,_0x347880,!![]);}catch(_0x138b26){return BPromise[_0x808b('0x1f')](_0x138b26);}return _0x27c0e9['save']();};}function saveUpdates(_0x531439,_0x16a5e1){return function(_0x760ec){if(_0x760ec){return _0x760ec['update'](_0x531439)[_0x808b('0x20')](function(_0x50ff5a){return _0x50ff5a;});}return null;};}function removeEntity(_0x23f0b5,_0x7a1feb){return function(_0x2ea30e){if(_0x2ea30e){return _0x2ea30e['destroy']()[_0x808b('0x20')](function(){_0x23f0b5[_0x808b('0x18')](0xcc)[_0x808b('0x21')]();});}};}function handleEntityNotFound(_0x504c99,_0x1ad9a2){return function(_0x43009a){if(!_0x43009a){_0x504c99[_0x808b('0x17')](0x194);}return _0x43009a;};}function handleError(_0x3df439,_0xcecd19){_0xcecd19=_0xcecd19||0x1f4;return function(_0x2cdd7a){logger['error'](_0x2cdd7a['stack']);if(_0x2cdd7a[_0x808b('0x22')]){delete _0x2cdd7a[_0x808b('0x22')];}_0x3df439[_0x808b('0x18')](_0xcecd19)[_0x808b('0x23')](_0x2cdd7a);};}exports[_0x808b('0x24')]=function(_0xabc6c8,_0x5a9664){var _0x1d0a28={},_0xcb969d={},_0x204971={'count':0x0,'rows':[]};var _0x2e0167=_[_0x808b('0x25')](db['SquareReport']['rawAttributes'],function(_0x258276){return{'name':_0x258276[_0x808b('0x26')],'type':_0x258276['type'][_0x808b('0x27')]};});_0xcb969d[_0x808b('0x28')]=_['map'](_0x2e0167,_0x808b('0x22'));_0xcb969d[_0x808b('0x29')]=_[_0x808b('0x2a')](_0xabc6c8[_0x808b('0x29')]);_0xcb969d[_0x808b('0x2b')]=_[_0x808b('0x2c')](_0xcb969d[_0x808b('0x28')],_0xcb969d[_0x808b('0x29')]);_0x1d0a28[_0x808b('0x2d')]=_['intersection'](_0xcb969d[_0x808b('0x28')],qs[_0x808b('0x2e')](_0xabc6c8[_0x808b('0x29')][_0x808b('0x2e')]));_0x1d0a28[_0x808b('0x2d')]=_0x1d0a28[_0x808b('0x2d')][_0x808b('0x2f')]?_0x1d0a28[_0x808b('0x2d')]:_0xcb969d[_0x808b('0x28')];if(!_0xabc6c8[_0x808b('0x29')][_0x808b('0x30')](_0x808b('0x31'))){_0x1d0a28['limit']=qs[_0x808b('0x1d')](_0xabc6c8[_0x808b('0x29')][_0x808b('0x1d')]);_0x1d0a28['offset']=qs[_0x808b('0x1a')](_0xabc6c8['query'][_0x808b('0x1a')]);}_0x1d0a28[_0x808b('0x32')]=qs['sort'](_0xabc6c8[_0x808b('0x29')]['sort']);_0x1d0a28[_0x808b('0x33')]=qs[_0x808b('0x2b')](_['pick'](_0xabc6c8['query'],_0xcb969d['filters']),_0x2e0167);if(_0xabc6c8[_0x808b('0x29')][_0x808b('0x34')]){_0x1d0a28[_0x808b('0x33')]=_['merge'](_0x1d0a28[_0x808b('0x33')],{'$or':_[_0x808b('0x25')](_0x2e0167,function(_0x4d055c){if(_0x4d055c[_0x808b('0x35')]!=='VIRTUAL'){var _0x4c8f49={};_0x4c8f49[_0x4d055c[_0x808b('0x22')]]={'$like':'%'+_0xabc6c8[_0x808b('0x29')]['filter']+'%'};return _0x4c8f49;}})});}_0x1d0a28=_[_0x808b('0x36')]({},_0x1d0a28,_0xabc6c8[_0x808b('0x37')]);var _0x38d4e3={'where':_0x1d0a28[_0x808b('0x33')]};return db[_0x808b('0x38')][_0x808b('0x1c')](_0x38d4e3)[_0x808b('0x20')](function(_0x2157a6){_0x204971[_0x808b('0x1c')]=_0x2157a6;if(_0xabc6c8[_0x808b('0x29')][_0x808b('0x39')]){_0x1d0a28[_0x808b('0x3a')]=[{'all':!![]}];}return db[_0x808b('0x38')][_0x808b('0x3b')](_0x1d0a28);})[_0x808b('0x20')](function(_0xf4e50e){_0x204971[_0x808b('0x3c')]=_0xf4e50e;return _0x204971;})['then'](respondWithFilteredResult(_0x5a9664,_0x1d0a28))[_0x808b('0x3d')](handleError(_0x5a9664,null));};exports['show']=function(_0x2b444,_0x53a983){var _0x315083={'raw':!![],'where':{'id':_0x2b444[_0x808b('0x3e')]['id']}},_0x32dcaa={};_0x32dcaa[_0x808b('0x28')]=_[_0x808b('0x2a')](db[_0x808b('0x38')][_0x808b('0x3f')]);_0x32dcaa[_0x808b('0x29')]=_[_0x808b('0x2a')](_0x2b444['query']);_0x32dcaa[_0x808b('0x2b')]=_[_0x808b('0x2c')](_0x32dcaa[_0x808b('0x28')],_0x32dcaa[_0x808b('0x29')]);_0x315083['attributes']=_[_0x808b('0x2c')](_0x32dcaa['model'],qs['fields'](_0x2b444['query'][_0x808b('0x2e')]));_0x315083[_0x808b('0x2d')]=_0x315083[_0x808b('0x2d')][_0x808b('0x2f')]?_0x315083[_0x808b('0x2d')]:_0x32dcaa[_0x808b('0x28')];if(_0x2b444[_0x808b('0x29')][_0x808b('0x39')]){_0x315083[_0x808b('0x3a')]=[{'all':!![]}];}_0x315083=_[_0x808b('0x36')]({},_0x315083,_0x2b444[_0x808b('0x37')]);return db[_0x808b('0x38')][_0x808b('0x40')](_0x315083)['then'](handleEntityNotFound(_0x53a983,null))['then'](respondWithResult(_0x53a983,null))[_0x808b('0x3d')](handleError(_0x53a983,null));};exports[_0x808b('0x41')]=function(_0xc9338a,_0x29682b){return db[_0x808b('0x38')][_0x808b('0x41')](_0xc9338a[_0x808b('0x42')],{})[_0x808b('0x20')](respondWithResult(_0x29682b,0xc9))['catch'](handleError(_0x29682b,null));};exports[_0x808b('0x43')]=function(_0x2bd4d1,_0x5077f4){if(_0x2bd4d1[_0x808b('0x42')]['id']){delete _0x2bd4d1[_0x808b('0x42')]['id'];}return db[_0x808b('0x38')][_0x808b('0x40')]({'where':{'id':_0x2bd4d1['params']['id']}})[_0x808b('0x20')](handleEntityNotFound(_0x5077f4,null))[_0x808b('0x20')](saveUpdates(_0x2bd4d1['body'],null))[_0x808b('0x20')](respondWithResult(_0x5077f4,null))[_0x808b('0x3d')](handleError(_0x5077f4,null));};exports[_0x808b('0x44')]=function(_0x5b4266,_0x38f4d5){return db[_0x808b('0x38')][_0x808b('0x40')]({'where':{'id':_0x5b4266['params']['id']}})['then'](handleEntityNotFound(_0x38f4d5,null))[_0x808b('0x20')](removeEntity(_0x38f4d5,null))['catch'](handleError(_0x38f4d5,null));};exports[_0x808b('0x45')]=function(_0x531a04,_0x506a41){return db[_0x808b('0x38')][_0x808b('0x45')]()[_0x808b('0x20')](respondWithResult(_0x506a41,null))[_0x808b('0x3d')](handleError(_0x506a41,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 1742514..6fcd626 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 _0x2f8a=['leaveAt','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareReport.attributes','exports','SquareReport','report_square'];(function(_0x5c3c09,_0x2fab6f){var _0x407546=function(_0x551f70){while(--_0x551f70){_0x5c3c09['push'](_0x5c3c09['shift']());}};_0x407546(++_0x2fab6f);}(_0x2f8a,0x1c1));var _0xa2f8=function(_0x41dc93,_0x463aff){_0x41dc93=_0x41dc93-0x0;var _0x186a6b=_0x2f8a[_0x41dc93];return _0x186a6b;};'use strict';var _=require('lodash');var util=require(_0xa2f8('0x0'));var logger=require(_0xa2f8('0x1'))(_0xa2f8('0x2'));var moment=require(_0xa2f8('0x3'));var BPromise=require(_0xa2f8('0x4'));var rp=require(_0xa2f8('0x5'));var fs=require('fs');var path=require(_0xa2f8('0x6'));var rimraf=require(_0xa2f8('0x7'));var config=require(_0xa2f8('0x8'));var attributes=require(_0xa2f8('0x9'));module[_0xa2f8('0xa')]=function(_0x1bb8c1,_0xbb83b2){return _0x1bb8c1['define'](_0xa2f8('0xb'),attributes,{'tableName':_0xa2f8('0xc'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':['uniqueid','project_name']},{'name':'leaveAt','fields':[_0xa2f8('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0fe6=['exports','define','uid_pname','uniqueid','leaveAt','lodash','util','../../config/logger','api','path','rimraf','./squareReport.attributes'];(function(_0xaba3e1,_0x311f68){var _0x290ab2=function(_0x12604a){while(--_0x12604a){_0xaba3e1['push'](_0xaba3e1['shift']());}};_0x290ab2(++_0x311f68);}(_0x0fe6,0x131));var _0x60fe=function(_0x2a997f,_0x4d280e){_0x2a997f=_0x2a997f-0x0;var _0x5a1015=_0x0fe6[_0x2a997f];return _0x5a1015;};'use strict';var _=require(_0x60fe('0x0'));var util=require(_0x60fe('0x1'));var logger=require(_0x60fe('0x2'))(_0x60fe('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x60fe('0x4'));var rimraf=require(_0x60fe('0x5'));var config=require('../../config/environment');var attributes=require(_0x60fe('0x6'));module[_0x60fe('0x7')]=function(_0x58c970,_0x3c592c){return _0x58c970[_0x60fe('0x8')]('SquareReport',attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':_0x60fe('0x9'),'fields':[_0x60fe('0xa'),'project_name']},{'name':_0x60fe('0xb'),'fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index e5abc0b..507652e 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 _0x66f0=['UpdateSquareReport','SquareReport','attributes','limit','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','CreateSquareReport','body','options','raw'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x66f0,0x1a8));var _0x066f=function(_0x19f5fc,_0x4c658a){_0x19f5fc=_0x19f5fc-0x0;var _0x315fa3=_0x66f0[_0x19f5fc];return _0x315fa3;};'use strict';var _=require(_0x066f('0x0'));var util=require(_0x066f('0x1'));var moment=require(_0x066f('0x2'));var BPromise=require('bluebird');var rs=require(_0x066f('0x3'));var fs=require('fs');var Redis=require(_0x066f('0x4'));var db=require(_0x066f('0x5'))['db'];var utils=require(_0x066f('0x6'));var logger=require(_0x066f('0x7'))(_0x066f('0x8'));var config=require('../../config/environment');var jayson=require(_0x066f('0x9'));var client=jayson[_0x066f('0xa')][_0x066f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x41a9a2,_0x1bd123,_0x3c7687){return new BPromise(function(_0x5dc547,_0x389492){return client[_0x066f('0xc')](_0x41a9a2,_0x3c7687)['then'](function(_0x233ff0){logger['info'](_0x066f('0xd'),_0x1bd123,_0x066f('0xe'));logger[_0x066f('0xf')](_0x066f('0x10'),_0x1bd123,_0x066f('0xe'),JSON[_0x066f('0x11')](_0x233ff0));if(_0x233ff0[_0x066f('0x12')]){if(_0x233ff0['error']['code']===0x1f4){logger[_0x066f('0x12')](_0x066f('0xd'),_0x1bd123,_0x233ff0[_0x066f('0x12')][_0x066f('0x13')]);return _0x389492(_0x233ff0[_0x066f('0x12')][_0x066f('0x13')]);}logger[_0x066f('0x12')](_0x066f('0xd'),_0x1bd123,_0x233ff0[_0x066f('0x12')][_0x066f('0x13')]);return _0x5dc547(_0x233ff0[_0x066f('0x12')][_0x066f('0x13')]);}else{logger[_0x066f('0x14')]('SquareReport,\x20%s,\x20%s',_0x1bd123,'request\x20sent');_0x5dc547(_0x233ff0['result']['message']);}})[_0x066f('0x15')](function(_0x1a0fd7){logger['error'](_0x066f('0xd'),_0x1bd123,_0x1a0fd7);_0x389492(_0x1a0fd7);});});}exports[_0x066f('0x16')]=function(_0x36fb2d){var _0x8f2ba1=this;return new Promise(function(_0x14377a,_0x9aa388){return db['SquareReport']['create'](_0x36fb2d[_0x066f('0x17')],{'raw':_0x36fb2d[_0x066f('0x18')]?_0x36fb2d[_0x066f('0x18')][_0x066f('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x2d7bd3){logger[_0x066f('0x14')](_0x066f('0x16'),_0x36fb2d);logger['debug'](_0x066f('0x16'),_0x36fb2d,JSON[_0x066f('0x11')](_0x2d7bd3));_0x14377a(_0x2d7bd3);})[_0x066f('0x15')](function(_0x2cdc81){logger['error'](_0x066f('0x16'),_0x2cdc81[_0x066f('0x13')],_0x36fb2d);_0x9aa388(_0x8f2ba1[_0x066f('0x12')](0x1f4,_0x2cdc81[_0x066f('0x13')]));});});};exports[_0x066f('0x1a')]=function(_0x5b91f5){var _0x27347b=this;return new Promise(function(_0x241d1c,_0x59c8b3){return db[_0x066f('0x1b')]['update'](_0x5b91f5[_0x066f('0x17')],{'raw':_0x5b91f5[_0x066f('0x18')]?_0x5b91f5[_0x066f('0x18')][_0x066f('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5b91f5['options']?_0x5b91f5[_0x066f('0x18')]['where']||null:null,'attributes':_0x5b91f5[_0x066f('0x18')]?_0x5b91f5[_0x066f('0x18')][_0x066f('0x1c')]||null:null,'limit':_0x5b91f5[_0x066f('0x18')]?_0x5b91f5[_0x066f('0x18')][_0x066f('0x1d')]||null:null})['then'](function(_0x2a6ac7){logger[_0x066f('0x14')]('UpdateSquareReport',_0x5b91f5);logger[_0x066f('0xf')]('UpdateSquareReport',_0x5b91f5,JSON[_0x066f('0x11')](_0x2a6ac7));_0x241d1c(_0x2a6ac7);})[_0x066f('0x15')](function(_0x335b86){logger[_0x066f('0x12')](_0x066f('0x1a'),_0x335b86[_0x066f('0x13')],_0x5b91f5);_0x59c8b3(_0x27347b[_0x066f('0x12')](0x1f4,_0x335b86[_0x066f('0x13')]));});});}; \ No newline at end of file +var _0x792b=['catch','SquareReport','create','body','options','raw','CreateSquareReport','UpdateSquareReport','update','attributes','limit','stringify','lodash','util','moment','bluebird','../../config/utils','../../config/logger','rpc','client','request','then','info','SquareReport,\x20%s,\x20%s','debug','request\x20sent','error','message','result'];(function(_0x263e77,_0x4a8748){var _0xe3910a=function(_0x3b248e){while(--_0x3b248e){_0x263e77['push'](_0x263e77['shift']());}};_0xe3910a(++_0x4a8748);}(_0x792b,0x1a2));var _0xb792=function(_0xbc25e1,_0x27007d){_0xbc25e1=_0xbc25e1-0x0;var _0xaf0a85=_0x792b[_0xbc25e1];return _0xaf0a85;};'use strict';var _=require(_0xb792('0x0'));var util=require(_0xb792('0x1'));var moment=require(_0xb792('0x2'));var BPromise=require(_0xb792('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb792('0x4'));var logger=require(_0xb792('0x5'))(_0xb792('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb792('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e30b5,_0x3a6c83,_0x596684){return new BPromise(function(_0x13f13f,_0x20fbdc){return client[_0xb792('0x8')](_0x4e30b5,_0x596684)[_0xb792('0x9')](function(_0xc6bb6d){logger[_0xb792('0xa')](_0xb792('0xb'),_0x3a6c83,'request\x20sent');logger[_0xb792('0xc')]('SquareReport,\x20%s,\x20%s,\x20%s',_0x3a6c83,_0xb792('0xd'),JSON['stringify'](_0xc6bb6d));if(_0xc6bb6d[_0xb792('0xe')]){if(_0xc6bb6d['error']['code']===0x1f4){logger[_0xb792('0xe')](_0xb792('0xb'),_0x3a6c83,_0xc6bb6d['error'][_0xb792('0xf')]);return _0x20fbdc(_0xc6bb6d[_0xb792('0xe')][_0xb792('0xf')]);}logger[_0xb792('0xe')](_0xb792('0xb'),_0x3a6c83,_0xc6bb6d[_0xb792('0xe')][_0xb792('0xf')]);return _0x13f13f(_0xc6bb6d[_0xb792('0xe')]['message']);}else{logger[_0xb792('0xa')](_0xb792('0xb'),_0x3a6c83,_0xb792('0xd'));_0x13f13f(_0xc6bb6d[_0xb792('0x10')][_0xb792('0xf')]);}})[_0xb792('0x11')](function(_0x2952c1){logger[_0xb792('0xe')](_0xb792('0xb'),_0x3a6c83,_0x2952c1);_0x20fbdc(_0x2952c1);});});}exports['CreateSquareReport']=function(_0x32677a){var _0x407bc8=this;return new Promise(function(_0x27b8f2,_0x498b0e){return db[_0xb792('0x12')][_0xb792('0x13')](_0x32677a[_0xb792('0x14')],{'raw':_0x32677a[_0xb792('0x15')]?_0x32677a[_0xb792('0x15')][_0xb792('0x16')]===undefined?!![]:![]:!![]})[_0xb792('0x9')](function(_0x11b26d){logger[_0xb792('0xa')](_0xb792('0x17'),_0x32677a);logger['debug'](_0xb792('0x17'),_0x32677a,JSON['stringify'](_0x11b26d));_0x27b8f2(_0x11b26d);})[_0xb792('0x11')](function(_0x37408f){logger[_0xb792('0xe')](_0xb792('0x17'),_0x37408f[_0xb792('0xf')],_0x32677a);_0x498b0e(_0x407bc8[_0xb792('0xe')](0x1f4,_0x37408f[_0xb792('0xf')]));});});};exports[_0xb792('0x18')]=function(_0x317944){var _0x483359=this;return new Promise(function(_0x25730e,_0x3044b6){return db[_0xb792('0x12')][_0xb792('0x19')](_0x317944[_0xb792('0x14')],{'raw':_0x317944[_0xb792('0x15')]?_0x317944[_0xb792('0x15')][_0xb792('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x317944[_0xb792('0x15')]?_0x317944[_0xb792('0x15')]['where']||null:null,'attributes':_0x317944[_0xb792('0x15')]?_0x317944[_0xb792('0x15')][_0xb792('0x1a')]||null:null,'limit':_0x317944[_0xb792('0x15')]?_0x317944[_0xb792('0x15')][_0xb792('0x1b')]||null:null})[_0xb792('0x9')](function(_0x189bfb){logger[_0xb792('0xa')]('UpdateSquareReport',_0x317944);logger[_0xb792('0xc')]('UpdateSquareReport',_0x317944,JSON[_0xb792('0x1c')](_0x189bfb));_0x25730e(_0x189bfb);})[_0xb792('0x11')](function(_0x58e4b5){logger[_0xb792('0xe')](_0xb792('0x18'),_0x58e4b5[_0xb792('0xf')],_0x317944);_0x3044b6(_0x483359[_0xb792('0xe')](0x1f4,_0x58e4b5['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index b789bf2..d40dbc6 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 _0x3d4d=['/:id','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','/describe','describe','show','post','put'];(function(_0xda6ad1,_0x5f09e3){var _0xedc3a5=function(_0x5459d7){while(--_0x5459d7){_0xda6ad1['push'](_0xda6ad1['shift']());}};_0xedc3a5(++_0x5f09e3);}(_0x3d4d,0x121));var _0xd3d4=function(_0x4df69e,_0x5131d5){_0x4df69e=_0x4df69e-0x0;var _0x1f9041=_0x3d4d[_0x4df69e];return _0x1f9041;};'use strict';var multer=require(_0xd3d4('0x0'));var util=require(_0xd3d4('0x1'));var path=require(_0xd3d4('0x2'));var timeout=require(_0xd3d4('0x3'));var express=require(_0xd3d4('0x4'));var router=express[_0xd3d4('0x5')]();var fs_extra=require(_0xd3d4('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xd3d4('0x7'));var config=require('../../config/environment');var controller=require('./squareReportDetail.controller');router[_0xd3d4('0x8')]('/',auth[_0xd3d4('0x9')](),controller['index']);router[_0xd3d4('0x8')](_0xd3d4('0xa'),auth[_0xd3d4('0x9')](),controller[_0xd3d4('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xd3d4('0xc')]);router[_0xd3d4('0xd')]('/',auth[_0xd3d4('0x9')](),controller['create']);router[_0xd3d4('0xe')](_0xd3d4('0xf'),auth[_0xd3d4('0x9')](),controller[_0xd3d4('0x10')]);router[_0xd3d4('0x11')](_0xd3d4('0xf'),auth['isAuthenticated'](),controller[_0xd3d4('0x12')]);module['exports']=router; \ No newline at end of file +var _0x437f=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','/describe','/:id','show','post','create','put','delete'];(function(_0x2cde0a,_0x1f9695){var _0x260610=function(_0x179089){while(--_0x179089){_0x2cde0a['push'](_0x2cde0a['shift']());}};_0x260610(++_0x1f9695);}(_0x437f,0xc0));var _0xf437=function(_0x425ea3,_0x26b830){_0x425ea3=_0x425ea3-0x0;var _0x54f159=_0x437f[_0x425ea3];return _0x54f159;};'use strict';var multer=require(_0xf437('0x0'));var util=require(_0xf437('0x1'));var path=require(_0xf437('0x2'));var timeout=require(_0xf437('0x3'));var express=require(_0xf437('0x4'));var router=express[_0xf437('0x5')]();var fs_extra=require(_0xf437('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xf437('0x7'));var config=require('../../config/environment');var controller=require('./squareReportDetail.controller');router[_0xf437('0x8')]('/',auth[_0xf437('0x9')](),controller['index']);router[_0xf437('0x8')](_0xf437('0xa'),auth[_0xf437('0x9')](),controller['describe']);router[_0xf437('0x8')](_0xf437('0xb'),auth[_0xf437('0x9')](),controller[_0xf437('0xc')]);router[_0xf437('0xd')]('/',auth[_0xf437('0x9')](),controller[_0xf437('0xe')]);router[_0xf437('0xf')](_0xf437('0xb'),auth[_0xf437('0x9')](),controller['update']);router[_0xf437('0x10')](_0xf437('0xb'),auth[_0xf437('0x9')](),controller[_0xf437('0x11')]);module[_0xf437('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index eb59216..93825c7 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 _0x1603=['STRING','TEXT','sequelize','exports'];(function(_0x429de1,_0x5f3c6d){var _0xb1bea5=function(_0x21fd02){while(--_0x21fd02){_0x429de1['push'](_0x429de1['shift']());}};_0xb1bea5(++_0x5f3c6d);}(_0x1603,0x96));var _0x3160=function(_0x592c31,_0x528da9){_0x592c31=_0x592c31-0x0;var _0x44690b=_0x1603[_0x592c31];return _0x44690b;};'use strict';var Sequelize=require(_0x3160('0x0'));module[_0x3160('0x1')]={'uniqueid':{'type':Sequelize[_0x3160('0x2')]},'node':{'type':Sequelize[_0x3160('0x2')]},'application':{'type':Sequelize[_0x3160('0x2')]},'data':{'type':Sequelize[_0x3160('0x3')]},'project_name':{'type':Sequelize[_0x3160('0x2')]},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x51cf=['TEXT','sequelize','exports','STRING'];(function(_0x62396d,_0x1ad1ba){var _0x49db3e=function(_0x4ef041){while(--_0x4ef041){_0x62396d['push'](_0x62396d['shift']());}};_0x49db3e(++_0x1ad1ba);}(_0x51cf,0x131));var _0xf51c=function(_0x4e00b6,_0x332bba){_0x4e00b6=_0x4e00b6-0x0;var _0x14f2ab=_0x51cf[_0x4e00b6];return _0x14f2ab;};'use strict';var Sequelize=require(_0xf51c('0x0'));module[_0xf51c('0x1')]={'uniqueid':{'type':Sequelize[_0xf51c('0x2')]},'node':{'type':Sequelize[_0xf51c('0x2')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0xf51c('0x3')]},'project_name':{'type':Sequelize[_0xf51c('0x2')]},'callerid':{'type':Sequelize[_0xf51c('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 148e169..b669ec0 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 _0x5421=['sort','pick','filter','where','merge','type','VIRTUAL','includeAll','include','findAll','rows','show','params','options','find','create','catch','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','crypto','jsforce','desk.js','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','update','destroy','then','error','stack','name','send','index','SquareDetailsReport','rawAttributes','fieldName','key','model','map','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order'];(function(_0x5523ab,_0x331ff7){var _0x2eed31=function(_0x3f0217){while(--_0x3f0217){_0x5523ab['push'](_0x5523ab['shift']());}};_0x2eed31(++_0x331ff7);}(_0x5421,0x1cf));var _0x1542=function(_0x1bc6af,_0x4fbcc4){_0x1bc6af=_0x1bc6af-0x0;var _0x35e765=_0x5421[_0x1bc6af];return _0x35e765;};'use strict';var emlformat=require(_0x1542('0x0'));var rimraf=require(_0x1542('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1542('0x2'));var rp=require(_0x1542('0x3'));var moment=require(_0x1542('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1542('0x5'));var util=require(_0x1542('0x6'));var path=require('path');var sox=require(_0x1542('0x7'));var csv=require(_0x1542('0x8'));var ejs=require(_0x1542('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x1542('0xa'));var jsforce=require(_0x1542('0xb'));var deskjs=require(_0x1542('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1542('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x1542('0xe'))(_0x1542('0xf'));var utils=require(_0x1542('0x10'));var config=require(_0x1542('0x11'));var licenseUtil=require(_0x1542('0x12'));var db=require(_0x1542('0x13'))['db'];function respondWithStatusCode(_0x497931,_0x4d5314){_0x4d5314=_0x4d5314||0xcc;return function(_0x34cf23){if(_0x34cf23){return _0x497931[_0x1542('0x14')](_0x4d5314);}return _0x497931['status'](_0x4d5314)[_0x1542('0x15')]();};}function respondWithResult(_0x1c891b,_0x5b5713){_0x5b5713=_0x5b5713||0xc8;return function(_0x3da223){if(_0x3da223){return _0x1c891b[_0x1542('0x16')](_0x5b5713)[_0x1542('0x17')](_0x3da223);}};}function respondWithFilteredResult(_0x2ca432,_0x54faac){return function(_0x219309){if(_0x219309){var _0x4793d9=typeof _0x54faac['offset']===_0x1542('0x18')&&typeof _0x54faac[_0x1542('0x19')]==='undefined';var _0x4b7c0d=_0x219309[_0x1542('0x1a')];var _0x564885=_0x4793d9?0x0:_0x54faac[_0x1542('0x1b')];var _0x4d8a7a=_0x4793d9?_0x219309[_0x1542('0x1a')]:_0x54faac[_0x1542('0x1b')]+_0x54faac[_0x1542('0x19')];var _0x178852;if(_0x4d8a7a>=_0x4b7c0d){_0x4d8a7a=_0x4b7c0d;_0x178852=0xc8;}else{_0x178852=0xce;}_0x2ca432[_0x1542('0x16')](_0x178852);return _0x2ca432[_0x1542('0x1c')](_0x1542('0x1d'),_0x564885+'-'+_0x4d8a7a+'/'+_0x4b7c0d)[_0x1542('0x17')](_0x219309);}return null;};}function patchUpdates(_0x59eda2){return function(_0x9af9e7){try{jsonpatch[_0x1542('0x1e')](_0x9af9e7,_0x59eda2,!![]);}catch(_0x5a4a23){return BPromise['reject'](_0x5a4a23);}return _0x9af9e7['save']();};}function saveUpdates(_0x5b32ec,_0x4ef277){return function(_0x51cde3){if(_0x51cde3){return _0x51cde3[_0x1542('0x1f')](_0x5b32ec)['then'](function(_0x5e5b24){return _0x5e5b24;});}return null;};}function removeEntity(_0x5e181d,_0x2c429e){return function(_0xf7048a){if(_0xf7048a){return _0xf7048a[_0x1542('0x20')]()[_0x1542('0x21')](function(){_0x5e181d[_0x1542('0x16')](0xcc)[_0x1542('0x15')]();});}};}function handleEntityNotFound(_0x4a2040,_0x374e1f){return function(_0x4679fc){if(!_0x4679fc){_0x4a2040['sendStatus'](0x194);}return _0x4679fc;};}function handleError(_0x1ed642,_0x4fd797){_0x4fd797=_0x4fd797||0x1f4;return function(_0x38559e){logger[_0x1542('0x22')](_0x38559e[_0x1542('0x23')]);if(_0x38559e[_0x1542('0x24')]){delete _0x38559e[_0x1542('0x24')];}_0x1ed642[_0x1542('0x16')](_0x4fd797)[_0x1542('0x25')](_0x38559e);};}exports[_0x1542('0x26')]=function(_0x41a041,_0x5a711a){var _0x2dfa18={},_0x11e632={},_0x54a64d={'count':0x0,'rows':[]};var _0x4eb3d5=_['map'](db[_0x1542('0x27')][_0x1542('0x28')],function(_0x418da){return{'name':_0x418da[_0x1542('0x29')],'type':_0x418da['type'][_0x1542('0x2a')]};});_0x11e632[_0x1542('0x2b')]=_[_0x1542('0x2c')](_0x4eb3d5,_0x1542('0x24'));_0x11e632['query']=_[_0x1542('0x2d')](_0x41a041[_0x1542('0x2e')]);_0x11e632[_0x1542('0x2f')]=_['intersection'](_0x11e632['model'],_0x11e632['query']);_0x2dfa18[_0x1542('0x30')]=_[_0x1542('0x31')](_0x11e632['model'],qs[_0x1542('0x32')](_0x41a041[_0x1542('0x2e')]['fields']));_0x2dfa18[_0x1542('0x30')]=_0x2dfa18[_0x1542('0x30')][_0x1542('0x33')]?_0x2dfa18[_0x1542('0x30')]:_0x11e632['model'];if(!_0x41a041[_0x1542('0x2e')][_0x1542('0x34')](_0x1542('0x35'))){_0x2dfa18['limit']=qs['limit'](_0x41a041[_0x1542('0x2e')][_0x1542('0x19')]);_0x2dfa18[_0x1542('0x1b')]=qs[_0x1542('0x1b')](_0x41a041[_0x1542('0x2e')][_0x1542('0x1b')]);}_0x2dfa18[_0x1542('0x36')]=qs[_0x1542('0x37')](_0x41a041[_0x1542('0x2e')][_0x1542('0x37')]);_0x2dfa18['where']=qs[_0x1542('0x2f')](_[_0x1542('0x38')](_0x41a041['query'],_0x11e632[_0x1542('0x2f')]),_0x4eb3d5);if(_0x41a041[_0x1542('0x2e')][_0x1542('0x39')]){_0x2dfa18[_0x1542('0x3a')]=_[_0x1542('0x3b')](_0x2dfa18[_0x1542('0x3a')],{'$or':_['map'](_0x4eb3d5,function(_0x1f14d0){if(_0x1f14d0[_0x1542('0x3c')]!==_0x1542('0x3d')){var _0x2a627a={};_0x2a627a[_0x1f14d0[_0x1542('0x24')]]={'$like':'%'+_0x41a041[_0x1542('0x2e')][_0x1542('0x39')]+'%'};return _0x2a627a;}})});}_0x2dfa18=_[_0x1542('0x3b')]({},_0x2dfa18,_0x41a041['options']);var _0xa0051b={'where':_0x2dfa18['where']};return db['SquareDetailsReport'][_0x1542('0x1a')](_0xa0051b)[_0x1542('0x21')](function(_0x411119){_0x54a64d[_0x1542('0x1a')]=_0x411119;if(_0x41a041[_0x1542('0x2e')][_0x1542('0x3e')]){_0x2dfa18[_0x1542('0x3f')]=[{'all':!![]}];}return db['SquareDetailsReport'][_0x1542('0x40')](_0x2dfa18);})[_0x1542('0x21')](function(_0x3db0a6){_0x54a64d[_0x1542('0x41')]=_0x3db0a6;return _0x54a64d;})['then'](respondWithFilteredResult(_0x5a711a,_0x2dfa18))['catch'](handleError(_0x5a711a,null));};exports[_0x1542('0x42')]=function(_0x246dfe,_0x2f6fa3){var _0x9dce09={'raw':!![],'where':{'id':_0x246dfe[_0x1542('0x43')]['id']}},_0x5bfe93={};_0x5bfe93[_0x1542('0x2b')]=_[_0x1542('0x2d')](db[_0x1542('0x27')]['rawAttributes']);_0x5bfe93['query']=_['keys'](_0x246dfe['query']);_0x5bfe93[_0x1542('0x2f')]=_['intersection'](_0x5bfe93[_0x1542('0x2b')],_0x5bfe93['query']);_0x9dce09[_0x1542('0x30')]=_[_0x1542('0x31')](_0x5bfe93['model'],qs[_0x1542('0x32')](_0x246dfe[_0x1542('0x2e')][_0x1542('0x32')]));_0x9dce09[_0x1542('0x30')]=_0x9dce09[_0x1542('0x30')][_0x1542('0x33')]?_0x9dce09[_0x1542('0x30')]:_0x5bfe93['model'];if(_0x246dfe[_0x1542('0x2e')]['includeAll']){_0x9dce09[_0x1542('0x3f')]=[{'all':!![]}];}_0x9dce09=_[_0x1542('0x3b')]({},_0x9dce09,_0x246dfe[_0x1542('0x44')]);return db[_0x1542('0x27')][_0x1542('0x45')](_0x9dce09)['then'](handleEntityNotFound(_0x2f6fa3,null))[_0x1542('0x21')](respondWithResult(_0x2f6fa3,null))['catch'](handleError(_0x2f6fa3,null));};exports[_0x1542('0x46')]=function(_0x36971e,_0x3aa7a9){return db[_0x1542('0x27')]['create'](_0x36971e['body'],{})['then'](respondWithResult(_0x3aa7a9,0xc9))[_0x1542('0x47')](handleError(_0x3aa7a9,null));};exports[_0x1542('0x1f')]=function(_0x143c00,_0x30966a){if(_0x143c00['body']['id']){delete _0x143c00[_0x1542('0x48')]['id'];}return db['SquareDetailsReport'][_0x1542('0x45')]({'where':{'id':_0x143c00[_0x1542('0x43')]['id']}})[_0x1542('0x21')](handleEntityNotFound(_0x30966a,null))[_0x1542('0x21')](saveUpdates(_0x143c00[_0x1542('0x48')],null))[_0x1542('0x21')](respondWithResult(_0x30966a,null))[_0x1542('0x47')](handleError(_0x30966a,null));};exports[_0x1542('0x20')]=function(_0x182c6d,_0xc0e18f){return db[_0x1542('0x27')][_0x1542('0x45')]({'where':{'id':_0x182c6d['params']['id']}})['then'](handleEntityNotFound(_0xc0e18f,null))['then'](removeEntity(_0xc0e18f,null))['catch'](handleError(_0xc0e18f,null));};exports['describe']=function(_0x3fab56,_0x1ba736){return db['SquareDetailsReport'][_0x1542('0x49')]()[_0x1542('0x21')](respondWithResult(_0x1ba736,null))['catch'](handleError(_0x1ba736,null));}; \ No newline at end of file +var _0xf6bb=['create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','end','error','stack','map','rawAttributes','fieldName','key','name','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','sort','filter','where','type','VIRTUAL','options','includeAll','include','SquareDetailsReport','findAll','rows','catch','show','length','find'];(function(_0x1ee9a1,_0x5f1434){var _0x21270f=function(_0x303251){while(--_0x303251){_0x1ee9a1['push'](_0x1ee9a1['shift']());}};_0x21270f(++_0x5f1434);}(_0xf6bb,0x9c));var _0xbf6b=function(_0x44c768,_0x552a5e){_0x44c768=_0x44c768-0x0;var _0x55daf5=_0xf6bb[_0x44c768];return _0x55daf5;};'use strict';var emlformat=require(_0xbf6b('0x0'));var rimraf=require(_0xbf6b('0x1'));var zipdir=require(_0xbf6b('0x2'));var jsonpatch=require(_0xbf6b('0x3'));var rp=require('request-promise');var moment=require(_0xbf6b('0x4'));var BPromise=require(_0xbf6b('0x5'));var Mustache=require('mustache');var util=require(_0xbf6b('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xbf6b('0x7'));var ejs=require(_0xbf6b('0x8'));var fs=require('fs');var fs_extra=require(_0xbf6b('0x9'));var _=require('lodash');var squel=require(_0xbf6b('0xa'));var crypto=require('crypto');var jsforce=require(_0xbf6b('0xb'));var deskjs=require(_0xbf6b('0xc'));var toCsv=require(_0xbf6b('0x7'));var querystring=require(_0xbf6b('0xd'));var Papa=require(_0xbf6b('0xe'));var Redis=require(_0xbf6b('0xf'));var authService=require(_0xbf6b('0x10'));var qs=require(_0xbf6b('0x11'));var as=require(_0xbf6b('0x12'));var hardwareService=require(_0xbf6b('0x13'));var logger=require(_0xbf6b('0x14'))(_0xbf6b('0x15'));var utils=require(_0xbf6b('0x16'));var config=require(_0xbf6b('0x17'));var licenseUtil=require(_0xbf6b('0x18'));var db=require(_0xbf6b('0x19'))['db'];function respondWithStatusCode(_0x731ae0,_0x23f76d){_0x23f76d=_0x23f76d||0xcc;return function(_0x33a5b8){if(_0x33a5b8){return _0x731ae0[_0xbf6b('0x1a')](_0x23f76d);}return _0x731ae0[_0xbf6b('0x1b')](_0x23f76d)['end']();};}function respondWithResult(_0x39c504,_0x2cb52c){_0x2cb52c=_0x2cb52c||0xc8;return function(_0x31bf62){if(_0x31bf62){return _0x39c504[_0xbf6b('0x1b')](_0x2cb52c)['json'](_0x31bf62);}};}function respondWithFilteredResult(_0xc69a46,_0x4979d7){return function(_0x572d06){if(_0x572d06){var _0x91d36a=typeof _0x4979d7[_0xbf6b('0x1c')]===_0xbf6b('0x1d')&&typeof _0x4979d7[_0xbf6b('0x1e')]===_0xbf6b('0x1d');var _0x16213c=_0x572d06[_0xbf6b('0x1f')];var _0x3aa4ea=_0x91d36a?0x0:_0x4979d7[_0xbf6b('0x1c')];var _0x4f2e8f=_0x91d36a?_0x572d06[_0xbf6b('0x1f')]:_0x4979d7[_0xbf6b('0x1c')]+_0x4979d7[_0xbf6b('0x1e')];var _0x2db8fe;if(_0x4f2e8f>=_0x16213c){_0x4f2e8f=_0x16213c;_0x2db8fe=0xc8;}else{_0x2db8fe=0xce;}_0xc69a46[_0xbf6b('0x1b')](_0x2db8fe);return _0xc69a46[_0xbf6b('0x20')](_0xbf6b('0x21'),_0x3aa4ea+'-'+_0x4f2e8f+'/'+_0x16213c)[_0xbf6b('0x22')](_0x572d06);}return null;};}function patchUpdates(_0x572468){return function(_0xdb87ee){try{jsonpatch[_0xbf6b('0x23')](_0xdb87ee,_0x572468,!![]);}catch(_0x135020){return BPromise[_0xbf6b('0x24')](_0x135020);}return _0xdb87ee[_0xbf6b('0x25')]();};}function saveUpdates(_0x471a1d,_0x272858){return function(_0xc744d){if(_0xc744d){return _0xc744d[_0xbf6b('0x26')](_0x471a1d)['then'](function(_0x2089bc){return _0x2089bc;});}return null;};}function removeEntity(_0x1e9f01,_0x3c2434){return function(_0x2837d5){if(_0x2837d5){return _0x2837d5['destroy']()[_0xbf6b('0x27')](function(){_0x1e9f01[_0xbf6b('0x1b')](0xcc)[_0xbf6b('0x28')]();});}};}function handleEntityNotFound(_0x2ab42d,_0x424710){return function(_0xceaec5){if(!_0xceaec5){_0x2ab42d[_0xbf6b('0x1a')](0x194);}return _0xceaec5;};}function handleError(_0x155c1c,_0x800f0f){_0x800f0f=_0x800f0f||0x1f4;return function(_0xa49f45){logger[_0xbf6b('0x29')](_0xa49f45[_0xbf6b('0x2a')]);if(_0xa49f45['name']){delete _0xa49f45['name'];}_0x155c1c[_0xbf6b('0x1b')](_0x800f0f)['send'](_0xa49f45);};}exports['index']=function(_0x2be5bc,_0x615f4d){var _0x33f8cb={},_0x516821={},_0x25f0c9={'count':0x0,'rows':[]};var _0x3bdd51=_[_0xbf6b('0x2b')](db['SquareDetailsReport'][_0xbf6b('0x2c')],function(_0x445af1){return{'name':_0x445af1[_0xbf6b('0x2d')],'type':_0x445af1['type'][_0xbf6b('0x2e')]};});_0x516821['model']=_['map'](_0x3bdd51,_0xbf6b('0x2f'));_0x516821[_0xbf6b('0x30')]=_[_0xbf6b('0x31')](_0x2be5bc[_0xbf6b('0x30')]);_0x516821[_0xbf6b('0x32')]=_[_0xbf6b('0x33')](_0x516821['model'],_0x516821[_0xbf6b('0x30')]);_0x33f8cb[_0xbf6b('0x34')]=_[_0xbf6b('0x33')](_0x516821[_0xbf6b('0x35')],qs[_0xbf6b('0x36')](_0x2be5bc[_0xbf6b('0x30')]['fields']));_0x33f8cb[_0xbf6b('0x34')]=_0x33f8cb[_0xbf6b('0x34')]['length']?_0x33f8cb[_0xbf6b('0x34')]:_0x516821['model'];if(!_0x2be5bc[_0xbf6b('0x30')][_0xbf6b('0x37')](_0xbf6b('0x38'))){_0x33f8cb['limit']=qs[_0xbf6b('0x1e')](_0x2be5bc['query'][_0xbf6b('0x1e')]);_0x33f8cb[_0xbf6b('0x1c')]=qs['offset'](_0x2be5bc['query'][_0xbf6b('0x1c')]);}_0x33f8cb['order']=qs[_0xbf6b('0x39')](_0x2be5bc[_0xbf6b('0x30')]['sort']);_0x33f8cb['where']=qs[_0xbf6b('0x32')](_['pick'](_0x2be5bc[_0xbf6b('0x30')],_0x516821[_0xbf6b('0x32')]),_0x3bdd51);if(_0x2be5bc[_0xbf6b('0x30')][_0xbf6b('0x3a')]){_0x33f8cb[_0xbf6b('0x3b')]=_['merge'](_0x33f8cb[_0xbf6b('0x3b')],{'$or':_['map'](_0x3bdd51,function(_0x122b9d){if(_0x122b9d[_0xbf6b('0x3c')]!==_0xbf6b('0x3d')){var _0xfca43={};_0xfca43[_0x122b9d['name']]={'$like':'%'+_0x2be5bc[_0xbf6b('0x30')]['filter']+'%'};return _0xfca43;}})});}_0x33f8cb=_['merge']({},_0x33f8cb,_0x2be5bc[_0xbf6b('0x3e')]);var _0x24a505={'where':_0x33f8cb[_0xbf6b('0x3b')]};return db['SquareDetailsReport']['count'](_0x24a505)['then'](function(_0xe9fe8b){_0x25f0c9[_0xbf6b('0x1f')]=_0xe9fe8b;if(_0x2be5bc[_0xbf6b('0x30')][_0xbf6b('0x3f')]){_0x33f8cb[_0xbf6b('0x40')]=[{'all':!![]}];}return db[_0xbf6b('0x41')][_0xbf6b('0x42')](_0x33f8cb);})['then'](function(_0x15520e){_0x25f0c9[_0xbf6b('0x43')]=_0x15520e;return _0x25f0c9;})['then'](respondWithFilteredResult(_0x615f4d,_0x33f8cb))[_0xbf6b('0x44')](handleError(_0x615f4d,null));};exports[_0xbf6b('0x45')]=function(_0x2de8bb,_0x3585b2){var _0x4c2be0={'raw':!![],'where':{'id':_0x2de8bb['params']['id']}},_0x5ccf46={};_0x5ccf46[_0xbf6b('0x35')]=_[_0xbf6b('0x31')](db[_0xbf6b('0x41')][_0xbf6b('0x2c')]);_0x5ccf46['query']=_[_0xbf6b('0x31')](_0x2de8bb[_0xbf6b('0x30')]);_0x5ccf46['filters']=_[_0xbf6b('0x33')](_0x5ccf46[_0xbf6b('0x35')],_0x5ccf46['query']);_0x4c2be0['attributes']=_[_0xbf6b('0x33')](_0x5ccf46[_0xbf6b('0x35')],qs[_0xbf6b('0x36')](_0x2de8bb['query'][_0xbf6b('0x36')]));_0x4c2be0[_0xbf6b('0x34')]=_0x4c2be0['attributes'][_0xbf6b('0x46')]?_0x4c2be0[_0xbf6b('0x34')]:_0x5ccf46['model'];if(_0x2de8bb[_0xbf6b('0x30')][_0xbf6b('0x3f')]){_0x4c2be0[_0xbf6b('0x40')]=[{'all':!![]}];}_0x4c2be0=_['merge']({},_0x4c2be0,_0x2de8bb[_0xbf6b('0x3e')]);return db[_0xbf6b('0x41')][_0xbf6b('0x47')](_0x4c2be0)['then'](handleEntityNotFound(_0x3585b2,null))[_0xbf6b('0x27')](respondWithResult(_0x3585b2,null))[_0xbf6b('0x44')](handleError(_0x3585b2,null));};exports['create']=function(_0x1ceadd,_0x286e74){return db['SquareDetailsReport'][_0xbf6b('0x48')](_0x1ceadd['body'],{})[_0xbf6b('0x27')](respondWithResult(_0x286e74,0xc9))[_0xbf6b('0x44')](handleError(_0x286e74,null));};exports[_0xbf6b('0x26')]=function(_0x31bfe8,_0x4f625a){if(_0x31bfe8['body']['id']){delete _0x31bfe8['body']['id'];}return db[_0xbf6b('0x41')][_0xbf6b('0x47')]({'where':{'id':_0x31bfe8['params']['id']}})[_0xbf6b('0x27')](handleEntityNotFound(_0x4f625a,null))[_0xbf6b('0x27')](saveUpdates(_0x31bfe8[_0xbf6b('0x49')],null))['then'](respondWithResult(_0x4f625a,null))[_0xbf6b('0x44')](handleError(_0x4f625a,null));};exports[_0xbf6b('0x4a')]=function(_0x430601,_0x1cfec5){return db[_0xbf6b('0x41')][_0xbf6b('0x47')]({'where':{'id':_0x430601['params']['id']}})[_0xbf6b('0x27')](handleEntityNotFound(_0x1cfec5,null))['then'](removeEntity(_0x1cfec5,null))[_0xbf6b('0x44')](handleError(_0x1cfec5,null));};exports[_0xbf6b('0x4b')]=function(_0x115dde,_0xb6cf29){return db[_0xbf6b('0x41')][_0xbf6b('0x4b')]()[_0xbf6b('0x27')](respondWithResult(_0xb6cf29,null))['catch'](handleError(_0xb6cf29,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index b936960..2cc4d8f 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 _0xa4ad=['exports','define','SquareDetailsReport','report_square_details','lodash','util','../../config/logger','bluebird','request-promise','path','../../config/environment','./squareReportDetail.attributes'];(function(_0x29b635,_0xca3da1){var _0x32f59e=function(_0x5d0b0c){while(--_0x5d0b0c){_0x29b635['push'](_0x29b635['shift']());}};_0x32f59e(++_0xca3da1);}(_0xa4ad,0x70));var _0xda4a=function(_0x3e69ae,_0x366e8d){_0x3e69ae=_0x3e69ae-0x0;var _0x3d7f42=_0xa4ad[_0x3e69ae];return _0x3d7f42;};'use strict';var _=require(_0xda4a('0x0'));var util=require(_0xda4a('0x1'));var logger=require(_0xda4a('0x2'))('api');var moment=require('moment');var BPromise=require(_0xda4a('0x3'));var rp=require(_0xda4a('0x4'));var fs=require('fs');var path=require(_0xda4a('0x5'));var rimraf=require('rimraf');var config=require(_0xda4a('0x6'));var attributes=require(_0xda4a('0x7'));module[_0xda4a('0x8')]=function(_0x523447,_0x2c617c){return _0x523447[_0xda4a('0x9')](_0xda4a('0xa'),attributes,{'tableName':_0xda4a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9108=['request-promise','path','rimraf','../../config/environment','report_square_details','util','../../config/logger','api'];(function(_0x3485f8,_0x5742da){var _0x3e1906=function(_0x5b783f){while(--_0x5b783f){_0x3485f8['push'](_0x3485f8['shift']());}};_0x3e1906(++_0x5742da);}(_0x9108,0x12d));var _0x8910=function(_0x3dfd90,_0x2928c9){_0x3dfd90=_0x3dfd90-0x0;var _0x4b0e86=_0x9108[_0x3dfd90];return _0x4b0e86;};'use strict';var _=require('lodash');var util=require(_0x8910('0x0'));var logger=require(_0x8910('0x1'))(_0x8910('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8910('0x3'));var fs=require('fs');var path=require(_0x8910('0x4'));var rimraf=require(_0x8910('0x5'));var config=require(_0x8910('0x6'));var attributes=require('./squareReportDetail.attributes');module['exports']=function(_0x58e893,_0x2685a8){return _0x58e893['define']('SquareDetailsReport',attributes,{'tableName':_0x8910('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 ca3e64b..6944ba2 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 _0x1eba=['SquareDetailsReport','create','body','options','raw','debug','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','SquareDetailsReport,\x20%s,\x20%s','message','result','CreateSquareDetailsReport'];(function(_0x16e465,_0x44d73b){var _0x128d6e=function(_0x5a21aa){while(--_0x5a21aa){_0x16e465['push'](_0x16e465['shift']());}};_0x128d6e(++_0x44d73b);}(_0x1eba,0x1d7));var _0xa1eb=function(_0x4e4519,_0x392ae){_0x4e4519=_0x4e4519-0x0;var _0x340044=_0x1eba[_0x4e4519];return _0x340044;};'use strict';var _=require(_0xa1eb('0x0'));var util=require(_0xa1eb('0x1'));var moment=require(_0xa1eb('0x2'));var BPromise=require(_0xa1eb('0x3'));var rs=require(_0xa1eb('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa1eb('0x5'));var logger=require(_0xa1eb('0x6'))(_0xa1eb('0x7'));var config=require(_0xa1eb('0x8'));var jayson=require(_0xa1eb('0x9'));var client=jayson[_0xa1eb('0xa')][_0xa1eb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2bfbb0,_0x39a5a3,_0x7d2982){return new BPromise(function(_0x2aebb6,_0x9d7113){return client['request'](_0x2bfbb0,_0x7d2982)[_0xa1eb('0xc')](function(_0x4d4aaf){logger[_0xa1eb('0xd')]('SquareDetailsReport,\x20%s,\x20%s',_0x39a5a3,_0xa1eb('0xe'));logger['debug'](_0xa1eb('0xf'),_0x39a5a3,'request\x20sent',JSON[_0xa1eb('0x10')](_0x4d4aaf));if(_0x4d4aaf[_0xa1eb('0x11')]){if(_0x4d4aaf[_0xa1eb('0x11')]['code']===0x1f4){logger[_0xa1eb('0x11')](_0xa1eb('0x12'),_0x39a5a3,_0x4d4aaf['error'][_0xa1eb('0x13')]);return _0x9d7113(_0x4d4aaf['error']['message']);}logger[_0xa1eb('0x11')]('SquareDetailsReport,\x20%s,\x20%s',_0x39a5a3,_0x4d4aaf[_0xa1eb('0x11')][_0xa1eb('0x13')]);return _0x2aebb6(_0x4d4aaf[_0xa1eb('0x11')][_0xa1eb('0x13')]);}else{logger[_0xa1eb('0xd')](_0xa1eb('0x12'),_0x39a5a3,_0xa1eb('0xe'));_0x2aebb6(_0x4d4aaf[_0xa1eb('0x14')][_0xa1eb('0x13')]);}})['catch'](function(_0xbd6a6b){logger['error'](_0xa1eb('0x12'),_0x39a5a3,_0xbd6a6b);_0x9d7113(_0xbd6a6b);});});}exports[_0xa1eb('0x15')]=function(_0x33c4e3){var _0x1a5d2c=this;return new Promise(function(_0x49bfaa,_0x1dd621){return db[_0xa1eb('0x16')][_0xa1eb('0x17')](_0x33c4e3[_0xa1eb('0x18')],{'raw':_0x33c4e3[_0xa1eb('0x19')]?_0x33c4e3[_0xa1eb('0x19')][_0xa1eb('0x1a')]===undefined?!![]:![]:!![]})[_0xa1eb('0xc')](function(_0x4fc14a){logger[_0xa1eb('0xd')]('CreateSquareDetailsReport',_0x33c4e3);logger[_0xa1eb('0x1b')](_0xa1eb('0x15'),_0x33c4e3,JSON[_0xa1eb('0x10')](_0x4fc14a));_0x49bfaa(_0x4fc14a);})[_0xa1eb('0x1c')](function(_0x5e7a34){logger['error'](_0xa1eb('0x15'),_0x5e7a34[_0xa1eb('0x13')],_0x33c4e3);_0x1dd621(_0x1a5d2c['error'](0x1f4,_0x5e7a34[_0xa1eb('0x13')]));});});}; \ No newline at end of file +var _0x4af8=['../../config/utils','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','error','code','message','SquareDetailsReport,\x20%s,\x20%s','result','catch','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','raw','stringify','randomstring','ioredis','../../mysqldb'];(function(_0x50f78c,_0x3f79e3){var _0xdee518=function(_0x436c80){while(--_0x436c80){_0x50f78c['push'](_0x50f78c['shift']());}};_0xdee518(++_0x3f79e3);}(_0x4af8,0x1ad));var _0x84af=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0x4af8[_0x12d033];return _0x3b4e80;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x84af('0x0'));var fs=require('fs');var Redis=require(_0x84af('0x1'));var db=require(_0x84af('0x2'))['db'];var utils=require(_0x84af('0x3'));var logger=require('../../config/logger')(_0x84af('0x4'));var config=require(_0x84af('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x84af('0x6')][_0x84af('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x550ee6,_0x422c5b,_0x294bc8){return new BPromise(function(_0x483ecc,_0x5b5e45){return client[_0x84af('0x8')](_0x550ee6,_0x294bc8)[_0x84af('0x9')](function(_0x479e1b){logger[_0x84af('0xa')]('SquareDetailsReport,\x20%s,\x20%s',_0x422c5b,_0x84af('0xb'));logger[_0x84af('0xc')](_0x84af('0xd'),_0x422c5b,_0x84af('0xb'),JSON['stringify'](_0x479e1b));if(_0x479e1b[_0x84af('0xe')]){if(_0x479e1b['error'][_0x84af('0xf')]===0x1f4){logger[_0x84af('0xe')]('SquareDetailsReport,\x20%s,\x20%s',_0x422c5b,_0x479e1b[_0x84af('0xe')][_0x84af('0x10')]);return _0x5b5e45(_0x479e1b[_0x84af('0xe')][_0x84af('0x10')]);}logger['error'](_0x84af('0x11'),_0x422c5b,_0x479e1b['error'][_0x84af('0x10')]);return _0x483ecc(_0x479e1b[_0x84af('0xe')]['message']);}else{logger[_0x84af('0xa')](_0x84af('0x11'),_0x422c5b,'request\x20sent');_0x483ecc(_0x479e1b[_0x84af('0x12')]['message']);}})[_0x84af('0x13')](function(_0x33baf1){logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x422c5b,_0x33baf1);_0x5b5e45(_0x33baf1);});});}exports[_0x84af('0x14')]=function(_0xd8120b){var _0x38a120=this;return new Promise(function(_0x4cf5b4,_0x4d0cf0){return db[_0x84af('0x15')][_0x84af('0x16')](_0xd8120b[_0x84af('0x17')],{'raw':_0xd8120b[_0x84af('0x18')]?_0xd8120b[_0x84af('0x18')][_0x84af('0x19')]===undefined?!![]:![]:!![]})[_0x84af('0x9')](function(_0x334875){logger[_0x84af('0xa')]('CreateSquareDetailsReport',_0xd8120b);logger[_0x84af('0xc')](_0x84af('0x14'),_0xd8120b,JSON[_0x84af('0x1a')](_0x334875));_0x4cf5b4(_0x334875);})['catch'](function(_0x2f40d6){logger[_0x84af('0xe')](_0x84af('0x14'),_0x2f40d6['message'],_0xd8120b);_0x4d0cf0(_0x38a120['error'](0x1f4,_0x2f40d6[_0x84af('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 866e2b1..efda6c0 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 _0x873e=['/process/:pid/kill','isAuthenticated','killProcess','exports','express','../../components/auth/service','./system.controller','index','get'];(function(_0x209880,_0x49c6fe){var _0x16b27d=function(_0x7e8df0){while(--_0x7e8df0){_0x209880['push'](_0x209880['shift']());}};_0x16b27d(++_0x49c6fe);}(_0x873e,0x1ea));var _0xe873=function(_0x1c3814,_0x38ea53){_0x1c3814=_0x1c3814-0x0;var _0x3b002e=_0x873e[_0x1c3814];return _0x3b002e;};'use strict';var express=require(_0xe873('0x0'));var router=express['Router']();var auth=require(_0xe873('0x1'));var controller=require(_0xe873('0x2'));router['get']('/',auth['isAuthenticated'](),controller[_0xe873('0x3')]);router[_0xe873('0x4')](_0xe873('0x5'),auth[_0xe873('0x6')](),controller[_0xe873('0x7')]);module[_0xe873('0x8')]=router; \ No newline at end of file +var _0x87e7=['/process/:pid/kill','isAuthenticated','killProcess','exports','express','Router','./system.controller','get'];(function(_0x4e7d4a,_0x35cdc8){var _0x235800=function(_0x59ff40){while(--_0x59ff40){_0x4e7d4a['push'](_0x4e7d4a['shift']());}};_0x235800(++_0x35cdc8);}(_0x87e7,0x1b4));var _0x787e=function(_0x1fa381,_0x758c2a){_0x1fa381=_0x1fa381-0x0;var _0x47eefe=_0x87e7[_0x1fa381];return _0x47eefe;};'use strict';var express=require(_0x787e('0x0'));var router=express[_0x787e('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x787e('0x2'));router[_0x787e('0x3')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x787e('0x4'),auth[_0x787e('0x5')](),controller[_0x787e('0x6')]);module[_0x787e('0x7')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index acb1ca3..3ff4cad 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 _0xb3e1=['send','index','getAllData','then','json','catch','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','length','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','exec','../../config/logger','api','util','bluebird','lodash','error','inspect','status'];(function(_0x2962d5,_0x38deda){var _0x273406=function(_0x3e0775){while(--_0x3e0775){_0x2962d5['push'](_0x2962d5['shift']());}};_0x273406(++_0x38deda);}(_0xb3e1,0x1b5));var _0x1b3e=function(_0x234ae1,_0x42bdd6){_0x234ae1=_0x234ae1-0x0;var _0x227ba0=_0xb3e1[_0x234ae1];return _0x227ba0;};'use strict';var info=require(_0x1b3e('0x0'));var exec=require(_0x1b3e('0x1'))[_0x1b3e('0x2')];var logger=require(_0x1b3e('0x3'))(_0x1b3e('0x4'));var util=require(_0x1b3e('0x5'));var BPromise=require(_0x1b3e('0x6'));var _=require(_0x1b3e('0x7'));function handleError(_0x170db4,_0x261a62,_0x415faf){_0x261a62=_0x261a62||0x1f4;return function(_0xe61676){logger[_0x1b3e('0x8')]('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x415faf,_0x261a62,util[_0x1b3e('0x9')](_0xe61676,{'showHidden':![],'depth':null}));delete _0xe61676['name'];_0x170db4[_0x1b3e('0xa')](_0x261a62)[_0x1b3e('0xb')](_0xe61676);};}exports[_0x1b3e('0xc')]=function(_0x4b5565,_0x3f2f28){return info[_0x1b3e('0xd')]()[_0x1b3e('0xe')](function(_0x509209){return _0x3f2f28[_0x1b3e('0xa')](0xc8)[_0x1b3e('0xf')](_0x509209);})[_0x1b3e('0x10')](function(_0x19d617){return _0x3f2f28[_0x1b3e('0xa')](0x1f4)['json'](_0x19d617);});};exports['killProcess']=function(_0x32c8b3,_0x524116){var _0x3880da=[_0x1b3e('0x11')];return new BPromise(function(_0x24b605,_0x49768f){return exec(util[_0x1b3e('0x12')](_0x1b3e('0x13'),_0x32c8b3[_0x1b3e('0x14')][_0x1b3e('0x15')]),function(_0x54097f,_0x42b855,_0xafddfa){if(_0x54097f){return _0x49768f(_0x54097f);}return _0x24b605(_0x42b855);});})[_0x1b3e('0xe')](function(_0x527c28){var _0x2ab1d7=![];var _0x1d3a90=_0x527c28[_0x1b3e('0x16')](/\n/);for(var _0x540aef=0x0,_0x5e1dee=_0x3880da[_0x1b3e('0x17')];_0x540aef<_0x5e1dee,_0x2ab1d7===![];_0x540aef+=0x1){if(_0x527c28['indexOf'](_0x3880da[_0x540aef])>=0x0){_0x2ab1d7=!![];}}if(!_0x2ab1d7){throw new Error(util[_0x1b3e('0x12')](_0x1b3e('0x18'),_0x32c8b3[_0x1b3e('0x14')][_0x1b3e('0x15')]));}process[_0x1b3e('0x19')](_0x32c8b3[_0x1b3e('0x14')][_0x1b3e('0x15')],_0x1b3e('0x1a'));return _0x524116[_0x1b3e('0xa')](0xc8)['json']({'message':util[_0x1b3e('0x12')](_0x1b3e('0x1b'),_0x32c8b3[_0x1b3e('0x14')][_0x1b3e('0x15')])});})[_0x1b3e('0x10')](handleError(_0x524116,null,'killProcess'));}; \ No newline at end of file +var _0xf2e9=['inspect','name','status','send','index','getAllData','then','json','catch','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','exec','../../config/logger','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s'];(function(_0x28d7b5,_0x1305a4){var _0x1ed035=function(_0x57e1f6){while(--_0x57e1f6){_0x28d7b5['push'](_0x28d7b5['shift']());}};_0x1ed035(++_0x1305a4);}(_0xf2e9,0xdb));var _0x9f2e=function(_0x4652c9,_0x4b3bcb){_0x4652c9=_0x4652c9-0x0;var _0x520be5=_0xf2e9[_0x4652c9];return _0x520be5;};'use strict';var info=require(_0x9f2e('0x0'));var exec=require('child_process')[_0x9f2e('0x1')];var logger=require(_0x9f2e('0x2'))('api');var util=require('util');var BPromise=require('bluebird');var _=require(_0x9f2e('0x3'));function handleError(_0x334ea4,_0x4b057f,_0x2ff8a5){_0x4b057f=_0x4b057f||0x1f4;return function(_0x1aeb27){logger[_0x9f2e('0x4')](_0x9f2e('0x5'),_0x2ff8a5,_0x4b057f,util[_0x9f2e('0x6')](_0x1aeb27,{'showHidden':![],'depth':null}));delete _0x1aeb27[_0x9f2e('0x7')];_0x334ea4[_0x9f2e('0x8')](_0x4b057f)[_0x9f2e('0x9')](_0x1aeb27);};}exports[_0x9f2e('0xa')]=function(_0x53312a,_0x519344){return info[_0x9f2e('0xb')]()[_0x9f2e('0xc')](function(_0x35285d){return _0x519344[_0x9f2e('0x8')](0xc8)[_0x9f2e('0xd')](_0x35285d);})[_0x9f2e('0xe')](function(_0x28497d){return _0x519344[_0x9f2e('0x8')](0x1f4)[_0x9f2e('0xd')](_0x28497d);});};exports[_0x9f2e('0xf')]=function(_0x118862,_0x33dbc1){var _0x9149c1=[_0x9f2e('0x10')];return new BPromise(function(_0x390c87,_0x2c0d56){return exec(util[_0x9f2e('0x11')](_0x9f2e('0x12'),_0x118862[_0x9f2e('0x13')][_0x9f2e('0x14')]),function(_0x56f68a,_0x4071cc,_0x3ff602){if(_0x56f68a){return _0x2c0d56(_0x56f68a);}return _0x390c87(_0x4071cc);});})[_0x9f2e('0xc')](function(_0x47efe8){var _0x2cbb3e=![];var _0x4502b9=_0x47efe8['split'](/\n/);for(var _0x300db8=0x0,_0x200c0a=_0x9149c1['length'];_0x300db8<_0x200c0a,_0x2cbb3e===![];_0x300db8+=0x1){if(_0x47efe8[_0x9f2e('0x15')](_0x9149c1[_0x300db8])>=0x0){_0x2cbb3e=!![];}}if(!_0x2cbb3e){throw new Error(util[_0x9f2e('0x11')](_0x9f2e('0x16'),_0x118862[_0x9f2e('0x13')][_0x9f2e('0x14')]));}process['kill'](_0x118862['params'][_0x9f2e('0x14')],_0x9f2e('0x17'));return _0x33dbc1[_0x9f2e('0x8')](0xc8)['json']({'message':util['format'](_0x9f2e('0x18'),_0x118862[_0x9f2e('0x13')][_0x9f2e('0x14')])});})[_0x9f2e('0xe')](handleError(_0x33dbc1,null,'killProcess'));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index f06bfb8..3a5b0fe 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 _0x4ef7=['show','create','put','update','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get','isAuthenticated','/:id'];(function(_0x583e0d,_0x4c0f0d){var _0x496345=function(_0xc39d1f){while(--_0xc39d1f){_0x583e0d['push'](_0x583e0d['shift']());}};_0x496345(++_0x4c0f0d);}(_0x4ef7,0x1c7));var _0x74ef=function(_0x3bdfdb,_0x5eb9b6){_0x3bdfdb=_0x3bdfdb-0x0;var _0x534a63=_0x4ef7[_0x3bdfdb];return _0x534a63;};'use strict';var multer=require(_0x74ef('0x0'));var util=require(_0x74ef('0x1'));var path=require('path');var timeout=require(_0x74ef('0x2'));var express=require(_0x74ef('0x3'));var router=express[_0x74ef('0x4')]();var fs_extra=require(_0x74ef('0x5'));var auth=require(_0x74ef('0x6'));var interaction=require(_0x74ef('0x7'));var config=require(_0x74ef('0x8'));var controller=require(_0x74ef('0x9'));router[_0x74ef('0xa')]('/',auth[_0x74ef('0xb')](),controller['index']);router[_0x74ef('0xa')](_0x74ef('0xc'),auth['isAuthenticated'](),controller[_0x74ef('0xd')]);router['post']('/',auth[_0x74ef('0xb')](),controller[_0x74ef('0xe')]);router[_0x74ef('0xf')]('/:id',auth[_0x74ef('0xb')](),controller[_0x74ef('0x10')]);router['delete'](_0x74ef('0xc'),auth['isAuthenticated'](),controller[_0x74ef('0x11')]);module['exports']=router; \ No newline at end of file +var _0x1b7b=['index','/:id','show','create','delete','isAuthenticated','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x1104ed,_0x578ff9){var _0x27d221=function(_0xa83f7b){while(--_0xa83f7b){_0x1104ed['push'](_0x1104ed['shift']());}};_0x27d221(++_0x578ff9);}(_0x1b7b,0x104));var _0xb1b7=function(_0x230398,_0x56b6d9){_0x230398=_0x230398-0x0;var _0x1b11f0=_0x1b7b[_0x230398];return _0x1b11f0;};'use strict';var multer=require(_0xb1b7('0x0'));var util=require(_0xb1b7('0x1'));var path=require(_0xb1b7('0x2'));var timeout=require(_0xb1b7('0x3'));var express=require('express');var router=express[_0xb1b7('0x4')]();var fs_extra=require(_0xb1b7('0x5'));var auth=require(_0xb1b7('0x6'));var interaction=require(_0xb1b7('0x7'));var config=require(_0xb1b7('0x8'));var controller=require('./tag.controller');router[_0xb1b7('0x9')]('/',auth['isAuthenticated'](),controller[_0xb1b7('0xa')]);router['get'](_0xb1b7('0xb'),auth['isAuthenticated'](),controller[_0xb1b7('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb1b7('0xd')]);router['put'](_0xb1b7('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xb1b7('0xe')](_0xb1b7('0xb'),auth[_0xb1b7('0xf')](),controller[_0xb1b7('0x10')]);module[_0xb1b7('0x11')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 8d51258..5b9f76d 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 _0x180d=['#0091EA','exports','STRING','name'];(function(_0x4ed19b,_0x4c0380){var _0x22fb0e=function(_0x25410d){while(--_0x25410d){_0x4ed19b['push'](_0x4ed19b['shift']());}};_0x22fb0e(++_0x4c0380);}(_0x180d,0xf9));var _0xd180=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0x180d[_0x47aa64];return _0x549c7a;};'use strict';var Sequelize=require('sequelize');module[_0xd180('0x0')]={'name':{'type':Sequelize[_0xd180('0x1')],'unique':_0xd180('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xd180('0x1')],'defaultValue':_0xd180('0x3')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2ea1=['name','#0091EA','sequelize','exports','STRING'];(function(_0x3ef0a9,_0x5d2ff6){var _0x40db78=function(_0x4ed268){while(--_0x4ed268){_0x3ef0a9['push'](_0x3ef0a9['shift']());}};_0x40db78(++_0x5d2ff6);}(_0x2ea1,0xca));var _0x12ea=function(_0x309099,_0x172fd1){_0x309099=_0x309099-0x0;var _0x4c2850=_0x2ea1[_0x309099];return _0x4c2850;};'use strict';var Sequelize=require(_0x12ea('0x0'));module[_0x12ea('0x1')]={'name':{'type':Sequelize[_0x12ea('0x2')],'unique':_0x12ea('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x12ea('0x2')],'defaultValue':_0x12ea('0x4')},'description':{'type':Sequelize[_0x12ea('0x2')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 69e8aa5..641a86d 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 _0x6f7a=['order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','update','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','Tags','destroy','then','sendStatus','error','stack','name','send','index','Tag','rawAttributes','type','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x2441aa,_0x23dd5a){var _0x5da4e4=function(_0x3a1faf){while(--_0x3a1faf){_0x2441aa['push'](_0x2441aa['shift']());}};_0x5da4e4(++_0x23dd5a);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0x12597c,_0x3127f7){_0x12597c=_0x12597c-0x0;var _0x176ee6=_0x6f7a[_0x12597c];return _0x176ee6;};'use strict';var emlformat=require(_0xa6f7('0x0'));var rimraf=require(_0xa6f7('0x1'));var zipdir=require(_0xa6f7('0x2'));var jsonpatch=require(_0xa6f7('0x3'));var rp=require('request-promise');var moment=require(_0xa6f7('0x4'));var BPromise=require(_0xa6f7('0x5'));var Mustache=require(_0xa6f7('0x6'));var util=require(_0xa6f7('0x7'));var path=require(_0xa6f7('0x8'));var sox=require(_0xa6f7('0x9'));var csv=require(_0xa6f7('0xa'));var ejs=require(_0xa6f7('0xb'));var fs=require('fs');var fs_extra=require(_0xa6f7('0xc'));var _=require(_0xa6f7('0xd'));var squel=require(_0xa6f7('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa6f7('0xf'));var toCsv=require(_0xa6f7('0xa'));var querystring=require(_0xa6f7('0x10'));var Papa=require(_0xa6f7('0x11'));var Redis=require(_0xa6f7('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa6f7('0x13'));var hardwareService=require(_0xa6f7('0x14'));var logger=require('../../config/logger')(_0xa6f7('0x15'));var utils=require('../../config/utils');var config=require(_0xa6f7('0x16'));var licenseUtil=require(_0xa6f7('0x17'));var db=require(_0xa6f7('0x18'))['db'];function respondWithStatusCode(_0xd5558b,_0x5a3035){_0x5a3035=_0x5a3035||0xcc;return function(_0x3fc7f1){if(_0x3fc7f1){return _0xd5558b['sendStatus'](_0x5a3035);}return _0xd5558b[_0xa6f7('0x19')](_0x5a3035)[_0xa6f7('0x1a')]();};}function respondWithResult(_0x25c123,_0x4d3d59){_0x4d3d59=_0x4d3d59||0xc8;return function(_0x34c02d){if(_0x34c02d){return _0x25c123['status'](_0x4d3d59)[_0xa6f7('0x1b')](_0x34c02d);}};}function respondWithFilteredResult(_0x57308a,_0x17b814){return function(_0x17f9c5){if(_0x17f9c5){var _0x6efd38=typeof _0x17b814['offset']===_0xa6f7('0x1c')&&typeof _0x17b814[_0xa6f7('0x1d')]===_0xa6f7('0x1c');var _0x2401b9=_0x17f9c5['count'];var _0x4a8827=_0x6efd38?0x0:_0x17b814[_0xa6f7('0x1e')];var _0x5298ba=_0x6efd38?_0x17f9c5[_0xa6f7('0x1f')]:_0x17b814[_0xa6f7('0x1e')]+_0x17b814['limit'];var _0x18fc4a;if(_0x5298ba>=_0x2401b9){_0x5298ba=_0x2401b9;_0x18fc4a=0xc8;}else{_0x18fc4a=0xce;}_0x57308a[_0xa6f7('0x19')](_0x18fc4a);return _0x57308a[_0xa6f7('0x20')](_0xa6f7('0x21'),_0x4a8827+'-'+_0x5298ba+'/'+_0x2401b9)[_0xa6f7('0x1b')](_0x17f9c5);}return null;};}function patchUpdates(_0x1aa8dc){return function(_0x4887ad){try{jsonpatch[_0xa6f7('0x22')](_0x4887ad,_0x1aa8dc,!![]);}catch(_0x45d79e){return BPromise['reject'](_0x45d79e);}return _0x4887ad['save']();};}function saveUpdates(_0x5ddc8d,_0x1de6c9){return function(_0x119950){if(_0x119950){return _0x119950['update'](_0x5ddc8d)['then'](function(_0x50e2be){return _0x50e2be;});}return null;};}function removeEntity(_0x2b6a84,_0xc77e8e){return function(_0x28263e){if(_0x28263e){return _0x28263e['destroy']()['then'](function(){var _0x2f4907=_0x28263e['get']({'plain':!![]});var _0x47ef97=_0xa6f7('0x23');return db['UserProfileResource'][_0xa6f7('0x24')]({'where':{'type':_0x47ef97,'resourceId':_0x2f4907['id']}})[_0xa6f7('0x25')](function(){return _0x28263e;});})[_0xa6f7('0x25')](function(){_0x2b6a84[_0xa6f7('0x19')](0xcc)[_0xa6f7('0x1a')]();});}};}function handleEntityNotFound(_0x4b8d2b,_0x51db47){return function(_0x1c419b){if(!_0x1c419b){_0x4b8d2b[_0xa6f7('0x26')](0x194);}return _0x1c419b;};}function handleError(_0x55d45a,_0x267917){_0x267917=_0x267917||0x1f4;return function(_0x27babb){logger[_0xa6f7('0x27')](_0x27babb[_0xa6f7('0x28')]);if(_0x27babb[_0xa6f7('0x29')]){delete _0x27babb[_0xa6f7('0x29')];}_0x55d45a[_0xa6f7('0x19')](_0x267917)[_0xa6f7('0x2a')](_0x27babb);};}exports[_0xa6f7('0x2b')]=function(_0x3dee2e,_0x40b0f8){var _0x278bad={},_0x52f9c1={},_0x442ccf={'count':0x0,'rows':[]};var _0x42dc49=_['map'](db[_0xa6f7('0x2c')][_0xa6f7('0x2d')],function(_0x4d79d8){return{'name':_0x4d79d8['fieldName'],'type':_0x4d79d8[_0xa6f7('0x2e')][_0xa6f7('0x2f')]};});_0x52f9c1[_0xa6f7('0x30')]=_[_0xa6f7('0x31')](_0x42dc49,_0xa6f7('0x29'));_0x52f9c1['query']=_['keys'](_0x3dee2e[_0xa6f7('0x32')]);_0x52f9c1['filters']=_[_0xa6f7('0x33')](_0x52f9c1[_0xa6f7('0x30')],_0x52f9c1[_0xa6f7('0x32')]);_0x278bad[_0xa6f7('0x34')]=_[_0xa6f7('0x33')](_0x52f9c1[_0xa6f7('0x30')],qs['fields'](_0x3dee2e[_0xa6f7('0x32')][_0xa6f7('0x35')]));_0x278bad[_0xa6f7('0x34')]=_0x278bad['attributes'][_0xa6f7('0x36')]?_0x278bad['attributes']:_0x52f9c1[_0xa6f7('0x30')];if(!_0x3dee2e[_0xa6f7('0x32')][_0xa6f7('0x37')]('nolimit')){_0x278bad[_0xa6f7('0x1d')]=qs[_0xa6f7('0x1d')](_0x3dee2e[_0xa6f7('0x32')][_0xa6f7('0x1d')]);_0x278bad[_0xa6f7('0x1e')]=qs[_0xa6f7('0x1e')](_0x3dee2e['query'][_0xa6f7('0x1e')]);}_0x278bad[_0xa6f7('0x38')]=qs[_0xa6f7('0x39')](_0x3dee2e[_0xa6f7('0x32')][_0xa6f7('0x39')]);_0x278bad[_0xa6f7('0x3a')]=qs[_0xa6f7('0x3b')](_[_0xa6f7('0x3c')](_0x3dee2e['query'],_0x52f9c1[_0xa6f7('0x3b')]),_0x42dc49);if(_0x3dee2e[_0xa6f7('0x32')][_0xa6f7('0x3d')]){_0x278bad['where']=_[_0xa6f7('0x3e')](_0x278bad[_0xa6f7('0x3a')],{'$or':_['map'](_0x42dc49,function(_0x39349a){if(_0x39349a[_0xa6f7('0x2e')]!==_0xa6f7('0x3f')){var _0x14d532={};_0x14d532[_0x39349a[_0xa6f7('0x29')]]={'$like':'%'+_0x3dee2e['query'][_0xa6f7('0x3d')]+'%'};return _0x14d532;}})});}_0x278bad=_[_0xa6f7('0x3e')]({},_0x278bad,_0x3dee2e[_0xa6f7('0x40')]);var _0x1b8bf3={'where':_0x278bad[_0xa6f7('0x3a')]};return db[_0xa6f7('0x2c')][_0xa6f7('0x1f')](_0x1b8bf3)[_0xa6f7('0x25')](function(_0x5646b9){_0x442ccf['count']=_0x5646b9;if(_0x3dee2e[_0xa6f7('0x32')][_0xa6f7('0x41')]){_0x278bad[_0xa6f7('0x42')]=[{'all':!![]}];}return db[_0xa6f7('0x2c')][_0xa6f7('0x43')](_0x278bad);})[_0xa6f7('0x25')](function(_0x21fdd7){_0x442ccf[_0xa6f7('0x44')]=_0x21fdd7;return _0x442ccf;})[_0xa6f7('0x25')](respondWithFilteredResult(_0x40b0f8,_0x278bad))[_0xa6f7('0x45')](handleError(_0x40b0f8,null));};exports['show']=function(_0x41917c,_0x30be3b){var _0x4d5846={'raw':!![],'where':{'id':_0x41917c[_0xa6f7('0x46')]['id']}},_0x22d500={};_0x22d500[_0xa6f7('0x30')]=_[_0xa6f7('0x47')](db['Tag'][_0xa6f7('0x2d')]);_0x22d500['query']=_['keys'](_0x41917c[_0xa6f7('0x32')]);_0x22d500[_0xa6f7('0x3b')]=_[_0xa6f7('0x33')](_0x22d500[_0xa6f7('0x30')],_0x22d500[_0xa6f7('0x32')]);_0x4d5846[_0xa6f7('0x34')]=_[_0xa6f7('0x33')](_0x22d500['model'],qs[_0xa6f7('0x35')](_0x41917c[_0xa6f7('0x32')]['fields']));_0x4d5846[_0xa6f7('0x34')]=_0x4d5846[_0xa6f7('0x34')][_0xa6f7('0x36')]?_0x4d5846['attributes']:_0x22d500[_0xa6f7('0x30')];if(_0x41917c['query'][_0xa6f7('0x41')]){_0x4d5846[_0xa6f7('0x42')]=[{'all':!![]}];}_0x4d5846=_[_0xa6f7('0x3e')]({},_0x4d5846,_0x41917c['options']);return db['Tag'][_0xa6f7('0x48')](_0x4d5846)['then'](handleEntityNotFound(_0x30be3b,null))[_0xa6f7('0x25')](respondWithResult(_0x30be3b,null))['catch'](handleError(_0x30be3b,null));};exports['create']=function(_0x1e7089,_0x2e3a04){return db[_0xa6f7('0x2c')][_0xa6f7('0x49')](_0x1e7089[_0xa6f7('0x4a')],{})[_0xa6f7('0x25')](function(_0x5d9b6f){var _0x4032fc=_0x1e7089[_0xa6f7('0x4b')]['get']({'plain':!![]});if(!_0x4032fc)throw new Error(_0xa6f7('0x4c'));if(_0x4032fc['role']===_0xa6f7('0x4b')){var _0x59091a=_0x5d9b6f['get']({'plain':!![]});var _0x60eacc=_0xa6f7('0x23');return db[_0xa6f7('0x4d')][_0xa6f7('0x48')]({'where':{'name':_0x60eacc,'userProfileId':_0x4032fc[_0xa6f7('0x4e')]},'raw':!![]})['then'](function(_0x340d3f){if(_0x340d3f&&_0x340d3f[_0xa6f7('0x4f')]===0x0){return db['UserProfileResource'][_0xa6f7('0x49')]({'name':_0x59091a['name'],'resourceId':_0x59091a['id'],'type':_0x340d3f[_0xa6f7('0x29')],'sectionId':_0x340d3f['id']},{})[_0xa6f7('0x25')](function(){return _0x5d9b6f;});}else{return _0x5d9b6f;}})[_0xa6f7('0x45')](function(_0x55369a){logger[_0xa6f7('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x55369a);throw _0x55369a;});}return _0x5d9b6f;})[_0xa6f7('0x25')](respondWithResult(_0x2e3a04,0xc9))[_0xa6f7('0x45')](handleError(_0x2e3a04,null));};exports[_0xa6f7('0x50')]=function(_0x1dcb45,_0xa6bff9){if(_0x1dcb45['body']['id']){delete _0x1dcb45['body']['id'];}return db[_0xa6f7('0x2c')][_0xa6f7('0x48')]({'where':{'id':_0x1dcb45[_0xa6f7('0x46')]['id']}})[_0xa6f7('0x25')](handleEntityNotFound(_0xa6bff9,null))['then'](saveUpdates(_0x1dcb45[_0xa6f7('0x4a')],null))[_0xa6f7('0x25')](respondWithResult(_0xa6bff9,null))[_0xa6f7('0x45')](handleError(_0xa6bff9,null));};exports[_0xa6f7('0x24')]=function(_0x1b33a5,_0x39538e){return db['Tag'][_0xa6f7('0x48')]({'where':{'id':_0x1b33a5[_0xa6f7('0x46')]['id']}})[_0xa6f7('0x25')](handleEntityNotFound(_0x39538e,null))['then'](removeEntity(_0x39538e,null))[_0xa6f7('0x45')](handleError(_0x39538e,null));}; \ No newline at end of file +var _0xc36d=['error','stack','name','Tag','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','nolimit','sort','where','pick','filter','merge','map','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','status','end','json','limit','undefined','count','offset','Content-Range','apply','save','update','then','destroy','Tags','UserProfileResource'];(function(_0x414f67,_0x861aed){var _0x338537=function(_0x4696fd){while(--_0x4696fd){_0x414f67['push'](_0x414f67['shift']());}};_0x338537(++_0x861aed);}(_0xc36d,0x7d));var _0xdc36=function(_0x5f4cd7,_0x459c44){_0x5f4cd7=_0x5f4cd7-0x0;var _0x47c93f=_0xc36d[_0x5f4cd7];return _0x47c93f;};'use strict';var emlformat=require(_0xdc36('0x0'));var rimraf=require(_0xdc36('0x1'));var zipdir=require(_0xdc36('0x2'));var jsonpatch=require(_0xdc36('0x3'));var rp=require(_0xdc36('0x4'));var moment=require(_0xdc36('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xdc36('0x6'));var util=require(_0xdc36('0x7'));var path=require('path');var sox=require(_0xdc36('0x8'));var csv=require(_0xdc36('0x9'));var ejs=require(_0xdc36('0xa'));var fs=require('fs');var fs_extra=require(_0xdc36('0xb'));var _=require(_0xdc36('0xc'));var squel=require('squel');var crypto=require(_0xdc36('0xd'));var jsforce=require(_0xdc36('0xe'));var deskjs=require(_0xdc36('0xf'));var toCsv=require(_0xdc36('0x9'));var querystring=require('querystring');var Papa=require(_0xdc36('0x10'));var Redis=require(_0xdc36('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xdc36('0x12'));var as=require(_0xdc36('0x13'));var hardwareService=require(_0xdc36('0x14'));var logger=require('../../config/logger')(_0xdc36('0x15'));var utils=require(_0xdc36('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xdc36('0x17'))['db'];function respondWithStatusCode(_0x276692,_0x519fa5){_0x519fa5=_0x519fa5||0xcc;return function(_0x5d62ee){if(_0x5d62ee){return _0x276692['sendStatus'](_0x519fa5);}return _0x276692[_0xdc36('0x18')](_0x519fa5)[_0xdc36('0x19')]();};}function respondWithResult(_0x243d54,_0xae6ad3){_0xae6ad3=_0xae6ad3||0xc8;return function(_0x30803d){if(_0x30803d){return _0x243d54[_0xdc36('0x18')](_0xae6ad3)[_0xdc36('0x1a')](_0x30803d);}};}function respondWithFilteredResult(_0x809cf0,_0x57ebde){return function(_0x155cce){if(_0x155cce){var _0x526ac8=typeof _0x57ebde['offset']==='undefined'&&typeof _0x57ebde[_0xdc36('0x1b')]===_0xdc36('0x1c');var _0x5a498f=_0x155cce[_0xdc36('0x1d')];var _0x219a73=_0x526ac8?0x0:_0x57ebde[_0xdc36('0x1e')];var _0x225878=_0x526ac8?_0x155cce[_0xdc36('0x1d')]:_0x57ebde[_0xdc36('0x1e')]+_0x57ebde['limit'];var _0x3d4c4c;if(_0x225878>=_0x5a498f){_0x225878=_0x5a498f;_0x3d4c4c=0xc8;}else{_0x3d4c4c=0xce;}_0x809cf0[_0xdc36('0x18')](_0x3d4c4c);return _0x809cf0['set'](_0xdc36('0x1f'),_0x219a73+'-'+_0x225878+'/'+_0x5a498f)[_0xdc36('0x1a')](_0x155cce);}return null;};}function patchUpdates(_0x3f25f0){return function(_0x5f15ef){try{jsonpatch[_0xdc36('0x20')](_0x5f15ef,_0x3f25f0,!![]);}catch(_0x235a39){return BPromise['reject'](_0x235a39);}return _0x5f15ef[_0xdc36('0x21')]();};}function saveUpdates(_0x480277,_0x5a6e35){return function(_0x12f9d8){if(_0x12f9d8){return _0x12f9d8[_0xdc36('0x22')](_0x480277)[_0xdc36('0x23')](function(_0xda916b){return _0xda916b;});}return null;};}function removeEntity(_0x2d83c0,_0x34d261){return function(_0x14b595){if(_0x14b595){return _0x14b595[_0xdc36('0x24')]()['then'](function(){var _0x34057e=_0x14b595['get']({'plain':!![]});var _0x2338d7=_0xdc36('0x25');return db[_0xdc36('0x26')]['destroy']({'where':{'type':_0x2338d7,'resourceId':_0x34057e['id']}})[_0xdc36('0x23')](function(){return _0x14b595;});})[_0xdc36('0x23')](function(){_0x2d83c0[_0xdc36('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x28a005,_0x2f3b6a){return function(_0x2a596d){if(!_0x2a596d){_0x28a005['sendStatus'](0x194);}return _0x2a596d;};}function handleError(_0x3c39e3,_0x2dcef7){_0x2dcef7=_0x2dcef7||0x1f4;return function(_0x4b15b4){logger[_0xdc36('0x27')](_0x4b15b4[_0xdc36('0x28')]);if(_0x4b15b4['name']){delete _0x4b15b4[_0xdc36('0x29')];}_0x3c39e3['status'](_0x2dcef7)['send'](_0x4b15b4);};}exports['index']=function(_0x3b0839,_0x2f2bb4){var _0x4f57aa={},_0x13bf82={},_0x983eab={'count':0x0,'rows':[]};var _0x336447=_['map'](db[_0xdc36('0x2a')][_0xdc36('0x2b')],function(_0x1d010c){return{'name':_0x1d010c[_0xdc36('0x2c')],'type':_0x1d010c[_0xdc36('0x2d')][_0xdc36('0x2e')]};});_0x13bf82[_0xdc36('0x2f')]=_['map'](_0x336447,_0xdc36('0x29'));_0x13bf82[_0xdc36('0x30')]=_['keys'](_0x3b0839['query']);_0x13bf82[_0xdc36('0x31')]=_[_0xdc36('0x32')](_0x13bf82[_0xdc36('0x2f')],_0x13bf82['query']);_0x4f57aa['attributes']=_[_0xdc36('0x32')](_0x13bf82[_0xdc36('0x2f')],qs[_0xdc36('0x33')](_0x3b0839[_0xdc36('0x30')][_0xdc36('0x33')]));_0x4f57aa[_0xdc36('0x34')]=_0x4f57aa[_0xdc36('0x34')][_0xdc36('0x35')]?_0x4f57aa[_0xdc36('0x34')]:_0x13bf82[_0xdc36('0x2f')];if(!_0x3b0839[_0xdc36('0x30')]['hasOwnProperty'](_0xdc36('0x36'))){_0x4f57aa[_0xdc36('0x1b')]=qs[_0xdc36('0x1b')](_0x3b0839[_0xdc36('0x30')]['limit']);_0x4f57aa[_0xdc36('0x1e')]=qs[_0xdc36('0x1e')](_0x3b0839[_0xdc36('0x30')][_0xdc36('0x1e')]);}_0x4f57aa['order']=qs[_0xdc36('0x37')](_0x3b0839['query']['sort']);_0x4f57aa[_0xdc36('0x38')]=qs[_0xdc36('0x31')](_[_0xdc36('0x39')](_0x3b0839['query'],_0x13bf82[_0xdc36('0x31')]),_0x336447);if(_0x3b0839['query'][_0xdc36('0x3a')]){_0x4f57aa[_0xdc36('0x38')]=_[_0xdc36('0x3b')](_0x4f57aa['where'],{'$or':_[_0xdc36('0x3c')](_0x336447,function(_0x3394ca){if(_0x3394ca[_0xdc36('0x2d')]!==_0xdc36('0x3d')){var _0x50cf7b={};_0x50cf7b[_0x3394ca[_0xdc36('0x29')]]={'$like':'%'+_0x3b0839[_0xdc36('0x30')][_0xdc36('0x3a')]+'%'};return _0x50cf7b;}})});}_0x4f57aa=_['merge']({},_0x4f57aa,_0x3b0839['options']);var _0x2cefcf={'where':_0x4f57aa[_0xdc36('0x38')]};return db['Tag']['count'](_0x2cefcf)[_0xdc36('0x23')](function(_0x8f4c80){_0x983eab[_0xdc36('0x1d')]=_0x8f4c80;if(_0x3b0839[_0xdc36('0x30')][_0xdc36('0x3e')]){_0x4f57aa[_0xdc36('0x3f')]=[{'all':!![]}];}return db[_0xdc36('0x2a')][_0xdc36('0x40')](_0x4f57aa);})[_0xdc36('0x23')](function(_0x125f0e){_0x983eab[_0xdc36('0x41')]=_0x125f0e;return _0x983eab;})[_0xdc36('0x23')](respondWithFilteredResult(_0x2f2bb4,_0x4f57aa))[_0xdc36('0x42')](handleError(_0x2f2bb4,null));};exports[_0xdc36('0x43')]=function(_0x1f2604,_0x133166){var _0xc8cb3d={'raw':!![],'where':{'id':_0x1f2604[_0xdc36('0x44')]['id']}},_0x16dcb7={};_0x16dcb7[_0xdc36('0x2f')]=_[_0xdc36('0x45')](db[_0xdc36('0x2a')][_0xdc36('0x2b')]);_0x16dcb7[_0xdc36('0x30')]=_[_0xdc36('0x45')](_0x1f2604[_0xdc36('0x30')]);_0x16dcb7['filters']=_[_0xdc36('0x32')](_0x16dcb7[_0xdc36('0x2f')],_0x16dcb7['query']);_0xc8cb3d['attributes']=_[_0xdc36('0x32')](_0x16dcb7['model'],qs[_0xdc36('0x33')](_0x1f2604['query'][_0xdc36('0x33')]));_0xc8cb3d[_0xdc36('0x34')]=_0xc8cb3d[_0xdc36('0x34')][_0xdc36('0x35')]?_0xc8cb3d[_0xdc36('0x34')]:_0x16dcb7[_0xdc36('0x2f')];if(_0x1f2604[_0xdc36('0x30')][_0xdc36('0x3e')]){_0xc8cb3d[_0xdc36('0x3f')]=[{'all':!![]}];}_0xc8cb3d=_[_0xdc36('0x3b')]({},_0xc8cb3d,_0x1f2604[_0xdc36('0x46')]);return db[_0xdc36('0x2a')][_0xdc36('0x47')](_0xc8cb3d)[_0xdc36('0x23')](handleEntityNotFound(_0x133166,null))[_0xdc36('0x23')](respondWithResult(_0x133166,null))[_0xdc36('0x42')](handleError(_0x133166,null));};exports[_0xdc36('0x48')]=function(_0x3399cc,_0x562c86){return db['Tag'][_0xdc36('0x48')](_0x3399cc[_0xdc36('0x49')],{})[_0xdc36('0x23')](function(_0x45dd51){var _0x205f76=_0x3399cc[_0xdc36('0x4a')]['get']({'plain':!![]});if(!_0x205f76)throw new Error(_0xdc36('0x4b'));if(_0x205f76[_0xdc36('0x4c')]===_0xdc36('0x4a')){var _0x49f456=_0x45dd51[_0xdc36('0x4d')]({'plain':!![]});var _0x53ed42=_0xdc36('0x25');return db[_0xdc36('0x4e')][_0xdc36('0x47')]({'where':{'name':_0x53ed42,'userProfileId':_0x205f76[_0xdc36('0x4f')]},'raw':!![]})['then'](function(_0x2f1707){if(_0x2f1707&&_0x2f1707[_0xdc36('0x50')]===0x0){return db[_0xdc36('0x26')][_0xdc36('0x48')]({'name':_0x49f456[_0xdc36('0x29')],'resourceId':_0x49f456['id'],'type':_0x2f1707[_0xdc36('0x29')],'sectionId':_0x2f1707['id']},{})[_0xdc36('0x23')](function(){return _0x45dd51;});}else{return _0x45dd51;}})[_0xdc36('0x42')](function(_0x4abeaf){logger[_0xdc36('0x27')](_0xdc36('0x51'),_0x4abeaf);throw _0x4abeaf;});}return _0x45dd51;})[_0xdc36('0x23')](respondWithResult(_0x562c86,0xc9))[_0xdc36('0x42')](handleError(_0x562c86,null));};exports[_0xdc36('0x22')]=function(_0x187b00,_0x1e7332){if(_0x187b00[_0xdc36('0x49')]['id']){delete _0x187b00['body']['id'];}return db['Tag'][_0xdc36('0x47')]({'where':{'id':_0x187b00[_0xdc36('0x44')]['id']}})['then'](handleEntityNotFound(_0x1e7332,null))[_0xdc36('0x23')](saveUpdates(_0x187b00[_0xdc36('0x49')],null))['then'](respondWithResult(_0x1e7332,null))['catch'](handleError(_0x1e7332,null));};exports[_0xdc36('0x24')]=function(_0x5cf2ee,_0x4277b4){return db['Tag'][_0xdc36('0x47')]({'where':{'id':_0x5cf2ee['params']['id']}})['then'](handleEntityNotFound(_0x4277b4,null))[_0xdc36('0x23')](removeEntity(_0x4277b4,null))['catch'](handleError(_0x4277b4,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 84411b7..1837c49 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 _0xfff0=['./tag.attributes','exports','Tag','tools_tags','lodash','util','api','request-promise','path','rimraf','../../config/environment'];(function(_0x1aecdc,_0x522a27){var _0xef638b=function(_0x1d5c91){while(--_0x1d5c91){_0x1aecdc['push'](_0x1aecdc['shift']());}};_0xef638b(++_0x522a27);}(_0xfff0,0xeb));var _0x0fff=function(_0x4628aa,_0x4324e9){_0x4628aa=_0x4628aa-0x0;var _0x4d3fde=_0xfff0[_0x4628aa];return _0x4d3fde;};'use strict';var _=require(_0x0fff('0x0'));var util=require(_0x0fff('0x1'));var logger=require('../../config/logger')(_0x0fff('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0fff('0x3'));var fs=require('fs');var path=require(_0x0fff('0x4'));var rimraf=require(_0x0fff('0x5'));var config=require(_0x0fff('0x6'));var attributes=require(_0x0fff('0x7'));module[_0x0fff('0x8')]=function(_0x5c04c3,_0x561c68){return _0x5c04c3['define'](_0x0fff('0x9'),attributes,{'tableName':_0x0fff('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb4e6=['path','rimraf','./tag.attributes','exports','define','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x34ec8f,_0x2c5e75){var _0x2566dc=function(_0x46a917){while(--_0x46a917){_0x34ec8f['push'](_0x34ec8f['shift']());}};_0x2566dc(++_0x2c5e75);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x3b711c,_0x4b22dc){_0x3b711c=_0x3b711c-0x0;var _0x2685f0=_0xb4e6[_0x3b711c];return _0x2685f0;};'use strict';var _=require(_0x6b4e('0x0'));var util=require('util');var logger=require(_0x6b4e('0x1'))(_0x6b4e('0x2'));var moment=require(_0x6b4e('0x3'));var BPromise=require(_0x6b4e('0x4'));var rp=require(_0x6b4e('0x5'));var fs=require('fs');var path=require(_0x6b4e('0x6'));var rimraf=require(_0x6b4e('0x7'));var config=require('../../config/environment');var attributes=require(_0x6b4e('0x8'));module[_0x6b4e('0x9')]=function(_0x1f67a2,_0x49de51){return _0x1f67a2[_0x6b4e('0xa')]('Tag',attributes,{'tableName':'tools_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index a2f218c..d02a22a 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 _0xf72b=['../../config/environment','jayson/promise','client','request','Tag,\x20%s,\x20%s','request\x20sent','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x31637d,_0x5116df){var _0x265eda=function(_0x1cedb7){while(--_0x1cedb7){_0x31637d['push'](_0x31637d['shift']());}};_0x265eda(++_0x5116df);}(_0xf72b,0x1d9));var _0xbf72=function(_0x3ac71c,_0x4c67ac){_0x3ac71c=_0x3ac71c-0x0;var _0xdd9303=_0xf72b[_0x3ac71c];return _0xdd9303;};'use strict';var _=require(_0xbf72('0x0'));var util=require('util');var moment=require(_0xbf72('0x1'));var BPromise=require('bluebird');var rs=require(_0xbf72('0x2'));var fs=require('fs');var Redis=require(_0xbf72('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbf72('0x4'));var logger=require(_0xbf72('0x5'))(_0xbf72('0x6'));var config=require(_0xbf72('0x7'));var jayson=require(_0xbf72('0x8'));var client=jayson[_0xbf72('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41c11d,_0xc0842b,_0x119807){return new BPromise(function(_0xd0402c,_0xdd6177){return client[_0xbf72('0xa')](_0x41c11d,_0x119807)['then'](function(_0x455891){logger['info'](_0xbf72('0xb'),_0xc0842b,_0xbf72('0xc'));logger['debug'](_0xbf72('0xd'),_0xc0842b,_0xbf72('0xc'),JSON[_0xbf72('0xe')](_0x455891));if(_0x455891[_0xbf72('0xf')]){if(_0x455891[_0xbf72('0xf')][_0xbf72('0x10')]===0x1f4){logger[_0xbf72('0xf')](_0xbf72('0xb'),_0xc0842b,_0x455891['error'][_0xbf72('0x11')]);return _0xdd6177(_0x455891[_0xbf72('0xf')][_0xbf72('0x11')]);}logger['error'](_0xbf72('0xb'),_0xc0842b,_0x455891['error']['message']);return _0xd0402c(_0x455891['error'][_0xbf72('0x11')]);}else{logger[_0xbf72('0x12')](_0xbf72('0xb'),_0xc0842b,_0xbf72('0xc'));_0xd0402c(_0x455891[_0xbf72('0x13')][_0xbf72('0x11')]);}})['catch'](function(_0x266ce2){logger[_0xbf72('0xf')](_0xbf72('0xb'),_0xc0842b,_0x266ce2);_0xdd6177(_0x266ce2);});});} \ No newline at end of file +var _0x222f=['result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x299610,_0x1fe0a7){var _0x50a58e=function(_0x33ce55){while(--_0x33ce55){_0x299610['push'](_0x299610['shift']());}};_0x50a58e(++_0x1fe0a7);}(_0x222f,0x1a4));var _0xf222=function(_0x469c7c,_0x4a54c6){_0x469c7c=_0x469c7c-0x0;var _0x4b8ffa=_0x222f[_0x469c7c];return _0x4b8ffa;};'use strict';var _=require(_0xf222('0x0'));var util=require(_0xf222('0x1'));var moment=require(_0xf222('0x2'));var BPromise=require(_0xf222('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf222('0x4'))['db'];var utils=require(_0xf222('0x5'));var logger=require(_0xf222('0x6'))(_0xf222('0x7'));var config=require('../../config/environment');var jayson=require(_0xf222('0x8'));var client=jayson['client'][_0xf222('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x26f129,_0x518ebb,_0xf5a105){return new BPromise(function(_0x302d7a,_0x4aceb4){return client[_0xf222('0xa')](_0x26f129,_0xf5a105)[_0xf222('0xb')](function(_0x878804){logger[_0xf222('0xc')](_0xf222('0xd'),_0x518ebb,_0xf222('0xe'));logger['debug'](_0xf222('0xf'),_0x518ebb,_0xf222('0xe'),JSON[_0xf222('0x10')](_0x878804));if(_0x878804[_0xf222('0x11')]){if(_0x878804['error'][_0xf222('0x12')]===0x1f4){logger[_0xf222('0x11')](_0xf222('0xd'),_0x518ebb,_0x878804[_0xf222('0x11')][_0xf222('0x13')]);return _0x4aceb4(_0x878804[_0xf222('0x11')][_0xf222('0x13')]);}logger[_0xf222('0x11')]('Tag,\x20%s,\x20%s',_0x518ebb,_0x878804['error'][_0xf222('0x13')]);return _0x302d7a(_0x878804[_0xf222('0x11')]['message']);}else{logger[_0xf222('0xc')](_0xf222('0xd'),_0x518ebb,_0xf222('0xe'));_0x302d7a(_0x878804[_0xf222('0x14')][_0xf222('0x13')]);}})[_0xf222('0x15')](function(_0x30b646){logger['error'](_0xf222('0xd'),_0x518ebb,_0x30b646);_0x4aceb4(_0x30b646);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index ebc4063..d066a81 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(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0xa9e0[_0x1b828b];return _0x98da1a;};'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(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'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 c0155ed..f27feaf 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 _0xb10b=['name','sequelize','STRING'];(function(_0xc8b6dc,_0xb3893d){var _0x26abc6=function(_0x5dbf3f){while(--_0x5dbf3f){_0xc8b6dc['push'](_0xc8b6dc['shift']());}};_0x26abc6(++_0xb3893d);}(_0xb10b,0x12a));var _0xbb10=function(_0x26462e,_0x416ff7){_0x26462e=_0x26462e-0x0;var _0x31c3f0=_0xb10b[_0x26462e];return _0x31c3f0;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![],'unique':_0xbb10('0x2')},'description':{'type':Sequelize[_0xbb10('0x1')]}}; \ No newline at end of file +var _0xe706=['STRING','sequelize','exports'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xe706,0xa3));var _0x6e70=function(_0x20259c,_0xe43fb2){_0x20259c=_0x20259c-0x0;var _0x4d988e=_0xe706[_0x20259c];return _0x4d988e;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'name':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x6e70('0x2')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 43db5a5..d3d5b64 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 _0x31b7=['spread','removeAgents','Queue:remove','getAgents','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./team.socket','register','sendStatus','status','json','limit','undefined','count','offset','set','Content-Range','apply','reject','then','error','stack','name','index','map','rawAttributes','fieldName','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','Teams','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','Team','destroy','transaction','sequelize','Sequelize','QueryTypes','SELECT','VoiceQueueId','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','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','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','end','getQueues','channel','isValidChannel','ValidationError','Unknown\x20channel','capitalize','Queue','toLowerCase','Queues','addQueues','findOne','add','ids','removeQueues','remove','isArray','Voice','Chat','Mail','Fax','Openchannel','Whatsapp','through','QueueId','TeamVoiceQueue','penalty','User','findOrCreate','emit','Queue:save','online','voicePause','interface','UserVoiceQueueRt','isNil','format','SIP/%s','all','upsert','addAgents'];(function(_0x352fbf,_0x5d417d){var _0x45784a=function(_0x22a0ff){while(--_0x22a0ff){_0x352fbf['push'](_0x352fbf['shift']());}};_0x45784a(++_0x5d417d);}(_0x31b7,0x138));var _0x731b=function(_0x267346,_0x2ae952){_0x267346=_0x267346-0x0;var _0x2e3e18=_0x31b7[_0x267346];return _0x2e3e18;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x731b('0x0'));var zipdir=require(_0x731b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x731b('0x2'));var moment=require('moment');var BPromise=require(_0x731b('0x3'));var Mustache=require(_0x731b('0x4'));var util=require('util');var path=require(_0x731b('0x5'));var sox=require(_0x731b('0x6'));var csv=require(_0x731b('0x7'));var ejs=require(_0x731b('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x731b('0x9'));var squel=require(_0x731b('0xa'));var crypto=require('crypto');var jsforce=require(_0x731b('0xb'));var deskjs=require(_0x731b('0xc'));var toCsv=require(_0x731b('0x7'));var querystring=require(_0x731b('0xd'));var Papa=require(_0x731b('0xe'));var Redis=require(_0x731b('0xf'));var authService=require(_0x731b('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x731b('0x11'));var logger=require(_0x731b('0x12'))(_0x731b('0x13'));var utils=require(_0x731b('0x14'));var config=require(_0x731b('0x15'));var licenseUtil=require(_0x731b('0x16'));var db=require('../../mysqldb')['db'];config[_0x731b('0x17')]=_[_0x731b('0x18')](config[_0x731b('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x731b('0x19'))(new Redis(config[_0x731b('0x17')]));require(_0x731b('0x1a'))[_0x731b('0x1b')](socket);function respondWithStatusCode(_0x419680,_0x550490){_0x550490=_0x550490||0xcc;return function(_0x42bb8b){if(_0x42bb8b){return _0x419680[_0x731b('0x1c')](_0x550490);}return _0x419680[_0x731b('0x1d')](_0x550490)['end']();};}function respondWithResult(_0x5f2d64,_0x19e411){_0x19e411=_0x19e411||0xc8;return function(_0x86eb75){if(_0x86eb75){return _0x5f2d64[_0x731b('0x1d')](_0x19e411)[_0x731b('0x1e')](_0x86eb75);}};}function respondWithFilteredResult(_0x19aa81,_0x441f7e){return function(_0x4bfd14){if(_0x4bfd14){var _0x143138=typeof _0x441f7e['offset']==='undefined'&&typeof _0x441f7e[_0x731b('0x1f')]===_0x731b('0x20');var _0x7bc41f=_0x4bfd14[_0x731b('0x21')];var _0x1c1958=_0x143138?0x0:_0x441f7e[_0x731b('0x22')];var _0x18db6c=_0x143138?_0x4bfd14[_0x731b('0x21')]:_0x441f7e[_0x731b('0x22')]+_0x441f7e[_0x731b('0x1f')];var _0x292726;if(_0x18db6c>=_0x7bc41f){_0x18db6c=_0x7bc41f;_0x292726=0xc8;}else{_0x292726=0xce;}_0x19aa81[_0x731b('0x1d')](_0x292726);return _0x19aa81[_0x731b('0x23')](_0x731b('0x24'),_0x1c1958+'-'+_0x18db6c+'/'+_0x7bc41f)['json'](_0x4bfd14);}return null;};}function patchUpdates(_0x20e26c){return function(_0x49d9e8){try{jsonpatch[_0x731b('0x25')](_0x49d9e8,_0x20e26c,!![]);}catch(_0x4627d8){return BPromise[_0x731b('0x26')](_0x4627d8);}return _0x49d9e8['save']();};}function saveUpdates(_0x7e4a9,_0x173b25){return function(_0x2bddc){if(_0x2bddc){return _0x2bddc['update'](_0x7e4a9)[_0x731b('0x27')](function(_0x5da8b8){return _0x5da8b8;});}return null;};}function handleEntityNotFound(_0x283b2a,_0x5a557d){return function(_0x2efccc){if(!_0x2efccc){_0x283b2a[_0x731b('0x1c')](0x194);}return _0x2efccc;};}function handleError(_0x195b0c,_0x5b6424){_0x5b6424=_0x5b6424||0x1f4;return function(_0x1d9773){logger[_0x731b('0x28')](_0x1d9773[_0x731b('0x29')]);if(_0x1d9773[_0x731b('0x2a')]){delete _0x1d9773[_0x731b('0x2a')];}_0x195b0c[_0x731b('0x1d')](_0x5b6424)['send'](_0x1d9773);};}exports[_0x731b('0x2b')]=function(_0x875038,_0x53b928){var _0x1337e2={},_0x3c265e={},_0x1716d6={'count':0x0,'rows':[]};var _0x470f72=_[_0x731b('0x2c')](db['Team'][_0x731b('0x2d')],function(_0x3db8bc){return{'name':_0x3db8bc[_0x731b('0x2e')],'type':_0x3db8bc['type']['key']};});_0x3c265e['model']=_[_0x731b('0x2c')](_0x470f72,_0x731b('0x2a'));_0x3c265e[_0x731b('0x2f')]=_[_0x731b('0x30')](_0x875038[_0x731b('0x2f')]);_0x3c265e[_0x731b('0x31')]=_[_0x731b('0x32')](_0x3c265e[_0x731b('0x33')],_0x3c265e['query']);_0x1337e2[_0x731b('0x34')]=_['intersection'](_0x3c265e[_0x731b('0x33')],qs[_0x731b('0x35')](_0x875038['query'][_0x731b('0x35')]));_0x1337e2[_0x731b('0x34')]=_0x1337e2[_0x731b('0x34')]['length']?_0x1337e2[_0x731b('0x34')]:_0x3c265e[_0x731b('0x33')];if(!_0x875038[_0x731b('0x2f')][_0x731b('0x36')](_0x731b('0x37'))){_0x1337e2[_0x731b('0x1f')]=qs[_0x731b('0x1f')](_0x875038[_0x731b('0x2f')]['limit']);_0x1337e2[_0x731b('0x22')]=qs['offset'](_0x875038[_0x731b('0x2f')][_0x731b('0x22')]);}_0x1337e2[_0x731b('0x38')]=qs[_0x731b('0x39')](_0x875038[_0x731b('0x2f')][_0x731b('0x39')]);_0x1337e2[_0x731b('0x3a')]=qs[_0x731b('0x31')](_[_0x731b('0x3b')](_0x875038[_0x731b('0x2f')],_0x3c265e[_0x731b('0x31')]),_0x470f72);if(_0x875038[_0x731b('0x2f')][_0x731b('0x3c')]){_0x1337e2[_0x731b('0x3a')]=_[_0x731b('0x3d')](_0x1337e2[_0x731b('0x3a')],{'$or':_[_0x731b('0x2c')](_0x470f72,function(_0x247d9f){if(_0x247d9f['type']!==_0x731b('0x3e')){var _0x1eb4fd={};_0x1eb4fd[_0x247d9f['name']]={'$like':'%'+_0x875038['query'][_0x731b('0x3c')]+'%'};return _0x1eb4fd;}})});}_0x1337e2=_[_0x731b('0x3d')]({},_0x1337e2,_0x875038[_0x731b('0x3f')]);var _0x332970={'where':_0x1337e2['where']};return db['Team']['count'](_0x332970)[_0x731b('0x27')](function(_0x13e016){_0x1716d6[_0x731b('0x21')]=_0x13e016;if(_0x875038[_0x731b('0x2f')][_0x731b('0x40')]){_0x1337e2[_0x731b('0x41')]=[{'all':!![]}];}return db['Team'][_0x731b('0x42')](_0x1337e2);})[_0x731b('0x27')](function(_0x1a9469){_0x1716d6[_0x731b('0x43')]=_0x1a9469;return _0x1716d6;})[_0x731b('0x27')](respondWithFilteredResult(_0x53b928,_0x1337e2))[_0x731b('0x44')](handleError(_0x53b928,null));};exports[_0x731b('0x45')]=function(_0x47952c,_0x1e0cf8){var _0x255f55={'raw':![],'where':{'id':_0x47952c[_0x731b('0x46')]['id']}},_0x5cfaab={};_0x5cfaab['model']=_['keys'](db['Team'][_0x731b('0x2d')]);_0x5cfaab['query']=_[_0x731b('0x30')](_0x47952c[_0x731b('0x2f')]);_0x5cfaab['filters']=_[_0x731b('0x32')](_0x5cfaab[_0x731b('0x33')],_0x5cfaab['query']);_0x255f55['attributes']=_[_0x731b('0x32')](_0x5cfaab[_0x731b('0x33')],qs[_0x731b('0x35')](_0x47952c[_0x731b('0x2f')][_0x731b('0x35')]));_0x255f55[_0x731b('0x34')]=_0x255f55['attributes'][_0x731b('0x47')]?_0x255f55[_0x731b('0x34')]:_0x5cfaab[_0x731b('0x33')];if(_0x47952c[_0x731b('0x2f')][_0x731b('0x40')]){_0x255f55[_0x731b('0x41')]=[{'all':!![]}];}_0x255f55=_['merge']({},_0x255f55,_0x47952c[_0x731b('0x3f')]);return db['Team'][_0x731b('0x48')](_0x255f55)[_0x731b('0x27')](handleEntityNotFound(_0x1e0cf8,null))[_0x731b('0x27')](respondWithResult(_0x1e0cf8,null))['catch'](handleError(_0x1e0cf8,null));};exports[_0x731b('0x49')]=function(_0x4892fe,_0x28f31a){return db['Team']['create'](_0x4892fe[_0x731b('0x4a')],{})[_0x731b('0x27')](function(_0x3e63f9){var _0x474b0e=_0x4892fe[_0x731b('0x4b')][_0x731b('0x4c')]({'plain':!![]});if(!_0x474b0e)throw new Error(_0x731b('0x4d'));if(_0x474b0e['role']===_0x731b('0x4b')){var _0x122fe3=_0x3e63f9[_0x731b('0x4c')]({'plain':!![]});var _0x1c5dd6=_0x731b('0x4e');return db[_0x731b('0x4f')][_0x731b('0x48')]({'where':{'name':_0x1c5dd6,'userProfileId':_0x474b0e['userProfileId']},'raw':!![]})[_0x731b('0x27')](function(_0x5c7bc6){if(_0x5c7bc6&&_0x5c7bc6[_0x731b('0x50')]===0x0){return db[_0x731b('0x51')][_0x731b('0x49')]({'name':_0x122fe3[_0x731b('0x2a')],'resourceId':_0x122fe3['id'],'type':_0x5c7bc6[_0x731b('0x2a')],'sectionId':_0x5c7bc6['id']},{})[_0x731b('0x27')](function(){return _0x3e63f9;});}else{return _0x3e63f9;}})['catch'](function(_0x59761b){logger[_0x731b('0x28')](_0x731b('0x52'),_0x59761b);throw _0x59761b;});}return _0x3e63f9;})['then'](respondWithResult(_0x28f31a,0xc9))[_0x731b('0x44')](handleError(_0x28f31a,null));};exports[_0x731b('0x53')]=function(_0x46d79e,_0x42f8a8){if(_0x46d79e[_0x731b('0x4a')]['id']){delete _0x46d79e[_0x731b('0x4a')]['id'];}return db[_0x731b('0x54')][_0x731b('0x48')]({'where':{'id':_0x46d79e[_0x731b('0x46')]['id']}})['then'](handleEntityNotFound(_0x42f8a8,null))[_0x731b('0x27')](saveUpdates(_0x46d79e['body'],null))['then'](respondWithResult(_0x42f8a8,null))['catch'](handleError(_0x42f8a8,null));};exports[_0x731b('0x55')]=function(_0x3e1b28,_0x3bf4de){var _0x42ee65=_0x3e1b28[_0x731b('0x46')]['id'];var _0x2d9b3c=[];return db['sequelize'][_0x731b('0x56')](function(_0x52210d){var _0x233b95='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0x42ee65;return db[_0x731b('0x57')][_0x731b('0x2f')](_0x233b95,{'type':db[_0x731b('0x58')][_0x731b('0x59')][_0x731b('0x5a')],'raw':!![],'transaction':_0x52210d})[_0x731b('0x27')](function(_0x2cc755){_0x2d9b3c=_[_0x731b('0x2c')](_0x2cc755,function(_0x36f31e){return Number(_0x36f31e['UserId']);});})['then'](function(){var _0x3c06e5='SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20'+_0x42ee65;return db['sequelize']['query'](_0x3c06e5,{'type':db[_0x731b('0x58')]['QueryTypes'][_0x731b('0x5a')],'raw':!![],'transaction':_0x52210d});})['then'](function(_0x2a7e6a){var _0x3f8eba=_[_0x731b('0x2c')](_0x2a7e6a,function(_0x2237b5){return Number(_0x2237b5[_0x731b('0x5b')]);});return db['UserVoiceQueue'][_0x731b('0x55')]({'where':{'UserId':{'$in':_0x2d9b3c},'VoiceQueueId':{'$in':_0x3f8eba}},'transaction':_0x52210d});})['then'](function(){var _0x1b4c29=_0x731b('0x5c')+_0x42ee65;return db[_0x731b('0x57')]['query'](_0x1b4c29,{'type':db[_0x731b('0x58')][_0x731b('0x59')][_0x731b('0x5a')],'raw':!![],'transaction':_0x52210d});})[_0x731b('0x27')](function(_0x192133){var _0x3275fa=_['map'](_0x192133,function(_0xead2d5){return Number(_0xead2d5[_0x731b('0x5d')]);});return db[_0x731b('0x5e')][_0x731b('0x55')]({'where':{'UserId':{'$in':_0x2d9b3c},'MailQueueId':{'$in':_0x3275fa}},'transaction':_0x52210d});})[_0x731b('0x27')](function(){var _0x296fb5=_0x731b('0x5f')+_0x42ee65;return db['sequelize'][_0x731b('0x2f')](_0x296fb5,{'type':db[_0x731b('0x58')][_0x731b('0x59')][_0x731b('0x5a')],'raw':!![],'transaction':_0x52210d});})[_0x731b('0x27')](function(_0x11f95f){var _0x2b6439=_[_0x731b('0x2c')](_0x11f95f,function(_0x22f35c){return Number(_0x22f35c[_0x731b('0x60')]);});return db['UserSmsQueue'][_0x731b('0x55')]({'where':{'UserId':{'$in':_0x2d9b3c},'SmsQueueId':{'$in':_0x2b6439}},'transaction':_0x52210d});})['then'](function(){var _0x208ccb='SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20'+_0x42ee65;return db[_0x731b('0x57')][_0x731b('0x2f')](_0x208ccb,{'type':db[_0x731b('0x58')][_0x731b('0x59')][_0x731b('0x5a')],'raw':!![],'transaction':_0x52210d});})[_0x731b('0x27')](function(_0x57f7e4){var _0x21125a=_['map'](_0x57f7e4,function(_0x3ba3f2){return Number(_0x3ba3f2[_0x731b('0x61')]);});return db[_0x731b('0x62')][_0x731b('0x55')]({'where':{'UserId':{'$in':_0x2d9b3c},'ChatQueueId':{'$in':_0x21125a}},'transaction':_0x52210d});})[_0x731b('0x27')](function(){var _0x94d363=_0x731b('0x63')+_0x42ee65;return db[_0x731b('0x57')]['query'](_0x94d363,{'type':db[_0x731b('0x58')][_0x731b('0x59')][_0x731b('0x5a')],'raw':!![],'transaction':_0x52210d});})['then'](function(_0x4cffcc){var _0x371268=_[_0x731b('0x2c')](_0x4cffcc,function(_0x29df57){return Number(_0x29df57[_0x731b('0x64')]);});return db[_0x731b('0x65')][_0x731b('0x55')]({'where':{'UserId':{'$in':_0x2d9b3c},'FaxQueueId':{'$in':_0x371268}},'transaction':_0x52210d});})[_0x731b('0x27')](function(){var _0x278f97=_0x731b('0x66')+_0x42ee65;return db[_0x731b('0x57')][_0x731b('0x2f')](_0x278f97,{'type':db[_0x731b('0x58')][_0x731b('0x59')][_0x731b('0x5a')],'raw':!![],'transaction':_0x52210d});})[_0x731b('0x27')](function(_0x4fe38e){var _0x238c1b=_[_0x731b('0x2c')](_0x4fe38e,function(_0x4a4f57){return Number(_0x4a4f57[_0x731b('0x67')]);});return db['UserOpenchannelQueue'][_0x731b('0x55')]({'where':{'UserId':{'$in':_0x2d9b3c},'OpenchannelQueueId':{'$in':_0x238c1b}},'transaction':_0x52210d});})['then'](function(){var _0x1b0363=_0x731b('0x68')+_0x42ee65;return db[_0x731b('0x57')][_0x731b('0x2f')](_0x1b0363,{'type':db[_0x731b('0x58')][_0x731b('0x59')][_0x731b('0x5a')],'raw':!![],'transaction':_0x52210d});})[_0x731b('0x27')](function(_0x53fa7b){var _0x56ebf4=_[_0x731b('0x2c')](_0x53fa7b,function(_0x324a4a){return Number(_0x324a4a[_0x731b('0x69')]);});return db['UserWhatsappQueue'][_0x731b('0x55')]({'where':{'UserId':{'$in':_0x2d9b3c},'WhatsappQueueId':{'$in':_0x56ebf4}},'transaction':_0x52210d});})[_0x731b('0x27')](function(){return db[_0x731b('0x6a')]['find']({'where':{'TeamId':_0x42ee65}});})['then'](function(_0x133bc5){if(_0x133bc5===null){return;}return db[_0x731b('0x6b')][_0x731b('0x55')]({'where':{'UserId':{'$in':_0x2d9b3c},'VoicePrefixId':_0x133bc5[_0x731b('0x6c')]},'transaction':_0x52210d});})[_0x731b('0x27')](function(){return db[_0x731b('0x54')][_0x731b('0x55')]({'where':{'id':_0x42ee65},'cascade':!![],'transaction':_0x52210d});})[_0x731b('0x27')](function(_0x2bddcb){if(_0x2bddcb===0x0){_0x3bf4de[_0x731b('0x1c')](0x194);}else{return db['UserProfileResource'][_0x731b('0x55')]({'where':{'type':_0x731b('0x4e'),'resourceId':_0x42ee65},'cascade':!![],'transaction':_0x52210d})['then'](function(){_0x3bf4de[_0x731b('0x1d')](0xcc)[_0x731b('0x6d')]();});}})[_0x731b('0x44')](function(_0x5029fe){_0x3bf4de[_0x731b('0x1d')](0x1f4)['send'](_0x5029fe);});});};exports[_0x731b('0x6e')]=function(_0x47d496,_0x2fc448,_0x478bff){return db[_0x731b('0x54')]['findOne']({'where':{'id':_0x47d496['params']['id']}})[_0x731b('0x27')](handleEntityNotFound(_0x2fc448,null))['then'](function(_0x3b818f){if(!_0x47d496['query'][_0x731b('0x6f')]||!utils[_0x731b('0x70')](_0x47d496[_0x731b('0x2f')]['channel'])){throw new db[(_0x731b('0x58'))][(_0x731b('0x71'))](_0x731b('0x72'));}var _0x49ec82={};var _0x2c5585={};_0x2c5585['model']=_[_0x731b('0x30')](db[_[_0x731b('0x73')](_0x47d496[_0x731b('0x2f')][_0x731b('0x6f')]['toLowerCase']())+_0x731b('0x74')]['rawAttributes']);_0x2c5585[_0x731b('0x2f')]=_[_0x731b('0x30')](_0x47d496[_0x731b('0x2f')]);_0x2c5585['filters']=_[_0x731b('0x32')](_0x2c5585[_0x731b('0x33')],_0x2c5585[_0x731b('0x2f')]);_0x49ec82[_0x731b('0x34')]=_[_0x731b('0x32')](_0x2c5585[_0x731b('0x33')],qs[_0x731b('0x35')](_0x47d496['query']['fields']));_0x49ec82[_0x731b('0x34')]=_0x49ec82[_0x731b('0x34')][_0x731b('0x47')]?_0x49ec82[_0x731b('0x34')]:_0x2c5585[_0x731b('0x33')];_0x49ec82[_0x731b('0x1f')]=qs[_0x731b('0x1f')](_0x47d496['query'][_0x731b('0x1f')]);_0x49ec82['offset']=qs['offset'](_0x47d496[_0x731b('0x2f')]['offset']);_0x49ec82[_0x731b('0x38')]=qs[_0x731b('0x39')](_0x47d496['query'][_0x731b('0x39')]);_0x49ec82[_0x731b('0x3a')]=qs[_0x731b('0x31')](_['pick'](_0x47d496[_0x731b('0x2f')],_0x2c5585['filters']));_0x49ec82=_[_0x731b('0x3d')]({},_0x49ec82,_0x47d496['options']);return _0x3b818f[_0x731b('0x4c')+_[_0x731b('0x73')](_0x47d496[_0x731b('0x2f')][_0x731b('0x6f')][_0x731b('0x75')]())+_0x731b('0x76')](_0x49ec82);})[_0x731b('0x27')](respondWithResult(_0x2fc448,null))['catch'](handleError(_0x2fc448,null));};exports[_0x731b('0x77')]=function(_0x50c0eb,_0x3f1664,_0x1f1285){return db[_0x731b('0x54')][_0x731b('0x78')]({'where':{'id':_0x50c0eb[_0x731b('0x46')]['id']}})[_0x731b('0x27')](function(_0x3900c0){if(_0x3900c0){if(!_0x50c0eb[_0x731b('0x4a')][_0x731b('0x6f')]||!utils[_0x731b('0x70')](_0x50c0eb[_0x731b('0x4a')][_0x731b('0x6f')])){throw new db[(_0x731b('0x58'))][(_0x731b('0x71'))](_0x731b('0x72'));}return _0x3900c0[_0x731b('0x79')+_[_0x731b('0x73')](_0x50c0eb[_0x731b('0x4a')]['channel']['toLowerCase']())+_0x731b('0x76')](_0x50c0eb['body'][_0x731b('0x7a')]);}return null;})[_0x731b('0x27')](handleEntityNotFound(_0x3f1664,null))['then'](respondWithStatusCode(_0x3f1664,null))[_0x731b('0x44')](handleError(_0x3f1664,null));};exports[_0x731b('0x7b')]=function(_0x5dad04,_0x523b8b,_0x129517){return db['Team'][_0x731b('0x78')]({'where':{'id':_0x5dad04[_0x731b('0x46')]['id']}})[_0x731b('0x27')](function(_0xae40ab){if(_0xae40ab){if(!_0x5dad04['query'][_0x731b('0x6f')]||!utils[_0x731b('0x70')](_0x5dad04[_0x731b('0x2f')][_0x731b('0x6f')])){throw new db['Sequelize'][(_0x731b('0x71'))](_0x731b('0x72'));}return _0xae40ab[_0x731b('0x7c')+_[_0x731b('0x73')](_0x5dad04[_0x731b('0x2f')][_0x731b('0x6f')]['toLowerCase']())+'Queues'](_0x5dad04['query']['ids']);}return null;})[_0x731b('0x27')](handleEntityNotFound(_0x523b8b,null))['then'](respondWithStatusCode(_0x523b8b,null))[_0x731b('0x44')](handleError(_0x523b8b,null));};exports['addAgents']=function(_0x36d4f8,_0x4bb66a){var _0x16ffd2=_[_0x731b('0x7d')](_0x36d4f8[_0x731b('0x4a')][_0x731b('0x7a')])?_0x36d4f8['body']['ids']:[_0x36d4f8[_0x731b('0x4a')][_0x731b('0x7a')]];var _0x5d69ac=_0x36d4f8['params']['id'];return db[_0x731b('0x54')][_0x731b('0x48')]({'where':{'id':_0x5d69ac}})['then'](handleEntityNotFound(_0x4bb66a,null))[_0x731b('0x27')](function(_0x5ce09c){if(_0x5ce09c){var _0x1b7c1a=[_0x731b('0x7e'),_0x731b('0x7f'),_0x731b('0x80'),'Sms',_0x731b('0x81'),_0x731b('0x82'),_0x731b('0x83')];return db[_0x731b('0x57')][_0x731b('0x56')](function(_0x16d9b2){var _0x161f1e=_['map'](_0x1b7c1a,function(_0x130c8c){var _0x48b34c={'attributes':['id','name']};if(_0x130c8c===_0x731b('0x7e')){_0x48b34c[_0x731b('0x84')]={'attributes':['penalty']};}return _0x5ce09c['get'+_0x130c8c+_0x731b('0x76')](_0x48b34c)[_0x731b('0x27')](function(_0xcd11b1){var _0x2fa019=_['map'](_0xcd11b1,function(_0x388729){var _0x2c8de6=_['map'](_0x16ffd2,function(_0x275911){var _0x2365aa={'where':{'UserId':_0x275911,[_0x130c8c+_0x731b('0x85')]:_0x388729['id']},'transaction':_0x16d9b2};if(_0x130c8c===_0x731b('0x7e')){_0x2365aa['defaults']={'penalty':_0x388729[_0x731b('0x86')][_0x731b('0x87')]};}return db[_0x731b('0x88')+_0x130c8c+'Queue'][_0x731b('0x89')](_0x2365aa)[_0x731b('0x27')](function(){socket[_0x731b('0x8a')](_0x731b('0x4b')+_0x130c8c+_0x731b('0x8b'),{'UserId':_0x275911,[_0x130c8c+'QueueId']:_0x388729['id']});if(_0x130c8c!==_0x731b('0x7e')){return;}return db[_0x731b('0x88')][_0x731b('0x42')]({'where':{'id':_0x16ffd2,'online':0x1},'attributes':['id','name',_0x731b('0x8c'),_0x731b('0x8d'),_0x731b('0x8e')],'raw':!![]})['then'](function(_0x3235eb){var _0x52e902=_[_0x731b('0x2c')](_0x3235eb,function(_0x2f7e2c){return db[_0x731b('0x8f')]['upsert']({'membername':_0x2f7e2c[_0x731b('0x2a')],'UserId':_0x2f7e2c['id'],'queue_name':_0x388729[_0x731b('0x2a')],'VoiceQueueId':_0x388729['id'],'interface':_[_0x731b('0x90')](_0x2f7e2c['interface'])?util[_0x731b('0x91')](_0x731b('0x92'),_0x2f7e2c[_0x731b('0x2a')]):_0x2f7e2c['interface'],'paused':_0x2f7e2c[_0x731b('0x8d')]||![],'penalty':_0x388729[_0x731b('0x86')][_0x731b('0x87')]},{'transaction':_0x16d9b2});});return Promise['all'](_0x52e902);});});});return Promise[_0x731b('0x93')](_0x2c8de6);});return Promise[_0x731b('0x93')](_0x2fa019);})[_0x731b('0x27')](function(){return db[_0x731b('0x6a')]['findOne']({'where':{'teamId':_0x5d69ac}})[_0x731b('0x27')](function(_0x4408f2){if(_0x4408f2){var _0x89eb62=_[_0x731b('0x2c')](_0x16ffd2,function(_0x5979b3){db[_0x731b('0x6b')][_0x731b('0x94')]({'UserId':_0x5979b3,'VoicePrefixId':_0x4408f2[_0x731b('0x6c')]});});return Promise[_0x731b('0x93')](_0x89eb62);}});});});return Promise['all'](_0x161f1e)[_0x731b('0x27')](function(){return _0x5ce09c[_0x731b('0x95')](_0x16ffd2,{'transaction':_0x16d9b2})[_0x731b('0x96')](function(_0x5960fc){return _0x5960fc;});});});}})[_0x731b('0x27')](respondWithResult(_0x4bb66a,null))[_0x731b('0x44')](handleError(_0x4bb66a,null));};exports[_0x731b('0x97')]=function(_0x2957e7,_0x23c33f){var _0x1dd579=_[_0x731b('0x7d')](_0x2957e7[_0x731b('0x2f')]['ids'])?_0x2957e7[_0x731b('0x2f')][_0x731b('0x7a')]:[_0x2957e7['query'][_0x731b('0x7a')]];var _0x221046=_0x2957e7['params']['id'];return db[_0x731b('0x54')][_0x731b('0x48')]({'where':{'id':_0x221046}})[_0x731b('0x27')](handleEntityNotFound(_0x23c33f,null))[_0x731b('0x27')](function(_0x182e31){if(_0x182e31){var _0x245fe4=[_0x731b('0x7e'),_0x731b('0x7f'),_0x731b('0x80'),'Sms',_0x731b('0x81'),_0x731b('0x82'),'Whatsapp'];return db[_0x731b('0x57')][_0x731b('0x56')](function(_0x1f0aa5){var _0x32987d=_[_0x731b('0x2c')](_0x245fe4,function(_0x115b70){var _0x28bb80={'attributes':['id','name']};return _0x182e31[_0x731b('0x4c')+_0x115b70+_0x731b('0x76')](_0x28bb80)['then'](function(_0x52d0d5){var _0x24b0be=_[_0x731b('0x2c')](_0x52d0d5,function(_0x55d17b){return _0x55d17b[_0x731b('0x97')](_0x1dd579,{'transaction':_0x1f0aa5})[_0x731b('0x27')](function(){var _0x3cdb67=_[_0x731b('0x2c')](_0x1dd579,function(_0x5bc1de){socket[_0x731b('0x8a')](_0x731b('0x4b')+_0x115b70+_0x731b('0x98'),{'UserId':Number(_0x5bc1de),[_0x115b70+'QueueId']:_0x55d17b['id']});if(_0x115b70!==_0x731b('0x7e')){return;}return db[_0x731b('0x8f')]['destroy']({'where':{'VoiceQueueId':_0x55d17b['id'],'UserId':_0x5bc1de},'transaction':_0x1f0aa5});});return Promise[_0x731b('0x93')](_0x3cdb67);});});return Promise[_0x731b('0x93')](_0x24b0be);});});return Promise['all'](_0x32987d)[_0x731b('0x27')](function(){return _0x182e31[_0x731b('0x97')](_0x1dd579,{'transaction':_0x1f0aa5});})[_0x731b('0x27')](function(){return db[_0x731b('0x6a')][_0x731b('0x78')]({'where':{'teamId':_0x221046}})[_0x731b('0x27')](function(_0x5a3501){if(_0x5a3501){var _0x5631be=_[_0x731b('0x2c')](_0x1dd579,function(_0x369572){db[_0x731b('0x6b')][_0x731b('0x55')]({'where':{'UserId':_0x369572,'VoicePrefixId':_0x5a3501[_0x731b('0x6c')]}});});return Promise[_0x731b('0x93')](_0x5631be);}});});});}})[_0x731b('0x27')](respondWithStatusCode(_0x23c33f,null))[_0x731b('0x44')](handleError(_0x23c33f,null));};exports[_0x731b('0x99')]=function(_0x5d7711,_0x4da67d,_0x23d09c){var _0x151b4a={};var _0x2264f2={};var _0x1bee9a;var _0x4d2d1b;return db[_0x731b('0x54')][_0x731b('0x78')]({'where':{'id':_0x5d7711[_0x731b('0x46')]['id']}})['then'](handleEntityNotFound(_0x4da67d,null))[_0x731b('0x27')](function(_0x5dbf4b){if(_0x5dbf4b){_0x1bee9a=_0x5dbf4b;_0x2264f2[_0x731b('0x33')]=_[_0x731b('0x30')](db['User'][_0x731b('0x2d')]);_0x2264f2['query']=_['keys'](_0x5d7711[_0x731b('0x2f')]);_0x2264f2[_0x731b('0x31')]=_[_0x731b('0x32')](_0x2264f2['model'],_0x2264f2[_0x731b('0x2f')]);_0x151b4a[_0x731b('0x34')]=_[_0x731b('0x32')](_0x2264f2[_0x731b('0x33')],qs[_0x731b('0x35')](_0x5d7711[_0x731b('0x2f')][_0x731b('0x35')]));_0x151b4a[_0x731b('0x34')]=_0x151b4a[_0x731b('0x34')]['length']?_0x151b4a[_0x731b('0x34')]:_0x2264f2[_0x731b('0x33')];_0x151b4a[_0x731b('0x38')]=qs['sort'](_0x5d7711[_0x731b('0x2f')][_0x731b('0x39')]);_0x151b4a['where']=qs['filters'](_['pick'](_0x5d7711[_0x731b('0x2f')],_0x2264f2[_0x731b('0x31')]));if(_0x5d7711[_0x731b('0x2f')][_0x731b('0x3c')]){_0x151b4a['where']=_[_0x731b('0x3d')](_0x151b4a['where'],{'$or':_[_0x731b('0x2c')](_0x151b4a[_0x731b('0x34')],function(_0x89ea1e){var _0x452023={};_0x452023[_0x89ea1e]={'$like':'%'+_0x5d7711[_0x731b('0x2f')]['filter']+'%'};return _0x452023;})});}_0x151b4a=_[_0x731b('0x3d')]({},_0x151b4a,_0x5d7711['options']);return _0x1bee9a[_0x731b('0x99')](_0x151b4a);}})[_0x731b('0x27')](function(_0x32a49b){if(_0x32a49b){_0x4d2d1b=_0x32a49b['length'];if(!_0x5d7711[_0x731b('0x2f')][_0x731b('0x36')](_0x731b('0x37'))){_0x151b4a[_0x731b('0x1f')]=qs[_0x731b('0x1f')](_0x5d7711[_0x731b('0x2f')][_0x731b('0x1f')]);_0x151b4a[_0x731b('0x22')]=qs['offset'](_0x5d7711[_0x731b('0x2f')][_0x731b('0x22')]);}return _0x1bee9a['getAgents'](_0x151b4a);}})[_0x731b('0x27')](function(_0x4389a8){if(_0x4389a8){return _0x4389a8?{'count':_0x4d2d1b,'rows':_0x4389a8}:null;}})[_0x731b('0x27')](respondWithResult(_0x4da67d,null))['catch'](handleError(_0x4da67d,null));}; \ No newline at end of file +var _0x5715=['to-csv','ejs','fs-extra','squel','crypto','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./team.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','name','send','index','map','Team','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','nolimit','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','show','params','keys','find','create','body','get','role','user','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','sequelize','transaction','QueryTypes','SELECT','VoiceQueueId','destroy','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','Sequelize','MailQueueId','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','UserSmsQueue','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','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','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','Teams','findOne','isValidChannel','channel','Queue','toLowerCase','addQueues','ids','removeQueues','Unknown\x20channel','remove','capitalize','Queues','addAgents','isArray','Voice','Chat','Sms','Fax','Openchannel','Whatsapp','penalty','TeamVoiceQueue','User','Queue:save','findAll','online','voicePause','interface','upsert','isNil','format','SIP/%s','all','removeAgents','Mail','emit','Queue:remove','QueueId','getAgents','order','zip-dir','fast-json-patch','request-promise','bluebird','path'];(function(_0x1f86e6,_0x2bdbe5){var _0x158085=function(_0x3128a6){while(--_0x3128a6){_0x1f86e6['push'](_0x1f86e6['shift']());}};_0x158085(++_0x2bdbe5);}(_0x5715,0x1ab));var _0x5571=function(_0x3ce2c4,_0x4544c1){_0x3ce2c4=_0x3ce2c4-0x0;var _0x4047c1=_0x5715[_0x3ce2c4];return _0x4047c1;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x5571('0x0'));var jsonpatch=require(_0x5571('0x1'));var rp=require(_0x5571('0x2'));var moment=require('moment');var BPromise=require(_0x5571('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x5571('0x4'));var sox=require('sox');var csv=require(_0x5571('0x5'));var ejs=require(_0x5571('0x6'));var fs=require('fs');var fs_extra=require(_0x5571('0x7'));var _=require('lodash');var squel=require(_0x5571('0x8'));var crypto=require(_0x5571('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x5571('0x5'));var querystring=require(_0x5571('0xa'));var Papa=require(_0x5571('0xb'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5571('0xc'));var as=require(_0x5571('0xd'));var hardwareService=require(_0x5571('0xe'));var logger=require('../../config/logger')(_0x5571('0xf'));var utils=require(_0x5571('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0x5571('0x11'));var db=require(_0x5571('0x12'))['db'];config[_0x5571('0x13')]=_[_0x5571('0x14')](config[_0x5571('0x13')],{'host':'localhost','port':0x18eb});var socket=require(_0x5571('0x15'))(new Redis(config[_0x5571('0x13')]));require(_0x5571('0x16'))[_0x5571('0x17')](socket);function respondWithStatusCode(_0x58b1d0,_0x316c26){_0x316c26=_0x316c26||0xcc;return function(_0x29a681){if(_0x29a681){return _0x58b1d0[_0x5571('0x18')](_0x316c26);}return _0x58b1d0[_0x5571('0x19')](_0x316c26)[_0x5571('0x1a')]();};}function respondWithResult(_0x7c486d,_0x3ac7eb){_0x3ac7eb=_0x3ac7eb||0xc8;return function(_0x2966bd){if(_0x2966bd){return _0x7c486d[_0x5571('0x19')](_0x3ac7eb)[_0x5571('0x1b')](_0x2966bd);}};}function respondWithFilteredResult(_0xbc48df,_0x596350){return function(_0x374767){if(_0x374767){var _0x5262c6=typeof _0x596350[_0x5571('0x1c')]===_0x5571('0x1d')&&typeof _0x596350[_0x5571('0x1e')]==='undefined';var _0x13e774=_0x374767[_0x5571('0x1f')];var _0x27a8e5=_0x5262c6?0x0:_0x596350[_0x5571('0x1c')];var _0x1c25ca=_0x5262c6?_0x374767[_0x5571('0x1f')]:_0x596350[_0x5571('0x1c')]+_0x596350[_0x5571('0x1e')];var _0x445b77;if(_0x1c25ca>=_0x13e774){_0x1c25ca=_0x13e774;_0x445b77=0xc8;}else{_0x445b77=0xce;}_0xbc48df[_0x5571('0x19')](_0x445b77);return _0xbc48df[_0x5571('0x20')](_0x5571('0x21'),_0x27a8e5+'-'+_0x1c25ca+'/'+_0x13e774)[_0x5571('0x1b')](_0x374767);}return null;};}function patchUpdates(_0x13ffd5){return function(_0x505c04){try{jsonpatch[_0x5571('0x22')](_0x505c04,_0x13ffd5,!![]);}catch(_0x20ff22){return BPromise[_0x5571('0x23')](_0x20ff22);}return _0x505c04[_0x5571('0x24')]();};}function saveUpdates(_0x397afd,_0x31bb27){return function(_0x1a5e8b){if(_0x1a5e8b){return _0x1a5e8b[_0x5571('0x25')](_0x397afd)[_0x5571('0x26')](function(_0x20a8d6){return _0x20a8d6;});}return null;};}function handleEntityNotFound(_0x21bbd0,_0x496681){return function(_0x2803e2){if(!_0x2803e2){_0x21bbd0[_0x5571('0x18')](0x194);}return _0x2803e2;};}function handleError(_0x5c2a6d,_0x1a7032){_0x1a7032=_0x1a7032||0x1f4;return function(_0x836434){logger[_0x5571('0x27')](_0x836434['stack']);if(_0x836434[_0x5571('0x28')]){delete _0x836434[_0x5571('0x28')];}_0x5c2a6d[_0x5571('0x19')](_0x1a7032)[_0x5571('0x29')](_0x836434);};}exports[_0x5571('0x2a')]=function(_0x2ea077,_0x6fb041){var _0x2eeb8c={},_0x36bcac={},_0x3f8e0f={'count':0x0,'rows':[]};var _0x3a1830=_[_0x5571('0x2b')](db[_0x5571('0x2c')][_0x5571('0x2d')],function(_0xc489b6){return{'name':_0xc489b6[_0x5571('0x2e')],'type':_0xc489b6[_0x5571('0x2f')][_0x5571('0x30')]};});_0x36bcac['model']=_['map'](_0x3a1830,'name');_0x36bcac[_0x5571('0x31')]=_['keys'](_0x2ea077[_0x5571('0x31')]);_0x36bcac[_0x5571('0x32')]=_[_0x5571('0x33')](_0x36bcac[_0x5571('0x34')],_0x36bcac['query']);_0x2eeb8c[_0x5571('0x35')]=_[_0x5571('0x33')](_0x36bcac['model'],qs['fields'](_0x2ea077['query'][_0x5571('0x36')]));_0x2eeb8c[_0x5571('0x35')]=_0x2eeb8c[_0x5571('0x35')][_0x5571('0x37')]?_0x2eeb8c[_0x5571('0x35')]:_0x36bcac[_0x5571('0x34')];if(!_0x2ea077['query']['hasOwnProperty'](_0x5571('0x38'))){_0x2eeb8c[_0x5571('0x1e')]=qs['limit'](_0x2ea077[_0x5571('0x31')][_0x5571('0x1e')]);_0x2eeb8c[_0x5571('0x1c')]=qs[_0x5571('0x1c')](_0x2ea077['query']['offset']);}_0x2eeb8c['order']=qs[_0x5571('0x39')](_0x2ea077[_0x5571('0x31')][_0x5571('0x39')]);_0x2eeb8c[_0x5571('0x3a')]=qs[_0x5571('0x32')](_[_0x5571('0x3b')](_0x2ea077[_0x5571('0x31')],_0x36bcac[_0x5571('0x32')]),_0x3a1830);if(_0x2ea077['query'][_0x5571('0x3c')]){_0x2eeb8c[_0x5571('0x3a')]=_[_0x5571('0x3d')](_0x2eeb8c[_0x5571('0x3a')],{'$or':_[_0x5571('0x2b')](_0x3a1830,function(_0x59d820){if(_0x59d820[_0x5571('0x2f')]!=='VIRTUAL'){var _0x17e307={};_0x17e307[_0x59d820[_0x5571('0x28')]]={'$like':'%'+_0x2ea077['query'][_0x5571('0x3c')]+'%'};return _0x17e307;}})});}_0x2eeb8c=_[_0x5571('0x3d')]({},_0x2eeb8c,_0x2ea077[_0x5571('0x3e')]);var _0x57c3f9={'where':_0x2eeb8c[_0x5571('0x3a')]};return db[_0x5571('0x2c')][_0x5571('0x1f')](_0x57c3f9)[_0x5571('0x26')](function(_0x5ea65f){_0x3f8e0f[_0x5571('0x1f')]=_0x5ea65f;if(_0x2ea077[_0x5571('0x31')][_0x5571('0x3f')]){_0x2eeb8c[_0x5571('0x40')]=[{'all':!![]}];}return db[_0x5571('0x2c')]['findAll'](_0x2eeb8c);})[_0x5571('0x26')](function(_0x5261f9){_0x3f8e0f[_0x5571('0x41')]=_0x5261f9;return _0x3f8e0f;})['then'](respondWithFilteredResult(_0x6fb041,_0x2eeb8c))[_0x5571('0x42')](handleError(_0x6fb041,null));};exports[_0x5571('0x43')]=function(_0x3642f6,_0x459f2b){var _0x5608a5={'raw':![],'where':{'id':_0x3642f6[_0x5571('0x44')]['id']}},_0x327a1f={};_0x327a1f[_0x5571('0x34')]=_[_0x5571('0x45')](db[_0x5571('0x2c')][_0x5571('0x2d')]);_0x327a1f[_0x5571('0x31')]=_['keys'](_0x3642f6[_0x5571('0x31')]);_0x327a1f[_0x5571('0x32')]=_[_0x5571('0x33')](_0x327a1f['model'],_0x327a1f[_0x5571('0x31')]);_0x5608a5[_0x5571('0x35')]=_[_0x5571('0x33')](_0x327a1f[_0x5571('0x34')],qs[_0x5571('0x36')](_0x3642f6[_0x5571('0x31')][_0x5571('0x36')]));_0x5608a5[_0x5571('0x35')]=_0x5608a5[_0x5571('0x35')][_0x5571('0x37')]?_0x5608a5['attributes']:_0x327a1f[_0x5571('0x34')];if(_0x3642f6[_0x5571('0x31')][_0x5571('0x3f')]){_0x5608a5[_0x5571('0x40')]=[{'all':!![]}];}_0x5608a5=_['merge']({},_0x5608a5,_0x3642f6[_0x5571('0x3e')]);return db[_0x5571('0x2c')][_0x5571('0x46')](_0x5608a5)[_0x5571('0x26')](handleEntityNotFound(_0x459f2b,null))[_0x5571('0x26')](respondWithResult(_0x459f2b,null))[_0x5571('0x42')](handleError(_0x459f2b,null));};exports['create']=function(_0x2154bc,_0x38889c){return db[_0x5571('0x2c')][_0x5571('0x47')](_0x2154bc[_0x5571('0x48')],{})[_0x5571('0x26')](function(_0x327e36){var _0x2e1666=_0x2154bc['user'][_0x5571('0x49')]({'plain':!![]});if(!_0x2e1666)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2e1666[_0x5571('0x4a')]===_0x5571('0x4b')){var _0x1eac11=_0x327e36[_0x5571('0x49')]({'plain':!![]});var _0x279de1='Teams';return db[_0x5571('0x4c')][_0x5571('0x46')]({'where':{'name':_0x279de1,'userProfileId':_0x2e1666['userProfileId']},'raw':!![]})[_0x5571('0x26')](function(_0x3851d8){if(_0x3851d8&&_0x3851d8[_0x5571('0x4d')]===0x0){return db[_0x5571('0x4e')][_0x5571('0x47')]({'name':_0x1eac11['name'],'resourceId':_0x1eac11['id'],'type':_0x3851d8[_0x5571('0x28')],'sectionId':_0x3851d8['id']},{})[_0x5571('0x26')](function(){return _0x327e36;});}else{return _0x327e36;}})[_0x5571('0x42')](function(_0x2397a2){logger[_0x5571('0x27')](_0x5571('0x4f'),_0x2397a2);throw _0x2397a2;});}return _0x327e36;})['then'](respondWithResult(_0x38889c,0xc9))[_0x5571('0x42')](handleError(_0x38889c,null));};exports[_0x5571('0x25')]=function(_0x231507,_0x241d5e){if(_0x231507[_0x5571('0x48')]['id']){delete _0x231507[_0x5571('0x48')]['id'];}return db[_0x5571('0x2c')][_0x5571('0x46')]({'where':{'id':_0x231507[_0x5571('0x44')]['id']}})['then'](handleEntityNotFound(_0x241d5e,null))[_0x5571('0x26')](saveUpdates(_0x231507[_0x5571('0x48')],null))['then'](respondWithResult(_0x241d5e,null))[_0x5571('0x42')](handleError(_0x241d5e,null));};exports['destroy']=function(_0x544fe3,_0x55d23d){var _0x29f0f2=_0x544fe3[_0x5571('0x44')]['id'];var _0x465d34=[];return db[_0x5571('0x50')][_0x5571('0x51')](function(_0x44ea17){var _0x52a1b8='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0x29f0f2;return db[_0x5571('0x50')][_0x5571('0x31')](_0x52a1b8,{'type':db['Sequelize'][_0x5571('0x52')][_0x5571('0x53')],'raw':!![],'transaction':_0x44ea17})[_0x5571('0x26')](function(_0x413378){_0x465d34=_['map'](_0x413378,function(_0x5c414b){return Number(_0x5c414b['UserId']);});})[_0x5571('0x26')](function(){var _0x3171a6='SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20'+_0x29f0f2;return db[_0x5571('0x50')][_0x5571('0x31')](_0x3171a6,{'type':db['Sequelize'][_0x5571('0x52')][_0x5571('0x53')],'raw':!![],'transaction':_0x44ea17});})[_0x5571('0x26')](function(_0xe97e79){var _0x48452c=_[_0x5571('0x2b')](_0xe97e79,function(_0x4bba45){return Number(_0x4bba45[_0x5571('0x54')]);});return db['UserVoiceQueue'][_0x5571('0x55')]({'where':{'UserId':{'$in':_0x465d34},'VoiceQueueId':{'$in':_0x48452c}},'transaction':_0x44ea17});})[_0x5571('0x26')](function(){var _0x593b3f=_0x5571('0x56')+_0x29f0f2;return db['sequelize'][_0x5571('0x31')](_0x593b3f,{'type':db[_0x5571('0x57')][_0x5571('0x52')][_0x5571('0x53')],'raw':!![],'transaction':_0x44ea17});})[_0x5571('0x26')](function(_0x26568f){var _0x35020e=_[_0x5571('0x2b')](_0x26568f,function(_0x279b4c){return Number(_0x279b4c[_0x5571('0x58')]);});return db['UserMailQueue'][_0x5571('0x55')]({'where':{'UserId':{'$in':_0x465d34},'MailQueueId':{'$in':_0x35020e}},'transaction':_0x44ea17});})[_0x5571('0x26')](function(){var _0x2657d1=_0x5571('0x59')+_0x29f0f2;return db[_0x5571('0x50')][_0x5571('0x31')](_0x2657d1,{'type':db[_0x5571('0x57')][_0x5571('0x52')][_0x5571('0x53')],'raw':!![],'transaction':_0x44ea17});})['then'](function(_0x52c7e){var _0x25a518=_[_0x5571('0x2b')](_0x52c7e,function(_0xe739d9){return Number(_0xe739d9['SmsQueueId']);});return db[_0x5571('0x5a')][_0x5571('0x55')]({'where':{'UserId':{'$in':_0x465d34},'SmsQueueId':{'$in':_0x25a518}},'transaction':_0x44ea17});})[_0x5571('0x26')](function(){var _0x38e456='SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20'+_0x29f0f2;return db[_0x5571('0x50')]['query'](_0x38e456,{'type':db[_0x5571('0x57')][_0x5571('0x52')][_0x5571('0x53')],'raw':!![],'transaction':_0x44ea17});})['then'](function(_0x30e81f){var _0x43e2b6=_[_0x5571('0x2b')](_0x30e81f,function(_0x4134e0){return Number(_0x4134e0['ChatQueueId']);});return db[_0x5571('0x5b')]['destroy']({'where':{'UserId':{'$in':_0x465d34},'ChatQueueId':{'$in':_0x43e2b6}},'transaction':_0x44ea17});})[_0x5571('0x26')](function(){var _0x28dd81=_0x5571('0x5c')+_0x29f0f2;return db[_0x5571('0x50')][_0x5571('0x31')](_0x28dd81,{'type':db[_0x5571('0x57')][_0x5571('0x52')][_0x5571('0x53')],'raw':!![],'transaction':_0x44ea17});})[_0x5571('0x26')](function(_0x419a98){var _0xa90c2d=_[_0x5571('0x2b')](_0x419a98,function(_0x386e38){return Number(_0x386e38['FaxQueueId']);});return db[_0x5571('0x5d')][_0x5571('0x55')]({'where':{'UserId':{'$in':_0x465d34},'FaxQueueId':{'$in':_0xa90c2d}},'transaction':_0x44ea17});})[_0x5571('0x26')](function(){var _0xa5471=_0x5571('0x5e')+_0x29f0f2;return db[_0x5571('0x50')][_0x5571('0x31')](_0xa5471,{'type':db[_0x5571('0x57')]['QueryTypes'][_0x5571('0x53')],'raw':!![],'transaction':_0x44ea17});})['then'](function(_0x361a1a){var _0x3986a5=_[_0x5571('0x2b')](_0x361a1a,function(_0x2e7902){return Number(_0x2e7902[_0x5571('0x5f')]);});return db[_0x5571('0x60')][_0x5571('0x55')]({'where':{'UserId':{'$in':_0x465d34},'OpenchannelQueueId':{'$in':_0x3986a5}},'transaction':_0x44ea17});})[_0x5571('0x26')](function(){var _0x3af011=_0x5571('0x61')+_0x29f0f2;return db[_0x5571('0x50')][_0x5571('0x31')](_0x3af011,{'type':db[_0x5571('0x57')][_0x5571('0x52')][_0x5571('0x53')],'raw':!![],'transaction':_0x44ea17});})[_0x5571('0x26')](function(_0x4c2313){var _0x1d338c=_[_0x5571('0x2b')](_0x4c2313,function(_0x263bf2){return Number(_0x263bf2[_0x5571('0x62')]);});return db[_0x5571('0x63')]['destroy']({'where':{'UserId':{'$in':_0x465d34},'WhatsappQueueId':{'$in':_0x1d338c}},'transaction':_0x44ea17});})[_0x5571('0x26')](function(){return db[_0x5571('0x64')][_0x5571('0x46')]({'where':{'TeamId':_0x29f0f2}});})['then'](function(_0x4fff69){if(_0x4fff69===null){return;}return db[_0x5571('0x65')][_0x5571('0x55')]({'where':{'UserId':{'$in':_0x465d34},'VoicePrefixId':_0x4fff69[_0x5571('0x66')]},'transaction':_0x44ea17});})[_0x5571('0x26')](function(){return db[_0x5571('0x2c')][_0x5571('0x55')]({'where':{'id':_0x29f0f2},'cascade':!![],'transaction':_0x44ea17});})[_0x5571('0x26')](function(_0x2a321c){if(_0x2a321c===0x0){_0x55d23d['sendStatus'](0x194);}else{return db[_0x5571('0x4e')][_0x5571('0x55')]({'where':{'type':_0x5571('0x67'),'resourceId':_0x29f0f2},'cascade':!![],'transaction':_0x44ea17})[_0x5571('0x26')](function(){_0x55d23d[_0x5571('0x19')](0xcc)['end']();});}})['catch'](function(_0xb8665f){_0x55d23d['status'](0x1f4)[_0x5571('0x29')](_0xb8665f);});});};exports['getQueues']=function(_0x1b160d,_0x2904b5,_0x3733c0){return db[_0x5571('0x2c')][_0x5571('0x68')]({'where':{'id':_0x1b160d[_0x5571('0x44')]['id']}})[_0x5571('0x26')](handleEntityNotFound(_0x2904b5,null))[_0x5571('0x26')](function(_0x4f733d){if(!_0x1b160d[_0x5571('0x31')]['channel']||!utils[_0x5571('0x69')](_0x1b160d[_0x5571('0x31')]['channel'])){throw new db[(_0x5571('0x57'))]['ValidationError']('Unknown\x20channel');}var _0x47861f={};var _0x1b9e43={};_0x1b9e43[_0x5571('0x34')]=_[_0x5571('0x45')](db[_['capitalize'](_0x1b160d[_0x5571('0x31')][_0x5571('0x6a')]['toLowerCase']())+_0x5571('0x6b')][_0x5571('0x2d')]);_0x1b9e43[_0x5571('0x31')]=_[_0x5571('0x45')](_0x1b160d[_0x5571('0x31')]);_0x1b9e43[_0x5571('0x32')]=_[_0x5571('0x33')](_0x1b9e43[_0x5571('0x34')],_0x1b9e43[_0x5571('0x31')]);_0x47861f[_0x5571('0x35')]=_['intersection'](_0x1b9e43['model'],qs[_0x5571('0x36')](_0x1b160d[_0x5571('0x31')]['fields']));_0x47861f[_0x5571('0x35')]=_0x47861f['attributes'][_0x5571('0x37')]?_0x47861f[_0x5571('0x35')]:_0x1b9e43[_0x5571('0x34')];_0x47861f[_0x5571('0x1e')]=qs[_0x5571('0x1e')](_0x1b160d[_0x5571('0x31')][_0x5571('0x1e')]);_0x47861f[_0x5571('0x1c')]=qs['offset'](_0x1b160d['query']['offset']);_0x47861f['order']=qs[_0x5571('0x39')](_0x1b160d[_0x5571('0x31')]['sort']);_0x47861f[_0x5571('0x3a')]=qs[_0x5571('0x32')](_[_0x5571('0x3b')](_0x1b160d[_0x5571('0x31')],_0x1b9e43['filters']));_0x47861f=_['merge']({},_0x47861f,_0x1b160d[_0x5571('0x3e')]);return _0x4f733d[_0x5571('0x49')+_['capitalize'](_0x1b160d[_0x5571('0x31')][_0x5571('0x6a')][_0x5571('0x6c')]())+'Queues'](_0x47861f);})[_0x5571('0x26')](respondWithResult(_0x2904b5,null))[_0x5571('0x42')](handleError(_0x2904b5,null));};exports[_0x5571('0x6d')]=function(_0x3ed455,_0x40648d,_0x5181a5){return db['Team'][_0x5571('0x68')]({'where':{'id':_0x3ed455[_0x5571('0x44')]['id']}})['then'](function(_0x57a278){if(_0x57a278){if(!_0x3ed455[_0x5571('0x48')]['channel']||!utils[_0x5571('0x69')](_0x3ed455['body'][_0x5571('0x6a')])){throw new db[(_0x5571('0x57'))]['ValidationError']('Unknown\x20channel');}return _0x57a278['add'+_['capitalize'](_0x3ed455[_0x5571('0x48')][_0x5571('0x6a')][_0x5571('0x6c')]())+'Queues'](_0x3ed455[_0x5571('0x48')][_0x5571('0x6e')]);}return null;})[_0x5571('0x26')](handleEntityNotFound(_0x40648d,null))['then'](respondWithStatusCode(_0x40648d,null))[_0x5571('0x42')](handleError(_0x40648d,null));};exports[_0x5571('0x6f')]=function(_0x55720d,_0xe9a430,_0x2b0a4b){return db['Team'][_0x5571('0x68')]({'where':{'id':_0x55720d[_0x5571('0x44')]['id']}})['then'](function(_0x31e7a8){if(_0x31e7a8){if(!_0x55720d[_0x5571('0x31')][_0x5571('0x6a')]||!utils[_0x5571('0x69')](_0x55720d[_0x5571('0x31')][_0x5571('0x6a')])){throw new db[(_0x5571('0x57'))]['ValidationError'](_0x5571('0x70'));}return _0x31e7a8[_0x5571('0x71')+_[_0x5571('0x72')](_0x55720d[_0x5571('0x31')]['channel'][_0x5571('0x6c')]())+_0x5571('0x73')](_0x55720d[_0x5571('0x31')][_0x5571('0x6e')]);}return null;})['then'](handleEntityNotFound(_0xe9a430,null))[_0x5571('0x26')](respondWithStatusCode(_0xe9a430,null))[_0x5571('0x42')](handleError(_0xe9a430,null));};exports[_0x5571('0x74')]=function(_0x2e767a,_0x264906){var _0x2de8d1=_[_0x5571('0x75')](_0x2e767a[_0x5571('0x48')]['ids'])?_0x2e767a[_0x5571('0x48')][_0x5571('0x6e')]:[_0x2e767a['body'][_0x5571('0x6e')]];var _0x4c2bd5=_0x2e767a[_0x5571('0x44')]['id'];return db['Team']['find']({'where':{'id':_0x4c2bd5}})[_0x5571('0x26')](handleEntityNotFound(_0x264906,null))[_0x5571('0x26')](function(_0x22f57d){if(_0x22f57d){var _0xe93117=[_0x5571('0x76'),_0x5571('0x77'),'Mail',_0x5571('0x78'),_0x5571('0x79'),_0x5571('0x7a'),_0x5571('0x7b')];return db[_0x5571('0x50')][_0x5571('0x51')](function(_0xb969c6){var _0x88cea8=_[_0x5571('0x2b')](_0xe93117,function(_0xf3a957){var _0x8fe908={'attributes':['id',_0x5571('0x28')]};if(_0xf3a957==='Voice'){_0x8fe908['through']={'attributes':[_0x5571('0x7c')]};}return _0x22f57d[_0x5571('0x49')+_0xf3a957+_0x5571('0x73')](_0x8fe908)[_0x5571('0x26')](function(_0x1cd985){var _0x18e850=_[_0x5571('0x2b')](_0x1cd985,function(_0x4f4d9a){var _0x2097a9=_[_0x5571('0x2b')](_0x2de8d1,function(_0x22467c){var _0x1943e6={'where':{'UserId':_0x22467c,[_0xf3a957+'QueueId']:_0x4f4d9a['id']},'transaction':_0xb969c6};if(_0xf3a957===_0x5571('0x76')){_0x1943e6['defaults']={'penalty':_0x4f4d9a[_0x5571('0x7d')][_0x5571('0x7c')]};}return db[_0x5571('0x7e')+_0xf3a957+'Queue']['findOrCreate'](_0x1943e6)[_0x5571('0x26')](function(){socket['emit'](_0x5571('0x4b')+_0xf3a957+_0x5571('0x7f'),{'UserId':_0x22467c,[_0xf3a957+'QueueId']:_0x4f4d9a['id']});if(_0xf3a957!=='Voice'){return;}return db[_0x5571('0x7e')][_0x5571('0x80')]({'where':{'id':_0x2de8d1,'online':0x1},'attributes':['id',_0x5571('0x28'),_0x5571('0x81'),_0x5571('0x82'),_0x5571('0x83')],'raw':!![]})[_0x5571('0x26')](function(_0x526163){var _0x151a52=_[_0x5571('0x2b')](_0x526163,function(_0x5bbbde){return db['UserVoiceQueueRt'][_0x5571('0x84')]({'membername':_0x5bbbde[_0x5571('0x28')],'UserId':_0x5bbbde['id'],'queue_name':_0x4f4d9a['name'],'VoiceQueueId':_0x4f4d9a['id'],'interface':_[_0x5571('0x85')](_0x5bbbde[_0x5571('0x83')])?util[_0x5571('0x86')](_0x5571('0x87'),_0x5bbbde[_0x5571('0x28')]):_0x5bbbde[_0x5571('0x83')],'paused':_0x5bbbde[_0x5571('0x82')]||![],'penalty':_0x4f4d9a[_0x5571('0x7d')]['penalty']},{'transaction':_0xb969c6});});return Promise[_0x5571('0x88')](_0x151a52);});});});return Promise[_0x5571('0x88')](_0x2097a9);});return Promise['all'](_0x18e850);})[_0x5571('0x26')](function(){return db['TeamVoicePrefix'][_0x5571('0x68')]({'where':{'teamId':_0x4c2bd5}})['then'](function(_0x4fa11e){if(_0x4fa11e){var _0x2f5190=_[_0x5571('0x2b')](_0x2de8d1,function(_0x10a0c0){db[_0x5571('0x65')]['upsert']({'UserId':_0x10a0c0,'VoicePrefixId':_0x4fa11e[_0x5571('0x66')]});});return Promise[_0x5571('0x88')](_0x2f5190);}});});});return Promise[_0x5571('0x88')](_0x88cea8)[_0x5571('0x26')](function(){return _0x22f57d[_0x5571('0x74')](_0x2de8d1,{'transaction':_0xb969c6})['spread'](function(_0x3cbb5d){return _0x3cbb5d;});});});}})[_0x5571('0x26')](respondWithResult(_0x264906,null))[_0x5571('0x42')](handleError(_0x264906,null));};exports[_0x5571('0x89')]=function(_0x17b57b,_0x800106){var _0x50360b=_[_0x5571('0x75')](_0x17b57b['query'][_0x5571('0x6e')])?_0x17b57b['query']['ids']:[_0x17b57b[_0x5571('0x31')][_0x5571('0x6e')]];var _0x3c1e52=_0x17b57b['params']['id'];return db['Team'][_0x5571('0x46')]({'where':{'id':_0x3c1e52}})[_0x5571('0x26')](handleEntityNotFound(_0x800106,null))[_0x5571('0x26')](function(_0x145bb3){if(_0x145bb3){var _0x134c27=[_0x5571('0x76'),'Chat',_0x5571('0x8a'),_0x5571('0x78'),_0x5571('0x79'),_0x5571('0x7a'),_0x5571('0x7b')];return db[_0x5571('0x50')][_0x5571('0x51')](function(_0x5af818){var _0x27ec48=_[_0x5571('0x2b')](_0x134c27,function(_0xd91463){var _0x2e85e9={'attributes':['id',_0x5571('0x28')]};return _0x145bb3['get'+_0xd91463+'Queues'](_0x2e85e9)[_0x5571('0x26')](function(_0x560382){var _0x3df382=_[_0x5571('0x2b')](_0x560382,function(_0x48800a){return _0x48800a[_0x5571('0x89')](_0x50360b,{'transaction':_0x5af818})[_0x5571('0x26')](function(){var _0xa66b76=_[_0x5571('0x2b')](_0x50360b,function(_0x29c33f){socket[_0x5571('0x8b')]('user'+_0xd91463+_0x5571('0x8c'),{'UserId':Number(_0x29c33f),[_0xd91463+_0x5571('0x8d')]:_0x48800a['id']});if(_0xd91463!=='Voice'){return;}return db['UserVoiceQueueRt'][_0x5571('0x55')]({'where':{'VoiceQueueId':_0x48800a['id'],'UserId':_0x29c33f},'transaction':_0x5af818});});return Promise[_0x5571('0x88')](_0xa66b76);});});return Promise[_0x5571('0x88')](_0x3df382);});});return Promise[_0x5571('0x88')](_0x27ec48)[_0x5571('0x26')](function(){return _0x145bb3['removeAgents'](_0x50360b,{'transaction':_0x5af818});})['then'](function(){return db[_0x5571('0x64')][_0x5571('0x68')]({'where':{'teamId':_0x3c1e52}})[_0x5571('0x26')](function(_0xf2854a){if(_0xf2854a){var _0x30e56f=_['map'](_0x50360b,function(_0x198e47){db[_0x5571('0x65')][_0x5571('0x55')]({'where':{'UserId':_0x198e47,'VoicePrefixId':_0xf2854a[_0x5571('0x66')]}});});return Promise[_0x5571('0x88')](_0x30e56f);}});});});}})[_0x5571('0x26')](respondWithStatusCode(_0x800106,null))[_0x5571('0x42')](handleError(_0x800106,null));};exports[_0x5571('0x8e')]=function(_0x5ea5e9,_0x10e3f2,_0x52a6e1){var _0xfec6b0={};var _0xdee023={};var _0x2aa6ed;var _0x2aea9b;return db[_0x5571('0x2c')][_0x5571('0x68')]({'where':{'id':_0x5ea5e9['params']['id']}})[_0x5571('0x26')](handleEntityNotFound(_0x10e3f2,null))[_0x5571('0x26')](function(_0x22dba6){if(_0x22dba6){_0x2aa6ed=_0x22dba6;_0xdee023['model']=_['keys'](db[_0x5571('0x7e')][_0x5571('0x2d')]);_0xdee023[_0x5571('0x31')]=_[_0x5571('0x45')](_0x5ea5e9[_0x5571('0x31')]);_0xdee023[_0x5571('0x32')]=_[_0x5571('0x33')](_0xdee023[_0x5571('0x34')],_0xdee023[_0x5571('0x31')]);_0xfec6b0['attributes']=_[_0x5571('0x33')](_0xdee023[_0x5571('0x34')],qs[_0x5571('0x36')](_0x5ea5e9[_0x5571('0x31')]['fields']));_0xfec6b0[_0x5571('0x35')]=_0xfec6b0[_0x5571('0x35')][_0x5571('0x37')]?_0xfec6b0[_0x5571('0x35')]:_0xdee023[_0x5571('0x34')];_0xfec6b0[_0x5571('0x8f')]=qs[_0x5571('0x39')](_0x5ea5e9[_0x5571('0x31')][_0x5571('0x39')]);_0xfec6b0['where']=qs[_0x5571('0x32')](_[_0x5571('0x3b')](_0x5ea5e9[_0x5571('0x31')],_0xdee023['filters']));if(_0x5ea5e9[_0x5571('0x31')][_0x5571('0x3c')]){_0xfec6b0['where']=_['merge'](_0xfec6b0['where'],{'$or':_[_0x5571('0x2b')](_0xfec6b0[_0x5571('0x35')],function(_0x186abf){var _0x2b537e={};_0x2b537e[_0x186abf]={'$like':'%'+_0x5ea5e9[_0x5571('0x31')][_0x5571('0x3c')]+'%'};return _0x2b537e;})});}_0xfec6b0=_['merge']({},_0xfec6b0,_0x5ea5e9[_0x5571('0x3e')]);return _0x2aa6ed['getAgents'](_0xfec6b0);}})['then'](function(_0x41a7f3){if(_0x41a7f3){_0x2aea9b=_0x41a7f3[_0x5571('0x37')];if(!_0x5ea5e9[_0x5571('0x31')]['hasOwnProperty'](_0x5571('0x38'))){_0xfec6b0[_0x5571('0x1e')]=qs['limit'](_0x5ea5e9['query'][_0x5571('0x1e')]);_0xfec6b0['offset']=qs[_0x5571('0x1c')](_0x5ea5e9[_0x5571('0x31')][_0x5571('0x1c')]);}return _0x2aa6ed[_0x5571('0x8e')](_0xfec6b0);}})[_0x5571('0x26')](function(_0x4605f9){if(_0x4605f9){return _0x4605f9?{'count':_0x2aea9b,'rows':_0x4605f9}:null;}})[_0x5571('0x26')](respondWithResult(_0x10e3f2,null))[_0x5571('0x42')](handleError(_0x10e3f2,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 701cf19..5c2a2fe 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 _0xe0ed=['hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x1eb4df,_0x3f2b65){var _0x1042b9=function(_0xc1b867){while(--_0xc1b867){_0x1eb4df['push'](_0x1eb4df['shift']());}};_0x1042b9(++_0x3f2b65);}(_0xe0ed,0x19c));var _0xde0e=function(_0x50cdba,_0x479461){_0x50cdba=_0x50cdba-0x0;var _0x2c7d1d=_0xe0ed[_0x50cdba];return _0x2c7d1d;};'use strict';var EventEmitter=require(_0xde0e('0x0'));var Team=require(_0xde0e('0x1'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0xde0e('0x2')](0x0);var events={'afterCreate':_0xde0e('0x3'),'afterUpdate':_0xde0e('0x4'),'afterDestroy':_0xde0e('0x5')};function emitEvent(_0xce91a){return function(_0x531d2a,_0x386216,_0x25d24c){TeamEvents[_0xde0e('0x6')](_0xce91a+':'+_0x531d2a['id'],_0x531d2a);TeamEvents[_0xde0e('0x6')](_0xce91a,_0x531d2a);_0x25d24c(null);};}for(var e in events){if(events[_0xde0e('0x7')](e)){var event=events[e];Team[_0xde0e('0x8')](e,emitEvent(event));}}module[_0xde0e('0x9')]=TeamEvents; \ No newline at end of file +var _0xee9a=['../../mysqldb','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x50ae88,_0x65d563){var _0x46b132=function(_0x348203){while(--_0x348203){_0x50ae88['push'](_0x50ae88['shift']());}};_0x46b132(++_0x65d563);}(_0xee9a,0x1b9));var _0xaee9=function(_0x431220,_0x35a5c9){_0x431220=_0x431220-0x0;var _0x4cc9be=_0xee9a[_0x431220];return _0x4cc9be;};'use strict';var EventEmitter=require('events');var Team=require(_0xaee9('0x0'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xaee9('0x1'),'afterUpdate':_0xaee9('0x2'),'afterDestroy':_0xaee9('0x3')};function emitEvent(_0x3c9e94){return function(_0x539032,_0x243a4d,_0x368521){TeamEvents[_0xaee9('0x4')](_0x3c9e94+':'+_0x539032['id'],_0x539032);TeamEvents[_0xaee9('0x4')](_0x3c9e94,_0x539032);_0x368521(null);};}for(var e in events){if(events[_0xaee9('0x5')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module[_0xaee9('0x6')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 7dca607..1d2548c 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 _0x2fe3=['exports','define','Team','teams','lodash','util','api','moment','bluebird','./team.attributes'];(function(_0x7a04f8,_0xc720e6){var _0x560a41=function(_0x6efb68){while(--_0x6efb68){_0x7a04f8['push'](_0x7a04f8['shift']());}};_0x560a41(++_0xc720e6);}(_0x2fe3,0xcc));var _0x32fe=function(_0x38a77a,_0x59a667){_0x38a77a=_0x38a77a-0x0;var _0x43f1d3=_0x2fe3[_0x38a77a];return _0x43f1d3;};'use strict';var _=require(_0x32fe('0x0'));var util=require(_0x32fe('0x1'));var logger=require('../../config/logger')(_0x32fe('0x2'));var moment=require(_0x32fe('0x3'));var BPromise=require(_0x32fe('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(_0x32fe('0x5'));module[_0x32fe('0x6')]=function(_0x346f85,_0x3c4397){return _0x346f85[_0x32fe('0x7')](_0x32fe('0x8'),attributes,{'tableName':_0x32fe('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9f17=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./team.attributes','Team','teams','util'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x9f17,0x16a));var _0x79f1=function(_0x28af2b,_0x579ccc){_0x28af2b=_0x28af2b-0x0;var _0x3b7ac1=_0x9f17[_0x28af2b];return _0x3b7ac1;};'use strict';var _=require('lodash');var util=require(_0x79f1('0x0'));var logger=require(_0x79f1('0x1'))(_0x79f1('0x2'));var moment=require(_0x79f1('0x3'));var BPromise=require(_0x79f1('0x4'));var rp=require(_0x79f1('0x5'));var fs=require('fs');var path=require(_0x79f1('0x6'));var rimraf=require('rimraf');var config=require(_0x79f1('0x7'));var attributes=require(_0x79f1('0x8'));module['exports']=function(_0x1528da,_0x416f9f){return _0x1528da['define'](_0x79f1('0x9'),attributes,{'tableName':_0x79f1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 68267e2..f0a4214 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 _0x5f60=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','socket.io-emitter','redis','register','request','then','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5f60,0x182));var _0x05f6=function(_0x54b283,_0x5eb8a6){_0x54b283=_0x54b283-0x0;var _0x2462b3=_0x5f60[_0x54b283];return _0x2462b3;};'use strict';var _=require(_0x05f6('0x0'));var util=require(_0x05f6('0x1'));var moment=require(_0x05f6('0x2'));var BPromise=require(_0x05f6('0x3'));var rs=require(_0x05f6('0x4'));var fs=require('fs');var Redis=require(_0x05f6('0x5'));var db=require(_0x05f6('0x6'))['db'];var utils=require(_0x05f6('0x7'));var logger=require(_0x05f6('0x8'))(_0x05f6('0x9'));var config=require('../../config/environment');var jayson=require(_0x05f6('0xa'));var client=jayson[_0x05f6('0xb')][_0x05f6('0xc')]({'port':0x232a});config['redis']=_[_0x05f6('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x05f6('0xe'))(new Redis(config[_0x05f6('0xf')]));require('./team.socket')[_0x05f6('0x10')](socket);function respondWithRpcPromise(_0xeb9b3d,_0x5ef35e,_0x116561){return new BPromise(function(_0x54a4eb,_0x15a524){return client[_0x05f6('0x11')](_0xeb9b3d,_0x116561)[_0x05f6('0x12')](function(_0x30dc17){logger['info'](_0x05f6('0x13'),_0x5ef35e,_0x05f6('0x14'));logger[_0x05f6('0x15')](_0x05f6('0x16'),_0x5ef35e,'request\x20sent',JSON[_0x05f6('0x17')](_0x30dc17));if(_0x30dc17[_0x05f6('0x18')]){if(_0x30dc17[_0x05f6('0x18')][_0x05f6('0x19')]===0x1f4){logger[_0x05f6('0x18')]('Team,\x20%s,\x20%s',_0x5ef35e,_0x30dc17[_0x05f6('0x18')][_0x05f6('0x1a')]);return _0x15a524(_0x30dc17[_0x05f6('0x18')][_0x05f6('0x1a')]);}logger['error']('Team,\x20%s,\x20%s',_0x5ef35e,_0x30dc17['error'][_0x05f6('0x1a')]);return _0x54a4eb(_0x30dc17['error']['message']);}else{logger[_0x05f6('0x1b')](_0x05f6('0x13'),_0x5ef35e,_0x05f6('0x14'));_0x54a4eb(_0x30dc17[_0x05f6('0x1c')][_0x05f6('0x1a')]);}})[_0x05f6('0x1d')](function(_0x4de47d){logger[_0x05f6('0x18')]('Team,\x20%s,\x20%s',_0x5ef35e,_0x4de47d);_0x15a524(_0x4de47d);});});} \ No newline at end of file +var _0xf75e=['jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./team.socket','register','then','Team,\x20%s,\x20%s','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x5d490e,_0x5c653a){var _0x49292e=function(_0x3c8839){while(--_0x3c8839){_0x5d490e['push'](_0x5d490e['shift']());}};_0x49292e(++_0x5c653a);}(_0xf75e,0x17d));var _0xef75=function(_0x59b8ef,_0x557df3){_0x59b8ef=_0x59b8ef-0x0;var _0x45f1cb=_0xf75e[_0x59b8ef];return _0x45f1cb;};'use strict';var _=require('lodash');var util=require(_0xef75('0x0'));var moment=require(_0xef75('0x1'));var BPromise=require(_0xef75('0x2'));var rs=require(_0xef75('0x3'));var fs=require('fs');var Redis=require(_0xef75('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xef75('0x5'));var logger=require(_0xef75('0x6'))(_0xef75('0x7'));var config=require(_0xef75('0x8'));var jayson=require(_0xef75('0x9'));var client=jayson[_0xef75('0xa')][_0xef75('0xb')]({'port':0x232a});config['redis']=_[_0xef75('0xc')](config[_0xef75('0xd')],{'host':_0xef75('0xe'),'port':0x18eb});var socket=require(_0xef75('0xf'))(new Redis(config[_0xef75('0xd')]));require(_0xef75('0x10'))[_0xef75('0x11')](socket);function respondWithRpcPromise(_0x5db911,_0x4c792f,_0x3073ac){return new BPromise(function(_0x12c08e,_0x2c1a03){return client['request'](_0x5db911,_0x3073ac)[_0xef75('0x12')](function(_0xe23b4b){logger['info'](_0xef75('0x13'),_0x4c792f,'request\x20sent');logger[_0xef75('0x14')](_0xef75('0x15'),_0x4c792f,'request\x20sent',JSON[_0xef75('0x16')](_0xe23b4b));if(_0xe23b4b[_0xef75('0x17')]){if(_0xe23b4b[_0xef75('0x17')][_0xef75('0x18')]===0x1f4){logger[_0xef75('0x17')](_0xef75('0x13'),_0x4c792f,_0xe23b4b[_0xef75('0x17')][_0xef75('0x19')]);return _0x2c1a03(_0xe23b4b['error'][_0xef75('0x19')]);}logger[_0xef75('0x17')](_0xef75('0x13'),_0x4c792f,_0xe23b4b['error'][_0xef75('0x19')]);return _0x12c08e(_0xe23b4b['error'][_0xef75('0x19')]);}else{logger[_0xef75('0x1a')](_0xef75('0x13'),_0x4c792f,_0xef75('0x1b'));_0x12c08e(_0xe23b4b[_0xef75('0x1c')][_0xef75('0x19')]);}})[_0xef75('0x1d')](function(_0x1660ba){logger[_0xef75('0x17')](_0xef75('0x13'),_0x4c792f,_0x1660ba);_0x2c1a03(_0x1660ba);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 4f3cf82..bce79c4 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 _0x3609=['remove','update','removeListener','length','team:','./team.events','save'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x3609,0x101));var _0x9360=function(_0x1f5269,_0xb4c12e){_0x1f5269=_0x1f5269-0x0;var _0x109f0e=_0x3609[_0x1f5269];return _0x109f0e;};'use strict';var TeamEvents=require(_0x9360('0x0'));var events=[_0x9360('0x1'),_0x9360('0x2'),_0x9360('0x3')];function createListener(_0xfd6fd7,_0x42aad5){return function(_0x133b7c){_0x42aad5['emit'](_0xfd6fd7,_0x133b7c);};}function removeListener(_0x28376e,_0x24c531){return function(){TeamEvents[_0x9360('0x4')](_0x28376e,_0x24c531);};}exports['register']=function(_0x5548c1){for(var _0x48aeae=0x0,_0x11fe15=events[_0x9360('0x5')];_0x48aeae<_0x11fe15;_0x48aeae++){var _0x50e967=events[_0x48aeae];var _0x2a67be=createListener(_0x9360('0x6')+_0x50e967,_0x5548c1);TeamEvents['on'](_0x50e967,_0x2a67be);}}; \ No newline at end of file +var _0x8588=['emit','removeListener','register','length','save','remove','update'];(function(_0x481c66,_0x242406){var _0x4c95d6=function(_0x29dd21){while(--_0x29dd21){_0x481c66['push'](_0x481c66['shift']());}};_0x4c95d6(++_0x242406);}(_0x8588,0x185));var _0x8858=function(_0xe269df,_0x54cc46){_0xe269df=_0xe269df-0x0;var _0x2ca87f=_0x8588[_0xe269df];return _0x2ca87f;};'use strict';var TeamEvents=require('./team.events');var events=[_0x8858('0x0'),_0x8858('0x1'),_0x8858('0x2')];function createListener(_0x299e33,_0x5c2622){return function(_0x4fb8c3){_0x5c2622[_0x8858('0x3')](_0x299e33,_0x4fb8c3);};}function removeListener(_0x400163,_0x58d0a6){return function(){TeamEvents[_0x8858('0x4')](_0x400163,_0x58d0a6);};}exports[_0x8858('0x5')]=function(_0x5d7984){for(var _0x370f4c=0x0,_0x3117b3=events[_0x8858('0x6')];_0x370f4c<_0x3117b3;_0x370f4c++){var _0x5703da=events[_0x370f4c];var _0x550895=createListener('team:'+_0x5703da,_0x5d7984);TeamEvents['on'](_0x5703da,_0x550895);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 3b8b9d2..b2a800b 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 _0x6343=['INTEGER','exports'];(function(_0x192346,_0x5a117f){var _0x91e4cc=function(_0x226b50){while(--_0x226b50){_0x192346['push'](_0x192346['shift']());}};_0x91e4cc(++_0x5a117f);}(_0x6343,0x1e9));var _0x3634=function(_0xe3f2fd,_0x28430c){_0xe3f2fd=_0xe3f2fd-0x0;var _0x5577f7=_0x6343[_0xe3f2fd];return _0x5577f7;};'use strict';var Sequelize=require('sequelize');module[_0x3634('0x0')]={'TeamId':{'type':Sequelize[_0x3634('0x1')]},'VoicePrefixId':{'type':Sequelize[_0x3634('0x1')]}}; \ No newline at end of file +var _0x5c4a=['INTEGER','exports'];(function(_0x189b21,_0x4c1465){var _0x2add98=function(_0x3bb76e){while(--_0x3bb76e){_0x189b21['push'](_0x189b21['shift']());}};_0x2add98(++_0x4c1465);}(_0x5c4a,0xfb));var _0xa5c4=function(_0x3c8f06,_0x3bc126){_0x3c8f06=_0x3c8f06-0x0;var _0x40c305=_0x5c4a[_0x3c8f06];return _0x40c305;};'use strict';var Sequelize=require('sequelize');module[_0xa5c4('0x0')]={'TeamId':{'type':Sequelize[_0xa5c4('0x1')]},'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 88888b7..0c5ef37 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 _0xf69c=['define','TeamVoicePrefix','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./teamVoicePrefix.attributes','exports'];(function(_0x2e8d01,_0x12fe7a){var _0x92efe5=function(_0x4fb17a){while(--_0x4fb17a){_0x2e8d01['push'](_0x2e8d01['shift']());}};_0x92efe5(++_0x12fe7a);}(_0xf69c,0x1e2));var _0xcf69=function(_0x1d5895,_0x1acd4a){_0x1d5895=_0x1d5895-0x0;var _0x12977e=_0xf69c[_0x1d5895];return _0x12977e;};'use strict';var _=require(_0xcf69('0x0'));var util=require(_0xcf69('0x1'));var logger=require(_0xcf69('0x2'))(_0xcf69('0x3'));var moment=require('moment');var BPromise=require(_0xcf69('0x4'));var rp=require(_0xcf69('0x5'));var fs=require('fs');var path=require(_0xcf69('0x6'));var rimraf=require('rimraf');var config=require(_0xcf69('0x7'));var attributes=require(_0xcf69('0x8'));module[_0xcf69('0x9')]=function(_0x2e8d3,_0x2ec528){return _0x2e8d3[_0xcf69('0xa')](_0xcf69('0xb'),attributes,{'tableName':'team_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x928c=['api','bluebird','request-promise','path','rimraf','../../config/environment','exports','../../config/logger'];(function(_0x1e0e1b,_0x428a77){var _0x4fc792=function(_0x29b110){while(--_0x29b110){_0x1e0e1b['push'](_0x1e0e1b['shift']());}};_0x4fc792(++_0x428a77);}(_0x928c,0x17f));var _0xc928=function(_0x2b38d9,_0x15873d){_0x2b38d9=_0x2b38d9-0x0;var _0x30e644=_0x928c[_0x2b38d9];return _0x30e644;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc928('0x0'))(_0xc928('0x1'));var moment=require('moment');var BPromise=require(_0xc928('0x2'));var rp=require(_0xc928('0x3'));var fs=require('fs');var path=require(_0xc928('0x4'));var rimraf=require(_0xc928('0x5'));var config=require(_0xc928('0x6'));var attributes=require('./teamVoicePrefix.attributes');module[_0xc928('0x7')]=function(_0x4704bc,_0x8c0fa5){return _0x4704bc['define']('TeamVoicePrefix',attributes,{'tableName':'team_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 2abf12f..964595e 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x5b9285,_0x3c6b59){var _0x56c407=function(_0x30532e){while(--_0x30532e){_0x5b9285['push'](_0x5b9285['shift']());}};_0x56c407(++_0x3c6b59);}(_0x70e0,0x17b));var _0x070e=function(_0x209324,_0x311cf2){_0x209324=_0x209324-0x0;var _0x536c37=_0x70e0[_0x209324];return _0x536c37;};'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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x1bb86f,_0x417c56){var _0x203cd1=function(_0x1a634a){while(--_0x1a634a){_0x1bb86f['push'](_0x1bb86f['shift']());}};_0x203cd1(++_0x417c56);}(_0xedd9,0xfc));var _0x9edd=function(_0x575d19,_0x2a6cd2){_0x575d19=_0x575d19-0x0;var _0x257c8f=_0xedd9[_0x575d19];return _0x257c8f;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index e0c2420..b79414f 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 _0xcbd1=['exports','INTEGER','sequelize'];(function(_0x1c5dc8,_0x4b508e){var _0x59672f=function(_0x498e01){while(--_0x498e01){_0x1c5dc8['push'](_0x1c5dc8['shift']());}};_0x59672f(++_0x4b508e);}(_0xcbd1,0x15b));var _0x1cbd=function(_0x32c09f,_0x5f28be){_0x32c09f=_0x32c09f-0x0;var _0x5985d3=_0xcbd1[_0x32c09f];return _0x5985d3;};'use strict';var Sequelize=require(_0x1cbd('0x0'));module[_0x1cbd('0x1')]={'penalty':{'type':Sequelize[_0x1cbd('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0f44=['exports','sequelize'];(function(_0x548546,_0x44ccc4){var _0x11e915=function(_0x15213a){while(--_0x15213a){_0x548546['push'](_0x548546['shift']());}};_0x11e915(++_0x44ccc4);}(_0x0f44,0x7d));var _0x40f4=function(_0x2507da,_0x55d1f8){_0x2507da=_0x2507da-0x0;var _0x56503b=_0x0f44[_0x2507da];return _0x56503b;};'use strict';var Sequelize=require(_0x40f4('0x0'));module[_0x40f4('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index 9980745..f690dbd 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 _0x3dd5=['request-promise','path','rimraf','../../config/environment','./teamVoiceQueue.attributes','define','TeamVoiceQueue','lodash','../../config/logger','api','moment','bluebird'];(function(_0xd2e2ab,_0x2440cf){var _0x1703a2=function(_0x23deba){while(--_0x23deba){_0xd2e2ab['push'](_0xd2e2ab['shift']());}};_0x1703a2(++_0x2440cf);}(_0x3dd5,0x73));var _0x53dd=function(_0x487c81,_0x137867){_0x487c81=_0x487c81-0x0;var _0xca71dc=_0x3dd5[_0x487c81];return _0xca71dc;};'use strict';var _=require(_0x53dd('0x0'));var util=require('util');var logger=require(_0x53dd('0x1'))(_0x53dd('0x2'));var moment=require(_0x53dd('0x3'));var BPromise=require(_0x53dd('0x4'));var rp=require(_0x53dd('0x5'));var fs=require('fs');var path=require(_0x53dd('0x6'));var rimraf=require(_0x53dd('0x7'));var config=require(_0x53dd('0x8'));var attributes=require(_0x53dd('0x9'));module['exports']=function(_0x3c8f9e,_0x26c218){return _0x3c8f9e[_0x53dd('0xa')](_0x53dd('0xb'),attributes,{'tableName':'team_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8128=['team_has_voice_queues','lodash','api','moment','path','rimraf','../../config/environment','exports','define'];(function(_0x45e74a,_0x2d3854){var _0xd6ff0f=function(_0x30a02e){while(--_0x30a02e){_0x45e74a['push'](_0x45e74a['shift']());}};_0xd6ff0f(++_0x2d3854);}(_0x8128,0x1b1));var _0x8812=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0x8128[_0x273c39];return _0x46d6b5;};'use strict';var _=require(_0x8812('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x8812('0x1'));var moment=require(_0x8812('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8812('0x3'));var rimraf=require(_0x8812('0x4'));var config=require(_0x8812('0x5'));var attributes=require('./teamVoiceQueue.attributes');module[_0x8812('0x6')]=function(_0x2f4af9,_0x2b43c6){return _0x2f4af9[_0x8812('0x7')]('TeamVoiceQueue',attributes,{'tableName':_0x8812('0x8'),'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 5d832ca..67d85dd 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 _0xd392=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','lodash','util'];(function(_0x185647,_0xd1ea93){var _0x12ed4a=function(_0x121a25){while(--_0x121a25){_0x185647['push'](_0x185647['shift']());}};_0x12ed4a(++_0xd1ea93);}(_0xd392,0x7c));var _0x2d39=function(_0x3eca98,_0x2ff3fe){_0x3eca98=_0x3eca98-0x0;var _0x5cf378=_0xd392[_0x3eca98];return _0x5cf378;};'use strict';var _=require(_0x2d39('0x0'));var util=require(_0x2d39('0x1'));var moment=require(_0x2d39('0x2'));var BPromise=require('bluebird');var rs=require(_0x2d39('0x3'));var fs=require('fs');var Redis=require(_0x2d39('0x4'));var db=require(_0x2d39('0x5'))['db'];var utils=require(_0x2d39('0x6'));var logger=require(_0x2d39('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x2d39('0x8'));var client=jayson[_0x2d39('0x9')][_0x2d39('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x459203,_0x10344d,_0x44adc1){return new BPromise(function(_0x2376e4,_0x351e24){return client[_0x2d39('0xb')](_0x459203,_0x44adc1)[_0x2d39('0xc')](function(_0x35503f){logger[_0x2d39('0xd')](_0x2d39('0xe'),_0x10344d,_0x2d39('0xf'));logger[_0x2d39('0x10')](_0x2d39('0x11'),_0x10344d,_0x2d39('0xf'),JSON['stringify'](_0x35503f));if(_0x35503f['error']){if(_0x35503f[_0x2d39('0x12')][_0x2d39('0x13')]===0x1f4){logger[_0x2d39('0x12')](_0x2d39('0xe'),_0x10344d,_0x35503f[_0x2d39('0x12')][_0x2d39('0x14')]);return _0x351e24(_0x35503f[_0x2d39('0x12')]['message']);}logger['error'](_0x2d39('0xe'),_0x10344d,_0x35503f['error'][_0x2d39('0x14')]);return _0x2376e4(_0x35503f[_0x2d39('0x12')][_0x2d39('0x14')]);}else{logger[_0x2d39('0xd')](_0x2d39('0xe'),_0x10344d,_0x2d39('0xf'));_0x2376e4(_0x35503f['result'][_0x2d39('0x14')]);}})['catch'](function(_0x45fba3){logger[_0x2d39('0x12')](_0x2d39('0xe'),_0x10344d,_0x45fba3);_0x351e24(_0x45fba3);});});} \ No newline at end of file +var _0xa943=['catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','TeamVoiceQueue,\x20%s,\x20%s'];(function(_0x58e4de,_0x13f58c){var _0x98d506=function(_0x549271){while(--_0x549271){_0x58e4de['push'](_0x58e4de['shift']());}};_0x98d506(++_0x13f58c);}(_0xa943,0x105));var _0x3a94=function(_0x15d374,_0x2518e2){_0x15d374=_0x15d374-0x0;var _0x5f2271=_0xa943[_0x15d374];return _0x5f2271;};'use strict';var _=require(_0x3a94('0x0'));var util=require(_0x3a94('0x1'));var moment=require('moment');var BPromise=require(_0x3a94('0x2'));var rs=require(_0x3a94('0x3'));var fs=require('fs');var Redis=require(_0x3a94('0x4'));var db=require(_0x3a94('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3a94('0x6'));var config=require(_0x3a94('0x7'));var jayson=require(_0x3a94('0x8'));var client=jayson[_0x3a94('0x9')][_0x3a94('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5890d9,_0x4cce69,_0x39c753){return new BPromise(function(_0x414414,_0xc95b4e){return client[_0x3a94('0xb')](_0x5890d9,_0x39c753)[_0x3a94('0xc')](function(_0x6de0d3){logger['info']('TeamVoiceQueue,\x20%s,\x20%s',_0x4cce69,_0x3a94('0xd'));logger['debug'](_0x3a94('0xe'),_0x4cce69,'request\x20sent',JSON['stringify'](_0x6de0d3));if(_0x6de0d3[_0x3a94('0xf')]){if(_0x6de0d3['error'][_0x3a94('0x10')]===0x1f4){logger[_0x3a94('0xf')]('TeamVoiceQueue,\x20%s,\x20%s',_0x4cce69,_0x6de0d3['error']['message']);return _0xc95b4e(_0x6de0d3['error']['message']);}logger[_0x3a94('0xf')]('TeamVoiceQueue,\x20%s,\x20%s',_0x4cce69,_0x6de0d3[_0x3a94('0xf')][_0x3a94('0x11')]);return _0x414414(_0x6de0d3[_0x3a94('0xf')][_0x3a94('0x11')]);}else{logger['info'](_0x3a94('0x12'),_0x4cce69,_0x3a94('0xd'));_0x414414(_0x6de0d3['result']['message']);}})[_0x3a94('0x13')](function(_0x5978a9){logger[_0x3a94('0xf')](_0x3a94('0x12'),_0x4cce69,_0x5978a9);_0xc95b4e(_0x5978a9);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 065415e..d2a4797 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 _0x6dc0=['get','/:id','show','post','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./template.controller','isAuthenticated'];(function(_0x409ad2,_0x5129c1){var _0x595b5f=function(_0x592974){while(--_0x592974){_0x409ad2['push'](_0x409ad2['shift']());}};_0x595b5f(++_0x5129c1);}(_0x6dc0,0xb6));var _0x06dc=function(_0x429f47,_0x231e8a){_0x429f47=_0x429f47-0x0;var _0xaa330b=_0x6dc0[_0x429f47];return _0xaa330b;};'use strict';var multer=require(_0x06dc('0x0'));var util=require(_0x06dc('0x1'));var path=require(_0x06dc('0x2'));var timeout=require('connect-timeout');var express=require(_0x06dc('0x3'));var router=express[_0x06dc('0x4')]();var fs_extra=require(_0x06dc('0x5'));var auth=require(_0x06dc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x06dc('0x7'));var controller=require(_0x06dc('0x8'));router['get']('/',auth[_0x06dc('0x9')](),controller['index']);router[_0x06dc('0xa')](_0x06dc('0xb'),auth[_0x06dc('0x9')](),controller[_0x06dc('0xc')]);router[_0x06dc('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x06dc('0xb'),auth[_0x06dc('0x9')](),controller['update']);router[_0x06dc('0xe')](_0x06dc('0xb'),auth[_0x06dc('0x9')](),controller[_0x06dc('0xf')]);module['exports']=router; \ No newline at end of file +var _0x6bab=['util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','post','create','put','destroy','exports','multer'];(function(_0x313534,_0x4b240b){var _0x32fd8d=function(_0x1370f5){while(--_0x1370f5){_0x313534['push'](_0x313534['shift']());}};_0x32fd8d(++_0x4b240b);}(_0x6bab,0x1c7));var _0xb6ba=function(_0x303064,_0x12f0c2){_0x303064=_0x303064-0x0;var _0x5a1d3d=_0x6bab[_0x303064];return _0x5a1d3d;};'use strict';var multer=require(_0xb6ba('0x0'));var util=require(_0xb6ba('0x1'));var path=require(_0xb6ba('0x2'));var timeout=require(_0xb6ba('0x3'));var express=require('express');var router=express[_0xb6ba('0x4')]();var fs_extra=require(_0xb6ba('0x5'));var auth=require(_0xb6ba('0x6'));var interaction=require(_0xb6ba('0x7'));var config=require(_0xb6ba('0x8'));var controller=require('./template.controller');router[_0xb6ba('0x9')]('/',auth['isAuthenticated'](),controller[_0xb6ba('0xa')]);router[_0xb6ba('0x9')](_0xb6ba('0xb'),auth[_0xb6ba('0xc')](),controller[_0xb6ba('0xd')]);router[_0xb6ba('0xe')]('/',auth[_0xb6ba('0xc')](),controller[_0xb6ba('0xf')]);router[_0xb6ba('0x10')]('/:id',auth[_0xb6ba('0xc')](),controller['update']);router['delete']('/:id',auth[_0xb6ba('0xc')](),controller[_0xb6ba('0x11')]);module[_0xb6ba('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 a1b4c0d..b1e80da 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 _0x0033=['sequelize','exports','STRING','TEXT'];(function(_0x40a043,_0xc7a013){var _0x17b279=function(_0xae5129){while(--_0xae5129){_0x40a043['push'](_0x40a043['shift']());}};_0x17b279(++_0xc7a013);}(_0x0033,0xb8));var _0x3003=function(_0x2f57b2,_0xa8e91a){_0x2f57b2=_0x2f57b2-0x0;var _0x5ace77=_0x0033[_0x2f57b2];return _0x5ace77;};'use strict';var Sequelize=require(_0x3003('0x0'));module[_0x3003('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x3003('0x2')]},'html':{'type':Sequelize[_0x3003('0x3')]}}; \ No newline at end of file +var _0x2303=['STRING','TEXT','exports'];(function(_0x1b4b23,_0x5dd6d6){var _0x2a325b=function(_0x175462){while(--_0x175462){_0x1b4b23['push'](_0x1b4b23['shift']());}};_0x2a325b(++_0x5dd6d6);}(_0x2303,0x152));var _0x3230=function(_0x22d79e,_0x50587c){_0x22d79e=_0x22d79e-0x0;var _0x53acff=_0x2303[_0x22d79e];return _0x53acff;};'use strict';var Sequelize=require('sequelize');module[_0x3230('0x0')]={'name':{'type':Sequelize[_0x3230('0x1')]},'description':{'type':Sequelize[_0x3230('0x1')]},'html':{'type':Sequelize[_0x3230('0x2')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index f59084b..0ea849a 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 _0x0fcc=['fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Templates','end','error','stack','name','send','index','map','Template','rawAttributes','type','key','model','query','keys','intersection','attributes'];(function(_0x3af055,_0x3149a9){var _0x4a60db=function(_0x1308c1){while(--_0x1308c1){_0x3af055['push'](_0x3af055['shift']());}};_0x4a60db(++_0x3149a9);}(_0x0fcc,0x127));var _0xc0fc=function(_0x36bf88,_0x15c459){_0x36bf88=_0x36bf88-0x0;var _0x332914=_0x0fcc[_0x36bf88];return _0x332914;};'use strict';var emlformat=require(_0xc0fc('0x0'));var rimraf=require(_0xc0fc('0x1'));var zipdir=require(_0xc0fc('0x2'));var jsonpatch=require(_0xc0fc('0x3'));var rp=require(_0xc0fc('0x4'));var moment=require(_0xc0fc('0x5'));var BPromise=require(_0xc0fc('0x6'));var Mustache=require(_0xc0fc('0x7'));var util=require(_0xc0fc('0x8'));var path=require(_0xc0fc('0x9'));var sox=require(_0xc0fc('0xa'));var csv=require(_0xc0fc('0xb'));var ejs=require(_0xc0fc('0xc'));var fs=require('fs');var fs_extra=require(_0xc0fc('0xd'));var _=require('lodash');var squel=require(_0xc0fc('0xe'));var crypto=require(_0xc0fc('0xf'));var jsforce=require(_0xc0fc('0x10'));var deskjs=require(_0xc0fc('0x11'));var toCsv=require(_0xc0fc('0xb'));var querystring=require(_0xc0fc('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xc0fc('0x13'));var qs=require(_0xc0fc('0x14'));var as=require(_0xc0fc('0x15'));var hardwareService=require(_0xc0fc('0x16'));var logger=require(_0xc0fc('0x17'))(_0xc0fc('0x18'));var utils=require('../../config/utils');var config=require(_0xc0fc('0x19'));var licenseUtil=require(_0xc0fc('0x1a'));var db=require(_0xc0fc('0x1b'))['db'];function respondWithStatusCode(_0x59847d,_0x5dd56a){_0x5dd56a=_0x5dd56a||0xcc;return function(_0x371289){if(_0x371289){return _0x59847d[_0xc0fc('0x1c')](_0x5dd56a);}return _0x59847d[_0xc0fc('0x1d')](_0x5dd56a)['end']();};}function respondWithResult(_0x350190,_0x3fd2df){_0x3fd2df=_0x3fd2df||0xc8;return function(_0x55558b){if(_0x55558b){return _0x350190[_0xc0fc('0x1d')](_0x3fd2df)[_0xc0fc('0x1e')](_0x55558b);}};}function respondWithFilteredResult(_0x5330ed,_0x5e78ed){return function(_0x3f16a2){if(_0x3f16a2){var _0x380c41=typeof _0x5e78ed[_0xc0fc('0x1f')]===_0xc0fc('0x20')&&typeof _0x5e78ed['limit']===_0xc0fc('0x20');var _0x56083d=_0x3f16a2[_0xc0fc('0x21')];var _0x2cc026=_0x380c41?0x0:_0x5e78ed[_0xc0fc('0x1f')];var _0xed03e6=_0x380c41?_0x3f16a2[_0xc0fc('0x21')]:_0x5e78ed['offset']+_0x5e78ed[_0xc0fc('0x22')];var _0x5d2797;if(_0xed03e6>=_0x56083d){_0xed03e6=_0x56083d;_0x5d2797=0xc8;}else{_0x5d2797=0xce;}_0x5330ed[_0xc0fc('0x1d')](_0x5d2797);return _0x5330ed[_0xc0fc('0x23')](_0xc0fc('0x24'),_0x2cc026+'-'+_0xed03e6+'/'+_0x56083d)[_0xc0fc('0x1e')](_0x3f16a2);}return null;};}function patchUpdates(_0x4d599a){return function(_0x5d9b13){try{jsonpatch[_0xc0fc('0x25')](_0x5d9b13,_0x4d599a,!![]);}catch(_0x4878de){return BPromise[_0xc0fc('0x26')](_0x4878de);}return _0x5d9b13[_0xc0fc('0x27')]();};}function saveUpdates(_0x1fdb75,_0x257add){return function(_0x1fd2c1){if(_0x1fd2c1){return _0x1fd2c1[_0xc0fc('0x28')](_0x1fdb75)[_0xc0fc('0x29')](function(_0x47bc42){return _0x47bc42;});}return null;};}function removeEntity(_0x5ae9ef,_0x3feca1){return function(_0x542ceb){if(_0x542ceb){return _0x542ceb[_0xc0fc('0x2a')]()[_0xc0fc('0x29')](function(){var _0x19fd03=_0x542ceb[_0xc0fc('0x2b')]({'plain':!![]});var _0x4f6724=_0xc0fc('0x2c');return db['UserProfileResource'][_0xc0fc('0x2a')]({'where':{'type':_0x4f6724,'resourceId':_0x19fd03['id']}})[_0xc0fc('0x29')](function(){return _0x542ceb;});})[_0xc0fc('0x29')](function(){_0x5ae9ef[_0xc0fc('0x1d')](0xcc)[_0xc0fc('0x2d')]();});}};}function handleEntityNotFound(_0x2afa1b,_0x5e1ef9){return function(_0xc00763){if(!_0xc00763){_0x2afa1b['sendStatus'](0x194);}return _0xc00763;};}function handleError(_0x35560d,_0x4e3e07){_0x4e3e07=_0x4e3e07||0x1f4;return function(_0xd7387e){logger[_0xc0fc('0x2e')](_0xd7387e[_0xc0fc('0x2f')]);if(_0xd7387e[_0xc0fc('0x30')]){delete _0xd7387e[_0xc0fc('0x30')];}_0x35560d[_0xc0fc('0x1d')](_0x4e3e07)[_0xc0fc('0x31')](_0xd7387e);};}exports[_0xc0fc('0x32')]=function(_0x207aea,_0x256d35){var _0x24f173={},_0x193d58={},_0x21d9ac={'count':0x0,'rows':[]};var _0xdb0b7f=_[_0xc0fc('0x33')](db[_0xc0fc('0x34')][_0xc0fc('0x35')],function(_0x42040c){return{'name':_0x42040c['fieldName'],'type':_0x42040c[_0xc0fc('0x36')][_0xc0fc('0x37')]};});_0x193d58[_0xc0fc('0x38')]=_['map'](_0xdb0b7f,_0xc0fc('0x30'));_0x193d58[_0xc0fc('0x39')]=_[_0xc0fc('0x3a')](_0x207aea['query']);_0x193d58['filters']=_[_0xc0fc('0x3b')](_0x193d58['model'],_0x193d58[_0xc0fc('0x39')]);_0x24f173[_0xc0fc('0x3c')]=_[_0xc0fc('0x3b')](_0x193d58[_0xc0fc('0x38')],qs['fields'](_0x207aea[_0xc0fc('0x39')][_0xc0fc('0x3d')]));_0x24f173[_0xc0fc('0x3c')]=_0x24f173[_0xc0fc('0x3c')][_0xc0fc('0x3e')]?_0x24f173[_0xc0fc('0x3c')]:_0x193d58[_0xc0fc('0x38')];if(!_0x207aea[_0xc0fc('0x39')][_0xc0fc('0x3f')](_0xc0fc('0x40'))){_0x24f173[_0xc0fc('0x22')]=qs[_0xc0fc('0x22')](_0x207aea[_0xc0fc('0x39')][_0xc0fc('0x22')]);_0x24f173[_0xc0fc('0x1f')]=qs['offset'](_0x207aea[_0xc0fc('0x39')][_0xc0fc('0x1f')]);}_0x24f173['order']=qs[_0xc0fc('0x41')](_0x207aea[_0xc0fc('0x39')][_0xc0fc('0x41')]);_0x24f173['where']=qs[_0xc0fc('0x42')](_[_0xc0fc('0x43')](_0x207aea[_0xc0fc('0x39')],_0x193d58['filters']),_0xdb0b7f);if(_0x207aea[_0xc0fc('0x39')][_0xc0fc('0x44')]){_0x24f173[_0xc0fc('0x45')]=_[_0xc0fc('0x46')](_0x24f173[_0xc0fc('0x45')],{'$or':_['map'](_0xdb0b7f,function(_0x1a2f83){if(_0x1a2f83[_0xc0fc('0x36')]!==_0xc0fc('0x47')){var _0x54a3af={};_0x54a3af[_0x1a2f83['name']]={'$like':'%'+_0x207aea[_0xc0fc('0x39')][_0xc0fc('0x44')]+'%'};return _0x54a3af;}})});}_0x24f173=_[_0xc0fc('0x46')]({},_0x24f173,_0x207aea[_0xc0fc('0x48')]);var _0x372295={'where':_0x24f173['where']};return db[_0xc0fc('0x34')]['count'](_0x372295)['then'](function(_0x3036d3){_0x21d9ac['count']=_0x3036d3;if(_0x207aea[_0xc0fc('0x39')][_0xc0fc('0x49')]){_0x24f173['include']=[{'all':!![]}];}return db[_0xc0fc('0x34')][_0xc0fc('0x4a')](_0x24f173);})[_0xc0fc('0x29')](function(_0x1a2dcf){_0x21d9ac[_0xc0fc('0x4b')]=_0x1a2dcf;return _0x21d9ac;})[_0xc0fc('0x29')](respondWithFilteredResult(_0x256d35,_0x24f173))[_0xc0fc('0x4c')](handleError(_0x256d35,null));};exports[_0xc0fc('0x4d')]=function(_0x226fa3,_0x585ebb){var _0x4214af={'raw':!![],'where':{'id':_0x226fa3[_0xc0fc('0x4e')]['id']}},_0xee6e4a={};_0xee6e4a[_0xc0fc('0x38')]=_[_0xc0fc('0x3a')](db[_0xc0fc('0x34')][_0xc0fc('0x35')]);_0xee6e4a[_0xc0fc('0x39')]=_[_0xc0fc('0x3a')](_0x226fa3[_0xc0fc('0x39')]);_0xee6e4a[_0xc0fc('0x42')]=_['intersection'](_0xee6e4a[_0xc0fc('0x38')],_0xee6e4a['query']);_0x4214af[_0xc0fc('0x3c')]=_[_0xc0fc('0x3b')](_0xee6e4a['model'],qs[_0xc0fc('0x3d')](_0x226fa3[_0xc0fc('0x39')][_0xc0fc('0x3d')]));_0x4214af['attributes']=_0x4214af[_0xc0fc('0x3c')]['length']?_0x4214af[_0xc0fc('0x3c')]:_0xee6e4a['model'];if(_0x226fa3['query']['includeAll']){_0x4214af[_0xc0fc('0x4f')]=[{'all':!![]}];}_0x4214af=_[_0xc0fc('0x46')]({},_0x4214af,_0x226fa3[_0xc0fc('0x48')]);return db['Template'][_0xc0fc('0x50')](_0x4214af)[_0xc0fc('0x29')](handleEntityNotFound(_0x585ebb,null))[_0xc0fc('0x29')](respondWithResult(_0x585ebb,null))[_0xc0fc('0x4c')](handleError(_0x585ebb,null));};exports['create']=function(_0x1646d0,_0x1e0692){return db[_0xc0fc('0x34')][_0xc0fc('0x51')](_0x1646d0['body'],{})[_0xc0fc('0x29')](function(_0x28b9bc){var _0x9d9619=_0x1646d0['user'][_0xc0fc('0x2b')]({'plain':!![]});if(!_0x9d9619)throw new Error(_0xc0fc('0x52'));if(_0x9d9619['role']===_0xc0fc('0x53')){var _0x1c0a66=_0x28b9bc[_0xc0fc('0x2b')]({'plain':!![]});var _0x39834e=_0xc0fc('0x2c');return db['UserProfileSection'][_0xc0fc('0x50')]({'where':{'name':_0x39834e,'userProfileId':_0x9d9619[_0xc0fc('0x54')]},'raw':!![]})[_0xc0fc('0x29')](function(_0x1095b5){if(_0x1095b5&&_0x1095b5[_0xc0fc('0x55')]===0x0){return db[_0xc0fc('0x56')][_0xc0fc('0x51')]({'name':_0x1c0a66[_0xc0fc('0x30')],'resourceId':_0x1c0a66['id'],'type':_0x1095b5[_0xc0fc('0x30')],'sectionId':_0x1095b5['id']},{})[_0xc0fc('0x29')](function(){return _0x28b9bc;});}else{return _0x28b9bc;}})['catch'](function(_0xce9088){logger[_0xc0fc('0x2e')](_0xc0fc('0x57'),_0xce9088);throw _0xce9088;});}return _0x28b9bc;})[_0xc0fc('0x29')](respondWithResult(_0x1e0692,0xc9))['catch'](handleError(_0x1e0692,null));};exports[_0xc0fc('0x28')]=function(_0x465262,_0x20ebd0){if(_0x465262[_0xc0fc('0x58')]['id']){delete _0x465262[_0xc0fc('0x58')]['id'];}return db['Template']['find']({'where':{'id':_0x465262[_0xc0fc('0x4e')]['id']}})[_0xc0fc('0x29')](handleEntityNotFound(_0x20ebd0,null))['then'](saveUpdates(_0x465262['body'],null))['then'](respondWithResult(_0x20ebd0,null))['catch'](handleError(_0x20ebd0,null));};exports[_0xc0fc('0x2a')]=function(_0xf0ee87,_0x396313){return db['Template'][_0xc0fc('0x50')]({'where':{'id':_0xf0ee87[_0xc0fc('0x4e')]['id']}})[_0xc0fc('0x29')](handleEntityNotFound(_0x396313,null))[_0xc0fc('0x29')](removeEntity(_0x396313,null))['catch'](handleError(_0x396313,null));}; \ No newline at end of file +var _0xff00=['limit','count','set','json','apply','save','update','destroy','then','Templates','UserProfileResource','stack','name','send','map','Template','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','offset','undefined'];(function(_0x9b2a1,_0xfdd9fb){var _0x2fadf8=function(_0x34bc5d){while(--_0x34bc5d){_0x9b2a1['push'](_0x9b2a1['shift']());}};_0x2fadf8(++_0xfdd9fb);}(_0xff00,0x131));var _0x0ff0=function(_0x3bf067,_0x3111e3){_0x3bf067=_0x3bf067-0x0;var _0x2a0b5b=_0xff00[_0x3bf067];return _0x2a0b5b;};'use strict';var emlformat=require(_0x0ff0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0ff0('0x1'));var jsonpatch=require(_0x0ff0('0x2'));var rp=require(_0x0ff0('0x3'));var moment=require(_0x0ff0('0x4'));var BPromise=require(_0x0ff0('0x5'));var Mustache=require(_0x0ff0('0x6'));var util=require(_0x0ff0('0x7'));var path=require('path');var sox=require(_0x0ff0('0x8'));var csv=require(_0x0ff0('0x9'));var ejs=require(_0x0ff0('0xa'));var fs=require('fs');var fs_extra=require(_0x0ff0('0xb'));var _=require(_0x0ff0('0xc'));var squel=require(_0x0ff0('0xd'));var crypto=require(_0x0ff0('0xe'));var jsforce=require(_0x0ff0('0xf'));var deskjs=require(_0x0ff0('0x10'));var toCsv=require(_0x0ff0('0x9'));var querystring=require(_0x0ff0('0x11'));var Papa=require(_0x0ff0('0x12'));var Redis=require(_0x0ff0('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x0ff0('0x14'));var as=require(_0x0ff0('0x15'));var hardwareService=require(_0x0ff0('0x16'));var logger=require(_0x0ff0('0x17'))('api');var utils=require(_0x0ff0('0x18'));var config=require(_0x0ff0('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a1e08,_0x60d6e3){_0x60d6e3=_0x60d6e3||0xcc;return function(_0x16996d){if(_0x16996d){return _0x1a1e08[_0x0ff0('0x1a')](_0x60d6e3);}return _0x1a1e08[_0x0ff0('0x1b')](_0x60d6e3)[_0x0ff0('0x1c')]();};}function respondWithResult(_0x11e06e,_0x5bf341){_0x5bf341=_0x5bf341||0xc8;return function(_0x56b887){if(_0x56b887){return _0x11e06e[_0x0ff0('0x1b')](_0x5bf341)['json'](_0x56b887);}};}function respondWithFilteredResult(_0x1e683f,_0x192564){return function(_0x3c219a){if(_0x3c219a){var _0x1d4976=typeof _0x192564[_0x0ff0('0x1d')]===_0x0ff0('0x1e')&&typeof _0x192564[_0x0ff0('0x1f')]===_0x0ff0('0x1e');var _0x3a1061=_0x3c219a['count'];var _0x1773cd=_0x1d4976?0x0:_0x192564['offset'];var _0x47eb5c=_0x1d4976?_0x3c219a[_0x0ff0('0x20')]:_0x192564[_0x0ff0('0x1d')]+_0x192564[_0x0ff0('0x1f')];var _0x1fc4a0;if(_0x47eb5c>=_0x3a1061){_0x47eb5c=_0x3a1061;_0x1fc4a0=0xc8;}else{_0x1fc4a0=0xce;}_0x1e683f[_0x0ff0('0x1b')](_0x1fc4a0);return _0x1e683f[_0x0ff0('0x21')]('Content-Range',_0x1773cd+'-'+_0x47eb5c+'/'+_0x3a1061)[_0x0ff0('0x22')](_0x3c219a);}return null;};}function patchUpdates(_0xb9dd4a){return function(_0x3cc94d){try{jsonpatch[_0x0ff0('0x23')](_0x3cc94d,_0xb9dd4a,!![]);}catch(_0x2b5d22){return BPromise['reject'](_0x2b5d22);}return _0x3cc94d[_0x0ff0('0x24')]();};}function saveUpdates(_0x1895f3,_0x21aff6){return function(_0x410d4a){if(_0x410d4a){return _0x410d4a[_0x0ff0('0x25')](_0x1895f3)['then'](function(_0x1f7d1c){return _0x1f7d1c;});}return null;};}function removeEntity(_0x3ea04e,_0x408c17){return function(_0x11aa8e){if(_0x11aa8e){return _0x11aa8e[_0x0ff0('0x26')]()[_0x0ff0('0x27')](function(){var _0x29a9c7=_0x11aa8e['get']({'plain':!![]});var _0x58dc0b=_0x0ff0('0x28');return db[_0x0ff0('0x29')]['destroy']({'where':{'type':_0x58dc0b,'resourceId':_0x29a9c7['id']}})['then'](function(){return _0x11aa8e;});})[_0x0ff0('0x27')](function(){_0x3ea04e['status'](0xcc)[_0x0ff0('0x1c')]();});}};}function handleEntityNotFound(_0x516204,_0x21a940){return function(_0x619a81){if(!_0x619a81){_0x516204[_0x0ff0('0x1a')](0x194);}return _0x619a81;};}function handleError(_0xcde087,_0x5d6283){_0x5d6283=_0x5d6283||0x1f4;return function(_0x11e2ec){logger['error'](_0x11e2ec[_0x0ff0('0x2a')]);if(_0x11e2ec[_0x0ff0('0x2b')]){delete _0x11e2ec[_0x0ff0('0x2b')];}_0xcde087[_0x0ff0('0x1b')](_0x5d6283)[_0x0ff0('0x2c')](_0x11e2ec);};}exports['index']=function(_0x1fd6a2,_0x35bcc9){var _0x2843ae={},_0x2ade10={},_0x38e7f3={'count':0x0,'rows':[]};var _0x4b7a4a=_[_0x0ff0('0x2d')](db[_0x0ff0('0x2e')]['rawAttributes'],function(_0x33f0b9){return{'name':_0x33f0b9[_0x0ff0('0x2f')],'type':_0x33f0b9['type'][_0x0ff0('0x30')]};});_0x2ade10[_0x0ff0('0x31')]=_[_0x0ff0('0x2d')](_0x4b7a4a,_0x0ff0('0x2b'));_0x2ade10[_0x0ff0('0x32')]=_[_0x0ff0('0x33')](_0x1fd6a2[_0x0ff0('0x32')]);_0x2ade10[_0x0ff0('0x34')]=_[_0x0ff0('0x35')](_0x2ade10[_0x0ff0('0x31')],_0x2ade10['query']);_0x2843ae[_0x0ff0('0x36')]=_[_0x0ff0('0x35')](_0x2ade10[_0x0ff0('0x31')],qs['fields'](_0x1fd6a2['query'][_0x0ff0('0x37')]));_0x2843ae[_0x0ff0('0x36')]=_0x2843ae[_0x0ff0('0x36')][_0x0ff0('0x38')]?_0x2843ae[_0x0ff0('0x36')]:_0x2ade10['model'];if(!_0x1fd6a2['query'][_0x0ff0('0x39')](_0x0ff0('0x3a'))){_0x2843ae[_0x0ff0('0x1f')]=qs[_0x0ff0('0x1f')](_0x1fd6a2[_0x0ff0('0x32')][_0x0ff0('0x1f')]);_0x2843ae['offset']=qs[_0x0ff0('0x1d')](_0x1fd6a2['query'][_0x0ff0('0x1d')]);}_0x2843ae[_0x0ff0('0x3b')]=qs['sort'](_0x1fd6a2[_0x0ff0('0x32')][_0x0ff0('0x3c')]);_0x2843ae['where']=qs['filters'](_[_0x0ff0('0x3d')](_0x1fd6a2[_0x0ff0('0x32')],_0x2ade10[_0x0ff0('0x34')]),_0x4b7a4a);if(_0x1fd6a2[_0x0ff0('0x32')][_0x0ff0('0x3e')]){_0x2843ae[_0x0ff0('0x3f')]=_[_0x0ff0('0x40')](_0x2843ae['where'],{'$or':_[_0x0ff0('0x2d')](_0x4b7a4a,function(_0x1735a3){if(_0x1735a3[_0x0ff0('0x41')]!==_0x0ff0('0x42')){var _0x2409e7={};_0x2409e7[_0x1735a3[_0x0ff0('0x2b')]]={'$like':'%'+_0x1fd6a2[_0x0ff0('0x32')][_0x0ff0('0x3e')]+'%'};return _0x2409e7;}})});}_0x2843ae=_[_0x0ff0('0x40')]({},_0x2843ae,_0x1fd6a2[_0x0ff0('0x43')]);var _0x2cf4a1={'where':_0x2843ae['where']};return db[_0x0ff0('0x2e')][_0x0ff0('0x20')](_0x2cf4a1)[_0x0ff0('0x27')](function(_0x2468fb){_0x38e7f3[_0x0ff0('0x20')]=_0x2468fb;if(_0x1fd6a2[_0x0ff0('0x32')][_0x0ff0('0x44')]){_0x2843ae[_0x0ff0('0x45')]=[{'all':!![]}];}return db[_0x0ff0('0x2e')][_0x0ff0('0x46')](_0x2843ae);})[_0x0ff0('0x27')](function(_0x28ce81){_0x38e7f3[_0x0ff0('0x47')]=_0x28ce81;return _0x38e7f3;})[_0x0ff0('0x27')](respondWithFilteredResult(_0x35bcc9,_0x2843ae))[_0x0ff0('0x48')](handleError(_0x35bcc9,null));};exports['show']=function(_0x158baf,_0x16401c){var _0x28471b={'raw':!![],'where':{'id':_0x158baf[_0x0ff0('0x49')]['id']}},_0x133da6={};_0x133da6['model']=_['keys'](db[_0x0ff0('0x2e')]['rawAttributes']);_0x133da6['query']=_[_0x0ff0('0x33')](_0x158baf[_0x0ff0('0x32')]);_0x133da6['filters']=_[_0x0ff0('0x35')](_0x133da6[_0x0ff0('0x31')],_0x133da6[_0x0ff0('0x32')]);_0x28471b[_0x0ff0('0x36')]=_['intersection'](_0x133da6[_0x0ff0('0x31')],qs[_0x0ff0('0x37')](_0x158baf[_0x0ff0('0x32')]['fields']));_0x28471b[_0x0ff0('0x36')]=_0x28471b['attributes'][_0x0ff0('0x38')]?_0x28471b['attributes']:_0x133da6[_0x0ff0('0x31')];if(_0x158baf[_0x0ff0('0x32')][_0x0ff0('0x44')]){_0x28471b[_0x0ff0('0x45')]=[{'all':!![]}];}_0x28471b=_[_0x0ff0('0x40')]({},_0x28471b,_0x158baf[_0x0ff0('0x43')]);return db[_0x0ff0('0x2e')][_0x0ff0('0x4a')](_0x28471b)[_0x0ff0('0x27')](handleEntityNotFound(_0x16401c,null))[_0x0ff0('0x27')](respondWithResult(_0x16401c,null))[_0x0ff0('0x48')](handleError(_0x16401c,null));};exports['create']=function(_0x1ee84f,_0x2ad27c){return db[_0x0ff0('0x2e')][_0x0ff0('0x4b')](_0x1ee84f[_0x0ff0('0x4c')],{})[_0x0ff0('0x27')](function(_0x30bbb3){var _0x4dc313=_0x1ee84f[_0x0ff0('0x4d')]['get']({'plain':!![]});if(!_0x4dc313)throw new Error(_0x0ff0('0x4e'));if(_0x4dc313[_0x0ff0('0x4f')]===_0x0ff0('0x4d')){var _0x238057=_0x30bbb3[_0x0ff0('0x50')]({'plain':!![]});var _0xcd7bbe=_0x0ff0('0x28');return db['UserProfileSection'][_0x0ff0('0x4a')]({'where':{'name':_0xcd7bbe,'userProfileId':_0x4dc313[_0x0ff0('0x51')]},'raw':!![]})[_0x0ff0('0x27')](function(_0x445f1e){if(_0x445f1e&&_0x445f1e[_0x0ff0('0x52')]===0x0){return db[_0x0ff0('0x29')][_0x0ff0('0x4b')]({'name':_0x238057[_0x0ff0('0x2b')],'resourceId':_0x238057['id'],'type':_0x445f1e[_0x0ff0('0x2b')],'sectionId':_0x445f1e['id']},{})['then'](function(){return _0x30bbb3;});}else{return _0x30bbb3;}})[_0x0ff0('0x48')](function(_0x11fc83){logger['error'](_0x0ff0('0x53'),_0x11fc83);throw _0x11fc83;});}return _0x30bbb3;})[_0x0ff0('0x27')](respondWithResult(_0x2ad27c,0xc9))[_0x0ff0('0x48')](handleError(_0x2ad27c,null));};exports['update']=function(_0x5d70be,_0x4370a1){if(_0x5d70be['body']['id']){delete _0x5d70be['body']['id'];}return db[_0x0ff0('0x2e')][_0x0ff0('0x4a')]({'where':{'id':_0x5d70be[_0x0ff0('0x49')]['id']}})[_0x0ff0('0x27')](handleEntityNotFound(_0x4370a1,null))['then'](saveUpdates(_0x5d70be[_0x0ff0('0x4c')],null))[_0x0ff0('0x27')](respondWithResult(_0x4370a1,null))[_0x0ff0('0x48')](handleError(_0x4370a1,null));};exports[_0x0ff0('0x26')]=function(_0x333c0c,_0x322cc6){return db['Template'][_0x0ff0('0x4a')]({'where':{'id':_0x333c0c[_0x0ff0('0x49')]['id']}})[_0x0ff0('0x27')](handleEntityNotFound(_0x322cc6,null))[_0x0ff0('0x27')](removeEntity(_0x322cc6,null))['catch'](handleError(_0x322cc6,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 24c46ac..288f86c 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 _0xfa95=['rimraf','../../config/environment','./template.attributes','exports','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x340819,_0x338c79){var _0x14c52f=function(_0x474888){while(--_0x474888){_0x340819['push'](_0x340819['shift']());}};_0x14c52f(++_0x338c79);}(_0xfa95,0x1e8));var _0x5fa9=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0xfa95[_0x4b7895];return _0x264180;};'use strict';var _=require(_0x5fa9('0x0'));var util=require(_0x5fa9('0x1'));var logger=require('../../config/logger')(_0x5fa9('0x2'));var moment=require(_0x5fa9('0x3'));var BPromise=require(_0x5fa9('0x4'));var rp=require(_0x5fa9('0x5'));var fs=require('fs');var path=require(_0x5fa9('0x6'));var rimraf=require(_0x5fa9('0x7'));var config=require(_0x5fa9('0x8'));var attributes=require(_0x5fa9('0x9'));module[_0x5fa9('0xa')]=function(_0x515b1f,_0x5f5840){return _0x515b1f['define']('Template',attributes,{'tableName':'tools_templates','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xecc8=['define','Template','tools_templates','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./template.attributes','exports'];(function(_0x3cfaa3,_0x34f6c9){var _0x55a02c=function(_0x2606fd){while(--_0x2606fd){_0x3cfaa3['push'](_0x3cfaa3['shift']());}};_0x55a02c(++_0x34f6c9);}(_0xecc8,0x16f));var _0x8ecc=function(_0x2d2fad,_0x38ff04){_0x2d2fad=_0x2d2fad-0x0;var _0x3dac77=_0xecc8[_0x2d2fad];return _0x3dac77;};'use strict';var _=require(_0x8ecc('0x0'));var util=require(_0x8ecc('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8ecc('0x2'));var BPromise=require(_0x8ecc('0x3'));var rp=require(_0x8ecc('0x4'));var fs=require('fs');var path=require(_0x8ecc('0x5'));var rimraf=require(_0x8ecc('0x6'));var config=require(_0x8ecc('0x7'));var attributes=require(_0x8ecc('0x8'));module[_0x8ecc('0x9')]=function(_0x43d381,_0x52fa23){return _0x43d381[_0x8ecc('0xa')](_0x8ecc('0xb'),attributes,{'tableName':_0x8ecc('0xc'),'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 18804fc..96a007e 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 _0xa866=['model','attributes','map','GetTemplate','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','Template,\x20%s,\x20%s','message','result','catch','Template','findAll','options','raw','where','limit','include'];(function(_0x27e8a8,_0x5a050d){var _0x257d08=function(_0xd3cbce){while(--_0xd3cbce){_0x27e8a8['push'](_0x27e8a8['shift']());}};_0x257d08(++_0x5a050d);}(_0xa866,0x6a));var _0x6a86=function(_0x4ea0d9,_0x2cb7c4){_0x4ea0d9=_0x4ea0d9-0x0;var _0x463d64=_0xa866[_0x4ea0d9];return _0x463d64;};'use strict';var _=require(_0x6a86('0x0'));var util=require(_0x6a86('0x1'));var moment=require(_0x6a86('0x2'));var BPromise=require(_0x6a86('0x3'));var rs=require(_0x6a86('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6a86('0x5'))['db'];var utils=require(_0x6a86('0x6'));var logger=require(_0x6a86('0x7'))('rpc');var config=require(_0x6a86('0x8'));var jayson=require(_0x6a86('0x9'));var client=jayson[_0x6a86('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x183997,_0x288910,_0x3ed589){return new BPromise(function(_0x1330e1,_0x37e3ee){return client[_0x6a86('0xb')](_0x183997,_0x3ed589)[_0x6a86('0xc')](function(_0x4a83c9){logger[_0x6a86('0xd')]('Template,\x20%s,\x20%s',_0x288910,_0x6a86('0xe'));logger[_0x6a86('0xf')](_0x6a86('0x10'),_0x288910,'request\x20sent',JSON[_0x6a86('0x11')](_0x4a83c9));if(_0x4a83c9[_0x6a86('0x12')]){if(_0x4a83c9['error']['code']===0x1f4){logger[_0x6a86('0x12')](_0x6a86('0x13'),_0x288910,_0x4a83c9[_0x6a86('0x12')][_0x6a86('0x14')]);return _0x37e3ee(_0x4a83c9[_0x6a86('0x12')][_0x6a86('0x14')]);}logger[_0x6a86('0x12')](_0x6a86('0x13'),_0x288910,_0x4a83c9['error'][_0x6a86('0x14')]);return _0x1330e1(_0x4a83c9[_0x6a86('0x12')]['message']);}else{logger[_0x6a86('0xd')](_0x6a86('0x13'),_0x288910,_0x6a86('0xe'));_0x1330e1(_0x4a83c9[_0x6a86('0x15')][_0x6a86('0x14')]);}})[_0x6a86('0x16')](function(_0x500b59){logger[_0x6a86('0x12')](_0x6a86('0x13'),_0x288910,_0x500b59);_0x37e3ee(_0x500b59);});});}exports['GetTemplate']=function(_0x50024d){var _0x11fe3b=this;return new Promise(function(_0x535fd9,_0x588a2f){return db[_0x6a86('0x17')][_0x6a86('0x18')]({'raw':_0x50024d[_0x6a86('0x19')]?_0x50024d['options'][_0x6a86('0x1a')]===undefined?!![]:![]:!![],'where':_0x50024d[_0x6a86('0x19')]?_0x50024d[_0x6a86('0x19')][_0x6a86('0x1b')]||null:null,'attributes':_0x50024d[_0x6a86('0x19')]?_0x50024d[_0x6a86('0x19')]['attributes']||null:null,'limit':_0x50024d['options']?_0x50024d['options'][_0x6a86('0x1c')]||null:null,'include':_0x50024d[_0x6a86('0x19')]?_0x50024d[_0x6a86('0x19')][_0x6a86('0x1d')]?_['map'](_0x50024d[_0x6a86('0x19')][_0x6a86('0x1d')],function(_0x366f4a){return{'model':db[_0x366f4a[_0x6a86('0x1e')]],'as':_0x366f4a['as'],'attributes':_0x366f4a[_0x6a86('0x1f')],'include':_0x366f4a[_0x6a86('0x1d')]?_[_0x6a86('0x20')](_0x366f4a[_0x6a86('0x1d')],function(_0x40e616){return{'model':db[_0x40e616['model']],'as':_0x40e616['as'],'attributes':_0x40e616['attributes'],'include':_0x40e616[_0x6a86('0x1d')]?_['map'](_0x40e616[_0x6a86('0x1d')],function(_0x1ff9c8){return{'model':db[_0x1ff9c8['model']],'as':_0x1ff9c8['as'],'attributes':_0x1ff9c8[_0x6a86('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x6a86('0xc')](function(_0x2da9f8){logger['info'](_0x6a86('0x21'),_0x50024d);logger['debug']('GetTemplate',_0x50024d,JSON['stringify'](_0x2da9f8));_0x535fd9(_0x2da9f8);})[_0x6a86('0x16')](function(_0xab04e4){logger[_0x6a86('0x12')]('GetTemplate',_0xab04e4[_0x6a86('0x14')],_0x50024d);_0x588a2f(_0x11fe3b[_0x6a86('0x12')](0x1f4,_0xab04e4[_0x6a86('0x14')]));});});}; \ No newline at end of file +var _0x3c0d=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Template,\x20%s,\x20%s','request\x20sent','Template,\x20%s,\x20%s,\x20%s','error','code','message','result','GetTemplate','findAll','options','raw','attributes','map','model','include','debug','stringify','catch','bluebird','randomstring'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3c0d,0xf6));var _0xd3c0=function(_0x2dc920,_0x5a76ac){_0x2dc920=_0x2dc920-0x0;var _0x35f176=_0x3c0d[_0x2dc920];return _0x35f176;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xd3c0('0x0'));var rs=require(_0xd3c0('0x1'));var fs=require('fs');var Redis=require(_0xd3c0('0x2'));var db=require(_0xd3c0('0x3'))['db'];var utils=require(_0xd3c0('0x4'));var logger=require(_0xd3c0('0x5'))(_0xd3c0('0x6'));var config=require(_0xd3c0('0x7'));var jayson=require(_0xd3c0('0x8'));var client=jayson['client'][_0xd3c0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x47fa5f,_0x6308e2,_0x10f804){return new BPromise(function(_0x2c37b8,_0x2d11d5){return client[_0xd3c0('0xa')](_0x47fa5f,_0x10f804)[_0xd3c0('0xb')](function(_0x2be3c0){logger[_0xd3c0('0xc')](_0xd3c0('0xd'),_0x6308e2,_0xd3c0('0xe'));logger['debug'](_0xd3c0('0xf'),_0x6308e2,_0xd3c0('0xe'),JSON['stringify'](_0x2be3c0));if(_0x2be3c0['error']){if(_0x2be3c0[_0xd3c0('0x10')][_0xd3c0('0x11')]===0x1f4){logger[_0xd3c0('0x10')](_0xd3c0('0xd'),_0x6308e2,_0x2be3c0['error'][_0xd3c0('0x12')]);return _0x2d11d5(_0x2be3c0[_0xd3c0('0x10')][_0xd3c0('0x12')]);}logger['error'](_0xd3c0('0xd'),_0x6308e2,_0x2be3c0[_0xd3c0('0x10')][_0xd3c0('0x12')]);return _0x2c37b8(_0x2be3c0[_0xd3c0('0x10')][_0xd3c0('0x12')]);}else{logger[_0xd3c0('0xc')]('Template,\x20%s,\x20%s',_0x6308e2,'request\x20sent');_0x2c37b8(_0x2be3c0[_0xd3c0('0x13')][_0xd3c0('0x12')]);}})['catch'](function(_0x3e9b6b){logger[_0xd3c0('0x10')](_0xd3c0('0xd'),_0x6308e2,_0x3e9b6b);_0x2d11d5(_0x3e9b6b);});});}exports[_0xd3c0('0x14')]=function(_0x1a204c){var _0x2adf93=this;return new Promise(function(_0x24e048,_0x53584a){return db['Template'][_0xd3c0('0x15')]({'raw':_0x1a204c['options']?_0x1a204c[_0xd3c0('0x16')][_0xd3c0('0x17')]===undefined?!![]:![]:!![],'where':_0x1a204c[_0xd3c0('0x16')]?_0x1a204c[_0xd3c0('0x16')]['where']||null:null,'attributes':_0x1a204c['options']?_0x1a204c[_0xd3c0('0x16')][_0xd3c0('0x18')]||null:null,'limit':_0x1a204c[_0xd3c0('0x16')]?_0x1a204c[_0xd3c0('0x16')]['limit']||null:null,'include':_0x1a204c[_0xd3c0('0x16')]?_0x1a204c['options']['include']?_[_0xd3c0('0x19')](_0x1a204c[_0xd3c0('0x16')]['include'],function(_0x3ac1b3){return{'model':db[_0x3ac1b3[_0xd3c0('0x1a')]],'as':_0x3ac1b3['as'],'attributes':_0x3ac1b3['attributes'],'include':_0x3ac1b3[_0xd3c0('0x1b')]?_['map'](_0x3ac1b3['include'],function(_0x23e772){return{'model':db[_0x23e772[_0xd3c0('0x1a')]],'as':_0x23e772['as'],'attributes':_0x23e772['attributes'],'include':_0x23e772['include']?_[_0xd3c0('0x19')](_0x23e772[_0xd3c0('0x1b')],function(_0x58d3cc){return{'model':db[_0x58d3cc['model']],'as':_0x58d3cc['as'],'attributes':_0x58d3cc[_0xd3c0('0x18')]};}):[]};}):[]};}):[]:[]})[_0xd3c0('0xb')](function(_0xa7a5c2){logger['info'](_0xd3c0('0x14'),_0x1a204c);logger[_0xd3c0('0x1c')]('GetTemplate',_0x1a204c,JSON[_0xd3c0('0x1d')](_0xa7a5c2));_0x24e048(_0xa7a5c2);})[_0xd3c0('0x1e')](function(_0xeeaecc){logger[_0xd3c0('0x10')](_0xd3c0('0x14'),_0xeeaecc['message'],_0x1a204c);_0x53584a(_0x2adf93[_0xd3c0('0x10')](0x1f4,_0xeeaecc[_0xd3c0('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 122d1f1..9733e6f 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 _0x4e80=['getActions','post','addAllCondition','/:id/any_conditions','addAnyCondition','update','destroy','exports','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./trigger.controller','get','index','/:id','isAuthenticated','show','/:id/all_conditions','/:id/actions'];(function(_0x5535c4,_0x407c29){var _0x2a48cc=function(_0x2dc051){while(--_0x2dc051){_0x5535c4['push'](_0x5535c4['shift']());}};_0x2a48cc(++_0x407c29);}(_0x4e80,0xda));var _0x04e8=function(_0x2d5aca,_0x19beca){_0x2d5aca=_0x2d5aca-0x0;var _0x24ae42=_0x4e80[_0x2d5aca];return _0x24ae42;};'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['getAllConditions']);router[_0x04e8('0x6')]('/:id/any_conditions',auth[_0x04e8('0x9')](),controller['getAnyConditions']);router[_0x04e8('0x6')](_0x04e8('0xc'),auth[_0x04e8('0x9')](),controller[_0x04e8('0xd')]);router[_0x04e8('0xe')]('/',auth[_0x04e8('0x9')](),controller['create']);router[_0x04e8('0xe')](_0x04e8('0xb'),auth[_0x04e8('0x9')](),controller[_0x04e8('0xf')]);router[_0x04e8('0xe')](_0x04e8('0x10'),auth['isAuthenticated'](),controller[_0x04e8('0x11')]);router[_0x04e8('0xe')]('/:id/actions',auth[_0x04e8('0x9')](),controller['addAction']);router['put'](_0x04e8('0x8'),auth['isAuthenticated'](),controller[_0x04e8('0x12')]);router['delete'](_0x04e8('0x8'),auth['isAuthenticated'](),controller[_0x04e8('0x13')]);module[_0x04e8('0x14')]=router; \ No newline at end of file +var _0x676b=['./trigger.controller','get','isAuthenticated','/:id','/:id/all_conditions','getAllConditions','/:id/any_conditions','getActions','post','addAllCondition','addAnyCondition','addAction','put','update','delete','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment'];(function(_0x3e44fa,_0x75ed2a){var _0x2a0aba=function(_0x1db6a7){while(--_0x1db6a7){_0x3e44fa['push'](_0x3e44fa['shift']());}};_0x2a0aba(++_0x75ed2a);}(_0x676b,0x6d));var _0xb676=function(_0x5b5cde,_0x1f7c5f){_0x5b5cde=_0x5b5cde-0x0;var _0x364ad2=_0x676b[_0x5b5cde];return _0x364ad2;};'use strict';var multer=require('multer');var util=require(_0xb676('0x0'));var path=require(_0xb676('0x1'));var timeout=require(_0xb676('0x2'));var express=require('express');var router=express[_0xb676('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb676('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xb676('0x5'));var controller=require(_0xb676('0x6'));router[_0xb676('0x7')]('/',auth[_0xb676('0x8')](),controller['index']);router[_0xb676('0x7')](_0xb676('0x9'),auth[_0xb676('0x8')](),controller['show']);router[_0xb676('0x7')](_0xb676('0xa'),auth['isAuthenticated'](),controller[_0xb676('0xb')]);router[_0xb676('0x7')](_0xb676('0xc'),auth[_0xb676('0x8')](),controller['getAnyConditions']);router['get']('/:id/actions',auth[_0xb676('0x8')](),controller[_0xb676('0xd')]);router[_0xb676('0xe')]('/',auth[_0xb676('0x8')](),controller['create']);router['post'](_0xb676('0xa'),auth['isAuthenticated'](),controller[_0xb676('0xf')]);router[_0xb676('0xe')](_0xb676('0xc'),auth[_0xb676('0x8')](),controller[_0xb676('0x10')]);router[_0xb676('0xe')]('/:id/actions',auth[_0xb676('0x8')](),controller[_0xb676('0x11')]);router[_0xb676('0x12')](_0xb676('0x9'),auth['isAuthenticated'](),controller[_0xb676('0x13')]);router[_0xb676('0x14')](_0xb676('0x9'),auth[_0xb676('0x8')](),controller[_0xb676('0x15')]);module[_0xb676('0x16')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index a688e60..207e1a1 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 _0x7352=['STRING','sequelize','exports'];(function(_0x3b73dc,_0x44dd01){var _0x154909=function(_0x1c68ea){while(--_0x1c68ea){_0x3b73dc['push'](_0x3b73dc['shift']());}};_0x154909(++_0x44dd01);}(_0x7352,0x18d));var _0x2735=function(_0x3a0783,_0x1506e6){_0x3a0783=_0x3a0783-0x0;var _0x629c72=_0x7352[_0x3a0783];return _0x629c72;};'use strict';var Sequelize=require(_0x2735('0x0'));module[_0x2735('0x1')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x2735('0x2')]},'description':{'type':Sequelize[_0x2735('0x2')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x535f=['exports','STRING','BOOLEAN'];(function(_0x3665de,_0x27a4e8){var _0x585e50=function(_0x16d56f){while(--_0x16d56f){_0x3665de['push'](_0x3665de['shift']());}};_0x585e50(++_0x27a4e8);}(_0x535f,0x111));var _0xf535=function(_0x40f99c,_0x234726){_0x40f99c=_0x40f99c-0x0;var _0x17f858=_0x535f[_0x40f99c];return _0x17f858;};'use strict';var Sequelize=require('sequelize');module[_0xf535('0x0')]={'name':{'type':Sequelize[_0xf535('0x1')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf535('0x1')]},'status':{'type':Sequelize[_0xf535('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 39ebcab..72480dc 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 _0xd98c=['nolimit','sort','where','filters','merge','VIRTUAL','filter','options','includeAll','include','rows','params','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','TriggerAllId','addAnyCondition','TriggerAnyId','getAllConditions','findOne','keys','Condition','pick','getAnyConditions','order','TriggerId','Action','getActions','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','offset','count','set','Content-Range','json','apply','reject','save','update','then','get','Triggers','UserProfileResource','destroy','stack','name','send','index','map','Trigger','rawAttributes','type','key','model','intersection','attributes','fields','length','query','hasOwnProperty'];(function(_0x24fd35,_0x13b401){var _0x1b2272=function(_0x2985cb){while(--_0x2985cb){_0x24fd35['push'](_0x24fd35['shift']());}};_0x1b2272(++_0x13b401);}(_0xd98c,0x143));var _0xcd98=function(_0x12ca3b,_0x22893d){_0x12ca3b=_0x12ca3b-0x0;var _0x370056=_0xd98c[_0x12ca3b];return _0x370056;};'use strict';var emlformat=require(_0xcd98('0x0'));var rimraf=require(_0xcd98('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcd98('0x2'));var rp=require(_0xcd98('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xcd98('0x4'));var util=require(_0xcd98('0x5'));var path=require(_0xcd98('0x6'));var sox=require(_0xcd98('0x7'));var csv=require(_0xcd98('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcd98('0x9'));var _=require(_0xcd98('0xa'));var squel=require(_0xcd98('0xb'));var crypto=require(_0xcd98('0xc'));var jsforce=require(_0xcd98('0xd'));var deskjs=require(_0xcd98('0xe'));var toCsv=require(_0xcd98('0x8'));var querystring=require(_0xcd98('0xf'));var Papa=require(_0xcd98('0x10'));var Redis=require(_0xcd98('0x11'));var authService=require(_0xcd98('0x12'));var qs=require(_0xcd98('0x13'));var as=require(_0xcd98('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcd98('0x15'))(_0xcd98('0x16'));var utils=require('../../config/utils');var config=require(_0xcd98('0x17'));var licenseUtil=require(_0xcd98('0x18'));var db=require(_0xcd98('0x19'))['db'];function respondWithStatusCode(_0x40ca4f,_0x490b3e){_0x490b3e=_0x490b3e||0xcc;return function(_0x308b7e){if(_0x308b7e){return _0x40ca4f[_0xcd98('0x1a')](_0x490b3e);}return _0x40ca4f[_0xcd98('0x1b')](_0x490b3e)[_0xcd98('0x1c')]();};}function respondWithResult(_0x480624,_0x3faf1c){_0x3faf1c=_0x3faf1c||0xc8;return function(_0x5e974d){if(_0x5e974d){return _0x480624['status'](_0x3faf1c)['json'](_0x5e974d);}};}function respondWithFilteredResult(_0x520a0a,_0x59f23e){return function(_0x262f0c){if(_0x262f0c){var _0x140c7d=typeof _0x59f23e['offset']===_0xcd98('0x1d')&&typeof _0x59f23e[_0xcd98('0x1e')]==='undefined';var _0x3e5809=_0x262f0c['count'];var _0x5822fc=_0x140c7d?0x0:_0x59f23e[_0xcd98('0x1f')];var _0x16d103=_0x140c7d?_0x262f0c[_0xcd98('0x20')]:_0x59f23e[_0xcd98('0x1f')]+_0x59f23e[_0xcd98('0x1e')];var _0x349420;if(_0x16d103>=_0x3e5809){_0x16d103=_0x3e5809;_0x349420=0xc8;}else{_0x349420=0xce;}_0x520a0a[_0xcd98('0x1b')](_0x349420);return _0x520a0a[_0xcd98('0x21')](_0xcd98('0x22'),_0x5822fc+'-'+_0x16d103+'/'+_0x3e5809)[_0xcd98('0x23')](_0x262f0c);}return null;};}function patchUpdates(_0x1df2cf){return function(_0x50dc71){try{jsonpatch[_0xcd98('0x24')](_0x50dc71,_0x1df2cf,!![]);}catch(_0x3299d4){return BPromise[_0xcd98('0x25')](_0x3299d4);}return _0x50dc71[_0xcd98('0x26')]();};}function saveUpdates(_0x158255,_0x20698d){return function(_0xa0063b){if(_0xa0063b){return _0xa0063b[_0xcd98('0x27')](_0x158255)['then'](function(_0x30530f){return _0x30530f;});}return null;};}function removeEntity(_0x75ad69,_0x141ef0){return function(_0x58ae55){if(_0x58ae55){return _0x58ae55['destroy']()[_0xcd98('0x28')](function(){var _0x2906ce=_0x58ae55[_0xcd98('0x29')]({'plain':!![]});var _0xd85434=_0xcd98('0x2a');return db[_0xcd98('0x2b')][_0xcd98('0x2c')]({'where':{'type':_0xd85434,'resourceId':_0x2906ce['id']}})[_0xcd98('0x28')](function(){return _0x58ae55;});})[_0xcd98('0x28')](function(){_0x75ad69[_0xcd98('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x53f0bd,_0x81d803){return function(_0x4128df){if(!_0x4128df){_0x53f0bd[_0xcd98('0x1a')](0x194);}return _0x4128df;};}function handleError(_0xcbd2f1,_0x594c6c){_0x594c6c=_0x594c6c||0x1f4;return function(_0x4516e9){logger['error'](_0x4516e9[_0xcd98('0x2d')]);if(_0x4516e9[_0xcd98('0x2e')]){delete _0x4516e9[_0xcd98('0x2e')];}_0xcbd2f1[_0xcd98('0x1b')](_0x594c6c)[_0xcd98('0x2f')](_0x4516e9);};}exports[_0xcd98('0x30')]=function(_0x3090c0,_0x171a41){var _0x32e945={},_0x130537={},_0x57e1f8={'count':0x0,'rows':[]};var _0x546360=_[_0xcd98('0x31')](db[_0xcd98('0x32')][_0xcd98('0x33')],function(_0x57d9e3){return{'name':_0x57d9e3['fieldName'],'type':_0x57d9e3[_0xcd98('0x34')][_0xcd98('0x35')]};});_0x130537[_0xcd98('0x36')]=_['map'](_0x546360,_0xcd98('0x2e'));_0x130537['query']=_['keys'](_0x3090c0['query']);_0x130537['filters']=_[_0xcd98('0x37')](_0x130537['model'],_0x130537['query']);_0x32e945[_0xcd98('0x38')]=_['intersection'](_0x130537[_0xcd98('0x36')],qs[_0xcd98('0x39')](_0x3090c0['query'][_0xcd98('0x39')]));_0x32e945['attributes']=_0x32e945[_0xcd98('0x38')][_0xcd98('0x3a')]?_0x32e945[_0xcd98('0x38')]:_0x130537[_0xcd98('0x36')];if(!_0x3090c0[_0xcd98('0x3b')][_0xcd98('0x3c')](_0xcd98('0x3d'))){_0x32e945[_0xcd98('0x1e')]=qs[_0xcd98('0x1e')](_0x3090c0['query'][_0xcd98('0x1e')]);_0x32e945['offset']=qs[_0xcd98('0x1f')](_0x3090c0[_0xcd98('0x3b')]['offset']);}_0x32e945['order']=qs[_0xcd98('0x3e')](_0x3090c0[_0xcd98('0x3b')]['sort']);_0x32e945[_0xcd98('0x3f')]=qs[_0xcd98('0x40')](_['pick'](_0x3090c0[_0xcd98('0x3b')],_0x130537[_0xcd98('0x40')]),_0x546360);if(_0x3090c0[_0xcd98('0x3b')]['filter']){_0x32e945[_0xcd98('0x3f')]=_[_0xcd98('0x41')](_0x32e945['where'],{'$or':_[_0xcd98('0x31')](_0x546360,function(_0x25e792){if(_0x25e792['type']!==_0xcd98('0x42')){var _0x2e2b3c={};_0x2e2b3c[_0x25e792['name']]={'$like':'%'+_0x3090c0['query'][_0xcd98('0x43')]+'%'};return _0x2e2b3c;}})});}_0x32e945=_[_0xcd98('0x41')]({},_0x32e945,_0x3090c0[_0xcd98('0x44')]);var _0x5f5a9b={'where':_0x32e945[_0xcd98('0x3f')]};return db[_0xcd98('0x32')][_0xcd98('0x20')](_0x5f5a9b)[_0xcd98('0x28')](function(_0x108ffd){_0x57e1f8['count']=_0x108ffd;if(_0x3090c0[_0xcd98('0x3b')][_0xcd98('0x45')]){_0x32e945[_0xcd98('0x46')]=[{'all':!![]}];}return db['Trigger']['findAll'](_0x32e945);})[_0xcd98('0x28')](function(_0x4afda3){_0x57e1f8[_0xcd98('0x47')]=_0x4afda3;return _0x57e1f8;})[_0xcd98('0x28')](respondWithFilteredResult(_0x171a41,_0x32e945))['catch'](handleError(_0x171a41,null));};exports['show']=function(_0x1a4165,_0x2d00a7){var _0x569560={'raw':![],'where':{'id':_0x1a4165[_0xcd98('0x48')]['id']}},_0x70cbb8={};_0x70cbb8[_0xcd98('0x36')]=_['keys'](db[_0xcd98('0x32')][_0xcd98('0x33')]);_0x70cbb8[_0xcd98('0x3b')]=_['keys'](_0x1a4165['query']);_0x70cbb8[_0xcd98('0x40')]=_[_0xcd98('0x37')](_0x70cbb8[_0xcd98('0x36')],_0x70cbb8[_0xcd98('0x3b')]);_0x569560[_0xcd98('0x38')]=_['intersection'](_0x70cbb8[_0xcd98('0x36')],qs[_0xcd98('0x39')](_0x1a4165[_0xcd98('0x3b')]['fields']));_0x569560[_0xcd98('0x38')]=_0x569560[_0xcd98('0x38')][_0xcd98('0x3a')]?_0x569560['attributes']:_0x70cbb8[_0xcd98('0x36')];if(_0x1a4165[_0xcd98('0x3b')]['includeAll']){_0x569560['include']=[{'all':!![]}];}_0x569560=_[_0xcd98('0x41')]({},_0x569560,_0x1a4165[_0xcd98('0x44')]);return db[_0xcd98('0x32')][_0xcd98('0x49')](_0x569560)[_0xcd98('0x28')](handleEntityNotFound(_0x2d00a7,null))[_0xcd98('0x28')](respondWithResult(_0x2d00a7,null))[_0xcd98('0x4a')](handleError(_0x2d00a7,null));};exports[_0xcd98('0x4b')]=function(_0x5fd9a6,_0x1f318b){return db['Trigger'][_0xcd98('0x4b')](_0x5fd9a6[_0xcd98('0x4c')],{})['then'](function(_0x54a6f4){var _0x3beeb7=_0x5fd9a6['user']['get']({'plain':!![]});if(!_0x3beeb7)throw new Error(_0xcd98('0x4d'));if(_0x3beeb7['role']==='user'){var _0x254056=_0x54a6f4[_0xcd98('0x29')]({'plain':!![]});var _0xb88d6e='Triggers';return db[_0xcd98('0x4e')][_0xcd98('0x49')]({'where':{'name':_0xb88d6e,'userProfileId':_0x3beeb7[_0xcd98('0x4f')]},'raw':!![]})['then'](function(_0x56a8e1){if(_0x56a8e1&&_0x56a8e1[_0xcd98('0x50')]===0x0){return db['UserProfileResource']['create']({'name':_0x254056['name'],'resourceId':_0x254056['id'],'type':_0x56a8e1[_0xcd98('0x2e')],'sectionId':_0x56a8e1['id']},{})['then'](function(){return _0x54a6f4;});}else{return _0x54a6f4;}})[_0xcd98('0x4a')](function(_0x511ebf){logger[_0xcd98('0x51')](_0xcd98('0x52'),_0x511ebf);throw _0x511ebf;});}return _0x54a6f4;})['then'](respondWithResult(_0x1f318b,0xc9))[_0xcd98('0x4a')](handleError(_0x1f318b,null));};exports[_0xcd98('0x27')]=function(_0x5550b1,_0x15e3ac){if(_0x5550b1['body']['id']){delete _0x5550b1[_0xcd98('0x4c')]['id'];}return db[_0xcd98('0x32')][_0xcd98('0x49')]({'where':{'id':_0x5550b1[_0xcd98('0x48')]['id']}})[_0xcd98('0x28')](handleEntityNotFound(_0x15e3ac,null))[_0xcd98('0x28')](saveUpdates(_0x5550b1[_0xcd98('0x4c')],null))[_0xcd98('0x28')](respondWithResult(_0x15e3ac,null))[_0xcd98('0x4a')](handleError(_0x15e3ac,null));};exports[_0xcd98('0x2c')]=function(_0x6034e5,_0x2abcb3){return db[_0xcd98('0x32')][_0xcd98('0x49')]({'where':{'id':_0x6034e5[_0xcd98('0x48')]['id']}})['then'](handleEntityNotFound(_0x2abcb3,null))[_0xcd98('0x28')](removeEntity(_0x2abcb3,null))['catch'](handleError(_0x2abcb3,null));};exports['addAllCondition']=function(_0x184579,_0x286a0b,_0x5db3ac){if(_0x184579[_0xcd98('0x4c')]['id']){delete _0x184579[_0xcd98('0x4c')]['id'];}return db[_0xcd98('0x32')][_0xcd98('0x49')]({'where':{'id':_0x184579[_0xcd98('0x48')]['id']}})[_0xcd98('0x28')](handleEntityNotFound(_0x286a0b,null))[_0xcd98('0x28')](function(_0x1cc786){if(_0x1cc786){_0x184579[_0xcd98('0x4c')][_0xcd98('0x53')]=_0x1cc786['id'];return db['Condition']['create'](_0x184579[_0xcd98('0x4c')]);}})['then'](respondWithResult(_0x286a0b,null))[_0xcd98('0x4a')](handleError(_0x286a0b,null));};exports[_0xcd98('0x54')]=function(_0x4c735e,_0x2593ef,_0x2ae205){if(_0x4c735e[_0xcd98('0x4c')]['id']){delete _0x4c735e[_0xcd98('0x4c')]['id'];}return db[_0xcd98('0x32')][_0xcd98('0x49')]({'where':{'id':_0x4c735e[_0xcd98('0x48')]['id']}})['then'](handleEntityNotFound(_0x2593ef,null))[_0xcd98('0x28')](function(_0x2fc7c5){if(_0x2fc7c5){_0x4c735e[_0xcd98('0x4c')][_0xcd98('0x55')]=_0x2fc7c5['id'];return db['Condition'][_0xcd98('0x4b')](_0x4c735e[_0xcd98('0x4c')]);}})[_0xcd98('0x28')](respondWithResult(_0x2593ef,null))[_0xcd98('0x4a')](handleError(_0x2593ef,null));};exports[_0xcd98('0x56')]=function(_0x1f6d81,_0x14b9c0,_0xb68189){var _0x3a2f37={};var _0x30ad56={};var _0x170cd4;var _0x1d477b;return db[_0xcd98('0x32')][_0xcd98('0x57')]({'where':{'id':_0x1f6d81['params']['id']}})[_0xcd98('0x28')](handleEntityNotFound(_0x14b9c0,null))[_0xcd98('0x28')](function(_0x423e0d){if(_0x423e0d){_0x170cd4=_0x423e0d;_0x30ad56['model']=_[_0xcd98('0x58')](db[_0xcd98('0x59')][_0xcd98('0x33')]);_0x30ad56[_0xcd98('0x3b')]=_['keys'](_0x1f6d81['query']);_0x30ad56[_0xcd98('0x40')]=_['intersection'](_0x30ad56['model'],_0x30ad56[_0xcd98('0x3b')]);_0x3a2f37[_0xcd98('0x38')]=_['intersection'](_0x30ad56['model'],qs[_0xcd98('0x39')](_0x1f6d81['query'][_0xcd98('0x39')]));_0x3a2f37[_0xcd98('0x38')]=_0x3a2f37[_0xcd98('0x38')]['length']?_0x3a2f37[_0xcd98('0x38')]:_0x30ad56[_0xcd98('0x36')];_0x3a2f37['order']=qs[_0xcd98('0x3e')](_0x1f6d81['query'][_0xcd98('0x3e')]);_0x3a2f37[_0xcd98('0x3f')]=qs['filters'](_[_0xcd98('0x5a')](_0x1f6d81[_0xcd98('0x3b')],_0x30ad56[_0xcd98('0x40')]));if(_0x1f6d81[_0xcd98('0x3b')][_0xcd98('0x43')]){_0x3a2f37[_0xcd98('0x3f')]=_[_0xcd98('0x41')](_0x3a2f37[_0xcd98('0x3f')],{'$or':_[_0xcd98('0x31')](_0x3a2f37[_0xcd98('0x38')],function(_0x434426){var _0x23b8bf={};_0x23b8bf[_0x434426]={'$like':'%'+_0x1f6d81[_0xcd98('0x3b')]['filter']+'%'};return _0x23b8bf;})});}_0x3a2f37=_[_0xcd98('0x41')]({},_0x3a2f37,_0x1f6d81[_0xcd98('0x44')]);return _0x170cd4[_0xcd98('0x56')](_0x3a2f37);}})[_0xcd98('0x28')](function(_0x590dd8){if(_0x590dd8){_0x1d477b=_0x590dd8[_0xcd98('0x3a')];if(!_0x1f6d81[_0xcd98('0x3b')]['hasOwnProperty']('nolimit')){_0x3a2f37[_0xcd98('0x1e')]=qs[_0xcd98('0x1e')](_0x1f6d81[_0xcd98('0x3b')]['limit']);_0x3a2f37[_0xcd98('0x1f')]=qs[_0xcd98('0x1f')](_0x1f6d81[_0xcd98('0x3b')][_0xcd98('0x1f')]);}return _0x170cd4[_0xcd98('0x56')](_0x3a2f37);}})['then'](function(_0x3947c3){if(_0x3947c3){return _0x3947c3?{'count':_0x1d477b,'rows':_0x3947c3}:null;}})[_0xcd98('0x28')](respondWithResult(_0x14b9c0,null))['catch'](handleError(_0x14b9c0,null));};exports[_0xcd98('0x5b')]=function(_0x5bceb9,_0x1206aa,_0xab57e){var _0x1e862a={};var _0x28170c={};var _0xc62095;var _0x5878af;return db[_0xcd98('0x32')][_0xcd98('0x57')]({'where':{'id':_0x5bceb9[_0xcd98('0x48')]['id']}})['then'](handleEntityNotFound(_0x1206aa,null))[_0xcd98('0x28')](function(_0x4e5ddc){if(_0x4e5ddc){_0xc62095=_0x4e5ddc;_0x28170c[_0xcd98('0x36')]=_[_0xcd98('0x58')](db[_0xcd98('0x59')][_0xcd98('0x33')]);_0x28170c['query']=_['keys'](_0x5bceb9[_0xcd98('0x3b')]);_0x28170c[_0xcd98('0x40')]=_[_0xcd98('0x37')](_0x28170c[_0xcd98('0x36')],_0x28170c['query']);_0x1e862a['attributes']=_['intersection'](_0x28170c[_0xcd98('0x36')],qs[_0xcd98('0x39')](_0x5bceb9[_0xcd98('0x3b')][_0xcd98('0x39')]));_0x1e862a[_0xcd98('0x38')]=_0x1e862a['attributes'][_0xcd98('0x3a')]?_0x1e862a[_0xcd98('0x38')]:_0x28170c[_0xcd98('0x36')];_0x1e862a[_0xcd98('0x5c')]=qs[_0xcd98('0x3e')](_0x5bceb9[_0xcd98('0x3b')][_0xcd98('0x3e')]);_0x1e862a[_0xcd98('0x3f')]=qs['filters'](_['pick'](_0x5bceb9[_0xcd98('0x3b')],_0x28170c['filters']));if(_0x5bceb9[_0xcd98('0x3b')][_0xcd98('0x43')]){_0x1e862a[_0xcd98('0x3f')]=_[_0xcd98('0x41')](_0x1e862a[_0xcd98('0x3f')],{'$or':_[_0xcd98('0x31')](_0x1e862a[_0xcd98('0x38')],function(_0x357700){var _0x425bb1={};_0x425bb1[_0x357700]={'$like':'%'+_0x5bceb9[_0xcd98('0x3b')]['filter']+'%'};return _0x425bb1;})});}_0x1e862a=_[_0xcd98('0x41')]({},_0x1e862a,_0x5bceb9[_0xcd98('0x44')]);return _0xc62095[_0xcd98('0x5b')](_0x1e862a);}})[_0xcd98('0x28')](function(_0x2f31d8){if(_0x2f31d8){_0x5878af=_0x2f31d8[_0xcd98('0x3a')];if(!_0x5bceb9[_0xcd98('0x3b')][_0xcd98('0x3c')](_0xcd98('0x3d'))){_0x1e862a[_0xcd98('0x1e')]=qs[_0xcd98('0x1e')](_0x5bceb9['query']['limit']);_0x1e862a['offset']=qs[_0xcd98('0x1f')](_0x5bceb9['query'][_0xcd98('0x1f')]);}return _0xc62095['getAnyConditions'](_0x1e862a);}})[_0xcd98('0x28')](function(_0x4fc104){if(_0x4fc104){return _0x4fc104?{'count':_0x5878af,'rows':_0x4fc104}:null;}})[_0xcd98('0x28')](respondWithResult(_0x1206aa,null))[_0xcd98('0x4a')](handleError(_0x1206aa,null));};exports['addAction']=function(_0x2bb055,_0x1c07b6,_0x333436){if(_0x2bb055[_0xcd98('0x4c')]['id']){delete _0x2bb055[_0xcd98('0x4c')]['id'];}return db[_0xcd98('0x32')]['find']({'where':{'id':_0x2bb055[_0xcd98('0x48')]['id']}})['then'](handleEntityNotFound(_0x1c07b6,null))[_0xcd98('0x28')](function(_0x594340){if(_0x594340){_0x2bb055[_0xcd98('0x4c')][_0xcd98('0x5d')]=_0x594340['id'];return db[_0xcd98('0x5e')]['create'](_0x2bb055[_0xcd98('0x4c')]);}})[_0xcd98('0x28')](respondWithResult(_0x1c07b6,null))[_0xcd98('0x4a')](handleError(_0x1c07b6,null));};exports[_0xcd98('0x5f')]=function(_0x4778da,_0x4575a1,_0x2948a1){var _0x2d1f9f={};var _0x822ac7={};var _0xd771cc;var _0x49d551;return db['Trigger'][_0xcd98('0x57')]({'where':{'id':_0x4778da[_0xcd98('0x48')]['id']}})[_0xcd98('0x28')](handleEntityNotFound(_0x4575a1,null))[_0xcd98('0x28')](function(_0x25e743){if(_0x25e743){_0xd771cc=_0x25e743;_0x822ac7[_0xcd98('0x36')]=_[_0xcd98('0x58')](db[_0xcd98('0x5e')]['rawAttributes']);_0x822ac7['query']=_['keys'](_0x4778da['query']);_0x822ac7[_0xcd98('0x40')]=_['intersection'](_0x822ac7[_0xcd98('0x36')],_0x822ac7[_0xcd98('0x3b')]);_0x2d1f9f[_0xcd98('0x38')]=_[_0xcd98('0x37')](_0x822ac7[_0xcd98('0x36')],qs['fields'](_0x4778da[_0xcd98('0x3b')]['fields']));_0x2d1f9f[_0xcd98('0x38')]=_0x2d1f9f[_0xcd98('0x38')][_0xcd98('0x3a')]?_0x2d1f9f[_0xcd98('0x38')]:_0x822ac7['model'];_0x2d1f9f['order']=qs[_0xcd98('0x3e')](_0x4778da[_0xcd98('0x3b')][_0xcd98('0x3e')]);_0x2d1f9f[_0xcd98('0x3f')]=qs[_0xcd98('0x40')](_['pick'](_0x4778da[_0xcd98('0x3b')],_0x822ac7[_0xcd98('0x40')]));if(_0x4778da[_0xcd98('0x3b')][_0xcd98('0x43')]){_0x2d1f9f[_0xcd98('0x3f')]=_['merge'](_0x2d1f9f['where'],{'$or':_['map'](_0x2d1f9f[_0xcd98('0x38')],function(_0x28ac67){var _0x41e2e8={};_0x41e2e8[_0x28ac67]={'$like':'%'+_0x4778da['query']['filter']+'%'};return _0x41e2e8;})});}_0x2d1f9f=_[_0xcd98('0x41')]({},_0x2d1f9f,_0x4778da[_0xcd98('0x44')]);return _0xd771cc[_0xcd98('0x5f')](_0x2d1f9f);}})[_0xcd98('0x28')](function(_0x2f998c){if(_0x2f998c){_0x49d551=_0x2f998c[_0xcd98('0x3a')];if(!_0x4778da[_0xcd98('0x3b')][_0xcd98('0x3c')]('nolimit')){_0x2d1f9f[_0xcd98('0x1e')]=qs[_0xcd98('0x1e')](_0x4778da[_0xcd98('0x3b')][_0xcd98('0x1e')]);_0x2d1f9f['offset']=qs[_0xcd98('0x1f')](_0x4778da[_0xcd98('0x3b')]['offset']);}return _0xd771cc[_0xcd98('0x5f')](_0x2d1f9f);}})[_0xcd98('0x28')](function(_0x25bf8c){if(_0x25bf8c){return _0x25bf8c?{'count':_0x49d551,'rows':_0x25bf8c}:null;}})[_0xcd98('0x28')](respondWithResult(_0x4575a1,null))[_0xcd98('0x4a')](handleError(_0x4575a1,null));}; \ No newline at end of file +var _0x6dab=['find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','addAllCondition','TriggerAllId','Condition','TriggerAnyId','getAllConditions','findOne','rawAttributes','where','hasOwnProperty','nolimit','getAnyConditions','addAction','Action','getActions','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','set','Content-Range','apply','reject','save','update','then','destroy','Triggers','error','stack','name','send','map','Trigger','fieldName','key','model','query','keys','intersection','attributes','fields','length','order','sort','filters','pick','type','VIRTUAL','filter','merge','count','includeAll','include','findAll','rows','catch','show','params','options'];(function(_0x212b08,_0x27ee7b){var _0x18a608=function(_0x5b089e){while(--_0x5b089e){_0x212b08['push'](_0x212b08['shift']());}};_0x18a608(++_0x27ee7b);}(_0x6dab,0x13b));var _0xb6da=function(_0x396910,_0x397bda){_0x396910=_0x396910-0x0;var _0x217d81=_0x6dab[_0x396910];return _0x217d81;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb6da('0x0'));var zipdir=require(_0xb6da('0x1'));var jsonpatch=require(_0xb6da('0x2'));var rp=require(_0xb6da('0x3'));var moment=require(_0xb6da('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb6da('0x5'));var util=require('util');var path=require(_0xb6da('0x6'));var sox=require(_0xb6da('0x7'));var csv=require(_0xb6da('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb6da('0x9'));var squel=require(_0xb6da('0xa'));var crypto=require(_0xb6da('0xb'));var jsforce=require(_0xb6da('0xc'));var deskjs=require(_0xb6da('0xd'));var toCsv=require(_0xb6da('0x8'));var querystring=require(_0xb6da('0xe'));var Papa=require(_0xb6da('0xf'));var Redis=require('ioredis');var authService=require(_0xb6da('0x10'));var qs=require(_0xb6da('0x11'));var as=require(_0xb6da('0x12'));var hardwareService=require(_0xb6da('0x13'));var logger=require(_0xb6da('0x14'))(_0xb6da('0x15'));var utils=require(_0xb6da('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xb6da('0x17'));var db=require(_0xb6da('0x18'))['db'];function respondWithStatusCode(_0x35f865,_0x48a0ac){_0x48a0ac=_0x48a0ac||0xcc;return function(_0x54f24c){if(_0x54f24c){return _0x35f865[_0xb6da('0x19')](_0x48a0ac);}return _0x35f865[_0xb6da('0x1a')](_0x48a0ac)[_0xb6da('0x1b')]();};}function respondWithResult(_0x2a70cb,_0x1760ff){_0x1760ff=_0x1760ff||0xc8;return function(_0x3aa19e){if(_0x3aa19e){return _0x2a70cb[_0xb6da('0x1a')](_0x1760ff)[_0xb6da('0x1c')](_0x3aa19e);}};}function respondWithFilteredResult(_0x47f2b,_0x4b1f3f){return function(_0x1ec65d){if(_0x1ec65d){var _0x204377=typeof _0x4b1f3f[_0xb6da('0x1d')]==='undefined'&&typeof _0x4b1f3f[_0xb6da('0x1e')]===_0xb6da('0x1f');var _0x174be9=_0x1ec65d['count'];var _0x49627e=_0x204377?0x0:_0x4b1f3f['offset'];var _0x18b3f5=_0x204377?_0x1ec65d['count']:_0x4b1f3f[_0xb6da('0x1d')]+_0x4b1f3f[_0xb6da('0x1e')];var _0x5688a4;if(_0x18b3f5>=_0x174be9){_0x18b3f5=_0x174be9;_0x5688a4=0xc8;}else{_0x5688a4=0xce;}_0x47f2b['status'](_0x5688a4);return _0x47f2b[_0xb6da('0x20')](_0xb6da('0x21'),_0x49627e+'-'+_0x18b3f5+'/'+_0x174be9)['json'](_0x1ec65d);}return null;};}function patchUpdates(_0xbcec58){return function(_0x3e2e67){try{jsonpatch[_0xb6da('0x22')](_0x3e2e67,_0xbcec58,!![]);}catch(_0x17775a){return BPromise[_0xb6da('0x23')](_0x17775a);}return _0x3e2e67[_0xb6da('0x24')]();};}function saveUpdates(_0x401007,_0x2e5ee4){return function(_0x75a684){if(_0x75a684){return _0x75a684[_0xb6da('0x25')](_0x401007)[_0xb6da('0x26')](function(_0x5a9043){return _0x5a9043;});}return null;};}function removeEntity(_0x40cf37,_0x3af9f3){return function(_0x1705b2){if(_0x1705b2){return _0x1705b2[_0xb6da('0x27')]()[_0xb6da('0x26')](function(){var _0x6fde39=_0x1705b2['get']({'plain':!![]});var _0xf879b2=_0xb6da('0x28');return db['UserProfileResource'][_0xb6da('0x27')]({'where':{'type':_0xf879b2,'resourceId':_0x6fde39['id']}})['then'](function(){return _0x1705b2;});})[_0xb6da('0x26')](function(){_0x40cf37[_0xb6da('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x133267,_0x2dabe0){return function(_0xea13cb){if(!_0xea13cb){_0x133267[_0xb6da('0x19')](0x194);}return _0xea13cb;};}function handleError(_0xbe0d95,_0x4e137f){_0x4e137f=_0x4e137f||0x1f4;return function(_0x5889c3){logger[_0xb6da('0x29')](_0x5889c3[_0xb6da('0x2a')]);if(_0x5889c3[_0xb6da('0x2b')]){delete _0x5889c3[_0xb6da('0x2b')];}_0xbe0d95['status'](_0x4e137f)[_0xb6da('0x2c')](_0x5889c3);};}exports['index']=function(_0x2e3bce,_0x3d8286){var _0x154317={},_0x28b849={},_0x1c3193={'count':0x0,'rows':[]};var _0x3042c2=_[_0xb6da('0x2d')](db[_0xb6da('0x2e')]['rawAttributes'],function(_0x4a6433){return{'name':_0x4a6433[_0xb6da('0x2f')],'type':_0x4a6433['type'][_0xb6da('0x30')]};});_0x28b849[_0xb6da('0x31')]=_[_0xb6da('0x2d')](_0x3042c2,_0xb6da('0x2b'));_0x28b849[_0xb6da('0x32')]=_[_0xb6da('0x33')](_0x2e3bce[_0xb6da('0x32')]);_0x28b849['filters']=_[_0xb6da('0x34')](_0x28b849[_0xb6da('0x31')],_0x28b849[_0xb6da('0x32')]);_0x154317[_0xb6da('0x35')]=_['intersection'](_0x28b849['model'],qs[_0xb6da('0x36')](_0x2e3bce[_0xb6da('0x32')][_0xb6da('0x36')]));_0x154317[_0xb6da('0x35')]=_0x154317['attributes'][_0xb6da('0x37')]?_0x154317[_0xb6da('0x35')]:_0x28b849['model'];if(!_0x2e3bce['query']['hasOwnProperty']('nolimit')){_0x154317[_0xb6da('0x1e')]=qs['limit'](_0x2e3bce[_0xb6da('0x32')]['limit']);_0x154317[_0xb6da('0x1d')]=qs[_0xb6da('0x1d')](_0x2e3bce[_0xb6da('0x32')]['offset']);}_0x154317[_0xb6da('0x38')]=qs[_0xb6da('0x39')](_0x2e3bce[_0xb6da('0x32')][_0xb6da('0x39')]);_0x154317['where']=qs[_0xb6da('0x3a')](_[_0xb6da('0x3b')](_0x2e3bce['query'],_0x28b849[_0xb6da('0x3a')]),_0x3042c2);if(_0x2e3bce['query']['filter']){_0x154317['where']=_['merge'](_0x154317['where'],{'$or':_[_0xb6da('0x2d')](_0x3042c2,function(_0x2308d9){if(_0x2308d9[_0xb6da('0x3c')]!==_0xb6da('0x3d')){var _0x58aa97={};_0x58aa97[_0x2308d9[_0xb6da('0x2b')]]={'$like':'%'+_0x2e3bce[_0xb6da('0x32')][_0xb6da('0x3e')]+'%'};return _0x58aa97;}})});}_0x154317=_[_0xb6da('0x3f')]({},_0x154317,_0x2e3bce['options']);var _0x55eecf={'where':_0x154317['where']};return db[_0xb6da('0x2e')][_0xb6da('0x40')](_0x55eecf)[_0xb6da('0x26')](function(_0x2b31eb){_0x1c3193['count']=_0x2b31eb;if(_0x2e3bce['query'][_0xb6da('0x41')]){_0x154317[_0xb6da('0x42')]=[{'all':!![]}];}return db[_0xb6da('0x2e')][_0xb6da('0x43')](_0x154317);})['then'](function(_0xf652e6){_0x1c3193[_0xb6da('0x44')]=_0xf652e6;return _0x1c3193;})[_0xb6da('0x26')](respondWithFilteredResult(_0x3d8286,_0x154317))[_0xb6da('0x45')](handleError(_0x3d8286,null));};exports[_0xb6da('0x46')]=function(_0x197c24,_0x28f382){var _0x2b57f8={'raw':![],'where':{'id':_0x197c24[_0xb6da('0x47')]['id']}},_0x59a579={};_0x59a579['model']=_[_0xb6da('0x33')](db[_0xb6da('0x2e')]['rawAttributes']);_0x59a579['query']=_[_0xb6da('0x33')](_0x197c24[_0xb6da('0x32')]);_0x59a579['filters']=_[_0xb6da('0x34')](_0x59a579['model'],_0x59a579[_0xb6da('0x32')]);_0x2b57f8[_0xb6da('0x35')]=_[_0xb6da('0x34')](_0x59a579[_0xb6da('0x31')],qs[_0xb6da('0x36')](_0x197c24['query'][_0xb6da('0x36')]));_0x2b57f8['attributes']=_0x2b57f8[_0xb6da('0x35')][_0xb6da('0x37')]?_0x2b57f8['attributes']:_0x59a579[_0xb6da('0x31')];if(_0x197c24['query'][_0xb6da('0x41')]){_0x2b57f8[_0xb6da('0x42')]=[{'all':!![]}];}_0x2b57f8=_[_0xb6da('0x3f')]({},_0x2b57f8,_0x197c24[_0xb6da('0x48')]);return db[_0xb6da('0x2e')][_0xb6da('0x49')](_0x2b57f8)['then'](handleEntityNotFound(_0x28f382,null))[_0xb6da('0x26')](respondWithResult(_0x28f382,null))[_0xb6da('0x45')](handleError(_0x28f382,null));};exports[_0xb6da('0x4a')]=function(_0x2fed20,_0x35de3d){return db['Trigger']['create'](_0x2fed20[_0xb6da('0x4b')],{})[_0xb6da('0x26')](function(_0x36114f){var _0x356e96=_0x2fed20[_0xb6da('0x4c')][_0xb6da('0x4d')]({'plain':!![]});if(!_0x356e96)throw new Error(_0xb6da('0x4e'));if(_0x356e96[_0xb6da('0x4f')]==='user'){var _0x429511=_0x36114f[_0xb6da('0x4d')]({'plain':!![]});var _0x49be64=_0xb6da('0x28');return db[_0xb6da('0x50')]['find']({'where':{'name':_0x49be64,'userProfileId':_0x356e96[_0xb6da('0x51')]},'raw':!![]})[_0xb6da('0x26')](function(_0x4be3d1){if(_0x4be3d1&&_0x4be3d1[_0xb6da('0x52')]===0x0){return db['UserProfileResource'][_0xb6da('0x4a')]({'name':_0x429511[_0xb6da('0x2b')],'resourceId':_0x429511['id'],'type':_0x4be3d1[_0xb6da('0x2b')],'sectionId':_0x4be3d1['id']},{})[_0xb6da('0x26')](function(){return _0x36114f;});}else{return _0x36114f;}})['catch'](function(_0x30e9ec){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x30e9ec);throw _0x30e9ec;});}return _0x36114f;})[_0xb6da('0x26')](respondWithResult(_0x35de3d,0xc9))[_0xb6da('0x45')](handleError(_0x35de3d,null));};exports[_0xb6da('0x25')]=function(_0x354a22,_0x5f27b1){if(_0x354a22[_0xb6da('0x4b')]['id']){delete _0x354a22['body']['id'];}return db[_0xb6da('0x2e')][_0xb6da('0x49')]({'where':{'id':_0x354a22[_0xb6da('0x47')]['id']}})[_0xb6da('0x26')](handleEntityNotFound(_0x5f27b1,null))['then'](saveUpdates(_0x354a22[_0xb6da('0x4b')],null))[_0xb6da('0x26')](respondWithResult(_0x5f27b1,null))['catch'](handleError(_0x5f27b1,null));};exports[_0xb6da('0x27')]=function(_0x7d7c94,_0x486763){return db['Trigger']['find']({'where':{'id':_0x7d7c94[_0xb6da('0x47')]['id']}})[_0xb6da('0x26')](handleEntityNotFound(_0x486763,null))[_0xb6da('0x26')](removeEntity(_0x486763,null))['catch'](handleError(_0x486763,null));};exports[_0xb6da('0x53')]=function(_0x2d2939,_0x434ff6,_0x5d0be7){if(_0x2d2939[_0xb6da('0x4b')]['id']){delete _0x2d2939[_0xb6da('0x4b')]['id'];}return db[_0xb6da('0x2e')]['find']({'where':{'id':_0x2d2939[_0xb6da('0x47')]['id']}})[_0xb6da('0x26')](handleEntityNotFound(_0x434ff6,null))[_0xb6da('0x26')](function(_0x14f18b){if(_0x14f18b){_0x2d2939[_0xb6da('0x4b')][_0xb6da('0x54')]=_0x14f18b['id'];return db[_0xb6da('0x55')][_0xb6da('0x4a')](_0x2d2939['body']);}})[_0xb6da('0x26')](respondWithResult(_0x434ff6,null))[_0xb6da('0x45')](handleError(_0x434ff6,null));};exports['addAnyCondition']=function(_0x35bb92,_0x991c7f,_0x377f87){if(_0x35bb92['body']['id']){delete _0x35bb92[_0xb6da('0x4b')]['id'];}return db['Trigger'][_0xb6da('0x49')]({'where':{'id':_0x35bb92[_0xb6da('0x47')]['id']}})['then'](handleEntityNotFound(_0x991c7f,null))[_0xb6da('0x26')](function(_0x3034cf){if(_0x3034cf){_0x35bb92[_0xb6da('0x4b')][_0xb6da('0x56')]=_0x3034cf['id'];return db['Condition'][_0xb6da('0x4a')](_0x35bb92[_0xb6da('0x4b')]);}})[_0xb6da('0x26')](respondWithResult(_0x991c7f,null))[_0xb6da('0x45')](handleError(_0x991c7f,null));};exports[_0xb6da('0x57')]=function(_0x4468af,_0x338af0,_0x4a993c){var _0xfab95d={};var _0x486166={};var _0x5acf35;var _0x397273;return db['Trigger'][_0xb6da('0x58')]({'where':{'id':_0x4468af[_0xb6da('0x47')]['id']}})[_0xb6da('0x26')](handleEntityNotFound(_0x338af0,null))[_0xb6da('0x26')](function(_0x5ab5bd){if(_0x5ab5bd){_0x5acf35=_0x5ab5bd;_0x486166['model']=_['keys'](db[_0xb6da('0x55')][_0xb6da('0x59')]);_0x486166['query']=_['keys'](_0x4468af['query']);_0x486166[_0xb6da('0x3a')]=_[_0xb6da('0x34')](_0x486166['model'],_0x486166[_0xb6da('0x32')]);_0xfab95d['attributes']=_[_0xb6da('0x34')](_0x486166[_0xb6da('0x31')],qs[_0xb6da('0x36')](_0x4468af[_0xb6da('0x32')][_0xb6da('0x36')]));_0xfab95d[_0xb6da('0x35')]=_0xfab95d[_0xb6da('0x35')][_0xb6da('0x37')]?_0xfab95d[_0xb6da('0x35')]:_0x486166['model'];_0xfab95d[_0xb6da('0x38')]=qs[_0xb6da('0x39')](_0x4468af[_0xb6da('0x32')][_0xb6da('0x39')]);_0xfab95d[_0xb6da('0x5a')]=qs[_0xb6da('0x3a')](_[_0xb6da('0x3b')](_0x4468af[_0xb6da('0x32')],_0x486166['filters']));if(_0x4468af['query'][_0xb6da('0x3e')]){_0xfab95d[_0xb6da('0x5a')]=_[_0xb6da('0x3f')](_0xfab95d[_0xb6da('0x5a')],{'$or':_[_0xb6da('0x2d')](_0xfab95d['attributes'],function(_0x5b8f98){var _0x510de2={};_0x510de2[_0x5b8f98]={'$like':'%'+_0x4468af['query'][_0xb6da('0x3e')]+'%'};return _0x510de2;})});}_0xfab95d=_['merge']({},_0xfab95d,_0x4468af[_0xb6da('0x48')]);return _0x5acf35[_0xb6da('0x57')](_0xfab95d);}})[_0xb6da('0x26')](function(_0x340f2d){if(_0x340f2d){_0x397273=_0x340f2d[_0xb6da('0x37')];if(!_0x4468af[_0xb6da('0x32')][_0xb6da('0x5b')](_0xb6da('0x5c'))){_0xfab95d[_0xb6da('0x1e')]=qs[_0xb6da('0x1e')](_0x4468af['query'][_0xb6da('0x1e')]);_0xfab95d[_0xb6da('0x1d')]=qs[_0xb6da('0x1d')](_0x4468af[_0xb6da('0x32')][_0xb6da('0x1d')]);}return _0x5acf35[_0xb6da('0x57')](_0xfab95d);}})[_0xb6da('0x26')](function(_0x2b5e44){if(_0x2b5e44){return _0x2b5e44?{'count':_0x397273,'rows':_0x2b5e44}:null;}})[_0xb6da('0x26')](respondWithResult(_0x338af0,null))[_0xb6da('0x45')](handleError(_0x338af0,null));};exports[_0xb6da('0x5d')]=function(_0x18ca76,_0x203223,_0x2060d0){var _0x29b0d6={};var _0x1770b9={};var _0x23dd86;var _0x3e4f45;return db[_0xb6da('0x2e')]['findOne']({'where':{'id':_0x18ca76['params']['id']}})['then'](handleEntityNotFound(_0x203223,null))[_0xb6da('0x26')](function(_0x3d175c){if(_0x3d175c){_0x23dd86=_0x3d175c;_0x1770b9[_0xb6da('0x31')]=_['keys'](db[_0xb6da('0x55')][_0xb6da('0x59')]);_0x1770b9[_0xb6da('0x32')]=_[_0xb6da('0x33')](_0x18ca76[_0xb6da('0x32')]);_0x1770b9[_0xb6da('0x3a')]=_[_0xb6da('0x34')](_0x1770b9['model'],_0x1770b9[_0xb6da('0x32')]);_0x29b0d6[_0xb6da('0x35')]=_[_0xb6da('0x34')](_0x1770b9['model'],qs[_0xb6da('0x36')](_0x18ca76[_0xb6da('0x32')][_0xb6da('0x36')]));_0x29b0d6[_0xb6da('0x35')]=_0x29b0d6[_0xb6da('0x35')][_0xb6da('0x37')]?_0x29b0d6[_0xb6da('0x35')]:_0x1770b9[_0xb6da('0x31')];_0x29b0d6[_0xb6da('0x38')]=qs[_0xb6da('0x39')](_0x18ca76[_0xb6da('0x32')][_0xb6da('0x39')]);_0x29b0d6[_0xb6da('0x5a')]=qs[_0xb6da('0x3a')](_[_0xb6da('0x3b')](_0x18ca76[_0xb6da('0x32')],_0x1770b9[_0xb6da('0x3a')]));if(_0x18ca76[_0xb6da('0x32')][_0xb6da('0x3e')]){_0x29b0d6['where']=_[_0xb6da('0x3f')](_0x29b0d6[_0xb6da('0x5a')],{'$or':_[_0xb6da('0x2d')](_0x29b0d6['attributes'],function(_0x17cbd3){var _0x19c3bb={};_0x19c3bb[_0x17cbd3]={'$like':'%'+_0x18ca76['query'][_0xb6da('0x3e')]+'%'};return _0x19c3bb;})});}_0x29b0d6=_[_0xb6da('0x3f')]({},_0x29b0d6,_0x18ca76[_0xb6da('0x48')]);return _0x23dd86[_0xb6da('0x5d')](_0x29b0d6);}})[_0xb6da('0x26')](function(_0x442d44){if(_0x442d44){_0x3e4f45=_0x442d44[_0xb6da('0x37')];if(!_0x18ca76[_0xb6da('0x32')][_0xb6da('0x5b')](_0xb6da('0x5c'))){_0x29b0d6[_0xb6da('0x1e')]=qs[_0xb6da('0x1e')](_0x18ca76[_0xb6da('0x32')][_0xb6da('0x1e')]);_0x29b0d6[_0xb6da('0x1d')]=qs[_0xb6da('0x1d')](_0x18ca76[_0xb6da('0x32')]['offset']);}return _0x23dd86['getAnyConditions'](_0x29b0d6);}})[_0xb6da('0x26')](function(_0x1e12fa){if(_0x1e12fa){return _0x1e12fa?{'count':_0x3e4f45,'rows':_0x1e12fa}:null;}})[_0xb6da('0x26')](respondWithResult(_0x203223,null))['catch'](handleError(_0x203223,null));};exports[_0xb6da('0x5e')]=function(_0x16e096,_0x7bb383,_0x2fa0f0){if(_0x16e096[_0xb6da('0x4b')]['id']){delete _0x16e096[_0xb6da('0x4b')]['id'];}return db[_0xb6da('0x2e')][_0xb6da('0x49')]({'where':{'id':_0x16e096[_0xb6da('0x47')]['id']}})['then'](handleEntityNotFound(_0x7bb383,null))[_0xb6da('0x26')](function(_0x3ca34f){if(_0x3ca34f){_0x16e096[_0xb6da('0x4b')]['TriggerId']=_0x3ca34f['id'];return db[_0xb6da('0x5f')][_0xb6da('0x4a')](_0x16e096[_0xb6da('0x4b')]);}})['then'](respondWithResult(_0x7bb383,null))[_0xb6da('0x45')](handleError(_0x7bb383,null));};exports[_0xb6da('0x60')]=function(_0x412fbd,_0x5b06a1,_0x49f93b){var _0x2ec930={};var _0x8d88fc={};var _0x486c50;var _0x3a3fc3;return db[_0xb6da('0x2e')]['findOne']({'where':{'id':_0x412fbd[_0xb6da('0x47')]['id']}})[_0xb6da('0x26')](handleEntityNotFound(_0x5b06a1,null))[_0xb6da('0x26')](function(_0x3a1032){if(_0x3a1032){_0x486c50=_0x3a1032;_0x8d88fc[_0xb6da('0x31')]=_[_0xb6da('0x33')](db[_0xb6da('0x5f')][_0xb6da('0x59')]);_0x8d88fc['query']=_[_0xb6da('0x33')](_0x412fbd[_0xb6da('0x32')]);_0x8d88fc[_0xb6da('0x3a')]=_[_0xb6da('0x34')](_0x8d88fc['model'],_0x8d88fc[_0xb6da('0x32')]);_0x2ec930[_0xb6da('0x35')]=_['intersection'](_0x8d88fc['model'],qs[_0xb6da('0x36')](_0x412fbd[_0xb6da('0x32')]['fields']));_0x2ec930['attributes']=_0x2ec930[_0xb6da('0x35')][_0xb6da('0x37')]?_0x2ec930[_0xb6da('0x35')]:_0x8d88fc[_0xb6da('0x31')];_0x2ec930[_0xb6da('0x38')]=qs[_0xb6da('0x39')](_0x412fbd[_0xb6da('0x32')][_0xb6da('0x39')]);_0x2ec930[_0xb6da('0x5a')]=qs[_0xb6da('0x3a')](_[_0xb6da('0x3b')](_0x412fbd[_0xb6da('0x32')],_0x8d88fc[_0xb6da('0x3a')]));if(_0x412fbd[_0xb6da('0x32')][_0xb6da('0x3e')]){_0x2ec930['where']=_[_0xb6da('0x3f')](_0x2ec930[_0xb6da('0x5a')],{'$or':_[_0xb6da('0x2d')](_0x2ec930[_0xb6da('0x35')],function(_0x2c1599){var _0x2a9183={};_0x2a9183[_0x2c1599]={'$like':'%'+_0x412fbd['query'][_0xb6da('0x3e')]+'%'};return _0x2a9183;})});}_0x2ec930=_[_0xb6da('0x3f')]({},_0x2ec930,_0x412fbd[_0xb6da('0x48')]);return _0x486c50[_0xb6da('0x60')](_0x2ec930);}})['then'](function(_0x389a74){if(_0x389a74){_0x3a3fc3=_0x389a74[_0xb6da('0x37')];if(!_0x412fbd[_0xb6da('0x32')]['hasOwnProperty'](_0xb6da('0x5c'))){_0x2ec930[_0xb6da('0x1e')]=qs[_0xb6da('0x1e')](_0x412fbd['query']['limit']);_0x2ec930[_0xb6da('0x1d')]=qs[_0xb6da('0x1d')](_0x412fbd[_0xb6da('0x32')][_0xb6da('0x1d')]);}return _0x486c50[_0xb6da('0x60')](_0x2ec930);}})[_0xb6da('0x26')](function(_0x29cc80){if(_0x29cc80){return _0x29cc80?{'count':_0x3a3fc3,'rows':_0x29cc80}:null;}})[_0xb6da('0x26')](respondWithResult(_0x5b06a1,null))[_0xb6da('0x45')](handleError(_0x5b06a1,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 85516be..724a2c8 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 _0xeea0=['./trigger.attributes','exports','define','Trigger','tools_triggers','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x4879b7,_0x10c129){var _0x55aa0b=function(_0x210a11){while(--_0x210a11){_0x4879b7['push'](_0x4879b7['shift']());}};_0x55aa0b(++_0x10c129);}(_0xeea0,0x91));var _0x0eea=function(_0x22a896,_0x36f1e5){_0x22a896=_0x22a896-0x0;var _0x57a2ff=_0xeea0[_0x22a896];return _0x57a2ff;};'use strict';var _=require(_0x0eea('0x0'));var util=require(_0x0eea('0x1'));var logger=require(_0x0eea('0x2'))(_0x0eea('0x3'));var moment=require(_0x0eea('0x4'));var BPromise=require('bluebird');var rp=require(_0x0eea('0x5'));var fs=require('fs');var path=require(_0x0eea('0x6'));var rimraf=require(_0x0eea('0x7'));var config=require(_0x0eea('0x8'));var attributes=require(_0x0eea('0x9'));module[_0x0eea('0xa')]=function(_0x2520ce,_0x47d7c8){return _0x2520ce[_0x0eea('0xb')](_0x0eea('0xc'),attributes,{'tableName':_0x0eea('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xff2a=['bluebird','path','../../config/environment','./trigger.attributes','define','Trigger','tools_triggers','util','../../config/logger','moment'];(function(_0x402731,_0x43c115){var _0x111736=function(_0x5a7044){while(--_0x5a7044){_0x402731['push'](_0x402731['shift']());}};_0x111736(++_0x43c115);}(_0xff2a,0x93));var _0xaff2=function(_0x25c326,_0x250137){_0x25c326=_0x25c326-0x0;var _0x762452=_0xff2a[_0x25c326];return _0x762452;};'use strict';var _=require('lodash');var util=require(_0xaff2('0x0'));var logger=require(_0xaff2('0x1'))('api');var moment=require(_0xaff2('0x2'));var BPromise=require(_0xaff2('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xaff2('0x4'));var rimraf=require('rimraf');var config=require(_0xaff2('0x5'));var attributes=require(_0xaff2('0x6'));module['exports']=function(_0x70cadf,_0x8313e5){return _0x70cadf[_0xaff2('0x7')](_0xaff2('0x8'),attributes,{'tableName':_0xaff2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index b12542b..2183883 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 _0x7a8d=['include','map','model','debug','ShowTrigger','find','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','then','info','request\x20sent','stringify','error','code','message','Trigger,\x20%s,\x20%s','result','catch','GetTrigger','Trigger','findAll','options','raw','where','attributes','limit'];(function(_0x580d55,_0x2a7cf8){var _0xd691bb=function(_0x545674){while(--_0x545674){_0x580d55['push'](_0x580d55['shift']());}};_0xd691bb(++_0x2a7cf8);}(_0x7a8d,0xab));var _0xd7a8=function(_0x3baae2,_0x20d350){_0x3baae2=_0x3baae2-0x0;var _0x1ec0b6=_0x7a8d[_0x3baae2];return _0x1ec0b6;};'use strict';var _=require(_0xd7a8('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd7a8('0x1'));var rs=require(_0xd7a8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd7a8('0x3'))['db'];var utils=require(_0xd7a8('0x4'));var logger=require('../../config/logger')(_0xd7a8('0x5'));var config=require('../../config/environment');var jayson=require(_0xd7a8('0x6'));var client=jayson[_0xd7a8('0x7')][_0xd7a8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5e5069,_0x522cfa,_0x33f6e3){return new BPromise(function(_0x53170c,_0x281234){return client['request'](_0x5e5069,_0x33f6e3)[_0xd7a8('0x9')](function(_0x51c311){logger[_0xd7a8('0xa')]('Trigger,\x20%s,\x20%s',_0x522cfa,'request\x20sent');logger['debug']('Trigger,\x20%s,\x20%s,\x20%s',_0x522cfa,_0xd7a8('0xb'),JSON[_0xd7a8('0xc')](_0x51c311));if(_0x51c311['error']){if(_0x51c311[_0xd7a8('0xd')][_0xd7a8('0xe')]===0x1f4){logger[_0xd7a8('0xd')]('Trigger,\x20%s,\x20%s',_0x522cfa,_0x51c311['error'][_0xd7a8('0xf')]);return _0x281234(_0x51c311[_0xd7a8('0xd')][_0xd7a8('0xf')]);}logger['error'](_0xd7a8('0x10'),_0x522cfa,_0x51c311[_0xd7a8('0xd')][_0xd7a8('0xf')]);return _0x53170c(_0x51c311[_0xd7a8('0xd')][_0xd7a8('0xf')]);}else{logger[_0xd7a8('0xa')](_0xd7a8('0x10'),_0x522cfa,_0xd7a8('0xb'));_0x53170c(_0x51c311[_0xd7a8('0x11')][_0xd7a8('0xf')]);}})[_0xd7a8('0x12')](function(_0x1a6b52){logger['error'](_0xd7a8('0x10'),_0x522cfa,_0x1a6b52);_0x281234(_0x1a6b52);});});}exports[_0xd7a8('0x13')]=function(_0x1647e0){var _0x1442df=this;return new Promise(function(_0x2d48a7,_0x4c0ed8){return db[_0xd7a8('0x14')][_0xd7a8('0x15')]({'raw':_0x1647e0['options']?_0x1647e0[_0xd7a8('0x16')][_0xd7a8('0x17')]===undefined?!![]:![]:!![],'where':_0x1647e0[_0xd7a8('0x16')]?_0x1647e0[_0xd7a8('0x16')][_0xd7a8('0x18')]||null:null,'attributes':_0x1647e0[_0xd7a8('0x16')]?_0x1647e0['options'][_0xd7a8('0x19')]||null:null,'limit':_0x1647e0[_0xd7a8('0x16')]?_0x1647e0[_0xd7a8('0x16')][_0xd7a8('0x1a')]||null:null,'include':_0x1647e0['options']?_0x1647e0[_0xd7a8('0x16')][_0xd7a8('0x1b')]?_[_0xd7a8('0x1c')](_0x1647e0[_0xd7a8('0x16')][_0xd7a8('0x1b')],function(_0xb50084){return{'model':db[_0xb50084[_0xd7a8('0x1d')]],'as':_0xb50084['as'],'attributes':_0xb50084['attributes'],'include':_0xb50084['include']?_[_0xd7a8('0x1c')](_0xb50084[_0xd7a8('0x1b')],function(_0x2af1fe){return{'model':db[_0x2af1fe[_0xd7a8('0x1d')]],'as':_0x2af1fe['as'],'attributes':_0x2af1fe['attributes'],'include':_0x2af1fe[_0xd7a8('0x1b')]?_[_0xd7a8('0x1c')](_0x2af1fe[_0xd7a8('0x1b')],function(_0x41de55){return{'model':db[_0x41de55[_0xd7a8('0x1d')]],'as':_0x41de55['as'],'attributes':_0x41de55['attributes']};}):[]};}):[]};}):[]:[]})[_0xd7a8('0x9')](function(_0x41e644){logger[_0xd7a8('0xa')](_0xd7a8('0x13'),_0x1647e0);logger[_0xd7a8('0x1e')](_0xd7a8('0x13'),_0x1647e0,JSON[_0xd7a8('0xc')](_0x41e644));_0x2d48a7(_0x41e644);})[_0xd7a8('0x12')](function(_0x1ac427){logger[_0xd7a8('0xd')]('GetTrigger',_0x1ac427[_0xd7a8('0xf')],_0x1647e0);_0x4c0ed8(_0x1442df[_0xd7a8('0xd')](0x1f4,_0x1ac427[_0xd7a8('0xf')]));});});};exports[_0xd7a8('0x1f')]=function(_0x5ee9fb){var _0xb0f33a=this;return new Promise(function(_0x44e349,_0x5eef89){return db[_0xd7a8('0x14')][_0xd7a8('0x20')]({'raw':_0x5ee9fb[_0xd7a8('0x16')]?_0x5ee9fb['options'][_0xd7a8('0x17')]===undefined?!![]:![]:!![],'where':_0x5ee9fb[_0xd7a8('0x16')]?_0x5ee9fb[_0xd7a8('0x16')][_0xd7a8('0x18')]||null:null,'attributes':_0x5ee9fb[_0xd7a8('0x16')]?_0x5ee9fb[_0xd7a8('0x16')][_0xd7a8('0x19')]||null:null,'include':_0x5ee9fb[_0xd7a8('0x16')]?_0x5ee9fb[_0xd7a8('0x16')][_0xd7a8('0x1b')]?_[_0xd7a8('0x1c')](_0x5ee9fb[_0xd7a8('0x16')]['include'],function(_0xe669c4){return{'model':db[_0xe669c4[_0xd7a8('0x1d')]],'as':_0xe669c4['as'],'attributes':_0xe669c4['attributes'],'include':_0xe669c4[_0xd7a8('0x1b')]?_[_0xd7a8('0x1c')](_0xe669c4[_0xd7a8('0x1b')],function(_0x3a6db4){return{'model':db[_0x3a6db4['model']],'as':_0x3a6db4['as'],'attributes':_0x3a6db4[_0xd7a8('0x19')],'include':_0x3a6db4[_0xd7a8('0x1b')]?_[_0xd7a8('0x1c')](_0x3a6db4[_0xd7a8('0x1b')],function(_0x2c6f9f){return{'model':db[_0x2c6f9f[_0xd7a8('0x1d')]],'as':_0x2c6f9f['as'],'attributes':_0x2c6f9f['attributes']};}):[]};}):[]};}):[]:[]})[_0xd7a8('0x9')](function(_0x412fac){logger[_0xd7a8('0xa')](_0xd7a8('0x1f'),_0x5ee9fb);logger[_0xd7a8('0x1e')]('ShowTrigger',_0x5ee9fb,JSON[_0xd7a8('0xc')](_0x412fac));_0x44e349(_0x412fac);})['catch'](function(_0x10d029){logger[_0xd7a8('0xd')](_0xd7a8('0x1f'),_0x10d029['message'],_0x5ee9fb);_0x5eef89(_0xb0f33a[_0xd7a8('0xd')](0x1f4,_0x10d029['message']));});});}; \ No newline at end of file +var _0xed98=['request','then','info','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','Trigger,\x20%s,\x20%s','message','result','catch','GetTrigger','Trigger','findAll','options','raw','where','include','map','model','attributes','ShowTrigger','find','util','../../mysqldb','../../config/logger','rpc','../../config/environment','client'];(function(_0x2b5eae,_0x55010d){var _0x5f3ac9=function(_0x397bfc){while(--_0x397bfc){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x5f3ac9(++_0x55010d);}(_0xed98,0xb4));var _0x8ed9=function(_0x564f89,_0x4846c8){_0x564f89=_0x564f89-0x0;var _0x5053cd=_0xed98[_0x564f89];return _0x5053cd;};'use strict';var _=require('lodash');var util=require(_0x8ed9('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8ed9('0x1'))['db'];var utils=require('../../config/utils');var logger=require(_0x8ed9('0x2'))(_0x8ed9('0x3'));var config=require(_0x8ed9('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x8ed9('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3f5e7d,_0x4d50c1,_0x5836c4){return new BPromise(function(_0x189118,_0x16f2c5){return client[_0x8ed9('0x6')](_0x3f5e7d,_0x5836c4)[_0x8ed9('0x7')](function(_0x5c52bb){logger[_0x8ed9('0x8')]('Trigger,\x20%s,\x20%s',_0x4d50c1,_0x8ed9('0x9'));logger[_0x8ed9('0xa')](_0x8ed9('0xb'),_0x4d50c1,_0x8ed9('0x9'),JSON[_0x8ed9('0xc')](_0x5c52bb));if(_0x5c52bb[_0x8ed9('0xd')]){if(_0x5c52bb[_0x8ed9('0xd')][_0x8ed9('0xe')]===0x1f4){logger[_0x8ed9('0xd')](_0x8ed9('0xf'),_0x4d50c1,_0x5c52bb['error']['message']);return _0x16f2c5(_0x5c52bb[_0x8ed9('0xd')][_0x8ed9('0x10')]);}logger['error'](_0x8ed9('0xf'),_0x4d50c1,_0x5c52bb[_0x8ed9('0xd')][_0x8ed9('0x10')]);return _0x189118(_0x5c52bb[_0x8ed9('0xd')][_0x8ed9('0x10')]);}else{logger[_0x8ed9('0x8')]('Trigger,\x20%s,\x20%s',_0x4d50c1,_0x8ed9('0x9'));_0x189118(_0x5c52bb[_0x8ed9('0x11')]['message']);}})[_0x8ed9('0x12')](function(_0x2b7960){logger[_0x8ed9('0xd')](_0x8ed9('0xf'),_0x4d50c1,_0x2b7960);_0x16f2c5(_0x2b7960);});});}exports[_0x8ed9('0x13')]=function(_0x182440){var _0x4938ad=this;return new Promise(function(_0x584b77,_0x3921be){return db[_0x8ed9('0x14')][_0x8ed9('0x15')]({'raw':_0x182440[_0x8ed9('0x16')]?_0x182440['options'][_0x8ed9('0x17')]===undefined?!![]:![]:!![],'where':_0x182440['options']?_0x182440[_0x8ed9('0x16')][_0x8ed9('0x18')]||null:null,'attributes':_0x182440[_0x8ed9('0x16')]?_0x182440[_0x8ed9('0x16')]['attributes']||null:null,'limit':_0x182440[_0x8ed9('0x16')]?_0x182440[_0x8ed9('0x16')]['limit']||null:null,'include':_0x182440[_0x8ed9('0x16')]?_0x182440[_0x8ed9('0x16')][_0x8ed9('0x19')]?_[_0x8ed9('0x1a')](_0x182440['options'][_0x8ed9('0x19')],function(_0x1b0d1e){return{'model':db[_0x1b0d1e[_0x8ed9('0x1b')]],'as':_0x1b0d1e['as'],'attributes':_0x1b0d1e[_0x8ed9('0x1c')],'include':_0x1b0d1e[_0x8ed9('0x19')]?_[_0x8ed9('0x1a')](_0x1b0d1e[_0x8ed9('0x19')],function(_0x3715dd){return{'model':db[_0x3715dd[_0x8ed9('0x1b')]],'as':_0x3715dd['as'],'attributes':_0x3715dd[_0x8ed9('0x1c')],'include':_0x3715dd[_0x8ed9('0x19')]?_['map'](_0x3715dd[_0x8ed9('0x19')],function(_0x5a94a8){return{'model':db[_0x5a94a8['model']],'as':_0x5a94a8['as'],'attributes':_0x5a94a8[_0x8ed9('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x8ed9('0x7')](function(_0x1690c2){logger['info'](_0x8ed9('0x13'),_0x182440);logger[_0x8ed9('0xa')](_0x8ed9('0x13'),_0x182440,JSON[_0x8ed9('0xc')](_0x1690c2));_0x584b77(_0x1690c2);})[_0x8ed9('0x12')](function(_0x5be639){logger[_0x8ed9('0xd')](_0x8ed9('0x13'),_0x5be639['message'],_0x182440);_0x3921be(_0x4938ad['error'](0x1f4,_0x5be639['message']));});});};exports[_0x8ed9('0x1d')]=function(_0x567bd8){var _0x202981=this;return new Promise(function(_0xf15dec,_0x519892){return db[_0x8ed9('0x14')][_0x8ed9('0x1e')]({'raw':_0x567bd8[_0x8ed9('0x16')]?_0x567bd8[_0x8ed9('0x16')][_0x8ed9('0x17')]===undefined?!![]:![]:!![],'where':_0x567bd8[_0x8ed9('0x16')]?_0x567bd8['options'][_0x8ed9('0x18')]||null:null,'attributes':_0x567bd8['options']?_0x567bd8[_0x8ed9('0x16')][_0x8ed9('0x1c')]||null:null,'include':_0x567bd8['options']?_0x567bd8[_0x8ed9('0x16')][_0x8ed9('0x19')]?_[_0x8ed9('0x1a')](_0x567bd8['options'][_0x8ed9('0x19')],function(_0x239ca6){return{'model':db[_0x239ca6[_0x8ed9('0x1b')]],'as':_0x239ca6['as'],'attributes':_0x239ca6['attributes'],'include':_0x239ca6['include']?_[_0x8ed9('0x1a')](_0x239ca6[_0x8ed9('0x19')],function(_0x4e0f67){return{'model':db[_0x4e0f67[_0x8ed9('0x1b')]],'as':_0x4e0f67['as'],'attributes':_0x4e0f67[_0x8ed9('0x1c')],'include':_0x4e0f67[_0x8ed9('0x19')]?_[_0x8ed9('0x1a')](_0x4e0f67[_0x8ed9('0x19')],function(_0x34d3c5){return{'model':db[_0x34d3c5['model']],'as':_0x34d3c5['as'],'attributes':_0x34d3c5[_0x8ed9('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xbf5d65){logger['info'](_0x8ed9('0x1d'),_0x567bd8);logger[_0x8ed9('0xa')](_0x8ed9('0x1d'),_0x567bd8,JSON[_0x8ed9('0xc')](_0xbf5d65));_0xf15dec(_0xbf5d65);})[_0x8ed9('0x12')](function(_0x161b74){logger['error']('ShowTrigger',_0x161b74[_0x8ed9('0x10')],_0x567bd8);_0x519892(_0x202981['error'](0x1f4,_0x161b74[_0x8ed9('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 40cab96..8326c5f 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 _0x90a8=['show','post','/:id/clone','clone','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','get','index','/:id','isAuthenticated'];(function(_0x5e5ab3,_0x378f77){var _0x51bddf=function(_0x53011e){while(--_0x53011e){_0x5e5ab3['push'](_0x5e5ab3['shift']());}};_0x51bddf(++_0x378f77);}(_0x90a8,0x126));var _0x890a=function(_0x4c6e1a,_0x537344){_0x4c6e1a=_0x4c6e1a-0x0;var _0x1c317b=_0x90a8[_0x4c6e1a];return _0x1c317b;};'use strict';var multer=require(_0x890a('0x0'));var util=require(_0x890a('0x1'));var path=require(_0x890a('0x2'));var timeout=require(_0x890a('0x3'));var express=require(_0x890a('0x4'));var router=express[_0x890a('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x890a('0x6'));var interaction=require(_0x890a('0x7'));var config=require(_0x890a('0x8'));var controller=require(_0x890a('0x9'));router[_0x890a('0xa')]('/',auth['isAuthenticated'](),controller[_0x890a('0xb')]);router[_0x890a('0xa')](_0x890a('0xc'),auth[_0x890a('0xd')](),controller[_0x890a('0xe')]);router[_0x890a('0xf')](_0x890a('0x10'),auth[_0x890a('0xd')](),controller[_0x890a('0x11')]);router[_0x890a('0xf')]('/',auth[_0x890a('0xd')](),controller['create']);router['put'](_0x890a('0xc'),auth[_0x890a('0xd')](),controller[_0x890a('0x12')]);router[_0x890a('0x13')](_0x890a('0xc'),auth[_0x890a('0xd')](),controller[_0x890a('0x14')]);module[_0x890a('0x15')]=router; \ No newline at end of file +var _0x0213=['/:id/clone','clone','create','update','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','get','isAuthenticated','index','/:id','post'];(function(_0x1dada2,_0x886900){var _0x3ad67c=function(_0x13b136){while(--_0x13b136){_0x1dada2['push'](_0x1dada2['shift']());}};_0x3ad67c(++_0x886900);}(_0x0213,0xc4));var _0x3021=function(_0x2c1aa8,_0x3e0609){_0x2c1aa8=_0x2c1aa8-0x0;var _0x4019f5=_0x0213[_0x2c1aa8];return _0x4019f5;};'use strict';var multer=require('multer');var util=require(_0x3021('0x0'));var path=require(_0x3021('0x1'));var timeout=require('connect-timeout');var express=require(_0x3021('0x2'));var router=express[_0x3021('0x3')]();var fs_extra=require(_0x3021('0x4'));var auth=require(_0x3021('0x5'));var interaction=require(_0x3021('0x6'));var config=require(_0x3021('0x7'));var controller=require(_0x3021('0x8'));router[_0x3021('0x9')]('/',auth[_0x3021('0xa')](),controller[_0x3021('0xb')]);router[_0x3021('0x9')](_0x3021('0xc'),auth[_0x3021('0xa')](),controller['show']);router[_0x3021('0xd')](_0x3021('0xe'),auth['isAuthenticated'](),controller[_0x3021('0xf')]);router[_0x3021('0xd')]('/',auth['isAuthenticated'](),controller[_0x3021('0x10')]);router['put'](_0x3021('0xc'),auth[_0x3021('0xa')](),controller[_0x3021('0x11')]);router[_0x3021('0x12')](_0x3021('0xc'),auth['isAuthenticated'](),controller[_0x3021('0x13')]);module[_0x3021('0x14')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index c9e0cb5..9099eda 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 _0x3549=['ENUM','friend','user','peer','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','getDataValue','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','shortinfo','inband','auto','rfc2833','yes','nonat','update','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','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,nonat','BOOLEAN','sequelize','exports','STRING'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x3549,0x1ad));var _0x9354=function(_0xc4ce4c,_0x19202b){_0xc4ce4c=_0xc4ce4c-0x0;var _0x17d789=_0x3549[_0xc4ce4c];return _0x17d789;};'use strict';var Sequelize=require(_0x9354('0x0'));module[_0x9354('0x1')]={'name':{'type':Sequelize[_0x9354('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x9354('0x3')](_0x9354('0x4'),_0x9354('0x5'),_0x9354('0x6')),'allowNull':![],'defaultValue':_0x9354('0x4')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0x9354('0x3')](_0x9354('0x7'),_0x9354('0x8'),_0x9354('0x9'),_0x9354('0xa'),'PROHIB_NOT_SCREENED',_0x9354('0xb'),_0x9354('0xc'),_0x9354('0xd'))},'deny':{'type':Sequelize[_0x9354('0x2')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize[_0x9354('0x2')]},'md5secret':{'type':Sequelize[_0x9354('0x2')]},'remotesecret':{'type':Sequelize[_0x9354('0x2')]},'transport':{'type':Sequelize['STRING'],'defaultValue':_0x9354('0xe'),'set':function(_0x48e6d4){this[_0x9354('0xf')]('transport',_0x48e6d4?_0x48e6d4['join'](','):null);},'get':function(){return this[_0x9354('0x10')](_0x9354('0x11'))?this[_0x9354('0x10')](_0x9354('0x11'))[_0x9354('0x12')](','):null;},'comment':_0x9354('0x13')},'dtmfmode':{'type':Sequelize['ENUM']('rfc2833','info',_0x9354('0x14'),_0x9354('0x15'),_0x9354('0x16')),'defaultValue':_0x9354('0x17')},'directmedia':{'type':Sequelize[_0x9354('0x3')](_0x9354('0x18'),'no',_0x9354('0x19'),_0x9354('0x1a'),'outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x9354('0x3')]('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0x9354('0x2')]},'nat':{'type':Sequelize['STRING'],'defaultValue':_0x9354('0x1b'),'set':function(_0x4539c1){this[_0x9354('0xf')](_0x9354('0x1c'),_0x4539c1?_0x4539c1['join'](','):null);},'get':function(){return this[_0x9354('0x10')](_0x9354('0x1c'))?this['getDataValue'](_0x9354('0x1c'))[_0x9354('0x12')](','):null;},'comment':_0x9354('0x1d')},'callgroup':{'type':Sequelize[_0x9354('0x2')]},'namedcallgroup':{'type':Sequelize[_0x9354('0x2')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x9354('0x2')]},'language':{'type':Sequelize[_0x9354('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x9354('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':_0x9354('0x1e')},'allow':{'type':Sequelize[_0x9354('0x2')],'allowNull':![],'defaultValue':_0x9354('0x1f'),'set':function(_0x29644a){this['setDataValue'](_0x9354('0x20'),_0x29644a?_0x29644a[_0x9354('0x21')](';'):_0x9354('0x1f'));},'get':function(){return this[_0x9354('0x10')](_0x9354('0x20'))?this['getDataValue']('allow')[_0x9354('0x12')](';'):null;},'comment':_0x9354('0x22')},'autoframing':{'type':Sequelize['ENUM'](_0x9354('0x18'),'no')},'insecure':{'type':Sequelize[_0x9354('0x2')],'defaultValue':_0x9354('0x23'),'set':function(_0x4edb5a){this['setDataValue'](_0x9354('0x24'),_0x4edb5a?_0x4edb5a['join'](','):null);},'get':function(){return this['getDataValue'](_0x9354('0x24'))?this['getDataValue'](_0x9354('0x24'))[_0x9354('0x12')](','):null;},'comment':_0x9354('0x25')},'trustrpid':{'type':Sequelize[_0x9354('0x3')](_0x9354('0x18'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x9354('0x3')](_0x9354('0x18'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x9354('0x3')](_0x9354('0x18'),'no',_0x9354('0x26'))},'promiscredir':{'type':Sequelize['ENUM']('yes','no')},'useclientcode':{'type':Sequelize[_0x9354('0x3')]('yes','no')},'accountcode':{'type':Sequelize[_0x9354('0x27')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0x9354('0x28')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0x9354('0x3')](_0x9354('0x18'),'no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x9354('0x27')](0xb)},'allowoverlap':{'type':Sequelize['ENUM']('yes','no')},'allowsubscribe':{'type':Sequelize[_0x9354('0x3')](_0x9354('0x18'),'no')},'allowtransfer':{'type':Sequelize[_0x9354('0x3')]('yes','no')},'ignoresdpversion':{'type':Sequelize[_0x9354('0x3')](_0x9354('0x18'),'no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0x9354('0x2')]},'videosupport':{'type':Sequelize[_0x9354('0x3')](_0x9354('0x18'),'no',_0x9354('0x29')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize[_0x9354('0x3')]('yes','no')},'mailbox':{'type':Sequelize[_0x9354('0x2')]},'session_timers':{'type':Sequelize['ENUM'](_0x9354('0x2a'),'refuse',_0x9354('0x2b'))},'session_expires':{'type':Sequelize[_0x9354('0x27')](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0x9354('0x3')](_0x9354('0x2c'),_0x9354('0x2d')),'defaultValue':_0x9354('0x2d')},'t38pt_usertpsource':{'type':Sequelize[_0x9354('0x2')]},'regexten':{'type':Sequelize[_0x9354('0x2')]},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize[_0x9354('0x3')](_0x9354('0x18'),'no'),'defaultValue':_0x9354('0x18')},'keepalive':{'type':Sequelize[_0x9354('0x27')](0xb)},'defaultip':{'type':Sequelize[_0x9354('0x2')]},'defaultuser':{'type':Sequelize[_0x9354('0x2')]},'rtptimeout':{'type':Sequelize[_0x9354('0x27')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0x9354('0x27')](0xb)},'sendrpid':{'type':Sequelize[_0x9354('0x3')](_0x9354('0x18'),'no',_0x9354('0x2e')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0x9354('0x27')](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0x9354('0x27')](0xb)},'contactpermit':{'type':Sequelize[_0x9354('0x2')]},'contactdeny':{'type':Sequelize[_0x9354('0x2')]},'contactacl':{'type':Sequelize[_0x9354('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0x9354('0x2')]},'use_q850_reason':{'type':Sequelize[_0x9354('0x2')]},'maxforwards':{'type':Sequelize[_0x9354('0x27')](0xb)},'encryption':{'type':Sequelize[_0x9354('0x3')](_0x9354('0x18'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM']('yes','no')},'force_avp':{'type':Sequelize[_0x9354('0x3')](_0x9354('0x18'),'no')},'icesupport':{'type':Sequelize[_0x9354('0x3')](_0x9354('0x18'),'no')},'dtlsenable':{'type':Sequelize[_0x9354('0x3')]('yes','no')},'dtlsverify':{'type':Sequelize[_0x9354('0x3')](_0x9354('0x18'),'no',_0x9354('0x2f'),_0x9354('0x30'))},'dtlsrekey':{'type':Sequelize[_0x9354('0x27')](0xb)},'dtlscertfile':{'type':Sequelize[_0x9354('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0x9354('0x2')]},'dtlscipher':{'type':Sequelize[_0x9354('0x2')]},'dtlscafile':{'type':Sequelize[_0x9354('0x2')]},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize[_0x9354('0x3')](_0x9354('0x31'),_0x9354('0x32'),_0x9354('0x33')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x9354('0x2')]},'usereqphone':{'type':Sequelize[_0x9354('0x3')]('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0x9354('0x2')]},'call_limit':{'type':Sequelize[_0x9354('0x27')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x9354('0x3')]('yes','no')},'subscribemwi':{'type':Sequelize[_0x9354('0x3')](_0x9354('0x18'),'no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize[_0x9354('0x2')]},'mohsuggest':{'type':Sequelize[_0x9354('0x2')]},'parkinglot':{'type':Sequelize[_0x9354('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x9354('0x2')],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize['ENUM'](_0x9354('0x18'),'no','nonat',_0x9354('0x1a'),_0x9354('0x34')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x9354('0x2')]},'otherFields':{'type':Sequelize[_0x9354('0x2')]},'active':{'type':Sequelize[_0x9354('0x35')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'defaultValue':'no'}}; \ No newline at end of file +var _0xfd39=['transport','join','getDataValue','info','shortinfo','inband','rfc2833','yes','update','outgoing','force_rport,comedia','nat','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','setDataValue','allow','ulaw;alaw;gsm','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','accept','refuse','uac','uas','fingerprint','certificate','active','actpass','nonat','update,nonat','sequelize','exports','STRING','name','ENUM','friend','user','peer','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','PROHIB_NOT_SCREENED','PROHIB','udp'];(function(_0xd4a827,_0x4b8cc1){var _0x5b0197=function(_0x4f22ac){while(--_0x4f22ac){_0xd4a827['push'](_0xd4a827['shift']());}};_0x5b0197(++_0x4b8cc1);}(_0xfd39,0x1d3));var _0x9fd3=function(_0x44a7a8,_0x35142d){_0x44a7a8=_0x44a7a8-0x0;var _0xa86164=_0xfd39[_0x44a7a8];return _0xa86164;};'use strict';var Sequelize=require(_0x9fd3('0x0'));module[_0x9fd3('0x1')]={'name':{'type':Sequelize[_0x9fd3('0x2')],'allowNull':![],'unique':_0x9fd3('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x9fd3('0x4')](_0x9fd3('0x5'),_0x9fd3('0x6'),_0x9fd3('0x7')),'allowNull':![],'defaultValue':_0x9fd3('0x5')},'context':{'type':Sequelize[_0x9fd3('0x2')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0x9fd3('0x4')](_0x9fd3('0x8'),_0x9fd3('0x9'),'ALLOWED_FAILED_SCREEN','ALLOWED',_0x9fd3('0xa'),'PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN',_0x9fd3('0xb'))},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize[_0x9fd3('0x2')]},'secret':{'type':Sequelize[_0x9fd3('0x2')]},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize[_0x9fd3('0x2')]},'transport':{'type':Sequelize[_0x9fd3('0x2')],'defaultValue':_0x9fd3('0xc'),'set':function(_0x345185){this['setDataValue'](_0x9fd3('0xd'),_0x345185?_0x345185[_0x9fd3('0xe')](','):null);},'get':function(){return this[_0x9fd3('0xf')](_0x9fd3('0xd'))?this[_0x9fd3('0xf')]('transport')['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x9fd3('0x4')]('rfc2833',_0x9fd3('0x10'),_0x9fd3('0x11'),_0x9fd3('0x12'),'auto'),'defaultValue':_0x9fd3('0x13')},'directmedia':{'type':Sequelize[_0x9fd3('0x4')](_0x9fd3('0x14'),'no','nonat',_0x9fd3('0x15'),_0x9fd3('0x16')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x9fd3('0x4')](_0x9fd3('0x14'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0x9fd3('0x2')]},'nat':{'type':Sequelize['STRING'],'defaultValue':_0x9fd3('0x17'),'set':function(_0x399522){this['setDataValue'](_0x9fd3('0x18'),_0x399522?_0x399522[_0x9fd3('0xe')](','):null);},'get':function(){return this[_0x9fd3('0xf')](_0x9fd3('0x18'))?this[_0x9fd3('0xf')](_0x9fd3('0x18'))[_0x9fd3('0x19')](','):null;},'comment':_0x9fd3('0x1a')},'callgroup':{'type':Sequelize[_0x9fd3('0x2')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x9fd3('0x2')]},'namedpickupgroup':{'type':Sequelize[_0x9fd3('0x2')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':_0x9fd3('0x1b')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x4ff067){this[_0x9fd3('0x1c')](_0x9fd3('0x1d'),_0x4ff067?_0x4ff067['join'](';'):_0x9fd3('0x1e'));},'get':function(){return this[_0x9fd3('0xf')](_0x9fd3('0x1d'))?this[_0x9fd3('0xf')]('allow')[_0x9fd3('0x19')](';'):null;},'comment':_0x9fd3('0x1f')},'autoframing':{'type':Sequelize[_0x9fd3('0x4')](_0x9fd3('0x14'),'no')},'insecure':{'type':Sequelize[_0x9fd3('0x2')],'defaultValue':_0x9fd3('0x20'),'set':function(_0x5406a0){this[_0x9fd3('0x1c')](_0x9fd3('0x21'),_0x5406a0?_0x5406a0[_0x9fd3('0xe')](','):null);},'get':function(){return this[_0x9fd3('0xf')](_0x9fd3('0x21'))?this[_0x9fd3('0xf')](_0x9fd3('0x21'))['split'](','):null;},'comment':_0x9fd3('0x22')},'trustrpid':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x9fd3('0x4')](_0x9fd3('0x14'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x9fd3('0x4')]('yes','no',_0x9fd3('0x23'))},'promiscredir':{'type':Sequelize[_0x9fd3('0x4')](_0x9fd3('0x14'),'no')},'useclientcode':{'type':Sequelize[_0x9fd3('0x4')]('yes','no')},'accountcode':{'type':Sequelize[_0x9fd3('0x24')](0xb)},'setvar':{'type':Sequelize[_0x9fd3('0x2')]},'callerid':{'type':Sequelize['STRING'],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x9fd3('0x14')},'busylevel':{'type':Sequelize[_0x9fd3('0x24')](0xb)},'allowoverlap':{'type':Sequelize[_0x9fd3('0x4')](_0x9fd3('0x14'),'no')},'allowsubscribe':{'type':Sequelize[_0x9fd3('0x4')]('yes','no')},'allowtransfer':{'type':Sequelize[_0x9fd3('0x4')](_0x9fd3('0x14'),'no')},'ignoresdpversion':{'type':Sequelize[_0x9fd3('0x4')]('yes','no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0x9fd3('0x2')]},'videosupport':{'type':Sequelize[_0x9fd3('0x4')]('yes','no',_0x9fd3('0x25')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize[_0x9fd3('0x4')](_0x9fd3('0x14'),'no')},'mailbox':{'type':Sequelize[_0x9fd3('0x2')]},'session_timers':{'type':Sequelize[_0x9fd3('0x4')](_0x9fd3('0x26'),_0x9fd3('0x27'),'originate')},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize[_0x9fd3('0x24')](0xb)},'session_refresher':{'type':Sequelize[_0x9fd3('0x4')](_0x9fd3('0x28'),_0x9fd3('0x29')),'defaultValue':_0x9fd3('0x29')},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize[_0x9fd3('0x2')]},'fromdomain':{'type':Sequelize[_0x9fd3('0x2')]},'fromuser':{'type':Sequelize[_0x9fd3('0x2')]},'port':{'type':Sequelize[_0x9fd3('0x24')](0x5)},'qualify':{'type':Sequelize[_0x9fd3('0x4')](_0x9fd3('0x14'),'no'),'defaultValue':_0x9fd3('0x14')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0x9fd3('0x2')]},'defaultuser':{'type':Sequelize[_0x9fd3('0x2')]},'rtptimeout':{'type':Sequelize[_0x9fd3('0x24')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x9fd3('0x24')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x9fd3('0x24')](0xb)},'sendrpid':{'type':Sequelize[_0x9fd3('0x4')]('yes','no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x9fd3('0x2')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0x9fd3('0x24')](0xb)},'timerb':{'type':Sequelize[_0x9fd3('0x24')](0xb)},'qualifyfreq':{'type':Sequelize[_0x9fd3('0x24')](0xb)},'contactpermit':{'type':Sequelize[_0x9fd3('0x2')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0x9fd3('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0x9fd3('0x2')]},'use_q850_reason':{'type':Sequelize[_0x9fd3('0x2')]},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize[_0x9fd3('0x4')](_0x9fd3('0x14'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x9fd3('0x4')](_0x9fd3('0x14'),'no')},'force_avp':{'type':Sequelize[_0x9fd3('0x4')]('yes','no')},'icesupport':{'type':Sequelize['ENUM'](_0x9fd3('0x14'),'no')},'dtlsenable':{'type':Sequelize[_0x9fd3('0x4')](_0x9fd3('0x14'),'no')},'dtlsverify':{'type':Sequelize[_0x9fd3('0x4')]('yes','no',_0x9fd3('0x2a'),_0x9fd3('0x2b'))},'dtlsrekey':{'type':Sequelize[_0x9fd3('0x24')](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize[_0x9fd3('0x2')]},'dtlscipher':{'type':Sequelize[_0x9fd3('0x2')]},'dtlscafile':{'type':Sequelize[_0x9fd3('0x2')]},'dtlscapath':{'type':Sequelize[_0x9fd3('0x2')]},'dtlssetup':{'type':Sequelize[_0x9fd3('0x4')](_0x9fd3('0x2c'),'passive',_0x9fd3('0x2d')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x9fd3('0x2')]},'usereqphone':{'type':Sequelize[_0x9fd3('0x4')](_0x9fd3('0x14'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x9fd3('0x2')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize[_0x9fd3('0x24')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0x9fd3('0x14'),'no')},'subscribemwi':{'type':Sequelize[_0x9fd3('0x4')]('yes','no')},'vmexten':{'type':Sequelize[_0x9fd3('0x2')]},'mohinterpret':{'type':Sequelize[_0x9fd3('0x2')]},'mohsuggest':{'type':Sequelize[_0x9fd3('0x2')]},'parkinglot':{'type':Sequelize[_0x9fd3('0x2')]},'description':{'type':Sequelize[_0x9fd3('0x2')]},'host':{'type':Sequelize[_0x9fd3('0x2')],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize[_0x9fd3('0x4')]('yes','no',_0x9fd3('0x2e'),_0x9fd3('0x15'),_0x9fd3('0x2f')),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x9fd3('0x2')],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index 955ab34..c54ac72 100644 --- a/server/api/trunk/trunk.controller.js +++ b/server/api/trunk/trunk.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x54ef=['intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','show','params','include','find','get','updatedAt','omit','body','createdAt','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','server/files/templates/trunk.ejs','utf8','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','userProfileId','root','chan_sip.so','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','http','request','info','Trunk,\x20%s,\x20%s','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','Trunks','UserProfileResource','name','send','index','map','Trunk','rawAttributes','fieldName','type','key','model','query','keys','filters'];(function(_0x5e773f,_0x5c0a0c){var _0x4c8fd7=function(_0x3b7bcf){while(--_0x3b7bcf){_0x5e773f['push'](_0x5e773f['shift']());}};_0x4c8fd7(++_0x5c0a0c);}(_0x54ef,0x112));var _0xf54e=function(_0x4d9692,_0x3251c7){_0x4d9692=_0x4d9692-0x0;var _0x1db6b8=_0x54ef[_0x4d9692];return _0x1db6b8;};'use strict';var emlformat=require(_0xf54e('0x0'));var rimraf=require(_0xf54e('0x1'));var zipdir=require(_0xf54e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf54e('0x3'));var moment=require(_0xf54e('0x4'));var BPromise=require(_0xf54e('0x5'));var Mustache=require(_0xf54e('0x6'));var util=require(_0xf54e('0x7'));var path=require(_0xf54e('0x8'));var sox=require(_0xf54e('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf54e('0xa'));var _=require(_0xf54e('0xb'));var squel=require(_0xf54e('0xc'));var crypto=require('crypto');var jsforce=require(_0xf54e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf54e('0xe'));var querystring=require(_0xf54e('0xf'));var Papa=require('papaparse');var Redis=require(_0xf54e('0x10'));var authService=require(_0xf54e('0x11'));var qs=require(_0xf54e('0x12'));var as=require(_0xf54e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf54e('0x14'))(_0xf54e('0x15'));var utils=require(_0xf54e('0x16'));var config=require(_0xf54e('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xf54e('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0xf54e('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x2033e9,_0x28f776,_0x380f26,_0x5644aa){return new BPromise(function(_0x331732,_0x1bbeaa){var _0x1855fe=_0x5644aa||client;return _0x1855fe[_0xf54e('0x1a')](_0x2033e9,_0x380f26)['then'](function(_0x2366ee){logger[_0xf54e('0x1b')](_0xf54e('0x1c'),_0x28f776,'request\x20sent');logger['debug'](_0xf54e('0x1d'),_0x28f776,_0xf54e('0x1e'),JSON[_0xf54e('0x1f')](_0x2366ee));if(_0x2366ee[_0xf54e('0x20')]){if(_0x2366ee[_0xf54e('0x20')][_0xf54e('0x21')]===0x1f4){logger[_0xf54e('0x20')](_0xf54e('0x1c'),_0x28f776,_0x2366ee[_0xf54e('0x20')][_0xf54e('0x22')]);return _0x1bbeaa(_0x2366ee[_0xf54e('0x20')]['message']);}logger['error'](_0xf54e('0x1c'),_0x28f776,_0x2366ee['error'][_0xf54e('0x22')]);return _0x331732(_0x2366ee[_0xf54e('0x20')][_0xf54e('0x22')]);}else{logger[_0xf54e('0x1b')](_0xf54e('0x1c'),_0x28f776,_0xf54e('0x1e'));_0x331732(_0x2366ee[_0xf54e('0x23')][_0xf54e('0x22')]);}})[_0xf54e('0x24')](function(_0x5f9eea){logger[_0xf54e('0x20')]('Trunk,\x20%s,\x20%s',_0x28f776,_0x5f9eea);_0x1bbeaa(_0x5f9eea);});});}function respondWithStatusCode(_0x6f6d29,_0x54f914){_0x54f914=_0x54f914||0xcc;return function(_0x264a8f){if(_0x264a8f){return _0x6f6d29[_0xf54e('0x25')](_0x54f914);}return _0x6f6d29[_0xf54e('0x26')](_0x54f914)[_0xf54e('0x27')]();};}function respondWithResult(_0x3805a7,_0x160160){_0x160160=_0x160160||0xc8;return function(_0x1e08d1){if(_0x1e08d1){return _0x3805a7[_0xf54e('0x26')](_0x160160)[_0xf54e('0x28')](_0x1e08d1);}};}function respondWithFilteredResult(_0x33457f,_0xf6cdd7){return function(_0x39c0ae){if(_0x39c0ae){var _0x2ea001=typeof _0xf6cdd7['offset']===_0xf54e('0x29')&&typeof _0xf6cdd7['limit']===_0xf54e('0x29');var _0x5e63f4=_0x39c0ae[_0xf54e('0x2a')];var _0x269f47=_0x2ea001?0x0:_0xf6cdd7[_0xf54e('0x2b')];var _0xa13cd0=_0x2ea001?_0x39c0ae[_0xf54e('0x2a')]:_0xf6cdd7[_0xf54e('0x2b')]+_0xf6cdd7[_0xf54e('0x2c')];var _0x54bd8f;if(_0xa13cd0>=_0x5e63f4){_0xa13cd0=_0x5e63f4;_0x54bd8f=0xc8;}else{_0x54bd8f=0xce;}_0x33457f['status'](_0x54bd8f);return _0x33457f[_0xf54e('0x2d')](_0xf54e('0x2e'),_0x269f47+'-'+_0xa13cd0+'/'+_0x5e63f4)[_0xf54e('0x28')](_0x39c0ae);}return null;};}function patchUpdates(_0x16d00f){return function(_0xb2d4c4){try{jsonpatch[_0xf54e('0x2f')](_0xb2d4c4,_0x16d00f,!![]);}catch(_0x2b5408){return BPromise[_0xf54e('0x30')](_0x2b5408);}return _0xb2d4c4[_0xf54e('0x31')]();};}function saveUpdates(_0x12edc3,_0x5ea0cc){return function(_0x5f29d3){if(_0x5f29d3){return _0x5f29d3[_0xf54e('0x32')](_0x12edc3)[_0xf54e('0x33')](function(_0x4d8fdd){return _0x4d8fdd;});}return null;};}function removeEntity(_0x3e319c,_0x82e313){return function(_0x379110){if(_0x379110){return _0x379110[_0xf54e('0x34')]()['then'](function(){var _0x54bea4=_0x379110['get']({'plain':!![]});var _0x3c0cca=_0xf54e('0x35');return db[_0xf54e('0x36')][_0xf54e('0x34')]({'where':{'type':_0x3c0cca,'resourceId':_0x54bea4['id']}})[_0xf54e('0x33')](function(){return _0x379110;});})[_0xf54e('0x33')](function(){_0x3e319c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x530cee,_0xc04e04){return function(_0x734187){if(!_0x734187){_0x530cee['sendStatus'](0x194);}return _0x734187;};}function handleError(_0x4d9b06,_0xda1d10){_0xda1d10=_0xda1d10||0x1f4;return function(_0x2c0d30){logger[_0xf54e('0x20')](_0x2c0d30['stack']);if(_0x2c0d30[_0xf54e('0x37')]){delete _0x2c0d30[_0xf54e('0x37')];}_0x4d9b06['status'](_0xda1d10)[_0xf54e('0x38')](_0x2c0d30);};}exports[_0xf54e('0x39')]=function(_0x5af03,_0x1eeeb4){var _0x12ef97={},_0x199056={},_0x4e00b7={'count':0x0,'rows':[]};var _0x5d45cf=_[_0xf54e('0x3a')](db[_0xf54e('0x3b')][_0xf54e('0x3c')],function(_0x4b1f84){return{'name':_0x4b1f84[_0xf54e('0x3d')],'type':_0x4b1f84[_0xf54e('0x3e')][_0xf54e('0x3f')]};});_0x199056[_0xf54e('0x40')]=_[_0xf54e('0x3a')](_0x5d45cf,_0xf54e('0x37'));_0x199056[_0xf54e('0x41')]=_[_0xf54e('0x42')](_0x5af03[_0xf54e('0x41')]);_0x199056[_0xf54e('0x43')]=_[_0xf54e('0x44')](_0x199056[_0xf54e('0x40')],_0x199056[_0xf54e('0x41')]);_0x12ef97[_0xf54e('0x45')]=_[_0xf54e('0x44')](_0x199056['model'],qs['fields'](_0x5af03['query'][_0xf54e('0x46')]));_0x12ef97[_0xf54e('0x45')]=_0x12ef97['attributes'][_0xf54e('0x47')]?_0x12ef97[_0xf54e('0x45')]:_0x199056[_0xf54e('0x40')];if(!_0x5af03['query'][_0xf54e('0x48')](_0xf54e('0x49'))){_0x12ef97[_0xf54e('0x2c')]=qs[_0xf54e('0x2c')](_0x5af03[_0xf54e('0x41')][_0xf54e('0x2c')]);_0x12ef97[_0xf54e('0x2b')]=qs[_0xf54e('0x2b')](_0x5af03[_0xf54e('0x41')]['offset']);}_0x12ef97[_0xf54e('0x4a')]=qs[_0xf54e('0x4b')](_0x5af03[_0xf54e('0x41')][_0xf54e('0x4b')]);_0x12ef97[_0xf54e('0x4c')]=qs[_0xf54e('0x43')](_['pick'](_0x5af03[_0xf54e('0x41')],_0x199056['filters']),_0x5d45cf);if(_0x5af03[_0xf54e('0x41')]['filter']){_0x12ef97[_0xf54e('0x4c')]=_[_0xf54e('0x4d')](_0x12ef97[_0xf54e('0x4c')],{'$or':_['map'](_0x5d45cf,function(_0x1af35d){if(_0x1af35d[_0xf54e('0x3e')]!==_0xf54e('0x4e')){var _0x32fb46={};_0x32fb46[_0x1af35d[_0xf54e('0x37')]]={'$like':'%'+_0x5af03['query'][_0xf54e('0x4f')]+'%'};return _0x32fb46;}})});}_0x12ef97=_[_0xf54e('0x4d')]({},_0x12ef97,_0x5af03[_0xf54e('0x50')]);var _0x45592b={'where':_0x12ef97['where']};return db[_0xf54e('0x3b')][_0xf54e('0x2a')](_0x45592b)['then'](function(_0x22c842){_0x4e00b7[_0xf54e('0x2a')]=_0x22c842;if(_0x5af03[_0xf54e('0x41')][_0xf54e('0x51')]){_0x12ef97['include']=[{'all':!![]}];}return db[_0xf54e('0x3b')][_0xf54e('0x52')](_0x12ef97);})[_0xf54e('0x33')](function(_0xb4654f){_0x4e00b7[_0xf54e('0x53')]=_0xb4654f;return _0x4e00b7;})[_0xf54e('0x33')](respondWithFilteredResult(_0x1eeeb4,_0x12ef97))[_0xf54e('0x24')](handleError(_0x1eeeb4,null));};exports[_0xf54e('0x54')]=function(_0x15bfef,_0x21f2f8){var _0xaf9bf0={'raw':![],'where':{'id':_0x15bfef[_0xf54e('0x55')]['id']}},_0x1f4cf8={};_0x1f4cf8[_0xf54e('0x40')]=_[_0xf54e('0x42')](db[_0xf54e('0x3b')][_0xf54e('0x3c')]);_0x1f4cf8[_0xf54e('0x41')]=_[_0xf54e('0x42')](_0x15bfef[_0xf54e('0x41')]);_0x1f4cf8['filters']=_['intersection'](_0x1f4cf8[_0xf54e('0x40')],_0x1f4cf8[_0xf54e('0x41')]);_0xaf9bf0[_0xf54e('0x45')]=_[_0xf54e('0x44')](_0x1f4cf8[_0xf54e('0x40')],qs[_0xf54e('0x46')](_0x15bfef[_0xf54e('0x41')][_0xf54e('0x46')]));_0xaf9bf0[_0xf54e('0x45')]=_0xaf9bf0[_0xf54e('0x45')][_0xf54e('0x47')]?_0xaf9bf0['attributes']:_0x1f4cf8[_0xf54e('0x40')];if(_0x15bfef[_0xf54e('0x41')][_0xf54e('0x51')]){_0xaf9bf0[_0xf54e('0x56')]=[{'all':!![]}];}_0xaf9bf0=_[_0xf54e('0x4d')]({},_0xaf9bf0,_0x15bfef[_0xf54e('0x50')]);return db[_0xf54e('0x3b')]['find'](_0xaf9bf0)[_0xf54e('0x33')](handleEntityNotFound(_0x21f2f8,null))[_0xf54e('0x33')](respondWithResult(_0x21f2f8,null))[_0xf54e('0x24')](handleError(_0x21f2f8,null));};exports['clone']=function(_0x3ce832,_0x54ac1a){var _0x465a0f={'where':{'id':_0x3ce832[_0xf54e('0x55')]['id']}},_0x400ee0={};_0x400ee0['model']=_[_0xf54e('0x42')](db[_0xf54e('0x3b')][_0xf54e('0x3c')]);_0x465a0f[_0xf54e('0x45')]=_[_0xf54e('0x44')](_0x400ee0[_0xf54e('0x40')],qs[_0xf54e('0x46')](_0x3ce832['query']['fields']));_0x465a0f[_0xf54e('0x45')]=_0x465a0f[_0xf54e('0x45')]['length']?_0x465a0f[_0xf54e('0x45')]:_0x400ee0['model'];if(_0x3ce832[_0xf54e('0x41')]['includeAll']){_0x465a0f[_0xf54e('0x56')]=[{'all':!![]}];}_0x465a0f=_[_0xf54e('0x4d')]({},_0x465a0f,_0x3ce832[_0xf54e('0x50')]);return db[_0xf54e('0x3b')][_0xf54e('0x57')](_0x465a0f)[_0xf54e('0x33')](handleEntityNotFound(_0x54ac1a,null))['then'](function(_0x479572){if(_0x479572){var _0x79345=_0x479572[_0xf54e('0x58')]({'plain':!![]});_0x79345=qs['omit'](_0x79345,['id','createdAt',_0xf54e('0x59')]);_0x3ce832['body']=_[_0xf54e('0x5a')](_0x3ce832[_0xf54e('0x5b')],['id',_0xf54e('0x5c'),_0xf54e('0x59')]);return db[_0xf54e('0x3b')][_0xf54e('0x5d')](_[_0xf54e('0x4d')](_0x79345,_0x3ce832[_0xf54e('0x5b')]),{'include':_0x3ce832[_0xf54e('0x41')][_0xf54e('0x51')]?[{'all':!![]}]:undefined})[_0xf54e('0x33')](function(_0x2c6d0e){var _0x65bdf2=_0x3ce832[_0xf54e('0x5e')]['get']({'plain':!![]});if(!_0x65bdf2)throw new Error(_0xf54e('0x5f'));if(_0x65bdf2[_0xf54e('0x60')]===_0xf54e('0x5e')){var _0x11908b=_0x2c6d0e[_0xf54e('0x58')]({'plain':!![]});var _0x494629=_0xf54e('0x35');return db[_0xf54e('0x61')]['find']({'where':{'name':_0x494629,'userProfileId':_0x65bdf2['userProfileId']},'raw':!![]})[_0xf54e('0x33')](function(_0x4b4a2f){if(_0x4b4a2f&&_0x4b4a2f[_0xf54e('0x62')]===0x0){return db[_0xf54e('0x36')][_0xf54e('0x5d')]({'name':_0x11908b[_0xf54e('0x37')],'resourceId':_0x11908b['id'],'type':_0x4b4a2f['name'],'sectionId':_0x4b4a2f['id']},{})[_0xf54e('0x33')](function(){return _0x2c6d0e;});}else{return _0x2c6d0e;}})['catch'](function(_0x3800d4){logger[_0xf54e('0x20')](_0xf54e('0x63'),_0x3800d4);throw _0x3800d4;});}return _0x2c6d0e;});}})['then'](respondWithResult(_0x54ac1a,0xc9))[_0xf54e('0x24')](handleError(_0x54ac1a,null));};exports['create']=function(_0x3f7224,_0x3e2101,_0x5500d7){var _0x380b4f;return db['Trunk'][_0xf54e('0x5d')](_0x3f7224[_0xf54e('0x5b')],{'raw':!![]})[_0xf54e('0x33')](function(_0x38405c){_0x380b4f=_0x38405c;return db[_0xf54e('0x3b')]['findAll']({'raw':!![]});})[_0xf54e('0x33')](function(_0x1d18d3){var _0x57db6f=fs[_0xf54e('0x64')](path[_0xf54e('0x65')](config['root'],_0xf54e('0x66')),_0xf54e('0x67'));var _0x309895=fs['readFileSync'](path[_0xf54e('0x65')](config['root'],_0xf54e('0x68')),_0xf54e('0x67'));var _0x5e45e7=ejs[_0xf54e('0x69')](_0x57db6f,{'trunks':_0x1d18d3||[]});fs[_0xf54e('0x6a')](_0xf54e('0x6b'),_0x5e45e7);if(_0x380b4f[_0xf54e('0x6c')]){var _0x38bf71=ejs[_0xf54e('0x69')](_0x309895,{'trunks':_0x1d18d3||[]});fs[_0xf54e('0x6a')](_0xf54e('0x6d'),_0x38bf71);}})[_0xf54e('0x33')](function(){return respondWithRpcPromise(_0xf54e('0x6e'),_0xf54e('0x5d'),{'module':'chan_sip.so'});})[_0xf54e('0x33')](function(){var _0x2c20b5=_0x3f7224[_0xf54e('0x5e')]['get']({'plain':!![]});if(!_0x2c20b5)throw new Error(_0xf54e('0x5f'));if(_0x2c20b5[_0xf54e('0x60')]===_0xf54e('0x5e')){var _0x13db3e=_0x380b4f[_0xf54e('0x58')]({'plain':!![]});return db[_0xf54e('0x61')][_0xf54e('0x57')]({'where':{'name':'Trunks','userProfileId':_0x2c20b5[_0xf54e('0x6f')]},'raw':!![]})[_0xf54e('0x33')](function(_0x261c39){if(_0x261c39&&_0x261c39['autoAssociation']===0x0){return db[_0xf54e('0x36')][_0xf54e('0x5d')]({'name':_0x13db3e[_0xf54e('0x37')],'resourceId':_0x13db3e['id'],'type':_0x261c39[_0xf54e('0x37')],'sectionId':_0x261c39['id']},{})['then'](function(){return _0x380b4f;});}else{return _0x380b4f;}})['catch'](function(_0x25d05e){logger[_0xf54e('0x20')](_0xf54e('0x63'),_0x25d05e);throw _0x25d05e;});}return _0x380b4f;})[_0xf54e('0x33')](respondWithResult(_0x3e2101,0xc9))[_0xf54e('0x24')](handleError(_0x3e2101,null));};exports[_0xf54e('0x32')]=function(_0x35b5a4,_0x3b2a3e,_0xf5108b){var _0x205b47;return db['Trunk'][_0xf54e('0x57')]({'where':{'id':_0x35b5a4[_0xf54e('0x55')]['id']}})[_0xf54e('0x33')](handleEntityNotFound(_0x3b2a3e,null))[_0xf54e('0x33')](saveUpdates(_0x35b5a4['body'],null))[_0xf54e('0x33')](function(_0x1de6dd){if(_0x1de6dd){_0x205b47=_0x1de6dd;return db[_0xf54e('0x3b')][_0xf54e('0x52')]({'raw':!![]});}})['then'](function(_0x394862){if(_0x394862){var _0x4876b5=fs[_0xf54e('0x64')](path['join'](config['root'],_0xf54e('0x66')),_0xf54e('0x67'));var _0x1e2834=fs[_0xf54e('0x64')](path[_0xf54e('0x65')](config[_0xf54e('0x70')],_0xf54e('0x68')),_0xf54e('0x67'));var _0x8093bc=ejs['render'](_0x4876b5,{'trunks':_0x394862||[]});fs[_0xf54e('0x6a')](_0xf54e('0x6b'),_0x8093bc);var _0x4ce10=ejs[_0xf54e('0x69')](_0x1e2834,{'trunks':_0x394862||[]});fs[_0xf54e('0x6a')](_0xf54e('0x6d'),_0x4ce10);return respondWithRpcPromise(_0xf54e('0x6e'),_0xf54e('0x32'),{'module':_0xf54e('0x71')});}return null;})[_0xf54e('0x33')](function(_0x11dec2){if(_0x11dec2){return _0x205b47;}})[_0xf54e('0x33')](respondWithResult(_0x3b2a3e,null))['catch'](handleError(_0x3b2a3e,null));};exports[_0xf54e('0x34')]=function(_0x1cfa09,_0x59acbc,_0x4a0614){var _0x85b108;return db[_0xf54e('0x3b')][_0xf54e('0x57')]({'where':{'id':_0x1cfa09[_0xf54e('0x55')]['id']}})[_0xf54e('0x33')](handleEntityNotFound(_0x59acbc,null))[_0xf54e('0x33')](removeEntity(_0x59acbc,null))[_0xf54e('0x33')](function(){return db[_0xf54e('0x3b')][_0xf54e('0x52')]({'raw':!![]});})['then'](function(_0x2bb31f){var _0x3c222a=fs[_0xf54e('0x64')](path['join'](config[_0xf54e('0x70')],'server/files/templates/trunk.ejs'),_0xf54e('0x67'));var _0x57bc6f=fs[_0xf54e('0x64')](path[_0xf54e('0x65')](config['root'],'server/files/templates/registry.ejs'),_0xf54e('0x67'));var _0x632240=ejs[_0xf54e('0x69')](_0x3c222a,{'trunks':_0x2bb31f});var _0x406261=ejs[_0xf54e('0x69')](_0x57bc6f,{'trunks':_0x2bb31f});fs['writeFileSync']('/etc/asterisk/sip_xcally_trunks.conf',_0x632240);fs[_0xf54e('0x6a')](_0xf54e('0x6d'),_0x406261);return respondWithRpcPromise(_0xf54e('0x6e'),_0xf54e('0x34'),{'module':_0xf54e('0x71')});})[_0xf54e('0x24')](handleError(_0x59acbc,null));}; \ No newline at end of file +var _0x3e74=['map','Trunk','rawAttributes','fieldName','key','model','keys','query','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','where','type','filter','merge','options','includeAll','include','findAll','params','clone','find','get','omit','createdAt','body','updatedAt','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','root','server/files/templates/trunk.ejs','utf8','readFileSync','server/files/templates/registry.ejs','render','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','writeFileSync','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','info','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','Trunk,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','update','destroy','Trunks','UserProfileResource','stack','name','send','index'];(function(_0x45f99e,_0x5e87ac){var _0x59458b=function(_0xf610f7){while(--_0xf610f7){_0x45f99e['push'](_0x45f99e['shift']());}};_0x59458b(++_0x5e87ac);}(_0x3e74,0x175));var _0x43e7=function(_0x5cdd7b,_0x12f49a){_0x5cdd7b=_0x5cdd7b-0x0;var _0x2c1b8f=_0x3e74[_0x5cdd7b];return _0x2c1b8f;};'use strict';var emlformat=require(_0x43e7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x43e7('0x1'));var jsonpatch=require(_0x43e7('0x2'));var rp=require(_0x43e7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x43e7('0x4'));var util=require('util');var path=require(_0x43e7('0x5'));var sox=require(_0x43e7('0x6'));var csv=require(_0x43e7('0x7'));var ejs=require(_0x43e7('0x8'));var fs=require('fs');var fs_extra=require(_0x43e7('0x9'));var _=require('lodash');var squel=require(_0x43e7('0xa'));var crypto=require(_0x43e7('0xb'));var jsforce=require(_0x43e7('0xc'));var deskjs=require(_0x43e7('0xd'));var toCsv=require(_0x43e7('0x7'));var querystring=require('querystring');var Papa=require(_0x43e7('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x43e7('0xf'));var as=require(_0x43e7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x43e7('0x11'))('api');var utils=require(_0x43e7('0x12'));var config=require(_0x43e7('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x43e7('0x14'))['db'];var jayson=require(_0x43e7('0x15'));var client=jayson[_0x43e7('0x16')][_0x43e7('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x4e008c,_0x583d85,_0x2fcb36,_0x21fdd3){return new BPromise(function(_0x44b0bd,_0x51b974){var _0x5e641c=_0x21fdd3||client;return _0x5e641c[_0x43e7('0x18')](_0x4e008c,_0x2fcb36)[_0x43e7('0x19')](function(_0x203378){logger[_0x43e7('0x1a')]('Trunk,\x20%s,\x20%s',_0x583d85,'request\x20sent');logger[_0x43e7('0x1b')](_0x43e7('0x1c'),_0x583d85,_0x43e7('0x1d'),JSON['stringify'](_0x203378));if(_0x203378['error']){if(_0x203378[_0x43e7('0x1e')][_0x43e7('0x1f')]===0x1f4){logger[_0x43e7('0x1e')](_0x43e7('0x20'),_0x583d85,_0x203378[_0x43e7('0x1e')][_0x43e7('0x21')]);return _0x51b974(_0x203378[_0x43e7('0x1e')][_0x43e7('0x21')]);}logger[_0x43e7('0x1e')](_0x43e7('0x20'),_0x583d85,_0x203378[_0x43e7('0x1e')][_0x43e7('0x21')]);return _0x44b0bd(_0x203378['error'][_0x43e7('0x21')]);}else{logger[_0x43e7('0x1a')]('Trunk,\x20%s,\x20%s',_0x583d85,_0x43e7('0x1d'));_0x44b0bd(_0x203378[_0x43e7('0x22')][_0x43e7('0x21')]);}})[_0x43e7('0x23')](function(_0x4077fb){logger[_0x43e7('0x1e')]('Trunk,\x20%s,\x20%s',_0x583d85,_0x4077fb);_0x51b974(_0x4077fb);});});}function respondWithStatusCode(_0x454359,_0x4eea52){_0x4eea52=_0x4eea52||0xcc;return function(_0x4c9df3){if(_0x4c9df3){return _0x454359[_0x43e7('0x24')](_0x4eea52);}return _0x454359[_0x43e7('0x25')](_0x4eea52)['end']();};}function respondWithResult(_0x1f0673,_0x4ca5cf){_0x4ca5cf=_0x4ca5cf||0xc8;return function(_0x326dab){if(_0x326dab){return _0x1f0673['status'](_0x4ca5cf)[_0x43e7('0x26')](_0x326dab);}};}function respondWithFilteredResult(_0x1b5f50,_0x20888b){return function(_0x405f85){if(_0x405f85){var _0x51f4d7=typeof _0x20888b['offset']===_0x43e7('0x27')&&typeof _0x20888b['limit']===_0x43e7('0x27');var _0x40dc8f=_0x405f85[_0x43e7('0x28')];var _0xb1fc63=_0x51f4d7?0x0:_0x20888b['offset'];var _0x33a1a5=_0x51f4d7?_0x405f85[_0x43e7('0x28')]:_0x20888b[_0x43e7('0x29')]+_0x20888b[_0x43e7('0x2a')];var _0x442c3b;if(_0x33a1a5>=_0x40dc8f){_0x33a1a5=_0x40dc8f;_0x442c3b=0xc8;}else{_0x442c3b=0xce;}_0x1b5f50[_0x43e7('0x25')](_0x442c3b);return _0x1b5f50[_0x43e7('0x2b')](_0x43e7('0x2c'),_0xb1fc63+'-'+_0x33a1a5+'/'+_0x40dc8f)[_0x43e7('0x26')](_0x405f85);}return null;};}function patchUpdates(_0x35dbcd){return function(_0x17df44){try{jsonpatch[_0x43e7('0x2d')](_0x17df44,_0x35dbcd,!![]);}catch(_0x2bde44){return BPromise[_0x43e7('0x2e')](_0x2bde44);}return _0x17df44['save']();};}function saveUpdates(_0x238321,_0x44f6b0){return function(_0x3b8f78){if(_0x3b8f78){return _0x3b8f78[_0x43e7('0x2f')](_0x238321)[_0x43e7('0x19')](function(_0x4c8650){return _0x4c8650;});}return null;};}function removeEntity(_0x1eba65,_0x49b83d){return function(_0x30d47e){if(_0x30d47e){return _0x30d47e[_0x43e7('0x30')]()['then'](function(){var _0x5a7342=_0x30d47e['get']({'plain':!![]});var _0xf8320=_0x43e7('0x31');return db[_0x43e7('0x32')][_0x43e7('0x30')]({'where':{'type':_0xf8320,'resourceId':_0x5a7342['id']}})[_0x43e7('0x19')](function(){return _0x30d47e;});})[_0x43e7('0x19')](function(){_0x1eba65['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ac23d,_0x59e5b2){return function(_0x4e8e86){if(!_0x4e8e86){_0x4ac23d['sendStatus'](0x194);}return _0x4e8e86;};}function handleError(_0x5cb753,_0x14d888){_0x14d888=_0x14d888||0x1f4;return function(_0x49cda6){logger[_0x43e7('0x1e')](_0x49cda6[_0x43e7('0x33')]);if(_0x49cda6[_0x43e7('0x34')]){delete _0x49cda6[_0x43e7('0x34')];}_0x5cb753[_0x43e7('0x25')](_0x14d888)[_0x43e7('0x35')](_0x49cda6);};}exports[_0x43e7('0x36')]=function(_0x4f1a5f,_0x5332d9){var _0x5d84f4={},_0xfa0474={},_0xfe70e9={'count':0x0,'rows':[]};var _0x199ff6=_[_0x43e7('0x37')](db[_0x43e7('0x38')][_0x43e7('0x39')],function(_0x1d4589){return{'name':_0x1d4589[_0x43e7('0x3a')],'type':_0x1d4589['type'][_0x43e7('0x3b')]};});_0xfa0474[_0x43e7('0x3c')]=_['map'](_0x199ff6,_0x43e7('0x34'));_0xfa0474['query']=_[_0x43e7('0x3d')](_0x4f1a5f[_0x43e7('0x3e')]);_0xfa0474[_0x43e7('0x3f')]=_[_0x43e7('0x40')](_0xfa0474[_0x43e7('0x3c')],_0xfa0474[_0x43e7('0x3e')]);_0x5d84f4['attributes']=_['intersection'](_0xfa0474[_0x43e7('0x3c')],qs[_0x43e7('0x41')](_0x4f1a5f[_0x43e7('0x3e')][_0x43e7('0x41')]));_0x5d84f4[_0x43e7('0x42')]=_0x5d84f4['attributes'][_0x43e7('0x43')]?_0x5d84f4[_0x43e7('0x42')]:_0xfa0474['model'];if(!_0x4f1a5f[_0x43e7('0x3e')]['hasOwnProperty'](_0x43e7('0x44'))){_0x5d84f4['limit']=qs[_0x43e7('0x2a')](_0x4f1a5f[_0x43e7('0x3e')][_0x43e7('0x2a')]);_0x5d84f4[_0x43e7('0x29')]=qs['offset'](_0x4f1a5f['query'][_0x43e7('0x29')]);}_0x5d84f4[_0x43e7('0x45')]=qs[_0x43e7('0x46')](_0x4f1a5f[_0x43e7('0x3e')]['sort']);_0x5d84f4['where']=qs['filters'](_[_0x43e7('0x47')](_0x4f1a5f['query'],_0xfa0474[_0x43e7('0x3f')]),_0x199ff6);if(_0x4f1a5f['query']['filter']){_0x5d84f4[_0x43e7('0x48')]=_['merge'](_0x5d84f4[_0x43e7('0x48')],{'$or':_[_0x43e7('0x37')](_0x199ff6,function(_0x257bd8){if(_0x257bd8[_0x43e7('0x49')]!=='VIRTUAL'){var _0x91f1e4={};_0x91f1e4[_0x257bd8[_0x43e7('0x34')]]={'$like':'%'+_0x4f1a5f[_0x43e7('0x3e')][_0x43e7('0x4a')]+'%'};return _0x91f1e4;}})});}_0x5d84f4=_[_0x43e7('0x4b')]({},_0x5d84f4,_0x4f1a5f[_0x43e7('0x4c')]);var _0x51eef4={'where':_0x5d84f4['where']};return db[_0x43e7('0x38')][_0x43e7('0x28')](_0x51eef4)[_0x43e7('0x19')](function(_0x4c00a8){_0xfe70e9['count']=_0x4c00a8;if(_0x4f1a5f['query'][_0x43e7('0x4d')]){_0x5d84f4[_0x43e7('0x4e')]=[{'all':!![]}];}return db['Trunk'][_0x43e7('0x4f')](_0x5d84f4);})[_0x43e7('0x19')](function(_0x3c96fe){_0xfe70e9['rows']=_0x3c96fe;return _0xfe70e9;})['then'](respondWithFilteredResult(_0x5332d9,_0x5d84f4))['catch'](handleError(_0x5332d9,null));};exports['show']=function(_0x214e7e,_0xe955fc){var _0x52fea5={'raw':![],'where':{'id':_0x214e7e[_0x43e7('0x50')]['id']}},_0x23e7cb={};_0x23e7cb[_0x43e7('0x3c')]=_[_0x43e7('0x3d')](db['Trunk'][_0x43e7('0x39')]);_0x23e7cb['query']=_['keys'](_0x214e7e[_0x43e7('0x3e')]);_0x23e7cb[_0x43e7('0x3f')]=_[_0x43e7('0x40')](_0x23e7cb[_0x43e7('0x3c')],_0x23e7cb[_0x43e7('0x3e')]);_0x52fea5[_0x43e7('0x42')]=_[_0x43e7('0x40')](_0x23e7cb[_0x43e7('0x3c')],qs[_0x43e7('0x41')](_0x214e7e[_0x43e7('0x3e')]['fields']));_0x52fea5[_0x43e7('0x42')]=_0x52fea5[_0x43e7('0x42')]['length']?_0x52fea5[_0x43e7('0x42')]:_0x23e7cb['model'];if(_0x214e7e[_0x43e7('0x3e')][_0x43e7('0x4d')]){_0x52fea5[_0x43e7('0x4e')]=[{'all':!![]}];}_0x52fea5=_[_0x43e7('0x4b')]({},_0x52fea5,_0x214e7e[_0x43e7('0x4c')]);return db['Trunk']['find'](_0x52fea5)[_0x43e7('0x19')](handleEntityNotFound(_0xe955fc,null))[_0x43e7('0x19')](respondWithResult(_0xe955fc,null))[_0x43e7('0x23')](handleError(_0xe955fc,null));};exports[_0x43e7('0x51')]=function(_0x23d835,_0x25bb44){var _0xa47464={'where':{'id':_0x23d835[_0x43e7('0x50')]['id']}},_0x44f8a0={};_0x44f8a0[_0x43e7('0x3c')]=_[_0x43e7('0x3d')](db['Trunk'][_0x43e7('0x39')]);_0xa47464[_0x43e7('0x42')]=_['intersection'](_0x44f8a0[_0x43e7('0x3c')],qs[_0x43e7('0x41')](_0x23d835[_0x43e7('0x3e')]['fields']));_0xa47464['attributes']=_0xa47464[_0x43e7('0x42')][_0x43e7('0x43')]?_0xa47464['attributes']:_0x44f8a0[_0x43e7('0x3c')];if(_0x23d835['query']['includeAll']){_0xa47464[_0x43e7('0x4e')]=[{'all':!![]}];}_0xa47464=_[_0x43e7('0x4b')]({},_0xa47464,_0x23d835[_0x43e7('0x4c')]);return db[_0x43e7('0x38')][_0x43e7('0x52')](_0xa47464)['then'](handleEntityNotFound(_0x25bb44,null))[_0x43e7('0x19')](function(_0xdb9fbe){if(_0xdb9fbe){var _0x4d89bd=_0xdb9fbe[_0x43e7('0x53')]({'plain':!![]});_0x4d89bd=qs[_0x43e7('0x54')](_0x4d89bd,['id',_0x43e7('0x55'),'updatedAt']);_0x23d835['body']=_['omit'](_0x23d835[_0x43e7('0x56')],['id',_0x43e7('0x55'),_0x43e7('0x57')]);return db[_0x43e7('0x38')]['create'](_['merge'](_0x4d89bd,_0x23d835[_0x43e7('0x56')]),{'include':_0x23d835[_0x43e7('0x3e')][_0x43e7('0x4d')]?[{'all':!![]}]:undefined})[_0x43e7('0x19')](function(_0x5ea0db){var _0x4438c0=_0x23d835[_0x43e7('0x58')][_0x43e7('0x53')]({'plain':!![]});if(!_0x4438c0)throw new Error(_0x43e7('0x59'));if(_0x4438c0[_0x43e7('0x5a')]===_0x43e7('0x58')){var _0x4665db=_0x5ea0db[_0x43e7('0x53')]({'plain':!![]});var _0x406155=_0x43e7('0x31');return db[_0x43e7('0x5b')]['find']({'where':{'name':_0x406155,'userProfileId':_0x4438c0['userProfileId']},'raw':!![]})[_0x43e7('0x19')](function(_0x58a3a8){if(_0x58a3a8&&_0x58a3a8['autoAssociation']===0x0){return db['UserProfileResource'][_0x43e7('0x5c')]({'name':_0x4665db[_0x43e7('0x34')],'resourceId':_0x4665db['id'],'type':_0x58a3a8['name'],'sectionId':_0x58a3a8['id']},{})[_0x43e7('0x19')](function(){return _0x5ea0db;});}else{return _0x5ea0db;}})[_0x43e7('0x23')](function(_0x1d8438){logger['error'](_0x43e7('0x5d'),_0x1d8438);throw _0x1d8438;});}return _0x5ea0db;});}})[_0x43e7('0x19')](respondWithResult(_0x25bb44,0xc9))[_0x43e7('0x23')](handleError(_0x25bb44,null));};exports[_0x43e7('0x5c')]=function(_0x2f43d7,_0x472a19,_0x1e02fa){var _0x515f01;return db[_0x43e7('0x38')][_0x43e7('0x5c')](_0x2f43d7[_0x43e7('0x56')],{'raw':!![]})['then'](function(_0x56b06d){_0x515f01=_0x56b06d;return db[_0x43e7('0x38')]['findAll']({'raw':!![]});})['then'](function(_0x1b793d){var _0x154e47=fs['readFileSync'](path[_0x43e7('0x5e')](config[_0x43e7('0x5f')],_0x43e7('0x60')),_0x43e7('0x61'));var _0x16499c=fs[_0x43e7('0x62')](path[_0x43e7('0x5e')](config['root'],_0x43e7('0x63')),_0x43e7('0x61'));var _0x4e5956=ejs[_0x43e7('0x64')](_0x154e47,{'trunks':_0x1b793d||[]});fs['writeFileSync'](_0x43e7('0x65'),_0x4e5956);if(_0x515f01[_0x43e7('0x66')]){var _0x37301b=ejs[_0x43e7('0x64')](_0x16499c,{'trunks':_0x1b793d||[]});fs['writeFileSync'](_0x43e7('0x67'),_0x37301b);}})[_0x43e7('0x19')](function(){return respondWithRpcPromise(_0x43e7('0x68'),'create',{'module':_0x43e7('0x69')});})[_0x43e7('0x19')](function(){var _0x219dc6=_0x2f43d7[_0x43e7('0x58')][_0x43e7('0x53')]({'plain':!![]});if(!_0x219dc6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x219dc6[_0x43e7('0x5a')]===_0x43e7('0x58')){var _0x35d133=_0x515f01[_0x43e7('0x53')]({'plain':!![]});return db[_0x43e7('0x5b')][_0x43e7('0x52')]({'where':{'name':_0x43e7('0x31'),'userProfileId':_0x219dc6['userProfileId']},'raw':!![]})['then'](function(_0x405faa){if(_0x405faa&&_0x405faa['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x35d133[_0x43e7('0x34')],'resourceId':_0x35d133['id'],'type':_0x405faa[_0x43e7('0x34')],'sectionId':_0x405faa['id']},{})[_0x43e7('0x19')](function(){return _0x515f01;});}else{return _0x515f01;}})[_0x43e7('0x23')](function(_0x18713b){logger[_0x43e7('0x1e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x18713b);throw _0x18713b;});}return _0x515f01;})[_0x43e7('0x19')](respondWithResult(_0x472a19,0xc9))[_0x43e7('0x23')](handleError(_0x472a19,null));};exports[_0x43e7('0x2f')]=function(_0x5b4c76,_0x2abca0,_0xea84ec){var _0x184ae3;return db[_0x43e7('0x38')][_0x43e7('0x52')]({'where':{'id':_0x5b4c76[_0x43e7('0x50')]['id']}})[_0x43e7('0x19')](handleEntityNotFound(_0x2abca0,null))[_0x43e7('0x19')](saveUpdates(_0x5b4c76['body'],null))['then'](function(_0x55990c){if(_0x55990c){_0x184ae3=_0x55990c;return db[_0x43e7('0x38')][_0x43e7('0x4f')]({'raw':!![]});}})['then'](function(_0x3fe23f){if(_0x3fe23f){var _0x39a787=fs[_0x43e7('0x62')](path[_0x43e7('0x5e')](config['root'],'server/files/templates/trunk.ejs'),'utf8');var _0x177a7a=fs[_0x43e7('0x62')](path['join'](config['root'],_0x43e7('0x63')),_0x43e7('0x61'));var _0x3b7e5b=ejs['render'](_0x39a787,{'trunks':_0x3fe23f||[]});fs[_0x43e7('0x6a')](_0x43e7('0x65'),_0x3b7e5b);var _0x401654=ejs[_0x43e7('0x64')](_0x177a7a,{'trunks':_0x3fe23f||[]});fs['writeFileSync'](_0x43e7('0x67'),_0x401654);return respondWithRpcPromise('Reload',_0x43e7('0x2f'),{'module':_0x43e7('0x69')});}return null;})[_0x43e7('0x19')](function(_0x90667c){if(_0x90667c){return _0x184ae3;}})[_0x43e7('0x19')](respondWithResult(_0x2abca0,null))[_0x43e7('0x23')](handleError(_0x2abca0,null));};exports[_0x43e7('0x30')]=function(_0x5e8d4e,_0x109c86,_0x40257e){var _0x1aea4e;return db[_0x43e7('0x38')]['find']({'where':{'id':_0x5e8d4e['params']['id']}})['then'](handleEntityNotFound(_0x109c86,null))[_0x43e7('0x19')](removeEntity(_0x109c86,null))['then'](function(){return db[_0x43e7('0x38')][_0x43e7('0x4f')]({'raw':!![]});})[_0x43e7('0x19')](function(_0x7387f6){var _0xa75254=fs[_0x43e7('0x62')](path[_0x43e7('0x5e')](config[_0x43e7('0x5f')],_0x43e7('0x60')),_0x43e7('0x61'));var _0x3de22e=fs['readFileSync'](path[_0x43e7('0x5e')](config[_0x43e7('0x5f')],_0x43e7('0x63')),_0x43e7('0x61'));var _0x206e54=ejs['render'](_0xa75254,{'trunks':_0x7387f6});var _0x5e04ec=ejs[_0x43e7('0x64')](_0x3de22e,{'trunks':_0x7387f6});fs[_0x43e7('0x6a')]('/etc/asterisk/sip_xcally_trunks.conf',_0x206e54);fs[_0x43e7('0x6a')](_0x43e7('0x67'),_0x5e04ec);return respondWithRpcPromise('Reload','destroy',{'module':_0x43e7('0x69')});})[_0x43e7('0x23')](handleError(_0x109c86,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 4f72db0..ccbc145 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 _0x4397=['../../config/environment','./trunk.attributes','exports','Trunk','tools_trunks','lodash','../../config/logger','moment','request-promise','path'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x4397,0x11d));var _0x7439=function(_0x13ce0c,_0x3f2a0d){_0x13ce0c=_0x13ce0c-0x0;var _0x4388fb=_0x4397[_0x13ce0c];return _0x4388fb;};'use strict';var _=require(_0x7439('0x0'));var util=require('util');var logger=require(_0x7439('0x1'))('api');var moment=require(_0x7439('0x2'));var BPromise=require('bluebird');var rp=require(_0x7439('0x3'));var fs=require('fs');var path=require(_0x7439('0x4'));var rimraf=require('rimraf');var config=require(_0x7439('0x5'));var attributes=require(_0x7439('0x6'));module[_0x7439('0x7')]=function(_0xd7726f,_0x287389){return _0xd7726f['define'](_0x7439('0x8'),attributes,{'tableName':_0x7439('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x409e=['define','tools_trunks','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./trunk.attributes'];(function(_0x7185f7,_0x37065){var _0x182e45=function(_0x519e0d){while(--_0x519e0d){_0x7185f7['push'](_0x7185f7['shift']());}};_0x182e45(++_0x37065);}(_0x409e,0xf4));var _0xe409=function(_0x22074d,_0x33df85){_0x22074d=_0x22074d-0x0;var _0x3a24ce=_0x409e[_0x22074d];return _0x3a24ce;};'use strict';var _=require(_0xe409('0x0'));var util=require(_0xe409('0x1'));var logger=require(_0xe409('0x2'))('api');var moment=require(_0xe409('0x3'));var BPromise=require(_0xe409('0x4'));var rp=require(_0xe409('0x5'));var fs=require('fs');var path=require(_0xe409('0x6'));var rimraf=require(_0xe409('0x7'));var config=require('../../config/environment');var attributes=require(_0xe409('0x8'));module['exports']=function(_0x18457d,_0x108fed){return _0x18457d[_0xe409('0x9')]('Trunk',attributes,{'tableName':_0xe409('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 db5e931..0d82371 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 _0x87d0=['GetTrunk','Trunk','findAll','raw','options','where','attributes','limit','include','map','model','debug','stringify','catch','ShowTrunk','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','Trunk,\x20%s,\x20%s,\x20%s','error','code','Trunk,\x20%s,\x20%s','message','result'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x87d0,0x113));var _0x087d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x87d0[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x087d('0x0'));var util=require(_0x087d('0x1'));var moment=require(_0x087d('0x2'));var BPromise=require(_0x087d('0x3'));var rs=require(_0x087d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x087d('0x5'))['db'];var utils=require(_0x087d('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x087d('0x7'));var jayson=require(_0x087d('0x8'));var client=jayson[_0x087d('0x9')][_0x087d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x33d051,_0x4355a9,_0x444b30){return new BPromise(function(_0x1023c7,_0x46c5dd){return client[_0x087d('0xb')](_0x33d051,_0x444b30)[_0x087d('0xc')](function(_0x4ca5eb){logger[_0x087d('0xd')]('Trunk,\x20%s,\x20%s',_0x4355a9,_0x087d('0xe'));logger['debug'](_0x087d('0xf'),_0x4355a9,_0x087d('0xe'),JSON['stringify'](_0x4ca5eb));if(_0x4ca5eb[_0x087d('0x10')]){if(_0x4ca5eb[_0x087d('0x10')][_0x087d('0x11')]===0x1f4){logger[_0x087d('0x10')](_0x087d('0x12'),_0x4355a9,_0x4ca5eb[_0x087d('0x10')][_0x087d('0x13')]);return _0x46c5dd(_0x4ca5eb['error']['message']);}logger['error'](_0x087d('0x12'),_0x4355a9,_0x4ca5eb[_0x087d('0x10')]['message']);return _0x1023c7(_0x4ca5eb[_0x087d('0x10')]['message']);}else{logger[_0x087d('0xd')](_0x087d('0x12'),_0x4355a9,_0x087d('0xe'));_0x1023c7(_0x4ca5eb[_0x087d('0x14')][_0x087d('0x13')]);}})['catch'](function(_0x3c213e){logger[_0x087d('0x10')](_0x087d('0x12'),_0x4355a9,_0x3c213e);_0x46c5dd(_0x3c213e);});});}exports[_0x087d('0x15')]=function(_0x4bfb86){var _0x52170d=this;return new Promise(function(_0x33c1ad,_0x32e246){return db[_0x087d('0x16')][_0x087d('0x17')]({'raw':_0x4bfb86['options']?_0x4bfb86['options'][_0x087d('0x18')]===undefined?!![]:![]:!![],'where':_0x4bfb86['options']?_0x4bfb86[_0x087d('0x19')][_0x087d('0x1a')]||null:null,'attributes':_0x4bfb86[_0x087d('0x19')]?_0x4bfb86[_0x087d('0x19')][_0x087d('0x1b')]||null:null,'limit':_0x4bfb86[_0x087d('0x19')]?_0x4bfb86[_0x087d('0x19')][_0x087d('0x1c')]||null:null,'include':_0x4bfb86[_0x087d('0x19')]?_0x4bfb86[_0x087d('0x19')][_0x087d('0x1d')]?_[_0x087d('0x1e')](_0x4bfb86[_0x087d('0x19')][_0x087d('0x1d')],function(_0x3b7347){return{'model':db[_0x3b7347[_0x087d('0x1f')]],'as':_0x3b7347['as'],'attributes':_0x3b7347[_0x087d('0x1b')],'include':_0x3b7347[_0x087d('0x1d')]?_[_0x087d('0x1e')](_0x3b7347[_0x087d('0x1d')],function(_0x1a3fc2){return{'model':db[_0x1a3fc2[_0x087d('0x1f')]],'as':_0x1a3fc2['as'],'attributes':_0x1a3fc2[_0x087d('0x1b')],'include':_0x1a3fc2['include']?_[_0x087d('0x1e')](_0x1a3fc2[_0x087d('0x1d')],function(_0x24451e){return{'model':db[_0x24451e['model']],'as':_0x24451e['as'],'attributes':_0x24451e['attributes']};}):[]};}):[]};}):[]:[]})[_0x087d('0xc')](function(_0x2f6e46){logger['info'](_0x087d('0x15'),_0x4bfb86);logger[_0x087d('0x20')](_0x087d('0x15'),_0x4bfb86,JSON[_0x087d('0x21')](_0x2f6e46));_0x33c1ad(_0x2f6e46);})[_0x087d('0x22')](function(_0x42e1b3){logger['error'](_0x087d('0x15'),_0x42e1b3[_0x087d('0x13')],_0x4bfb86);_0x32e246(_0x52170d[_0x087d('0x10')](0x1f4,_0x42e1b3['message']));});});};exports[_0x087d('0x23')]=function(_0x47e948){var _0x5224c2=this;return new Promise(function(_0x44757d,_0xb8e64b){return db[_0x087d('0x16')][_0x087d('0x24')]({'raw':_0x47e948[_0x087d('0x19')]?_0x47e948[_0x087d('0x19')][_0x087d('0x18')]===undefined?!![]:![]:!![],'where':_0x47e948[_0x087d('0x19')]?_0x47e948['options'][_0x087d('0x1a')]||null:null,'attributes':_0x47e948[_0x087d('0x19')]?_0x47e948[_0x087d('0x19')][_0x087d('0x1b')]||null:null,'include':_0x47e948[_0x087d('0x19')]?_0x47e948[_0x087d('0x19')][_0x087d('0x1d')]?_['map'](_0x47e948[_0x087d('0x19')][_0x087d('0x1d')],function(_0x537025){return{'model':db[_0x537025[_0x087d('0x1f')]],'as':_0x537025['as'],'attributes':_0x537025[_0x087d('0x1b')],'include':_0x537025['include']?_[_0x087d('0x1e')](_0x537025['include'],function(_0x496246){return{'model':db[_0x496246[_0x087d('0x1f')]],'as':_0x496246['as'],'attributes':_0x496246[_0x087d('0x1b')],'include':_0x496246[_0x087d('0x1d')]?_[_0x087d('0x1e')](_0x496246['include'],function(_0x540504){return{'model':db[_0x540504[_0x087d('0x1f')]],'as':_0x540504['as'],'attributes':_0x540504[_0x087d('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x087d('0xc')](function(_0x248d4e){logger['info'](_0x087d('0x23'),_0x47e948);logger[_0x087d('0x20')](_0x087d('0x23'),_0x47e948,JSON[_0x087d('0x21')](_0x248d4e));_0x44757d(_0x248d4e);})[_0x087d('0x22')](function(_0x2318cf){logger['error'](_0x087d('0x23'),_0x2318cf[_0x087d('0x13')],_0x47e948);_0xb8e64b(_0x5224c2[_0x087d('0x10')](0x1f4,_0x2318cf[_0x087d('0x13')]));});});}; \ No newline at end of file +var _0x11f6=['where','attributes','include','map','model','debug','find','raw','ShowTrunk','lodash','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetTrunk','Trunk','findAll','options'];(function(_0x4c93dc,_0x49f8e7){var _0x20e569=function(_0x4f1b1b){while(--_0x4f1b1b){_0x4c93dc['push'](_0x4c93dc['shift']());}};_0x20e569(++_0x49f8e7);}(_0x11f6,0x15d));var _0x611f=function(_0x5a76cb,_0x450caf){_0x5a76cb=_0x5a76cb-0x0;var _0x572cb4=_0x11f6[_0x5a76cb];return _0x572cb4;};'use strict';var _=require(_0x611f('0x0'));var util=require('util');var moment=require(_0x611f('0x1'));var BPromise=require(_0x611f('0x2'));var rs=require(_0x611f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x611f('0x4'));var logger=require('../../config/logger')(_0x611f('0x5'));var config=require(_0x611f('0x6'));var jayson=require(_0x611f('0x7'));var client=jayson[_0x611f('0x8')][_0x611f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x32a25f,_0x17518a,_0x1c92fd){return new BPromise(function(_0x2380ff,_0x3be90b){return client[_0x611f('0xa')](_0x32a25f,_0x1c92fd)[_0x611f('0xb')](function(_0x13f3a2){logger[_0x611f('0xc')](_0x611f('0xd'),_0x17518a,_0x611f('0xe'));logger['debug']('Trunk,\x20%s,\x20%s,\x20%s',_0x17518a,_0x611f('0xe'),JSON[_0x611f('0xf')](_0x13f3a2));if(_0x13f3a2[_0x611f('0x10')]){if(_0x13f3a2['error'][_0x611f('0x11')]===0x1f4){logger['error'](_0x611f('0xd'),_0x17518a,_0x13f3a2[_0x611f('0x10')][_0x611f('0x12')]);return _0x3be90b(_0x13f3a2['error'][_0x611f('0x12')]);}logger[_0x611f('0x10')](_0x611f('0xd'),_0x17518a,_0x13f3a2[_0x611f('0x10')][_0x611f('0x12')]);return _0x2380ff(_0x13f3a2[_0x611f('0x10')][_0x611f('0x12')]);}else{logger['info'](_0x611f('0xd'),_0x17518a,'request\x20sent');_0x2380ff(_0x13f3a2[_0x611f('0x13')][_0x611f('0x12')]);}})[_0x611f('0x14')](function(_0x3d6d08){logger[_0x611f('0x10')](_0x611f('0xd'),_0x17518a,_0x3d6d08);_0x3be90b(_0x3d6d08);});});}exports[_0x611f('0x15')]=function(_0x401293){var _0x1a760e=this;return new Promise(function(_0x41563d,_0x391618){return db[_0x611f('0x16')][_0x611f('0x17')]({'raw':_0x401293['options']?_0x401293[_0x611f('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x401293['options']?_0x401293[_0x611f('0x18')][_0x611f('0x19')]||null:null,'attributes':_0x401293[_0x611f('0x18')]?_0x401293[_0x611f('0x18')][_0x611f('0x1a')]||null:null,'limit':_0x401293[_0x611f('0x18')]?_0x401293['options']['limit']||null:null,'include':_0x401293[_0x611f('0x18')]?_0x401293[_0x611f('0x18')][_0x611f('0x1b')]?_[_0x611f('0x1c')](_0x401293[_0x611f('0x18')][_0x611f('0x1b')],function(_0x23eadc){return{'model':db[_0x23eadc[_0x611f('0x1d')]],'as':_0x23eadc['as'],'attributes':_0x23eadc[_0x611f('0x1a')],'include':_0x23eadc[_0x611f('0x1b')]?_['map'](_0x23eadc[_0x611f('0x1b')],function(_0x5db3b5){return{'model':db[_0x5db3b5[_0x611f('0x1d')]],'as':_0x5db3b5['as'],'attributes':_0x5db3b5[_0x611f('0x1a')],'include':_0x5db3b5[_0x611f('0x1b')]?_[_0x611f('0x1c')](_0x5db3b5[_0x611f('0x1b')],function(_0x3766f4){return{'model':db[_0x3766f4[_0x611f('0x1d')]],'as':_0x3766f4['as'],'attributes':_0x3766f4[_0x611f('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x577517){logger[_0x611f('0xc')](_0x611f('0x15'),_0x401293);logger[_0x611f('0x1e')](_0x611f('0x15'),_0x401293,JSON[_0x611f('0xf')](_0x577517));_0x41563d(_0x577517);})['catch'](function(_0x2dc9f2){logger[_0x611f('0x10')](_0x611f('0x15'),_0x2dc9f2[_0x611f('0x12')],_0x401293);_0x391618(_0x1a760e['error'](0x1f4,_0x2dc9f2[_0x611f('0x12')]));});});};exports['ShowTrunk']=function(_0x25e364){var _0x193fdc=this;return new Promise(function(_0x21dfe1,_0x3b1e8f){return db[_0x611f('0x16')][_0x611f('0x1f')]({'raw':_0x25e364['options']?_0x25e364[_0x611f('0x18')][_0x611f('0x20')]===undefined?!![]:![]:!![],'where':_0x25e364[_0x611f('0x18')]?_0x25e364['options'][_0x611f('0x19')]||null:null,'attributes':_0x25e364[_0x611f('0x18')]?_0x25e364[_0x611f('0x18')][_0x611f('0x1a')]||null:null,'include':_0x25e364[_0x611f('0x18')]?_0x25e364[_0x611f('0x18')][_0x611f('0x1b')]?_[_0x611f('0x1c')](_0x25e364[_0x611f('0x18')]['include'],function(_0x4d6fb6){return{'model':db[_0x4d6fb6[_0x611f('0x1d')]],'as':_0x4d6fb6['as'],'attributes':_0x4d6fb6['attributes'],'include':_0x4d6fb6[_0x611f('0x1b')]?_[_0x611f('0x1c')](_0x4d6fb6['include'],function(_0x5a627d){return{'model':db[_0x5a627d['model']],'as':_0x5a627d['as'],'attributes':_0x5a627d[_0x611f('0x1a')],'include':_0x5a627d['include']?_[_0x611f('0x1c')](_0x5a627d[_0x611f('0x1b')],function(_0x523abd){return{'model':db[_0x523abd['model']],'as':_0x523abd['as'],'attributes':_0x523abd[_0x611f('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x448f34){logger[_0x611f('0xc')](_0x611f('0x21'),_0x25e364);logger['debug'](_0x611f('0x21'),_0x25e364,JSON[_0x611f('0xf')](_0x448f34));_0x21dfe1(_0x448f34);})[_0x611f('0x14')](function(_0x278513){logger[_0x611f('0x10')](_0x611f('0x21'),_0x278513['message'],_0x25e364);_0x3b1e8f(_0x193fdc[_0x611f('0x10')](0x1f4,_0x278513[_0x611f('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 1ddc113..7215096 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 _0x758e=['/:id/contacts','/:id/queues','getQueues','/:id/groups','getRecordings','/:id/screen_recordings','getScreenRecordings','getChatInteractions','/:id/openchannel/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','getOpenchannelAccounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','getApiKey','addContacts','post','/create_many','bulkCreate','diskStorage','root','server/files/images/','format','%s-%s','now','originalname','single','file','addAvatar','/:id/login','login','/:id/logout','logout','/:id/pause','pause','unpause','addTeams','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','addSmsInteractions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','/:id/openchannel_accounts','addOpenchannelAccounts','addWhatsappAccounts','/:id/api_key','put','update','/:id/password','delete','removeTeams','destroy','removeChatInteractions','removeFaxInteractions','/:id/sms_interactions','removeSmsInteractions','/:id/openchannel_interactions','removeOpenchannelInteractions','removeWhatsappInteractions','removeMailAccounts','removeOpenchannelAccounts','/:id/sms_accounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','removeApiKey','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./user.controller','isAuthenticated','index','get','/describe','describe','whoami','/presence','/:id','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs'];(function(_0x5d15a4,_0x2e50e3){var _0x504b50=function(_0x45cf6c){while(--_0x45cf6c){_0x5d15a4['push'](_0x5d15a4['shift']());}};_0x504b50(++_0x2e50e3);}(_0x758e,0x143));var _0xe758=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x758e[_0x1ac595];return _0x455fff;};'use strict';var multer=require(_0xe758('0x0'));var util=require(_0xe758('0x1'));var path=require(_0xe758('0x2'));var timeout=require(_0xe758('0x3'));var express=require(_0xe758('0x4'));var router=express[_0xe758('0x5')]();var fs_extra=require(_0xe758('0x6'));var auth=require(_0xe758('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xe758('0x8'));var controller=require(_0xe758('0x9'));router['get']('/',auth[_0xe758('0xa')](),controller[_0xe758('0xb')]);router[_0xe758('0xc')](_0xe758('0xd'),auth[_0xe758('0xa')](),controller[_0xe758('0xe')]);router[_0xe758('0xc')]('/whoami',auth[_0xe758('0xa')](),controller[_0xe758('0xf')]);router[_0xe758('0xc')](_0xe758('0x10'),auth['isAuthenticated'](),controller['getPresence']);router[_0xe758('0xc')](_0xe758('0x11'),auth[_0xe758('0xa')](),controller['show']);router['get'](_0xe758('0x12'),controller[_0xe758('0x13')]);router[_0xe758('0xc')](_0xe758('0x14'),auth[_0xe758('0xa')](),controller[_0xe758('0x15')]);router[_0xe758('0xc')](_0xe758('0x16'),auth[_0xe758('0xa')](),controller['getContacts']);router[_0xe758('0xc')](_0xe758('0x17'),auth[_0xe758('0xa')](),controller[_0xe758('0x18')]);router[_0xe758('0xc')]('/:id/queues_rt',auth['isAuthenticated'](),controller['getVoiceQueuesRt']);router[_0xe758('0xc')](_0xe758('0x19'),auth[_0xe758('0xa')](),controller['getGroups']);router['get']('/:id/recordings',auth['isAuthenticated'](),controller[_0xe758('0x1a')]);router['get'](_0xe758('0x1b'),auth[_0xe758('0xa')](),controller[_0xe758('0x1c')]);router['get']('/:id/chat/interactions',auth[_0xe758('0xa')](),controller[_0xe758('0x1d')]);router[_0xe758('0xc')](_0xe758('0x1e'),auth[_0xe758('0xa')](),controller['getOpenchannelInteractions']);router[_0xe758('0xc')]('/:id/mail/interactions',auth[_0xe758('0xa')](),controller[_0xe758('0x1f')]);router['get'](_0xe758('0x20'),auth['isAuthenticated'](),controller[_0xe758('0x21')]);router[_0xe758('0xc')]('/:id/fax/interactions',auth['isAuthenticated'](),controller[_0xe758('0x22')]);router[_0xe758('0xc')](_0xe758('0x23'),auth['isAuthenticated'](),controller[_0xe758('0x24')]);router[_0xe758('0xc')](_0xe758('0x25'),auth[_0xe758('0xa')](),controller[_0xe758('0x26')]);router[_0xe758('0xc')]('/:id/lists',auth[_0xe758('0xa')](),controller['getLists']);router[_0xe758('0xc')](_0xe758('0x27'),auth[_0xe758('0xa')](),controller[_0xe758('0x28')]);router[_0xe758('0xc')](_0xe758('0x29'),auth['isAuthenticated'](),controller[_0xe758('0x2a')]);router['get'](_0xe758('0x2b'),auth[_0xe758('0xa')](),controller[_0xe758('0x2c')]);router[_0xe758('0xc')](_0xe758('0x2d'),auth[_0xe758('0xa')](),controller[_0xe758('0x2e')]);router[_0xe758('0xc')]('/:id/openchannel_accounts',auth['isAuthenticated'](),controller[_0xe758('0x2f')]);router[_0xe758('0xc')]('/:id/sms_accounts',auth[_0xe758('0xa')](),controller[_0xe758('0x30')]);router[_0xe758('0xc')](_0xe758('0x31'),auth[_0xe758('0xa')](),controller[_0xe758('0x32')]);router[_0xe758('0xc')](_0xe758('0x33'),auth[_0xe758('0xa')](),controller[_0xe758('0x34')]);router[_0xe758('0xc')](_0xe758('0x35'),auth[_0xe758('0xa')](),controller[_0xe758('0x36')]);router[_0xe758('0xc')](_0xe758('0x37'),auth[_0xe758('0xa')](),controller['getScheduledCalls']);router['get']('/:id/api_key',auth['isAuthenticated'](),controller[_0xe758('0x38')]);router['post'](_0xe758('0x16'),auth[_0xe758('0xa')](),controller[_0xe758('0x39')]);router[_0xe758('0x3a')]('/',auth['isAuthenticated'](),controller['create']);router[_0xe758('0x3a')](_0xe758('0x3b'),auth[_0xe758('0xa')](),controller[_0xe758('0x3c')]);router['post'](_0xe758('0x17'),auth[_0xe758('0xa')](),controller['addQueues']);var upload=multer({'storage':multer[_0xe758('0x3d')]({'destination':function(_0x48ba80,_0x20c228,_0xb0e209){_0xb0e209(null,path['join'](config[_0xe758('0x3e')],_0xe758('0x3f')));},'filename':function(_0x351999,_0x8b5c,_0xc5f966){_0xc5f966(null,util[_0xe758('0x40')](_0xe758('0x41'),Date[_0xe758('0x42')](),_0x8b5c[_0xe758('0x43')]));}})});router['post'](_0xe758('0x12'),upload[_0xe758('0x44')](_0xe758('0x45')),controller[_0xe758('0x46')]);router[_0xe758('0x3a')](_0xe758('0x47'),auth[_0xe758('0xa')](),controller[_0xe758('0x48')]);router[_0xe758('0x3a')](_0xe758('0x49'),auth[_0xe758('0xa')](),controller[_0xe758('0x4a')]);router[_0xe758('0x3a')](_0xe758('0x4b'),auth['isAuthenticated'](),controller[_0xe758('0x4c')]);router['post']('/:id/unpause',auth[_0xe758('0xa')](),controller[_0xe758('0x4d')]);router[_0xe758('0x3a')](_0xe758('0x25'),auth[_0xe758('0xa')](),controller[_0xe758('0x4e')]);router['post']('/:id/chat_interactions',auth['isAuthenticated'](),controller[_0xe758('0x4f')]);router[_0xe758('0x3a')](_0xe758('0x50'),auth[_0xe758('0xa')](),controller[_0xe758('0x51')]);router[_0xe758('0x3a')](_0xe758('0x52'),auth[_0xe758('0xa')](),controller[_0xe758('0x53')]);router[_0xe758('0x3a')]('/:id/sms_interactions',auth[_0xe758('0xa')](),controller[_0xe758('0x54')]);router[_0xe758('0x3a')]('/:id/openchannel_interactions',auth[_0xe758('0xa')](),controller[_0xe758('0x55')]);router['post'](_0xe758('0x56'),auth[_0xe758('0xa')](),controller[_0xe758('0x57')]);router[_0xe758('0x3a')]('/:id/fax_accounts',auth['isAuthenticated'](),controller[_0xe758('0x58')]);router[_0xe758('0x3a')]('/:id/mail_accounts',auth['isAuthenticated'](),controller[_0xe758('0x59')]);router['post'](_0xe758('0x5a'),auth[_0xe758('0xa')](),controller[_0xe758('0x5b')]);router[_0xe758('0x3a')]('/:id/sms_accounts',auth['isAuthenticated'](),controller['addSmsAccounts']);router['post'](_0xe758('0x31'),auth[_0xe758('0xa')](),controller['addChatWebsites']);router[_0xe758('0x3a')](_0xe758('0x33'),auth[_0xe758('0xa')](),controller[_0xe758('0x5c')]);router[_0xe758('0x3a')](_0xe758('0x35'),auth[_0xe758('0xa')](),controller['addSquareProjects']);router[_0xe758('0x3a')](_0xe758('0x5d'),auth[_0xe758('0xa')](),controller['createApiKey']);router[_0xe758('0x5e')]('/:id',auth[_0xe758('0xa')](),controller[_0xe758('0x5f')]);router[_0xe758('0x5e')](_0xe758('0x60'),auth['isAuthenticated'](),controller['changePassword']);router[_0xe758('0x61')](_0xe758('0x17'),auth[_0xe758('0xa')](),controller['removeQueues']);router[_0xe758('0x61')](_0xe758('0x25'),auth[_0xe758('0xa')](),controller[_0xe758('0x62')]);router[_0xe758('0x61')](_0xe758('0x11'),auth['isAuthenticated'](),controller[_0xe758('0x63')]);router[_0xe758('0x61')]('/:id/chat_interactions',auth[_0xe758('0xa')](),controller[_0xe758('0x64')]);router[_0xe758('0x61')](_0xe758('0x50'),auth[_0xe758('0xa')](),controller['removeMailInteractions']);router[_0xe758('0x61')](_0xe758('0x52'),auth[_0xe758('0xa')](),controller[_0xe758('0x65')]);router[_0xe758('0x61')](_0xe758('0x66'),auth['isAuthenticated'](),controller[_0xe758('0x67')]);router[_0xe758('0x61')](_0xe758('0x68'),auth[_0xe758('0xa')](),controller[_0xe758('0x69')]);router['delete'](_0xe758('0x56'),auth[_0xe758('0xa')](),controller[_0xe758('0x6a')]);router[_0xe758('0x61')](_0xe758('0x2b'),auth[_0xe758('0xa')](),controller['removeFaxAccounts']);router[_0xe758('0x61')](_0xe758('0x2d'),auth[_0xe758('0xa')](),controller[_0xe758('0x6b')]);router['delete']('/:id/openchannel_accounts',auth['isAuthenticated'](),controller[_0xe758('0x6c')]);router[_0xe758('0x61')](_0xe758('0x6d'),auth['isAuthenticated'](),controller[_0xe758('0x6e')]);router[_0xe758('0x61')](_0xe758('0x31'),auth[_0xe758('0xa')](),controller[_0xe758('0x6f')]);router[_0xe758('0x61')](_0xe758('0x33'),auth['isAuthenticated'](),controller[_0xe758('0x70')]);router[_0xe758('0x61')](_0xe758('0x35'),auth['isAuthenticated'](),controller[_0xe758('0x71')]);router[_0xe758('0x61')](_0xe758('0x5d'),auth[_0xe758('0xa')](),controller[_0xe758('0x72')]);module['exports']=router; \ No newline at end of file +var _0x4a58=['/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','/:id/chat_websites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/square_projects','getSquareProjects','getScheduledCalls','/:id/api_key','getApiKey','post','addContacts','create','/create_many','bulkCreate','addQueues','diskStorage','join','root','server/files/images/','format','%s-%s','now','originalname','/:id/avatar','file','addAvatar','/:id/login','logout','/:id/pause','pause','/:id/unpause','/:id/teams','addChatInteractions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','createApiKey','put','update','/:id/password','changePassword','delete','removeQueues','removeTeams','destroy','removeChatInteractions','/:id/mail_interactions','removeMailInteractions','removeSmsInteractions','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeSquareProjects','removeApiKey','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','index','/describe','describe','/whoami','whoami','/presence','getPresence','/:id','show','/:id/open_tabs','/:id/contacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','getGroups','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','/:id/mail/interactions','getMailInteractions','getSmsInteractions','getFaxInteractions','/:id/whatsapp/interactions','getTeams','/:id/lists','getLists','/:id/agents','getVoicePrefixes'];(function(_0x1ccb1a,_0x3e787e){var _0x8956da=function(_0x3350ed){while(--_0x3350ed){_0x1ccb1a['push'](_0x1ccb1a['shift']());}};_0x8956da(++_0x3e787e);}(_0x4a58,0xb7));var _0x84a5=function(_0x32a2fc,_0x1be7d5){_0x32a2fc=_0x32a2fc-0x0;var _0x3574c5=_0x4a58[_0x32a2fc];return _0x3574c5;};'use strict';var multer=require(_0x84a5('0x0'));var util=require(_0x84a5('0x1'));var path=require(_0x84a5('0x2'));var timeout=require(_0x84a5('0x3'));var express=require(_0x84a5('0x4'));var router=express['Router']();var fs_extra=require(_0x84a5('0x5'));var auth=require(_0x84a5('0x6'));var interaction=require(_0x84a5('0x7'));var config=require(_0x84a5('0x8'));var controller=require(_0x84a5('0x9'));router[_0x84a5('0xa')]('/',auth[_0x84a5('0xb')](),controller[_0x84a5('0xc')]);router['get'](_0x84a5('0xd'),auth[_0x84a5('0xb')](),controller[_0x84a5('0xe')]);router[_0x84a5('0xa')](_0x84a5('0xf'),auth[_0x84a5('0xb')](),controller[_0x84a5('0x10')]);router[_0x84a5('0xa')](_0x84a5('0x11'),auth[_0x84a5('0xb')](),controller[_0x84a5('0x12')]);router[_0x84a5('0xa')](_0x84a5('0x13'),auth[_0x84a5('0xb')](),controller[_0x84a5('0x14')]);router['get']('/:id/avatar',controller['getAvatar']);router[_0x84a5('0xa')](_0x84a5('0x15'),auth[_0x84a5('0xb')](),controller['getOpenTabs']);router[_0x84a5('0xa')](_0x84a5('0x16'),auth[_0x84a5('0xb')](),controller['getContacts']);router[_0x84a5('0xa')](_0x84a5('0x17'),auth[_0x84a5('0xb')](),controller[_0x84a5('0x18')]);router[_0x84a5('0xa')](_0x84a5('0x19'),auth[_0x84a5('0xb')](),controller[_0x84a5('0x1a')]);router[_0x84a5('0xa')]('/:id/groups',auth[_0x84a5('0xb')](),controller[_0x84a5('0x1b')]);router[_0x84a5('0xa')]('/:id/recordings',auth[_0x84a5('0xb')](),controller['getRecordings']);router[_0x84a5('0xa')](_0x84a5('0x1c'),auth[_0x84a5('0xb')](),controller[_0x84a5('0x1d')]);router[_0x84a5('0xa')](_0x84a5('0x1e'),auth[_0x84a5('0xb')](),controller[_0x84a5('0x1f')]);router[_0x84a5('0xa')](_0x84a5('0x20'),auth['isAuthenticated'](),controller['getOpenchannelInteractions']);router[_0x84a5('0xa')](_0x84a5('0x21'),auth['isAuthenticated'](),controller[_0x84a5('0x22')]);router[_0x84a5('0xa')]('/:id/sms/interactions',auth[_0x84a5('0xb')](),controller[_0x84a5('0x23')]);router[_0x84a5('0xa')]('/:id/fax/interactions',auth[_0x84a5('0xb')](),controller[_0x84a5('0x24')]);router[_0x84a5('0xa')](_0x84a5('0x25'),auth[_0x84a5('0xb')](),controller['getWhatsappInteractions']);router[_0x84a5('0xa')]('/:id/teams',auth['isAuthenticated'](),controller[_0x84a5('0x26')]);router['get'](_0x84a5('0x27'),auth[_0x84a5('0xb')](),controller[_0x84a5('0x28')]);router['get'](_0x84a5('0x29'),auth[_0x84a5('0xb')](),controller['getAgents']);router['get']('/:id/prefixes',auth[_0x84a5('0xb')](),controller[_0x84a5('0x2a')]);router[_0x84a5('0xa')](_0x84a5('0x2b'),auth[_0x84a5('0xb')](),controller[_0x84a5('0x2c')]);router[_0x84a5('0xa')](_0x84a5('0x2d'),auth[_0x84a5('0xb')](),controller[_0x84a5('0x2e')]);router[_0x84a5('0xa')](_0x84a5('0x2f'),auth['isAuthenticated'](),controller[_0x84a5('0x30')]);router[_0x84a5('0xa')](_0x84a5('0x31'),auth[_0x84a5('0xb')](),controller['getSmsAccounts']);router[_0x84a5('0xa')](_0x84a5('0x32'),auth[_0x84a5('0xb')](),controller['getChatWebsites']);router[_0x84a5('0xa')](_0x84a5('0x33'),auth[_0x84a5('0xb')](),controller[_0x84a5('0x34')]);router[_0x84a5('0xa')](_0x84a5('0x35'),auth['isAuthenticated'](),controller[_0x84a5('0x36')]);router[_0x84a5('0xa')]('/:id/scheduled_calls',auth[_0x84a5('0xb')](),controller[_0x84a5('0x37')]);router[_0x84a5('0xa')](_0x84a5('0x38'),auth[_0x84a5('0xb')](),controller[_0x84a5('0x39')]);router[_0x84a5('0x3a')](_0x84a5('0x16'),auth['isAuthenticated'](),controller[_0x84a5('0x3b')]);router[_0x84a5('0x3a')]('/',auth['isAuthenticated'](),controller[_0x84a5('0x3c')]);router[_0x84a5('0x3a')](_0x84a5('0x3d'),auth[_0x84a5('0xb')](),controller[_0x84a5('0x3e')]);router[_0x84a5('0x3a')](_0x84a5('0x17'),auth[_0x84a5('0xb')](),controller[_0x84a5('0x3f')]);var upload=multer({'storage':multer[_0x84a5('0x40')]({'destination':function(_0x183c6a,_0x231e4d,_0x5f5cd1){_0x5f5cd1(null,path[_0x84a5('0x41')](config[_0x84a5('0x42')],_0x84a5('0x43')));},'filename':function(_0x1ca10f,_0x38e424,_0x13b38c){_0x13b38c(null,util[_0x84a5('0x44')](_0x84a5('0x45'),Date[_0x84a5('0x46')](),_0x38e424[_0x84a5('0x47')]));}})});router[_0x84a5('0x3a')](_0x84a5('0x48'),upload['single'](_0x84a5('0x49')),controller[_0x84a5('0x4a')]);router[_0x84a5('0x3a')](_0x84a5('0x4b'),auth[_0x84a5('0xb')](),controller['login']);router['post']('/:id/logout',auth['isAuthenticated'](),controller[_0x84a5('0x4c')]);router[_0x84a5('0x3a')](_0x84a5('0x4d'),auth[_0x84a5('0xb')](),controller[_0x84a5('0x4e')]);router[_0x84a5('0x3a')](_0x84a5('0x4f'),auth[_0x84a5('0xb')](),controller['unpause']);router[_0x84a5('0x3a')](_0x84a5('0x50'),auth[_0x84a5('0xb')](),controller['addTeams']);router[_0x84a5('0x3a')]('/:id/chat_interactions',auth[_0x84a5('0xb')](),controller[_0x84a5('0x51')]);router[_0x84a5('0x3a')]('/:id/mail_interactions',auth[_0x84a5('0xb')](),controller[_0x84a5('0x52')]);router['post'](_0x84a5('0x53'),auth[_0x84a5('0xb')](),controller[_0x84a5('0x54')]);router[_0x84a5('0x3a')]('/:id/sms_interactions',auth[_0x84a5('0xb')](),controller[_0x84a5('0x55')]);router[_0x84a5('0x3a')](_0x84a5('0x56'),auth[_0x84a5('0xb')](),controller[_0x84a5('0x57')]);router['post'](_0x84a5('0x58'),auth[_0x84a5('0xb')](),controller['addWhatsappInteractions']);router[_0x84a5('0x3a')](_0x84a5('0x2b'),auth[_0x84a5('0xb')](),controller[_0x84a5('0x59')]);router[_0x84a5('0x3a')](_0x84a5('0x2d'),auth[_0x84a5('0xb')](),controller[_0x84a5('0x5a')]);router[_0x84a5('0x3a')](_0x84a5('0x2f'),auth['isAuthenticated'](),controller[_0x84a5('0x5b')]);router[_0x84a5('0x3a')](_0x84a5('0x31'),auth['isAuthenticated'](),controller[_0x84a5('0x5c')]);router[_0x84a5('0x3a')](_0x84a5('0x32'),auth[_0x84a5('0xb')](),controller[_0x84a5('0x5d')]);router[_0x84a5('0x3a')](_0x84a5('0x33'),auth[_0x84a5('0xb')](),controller['addWhatsappAccounts']);router[_0x84a5('0x3a')](_0x84a5('0x35'),auth[_0x84a5('0xb')](),controller['addSquareProjects']);router[_0x84a5('0x3a')](_0x84a5('0x38'),auth[_0x84a5('0xb')](),controller[_0x84a5('0x5e')]);router[_0x84a5('0x5f')](_0x84a5('0x13'),auth['isAuthenticated'](),controller[_0x84a5('0x60')]);router[_0x84a5('0x5f')](_0x84a5('0x61'),auth[_0x84a5('0xb')](),controller[_0x84a5('0x62')]);router[_0x84a5('0x63')](_0x84a5('0x17'),auth['isAuthenticated'](),controller[_0x84a5('0x64')]);router['delete'](_0x84a5('0x50'),auth[_0x84a5('0xb')](),controller[_0x84a5('0x65')]);router[_0x84a5('0x63')]('/:id',auth[_0x84a5('0xb')](),controller[_0x84a5('0x66')]);router[_0x84a5('0x63')]('/:id/chat_interactions',auth[_0x84a5('0xb')](),controller[_0x84a5('0x67')]);router['delete'](_0x84a5('0x68'),auth[_0x84a5('0xb')](),controller[_0x84a5('0x69')]);router[_0x84a5('0x63')](_0x84a5('0x53'),auth[_0x84a5('0xb')](),controller['removeFaxInteractions']);router[_0x84a5('0x63')]('/:id/sms_interactions',auth['isAuthenticated'](),controller[_0x84a5('0x6a')]);router[_0x84a5('0x63')](_0x84a5('0x56'),auth[_0x84a5('0xb')](),controller['removeOpenchannelInteractions']);router[_0x84a5('0x63')](_0x84a5('0x58'),auth[_0x84a5('0xb')](),controller['removeWhatsappInteractions']);router['delete'](_0x84a5('0x2b'),auth[_0x84a5('0xb')](),controller['removeFaxAccounts']);router['delete'](_0x84a5('0x2d'),auth[_0x84a5('0xb')](),controller[_0x84a5('0x6b')]);router[_0x84a5('0x63')](_0x84a5('0x2f'),auth[_0x84a5('0xb')](),controller[_0x84a5('0x6c')]);router['delete'](_0x84a5('0x31'),auth[_0x84a5('0xb')](),controller[_0x84a5('0x6d')]);router[_0x84a5('0x63')](_0x84a5('0x32'),auth[_0x84a5('0xb')](),controller[_0x84a5('0x6e')]);router['delete'](_0x84a5('0x33'),auth[_0x84a5('0xb')](),controller['removeWhatsappAccounts']);router[_0x84a5('0x63')](_0x84a5('0x35'),auth[_0x84a5('0xb')](),controller[_0x84a5('0x6f')]);router['delete'](_0x84a5('0x38'),auth[_0x84a5('0xb')](),controller[_0x84a5('0x70')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index f25ca1c..cae6838 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 _0x277d=['icesupport','dtlsenable','dtlsverify','encryption','dtlssetup','dtlscertfile','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','false','screenrecording','blockedAt','loginAttempts','UNSIGNED','sequelize','util','lodash','name','defaultuser','The\x20name\x20of\x20the\x20user','STRING','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','ENUM','admin','user','agent','telephone','setDataValue','accountcode','DATE','BOOLEAN','DEFAULT\x20PAUSE','INTEGER','dynamic','peer','friend','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','join','transport','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','inband','auto','yes','nonat','update','nat','split','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','never','accept','refuse','originate','uac','uas','fingerprint','certificate','active','passive','actpass','update,nonat','TEXT','isArray','wss','udp','avpf','force_avp'];(function(_0x52e363,_0x48062a){var _0x3fc2b5=function(_0x1b0cf9){while(--_0x1b0cf9){_0x52e363['push'](_0x52e363['shift']());}};_0x3fc2b5(++_0x48062a);}(_0x277d,0x6a));var _0xd277=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x277d[_0x4a9fb1];return _0x348672;};'use strict';var Sequelize=require(_0xd277('0x0'));var moment=require('moment');var util=require(_0xd277('0x1'));var _=require(_0xd277('0x2'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xd277('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x3e7f08){this['setDataValue'](_0xd277('0x3'),_0x3e7f08);this['setDataValue'](_0xd277('0x4'),_0x3e7f08);},'comment':_0xd277('0x5')},'fullname':{'type':Sequelize[_0xd277('0x6')],'allowNull':![],'set':function(_0xcdb660){this['setDataValue'](_0xd277('0x7'),_0xcdb660);this['setDataValue'](_0xd277('0x8'),util[_0xd277('0x9')](_0xd277('0xa'),_0xcdb660,this[_0xd277('0xb')](_0xd277('0xc'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xd277('0x6')],'allowNull':![],'unique':_0xd277('0xd'),'validate':{'isEmail':!![]},'set':function(_0x1580d2){if(_0x1580d2){this['setDataValue'](_0xd277('0xd'),_0x1580d2[_0xd277('0xe')]());}}},'role':{'type':Sequelize[_0xd277('0xf')](_0xd277('0x10'),_0xd277('0x11'),_0xd277('0x12'),_0xd277('0x13')),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xd277('0x6')],'defaultValue':'local'},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':_0xd277('0xc'),'set':function(_0x450558){this[_0xd277('0x14')](_0xd277('0xc'),_0x450558);this[_0xd277('0x14')](_0xd277('0x15'),_0x450558);this['setDataValue']('callerid',util[_0xd277('0x9')](_0xd277('0xa'),this[_0xd277('0xb')](_0xd277('0x7')),_0x450558));}},'salt':{'type':Sequelize[_0xd277('0x6')]},'phone':{'type':Sequelize[_0xd277('0x6')]},'mobile':{'type':Sequelize[_0xd277('0x6')]},'address':{'type':Sequelize[_0xd277('0x6')]},'zipcode':{'type':Sequelize[_0xd277('0x6')]},'userpic':{'type':Sequelize[_0xd277('0x6')]},'city':{'type':Sequelize[_0xd277('0x6')]},'country':{'type':Sequelize['STRING']},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xd277('0x16')]},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xd277('0x17')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xd277('0x17')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xd277('0x17')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xd277('0x17')],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xd277('0x6')],'defaultValue':_0xd277('0x18')},'lastPauseAt':{'type':Sequelize[_0xd277('0x16')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xd277('0x19')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xd277('0x19')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xd277('0x19')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xd277('0x17')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xd277('0x17')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xd277('0x19')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xd277('0x17')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xd277('0x19')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xd277('0x17')],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xd277('0x1a')},'ipaddr':{'type':Sequelize[_0xd277('0x6')],'allowNull':!![]},'port':{'type':Sequelize[_0xd277('0x19')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xd277('0x19')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xd277('0x6')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0xd277('0x6')],'allowNull':!![]},'lastms':{'type':Sequelize[_0xd277('0x19')](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM']('friend','user',_0xd277('0x1b')),'allowNull':!![],'defaultValue':_0xd277('0x1c')},'context':{'type':Sequelize[_0xd277('0x6')],'allowNull':!![],'defaultValue':_0xd277('0x1d')},'callingpres':{'type':Sequelize[_0xd277('0xf')](_0xd277('0x1e'),_0xd277('0x1f'),_0xd277('0x20'),_0xd277('0x21'),_0xd277('0x22'),_0xd277('0x23'),_0xd277('0x24'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0xd277('0x6')],'allowNull':!![]},'permit':{'type':Sequelize[_0xd277('0x6')],'allowNull':!![]},'secret':{'type':Sequelize[_0xd277('0x6')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xd277('0x6')],'allowNull':!![]},'transport':{'type':Sequelize[_0xd277('0x6')],'allowNull':!![],'defaultValue':'udp','set':function(_0x4656c5){this[_0xd277('0x14')]('transport',_0x4656c5?_0x4656c5[_0xd277('0x25')](','):null);},'get':function(){return this['getDataValue'](_0xd277('0x26'))?this[_0xd277('0xb')]('transport')['split'](','):null;},'comment':_0xd277('0x27')},'dtmfmode':{'type':Sequelize[_0xd277('0xf')](_0xd277('0x28'),_0xd277('0x29'),'shortinfo',_0xd277('0x2a'),_0xd277('0x2b')),'allowNull':!![],'defaultValue':_0xd277('0x28')},'directmedia':{'type':Sequelize['ENUM'](_0xd277('0x2c'),'no',_0xd277('0x2d'),_0xd277('0x2e'),'outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xd277('0xf')](_0xd277('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xd277('0x6')],'allowNull':!![]},'directmediadeny':{'type':Sequelize['STRING'],'allowNull':!![]},'nat':{'type':Sequelize[_0xd277('0x6')],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x1f5cd9){this[_0xd277('0x14')](_0xd277('0x2f'),_0x1f5cd9?_0x1f5cd9[_0xd277('0x25')](','):null);},'get':function(){return this['getDataValue'](_0xd277('0x2f'))?this[_0xd277('0xb')](_0xd277('0x2f'))[_0xd277('0x30')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0xd277('0x6')]},'namedcallgroup':{'type':Sequelize[_0xd277('0x6')]},'pickupgroup':{'type':Sequelize[_0xd277('0x6')]},'namedpickupgroup':{'type':Sequelize[_0xd277('0x6')]},'language':{'type':Sequelize[_0xd277('0x6')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xd277('0x6')]},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xd277('0x31')},'allow':{'type':Sequelize[_0xd277('0x6')],'allowNull':![],'defaultValue':_0xd277('0x32'),'set':function(_0x543bc2){this[_0xd277('0x14')]('allow',_0x543bc2?_0x543bc2['join'](';'):_0xd277('0x32'));},'get':function(){return this[_0xd277('0xb')]('allow')?this['getDataValue'](_0xd277('0x33'))[_0xd277('0x30')](';'):null;},'comment':_0xd277('0x34')},'autoframing':{'type':Sequelize[_0xd277('0xf')](_0xd277('0x2c'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xd277('0x6')],'allowNull':!![],'set':function(_0x40945b){this[_0xd277('0x14')](_0xd277('0x35'),_0x40945b?_0x40945b[_0xd277('0x25')](','):null);},'get':function(){return this[_0xd277('0xb')](_0xd277('0x35'))?this[_0xd277('0xb')]('insecure')['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0xd277('0xf')](_0xd277('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0xd277('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xd277('0xf')](_0xd277('0x2c'),'no',_0xd277('0x36')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xd277('0xf')](_0xd277('0x2c'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xd277('0xf')](_0xd277('0x2c'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xd277('0x6')],'allowNull':!![]},'callerid':{'type':Sequelize[_0xd277('0x6')],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0xd277('0x6')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xd277('0xf')](_0xd277('0x2c'),'no'),'allowNull':!![],'defaultValue':_0xd277('0x2c')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xd277('0xf')](_0xd277('0x2c'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xd277('0xf')](_0xd277('0x2c'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xd277('0xf')]('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0xd277('0xf')](_0xd277('0x2c'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize['STRING'],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xd277('0xf')]('yes','no','always'),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xd277('0x19')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xd277('0xf')]('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xd277('0x6')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM'](_0xd277('0x37'),_0xd277('0x38'),_0xd277('0x39')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xd277('0x19')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xd277('0x19')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xd277('0xf')](_0xd277('0x3a'),_0xd277('0x3b')),'allowNull':!![],'defaultValue':_0xd277('0x3b')},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize[_0xd277('0x6')],'allowNull':!![]},'fromdomain':{'type':Sequelize['STRING'],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xd277('0x6')],'allowNull':!![]},'qualify':{'type':Sequelize[_0xd277('0xf')](_0xd277('0x2c'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0xd277('0x19')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xd277('0x6')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xd277('0x19')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0xd277('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING'],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xd277('0x6')],'allowNull':!![]},'timert1':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xd277('0x19')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xd277('0x19')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xd277('0x6')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xd277('0x6')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xd277('0x6')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xd277('0x6')],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xd277('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xd277('0xf')](_0xd277('0x2c'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0xd277('0x2c'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0xd277('0xf')](_0xd277('0x2c'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xd277('0xf')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xd277('0xf')]('yes','no',_0xd277('0x3c'),_0xd277('0x3d')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xd277('0x19')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xd277('0x6')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0xd277('0x6')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xd277('0x6')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xd277('0x6')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xd277('0x6')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xd277('0xf')](_0xd277('0x3e'),_0xd277('0x3f'),_0xd277('0x40')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xd277('0x6')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xd277('0xf')](_0xd277('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xd277('0x6')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xd277('0x6')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xd277('0x19')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xd277('0xf')](_0xd277('0x2c'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xd277('0x6')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xd277('0x6')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xd277('0x6')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xd277('0x6')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0xd277('0x2c'),'no',_0xd277('0x2d'),_0xd277('0x2e'),_0xd277('0x41')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xd277('0x17')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xd277('0x6')]},'resetPasswordExpires':{'type':Sequelize[_0xd277('0x16')]},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0xd277('0x42')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x1ecd14){this['setDataValue']('showWebBar',_0x1ecd14);var _0x3ced30=this['get']({'plain':!![]});switch(_0x1ecd14){case 0x0:case 0x1:var _0x3ccb3b=_0x3ced30['transport']?_[_0xd277('0x43')](_0x3ced30[_0xd277('0x26')])?_0x3ced30[_0xd277('0x26')]['join']():_0x3ced30[_0xd277('0x26')]:'udp';if(_0x3ccb3b===_0xd277('0x44')){_0x3ccb3b=_0xd277('0x45');}this[_0xd277('0x14')](_0xd277('0x26'),_0x3ccb3b);this[_0xd277('0x14')]('encryption','no');this['setDataValue'](_0xd277('0x46'),null);this[_0xd277('0x14')](_0xd277('0x47'),null);this[_0xd277('0x14')](_0xd277('0x48'),null);this[_0xd277('0x14')](_0xd277('0x49'),null);this['setDataValue'](_0xd277('0x4a'),null);this[_0xd277('0x14')]('dtlssetup',null);this[_0xd277('0x14')]('dtlscertfile',null);this['setDataValue']('dtlsprivatekey',null);this[_0xd277('0x14')]('rtcp_mux','no');break;case 0x2:this[_0xd277('0x14')](_0xd277('0x26'),_0xd277('0x44'));this['setDataValue'](_0xd277('0x4b'),'yes');this[_0xd277('0x14')](_0xd277('0x46'),_0xd277('0x2c'));this['setDataValue']('force_avp',_0xd277('0x2c'));this['setDataValue'](_0xd277('0x48'),_0xd277('0x2c'));this[_0xd277('0x14')](_0xd277('0x49'),'yes');this[_0xd277('0x14')](_0xd277('0x4a'),'no');this[_0xd277('0x14')](_0xd277('0x4c'),'actpass');this[_0xd277('0x14')](_0xd277('0x4d'),_0x3ced30[_0xd277('0x4d')]||_0xd277('0x4e'));this[_0xd277('0x14')]('dtlsprivatekey',_0x3ced30[_0xd277('0x4f')]||'/etc/pki/tls/private/motion.key');this[_0xd277('0x14')]('rtcp_mux',_0xd277('0x2c'));break;default:}}},'permissions':{'type':Sequelize[_0xd277('0x42')],'set':function(_0x258f13){this[_0xd277('0x14')](_0xd277('0x50'),_0x258f13?_0x258f13['join'](','):[]);},'get':function(){return this[_0xd277('0xb')]('permissions')?_[_0xd277('0x51')](this[_0xd277('0xb')](_0xd277('0x50'))[_0xd277('0x30')](','),function(_0x193be7){return parseInt(_0x193be7,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xd277('0x6')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize[_0xd277('0x6')]},'phoneBarUnconditional':{'type':Sequelize[_0xd277('0x17')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xd277('0x17')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xd277('0x17')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xd277('0x17')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xd277('0x17')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xd277('0x17')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xd277('0x6')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xd277('0xf')](_0xd277('0x2c'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xd277('0x17')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xd277('0x52')],'get':function(){return this[_0xd277('0xb')](_0xd277('0x53'))?this[_0xd277('0xb')](_0xd277('0x53')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xd277('0x17')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xd277('0x17')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0xd277('0x6')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xd277('0x17')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xd277('0x6')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x1b11f5){if(typeof _0x1b11f5==='string'){var _0x5e7128=_0x1b11f5==='1'?!![]:_0x1b11f5==='0'?![]:_0x1b11f5==='true'?!![]:_0x1b11f5===_0xd277('0x54')?![]:![];this[_0xd277('0x14')](_0xd277('0x55'),_0x5e7128);}else{this[_0xd277('0x14')](_0xd277('0x55'),_0x1b11f5);}}},'blocked':{'type':Sequelize[_0xd277('0x17')],'defaultValue':![],'set':function(_0x37396f){this[_0xd277('0x14')]('blocked',_0x37396f);if(_0x37396f===!![]){this[_0xd277('0x14')](_0xd277('0x56'),moment());this[_0xd277('0x14')](_0xd277('0x57'),0x0);}else{this['setDataValue'](_0xd277('0x56'),null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0xd277('0x17')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0xd277('0x19')](0x5)[_0xd277('0x58')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0xd277('0x17')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xd277('0x17')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xd277('0x17')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0xd277('0x17')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x3d04=['originate','uac','uas','fingerprint','certificate','active','passive','actpass','update,nonat','showWebBar','wss','encryption','avpf','force_avp','icesupport','dtlssetup','dtlscertfile','rtcp_mux','dtlsverify','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','/etc/pki/tls/private/motion.key','permissions','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','false','screenrecording','blocked','blockedAt','loginAttempts','sequelize','util','lodash','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','callerid','format','getDataValue','internal','email','toLowerCase','admin','agent','telephone','local','INTEGER','accountcode','\x22%s\x22\x20<%s>','BOOLEAN','DATE','DEFAULT\x20PAUSE','dynamic','user','friend','ENUM','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','split','rfc2833','info','shortinfo','inband','auto','yes','nonat','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','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]','never','accept','refuse'];(function(_0x4b935a,_0x327ee3){var _0xa298f0=function(_0x3e07c2){while(--_0x3e07c2){_0x4b935a['push'](_0x4b935a['shift']());}};_0xa298f0(++_0x327ee3);}(_0x3d04,0x7a));var _0x43d0=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x3d04[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require(_0x43d0('0x0'));var moment=require('moment');var util=require(_0x43d0('0x1'));var _=require(_0x43d0('0x2'));module['exports']={'name':{'type':Sequelize[_0x43d0('0x3')],'allowNull':![],'unique':_0x43d0('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x56eb6d){this[_0x43d0('0x5')](_0x43d0('0x4'),_0x56eb6d);this['setDataValue'](_0x43d0('0x6'),_0x56eb6d);},'comment':_0x43d0('0x7')},'fullname':{'type':Sequelize[_0x43d0('0x3')],'allowNull':![],'set':function(_0x163124){this['setDataValue'](_0x43d0('0x8'),_0x163124);this[_0x43d0('0x5')](_0x43d0('0x9'),util[_0x43d0('0xa')]('\x22%s\x22\x20<%s>',_0x163124,this[_0x43d0('0xb')](_0x43d0('0xc'))));}},'alias':{'type':Sequelize[_0x43d0('0x3')]},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x43d0('0xd'),'validate':{'isEmail':!![]},'set':function(_0x42fd94){if(_0x42fd94){this['setDataValue'](_0x43d0('0xd'),_0x42fd94[_0x43d0('0xe')]());}}},'role':{'type':Sequelize['ENUM'](_0x43d0('0xf'),'user',_0x43d0('0x10'),_0x43d0('0x11')),'allowNull':![]},'password':{'type':Sequelize[_0x43d0('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x43d0('0x3')],'defaultValue':_0x43d0('0x12')},'internal':{'type':Sequelize[_0x43d0('0x13')](0xb),'allowNull':![],'unique':'internal','set':function(_0x4ef9e9){this[_0x43d0('0x5')](_0x43d0('0xc'),_0x4ef9e9);this['setDataValue'](_0x43d0('0x14'),_0x4ef9e9);this['setDataValue'](_0x43d0('0x9'),util[_0x43d0('0xa')](_0x43d0('0x15'),this[_0x43d0('0xb')](_0x43d0('0x8')),_0x4ef9e9));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x43d0('0x3')]},'mobile':{'type':Sequelize[_0x43d0('0x3')]},'address':{'type':Sequelize[_0x43d0('0x3')]},'zipcode':{'type':Sequelize[_0x43d0('0x3')]},'userpic':{'type':Sequelize[_0x43d0('0x3')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize['STRING']},'online':{'type':Sequelize[_0x43d0('0x16')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x43d0('0x17')]},'voicePause':{'type':Sequelize[_0x43d0('0x16')],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x43d0('0x16')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x43d0('0x16')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x43d0('0x16')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x43d0('0x16')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x43d0('0x16')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x43d0('0x3')],'defaultValue':_0x43d0('0x18')},'lastPauseAt':{'type':Sequelize[_0x43d0('0x17')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x43d0('0x13')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x43d0('0x13')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x43d0('0x13')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x43d0('0x16')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x43d0('0x16')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x43d0('0x13')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x43d0('0x16')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x43d0('0x13')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x43d0('0x16')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x43d0('0x16')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x43d0('0x19')},'ipaddr':{'type':Sequelize[_0x43d0('0x3')],'allowNull':!![]},'port':{'type':Sequelize[_0x43d0('0x13')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x43d0('0x13')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x43d0('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x43d0('0x3')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x43d0('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM']('friend',_0x43d0('0x1a'),'peer'),'allowNull':!![],'defaultValue':_0x43d0('0x1b')},'context':{'type':Sequelize[_0x43d0('0x3')],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize[_0x43d0('0x1c')](_0x43d0('0x1d'),_0x43d0('0x1e'),_0x43d0('0x1f'),'ALLOWED',_0x43d0('0x20'),_0x43d0('0x21'),_0x43d0('0x22'),_0x43d0('0x23')),'allowNull':!![]},'deny':{'type':Sequelize[_0x43d0('0x3')],'allowNull':!![]},'permit':{'type':Sequelize[_0x43d0('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x43d0('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x43d0('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize[_0x43d0('0x3')],'allowNull':!![],'defaultValue':_0x43d0('0x24'),'set':function(_0x2ef306){this[_0x43d0('0x5')](_0x43d0('0x25'),_0x2ef306?_0x2ef306[_0x43d0('0x26')](','):null);},'get':function(){return this['getDataValue'](_0x43d0('0x25'))?this[_0x43d0('0xb')](_0x43d0('0x25'))[_0x43d0('0x27')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize['ENUM'](_0x43d0('0x28'),_0x43d0('0x29'),_0x43d0('0x2a'),_0x43d0('0x2b'),_0x43d0('0x2c')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x43d0('0x1c')](_0x43d0('0x2d'),'no',_0x43d0('0x2e'),_0x43d0('0x2f'),_0x43d0('0x30')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x43d0('0x1c')](_0x43d0('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x43d0('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x43d0('0x3')],'allowNull':!![]},'nat':{'type':Sequelize[_0x43d0('0x3')],'allowNull':!![],'defaultValue':_0x43d0('0x31'),'set':function(_0x564e9b){this[_0x43d0('0x5')](_0x43d0('0x32'),_0x564e9b?_0x564e9b[_0x43d0('0x26')](','):null);},'get':function(){return this['getDataValue'](_0x43d0('0x32'))?this['getDataValue'](_0x43d0('0x32'))[_0x43d0('0x27')](','):null;},'comment':_0x43d0('0x33')},'callgroup':{'type':Sequelize[_0x43d0('0x3')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x43d0('0x3')]},'namedpickupgroup':{'type':Sequelize[_0x43d0('0x3')]},'language':{'type':Sequelize[_0x43d0('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x43d0('0x3')]},'disallow':{'type':Sequelize[_0x43d0('0x3')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize[_0x43d0('0x3')],'allowNull':![],'defaultValue':_0x43d0('0x34'),'set':function(_0x39452){this[_0x43d0('0x5')](_0x43d0('0x35'),_0x39452?_0x39452[_0x43d0('0x26')](';'):_0x43d0('0x34'));},'get':function(){return this[_0x43d0('0xb')]('allow')?this[_0x43d0('0xb')](_0x43d0('0x35'))[_0x43d0('0x27')](';'):null;},'comment':_0x43d0('0x36')},'autoframing':{'type':Sequelize[_0x43d0('0x1c')](_0x43d0('0x2d'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x43d0('0x3')],'allowNull':!![],'set':function(_0xee6357){this[_0x43d0('0x5')](_0x43d0('0x37'),_0xee6357?_0xee6357[_0x43d0('0x26')](','):null);},'get':function(){return this[_0x43d0('0xb')](_0x43d0('0x37'))?this[_0x43d0('0xb')](_0x43d0('0x37'))[_0x43d0('0x27')](','):null;},'comment':_0x43d0('0x38')},'trustrpid':{'type':Sequelize['ENUM'](_0x43d0('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x43d0('0x1c')](_0x43d0('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0x43d0('0x2d'),'no',_0x43d0('0x39')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x43d0('0x1c')](_0x43d0('0x2d'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x43d0('0x1c')](_0x43d0('0x2d'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x43d0('0x13')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x43d0('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x43d0('0x3')],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x43d0('0x1c')](_0x43d0('0x2d'),'no'),'allowNull':!![],'defaultValue':_0x43d0('0x2d')},'busylevel':{'type':Sequelize[_0x43d0('0x13')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM'](_0x43d0('0x2d'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x43d0('0x1c')](_0x43d0('0x2d'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x43d0('0x2d'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x43d0('0x3')],'allowNull':!![]},'template':{'type':Sequelize[_0x43d0('0x3')],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM']('yes','no','always'),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x43d0('0x13')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x43d0('0x1c')]('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x43d0('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x43d0('0x1c')](_0x43d0('0x3a'),_0x43d0('0x3b'),_0x43d0('0x3c')),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x43d0('0x13')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x43d0('0x1c')](_0x43d0('0x3d'),_0x43d0('0x3e')),'allowNull':!![],'defaultValue':_0x43d0('0x3e')},'t38pt_usertpsource':{'type':Sequelize[_0x43d0('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize['STRING'],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x43d0('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x43d0('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':_0x43d0('0x2d')},'keepalive':{'type':Sequelize[_0x43d0('0x13')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x43d0('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x43d0('0x13')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x43d0('0x13')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0x43d0('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING'],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x43d0('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x43d0('0x13')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x43d0('0x13')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x43d0('0x13')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x43d0('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x43d0('0x3')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x43d0('0x3')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x43d0('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x43d0('0x3')],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x43d0('0x1c')](_0x43d0('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x43d0('0x1c')](_0x43d0('0x2d'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x43d0('0x1c')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0x43d0('0x2d'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0x43d0('0x2d'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0x43d0('0x2d'),'no',_0x43d0('0x3f'),_0x43d0('0x40')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x43d0('0x13')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x43d0('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x43d0('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x43d0('0x3')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x43d0('0x1c')](_0x43d0('0x41'),_0x43d0('0x42'),_0x43d0('0x43')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x43d0('0x1c')](_0x43d0('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x43d0('0x3')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x43d0('0x1c')](_0x43d0('0x2d'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x43d0('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x43d0('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x43d0('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x43d0('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x43d0('0x1c')]('yes','no',_0x43d0('0x2e'),_0x43d0('0x2f'),_0x43d0('0x44')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x43d0('0x16')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x43d0('0x3')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x43d0('0x17')],'defaultValue':null},'previousPasswords':{'type':Sequelize['TEXT']},'showWebBar':{'type':Sequelize[_0x43d0('0x13')],'defaultValue':0x0,'set':function(_0x1d67ba){this['setDataValue'](_0x43d0('0x45'),_0x1d67ba);var _0x2f7121=this['get']({'plain':!![]});switch(_0x1d67ba){case 0x0:case 0x1:var _0x319469=_0x2f7121['transport']?_['isArray'](_0x2f7121[_0x43d0('0x25')])?_0x2f7121['transport'][_0x43d0('0x26')]():_0x2f7121[_0x43d0('0x25')]:_0x43d0('0x24');if(_0x319469===_0x43d0('0x46')){_0x319469='udp';}this[_0x43d0('0x5')](_0x43d0('0x25'),_0x319469);this['setDataValue'](_0x43d0('0x47'),'no');this['setDataValue'](_0x43d0('0x48'),null);this[_0x43d0('0x5')](_0x43d0('0x49'),null);this[_0x43d0('0x5')](_0x43d0('0x4a'),null);this['setDataValue']('dtlsenable',null);this['setDataValue']('dtlsverify',null);this['setDataValue'](_0x43d0('0x4b'),null);this[_0x43d0('0x5')](_0x43d0('0x4c'),null);this['setDataValue']('dtlsprivatekey',null);this['setDataValue'](_0x43d0('0x4d'),'no');break;case 0x2:this[_0x43d0('0x5')]('transport',_0x43d0('0x46'));this[_0x43d0('0x5')]('encryption','yes');this[_0x43d0('0x5')](_0x43d0('0x48'),_0x43d0('0x2d'));this[_0x43d0('0x5')]('force_avp',_0x43d0('0x2d'));this['setDataValue'](_0x43d0('0x4a'),_0x43d0('0x2d'));this[_0x43d0('0x5')]('dtlsenable',_0x43d0('0x2d'));this[_0x43d0('0x5')](_0x43d0('0x4e'),'no');this[_0x43d0('0x5')](_0x43d0('0x4b'),'actpass');this[_0x43d0('0x5')](_0x43d0('0x4c'),_0x2f7121[_0x43d0('0x4c')]||_0x43d0('0x4f'));this['setDataValue'](_0x43d0('0x50'),_0x2f7121[_0x43d0('0x50')]||_0x43d0('0x51'));this[_0x43d0('0x5')]('rtcp_mux','yes');break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x3458fc){this[_0x43d0('0x5')]('permissions',_0x3458fc?_0x3458fc[_0x43d0('0x26')](','):[]);},'get':function(){return this[_0x43d0('0xb')](_0x43d0('0x52'))?_['map'](this[_0x43d0('0xb')](_0x43d0('0x52'))[_0x43d0('0x27')](','),function(_0x267bcd){return parseInt(_0x267bcd,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x43d0('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x43d0('0x3')]},'phoneBarBusyNumber':{'type':Sequelize['STRING']},'phoneBarUnconditional':{'type':Sequelize[_0x43d0('0x16')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x43d0('0x16')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x43d0('0x16')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x43d0('0x16')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x43d0('0x13')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x43d0('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x43d0('0x13')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x43d0('0x1c')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x43d0('0x16')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x43d0('0x3')]},'phoneBarEnableJaws':{'type':Sequelize[_0x43d0('0x16')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x43d0('0x16')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x43d0('0x53')],'get':function(){return this['getDataValue'](_0x43d0('0x54'))?this[_0x43d0('0xb')]('phoneBarEnableScreenRecordingByAgent'):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x43d0('0x16')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x43d0('0x16')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x43d0('0x16')],'defaultValue':![]},'interface':{'type':Sequelize[_0x43d0('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x43d0('0x16')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x43d0('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x43d0('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x2ad702){if(typeof _0x2ad702===_0x43d0('0x55')){var _0x701ff=_0x2ad702==='1'?!![]:_0x2ad702==='0'?![]:_0x2ad702==='true'?!![]:_0x2ad702===_0x43d0('0x56')?![]:![];this[_0x43d0('0x5')](_0x43d0('0x57'),_0x701ff);}else{this[_0x43d0('0x5')](_0x43d0('0x57'),_0x2ad702);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x467ba5){this[_0x43d0('0x5')](_0x43d0('0x58'),_0x467ba5);if(_0x467ba5===!![]){this[_0x43d0('0x5')](_0x43d0('0x59'),moment());this[_0x43d0('0x5')](_0x43d0('0x5a'),0x0);}else{this[_0x43d0('0x5')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize[_0x43d0('0x17')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x43d0('0x13')],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x43d0('0x16')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x43d0('0x13')](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x43d0('0x16')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x43d0('0x16')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x43d0('0x16')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x43d0('0x16')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 3db5499..6e5f851 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 _0x7a54=['oldPassword','newPassword','authenticate','Sequelize','ValidationError','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','enforcePasswordHistory','passwordHistoryLimit','previousPasswords','updatePasswordsHistory','online','loginInPause','voicePause','interface','add','capitalize','toLowerCase','Queues','penalty','spread','emit','Queue:save','voice','format','SIP/%s','UserVoiceQueueRt','upsert','removeQueues','channel','isValidChannel','Unknown\x20channel','isArray','Queue:remove','QueueId','addAvatar','userpic','file','filename','getAvatar','join','root','download','existsSync','server/files/images/','getOpenTabs','ChatOpenTabs','CHAT','createdAt','FaxOpenTabs','FAX','OpenchannelOpenTabs','OPENCHANNEL','MailOpenTabs','MAIL','SmsOpenTabs','WhatsappOpenTabs','WHATSAPP','filters','order','sort','pick','getContacts','hasOwnProperty','CmList','List','Tag','Tags','color','tag','nolimit','getQueues','findOne','Queue','Unknown\x20role','getVoiceQueuesRt','getGroups','ChatGroup','getRecordings','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','getChatInteractions','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','getSmsInteractions','SmsInteraction','getFaxInteractions','FaxInteraction','getWhatsappInteractions','WhatsappInteraction','login','mobile','LOCAL/%s@from-sip/n','intrf','user:%s','headers','x-forwarded-for','remoteAddress','socket','connection','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','MemberReport','YYYY-MM-DD\x20HH:mm:ss','getChannels','forEach','device','PAUSE','LOGININPAUSE','resolve','logout','pause','QueuePause','updateAttributes','DEFAULT\x20PAUSE','mailPause','chatPause','faxPause','openchannelPause','smsPause','pauseType','unpause','manual','%s%s','Pause','getTeams','Team','addTeams','setDataValue','Chat','Mail','getSmsQueues','Sms','getWhatsappQueues','Whatsapp','Fax','getOpenchannelQueues','Openchannel','flatten','transaction','addAgent','getDataValue','Voice','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','removeTeams','getMailQueues','removeAgent','getLists','getAgents','values','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','getVoicePrefixes','VoicePrefix','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','MailAccount','getMailAccounts','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','addSmsAccounts','removeSmsAccounts','getChatWebsites','addChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','getSquareProjects','SquareProject','addSquareProjects','removeSquareProjects','getScheduledCalls','CmHopper','$and','$or','$gt','$lt','$lte','$eq','$not','$notBetween','$in','$like','$notLike','$iLike','$overlap','$contains','$contained','$any','firstName','lastName','phone','CmContact','dialActive','VoiceQueue','getApiKey','retrieveApiKey','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','nonce','token','removeApiKey','apiKeyNonce','API\x20key\x20not\x20available','getPresence','teams','queues','inbound','col','toString','desc','asc','substring','uniqBy','orderBy','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','client','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','offline','idle','unknown','ringing','voiceStatus','busy','slice','select','field','ui.','InteractionId','user_has_','moment','bluebird','util','lodash','squel','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','socket.io-emitter','./user.socket','redis','localhost','http','request','then','info','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','update','get','admin','Users','user','Telephones','telephone','ignore','map','value','role','UserProfileResource','destroy','stack','name','send','index','User','rawAttributes','fieldName','type','filter','getOptions','where','query','includeAll','include','includes','attributes','push','findAll','rows','length','chat','dataValues','fax','mail','openchannel','whatsapp','all','differenceBy','password','salt','keys','model','intersection','fields','merge','options','find','openTabs','true','sms','body','describe','addContacts','params','ids','omit','Setting','findById','securePassword','validatePasswordPattern','internal','isNil','min_internal','sequelize','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','SELECT','from','voicemail','mailbox','fullname','email','agent','permissions','101','102','103','113','104','106','107','108','109','100','111','114','115','create','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','checkUserLimits','settingsEnabled','VoiceMail','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','Unauthorized','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','each','Agents','userProfileId','isEmpty','changePassword'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x7a54,0x106));var _0x47a5=function(_0x2d55fe,_0x375d02){_0x2d55fe=_0x2d55fe-0x0;var _0xd1f8a0=_0x7a54[_0x2d55fe];return _0xd1f8a0;};'use strict';var moment=require(_0x47a5('0x0'));var BPromise=require(_0x47a5('0x1'));var util=require(_0x47a5('0x2'));var path=require('path');var fs=require('fs');var _=require(_0x47a5('0x3'));var squel=require(_0x47a5('0x4'));var jayson=require('jayson/promise');var Redis=require(_0x47a5('0x5'));var authService=require(_0x47a5('0x6'));var qs=require(_0x47a5('0x7'));var logger=require(_0x47a5('0x8'))(_0x47a5('0x9'));var utils=require('../../config/utils');var config=require(_0x47a5('0xa'));var licenseUtil=require('../../config/license/util');var db=require(_0x47a5('0xb'))['db'];var socket=require(_0x47a5('0xc'))(new Redis(config['redis']));require(_0x47a5('0xd'))['register'](socket);config['redis']=_['defaults'](config[_0x47a5('0xe')],{'host':_0x47a5('0xf'),'port':0x18eb});var client=jayson['client'][_0x47a5('0x10')]({'port':0x232a});var values;function respondWithRpcPromise(_0x49e844,_0x5de6d7,_0x1f47f4,_0x69e4d4){return new BPromise(function(_0x2f399b,_0x250fad){var _0xd612dd=_0x69e4d4||client;return _0xd612dd[_0x47a5('0x11')](_0x49e844,_0x1f47f4)[_0x47a5('0x12')](function(_0x5beb89){logger[_0x47a5('0x13')](_0x47a5('0x14'),_0x5de6d7,_0x47a5('0x15'));logger[_0x47a5('0x16')](_0x47a5('0x17'),_0x5de6d7,_0x47a5('0x15'),JSON[_0x47a5('0x18')](_0x5beb89));if(_0x5beb89[_0x47a5('0x19')]){if(_0x5beb89['error'][_0x47a5('0x1a')]===0x1f4){logger[_0x47a5('0x19')](_0x47a5('0x14'),_0x5de6d7,_0x5beb89[_0x47a5('0x19')][_0x47a5('0x1b')]);return _0x250fad(_0x5beb89['error']['message']);}logger[_0x47a5('0x19')]('User,\x20%s,\x20%s',_0x5de6d7,_0x5beb89['error'][_0x47a5('0x1b')]);return _0x2f399b(_0x5beb89[_0x47a5('0x19')][_0x47a5('0x1b')]);}else{logger[_0x47a5('0x13')](_0x47a5('0x14'),_0x5de6d7,_0x47a5('0x15'));_0x2f399b(_0x5beb89[_0x47a5('0x1c')][_0x47a5('0x1b')]);}})[_0x47a5('0x1d')](function(_0x4a9fcb){logger[_0x47a5('0x19')](_0x47a5('0x14'),_0x5de6d7,_0x4a9fcb);_0x250fad(_0x4a9fcb);});});}function respondWithStatusCode(_0x47cf3c,_0x2b0360){_0x2b0360=_0x2b0360||0xcc;return function(_0x1f03f7){if(_0x1f03f7){return _0x47cf3c[_0x47a5('0x1e')](_0x2b0360);}return _0x47cf3c['status'](_0x2b0360)[_0x47a5('0x1f')]();};}function respondWithResult(_0x2f142b,_0x23db32){_0x23db32=_0x23db32||0xc8;return function(_0x7a9f9e){if(_0x7a9f9e){return _0x2f142b['status'](_0x23db32)[_0x47a5('0x20')](_0x7a9f9e);}};}function respondWithFilteredResult(_0x385687,_0x513981){return function(_0x28747d){if(_0x28747d){var _0xc4cd63=typeof _0x513981[_0x47a5('0x21')]===_0x47a5('0x22')&&typeof _0x513981[_0x47a5('0x23')]==='undefined';var _0x53078a=_0x28747d[_0x47a5('0x24')];var _0x5686db=_0xc4cd63?0x0:_0x513981[_0x47a5('0x21')];var _0x5b6c4e=_0xc4cd63?_0x28747d[_0x47a5('0x24')]:_0x513981[_0x47a5('0x21')]+_0x513981[_0x47a5('0x23')];var _0x1dac65;if(_0x5b6c4e>=_0x53078a){_0x5b6c4e=_0x53078a;_0x1dac65=0xc8;}else{_0x1dac65=0xce;}_0x385687[_0x47a5('0x25')](_0x1dac65);return _0x385687[_0x47a5('0x26')](_0x47a5('0x27'),_0x5686db+'-'+_0x5b6c4e+'/'+_0x53078a)[_0x47a5('0x20')](_0x28747d);}return null;};}function saveUpdates(_0x16631f){return function(_0x361bfa){if(_0x361bfa){return _0x361bfa[_0x47a5('0x28')](_0x16631f)[_0x47a5('0x12')](function(_0x3ad507){return _0x3ad507;});}return null;};}function removeEntity(_0x528582){return function(_0x243210){if(_0x243210){return _0x243210['destroy']()[_0x47a5('0x12')](function(){var _0x9ac908=_0x243210[_0x47a5('0x29')]({'plain':!![]});if(_0x9ac908['role']===_0x47a5('0x2a'))return;var _0x625952=[{'name':_0x47a5('0x2b'),'value':_0x47a5('0x2c'),'ignore':!![]},{'name':'Agents','value':'agent','ignore':![]},{'name':_0x47a5('0x2d'),'value':_0x47a5('0x2e'),'ignore':![]}];var _0x5bd7eb=_(_0x625952)['filter'](_0x47a5('0x2f'))[_0x47a5('0x30')]('value')[_0x47a5('0x31')]();if(_['includes'](_0x5bd7eb,_0x9ac908[_0x47a5('0x32')])){return;}var _0xd972c=_['find'](_0x625952,['value',_0x9ac908[_0x47a5('0x32')]])['name'];return db[_0x47a5('0x33')][_0x47a5('0x34')]({'where':{'type':_0xd972c,'resourceId':_0x9ac908['id']}})[_0x47a5('0x12')](function(){return _0x243210;});})['then'](function(){_0x528582[_0x47a5('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x53c754){return function(_0x65542e){if(!_0x65542e){_0x53c754['sendStatus'](0x194);}return _0x65542e;};}function handleError(_0x25cce0,_0x5ef577){_0x5ef577=_0x5ef577||0x1f4;return function(_0x21ad34){logger[_0x47a5('0x19')](_0x21ad34[_0x47a5('0x35')]);if(_0x21ad34[_0x47a5('0x36')]){delete _0x21ad34[_0x47a5('0x36')];}_0x25cce0[_0x47a5('0x25')](_0x5ef577)[_0x47a5('0x37')](_0x21ad34);};}exports[_0x47a5('0x38')]=function(_0x1a0d23,_0x4caed5){var _0x396a9a={},_0x10f136={'count':0x0,'rows':[]};var _0x511c06=_(db[_0x47a5('0x39')][_0x47a5('0x3a')])[_0x47a5('0x30')](function(_0x49c4b5){return{'name':_0x49c4b5[_0x47a5('0x3b')],'type':_0x49c4b5[_0x47a5('0x3c')]['key']};})[_0x47a5('0x3d')](function(_0x19218a){return!_['includes'](['password','salt'],_0x19218a[_0x47a5('0x36')]);})['value']();_0x396a9a=qs[_0x47a5('0x3e')](_0x511c06,_0x1a0d23);var _0x1f9631={'where':_0x396a9a[_0x47a5('0x3f')]};return db[_0x47a5('0x39')][_0x47a5('0x24')](_0x1f9631)[_0x47a5('0x12')](function(_0x2003b0){_0x10f136[_0x47a5('0x24')]=_0x2003b0;if(_0x1a0d23[_0x47a5('0x40')][_0x47a5('0x41')]){_0x396a9a[_0x47a5('0x42')]=[{'all':!![]}];}if(!_[_0x47a5('0x43')](_0x396a9a[_0x47a5('0x44')],'id')){_0x396a9a['attributes'][_0x47a5('0x45')]('id');}return db[_0x47a5('0x39')][_0x47a5('0x46')](_0x396a9a);})[_0x47a5('0x12')](function(_0x586f4f){_0x10f136[_0x47a5('0x47')]=_0x586f4f;if(_0x1a0d23['query']['openTabs']==='true'){var _0x50d116=[];for(var _0x27dd5d=0x0;_0x27dd5d<_0x10f136['rows'][_0x47a5('0x48')];_0x27dd5d++){_0x50d116[_0x47a5('0x45')](get_open_tabs(_0x47a5('0x49'),_0x10f136['rows'][_0x27dd5d][_0x47a5('0x4a')]));_0x50d116[_0x47a5('0x45')](get_open_tabs('sms',_0x10f136['rows'][_0x27dd5d][_0x47a5('0x4a')]));_0x50d116['push'](get_open_tabs(_0x47a5('0x4b'),_0x10f136[_0x47a5('0x47')][_0x27dd5d][_0x47a5('0x4a')]));_0x50d116[_0x47a5('0x45')](get_open_tabs(_0x47a5('0x4c'),_0x10f136[_0x47a5('0x47')][_0x27dd5d][_0x47a5('0x4a')]));_0x50d116[_0x47a5('0x45')](get_open_tabs(_0x47a5('0x4d'),_0x10f136[_0x47a5('0x47')][_0x27dd5d][_0x47a5('0x4a')]));_0x50d116[_0x47a5('0x45')](get_open_tabs(_0x47a5('0x4e'),_0x10f136[_0x47a5('0x47')][_0x27dd5d][_0x47a5('0x4a')]));}return BPromise[_0x47a5('0x4f')](_0x50d116)['then'](function(_0x2d38de){return _0x10f136;});}else{return _0x10f136;}})[_0x47a5('0x12')](respondWithFilteredResult(_0x4caed5,_0x396a9a))['catch'](handleError(_0x4caed5,null));};exports['show']=function(_0x3d0a88,_0x560e4e){var _0x13750d={'raw':![],'where':{'id':_0x3d0a88['params']['id']}},_0xd93e37={};_0xd93e37['model']=_[_0x47a5('0x50')](_['keys'](db[_0x47a5('0x39')][_0x47a5('0x3a')]),[_0x47a5('0x51'),_0x47a5('0x52')]);_0xd93e37[_0x47a5('0x40')]=_[_0x47a5('0x53')](_0x3d0a88[_0x47a5('0x40')]);_0xd93e37['filters']=_['intersection'](_0xd93e37[_0x47a5('0x54')],_0xd93e37[_0x47a5('0x40')]);_0x13750d[_0x47a5('0x44')]=_[_0x47a5('0x55')](_0xd93e37[_0x47a5('0x54')],qs[_0x47a5('0x56')](_0x3d0a88[_0x47a5('0x40')]['fields']));_0x13750d[_0x47a5('0x44')]=_0x13750d[_0x47a5('0x44')][_0x47a5('0x48')]?_0x13750d['attributes']:_0xd93e37[_0x47a5('0x54')];if(_0x3d0a88['query'][_0x47a5('0x41')]){_0x13750d[_0x47a5('0x42')]=[{'all':!![]}];}_0x13750d=_[_0x47a5('0x57')]({},_0x13750d,_0x3d0a88[_0x47a5('0x58')]);if(!_['includes'](_0x13750d[_0x47a5('0x44')],'id')){_0x13750d[_0x47a5('0x44')][_0x47a5('0x45')]('id');}return db[_0x47a5('0x39')][_0x47a5('0x59')](_0x13750d)[_0x47a5('0x12')](handleEntityNotFound(_0x560e4e,null))[_0x47a5('0x12')](function(_0x481089){var _0x2a0aa2=[];values=_0x481089;if(_0x3d0a88[_0x47a5('0x40')][_0x47a5('0x5a')]===_0x47a5('0x5b')){_0x2a0aa2[_0x47a5('0x45')](get_open_tabs(_0x47a5('0x49'),_0x481089['dataValues']));_0x2a0aa2[_0x47a5('0x45')](get_open_tabs(_0x47a5('0x5c'),_0x481089[_0x47a5('0x4a')]));_0x2a0aa2['push'](get_open_tabs(_0x47a5('0x4d'),_0x481089[_0x47a5('0x4a')]));_0x2a0aa2[_0x47a5('0x45')](get_open_tabs('whatsapp',_0x481089['dataValues']));_0x2a0aa2[_0x47a5('0x45')](get_open_tabs(_0x47a5('0x4b'),_0x481089['dataValues']));_0x2a0aa2['push'](get_open_tabs(_0x47a5('0x4c'),_0x481089['dataValues']));return BPromise[_0x47a5('0x4f')](_0x2a0aa2);}else{return values;}})['then'](function(_0x482de6){return values;})[_0x47a5('0x12')](respondWithResult(_0x560e4e,null))[_0x47a5('0x1d')](handleError(_0x560e4e,null));};exports['update']=function(_0x1b958b,_0x72fe){if(_0x1b958b['body']['id']){delete _0x1b958b['body']['id'];}delete _0x1b958b[_0x47a5('0x5d')][_0x47a5('0x32')];return db[_0x47a5('0x39')][_0x47a5('0x59')]({'where':{'id':_0x1b958b['params']['id']}})[_0x47a5('0x12')](handleEntityNotFound(_0x72fe,null))[_0x47a5('0x12')](saveUpdates(_0x1b958b[_0x47a5('0x5d')],null))['then'](respondWithResult(_0x72fe,null))[_0x47a5('0x1d')](handleError(_0x72fe,null));};exports['describe']=function(_0x485e3c,_0x470da6){return db[_0x47a5('0x39')][_0x47a5('0x5e')]()[_0x47a5('0x12')](respondWithResult(_0x470da6,null))['catch'](handleError(_0x470da6,null));};exports[_0x47a5('0x5f')]=function(_0x5d1550,_0x5cbe97){return db['User']['find']({'where':{'id':_0x5d1550[_0x47a5('0x60')]['id']}})[_0x47a5('0x12')](handleEntityNotFound(_0x5cbe97,null))[_0x47a5('0x12')](function(_0x52e3ee){if(_0x52e3ee){return _0x52e3ee['addContacts'](_0x5d1550[_0x47a5('0x5d')][_0x47a5('0x61')],_[_0x47a5('0x62')](_0x5d1550[_0x47a5('0x5d')],[_0x47a5('0x61'),'id'])||{});}})['then'](respondWithResult(_0x5cbe97,null))[_0x47a5('0x1d')](handleError(_0x5cbe97,null));};function validateUser(_0x519e9e){return new BPromise(function(_0x22c886,_0x274d31){if(_0x519e9e['internal'])return _0x22c886(_0x519e9e);return db[_0x47a5('0x63')][_0x47a5('0x64')](0x1)[_0x47a5('0x12')](function(_0x3e8274){if(_0x3e8274[_0x47a5('0x65')])authService[_0x47a5('0x66')](_0x519e9e[_0x47a5('0x51')]);db[_0x47a5('0x39')]['max'](_0x47a5('0x67'))[_0x47a5('0x12')](function(_0x3c75c6){if(_[_0x47a5('0x68')](_0x3c75c6)){_0x519e9e[_0x47a5('0x67')]=_0x3e8274['min_internal']||0x1;return;}if(_[_0x47a5('0x68')](_0x3e8274[_0x47a5('0x69')])||_0x3e8274[_0x47a5('0x69')]===_0x3c75c6){_0x519e9e[_0x47a5('0x67')]=_0x3c75c6+0x1;return;}if(_0x3e8274[_0x47a5('0x69')]>_0x3c75c6){_0x519e9e[_0x47a5('0x67')]=_0x3e8274[_0x47a5('0x69')];return;}return db[_0x47a5('0x6a')][_0x47a5('0x40')](_0x47a5('0x6b'),{'type':db[_0x47a5('0x6a')][_0x47a5('0x6c')][_0x47a5('0x6d')]})[_0x47a5('0x12')](function(_0x3edd17){if(_0x3edd17&&_0x3edd17['length']){for(var _0x42dd7d=0x0,_0x284fb8=_0x3edd17[_0x47a5('0x48')];_0x42dd7d<_0x284fb8&&_['isNil'](_0x519e9e[_0x47a5('0x67')]);_0x42dd7d++){if(_0x3e8274[_0x47a5('0x69')]<=_0x3edd17[_0x42dd7d][_0x47a5('0x6e')]){_0x519e9e[_0x47a5('0x67')]=_0x3edd17[_0x42dd7d]['from'];}else if(_0x3e8274[_0x47a5('0x69')]>_0x3edd17[_0x42dd7d]['from']&&_0x3e8274[_0x47a5('0x69')]<=_0x3edd17[_0x42dd7d]['to']){_0x519e9e['internal']=_0x3e8274[_0x47a5('0x69')];}}}if(_['isNil'](_0x519e9e[_0x47a5('0x67')])){_0x519e9e[_0x47a5('0x67')]=_0x3c75c6+0x1;}return _0x22c886(_0x519e9e);});});})[_0x47a5('0x1d')](function(_0x58473b){_0x274d31(_0x58473b);});});}function updateUser(_0x4af557){return new BPromise(function(_0x4b8084,_0x4164a3){try{if(_0x4af557[_0x47a5('0x6f')]){_0x4af557[_0x47a5('0x70')]=_0x4af557[_0x47a5('0x67')];_0x4af557['VoiceMail']={'mailbox':_0x4af557[_0x47a5('0x67')],'password':_0x4af557[_0x47a5('0x51')],'fullname':_0x4af557[_0x47a5('0x71')],'email':_0x4af557[_0x47a5('0x72')]};}if(_0x4af557[_0x47a5('0x32')]===_0x47a5('0x73')){if(!_0x4af557[_0x47a5('0x74')])_0x4af557[_0x47a5('0x74')]=[_0x47a5('0x75'),_0x47a5('0x76'),_0x47a5('0x77'),_0x47a5('0x78'),'110',_0x47a5('0x79'),'105',_0x47a5('0x7a'),_0x47a5('0x7b'),_0x47a5('0x7c'),_0x47a5('0x7d'),_0x47a5('0x7e'),_0x47a5('0x7f'),_0x47a5('0x80'),_0x47a5('0x81')];}_0x4b8084(_0x4af557);}catch(_0x11c1db){_0x4164a3(_0x11c1db);}});}exports[_0x47a5('0x82')]=function(_0x1cfb37,_0x1f07ac){if(_0x1cfb37[_0x47a5('0x2c')][_0x47a5('0x32')]===_0x47a5('0x73'))throw new Error('Unauthorized');if(_0x1cfb37['body']['role']==='user'&&_0x1cfb37[_0x47a5('0x2c')][_0x47a5('0x32')]!=='admin'){throw new Error(_0x47a5('0x83'));}if(_0x1cfb37[_0x47a5('0x5d')][_0x47a5('0x32')]===_0x47a5('0x2a')&&_0x1cfb37[_0x47a5('0x2c')][_0x47a5('0x32')]!==_0x47a5('0x2a')){throw new Error(_0x47a5('0x84'));}return licenseUtil[_0x47a5('0x85')]([_0x1cfb37[_0x47a5('0x5d')]])[_0x47a5('0x12')](function(){return validateUser(_0x1cfb37['body']);})[_0x47a5('0x12')](function(_0x1fbd42){return updateUser(_0x1fbd42)[_0x47a5('0x12')](function(_0x4f35ff){if(_0x4f35ff[_0x47a5('0x32')]===_0x47a5('0x2a')){_0x4f35ff[_0x47a5('0x86')]=_0x1cfb37['user'][_0x47a5('0x86')];delete _0x4f35ff['userProfileId'];}return _0x4f35ff;});})['then'](function(_0x356e16){return db[_0x47a5('0x39')][_0x47a5('0x82')](_0x356e16,{'include':[{'model':db[_0x47a5('0x87')],'as':_0x47a5('0x87')}]});})[_0x47a5('0x12')](function(_0x479a82){if(_0x1cfb37['body'][_0x47a5('0x32')]==='user')return _0x479a82;if(_0x1cfb37[_0x47a5('0x2c')][_0x47a5('0x32')]!==_0x47a5('0x2c'))return _0x479a82;return db[_0x47a5('0x88')]['find']({'where':{'name':_0x479a82[_0x47a5('0x32')]==='agent'?'Agents':_0x47a5('0x2d'),'userProfileId':_0x1cfb37[_0x47a5('0x2c')]['userProfileId']},'raw':!![]})[_0x47a5('0x12')](function(_0x21828e){if(!_0x21828e||_0x21828e[_0x47a5('0x89')]!=0x0)return _0x479a82;return db['UserProfileResource'][_0x47a5('0x82')]({'name':_0x479a82['name'],'resourceId':_0x479a82['id'],'type':_0x21828e[_0x47a5('0x36')],'sectionId':_0x21828e['id']},{})[_0x47a5('0x12')](function(){return _0x479a82;});})[_0x47a5('0x1d')](function(_0x4a5ca1){logger[_0x47a5('0x19')](_0x47a5('0x8a'),_0x4a5ca1);throw _0x4a5ca1;});})[_0x47a5('0x12')](respondWithResult(_0x1f07ac,0xc9))['catch'](handleError(_0x1f07ac,null));};exports[_0x47a5('0x8b')]=function(_0x4f2fbb,_0x3c012b){var _0x491bb4=_0x4f2fbb[_0x47a5('0x5d')];var _0x20d8bd=[];if(_0x4f2fbb[_0x47a5('0x2c')][_0x47a5('0x32')]==='agent')throw new Error(_0x47a5('0x8c'));if(_[_0x47a5('0x8d')](_0x491bb4,[_0x47a5('0x32'),_0x47a5('0x2c')])&&_0x4f2fbb[_0x47a5('0x2c')]['role']!=='admin'){throw new Error(_0x47a5('0x83'));}if(_['some'](_0x491bb4,[_0x47a5('0x32'),_0x47a5('0x2a')])&&_0x4f2fbb[_0x47a5('0x2c')]['role']!==_0x47a5('0x2a')){throw new Error(_0x47a5('0x8e'));}return licenseUtil['checkUserLimits'](_0x491bb4)[_0x47a5('0x12')](function(){return validateUser(_0x491bb4[0x0]);})[_0x47a5('0x12')](function(){for(var _0x19acfa=0x1;_0x19acfa<_0x491bb4[_0x47a5('0x48')];_0x19acfa++){var _0x58dacd=_0x491bb4[_0x19acfa-0x1]['internal'];if(!_0x491bb4[_0x19acfa][_0x47a5('0x67')])_0x491bb4[_0x19acfa][_0x47a5('0x67')]=_0x58dacd+0x1;_0x20d8bd['push'](validateUser(_0x491bb4[_0x19acfa]));}return BPromise[_0x47a5('0x4f')](_0x20d8bd);})[_0x47a5('0x12')](function(){_0x20d8bd=[];for(var _0x5a0901=0x0;_0x5a0901<_0x491bb4[_0x47a5('0x48')];_0x5a0901++){_0x20d8bd[_0x47a5('0x45')](updateUser(_0x491bb4[_0x5a0901]));}return BPromise[_0x47a5('0x4f')](_0x20d8bd);})['then'](function(){return BPromise[_0x47a5('0x8f')](_0x491bb4,function(_0x59b4a5){return db[_0x47a5('0x39')]['create'](_0x59b4a5,{'include':[{'model':db[_0x47a5('0x87')],'as':_0x47a5('0x87')}]})['then'](function(_0x35d9f0){_0x59b4a5['id']=_0x35d9f0['id'];return _0x59b4a5;});});})['then'](function(_0x1eabef){if(_0x4f2fbb[_0x47a5('0x5d')][_0x47a5('0x32')]===_0x47a5('0x2c'))return _0x1eabef;if(_0x4f2fbb['user'][_0x47a5('0x32')]!=='user')return _0x1eabef;var _0x52be82=_[_0x47a5('0x8d')](_0x1eabef,function(_0x46bdb1){return _0x46bdb1[_0x47a5('0x32')]===_0x47a5('0x73')||_0x46bdb1[_0x47a5('0x32')]==='telephone';});if(!_0x52be82)return _0x1eabef;return db[_0x47a5('0x88')][_0x47a5('0x46')]({'where':{'name':{'$or':[_0x47a5('0x90'),_0x47a5('0x2d')]},'userProfileId':_0x4f2fbb['user'][_0x47a5('0x91')]},'raw':!![]})['then'](function(_0x12891d){if(_[_0x47a5('0x92')](_0x12891d)||!_[_0x47a5('0x8d')](_0x12891d,[_0x47a5('0x89'),0x0]))return _0x1eabef;_0x20d8bd=[];var _0x29a1cf=_(_0x12891d)[_0x47a5('0x30')](function(_0x92bfd7){if(_0x92bfd7[_0x47a5('0x89')]===0x1)return;return _0x92bfd7[_0x47a5('0x36')]==='Agents'?_0x47a5('0x73'):_0x47a5('0x2e');})['compact']()[_0x47a5('0x31')]();for(var _0x32035e=0x0;_0x32035e<_0x1eabef[_0x47a5('0x48')];_0x32035e++){if(!_['includes'](_0x29a1cf,_0x1eabef[_0x32035e]['role']))return;var _0x126bb1=_0x1eabef[_0x32035e][_0x47a5('0x32')]==='agent'?'Agents':_0x47a5('0x2d');_0x20d8bd[_0x47a5('0x45')](db['UserProfileResource'][_0x47a5('0x82')]({'name':_0x1eabef[_0x32035e][_0x47a5('0x36')],'resourceId':_0x1eabef[_0x32035e]['id'],'type':_0x126bb1,'sectionId':_['find'](_0x12891d,[_0x47a5('0x36'),_0x126bb1])['id']},{}));}return BPromise[_0x47a5('0x4f')](_0x20d8bd);});})[_0x47a5('0x12')](respondWithResult(_0x3c012b,0xc9))[_0x47a5('0x1d')](handleError(_0x3c012b,null));};exports[_0x47a5('0x93')]=function(_0x1371e4,_0x5d89a1){if(_0x1371e4['body']['id']){delete _0x1371e4['body']['id'];}return db[_0x47a5('0x39')][_0x47a5('0x59')]({'where':{'id':_0x1371e4['params']['id']}})[_0x47a5('0x12')](function(_0x241f2a){if(!_0x241f2a)return null;if(_0x241f2a['id']===_0x1371e4[_0x47a5('0x2c')]['id']){if(!_0x1371e4[_0x47a5('0x5d')][_0x47a5('0x94')]||!_0x1371e4['body'][_0x47a5('0x95')]){throw new db['Sequelize']['ValidationError']('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x241f2a[_0x47a5('0x96')](_0x1371e4['body'][_0x47a5('0x94')])){throw new db[(_0x47a5('0x97'))][(_0x47a5('0x98'))]('Wrong\x20credentials');}if(_0x1371e4[_0x47a5('0x5d')][_0x47a5('0x94')]===_0x1371e4[_0x47a5('0x5d')][_0x47a5('0x95')]){throw new db[(_0x47a5('0x97'))]['ValidationError'](_0x47a5('0x99'));}}else if(_0x1371e4[_0x47a5('0x2c')]['role']===_0x47a5('0x2a')){if(!_0x1371e4[_0x47a5('0x5d')][_0x47a5('0x95')]){throw new db[(_0x47a5('0x97'))][(_0x47a5('0x98'))](_0x47a5('0x9a'));}}else if(_0x1371e4['user'][_0x47a5('0x32')]===_0x47a5('0x2c')){if(!_0x1371e4['body'][_0x47a5('0x95')]){throw new db[(_0x47a5('0x97'))][(_0x47a5('0x98'))](_0x47a5('0x9a'));}if(_0x241f2a['role']!=='agent'){throw new db['Sequelize']['ValidationError'](_0x47a5('0x8c'));}}else{throw new db[(_0x47a5('0x97'))][(_0x47a5('0x98'))](_0x47a5('0x8c'));}return _0x241f2a;})[_0x47a5('0x12')](handleEntityNotFound(_0x5d89a1,null))[_0x47a5('0x12')](function(_0xac1f9e){return db[_0x47a5('0x63')]['findOne']({'attributes':['id',_0x47a5('0x65'),_0x47a5('0x9b'),_0x47a5('0x9c')]})[_0x47a5('0x12')](function(_0x47be87){if(_0x47be87['securePassword'])authService[_0x47a5('0x66')](_0x1371e4['body']['newPassword']);if(!_0x47be87[_0x47a5('0x9b')]||!_0xac1f9e[_0x47a5('0x9d')])return _0xac1f9e;authService['validatePasswordHistory'](_0x1371e4[_0x47a5('0x5d')][_0x47a5('0x95')],_0xac1f9e[_0x47a5('0x9d')],_0x47be87['passwordHistoryLimit']);return _0xac1f9e;})[_0x47a5('0x12')](saveUpdates({'password':_0x1371e4[_0x47a5('0x5d')]['newPassword'],'passwordResetAt':_0x1371e4[_0x47a5('0x2c')]['id']==_0x1371e4[_0x47a5('0x60')]['id']?moment():null,'previousPasswords':authService[_0x47a5('0x9e')](_0x1371e4[_0x47a5('0x5d')][_0x47a5('0x95')],_0xac1f9e[_0x47a5('0x9d')])},null));})['then'](respondWithResult(_0x5d89a1,null))[_0x47a5('0x1d')](handleError(_0x5d89a1,null));};exports['addQueues']=function(_0x2a3f32,_0x3ab7ac){var _0xe3f69f=_0x2a3f32[_0x47a5('0x5d')]['channel'];return db[_0x47a5('0x39')][_0x47a5('0x59')]({'where':{'id':_0x2a3f32[_0x47a5('0x60')]['id']},'attributes':['id',_0x47a5('0x36'),_0x47a5('0x32'),_0x47a5('0x9f'),_0x47a5('0xa0'),_0x47a5('0xa1'),_0x47a5('0xa2')]})[_0x47a5('0x12')](handleEntityNotFound(_0x3ab7ac,null))[_0x47a5('0x12')](function(_0x301031){if(_0x301031){if(!utils['isValidChannel'](_0xe3f69f)){throw new db[(_0x47a5('0x97'))][(_0x47a5('0x98'))]('Unknown\x20channel');}return _0x301031[_0x47a5('0xa3')+_[_0x47a5('0xa4')](_0xe3f69f[_0x47a5('0xa5')]())+_0x47a5('0xa6')](_0x2a3f32[_0x47a5('0x5d')]['ids'],{'penalty':_0x2a3f32[_0x47a5('0x5d')][_0x47a5('0xa7')]||0x0})[_0x47a5('0xa8')](function(_0x266a2f){for(var _0x343214=0x0;_0x343214<_0x2a3f32[_0x47a5('0x5d')][_0x47a5('0x61')]['length'];_0x343214+=0x1){var _0x596562={'UserId':Number(_0x2a3f32[_0x47a5('0x60')]['id'])};_0x596562[_['capitalize'](_0xe3f69f[_0x47a5('0xa5')]())+'QueueId']=Number(_0x2a3f32[_0x47a5('0x5d')][_0x47a5('0x61')][_0x343214]);socket[_0x47a5('0xa9')](_0x47a5('0x2c')+_['capitalize'](_0xe3f69f[_0x47a5('0xa5')]())+_0x47a5('0xaa'),_0x596562);}return _0x266a2f;})[_0x47a5('0x12')](function(){if(_0xe3f69f==='voice'){return db['VoiceQueue'][_0x47a5('0x46')]({'where':{'id':_0x2a3f32[_0x47a5('0x5d')][_0x47a5('0x61')]||[]},'raw':!![],'attributes':['id',_0x47a5('0x36')]});}})[_0x47a5('0x12')](function(_0x402bba){var _0x1c0323=_0x301031[_0x47a5('0x29')]({'plain':!![]});var _0x566630=[];if(_0xe3f69f===_0x47a5('0xab')&&_0x1c0323['role']===_0x47a5('0x73')&&_0x1c0323[_0x47a5('0x9f')]){for(var _0x5b0b0b=0x0;_0x5b0b0b<_0x402bba['length'];_0x5b0b0b+=0x1){_0x566630[_0x47a5('0x45')]({'membername':_0x1c0323[_0x47a5('0x36')],'UserId':_0x1c0323['id'],'queue_name':_0x402bba[_0x5b0b0b]['name'],'VoiceQueueId':_0x402bba[_0x5b0b0b]['id'],'interface':_[_0x47a5('0x68')](_0x1c0323[_0x47a5('0xa2')])?util[_0x47a5('0xac')](_0x47a5('0xad'),_0x1c0323['name']):_0x1c0323[_0x47a5('0xa2')],'paused':_0x1c0323['voicePause']||![],'penalty':_0x2a3f32['body']['penalty']||0x0});}return BPromise[_0x47a5('0x8f')](_0x566630,function(_0x5a975d){return db[_0x47a5('0xae')][_0x47a5('0xaf')](_0x5a975d);});}return _0x301031;});}})[_0x47a5('0x12')](respondWithStatusCode(_0x3ab7ac,null))[_0x47a5('0x1d')](handleError(_0x3ab7ac,null));};exports[_0x47a5('0xb0')]=function(_0x1dae08,_0x6cd737){var _0x62d3a4;return db[_0x47a5('0x39')][_0x47a5('0x59')]({'where':{'id':_0x1dae08[_0x47a5('0x60')]['id']},'attributes':['id',_0x47a5('0x36'),_0x47a5('0x32')]})[_0x47a5('0x12')](handleEntityNotFound(_0x6cd737,null))[_0x47a5('0x12')](function(_0x5e17cb){if(_0x5e17cb){_0x62d3a4=_0x5e17cb;if(!_0x1dae08[_0x47a5('0x40')][_0x47a5('0xb1')]||!utils[_0x47a5('0xb2')](_0x1dae08[_0x47a5('0x40')]['channel'])){throw new db[(_0x47a5('0x97'))]['ValidationError'](_0x47a5('0xb3'));}return _0x5e17cb['remove'+_[_0x47a5('0xa4')](_0x1dae08[_0x47a5('0x40')][_0x47a5('0xb1')]['toLowerCase']())+_0x47a5('0xa6')](_0x1dae08[_0x47a5('0x40')][_0x47a5('0x61')]);}})['then'](function(_0x52798d){if(_[_0x47a5('0xb4')](_0x1dae08[_0x47a5('0x40')][_0x47a5('0x61')])){for(var _0x4594df=0x0;_0x4594df<_0x1dae08[_0x47a5('0x40')]['ids'][_0x47a5('0x48')];_0x4594df+=0x1){var _0x481bc3={'UserId':Number(_0x1dae08[_0x47a5('0x60')]['id'])};_0x481bc3[_[_0x47a5('0xa4')](_0x1dae08[_0x47a5('0x40')][_0x47a5('0xb1')]['toLowerCase']())+'QueueId']=Number(_0x1dae08[_0x47a5('0x40')][_0x47a5('0x61')][_0x4594df]);socket[_0x47a5('0xa9')](_0x47a5('0x2c')+_[_0x47a5('0xa4')](_0x1dae08[_0x47a5('0x40')][_0x47a5('0xb1')][_0x47a5('0xa5')]())+_0x47a5('0xb5'),_0x481bc3);}}else{var _0x481bc3={'UserId':Number(_0x1dae08['params']['id'])};_0x481bc3[_[_0x47a5('0xa4')](_0x1dae08['query'][_0x47a5('0xb1')][_0x47a5('0xa5')]())+_0x47a5('0xb6')]=Number(_0x1dae08['query'][_0x47a5('0x61')]);socket[_0x47a5('0xa9')]('user'+_[_0x47a5('0xa4')](_0x1dae08['query'][_0x47a5('0xb1')][_0x47a5('0xa5')]())+_0x47a5('0xb5'),_0x481bc3);}return _0x52798d;})['then'](function(){if(_0x1dae08['query']['channel']==='voice'){return db['UserVoiceQueueRt'][_0x47a5('0x34')]({'where':{'UserId':_0x1dae08['params']['id'],'VoiceQueueId':_0x1dae08[_0x47a5('0x40')][_0x47a5('0x61')]},'individualHooks':!![]})['then'](function(){return _0x62d3a4;});}return _0x62d3a4;})['then'](respondWithStatusCode(_0x6cd737,null))['catch'](handleError(_0x6cd737,null));};exports[_0x47a5('0xb7')]=function(_0x4e0dfa,_0x4ec4a8){_0x4e0dfa['body'][_0x47a5('0xb8')]=_0x4e0dfa[_0x47a5('0xb9')][_0x47a5('0xba')];return db[_0x47a5('0x39')]['find']({'where':{'id':_0x4e0dfa[_0x47a5('0x60')]['id']}})['then'](handleEntityNotFound(_0x4ec4a8,null))[_0x47a5('0x12')](saveUpdates(_0x4e0dfa['body'],null))[_0x47a5('0x12')](respondWithResult(_0x4ec4a8,null))[_0x47a5('0x1d')](handleError(_0x4ec4a8,null));};exports[_0x47a5('0xbb')]=function(_0x4f8171,_0x106bbe){var _0x427c02=path[_0x47a5('0xbc')](config[_0x47a5('0xbd')],'server/files/images/logos/default_profile.png');return db[_0x47a5('0x39')][_0x47a5('0x59')]({'where':{'id':_0x4f8171[_0x47a5('0x60')]['id']},'attributes':['id',_0x47a5('0xb8')],'raw':!![]})[_0x47a5('0x12')](handleEntityNotFound(_0x106bbe,null))[_0x47a5('0x12')](function(_0x598825){if(_0x598825){if(_[_0x47a5('0x68')](_0x598825[_0x47a5('0xb8')])){return _0x106bbe[_0x47a5('0xbe')](_0x427c02);}else{if(!fs[_0x47a5('0xbf')](path[_0x47a5('0xbc')](config[_0x47a5('0xbd')],_0x47a5('0xc0'),_0x598825[_0x47a5('0xb8')]))){return _0x106bbe[_0x47a5('0xbe')](_0x427c02);}return _0x106bbe[_0x47a5('0xbe')](path[_0x47a5('0xbc')](config[_0x47a5('0xbd')],_0x47a5('0xc0'),_0x598825[_0x47a5('0xb8')]));}}})[_0x47a5('0x1d')](handleError(_0x106bbe,null));};exports[_0x47a5('0xc1')]=function(_0x40505e,_0x4c181e){return db[_0x47a5('0x39')]['find']({'where':{'id':_0x40505e['params']['id']},'attributes':['id']})[_0x47a5('0x12')](handleEntityNotFound(_0x4c181e,null))[_0x47a5('0x12')](function(_0x36f910){var _0x4d4039=[];values=_0x36f910[_0x47a5('0x4a')];_0x4d4039[_0x47a5('0x45')](get_open_tabs(_0x47a5('0x49'),_0x36f910[_0x47a5('0x4a')]));_0x4d4039[_0x47a5('0x45')](get_open_tabs(_0x47a5('0x5c'),_0x36f910[_0x47a5('0x4a')]));_0x4d4039[_0x47a5('0x45')](get_open_tabs(_0x47a5('0x4d'),_0x36f910[_0x47a5('0x4a')]));_0x4d4039[_0x47a5('0x45')](get_open_tabs(_0x47a5('0x4e'),_0x36f910[_0x47a5('0x4a')]));_0x4d4039['push'](get_open_tabs('fax',_0x36f910[_0x47a5('0x4a')]));_0x4d4039['push'](get_open_tabs(_0x47a5('0x4c'),_0x36f910[_0x47a5('0x4a')]));return BPromise[_0x47a5('0x4f')](_0x4d4039);})[_0x47a5('0x12')](function(_0x2bdd28){var _0x3708ea=[];if(_0x2bdd28){for(var _0x258b96=0x0;_0x258b96=_0x598aa4){_0xeff822=_0x598aa4;_0x2a20ed=0xc8;}else{_0x2a20ed=0xce;}_0x145771[_0xd187('0x21')](_0x2a20ed);return _0x145771['set'](_0xd187('0x25'),_0x4eac6a+'-'+_0xeff822+'/'+_0x598aa4)[_0xd187('0x26')](_0x1047f4);}return null;};}function saveUpdates(_0x34febe){return function(_0x4c50a5){if(_0x4c50a5){return _0x4c50a5[_0xd187('0x27')](_0x34febe)['then'](function(_0x263e31){return _0x263e31;});}return null;};}function removeEntity(_0x19e75f){return function(_0x1e7750){if(_0x1e7750){return _0x1e7750[_0xd187('0x28')]()['then'](function(){var _0x140e54=_0x1e7750[_0xd187('0x29')]({'plain':!![]});if(_0x140e54['role']==='admin')return;var _0x1a1922=[{'name':_0xd187('0x2a'),'value':_0xd187('0x2b'),'ignore':!![]},{'name':_0xd187('0x2c'),'value':_0xd187('0x2d'),'ignore':![]},{'name':_0xd187('0x2e'),'value':_0xd187('0x2f'),'ignore':![]}];var _0x4713df=_(_0x1a1922)['filter'](_0xd187('0x30'))[_0xd187('0x31')](_0xd187('0x32'))['value']();if(_[_0xd187('0x33')](_0x4713df,_0x140e54['role'])){return;}var _0xb3efa3=_[_0xd187('0x34')](_0x1a1922,[_0xd187('0x32'),_0x140e54['role']])['name'];return db[_0xd187('0x35')][_0xd187('0x28')]({'where':{'type':_0xb3efa3,'resourceId':_0x140e54['id']}})['then'](function(){return _0x1e7750;});})[_0xd187('0x16')](function(){_0x19e75f[_0xd187('0x21')](0xcc)[_0xd187('0x20')]();});}};}function handleEntityNotFound(_0x54abed){return function(_0x527c6f){if(!_0x527c6f){_0x54abed[_0xd187('0x36')](0x194);}return _0x527c6f;};}function handleError(_0xf32da2,_0x556146){_0x556146=_0x556146||0x1f4;return function(_0x51f5bf){logger['error'](_0x51f5bf[_0xd187('0x37')]);if(_0x51f5bf['name']){delete _0x51f5bf[_0xd187('0x38')];}_0xf32da2[_0xd187('0x21')](_0x556146)['send'](_0x51f5bf);};}exports[_0xd187('0x39')]=function(_0x5674ca,_0x293ce9){var _0x2db36e={},_0x4af59f={'count':0x0,'rows':[]};var _0x1a6256=_(db[_0xd187('0x3a')]['rawAttributes'])[_0xd187('0x31')](function(_0x5ec6cd){return{'name':_0x5ec6cd['fieldName'],'type':_0x5ec6cd[_0xd187('0x3b')][_0xd187('0x3c')]};})[_0xd187('0x3d')](function(_0x1a8f54){return!_[_0xd187('0x33')](['password',_0xd187('0x3e')],_0x1a8f54[_0xd187('0x38')]);})[_0xd187('0x32')]();_0x2db36e=qs['getOptions'](_0x1a6256,_0x5674ca);var _0x4b121c={'where':_0x2db36e['where']};return db['User'][_0xd187('0x24')](_0x4b121c)[_0xd187('0x16')](function(_0x3d74cc){_0x4af59f[_0xd187('0x24')]=_0x3d74cc;if(_0x5674ca[_0xd187('0x3f')][_0xd187('0x40')]){_0x2db36e[_0xd187('0x41')]=[{'all':!![]}];}if(!_[_0xd187('0x33')](_0x2db36e['attributes'],'id')){_0x2db36e[_0xd187('0x42')][_0xd187('0x43')]('id');}return db[_0xd187('0x3a')]['findAll'](_0x2db36e);})[_0xd187('0x16')](function(_0x48c100){_0x4af59f[_0xd187('0x44')]=_0x48c100;if(_0x5674ca[_0xd187('0x3f')][_0xd187('0x45')]===_0xd187('0x46')){var _0x3cea48=[];for(var _0x49c26e=0x0;_0x49c26e<_0x4af59f[_0xd187('0x44')][_0xd187('0x47')];_0x49c26e++){_0x3cea48[_0xd187('0x43')](get_open_tabs(_0xd187('0x48'),_0x4af59f['rows'][_0x49c26e][_0xd187('0x49')]));_0x3cea48[_0xd187('0x43')](get_open_tabs('sms',_0x4af59f[_0xd187('0x44')][_0x49c26e][_0xd187('0x49')]));_0x3cea48['push'](get_open_tabs('fax',_0x4af59f[_0xd187('0x44')][_0x49c26e][_0xd187('0x49')]));_0x3cea48['push'](get_open_tabs('mail',_0x4af59f['rows'][_0x49c26e][_0xd187('0x49')]));_0x3cea48[_0xd187('0x43')](get_open_tabs(_0xd187('0x4a'),_0x4af59f[_0xd187('0x44')][_0x49c26e][_0xd187('0x49')]));_0x3cea48[_0xd187('0x43')](get_open_tabs(_0xd187('0x4b'),_0x4af59f['rows'][_0x49c26e][_0xd187('0x49')]));}return BPromise[_0xd187('0x4c')](_0x3cea48)[_0xd187('0x16')](function(_0x3ce4a1){return _0x4af59f;});}else{return _0x4af59f;}})[_0xd187('0x16')](respondWithFilteredResult(_0x293ce9,_0x2db36e))[_0xd187('0x1f')](handleError(_0x293ce9,null));};exports[_0xd187('0x4d')]=function(_0x3400a0,_0x4e4a32){var _0x368348={'raw':![],'where':{'id':_0x3400a0[_0xd187('0x4e')]['id']}},_0x2657be={};_0x2657be[_0xd187('0x4f')]=_[_0xd187('0x50')](_['keys'](db[_0xd187('0x3a')][_0xd187('0x51')]),['password',_0xd187('0x3e')]);_0x2657be[_0xd187('0x3f')]=_['keys'](_0x3400a0['query']);_0x2657be['filters']=_['intersection'](_0x2657be[_0xd187('0x4f')],_0x2657be[_0xd187('0x3f')]);_0x368348[_0xd187('0x42')]=_[_0xd187('0x52')](_0x2657be[_0xd187('0x4f')],qs[_0xd187('0x53')](_0x3400a0[_0xd187('0x3f')]['fields']));_0x368348[_0xd187('0x42')]=_0x368348[_0xd187('0x42')][_0xd187('0x47')]?_0x368348[_0xd187('0x42')]:_0x2657be['model'];if(_0x3400a0[_0xd187('0x3f')]['includeAll']){_0x368348['include']=[{'all':!![]}];}_0x368348=_[_0xd187('0x54')]({},_0x368348,_0x3400a0['options']);if(!_[_0xd187('0x33')](_0x368348[_0xd187('0x42')],'id')){_0x368348[_0xd187('0x42')][_0xd187('0x43')]('id');}return db[_0xd187('0x3a')][_0xd187('0x34')](_0x368348)[_0xd187('0x16')](handleEntityNotFound(_0x4e4a32,null))[_0xd187('0x16')](function(_0x1649a2){var _0x55e954=[];values=_0x1649a2;if(_0x3400a0[_0xd187('0x3f')][_0xd187('0x45')]==='true'){_0x55e954[_0xd187('0x43')](get_open_tabs(_0xd187('0x48'),_0x1649a2[_0xd187('0x49')]));_0x55e954['push'](get_open_tabs(_0xd187('0x55'),_0x1649a2[_0xd187('0x49')]));_0x55e954['push'](get_open_tabs(_0xd187('0x4a'),_0x1649a2[_0xd187('0x49')]));_0x55e954['push'](get_open_tabs(_0xd187('0x4b'),_0x1649a2['dataValues']));_0x55e954[_0xd187('0x43')](get_open_tabs(_0xd187('0x56'),_0x1649a2[_0xd187('0x49')]));_0x55e954[_0xd187('0x43')](get_open_tabs(_0xd187('0x57'),_0x1649a2[_0xd187('0x49')]));return BPromise[_0xd187('0x4c')](_0x55e954);}else{return values;}})['then'](function(_0xcef6ca){return values;})[_0xd187('0x16')](respondWithResult(_0x4e4a32,null))[_0xd187('0x1f')](handleError(_0x4e4a32,null));};exports['update']=function(_0x374e30,_0x23428f){if(_0x374e30[_0xd187('0x58')]['id']){delete _0x374e30[_0xd187('0x58')]['id'];}delete _0x374e30[_0xd187('0x58')][_0xd187('0x59')];return db[_0xd187('0x3a')][_0xd187('0x34')]({'where':{'id':_0x374e30[_0xd187('0x4e')]['id']}})[_0xd187('0x16')](handleEntityNotFound(_0x23428f,null))[_0xd187('0x16')](saveUpdates(_0x374e30[_0xd187('0x58')],null))[_0xd187('0x16')](respondWithResult(_0x23428f,null))[_0xd187('0x1f')](handleError(_0x23428f,null));};exports[_0xd187('0x5a')]=function(_0xaff1e6,_0x42fb32){return db[_0xd187('0x3a')][_0xd187('0x5a')]()[_0xd187('0x16')](respondWithResult(_0x42fb32,null))['catch'](handleError(_0x42fb32,null));};exports[_0xd187('0x5b')]=function(_0x48c82d,_0x13d118){return db[_0xd187('0x3a')][_0xd187('0x34')]({'where':{'id':_0x48c82d[_0xd187('0x4e')]['id']}})['then'](handleEntityNotFound(_0x13d118,null))[_0xd187('0x16')](function(_0x2eda30){if(_0x2eda30){return _0x2eda30['addContacts'](_0x48c82d['body'][_0xd187('0x5c')],_[_0xd187('0x5d')](_0x48c82d[_0xd187('0x58')],[_0xd187('0x5c'),'id'])||{});}})['then'](respondWithResult(_0x13d118,null))[_0xd187('0x1f')](handleError(_0x13d118,null));};function validateUser(_0x49543f){return new BPromise(function(_0x1971b2,_0x2f6a72){if(_0x49543f[_0xd187('0x5e')])return _0x1971b2(_0x49543f);return db[_0xd187('0x5f')]['findById'](0x1)[_0xd187('0x16')](function(_0xaea7e0){if(_0xaea7e0[_0xd187('0x60')])authService[_0xd187('0x61')](_0x49543f[_0xd187('0x62')]);db['User']['max'](_0xd187('0x5e'))[_0xd187('0x16')](function(_0x167eaf){if(_[_0xd187('0x63')](_0x167eaf)){_0x49543f[_0xd187('0x5e')]=_0xaea7e0[_0xd187('0x64')]||0x1;return;}if(_[_0xd187('0x63')](_0xaea7e0[_0xd187('0x64')])||_0xaea7e0[_0xd187('0x64')]===_0x167eaf){_0x49543f[_0xd187('0x5e')]=_0x167eaf+0x1;return;}if(_0xaea7e0[_0xd187('0x64')]>_0x167eaf){_0x49543f[_0xd187('0x5e')]=_0xaea7e0['min_internal'];return;}return db[_0xd187('0x65')][_0xd187('0x3f')]('select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)',{'type':db[_0xd187('0x65')][_0xd187('0x66')]['SELECT']})['then'](function(_0x32ba2a){if(_0x32ba2a&&_0x32ba2a[_0xd187('0x47')]){for(var _0x2ac56f=0x0,_0x2f743b=_0x32ba2a['length'];_0x2ac56f<_0x2f743b&&_[_0xd187('0x63')](_0x49543f[_0xd187('0x5e')]);_0x2ac56f++){if(_0xaea7e0['min_internal']<=_0x32ba2a[_0x2ac56f]['from']){_0x49543f[_0xd187('0x5e')]=_0x32ba2a[_0x2ac56f]['from'];}else if(_0xaea7e0[_0xd187('0x64')]>_0x32ba2a[_0x2ac56f][_0xd187('0x67')]&&_0xaea7e0['min_internal']<=_0x32ba2a[_0x2ac56f]['to']){_0x49543f[_0xd187('0x5e')]=_0xaea7e0['min_internal'];}}}if(_[_0xd187('0x63')](_0x49543f['internal'])){_0x49543f['internal']=_0x167eaf+0x1;}return _0x1971b2(_0x49543f);});});})['catch'](function(_0x16d9ea){_0x2f6a72(_0x16d9ea);});});}function updateUser(_0x243063){return new BPromise(function(_0x421585,_0x216829){try{if(_0x243063[_0xd187('0x68')]){_0x243063[_0xd187('0x69')]=_0x243063[_0xd187('0x5e')];_0x243063[_0xd187('0x6a')]={'mailbox':_0x243063['internal'],'password':_0x243063[_0xd187('0x62')],'fullname':_0x243063[_0xd187('0x6b')],'email':_0x243063[_0xd187('0x6c')]};}if(_0x243063['role']===_0xd187('0x2d')){if(!_0x243063[_0xd187('0x6d')])_0x243063[_0xd187('0x6d')]=[_0xd187('0x6e'),'102',_0xd187('0x6f'),_0xd187('0x70'),'110',_0xd187('0x71'),_0xd187('0x72'),_0xd187('0x73'),_0xd187('0x74'),'108',_0xd187('0x75'),_0xd187('0x76'),'111',_0xd187('0x77'),'115'];}_0x421585(_0x243063);}catch(_0x47c27c){_0x216829(_0x47c27c);}});}exports['create']=function(_0x7cbbac,_0x28472d){if(_0x7cbbac[_0xd187('0x2b')][_0xd187('0x59')]===_0xd187('0x2d'))throw new Error(_0xd187('0x78'));if(_0x7cbbac['body'][_0xd187('0x59')]===_0xd187('0x2b')&&_0x7cbbac['user']['role']!==_0xd187('0x79')){throw new Error(_0xd187('0x7a'));}if(_0x7cbbac[_0xd187('0x58')][_0xd187('0x59')]===_0xd187('0x79')&&_0x7cbbac[_0xd187('0x2b')]['role']!==_0xd187('0x79')){throw new Error(_0xd187('0x7b'));}return licenseUtil[_0xd187('0x7c')]([_0x7cbbac[_0xd187('0x58')]])[_0xd187('0x16')](function(){return validateUser(_0x7cbbac[_0xd187('0x58')]);})[_0xd187('0x16')](function(_0x1e58d4){return updateUser(_0x1e58d4)[_0xd187('0x16')](function(_0xf31fac){if(_0xf31fac[_0xd187('0x59')]===_0xd187('0x79')){_0xf31fac['settingsEnabled']=_0x7cbbac['user'][_0xd187('0x7d')];delete _0xf31fac[_0xd187('0x7e')];}return _0xf31fac;});})[_0xd187('0x16')](function(_0x147c96){return db[_0xd187('0x3a')][_0xd187('0x7f')](_0x147c96,{'include':[{'model':db['VoiceMail'],'as':_0xd187('0x6a')}]});})['then'](function(_0x2b2df3){if(_0x7cbbac['body']['role']===_0xd187('0x2b'))return _0x2b2df3;if(_0x7cbbac['user'][_0xd187('0x59')]!==_0xd187('0x2b'))return _0x2b2df3;return db[_0xd187('0x80')][_0xd187('0x34')]({'where':{'name':_0x2b2df3[_0xd187('0x59')]===_0xd187('0x2d')?_0xd187('0x2c'):_0xd187('0x2e'),'userProfileId':_0x7cbbac[_0xd187('0x2b')][_0xd187('0x7e')]},'raw':!![]})[_0xd187('0x16')](function(_0x3ae931){if(!_0x3ae931||_0x3ae931[_0xd187('0x81')]!=0x0)return _0x2b2df3;return db[_0xd187('0x35')][_0xd187('0x7f')]({'name':_0x2b2df3['name'],'resourceId':_0x2b2df3['id'],'type':_0x3ae931[_0xd187('0x38')],'sectionId':_0x3ae931['id']},{})[_0xd187('0x16')](function(){return _0x2b2df3;});})[_0xd187('0x1f')](function(_0x43563b){logger['error'](_0xd187('0x82'),_0x43563b);throw _0x43563b;});})[_0xd187('0x16')](respondWithResult(_0x28472d,0xc9))['catch'](handleError(_0x28472d,null));};exports['bulkCreate']=function(_0x20b680,_0x3c993a){var _0x7fdb14=_0x20b680[_0xd187('0x58')];var _0x371869=[];if(_0x20b680[_0xd187('0x2b')]['role']===_0xd187('0x2d'))throw new Error(_0xd187('0x78'));if(_['some'](_0x7fdb14,[_0xd187('0x59'),_0xd187('0x2b')])&&_0x20b680[_0xd187('0x2b')][_0xd187('0x59')]!=='admin'){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_[_0xd187('0x83')](_0x7fdb14,[_0xd187('0x59'),_0xd187('0x79')])&&_0x20b680['user'][_0xd187('0x59')]!==_0xd187('0x79')){throw new Error(_0xd187('0x84'));}return licenseUtil[_0xd187('0x7c')](_0x7fdb14)['then'](function(){return validateUser(_0x7fdb14[0x0]);})[_0xd187('0x16')](function(){for(var _0x4efb9f=0x1;_0x4efb9f<_0x7fdb14['length'];_0x4efb9f++){var _0x4a9310=_0x7fdb14[_0x4efb9f-0x1]['internal'];if(!_0x7fdb14[_0x4efb9f]['internal'])_0x7fdb14[_0x4efb9f]['internal']=_0x4a9310+0x1;_0x371869['push'](validateUser(_0x7fdb14[_0x4efb9f]));}return BPromise[_0xd187('0x4c')](_0x371869);})[_0xd187('0x16')](function(){_0x371869=[];for(var _0x4c5879=0x0;_0x4c5879<_0x7fdb14[_0xd187('0x47')];_0x4c5879++){_0x371869[_0xd187('0x43')](updateUser(_0x7fdb14[_0x4c5879]));}return BPromise[_0xd187('0x4c')](_0x371869);})[_0xd187('0x16')](function(){return BPromise[_0xd187('0x85')](_0x7fdb14,function(_0x4a1189){return db[_0xd187('0x3a')]['create'](_0x4a1189,{'include':[{'model':db[_0xd187('0x6a')],'as':_0xd187('0x6a')}]})[_0xd187('0x16')](function(_0x36e6ae){_0x4a1189['id']=_0x36e6ae['id'];return _0x4a1189;});});})[_0xd187('0x16')](function(_0x18690e){if(_0x20b680[_0xd187('0x58')]['role']===_0xd187('0x2b'))return _0x18690e;if(_0x20b680[_0xd187('0x2b')]['role']!==_0xd187('0x2b'))return _0x18690e;var _0x3720f1=_['some'](_0x18690e,function(_0x348b73){return _0x348b73[_0xd187('0x59')]===_0xd187('0x2d')||_0x348b73[_0xd187('0x59')]===_0xd187('0x2f');});if(!_0x3720f1)return _0x18690e;return db[_0xd187('0x80')][_0xd187('0x86')]({'where':{'name':{'$or':[_0xd187('0x2c'),'Telephones']},'userProfileId':_0x20b680[_0xd187('0x2b')][_0xd187('0x7e')]},'raw':!![]})[_0xd187('0x16')](function(_0x44ac47){if(_[_0xd187('0x87')](_0x44ac47)||!_[_0xd187('0x83')](_0x44ac47,['autoAssociation',0x0]))return _0x18690e;_0x371869=[];var _0x4fcf43=_(_0x44ac47)[_0xd187('0x31')](function(_0x3c9248){if(_0x3c9248['autoAssociation']===0x1)return;return _0x3c9248[_0xd187('0x38')]===_0xd187('0x2c')?_0xd187('0x2d'):_0xd187('0x2f');})[_0xd187('0x88')]()[_0xd187('0x32')]();for(var _0x578de9=0x0;_0x578de9<_0x18690e[_0xd187('0x47')];_0x578de9++){if(!_[_0xd187('0x33')](_0x4fcf43,_0x18690e[_0x578de9][_0xd187('0x59')]))return;var _0x23e30b=_0x18690e[_0x578de9][_0xd187('0x59')]===_0xd187('0x2d')?_0xd187('0x2c'):_0xd187('0x2e');_0x371869[_0xd187('0x43')](db['UserProfileResource'][_0xd187('0x7f')]({'name':_0x18690e[_0x578de9][_0xd187('0x38')],'resourceId':_0x18690e[_0x578de9]['id'],'type':_0x23e30b,'sectionId':_[_0xd187('0x34')](_0x44ac47,['name',_0x23e30b])['id']},{}));}return BPromise[_0xd187('0x4c')](_0x371869);});})[_0xd187('0x16')](respondWithResult(_0x3c993a,0xc9))[_0xd187('0x1f')](handleError(_0x3c993a,null));};exports[_0xd187('0x89')]=function(_0x1e0e80,_0xec0779){if(_0x1e0e80['body']['id']){delete _0x1e0e80[_0xd187('0x58')]['id'];}return db[_0xd187('0x3a')][_0xd187('0x34')]({'where':{'id':_0x1e0e80['params']['id']}})[_0xd187('0x16')](function(_0xd39f2a){if(!_0xd39f2a)return null;if(_0xd39f2a['id']===_0x1e0e80[_0xd187('0x2b')]['id']){if(!_0x1e0e80[_0xd187('0x58')][_0xd187('0x8a')]||!_0x1e0e80[_0xd187('0x58')]['newPassword']){throw new db[(_0xd187('0x8b'))][(_0xd187('0x8c'))]('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0xd39f2a[_0xd187('0x8d')](_0x1e0e80[_0xd187('0x58')]['oldPassword'])){throw new db[(_0xd187('0x8b'))][(_0xd187('0x8c'))]('Wrong\x20credentials');}if(_0x1e0e80[_0xd187('0x58')][_0xd187('0x8a')]===_0x1e0e80['body'][_0xd187('0x8e')]){throw new db['Sequelize'][(_0xd187('0x8c'))](_0xd187('0x8f'));}}else if(_0x1e0e80[_0xd187('0x2b')][_0xd187('0x59')]===_0xd187('0x79')){if(!_0x1e0e80['body']['newPassword']){throw new db[(_0xd187('0x8b'))][(_0xd187('0x8c'))](_0xd187('0x90'));}}else if(_0x1e0e80[_0xd187('0x2b')][_0xd187('0x59')]===_0xd187('0x2b')){if(!_0x1e0e80[_0xd187('0x58')]['newPassword']){throw new db[(_0xd187('0x8b'))][(_0xd187('0x8c'))](_0xd187('0x90'));}if(_0xd39f2a[_0xd187('0x59')]!==_0xd187('0x2d')){throw new db[(_0xd187('0x8b'))]['ValidationError'](_0xd187('0x78'));}}else{throw new db[(_0xd187('0x8b'))][(_0xd187('0x8c'))](_0xd187('0x78'));}return _0xd39f2a;})[_0xd187('0x16')](handleEntityNotFound(_0xec0779,null))[_0xd187('0x16')](function(_0x1c6433){return db[_0xd187('0x5f')]['findOne']({'attributes':['id',_0xd187('0x60'),'enforcePasswordHistory',_0xd187('0x91')]})[_0xd187('0x16')](function(_0x4853a8){if(_0x4853a8[_0xd187('0x60')])authService[_0xd187('0x61')](_0x1e0e80['body'][_0xd187('0x8e')]);if(!_0x4853a8['enforcePasswordHistory']||!_0x1c6433[_0xd187('0x92')])return _0x1c6433;authService['validatePasswordHistory'](_0x1e0e80['body'][_0xd187('0x8e')],_0x1c6433[_0xd187('0x92')],_0x4853a8[_0xd187('0x91')]);return _0x1c6433;})[_0xd187('0x16')](saveUpdates({'password':_0x1e0e80['body'][_0xd187('0x8e')],'passwordResetAt':_0x1e0e80[_0xd187('0x2b')]['id']==_0x1e0e80[_0xd187('0x4e')]['id']?moment():null,'previousPasswords':authService[_0xd187('0x93')](_0x1e0e80[_0xd187('0x58')][_0xd187('0x8e')],_0x1c6433[_0xd187('0x92')])},null));})[_0xd187('0x16')](respondWithResult(_0xec0779,null))[_0xd187('0x1f')](handleError(_0xec0779,null));};exports[_0xd187('0x94')]=function(_0x52f520,_0x74f8d7){var _0x8c3b2a=_0x52f520[_0xd187('0x58')]['channel'];return db['User'][_0xd187('0x34')]({'where':{'id':_0x52f520[_0xd187('0x4e')]['id']},'attributes':['id',_0xd187('0x38'),'role','online',_0xd187('0x95'),_0xd187('0x96'),'interface']})[_0xd187('0x16')](handleEntityNotFound(_0x74f8d7,null))[_0xd187('0x16')](function(_0x361f8b){if(_0x361f8b){if(!utils[_0xd187('0x97')](_0x8c3b2a)){throw new db['Sequelize'][(_0xd187('0x8c'))](_0xd187('0x98'));}return _0x361f8b[_0xd187('0x99')+_[_0xd187('0x9a')](_0x8c3b2a[_0xd187('0x9b')]())+_0xd187('0x9c')](_0x52f520[_0xd187('0x58')]['ids'],{'penalty':_0x52f520[_0xd187('0x58')]['penalty']||0x0})[_0xd187('0x9d')](function(_0x4f50a8){for(var _0x3a1101=0x0;_0x3a1101<_0x52f520['body'][_0xd187('0x5c')][_0xd187('0x47')];_0x3a1101+=0x1){var _0x388797={'UserId':Number(_0x52f520['params']['id'])};_0x388797[_[_0xd187('0x9a')](_0x8c3b2a[_0xd187('0x9b')]())+_0xd187('0x9e')]=Number(_0x52f520[_0xd187('0x58')][_0xd187('0x5c')][_0x3a1101]);socket[_0xd187('0x9f')](_0xd187('0x2b')+_[_0xd187('0x9a')](_0x8c3b2a['toLowerCase']())+_0xd187('0xa0'),_0x388797);}return _0x4f50a8;})[_0xd187('0x16')](function(){if(_0x8c3b2a===_0xd187('0xa1')){return db['VoiceQueue'][_0xd187('0x86')]({'where':{'id':_0x52f520[_0xd187('0x58')][_0xd187('0x5c')]||[]},'raw':!![],'attributes':['id',_0xd187('0x38')]});}})[_0xd187('0x16')](function(_0x28bc14){var _0x2e4db4=_0x361f8b[_0xd187('0x29')]({'plain':!![]});var _0xbb4a68=[];if(_0x8c3b2a===_0xd187('0xa1')&&_0x2e4db4[_0xd187('0x59')]==='agent'&&_0x2e4db4[_0xd187('0xa2')]){for(var _0x7960ed=0x0;_0x7960ed<_0x28bc14[_0xd187('0x47')];_0x7960ed+=0x1){_0xbb4a68[_0xd187('0x43')]({'membername':_0x2e4db4['name'],'UserId':_0x2e4db4['id'],'queue_name':_0x28bc14[_0x7960ed][_0xd187('0x38')],'VoiceQueueId':_0x28bc14[_0x7960ed]['id'],'interface':_['isNil'](_0x2e4db4[_0xd187('0xa3')])?util[_0xd187('0xa4')](_0xd187('0xa5'),_0x2e4db4[_0xd187('0x38')]):_0x2e4db4[_0xd187('0xa3')],'paused':_0x2e4db4['voicePause']||![],'penalty':_0x52f520[_0xd187('0x58')][_0xd187('0xa6')]||0x0});}return BPromise[_0xd187('0x85')](_0xbb4a68,function(_0x31c17b){return db[_0xd187('0xa7')]['upsert'](_0x31c17b);});}return _0x361f8b;});}})[_0xd187('0x16')](respondWithStatusCode(_0x74f8d7,null))[_0xd187('0x1f')](handleError(_0x74f8d7,null));};exports[_0xd187('0xa8')]=function(_0x4fce90,_0x4dcd41){var _0x38e2af;return db[_0xd187('0x3a')][_0xd187('0x34')]({'where':{'id':_0x4fce90[_0xd187('0x4e')]['id']},'attributes':['id','name',_0xd187('0x59')]})[_0xd187('0x16')](handleEntityNotFound(_0x4dcd41,null))[_0xd187('0x16')](function(_0x1721c2){if(_0x1721c2){_0x38e2af=_0x1721c2;if(!_0x4fce90['query'][_0xd187('0xa9')]||!utils['isValidChannel'](_0x4fce90[_0xd187('0x3f')][_0xd187('0xa9')])){throw new db[(_0xd187('0x8b'))][(_0xd187('0x8c'))](_0xd187('0x98'));}return _0x1721c2['remove'+_[_0xd187('0x9a')](_0x4fce90[_0xd187('0x3f')][_0xd187('0xa9')][_0xd187('0x9b')]())+'Queues'](_0x4fce90[_0xd187('0x3f')][_0xd187('0x5c')]);}})[_0xd187('0x16')](function(_0x474a9f){if(_[_0xd187('0xaa')](_0x4fce90[_0xd187('0x3f')][_0xd187('0x5c')])){for(var _0x12e3ca=0x0;_0x12e3ca<_0x4fce90[_0xd187('0x3f')][_0xd187('0x5c')][_0xd187('0x47')];_0x12e3ca+=0x1){var _0x943fc1={'UserId':Number(_0x4fce90[_0xd187('0x4e')]['id'])};_0x943fc1[_['capitalize'](_0x4fce90[_0xd187('0x3f')]['channel'][_0xd187('0x9b')]())+'QueueId']=Number(_0x4fce90[_0xd187('0x3f')][_0xd187('0x5c')][_0x12e3ca]);socket[_0xd187('0x9f')](_0xd187('0x2b')+_['capitalize'](_0x4fce90['query'][_0xd187('0xa9')][_0xd187('0x9b')]())+_0xd187('0xab'),_0x943fc1);}}else{var _0x943fc1={'UserId':Number(_0x4fce90[_0xd187('0x4e')]['id'])};_0x943fc1[_[_0xd187('0x9a')](_0x4fce90['query']['channel'][_0xd187('0x9b')]())+_0xd187('0x9e')]=Number(_0x4fce90[_0xd187('0x3f')]['ids']);socket[_0xd187('0x9f')](_0xd187('0x2b')+_[_0xd187('0x9a')](_0x4fce90['query'][_0xd187('0xa9')]['toLowerCase']())+_0xd187('0xab'),_0x943fc1);}return _0x474a9f;})['then'](function(){if(_0x4fce90['query']['channel']===_0xd187('0xa1')){return db[_0xd187('0xa7')][_0xd187('0x28')]({'where':{'UserId':_0x4fce90[_0xd187('0x4e')]['id'],'VoiceQueueId':_0x4fce90[_0xd187('0x3f')][_0xd187('0x5c')]},'individualHooks':!![]})['then'](function(){return _0x38e2af;});}return _0x38e2af;})[_0xd187('0x16')](respondWithStatusCode(_0x4dcd41,null))['catch'](handleError(_0x4dcd41,null));};exports[_0xd187('0xac')]=function(_0x3ee43e,_0x3c71f3){_0x3ee43e[_0xd187('0x58')][_0xd187('0xad')]=_0x3ee43e[_0xd187('0xae')]['filename'];return db[_0xd187('0x3a')][_0xd187('0x34')]({'where':{'id':_0x3ee43e[_0xd187('0x4e')]['id']}})[_0xd187('0x16')](handleEntityNotFound(_0x3c71f3,null))['then'](saveUpdates(_0x3ee43e[_0xd187('0x58')],null))[_0xd187('0x16')](respondWithResult(_0x3c71f3,null))['catch'](handleError(_0x3c71f3,null));};exports[_0xd187('0xaf')]=function(_0x305023,_0xc926a1){var _0x18c8e4=path['join'](config[_0xd187('0xb0')],'server/files/images/logos/default_profile.png');return db['User']['find']({'where':{'id':_0x305023[_0xd187('0x4e')]['id']},'attributes':['id',_0xd187('0xad')],'raw':!![]})[_0xd187('0x16')](handleEntityNotFound(_0xc926a1,null))[_0xd187('0x16')](function(_0x7d8eb5){if(_0x7d8eb5){if(_[_0xd187('0x63')](_0x7d8eb5[_0xd187('0xad')])){return _0xc926a1[_0xd187('0xb1')](_0x18c8e4);}else{if(!fs['existsSync'](path[_0xd187('0xb2')](config[_0xd187('0xb0')],_0xd187('0xb3'),_0x7d8eb5['userpic']))){return _0xc926a1[_0xd187('0xb1')](_0x18c8e4);}return _0xc926a1[_0xd187('0xb1')](path[_0xd187('0xb2')](config[_0xd187('0xb0')],_0xd187('0xb3'),_0x7d8eb5['userpic']));}}})[_0xd187('0x1f')](handleError(_0xc926a1,null));};exports[_0xd187('0xb4')]=function(_0x1ac714,_0x5ac21a){return db[_0xd187('0x3a')][_0xd187('0x34')]({'where':{'id':_0x1ac714[_0xd187('0x4e')]['id']},'attributes':['id']})[_0xd187('0x16')](handleEntityNotFound(_0x5ac21a,null))['then'](function(_0x476b70){var _0x3cf76c=[];values=_0x476b70[_0xd187('0x49')];_0x3cf76c[_0xd187('0x43')](get_open_tabs('chat',_0x476b70[_0xd187('0x49')]));_0x3cf76c[_0xd187('0x43')](get_open_tabs('sms',_0x476b70[_0xd187('0x49')]));_0x3cf76c['push'](get_open_tabs(_0xd187('0x4a'),_0x476b70['dataValues']));_0x3cf76c['push'](get_open_tabs(_0xd187('0x4b'),_0x476b70['dataValues']));_0x3cf76c[_0xd187('0x43')](get_open_tabs('fax',_0x476b70[_0xd187('0x49')]));_0x3cf76c[_0xd187('0x43')](get_open_tabs('mail',_0x476b70[_0xd187('0x49')]));return BPromise[_0xd187('0x4c')](_0x3cf76c);})[_0xd187('0x16')](function(_0x450bf6){var _0x1751ee=[];if(_0x450bf6){for(var _0x17a1d6=0x0;_0x17a1d6=_0xf0585e['agents']){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})['then'](function(){if(_0x356a51){return db[_0x2d51('0x2e')]['destroy']({'where':{'membername':_0x356a51[_0x2d51('0x2a')]},'individualHooks':!![]});}})[_0x2d51('0x23')](function(){if(_0x356a51){return _0x356a51[_0x2d51('0x56')]({'raw':!![]});}})[_0x2d51('0x23')](function(_0x25e6d9){if(_0x356a51){if(_0x25e6d9){var _0x2479de=[];_0xe3974=_0x25e6d9;if(_0xe3974[_0x2d51('0x32')]){for(var _0x510449=0x0;_0x510449<_0xe3974['length'];_0x510449++){_0x2479de[_0x2d51('0x37')](db['UserVoiceQueueRt'][_0x2d51('0x57')]({'membername':_0x356a51['name'],'UserId':_0x356a51['id'],'queue_name':_0xe3974[_0x510449][_0x2d51('0x2a')],'VoiceQueueId':_0xe3974[_0x510449]['id'],'interface':_0x4c2d31,'paused':_0x356a51[_0x2d51('0x4f')]||![],'penalty':_0xe3974[_0x510449][_0x2d51('0x58')]||0x0}));}return BPromise[_0x2d51('0x59')](_0x2479de);}}}})[_0x2d51('0x23')](function(){if(_0x356a51){return db[_0x2d51('0x30')][_0x2d51('0x1a')]({'where':{'membername':_0x356a51[_0x2d51('0x2a')],'exitAt':null}});}})[_0x2d51('0x23')](function(_0xfe6316){if(_0x356a51){if(_0xfe6316&&_0xfe6316[_0x2d51('0x32')]){var _0x495e90=[];_0xfe6316['forEach'](function(_0x299be1){_0x495e90[_0x2d51('0x37')](_0x299be1[_0x2d51('0x2f')]({'exitAt':moment()[_0x2d51('0x33')](_0x2d51('0x39'))}));});return BPromise[_0x2d51('0x59')](_0x495e90);}}})[_0x2d51('0x23')](function(_0x38a0eb){if(_0x356a51){var _0x39b46b=[];var _0x3b1572=[];var _0x501d34=utils[_0x2d51('0x35')]();var _0x1bf514={'membername':_0x356a51[_0x2d51('0x2a')],'interface':_0x4c2d31,'enterAt':moment()[_0x2d51('0x33')](_0x2d51('0x39')),'role':_0x356a51[_0x2d51('0x2b')],'internal':_0x356a51['internal']};_0x501d34[_0x2d51('0x36')](function(_0xcc3eac){_0x39b46b[_0x2d51('0x37')](_[_0x2d51('0x5a')]({'channel':_0xcc3eac,'type':'LOGIN','data1':'callysquare','data2':_0x4c2d31},_0x1bf514));if(_0x356a51[_0x2d51('0x4f')]){_0x3b1572['push'](_[_0x2d51('0x5a')]({'channel':_0xcc3eac,'type':_0x2d51('0x31'),'data1':'LOGININPAUSE'},_0x1bf514));}});return db[_0x2d51('0x30')][_0x2d51('0x3e')](_0x39b46b[_0x2d51('0x5b')](_0x3b1572),{'individualHooks':!![]});}})[_0x2d51('0x23')](function(){if(_0x356a51){return _0x356a51[_0x2d51('0x2f')]({'online':!![],'lastLoginAt':moment()[_0x2d51('0x33')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x356a51['loginInPause']||![],'mailPause':_0x356a51[_0x2d51('0x4f')]||![],'chatPause':_0x356a51[_0x2d51('0x4f')]||![],'faxPause':_0x356a51[_0x2d51('0x4f')]||![],'smsPause':_0x356a51[_0x2d51('0x4f')]||![],'openchannelPause':_0x356a51[_0x2d51('0x4f')]||![],'pauseType':_0x356a51[_0x2d51('0x4f')]?'LOGININPAUSE':null,'lastPauseAt':moment()[_0x2d51('0x33')](_0x2d51('0x39')),'interface':_0x4c2d31});}})[_0x2d51('0x23')](function(_0x586807){_0x2f20da(_0x586807);})[_0x2d51('0x26')](function(_0x3141b6){_0xa3130(_0x719978[_0x2d51('0x14')](0x1f4,_0x3141b6['message']));});});}; \ No newline at end of file +var _0xa094=['result','catch','GetUser','User','options','where','limit','include','map','model','attributes','ShowUser','find','raw','PauseUser','name','internal','interface','update','findAll','PAUSE','format','YYYY-MM-DD\x20HH:mm:ss','length','updateAttributes','getChannels','isNil','SIP/%s','body','type','role','uniqueid','DEFAULT\x20PAUSE','UnpauseUser','findOne','channel','isValidChannel','Unknown\x20channel','voice','system','mail','chat','fax','sms','openchannel','whatsapp','MemberReport','set','%s%s','Pause','UserVoiceQueueRt','forEach','push','destroy','all','LoginUser','mobile','loginInPause','count','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','upsert','UserVoiceQueue.penalty','merge','LOGIN','callysquare','LOGININPAUSE','bulkCreate','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./user.socket','register','request','then','info','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x59b533,_0x59fdcc){var _0x2beced=function(_0xd3aaf3){while(--_0xd3aaf3){_0x59b533['push'](_0x59b533['shift']());}};_0x2beced(++_0x59fdcc);}(_0xa094,0x16d));var _0x4a09=function(_0x2b93d1,_0x2e7eea){_0x2b93d1=_0x2b93d1-0x0;var _0x6952b0=_0xa094[_0x2b93d1];return _0x6952b0;};'use strict';var _=require(_0x4a09('0x0'));var util=require(_0x4a09('0x1'));var moment=require(_0x4a09('0x2'));var BPromise=require(_0x4a09('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4a09('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4a09('0x5'));var logger=require('../../config/logger')(_0x4a09('0x6'));var config=require('../../config/environment');var jayson=require(_0x4a09('0x7'));var client=jayson[_0x4a09('0x8')][_0x4a09('0x9')]({'port':0x232a});config['redis']=_[_0x4a09('0xa')](config[_0x4a09('0xb')],{'host':_0x4a09('0xc'),'port':0x18eb});var socket=require(_0x4a09('0xd'))(new Redis(config[_0x4a09('0xb')]));require(_0x4a09('0xe'))[_0x4a09('0xf')](socket);function respondWithRpcPromise(_0x51ff14,_0x181b9f,_0x4c520d){return new BPromise(function(_0x4de05c,_0x56ebaa){return client[_0x4a09('0x10')](_0x51ff14,_0x4c520d)[_0x4a09('0x11')](function(_0x32a979){logger[_0x4a09('0x12')](_0x4a09('0x13'),_0x181b9f,_0x4a09('0x14'));logger[_0x4a09('0x15')](_0x4a09('0x16'),_0x181b9f,_0x4a09('0x14'),JSON[_0x4a09('0x17')](_0x32a979));if(_0x32a979[_0x4a09('0x18')]){if(_0x32a979[_0x4a09('0x18')][_0x4a09('0x19')]===0x1f4){logger[_0x4a09('0x18')](_0x4a09('0x13'),_0x181b9f,_0x32a979[_0x4a09('0x18')]['message']);return _0x56ebaa(_0x32a979[_0x4a09('0x18')]['message']);}logger[_0x4a09('0x18')](_0x4a09('0x13'),_0x181b9f,_0x32a979['error'][_0x4a09('0x1a')]);return _0x4de05c(_0x32a979[_0x4a09('0x18')][_0x4a09('0x1a')]);}else{logger[_0x4a09('0x12')]('User,\x20%s,\x20%s',_0x181b9f,_0x4a09('0x14'));_0x4de05c(_0x32a979[_0x4a09('0x1b')]['message']);}})[_0x4a09('0x1c')](function(_0x564869){logger[_0x4a09('0x18')](_0x4a09('0x13'),_0x181b9f,_0x564869);_0x56ebaa(_0x564869);});});}exports[_0x4a09('0x1d')]=function(_0x15fa4a){var _0x379a8c=this;return new Promise(function(_0x2e3772,_0xb02e97){return db[_0x4a09('0x1e')]['findAll']({'raw':_0x15fa4a[_0x4a09('0x1f')]?_0x15fa4a[_0x4a09('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x15fa4a['options']?_0x15fa4a[_0x4a09('0x1f')][_0x4a09('0x20')]||null:null,'attributes':_0x15fa4a['options']?_0x15fa4a[_0x4a09('0x1f')]['attributes']||null:null,'limit':_0x15fa4a[_0x4a09('0x1f')]?_0x15fa4a['options'][_0x4a09('0x21')]||null:null,'include':_0x15fa4a['options']?_0x15fa4a[_0x4a09('0x1f')][_0x4a09('0x22')]?_[_0x4a09('0x23')](_0x15fa4a[_0x4a09('0x1f')][_0x4a09('0x22')],function(_0x59c7d7){return{'model':db[_0x59c7d7[_0x4a09('0x24')]],'as':_0x59c7d7['as'],'attributes':_0x59c7d7[_0x4a09('0x25')],'include':_0x59c7d7[_0x4a09('0x22')]?_[_0x4a09('0x23')](_0x59c7d7[_0x4a09('0x22')],function(_0x2aba2a){return{'model':db[_0x2aba2a[_0x4a09('0x24')]],'as':_0x2aba2a['as'],'attributes':_0x2aba2a['attributes'],'include':_0x2aba2a[_0x4a09('0x22')]?_[_0x4a09('0x23')](_0x2aba2a[_0x4a09('0x22')],function(_0x36e72f){return{'model':db[_0x36e72f[_0x4a09('0x24')]],'as':_0x36e72f['as'],'attributes':_0x36e72f[_0x4a09('0x25')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x27febd){logger[_0x4a09('0x12')](_0x4a09('0x1d'),_0x15fa4a);logger['debug']('GetUser',_0x15fa4a,JSON[_0x4a09('0x17')](_0x27febd));_0x2e3772(_0x27febd);})[_0x4a09('0x1c')](function(_0x3e3d73){logger['error']('GetUser',_0x3e3d73['message'],_0x15fa4a);_0xb02e97(_0x379a8c[_0x4a09('0x18')](0x1f4,_0x3e3d73[_0x4a09('0x1a')]));});});};exports[_0x4a09('0x26')]=function(_0x384d87){var _0x440bec=this;return new Promise(function(_0x206e98,_0x5b718a){return db['User'][_0x4a09('0x27')]({'raw':_0x384d87['options']?_0x384d87[_0x4a09('0x1f')][_0x4a09('0x28')]===undefined?!![]:![]:!![],'where':_0x384d87[_0x4a09('0x1f')]?_0x384d87[_0x4a09('0x1f')]['where']||null:null,'attributes':_0x384d87[_0x4a09('0x1f')]?_0x384d87[_0x4a09('0x1f')]['attributes']||null:null,'include':_0x384d87[_0x4a09('0x1f')]?_0x384d87[_0x4a09('0x1f')]['include']?_[_0x4a09('0x23')](_0x384d87['options']['include'],function(_0x78e535){return{'model':db[_0x78e535[_0x4a09('0x24')]],'as':_0x78e535['as'],'attributes':_0x78e535['attributes'],'include':_0x78e535[_0x4a09('0x22')]?_[_0x4a09('0x23')](_0x78e535[_0x4a09('0x22')],function(_0x11949d){return{'model':db[_0x11949d['model']],'as':_0x11949d['as'],'attributes':_0x11949d['attributes'],'include':_0x11949d[_0x4a09('0x22')]?_[_0x4a09('0x23')](_0x11949d['include'],function(_0x5ae2c1){return{'model':db[_0x5ae2c1[_0x4a09('0x24')]],'as':_0x5ae2c1['as'],'attributes':_0x5ae2c1[_0x4a09('0x25')]};}):[]};}):[]};}):[]:[]})[_0x4a09('0x11')](function(_0x3932ad){logger['info'](_0x4a09('0x26'),_0x384d87);logger[_0x4a09('0x15')]('ShowUser',_0x384d87,JSON[_0x4a09('0x17')](_0x3932ad));_0x206e98(_0x3932ad);})[_0x4a09('0x1c')](function(_0x248113){logger[_0x4a09('0x18')](_0x4a09('0x26'),_0x248113[_0x4a09('0x1a')],_0x384d87);_0x5b718a(_0x440bec['error'](0x1f4,_0x248113['message']));});});};exports[_0x4a09('0x29')]=function(_0x419049){var _0x27b862=this;return new Promise(function(_0x477f3f,_0x1ccab1){var _0x270020;return db[_0x4a09('0x1e')][_0x4a09('0x27')]({'where':_0x419049[_0x4a09('0x1f')][_0x4a09('0x20')]||{},'attributes':['id',_0x4a09('0x2a'),'role',_0x4a09('0x2b'),_0x4a09('0x2c')]})[_0x4a09('0x11')](function(_0x490e8a){if(_0x490e8a){_0x270020=_0x490e8a;return db['UserVoiceQueueRt'][_0x4a09('0x2d')]({'paused':0x1},{'where':{'UserId':_0x270020['id']},'individualHooks':!![]});}})['then'](function(){if(_0x270020){return db['MemberReport'][_0x4a09('0x2e')]({'where':{'membername':_0x270020[_0x4a09('0x2a')],'type':_0x4a09('0x2f'),'exitAt':null}});}})[_0x4a09('0x11')](function(_0x473d29){if(_0x270020){if(_0x473d29&&_0x473d29['length']){var _0x1007a3=moment()[_0x4a09('0x30')](_0x4a09('0x31'));for(var _0x137e99=0x0,_0x23b04b=_0x473d29[_0x4a09('0x32')];_0x137e99<_0x23b04b;_0x137e99++){_0x473d29[_0x137e99][_0x4a09('0x33')]({'exitAt':_0x1007a3});}}}})['then'](function(){if(_0x270020){var _0x7457dd=[];var _0x325570=utils[_0x4a09('0x34')]();_0x325570['forEach'](function(_0x249737){_0x7457dd['push']({'channel':_0x249737,'membername':_0x270020[_0x4a09('0x2a')],'interface':_[_0x4a09('0x35')](_0x270020[_0x4a09('0x2c')])?util[_0x4a09('0x30')](_0x4a09('0x36'),_0x270020[_0x4a09('0x2a')]):_0x270020[_0x4a09('0x2c')],'type':_0x4a09('0x2f'),'enterAt':moment()['format'](_0x4a09('0x31')),'data1':_0x419049[_0x4a09('0x37')][_0x4a09('0x38')]||'DEFAULT\x20PAUSE','role':_0x270020[_0x4a09('0x39')],'internal':_0x270020['internal'],'uniqueid':_0x419049[_0x4a09('0x37')][_0x4a09('0x3a')]||null});});return db['MemberReport']['bulkCreate'](_0x7457dd,{'individualHooks':!![]});}})[_0x4a09('0x11')](function(){if(_0x270020){return _0x270020[_0x4a09('0x2d')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x419049['body']['type']||_0x4a09('0x3b'),'lastPauseAt':moment()[_0x4a09('0x30')](_0x4a09('0x31'))});}})[_0x4a09('0x11')](function(_0x1e3331){_0x477f3f(_0x1e3331);})['catch'](function(_0x59a4c){_0x1ccab1(_0x27b862[_0x4a09('0x18')](0x1f4,_0x59a4c[_0x4a09('0x1a')]));});});};exports[_0x4a09('0x3c')]=function(_0x48ada1){var _0x609f74=this;return new Promise(function(_0x46d00f,_0x23602b){var _0xbe1c6b;return db['User'][_0x4a09('0x3d')]({'where':_0x48ada1[_0x4a09('0x1f')][_0x4a09('0x20')]||{},'attributes':['id','name']})[_0x4a09('0x11')](function(_0xef6301){if(_0xef6301){_0xbe1c6b=_0xef6301;if(_0x48ada1[_0x4a09('0x37')][_0x4a09('0x3e')]&&!utils[_0x4a09('0x3f')](_0x48ada1['body'][_0x4a09('0x3e')])){throw new Error(_0x4a09('0x40'));}switch(_0x48ada1['body']['channel']){case _0x4a09('0x41'):return db['UserVoiceQueueRt'][_0x4a09('0x2d')]({'paused':0x0},{'where':{'UserId':_0xbe1c6b['id']}})[_0x4a09('0x11')](function(){return db['MemberReport']['find']({'where':{'channel':_0x48ada1[_0x4a09('0x37')][_0x4a09('0x3e')],'membername':_0xbe1c6b[_0x4a09('0x2a')],'type':'PAUSE','exitAt':null}});})[_0x4a09('0x11')](function(_0x3043a){if(_0x3043a){return _0x3043a[_0x4a09('0x2d')]({'exitAt':moment()[_0x4a09('0x30')](_0x4a09('0x31')),'data2':_0x4a09('0x42')},{'individualHooks':!![]});}return null;})[_0x4a09('0x11')](function(){return _0xbe1c6b[_0x4a09('0x2d')]({'voicePause':![]});});case _0x4a09('0x43'):case _0x4a09('0x44'):case _0x4a09('0x45'):case _0x4a09('0x46'):case _0x4a09('0x47'):case _0x4a09('0x48'):return db[_0x4a09('0x49')]['find']({'where':{'channel':_0x48ada1[_0x4a09('0x37')][_0x4a09('0x3e')],'membername':_0xbe1c6b[_0x4a09('0x2a')],'type':_0x4a09('0x2f'),'exitAt':null}})[_0x4a09('0x11')](function(_0xdb5699){return _0xdb5699[_0x4a09('0x2d')]({'exitAt':moment()[_0x4a09('0x30')](_0x4a09('0x31')),'data2':_0x4a09('0x42')},{'individualHooks':!![]});})[_0x4a09('0x11')](function(){var _0x562f00={};_[_0x4a09('0x4a')](_0x562f00,util[_0x4a09('0x30')](_0x4a09('0x4b'),_0x48ada1[_0x4a09('0x37')][_0x4a09('0x3e')],_0x4a09('0x4c')),![]);return _0xbe1c6b[_0x4a09('0x2d')](_0x562f00);});default:return db[_0x4a09('0x4d')][_0x4a09('0x2d')]({'paused':0x0},{'where':{'UserId':_0xbe1c6b['id']}})['then'](function(){return db[_0x4a09('0x49')][_0x4a09('0x2e')]({'where':{'membername':_0xbe1c6b[_0x4a09('0x2a')],'type':_0x4a09('0x2f'),'exitAt':null}});})[_0x4a09('0x11')](function(_0x965f23){var _0x52aabd=[];_0x965f23[_0x4a09('0x4e')](function(_0x4cc133){_0x52aabd[_0x4a09('0x4f')](_0x4cc133[_0x4a09('0x2d')]({'exitAt':moment()[_0x4a09('0x30')](_0x4a09('0x31')),'data2':_0x4a09('0x42')}));});return BPromise['all'](_0x52aabd);})[_0x4a09('0x11')](function(){return _0xbe1c6b[_0x4a09('0x2d')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})[_0x4a09('0x11')](function(_0x31c9ef){_0x46d00f(_0x31c9ef);})[_0x4a09('0x1c')](function(_0x41c055){_0x23602b(_0x609f74[_0x4a09('0x18')](0x1f4,_0x41c055[_0x4a09('0x1a')]));});});};exports['LogoutUser']=function(_0x676952){var _0xef5217=this;return new Promise(function(_0x153190,_0x2d433c){var _0xc0318d;return db[_0x4a09('0x1e')]['findOne']({'where':_0x676952[_0x4a09('0x1f')][_0x4a09('0x20')]||{},'attributes':['id',_0x4a09('0x2a')]})[_0x4a09('0x11')](function(_0x3c2a63){if(_0x3c2a63){_0xc0318d=_0x3c2a63;return db['UserVoiceQueueRt'][_0x4a09('0x50')]({'where':{'membername':_0xc0318d[_0x4a09('0x2a')]},'individualHooks':!![]});}})[_0x4a09('0x11')](function(){if(_0xc0318d){return db[_0x4a09('0x49')][_0x4a09('0x2e')]({'where':{'membername':_0xc0318d['name'],'exitAt':null}});}})[_0x4a09('0x11')](function(_0x1338fb){if(_0xc0318d){if(_0x1338fb&&_0x1338fb[_0x4a09('0x32')]){var _0x374719=[];_0x1338fb[_0x4a09('0x4e')](function(_0x102155){_0x374719[_0x4a09('0x4f')](_0x102155[_0x4a09('0x2d')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x4a09('0x51')](_0x374719);}}})[_0x4a09('0x11')](function(){if(_0xc0318d){return _0xc0318d['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x4a09('0x11')](function(_0x5b71cf){_0x153190(_0x5b71cf);})[_0x4a09('0x1c')](function(_0x54783c){_0x2d433c(_0xef5217[_0x4a09('0x18')](0x1f4,_0x54783c[_0x4a09('0x1a')]));});});};exports[_0x4a09('0x52')]=function(_0x8d87e6){var _0xe1fb0e=this;return new Promise(function(_0x1f99e0,_0x3180d5){var _0x4312a0;var _0x33fd2e;var _0x5b45e2;var _0x17e087;return db['User'][_0x4a09('0x3d')]({'where':_0x8d87e6[_0x4a09('0x1f')]['where']||{},'attributes':['id','name',_0x4a09('0x39'),_0x4a09('0x53'),'phone',_0x4a09('0x2b'),_0x4a09('0x54'),'interface']})[_0x4a09('0x11')](function(_0x260ed8){if(_0x260ed8){_0x4312a0=_0x260ed8;_0x17e087=_0x8d87e6[_0x4a09('0x37')][_0x4a09('0x2c')]?_0x8d87e6[_0x4a09('0x37')]['interface']:util['format'](_0x4a09('0x36'),_0x4312a0[_0x4a09('0x2a')]);return db['User'][_0x4a09('0x55')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0x4312a0['id']}}});}})[_0x4a09('0x11')](function(_0x2b9f7f){if(_0x2b9f7f){_0x5b45e2=_0x2b9f7f;return require(_0x4a09('0x56'))[_0x4a09('0x57')]();}})[_0x4a09('0x11')](function(_0x5be504){if(_0x5be504&&_0x5be504[_0x4a09('0x58')]&&_0x5b45e2>=_0x5be504['agents']){throw new Error(_0x4a09('0x59'));}})[_0x4a09('0x11')](function(){if(_0x4312a0){return db['UserVoiceQueueRt'][_0x4a09('0x50')]({'where':{'membername':_0x4312a0[_0x4a09('0x2a')]},'individualHooks':!![]});}})[_0x4a09('0x11')](function(){if(_0x4312a0){return _0x4312a0[_0x4a09('0x5a')]({'raw':!![]});}})[_0x4a09('0x11')](function(_0x2eb488){if(_0x4312a0){if(_0x2eb488){var _0x36dfcc=[];_0x33fd2e=_0x2eb488;if(_0x33fd2e[_0x4a09('0x32')]){for(var _0x560496=0x0;_0x560496<_0x33fd2e[_0x4a09('0x32')];_0x560496++){_0x36dfcc[_0x4a09('0x4f')](db[_0x4a09('0x4d')][_0x4a09('0x5b')]({'membername':_0x4312a0[_0x4a09('0x2a')],'UserId':_0x4312a0['id'],'queue_name':_0x33fd2e[_0x560496][_0x4a09('0x2a')],'VoiceQueueId':_0x33fd2e[_0x560496]['id'],'interface':_0x17e087,'paused':_0x4312a0[_0x4a09('0x54')]||![],'penalty':_0x33fd2e[_0x560496][_0x4a09('0x5c')]||0x0}));}return BPromise[_0x4a09('0x51')](_0x36dfcc);}}}})['then'](function(){if(_0x4312a0){return db[_0x4a09('0x49')][_0x4a09('0x2e')]({'where':{'membername':_0x4312a0['name'],'exitAt':null}});}})['then'](function(_0x5766d8){if(_0x4312a0){if(_0x5766d8&&_0x5766d8[_0x4a09('0x32')]){var _0x29a0cf=[];_0x5766d8[_0x4a09('0x4e')](function(_0x1f84a7){_0x29a0cf[_0x4a09('0x4f')](_0x1f84a7[_0x4a09('0x2d')]({'exitAt':moment()['format'](_0x4a09('0x31'))}));});return BPromise[_0x4a09('0x51')](_0x29a0cf);}}})[_0x4a09('0x11')](function(_0x592d73){if(_0x4312a0){var _0x28d85d=[];var _0x4cb3bf=[];var _0x5ba63c=utils[_0x4a09('0x34')]();var _0x55e496={'membername':_0x4312a0[_0x4a09('0x2a')],'interface':_0x17e087,'enterAt':moment()[_0x4a09('0x30')](_0x4a09('0x31')),'role':_0x4312a0[_0x4a09('0x39')],'internal':_0x4312a0['internal']};_0x5ba63c[_0x4a09('0x4e')](function(_0xc047ae){_0x28d85d['push'](_[_0x4a09('0x5d')]({'channel':_0xc047ae,'type':_0x4a09('0x5e'),'data1':_0x4a09('0x5f'),'data2':_0x17e087},_0x55e496));if(_0x4312a0[_0x4a09('0x54')]){_0x4cb3bf[_0x4a09('0x4f')](_[_0x4a09('0x5d')]({'channel':_0xc047ae,'type':_0x4a09('0x2f'),'data1':_0x4a09('0x60')},_0x55e496));}});return db[_0x4a09('0x49')][_0x4a09('0x61')](_0x28d85d['concat'](_0x4cb3bf),{'individualHooks':!![]});}})['then'](function(){if(_0x4312a0){return _0x4312a0[_0x4a09('0x2d')]({'online':!![],'lastLoginAt':moment()[_0x4a09('0x30')](_0x4a09('0x31')),'voicePause':_0x4312a0[_0x4a09('0x54')]||![],'mailPause':_0x4312a0['loginInPause']||![],'chatPause':_0x4312a0[_0x4a09('0x54')]||![],'faxPause':_0x4312a0['loginInPause']||![],'smsPause':_0x4312a0[_0x4a09('0x54')]||![],'openchannelPause':_0x4312a0[_0x4a09('0x54')]||![],'pauseType':_0x4312a0[_0x4a09('0x54')]?_0x4a09('0x60'):null,'lastPauseAt':moment()['format'](_0x4a09('0x31')),'interface':_0x17e087});}})[_0x4a09('0x11')](function(_0x3f1164){_0x1f99e0(_0x3f1164);})['catch'](function(_0x248dc8){_0x3180d5(_0xe1fb0e['error'](0x1f4,_0x248dc8[_0x4a09('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index d25926e..87a9542 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 _0x5638=['save','remove','removeListener','register','length','user:','./user.events'];(function(_0xd511d,_0x3546b9){var _0x3f148e=function(_0x51f35f){while(--_0x51f35f){_0xd511d['push'](_0xd511d['shift']());}};_0x3f148e(++_0x3546b9);}(_0x5638,0xca));var _0x8563=function(_0x2df106,_0x5e43f8){_0x2df106=_0x2df106-0x0;var _0x20e1d1=_0x5638[_0x2df106];return _0x20e1d1;};'use strict';var UserEvents=require(_0x8563('0x0'));var events=[_0x8563('0x1'),_0x8563('0x2'),'update'];function createListener(_0xd13ca3,_0x9da2f6){return function(_0x4d342b){_0x9da2f6['emit'](_0xd13ca3,_0x4d342b);};}function removeListener(_0x5a9101,_0x1ecae4){return function(){UserEvents[_0x8563('0x3')](_0x5a9101,_0x1ecae4);};}exports[_0x8563('0x4')]=function(_0xd0a463){for(var _0x420a0a=0x0,_0x47db69=events[_0x8563('0x5')];_0x420a0a<_0x47db69;_0x420a0a++){var _0x28b0b3=events[_0x420a0a];var _0x166559=createListener(_0x8563('0x6')+_0x28b0b3,_0xd0a463);UserEvents['on'](_0x28b0b3,_0x166559);}}; \ No newline at end of file +var _0xdcda=['./user.events','save','remove','removeListener','register','user:'];(function(_0x2a2763,_0x4b48ec){var _0x4a61ed=function(_0x10a2e3){while(--_0x10a2e3){_0x2a2763['push'](_0x2a2763['shift']());}};_0x4a61ed(++_0x4b48ec);}(_0xdcda,0x13e));var _0xadcd=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xdcda[_0x1d1779];return _0x2377e9;};'use strict';var UserEvents=require(_0xadcd('0x0'));var events=[_0xadcd('0x1'),_0xadcd('0x2'),'update'];function createListener(_0x353a84,_0x5f1a31){return function(_0x1ba2e8){_0x5f1a31['emit'](_0x353a84,_0x1ba2e8);};}function removeListener(_0x11a390,_0x355137){return function(){UserEvents[_0xadcd('0x3')](_0x11a390,_0x355137);};}exports[_0xadcd('0x4')]=function(_0x41e833){for(var _0x4d1279=0x0,_0x5b32a5=events['length'];_0x4d1279<_0x5b32a5;_0x4d1279++){var _0x40ec63=events[_0x4d1279];var _0x2c0bd6=createListener(_0xadcd('0x5')+_0x40ec63,_0x41e833);UserEvents['on'](_0x40ec63,_0x2c0bd6);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index faa2be5..85af074 100644 --- a/server/api/userChatQueue/index.js +++ b/server/api/userChatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x5c2f5c,_0x2632d7){var _0x230e26=function(_0x4d07af){while(--_0x4d07af){_0x5c2f5c['push'](_0x5c2f5c['shift']());}};_0x230e26(++_0x2632d7);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x4ef95e,_0x442da1){var _0x5a49f2=function(_0x50a2ad){while(--_0x50a2ad){_0x4ef95e['push'](_0x4ef95e['shift']());}};_0x5a49f2(++_0x442da1);}(_0xedd9,0xfc));var _0x9edd=function(_0x530d19,_0x5479c6){_0x530d19=_0x530d19-0x0;var _0x2816b7=_0xedd9[_0x530d19];return _0x2816b7;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 6e24a20..0836581 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 _0x7c55=['sequelize','exports','INTEGER'];(function(_0x6a0951,_0x1ce595){var _0x28c2ab=function(_0x599a28){while(--_0x599a28){_0x6a0951['push'](_0x6a0951['shift']());}};_0x28c2ab(++_0x1ce595);}(_0x7c55,0x180));var _0x57c5=function(_0x281ad7,_0x2adabc){_0x281ad7=_0x281ad7-0x0;var _0x4e7f82=_0x7c55[_0x281ad7];return _0x4e7f82;};'use strict';var Sequelize=require(_0x57c5('0x0'));module[_0x57c5('0x1')]={'penalty':{'type':Sequelize[_0x57c5('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3bca=['INTEGER','exports'];(function(_0x5c9a04,_0x1c1ebd){var _0x1cb316=function(_0xa755cb){while(--_0xa755cb){_0x5c9a04['push'](_0x5c9a04['shift']());}};_0x1cb316(++_0x1c1ebd);}(_0x3bca,0x1d1));var _0xa3bc=function(_0x5d7171,_0x2312d6){_0x5d7171=_0x5d7171-0x0;var _0x274101=_0x3bca[_0x5d7171];return _0x274101;};'use strict';var Sequelize=require('sequelize');module[_0xa3bc('0x0')]={'penalty':{'type':Sequelize[_0xa3bc('0x1')],'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 cf1b185..45ab8fc 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 _0x9c58=['define','UserChatQueue','user_has_chat_queues','lodash','util','moment','request-promise','rimraf','./userChatQueue.attributes','exports'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x9c58,0xd5));var _0x89c5=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x9c58[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x89c5('0x0'));var util=require(_0x89c5('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x89c5('0x2'));var BPromise=require('bluebird');var rp=require(_0x89c5('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x89c5('0x4'));var config=require('../../config/environment');var attributes=require(_0x89c5('0x5'));module[_0x89c5('0x6')]=function(_0x3a4eac,_0x24b937){return _0x3a4eac[_0x89c5('0x7')](_0x89c5('0x8'),attributes,{'tableName':_0x89c5('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcbee=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes','exports','define','user_has_chat_queues','util'];(function(_0x4b4517,_0x5dbf6a){var _0x48278b=function(_0x4592ea){while(--_0x4592ea){_0x4b4517['push'](_0x4b4517['shift']());}};_0x48278b(++_0x5dbf6a);}(_0xcbee,0x107));var _0xecbe=function(_0x2483d5,_0x399095){_0x2483d5=_0x2483d5-0x0;var _0x4b6f60=_0xcbee[_0x2483d5];return _0x4b6f60;};'use strict';var _=require('lodash');var util=require(_0xecbe('0x0'));var logger=require(_0xecbe('0x1'))(_0xecbe('0x2'));var moment=require(_0xecbe('0x3'));var BPromise=require('bluebird');var rp=require(_0xecbe('0x4'));var fs=require('fs');var path=require(_0xecbe('0x5'));var rimraf=require(_0xecbe('0x6'));var config=require(_0xecbe('0x7'));var attributes=require(_0xecbe('0x8'));module[_0xecbe('0x9')]=function(_0x4a6b49,_0x45aced){return _0x4a6b49[_0xecbe('0xa')]('UserChatQueue',attributes,{'tableName':_0xecbe('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.rpc.js b/server/api/userChatQueue/userChatQueue.rpc.js index 8ecc036..04a9f0a 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 _0x6804=['../../config/logger','jayson/promise','client','http','then','info','UserChatQueue,\x20%s,\x20%s','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','randomstring','../../mysqldb','../../config/utils'];(function(_0x7c8431,_0x3837d3){var _0x2e27eb=function(_0x58d616){while(--_0x58d616){_0x7c8431['push'](_0x7c8431['shift']());}};_0x2e27eb(++_0x3837d3);}(_0x6804,0x176));var _0x4680=function(_0x107ebc,_0x271dd3){_0x107ebc=_0x107ebc-0x0;var _0x21c846=_0x6804[_0x107ebc];return _0x21c846;};'use strict';var _=require(_0x4680('0x0'));var util=require(_0x4680('0x1'));var moment=require(_0x4680('0x2'));var BPromise=require('bluebird');var rs=require(_0x4680('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4680('0x4'))['db'];var utils=require(_0x4680('0x5'));var logger=require(_0x4680('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4680('0x7'));var client=jayson[_0x4680('0x8')][_0x4680('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x35a901,_0x401b70,_0x651259){return new BPromise(function(_0x37186d,_0xc9b611){return client['request'](_0x35a901,_0x651259)[_0x4680('0xa')](function(_0xcddace){logger[_0x4680('0xb')](_0x4680('0xc'),_0x401b70,'request\x20sent');logger[_0x4680('0xd')](_0x4680('0xe'),_0x401b70,'request\x20sent',JSON[_0x4680('0xf')](_0xcddace));if(_0xcddace[_0x4680('0x10')]){if(_0xcddace[_0x4680('0x10')][_0x4680('0x11')]===0x1f4){logger['error']('UserChatQueue,\x20%s,\x20%s',_0x401b70,_0xcddace[_0x4680('0x10')]['message']);return _0xc9b611(_0xcddace[_0x4680('0x10')][_0x4680('0x12')]);}logger[_0x4680('0x10')](_0x4680('0xc'),_0x401b70,_0xcddace['error'][_0x4680('0x12')]);return _0x37186d(_0xcddace[_0x4680('0x10')][_0x4680('0x12')]);}else{logger['info']('UserChatQueue,\x20%s,\x20%s',_0x401b70,'request\x20sent');_0x37186d(_0xcddace[_0x4680('0x13')][_0x4680('0x12')]);}})['catch'](function(_0x276ed7){logger['error'](_0x4680('0xc'),_0x401b70,_0x276ed7);_0xc9b611(_0x276ed7);});});} \ No newline at end of file +var _0x8812=['../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x46f595,_0x25c1b8){var _0x5dfe83=function(_0x4eeb13){while(--_0x4eeb13){_0x46f595['push'](_0x46f595['shift']());}};_0x5dfe83(++_0x25c1b8);}(_0x8812,0xc8));var _0x2881=function(_0x39f4fb,_0x12be18){_0x39f4fb=_0x39f4fb-0x0;var _0x35b45c=_0x8812[_0x39f4fb];return _0x35b45c;};'use strict';var _=require(_0x2881('0x0'));var util=require(_0x2881('0x1'));var moment=require(_0x2881('0x2'));var BPromise=require(_0x2881('0x3'));var rs=require(_0x2881('0x4'));var fs=require('fs');var Redis=require(_0x2881('0x5'));var db=require(_0x2881('0x6'))['db'];var utils=require(_0x2881('0x7'));var logger=require(_0x2881('0x8'))('rpc');var config=require(_0x2881('0x9'));var jayson=require(_0x2881('0xa'));var client=jayson[_0x2881('0xb')][_0x2881('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x115c5d,_0x1e35d1,_0x3b6e66){return new BPromise(function(_0x52c652,_0x2ed2eb){return client[_0x2881('0xd')](_0x115c5d,_0x3b6e66)[_0x2881('0xe')](function(_0x4603c2){logger[_0x2881('0xf')](_0x2881('0x10'),_0x1e35d1,_0x2881('0x11'));logger[_0x2881('0x12')](_0x2881('0x13'),_0x1e35d1,_0x2881('0x11'),JSON[_0x2881('0x14')](_0x4603c2));if(_0x4603c2[_0x2881('0x15')]){if(_0x4603c2[_0x2881('0x15')][_0x2881('0x16')]===0x1f4){logger[_0x2881('0x15')](_0x2881('0x10'),_0x1e35d1,_0x4603c2[_0x2881('0x15')][_0x2881('0x17')]);return _0x2ed2eb(_0x4603c2['error'][_0x2881('0x17')]);}logger[_0x2881('0x15')](_0x2881('0x10'),_0x1e35d1,_0x4603c2['error'][_0x2881('0x17')]);return _0x52c652(_0x4603c2[_0x2881('0x15')]['message']);}else{logger[_0x2881('0xf')](_0x2881('0x10'),_0x1e35d1,_0x2881('0x11'));_0x52c652(_0x4603c2[_0x2881('0x18')]['message']);}})[_0x2881('0x19')](function(_0x48ddf1){logger[_0x2881('0x15')](_0x2881('0x10'),_0x1e35d1,_0x48ddf1);_0x2ed2eb(_0x48ddf1);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 6a57440..96cd5a7 100644 --- a/server/api/userFaxQueue/index.js +++ b/server/api/userFaxQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x29e3f6,_0x3d9c38){var _0x42d404=function(_0x4571dd){while(--_0x4571dd){_0x29e3f6['push'](_0x29e3f6['shift']());}};_0x42d404(++_0x3d9c38);}(_0xe706,0xa3));var _0x6e70=function(_0x437808,_0x5d54e4){_0x437808=_0x437808-0x0;var _0x3752ac=_0xe706[_0x437808];return _0x3752ac;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x5876fc,_0x431a54){var _0x279a56=function(_0xa7f754){while(--_0xa7f754){_0x5876fc['push'](_0x5876fc['shift']());}};_0x279a56(++_0x431a54);}(_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/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index d3d316d..5ca2350 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 _0xc00d=['sequelize','exports','INTEGER','STRING'];(function(_0x34effa,_0x27e3fc){var _0x2a9af1=function(_0x1253c6){while(--_0x1253c6){_0x34effa['push'](_0x34effa['shift']());}};_0x2a9af1(++_0x27e3fc);}(_0xc00d,0x10c));var _0xdc00=function(_0x54c7d2,_0xad88a){_0x54c7d2=_0x54c7d2-0x0;var _0x5af671=_0xc00d[_0x54c7d2];return _0x5af671;};'use strict';var Sequelize=require(_0xdc00('0x0'));module[_0xdc00('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xdc00('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0xdc00('0x3')]}}; \ No newline at end of file +var _0x34a6=['STRING','sequelize','exports','INTEGER'];(function(_0x599fb1,_0x35f74a){var _0x18af62=function(_0x166912){while(--_0x166912){_0x599fb1['push'](_0x599fb1['shift']());}};_0x18af62(++_0x35f74a);}(_0x34a6,0x1d1));var _0x634a=function(_0x1f2ab4,_0x3ff579){_0x1f2ab4=_0x1f2ab4-0x0;var _0x184a15=_0x34a6[_0x1f2ab4];return _0x184a15;};'use strict';var Sequelize=require(_0x634a('0x0'));module[_0x634a('0x1')]={'penalty':{'type':Sequelize[_0x634a('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x634a('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x634a('0x3')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 0464400..7c2a5bd 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 _0xfd50=['util','bluebird','path','../../config/environment','./userFaxQueue.attributes','exports','define','UserFaxQueue','lodash'];(function(_0x1c5eee,_0x4de08c){var _0x26c869=function(_0xc52abc){while(--_0xc52abc){_0x1c5eee['push'](_0x1c5eee['shift']());}};_0x26c869(++_0x4de08c);}(_0xfd50,0x182));var _0x0fd5=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xfd50[_0x138adb];return _0x1b27f2;};'use strict';var _=require(_0x0fd5('0x0'));var util=require(_0x0fd5('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0fd5('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0fd5('0x3'));var rimraf=require('rimraf');var config=require(_0x0fd5('0x4'));var attributes=require(_0x0fd5('0x5'));module[_0x0fd5('0x6')]=function(_0x4d2b12,_0x2f55c3){return _0x4d2b12[_0x0fd5('0x7')](_0x0fd5('0x8'),attributes,{'tableName':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x420a=['bluebird','request-promise','path','../../config/environment','./userFaxQueue.attributes','exports','define','UserFaxQueue','lodash','util','../../config/logger','moment'];(function(_0x19b764,_0x2e3e9b){var _0x43b553=function(_0x294bea){while(--_0x294bea){_0x19b764['push'](_0x19b764['shift']());}};_0x43b553(++_0x2e3e9b);}(_0x420a,0x140));var _0xa420=function(_0x2464f5,_0x55b080){_0x2464f5=_0x2464f5-0x0;var _0x202b0f=_0x420a[_0x2464f5];return _0x202b0f;};'use strict';var _=require(_0xa420('0x0'));var util=require(_0xa420('0x1'));var logger=require(_0xa420('0x2'))('api');var moment=require(_0xa420('0x3'));var BPromise=require(_0xa420('0x4'));var rp=require(_0xa420('0x5'));var fs=require('fs');var path=require(_0xa420('0x6'));var rimraf=require('rimraf');var config=require(_0xa420('0x7'));var attributes=require(_0xa420('0x8'));module[_0xa420('0x9')]=function(_0x5448e3,_0x57ab5f){return _0x5448e3[_0xa420('0xa')](_0xa420('0xb'),attributes,{'tableName':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.rpc.js b/server/api/userFaxQueue/userFaxQueue.rpc.js index ebd8654..ec252bd 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 _0xe01a=['jayson/promise','http','request','then','info','request\x20sent','UserFaxQueue,\x20%s,\x20%s,\x20%s','error','UserFaxQueue,\x20%s,\x20%s','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0xff823c,_0x146864){var _0x1f662a=function(_0x2c4cc0){while(--_0x2c4cc0){_0xff823c['push'](_0xff823c['shift']());}};_0x1f662a(++_0x146864);}(_0xe01a,0xc8));var _0xae01=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xe01a[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xae01('0x0'));var util=require(_0xae01('0x1'));var moment=require('moment');var BPromise=require(_0xae01('0x2'));var rs=require(_0xae01('0x3'));var fs=require('fs');var Redis=require(_0xae01('0x4'));var db=require(_0xae01('0x5'))['db'];var utils=require(_0xae01('0x6'));var logger=require(_0xae01('0x7'))(_0xae01('0x8'));var config=require(_0xae01('0x9'));var jayson=require(_0xae01('0xa'));var client=jayson['client'][_0xae01('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x98cd2c,_0x2bede0,_0x51fd16){return new BPromise(function(_0x278841,_0x9e660e){return client[_0xae01('0xc')](_0x98cd2c,_0x51fd16)[_0xae01('0xd')](function(_0x545794){logger[_0xae01('0xe')]('UserFaxQueue,\x20%s,\x20%s',_0x2bede0,_0xae01('0xf'));logger['debug'](_0xae01('0x10'),_0x2bede0,'request\x20sent',JSON['stringify'](_0x545794));if(_0x545794[_0xae01('0x11')]){if(_0x545794[_0xae01('0x11')]['code']===0x1f4){logger[_0xae01('0x11')](_0xae01('0x12'),_0x2bede0,_0x545794[_0xae01('0x11')][_0xae01('0x13')]);return _0x9e660e(_0x545794[_0xae01('0x11')][_0xae01('0x13')]);}logger['error'](_0xae01('0x12'),_0x2bede0,_0x545794['error'][_0xae01('0x13')]);return _0x278841(_0x545794['error'][_0xae01('0x13')]);}else{logger[_0xae01('0xe')]('UserFaxQueue,\x20%s,\x20%s',_0x2bede0,_0xae01('0xf'));_0x278841(_0x545794['result']['message']);}})[_0xae01('0x14')](function(_0x1cbe63){logger[_0xae01('0x11')](_0xae01('0x12'),_0x2bede0,_0x1cbe63);_0x9e660e(_0x1cbe63);});});} \ No newline at end of file +var _0x230f=['randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','UserFaxQueue,\x20%s,\x20%s','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','moment','bluebird'];(function(_0xfadccd,_0x290136){var _0x482ac4=function(_0x315460){while(--_0x315460){_0xfadccd['push'](_0xfadccd['shift']());}};_0x482ac4(++_0x290136);}(_0x230f,0xc5));var _0xf230=function(_0x5031c1,_0x310436){_0x5031c1=_0x5031c1-0x0;var _0x418bb6=_0x230f[_0x5031c1];return _0x418bb6;};'use strict';var _=require(_0xf230('0x0'));var util=require('util');var moment=require(_0xf230('0x1'));var BPromise=require(_0xf230('0x2'));var rs=require(_0xf230('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf230('0x4'))['db'];var utils=require(_0xf230('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xf230('0x6'));var jayson=require(_0xf230('0x7'));var client=jayson['client'][_0xf230('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x287fcd,_0x5468c0,_0xe3ac2f){return new BPromise(function(_0x58c6e9,_0x1156e8){return client['request'](_0x287fcd,_0xe3ac2f)['then'](function(_0x3980c7){logger['info'](_0xf230('0x9'),_0x5468c0,'request\x20sent');logger[_0xf230('0xa')](_0xf230('0xb'),_0x5468c0,_0xf230('0xc'),JSON[_0xf230('0xd')](_0x3980c7));if(_0x3980c7[_0xf230('0xe')]){if(_0x3980c7[_0xf230('0xe')][_0xf230('0xf')]===0x1f4){logger[_0xf230('0xe')]('UserFaxQueue,\x20%s,\x20%s',_0x5468c0,_0x3980c7[_0xf230('0xe')]['message']);return _0x1156e8(_0x3980c7[_0xf230('0xe')][_0xf230('0x10')]);}logger[_0xf230('0xe')](_0xf230('0x9'),_0x5468c0,_0x3980c7[_0xf230('0xe')][_0xf230('0x10')]);return _0x58c6e9(_0x3980c7[_0xf230('0xe')][_0xf230('0x10')]);}else{logger[_0xf230('0x11')](_0xf230('0x9'),_0x5468c0,_0xf230('0xc'));_0x58c6e9(_0x3980c7[_0xf230('0x12')][_0xf230('0x10')]);}})[_0xf230('0x13')](function(_0x3fe16c){logger[_0xf230('0xe')](_0xf230('0x9'),_0x5468c0,_0x3fe16c);_0x1156e8(_0x3fe16c);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 4652f2f..9d40e6c 100644 --- a/server/api/userMailQueue/index.js +++ b/server/api/userMailQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x47d060,_0x4a2b1d){var _0xb2d051=function(_0x3434e7){while(--_0x3434e7){_0x47d060['push'](_0x47d060['shift']());}};_0xb2d051(++_0x4a2b1d);}(_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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x1e1458,_0x2eaca0){var _0x430838=function(_0x1a3805){while(--_0x1a3805){_0x1e1458['push'](_0x1e1458['shift']());}};_0x430838(++_0x2eaca0);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index edc0122..76b03f6 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 _0xa6f6=['exports','sequelize'];(function(_0x218e76,_0x5f0903){var _0x4269bb=function(_0x3881db){while(--_0x3881db){_0x218e76['push'](_0x218e76['shift']());}};_0x4269bb(++_0x5f0903);}(_0xa6f6,0x16b));var _0x6a6f=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0xa6f6[_0x36884e];return _0x1cc367;};'use strict';var Sequelize=require(_0x6a6f('0x0'));module[_0x6a6f('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x8627=['INTEGER'];(function(_0x4bc4f3,_0xb93bd2){var _0x478fab=function(_0x2404ea){while(--_0x2404ea){_0x4bc4f3['push'](_0x4bc4f3['shift']());}};_0x478fab(++_0xb93bd2);}(_0x8627,0xd1));var _0x7862=function(_0x265b28,_0x302a76){_0x265b28=_0x265b28-0x0;var _0x18ce91=_0x8627[_0x265b28];return _0x18ce91;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x7862('0x0')],'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 0d31941..4871b24 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 _0x1e91=['path','../../config/environment','./userMailQueue.attributes','UserMailQueue','user_has_mail_queues','lodash','../../config/logger','api','moment','request-promise'];(function(_0x4efcad,_0x4ed9a7){var _0x5a6d2a=function(_0x908dca){while(--_0x908dca){_0x4efcad['push'](_0x4efcad['shift']());}};_0x5a6d2a(++_0x4ed9a7);}(_0x1e91,0x145));var _0x11e9=function(_0xea1570,_0x2f7856){_0xea1570=_0xea1570-0x0;var _0x579e74=_0x1e91[_0xea1570];return _0x579e74;};'use strict';var _=require(_0x11e9('0x0'));var util=require('util');var logger=require(_0x11e9('0x1'))(_0x11e9('0x2'));var moment=require(_0x11e9('0x3'));var BPromise=require('bluebird');var rp=require(_0x11e9('0x4'));var fs=require('fs');var path=require(_0x11e9('0x5'));var rimraf=require('rimraf');var config=require(_0x11e9('0x6'));var attributes=require(_0x11e9('0x7'));module['exports']=function(_0x590d92,_0x25f4e1){return _0x590d92['define'](_0x11e9('0x8'),attributes,{'tableName':_0x11e9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1874=['user_has_mail_queues','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','exports','define','UserMailQueue'];(function(_0x19cd2a,_0x52bf9e){var _0x41f8b7=function(_0x132d14){while(--_0x132d14){_0x19cd2a['push'](_0x19cd2a['shift']());}};_0x41f8b7(++_0x52bf9e);}(_0x1874,0x114));var _0x4187=function(_0x597948,_0x56f6ce){_0x597948=_0x597948-0x0;var _0x171185=_0x1874[_0x597948];return _0x171185;};'use strict';var _=require('lodash');var util=require(_0x4187('0x0'));var logger=require(_0x4187('0x1'))('api');var moment=require(_0x4187('0x2'));var BPromise=require(_0x4187('0x3'));var rp=require(_0x4187('0x4'));var fs=require('fs');var path=require(_0x4187('0x5'));var rimraf=require(_0x4187('0x6'));var config=require('../../config/environment');var attributes=require('./userMailQueue.attributes');module[_0x4187('0x7')]=function(_0x3da831,_0x2a2819){return _0x3da831[_0x4187('0x8')](_0x4187('0x9'),attributes,{'tableName':_0x4187('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index 7a1fea2..70dea67 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 _0x4b84=['../../config/logger','rpc','http','then','info','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','UserMailQueue,\x20%s,\x20%s','message','lodash','util','randomstring','../../config/utils'];(function(_0x47497c,_0x4c3c4c){var _0x59ab04=function(_0x58bf80){while(--_0x58bf80){_0x47497c['push'](_0x47497c['shift']());}};_0x59ab04(++_0x4c3c4c);}(_0x4b84,0x1cc));var _0x44b8=function(_0x2a453b,_0x479c50){_0x2a453b=_0x2a453b-0x0;var _0x132f79=_0x4b84[_0x2a453b];return _0x132f79;};'use strict';var _=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x44b8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x44b8('0x3'));var logger=require(_0x44b8('0x4'))(_0x44b8('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x44b8('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x54274b,_0x327f59,_0x5947f7){return new BPromise(function(_0x3e87c5,_0x5a2353){return client['request'](_0x54274b,_0x5947f7)[_0x44b8('0x7')](function(_0x42319d){logger[_0x44b8('0x8')]('UserMailQueue,\x20%s,\x20%s',_0x327f59,_0x44b8('0x9'));logger[_0x44b8('0xa')](_0x44b8('0xb'),_0x327f59,_0x44b8('0x9'),JSON[_0x44b8('0xc')](_0x42319d));if(_0x42319d[_0x44b8('0xd')]){if(_0x42319d[_0x44b8('0xd')]['code']===0x1f4){logger[_0x44b8('0xd')](_0x44b8('0xe'),_0x327f59,_0x42319d['error'][_0x44b8('0xf')]);return _0x5a2353(_0x42319d['error'][_0x44b8('0xf')]);}logger[_0x44b8('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x327f59,_0x42319d[_0x44b8('0xd')]['message']);return _0x3e87c5(_0x42319d['error'][_0x44b8('0xf')]);}else{logger[_0x44b8('0x8')](_0x44b8('0xe'),_0x327f59,_0x44b8('0x9'));_0x3e87c5(_0x42319d['result']['message']);}})['catch'](function(_0x3fe9fb){logger['error'](_0x44b8('0xe'),_0x327f59,_0x3fe9fb);_0x5a2353(_0x3fe9fb);});});} \ No newline at end of file +var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3bcc96,_0x721be){var _0xcd1705=function(_0x17d6eb){while(--_0x17d6eb){_0x3bcc96['push'](_0x3bcc96['shift']());}};_0xcd1705(++_0x721be);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('UserMailQueue,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 78258af..b64b590 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 _0xa974=['util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userNotification.controller','post','isAuthenticated','sendUserNotification','exports','multer'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xa974,0x192));var _0x4a97=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xa974[_0x397e5f];return _0x5302b8;};'use strict';var multer=require(_0x4a97('0x0'));var util=require(_0x4a97('0x1'));var path=require(_0x4a97('0x2'));var timeout=require(_0x4a97('0x3'));var express=require('express');var router=express[_0x4a97('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4a97('0x5'));var interaction=require(_0x4a97('0x6'));var config=require(_0x4a97('0x7'));var controller=require(_0x4a97('0x8'));router[_0x4a97('0x9')]('/',auth[_0x4a97('0xa')](),controller[_0x4a97('0xb')]);module[_0x4a97('0xc')]=router; \ No newline at end of file +var _0xeecb=['./userNotification.controller','post','sendUserNotification','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service'];(function(_0x38c861,_0x37c537){var _0x147e86=function(_0x52c5c4){while(--_0x52c5c4){_0x38c861['push'](_0x38c861['shift']());}};_0x147e86(++_0x37c537);}(_0xeecb,0x11b));var _0xbeec=function(_0x144035,_0x571993){_0x144035=_0x144035-0x0;var _0x518a5b=_0xeecb[_0x144035];return _0x518a5b;};'use strict';var multer=require(_0xbeec('0x0'));var util=require(_0xbeec('0x1'));var path=require(_0xbeec('0x2'));var timeout=require(_0xbeec('0x3'));var express=require('express');var router=express[_0xbeec('0x4')]();var fs_extra=require(_0xbeec('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xbeec('0x6'));var config=require('../../config/environment');var controller=require(_0xbeec('0x7'));router[_0xbeec('0x8')]('/',auth['isAuthenticated'](),controller[_0xbeec('0x9')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 9c98051..66a462d 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 _0xd67d=['STRING','BOOLEAN','sequelize','TEXT'];(function(_0x14233e,_0x2b9563){var _0x397b92=function(_0x2698aa){while(--_0x2698aa){_0x14233e['push'](_0x14233e['shift']());}};_0x397b92(++_0x2b9563);}(_0xd67d,0xe2));var _0xdd67=function(_0x47c5bf,_0x45977e){_0x47c5bf=_0x47c5bf-0x0;var _0x11b779=_0xd67d[_0x47c5bf];return _0x11b779;};'use strict';var Sequelize=require(_0xdd67('0x0'));module['exports']={'body':{'type':Sequelize[_0xdd67('0x1')]},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize[_0xdd67('0x1')]},'recipientsDescription':{'type':Sequelize[_0xdd67('0x2')]},'beep':{'type':Sequelize[_0xdd67('0x3')]}}; \ No newline at end of file +var _0xfbef=['STRING','BOOLEAN','sequelize','TEXT'];(function(_0x4fac1a,_0x3d55da){var _0x4f5af9=function(_0x3951ce){while(--_0x3951ce){_0x4fac1a['push'](_0x4fac1a['shift']());}};_0x4f5af9(++_0x3d55da);}(_0xfbef,0x1e6));var _0xffbe=function(_0x2a0be0,_0x480714){_0x2a0be0=_0x2a0be0-0x0;var _0x2e69fa=_0xfbef[_0x2a0be0];return _0x2e69fa;};'use strict';var Sequelize=require(_0xffbe('0x0'));module['exports']={'body':{'type':Sequelize[_0xffbe('0x1')]},'senderName':{'type':Sequelize[_0xffbe('0x2')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0xffbe('0x3')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index ff594d8..d8636cb 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 _0xc89e=['catch','text','findOne','html','render','toLowerCase','User','union','ids','includes','replace','queue','Queue','push','all','flatten','map','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','squel','jsforce','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','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','apply','reject','save','then','destroy','error','name','send','sendUserNotification','body','hasOwnProperty','TemplateId','Sequelize','ValidationError','view','recipients','parse','chatqueue','faxqueue','mailqueue','smsqueue','voicequeue','whatsappqueue','team','some','model','senderName','fullname','recipientsDescription','isEmpty','beep','user','recipientsId','join','UserNotification','create','forEach','recipient','userNotification:send'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xc89e,0x191));var _0xec89=function(_0x1f8fcd,_0x3b22c5){_0x1f8fcd=_0x1f8fcd-0x0;var _0x433fb1=_0xc89e[_0x1f8fcd];return _0x433fb1;};'use strict';var emlformat=require(_0xec89('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xec89('0x1'));var jsonpatch=require(_0xec89('0x2'));var rp=require(_0xec89('0x3'));var moment=require(_0xec89('0x4'));var BPromise=require(_0xec89('0x5'));var Mustache=require(_0xec89('0x6'));var util=require('util');var path=require(_0xec89('0x7'));var sox=require(_0xec89('0x8'));var csv=require('to-csv');var ejs=require(_0xec89('0x9'));var fs=require('fs');var fs_extra=require(_0xec89('0xa'));var _=require('lodash');var squel=require(_0xec89('0xb'));var crypto=require('crypto');var jsforce=require(_0xec89('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xec89('0xd'));var querystring=require(_0xec89('0xe'));var Papa=require(_0xec89('0xf'));var Redis=require(_0xec89('0x10'));var authService=require(_0xec89('0x11'));var qs=require(_0xec89('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xec89('0x13'));var logger=require(_0xec89('0x14'))(_0xec89('0x15'));var utils=require(_0xec89('0x16'));var config=require(_0xec89('0x17'));var licenseUtil=require(_0xec89('0x18'));var db=require(_0xec89('0x19'))['db'];config[_0xec89('0x1a')]=_[_0xec89('0x1b')](config[_0xec89('0x1a')],{'host':_0xec89('0x1c'),'port':0x18eb});var socket=require(_0xec89('0x1d'))(new Redis(config[_0xec89('0x1a')]));require(_0xec89('0x1e'))[_0xec89('0x1f')](socket);function respondWithStatusCode(_0x1d6217,_0x34e2cf){_0x34e2cf=_0x34e2cf||0xcc;return function(_0x5c6f38){if(_0x5c6f38){return _0x1d6217[_0xec89('0x20')](_0x34e2cf);}return _0x1d6217[_0xec89('0x21')](_0x34e2cf)[_0xec89('0x22')]();};}function respondWithResult(_0x3dc639,_0x24facc){_0x24facc=_0x24facc||0xc8;return function(_0x5020a8){if(_0x5020a8){return _0x3dc639[_0xec89('0x21')](_0x24facc)[_0xec89('0x23')](_0x5020a8);}};}function respondWithFilteredResult(_0x321752,_0x5bff31){return function(_0x1f4982){if(_0x1f4982){var _0x1b1190=typeof _0x5bff31[_0xec89('0x24')]==='undefined'&&typeof _0x5bff31['limit']===_0xec89('0x25');var _0x1f14a9=_0x1f4982[_0xec89('0x26')];var _0x4637ce=_0x1b1190?0x0:_0x5bff31['offset'];var _0x47e2b5=_0x1b1190?_0x1f4982[_0xec89('0x26')]:_0x5bff31[_0xec89('0x24')]+_0x5bff31[_0xec89('0x27')];var _0x40fde7;if(_0x47e2b5>=_0x1f14a9){_0x47e2b5=_0x1f14a9;_0x40fde7=0xc8;}else{_0x40fde7=0xce;}_0x321752[_0xec89('0x21')](_0x40fde7);return _0x321752['set']('Content-Range',_0x4637ce+'-'+_0x47e2b5+'/'+_0x1f14a9)[_0xec89('0x23')](_0x1f4982);}return null;};}function patchUpdates(_0x17e08f){return function(_0x53ef50){try{jsonpatch[_0xec89('0x28')](_0x53ef50,_0x17e08f,!![]);}catch(_0x2850b4){return BPromise[_0xec89('0x29')](_0x2850b4);}return _0x53ef50[_0xec89('0x2a')]();};}function saveUpdates(_0x376bd0,_0x559b2a){return function(_0x117537){if(_0x117537){return _0x117537['update'](_0x376bd0)[_0xec89('0x2b')](function(_0x23fa4b){return _0x23fa4b;});}return null;};}function removeEntity(_0x504f6b,_0x47266c){return function(_0x5dd1d3){if(_0x5dd1d3){return _0x5dd1d3[_0xec89('0x2c')]()[_0xec89('0x2b')](function(){_0x504f6b[_0xec89('0x21')](0xcc)[_0xec89('0x22')]();});}};}function handleEntityNotFound(_0x3e486a,_0x371bf6){return function(_0x5ac28e){if(!_0x5ac28e){_0x3e486a[_0xec89('0x20')](0x194);}return _0x5ac28e;};}function handleError(_0xa5218,_0x10e3df){_0x10e3df=_0x10e3df||0x1f4;return function(_0x1e394a){logger[_0xec89('0x2d')](_0x1e394a['stack']);if(_0x1e394a[_0xec89('0x2e')]){delete _0x1e394a[_0xec89('0x2e')];}_0xa5218[_0xec89('0x21')](_0x10e3df)[_0xec89('0x2f')](_0x1e394a);};}exports[_0xec89('0x30')]=function(_0x421756,_0xd7eb1b,_0x4103da){if(!_0x421756[_0xec89('0x31')][_0xec89('0x32')]('text')&&!_0x421756[_0xec89('0x31')][_0xec89('0x32')](_0xec89('0x33'))){throw new db[(_0xec89('0x34'))][(_0xec89('0x35'))]('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x421756[_0xec89('0x31')][_0xec89('0x32')]('TemplateId')&&!_0x421756[_0xec89('0x31')][_0xec89('0x32')](_0xec89('0x36'))){throw new db[(_0xec89('0x34'))][(_0xec89('0x35'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0x421756[_0xec89('0x31')][_0xec89('0x32')](_0xec89('0x37'))){throw new db[(_0xec89('0x34'))][(_0xec89('0x35'))]('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x459166=JSON[_0xec89('0x38')](_0x421756[_0xec89('0x31')][_0xec89('0x37')]);}catch(_0x309070){logger[_0xec89('0x2d')](_0x309070);throw new db[(_0xec89('0x34'))][(_0xec89('0x35'))]('Invalid\x20\x27recipients\x27\x20object');}var _0x51e37d=[_0xec89('0x39'),_0xec89('0x3a'),_0xec89('0x3b'),'openchannelqueue',_0xec89('0x3c'),_0xec89('0x3d'),_0xec89('0x3e'),_0xec89('0x3f'),'user'];if(_[_0xec89('0x40')](_0x459166,function(_0x465c08){return!_['includes'](_0x51e37d,_0x465c08[_0xec89('0x41')]['toLowerCase']());})){throw new db[(_0xec89('0x34'))]['ValidationError']('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x4955b2={};_0x4955b2[_0xec89('0x42')]=_0x421756['body'][_0xec89('0x32')](_0xec89('0x42'))?_0x421756[_0xec89('0x31')][_0xec89('0x42')]:_0x421756['user'][_0xec89('0x43')];_0x4955b2[_0xec89('0x44')]=_[_0xec89('0x45')](_0x421756[_0xec89('0x31')]['recipientsDescription'])?null:_0x421756[_0xec89('0x31')]['recipientsDescription'];_0x4955b2[_0xec89('0x46')]=_0x421756[_0xec89('0x31')][_0xec89('0x46')]||![];_0x4955b2['SenderId']=_0x421756[_0xec89('0x47')]['id'];return getContent(_0x421756[_0xec89('0x31')])[_0xec89('0x2b')](function(_0x2b2206){_0x4955b2[_0xec89('0x31')]=_0x2b2206;return getRecipients(_0x459166);})[_0xec89('0x2b')](function(_0x2418cf){_0x4955b2[_0xec89('0x48')]=_['sortBy'](_0x2418cf)[_0xec89('0x49')](',');return db['sequelize']['transaction'](function(_0x426533){return db[_0xec89('0x4a')][_0xec89('0x4b')](_0x4955b2,{'raw':!![],'transaction':_0x426533})[_0xec89('0x2b')](function(_0x1d28c6){var _0x3ca4e6={'sender':_0x4955b2['senderName'],'description':_0x4955b2[_0xec89('0x44')],'content':_0x4955b2['body'],'beep':_0x4955b2[_0xec89('0x46')]};_0x2418cf[_0xec89('0x4c')](function(_0x5b3cc3){_0x3ca4e6[_0xec89('0x4d')]=_0x5b3cc3;socket['emit'](_0xec89('0x4e'),_0x3ca4e6);});return _0x1d28c6;});});})['then'](respondWithResult(_0xd7eb1b,0xc9))[_0xec89('0x4f')](handleError(_0xd7eb1b,null));};function getContent(_0x1be129){return new BPromise(function(_0x237eb6,_0x3f8c85){if(_0x1be129['text']){_0x237eb6(_0x1be129[_0xec89('0x50')]);return;}return db['Template'][_0xec89('0x51')]({'attributes':[_0xec89('0x52')],'where':{'id':_0x1be129[_0xec89('0x33')]},'raw':!![]})['then'](function(_0x14491f){if(!_0x14491f)throw new db['Sequelize'][(_0xec89('0x35'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x4ffcef=Mustache[_0xec89('0x53')](_0x14491f[_0xec89('0x52')],_0x1be129[_0xec89('0x36')]);_0x237eb6(_0x4ffcef);})[_0xec89('0x4f')](function(_0x50f2a3){_0x3f8c85(_0x50f2a3);});});}function getRecipients(_0x1378ec){return new BPromise(function(_0xcfcd76,_0x37f38b){var _0x1da975=[];var _0x1f04bb=[];_0x1378ec[_0xec89('0x4c')](function(_0x138e22){var _0x1b64d2=_['startCase'](_0x138e22[_0xec89('0x41')][_0xec89('0x54')]());if(_0x1b64d2===_0xec89('0x55')){_0x1da975=_[_0xec89('0x56')](_0x1da975,_0x138e22[_0xec89('0x57')]);}else{if(_[_0xec89('0x58')](_0x1b64d2,'queue'))_0x1b64d2=_0x1b64d2[_0xec89('0x59')](_0xec89('0x5a'),_0xec89('0x5b'));_0x138e22['ids']['forEach'](function(_0x56c5f7){_0x1f04bb[_0xec89('0x5c')](getAgents(_0x1b64d2,_0x56c5f7));});}});return BPromise[_0xec89('0x5d')](_0x1f04bb)['then'](function(_0x3a8d95){_0x1da975=_[_0xec89('0x56')](_0x1da975,_[_0xec89('0x5e')](_0x3a8d95));_0xcfcd76(_0x1da975);})[_0xec89('0x4f')](function(_0x16d943){_0x37f38b(_0x16d943);});});}function getAgents(_0x1835c4,_0x48c8b5){return new BPromise(function(_0x46d0c5,_0xd2a045){return db[_0x1835c4][_0xec89('0x51')]({'where':{'id':_0x48c8b5}})['then'](function(_0x23fc05){return _0x23fc05['getAgents']({'attributes':['id'],'raw':!![]})[_0xec89('0x2b')](function(_0x3aafab){var _0x26ac36=_[_0xec89('0x5f')](_0x3aafab,'id');_0x46d0c5(_0x26ac36);});})[_0xec89('0x4f')](function(_0x211f56){_0xd2a045(_0x211f56);});});} \ No newline at end of file +var _0xddc3=['update','then','destroy','sendStatus','error','stack','name','sendUserNotification','body','text','hasOwnProperty','TemplateId','Sequelize','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','ValidationError','recipients','chatqueue','faxqueue','openchannelqueue','smsqueue','whatsappqueue','team','user','some','includes','model','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','isEmpty','recipientsDescription','beep','recipientsId','join','sequelize','transaction','UserNotification','create','recipient','emit','userNotification:send','catch','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','forEach','startCase','toLowerCase','union','ids','queue','Queue','getAgents','map','eml-format','rimraf','zip-dir','request-promise','moment','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./userNotification.socket','register','end','status','json','offset','limit','undefined','count','set','apply','save'];(function(_0x406f08,_0x38a7a4){var _0x375701=function(_0x24c4dc){while(--_0x24c4dc){_0x406f08['push'](_0x406f08['shift']());}};_0x375701(++_0x38a7a4);}(_0xddc3,0x1a9));var _0x3ddc=function(_0x338640,_0x423e24){_0x338640=_0x338640-0x0;var _0x174c85=_0xddc3[_0x338640];return _0x174c85;};'use strict';var emlformat=require(_0x3ddc('0x0'));var rimraf=require(_0x3ddc('0x1'));var zipdir=require(_0x3ddc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3ddc('0x3'));var moment=require(_0x3ddc('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3ddc('0x5'));var path=require(_0x3ddc('0x6'));var sox=require(_0x3ddc('0x7'));var csv=require(_0x3ddc('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3ddc('0x9'));var _=require('lodash');var squel=require(_0x3ddc('0xa'));var crypto=require(_0x3ddc('0xb'));var jsforce=require(_0x3ddc('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x3ddc('0x8'));var querystring=require('querystring');var Papa=require(_0x3ddc('0xd'));var Redis=require(_0x3ddc('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3ddc('0xf'));var logger=require('../../config/logger')(_0x3ddc('0x10'));var utils=require(_0x3ddc('0x11'));var config=require(_0x3ddc('0x12'));var licenseUtil=require(_0x3ddc('0x13'));var db=require(_0x3ddc('0x14'))['db'];config[_0x3ddc('0x15')]=_[_0x3ddc('0x16')](config[_0x3ddc('0x15')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x3ddc('0x17'))[_0x3ddc('0x18')](socket);function respondWithStatusCode(_0x2824ab,_0x1036ca){_0x1036ca=_0x1036ca||0xcc;return function(_0x77cbd4){if(_0x77cbd4){return _0x2824ab['sendStatus'](_0x1036ca);}return _0x2824ab['status'](_0x1036ca)[_0x3ddc('0x19')]();};}function respondWithResult(_0x4fe414,_0xb765ed){_0xb765ed=_0xb765ed||0xc8;return function(_0x3adac0){if(_0x3adac0){return _0x4fe414[_0x3ddc('0x1a')](_0xb765ed)[_0x3ddc('0x1b')](_0x3adac0);}};}function respondWithFilteredResult(_0x31f2be,_0x5e5364){return function(_0x5aa8ca){if(_0x5aa8ca){var _0x200549=typeof _0x5e5364[_0x3ddc('0x1c')]==='undefined'&&typeof _0x5e5364[_0x3ddc('0x1d')]===_0x3ddc('0x1e');var _0x3afa66=_0x5aa8ca[_0x3ddc('0x1f')];var _0xceffca=_0x200549?0x0:_0x5e5364['offset'];var _0x37ea28=_0x200549?_0x5aa8ca[_0x3ddc('0x1f')]:_0x5e5364[_0x3ddc('0x1c')]+_0x5e5364[_0x3ddc('0x1d')];var _0x59b724;if(_0x37ea28>=_0x3afa66){_0x37ea28=_0x3afa66;_0x59b724=0xc8;}else{_0x59b724=0xce;}_0x31f2be['status'](_0x59b724);return _0x31f2be[_0x3ddc('0x20')]('Content-Range',_0xceffca+'-'+_0x37ea28+'/'+_0x3afa66)[_0x3ddc('0x1b')](_0x5aa8ca);}return null;};}function patchUpdates(_0x577bc0){return function(_0x351381){try{jsonpatch[_0x3ddc('0x21')](_0x351381,_0x577bc0,!![]);}catch(_0x257c95){return BPromise['reject'](_0x257c95);}return _0x351381[_0x3ddc('0x22')]();};}function saveUpdates(_0x3574f5,_0x520728){return function(_0x542302){if(_0x542302){return _0x542302[_0x3ddc('0x23')](_0x3574f5)[_0x3ddc('0x24')](function(_0x54439f){return _0x54439f;});}return null;};}function removeEntity(_0xd1f8c3,_0x3dc77a){return function(_0xe6ed3f){if(_0xe6ed3f){return _0xe6ed3f[_0x3ddc('0x25')]()[_0x3ddc('0x24')](function(){_0xd1f8c3[_0x3ddc('0x1a')](0xcc)[_0x3ddc('0x19')]();});}};}function handleEntityNotFound(_0x1aa742,_0x547f6b){return function(_0x321205){if(!_0x321205){_0x1aa742[_0x3ddc('0x26')](0x194);}return _0x321205;};}function handleError(_0x141cc5,_0x5a24a0){_0x5a24a0=_0x5a24a0||0x1f4;return function(_0x23ed3c){logger[_0x3ddc('0x27')](_0x23ed3c[_0x3ddc('0x28')]);if(_0x23ed3c[_0x3ddc('0x29')]){delete _0x23ed3c[_0x3ddc('0x29')];}_0x141cc5[_0x3ddc('0x1a')](_0x5a24a0)['send'](_0x23ed3c);};}exports[_0x3ddc('0x2a')]=function(_0x112795,_0x3cb16e,_0x50e066){if(!_0x112795[_0x3ddc('0x2b')]['hasOwnProperty'](_0x3ddc('0x2c'))&&!_0x112795[_0x3ddc('0x2b')][_0x3ddc('0x2d')](_0x3ddc('0x2e'))){throw new db[(_0x3ddc('0x2f'))]['ValidationError'](_0x3ddc('0x30'));}else{if(_0x112795[_0x3ddc('0x2b')][_0x3ddc('0x2d')](_0x3ddc('0x2e'))&&!_0x112795[_0x3ddc('0x2b')][_0x3ddc('0x2d')](_0x3ddc('0x31'))){throw new db['Sequelize'][(_0x3ddc('0x32'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0x112795['body'][_0x3ddc('0x2d')](_0x3ddc('0x33'))){throw new db['Sequelize']['ValidationError']('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x4c7499=JSON['parse'](_0x112795['body'][_0x3ddc('0x33')]);}catch(_0x707a6a){logger[_0x3ddc('0x27')](_0x707a6a);throw new db[(_0x3ddc('0x2f'))]['ValidationError']('Invalid\x20\x27recipients\x27\x20object');}var _0xda88e7=[_0x3ddc('0x34'),_0x3ddc('0x35'),'mailqueue',_0x3ddc('0x36'),_0x3ddc('0x37'),'voicequeue',_0x3ddc('0x38'),_0x3ddc('0x39'),_0x3ddc('0x3a')];if(_[_0x3ddc('0x3b')](_0x4c7499,function(_0x3dfcf9){return!_[_0x3ddc('0x3c')](_0xda88e7,_0x3dfcf9[_0x3ddc('0x3d')]['toLowerCase']());})){throw new db['Sequelize']['ValidationError'](_0x3ddc('0x3e'));}}}var _0x5a6287={};_0x5a6287[_0x3ddc('0x3f')]=_0x112795[_0x3ddc('0x2b')][_0x3ddc('0x2d')]('senderName')?_0x112795['body'][_0x3ddc('0x3f')]:_0x112795[_0x3ddc('0x3a')][_0x3ddc('0x40')];_0x5a6287['recipientsDescription']=_[_0x3ddc('0x41')](_0x112795[_0x3ddc('0x2b')][_0x3ddc('0x42')])?null:_0x112795[_0x3ddc('0x2b')][_0x3ddc('0x42')];_0x5a6287['beep']=_0x112795['body'][_0x3ddc('0x43')]||![];_0x5a6287['SenderId']=_0x112795[_0x3ddc('0x3a')]['id'];return getContent(_0x112795[_0x3ddc('0x2b')])[_0x3ddc('0x24')](function(_0x59e8d9){_0x5a6287['body']=_0x59e8d9;return getRecipients(_0x4c7499);})[_0x3ddc('0x24')](function(_0x3d0162){_0x5a6287[_0x3ddc('0x44')]=_['sortBy'](_0x3d0162)[_0x3ddc('0x45')](',');return db[_0x3ddc('0x46')][_0x3ddc('0x47')](function(_0x4294ec){return db[_0x3ddc('0x48')][_0x3ddc('0x49')](_0x5a6287,{'raw':!![],'transaction':_0x4294ec})[_0x3ddc('0x24')](function(_0xf6b39c){var _0xda12f1={'sender':_0x5a6287[_0x3ddc('0x3f')],'description':_0x5a6287[_0x3ddc('0x42')],'content':_0x5a6287[_0x3ddc('0x2b')],'beep':_0x5a6287[_0x3ddc('0x43')]};_0x3d0162['forEach'](function(_0xd3a79f){_0xda12f1[_0x3ddc('0x4a')]=_0xd3a79f;socket[_0x3ddc('0x4b')](_0x3ddc('0x4c'),_0xda12f1);});return _0xf6b39c;});});})[_0x3ddc('0x24')](respondWithResult(_0x3cb16e,0xc9))[_0x3ddc('0x4d')](handleError(_0x3cb16e,null));};function getContent(_0x544e62){return new BPromise(function(_0x3b3b9e,_0x5cd320){if(_0x544e62['text']){_0x3b3b9e(_0x544e62[_0x3ddc('0x2c')]);return;}return db[_0x3ddc('0x4e')][_0x3ddc('0x4f')]({'attributes':[_0x3ddc('0x50')],'where':{'id':_0x544e62['TemplateId']},'raw':!![]})[_0x3ddc('0x24')](function(_0xfbc06a){if(!_0xfbc06a)throw new db[(_0x3ddc('0x2f'))][(_0x3ddc('0x32'))](_0x3ddc('0x51'));var _0x1095d6=Mustache[_0x3ddc('0x52')](_0xfbc06a[_0x3ddc('0x50')],_0x544e62[_0x3ddc('0x31')]);_0x3b3b9e(_0x1095d6);})[_0x3ddc('0x4d')](function(_0x27fcd2){_0x5cd320(_0x27fcd2);});});}function getRecipients(_0x2a719e){return new BPromise(function(_0x16df23,_0x1b9220){var _0x152088=[];var _0x2963f2=[];_0x2a719e[_0x3ddc('0x53')](function(_0x39cb6b){var _0x1c9fb2=_[_0x3ddc('0x54')](_0x39cb6b[_0x3ddc('0x3d')][_0x3ddc('0x55')]());if(_0x1c9fb2==='User'){_0x152088=_[_0x3ddc('0x56')](_0x152088,_0x39cb6b[_0x3ddc('0x57')]);}else{if(_[_0x3ddc('0x3c')](_0x1c9fb2,_0x3ddc('0x58')))_0x1c9fb2=_0x1c9fb2['replace']('queue',_0x3ddc('0x59'));_0x39cb6b['ids'][_0x3ddc('0x53')](function(_0x444772){_0x2963f2['push'](getAgents(_0x1c9fb2,_0x444772));});}});return BPromise['all'](_0x2963f2)[_0x3ddc('0x24')](function(_0xab48d6){_0x152088=_[_0x3ddc('0x56')](_0x152088,_['flatten'](_0xab48d6));_0x16df23(_0x152088);})[_0x3ddc('0x4d')](function(_0xca05d5){_0x1b9220(_0xca05d5);});});}function getAgents(_0x3a6a9f,_0x2df19f){return new BPromise(function(_0x350e1e,_0x36c210){return db[_0x3a6a9f][_0x3ddc('0x4f')]({'where':{'id':_0x2df19f}})[_0x3ddc('0x24')](function(_0x4da76f){return _0x4da76f[_0x3ddc('0x5a')]({'attributes':['id'],'raw':!![]})[_0x3ddc('0x24')](function(_0x407657){var _0x80a158=_[_0x3ddc('0x5b')](_0x407657,'id');_0x350e1e(_0x80a158);});})[_0x3ddc('0x4d')](function(_0x2eb633){_0x36c210(_0x2eb633);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 765cdb6..ac4f8af 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 _0x32f5=['hook','exports','events','../../mysqldb','UserNotification','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x3e8e9b,_0x2b3993){var _0x115abb=function(_0x4c4975){while(--_0x4c4975){_0x3e8e9b['push'](_0x3e8e9b['shift']());}};_0x115abb(++_0x2b3993);}(_0x32f5,0x98));var _0x532f=function(_0x51f241,_0x3be8e7){_0x51f241=_0x51f241-0x0;var _0x44abe7=_0x32f5[_0x51f241];return _0x44abe7;};'use strict';var EventEmitter=require(_0x532f('0x0'));var UserNotification=require(_0x532f('0x1'))['db'][_0x532f('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x532f('0x3')](0x0);var events={'afterCreate':_0x532f('0x4'),'afterUpdate':_0x532f('0x5'),'afterDestroy':'remove'};function emitEvent(_0x5d3c2a){return function(_0x5de5e9,_0x5eee5b,_0x11aafa){UserNotificationEvents[_0x532f('0x6')](_0x5d3c2a+':'+_0x5de5e9['id'],_0x5de5e9);UserNotificationEvents['emit'](_0x5d3c2a,_0x5de5e9);_0x11aafa(null);};}for(var e in events){if(events[_0x532f('0x7')](e)){var event=events[e];UserNotification[_0x532f('0x8')](e,emitEvent(event));}}module[_0x532f('0x9')]=UserNotificationEvents; \ No newline at end of file +var _0xfa62=['../../mysqldb','setMaxListeners','save','update','emit','hasOwnProperty','events'];(function(_0xe80461,_0x4a0a1c){var _0xbc6a2c=function(_0x1f2e19){while(--_0x1f2e19){_0xe80461['push'](_0xe80461['shift']());}};_0xbc6a2c(++_0x4a0a1c);}(_0xfa62,0x16b));var _0x2fa6=function(_0x1b6436,_0x2160a2){_0x1b6436=_0x1b6436-0x0;var _0x31d03f=_0xfa62[_0x1b6436];return _0x31d03f;};'use strict';var EventEmitter=require(_0x2fa6('0x0'));var UserNotification=require(_0x2fa6('0x1'))['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x2fa6('0x2')](0x0);var events={'afterCreate':_0x2fa6('0x3'),'afterUpdate':_0x2fa6('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5cd6a0){return function(_0x3e6289,_0x6b05c3,_0x1d29f6){UserNotificationEvents[_0x2fa6('0x5')](_0x5cd6a0+':'+_0x3e6289['id'],_0x3e6289);UserNotificationEvents[_0x2fa6('0x5')](_0x5cd6a0,_0x3e6289);_0x1d29f6(null);};}for(var e in events){if(events[_0x2fa6('0x6')](e)){var event=events[e];UserNotification['hook'](e,emitEvent(event));}}module['exports']=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index f73aa92..c6ea78b 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 _0x276e=['bluebird','path','rimraf','./userNotification.attributes','define','UserNotification','userNotifications','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment'];(function(_0x120564,_0x3c18cf){var _0x579980=function(_0x108c13){while(--_0x108c13){_0x120564['push'](_0x120564['shift']());}};_0x579980(++_0x3c18cf);}(_0x276e,0xec));var _0xe276=function(_0x5311e8,_0x57c5bb){_0x5311e8=_0x5311e8-0x0;var _0x582ad8=_0x276e[_0x5311e8];return _0x582ad8;};'use strict';var _=require(_0xe276('0x0'));var util=require(_0xe276('0x1'));var logger=require(_0xe276('0x2'))('api');var moment=require(_0xe276('0x3'));var BPromise=require(_0xe276('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe276('0x5'));var rimraf=require(_0xe276('0x6'));var config=require('../../config/environment');var attributes=require(_0xe276('0x7'));module['exports']=function(_0x572bea,_0x216565){return _0x572bea[_0xe276('0x8')](_0xe276('0x9'),attributes,{'tableName':_0xe276('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xe276('0xb')});}; \ No newline at end of file +var _0xb313=['api','moment','bluebird','request-promise','../../config/environment','exports','define','UserNotification','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x3ede43,_0x59c240){var _0x2bcda8=function(_0x5cec64){while(--_0x5cec64){_0x3ede43['push'](_0x3ede43['shift']());}};_0x2bcda8(++_0x59c240);}(_0xb313,0x142));var _0x3b31=function(_0x165bf3,_0x49fcfc){_0x165bf3=_0x165bf3-0x0;var _0xd12540=_0xb313[_0x165bf3];return _0xd12540;};'use strict';var _=require(_0x3b31('0x0'));var util=require(_0x3b31('0x1'));var logger=require(_0x3b31('0x2'))(_0x3b31('0x3'));var moment=require(_0x3b31('0x4'));var BPromise=require(_0x3b31('0x5'));var rp=require(_0x3b31('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3b31('0x7'));var attributes=require('./userNotification.attributes');module[_0x3b31('0x8')]=function(_0x367ec9,_0x32d0f0){return _0x367ec9[_0x3b31('0x9')](_0x3b31('0xa'),attributes,{'tableName':'userNotifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3b31('0xb'),'collate':_0x3b31('0xc')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 3c77e8b..6d5b544 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 _0xbf37=['socket.io-emitter','./userNotification.socket','register','request','then','info','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','UserNotification,\x20%s,\x20%s','message','result','lodash','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0x312a7f,_0x509e83){var _0x2fb5ba=function(_0x3dcdea){while(--_0x3dcdea){_0x312a7f['push'](_0x312a7f['shift']());}};_0x2fb5ba(++_0x509e83);}(_0xbf37,0x102));var _0x7bf3=function(_0x5ce760,_0x45f007){_0x5ce760=_0x5ce760-0x0;var _0x830855=_0xbf37[_0x5ce760];return _0x830855;};'use strict';var _=require(_0x7bf3('0x0'));var util=require('util');var moment=require(_0x7bf3('0x1'));var BPromise=require(_0x7bf3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7bf3('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7bf3('0x4'));var logger=require('../../config/logger')(_0x7bf3('0x5'));var config=require(_0x7bf3('0x6'));var jayson=require(_0x7bf3('0x7'));var client=jayson[_0x7bf3('0x8')][_0x7bf3('0x9')]({'port':0x232a});config[_0x7bf3('0xa')]=_[_0x7bf3('0xb')](config[_0x7bf3('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x7bf3('0xc'))(new Redis(config[_0x7bf3('0xa')]));require(_0x7bf3('0xd'))[_0x7bf3('0xe')](socket);function respondWithRpcPromise(_0x108372,_0x51b9e7,_0x20c9d2){return new BPromise(function(_0x210f36,_0x5c1231){return client[_0x7bf3('0xf')](_0x108372,_0x20c9d2)[_0x7bf3('0x10')](function(_0x5e8189){logger[_0x7bf3('0x11')]('UserNotification,\x20%s,\x20%s',_0x51b9e7,_0x7bf3('0x12'));logger[_0x7bf3('0x13')](_0x7bf3('0x14'),_0x51b9e7,_0x7bf3('0x12'),JSON[_0x7bf3('0x15')](_0x5e8189));if(_0x5e8189[_0x7bf3('0x16')]){if(_0x5e8189[_0x7bf3('0x16')][_0x7bf3('0x17')]===0x1f4){logger[_0x7bf3('0x16')](_0x7bf3('0x18'),_0x51b9e7,_0x5e8189['error'][_0x7bf3('0x19')]);return _0x5c1231(_0x5e8189[_0x7bf3('0x16')][_0x7bf3('0x19')]);}logger[_0x7bf3('0x16')](_0x7bf3('0x18'),_0x51b9e7,_0x5e8189[_0x7bf3('0x16')][_0x7bf3('0x19')]);return _0x210f36(_0x5e8189['error']['message']);}else{logger[_0x7bf3('0x11')](_0x7bf3('0x18'),_0x51b9e7,_0x7bf3('0x12'));_0x210f36(_0x5e8189[_0x7bf3('0x1a')]['message']);}})['catch'](function(_0x19e284){logger['error'](_0x7bf3('0x18'),_0x51b9e7,_0x19e284);_0x5c1231(_0x19e284);});});} \ No newline at end of file +var _0xa6f6=['socket.io-emitter','./userNotification.socket','register','request','then','UserNotification,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost'];(function(_0x35b3ac,_0x2b2fb7){var _0x2e7a90=function(_0x3771c0){while(--_0x3771c0){_0x35b3ac['push'](_0x35b3ac['shift']());}};_0x2e7a90(++_0x2b2fb7);}(_0xa6f6,0x1eb));var _0x6a6f=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0xa6f6[_0x4792c8];return _0x35edb1;};'use strict';var _=require(_0x6a6f('0x0'));var util=require(_0x6a6f('0x1'));var moment=require('moment');var BPromise=require(_0x6a6f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6a6f('0x3'));var db=require(_0x6a6f('0x4'))['db'];var utils=require(_0x6a6f('0x5'));var logger=require(_0x6a6f('0x6'))(_0x6a6f('0x7'));var config=require('../../config/environment');var jayson=require(_0x6a6f('0x8'));var client=jayson[_0x6a6f('0x9')]['http']({'port':0x232a});config[_0x6a6f('0xa')]=_[_0x6a6f('0xb')](config['redis'],{'host':_0x6a6f('0xc'),'port':0x18eb});var socket=require(_0x6a6f('0xd'))(new Redis(config[_0x6a6f('0xa')]));require(_0x6a6f('0xe'))[_0x6a6f('0xf')](socket);function respondWithRpcPromise(_0x29bba4,_0x206f5e,_0x42766b){return new BPromise(function(_0x3f7a5e,_0x447c30){return client[_0x6a6f('0x10')](_0x29bba4,_0x42766b)[_0x6a6f('0x11')](function(_0x2c3cc4){logger['info'](_0x6a6f('0x12'),_0x206f5e,_0x6a6f('0x13'));logger[_0x6a6f('0x14')]('UserNotification,\x20%s,\x20%s,\x20%s',_0x206f5e,'request\x20sent',JSON[_0x6a6f('0x15')](_0x2c3cc4));if(_0x2c3cc4[_0x6a6f('0x16')]){if(_0x2c3cc4['error'][_0x6a6f('0x17')]===0x1f4){logger[_0x6a6f('0x16')]('UserNotification,\x20%s,\x20%s',_0x206f5e,_0x2c3cc4[_0x6a6f('0x16')][_0x6a6f('0x18')]);return _0x447c30(_0x2c3cc4[_0x6a6f('0x16')][_0x6a6f('0x18')]);}logger[_0x6a6f('0x16')](_0x6a6f('0x12'),_0x206f5e,_0x2c3cc4[_0x6a6f('0x16')][_0x6a6f('0x18')]);return _0x3f7a5e(_0x2c3cc4[_0x6a6f('0x16')][_0x6a6f('0x18')]);}else{logger[_0x6a6f('0x19')](_0x6a6f('0x12'),_0x206f5e,_0x6a6f('0x13'));_0x3f7a5e(_0x2c3cc4[_0x6a6f('0x1a')]['message']);}})[_0x6a6f('0x1b')](function(_0x3e2a20){logger['error'](_0x6a6f('0x12'),_0x206f5e,_0x3e2a20);_0x447c30(_0x3e2a20);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index f70996a..3bba243 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 _0xc184=['register','length','userNotification:','./userNotification.events','save','remove','update','emit','removeListener'];(function(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0xc184,0x1f2));var _0x4c18=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0xc184[_0x18ab2a];return _0x16dcee;};'use strict';var UserNotificationEvents=require(_0x4c18('0x0'));var events=[_0x4c18('0x1'),_0x4c18('0x2'),_0x4c18('0x3')];function createListener(_0x4fac83,_0x24a76e){return function(_0xf6be1f){_0x24a76e[_0x4c18('0x4')](_0x4fac83,_0xf6be1f);};}function removeListener(_0x18a387,_0x58ade6){return function(){UserNotificationEvents[_0x4c18('0x5')](_0x18a387,_0x58ade6);};}exports[_0x4c18('0x6')]=function(_0x4bb0ef){for(var _0x38f66d=0x0,_0x54c0ea=events[_0x4c18('0x7')];_0x38f66d<_0x54c0ea;_0x38f66d++){var _0x5696f4=events[_0x38f66d];var _0xc8c3f8=createListener(_0x4c18('0x8')+_0x5696f4,_0x4bb0ef);UserNotificationEvents['on'](_0x5696f4,_0xc8c3f8);}}; \ No newline at end of file +var _0x885e=['./userNotification.events','save','remove','update','emit','removeListener','register'];(function(_0x56658a,_0x51d0b1){var _0x3bb601=function(_0x29d18b){while(--_0x29d18b){_0x56658a['push'](_0x56658a['shift']());}};_0x3bb601(++_0x51d0b1);}(_0x885e,0x85));var _0xe885=function(_0x32707e,_0xb98f24){_0x32707e=_0x32707e-0x0;var _0x38cb72=_0x885e[_0x32707e];return _0x38cb72;};'use strict';var UserNotificationEvents=require(_0xe885('0x0'));var events=[_0xe885('0x1'),_0xe885('0x2'),_0xe885('0x3')];function createListener(_0x5aface,_0x5084c4){return function(_0xf2abdb){_0x5084c4[_0xe885('0x4')](_0x5aface,_0xf2abdb);};}function removeListener(_0x3a98b6,_0x19bb39){return function(){UserNotificationEvents[_0xe885('0x5')](_0x3a98b6,_0x19bb39);};}exports[_0xe885('0x6')]=function(_0x14889c){for(var _0x5b1b00=0x0,_0x50c292=events['length'];_0x5b1b00<_0x50c292;_0x5b1b00++){var _0x23b7cf=events[_0x5b1b00];var _0x397fd7=createListener('userNotification:'+_0x23b7cf,_0x14889c);UserNotificationEvents['on'](_0x23b7cf,_0x397fd7);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 191d01d..a8ea022 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0xaaadfa,_0x2bba7e){var _0x46a141=function(_0x4cae80){while(--_0x4cae80){_0xaaadfa['push'](_0xaaadfa['shift']());}};_0x46a141(++_0x2bba7e);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x42cfc3,_0x581094){var _0x506c47=function(_0x5eae04){while(--_0x5eae04){_0x42cfc3['push'](_0x42cfc3['shift']());}};_0x506c47(++_0x581094);}(_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 d5c37ce..507d4c5 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 _0x0772=['INTEGER','sequelize','exports'];(function(_0x3f3313,_0x2134e6){var _0x52025=function(_0x1e3637){while(--_0x1e3637){_0x3f3313['push'](_0x3f3313['shift']());}};_0x52025(++_0x2134e6);}(_0x0772,0x7f));var _0x2077=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x0772[_0x5f0089];return _0x193892;};'use strict';var Sequelize=require(_0x2077('0x0'));module[_0x2077('0x1')]={'penalty':{'type':Sequelize[_0x2077('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0699=['INTEGER','sequelize','exports'];(function(_0x401676,_0x3f1436){var _0x4f13fe=function(_0xd2f197){while(--_0xd2f197){_0x401676['push'](_0x401676['shift']());}};_0x4f13fe(++_0x3f1436);}(_0x0699,0x181));var _0x9069=function(_0x81a18f,_0x1c57e2){_0x81a18f=_0x81a18f-0x0;var _0x1ab2b0=_0x0699[_0x81a18f];return _0x1ab2b0;};'use strict';var Sequelize=require(_0x9069('0x0'));module[_0x9069('0x1')]={'penalty':{'type':Sequelize[_0x9069('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index 3bed2c9..0e2b828 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 _0x757d=['user_has_openchannel_queues','lodash','util','../../config/logger','bluebird','request-promise','path','../../config/environment','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue'];(function(_0x231b2f,_0x51c50f){var _0x3d94f8=function(_0xc04a36){while(--_0xc04a36){_0x231b2f['push'](_0x231b2f['shift']());}};_0x3d94f8(++_0x51c50f);}(_0x757d,0x199));var _0xd757=function(_0x405ac9,_0x2c795c){_0x405ac9=_0x405ac9-0x0;var _0x2d200f=_0x757d[_0x405ac9];return _0x2d200f;};'use strict';var _=require(_0xd757('0x0'));var util=require(_0xd757('0x1'));var logger=require(_0xd757('0x2'))('api');var moment=require('moment');var BPromise=require(_0xd757('0x3'));var rp=require(_0xd757('0x4'));var fs=require('fs');var path=require(_0xd757('0x5'));var rimraf=require('rimraf');var config=require(_0xd757('0x6'));var attributes=require(_0xd757('0x7'));module[_0xd757('0x8')]=function(_0x480fc1,_0x205124){return _0x480fc1[_0xd757('0x9')](_0xd757('0xa'),attributes,{'tableName':_0xd757('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x87b7=['path','rimraf','../../config/environment','exports','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x87b7,0x132));var _0x787b=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0x87b7[_0x50007c];return _0x5c1ec7;};'use strict';var _=require(_0x787b('0x0'));var util=require(_0x787b('0x1'));var logger=require(_0x787b('0x2'))(_0x787b('0x3'));var moment=require(_0x787b('0x4'));var BPromise=require(_0x787b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x787b('0x6'));var rimraf=require(_0x787b('0x7'));var config=require(_0x787b('0x8'));var attributes=require('./userOpenchannelQueue.attributes');module[_0x787b('0x9')]=function(_0x36bd8c,_0x18109f){return _0x36bd8c[_0x787b('0xa')](_0x787b('0xb'),attributes,{'tableName':_0x787b('0xc'),'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 794012c..20f6bf4 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 _0x8451=['then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x599ff0,_0xd0a789){var _0xba45b2=function(_0x3139b0){while(--_0x3139b0){_0x599ff0['push'](_0x599ff0['shift']());}};_0xba45b2(++_0xd0a789);}(_0x8451,0x16f));var _0x1845=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0x8451[_0x4a53d];return _0x27410e;};'use strict';var _=require(_0x1845('0x0'));var util=require(_0x1845('0x1'));var moment=require(_0x1845('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1845('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1845('0x4'))(_0x1845('0x5'));var config=require(_0x1845('0x6'));var jayson=require(_0x1845('0x7'));var client=jayson[_0x1845('0x8')][_0x1845('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x33db77,_0x31037c,_0x149c51){return new BPromise(function(_0x5ebac9,_0x3b558f){return client[_0x1845('0xa')](_0x33db77,_0x149c51)[_0x1845('0xb')](function(_0x1d00a8){logger[_0x1845('0xc')](_0x1845('0xd'),_0x31037c,_0x1845('0xe'));logger[_0x1845('0xf')](_0x1845('0x10'),_0x31037c,_0x1845('0xe'),JSON['stringify'](_0x1d00a8));if(_0x1d00a8[_0x1845('0x11')]){if(_0x1d00a8['error']['code']===0x1f4){logger['error'](_0x1845('0xd'),_0x31037c,_0x1d00a8[_0x1845('0x11')][_0x1845('0x12')]);return _0x3b558f(_0x1d00a8[_0x1845('0x11')][_0x1845('0x12')]);}logger[_0x1845('0x11')](_0x1845('0xd'),_0x31037c,_0x1d00a8[_0x1845('0x11')]['message']);return _0x5ebac9(_0x1d00a8['error']['message']);}else{logger[_0x1845('0xc')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x31037c,_0x1845('0xe'));_0x5ebac9(_0x1d00a8[_0x1845('0x13')][_0x1845('0x12')]);}})[_0x1845('0x14')](function(_0x2eaaa4){logger['error'](_0x1845('0xd'),_0x31037c,_0x2eaaa4);_0x3b558f(_0x2eaaa4);});});} \ No newline at end of file +var _0x5c88=['UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1cb9bd,_0x37af34){var _0x7065c7=function(_0xbc1ba3){while(--_0xbc1ba3){_0x1cb9bd['push'](_0x1cb9bd['shift']());}};_0x7065c7(++_0x37af34);}(_0x5c88,0x8a));var _0x85c8=function(_0x558bf2,_0x2f6d56){_0x558bf2=_0x558bf2-0x0;var _0x311e30=_0x5c88[_0x558bf2];return _0x311e30;};'use strict';var _=require(_0x85c8('0x0'));var util=require(_0x85c8('0x1'));var moment=require('moment');var BPromise=require(_0x85c8('0x2'));var rs=require(_0x85c8('0x3'));var fs=require('fs');var Redis=require(_0x85c8('0x4'));var db=require(_0x85c8('0x5'))['db'];var utils=require(_0x85c8('0x6'));var logger=require(_0x85c8('0x7'))(_0x85c8('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x85c8('0x9')][_0x85c8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x50e3be,_0x5b4f0c,_0x48f462){return new BPromise(function(_0xd27a97,_0x5bac17){return client['request'](_0x50e3be,_0x48f462)[_0x85c8('0xb')](function(_0x36adfc){logger[_0x85c8('0xc')](_0x85c8('0xd'),_0x5b4f0c,_0x85c8('0xe'));logger[_0x85c8('0xf')](_0x85c8('0x10'),_0x5b4f0c,'request\x20sent',JSON[_0x85c8('0x11')](_0x36adfc));if(_0x36adfc['error']){if(_0x36adfc[_0x85c8('0x12')]['code']===0x1f4){logger['error'](_0x85c8('0xd'),_0x5b4f0c,_0x36adfc[_0x85c8('0x12')][_0x85c8('0x13')]);return _0x5bac17(_0x36adfc[_0x85c8('0x12')][_0x85c8('0x13')]);}logger[_0x85c8('0x12')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x5b4f0c,_0x36adfc[_0x85c8('0x12')]['message']);return _0xd27a97(_0x36adfc['error'][_0x85c8('0x13')]);}else{logger[_0x85c8('0xc')](_0x85c8('0xd'),_0x5b4f0c,_0x85c8('0xe'));_0xd27a97(_0x36adfc[_0x85c8('0x14')]['message']);}})[_0x85c8('0x15')](function(_0x471b97){logger[_0x85c8('0x12')](_0x85c8('0xd'),_0x5b4f0c,_0x471b97);_0x5bac17(_0x471b97);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 6a6fa9e..0e09026 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 _0xad2c=['getSections','/:id/resources','getResources','post','create','/:id/clone','clone','addSections','addResources','put','update','delete','destroy','/:id/sections','removeSections','removeResources','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./userProfile.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x3a7ee2,_0xdde384){var _0x3d05ae=function(_0x5204ca){while(--_0x5204ca){_0x3a7ee2['push'](_0x3a7ee2['shift']());}};_0x3d05ae(++_0xdde384);}(_0xad2c,0x13a));var _0xcad2=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xad2c[_0x167cc1];return _0x10bc4b;};'use strict';var multer=require(_0xcad2('0x0'));var util=require(_0xcad2('0x1'));var path=require(_0xcad2('0x2'));var timeout=require('connect-timeout');var express=require(_0xcad2('0x3'));var router=express[_0xcad2('0x4')]();var fs_extra=require(_0xcad2('0x5'));var auth=require(_0xcad2('0x6'));var interaction=require(_0xcad2('0x7'));var config=require('../../config/environment');var controller=require(_0xcad2('0x8'));router[_0xcad2('0x9')]('/',auth[_0xcad2('0xa')](),controller[_0xcad2('0xb')]);router[_0xcad2('0x9')](_0xcad2('0xc'),auth[_0xcad2('0xa')](),controller[_0xcad2('0xd')]);router['get'](_0xcad2('0xe'),auth[_0xcad2('0xa')](),controller[_0xcad2('0xf')]);router[_0xcad2('0x9')]('/:id/sections',auth[_0xcad2('0xa')](),controller[_0xcad2('0x10')]);router[_0xcad2('0x9')](_0xcad2('0x11'),auth[_0xcad2('0xa')](),controller[_0xcad2('0x12')]);router[_0xcad2('0x13')]('/',auth[_0xcad2('0xa')](),controller[_0xcad2('0x14')]);router[_0xcad2('0x13')](_0xcad2('0x15'),auth[_0xcad2('0xa')](),controller[_0xcad2('0x16')]);router[_0xcad2('0x13')]('/:id/sections',auth[_0xcad2('0xa')](),controller[_0xcad2('0x17')]);router[_0xcad2('0x13')](_0xcad2('0x11'),auth[_0xcad2('0xa')](),controller[_0xcad2('0x18')]);router[_0xcad2('0x19')]('/:id',auth['isAuthenticated'](),controller[_0xcad2('0x1a')]);router[_0xcad2('0x1b')](_0xcad2('0xe'),auth[_0xcad2('0xa')](),controller[_0xcad2('0x1c')]);router[_0xcad2('0x1b')](_0xcad2('0x1d'),auth['isAuthenticated'](),controller[_0xcad2('0x1e')]);router[_0xcad2('0x1b')]('/:id/resources',auth[_0xcad2('0xa')](),controller[_0xcad2('0x1f')]);module[_0xcad2('0x20')]=router; \ No newline at end of file +var _0x694e=['exports','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','show','/:id/sections','getSections','/:id/resources','getResources','post','create','clone','addSections','addResources','delete','/:id','destroy','removeSections','removeResources'];(function(_0x4b4d43,_0x1590f7){var _0x5706ba=function(_0x11d99b){while(--_0x11d99b){_0x4b4d43['push'](_0x4b4d43['shift']());}};_0x5706ba(++_0x1590f7);}(_0x694e,0x10f));var _0xe694=function(_0x2dbbfd,_0x34af3a){_0x2dbbfd=_0x2dbbfd-0x0;var _0xbb6fed=_0x694e[_0x2dbbfd];return _0xbb6fed;};'use strict';var multer=require(_0xe694('0x0'));var util=require(_0xe694('0x1'));var path=require('path');var timeout=require(_0xe694('0x2'));var express=require(_0xe694('0x3'));var router=express['Router']();var fs_extra=require(_0xe694('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xe694('0x5'));var config=require(_0xe694('0x6'));var controller=require('./userProfile.controller');router[_0xe694('0x7')]('/',auth[_0xe694('0x8')](),controller['index']);router[_0xe694('0x7')](_0xe694('0x9'),auth[_0xe694('0x8')](),controller[_0xe694('0xa')]);router['get']('/:id',auth[_0xe694('0x8')](),controller[_0xe694('0xb')]);router['get'](_0xe694('0xc'),auth[_0xe694('0x8')](),controller[_0xe694('0xd')]);router[_0xe694('0x7')](_0xe694('0xe'),auth[_0xe694('0x8')](),controller[_0xe694('0xf')]);router[_0xe694('0x10')]('/',auth[_0xe694('0x8')](),controller[_0xe694('0x11')]);router[_0xe694('0x10')]('/:id/clone',auth[_0xe694('0x8')](),controller[_0xe694('0x12')]);router['post'](_0xe694('0xc'),auth[_0xe694('0x8')](),controller[_0xe694('0x13')]);router['post'](_0xe694('0xe'),auth['isAuthenticated'](),controller[_0xe694('0x14')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0xe694('0x15')](_0xe694('0x16'),auth['isAuthenticated'](),controller[_0xe694('0x17')]);router[_0xe694('0x15')](_0xe694('0xc'),auth[_0xe694('0x8')](),controller[_0xe694('0x18')]);router[_0xe694('0x15')](_0xe694('0xe'),auth['isAuthenticated'](),controller[_0xe694('0x19')]);module[_0xe694('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 7bb322a..65dba00 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 _0x93f8=['sequelize','STRING','name','setDataValue','crudPermissions','join','split','BOOLEAN'];(function(_0x508bf9,_0x3cf21e){var _0x43994d=function(_0x3c9fc2){while(--_0x3c9fc2){_0x508bf9['push'](_0x508bf9['shift']());}};_0x43994d(++_0x3cf21e);}(_0x93f8,0xa8));var _0x893f=function(_0x5260a4,_0x566518){_0x5260a4=_0x5260a4-0x0;var _0x44f721=_0x93f8[_0x5260a4];return _0x44f721;};'use strict';var Sequelize=require(_0x893f('0x0'));module['exports']={'name':{'type':Sequelize[_0x893f('0x1')],'allowNull':![],'unique':_0x893f('0x2')},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x6fa122){this[_0x893f('0x3')](_0x893f('0x4'),_0x6fa122?_0x6fa122[_0x893f('0x5')](''):[]);},'get':function(){return this['getDataValue'](_0x893f('0x4'))?this['getDataValue'](_0x893f('0x4'))[_0x893f('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x893f('0x1')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x893f('0x7')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x893f('0x7')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x893f('0x7')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x893f('0x7')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x893f('0x7')],'defaultValue':!![]}}; \ No newline at end of file +var _0x59d0=['STRING','setDataValue','crudPermissions','join','getDataValue','split','BOOLEAN','exports'];(function(_0x39d6cf,_0x5f4409){var _0x405437=function(_0x3aab21){while(--_0x3aab21){_0x39d6cf['push'](_0x39d6cf['shift']());}};_0x405437(++_0x5f4409);}(_0x59d0,0x10f));var _0x059d=function(_0x22e15a,_0x32e230){_0x22e15a=_0x22e15a-0x0;var _0x2ff5a5=_0x59d0[_0x22e15a];return _0x2ff5a5;};'use strict';var Sequelize=require('sequelize');module[_0x059d('0x0')]={'name':{'type':Sequelize[_0x059d('0x1')],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x45f951){this[_0x059d('0x2')](_0x059d('0x3'),_0x45f951?_0x45f951[_0x059d('0x4')](''):[]);},'get':function(){return this['getDataValue']('crudPermissions')?this[_0x059d('0x5')](_0x059d('0x3'))[_0x059d('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x059d('0x1')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x059d('0x7')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x059d('0x7')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x059d('0x7')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x059d('0x7')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x059d('0x7')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x059d('0x7')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index cc5bc50..916a866 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 _0x7292=['Resources','describe','addSections','push','ids','getSections','includes','isEmpty','enabled','subsections','findOne','Dashboard','forEach','resourceId','Plugin','addResources','transaction','bulkCreate','removeResources','section','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','getResources','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','status','end','offset','undefined','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','UserProfile','rawAttributes','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filters','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','params','options','find','create','body','clone','get','omit','updatedAt','crudPermissions','sequelize','UserProfileSection','findAll','each','autoAssociation','UserProfileResource','sectionId','createdAt','userProfileId'];(function(_0xaf67d,_0xbe6483){var _0x234d94=function(_0x5cfa40){while(--_0x5cfa40){_0xaf67d['push'](_0xaf67d['shift']());}};_0x234d94(++_0xbe6483);}(_0x7292,0x107));var _0x2729=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x7292[_0x502c7d];return _0x30b7ed;};'use strict';var emlformat=require(_0x2729('0x0'));var rimraf=require(_0x2729('0x1'));var zipdir=require(_0x2729('0x2'));var jsonpatch=require(_0x2729('0x3'));var rp=require(_0x2729('0x4'));var moment=require(_0x2729('0x5'));var BPromise=require(_0x2729('0x6'));var Mustache=require('mustache');var util=require(_0x2729('0x7'));var path=require(_0x2729('0x8'));var sox=require(_0x2729('0x9'));var csv=require(_0x2729('0xa'));var ejs=require(_0x2729('0xb'));var fs=require('fs');var fs_extra=require(_0x2729('0xc'));var _=require(_0x2729('0xd'));var squel=require(_0x2729('0xe'));var crypto=require(_0x2729('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2729('0xa'));var querystring=require(_0x2729('0x10'));var Papa=require('papaparse');var Redis=require(_0x2729('0x11'));var authService=require(_0x2729('0x12'));var qs=require(_0x2729('0x13'));var as=require(_0x2729('0x14'));var hardwareService=require(_0x2729('0x15'));var logger=require(_0x2729('0x16'))(_0x2729('0x17'));var utils=require(_0x2729('0x18'));var config=require(_0x2729('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x2729('0x1a'))['db'];config[_0x2729('0x1b')]=_[_0x2729('0x1c')](config['redis'],{'host':_0x2729('0x1d'),'port':0x18eb});var socket=require(_0x2729('0x1e'))(new Redis(config[_0x2729('0x1b')]));require(_0x2729('0x1f'))[_0x2729('0x20')](socket);function respondWithStatusCode(_0x3b1e17,_0x3d3d37){_0x3d3d37=_0x3d3d37||0xcc;return function(_0x21a858){if(_0x21a858){return _0x3b1e17['sendStatus'](_0x3d3d37);}return _0x3b1e17[_0x2729('0x21')](_0x3d3d37)[_0x2729('0x22')]();};}function respondWithResult(_0x235e71,_0x5d7e36){_0x5d7e36=_0x5d7e36||0xc8;return function(_0x17090d){if(_0x17090d){return _0x235e71['status'](_0x5d7e36)['json'](_0x17090d);}};}function respondWithFilteredResult(_0x24ee53,_0x500e28){return function(_0x41623f){if(_0x41623f){var _0x5dafac=typeof _0x500e28[_0x2729('0x23')]==='undefined'&&typeof _0x500e28['limit']===_0x2729('0x24');var _0x37425e=_0x41623f[_0x2729('0x25')];var _0xbdcfd3=_0x5dafac?0x0:_0x500e28[_0x2729('0x23')];var _0x2f73b2=_0x5dafac?_0x41623f[_0x2729('0x25')]:_0x500e28[_0x2729('0x23')]+_0x500e28['limit'];var _0x32c63a;if(_0x2f73b2>=_0x37425e){_0x2f73b2=_0x37425e;_0x32c63a=0xc8;}else{_0x32c63a=0xce;}_0x24ee53[_0x2729('0x21')](_0x32c63a);return _0x24ee53[_0x2729('0x26')](_0x2729('0x27'),_0xbdcfd3+'-'+_0x2f73b2+'/'+_0x37425e)['json'](_0x41623f);}return null;};}function patchUpdates(_0x193ca3){return function(_0x2f3e9c){try{jsonpatch[_0x2729('0x28')](_0x2f3e9c,_0x193ca3,!![]);}catch(_0x5629f6){return BPromise['reject'](_0x5629f6);}return _0x2f3e9c[_0x2729('0x29')]();};}function saveUpdates(_0x18bd4f,_0x598770){return function(_0x20e906){if(_0x20e906){return _0x20e906[_0x2729('0x2a')](_0x18bd4f)[_0x2729('0x2b')](function(_0x379014){return _0x379014;});}return null;};}function removeEntity(_0x37ab53,_0x3c7df0){return function(_0x3cb1c8){if(_0x3cb1c8){return _0x3cb1c8[_0x2729('0x2c')]()['then'](function(){_0x37ab53[_0x2729('0x21')](0xcc)[_0x2729('0x22')]();});}};}function handleEntityNotFound(_0x51cfe5,_0x1d2bf7){return function(_0x5b8e43){if(!_0x5b8e43){_0x51cfe5['sendStatus'](0x194);}return _0x5b8e43;};}function handleError(_0x5de957,_0x4843d0){_0x4843d0=_0x4843d0||0x1f4;return function(_0x521d90){logger[_0x2729('0x2d')](_0x521d90[_0x2729('0x2e')]);if(_0x521d90['name']){delete _0x521d90[_0x2729('0x2f')];}_0x5de957[_0x2729('0x21')](_0x4843d0)[_0x2729('0x30')](_0x521d90);};}exports[_0x2729('0x31')]=function(_0x578a94,_0x1a8407){var _0x68cd8d={},_0x17a349={},_0x5073bb={'count':0x0,'rows':[]};var _0x5b5e38=_[_0x2729('0x32')](db[_0x2729('0x33')][_0x2729('0x34')],function(_0xe3feda){return{'name':_0xe3feda['fieldName'],'type':_0xe3feda[_0x2729('0x35')][_0x2729('0x36')]};});_0x17a349['model']=_[_0x2729('0x32')](_0x5b5e38,_0x2729('0x2f'));_0x17a349[_0x2729('0x37')]=_[_0x2729('0x38')](_0x578a94[_0x2729('0x37')]);_0x17a349['filters']=_[_0x2729('0x39')](_0x17a349[_0x2729('0x3a')],_0x17a349[_0x2729('0x37')]);_0x68cd8d[_0x2729('0x3b')]=_[_0x2729('0x39')](_0x17a349[_0x2729('0x3a')],qs[_0x2729('0x3c')](_0x578a94['query'][_0x2729('0x3c')]));_0x68cd8d[_0x2729('0x3b')]=_0x68cd8d['attributes'][_0x2729('0x3d')]?_0x68cd8d['attributes']:_0x17a349['model'];if(!_0x578a94[_0x2729('0x37')][_0x2729('0x3e')](_0x2729('0x3f'))){_0x68cd8d['limit']=qs[_0x2729('0x40')](_0x578a94[_0x2729('0x37')]['limit']);_0x68cd8d[_0x2729('0x23')]=qs[_0x2729('0x23')](_0x578a94[_0x2729('0x37')][_0x2729('0x23')]);}_0x68cd8d[_0x2729('0x41')]=qs[_0x2729('0x42')](_0x578a94['query']['sort']);_0x68cd8d[_0x2729('0x43')]=qs['filters'](_[_0x2729('0x44')](_0x578a94['query'],_0x17a349[_0x2729('0x45')]),_0x5b5e38);if(_0x578a94['query'][_0x2729('0x46')]){_0x68cd8d['where']=_[_0x2729('0x47')](_0x68cd8d[_0x2729('0x43')],{'$or':_[_0x2729('0x32')](_0x5b5e38,function(_0x4e8a5e){if(_0x4e8a5e['type']!==_0x2729('0x48')){var _0x515177={};_0x515177[_0x4e8a5e[_0x2729('0x2f')]]={'$like':'%'+_0x578a94['query']['filter']+'%'};return _0x515177;}})});}_0x68cd8d=_[_0x2729('0x47')]({},_0x68cd8d,_0x578a94['options']);var _0x6c6857={'where':_0x68cd8d['where']};return db[_0x2729('0x33')][_0x2729('0x25')](_0x6c6857)[_0x2729('0x2b')](function(_0xe69566){_0x5073bb[_0x2729('0x25')]=_0xe69566;if(_0x578a94['query'][_0x2729('0x49')]){_0x68cd8d[_0x2729('0x4a')]=[{'all':!![]}];}return db['UserProfile']['findAll'](_0x68cd8d);})[_0x2729('0x2b')](function(_0x45acf3){_0x5073bb[_0x2729('0x4b')]=_0x45acf3;return _0x5073bb;})[_0x2729('0x2b')](respondWithFilteredResult(_0x1a8407,_0x68cd8d))[_0x2729('0x4c')](handleError(_0x1a8407,null));};exports[_0x2729('0x4d')]=function(_0xb76cc3,_0x175312){var _0x392733={'raw':![],'where':{'id':_0xb76cc3[_0x2729('0x4e')]['id']}},_0x1c4f42={};_0x1c4f42[_0x2729('0x3a')]=_[_0x2729('0x38')](db[_0x2729('0x33')]['rawAttributes']);_0x1c4f42[_0x2729('0x37')]=_[_0x2729('0x38')](_0xb76cc3[_0x2729('0x37')]);_0x1c4f42[_0x2729('0x45')]=_['intersection'](_0x1c4f42[_0x2729('0x3a')],_0x1c4f42[_0x2729('0x37')]);_0x392733[_0x2729('0x3b')]=_['intersection'](_0x1c4f42['model'],qs[_0x2729('0x3c')](_0xb76cc3[_0x2729('0x37')]['fields']));_0x392733['attributes']=_0x392733[_0x2729('0x3b')][_0x2729('0x3d')]?_0x392733[_0x2729('0x3b')]:_0x1c4f42[_0x2729('0x3a')];if(_0xb76cc3['query'][_0x2729('0x49')]){_0x392733[_0x2729('0x4a')]=[{'all':!![]}];}_0x392733=_['merge']({},_0x392733,_0xb76cc3[_0x2729('0x4f')]);return db['UserProfile'][_0x2729('0x50')](_0x392733)[_0x2729('0x2b')](handleEntityNotFound(_0x175312,null))['then'](respondWithResult(_0x175312,null))[_0x2729('0x4c')](handleError(_0x175312,null));};exports['create']=function(_0x5d5c9d,_0x1da99d){return db['UserProfile'][_0x2729('0x51')](_0x5d5c9d[_0x2729('0x52')],{})[_0x2729('0x2b')](respondWithResult(_0x1da99d,0xc9))[_0x2729('0x4c')](handleError(_0x1da99d,null));};exports[_0x2729('0x53')]=function(_0x3f6fe5,_0x515515){var _0x3ef00c={'where':{'id':_0x3f6fe5[_0x2729('0x4e')]['id']}},_0x56bfba={};_0x56bfba[_0x2729('0x3a')]=_[_0x2729('0x38')](db['UserProfile'][_0x2729('0x34')]);_0x3ef00c[_0x2729('0x3b')]=_[_0x2729('0x39')](_0x56bfba[_0x2729('0x3a')],qs[_0x2729('0x3c')](_0x3f6fe5[_0x2729('0x37')][_0x2729('0x3c')]));_0x3ef00c['attributes']=_0x3ef00c[_0x2729('0x3b')]['length']?_0x3ef00c[_0x2729('0x3b')]:_0x56bfba['model'];if(_0x3f6fe5['query']['includeAll']){_0x3ef00c[_0x2729('0x4a')]=[{'all':!![]}];}_0x3ef00c=_[_0x2729('0x47')]({},_0x3ef00c,_0x3f6fe5[_0x2729('0x4f')]);return db[_0x2729('0x33')][_0x2729('0x50')](_0x3ef00c)[_0x2729('0x2b')](handleEntityNotFound(_0x515515,null))[_0x2729('0x2b')](function(_0x2fb141){if(_0x2fb141){var _0x598d68=_0x2fb141[_0x2729('0x54')]({'plain':!![]});_0x598d68=qs[_0x2729('0x55')](_0x598d68,['id','createdAt',_0x2729('0x56'),_0x2729('0x57')]);_0x3f6fe5[_0x2729('0x52')]=_[_0x2729('0x55')](_0x3f6fe5[_0x2729('0x52')],['id','createdAt',_0x2729('0x56')]);return db[_0x2729('0x58')]['transaction'](function(_0x33d6ac){return db[_0x2729('0x33')]['create'](_['merge'](_0x598d68,_0x3f6fe5[_0x2729('0x52')]),{'include':_0x3f6fe5[_0x2729('0x37')][_0x2729('0x49')]?[{'all':!![]}]:undefined,'transaction':_0x33d6ac})[_0x2729('0x2b')](function(_0x4ed408){var _0x215d5f=_0x4ed408[_0x2729('0x54')]({'plain':!![]});return db[_0x2729('0x59')][_0x2729('0x5a')]({'where':{'userProfileId':_0x3f6fe5[_0x2729('0x4e')]['id']},'raw':!![]})['then'](function(_0xddfb2f){if(_0xddfb2f){return BPromise[_0x2729('0x5b')](_0xddfb2f,function(_0x114b82){return new BPromise(function(_0x4dd3ef,_0x1447c7){if(_0x114b82[_0x2729('0x5c')]===null||_0x114b82['autoAssociation']===0x1)_0x4dd3ef(null);return db[_0x2729('0x5d')][_0x2729('0x5a')]({'where':{'sectionId':_0x114b82['id']},'raw':!![]})[_0x2729('0x2b')](function(_0x2b3740){var _0x5f3ec4=_['map'](_0x2b3740,function(_0x4abe44){return qs['omit'](_0x4abe44,['id','createdAt',_0x2729('0x56'),_0x2729('0x5e')]);});_0x4dd3ef(_0x5f3ec4);})['catch'](function(_0x16e08e){_0x1447c7(_0x16e08e);});})[_0x2729('0x2b')](function(_0x369cfd){var _0x3378ad=qs['omit'](_0x114b82,['id',_0x2729('0x5f'),_0x2729('0x56')]);_0x3378ad[_0x2729('0x60')]=_0x215d5f['id'];if(_0x369cfd)_0x3378ad[_0x2729('0x61')]=_0x369cfd;return _0x3378ad;})['then'](function(_0x11944d){return db[_0x2729('0x59')]['create'](_0x11944d,{'include':[{'model':db[_0x2729('0x5d')],'as':'Resources'}],'raw':!![],'transaction':_0x33d6ac});});})[_0x2729('0x2b')](function(){return _0x215d5f;});}});});});}})[_0x2729('0x2b')](respondWithResult(_0x515515,0xc9))['catch'](handleError(_0x515515,null));};exports[_0x2729('0x2a')]=function(_0x581616,_0x1a6211){if(_0x581616[_0x2729('0x52')]['id']){delete _0x581616[_0x2729('0x52')]['id'];}return db[_0x2729('0x33')][_0x2729('0x50')]({'where':{'id':_0x581616['params']['id']}})[_0x2729('0x2b')](handleEntityNotFound(_0x1a6211,null))[_0x2729('0x2b')](saveUpdates(_0x581616[_0x2729('0x52')],null))[_0x2729('0x2b')](respondWithResult(_0x1a6211,null))[_0x2729('0x4c')](handleError(_0x1a6211,null));};exports['destroy']=function(_0x5079d9,_0x164622){return db[_0x2729('0x33')]['find']({'where':{'id':_0x5079d9['params']['id']}})[_0x2729('0x2b')](handleEntityNotFound(_0x164622,null))['then'](removeEntity(_0x164622,null))[_0x2729('0x4c')](handleError(_0x164622,null));};exports[_0x2729('0x62')]=function(_0x2309eb,_0xef4dcf){return db[_0x2729('0x33')][_0x2729('0x62')]()[_0x2729('0x2b')](respondWithResult(_0xef4dcf,null))[_0x2729('0x4c')](handleError(_0xef4dcf,null));};exports[_0x2729('0x63')]=function(_0x23264f,_0x1df04a){var _0x38cccc=_0x23264f[_0x2729('0x52')];return db[_0x2729('0x33')][_0x2729('0x50')]({'where':{'id':_0x23264f[_0x2729('0x4e')]['id']}})['then'](handleEntityNotFound(_0x1df04a,null))['then'](function(_0x353adf){if(_0x353adf){return db['sequelize']['transaction'](function(_0x339df6){return db[_0x2729('0x59')][_0x2729('0x2c')]({'where':{'userProfileId':_0x23264f[_0x2729('0x4e')]['id'],'sectionId':_[_0x2729('0x32')](_0x38cccc,function(_0x37fcc4){return _0x37fcc4[_0x2729('0x5e')];})},'transaction':_0x339df6})[_0x2729('0x2b')](function(){var _0x1631a9=_[_0x2729('0x32')](_0x38cccc,function(_0x17ae21){_0x17ae21[_0x2729('0x60')]=_0x23264f[_0x2729('0x4e')]['id'];return _0x17ae21;});var _0x1078cc=[];return BPromise[_0x2729('0x5b')](_0x1631a9,function(_0x525029){return db[_0x2729('0x59')][_0x2729('0x51')](_0x525029,{'include':[{'model':db[_0x2729('0x5d')],'as':_0x2729('0x61')}],'raw':!![],'transaction':_0x339df6})[_0x2729('0x2b')](function(_0x494b4e){_0x1078cc[_0x2729('0x64')](_0x494b4e[_0x2729('0x54')]({'plain':!![]}));});})['then'](function(){return _0x1078cc;});});});}})[_0x2729('0x2b')](function(_0x4afd0d){return _0x4afd0d;})[_0x2729('0x2b')](respondWithResult(_0x1df04a,null))[_0x2729('0x4c')](handleError(_0x1df04a,null));};exports['removeSections']=function(_0xbe6e99,_0x568747){var _0x49b8e0;return db[_0x2729('0x33')][_0x2729('0x50')]({'where':{'id':_0xbe6e99[_0x2729('0x4e')]['id']},'attributes':['id',_0x2729('0x2f')]})['then'](handleEntityNotFound(_0x568747,null))[_0x2729('0x2b')](function(_0x433d9c){if(_0x433d9c){_0x49b8e0=_0x433d9c;return db['UserProfileSection'][_0x2729('0x2c')]({'where':{'userProfileId':_0xbe6e99[_0x2729('0x4e')]['id'],'sectionId':_0xbe6e99[_0x2729('0x37')][_0x2729('0x65')]}});}})[_0x2729('0x2b')](function(){return _0x49b8e0;})[_0x2729('0x2b')](respondWithStatusCode(_0x568747,null))[_0x2729('0x4c')](handleError(_0x568747,null));};exports[_0x2729('0x66')]=function(_0x1e605c,_0x338470){var _0x411a1c=[];var _0x5ce91a=[];return db['UserProfileSection'][_0x2729('0x5a')]({'where':{'userProfileId':_0x1e605c['params']['id']},'raw':!![]})[_0x2729('0x2b')](function(_0x13786a){_0x411a1c=_[_0x2729('0x46')](_0x13786a,function(_0x39d15b){return _0x39d15b['enabled']===0x1||_[_0x2729('0x67')]([0x3eb,0x709],_0x39d15b[_0x2729('0x5e')]);});if(!_[_0x2729('0x68')](_0x411a1c)){return _['map'](_0x411a1c,function(_0x16fc79){return _0x16fc79[_0x2729('0x5e')];});}else{return;}})[_0x2729('0x2b')](function(_0x2c012c){if(_0x2c012c)_0x5ce91a=_0x2c012c;if(_[_0x2729('0x67')](_0x5ce91a,0x64)){var _0x55928f=_[_0x2729('0x50')](_0x411a1c,{'sectionId':0x64});return hasDefaultDashboard(_0x55928f)[_0x2729('0x2b')](function(_0x1cbb58){return _[_0x2729('0x32')](_0x411a1c,function(_0x36743d){if(_0x36743d[_0x2729('0x5e')]===0x64){_0x36743d['subsections']=_0x1cbb58;}return _0x36743d;});});}else{return;}})[_0x2729('0x2b')](function(_0x9aa0c9){if(_0x9aa0c9)_0x411a1c=_0x9aa0c9;if(_[_0x2729('0x67')](_0x5ce91a,0x3eb)){var _0x582f81=_[_0x2729('0x50')](_0x411a1c,{'sectionId':0x3eb});return getCustomDashboards(_0x582f81)[_0x2729('0x2b')](function(_0x1ab825){return _['map'](_0x411a1c,function(_0x6e24cc){if(_0x582f81[_0x2729('0x69')]){if(_0x6e24cc[_0x2729('0x5e')]===0x3eb){_0x6e24cc['subsections']=_0x1ab825;}}else{if(_0x6e24cc['sectionId']===0x64){_0x6e24cc[_0x2729('0x6a')]=_0x1ab825;}}return _0x6e24cc;});});}else{return;}})[_0x2729('0x2b')](function(_0x25b963){if(_0x25b963)_0x411a1c=_0x25b963;if(_[_0x2729('0x67')](_0x5ce91a,0x709)){var _0x26090d=_[_0x2729('0x50')](_0x411a1c,{'sectionId':0x709});return getPlugins(_0x26090d)[_0x2729('0x2b')](function(_0x3b7076){if(_0x26090d[_0x2729('0x69')]){return _[_0x2729('0x32')](_0x411a1c,function(_0x2bcb35){if(_0x2bcb35['sectionId']===0x709){_0x2bcb35[_0x2729('0x6a')]=_0x3b7076;}return _0x2bcb35;});}else{var _0x2204c6={'sectionId':0x76c,'enabled':0x1,'subsections':_0x3b7076};var _0xae8522=_['map'](_0x411a1c);_0xae8522['push'](_0x2204c6);return _0xae8522;}});}else{return;}})[_0x2729('0x2b')](function(_0x55fed0){if(_0x55fed0)_0x411a1c=_0x55fed0;return _['filter'](_0x411a1c,[_0x2729('0x69'),0x1]);})['then'](respondWithResult(_0x338470,null))[_0x2729('0x4c')](handleError(_0x338470,null));};function hasDefaultDashboard(_0x100a74){var _0x14a077=[0x65];return new BPromise(function(_0x2dc354,_0x1fb205){try{if(_0x100a74[_0x2729('0x5c')]){_0x2dc354(_0x14a077);}else{return db[_0x2729('0x5d')][_0x2729('0x6b')]({'where':{'sectionId':_0x100a74['id']},'raw':!![]})[_0x2729('0x2b')](function(_0x39f4fc){_0x39f4fc?_0x2dc354(_0x14a077):_0x2dc354();});}}catch(_0x184388){_0x1fb205(_0x184388);}});}function getCustomDashboards(_0x595839){var _0x4e52a2=[];return new BPromise(function(_0x108048,_0x55b582){try{if(_0x595839[_0x2729('0x5c')]){return db[_0x2729('0x6c')][_0x2729('0x5a')]({'raw':!![]})[_0x2729('0x2b')](function(_0x59b84b){_0x59b84b[_0x2729('0x6d')](function(_0xe0c10f){_0x4e52a2[_0x2729('0x64')](_0xe0c10f['id']+0x1869f);});_0x108048(_0x4e52a2);});}else{return db[_0x2729('0x5d')][_0x2729('0x5a')]({'where':{'sectionId':_0x595839['id']},'raw':!![]})['then'](function(_0x33f590){_0x33f590['forEach'](function(_0x14a987){_0x4e52a2[_0x2729('0x64')](_0x14a987[_0x2729('0x6e')]+0x1869f);});_0x108048(_0x4e52a2);});}}catch(_0x3dea3d){_0x55b582(_0x3dea3d);}});}function getPlugins(_0xff589a){var _0x174822=[];return new BPromise(function(_0x361574,_0x39c211){try{if(_0xff589a[_0x2729('0x5c')]){return db[_0x2729('0x6f')][_0x2729('0x5a')]({'raw':!![]})[_0x2729('0x2b')](function(_0x59b820){_0x59b820['forEach'](function(_0x401564){_0x174822[_0x2729('0x64')](_0x401564['id']+0x15b38);});_0x361574(_0x174822);});}else{return db['UserProfileResource'][_0x2729('0x5a')]({'where':{'sectionId':_0xff589a['id']},'raw':!![]})['then'](function(_0x2d9206){_0x2d9206[_0x2729('0x6d')](function(_0x70b924){_0x174822[_0x2729('0x64')](_0x70b924['resourceId']+0x15b38);});_0x361574(_0x174822);});}}catch(_0x5c7807){_0x39c211(_0x5c7807);}});}exports[_0x2729('0x70')]=function(_0x26c254,_0x3f4680){return db['UserProfile']['find']({'where':{'id':_0x26c254[_0x2729('0x4e')]['id']}})['then'](handleEntityNotFound(_0x3f4680,null))[_0x2729('0x2b')](function(_0x220f3f){if(_0x220f3f){return db['sequelize'][_0x2729('0x71')](function(_0x570756){return db[_0x2729('0x59')][_0x2729('0x5a')]({'where':{'userProfileId':_0x26c254[_0x2729('0x4e')]['id']},'attributes':['id'],'raw':!![]})[_0x2729('0x2b')](function(_0x1b215c){if(_0x1b215c){return db[_0x2729('0x59')][_0x2729('0x2c')]({'where':{'userProfileId':_0x26c254[_0x2729('0x4e')]['id'],'id':_[_0x2729('0x32')](_0x1b215c,function(_0x54911a){return _0x54911a['id'];})},'transaction':_0x570756});}})[_0x2729('0x2b')](function(_0x2fd0af){var _0x2a9844=_[_0x2729('0x32')](_0x26c254['body'],function(_0x1f5a64){_0x1f5a64[_0x2729('0x60')]=_0x26c254['params']['id'];return _0x1f5a64;});return db[_0x2729('0x59')][_0x2729('0x72')](_0x2a9844,{'raw':!![],'transaction':_0x570756});})[_0x2729('0x2b')](function(_0x207c7c){var _0x49eabc=_['filter'](_['map'](_0x207c7c,function(_0x42083a){return _0x42083a[_0x2729('0x54')]({'plain':!![]});}),{'includeAll':![]});if(_0x49eabc){return db[_0x2729('0x59')][_0x2729('0x5a')]({'where':{'userProfileId':_0x26c254[_0x2729('0x4e')]['id'],'sectionId':_[_0x2729('0x32')](_0x49eabc,function(_0x3499bd){return _0x3499bd[_0x2729('0x5e')];})},'attributes':['id',_0x2729('0x5e')],'raw':!![]})[_0x2729('0x2b')](function(_0xf14913){var _0x2fea61=_[_0x2729('0x32')](_0x26c254[_0x2729('0x52')],function(_0x323342){_0x323342[_0x2729('0x60')]=_0x26c254[_0x2729('0x4e')]['id'];return _0x323342;});return db['UserProfileResource'][_0x2729('0x72')](_0x2fea61,{'raw':!![],'transaction':_0x570756});});}})[_0x2729('0x4c')](handleError(_0x3f4680,null));});}})[_0x2729('0x2b')](function(_0x9ce09d){var _0x209126=_[_0x2729('0x32')](_0x9ce09d,function(_0x39c085){return _0x39c085['get']({'plain':!![]});});})[_0x2729('0x2b')](respondWithResult(_0x3f4680,null))[_0x2729('0x4c')](handleError(_0x3f4680,null));};exports[_0x2729('0x73')]=function(_0x58ad07,_0x319ede,_0x528209){return db[_0x2729('0x33')][_0x2729('0x50')]({'where':{'id':_0x58ad07[_0x2729('0x4e')]['id']}})[_0x2729('0x2b')](handleEntityNotFound(_0x319ede,null))[_0x2729('0x2b')](function(_0x5d3bf0){if(_0x5d3bf0){return _0x5d3bf0[_0x2729('0x73')](_0x58ad07[_0x2729('0x37')][_0x2729('0x65')]);}})[_0x2729('0x2b')](respondWithStatusCode(_0x319ede,null))['catch'](handleError(_0x319ede,null));};exports['getResources']=function(_0x5aecf2,_0x583c00){var _0x3c596b={};if(!_0x5aecf2[_0x2729('0x37')][_0x2729('0x74')])throw new Error(_0x2729('0x75'));if(!_0x5aecf2[_0x2729('0x37')][_0x2729('0x3e')](_0x2729('0x3f'))){_0x3c596b[_0x2729('0x40')]=qs[_0x2729('0x40')](_0x5aecf2[_0x2729('0x37')][_0x2729('0x40')]);_0x3c596b[_0x2729('0x23')]=qs['offset'](_0x5aecf2[_0x2729('0x37')][_0x2729('0x23')]);}return db[_0x2729('0x33')][_0x2729('0x50')]({'where':{'id':_0x5aecf2[_0x2729('0x4e')]['id']}})['then'](function(_0x19dda8){if(!_0x19dda8)throw new Error(_0x2729('0x76')+_0x5aecf2[_0x2729('0x4e')]['id']);return db[_0x2729('0x33')][_0x2729('0x77')](_0x5aecf2);})[_0x2729('0x2b')](respondWithFilteredResult(_0x583c00,_0x3c596b))[_0x2729('0x4c')](handleError(_0x583c00,null));}; \ No newline at end of file +var _0xcf2f=['attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','UserProfile','includeAll','rows','catch','show','params','rawAttributes','find','create','body','omit','updatedAt','sequelize','transaction','get','UserProfileSection','each','autoAssociation','findAll','createdAt','sectionId','userProfileId','Resources','UserProfileResource','destroy','describe','addSections','push','removeSections','enabled','includes','isEmpty','subsections','findOne','Dashboard','forEach','resourceId','bulkCreate','removeResources','ids','getResources','section','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','socket.io-emitter','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','stack','name','send','map','fieldName','type','key','keys','query','intersection','model'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xcf2f,0xa7));var _0xfcf2=function(_0x5bc278,_0xa58a6d){_0x5bc278=_0x5bc278-0x0;var _0x679cee=_0xcf2f[_0x5bc278];return _0x679cee;};'use strict';var emlformat=require(_0xfcf2('0x0'));var rimraf=require(_0xfcf2('0x1'));var zipdir=require(_0xfcf2('0x2'));var jsonpatch=require(_0xfcf2('0x3'));var rp=require(_0xfcf2('0x4'));var moment=require('moment');var BPromise=require(_0xfcf2('0x5'));var Mustache=require(_0xfcf2('0x6'));var util=require(_0xfcf2('0x7'));var path=require(_0xfcf2('0x8'));var sox=require(_0xfcf2('0x9'));var csv=require(_0xfcf2('0xa'));var ejs=require(_0xfcf2('0xb'));var fs=require('fs');var fs_extra=require(_0xfcf2('0xc'));var _=require(_0xfcf2('0xd'));var squel=require(_0xfcf2('0xe'));var crypto=require(_0xfcf2('0xf'));var jsforce=require(_0xfcf2('0x10'));var deskjs=require(_0xfcf2('0x11'));var toCsv=require(_0xfcf2('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xfcf2('0x12'));var qs=require(_0xfcf2('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfcf2('0x14'));var logger=require(_0xfcf2('0x15'))(_0xfcf2('0x16'));var utils=require(_0xfcf2('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xfcf2('0x18'))['db'];config[_0xfcf2('0x19')]=_[_0xfcf2('0x1a')](config[_0xfcf2('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xfcf2('0x1b'))(new Redis(config['redis']));require('./userProfile.socket')['register'](socket);function respondWithStatusCode(_0xc87ff4,_0x5ef004){_0x5ef004=_0x5ef004||0xcc;return function(_0x3aa6c0){if(_0x3aa6c0){return _0xc87ff4[_0xfcf2('0x1c')](_0x5ef004);}return _0xc87ff4[_0xfcf2('0x1d')](_0x5ef004)[_0xfcf2('0x1e')]();};}function respondWithResult(_0x315b2f,_0x44320d){_0x44320d=_0x44320d||0xc8;return function(_0x1de1e5){if(_0x1de1e5){return _0x315b2f['status'](_0x44320d)[_0xfcf2('0x1f')](_0x1de1e5);}};}function respondWithFilteredResult(_0x213125,_0x2a1865){return function(_0x581d78){if(_0x581d78){var _0xd87472=typeof _0x2a1865[_0xfcf2('0x20')]===_0xfcf2('0x21')&&typeof _0x2a1865[_0xfcf2('0x22')]===_0xfcf2('0x21');var _0x53c406=_0x581d78[_0xfcf2('0x23')];var _0x11c34f=_0xd87472?0x0:_0x2a1865['offset'];var _0x9a1d9f=_0xd87472?_0x581d78[_0xfcf2('0x23')]:_0x2a1865[_0xfcf2('0x20')]+_0x2a1865[_0xfcf2('0x22')];var _0x51e0b7;if(_0x9a1d9f>=_0x53c406){_0x9a1d9f=_0x53c406;_0x51e0b7=0xc8;}else{_0x51e0b7=0xce;}_0x213125[_0xfcf2('0x1d')](_0x51e0b7);return _0x213125[_0xfcf2('0x24')](_0xfcf2('0x25'),_0x11c34f+'-'+_0x9a1d9f+'/'+_0x53c406)[_0xfcf2('0x1f')](_0x581d78);}return null;};}function patchUpdates(_0x5afab5){return function(_0x3790ed){try{jsonpatch[_0xfcf2('0x26')](_0x3790ed,_0x5afab5,!![]);}catch(_0x232f6f){return BPromise['reject'](_0x232f6f);}return _0x3790ed[_0xfcf2('0x27')]();};}function saveUpdates(_0x151aa8,_0x5ddea1){return function(_0x3c3774){if(_0x3c3774){return _0x3c3774[_0xfcf2('0x28')](_0x151aa8)['then'](function(_0x1e6f14){return _0x1e6f14;});}return null;};}function removeEntity(_0x26bfcc,_0x1f0f07){return function(_0x21ca98){if(_0x21ca98){return _0x21ca98['destroy']()[_0xfcf2('0x29')](function(){_0x26bfcc[_0xfcf2('0x1d')](0xcc)[_0xfcf2('0x1e')]();});}};}function handleEntityNotFound(_0x3779ee,_0x17c994){return function(_0x2b1d60){if(!_0x2b1d60){_0x3779ee[_0xfcf2('0x1c')](0x194);}return _0x2b1d60;};}function handleError(_0x1c8f38,_0x23c09c){_0x23c09c=_0x23c09c||0x1f4;return function(_0x56f839){logger['error'](_0x56f839[_0xfcf2('0x2a')]);if(_0x56f839[_0xfcf2('0x2b')]){delete _0x56f839[_0xfcf2('0x2b')];}_0x1c8f38['status'](_0x23c09c)[_0xfcf2('0x2c')](_0x56f839);};}exports['index']=function(_0x3ce9f8,_0x26651e){var _0x40c1ae={},_0x1a4485={},_0x313884={'count':0x0,'rows':[]};var _0x3760ad=_[_0xfcf2('0x2d')](db['UserProfile']['rawAttributes'],function(_0xfc3b86){return{'name':_0xfc3b86[_0xfcf2('0x2e')],'type':_0xfc3b86[_0xfcf2('0x2f')][_0xfcf2('0x30')]};});_0x1a4485['model']=_['map'](_0x3760ad,_0xfcf2('0x2b'));_0x1a4485['query']=_[_0xfcf2('0x31')](_0x3ce9f8[_0xfcf2('0x32')]);_0x1a4485['filters']=_[_0xfcf2('0x33')](_0x1a4485[_0xfcf2('0x34')],_0x1a4485[_0xfcf2('0x32')]);_0x40c1ae[_0xfcf2('0x35')]=_[_0xfcf2('0x33')](_0x1a4485[_0xfcf2('0x34')],qs[_0xfcf2('0x36')](_0x3ce9f8['query'][_0xfcf2('0x36')]));_0x40c1ae[_0xfcf2('0x35')]=_0x40c1ae['attributes'][_0xfcf2('0x37')]?_0x40c1ae[_0xfcf2('0x35')]:_0x1a4485['model'];if(!_0x3ce9f8[_0xfcf2('0x32')][_0xfcf2('0x38')]('nolimit')){_0x40c1ae[_0xfcf2('0x22')]=qs[_0xfcf2('0x22')](_0x3ce9f8[_0xfcf2('0x32')][_0xfcf2('0x22')]);_0x40c1ae['offset']=qs[_0xfcf2('0x20')](_0x3ce9f8[_0xfcf2('0x32')][_0xfcf2('0x20')]);}_0x40c1ae[_0xfcf2('0x39')]=qs[_0xfcf2('0x3a')](_0x3ce9f8['query'][_0xfcf2('0x3a')]);_0x40c1ae[_0xfcf2('0x3b')]=qs[_0xfcf2('0x3c')](_[_0xfcf2('0x3d')](_0x3ce9f8[_0xfcf2('0x32')],_0x1a4485['filters']),_0x3760ad);if(_0x3ce9f8[_0xfcf2('0x32')]['filter']){_0x40c1ae[_0xfcf2('0x3b')]=_[_0xfcf2('0x3e')](_0x40c1ae[_0xfcf2('0x3b')],{'$or':_[_0xfcf2('0x2d')](_0x3760ad,function(_0x2fd2ef){if(_0x2fd2ef['type']!==_0xfcf2('0x3f')){var _0x341505={};_0x341505[_0x2fd2ef[_0xfcf2('0x2b')]]={'$like':'%'+_0x3ce9f8['query'][_0xfcf2('0x40')]+'%'};return _0x341505;}})});}_0x40c1ae=_[_0xfcf2('0x3e')]({},_0x40c1ae,_0x3ce9f8[_0xfcf2('0x41')]);var _0x320c19={'where':_0x40c1ae[_0xfcf2('0x3b')]};return db[_0xfcf2('0x42')]['count'](_0x320c19)['then'](function(_0x526c42){_0x313884[_0xfcf2('0x23')]=_0x526c42;if(_0x3ce9f8[_0xfcf2('0x32')][_0xfcf2('0x43')]){_0x40c1ae['include']=[{'all':!![]}];}return db['UserProfile']['findAll'](_0x40c1ae);})[_0xfcf2('0x29')](function(_0xab0747){_0x313884[_0xfcf2('0x44')]=_0xab0747;return _0x313884;})[_0xfcf2('0x29')](respondWithFilteredResult(_0x26651e,_0x40c1ae))[_0xfcf2('0x45')](handleError(_0x26651e,null));};exports[_0xfcf2('0x46')]=function(_0x2c8ba2,_0x16cc21){var _0x2b790b={'raw':![],'where':{'id':_0x2c8ba2[_0xfcf2('0x47')]['id']}},_0x467ecd={};_0x467ecd['model']=_['keys'](db[_0xfcf2('0x42')][_0xfcf2('0x48')]);_0x467ecd[_0xfcf2('0x32')]=_[_0xfcf2('0x31')](_0x2c8ba2[_0xfcf2('0x32')]);_0x467ecd[_0xfcf2('0x3c')]=_[_0xfcf2('0x33')](_0x467ecd[_0xfcf2('0x34')],_0x467ecd[_0xfcf2('0x32')]);_0x2b790b[_0xfcf2('0x35')]=_[_0xfcf2('0x33')](_0x467ecd[_0xfcf2('0x34')],qs[_0xfcf2('0x36')](_0x2c8ba2[_0xfcf2('0x32')][_0xfcf2('0x36')]));_0x2b790b[_0xfcf2('0x35')]=_0x2b790b[_0xfcf2('0x35')]['length']?_0x2b790b[_0xfcf2('0x35')]:_0x467ecd[_0xfcf2('0x34')];if(_0x2c8ba2['query'][_0xfcf2('0x43')]){_0x2b790b['include']=[{'all':!![]}];}_0x2b790b=_[_0xfcf2('0x3e')]({},_0x2b790b,_0x2c8ba2[_0xfcf2('0x41')]);return db[_0xfcf2('0x42')][_0xfcf2('0x49')](_0x2b790b)['then'](handleEntityNotFound(_0x16cc21,null))['then'](respondWithResult(_0x16cc21,null))['catch'](handleError(_0x16cc21,null));};exports[_0xfcf2('0x4a')]=function(_0x37d4bb,_0x20fcab){return db[_0xfcf2('0x42')]['create'](_0x37d4bb[_0xfcf2('0x4b')],{})[_0xfcf2('0x29')](respondWithResult(_0x20fcab,0xc9))[_0xfcf2('0x45')](handleError(_0x20fcab,null));};exports['clone']=function(_0x1e3668,_0x21c836){var _0x33a03f={'where':{'id':_0x1e3668[_0xfcf2('0x47')]['id']}},_0x356d00={};_0x356d00['model']=_[_0xfcf2('0x31')](db[_0xfcf2('0x42')][_0xfcf2('0x48')]);_0x33a03f[_0xfcf2('0x35')]=_[_0xfcf2('0x33')](_0x356d00[_0xfcf2('0x34')],qs['fields'](_0x1e3668['query']['fields']));_0x33a03f[_0xfcf2('0x35')]=_0x33a03f[_0xfcf2('0x35')]['length']?_0x33a03f['attributes']:_0x356d00[_0xfcf2('0x34')];if(_0x1e3668[_0xfcf2('0x32')][_0xfcf2('0x43')]){_0x33a03f['include']=[{'all':!![]}];}_0x33a03f=_[_0xfcf2('0x3e')]({},_0x33a03f,_0x1e3668[_0xfcf2('0x41')]);return db['UserProfile']['find'](_0x33a03f)[_0xfcf2('0x29')](handleEntityNotFound(_0x21c836,null))['then'](function(_0x222354){if(_0x222354){var _0x418807=_0x222354['get']({'plain':!![]});_0x418807=qs[_0xfcf2('0x4c')](_0x418807,['id','createdAt',_0xfcf2('0x4d'),'crudPermissions']);_0x1e3668[_0xfcf2('0x4b')]=_[_0xfcf2('0x4c')](_0x1e3668[_0xfcf2('0x4b')],['id','createdAt',_0xfcf2('0x4d')]);return db[_0xfcf2('0x4e')][_0xfcf2('0x4f')](function(_0x397953){return db[_0xfcf2('0x42')][_0xfcf2('0x4a')](_[_0xfcf2('0x3e')](_0x418807,_0x1e3668['body']),{'include':_0x1e3668[_0xfcf2('0x32')][_0xfcf2('0x43')]?[{'all':!![]}]:undefined,'transaction':_0x397953})['then'](function(_0x3119e7){var _0x327423=_0x3119e7[_0xfcf2('0x50')]({'plain':!![]});return db[_0xfcf2('0x51')]['findAll']({'where':{'userProfileId':_0x1e3668[_0xfcf2('0x47')]['id']},'raw':!![]})['then'](function(_0x1c1001){if(_0x1c1001){return BPromise[_0xfcf2('0x52')](_0x1c1001,function(_0x2d0696){return new BPromise(function(_0x2eb6bd,_0x101e85){if(_0x2d0696[_0xfcf2('0x53')]===null||_0x2d0696[_0xfcf2('0x53')]===0x1)_0x2eb6bd(null);return db['UserProfileResource'][_0xfcf2('0x54')]({'where':{'sectionId':_0x2d0696['id']},'raw':!![]})[_0xfcf2('0x29')](function(_0x5818bf){var _0x127b1c=_['map'](_0x5818bf,function(_0x5cf64f){return qs[_0xfcf2('0x4c')](_0x5cf64f,['id',_0xfcf2('0x55'),_0xfcf2('0x4d'),_0xfcf2('0x56')]);});_0x2eb6bd(_0x127b1c);})[_0xfcf2('0x45')](function(_0x545dd7){_0x101e85(_0x545dd7);});})[_0xfcf2('0x29')](function(_0xf1490f){var _0x4e84da=qs[_0xfcf2('0x4c')](_0x2d0696,['id',_0xfcf2('0x55'),'updatedAt']);_0x4e84da[_0xfcf2('0x57')]=_0x327423['id'];if(_0xf1490f)_0x4e84da[_0xfcf2('0x58')]=_0xf1490f;return _0x4e84da;})[_0xfcf2('0x29')](function(_0x9efe34){return db[_0xfcf2('0x51')][_0xfcf2('0x4a')](_0x9efe34,{'include':[{'model':db[_0xfcf2('0x59')],'as':'Resources'}],'raw':!![],'transaction':_0x397953});});})[_0xfcf2('0x29')](function(){return _0x327423;});}});});});}})[_0xfcf2('0x29')](respondWithResult(_0x21c836,0xc9))['catch'](handleError(_0x21c836,null));};exports['update']=function(_0x490c66,_0x25acf7){if(_0x490c66['body']['id']){delete _0x490c66[_0xfcf2('0x4b')]['id'];}return db['UserProfile'][_0xfcf2('0x49')]({'where':{'id':_0x490c66[_0xfcf2('0x47')]['id']}})['then'](handleEntityNotFound(_0x25acf7,null))['then'](saveUpdates(_0x490c66[_0xfcf2('0x4b')],null))[_0xfcf2('0x29')](respondWithResult(_0x25acf7,null))[_0xfcf2('0x45')](handleError(_0x25acf7,null));};exports[_0xfcf2('0x5a')]=function(_0x4cfbdd,_0x3f22a8){return db[_0xfcf2('0x42')][_0xfcf2('0x49')]({'where':{'id':_0x4cfbdd[_0xfcf2('0x47')]['id']}})['then'](handleEntityNotFound(_0x3f22a8,null))['then'](removeEntity(_0x3f22a8,null))['catch'](handleError(_0x3f22a8,null));};exports['describe']=function(_0xa668b8,_0x42c13d){return db['UserProfile'][_0xfcf2('0x5b')]()[_0xfcf2('0x29')](respondWithResult(_0x42c13d,null))['catch'](handleError(_0x42c13d,null));};exports[_0xfcf2('0x5c')]=function(_0x4a648d,_0x51e8bd){var _0x325ccd=_0x4a648d[_0xfcf2('0x4b')];return db[_0xfcf2('0x42')]['find']({'where':{'id':_0x4a648d[_0xfcf2('0x47')]['id']}})[_0xfcf2('0x29')](handleEntityNotFound(_0x51e8bd,null))['then'](function(_0x57d354){if(_0x57d354){return db['sequelize'][_0xfcf2('0x4f')](function(_0x448165){return db[_0xfcf2('0x51')]['destroy']({'where':{'userProfileId':_0x4a648d[_0xfcf2('0x47')]['id'],'sectionId':_[_0xfcf2('0x2d')](_0x325ccd,function(_0x451050){return _0x451050[_0xfcf2('0x56')];})},'transaction':_0x448165})[_0xfcf2('0x29')](function(){var _0x1a4b68=_[_0xfcf2('0x2d')](_0x325ccd,function(_0x4b1f0c){_0x4b1f0c['userProfileId']=_0x4a648d['params']['id'];return _0x4b1f0c;});var _0x5602d7=[];return BPromise[_0xfcf2('0x52')](_0x1a4b68,function(_0x1a9da4){return db[_0xfcf2('0x51')]['create'](_0x1a9da4,{'include':[{'model':db[_0xfcf2('0x59')],'as':_0xfcf2('0x58')}],'raw':!![],'transaction':_0x448165})['then'](function(_0x11171b){_0x5602d7[_0xfcf2('0x5d')](_0x11171b[_0xfcf2('0x50')]({'plain':!![]}));});})[_0xfcf2('0x29')](function(){return _0x5602d7;});});});}})[_0xfcf2('0x29')](function(_0x663a4e){return _0x663a4e;})['then'](respondWithResult(_0x51e8bd,null))['catch'](handleError(_0x51e8bd,null));};exports[_0xfcf2('0x5e')]=function(_0x2b1869,_0x22e07b){var _0x53a61c;return db['UserProfile']['find']({'where':{'id':_0x2b1869[_0xfcf2('0x47')]['id']},'attributes':['id',_0xfcf2('0x2b')]})['then'](handleEntityNotFound(_0x22e07b,null))['then'](function(_0xce5424){if(_0xce5424){_0x53a61c=_0xce5424;return db[_0xfcf2('0x51')]['destroy']({'where':{'userProfileId':_0x2b1869[_0xfcf2('0x47')]['id'],'sectionId':_0x2b1869[_0xfcf2('0x32')]['ids']}});}})[_0xfcf2('0x29')](function(){return _0x53a61c;})[_0xfcf2('0x29')](respondWithStatusCode(_0x22e07b,null))['catch'](handleError(_0x22e07b,null));};exports['getSections']=function(_0x141b22,_0x581cac){var _0x33ec43=[];var _0x1d0a3b=[];return db[_0xfcf2('0x51')][_0xfcf2('0x54')]({'where':{'userProfileId':_0x141b22[_0xfcf2('0x47')]['id']},'raw':!![]})[_0xfcf2('0x29')](function(_0x4ba3ad){_0x33ec43=_[_0xfcf2('0x40')](_0x4ba3ad,function(_0xf755e3){return _0xf755e3[_0xfcf2('0x5f')]===0x1||_[_0xfcf2('0x60')]([0x3eb,0x709],_0xf755e3[_0xfcf2('0x56')]);});if(!_[_0xfcf2('0x61')](_0x33ec43)){return _['map'](_0x33ec43,function(_0x20dbf9){return _0x20dbf9[_0xfcf2('0x56')];});}else{return;}})[_0xfcf2('0x29')](function(_0x4266f2){if(_0x4266f2)_0x1d0a3b=_0x4266f2;if(_['includes'](_0x1d0a3b,0x64)){var _0x4d763a=_[_0xfcf2('0x49')](_0x33ec43,{'sectionId':0x64});return hasDefaultDashboard(_0x4d763a)[_0xfcf2('0x29')](function(_0x3dd34e){return _[_0xfcf2('0x2d')](_0x33ec43,function(_0x4eea62){if(_0x4eea62[_0xfcf2('0x56')]===0x64){_0x4eea62['subsections']=_0x3dd34e;}return _0x4eea62;});});}else{return;}})[_0xfcf2('0x29')](function(_0x105198){if(_0x105198)_0x33ec43=_0x105198;if(_[_0xfcf2('0x60')](_0x1d0a3b,0x3eb)){var _0x5e5b73=_['find'](_0x33ec43,{'sectionId':0x3eb});return getCustomDashboards(_0x5e5b73)[_0xfcf2('0x29')](function(_0x2903a1){return _[_0xfcf2('0x2d')](_0x33ec43,function(_0x485b9){if(_0x5e5b73['enabled']){if(_0x485b9[_0xfcf2('0x56')]===0x3eb){_0x485b9['subsections']=_0x2903a1;}}else{if(_0x485b9[_0xfcf2('0x56')]===0x64){_0x485b9[_0xfcf2('0x62')]=_0x2903a1;}}return _0x485b9;});});}else{return;}})[_0xfcf2('0x29')](function(_0x4c58f4){if(_0x4c58f4)_0x33ec43=_0x4c58f4;if(_['includes'](_0x1d0a3b,0x709)){var _0x5c588b=_['find'](_0x33ec43,{'sectionId':0x709});return getPlugins(_0x5c588b)[_0xfcf2('0x29')](function(_0x420eb7){if(_0x5c588b['enabled']){return _['map'](_0x33ec43,function(_0x320b8f){if(_0x320b8f[_0xfcf2('0x56')]===0x709){_0x320b8f['subsections']=_0x420eb7;}return _0x320b8f;});}else{var _0x2020ea={'sectionId':0x76c,'enabled':0x1,'subsections':_0x420eb7};var _0x11f007=_['map'](_0x33ec43);_0x11f007[_0xfcf2('0x5d')](_0x2020ea);return _0x11f007;}});}else{return;}})[_0xfcf2('0x29')](function(_0x36dac7){if(_0x36dac7)_0x33ec43=_0x36dac7;return _[_0xfcf2('0x40')](_0x33ec43,[_0xfcf2('0x5f'),0x1]);})[_0xfcf2('0x29')](respondWithResult(_0x581cac,null))[_0xfcf2('0x45')](handleError(_0x581cac,null));};function hasDefaultDashboard(_0x30238a){var _0xdc66a5=[0x65];return new BPromise(function(_0x42b005,_0xb2c789){try{if(_0x30238a[_0xfcf2('0x53')]){_0x42b005(_0xdc66a5);}else{return db[_0xfcf2('0x59')][_0xfcf2('0x63')]({'where':{'sectionId':_0x30238a['id']},'raw':!![]})['then'](function(_0x2f3990){_0x2f3990?_0x42b005(_0xdc66a5):_0x42b005();});}}catch(_0x293432){_0xb2c789(_0x293432);}});}function getCustomDashboards(_0x446c27){var _0x22f370=[];return new BPromise(function(_0x27317b,_0xfc0a61){try{if(_0x446c27[_0xfcf2('0x53')]){return db[_0xfcf2('0x64')][_0xfcf2('0x54')]({'raw':!![]})[_0xfcf2('0x29')](function(_0x191dad){_0x191dad[_0xfcf2('0x65')](function(_0xd72cc6){_0x22f370['push'](_0xd72cc6['id']+0x1869f);});_0x27317b(_0x22f370);});}else{return db[_0xfcf2('0x59')]['findAll']({'where':{'sectionId':_0x446c27['id']},'raw':!![]})[_0xfcf2('0x29')](function(_0x4036e4){_0x4036e4[_0xfcf2('0x65')](function(_0x20293c){_0x22f370[_0xfcf2('0x5d')](_0x20293c[_0xfcf2('0x66')]+0x1869f);});_0x27317b(_0x22f370);});}}catch(_0x2f8e66){_0xfc0a61(_0x2f8e66);}});}function getPlugins(_0x401dd2){var _0xe319d3=[];return new BPromise(function(_0x382470,_0x2a6918){try{if(_0x401dd2[_0xfcf2('0x53')]){return db['Plugin'][_0xfcf2('0x54')]({'raw':!![]})[_0xfcf2('0x29')](function(_0x2798c5){_0x2798c5[_0xfcf2('0x65')](function(_0x2b2bbf){_0xe319d3[_0xfcf2('0x5d')](_0x2b2bbf['id']+0x15b38);});_0x382470(_0xe319d3);});}else{return db[_0xfcf2('0x59')]['findAll']({'where':{'sectionId':_0x401dd2['id']},'raw':!![]})[_0xfcf2('0x29')](function(_0x470625){_0x470625[_0xfcf2('0x65')](function(_0x12d93e){_0xe319d3[_0xfcf2('0x5d')](_0x12d93e[_0xfcf2('0x66')]+0x15b38);});_0x382470(_0xe319d3);});}}catch(_0x6dba54){_0x2a6918(_0x6dba54);}});}exports['addResources']=function(_0x10caf3,_0x26432f){return db[_0xfcf2('0x42')][_0xfcf2('0x49')]({'where':{'id':_0x10caf3[_0xfcf2('0x47')]['id']}})[_0xfcf2('0x29')](handleEntityNotFound(_0x26432f,null))[_0xfcf2('0x29')](function(_0x48a3cb){if(_0x48a3cb){return db[_0xfcf2('0x4e')][_0xfcf2('0x4f')](function(_0x41c0ac){return db['UserProfileSection'][_0xfcf2('0x54')]({'where':{'userProfileId':_0x10caf3['params']['id']},'attributes':['id'],'raw':!![]})[_0xfcf2('0x29')](function(_0x2f5c59){if(_0x2f5c59){return db['UserProfileSection'][_0xfcf2('0x5a')]({'where':{'userProfileId':_0x10caf3[_0xfcf2('0x47')]['id'],'id':_[_0xfcf2('0x2d')](_0x2f5c59,function(_0xa1d45f){return _0xa1d45f['id'];})},'transaction':_0x41c0ac});}})[_0xfcf2('0x29')](function(_0x4a3c8a){var _0x4636e5=_[_0xfcf2('0x2d')](_0x10caf3['body'],function(_0x3d244e){_0x3d244e[_0xfcf2('0x57')]=_0x10caf3[_0xfcf2('0x47')]['id'];return _0x3d244e;});return db['UserProfileSection']['bulkCreate'](_0x4636e5,{'raw':!![],'transaction':_0x41c0ac});})[_0xfcf2('0x29')](function(_0x23d7dd){var _0x284163=_[_0xfcf2('0x40')](_[_0xfcf2('0x2d')](_0x23d7dd,function(_0x4d341a){return _0x4d341a['get']({'plain':!![]});}),{'includeAll':![]});if(_0x284163){return db[_0xfcf2('0x51')][_0xfcf2('0x54')]({'where':{'userProfileId':_0x10caf3[_0xfcf2('0x47')]['id'],'sectionId':_[_0xfcf2('0x2d')](_0x284163,function(_0x4bf5f4){return _0x4bf5f4[_0xfcf2('0x56')];})},'attributes':['id','sectionId'],'raw':!![]})[_0xfcf2('0x29')](function(_0x4aa11b){var _0x2bb04c=_['map'](_0x10caf3[_0xfcf2('0x4b')],function(_0x4e22ed){_0x4e22ed[_0xfcf2('0x57')]=_0x10caf3[_0xfcf2('0x47')]['id'];return _0x4e22ed;});return db['UserProfileResource'][_0xfcf2('0x67')](_0x2bb04c,{'raw':!![],'transaction':_0x41c0ac});});}})[_0xfcf2('0x45')](handleError(_0x26432f,null));});}})[_0xfcf2('0x29')](function(_0x295185){var _0x7e7358=_['map'](_0x295185,function(_0x5a30c4){return _0x5a30c4['get']({'plain':!![]});});})[_0xfcf2('0x29')](respondWithResult(_0x26432f,null))[_0xfcf2('0x45')](handleError(_0x26432f,null));};exports['removeResources']=function(_0x221c05,_0x549c40,_0x4c2528){return db['UserProfile'][_0xfcf2('0x49')]({'where':{'id':_0x221c05[_0xfcf2('0x47')]['id']}})[_0xfcf2('0x29')](handleEntityNotFound(_0x549c40,null))[_0xfcf2('0x29')](function(_0x205e86){if(_0x205e86){return _0x205e86[_0xfcf2('0x68')](_0x221c05[_0xfcf2('0x32')][_0xfcf2('0x69')]);}})[_0xfcf2('0x29')](respondWithStatusCode(_0x549c40,null))[_0xfcf2('0x45')](handleError(_0x549c40,null));};exports[_0xfcf2('0x6a')]=function(_0x3c7e2d,_0x5acb37){var _0x83d2bc={};if(!_0x3c7e2d['query'][_0xfcf2('0x6b')])throw new Error(_0xfcf2('0x6c'));if(!_0x3c7e2d[_0xfcf2('0x32')][_0xfcf2('0x38')]('nolimit')){_0x83d2bc['limit']=qs['limit'](_0x3c7e2d[_0xfcf2('0x32')][_0xfcf2('0x22')]);_0x83d2bc['offset']=qs[_0xfcf2('0x20')](_0x3c7e2d[_0xfcf2('0x32')][_0xfcf2('0x20')]);}return db[_0xfcf2('0x42')]['find']({'where':{'id':_0x3c7e2d['params']['id']}})[_0xfcf2('0x29')](function(_0x597cd9){if(!_0x597cd9)throw new Error(_0xfcf2('0x6d')+_0x3c7e2d[_0xfcf2('0x47')]['id']);return db[_0xfcf2('0x42')][_0xfcf2('0x6a')](_0x3c7e2d);})['then'](respondWithFilteredResult(_0x5acb37,_0x83d2bc))[_0xfcf2('0x45')](handleError(_0x5acb37,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 2f8d5da..1956ac4 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 _0x8579=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x8579,0x16c));var _0x9857=function(_0x4afe7c,_0x1d2d4b){_0x4afe7c=_0x4afe7c-0x0;var _0x4c0edc=_0x8579[_0x4afe7c];return _0x4c0edc;};'use strict';var EventEmitter=require(_0x9857('0x0'));var UserProfile=require(_0x9857('0x1'))['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x9857('0x2')](0x0);var events={'afterCreate':_0x9857('0x3'),'afterUpdate':_0x9857('0x4'),'afterDestroy':_0x9857('0x5')};function emitEvent(_0x48bc70){return function(_0x48dd34,_0x5ae8ce,_0x4910ae){UserProfileEvents[_0x9857('0x6')](_0x48bc70+':'+_0x48dd34['id'],_0x48dd34);UserProfileEvents[_0x9857('0x6')](_0x48bc70,_0x48dd34);_0x4910ae(null);};}for(var e in events){if(events[_0x9857('0x7')](e)){var event=events[e];UserProfile[_0x9857('0x8')](e,emitEvent(event));}}module[_0x9857('0x9')]=UserProfileEvents; \ No newline at end of file +var _0x3837=['exports','../../mysqldb','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x754ab4,_0x56daa7){var _0x34079a=function(_0x295ec1){while(--_0x295ec1){_0x754ab4['push'](_0x754ab4['shift']());}};_0x34079a(++_0x56daa7);}(_0x3837,0x1d1));var _0x7383=function(_0x48e580,_0x3d5309){_0x48e580=_0x48e580-0x0;var _0x12c49b=_0x3837[_0x48e580];return _0x12c49b;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0x7383('0x0'))['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x7383('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7383('0x2'),'afterDestroy':_0x7383('0x3')};function emitEvent(_0x49878d){return function(_0x227ab2,_0xf57468,_0x53485d){UserProfileEvents['emit'](_0x49878d+':'+_0x227ab2['id'],_0x227ab2);UserProfileEvents[_0x7383('0x4')](_0x49878d,_0x227ab2);_0x53485d(null);};}for(var e in events){if(events[_0x7383('0x5')](e)){var event=events[e];UserProfile[_0x7383('0x6')](e,emitEvent(event));}}module[_0x7383('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 8cab1c2..e910eae 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 _0xb016=['SquareOdbc','squarerecordings','SquareRecording','parentSections','SquareProjects','projectName','projects','JscriptyProject','contacts','Lists','ListId','lists','CmList','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','voicemails','VoiceMail','voicerecordings','Agents','name','membername','User','role','agent','Telephones','telephone','VoiceQueues','queue','VoiceQueue','QueueCampaigns','outbound','musiconholds','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','MailSubstatus','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','Team','voicequeues','queuecampaigns','users','agents','telephones','admin','user','zendeskaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','deskaccounts','vtigeraccounts','cannedanswers','dispositions','Disposition','Dashboard','Interval','pauses','Sound','Tag','Template','triggers','Trigger','variables','Variable','Plugin','extractedreports','Reports','reportId','AnalyticMetric','charAt','toUpperCase','Sequelize','QueryTypes','select','ui.','InteractionId','ui.createdAt','user_has_','_interactions','where','ui.UserId\x20=\x20?','sequelize','query','toString','define','UserProfile','user_profiles','section','Invalid\x20section\x20\x27','isEmpty','push','UserProfileSection','find','all','ignore','union','length','autoAssociation','rawAttributes','keys','filters','intersection','attributes','fields','hasOwnProperty','offset','order','sort','key','VIRTUAL','foreignKey','forEach','merge','options','includeAll','include','reportType','default','custom','CustomReports','count','rows','CmContact','Tags','color','tag','ThroughTags','openTabs','true','chat','dataValues','sms','fax','mail','openchannel','whatsapp','lodash','./userProfile.attributes','exports','models','field','filter','then','associatedResources','map','catch','value','model','resolve','UserProfileResource','findAll','AnalyticExtractedReport','resourceId','type','toLowerCase','squareprojects','childModel','SquareProject','odbc'];(function(_0x3a2c11,_0x527ecf){var _0x1d56a6=function(_0x4cb5f9){while(--_0x4cb5f9){_0x3a2c11['push'](_0x3a2c11['shift']());}};_0x1d56a6(++_0x527ecf);}(_0xb016,0x159));var _0x6b01=function(_0x3b9ef2,_0x405499){_0x3b9ef2=_0x3b9ef2-0x0;var _0x5443be=_0xb016[_0x3b9ef2];return _0x5443be;};'use strict';var _=require(_0x6b01('0x0'));var attributes=require(_0x6b01('0x1'));var qs=require('../../components/parsers/qs');var squel=require('squel');module[_0x6b01('0x2')]=function(_0x531b6a){var _0x160a7d=_0x531b6a[_0x6b01('0x3')];function _0x161b59(_0x3b9de1,_0x5964ca){return new Promise(function(_0x1b7dd6,_0x65407a){if(!_0x5964ca)return _0x1b7dd6(null);var _0x192b2d=_0x5964ca['filter']?{[_0x5964ca['filter'][_0x6b01('0x4')]]:_0x5964ca[_0x6b01('0x5')]['value']}:undefined;return _0x160a7d[_0x3b9de1]['findAll']({'where':_0x192b2d,'raw':!![]})[_0x6b01('0x6')](function(_0x1cb3a6){_0x5964ca[_0x6b01('0x7')]=_[_0x6b01('0x8')](_0x1cb3a6,'id');_0x1b7dd6(_0x5964ca);})[_0x6b01('0x9')](function(_0x5bed15){_0x65407a(_0x5bed15);});});}function _0x4b4a4d(_0x4627ef,_0x24049f){return new Promise(function(_0x2660c7,_0x5a8817){var _0x200614=_0x4627ef['filter']?{[_0x4627ef['filter'][_0x6b01('0x4')]]:_0x4627ef['filter'][_0x6b01('0xa')]}:undefined;return _0x160a7d[_0x4627ef[_0x6b01('0xb')]]['findAll']({'where':_0x200614,'raw':!![]})[_0x6b01('0x6')](function(_0x4ea5fa){_0x24049f['associatedResources']=_['map'](_0x4ea5fa,function(_0x3d4666){return _0x3d4666['name'];});_0x2660c7(_0x24049f);})['catch'](function(_0x3a259f){_0x5a8817(_0x3a259f);});});}function _0x327e86(_0x20dd83,_0x41efa3,_0x3d7045){if(!_0x41efa3)return Promise[_0x6b01('0xc')](null);return new Promise(function(_0x122769,_0x33ffe8){return _0x160a7d[_0x6b01('0xd')][_0x6b01('0xe')]({'where':{'sectionId':_0x41efa3['id']},'raw':!![]})[_0x6b01('0x6')](function(_0x4f2d08){if(_0x20dd83[_0x6b01('0x4')]&&_0x20dd83[_0x6b01('0x4')]!=='id'){_0x41efa3[_0x6b01('0x7')]=_[_0x6b01('0x8')](_0x4f2d08,function(_0x5a7d75){return _0x5a7d75[_0x20dd83[_0x6b01('0x4')]];});}else{if(_0x3d7045===_0x6b01('0xf')){_0x41efa3[_0x6b01('0x7')]=_['map'](_0x4f2d08,function(_0x3029e2){return{'id':_0x3029e2[_0x6b01('0x10')],'type':_0x3029e2[_0x6b01('0x11')]};});}else{_0x41efa3[_0x6b01('0x7')]=_[_0x6b01('0x8')](_0x4f2d08,function(_0x181b09){return _0x181b09[_0x6b01('0x10')];});}}_0x122769(_0x41efa3);})['catch'](function(_0x7caa07){_0x33ffe8(_0x7caa07);});});}function _0xcf9200(_0x42c990,_0x51243c){var _0x399808={'parentSections':[]};switch(_0x42c990[_0x6b01('0x12')]()){case _0x6b01('0x13'):_0x399808[_0x6b01('0x14')]=_0x6b01('0x15');break;case _0x6b01('0x16'):_0x399808[_0x6b01('0x14')]=_0x6b01('0x17');break;case _0x6b01('0x18'):_0x399808[_0x6b01('0x14')]=_0x6b01('0x19');_0x399808[_0x6b01('0x1a')]=[{'name':_0x6b01('0x1b'),'field':'name','foreignKey':_0x6b01('0x1c')}];break;case _0x6b01('0x1d'):_0x399808[_0x6b01('0x14')]=_0x6b01('0x1e');break;case _0x6b01('0x1f'):_0x399808['childModel']='CmContact';_0x399808[_0x6b01('0x1a')]=[{'name':_0x6b01('0x20'),'field':'id','foreignKey':_0x6b01('0x21')}];break;case _0x6b01('0x22'):_0x399808[_0x6b01('0x14')]=_0x6b01('0x23');break;case'companies':_0x399808[_0x6b01('0x14')]='CmCompany';break;case _0x6b01('0x24'):_0x399808['childModel']=_0x6b01('0x25');break;case _0x6b01('0x26'):_0x399808[_0x6b01('0x14')]=_0x6b01('0x27');break;case _0x6b01('0x28'):_0x399808['childModel']=_0x6b01('0x29');break;case _0x6b01('0x2a'):_0x399808[_0x6b01('0x14')]='FaxQueue';break;case'faxaccounts':_0x399808[_0x6b01('0x14')]='FaxAccount';break;case _0x6b01('0x2b'):case _0x6b01('0x2c'):case _0x6b01('0x2d'):_0x399808['childModel']=_0x6b01('0x2e');break;case _0x6b01('0x2f'):_0x399808[_0x6b01('0x14')]='VoiceContext';break;case _0x6b01('0x30'):_0x399808[_0x6b01('0x14')]=_0x6b01('0x31');break;case _0x6b01('0x32'):_0x399808[_0x6b01('0x14')]='VoiceRecording';_0x399808[_0x6b01('0x1a')]=[{'name':_0x6b01('0x33'),'field':_0x6b01('0x34'),'foreignKey':_0x6b01('0x35'),'model':_0x6b01('0x36'),'filter':{'field':_0x6b01('0x37'),'value':[_0x6b01('0x38')]}},{'name':_0x6b01('0x39'),'field':'name','foreignKey':_0x6b01('0x35'),'model':'User','filter':{'field':_0x6b01('0x37'),'value':[_0x6b01('0x3a')]}},{'name':_0x6b01('0x3b'),'field':_0x6b01('0x34'),'foreignKey':_0x6b01('0x3c'),'model':_0x6b01('0x3d'),'filter':{'field':_0x6b01('0x11'),'value':['inbound']}},{'name':_0x6b01('0x3e'),'field':_0x6b01('0x34'),'foreignKey':_0x6b01('0x3c'),'model':_0x6b01('0x3d'),'filter':{'field':_0x6b01('0x11'),'value':[_0x6b01('0x3f')]}}];break;case _0x6b01('0x40'):_0x399808[_0x6b01('0x14')]='VoiceMusicOnHold';break;case _0x6b01('0x41'):_0x399808['childModel']=_0x6b01('0x42');break;case _0x6b01('0x43'):_0x399808['childModel']=_0x6b01('0x44');break;case _0x6b01('0x45'):_0x399808[_0x6b01('0x14')]=_0x6b01('0x46');break;case _0x6b01('0x47'):_0x399808[_0x6b01('0x14')]=_0x6b01('0x48');break;case _0x6b01('0x49'):_0x399808[_0x6b01('0x14')]=_0x6b01('0x4a');break;case'mailsubstatuses':_0x399808[_0x6b01('0x14')]=_0x6b01('0x4b');break;case'openchannelqueues':_0x399808['childModel']=_0x6b01('0x4c');break;case _0x6b01('0x4d'):_0x399808['childModel']=_0x6b01('0x4e');break;case _0x6b01('0x4f'):_0x399808['childModel']=_0x6b01('0x50');break;case'smsaccounts':_0x399808[_0x6b01('0x14')]=_0x6b01('0x51');break;case _0x6b01('0x52'):_0x399808['childModel']=_0x6b01('0x53');break;case _0x6b01('0x54'):_0x399808['childModel']='WhatsappAccount';break;case'teams':_0x399808[_0x6b01('0x14')]=_0x6b01('0x55');break;case _0x6b01('0x56'):case _0x6b01('0x57'):_0x399808[_0x6b01('0x14')]=_0x6b01('0x3d');if(_0x51243c){_0x399808['parentSections']=[{'name':_0x6b01('0x3b')},{'name':_0x6b01('0x3e')}];}break;case _0x6b01('0x58'):case _0x6b01('0x59'):case _0x6b01('0x5a'):_0x399808[_0x6b01('0x14')]='User';if(_0x51243c){_0x399808[_0x6b01('0x1a')]=[{'name':'Users','filter':{'field':'role','value':[_0x6b01('0x5b'),_0x6b01('0x5c')]},'ignore':!![]},{'name':'Agents'},{'name':_0x6b01('0x39')}];}break;case _0x6b01('0x5d'):_0x399808[_0x6b01('0x14')]='ZendeskAccount';break;case'salesforceaccounts':_0x399808['childModel']=_0x6b01('0x5e');break;case _0x6b01('0x5f'):_0x399808['childModel']=_0x6b01('0x60');break;case'sugarcrmaccounts':_0x399808['childModel']='SugarcrmAccount';break;case _0x6b01('0x61'):_0x399808[_0x6b01('0x14')]='DeskAccount';break;case'zohoaccounts':_0x399808[_0x6b01('0x14')]='ZohoAccount';break;case _0x6b01('0x62'):_0x399808[_0x6b01('0x14')]=_0x6b01('0x36');break;case _0x6b01('0x63'):_0x399808[_0x6b01('0x14')]='CannedAnswer';break;case _0x6b01('0x64'):_0x399808[_0x6b01('0x14')]=_0x6b01('0x65');break;case'customdashboards':_0x399808[_0x6b01('0x14')]=_0x6b01('0x66');break;case'intervals':_0x399808[_0x6b01('0x14')]=_0x6b01('0x67');break;case _0x6b01('0x68'):_0x399808[_0x6b01('0x14')]='Pause';break;case'scheduler':_0x399808[_0x6b01('0x14')]='Schedule';break;case'sounds':_0x399808[_0x6b01('0x14')]=_0x6b01('0x69');break;case'tags':_0x399808[_0x6b01('0x14')]=_0x6b01('0x6a');break;case'templates':_0x399808[_0x6b01('0x14')]=_0x6b01('0x6b');break;case _0x6b01('0x6c'):_0x399808[_0x6b01('0x14')]=_0x6b01('0x6d');break;case'trunks':_0x399808[_0x6b01('0x14')]='Trunk';break;case _0x6b01('0x6e'):_0x399808[_0x6b01('0x14')]=_0x6b01('0x6f');break;case'plugins':_0x399808[_0x6b01('0x14')]=_0x6b01('0x70');break;case _0x6b01('0x71'):_0x399808[_0x6b01('0x14')]='AnalyticExtractedReport';_0x399808[_0x6b01('0x1a')]=[{'name':_0x6b01('0x72'),'field':'id','foreignKey':_0x6b01('0x73')}];break;case'metrics':_0x399808['childModel']=_0x6b01('0x74');break;}return _0x399808;}function _0x1aefc2(_0x11cbcc,_0x4e1702){var _0x21b99f=_0x11cbcc[_0x6b01('0x75')](0x0)[_0x6b01('0x76')]()+_0x11cbcc['slice'](0x1);var _0x54b3ae={'type':_0x160a7d[_0x6b01('0x77')][_0x6b01('0x78')]['SELECT'],'raw':!![]};return new Promise(function(_0x3e16e8,_0x3faa54){var _0xe6d027=squel[_0x6b01('0x79')]()[_0x6b01('0x4')](_0x6b01('0x7a')+_0x21b99f+_0x6b01('0x7b'),'id')[_0x6b01('0x4')](_0x6b01('0x7c'))['from'](_0x6b01('0x7d')+_0x11cbcc+_0x6b01('0x7e'),'ui')[_0x6b01('0x7f')](_0x6b01('0x80'),_0x4e1702['id']);return _0x160a7d[_0x6b01('0x81')][_0x6b01('0x82')](_0xe6d027[_0x6b01('0x83')](),_0x54b3ae)[_0x6b01('0x6')](function(_0x281e55){_0x4e1702[_0x21b99f+'OpenTabs']=_0x281e55;_0x3e16e8(_0x281e55);})[_0x6b01('0x9')](function(_0x25b39b){_0x3faa54(_0x25b39b);});});}return _0x531b6a[_0x6b01('0x84')](_0x6b01('0x85'),attributes,{'tableName':_0x6b01('0x86'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x1dda2f){var _0x4c84cc={'raw':![],'where':{}};var _0x523102={};var _0x38ae38={'count':0x0,'rows':[]};var _0x270128=_0x1dda2f[_0x6b01('0x82')][_0x6b01('0x87')];var _0x728ae2=_0x1dda2f[_0x6b01('0x82')]['mergeResources']||![];var _0x2bd87d=_0xcf9200(_0x270128,_0x728ae2);if(!_0x2bd87d[_0x6b01('0x14')])throw new Error(_0x6b01('0x88')+_0x270128+'\x27');var _0x44c3d1=[{'name':_0x270128}];if(!_[_0x6b01('0x89')](_0x2bd87d[_0x6b01('0x1a')]))_0x44c3d1=_0x2bd87d[_0x6b01('0x1a')];var _0x582bff=[];for(var _0x3ea965=0x0;_0x3ea965<_0x44c3d1['length'];_0x3ea965++){_0x582bff[_0x6b01('0x8a')](_0x160a7d[_0x6b01('0x8b')][_0x6b01('0x8c')]({'where':{'userProfileId':_0x1dda2f['params']['id'],'name':_0x44c3d1[_0x3ea965][_0x6b01('0x34')]},'raw':!![]}));}return Promise[_0x6b01('0x8d')](_0x582bff)[_0x6b01('0x6')](function(_0x14742e){var _0xa29570=_[_0x6b01('0x5')](_0x14742e,function(_0xdb2660){return _0xdb2660?_0xdb2660:undefined;});var _0x17481f=_[_0x6b01('0x5')](_0x44c3d1,[_0x6b01('0x8e'),!![]]);var _0x350e68=_[_0x6b01('0x89')](_0xa29570)&&_[_0x6b01('0x89')](_0x17481f)?null:_[_0x6b01('0x8f')](_0x17481f,_0xa29570);if(!_0x350e68)return null;var _0x207e0a=[];for(var _0x13ceac=0x0;_0x13ceac<_0x350e68[_0x6b01('0x90')];_0x13ceac++){var _0x3f077f=_[_0x6b01('0x8c')](_0x44c3d1,function(_0x4a8fcb){return _0x350e68[_0x13ceac]?_0x4a8fcb[_0x6b01('0x34')]===_0x350e68[_0x13ceac][_0x6b01('0x34')]:null;});if(_0x3f077f){if(_0x350e68[_0x13ceac][_0x6b01('0x8e')]){_0x207e0a[_0x6b01('0x8a')](_0x161b59(_0x2bd87d[_0x6b01('0x14')],_0x350e68[_0x13ceac]));}else{if(!_0x350e68[_0x13ceac][_0x6b01('0x91')]){_0x207e0a[_0x6b01('0x8a')](_0x327e86(_0x3f077f,_0x350e68[_0x13ceac],_0x2bd87d[_0x6b01('0x14')]));}else{if(_0x3f077f[_0x6b01('0xb')]){_0x207e0a[_0x6b01('0x8a')](_0x4b4a4d(_0x3f077f,_0x350e68[_0x13ceac]));}}}}}return Promise[_0x6b01('0x8d')](_0x207e0a);})[_0x6b01('0x6')](function(_0x468a0b){var _0x30171f=_0x468a0b;var _0x1a0bb7=null;if(_0x30171f){_0x1a0bb7=_0x30171f['length']===0x1?_0x30171f[0x0]:null;}if(!_0x1a0bb7&&!_0x30171f)return _0x38ae38;var _0xbcba19=_0x160a7d[_0x2bd87d[_0x6b01('0x14')]][_0x6b01('0x92')];_0x523102[_0x6b01('0xb')]=_[_0x6b01('0x93')](_0xbcba19);_0x523102[_0x6b01('0x82')]=_[_0x6b01('0x93')](_0x1dda2f[_0x6b01('0x82')]);_0x523102[_0x6b01('0x94')]=_[_0x6b01('0x95')](_0x523102[_0x6b01('0xb')],_0x523102[_0x6b01('0x82')]);_0x4c84cc[_0x6b01('0x96')]=_[_0x6b01('0x95')](_0x523102[_0x6b01('0xb')],qs[_0x6b01('0x97')](_0x1dda2f[_0x6b01('0x82')][_0x6b01('0x97')]));_0x4c84cc[_0x6b01('0x96')]=_0x4c84cc[_0x6b01('0x96')]['length']?_0x4c84cc['attributes']:_0x523102['model'];if(!_0x1dda2f['query'][_0x6b01('0x98')]('nolimit')){_0x4c84cc['limit']=qs['limit'](_0x1dda2f[_0x6b01('0x82')]['limit']);_0x4c84cc[_0x6b01('0x99')]=qs[_0x6b01('0x99')](_0x1dda2f[_0x6b01('0x82')][_0x6b01('0x99')]);}_0x4c84cc[_0x6b01('0x9a')]=qs['sort'](_0x1dda2f['query'][_0x6b01('0x9b')]);_0x4c84cc[_0x6b01('0x7f')]=qs[_0x6b01('0x94')](_['pick'](_0x1dda2f[_0x6b01('0x82')],_0x523102[_0x6b01('0x94')]));if(_0x1dda2f[_0x6b01('0x82')][_0x6b01('0x5')]){_0x4c84cc[_0x6b01('0x7f')]=_['merge'](_0x4c84cc[_0x6b01('0x7f')],{'$or':_['map'](_0xbcba19,function(_0x1a03e4){if(_0x1a03e4[_0x6b01('0x11')][_0x6b01('0x9c')]!==_0x6b01('0x9d')){var _0x16a427={};_0x16a427[_0x1a03e4['field']]={'$like':'%'+_0x1dda2f[_0x6b01('0x82')][_0x6b01('0x5')]+'%'};return _0x16a427;}})});}var _0xb133fc=[];var _0x8b2514=null;var _0x4dbd69={};if(_0x1a0bb7){_0x8b2514=_[_0x6b01('0x8c')](_0x44c3d1,[_0x6b01('0x34'),_0x1a0bb7[_0x6b01('0x34')]]);if(_0x8b2514[_0x6b01('0x4')]){_0x4dbd69={};if(_0x2bd87d[_0x6b01('0x14')]===_0x6b01('0xf')){_0x4dbd69[_0x8b2514['foreignKey']]=_['map'](_0x1a0bb7['associatedResources'],'id');}else{_0x4dbd69[_0x8b2514[_0x6b01('0x9e')]]=_0x1a0bb7[_0x6b01('0x7')];}_0xb133fc['push'](_0x4dbd69);}else{_0x4c84cc[_0x6b01('0x7f')]['id']=_0x1a0bb7[_0x6b01('0x7')];}}else{for(var _0x34c971=0x0;_0x34c971<_0x30171f[_0x6b01('0x90')];_0x34c971++){_0x8b2514=_['find'](_0x44c3d1,[_0x6b01('0x34'),_0x30171f[_0x34c971]['name']]);if(_0x8b2514[_0x6b01('0x4')]){_0x4dbd69={};_0x4dbd69[_0x8b2514['foreignKey']]=_0x30171f[_0x34c971][_0x6b01('0x7')];_0xb133fc['push'](_0x4dbd69);}else{if(!_0x4c84cc[_0x6b01('0x7f')]['id'])_0x4c84cc[_0x6b01('0x7f')]['id']=[];_0x30171f[_0x34c971][_0x6b01('0x7')][_0x6b01('0x9f')](function(_0x12b0d8){_0x4c84cc[_0x6b01('0x7f')]['id'][_0x6b01('0x8a')](_0x12b0d8);});}}}if(!_['isEmpty'](_0xb133fc)){_0x4c84cc[_0x6b01('0x7f')]=_['merge'](_0x4c84cc[_0x6b01('0x7f')],{'$and':{'$or':_0xb133fc}});}_0x4c84cc=_[_0x6b01('0xa0')]({},_0x4c84cc,_0x1dda2f[_0x6b01('0xa1')]);if(_0x1a0bb7&&!_0x1a0bb7[_0x6b01('0x91')]&&_0x2bd87d[_0x6b01('0x14')]===_0x6b01('0xf')){if(_0x1dda2f[_0x6b01('0x82')][_0x6b01('0xa2')]){_0x4c84cc[_0x6b01('0xa3')]=[{'all':!![]}];}return _0x160a7d[_0x2bd87d[_0x6b01('0x14')]][_0x6b01('0xe')](_0x4c84cc)['then'](function(_0x1e9300){var _0x4091a8=[];_0x1e9300[_0x6b01('0x9f')](function(_0x41c2a9){var _0x5ac0b6;switch(_0x41c2a9[_0x6b01('0xa4')]){case _0x6b01('0xa5'):_0x5ac0b6=_[_0x6b01('0x8c')](_0x1a0bb7[_0x6b01('0x7')],function(_0x3c4424){return _0x3c4424['id']===_0x41c2a9['reportId']&&_0x3c4424[_0x6b01('0x11')]==='DefaultReports';});break;case _0x6b01('0xa6'):_0x5ac0b6=_[_0x6b01('0x8c')](_0x1a0bb7[_0x6b01('0x7')],function(_0x7b8545){return _0x7b8545['id']===_0x41c2a9[_0x6b01('0x73')]&&_0x7b8545[_0x6b01('0x11')]===_0x6b01('0xa7');});break;}if(_0x5ac0b6)_0x4091a8[_0x6b01('0x8a')](_0x41c2a9);});_0x38ae38[_0x6b01('0xa8')]=_0x4091a8[_0x6b01('0x90')];_0x38ae38[_0x6b01('0xa9')]=_0x4091a8;return _0x38ae38;});}else{return _0x160a7d[_0x2bd87d[_0x6b01('0x14')]][_0x6b01('0xa8')]({'where':_0x4c84cc[_0x6b01('0x7f')]})['then'](function(_0x2f180){_0x38ae38['count']=_0x2f180;if(_0x1dda2f['query'][_0x6b01('0xa2')]){if(_0x2bd87d[_0x6b01('0x14')]===_0x6b01('0xaa')){_0x4c84cc[_0x6b01('0xa3')]=[{'model':_0x160a7d['Tag'],'as':_0x6b01('0xab'),'attributes':['id',_0x6b01('0x34'),_0x6b01('0xac')],'required':_0x1dda2f['query'][_0x6b01('0xad')]?!![]:![]},{'model':_0x160a7d[_0x6b01('0x6a')],'as':_0x6b01('0xae'),'attributes':['id',_0x6b01('0x34'),_0x6b01('0xac')],'through':_0x1dda2f[_0x6b01('0x82')][_0x6b01('0xad')]?{'attributes':[],'where':{'TagId':_0x1dda2f[_0x6b01('0x82')]['tag']||undefined}}:{},'required':_0x1dda2f[_0x6b01('0x82')][_0x6b01('0xad')]?!![]:![]}];}else{_0x4c84cc[_0x6b01('0xa3')]=[{'all':!![]}];}}return _0x160a7d[_0x2bd87d[_0x6b01('0x14')]]['findAll'](_0x4c84cc);})['then'](function(_0x33fa1d){_0x38ae38[_0x6b01('0xa9')]=_0x33fa1d;if(_0x270128===_0x6b01('0x33')&&_0x1dda2f[_0x6b01('0x82')][_0x6b01('0xaf')]===_0x6b01('0xb0')){var _0x1343af=[];for(var _0x29c507=0x0;_0x29c507<_0x38ae38['rows'][_0x6b01('0x90')];_0x29c507++){_0x1343af[_0x6b01('0x8a')](_0x1aefc2(_0x6b01('0xb1'),_0x38ae38[_0x6b01('0xa9')][_0x29c507][_0x6b01('0xb2')]));_0x1343af[_0x6b01('0x8a')](_0x1aefc2(_0x6b01('0xb3'),_0x38ae38['rows'][_0x29c507][_0x6b01('0xb2')]));_0x1343af['push'](_0x1aefc2(_0x6b01('0xb4'),_0x38ae38[_0x6b01('0xa9')][_0x29c507][_0x6b01('0xb2')]));_0x1343af[_0x6b01('0x8a')](_0x1aefc2(_0x6b01('0xb5'),_0x38ae38['rows'][_0x29c507][_0x6b01('0xb2')]));_0x1343af['push'](_0x1aefc2(_0x6b01('0xb6'),_0x38ae38[_0x6b01('0xa9')][_0x29c507]['dataValues']));_0x1343af[_0x6b01('0x8a')](_0x1aefc2(_0x6b01('0xb7'),_0x38ae38[_0x6b01('0xa9')][_0x29c507][_0x6b01('0xb2')]));}return Promise[_0x6b01('0x8d')](_0x1343af)['then'](function(){return _0x38ae38;});}return _0x38ae38;});}});}}});}; \ No newline at end of file +var _0x0295=['VoiceContext','voicemails','VoiceMail','voicerecordings','Agents','membername','role','agent','Telephones','User','queue','VoiceQueue','type','inbound','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','VoiceChanSpy','voiceprefixes','ivrcampaigns','mailqueues','MailQueue','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','whatsappqueues','WhatsappQueue','whatsappaccounts','teams','Team','voicequeues','queuecampaigns','VoiceQueues','users','agents','telephones','Users','admin','user','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','vtigeraccounts','Disposition','customdashboards','intervals','pauses','Pause','Schedule','sounds','Sound','tags','Tag','triggers','trunks','plugins','Plugin','Reports','reportId','metrics','AnalyticMetric','charAt','slice','SELECT','ui.','InteractionId','ui.createdAt','from','where','ui.UserId\x20=\x20?','sequelize','toString','OpenTabs','define','UserProfile','user_profiles','query','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','push','find','ignore','union','autoAssociation','model','all','rawAttributes','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','offset','order','sort','pick','key','foreignKey','forEach','merge','includeAll','default','DefaultReports','custom','count','include','color','tag','openTabs','rows','chat','sms','dataValues','fax','mail','openchannel','whatsapp','lodash','squel','models','filter','value','then','associatedResources','catch','findAll','map','name','resolve','UserProfileResource','field','AnalyticExtractedReport','resourceId','toLowerCase','odbc','childModel','SquareRecording','parentSections','projectName','JscriptyProject','contacts','CmContact','Lists','lists','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxaccounts','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts'];(function(_0xffa586,_0x5331a6){var _0x510c40=function(_0x437ea0){while(--_0x437ea0){_0xffa586['push'](_0xffa586['shift']());}};_0x510c40(++_0x5331a6);}(_0x0295,0x1f0));var _0x5029=function(_0x3aaf69,_0x318ff9){_0x3aaf69=_0x3aaf69-0x0;var _0x4542c6=_0x0295[_0x3aaf69];return _0x4542c6;};'use strict';var _=require(_0x5029('0x0'));var attributes=require('./userProfile.attributes');var qs=require('../../components/parsers/qs');var squel=require(_0x5029('0x1'));module['exports']=function(_0x53c2e1){var _0x315589=_0x53c2e1[_0x5029('0x2')];function _0x157a4f(_0x3d0af1,_0x170504){return new Promise(function(_0x69a497,_0x200217){if(!_0x170504)return _0x69a497(null);var _0x215955=_0x170504[_0x5029('0x3')]?{[_0x170504['filter']['field']]:_0x170504['filter'][_0x5029('0x4')]}:undefined;return _0x315589[_0x3d0af1]['findAll']({'where':_0x215955,'raw':!![]})[_0x5029('0x5')](function(_0x5bccfc){_0x170504[_0x5029('0x6')]=_['map'](_0x5bccfc,'id');_0x69a497(_0x170504);})[_0x5029('0x7')](function(_0x22cfb4){_0x200217(_0x22cfb4);});});}function _0x12834c(_0x52fa95,_0x3f4c48){return new Promise(function(_0xbf61f,_0x3fe6d1){var _0x4f295e=_0x52fa95[_0x5029('0x3')]?{[_0x52fa95[_0x5029('0x3')]['field']]:_0x52fa95['filter']['value']}:undefined;return _0x315589[_0x52fa95['model']][_0x5029('0x8')]({'where':_0x4f295e,'raw':!![]})[_0x5029('0x5')](function(_0x12c237){_0x3f4c48[_0x5029('0x6')]=_[_0x5029('0x9')](_0x12c237,function(_0x11c24b){return _0x11c24b[_0x5029('0xa')];});_0xbf61f(_0x3f4c48);})[_0x5029('0x7')](function(_0x10bf55){_0x3fe6d1(_0x10bf55);});});}function _0x326923(_0x457c73,_0x353cba,_0x3786b5){if(!_0x353cba)return Promise[_0x5029('0xb')](null);return new Promise(function(_0x343918,_0x4f7ab4){return _0x315589[_0x5029('0xc')][_0x5029('0x8')]({'where':{'sectionId':_0x353cba['id']},'raw':!![]})[_0x5029('0x5')](function(_0x4902f3){if(_0x457c73[_0x5029('0xd')]&&_0x457c73[_0x5029('0xd')]!=='id'){_0x353cba[_0x5029('0x6')]=_['map'](_0x4902f3,function(_0x226a5c){return _0x226a5c[_0x457c73['field']];});}else{if(_0x3786b5===_0x5029('0xe')){_0x353cba[_0x5029('0x6')]=_[_0x5029('0x9')](_0x4902f3,function(_0x3cf0fb){return{'id':_0x3cf0fb['resourceId'],'type':_0x3cf0fb['type']};});}else{_0x353cba[_0x5029('0x6')]=_['map'](_0x4902f3,function(_0x3f657d){return _0x3f657d[_0x5029('0xf')];});}}_0x343918(_0x353cba);})[_0x5029('0x7')](function(_0x2bbbcb){_0x4f7ab4(_0x2bbbcb);});});}function _0x16bd22(_0x3a3e52,_0x125c26){var _0x356dac={'parentSections':[]};switch(_0x3a3e52[_0x5029('0x10')]()){case'squareprojects':_0x356dac['childModel']='SquareProject';break;case _0x5029('0x11'):_0x356dac[_0x5029('0x12')]='SquareOdbc';break;case'squarerecordings':_0x356dac[_0x5029('0x12')]=_0x5029('0x13');_0x356dac[_0x5029('0x14')]=[{'name':'SquareProjects','field':_0x5029('0xa'),'foreignKey':_0x5029('0x15')}];break;case'projects':_0x356dac[_0x5029('0x12')]=_0x5029('0x16');break;case _0x5029('0x17'):_0x356dac['childModel']=_0x5029('0x18');_0x356dac[_0x5029('0x14')]=[{'name':_0x5029('0x19'),'field':'id','foreignKey':'ListId'}];break;case _0x5029('0x1a'):_0x356dac[_0x5029('0x12')]='CmList';break;case _0x5029('0x1b'):_0x356dac[_0x5029('0x12')]=_0x5029('0x1c');break;case _0x5029('0x1d'):_0x356dac[_0x5029('0x12')]=_0x5029('0x1e');break;case _0x5029('0x1f'):_0x356dac[_0x5029('0x12')]=_0x5029('0x20');break;case _0x5029('0x21'):_0x356dac[_0x5029('0x12')]=_0x5029('0x22');break;case'faxqueues':_0x356dac[_0x5029('0x12')]='FaxQueue';break;case _0x5029('0x23'):_0x356dac['childModel']='FaxAccount';break;case _0x5029('0x24'):case _0x5029('0x25'):case _0x5029('0x26'):_0x356dac['childModel']=_0x5029('0x27');break;case _0x5029('0x28'):_0x356dac[_0x5029('0x12')]=_0x5029('0x29');break;case _0x5029('0x2a'):_0x356dac[_0x5029('0x12')]=_0x5029('0x2b');break;case _0x5029('0x2c'):_0x356dac[_0x5029('0x12')]='VoiceRecording';_0x356dac[_0x5029('0x14')]=[{'name':_0x5029('0x2d'),'field':_0x5029('0xa'),'foreignKey':_0x5029('0x2e'),'model':'User','filter':{'field':_0x5029('0x2f'),'value':[_0x5029('0x30')]}},{'name':_0x5029('0x31'),'field':'name','foreignKey':'membername','model':_0x5029('0x32'),'filter':{'field':_0x5029('0x2f'),'value':['telephone']}},{'name':'VoiceQueues','field':_0x5029('0xa'),'foreignKey':_0x5029('0x33'),'model':_0x5029('0x34'),'filter':{'field':_0x5029('0x35'),'value':[_0x5029('0x36')]}},{'name':_0x5029('0x37'),'field':_0x5029('0xa'),'foreignKey':_0x5029('0x33'),'model':_0x5029('0x34'),'filter':{'field':_0x5029('0x35'),'value':[_0x5029('0x38')]}}];break;case _0x5029('0x39'):_0x356dac[_0x5029('0x12')]=_0x5029('0x3a');break;case'chanspies':_0x356dac['childModel']=_0x5029('0x3b');break;case _0x5029('0x3c'):_0x356dac[_0x5029('0x12')]='VoicePrefix';break;case _0x5029('0x3d'):_0x356dac[_0x5029('0x12')]='Campaign';break;case _0x5029('0x3e'):_0x356dac['childModel']=_0x5029('0x3f');break;case'mailaccounts':_0x356dac[_0x5029('0x12')]=_0x5029('0x40');break;case _0x5029('0x41'):_0x356dac[_0x5029('0x12')]=_0x5029('0x42');break;case _0x5029('0x43'):_0x356dac[_0x5029('0x12')]=_0x5029('0x44');break;case _0x5029('0x45'):_0x356dac['childModel']=_0x5029('0x46');break;case _0x5029('0x47'):_0x356dac[_0x5029('0x12')]=_0x5029('0x48');break;case _0x5029('0x49'):_0x356dac[_0x5029('0x12')]='SmsAccount';break;case _0x5029('0x4a'):_0x356dac[_0x5029('0x12')]=_0x5029('0x4b');break;case _0x5029('0x4c'):_0x356dac[_0x5029('0x12')]='WhatsappAccount';break;case _0x5029('0x4d'):_0x356dac[_0x5029('0x12')]=_0x5029('0x4e');break;case _0x5029('0x4f'):case _0x5029('0x50'):_0x356dac[_0x5029('0x12')]=_0x5029('0x34');if(_0x125c26){_0x356dac[_0x5029('0x14')]=[{'name':_0x5029('0x51')},{'name':'QueueCampaigns'}];}break;case _0x5029('0x52'):case _0x5029('0x53'):case _0x5029('0x54'):_0x356dac[_0x5029('0x12')]='User';if(_0x125c26){_0x356dac['parentSections']=[{'name':_0x5029('0x55'),'filter':{'field':_0x5029('0x2f'),'value':[_0x5029('0x56'),_0x5029('0x57')]},'ignore':!![]},{'name':_0x5029('0x2d')},{'name':_0x5029('0x31')}];}break;case _0x5029('0x58'):_0x356dac[_0x5029('0x12')]=_0x5029('0x59');break;case _0x5029('0x5a'):_0x356dac[_0x5029('0x12')]=_0x5029('0x5b');break;case _0x5029('0x5c'):_0x356dac[_0x5029('0x12')]=_0x5029('0x5d');break;case _0x5029('0x5e'):_0x356dac[_0x5029('0x12')]=_0x5029('0x5f');break;case _0x5029('0x60'):_0x356dac[_0x5029('0x12')]=_0x5029('0x61');break;case'zohoaccounts':_0x356dac[_0x5029('0x12')]='ZohoAccount';break;case _0x5029('0x62'):_0x356dac[_0x5029('0x12')]='User';break;case'cannedanswers':_0x356dac[_0x5029('0x12')]='CannedAnswer';break;case'dispositions':_0x356dac[_0x5029('0x12')]=_0x5029('0x63');break;case _0x5029('0x64'):_0x356dac['childModel']='Dashboard';break;case _0x5029('0x65'):_0x356dac[_0x5029('0x12')]='Interval';break;case _0x5029('0x66'):_0x356dac['childModel']=_0x5029('0x67');break;case'scheduler':_0x356dac[_0x5029('0x12')]=_0x5029('0x68');break;case _0x5029('0x69'):_0x356dac[_0x5029('0x12')]=_0x5029('0x6a');break;case _0x5029('0x6b'):_0x356dac[_0x5029('0x12')]=_0x5029('0x6c');break;case'templates':_0x356dac[_0x5029('0x12')]='Template';break;case _0x5029('0x6d'):_0x356dac[_0x5029('0x12')]='Trigger';break;case _0x5029('0x6e'):_0x356dac['childModel']='Trunk';break;case'variables':_0x356dac[_0x5029('0x12')]='Variable';break;case _0x5029('0x6f'):_0x356dac[_0x5029('0x12')]=_0x5029('0x70');break;case'extractedreports':_0x356dac[_0x5029('0x12')]='AnalyticExtractedReport';_0x356dac['parentSections']=[{'name':_0x5029('0x71'),'field':'id','foreignKey':_0x5029('0x72')}];break;case _0x5029('0x73'):_0x356dac[_0x5029('0x12')]=_0x5029('0x74');break;}return _0x356dac;}function _0x4e8d9f(_0x450d4d,_0x124634){var _0x1f79b3=_0x450d4d[_0x5029('0x75')](0x0)['toUpperCase']()+_0x450d4d[_0x5029('0x76')](0x1);var _0xfffc0d={'type':_0x315589['Sequelize']['QueryTypes'][_0x5029('0x77')],'raw':!![]};return new Promise(function(_0x4685a6,_0x1263ba){var _0x3b68e1=squel['select']()[_0x5029('0xd')](_0x5029('0x78')+_0x1f79b3+_0x5029('0x79'),'id')[_0x5029('0xd')](_0x5029('0x7a'))[_0x5029('0x7b')]('user_has_'+_0x450d4d+'_interactions','ui')[_0x5029('0x7c')](_0x5029('0x7d'),_0x124634['id']);return _0x315589[_0x5029('0x7e')]['query'](_0x3b68e1[_0x5029('0x7f')](),_0xfffc0d)[_0x5029('0x5')](function(_0x105638){_0x124634[_0x1f79b3+_0x5029('0x80')]=_0x105638;_0x4685a6(_0x105638);})[_0x5029('0x7')](function(_0x5264c6){_0x1263ba(_0x5264c6);});});}return _0x53c2e1[_0x5029('0x81')](_0x5029('0x82'),attributes,{'tableName':_0x5029('0x83'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x5bf867){var _0x853407={'raw':![],'where':{}};var _0x4e0fe6={};var _0x2a9d12={'count':0x0,'rows':[]};var _0x4f2f0c=_0x5bf867[_0x5029('0x84')][_0x5029('0x85')];var _0x2ad2e3=_0x5bf867[_0x5029('0x84')][_0x5029('0x86')]||![];var _0x2ab5cf=_0x16bd22(_0x4f2f0c,_0x2ad2e3);if(!_0x2ab5cf['childModel'])throw new Error(_0x5029('0x87')+_0x4f2f0c+'\x27');var _0x19220d=[{'name':_0x4f2f0c}];if(!_[_0x5029('0x88')](_0x2ab5cf[_0x5029('0x14')]))_0x19220d=_0x2ab5cf[_0x5029('0x14')];var _0x506f74=[];for(var _0x13ca47=0x0;_0x13ca47<_0x19220d['length'];_0x13ca47++){_0x506f74[_0x5029('0x89')](_0x315589['UserProfileSection'][_0x5029('0x8a')]({'where':{'userProfileId':_0x5bf867['params']['id'],'name':_0x19220d[_0x13ca47][_0x5029('0xa')]},'raw':!![]}));}return Promise['all'](_0x506f74)['then'](function(_0x440658){var _0x575f09=_[_0x5029('0x3')](_0x440658,function(_0xd0175d){return _0xd0175d?_0xd0175d:undefined;});var _0x382994=_['filter'](_0x19220d,[_0x5029('0x8b'),!![]]);var _0x490821=_[_0x5029('0x88')](_0x575f09)&&_[_0x5029('0x88')](_0x382994)?null:_[_0x5029('0x8c')](_0x382994,_0x575f09);if(!_0x490821)return null;var _0x1cca02=[];for(var _0x1deed7=0x0;_0x1deed7<_0x490821['length'];_0x1deed7++){var _0x409034=_[_0x5029('0x8a')](_0x19220d,function(_0x5890ac){return _0x490821[_0x1deed7]?_0x5890ac[_0x5029('0xa')]===_0x490821[_0x1deed7][_0x5029('0xa')]:null;});if(_0x409034){if(_0x490821[_0x1deed7][_0x5029('0x8b')]){_0x1cca02[_0x5029('0x89')](_0x157a4f(_0x2ab5cf[_0x5029('0x12')],_0x490821[_0x1deed7]));}else{if(!_0x490821[_0x1deed7][_0x5029('0x8d')]){_0x1cca02['push'](_0x326923(_0x409034,_0x490821[_0x1deed7],_0x2ab5cf['childModel']));}else{if(_0x409034[_0x5029('0x8e')]){_0x1cca02['push'](_0x12834c(_0x409034,_0x490821[_0x1deed7]));}}}}}return Promise[_0x5029('0x8f')](_0x1cca02);})[_0x5029('0x5')](function(_0x58db57){var _0x181956=_0x58db57;var _0x574d06=null;if(_0x181956){_0x574d06=_0x181956['length']===0x1?_0x181956[0x0]:null;}if(!_0x574d06&&!_0x181956)return _0x2a9d12;var _0x3688d8=_0x315589[_0x2ab5cf[_0x5029('0x12')]][_0x5029('0x90')];_0x4e0fe6[_0x5029('0x8e')]=_['keys'](_0x3688d8);_0x4e0fe6[_0x5029('0x84')]=_[_0x5029('0x91')](_0x5bf867['query']);_0x4e0fe6[_0x5029('0x92')]=_[_0x5029('0x93')](_0x4e0fe6['model'],_0x4e0fe6['query']);_0x853407['attributes']=_[_0x5029('0x93')](_0x4e0fe6[_0x5029('0x8e')],qs[_0x5029('0x94')](_0x5bf867[_0x5029('0x84')][_0x5029('0x94')]));_0x853407[_0x5029('0x95')]=_0x853407[_0x5029('0x95')][_0x5029('0x96')]?_0x853407[_0x5029('0x95')]:_0x4e0fe6['model'];if(!_0x5bf867['query'][_0x5029('0x97')](_0x5029('0x98'))){_0x853407[_0x5029('0x99')]=qs[_0x5029('0x99')](_0x5bf867[_0x5029('0x84')][_0x5029('0x99')]);_0x853407[_0x5029('0x9a')]=qs['offset'](_0x5bf867[_0x5029('0x84')][_0x5029('0x9a')]);}_0x853407[_0x5029('0x9b')]=qs['sort'](_0x5bf867[_0x5029('0x84')][_0x5029('0x9c')]);_0x853407[_0x5029('0x7c')]=qs['filters'](_[_0x5029('0x9d')](_0x5bf867[_0x5029('0x84')],_0x4e0fe6[_0x5029('0x92')]));if(_0x5bf867['query'][_0x5029('0x3')]){_0x853407[_0x5029('0x7c')]=_['merge'](_0x853407[_0x5029('0x7c')],{'$or':_[_0x5029('0x9')](_0x3688d8,function(_0x3f3118){if(_0x3f3118[_0x5029('0x35')][_0x5029('0x9e')]!=='VIRTUAL'){var _0x29d5bf={};_0x29d5bf[_0x3f3118[_0x5029('0xd')]]={'$like':'%'+_0x5bf867[_0x5029('0x84')][_0x5029('0x3')]+'%'};return _0x29d5bf;}})});}var _0x153cdc=[];var _0x5e7f50=null;var _0x455464={};if(_0x574d06){_0x5e7f50=_[_0x5029('0x8a')](_0x19220d,[_0x5029('0xa'),_0x574d06['name']]);if(_0x5e7f50[_0x5029('0xd')]){_0x455464={};if(_0x2ab5cf[_0x5029('0x12')]===_0x5029('0xe')){_0x455464[_0x5e7f50[_0x5029('0x9f')]]=_[_0x5029('0x9')](_0x574d06[_0x5029('0x6')],'id');}else{_0x455464[_0x5e7f50[_0x5029('0x9f')]]=_0x574d06['associatedResources'];}_0x153cdc[_0x5029('0x89')](_0x455464);}else{_0x853407[_0x5029('0x7c')]['id']=_0x574d06[_0x5029('0x6')];}}else{for(var _0xde6006=0x0;_0xde6006<_0x181956[_0x5029('0x96')];_0xde6006++){_0x5e7f50=_['find'](_0x19220d,[_0x5029('0xa'),_0x181956[_0xde6006][_0x5029('0xa')]]);if(_0x5e7f50[_0x5029('0xd')]){_0x455464={};_0x455464[_0x5e7f50['foreignKey']]=_0x181956[_0xde6006][_0x5029('0x6')];_0x153cdc[_0x5029('0x89')](_0x455464);}else{if(!_0x853407['where']['id'])_0x853407['where']['id']=[];_0x181956[_0xde6006]['associatedResources'][_0x5029('0xa0')](function(_0x46c738){_0x853407[_0x5029('0x7c')]['id'][_0x5029('0x89')](_0x46c738);});}}}if(!_[_0x5029('0x88')](_0x153cdc)){_0x853407['where']=_[_0x5029('0xa1')](_0x853407[_0x5029('0x7c')],{'$and':{'$or':_0x153cdc}});}_0x853407=_[_0x5029('0xa1')]({},_0x853407,_0x5bf867['options']);if(_0x574d06&&!_0x574d06['autoAssociation']&&_0x2ab5cf[_0x5029('0x12')]===_0x5029('0xe')){if(_0x5bf867[_0x5029('0x84')][_0x5029('0xa2')]){_0x853407['include']=[{'all':!![]}];}return _0x315589[_0x2ab5cf[_0x5029('0x12')]][_0x5029('0x8')](_0x853407)[_0x5029('0x5')](function(_0x3295ba){var _0x49f6b8=[];_0x3295ba[_0x5029('0xa0')](function(_0x308860){var _0xe4b730;switch(_0x308860['reportType']){case _0x5029('0xa3'):_0xe4b730=_['find'](_0x574d06['associatedResources'],function(_0x3e3150){return _0x3e3150['id']===_0x308860['reportId']&&_0x3e3150[_0x5029('0x35')]===_0x5029('0xa4');});break;case _0x5029('0xa5'):_0xe4b730=_[_0x5029('0x8a')](_0x574d06[_0x5029('0x6')],function(_0x227d13){return _0x227d13['id']===_0x308860[_0x5029('0x72')]&&_0x227d13[_0x5029('0x35')]==='CustomReports';});break;}if(_0xe4b730)_0x49f6b8['push'](_0x308860);});_0x2a9d12[_0x5029('0xa6')]=_0x49f6b8['length'];_0x2a9d12['rows']=_0x49f6b8;return _0x2a9d12;});}else{return _0x315589[_0x2ab5cf[_0x5029('0x12')]]['count']({'where':_0x853407['where']})[_0x5029('0x5')](function(_0xb8da0b){_0x2a9d12[_0x5029('0xa6')]=_0xb8da0b;if(_0x5bf867[_0x5029('0x84')][_0x5029('0xa2')]){if(_0x2ab5cf['childModel']===_0x5029('0x18')){_0x853407[_0x5029('0xa7')]=[{'model':_0x315589[_0x5029('0x6c')],'as':'Tags','attributes':['id',_0x5029('0xa'),_0x5029('0xa8')],'required':_0x5bf867[_0x5029('0x84')][_0x5029('0xa9')]?!![]:![]},{'model':_0x315589[_0x5029('0x6c')],'as':'ThroughTags','attributes':['id','name',_0x5029('0xa8')],'through':_0x5bf867[_0x5029('0x84')]['tag']?{'attributes':[],'where':{'TagId':_0x5bf867[_0x5029('0x84')][_0x5029('0xa9')]||undefined}}:{},'required':_0x5bf867[_0x5029('0x84')][_0x5029('0xa9')]?!![]:![]}];}else{_0x853407[_0x5029('0xa7')]=[{'all':!![]}];}}return _0x315589[_0x2ab5cf[_0x5029('0x12')]][_0x5029('0x8')](_0x853407);})[_0x5029('0x5')](function(_0x51aaad){_0x2a9d12['rows']=_0x51aaad;if(_0x4f2f0c===_0x5029('0x2d')&&_0x5bf867['query'][_0x5029('0xaa')]==='true'){var _0x36fdce=[];for(var _0x37880b=0x0;_0x37880b<_0x2a9d12[_0x5029('0xab')]['length'];_0x37880b++){_0x36fdce[_0x5029('0x89')](_0x4e8d9f(_0x5029('0xac'),_0x2a9d12[_0x5029('0xab')][_0x37880b]['dataValues']));_0x36fdce[_0x5029('0x89')](_0x4e8d9f(_0x5029('0xad'),_0x2a9d12[_0x5029('0xab')][_0x37880b][_0x5029('0xae')]));_0x36fdce[_0x5029('0x89')](_0x4e8d9f(_0x5029('0xaf'),_0x2a9d12[_0x5029('0xab')][_0x37880b][_0x5029('0xae')]));_0x36fdce[_0x5029('0x89')](_0x4e8d9f(_0x5029('0xb0'),_0x2a9d12[_0x5029('0xab')][_0x37880b][_0x5029('0xae')]));_0x36fdce[_0x5029('0x89')](_0x4e8d9f(_0x5029('0xb1'),_0x2a9d12[_0x5029('0xab')][_0x37880b][_0x5029('0xae')]));_0x36fdce[_0x5029('0x89')](_0x4e8d9f(_0x5029('0xb2'),_0x2a9d12['rows'][_0x37880b][_0x5029('0xae')]));}return Promise[_0x5029('0x8f')](_0x36fdce)[_0x5029('0x5')](function(){return _0x2a9d12;});}return _0x2a9d12;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index d88bf33..91ec7e5 100644 --- a/server/api/userProfile/userProfile.rpc.js +++ b/server/api/userProfile/userProfile.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x80c3=['lodash','bluebird','ioredis','../../mysqldb','../../config/utils','jayson/promise','redis','defaults','socket.io-emitter','register','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x3fda66,_0x4a3515){var _0x4228e7=function(_0x104baf){while(--_0x104baf){_0x3fda66['push'](_0x3fda66['shift']());}};_0x4228e7(++_0x4a3515);}(_0x80c3,0x18f));var _0x380c=function(_0x12bcf7,_0xc11103){_0x12bcf7=_0x12bcf7-0x0;var _0x2825a=_0x80c3[_0x12bcf7];return _0x2825a;};'use strict';var _=require(_0x380c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x380c('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x380c('0x2'));var db=require(_0x380c('0x3'))['db'];var utils=require(_0x380c('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x380c('0x5'));var client=jayson['client']['http']({'port':0x232a});config[_0x380c('0x6')]=_[_0x380c('0x7')](config[_0x380c('0x6')],{'host':'localhost','port':0x18eb});var socket=require(_0x380c('0x8'))(new Redis(config[_0x380c('0x6')]));require('./userProfile.socket')[_0x380c('0x9')](socket);function respondWithRpcPromise(_0x1d5493,_0x50be52,_0x58886c){return new BPromise(function(_0x3a1ebb,_0x35f424){return client['request'](_0x1d5493,_0x58886c)[_0x380c('0xa')](function(_0x41fbf2){logger[_0x380c('0xb')](_0x380c('0xc'),_0x50be52,_0x380c('0xd'));logger[_0x380c('0xe')](_0x380c('0xf'),_0x50be52,_0x380c('0xd'),JSON[_0x380c('0x10')](_0x41fbf2));if(_0x41fbf2[_0x380c('0x11')]){if(_0x41fbf2['error'][_0x380c('0x12')]===0x1f4){logger[_0x380c('0x11')]('UserProfile,\x20%s,\x20%s',_0x50be52,_0x41fbf2[_0x380c('0x11')][_0x380c('0x13')]);return _0x35f424(_0x41fbf2[_0x380c('0x11')][_0x380c('0x13')]);}logger[_0x380c('0x11')](_0x380c('0xc'),_0x50be52,_0x41fbf2[_0x380c('0x11')][_0x380c('0x13')]);return _0x3a1ebb(_0x41fbf2[_0x380c('0x11')]['message']);}else{logger[_0x380c('0xb')]('UserProfile,\x20%s,\x20%s',_0x50be52,'request\x20sent');_0x3a1ebb(_0x41fbf2[_0x380c('0x14')]['message']);}})['catch'](function(_0x4901fe){logger['error'](_0x380c('0xc'),_0x50be52,_0x4901fe);_0x35f424(_0x4901fe);});});} \ No newline at end of file +var _0xd634=['stringify','error','UserProfile,\x20%s,\x20%s','message','util','moment','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','request','info','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s'];(function(_0x152953,_0x46ff51){var _0x3dbc2c=function(_0x3e1d59){while(--_0x3e1d59){_0x152953['push'](_0x152953['shift']());}};_0x3dbc2c(++_0x46ff51);}(_0xd634,0xf4));var _0x4d63=function(_0xa1e3ca,_0x559022){_0xa1e3ca=_0xa1e3ca-0x0;var _0x5005ab=_0xd634[_0xa1e3ca];return _0x5005ab;};'use strict';var _=require('lodash');var util=require(_0x4d63('0x0'));var moment=require(_0x4d63('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4d63('0x2'));var db=require(_0x4d63('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4d63('0x4'));var config=require(_0x4d63('0x5'));var jayson=require(_0x4d63('0x6'));var client=jayson[_0x4d63('0x7')][_0x4d63('0x8')]({'port':0x232a});config[_0x4d63('0x9')]=_[_0x4d63('0xa')](config[_0x4d63('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./userProfile.socket')['register'](socket);function respondWithRpcPromise(_0x305d5b,_0x46a91a,_0x20aac2){return new BPromise(function(_0x58e78d,_0x21024c){return client[_0x4d63('0xb')](_0x305d5b,_0x20aac2)['then'](function(_0x5f5707){logger[_0x4d63('0xc')]('UserProfile,\x20%s,\x20%s',_0x46a91a,_0x4d63('0xd'));logger[_0x4d63('0xe')](_0x4d63('0xf'),_0x46a91a,_0x4d63('0xd'),JSON[_0x4d63('0x10')](_0x5f5707));if(_0x5f5707[_0x4d63('0x11')]){if(_0x5f5707['error']['code']===0x1f4){logger['error'](_0x4d63('0x12'),_0x46a91a,_0x5f5707[_0x4d63('0x11')][_0x4d63('0x13')]);return _0x21024c(_0x5f5707[_0x4d63('0x11')]['message']);}logger[_0x4d63('0x11')](_0x4d63('0x12'),_0x46a91a,_0x5f5707[_0x4d63('0x11')][_0x4d63('0x13')]);return _0x58e78d(_0x5f5707[_0x4d63('0x11')][_0x4d63('0x13')]);}else{logger[_0x4d63('0xc')](_0x4d63('0x12'),_0x46a91a,'request\x20sent');_0x58e78d(_0x5f5707['result'][_0x4d63('0x13')]);}})['catch'](function(_0x19d26f){logger[_0x4d63('0x11')](_0x4d63('0x12'),_0x46a91a,_0x19d26f);_0x21024c(_0x19d26f);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 53009c0..724efce 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 _0x0add=['removeListener','register','length','userProfile:','./userProfile.events','save','remove','update','emit'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x0add,0x148));var _0xd0ad=function(_0x420d8d,_0x78b67f){_0x420d8d=_0x420d8d-0x0;var _0x4865d7=_0x0add[_0x420d8d];return _0x4865d7;};'use strict';var UserProfileEvents=require(_0xd0ad('0x0'));var events=[_0xd0ad('0x1'),_0xd0ad('0x2'),_0xd0ad('0x3')];function createListener(_0x43dcb4,_0x33fe81){return function(_0x1217f5){_0x33fe81[_0xd0ad('0x4')](_0x43dcb4,_0x1217f5);};}function removeListener(_0x66129a,_0x32364c){return function(){UserProfileEvents[_0xd0ad('0x5')](_0x66129a,_0x32364c);};}exports[_0xd0ad('0x6')]=function(_0x2cb743){for(var _0x4243bc=0x0,_0xbffc88=events[_0xd0ad('0x7')];_0x4243bc<_0xbffc88;_0x4243bc++){var _0x5eeae8=events[_0x4243bc];var _0x559d14=createListener(_0xd0ad('0x8')+_0x5eeae8,_0x2cb743);UserProfileEvents['on'](_0x5eeae8,_0x559d14);}}; \ No newline at end of file +var _0xd464=['update','removeListener','register','length','userProfile:','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd464,0x9b));var _0x4d46=function(_0x40e381,_0x50f482){_0x40e381=_0x40e381-0x0;var _0x51e9db=_0xd464[_0x40e381];return _0x51e9db;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=[_0x4d46('0x0'),'remove',_0x4d46('0x1')];function createListener(_0x638f3b,_0x4a48d6){return function(_0x2f37ba){_0x4a48d6['emit'](_0x638f3b,_0x2f37ba);};}function removeListener(_0x2ef7a8,_0x4929c1){return function(){UserProfileEvents[_0x4d46('0x2')](_0x2ef7a8,_0x4929c1);};}exports[_0x4d46('0x3')]=function(_0x985c98){for(var _0x24637b=0x0,_0x182941=events[_0x4d46('0x4')];_0x24637b<_0x182941;_0x24637b++){var _0x1c7414=events[_0x24637b];var _0x3e77c6=createListener(_0x4d46('0x5')+_0x1c7414,_0x985c98);UserProfileEvents['on'](_0x1c7414,_0x3e77c6);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 957f1e6..d9d2ca4 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 _0x0105=['./userProfileResource.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','destroy','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x310eb3,_0x546e4a){var _0x3a0766=function(_0xa3c1ac){while(--_0xa3c1ac){_0x310eb3['push'](_0x310eb3['shift']());}};_0x3a0766(++_0x546e4a);}(_0x0105,0x1dc));var _0x5010=function(_0x3a0bee,_0x5e1286){_0x3a0bee=_0x3a0bee-0x0;var _0x2f5898=_0x0105[_0x3a0bee];return _0x2f5898;};'use strict';var multer=require(_0x5010('0x0'));var util=require(_0x5010('0x1'));var path=require('path');var timeout=require(_0x5010('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x5010('0x3'));var auth=require(_0x5010('0x4'));var interaction=require(_0x5010('0x5'));var config=require(_0x5010('0x6'));var controller=require(_0x5010('0x7'));router[_0x5010('0x8')]('/',auth['isAuthenticated'](),controller[_0x5010('0x9')]);router[_0x5010('0x8')](_0x5010('0xa'),auth[_0x5010('0xb')](),controller[_0x5010('0xc')]);router['get'](_0x5010('0xd'),auth[_0x5010('0xb')](),controller[_0x5010('0xe')]);router[_0x5010('0xf')]('/',auth[_0x5010('0xb')](),controller[_0x5010('0x10')]);router[_0x5010('0x11')](_0x5010('0xd'),auth[_0x5010('0xb')](),controller[_0x5010('0x12')]);router['delete'](_0x5010('0xd'),auth[_0x5010('0xb')](),controller[_0x5010('0x13')]);module[_0x5010('0x14')]=router; \ No newline at end of file +var _0x880e=['get','/:id','create','put','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./userProfileResource.controller','isAuthenticated','index','/describe','describe'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0x880e,0x180));var _0xe880=function(_0x37756b,_0x24db76){_0x37756b=_0x37756b-0x0;var _0x46efec=_0x880e[_0x37756b];return _0x46efec;};'use strict';var multer=require(_0xe880('0x0'));var util=require('util');var path=require(_0xe880('0x1'));var timeout=require(_0xe880('0x2'));var express=require(_0xe880('0x3'));var router=express[_0xe880('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe880('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe880('0x6'));var controller=require(_0xe880('0x7'));router['get']('/',auth[_0xe880('0x8')](),controller[_0xe880('0x9')]);router['get'](_0xe880('0xa'),auth['isAuthenticated'](),controller[_0xe880('0xb')]);router[_0xe880('0xc')](_0xe880('0xd'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xe880('0x8')](),controller[_0xe880('0xe')]);router[_0xe880('0xf')](_0xe880('0xd'),auth[_0xe880('0x8')](),controller['update']);router['delete']('/:id',auth[_0xe880('0x8')](),controller[_0xe880('0x10')]);module[_0xe880('0x11')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 8ec761a..3da5c96 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 _0x74da=['STRING','sequelize','exports'];(function(_0x39258d,_0x46cd06){var _0x2f54ce=function(_0x481f3b){while(--_0x481f3b){_0x39258d['push'](_0x39258d['shift']());}};_0x2f54ce(++_0x46cd06);}(_0x74da,0x196));var _0xa74d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x74da[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xa74d('0x0'));module[_0xa74d('0x1')]={'name':{'type':Sequelize[_0xa74d('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize[_0xa74d('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xec97=['INTEGER','STRING','sequelize','exports'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xec97,0x9e));var _0x7ec9=function(_0x5cca1e,_0x167528){_0x5cca1e=_0x5cca1e-0x0;var _0x2a04a2=_0xec97[_0x5cca1e];return _0x2a04a2;};'use strict';var Sequelize=require(_0x7ec9('0x0'));module[_0x7ec9('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize[_0x7ec9('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x7ec9('0x3')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index eade05d..f910be5 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 _0x5f66=['bluebird','mustache','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','destroy','then','error','name','send','index','map','UserProfileResource','rawAttributes','fieldName','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','show','params','find','create','body','update','catch','describe','rimraf','fast-json-patch','request-promise','moment'];(function(_0x273dc5,_0x268a81){var _0x46dae7=function(_0x263d62){while(--_0x263d62){_0x273dc5['push'](_0x273dc5['shift']());}};_0x46dae7(++_0x268a81);}(_0x5f66,0x1a0));var _0x65f6=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x5f66[_0x278e3c];return _0x3e2d9b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x65f6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x65f6('0x1'));var rp=require(_0x65f6('0x2'));var moment=require(_0x65f6('0x3'));var BPromise=require(_0x65f6('0x4'));var Mustache=require(_0x65f6('0x5'));var util=require('util');var path=require(_0x65f6('0x6'));var sox=require('sox');var csv=require(_0x65f6('0x7'));var ejs=require(_0x65f6('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x65f6('0x9'));var crypto=require(_0x65f6('0xa'));var jsforce=require(_0x65f6('0xb'));var deskjs=require(_0x65f6('0xc'));var toCsv=require(_0x65f6('0x7'));var querystring=require(_0x65f6('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x65f6('0xe'));var qs=require(_0x65f6('0xf'));var as=require(_0x65f6('0x10'));var hardwareService=require(_0x65f6('0x11'));var logger=require('../../config/logger')(_0x65f6('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x65f6('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x419819,_0x4862a5){_0x4862a5=_0x4862a5||0xcc;return function(_0x2f964a){if(_0x2f964a){return _0x419819[_0x65f6('0x14')](_0x4862a5);}return _0x419819[_0x65f6('0x15')](_0x4862a5)[_0x65f6('0x16')]();};}function respondWithResult(_0x369f96,_0x1d29fd){_0x1d29fd=_0x1d29fd||0xc8;return function(_0x44144b){if(_0x44144b){return _0x369f96[_0x65f6('0x15')](_0x1d29fd)[_0x65f6('0x17')](_0x44144b);}};}function respondWithFilteredResult(_0x3440af,_0x59154e){return function(_0x19b9ff){if(_0x19b9ff){var _0x49a913=typeof _0x59154e['offset']===_0x65f6('0x18')&&typeof _0x59154e[_0x65f6('0x19')]===_0x65f6('0x18');var _0x1c955c=_0x19b9ff[_0x65f6('0x1a')];var _0x1f974c=_0x49a913?0x0:_0x59154e[_0x65f6('0x1b')];var _0x18380e=_0x49a913?_0x19b9ff['count']:_0x59154e['offset']+_0x59154e[_0x65f6('0x19')];var _0x5b4055;if(_0x18380e>=_0x1c955c){_0x18380e=_0x1c955c;_0x5b4055=0xc8;}else{_0x5b4055=0xce;}_0x3440af['status'](_0x5b4055);return _0x3440af['set'](_0x65f6('0x1c'),_0x1f974c+'-'+_0x18380e+'/'+_0x1c955c)[_0x65f6('0x17')](_0x19b9ff);}return null;};}function patchUpdates(_0x5114a4){return function(_0x39e19f){try{jsonpatch[_0x65f6('0x1d')](_0x39e19f,_0x5114a4,!![]);}catch(_0xbee6a4){return BPromise[_0x65f6('0x1e')](_0xbee6a4);}return _0x39e19f[_0x65f6('0x1f')]();};}function saveUpdates(_0xc139c2,_0x581374){return function(_0x197a49){if(_0x197a49){return _0x197a49['update'](_0xc139c2)['then'](function(_0x212247){return _0x212247;});}return null;};}function removeEntity(_0xd173f4,_0x524e42){return function(_0x1eeaaa){if(_0x1eeaaa){return _0x1eeaaa[_0x65f6('0x20')]()[_0x65f6('0x21')](function(){_0xd173f4[_0x65f6('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9d7bb0,_0x59ea32){return function(_0x20a161){if(!_0x20a161){_0x9d7bb0['sendStatus'](0x194);}return _0x20a161;};}function handleError(_0x5cb131,_0x4fde2f){_0x4fde2f=_0x4fde2f||0x1f4;return function(_0x29abdb){logger[_0x65f6('0x22')](_0x29abdb['stack']);if(_0x29abdb[_0x65f6('0x23')]){delete _0x29abdb[_0x65f6('0x23')];}_0x5cb131['status'](_0x4fde2f)[_0x65f6('0x24')](_0x29abdb);};}exports[_0x65f6('0x25')]=function(_0x28d0df,_0x559330){var _0x4ac04b={},_0x488d36={},_0x266cfe={'count':0x0,'rows':[]};var _0x3c032f=_[_0x65f6('0x26')](db[_0x65f6('0x27')][_0x65f6('0x28')],function(_0x14a387){return{'name':_0x14a387[_0x65f6('0x29')],'type':_0x14a387['type']['key']};});_0x488d36[_0x65f6('0x2a')]=_[_0x65f6('0x26')](_0x3c032f,'name');_0x488d36['query']=_[_0x65f6('0x2b')](_0x28d0df[_0x65f6('0x2c')]);_0x488d36[_0x65f6('0x2d')]=_[_0x65f6('0x2e')](_0x488d36[_0x65f6('0x2a')],_0x488d36[_0x65f6('0x2c')]);_0x4ac04b['attributes']=_[_0x65f6('0x2e')](_0x488d36[_0x65f6('0x2a')],qs[_0x65f6('0x2f')](_0x28d0df['query'][_0x65f6('0x2f')]));_0x4ac04b[_0x65f6('0x30')]=_0x4ac04b[_0x65f6('0x30')][_0x65f6('0x31')]?_0x4ac04b[_0x65f6('0x30')]:_0x488d36[_0x65f6('0x2a')];if(!_0x28d0df['query'][_0x65f6('0x32')](_0x65f6('0x33'))){_0x4ac04b['limit']=qs[_0x65f6('0x19')](_0x28d0df['query'][_0x65f6('0x19')]);_0x4ac04b['offset']=qs[_0x65f6('0x1b')](_0x28d0df[_0x65f6('0x2c')]['offset']);}_0x4ac04b[_0x65f6('0x34')]=qs[_0x65f6('0x35')](_0x28d0df[_0x65f6('0x2c')]['sort']);_0x4ac04b['where']=qs[_0x65f6('0x2d')](_['pick'](_0x28d0df[_0x65f6('0x2c')],_0x488d36['filters']),_0x3c032f);if(_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x36')]){_0x4ac04b['where']=_[_0x65f6('0x37')](_0x4ac04b['where'],{'$or':_['map'](_0x3c032f,function(_0x71b16b){if(_0x71b16b[_0x65f6('0x38')]!==_0x65f6('0x39')){var _0x313be5={};_0x313be5[_0x71b16b[_0x65f6('0x23')]]={'$like':'%'+_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x36')]+'%'};return _0x313be5;}})});}_0x4ac04b=_[_0x65f6('0x37')]({},_0x4ac04b,_0x28d0df['options']);var _0x3aa254={'where':_0x4ac04b['where']};return db[_0x65f6('0x27')][_0x65f6('0x1a')](_0x3aa254)[_0x65f6('0x21')](function(_0x2ea7f7){_0x266cfe['count']=_0x2ea7f7;if(_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x3a')]){_0x4ac04b[_0x65f6('0x3b')]=[{'all':!![]}];}return db[_0x65f6('0x27')][_0x65f6('0x3c')](_0x4ac04b);})[_0x65f6('0x21')](function(_0xed4c96){_0x266cfe[_0x65f6('0x3d')]=_0xed4c96;return _0x266cfe;})[_0x65f6('0x21')](respondWithFilteredResult(_0x559330,_0x4ac04b))['catch'](handleError(_0x559330,null));};exports[_0x65f6('0x3e')]=function(_0x400ed2,_0x377ae5){var _0x181798={'raw':![],'where':{'id':_0x400ed2[_0x65f6('0x3f')]['id']}},_0x83e2d9={};_0x83e2d9[_0x65f6('0x2a')]=_[_0x65f6('0x2b')](db[_0x65f6('0x27')][_0x65f6('0x28')]);_0x83e2d9[_0x65f6('0x2c')]=_[_0x65f6('0x2b')](_0x400ed2[_0x65f6('0x2c')]);_0x83e2d9[_0x65f6('0x2d')]=_[_0x65f6('0x2e')](_0x83e2d9[_0x65f6('0x2a')],_0x83e2d9['query']);_0x181798[_0x65f6('0x30')]=_[_0x65f6('0x2e')](_0x83e2d9[_0x65f6('0x2a')],qs[_0x65f6('0x2f')](_0x400ed2['query'][_0x65f6('0x2f')]));_0x181798[_0x65f6('0x30')]=_0x181798[_0x65f6('0x30')]['length']?_0x181798[_0x65f6('0x30')]:_0x83e2d9[_0x65f6('0x2a')];if(_0x400ed2[_0x65f6('0x2c')][_0x65f6('0x3a')]){_0x181798['include']=[{'all':!![]}];}_0x181798=_[_0x65f6('0x37')]({},_0x181798,_0x400ed2['options']);return db[_0x65f6('0x27')][_0x65f6('0x40')](_0x181798)['then'](handleEntityNotFound(_0x377ae5,null))[_0x65f6('0x21')](respondWithResult(_0x377ae5,null))['catch'](handleError(_0x377ae5,null));};exports[_0x65f6('0x41')]=function(_0x4d9b76,_0x2d1706){return db[_0x65f6('0x27')][_0x65f6('0x41')](_0x4d9b76[_0x65f6('0x42')],{})['then'](respondWithResult(_0x2d1706,0xc9))['catch'](handleError(_0x2d1706,null));};exports[_0x65f6('0x43')]=function(_0x15d3ba,_0x3b647a){if(_0x15d3ba[_0x65f6('0x42')]['id']){delete _0x15d3ba[_0x65f6('0x42')]['id'];}return db[_0x65f6('0x27')][_0x65f6('0x40')]({'where':{'id':_0x15d3ba[_0x65f6('0x3f')]['id']}})[_0x65f6('0x21')](handleEntityNotFound(_0x3b647a,null))['then'](saveUpdates(_0x15d3ba[_0x65f6('0x42')],null))[_0x65f6('0x21')](respondWithResult(_0x3b647a,null))[_0x65f6('0x44')](handleError(_0x3b647a,null));};exports['destroy']=function(_0x47e749,_0x42d453){return db['UserProfileResource'][_0x65f6('0x40')]({'where':{'id':_0x47e749[_0x65f6('0x3f')]['id']}})['then'](handleEntityNotFound(_0x42d453,null))[_0x65f6('0x21')](removeEntity(_0x42d453,null))['catch'](handleError(_0x42d453,null));};exports[_0x65f6('0x45')]=function(_0x3b241f,_0x1ca67e){return db['UserProfileResource'][_0x65f6('0x45')]()[_0x65f6('0x21')](respondWithResult(_0x1ca67e,null))['catch'](handleError(_0x1ca67e,null));}; \ No newline at end of file +var _0x01d9=['rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','catch','show','params','includeAll','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','error','name','send','index','map','UserProfileResource'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x01d9,0x6c));var _0x901d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x01d9[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x901d('0x0'));var rimraf=require(_0x901d('0x1'));var zipdir=require(_0x901d('0x2'));var jsonpatch=require(_0x901d('0x3'));var rp=require('request-promise');var moment=require(_0x901d('0x4'));var BPromise=require(_0x901d('0x5'));var Mustache=require(_0x901d('0x6'));var util=require(_0x901d('0x7'));var path=require(_0x901d('0x8'));var sox=require(_0x901d('0x9'));var csv=require(_0x901d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x901d('0xb'));var _=require(_0x901d('0xc'));var squel=require(_0x901d('0xd'));var crypto=require(_0x901d('0xe'));var jsforce=require(_0x901d('0xf'));var deskjs=require(_0x901d('0x10'));var toCsv=require(_0x901d('0xa'));var querystring=require(_0x901d('0x11'));var Papa=require(_0x901d('0x12'));var Redis=require(_0x901d('0x13'));var authService=require(_0x901d('0x14'));var qs=require(_0x901d('0x15'));var as=require(_0x901d('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x901d('0x17'))('api');var utils=require(_0x901d('0x18'));var config=require(_0x901d('0x19'));var licenseUtil=require(_0x901d('0x1a'));var db=require(_0x901d('0x1b'))['db'];function respondWithStatusCode(_0x15ebaf,_0x5d2345){_0x5d2345=_0x5d2345||0xcc;return function(_0x1d8117){if(_0x1d8117){return _0x15ebaf[_0x901d('0x1c')](_0x5d2345);}return _0x15ebaf[_0x901d('0x1d')](_0x5d2345)[_0x901d('0x1e')]();};}function respondWithResult(_0xb8869a,_0x14d99b){_0x14d99b=_0x14d99b||0xc8;return function(_0x530a2b){if(_0x530a2b){return _0xb8869a[_0x901d('0x1d')](_0x14d99b)[_0x901d('0x1f')](_0x530a2b);}};}function respondWithFilteredResult(_0x11b0cc,_0x17d451){return function(_0x1aba97){if(_0x1aba97){var _0x7dd5f4=typeof _0x17d451[_0x901d('0x20')]===_0x901d('0x21')&&typeof _0x17d451[_0x901d('0x22')]===_0x901d('0x21');var _0x28caae=_0x1aba97[_0x901d('0x23')];var _0x285353=_0x7dd5f4?0x0:_0x17d451[_0x901d('0x20')];var _0x38f42b=_0x7dd5f4?_0x1aba97[_0x901d('0x23')]:_0x17d451[_0x901d('0x20')]+_0x17d451[_0x901d('0x22')];var _0x57d518;if(_0x38f42b>=_0x28caae){_0x38f42b=_0x28caae;_0x57d518=0xc8;}else{_0x57d518=0xce;}_0x11b0cc[_0x901d('0x1d')](_0x57d518);return _0x11b0cc[_0x901d('0x24')]('Content-Range',_0x285353+'-'+_0x38f42b+'/'+_0x28caae)['json'](_0x1aba97);}return null;};}function patchUpdates(_0x496a06){return function(_0x53f8ae){try{jsonpatch[_0x901d('0x25')](_0x53f8ae,_0x496a06,!![]);}catch(_0x44ea6f){return BPromise['reject'](_0x44ea6f);}return _0x53f8ae[_0x901d('0x26')]();};}function saveUpdates(_0x3ea3f6,_0x488e24){return function(_0x20778b){if(_0x20778b){return _0x20778b[_0x901d('0x27')](_0x3ea3f6)[_0x901d('0x28')](function(_0x3f80b9){return _0x3f80b9;});}return null;};}function removeEntity(_0x1e7d36,_0x1818d3){return function(_0x46e5c6){if(_0x46e5c6){return _0x46e5c6[_0x901d('0x29')]()['then'](function(){_0x1e7d36[_0x901d('0x1d')](0xcc)[_0x901d('0x1e')]();});}};}function handleEntityNotFound(_0xbc89a5,_0x1f0ee5){return function(_0x557809){if(!_0x557809){_0xbc89a5[_0x901d('0x1c')](0x194);}return _0x557809;};}function handleError(_0x23fd43,_0x27f4ca){_0x27f4ca=_0x27f4ca||0x1f4;return function(_0x3cbe43){logger[_0x901d('0x2a')](_0x3cbe43['stack']);if(_0x3cbe43[_0x901d('0x2b')]){delete _0x3cbe43[_0x901d('0x2b')];}_0x23fd43[_0x901d('0x1d')](_0x27f4ca)[_0x901d('0x2c')](_0x3cbe43);};}exports[_0x901d('0x2d')]=function(_0x3de9b9,_0x48e86e){var _0xae6dfe={},_0x533038={},_0x128830={'count':0x0,'rows':[]};var _0x389fd9=_[_0x901d('0x2e')](db[_0x901d('0x2f')][_0x901d('0x30')],function(_0x20df02){return{'name':_0x20df02[_0x901d('0x31')],'type':_0x20df02[_0x901d('0x32')][_0x901d('0x33')]};});_0x533038[_0x901d('0x34')]=_[_0x901d('0x2e')](_0x389fd9,_0x901d('0x2b'));_0x533038[_0x901d('0x35')]=_[_0x901d('0x36')](_0x3de9b9[_0x901d('0x35')]);_0x533038['filters']=_[_0x901d('0x37')](_0x533038[_0x901d('0x34')],_0x533038[_0x901d('0x35')]);_0xae6dfe['attributes']=_[_0x901d('0x37')](_0x533038[_0x901d('0x34')],qs[_0x901d('0x38')](_0x3de9b9[_0x901d('0x35')][_0x901d('0x38')]));_0xae6dfe[_0x901d('0x39')]=_0xae6dfe[_0x901d('0x39')][_0x901d('0x3a')]?_0xae6dfe[_0x901d('0x39')]:_0x533038[_0x901d('0x34')];if(!_0x3de9b9['query']['hasOwnProperty'](_0x901d('0x3b'))){_0xae6dfe['limit']=qs[_0x901d('0x22')](_0x3de9b9[_0x901d('0x35')]['limit']);_0xae6dfe[_0x901d('0x20')]=qs[_0x901d('0x20')](_0x3de9b9[_0x901d('0x35')]['offset']);}_0xae6dfe[_0x901d('0x3c')]=qs[_0x901d('0x3d')](_0x3de9b9[_0x901d('0x35')][_0x901d('0x3d')]);_0xae6dfe[_0x901d('0x3e')]=qs[_0x901d('0x3f')](_[_0x901d('0x40')](_0x3de9b9[_0x901d('0x35')],_0x533038[_0x901d('0x3f')]),_0x389fd9);if(_0x3de9b9[_0x901d('0x35')][_0x901d('0x41')]){_0xae6dfe[_0x901d('0x3e')]=_[_0x901d('0x42')](_0xae6dfe[_0x901d('0x3e')],{'$or':_[_0x901d('0x2e')](_0x389fd9,function(_0x1644d8){if(_0x1644d8['type']!==_0x901d('0x43')){var _0x423cab={};_0x423cab[_0x1644d8['name']]={'$like':'%'+_0x3de9b9['query'][_0x901d('0x41')]+'%'};return _0x423cab;}})});}_0xae6dfe=_['merge']({},_0xae6dfe,_0x3de9b9[_0x901d('0x44')]);var _0x3d0556={'where':_0xae6dfe[_0x901d('0x3e')]};return db[_0x901d('0x2f')][_0x901d('0x23')](_0x3d0556)[_0x901d('0x28')](function(_0x5df4cb){_0x128830['count']=_0x5df4cb;if(_0x3de9b9['query']['includeAll']){_0xae6dfe[_0x901d('0x45')]=[{'all':!![]}];}return db[_0x901d('0x2f')]['findAll'](_0xae6dfe);})[_0x901d('0x28')](function(_0x22fc44){_0x128830['rows']=_0x22fc44;return _0x128830;})[_0x901d('0x28')](respondWithFilteredResult(_0x48e86e,_0xae6dfe))[_0x901d('0x46')](handleError(_0x48e86e,null));};exports[_0x901d('0x47')]=function(_0x2c1895,_0x53663d){var _0x5aeb41={'raw':![],'where':{'id':_0x2c1895[_0x901d('0x48')]['id']}},_0xa9c008={};_0xa9c008[_0x901d('0x34')]=_[_0x901d('0x36')](db[_0x901d('0x2f')][_0x901d('0x30')]);_0xa9c008[_0x901d('0x35')]=_[_0x901d('0x36')](_0x2c1895[_0x901d('0x35')]);_0xa9c008[_0x901d('0x3f')]=_[_0x901d('0x37')](_0xa9c008['model'],_0xa9c008[_0x901d('0x35')]);_0x5aeb41['attributes']=_[_0x901d('0x37')](_0xa9c008['model'],qs[_0x901d('0x38')](_0x2c1895['query'][_0x901d('0x38')]));_0x5aeb41[_0x901d('0x39')]=_0x5aeb41[_0x901d('0x39')][_0x901d('0x3a')]?_0x5aeb41[_0x901d('0x39')]:_0xa9c008[_0x901d('0x34')];if(_0x2c1895[_0x901d('0x35')][_0x901d('0x49')]){_0x5aeb41[_0x901d('0x45')]=[{'all':!![]}];}_0x5aeb41=_[_0x901d('0x42')]({},_0x5aeb41,_0x2c1895[_0x901d('0x44')]);return db['UserProfileResource'][_0x901d('0x4a')](_0x5aeb41)[_0x901d('0x28')](handleEntityNotFound(_0x53663d,null))[_0x901d('0x28')](respondWithResult(_0x53663d,null))[_0x901d('0x46')](handleError(_0x53663d,null));};exports[_0x901d('0x4b')]=function(_0x24b6fa,_0x27459b){return db[_0x901d('0x2f')][_0x901d('0x4b')](_0x24b6fa[_0x901d('0x4c')],{})[_0x901d('0x28')](respondWithResult(_0x27459b,0xc9))[_0x901d('0x46')](handleError(_0x27459b,null));};exports[_0x901d('0x27')]=function(_0x23f2a9,_0x4888e8){if(_0x23f2a9['body']['id']){delete _0x23f2a9[_0x901d('0x4c')]['id'];}return db[_0x901d('0x2f')][_0x901d('0x4a')]({'where':{'id':_0x23f2a9[_0x901d('0x48')]['id']}})[_0x901d('0x28')](handleEntityNotFound(_0x4888e8,null))['then'](saveUpdates(_0x23f2a9['body'],null))[_0x901d('0x28')](respondWithResult(_0x4888e8,null))[_0x901d('0x46')](handleError(_0x4888e8,null));};exports['destroy']=function(_0x23673d,_0x165207){return db['UserProfileResource'][_0x901d('0x4a')]({'where':{'id':_0x23673d['params']['id']}})[_0x901d('0x28')](handleEntityNotFound(_0x165207,null))[_0x901d('0x28')](removeEntity(_0x165207,null))[_0x901d('0x46')](handleError(_0x165207,null));};exports[_0x901d('0x4d')]=function(_0x52aa2d,_0x3a3ea6){return db[_0x901d('0x2f')][_0x901d('0x4d')]()[_0x901d('0x28')](respondWithResult(_0x3a3ea6,null))[_0x901d('0x46')](handleError(_0x3a3ea6,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 576f6d2..36e77b3 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 _0xe26e=['sectionId','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./userProfileResource.attributes','exports','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId'];(function(_0x272129,_0x1f2a0a){var _0x59ace5=function(_0x22528c){while(--_0x22528c){_0x272129['push'](_0x272129['shift']());}};_0x59ace5(++_0x1f2a0a);}(_0xe26e,0x151));var _0xee26=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xe26e[_0x2be8c2];return _0x97f531;};'use strict';var _=require('lodash');var util=require(_0xee26('0x0'));var logger=require(_0xee26('0x1'))(_0xee26('0x2'));var moment=require(_0xee26('0x3'));var BPromise=require('bluebird');var rp=require(_0xee26('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xee26('0x5'));var config=require(_0xee26('0x6'));var attributes=require(_0xee26('0x7'));module[_0xee26('0x8')]=function(_0x12030a,_0x4b325e){return _0x12030a['define'](_0xee26('0x9'),attributes,{'tableName':_0xee26('0xa'),'paranoid':![],'indexes':[{'name':_0xee26('0xb'),'fields':[_0xee26('0xc'),_0xee26('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb837=['sectionId','lodash','util','../../config/logger','api','bluebird','path','rimraf','./userProfileResource.attributes','define','UserProfileResource','resourceId'];(function(_0x4605dc,_0x3f7ae5){var _0x5d3e81=function(_0x1d0375){while(--_0x1d0375){_0x4605dc['push'](_0x4605dc['shift']());}};_0x5d3e81(++_0x3f7ae5);}(_0xb837,0x139));var _0x7b83=function(_0x18032f,_0x4f4e45){_0x18032f=_0x18032f-0x0;var _0xb0b2b8=_0xb837[_0x18032f];return _0xb0b2b8;};'use strict';var _=require(_0x7b83('0x0'));var util=require(_0x7b83('0x1'));var logger=require(_0x7b83('0x2'))(_0x7b83('0x3'));var moment=require('moment');var BPromise=require(_0x7b83('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7b83('0x5'));var rimraf=require(_0x7b83('0x6'));var config=require('../../config/environment');var attributes=require(_0x7b83('0x7'));module['exports']=function(_0x490061,_0x4e5a01){return _0x490061[_0x7b83('0x8')](_0x7b83('0x9'),attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x7b83('0xa'),_0x7b83('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 3079d40..b69d666 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 _0x31b0=['request','then','UserProfileResource,\x20%s,\x20%s','request\x20sent','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','ioredis','../../mysqldb','../../config/logger','jayson/promise','http'];(function(_0x3b9587,_0x44eb6c){var _0x44c5c1=function(_0x1d1177){while(--_0x1d1177){_0x3b9587['push'](_0x3b9587['shift']());}};_0x44c5c1(++_0x44eb6c);}(_0x31b0,0x1ae));var _0x031b=function(_0x145042,_0x458dd4){_0x145042=_0x145042-0x0;var _0x214a0c=_0x31b0[_0x145042];return _0x214a0c;};'use strict';var _=require(_0x031b('0x0'));var util=require(_0x031b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x031b('0x2'));var db=require(_0x031b('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x031b('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x031b('0x5'));var client=jayson['client'][_0x031b('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x4fa238,_0x17f7a3,_0x31d488){return new BPromise(function(_0x575879,_0x2fcf82){return client[_0x031b('0x7')](_0x4fa238,_0x31d488)[_0x031b('0x8')](function(_0x56c866){logger['info'](_0x031b('0x9'),_0x17f7a3,_0x031b('0xa'));logger['debug'](_0x031b('0xb'),_0x17f7a3,_0x031b('0xa'),JSON[_0x031b('0xc')](_0x56c866));if(_0x56c866[_0x031b('0xd')]){if(_0x56c866[_0x031b('0xd')][_0x031b('0xe')]===0x1f4){logger[_0x031b('0xd')](_0x031b('0x9'),_0x17f7a3,_0x56c866[_0x031b('0xd')][_0x031b('0xf')]);return _0x2fcf82(_0x56c866[_0x031b('0xd')][_0x031b('0xf')]);}logger[_0x031b('0xd')]('UserProfileResource,\x20%s,\x20%s',_0x17f7a3,_0x56c866[_0x031b('0xd')]['message']);return _0x575879(_0x56c866[_0x031b('0xd')][_0x031b('0xf')]);}else{logger[_0x031b('0x10')](_0x031b('0x9'),_0x17f7a3,_0x031b('0xa'));_0x575879(_0x56c866[_0x031b('0x11')][_0x031b('0xf')]);}})[_0x031b('0x12')](function(_0x458673){logger[_0x031b('0xd')](_0x031b('0x9'),_0x17f7a3,_0x458673);_0x2fcf82(_0x458673);});});} \ No newline at end of file +var _0x9e4d=['jayson/promise','client','http','request','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x4ca6ab,_0x2c1bfa){var _0x33ac1b=function(_0x521ac2){while(--_0x521ac2){_0x4ca6ab['push'](_0x4ca6ab['shift']());}};_0x33ac1b(++_0x2c1bfa);}(_0x9e4d,0x1dc));var _0xd9e4=function(_0x68927a,_0x1bcc9a){_0x68927a=_0x68927a-0x0;var _0x5555f9=_0x9e4d[_0x68927a];return _0x5555f9;};'use strict';var _=require('lodash');var util=require(_0xd9e4('0x0'));var moment=require(_0xd9e4('0x1'));var BPromise=require('bluebird');var rs=require(_0xd9e4('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd9e4('0x3'))['db'];var utils=require(_0xd9e4('0x4'));var logger=require(_0xd9e4('0x5'))('rpc');var config=require(_0xd9e4('0x6'));var jayson=require(_0xd9e4('0x7'));var client=jayson[_0xd9e4('0x8')][_0xd9e4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5d54ac,_0x27d491,_0x4bac41){return new BPromise(function(_0x1ab2d5,_0x16946){return client[_0xd9e4('0xa')](_0x5d54ac,_0x4bac41)[_0xd9e4('0xb')](function(_0x177340){logger[_0xd9e4('0xc')](_0xd9e4('0xd'),_0x27d491,_0xd9e4('0xe'));logger[_0xd9e4('0xf')](_0xd9e4('0x10'),_0x27d491,_0xd9e4('0xe'),JSON[_0xd9e4('0x11')](_0x177340));if(_0x177340[_0xd9e4('0x12')]){if(_0x177340[_0xd9e4('0x12')][_0xd9e4('0x13')]===0x1f4){logger[_0xd9e4('0x12')](_0xd9e4('0xd'),_0x27d491,_0x177340[_0xd9e4('0x12')]['message']);return _0x16946(_0x177340['error']['message']);}logger[_0xd9e4('0x12')](_0xd9e4('0xd'),_0x27d491,_0x177340[_0xd9e4('0x12')][_0xd9e4('0x14')]);return _0x1ab2d5(_0x177340['error'][_0xd9e4('0x14')]);}else{logger['info']('UserProfileResource,\x20%s,\x20%s',_0x27d491,_0xd9e4('0xe'));_0x1ab2d5(_0x177340['result'][_0xd9e4('0x14')]);}})['catch'](function(_0x150577){logger['error']('UserProfileResource,\x20%s,\x20%s',_0x27d491,_0x150577);_0x16946(_0x150577);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 6ffa5bd..d209237 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 _0x54c1=['put','update','delete','destroy','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','describe','/:id','show','post','create'];(function(_0x4f34cb,_0x5dfb8b){var _0x9a9a20=function(_0x3f5287){while(--_0x3f5287){_0x4f34cb['push'](_0x4f34cb['shift']());}};_0x9a9a20(++_0x5dfb8b);}(_0x54c1,0xe0));var _0x154c=function(_0x3c8a38,_0x51b727){_0x3c8a38=_0x3c8a38-0x0;var _0x3839ef=_0x54c1[_0x3c8a38];return _0x3839ef;};'use strict';var multer=require('multer');var util=require(_0x154c('0x0'));var path=require(_0x154c('0x1'));var timeout=require(_0x154c('0x2'));var express=require(_0x154c('0x3'));var router=express['Router']();var fs_extra=require(_0x154c('0x4'));var auth=require(_0x154c('0x5'));var interaction=require(_0x154c('0x6'));var config=require(_0x154c('0x7'));var controller=require(_0x154c('0x8'));router[_0x154c('0x9')]('/',auth[_0x154c('0xa')](),controller['index']);router[_0x154c('0x9')]('/describe',auth[_0x154c('0xa')](),controller[_0x154c('0xb')]);router[_0x154c('0x9')](_0x154c('0xc'),auth[_0x154c('0xa')](),controller[_0x154c('0xd')]);router[_0x154c('0xe')]('/',auth[_0x154c('0xa')](),controller[_0x154c('0xf')]);router[_0x154c('0x10')](_0x154c('0xc'),auth[_0x154c('0xa')](),controller[_0x154c('0x11')]);router[_0x154c('0x12')](_0x154c('0xc'),auth[_0x154c('0xa')](),controller[_0x154c('0x13')]);module['exports']=router; \ No newline at end of file +var _0x6674=['multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','index','/describe','describe','/:id','post','isAuthenticated','put','update','delete','destroy'];(function(_0x3b380c,_0xe5347c){var _0x5c0904=function(_0x3532a2){while(--_0x3532a2){_0x3b380c['push'](_0x3b380c['shift']());}};_0x5c0904(++_0xe5347c);}(_0x6674,0x18f));var _0x4667=function(_0x51bdb0,_0x523d49){_0x51bdb0=_0x51bdb0-0x0;var _0x24f522=_0x6674[_0x51bdb0];return _0x24f522;};'use strict';var multer=require(_0x4667('0x0'));var util=require('util');var path=require(_0x4667('0x1'));var timeout=require(_0x4667('0x2'));var express=require(_0x4667('0x3'));var router=express[_0x4667('0x4')]();var fs_extra=require(_0x4667('0x5'));var auth=require(_0x4667('0x6'));var interaction=require(_0x4667('0x7'));var config=require(_0x4667('0x8'));var controller=require(_0x4667('0x9'));router[_0x4667('0xa')]('/',auth['isAuthenticated'](),controller[_0x4667('0xb')]);router[_0x4667('0xa')](_0x4667('0xc'),auth['isAuthenticated'](),controller[_0x4667('0xd')]);router[_0x4667('0xa')](_0x4667('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x4667('0xf')]('/',auth[_0x4667('0x10')](),controller['create']);router[_0x4667('0x11')]('/:id',auth[_0x4667('0x10')](),controller[_0x4667('0x12')]);router[_0x4667('0x13')](_0x4667('0xe'),auth['isAuthenticated'](),controller[_0x4667('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 9d4db90..3d7be92 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 _0x1c7c=['setDataValue','crudPermissions','join','getDataValue','split','sequelize','exports','STRING','BOOLEAN'];(function(_0x340c13,_0x595d66){var _0x5a7d96=function(_0x250118){while(--_0x250118){_0x340c13['push'](_0x340c13['shift']());}};_0x5a7d96(++_0x595d66);}(_0x1c7c,0x164));var _0xc1c7=function(_0x32f324,_0x21beef){_0x32f324=_0x32f324-0x0;var _0x2fdf6e=_0x1c7c[_0x32f324];return _0x2fdf6e;};'use strict';var Sequelize=require(_0xc1c7('0x0'));module[_0xc1c7('0x1')]={'name':{'type':Sequelize[_0xc1c7('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0xc1c7('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize[_0xc1c7('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xc1c7('0x2')],'set':function(_0x20dad3){this[_0xc1c7('0x4')](_0xc1c7('0x5'),_0x20dad3?_0x20dad3[_0xc1c7('0x6')](''):[]);},'get':function(){return this[_0xc1c7('0x7')](_0xc1c7('0x5'))?this[_0xc1c7('0x7')](_0xc1c7('0x5'))[_0xc1c7('0x8')](''):[];}}}; \ No newline at end of file +var _0x28f2=['join','getDataValue','split','sequelize','exports','STRING','INTEGER','BOOLEAN','setDataValue','crudPermissions'];(function(_0x29b4c6,_0x461170){var _0x354f89=function(_0x2f9c16){while(--_0x2f9c16){_0x29b4c6['push'](_0x29b4c6['shift']());}};_0x354f89(++_0x461170);}(_0x28f2,0x193));var _0x228f=function(_0x5e2dfe,_0x28aa30){_0x5e2dfe=_0x5e2dfe-0x0;var _0x4f538f=_0x28f2[_0x5e2dfe];return _0x4f538f;};'use strict';var Sequelize=require(_0x228f('0x0'));module[_0x228f('0x1')]={'name':{'type':Sequelize[_0x228f('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0x228f('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x228f('0x3')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x228f('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x228f('0x2')],'set':function(_0x79ed5f){this[_0x228f('0x5')](_0x228f('0x6'),_0x79ed5f?_0x79ed5f[_0x228f('0x7')](''):[]);},'get':function(){return this[_0x228f('0x8')]('crudPermissions')?this[_0x228f('0x8')]('crudPermissions')[_0x228f('0x9')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 010fb80..0a2d7ba 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 _0x1a1c=['filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','type','VIRTUAL','include','rows','catch','show','params','includeAll','options','create','body','update','find','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','reject','save','then','destroy','error','name','index','map','UserProfileSection','rawAttributes','model','query','keys'];(function(_0x1e10dd,_0x408021){var _0x364435=function(_0x140dab){while(--_0x140dab){_0x1e10dd['push'](_0x1e10dd['shift']());}};_0x364435(++_0x408021);}(_0x1a1c,0xa8));var _0xc1a1=function(_0x33de8b,_0x47856f){_0x33de8b=_0x33de8b-0x0;var _0x182144=_0x1a1c[_0x33de8b];return _0x182144;};'use strict';var emlformat=require(_0xc1a1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc1a1('0x1'));var jsonpatch=require(_0xc1a1('0x2'));var rp=require('request-promise');var moment=require(_0xc1a1('0x3'));var BPromise=require(_0xc1a1('0x4'));var Mustache=require(_0xc1a1('0x5'));var util=require(_0xc1a1('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xc1a1('0x7'));var ejs=require(_0xc1a1('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc1a1('0x9'));var squel=require(_0xc1a1('0xa'));var crypto=require(_0xc1a1('0xb'));var jsforce=require(_0xc1a1('0xc'));var deskjs=require(_0xc1a1('0xd'));var toCsv=require(_0xc1a1('0x7'));var querystring=require(_0xc1a1('0xe'));var Papa=require('papaparse');var Redis=require(_0xc1a1('0xf'));var authService=require(_0xc1a1('0x10'));var qs=require(_0xc1a1('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc1a1('0x12'));var logger=require(_0xc1a1('0x13'))(_0xc1a1('0x14'));var utils=require(_0xc1a1('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc1a1('0x16'))['db'];function respondWithStatusCode(_0x3360d1,_0x5937b8){_0x5937b8=_0x5937b8||0xcc;return function(_0x3b88fc){if(_0x3b88fc){return _0x3360d1[_0xc1a1('0x17')](_0x5937b8);}return _0x3360d1[_0xc1a1('0x18')](_0x5937b8)[_0xc1a1('0x19')]();};}function respondWithResult(_0x2cdadc,_0x4e1a6b){_0x4e1a6b=_0x4e1a6b||0xc8;return function(_0x388f7c){if(_0x388f7c){return _0x2cdadc[_0xc1a1('0x18')](_0x4e1a6b)['json'](_0x388f7c);}};}function respondWithFilteredResult(_0x4d8748,_0x18e753){return function(_0x1b8b6e){if(_0x1b8b6e){var _0x11a0a0=typeof _0x18e753[_0xc1a1('0x1a')]===_0xc1a1('0x1b')&&typeof _0x18e753[_0xc1a1('0x1c')]===_0xc1a1('0x1b');var _0x2c0e81=_0x1b8b6e['count'];var _0x447934=_0x11a0a0?0x0:_0x18e753[_0xc1a1('0x1a')];var _0x118031=_0x11a0a0?_0x1b8b6e[_0xc1a1('0x1d')]:_0x18e753[_0xc1a1('0x1a')]+_0x18e753[_0xc1a1('0x1c')];var _0x2c03c8;if(_0x118031>=_0x2c0e81){_0x118031=_0x2c0e81;_0x2c03c8=0xc8;}else{_0x2c03c8=0xce;}_0x4d8748[_0xc1a1('0x18')](_0x2c03c8);return _0x4d8748['set'](_0xc1a1('0x1e'),_0x447934+'-'+_0x118031+'/'+_0x2c0e81)[_0xc1a1('0x1f')](_0x1b8b6e);}return null;};}function patchUpdates(_0xfcf7b3){return function(_0x3b178c){try{jsonpatch['apply'](_0x3b178c,_0xfcf7b3,!![]);}catch(_0x488202){return BPromise[_0xc1a1('0x20')](_0x488202);}return _0x3b178c[_0xc1a1('0x21')]();};}function saveUpdates(_0x2a7173,_0x24565a){return function(_0x5d0472){if(_0x5d0472){return _0x5d0472['update'](_0x2a7173)[_0xc1a1('0x22')](function(_0x30fe85){return _0x30fe85;});}return null;};}function removeEntity(_0x1d2b5e,_0x524958){return function(_0x5580e3){if(_0x5580e3){return _0x5580e3[_0xc1a1('0x23')]()['then'](function(){_0x1d2b5e[_0xc1a1('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0xd6c940,_0x3e9814){return function(_0x5c04b7){if(!_0x5c04b7){_0xd6c940[_0xc1a1('0x17')](0x194);}return _0x5c04b7;};}function handleError(_0x4ca908,_0x15ddd3){_0x15ddd3=_0x15ddd3||0x1f4;return function(_0x52bb2a){logger[_0xc1a1('0x24')](_0x52bb2a['stack']);if(_0x52bb2a[_0xc1a1('0x25')]){delete _0x52bb2a[_0xc1a1('0x25')];}_0x4ca908['status'](_0x15ddd3)['send'](_0x52bb2a);};}exports[_0xc1a1('0x26')]=function(_0x21c0b6,_0x445f4a){var _0x14677a={},_0x4590c1={},_0x3f4f6f={'count':0x0,'rows':[]};var _0x22d3a6=_[_0xc1a1('0x27')](db[_0xc1a1('0x28')][_0xc1a1('0x29')],function(_0x2908b3){return{'name':_0x2908b3['fieldName'],'type':_0x2908b3['type']['key']};});_0x4590c1[_0xc1a1('0x2a')]=_[_0xc1a1('0x27')](_0x22d3a6,'name');_0x4590c1[_0xc1a1('0x2b')]=_[_0xc1a1('0x2c')](_0x21c0b6['query']);_0x4590c1[_0xc1a1('0x2d')]=_[_0xc1a1('0x2e')](_0x4590c1[_0xc1a1('0x2a')],_0x4590c1[_0xc1a1('0x2b')]);_0x14677a['attributes']=_[_0xc1a1('0x2e')](_0x4590c1[_0xc1a1('0x2a')],qs[_0xc1a1('0x2f')](_0x21c0b6['query']['fields']));_0x14677a['attributes']=_0x14677a[_0xc1a1('0x30')][_0xc1a1('0x31')]?_0x14677a['attributes']:_0x4590c1['model'];if(!_0x21c0b6[_0xc1a1('0x2b')][_0xc1a1('0x32')](_0xc1a1('0x33'))){_0x14677a[_0xc1a1('0x1c')]=qs[_0xc1a1('0x1c')](_0x21c0b6['query'][_0xc1a1('0x1c')]);_0x14677a['offset']=qs['offset'](_0x21c0b6[_0xc1a1('0x2b')][_0xc1a1('0x1a')]);}_0x14677a['order']=qs[_0xc1a1('0x34')](_0x21c0b6['query'][_0xc1a1('0x34')]);_0x14677a['where']=qs[_0xc1a1('0x2d')](_[_0xc1a1('0x35')](_0x21c0b6[_0xc1a1('0x2b')],_0x4590c1[_0xc1a1('0x2d')]),_0x22d3a6);if(_0x21c0b6[_0xc1a1('0x2b')][_0xc1a1('0x36')]){_0x14677a[_0xc1a1('0x37')]=_[_0xc1a1('0x38')](_0x14677a['where'],{'$or':_[_0xc1a1('0x27')](_0x22d3a6,function(_0x4088c2){if(_0x4088c2[_0xc1a1('0x39')]!==_0xc1a1('0x3a')){var _0xcf17a0={};_0xcf17a0[_0x4088c2[_0xc1a1('0x25')]]={'$like':'%'+_0x21c0b6['query'][_0xc1a1('0x36')]+'%'};return _0xcf17a0;}})});}_0x14677a=_[_0xc1a1('0x38')]({},_0x14677a,_0x21c0b6['options']);var _0xf0a220={'where':_0x14677a[_0xc1a1('0x37')]};return db['UserProfileSection'][_0xc1a1('0x1d')](_0xf0a220)['then'](function(_0xfa15af){_0x3f4f6f[_0xc1a1('0x1d')]=_0xfa15af;if(_0x21c0b6[_0xc1a1('0x2b')]['includeAll']){_0x14677a[_0xc1a1('0x3b')]=[{'all':!![]}];}return db[_0xc1a1('0x28')]['findAll'](_0x14677a);})[_0xc1a1('0x22')](function(_0x39b086){_0x3f4f6f[_0xc1a1('0x3c')]=_0x39b086;return _0x3f4f6f;})[_0xc1a1('0x22')](respondWithFilteredResult(_0x445f4a,_0x14677a))[_0xc1a1('0x3d')](handleError(_0x445f4a,null));};exports[_0xc1a1('0x3e')]=function(_0x32abc4,_0x578336){var _0x4b4b81={'raw':![],'where':{'id':_0x32abc4[_0xc1a1('0x3f')]['id']}},_0x11b96f={};_0x11b96f['model']=_[_0xc1a1('0x2c')](db[_0xc1a1('0x28')][_0xc1a1('0x29')]);_0x11b96f[_0xc1a1('0x2b')]=_[_0xc1a1('0x2c')](_0x32abc4[_0xc1a1('0x2b')]);_0x11b96f['filters']=_[_0xc1a1('0x2e')](_0x11b96f['model'],_0x11b96f[_0xc1a1('0x2b')]);_0x4b4b81[_0xc1a1('0x30')]=_[_0xc1a1('0x2e')](_0x11b96f[_0xc1a1('0x2a')],qs[_0xc1a1('0x2f')](_0x32abc4[_0xc1a1('0x2b')][_0xc1a1('0x2f')]));_0x4b4b81[_0xc1a1('0x30')]=_0x4b4b81[_0xc1a1('0x30')][_0xc1a1('0x31')]?_0x4b4b81[_0xc1a1('0x30')]:_0x11b96f[_0xc1a1('0x2a')];if(_0x32abc4[_0xc1a1('0x2b')][_0xc1a1('0x40')]){_0x4b4b81[_0xc1a1('0x3b')]=[{'all':!![]}];}_0x4b4b81=_[_0xc1a1('0x38')]({},_0x4b4b81,_0x32abc4[_0xc1a1('0x41')]);return db[_0xc1a1('0x28')]['find'](_0x4b4b81)[_0xc1a1('0x22')](handleEntityNotFound(_0x578336,null))['then'](respondWithResult(_0x578336,null))['catch'](handleError(_0x578336,null));};exports[_0xc1a1('0x42')]=function(_0x27f2e4,_0x221869){return db[_0xc1a1('0x28')][_0xc1a1('0x42')](_0x27f2e4[_0xc1a1('0x43')],{})[_0xc1a1('0x22')](respondWithResult(_0x221869,0xc9))[_0xc1a1('0x3d')](handleError(_0x221869,null));};exports[_0xc1a1('0x44')]=function(_0xd9bdb0,_0x256065){if(_0xd9bdb0[_0xc1a1('0x43')]['id']){delete _0xd9bdb0[_0xc1a1('0x43')]['id'];}return db[_0xc1a1('0x28')][_0xc1a1('0x45')]({'where':{'id':_0xd9bdb0['params']['id']}})[_0xc1a1('0x22')](handleEntityNotFound(_0x256065,null))[_0xc1a1('0x22')](saveUpdates(_0xd9bdb0[_0xc1a1('0x43')],null))['then'](respondWithResult(_0x256065,null))['catch'](handleError(_0x256065,null));};exports['destroy']=function(_0x2a9e11,_0x5acd9f){return db['UserProfileSection'][_0xc1a1('0x45')]({'where':{'id':_0x2a9e11[_0xc1a1('0x3f')]['id']}})[_0xc1a1('0x22')](handleEntityNotFound(_0x5acd9f,null))[_0xc1a1('0x22')](removeEntity(_0x5acd9f,null))[_0xc1a1('0x3d')](handleError(_0x5acd9f,null));};exports[_0xc1a1('0x46')]=function(_0x5f0b7e,_0x35300f){return db[_0xc1a1('0x28')]['describe']()[_0xc1a1('0x22')](respondWithResult(_0x35300f,null))[_0xc1a1('0x3d')](handleError(_0x35300f,null));}; \ No newline at end of file +var _0x8564=['squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','then','destroy','error','stack','name','index','UserProfileSection','rawAttributes','type','model','map','query','keys','filters','intersection','fields','attributes','length','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash'];(function(_0x4710f7,_0x1525a5){var _0x3634b5=function(_0x29a05a){while(--_0x29a05a){_0x4710f7['push'](_0x4710f7['shift']());}};_0x3634b5(++_0x1525a5);}(_0x8564,0x1ec));var _0x4856=function(_0x208289,_0x563c09){_0x208289=_0x208289-0x0;var _0x49ab3c=_0x8564[_0x208289];return _0x49ab3c;};'use strict';var emlformat=require(_0x4856('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4856('0x1'));var jsonpatch=require(_0x4856('0x2'));var rp=require(_0x4856('0x3'));var moment=require(_0x4856('0x4'));var BPromise=require(_0x4856('0x5'));var Mustache=require(_0x4856('0x6'));var util=require(_0x4856('0x7'));var path=require(_0x4856('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4856('0x9'));var fs=require('fs');var fs_extra=require(_0x4856('0xa'));var _=require(_0x4856('0xb'));var squel=require(_0x4856('0xc'));var crypto=require(_0x4856('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x4856('0xe'));var toCsv=require(_0x4856('0xf'));var querystring=require('querystring');var Papa=require(_0x4856('0x10'));var Redis=require(_0x4856('0x11'));var authService=require(_0x4856('0x12'));var qs=require(_0x4856('0x13'));var as=require(_0x4856('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4856('0x15'))('api');var utils=require(_0x4856('0x16'));var config=require(_0x4856('0x17'));var licenseUtil=require(_0x4856('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4f56ff,_0x52d321){_0x52d321=_0x52d321||0xcc;return function(_0x58ea88){if(_0x58ea88){return _0x4f56ff[_0x4856('0x19')](_0x52d321);}return _0x4f56ff[_0x4856('0x1a')](_0x52d321)[_0x4856('0x1b')]();};}function respondWithResult(_0x313d6f,_0x4fc10b){_0x4fc10b=_0x4fc10b||0xc8;return function(_0x4694f8){if(_0x4694f8){return _0x313d6f[_0x4856('0x1a')](_0x4fc10b)['json'](_0x4694f8);}};}function respondWithFilteredResult(_0x340783,_0x51f164){return function(_0x4ee151){if(_0x4ee151){var _0x4c5647=typeof _0x51f164[_0x4856('0x1c')]===_0x4856('0x1d')&&typeof _0x51f164[_0x4856('0x1e')]===_0x4856('0x1d');var _0xe367af=_0x4ee151[_0x4856('0x1f')];var _0x2af1de=_0x4c5647?0x0:_0x51f164[_0x4856('0x1c')];var _0x49598e=_0x4c5647?_0x4ee151[_0x4856('0x1f')]:_0x51f164[_0x4856('0x1c')]+_0x51f164['limit'];var _0xde125c;if(_0x49598e>=_0xe367af){_0x49598e=_0xe367af;_0xde125c=0xc8;}else{_0xde125c=0xce;}_0x340783[_0x4856('0x1a')](_0xde125c);return _0x340783[_0x4856('0x20')]('Content-Range',_0x2af1de+'-'+_0x49598e+'/'+_0xe367af)[_0x4856('0x21')](_0x4ee151);}return null;};}function patchUpdates(_0x4b8038){return function(_0x3112a1){try{jsonpatch[_0x4856('0x22')](_0x3112a1,_0x4b8038,!![]);}catch(_0x4f0946){return BPromise['reject'](_0x4f0946);}return _0x3112a1['save']();};}function saveUpdates(_0x2939ad,_0x5ed7d3){return function(_0x4fbb9a){if(_0x4fbb9a){return _0x4fbb9a['update'](_0x2939ad)[_0x4856('0x23')](function(_0x29fbf6){return _0x29fbf6;});}return null;};}function removeEntity(_0x5242d5,_0x55b6ad){return function(_0x34ac6a){if(_0x34ac6a){return _0x34ac6a[_0x4856('0x24')]()[_0x4856('0x23')](function(){_0x5242d5[_0x4856('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4bf26e,_0x481c26){return function(_0x239af8){if(!_0x239af8){_0x4bf26e['sendStatus'](0x194);}return _0x239af8;};}function handleError(_0x5cdd43,_0x37d18c){_0x37d18c=_0x37d18c||0x1f4;return function(_0x297a34){logger[_0x4856('0x25')](_0x297a34[_0x4856('0x26')]);if(_0x297a34[_0x4856('0x27')]){delete _0x297a34[_0x4856('0x27')];}_0x5cdd43[_0x4856('0x1a')](_0x37d18c)['send'](_0x297a34);};}exports[_0x4856('0x28')]=function(_0x45738f,_0xce8d2e){var _0x9fa204={},_0x219d21={},_0x4aa956={'count':0x0,'rows':[]};var _0x2f642d=_['map'](db[_0x4856('0x29')][_0x4856('0x2a')],function(_0xd22571){return{'name':_0xd22571['fieldName'],'type':_0xd22571[_0x4856('0x2b')]['key']};});_0x219d21[_0x4856('0x2c')]=_[_0x4856('0x2d')](_0x2f642d,_0x4856('0x27'));_0x219d21[_0x4856('0x2e')]=_[_0x4856('0x2f')](_0x45738f[_0x4856('0x2e')]);_0x219d21[_0x4856('0x30')]=_[_0x4856('0x31')](_0x219d21['model'],_0x219d21[_0x4856('0x2e')]);_0x9fa204['attributes']=_['intersection'](_0x219d21[_0x4856('0x2c')],qs[_0x4856('0x32')](_0x45738f[_0x4856('0x2e')]['fields']));_0x9fa204[_0x4856('0x33')]=_0x9fa204['attributes'][_0x4856('0x34')]?_0x9fa204[_0x4856('0x33')]:_0x219d21['model'];if(!_0x45738f['query']['hasOwnProperty']('nolimit')){_0x9fa204[_0x4856('0x1e')]=qs[_0x4856('0x1e')](_0x45738f[_0x4856('0x2e')][_0x4856('0x1e')]);_0x9fa204[_0x4856('0x1c')]=qs[_0x4856('0x1c')](_0x45738f[_0x4856('0x2e')][_0x4856('0x1c')]);}_0x9fa204[_0x4856('0x35')]=qs['sort'](_0x45738f['query'][_0x4856('0x36')]);_0x9fa204['where']=qs[_0x4856('0x30')](_[_0x4856('0x37')](_0x45738f['query'],_0x219d21[_0x4856('0x30')]),_0x2f642d);if(_0x45738f['query'][_0x4856('0x38')]){_0x9fa204[_0x4856('0x39')]=_['merge'](_0x9fa204[_0x4856('0x39')],{'$or':_['map'](_0x2f642d,function(_0x2b49a1){if(_0x2b49a1[_0x4856('0x2b')]!==_0x4856('0x3a')){var _0x213d66={};_0x213d66[_0x2b49a1[_0x4856('0x27')]]={'$like':'%'+_0x45738f[_0x4856('0x2e')][_0x4856('0x38')]+'%'};return _0x213d66;}})});}_0x9fa204=_[_0x4856('0x3b')]({},_0x9fa204,_0x45738f[_0x4856('0x3c')]);var _0x4568ab={'where':_0x9fa204['where']};return db[_0x4856('0x29')]['count'](_0x4568ab)[_0x4856('0x23')](function(_0x45323a){_0x4aa956[_0x4856('0x1f')]=_0x45323a;if(_0x45738f[_0x4856('0x2e')][_0x4856('0x3d')]){_0x9fa204[_0x4856('0x3e')]=[{'all':!![]}];}return db[_0x4856('0x29')][_0x4856('0x3f')](_0x9fa204);})[_0x4856('0x23')](function(_0x26f7cc){_0x4aa956[_0x4856('0x40')]=_0x26f7cc;return _0x4aa956;})[_0x4856('0x23')](respondWithFilteredResult(_0xce8d2e,_0x9fa204))[_0x4856('0x41')](handleError(_0xce8d2e,null));};exports[_0x4856('0x42')]=function(_0x4e86ba,_0x15a3c9){var _0x2bca6d={'raw':![],'where':{'id':_0x4e86ba['params']['id']}},_0x19c58e={};_0x19c58e[_0x4856('0x2c')]=_[_0x4856('0x2f')](db[_0x4856('0x29')]['rawAttributes']);_0x19c58e[_0x4856('0x2e')]=_[_0x4856('0x2f')](_0x4e86ba[_0x4856('0x2e')]);_0x19c58e[_0x4856('0x30')]=_['intersection'](_0x19c58e['model'],_0x19c58e['query']);_0x2bca6d[_0x4856('0x33')]=_[_0x4856('0x31')](_0x19c58e[_0x4856('0x2c')],qs['fields'](_0x4e86ba['query']['fields']));_0x2bca6d[_0x4856('0x33')]=_0x2bca6d[_0x4856('0x33')][_0x4856('0x34')]?_0x2bca6d['attributes']:_0x19c58e[_0x4856('0x2c')];if(_0x4e86ba[_0x4856('0x2e')][_0x4856('0x3d')]){_0x2bca6d[_0x4856('0x3e')]=[{'all':!![]}];}_0x2bca6d=_[_0x4856('0x3b')]({},_0x2bca6d,_0x4e86ba[_0x4856('0x3c')]);return db[_0x4856('0x29')][_0x4856('0x43')](_0x2bca6d)[_0x4856('0x23')](handleEntityNotFound(_0x15a3c9,null))['then'](respondWithResult(_0x15a3c9,null))[_0x4856('0x41')](handleError(_0x15a3c9,null));};exports[_0x4856('0x44')]=function(_0x406a1e,_0x567d8f){return db[_0x4856('0x29')]['create'](_0x406a1e[_0x4856('0x45')],{})[_0x4856('0x23')](respondWithResult(_0x567d8f,0xc9))[_0x4856('0x41')](handleError(_0x567d8f,null));};exports['update']=function(_0x4f84af,_0x2e750a){if(_0x4f84af['body']['id']){delete _0x4f84af[_0x4856('0x45')]['id'];}return db['UserProfileSection'][_0x4856('0x43')]({'where':{'id':_0x4f84af['params']['id']}})[_0x4856('0x23')](handleEntityNotFound(_0x2e750a,null))['then'](saveUpdates(_0x4f84af[_0x4856('0x45')],null))[_0x4856('0x23')](respondWithResult(_0x2e750a,null))['catch'](handleError(_0x2e750a,null));};exports[_0x4856('0x24')]=function(_0x24522f,_0x2c2a6c){return db['UserProfileSection'][_0x4856('0x43')]({'where':{'id':_0x24522f[_0x4856('0x46')]['id']}})[_0x4856('0x23')](handleEntityNotFound(_0x2c2a6c,null))[_0x4856('0x23')](removeEntity(_0x2c2a6c,null))[_0x4856('0x41')](handleError(_0x2c2a6c,null));};exports[_0x4856('0x47')]=function(_0x1d9de0,_0x3e364d){return db[_0x4856('0x29')][_0x4856('0x47')]()[_0x4856('0x23')](respondWithResult(_0x3e364d,null))[_0x4856('0x41')](handleError(_0x3e364d,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 043ea3f..3ad4146 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 _0x5abc=['request-promise','rimraf','./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections','compositeIndex','userProfileId','lodash','util','../../config/logger','moment','bluebird'];(function(_0x1846b8,_0x5e9fd2){var _0x5d29ea=function(_0x26ffc3){while(--_0x26ffc3){_0x1846b8['push'](_0x1846b8['shift']());}};_0x5d29ea(++_0x5e9fd2);}(_0x5abc,0x105));var _0xc5ab=function(_0x24da6d,_0x2ce103){_0x24da6d=_0x24da6d-0x0;var _0xd7ee93=_0x5abc[_0x24da6d];return _0xd7ee93;};'use strict';var _=require(_0xc5ab('0x0'));var util=require(_0xc5ab('0x1'));var logger=require(_0xc5ab('0x2'))('api');var moment=require(_0xc5ab('0x3'));var BPromise=require(_0xc5ab('0x4'));var rp=require(_0xc5ab('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc5ab('0x6'));var config=require('../../config/environment');var attributes=require(_0xc5ab('0x7'));module[_0xc5ab('0x8')]=function(_0x1e3ffa,_0x540ff7){return _0x1e3ffa[_0xc5ab('0x9')](_0xc5ab('0xa'),attributes,{'tableName':_0xc5ab('0xb'),'paranoid':![],'indexes':[{'name':_0xc5ab('0xc'),'fields':['sectionId',_0xc5ab('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa613=['path','rimraf','../../config/environment','./userProfileSection.attributes','exports','define','user_profile_has_sections','compositeIndex','sectionId','userProfileId','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x35361f,_0x1331ca){var _0x11ae90=function(_0x6b17e6){while(--_0x6b17e6){_0x35361f['push'](_0x35361f['shift']());}};_0x11ae90(++_0x1331ca);}(_0xa613,0x8a));var _0x3a61=function(_0x29d530,_0x5da0d7){_0x29d530=_0x29d530-0x0;var _0x242905=_0xa613[_0x29d530];return _0x242905;};'use strict';var _=require(_0x3a61('0x0'));var util=require('util');var logger=require(_0x3a61('0x1'))(_0x3a61('0x2'));var moment=require(_0x3a61('0x3'));var BPromise=require(_0x3a61('0x4'));var rp=require(_0x3a61('0x5'));var fs=require('fs');var path=require(_0x3a61('0x6'));var rimraf=require(_0x3a61('0x7'));var config=require(_0x3a61('0x8'));var attributes=require(_0x3a61('0x9'));module[_0x3a61('0xa')]=function(_0x50a744,_0x37904a){return _0x50a744[_0x3a61('0xb')]('UserProfileSection',attributes,{'tableName':_0x3a61('0xc'),'paranoid':![],'indexes':[{'name':_0x3a61('0xd'),'fields':[_0x3a61('0xe'),_0x3a61('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 6101e23..c7a6244 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 _0x18c4=['http','request','info','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','UserProfileSection,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client'];(function(_0x254939,_0x4ccf4b){var _0x3a40ce=function(_0x272967){while(--_0x272967){_0x254939['push'](_0x254939['shift']());}};_0x3a40ce(++_0x4ccf4b);}(_0x18c4,0xf3));var _0x418c=function(_0x1473d6,_0x3c0c6d){_0x1473d6=_0x1473d6-0x0;var _0x3d00b7=_0x18c4[_0x1473d6];return _0x3d00b7;};'use strict';var _=require(_0x418c('0x0'));var util=require(_0x418c('0x1'));var moment=require(_0x418c('0x2'));var BPromise=require('bluebird');var rs=require(_0x418c('0x3'));var fs=require('fs');var Redis=require(_0x418c('0x4'));var db=require(_0x418c('0x5'))['db'];var utils=require(_0x418c('0x6'));var logger=require(_0x418c('0x7'))(_0x418c('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x418c('0x9')][_0x418c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x49ad4f,_0x3a13a0,_0x4c7e27){return new BPromise(function(_0x5e15ec,_0x57e1f8){return client[_0x418c('0xb')](_0x49ad4f,_0x4c7e27)['then'](function(_0x55faf2){logger[_0x418c('0xc')]('UserProfileSection,\x20%s,\x20%s',_0x3a13a0,_0x418c('0xd'));logger[_0x418c('0xe')](_0x418c('0xf'),_0x3a13a0,_0x418c('0xd'),JSON[_0x418c('0x10')](_0x55faf2));if(_0x55faf2[_0x418c('0x11')]){if(_0x55faf2[_0x418c('0x11')][_0x418c('0x12')]===0x1f4){logger[_0x418c('0x11')](_0x418c('0x13'),_0x3a13a0,_0x55faf2[_0x418c('0x11')]['message']);return _0x57e1f8(_0x55faf2[_0x418c('0x11')][_0x418c('0x14')]);}logger[_0x418c('0x11')](_0x418c('0x13'),_0x3a13a0,_0x55faf2[_0x418c('0x11')][_0x418c('0x14')]);return _0x5e15ec(_0x55faf2['error']['message']);}else{logger[_0x418c('0xc')](_0x418c('0x13'),_0x3a13a0,'request\x20sent');_0x5e15ec(_0x55faf2[_0x418c('0x15')][_0x418c('0x14')]);}})[_0x418c('0x16')](function(_0x5b4bc5){logger[_0x418c('0x11')](_0x418c('0x13'),_0x3a13a0,_0x5b4bc5);_0x57e1f8(_0x5b4bc5);});});} \ No newline at end of file +var _0x9979=['moment','bluebird','randomstring','ioredis','../../config/utils','rpc','then','info','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','UserProfileSection,\x20%s,\x20%s','message','result','catch','lodash','util'];(function(_0x4f32de,_0x5bd4a){var _0x149821=function(_0x205885){while(--_0x205885){_0x4f32de['push'](_0x4f32de['shift']());}};_0x149821(++_0x5bd4a);}(_0x9979,0x166));var _0x9997=function(_0x486d65,_0x3b7523){_0x486d65=_0x486d65-0x0;var _0x49bd9f=_0x9979[_0x486d65];return _0x49bd9f;};'use strict';var _=require(_0x9997('0x0'));var util=require(_0x9997('0x1'));var moment=require(_0x9997('0x2'));var BPromise=require(_0x9997('0x3'));var rs=require(_0x9997('0x4'));var fs=require('fs');var Redis=require(_0x9997('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x9997('0x6'));var logger=require('../../config/logger')(_0x9997('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x121828,_0x173b9c,_0x1f2175){return new BPromise(function(_0x505d7a,_0x44feeb){return client['request'](_0x121828,_0x1f2175)[_0x9997('0x8')](function(_0x4a4283){logger[_0x9997('0x9')]('UserProfileSection,\x20%s,\x20%s',_0x173b9c,_0x9997('0xa'));logger[_0x9997('0xb')](_0x9997('0xc'),_0x173b9c,_0x9997('0xa'),JSON[_0x9997('0xd')](_0x4a4283));if(_0x4a4283[_0x9997('0xe')]){if(_0x4a4283['error'][_0x9997('0xf')]===0x1f4){logger[_0x9997('0xe')](_0x9997('0x10'),_0x173b9c,_0x4a4283[_0x9997('0xe')]['message']);return _0x44feeb(_0x4a4283[_0x9997('0xe')]['message']);}logger[_0x9997('0xe')](_0x9997('0x10'),_0x173b9c,_0x4a4283['error'][_0x9997('0x11')]);return _0x505d7a(_0x4a4283['error'][_0x9997('0x11')]);}else{logger['info'](_0x9997('0x10'),_0x173b9c,_0x9997('0xa'));_0x505d7a(_0x4a4283[_0x9997('0x12')][_0x9997('0x11')]);}})[_0x9997('0x13')](function(_0x1ea457){logger[_0x9997('0xe')](_0x9997('0x10'),_0x173b9c,_0x1ea457);_0x44feeb(_0x1ea457);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index db047bb..6466f54 100644 --- a/server/api/userSmsQueue/index.js +++ b/server/api/userSmsQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x1e327c,_0xa6c750){var _0x2c401f=function(_0x2b1ec3){while(--_0x2b1ec3){_0x1e327c['push'](_0x1e327c['shift']());}};_0x2c401f(++_0xa6c750);}(_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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x53f897,_0x539857){var _0x6879f8=function(_0xa3c36){while(--_0xa3c36){_0x53f897['push'](_0x53f897['shift']());}};_0x6879f8(++_0x539857);}(_0x9c44,0x178));var _0x49c4=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x9c44[_0x50a0c2];return _0x5ebadd;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index d614ed4..4ccb94f 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 _0x9ea2=['sequelize'];(function(_0x5192de,_0x4e91cd){var _0x4e287e=function(_0x3639bc){while(--_0x3639bc){_0x5192de['push'](_0x5192de['shift']());}};_0x4e287e(++_0x4e91cd);}(_0x9ea2,0x147));var _0x29ea=function(_0x5c0db5,_0x333544){_0x5c0db5=_0x5c0db5-0x0;var _0x41a243=_0x9ea2[_0x5c0db5];return _0x41a243;};'use strict';var Sequelize=require(_0x29ea('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xde23=['sequelize','exports'];(function(_0x3968b8,_0x96d622){var _0x6f38ec=function(_0x365229){while(--_0x365229){_0x3968b8['push'](_0x3968b8['shift']());}};_0x6f38ec(++_0x96d622);}(_0xde23,0xc0));var _0x3de2=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xde23[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x3de2('0x0'));module[_0x3de2('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 6de2df3..aa9ade5 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 _0xa498=['util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','UserSmsQueue'];(function(_0x55bdf3,_0x3a81b2){var _0x522f9a=function(_0x2a6e65){while(--_0x2a6e65){_0x55bdf3['push'](_0x55bdf3['shift']());}};_0x522f9a(++_0x3a81b2);}(_0xa498,0x1d6));var _0x8a49=function(_0x32b3c2,_0xe56fd){_0x32b3c2=_0x32b3c2-0x0;var _0x40a313=_0xa498[_0x32b3c2];return _0x40a313;};'use strict';var _=require('lodash');var util=require(_0x8a49('0x0'));var logger=require(_0x8a49('0x1'))('api');var moment=require('moment');var BPromise=require(_0x8a49('0x2'));var rp=require(_0x8a49('0x3'));var fs=require('fs');var path=require(_0x8a49('0x4'));var rimraf=require(_0x8a49('0x5'));var config=require(_0x8a49('0x6'));var attributes=require('./userSmsQueue.attributes');module[_0x8a49('0x7')]=function(_0x5c5df6,_0x366d5b){return _0x5c5df6[_0x8a49('0x8')](_0x8a49('0x9'),attributes,{'tableName':'user_has_sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb4b6=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','UserSmsQueue','user_has_sms_queues','util','../../config/logger','api','moment'];(function(_0x53429e,_0x435a4a){var _0x19a452=function(_0x1fbe2c){while(--_0x1fbe2c){_0x53429e['push'](_0x53429e['shift']());}};_0x19a452(++_0x435a4a);}(_0xb4b6,0x7e));var _0x6b4b=function(_0x45a2be,_0x320bc1){_0x45a2be=_0x45a2be-0x0;var _0x13e3fb=_0xb4b6[_0x45a2be];return _0x13e3fb;};'use strict';var _=require('lodash');var util=require(_0x6b4b('0x0'));var logger=require(_0x6b4b('0x1'))(_0x6b4b('0x2'));var moment=require(_0x6b4b('0x3'));var BPromise=require(_0x6b4b('0x4'));var rp=require(_0x6b4b('0x5'));var fs=require('fs');var path=require(_0x6b4b('0x6'));var rimraf=require(_0x6b4b('0x7'));var config=require(_0x6b4b('0x8'));var attributes=require('./userSmsQueue.attributes');module[_0x6b4b('0x9')]=function(_0x49e81c,_0x3915de){return _0x49e81c[_0x6b4b('0xa')](_0x6b4b('0xb'),attributes,{'tableName':_0x6b4b('0xc'),'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 c27262d..93b4120 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 _0x313d=['info','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserSmsQueue,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x5c4609,_0x57fb78){var _0x507834=function(_0x59326b){while(--_0x59326b){_0x5c4609['push'](_0x5c4609['shift']());}};_0x507834(++_0x57fb78);}(_0x313d,0xe3));var _0xd313=function(_0x72cf5c,_0xed7b26){_0x72cf5c=_0x72cf5c-0x0;var _0x47752f=_0x313d[_0x72cf5c];return _0x47752f;};'use strict';var _=require(_0xd313('0x0'));var util=require('util');var moment=require(_0xd313('0x1'));var BPromise=require(_0xd313('0x2'));var rs=require(_0xd313('0x3'));var fs=require('fs');var Redis=require(_0xd313('0x4'));var db=require(_0xd313('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd313('0x6'))(_0xd313('0x7'));var config=require(_0xd313('0x8'));var jayson=require(_0xd313('0x9'));var client=jayson[_0xd313('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4c8a05,_0x44b2ae,_0x2fbeb1){return new BPromise(function(_0x45debb,_0x1d9824){return client[_0xd313('0xb')](_0x4c8a05,_0x2fbeb1)[_0xd313('0xc')](function(_0x222b29){logger[_0xd313('0xd')]('UserSmsQueue,\x20%s,\x20%s',_0x44b2ae,_0xd313('0xe'));logger[_0xd313('0xf')](_0xd313('0x10'),_0x44b2ae,_0xd313('0xe'),JSON[_0xd313('0x11')](_0x222b29));if(_0x222b29[_0xd313('0x12')]){if(_0x222b29[_0xd313('0x12')][_0xd313('0x13')]===0x1f4){logger[_0xd313('0x12')](_0xd313('0x14'),_0x44b2ae,_0x222b29[_0xd313('0x12')]['message']);return _0x1d9824(_0x222b29[_0xd313('0x12')][_0xd313('0x15')]);}logger[_0xd313('0x12')]('UserSmsQueue,\x20%s,\x20%s',_0x44b2ae,_0x222b29[_0xd313('0x12')]['message']);return _0x45debb(_0x222b29[_0xd313('0x12')][_0xd313('0x15')]);}else{logger['info'](_0xd313('0x14'),_0x44b2ae,'request\x20sent');_0x45debb(_0x222b29[_0xd313('0x16')][_0xd313('0x15')]);}})[_0xd313('0x17')](function(_0x1b8eda){logger[_0xd313('0x12')](_0xd313('0x14'),_0x44b2ae,_0x1b8eda);_0x1d9824(_0x1b8eda);});});} \ No newline at end of file +var _0xb4ff=['UserSmsQueue,\x20%s,\x20%s','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x41c9d3,_0x2dc329){var _0x4e5c7b=function(_0x4eb2a8){while(--_0x4eb2a8){_0x41c9d3['push'](_0x41c9d3['shift']());}};_0x4e5c7b(++_0x2dc329);}(_0xb4ff,0x1d1));var _0xfb4f=function(_0x22add5,_0x1a3b9e){_0x22add5=_0x22add5-0x0;var _0x5b2233=_0xb4ff[_0x22add5];return _0x5b2233;};'use strict';var _=require('lodash');var util=require(_0xfb4f('0x0'));var moment=require(_0xfb4f('0x1'));var BPromise=require('bluebird');var rs=require(_0xfb4f('0x2'));var fs=require('fs');var Redis=require(_0xfb4f('0x3'));var db=require(_0xfb4f('0x4'))['db'];var utils=require(_0xfb4f('0x5'));var logger=require(_0xfb4f('0x6'))('rpc');var config=require(_0xfb4f('0x7'));var jayson=require(_0xfb4f('0x8'));var client=jayson['client'][_0xfb4f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x181164,_0x2d3972,_0x2c2dff){return new BPromise(function(_0x2a1533,_0x4dd4fb){return client[_0xfb4f('0xa')](_0x181164,_0x2c2dff)['then'](function(_0x2677f7){logger[_0xfb4f('0xb')]('UserSmsQueue,\x20%s,\x20%s',_0x2d3972,_0xfb4f('0xc'));logger[_0xfb4f('0xd')](_0xfb4f('0xe'),_0x2d3972,_0xfb4f('0xc'),JSON[_0xfb4f('0xf')](_0x2677f7));if(_0x2677f7[_0xfb4f('0x10')]){if(_0x2677f7[_0xfb4f('0x10')][_0xfb4f('0x11')]===0x1f4){logger[_0xfb4f('0x10')]('UserSmsQueue,\x20%s,\x20%s',_0x2d3972,_0x2677f7[_0xfb4f('0x10')][_0xfb4f('0x12')]);return _0x4dd4fb(_0x2677f7[_0xfb4f('0x10')][_0xfb4f('0x12')]);}logger[_0xfb4f('0x10')](_0xfb4f('0x13'),_0x2d3972,_0x2677f7[_0xfb4f('0x10')][_0xfb4f('0x12')]);return _0x2a1533(_0x2677f7['error'][_0xfb4f('0x12')]);}else{logger[_0xfb4f('0xb')](_0xfb4f('0x13'),_0x2d3972,_0xfb4f('0xc'));_0x2a1533(_0x2677f7[_0xfb4f('0x14')][_0xfb4f('0x12')]);}})[_0xfb4f('0x15')](function(_0x38a534){logger['error'](_0xfb4f('0x13'),_0x2d3972,_0x38a534);_0x4dd4fb(_0x38a534);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 3bbf581..d4f33fa 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 _0xebdd=['INTEGER','sequelize','exports'];(function(_0x44039a,_0x2ac8a8){var _0x525de5=function(_0x1dc635){while(--_0x1dc635){_0x44039a['push'](_0x44039a['shift']());}};_0x525de5(++_0x2ac8a8);}(_0xebdd,0x19f));var _0xdebd=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xebdd[_0x32d457];return _0x338386;};'use strict';var Sequelize=require(_0xdebd('0x0'));module[_0xdebd('0x1')]={'UserId':{'type':Sequelize[_0xdebd('0x2')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x841d=['sequelize','exports','INTEGER'];(function(_0x3f478a,_0x4899ef){var _0x45b715=function(_0x15b715){while(--_0x15b715){_0x3f478a['push'](_0x3f478a['shift']());}};_0x45b715(++_0x4899ef);}(_0x841d,0x17a));var _0xd841=function(_0x3f2f4d,_0x4f7e72){_0x3f2f4d=_0x3f2f4d-0x0;var _0x11bedd=_0x841d[_0x3f2f4d];return _0x11bedd;};'use strict';var Sequelize=require(_0xd841('0x0'));module[_0xd841('0x1')]={'UserId':{'type':Sequelize[_0xd841('0x2')]},'VoicePrefixId':{'type':Sequelize[_0xd841('0x2')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 88bd037..b77886e 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(_0x4acc37,_0x21da63){var _0x22e2d0=function(_0x3d1a39){while(--_0x3d1a39){_0x4acc37['push'](_0x4acc37['shift']());}};_0x22e2d0(++_0x21da63);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0xa9e0[_0x1b828b];return _0x98da1a;};'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(_0x58e431,_0x17582b){var _0x180d77=function(_0x14e479){while(--_0x14e479){_0x58e431['push'](_0x58e431['shift']());}};_0x180d77(++_0x17582b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 eb6cec5..24de30a 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x34421e,_0xf309a2){var _0x5725d7=function(_0x367fbf){while(--_0x367fbf){_0x34421e['push'](_0x34421e['shift']());}};_0x5725d7(++_0xf309a2);}(_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 +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x515ae8,_0x2a964f){var _0x4cf66a=function(_0x8d6d43){while(--_0x8d6d43){_0x515ae8['push'](_0x515ae8['shift']());}};_0x4cf66a(++_0x2a964f);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index d39354a..d0536e9 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 _0x46d2=['sequelize','exports','INTEGER'];(function(_0xfb0cfd,_0x500179){var _0x2fd8aa=function(_0xccb501){while(--_0xccb501){_0xfb0cfd['push'](_0xfb0cfd['shift']());}};_0x2fd8aa(++_0x500179);}(_0x46d2,0x19e));var _0x246d=function(_0x44d3ae,_0x25d67b){_0x44d3ae=_0x44d3ae-0x0;var _0x55c8ec=_0x46d2[_0x44d3ae];return _0x55c8ec;};'use strict';var Sequelize=require(_0x246d('0x0'));module[_0x246d('0x1')]={'penalty':{'type':Sequelize[_0x246d('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3ec2=['INTEGER','sequelize'];(function(_0x295c45,_0x372b88){var _0x456410=function(_0x1fc893){while(--_0x1fc893){_0x295c45['push'](_0x295c45['shift']());}};_0x456410(++_0x372b88);}(_0x3ec2,0x19b));var _0x23ec=function(_0x473582,_0x139c3c){_0x473582=_0x473582-0x0;var _0x48feb7=_0x3ec2[_0x473582];return _0x48feb7;};'use strict';var Sequelize=require(_0x23ec('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x23ec('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index f2d23ba..f844d24 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 _0x9200=['util','../../config/logger','moment','bluebird','request-promise','../../config/environment','./userVoiceQueue.attributes','define','UserVoiceQueue','user_has_voice_queues','lodash'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x9200,0x11d));var _0x0920=function(_0xaca245,_0x1b5a54){_0xaca245=_0xaca245-0x0;var _0x292dce=_0x9200[_0xaca245];return _0x292dce;};'use strict';var _=require(_0x0920('0x0'));var util=require(_0x0920('0x1'));var logger=require(_0x0920('0x2'))('api');var moment=require(_0x0920('0x3'));var BPromise=require(_0x0920('0x4'));var rp=require(_0x0920('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x0920('0x6'));var attributes=require(_0x0920('0x7'));module['exports']=function(_0x252c26,_0x51d965){return _0x252c26[_0x0920('0x8')](_0x0920('0x9'),attributes,{'tableName':_0x0920('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1685=['path','rimraf','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x365e49,_0x50589d){var _0x484047=function(_0x3c7cb3){while(--_0x3c7cb3){_0x365e49['push'](_0x365e49['shift']());}};_0x484047(++_0x50589d);}(_0x1685,0x18c));var _0x5168=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x1685[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x5168('0x0'));var util=require(_0x5168('0x1'));var logger=require(_0x5168('0x2'))(_0x5168('0x3'));var moment=require(_0x5168('0x4'));var BPromise=require(_0x5168('0x5'));var rp=require(_0x5168('0x6'));var fs=require('fs');var path=require(_0x5168('0x7'));var rimraf=require(_0x5168('0x8'));var config=require('../../config/environment');var attributes=require(_0x5168('0x9'));module[_0x5168('0xa')]=function(_0x8d4b73,_0x20abce){return _0x8d4b73[_0x5168('0xb')](_0x5168('0xc'),attributes,{'tableName':'user_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index 89dd0a2..8e62ad0 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 _0xbd57=['error','message','request\x20sent','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','UserVoiceQueue,\x20%s,\x20%s','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x19cbac,_0x4a7597){var _0x180da3=function(_0x219c1a){while(--_0x219c1a){_0x19cbac['push'](_0x19cbac['shift']());}};_0x180da3(++_0x4a7597);}(_0xbd57,0x164));var _0x7bd5=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xbd57[_0x465028];return _0xb783d4;};'use strict';var _=require(_0x7bd5('0x0'));var util=require(_0x7bd5('0x1'));var moment=require(_0x7bd5('0x2'));var BPromise=require(_0x7bd5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7bd5('0x4'));var db=require(_0x7bd5('0x5'))['db'];var utils=require(_0x7bd5('0x6'));var logger=require(_0x7bd5('0x7'))(_0x7bd5('0x8'));var config=require(_0x7bd5('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7bd5('0xa')][_0x7bd5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xd0eb0d,_0x53940f,_0x2e9077){return new BPromise(function(_0x29ec74,_0x8f143d){return client[_0x7bd5('0xc')](_0xd0eb0d,_0x2e9077)[_0x7bd5('0xd')](function(_0x1bd53e){logger[_0x7bd5('0xe')](_0x7bd5('0xf'),_0x53940f,'request\x20sent');logger['debug'](_0x7bd5('0x10'),_0x53940f,'request\x20sent',JSON[_0x7bd5('0x11')](_0x1bd53e));if(_0x1bd53e[_0x7bd5('0x12')]){if(_0x1bd53e['error']['code']===0x1f4){logger[_0x7bd5('0x12')](_0x7bd5('0xf'),_0x53940f,_0x1bd53e[_0x7bd5('0x12')]['message']);return _0x8f143d(_0x1bd53e[_0x7bd5('0x12')][_0x7bd5('0x13')]);}logger[_0x7bd5('0x12')](_0x7bd5('0xf'),_0x53940f,_0x1bd53e['error'][_0x7bd5('0x13')]);return _0x29ec74(_0x1bd53e[_0x7bd5('0x12')][_0x7bd5('0x13')]);}else{logger[_0x7bd5('0xe')](_0x7bd5('0xf'),_0x53940f,_0x7bd5('0x14'));_0x29ec74(_0x1bd53e['result'][_0x7bd5('0x13')]);}})[_0x7bd5('0x15')](function(_0xcd1612){logger['error'](_0x7bd5('0xf'),_0x53940f,_0xcd1612);_0x8f143d(_0xcd1612);});});} \ No newline at end of file +var _0xa9f2=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util'];(function(_0x286a0e,_0x47eef8){var _0x16a7ac=function(_0x2dd05a){while(--_0x2dd05a){_0x286a0e['push'](_0x286a0e['shift']());}};_0x16a7ac(++_0x47eef8);}(_0xa9f2,0x11e));var _0x2a9f=function(_0xdbfd3c,_0x52bbba){_0xdbfd3c=_0xdbfd3c-0x0;var _0x5674dc=_0xa9f2[_0xdbfd3c];return _0x5674dc;};'use strict';var _=require(_0x2a9f('0x0'));var util=require(_0x2a9f('0x1'));var moment=require(_0x2a9f('0x2'));var BPromise=require(_0x2a9f('0x3'));var rs=require(_0x2a9f('0x4'));var fs=require('fs');var Redis=require(_0x2a9f('0x5'));var db=require(_0x2a9f('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x2a9f('0x7'))(_0x2a9f('0x8'));var config=require(_0x2a9f('0x9'));var jayson=require(_0x2a9f('0xa'));var client=jayson[_0x2a9f('0xb')][_0x2a9f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x85371e,_0x25761f,_0x597d43){return new BPromise(function(_0x62a380,_0x2b5d68){return client[_0x2a9f('0xd')](_0x85371e,_0x597d43)[_0x2a9f('0xe')](function(_0x763e57){logger[_0x2a9f('0xf')](_0x2a9f('0x10'),_0x25761f,_0x2a9f('0x11'));logger[_0x2a9f('0x12')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x25761f,_0x2a9f('0x11'),JSON[_0x2a9f('0x13')](_0x763e57));if(_0x763e57['error']){if(_0x763e57[_0x2a9f('0x14')]['code']===0x1f4){logger[_0x2a9f('0x14')](_0x2a9f('0x10'),_0x25761f,_0x763e57[_0x2a9f('0x14')][_0x2a9f('0x15')]);return _0x2b5d68(_0x763e57[_0x2a9f('0x14')][_0x2a9f('0x15')]);}logger[_0x2a9f('0x14')](_0x2a9f('0x10'),_0x25761f,_0x763e57[_0x2a9f('0x14')][_0x2a9f('0x15')]);return _0x62a380(_0x763e57[_0x2a9f('0x14')]['message']);}else{logger[_0x2a9f('0xf')](_0x2a9f('0x10'),_0x25761f,_0x2a9f('0x11'));_0x62a380(_0x763e57[_0x2a9f('0x16')][_0x2a9f('0x15')]);}})[_0x2a9f('0x17')](function(_0x5ae5f6){logger[_0x2a9f('0x14')](_0x2a9f('0x10'),_0x25761f,_0x5ae5f6);_0x2b5d68(_0x5ae5f6);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index eb2ab56..f8c2015 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(_0x1fde64,_0x39769a){var _0x53b5bb=function(_0x565852){while(--_0x565852){_0x1fde64['push'](_0x1fde64['shift']());}};_0x53b5bb(++_0x39769a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xa9e0[_0x49ca18];return _0x145d54;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x502e30,_0x4c7867){var _0x2fbbac=function(_0x4bc8d6){while(--_0x4bc8d6){_0x502e30['push'](_0x502e30['shift']());}};_0x2fbbac(++_0x4c7867);}(_0x70e0,0x17b));var _0x070e=function(_0x43c9e8,_0x3edc5e){_0x43c9e8=_0x43c9e8-0x0;var _0x4eeed4=_0x70e0[_0x43c9e8];return _0x4eeed4;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 160bb6a..f38b73f 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 _0xdd12=['sequelize','exports','Required\x20by\x20Asterisk','STRING','INTEGER','queue_interface'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xdd12,0xf6));var _0x2dd1=function(_0x32d275,_0x207593){_0x32d275=_0x32d275-0x0;var _0x51665d=_0xdd12[_0x32d275];return _0x51665d;};'use strict';var Sequelize=require(_0x2dd1('0x0'));module[_0x2dd1('0x1')]={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':_0x2dd1('0x2')},'membername':{'type':Sequelize[_0x2dd1('0x3')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize[_0x2dd1('0x4')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x2dd1('0x3')],'allowNull':![],'unique':'queue_interface','comment':_0x2dd1('0x2')},'VoiceQueueId':{'type':Sequelize[_0x2dd1('0x4')],'allowNull':![]},'interface':{'type':Sequelize[_0x2dd1('0x3')],'allowNull':![],'unique':_0x2dd1('0x5'),'comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize[_0x2dd1('0x4')](0xb),'defaultValue':0x0,'comment':_0x2dd1('0x2')},'paused':{'type':Sequelize[_0x2dd1('0x4')](0xb),'defaultValue':0x0,'comment':_0x2dd1('0x2')}}; \ No newline at end of file +var _0x01a9=['INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface','sequelize','exports'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x01a9,0xee));var _0x901a=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0x01a9[_0x49b207];return _0x2dc8fa;};'use strict';var Sequelize=require(_0x901a('0x0'));module[_0x901a('0x1')]={'uniqueid':{'type':Sequelize[_0x901a('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x901a('0x3')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':_0x901a('0x3')},'UserId':{'type':Sequelize[_0x901a('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x901a('0x4')],'allowNull':![],'unique':_0x901a('0x5'),'comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize[_0x901a('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0x901a('0x4')],'allowNull':![],'unique':_0x901a('0x5'),'comment':_0x901a('0x3')},'penalty':{'type':Sequelize[_0x901a('0x2')](0xb),'defaultValue':0x0,'comment':_0x901a('0x3')},'paused':{'type':Sequelize[_0x901a('0x2')](0xb),'defaultValue':0x0,'comment':_0x901a('0x3')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index cfde38e..ffdd110 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 _0x198e=['events','../../mysqldb','setMaxListeners','save','remove','emit','hasOwnProperty','exports'];(function(_0x4c1313,_0x153b90){var _0x29195a=function(_0x106841){while(--_0x106841){_0x4c1313['push'](_0x4c1313['shift']());}};_0x29195a(++_0x153b90);}(_0x198e,0x1a0));var _0xe198=function(_0x33eb1a,_0x5a7d04){_0x33eb1a=_0x33eb1a-0x0;var _0x1e6365=_0x198e[_0x33eb1a];return _0x1e6365;};'use strict';var EventEmitter=require(_0xe198('0x0'));var UserVoiceQueueRt=require(_0xe198('0x1'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xe198('0x2')](0x0);var events={'afterCreate':_0xe198('0x3'),'afterUpdate':'update','afterDestroy':_0xe198('0x4')};function emitEvent(_0x4a562b){return function(_0x296ce6,_0x209553,_0x4b8aed){UserVoiceQueueRtEvents[_0xe198('0x5')](_0x4a562b+':'+_0x296ce6['id'],_0x296ce6);UserVoiceQueueRtEvents[_0xe198('0x5')](_0x4a562b,_0x296ce6);_0x4b8aed(null);};}for(var e in events){if(events[_0xe198('0x6')](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module[_0xe198('0x7')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x9616=['UserVoiceQueueRt','save','update','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0xf0e88c,_0x353416){var _0x8d5d7d=function(_0xa9ef95){while(--_0xa9ef95){_0xf0e88c['push'](_0xf0e88c['shift']());}};_0x8d5d7d(++_0x353416);}(_0x9616,0x18e));var _0x6961=function(_0x12723c,_0x148a5a){_0x12723c=_0x12723c-0x0;var _0x3fc804=_0x9616[_0x12723c];return _0x3fc804;};'use strict';var EventEmitter=require(_0x6961('0x0'));var UserVoiceQueueRt=require(_0x6961('0x1'))['db'][_0x6961('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6961('0x3'),'afterUpdate':_0x6961('0x4'),'afterDestroy':'remove'};function emitEvent(_0x271c34){return function(_0x5895e9,_0x475072,_0x45073b){UserVoiceQueueRtEvents[_0x6961('0x5')](_0x271c34+':'+_0x5895e9['id'],_0x5895e9);UserVoiceQueueRtEvents[_0x6961('0x5')](_0x271c34,_0x5895e9);_0x45073b(null);};}for(var e in events){if(events[_0x6961('0x6')](e)){var event=events[e];UserVoiceQueueRt[_0x6961('0x7')](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 7bf8aa7..a4746f3 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 _0xc047=['rimraf','../../config/environment','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0xc047,0xc9));var _0x7c04=function(_0x5039ed,_0x1a0806){_0x5039ed=_0x5039ed-0x0;var _0x241f03=_0xc047[_0x5039ed];return _0x241f03;};'use strict';var _=require(_0x7c04('0x0'));var util=require(_0x7c04('0x1'));var logger=require(_0x7c04('0x2'))(_0x7c04('0x3'));var moment=require(_0x7c04('0x4'));var BPromise=require(_0x7c04('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7c04('0x6'));var rimraf=require(_0x7c04('0x7'));var config=require(_0x7c04('0x8'));var attributes=require('./userVoiceQueueRt.attributes');module[_0x7c04('0x9')]=function(_0x2389d2,_0xf0523a){return _0x2389d2[_0x7c04('0xa')](_0x7c04('0xb'),attributes,{'tableName':_0x7c04('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5208=['exports','define','UserVoiceQueueRt','user_has_voice_queues_rt','util','api','moment','rimraf','../../config/environment','./userVoiceQueueRt.attributes'];(function(_0x14dc65,_0x22f931){var _0x4d95d7=function(_0x5b4e30){while(--_0x5b4e30){_0x14dc65['push'](_0x14dc65['shift']());}};_0x4d95d7(++_0x22f931);}(_0x5208,0xc2));var _0x8520=function(_0x483ab9,_0x419148){_0x483ab9=_0x483ab9-0x0;var _0x35043b=_0x5208[_0x483ab9];return _0x35043b;};'use strict';var _=require('lodash');var util=require(_0x8520('0x0'));var logger=require('../../config/logger')(_0x8520('0x1'));var moment=require(_0x8520('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8520('0x3'));var config=require(_0x8520('0x4'));var attributes=require(_0x8520('0x5'));module[_0x8520('0x6')]=function(_0x41a20a,_0x8518da){return _0x41a20a[_0x8520('0x7')](_0x8520('0x8'),attributes,{'tableName':_0x8520('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index 75064de..4a8ae53 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 _0x271f=['outboundQueuePauses','lodash','util','moment','ioredis','../../mysqldb','rpc','../../config/environment','http','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','then','info','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','UserVoiceQueueRt,\x20%s,\x20%s','message','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','where','sequelize','literal','`paused`\x20=\x201,\x201,\x20null'];(function(_0x19b66c,_0x580235){var _0x51eb96=function(_0x56e3a3){while(--_0x56e3a3){_0x19b66c['push'](_0x19b66c['shift']());}};_0x51eb96(++_0x580235);}(_0x271f,0xe8));var _0xf271=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x271f[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0xf271('0x0'));var util=require(_0xf271('0x1'));var moment=require(_0xf271('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf271('0x3'));var db=require(_0xf271('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf271('0x5'));var config=require(_0xf271('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf271('0x7')]({'port':0x232a});config['redis']=_[_0xf271('0x8')](config['redis'],{'host':_0xf271('0x9'),'port':0x18eb});var socket=require(_0xf271('0xa'))(new Redis(config['redis']));require(_0xf271('0xb'))[_0xf271('0xc')](socket);function respondWithRpcPromise(_0xd25e37,_0x32429d,_0x51b1b1){return new BPromise(function(_0x4f010a,_0x1f07b9){return client['request'](_0xd25e37,_0x51b1b1)[_0xf271('0xd')](function(_0x4ad2c9){logger[_0xf271('0xe')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x32429d,_0xf271('0xf'));logger[_0xf271('0x10')](_0xf271('0x11'),_0x32429d,_0xf271('0xf'),JSON[_0xf271('0x12')](_0x4ad2c9));if(_0x4ad2c9[_0xf271('0x13')]){if(_0x4ad2c9[_0xf271('0x13')][_0xf271('0x14')]===0x1f4){logger[_0xf271('0x13')](_0xf271('0x15'),_0x32429d,_0x4ad2c9['error']['message']);return _0x1f07b9(_0x4ad2c9[_0xf271('0x13')][_0xf271('0x16')]);}logger['error'](_0xf271('0x15'),_0x32429d,_0x4ad2c9[_0xf271('0x13')][_0xf271('0x16')]);return _0x4f010a(_0x4ad2c9[_0xf271('0x13')][_0xf271('0x16')]);}else{logger[_0xf271('0xe')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x32429d,_0xf271('0xf'));_0x4f010a(_0x4ad2c9['result']['message']);}})[_0xf271('0x17')](function(_0x51ddc8){logger[_0xf271('0x13')](_0xf271('0x15'),_0x32429d,_0x51ddc8);_0x1f07b9(_0x51ddc8);});});}exports[_0xf271('0x18')]=function(_0x521419){var _0x5c0223=this;return new Promise(function(_0x2283ae,_0x493a6a){return db[_0xf271('0x19')][_0xf271('0x1a')]({'raw':_0x521419[_0xf271('0x1b')]?_0x521419[_0xf271('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x521419['options']?_0x521419[_0xf271('0x1b')][_0xf271('0x1c')]||null:null,'attributes':[[db[_0xf271('0x1d')]['fn']('COUNT',db[_0xf271('0x1d')]['fn']('IF',db['sequelize'][_0xf271('0x1e')](_0xf271('0x1f')))),_0xf271('0x20')]]})[_0xf271('0xd')](function(_0x515907){logger[_0xf271('0xe')](_0xf271('0x18'),_0x521419);logger[_0xf271('0x10')](_0xf271('0x18'),_0x521419,JSON['stringify'](_0x515907));_0x2283ae(_0x515907);})[_0xf271('0x17')](function(_0x4b3b45){logger[_0xf271('0x13')](_0xf271('0x18'),_0x4b3b45[_0xf271('0x16')],_0x521419);_0x493a6a(_0x5c0223[_0xf271('0x13')](0x1f4,_0x4b3b45[_0xf271('0x16')]));});});}; \ No newline at end of file +var _0xaf6b=['rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./userVoiceQueueRt.socket','register','request','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','sequelize','literal','outboundQueuePauses','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x4c5465,_0x41ad78){var _0x5985f6=function(_0x488601){while(--_0x488601){_0x4c5465['push'](_0x4c5465['shift']());}};_0x5985f6(++_0x41ad78);}(_0xaf6b,0xfc));var _0xbaf6=function(_0x11cc41,_0x4e28b2){_0x11cc41=_0x11cc41-0x0;var _0x224557=_0xaf6b[_0x11cc41];return _0x224557;};'use strict';var _=require('lodash');var util=require(_0xbaf6('0x0'));var moment=require(_0xbaf6('0x1'));var BPromise=require(_0xbaf6('0x2'));var rs=require(_0xbaf6('0x3'));var fs=require('fs');var Redis=require(_0xbaf6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbaf6('0x5'));var logger=require(_0xbaf6('0x6'))(_0xbaf6('0x7'));var config=require(_0xbaf6('0x8'));var jayson=require(_0xbaf6('0x9'));var client=jayson[_0xbaf6('0xa')][_0xbaf6('0xb')]({'port':0x232a});config[_0xbaf6('0xc')]=_[_0xbaf6('0xd')](config[_0xbaf6('0xc')],{'host':_0xbaf6('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbaf6('0xc')]));require(_0xbaf6('0xf'))[_0xbaf6('0x10')](socket);function respondWithRpcPromise(_0x5d7936,_0x4551d5,_0x15f76c){return new BPromise(function(_0x4287fb,_0x450bdc){return client[_0xbaf6('0x11')](_0x5d7936,_0x15f76c)['then'](function(_0x36bb8f){logger[_0xbaf6('0x12')](_0xbaf6('0x13'),_0x4551d5,_0xbaf6('0x14'));logger[_0xbaf6('0x15')](_0xbaf6('0x16'),_0x4551d5,_0xbaf6('0x14'),JSON[_0xbaf6('0x17')](_0x36bb8f));if(_0x36bb8f[_0xbaf6('0x18')]){if(_0x36bb8f[_0xbaf6('0x18')][_0xbaf6('0x19')]===0x1f4){logger[_0xbaf6('0x18')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x4551d5,_0x36bb8f[_0xbaf6('0x18')][_0xbaf6('0x1a')]);return _0x450bdc(_0x36bb8f[_0xbaf6('0x18')][_0xbaf6('0x1a')]);}logger[_0xbaf6('0x18')](_0xbaf6('0x13'),_0x4551d5,_0x36bb8f[_0xbaf6('0x18')][_0xbaf6('0x1a')]);return _0x4287fb(_0x36bb8f[_0xbaf6('0x18')]['message']);}else{logger['info'](_0xbaf6('0x13'),_0x4551d5,_0xbaf6('0x14'));_0x4287fb(_0x36bb8f[_0xbaf6('0x1b')][_0xbaf6('0x1a')]);}})['catch'](function(_0x24ece7){logger[_0xbaf6('0x18')](_0xbaf6('0x13'),_0x4551d5,_0x24ece7);_0x450bdc(_0x24ece7);});});}exports[_0xbaf6('0x1c')]=function(_0x4e8c32){var _0x3d9618=this;return new Promise(function(_0x4f78ab,_0x33d5a3){return db[_0xbaf6('0x1d')][_0xbaf6('0x1e')]({'raw':_0x4e8c32[_0xbaf6('0x1f')]?_0x4e8c32['options'][_0xbaf6('0x20')]===undefined?!![]:![]:!![],'where':_0x4e8c32['options']?_0x4e8c32[_0xbaf6('0x1f')]['where']||null:null,'attributes':[[db[_0xbaf6('0x21')]['fn']('COUNT',db[_0xbaf6('0x21')]['fn']('IF',db[_0xbaf6('0x21')][_0xbaf6('0x22')]('`paused`\x20=\x201,\x201,\x20null'))),_0xbaf6('0x23')]]})['then'](function(_0x4dc84a){logger['info'](_0xbaf6('0x1c'),_0x4e8c32);logger[_0xbaf6('0x15')](_0xbaf6('0x1c'),_0x4e8c32,JSON[_0xbaf6('0x17')](_0x4dc84a));_0x4f78ab(_0x4dc84a);})[_0xbaf6('0x24')](function(_0x4a46e6){logger['error']('GetVoiceQueueRtPauses',_0x4a46e6[_0xbaf6('0x1a')],_0x4e8c32);_0x33d5a3(_0x3d9618[_0xbaf6('0x18')](0x1f4,_0x4a46e6[_0xbaf6('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 97bb07f..b37e632 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 _0x814b=['removeListener','register','length','userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove','update','emit'];(function(_0x2a55f8,_0x540ac4){var _0x245efd=function(_0x4dbc19){while(--_0x4dbc19){_0x2a55f8['push'](_0x2a55f8['shift']());}};_0x245efd(++_0x540ac4);}(_0x814b,0x1a2));var _0xb814=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x814b[_0x13d07a];return _0x5ee0ee;};'use strict';var UserVoiceQueueRtEvents=require(_0xb814('0x0'));var events=[_0xb814('0x1'),_0xb814('0x2'),_0xb814('0x3')];function createListener(_0xfbb64b,_0x477725){return function(_0x4a98af){_0x477725[_0xb814('0x4')](_0xfbb64b,_0x4a98af);};}function removeListener(_0x3e1e9,_0x258866){return function(){UserVoiceQueueRtEvents[_0xb814('0x5')](_0x3e1e9,_0x258866);};}exports[_0xb814('0x6')]=function(_0x322a70){for(var _0x53e507=0x0,_0x3b0829=events[_0xb814('0x7')];_0x53e507<_0x3b0829;_0x53e507++){var _0x5c8539=events[_0x53e507];var _0x271af9=createListener(_0xb814('0x8')+_0x5c8539,_0x322a70);UserVoiceQueueRtEvents['on'](_0x5c8539,_0x271af9);}}; \ No newline at end of file +var _0x5655=['./userVoiceQueueRt.events','save','remove','update','removeListener','register','userVoiceQueueRt:'];(function(_0x3374e1,_0x157766){var _0x577393=function(_0x4418e6){while(--_0x4418e6){_0x3374e1['push'](_0x3374e1['shift']());}};_0x577393(++_0x157766);}(_0x5655,0x15e));var _0x5565=function(_0x35121d,_0x2109fd){_0x35121d=_0x35121d-0x0;var _0x1c9e42=_0x5655[_0x35121d];return _0x1c9e42;};'use strict';var UserVoiceQueueRtEvents=require(_0x5565('0x0'));var events=[_0x5565('0x1'),_0x5565('0x2'),_0x5565('0x3')];function createListener(_0x42be35,_0x243782){return function(_0x5b1b44){_0x243782['emit'](_0x42be35,_0x5b1b44);};}function removeListener(_0x307c01,_0x58e4f5){return function(){UserVoiceQueueRtEvents[_0x5565('0x4')](_0x307c01,_0x58e4f5);};}exports[_0x5565('0x5')]=function(_0x37954f){for(var _0x93a8e5=0x0,_0x106d59=events['length'];_0x93a8e5<_0x106d59;_0x93a8e5++){var _0xc88d42=events[_0x93a8e5];var _0x2980c9=createListener(_0x5565('0x6')+_0xc88d42,_0x37954f);UserVoiceQueueRtEvents['on'](_0xc88d42,_0x2980c9);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 815a0df..05ef085 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0xcd9ece,_0x33ff67){var _0x36f54f=function(_0x54ec76){while(--_0x54ec76){_0xcd9ece['push'](_0xcd9ece['shift']());}};_0x36f54f(++_0x33ff67);}(_0x9c44,0x178));var _0x49c4=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x9c44[_0x13e741];return _0x3f8bb3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x347cde,_0x1522c2){var _0x3b9863=function(_0x28e04a){while(--_0x28e04a){_0x347cde['push'](_0x347cde['shift']());}};_0x3b9863(++_0x1522c2);}(_0x70e0,0x17b));var _0x070e=function(_0x191276,_0x378503){_0x191276=_0x191276-0x0;var _0x402c8f=_0x70e0[_0x191276];return _0x402c8f;};'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/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index aef168d..d259614 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 _0x0737=['INTEGER','sequelize'];(function(_0x51edf1,_0x3d3a71){var _0x93394a=function(_0x204824){while(--_0x204824){_0x51edf1['push'](_0x51edf1['shift']());}};_0x93394a(++_0x3d3a71);}(_0x0737,0x18d));var _0x7073=function(_0x3cec80,_0x275f2a){_0x3cec80=_0x3cec80-0x0;var _0x32ad56=_0x0737[_0x3cec80];return _0x32ad56;};'use strict';var Sequelize=require(_0x7073('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x7073('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x9123=['INTEGER','exports'];(function(_0x2d9be9,_0x139190){var _0x33b96a=function(_0x546132){while(--_0x546132){_0x2d9be9['push'](_0x2d9be9['shift']());}};_0x33b96a(++_0x139190);}(_0x9123,0x119));var _0x3912=function(_0x2c1ee8,_0x47e4c7){_0x2c1ee8=_0x2c1ee8-0x0;var _0x3141b3=_0x9123[_0x2c1ee8];return _0x3141b3;};'use strict';var Sequelize=require('sequelize');module[_0x3912('0x0')]={'penalty':{'type':Sequelize[_0x3912('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index 6bb4c11..90f768e 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 _0x9a12=['../../config/logger','moment','bluebird','path','./userWhatsappQueue.attributes','define','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util'];(function(_0x46f216,_0x5e4824){var _0x1f1920=function(_0x2f44a3){while(--_0x2f44a3){_0x46f216['push'](_0x46f216['shift']());}};_0x1f1920(++_0x5e4824);}(_0x9a12,0xbc));var _0x29a1=function(_0x4f72ad,_0x4274d4){_0x4f72ad=_0x4f72ad-0x0;var _0x2347b3=_0x9a12[_0x4f72ad];return _0x2347b3;};'use strict';var _=require(_0x29a1('0x0'));var util=require(_0x29a1('0x1'));var logger=require(_0x29a1('0x2'))('api');var moment=require(_0x29a1('0x3'));var BPromise=require(_0x29a1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x29a1('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x29a1('0x6'));module['exports']=function(_0x1d3701,_0x5b1a75){return _0x1d3701[_0x29a1('0x7')](_0x29a1('0x8'),attributes,{'tableName':_0x29a1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4a03=['user_has_whatsapp_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','define'];(function(_0x2f3d29,_0x150e7b){var _0x53d69d=function(_0x45f6ec){while(--_0x45f6ec){_0x2f3d29['push'](_0x2f3d29['shift']());}};_0x53d69d(++_0x150e7b);}(_0x4a03,0x69));var _0x34a0=function(_0x90ceda,_0x43ef42){_0x90ceda=_0x90ceda-0x0;var _0x591123=_0x4a03[_0x90ceda];return _0x591123;};'use strict';var _=require(_0x34a0('0x0'));var util=require(_0x34a0('0x1'));var logger=require(_0x34a0('0x2'))(_0x34a0('0x3'));var moment=require(_0x34a0('0x4'));var BPromise=require(_0x34a0('0x5'));var rp=require(_0x34a0('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x34a0('0x7'));var config=require(_0x34a0('0x8'));var attributes=require(_0x34a0('0x9'));module[_0x34a0('0xa')]=function(_0x7cf17b,_0x31cb43){return _0x7cf17b[_0x34a0('0xb')]('UserWhatsappQueue',attributes,{'tableName':_0x34a0('0xc'),'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 b2b8bb7..3a938e8 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 _0x9035=['UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x200703,_0x4cccfd){var _0x5a32dc=function(_0x4a4835){while(--_0x4a4835){_0x200703['push'](_0x200703['shift']());}};_0x5a32dc(++_0x4cccfd);}(_0x9035,0x193));var _0x5903=function(_0x880b41,_0x38904c){_0x880b41=_0x880b41-0x0;var _0x31560a=_0x9035[_0x880b41];return _0x31560a;};'use strict';var _=require('lodash');var util=require(_0x5903('0x0'));var moment=require(_0x5903('0x1'));var BPromise=require(_0x5903('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5903('0x3'));var db=require(_0x5903('0x4'))['db'];var utils=require(_0x5903('0x5'));var logger=require(_0x5903('0x6'))(_0x5903('0x7'));var config=require(_0x5903('0x8'));var jayson=require(_0x5903('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x488287,_0x145b82,_0x4e4619){return new BPromise(function(_0x307cf5,_0x1c2cfd){return client[_0x5903('0xa')](_0x488287,_0x4e4619)['then'](function(_0x35ce52){logger[_0x5903('0xb')](_0x5903('0xc'),_0x145b82,_0x5903('0xd'));logger[_0x5903('0xe')](_0x5903('0xf'),_0x145b82,_0x5903('0xd'),JSON[_0x5903('0x10')](_0x35ce52));if(_0x35ce52[_0x5903('0x11')]){if(_0x35ce52[_0x5903('0x11')][_0x5903('0x12')]===0x1f4){logger[_0x5903('0x11')](_0x5903('0xc'),_0x145b82,_0x35ce52[_0x5903('0x11')][_0x5903('0x13')]);return _0x1c2cfd(_0x35ce52[_0x5903('0x11')][_0x5903('0x13')]);}logger[_0x5903('0x11')](_0x5903('0xc'),_0x145b82,_0x35ce52[_0x5903('0x11')][_0x5903('0x13')]);return _0x307cf5(_0x35ce52[_0x5903('0x11')][_0x5903('0x13')]);}else{logger[_0x5903('0xb')](_0x5903('0xc'),_0x145b82,_0x5903('0xd'));_0x307cf5(_0x35ce52[_0x5903('0x14')]['message']);}})[_0x5903('0x15')](function(_0x2be993){logger[_0x5903('0x11')]('UserWhatsappQueue,\x20%s,\x20%s',_0x145b82,_0x2be993);_0x1c2cfd(_0x2be993);});});} \ No newline at end of file +var _0x4ea2=['jayson/promise','client','http','request','then','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','code','error','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x2f95c5,_0x3c552b){var _0xdbd47b=function(_0x3284d8){while(--_0x3284d8){_0x2f95c5['push'](_0x2f95c5['shift']());}};_0xdbd47b(++_0x3c552b);}(_0x4ea2,0xf4));var _0x24ea=function(_0x590a38,_0x2bc65c){_0x590a38=_0x590a38-0x0;var _0xf36626=_0x4ea2[_0x590a38];return _0xf36626;};'use strict';var _=require(_0x24ea('0x0'));var util=require('util');var moment=require(_0x24ea('0x1'));var BPromise=require('bluebird');var rs=require(_0x24ea('0x2'));var fs=require('fs');var Redis=require(_0x24ea('0x3'));var db=require(_0x24ea('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x24ea('0x5'))(_0x24ea('0x6'));var config=require(_0x24ea('0x7'));var jayson=require(_0x24ea('0x8'));var client=jayson[_0x24ea('0x9')][_0x24ea('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2a4ac2,_0x2d8cbe,_0x4ada30){return new BPromise(function(_0xddad09,_0x3508c4){return client[_0x24ea('0xb')](_0x2a4ac2,_0x4ada30)[_0x24ea('0xc')](function(_0x366a74){logger['info'](_0x24ea('0xd'),_0x2d8cbe,_0x24ea('0xe'));logger[_0x24ea('0xf')]('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0x2d8cbe,_0x24ea('0xe'),JSON['stringify'](_0x366a74));if(_0x366a74['error']){if(_0x366a74['error'][_0x24ea('0x10')]===0x1f4){logger[_0x24ea('0x11')](_0x24ea('0xd'),_0x2d8cbe,_0x366a74[_0x24ea('0x11')][_0x24ea('0x12')]);return _0x3508c4(_0x366a74[_0x24ea('0x11')][_0x24ea('0x12')]);}logger[_0x24ea('0x11')](_0x24ea('0xd'),_0x2d8cbe,_0x366a74['error'][_0x24ea('0x12')]);return _0xddad09(_0x366a74[_0x24ea('0x11')]['message']);}else{logger['info'](_0x24ea('0xd'),_0x2d8cbe,_0x24ea('0xe'));_0xddad09(_0x366a74[_0x24ea('0x13')][_0x24ea('0x12')]);}})[_0x24ea('0x14')](function(_0x294b3f){logger[_0x24ea('0x11')]('UserWhatsappQueue,\x20%s,\x20%s',_0x2d8cbe,_0x294b3f);_0x3508c4(_0x294b3f);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 7b3728a..15fea68 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 _0x54f3=['post','create','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./variable.controller','index','/:id','isAuthenticated','show'];(function(_0x2f9d59,_0x1eb328){var _0x52381c=function(_0x328f26){while(--_0x328f26){_0x2f9d59['push'](_0x2f9d59['shift']());}};_0x52381c(++_0x1eb328);}(_0x54f3,0x120));var _0x354f=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x54f3[_0x8c43de];return _0xa6591b;};'use strict';var multer=require('multer');var util=require(_0x354f('0x0'));var path=require(_0x354f('0x1'));var timeout=require(_0x354f('0x2'));var express=require(_0x354f('0x3'));var router=express[_0x354f('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x354f('0x5'));var config=require(_0x354f('0x6'));var controller=require(_0x354f('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x354f('0x8')]);router['get'](_0x354f('0x9'),auth[_0x354f('0xa')](),controller[_0x354f('0xb')]);router[_0x354f('0xc')]('/',auth['isAuthenticated'](),controller[_0x354f('0xd')]);router['put'](_0x354f('0x9'),auth[_0x354f('0xa')](),controller['update']);router['delete'](_0x354f('0x9'),auth[_0x354f('0xa')](),controller['destroy']);module[_0x354f('0xe')]=router; \ No newline at end of file +var _0x2b37=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','post','create','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x2bcd1f,_0x4f1972){var _0x2381ca=function(_0x51f935){while(--_0x51f935){_0x2bcd1f['push'](_0x2bcd1f['shift']());}};_0x2381ca(++_0x4f1972);}(_0x2b37,0x12b));var _0x72b3=function(_0x4c94b6,_0x41357a){_0x4c94b6=_0x4c94b6-0x0;var _0x200324=_0x2b37[_0x4c94b6];return _0x200324;};'use strict';var multer=require(_0x72b3('0x0'));var util=require(_0x72b3('0x1'));var path=require(_0x72b3('0x2'));var timeout=require(_0x72b3('0x3'));var express=require(_0x72b3('0x4'));var router=express[_0x72b3('0x5')]();var fs_extra=require(_0x72b3('0x6'));var auth=require(_0x72b3('0x7'));var interaction=require(_0x72b3('0x8'));var config=require(_0x72b3('0x9'));var controller=require('./variable.controller');router[_0x72b3('0xa')]('/',auth[_0x72b3('0xb')](),controller['index']);router[_0x72b3('0xa')](_0x72b3('0xc'),auth[_0x72b3('0xb')](),controller['show']);router[_0x72b3('0xd')]('/',auth[_0x72b3('0xb')](),controller[_0x72b3('0xe')]);router['put'](_0x72b3('0xc'),auth[_0x72b3('0xb')](),controller[_0x72b3('0xf')]);router[_0x72b3('0x10')](_0x72b3('0xc'),auth[_0x72b3('0xb')](),controller[_0x72b3('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 7fe84db..12c97d5 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 _0x4689=['sequelize','exports','STRING'];(function(_0x2d871e,_0xd14b61){var _0x41dd7b=function(_0x3e69f0){while(--_0x3e69f0){_0x2d871e['push'](_0x2d871e['shift']());}};_0x41dd7b(++_0xd14b61);}(_0x4689,0x108));var _0x9468=function(_0x4381d3,_0x1b187c){_0x4381d3=_0x4381d3-0x0;var _0x311b79=_0x4689[_0x4381d3];return _0x311b79;};'use strict';var Sequelize=require(_0x9468('0x0'));module[_0x9468('0x1')]={'name':{'type':Sequelize[_0x9468('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x9468('0x2')]}}; \ No newline at end of file +var _0x869a=['sequelize'];(function(_0x38dd96,_0x2fe4eb){var _0x3c6d0e=function(_0x10fd62){while(--_0x10fd62){_0x38dd96['push'](_0x38dd96['shift']());}};_0x3c6d0e(++_0x2fe4eb);}(_0x869a,0x1f4));var _0xa869=function(_0xecbc3f,_0x422271){_0xecbc3f=_0xecbc3f-0x0;var _0x52232d=_0x869a[_0xecbc3f];return _0x52232d;};'use strict';var Sequelize=require(_0xa869('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','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 2a12458..0a1dca7 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 _0x14d9=['sendStatus','status','json','limit','undefined','count','offset','set','Content-Range','reject','save','then','destroy','get','Variables','UserProfileResource','error','stack','name','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','Variable','includeAll','include','findAll','show','options','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','params','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','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x4b4918,_0x37aa6d){var _0xcdf16f=function(_0x23de13){while(--_0x23de13){_0x4b4918['push'](_0x4b4918['shift']());}};_0xcdf16f(++_0x37aa6d);}(_0x14d9,0x1d3));var _0x914d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x14d9[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x914d('0x0'));var rimraf=require(_0x914d('0x1'));var zipdir=require(_0x914d('0x2'));var jsonpatch=require(_0x914d('0x3'));var rp=require(_0x914d('0x4'));var moment=require(_0x914d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x914d('0x6'));var util=require(_0x914d('0x7'));var path=require(_0x914d('0x8'));var sox=require(_0x914d('0x9'));var csv=require(_0x914d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x914d('0xb'));var squel=require(_0x914d('0xc'));var crypto=require(_0x914d('0xd'));var jsforce=require(_0x914d('0xe'));var deskjs=require(_0x914d('0xf'));var toCsv=require(_0x914d('0xa'));var querystring=require(_0x914d('0x10'));var Papa=require(_0x914d('0x11'));var Redis=require('ioredis');var authService=require(_0x914d('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x914d('0x13'));var hardwareService=require(_0x914d('0x14'));var logger=require('../../config/logger')(_0x914d('0x15'));var utils=require(_0x914d('0x16'));var config=require(_0x914d('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x914d('0x18'))['db'];function respondWithStatusCode(_0x5700d3,_0x382ee0){_0x382ee0=_0x382ee0||0xcc;return function(_0x56550c){if(_0x56550c){return _0x5700d3[_0x914d('0x19')](_0x382ee0);}return _0x5700d3[_0x914d('0x1a')](_0x382ee0)['end']();};}function respondWithResult(_0x235f94,_0x530eda){_0x530eda=_0x530eda||0xc8;return function(_0x5bf5c1){if(_0x5bf5c1){return _0x235f94[_0x914d('0x1a')](_0x530eda)[_0x914d('0x1b')](_0x5bf5c1);}};}function respondWithFilteredResult(_0x298d96,_0x414ab9){return function(_0x18a789){if(_0x18a789){var _0x95973d=typeof _0x414ab9['offset']==='undefined'&&typeof _0x414ab9[_0x914d('0x1c')]===_0x914d('0x1d');var _0x1e25bb=_0x18a789[_0x914d('0x1e')];var _0xcdd751=_0x95973d?0x0:_0x414ab9['offset'];var _0x5562a7=_0x95973d?_0x18a789[_0x914d('0x1e')]:_0x414ab9[_0x914d('0x1f')]+_0x414ab9[_0x914d('0x1c')];var _0x5f5d15;if(_0x5562a7>=_0x1e25bb){_0x5562a7=_0x1e25bb;_0x5f5d15=0xc8;}else{_0x5f5d15=0xce;}_0x298d96['status'](_0x5f5d15);return _0x298d96[_0x914d('0x20')](_0x914d('0x21'),_0xcdd751+'-'+_0x5562a7+'/'+_0x1e25bb)[_0x914d('0x1b')](_0x18a789);}return null;};}function patchUpdates(_0x38d3ed){return function(_0x9cbe88){try{jsonpatch['apply'](_0x9cbe88,_0x38d3ed,!![]);}catch(_0x38daeb){return BPromise[_0x914d('0x22')](_0x38daeb);}return _0x9cbe88[_0x914d('0x23')]();};}function saveUpdates(_0x157d93,_0x31c038){return function(_0x2b33c3){if(_0x2b33c3){return _0x2b33c3['update'](_0x157d93)[_0x914d('0x24')](function(_0x1b8408){return _0x1b8408;});}return null;};}function removeEntity(_0x52f094,_0x13e79b){return function(_0x8e48a4){if(_0x8e48a4){return _0x8e48a4[_0x914d('0x25')]()[_0x914d('0x24')](function(){var _0x5e1b56=_0x8e48a4[_0x914d('0x26')]({'plain':!![]});var _0xed8295=_0x914d('0x27');return db[_0x914d('0x28')]['destroy']({'where':{'type':_0xed8295,'resourceId':_0x5e1b56['id']}})[_0x914d('0x24')](function(){return _0x8e48a4;});})[_0x914d('0x24')](function(){_0x52f094[_0x914d('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ed93a,_0x460ed9){return function(_0x15642){if(!_0x15642){_0x2ed93a[_0x914d('0x19')](0x194);}return _0x15642;};}function handleError(_0x772a4f,_0x41061a){_0x41061a=_0x41061a||0x1f4;return function(_0x5590f5){logger[_0x914d('0x29')](_0x5590f5[_0x914d('0x2a')]);if(_0x5590f5[_0x914d('0x2b')]){delete _0x5590f5[_0x914d('0x2b')];}_0x772a4f[_0x914d('0x1a')](_0x41061a)['send'](_0x5590f5);};}exports['index']=function(_0x125f83,_0x27cac2){var _0x7411d5={},_0x5e9eb5={},_0x6b30cb={'count':0x0,'rows':[]};var _0x1af053=_[_0x914d('0x2c')](db['Variable'][_0x914d('0x2d')],function(_0x4ed3c3){return{'name':_0x4ed3c3[_0x914d('0x2e')],'type':_0x4ed3c3[_0x914d('0x2f')][_0x914d('0x30')]};});_0x5e9eb5[_0x914d('0x31')]=_[_0x914d('0x2c')](_0x1af053,_0x914d('0x2b'));_0x5e9eb5[_0x914d('0x32')]=_[_0x914d('0x33')](_0x125f83[_0x914d('0x32')]);_0x5e9eb5['filters']=_[_0x914d('0x34')](_0x5e9eb5[_0x914d('0x31')],_0x5e9eb5['query']);_0x7411d5[_0x914d('0x35')]=_[_0x914d('0x34')](_0x5e9eb5[_0x914d('0x31')],qs[_0x914d('0x36')](_0x125f83['query']['fields']));_0x7411d5[_0x914d('0x35')]=_0x7411d5['attributes']['length']?_0x7411d5[_0x914d('0x35')]:_0x5e9eb5[_0x914d('0x31')];if(!_0x125f83[_0x914d('0x32')][_0x914d('0x37')](_0x914d('0x38'))){_0x7411d5[_0x914d('0x1c')]=qs['limit'](_0x125f83[_0x914d('0x32')][_0x914d('0x1c')]);_0x7411d5[_0x914d('0x1f')]=qs[_0x914d('0x1f')](_0x125f83[_0x914d('0x32')][_0x914d('0x1f')]);}_0x7411d5[_0x914d('0x39')]=qs[_0x914d('0x3a')](_0x125f83['query']['sort']);_0x7411d5[_0x914d('0x3b')]=qs['filters'](_[_0x914d('0x3c')](_0x125f83['query'],_0x5e9eb5[_0x914d('0x3d')]),_0x1af053);if(_0x125f83[_0x914d('0x32')][_0x914d('0x3e')]){_0x7411d5[_0x914d('0x3b')]=_[_0x914d('0x3f')](_0x7411d5[_0x914d('0x3b')],{'$or':_[_0x914d('0x2c')](_0x1af053,function(_0xf0b1cb){if(_0xf0b1cb[_0x914d('0x2f')]!==_0x914d('0x40')){var _0x1fbb99={};_0x1fbb99[_0xf0b1cb[_0x914d('0x2b')]]={'$like':'%'+_0x125f83[_0x914d('0x32')][_0x914d('0x3e')]+'%'};return _0x1fbb99;}})});}_0x7411d5=_[_0x914d('0x3f')]({},_0x7411d5,_0x125f83['options']);var _0x59d284={'where':_0x7411d5['where']};return db[_0x914d('0x41')][_0x914d('0x1e')](_0x59d284)[_0x914d('0x24')](function(_0x1891d6){_0x6b30cb[_0x914d('0x1e')]=_0x1891d6;if(_0x125f83['query'][_0x914d('0x42')]){_0x7411d5[_0x914d('0x43')]=[{'all':!![]}];}return db[_0x914d('0x41')][_0x914d('0x44')](_0x7411d5);})['then'](function(_0x3f2395){_0x6b30cb['rows']=_0x3f2395;return _0x6b30cb;})[_0x914d('0x24')](respondWithFilteredResult(_0x27cac2,_0x7411d5))['catch'](handleError(_0x27cac2,null));};exports[_0x914d('0x45')]=function(_0x24ac36,_0x52a503){var _0x561660={'raw':!![],'where':{'id':_0x24ac36['params']['id']}},_0x52028c={};_0x52028c[_0x914d('0x31')]=_['keys'](db[_0x914d('0x41')]['rawAttributes']);_0x52028c[_0x914d('0x32')]=_['keys'](_0x24ac36[_0x914d('0x32')]);_0x52028c['filters']=_[_0x914d('0x34')](_0x52028c[_0x914d('0x31')],_0x52028c[_0x914d('0x32')]);_0x561660[_0x914d('0x35')]=_[_0x914d('0x34')](_0x52028c['model'],qs[_0x914d('0x36')](_0x24ac36[_0x914d('0x32')][_0x914d('0x36')]));_0x561660[_0x914d('0x35')]=_0x561660[_0x914d('0x35')]['length']?_0x561660[_0x914d('0x35')]:_0x52028c[_0x914d('0x31')];if(_0x24ac36[_0x914d('0x32')]['includeAll']){_0x561660[_0x914d('0x43')]=[{'all':!![]}];}_0x561660=_[_0x914d('0x3f')]({},_0x561660,_0x24ac36[_0x914d('0x46')]);return db['Variable'][_0x914d('0x47')](_0x561660)[_0x914d('0x24')](handleEntityNotFound(_0x52a503,null))['then'](respondWithResult(_0x52a503,null))['catch'](handleError(_0x52a503,null));};exports['create']=function(_0x5495b5,_0x297794){return db['Variable'][_0x914d('0x48')](_0x5495b5[_0x914d('0x49')],{})[_0x914d('0x24')](function(_0x3ae842){var _0x25838b=_0x5495b5[_0x914d('0x4a')][_0x914d('0x26')]({'plain':!![]});if(!_0x25838b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x25838b[_0x914d('0x4b')]===_0x914d('0x4a')){var _0x707660=_0x3ae842['get']({'plain':!![]});var _0x4f77ac=_0x914d('0x27');return db[_0x914d('0x4c')][_0x914d('0x47')]({'where':{'name':_0x4f77ac,'userProfileId':_0x25838b[_0x914d('0x4d')]},'raw':!![]})['then'](function(_0xcd40da){if(_0xcd40da&&_0xcd40da[_0x914d('0x4e')]===0x0){return db[_0x914d('0x28')][_0x914d('0x48')]({'name':_0x707660['name'],'resourceId':_0x707660['id'],'type':_0xcd40da['name'],'sectionId':_0xcd40da['id']},{})[_0x914d('0x24')](function(){return _0x3ae842;});}else{return _0x3ae842;}})['catch'](function(_0xfa2c42){logger['error'](_0x914d('0x4f'),_0xfa2c42);throw _0xfa2c42;});}return _0x3ae842;})[_0x914d('0x24')](respondWithResult(_0x297794,0xc9))[_0x914d('0x50')](handleError(_0x297794,null));};exports['update']=function(_0x225bb2,_0x1e1900){if(_0x225bb2[_0x914d('0x49')]['id']){delete _0x225bb2[_0x914d('0x49')]['id'];}return db[_0x914d('0x41')]['find']({'where':{'id':_0x225bb2[_0x914d('0x51')]['id']}})['then'](handleEntityNotFound(_0x1e1900,null))['then'](saveUpdates(_0x225bb2[_0x914d('0x49')],null))[_0x914d('0x24')](respondWithResult(_0x1e1900,null))[_0x914d('0x50')](handleError(_0x1e1900,null));};exports[_0x914d('0x25')]=function(_0x3906cd,_0x7d7f4b){return db['Variable'][_0x914d('0x47')]({'where':{'id':_0x3906cd[_0x914d('0x51')]['id']}})[_0x914d('0x24')](handleEntityNotFound(_0x7d7f4b,null))['then'](removeEntity(_0x7d7f4b,null))[_0x914d('0x50')](handleError(_0x7d7f4b,null));}; \ No newline at end of file +var _0xf40f=['apply','reject','update','then','destroy','get','Variables','UserProfileResource','name','send','map','Variable','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','keys','rawAttributes','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','request-promise','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','offset','count','set'];(function(_0x254b22,_0x27159f){var _0x1279db=function(_0x3ca06f){while(--_0x3ca06f){_0x254b22['push'](_0x254b22['shift']());}};_0x1279db(++_0x27159f);}(_0xf40f,0x1a5));var _0xff40=function(_0x39d259,_0x3af080){_0x39d259=_0x39d259-0x0;var _0x4a2dea=_0xf40f[_0x39d259];return _0x4a2dea;};'use strict';var emlformat=require(_0xff40('0x0'));var rimraf=require(_0xff40('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xff40('0x2'));var moment=require('moment');var BPromise=require(_0xff40('0x3'));var Mustache=require('mustache');var util=require(_0xff40('0x4'));var path=require(_0xff40('0x5'));var sox=require(_0xff40('0x6'));var csv=require(_0xff40('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xff40('0x8'));var _=require(_0xff40('0x9'));var squel=require(_0xff40('0xa'));var crypto=require('crypto');var jsforce=require(_0xff40('0xb'));var deskjs=require(_0xff40('0xc'));var toCsv=require(_0xff40('0x7'));var querystring=require(_0xff40('0xd'));var Papa=require('papaparse');var Redis=require(_0xff40('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xff40('0xf'));var hardwareService=require(_0xff40('0x10'));var logger=require(_0xff40('0x11'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xff40('0x12'));var db=require(_0xff40('0x13'))['db'];function respondWithStatusCode(_0x9f559a,_0x1da851){_0x1da851=_0x1da851||0xcc;return function(_0x5c67c7){if(_0x5c67c7){return _0x9f559a[_0xff40('0x14')](_0x1da851);}return _0x9f559a[_0xff40('0x15')](_0x1da851)[_0xff40('0x16')]();};}function respondWithResult(_0x41dc2e,_0x53bf9b){_0x53bf9b=_0x53bf9b||0xc8;return function(_0x465c28){if(_0x465c28){return _0x41dc2e[_0xff40('0x15')](_0x53bf9b)[_0xff40('0x17')](_0x465c28);}};}function respondWithFilteredResult(_0x6c0047,_0x1d14e6){return function(_0x230681){if(_0x230681){var _0x4f3af4=typeof _0x1d14e6['offset']==='undefined'&&typeof _0x1d14e6[_0xff40('0x18')]===_0xff40('0x19');var _0x347b36=_0x230681['count'];var _0x37158c=_0x4f3af4?0x0:_0x1d14e6[_0xff40('0x1a')];var _0x1cd602=_0x4f3af4?_0x230681[_0xff40('0x1b')]:_0x1d14e6['offset']+_0x1d14e6[_0xff40('0x18')];var _0x49458c;if(_0x1cd602>=_0x347b36){_0x1cd602=_0x347b36;_0x49458c=0xc8;}else{_0x49458c=0xce;}_0x6c0047[_0xff40('0x15')](_0x49458c);return _0x6c0047[_0xff40('0x1c')]('Content-Range',_0x37158c+'-'+_0x1cd602+'/'+_0x347b36)['json'](_0x230681);}return null;};}function patchUpdates(_0x3866e5){return function(_0x2fbc1f){try{jsonpatch[_0xff40('0x1d')](_0x2fbc1f,_0x3866e5,!![]);}catch(_0x278ad6){return BPromise[_0xff40('0x1e')](_0x278ad6);}return _0x2fbc1f['save']();};}function saveUpdates(_0x277392,_0x1e21a9){return function(_0x42e598){if(_0x42e598){return _0x42e598[_0xff40('0x1f')](_0x277392)[_0xff40('0x20')](function(_0x2b1bea){return _0x2b1bea;});}return null;};}function removeEntity(_0x10dc64,_0x387a1a){return function(_0x1f4478){if(_0x1f4478){return _0x1f4478[_0xff40('0x21')]()[_0xff40('0x20')](function(){var _0x3a10c2=_0x1f4478[_0xff40('0x22')]({'plain':!![]});var _0x30a137=_0xff40('0x23');return db[_0xff40('0x24')][_0xff40('0x21')]({'where':{'type':_0x30a137,'resourceId':_0x3a10c2['id']}})[_0xff40('0x20')](function(){return _0x1f4478;});})[_0xff40('0x20')](function(){_0x10dc64[_0xff40('0x15')](0xcc)[_0xff40('0x16')]();});}};}function handleEntityNotFound(_0xd4e3c6,_0x207b8a){return function(_0x69f17d){if(!_0x69f17d){_0xd4e3c6[_0xff40('0x14')](0x194);}return _0x69f17d;};}function handleError(_0x2be0c2,_0x1dbd28){_0x1dbd28=_0x1dbd28||0x1f4;return function(_0x512c13){logger['error'](_0x512c13['stack']);if(_0x512c13['name']){delete _0x512c13[_0xff40('0x25')];}_0x2be0c2[_0xff40('0x15')](_0x1dbd28)[_0xff40('0x26')](_0x512c13);};}exports['index']=function(_0x4faf89,_0x4bf5e6){var _0x46d07f={},_0x222e60={},_0x210161={'count':0x0,'rows':[]};var _0x13d304=_[_0xff40('0x27')](db[_0xff40('0x28')]['rawAttributes'],function(_0x3877a8){return{'name':_0x3877a8['fieldName'],'type':_0x3877a8[_0xff40('0x29')][_0xff40('0x2a')]};});_0x222e60['model']=_['map'](_0x13d304,_0xff40('0x25'));_0x222e60[_0xff40('0x2b')]=_['keys'](_0x4faf89[_0xff40('0x2b')]);_0x222e60[_0xff40('0x2c')]=_[_0xff40('0x2d')](_0x222e60[_0xff40('0x2e')],_0x222e60[_0xff40('0x2b')]);_0x46d07f['attributes']=_[_0xff40('0x2d')](_0x222e60[_0xff40('0x2e')],qs['fields'](_0x4faf89[_0xff40('0x2b')][_0xff40('0x2f')]));_0x46d07f[_0xff40('0x30')]=_0x46d07f['attributes'][_0xff40('0x31')]?_0x46d07f[_0xff40('0x30')]:_0x222e60[_0xff40('0x2e')];if(!_0x4faf89[_0xff40('0x2b')][_0xff40('0x32')](_0xff40('0x33'))){_0x46d07f[_0xff40('0x18')]=qs[_0xff40('0x18')](_0x4faf89[_0xff40('0x2b')][_0xff40('0x18')]);_0x46d07f['offset']=qs['offset'](_0x4faf89[_0xff40('0x2b')][_0xff40('0x1a')]);}_0x46d07f[_0xff40('0x34')]=qs['sort'](_0x4faf89[_0xff40('0x2b')][_0xff40('0x35')]);_0x46d07f[_0xff40('0x36')]=qs['filters'](_[_0xff40('0x37')](_0x4faf89[_0xff40('0x2b')],_0x222e60['filters']),_0x13d304);if(_0x4faf89[_0xff40('0x2b')]['filter']){_0x46d07f[_0xff40('0x36')]=_[_0xff40('0x38')](_0x46d07f['where'],{'$or':_[_0xff40('0x27')](_0x13d304,function(_0x27b7bb){if(_0x27b7bb[_0xff40('0x29')]!==_0xff40('0x39')){var _0x3fab24={};_0x3fab24[_0x27b7bb[_0xff40('0x25')]]={'$like':'%'+_0x4faf89['query'][_0xff40('0x3a')]+'%'};return _0x3fab24;}})});}_0x46d07f=_[_0xff40('0x38')]({},_0x46d07f,_0x4faf89[_0xff40('0x3b')]);var _0xbc5750={'where':_0x46d07f[_0xff40('0x36')]};return db[_0xff40('0x28')][_0xff40('0x1b')](_0xbc5750)[_0xff40('0x20')](function(_0x1322ce){_0x210161[_0xff40('0x1b')]=_0x1322ce;if(_0x4faf89['query'][_0xff40('0x3c')]){_0x46d07f[_0xff40('0x3d')]=[{'all':!![]}];}return db['Variable'][_0xff40('0x3e')](_0x46d07f);})['then'](function(_0xde8ba4){_0x210161[_0xff40('0x3f')]=_0xde8ba4;return _0x210161;})['then'](respondWithFilteredResult(_0x4bf5e6,_0x46d07f))[_0xff40('0x40')](handleError(_0x4bf5e6,null));};exports['show']=function(_0x4df6a4,_0x1e16c0){var _0x3d8286={'raw':!![],'where':{'id':_0x4df6a4['params']['id']}},_0x1cc793={};_0x1cc793[_0xff40('0x2e')]=_[_0xff40('0x41')](db[_0xff40('0x28')][_0xff40('0x42')]);_0x1cc793[_0xff40('0x2b')]=_[_0xff40('0x41')](_0x4df6a4['query']);_0x1cc793[_0xff40('0x2c')]=_[_0xff40('0x2d')](_0x1cc793[_0xff40('0x2e')],_0x1cc793[_0xff40('0x2b')]);_0x3d8286[_0xff40('0x30')]=_[_0xff40('0x2d')](_0x1cc793['model'],qs[_0xff40('0x2f')](_0x4df6a4[_0xff40('0x2b')][_0xff40('0x2f')]));_0x3d8286[_0xff40('0x30')]=_0x3d8286[_0xff40('0x30')][_0xff40('0x31')]?_0x3d8286[_0xff40('0x30')]:_0x1cc793[_0xff40('0x2e')];if(_0x4df6a4[_0xff40('0x2b')][_0xff40('0x3c')]){_0x3d8286[_0xff40('0x3d')]=[{'all':!![]}];}_0x3d8286=_[_0xff40('0x38')]({},_0x3d8286,_0x4df6a4[_0xff40('0x3b')]);return db[_0xff40('0x28')][_0xff40('0x43')](_0x3d8286)[_0xff40('0x20')](handleEntityNotFound(_0x1e16c0,null))[_0xff40('0x20')](respondWithResult(_0x1e16c0,null))['catch'](handleError(_0x1e16c0,null));};exports[_0xff40('0x44')]=function(_0x514c29,_0x592e5f){return db['Variable']['create'](_0x514c29[_0xff40('0x45')],{})['then'](function(_0x482b64){var _0x4100c5=_0x514c29['user'][_0xff40('0x22')]({'plain':!![]});if(!_0x4100c5)throw new Error(_0xff40('0x46'));if(_0x4100c5['role']==='user'){var _0x348947=_0x482b64[_0xff40('0x22')]({'plain':!![]});var _0x195f51=_0xff40('0x23');return db['UserProfileSection'][_0xff40('0x43')]({'where':{'name':_0x195f51,'userProfileId':_0x4100c5[_0xff40('0x47')]},'raw':!![]})['then'](function(_0xfb1245){if(_0xfb1245&&_0xfb1245[_0xff40('0x48')]===0x0){return db[_0xff40('0x24')][_0xff40('0x44')]({'name':_0x348947[_0xff40('0x25')],'resourceId':_0x348947['id'],'type':_0xfb1245[_0xff40('0x25')],'sectionId':_0xfb1245['id']},{})[_0xff40('0x20')](function(){return _0x482b64;});}else{return _0x482b64;}})['catch'](function(_0x2bed45){logger['error'](_0xff40('0x49'),_0x2bed45);throw _0x2bed45;});}return _0x482b64;})[_0xff40('0x20')](respondWithResult(_0x592e5f,0xc9))[_0xff40('0x40')](handleError(_0x592e5f,null));};exports[_0xff40('0x1f')]=function(_0x54b191,_0x252e2e){if(_0x54b191[_0xff40('0x45')]['id']){delete _0x54b191[_0xff40('0x45')]['id'];}return db[_0xff40('0x28')][_0xff40('0x43')]({'where':{'id':_0x54b191[_0xff40('0x4a')]['id']}})[_0xff40('0x20')](handleEntityNotFound(_0x252e2e,null))['then'](saveUpdates(_0x54b191[_0xff40('0x45')],null))['then'](respondWithResult(_0x252e2e,null))['catch'](handleError(_0x252e2e,null));};exports[_0xff40('0x21')]=function(_0x3ef9f5,_0x5c6d4d){return db[_0xff40('0x28')]['find']({'where':{'id':_0x3ef9f5[_0xff40('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5c6d4d,null))[_0xff40('0x20')](removeEntity(_0x5c6d4d,null))[_0xff40('0x40')](handleError(_0x5c6d4d,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 2b8b72f..ee1e0a5 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 _0x7f11=['./variable.attributes','exports','define','Variable','tools_variables','lodash','../../config/logger','api','bluebird','request-promise','../../config/environment'];(function(_0x20fb4a,_0x59be4b){var _0x460e4b=function(_0x112673){while(--_0x112673){_0x20fb4a['push'](_0x20fb4a['shift']());}};_0x460e4b(++_0x59be4b);}(_0x7f11,0x1e9));var _0x17f1=function(_0x56fb7f,_0x33b941){_0x56fb7f=_0x56fb7f-0x0;var _0x2f4fa2=_0x7f11[_0x56fb7f];return _0x2f4fa2;};'use strict';var _=require(_0x17f1('0x0'));var util=require('util');var logger=require(_0x17f1('0x1'))(_0x17f1('0x2'));var moment=require('moment');var BPromise=require(_0x17f1('0x3'));var rp=require(_0x17f1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x17f1('0x5'));var attributes=require(_0x17f1('0x6'));module[_0x17f1('0x7')]=function(_0x19537c,_0x4b4ddc){return _0x19537c[_0x17f1('0x8')](_0x17f1('0x9'),attributes,{'tableName':_0x17f1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaa84=['api','bluebird','request-promise','path','rimraf','../../config/environment','./variable.attributes','exports','define','tools_variables','lodash','../../config/logger'];(function(_0x4588bd,_0x57222b){var _0x1becaa=function(_0x2ec59d){while(--_0x2ec59d){_0x4588bd['push'](_0x4588bd['shift']());}};_0x1becaa(++_0x57222b);}(_0xaa84,0x172));var _0x4aa8=function(_0x46ce3c,_0xb7103a){_0x46ce3c=_0x46ce3c-0x0;var _0x2b4d58=_0xaa84[_0x46ce3c];return _0x2b4d58;};'use strict';var _=require(_0x4aa8('0x0'));var util=require('util');var logger=require(_0x4aa8('0x1'))(_0x4aa8('0x2'));var moment=require('moment');var BPromise=require(_0x4aa8('0x3'));var rp=require(_0x4aa8('0x4'));var fs=require('fs');var path=require(_0x4aa8('0x5'));var rimraf=require(_0x4aa8('0x6'));var config=require(_0x4aa8('0x7'));var attributes=require(_0x4aa8('0x8'));module[_0x4aa8('0x9')]=function(_0x3f6187,_0x2405e7){return _0x3f6187[_0x4aa8('0xa')]('Variable',attributes,{'tableName':_0x4aa8('0xb'),'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 4ce4181..f12d5d5 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 _0x55ca=['options','where','attributes','include','map','model','lodash','util','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','ShowVariable','Variable','find'];(function(_0x4b87ef,_0x1aa1ab){var _0x287e5e=function(_0x66f401){while(--_0x66f401){_0x4b87ef['push'](_0x4b87ef['shift']());}};_0x287e5e(++_0x1aa1ab);}(_0x55ca,0x126));var _0xa55c=function(_0x339ded,_0xb38a57){_0x339ded=_0x339ded-0x0;var _0x37f8dc=_0x55ca[_0x339ded];return _0x37f8dc;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa55c('0x2'));var db=require(_0xa55c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa55c('0x4'))(_0xa55c('0x5'));var config=require(_0xa55c('0x6'));var jayson=require(_0xa55c('0x7'));var client=jayson[_0xa55c('0x8')][_0xa55c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36b623,_0x4d0624,_0x2121fd){return new BPromise(function(_0x2537f0,_0x57e069){return client[_0xa55c('0xa')](_0x36b623,_0x2121fd)[_0xa55c('0xb')](function(_0x52a3bc){logger['info'](_0xa55c('0xc'),_0x4d0624,_0xa55c('0xd'));logger[_0xa55c('0xe')](_0xa55c('0xf'),_0x4d0624,_0xa55c('0xd'),JSON[_0xa55c('0x10')](_0x52a3bc));if(_0x52a3bc[_0xa55c('0x11')]){if(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x12')]===0x1f4){logger[_0xa55c('0x11')]('Variable,\x20%s,\x20%s',_0x4d0624,_0x52a3bc['error'][_0xa55c('0x13')]);return _0x57e069(_0x52a3bc['error']['message']);}logger['error'](_0xa55c('0xc'),_0x4d0624,_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);return _0x2537f0(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);}else{logger[_0xa55c('0x14')]('Variable,\x20%s,\x20%s',_0x4d0624,_0xa55c('0xd'));_0x2537f0(_0x52a3bc[_0xa55c('0x15')][_0xa55c('0x13')]);}})[_0xa55c('0x16')](function(_0x1c4cfd){logger[_0xa55c('0x11')](_0xa55c('0xc'),_0x4d0624,_0x1c4cfd);_0x57e069(_0x1c4cfd);});});}exports[_0xa55c('0x17')]=function(_0x24783b){var _0x4cee3c=this;return new Promise(function(_0x3d4c9e,_0x104a99){return db[_0xa55c('0x18')][_0xa55c('0x19')]({'raw':_0x24783b[_0xa55c('0x1a')]?_0x24783b[_0xa55c('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x24783b['options']?_0x24783b[_0xa55c('0x1a')][_0xa55c('0x1b')]||null:null,'attributes':_0x24783b[_0xa55c('0x1a')]?_0x24783b['options'][_0xa55c('0x1c')]||null:null,'include':_0x24783b[_0xa55c('0x1a')]?_0x24783b['options'][_0xa55c('0x1d')]?_[_0xa55c('0x1e')](_0x24783b[_0xa55c('0x1a')][_0xa55c('0x1d')],function(_0x234372){return{'model':db[_0x234372['model']],'as':_0x234372['as'],'attributes':_0x234372[_0xa55c('0x1c')],'include':_0x234372['include']?_['map'](_0x234372['include'],function(_0x19ae88){return{'model':db[_0x19ae88['model']],'as':_0x19ae88['as'],'attributes':_0x19ae88[_0xa55c('0x1c')],'include':_0x19ae88[_0xa55c('0x1d')]?_[_0xa55c('0x1e')](_0x19ae88[_0xa55c('0x1d')],function(_0x2313a9){return{'model':db[_0x2313a9[_0xa55c('0x1f')]],'as':_0x2313a9['as'],'attributes':_0x2313a9[_0xa55c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa55c('0xb')](function(_0x192df2){logger[_0xa55c('0x14')](_0xa55c('0x17'),_0x24783b);logger['debug'](_0xa55c('0x17'),_0x24783b,JSON[_0xa55c('0x10')](_0x192df2));_0x3d4c9e(_0x192df2);})[_0xa55c('0x16')](function(_0x906caa){logger['error'](_0xa55c('0x17'),_0x906caa[_0xa55c('0x13')],_0x24783b);_0x104a99(_0x4cee3c[_0xa55c('0x11')](0x1f4,_0x906caa[_0xa55c('0x13')]));});});}; \ No newline at end of file +var _0x3e74=['catch','Variable','find','options','raw','where','attributes','include','map','model','then','ShowVariable','stringify','lodash','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','error','Variable,\x20%s,\x20%s','message','info'];(function(_0x1406ae,_0x292395){var _0x23a076=function(_0x5e147a){while(--_0x5e147a){_0x1406ae['push'](_0x1406ae['shift']());}};_0x23a076(++_0x292395);}(_0x3e74,0x175));var _0x43e7=function(_0x1faac5,_0x29b641){_0x1faac5=_0x1faac5-0x0;var _0x4d8b3e=_0x3e74[_0x1faac5];return _0x4d8b3e;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var moment=require(_0x43e7('0x1'));var BPromise=require(_0x43e7('0x2'));var rs=require(_0x43e7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x43e7('0x4'));var logger=require('../../config/logger')(_0x43e7('0x5'));var config=require(_0x43e7('0x6'));var jayson=require(_0x43e7('0x7'));var client=jayson[_0x43e7('0x8')][_0x43e7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x503698,_0x45a0d1,_0x3491d6){return new BPromise(function(_0x2ede2d,_0x8528fc){return client[_0x43e7('0xa')](_0x503698,_0x3491d6)['then'](function(_0x212c6c){logger['info']('Variable,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'));logger[_0x43e7('0xc')]('Variable,\x20%s,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'),JSON['stringify'](_0x212c6c));if(_0x212c6c[_0x43e7('0xd')]){if(_0x212c6c[_0x43e7('0xd')]['code']===0x1f4){logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')][_0x43e7('0xf')]);return _0x8528fc(_0x212c6c['error']['message']);}logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')]['message']);return _0x2ede2d(_0x212c6c['error'][_0x43e7('0xf')]);}else{logger[_0x43e7('0x10')](_0x43e7('0xe'),_0x45a0d1,_0x43e7('0xb'));_0x2ede2d(_0x212c6c['result']['message']);}})[_0x43e7('0x11')](function(_0x264575){logger[_0x43e7('0xd')]('Variable,\x20%s,\x20%s',_0x45a0d1,_0x264575);_0x8528fc(_0x264575);});});}exports['ShowVariable']=function(_0x446986){var _0x1ca758=this;return new Promise(function(_0x9037d3,_0x140657){return db[_0x43e7('0x12')][_0x43e7('0x13')]({'raw':_0x446986[_0x43e7('0x14')]?_0x446986[_0x43e7('0x14')][_0x43e7('0x15')]===undefined?!![]:![]:!![],'where':_0x446986[_0x43e7('0x14')]?_0x446986[_0x43e7('0x14')][_0x43e7('0x16')]||null:null,'attributes':_0x446986['options']?_0x446986[_0x43e7('0x14')][_0x43e7('0x17')]||null:null,'include':_0x446986['options']?_0x446986[_0x43e7('0x14')][_0x43e7('0x18')]?_[_0x43e7('0x19')](_0x446986[_0x43e7('0x14')][_0x43e7('0x18')],function(_0x2f4cb4){return{'model':db[_0x2f4cb4['model']],'as':_0x2f4cb4['as'],'attributes':_0x2f4cb4[_0x43e7('0x17')],'include':_0x2f4cb4['include']?_['map'](_0x2f4cb4[_0x43e7('0x18')],function(_0x43f4ff){return{'model':db[_0x43f4ff['model']],'as':_0x43f4ff['as'],'attributes':_0x43f4ff[_0x43e7('0x17')],'include':_0x43f4ff['include']?_[_0x43e7('0x19')](_0x43f4ff['include'],function(_0x1af208){return{'model':db[_0x1af208[_0x43e7('0x1a')]],'as':_0x1af208['as'],'attributes':_0x1af208[_0x43e7('0x17')]};}):[]};}):[]};}):[]:[]})[_0x43e7('0x1b')](function(_0x51f4d7){logger['info'](_0x43e7('0x1c'),_0x446986);logger['debug'](_0x43e7('0x1c'),_0x446986,JSON[_0x43e7('0x1d')](_0x51f4d7));_0x9037d3(_0x51f4d7);})[_0x43e7('0x11')](function(_0xb1fc63){logger['error'](_0x43e7('0x1c'),_0xb1fc63[_0x43e7('0xf')],_0x446986);_0x140657(_0x1ca758[_0x43e7('0xd')](0x1f4,_0xb1fc63[_0x43e7('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 14b4b03..0dd0db4 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 _0x0956=['pull','/restart','restart','/migrations','migrations','exports','express','../../components/auth/service','./version.controller','get','index','/fetch','isAuthenticated','canUpdate','fetch','/reset','reset','/pull'];(function(_0x5c2f45,_0x1c78e7){var _0x3fb682=function(_0x27a24f){while(--_0x27a24f){_0x5c2f45['push'](_0x5c2f45['shift']());}};_0x3fb682(++_0x1c78e7);}(_0x0956,0x72));var _0x6095=function(_0x5f25a7,_0x33fa69){_0x5f25a7=_0x5f25a7-0x0;var _0x441701=_0x0956[_0x5f25a7];return _0x441701;};'use strict';var express=require(_0x6095('0x0'));var router=express['Router']();var auth=require(_0x6095('0x1'));var controller=require(_0x6095('0x2'));router[_0x6095('0x3')]('/',controller[_0x6095('0x4')]);router[_0x6095('0x3')](_0x6095('0x5'),auth[_0x6095('0x6')](),auth[_0x6095('0x7')](),controller[_0x6095('0x8')]);router[_0x6095('0x3')](_0x6095('0x9'),auth[_0x6095('0x6')](),auth[_0x6095('0x7')](),controller[_0x6095('0xa')]);router[_0x6095('0x3')](_0x6095('0xb'),auth[_0x6095('0x6')](),auth[_0x6095('0x7')](),controller[_0x6095('0xc')]);router[_0x6095('0x3')](_0x6095('0xd'),auth[_0x6095('0x6')](),controller[_0x6095('0xe')]);router['get'](_0x6095('0xf'),controller[_0x6095('0x10')]);module[_0x6095('0x11')]=router; \ No newline at end of file +var _0x93e4=['migrations','exports','get','index','canUpdate','isAuthenticated','reset','/pull','/restart','restart'];(function(_0x1686ca,_0x4135d7){var _0x53a994=function(_0x1a1b54){while(--_0x1a1b54){_0x1686ca['push'](_0x1686ca['shift']());}};_0x53a994(++_0x4135d7);}(_0x93e4,0xe8));var _0x493e=function(_0x53901e,_0x36adc1){_0x53901e=_0x53901e-0x0;var _0x27fdb1=_0x93e4[_0x53901e];return _0x27fdb1;};'use strict';var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var controller=require('./version.controller');router[_0x493e('0x0')]('/',controller[_0x493e('0x1')]);router[_0x493e('0x0')]('/fetch',auth['isAuthenticated'](),auth[_0x493e('0x2')](),controller['fetch']);router['get']('/reset',auth[_0x493e('0x3')](),auth['canUpdate'](),controller[_0x493e('0x4')]);router['get'](_0x493e('0x5'),auth[_0x493e('0x3')](),auth['canUpdate'](),controller['pull']);router['get'](_0x493e('0x6'),auth[_0x493e('0x3')](),controller[_0x493e('0x7')]);router[_0x493e('0x0')]('/migrations',controller[_0x493e('0x8')]);module[_0x493e('0x9')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 4bb16ce..3b6a72a 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 _0xd9bf=['master','error','info','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','restart','motion2','then','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','server','length','.js','sort','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','last','UniqueConstraintError','path','lodash','pkginfo','version','child_process','../../mysqldb','../../config/pm2','../../config/logger','simple-git','root','index','exports','query','latest','fetch','tags','2.0.0','status','json'];(function(_0xcdac34,_0x43f665){var _0x269d23=function(_0x3f2d6f){while(--_0x3f2d6f){_0xcdac34['push'](_0xcdac34['shift']());}};_0x269d23(++_0x43f665);}(_0xd9bf,0x136));var _0xfd9b=function(_0x365b29,_0xba343a){_0x365b29=_0x365b29-0x0;var _0xef77e7=_0xd9bf[_0x365b29];return _0xef77e7;};'use strict';var Umzug=require('umzug');var path=require(_0xfd9b('0x0'));var fs=require('fs');var _=require(_0xfd9b('0x1'));var pkginfo=require(_0xfd9b('0x2'))(module,_0xfd9b('0x3'));var compareVersions=require('compare-versions');var exec=require(_0xfd9b('0x4'))['exec'];var db=require(_0xfd9b('0x5'))['db'];var config=require('../../config/environment');var pm2=require(_0xfd9b('0x6'));var logger=require(_0xfd9b('0x7'))('update');var git=require(_0xfd9b('0x8'))(config[_0xfd9b('0x9')]);exports[_0xfd9b('0xa')]=function(_0x2411e5,_0x4242bd){var _0x4a8f7d={'current':module[_0xfd9b('0xb')][_0xfd9b('0x3')],'phonebar':0x2};if(_0x2411e5[_0xfd9b('0xc')]&&_0x2411e5[_0xfd9b('0xc')][_0xfd9b('0xd')]){return git[_0xfd9b('0xe')]()[_0xfd9b('0xf')](function(_0x572dbc,_0x1608ee){_0x4a8f7d['latest']=(_0x572dbc?module['exports'][_0xfd9b('0x3')]:_0x1608ee['latest'])||_0xfd9b('0x10');return _0x4242bd[_0xfd9b('0x11')](0xc8)['json'](_0x4a8f7d);});}else{return _0x4242bd[_0xfd9b('0x11')](0xc8)[_0xfd9b('0x12')](_0x4a8f7d);}};exports['fetch']=function(_0x315195,_0x143ced){return git[_0xfd9b('0xe')](['origin',_0xfd9b('0x13')],function(_0x284236){if(_0x284236){logger[_0xfd9b('0x14')](_0x284236);return _0x143ced[_0xfd9b('0x11')](0x1f4)[_0xfd9b('0x12')](_0x284236);}logger[_0xfd9b('0x15')]('git\x20fetch');return _0x143ced[_0xfd9b('0x11')](0xc8)[_0xfd9b('0x12')]({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0xfd9b('0x16')]=function(_0xf360a1,_0x3667a5){return git[_0xfd9b('0x16')]([_0xfd9b('0x17'),_0xfd9b('0x18')],function(_0x34eda6){if(_0x34eda6){logger[_0xfd9b('0x14')](_0x34eda6);return _0x3667a5[_0xfd9b('0x11')](0x1f4)[_0xfd9b('0x12')](_0x34eda6);}logger[_0xfd9b('0x15')](_0xfd9b('0x19'));return _0x3667a5[_0xfd9b('0x11')](0xc8)['json']({'output':_0xfd9b('0x1a')});});};exports[_0xfd9b('0x1b')]=function(_0x482b66,_0x22f52){exec('npm\x20install\x20--production',function(_0x47eef1,_0x980718,_0x2959dc){logger[_0xfd9b('0x15')](_0x980718);logger[_0xfd9b('0x15')](_0x2959dc);if(_0x47eef1){logger[_0xfd9b('0x14')](_0x47eef1);return _0x22f52[_0xfd9b('0x11')](0x1f4)[_0xfd9b('0x12')](_0x47eef1);}return _0x22f52[_0xfd9b('0x11')](0xc8)[_0xfd9b('0x12')]({'output':_0x980718});});};exports[_0xfd9b('0x1c')]=function(_0x49de74,_0x5cb5f7){return pm2[_0xfd9b('0x1c')](_0xfd9b('0x1d'))[_0xfd9b('0x1e')](function(_0x5e7f4d){logger[_0xfd9b('0x15')]('pm2\x20restart\x20motion\x20%s',_0x5e7f4d);return _0x5cb5f7[_0xfd9b('0x11')](0xc8)[_0xfd9b('0x12')]({'output':_0xfd9b('0x1f')});})[_0xfd9b('0x20')](function(_0x4bea90){logger[_0xfd9b('0x14')](_0x4bea90);return _0x5cb5f7[_0xfd9b('0x11')](0x1f4)[_0xfd9b('0x12')](_0x4bea90);});};exports[_0xfd9b('0x21')]=function(_0x939f2e,_0x5c1c1b){var _0x54b6ec=fs[_0xfd9b('0x22')](path[_0xfd9b('0x23')](config['root'],_0xfd9b('0x24'),_0xfd9b('0x21')));var _0x31cffc=[];for(var _0x5a89dc=0x0;_0x5a89dc<_0x54b6ec[_0xfd9b('0x25')];_0x5a89dc++){var _0x43f479=_0x54b6ec[_0x5a89dc]['replace'](_0xfd9b('0x26'),'');if(compareVersions(module['exports']['version'],_0x43f479)===-0x1){_0x31cffc['push'](_0x43f479);}}if(_0x31cffc['length']){var _0x1a1fdd=_0x31cffc[_0xfd9b('0x27')](compareVersions);var _0x1e9e5e=new Umzug({'storage':_0xfd9b('0x28'),'storageOptions':{'model':db['Migration'],'modelName':_0xfd9b('0x29'),'columnName':_0xfd9b('0x3')},'migrations':{'params':[db['sequelize'][_0xfd9b('0x2a')](),db[_0xfd9b('0x28')][_0xfd9b('0x2b')],function(){throw new Error(_0xfd9b('0x2c'));}],'path':path['join'](config[_0xfd9b('0x9')],_0xfd9b('0x24'),'migrations'),'pattern':/\.js$/}});_0x1e9e5e['up']({'migrations':_['map'](_0x1a1fdd,function(_0x7214ee){return _0x7214ee+_0xfd9b('0x26');})})[_0xfd9b('0x1e')](function(){return _0x5c1c1b[_0xfd9b('0x11')](0xc8)[_0xfd9b('0x12')]({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module[_0xfd9b('0xb')][_0xfd9b('0x3')]+'\x20to\x20'+_[_0xfd9b('0x2d')](_0x1a1fdd),'migrations':_[_0xfd9b('0x23')](_0x1a1fdd)});})[_0xfd9b('0x20')](function(_0x1b5b82){if(_0x1b5b82 instanceof db['sequelize'][_0xfd9b('0x2e')]){return _0x5c1c1b[_0xfd9b('0x11')](0xc8)[_0xfd9b('0x12')]({'output':'Database\x20already\x20up-to-date'});}else{return _0x5c1c1b[_0xfd9b('0x11')](0x1f4)[_0xfd9b('0x12')](_0x1b5b82);}});}else{return _0x5c1c1b[_0xfd9b('0x11')](0xc8)[_0xfd9b('0x12')]({'output':'Database\x20already\x20up-to-date'});}}; \ No newline at end of file +var _0xcd21=['error','status','info','git\x20fetch\x20origin\x20master','reset','--hard','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','Your\x20system\x20has\x20been\x20restart\x20successfully','migrations','join','server','length','replace','.js','push','sort','sequelize','Migration','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','path','version','compare-versions','child_process','../../mysqldb','../../config/environment','../../config/logger','simple-git','root','index','query','tags','latest','exports','json','fetch','master'];(function(_0x25ffb7,_0x20ea1a){var _0x50fac1=function(_0x3d823b){while(--_0x3d823b){_0x25ffb7['push'](_0x25ffb7['shift']());}};_0x50fac1(++_0x20ea1a);}(_0xcd21,0x177));var _0x1cd2=function(_0x44cf98,_0xaa3d62){_0x44cf98=_0x44cf98-0x0;var _0x5f0fde=_0xcd21[_0x44cf98];return _0x5f0fde;};'use strict';var Umzug=require('umzug');var path=require(_0x1cd2('0x0'));var fs=require('fs');var _=require('lodash');var pkginfo=require('pkginfo')(module,_0x1cd2('0x1'));var compareVersions=require(_0x1cd2('0x2'));var exec=require(_0x1cd2('0x3'))['exec'];var db=require(_0x1cd2('0x4'))['db'];var config=require(_0x1cd2('0x5'));var pm2=require('../../config/pm2');var logger=require(_0x1cd2('0x6'))('update');var git=require(_0x1cd2('0x7'))(config[_0x1cd2('0x8')]);exports[_0x1cd2('0x9')]=function(_0x1ec36a,_0x5d8ef8){var _0x122661={'current':module['exports'][_0x1cd2('0x1')],'phonebar':0x2};if(_0x1ec36a[_0x1cd2('0xa')]&&_0x1ec36a[_0x1cd2('0xa')]['latest']){return git['fetch']()[_0x1cd2('0xb')](function(_0x4a2d04,_0xd2341){_0x122661[_0x1cd2('0xc')]=(_0x4a2d04?module[_0x1cd2('0xd')]['version']:_0xd2341[_0x1cd2('0xc')])||'2.0.0';return _0x5d8ef8['status'](0xc8)[_0x1cd2('0xe')](_0x122661);});}else{return _0x5d8ef8['status'](0xc8)[_0x1cd2('0xe')](_0x122661);}};exports[_0x1cd2('0xf')]=function(_0x4af675,_0x40190b){return git[_0x1cd2('0xf')](['origin',_0x1cd2('0x10')],function(_0x1e4f29){if(_0x1e4f29){logger[_0x1cd2('0x11')](_0x1e4f29);return _0x40190b[_0x1cd2('0x12')](0x1f4)[_0x1cd2('0xe')](_0x1e4f29);}logger[_0x1cd2('0x13')]('git\x20fetch');return _0x40190b[_0x1cd2('0x12')](0xc8)['json']({'output':_0x1cd2('0x14')});});};exports[_0x1cd2('0x15')]=function(_0x53dff2,_0x741ddf){return git[_0x1cd2('0x15')]([_0x1cd2('0x16'),'FETCH_HEAD'],function(_0xc7522){if(_0xc7522){logger[_0x1cd2('0x11')](_0xc7522);return _0x741ddf[_0x1cd2('0x12')](0x1f4)['json'](_0xc7522);}logger[_0x1cd2('0x13')](_0x1cd2('0x17'));return _0x741ddf['status'](0xc8)['json']({'output':_0x1cd2('0x18')});});};exports[_0x1cd2('0x19')]=function(_0xb1bc0d,_0x1eba5a){exec(_0x1cd2('0x1a'),function(_0x591d5f,_0x197026,_0x23a32b){logger[_0x1cd2('0x13')](_0x197026);logger[_0x1cd2('0x13')](_0x23a32b);if(_0x591d5f){logger[_0x1cd2('0x11')](_0x591d5f);return _0x1eba5a[_0x1cd2('0x12')](0x1f4)['json'](_0x591d5f);}return _0x1eba5a[_0x1cd2('0x12')](0xc8)[_0x1cd2('0xe')]({'output':_0x197026});});};exports[_0x1cd2('0x1b')]=function(_0x322c09,_0x389afa){return pm2[_0x1cd2('0x1b')](_0x1cd2('0x1c'))[_0x1cd2('0x1d')](function(_0x43acd3){logger[_0x1cd2('0x13')]('pm2\x20restart\x20motion\x20%s',_0x43acd3);return _0x389afa[_0x1cd2('0x12')](0xc8)[_0x1cd2('0xe')]({'output':_0x1cd2('0x1e')});})['catch'](function(_0x199bbc){logger[_0x1cd2('0x11')](_0x199bbc);return _0x389afa[_0x1cd2('0x12')](0x1f4)[_0x1cd2('0xe')](_0x199bbc);});};exports[_0x1cd2('0x1f')]=function(_0x592825,_0x51c707){var _0x16b6cd=fs['readdirSync'](path[_0x1cd2('0x20')](config[_0x1cd2('0x8')],_0x1cd2('0x21'),_0x1cd2('0x1f')));var _0x20c216=[];for(var _0x342841=0x0;_0x342841<_0x16b6cd[_0x1cd2('0x22')];_0x342841++){var _0x147356=_0x16b6cd[_0x342841][_0x1cd2('0x23')](_0x1cd2('0x24'),'');if(compareVersions(module[_0x1cd2('0xd')]['version'],_0x147356)===-0x1){_0x20c216[_0x1cd2('0x25')](_0x147356);}}if(_0x20c216['length']){var _0x1ee481=_0x20c216[_0x1cd2('0x26')](compareVersions);var _0x5ce996=new Umzug({'storage':_0x1cd2('0x27'),'storageOptions':{'model':db[_0x1cd2('0x28')],'modelName':_0x1cd2('0x28'),'columnName':_0x1cd2('0x1')},'migrations':{'params':[db[_0x1cd2('0x27')]['getQueryInterface'](),db[_0x1cd2('0x27')][_0x1cd2('0x29')],function(){throw new Error(_0x1cd2('0x2a'));}],'path':path[_0x1cd2('0x20')](config[_0x1cd2('0x8')],'server',_0x1cd2('0x1f')),'pattern':/\.js$/}});_0x5ce996['up']({'migrations':_[_0x1cd2('0x2b')](_0x1ee481,function(_0x4ee739){return _0x4ee739+'.js';})})['then'](function(){return _0x51c707[_0x1cd2('0x12')](0xc8)[_0x1cd2('0xe')]({'output':_0x1cd2('0x2c')+module[_0x1cd2('0xd')][_0x1cd2('0x1')]+_0x1cd2('0x2d')+_[_0x1cd2('0x2e')](_0x1ee481),'migrations':_[_0x1cd2('0x20')](_0x1ee481)});})['catch'](function(_0x2dcde7){if(_0x2dcde7 instanceof db['sequelize'][_0x1cd2('0x2f')]){return _0x51c707[_0x1cd2('0x12')](0xc8)[_0x1cd2('0xe')]({'output':'Database\x20already\x20up-to-date'});}else{return _0x51c707[_0x1cd2('0x12')](0x1f4)[_0x1cd2('0xe')](_0x2dcde7);}});}else{return _0x51c707['status'](0xc8)[_0x1cd2('0xe')]({'output':_0x1cd2('0x30')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 90c1cd8..9055cd7 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 _0xe3e9=['../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0xf8174b,_0x2666b5){var _0x48fcb5=function(_0x473fc0){while(--_0x473fc0){_0xf8174b['push'](_0xf8174b['shift']());}};_0x48fcb5(++_0x2666b5);}(_0xe3e9,0xa1));var _0x9e3e=function(_0x4d2366,_0x412bfe){_0x4d2366=_0x4d2366-0x0;var _0xefd8bb=_0xe3e9[_0x4d2366];return _0xefd8bb;};'use strict';var multer=require('multer');var util=require(_0x9e3e('0x0'));var path=require(_0x9e3e('0x1'));var timeout=require(_0x9e3e('0x2'));var express=require(_0x9e3e('0x3'));var router=express[_0x9e3e('0x4')]();var fs_extra=require(_0x9e3e('0x5'));var auth=require(_0x9e3e('0x6'));var interaction=require(_0x9e3e('0x7'));var config=require(_0x9e3e('0x8'));var controller=require('./voiceAgentReport.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x9e3e('0x9')](_0x9e3e('0xa'),auth[_0x9e3e('0xb')](),controller[_0x9e3e('0xc')]);router['get'](_0x9e3e('0xd'),auth[_0x9e3e('0xb')](),controller[_0x9e3e('0xe')]);router[_0x9e3e('0xf')]('/',auth[_0x9e3e('0xb')](),controller[_0x9e3e('0x10')]);router[_0x9e3e('0x11')](_0x9e3e('0xd'),auth[_0x9e3e('0xb')](),controller[_0x9e3e('0x12')]);router[_0x9e3e('0x13')](_0x9e3e('0xd'),auth[_0x9e3e('0xb')](),controller['destroy']);module[_0x9e3e('0x14')]=router; \ No newline at end of file +var _0xd4a1=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','index','/describe','/:id','show','create','delete','destroy'];(function(_0xdb8c35,_0x49387e){var _0x3636f6=function(_0x30e5e8){while(--_0x30e5e8){_0xdb8c35['push'](_0xdb8c35['shift']());}};_0x3636f6(++_0x49387e);}(_0xd4a1,0x157));var _0x1d4a=function(_0xfd60c2,_0x1ae20c){_0xfd60c2=_0xfd60c2-0x0;var _0x5debfe=_0xd4a1[_0xfd60c2];return _0x5debfe;};'use strict';var multer=require(_0x1d4a('0x0'));var util=require(_0x1d4a('0x1'));var path=require(_0x1d4a('0x2'));var timeout=require(_0x1d4a('0x3'));var express=require(_0x1d4a('0x4'));var router=express[_0x1d4a('0x5')]();var fs_extra=require(_0x1d4a('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x1d4a('0x7'));var config=require('../../config/environment');var controller=require('./voiceAgentReport.controller');router[_0x1d4a('0x8')]('/',auth[_0x1d4a('0x9')](),controller[_0x1d4a('0xa')]);router[_0x1d4a('0x8')](_0x1d4a('0xb'),auth[_0x1d4a('0x9')](),controller['describe']);router[_0x1d4a('0x8')](_0x1d4a('0xc'),auth[_0x1d4a('0x9')](),controller[_0x1d4a('0xd')]);router['post']('/',auth[_0x1d4a('0x9')](),controller[_0x1d4a('0xe')]);router['put'](_0x1d4a('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x1d4a('0xf')](_0x1d4a('0xc'),auth[_0x1d4a('0x9')](),controller[_0x1d4a('0x10')]);module[_0x1d4a('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 897ae0a..e576e06 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 _0x753c=['exports','STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED'];(function(_0x1d75f7,_0x139d5e){var _0x307f9a=function(_0x400ae1){while(--_0x400ae1){_0x1d75f7['push'](_0x1d75f7['shift']());}};_0x307f9a(++_0x139d5e);}(_0x753c,0x96));var _0xc753=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x753c[_0x4cf98e];return _0x1623ac;};'use strict';var Sequelize=require('sequelize');module[_0xc753('0x0')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xc753('0x1')]},'calleridnum':{'type':Sequelize[_0xc753('0x1')]},'calleridname':{'type':Sequelize[_0xc753('0x1')]},'queue':{'type':Sequelize[_0xc753('0x1')]},'interface':{'type':Sequelize[_0xc753('0x1')]},'membername':{'type':Sequelize[_0xc753('0x1')]},'agentcalledAt':{'type':Sequelize[_0xc753('0x2')]},'agentconnectAt':{'type':Sequelize[_0xc753('0x2')]},'agentcompleteAt':{'type':Sequelize[_0xc753('0x2')]},'agentringnoanswerAt':{'type':Sequelize[_0xc753('0x2')]},'agentdumpAt':{'type':Sequelize[_0xc753('0x2')]},'holdtime':{'type':Sequelize[_0xc753('0x3')]},'agentcomplete':{'type':Sequelize[_0xc753('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xc753('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xc753('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xc753('0x3')]},'agentacw':{'type':Sequelize[_0xc753('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xc753('0x3')]},'reason':{'type':Sequelize[_0xc753('0x1')]},'lastevent':{'type':Sequelize[_0xc753('0x1')]},'channel':{'type':Sequelize[_0xc753('0x1')]},'channelstate':{'type':Sequelize[_0xc753('0x3')]},'channelstatedesc':{'type':Sequelize[_0xc753('0x1')]},'connectedlinenum':{'type':Sequelize[_0xc753('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xc753('0x1')]},'accountcode':{'type':Sequelize[_0xc753('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xc753('0x1')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xc753('0x1')]},'destchannelstate':{'type':Sequelize[_0xc753('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xc753('0x1')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xc753('0x1')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0xc753('0x1')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0xc753('0x1')]},'destcontext':{'type':Sequelize[_0xc753('0x1')]},'destexten':{'type':Sequelize[_0xc753('0x1')]},'destpriority':{'type':Sequelize[_0xc753('0x1')]},'destuniqueid':{'type':Sequelize[_0xc753('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize[_0xc753('0x1')]},'transfer':{'type':Sequelize[_0xc753('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xc753('0x1')],'comment':_0xc753('0x5')},'transferexten':{'type':Sequelize[_0xc753('0x1')]},'transferuniqueid':{'type':Sequelize[_0xc753('0x1')]},'agententerreason':{'type':Sequelize[_0xc753('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xbcff=['FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE','BOOLEAN','INTEGER'];(function(_0x162739,_0x2f5faa){var _0x97a9b=function(_0xddf869){while(--_0xddf869){_0x162739['push'](_0x162739['shift']());}};_0x97a9b(++_0x2f5faa);}(_0xbcff,0x12e));var _0xfbcf=function(_0x40ca63,_0x5c148d){_0x40ca63=_0x40ca63-0x0;var _0x2f7046=_0xbcff[_0x40ca63];return _0x2f7046;};'use strict';var Sequelize=require(_0xfbcf('0x0'));module[_0xfbcf('0x1')]={'type':{'type':Sequelize[_0xfbcf('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xfbcf('0x2')]},'calleridname':{'type':Sequelize[_0xfbcf('0x2')]},'queue':{'type':Sequelize[_0xfbcf('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xfbcf('0x2')]},'agentcalledAt':{'type':Sequelize[_0xfbcf('0x3')]},'agentconnectAt':{'type':Sequelize[_0xfbcf('0x3')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0xfbcf('0x3')]},'agentdumpAt':{'type':Sequelize[_0xfbcf('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0xfbcf('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xfbcf('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0xfbcf('0x5')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xfbcf('0x5')]},'reason':{'type':Sequelize[_0xfbcf('0x2')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xfbcf('0x5')]},'channelstatedesc':{'type':Sequelize[_0xfbcf('0x2')]},'connectedlinenum':{'type':Sequelize[_0xfbcf('0x2')]},'connectedlinename':{'type':Sequelize[_0xfbcf('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xfbcf('0x2')]},'context':{'type':Sequelize[_0xfbcf('0x2')]},'exten':{'type':Sequelize[_0xfbcf('0x2')]},'priority':{'type':Sequelize[_0xfbcf('0x2')]},'destchannel':{'type':Sequelize[_0xfbcf('0x2')]},'destchannelstate':{'type':Sequelize[_0xfbcf('0x5')]},'destchannelstatedesc':{'type':Sequelize[_0xfbcf('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xfbcf('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0xfbcf('0x2')]},'destlanguage':{'type':Sequelize[_0xfbcf('0x2')]},'destaccountcode':{'type':Sequelize[_0xfbcf('0x2')]},'destcontext':{'type':Sequelize[_0xfbcf('0x2')]},'destexten':{'type':Sequelize[_0xfbcf('0x2')]},'destpriority':{'type':Sequelize[_0xfbcf('0x2')]},'destuniqueid':{'type':Sequelize[_0xfbcf('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xfbcf('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0xfbcf('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xfbcf('0x2')],'comment':_0xfbcf('0x6')},'transferexten':{'type':Sequelize[_0xfbcf('0x2')]},'transferuniqueid':{'type':Sequelize[_0xfbcf('0x2')]},'agententerreason':{'type':Sequelize[_0xfbcf('0x5')],'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 f16d976..2d8b738 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(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xa9e0[_0x2a6809];return _0x11c371;};'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(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'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 aa7444f..16da05c 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 _0x6726=['moment','bluebird','path','../../config/environment','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','report_agent','uniqueid','destuniqueid','util','../../config/logger'];(function(_0xd02bb,_0x26e2d0){var _0x1cdf23=function(_0x18fd05){while(--_0x18fd05){_0xd02bb['push'](_0xd02bb['shift']());}};_0x1cdf23(++_0x26e2d0);}(_0x6726,0xdb));var _0x6672=function(_0x8c8176,_0x5360a1){_0x8c8176=_0x8c8176-0x0;var _0x4dc47b=_0x6726[_0x8c8176];return _0x4dc47b;};'use strict';var _=require('lodash');var util=require(_0x6672('0x0'));var logger=require(_0x6672('0x1'))('api');var moment=require(_0x6672('0x2'));var BPromise=require(_0x6672('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6672('0x4'));var rimraf=require('rimraf');var config=require(_0x6672('0x5'));var attributes=require(_0x6672('0x6'));module[_0x6672('0x7')]=function(_0x40ba7e,_0x5701b9){return _0x40ba7e[_0x6672('0x8')](_0x6672('0x9'),attributes,{'tableName':_0x6672('0xa'),'paranoid':![],'indexes':[{'fields':[_0x6672('0xb'),_0x6672('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7a2d=['./voiceAgentReport.attributes','exports','define','VoiceAgentReport','report_agent','uniqueid','destuniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment'];(function(_0x18ae4b,_0x3fccea){var _0x409b8b=function(_0x2d611c){while(--_0x2d611c){_0x18ae4b['push'](_0x18ae4b['shift']());}};_0x409b8b(++_0x3fccea);}(_0x7a2d,0x142));var _0xd7a2=function(_0x5f2de8,_0x124dfe){_0x5f2de8=_0x5f2de8-0x0;var _0x11e267=_0x7a2d[_0x5f2de8];return _0x11e267;};'use strict';var _=require(_0xd7a2('0x0'));var util=require(_0xd7a2('0x1'));var logger=require(_0xd7a2('0x2'))(_0xd7a2('0x3'));var moment=require(_0xd7a2('0x4'));var BPromise=require(_0xd7a2('0x5'));var rp=require(_0xd7a2('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd7a2('0x7'));var attributes=require(_0xd7a2('0x8'));module[_0xd7a2('0x9')]=function(_0x13b19d,_0x4f0c6b){return _0x13b19d[_0xd7a2('0xa')](_0xd7a2('0xb'),attributes,{'tableName':_0xd7a2('0xc'),'paranoid':![],'indexes':[{'fields':[_0xd7a2('0xd'),_0xd7a2('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 925beab..0bc4759 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 _0x4ed0=['where','limit','UpdateVoiceAgentReport','stringify','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','VoiceAgentReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','raw','debug','update','options'];(function(_0x2642cb,_0x4b917f){var _0xe6e41=function(_0x281676){while(--_0x281676){_0x2642cb['push'](_0x2642cb['shift']());}};_0xe6e41(++_0x4b917f);}(_0x4ed0,0x10c));var _0x04ed=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x4ed0[_0x126558];return _0x1f6d14;};'use strict';var _=require(_0x04ed('0x0'));var util=require(_0x04ed('0x1'));var moment=require(_0x04ed('0x2'));var BPromise=require('bluebird');var rs=require(_0x04ed('0x3'));var fs=require('fs');var Redis=require(_0x04ed('0x4'));var db=require(_0x04ed('0x5'))['db'];var utils=require(_0x04ed('0x6'));var logger=require(_0x04ed('0x7'))('rpc');var config=require(_0x04ed('0x8'));var jayson=require(_0x04ed('0x9'));var client=jayson['client'][_0x04ed('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x530830,_0x15894d,_0x590c7c){return new BPromise(function(_0x2b6ef9,_0x356934){return client[_0x04ed('0xb')](_0x530830,_0x590c7c)[_0x04ed('0xc')](function(_0x67296e){logger[_0x04ed('0xd')](_0x04ed('0xe'),_0x15894d,_0x04ed('0xf'));logger['debug'](_0x04ed('0x10'),_0x15894d,'request\x20sent',JSON['stringify'](_0x67296e));if(_0x67296e['error']){if(_0x67296e[_0x04ed('0x11')]['code']===0x1f4){logger['error']('VoiceAgentReport,\x20%s,\x20%s',_0x15894d,_0x67296e[_0x04ed('0x11')][_0x04ed('0x12')]);return _0x356934(_0x67296e[_0x04ed('0x11')][_0x04ed('0x12')]);}logger[_0x04ed('0x11')](_0x04ed('0xe'),_0x15894d,_0x67296e[_0x04ed('0x11')][_0x04ed('0x12')]);return _0x2b6ef9(_0x67296e[_0x04ed('0x11')][_0x04ed('0x12')]);}else{logger[_0x04ed('0xd')](_0x04ed('0xe'),_0x15894d,_0x04ed('0xf'));_0x2b6ef9(_0x67296e[_0x04ed('0x13')]['message']);}})[_0x04ed('0x14')](function(_0x54b0b5){logger[_0x04ed('0x11')](_0x04ed('0xe'),_0x15894d,_0x54b0b5);_0x356934(_0x54b0b5);});});}exports[_0x04ed('0x15')]=function(_0x55318b){var _0x16e335=this;return new Promise(function(_0x5532a4,_0x14c5bc){return db[_0x04ed('0x16')][_0x04ed('0x17')](_0x55318b[_0x04ed('0x18')],{'raw':_0x55318b['options']?_0x55318b['options'][_0x04ed('0x19')]===undefined?!![]:![]:!![]})[_0x04ed('0xc')](function(_0x42c8a5){logger[_0x04ed('0xd')](_0x04ed('0x15'),_0x55318b);logger[_0x04ed('0x1a')]('CreateVoiceAgentReport',_0x55318b,JSON['stringify'](_0x42c8a5));_0x5532a4(_0x42c8a5);})[_0x04ed('0x14')](function(_0x207b77){logger[_0x04ed('0x11')](_0x04ed('0x15'),_0x207b77[_0x04ed('0x12')],_0x55318b);_0x14c5bc(_0x16e335[_0x04ed('0x11')](0x1f4,_0x207b77[_0x04ed('0x12')]));});});};exports['UpdateVoiceAgentReport']=function(_0x7ae6d0){var _0x25357c=this;return new Promise(function(_0x579f57,_0x43f3ae){return db[_0x04ed('0x16')][_0x04ed('0x1b')](_0x7ae6d0[_0x04ed('0x18')],{'raw':_0x7ae6d0[_0x04ed('0x1c')]?_0x7ae6d0[_0x04ed('0x1c')][_0x04ed('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x7ae6d0[_0x04ed('0x1c')]?_0x7ae6d0['options'][_0x04ed('0x1d')]||null:null,'attributes':_0x7ae6d0['options']?_0x7ae6d0[_0x04ed('0x1c')]['attributes']||null:null,'limit':_0x7ae6d0['options']?_0x7ae6d0[_0x04ed('0x1c')][_0x04ed('0x1e')]||null:null})[_0x04ed('0xc')](function(_0x562614){logger[_0x04ed('0xd')]('UpdateVoiceAgentReport',_0x7ae6d0);logger[_0x04ed('0x1a')](_0x04ed('0x1f'),_0x7ae6d0,JSON[_0x04ed('0x20')](_0x562614));_0x579f57(_0x562614);})[_0x04ed('0x14')](function(_0x44a1c6){logger['error'](_0x04ed('0x1f'),_0x44a1c6[_0x04ed('0x12')],_0x7ae6d0);_0x43f3ae(_0x25357c[_0x04ed('0x11')](0x1f4,_0x44a1c6[_0x04ed('0x12')]));});});}; \ No newline at end of file +var _0x2ea9=['client','http','request','then','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','CreateVoiceAgentReport','VoiceAgentReport','raw','stringify','update','body','options','where','limit','UpdateVoiceAgentReport','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise'];(function(_0x21b7bc,_0xaefc61){var _0x16d5b6=function(_0x28b26b){while(--_0x28b26b){_0x21b7bc['push'](_0x21b7bc['shift']());}};_0x16d5b6(++_0xaefc61);}(_0x2ea9,0x162));var _0x92ea=function(_0x3f8b66,_0x2ba867){_0x3f8b66=_0x3f8b66-0x0;var _0x148862=_0x2ea9[_0x3f8b66];return _0x148862;};'use strict';var _=require(_0x92ea('0x0'));var util=require(_0x92ea('0x1'));var moment=require('moment');var BPromise=require(_0x92ea('0x2'));var rs=require(_0x92ea('0x3'));var fs=require('fs');var Redis=require(_0x92ea('0x4'));var db=require(_0x92ea('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x92ea('0x6'))(_0x92ea('0x7'));var config=require('../../config/environment');var jayson=require(_0x92ea('0x8'));var client=jayson[_0x92ea('0x9')][_0x92ea('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x11d5d4,_0x119791,_0xd6857e){return new BPromise(function(_0x5647e9,_0x2b7a2c){return client[_0x92ea('0xb')](_0x11d5d4,_0xd6857e)[_0x92ea('0xc')](function(_0x1afabc){logger['info'](_0x92ea('0xd'),_0x119791,_0x92ea('0xe'));logger[_0x92ea('0xf')](_0x92ea('0x10'),_0x119791,_0x92ea('0xe'),JSON['stringify'](_0x1afabc));if(_0x1afabc[_0x92ea('0x11')]){if(_0x1afabc['error'][_0x92ea('0x12')]===0x1f4){logger['error'](_0x92ea('0xd'),_0x119791,_0x1afabc[_0x92ea('0x11')][_0x92ea('0x13')]);return _0x2b7a2c(_0x1afabc[_0x92ea('0x11')][_0x92ea('0x13')]);}logger['error']('VoiceAgentReport,\x20%s,\x20%s',_0x119791,_0x1afabc['error'][_0x92ea('0x13')]);return _0x5647e9(_0x1afabc[_0x92ea('0x11')]['message']);}else{logger[_0x92ea('0x14')](_0x92ea('0xd'),_0x119791,_0x92ea('0xe'));_0x5647e9(_0x1afabc[_0x92ea('0x15')][_0x92ea('0x13')]);}})[_0x92ea('0x16')](function(_0x1ed41c){logger[_0x92ea('0x11')](_0x92ea('0xd'),_0x119791,_0x1ed41c);_0x2b7a2c(_0x1ed41c);});});}exports[_0x92ea('0x17')]=function(_0x5b9107){var _0x62d0e=this;return new Promise(function(_0x2f5208,_0x1b794c){return db[_0x92ea('0x18')]['create'](_0x5b9107['body'],{'raw':_0x5b9107['options']?_0x5b9107['options'][_0x92ea('0x19')]===undefined?!![]:![]:!![]})[_0x92ea('0xc')](function(_0x7d39a7){logger[_0x92ea('0x14')]('CreateVoiceAgentReport',_0x5b9107);logger['debug'](_0x92ea('0x17'),_0x5b9107,JSON[_0x92ea('0x1a')](_0x7d39a7));_0x2f5208(_0x7d39a7);})[_0x92ea('0x16')](function(_0x3ef656){logger[_0x92ea('0x11')](_0x92ea('0x17'),_0x3ef656[_0x92ea('0x13')],_0x5b9107);_0x1b794c(_0x62d0e[_0x92ea('0x11')](0x1f4,_0x3ef656[_0x92ea('0x13')]));});});};exports['UpdateVoiceAgentReport']=function(_0x4d8f07){var _0x2c5bba=this;return new Promise(function(_0x5108fc,_0x13e56f){return db['VoiceAgentReport'][_0x92ea('0x1b')](_0x4d8f07[_0x92ea('0x1c')],{'raw':_0x4d8f07[_0x92ea('0x1d')]?_0x4d8f07[_0x92ea('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4d8f07[_0x92ea('0x1d')]?_0x4d8f07[_0x92ea('0x1d')][_0x92ea('0x1e')]||null:null,'attributes':_0x4d8f07[_0x92ea('0x1d')]?_0x4d8f07[_0x92ea('0x1d')]['attributes']||null:null,'limit':_0x4d8f07[_0x92ea('0x1d')]?_0x4d8f07['options'][_0x92ea('0x1f')]||null:null})[_0x92ea('0xc')](function(_0x31da58){logger[_0x92ea('0x14')]('UpdateVoiceAgentReport',_0x4d8f07);logger[_0x92ea('0xf')](_0x92ea('0x20'),_0x4d8f07,JSON[_0x92ea('0x1a')](_0x31da58));_0x5108fc(_0x31da58);})[_0x92ea('0x16')](function(_0x374c51){logger[_0x92ea('0x11')](_0x92ea('0x20'),_0x374c51['message'],_0x4d8f07);_0x13e56f(_0x2c5bba[_0x92ea('0x11')](0x1f4,_0x374c51[_0x92ea('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 09d1f40..538d19a 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 _0x0e85=['/describe','describe','/:id','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','../../components/interaction/service','./voiceCallReport.controller','get','isAuthenticated','index'];(function(_0x3a8ce2,_0x552ad5){var _0x2e5a45=function(_0x5de5ed){while(--_0x5de5ed){_0x3a8ce2['push'](_0x3a8ce2['shift']());}};_0x2e5a45(++_0x552ad5);}(_0x0e85,0x7c));var _0x50e8=function(_0x4dc7b9,_0x319d5a){_0x4dc7b9=_0x4dc7b9-0x0;var _0x3ab114=_0x0e85[_0x4dc7b9];return _0x3ab114;};'use strict';var multer=require(_0x50e8('0x0'));var util=require(_0x50e8('0x1'));var path=require('path');var timeout=require(_0x50e8('0x2'));var express=require(_0x50e8('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x50e8('0x4'));var config=require('../../config/environment');var controller=require(_0x50e8('0x5'));router[_0x50e8('0x6')]('/',auth[_0x50e8('0x7')](),controller[_0x50e8('0x8')]);router['get'](_0x50e8('0x9'),auth[_0x50e8('0x7')](),controller[_0x50e8('0xa')]);router[_0x50e8('0x6')](_0x50e8('0xb'),auth[_0x50e8('0x7')](),controller['show']);router[_0x50e8('0xc')]('/',auth[_0x50e8('0x7')](),controller[_0x50e8('0xd')]);router[_0x50e8('0xe')](_0x50e8('0xb'),auth[_0x50e8('0x7')](),controller[_0x50e8('0xf')]);router[_0x50e8('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x50e8('0x11')]);module[_0x50e8('0x12')]=router; \ No newline at end of file +var _0x8958=['index','get','/describe','/:id','show','post','create','put','delete','destroy','exports','util','fs-extra','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','isAuthenticated'];(function(_0x2d3899,_0x26a4c9){var _0x74e6f7=function(_0x259b03){while(--_0x259b03){_0x2d3899['push'](_0x2d3899['shift']());}};_0x74e6f7(++_0x26a4c9);}(_0x8958,0x93));var _0x8895=function(_0x5cb4c6,_0x106e78){_0x5cb4c6=_0x5cb4c6-0x0;var _0x5a416b=_0x8958[_0x5cb4c6];return _0x5a416b;};'use strict';var multer=require('multer');var util=require(_0x8895('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x8895('0x1'));var auth=require('../../components/auth/service');var interaction=require(_0x8895('0x2'));var config=require(_0x8895('0x3'));var controller=require(_0x8895('0x4'));router['get']('/',auth[_0x8895('0x5')](),controller[_0x8895('0x6')]);router[_0x8895('0x7')](_0x8895('0x8'),auth[_0x8895('0x5')](),controller['describe']);router[_0x8895('0x7')](_0x8895('0x9'),auth[_0x8895('0x5')](),controller[_0x8895('0xa')]);router[_0x8895('0xb')]('/',auth[_0x8895('0x5')](),controller[_0x8895('0xc')]);router[_0x8895('0xd')](_0x8895('0x9'),auth[_0x8895('0x5')](),controller['update']);router[_0x8895('0xe')](_0x8895('0x9'),auth[_0x8895('0x5')](),controller[_0x8895('0xf')]);module[_0x8895('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index bc0b94f..4971000 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 _0xa896=['internal','outbound','inbound-fax','outbound-fax','STRING','TEXT','DATE','INTEGER','sequelize','exports','ENUM','inbound'];(function(_0x20a27d,_0x5dcaf1){var _0x88c40=function(_0x369554){while(--_0x369554){_0x20a27d['push'](_0x20a27d['shift']());}};_0x88c40(++_0x5dcaf1);}(_0xa896,0xe0));var _0x6a89=function(_0x3abe55,_0x54e6d2){_0x3abe55=_0x3abe55-0x0;var _0x1e17e0=_0xa896[_0x3abe55];return _0x1e17e0;};'use strict';var Sequelize=require(_0x6a89('0x0'));module[_0x6a89('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x6a89('0x2')](_0x6a89('0x3'),_0x6a89('0x4'),_0x6a89('0x5'),_0x6a89('0x6'),_0x6a89('0x7'),'dialer')},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x6a89('0x8')]},'source':{'type':Sequelize[_0x6a89('0x8')]},'destination':{'type':Sequelize[_0x6a89('0x8')]},'destinationcontext':{'type':Sequelize[_0x6a89('0x8')]},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x6a89('0x8')]},'destinationchannel':{'type':Sequelize[_0x6a89('0x8')]},'lastapplication':{'type':Sequelize[_0x6a89('0x8')]},'lastdata':{'type':Sequelize[_0x6a89('0x9')]},'starttime':{'type':Sequelize[_0x6a89('0xa')]},'systemanswertime':{'type':Sequelize[_0x6a89('0xa')]},'answertime':{'type':Sequelize[_0x6a89('0xa')]},'endtime':{'type':Sequelize[_0x6a89('0xa')]},'duration':{'type':Sequelize[_0x6a89('0xb')]},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0x6a89('0xb')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x6a89('0x8')]},'amaflags':{'type':Sequelize[_0x6a89('0x8')]},'userfield':{'type':Sequelize[_0x6a89('0x8')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x6a89('0x8')]},'userThirdDisposition':{'type':Sequelize[_0x6a89('0x8')]},'note':{'type':Sequelize[_0x6a89('0x8')]},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize[_0x6a89('0x8')]}}; \ No newline at end of file +var _0xc9de=['INTEGER','sequelize','exports','STRING','inbound','internal','outbound','inbound-fax','outbound-fax','dialer','DATE'];(function(_0x715d76,_0x402d60){var _0x48fe88=function(_0x4dd0ea){while(--_0x4dd0ea){_0x715d76['push'](_0x715d76['shift']());}};_0x48fe88(++_0x402d60);}(_0xc9de,0x140));var _0xec9d=function(_0x5cbe80,_0x559268){_0x5cbe80=_0x5cbe80-0x0;var _0xf3809d=_0xc9de[_0x5cbe80];return _0xf3809d;};'use strict';var Sequelize=require(_0xec9d('0x0'));module[_0xec9d('0x1')]={'uniqueid':{'type':Sequelize[_0xec9d('0x2')]},'type':{'type':Sequelize['ENUM'](_0xec9d('0x3'),_0xec9d('0x4'),_0xec9d('0x5'),_0xec9d('0x6'),_0xec9d('0x7'),_0xec9d('0x8'))},'tag':{'type':Sequelize[_0xec9d('0x2')]},'accountcode':{'type':Sequelize[_0xec9d('0x2')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize[_0xec9d('0x2')]},'destinationcontext':{'type':Sequelize[_0xec9d('0x2')]},'callerid':{'type':Sequelize[_0xec9d('0x2')]},'channel':{'type':Sequelize[_0xec9d('0x2')]},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize[_0xec9d('0x2')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0xec9d('0x9')]},'systemanswertime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'duration':{'type':Sequelize[_0xec9d('0xa')]},'billableseconds':{'type':Sequelize[_0xec9d('0xa')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xec9d('0x2')]},'amaflags':{'type':Sequelize[_0xec9d('0x2')]},'userfield':{'type':Sequelize[_0xec9d('0x2')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0xec9d('0x2')]},'userThirdDisposition':{'type':Sequelize[_0xec9d('0x2')]},'note':{'type':Sequelize[_0xec9d('0x2')]},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize[_0xec9d('0xa')]},'sipcallid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 2e6ed21..8bdd2f7 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 _0xdb28=['options','includeAll','fullname','User','findAll','rows','catch','show','params','rawAttributes','intersection','include','find','create','destroy','describe','body','uniqueid','user','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','apply','save','update','then','sendStatus','error','stack','name','send','index','VoiceCallReport','fieldName','type','key','map','query','keys','model','fields','attributes','length','nolimit','order','sort','filters','filter','where','VIRTUAL','merge'];(function(_0x259856,_0x973ecb){var _0x461d7a=function(_0x8fa8ea){while(--_0x8fa8ea){_0x259856['push'](_0x259856['shift']());}};_0x461d7a(++_0x973ecb);}(_0xdb28,0x106));var _0x8db2=function(_0x32c207,_0x789152){_0x32c207=_0x32c207-0x0;var _0xfa087c=_0xdb28[_0x32c207];return _0xfa087c;};'use strict';var emlformat=require(_0x8db2('0x0'));var rimraf=require(_0x8db2('0x1'));var zipdir=require(_0x8db2('0x2'));var jsonpatch=require(_0x8db2('0x3'));var rp=require('request-promise');var moment=require(_0x8db2('0x4'));var BPromise=require(_0x8db2('0x5'));var Mustache=require(_0x8db2('0x6'));var util=require(_0x8db2('0x7'));var path=require(_0x8db2('0x8'));var sox=require('sox');var csv=require(_0x8db2('0x9'));var ejs=require(_0x8db2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8db2('0xb'));var crypto=require(_0x8db2('0xc'));var jsforce=require(_0x8db2('0xd'));var deskjs=require(_0x8db2('0xe'));var toCsv=require(_0x8db2('0x9'));var querystring=require(_0x8db2('0xf'));var Papa=require(_0x8db2('0x10'));var Redis=require('ioredis');var authService=require(_0x8db2('0x11'));var qs=require(_0x8db2('0x12'));var as=require(_0x8db2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8db2('0x14'))(_0x8db2('0x15'));var utils=require('../../config/utils');var config=require(_0x8db2('0x16'));var licenseUtil=require(_0x8db2('0x17'));var db=require(_0x8db2('0x18'))['db'];function respondWithStatusCode(_0x204f49,_0x37d017){_0x37d017=_0x37d017||0xcc;return function(_0x559fb1){if(_0x559fb1){return _0x204f49['sendStatus'](_0x37d017);}return _0x204f49[_0x8db2('0x19')](_0x37d017)[_0x8db2('0x1a')]();};}function respondWithResult(_0x350d61,_0x1d6a15){_0x1d6a15=_0x1d6a15||0xc8;return function(_0x227355){if(_0x227355){return _0x350d61[_0x8db2('0x19')](_0x1d6a15)[_0x8db2('0x1b')](_0x227355);}};}function respondWithFilteredResult(_0x3c96a7,_0x131252){return function(_0x16c8c2){if(_0x16c8c2){var _0x5489a9=typeof _0x131252[_0x8db2('0x1c')]===_0x8db2('0x1d')&&typeof _0x131252['limit']===_0x8db2('0x1d');var _0x44957d=_0x16c8c2[_0x8db2('0x1e')];var _0x3fddc2=_0x5489a9?0x0:_0x131252[_0x8db2('0x1c')];var _0x46ce14=_0x5489a9?_0x16c8c2['count']:_0x131252['offset']+_0x131252[_0x8db2('0x1f')];var _0x104e33;if(_0x46ce14>=_0x44957d){_0x46ce14=_0x44957d;_0x104e33=0xc8;}else{_0x104e33=0xce;}_0x3c96a7[_0x8db2('0x19')](_0x104e33);return _0x3c96a7[_0x8db2('0x20')]('Content-Range',_0x3fddc2+'-'+_0x46ce14+'/'+_0x44957d)[_0x8db2('0x1b')](_0x16c8c2);}return null;};}function patchUpdates(_0x36a9ff){return function(_0x260940){try{jsonpatch[_0x8db2('0x21')](_0x260940,_0x36a9ff,!![]);}catch(_0x3dbe8e){return BPromise['reject'](_0x3dbe8e);}return _0x260940[_0x8db2('0x22')]();};}function saveUpdates(_0x3e30e6,_0x18f69c){return function(_0x125be2){if(_0x125be2){return _0x125be2[_0x8db2('0x23')](_0x3e30e6)[_0x8db2('0x24')](function(_0x796ec1){return _0x796ec1;});}return null;};}function removeEntity(_0x5c6614,_0x256202){return function(_0x4f6516){if(_0x4f6516){return _0x4f6516['destroy']()['then'](function(){_0x5c6614['status'](0xcc)[_0x8db2('0x1a')]();});}};}function handleEntityNotFound(_0x29b5cd,_0x3be281){return function(_0x2baed0){if(!_0x2baed0){_0x29b5cd[_0x8db2('0x25')](0x194);}return _0x2baed0;};}function handleError(_0x8d4f54,_0x58cd9d){_0x58cd9d=_0x58cd9d||0x1f4;return function(_0x3544ba){logger[_0x8db2('0x26')](_0x3544ba[_0x8db2('0x27')]);if(_0x3544ba[_0x8db2('0x28')]){delete _0x3544ba['name'];}_0x8d4f54[_0x8db2('0x19')](_0x58cd9d)[_0x8db2('0x29')](_0x3544ba);};}exports[_0x8db2('0x2a')]=function(_0x1687ed,_0xbe5ece){var _0x21bae5={},_0xa54ea3={},_0x3124d5={'count':0x0,'rows':[]};var _0xbc5366=_['map'](db[_0x8db2('0x2b')]['rawAttributes'],function(_0x59cb77){return{'name':_0x59cb77[_0x8db2('0x2c')],'type':_0x59cb77[_0x8db2('0x2d')][_0x8db2('0x2e')]};});_0xa54ea3['model']=_[_0x8db2('0x2f')](_0xbc5366,'name');_0xa54ea3[_0x8db2('0x30')]=_[_0x8db2('0x31')](_0x1687ed[_0x8db2('0x30')]);_0xa54ea3['filters']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],_0xa54ea3[_0x8db2('0x30')]);_0x21bae5['attributes']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],qs[_0x8db2('0x33')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x33')]));_0x21bae5[_0x8db2('0x34')]=_0x21bae5[_0x8db2('0x34')][_0x8db2('0x35')]?_0x21bae5[_0x8db2('0x34')]:_0xa54ea3[_0x8db2('0x32')];if(!_0x1687ed[_0x8db2('0x30')]['hasOwnProperty'](_0x8db2('0x36'))){_0x21bae5[_0x8db2('0x1f')]=qs['limit'](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x1f')]);_0x21bae5['offset']=qs['offset'](_0x1687ed[_0x8db2('0x30')]['offset']);}_0x21bae5[_0x8db2('0x37')]=qs[_0x8db2('0x38')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x38')]);_0x21bae5['where']=qs[_0x8db2('0x39')](_['pick'](_0x1687ed[_0x8db2('0x30')],_0xa54ea3[_0x8db2('0x39')]),_0xbc5366);if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]){_0x21bae5['where']=_['merge'](_0x21bae5[_0x8db2('0x3b')],{'$or':_[_0x8db2('0x2f')](_0xbc5366,function(_0x5dc2b4){if(_0x5dc2b4[_0x8db2('0x2d')]!==_0x8db2('0x3c')){var _0x656dd2={};_0x656dd2[_0x5dc2b4['name']]={'$like':'%'+_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]+'%'};return _0x656dd2;}})});}_0x21bae5=_[_0x8db2('0x3d')]({},_0x21bae5,_0x1687ed[_0x8db2('0x3e')]);var _0x2e6f0c={'where':_0x21bae5[_0x8db2('0x3b')]};return db[_0x8db2('0x2b')][_0x8db2('0x1e')](_0x2e6f0c)[_0x8db2('0x24')](function(_0x63c561){_0x3124d5[_0x8db2('0x1e')]=_0x63c561;if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3f')]){_0x21bae5['include']=[{'attributes':['id',_0x8db2('0x28'),_0x8db2('0x40'),'alias'],'model':db['User'],'as':_0x8db2('0x41')}];}return db['VoiceCallReport'][_0x8db2('0x42')](_0x21bae5);})[_0x8db2('0x24')](function(_0x313130){_0x3124d5[_0x8db2('0x43')]=_0x313130;return _0x3124d5;})[_0x8db2('0x24')](respondWithFilteredResult(_0xbe5ece,_0x21bae5))[_0x8db2('0x44')](handleError(_0xbe5ece,null));};exports[_0x8db2('0x45')]=function(_0x5c97ef,_0x2f86b1){var _0x3d44de={'raw':!![],'where':{'id':_0x5c97ef[_0x8db2('0x46')]['id']}},_0x40c69e={};_0x40c69e['model']=_[_0x8db2('0x31')](db[_0x8db2('0x2b')][_0x8db2('0x47')]);_0x40c69e[_0x8db2('0x30')]=_['keys'](_0x5c97ef[_0x8db2('0x30')]);_0x40c69e['filters']=_[_0x8db2('0x48')](_0x40c69e[_0x8db2('0x32')],_0x40c69e[_0x8db2('0x30')]);_0x3d44de['attributes']=_['intersection'](_0x40c69e[_0x8db2('0x32')],qs['fields'](_0x5c97ef[_0x8db2('0x30')][_0x8db2('0x33')]));_0x3d44de[_0x8db2('0x34')]=_0x3d44de[_0x8db2('0x34')][_0x8db2('0x35')]?_0x3d44de[_0x8db2('0x34')]:_0x40c69e[_0x8db2('0x32')];if(_0x5c97ef[_0x8db2('0x30')][_0x8db2('0x3f')]){_0x3d44de[_0x8db2('0x49')]=[{'all':!![]}];}_0x3d44de=_[_0x8db2('0x3d')]({},_0x3d44de,_0x5c97ef[_0x8db2('0x3e')]);return db['VoiceCallReport'][_0x8db2('0x4a')](_0x3d44de)[_0x8db2('0x24')](handleEntityNotFound(_0x2f86b1,null))[_0x8db2('0x24')](respondWithResult(_0x2f86b1,null))[_0x8db2('0x44')](handleError(_0x2f86b1,null));};exports['create']=function(_0x4ffd9d,_0x11c224){return db[_0x8db2('0x2b')][_0x8db2('0x4b')](_0x4ffd9d['body'],{})['then'](respondWithResult(_0x11c224,0xc9))['catch'](handleError(_0x11c224,null));};exports[_0x8db2('0x4c')]=function(_0x368c37,_0x55c7dd){return db[_0x8db2('0x2b')][_0x8db2('0x4a')]({'where':{'id':_0x368c37[_0x8db2('0x46')]['id']}})[_0x8db2('0x24')](handleEntityNotFound(_0x55c7dd,null))['then'](removeEntity(_0x55c7dd,null))['catch'](handleError(_0x55c7dd,null));};exports[_0x8db2('0x4d')]=function(_0x18c6ef,_0x2908e4){return db[_0x8db2('0x2b')][_0x8db2('0x4d')]()[_0x8db2('0x24')](respondWithResult(_0x2908e4,null))[_0x8db2('0x44')](handleError(_0x2908e4,null));};exports[_0x8db2('0x23')]=function(_0x4187d6,_0x426ae0){if(_0x4187d6[_0x8db2('0x4e')][_0x8db2('0x4f')]){delete _0x4187d6[_0x8db2('0x4e')][_0x8db2('0x4f')];}return db[_0x8db2('0x2b')]['find']({'where':{'uniqueid':_0x4187d6[_0x8db2('0x46')]['id'],'UserId':{'$or':[null,_0x4187d6[_0x8db2('0x50')]['id']]}}})['then'](handleEntityNotFound(_0x426ae0,null))[_0x8db2('0x24')](saveUpdates(_0x4187d6[_0x8db2('0x4e')],null))[_0x8db2('0x24')](respondWithResult(_0x426ae0,null))['catch'](handleError(_0x426ae0,null));}; \ No newline at end of file +var _0xadb5=['filter','VIRTUAL','merge','options','includeAll','include','fullname','User','findAll','rows','show','rawAttributes','length','find','catch','body','params','describe','uniqueid','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','stack','name','send','index','map','VoiceCallReport','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filters'];(function(_0x559a80,_0x3d193d){var _0x42f555=function(_0x24e596){while(--_0x24e596){_0x559a80['push'](_0x559a80['shift']());}};_0x42f555(++_0x3d193d);}(_0xadb5,0xad));var _0x5adb=function(_0x94e1e5,_0x4065f8){_0x94e1e5=_0x94e1e5-0x0;var _0x262c5e=_0xadb5[_0x94e1e5];return _0x262c5e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5adb('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5adb('0x1'));var rp=require(_0x5adb('0x2'));var moment=require(_0x5adb('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5adb('0x4'));var util=require(_0x5adb('0x5'));var path=require(_0x5adb('0x6'));var sox=require('sox');var csv=require(_0x5adb('0x7'));var ejs=require(_0x5adb('0x8'));var fs=require('fs');var fs_extra=require(_0x5adb('0x9'));var _=require(_0x5adb('0xa'));var squel=require(_0x5adb('0xb'));var crypto=require(_0x5adb('0xc'));var jsforce=require(_0x5adb('0xd'));var deskjs=require(_0x5adb('0xe'));var toCsv=require(_0x5adb('0x7'));var querystring=require(_0x5adb('0xf'));var Papa=require(_0x5adb('0x10'));var Redis=require(_0x5adb('0x11'));var authService=require(_0x5adb('0x12'));var qs=require(_0x5adb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5adb('0x14'))(_0x5adb('0x15'));var utils=require(_0x5adb('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5adb('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a0b70,_0x5433bf){_0x5433bf=_0x5433bf||0xcc;return function(_0x8cfcc6){if(_0x8cfcc6){return _0x2a0b70[_0x5adb('0x18')](_0x5433bf);}return _0x2a0b70[_0x5adb('0x19')](_0x5433bf)['end']();};}function respondWithResult(_0x2a545b,_0x34af2c){_0x34af2c=_0x34af2c||0xc8;return function(_0xf82f72){if(_0xf82f72){return _0x2a545b['status'](_0x34af2c)[_0x5adb('0x1a')](_0xf82f72);}};}function respondWithFilteredResult(_0x518823,_0x367d82){return function(_0x42a482){if(_0x42a482){var _0x30614e=typeof _0x367d82[_0x5adb('0x1b')]===_0x5adb('0x1c')&&typeof _0x367d82[_0x5adb('0x1d')]===_0x5adb('0x1c');var _0x42f4c6=_0x42a482[_0x5adb('0x1e')];var _0x529b65=_0x30614e?0x0:_0x367d82[_0x5adb('0x1b')];var _0x5de028=_0x30614e?_0x42a482[_0x5adb('0x1e')]:_0x367d82['offset']+_0x367d82[_0x5adb('0x1d')];var _0x50e84f;if(_0x5de028>=_0x42f4c6){_0x5de028=_0x42f4c6;_0x50e84f=0xc8;}else{_0x50e84f=0xce;}_0x518823['status'](_0x50e84f);return _0x518823[_0x5adb('0x1f')](_0x5adb('0x20'),_0x529b65+'-'+_0x5de028+'/'+_0x42f4c6)[_0x5adb('0x1a')](_0x42a482);}return null;};}function patchUpdates(_0x1fd4a7){return function(_0x99bc6c){try{jsonpatch['apply'](_0x99bc6c,_0x1fd4a7,!![]);}catch(_0x3255b3){return BPromise['reject'](_0x3255b3);}return _0x99bc6c['save']();};}function saveUpdates(_0x3754cc,_0x379b33){return function(_0x1a38d3){if(_0x1a38d3){return _0x1a38d3[_0x5adb('0x21')](_0x3754cc)[_0x5adb('0x22')](function(_0x413911){return _0x413911;});}return null;};}function removeEntity(_0xfd9bb9,_0x4ca150){return function(_0x4b1957){if(_0x4b1957){return _0x4b1957[_0x5adb('0x23')]()[_0x5adb('0x22')](function(){_0xfd9bb9[_0x5adb('0x19')](0xcc)[_0x5adb('0x24')]();});}};}function handleEntityNotFound(_0x49f203,_0x2fee18){return function(_0x2e1e63){if(!_0x2e1e63){_0x49f203['sendStatus'](0x194);}return _0x2e1e63;};}function handleError(_0x1feecf,_0x1ded9f){_0x1ded9f=_0x1ded9f||0x1f4;return function(_0x1a0acd){logger['error'](_0x1a0acd[_0x5adb('0x25')]);if(_0x1a0acd[_0x5adb('0x26')]){delete _0x1a0acd[_0x5adb('0x26')];}_0x1feecf[_0x5adb('0x19')](_0x1ded9f)[_0x5adb('0x27')](_0x1a0acd);};}exports[_0x5adb('0x28')]=function(_0x4a5d46,_0x49992e){var _0x5d457e={},_0x39bddd={},_0x1eac55={'count':0x0,'rows':[]};var _0x60a672=_[_0x5adb('0x29')](db[_0x5adb('0x2a')]['rawAttributes'],function(_0x11ec2a){return{'name':_0x11ec2a[_0x5adb('0x2b')],'type':_0x11ec2a[_0x5adb('0x2c')][_0x5adb('0x2d')]};});_0x39bddd[_0x5adb('0x2e')]=_[_0x5adb('0x29')](_0x60a672,_0x5adb('0x26'));_0x39bddd[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x4a5d46[_0x5adb('0x2f')]);_0x39bddd['filters']=_[_0x5adb('0x31')](_0x39bddd['model'],_0x39bddd[_0x5adb('0x2f')]);_0x5d457e[_0x5adb('0x32')]=_['intersection'](_0x39bddd[_0x5adb('0x2e')],qs[_0x5adb('0x33')](_0x4a5d46[_0x5adb('0x2f')]['fields']));_0x5d457e[_0x5adb('0x32')]=_0x5d457e[_0x5adb('0x32')]['length']?_0x5d457e['attributes']:_0x39bddd[_0x5adb('0x2e')];if(!_0x4a5d46['query'][_0x5adb('0x34')](_0x5adb('0x35'))){_0x5d457e[_0x5adb('0x1d')]=qs[_0x5adb('0x1d')](_0x4a5d46[_0x5adb('0x2f')]['limit']);_0x5d457e[_0x5adb('0x1b')]=qs[_0x5adb('0x1b')](_0x4a5d46[_0x5adb('0x2f')]['offset']);}_0x5d457e['order']=qs[_0x5adb('0x36')](_0x4a5d46[_0x5adb('0x2f')]['sort']);_0x5d457e[_0x5adb('0x37')]=qs['filters'](_[_0x5adb('0x38')](_0x4a5d46['query'],_0x39bddd[_0x5adb('0x39')]),_0x60a672);if(_0x4a5d46['query'][_0x5adb('0x3a')]){_0x5d457e[_0x5adb('0x37')]=_['merge'](_0x5d457e[_0x5adb('0x37')],{'$or':_['map'](_0x60a672,function(_0xadbe37){if(_0xadbe37[_0x5adb('0x2c')]!==_0x5adb('0x3b')){var _0x50edd1={};_0x50edd1[_0xadbe37[_0x5adb('0x26')]]={'$like':'%'+_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3a')]+'%'};return _0x50edd1;}})});}_0x5d457e=_[_0x5adb('0x3c')]({},_0x5d457e,_0x4a5d46[_0x5adb('0x3d')]);var _0x52d74f={'where':_0x5d457e['where']};return db['VoiceCallReport']['count'](_0x52d74f)[_0x5adb('0x22')](function(_0x2fbe14){_0x1eac55[_0x5adb('0x1e')]=_0x2fbe14;if(_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3e')]){_0x5d457e[_0x5adb('0x3f')]=[{'attributes':['id',_0x5adb('0x26'),_0x5adb('0x40'),'alias'],'model':db['User'],'as':_0x5adb('0x41')}];}return db['VoiceCallReport'][_0x5adb('0x42')](_0x5d457e);})[_0x5adb('0x22')](function(_0x299746){_0x1eac55[_0x5adb('0x43')]=_0x299746;return _0x1eac55;})[_0x5adb('0x22')](respondWithFilteredResult(_0x49992e,_0x5d457e))['catch'](handleError(_0x49992e,null));};exports[_0x5adb('0x44')]=function(_0x565b03,_0x508690){var _0x4160ad={'raw':!![],'where':{'id':_0x565b03['params']['id']}},_0x1a256c={};_0x1a256c[_0x5adb('0x2e')]=_[_0x5adb('0x30')](db[_0x5adb('0x2a')][_0x5adb('0x45')]);_0x1a256c[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x565b03[_0x5adb('0x2f')]);_0x1a256c['filters']=_['intersection'](_0x1a256c[_0x5adb('0x2e')],_0x1a256c[_0x5adb('0x2f')]);_0x4160ad[_0x5adb('0x32')]=_[_0x5adb('0x31')](_0x1a256c['model'],qs['fields'](_0x565b03[_0x5adb('0x2f')][_0x5adb('0x33')]));_0x4160ad[_0x5adb('0x32')]=_0x4160ad[_0x5adb('0x32')][_0x5adb('0x46')]?_0x4160ad['attributes']:_0x1a256c[_0x5adb('0x2e')];if(_0x565b03[_0x5adb('0x2f')]['includeAll']){_0x4160ad[_0x5adb('0x3f')]=[{'all':!![]}];}_0x4160ad=_[_0x5adb('0x3c')]({},_0x4160ad,_0x565b03[_0x5adb('0x3d')]);return db[_0x5adb('0x2a')][_0x5adb('0x47')](_0x4160ad)[_0x5adb('0x22')](handleEntityNotFound(_0x508690,null))[_0x5adb('0x22')](respondWithResult(_0x508690,null))[_0x5adb('0x48')](handleError(_0x508690,null));};exports['create']=function(_0x3a925b,_0x57dc8b){return db['VoiceCallReport']['create'](_0x3a925b[_0x5adb('0x49')],{})[_0x5adb('0x22')](respondWithResult(_0x57dc8b,0xc9))[_0x5adb('0x48')](handleError(_0x57dc8b,null));};exports['destroy']=function(_0x2ad69d,_0x5cbab5){return db[_0x5adb('0x2a')][_0x5adb('0x47')]({'where':{'id':_0x2ad69d[_0x5adb('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5cbab5,null))[_0x5adb('0x22')](removeEntity(_0x5cbab5,null))['catch'](handleError(_0x5cbab5,null));};exports[_0x5adb('0x4b')]=function(_0x6dc067,_0x55c535){return db[_0x5adb('0x2a')][_0x5adb('0x4b')]()[_0x5adb('0x22')](respondWithResult(_0x55c535,null))[_0x5adb('0x48')](handleError(_0x55c535,null));};exports[_0x5adb('0x21')]=function(_0x4cb36c,_0x36b847){if(_0x4cb36c[_0x5adb('0x49')][_0x5adb('0x4c')]){delete _0x4cb36c[_0x5adb('0x49')]['uniqueid'];}return db[_0x5adb('0x2a')][_0x5adb('0x47')]({'where':{'uniqueid':_0x4cb36c[_0x5adb('0x4a')]['id'],'UserId':{'$or':[null,_0x4cb36c['user']['id']]}}})[_0x5adb('0x22')](handleEntityNotFound(_0x36b847,null))[_0x5adb('0x22')](saveUpdates(_0x4cb36c[_0x5adb('0x49')],null))[_0x5adb('0x22')](respondWithResult(_0x36b847,null))['catch'](handleError(_0x36b847,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 569d928..04272c3 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 _0x74ba=['request-promise','path','rimraf','./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call','uniqueid','lodash','api'];(function(_0x1930bd,_0x4963fc){var _0x2b2d26=function(_0x1aec41){while(--_0x1aec41){_0x1930bd['push'](_0x1930bd['shift']());}};_0x2b2d26(++_0x4963fc);}(_0x74ba,0x174));var _0xa74b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x74ba[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xa74b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa74b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa74b('0x2'));var fs=require('fs');var path=require(_0xa74b('0x3'));var rimraf=require(_0xa74b('0x4'));var config=require('../../config/environment');var attributes=require(_0xa74b('0x5'));module[_0xa74b('0x6')]=function(_0x594e0e,_0x39ef56){return _0x594e0e[_0xa74b('0x7')](_0xa74b('0x8'),attributes,{'tableName':_0xa74b('0x9'),'paranoid':![],'indexes':[{'fields':[_0xa74b('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1992=['lodash','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','uniqueid'];(function(_0x337233,_0xf33f60){var _0x47b3a2=function(_0x5c03c3){while(--_0x5c03c3){_0x337233['push'](_0x337233['shift']());}};_0x47b3a2(++_0xf33f60);}(_0x1992,0x17c));var _0x2199=function(_0x48b6fe,_0x363788){_0x48b6fe=_0x48b6fe-0x0;var _0x53581f=_0x1992[_0x48b6fe];return _0x53581f;};'use strict';var _=require(_0x2199('0x0'));var util=require('util');var logger=require(_0x2199('0x1'))('api');var moment=require(_0x2199('0x2'));var BPromise=require(_0x2199('0x3'));var rp=require(_0x2199('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2199('0x5'));var config=require(_0x2199('0x6'));var attributes=require('./voiceCallReport.attributes');module[_0x2199('0x7')]=function(_0x4dfe5c,_0x1a4b6a){return _0x4dfe5c[_0x2199('0x8')]('VoiceCallReport',attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':[_0x2199('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index a4523a0..bb7bc71 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 _0xa24d=['request','then','info','VoiceCallReport,\x20%s,\x20%s','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','VoiceCallReport','findAll','options','raw','map','include','model','attributes','GetVoiceCallReport','create','body','CreateVoiceCallReport','UpdateVoiceCallReport','update','where','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x5c83f3,_0x5f0b6b){var _0x1700b2=function(_0x47f7cd){while(--_0x47f7cd){_0x5c83f3['push'](_0x5c83f3['shift']());}};_0x1700b2(++_0x5f0b6b);}(_0xa24d,0x1a1));var _0xda24=function(_0x34bcbf,_0x529caf){_0x34bcbf=_0x34bcbf-0x0;var _0x4951ee=_0xa24d[_0x34bcbf];return _0x4951ee;};'use strict';var _=require(_0xda24('0x0'));var util=require(_0xda24('0x1'));var moment=require(_0xda24('0x2'));var BPromise=require(_0xda24('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xda24('0x4'));var db=require(_0xda24('0x5'))['db'];var utils=require(_0xda24('0x6'));var logger=require(_0xda24('0x7'))(_0xda24('0x8'));var config=require(_0xda24('0x9'));var jayson=require(_0xda24('0xa'));var client=jayson['client'][_0xda24('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x13e2f5,_0x21ecc4,_0x46cae2){return new BPromise(function(_0x2661ef,_0x28d38e){return client[_0xda24('0xc')](_0x13e2f5,_0x46cae2)[_0xda24('0xd')](function(_0x4d0b17){logger[_0xda24('0xe')](_0xda24('0xf'),_0x21ecc4,'request\x20sent');logger[_0xda24('0x10')](_0xda24('0x11'),_0x21ecc4,'request\x20sent',JSON[_0xda24('0x12')](_0x4d0b17));if(_0x4d0b17[_0xda24('0x13')]){if(_0x4d0b17[_0xda24('0x13')]['code']===0x1f4){logger[_0xda24('0x13')]('VoiceCallReport,\x20%s,\x20%s',_0x21ecc4,_0x4d0b17['error'][_0xda24('0x14')]);return _0x28d38e(_0x4d0b17['error'][_0xda24('0x14')]);}logger[_0xda24('0x13')](_0xda24('0xf'),_0x21ecc4,_0x4d0b17[_0xda24('0x13')][_0xda24('0x14')]);return _0x2661ef(_0x4d0b17[_0xda24('0x13')][_0xda24('0x14')]);}else{logger[_0xda24('0xe')](_0xda24('0xf'),_0x21ecc4,_0xda24('0x15'));_0x2661ef(_0x4d0b17[_0xda24('0x16')][_0xda24('0x14')]);}})[_0xda24('0x17')](function(_0x4ec2e6){logger[_0xda24('0x13')](_0xda24('0xf'),_0x21ecc4,_0x4ec2e6);_0x28d38e(_0x4ec2e6);});});}exports['GetVoiceCallReport']=function(_0x3f8efe){var _0x35e005=this;return new Promise(function(_0xc03209,_0x202ed9){return db[_0xda24('0x18')][_0xda24('0x19')]({'raw':_0x3f8efe['options']?_0x3f8efe[_0xda24('0x1a')][_0xda24('0x1b')]===undefined?!![]:![]:!![],'where':_0x3f8efe['options']?_0x3f8efe[_0xda24('0x1a')]['where']||null:null,'attributes':_0x3f8efe[_0xda24('0x1a')]?_0x3f8efe[_0xda24('0x1a')]['attributes']||null:null,'limit':_0x3f8efe[_0xda24('0x1a')]?_0x3f8efe[_0xda24('0x1a')]['limit']||null:null,'include':_0x3f8efe[_0xda24('0x1a')]?_0x3f8efe[_0xda24('0x1a')]['include']?_[_0xda24('0x1c')](_0x3f8efe[_0xda24('0x1a')][_0xda24('0x1d')],function(_0x404d5e){return{'model':db[_0x404d5e[_0xda24('0x1e')]],'as':_0x404d5e['as'],'attributes':_0x404d5e[_0xda24('0x1f')],'include':_0x404d5e[_0xda24('0x1d')]?_['map'](_0x404d5e['include'],function(_0x195e77){return{'model':db[_0x195e77[_0xda24('0x1e')]],'as':_0x195e77['as'],'attributes':_0x195e77['attributes'],'include':_0x195e77[_0xda24('0x1d')]?_[_0xda24('0x1c')](_0x195e77[_0xda24('0x1d')],function(_0x1a1c05){return{'model':db[_0x1a1c05[_0xda24('0x1e')]],'as':_0x1a1c05['as'],'attributes':_0x1a1c05[_0xda24('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xda24('0xd')](function(_0x59fae6){logger[_0xda24('0xe')](_0xda24('0x20'),_0x3f8efe);logger[_0xda24('0x10')]('GetVoiceCallReport',_0x3f8efe,JSON[_0xda24('0x12')](_0x59fae6));_0xc03209(_0x59fae6);})['catch'](function(_0x362da8){logger[_0xda24('0x13')](_0xda24('0x20'),_0x362da8[_0xda24('0x14')],_0x3f8efe);_0x202ed9(_0x35e005[_0xda24('0x13')](0x1f4,_0x362da8[_0xda24('0x14')]));});});};exports['CreateVoiceCallReport']=function(_0xd75e37){var _0xc4f1d8=this;return new Promise(function(_0x238555,_0x2ef0e2){return db['VoiceCallReport'][_0xda24('0x21')](_0xd75e37[_0xda24('0x22')],{'raw':_0xd75e37[_0xda24('0x1a')]?_0xd75e37[_0xda24('0x1a')][_0xda24('0x1b')]===undefined?!![]:![]:!![]})[_0xda24('0xd')](function(_0x806438){logger[_0xda24('0xe')](_0xda24('0x23'),_0xd75e37);logger[_0xda24('0x10')](_0xda24('0x23'),_0xd75e37,JSON['stringify'](_0x806438));_0x238555(_0x806438);})[_0xda24('0x17')](function(_0x4a2434){logger[_0xda24('0x13')](_0xda24('0x23'),_0x4a2434[_0xda24('0x14')],_0xd75e37);_0x2ef0e2(_0xc4f1d8['error'](0x1f4,_0x4a2434[_0xda24('0x14')]));});});};exports[_0xda24('0x24')]=function(_0x377504){var _0x17b0e8=this;return new Promise(function(_0x816053,_0x1ce77b){return db['VoiceCallReport'][_0xda24('0x25')](_0x377504['body'],{'raw':_0x377504[_0xda24('0x1a')]?_0x377504['options'][_0xda24('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x377504['options']?_0x377504[_0xda24('0x1a')][_0xda24('0x26')]||null:null,'attributes':_0x377504['options']?_0x377504[_0xda24('0x1a')][_0xda24('0x1f')]||null:null,'limit':_0x377504[_0xda24('0x1a')]?_0x377504[_0xda24('0x1a')]['limit']||null:null})[_0xda24('0xd')](function(_0x51c972){logger[_0xda24('0xe')](_0xda24('0x24'),_0x377504);logger[_0xda24('0x10')](_0xda24('0x24'),_0x377504,JSON[_0xda24('0x12')](_0x51c972));_0x816053(_0x51c972);})[_0xda24('0x17')](function(_0x200f8b){logger[_0xda24('0x13')](_0xda24('0x24'),_0x200f8b[_0xda24('0x14')],_0x377504);_0x1ce77b(_0x17b0e8[_0xda24('0x13')](0x1f4,_0x200f8b[_0xda24('0x14')]));});});}; \ No newline at end of file +var _0x0075=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceCallReport,\x20%s,\x20%s','result','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','where','limit','map','include','model','attributes','info','CreateVoiceCallReport','body','raw','UpdateVoiceCallReport','lodash','util','moment'];(function(_0x28566a,_0x584a69){var _0x152d46=function(_0x18c4d1){while(--_0x18c4d1){_0x28566a['push'](_0x28566a['shift']());}};_0x152d46(++_0x584a69);}(_0x0075,0xbb));var _0x5007=function(_0x3c6fb3,_0x2c2a12){_0x3c6fb3=_0x3c6fb3-0x0;var _0xe24712=_0x0075[_0x3c6fb3];return _0xe24712;};'use strict';var _=require(_0x5007('0x0'));var util=require(_0x5007('0x1'));var moment=require(_0x5007('0x2'));var BPromise=require(_0x5007('0x3'));var rs=require(_0x5007('0x4'));var fs=require('fs');var Redis=require(_0x5007('0x5'));var db=require(_0x5007('0x6'))['db'];var utils=require(_0x5007('0x7'));var logger=require(_0x5007('0x8'))('rpc');var config=require(_0x5007('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x5007('0xa')][_0x5007('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xfe2d7b,_0x269e84,_0x49eedc){return new BPromise(function(_0x47263b,_0x9252b){return client['request'](_0xfe2d7b,_0x49eedc)[_0x5007('0xc')](function(_0x313e7a){logger['info']('VoiceCallReport,\x20%s,\x20%s',_0x269e84,_0x5007('0xd'));logger[_0x5007('0xe')](_0x5007('0xf'),_0x269e84,'request\x20sent',JSON[_0x5007('0x10')](_0x313e7a));if(_0x313e7a[_0x5007('0x11')]){if(_0x313e7a[_0x5007('0x11')][_0x5007('0x12')]===0x1f4){logger[_0x5007('0x11')]('VoiceCallReport,\x20%s,\x20%s',_0x269e84,_0x313e7a[_0x5007('0x11')]['message']);return _0x9252b(_0x313e7a[_0x5007('0x11')][_0x5007('0x13')]);}logger[_0x5007('0x11')](_0x5007('0x14'),_0x269e84,_0x313e7a[_0x5007('0x11')]['message']);return _0x47263b(_0x313e7a[_0x5007('0x11')][_0x5007('0x13')]);}else{logger['info']('VoiceCallReport,\x20%s,\x20%s',_0x269e84,_0x5007('0xd'));_0x47263b(_0x313e7a[_0x5007('0x15')][_0x5007('0x13')]);}})[_0x5007('0x16')](function(_0x2ee58a){logger[_0x5007('0x11')](_0x5007('0x14'),_0x269e84,_0x2ee58a);_0x9252b(_0x2ee58a);});});}exports[_0x5007('0x17')]=function(_0x576dab){var _0x15c411=this;return new Promise(function(_0x27fc67,_0x2d3d3c){return db[_0x5007('0x18')][_0x5007('0x19')]({'raw':_0x576dab['options']?_0x576dab[_0x5007('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x576dab[_0x5007('0x1a')]?_0x576dab[_0x5007('0x1a')][_0x5007('0x1b')]||null:null,'attributes':_0x576dab['options']?_0x576dab[_0x5007('0x1a')]['attributes']||null:null,'limit':_0x576dab[_0x5007('0x1a')]?_0x576dab[_0x5007('0x1a')][_0x5007('0x1c')]||null:null,'include':_0x576dab[_0x5007('0x1a')]?_0x576dab[_0x5007('0x1a')]['include']?_[_0x5007('0x1d')](_0x576dab['options'][_0x5007('0x1e')],function(_0x36ce08){return{'model':db[_0x36ce08[_0x5007('0x1f')]],'as':_0x36ce08['as'],'attributes':_0x36ce08[_0x5007('0x20')],'include':_0x36ce08[_0x5007('0x1e')]?_['map'](_0x36ce08[_0x5007('0x1e')],function(_0x13b1a6){return{'model':db[_0x13b1a6[_0x5007('0x1f')]],'as':_0x13b1a6['as'],'attributes':_0x13b1a6[_0x5007('0x20')],'include':_0x13b1a6[_0x5007('0x1e')]?_['map'](_0x13b1a6[_0x5007('0x1e')],function(_0x4a77d4){return{'model':db[_0x4a77d4[_0x5007('0x1f')]],'as':_0x4a77d4['as'],'attributes':_0x4a77d4[_0x5007('0x20')]};}):[]};}):[]};}):[]:[]})[_0x5007('0xc')](function(_0x1c905e){logger[_0x5007('0x21')](_0x5007('0x17'),_0x576dab);logger[_0x5007('0xe')](_0x5007('0x17'),_0x576dab,JSON[_0x5007('0x10')](_0x1c905e));_0x27fc67(_0x1c905e);})[_0x5007('0x16')](function(_0x27e492){logger[_0x5007('0x11')](_0x5007('0x17'),_0x27e492[_0x5007('0x13')],_0x576dab);_0x2d3d3c(_0x15c411[_0x5007('0x11')](0x1f4,_0x27e492['message']));});});};exports[_0x5007('0x22')]=function(_0x19b9f7){var _0x2442f9=this;return new Promise(function(_0x495afa,_0xa90a97){return db[_0x5007('0x18')]['create'](_0x19b9f7[_0x5007('0x23')],{'raw':_0x19b9f7[_0x5007('0x1a')]?_0x19b9f7['options']['raw']===undefined?!![]:![]:!![]})[_0x5007('0xc')](function(_0x4ff8ae){logger[_0x5007('0x21')](_0x5007('0x22'),_0x19b9f7);logger['debug']('CreateVoiceCallReport',_0x19b9f7,JSON[_0x5007('0x10')](_0x4ff8ae));_0x495afa(_0x4ff8ae);})[_0x5007('0x16')](function(_0x4347c1){logger['error'](_0x5007('0x22'),_0x4347c1[_0x5007('0x13')],_0x19b9f7);_0xa90a97(_0x2442f9['error'](0x1f4,_0x4347c1['message']));});});};exports['UpdateVoiceCallReport']=function(_0xd780f1){var _0x43b927=this;return new Promise(function(_0x18d619,_0x3ebe00){return db['VoiceCallReport']['update'](_0xd780f1[_0x5007('0x23')],{'raw':_0xd780f1[_0x5007('0x1a')]?_0xd780f1[_0x5007('0x1a')][_0x5007('0x24')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xd780f1[_0x5007('0x1a')]?_0xd780f1[_0x5007('0x1a')]['where']||null:null,'attributes':_0xd780f1['options']?_0xd780f1['options'][_0x5007('0x20')]||null:null,'limit':_0xd780f1[_0x5007('0x1a')]?_0xd780f1[_0x5007('0x1a')]['limit']||null:null})[_0x5007('0xc')](function(_0x156c27){logger[_0x5007('0x21')](_0x5007('0x25'),_0xd780f1);logger['debug'](_0x5007('0x25'),_0xd780f1,JSON[_0x5007('0x10')](_0x156c27));_0x18d619(_0x156c27);})['catch'](function(_0x4b504){logger[_0x5007('0x11')](_0x5007('0x25'),_0x4b504['message'],_0xd780f1);_0x3ebe00(_0x43b927[_0x5007('0x11')](0x1f4,_0x4b504[_0x5007('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index c9aaf3b..4c5c041 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 _0x3078=['isAuthenticated','show','post','create','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','index','/:id'];(function(_0x1c4903,_0x2c8ecd){var _0x1f0af5=function(_0x90ceaa){while(--_0x90ceaa){_0x1c4903['push'](_0x1c4903['shift']());}};_0x1f0af5(++_0x2c8ecd);}(_0x3078,0x66));var _0x8307=function(_0x43c8de,_0x4ac946){_0x43c8de=_0x43c8de-0x0;var _0x17430a=_0x3078[_0x43c8de];return _0x17430a;};'use strict';var multer=require(_0x8307('0x0'));var util=require(_0x8307('0x1'));var path=require(_0x8307('0x2'));var timeout=require(_0x8307('0x3'));var express=require(_0x8307('0x4'));var router=express[_0x8307('0x5')]();var fs_extra=require(_0x8307('0x6'));var auth=require(_0x8307('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x8307('0x8'));var controller=require('./voiceChanSpy.controller');router[_0x8307('0x9')]('/',auth['isAuthenticated'](),controller[_0x8307('0xa')]);router[_0x8307('0x9')](_0x8307('0xb'),auth[_0x8307('0xc')](),controller[_0x8307('0xd')]);router[_0x8307('0xe')]('/',auth[_0x8307('0xc')](),controller[_0x8307('0xf')]);router['put'](_0x8307('0xb'),auth[_0x8307('0xc')](),controller[_0x8307('0x10')]);router[_0x8307('0x11')](_0x8307('0xb'),auth[_0x8307('0xc')](),controller['destroy']);module[_0x8307('0x12')]=router; \ No newline at end of file +var _0xcbde=['Router','../../components/auth/service','../../components/interaction/service','./voiceChanSpy.controller','get','/:id','isAuthenticated','post','create','put','update','delete','destroy','exports','express'];(function(_0x30c8b6,_0x5d1252){var _0x36c92e=function(_0x250291){while(--_0x250291){_0x30c8b6['push'](_0x30c8b6['shift']());}};_0x36c92e(++_0x5d1252);}(_0xcbde,0xd1));var _0xecbd=function(_0xb20a09,_0x530b82){_0xb20a09=_0xb20a09-0x0;var _0x98cc62=_0xcbde[_0xb20a09];return _0x98cc62;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xecbd('0x0'));var router=express[_0xecbd('0x1')]();var fs_extra=require('fs-extra');var auth=require(_0xecbd('0x2'));var interaction=require(_0xecbd('0x3'));var config=require('../../config/environment');var controller=require(_0xecbd('0x4'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xecbd('0x5')](_0xecbd('0x6'),auth[_0xecbd('0x7')](),controller['show']);router[_0xecbd('0x8')]('/',auth[_0xecbd('0x7')](),controller[_0xecbd('0x9')]);router[_0xecbd('0xa')](_0xecbd('0x6'),auth[_0xecbd('0x7')](),controller[_0xecbd('0xb')]);router[_0xecbd('0xc')](_0xecbd('0x6'),auth[_0xecbd('0x7')](),controller[_0xecbd('0xd')]);module[_0xecbd('0xe')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 00292b4..86c1ecd 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 _0xf75e=['BOOLEAN','sequelize','exports','STRING','setDataValue','join','options','split'];(function(_0x2bf010,_0x3c817d){var _0xaec2e0=function(_0x4879d7){while(--_0x4879d7){_0x2bf010['push'](_0x2bf010['shift']());}};_0xaec2e0(++_0x3c817d);}(_0xf75e,0x91));var _0xef75=function(_0x27e593,_0x3c9f9f){_0x27e593=_0x27e593-0x0;var _0x1cfe0f=_0xf75e[_0x27e593];return _0x1cfe0f;};'use strict';var Sequelize=require(_0xef75('0x0'));module[_0xef75('0x1')]={'name':{'type':Sequelize[_0xef75('0x2')]},'prefix':{'type':Sequelize[_0xef75('0x2')],'unique':'name','allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x113bba){this[_0xef75('0x3')]('options',_0x113bba?_0x113bba[_0xef75('0x4')](''):[]);},'get':function(){return this['getDataValue'](_0xef75('0x5'))?this['getDataValue'](_0xef75('0x5'))[_0xef75('0x6')](''):[];}},'auth':{'type':Sequelize[_0xef75('0x7')],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize[_0xef75('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xef75('0x2')]},'description':{'type':Sequelize[_0xef75('0x2')]}}; \ No newline at end of file +var _0xe6d0=['exports','STRING','name','setDataValue','options','join','getDataValue','split','BOOLEAN','sequelize'];(function(_0x1d9057,_0x32bca8){var _0x162ae5=function(_0xc179f6){while(--_0xc179f6){_0x1d9057['push'](_0x1d9057['shift']());}};_0x162ae5(++_0x32bca8);}(_0xe6d0,0x153));var _0x0e6d=function(_0x13f58e,_0x265b14){_0x13f58e=_0x13f58e-0x0;var _0x47f915=_0xe6d0[_0x13f58e];return _0x47f915;};'use strict';var Sequelize=require(_0x0e6d('0x0'));module[_0x0e6d('0x1')]={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x0e6d('0x2')],'unique':_0x0e6d('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0x0e6d('0x2')],'set':function(_0xb44bd6){this[_0x0e6d('0x4')](_0x0e6d('0x5'),_0xb44bd6?_0xb44bd6[_0x0e6d('0x6')](''):[]);},'get':function(){return this[_0x0e6d('0x7')]('options')?this[_0x0e6d('0x7')]('options')[_0x0e6d('0x8')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0x0e6d('0x2')]},'record':{'type':Sequelize[_0x0e6d('0x9')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x0e6d('0x2')]},'description':{'type':Sequelize[_0x0e6d('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 3a20ac1..1335a69 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 _0xf194=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','get','ChanSpies','UserProfileResource','end','error','stack','name','index','map','VoiceChanSpy','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','VIRTUAL','filter','options','include','findAll','rows','show','params','includeAll','merge','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','path','sox','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service'];(function(_0x327c71,_0x2d75f0){var _0x1a99e3=function(_0x40944a){while(--_0x40944a){_0x327c71['push'](_0x327c71['shift']());}};_0x1a99e3(++_0x2d75f0);}(_0xf194,0x91));var _0x4f19=function(_0x3b4151,_0x22fbf2){_0x3b4151=_0x3b4151-0x0;var _0x598d4c=_0xf194[_0x3b4151];return _0x598d4c;};'use strict';var emlformat=require(_0x4f19('0x0'));var rimraf=require(_0x4f19('0x1'));var zipdir=require(_0x4f19('0x2'));var jsonpatch=require(_0x4f19('0x3'));var rp=require('request-promise');var moment=require(_0x4f19('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x4f19('0x5'));var sox=require(_0x4f19('0x6'));var csv=require(_0x4f19('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4f19('0x8'));var _=require(_0x4f19('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4f19('0xa'));var deskjs=require(_0x4f19('0xb'));var toCsv=require(_0x4f19('0x7'));var querystring=require(_0x4f19('0xc'));var Papa=require('papaparse');var Redis=require(_0x4f19('0xd'));var authService=require(_0x4f19('0xe'));var qs=require(_0x4f19('0xf'));var as=require(_0x4f19('0x10'));var hardwareService=require(_0x4f19('0x11'));var logger=require(_0x4f19('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4f19('0x13'));var db=require(_0x4f19('0x14'))['db'];function respondWithStatusCode(_0x5f4f1d,_0x6280a0){_0x6280a0=_0x6280a0||0xcc;return function(_0x26348c){if(_0x26348c){return _0x5f4f1d[_0x4f19('0x15')](_0x6280a0);}return _0x5f4f1d[_0x4f19('0x16')](_0x6280a0)['end']();};}function respondWithResult(_0x144e21,_0x25e5ce){_0x25e5ce=_0x25e5ce||0xc8;return function(_0x4b7198){if(_0x4b7198){return _0x144e21[_0x4f19('0x16')](_0x25e5ce)[_0x4f19('0x17')](_0x4b7198);}};}function respondWithFilteredResult(_0x5b77b1,_0x298562){return function(_0x55e1f8){if(_0x55e1f8){var _0x33bded=typeof _0x298562[_0x4f19('0x18')]==='undefined'&&typeof _0x298562['limit']===_0x4f19('0x19');var _0x34f0dc=_0x55e1f8[_0x4f19('0x1a')];var _0x576eef=_0x33bded?0x0:_0x298562[_0x4f19('0x18')];var _0x205fee=_0x33bded?_0x55e1f8[_0x4f19('0x1a')]:_0x298562[_0x4f19('0x18')]+_0x298562[_0x4f19('0x1b')];var _0x5915a2;if(_0x205fee>=_0x34f0dc){_0x205fee=_0x34f0dc;_0x5915a2=0xc8;}else{_0x5915a2=0xce;}_0x5b77b1[_0x4f19('0x16')](_0x5915a2);return _0x5b77b1[_0x4f19('0x1c')]('Content-Range',_0x576eef+'-'+_0x205fee+'/'+_0x34f0dc)[_0x4f19('0x17')](_0x55e1f8);}return null;};}function patchUpdates(_0x14ff93){return function(_0x3312f8){try{jsonpatch[_0x4f19('0x1d')](_0x3312f8,_0x14ff93,!![]);}catch(_0x5ee94d){return BPromise[_0x4f19('0x1e')](_0x5ee94d);}return _0x3312f8[_0x4f19('0x1f')]();};}function saveUpdates(_0x13cdcb,_0xcbe002){return function(_0x11a272){if(_0x11a272){return _0x11a272[_0x4f19('0x20')](_0x13cdcb)[_0x4f19('0x21')](function(_0x40c007){return _0x40c007;});}return null;};}function removeEntity(_0x9e3298,_0x10e164){return function(_0x4531f4){if(_0x4531f4){return _0x4531f4[_0x4f19('0x22')]()[_0x4f19('0x21')](function(){var _0x3457a4=_0x4531f4[_0x4f19('0x23')]({'plain':!![]});var _0x39cb12=_0x4f19('0x24');return db[_0x4f19('0x25')][_0x4f19('0x22')]({'where':{'type':_0x39cb12,'resourceId':_0x3457a4['id']}})['then'](function(){return _0x4531f4;});})[_0x4f19('0x21')](function(){_0x9e3298['status'](0xcc)[_0x4f19('0x26')]();});}};}function handleEntityNotFound(_0x515956,_0x759454){return function(_0x5321a8){if(!_0x5321a8){_0x515956[_0x4f19('0x15')](0x194);}return _0x5321a8;};}function handleError(_0x22f4ad,_0xc37e6f){_0xc37e6f=_0xc37e6f||0x1f4;return function(_0x567bd2){logger[_0x4f19('0x27')](_0x567bd2[_0x4f19('0x28')]);if(_0x567bd2[_0x4f19('0x29')]){delete _0x567bd2[_0x4f19('0x29')];}_0x22f4ad[_0x4f19('0x16')](_0xc37e6f)['send'](_0x567bd2);};}exports[_0x4f19('0x2a')]=function(_0xa6789b,_0x4eceaa){var _0x3531d9={},_0x3c7e22={},_0x4505df={'count':0x0,'rows':[]};var _0x1f38a7=_[_0x4f19('0x2b')](db[_0x4f19('0x2c')]['rawAttributes'],function(_0x27e96d){return{'name':_0x27e96d[_0x4f19('0x2d')],'type':_0x27e96d[_0x4f19('0x2e')]['key']};});_0x3c7e22[_0x4f19('0x2f')]=_[_0x4f19('0x2b')](_0x1f38a7,_0x4f19('0x29'));_0x3c7e22[_0x4f19('0x30')]=_[_0x4f19('0x31')](_0xa6789b[_0x4f19('0x30')]);_0x3c7e22['filters']=_[_0x4f19('0x32')](_0x3c7e22[_0x4f19('0x2f')],_0x3c7e22['query']);_0x3531d9[_0x4f19('0x33')]=_[_0x4f19('0x32')](_0x3c7e22[_0x4f19('0x2f')],qs[_0x4f19('0x34')](_0xa6789b[_0x4f19('0x30')][_0x4f19('0x34')]));_0x3531d9[_0x4f19('0x33')]=_0x3531d9['attributes'][_0x4f19('0x35')]?_0x3531d9[_0x4f19('0x33')]:_0x3c7e22[_0x4f19('0x2f')];if(!_0xa6789b[_0x4f19('0x30')][_0x4f19('0x36')](_0x4f19('0x37'))){_0x3531d9[_0x4f19('0x1b')]=qs[_0x4f19('0x1b')](_0xa6789b[_0x4f19('0x30')]['limit']);_0x3531d9[_0x4f19('0x18')]=qs[_0x4f19('0x18')](_0xa6789b[_0x4f19('0x30')][_0x4f19('0x18')]);}_0x3531d9[_0x4f19('0x38')]=qs['sort'](_0xa6789b['query'][_0x4f19('0x39')]);_0x3531d9[_0x4f19('0x3a')]=qs['filters'](_['pick'](_0xa6789b[_0x4f19('0x30')],_0x3c7e22[_0x4f19('0x3b')]),_0x1f38a7);if(_0xa6789b['query']['filter']){_0x3531d9[_0x4f19('0x3a')]=_['merge'](_0x3531d9[_0x4f19('0x3a')],{'$or':_[_0x4f19('0x2b')](_0x1f38a7,function(_0x23a565){if(_0x23a565[_0x4f19('0x2e')]!==_0x4f19('0x3c')){var _0x3a0648={};_0x3a0648[_0x23a565[_0x4f19('0x29')]]={'$like':'%'+_0xa6789b[_0x4f19('0x30')][_0x4f19('0x3d')]+'%'};return _0x3a0648;}})});}_0x3531d9=_['merge']({},_0x3531d9,_0xa6789b[_0x4f19('0x3e')]);var _0x485c2a={'where':_0x3531d9[_0x4f19('0x3a')]};return db[_0x4f19('0x2c')][_0x4f19('0x1a')](_0x485c2a)[_0x4f19('0x21')](function(_0x26b18e){_0x4505df[_0x4f19('0x1a')]=_0x26b18e;if(_0xa6789b['query']['includeAll']){_0x3531d9[_0x4f19('0x3f')]=[{'all':!![]}];}return db[_0x4f19('0x2c')][_0x4f19('0x40')](_0x3531d9);})['then'](function(_0x41257f){_0x4505df[_0x4f19('0x41')]=_0x41257f;return _0x4505df;})[_0x4f19('0x21')](respondWithFilteredResult(_0x4eceaa,_0x3531d9))['catch'](handleError(_0x4eceaa,null));};exports[_0x4f19('0x42')]=function(_0x2a58a2,_0x350463){var _0x565c54={'raw':![],'where':{'id':_0x2a58a2[_0x4f19('0x43')]['id']}},_0x4c070c={};_0x4c070c[_0x4f19('0x2f')]=_[_0x4f19('0x31')](db['VoiceChanSpy']['rawAttributes']);_0x4c070c[_0x4f19('0x30')]=_[_0x4f19('0x31')](_0x2a58a2[_0x4f19('0x30')]);_0x4c070c[_0x4f19('0x3b')]=_[_0x4f19('0x32')](_0x4c070c[_0x4f19('0x2f')],_0x4c070c[_0x4f19('0x30')]);_0x565c54[_0x4f19('0x33')]=_[_0x4f19('0x32')](_0x4c070c[_0x4f19('0x2f')],qs['fields'](_0x2a58a2[_0x4f19('0x30')][_0x4f19('0x34')]));_0x565c54[_0x4f19('0x33')]=_0x565c54[_0x4f19('0x33')][_0x4f19('0x35')]?_0x565c54[_0x4f19('0x33')]:_0x4c070c[_0x4f19('0x2f')];if(_0x2a58a2[_0x4f19('0x30')][_0x4f19('0x44')]){_0x565c54[_0x4f19('0x3f')]=[{'all':!![]}];}_0x565c54=_[_0x4f19('0x45')]({},_0x565c54,_0x2a58a2['options']);return db[_0x4f19('0x2c')]['find'](_0x565c54)['then'](handleEntityNotFound(_0x350463,null))[_0x4f19('0x21')](respondWithResult(_0x350463,null))[_0x4f19('0x46')](handleError(_0x350463,null));};exports[_0x4f19('0x47')]=function(_0x3f08f3,_0x4b7c50){return db['VoiceChanSpy']['create'](_0x3f08f3['body'],{})['then'](function(_0x59b761){var _0x5b72ad=_0x3f08f3[_0x4f19('0x48')][_0x4f19('0x23')]({'plain':!![]});if(!_0x5b72ad)throw new Error(_0x4f19('0x49'));if(_0x5b72ad[_0x4f19('0x4a')]===_0x4f19('0x48')){var _0x327a96=_0x59b761['get']({'plain':!![]});var _0x454f0f=_0x4f19('0x24');return db[_0x4f19('0x4b')][_0x4f19('0x4c')]({'where':{'name':_0x454f0f,'userProfileId':_0x5b72ad['userProfileId']},'raw':!![]})['then'](function(_0xd88444){if(_0xd88444&&_0xd88444[_0x4f19('0x4d')]===0x0){return db[_0x4f19('0x25')]['create']({'name':_0x327a96[_0x4f19('0x29')],'resourceId':_0x327a96['id'],'type':_0xd88444[_0x4f19('0x29')],'sectionId':_0xd88444['id']},{})[_0x4f19('0x21')](function(){return _0x59b761;});}else{return _0x59b761;}})[_0x4f19('0x46')](function(_0xbf80ab){logger[_0x4f19('0x27')](_0x4f19('0x4e'),_0xbf80ab);throw _0xbf80ab;});}return _0x59b761;})[_0x4f19('0x21')](respondWithResult(_0x4b7c50,0xc9))['catch'](handleError(_0x4b7c50,null));};exports[_0x4f19('0x20')]=function(_0x6330c3,_0x10966e){if(_0x6330c3[_0x4f19('0x4f')]['id']){delete _0x6330c3[_0x4f19('0x4f')]['id'];}return db[_0x4f19('0x2c')][_0x4f19('0x4c')]({'where':{'id':_0x6330c3[_0x4f19('0x43')]['id']}})['then'](handleEntityNotFound(_0x10966e,null))[_0x4f19('0x21')](saveUpdates(_0x6330c3['body'],null))['then'](respondWithResult(_0x10966e,null))[_0x4f19('0x46')](handleError(_0x10966e,null));};exports[_0x4f19('0x22')]=function(_0x45694e,_0x7b4bf){return db[_0x4f19('0x2c')][_0x4f19('0x4c')]({'where':{'id':_0x45694e[_0x4f19('0x43')]['id']}})[_0x4f19('0x21')](handleEntityNotFound(_0x7b4bf,null))['then'](removeEntity(_0x7b4bf,null))[_0x4f19('0x46')](handleError(_0x7b4bf,null));}; \ No newline at end of file +var _0x938c=['api','../../config/utils','../../config/license/util','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','then','ChanSpies','UserProfileResource','destroy','sendStatus','error','name','send','map','VoiceChanSpy','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','sort','where','pick','merge','filter','options','include','findAll','rows','catch','show','params','length','includeAll','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','update','eml-format','rimraf','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x20d39b,_0x189175){var _0x103eea=function(_0x30ec4a){while(--_0x30ec4a){_0x20d39b['push'](_0x20d39b['shift']());}};_0x103eea(++_0x189175);}(_0x938c,0x11f));var _0xc938=function(_0x2e94e0,_0x46284a){_0x2e94e0=_0x2e94e0-0x0;var _0x503f1e=_0x938c[_0x2e94e0];return _0x503f1e;};'use strict';var emlformat=require(_0xc938('0x0'));var rimraf=require(_0xc938('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc938('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc938('0x3'));var Mustache=require('mustache');var util=require(_0xc938('0x4'));var path=require(_0xc938('0x5'));var sox=require(_0xc938('0x6'));var csv=require(_0xc938('0x7'));var ejs=require(_0xc938('0x8'));var fs=require('fs');var fs_extra=require(_0xc938('0x9'));var _=require('lodash');var squel=require(_0xc938('0xa'));var crypto=require(_0xc938('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xc938('0xc'));var toCsv=require(_0xc938('0x7'));var querystring=require('querystring');var Papa=require(_0xc938('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc938('0xe'));var as=require(_0xc938('0xf'));var hardwareService=require(_0xc938('0x10'));var logger=require('../../config/logger')(_0xc938('0x11'));var utils=require(_0xc938('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xc938('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3020c0,_0x134bef){_0x134bef=_0x134bef||0xcc;return function(_0x3ec5e5){if(_0x3ec5e5){return _0x3020c0['sendStatus'](_0x134bef);}return _0x3020c0[_0xc938('0x14')](_0x134bef)[_0xc938('0x15')]();};}function respondWithResult(_0x416c26,_0x4d9dab){_0x4d9dab=_0x4d9dab||0xc8;return function(_0x4bc776){if(_0x4bc776){return _0x416c26['status'](_0x4d9dab)[_0xc938('0x16')](_0x4bc776);}};}function respondWithFilteredResult(_0x271c1d,_0x34e3a7){return function(_0x52a56b){if(_0x52a56b){var _0x143c42=typeof _0x34e3a7['offset']===_0xc938('0x17')&&typeof _0x34e3a7[_0xc938('0x18')]==='undefined';var _0x278c2d=_0x52a56b[_0xc938('0x19')];var _0x4ef24e=_0x143c42?0x0:_0x34e3a7[_0xc938('0x1a')];var _0x566758=_0x143c42?_0x52a56b[_0xc938('0x19')]:_0x34e3a7[_0xc938('0x1a')]+_0x34e3a7[_0xc938('0x18')];var _0x523bf1;if(_0x566758>=_0x278c2d){_0x566758=_0x278c2d;_0x523bf1=0xc8;}else{_0x523bf1=0xce;}_0x271c1d[_0xc938('0x14')](_0x523bf1);return _0x271c1d[_0xc938('0x1b')](_0xc938('0x1c'),_0x4ef24e+'-'+_0x566758+'/'+_0x278c2d)[_0xc938('0x16')](_0x52a56b);}return null;};}function patchUpdates(_0x33d533){return function(_0x474d1b){try{jsonpatch[_0xc938('0x1d')](_0x474d1b,_0x33d533,!![]);}catch(_0x2675d1){return BPromise['reject'](_0x2675d1);}return _0x474d1b[_0xc938('0x1e')]();};}function saveUpdates(_0xc4b20f,_0x5858b7){return function(_0xa43304){if(_0xa43304){return _0xa43304['update'](_0xc4b20f)[_0xc938('0x1f')](function(_0x4b8aac){return _0x4b8aac;});}return null;};}function removeEntity(_0x196481,_0x388391){return function(_0x20734d){if(_0x20734d){return _0x20734d['destroy']()[_0xc938('0x1f')](function(){var _0x229c62=_0x20734d['get']({'plain':!![]});var _0x4902fa=_0xc938('0x20');return db[_0xc938('0x21')][_0xc938('0x22')]({'where':{'type':_0x4902fa,'resourceId':_0x229c62['id']}})[_0xc938('0x1f')](function(){return _0x20734d;});})[_0xc938('0x1f')](function(){_0x196481[_0xc938('0x14')](0xcc)[_0xc938('0x15')]();});}};}function handleEntityNotFound(_0x156126,_0x2f1c44){return function(_0x232362){if(!_0x232362){_0x156126[_0xc938('0x23')](0x194);}return _0x232362;};}function handleError(_0x3334cb,_0x1a149f){_0x1a149f=_0x1a149f||0x1f4;return function(_0xa84e9){logger[_0xc938('0x24')](_0xa84e9['stack']);if(_0xa84e9[_0xc938('0x25')]){delete _0xa84e9[_0xc938('0x25')];}_0x3334cb[_0xc938('0x14')](_0x1a149f)[_0xc938('0x26')](_0xa84e9);};}exports['index']=function(_0x328dd7,_0x3056f4){var _0x1bc0a8={},_0xeb24d={},_0x373200={'count':0x0,'rows':[]};var _0x186c4e=_[_0xc938('0x27')](db[_0xc938('0x28')][_0xc938('0x29')],function(_0x5284ba){return{'name':_0x5284ba[_0xc938('0x2a')],'type':_0x5284ba[_0xc938('0x2b')][_0xc938('0x2c')]};});_0xeb24d[_0xc938('0x2d')]=_[_0xc938('0x27')](_0x186c4e,_0xc938('0x25'));_0xeb24d[_0xc938('0x2e')]=_[_0xc938('0x2f')](_0x328dd7[_0xc938('0x2e')]);_0xeb24d[_0xc938('0x30')]=_[_0xc938('0x31')](_0xeb24d[_0xc938('0x2d')],_0xeb24d['query']);_0x1bc0a8[_0xc938('0x32')]=_[_0xc938('0x31')](_0xeb24d[_0xc938('0x2d')],qs['fields'](_0x328dd7[_0xc938('0x2e')][_0xc938('0x33')]));_0x1bc0a8['attributes']=_0x1bc0a8[_0xc938('0x32')]['length']?_0x1bc0a8['attributes']:_0xeb24d[_0xc938('0x2d')];if(!_0x328dd7[_0xc938('0x2e')]['hasOwnProperty'](_0xc938('0x34'))){_0x1bc0a8[_0xc938('0x18')]=qs[_0xc938('0x18')](_0x328dd7['query'][_0xc938('0x18')]);_0x1bc0a8['offset']=qs[_0xc938('0x1a')](_0x328dd7[_0xc938('0x2e')]['offset']);}_0x1bc0a8['order']=qs['sort'](_0x328dd7[_0xc938('0x2e')][_0xc938('0x35')]);_0x1bc0a8[_0xc938('0x36')]=qs[_0xc938('0x30')](_[_0xc938('0x37')](_0x328dd7[_0xc938('0x2e')],_0xeb24d[_0xc938('0x30')]),_0x186c4e);if(_0x328dd7[_0xc938('0x2e')]['filter']){_0x1bc0a8[_0xc938('0x36')]=_[_0xc938('0x38')](_0x1bc0a8[_0xc938('0x36')],{'$or':_[_0xc938('0x27')](_0x186c4e,function(_0x5e0698){if(_0x5e0698['type']!=='VIRTUAL'){var _0x2d36e4={};_0x2d36e4[_0x5e0698[_0xc938('0x25')]]={'$like':'%'+_0x328dd7[_0xc938('0x2e')][_0xc938('0x39')]+'%'};return _0x2d36e4;}})});}_0x1bc0a8=_[_0xc938('0x38')]({},_0x1bc0a8,_0x328dd7[_0xc938('0x3a')]);var _0x4513f9={'where':_0x1bc0a8['where']};return db[_0xc938('0x28')][_0xc938('0x19')](_0x4513f9)[_0xc938('0x1f')](function(_0x1ae77a){_0x373200['count']=_0x1ae77a;if(_0x328dd7[_0xc938('0x2e')]['includeAll']){_0x1bc0a8[_0xc938('0x3b')]=[{'all':!![]}];}return db['VoiceChanSpy'][_0xc938('0x3c')](_0x1bc0a8);})[_0xc938('0x1f')](function(_0x3c4667){_0x373200[_0xc938('0x3d')]=_0x3c4667;return _0x373200;})[_0xc938('0x1f')](respondWithFilteredResult(_0x3056f4,_0x1bc0a8))[_0xc938('0x3e')](handleError(_0x3056f4,null));};exports[_0xc938('0x3f')]=function(_0x56a7c4,_0x44a13e){var _0x2f9285={'raw':![],'where':{'id':_0x56a7c4[_0xc938('0x40')]['id']}},_0x22338a={};_0x22338a[_0xc938('0x2d')]=_[_0xc938('0x2f')](db[_0xc938('0x28')][_0xc938('0x29')]);_0x22338a[_0xc938('0x2e')]=_[_0xc938('0x2f')](_0x56a7c4[_0xc938('0x2e')]);_0x22338a[_0xc938('0x30')]=_[_0xc938('0x31')](_0x22338a['model'],_0x22338a['query']);_0x2f9285['attributes']=_['intersection'](_0x22338a[_0xc938('0x2d')],qs[_0xc938('0x33')](_0x56a7c4[_0xc938('0x2e')][_0xc938('0x33')]));_0x2f9285[_0xc938('0x32')]=_0x2f9285[_0xc938('0x32')][_0xc938('0x41')]?_0x2f9285[_0xc938('0x32')]:_0x22338a['model'];if(_0x56a7c4['query'][_0xc938('0x42')]){_0x2f9285[_0xc938('0x3b')]=[{'all':!![]}];}_0x2f9285=_['merge']({},_0x2f9285,_0x56a7c4[_0xc938('0x3a')]);return db[_0xc938('0x28')][_0xc938('0x43')](_0x2f9285)['then'](handleEntityNotFound(_0x44a13e,null))[_0xc938('0x1f')](respondWithResult(_0x44a13e,null))[_0xc938('0x3e')](handleError(_0x44a13e,null));};exports[_0xc938('0x44')]=function(_0x1a9bd7,_0x390b40){return db['VoiceChanSpy']['create'](_0x1a9bd7[_0xc938('0x45')],{})['then'](function(_0x38435a){var _0x45e4ba=_0x1a9bd7['user'][_0xc938('0x46')]({'plain':!![]});if(!_0x45e4ba)throw new Error(_0xc938('0x47'));if(_0x45e4ba['role']===_0xc938('0x48')){var _0x130abf=_0x38435a['get']({'plain':!![]});var _0x2fe7fc='ChanSpies';return db[_0xc938('0x49')][_0xc938('0x43')]({'where':{'name':_0x2fe7fc,'userProfileId':_0x45e4ba['userProfileId']},'raw':!![]})[_0xc938('0x1f')](function(_0x44b058){if(_0x44b058&&_0x44b058[_0xc938('0x4a')]===0x0){return db[_0xc938('0x21')][_0xc938('0x44')]({'name':_0x130abf[_0xc938('0x25')],'resourceId':_0x130abf['id'],'type':_0x44b058['name'],'sectionId':_0x44b058['id']},{})[_0xc938('0x1f')](function(){return _0x38435a;});}else{return _0x38435a;}})[_0xc938('0x3e')](function(_0x28bbfd){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x28bbfd);throw _0x28bbfd;});}return _0x38435a;})['then'](respondWithResult(_0x390b40,0xc9))[_0xc938('0x3e')](handleError(_0x390b40,null));};exports[_0xc938('0x4b')]=function(_0x43af75,_0x37fe9b){if(_0x43af75[_0xc938('0x45')]['id']){delete _0x43af75[_0xc938('0x45')]['id'];}return db[_0xc938('0x28')]['find']({'where':{'id':_0x43af75['params']['id']}})[_0xc938('0x1f')](handleEntityNotFound(_0x37fe9b,null))[_0xc938('0x1f')](saveUpdates(_0x43af75[_0xc938('0x45')],null))[_0xc938('0x1f')](respondWithResult(_0x37fe9b,null))[_0xc938('0x3e')](handleError(_0x37fe9b,null));};exports[_0xc938('0x22')]=function(_0x48114f,_0x551536){return db[_0xc938('0x28')][_0xc938('0x43')]({'where':{'id':_0x48114f[_0xc938('0x40')]['id']}})[_0xc938('0x1f')](handleEntityNotFound(_0x551536,null))[_0xc938('0x1f')](removeEntity(_0x551536,null))[_0xc938('0x3e')](handleError(_0x551536,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index d15f11b..6686fcf 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 _0x4a05=['models','define','VoiceChanSpy','voice_chanspy','then','bulkCreate','VoiceExtension','destroy','lodash','bluebird','./voiceChanSpy.attributes','context','%s%s','prefix','system','push','merge','Set','CDR(type)=%s','chanspy','record','MixMonitor','auth','Authenticate','ChanSpy','format','SIP/%s,%s','name','options','join','length','concat','internal','User','findAll','agent','catch','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4a05,0x138));var _0x54a0=function(_0x2fe9d3,_0x2fcde6){_0x2fe9d3=_0x2fe9d3-0x0;var _0x16f31b=_0x4a05[_0x2fe9d3];return _0x16f31b;};'use strict';var _=require(_0x54a0('0x0'));var util=require('util');var BPromise=require(_0x54a0('0x1'));var attributes=require(_0x54a0('0x2'));var getUserApplications=function(_0x39759a,_0x9d6815,_0x142e6d){var _0x3b8502=0x1;var _0x391080=[];var _0x325fec={'context':_0x9d6815[_0x54a0('0x3')]||'from-sip','exten':util['format'](_0x54a0('0x4'),_0x39759a[_0x54a0('0x5')],_0x142e6d),'type':_0x54a0('0x6'),'isApp':![],'ChanSpyId':_0x39759a['id'],'UserId':_0x9d6815['id']};_0x391080[_0x54a0('0x7')](_[_0x54a0('0x8')]({'app':_0x54a0('0x9'),'appdata':util['format'](_0x54a0('0xa'),_0x54a0('0xb')),'priority':_0x3b8502++},_0x325fec));if(_0x39759a[_0x54a0('0xc')]){_0x391080[_0x54a0('0x7')](_[_0x54a0('0x8')]({'app':_0x54a0('0xd'),'appdata':util['format']('${UNIQUEID}.%s,a',_0x39759a['recordingFormat']),'priority':_0x3b8502++},_0x325fec));}if(_0x39759a[_0x54a0('0xe')]){_0x391080[_0x54a0('0x7')](_[_0x54a0('0x8')]({'app':_0x54a0('0xf'),'appdata':_0x39759a['password'],'priority':_0x3b8502++},_0x325fec));}_0x391080[_0x54a0('0x7')](_['merge']({'app':_0x54a0('0x10'),'appdata':util[_0x54a0('0x11')](_0x54a0('0x12'),_0x9d6815[_0x54a0('0x13')],_0x39759a[_0x54a0('0x14')]?_0x39759a[_0x54a0('0x14')][_0x54a0('0x15')](''):''),'priority':_0x3b8502++},_0x325fec));if(_0x39759a[_0x54a0('0xc')]){_0x391080[_0x54a0('0x7')](_[_0x54a0('0x8')]({'app':'StopMixMonitor','priority':_0x3b8502++},_0x325fec));}return _0x391080;};var getChanSpyApplications=function(_0x22bb4e,_0x11b708){var _0x5bed72=[];for(var _0x1bd180=0x0,_0x26f811=0x1;_0x1bd180<_0x11b708[_0x54a0('0x16')];_0x1bd180++,_0x26f811=0x1){_0x5bed72=_0x5bed72[_0x54a0('0x17')](getUserApplications(_0x22bb4e,_0x11b708[_0x1bd180],_0x11b708[_0x1bd180][_0x54a0('0x18')]));if(_0x11b708[_0x1bd180][_0x54a0('0x18')]!=_0x11b708[_0x1bd180]['name']){_0x5bed72=_0x5bed72[_0x54a0('0x17')](getUserApplications(_0x22bb4e,_0x11b708[_0x1bd180],_0x11b708[_0x1bd180][_0x54a0('0x13')]));}}return _0x5bed72;};var getChanSpyPromise=function(_0x24561a,_0xfd8e97){return new BPromise(function(_0x5118dc,_0x345b36){return _0x24561a[_0x54a0('0x19')][_0x54a0('0x1a')]({'attributes':['id',_0x54a0('0x13'),_0x54a0('0x18')],'where':{'role':_0x54a0('0x1b'),'chanspy':!![]},'raw':!![]})['then'](function(_0x2c6eef){if(_0x2c6eef){return _0x5118dc(getChanSpyApplications(_0xfd8e97,_0x2c6eef));}return _0x5118dc([]);})[_0x54a0('0x1c')](function(_0x51f11f){_0x345b36(_0x51f11f);});});};module[_0x54a0('0x1d')]=function(_0x2687e0,_0xd6c0cf){var _0x4ad256=_0x2687e0[_0x54a0('0x1e')];return _0x2687e0[_0x54a0('0x1f')](_0x54a0('0x20'),attributes,{'tableName':_0x54a0('0x21'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3eb355,_0x5e08f3,_0x46de34){return getChanSpyPromise(_0x4ad256,_0x3eb355)[_0x54a0('0x22')](function(_0x35a0f4){if(_0x35a0f4&&_0x35a0f4[_0x54a0('0x16')]){return _0x4ad256['VoiceExtension'][_0x54a0('0x23')](_0x35a0f4);}})[_0x54a0('0x22')](function(){_0x46de34();})[_0x54a0('0x1c')](function(_0x5ccd3d){_0x46de34(_0x5ccd3d);});},'afterUpdate':function(_0x19f37a,_0x5a3943,_0x4009a1){return _0x4ad256[_0x54a0('0x24')][_0x54a0('0x25')]({'where':{'ChanSpyId':_0x19f37a['id']}})[_0x54a0('0x22')](function(){return getChanSpyPromise(_0x4ad256,_0x19f37a);})[_0x54a0('0x22')](function(_0xf2bc87){if(_0xf2bc87&&_0xf2bc87[_0x54a0('0x16')]){return _0x4ad256[_0x54a0('0x24')][_0x54a0('0x23')](_0xf2bc87);}})['then'](function(){_0x4009a1();})['catch'](function(_0x593886){_0x4009a1(_0x593886);});},'afterDestroy':function(_0x2e32f1,_0x35900a,_0x11839d){return _0x4ad256[_0x54a0('0x24')][_0x54a0('0x25')]({'where':{'ChanSpyId':_0x2e32f1['id']}})[_0x54a0('0x22')](function(){_0x11839d();})[_0x54a0('0x1c')](function(_0x2b9807){_0x11839d(_0x2b9807);});}}});}; \ No newline at end of file +var _0x28f5=['record','merge','MixMonitor','${UNIQUEID}.%s,a','auth','Authenticate','password','push','ChanSpy','SIP/%s,%s','name','options','join','length','internal','concat','User','findAll','agent','then','catch','exports','models','VoiceChanSpy','voice_chanspy','bulkCreate','VoiceExtension','destroy','lodash','bluebird','./voiceChanSpy.attributes','from-sip','format','prefix','system','Set','CDR(type)=%s','chanspy'];(function(_0x1ff454,_0x12372d){var _0x5dcf92=function(_0x2f026a){while(--_0x2f026a){_0x1ff454['push'](_0x1ff454['shift']());}};_0x5dcf92(++_0x12372d);}(_0x28f5,0x68));var _0x528f=function(_0x4f8e64,_0x381ed2){_0x4f8e64=_0x4f8e64-0x0;var _0x360529=_0x28f5[_0x4f8e64];return _0x360529;};'use strict';var _=require(_0x528f('0x0'));var util=require('util');var BPromise=require(_0x528f('0x1'));var attributes=require(_0x528f('0x2'));var getUserApplications=function(_0x4db407,_0x15fc8c,_0x26dc3a){var _0x229b57=0x1;var _0xfc533c=[];var _0x234d50={'context':_0x15fc8c['context']||_0x528f('0x3'),'exten':util[_0x528f('0x4')]('%s%s',_0x4db407[_0x528f('0x5')],_0x26dc3a),'type':_0x528f('0x6'),'isApp':![],'ChanSpyId':_0x4db407['id'],'UserId':_0x15fc8c['id']};_0xfc533c['push'](_['merge']({'app':_0x528f('0x7'),'appdata':util['format'](_0x528f('0x8'),_0x528f('0x9')),'priority':_0x229b57++},_0x234d50));if(_0x4db407[_0x528f('0xa')]){_0xfc533c['push'](_[_0x528f('0xb')]({'app':_0x528f('0xc'),'appdata':util['format'](_0x528f('0xd'),_0x4db407['recordingFormat']),'priority':_0x229b57++},_0x234d50));}if(_0x4db407[_0x528f('0xe')]){_0xfc533c['push'](_[_0x528f('0xb')]({'app':_0x528f('0xf'),'appdata':_0x4db407[_0x528f('0x10')],'priority':_0x229b57++},_0x234d50));}_0xfc533c[_0x528f('0x11')](_[_0x528f('0xb')]({'app':_0x528f('0x12'),'appdata':util['format'](_0x528f('0x13'),_0x15fc8c[_0x528f('0x14')],_0x4db407[_0x528f('0x15')]?_0x4db407[_0x528f('0x15')][_0x528f('0x16')](''):''),'priority':_0x229b57++},_0x234d50));if(_0x4db407['record']){_0xfc533c[_0x528f('0x11')](_['merge']({'app':'StopMixMonitor','priority':_0x229b57++},_0x234d50));}return _0xfc533c;};var getChanSpyApplications=function(_0x140ffe,_0x5ecc46){var _0x3d978d=[];for(var _0x3b4ba8=0x0,_0x3c4884=0x1;_0x3b4ba8<_0x5ecc46[_0x528f('0x17')];_0x3b4ba8++,_0x3c4884=0x1){_0x3d978d=_0x3d978d['concat'](getUserApplications(_0x140ffe,_0x5ecc46[_0x3b4ba8],_0x5ecc46[_0x3b4ba8][_0x528f('0x18')]));if(_0x5ecc46[_0x3b4ba8][_0x528f('0x18')]!=_0x5ecc46[_0x3b4ba8][_0x528f('0x14')]){_0x3d978d=_0x3d978d[_0x528f('0x19')](getUserApplications(_0x140ffe,_0x5ecc46[_0x3b4ba8],_0x5ecc46[_0x3b4ba8][_0x528f('0x14')]));}}return _0x3d978d;};var getChanSpyPromise=function(_0x55f9b8,_0x3bb79a){return new BPromise(function(_0x154eec,_0x2fc6bf){return _0x55f9b8[_0x528f('0x1a')][_0x528f('0x1b')]({'attributes':['id',_0x528f('0x14'),'internal'],'where':{'role':_0x528f('0x1c'),'chanspy':!![]},'raw':!![]})[_0x528f('0x1d')](function(_0x2767e4){if(_0x2767e4){return _0x154eec(getChanSpyApplications(_0x3bb79a,_0x2767e4));}return _0x154eec([]);})[_0x528f('0x1e')](function(_0x2491d5){_0x2fc6bf(_0x2491d5);});});};module[_0x528f('0x1f')]=function(_0x301306,_0x3d0670){var _0x2eff1f=_0x301306[_0x528f('0x20')];return _0x301306['define'](_0x528f('0x21'),attributes,{'tableName':_0x528f('0x22'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3998ad,_0x42239b,_0x15db3d){return getChanSpyPromise(_0x2eff1f,_0x3998ad)[_0x528f('0x1d')](function(_0x51ee6d){if(_0x51ee6d&&_0x51ee6d[_0x528f('0x17')]){return _0x2eff1f['VoiceExtension'][_0x528f('0x23')](_0x51ee6d);}})[_0x528f('0x1d')](function(){_0x15db3d();})[_0x528f('0x1e')](function(_0x1bb791){_0x15db3d(_0x1bb791);});},'afterUpdate':function(_0x1de643,_0x4dc137,_0x3f7286){return _0x2eff1f[_0x528f('0x24')][_0x528f('0x25')]({'where':{'ChanSpyId':_0x1de643['id']}})[_0x528f('0x1d')](function(){return getChanSpyPromise(_0x2eff1f,_0x1de643);})[_0x528f('0x1d')](function(_0x20fdff){if(_0x20fdff&&_0x20fdff[_0x528f('0x17')]){return _0x2eff1f[_0x528f('0x24')]['bulkCreate'](_0x20fdff);}})[_0x528f('0x1d')](function(){_0x3f7286();})['catch'](function(_0x5afa67){_0x3f7286(_0x5afa67);});},'afterDestroy':function(_0x213afc,_0x8012a2,_0x210ac0){return _0x2eff1f[_0x528f('0x24')]['destroy']({'where':{'ChanSpyId':_0x213afc['id']}})[_0x528f('0x1d')](function(){_0x210ac0();})[_0x528f('0x1e')](function(_0x290b89){_0x210ac0(_0x290b89);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index dd2f99a..785da9d 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 _0x2f68=['VoiceChanSpy,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','info','VoiceChanSpy,\x20%s,\x20%s','debug'];(function(_0x31669f,_0x3f306f){var _0xe67913=function(_0x5cb931){while(--_0x5cb931){_0x31669f['push'](_0x31669f['shift']());}};_0xe67913(++_0x3f306f);}(_0x2f68,0x9a));var _0x82f6=function(_0x31db55,_0x387aaa){_0x31db55=_0x31db55-0x0;var _0x2a8b0b=_0x2f68[_0x31db55];return _0x2a8b0b;};'use strict';var _=require('lodash');var util=require(_0x82f6('0x0'));var moment=require(_0x82f6('0x1'));var BPromise=require(_0x82f6('0x2'));var rs=require(_0x82f6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x82f6('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x82f6('0x5'))(_0x82f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x82f6('0x7'));var client=jayson[_0x82f6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a8089,_0x1bc0be,_0x5660bf){return new BPromise(function(_0x5daa3c,_0x864400){return client[_0x82f6('0x9')](_0x5a8089,_0x5660bf)[_0x82f6('0xa')](function(_0x5ee0e5){logger[_0x82f6('0xb')](_0x82f6('0xc'),_0x1bc0be,'request\x20sent');logger[_0x82f6('0xd')](_0x82f6('0xe'),_0x1bc0be,_0x82f6('0xf'),JSON[_0x82f6('0x10')](_0x5ee0e5));if(_0x5ee0e5[_0x82f6('0x11')]){if(_0x5ee0e5[_0x82f6('0x11')]['code']===0x1f4){logger[_0x82f6('0x11')](_0x82f6('0xc'),_0x1bc0be,_0x5ee0e5['error'][_0x82f6('0x12')]);return _0x864400(_0x5ee0e5[_0x82f6('0x11')][_0x82f6('0x12')]);}logger[_0x82f6('0x11')](_0x82f6('0xc'),_0x1bc0be,_0x5ee0e5[_0x82f6('0x11')][_0x82f6('0x12')]);return _0x5daa3c(_0x5ee0e5[_0x82f6('0x11')][_0x82f6('0x12')]);}else{logger['info'](_0x82f6('0xc'),_0x1bc0be,'request\x20sent');_0x5daa3c(_0x5ee0e5[_0x82f6('0x13')][_0x82f6('0x12')]);}})[_0x82f6('0x14')](function(_0x1033d3){logger[_0x82f6('0x11')](_0x82f6('0xc'),_0x1bc0be,_0x1033d3);_0x864400(_0x1033d3);});});} \ No newline at end of file +var _0x7980=['message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x102ece,_0x15d4ce){var _0x26a172=function(_0x5217c8){while(--_0x5217c8){_0x102ece['push'](_0x102ece['shift']());}};_0x26a172(++_0x15d4ce);}(_0x7980,0xab));var _0x0798=function(_0x3f5807,_0x1c12ae){_0x3f5807=_0x3f5807-0x0;var _0x3212ef=_0x7980[_0x3f5807];return _0x3212ef;};'use strict';var _=require(_0x0798('0x0'));var util=require(_0x0798('0x1'));var moment=require(_0x0798('0x2'));var BPromise=require(_0x0798('0x3'));var rs=require(_0x0798('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0798('0x5'))['db'];var utils=require(_0x0798('0x6'));var logger=require(_0x0798('0x7'))(_0x0798('0x8'));var config=require(_0x0798('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x0798('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1e534f,_0x34f808,_0x467859){return new BPromise(function(_0x54da10,_0x5151b3){return client[_0x0798('0xb')](_0x1e534f,_0x467859)[_0x0798('0xc')](function(_0x301a55){logger[_0x0798('0xd')](_0x0798('0xe'),_0x34f808,_0x0798('0xf'));logger[_0x0798('0x10')](_0x0798('0x11'),_0x34f808,_0x0798('0xf'),JSON[_0x0798('0x12')](_0x301a55));if(_0x301a55['error']){if(_0x301a55[_0x0798('0x13')][_0x0798('0x14')]===0x1f4){logger['error']('VoiceChanSpy,\x20%s,\x20%s',_0x34f808,_0x301a55[_0x0798('0x13')][_0x0798('0x15')]);return _0x5151b3(_0x301a55[_0x0798('0x13')][_0x0798('0x15')]);}logger[_0x0798('0x13')](_0x0798('0xe'),_0x34f808,_0x301a55[_0x0798('0x13')]['message']);return _0x54da10(_0x301a55['error'][_0x0798('0x15')]);}else{logger[_0x0798('0xd')]('VoiceChanSpy,\x20%s,\x20%s',_0x34f808,'request\x20sent');_0x54da10(_0x301a55[_0x0798('0x16')][_0x0798('0x15')]);}})[_0x0798('0x17')](function(_0x5dc617){logger['error'](_0x0798('0xe'),_0x34f808,_0x5dc617);_0x5151b3(_0x5dc617);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 8466d81..1363c23 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 _0x27bb=['Router','fs-extra','../../components/interaction/service','./voiceContext.controller','get','isAuthenticated','index','/:id','show','post','put','update','destroy','exports','multer','util','path','express'];(function(_0x2a75f4,_0x53baa3){var _0x135fd5=function(_0x4d18fa){while(--_0x4d18fa){_0x2a75f4['push'](_0x2a75f4['shift']());}};_0x135fd5(++_0x53baa3);}(_0x27bb,0xf8));var _0xb27b=function(_0x39e21a,_0x165673){_0x39e21a=_0x39e21a-0x0;var _0x2a020e=_0x27bb[_0x39e21a];return _0x2a020e;};'use strict';var multer=require(_0xb27b('0x0'));var util=require(_0xb27b('0x1'));var path=require(_0xb27b('0x2'));var timeout=require('connect-timeout');var express=require(_0xb27b('0x3'));var router=express[_0xb27b('0x4')]();var fs_extra=require(_0xb27b('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb27b('0x6'));var config=require('../../config/environment');var controller=require(_0xb27b('0x7'));router[_0xb27b('0x8')]('/',auth[_0xb27b('0x9')](),controller[_0xb27b('0xa')]);router[_0xb27b('0x8')](_0xb27b('0xb'),auth[_0xb27b('0x9')](),controller[_0xb27b('0xc')]);router[_0xb27b('0xd')]('/',auth[_0xb27b('0x9')](),controller['create']);router[_0xb27b('0xe')](_0xb27b('0xb'),auth[_0xb27b('0x9')](),controller[_0xb27b('0xf')]);router['delete']('/:id',auth[_0xb27b('0x9')](),controller[_0xb27b('0x10')]);module[_0xb27b('0x11')]=router; \ No newline at end of file +var _0x5552=['isAuthenticated','index','/:id','show','post','create','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceContext.controller','get'];(function(_0x2f9807,_0x59adc2){var _0xe459e9=function(_0x4e6979){while(--_0x4e6979){_0x2f9807['push'](_0x2f9807['shift']());}};_0xe459e9(++_0x59adc2);}(_0x5552,0x199));var _0x2555=function(_0x50b210,_0x4d49e8){_0x50b210=_0x50b210-0x0;var _0x53ade6=_0x5552[_0x50b210];return _0x53ade6;};'use strict';var multer=require(_0x2555('0x0'));var util=require(_0x2555('0x1'));var path=require('path');var timeout=require(_0x2555('0x2'));var express=require('express');var router=express[_0x2555('0x3')]();var fs_extra=require(_0x2555('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2555('0x5'));var config=require(_0x2555('0x6'));var controller=require(_0x2555('0x7'));router[_0x2555('0x8')]('/',auth[_0x2555('0x9')](),controller[_0x2555('0xa')]);router[_0x2555('0x8')](_0x2555('0xb'),auth[_0x2555('0x9')](),controller[_0x2555('0xc')]);router[_0x2555('0xd')]('/',auth[_0x2555('0x9')](),controller[_0x2555('0xe')]);router['put'](_0x2555('0xb'),auth[_0x2555('0x9')](),controller[_0x2555('0xf')]);router[_0x2555('0x10')](_0x2555('0xb'),auth[_0x2555('0x9')](),controller[_0x2555('0x11')]);module[_0x2555('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 24aea63..6608e5f 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 _0x2952=['exports','STRING','name','BOOLEAN'];(function(_0x19f8d7,_0x4efa7a){var _0x383314=function(_0x57f49e){while(--_0x57f49e){_0x19f8d7['push'](_0x19f8d7['shift']());}};_0x383314(++_0x4efa7a);}(_0x2952,0xc4));var _0x2295=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x2952[_0x2c91e9];return _0x13f0ff;};'use strict';var Sequelize=require('sequelize');module[_0x2295('0x0')]={'name':{'type':Sequelize[_0x2295('0x1')],'unique':_0x2295('0x2')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x2295('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x2ef1=['exports','STRING','name','BOOLEAN','sequelize'];(function(_0x55821d,_0x27a22e){var _0x58ea8a=function(_0x5bdd3d){while(--_0x5bdd3d){_0x55821d['push'](_0x55821d['shift']());}};_0x58ea8a(++_0x27a22e);}(_0x2ef1,0xb8));var _0x12ef=function(_0x56b45d,_0xbe0daa){_0x56b45d=_0x56b45d-0x0;var _0x1c7b0c=_0x2ef1[_0x56b45d];return _0x1c7b0c;};'use strict';var Sequelize=require(_0x12ef('0x0'));module[_0x12ef('0x1')]={'name':{'type':Sequelize[_0x12ef('0x2')],'unique':_0x12ef('0x3')},'description':{'type':Sequelize[_0x12ef('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x12ef('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 d9781d4..a84d724 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 _0x8170=['root','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','server/files/templates/context.ejs','Reload','chan_sip.so','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','get','Contexts','UserProfileResource','sendStatus','stack','name','index','VoiceContext','rawAttributes','fieldName','type','model','map','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','show','params','fields','find','create','body','readFileSync','join'];(function(_0x316fe7,_0x480db9){var _0x576e3e=function(_0x26a6bf){while(--_0x26a6bf){_0x316fe7['push'](_0x316fe7['shift']());}};_0x576e3e(++_0x480db9);}(_0x8170,0x1b1));var _0x0817=function(_0x344c14,_0x5eab3e){_0x344c14=_0x344c14-0x0;var _0x5e70b8=_0x8170[_0x344c14];return _0x5e70b8;};'use strict';var emlformat=require(_0x0817('0x0'));var rimraf=require(_0x0817('0x1'));var zipdir=require(_0x0817('0x2'));var jsonpatch=require(_0x0817('0x3'));var rp=require('request-promise');var moment=require(_0x0817('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0817('0x5'));var util=require(_0x0817('0x6'));var path=require(_0x0817('0x7'));var sox=require(_0x0817('0x8'));var csv=require('to-csv');var ejs=require(_0x0817('0x9'));var fs=require('fs');var fs_extra=require(_0x0817('0xa'));var _=require(_0x0817('0xb'));var squel=require('squel');var crypto=require(_0x0817('0xc'));var jsforce=require(_0x0817('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x0817('0xe'));var querystring=require(_0x0817('0xf'));var Papa=require(_0x0817('0x10'));var Redis=require('ioredis');var authService=require(_0x0817('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x0817('0x12'));var hardwareService=require(_0x0817('0x13'));var logger=require('../../config/logger')(_0x0817('0x14'));var utils=require(_0x0817('0x15'));var config=require(_0x0817('0x16'));var licenseUtil=require(_0x0817('0x17'));var db=require('../../mysqldb')['db'];var jayson=require(_0x0817('0x18'));var client=jayson[_0x0817('0x19')][_0x0817('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x493105,_0x2adc9d,_0x4a8885,_0x2cb589){return new BPromise(function(_0x2b48e0,_0x58cf17){var _0x5cae9e=_0x2cb589||client;return _0x5cae9e[_0x0817('0x1b')](_0x493105,_0x4a8885)[_0x0817('0x1c')](function(_0x12b146){logger[_0x0817('0x1d')](_0x0817('0x1e'),_0x2adc9d,_0x0817('0x1f'));logger[_0x0817('0x20')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x2adc9d,_0x0817('0x1f'),JSON[_0x0817('0x21')](_0x12b146));if(_0x12b146[_0x0817('0x22')]){if(_0x12b146['error'][_0x0817('0x23')]===0x1f4){logger[_0x0817('0x22')]('VoiceContext,\x20%s,\x20%s',_0x2adc9d,_0x12b146['error'][_0x0817('0x24')]);return _0x58cf17(_0x12b146[_0x0817('0x22')][_0x0817('0x24')]);}logger['error'](_0x0817('0x1e'),_0x2adc9d,_0x12b146[_0x0817('0x22')][_0x0817('0x24')]);return _0x2b48e0(_0x12b146[_0x0817('0x22')][_0x0817('0x24')]);}else{logger['info'](_0x0817('0x1e'),_0x2adc9d,_0x0817('0x1f'));_0x2b48e0(_0x12b146['result']['message']);}})[_0x0817('0x25')](function(_0x3210f6){logger[_0x0817('0x22')]('VoiceContext,\x20%s,\x20%s',_0x2adc9d,_0x3210f6);_0x58cf17(_0x3210f6);});});}function respondWithStatusCode(_0xd23fff,_0x8a4c5b){_0x8a4c5b=_0x8a4c5b||0xcc;return function(_0x184d82){if(_0x184d82){return _0xd23fff['sendStatus'](_0x8a4c5b);}return _0xd23fff[_0x0817('0x26')](_0x8a4c5b)[_0x0817('0x27')]();};}function respondWithResult(_0x4b85f5,_0x4a58ea){_0x4a58ea=_0x4a58ea||0xc8;return function(_0x356651){if(_0x356651){return _0x4b85f5['status'](_0x4a58ea)[_0x0817('0x28')](_0x356651);}};}function respondWithFilteredResult(_0x5317fb,_0x57d62b){return function(_0x4cb487){if(_0x4cb487){var _0x32d48b=typeof _0x57d62b[_0x0817('0x29')]==='undefined'&&typeof _0x57d62b[_0x0817('0x2a')]===_0x0817('0x2b');var _0x231afb=_0x4cb487['count'];var _0x5719cf=_0x32d48b?0x0:_0x57d62b[_0x0817('0x29')];var _0x4097df=_0x32d48b?_0x4cb487[_0x0817('0x2c')]:_0x57d62b['offset']+_0x57d62b['limit'];var _0x1f0724;if(_0x4097df>=_0x231afb){_0x4097df=_0x231afb;_0x1f0724=0xc8;}else{_0x1f0724=0xce;}_0x5317fb['status'](_0x1f0724);return _0x5317fb[_0x0817('0x2d')](_0x0817('0x2e'),_0x5719cf+'-'+_0x4097df+'/'+_0x231afb)[_0x0817('0x28')](_0x4cb487);}return null;};}function patchUpdates(_0x4c3dfc){return function(_0x5452f0){try{jsonpatch[_0x0817('0x2f')](_0x5452f0,_0x4c3dfc,!![]);}catch(_0x30dd50){return BPromise[_0x0817('0x30')](_0x30dd50);}return _0x5452f0[_0x0817('0x31')]();};}function saveUpdates(_0x15ec4d,_0x122b60){return function(_0x78fca4){if(_0x78fca4){return _0x78fca4[_0x0817('0x32')](_0x15ec4d)[_0x0817('0x1c')](function(_0x1e8296){return _0x1e8296;});}return null;};}function removeEntity(_0x207cc1,_0x3b77cf){return function(_0xbcf67a){if(_0xbcf67a){return _0xbcf67a[_0x0817('0x33')]()[_0x0817('0x1c')](function(){var _0x3fc978=_0xbcf67a[_0x0817('0x34')]({'plain':!![]});var _0x46ee97=_0x0817('0x35');return db[_0x0817('0x36')][_0x0817('0x33')]({'where':{'type':_0x46ee97,'resourceId':_0x3fc978['id']}})[_0x0817('0x1c')](function(){return _0xbcf67a;});})[_0x0817('0x1c')](function(){_0x207cc1[_0x0817('0x26')](0xcc)[_0x0817('0x27')]();});}};}function handleEntityNotFound(_0xc8826,_0x46f297){return function(_0x30f9e2){if(!_0x30f9e2){_0xc8826[_0x0817('0x37')](0x194);}return _0x30f9e2;};}function handleError(_0xfef428,_0x316402){_0x316402=_0x316402||0x1f4;return function(_0x33e8c5){logger[_0x0817('0x22')](_0x33e8c5[_0x0817('0x38')]);if(_0x33e8c5[_0x0817('0x39')]){delete _0x33e8c5[_0x0817('0x39')];}_0xfef428[_0x0817('0x26')](_0x316402)['send'](_0x33e8c5);};}exports[_0x0817('0x3a')]=function(_0x1d1f96,_0x192870){var _0x4ac142={},_0x37097b={},_0x57fcde={'count':0x0,'rows':[]};var _0x2f1a38=_['map'](db[_0x0817('0x3b')][_0x0817('0x3c')],function(_0x51c395){return{'name':_0x51c395[_0x0817('0x3d')],'type':_0x51c395[_0x0817('0x3e')]['key']};});_0x37097b[_0x0817('0x3f')]=_[_0x0817('0x40')](_0x2f1a38,_0x0817('0x39'));_0x37097b['query']=_[_0x0817('0x41')](_0x1d1f96[_0x0817('0x42')]);_0x37097b[_0x0817('0x43')]=_['intersection'](_0x37097b['model'],_0x37097b['query']);_0x4ac142['attributes']=_[_0x0817('0x44')](_0x37097b['model'],qs['fields'](_0x1d1f96[_0x0817('0x42')]['fields']));_0x4ac142[_0x0817('0x45')]=_0x4ac142[_0x0817('0x45')][_0x0817('0x46')]?_0x4ac142['attributes']:_0x37097b[_0x0817('0x3f')];if(!_0x1d1f96['query'][_0x0817('0x47')](_0x0817('0x48'))){_0x4ac142[_0x0817('0x2a')]=qs[_0x0817('0x2a')](_0x1d1f96[_0x0817('0x42')][_0x0817('0x2a')]);_0x4ac142[_0x0817('0x29')]=qs[_0x0817('0x29')](_0x1d1f96['query'][_0x0817('0x29')]);}_0x4ac142[_0x0817('0x49')]=qs[_0x0817('0x4a')](_0x1d1f96[_0x0817('0x42')]['sort']);_0x4ac142[_0x0817('0x4b')]=qs[_0x0817('0x43')](_[_0x0817('0x4c')](_0x1d1f96[_0x0817('0x42')],_0x37097b['filters']),_0x2f1a38);if(_0x1d1f96['query']['filter']){_0x4ac142['where']=_[_0x0817('0x4d')](_0x4ac142[_0x0817('0x4b')],{'$or':_['map'](_0x2f1a38,function(_0x469095){if(_0x469095[_0x0817('0x3e')]!==_0x0817('0x4e')){var _0x23cdf3={};_0x23cdf3[_0x469095[_0x0817('0x39')]]={'$like':'%'+_0x1d1f96[_0x0817('0x42')][_0x0817('0x4f')]+'%'};return _0x23cdf3;}})});}_0x4ac142=_['merge']({},_0x4ac142,_0x1d1f96[_0x0817('0x50')]);var _0x1e8721={'where':_0x4ac142[_0x0817('0x4b')]};return db['VoiceContext'][_0x0817('0x2c')](_0x1e8721)['then'](function(_0x465d58){_0x57fcde[_0x0817('0x2c')]=_0x465d58;if(_0x1d1f96[_0x0817('0x42')][_0x0817('0x51')]){_0x4ac142['include']=[{'all':!![]}];}return db['VoiceContext'][_0x0817('0x52')](_0x4ac142);})['then'](function(_0x579d72){_0x57fcde[_0x0817('0x53')]=_0x579d72;return _0x57fcde;})[_0x0817('0x1c')](respondWithFilteredResult(_0x192870,_0x4ac142))['catch'](handleError(_0x192870,null));};exports[_0x0817('0x54')]=function(_0x42e4f5,_0x56219d){var _0x16261a={'raw':![],'where':{'id':_0x42e4f5[_0x0817('0x55')]['id']}},_0x7ff9af={};_0x7ff9af['model']=_['keys'](db[_0x0817('0x3b')]['rawAttributes']);_0x7ff9af[_0x0817('0x42')]=_[_0x0817('0x41')](_0x42e4f5[_0x0817('0x42')]);_0x7ff9af[_0x0817('0x43')]=_[_0x0817('0x44')](_0x7ff9af[_0x0817('0x3f')],_0x7ff9af[_0x0817('0x42')]);_0x16261a[_0x0817('0x45')]=_[_0x0817('0x44')](_0x7ff9af['model'],qs[_0x0817('0x56')](_0x42e4f5[_0x0817('0x42')][_0x0817('0x56')]));_0x16261a[_0x0817('0x45')]=_0x16261a[_0x0817('0x45')][_0x0817('0x46')]?_0x16261a[_0x0817('0x45')]:_0x7ff9af[_0x0817('0x3f')];if(_0x42e4f5['query'][_0x0817('0x51')]){_0x16261a['include']=[{'all':!![]}];}_0x16261a=_['merge']({},_0x16261a,_0x42e4f5[_0x0817('0x50')]);return db[_0x0817('0x3b')][_0x0817('0x57')](_0x16261a)[_0x0817('0x1c')](handleEntityNotFound(_0x56219d,null))[_0x0817('0x1c')](respondWithResult(_0x56219d,null))[_0x0817('0x25')](handleError(_0x56219d,null));};exports['create']=function(_0x174315,_0x2e7777,_0x289134){var _0x500120;return db[_0x0817('0x3b')][_0x0817('0x58')](_0x174315[_0x0817('0x59')],{'raw':!![]})[_0x0817('0x1c')](function(_0x4dd849){_0x500120=_0x4dd849;return db['VoiceContext'][_0x0817('0x52')]({'raw':!![]});})[_0x0817('0x1c')](function(_0x14b303){var _0x1bf7b8=fs[_0x0817('0x5a')](path[_0x0817('0x5b')](config[_0x0817('0x5c')],'server/files/templates/context.ejs'),_0x0817('0x5d'));var _0x225386=ejs[_0x0817('0x5e')](_0x1bf7b8,{'contexts':_0x14b303||[]});fs[_0x0817('0x5f')](_0x0817('0x60'),_0x225386);})[_0x0817('0x1c')](function(){return respondWithRpcPromise('Reload','create',{'module':'chan_sip.so'});})[_0x0817('0x1c')](function(){var _0x37bb71=_0x174315[_0x0817('0x61')][_0x0817('0x34')]({'plain':!![]});if(!_0x37bb71)throw new Error(_0x0817('0x62'));if(_0x37bb71[_0x0817('0x63')]===_0x0817('0x61')){var _0x18ddde=_0x500120['get']({'plain':!![]});return db['UserProfileSection'][_0x0817('0x57')]({'where':{'name':_0x0817('0x35'),'userProfileId':_0x37bb71[_0x0817('0x64')]},'raw':!![]})[_0x0817('0x1c')](function(_0x375822){if(_0x375822&&_0x375822[_0x0817('0x65')]===0x0){return db[_0x0817('0x36')]['create']({'name':_0x18ddde['name'],'resourceId':_0x18ddde['id'],'type':_0x375822[_0x0817('0x39')],'sectionId':_0x375822['id']},{})[_0x0817('0x1c')](function(){return _0x500120;});}else{return _0x500120;}})[_0x0817('0x25')](function(_0x3439d9){logger[_0x0817('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3439d9);throw _0x3439d9;});}return _0x500120;})[_0x0817('0x1c')](respondWithResult(_0x2e7777,0xc9))['catch'](handleError(_0x2e7777,null));};exports[_0x0817('0x32')]=function(_0x4bf56b,_0x2c228c,_0x59ef63){var _0x4096fe;return db[_0x0817('0x3b')][_0x0817('0x57')]({'where':{'id':_0x4bf56b[_0x0817('0x55')]['id']}})['then'](handleEntityNotFound(_0x2c228c,null))[_0x0817('0x1c')](saveUpdates(_0x4bf56b[_0x0817('0x59')],null))[_0x0817('0x1c')](function(_0x1fa984){if(_0x1fa984){_0x4096fe=_0x1fa984;return db[_0x0817('0x3b')][_0x0817('0x52')]({'raw':!![]});}})['then'](function(_0x233214){var _0x57a661=fs[_0x0817('0x5a')](path[_0x0817('0x5b')](config[_0x0817('0x5c')],_0x0817('0x66')),_0x0817('0x5d'));var _0x1c7c8d=ejs['render'](_0x57a661,{'contexts':_0x233214||[]});fs[_0x0817('0x5f')](_0x0817('0x60'),_0x1c7c8d);})['then'](function(){return respondWithRpcPromise(_0x0817('0x67'),'update',{'module':_0x0817('0x68')});})[_0x0817('0x1c')](function(){return _0x4096fe;})[_0x0817('0x1c')](respondWithResult(_0x2c228c,null))[_0x0817('0x25')](handleError(_0x2c228c,null));};exports[_0x0817('0x33')]=function(_0x4797e1,_0x24fdf2,_0x5bdc8a){var _0x2e3989;return db['VoiceContext']['find']({'where':{'id':_0x4797e1['params']['id']}})[_0x0817('0x1c')](handleEntityNotFound(_0x24fdf2,null))[_0x0817('0x1c')](removeEntity(_0x24fdf2,null))[_0x0817('0x1c')](function(){return db[_0x0817('0x3b')][_0x0817('0x52')]({'raw':!![]});})['then'](function(_0x398718){var _0x1eaf5b=fs[_0x0817('0x5a')](path[_0x0817('0x5b')](config[_0x0817('0x5c')],_0x0817('0x66')),_0x0817('0x5d'));var _0x664bf8=ejs['render'](_0x1eaf5b,{'contexts':_0x398718});fs[_0x0817('0x5f')](_0x0817('0x60'),_0x664bf8);return respondWithRpcPromise(_0x0817('0x67'),_0x0817('0x33'),{'module':_0x0817('0x68')});})[_0x0817('0x25')](handleError(_0x24fdf2,null));}; \ No newline at end of file +var _0xddcc=['attributes','fields','length','hasOwnProperty','offset','order','sort','where','pick','filter','merge','options','includeAll','include','rows','show','params','keys','intersection','find','create','body','findAll','readFileSync','join','root','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Reload','update','chan_sip.so','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','ejs','lodash','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','jayson/promise','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','end','json','limit','undefined','count','status','set','Content-Range','apply','reject','save','Contexts','UserProfileResource','destroy','sendStatus','stack','name','send','map','VoiceContext','rawAttributes','type','key','model','query','filters'];(function(_0x2e73f6,_0x211b10){var _0x289034=function(_0x36044e){while(--_0x36044e){_0x2e73f6['push'](_0x2e73f6['shift']());}};_0x289034(++_0x211b10);}(_0xddcc,0x1bc));var _0xcddc=function(_0x2bec5b,_0x1990df){_0x2bec5b=_0x2bec5b-0x0;var _0x4e568c=_0xddcc[_0x2bec5b];return _0x4e568c;};'use strict';var emlformat=require(_0xcddc('0x0'));var rimraf=require(_0xcddc('0x1'));var zipdir=require(_0xcddc('0x2'));var jsonpatch=require(_0xcddc('0x3'));var rp=require('request-promise');var moment=require(_0xcddc('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xcddc('0x5'));var util=require(_0xcddc('0x6'));var path=require(_0xcddc('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xcddc('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcddc('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xcddc('0xa'));var Papa=require(_0xcddc('0xb'));var Redis=require(_0xcddc('0xc'));var authService=require(_0xcddc('0xd'));var qs=require(_0xcddc('0xe'));var as=require(_0xcddc('0xf'));var hardwareService=require(_0xcddc('0x10'));var logger=require(_0xcddc('0x11'))(_0xcddc('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xcddc('0x13'));var db=require(_0xcddc('0x14'))['db'];var jayson=require(_0xcddc('0x15'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1473ce,_0x50b458,_0x1c6f18,_0x3e58d5){return new BPromise(function(_0x461f68,_0x4fdc72){var _0x2fb3da=_0x3e58d5||client;return _0x2fb3da[_0xcddc('0x16')](_0x1473ce,_0x1c6f18)[_0xcddc('0x17')](function(_0x4138aa){logger[_0xcddc('0x18')](_0xcddc('0x19'),_0x50b458,_0xcddc('0x1a'));logger[_0xcddc('0x1b')](_0xcddc('0x1c'),_0x50b458,'request\x20sent',JSON[_0xcddc('0x1d')](_0x4138aa));if(_0x4138aa[_0xcddc('0x1e')]){if(_0x4138aa[_0xcddc('0x1e')][_0xcddc('0x1f')]===0x1f4){logger[_0xcddc('0x1e')](_0xcddc('0x19'),_0x50b458,_0x4138aa['error'][_0xcddc('0x20')]);return _0x4fdc72(_0x4138aa[_0xcddc('0x1e')][_0xcddc('0x20')]);}logger['error']('VoiceContext,\x20%s,\x20%s',_0x50b458,_0x4138aa[_0xcddc('0x1e')][_0xcddc('0x20')]);return _0x461f68(_0x4138aa['error'][_0xcddc('0x20')]);}else{logger['info'](_0xcddc('0x19'),_0x50b458,_0xcddc('0x1a'));_0x461f68(_0x4138aa[_0xcddc('0x21')][_0xcddc('0x20')]);}})[_0xcddc('0x22')](function(_0x54e328){logger[_0xcddc('0x1e')](_0xcddc('0x19'),_0x50b458,_0x54e328);_0x4fdc72(_0x54e328);});});}function respondWithStatusCode(_0x1e816d,_0x44bd58){_0x44bd58=_0x44bd58||0xcc;return function(_0x382b6e){if(_0x382b6e){return _0x1e816d['sendStatus'](_0x44bd58);}return _0x1e816d['status'](_0x44bd58)[_0xcddc('0x23')]();};}function respondWithResult(_0x2ec37c,_0x5b49a8){_0x5b49a8=_0x5b49a8||0xc8;return function(_0x441043){if(_0x441043){return _0x2ec37c['status'](_0x5b49a8)[_0xcddc('0x24')](_0x441043);}};}function respondWithFilteredResult(_0x36e0d8,_0x3b6af9){return function(_0x19ca09){if(_0x19ca09){var _0x57fb56=typeof _0x3b6af9['offset']==='undefined'&&typeof _0x3b6af9[_0xcddc('0x25')]===_0xcddc('0x26');var _0x236566=_0x19ca09['count'];var _0x5e131e=_0x57fb56?0x0:_0x3b6af9['offset'];var _0x1c502c=_0x57fb56?_0x19ca09[_0xcddc('0x27')]:_0x3b6af9['offset']+_0x3b6af9[_0xcddc('0x25')];var _0x232dcc;if(_0x1c502c>=_0x236566){_0x1c502c=_0x236566;_0x232dcc=0xc8;}else{_0x232dcc=0xce;}_0x36e0d8[_0xcddc('0x28')](_0x232dcc);return _0x36e0d8[_0xcddc('0x29')](_0xcddc('0x2a'),_0x5e131e+'-'+_0x1c502c+'/'+_0x236566)[_0xcddc('0x24')](_0x19ca09);}return null;};}function patchUpdates(_0x196484){return function(_0x49a658){try{jsonpatch[_0xcddc('0x2b')](_0x49a658,_0x196484,!![]);}catch(_0x7cf741){return BPromise[_0xcddc('0x2c')](_0x7cf741);}return _0x49a658[_0xcddc('0x2d')]();};}function saveUpdates(_0x33c781,_0x4804fa){return function(_0x45934c){if(_0x45934c){return _0x45934c['update'](_0x33c781)[_0xcddc('0x17')](function(_0x154454){return _0x154454;});}return null;};}function removeEntity(_0x536d84,_0x538fbf){return function(_0x36b1d0){if(_0x36b1d0){return _0x36b1d0['destroy']()[_0xcddc('0x17')](function(){var _0x1c91fa=_0x36b1d0['get']({'plain':!![]});var _0x115f8a=_0xcddc('0x2e');return db[_0xcddc('0x2f')][_0xcddc('0x30')]({'where':{'type':_0x115f8a,'resourceId':_0x1c91fa['id']}})[_0xcddc('0x17')](function(){return _0x36b1d0;});})[_0xcddc('0x17')](function(){_0x536d84[_0xcddc('0x28')](0xcc)[_0xcddc('0x23')]();});}};}function handleEntityNotFound(_0x367d12,_0x30b927){return function(_0x372272){if(!_0x372272){_0x367d12[_0xcddc('0x31')](0x194);}return _0x372272;};}function handleError(_0x3a0818,_0x1e0e28){_0x1e0e28=_0x1e0e28||0x1f4;return function(_0x279856){logger['error'](_0x279856[_0xcddc('0x32')]);if(_0x279856[_0xcddc('0x33')]){delete _0x279856[_0xcddc('0x33')];}_0x3a0818[_0xcddc('0x28')](_0x1e0e28)[_0xcddc('0x34')](_0x279856);};}exports['index']=function(_0x4c2174,_0x318265){var _0xdb67c4={},_0x12ea03={},_0x576c4e={'count':0x0,'rows':[]};var _0x1ec717=_[_0xcddc('0x35')](db[_0xcddc('0x36')][_0xcddc('0x37')],function(_0x12c907){return{'name':_0x12c907['fieldName'],'type':_0x12c907[_0xcddc('0x38')][_0xcddc('0x39')]};});_0x12ea03[_0xcddc('0x3a')]=_['map'](_0x1ec717,_0xcddc('0x33'));_0x12ea03[_0xcddc('0x3b')]=_['keys'](_0x4c2174[_0xcddc('0x3b')]);_0x12ea03[_0xcddc('0x3c')]=_['intersection'](_0x12ea03['model'],_0x12ea03[_0xcddc('0x3b')]);_0xdb67c4[_0xcddc('0x3d')]=_['intersection'](_0x12ea03['model'],qs[_0xcddc('0x3e')](_0x4c2174[_0xcddc('0x3b')]['fields']));_0xdb67c4['attributes']=_0xdb67c4[_0xcddc('0x3d')][_0xcddc('0x3f')]?_0xdb67c4['attributes']:_0x12ea03[_0xcddc('0x3a')];if(!_0x4c2174[_0xcddc('0x3b')][_0xcddc('0x40')]('nolimit')){_0xdb67c4[_0xcddc('0x25')]=qs[_0xcddc('0x25')](_0x4c2174['query'][_0xcddc('0x25')]);_0xdb67c4[_0xcddc('0x41')]=qs[_0xcddc('0x41')](_0x4c2174[_0xcddc('0x3b')][_0xcddc('0x41')]);}_0xdb67c4[_0xcddc('0x42')]=qs[_0xcddc('0x43')](_0x4c2174[_0xcddc('0x3b')][_0xcddc('0x43')]);_0xdb67c4[_0xcddc('0x44')]=qs[_0xcddc('0x3c')](_[_0xcddc('0x45')](_0x4c2174[_0xcddc('0x3b')],_0x12ea03['filters']),_0x1ec717);if(_0x4c2174[_0xcddc('0x3b')][_0xcddc('0x46')]){_0xdb67c4[_0xcddc('0x44')]=_['merge'](_0xdb67c4['where'],{'$or':_[_0xcddc('0x35')](_0x1ec717,function(_0xf2ca22){if(_0xf2ca22['type']!=='VIRTUAL'){var _0x44f43a={};_0x44f43a[_0xf2ca22[_0xcddc('0x33')]]={'$like':'%'+_0x4c2174[_0xcddc('0x3b')][_0xcddc('0x46')]+'%'};return _0x44f43a;}})});}_0xdb67c4=_[_0xcddc('0x47')]({},_0xdb67c4,_0x4c2174[_0xcddc('0x48')]);var _0x416ff9={'where':_0xdb67c4['where']};return db[_0xcddc('0x36')][_0xcddc('0x27')](_0x416ff9)['then'](function(_0x454054){_0x576c4e[_0xcddc('0x27')]=_0x454054;if(_0x4c2174['query'][_0xcddc('0x49')]){_0xdb67c4[_0xcddc('0x4a')]=[{'all':!![]}];}return db[_0xcddc('0x36')]['findAll'](_0xdb67c4);})[_0xcddc('0x17')](function(_0x59bdbe){_0x576c4e[_0xcddc('0x4b')]=_0x59bdbe;return _0x576c4e;})[_0xcddc('0x17')](respondWithFilteredResult(_0x318265,_0xdb67c4))[_0xcddc('0x22')](handleError(_0x318265,null));};exports[_0xcddc('0x4c')]=function(_0x5d9f32,_0x44d87e){var _0x157951={'raw':![],'where':{'id':_0x5d9f32[_0xcddc('0x4d')]['id']}},_0x2f3ab0={};_0x2f3ab0[_0xcddc('0x3a')]=_[_0xcddc('0x4e')](db[_0xcddc('0x36')][_0xcddc('0x37')]);_0x2f3ab0[_0xcddc('0x3b')]=_['keys'](_0x5d9f32[_0xcddc('0x3b')]);_0x2f3ab0[_0xcddc('0x3c')]=_[_0xcddc('0x4f')](_0x2f3ab0[_0xcddc('0x3a')],_0x2f3ab0[_0xcddc('0x3b')]);_0x157951[_0xcddc('0x3d')]=_[_0xcddc('0x4f')](_0x2f3ab0[_0xcddc('0x3a')],qs[_0xcddc('0x3e')](_0x5d9f32[_0xcddc('0x3b')]['fields']));_0x157951[_0xcddc('0x3d')]=_0x157951[_0xcddc('0x3d')]['length']?_0x157951['attributes']:_0x2f3ab0[_0xcddc('0x3a')];if(_0x5d9f32['query'][_0xcddc('0x49')]){_0x157951['include']=[{'all':!![]}];}_0x157951=_[_0xcddc('0x47')]({},_0x157951,_0x5d9f32[_0xcddc('0x48')]);return db[_0xcddc('0x36')][_0xcddc('0x50')](_0x157951)[_0xcddc('0x17')](handleEntityNotFound(_0x44d87e,null))[_0xcddc('0x17')](respondWithResult(_0x44d87e,null))['catch'](handleError(_0x44d87e,null));};exports[_0xcddc('0x51')]=function(_0xe532a1,_0x20b4d7,_0x111bff){var _0x92485c;return db['VoiceContext']['create'](_0xe532a1[_0xcddc('0x52')],{'raw':!![]})[_0xcddc('0x17')](function(_0x274845){_0x92485c=_0x274845;return db[_0xcddc('0x36')][_0xcddc('0x53')]({'raw':!![]});})[_0xcddc('0x17')](function(_0xcdd5f8){var _0xce9d25=fs[_0xcddc('0x54')](path[_0xcddc('0x55')](config[_0xcddc('0x56')],_0xcddc('0x57')),_0xcddc('0x58'));var _0x265ab5=ejs[_0xcddc('0x59')](_0xce9d25,{'contexts':_0xcdd5f8||[]});fs[_0xcddc('0x5a')](_0xcddc('0x5b'),_0x265ab5);})[_0xcddc('0x17')](function(){return respondWithRpcPromise('Reload',_0xcddc('0x51'),{'module':'chan_sip.so'});})[_0xcddc('0x17')](function(){var _0x2375b5=_0xe532a1[_0xcddc('0x5c')]['get']({'plain':!![]});if(!_0x2375b5)throw new Error(_0xcddc('0x5d'));if(_0x2375b5[_0xcddc('0x5e')]==='user'){var _0x5a787e=_0x92485c['get']({'plain':!![]});return db[_0xcddc('0x5f')][_0xcddc('0x50')]({'where':{'name':_0xcddc('0x2e'),'userProfileId':_0x2375b5[_0xcddc('0x60')]},'raw':!![]})[_0xcddc('0x17')](function(_0x4832f0){if(_0x4832f0&&_0x4832f0['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x5a787e[_0xcddc('0x33')],'resourceId':_0x5a787e['id'],'type':_0x4832f0[_0xcddc('0x33')],'sectionId':_0x4832f0['id']},{})[_0xcddc('0x17')](function(){return _0x92485c;});}else{return _0x92485c;}})['catch'](function(_0x1774ff){logger[_0xcddc('0x1e')](_0xcddc('0x61'),_0x1774ff);throw _0x1774ff;});}return _0x92485c;})[_0xcddc('0x17')](respondWithResult(_0x20b4d7,0xc9))[_0xcddc('0x22')](handleError(_0x20b4d7,null));};exports['update']=function(_0x3a95f4,_0x848cb7,_0x2fb2fe){var _0x5a64ec;return db[_0xcddc('0x36')][_0xcddc('0x50')]({'where':{'id':_0x3a95f4[_0xcddc('0x4d')]['id']}})[_0xcddc('0x17')](handleEntityNotFound(_0x848cb7,null))[_0xcddc('0x17')](saveUpdates(_0x3a95f4[_0xcddc('0x52')],null))['then'](function(_0x59a45b){if(_0x59a45b){_0x5a64ec=_0x59a45b;return db[_0xcddc('0x36')]['findAll']({'raw':!![]});}})[_0xcddc('0x17')](function(_0x37f3ed){var _0x5a45ea=fs[_0xcddc('0x54')](path[_0xcddc('0x55')](config[_0xcddc('0x56')],_0xcddc('0x57')),_0xcddc('0x58'));var _0x417931=ejs[_0xcddc('0x59')](_0x5a45ea,{'contexts':_0x37f3ed||[]});fs[_0xcddc('0x5a')](_0xcddc('0x5b'),_0x417931);})['then'](function(){return respondWithRpcPromise(_0xcddc('0x62'),_0xcddc('0x63'),{'module':_0xcddc('0x64')});})['then'](function(){return _0x5a64ec;})[_0xcddc('0x17')](respondWithResult(_0x848cb7,null))[_0xcddc('0x22')](handleError(_0x848cb7,null));};exports[_0xcddc('0x30')]=function(_0x3cef4b,_0x4a0132,_0x1ec6fe){var _0x278cb3;return db['VoiceContext']['find']({'where':{'id':_0x3cef4b[_0xcddc('0x4d')]['id']}})[_0xcddc('0x17')](handleEntityNotFound(_0x4a0132,null))['then'](removeEntity(_0x4a0132,null))['then'](function(){return db['VoiceContext']['findAll']({'raw':!![]});})[_0xcddc('0x17')](function(_0xd6b4f){var _0x3eaa35=fs[_0xcddc('0x54')](path[_0xcddc('0x55')](config[_0xcddc('0x56')],_0xcddc('0x57')),_0xcddc('0x58'));var _0x487d7d=ejs[_0xcddc('0x59')](_0x3eaa35,{'contexts':_0xd6b4f});fs[_0xcddc('0x5a')](_0xcddc('0x5b'),_0x487d7d);return respondWithRpcPromise(_0xcddc('0x62'),'destroy',{'module':_0xcddc('0x64')});})[_0xcddc('0x22')](handleError(_0x4a0132,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 4e300c9..f5a3958 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 _0x03fd=['voice_contexts','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceContext.attributes','exports','define','VoiceContext'];(function(_0x262ee7,_0x52ee92){var _0x1dc842=function(_0x4bf54a){while(--_0x4bf54a){_0x262ee7['push'](_0x262ee7['shift']());}};_0x1dc842(++_0x52ee92);}(_0x03fd,0x83));var _0xd03f=function(_0x5746a3,_0x425484){_0x5746a3=_0x5746a3-0x0;var _0x554133=_0x03fd[_0x5746a3];return _0x554133;};'use strict';var _=require(_0xd03f('0x0'));var util=require(_0xd03f('0x1'));var logger=require(_0xd03f('0x2'))('api');var moment=require(_0xd03f('0x3'));var BPromise=require(_0xd03f('0x4'));var rp=require(_0xd03f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd03f('0x6'));var config=require(_0xd03f('0x7'));var attributes=require(_0xd03f('0x8'));module[_0xd03f('0x9')]=function(_0x541263,_0xa7ac9f){return _0x541263[_0xd03f('0xa')](_0xd03f('0xb'),attributes,{'tableName':_0xd03f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0630=['voice_contexts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceContext.attributes','exports','define'];(function(_0x55933f,_0x33712b){var _0x588e8d=function(_0x15a68b){while(--_0x15a68b){_0x55933f['push'](_0x55933f['shift']());}};_0x588e8d(++_0x33712b);}(_0x0630,0x9d));var _0x0063=function(_0x21e871,_0xf8b7f5){_0x21e871=_0x21e871-0x0;var _0x14ae24=_0x0630[_0x21e871];return _0x14ae24;};'use strict';var _=require(_0x0063('0x0'));var util=require(_0x0063('0x1'));var logger=require(_0x0063('0x2'))(_0x0063('0x3'));var moment=require(_0x0063('0x4'));var BPromise=require(_0x0063('0x5'));var rp=require(_0x0063('0x6'));var fs=require('fs');var path=require(_0x0063('0x7'));var rimraf=require(_0x0063('0x8'));var config=require('../../config/environment');var attributes=require(_0x0063('0x9'));module[_0x0063('0xa')]=function(_0x1f16ba,_0x1237ed){return _0x1f16ba[_0x0063('0xb')]('VoiceContext',attributes,{'tableName':_0x0063('0xc'),'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 dccfd79..1724f84 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 _0x99d1=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','VoiceContext,\x20%s,\x20%s','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x4b6cc8,_0x355e5b){var _0x5c4743=function(_0x68d0f6){while(--_0x68d0f6){_0x4b6cc8['push'](_0x4b6cc8['shift']());}};_0x5c4743(++_0x355e5b);}(_0x99d1,0x104));var _0x199d=function(_0xb9d1bc,_0x7a8ced){_0xb9d1bc=_0xb9d1bc-0x0;var _0x4bce70=_0x99d1[_0xb9d1bc];return _0x4bce70;};'use strict';var _=require(_0x199d('0x0'));var util=require('util');var moment=require(_0x199d('0x1'));var BPromise=require(_0x199d('0x2'));var rs=require(_0x199d('0x3'));var fs=require('fs');var Redis=require(_0x199d('0x4'));var db=require(_0x199d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x199d('0x6'))(_0x199d('0x7'));var config=require(_0x199d('0x8'));var jayson=require(_0x199d('0x9'));var client=jayson[_0x199d('0xa')][_0x199d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x15cca0,_0x1c1fe5,_0x1dd7e4){return new BPromise(function(_0x407e36,_0x277bf9){return client[_0x199d('0xc')](_0x15cca0,_0x1dd7e4)[_0x199d('0xd')](function(_0x2bf231){logger['info'](_0x199d('0xe'),_0x1c1fe5,_0x199d('0xf'));logger['debug'](_0x199d('0x10'),_0x1c1fe5,_0x199d('0xf'),JSON[_0x199d('0x11')](_0x2bf231));if(_0x2bf231['error']){if(_0x2bf231[_0x199d('0x12')][_0x199d('0x13')]===0x1f4){logger['error']('VoiceContext,\x20%s,\x20%s',_0x1c1fe5,_0x2bf231[_0x199d('0x12')][_0x199d('0x14')]);return _0x277bf9(_0x2bf231[_0x199d('0x12')][_0x199d('0x14')]);}logger[_0x199d('0x12')](_0x199d('0xe'),_0x1c1fe5,_0x2bf231['error'][_0x199d('0x14')]);return _0x407e36(_0x2bf231[_0x199d('0x12')]['message']);}else{logger[_0x199d('0x15')](_0x199d('0xe'),_0x1c1fe5,_0x199d('0xf'));_0x407e36(_0x2bf231[_0x199d('0x16')][_0x199d('0x14')]);}})[_0x199d('0x17')](function(_0x1fa235){logger[_0x199d('0x12')](_0x199d('0xe'),_0x1c1fe5,_0x1fa235);_0x277bf9(_0x1fa235);});});} \ No newline at end of file +var _0x42f4=['jayson/promise','http','then','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceContext,\x20%s,\x20%s','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment'];(function(_0x2738fc,_0x326e22){var _0x1a3cc2=function(_0x1001f2){while(--_0x1001f2){_0x2738fc['push'](_0x2738fc['shift']());}};_0x1a3cc2(++_0x326e22);}(_0x42f4,0x19d));var _0x442f=function(_0xd7b0a4,_0x53c7d3){_0xd7b0a4=_0xd7b0a4-0x0;var _0x184e9e=_0x42f4[_0xd7b0a4];return _0x184e9e;};'use strict';var _=require(_0x442f('0x0'));var util=require('util');var moment=require(_0x442f('0x1'));var BPromise=require(_0x442f('0x2'));var rs=require(_0x442f('0x3'));var fs=require('fs');var Redis=require(_0x442f('0x4'));var db=require(_0x442f('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x442f('0x6'));var jayson=require(_0x442f('0x7'));var client=jayson['client'][_0x442f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x11b450,_0x23c5ba,_0x37dfe7){return new BPromise(function(_0x6c0b4b,_0x476480){return client['request'](_0x11b450,_0x37dfe7)[_0x442f('0x9')](function(_0x4e32af){logger['info']('VoiceContext,\x20%s,\x20%s',_0x23c5ba,_0x442f('0xa'));logger[_0x442f('0xb')](_0x442f('0xc'),_0x23c5ba,_0x442f('0xa'),JSON[_0x442f('0xd')](_0x4e32af));if(_0x4e32af[_0x442f('0xe')]){if(_0x4e32af[_0x442f('0xe')][_0x442f('0xf')]===0x1f4){logger[_0x442f('0xe')](_0x442f('0x10'),_0x23c5ba,_0x4e32af['error'][_0x442f('0x11')]);return _0x476480(_0x4e32af[_0x442f('0xe')][_0x442f('0x11')]);}logger[_0x442f('0xe')](_0x442f('0x10'),_0x23c5ba,_0x4e32af[_0x442f('0xe')][_0x442f('0x11')]);return _0x6c0b4b(_0x4e32af[_0x442f('0xe')][_0x442f('0x11')]);}else{logger[_0x442f('0x12')](_0x442f('0x10'),_0x23c5ba,_0x442f('0xa'));_0x6c0b4b(_0x4e32af[_0x442f('0x13')][_0x442f('0x11')]);}})[_0x442f('0x14')](function(_0x3ff2b1){logger['error'](_0x442f('0x10'),_0x23c5ba,_0x3ff2b1);_0x476480(_0x3ff2b1);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 05a85e4..2c56932 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 _0xb60e=['show','create','/:id','update','delete','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','/describe','describe'];(function(_0x1e7e12,_0x586d42){var _0x32781c=function(_0x39ee5b){while(--_0x39ee5b){_0x1e7e12['push'](_0x1e7e12['shift']());}};_0x32781c(++_0x586d42);}(_0xb60e,0x10f));var _0xeb60=function(_0x48f038,_0x2bde84){_0x48f038=_0x48f038-0x0;var _0x2edc62=_0xb60e[_0x48f038];return _0x2edc62;};'use strict';var multer=require(_0xeb60('0x0'));var util=require(_0xeb60('0x1'));var path=require(_0xeb60('0x2'));var timeout=require(_0xeb60('0x3'));var express=require(_0xeb60('0x4'));var router=express[_0xeb60('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xeb60('0x6'));var interaction=require(_0xeb60('0x7'));var config=require(_0xeb60('0x8'));var controller=require(_0xeb60('0x9'));router[_0xeb60('0xa')]('/',auth[_0xeb60('0xb')](),controller['index']);router[_0xeb60('0xa')](_0xeb60('0xc'),auth['isAuthenticated'](),controller[_0xeb60('0xd')]);router[_0xeb60('0xa')]('/:id',auth[_0xeb60('0xb')](),controller[_0xeb60('0xe')]);router['post']('/',auth[_0xeb60('0xb')](),controller[_0xeb60('0xf')]);router['put'](_0xeb60('0x10'),auth['isAuthenticated'](),controller[_0xeb60('0x11')]);router[_0xeb60('0x12')](_0xeb60('0x10'),auth[_0xeb60('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x8a1b=['describe','/:id','post','put','update','delete','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','index','/describe','isAuthenticated'];(function(_0x21d2b6,_0xc16e6c){var _0x14603d=function(_0x178dc4){while(--_0x178dc4){_0x21d2b6['push'](_0x21d2b6['shift']());}};_0x14603d(++_0xc16e6c);}(_0x8a1b,0xf8));var _0xb8a1=function(_0x4f4b1b,_0x4b1917){_0x4f4b1b=_0x4f4b1b-0x0;var _0x3c2aec=_0x8a1b[_0x4f4b1b];return _0x3c2aec;};'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['get'](_0xb8a1('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xb8a1('0xe')]('/',auth[_0xb8a1('0xb')](),controller['create']);router[_0xb8a1('0xf')]('/:id',auth[_0xb8a1('0xb')](),controller[_0xb8a1('0x10')]);router[_0xb8a1('0x11')](_0xb8a1('0xd'),auth['isAuthenticated'](),controller[_0xb8a1('0x12')]);module[_0xb8a1('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 62dad3b..913593a 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 _0xa41a=['exports','STRING','INTEGER','DATE','called,connect,complete','sequelize'];(function(_0x37b48a,_0x12e51c){var _0x3e0a7c=function(_0x5d697f){while(--_0x5d697f){_0x37b48a['push'](_0x37b48a['shift']());}};_0x3e0a7c(++_0x12e51c);}(_0xa41a,0x6b));var _0xaa41=function(_0x3affd9,_0x3a0e92){_0x3affd9=_0x3affd9-0x0;var _0x4e0bd1=_0xa41a[_0x3affd9];return _0x4e0bd1;};'use strict';var Sequelize=require(_0xaa41('0x0'));module[_0xaa41('0x1')]={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xaa41('0x2')]},'channelstate':{'type':Sequelize[_0xaa41('0x3')]},'channelstatedesc':{'type':Sequelize[_0xaa41('0x2')]},'calleridnum':{'type':Sequelize[_0xaa41('0x2')]},'calleridname':{'type':Sequelize[_0xaa41('0x2')]},'connectedlinenum':{'type':Sequelize[_0xaa41('0x2')]},'connectedlinename':{'type':Sequelize[_0xaa41('0x2')]},'language':{'type':Sequelize[_0xaa41('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xaa41('0x2')]},'exten':{'type':Sequelize[_0xaa41('0x2')]},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0xaa41('0x2')]},'destchannel':{'type':Sequelize[_0xaa41('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xaa41('0x2')]},'destcalleridnum':{'type':Sequelize[_0xaa41('0x2')]},'destcalleridname':{'type':Sequelize[_0xaa41('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xaa41('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xaa41('0x2')]},'destlanguage':{'type':Sequelize[_0xaa41('0x2')]},'destaccountcode':{'type':Sequelize[_0xaa41('0x2')]},'destcontext':{'type':Sequelize[_0xaa41('0x2')]},'destexten':{'type':Sequelize[_0xaa41('0x2')]},'destpriority':{'type':Sequelize['INTEGER']},'destuniqueid':{'type':Sequelize[_0xaa41('0x2')]},'destlinkedid':{'type':Sequelize[_0xaa41('0x2')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xaa41('0x4')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xaa41('0x4')]},'lastevent':{'type':Sequelize[_0xaa41('0x2')],'comment':_0xaa41('0x5')},'routeId':{'type':Sequelize[_0xaa41('0x3')]},'duration':{'type':Sequelize[_0xaa41('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0xaa41('0x3')]}}; \ No newline at end of file +var _0x55ca=['exports','STRING','INTEGER','DATE','sequelize'];(function(_0x37d289,_0x5929e7){var _0x2306c6=function(_0x2de010){while(--_0x2de010){_0x37d289['push'](_0x37d289['shift']());}};_0x2306c6(++_0x5929e7);}(_0x55ca,0x126));var _0xa55c=function(_0x539d7b,_0x5f2eba){_0x539d7b=_0x539d7b-0x0;var _0x31953c=_0x55ca[_0x539d7b];return _0x31953c;};'use strict';var Sequelize=require(_0xa55c('0x0'));module[_0xa55c('0x1')]={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xa55c('0x2')]},'calleridnum':{'type':Sequelize[_0xa55c('0x2')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xa55c('0x2')]},'connectedlinename':{'type':Sequelize[_0xa55c('0x2')]},'language':{'type':Sequelize[_0xa55c('0x2')]},'accountcode':{'type':Sequelize[_0xa55c('0x2')]},'context':{'type':Sequelize[_0xa55c('0x2')]},'exten':{'type':Sequelize[_0xa55c('0x2')]},'priority':{'type':Sequelize[_0xa55c('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0xa55c('0x2')]},'destchannel':{'type':Sequelize[_0xa55c('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xa55c('0x2')]},'destcalleridnum':{'type':Sequelize[_0xa55c('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0xa55c('0x2')]},'destlanguage':{'type':Sequelize[_0xa55c('0x2')]},'destaccountcode':{'type':Sequelize[_0xa55c('0x2')]},'destcontext':{'type':Sequelize[_0xa55c('0x2')]},'destexten':{'type':Sequelize[_0xa55c('0x2')]},'destpriority':{'type':Sequelize[_0xa55c('0x3')]},'destuniqueid':{'type':Sequelize[_0xa55c('0x2')]},'destlinkedid':{'type':Sequelize[_0xa55c('0x2')]},'dialstring':{'type':Sequelize[_0xa55c('0x2')]},'dialstatus':{'type':Sequelize[_0xa55c('0x2')]},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xa55c('0x4')]},'lastevent':{'type':Sequelize['STRING'],'comment':'called,connect,complete'},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize[_0xa55c('0x3')]},'holdtime':{'type':Sequelize[_0xa55c('0x3')]},'billableseconds':{'type':Sequelize[_0xa55c('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 99042ee..1faa678 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 _0xa0d4=['where','VIRTUAL','options','VoiceDialReport','includeAll','include','findAll','catch','show','filters','length','find','create','body','destroy','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','model','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','merge'];(function(_0x322f4d,_0x2211c6){var _0x548443=function(_0x5f42a4){while(--_0x5f42a4){_0x322f4d['push'](_0x322f4d['shift']());}};_0x548443(++_0x2211c6);}(_0xa0d4,0xaf));var _0x4a0d=function(_0x5b9d3a,_0x1f1842){_0x5b9d3a=_0x5b9d3a-0x0;var _0x383375=_0xa0d4[_0x5b9d3a];return _0x383375;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4a0d('0x0'));var zipdir=require(_0x4a0d('0x1'));var jsonpatch=require(_0x4a0d('0x2'));var rp=require(_0x4a0d('0x3'));var moment=require(_0x4a0d('0x4'));var BPromise=require(_0x4a0d('0x5'));var Mustache=require(_0x4a0d('0x6'));var util=require(_0x4a0d('0x7'));var path=require(_0x4a0d('0x8'));var sox=require(_0x4a0d('0x9'));var csv=require(_0x4a0d('0xa'));var ejs=require(_0x4a0d('0xb'));var fs=require('fs');var fs_extra=require(_0x4a0d('0xc'));var _=require(_0x4a0d('0xd'));var squel=require(_0x4a0d('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4a0d('0xa'));var querystring=require(_0x4a0d('0xf'));var Papa=require('papaparse');var Redis=require(_0x4a0d('0x10'));var authService=require(_0x4a0d('0x11'));var qs=require(_0x4a0d('0x12'));var as=require(_0x4a0d('0x13'));var hardwareService=require(_0x4a0d('0x14'));var logger=require('../../config/logger')(_0x4a0d('0x15'));var utils=require(_0x4a0d('0x16'));var config=require(_0x4a0d('0x17'));var licenseUtil=require(_0x4a0d('0x18'));var db=require(_0x4a0d('0x19'))['db'];function respondWithStatusCode(_0x53debb,_0x177aca){_0x177aca=_0x177aca||0xcc;return function(_0x33811a){if(_0x33811a){return _0x53debb['sendStatus'](_0x177aca);}return _0x53debb[_0x4a0d('0x1a')](_0x177aca)[_0x4a0d('0x1b')]();};}function respondWithResult(_0x3d8c2e,_0x4580e1){_0x4580e1=_0x4580e1||0xc8;return function(_0x319488){if(_0x319488){return _0x3d8c2e[_0x4a0d('0x1a')](_0x4580e1)[_0x4a0d('0x1c')](_0x319488);}};}function respondWithFilteredResult(_0x4cb6be,_0x1ed971){return function(_0x55f986){if(_0x55f986){var _0x499f61=typeof _0x1ed971[_0x4a0d('0x1d')]===_0x4a0d('0x1e')&&typeof _0x1ed971[_0x4a0d('0x1f')]===_0x4a0d('0x1e');var _0x1120a6=_0x55f986[_0x4a0d('0x20')];var _0x386e35=_0x499f61?0x0:_0x1ed971[_0x4a0d('0x1d')];var _0x427aca=_0x499f61?_0x55f986[_0x4a0d('0x20')]:_0x1ed971['offset']+_0x1ed971[_0x4a0d('0x1f')];var _0x267704;if(_0x427aca>=_0x1120a6){_0x427aca=_0x1120a6;_0x267704=0xc8;}else{_0x267704=0xce;}_0x4cb6be[_0x4a0d('0x1a')](_0x267704);return _0x4cb6be[_0x4a0d('0x21')](_0x4a0d('0x22'),_0x386e35+'-'+_0x427aca+'/'+_0x1120a6)[_0x4a0d('0x1c')](_0x55f986);}return null;};}function patchUpdates(_0x13a98f){return function(_0xbbe9dd){try{jsonpatch[_0x4a0d('0x23')](_0xbbe9dd,_0x13a98f,!![]);}catch(_0x2ff296){return BPromise[_0x4a0d('0x24')](_0x2ff296);}return _0xbbe9dd[_0x4a0d('0x25')]();};}function saveUpdates(_0x21b238,_0x4cc614){return function(_0x4d5438){if(_0x4d5438){return _0x4d5438[_0x4a0d('0x26')](_0x21b238)[_0x4a0d('0x27')](function(_0x13103b){return _0x13103b;});}return null;};}function removeEntity(_0x2daa72,_0x3707e1){return function(_0x12eaa0){if(_0x12eaa0){return _0x12eaa0['destroy']()[_0x4a0d('0x27')](function(){_0x2daa72[_0x4a0d('0x1a')](0xcc)[_0x4a0d('0x1b')]();});}};}function handleEntityNotFound(_0x49341b,_0x3166dc){return function(_0x33d4de){if(!_0x33d4de){_0x49341b[_0x4a0d('0x28')](0x194);}return _0x33d4de;};}function handleError(_0x1877a9,_0x1cda36){_0x1cda36=_0x1cda36||0x1f4;return function(_0x412036){logger['error'](_0x412036[_0x4a0d('0x29')]);if(_0x412036[_0x4a0d('0x2a')]){delete _0x412036[_0x4a0d('0x2a')];}_0x1877a9['status'](_0x1cda36)[_0x4a0d('0x2b')](_0x412036);};}exports[_0x4a0d('0x2c')]=function(_0x3d08b4,_0x3351a8){var _0x1b3b03={},_0x178ddf={},_0x876b3b={'count':0x0,'rows':[]};var _0x43b47b=_[_0x4a0d('0x2d')](db['VoiceDialReport'][_0x4a0d('0x2e')],function(_0x28ae0f){return{'name':_0x28ae0f[_0x4a0d('0x2f')],'type':_0x28ae0f[_0x4a0d('0x30')]['key']};});_0x178ddf[_0x4a0d('0x31')]=_[_0x4a0d('0x2d')](_0x43b47b,_0x4a0d('0x2a'));_0x178ddf['query']=_[_0x4a0d('0x32')](_0x3d08b4[_0x4a0d('0x33')]);_0x178ddf['filters']=_[_0x4a0d('0x34')](_0x178ddf[_0x4a0d('0x31')],_0x178ddf[_0x4a0d('0x33')]);_0x1b3b03[_0x4a0d('0x35')]=_[_0x4a0d('0x34')](_0x178ddf[_0x4a0d('0x31')],qs[_0x4a0d('0x36')](_0x3d08b4['query'][_0x4a0d('0x36')]));_0x1b3b03[_0x4a0d('0x35')]=_0x1b3b03[_0x4a0d('0x35')]['length']?_0x1b3b03[_0x4a0d('0x35')]:_0x178ddf[_0x4a0d('0x31')];if(!_0x3d08b4[_0x4a0d('0x33')][_0x4a0d('0x37')](_0x4a0d('0x38'))){_0x1b3b03['limit']=qs[_0x4a0d('0x1f')](_0x3d08b4[_0x4a0d('0x33')][_0x4a0d('0x1f')]);_0x1b3b03[_0x4a0d('0x1d')]=qs[_0x4a0d('0x1d')](_0x3d08b4[_0x4a0d('0x33')][_0x4a0d('0x1d')]);}_0x1b3b03[_0x4a0d('0x39')]=qs[_0x4a0d('0x3a')](_0x3d08b4[_0x4a0d('0x33')]['sort']);_0x1b3b03['where']=qs['filters'](_[_0x4a0d('0x3b')](_0x3d08b4['query'],_0x178ddf['filters']),_0x43b47b);if(_0x3d08b4['query'][_0x4a0d('0x3c')]){_0x1b3b03['where']=_[_0x4a0d('0x3d')](_0x1b3b03[_0x4a0d('0x3e')],{'$or':_[_0x4a0d('0x2d')](_0x43b47b,function(_0x11cc4b){if(_0x11cc4b['type']!==_0x4a0d('0x3f')){var _0x294da5={};_0x294da5[_0x11cc4b[_0x4a0d('0x2a')]]={'$like':'%'+_0x3d08b4['query'][_0x4a0d('0x3c')]+'%'};return _0x294da5;}})});}_0x1b3b03=_['merge']({},_0x1b3b03,_0x3d08b4[_0x4a0d('0x40')]);var _0x5564b5={'where':_0x1b3b03[_0x4a0d('0x3e')]};return db[_0x4a0d('0x41')][_0x4a0d('0x20')](_0x5564b5)[_0x4a0d('0x27')](function(_0x4d8c5d){_0x876b3b[_0x4a0d('0x20')]=_0x4d8c5d;if(_0x3d08b4[_0x4a0d('0x33')][_0x4a0d('0x42')]){_0x1b3b03[_0x4a0d('0x43')]=[{'all':!![]}];}return db[_0x4a0d('0x41')][_0x4a0d('0x44')](_0x1b3b03);})[_0x4a0d('0x27')](function(_0x386127){_0x876b3b['rows']=_0x386127;return _0x876b3b;})['then'](respondWithFilteredResult(_0x3351a8,_0x1b3b03))[_0x4a0d('0x45')](handleError(_0x3351a8,null));};exports[_0x4a0d('0x46')]=function(_0x3ec1cd,_0xca4ff7){var _0x2d1766={'raw':!![],'where':{'id':_0x3ec1cd['params']['id']}},_0x5f0643={};_0x5f0643[_0x4a0d('0x31')]=_['keys'](db[_0x4a0d('0x41')]['rawAttributes']);_0x5f0643['query']=_[_0x4a0d('0x32')](_0x3ec1cd[_0x4a0d('0x33')]);_0x5f0643[_0x4a0d('0x47')]=_[_0x4a0d('0x34')](_0x5f0643['model'],_0x5f0643['query']);_0x2d1766[_0x4a0d('0x35')]=_[_0x4a0d('0x34')](_0x5f0643[_0x4a0d('0x31')],qs[_0x4a0d('0x36')](_0x3ec1cd[_0x4a0d('0x33')][_0x4a0d('0x36')]));_0x2d1766[_0x4a0d('0x35')]=_0x2d1766['attributes'][_0x4a0d('0x48')]?_0x2d1766[_0x4a0d('0x35')]:_0x5f0643[_0x4a0d('0x31')];if(_0x3ec1cd[_0x4a0d('0x33')]['includeAll']){_0x2d1766[_0x4a0d('0x43')]=[{'all':!![]}];}_0x2d1766=_['merge']({},_0x2d1766,_0x3ec1cd[_0x4a0d('0x40')]);return db[_0x4a0d('0x41')][_0x4a0d('0x49')](_0x2d1766)[_0x4a0d('0x27')](handleEntityNotFound(_0xca4ff7,null))['then'](respondWithResult(_0xca4ff7,null))[_0x4a0d('0x45')](handleError(_0xca4ff7,null));};exports['create']=function(_0xd546f0,_0x31dbb4){return db[_0x4a0d('0x41')][_0x4a0d('0x4a')](_0xd546f0[_0x4a0d('0x4b')],{})[_0x4a0d('0x27')](respondWithResult(_0x31dbb4,0xc9))[_0x4a0d('0x45')](handleError(_0x31dbb4,null));};exports['update']=function(_0x70e7d4,_0x4aeec6){if(_0x70e7d4['body']['id']){delete _0x70e7d4['body']['id'];}return db[_0x4a0d('0x41')][_0x4a0d('0x49')]({'where':{'id':_0x70e7d4['params']['id']}})[_0x4a0d('0x27')](handleEntityNotFound(_0x4aeec6,null))[_0x4a0d('0x27')](saveUpdates(_0x70e7d4['body'],null))[_0x4a0d('0x27')](respondWithResult(_0x4aeec6,null))[_0x4a0d('0x45')](handleError(_0x4aeec6,null));};exports[_0x4a0d('0x4c')]=function(_0x5b58c3,_0x47eda6){return db[_0x4a0d('0x41')][_0x4a0d('0x49')]({'where':{'id':_0x5b58c3[_0x4a0d('0x4d')]['id']}})[_0x4a0d('0x27')](handleEntityNotFound(_0x47eda6,null))[_0x4a0d('0x27')](removeEntity(_0x47eda6,null))['catch'](handleError(_0x47eda6,null));};exports[_0x4a0d('0x4e')]=function(_0x3573e4,_0x31c53c){return db[_0x4a0d('0x41')][_0x4a0d('0x4e')]()['then'](respondWithResult(_0x31c53c,null))[_0x4a0d('0x45')](handleError(_0x31c53c,null));}; \ No newline at end of file +var _0xa3ea=['nolimit','limit','sort','pick','filter','where','merge','options','findAll','rows','catch','params','rawAttributes','includeAll','include','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','count','set','Content-Range','reject','save','update','then','stack','name','send','index','map','VoiceDialReport','type','key','model','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty'];(function(_0x3ceaa7,_0x540732){var _0x390948=function(_0x15d06b){while(--_0x15d06b){_0x3ceaa7['push'](_0x3ceaa7['shift']());}};_0x390948(++_0x540732);}(_0xa3ea,0x1dc));var _0xaa3e=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xa3ea[_0x19950b];return _0x3c6b41;};'use strict';var emlformat=require(_0xaa3e('0x0'));var rimraf=require(_0xaa3e('0x1'));var zipdir=require(_0xaa3e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaa3e('0x3'));var moment=require(_0xaa3e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xaa3e('0x5'));var util=require(_0xaa3e('0x6'));var path=require(_0xaa3e('0x7'));var sox=require(_0xaa3e('0x8'));var csv=require('to-csv');var ejs=require(_0xaa3e('0x9'));var fs=require('fs');var fs_extra=require(_0xaa3e('0xa'));var _=require('lodash');var squel=require(_0xaa3e('0xb'));var crypto=require(_0xaa3e('0xc'));var jsforce=require(_0xaa3e('0xd'));var deskjs=require(_0xaa3e('0xe'));var toCsv=require(_0xaa3e('0xf'));var querystring=require(_0xaa3e('0x10'));var Papa=require('papaparse');var Redis=require(_0xaa3e('0x11'));var authService=require(_0xaa3e('0x12'));var qs=require(_0xaa3e('0x13'));var as=require(_0xaa3e('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xaa3e('0x15'))(_0xaa3e('0x16'));var utils=require(_0xaa3e('0x17'));var config=require(_0xaa3e('0x18'));var licenseUtil=require(_0xaa3e('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xf4082f,_0x228749){_0x228749=_0x228749||0xcc;return function(_0x2eabd0){if(_0x2eabd0){return _0xf4082f[_0xaa3e('0x1a')](_0x228749);}return _0xf4082f['status'](_0x228749)[_0xaa3e('0x1b')]();};}function respondWithResult(_0x2aba8e,_0x13f138){_0x13f138=_0x13f138||0xc8;return function(_0x4cffe2){if(_0x4cffe2){return _0x2aba8e[_0xaa3e('0x1c')](_0x13f138)[_0xaa3e('0x1d')](_0x4cffe2);}};}function respondWithFilteredResult(_0x2a754c,_0x2d54a6){return function(_0x23c678){if(_0x23c678){var _0x58f28b=typeof _0x2d54a6[_0xaa3e('0x1e')]===_0xaa3e('0x1f')&&typeof _0x2d54a6['limit']===_0xaa3e('0x1f');var _0x144ef2=_0x23c678['count'];var _0x5bcf02=_0x58f28b?0x0:_0x2d54a6[_0xaa3e('0x1e')];var _0xbbeaed=_0x58f28b?_0x23c678[_0xaa3e('0x20')]:_0x2d54a6[_0xaa3e('0x1e')]+_0x2d54a6['limit'];var _0x1fd8bc;if(_0xbbeaed>=_0x144ef2){_0xbbeaed=_0x144ef2;_0x1fd8bc=0xc8;}else{_0x1fd8bc=0xce;}_0x2a754c[_0xaa3e('0x1c')](_0x1fd8bc);return _0x2a754c[_0xaa3e('0x21')](_0xaa3e('0x22'),_0x5bcf02+'-'+_0xbbeaed+'/'+_0x144ef2)[_0xaa3e('0x1d')](_0x23c678);}return null;};}function patchUpdates(_0x6bf94a){return function(_0x57996f){try{jsonpatch['apply'](_0x57996f,_0x6bf94a,!![]);}catch(_0x51b99a){return BPromise[_0xaa3e('0x23')](_0x51b99a);}return _0x57996f[_0xaa3e('0x24')]();};}function saveUpdates(_0x5b0ef3,_0x2aead8){return function(_0x44966e){if(_0x44966e){return _0x44966e[_0xaa3e('0x25')](_0x5b0ef3)[_0xaa3e('0x26')](function(_0x1906a2){return _0x1906a2;});}return null;};}function removeEntity(_0x5158c2,_0x316369){return function(_0x6136cb){if(_0x6136cb){return _0x6136cb['destroy']()['then'](function(){_0x5158c2[_0xaa3e('0x1c')](0xcc)[_0xaa3e('0x1b')]();});}};}function handleEntityNotFound(_0x578476,_0x451352){return function(_0x452283){if(!_0x452283){_0x578476['sendStatus'](0x194);}return _0x452283;};}function handleError(_0x28f60a,_0x11c378){_0x11c378=_0x11c378||0x1f4;return function(_0x5b5667){logger['error'](_0x5b5667[_0xaa3e('0x27')]);if(_0x5b5667[_0xaa3e('0x28')]){delete _0x5b5667['name'];}_0x28f60a['status'](_0x11c378)[_0xaa3e('0x29')](_0x5b5667);};}exports[_0xaa3e('0x2a')]=function(_0xc5c084,_0x304956){var _0x181ae4={},_0x1e44de={},_0x4f249a={'count':0x0,'rows':[]};var _0x3fa205=_[_0xaa3e('0x2b')](db[_0xaa3e('0x2c')]['rawAttributes'],function(_0x3fb9c5){return{'name':_0x3fb9c5['fieldName'],'type':_0x3fb9c5[_0xaa3e('0x2d')][_0xaa3e('0x2e')]};});_0x1e44de[_0xaa3e('0x2f')]=_[_0xaa3e('0x2b')](_0x3fa205,_0xaa3e('0x28'));_0x1e44de[_0xaa3e('0x30')]=_[_0xaa3e('0x31')](_0xc5c084['query']);_0x1e44de[_0xaa3e('0x32')]=_['intersection'](_0x1e44de[_0xaa3e('0x2f')],_0x1e44de[_0xaa3e('0x30')]);_0x181ae4['attributes']=_[_0xaa3e('0x33')](_0x1e44de[_0xaa3e('0x2f')],qs[_0xaa3e('0x34')](_0xc5c084[_0xaa3e('0x30')][_0xaa3e('0x34')]));_0x181ae4['attributes']=_0x181ae4['attributes'][_0xaa3e('0x35')]?_0x181ae4[_0xaa3e('0x36')]:_0x1e44de[_0xaa3e('0x2f')];if(!_0xc5c084[_0xaa3e('0x30')][_0xaa3e('0x37')](_0xaa3e('0x38'))){_0x181ae4['limit']=qs[_0xaa3e('0x39')](_0xc5c084['query'][_0xaa3e('0x39')]);_0x181ae4[_0xaa3e('0x1e')]=qs['offset'](_0xc5c084['query'][_0xaa3e('0x1e')]);}_0x181ae4['order']=qs[_0xaa3e('0x3a')](_0xc5c084[_0xaa3e('0x30')][_0xaa3e('0x3a')]);_0x181ae4['where']=qs[_0xaa3e('0x32')](_[_0xaa3e('0x3b')](_0xc5c084[_0xaa3e('0x30')],_0x1e44de[_0xaa3e('0x32')]),_0x3fa205);if(_0xc5c084[_0xaa3e('0x30')][_0xaa3e('0x3c')]){_0x181ae4[_0xaa3e('0x3d')]=_[_0xaa3e('0x3e')](_0x181ae4[_0xaa3e('0x3d')],{'$or':_['map'](_0x3fa205,function(_0x14aa63){if(_0x14aa63[_0xaa3e('0x2d')]!=='VIRTUAL'){var _0x4958e5={};_0x4958e5[_0x14aa63[_0xaa3e('0x28')]]={'$like':'%'+_0xc5c084[_0xaa3e('0x30')][_0xaa3e('0x3c')]+'%'};return _0x4958e5;}})});}_0x181ae4=_['merge']({},_0x181ae4,_0xc5c084[_0xaa3e('0x3f')]);var _0x3bfef0={'where':_0x181ae4[_0xaa3e('0x3d')]};return db[_0xaa3e('0x2c')]['count'](_0x3bfef0)[_0xaa3e('0x26')](function(_0x404341){_0x4f249a[_0xaa3e('0x20')]=_0x404341;if(_0xc5c084[_0xaa3e('0x30')]['includeAll']){_0x181ae4['include']=[{'all':!![]}];}return db[_0xaa3e('0x2c')][_0xaa3e('0x40')](_0x181ae4);})[_0xaa3e('0x26')](function(_0x1678ce){_0x4f249a[_0xaa3e('0x41')]=_0x1678ce;return _0x4f249a;})[_0xaa3e('0x26')](respondWithFilteredResult(_0x304956,_0x181ae4))[_0xaa3e('0x42')](handleError(_0x304956,null));};exports['show']=function(_0x35df67,_0x24790e){var _0x3440d5={'raw':!![],'where':{'id':_0x35df67[_0xaa3e('0x43')]['id']}},_0x3927c5={};_0x3927c5['model']=_[_0xaa3e('0x31')](db[_0xaa3e('0x2c')][_0xaa3e('0x44')]);_0x3927c5[_0xaa3e('0x30')]=_[_0xaa3e('0x31')](_0x35df67[_0xaa3e('0x30')]);_0x3927c5[_0xaa3e('0x32')]=_[_0xaa3e('0x33')](_0x3927c5[_0xaa3e('0x2f')],_0x3927c5[_0xaa3e('0x30')]);_0x3440d5[_0xaa3e('0x36')]=_['intersection'](_0x3927c5[_0xaa3e('0x2f')],qs[_0xaa3e('0x34')](_0x35df67[_0xaa3e('0x30')]['fields']));_0x3440d5[_0xaa3e('0x36')]=_0x3440d5[_0xaa3e('0x36')]['length']?_0x3440d5[_0xaa3e('0x36')]:_0x3927c5['model'];if(_0x35df67[_0xaa3e('0x30')][_0xaa3e('0x45')]){_0x3440d5[_0xaa3e('0x46')]=[{'all':!![]}];}_0x3440d5=_[_0xaa3e('0x3e')]({},_0x3440d5,_0x35df67[_0xaa3e('0x3f')]);return db['VoiceDialReport'][_0xaa3e('0x47')](_0x3440d5)[_0xaa3e('0x26')](handleEntityNotFound(_0x24790e,null))[_0xaa3e('0x26')](respondWithResult(_0x24790e,null))[_0xaa3e('0x42')](handleError(_0x24790e,null));};exports['create']=function(_0x10f39b,_0x131f34){return db['VoiceDialReport'][_0xaa3e('0x48')](_0x10f39b[_0xaa3e('0x49')],{})['then'](respondWithResult(_0x131f34,0xc9))[_0xaa3e('0x42')](handleError(_0x131f34,null));};exports['update']=function(_0x2be4a0,_0x73e776){if(_0x2be4a0[_0xaa3e('0x49')]['id']){delete _0x2be4a0['body']['id'];}return db[_0xaa3e('0x2c')]['find']({'where':{'id':_0x2be4a0['params']['id']}})[_0xaa3e('0x26')](handleEntityNotFound(_0x73e776,null))['then'](saveUpdates(_0x2be4a0[_0xaa3e('0x49')],null))[_0xaa3e('0x26')](respondWithResult(_0x73e776,null))['catch'](handleError(_0x73e776,null));};exports[_0xaa3e('0x4a')]=function(_0x5dc308,_0x4d8639){return db[_0xaa3e('0x2c')][_0xaa3e('0x47')]({'where':{'id':_0x5dc308[_0xaa3e('0x43')]['id']}})[_0xaa3e('0x26')](handleEntityNotFound(_0x4d8639,null))[_0xaa3e('0x26')](removeEntity(_0x4d8639,null))[_0xaa3e('0x42')](handleError(_0x4d8639,null));};exports[_0xaa3e('0x4b')]=function(_0x59eb13,_0x49923f){return db['VoiceDialReport'][_0xaa3e('0x4b')]()[_0xaa3e('0x26')](respondWithResult(_0x49923f,null))['catch'](handleError(_0x49923f,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 2590cc8..82f68d4 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 _0x4f5a=['request-promise','rimraf','../../config/environment','define','VoiceDialReport','uniqueid','lodash','../../config/logger'];(function(_0x2e9471,_0x2204d5){var _0x2f6954=function(_0x597bbd){while(--_0x597bbd){_0x2e9471['push'](_0x2e9471['shift']());}};_0x2f6954(++_0x2204d5);}(_0x4f5a,0x10e));var _0xa4f5=function(_0x1a6269,_0x5deea5){_0x1a6269=_0x1a6269-0x0;var _0x536f68=_0x4f5a[_0x1a6269];return _0x536f68;};'use strict';var _=require(_0xa4f5('0x0'));var util=require('util');var logger=require(_0xa4f5('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa4f5('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa4f5('0x3'));var config=require(_0xa4f5('0x4'));var attributes=require('./voiceDialReport.attributes');module['exports']=function(_0x3122bd,_0x16f87c){return _0x3122bd[_0xa4f5('0x5')](_0xa4f5('0x6'),attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':[_0xa4f5('0x7')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7610=['../../config/environment','./voiceDialReport.attributes','define','VoiceDialReport','uniqueid','lodash','util','../../config/logger','api','request-promise','path'];(function(_0x342700,_0x569f75){var _0x53406f=function(_0x3b3c32){while(--_0x3b3c32){_0x342700['push'](_0x342700['shift']());}};_0x53406f(++_0x569f75);}(_0x7610,0x123));var _0x0761=function(_0x1961d3,_0x3a83cb){_0x1961d3=_0x1961d3-0x0;var _0x21e06a=_0x7610[_0x1961d3];return _0x21e06a;};'use strict';var _=require(_0x0761('0x0'));var util=require(_0x0761('0x1'));var logger=require(_0x0761('0x2'))(_0x0761('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0761('0x4'));var fs=require('fs');var path=require(_0x0761('0x5'));var rimraf=require('rimraf');var config=require(_0x0761('0x6'));var attributes=require(_0x0761('0x7'));module['exports']=function(_0x30022e,_0x4788e4){return _0x30022e[_0x0761('0x8')](_0x0761('0x9'),attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':[_0x0761('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 6bb6144..d88e8d6 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 _0xb768=['options','raw','then','CreateVoiceDialReport','debug','UpdateVoiceDialReport','limit','stringify','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','info','VoiceDialReport,\x20%s,\x20%s,\x20%s','error','VoiceDialReport,\x20%s,\x20%s','message','catch','VoiceDialReport','create','body'];(function(_0x501e67,_0x2e6643){var _0x16b255=function(_0x474eb4){while(--_0x474eb4){_0x501e67['push'](_0x501e67['shift']());}};_0x16b255(++_0x2e6643);}(_0xb768,0x1e4));var _0x8b76=function(_0x2709ee,_0x4db185){_0x2709ee=_0x2709ee-0x0;var _0x35ba9a=_0xb768[_0x2709ee];return _0x35ba9a;};'use strict';var _=require(_0x8b76('0x0'));var util=require(_0x8b76('0x1'));var moment=require(_0x8b76('0x2'));var BPromise=require(_0x8b76('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8b76('0x4'))['db'];var utils=require(_0x8b76('0x5'));var logger=require('../../config/logger')(_0x8b76('0x6'));var config=require(_0x8b76('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x8b76('0x8')][_0x8b76('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5e4f81,_0xb2ac2d,_0x5494ab){return new BPromise(function(_0x106ad9,_0xb448d5){return client[_0x8b76('0xa')](_0x5e4f81,_0x5494ab)['then'](function(_0x4d5383){logger[_0x8b76('0xb')]('VoiceDialReport,\x20%s,\x20%s',_0xb2ac2d,'request\x20sent');logger['debug'](_0x8b76('0xc'),_0xb2ac2d,'request\x20sent',JSON['stringify'](_0x4d5383));if(_0x4d5383['error']){if(_0x4d5383[_0x8b76('0xd')]['code']===0x1f4){logger[_0x8b76('0xd')](_0x8b76('0xe'),_0xb2ac2d,_0x4d5383[_0x8b76('0xd')][_0x8b76('0xf')]);return _0xb448d5(_0x4d5383['error']['message']);}logger[_0x8b76('0xd')](_0x8b76('0xe'),_0xb2ac2d,_0x4d5383[_0x8b76('0xd')][_0x8b76('0xf')]);return _0x106ad9(_0x4d5383['error'][_0x8b76('0xf')]);}else{logger[_0x8b76('0xb')](_0x8b76('0xe'),_0xb2ac2d,'request\x20sent');_0x106ad9(_0x4d5383['result'][_0x8b76('0xf')]);}})[_0x8b76('0x10')](function(_0x5b2797){logger[_0x8b76('0xd')](_0x8b76('0xe'),_0xb2ac2d,_0x5b2797);_0xb448d5(_0x5b2797);});});}exports['CreateVoiceDialReport']=function(_0x104c45){var _0x233c2f=this;return new Promise(function(_0x213578,_0x11917e){return db[_0x8b76('0x11')][_0x8b76('0x12')](_0x104c45[_0x8b76('0x13')],{'raw':_0x104c45[_0x8b76('0x14')]?_0x104c45['options'][_0x8b76('0x15')]===undefined?!![]:![]:!![]})[_0x8b76('0x16')](function(_0x5be107){logger[_0x8b76('0xb')](_0x8b76('0x17'),_0x104c45);logger[_0x8b76('0x18')](_0x8b76('0x17'),_0x104c45,JSON['stringify'](_0x5be107));_0x213578(_0x5be107);})[_0x8b76('0x10')](function(_0x2debe3){logger[_0x8b76('0xd')](_0x8b76('0x17'),_0x2debe3[_0x8b76('0xf')],_0x104c45);_0x11917e(_0x233c2f[_0x8b76('0xd')](0x1f4,_0x2debe3['message']));});});};exports[_0x8b76('0x19')]=function(_0x5d9969){var _0x337011=this;return new Promise(function(_0x1f6f53,_0x41317f){return db[_0x8b76('0x11')]['update'](_0x5d9969[_0x8b76('0x13')],{'raw':_0x5d9969[_0x8b76('0x14')]?_0x5d9969[_0x8b76('0x14')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5d9969[_0x8b76('0x14')]?_0x5d9969[_0x8b76('0x14')]['where']||null:null,'attributes':_0x5d9969['options']?_0x5d9969[_0x8b76('0x14')]['attributes']||null:null,'limit':_0x5d9969['options']?_0x5d9969[_0x8b76('0x14')][_0x8b76('0x1a')]||null:null})[_0x8b76('0x16')](function(_0x24bf8c){logger[_0x8b76('0xb')]('UpdateVoiceDialReport',_0x5d9969);logger[_0x8b76('0x18')](_0x8b76('0x19'),_0x5d9969,JSON[_0x8b76('0x1b')](_0x24bf8c));_0x1f6f53(_0x24bf8c);})['catch'](function(_0x42d194){logger[_0x8b76('0xd')](_0x8b76('0x19'),_0x42d194[_0x8b76('0xf')],_0x5d9969);_0x41317f(_0x337011[_0x8b76('0xd')](0x1f4,_0x42d194[_0x8b76('0xf')]));});});}; \ No newline at end of file +var _0x35cf=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','VoiceDialReport','create','body','options','CreateVoiceDialReport','catch','update','raw','UpdateVoiceDialReport','lodash','util'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x35cf,0x1de));var _0xf35c=function(_0x5d04ee,_0x2a38ca){_0x5d04ee=_0x5d04ee-0x0;var _0x4a666a=_0x35cf[_0x5d04ee];return _0x4a666a;};'use strict';var _=require(_0xf35c('0x0'));var util=require(_0xf35c('0x1'));var moment=require(_0xf35c('0x2'));var BPromise=require(_0xf35c('0x3'));var rs=require(_0xf35c('0x4'));var fs=require('fs');var Redis=require(_0xf35c('0x5'));var db=require(_0xf35c('0x6'))['db'];var utils=require(_0xf35c('0x7'));var logger=require('../../config/logger')(_0xf35c('0x8'));var config=require(_0xf35c('0x9'));var jayson=require(_0xf35c('0xa'));var client=jayson[_0xf35c('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x48ec8e,_0x3f1042,_0x132f7c){return new BPromise(function(_0x317d52,_0x14b7db){return client[_0xf35c('0xc')](_0x48ec8e,_0x132f7c)[_0xf35c('0xd')](function(_0x48d5dc){logger[_0xf35c('0xe')](_0xf35c('0xf'),_0x3f1042,_0xf35c('0x10'));logger[_0xf35c('0x11')](_0xf35c('0x12'),_0x3f1042,_0xf35c('0x10'),JSON[_0xf35c('0x13')](_0x48d5dc));if(_0x48d5dc[_0xf35c('0x14')]){if(_0x48d5dc['error']['code']===0x1f4){logger[_0xf35c('0x14')](_0xf35c('0xf'),_0x3f1042,_0x48d5dc[_0xf35c('0x14')][_0xf35c('0x15')]);return _0x14b7db(_0x48d5dc[_0xf35c('0x14')][_0xf35c('0x15')]);}logger['error']('VoiceDialReport,\x20%s,\x20%s',_0x3f1042,_0x48d5dc[_0xf35c('0x14')]['message']);return _0x317d52(_0x48d5dc['error'][_0xf35c('0x15')]);}else{logger['info']('VoiceDialReport,\x20%s,\x20%s',_0x3f1042,_0xf35c('0x10'));_0x317d52(_0x48d5dc[_0xf35c('0x16')][_0xf35c('0x15')]);}})['catch'](function(_0x479c60){logger[_0xf35c('0x14')](_0xf35c('0xf'),_0x3f1042,_0x479c60);_0x14b7db(_0x479c60);});});}exports['CreateVoiceDialReport']=function(_0x9cf3b1){var _0x56e4ae=this;return new Promise(function(_0x300e6b,_0x1e605b){return db[_0xf35c('0x17')][_0xf35c('0x18')](_0x9cf3b1[_0xf35c('0x19')],{'raw':_0x9cf3b1[_0xf35c('0x1a')]?_0x9cf3b1[_0xf35c('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0xf35c('0xd')](function(_0x266cc0){logger[_0xf35c('0xe')](_0xf35c('0x1b'),_0x9cf3b1);logger['debug'](_0xf35c('0x1b'),_0x9cf3b1,JSON[_0xf35c('0x13')](_0x266cc0));_0x300e6b(_0x266cc0);})[_0xf35c('0x1c')](function(_0xdb8a3e){logger[_0xf35c('0x14')](_0xf35c('0x1b'),_0xdb8a3e[_0xf35c('0x15')],_0x9cf3b1);_0x1e605b(_0x56e4ae[_0xf35c('0x14')](0x1f4,_0xdb8a3e[_0xf35c('0x15')]));});});};exports['UpdateVoiceDialReport']=function(_0x3db059){var _0x171a35=this;return new Promise(function(_0x25396d,_0x2570ed){return db[_0xf35c('0x17')][_0xf35c('0x1d')](_0x3db059[_0xf35c('0x19')],{'raw':_0x3db059[_0xf35c('0x1a')]?_0x3db059['options'][_0xf35c('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3db059[_0xf35c('0x1a')]?_0x3db059['options']['where']||null:null,'attributes':_0x3db059[_0xf35c('0x1a')]?_0x3db059[_0xf35c('0x1a')]['attributes']||null:null,'limit':_0x3db059[_0xf35c('0x1a')]?_0x3db059[_0xf35c('0x1a')]['limit']||null:null})[_0xf35c('0xd')](function(_0x449202){logger[_0xf35c('0xe')]('UpdateVoiceDialReport',_0x3db059);logger[_0xf35c('0x11')](_0xf35c('0x1f'),_0x3db059,JSON['stringify'](_0x449202));_0x25396d(_0x449202);})['catch'](function(_0x67e7cd){logger['error']('UpdateVoiceDialReport',_0x67e7cd[_0xf35c('0x15')],_0x3db059);_0x2570ed(_0x171a35[_0xf35c('0x14')](0x1f4,_0x67e7cd['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 33d0585..16901b6 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 _0x8457=['destroy','multer','util','path','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/:id','show','create','post','/:id/applications','addApplications','put','update','delete'];(function(_0x114b15,_0x3309fe){var _0x484acf=function(_0x2dfe93){while(--_0x2dfe93){_0x114b15['push'](_0x114b15['shift']());}};_0x484acf(++_0x3309fe);}(_0x8457,0x1ef));var _0x7845=function(_0x392afa,_0x589239){_0x392afa=_0x392afa-0x0;var _0x2942a8=_0x8457[_0x392afa];return _0x2942a8;};'use strict';var multer=require(_0x7845('0x0'));var util=require(_0x7845('0x1'));var path=require(_0x7845('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x7845('0x3'));var auth=require(_0x7845('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x7845('0x5'));var controller=require('./voiceExtension.controller');router['get']('/',auth[_0x7845('0x6')](),controller[_0x7845('0x7')]);router[_0x7845('0x8')](_0x7845('0x9'),auth['isAuthenticated'](),controller[_0x7845('0xa')]);router['post']('/',auth[_0x7845('0x6')](),controller[_0x7845('0xb')]);router[_0x7845('0xc')](_0x7845('0xd'),auth[_0x7845('0x6')](),controller[_0x7845('0xe')]);router[_0x7845('0xf')](_0x7845('0x9'),auth[_0x7845('0x6')](),controller[_0x7845('0x10')]);router[_0x7845('0x11')](_0x7845('0x9'),auth[_0x7845('0x6')](),controller[_0x7845('0x12')]);module['exports']=router; \ No newline at end of file +var _0xea7a=['put','/:id','update','delete','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','index','show','post','create','/:id/applications','isAuthenticated'];(function(_0x9e4b6d,_0x6b433a){var _0x20298d=function(_0x180ce3){while(--_0x180ce3){_0x9e4b6d['push'](_0x9e4b6d['shift']());}};_0x20298d(++_0x6b433a);}(_0xea7a,0xe8));var _0xaea7=function(_0x45b4b7,_0x28553d){_0x45b4b7=_0x45b4b7-0x0;var _0x418343=_0xea7a[_0x45b4b7];return _0x418343;};'use strict';var multer=require(_0xaea7('0x0'));var util=require('util');var path=require(_0xaea7('0x1'));var timeout=require(_0xaea7('0x2'));var express=require(_0xaea7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xaea7('0x4'));var interaction=require(_0xaea7('0x5'));var config=require(_0xaea7('0x6'));var controller=require(_0xaea7('0x7'));router[_0xaea7('0x8')]('/',auth['isAuthenticated'](),controller[_0xaea7('0x9')]);router[_0xaea7('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xaea7('0xa')]);router[_0xaea7('0xb')]('/',auth['isAuthenticated'](),controller[_0xaea7('0xc')]);router[_0xaea7('0xb')](_0xaea7('0xd'),auth[_0xaea7('0xe')](),controller['addApplications']);router[_0xaea7('0xf')](_0xaea7('0x10'),auth[_0xaea7('0xe')](),controller[_0xaea7('0x11')]);router[_0xaea7('0x12')](_0xaea7('0x10'),auth[_0xaea7('0xe')](),controller['destroy']);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 7074160..5774451 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 _0x0720=['outbound','outbound-fax','any','INTEGER','BOOLEAN','exten','sequelize','exports','STRING','compositeIndex','NoOp','inbound'];(function(_0x3b0422,_0x820084){var _0x545e14=function(_0x1972c4){while(--_0x1972c4){_0x3b0422['push'](_0x3b0422['shift']());}};_0x545e14(++_0x820084);}(_0x0720,0x102));var _0x0072=function(_0x2119fe,_0x5b58ae){_0x2119fe=_0x2119fe-0x0;var _0x3a9e4a=_0x0720[_0x2119fe];return _0x3a9e4a;};'use strict';var Sequelize=require(_0x0072('0x0'));module[_0x0072('0x1')]={'context':{'type':Sequelize[_0x0072('0x2')],'allowNull':![],'unique':_0x0072('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x0072('0x2')],'allowNull':![],'unique':'compositeIndex'},'priority':{'type':Sequelize[_0x0072('0x2')],'allowNull':![],'defaultValue':'1','unique':_0x0072('0x3')},'tag':{'type':Sequelize[_0x0072('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0072('0x4')},'appdata':{'type':Sequelize[_0x0072('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x0072('0x5'),_0x0072('0x6'),'internal','inbound-fax',_0x0072('0x7'),'system',_0x0072('0x8')),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x0072('0x2')],'allowNull':![],'defaultValue':'*,*,*,*'},'IntervalId':{'type':Sequelize[_0x0072('0x9')]},'isApp':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize['STRING'],'defaultValue':null},'callerID':{'type':Sequelize['STRING'],'allowNull':!![]},'record':{'type':Sequelize[_0x0072('0xa')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x0072('0x9')]},'recordingFormat':{'type':Sequelize[_0x0072('0x2')],'defaultValue':'wav'},'answer':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x1fe664){return this['getDataValue'](_0x0072('0xb'));}},'alias':{'type':Sequelize[_0x0072('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0xcb5a=['outbound','inbound-fax','outbound-fax','system','any','*,*,*,*','INTEGER','BOOLEAN','VIRTUAL','exten','exports','compositeIndex','STRING','NoOp','ENUM','inbound'];(function(_0x2c7570,_0x2a15bf){var _0x2446dd=function(_0x112abc){while(--_0x112abc){_0x2c7570['push'](_0x2c7570['shift']());}};_0x2446dd(++_0x2a15bf);}(_0xcb5a,0x1aa));var _0xacb5=function(_0x36c23d,_0x9a35ac){_0x36c23d=_0x36c23d-0x0;var _0x34fa7c=_0xcb5a[_0x36c23d];return _0x34fa7c;};'use strict';var Sequelize=require('sequelize');module[_0xacb5('0x0')]={'context':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xacb5('0x1'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':'compositeIndex'},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0xacb5('0x1')},'tag':{'type':Sequelize[_0xacb5('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0xacb5('0x2')],'allowNull':![],'defaultValue':_0xacb5('0x3')},'appdata':{'type':Sequelize[_0xacb5('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xacb5('0x4')](_0xacb5('0x5'),_0xacb5('0x6'),'internal',_0xacb5('0x7'),_0xacb5('0x8'),_0xacb5('0x9'),_0xacb5('0xa')),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xacb5('0x2')],'allowNull':![],'defaultValue':_0xacb5('0xb')},'IntervalId':{'type':Sequelize[_0xacb5('0xc')]},'isApp':{'type':Sequelize[_0xacb5('0xd')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xacb5('0x2')],'defaultValue':null},'callerID':{'type':Sequelize['STRING'],'allowNull':!![]},'record':{'type':Sequelize[_0xacb5('0xd')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xacb5('0xc')]},'recordingFormat':{'type':Sequelize[_0xacb5('0x2')],'defaultValue':'wav'},'answer':{'type':Sequelize[_0xacb5('0xd')],'defaultValue':!![]},'name':{'type':Sequelize[_0xacb5('0xe')],'get':function(_0x35d724){return this['getDataValue'](_0xacb5('0xf'));}},'alias':{'type':Sequelize[_0xacb5('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 2159ed4..aaa15b1 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 _0xe92c=['update','context','description','recordingFormat','alias','addApplications','sequelize','ISOLATION_LEVELS','READ_COMMITTED','findOne','VoiceExtensionId','bulkCreate','findAndCountAll','priority','error','stack','lodash','ioredis','../../config/logger','api','../../config/environment','redis','localhost','socket.io-emitter','./voiceExtension.socket','sendStatus','end','status','offset','limit','undefined','set','json','destroy','then','get','InboundRoutes','OutboundRoutes','outbound','InternalRoutes','internal','ignore','map','value','includes','name','send','index','VoiceExtension','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','include','findAll','rows','catch','show','params','find','create','body','startsWith','exten','concat','user','inbound','UserProfileSection','userProfileId','autoAssociation','UserProfileResource'];(function(_0xbee015,_0x4af57f){var _0x40044a=function(_0x40cdc6){while(--_0x40cdc6){_0xbee015['push'](_0xbee015['shift']());}};_0x40044a(++_0x4af57f);}(_0xe92c,0x66));var _0xce92=function(_0x2b6726,_0x247b20){_0x2b6726=_0x2b6726-0x0;var _0x34f01c=_0xe92c[_0x2b6726];return _0x34f01c;};'use strict';var _=require(_0xce92('0x0'));var Redis=require(_0xce92('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0xce92('0x2'))(_0xce92('0x3'));var config=require(_0xce92('0x4'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0xce92('0x5')],{'host':_0xce92('0x6'),'port':0x18eb});var socket=require(_0xce92('0x7'))(new Redis(config[_0xce92('0x5')]));require(_0xce92('0x8'))['register'](socket);function respondWithStatusCode(_0x578d96,_0x24568a){_0x24568a=_0x24568a||0xcc;return function(_0x19d974){if(_0x19d974){return _0x578d96[_0xce92('0x9')](_0x24568a);}return _0x578d96['status'](_0x24568a)[_0xce92('0xa')]();};}function respondWithResult(_0x20f116,_0x2e16d2){_0x2e16d2=_0x2e16d2||0xc8;return function(_0x1a4494){if(_0x1a4494){return _0x20f116[_0xce92('0xb')](_0x2e16d2)['json'](_0x1a4494);}};}function respondWithFilteredResult(_0x234490,_0x9e634d){return function(_0x409d20){if(_0x409d20){var _0x283b82=typeof _0x9e634d[_0xce92('0xc')]==='undefined'&&typeof _0x9e634d[_0xce92('0xd')]===_0xce92('0xe');var _0x54ab11=_0x409d20['count'];var _0x28abe9=_0x283b82?0x0:_0x9e634d[_0xce92('0xc')];var _0x29cb1e=_0x283b82?_0x409d20['count']:_0x9e634d['offset']+_0x9e634d[_0xce92('0xd')];var _0x51d5d3;if(_0x29cb1e>=_0x54ab11){_0x29cb1e=_0x54ab11;_0x51d5d3=0xc8;}else{_0x51d5d3=0xce;}_0x234490[_0xce92('0xb')](_0x51d5d3);return _0x234490[_0xce92('0xf')]('Content-Range',_0x28abe9+'-'+_0x29cb1e+'/'+_0x54ab11)[_0xce92('0x10')](_0x409d20);}return null;};}function removeEntity(_0x2a1251){return function(_0x57f66d){if(_0x57f66d){return _0x57f66d[_0xce92('0x11')]()[_0xce92('0x12')](function(){var _0x48191e=_0x57f66d[_0xce92('0x13')]({'plain':!![]});var _0x3a4cba=[{'name':_0xce92('0x14'),'value':'inbound','ignore':![]},{'name':_0xce92('0x15'),'value':_0xce92('0x16'),'ignore':![]},{'name':_0xce92('0x17'),'value':_0xce92('0x18'),'ignore':![]}];var _0x4868f6=_(_0x3a4cba)['filter'](_0xce92('0x19'))[_0xce92('0x1a')](_0xce92('0x1b'))[_0xce92('0x1b')]();if(_[_0xce92('0x1c')](_0x4868f6,_0x48191e['type'])){return;}var _0x342ca8=_['find'](_0x3a4cba,[_0xce92('0x1b'),_0x48191e['type']])[_0xce92('0x1d')];return db['UserProfileResource'][_0xce92('0x11')]({'where':{'type':_0x342ca8,'resourceId':_0x48191e['id']}})[_0xce92('0x12')](function(){return _0x57f66d;});})[_0xce92('0x12')](function(){_0x2a1251['status'](0xcc)[_0xce92('0xa')]();});}};}function handleEntityNotFound(_0x2a5fc1){return function(_0x33ef19){if(!_0x33ef19){_0x2a5fc1[_0xce92('0x9')](0x194);}return _0x33ef19;};}function handleError(_0x553267,_0x51e701){_0x51e701=_0x51e701||0x1f4;return function(_0x55893f){logger['error'](_0x55893f['stack']);if(_0x55893f[_0xce92('0x1d')]){delete _0x55893f[_0xce92('0x1d')];}_0x553267[_0xce92('0xb')](_0x51e701)[_0xce92('0x1e')](_0x55893f);};}exports[_0xce92('0x1f')]=function(_0x3f6e33,_0x5dd7dd){var _0x4d0400={},_0x29348d={},_0x4e06c2={'count':0x0,'rows':[]};var _0x52d88a=_['map'](db[_0xce92('0x20')][_0xce92('0x21')],function(_0x23e9de){return{'name':_0x23e9de[_0xce92('0x22')],'type':_0x23e9de[_0xce92('0x23')]['key']};});_0x29348d[_0xce92('0x24')]=_[_0xce92('0x1a')](_0x52d88a,_0xce92('0x1d'));_0x29348d[_0xce92('0x25')]=_[_0xce92('0x26')](_0x3f6e33[_0xce92('0x25')]);_0x29348d[_0xce92('0x27')]=_['intersection'](_0x29348d[_0xce92('0x24')],_0x29348d['query']);_0x4d0400[_0xce92('0x28')]=_[_0xce92('0x29')](_0x29348d[_0xce92('0x24')],qs['fields'](_0x3f6e33[_0xce92('0x25')][_0xce92('0x2a')]));_0x4d0400[_0xce92('0x28')]=_0x4d0400[_0xce92('0x28')][_0xce92('0x2b')]?_0x4d0400[_0xce92('0x28')]:_0x29348d['model'];if(!_0x3f6e33[_0xce92('0x25')]['hasOwnProperty']('nolimit')){_0x4d0400[_0xce92('0xd')]=qs[_0xce92('0xd')](_0x3f6e33[_0xce92('0x25')][_0xce92('0xd')]);_0x4d0400['offset']=qs[_0xce92('0xc')](_0x3f6e33[_0xce92('0x25')][_0xce92('0xc')]);}_0x4d0400['order']=qs[_0xce92('0x2c')](_0x3f6e33[_0xce92('0x25')][_0xce92('0x2c')]);_0x4d0400[_0xce92('0x2d')]=qs['filters'](_[_0xce92('0x2e')](_0x3f6e33[_0xce92('0x25')],_0x29348d[_0xce92('0x27')]),_0x52d88a);if(_0x3f6e33[_0xce92('0x25')][_0xce92('0x2f')]){_0x4d0400[_0xce92('0x2d')]=_[_0xce92('0x30')](_0x4d0400[_0xce92('0x2d')],{'$or':_[_0xce92('0x1a')](_0x52d88a,function(_0x49704f){if(_0x49704f[_0xce92('0x23')]!==_0xce92('0x31')){var _0x4e4d8c={};_0x4e4d8c[_0x49704f[_0xce92('0x1d')]]={'$like':'%'+_0x3f6e33[_0xce92('0x25')]['filter']+'%'};return _0x4e4d8c;}})});}_0x4d0400=_[_0xce92('0x30')]({},_0x4d0400,_0x3f6e33['options']);var _0x1e8f99={'where':_0x4d0400[_0xce92('0x2d')]};return db[_0xce92('0x20')][_0xce92('0x32')](_0x1e8f99)[_0xce92('0x12')](function(_0x40f9c7){_0x4e06c2[_0xce92('0x32')]=_0x40f9c7;if(_0x3f6e33[_0xce92('0x25')][_0xce92('0x33')]){_0x4d0400[_0xce92('0x34')]=[{'all':!![]}];}return db[_0xce92('0x20')][_0xce92('0x35')](_0x4d0400);})[_0xce92('0x12')](function(_0x3864e2){_0x4e06c2[_0xce92('0x36')]=_0x3864e2;return _0x4e06c2;})[_0xce92('0x12')](respondWithFilteredResult(_0x5dd7dd,_0x4d0400))[_0xce92('0x37')](handleError(_0x5dd7dd,null));};exports[_0xce92('0x38')]=function(_0x1b4043,_0xd5e9db){var _0x46c584={'raw':![],'where':{'id':_0x1b4043[_0xce92('0x39')]['id']}},_0x2ff1f3={};_0x2ff1f3[_0xce92('0x24')]=_[_0xce92('0x26')](db['VoiceExtension']['rawAttributes']);_0x2ff1f3['query']=_['keys'](_0x1b4043['query']);_0x2ff1f3[_0xce92('0x27')]=_[_0xce92('0x29')](_0x2ff1f3[_0xce92('0x24')],_0x2ff1f3[_0xce92('0x25')]);_0x46c584[_0xce92('0x28')]=_['intersection'](_0x2ff1f3[_0xce92('0x24')],qs[_0xce92('0x2a')](_0x1b4043[_0xce92('0x25')][_0xce92('0x2a')]));_0x46c584[_0xce92('0x28')]=_0x46c584[_0xce92('0x28')][_0xce92('0x2b')]?_0x46c584[_0xce92('0x28')]:_0x2ff1f3[_0xce92('0x24')];if(_0x1b4043[_0xce92('0x25')]['includeAll']){_0x46c584['include']=[{'all':!![]}];}_0x46c584=_[_0xce92('0x30')]({},_0x46c584,_0x1b4043['options']);return db[_0xce92('0x20')]['find'](_0x46c584)[_0xce92('0x12')](handleEntityNotFound(_0xd5e9db,null))[_0xce92('0x12')](respondWithResult(_0xd5e9db,null))[_0xce92('0x37')](handleError(_0xd5e9db,null));};exports[_0xce92('0x11')]=function(_0x520c6a,_0x1e3c0d){return db['VoiceExtension'][_0xce92('0x3a')]({'where':{'id':_0x520c6a[_0xce92('0x39')]['id']}})[_0xce92('0x12')](handleEntityNotFound(_0x1e3c0d,null))['then'](removeEntity(_0x1e3c0d,null))[_0xce92('0x37')](handleError(_0x1e3c0d,null));};exports[_0xce92('0x3b')]=function(_0x153222,_0x3eb0a5){if(_0x153222[_0xce92('0x3c')]['type']==='outbound'&&!_[_0xce92('0x3d')](_0x153222[_0xce92('0x3c')][_0xce92('0x3e')],'_')){_0x153222[_0xce92('0x3c')]['exten']='_'[_0xce92('0x3f')](_0x153222['body']['exten']);}return db[_0xce92('0x20')]['create'](_0x153222[_0xce92('0x3c')],{'raw':![]})[_0xce92('0x12')](function(_0xb929ca){var _0x5a1134=_0x153222[_0xce92('0x40')][_0xce92('0x13')]({'plain':!![]});if(!_0x5a1134)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5a1134['role']==='user'){var _0x1b0214=_0xb929ca['get']({'plain':!![]});var _0x589311=[{'name':_0xce92('0x14'),'value':_0xce92('0x41')},{'name':_0xce92('0x15'),'value':_0xce92('0x16')},{'name':_0xce92('0x17'),'value':'internal'}];var _0x55869a=_[_0xce92('0x3a')](_0x589311,[_0xce92('0x1b'),_0x1b0214[_0xce92('0x23')]])[_0xce92('0x1d')];return db[_0xce92('0x42')][_0xce92('0x3a')]({'where':{'name':_0x55869a,'userProfileId':_0x5a1134[_0xce92('0x43')]},'raw':!![]})['then'](function(_0x5af36d){if(_0x5af36d&&_0x5af36d[_0xce92('0x44')]===0x0){return db[_0xce92('0x45')][_0xce92('0x3b')]({'name':_0x1b0214[_0xce92('0x1d')],'resourceId':_0x1b0214['id'],'type':_0x5af36d[_0xce92('0x1d')],'sectionId':_0x5af36d['id']},{})[_0xce92('0x12')](function(){return _0xb929ca;});}else{return _0xb929ca;}})['catch'](function(_0x4303cc){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4303cc);throw _0x4303cc;});}return _0xb929ca;})[_0xce92('0x12')](respondWithResult(_0x3eb0a5,0xc9))[_0xce92('0x37')](handleError(_0x3eb0a5,null));};exports[_0xce92('0x46')]=function(_0x9e773e,_0x1aeeb2){if(_0x9e773e[_0xce92('0x3c')]['id']){delete _0x9e773e[_0xce92('0x3c')]['id'];}return db[_0xce92('0x20')]['find']({'where':{'id':_0x9e773e[_0xce92('0x39')]['id']}})[_0xce92('0x12')](handleEntityNotFound(_0x1aeeb2,null))[_0xce92('0x12')](function(_0x56635a){if(_0x56635a){return db['VoiceExtension'][_0xce92('0x46')](_['pick'](_0x9e773e[_0xce92('0x3c')],[_0xce92('0x3e'),_0xce92('0x47'),_0xce92('0x48'),_0xce92('0x49'),'cutdigits','mandatoryDisposition',_0xce92('0x4a')]),{'where':{'context':_0x56635a[_0xce92('0x47')],'exten':_0x56635a[_0xce92('0x3e')]},'individualHooks':!![]})[_0xce92('0x12')](function(_0x24cfa8){return _0x24cfa8;});}return null;})[_0xce92('0x12')](respondWithStatusCode(_0x1aeeb2,null))[_0xce92('0x37')](handleError(_0x1aeeb2,null));};exports[_0xce92('0x4b')]=function(_0x418249,_0x477a0e){var _0x271cdc=_0x418249[_0xce92('0x39')]['id'];var _0x3c618f=_0x418249[_0xce92('0x3c')];var _0xce1aa0=0xc8;var _0x51b856=null;return db[_0xce92('0x4c')]['transaction']({'isolationLevel':db[_0xce92('0x4c')]['Transaction'][_0xce92('0x4d')][_0xce92('0x4e')]},function(_0xb569b8){return db[_0xce92('0x20')][_0xce92('0x4f')]({'where':{'id':_0x271cdc},'transaction':_0xb569b8})[_0xce92('0x12')](function(_0x4fa647){if(_0x4fa647){return db[_0xce92('0x20')]['destroy']({'where':{'VoiceExtensionId':_0x271cdc},'transaction':_0xb569b8})['then'](function(){var _0x4c86dd=_['map'](_0x3c618f,function(_0x4f0536){_0x4f0536[_0xce92('0x50')]=_0x271cdc;_0x4f0536['isApp']=!![];return _0x4f0536;});return _0x4fa647['createRouting'](_0x4c86dd);})[_0xce92('0x12')](function(_0x27e205){return db[_0xce92('0x20')][_0xce92('0x51')](_0x27e205,{'transaction':_0xb569b8});});}else{_0xce1aa0=0x194;_0x51b856=[];}});})['then'](function(){if(_0xce1aa0!==0x194){return db['VoiceExtension'][_0xce92('0x52')]({'where':{'isApp':!![],'VoiceExtensionId':_0x271cdc},'order':_0xce92('0x53')})[_0xce92('0x12')](function(_0x44657c){_0x51b856=_0x44657c;});}})[_0xce92('0x37')](function(_0x42907c){_0xce1aa0=0x1f4;logger[_0xce92('0x54')](_0x42907c[_0xce92('0x55')]);if(_0x42907c[_0xce92('0x1d')]){delete _0x42907c[_0xce92('0x1d')];}_0x51b856=_0x42907c;})['finally'](function(){if(_0x51b856===null){_0x477a0e[_0xce92('0x9')](_0xce1aa0);}else{if(_0xce1aa0===0x1f4){_0x477a0e[_0xce92('0xb')](_0xce1aa0)['send'](_0x51b856);}else{_0x477a0e[_0xce92('0xb')](_0xce1aa0)['json'](_0x51b856);}}});}; \ No newline at end of file +var _0xb389=['context','description','recordingFormat','cutdigits','mandatoryDisposition','alias','addApplications','transaction','sequelize','Transaction','READ_COMMITTED','findOne','VoiceExtensionId','isApp','createRouting','bulkCreate','findAndCountAll','finally','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','limit','undefined','offset','count','set','Content-Range','json','destroy','then','get','inbound','OutboundRoutes','outbound','InternalRoutes','internal','ignore','map','value','includes','find','name','UserProfileResource','end','error','stack','send','VoiceExtension','rawAttributes','type','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','params','create','startsWith','body','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update'];(function(_0x2d9a47,_0x295c15){var _0xdca254=function(_0x3d3413){while(--_0x3d3413){_0x2d9a47['push'](_0x2d9a47['shift']());}};_0xdca254(++_0x295c15);}(_0xb389,0x71));var _0x9b38=function(_0x46d0c9,_0x526bfa){_0x46d0c9=_0x46d0c9-0x0;var _0x174506=_0xb389[_0x46d0c9];return _0x174506;};'use strict';var _=require(_0x9b38('0x0'));var Redis=require('ioredis');var qs=require(_0x9b38('0x1'));var logger=require(_0x9b38('0x2'))(_0x9b38('0x3'));var config=require(_0x9b38('0x4'));var db=require(_0x9b38('0x5'))['db'];config[_0x9b38('0x6')]=_['defaults'](config[_0x9b38('0x6')],{'host':_0x9b38('0x7'),'port':0x18eb});var socket=require(_0x9b38('0x8'))(new Redis(config['redis']));require('./voiceExtension.socket')[_0x9b38('0x9')](socket);function respondWithStatusCode(_0x3d5550,_0x58b450){_0x58b450=_0x58b450||0xcc;return function(_0x5e2e4b){if(_0x5e2e4b){return _0x3d5550[_0x9b38('0xa')](_0x58b450);}return _0x3d5550['status'](_0x58b450)['end']();};}function respondWithResult(_0x29831a,_0x35bf2a){_0x35bf2a=_0x35bf2a||0xc8;return function(_0x19735b){if(_0x19735b){return _0x29831a[_0x9b38('0xb')](_0x35bf2a)['json'](_0x19735b);}};}function respondWithFilteredResult(_0x47c246,_0x168f51){return function(_0x49625e){if(_0x49625e){var _0x5224c9=typeof _0x168f51['offset']==='undefined'&&typeof _0x168f51[_0x9b38('0xc')]===_0x9b38('0xd');var _0x342099=_0x49625e['count'];var _0x4926b9=_0x5224c9?0x0:_0x168f51[_0x9b38('0xe')];var _0x5a1a80=_0x5224c9?_0x49625e[_0x9b38('0xf')]:_0x168f51['offset']+_0x168f51['limit'];var _0x2d4a2b;if(_0x5a1a80>=_0x342099){_0x5a1a80=_0x342099;_0x2d4a2b=0xc8;}else{_0x2d4a2b=0xce;}_0x47c246[_0x9b38('0xb')](_0x2d4a2b);return _0x47c246[_0x9b38('0x10')](_0x9b38('0x11'),_0x4926b9+'-'+_0x5a1a80+'/'+_0x342099)[_0x9b38('0x12')](_0x49625e);}return null;};}function removeEntity(_0x3d3b1e){return function(_0x4e8030){if(_0x4e8030){return _0x4e8030[_0x9b38('0x13')]()[_0x9b38('0x14')](function(){var _0x344201=_0x4e8030[_0x9b38('0x15')]({'plain':!![]});var _0x4ef2b2=[{'name':'InboundRoutes','value':_0x9b38('0x16'),'ignore':![]},{'name':_0x9b38('0x17'),'value':_0x9b38('0x18'),'ignore':![]},{'name':_0x9b38('0x19'),'value':_0x9b38('0x1a'),'ignore':![]}];var _0xcc3579=_(_0x4ef2b2)['filter'](_0x9b38('0x1b'))[_0x9b38('0x1c')](_0x9b38('0x1d'))[_0x9b38('0x1d')]();if(_[_0x9b38('0x1e')](_0xcc3579,_0x344201['type'])){return;}var _0x45658b=_[_0x9b38('0x1f')](_0x4ef2b2,['value',_0x344201['type']])[_0x9b38('0x20')];return db[_0x9b38('0x21')][_0x9b38('0x13')]({'where':{'type':_0x45658b,'resourceId':_0x344201['id']}})[_0x9b38('0x14')](function(){return _0x4e8030;});})[_0x9b38('0x14')](function(){_0x3d3b1e[_0x9b38('0xb')](0xcc)[_0x9b38('0x22')]();});}};}function handleEntityNotFound(_0x2f999b){return function(_0x488854){if(!_0x488854){_0x2f999b[_0x9b38('0xa')](0x194);}return _0x488854;};}function handleError(_0x4a8617,_0xce8c79){_0xce8c79=_0xce8c79||0x1f4;return function(_0x1a0bbc){logger[_0x9b38('0x23')](_0x1a0bbc[_0x9b38('0x24')]);if(_0x1a0bbc[_0x9b38('0x20')]){delete _0x1a0bbc[_0x9b38('0x20')];}_0x4a8617[_0x9b38('0xb')](_0xce8c79)[_0x9b38('0x25')](_0x1a0bbc);};}exports['index']=function(_0x44da7d,_0x5a2bad){var _0x43d940={},_0x320413={},_0x1458c1={'count':0x0,'rows':[]};var _0x124ac0=_[_0x9b38('0x1c')](db[_0x9b38('0x26')][_0x9b38('0x27')],function(_0x27681d){return{'name':_0x27681d['fieldName'],'type':_0x27681d[_0x9b38('0x28')][_0x9b38('0x29')]};});_0x320413[_0x9b38('0x2a')]=_[_0x9b38('0x1c')](_0x124ac0,_0x9b38('0x20'));_0x320413['query']=_[_0x9b38('0x2b')](_0x44da7d[_0x9b38('0x2c')]);_0x320413['filters']=_[_0x9b38('0x2d')](_0x320413[_0x9b38('0x2a')],_0x320413[_0x9b38('0x2c')]);_0x43d940['attributes']=_[_0x9b38('0x2d')](_0x320413['model'],qs[_0x9b38('0x2e')](_0x44da7d[_0x9b38('0x2c')][_0x9b38('0x2e')]));_0x43d940[_0x9b38('0x2f')]=_0x43d940[_0x9b38('0x2f')][_0x9b38('0x30')]?_0x43d940[_0x9b38('0x2f')]:_0x320413[_0x9b38('0x2a')];if(!_0x44da7d['query'][_0x9b38('0x31')](_0x9b38('0x32'))){_0x43d940['limit']=qs['limit'](_0x44da7d[_0x9b38('0x2c')]['limit']);_0x43d940[_0x9b38('0xe')]=qs[_0x9b38('0xe')](_0x44da7d[_0x9b38('0x2c')][_0x9b38('0xe')]);}_0x43d940[_0x9b38('0x33')]=qs[_0x9b38('0x34')](_0x44da7d[_0x9b38('0x2c')]['sort']);_0x43d940[_0x9b38('0x35')]=qs['filters'](_[_0x9b38('0x36')](_0x44da7d[_0x9b38('0x2c')],_0x320413[_0x9b38('0x37')]),_0x124ac0);if(_0x44da7d['query'][_0x9b38('0x38')]){_0x43d940[_0x9b38('0x35')]=_[_0x9b38('0x39')](_0x43d940[_0x9b38('0x35')],{'$or':_['map'](_0x124ac0,function(_0x2b7040){if(_0x2b7040[_0x9b38('0x28')]!==_0x9b38('0x3a')){var _0x3abcd1={};_0x3abcd1[_0x2b7040[_0x9b38('0x20')]]={'$like':'%'+_0x44da7d['query'][_0x9b38('0x38')]+'%'};return _0x3abcd1;}})});}_0x43d940=_[_0x9b38('0x39')]({},_0x43d940,_0x44da7d['options']);var _0x1d015f={'where':_0x43d940[_0x9b38('0x35')]};return db[_0x9b38('0x26')][_0x9b38('0xf')](_0x1d015f)[_0x9b38('0x14')](function(_0xc7487b){_0x1458c1[_0x9b38('0xf')]=_0xc7487b;if(_0x44da7d[_0x9b38('0x2c')][_0x9b38('0x3b')]){_0x43d940[_0x9b38('0x3c')]=[{'all':!![]}];}return db['VoiceExtension']['findAll'](_0x43d940);})[_0x9b38('0x14')](function(_0x5bd242){_0x1458c1[_0x9b38('0x3d')]=_0x5bd242;return _0x1458c1;})['then'](respondWithFilteredResult(_0x5a2bad,_0x43d940))[_0x9b38('0x3e')](handleError(_0x5a2bad,null));};exports[_0x9b38('0x3f')]=function(_0x365d9b,_0xb5225a){var _0x3140e7={'raw':![],'where':{'id':_0x365d9b[_0x9b38('0x40')]['id']}},_0xa3c43d={};_0xa3c43d['model']=_[_0x9b38('0x2b')](db[_0x9b38('0x26')][_0x9b38('0x27')]);_0xa3c43d[_0x9b38('0x2c')]=_['keys'](_0x365d9b[_0x9b38('0x2c')]);_0xa3c43d[_0x9b38('0x37')]=_['intersection'](_0xa3c43d[_0x9b38('0x2a')],_0xa3c43d[_0x9b38('0x2c')]);_0x3140e7[_0x9b38('0x2f')]=_[_0x9b38('0x2d')](_0xa3c43d[_0x9b38('0x2a')],qs[_0x9b38('0x2e')](_0x365d9b[_0x9b38('0x2c')][_0x9b38('0x2e')]));_0x3140e7[_0x9b38('0x2f')]=_0x3140e7[_0x9b38('0x2f')][_0x9b38('0x30')]?_0x3140e7[_0x9b38('0x2f')]:_0xa3c43d[_0x9b38('0x2a')];if(_0x365d9b['query'][_0x9b38('0x3b')]){_0x3140e7['include']=[{'all':!![]}];}_0x3140e7=_['merge']({},_0x3140e7,_0x365d9b['options']);return db[_0x9b38('0x26')][_0x9b38('0x1f')](_0x3140e7)[_0x9b38('0x14')](handleEntityNotFound(_0xb5225a,null))[_0x9b38('0x14')](respondWithResult(_0xb5225a,null))['catch'](handleError(_0xb5225a,null));};exports[_0x9b38('0x13')]=function(_0x321de8,_0x4b807b){return db[_0x9b38('0x26')][_0x9b38('0x1f')]({'where':{'id':_0x321de8[_0x9b38('0x40')]['id']}})[_0x9b38('0x14')](handleEntityNotFound(_0x4b807b,null))['then'](removeEntity(_0x4b807b,null))[_0x9b38('0x3e')](handleError(_0x4b807b,null));};exports[_0x9b38('0x41')]=function(_0x5b69c7,_0x654e3d){if(_0x5b69c7['body'][_0x9b38('0x28')]===_0x9b38('0x18')&&!_[_0x9b38('0x42')](_0x5b69c7[_0x9b38('0x43')][_0x9b38('0x44')],'_')){_0x5b69c7['body']['exten']='_'[_0x9b38('0x45')](_0x5b69c7[_0x9b38('0x43')][_0x9b38('0x44')]);}return db[_0x9b38('0x26')][_0x9b38('0x41')](_0x5b69c7[_0x9b38('0x43')],{'raw':![]})[_0x9b38('0x14')](function(_0x4ebdb2){var _0x317180=_0x5b69c7[_0x9b38('0x46')][_0x9b38('0x15')]({'plain':!![]});if(!_0x317180)throw new Error(_0x9b38('0x47'));if(_0x317180[_0x9b38('0x48')]===_0x9b38('0x46')){var _0x52ede5=_0x4ebdb2[_0x9b38('0x15')]({'plain':!![]});var _0x380018=[{'name':'InboundRoutes','value':_0x9b38('0x16')},{'name':'OutboundRoutes','value':_0x9b38('0x18')},{'name':_0x9b38('0x19'),'value':_0x9b38('0x1a')}];var _0x591c58=_[_0x9b38('0x1f')](_0x380018,['value',_0x52ede5[_0x9b38('0x28')]])[_0x9b38('0x20')];return db[_0x9b38('0x49')][_0x9b38('0x1f')]({'where':{'name':_0x591c58,'userProfileId':_0x317180['userProfileId']},'raw':!![]})[_0x9b38('0x14')](function(_0x5a401a){if(_0x5a401a&&_0x5a401a[_0x9b38('0x4a')]===0x0){return db[_0x9b38('0x21')][_0x9b38('0x41')]({'name':_0x52ede5[_0x9b38('0x20')],'resourceId':_0x52ede5['id'],'type':_0x5a401a[_0x9b38('0x20')],'sectionId':_0x5a401a['id']},{})[_0x9b38('0x14')](function(){return _0x4ebdb2;});}else{return _0x4ebdb2;}})[_0x9b38('0x3e')](function(_0x5d6ac1){logger['error'](_0x9b38('0x4b'),_0x5d6ac1);throw _0x5d6ac1;});}return _0x4ebdb2;})[_0x9b38('0x14')](respondWithResult(_0x654e3d,0xc9))[_0x9b38('0x3e')](handleError(_0x654e3d,null));};exports[_0x9b38('0x4c')]=function(_0x348e70,_0x1d7cf0){if(_0x348e70[_0x9b38('0x43')]['id']){delete _0x348e70['body']['id'];}return db[_0x9b38('0x26')][_0x9b38('0x1f')]({'where':{'id':_0x348e70[_0x9b38('0x40')]['id']}})['then'](handleEntityNotFound(_0x1d7cf0,null))['then'](function(_0x8753aa){if(_0x8753aa){return db[_0x9b38('0x26')]['update'](_[_0x9b38('0x36')](_0x348e70[_0x9b38('0x43')],[_0x9b38('0x44'),_0x9b38('0x4d'),_0x9b38('0x4e'),_0x9b38('0x4f'),_0x9b38('0x50'),_0x9b38('0x51'),_0x9b38('0x52')]),{'where':{'context':_0x8753aa['context'],'exten':_0x8753aa[_0x9b38('0x44')]},'individualHooks':!![]})[_0x9b38('0x14')](function(_0x2b23ad){return _0x2b23ad;});}return null;})[_0x9b38('0x14')](respondWithStatusCode(_0x1d7cf0,null))[_0x9b38('0x3e')](handleError(_0x1d7cf0,null));};exports[_0x9b38('0x53')]=function(_0x9f1fe8,_0xcac17d){var _0x470f9d=_0x9f1fe8[_0x9b38('0x40')]['id'];var _0x22313e=_0x9f1fe8['body'];var _0x4c1fc5=0xc8;var _0x3942b3=null;return db['sequelize'][_0x9b38('0x54')]({'isolationLevel':db[_0x9b38('0x55')][_0x9b38('0x56')]['ISOLATION_LEVELS'][_0x9b38('0x57')]},function(_0xc3ef58){return db[_0x9b38('0x26')][_0x9b38('0x58')]({'where':{'id':_0x470f9d},'transaction':_0xc3ef58})[_0x9b38('0x14')](function(_0x102bbd){if(_0x102bbd){return db[_0x9b38('0x26')][_0x9b38('0x13')]({'where':{'VoiceExtensionId':_0x470f9d},'transaction':_0xc3ef58})[_0x9b38('0x14')](function(){var _0x4df85f=_[_0x9b38('0x1c')](_0x22313e,function(_0x42c558){_0x42c558[_0x9b38('0x59')]=_0x470f9d;_0x42c558[_0x9b38('0x5a')]=!![];return _0x42c558;});return _0x102bbd[_0x9b38('0x5b')](_0x4df85f);})[_0x9b38('0x14')](function(_0xacef3d){return db[_0x9b38('0x26')][_0x9b38('0x5c')](_0xacef3d,{'transaction':_0xc3ef58});});}else{_0x4c1fc5=0x194;_0x3942b3=[];}});})[_0x9b38('0x14')](function(){if(_0x4c1fc5!==0x194){return db['VoiceExtension'][_0x9b38('0x5d')]({'where':{'isApp':!![],'VoiceExtensionId':_0x470f9d},'order':'priority'})[_0x9b38('0x14')](function(_0x2f4696){_0x3942b3=_0x2f4696;});}})[_0x9b38('0x3e')](function(_0x3b226f){_0x4c1fc5=0x1f4;logger[_0x9b38('0x23')](_0x3b226f['stack']);if(_0x3b226f[_0x9b38('0x20')]){delete _0x3b226f[_0x9b38('0x20')];}_0x3942b3=_0x3b226f;})[_0x9b38('0x5e')](function(){if(_0x3942b3===null){_0xcac17d[_0x9b38('0xa')](_0x4c1fc5);}else{if(_0x4c1fc5===0x1f4){_0xcac17d['status'](_0x4c1fc5)['send'](_0x3942b3);}else{_0xcac17d['status'](_0x4c1fc5)[_0x9b38('0x12')](_0x3942b3);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index bd32898..9c5c17a 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 _0xd4f3=['events','../../mysqldb','VoiceExtension','setMaxListeners','save','remove','emit','hook','exports'];(function(_0x43d73f,_0xbf262d){var _0x3dbba4=function(_0x3a5a45){while(--_0x3a5a45){_0x43d73f['push'](_0x43d73f['shift']());}};_0x3dbba4(++_0xbf262d);}(_0xd4f3,0xd8));var _0x3d4f=function(_0x563654,_0x55ed34){_0x563654=_0x563654-0x0;var _0x471c6e=_0xd4f3[_0x563654];return _0x471c6e;};'use strict';var EventEmitter=require(_0x3d4f('0x0'));var VoiceExtension=require(_0x3d4f('0x1'))['db'][_0x3d4f('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x3d4f('0x3')](0x0);var events={'afterCreate':_0x3d4f('0x4'),'afterUpdate':'update','afterDestroy':_0x3d4f('0x5')};function emitEvent(_0x3c93b5){return function(_0x2f4c3c,_0x5cb28b,_0x38d788){VoiceExtensionEvents[_0x3d4f('0x6')](_0x3c93b5+':'+_0x2f4c3c['id'],_0x2f4c3c);VoiceExtensionEvents[_0x3d4f('0x6')](_0x3c93b5,_0x2f4c3c);_0x38d788(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0x3d4f('0x7')](e,emitEvent(event));}}module[_0x3d4f('0x8')]=VoiceExtensionEvents; \ No newline at end of file +var _0x3c07=['setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events','VoiceExtension'];(function(_0x31ced5,_0x5d5415){var _0x10d9e5=function(_0x2e51a5){while(--_0x2e51a5){_0x31ced5['push'](_0x31ced5['shift']());}};_0x10d9e5(++_0x5d5415);}(_0x3c07,0x18a));var _0x73c0=function(_0x49c653,_0x390195){_0x49c653=_0x49c653-0x0;var _0x31e169=_0x3c07[_0x49c653];return _0x31e169;};'use strict';var EventEmitter=require(_0x73c0('0x0'));var VoiceExtension=require('../../mysqldb')['db'][_0x73c0('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x73c0('0x2')](0x0);var events={'afterCreate':_0x73c0('0x3'),'afterUpdate':_0x73c0('0x4'),'afterDestroy':_0x73c0('0x5')};function emitEvent(_0x3e83aa){return function(_0x250a96,_0x500d1,_0x20eae3){VoiceExtensionEvents['emit'](_0x3e83aa+':'+_0x250a96['id'],_0x250a96);VoiceExtensionEvents[_0x73c0('0x6')](_0x3e83aa,_0x250a96);_0x20eae3(null);};}for(var e in events){if(events[_0x73c0('0x7')](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module[_0x73c0('0x8')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index e5a4305..81e16e3 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 _0x1d54=['appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','priority','last','catch','define','VoiceExtension','voice_extensions','get','concat','Hangup','lodash','exports','models','type','Set','CDR(type)=','exten','alias','NoOp','CDR(routeAlias)=','context','inbound','push','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','No\x20alias\x20set','CDR(destination)=','${EXTEN:','cutdigits','${EXTEN}','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','trunk','timeout','options','url','split','name','param','prefix','phone','SIP','join','indexOf','U(xcally-mixmonitor-context)','isEmpty','findAll','then','length','interval','*,*,*,*','intervals','IntervalId','map','filter','toLowerCase','tag','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','Set(CALLERID(all)=','callerID','NoOp(No\x20number\x20available)','playback','includes','app'];(function(_0x1bc908,_0xd1cc83){var _0x4692b7=function(_0x32e98f){while(--_0x32e98f){_0x1bc908['push'](_0x1bc908['shift']());}};_0x4692b7(++_0xd1cc83);}(_0x1d54,0x100));var _0x41d5=function(_0x30a31e,_0x31f766){_0x30a31e=_0x30a31e-0x0;var _0x170879=_0x1d54[_0x30a31e];return _0x170879;};'use strict';var _=require(_0x41d5('0x0'));var attributes=require('./voiceExtension.attributes');module[_0x41d5('0x1')]=function(_0x80134b){var _0x24cd0b=_0x80134b[_0x41d5('0x2')];function _0x5d1f0e(_0x34b74a){var _0x3666f2=0x2;var _0x4ab969=[{'type':_0x34b74a[_0x41d5('0x3')],'app':_0x41d5('0x4'),'appdata':_0x41d5('0x5')+_0x34b74a[_0x41d5('0x3')],'context':_0x34b74a['context'],'exten':_0x34b74a[_0x41d5('0x6')],'priority':_0x3666f2++,'VoiceExtensionId':_0x34b74a['id']},{'type':_0x34b74a[_0x41d5('0x3')],'app':_0x34b74a[_0x41d5('0x7')]?_0x41d5('0x4'):_0x41d5('0x8'),'appdata':_0x34b74a[_0x41d5('0x7')]?_0x41d5('0x9')+_0x34b74a[_0x41d5('0x7')]:'No\x20alias\x20set','context':_0x34b74a[_0x41d5('0xa')],'exten':_0x34b74a[_0x41d5('0x6')],'priority':_0x3666f2++,'VoiceExtensionId':_0x34b74a['id']}];if(_0x34b74a[_0x41d5('0x3')]===_0x41d5('0xb')){_0x4ab969[_0x41d5('0xc')]({'type':_0x41d5('0xb'),'app':_0x41d5('0x4'),'appdata':_0x41d5('0xd')+_0x34b74a['id'],'context':_0x34b74a['context'],'exten':_0x34b74a[_0x41d5('0x6')],'priority':_0x3666f2++,'VoiceExtensionId':_0x34b74a['id']});}_0x4ab969[_0x41d5('0xc')]({'type':_0x34b74a[_0x41d5('0x3')],'app':_0x41d5('0x4'),'appdata':_0x41d5('0xe'),'context':_0x34b74a[_0x41d5('0xa')],'exten':_0x34b74a['exten'],'priority':_0x3666f2++,'VoiceExtensionId':_0x34b74a['id']},{'type':_0x34b74a[_0x41d5('0x3')],'app':'Set','appdata':_0x41d5('0xf'),'context':_0x34b74a[_0x41d5('0xa')],'exten':_0x34b74a[_0x41d5('0x6')],'priority':_0x3666f2++,'VoiceExtensionId':_0x34b74a['id']},{'type':_0x34b74a[_0x41d5('0x3')],'app':_0x41d5('0x4'),'appdata':_0x41d5('0x10'),'context':_0x34b74a['context'],'exten':_0x34b74a[_0x41d5('0x6')],'priority':_0x3666f2++,'VoiceExtensionId':_0x34b74a['id']});return _0x4ab969;}function _0x1a309e(_0x24a778){var _0x4578ea=0x2;var _0x1a3f97=[{'type':_0x41d5('0x11'),'app':_0x41d5('0x4'),'appdata':_0x41d5('0x12'),'context':_0x24a778['context'],'exten':_0x24a778[_0x41d5('0x6')],'priority':_0x4578ea++,'VoiceExtensionId':_0x24a778['id']},{'type':_0x41d5('0x11'),'app':_0x24a778[_0x41d5('0x7')]?_0x41d5('0x4'):_0x41d5('0x8'),'appdata':_0x24a778['alias']?_0x41d5('0x9')+_0x24a778[_0x41d5('0x7')]:_0x41d5('0x13'),'context':_0x24a778[_0x41d5('0xa')],'exten':_0x24a778['exten'],'priority':_0x4578ea++,'VoiceExtensionId':_0x24a778['id']},{'type':_0x41d5('0x11'),'app':'Set','appdata':_0x41d5('0x14')+(_0x24a778['cutdigits']?_0x41d5('0x15')+_0x24a778[_0x41d5('0x16')]+'}':_0x41d5('0x17')),'context':_0x24a778[_0x41d5('0xa')],'exten':_0x24a778[_0x41d5('0x6')],'priority':_0x4578ea++,'VoiceExtensionId':_0x24a778['id']},{'type':_0x41d5('0x11'),'app':'Set','appdata':'CDR(routeid)='+_0x24a778['id'],'context':_0x24a778[_0x41d5('0xa')],'exten':_0x24a778[_0x41d5('0x6')],'priority':_0x4578ea++,'VoiceExtensionId':_0x24a778['id']},{'type':_0x41d5('0x11'),'app':'ExecIf','appdata':_0x41d5('0x18')+(_0x4578ea+0x2)+'):Goto('+(_0x4578ea+0x1)+')','context':_0x24a778[_0x41d5('0xa')],'exten':_0x24a778[_0x41d5('0x6')],'priority':_0x4578ea++,'VoiceExtensionId':_0x24a778['id']},{'type':_0x41d5('0x11'),'app':'Set','appdata':_0x24a778[_0x41d5('0x16')]?_0x41d5('0x19')+_0x24a778[_0x41d5('0x16')]+'}':'CDR(prefix)=noprefix','context':_0x24a778[_0x41d5('0xa')],'exten':_0x24a778[_0x41d5('0x6')],'priority':_0x4578ea++,'VoiceExtensionId':_0x24a778['id']},{'type':'outbound','app':_0x41d5('0x4'),'appdata':_0x41d5('0xe'),'context':_0x24a778['context'],'exten':_0x24a778[_0x41d5('0x6')],'priority':_0x4578ea++,'VoiceExtensionId':_0x24a778['id']},{'type':_0x41d5('0x11'),'app':_0x41d5('0x4'),'appdata':_0x41d5('0xf'),'context':_0x24a778[_0x41d5('0xa')],'exten':_0x24a778[_0x41d5('0x6')],'priority':_0x4578ea++,'VoiceExtensionId':_0x24a778['id']},{'type':'outbound','app':'Set','appdata':_0x41d5('0x10'),'context':_0x24a778[_0x41d5('0xa')],'exten':_0x24a778[_0x41d5('0x6')],'priority':_0x4578ea++,'VoiceExtensionId':_0x24a778['id']},{'type':'outbound','app':_0x41d5('0x4'),'appdata':'outboundrouteid='+_0x24a778['id'],'context':_0x24a778[_0x41d5('0xa')],'exten':_0x24a778[_0x41d5('0x6')],'priority':_0x4578ea++,'VoiceExtensionId':_0x24a778['id']}];if(_0x24a778[_0x41d5('0x1a')](_0x41d5('0x1b'))&&_0x24a778[_0x41d5('0x1b')]!==_0x41d5('0x1c')){_0x1a3f97[_0x41d5('0xc')]({'type':_0x41d5('0x11'),'app':_0x41d5('0x4'),'appdata':_0x41d5('0x1d'),'context':_0x24a778['context'],'exten':_0x24a778[_0x41d5('0x6')],'priority':_0x4578ea++,'VoiceExtensionId':_0x24a778['id']},{'type':_0x41d5('0x11'),'app':'Set','appdata':_0x41d5('0x1e')+_0x24a778['recordingFormat']||'wav','context':_0x24a778[_0x41d5('0xa')],'exten':_0x24a778[_0x41d5('0x6')],'priority':_0x4578ea++,'VoiceExtensionId':_0x24a778['id']});}return _0x1a3f97;}function _0x21600d(_0x2f08e7,_0x489194){var _0x26bbb9=[{'name':_0x41d5('0x1f'),'param':0x0},{'name':_0x41d5('0x20'),'param':0x1},{'name':_0x41d5('0x21'),'param':0x2},{'name':_0x41d5('0x22'),'param':0x3}];var _0x569cb7={};var _0x123c19=_0x489194[_0x41d5('0x23')](',');var _0x90ebc4=[];for(var _0x5bbb83=0x0;_0x5bbb83<_0x26bbb9['length'];_0x5bbb83++){switch(_0x26bbb9[_0x5bbb83][_0x41d5('0x24')]){case'trunk':_0x569cb7[_0x41d5('0x1f')]=_0x123c19[_0x26bbb9[_0x5bbb83]['param']][_0x41d5('0x23')]('/')[0x1];_0x569cb7['phone']=_0x123c19[_0x26bbb9[_0x5bbb83][_0x41d5('0x25')]][_0x41d5('0x23')]('/')[0x2];_0x569cb7[_0x41d5('0x26')]=_0x569cb7[_0x41d5('0x27')]?_0x569cb7[_0x41d5('0x27')]['split']('$')[0x0]:undefined;_0x569cb7[_0x41d5('0x27')]=_0x2f08e7[_0x41d5('0x16')]?(_0x569cb7[_0x41d5('0x26')]||'')+'${EXTEN:'+_0x2f08e7['cutdigits']+'}':(_0x569cb7[_0x41d5('0x26')]||'')+_0x41d5('0x17');_0x90ebc4[_0x26bbb9[_0x5bbb83][_0x41d5('0x25')]]=[_0x41d5('0x28'),_0x569cb7['trunk'],_0x569cb7[_0x41d5('0x27')]][_0x41d5('0x29')]('/');break;case _0x41d5('0x21'):_0x569cb7['options']=_0x123c19[_0x26bbb9[_0x5bbb83][_0x41d5('0x25')]];if(_0x2f08e7[_0x41d5('0x1b')]!==_0x41d5('0x1c')){if(_0x569cb7[_0x41d5('0x21')][_0x41d5('0x2a')]('U(xcally-mixmonitor-context)')<0x0){_0x569cb7[_0x41d5('0x21')]+=_0x41d5('0x2b');}}else{_0x569cb7[_0x41d5('0x21')]=_0x569cb7[_0x41d5('0x21')]['replace'](_0x41d5('0x2b'),'');}_0x90ebc4[_0x26bbb9[_0x5bbb83][_0x41d5('0x25')]]=_0x569cb7[_0x41d5('0x21')];break;default:_0x90ebc4[_0x26bbb9[_0x5bbb83][_0x41d5('0x25')]]=_0x123c19[_0x26bbb9[_0x5bbb83]['param']];}}return _0x90ebc4['join'](',');}function _0x1170b8(_0x66fa37,_0x16aebf,_0x5be1e0){return new Promise(function(_0x4c5a69,_0x3d5c7b){var _0x52a489=[];if(_[_0x41d5('0x2c')](_0x16aebf))return _0x4c5a69(_0x52a489);_0x24cd0b['Interval'][_0x41d5('0x2d')]({'attributes':['id','interval','IntervalId'],'raw':!![]})[_0x41d5('0x2e')](function(_0x2cbf42){for(var _0x2ab7c2=0x0,_0x1526e8=0x0;_0x2ab7c2<_0x16aebf[_0x41d5('0x2f')];_0x2ab7c2++,_0x1526e8=0x0){var _0x91bc94=_0x16aebf[_0x2ab7c2];var _0x48fc53=[];var _0x459872=[];delete _0x91bc94['id'];if(_0x91bc94[_0x41d5('0x30')]!==_0x41d5('0x31')){_0x91bc94[_0x41d5('0x32')]=[_0x91bc94[_0x41d5('0x30')]];}else{_0x91bc94[_0x41d5('0x32')]=_0x91bc94[_0x41d5('0x33')]?_[_0x41d5('0x34')](_[_0x41d5('0x35')](_0x2cbf42,{'IntervalId':_0x91bc94[_0x41d5('0x33')]}),_0x41d5('0x30')):[];}_0x91bc94[_0x41d5('0xa')]=_0x66fa37[_0x41d5('0xa')];_0x91bc94[_0x41d5('0x6')]=_0x66fa37[_0x41d5('0x6')];if(_0x91bc94[_0x41d5('0x3')])_0x91bc94[_0x41d5('0x3')]=_0x91bc94[_0x41d5('0x3')][_0x41d5('0x36')]();if(_0x66fa37[_0x41d5('0x3')]===_0x41d5('0x11')){if(_0x91bc94['hasOwnProperty'](_0x41d5('0x37'))&&_0x91bc94[_0x41d5('0x37')]&&_0x91bc94[_0x41d5('0x37')]!=='--'){_0x48fc53['push']({'type':_0x91bc94[_0x41d5('0x3')][_0x41d5('0x36')](),'app':_0x41d5('0x4'),'appdata':'CDR(tag)='+_0x91bc94[_0x41d5('0x37')],'context':_0x66fa37[_0x41d5('0xa')],'exten':_0x66fa37[_0x41d5('0x6')],'priority':_0x91bc94[_0x41d5('0x32')][_0x41d5('0x2f')]+_0x5be1e0+_0x1526e8++,'VoiceExtensionId':_0x66fa37['id']});}_0x48fc53['push']({'type':_0x91bc94[_0x41d5('0x3')]['toLowerCase'](),'app':_0x41d5('0x38'),'appdata':_0x41d5('0x39')+(_0x91bc94['callerID']?_0x41d5('0x3a')+_0x91bc94[_0x41d5('0x3b')]+')':_0x41d5('0x3c')),'context':_0x66fa37[_0x41d5('0xa')],'exten':_0x66fa37[_0x41d5('0x6')],'priority':_0x91bc94[_0x41d5('0x32')][_0x41d5('0x2f')]+_0x5be1e0+_0x1526e8++,'VoiceExtensionId':_0x66fa37['id']});}else{if(_0x91bc94[_0x41d5('0x1a')]('answer')){if(['queue',_0x41d5('0x3d')][_0x41d5('0x3e')](_0x91bc94[_0x41d5('0x3f')]['toLowerCase']())&&_0x91bc94[_0x41d5('0x40')]!==_0x41d5('0x41')){if(_0x91bc94['answer']){_0x48fc53[_0x41d5('0xc')]({'type':_0x91bc94[_0x41d5('0x3')][_0x41d5('0x36')](),'app':_0x41d5('0x38'),'appdata':_0x41d5('0x42'),'context':_0x66fa37['context'],'exten':_0x66fa37[_0x41d5('0x6')],'priority':_0x91bc94['intervals'][_0x41d5('0x2f')]+_0x5be1e0+_0x1526e8++,'VoiceExtensionId':_0x66fa37['id']});_0x48fc53[_0x41d5('0xc')]({'type':_0x91bc94[_0x41d5('0x3')][_0x41d5('0x36')](),'app':_0x41d5('0x4'),'appdata':_0x41d5('0x43'),'context':_0x66fa37['context'],'exten':_0x66fa37[_0x41d5('0x6')],'priority':_0x91bc94[_0x41d5('0x32')][_0x41d5('0x2f')]+_0x5be1e0+_0x1526e8++,'VoiceExtensionId':_0x66fa37['id']});}else{_0x48fc53['push']({'type':_0x91bc94['type'][_0x41d5('0x36')](),'app':_0x41d5('0x38'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x66fa37['context'],'exten':_0x66fa37[_0x41d5('0x6')],'priority':_0x91bc94[_0x41d5('0x32')][_0x41d5('0x2f')]+_0x5be1e0+_0x1526e8++,'VoiceExtensionId':_0x66fa37['id']});_0x48fc53[_0x41d5('0xc')]({'type':_0x91bc94[_0x41d5('0x3')]['toLowerCase'](),'app':'Set','appdata':_0x41d5('0x44'),'context':_0x66fa37[_0x41d5('0xa')],'exten':_0x66fa37[_0x41d5('0x6')],'priority':_0x91bc94['intervals'][_0x41d5('0x2f')]+_0x5be1e0+_0x1526e8++,'VoiceExtensionId':_0x66fa37['id']});}}}}for(var _0x4a6f51=0x0;_0x4a6f51<_0x91bc94[_0x41d5('0x32')][_0x41d5('0x2f')];_0x4a6f51++){var _0x4f65da=_0x5be1e0+_0x91bc94[_0x41d5('0x32')][_0x41d5('0x2f')];var _0x27996b=_0x4a6f51===_0x91bc94[_0x41d5('0x32')][_0x41d5('0x2f')]-0x1?_0x5be1e0+_0x48fc53[_0x41d5('0x2f')]+_0x459872[_0x41d5('0x2f')]+0x2:_0x5be1e0+_0x4a6f51+0x1;_0x48fc53[_0x41d5('0x45')](_0x4a6f51,0x0,{'type':_0x66fa37['type'],'app':'GotoIfTime','appdata':_0x91bc94[_0x41d5('0x32')][_0x4a6f51]+'?'+_0x66fa37[_0x41d5('0xa')]+_0x41d5('0x46')+_0x4f65da+':'+_0x66fa37['context']+_0x41d5('0x46')+_0x27996b,'exten':_0x66fa37[_0x41d5('0x6')],'context':_0x66fa37['context'],'priority':_0x5be1e0+_0x4a6f51,'VoiceExtensionId':_0x66fa37['id']});}if(_0x91bc94[_0x41d5('0x40')]==='outboundDial')_0x91bc94['appdata']=_0x21600d(_0x66fa37,_0x91bc94['appdata']);_0x91bc94[_0x41d5('0x47')]=_0x48fc53[_0x41d5('0x2f')]?_[_0x41d5('0x48')](_0x48fc53)[_0x41d5('0x47')]+0x1:_0x5be1e0;_0x52a489=_['concat'](_0x52a489,_0x48fc53,[_0x91bc94],_0x459872);_0x5be1e0=_[_0x41d5('0x48')](_0x52a489)[_0x41d5('0x47')]+0x1;}return _0x4c5a69(_0x52a489);})[_0x41d5('0x49')](function(_0x11f2ab){_0x3d5c7b(_0x11f2ab);});});}return _0x80134b[_0x41d5('0x4a')](_0x41d5('0x4b'),attributes,{'tableName':_0x41d5('0x4c'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x4526d8){var _0x233041=this[_0x41d5('0x4d')]({'plain':!![]});var _0x9a983a=_0x233041[_0x41d5('0x3')]===_0x41d5('0x11')?_0x1a309e(_0x233041):_0x5d1f0e(_0x233041);return _0x1170b8(_0x233041,_0x4526d8,_[_0x41d5('0x48')](_0x9a983a)[_0x41d5('0x47')]+0x1)[_0x41d5('0x2e')](function(_0x35e748){var _0x36fc3f=_[_0x41d5('0x4e')](_0x9a983a,_0x35e748);_0x36fc3f[_0x41d5('0xc')]({'type':_0x233041['type'],'app':_0x41d5('0x4f'),'exten':_0x233041[_0x41d5('0x6')],'context':_0x233041[_0x41d5('0xa')],'priority':_[_0x41d5('0x48')](_0x36fc3f)[_0x41d5('0x47')]+0x1,'VoiceExtensionId':_0x233041['id']});return _0x36fc3f;});}}});}; \ No newline at end of file +var _0x6657=['VoiceExtension','voice_extensions','Hangup','lodash','exports','models','type','Set','CDR(type)=','context','alias','NoOp','CDR(routeAlias)=','No\x20alias\x20set','exten','inbound','CDR(routeid)=','push','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(destination)=','${EXTEN:','cutdigits','CDR(prefix)=${EXTEN:0:','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','trunk','options','split','length','param','prefix','phone','${EXTEN}','SIP','U(xcally-mixmonitor-context)','replace','join','isEmpty','Interval','findAll','IntervalId','then','*,*,*,*','intervals','map','filter','interval','tag','toLowerCase','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','answer','queue','playback','includes','app','appType','custom','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','outboundDial','appdata','priority','last','concat','catch','define'];(function(_0x5585a6,_0x304103){var _0x4824bd=function(_0x568dfe){while(--_0x568dfe){_0x5585a6['push'](_0x5585a6['shift']());}};_0x4824bd(++_0x304103);}(_0x6657,0x17f));var _0x7665=function(_0x2657fa,_0x15fab8){_0x2657fa=_0x2657fa-0x0;var _0x555b92=_0x6657[_0x2657fa];return _0x555b92;};'use strict';var _=require(_0x7665('0x0'));var attributes=require('./voiceExtension.attributes');module[_0x7665('0x1')]=function(_0x43c954){var _0x40f0aa=_0x43c954[_0x7665('0x2')];function _0x5c6cda(_0x386ca9){var _0x2ed8cb=0x2;var _0x26acc4=[{'type':_0x386ca9[_0x7665('0x3')],'app':_0x7665('0x4'),'appdata':_0x7665('0x5')+_0x386ca9[_0x7665('0x3')],'context':_0x386ca9[_0x7665('0x6')],'exten':_0x386ca9['exten'],'priority':_0x2ed8cb++,'VoiceExtensionId':_0x386ca9['id']},{'type':_0x386ca9[_0x7665('0x3')],'app':_0x386ca9[_0x7665('0x7')]?_0x7665('0x4'):_0x7665('0x8'),'appdata':_0x386ca9[_0x7665('0x7')]?_0x7665('0x9')+_0x386ca9[_0x7665('0x7')]:_0x7665('0xa'),'context':_0x386ca9['context'],'exten':_0x386ca9[_0x7665('0xb')],'priority':_0x2ed8cb++,'VoiceExtensionId':_0x386ca9['id']}];if(_0x386ca9[_0x7665('0x3')]===_0x7665('0xc')){_0x26acc4['push']({'type':_0x7665('0xc'),'app':'Set','appdata':_0x7665('0xd')+_0x386ca9['id'],'context':_0x386ca9[_0x7665('0x6')],'exten':_0x386ca9['exten'],'priority':_0x2ed8cb++,'VoiceExtensionId':_0x386ca9['id']});}_0x26acc4[_0x7665('0xe')]({'type':_0x386ca9[_0x7665('0x3')],'app':'Set','appdata':_0x7665('0xf'),'context':_0x386ca9[_0x7665('0x6')],'exten':_0x386ca9['exten'],'priority':_0x2ed8cb++,'VoiceExtensionId':_0x386ca9['id']},{'type':_0x386ca9[_0x7665('0x3')],'app':_0x7665('0x4'),'appdata':_0x7665('0x10'),'context':_0x386ca9[_0x7665('0x6')],'exten':_0x386ca9[_0x7665('0xb')],'priority':_0x2ed8cb++,'VoiceExtensionId':_0x386ca9['id']},{'type':_0x386ca9[_0x7665('0x3')],'app':_0x7665('0x4'),'appdata':_0x7665('0x11'),'context':_0x386ca9[_0x7665('0x6')],'exten':_0x386ca9[_0x7665('0xb')],'priority':_0x2ed8cb++,'VoiceExtensionId':_0x386ca9['id']});return _0x26acc4;}function _0x365469(_0xf730b0){var _0x34dc39=0x2;var _0x34e7a8=[{'type':_0x7665('0x12'),'app':_0x7665('0x4'),'appdata':'CDR(type)=outbound','context':_0xf730b0[_0x7665('0x6')],'exten':_0xf730b0[_0x7665('0xb')],'priority':_0x34dc39++,'VoiceExtensionId':_0xf730b0['id']},{'type':'outbound','app':_0xf730b0[_0x7665('0x7')]?_0x7665('0x4'):_0x7665('0x8'),'appdata':_0xf730b0[_0x7665('0x7')]?'CDR(routeAlias)='+_0xf730b0[_0x7665('0x7')]:_0x7665('0xa'),'context':_0xf730b0[_0x7665('0x6')],'exten':_0xf730b0[_0x7665('0xb')],'priority':_0x34dc39++,'VoiceExtensionId':_0xf730b0['id']},{'type':_0x7665('0x12'),'app':'Set','appdata':_0x7665('0x13')+(_0xf730b0['cutdigits']?_0x7665('0x14')+_0xf730b0[_0x7665('0x15')]+'}':'${EXTEN}'),'context':_0xf730b0['context'],'exten':_0xf730b0[_0x7665('0xb')],'priority':_0x34dc39++,'VoiceExtensionId':_0xf730b0['id']},{'type':_0x7665('0x12'),'app':'Set','appdata':_0x7665('0xd')+_0xf730b0['id'],'context':_0xf730b0[_0x7665('0x6')],'exten':_0xf730b0[_0x7665('0xb')],'priority':_0x34dc39++,'VoiceExtensionId':_0xf730b0['id']},{'type':'outbound','app':'ExecIf','appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x34dc39+0x2)+'):Goto('+(_0x34dc39+0x1)+')','context':_0xf730b0[_0x7665('0x6')],'exten':_0xf730b0[_0x7665('0xb')],'priority':_0x34dc39++,'VoiceExtensionId':_0xf730b0['id']},{'type':_0x7665('0x12'),'app':'Set','appdata':_0xf730b0[_0x7665('0x15')]?_0x7665('0x16')+_0xf730b0['cutdigits']+'}':'CDR(prefix)=noprefix','context':_0xf730b0[_0x7665('0x6')],'exten':_0xf730b0[_0x7665('0xb')],'priority':_0x34dc39++,'VoiceExtensionId':_0xf730b0['id']},{'type':_0x7665('0x12'),'app':_0x7665('0x4'),'appdata':_0x7665('0xf'),'context':_0xf730b0[_0x7665('0x6')],'exten':_0xf730b0['exten'],'priority':_0x34dc39++,'VoiceExtensionId':_0xf730b0['id']},{'type':_0x7665('0x12'),'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=0','context':_0xf730b0[_0x7665('0x6')],'exten':_0xf730b0[_0x7665('0xb')],'priority':_0x34dc39++,'VoiceExtensionId':_0xf730b0['id']},{'type':_0x7665('0x12'),'app':_0x7665('0x4'),'appdata':_0x7665('0x11'),'context':_0xf730b0[_0x7665('0x6')],'exten':_0xf730b0[_0x7665('0xb')],'priority':_0x34dc39++,'VoiceExtensionId':_0xf730b0['id']},{'type':_0x7665('0x12'),'app':_0x7665('0x4'),'appdata':_0x7665('0x17')+_0xf730b0['id'],'context':_0xf730b0[_0x7665('0x6')],'exten':_0xf730b0[_0x7665('0xb')],'priority':_0x34dc39++,'VoiceExtensionId':_0xf730b0['id']}];if(_0xf730b0[_0x7665('0x18')](_0x7665('0x19'))&&_0xf730b0[_0x7665('0x19')]!==_0x7665('0x1a')){_0x34e7a8[_0x7665('0xe')]({'type':_0x7665('0x12'),'app':_0x7665('0x4'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0xf730b0[_0x7665('0x6')],'exten':_0xf730b0[_0x7665('0xb')],'priority':_0x34dc39++,'VoiceExtensionId':_0xf730b0['id']},{'type':_0x7665('0x12'),'app':_0x7665('0x4'),'appdata':_0x7665('0x1b')+_0xf730b0[_0x7665('0x19')]||'wav','context':_0xf730b0[_0x7665('0x6')],'exten':_0xf730b0[_0x7665('0xb')],'priority':_0x34dc39++,'VoiceExtensionId':_0xf730b0['id']});}return _0x34e7a8;}function _0x16043b(_0x1899ad,_0x35abcb){var _0x495704=[{'name':_0x7665('0x1c'),'param':0x0},{'name':'timeout','param':0x1},{'name':_0x7665('0x1d'),'param':0x2},{'name':'url','param':0x3}];var _0x1c91ea={};var _0xe9a15d=_0x35abcb[_0x7665('0x1e')](',');var _0x2f03bb=[];for(var _0x3eea5a=0x0;_0x3eea5a<_0x495704[_0x7665('0x1f')];_0x3eea5a++){switch(_0x495704[_0x3eea5a]['name']){case _0x7665('0x1c'):_0x1c91ea[_0x7665('0x1c')]=_0xe9a15d[_0x495704[_0x3eea5a][_0x7665('0x20')]][_0x7665('0x1e')]('/')[0x1];_0x1c91ea['phone']=_0xe9a15d[_0x495704[_0x3eea5a][_0x7665('0x20')]][_0x7665('0x1e')]('/')[0x2];_0x1c91ea[_0x7665('0x21')]=_0x1c91ea[_0x7665('0x22')]?_0x1c91ea[_0x7665('0x22')]['split']('$')[0x0]:undefined;_0x1c91ea[_0x7665('0x22')]=_0x1899ad[_0x7665('0x15')]?(_0x1c91ea[_0x7665('0x21')]||'')+_0x7665('0x14')+_0x1899ad[_0x7665('0x15')]+'}':(_0x1c91ea[_0x7665('0x21')]||'')+_0x7665('0x23');_0x2f03bb[_0x495704[_0x3eea5a][_0x7665('0x20')]]=[_0x7665('0x24'),_0x1c91ea[_0x7665('0x1c')],_0x1c91ea['phone']]['join']('/');break;case _0x7665('0x1d'):_0x1c91ea[_0x7665('0x1d')]=_0xe9a15d[_0x495704[_0x3eea5a]['param']];if(_0x1899ad['recordingFormat']!==_0x7665('0x1a')){if(_0x1c91ea[_0x7665('0x1d')]['indexOf'](_0x7665('0x25'))<0x0){_0x1c91ea[_0x7665('0x1d')]+=_0x7665('0x25');}}else{_0x1c91ea[_0x7665('0x1d')]=_0x1c91ea[_0x7665('0x1d')][_0x7665('0x26')](_0x7665('0x25'),'');}_0x2f03bb[_0x495704[_0x3eea5a][_0x7665('0x20')]]=_0x1c91ea[_0x7665('0x1d')];break;default:_0x2f03bb[_0x495704[_0x3eea5a][_0x7665('0x20')]]=_0xe9a15d[_0x495704[_0x3eea5a][_0x7665('0x20')]];}}return _0x2f03bb[_0x7665('0x27')](',');}function _0x3ed97d(_0x218db5,_0x4ebda0,_0x261ce7){return new Promise(function(_0x4c3a34,_0x32fc2b){var _0x2af7d8=[];if(_[_0x7665('0x28')](_0x4ebda0))return _0x4c3a34(_0x2af7d8);_0x40f0aa[_0x7665('0x29')][_0x7665('0x2a')]({'attributes':['id','interval',_0x7665('0x2b')],'raw':!![]})[_0x7665('0x2c')](function(_0x5dc646){for(var _0xe2650a=0x0,_0x48e840=0x0;_0xe2650a<_0x4ebda0[_0x7665('0x1f')];_0xe2650a++,_0x48e840=0x0){var _0x14a4bf=_0x4ebda0[_0xe2650a];var _0x1a1cd9=[];var _0x503679=[];delete _0x14a4bf['id'];if(_0x14a4bf['interval']!==_0x7665('0x2d')){_0x14a4bf[_0x7665('0x2e')]=[_0x14a4bf['interval']];}else{_0x14a4bf[_0x7665('0x2e')]=_0x14a4bf[_0x7665('0x2b')]?_[_0x7665('0x2f')](_[_0x7665('0x30')](_0x5dc646,{'IntervalId':_0x14a4bf[_0x7665('0x2b')]}),_0x7665('0x31')):[];}_0x14a4bf[_0x7665('0x6')]=_0x218db5[_0x7665('0x6')];_0x14a4bf[_0x7665('0xb')]=_0x218db5[_0x7665('0xb')];if(_0x14a4bf[_0x7665('0x3')])_0x14a4bf['type']=_0x14a4bf[_0x7665('0x3')]['toLowerCase']();if(_0x218db5[_0x7665('0x3')]===_0x7665('0x12')){if(_0x14a4bf[_0x7665('0x18')](_0x7665('0x32'))&&_0x14a4bf['tag']&&_0x14a4bf[_0x7665('0x32')]!=='--'){_0x1a1cd9[_0x7665('0xe')]({'type':_0x14a4bf[_0x7665('0x3')][_0x7665('0x33')](),'app':_0x7665('0x4'),'appdata':'CDR(tag)='+_0x14a4bf[_0x7665('0x32')],'context':_0x218db5['context'],'exten':_0x218db5[_0x7665('0xb')],'priority':_0x14a4bf[_0x7665('0x2e')]['length']+_0x261ce7+_0x48e840++,'VoiceExtensionId':_0x218db5['id']});}_0x1a1cd9['push']({'type':_0x14a4bf[_0x7665('0x3')][_0x7665('0x33')](),'app':_0x7665('0x34'),'appdata':_0x7665('0x35')+(_0x14a4bf['callerID']?'Set(CALLERID(all)='+_0x14a4bf[_0x7665('0x36')]+')':'NoOp(No\x20number\x20available)'),'context':_0x218db5[_0x7665('0x6')],'exten':_0x218db5[_0x7665('0xb')],'priority':_0x14a4bf[_0x7665('0x2e')]['length']+_0x261ce7+_0x48e840++,'VoiceExtensionId':_0x218db5['id']});}else{if(_0x14a4bf[_0x7665('0x18')](_0x7665('0x37'))){if([_0x7665('0x38'),_0x7665('0x39')][_0x7665('0x3a')](_0x14a4bf[_0x7665('0x3b')][_0x7665('0x33')]())&&_0x14a4bf[_0x7665('0x3c')]!==_0x7665('0x3d')){if(_0x14a4bf[_0x7665('0x37')]){_0x1a1cd9[_0x7665('0xe')]({'type':_0x14a4bf[_0x7665('0x3')][_0x7665('0x33')](),'app':_0x7665('0x34'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x218db5['context'],'exten':_0x218db5[_0x7665('0xb')],'priority':_0x14a4bf[_0x7665('0x2e')]['length']+_0x261ce7+_0x48e840++,'VoiceExtensionId':_0x218db5['id']});_0x1a1cd9['push']({'type':_0x14a4bf['type'][_0x7665('0x33')](),'app':_0x7665('0x4'),'appdata':_0x7665('0x3e'),'context':_0x218db5[_0x7665('0x6')],'exten':_0x218db5[_0x7665('0xb')],'priority':_0x14a4bf[_0x7665('0x2e')][_0x7665('0x1f')]+_0x261ce7+_0x48e840++,'VoiceExtensionId':_0x218db5['id']});}else{_0x1a1cd9[_0x7665('0xe')]({'type':_0x14a4bf[_0x7665('0x3')][_0x7665('0x33')](),'app':'ExecIf','appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x218db5[_0x7665('0x6')],'exten':_0x218db5[_0x7665('0xb')],'priority':_0x14a4bf[_0x7665('0x2e')]['length']+_0x261ce7+_0x48e840++,'VoiceExtensionId':_0x218db5['id']});_0x1a1cd9[_0x7665('0xe')]({'type':_0x14a4bf['type'][_0x7665('0x33')](),'app':_0x7665('0x4'),'appdata':_0x7665('0x3f'),'context':_0x218db5[_0x7665('0x6')],'exten':_0x218db5[_0x7665('0xb')],'priority':_0x14a4bf[_0x7665('0x2e')][_0x7665('0x1f')]+_0x261ce7+_0x48e840++,'VoiceExtensionId':_0x218db5['id']});}}}}for(var _0x411ac8=0x0;_0x411ac8<_0x14a4bf[_0x7665('0x2e')][_0x7665('0x1f')];_0x411ac8++){var _0x3c6515=_0x261ce7+_0x14a4bf['intervals'][_0x7665('0x1f')];var _0x204b80=_0x411ac8===_0x14a4bf[_0x7665('0x2e')][_0x7665('0x1f')]-0x1?_0x261ce7+_0x1a1cd9[_0x7665('0x1f')]+_0x503679[_0x7665('0x1f')]+0x2:_0x261ce7+_0x411ac8+0x1;_0x1a1cd9[_0x7665('0x40')](_0x411ac8,0x0,{'type':_0x218db5[_0x7665('0x3')],'app':'GotoIfTime','appdata':_0x14a4bf['intervals'][_0x411ac8]+'?'+_0x218db5[_0x7665('0x6')]+_0x7665('0x41')+_0x3c6515+':'+_0x218db5[_0x7665('0x6')]+_0x7665('0x41')+_0x204b80,'exten':_0x218db5[_0x7665('0xb')],'context':_0x218db5[_0x7665('0x6')],'priority':_0x261ce7+_0x411ac8,'VoiceExtensionId':_0x218db5['id']});}if(_0x14a4bf['appType']===_0x7665('0x42'))_0x14a4bf[_0x7665('0x43')]=_0x16043b(_0x218db5,_0x14a4bf[_0x7665('0x43')]);_0x14a4bf[_0x7665('0x44')]=_0x1a1cd9[_0x7665('0x1f')]?_[_0x7665('0x45')](_0x1a1cd9)['priority']+0x1:_0x261ce7;_0x2af7d8=_[_0x7665('0x46')](_0x2af7d8,_0x1a1cd9,[_0x14a4bf],_0x503679);_0x261ce7=_[_0x7665('0x45')](_0x2af7d8)[_0x7665('0x44')]+0x1;}return _0x4c3a34(_0x2af7d8);})[_0x7665('0x47')](function(_0x54fc74){_0x32fc2b(_0x54fc74);});});}return _0x43c954[_0x7665('0x48')](_0x7665('0x49'),attributes,{'tableName':_0x7665('0x4a'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x5c0469){var _0x41e903=this['get']({'plain':!![]});var _0x23efd7=_0x41e903[_0x7665('0x3')]==='outbound'?_0x365469(_0x41e903):_0x5c6cda(_0x41e903);return _0x3ed97d(_0x41e903,_0x5c0469,_[_0x7665('0x45')](_0x23efd7)['priority']+0x1)[_0x7665('0x2c')](function(_0x35d4ea){var _0x59403b=_[_0x7665('0x46')](_0x23efd7,_0x35d4ea);_0x59403b['push']({'type':_0x41e903['type'],'app':_0x7665('0x4b'),'exten':_0x41e903[_0x7665('0xb')],'context':_0x41e903['context'],'priority':_['last'](_0x59403b)[_0x7665('0x44')]+0x1,'VoiceExtensionId':_0x41e903['id']});return _0x59403b;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index de81307..7d08f2c 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 _0xe7de=['attributes','limit','map','include','model','GetVoiceExtension','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','request','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','VoiceExtension','options','raw','where'];(function(_0xd206ce,_0x3031d2){var _0x5b3ec6=function(_0x526993){while(--_0x526993){_0xd206ce['push'](_0xd206ce['shift']());}};_0x5b3ec6(++_0x3031d2);}(_0xe7de,0x165));var _0xee7d=function(_0x496d16,_0x4202ae){_0x496d16=_0x496d16-0x0;var _0x491da4=_0xe7de[_0x496d16];return _0x491da4;};'use strict';var _=require(_0xee7d('0x0'));var util=require(_0xee7d('0x1'));var moment=require(_0xee7d('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xee7d('0x3'));var db=require(_0xee7d('0x4'))['db'];var utils=require(_0xee7d('0x5'));var logger=require(_0xee7d('0x6'))(_0xee7d('0x7'));var config=require(_0xee7d('0x8'));var jayson=require(_0xee7d('0x9'));var client=jayson[_0xee7d('0xa')][_0xee7d('0xb')]({'port':0x232a});config[_0xee7d('0xc')]=_[_0xee7d('0xd')](config[_0xee7d('0xc')],{'host':_0xee7d('0xe'),'port':0x18eb});var socket=require(_0xee7d('0xf'))(new Redis(config['redis']));require(_0xee7d('0x10'))[_0xee7d('0x11')](socket);function respondWithRpcPromise(_0x44e6ef,_0x474c53,_0x146172){return new BPromise(function(_0x36e00f,_0x598421){return client[_0xee7d('0x12')](_0x44e6ef,_0x146172)['then'](function(_0x1bf8af){logger[_0xee7d('0x13')](_0xee7d('0x14'),_0x474c53,_0xee7d('0x15'));logger[_0xee7d('0x16')](_0xee7d('0x17'),_0x474c53,_0xee7d('0x15'),JSON[_0xee7d('0x18')](_0x1bf8af));if(_0x1bf8af[_0xee7d('0x19')]){if(_0x1bf8af[_0xee7d('0x19')][_0xee7d('0x1a')]===0x1f4){logger['error']('VoiceExtension,\x20%s,\x20%s',_0x474c53,_0x1bf8af[_0xee7d('0x19')][_0xee7d('0x1b')]);return _0x598421(_0x1bf8af[_0xee7d('0x19')][_0xee7d('0x1b')]);}logger[_0xee7d('0x19')](_0xee7d('0x14'),_0x474c53,_0x1bf8af['error'][_0xee7d('0x1b')]);return _0x36e00f(_0x1bf8af[_0xee7d('0x19')][_0xee7d('0x1b')]);}else{logger[_0xee7d('0x13')](_0xee7d('0x14'),_0x474c53,_0xee7d('0x15'));_0x36e00f(_0x1bf8af['result'][_0xee7d('0x1b')]);}})[_0xee7d('0x1c')](function(_0x3facfb){logger['error'](_0xee7d('0x14'),_0x474c53,_0x3facfb);_0x598421(_0x3facfb);});});}exports['GetVoiceExtension']=function(_0x1ef8ea){var _0x34209e=this;return new Promise(function(_0x2eb283,_0x4f6445){return db[_0xee7d('0x1d')]['findAll']({'raw':_0x1ef8ea[_0xee7d('0x1e')]?_0x1ef8ea[_0xee7d('0x1e')][_0xee7d('0x1f')]===undefined?!![]:![]:!![],'where':_0x1ef8ea[_0xee7d('0x1e')]?_0x1ef8ea['options'][_0xee7d('0x20')]||null:null,'attributes':_0x1ef8ea[_0xee7d('0x1e')]?_0x1ef8ea[_0xee7d('0x1e')][_0xee7d('0x21')]||null:null,'limit':_0x1ef8ea[_0xee7d('0x1e')]?_0x1ef8ea[_0xee7d('0x1e')][_0xee7d('0x22')]||null:null,'include':_0x1ef8ea[_0xee7d('0x1e')]?_0x1ef8ea[_0xee7d('0x1e')]['include']?_[_0xee7d('0x23')](_0x1ef8ea[_0xee7d('0x1e')][_0xee7d('0x24')],function(_0x576d56){return{'model':db[_0x576d56[_0xee7d('0x25')]],'as':_0x576d56['as'],'attributes':_0x576d56[_0xee7d('0x21')],'include':_0x576d56[_0xee7d('0x24')]?_[_0xee7d('0x23')](_0x576d56[_0xee7d('0x24')],function(_0x1b4492){return{'model':db[_0x1b4492[_0xee7d('0x25')]],'as':_0x1b4492['as'],'attributes':_0x1b4492[_0xee7d('0x21')],'include':_0x1b4492[_0xee7d('0x24')]?_['map'](_0x1b4492[_0xee7d('0x24')],function(_0x4e1bf5){return{'model':db[_0x4e1bf5['model']],'as':_0x4e1bf5['as'],'attributes':_0x4e1bf5[_0xee7d('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x151094){logger[_0xee7d('0x13')]('GetVoiceExtension',_0x1ef8ea);logger[_0xee7d('0x16')](_0xee7d('0x26'),_0x1ef8ea,JSON[_0xee7d('0x18')](_0x151094));_0x2eb283(_0x151094);})[_0xee7d('0x1c')](function(_0xcbfec4){logger['error'](_0xee7d('0x26'),_0xcbfec4[_0xee7d('0x1b')],_0x1ef8ea);_0x4f6445(_0x34209e[_0xee7d('0x19')](0x1f4,_0xcbfec4[_0xee7d('0x1b')]));});});}; \ No newline at end of file +var _0xd072=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','request','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','VoiceExtension','findAll','options','where','limit','include','model','attributes','GetVoiceExtension','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x8c1149,_0x7f86e2){var _0x2f5891=function(_0x32c375){while(--_0x32c375){_0x8c1149['push'](_0x8c1149['shift']());}};_0x2f5891(++_0x7f86e2);}(_0xd072,0x132));var _0x2d07=function(_0x323083,_0x5a07e6){_0x323083=_0x323083-0x0;var _0x52640e=_0xd072[_0x323083];return _0x52640e;};'use strict';var _=require(_0x2d07('0x0'));var util=require(_0x2d07('0x1'));var moment=require(_0x2d07('0x2'));var BPromise=require(_0x2d07('0x3'));var rs=require(_0x2d07('0x4'));var fs=require('fs');var Redis=require(_0x2d07('0x5'));var db=require(_0x2d07('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x2d07('0x7'))(_0x2d07('0x8'));var config=require(_0x2d07('0x9'));var jayson=require(_0x2d07('0xa'));var client=jayson[_0x2d07('0xb')]['http']({'port':0x232a});config[_0x2d07('0xc')]=_[_0x2d07('0xd')](config[_0x2d07('0xc')],{'host':_0x2d07('0xe'),'port':0x18eb});var socket=require(_0x2d07('0xf'))(new Redis(config[_0x2d07('0xc')]));require(_0x2d07('0x10'))['register'](socket);function respondWithRpcPromise(_0x12e4b4,_0x3288ea,_0xa67a15){return new BPromise(function(_0x46ddb1,_0x20ce98){return client[_0x2d07('0x11')](_0x12e4b4,_0xa67a15)[_0x2d07('0x12')](function(_0x3a679d){logger[_0x2d07('0x13')](_0x2d07('0x14'),_0x3288ea,_0x2d07('0x15'));logger[_0x2d07('0x16')](_0x2d07('0x17'),_0x3288ea,_0x2d07('0x15'),JSON[_0x2d07('0x18')](_0x3a679d));if(_0x3a679d[_0x2d07('0x19')]){if(_0x3a679d[_0x2d07('0x19')][_0x2d07('0x1a')]===0x1f4){logger[_0x2d07('0x19')](_0x2d07('0x14'),_0x3288ea,_0x3a679d[_0x2d07('0x19')][_0x2d07('0x1b')]);return _0x20ce98(_0x3a679d[_0x2d07('0x19')][_0x2d07('0x1b')]);}logger[_0x2d07('0x19')]('VoiceExtension,\x20%s,\x20%s',_0x3288ea,_0x3a679d[_0x2d07('0x19')][_0x2d07('0x1b')]);return _0x46ddb1(_0x3a679d[_0x2d07('0x19')][_0x2d07('0x1b')]);}else{logger[_0x2d07('0x13')](_0x2d07('0x14'),_0x3288ea,_0x2d07('0x15'));_0x46ddb1(_0x3a679d[_0x2d07('0x1c')]['message']);}})[_0x2d07('0x1d')](function(_0x1c6300){logger[_0x2d07('0x19')](_0x2d07('0x14'),_0x3288ea,_0x1c6300);_0x20ce98(_0x1c6300);});});}exports['GetVoiceExtension']=function(_0x112ac3){var _0x2a419f=this;return new Promise(function(_0xd0c5f8,_0xe56848){return db[_0x2d07('0x1e')][_0x2d07('0x1f')]({'raw':_0x112ac3[_0x2d07('0x20')]?_0x112ac3[_0x2d07('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x112ac3[_0x2d07('0x20')]?_0x112ac3[_0x2d07('0x20')][_0x2d07('0x21')]||null:null,'attributes':_0x112ac3['options']?_0x112ac3[_0x2d07('0x20')]['attributes']||null:null,'limit':_0x112ac3[_0x2d07('0x20')]?_0x112ac3[_0x2d07('0x20')][_0x2d07('0x22')]||null:null,'include':_0x112ac3['options']?_0x112ac3[_0x2d07('0x20')][_0x2d07('0x23')]?_['map'](_0x112ac3[_0x2d07('0x20')]['include'],function(_0x1f0f2a){return{'model':db[_0x1f0f2a[_0x2d07('0x24')]],'as':_0x1f0f2a['as'],'attributes':_0x1f0f2a[_0x2d07('0x25')],'include':_0x1f0f2a[_0x2d07('0x23')]?_['map'](_0x1f0f2a[_0x2d07('0x23')],function(_0x713c5d){return{'model':db[_0x713c5d[_0x2d07('0x24')]],'as':_0x713c5d['as'],'attributes':_0x713c5d['attributes'],'include':_0x713c5d[_0x2d07('0x23')]?_['map'](_0x713c5d['include'],function(_0x16c5ed){return{'model':db[_0x16c5ed[_0x2d07('0x24')]],'as':_0x16c5ed['as'],'attributes':_0x16c5ed['attributes']};}):[]};}):[]};}):[]:[]})[_0x2d07('0x12')](function(_0x59e36f){logger['info'](_0x2d07('0x26'),_0x112ac3);logger[_0x2d07('0x16')]('GetVoiceExtension',_0x112ac3,JSON[_0x2d07('0x18')](_0x59e36f));_0xd0c5f8(_0x59e36f);})['catch'](function(_0x34794b){logger[_0x2d07('0x19')]('GetVoiceExtension',_0x34794b[_0x2d07('0x1b')],_0x112ac3);_0xe56848(_0x2a419f['error'](0x1f4,_0x34794b['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 02371d6..8580352 100644 --- a/server/api/voiceExtension/voiceExtension.socket.js +++ b/server/api/voiceExtension/voiceExtension.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['remove','update','removeListener','register','length','./voiceExtension.events','save'];(function(_0x577ae0,_0x47922c){var _0x15fdbe=function(_0x1dce09){while(--_0x1dce09){_0x577ae0['push'](_0x577ae0['shift']());}};_0x15fdbe(++_0x47922c);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0xc4aa[_0x5f1391];return _0x50ebe3;};'use strict';var VoiceExtensionEvents=require(_0xac4a('0x0'));var events=[_0xac4a('0x1'),_0xac4a('0x2'),_0xac4a('0x3')];function createListener(_0x275161,_0x22469d){return function(_0x58634e){_0x22469d['emit'](_0x275161,_0x58634e);};}function removeListener(_0x47d4f6,_0x2f48ed){return function(){VoiceExtensionEvents[_0xac4a('0x4')](_0x47d4f6,_0x2f48ed);};}exports[_0xac4a('0x5')]=function(_0x215f39){for(var _0x96be2b=0x0,_0x15cd34=events[_0xac4a('0x6')];_0x96be2b<_0x15cd34;_0x96be2b++){var _0x10525b=events[_0x96be2b];var _0x5c6179=createListener('voiceExtension:'+_0x10525b,_0x215f39);VoiceExtensionEvents['on'](_0x10525b,_0x5c6179);}}; \ No newline at end of file +var _0x0295=['emit','removeListener','register','voiceExtension:','./voiceExtension.events','update'];(function(_0x4e818c,_0x431c6c){var _0x10fb73=function(_0x1a474a){while(--_0x1a474a){_0x4e818c['push'](_0x4e818c['shift']());}};_0x10fb73(++_0x431c6c);}(_0x0295,0x1f0));var _0x5029=function(_0x1dfa63,_0x362bd4){_0x1dfa63=_0x1dfa63-0x0;var _0x26f2a9=_0x0295[_0x1dfa63];return _0x26f2a9;};'use strict';var VoiceExtensionEvents=require(_0x5029('0x0'));var events=['save','remove',_0x5029('0x1')];function createListener(_0x4f552a,_0x53c2e1){return function(_0x315589){_0x53c2e1[_0x5029('0x2')](_0x4f552a,_0x315589);};}function removeListener(_0x157a4f,_0x3d0af1){return function(){VoiceExtensionEvents[_0x5029('0x3')](_0x157a4f,_0x3d0af1);};}exports[_0x5029('0x4')]=function(_0x200217){for(var _0x215955=0x0,_0x5b3cd=events['length'];_0x215955<_0x5b3cd;_0x215955++){var _0x54978f=events[_0x215955];var _0x4ee867=createListener(_0x5029('0x5')+_0x54978f,_0x200217);VoiceExtensionEvents['on'](_0x54978f,_0x4ee867);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index ae68a82..8cf84c2 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 _0xa6b0=['post','create','put','update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','index','/:id','show','/:id/messages'];(function(_0x2fe21c,_0x372ec7){var _0x8f82a5=function(_0xca7e02){while(--_0xca7e02){_0x2fe21c['push'](_0x2fe21c['shift']());}};_0x8f82a5(++_0x372ec7);}(_0xa6b0,0xaf));var _0x0a6b=function(_0x4c13f1,_0x3f4b0b){_0x4c13f1=_0x4c13f1-0x0;var _0x10a88a=_0xa6b0[_0x4c13f1];return _0x10a88a;};'use strict';var multer=require(_0x0a6b('0x0'));var util=require(_0x0a6b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0a6b('0x2'));var router=express[_0x0a6b('0x3')]();var fs_extra=require(_0x0a6b('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x0a6b('0x5'));var config=require(_0x0a6b('0x6'));var controller=require(_0x0a6b('0x7'));router[_0x0a6b('0x8')]('/',auth[_0x0a6b('0x9')](),controller[_0x0a6b('0xa')]);router[_0x0a6b('0x8')](_0x0a6b('0xb'),auth[_0x0a6b('0x9')](),controller[_0x0a6b('0xc')]);router[_0x0a6b('0x8')](_0x0a6b('0xd'),auth['isAuthenticated'](),controller['getMessages']);router[_0x0a6b('0xe')]('/',auth[_0x0a6b('0x9')](),controller[_0x0a6b('0xf')]);router[_0x0a6b('0x10')](_0x0a6b('0xb'),auth[_0x0a6b('0x9')](),controller[_0x0a6b('0x11')]);router[_0x0a6b('0x12')](_0x0a6b('0xb'),auth[_0x0a6b('0x9')](),controller[_0x0a6b('0x13')]);module[_0x0a6b('0x14')]=router; \ No newline at end of file +var _0x53ec=['update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./voiceMail.controller','isAuthenticated','get','/:id','show','/:id/messages','getMessages','post','create','put'];(function(_0xec2e49,_0x4fdc5d){var _0x88f53c=function(_0xa859c9){while(--_0xa859c9){_0xec2e49['push'](_0xec2e49['shift']());}};_0x88f53c(++_0x4fdc5d);}(_0x53ec,0x192));var _0xc53e=function(_0x5d6270,_0x83b57a){_0x5d6270=_0x5d6270-0x0;var _0x168f26=_0x53ec[_0x5d6270];return _0x168f26;};'use strict';var multer=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var path=require(_0xc53e('0x2'));var timeout=require(_0xc53e('0x3'));var express=require(_0xc53e('0x4'));var router=express[_0xc53e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc53e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc53e('0x7'));var controller=require(_0xc53e('0x8'));router['get']('/',auth[_0xc53e('0x9')](),controller['index']);router[_0xc53e('0xa')](_0xc53e('0xb'),auth['isAuthenticated'](),controller[_0xc53e('0xc')]);router[_0xc53e('0xa')](_0xc53e('0xd'),auth[_0xc53e('0x9')](),controller[_0xc53e('0xe')]);router[_0xc53e('0xf')]('/',auth[_0xc53e('0x9')](),controller[_0xc53e('0x10')]);router[_0xc53e('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xc53e('0x12')]);router['delete']('/:id',auth[_0xc53e('0x9')](),controller[_0xc53e('0x13')]);module[_0xc53e('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 97066f3..bcbea3f 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 _0x3188=['getDataValue','mailbox','exports','STRING','contest_mailbox','setDataValue','email','string','trim','central','ENUM','yes','TIMESTAMP','INTEGER','VIRTUAL','fullname','\x20-\x20'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x3188,0x112));var _0x8318=function(_0x39ec63,_0x346199){_0x39ec63=_0x39ec63-0x0;var _0x5802e1=_0x3188[_0x39ec63];return _0x5802e1;};'use strict';var Sequelize=require('sequelize');module[_0x8318('0x0')]={'customer_id':{'type':Sequelize[_0x8318('0x1')]},'context':{'type':Sequelize[_0x8318('0x1')],'defaultValue':'from-voicemail','unique':_0x8318('0x2')},'mailbox':{'type':Sequelize[_0x8318('0x1')],'defaultValue':'','allowNull':![],'unique':_0x8318('0x2')},'password':{'type':Sequelize[_0x8318('0x1')]},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x8318('0x1')],'validate':{'isEmail':!![]},'set':function(_0x32d73a){this[_0x8318('0x3')](_0x8318('0x4'),typeof _0x32d73a===_0x8318('0x5')&&_0x32d73a[_0x8318('0x6')]()?_0x32d73a[_0x8318('0x6')]():null);}},'pager':{'type':Sequelize[_0x8318('0x1')]},'tz':{'type':Sequelize[_0x8318('0x1')],'defaultValue':_0x8318('0x7')},'attach':{'type':Sequelize[_0x8318('0x8')](_0x8318('0x9'),'no'),'defaultValue':_0x8318('0x9'),'allowNull':![]},'saycid':{'type':Sequelize[_0x8318('0x8')](_0x8318('0x9'),'no'),'defaultValue':_0x8318('0x9'),'allowNull':![]},'dialout':{'type':Sequelize[_0x8318('0x1')]},'callback':{'type':Sequelize[_0x8318('0x1')]},'review':{'type':Sequelize[_0x8318('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x8318('0x8')](_0x8318('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x8318('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x8318('0x8')](_0x8318('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x8318('0x8')](_0x8318('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x8318('0x8')](_0x8318('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x8318('0x9'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0x8318('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x8318('0x8')](_0x8318('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM'](_0x8318('0x9'),'no'),'defaultValue':_0x8318('0x9'),'allowNull':![]},'stamp':{'type':_0x8318('0xa')},'emailsubject':{'type':Sequelize[_0x8318('0x1')]},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize[_0x8318('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x8318('0xb')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x8318('0xc')],'get':function(){return this['getDataValue'](_0x8318('0xd'))+_0x8318('0xe')+this[_0x8318('0xf')](_0x8318('0x10'));}}}; \ No newline at end of file +var _0x05c9=['VIRTUAL','getDataValue','exports','STRING','from-voicemail','contest_mailbox','email','string','trim','central','yes','ENUM','TINYINT(4)','TIMESTAMP','INTEGER'];(function(_0x41dd55,_0x5bce49){var _0x5bdb5f=function(_0x17c5c9){while(--_0x17c5c9){_0x41dd55['push'](_0x41dd55['shift']());}};_0x5bdb5f(++_0x5bce49);}(_0x05c9,0x7a));var _0x905c=function(_0x4749b5,_0x3033aa){_0x4749b5=_0x4749b5-0x0;var _0x1ef30a=_0x05c9[_0x4749b5];return _0x1ef30a;};'use strict';var Sequelize=require('sequelize');module[_0x905c('0x0')]={'customer_id':{'type':Sequelize[_0x905c('0x1')]},'context':{'type':Sequelize[_0x905c('0x1')],'defaultValue':_0x905c('0x2'),'unique':_0x905c('0x3')},'mailbox':{'type':Sequelize[_0x905c('0x1')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0x905c('0x1')]},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x905c('0x1')],'validate':{'isEmail':!![]},'set':function(_0x164ebe){this['setDataValue'](_0x905c('0x4'),typeof _0x164ebe===_0x905c('0x5')&&_0x164ebe[_0x905c('0x6')]()?_0x164ebe['trim']():null);}},'pager':{'type':Sequelize[_0x905c('0x1')]},'tz':{'type':Sequelize[_0x905c('0x1')],'defaultValue':_0x905c('0x7')},'attach':{'type':Sequelize['ENUM'](_0x905c('0x8'),'no'),'defaultValue':_0x905c('0x8'),'allowNull':![]},'saycid':{'type':Sequelize[_0x905c('0x9')]('yes','no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0x905c('0x1')]},'callback':{'type':Sequelize[_0x905c('0x1')]},'review':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x905c('0x9')](_0x905c('0x8'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x905c('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x905c('0xa'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM'](_0x905c('0x8'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x905c('0x9')](_0x905c('0x8'),'no'),'defaultValue':_0x905c('0x8'),'allowNull':![]},'forcename':{'type':Sequelize[_0x905c('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x905c('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x905c('0x9')](_0x905c('0x8'),'no'),'defaultValue':_0x905c('0x8'),'allowNull':![]},'stamp':{'type':_0x905c('0xb')},'emailsubject':{'type':Sequelize[_0x905c('0x1')]},'emailbody':{'type':Sequelize[_0x905c('0x1')]},'maxsecs':{'type':Sequelize[_0x905c('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x905c('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x905c('0xd')],'get':function(){return this[_0x905c('0xe')]('fullname')+'\x20-\x20'+this['getDataValue']('mailbox');}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 82577f1..4ae6501 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 _0x7072=['order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','intersection','length','find','create','body','user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','getMessages','findOne','VoiceMailMessage','hasOwnProperty','nolimit','mailbox','findAndCountAll','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','then','get','Voicemails','UserProfileResource','error','stack','name','index','map','VoiceMail','rawAttributes','fieldName','type','key','model','query','keys','attributes','fields'];(function(_0x47c156,_0xe8df6d){var _0x57eadd=function(_0x518275){while(--_0x518275){_0x47c156['push'](_0x47c156['shift']());}};_0x57eadd(++_0xe8df6d);}(_0x7072,0x138));var _0x2707=function(_0x49d41c,_0x2bdc35){_0x49d41c=_0x49d41c-0x0;var _0xb64c5f=_0x7072[_0x49d41c];return _0xb64c5f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2707('0x0'));var zipdir=require(_0x2707('0x1'));var jsonpatch=require(_0x2707('0x2'));var rp=require(_0x2707('0x3'));var moment=require(_0x2707('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2707('0x5'));var path=require('path');var sox=require(_0x2707('0x6'));var csv=require(_0x2707('0x7'));var ejs=require(_0x2707('0x8'));var fs=require('fs');var fs_extra=require(_0x2707('0x9'));var _=require(_0x2707('0xa'));var squel=require(_0x2707('0xb'));var crypto=require(_0x2707('0xc'));var jsforce=require(_0x2707('0xd'));var deskjs=require(_0x2707('0xe'));var toCsv=require(_0x2707('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x2707('0xf'));var authService=require(_0x2707('0x10'));var qs=require(_0x2707('0x11'));var as=require(_0x2707('0x12'));var hardwareService=require(_0x2707('0x13'));var logger=require(_0x2707('0x14'))(_0x2707('0x15'));var utils=require(_0x2707('0x16'));var config=require(_0x2707('0x17'));var licenseUtil=require(_0x2707('0x18'));var db=require(_0x2707('0x19'))['db'];function respondWithStatusCode(_0x32d4bd,_0x40d370){_0x40d370=_0x40d370||0xcc;return function(_0x5bf16e){if(_0x5bf16e){return _0x32d4bd[_0x2707('0x1a')](_0x40d370);}return _0x32d4bd['status'](_0x40d370)[_0x2707('0x1b')]();};}function respondWithResult(_0x307367,_0xfe975c){_0xfe975c=_0xfe975c||0xc8;return function(_0x3a67f2){if(_0x3a67f2){return _0x307367[_0x2707('0x1c')](_0xfe975c)['json'](_0x3a67f2);}};}function respondWithFilteredResult(_0x345774,_0x1a687a){return function(_0x2f6381){if(_0x2f6381){var _0x5d523f=typeof _0x1a687a[_0x2707('0x1d')]===_0x2707('0x1e')&&typeof _0x1a687a[_0x2707('0x1f')]===_0x2707('0x1e');var _0x7ed037=_0x2f6381[_0x2707('0x20')];var _0x4a8b7f=_0x5d523f?0x0:_0x1a687a[_0x2707('0x1d')];var _0x449a61=_0x5d523f?_0x2f6381[_0x2707('0x20')]:_0x1a687a['offset']+_0x1a687a['limit'];var _0x58a4ee;if(_0x449a61>=_0x7ed037){_0x449a61=_0x7ed037;_0x58a4ee=0xc8;}else{_0x58a4ee=0xce;}_0x345774[_0x2707('0x1c')](_0x58a4ee);return _0x345774[_0x2707('0x21')](_0x2707('0x22'),_0x4a8b7f+'-'+_0x449a61+'/'+_0x7ed037)[_0x2707('0x23')](_0x2f6381);}return null;};}function patchUpdates(_0x1a0e1a){return function(_0x3c2935){try{jsonpatch[_0x2707('0x24')](_0x3c2935,_0x1a0e1a,!![]);}catch(_0x65b6e5){return BPromise[_0x2707('0x25')](_0x65b6e5);}return _0x3c2935[_0x2707('0x26')]();};}function saveUpdates(_0x37c475,_0x119df4){return function(_0x454fde){if(_0x454fde){return _0x454fde[_0x2707('0x27')](_0x37c475)['then'](function(_0x1acf22){return _0x1acf22;});}return null;};}function removeEntity(_0x3b030a,_0x46259e){return function(_0x369e3a){if(_0x369e3a){return _0x369e3a[_0x2707('0x28')]()[_0x2707('0x29')](function(){var _0x4831ed=_0x369e3a[_0x2707('0x2a')]({'plain':!![]});var _0x3f6976=_0x2707('0x2b');return db[_0x2707('0x2c')][_0x2707('0x28')]({'where':{'type':_0x3f6976,'resourceId':_0x4831ed['id']}})['then'](function(){return _0x369e3a;});})[_0x2707('0x29')](function(){_0x3b030a['status'](0xcc)[_0x2707('0x1b')]();});}};}function handleEntityNotFound(_0x34dc4e,_0x2aa3fe){return function(_0x57da26){if(!_0x57da26){_0x34dc4e[_0x2707('0x1a')](0x194);}return _0x57da26;};}function handleError(_0x14daf8,_0x2c7047){_0x2c7047=_0x2c7047||0x1f4;return function(_0x529be8){logger[_0x2707('0x2d')](_0x529be8[_0x2707('0x2e')]);if(_0x529be8['name']){delete _0x529be8[_0x2707('0x2f')];}_0x14daf8['status'](_0x2c7047)['send'](_0x529be8);};}exports[_0x2707('0x30')]=function(_0x4e0c93,_0x2a0d24){var _0x3f153d={},_0x417a97={},_0x36b2e9={'count':0x0,'rows':[]};var _0x48832b=_[_0x2707('0x31')](db[_0x2707('0x32')][_0x2707('0x33')],function(_0x154799){return{'name':_0x154799[_0x2707('0x34')],'type':_0x154799[_0x2707('0x35')][_0x2707('0x36')]};});_0x417a97[_0x2707('0x37')]=_[_0x2707('0x31')](_0x48832b,'name');_0x417a97[_0x2707('0x38')]=_[_0x2707('0x39')](_0x4e0c93['query']);_0x417a97['filters']=_['intersection'](_0x417a97['model'],_0x417a97['query']);_0x3f153d[_0x2707('0x3a')]=_['intersection'](_0x417a97['model'],qs[_0x2707('0x3b')](_0x4e0c93[_0x2707('0x38')]['fields']));_0x3f153d[_0x2707('0x3a')]=_0x3f153d[_0x2707('0x3a')]['length']?_0x3f153d['attributes']:_0x417a97[_0x2707('0x37')];if(!_0x4e0c93[_0x2707('0x38')]['hasOwnProperty']('nolimit')){_0x3f153d[_0x2707('0x1f')]=qs[_0x2707('0x1f')](_0x4e0c93['query'][_0x2707('0x1f')]);_0x3f153d[_0x2707('0x1d')]=qs[_0x2707('0x1d')](_0x4e0c93[_0x2707('0x38')][_0x2707('0x1d')]);}_0x3f153d[_0x2707('0x3c')]=qs['sort'](_0x4e0c93[_0x2707('0x38')][_0x2707('0x3d')]);_0x3f153d[_0x2707('0x3e')]=qs[_0x2707('0x3f')](_[_0x2707('0x40')](_0x4e0c93[_0x2707('0x38')],_0x417a97[_0x2707('0x3f')]),_0x48832b);if(_0x4e0c93['query'][_0x2707('0x41')]){_0x3f153d[_0x2707('0x3e')]=_[_0x2707('0x42')](_0x3f153d[_0x2707('0x3e')],{'$or':_[_0x2707('0x31')](_0x48832b,function(_0xc7119d){if(_0xc7119d[_0x2707('0x35')]!==_0x2707('0x43')){var _0x2f06f8={};_0x2f06f8[_0xc7119d[_0x2707('0x2f')]]={'$like':'%'+_0x4e0c93[_0x2707('0x38')][_0x2707('0x41')]+'%'};return _0x2f06f8;}})});}_0x3f153d=_[_0x2707('0x42')]({},_0x3f153d,_0x4e0c93[_0x2707('0x44')]);var _0x36c8ab={'where':_0x3f153d[_0x2707('0x3e')]};return db['VoiceMail'][_0x2707('0x20')](_0x36c8ab)[_0x2707('0x29')](function(_0x5053ba){_0x36b2e9[_0x2707('0x20')]=_0x5053ba;if(_0x4e0c93['query'][_0x2707('0x45')]){_0x3f153d[_0x2707('0x46')]=[{'all':!![]}];}return db[_0x2707('0x32')][_0x2707('0x47')](_0x3f153d);})[_0x2707('0x29')](function(_0xdeec24){_0x36b2e9[_0x2707('0x48')]=_0xdeec24;return _0x36b2e9;})['then'](respondWithFilteredResult(_0x2a0d24,_0x3f153d))[_0x2707('0x49')](handleError(_0x2a0d24,null));};exports[_0x2707('0x4a')]=function(_0x4c8dbf,_0x3d25ea){var _0x6defc2={'raw':!![],'where':{'id':_0x4c8dbf['params']['id']}},_0x3b38d7={};_0x3b38d7['model']=_[_0x2707('0x39')](db[_0x2707('0x32')]['rawAttributes']);_0x3b38d7[_0x2707('0x38')]=_['keys'](_0x4c8dbf[_0x2707('0x38')]);_0x3b38d7[_0x2707('0x3f')]=_[_0x2707('0x4b')](_0x3b38d7[_0x2707('0x37')],_0x3b38d7['query']);_0x6defc2[_0x2707('0x3a')]=_[_0x2707('0x4b')](_0x3b38d7[_0x2707('0x37')],qs[_0x2707('0x3b')](_0x4c8dbf[_0x2707('0x38')][_0x2707('0x3b')]));_0x6defc2[_0x2707('0x3a')]=_0x6defc2['attributes'][_0x2707('0x4c')]?_0x6defc2[_0x2707('0x3a')]:_0x3b38d7[_0x2707('0x37')];if(_0x4c8dbf[_0x2707('0x38')][_0x2707('0x45')]){_0x6defc2['include']=[{'all':!![]}];}_0x6defc2=_[_0x2707('0x42')]({},_0x6defc2,_0x4c8dbf['options']);return db[_0x2707('0x32')][_0x2707('0x4d')](_0x6defc2)['then'](handleEntityNotFound(_0x3d25ea,null))[_0x2707('0x29')](respondWithResult(_0x3d25ea,null))[_0x2707('0x49')](handleError(_0x3d25ea,null));};exports[_0x2707('0x4e')]=function(_0x4ae196,_0x1a8034){return db['VoiceMail'][_0x2707('0x4e')](_0x4ae196[_0x2707('0x4f')],{})['then'](function(_0x2b1746){var _0xffe740=_0x4ae196[_0x2707('0x50')]['get']({'plain':!![]});if(!_0xffe740)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xffe740[_0x2707('0x51')]===_0x2707('0x50')){var _0x292b44=_0x2b1746[_0x2707('0x2a')]({'plain':!![]});var _0x463bf='Voicemails';return db['UserProfileSection']['find']({'where':{'name':_0x463bf,'userProfileId':_0xffe740[_0x2707('0x52')]},'raw':!![]})[_0x2707('0x29')](function(_0x2e11fc){if(_0x2e11fc&&_0x2e11fc[_0x2707('0x53')]===0x0){return db[_0x2707('0x2c')]['create']({'name':_0x292b44[_0x2707('0x2f')],'resourceId':_0x292b44['id'],'type':_0x2e11fc[_0x2707('0x2f')],'sectionId':_0x2e11fc['id']},{})['then'](function(){return _0x2b1746;});}else{return _0x2b1746;}})['catch'](function(_0x3b41b2){logger[_0x2707('0x2d')](_0x2707('0x54'),_0x3b41b2);throw _0x3b41b2;});}return _0x2b1746;})['then'](respondWithResult(_0x1a8034,0xc9))[_0x2707('0x49')](handleError(_0x1a8034,null));};exports[_0x2707('0x27')]=function(_0x2a2a71,_0x29a453){if(_0x2a2a71['body']['id']){delete _0x2a2a71[_0x2707('0x4f')]['id'];}return db[_0x2707('0x32')][_0x2707('0x4d')]({'where':{'id':_0x2a2a71[_0x2707('0x55')]['id']}})[_0x2707('0x29')](handleEntityNotFound(_0x29a453,null))[_0x2707('0x29')](saveUpdates(_0x2a2a71[_0x2707('0x4f')],null))[_0x2707('0x29')](respondWithResult(_0x29a453,null))[_0x2707('0x49')](handleError(_0x29a453,null));};exports[_0x2707('0x28')]=function(_0x4f2b54,_0x38acdd){return db['VoiceMail']['find']({'where':{'id':_0x4f2b54[_0x2707('0x55')]['id']}})['then'](handleEntityNotFound(_0x38acdd,null))['then'](removeEntity(_0x38acdd,null))[_0x2707('0x49')](handleError(_0x38acdd,null));};exports[_0x2707('0x56')]=function(_0x185bd3,_0x154e26,_0x3f82de){return db[_0x2707('0x32')][_0x2707('0x57')]({'where':{'id':_0x185bd3[_0x2707('0x55')]['id']}})[_0x2707('0x29')](handleEntityNotFound(_0x154e26,null))[_0x2707('0x29')](function(_0x40c333){var _0x5852bd;var _0x4c4568={},_0x4a3a35={};_0x4a3a35[_0x2707('0x37')]=_[_0x2707('0x39')](db[_0x2707('0x58')]['rawAttributes']);_0x4a3a35['query']=_[_0x2707('0x39')](_0x185bd3[_0x2707('0x38')]);_0x4a3a35[_0x2707('0x3f')]=_[_0x2707('0x4b')](_0x4a3a35[_0x2707('0x37')],_0x4a3a35['query']);_0x4c4568['attributes']=_[_0x2707('0x4b')](_0x4a3a35[_0x2707('0x37')],qs[_0x2707('0x3b')](_0x185bd3[_0x2707('0x38')][_0x2707('0x3b')]));_0x4c4568[_0x2707('0x3a')]=_0x4c4568[_0x2707('0x3a')][_0x2707('0x4c')]?_0x4c4568[_0x2707('0x3a')]:_0x4a3a35['model'];if(!_0x185bd3[_0x2707('0x38')][_0x2707('0x59')](_0x2707('0x5a'))){_0x4c4568[_0x2707('0x1f')]=qs[_0x2707('0x1f')](_0x185bd3[_0x2707('0x38')]['limit']);_0x4c4568['offset']=qs[_0x2707('0x1d')](_0x185bd3[_0x2707('0x38')]['offset']);}_0x4c4568['order']=qs['sort'](_0x185bd3['query'][_0x2707('0x3d')]);_0x4c4568[_0x2707('0x3e')]=qs['filters'](_[_0x2707('0x40')](_0x185bd3[_0x2707('0x38')],_0x4a3a35[_0x2707('0x3f')]));if(_0x185bd3['query']['filter']){_0x4c4568[_0x2707('0x3e')]=_[_0x2707('0x42')](_0x4c4568[_0x2707('0x3e')],{'$or':_[_0x2707('0x31')](_0x4c4568[_0x2707('0x3a')],function(_0xdb1de0){var _0x3973a0={};_0x3973a0[_0xdb1de0]={'$like':'%'+_0x185bd3['query'][_0x2707('0x41')]+'%'};return _0x3973a0;})});}_0x4c4568[_0x2707('0x3e')]=_[_0x2707('0x42')](_0x4c4568[_0x2707('0x3e')],{'mailboxuser':_0x40c333[_0x2707('0x5b')]});_0x4c4568=_[_0x2707('0x42')]({},_0x4c4568,_0x185bd3['options']);return db[_0x2707('0x58')][_0x2707('0x5c')](_0x4c4568)[_0x2707('0x29')](respondWithFilteredResult(_0x154e26,_0x4c4568));})[_0x2707('0x49')](handleError(_0x154e26,null));}; \ No newline at end of file +var _0x5eb8=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','then','get','Voicemails','UserProfileResource','sendStatus','error','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','includeAll','include','VoiceMail','findAll','rows','catch','show','params','options','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','VoiceMailMessage','pick','filter','mailbox'];(function(_0x12c98e,_0x2d0b4b){var _0x198b35=function(_0x26c881){while(--_0x26c881){_0x12c98e['push'](_0x12c98e['shift']());}};_0x198b35(++_0x2d0b4b);}(_0x5eb8,0xb0));var _0x85eb=function(_0x2f62aa,_0x108e95){_0x2f62aa=_0x2f62aa-0x0;var _0x1a341f=_0x5eb8[_0x2f62aa];return _0x1a341f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x85eb('0x0'));var jsonpatch=require(_0x85eb('0x1'));var rp=require(_0x85eb('0x2'));var moment=require(_0x85eb('0x3'));var BPromise=require(_0x85eb('0x4'));var Mustache=require(_0x85eb('0x5'));var util=require(_0x85eb('0x6'));var path=require(_0x85eb('0x7'));var sox=require(_0x85eb('0x8'));var csv=require(_0x85eb('0x9'));var ejs=require(_0x85eb('0xa'));var fs=require('fs');var fs_extra=require(_0x85eb('0xb'));var _=require('lodash');var squel=require(_0x85eb('0xc'));var crypto=require(_0x85eb('0xd'));var jsforce=require(_0x85eb('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x85eb('0x9'));var querystring=require('querystring');var Papa=require(_0x85eb('0xf'));var Redis=require(_0x85eb('0x10'));var authService=require(_0x85eb('0x11'));var qs=require(_0x85eb('0x12'));var as=require(_0x85eb('0x13'));var hardwareService=require(_0x85eb('0x14'));var logger=require(_0x85eb('0x15'))('api');var utils=require(_0x85eb('0x16'));var config=require(_0x85eb('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x85eb('0x18'))['db'];function respondWithStatusCode(_0x784583,_0x2f42ba){_0x2f42ba=_0x2f42ba||0xcc;return function(_0x259f72){if(_0x259f72){return _0x784583['sendStatus'](_0x2f42ba);}return _0x784583['status'](_0x2f42ba)[_0x85eb('0x19')]();};}function respondWithResult(_0x5c760a,_0x18ca53){_0x18ca53=_0x18ca53||0xc8;return function(_0x23a82a){if(_0x23a82a){return _0x5c760a[_0x85eb('0x1a')](_0x18ca53)[_0x85eb('0x1b')](_0x23a82a);}};}function respondWithFilteredResult(_0x183b0c,_0x49efdf){return function(_0x2e5c0a){if(_0x2e5c0a){var _0x59237b=typeof _0x49efdf[_0x85eb('0x1c')]===_0x85eb('0x1d')&&typeof _0x49efdf[_0x85eb('0x1e')]===_0x85eb('0x1d');var _0x5dbeda=_0x2e5c0a['count'];var _0x50d2a8=_0x59237b?0x0:_0x49efdf[_0x85eb('0x1c')];var _0x39ca96=_0x59237b?_0x2e5c0a[_0x85eb('0x1f')]:_0x49efdf[_0x85eb('0x1c')]+_0x49efdf[_0x85eb('0x1e')];var _0x34f875;if(_0x39ca96>=_0x5dbeda){_0x39ca96=_0x5dbeda;_0x34f875=0xc8;}else{_0x34f875=0xce;}_0x183b0c['status'](_0x34f875);return _0x183b0c[_0x85eb('0x20')](_0x85eb('0x21'),_0x50d2a8+'-'+_0x39ca96+'/'+_0x5dbeda)[_0x85eb('0x1b')](_0x2e5c0a);}return null;};}function patchUpdates(_0x4e8041){return function(_0x4b4b38){try{jsonpatch['apply'](_0x4b4b38,_0x4e8041,!![]);}catch(_0x55b9e4){return BPromise[_0x85eb('0x22')](_0x55b9e4);}return _0x4b4b38[_0x85eb('0x23')]();};}function saveUpdates(_0x329fc5,_0x255ca7){return function(_0x465c74){if(_0x465c74){return _0x465c74[_0x85eb('0x24')](_0x329fc5)['then'](function(_0x5491d5){return _0x5491d5;});}return null;};}function removeEntity(_0x5b48d9,_0x298e84){return function(_0x1426c8){if(_0x1426c8){return _0x1426c8[_0x85eb('0x25')]()[_0x85eb('0x26')](function(){var _0x312b3e=_0x1426c8[_0x85eb('0x27')]({'plain':!![]});var _0x5dfc96=_0x85eb('0x28');return db[_0x85eb('0x29')][_0x85eb('0x25')]({'where':{'type':_0x5dfc96,'resourceId':_0x312b3e['id']}})[_0x85eb('0x26')](function(){return _0x1426c8;});})[_0x85eb('0x26')](function(){_0x5b48d9['status'](0xcc)[_0x85eb('0x19')]();});}};}function handleEntityNotFound(_0x792d3a,_0x291557){return function(_0x3e7eb9){if(!_0x3e7eb9){_0x792d3a[_0x85eb('0x2a')](0x194);}return _0x3e7eb9;};}function handleError(_0x29d262,_0x50541a){_0x50541a=_0x50541a||0x1f4;return function(_0x562792){logger[_0x85eb('0x2b')](_0x562792['stack']);if(_0x562792[_0x85eb('0x2c')]){delete _0x562792['name'];}_0x29d262[_0x85eb('0x1a')](_0x50541a)[_0x85eb('0x2d')](_0x562792);};}exports[_0x85eb('0x2e')]=function(_0x1d9278,_0xa67e1c){var _0xf4ac13={},_0x41ed76={},_0x5decd5={'count':0x0,'rows':[]};var _0x237f19=_[_0x85eb('0x2f')](db['VoiceMail'][_0x85eb('0x30')],function(_0x5af2de){return{'name':_0x5af2de['fieldName'],'type':_0x5af2de[_0x85eb('0x31')][_0x85eb('0x32')]};});_0x41ed76[_0x85eb('0x33')]=_[_0x85eb('0x2f')](_0x237f19,_0x85eb('0x2c'));_0x41ed76[_0x85eb('0x34')]=_[_0x85eb('0x35')](_0x1d9278[_0x85eb('0x34')]);_0x41ed76[_0x85eb('0x36')]=_[_0x85eb('0x37')](_0x41ed76['model'],_0x41ed76[_0x85eb('0x34')]);_0xf4ac13[_0x85eb('0x38')]=_['intersection'](_0x41ed76['model'],qs[_0x85eb('0x39')](_0x1d9278[_0x85eb('0x34')][_0x85eb('0x39')]));_0xf4ac13[_0x85eb('0x38')]=_0xf4ac13[_0x85eb('0x38')][_0x85eb('0x3a')]?_0xf4ac13[_0x85eb('0x38')]:_0x41ed76[_0x85eb('0x33')];if(!_0x1d9278[_0x85eb('0x34')][_0x85eb('0x3b')](_0x85eb('0x3c'))){_0xf4ac13[_0x85eb('0x1e')]=qs[_0x85eb('0x1e')](_0x1d9278[_0x85eb('0x34')]['limit']);_0xf4ac13[_0x85eb('0x1c')]=qs[_0x85eb('0x1c')](_0x1d9278['query']['offset']);}_0xf4ac13[_0x85eb('0x3d')]=qs[_0x85eb('0x3e')](_0x1d9278['query'][_0x85eb('0x3e')]);_0xf4ac13['where']=qs[_0x85eb('0x36')](_['pick'](_0x1d9278[_0x85eb('0x34')],_0x41ed76['filters']),_0x237f19);if(_0x1d9278[_0x85eb('0x34')]['filter']){_0xf4ac13[_0x85eb('0x3f')]=_[_0x85eb('0x40')](_0xf4ac13['where'],{'$or':_[_0x85eb('0x2f')](_0x237f19,function(_0x5a1c15){if(_0x5a1c15[_0x85eb('0x31')]!==_0x85eb('0x41')){var _0x5c0156={};_0x5c0156[_0x5a1c15[_0x85eb('0x2c')]]={'$like':'%'+_0x1d9278['query']['filter']+'%'};return _0x5c0156;}})});}_0xf4ac13=_[_0x85eb('0x40')]({},_0xf4ac13,_0x1d9278['options']);var _0x17cc20={'where':_0xf4ac13[_0x85eb('0x3f')]};return db['VoiceMail']['count'](_0x17cc20)[_0x85eb('0x26')](function(_0x422ec3){_0x5decd5['count']=_0x422ec3;if(_0x1d9278['query'][_0x85eb('0x42')]){_0xf4ac13[_0x85eb('0x43')]=[{'all':!![]}];}return db[_0x85eb('0x44')][_0x85eb('0x45')](_0xf4ac13);})[_0x85eb('0x26')](function(_0x5b7411){_0x5decd5[_0x85eb('0x46')]=_0x5b7411;return _0x5decd5;})[_0x85eb('0x26')](respondWithFilteredResult(_0xa67e1c,_0xf4ac13))[_0x85eb('0x47')](handleError(_0xa67e1c,null));};exports[_0x85eb('0x48')]=function(_0x2ed39d,_0xbc43a7){var _0x40e2a2={'raw':!![],'where':{'id':_0x2ed39d[_0x85eb('0x49')]['id']}},_0x3e11a8={};_0x3e11a8['model']=_[_0x85eb('0x35')](db[_0x85eb('0x44')]['rawAttributes']);_0x3e11a8[_0x85eb('0x34')]=_[_0x85eb('0x35')](_0x2ed39d[_0x85eb('0x34')]);_0x3e11a8[_0x85eb('0x36')]=_[_0x85eb('0x37')](_0x3e11a8[_0x85eb('0x33')],_0x3e11a8['query']);_0x40e2a2[_0x85eb('0x38')]=_[_0x85eb('0x37')](_0x3e11a8[_0x85eb('0x33')],qs[_0x85eb('0x39')](_0x2ed39d[_0x85eb('0x34')][_0x85eb('0x39')]));_0x40e2a2[_0x85eb('0x38')]=_0x40e2a2[_0x85eb('0x38')]['length']?_0x40e2a2[_0x85eb('0x38')]:_0x3e11a8[_0x85eb('0x33')];if(_0x2ed39d[_0x85eb('0x34')][_0x85eb('0x42')]){_0x40e2a2[_0x85eb('0x43')]=[{'all':!![]}];}_0x40e2a2=_[_0x85eb('0x40')]({},_0x40e2a2,_0x2ed39d[_0x85eb('0x4a')]);return db[_0x85eb('0x44')][_0x85eb('0x4b')](_0x40e2a2)[_0x85eb('0x26')](handleEntityNotFound(_0xbc43a7,null))[_0x85eb('0x26')](respondWithResult(_0xbc43a7,null))[_0x85eb('0x47')](handleError(_0xbc43a7,null));};exports['create']=function(_0x11da79,_0x2c951b){return db[_0x85eb('0x44')]['create'](_0x11da79[_0x85eb('0x4c')],{})[_0x85eb('0x26')](function(_0x2cf928){var _0xd2f302=_0x11da79[_0x85eb('0x4d')]['get']({'plain':!![]});if(!_0xd2f302)throw new Error(_0x85eb('0x4e'));if(_0xd2f302[_0x85eb('0x4f')]===_0x85eb('0x4d')){var _0x50e264=_0x2cf928[_0x85eb('0x27')]({'plain':!![]});var _0x4550fd=_0x85eb('0x28');return db['UserProfileSection']['find']({'where':{'name':_0x4550fd,'userProfileId':_0xd2f302[_0x85eb('0x50')]},'raw':!![]})['then'](function(_0x5ed98a){if(_0x5ed98a&&_0x5ed98a[_0x85eb('0x51')]===0x0){return db['UserProfileResource'][_0x85eb('0x52')]({'name':_0x50e264[_0x85eb('0x2c')],'resourceId':_0x50e264['id'],'type':_0x5ed98a['name'],'sectionId':_0x5ed98a['id']},{})['then'](function(){return _0x2cf928;});}else{return _0x2cf928;}})[_0x85eb('0x47')](function(_0x249511){logger[_0x85eb('0x2b')](_0x85eb('0x53'),_0x249511);throw _0x249511;});}return _0x2cf928;})[_0x85eb('0x26')](respondWithResult(_0x2c951b,0xc9))['catch'](handleError(_0x2c951b,null));};exports[_0x85eb('0x24')]=function(_0x30062e,_0x270bb2){if(_0x30062e[_0x85eb('0x4c')]['id']){delete _0x30062e[_0x85eb('0x4c')]['id'];}return db['VoiceMail'][_0x85eb('0x4b')]({'where':{'id':_0x30062e['params']['id']}})[_0x85eb('0x26')](handleEntityNotFound(_0x270bb2,null))[_0x85eb('0x26')](saveUpdates(_0x30062e['body'],null))[_0x85eb('0x26')](respondWithResult(_0x270bb2,null))[_0x85eb('0x47')](handleError(_0x270bb2,null));};exports[_0x85eb('0x25')]=function(_0x26e04a,_0x214ef7){return db[_0x85eb('0x44')]['find']({'where':{'id':_0x26e04a[_0x85eb('0x49')]['id']}})['then'](handleEntityNotFound(_0x214ef7,null))[_0x85eb('0x26')](removeEntity(_0x214ef7,null))[_0x85eb('0x47')](handleError(_0x214ef7,null));};exports['getMessages']=function(_0x152452,_0x2a0f8b,_0x4a3af9){return db[_0x85eb('0x44')]['findOne']({'where':{'id':_0x152452[_0x85eb('0x49')]['id']}})[_0x85eb('0x26')](handleEntityNotFound(_0x2a0f8b,null))[_0x85eb('0x26')](function(_0x13c0b3){var _0x45a201;var _0x15d4a7={},_0x5a729e={};_0x5a729e[_0x85eb('0x33')]=_[_0x85eb('0x35')](db[_0x85eb('0x54')][_0x85eb('0x30')]);_0x5a729e[_0x85eb('0x34')]=_[_0x85eb('0x35')](_0x152452[_0x85eb('0x34')]);_0x5a729e[_0x85eb('0x36')]=_[_0x85eb('0x37')](_0x5a729e[_0x85eb('0x33')],_0x5a729e[_0x85eb('0x34')]);_0x15d4a7['attributes']=_[_0x85eb('0x37')](_0x5a729e[_0x85eb('0x33')],qs[_0x85eb('0x39')](_0x152452[_0x85eb('0x34')][_0x85eb('0x39')]));_0x15d4a7[_0x85eb('0x38')]=_0x15d4a7['attributes'][_0x85eb('0x3a')]?_0x15d4a7['attributes']:_0x5a729e[_0x85eb('0x33')];if(!_0x152452[_0x85eb('0x34')][_0x85eb('0x3b')](_0x85eb('0x3c'))){_0x15d4a7[_0x85eb('0x1e')]=qs['limit'](_0x152452[_0x85eb('0x34')][_0x85eb('0x1e')]);_0x15d4a7[_0x85eb('0x1c')]=qs[_0x85eb('0x1c')](_0x152452[_0x85eb('0x34')][_0x85eb('0x1c')]);}_0x15d4a7[_0x85eb('0x3d')]=qs[_0x85eb('0x3e')](_0x152452['query'][_0x85eb('0x3e')]);_0x15d4a7['where']=qs[_0x85eb('0x36')](_[_0x85eb('0x55')](_0x152452[_0x85eb('0x34')],_0x5a729e[_0x85eb('0x36')]));if(_0x152452[_0x85eb('0x34')]['filter']){_0x15d4a7[_0x85eb('0x3f')]=_[_0x85eb('0x40')](_0x15d4a7[_0x85eb('0x3f')],{'$or':_[_0x85eb('0x2f')](_0x15d4a7[_0x85eb('0x38')],function(_0x419b24){var _0x562ffa={};_0x562ffa[_0x419b24]={'$like':'%'+_0x152452['query'][_0x85eb('0x56')]+'%'};return _0x562ffa;})});}_0x15d4a7['where']=_[_0x85eb('0x40')](_0x15d4a7[_0x85eb('0x3f')],{'mailboxuser':_0x13c0b3[_0x85eb('0x57')]});_0x15d4a7=_[_0x85eb('0x40')]({},_0x15d4a7,_0x152452[_0x85eb('0x4a')]);return db[_0x85eb('0x54')]['findAndCountAll'](_0x15d4a7)[_0x85eb('0x26')](respondWithFilteredResult(_0x2a0f8b,_0x15d4a7));})[_0x85eb('0x47')](handleError(_0x2a0f8b,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 6b4018e..2fef8e4 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 _0xe1f8=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','VoiceMail','context'];(function(_0x5206cc,_0xaae8a3){var _0x350b42=function(_0x4748bc){while(--_0x4748bc){_0x5206cc['push'](_0x5206cc['shift']());}};_0x350b42(++_0xaae8a3);}(_0xe1f8,0x9a));var _0x8e1f=function(_0x139c03,_0x40e439){_0x139c03=_0x139c03-0x0;var _0x365d17=_0xe1f8[_0x139c03];return _0x365d17;};'use strict';var _=require(_0x8e1f('0x0'));var util=require(_0x8e1f('0x1'));var logger=require(_0x8e1f('0x2'))(_0x8e1f('0x3'));var moment=require(_0x8e1f('0x4'));var BPromise=require(_0x8e1f('0x5'));var rp=require(_0x8e1f('0x6'));var fs=require('fs');var path=require(_0x8e1f('0x7'));var rimraf=require(_0x8e1f('0x8'));var config=require(_0x8e1f('0x9'));var attributes=require('./voiceMail.attributes');module[_0x8e1f('0xa')]=function(_0x1bde19,_0x421a61){return _0x1bde19[_0x8e1f('0xb')](_0x8e1f('0xc'),attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':'mailbox_context','fields':['mailbox',_0x8e1f('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4a6e=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceMail.attributes','exports','VoiceMail','voice_voicemail','mailbox','context'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0x4a6e,0xc3));var _0xe4a6=function(_0x11e30d,_0x5584aa){_0x11e30d=_0x11e30d-0x0;var _0x2d4e29=_0x4a6e[_0x11e30d];return _0x2d4e29;};'use strict';var _=require(_0xe4a6('0x0'));var util=require(_0xe4a6('0x1'));var logger=require(_0xe4a6('0x2'))(_0xe4a6('0x3'));var moment=require(_0xe4a6('0x4'));var BPromise=require(_0xe4a6('0x5'));var rp=require(_0xe4a6('0x6'));var fs=require('fs');var path=require(_0xe4a6('0x7'));var rimraf=require(_0xe4a6('0x8'));var config=require('../../config/environment');var attributes=require(_0xe4a6('0x9'));module[_0xe4a6('0xa')]=function(_0xca4451,_0x8f782e){return _0xca4451['define'](_0xe4a6('0xb'),attributes,{'tableName':_0xe4a6('0xc'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':[_0xe4a6('0xd'),_0xe4a6('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 29c3a9c..aa53cd2 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 _0x34f0=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','catch','lodash','util'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x34f0,0x166));var _0x034f=function(_0x313534,_0x29a409){_0x313534=_0x313534-0x0;var _0x4962b6=_0x34f0[_0x313534];return _0x4962b6;};'use strict';var _=require(_0x034f('0x0'));var util=require(_0x034f('0x1'));var moment=require('moment');var BPromise=require(_0x034f('0x2'));var rs=require(_0x034f('0x3'));var fs=require('fs');var Redis=require(_0x034f('0x4'));var db=require(_0x034f('0x5'))['db'];var utils=require(_0x034f('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x034f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x034f('0x8')][_0x034f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x44fcf9,_0x52aa39,_0x41e401){return new BPromise(function(_0x4ef0bc,_0x117cea){return client[_0x034f('0xa')](_0x44fcf9,_0x41e401)['then'](function(_0x3c05f2){logger[_0x034f('0xb')](_0x034f('0xc'),_0x52aa39,_0x034f('0xd'));logger[_0x034f('0xe')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x52aa39,_0x034f('0xd'),JSON[_0x034f('0xf')](_0x3c05f2));if(_0x3c05f2['error']){if(_0x3c05f2['error'][_0x034f('0x10')]===0x1f4){logger['error']('VoiceMail,\x20%s,\x20%s',_0x52aa39,_0x3c05f2[_0x034f('0x11')][_0x034f('0x12')]);return _0x117cea(_0x3c05f2[_0x034f('0x11')][_0x034f('0x12')]);}logger[_0x034f('0x11')]('VoiceMail,\x20%s,\x20%s',_0x52aa39,_0x3c05f2[_0x034f('0x11')]['message']);return _0x4ef0bc(_0x3c05f2[_0x034f('0x11')][_0x034f('0x12')]);}else{logger[_0x034f('0xb')](_0x034f('0xc'),_0x52aa39,_0x034f('0xd'));_0x4ef0bc(_0x3c05f2['result']['message']);}})[_0x034f('0x13')](function(_0x1e9c72){logger[_0x034f('0x11')](_0x034f('0xc'),_0x52aa39,_0x1e9c72);_0x117cea(_0x1e9c72);});});} \ No newline at end of file +var _0xe24e=['request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','VoiceMail,\x20%s,\x20%s,\x20%s','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x43d54f,_0x3fd819){var _0x39e3f4=function(_0x33ad8f){while(--_0x33ad8f){_0x43d54f['push'](_0x43d54f['shift']());}};_0x39e3f4(++_0x3fd819);}(_0xe24e,0x122));var _0xee24=function(_0x71e493,_0x4308b7){_0x71e493=_0x71e493-0x0;var _0x3d40ab=_0xe24e[_0x71e493];return _0x3d40ab;};'use strict';var _=require('lodash');var util=require(_0xee24('0x0'));var moment=require(_0xee24('0x1'));var BPromise=require(_0xee24('0x2'));var rs=require(_0xee24('0x3'));var fs=require('fs');var Redis=require(_0xee24('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xee24('0x5'));var logger=require(_0xee24('0x6'))(_0xee24('0x7'));var config=require(_0xee24('0x8'));var jayson=require(_0xee24('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x45e440,_0x43e31e,_0x52ed80){return new BPromise(function(_0x5bcae9,_0x148f20){return client[_0xee24('0xa')](_0x45e440,_0x52ed80)[_0xee24('0xb')](function(_0x24fe63){logger[_0xee24('0xc')](_0xee24('0xd'),_0x43e31e,_0xee24('0xe'));logger['debug'](_0xee24('0xf'),_0x43e31e,_0xee24('0xe'),JSON['stringify'](_0x24fe63));if(_0x24fe63['error']){if(_0x24fe63[_0xee24('0x10')][_0xee24('0x11')]===0x1f4){logger[_0xee24('0x10')](_0xee24('0xd'),_0x43e31e,_0x24fe63[_0xee24('0x10')][_0xee24('0x12')]);return _0x148f20(_0x24fe63[_0xee24('0x10')][_0xee24('0x12')]);}logger['error'](_0xee24('0xd'),_0x43e31e,_0x24fe63[_0xee24('0x10')]['message']);return _0x5bcae9(_0x24fe63[_0xee24('0x10')][_0xee24('0x12')]);}else{logger[_0xee24('0xc')]('VoiceMail,\x20%s,\x20%s',_0x43e31e,_0xee24('0xe'));_0x5bcae9(_0x24fe63[_0xee24('0x13')][_0xee24('0x12')]);}})['catch'](function(_0x21cf0f){logger[_0xee24('0x10')](_0xee24('0xd'),_0x43e31e,_0x21cf0f);_0x148f20(_0x21cf0f);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index ef775ab..1a67fd4 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 _0x1119=['index','/:id','show','create','put','delete','destroy','exports','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1119,0x148));var _0x9111=function(_0x3d6bab,_0x3242db){_0x3d6bab=_0x3d6bab-0x0;var _0x348415=_0x1119[_0x3d6bab];return _0x348415;};'use strict';var multer=require('multer');var util=require(_0x9111('0x0'));var path=require('path');var timeout=require(_0x9111('0x1'));var express=require('express');var router=express[_0x9111('0x2')]();var fs_extra=require(_0x9111('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x9111('0x4'));var config=require(_0x9111('0x5'));var controller=require('./voiceMailMessage.controller');router[_0x9111('0x6')]('/',auth[_0x9111('0x7')](),controller[_0x9111('0x8')]);router[_0x9111('0x6')](_0x9111('0x9'),auth[_0x9111('0x7')](),controller[_0x9111('0xa')]);router[_0x9111('0x6')]('/:id/download',auth[_0x9111('0x7')](),controller['download']);router['post']('/',auth['isAuthenticated'](),controller[_0x9111('0xb')]);router[_0x9111('0xc')](_0x9111('0x9'),auth[_0x9111('0x7')](),controller['update']);router[_0x9111('0xd')](_0x9111('0x9'),auth[_0x9111('0x7')](),controller[_0x9111('0xe')]);module[_0x9111('0xf')]=router; \ No newline at end of file +var _0x6bdb=['post','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','isAuthenticated','index','get','show','/:id/download'];(function(_0x5cf584,_0x59990d){var _0x163e63=function(_0x5d73ee){while(--_0x5d73ee){_0x5cf584['push'](_0x5cf584['shift']());}};_0x163e63(++_0x59990d);}(_0x6bdb,0x11e));var _0xb6bd=function(_0x1dd05f,_0x50591e){_0x1dd05f=_0x1dd05f-0x0;var _0x8ed2ba=_0x6bdb[_0x1dd05f];return _0x8ed2ba;};'use strict';var multer=require(_0xb6bd('0x0'));var util=require(_0xb6bd('0x1'));var path=require(_0xb6bd('0x2'));var timeout=require(_0xb6bd('0x3'));var express=require('express');var router=express[_0xb6bd('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb6bd('0x5'));var interaction=require(_0xb6bd('0x6'));var config=require(_0xb6bd('0x7'));var controller=require(_0xb6bd('0x8'));router['get']('/',auth[_0xb6bd('0x9')](),controller[_0xb6bd('0xa')]);router[_0xb6bd('0xb')]('/:id',auth[_0xb6bd('0x9')](),controller[_0xb6bd('0xc')]);router[_0xb6bd('0xb')](_0xb6bd('0xd'),auth[_0xb6bd('0x9')](),controller['download']);router[_0xb6bd('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xb6bd('0xf')](_0xb6bd('0x10'),auth[_0xb6bd('0x9')](),controller[_0xb6bd('0x11')]);router['delete'](_0xb6bd('0x10'),auth[_0xb6bd('0x9')](),controller[_0xb6bd('0x12')]);module[_0xb6bd('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 0eb069f..015eb04 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 _0xaf2b=['exports','getDataValue','STRING','long','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize'];(function(_0x5517c0,_0x358609){var _0x33803b=function(_0x513c18){while(--_0x513c18){_0x5517c0['push'](_0x5517c0['shift']());}};_0x33803b(++_0x358609);}(_0xaf2b,0x197));var _0xbaf2=function(_0x4fcd97,_0x4e553c){_0x4fcd97=_0x4fcd97-0x0;var _0x439b10=_0xaf2b[_0x4fcd97];return _0x439b10;};'use strict';var Sequelize=require(_0xbaf2('0x0'));module[_0xbaf2('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x14d8f6){return this[_0xbaf2('0x2')]('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xbaf2('0x3')],'defaultValue':''},'context':{'type':Sequelize[_0xbaf2('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xbaf2('0x3')],'defaultValue':''},'callerid':{'type':Sequelize[_0xbaf2('0x3')],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize[_0xbaf2('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xbaf2('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xbaf2('0x3')],'defaultValue':''},'recording':{'type':Sequelize['BLOB'](_0xbaf2('0x4')),'defaultValue':null},'flag':{'type':Sequelize[_0xbaf2('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0xbaf2('0x5'),'defaultValue':Sequelize[_0xbaf2('0x6')](_0xbaf2('0x7'))}}; \ No newline at end of file +var _0x7ad1=['INTEGER','STRING','BLOB','long','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','VIRTUAL'];(function(_0xbf956e,_0x2055fe){var _0x28f3bd=function(_0x5a9403){while(--_0x5a9403){_0xbf956e['push'](_0xbf956e['shift']());}};_0x28f3bd(++_0x2055fe);}(_0x7ad1,0x1d3));var _0x17ad=function(_0x1abd0c,_0x2ed5cf){_0x1abd0c=_0x1abd0c-0x0;var _0x3ece6c=_0x7ad1[_0x1abd0c];return _0x3ece6c;};'use strict';var Sequelize=require(_0x17ad('0x0'));module[_0x17ad('0x1')]={'name':{'type':Sequelize[_0x17ad('0x2')],'get':function(_0x3c486a){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize[_0x17ad('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x17ad('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0x17ad('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x17ad('0x4')],'defaultValue':''},'callerid':{'type':Sequelize[_0x17ad('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0x17ad('0x4')],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x17ad('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x17ad('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0x17ad('0x5')](_0x17ad('0x6')),'defaultValue':null},'flag':{'type':Sequelize[_0x17ad('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0x17ad('0x7'),'defaultValue':Sequelize[_0x17ad('0x8')](_0x17ad('0x9'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 2604d96..1829f06 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 _0xdd81=['Sequelize','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','.wav\x22','send','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filters','filter','where','VIRTUAL','merge','options','VoiceMailMessage','include','findAll','show','includeAll','find','catch','create','body','params','download','recording','msg_id'];(function(_0x50b498,_0x218035){var _0xba90d7=function(_0x50a43d){while(--_0x50a43d){_0x50b498['push'](_0x50b498['shift']());}};_0xba90d7(++_0x218035);}(_0xdd81,0x16f));var _0x1dd8=function(_0x474e22,_0x2c6e4c){_0x474e22=_0x474e22-0x0;var _0x38de4e=_0xdd81[_0x474e22];return _0x38de4e;};'use strict';var emlformat=require(_0x1dd8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1dd8('0x1'));var jsonpatch=require(_0x1dd8('0x2'));var rp=require(_0x1dd8('0x3'));var moment=require(_0x1dd8('0x4'));var BPromise=require(_0x1dd8('0x5'));var Mustache=require(_0x1dd8('0x6'));var util=require(_0x1dd8('0x7'));var path=require(_0x1dd8('0x8'));var sox=require('sox');var csv=require(_0x1dd8('0x9'));var ejs=require(_0x1dd8('0xa'));var fs=require('fs');var fs_extra=require(_0x1dd8('0xb'));var _=require(_0x1dd8('0xc'));var squel=require(_0x1dd8('0xd'));var crypto=require(_0x1dd8('0xe'));var jsforce=require(_0x1dd8('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x1dd8('0x9'));var querystring=require(_0x1dd8('0x10'));var Papa=require(_0x1dd8('0x11'));var Redis=require('ioredis');var authService=require(_0x1dd8('0x12'));var qs=require(_0x1dd8('0x13'));var as=require(_0x1dd8('0x14'));var hardwareService=require(_0x1dd8('0x15'));var logger=require('../../config/logger')(_0x1dd8('0x16'));var utils=require(_0x1dd8('0x17'));var config=require(_0x1dd8('0x18'));var licenseUtil=require(_0x1dd8('0x19'));var db=require(_0x1dd8('0x1a'))['db'];function respondWithStatusCode(_0x3d8096,_0x2565c5){_0x2565c5=_0x2565c5||0xcc;return function(_0x36cc61){if(_0x36cc61){return _0x3d8096[_0x1dd8('0x1b')](_0x2565c5);}return _0x3d8096['status'](_0x2565c5)[_0x1dd8('0x1c')]();};}function respondWithResult(_0xad28d7,_0x2cc7d6){_0x2cc7d6=_0x2cc7d6||0xc8;return function(_0x57a91d){if(_0x57a91d){return _0xad28d7['status'](_0x2cc7d6)[_0x1dd8('0x1d')](_0x57a91d);}};}function respondWithFilteredResult(_0x32f96b,_0xb15b9f){return function(_0x5e9811){if(_0x5e9811){var _0x318c47=typeof _0xb15b9f[_0x1dd8('0x1e')]===_0x1dd8('0x1f')&&typeof _0xb15b9f[_0x1dd8('0x20')]==='undefined';var _0x4269d4=_0x5e9811[_0x1dd8('0x21')];var _0x416967=_0x318c47?0x0:_0xb15b9f[_0x1dd8('0x1e')];var _0x296b8c=_0x318c47?_0x5e9811[_0x1dd8('0x21')]:_0xb15b9f[_0x1dd8('0x1e')]+_0xb15b9f[_0x1dd8('0x20')];var _0x55c55d;if(_0x296b8c>=_0x4269d4){_0x296b8c=_0x4269d4;_0x55c55d=0xc8;}else{_0x55c55d=0xce;}_0x32f96b[_0x1dd8('0x22')](_0x55c55d);return _0x32f96b[_0x1dd8('0x23')](_0x1dd8('0x24'),_0x416967+'-'+_0x296b8c+'/'+_0x4269d4)['json'](_0x5e9811);}return null;};}function patchUpdates(_0x3b7014){return function(_0x444c78){try{jsonpatch[_0x1dd8('0x25')](_0x444c78,_0x3b7014,!![]);}catch(_0x4de55c){return BPromise[_0x1dd8('0x26')](_0x4de55c);}return _0x444c78[_0x1dd8('0x27')]();};}function saveUpdates(_0x262f4c,_0x5c7fb2){return function(_0x694fa8){if(_0x694fa8){return _0x694fa8[_0x1dd8('0x28')](_0x262f4c)['then'](function(_0x47e1a2){return _0x47e1a2;});}return null;};}function removeEntity(_0x41af9b,_0x402f06){return function(_0x328555){if(_0x328555){return _0x328555[_0x1dd8('0x29')]()[_0x1dd8('0x2a')](function(){_0x41af9b[_0x1dd8('0x22')](0xcc)[_0x1dd8('0x1c')]();});}};}function handleEntityNotFound(_0x52ecc0,_0x2ce056){return function(_0x5fe470){if(!_0x5fe470){_0x52ecc0[_0x1dd8('0x1b')](0x194);}return _0x5fe470;};}function handleError(_0x5e7203,_0xb776c8){_0xb776c8=_0xb776c8||0x1f4;return function(_0x3b2ea8){logger[_0x1dd8('0x2b')](_0x3b2ea8[_0x1dd8('0x2c')]);if(_0x3b2ea8[_0x1dd8('0x2d')]){delete _0x3b2ea8[_0x1dd8('0x2d')];}_0x5e7203[_0x1dd8('0x22')](_0xb776c8)['send'](_0x3b2ea8);};}exports[_0x1dd8('0x2e')]=function(_0x50eb15,_0x7db011){var _0x3967f0={},_0x517d0b={},_0x2c4b1a={'count':0x0,'rows':[]};var _0x50b214=_[_0x1dd8('0x2f')](db['VoiceMailMessage'][_0x1dd8('0x30')],function(_0x450a50){return{'name':_0x450a50[_0x1dd8('0x31')],'type':_0x450a50[_0x1dd8('0x32')][_0x1dd8('0x33')]};});_0x517d0b[_0x1dd8('0x34')]=_['differenceBy'](_[_0x1dd8('0x2f')](_0x50b214,'name'),[_0x1dd8('0x2d')]);_0x517d0b['query']=_[_0x1dd8('0x35')](_0x50eb15[_0x1dd8('0x36')]);_0x517d0b['filters']=_[_0x1dd8('0x37')](_0x517d0b['model'],_0x517d0b['query']);_0x3967f0[_0x1dd8('0x38')]=_[_0x1dd8('0x37')](_0x517d0b['model'],qs['fields'](_0x50eb15[_0x1dd8('0x36')][_0x1dd8('0x39')]));_0x3967f0['attributes']=_0x3967f0[_0x1dd8('0x38')][_0x1dd8('0x3a')]?_0x3967f0['attributes']:_0x517d0b[_0x1dd8('0x34')];if(!_0x50eb15[_0x1dd8('0x36')][_0x1dd8('0x3b')](_0x1dd8('0x3c'))){_0x3967f0[_0x1dd8('0x20')]=qs[_0x1dd8('0x20')](_0x50eb15[_0x1dd8('0x36')]['limit']);_0x3967f0['offset']=qs[_0x1dd8('0x1e')](_0x50eb15[_0x1dd8('0x36')]['offset']);}_0x3967f0[_0x1dd8('0x3d')]=qs[_0x1dd8('0x3e')](_0x50eb15[_0x1dd8('0x36')]['sort']);_0x3967f0['where']=qs['filters'](_[_0x1dd8('0x3f')](_0x50eb15[_0x1dd8('0x36')],_0x517d0b[_0x1dd8('0x40')]),_0x50b214);if(_0x50eb15[_0x1dd8('0x36')][_0x1dd8('0x41')]){_0x3967f0[_0x1dd8('0x42')]=_['merge'](_0x3967f0[_0x1dd8('0x42')],{'$or':_[_0x1dd8('0x2f')](_0x50b214,function(_0x2d5204){if(_0x2d5204[_0x1dd8('0x32')]!==_0x1dd8('0x43')){var _0x2f9827={};_0x2f9827[_0x2d5204[_0x1dd8('0x2d')]]={'$like':'%'+_0x50eb15[_0x1dd8('0x36')][_0x1dd8('0x41')]+'%'};return _0x2f9827;}})});}_0x3967f0=_[_0x1dd8('0x44')]({},_0x3967f0,_0x50eb15[_0x1dd8('0x45')]);var _0x16b011={'where':_0x3967f0[_0x1dd8('0x42')]};return db[_0x1dd8('0x46')][_0x1dd8('0x21')](_0x16b011)[_0x1dd8('0x2a')](function(_0x3771b5){_0x2c4b1a['count']=_0x3771b5;if(_0x50eb15[_0x1dd8('0x36')]['includeAll']){_0x3967f0[_0x1dd8('0x47')]=[{'all':!![]}];}return db['VoiceMailMessage'][_0x1dd8('0x48')](_0x3967f0);})[_0x1dd8('0x2a')](function(_0x5dfa2e){_0x2c4b1a['rows']=_0x5dfa2e;return _0x2c4b1a;})[_0x1dd8('0x2a')](respondWithFilteredResult(_0x7db011,_0x3967f0))['catch'](handleError(_0x7db011,null));};exports[_0x1dd8('0x49')]=function(_0x29ebc7,_0x25fd95){var _0x604cc4={'raw':!![],'where':{'id':_0x29ebc7['params']['id']}},_0x8108b={};_0x8108b[_0x1dd8('0x34')]=_['keys'](db[_0x1dd8('0x46')]['rawAttributes']);_0x8108b['query']=_[_0x1dd8('0x35')](_0x29ebc7[_0x1dd8('0x36')]);_0x8108b[_0x1dd8('0x40')]=_[_0x1dd8('0x37')](_0x8108b[_0x1dd8('0x34')],_0x8108b['query']);_0x604cc4[_0x1dd8('0x38')]=_['intersection'](_0x8108b['model'],qs[_0x1dd8('0x39')](_0x29ebc7[_0x1dd8('0x36')]['fields']));_0x604cc4['attributes']=_0x604cc4['attributes'][_0x1dd8('0x3a')]?_0x604cc4[_0x1dd8('0x38')]:_0x8108b[_0x1dd8('0x34')];if(_0x29ebc7[_0x1dd8('0x36')][_0x1dd8('0x4a')]){_0x604cc4[_0x1dd8('0x47')]=[{'all':!![]}];}_0x604cc4=_[_0x1dd8('0x44')]({},_0x604cc4,_0x29ebc7['options']);return db[_0x1dd8('0x46')][_0x1dd8('0x4b')](_0x604cc4)['then'](handleEntityNotFound(_0x25fd95,null))['then'](respondWithResult(_0x25fd95,null))[_0x1dd8('0x4c')](handleError(_0x25fd95,null));};exports[_0x1dd8('0x4d')]=function(_0x46941b,_0x256113){return db[_0x1dd8('0x46')][_0x1dd8('0x4d')](_0x46941b[_0x1dd8('0x4e')],{})['then'](respondWithResult(_0x256113,0xc9))[_0x1dd8('0x4c')](handleError(_0x256113,null));};exports['update']=function(_0x980a96,_0x51478b){if(_0x980a96['body']['id']){delete _0x980a96[_0x1dd8('0x4e')]['id'];}return db[_0x1dd8('0x46')][_0x1dd8('0x4b')]({'where':{'id':_0x980a96[_0x1dd8('0x4f')]['id']}})[_0x1dd8('0x2a')](handleEntityNotFound(_0x51478b,null))[_0x1dd8('0x2a')](saveUpdates(_0x980a96[_0x1dd8('0x4e')],null))[_0x1dd8('0x2a')](respondWithResult(_0x51478b,null))[_0x1dd8('0x4c')](handleError(_0x51478b,null));};exports[_0x1dd8('0x29')]=function(_0x481227,_0x561c58){return db['VoiceMailMessage'][_0x1dd8('0x4b')]({'where':{'id':_0x481227[_0x1dd8('0x4f')]['id']}})['then'](handleEntityNotFound(_0x561c58,null))[_0x1dd8('0x2a')](removeEntity(_0x561c58,null))[_0x1dd8('0x4c')](handleError(_0x561c58,null));};exports[_0x1dd8('0x50')]=function(_0x4d41c1,_0x3d0fd7,_0x330c23){return db[_0x1dd8('0x46')][_0x1dd8('0x4b')]({'where':{'id':_0x4d41c1[_0x1dd8('0x4f')]['id']},'attributes':['id',_0x1dd8('0x51'),_0x1dd8('0x52')]})['then'](handleEntityNotFound(_0x3d0fd7,null))[_0x1dd8('0x2a')](function(_0x2e0405){if(_0x2e0405){if(!_0x2e0405[_0x1dd8('0x51')]){throw new db[(_0x1dd8('0x53'))]['ValidationError'](_0x1dd8('0x54'));}var _0x1632ce={'Content-Type':_0x1dd8('0x55'),'Content-Disposition':_0x1dd8('0x56')};if(_0x2e0405['msg_id']){_0x1632ce[_0x1dd8('0x57')]='attachment;\x20filename=\x22'+_0x2e0405['msg_id']+_0x1dd8('0x58');}_0x3d0fd7[_0x1dd8('0x23')](_0x1632ce);return _0x3d0fd7[_0x1dd8('0x59')](new Buffer(_0x2e0405['recording']));}})['catch'](handleError(_0x3d0fd7,null));}; \ No newline at end of file +var _0xe8af=['update','then','destroy','end','error','stack','name','send','index','map','VoiceMailMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','includeAll','include','findAll','rows','catch','show','options','find','create','body','params','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','Content-Disposition','.wav\x22','eml-format','rimraf','fast-json-patch','moment','mustache','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save'];(function(_0x55b5fa,_0xb6b7ee){var _0x10a6c2=function(_0x28ac66){while(--_0x28ac66){_0x55b5fa['push'](_0x55b5fa['shift']());}};_0x10a6c2(++_0xb6b7ee);}(_0xe8af,0xd9));var _0xfe8a=function(_0x18afca,_0x4219d9){_0x18afca=_0x18afca-0x0;var _0x11603f=_0xe8af[_0x18afca];return _0x11603f;};'use strict';var emlformat=require(_0xfe8a('0x0'));var rimraf=require(_0xfe8a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfe8a('0x2'));var rp=require('request-promise');var moment=require(_0xfe8a('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xfe8a('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xfe8a('0x5'));var fs=require('fs');var fs_extra=require(_0xfe8a('0x6'));var _=require(_0xfe8a('0x7'));var squel=require(_0xfe8a('0x8'));var crypto=require(_0xfe8a('0x9'));var jsforce=require(_0xfe8a('0xa'));var deskjs=require(_0xfe8a('0xb'));var toCsv=require(_0xfe8a('0xc'));var querystring=require(_0xfe8a('0xd'));var Papa=require(_0xfe8a('0xe'));var Redis=require(_0xfe8a('0xf'));var authService=require(_0xfe8a('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xfe8a('0x11'));var hardwareService=require(_0xfe8a('0x12'));var logger=require(_0xfe8a('0x13'))(_0xfe8a('0x14'));var utils=require(_0xfe8a('0x15'));var config=require(_0xfe8a('0x16'));var licenseUtil=require(_0xfe8a('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1f7a35,_0x325254){_0x325254=_0x325254||0xcc;return function(_0x2acecf){if(_0x2acecf){return _0x1f7a35[_0xfe8a('0x18')](_0x325254);}return _0x1f7a35[_0xfe8a('0x19')](_0x325254)['end']();};}function respondWithResult(_0x45eaab,_0xaf00){_0xaf00=_0xaf00||0xc8;return function(_0x44f8c7){if(_0x44f8c7){return _0x45eaab['status'](_0xaf00)[_0xfe8a('0x1a')](_0x44f8c7);}};}function respondWithFilteredResult(_0x461908,_0x3a6d4f){return function(_0x35e19e){if(_0x35e19e){var _0x55897a=typeof _0x3a6d4f[_0xfe8a('0x1b')]===_0xfe8a('0x1c')&&typeof _0x3a6d4f[_0xfe8a('0x1d')]===_0xfe8a('0x1c');var _0x291661=_0x35e19e['count'];var _0x3d3a61=_0x55897a?0x0:_0x3a6d4f['offset'];var _0x25f3cd=_0x55897a?_0x35e19e[_0xfe8a('0x1e')]:_0x3a6d4f[_0xfe8a('0x1b')]+_0x3a6d4f[_0xfe8a('0x1d')];var _0xf06cc8;if(_0x25f3cd>=_0x291661){_0x25f3cd=_0x291661;_0xf06cc8=0xc8;}else{_0xf06cc8=0xce;}_0x461908['status'](_0xf06cc8);return _0x461908[_0xfe8a('0x1f')](_0xfe8a('0x20'),_0x3d3a61+'-'+_0x25f3cd+'/'+_0x291661)['json'](_0x35e19e);}return null;};}function patchUpdates(_0x3e1996){return function(_0xcfd773){try{jsonpatch['apply'](_0xcfd773,_0x3e1996,!![]);}catch(_0x5aa534){return BPromise[_0xfe8a('0x21')](_0x5aa534);}return _0xcfd773[_0xfe8a('0x22')]();};}function saveUpdates(_0x77e1b5,_0x335692){return function(_0x27878f){if(_0x27878f){return _0x27878f[_0xfe8a('0x23')](_0x77e1b5)[_0xfe8a('0x24')](function(_0x32ea7f){return _0x32ea7f;});}return null;};}function removeEntity(_0x146221,_0xce6572){return function(_0x535dc9){if(_0x535dc9){return _0x535dc9[_0xfe8a('0x25')]()[_0xfe8a('0x24')](function(){_0x146221[_0xfe8a('0x19')](0xcc)[_0xfe8a('0x26')]();});}};}function handleEntityNotFound(_0x645df3,_0x216779){return function(_0xb3c51e){if(!_0xb3c51e){_0x645df3[_0xfe8a('0x18')](0x194);}return _0xb3c51e;};}function handleError(_0x1bad6a,_0x10516a){_0x10516a=_0x10516a||0x1f4;return function(_0xa9217c){logger[_0xfe8a('0x27')](_0xa9217c[_0xfe8a('0x28')]);if(_0xa9217c[_0xfe8a('0x29')]){delete _0xa9217c['name'];}_0x1bad6a['status'](_0x10516a)[_0xfe8a('0x2a')](_0xa9217c);};}exports[_0xfe8a('0x2b')]=function(_0x443d6f,_0x117d48){var _0x2d50aa={},_0x240fa5={},_0x5eefb0={'count':0x0,'rows':[]};var _0xd73eeb=_[_0xfe8a('0x2c')](db[_0xfe8a('0x2d')][_0xfe8a('0x2e')],function(_0xb81cba){return{'name':_0xb81cba[_0xfe8a('0x2f')],'type':_0xb81cba[_0xfe8a('0x30')][_0xfe8a('0x31')]};});_0x240fa5[_0xfe8a('0x32')]=_['differenceBy'](_[_0xfe8a('0x2c')](_0xd73eeb,_0xfe8a('0x29')),[_0xfe8a('0x29')]);_0x240fa5[_0xfe8a('0x33')]=_[_0xfe8a('0x34')](_0x443d6f[_0xfe8a('0x33')]);_0x240fa5[_0xfe8a('0x35')]=_[_0xfe8a('0x36')](_0x240fa5[_0xfe8a('0x32')],_0x240fa5[_0xfe8a('0x33')]);_0x2d50aa[_0xfe8a('0x37')]=_[_0xfe8a('0x36')](_0x240fa5[_0xfe8a('0x32')],qs['fields'](_0x443d6f[_0xfe8a('0x33')][_0xfe8a('0x38')]));_0x2d50aa[_0xfe8a('0x37')]=_0x2d50aa['attributes'][_0xfe8a('0x39')]?_0x2d50aa[_0xfe8a('0x37')]:_0x240fa5[_0xfe8a('0x32')];if(!_0x443d6f[_0xfe8a('0x33')][_0xfe8a('0x3a')](_0xfe8a('0x3b'))){_0x2d50aa[_0xfe8a('0x1d')]=qs[_0xfe8a('0x1d')](_0x443d6f[_0xfe8a('0x33')]['limit']);_0x2d50aa[_0xfe8a('0x1b')]=qs[_0xfe8a('0x1b')](_0x443d6f[_0xfe8a('0x33')][_0xfe8a('0x1b')]);}_0x2d50aa[_0xfe8a('0x3c')]=qs['sort'](_0x443d6f[_0xfe8a('0x33')][_0xfe8a('0x3d')]);_0x2d50aa[_0xfe8a('0x3e')]=qs[_0xfe8a('0x35')](_['pick'](_0x443d6f[_0xfe8a('0x33')],_0x240fa5[_0xfe8a('0x35')]),_0xd73eeb);if(_0x443d6f[_0xfe8a('0x33')][_0xfe8a('0x3f')]){_0x2d50aa[_0xfe8a('0x3e')]=_[_0xfe8a('0x40')](_0x2d50aa[_0xfe8a('0x3e')],{'$or':_[_0xfe8a('0x2c')](_0xd73eeb,function(_0x21898d){if(_0x21898d[_0xfe8a('0x30')]!=='VIRTUAL'){var _0x5afd98={};_0x5afd98[_0x21898d[_0xfe8a('0x29')]]={'$like':'%'+_0x443d6f[_0xfe8a('0x33')][_0xfe8a('0x3f')]+'%'};return _0x5afd98;}})});}_0x2d50aa=_[_0xfe8a('0x40')]({},_0x2d50aa,_0x443d6f['options']);var _0x415c8a={'where':_0x2d50aa['where']};return db[_0xfe8a('0x2d')][_0xfe8a('0x1e')](_0x415c8a)[_0xfe8a('0x24')](function(_0x4b49c4){_0x5eefb0[_0xfe8a('0x1e')]=_0x4b49c4;if(_0x443d6f[_0xfe8a('0x33')][_0xfe8a('0x41')]){_0x2d50aa[_0xfe8a('0x42')]=[{'all':!![]}];}return db[_0xfe8a('0x2d')][_0xfe8a('0x43')](_0x2d50aa);})[_0xfe8a('0x24')](function(_0x254855){_0x5eefb0[_0xfe8a('0x44')]=_0x254855;return _0x5eefb0;})['then'](respondWithFilteredResult(_0x117d48,_0x2d50aa))[_0xfe8a('0x45')](handleError(_0x117d48,null));};exports[_0xfe8a('0x46')]=function(_0x4d9d29,_0x3ea4a2){var _0x15df9c={'raw':!![],'where':{'id':_0x4d9d29['params']['id']}},_0x35dc2f={};_0x35dc2f[_0xfe8a('0x32')]=_[_0xfe8a('0x34')](db['VoiceMailMessage'][_0xfe8a('0x2e')]);_0x35dc2f['query']=_[_0xfe8a('0x34')](_0x4d9d29[_0xfe8a('0x33')]);_0x35dc2f[_0xfe8a('0x35')]=_[_0xfe8a('0x36')](_0x35dc2f['model'],_0x35dc2f[_0xfe8a('0x33')]);_0x15df9c[_0xfe8a('0x37')]=_['intersection'](_0x35dc2f[_0xfe8a('0x32')],qs[_0xfe8a('0x38')](_0x4d9d29[_0xfe8a('0x33')][_0xfe8a('0x38')]));_0x15df9c[_0xfe8a('0x37')]=_0x15df9c[_0xfe8a('0x37')][_0xfe8a('0x39')]?_0x15df9c[_0xfe8a('0x37')]:_0x35dc2f[_0xfe8a('0x32')];if(_0x4d9d29[_0xfe8a('0x33')][_0xfe8a('0x41')]){_0x15df9c[_0xfe8a('0x42')]=[{'all':!![]}];}_0x15df9c=_['merge']({},_0x15df9c,_0x4d9d29[_0xfe8a('0x47')]);return db['VoiceMailMessage'][_0xfe8a('0x48')](_0x15df9c)['then'](handleEntityNotFound(_0x3ea4a2,null))[_0xfe8a('0x24')](respondWithResult(_0x3ea4a2,null))[_0xfe8a('0x45')](handleError(_0x3ea4a2,null));};exports[_0xfe8a('0x49')]=function(_0xc83c3e,_0x108d04){return db[_0xfe8a('0x2d')]['create'](_0xc83c3e['body'],{})[_0xfe8a('0x24')](respondWithResult(_0x108d04,0xc9))[_0xfe8a('0x45')](handleError(_0x108d04,null));};exports[_0xfe8a('0x23')]=function(_0x56aff6,_0x4cca70){if(_0x56aff6[_0xfe8a('0x4a')]['id']){delete _0x56aff6[_0xfe8a('0x4a')]['id'];}return db[_0xfe8a('0x2d')]['find']({'where':{'id':_0x56aff6[_0xfe8a('0x4b')]['id']}})[_0xfe8a('0x24')](handleEntityNotFound(_0x4cca70,null))['then'](saveUpdates(_0x56aff6[_0xfe8a('0x4a')],null))[_0xfe8a('0x24')](respondWithResult(_0x4cca70,null))[_0xfe8a('0x45')](handleError(_0x4cca70,null));};exports[_0xfe8a('0x25')]=function(_0x411660,_0x37d0f6){return db[_0xfe8a('0x2d')][_0xfe8a('0x48')]({'where':{'id':_0x411660[_0xfe8a('0x4b')]['id']}})['then'](handleEntityNotFound(_0x37d0f6,null))[_0xfe8a('0x24')](removeEntity(_0x37d0f6,null))[_0xfe8a('0x45')](handleError(_0x37d0f6,null));};exports['download']=function(_0xb96385,_0x482643,_0x1d3b60){return db[_0xfe8a('0x2d')][_0xfe8a('0x48')]({'where':{'id':_0xb96385[_0xfe8a('0x4b')]['id']},'attributes':['id',_0xfe8a('0x4c'),_0xfe8a('0x4d')]})['then'](handleEntityNotFound(_0x482643,null))[_0xfe8a('0x24')](function(_0x53c921){if(_0x53c921){if(!_0x53c921[_0xfe8a('0x4c')]){throw new db[(_0xfe8a('0x4e'))][(_0xfe8a('0x4f'))](_0xfe8a('0x50'));}var _0x44726d={'Content-Type':_0xfe8a('0x51'),'Content-Disposition':'attachment'};if(_0x53c921[_0xfe8a('0x4d')]){_0x44726d[_0xfe8a('0x52')]='attachment;\x20filename=\x22'+_0x53c921[_0xfe8a('0x4d')]+_0xfe8a('0x53');}_0x482643[_0xfe8a('0x1f')](_0x44726d);return _0x482643[_0xfe8a('0x2a')](new Buffer(_0x53c921[_0xfe8a('0x4c')]));}})['catch'](handleError(_0x482643,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index f2b7114..714db37 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 _0x1211=['../../config/environment','./voiceMailMessage.attributes','VoiceMailMessage','dir','lodash','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0xac75be,_0xde7b3f){var _0x4e7233=function(_0x45d4f2){while(--_0x45d4f2){_0xac75be['push'](_0xac75be['shift']());}};_0x4e7233(++_0xde7b3f);}(_0x1211,0xb8));var _0x1121=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x1211[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x1121('0x0'));var util=require('util');var logger=require(_0x1121('0x1'))('api');var moment=require(_0x1121('0x2'));var BPromise=require(_0x1121('0x3'));var rp=require(_0x1121('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1121('0x5'));var config=require(_0x1121('0x6'));var attributes=require(_0x1121('0x7'));module['exports']=function(_0x767961,_0x2c1056){return _0x767961['define'](_0x1121('0x8'),attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':_0x1121('0x9'),'fields':[_0x1121('0x9')]}],'timestamps':![]});}; \ No newline at end of file +var _0x6129=['define','VoiceMailMessage','dir','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMailMessage.attributes','exports'];(function(_0xda1e1c,_0x5f04bb){var _0x3c1ea8=function(_0x1b17e3){while(--_0x1b17e3){_0xda1e1c['push'](_0xda1e1c['shift']());}};_0x3c1ea8(++_0x5f04bb);}(_0x6129,0x199));var _0x9612=function(_0x6d310d,_0x40d88b){_0x6d310d=_0x6d310d-0x0;var _0x178161=_0x6129[_0x6d310d];return _0x178161;};'use strict';var _=require(_0x9612('0x0'));var util=require(_0x9612('0x1'));var logger=require(_0x9612('0x2'))(_0x9612('0x3'));var moment=require('moment');var BPromise=require(_0x9612('0x4'));var rp=require(_0x9612('0x5'));var fs=require('fs');var path=require(_0x9612('0x6'));var rimraf=require(_0x9612('0x7'));var config=require(_0x9612('0x8'));var attributes=require(_0x9612('0x9'));module[_0x9612('0xa')]=function(_0x303334,_0x341f28){return _0x303334[_0x9612('0xb')](_0x9612('0xc'),attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':_0x9612('0xd'),'fields':[_0x9612('0xd')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 1f1bb73..3d236d6 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 _0xa332=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','VoiceMailMessage,\x20%s,\x20%s','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','lodash'];(function(_0x5b9ca1,_0x40ecc9){var _0x5129bd=function(_0x57957d){while(--_0x57957d){_0x5b9ca1['push'](_0x5b9ca1['shift']());}};_0x5129bd(++_0x40ecc9);}(_0xa332,0x18b));var _0x2a33=function(_0x39ec3a,_0x50f377){_0x39ec3a=_0x39ec3a-0x0;var _0x5d8f6a=_0xa332[_0x39ec3a];return _0x5d8f6a;};'use strict';var _=require(_0x2a33('0x0'));var util=require(_0x2a33('0x1'));var moment=require(_0x2a33('0x2'));var BPromise=require('bluebird');var rs=require(_0x2a33('0x3'));var fs=require('fs');var Redis=require(_0x2a33('0x4'));var db=require(_0x2a33('0x5'))['db'];var utils=require(_0x2a33('0x6'));var logger=require(_0x2a33('0x7'))(_0x2a33('0x8'));var config=require(_0x2a33('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x2a33('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1ad391,_0x34a0b7,_0x5ec9ee){return new BPromise(function(_0x338b06,_0x107b82){return client['request'](_0x1ad391,_0x5ec9ee)[_0x2a33('0xb')](function(_0x4cf66d){logger['info'](_0x2a33('0xc'),_0x34a0b7,'request\x20sent');logger[_0x2a33('0xd')](_0x2a33('0xe'),_0x34a0b7,_0x2a33('0xf'),JSON[_0x2a33('0x10')](_0x4cf66d));if(_0x4cf66d[_0x2a33('0x11')]){if(_0x4cf66d[_0x2a33('0x11')][_0x2a33('0x12')]===0x1f4){logger['error'](_0x2a33('0xc'),_0x34a0b7,_0x4cf66d[_0x2a33('0x11')][_0x2a33('0x13')]);return _0x107b82(_0x4cf66d[_0x2a33('0x11')][_0x2a33('0x13')]);}logger[_0x2a33('0x11')](_0x2a33('0xc'),_0x34a0b7,_0x4cf66d[_0x2a33('0x11')][_0x2a33('0x13')]);return _0x338b06(_0x4cf66d[_0x2a33('0x11')][_0x2a33('0x13')]);}else{logger[_0x2a33('0x14')](_0x2a33('0xc'),_0x34a0b7,'request\x20sent');_0x338b06(_0x4cf66d['result']['message']);}})[_0x2a33('0x15')](function(_0x5df50a){logger[_0x2a33('0x11')](_0x2a33('0xc'),_0x34a0b7,_0x5df50a);_0x107b82(_0x5df50a);});});} \ No newline at end of file +var _0x459f=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','VoiceMailMessage,\x20%s,\x20%s','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','util','moment','bluebird','randomstring','ioredis'];(function(_0x817d9b,_0x3c37e3){var _0x2752e1=function(_0x2b434e){while(--_0x2b434e){_0x817d9b['push'](_0x817d9b['shift']());}};_0x2752e1(++_0x3c37e3);}(_0x459f,0x10c));var _0xf459=function(_0x8db2bc,_0x2f7d96){_0x8db2bc=_0x8db2bc-0x0;var _0x47312b=_0x459f[_0x8db2bc];return _0x47312b;};'use strict';var _=require('lodash');var util=require(_0xf459('0x0'));var moment=require(_0xf459('0x1'));var BPromise=require(_0xf459('0x2'));var rs=require(_0xf459('0x3'));var fs=require('fs');var Redis=require(_0xf459('0x4'));var db=require(_0xf459('0x5'))['db'];var utils=require(_0xf459('0x6'));var logger=require('../../config/logger')(_0xf459('0x7'));var config=require('../../config/environment');var jayson=require(_0xf459('0x8'));var client=jayson[_0xf459('0x9')][_0xf459('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3d0307,_0x21332f,_0x33cdef){return new BPromise(function(_0x2c84e4,_0x5c84cf){return client[_0xf459('0xb')](_0x3d0307,_0x33cdef)[_0xf459('0xc')](function(_0x6cc248){logger[_0xf459('0xd')](_0xf459('0xe'),_0x21332f,'request\x20sent');logger[_0xf459('0xf')](_0xf459('0x10'),_0x21332f,_0xf459('0x11'),JSON['stringify'](_0x6cc248));if(_0x6cc248[_0xf459('0x12')]){if(_0x6cc248[_0xf459('0x12')]['code']===0x1f4){logger[_0xf459('0x12')](_0xf459('0xe'),_0x21332f,_0x6cc248['error'][_0xf459('0x13')]);return _0x5c84cf(_0x6cc248[_0xf459('0x12')][_0xf459('0x13')]);}logger[_0xf459('0x12')]('VoiceMailMessage,\x20%s,\x20%s',_0x21332f,_0x6cc248['error'][_0xf459('0x13')]);return _0x2c84e4(_0x6cc248[_0xf459('0x12')][_0xf459('0x13')]);}else{logger[_0xf459('0xd')](_0xf459('0xe'),_0x21332f,_0xf459('0x11'));_0x2c84e4(_0x6cc248[_0xf459('0x14')][_0xf459('0x13')]);}})['catch'](function(_0x358c54){logger['error']('VoiceMailMessage,\x20%s,\x20%s',_0x21332f,_0x358c54);_0x5c84cf(_0x358c54);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index d4386f8..89b5809 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 _0x089d=['path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','show','/:id/sounds','getSounds','post','update','delete','removeSound','exports','multer','util'];(function(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0x089d,0x178));var _0xd089=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x089d[_0x199572];return _0x13cfa3;};'use strict';var multer=require(_0xd089('0x0'));var util=require(_0xd089('0x1'));var path=require(_0xd089('0x2'));var timeout=require('connect-timeout');var express=require(_0xd089('0x3'));var router=express[_0xd089('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd089('0x5'));var interaction=require(_0xd089('0x6'));var config=require(_0xd089('0x7'));var controller=require(_0xd089('0x8'));router[_0xd089('0x9')]('/',auth[_0xd089('0xa')](),controller[_0xd089('0xb')]);router[_0xd089('0x9')](_0xd089('0xc'),auth['isAuthenticated'](),controller[_0xd089('0xd')]);router[_0xd089('0x9')](_0xd089('0xe'),auth[_0xd089('0xa')](),controller[_0xd089('0xf')]);router[_0xd089('0x10')]('/',auth[_0xd089('0xa')](),controller['create']);router['post']('/:id/sounds',auth[_0xd089('0xa')](),controller['addSound']);router['put']('/:id',auth[_0xd089('0xa')](),controller[_0xd089('0x11')]);router['delete']('/:id',auth[_0xd089('0xa')](),controller['destroy']);router[_0xd089('0x12')]('/:id/sounds/:id2',auth[_0xd089('0xa')](),controller[_0xd089('0x13')]);module[_0xd089('0x14')]=router; \ No newline at end of file +var _0xf9b6=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','isAuthenticated','index','show','get','/:id/sounds','getSounds','post','addSound','put','/:id','delete','destroy','/:id/sounds/:id2','removeSound','util','path'];(function(_0x5342b1,_0x3f441d){var _0x499430=function(_0x3b27da){while(--_0x3b27da){_0x5342b1['push'](_0x5342b1['shift']());}};_0x499430(++_0x3f441d);}(_0xf9b6,0xf0));var _0x6f9b=function(_0x3303c0,_0x1eaa43){_0x3303c0=_0x3303c0-0x0;var _0x454848=_0xf9b6[_0x3303c0];return _0x454848;};'use strict';var multer=require('multer');var util=require(_0x6f9b('0x0'));var path=require(_0x6f9b('0x1'));var timeout=require('connect-timeout');var express=require(_0x6f9b('0x2'));var router=express[_0x6f9b('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x6f9b('0x4'));var interaction=require(_0x6f9b('0x5'));var config=require(_0x6f9b('0x6'));var controller=require(_0x6f9b('0x7'));router['get']('/',auth[_0x6f9b('0x8')](),controller[_0x6f9b('0x9')]);router['get']('/:id',auth[_0x6f9b('0x8')](),controller[_0x6f9b('0xa')]);router[_0x6f9b('0xb')](_0x6f9b('0xc'),auth[_0x6f9b('0x8')](),controller[_0x6f9b('0xd')]);router[_0x6f9b('0xe')]('/',auth[_0x6f9b('0x8')](),controller['create']);router[_0x6f9b('0xe')](_0x6f9b('0xc'),auth[_0x6f9b('0x8')](),controller[_0x6f9b('0xf')]);router[_0x6f9b('0x10')](_0x6f9b('0x11'),auth[_0x6f9b('0x8')](),controller['update']);router[_0x6f9b('0x12')]('/:id',auth[_0x6f9b('0x8')](),controller[_0x6f9b('0x13')]);router[_0x6f9b('0x12')](_0x6f9b('0x14'),auth[_0x6f9b('0x8')](),controller[_0x6f9b('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 5208aec..2092469 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 _0xd9c5=['quietmp3','mp3','STRING','alpha','TIMESTAMP','BOOLEAN','sequelize','exports','name','ENUM','files','mp3nb'];(function(_0x5e4b85,_0x6cf965){var _0x5cd3cb=function(_0x589c9e){while(--_0x589c9e){_0x5e4b85['push'](_0x5e4b85['shift']());}};_0x5cd3cb(++_0x6cf965);}(_0xd9c5,0xea));var _0x5d9c=function(_0xbab1c3,_0x3f67d8){_0xbab1c3=_0xbab1c3-0x0;var _0x31ec6e=_0xd9c5[_0xbab1c3];return _0x31ec6e;};'use strict';var Sequelize=require(_0x5d9c('0x0'));module[_0x5d9c('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x5d9c('0x2')},'mode':{'type':Sequelize[_0x5d9c('0x3')]('custom',_0x5d9c('0x4'),_0x5d9c('0x5'),'quietmp3nb',_0x5d9c('0x6'),_0x5d9c('0x7')),'allowNull':!![],'defaultValue':_0x5d9c('0x4')},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0x5d9c('0x8')],'allowNull':!![]},'digit':{'type':Sequelize[_0x5d9c('0x8')],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x5d9c('0x9')},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':_0x5d9c('0xa')},'defaultEntry':{'type':Sequelize[_0x5d9c('0xb')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3512=['mp3nb','quietmp3nb','quietmp3','mp3','alpha','TIMESTAMP','BOOLEAN','sequelize','exports','STRING','name','ENUM','custom','files'];(function(_0x30be49,_0x4f894b){var _0x4c6ee9=function(_0x336486){while(--_0x336486){_0x30be49['push'](_0x30be49['shift']());}};_0x4c6ee9(++_0x4f894b);}(_0x3512,0x12d));var _0x2351=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x3512[_0x502c7d];return _0x30b7ed;};'use strict';var Sequelize=require(_0x2351('0x0'));module[_0x2351('0x1')]={'name':{'type':Sequelize[_0x2351('0x2')],'allowNull':![],'unique':_0x2351('0x3')},'mode':{'type':Sequelize[_0x2351('0x4')](_0x2351('0x5'),_0x2351('0x6'),_0x2351('0x7'),_0x2351('0x8'),_0x2351('0x9'),_0x2351('0xa')),'allowNull':!![],'defaultValue':_0x2351('0x6')},'directory':{'type':Sequelize[_0x2351('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0x2351('0x2')],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize[_0x2351('0x2')],'allowNull':!![],'defaultValue':_0x2351('0xb')},'format':{'type':Sequelize[_0x2351('0x2')],'allowNull':!![]},'stamp':{'type':_0x2351('0xc')},'defaultEntry':{'type':Sequelize[_0x2351('0xd')],'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 b0d0574..edab072 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 _0x3ab3=['Sound','getSounds','pick','hasOwnProperty','rimraf','zip-dir','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','limit','count','offset','set','apply','reject','save','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','VoiceMusicOnHold','rawAttributes','fieldName','key','model','query','filters','attributes','intersection','fields','nolimit','sort','filter','where','merge','type','options','include','findAll','rows','catch','params','keys','length','find','update','body','transaction','files','join','root','server/files/moh','create','directory','0777','role','user','UserProfileSection','MusicOnHolds','sequelize','readdirSync','forEach','unlinkSync','Sequelize','ValidationError','message','addSound','findOne','save_name','createdAt','server/files/sounds/converted','%s.%s','basename','extname','converted_format','symlinkSync','removeSound','id2'];(function(_0x4d4c85,_0x496cb2){var _0x39a66b=function(_0x994163){while(--_0x994163){_0x4d4c85['push'](_0x4d4c85['shift']());}};_0x39a66b(++_0x496cb2);}(_0x3ab3,0x1a8));var _0x33ab=function(_0x4e0a03,_0x5eb6b0){_0x4e0a03=_0x4e0a03-0x0;var _0x2478fc=_0x3ab3[_0x4e0a03];return _0x2478fc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x33ab('0x0'));var zipdir=require(_0x33ab('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x33ab('0x2'));var BPromise=require(_0x33ab('0x3'));var Mustache=require(_0x33ab('0x4'));var util=require(_0x33ab('0x5'));var path=require(_0x33ab('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x33ab('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x33ab('0x8'));var squel=require(_0x33ab('0x9'));var crypto=require(_0x33ab('0xa'));var jsforce=require(_0x33ab('0xb'));var deskjs=require(_0x33ab('0xc'));var toCsv=require('to-csv');var querystring=require(_0x33ab('0xd'));var Papa=require('papaparse');var Redis=require(_0x33ab('0xe'));var authService=require(_0x33ab('0xf'));var qs=require(_0x33ab('0x10'));var as=require(_0x33ab('0x11'));var hardwareService=require(_0x33ab('0x12'));var logger=require(_0x33ab('0x13'))('api');var utils=require(_0x33ab('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x33ab('0x15'));var db=require(_0x33ab('0x16'))['db'];function respondWithStatusCode(_0xa74093,_0x2ecea3){_0x2ecea3=_0x2ecea3||0xcc;return function(_0x45ae3d){if(_0x45ae3d){return _0xa74093[_0x33ab('0x17')](_0x2ecea3);}return _0xa74093['status'](_0x2ecea3)[_0x33ab('0x18')]();};}function respondWithResult(_0x10fbe4,_0x2f0f4c){_0x2f0f4c=_0x2f0f4c||0xc8;return function(_0x2cc910){if(_0x2cc910){return _0x10fbe4[_0x33ab('0x19')](_0x2f0f4c)['json'](_0x2cc910);}};}function respondWithFilteredResult(_0x1ac5c6,_0x373034){return function(_0x159e4c){if(_0x159e4c){var _0x5513c9=typeof _0x373034['offset']==='undefined'&&typeof _0x373034[_0x33ab('0x1a')]==='undefined';var _0x557b77=_0x159e4c[_0x33ab('0x1b')];var _0x281ef9=_0x5513c9?0x0:_0x373034[_0x33ab('0x1c')];var _0x4dbbe7=_0x5513c9?_0x159e4c['count']:_0x373034[_0x33ab('0x1c')]+_0x373034[_0x33ab('0x1a')];var _0x41443a;if(_0x4dbbe7>=_0x557b77){_0x4dbbe7=_0x557b77;_0x41443a=0xc8;}else{_0x41443a=0xce;}_0x1ac5c6[_0x33ab('0x19')](_0x41443a);return _0x1ac5c6[_0x33ab('0x1d')]('Content-Range',_0x281ef9+'-'+_0x4dbbe7+'/'+_0x557b77)['json'](_0x159e4c);}return null;};}function patchUpdates(_0x3ad437){return function(_0xbbc6dc){try{jsonpatch[_0x33ab('0x1e')](_0xbbc6dc,_0x3ad437,!![]);}catch(_0xd15512){return BPromise[_0x33ab('0x1f')](_0xd15512);}return _0xbbc6dc[_0x33ab('0x20')]();};}function saveUpdates(_0x40daec,_0x18e9dd){return function(_0x4c5942){if(_0x4c5942){return _0x4c5942['update'](_0x40daec)[_0x33ab('0x21')](function(_0x39b99f){return _0x39b99f;});}return null;};}function removeEntity(_0x47f7df,_0x3c03b7){return function(_0x76811b){if(_0x76811b){return _0x76811b[_0x33ab('0x22')]()[_0x33ab('0x21')](function(){var _0x4158e0=_0x76811b[_0x33ab('0x23')]({'plain':!![]});var _0x24fdbb='MusicOnHolds';return db[_0x33ab('0x24')][_0x33ab('0x22')]({'where':{'type':_0x24fdbb,'resourceId':_0x4158e0['id']}})[_0x33ab('0x21')](function(){return _0x76811b;});})['then'](function(){_0x47f7df[_0x33ab('0x19')](0xcc)[_0x33ab('0x18')]();});}};}function handleEntityNotFound(_0x1bedc0,_0x439e29){return function(_0x447f17){if(!_0x447f17){_0x1bedc0['sendStatus'](0x194);}return _0x447f17;};}function handleError(_0x513acd,_0x5d510c){_0x5d510c=_0x5d510c||0x1f4;return function(_0x3b7e4c){logger[_0x33ab('0x25')](_0x3b7e4c[_0x33ab('0x26')]);if(_0x3b7e4c['name']){delete _0x3b7e4c[_0x33ab('0x27')];}_0x513acd[_0x33ab('0x19')](_0x5d510c)[_0x33ab('0x28')](_0x3b7e4c);};}exports[_0x33ab('0x29')]=function(_0x53053d,_0x402fd0){var _0x527666={},_0x53c633={},_0x12872b={'count':0x0,'rows':[]};var _0x5a2051=_[_0x33ab('0x2a')](db[_0x33ab('0x2b')][_0x33ab('0x2c')],function(_0x204c75){return{'name':_0x204c75[_0x33ab('0x2d')],'type':_0x204c75['type'][_0x33ab('0x2e')]};});_0x53c633[_0x33ab('0x2f')]=_[_0x33ab('0x2a')](_0x5a2051,_0x33ab('0x27'));_0x53c633[_0x33ab('0x30')]=_['keys'](_0x53053d[_0x33ab('0x30')]);_0x53c633[_0x33ab('0x31')]=_['intersection'](_0x53c633[_0x33ab('0x2f')],_0x53c633[_0x33ab('0x30')]);_0x527666[_0x33ab('0x32')]=_[_0x33ab('0x33')](_0x53c633['model'],qs[_0x33ab('0x34')](_0x53053d['query'][_0x33ab('0x34')]));_0x527666['attributes']=_0x527666[_0x33ab('0x32')]['length']?_0x527666[_0x33ab('0x32')]:_0x53c633[_0x33ab('0x2f')];if(!_0x53053d[_0x33ab('0x30')]['hasOwnProperty'](_0x33ab('0x35'))){_0x527666[_0x33ab('0x1a')]=qs[_0x33ab('0x1a')](_0x53053d[_0x33ab('0x30')][_0x33ab('0x1a')]);_0x527666['offset']=qs[_0x33ab('0x1c')](_0x53053d['query'][_0x33ab('0x1c')]);}_0x527666['order']=qs[_0x33ab('0x36')](_0x53053d['query'][_0x33ab('0x36')]);delete _0x53053d['query'][_0x33ab('0x36')];_0x527666['where']=qs[_0x33ab('0x31')](_['pick'](_0x53053d[_0x33ab('0x30')],_0x53c633[_0x33ab('0x31')]),_0x5a2051);if(_0x53053d[_0x33ab('0x30')][_0x33ab('0x37')]){_0x527666[_0x33ab('0x38')]=_[_0x33ab('0x39')](_0x527666[_0x33ab('0x38')],{'$or':_[_0x33ab('0x2a')](_0x5a2051,function(_0x253a39){if(_0x253a39[_0x33ab('0x3a')]!=='VIRTUAL'){var _0x352534={};_0x352534[_0x253a39[_0x33ab('0x27')]]={'$like':'%'+_0x53053d[_0x33ab('0x30')]['filter']+'%'};return _0x352534;}})});}_0x527666=_['merge']({},_0x527666,_0x53053d[_0x33ab('0x3b')]);var _0x165093={'where':_0x527666[_0x33ab('0x38')]};return db[_0x33ab('0x2b')][_0x33ab('0x1b')](_0x165093)['then'](function(_0x323f92){_0x12872b['count']=_0x323f92;if(_0x53053d['query']['includeAll']){_0x527666[_0x33ab('0x3c')]=[{'all':!![]}];}return db[_0x33ab('0x2b')][_0x33ab('0x3d')](_0x527666);})['then'](function(_0x49f623){_0x12872b[_0x33ab('0x3e')]=_0x49f623;return _0x12872b;})[_0x33ab('0x21')](respondWithFilteredResult(_0x402fd0,_0x527666))[_0x33ab('0x3f')](handleError(_0x402fd0,null));};exports['show']=function(_0xcaf162,_0x4c449a){var _0x2b9fc8={'raw':![],'where':{'id':_0xcaf162[_0x33ab('0x40')]['id']}},_0x298b17={};_0x298b17[_0x33ab('0x2f')]=_[_0x33ab('0x41')](db[_0x33ab('0x2b')][_0x33ab('0x2c')]);_0x298b17[_0x33ab('0x30')]=_[_0x33ab('0x41')](_0xcaf162['query']);_0x298b17['filters']=_[_0x33ab('0x33')](_0x298b17['model'],_0x298b17[_0x33ab('0x30')]);_0x2b9fc8[_0x33ab('0x32')]=_['intersection'](_0x298b17['model'],qs[_0x33ab('0x34')](_0xcaf162['query'][_0x33ab('0x34')]));_0x2b9fc8[_0x33ab('0x32')]=_0x2b9fc8[_0x33ab('0x32')][_0x33ab('0x42')]?_0x2b9fc8['attributes']:_0x298b17['model'];if(_0xcaf162[_0x33ab('0x30')]['includeAll']){_0x2b9fc8['include']=[{'all':!![]}];}_0x2b9fc8=_[_0x33ab('0x39')]({},_0x2b9fc8,_0xcaf162[_0x33ab('0x3b')]);return db['VoiceMusicOnHold'][_0x33ab('0x43')](_0x2b9fc8)[_0x33ab('0x21')](handleEntityNotFound(_0x4c449a,null))[_0x33ab('0x21')](respondWithResult(_0x4c449a,null))[_0x33ab('0x3f')](handleError(_0x4c449a,null));};exports[_0x33ab('0x44')]=function(_0x5f2d93,_0xe0e6f6){if(_0x5f2d93[_0x33ab('0x45')]['id']){delete _0x5f2d93[_0x33ab('0x45')]['id'];}return db['VoiceMusicOnHold'][_0x33ab('0x43')]({'where':{'id':_0x5f2d93['params']['id']}})['then'](handleEntityNotFound(_0xe0e6f6,null))[_0x33ab('0x21')](saveUpdates(_0x5f2d93[_0x33ab('0x45')],null))[_0x33ab('0x21')](respondWithResult(_0xe0e6f6,null))['catch'](handleError(_0xe0e6f6,null));};exports['create']=function(_0x451118,_0xd4dcd9,_0x1bd37c){return db['sequelize'][_0x33ab('0x46')](function(_0x364be4){if(_0x451118[_0x33ab('0x45')]['mode']===_0x33ab('0x47')){_0x451118['body']['directory']=path[_0x33ab('0x48')](config[_0x33ab('0x49')],_0x33ab('0x4a'),_0x451118[_0x33ab('0x45')][_0x33ab('0x27')]);}return db[_0x33ab('0x2b')][_0x33ab('0x4b')](_0x451118['body'],{'transaction':_0x364be4})[_0x33ab('0x21')](function(_0x223739){if(_0x451118[_0x33ab('0x45')]['mode']===_0x33ab('0x47')){fs['mkdirSync'](_0x223739[_0x33ab('0x4c')],parseInt(_0x33ab('0x4d'),0x8));}var _0x2842c8=_0x451118['user'][_0x33ab('0x23')]({'plain':!![]});if(!_0x2842c8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2842c8[_0x33ab('0x4e')]===_0x33ab('0x4f')){var _0x367ddc=_0x223739[_0x33ab('0x23')]({'plain':!![]});return db[_0x33ab('0x50')][_0x33ab('0x43')]({'where':{'name':_0x33ab('0x51'),'userProfileId':_0x2842c8['userProfileId']},'raw':!![]})['then'](function(_0x171101){if(_0x171101&&_0x171101['autoAssociation']===0x0){return db[_0x33ab('0x24')]['create']({'name':_0x367ddc[_0x33ab('0x27')],'resourceId':_0x367ddc['id'],'type':_0x171101[_0x33ab('0x27')],'sectionId':_0x171101['id']},{})['then'](function(){return _0x223739;});}else{return _0x223739;}})[_0x33ab('0x3f')](function(_0x476a7e){logger[_0x33ab('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x476a7e);});}return _0x223739;});})[_0x33ab('0x21')](respondWithResult(_0xd4dcd9,0xc9))[_0x33ab('0x3f')](handleError(_0xd4dcd9,null));};exports[_0x33ab('0x22')]=function(_0x3509b9,_0x4297a6,_0x4f63b2){var _0x1e9561;return db[_0x33ab('0x2b')][_0x33ab('0x43')]({'where':{'id':_0x3509b9[_0x33ab('0x40')]['id']}})[_0x33ab('0x21')](function(_0x1b7690){if(_0x1b7690){return db[_0x33ab('0x52')][_0x33ab('0x46')](function(_0x520a97){return _0x1b7690[_0x33ab('0x22')]({'transaction':_0x520a97,'raw':!![]})['then'](function(_0x26e312){if(_0x26e312['directory']){fs[_0x33ab('0x53')](_0x26e312[_0x33ab('0x4c')])[_0x33ab('0x54')](function(_0x5bb908){fs[_0x33ab('0x55')](path[_0x33ab('0x48')](_0x26e312[_0x33ab('0x4c')],_0x5bb908));});fs['rmdirSync'](_0x26e312[_0x33ab('0x4c')]);}return _0x26e312;});})[_0x33ab('0x3f')](function(_0x44664a){throw new db[(_0x33ab('0x56'))][(_0x33ab('0x57'))](_0x44664a[_0x33ab('0x58')]);});}})[_0x33ab('0x21')](handleEntityNotFound(_0x4297a6,null))[_0x33ab('0x21')](removeEntity(_0x4297a6,null))[_0x33ab('0x3f')](handleError(_0x4297a6,null));};exports[_0x33ab('0x59')]=function(_0x20dcd8,_0x5c2c11,_0xa8140a){return db[_0x33ab('0x52')][_0x33ab('0x46')](function(_0x3704cb){var _0x2198e0;return db['VoiceMusicOnHold'][_0x33ab('0x43')]({'where':{'id':_0x20dcd8['params']['id']}})['then'](function(_0x354881){if(_0x354881){_0x2198e0=_0x354881;return _0x354881[_0x33ab('0x59')](_0x20dcd8[_0x33ab('0x45')]['id'],{'transaction':_0x3704cb});}})[_0x33ab('0x21')](function(_0x2e7d6b){if(_0x2e7d6b){return db['Sound'][_0x33ab('0x5a')]({'where':{'id':_0x20dcd8['body']['id']},'attributes':['id',_0x33ab('0x27'),_0x33ab('0x5b'),'converted_format',_0x33ab('0x5c')],'raw':!![]});}})[_0x33ab('0x21')](function(_0x1c18aa){if(_0x1c18aa){var _0x588fc3=path[_0x33ab('0x48')](config[_0x33ab('0x49')],_0x33ab('0x5d'),util['format'](_0x33ab('0x5e'),path[_0x33ab('0x5f')](_0x1c18aa['save_name'],path[_0x33ab('0x60')](_0x1c18aa[_0x33ab('0x5b')])),_0x1c18aa[_0x33ab('0x61')]));var _0x4a7af2=path['join'](config[_0x33ab('0x49')],'server/files/moh',_0x2198e0[_0x33ab('0x27')],util['format'](_0x33ab('0x5e'),_0x1c18aa[_0x33ab('0x27')],_0x1c18aa[_0x33ab('0x61')]));fs[_0x33ab('0x62')](_0x588fc3,_0x4a7af2);return _0x1c18aa;}})['catch'](function(_0x139d1d){throw new db[(_0x33ab('0x56'))][(_0x33ab('0x57'))](_0x139d1d[_0x33ab('0x58')]);});})[_0x33ab('0x21')](handleEntityNotFound(_0x5c2c11,null))[_0x33ab('0x21')](respondWithResult(_0x5c2c11,0xc9))[_0x33ab('0x3f')](handleError(_0x5c2c11,null));};exports['removeSound']=function(_0x62ab4b,_0x201580,_0x273f8a){return db[_0x33ab('0x52')]['transaction'](function(_0x53239e){var _0x4185c2;return db[_0x33ab('0x2b')][_0x33ab('0x5a')]({'where':{'id':_0x62ab4b[_0x33ab('0x40')]['id']}})[_0x33ab('0x21')](handleEntityNotFound(_0x201580,null))[_0x33ab('0x21')](function(_0x1f1e4c){if(_0x1f1e4c){_0x4185c2=_0x1f1e4c;return _0x1f1e4c[_0x33ab('0x63')](_0x62ab4b['params'][_0x33ab('0x64')]);}})['then'](function(_0x38c955){if(_0x38c955){return db[_0x33ab('0x65')][_0x33ab('0x5a')]({'where':{'id':_0x62ab4b[_0x33ab('0x40')][_0x33ab('0x64')]},'attributes':['id',_0x33ab('0x27'),'save_name',_0x33ab('0x61'),_0x33ab('0x5c')],'raw':!![]});}})[_0x33ab('0x21')](function(_0x4042bf){if(_0x4042bf){fs[_0x33ab('0x55')](path[_0x33ab('0x48')](_0x4185c2['directory'],util['format'](_0x33ab('0x5e'),_0x4042bf[_0x33ab('0x27')],_0x4042bf['converted_format'])));return _0x4042bf;}})[_0x33ab('0x3f')](function(_0x3884e9){throw new db[(_0x33ab('0x56'))][(_0x33ab('0x57'))](_0x3884e9[_0x33ab('0x58')]);});})[_0x33ab('0x21')](handleEntityNotFound(_0x201580,null))[_0x33ab('0x21')](respondWithStatusCode(_0x201580,0xcc))[_0x33ab('0x3f')](handleError(_0x201580,null));};exports[_0x33ab('0x66')]=function(_0x84f15f,_0x214675,_0x4a9351){var _0x2b9664={};var _0x1a6902={};var _0x1a138e;var _0x5f17cd;return db[_0x33ab('0x2b')][_0x33ab('0x5a')]({'where':{'id':_0x84f15f['params']['id']}})['then'](handleEntityNotFound(_0x214675,null))[_0x33ab('0x21')](function(_0x1a5f47){if(_0x1a5f47){_0x1a138e=_0x1a5f47;_0x1a6902[_0x33ab('0x2f')]=_[_0x33ab('0x41')](db[_0x33ab('0x65')][_0x33ab('0x2c')]);_0x1a6902[_0x33ab('0x30')]=_['keys'](_0x84f15f['query']);_0x1a6902[_0x33ab('0x31')]=_['intersection'](_0x1a6902[_0x33ab('0x2f')],_0x1a6902['query']);_0x2b9664[_0x33ab('0x32')]=_[_0x33ab('0x33')](_0x1a6902[_0x33ab('0x2f')],qs[_0x33ab('0x34')](_0x84f15f[_0x33ab('0x30')][_0x33ab('0x34')]));_0x2b9664['attributes']=_0x2b9664['attributes'][_0x33ab('0x42')]?_0x2b9664['attributes']:_0x1a6902[_0x33ab('0x2f')];_0x2b9664['order']=qs[_0x33ab('0x36')](_0x84f15f['query'][_0x33ab('0x36')]);_0x2b9664['where']=qs[_0x33ab('0x31')](_[_0x33ab('0x67')](_0x84f15f[_0x33ab('0x30')],_0x1a6902['filters']));if(_0x84f15f['query'][_0x33ab('0x37')]){_0x2b9664['where']=_[_0x33ab('0x39')](_0x2b9664[_0x33ab('0x38')],{'$or':_[_0x33ab('0x2a')](_0x2b9664['attributes'],function(_0x2c0543){var _0x309de1={};_0x309de1[_0x2c0543]={'$like':'%'+_0x84f15f[_0x33ab('0x30')]['filter']+'%'};return _0x309de1;})});}_0x2b9664=_[_0x33ab('0x39')]({},_0x2b9664,_0x84f15f['options']);return _0x1a138e['getSounds'](_0x2b9664);}})[_0x33ab('0x21')](function(_0x4a29f6){if(_0x4a29f6){_0x5f17cd=_0x4a29f6[_0x33ab('0x42')];if(!_0x84f15f[_0x33ab('0x30')][_0x33ab('0x68')]('nolimit')){_0x2b9664[_0x33ab('0x1a')]=qs[_0x33ab('0x1a')](_0x84f15f[_0x33ab('0x30')]['limit']);_0x2b9664['offset']=qs[_0x33ab('0x1c')](_0x84f15f['query'][_0x33ab('0x1c')]);}return _0x1a138e[_0x33ab('0x66')](_0x2b9664);}})['then'](function(_0x447c20){if(_0x447c20){return _0x447c20?{'count':_0x5f17cd,'rows':_0x447c20}:null;}})[_0x33ab('0x21')](respondWithResult(_0x214675,null))[_0x33ab('0x3f')](handleError(_0x214675,null));}; \ No newline at end of file +var _0x6fc0=['transaction','files','directory','join','mkdirSync','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','readdirSync','forEach','unlinkSync','rmdirSync','Sequelize','ValidationError','addSound','Sound','findOne','save_name','converted_format','createdAt','root','server/files/sounds/converted','format','%s.%s','basename','extname','server/files/moh','symlinkSync','removeSound','id2','message','getSounds','order','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/environment','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','then','destroy','get','MusicOnHolds','UserProfileResource','sendStatus','error','stack','index','map','rawAttributes','fieldName','type','key','model','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','name','options','VoiceMusicOnHold','count','includeAll','rows','show','params','keys','filters','intersection','catch','update','body','find','create','sequelize'];(function(_0x12f688,_0x585c25){var _0x59c3de=function(_0x4ac301){while(--_0x4ac301){_0x12f688['push'](_0x12f688['shift']());}};_0x59c3de(++_0x585c25);}(_0x6fc0,0x1e0));var _0x06fc=function(_0x3f7dfc,_0x8f0dad){_0x3f7dfc=_0x3f7dfc-0x0;var _0x499d09=_0x6fc0[_0x3f7dfc];return _0x499d09;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x06fc('0x0'));var jsonpatch=require(_0x06fc('0x1'));var rp=require(_0x06fc('0x2'));var moment=require(_0x06fc('0x3'));var BPromise=require(_0x06fc('0x4'));var Mustache=require(_0x06fc('0x5'));var util=require(_0x06fc('0x6'));var path=require(_0x06fc('0x7'));var sox=require(_0x06fc('0x8'));var csv=require(_0x06fc('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x06fc('0xa'));var _=require(_0x06fc('0xb'));var squel=require('squel');var crypto=require(_0x06fc('0xc'));var jsforce=require(_0x06fc('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x06fc('0xe'));var Papa=require(_0x06fc('0xf'));var Redis=require('ioredis');var authService=require(_0x06fc('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x06fc('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x06fc('0x12'));var utils=require('../../config/utils');var config=require(_0x06fc('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1e3ead,_0x5b3308){_0x5b3308=_0x5b3308||0xcc;return function(_0x274f02){if(_0x274f02){return _0x1e3ead['sendStatus'](_0x5b3308);}return _0x1e3ead[_0x06fc('0x14')](_0x5b3308)[_0x06fc('0x15')]();};}function respondWithResult(_0x69164f,_0x11164d){_0x11164d=_0x11164d||0xc8;return function(_0xc20725){if(_0xc20725){return _0x69164f[_0x06fc('0x14')](_0x11164d)[_0x06fc('0x16')](_0xc20725);}};}function respondWithFilteredResult(_0x4809a0,_0x3c6fc2){return function(_0x1ab6fe){if(_0x1ab6fe){var _0x385666=typeof _0x3c6fc2[_0x06fc('0x17')]===_0x06fc('0x18')&&typeof _0x3c6fc2['limit']===_0x06fc('0x18');var _0x1e8201=_0x1ab6fe['count'];var _0x361425=_0x385666?0x0:_0x3c6fc2[_0x06fc('0x17')];var _0xa9e786=_0x385666?_0x1ab6fe['count']:_0x3c6fc2[_0x06fc('0x17')]+_0x3c6fc2[_0x06fc('0x19')];var _0x366de4;if(_0xa9e786>=_0x1e8201){_0xa9e786=_0x1e8201;_0x366de4=0xc8;}else{_0x366de4=0xce;}_0x4809a0[_0x06fc('0x14')](_0x366de4);return _0x4809a0[_0x06fc('0x1a')](_0x06fc('0x1b'),_0x361425+'-'+_0xa9e786+'/'+_0x1e8201)[_0x06fc('0x16')](_0x1ab6fe);}return null;};}function patchUpdates(_0xc67818){return function(_0x5414ce){try{jsonpatch[_0x06fc('0x1c')](_0x5414ce,_0xc67818,!![]);}catch(_0x574834){return BPromise[_0x06fc('0x1d')](_0x574834);}return _0x5414ce[_0x06fc('0x1e')]();};}function saveUpdates(_0x1f6a71,_0x1abcd5){return function(_0x4fe381){if(_0x4fe381){return _0x4fe381['update'](_0x1f6a71)[_0x06fc('0x1f')](function(_0x17e39d){return _0x17e39d;});}return null;};}function removeEntity(_0x300716,_0x5f059e){return function(_0x26e134){if(_0x26e134){return _0x26e134[_0x06fc('0x20')]()[_0x06fc('0x1f')](function(){var _0x4bac28=_0x26e134[_0x06fc('0x21')]({'plain':!![]});var _0x931028=_0x06fc('0x22');return db[_0x06fc('0x23')][_0x06fc('0x20')]({'where':{'type':_0x931028,'resourceId':_0x4bac28['id']}})['then'](function(){return _0x26e134;});})['then'](function(){_0x300716[_0x06fc('0x14')](0xcc)[_0x06fc('0x15')]();});}};}function handleEntityNotFound(_0x6acb0c,_0x40b449){return function(_0x3719de){if(!_0x3719de){_0x6acb0c[_0x06fc('0x24')](0x194);}return _0x3719de;};}function handleError(_0x1dbdaf,_0x5bd682){_0x5bd682=_0x5bd682||0x1f4;return function(_0x374c7d){logger[_0x06fc('0x25')](_0x374c7d[_0x06fc('0x26')]);if(_0x374c7d['name']){delete _0x374c7d['name'];}_0x1dbdaf[_0x06fc('0x14')](_0x5bd682)['send'](_0x374c7d);};}exports[_0x06fc('0x27')]=function(_0x355628,_0x189dc7){var _0x5f46fb={},_0x29ea31={},_0x98e957={'count':0x0,'rows':[]};var _0x49ab11=_[_0x06fc('0x28')](db['VoiceMusicOnHold'][_0x06fc('0x29')],function(_0x301730){return{'name':_0x301730[_0x06fc('0x2a')],'type':_0x301730[_0x06fc('0x2b')][_0x06fc('0x2c')]};});_0x29ea31[_0x06fc('0x2d')]=_[_0x06fc('0x28')](_0x49ab11,'name');_0x29ea31[_0x06fc('0x2e')]=_['keys'](_0x355628[_0x06fc('0x2e')]);_0x29ea31['filters']=_['intersection'](_0x29ea31[_0x06fc('0x2d')],_0x29ea31[_0x06fc('0x2e')]);_0x5f46fb[_0x06fc('0x2f')]=_['intersection'](_0x29ea31[_0x06fc('0x2d')],qs[_0x06fc('0x30')](_0x355628[_0x06fc('0x2e')][_0x06fc('0x30')]));_0x5f46fb[_0x06fc('0x2f')]=_0x5f46fb[_0x06fc('0x2f')][_0x06fc('0x31')]?_0x5f46fb['attributes']:_0x29ea31['model'];if(!_0x355628['query'][_0x06fc('0x32')](_0x06fc('0x33'))){_0x5f46fb[_0x06fc('0x19')]=qs[_0x06fc('0x19')](_0x355628['query'][_0x06fc('0x19')]);_0x5f46fb[_0x06fc('0x17')]=qs[_0x06fc('0x17')](_0x355628[_0x06fc('0x2e')]['offset']);}_0x5f46fb['order']=qs[_0x06fc('0x34')](_0x355628[_0x06fc('0x2e')][_0x06fc('0x34')]);delete _0x355628[_0x06fc('0x2e')][_0x06fc('0x34')];_0x5f46fb[_0x06fc('0x35')]=qs['filters'](_[_0x06fc('0x36')](_0x355628['query'],_0x29ea31['filters']),_0x49ab11);if(_0x355628[_0x06fc('0x2e')][_0x06fc('0x37')]){_0x5f46fb[_0x06fc('0x35')]=_[_0x06fc('0x38')](_0x5f46fb['where'],{'$or':_[_0x06fc('0x28')](_0x49ab11,function(_0xd402fc){if(_0xd402fc[_0x06fc('0x2b')]!==_0x06fc('0x39')){var _0x5d0799={};_0x5d0799[_0xd402fc[_0x06fc('0x3a')]]={'$like':'%'+_0x355628[_0x06fc('0x2e')][_0x06fc('0x37')]+'%'};return _0x5d0799;}})});}_0x5f46fb=_[_0x06fc('0x38')]({},_0x5f46fb,_0x355628[_0x06fc('0x3b')]);var _0x35dd55={'where':_0x5f46fb[_0x06fc('0x35')]};return db[_0x06fc('0x3c')]['count'](_0x35dd55)['then'](function(_0x5a49bf){_0x98e957[_0x06fc('0x3d')]=_0x5a49bf;if(_0x355628['query'][_0x06fc('0x3e')]){_0x5f46fb['include']=[{'all':!![]}];}return db[_0x06fc('0x3c')]['findAll'](_0x5f46fb);})[_0x06fc('0x1f')](function(_0x48f6a6){_0x98e957[_0x06fc('0x3f')]=_0x48f6a6;return _0x98e957;})[_0x06fc('0x1f')](respondWithFilteredResult(_0x189dc7,_0x5f46fb))['catch'](handleError(_0x189dc7,null));};exports[_0x06fc('0x40')]=function(_0x4a9f6e,_0x26aecc){var _0x27e18d={'raw':![],'where':{'id':_0x4a9f6e[_0x06fc('0x41')]['id']}},_0x4e8dd3={};_0x4e8dd3['model']=_['keys'](db['VoiceMusicOnHold']['rawAttributes']);_0x4e8dd3['query']=_[_0x06fc('0x42')](_0x4a9f6e[_0x06fc('0x2e')]);_0x4e8dd3[_0x06fc('0x43')]=_[_0x06fc('0x44')](_0x4e8dd3['model'],_0x4e8dd3['query']);_0x27e18d[_0x06fc('0x2f')]=_[_0x06fc('0x44')](_0x4e8dd3[_0x06fc('0x2d')],qs[_0x06fc('0x30')](_0x4a9f6e[_0x06fc('0x2e')][_0x06fc('0x30')]));_0x27e18d[_0x06fc('0x2f')]=_0x27e18d[_0x06fc('0x2f')][_0x06fc('0x31')]?_0x27e18d[_0x06fc('0x2f')]:_0x4e8dd3[_0x06fc('0x2d')];if(_0x4a9f6e[_0x06fc('0x2e')][_0x06fc('0x3e')]){_0x27e18d['include']=[{'all':!![]}];}_0x27e18d=_[_0x06fc('0x38')]({},_0x27e18d,_0x4a9f6e['options']);return db[_0x06fc('0x3c')]['find'](_0x27e18d)['then'](handleEntityNotFound(_0x26aecc,null))[_0x06fc('0x1f')](respondWithResult(_0x26aecc,null))[_0x06fc('0x45')](handleError(_0x26aecc,null));};exports[_0x06fc('0x46')]=function(_0x2d9563,_0x2b4c91){if(_0x2d9563[_0x06fc('0x47')]['id']){delete _0x2d9563[_0x06fc('0x47')]['id'];}return db[_0x06fc('0x3c')][_0x06fc('0x48')]({'where':{'id':_0x2d9563[_0x06fc('0x41')]['id']}})[_0x06fc('0x1f')](handleEntityNotFound(_0x2b4c91,null))[_0x06fc('0x1f')](saveUpdates(_0x2d9563[_0x06fc('0x47')],null))[_0x06fc('0x1f')](respondWithResult(_0x2b4c91,null))[_0x06fc('0x45')](handleError(_0x2b4c91,null));};exports[_0x06fc('0x49')]=function(_0x439516,_0x37d0da,_0x545e05){return db[_0x06fc('0x4a')][_0x06fc('0x4b')](function(_0x1b5999){if(_0x439516[_0x06fc('0x47')]['mode']===_0x06fc('0x4c')){_0x439516[_0x06fc('0x47')][_0x06fc('0x4d')]=path[_0x06fc('0x4e')](config['root'],'server/files/moh',_0x439516[_0x06fc('0x47')][_0x06fc('0x3a')]);}return db[_0x06fc('0x3c')][_0x06fc('0x49')](_0x439516['body'],{'transaction':_0x1b5999})[_0x06fc('0x1f')](function(_0x3e4d2c){if(_0x439516[_0x06fc('0x47')]['mode']===_0x06fc('0x4c')){fs[_0x06fc('0x4f')](_0x3e4d2c[_0x06fc('0x4d')],parseInt(_0x06fc('0x50'),0x8));}var _0x1996f3=_0x439516[_0x06fc('0x51')][_0x06fc('0x21')]({'plain':!![]});if(!_0x1996f3)throw new Error(_0x06fc('0x52'));if(_0x1996f3[_0x06fc('0x53')]===_0x06fc('0x51')){var _0x5c547a=_0x3e4d2c[_0x06fc('0x21')]({'plain':!![]});return db[_0x06fc('0x54')]['find']({'where':{'name':_0x06fc('0x22'),'userProfileId':_0x1996f3[_0x06fc('0x55')]},'raw':!![]})[_0x06fc('0x1f')](function(_0x56ae36){if(_0x56ae36&&_0x56ae36['autoAssociation']===0x0){return db['UserProfileResource'][_0x06fc('0x49')]({'name':_0x5c547a['name'],'resourceId':_0x5c547a['id'],'type':_0x56ae36[_0x06fc('0x3a')],'sectionId':_0x56ae36['id']},{})[_0x06fc('0x1f')](function(){return _0x3e4d2c;});}else{return _0x3e4d2c;}})['catch'](function(_0xaa65c3){logger[_0x06fc('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xaa65c3);});}return _0x3e4d2c;});})[_0x06fc('0x1f')](respondWithResult(_0x37d0da,0xc9))['catch'](handleError(_0x37d0da,null));};exports['destroy']=function(_0x44075c,_0x1a110f,_0x5246a5){var _0x4cbb78;return db[_0x06fc('0x3c')][_0x06fc('0x48')]({'where':{'id':_0x44075c[_0x06fc('0x41')]['id']}})[_0x06fc('0x1f')](function(_0x2d3b4d){if(_0x2d3b4d){return db[_0x06fc('0x4a')][_0x06fc('0x4b')](function(_0x1c3348){return _0x2d3b4d['destroy']({'transaction':_0x1c3348,'raw':!![]})[_0x06fc('0x1f')](function(_0x1fdd38){if(_0x1fdd38[_0x06fc('0x4d')]){fs[_0x06fc('0x56')](_0x1fdd38[_0x06fc('0x4d')])[_0x06fc('0x57')](function(_0x27a14a){fs[_0x06fc('0x58')](path[_0x06fc('0x4e')](_0x1fdd38[_0x06fc('0x4d')],_0x27a14a));});fs[_0x06fc('0x59')](_0x1fdd38[_0x06fc('0x4d')]);}return _0x1fdd38;});})[_0x06fc('0x45')](function(_0x2c28cf){throw new db[(_0x06fc('0x5a'))][(_0x06fc('0x5b'))](_0x2c28cf['message']);});}})[_0x06fc('0x1f')](handleEntityNotFound(_0x1a110f,null))[_0x06fc('0x1f')](removeEntity(_0x1a110f,null))[_0x06fc('0x45')](handleError(_0x1a110f,null));};exports[_0x06fc('0x5c')]=function(_0x14f0bd,_0x4405cc,_0x5db0ee){return db[_0x06fc('0x4a')][_0x06fc('0x4b')](function(_0x1fa3e5){var _0x42f20e;return db[_0x06fc('0x3c')][_0x06fc('0x48')]({'where':{'id':_0x14f0bd[_0x06fc('0x41')]['id']}})[_0x06fc('0x1f')](function(_0x1a4396){if(_0x1a4396){_0x42f20e=_0x1a4396;return _0x1a4396[_0x06fc('0x5c')](_0x14f0bd[_0x06fc('0x47')]['id'],{'transaction':_0x1fa3e5});}})[_0x06fc('0x1f')](function(_0x18aba9){if(_0x18aba9){return db[_0x06fc('0x5d')][_0x06fc('0x5e')]({'where':{'id':_0x14f0bd[_0x06fc('0x47')]['id']},'attributes':['id',_0x06fc('0x3a'),_0x06fc('0x5f'),_0x06fc('0x60'),_0x06fc('0x61')],'raw':!![]});}})[_0x06fc('0x1f')](function(_0xe16fc8){if(_0xe16fc8){var _0x69cf1a=path[_0x06fc('0x4e')](config[_0x06fc('0x62')],_0x06fc('0x63'),util[_0x06fc('0x64')](_0x06fc('0x65'),path[_0x06fc('0x66')](_0xe16fc8[_0x06fc('0x5f')],path[_0x06fc('0x67')](_0xe16fc8['save_name'])),_0xe16fc8['converted_format']));var _0x3b72dc=path[_0x06fc('0x4e')](config[_0x06fc('0x62')],_0x06fc('0x68'),_0x42f20e[_0x06fc('0x3a')],util[_0x06fc('0x64')]('%s.%s',_0xe16fc8['name'],_0xe16fc8[_0x06fc('0x60')]));fs[_0x06fc('0x69')](_0x69cf1a,_0x3b72dc);return _0xe16fc8;}})[_0x06fc('0x45')](function(_0x58afb7){throw new db[(_0x06fc('0x5a'))][(_0x06fc('0x5b'))](_0x58afb7['message']);});})[_0x06fc('0x1f')](handleEntityNotFound(_0x4405cc,null))[_0x06fc('0x1f')](respondWithResult(_0x4405cc,0xc9))[_0x06fc('0x45')](handleError(_0x4405cc,null));};exports[_0x06fc('0x6a')]=function(_0x3733e9,_0x17c3be,_0x65178d){return db[_0x06fc('0x4a')]['transaction'](function(_0x120c61){var _0x1ec209;return db[_0x06fc('0x3c')]['findOne']({'where':{'id':_0x3733e9['params']['id']}})[_0x06fc('0x1f')](handleEntityNotFound(_0x17c3be,null))[_0x06fc('0x1f')](function(_0x2181e0){if(_0x2181e0){_0x1ec209=_0x2181e0;return _0x2181e0[_0x06fc('0x6a')](_0x3733e9[_0x06fc('0x41')]['id2']);}})[_0x06fc('0x1f')](function(_0xe1d67){if(_0xe1d67){return db[_0x06fc('0x5d')]['findOne']({'where':{'id':_0x3733e9['params'][_0x06fc('0x6b')]},'attributes':['id',_0x06fc('0x3a'),_0x06fc('0x5f'),_0x06fc('0x60'),_0x06fc('0x61')],'raw':!![]});}})[_0x06fc('0x1f')](function(_0x37e352){if(_0x37e352){fs[_0x06fc('0x58')](path['join'](_0x1ec209[_0x06fc('0x4d')],util[_0x06fc('0x64')](_0x06fc('0x65'),_0x37e352[_0x06fc('0x3a')],_0x37e352['converted_format'])));return _0x37e352;}})['catch'](function(_0x4ec647){throw new db[(_0x06fc('0x5a'))]['ValidationError'](_0x4ec647[_0x06fc('0x6c')]);});})[_0x06fc('0x1f')](handleEntityNotFound(_0x17c3be,null))['then'](respondWithStatusCode(_0x17c3be,0xcc))[_0x06fc('0x45')](handleError(_0x17c3be,null));};exports[_0x06fc('0x6d')]=function(_0x50ae19,_0x5e7cd4,_0x13d481){var _0x2ae162={};var _0x4a7b64={};var _0x57073e;var _0x4105a5;return db[_0x06fc('0x3c')][_0x06fc('0x5e')]({'where':{'id':_0x50ae19[_0x06fc('0x41')]['id']}})[_0x06fc('0x1f')](handleEntityNotFound(_0x5e7cd4,null))[_0x06fc('0x1f')](function(_0x3c17e6){if(_0x3c17e6){_0x57073e=_0x3c17e6;_0x4a7b64[_0x06fc('0x2d')]=_[_0x06fc('0x42')](db['Sound'][_0x06fc('0x29')]);_0x4a7b64['query']=_[_0x06fc('0x42')](_0x50ae19[_0x06fc('0x2e')]);_0x4a7b64[_0x06fc('0x43')]=_[_0x06fc('0x44')](_0x4a7b64[_0x06fc('0x2d')],_0x4a7b64[_0x06fc('0x2e')]);_0x2ae162[_0x06fc('0x2f')]=_['intersection'](_0x4a7b64[_0x06fc('0x2d')],qs[_0x06fc('0x30')](_0x50ae19[_0x06fc('0x2e')][_0x06fc('0x30')]));_0x2ae162[_0x06fc('0x2f')]=_0x2ae162[_0x06fc('0x2f')][_0x06fc('0x31')]?_0x2ae162[_0x06fc('0x2f')]:_0x4a7b64[_0x06fc('0x2d')];_0x2ae162[_0x06fc('0x6e')]=qs[_0x06fc('0x34')](_0x50ae19[_0x06fc('0x2e')][_0x06fc('0x34')]);_0x2ae162[_0x06fc('0x35')]=qs[_0x06fc('0x43')](_[_0x06fc('0x36')](_0x50ae19['query'],_0x4a7b64[_0x06fc('0x43')]));if(_0x50ae19[_0x06fc('0x2e')]['filter']){_0x2ae162['where']=_[_0x06fc('0x38')](_0x2ae162[_0x06fc('0x35')],{'$or':_[_0x06fc('0x28')](_0x2ae162['attributes'],function(_0x468d4b){var _0x52295f={};_0x52295f[_0x468d4b]={'$like':'%'+_0x50ae19[_0x06fc('0x2e')][_0x06fc('0x37')]+'%'};return _0x52295f;})});}_0x2ae162=_[_0x06fc('0x38')]({},_0x2ae162,_0x50ae19[_0x06fc('0x3b')]);return _0x57073e[_0x06fc('0x6d')](_0x2ae162);}})[_0x06fc('0x1f')](function(_0x413e76){if(_0x413e76){_0x4105a5=_0x413e76['length'];if(!_0x50ae19[_0x06fc('0x2e')][_0x06fc('0x32')](_0x06fc('0x33'))){_0x2ae162[_0x06fc('0x19')]=qs[_0x06fc('0x19')](_0x50ae19[_0x06fc('0x2e')]['limit']);_0x2ae162[_0x06fc('0x17')]=qs['offset'](_0x50ae19[_0x06fc('0x2e')]['offset']);}return _0x57073e[_0x06fc('0x6d')](_0x2ae162);}})[_0x06fc('0x1f')](function(_0x23fd05){if(_0x23fd05){return _0x23fd05?{'count':_0x4105a5,'rows':_0x23fd05}:null;}})[_0x06fc('0x1f')](respondWithResult(_0x5e7cd4,null))[_0x06fc('0x45')](handleError(_0x5e7cd4,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 41b4f6c..cba241b 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 _0x03d4=['./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','voice_musiconhold','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x03d4,0x123));var _0x403d=function(_0x12d642,_0x32a04b){_0x12d642=_0x12d642-0x0;var _0x437308=_0x03d4[_0x12d642];return _0x437308;};'use strict';var _=require(_0x403d('0x0'));var util=require(_0x403d('0x1'));var logger=require(_0x403d('0x2'))(_0x403d('0x3'));var moment=require(_0x403d('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x403d('0x5'));var rimraf=require(_0x403d('0x6'));var config=require(_0x403d('0x7'));var attributes=require(_0x403d('0x8'));module[_0x403d('0x9')]=function(_0x5c0fb3,_0x3efb7b){return _0x5c0fb3[_0x403d('0xa')](_0x403d('0xb'),attributes,{'tableName':_0x403d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x135d=['path','../../config/environment','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0x135d,0x17f));var _0xd135=function(_0x4d12ba,_0x54f8da){_0x4d12ba=_0x4d12ba-0x0;var _0x9c238c=_0x135d[_0x4d12ba];return _0x9c238c;};'use strict';var _=require(_0xd135('0x0'));var util=require(_0xd135('0x1'));var logger=require(_0xd135('0x2'))(_0xd135('0x3'));var moment=require(_0xd135('0x4'));var BPromise=require(_0xd135('0x5'));var rp=require(_0xd135('0x6'));var fs=require('fs');var path=require(_0xd135('0x7'));var rimraf=require('rimraf');var config=require(_0xd135('0x8'));var attributes=require(_0xd135('0x9'));module[_0xd135('0xa')]=function(_0x30916a,_0x21d36f){return _0x30916a[_0xd135('0xb')](_0xd135('0xc'),attributes,{'tableName':'voice_musiconhold','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index 0aaa0bd..9b3601f 100644 --- a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js +++ b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['code','VoiceMusicOnHold,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x3a922c,_0x4ac58e){var _0x4f2cf3=function(_0x288112){while(--_0x288112){_0x3a922c['push'](_0x3a922c['shift']());}};_0x4f2cf3(++_0x4ac58e);}(_0x70e0,0x17b));var _0x070e=function(_0x1e8d24,_0x761937){_0x1e8d24=_0x1e8d24-0x0;var _0x5fc649=_0x70e0[_0x1e8d24];return _0x5fc649;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file +var _0xa9e0=['http','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x130e31,_0x5503a2){var _0x4bd259=function(_0x5dad39){while(--_0x5dad39){_0x130e31['push'](_0x130e31['shift']());}};_0x4bd259(++_0x5503a2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 4d835a4..0b1df47 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 _0x5643=['/describe','show','getTeams','post','create','/:id/users','addAgents','addTeams','put','/:id','update','destroy','delete','removeAgents','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','isAuthenticated','index','get'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5643,0x1a3));var _0x3564=function(_0x3e1922,_0x4a11e3){_0x3e1922=_0x3e1922-0x0;var _0x2790fa=_0x5643[_0x3e1922];return _0x2790fa;};'use strict';var multer=require(_0x3564('0x0'));var util=require(_0x3564('0x1'));var path=require(_0x3564('0x2'));var timeout=require('connect-timeout');var express=require(_0x3564('0x3'));var router=express[_0x3564('0x4')]();var fs_extra=require(_0x3564('0x5'));var auth=require(_0x3564('0x6'));var interaction=require(_0x3564('0x7'));var config=require(_0x3564('0x8'));var controller=require(_0x3564('0x9'));router['get']('/',auth[_0x3564('0xa')](),controller[_0x3564('0xb')]);router[_0x3564('0xc')](_0x3564('0xd'),auth[_0x3564('0xa')](),controller['describe']);router[_0x3564('0xc')]('/:id',auth[_0x3564('0xa')](),controller[_0x3564('0xe')]);router[_0x3564('0xc')]('/:id/users',auth[_0x3564('0xa')](),controller['getAgents']);router[_0x3564('0xc')]('/:id/teams',auth[_0x3564('0xa')](),controller[_0x3564('0xf')]);router[_0x3564('0x10')]('/',auth['isAuthenticated'](),controller[_0x3564('0x11')]);router[_0x3564('0x10')](_0x3564('0x12'),auth[_0x3564('0xa')](),controller[_0x3564('0x13')]);router['post']('/:id/teams',auth[_0x3564('0xa')](),controller[_0x3564('0x14')]);router[_0x3564('0x15')](_0x3564('0x16'),auth['isAuthenticated'](),controller[_0x3564('0x17')]);router['delete']('/:id',auth[_0x3564('0xa')](),controller[_0x3564('0x18')]);router[_0x3564('0x19')](_0x3564('0x12'),auth['isAuthenticated'](),controller[_0x3564('0x1a')]);router['delete']('/:id/teams',auth['isAuthenticated'](),controller['removeTeams']);module['exports']=router; \ No newline at end of file +var _0x8569=['post','addAgents','/:id/teams','update','delete','destroy','removeTeams','exports','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/users','getAgents','getTeams'];(function(_0x1f658e,_0x399a4a){var _0x19e02a=function(_0x434f3b){while(--_0x434f3b){_0x1f658e['push'](_0x1f658e['shift']());}};_0x19e02a(++_0x399a4a);}(_0x8569,0x14d));var _0x9856=function(_0x4d0df6,_0x4634f3){_0x4d0df6=_0x4d0df6-0x0;var _0x4e2615=_0x8569[_0x4d0df6];return _0x4e2615;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9856('0x0'));var timeout=require(_0x9856('0x1'));var express=require(_0x9856('0x2'));var router=express['Router']();var fs_extra=require(_0x9856('0x3'));var auth=require(_0x9856('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x9856('0x5'));var controller=require(_0x9856('0x6'));router[_0x9856('0x7')]('/',auth[_0x9856('0x8')](),controller[_0x9856('0x9')]);router[_0x9856('0x7')](_0x9856('0xa'),auth[_0x9856('0x8')](),controller[_0x9856('0xb')]);router[_0x9856('0x7')](_0x9856('0xc'),auth[_0x9856('0x8')](),controller[_0x9856('0xd')]);router[_0x9856('0x7')](_0x9856('0xe'),auth[_0x9856('0x8')](),controller[_0x9856('0xf')]);router[_0x9856('0x7')]('/:id/teams',auth['isAuthenticated'](),controller[_0x9856('0x10')]);router[_0x9856('0x11')]('/',auth[_0x9856('0x8')](),controller['create']);router[_0x9856('0x11')](_0x9856('0xe'),auth[_0x9856('0x8')](),controller[_0x9856('0x12')]);router['post'](_0x9856('0x13'),auth['isAuthenticated'](),controller['addTeams']);router['put'](_0x9856('0xc'),auth['isAuthenticated'](),controller[_0x9856('0x14')]);router[_0x9856('0x15')](_0x9856('0xc'),auth[_0x9856('0x8')](),controller[_0x9856('0x16')]);router['delete'](_0x9856('0xe'),auth[_0x9856('0x8')](),controller['removeAgents']);router[_0x9856('0x15')](_0x9856('0x13'),auth[_0x9856('0x8')](),controller[_0x9856('0x17')]);module[_0x9856('0x18')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index f8a33f9..7e8171a 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 _0xe46f=['name','sequelize','exports','STRING','VIRTUAL','system-','getDataValue'];(function(_0x16f1e7,_0x387f09){var _0x49651c=function(_0x5baac4){while(--_0x5baac4){_0x16f1e7['push'](_0x16f1e7['shift']());}};_0x49651c(++_0x387f09);}(_0xe46f,0x1a5));var _0xfe46=function(_0x1b9c2a,_0x50582e){_0x1b9c2a=_0x1b9c2a-0x0;var _0x21ab47=_0xe46f[_0x1b9c2a];return _0x21ab47;};'use strict';var Sequelize=require(_0xfe46('0x0'));module[_0xfe46('0x1')]={'name':{'type':Sequelize[_0xfe46('0x2')],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize[_0xfe46('0x3')],'get':function(_0x13820b){return _0xfe46('0x4')+this[_0xfe46('0x5')](_0xfe46('0x6'))+'-';}},'description':{'type':Sequelize[_0xfe46('0x2')]},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xef48=['getDataValue','INTEGER','sequelize','STRING','VIRTUAL','system-'];(function(_0x575b2e,_0x4c8fd5){var _0x44cbe0=function(_0x5778cd){while(--_0x5778cd){_0x575b2e['push'](_0x575b2e['shift']());}};_0x44cbe0(++_0x4c8fd5);}(_0xef48,0x80));var _0x8ef4=function(_0x5aa8b7,_0x3b3654){_0x5aa8b7=_0x5aa8b7-0x0;var _0xd239ae=_0xef48[_0x5aa8b7];return _0xd239ae;};'use strict';var Sequelize=require(_0x8ef4('0x0'));module['exports']={'name':{'type':Sequelize[_0x8ef4('0x1')],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize[_0x8ef4('0x2')],'get':function(_0x4c71f1){return _0x8ef4('0x3')+this[_0x8ef4('0x4')]('name')+'-';}},'description':{'type':Sequelize[_0x8ef4('0x1')]},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize[_0x8ef4('0x5')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 55a3e36..4d99093 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 _0xa30a=['priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','Set','push','PREFIX-CALLERIDALL=','charAt','body','VoiceExtensionId','findById','addAgents','ids','omit','spread','emit','removeAgents','userVoicePrefix:remove','getAgents','findOne','User','getTeams','Team','order','addTeams','Agents','online','voicePause','interface','flatMap','sequelize','TeamVoicePrefix','upsert','findOrCreate','userVoicePrefix:save','removeTeams','tq.TeamId','from','team_has_voice_prefixes','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','includes','all','union','compact','value','isEmpty','forEach','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','get','VoicePrefixes','UserProfileResource','error','stack','name','send','index','VoicePrefix','rawAttributes','fieldName','type','map','keys','filters','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','find','params','describe','create','transaction','VoiceExtension','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','exten','app','description','Voice\x20Prefix\x20Extension'];(function(_0x40a327,_0x520a46){var _0x1e8e3e=function(_0x545175){while(--_0x545175){_0x40a327['push'](_0x40a327['shift']());}};_0x1e8e3e(++_0x520a46);}(_0xa30a,0xd7));var _0xaa30=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa30a[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0xaa30('0x0'));var rimraf=require(_0xaa30('0x1'));var zipdir=require(_0xaa30('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaa30('0x3'));var moment=require(_0xaa30('0x4'));var BPromise=require(_0xaa30('0x5'));var Mustache=require(_0xaa30('0x6'));var util=require(_0xaa30('0x7'));var path=require(_0xaa30('0x8'));var sox=require(_0xaa30('0x9'));var csv=require('to-csv');var ejs=require(_0xaa30('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaa30('0xb'));var squel=require(_0xaa30('0xc'));var crypto=require(_0xaa30('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xaa30('0xe'));var toCsv=require(_0xaa30('0xf'));var querystring=require(_0xaa30('0x10'));var Papa=require(_0xaa30('0x11'));var Redis=require(_0xaa30('0x12'));var authService=require(_0xaa30('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaa30('0x14'));var logger=require('../../config/logger')(_0xaa30('0x15'));var utils=require(_0xaa30('0x16'));var config=require(_0xaa30('0x17'));var licenseUtil=require(_0xaa30('0x18'));var db=require('../../mysqldb')['db'];config[_0xaa30('0x19')]=_[_0xaa30('0x1a')](config[_0xaa30('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xaa30('0x1b'))(new Redis(config[_0xaa30('0x19')]));require(_0xaa30('0x1c'))[_0xaa30('0x1d')](socket);function respondWithStatusCode(_0x41f1d9,_0x31aa0b){_0x31aa0b=_0x31aa0b||0xcc;return function(_0x3240e9){if(_0x3240e9){return _0x41f1d9[_0xaa30('0x1e')](_0x31aa0b);}return _0x41f1d9[_0xaa30('0x1f')](_0x31aa0b)[_0xaa30('0x20')]();};}function respondWithResult(_0x519518,_0x91839d){_0x91839d=_0x91839d||0xc8;return function(_0x591478){if(_0x591478){return _0x519518['status'](_0x91839d)[_0xaa30('0x21')](_0x591478);}};}function respondWithFilteredResult(_0x153939,_0x130606){return function(_0x540e36){if(_0x540e36){var _0x54fa49=typeof _0x130606['offset']===_0xaa30('0x22')&&typeof _0x130606['limit']===_0xaa30('0x22');var _0x332a0a=_0x540e36['count'];var _0x4e29f9=_0x54fa49?0x0:_0x130606['offset'];var _0x3cbf92=_0x54fa49?_0x540e36[_0xaa30('0x23')]:_0x130606[_0xaa30('0x24')]+_0x130606[_0xaa30('0x25')];var _0x43a526;if(_0x3cbf92>=_0x332a0a){_0x3cbf92=_0x332a0a;_0x43a526=0xc8;}else{_0x43a526=0xce;}_0x153939['status'](_0x43a526);return _0x153939[_0xaa30('0x26')](_0xaa30('0x27'),_0x4e29f9+'-'+_0x3cbf92+'/'+_0x332a0a)[_0xaa30('0x21')](_0x540e36);}return null;};}function patchUpdates(_0x2d9e35){return function(_0x1ff442){try{jsonpatch['apply'](_0x1ff442,_0x2d9e35,!![]);}catch(_0x325b42){return BPromise[_0xaa30('0x28')](_0x325b42);}return _0x1ff442[_0xaa30('0x29')]();};}function saveUpdates(_0x326f84,_0x57d1ca){return function(_0x14d7fa){if(_0x14d7fa){return _0x14d7fa[_0xaa30('0x2a')](_0x326f84)[_0xaa30('0x2b')](function(_0x12da2f){return _0x12da2f;});}return null;};}function removeEntity(_0x97b038,_0x2a59ce){return function(_0x55cccb){if(_0x55cccb){return _0x55cccb[_0xaa30('0x2c')]()[_0xaa30('0x2b')](function(){var _0x5d4da8=_0x55cccb[_0xaa30('0x2d')]({'plain':!![]});var _0x5b3efb=_0xaa30('0x2e');return db[_0xaa30('0x2f')][_0xaa30('0x2c')]({'where':{'type':_0x5b3efb,'resourceId':_0x5d4da8['id']}})[_0xaa30('0x2b')](function(){return _0x55cccb;});})[_0xaa30('0x2b')](function(){_0x97b038[_0xaa30('0x1f')](0xcc)[_0xaa30('0x20')]();});}};}function handleEntityNotFound(_0x39f708,_0x1f288c){return function(_0x43fb30){if(!_0x43fb30){_0x39f708[_0xaa30('0x1e')](0x194);}return _0x43fb30;};}function handleError(_0x43003f,_0x2038a6){_0x2038a6=_0x2038a6||0x1f4;return function(_0x46abb9){logger[_0xaa30('0x30')](_0x46abb9[_0xaa30('0x31')]);if(_0x46abb9[_0xaa30('0x32')]){delete _0x46abb9[_0xaa30('0x32')];}_0x43003f['status'](_0x2038a6)[_0xaa30('0x33')](_0x46abb9);};}exports[_0xaa30('0x34')]=function(_0x3bc22f,_0x20916f){var _0x2276e0={},_0x1dce4a={},_0x4dae71={'count':0x0,'rows':[]};var _0x5addbf=_['map'](db[_0xaa30('0x35')][_0xaa30('0x36')],function(_0xb48ef3){return{'name':_0xb48ef3[_0xaa30('0x37')],'type':_0xb48ef3[_0xaa30('0x38')]['key']};});_0x1dce4a['model']=_[_0xaa30('0x39')](_0x5addbf,_0xaa30('0x32'));_0x1dce4a['query']=_[_0xaa30('0x3a')](_0x3bc22f['query']);_0x1dce4a[_0xaa30('0x3b')]=_['intersection'](_0x1dce4a[_0xaa30('0x3c')],_0x1dce4a[_0xaa30('0x3d')]);_0x2276e0['attributes']=_[_0xaa30('0x3e')](_0x1dce4a[_0xaa30('0x3c')],qs[_0xaa30('0x3f')](_0x3bc22f[_0xaa30('0x3d')][_0xaa30('0x3f')]));_0x2276e0[_0xaa30('0x40')]=_0x2276e0['attributes'][_0xaa30('0x41')]?_0x2276e0[_0xaa30('0x40')]:_0x1dce4a['model'];if(!_0x3bc22f[_0xaa30('0x3d')][_0xaa30('0x42')](_0xaa30('0x43'))){_0x2276e0['limit']=qs['limit'](_0x3bc22f[_0xaa30('0x3d')][_0xaa30('0x25')]);_0x2276e0[_0xaa30('0x24')]=qs[_0xaa30('0x24')](_0x3bc22f[_0xaa30('0x3d')][_0xaa30('0x24')]);}_0x2276e0['order']=qs['sort'](_0x3bc22f[_0xaa30('0x3d')][_0xaa30('0x44')]);_0x2276e0[_0xaa30('0x45')]=qs['filters'](_[_0xaa30('0x46')](_0x3bc22f[_0xaa30('0x3d')],_0x1dce4a[_0xaa30('0x3b')]),_0x5addbf);if(_0x3bc22f[_0xaa30('0x3d')]['filter']){_0x2276e0[_0xaa30('0x45')]=_[_0xaa30('0x47')](_0x2276e0[_0xaa30('0x45')],{'$or':_[_0xaa30('0x39')](_0x5addbf,function(_0x1f6f53){if(_0x1f6f53['type']!==_0xaa30('0x48')){var _0x29cf85={};_0x29cf85[_0x1f6f53[_0xaa30('0x32')]]={'$like':'%'+_0x3bc22f[_0xaa30('0x3d')][_0xaa30('0x49')]+'%'};return _0x29cf85;}})});}_0x2276e0=_[_0xaa30('0x47')]({},_0x2276e0,_0x3bc22f[_0xaa30('0x4a')]);var _0x17510b={'where':_0x2276e0['where']};return db['VoicePrefix'][_0xaa30('0x23')](_0x17510b)['then'](function(_0x5208f8){_0x4dae71['count']=_0x5208f8;if(_0x3bc22f[_0xaa30('0x3d')]['includeAll']){_0x2276e0[_0xaa30('0x4b')]=[{'all':!![]}];}return db['VoicePrefix'][_0xaa30('0x4c')](_0x2276e0);})[_0xaa30('0x2b')](function(_0x3f530e){_0x4dae71[_0xaa30('0x4d')]=_0x3f530e;return _0x4dae71;})[_0xaa30('0x2b')](respondWithFilteredResult(_0x20916f,_0x2276e0))[_0xaa30('0x4e')](handleError(_0x20916f,null));};exports[_0xaa30('0x4f')]=function(_0xc1ae21,_0x3302ff){var _0x521462={'raw':![],'where':{'id':_0xc1ae21['params']['id']}},_0x334639={};_0x334639[_0xaa30('0x3c')]=_[_0xaa30('0x3a')](db[_0xaa30('0x35')][_0xaa30('0x36')]);_0x334639[_0xaa30('0x3d')]=_['keys'](_0xc1ae21['query']);_0x334639[_0xaa30('0x3b')]=_['intersection'](_0x334639[_0xaa30('0x3c')],_0x334639[_0xaa30('0x3d')]);_0x521462[_0xaa30('0x40')]=_[_0xaa30('0x3e')](_0x334639[_0xaa30('0x3c')],qs[_0xaa30('0x3f')](_0xc1ae21[_0xaa30('0x3d')]['fields']));_0x521462[_0xaa30('0x40')]=_0x521462[_0xaa30('0x40')][_0xaa30('0x41')]?_0x521462['attributes']:_0x334639[_0xaa30('0x3c')];if(_0xc1ae21[_0xaa30('0x3d')]['includeAll']){_0x521462[_0xaa30('0x4b')]=[{'all':!![]}];}_0x521462=_['merge']({},_0x521462,_0xc1ae21[_0xaa30('0x4a')]);return db['VoicePrefix']['find'](_0x521462)[_0xaa30('0x2b')](handleEntityNotFound(_0x3302ff,null))['then'](respondWithResult(_0x3302ff,null))['catch'](handleError(_0x3302ff,null));};exports[_0xaa30('0x2c')]=function(_0x1083e2,_0x2574f5){return db[_0xaa30('0x35')][_0xaa30('0x50')]({'where':{'id':_0x1083e2[_0xaa30('0x51')]['id']}})['then'](handleEntityNotFound(_0x2574f5,null))[_0xaa30('0x2b')](removeEntity(_0x2574f5,null))[_0xaa30('0x4e')](handleError(_0x2574f5,null));};exports[_0xaa30('0x52')]=function(_0x57a5fa,_0x53bcaa){return db['VoicePrefix']['describe']()[_0xaa30('0x2b')](respondWithResult(_0x53bcaa,null))[_0xaa30('0x4e')](handleError(_0x53bcaa,null));};exports[_0xaa30('0x53')]=function(_0x1d5c15,_0x1cb3f9){var _0x1ed257;return db['sequelize'][_0xaa30('0x54')](function(_0x2db9d5){return db[_0xaa30('0x35')][_0xaa30('0x53')](_0x1d5c15['body'],{'transaction':_0x2db9d5})[_0xaa30('0x2b')](function(_0x2d23f8){_0x1ed257=_0x2d23f8[_0xaa30('0x2d')]({'plain':!![]});return db[_0xaa30('0x55')][_0xaa30('0x50')]({'where':{'id':_0x1ed257['VoiceExtensionId']},'raw':!![]})['then'](function(_0x34ca1c){return createVoicePrefixExtensions(_0x1ed257,_0x34ca1c,_0x2db9d5);});});})[_0xaa30('0x2b')](function(){var _0x3c4f07=_0x1d5c15['user'][_0xaa30('0x2d')]({'plain':!![]});if(!_0x3c4f07)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3c4f07[_0xaa30('0x56')]===_0xaa30('0x57')){var _0x483a01=_0x1ed257;return db[_0xaa30('0x58')][_0xaa30('0x50')]({'where':{'name':'VoicePrefixes','userProfileId':_0x3c4f07[_0xaa30('0x59')]},'raw':!![]})['then'](function(_0x5b227d){if(_0x5b227d&&_0x5b227d[_0xaa30('0x5a')]===0x0){return db[_0xaa30('0x2f')][_0xaa30('0x53')]({'name':_0x483a01['name'],'resourceId':_0x483a01['id'],'type':_0x5b227d[_0xaa30('0x32')],'sectionId':_0x5b227d['id']},{})[_0xaa30('0x2b')](function(){return _0x1ed257;});}else{return _0x1ed257;}})[_0xaa30('0x4e')](function(_0x949d84){logger[_0xaa30('0x30')](_0xaa30('0x5b'),_0x949d84);throw _0x949d84;});}return _0x1ed257;})[_0xaa30('0x2b')](respondWithResult(_0x1cb3f9,null))[_0xaa30('0x4e')](handleError(_0x1cb3f9,null));};function Extension(_0x242b5a,_0x426b90,_0xb1afa8,_0x2f84fa){this[_0xaa30('0x5c')]='from-sip';this[_0xaa30('0x5d')]=_0x242b5a;this[_0xaa30('0x5e')]=_0xb1afa8;this[_0xaa30('0x38')]='system';this[_0xaa30('0x5f')]=_0xaa30('0x60');this[_0xaa30('0x61')]=_0x426b90;this[_0xaa30('0x62')]=_0x2f84fa;}function createVoicePrefixExtensions(_0x9ee658,_0x2c5959,_0x4f1d54){return new BPromise(function(_0x366205,_0x4f5222){var _0x36242e=new Extension(formatPrefixName(_0x9ee658[_0xaa30('0x63')]),0x1,_0xaa30('0x64'),_0xaa30('0x65'));_0x36242e['VoicePrefixId']=_0x9ee658['id'];return db[_0xaa30('0x55')][_0xaa30('0x53')](_0x36242e,{'transaction':_0x4f1d54})['then'](function(_0x26f6f9){var _0x62b307=_0x26f6f9[_0xaa30('0x2d')]({'plain':!![]});var _0x16097e=_[_0xaa30('0x39')](addVoicePrefixExtensions(_0x9ee658,_0x2c5959),function(_0x13ee8f){_0x13ee8f['VoiceExtensionId']=_0x62b307['id'];_0x13ee8f[_0xaa30('0x66')]=_0x9ee658['id'];return _0x13ee8f;});return db[_0xaa30('0x55')][_0xaa30('0x67')](_0x16097e,{'transaction':_0x4f1d54})[_0xaa30('0x2b')](function(_0x334ef1){if(!_0x334ef1){return _0x4f5222(_0xaa30('0x68'));}else{return _0x366205(_0x334ef1);}})[_0xaa30('0x4e')](function(_0x42da00){return _0x4f5222(_0x42da00);});});;});};function addVoicePrefixExtensions(_0x4318a2,_0x6c968e){var _0x46bdc4=[];var _0x2f4d77=formatPrefixName(_0x4318a2[_0xaa30('0x63')]);_0x46bdc4['push'](new Extension(_0x2f4d77,0x2,_0xaa30('0x69'),'CDR(prefix)='+_0x4318a2[_0xaa30('0x32')]));if(_0x4318a2['callerIdAll']){_0x46bdc4[_0xaa30('0x6a')](new Extension(_0x2f4d77,0x3,_0xaa30('0x69'),_0xaa30('0x6b')+_0x4318a2['callerIdAll']));}else{_0x46bdc4[_0xaa30('0x6a')](new Extension(_0x2f4d77,0x3,_0xaa30('0x64'),'No\x20callerid\x20available'));}_0x46bdc4[_0xaa30('0x6a')](new Extension(_0x2f4d77,0x4,'goto',_0x6c968e[_0xaa30('0x5c')]+','+'${EXTEN:'+(0x8+_0x4318a2['name'][_0xaa30('0x41')])+'}'+','+0x1));return _0x46bdc4;}function formatPrefixName(_0x99d382){var _0xd3e52e='_';for(var _0x313bfa=0x0;_0x313bfa<_0x99d382[_0xaa30('0x41')];_0x313bfa++){if(_0x99d382[_0xaa30('0x6c')](_0x313bfa)=='-'){_0xd3e52e+=_0x99d382[_0xaa30('0x6c')](_0x313bfa);}else{_0xd3e52e+='['+_0x99d382['charAt'](_0x313bfa)+']';}}_0xd3e52e+='.';return _0xd3e52e;}exports[_0xaa30('0x2a')]=function(_0x3f2683,_0x1386a9,_0x4aeb5d){var _0x1f8a61=_0x3f2683[_0xaa30('0x6d')];_0x1f8a61[_0xaa30('0x63')]='system-'+_0x1f8a61[_0xaa30('0x32')]+'-';return db['sequelize'][_0xaa30('0x54')](function(_0x4d2787){return db['VoicePrefix'][_0xaa30('0x2a')](_0x1f8a61,{'where':{'id':_0x1f8a61['id']},'transaction':_0x4d2787})[_0xaa30('0x2b')](function(){return db['VoiceExtension'][_0xaa30('0x2c')]({'where':{'VoicePrefixId':_0x1f8a61['id']},'transaction':_0x4d2787})[_0xaa30('0x2b')](function(){return db[_0xaa30('0x55')]['find']({'where':{'id':_0x1f8a61[_0xaa30('0x6e')]},'raw':!![]})[_0xaa30('0x2b')](function(_0x23daeb){return createVoicePrefixExtensions(_0x1f8a61,_0x23daeb,_0x4d2787);});});});})[_0xaa30('0x2b')](function(){return db[_0xaa30('0x35')][_0xaa30('0x6f')](_0x1f8a61['id']);})[_0xaa30('0x2b')](respondWithResult(_0x1386a9,null))['catch'](handleError(_0x1386a9,null));};exports[_0xaa30('0x70')]=function(_0x37c3ee,_0x112dc3,_0x25977d){return db['VoicePrefix'][_0xaa30('0x50')]({'where':{'id':_0x37c3ee[_0xaa30('0x51')]['id']}})['then'](handleEntityNotFound(_0x112dc3,null))[_0xaa30('0x2b')](function(_0x2d9dd8){if(_0x2d9dd8){return _0x2d9dd8[_0xaa30('0x70')](_0x37c3ee[_0xaa30('0x6d')][_0xaa30('0x71')],_[_0xaa30('0x72')](_0x37c3ee['body'],[_0xaa30('0x71'),'id'])||{})[_0xaa30('0x73')](function(_0x5948b4){for(var _0x2aa0ce=0x0;_0x2aa0ce<_0x37c3ee[_0xaa30('0x6d')][_0xaa30('0x71')][_0xaa30('0x41')];_0x2aa0ce+=0x1){socket[_0xaa30('0x74')]('userVoicePrefix:save',{'UserId':Number(_0x37c3ee[_0xaa30('0x6d')][_0xaa30('0x71')][_0x2aa0ce]),'VoicePrefixId':Number(_0x37c3ee[_0xaa30('0x51')]['id'])});}return _0x5948b4;});}})[_0xaa30('0x2b')](respondWithResult(_0x112dc3,null))[_0xaa30('0x4e')](handleError(_0x112dc3,null));};exports[_0xaa30('0x75')]=function(_0x5d3d83,_0x1e3a19,_0x467134){return db['VoicePrefix']['find']({'where':{'id':_0x5d3d83[_0xaa30('0x51')]['id']}})[_0xaa30('0x2b')](handleEntityNotFound(_0x1e3a19,null))[_0xaa30('0x2b')](function(_0x100f18){if(_0x100f18){return _0x100f18[_0xaa30('0x75')](_0x5d3d83[_0xaa30('0x3d')][_0xaa30('0x71')])['then'](function(){if(_['isArray'](_0x5d3d83['query'][_0xaa30('0x71')])){for(var _0x25ebba=0x0;_0x25ebba<_0x5d3d83[_0xaa30('0x3d')][_0xaa30('0x71')][_0xaa30('0x41')];_0x25ebba+=0x1){socket['emit'](_0xaa30('0x76'),{'UserId':Number(_0x5d3d83[_0xaa30('0x3d')][_0xaa30('0x71')][_0x25ebba]),'VoicePrefixId':Number(_0x5d3d83[_0xaa30('0x51')]['id'])});}}else{socket[_0xaa30('0x74')](_0xaa30('0x76'),{'UserId':Number(_0x5d3d83[_0xaa30('0x3d')][_0xaa30('0x71')]),'VoicePrefixId':Number(_0x5d3d83['params']['id'])});}});}})['then'](respondWithStatusCode(_0x1e3a19,null))['catch'](handleError(_0x1e3a19,null));};exports[_0xaa30('0x77')]=function(_0x408362,_0x541d3b,_0x775047){var _0xe9e4={};var _0x15e3ae={};var _0x33551c;var _0x404f82;return db['VoicePrefix'][_0xaa30('0x78')]({'where':{'id':_0x408362[_0xaa30('0x51')]['id']}})[_0xaa30('0x2b')](handleEntityNotFound(_0x541d3b,null))['then'](function(_0x21b87b){if(_0x21b87b){_0x33551c=_0x21b87b;_0x15e3ae[_0xaa30('0x3c')]=_[_0xaa30('0x3a')](db[_0xaa30('0x79')][_0xaa30('0x36')]);_0x15e3ae[_0xaa30('0x3d')]=_[_0xaa30('0x3a')](_0x408362['query']);_0x15e3ae[_0xaa30('0x3b')]=_[_0xaa30('0x3e')](_0x15e3ae[_0xaa30('0x3c')],_0x15e3ae[_0xaa30('0x3d')]);_0xe9e4[_0xaa30('0x40')]=_[_0xaa30('0x3e')](_0x15e3ae[_0xaa30('0x3c')],qs[_0xaa30('0x3f')](_0x408362[_0xaa30('0x3d')][_0xaa30('0x3f')]));_0xe9e4[_0xaa30('0x40')]=_0xe9e4[_0xaa30('0x40')][_0xaa30('0x41')]?_0xe9e4['attributes']:_0x15e3ae[_0xaa30('0x3c')];_0xe9e4['order']=qs[_0xaa30('0x44')](_0x408362[_0xaa30('0x3d')][_0xaa30('0x44')]);_0xe9e4[_0xaa30('0x45')]=qs[_0xaa30('0x3b')](_[_0xaa30('0x46')](_0x408362[_0xaa30('0x3d')],_0x15e3ae[_0xaa30('0x3b')]));if(_0x408362[_0xaa30('0x3d')][_0xaa30('0x49')]){_0xe9e4[_0xaa30('0x45')]=_[_0xaa30('0x47')](_0xe9e4[_0xaa30('0x45')],{'$or':_[_0xaa30('0x39')](_0xe9e4[_0xaa30('0x40')],function(_0x3744b3){var _0x35a47f={};_0x35a47f[_0x3744b3]={'$like':'%'+_0x408362[_0xaa30('0x3d')][_0xaa30('0x49')]+'%'};return _0x35a47f;})});}_0xe9e4=_['merge']({},_0xe9e4,_0x408362[_0xaa30('0x4a')]);return _0x33551c[_0xaa30('0x77')](_0xe9e4);}})[_0xaa30('0x2b')](function(_0x3a67b3){if(_0x3a67b3){_0x404f82=_0x3a67b3[_0xaa30('0x41')];if(!_0x408362[_0xaa30('0x3d')][_0xaa30('0x42')]('nolimit')){_0xe9e4[_0xaa30('0x25')]=qs[_0xaa30('0x25')](_0x408362['query'][_0xaa30('0x25')]);_0xe9e4[_0xaa30('0x24')]=qs['offset'](_0x408362[_0xaa30('0x3d')][_0xaa30('0x24')]);}return _0x33551c[_0xaa30('0x77')](_0xe9e4);}})[_0xaa30('0x2b')](function(_0x5eb209){if(_0x5eb209){return _0x5eb209?{'count':_0x404f82,'rows':_0x5eb209}:null;}})[_0xaa30('0x2b')](respondWithResult(_0x541d3b,null))['catch'](handleError(_0x541d3b,null));};exports[_0xaa30('0x7a')]=function(_0x41480f,_0x24f60f,_0x3fb561){var _0x24a3af={};var _0x4412d4={};var _0x45ffba;var _0x2e73e1;return db[_0xaa30('0x35')]['findOne']({'where':{'id':_0x41480f[_0xaa30('0x51')]['id']}})[_0xaa30('0x2b')](handleEntityNotFound(_0x24f60f,null))['then'](function(_0x1f48c1){if(_0x1f48c1){_0x45ffba=_0x1f48c1;_0x4412d4[_0xaa30('0x3c')]=_['keys'](db[_0xaa30('0x7b')][_0xaa30('0x36')]);_0x4412d4['query']=_[_0xaa30('0x3a')](_0x41480f['query']);_0x4412d4['filters']=_[_0xaa30('0x3e')](_0x4412d4[_0xaa30('0x3c')],_0x4412d4['query']);_0x24a3af['attributes']=_[_0xaa30('0x3e')](_0x4412d4[_0xaa30('0x3c')],qs['fields'](_0x41480f[_0xaa30('0x3d')]['fields']));_0x24a3af['attributes']=_0x24a3af[_0xaa30('0x40')]['length']?_0x24a3af[_0xaa30('0x40')]:_0x4412d4['model'];_0x24a3af[_0xaa30('0x7c')]=qs[_0xaa30('0x44')](_0x41480f[_0xaa30('0x3d')][_0xaa30('0x44')]);_0x24a3af[_0xaa30('0x45')]=qs[_0xaa30('0x3b')](_[_0xaa30('0x46')](_0x41480f[_0xaa30('0x3d')],_0x4412d4[_0xaa30('0x3b')]));if(_0x41480f['query']['filter']){_0x24a3af[_0xaa30('0x45')]=_[_0xaa30('0x47')](_0x24a3af[_0xaa30('0x45')],{'$or':_['map'](_0x24a3af['attributes'],function(_0x46df1d){var _0x554b6b={};_0x554b6b[_0x46df1d]={'$like':'%'+_0x41480f[_0xaa30('0x3d')][_0xaa30('0x49')]+'%'};return _0x554b6b;})});}_0x24a3af=_[_0xaa30('0x47')]({},_0x24a3af,_0x41480f[_0xaa30('0x4a')]);return _0x45ffba['getTeams'](_0x24a3af);}})[_0xaa30('0x2b')](function(_0x5d061b){if(_0x5d061b){_0x2e73e1=_0x5d061b[_0xaa30('0x41')];if(!_0x41480f[_0xaa30('0x3d')][_0xaa30('0x42')](_0xaa30('0x43'))){_0x24a3af['limit']=qs[_0xaa30('0x25')](_0x41480f[_0xaa30('0x3d')]['limit']);_0x24a3af[_0xaa30('0x24')]=qs['offset'](_0x41480f[_0xaa30('0x3d')]['offset']);}return _0x45ffba[_0xaa30('0x7a')](_0x24a3af);}})[_0xaa30('0x2b')](function(_0x11dd5e){if(_0x11dd5e){return _0x11dd5e?{'count':_0x2e73e1,'rows':_0x11dd5e}:null;}})[_0xaa30('0x2b')](respondWithResult(_0x24f60f,null))[_0xaa30('0x4e')](handleError(_0x24f60f,null));};exports[_0xaa30('0x7d')]=function(_0x2f90db,_0x3f382a,_0x36f739){var _0x5687ef=_0x2f90db[_0xaa30('0x6d')][_0xaa30('0x71')];var _0x21e8c7;return db['Team'][_0xaa30('0x4c')]({'where':{'id':_0x5687ef},'attributes':['id'],'include':[{'model':db[_0xaa30('0x79')],'as':_0xaa30('0x7e'),'attributes':['id',_0xaa30('0x32'),_0xaa30('0x7f'),_0xaa30('0x80'),_0xaa30('0x81')],'raw':!![]}]})[_0xaa30('0x2b')](function(_0x16e95c){if(_0x16e95c){_0x21e8c7=_0x16e95c;var _0x4dc93c=_[_0xaa30('0x82')](_0x16e95c,function(_0x25dca3){var _0x13521a=_0x25dca3['get']({'plain':!![]});return _0x13521a[_0xaa30('0x7e')];});return db[_0xaa30('0x35')]['find']({'where':{'id':_0x2f90db[_0xaa30('0x51')]['id']}})['then'](function(_0x51a37a){return db[_0xaa30('0x83')][_0xaa30('0x54')](function(_0xcf7c59){return _0x51a37a[_0xaa30('0x7d')](_0x5687ef,{'transaction':_0xcf7c59})['then'](function(){return BPromise['each'](_0x21e8c7,function(_0x4240d0){return db[_0xaa30('0x84')][_0xaa30('0x85')]({'TeamId':_0x4240d0['id'],'VoicePrefixId':_0x2f90db[_0xaa30('0x51')]['id']},{'transaction':_0xcf7c59});});})[_0xaa30('0x2b')](function(){return BPromise['each'](_0x4dc93c,function(_0x7db5d7){return db['UserVoicePrefix'][_0xaa30('0x86')]({'where':{'UserId':_0x7db5d7['id'],'VoicePrefixId':_0x2f90db[_0xaa30('0x51')]['id']},'transaction':_0xcf7c59});});})[_0xaa30('0x2b')](function(){_0x4dc93c['forEach'](function(_0x1c25b1){socket[_0xaa30('0x74')](_0xaa30('0x87'),{'UserId':_0x1c25b1['id'],'VoicePrefixId':_0x51a37a['id']});});});});});}})[_0xaa30('0x2b')](respondWithStatusCode(_0x3f382a,null))[_0xaa30('0x4e')](handleError(_0x3f382a,null));};exports[_0xaa30('0x88')]=function(_0x51fb85,_0x133a0f,_0x1bd3c2){return db['Team']['findAll']({'where':{'id':_0x51fb85[_0xaa30('0x3d')][_0xaa30('0x71')]},'attributes':['id'],'include':[{'model':db[_0xaa30('0x79')],'as':_0xaa30('0x7e'),'attributes':['id'],'raw':!![]}]})[_0xaa30('0x2b')](handleEntityNotFound(_0x133a0f,null))[_0xaa30('0x2b')](function(_0x3dd250){var _0x2ec205=_[_0xaa30('0x39')](_0x3dd250,'id');var _0x211916=[];var _0x4bba25=[];var _0x73c665=squel['select']();_0x73c665['field'](_0xaa30('0x89'))[_0xaa30('0x8a')](_0xaa30('0x8b'),'tq')['join'](_0xaa30('0x8c'),'ut',_0xaa30('0x8d'))['where'](_0xaa30('0x8e'),_0x51fb85[_0xaa30('0x51')]['id']);for(var _0x2ebaa0=0x0;_0x2ebaa0<_0x3dd250[_0xaa30('0x41')];_0x2ebaa0+=0x1){let _0x420276=_0x3dd250[_0x2ebaa0];for(var _0x2c48a2=0x0;_0x2c48a2<_0x420276['Agents'][_0xaa30('0x41')];_0x2c48a2+=0x1){let _0x206fc4=_0x420276[_0xaa30('0x7e')][_0x2c48a2];var _0x24fccc=_0x73c665[_0xaa30('0x8f')]();_0x24fccc[_0xaa30('0x45')](_0xaa30('0x90'),_0x206fc4['id']);_0x4bba25['push'](db['sequelize'][_0xaa30('0x3d')](_0x24fccc[_0xaa30('0x91')](),{'type':db[_0xaa30('0x83')][_0xaa30('0x92')][_0xaa30('0x93')]})[_0xaa30('0x2b')](function(_0x162810){if(_0x162810[_0xaa30('0x41')]===0x1){return _0x206fc4['id'];}else{var _0x2ed461=_[_0xaa30('0x94')](_[_0xaa30('0x39')](_0x162810,'TeamId'),function(_0x5c21e){return _[_0xaa30('0x95')](_0x2ec205,_0x5c21e);});if(_0x2ed461){return _0x206fc4['id'];}}}));}}return BPromise[_0xaa30('0x96')](_0x4bba25)[_0xaa30('0x2b')](function(_0x46c9a5){_0x211916=_(_0x211916)[_0xaa30('0x97')](_0x46c9a5)[_0xaa30('0x98')]()[_0xaa30('0x99')]();return db[_0xaa30('0x35')][_0xaa30('0x50')]({'where':{'id':_0x51fb85[_0xaa30('0x51')]['id']}})[_0xaa30('0x2b')](function(_0x4cc3f0){return db[_0xaa30('0x83')][_0xaa30('0x54')](function(_0x31bdf6){return _0x4cc3f0['removeTeams'](_0x51fb85['query'][_0xaa30('0x71')],{'transaction':_0x31bdf6})['then'](function(){if(!_[_0xaa30('0x9a')](_0x211916)){return _0x4cc3f0['removeAgents'](_0x211916,{'transaction':_0x31bdf6});}})[_0xaa30('0x2b')](function(){_0x211916[_0xaa30('0x9b')](function(_0xb148d9){socket[_0xaa30('0x74')]('userVoicePrefix:remove',{'UserId':_0xb148d9,'VoicePrefixId':_0x4cc3f0['id']});});});});});});})[_0xaa30('0x2b')](respondWithStatusCode(_0x133a0f,null))[_0xaa30('0x4e')](handleError(_0x133a0f,null));}; \ No newline at end of file +var _0xd943=['isArray','userVoicePrefix:remove','getAgents','User','getTeams','Team','addTeams','Agents','online','flatMap','sequelize','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate','forEach','userVoicePrefix:save','removeTeams','select','field','tq.TeamId','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','toString','QueryTypes','every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','ejs','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','VoicePrefixes','UserProfileResource','destroy','error','name','index','map','VoicePrefix','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','rawAttributes','merge','options','find','catch','params','describe','create','transaction','VoiceExtension','VoiceExtensionId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','app','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','PREFIX-CALLERIDALL=','callerIdAll','${EXTEN:','charAt','body','system-','findById','addAgents','ids','omit','emit'];(function(_0x56ed0f,_0x2f2b2b){var _0x5110d4=function(_0x24c679){while(--_0x24c679){_0x56ed0f['push'](_0x56ed0f['shift']());}};_0x5110d4(++_0x2f2b2b);}(_0xd943,0x15d));var _0x3d94=function(_0x1336f1,_0x2020c3){_0x1336f1=_0x1336f1-0x0;var _0x33b4e7=_0xd943[_0x1336f1];return _0x33b4e7;};'use strict';var emlformat=require(_0x3d94('0x0'));var rimraf=require(_0x3d94('0x1'));var zipdir=require(_0x3d94('0x2'));var jsonpatch=require(_0x3d94('0x3'));var rp=require('request-promise');var moment=require(_0x3d94('0x4'));var BPromise=require(_0x3d94('0x5'));var Mustache=require(_0x3d94('0x6'));var util=require(_0x3d94('0x7'));var path=require(_0x3d94('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3d94('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x3d94('0xa'));var jsforce=require(_0x3d94('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3d94('0xc'));var Papa=require(_0x3d94('0xd'));var Redis=require(_0x3d94('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x3d94('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3d94('0x10'));var logger=require(_0x3d94('0x11'))('api');var utils=require(_0x3d94('0x12'));var config=require(_0x3d94('0x13'));var licenseUtil=require(_0x3d94('0x14'));var db=require(_0x3d94('0x15'))['db'];config[_0x3d94('0x16')]=_['defaults'](config[_0x3d94('0x16')],{'host':_0x3d94('0x17'),'port':0x18eb});var socket=require(_0x3d94('0x18'))(new Redis(config['redis']));require(_0x3d94('0x19'))[_0x3d94('0x1a')](socket);function respondWithStatusCode(_0x7d6969,_0x5d9366){_0x5d9366=_0x5d9366||0xcc;return function(_0x14ea5f){if(_0x14ea5f){return _0x7d6969[_0x3d94('0x1b')](_0x5d9366);}return _0x7d6969[_0x3d94('0x1c')](_0x5d9366)[_0x3d94('0x1d')]();};}function respondWithResult(_0xaf939a,_0xd8efaa){_0xd8efaa=_0xd8efaa||0xc8;return function(_0x31c6e8){if(_0x31c6e8){return _0xaf939a[_0x3d94('0x1c')](_0xd8efaa)['json'](_0x31c6e8);}};}function respondWithFilteredResult(_0x22676a,_0x1a9315){return function(_0x2acee3){if(_0x2acee3){var _0x1c35a8=typeof _0x1a9315[_0x3d94('0x1e')]===_0x3d94('0x1f')&&typeof _0x1a9315[_0x3d94('0x20')]==='undefined';var _0x9bca24=_0x2acee3['count'];var _0x28bead=_0x1c35a8?0x0:_0x1a9315[_0x3d94('0x1e')];var _0x16a6d0=_0x1c35a8?_0x2acee3[_0x3d94('0x21')]:_0x1a9315[_0x3d94('0x1e')]+_0x1a9315['limit'];var _0x578002;if(_0x16a6d0>=_0x9bca24){_0x16a6d0=_0x9bca24;_0x578002=0xc8;}else{_0x578002=0xce;}_0x22676a[_0x3d94('0x1c')](_0x578002);return _0x22676a[_0x3d94('0x22')](_0x3d94('0x23'),_0x28bead+'-'+_0x16a6d0+'/'+_0x9bca24)['json'](_0x2acee3);}return null;};}function patchUpdates(_0x30af25){return function(_0x2e8c91){try{jsonpatch[_0x3d94('0x24')](_0x2e8c91,_0x30af25,!![]);}catch(_0x384f76){return BPromise[_0x3d94('0x25')](_0x384f76);}return _0x2e8c91[_0x3d94('0x26')]();};}function saveUpdates(_0x295493,_0x27f978){return function(_0xee7b8d){if(_0xee7b8d){return _0xee7b8d[_0x3d94('0x27')](_0x295493)[_0x3d94('0x28')](function(_0x192839){return _0x192839;});}return null;};}function removeEntity(_0x292976,_0x3496c3){return function(_0x2945d2){if(_0x2945d2){return _0x2945d2['destroy']()[_0x3d94('0x28')](function(){var _0x558fd2=_0x2945d2[_0x3d94('0x29')]({'plain':!![]});var _0x1d0a7a=_0x3d94('0x2a');return db[_0x3d94('0x2b')][_0x3d94('0x2c')]({'where':{'type':_0x1d0a7a,'resourceId':_0x558fd2['id']}})[_0x3d94('0x28')](function(){return _0x2945d2;});})[_0x3d94('0x28')](function(){_0x292976['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x362642,_0x4813e1){return function(_0x4dd410){if(!_0x4dd410){_0x362642[_0x3d94('0x1b')](0x194);}return _0x4dd410;};}function handleError(_0x58c0d0,_0x19bfd4){_0x19bfd4=_0x19bfd4||0x1f4;return function(_0xef9644){logger[_0x3d94('0x2d')](_0xef9644['stack']);if(_0xef9644[_0x3d94('0x2e')]){delete _0xef9644['name'];}_0x58c0d0[_0x3d94('0x1c')](_0x19bfd4)['send'](_0xef9644);};}exports[_0x3d94('0x2f')]=function(_0x215ad7,_0x29b1ff){var _0x246f88={},_0x50560c={},_0x18f854={'count':0x0,'rows':[]};var _0x51f634=_[_0x3d94('0x30')](db[_0x3d94('0x31')]['rawAttributes'],function(_0x5288da){return{'name':_0x5288da[_0x3d94('0x32')],'type':_0x5288da[_0x3d94('0x33')][_0x3d94('0x34')]};});_0x50560c['model']=_[_0x3d94('0x30')](_0x51f634,_0x3d94('0x2e'));_0x50560c['query']=_[_0x3d94('0x35')](_0x215ad7[_0x3d94('0x36')]);_0x50560c[_0x3d94('0x37')]=_[_0x3d94('0x38')](_0x50560c[_0x3d94('0x39')],_0x50560c['query']);_0x246f88[_0x3d94('0x3a')]=_[_0x3d94('0x38')](_0x50560c[_0x3d94('0x39')],qs[_0x3d94('0x3b')](_0x215ad7[_0x3d94('0x36')][_0x3d94('0x3b')]));_0x246f88['attributes']=_0x246f88['attributes'][_0x3d94('0x3c')]?_0x246f88[_0x3d94('0x3a')]:_0x50560c[_0x3d94('0x39')];if(!_0x215ad7[_0x3d94('0x36')][_0x3d94('0x3d')](_0x3d94('0x3e'))){_0x246f88[_0x3d94('0x20')]=qs[_0x3d94('0x20')](_0x215ad7[_0x3d94('0x36')][_0x3d94('0x20')]);_0x246f88['offset']=qs[_0x3d94('0x1e')](_0x215ad7[_0x3d94('0x36')][_0x3d94('0x1e')]);}_0x246f88[_0x3d94('0x3f')]=qs['sort'](_0x215ad7[_0x3d94('0x36')][_0x3d94('0x40')]);_0x246f88[_0x3d94('0x41')]=qs[_0x3d94('0x37')](_[_0x3d94('0x42')](_0x215ad7['query'],_0x50560c[_0x3d94('0x37')]),_0x51f634);if(_0x215ad7[_0x3d94('0x36')][_0x3d94('0x43')]){_0x246f88['where']=_['merge'](_0x246f88['where'],{'$or':_['map'](_0x51f634,function(_0x3b3550){if(_0x3b3550[_0x3d94('0x33')]!==_0x3d94('0x44')){var _0x146ccb={};_0x146ccb[_0x3b3550[_0x3d94('0x2e')]]={'$like':'%'+_0x215ad7[_0x3d94('0x36')][_0x3d94('0x43')]+'%'};return _0x146ccb;}})});}_0x246f88=_['merge']({},_0x246f88,_0x215ad7['options']);var _0x118fda={'where':_0x246f88[_0x3d94('0x41')]};return db['VoicePrefix'][_0x3d94('0x21')](_0x118fda)['then'](function(_0x1361fb){_0x18f854[_0x3d94('0x21')]=_0x1361fb;if(_0x215ad7[_0x3d94('0x36')][_0x3d94('0x45')]){_0x246f88[_0x3d94('0x46')]=[{'all':!![]}];}return db['VoicePrefix'][_0x3d94('0x47')](_0x246f88);})[_0x3d94('0x28')](function(_0x18a70c){_0x18f854['rows']=_0x18a70c;return _0x18f854;})[_0x3d94('0x28')](respondWithFilteredResult(_0x29b1ff,_0x246f88))['catch'](handleError(_0x29b1ff,null));};exports['show']=function(_0x3f4b32,_0x402132){var _0x6190cc={'raw':![],'where':{'id':_0x3f4b32['params']['id']}},_0xfeae3a={};_0xfeae3a[_0x3d94('0x39')]=_['keys'](db[_0x3d94('0x31')][_0x3d94('0x48')]);_0xfeae3a[_0x3d94('0x36')]=_[_0x3d94('0x35')](_0x3f4b32[_0x3d94('0x36')]);_0xfeae3a[_0x3d94('0x37')]=_[_0x3d94('0x38')](_0xfeae3a['model'],_0xfeae3a[_0x3d94('0x36')]);_0x6190cc[_0x3d94('0x3a')]=_['intersection'](_0xfeae3a['model'],qs[_0x3d94('0x3b')](_0x3f4b32[_0x3d94('0x36')]['fields']));_0x6190cc[_0x3d94('0x3a')]=_0x6190cc[_0x3d94('0x3a')][_0x3d94('0x3c')]?_0x6190cc[_0x3d94('0x3a')]:_0xfeae3a[_0x3d94('0x39')];if(_0x3f4b32[_0x3d94('0x36')][_0x3d94('0x45')]){_0x6190cc[_0x3d94('0x46')]=[{'all':!![]}];}_0x6190cc=_[_0x3d94('0x49')]({},_0x6190cc,_0x3f4b32[_0x3d94('0x4a')]);return db[_0x3d94('0x31')][_0x3d94('0x4b')](_0x6190cc)[_0x3d94('0x28')](handleEntityNotFound(_0x402132,null))[_0x3d94('0x28')](respondWithResult(_0x402132,null))[_0x3d94('0x4c')](handleError(_0x402132,null));};exports['destroy']=function(_0x44df82,_0x22e2b8){return db[_0x3d94('0x31')][_0x3d94('0x4b')]({'where':{'id':_0x44df82[_0x3d94('0x4d')]['id']}})[_0x3d94('0x28')](handleEntityNotFound(_0x22e2b8,null))[_0x3d94('0x28')](removeEntity(_0x22e2b8,null))[_0x3d94('0x4c')](handleError(_0x22e2b8,null));};exports[_0x3d94('0x4e')]=function(_0x5465a5,_0x88ec05){return db['VoicePrefix'][_0x3d94('0x4e')]()[_0x3d94('0x28')](respondWithResult(_0x88ec05,null))['catch'](handleError(_0x88ec05,null));};exports[_0x3d94('0x4f')]=function(_0x49f544,_0x567751){var _0x335247;return db['sequelize'][_0x3d94('0x50')](function(_0x132e0b){return db['VoicePrefix'][_0x3d94('0x4f')](_0x49f544['body'],{'transaction':_0x132e0b})['then'](function(_0x1a91d9){_0x335247=_0x1a91d9[_0x3d94('0x29')]({'plain':!![]});return db[_0x3d94('0x51')][_0x3d94('0x4b')]({'where':{'id':_0x335247[_0x3d94('0x52')]},'raw':!![]})[_0x3d94('0x28')](function(_0x137052){return createVoicePrefixExtensions(_0x335247,_0x137052,_0x132e0b);});});})[_0x3d94('0x28')](function(){var _0xae892=_0x49f544['user'][_0x3d94('0x29')]({'plain':!![]});if(!_0xae892)throw new Error(_0x3d94('0x53'));if(_0xae892[_0x3d94('0x54')]===_0x3d94('0x55')){var _0xe7d1dc=_0x335247;return db[_0x3d94('0x56')][_0x3d94('0x4b')]({'where':{'name':_0x3d94('0x2a'),'userProfileId':_0xae892[_0x3d94('0x57')]},'raw':!![]})[_0x3d94('0x28')](function(_0x1fd806){if(_0x1fd806&&_0x1fd806['autoAssociation']===0x0){return db[_0x3d94('0x2b')]['create']({'name':_0xe7d1dc[_0x3d94('0x2e')],'resourceId':_0xe7d1dc['id'],'type':_0x1fd806[_0x3d94('0x2e')],'sectionId':_0x1fd806['id']},{})[_0x3d94('0x28')](function(){return _0x335247;});}else{return _0x335247;}})[_0x3d94('0x4c')](function(_0x3a837b){logger[_0x3d94('0x2d')](_0x3d94('0x58'),_0x3a837b);throw _0x3a837b;});}return _0x335247;})[_0x3d94('0x28')](respondWithResult(_0x567751,null))[_0x3d94('0x4c')](handleError(_0x567751,null));};function Extension(_0x5da38c,_0x519ada,_0x46bff3,_0x4bd97c){this[_0x3d94('0x59')]=_0x3d94('0x5a');this['exten']=_0x5da38c;this[_0x3d94('0x5b')]=_0x46bff3;this[_0x3d94('0x33')]=_0x3d94('0x5c');this[_0x3d94('0x5d')]=_0x3d94('0x5e');this[_0x3d94('0x5f')]=_0x519ada;this[_0x3d94('0x60')]=_0x4bd97c;}function createVoicePrefixExtensions(_0x4b023e,_0x22dbf9,_0x351ea6){return new BPromise(function(_0x368581,_0x4b23b5){var _0x2d8b49=new Extension(formatPrefixName(_0x4b023e[_0x3d94('0x61')]),0x1,_0x3d94('0x62'),_0x3d94('0x63'));_0x2d8b49['VoicePrefixId']=_0x4b023e['id'];return db['VoiceExtension'][_0x3d94('0x4f')](_0x2d8b49,{'transaction':_0x351ea6})[_0x3d94('0x28')](function(_0x4190ef){var _0x3eaecc=_0x4190ef['get']({'plain':!![]});var _0x1c12da=_[_0x3d94('0x30')](addVoicePrefixExtensions(_0x4b023e,_0x22dbf9),function(_0x49bfb0){_0x49bfb0[_0x3d94('0x52')]=_0x3eaecc['id'];_0x49bfb0[_0x3d94('0x64')]=_0x4b023e['id'];return _0x49bfb0;});return db[_0x3d94('0x51')]['bulkCreate'](_0x1c12da,{'transaction':_0x351ea6})[_0x3d94('0x28')](function(_0x227372){if(!_0x227372){return _0x4b23b5(_0x3d94('0x65'));}else{return _0x368581(_0x227372);}})['catch'](function(_0x11eeaa){return _0x4b23b5(_0x11eeaa);});});;});};function addVoicePrefixExtensions(_0x68c033,_0x5c7aac){var _0x4d291e=[];var _0x4e1932=formatPrefixName(_0x68c033[_0x3d94('0x61')]);_0x4d291e[_0x3d94('0x66')](new Extension(_0x4e1932,0x2,_0x3d94('0x67'),_0x3d94('0x68')+_0x68c033[_0x3d94('0x2e')]));if(_0x68c033['callerIdAll']){_0x4d291e[_0x3d94('0x66')](new Extension(_0x4e1932,0x3,_0x3d94('0x67'),_0x3d94('0x69')+_0x68c033[_0x3d94('0x6a')]));}else{_0x4d291e[_0x3d94('0x66')](new Extension(_0x4e1932,0x3,_0x3d94('0x62'),'No\x20callerid\x20available'));}_0x4d291e[_0x3d94('0x66')](new Extension(_0x4e1932,0x4,'goto',_0x5c7aac[_0x3d94('0x59')]+','+_0x3d94('0x6b')+(0x8+_0x68c033[_0x3d94('0x2e')][_0x3d94('0x3c')])+'}'+','+0x1));return _0x4d291e;}function formatPrefixName(_0x128fdc){var _0x350ad3='_';for(var _0x48b108=0x0;_0x48b108<_0x128fdc['length'];_0x48b108++){if(_0x128fdc[_0x3d94('0x6c')](_0x48b108)=='-'){_0x350ad3+=_0x128fdc['charAt'](_0x48b108);}else{_0x350ad3+='['+_0x128fdc['charAt'](_0x48b108)+']';}}_0x350ad3+='.';return _0x350ad3;}exports['update']=function(_0x3c7dc4,_0x262a6a,_0x222963){var _0x396146=_0x3c7dc4[_0x3d94('0x6d')];_0x396146[_0x3d94('0x61')]=_0x3d94('0x6e')+_0x396146[_0x3d94('0x2e')]+'-';return db['sequelize'][_0x3d94('0x50')](function(_0x5e55a4){return db[_0x3d94('0x31')][_0x3d94('0x27')](_0x396146,{'where':{'id':_0x396146['id']},'transaction':_0x5e55a4})[_0x3d94('0x28')](function(){return db['VoiceExtension']['destroy']({'where':{'VoicePrefixId':_0x396146['id']},'transaction':_0x5e55a4})['then'](function(){return db[_0x3d94('0x51')][_0x3d94('0x4b')]({'where':{'id':_0x396146[_0x3d94('0x52')]},'raw':!![]})[_0x3d94('0x28')](function(_0x2382df){return createVoicePrefixExtensions(_0x396146,_0x2382df,_0x5e55a4);});});});})['then'](function(){return db['VoicePrefix'][_0x3d94('0x6f')](_0x396146['id']);})[_0x3d94('0x28')](respondWithResult(_0x262a6a,null))[_0x3d94('0x4c')](handleError(_0x262a6a,null));};exports['addAgents']=function(_0x46a9af,_0x53d471,_0x255d56){return db[_0x3d94('0x31')][_0x3d94('0x4b')]({'where':{'id':_0x46a9af[_0x3d94('0x4d')]['id']}})[_0x3d94('0x28')](handleEntityNotFound(_0x53d471,null))[_0x3d94('0x28')](function(_0x234bce){if(_0x234bce){return _0x234bce[_0x3d94('0x70')](_0x46a9af[_0x3d94('0x6d')][_0x3d94('0x71')],_[_0x3d94('0x72')](_0x46a9af[_0x3d94('0x6d')],[_0x3d94('0x71'),'id'])||{})['spread'](function(_0x2a6df3){for(var _0x2819e2=0x0;_0x2819e2<_0x46a9af[_0x3d94('0x6d')][_0x3d94('0x71')]['length'];_0x2819e2+=0x1){socket[_0x3d94('0x73')]('userVoicePrefix:save',{'UserId':Number(_0x46a9af['body'][_0x3d94('0x71')][_0x2819e2]),'VoicePrefixId':Number(_0x46a9af['params']['id'])});}return _0x2a6df3;});}})[_0x3d94('0x28')](respondWithResult(_0x53d471,null))[_0x3d94('0x4c')](handleError(_0x53d471,null));};exports['removeAgents']=function(_0x4558ff,_0x4acb44,_0x3b612f){return db[_0x3d94('0x31')]['find']({'where':{'id':_0x4558ff['params']['id']}})['then'](handleEntityNotFound(_0x4acb44,null))[_0x3d94('0x28')](function(_0x5b2dd6){if(_0x5b2dd6){return _0x5b2dd6['removeAgents'](_0x4558ff[_0x3d94('0x36')][_0x3d94('0x71')])[_0x3d94('0x28')](function(){if(_[_0x3d94('0x74')](_0x4558ff['query'][_0x3d94('0x71')])){for(var _0x3fc0e7=0x0;_0x3fc0e7<_0x4558ff[_0x3d94('0x36')][_0x3d94('0x71')][_0x3d94('0x3c')];_0x3fc0e7+=0x1){socket[_0x3d94('0x73')]('userVoicePrefix:remove',{'UserId':Number(_0x4558ff[_0x3d94('0x36')][_0x3d94('0x71')][_0x3fc0e7]),'VoicePrefixId':Number(_0x4558ff[_0x3d94('0x4d')]['id'])});}}else{socket[_0x3d94('0x73')](_0x3d94('0x75'),{'UserId':Number(_0x4558ff[_0x3d94('0x36')][_0x3d94('0x71')]),'VoicePrefixId':Number(_0x4558ff[_0x3d94('0x4d')]['id'])});}});}})['then'](respondWithStatusCode(_0x4acb44,null))['catch'](handleError(_0x4acb44,null));};exports[_0x3d94('0x76')]=function(_0x23b1a6,_0x970b44,_0x561e65){var _0x43a00e={};var _0xa193a1={};var _0x43192c;var _0xdb96c0;return db[_0x3d94('0x31')]['findOne']({'where':{'id':_0x23b1a6['params']['id']}})[_0x3d94('0x28')](handleEntityNotFound(_0x970b44,null))[_0x3d94('0x28')](function(_0x274a82){if(_0x274a82){_0x43192c=_0x274a82;_0xa193a1[_0x3d94('0x39')]=_[_0x3d94('0x35')](db[_0x3d94('0x77')][_0x3d94('0x48')]);_0xa193a1[_0x3d94('0x36')]=_[_0x3d94('0x35')](_0x23b1a6[_0x3d94('0x36')]);_0xa193a1[_0x3d94('0x37')]=_[_0x3d94('0x38')](_0xa193a1[_0x3d94('0x39')],_0xa193a1['query']);_0x43a00e[_0x3d94('0x3a')]=_[_0x3d94('0x38')](_0xa193a1['model'],qs['fields'](_0x23b1a6[_0x3d94('0x36')][_0x3d94('0x3b')]));_0x43a00e[_0x3d94('0x3a')]=_0x43a00e[_0x3d94('0x3a')]['length']?_0x43a00e['attributes']:_0xa193a1[_0x3d94('0x39')];_0x43a00e[_0x3d94('0x3f')]=qs[_0x3d94('0x40')](_0x23b1a6[_0x3d94('0x36')][_0x3d94('0x40')]);_0x43a00e['where']=qs[_0x3d94('0x37')](_['pick'](_0x23b1a6[_0x3d94('0x36')],_0xa193a1[_0x3d94('0x37')]));if(_0x23b1a6[_0x3d94('0x36')]['filter']){_0x43a00e[_0x3d94('0x41')]=_[_0x3d94('0x49')](_0x43a00e['where'],{'$or':_[_0x3d94('0x30')](_0x43a00e['attributes'],function(_0x3c62ec){var _0x401772={};_0x401772[_0x3c62ec]={'$like':'%'+_0x23b1a6[_0x3d94('0x36')]['filter']+'%'};return _0x401772;})});}_0x43a00e=_[_0x3d94('0x49')]({},_0x43a00e,_0x23b1a6[_0x3d94('0x4a')]);return _0x43192c[_0x3d94('0x76')](_0x43a00e);}})['then'](function(_0x3e091a){if(_0x3e091a){_0xdb96c0=_0x3e091a[_0x3d94('0x3c')];if(!_0x23b1a6[_0x3d94('0x36')][_0x3d94('0x3d')](_0x3d94('0x3e'))){_0x43a00e[_0x3d94('0x20')]=qs[_0x3d94('0x20')](_0x23b1a6[_0x3d94('0x36')]['limit']);_0x43a00e[_0x3d94('0x1e')]=qs[_0x3d94('0x1e')](_0x23b1a6[_0x3d94('0x36')][_0x3d94('0x1e')]);}return _0x43192c[_0x3d94('0x76')](_0x43a00e);}})[_0x3d94('0x28')](function(_0x5716fd){if(_0x5716fd){return _0x5716fd?{'count':_0xdb96c0,'rows':_0x5716fd}:null;}})[_0x3d94('0x28')](respondWithResult(_0x970b44,null))[_0x3d94('0x4c')](handleError(_0x970b44,null));};exports[_0x3d94('0x78')]=function(_0x59b62b,_0x3fc2f2,_0x4c6c49){var _0xe85875={};var _0x3ed74f={};var _0x490d77;var _0x73b09c;return db[_0x3d94('0x31')]['findOne']({'where':{'id':_0x59b62b['params']['id']}})[_0x3d94('0x28')](handleEntityNotFound(_0x3fc2f2,null))[_0x3d94('0x28')](function(_0x48a22f){if(_0x48a22f){_0x490d77=_0x48a22f;_0x3ed74f['model']=_['keys'](db[_0x3d94('0x79')][_0x3d94('0x48')]);_0x3ed74f[_0x3d94('0x36')]=_[_0x3d94('0x35')](_0x59b62b[_0x3d94('0x36')]);_0x3ed74f['filters']=_[_0x3d94('0x38')](_0x3ed74f[_0x3d94('0x39')],_0x3ed74f[_0x3d94('0x36')]);_0xe85875['attributes']=_[_0x3d94('0x38')](_0x3ed74f['model'],qs[_0x3d94('0x3b')](_0x59b62b[_0x3d94('0x36')][_0x3d94('0x3b')]));_0xe85875[_0x3d94('0x3a')]=_0xe85875[_0x3d94('0x3a')]['length']?_0xe85875['attributes']:_0x3ed74f[_0x3d94('0x39')];_0xe85875[_0x3d94('0x3f')]=qs['sort'](_0x59b62b[_0x3d94('0x36')]['sort']);_0xe85875[_0x3d94('0x41')]=qs[_0x3d94('0x37')](_[_0x3d94('0x42')](_0x59b62b['query'],_0x3ed74f[_0x3d94('0x37')]));if(_0x59b62b['query'][_0x3d94('0x43')]){_0xe85875[_0x3d94('0x41')]=_[_0x3d94('0x49')](_0xe85875[_0x3d94('0x41')],{'$or':_['map'](_0xe85875['attributes'],function(_0x11ff83){var _0x26e454={};_0x26e454[_0x11ff83]={'$like':'%'+_0x59b62b[_0x3d94('0x36')][_0x3d94('0x43')]+'%'};return _0x26e454;})});}_0xe85875=_['merge']({},_0xe85875,_0x59b62b[_0x3d94('0x4a')]);return _0x490d77['getTeams'](_0xe85875);}})['then'](function(_0x543b1a){if(_0x543b1a){_0x73b09c=_0x543b1a[_0x3d94('0x3c')];if(!_0x59b62b[_0x3d94('0x36')][_0x3d94('0x3d')](_0x3d94('0x3e'))){_0xe85875[_0x3d94('0x20')]=qs[_0x3d94('0x20')](_0x59b62b[_0x3d94('0x36')][_0x3d94('0x20')]);_0xe85875[_0x3d94('0x1e')]=qs[_0x3d94('0x1e')](_0x59b62b[_0x3d94('0x36')][_0x3d94('0x1e')]);}return _0x490d77[_0x3d94('0x78')](_0xe85875);}})[_0x3d94('0x28')](function(_0x140ad1){if(_0x140ad1){return _0x140ad1?{'count':_0x73b09c,'rows':_0x140ad1}:null;}})['then'](respondWithResult(_0x3fc2f2,null))['catch'](handleError(_0x3fc2f2,null));};exports[_0x3d94('0x7a')]=function(_0x3ff668,_0x1837c9,_0x41251d){var _0x876bcc=_0x3ff668[_0x3d94('0x6d')][_0x3d94('0x71')];var _0x47ab6a;return db[_0x3d94('0x79')][_0x3d94('0x47')]({'where':{'id':_0x876bcc},'attributes':['id'],'include':[{'model':db[_0x3d94('0x77')],'as':_0x3d94('0x7b'),'attributes':['id',_0x3d94('0x2e'),_0x3d94('0x7c'),'voicePause','interface'],'raw':!![]}]})[_0x3d94('0x28')](function(_0x50e8ba){if(_0x50e8ba){_0x47ab6a=_0x50e8ba;var _0x248fbe=_[_0x3d94('0x7d')](_0x50e8ba,function(_0x350751){var _0x16853d=_0x350751[_0x3d94('0x29')]({'plain':!![]});return _0x16853d[_0x3d94('0x7b')];});return db[_0x3d94('0x31')][_0x3d94('0x4b')]({'where':{'id':_0x3ff668['params']['id']}})[_0x3d94('0x28')](function(_0x2c8a2f){return db[_0x3d94('0x7e')][_0x3d94('0x50')](function(_0x22e7ff){return _0x2c8a2f[_0x3d94('0x7a')](_0x876bcc,{'transaction':_0x22e7ff})[_0x3d94('0x28')](function(){return BPromise[_0x3d94('0x7f')](_0x47ab6a,function(_0x1c7315){return db[_0x3d94('0x80')][_0x3d94('0x81')]({'TeamId':_0x1c7315['id'],'VoicePrefixId':_0x3ff668[_0x3d94('0x4d')]['id']},{'transaction':_0x22e7ff});});})[_0x3d94('0x28')](function(){return BPromise[_0x3d94('0x7f')](_0x248fbe,function(_0x2d02db){return db[_0x3d94('0x82')][_0x3d94('0x83')]({'where':{'UserId':_0x2d02db['id'],'VoicePrefixId':_0x3ff668[_0x3d94('0x4d')]['id']},'transaction':_0x22e7ff});});})[_0x3d94('0x28')](function(){_0x248fbe[_0x3d94('0x84')](function(_0xb55889){socket['emit'](_0x3d94('0x85'),{'UserId':_0xb55889['id'],'VoicePrefixId':_0x2c8a2f['id']});});});});});}})[_0x3d94('0x28')](respondWithStatusCode(_0x1837c9,null))[_0x3d94('0x4c')](handleError(_0x1837c9,null));};exports[_0x3d94('0x86')]=function(_0x434b19,_0x185592,_0x594800){return db[_0x3d94('0x79')][_0x3d94('0x47')]({'where':{'id':_0x434b19[_0x3d94('0x36')][_0x3d94('0x71')]},'attributes':['id'],'include':[{'model':db[_0x3d94('0x77')],'as':_0x3d94('0x7b'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x185592,null))[_0x3d94('0x28')](function(_0x4ff1a0){var _0x577fd0=_['map'](_0x4ff1a0,'id');var _0x4a1faa=[];var _0x3e1139=[];var _0x77b79d=squel[_0x3d94('0x87')]();_0x77b79d[_0x3d94('0x88')](_0x3d94('0x89'))['from'](_0x3d94('0x8a'),'tq')[_0x3d94('0x8b')](_0x3d94('0x8c'),'ut',_0x3d94('0x8d'))[_0x3d94('0x41')](_0x3d94('0x8e'),_0x434b19['params']['id']);for(var _0x167d4c=0x0;_0x167d4c<_0x4ff1a0['length'];_0x167d4c+=0x1){let _0x219757=_0x4ff1a0[_0x167d4c];for(var _0xb970e1=0x0;_0xb970e1<_0x219757[_0x3d94('0x7b')][_0x3d94('0x3c')];_0xb970e1+=0x1){let _0x5df8b4=_0x219757[_0x3d94('0x7b')][_0xb970e1];var _0x2e409b=_0x77b79d[_0x3d94('0x8f')]();_0x2e409b[_0x3d94('0x41')]('ut.UserId\x20=\x20?',_0x5df8b4['id']);_0x3e1139['push'](db[_0x3d94('0x7e')][_0x3d94('0x36')](_0x2e409b[_0x3d94('0x90')](),{'type':db['sequelize'][_0x3d94('0x91')]['SELECT']})['then'](function(_0x560fdf){if(_0x560fdf[_0x3d94('0x3c')]===0x1){return _0x5df8b4['id'];}else{var _0x4ae177=_[_0x3d94('0x92')](_[_0x3d94('0x30')](_0x560fdf,_0x3d94('0x93')),function(_0x5ed8e8){return _[_0x3d94('0x94')](_0x577fd0,_0x5ed8e8);});if(_0x4ae177){return _0x5df8b4['id'];}}}));}}return BPromise[_0x3d94('0x95')](_0x3e1139)['then'](function(_0x551002){_0x4a1faa=_(_0x4a1faa)[_0x3d94('0x96')](_0x551002)[_0x3d94('0x97')]()[_0x3d94('0x98')]();return db[_0x3d94('0x31')][_0x3d94('0x4b')]({'where':{'id':_0x434b19[_0x3d94('0x4d')]['id']}})['then'](function(_0x54651a){return db['sequelize']['transaction'](function(_0x3c736a){return _0x54651a[_0x3d94('0x86')](_0x434b19[_0x3d94('0x36')][_0x3d94('0x71')],{'transaction':_0x3c736a})[_0x3d94('0x28')](function(){if(!_[_0x3d94('0x99')](_0x4a1faa)){return _0x54651a[_0x3d94('0x9a')](_0x4a1faa,{'transaction':_0x3c736a});}})[_0x3d94('0x28')](function(){_0x4a1faa[_0x3d94('0x84')](function(_0x414b82){socket[_0x3d94('0x73')]('userVoicePrefix:remove',{'UserId':_0x414b82,'VoicePrefixId':_0x54651a['id']});});});});});});})[_0x3d94('0x28')](respondWithStatusCode(_0x185592,null))['catch'](handleError(_0x185592,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index aa2d749..4837056 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 _0xd9bb=['update','emit','hasOwnProperty','exports','../../mysqldb','VoicePrefix','save'];(function(_0x1189eb,_0x3d2fb1){var _0x417af=function(_0x13787b){while(--_0x13787b){_0x1189eb['push'](_0x1189eb['shift']());}};_0x417af(++_0x3d2fb1);}(_0xd9bb,0x193));var _0xbd9b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd9bb[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require('events');var VoicePrefix=require(_0xbd9b('0x0'))['db'][_0xbd9b('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbd9b('0x2'),'afterUpdate':_0xbd9b('0x3'),'afterDestroy':'remove'};function emitEvent(_0xd6a8a2){return function(_0x49a590,_0x22ee86,_0x152293){VoicePrefixEvents[_0xbd9b('0x4')](_0xd6a8a2+':'+_0x49a590['id'],_0x49a590);VoicePrefixEvents[_0xbd9b('0x4')](_0xd6a8a2,_0x49a590);_0x152293(null);};}for(var e in events){if(events[_0xbd9b('0x5')](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module[_0xbd9b('0x6')]=VoicePrefixEvents; \ No newline at end of file +var _0xb453=['setMaxListeners','save','exports','events','VoicePrefix'];(function(_0xf414f8,_0x50ab92){var _0x524bdb=function(_0x2328ac){while(--_0x2328ac){_0xf414f8['push'](_0xf414f8['shift']());}};_0x524bdb(++_0x50ab92);}(_0xb453,0x111));var _0x3b45=function(_0x174e33,_0x3de0be){_0x174e33=_0x174e33-0x0;var _0x3a3216=_0xb453[_0x174e33];return _0x3a3216;};'use strict';var EventEmitter=require(_0x3b45('0x0'));var VoicePrefix=require('../../mysqldb')['db'][_0x3b45('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x3b45('0x2')](0x0);var events={'afterCreate':_0x3b45('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2ea659){return function(_0x322a74,_0x461ab9,_0x5e8bb9){VoicePrefixEvents['emit'](_0x2ea659+':'+_0x322a74['id'],_0x322a74);VoicePrefixEvents['emit'](_0x2ea659,_0x322a74);_0x5e8bb9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module[_0x3b45('0x4')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 9c3ddd4..071397f 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 _0x96a0=['lodash','util','../../config/logger','api','moment','request-promise','../../config/environment','./voicePrefix.attributes','exports','define','VoicePrefix','voice_prefixes'];(function(_0x2587f1,_0x208412){var _0x4b7fed=function(_0x4d7510){while(--_0x4d7510){_0x2587f1['push'](_0x2587f1['shift']());}};_0x4b7fed(++_0x208412);}(_0x96a0,0xe4));var _0x096a=function(_0x2f8e33,_0x593a85){_0x2f8e33=_0x2f8e33-0x0;var _0x256677=_0x96a0[_0x2f8e33];return _0x256677;};'use strict';var _=require(_0x096a('0x0'));var util=require(_0x096a('0x1'));var logger=require(_0x096a('0x2'))(_0x096a('0x3'));var moment=require(_0x096a('0x4'));var BPromise=require('bluebird');var rp=require(_0x096a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x096a('0x6'));var attributes=require(_0x096a('0x7'));module[_0x096a('0x8')]=function(_0x380876,_0x5cde93){return _0x380876[_0x096a('0x9')](_0x096a('0xa'),attributes,{'tableName':_0x096a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xebf7=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','VoicePrefix','voice_prefixes','lodash'];(function(_0x3e2040,_0x660381){var _0x38e3ec=function(_0x2e61bd){while(--_0x2e61bd){_0x3e2040['push'](_0x3e2040['shift']());}};_0x38e3ec(++_0x660381);}(_0xebf7,0x7d));var _0x7ebf=function(_0x5097b1,_0x4a1c01){_0x5097b1=_0x5097b1-0x0;var _0x4df946=_0xebf7[_0x5097b1];return _0x4df946;};'use strict';var _=require(_0x7ebf('0x0'));var util=require(_0x7ebf('0x1'));var logger=require(_0x7ebf('0x2'))(_0x7ebf('0x3'));var moment=require(_0x7ebf('0x4'));var BPromise=require(_0x7ebf('0x5'));var rp=require(_0x7ebf('0x6'));var fs=require('fs');var path=require(_0x7ebf('0x7'));var rimraf=require(_0x7ebf('0x8'));var config=require(_0x7ebf('0x9'));var attributes=require('./voicePrefix.attributes');module[_0x7ebf('0xa')]=function(_0x5b82ca,_0x49b7d8){return _0x5b82ca[_0x7ebf('0xb')](_0x7ebf('0xc'),attributes,{'tableName':_0x7ebf('0xd'),'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 aa7e404..d6025bd 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 _0x5d95=['rpc','client','http','redis','request','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x5b013d,_0x4892b3){var _0x1c4925=function(_0x35f205){while(--_0x35f205){_0x5b013d['push'](_0x5b013d['shift']());}};_0x1c4925(++_0x4892b3);}(_0x5d95,0x77));var _0x55d9=function(_0x15e249,_0x547ccb){_0x15e249=_0x15e249-0x0;var _0x118478=_0x5d95[_0x15e249];return _0x118478;};'use strict';var _=require(_0x55d9('0x0'));var util=require(_0x55d9('0x1'));var moment=require('moment');var BPromise=require(_0x55d9('0x2'));var rs=require(_0x55d9('0x3'));var fs=require('fs');var Redis=require(_0x55d9('0x4'));var db=require(_0x55d9('0x5'))['db'];var utils=require(_0x55d9('0x6'));var logger=require('../../config/logger')(_0x55d9('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x55d9('0x8')][_0x55d9('0x9')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x55d9('0xa')]));require('./voicePrefix.socket')['register'](socket);function respondWithRpcPromise(_0x77a04f,_0x373788,_0x2b406c){return new BPromise(function(_0xfd0f08,_0x38cde2){return client[_0x55d9('0xb')](_0x77a04f,_0x2b406c)['then'](function(_0x552cb8){logger[_0x55d9('0xc')](_0x55d9('0xd'),_0x373788,_0x55d9('0xe'));logger[_0x55d9('0xf')](_0x55d9('0x10'),_0x373788,_0x55d9('0xe'),JSON[_0x55d9('0x11')](_0x552cb8));if(_0x552cb8[_0x55d9('0x12')]){if(_0x552cb8[_0x55d9('0x12')]['code']===0x1f4){logger[_0x55d9('0x12')](_0x55d9('0xd'),_0x373788,_0x552cb8[_0x55d9('0x12')][_0x55d9('0x13')]);return _0x38cde2(_0x552cb8[_0x55d9('0x12')][_0x55d9('0x13')]);}logger[_0x55d9('0x12')](_0x55d9('0xd'),_0x373788,_0x552cb8[_0x55d9('0x12')][_0x55d9('0x13')]);return _0xfd0f08(_0x552cb8[_0x55d9('0x12')][_0x55d9('0x13')]);}else{logger[_0x55d9('0xc')](_0x55d9('0xd'),_0x373788,'request\x20sent');_0xfd0f08(_0x552cb8[_0x55d9('0x14')][_0x55d9('0x13')]);}})['catch'](function(_0x4c8561){logger['error'](_0x55d9('0xd'),_0x373788,_0x4c8561);_0x38cde2(_0x4c8561);});});} \ No newline at end of file +var _0x87d8=['error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x98c4d8,_0x334f16){var _0x1b3fff=function(_0x514ebf){while(--_0x514ebf){_0x98c4d8['push'](_0x98c4d8['shift']());}};_0x1b3fff(++_0x334f16);}(_0x87d8,0x1a9));var _0x887d=function(_0x3374fd,_0x59a9bc){_0x3374fd=_0x3374fd-0x0;var _0xb10792=_0x87d8[_0x3374fd];return _0xb10792;};'use strict';var _=require('lodash');var util=require(_0x887d('0x0'));var moment=require(_0x887d('0x1'));var BPromise=require(_0x887d('0x2'));var rs=require(_0x887d('0x3'));var fs=require('fs');var Redis=require(_0x887d('0x4'));var db=require(_0x887d('0x5'))['db'];var utils=require(_0x887d('0x6'));var logger=require(_0x887d('0x7'))(_0x887d('0x8'));var config=require(_0x887d('0x9'));var jayson=require(_0x887d('0xa'));var client=jayson[_0x887d('0xb')][_0x887d('0xc')]({'port':0x232a});config[_0x887d('0xd')]=_[_0x887d('0xe')](config['redis'],{'host':_0x887d('0xf'),'port':0x18eb});var socket=require(_0x887d('0x10'))(new Redis(config['redis']));require('./voicePrefix.socket')['register'](socket);function respondWithRpcPromise(_0x56c73a,_0x4396d8,_0x31488d){return new BPromise(function(_0x1f745a,_0x3db821){return client['request'](_0x56c73a,_0x31488d)['then'](function(_0x1aba20){logger[_0x887d('0x11')](_0x887d('0x12'),_0x4396d8,_0x887d('0x13'));logger[_0x887d('0x14')](_0x887d('0x15'),_0x4396d8,_0x887d('0x13'),JSON[_0x887d('0x16')](_0x1aba20));if(_0x1aba20['error']){if(_0x1aba20[_0x887d('0x17')][_0x887d('0x18')]===0x1f4){logger[_0x887d('0x17')]('VoicePrefix,\x20%s,\x20%s',_0x4396d8,_0x1aba20[_0x887d('0x17')][_0x887d('0x19')]);return _0x3db821(_0x1aba20['error']['message']);}logger['error'](_0x887d('0x12'),_0x4396d8,_0x1aba20[_0x887d('0x17')]['message']);return _0x1f745a(_0x1aba20[_0x887d('0x17')][_0x887d('0x19')]);}else{logger[_0x887d('0x11')]('VoicePrefix,\x20%s,\x20%s',_0x4396d8,_0x887d('0x13'));_0x1f745a(_0x1aba20[_0x887d('0x1a')]['message']);}})[_0x887d('0x1b')](function(_0x54481b){logger[_0x887d('0x17')](_0x887d('0x12'),_0x4396d8,_0x54481b);_0x3db821(_0x54481b);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 3a04d7d..6ef2e40 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 _0x13f6=['./voicePrefix.events','save','removeListener','voicePrefix:'];(function(_0xc5bf78,_0x13f6e2){var _0xb36be5=function(_0x4cdeb0){while(--_0x4cdeb0){_0xc5bf78['push'](_0xc5bf78['shift']());}};_0xb36be5(++_0x13f6e2);}(_0x13f6,0x124));var _0x613f=function(_0x526acf,_0x37779a){_0x526acf=_0x526acf-0x0;var _0x1cce08=_0x13f6[_0x526acf];return _0x1cce08;};'use strict';var VoicePrefixEvents=require(_0x613f('0x0'));var events=[_0x613f('0x1'),'remove','update'];function createListener(_0xd04cfd,_0x13b50a){return function(_0x12dc5a){_0x13b50a['emit'](_0xd04cfd,_0x12dc5a);};}function removeListener(_0x179f6e,_0x1e01e3){return function(){VoicePrefixEvents[_0x613f('0x2')](_0x179f6e,_0x1e01e3);};}exports['register']=function(_0x3f3525){for(var _0x2367b3=0x0,_0x5618fa=events['length'];_0x2367b3<_0x5618fa;_0x2367b3++){var _0x5a84f2=events[_0x2367b3];var _0x5c93c0=createListener(_0x613f('0x3')+_0x5a84f2,_0x3f3525);VoicePrefixEvents['on'](_0x5a84f2,_0x5c93c0);}}; \ No newline at end of file +var _0x7382=['save','register','voicePrefix:'];(function(_0x4f206d,_0x187554){var _0xc5bf3f=function(_0x5f3cff){while(--_0x5f3cff){_0x4f206d['push'](_0x4f206d['shift']());}};_0xc5bf3f(++_0x187554);}(_0x7382,0x1f2));var _0x2738=function(_0x44b405,_0x20786d){_0x44b405=_0x44b405-0x0;var _0x4d2453=_0x7382[_0x44b405];return _0x4d2453;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=[_0x2738('0x0'),'remove','update'];function createListener(_0x190aa6,_0x480143){return function(_0x250b3c){_0x480143['emit'](_0x190aa6,_0x250b3c);};}function removeListener(_0x402f25,_0x25ad1b){return function(){VoicePrefixEvents['removeListener'](_0x402f25,_0x25ad1b);};}exports[_0x2738('0x1')]=function(_0x267a1a){for(var _0x457c61=0x0,_0x1437b0=events['length'];_0x457c61<_0x1437b0;_0x457c61++){var _0x99e22e=events[_0x457c61];var _0x20a64f=createListener(_0x2738('0x2')+_0x99e22e,_0x267a1a);VoicePrefixEvents['on'](_0x99e22e,_0x20a64f);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 1c9c61b..200e4c4 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(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0xb10b,0x12a));var _0xbb10=function(_0x34046c,_0x283124){_0x34046c=_0x34046c-0x0;var _0x5d4d17=_0xb10b[_0x34046c];return _0x5d4d17;};'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(_0x103538,_0x16d9df){var _0x13bd35=function(_0x2cac77){while(--_0x2cac77){_0x103538['push'](_0x103538['shift']());}};_0x13bd35(++_0x16d9df);}(_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['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 d48fa33..eb3d7b3 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 _0xa940=['Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','exports','name','inbound','STRING','ringall','leastrecent','fewestcalls','rrmemory','linear','wrandom','rrordered','setDataValue','strategy','type','getDataValue','dialMethod','booked','roundrobin','predictive','power','INTEGER','yes','ENUM','all','once','TEXT','join','periodic_announce','split','joinempty','leavewhenempty','BOOLEAN','wrapuptime','Active/Disactive\x20Campaign','progressive','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','dropRate','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)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','always','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#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)','DESC','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'];(function(_0x52f9ab,_0x463c9f){var _0x4edff2=function(_0x2466a4){while(--_0x2466a4){_0x52f9ab['push'](_0x52f9ab['shift']());}};_0x4edff2(++_0x463c9f);}(_0xa940,0x191));var _0x0a94=function(_0x1bc9bc,_0x3d9b44){_0x1bc9bc=_0x1bc9bc-0x0;var _0x483073=_0xa940[_0x1bc9bc];return _0x483073;};'use strict';var Sequelize=require('sequelize');module[_0x0a94('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x0a94('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x0a94('0x2'),'outbound'),'allowNull':![],'defaultValue':_0x0a94('0x2')},'musiconhold':{'type':Sequelize['STRING'],'defaultValue':'default'},'announce':{'type':Sequelize[_0x0a94('0x3')],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr',_0x0a94('0x4'),_0x0a94('0x5'),_0x0a94('0x6'),'random',_0x0a94('0x7'),_0x0a94('0x8'),_0x0a94('0x9'),_0x0a94('0xa')),'allowNull':![],'defaultValue':'ringall','set':function(_0x56398b){this[_0x0a94('0xb')](_0x0a94('0xc'),_0x56398b?_0x56398b:'rrmemory');},'get':function(){var _0xe80608=this['getDataValue'](_0x0a94('0xd'));var _0x5b1539=this[_0x0a94('0xe')](_0x0a94('0xf'));var _0x518bd4=this[_0x0a94('0xe')](_0x0a94('0xc'));if(_0xe80608===_0x0a94('0x2')){return _0x518bd4;}if(_0x5b1539===_0x0a94('0x10')&&_0x518bd4===_0x0a94('0x7')||_0x5b1539===_0x0a94('0x10')&&_0x518bd4===_0x0a94('0x11')){return _0x518bd4;}if(_0x5b1539==='progressive'||_0x5b1539===_0x0a94('0x12')||_0x5b1539===_0x0a94('0x13')){return _0x518bd4;}return null;}},'servicelevel':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'context':{'type':Sequelize['STRING'],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x0a94('0x14')](0xb)},'timeout':{'type':Sequelize[_0x0a94('0x14')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x0a94('0x14')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x0a94('0x3')]},'weight':{'type':Sequelize[_0x0a94('0x14')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x0a94('0x15')},'autopause':{'type':Sequelize[_0x0a94('0x16')](_0x0a94('0x15'),'no',_0x0a94('0x17')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x0a94('0x14')](0xb)},'autopausebusy':{'type':Sequelize['ENUM'](_0x0a94('0x15'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x0a94('0x16')](_0x0a94('0x15'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x0a94('0x16')](_0x0a94('0x15'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x0a94('0x16')](_0x0a94('0x15'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x0a94('0x16')](_0x0a94('0x15'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x0a94('0x3')],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x0a94('0x14')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x0a94('0x14')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x0a94('0x16')]('yes','no'),'defaultValue':_0x0a94('0x15')},'announce_holdtime':{'type':Sequelize[_0x0a94('0x16')](_0x0a94('0x15'),'no',_0x0a94('0x18')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x0a94('0x3')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x0a94('0x16')](_0x0a94('0x15'),'no')},'announce_position_limit':{'type':Sequelize[_0x0a94('0x14')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x0a94('0x16')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize['STRING'],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x0a94('0x3')]},'queue_youarenext':{'type':Sequelize[_0x0a94('0x3')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x0a94('0x3')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x0a94('0x3')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x0a94('0x3')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x0a94('0x3')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x0a94('0x3')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x0a94('0x3')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x0a94('0x3')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x0a94('0x3')]},'queue_quantity1':{'type':Sequelize[_0x0a94('0x3')]},'queue_quantity2':{'type':Sequelize[_0x0a94('0x3')]},'queue_periodic_announce':{'type':Sequelize[_0x0a94('0x3')]},'queue_less_than':{'type':Sequelize[_0x0a94('0x3')]},'periodic_announce':{'type':Sequelize[_0x0a94('0x19')],'set':function(_0x15d78c){this[_0x0a94('0xb')]('periodic_announce',_0x15d78c?_0x15d78c[_0x0a94('0x1a')](','):[]);},'get':function(){return this[_0x0a94('0xe')](_0x0a94('0x1b'))?this['getDataValue'](_0x0a94('0x1b'))[_0x0a94('0x1c')](','):[];}},'joinempty':{'type':Sequelize[_0x0a94('0x3')],'defaultValue':'yes','set':function(_0x3d7e4e){this[_0x0a94('0xb')](_0x0a94('0x1d'),_0x3d7e4e?_0x3d7e4e[_0x0a94('0x1a')](','):undefined);},'get':function(){return this['getDataValue'](_0x0a94('0x1d'))?this[_0x0a94('0xe')](_0x0a94('0x1d'))[_0x0a94('0x1c')](','):undefined;}},'leavewhenempty':{'type':Sequelize['STRING'],'defaultValue':'no','set':function(_0x4c3a70){this['setDataValue'](_0x0a94('0x1e'),_0x4c3a70?_0x4c3a70[_0x0a94('0x1a')](','):undefined);},'get':function(){return this[_0x0a94('0xe')]('leavewhenempty')?this['getDataValue']('leavewhenempty')[_0x0a94('0x1c')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x0a94('0x16')](_0x0a94('0x15'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x0a94('0x16')]('yes','no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x0a94('0x16')]('yes','no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x0a94('0x3')]},'description':{'type':Sequelize['STRING']},'acw':{'type':Sequelize[_0x0a94('0x1f')],'defaultValue':0x0,'set':function(_0x325a3c){this[_0x0a94('0xb')]('acw',_0x325a3c);if(_0x325a3c){if(this['getDataValue'](_0x0a94('0x20'))<0x2){this[_0x0a94('0xb')](_0x0a94('0x20'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x0a94('0x14')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x0a94('0x21')},'dialMethod':{'type':Sequelize[_0x0a94('0x16')]('preview',_0x0a94('0x22'),_0x0a94('0x13'),_0x0a94('0x12'),_0x0a94('0x10')),'defaultValue':_0x0a94('0x22'),'comment':_0x0a94('0x23')},'dialLimitChannel':{'type':Sequelize[_0x0a94('0x14')](0x4)[_0x0a94('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x0a94('0x25')},'dialLimitQueue':{'type':Sequelize[_0x0a94('0x14')](0x4)[_0x0a94('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x0a94('0x26')},'dialPowerLevel':{'type':Sequelize[_0x0a94('0x27')](0x2)[_0x0a94('0x24')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x0a94('0x28')},'dialPredictiveOptimization':{'type':Sequelize['ENUM'](_0x0a94('0x29'),_0x0a94('0x2a')),'defaultValue':_0x0a94('0x2a'),'comment':'Only\x20for\x20predictive\x20method.'},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x0a94('0x27')](0x2)[_0x0a94('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x0a94('0x2b')},'dialPredictiveInterval':{'type':Sequelize[_0x0a94('0x14')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x0a94('0x2c')},'dialOriginateCallerIdName':{'type':Sequelize[_0x0a94('0x3')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x0a94('0x3')]},'dialOriginateTimeout':{'type':Sequelize[_0x0a94('0x14')](0x3)[_0x0a94('0x24')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a94('0x2d')},'dialQueueOptions':{'type':Sequelize[_0x0a94('0x3')],'defaultValue':_0x0a94('0x2e'),'comment':_0x0a94('0x2f')},'dialQueueTimeout':{'type':Sequelize[_0x0a94('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a94('0x30')},'dialQueueProject':{'type':Sequelize[_0x0a94('0x3')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x0a94('0x14')](0x3)[_0x0a94('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a94('0x31')},'dialBusyMaxRetry':{'type':Sequelize[_0x0a94('0x14')](0x3)[_0x0a94('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x0a94('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x0a94('0x14')](0x3)[_0x0a94('0x24')],'defaultValue':0x3,'comment':_0x0a94('0x32')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x0a94('0x14')](0x5)[_0x0a94('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a94('0x33')},'dialGlobalMaxRetry':{'type':Sequelize[_0x0a94('0x14')](0x3)[_0x0a94('0x24')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x0a94('0x34')},'dialTimezone':{'type':Sequelize[_0x0a94('0x3')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x0a94('0x3')],'defaultValue':'07:00-22:00,*,*,*'},'dialPrefix':{'type':Sequelize[_0x0a94('0x3')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x0a94('0x16')](_0x0a94('0x35'),'never',_0x0a94('0x36')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x0a94('0x1f')],'defaultValue':0x0,'comment':_0x0a94('0x37')},'dialAMDInitialSilence':{'type':Sequelize[_0x0a94('0x14')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x0a94('0x38')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x0a94('0x24')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x0a94('0x39')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x0a94('0x14')](0x9)[_0x0a94('0x24')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x0a94('0x3a')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x0a94('0x14')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0a94('0x3b')},'dialAMDMinWordLength':{'type':Sequelize[_0x0a94('0x14')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x0a94('0x3c')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x0a94('0x24')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x0a94('0x3d')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x0a94('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x0a94('0x3e')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x0a94('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0a94('0x3f')},'dialRecallMeTimeout':{'type':Sequelize[_0x0a94('0x14')](0x5)[_0x0a94('0x24')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x0a94('0x40')},'dialRecallInQueue':{'type':Sequelize[_0x0a94('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize[_0x0a94('0x16')](_0x0a94('0x41'),'ASC'),'defaultValue':_0x0a94('0x41')},'dialQueueProject2':{'type':Sequelize['STRING'],'comment':_0x0a94('0x42')},'dialAgiAfterHangupClient':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x0a94('0x1f')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x0a94('0x14')](0x3)[_0x0a94('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x0a94('0x43')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x0a94('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x0a94('0x44')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x0a94('0x14')](0x3)[_0x0a94('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a94('0x45')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x0a94('0x14')](0x5)[_0x0a94('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a94('0x46')},'dialDropMaxRetry':{'type':Sequelize[_0x0a94('0x14')](0x3)[_0x0a94('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a94('0x47')},'dialDropRetryFrequency':{'type':Sequelize[_0x0a94('0x14')](0x5)[_0x0a94('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a94('0x48')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x0a94('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x0a94('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a94('0x49')},'dialMachineMaxRetry':{'type':Sequelize[_0x0a94('0x14')](0x3)[_0x0a94('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a94('0x4a')},'dialMachineRetryFrequency':{'type':Sequelize[_0x0a94('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x0a94('0x14')](0x3)[_0x0a94('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a94('0x4b')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x0a94('0x14')](0x5)[_0x0a94('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0a94('0x14')],'allowNull':!![],'comment':_0x0a94('0x4c')},'mandatoryDisposition':{'type':Sequelize[_0x0a94('0x1f')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x394c84){if(!_0x394c84)this['setDataValue'](_0x0a94('0x4d'),null);this[_0x0a94('0xb')](_0x0a94('0x4e'),_0x394c84);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x0a94('0x14')](0x3)[_0x0a94('0x24')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x0a94('0x1f')],'defaultValue':!![]}}; \ No newline at end of file +var _0xcf61=['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)','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)','always','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)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','inbound','outbound','default','ENUM','ringall','leastrecent','fewestcalls','random','rrmemory','linear','wrandom','rrordered','setDataValue','strategy','getDataValue','type','dialMethod','booked','roundrobin','progressive','predictive','INTEGER','yes','all','TEXT','periodic_announce','join','joinempty','split','leavewhenempty','wrapuptime','BOOLEAN','Active/Disactive\x20Campaign','preview','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate'];(function(_0x1492b2,_0x309166){var _0x1d7e80=function(_0x10e3c5){while(--_0x10e3c5){_0x1492b2['push'](_0x1492b2['shift']());}};_0x1d7e80(++_0x309166);}(_0xcf61,0xd6));var _0x1cf6=function(_0x5d623d,_0xc2bee1){_0x5d623d=_0x5d623d-0x0;var _0x30a526=_0xcf61[_0x5d623d];return _0x30a526;};'use strict';var Sequelize=require(_0x1cf6('0x0'));module[_0x1cf6('0x1')]={'name':{'type':Sequelize[_0x1cf6('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x1cf6('0x3'),_0x1cf6('0x4')),'allowNull':![],'defaultValue':_0x1cf6('0x3')},'musiconhold':{'type':Sequelize[_0x1cf6('0x2')],'defaultValue':_0x1cf6('0x5')},'announce':{'type':Sequelize[_0x1cf6('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0x1cf6('0x6')]('rr',_0x1cf6('0x7'),_0x1cf6('0x8'),_0x1cf6('0x9'),_0x1cf6('0xa'),_0x1cf6('0xb'),_0x1cf6('0xc'),_0x1cf6('0xd'),_0x1cf6('0xe')),'allowNull':![],'defaultValue':_0x1cf6('0x7'),'set':function(_0x43cb92){this[_0x1cf6('0xf')](_0x1cf6('0x10'),_0x43cb92?_0x43cb92:_0x1cf6('0xb'));},'get':function(){var _0x551071=this[_0x1cf6('0x11')](_0x1cf6('0x12'));var _0x2fa8de=this['getDataValue'](_0x1cf6('0x13'));var _0x495570=this[_0x1cf6('0x11')]('strategy');if(_0x551071===_0x1cf6('0x3')){return _0x495570;}if(_0x2fa8de===_0x1cf6('0x14')&&_0x495570===_0x1cf6('0xb')||_0x2fa8de===_0x1cf6('0x14')&&_0x495570===_0x1cf6('0x15')){return _0x495570;}if(_0x2fa8de===_0x1cf6('0x16')||_0x2fa8de===_0x1cf6('0x17')||_0x2fa8de==='power'){return _0x495570;}return null;}},'servicelevel':{'type':Sequelize[_0x1cf6('0x18')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x1cf6('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x1cf6('0x18')](0xb)},'timeout':{'type':Sequelize[_0x1cf6('0x18')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x1cf6('0x18')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize['STRING']},'weight':{'type':Sequelize[_0x1cf6('0x18')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x1cf6('0x18')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x1cf6('0x19')},'autopause':{'type':Sequelize['ENUM']('yes','no',_0x1cf6('0x1a')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x1cf6('0x18')](0xb)},'autopausebusy':{'type':Sequelize[_0x1cf6('0x6')](_0x1cf6('0x19'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x1cf6('0x6')](_0x1cf6('0x19'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize['ENUM'](_0x1cf6('0x19'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x1cf6('0x6')](_0x1cf6('0x19'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x1cf6('0x6')](_0x1cf6('0x19'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x1cf6('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x1cf6('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x1cf6('0x18')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize['ENUM'](_0x1cf6('0x19'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0x1cf6('0x19'),'no'),'defaultValue':_0x1cf6('0x19')},'announce_holdtime':{'type':Sequelize['ENUM'](_0x1cf6('0x19'),'no','once'),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x1cf6('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x1cf6('0x6')](_0x1cf6('0x19'),'no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0x1cf6('0x6')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize['STRING'],'defaultValue':''},'monitor_type':{'type':Sequelize['STRING']},'queue_youarenext':{'type':Sequelize[_0x1cf6('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x1cf6('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x1cf6('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x1cf6('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x1cf6('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x1cf6('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize[_0x1cf6('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0x1cf6('0x2')]},'queue_less_than':{'type':Sequelize[_0x1cf6('0x2')]},'periodic_announce':{'type':Sequelize[_0x1cf6('0x1b')],'set':function(_0x17f0c6){this[_0x1cf6('0xf')](_0x1cf6('0x1c'),_0x17f0c6?_0x17f0c6[_0x1cf6('0x1d')](','):[]);},'get':function(){return this['getDataValue'](_0x1cf6('0x1c'))?this['getDataValue'](_0x1cf6('0x1c'))['split'](','):[];}},'joinempty':{'type':Sequelize[_0x1cf6('0x2')],'defaultValue':_0x1cf6('0x19'),'set':function(_0x3fc490){this[_0x1cf6('0xf')](_0x1cf6('0x1e'),_0x3fc490?_0x3fc490[_0x1cf6('0x1d')](','):undefined);},'get':function(){return this[_0x1cf6('0x11')](_0x1cf6('0x1e'))?this[_0x1cf6('0x11')]('joinempty')[_0x1cf6('0x1f')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x1cf6('0x2')],'defaultValue':'no','set':function(_0x274eb5){this['setDataValue'](_0x1cf6('0x20'),_0x274eb5?_0x274eb5[_0x1cf6('0x1d')](','):undefined);},'get':function(){return this[_0x1cf6('0x11')](_0x1cf6('0x20'))?this[_0x1cf6('0x11')]('leavewhenempty')[_0x1cf6('0x1f')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x1cf6('0x6')](_0x1cf6('0x19'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x1cf6('0x6')](_0x1cf6('0x19'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x1cf6('0x18')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize['ENUM'](_0x1cf6('0x19'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x1cf6('0x2')]},'description':{'type':Sequelize[_0x1cf6('0x2')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x4ea6fa){this[_0x1cf6('0xf')]('acw',_0x4ea6fa);if(_0x4ea6fa){if(this[_0x1cf6('0x11')](_0x1cf6('0x21'))<0x2){this['setDataValue'](_0x1cf6('0x21'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x1cf6('0x22')],'defaultValue':0x0,'comment':_0x1cf6('0x23')},'dialMethod':{'type':Sequelize[_0x1cf6('0x6')](_0x1cf6('0x24'),_0x1cf6('0x16'),'power',_0x1cf6('0x17'),'booked'),'defaultValue':_0x1cf6('0x16'),'comment':_0x1cf6('0x25')},'dialLimitChannel':{'type':Sequelize['INTEGER'](0x4)[_0x1cf6('0x26')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x1cf6('0x27')},'dialLimitQueue':{'type':Sequelize[_0x1cf6('0x18')](0x4)[_0x1cf6('0x26')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.'},'dialPowerLevel':{'type':Sequelize[_0x1cf6('0x28')](0x2)['UNSIGNED'],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x1cf6('0x29')},'dialPredictiveOptimization':{'type':Sequelize[_0x1cf6('0x6')](_0x1cf6('0x2a'),'dropRate'),'defaultValue':_0x1cf6('0x2b'),'comment':_0x1cf6('0x2c')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x1cf6('0x28')](0x2)[_0x1cf6('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x1cf6('0x2d')},'dialPredictiveInterval':{'type':Sequelize[_0x1cf6('0x18')](0x3)[_0x1cf6('0x26')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x1cf6('0x2e')},'dialOriginateCallerIdName':{'type':Sequelize[_0x1cf6('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x1cf6('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x1cf6('0x18')](0x3)[_0x1cf6('0x26')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1cf6('0x2f')},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':_0x1cf6('0x30'),'comment':_0x1cf6('0x31')},'dialQueueTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x1cf6('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1cf6('0x32')},'dialQueueProject':{'type':Sequelize[_0x1cf6('0x2')],'comment':_0x1cf6('0x33')},'dialCongestionMaxRetry':{'type':Sequelize[_0x1cf6('0x18')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1cf6('0x34')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x1cf6('0x18')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1cf6('0x35')},'dialBusyMaxRetry':{'type':Sequelize[_0x1cf6('0x18')](0x3)[_0x1cf6('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1cf6('0x36')},'dialBusyRetryFrequency':{'type':Sequelize[_0x1cf6('0x18')](0x5)[_0x1cf6('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1cf6('0x37')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x1cf6('0x18')](0x3)[_0x1cf6('0x26')],'defaultValue':0x3,'comment':_0x1cf6('0x38')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x1cf6('0x18')](0x5)[_0x1cf6('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1cf6('0x39')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x1cf6('0x3a')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x1cf6('0x2')],'defaultValue':'07:00-22:00,*,*,*'},'dialPrefix':{'type':Sequelize[_0x1cf6('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x1cf6('0x6')](_0x1cf6('0x3b'),'never','onlyIfOpen'),'defaultValue':_0x1cf6('0x3b')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x1cf6('0x3c')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x1cf6('0x26')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x1cf6('0x3d')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x1cf6('0x26')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x1cf6('0x3e')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x1cf6('0x18')](0x9)[_0x1cf6('0x26')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x1cf6('0x3f')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x1cf6('0x18')](0x9)[_0x1cf6('0x26')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x1cf6('0x40')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x1cf6('0x26')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x1cf6('0x41')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x1cf6('0x26')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x1cf6('0x42')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x1cf6('0x18')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x1cf6('0x43')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x1cf6('0x26')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x1cf6('0x44')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x1cf6('0x18')](0x9)[_0x1cf6('0x26')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x1cf6('0x45')},'dialRecallMeTimeout':{'type':Sequelize[_0x1cf6('0x18')](0x5)[_0x1cf6('0x26')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x1cf6('0x46')},'dialRecallInQueue':{'type':Sequelize[_0x1cf6('0x22')],'defaultValue':0x0,'comment':_0x1cf6('0x47')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0x1cf6('0x48'),_0x1cf6('0x49')),'defaultValue':_0x1cf6('0x48')},'dialQueueProject2':{'type':Sequelize[_0x1cf6('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0x1cf6('0x22')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x1cf6('0x26')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x1cf6('0x4a')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x1cf6('0x26')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x1cf6('0x18')](0x3)[_0x1cf6('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1cf6('0x4b')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x1cf6('0x18')](0x5)[_0x1cf6('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1cf6('0x4c')},'dialDropRetryFrequency':{'type':Sequelize[_0x1cf6('0x18')](0x5)[_0x1cf6('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1cf6('0x4d')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x1cf6('0x18')](0x3)[_0x1cf6('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1cf6('0x4e')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x1cf6('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1cf6('0x4f')},'dialMachineMaxRetry':{'type':Sequelize[_0x1cf6('0x18')](0x3)[_0x1cf6('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1cf6('0x50')},'dialMachineRetryFrequency':{'type':Sequelize[_0x1cf6('0x18')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1cf6('0x51')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x1cf6('0x18')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x1cf6('0x18')](0x5)[_0x1cf6('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize[_0x1cf6('0x18')],'allowNull':!![],'comment':_0x1cf6('0x52')},'mandatoryDisposition':{'type':Sequelize[_0x1cf6('0x22')],'defaultValue':![],'comment':_0x1cf6('0x53'),'set':function(_0x3560f7){if(!_0x3560f7)this[_0x1cf6('0xf')](_0x1cf6('0x54'),null);this[_0x1cf6('0xf')](_0x1cf6('0x55'),_0x3560f7);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x1cf6('0x18')](0x3)['UNSIGNED'],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x1cf6('0x26')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x1cf6('0x22')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 43b169b..2a61cbd 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 _0xcd7a=['find','name','UserProfileResource','stack','send','index','map','VoiceQueue','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','options','includeAll','include','rows','catch','show','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','VoiceQueues','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','omit','updatedAt','UserProfileSection','findOne','VoiceQueueId','CmHopper','CmHopperHistory','order','getHopperFinals','CmHopperFinal','findAll','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','User','voicePause','interface','flatMap','Agents','penalty','TeamVoiceQueue','each','findOrCreate','UserVoiceQueueRt','upsert','SIP/%s','forEach','emit','userVoiceQueue:save','field','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','QueryTypes','SELECT','every','TeamId','union','transaction','ids','isEmpty','removeAgents','destroy','userVoiceQueue:remove','addAgents','online','format','isArray','getAgents','getMembers','getLists','CmList','addLists','spread','dialCheckDuplicateType','always','insert','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','createdAt','select','NOW()','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','into','cm_contacts','deletedAt\x20IS\x20NULL','sequelize','all','removeLists','getBlackLists','cm_hopper_black','removeBlackLists','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','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','status','json','limit','undefined','count','offset','set','Content-Range','apply','update','then','inbound','QueueCampaigns','outbound','filter','ignore','value','includes','type'];(function(_0xdb1b95,_0x3bb07f){var _0x540f72=function(_0x537413){while(--_0x537413){_0xdb1b95['push'](_0xdb1b95['shift']());}};_0x540f72(++_0x3bb07f);}(_0xcd7a,0x141));var _0xacd7=function(_0x340625,_0x32f682){_0x340625=_0x340625-0x0;var _0x263345=_0xcd7a[_0x340625];return _0x263345;};'use strict';var emlformat=require(_0xacd7('0x0'));var rimraf=require(_0xacd7('0x1'));var zipdir=require(_0xacd7('0x2'));var jsonpatch=require(_0xacd7('0x3'));var rp=require('request-promise');var moment=require(_0xacd7('0x4'));var BPromise=require(_0xacd7('0x5'));var Mustache=require(_0xacd7('0x6'));var util=require(_0xacd7('0x7'));var path=require(_0xacd7('0x8'));var sox=require(_0xacd7('0x9'));var csv=require(_0xacd7('0xa'));var ejs=require(_0xacd7('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xacd7('0xc'));var squel=require(_0xacd7('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xacd7('0xe'));var toCsv=require(_0xacd7('0xa'));var querystring=require(_0xacd7('0xf'));var Papa=require('papaparse');var Redis=require(_0xacd7('0x10'));var authService=require(_0xacd7('0x11'));var qs=require(_0xacd7('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xacd7('0x13'));var logger=require(_0xacd7('0x14'))('api');var utils=require(_0xacd7('0x15'));var config=require(_0xacd7('0x16'));var licenseUtil=require(_0xacd7('0x17'));var db=require(_0xacd7('0x18'))['db'];config[_0xacd7('0x19')]=_[_0xacd7('0x1a')](config['redis'],{'host':_0xacd7('0x1b'),'port':0x18eb});var socket=require(_0xacd7('0x1c'))(new Redis(config[_0xacd7('0x19')]));require('./voiceQueue.socket')[_0xacd7('0x1d')](socket);function respondWithStatusCode(_0xdad752,_0x59a9eb){_0x59a9eb=_0x59a9eb||0xcc;return function(_0x21a29e){if(_0x21a29e){return _0xdad752[_0xacd7('0x1e')](_0x59a9eb);}return _0xdad752['status'](_0x59a9eb)[_0xacd7('0x1f')]();};}function respondWithResult(_0x32842b,_0x2a93ef){_0x2a93ef=_0x2a93ef||0xc8;return function(_0x1f9f0e){if(_0x1f9f0e){return _0x32842b[_0xacd7('0x20')](_0x2a93ef)[_0xacd7('0x21')](_0x1f9f0e);}};}function respondWithFilteredResult(_0x44c1a6,_0x2fd768){return function(_0xeee43c){if(_0xeee43c){var _0x557e5e=typeof _0x2fd768['offset']==='undefined'&&typeof _0x2fd768[_0xacd7('0x22')]===_0xacd7('0x23');var _0x445b9d=_0xeee43c[_0xacd7('0x24')];var _0x118a92=_0x557e5e?0x0:_0x2fd768[_0xacd7('0x25')];var _0x251caa=_0x557e5e?_0xeee43c['count']:_0x2fd768[_0xacd7('0x25')]+_0x2fd768[_0xacd7('0x22')];var _0x4ce04f;if(_0x251caa>=_0x445b9d){_0x251caa=_0x445b9d;_0x4ce04f=0xc8;}else{_0x4ce04f=0xce;}_0x44c1a6[_0xacd7('0x20')](_0x4ce04f);return _0x44c1a6[_0xacd7('0x26')](_0xacd7('0x27'),_0x118a92+'-'+_0x251caa+'/'+_0x445b9d)['json'](_0xeee43c);}return null;};}function patchUpdates(_0x56eb9e){return function(_0x4b8986){try{jsonpatch[_0xacd7('0x28')](_0x4b8986,_0x56eb9e,!![]);}catch(_0x434726){return BPromise['reject'](_0x434726);}return _0x4b8986['save']();};}function saveUpdates(_0xdf0543,_0x2e3a92){return function(_0x10978c){if(_0x10978c){return _0x10978c[_0xacd7('0x29')](_0xdf0543)[_0xacd7('0x2a')](function(_0x18a04e){return _0x18a04e;});}return null;};}function removeEntity(_0x547cb9,_0x17fb04){return function(_0x28c4f5){if(_0x28c4f5){return _0x28c4f5['destroy']()[_0xacd7('0x2a')](function(){var _0x3c596b=_0x28c4f5['get']({'plain':!![]});var _0x4fe2ff=[{'name':'VoiceQueues','value':_0xacd7('0x2b'),'ignore':![]},{'name':_0xacd7('0x2c'),'value':_0xacd7('0x2d'),'ignore':![]}];var _0xe7c4f2=_(_0x4fe2ff)[_0xacd7('0x2e')](_0xacd7('0x2f'))['map'](_0xacd7('0x30'))['value']();if(_[_0xacd7('0x31')](_0xe7c4f2,_0x3c596b[_0xacd7('0x32')])){return;}var _0x12a71d=_[_0xacd7('0x33')](_0x4fe2ff,[_0xacd7('0x30'),_0x3c596b[_0xacd7('0x32')]])[_0xacd7('0x34')];return db[_0xacd7('0x35')]['destroy']({'where':{'type':_0x12a71d,'resourceId':_0x3c596b['id']}})[_0xacd7('0x2a')](function(){return _0x28c4f5;});})[_0xacd7('0x2a')](function(){_0x547cb9[_0xacd7('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x15a452,_0x25663c){return function(_0x187ae4){if(!_0x187ae4){_0x15a452['sendStatus'](0x194);}return _0x187ae4;};}function handleError(_0x58742,_0x4707d9){_0x4707d9=_0x4707d9||0x1f4;return function(_0x2f0f78){logger['error'](_0x2f0f78[_0xacd7('0x36')]);if(_0x2f0f78[_0xacd7('0x34')]){delete _0x2f0f78[_0xacd7('0x34')];}_0x58742[_0xacd7('0x20')](_0x4707d9)[_0xacd7('0x37')](_0x2f0f78);};}exports[_0xacd7('0x38')]=function(_0x4091c4,_0xf91b65){var _0x5a4744={},_0x3e041b={},_0x4e0e26={'count':0x0,'rows':[]};var _0x2ac586=_[_0xacd7('0x39')](db[_0xacd7('0x3a')][_0xacd7('0x3b')],function(_0x43cbf2){return{'name':_0x43cbf2[_0xacd7('0x3c')],'type':_0x43cbf2['type'][_0xacd7('0x3d')]};});_0x3e041b[_0xacd7('0x3e')]=_[_0xacd7('0x39')](_0x2ac586,_0xacd7('0x34'));_0x3e041b[_0xacd7('0x3f')]=_[_0xacd7('0x40')](_0x4091c4['query']);_0x3e041b[_0xacd7('0x41')]=_['intersection'](_0x3e041b[_0xacd7('0x3e')],_0x3e041b[_0xacd7('0x3f')]);_0x5a4744['attributes']=_[_0xacd7('0x42')](_0x3e041b[_0xacd7('0x3e')],qs[_0xacd7('0x43')](_0x4091c4[_0xacd7('0x3f')][_0xacd7('0x43')]));_0x5a4744[_0xacd7('0x44')]=_0x5a4744[_0xacd7('0x44')][_0xacd7('0x45')]?_0x5a4744[_0xacd7('0x44')]:_0x3e041b[_0xacd7('0x3e')];if(!_0x4091c4[_0xacd7('0x3f')][_0xacd7('0x46')](_0xacd7('0x47'))){_0x5a4744[_0xacd7('0x22')]=qs[_0xacd7('0x22')](_0x4091c4['query'][_0xacd7('0x22')]);_0x5a4744[_0xacd7('0x25')]=qs[_0xacd7('0x25')](_0x4091c4[_0xacd7('0x3f')][_0xacd7('0x25')]);}_0x5a4744['order']=qs['sort'](_0x4091c4[_0xacd7('0x3f')][_0xacd7('0x48')]);_0x5a4744[_0xacd7('0x49')]=qs['filters'](_[_0xacd7('0x4a')](_0x4091c4['query'],_0x3e041b['filters']),_0x2ac586);if(_0x4091c4['query']['filter']){_0x5a4744['where']=_['merge'](_0x5a4744['where'],{'$or':_[_0xacd7('0x39')](_0x2ac586,function(_0x4b1992){if(_0x4b1992['type']!=='VIRTUAL'){var _0x54e51e={};_0x54e51e[_0x4b1992['name']]={'$like':'%'+_0x4091c4[_0xacd7('0x3f')][_0xacd7('0x2e')]+'%'};return _0x54e51e;}})});}_0x5a4744=_[_0xacd7('0x4b')]({},_0x5a4744,_0x4091c4[_0xacd7('0x4c')]);var _0x3e4280={'where':_0x5a4744[_0xacd7('0x49')]};return db[_0xacd7('0x3a')][_0xacd7('0x24')](_0x3e4280)[_0xacd7('0x2a')](function(_0x531f00){_0x4e0e26['count']=_0x531f00;if(_0x4091c4[_0xacd7('0x3f')][_0xacd7('0x4d')]){_0x5a4744[_0xacd7('0x4e')]=[{'all':!![]}];}return db[_0xacd7('0x3a')]['findAll'](_0x5a4744);})[_0xacd7('0x2a')](function(_0x1001bb){_0x4e0e26[_0xacd7('0x4f')]=_0x1001bb;return _0x4e0e26;})[_0xacd7('0x2a')](respondWithFilteredResult(_0xf91b65,_0x5a4744))[_0xacd7('0x50')](handleError(_0xf91b65,null));};exports[_0xacd7('0x51')]=function(_0x131984,_0x452df6){var _0x5a3488={'raw':![],'where':{'id':_0x131984['params']['id']}},_0x41f162={};_0x41f162['model']=_[_0xacd7('0x40')](db[_0xacd7('0x3a')]['rawAttributes']);_0x41f162[_0xacd7('0x3f')]=_['keys'](_0x131984[_0xacd7('0x3f')]);_0x41f162[_0xacd7('0x41')]=_[_0xacd7('0x42')](_0x41f162[_0xacd7('0x3e')],_0x41f162[_0xacd7('0x3f')]);_0x5a3488[_0xacd7('0x44')]=_['intersection'](_0x41f162[_0xacd7('0x3e')],qs[_0xacd7('0x43')](_0x131984[_0xacd7('0x3f')][_0xacd7('0x43')]));_0x5a3488['attributes']=_0x5a3488['attributes'][_0xacd7('0x45')]?_0x5a3488[_0xacd7('0x44')]:_0x41f162['model'];if(_0x131984[_0xacd7('0x3f')]['includeAll']){_0x5a3488[_0xacd7('0x4e')]=[{'all':!![]}];}_0x5a3488=_[_0xacd7('0x4b')]({},_0x5a3488,_0x131984['options']);return db[_0xacd7('0x3a')][_0xacd7('0x33')](_0x5a3488)[_0xacd7('0x2a')](handleEntityNotFound(_0x452df6,null))[_0xacd7('0x2a')](respondWithResult(_0x452df6,null))['catch'](handleError(_0x452df6,null));};exports[_0xacd7('0x52')]=function(_0x55fc43,_0x557e5a){return db[_0xacd7('0x3a')][_0xacd7('0x52')](_0x55fc43[_0xacd7('0x53')],{})[_0xacd7('0x2a')](function(_0x175c25){var _0x118ca1=_0x55fc43[_0xacd7('0x54')][_0xacd7('0x55')]({'plain':!![]});if(!_0x118ca1)throw new Error(_0xacd7('0x56'));if(_0x118ca1[_0xacd7('0x57')]==='user'){var _0x5348ea=_0x175c25[_0xacd7('0x55')]({'plain':!![]});var _0x2c79f7=[{'name':_0xacd7('0x58'),'value':'inbound'},{'name':_0xacd7('0x2c'),'value':_0xacd7('0x2d')}];var _0x4730e1=_[_0xacd7('0x33')](_0x2c79f7,[_0xacd7('0x30'),_0x5348ea[_0xacd7('0x32')]])[_0xacd7('0x34')];return db['UserProfileSection'][_0xacd7('0x33')]({'where':{'name':_0x4730e1,'userProfileId':_0x118ca1[_0xacd7('0x59')]},'raw':!![]})[_0xacd7('0x2a')](function(_0x18f2b9){if(_0x18f2b9&&_0x18f2b9[_0xacd7('0x5a')]===0x0){return db[_0xacd7('0x35')][_0xacd7('0x52')]({'name':_0x5348ea[_0xacd7('0x34')],'resourceId':_0x5348ea['id'],'type':_0x18f2b9[_0xacd7('0x34')],'sectionId':_0x18f2b9['id']},{})[_0xacd7('0x2a')](function(){return _0x175c25;});}else{return _0x175c25;}})[_0xacd7('0x50')](function(_0x2471cb){logger[_0xacd7('0x5b')](_0xacd7('0x5c'),_0x2471cb);throw _0x2471cb;});}return _0x175c25;})[_0xacd7('0x2a')](respondWithResult(_0x557e5a,0xc9))[_0xacd7('0x50')](handleError(_0x557e5a,null));};exports['clone']=function(_0x21ecb1,_0x57a6f4){var _0x4e6252={'where':{'id':_0x21ecb1[_0xacd7('0x5d')]['id']}},_0x41f620={};_0x41f620['model']=_[_0xacd7('0x40')](db[_0xacd7('0x3a')][_0xacd7('0x3b')]);_0x4e6252[_0xacd7('0x44')]=_[_0xacd7('0x42')](_0x41f620[_0xacd7('0x3e')],qs[_0xacd7('0x43')](_0x21ecb1['query'][_0xacd7('0x43')]));_0x4e6252['attributes']=_0x4e6252[_0xacd7('0x44')][_0xacd7('0x45')]?_0x4e6252[_0xacd7('0x44')]:_0x41f620[_0xacd7('0x3e')];if(_0x21ecb1[_0xacd7('0x3f')][_0xacd7('0x4d')]){_0x4e6252[_0xacd7('0x4e')]=[{'all':!![]}];}_0x4e6252=_[_0xacd7('0x4b')]({},_0x4e6252,_0x21ecb1[_0xacd7('0x4c')]);return db[_0xacd7('0x3a')][_0xacd7('0x33')](_0x4e6252)[_0xacd7('0x2a')](handleEntityNotFound(_0x57a6f4,null))[_0xacd7('0x2a')](function(_0x585aa4){if(_0x585aa4){var _0x673db3=_0x585aa4[_0xacd7('0x55')]({'plain':!![]});_0x673db3=qs[_0xacd7('0x5e')](_0x673db3,['id','createdAt',_0xacd7('0x5f')]);_0x21ecb1[_0xacd7('0x53')]=_[_0xacd7('0x5e')](_0x21ecb1['body'],['id','createdAt',_0xacd7('0x5f')]);return db[_0xacd7('0x3a')][_0xacd7('0x52')](_[_0xacd7('0x4b')](_0x673db3,_0x21ecb1[_0xacd7('0x53')]),{'include':_0x21ecb1[_0xacd7('0x3f')]['includeAll']?[{'all':!![]}]:undefined})[_0xacd7('0x2a')](function(_0x486206){var _0x1f484d=_0x21ecb1[_0xacd7('0x54')]['get']({'plain':!![]});if(!_0x1f484d)throw new Error(_0xacd7('0x56'));if(_0x1f484d[_0xacd7('0x57')]==='user'){var _0x3cde3b=_0x486206[_0xacd7('0x55')]({'plain':!![]});var _0x5adcaa=[{'name':_0xacd7('0x58'),'value':'inbound'},{'name':'QueueCampaigns','value':_0xacd7('0x2d')}];var _0x269325=_[_0xacd7('0x33')](_0x5adcaa,['value',_0x3cde3b[_0xacd7('0x32')]])[_0xacd7('0x34')];return db[_0xacd7('0x60')][_0xacd7('0x33')]({'where':{'name':_0x269325,'userProfileId':_0x1f484d['userProfileId']},'raw':!![]})[_0xacd7('0x2a')](function(_0x880eac){if(_0x880eac&&_0x880eac[_0xacd7('0x5a')]===0x0){return db[_0xacd7('0x35')][_0xacd7('0x52')]({'name':_0x3cde3b['name'],'resourceId':_0x3cde3b['id'],'type':_0x880eac['name'],'sectionId':_0x880eac['id']},{})[_0xacd7('0x2a')](function(){return _0x486206;});}else{return _0x486206;}})[_0xacd7('0x50')](function(_0x2b5ea5){logger[_0xacd7('0x5b')](_0xacd7('0x5c'),_0x2b5ea5);throw _0x2b5ea5;});}return _0x486206;});}})[_0xacd7('0x2a')](respondWithResult(_0x57a6f4,0xc9))[_0xacd7('0x50')](handleError(_0x57a6f4,null));};exports['update']=function(_0xe660e6,_0x270aac){if(_0xe660e6[_0xacd7('0x53')]['id']){delete _0xe660e6[_0xacd7('0x53')]['id'];}return db[_0xacd7('0x3a')]['find']({'where':{'id':_0xe660e6[_0xacd7('0x5d')]['id']}})[_0xacd7('0x2a')](handleEntityNotFound(_0x270aac,null))[_0xacd7('0x2a')](saveUpdates(_0xe660e6[_0xacd7('0x53')],null))[_0xacd7('0x2a')](respondWithResult(_0x270aac,null))[_0xacd7('0x50')](handleError(_0x270aac,null));};exports['destroy']=function(_0x29390a,_0x5b0bbb){return db[_0xacd7('0x3a')][_0xacd7('0x33')]({'where':{'id':_0x29390a[_0xacd7('0x5d')]['id']}})[_0xacd7('0x2a')](handleEntityNotFound(_0x5b0bbb,null))['then'](removeEntity(_0x5b0bbb,null))['catch'](handleError(_0x5b0bbb,null));};exports['getHoppers']=function(_0x4b406e,_0x145c19,_0x3107d4){var _0x5d0664={'raw':![],'where':{}};var _0x3b114b={};var _0xe93de5={'count':0x0,'rows':[]};return db[_0xacd7('0x3a')][_0xacd7('0x61')]({'where':{'id':_0x4b406e[_0xacd7('0x5d')]['id']}})[_0xacd7('0x2a')](handleEntityNotFound(_0x145c19,null))[_0xacd7('0x2a')](function(_0x1e0947){if(_0x1e0947){_0x3b114b[_0xacd7('0x3e')]=_[_0xacd7('0x40')](db['CmHopper'][_0xacd7('0x3b')]);_0x3b114b[_0xacd7('0x3f')]=_['keys'](_0x4b406e[_0xacd7('0x3f')]);_0x3b114b['filters']=_[_0xacd7('0x42')](_0x3b114b['model'],_0x3b114b[_0xacd7('0x3f')]);_0x5d0664[_0xacd7('0x44')]=_[_0xacd7('0x42')](_0x3b114b[_0xacd7('0x3e')],qs['fields'](_0x4b406e['query'][_0xacd7('0x43')]));_0x5d0664[_0xacd7('0x44')]=_0x5d0664['attributes'][_0xacd7('0x45')]?_0x5d0664['attributes']:_0x3b114b[_0xacd7('0x3e')];if(!_0x4b406e[_0xacd7('0x3f')][_0xacd7('0x46')]('nolimit')){_0x5d0664['limit']=qs[_0xacd7('0x22')](_0x4b406e['query']['limit']);_0x5d0664['offset']=qs[_0xacd7('0x25')](_0x4b406e['query'][_0xacd7('0x25')]);}_0x5d0664['order']=qs[_0xacd7('0x48')](_0x4b406e[_0xacd7('0x3f')][_0xacd7('0x48')]);_0x5d0664[_0xacd7('0x49')]=qs['filters'](_[_0xacd7('0x4a')](_0x4b406e[_0xacd7('0x3f')],_0x3b114b[_0xacd7('0x41')]));_0x5d0664['where'][_0xacd7('0x62')]=_0x1e0947['id'];if(_0x4b406e['query']['filter']){_0x5d0664[_0xacd7('0x49')]=_['merge'](_0x5d0664['where'],{'$or':_['map'](_0x5d0664[_0xacd7('0x44')],function(_0x3ae7f7){var _0x115e4f={};_0x115e4f[_0x3ae7f7]={'$like':'%'+_0x4b406e[_0xacd7('0x3f')]['filter']+'%'};return _0x115e4f;})});}_0x5d0664=_[_0xacd7('0x4b')]({},_0x5d0664,_0x4b406e['options']);return db[_0xacd7('0x63')]['count']({'where':_0x5d0664['where']})[_0xacd7('0x2a')](function(_0x5d2065){_0xe93de5[_0xacd7('0x24')]=_0x5d2065;if(_0x4b406e['query'][_0xacd7('0x4d')]){_0x5d0664['include']=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x5d0664);})[_0xacd7('0x2a')](function(_0x25e861){_0xe93de5[_0xacd7('0x4f')]=_0x25e861;return _0xe93de5;});}})[_0xacd7('0x2a')](respondWithFilteredResult(_0x145c19,_0x5d0664))['catch'](handleError(_0x145c19,null));};exports['getHopperHistories']=function(_0x5408e1,_0x527af7,_0x5e4409){var _0x147a53={'raw':!![],'where':{}};var _0x43cb93={};var _0xea44ee={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xacd7('0x61')]({'where':{'id':_0x5408e1[_0xacd7('0x5d')]['id']}})[_0xacd7('0x2a')](handleEntityNotFound(_0x527af7,null))[_0xacd7('0x2a')](function(_0x208377){if(_0x208377){_0x43cb93[_0xacd7('0x3e')]=_[_0xacd7('0x40')](db[_0xacd7('0x64')][_0xacd7('0x3b')]);_0x43cb93[_0xacd7('0x3f')]=_['keys'](_0x5408e1[_0xacd7('0x3f')]);_0x43cb93[_0xacd7('0x41')]=_[_0xacd7('0x42')](_0x43cb93[_0xacd7('0x3e')],_0x43cb93[_0xacd7('0x3f')]);_0x147a53['attributes']=_[_0xacd7('0x42')](_0x43cb93[_0xacd7('0x3e')],qs[_0xacd7('0x43')](_0x5408e1[_0xacd7('0x3f')][_0xacd7('0x43')]));_0x147a53[_0xacd7('0x44')]=_0x147a53[_0xacd7('0x44')]['length']?_0x147a53[_0xacd7('0x44')]:_0x43cb93[_0xacd7('0x3e')];if(!_0x5408e1[_0xacd7('0x3f')][_0xacd7('0x46')](_0xacd7('0x47'))){_0x147a53['limit']=qs[_0xacd7('0x22')](_0x5408e1[_0xacd7('0x3f')]['limit']);_0x147a53[_0xacd7('0x25')]=qs[_0xacd7('0x25')](_0x5408e1[_0xacd7('0x3f')]['offset']);}_0x147a53[_0xacd7('0x65')]=qs[_0xacd7('0x48')](_0x5408e1[_0xacd7('0x3f')][_0xacd7('0x48')]);_0x147a53['where']=qs[_0xacd7('0x41')](_[_0xacd7('0x4a')](_0x5408e1[_0xacd7('0x3f')],_0x43cb93[_0xacd7('0x41')]));_0x147a53[_0xacd7('0x49')][_0xacd7('0x62')]=_0x208377['id'];if(_0x5408e1[_0xacd7('0x3f')]['filter']){_0x147a53[_0xacd7('0x49')]=_[_0xacd7('0x4b')](_0x147a53[_0xacd7('0x49')],{'$or':_['map'](_0x147a53[_0xacd7('0x44')],function(_0xb6f27a){var _0x267903={};_0x267903[_0xb6f27a]={'$like':'%'+_0x5408e1[_0xacd7('0x3f')][_0xacd7('0x2e')]+'%'};return _0x267903;})});}_0x147a53=_[_0xacd7('0x4b')]({},_0x147a53,_0x5408e1[_0xacd7('0x4c')]);return db['CmHopperHistory'][_0xacd7('0x24')]({'where':_0x147a53[_0xacd7('0x49')]})[_0xacd7('0x2a')](function(_0x25b94c){_0xea44ee[_0xacd7('0x24')]=_0x25b94c;if(_0x5408e1[_0xacd7('0x3f')][_0xacd7('0x4d')]){_0x147a53[_0xacd7('0x4e')]=[{'all':!![]}];}return db[_0xacd7('0x64')]['findAll'](_0x147a53);})[_0xacd7('0x2a')](function(_0x16e229){_0xea44ee['rows']=_0x16e229;return _0xea44ee;});}})[_0xacd7('0x2a')](respondWithFilteredResult(_0x527af7,_0x147a53))[_0xacd7('0x50')](handleError(_0x527af7,null));};exports[_0xacd7('0x66')]=function(_0x538eac,_0x2b0a56,_0x1c9984){var _0x4df578={'raw':!![],'where':{}};var _0x8f2d9={};var _0x1c7abb={'count':0x0,'rows':[]};return db[_0xacd7('0x3a')][_0xacd7('0x61')]({'where':{'id':_0x538eac[_0xacd7('0x5d')]['id']}})[_0xacd7('0x2a')](handleEntityNotFound(_0x2b0a56,null))[_0xacd7('0x2a')](function(_0x7729b3){if(_0x7729b3){_0x8f2d9[_0xacd7('0x3e')]=_['keys'](db[_0xacd7('0x67')][_0xacd7('0x3b')]);_0x8f2d9['query']=_[_0xacd7('0x40')](_0x538eac[_0xacd7('0x3f')]);_0x8f2d9['filters']=_[_0xacd7('0x42')](_0x8f2d9[_0xacd7('0x3e')],_0x8f2d9['query']);_0x4df578['attributes']=_[_0xacd7('0x42')](_0x8f2d9[_0xacd7('0x3e')],qs[_0xacd7('0x43')](_0x538eac[_0xacd7('0x3f')][_0xacd7('0x43')]));_0x4df578[_0xacd7('0x44')]=_0x4df578['attributes']['length']?_0x4df578['attributes']:_0x8f2d9['model'];if(!_0x538eac[_0xacd7('0x3f')][_0xacd7('0x46')](_0xacd7('0x47'))){_0x4df578[_0xacd7('0x22')]=qs[_0xacd7('0x22')](_0x538eac[_0xacd7('0x3f')][_0xacd7('0x22')]);_0x4df578[_0xacd7('0x25')]=qs[_0xacd7('0x25')](_0x538eac[_0xacd7('0x3f')][_0xacd7('0x25')]);}_0x4df578[_0xacd7('0x65')]=qs['sort'](_0x538eac[_0xacd7('0x3f')][_0xacd7('0x48')]);_0x4df578[_0xacd7('0x49')]=qs[_0xacd7('0x41')](_['pick'](_0x538eac[_0xacd7('0x3f')],_0x8f2d9[_0xacd7('0x41')]));_0x4df578[_0xacd7('0x49')][_0xacd7('0x62')]=_0x7729b3['id'];if(_0x538eac[_0xacd7('0x3f')][_0xacd7('0x2e')]){_0x4df578['where']=_[_0xacd7('0x4b')](_0x4df578['where'],{'$or':_[_0xacd7('0x39')](_0x4df578['attributes'],function(_0x4f7685){var _0x42ff75={};_0x42ff75[_0x4f7685]={'$like':'%'+_0x538eac[_0xacd7('0x3f')][_0xacd7('0x2e')]+'%'};return _0x42ff75;})});}_0x4df578=_[_0xacd7('0x4b')]({},_0x4df578,_0x538eac[_0xacd7('0x4c')]);return db[_0xacd7('0x67')][_0xacd7('0x24')]({'where':_0x4df578['where']})[_0xacd7('0x2a')](function(_0x264164){_0x1c7abb[_0xacd7('0x24')]=_0x264164;if(_0x538eac[_0xacd7('0x3f')][_0xacd7('0x4d')]){_0x4df578[_0xacd7('0x4e')]=[{'all':!![]}];}return db[_0xacd7('0x67')][_0xacd7('0x68')](_0x4df578);})[_0xacd7('0x2a')](function(_0x2f0816){_0x1c7abb['rows']=_0x2f0816;return _0x1c7abb;});}})[_0xacd7('0x2a')](respondWithFilteredResult(_0x2b0a56,_0x4df578))['catch'](handleError(_0x2b0a56,null));};exports[_0xacd7('0x69')]=function(_0x30685d,_0x3f80a0,_0x5fd4b8){var _0x6e1204={'raw':!![],'where':{}};var _0xa25657={};var _0xf57de0={'count':0x0,'rows':[]};return db[_0xacd7('0x3a')][_0xacd7('0x61')]({'where':{'id':_0x30685d[_0xacd7('0x5d')]['id']}})[_0xacd7('0x2a')](handleEntityNotFound(_0x3f80a0,null))[_0xacd7('0x2a')](function(_0x524308){if(_0x524308){_0xa25657['model']=_[_0xacd7('0x40')](db[_0xacd7('0x6a')][_0xacd7('0x3b')]);_0xa25657['query']=_[_0xacd7('0x40')](_0x30685d[_0xacd7('0x3f')]);_0xa25657['filters']=_[_0xacd7('0x42')](_0xa25657[_0xacd7('0x3e')],_0xa25657[_0xacd7('0x3f')]);_0x6e1204[_0xacd7('0x44')]=_[_0xacd7('0x42')](_0xa25657[_0xacd7('0x3e')],qs[_0xacd7('0x43')](_0x30685d[_0xacd7('0x3f')][_0xacd7('0x43')]));_0x6e1204[_0xacd7('0x44')]=_0x6e1204[_0xacd7('0x44')]['length']?_0x6e1204[_0xacd7('0x44')]:_0xa25657[_0xacd7('0x3e')];if(!_0x30685d[_0xacd7('0x3f')][_0xacd7('0x46')](_0xacd7('0x47'))){_0x6e1204[_0xacd7('0x22')]=qs[_0xacd7('0x22')](_0x30685d[_0xacd7('0x3f')][_0xacd7('0x22')]);_0x6e1204[_0xacd7('0x25')]=qs[_0xacd7('0x25')](_0x30685d[_0xacd7('0x3f')][_0xacd7('0x25')]);}_0x6e1204['order']=qs[_0xacd7('0x48')](_0x30685d[_0xacd7('0x3f')]['sort']);_0x6e1204[_0xacd7('0x49')]=qs[_0xacd7('0x41')](_['pick'](_0x30685d['query'],_0xa25657[_0xacd7('0x41')]));_0x6e1204[_0xacd7('0x49')][_0xacd7('0x62')]=_0x524308['id'];if(_0x30685d['query'][_0xacd7('0x2e')]){_0x6e1204[_0xacd7('0x49')]=_[_0xacd7('0x4b')](_0x6e1204[_0xacd7('0x49')],{'$or':_['map'](_0x6e1204[_0xacd7('0x44')],function(_0x4d11e6){var _0x4c1b69={};_0x4c1b69[_0x4d11e6]={'$like':'%'+_0x30685d[_0xacd7('0x3f')][_0xacd7('0x2e')]+'%'};return _0x4c1b69;})});}_0x6e1204=_[_0xacd7('0x4b')]({},_0x6e1204,_0x30685d[_0xacd7('0x4c')]);return db[_0xacd7('0x6a')][_0xacd7('0x24')]({'where':_0x6e1204['where']})[_0xacd7('0x2a')](function(_0x5a2948){_0xf57de0['count']=_0x5a2948;if(_0x30685d[_0xacd7('0x3f')]['includeAll']){_0x6e1204[_0xacd7('0x4e')]=[{'all':!![]}];}return db['CmHopperBlack'][_0xacd7('0x68')](_0x6e1204);})[_0xacd7('0x2a')](function(_0x3092cc){_0xf57de0['rows']=_0x3092cc;return _0xf57de0;});}})['then'](respondWithFilteredResult(_0x3f80a0,_0x6e1204))[_0xacd7('0x50')](handleError(_0x3f80a0,null));};exports[_0xacd7('0x6b')]=function(_0x25408f,_0x45cee0,_0x1c4c55){var _0x335ff0={};var _0x57071d={};var _0x5bb255;var _0x47754f;return db['VoiceQueue'][_0xacd7('0x61')]({'where':{'id':_0x25408f[_0xacd7('0x5d')]['id']}})[_0xacd7('0x2a')](handleEntityNotFound(_0x45cee0,null))[_0xacd7('0x2a')](function(_0x4ac0ec){if(_0x4ac0ec){_0x5bb255=_0x4ac0ec;_0x57071d[_0xacd7('0x3e')]=_['keys'](db[_0xacd7('0x6c')][_0xacd7('0x3b')]);_0x57071d[_0xacd7('0x3f')]=_['keys'](_0x25408f['query']);_0x57071d[_0xacd7('0x41')]=_[_0xacd7('0x42')](_0x57071d[_0xacd7('0x3e')],_0x57071d[_0xacd7('0x3f')]);_0x335ff0[_0xacd7('0x44')]=_['intersection'](_0x57071d[_0xacd7('0x3e')],qs[_0xacd7('0x43')](_0x25408f[_0xacd7('0x3f')]['fields']));_0x335ff0[_0xacd7('0x44')]=_0x335ff0[_0xacd7('0x44')][_0xacd7('0x45')]?_0x335ff0[_0xacd7('0x44')]:_0x57071d[_0xacd7('0x3e')];_0x335ff0[_0xacd7('0x65')]=qs[_0xacd7('0x48')](_0x25408f['query'][_0xacd7('0x48')]);_0x335ff0['where']=qs[_0xacd7('0x41')](_[_0xacd7('0x4a')](_0x25408f[_0xacd7('0x3f')],_0x57071d['filters']));if(_0x25408f['query'][_0xacd7('0x2e')]){_0x335ff0['where']=_[_0xacd7('0x4b')](_0x335ff0[_0xacd7('0x49')],{'$or':_[_0xacd7('0x39')](_0x335ff0[_0xacd7('0x44')],function(_0x5f2b13){var _0x597d1b={};_0x597d1b[_0x5f2b13]={'$like':'%'+_0x25408f[_0xacd7('0x3f')][_0xacd7('0x2e')]+'%'};return _0x597d1b;})});}_0x335ff0=_['merge']({},_0x335ff0,_0x25408f[_0xacd7('0x4c')]);return _0x5bb255['getTeams'](_0x335ff0);}})[_0xacd7('0x2a')](function(_0xd2cdbe){if(_0xd2cdbe){_0x47754f=_0xd2cdbe[_0xacd7('0x45')];if(!_0x25408f[_0xacd7('0x3f')][_0xacd7('0x46')](_0xacd7('0x47'))){_0x335ff0[_0xacd7('0x22')]=qs['limit'](_0x25408f[_0xacd7('0x3f')][_0xacd7('0x22')]);_0x335ff0[_0xacd7('0x25')]=qs[_0xacd7('0x25')](_0x25408f[_0xacd7('0x3f')][_0xacd7('0x25')]);}return _0x5bb255['getTeams'](_0x335ff0);}})[_0xacd7('0x2a')](function(_0x371894){if(_0x371894){return _0x371894?{'count':_0x47754f,'rows':_0x371894}:null;}})[_0xacd7('0x2a')](respondWithResult(_0x45cee0,null))['catch'](handleError(_0x45cee0,null));};exports[_0xacd7('0x6d')]=function(_0x4d4543,_0x26bcf2,_0x2368c2){var _0x1415e7=_0x4d4543['body']['teams'];var _0x4ca5dd=_['map'](_0x1415e7,'id');return db[_0xacd7('0x6c')][_0xacd7('0x68')]({'where':{'id':_0x4ca5dd},'attributes':['id'],'include':[{'model':db[_0xacd7('0x6e')],'as':'Agents','attributes':['id',_0xacd7('0x34'),'online',_0xacd7('0x6f'),_0xacd7('0x70')],'raw':!![]}]})[_0xacd7('0x2a')](function(_0x71d70a){if(_0x71d70a){var _0x1b0fe0=_[_0xacd7('0x71')](_0x71d70a,function(_0x1b73c4){var _0x1be9a=_0x1b73c4[_0xacd7('0x55')]({'plain':!![]});_0x1be9a[_0xacd7('0x72')]['forEach'](function(_0x291121){_0x291121['penalty']=_[_0xacd7('0x33')](_0x1415e7,{'id':_0x1be9a['id']})[_0xacd7('0x73')];});return _0x1be9a[_0xacd7('0x72')];});return db['VoiceQueue'][_0xacd7('0x33')]({'where':{'id':_0x4d4543[_0xacd7('0x5d')]['id']}})[_0xacd7('0x2a')](function(_0x378768){return db['sequelize']['transaction'](function(_0x4e5879){return _0x378768[_0xacd7('0x6d')](_0x4ca5dd,{'transaction':_0x4e5879})[_0xacd7('0x2a')](function(){return BPromise['each'](_0x1415e7,function(_0x1f925a){return db[_0xacd7('0x74')]['upsert']({'TeamId':_0x1f925a['id'],'VoiceQueueId':_0x4d4543[_0xacd7('0x5d')]['id'],'penalty':_0x1f925a['penalty']},{'transaction':_0x4e5879});});})[_0xacd7('0x2a')](function(){return BPromise[_0xacd7('0x75')](_0x1b0fe0,function(_0x5bcbbe){return db['UserVoiceQueue'][_0xacd7('0x76')]({'where':{'UserId':_0x5bcbbe['id'],'VoiceQueueId':_0x4d4543[_0xacd7('0x5d')]['id']},'defaults':{'penalty':_0x5bcbbe[_0xacd7('0x73')]},'transaction':_0x4e5879});});})[_0xacd7('0x2a')](function(){return BPromise['each'](_['filter'](_0x1b0fe0,{'online':!![]}),function(_0x9def14){return db[_0xacd7('0x77')][_0xacd7('0x78')]({'membername':_0x9def14['name'],'UserId':_0x9def14['id'],'queue_name':_0x378768[_0xacd7('0x34')],'VoiceQueueId':_0x378768['id'],'interface':_['isNil'](_0x9def14[_0xacd7('0x70')])?util['format'](_0xacd7('0x79'),_0x9def14['name']):_0x9def14[_0xacd7('0x70')],'paused':_0x9def14[_0xacd7('0x6f')]||![],'penalty':_0x9def14[_0xacd7('0x73')]},{'transaction':_0x4e5879});});})['then'](function(){_0x1b0fe0[_0xacd7('0x7a')](function(_0x43bf47){socket[_0xacd7('0x7b')](_0xacd7('0x7c'),{'UserId':_0x43bf47['id'],'VoiceQueueId':_0x378768['id']});});});});});}})[_0xacd7('0x2a')](respondWithStatusCode(_0x26bcf2,null))[_0xacd7('0x50')](handleError(_0x26bcf2,null));};exports['removeTeams']=function(_0x449eed,_0x1571fb,_0x5063f6){return db[_0xacd7('0x6c')][_0xacd7('0x68')]({'where':{'id':_0x449eed[_0xacd7('0x3f')]['ids']},'attributes':['id'],'include':[{'model':db[_0xacd7('0x6e')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xacd7('0x2a')](handleEntityNotFound(_0x1571fb,null))[_0xacd7('0x2a')](function(_0x164248){var _0x174621=_[_0xacd7('0x39')](_0x164248,'id');var _0x556c1d=[];var _0x1fb321=[];var _0x6d3439=squel['select']();_0x6d3439[_0xacd7('0x7d')](_0xacd7('0x7e'))[_0xacd7('0x7f')](_0xacd7('0x80'),'tq')[_0xacd7('0x81')](_0xacd7('0x82'),'ut',_0xacd7('0x83'))[_0xacd7('0x49')](_0xacd7('0x84'),_0x449eed[_0xacd7('0x5d')]['id']);for(var _0x70e2a9=0x0;_0x70e2a9<_0x164248['length'];_0x70e2a9+=0x1){let _0x444652=_0x164248[_0x70e2a9];for(var _0x3ae3cf=0x0;_0x3ae3cf<_0x444652[_0xacd7('0x72')][_0xacd7('0x45')];_0x3ae3cf+=0x1){let _0x4baba2=_0x444652[_0xacd7('0x72')][_0x3ae3cf];var _0xd66664=_0x6d3439[_0xacd7('0x85')]();_0xd66664[_0xacd7('0x49')](_0xacd7('0x86'),_0x4baba2['id']);_0x1fb321[_0xacd7('0x87')](db['sequelize'][_0xacd7('0x3f')](_0xd66664[_0xacd7('0x88')](),{'type':db['sequelize'][_0xacd7('0x89')][_0xacd7('0x8a')]})[_0xacd7('0x2a')](function(_0x28d333){if(_0x28d333['length']===0x1){return _0x4baba2['id'];}else{var _0x547e30=_[_0xacd7('0x8b')](_['map'](_0x28d333,_0xacd7('0x8c')),function(_0x1e942d){return _[_0xacd7('0x31')](_0x174621,_0x1e942d);});if(_0x547e30){return _0x4baba2['id'];}}}));}}return BPromise['all'](_0x1fb321)['then'](function(_0x19777f){_0x556c1d=_(_0x556c1d)[_0xacd7('0x8d')](_0x19777f)['compact']()[_0xacd7('0x30')]();return db['VoiceQueue'][_0xacd7('0x33')]({'where':{'id':_0x449eed[_0xacd7('0x5d')]['id']}})[_0xacd7('0x2a')](function(_0x5b4b84){return db['sequelize'][_0xacd7('0x8e')](function(_0x336051){return _0x5b4b84['removeTeams'](_0x449eed[_0xacd7('0x3f')][_0xacd7('0x8f')],{'transaction':_0x336051})[_0xacd7('0x2a')](function(){if(!_[_0xacd7('0x90')](_0x556c1d)){return _0x5b4b84[_0xacd7('0x91')](_0x556c1d,{'transaction':_0x336051})['then'](function(){return db[_0xacd7('0x77')][_0xacd7('0x92')]({'where':{'VoiceQueueId':_0x449eed[_0xacd7('0x5d')]['id'],'UserId':_0x556c1d},'transaction':_0x336051});});}})[_0xacd7('0x2a')](function(){_0x556c1d[_0xacd7('0x7a')](function(_0x40b4c5){socket[_0xacd7('0x7b')](_0xacd7('0x93'),{'UserId':_0x40b4c5,'VoiceQueueId':_0x5b4b84['id']});});});});});});})[_0xacd7('0x2a')](respondWithStatusCode(_0x1571fb,null))[_0xacd7('0x50')](handleError(_0x1571fb,null));};exports['addAgents']=function(_0x662d06,_0x1b706e,_0x2d002f){var _0x46f5fa,_0x21f977;return db['VoiceQueue']['find']({'where':{'id':_0x662d06[_0xacd7('0x5d')]['id']}})[_0xacd7('0x2a')](handleEntityNotFound(_0x1b706e,null))[_0xacd7('0x2a')](function(_0x25eb39){if(_0x25eb39){_0x21f977=_0x25eb39;return _0x25eb39[_0xacd7('0x94')](_0x662d06[_0xacd7('0x53')]['ids'],_[_0xacd7('0x5e')](_0x662d06[_0xacd7('0x53')],[_0xacd7('0x8f'),'id'])||{})['spread'](function(_0x405769){for(var _0xb9a4b7=0x0;_0xb9a4b7<_0x662d06[_0xacd7('0x53')][_0xacd7('0x8f')][_0xacd7('0x45')];_0xb9a4b7+=0x1){socket[_0xacd7('0x7b')](_0xacd7('0x7c'),{'UserId':Number(_0x662d06[_0xacd7('0x53')][_0xacd7('0x8f')][_0xb9a4b7]),'VoiceQueueId':Number(_0x662d06[_0xacd7('0x5d')]['id'])});}return _0x405769;});}})[_0xacd7('0x2a')](function(_0x4f3c55){_0x46f5fa=_0x4f3c55||[];if(_0x21f977){return db['User'][_0xacd7('0x68')]({'where':{'id':_0x662d06[_0xacd7('0x53')][_0xacd7('0x8f')]},'attributes':['id',_0xacd7('0x34'),_0xacd7('0x95'),'voicePause',_0xacd7('0x70')],'raw':!![]});}})[_0xacd7('0x2a')](function(_0x5e2eb2){if(!_[_0xacd7('0x90')](_0x5e2eb2)){var _0x14b1f9=[];for(var _0x102bd5=0x0;_0x102bd5<_0x5e2eb2['length'];_0x102bd5++){if(_0x5e2eb2[_0x102bd5][_0xacd7('0x95')]){_0x14b1f9['push'](db['UserVoiceQueueRt'][_0xacd7('0x78')]({'membername':_0x5e2eb2[_0x102bd5][_0xacd7('0x34')],'UserId':_0x5e2eb2[_0x102bd5]['id'],'queue_name':_0x21f977['name'],'VoiceQueueId':_0x21f977['id'],'interface':_['isNil'](_0x5e2eb2[_0x102bd5][_0xacd7('0x70')])?util[_0xacd7('0x96')]('SIP/%s',_0x5e2eb2[_0x102bd5][_0xacd7('0x34')]):_0x5e2eb2[_0x102bd5][_0xacd7('0x70')],'paused':_0x5e2eb2[_0x102bd5][_0xacd7('0x6f')]||![],'penalty':_0x662d06[_0xacd7('0x53')][_0xacd7('0x73')]||0x0}));}}return BPromise['all'](_0x14b1f9);}})[_0xacd7('0x2a')](function(){return _0x46f5fa;})[_0xacd7('0x2a')](respondWithResult(_0x1b706e,null))[_0xacd7('0x50')](handleError(_0x1b706e,null));};exports['removeAgents']=function(_0x5ee87e,_0x2d84ee,_0x336251){return db[_0xacd7('0x3a')]['find']({'where':{'id':_0x5ee87e[_0xacd7('0x5d')]['id']}})[_0xacd7('0x2a')](handleEntityNotFound(_0x2d84ee,null))[_0xacd7('0x2a')](function(_0x3780ea){if(_0x3780ea){return _0x3780ea[_0xacd7('0x91')](_0x5ee87e[_0xacd7('0x3f')][_0xacd7('0x8f')])[_0xacd7('0x2a')](function(){if(_[_0xacd7('0x97')](_0x5ee87e[_0xacd7('0x3f')]['ids'])){for(var _0x401329=0x0;_0x401329<_0x5ee87e[_0xacd7('0x3f')][_0xacd7('0x8f')]['length'];_0x401329+=0x1){socket['emit'](_0xacd7('0x93'),{'UserId':Number(_0x5ee87e[_0xacd7('0x3f')][_0xacd7('0x8f')][_0x401329]),'VoiceQueueId':Number(_0x5ee87e[_0xacd7('0x5d')]['id'])});}}else{socket[_0xacd7('0x7b')](_0xacd7('0x93'),{'UserId':Number(_0x5ee87e[_0xacd7('0x3f')][_0xacd7('0x8f')]),'VoiceQueueId':Number(_0x5ee87e[_0xacd7('0x5d')]['id'])});}});}})[_0xacd7('0x2a')](function(_0x5339e8){return db[_0xacd7('0x77')]['destroy']({'where':{'VoiceQueueId':_0x5ee87e[_0xacd7('0x5d')]['id'],'UserId':_0x5ee87e[_0xacd7('0x3f')][_0xacd7('0x8f')]}})[_0xacd7('0x2a')](function(){return _0x5339e8;});})[_0xacd7('0x2a')](respondWithStatusCode(_0x2d84ee,null))[_0xacd7('0x50')](handleError(_0x2d84ee,null));};exports[_0xacd7('0x98')]=function(_0x5ae24c,_0x1ac6a1,_0x32826f){var _0x14c07e={};var _0x41e7d2={};var _0x549f29;var _0x5097de;return db['VoiceQueue'][_0xacd7('0x61')]({'where':{'id':_0x5ae24c[_0xacd7('0x5d')]['id']}})['then'](handleEntityNotFound(_0x1ac6a1,null))['then'](function(_0x2f9b2b){if(_0x2f9b2b){_0x549f29=_0x2f9b2b;_0x41e7d2[_0xacd7('0x3e')]=_[_0xacd7('0x40')](db[_0xacd7('0x6e')][_0xacd7('0x3b')]);_0x41e7d2[_0xacd7('0x3f')]=_[_0xacd7('0x40')](_0x5ae24c['query']);_0x41e7d2[_0xacd7('0x41')]=_['intersection'](_0x41e7d2[_0xacd7('0x3e')],_0x41e7d2['query']);_0x14c07e['attributes']=_[_0xacd7('0x42')](_0x41e7d2[_0xacd7('0x3e')],qs['fields'](_0x5ae24c[_0xacd7('0x3f')][_0xacd7('0x43')]));_0x14c07e[_0xacd7('0x44')]=_0x14c07e[_0xacd7('0x44')]['length']?_0x14c07e[_0xacd7('0x44')]:_0x41e7d2[_0xacd7('0x3e')];_0x14c07e[_0xacd7('0x65')]=qs['sort'](_0x5ae24c['query'][_0xacd7('0x48')]);_0x14c07e['where']=qs['filters'](_[_0xacd7('0x4a')](_0x5ae24c['query'],_0x41e7d2['filters']));if(_0x5ae24c['query']['filter']){_0x14c07e[_0xacd7('0x49')]=_[_0xacd7('0x4b')](_0x14c07e['where'],{'$or':_[_0xacd7('0x39')](_0x14c07e[_0xacd7('0x44')],function(_0x378c1f){var _0x44a3f8={};_0x44a3f8[_0x378c1f]={'$like':'%'+_0x5ae24c[_0xacd7('0x3f')]['filter']+'%'};return _0x44a3f8;})});}_0x14c07e=_[_0xacd7('0x4b')]({},_0x14c07e,_0x5ae24c[_0xacd7('0x4c')]);return _0x549f29[_0xacd7('0x98')](_0x14c07e);}})['then'](function(_0x4f371e){if(_0x4f371e){_0x5097de=_0x4f371e[_0xacd7('0x45')];if(!_0x5ae24c[_0xacd7('0x3f')][_0xacd7('0x46')](_0xacd7('0x47'))){_0x14c07e[_0xacd7('0x22')]=qs['limit'](_0x5ae24c[_0xacd7('0x3f')][_0xacd7('0x22')]);_0x14c07e[_0xacd7('0x25')]=qs[_0xacd7('0x25')](_0x5ae24c['query'][_0xacd7('0x25')]);}return _0x549f29[_0xacd7('0x98')](_0x14c07e);}})[_0xacd7('0x2a')](function(_0x552fd9){if(_0x552fd9){return _0x552fd9?{'count':_0x5097de,'rows':_0x552fd9}:null;}})['then'](respondWithResult(_0x1ac6a1,null))[_0xacd7('0x50')](handleError(_0x1ac6a1,null));};exports['getMembers']=function(_0x25341a,_0x333516,_0x293fa4){var _0x278729={};var _0x284ef1={};var _0x137105;var _0x255ac4;return db['VoiceQueue'][_0xacd7('0x61')]({'where':{'id':_0x25341a[_0xacd7('0x5d')]['id']}})[_0xacd7('0x2a')](handleEntityNotFound(_0x333516,null))[_0xacd7('0x2a')](function(_0x476d22){if(_0x476d22){_0x137105=_0x476d22;_0x284ef1['model']=_[_0xacd7('0x40')](db[_0xacd7('0x77')][_0xacd7('0x3b')]);_0x284ef1[_0xacd7('0x3f')]=_['keys'](_0x25341a['query']);_0x284ef1['filters']=_[_0xacd7('0x42')](_0x284ef1[_0xacd7('0x3e')],_0x284ef1[_0xacd7('0x3f')]);_0x278729[_0xacd7('0x44')]=_[_0xacd7('0x42')](_0x284ef1['model'],qs[_0xacd7('0x43')](_0x25341a[_0xacd7('0x3f')][_0xacd7('0x43')]));_0x278729[_0xacd7('0x44')]=_0x278729[_0xacd7('0x44')]['length']?_0x278729[_0xacd7('0x44')]:_0x284ef1['model'];_0x278729[_0xacd7('0x65')]=qs[_0xacd7('0x48')](_0x25341a['query'][_0xacd7('0x48')]);_0x278729[_0xacd7('0x49')]=qs[_0xacd7('0x41')](_[_0xacd7('0x4a')](_0x25341a['query'],_0x284ef1['filters']));if(_0x25341a[_0xacd7('0x3f')][_0xacd7('0x2e')]){_0x278729[_0xacd7('0x49')]=_[_0xacd7('0x4b')](_0x278729[_0xacd7('0x49')],{'$or':_['map'](_0x278729[_0xacd7('0x44')],function(_0x3653b6){var _0x383ac4={};_0x383ac4[_0x3653b6]={'$like':'%'+_0x25341a['query']['filter']+'%'};return _0x383ac4;})});}_0x278729=_[_0xacd7('0x4b')]({},_0x278729,_0x25341a['options']);return _0x137105[_0xacd7('0x99')](_0x278729);}})[_0xacd7('0x2a')](function(_0x321d67){if(_0x321d67){_0x255ac4=_0x321d67[_0xacd7('0x45')];if(!_0x25341a['query'][_0xacd7('0x46')](_0xacd7('0x47'))){_0x278729['limit']=qs[_0xacd7('0x22')](_0x25341a[_0xacd7('0x3f')]['limit']);_0x278729[_0xacd7('0x25')]=qs[_0xacd7('0x25')](_0x25341a[_0xacd7('0x3f')][_0xacd7('0x25')]);}return _0x137105[_0xacd7('0x99')](_0x278729);}})[_0xacd7('0x2a')](function(_0x5a0ac1){return _0x5a0ac1?{'count':_0x255ac4,'rows':_0x5a0ac1}:null;})[_0xacd7('0x2a')](respondWithResult(_0x333516,null))[_0xacd7('0x50')](handleError(_0x333516,null));};exports[_0xacd7('0x9a')]=function(_0x2b4cce,_0x17b4db,_0x2a7017){var _0x2f895b={};var _0x3a3ee4={};var _0x7c40cd;var _0x3a31d6;return db[_0xacd7('0x3a')][_0xacd7('0x61')]({'where':{'id':_0x2b4cce['params']['id']}})[_0xacd7('0x2a')](handleEntityNotFound(_0x17b4db,null))[_0xacd7('0x2a')](function(_0x430a36){if(_0x430a36){_0x7c40cd=_0x430a36;_0x3a3ee4[_0xacd7('0x3e')]=_['keys'](db[_0xacd7('0x9b')][_0xacd7('0x3b')]);_0x3a3ee4['query']=_['keys'](_0x2b4cce[_0xacd7('0x3f')]);_0x3a3ee4[_0xacd7('0x41')]=_[_0xacd7('0x42')](_0x3a3ee4[_0xacd7('0x3e')],_0x3a3ee4[_0xacd7('0x3f')]);_0x2f895b[_0xacd7('0x44')]=_[_0xacd7('0x42')](_0x3a3ee4['model'],qs[_0xacd7('0x43')](_0x2b4cce['query'][_0xacd7('0x43')]));_0x2f895b[_0xacd7('0x44')]=_0x2f895b[_0xacd7('0x44')][_0xacd7('0x45')]?_0x2f895b[_0xacd7('0x44')]:_0x3a3ee4[_0xacd7('0x3e')];_0x2f895b[_0xacd7('0x65')]=qs['sort'](_0x2b4cce[_0xacd7('0x3f')][_0xacd7('0x48')]);_0x2f895b['where']=qs[_0xacd7('0x41')](_[_0xacd7('0x4a')](_0x2b4cce[_0xacd7('0x3f')],_0x3a3ee4[_0xacd7('0x41')]));if(_0x2b4cce[_0xacd7('0x3f')][_0xacd7('0x2e')]){_0x2f895b[_0xacd7('0x49')]=_['merge'](_0x2f895b[_0xacd7('0x49')],{'$or':_[_0xacd7('0x39')](_0x2f895b[_0xacd7('0x44')],function(_0x2d1f59){var _0x178805={};_0x178805[_0x2d1f59]={'$like':'%'+_0x2b4cce[_0xacd7('0x3f')]['filter']+'%'};return _0x178805;})});}_0x2f895b=_[_0xacd7('0x4b')]({},_0x2f895b,_0x2b4cce['options']);return _0x7c40cd[_0xacd7('0x9a')](_0x2f895b);}})[_0xacd7('0x2a')](function(_0x3c7a1b){if(_0x3c7a1b){_0x3a31d6=_0x3c7a1b[_0xacd7('0x45')];if(!_0x2b4cce[_0xacd7('0x3f')][_0xacd7('0x46')]('nolimit')){_0x2f895b[_0xacd7('0x22')]=qs[_0xacd7('0x22')](_0x2b4cce[_0xacd7('0x3f')][_0xacd7('0x22')]);_0x2f895b[_0xacd7('0x25')]=qs[_0xacd7('0x25')](_0x2b4cce[_0xacd7('0x3f')][_0xacd7('0x25')]);}return _0x7c40cd[_0xacd7('0x9a')](_0x2f895b);}})[_0xacd7('0x2a')](function(_0x4fd0c1){if(_0x4fd0c1){return _0x4fd0c1?{'count':_0x3a31d6,'rows':_0x4fd0c1}:null;}})['then'](respondWithResult(_0x17b4db,null))[_0xacd7('0x50')](handleError(_0x17b4db,null));};exports[_0xacd7('0x9c')]=function(_0xc993e3,_0xd2ba09,_0x12ea05){var _0x1652ac,_0x2d4407;return db[_0xacd7('0x3a')][_0xacd7('0x33')]({'where':{'id':_0xc993e3[_0xacd7('0x5d')]['id']}})[_0xacd7('0x2a')](handleEntityNotFound(_0xd2ba09,null))['then'](function(_0x1c3aed){if(_0x1c3aed){_0x2d4407=_0x1c3aed;return _0x1c3aed[_0xacd7('0x9c')](_0xc993e3['body']['ids'],_[_0xacd7('0x5e')](_0xc993e3[_0xacd7('0x53')],['ids','id'])||{});}return null;})[_0xacd7('0x9d')](function(_0xb6fddf){var _0x241ead;_0x1652ac=_0xb6fddf||[];var _0x18be9c=[];if(_0xb6fddf){for(var _0x18497c=0x0;_0x18497c<_0xb6fddf['length'];_0x18497c+=0x1){var _0x1e295e=_0xb6fddf[_0x18497c][_0xacd7('0x55')]({'plain':!![]});_0x2d4407[_0xacd7('0x9e')]=_0xc993e3[_0xacd7('0x53')][_0xacd7('0x9e')]?_0xc993e3[_0xacd7('0x53')][_0xacd7('0x9e')]:_0x2d4407['dialCheckDuplicateType'];switch(_0x2d4407[_0xacd7('0x9e')]){case _0xacd7('0x9f'):_0x241ead=squel[_0xacd7('0xa0')]()['into'](_0xacd7('0xa1'))[_0xacd7('0xa2')]([_0xacd7('0xa3'),_0xacd7('0xa4'),_0xacd7('0xa5'),_0xacd7('0xa6'),_0xacd7('0x62'),_0xacd7('0xa7'),_0xacd7('0x5f')],squel[_0xacd7('0xa8')]()[_0xacd7('0x7d')](_0xacd7('0xa3'),_0xacd7('0xa3'))[_0xacd7('0x7d')]('NOW()','scheduledAt')[_0xacd7('0x7d')]('id',_0xacd7('0xa5'))['field'](_0x1e295e['CmListId']['toString'](),'ListId')[_0xacd7('0x7d')](_0xc993e3[_0xacd7('0x5d')]['id'][_0xacd7('0x88')](),'VoiceQueueId')[_0xacd7('0x7d')](_0xacd7('0xa9'),_0xacd7('0xa7'))[_0xacd7('0x7d')](_0xacd7('0xa9'),_0xacd7('0x5f'))[_0xacd7('0x7f')]('cm_contacts')[_0xacd7('0x49')]('deletedAt\x20IS\x20NULL')[_0xacd7('0x49')](_0xacd7('0xaa'),_0x1e295e[_0xacd7('0xab')][_0xacd7('0x88')]())[_0xacd7('0x49')](_0xacd7('0xac'))[_0xacd7('0x49')](_0xacd7('0xad'),squel['select']()[_0xacd7('0x7d')](_0xacd7('0xae'))['from'](_0xacd7('0xaf'))['where'](_0xacd7('0x84'),_0xc993e3[_0xacd7('0x5d')]['id'][_0xacd7('0x88')]()))[_0xacd7('0x49')]('phone\x20NOT\x20IN\x20(?)',squel[_0xacd7('0xa8')]()['field'](_0xacd7('0xb0'))[_0xacd7('0x7f')](_0xacd7('0xa1'))[_0xacd7('0x49')](_0xacd7('0x84'),_0xc993e3['params']['id'][_0xacd7('0x88')]())))[_0xacd7('0x88')]();break;case'onlyIfOpen':_0x241ead=squel[_0xacd7('0xa0')]()[_0xacd7('0xb1')](_0xacd7('0xa1'))[_0xacd7('0xa2')]([_0xacd7('0xa3'),_0xacd7('0xa4'),'ContactId',_0xacd7('0xa6'),'VoiceQueueId',_0xacd7('0xa7'),_0xacd7('0x5f')],squel[_0xacd7('0xa8')]()[_0xacd7('0x7d')](_0xacd7('0xa3'),'phone')[_0xacd7('0x7d')]('NOW()',_0xacd7('0xa4'))[_0xacd7('0x7d')]('id',_0xacd7('0xa5'))[_0xacd7('0x7d')](_0x1e295e[_0xacd7('0xab')][_0xacd7('0x88')](),_0xacd7('0xa6'))[_0xacd7('0x7d')](_0xc993e3[_0xacd7('0x5d')]['id'][_0xacd7('0x88')](),'VoiceQueueId')['field'](_0xacd7('0xa9'),_0xacd7('0xa7'))[_0xacd7('0x7d')]('NOW()',_0xacd7('0x5f'))[_0xacd7('0x7f')](_0xacd7('0xb2'))['where'](_0xacd7('0xb3'))[_0xacd7('0x49')](_0xacd7('0xaa'),_0x1e295e[_0xacd7('0xab')][_0xacd7('0x88')]())[_0xacd7('0x49')]('phone\x20IS\x20NOT\x20NULL')[_0xacd7('0x49')](_0xacd7('0xad'),squel[_0xacd7('0xa8')]()[_0xacd7('0x7d')](_0xacd7('0xb0'))['from'](_0xacd7('0xa1'))[_0xacd7('0x49')](_0xacd7('0x84'),_0xc993e3[_0xacd7('0x5d')]['id']['toString']())))['toString']();break;default:_0x241ead=squel[_0xacd7('0xa0')]()[_0xacd7('0xb1')]('cm_hopper')['fromQuery'](['phone','scheduledAt',_0xacd7('0xa5'),_0xacd7('0xa6'),'VoiceQueueId',_0xacd7('0xa7'),_0xacd7('0x5f')],squel[_0xacd7('0xa8')]()['field']('phone',_0xacd7('0xa3'))[_0xacd7('0x7d')]('NOW()',_0xacd7('0xa4'))['field']('id',_0xacd7('0xa5'))['field'](_0x1e295e[_0xacd7('0xab')][_0xacd7('0x88')](),'ListId')[_0xacd7('0x7d')](_0xc993e3[_0xacd7('0x5d')]['id'][_0xacd7('0x88')](),_0xacd7('0x62'))[_0xacd7('0x7d')](_0xacd7('0xa9'),_0xacd7('0xa7'))[_0xacd7('0x7d')](_0xacd7('0xa9'),_0xacd7('0x5f'))['from'](_0xacd7('0xb2'))[_0xacd7('0x49')](_0xacd7('0xb3'))[_0xacd7('0x49')](_0xacd7('0xaa'),_0x1e295e[_0xacd7('0xab')]['toString']())[_0xacd7('0x49')](_0xacd7('0xac')))[_0xacd7('0x88')]();}_0x18be9c[_0xacd7('0x87')](db[_0xacd7('0xb4')][_0xacd7('0x3f')](_0x241ead));}return BPromise[_0xacd7('0xb5')](_0x18be9c);}})[_0xacd7('0x2a')](function(){return _0x1652ac;})[_0xacd7('0x2a')](respondWithResult(_0xd2ba09,null))[_0xacd7('0x50')](handleError(_0xd2ba09,null));};exports[_0xacd7('0xb6')]=function(_0x21a7fd,_0x59ac9f,_0x65abd6){return db[_0xacd7('0x3a')]['find']({'where':{'id':_0x21a7fd[_0xacd7('0x5d')]['id']}})[_0xacd7('0x2a')](handleEntityNotFound(_0x59ac9f,null))[_0xacd7('0x2a')](function(_0x2cb94a){if(_0x2cb94a){return _0x2cb94a['removeLists'](_0x21a7fd[_0xacd7('0x3f')]['ids']);}})[_0xacd7('0x2a')](function(_0x1711ac){if(_0x1711ac){return db[_0xacd7('0x63')][_0xacd7('0x92')]({'where':{'ListId':_0x21a7fd[_0xacd7('0x3f')]['ids'],'VoiceQueueId':_0x21a7fd[_0xacd7('0x5d')]['id']}})['then'](function(){return _0x1711ac;});}})['then'](respondWithStatusCode(_0x59ac9f,null))[_0xacd7('0x50')](handleError(_0x59ac9f,null));};exports[_0xacd7('0xb7')]=function(_0x14502b,_0x22cdd8,_0x1931b1){var _0x27a9ab={};var _0x23ffe7={};var _0x293e49;var _0x59e694;return db[_0xacd7('0x3a')][_0xacd7('0x61')]({'where':{'id':_0x14502b[_0xacd7('0x5d')]['id']}})['then'](handleEntityNotFound(_0x22cdd8,null))[_0xacd7('0x2a')](function(_0x289fa2){if(_0x289fa2){_0x293e49=_0x289fa2;_0x23ffe7[_0xacd7('0x3e')]=_['keys'](db[_0xacd7('0x9b')]['rawAttributes']);_0x23ffe7['query']=_[_0xacd7('0x40')](_0x14502b[_0xacd7('0x3f')]);_0x23ffe7[_0xacd7('0x41')]=_[_0xacd7('0x42')](_0x23ffe7[_0xacd7('0x3e')],_0x23ffe7[_0xacd7('0x3f')]);_0x27a9ab[_0xacd7('0x44')]=_['intersection'](_0x23ffe7[_0xacd7('0x3e')],qs[_0xacd7('0x43')](_0x14502b[_0xacd7('0x3f')][_0xacd7('0x43')]));_0x27a9ab[_0xacd7('0x44')]=_0x27a9ab[_0xacd7('0x44')]['length']?_0x27a9ab['attributes']:_0x23ffe7[_0xacd7('0x3e')];_0x27a9ab[_0xacd7('0x65')]=qs[_0xacd7('0x48')](_0x14502b[_0xacd7('0x3f')]['sort']);_0x27a9ab['where']=qs[_0xacd7('0x41')](_['pick'](_0x14502b['query'],_0x23ffe7[_0xacd7('0x41')]));if(_0x14502b[_0xacd7('0x3f')][_0xacd7('0x2e')]){_0x27a9ab['where']=_[_0xacd7('0x4b')](_0x27a9ab['where'],{'$or':_[_0xacd7('0x39')](_0x27a9ab['attributes'],function(_0x3854ac){var _0x8b3d38={};_0x8b3d38[_0x3854ac]={'$like':'%'+_0x14502b[_0xacd7('0x3f')][_0xacd7('0x2e')]+'%'};return _0x8b3d38;})});}_0x27a9ab=_['merge']({},_0x27a9ab,_0x14502b['options']);return _0x293e49[_0xacd7('0xb7')](_0x27a9ab);}})[_0xacd7('0x2a')](function(_0x29b146){if(_0x29b146){_0x59e694=_0x29b146[_0xacd7('0x45')];if(!_0x14502b[_0xacd7('0x3f')]['hasOwnProperty'](_0xacd7('0x47'))){_0x27a9ab[_0xacd7('0x22')]=qs[_0xacd7('0x22')](_0x14502b[_0xacd7('0x3f')][_0xacd7('0x22')]);_0x27a9ab['offset']=qs[_0xacd7('0x25')](_0x14502b[_0xacd7('0x3f')][_0xacd7('0x25')]);}return _0x293e49[_0xacd7('0xb7')](_0x27a9ab);}})['then'](function(_0x16d615){if(_0x16d615){return _0x16d615?{'count':_0x59e694,'rows':_0x16d615}:null;}})[_0xacd7('0x2a')](respondWithResult(_0x22cdd8,null))[_0xacd7('0x50')](handleError(_0x22cdd8,null));};exports['addBlackLists']=function(_0x5a4792,_0x4ff969,_0x2949c1){var _0x9d1ce4,_0x1f4b95;return db[_0xacd7('0x3a')]['find']({'where':{'id':_0x5a4792[_0xacd7('0x5d')]['id']}})[_0xacd7('0x2a')](handleEntityNotFound(_0x4ff969,null))['then'](function(_0xbad07d){if(_0xbad07d){_0x1f4b95=_0xbad07d;return _0xbad07d['addBlackLists'](_0x5a4792[_0xacd7('0x53')][_0xacd7('0x8f')],_[_0xacd7('0x5e')](_0x5a4792[_0xacd7('0x53')],['ids','id'])||{});}return null;})[_0xacd7('0x9d')](function(_0x332720){var _0x472f25;_0x9d1ce4=_0x332720||[];var _0x14e783=[];if(_0x332720){for(var _0x5e5632=0x0;_0x5e5632<_0x332720[_0xacd7('0x45')];_0x5e5632+=0x1){var _0x4e5420=_0x332720[_0x5e5632][_0xacd7('0x55')]({'plain':!![]});_0x472f25=squel[_0xacd7('0xa0')]()[_0xacd7('0xb1')](_0xacd7('0xb8'))[_0xacd7('0xa2')]([_0xacd7('0xa3'),_0xacd7('0xa5'),_0xacd7('0xa6'),'VoiceQueueId',_0xacd7('0xa7'),_0xacd7('0x5f')],squel[_0xacd7('0xa8')]()[_0xacd7('0x7d')](_0xacd7('0xa3'),_0xacd7('0xa3'))[_0xacd7('0x7d')]('id',_0xacd7('0xa5'))[_0xacd7('0x7d')](_0x4e5420[_0xacd7('0xab')]['toString'](),_0xacd7('0xa6'))['field'](_0x5a4792['params']['id'][_0xacd7('0x88')](),_0xacd7('0x62'))[_0xacd7('0x7d')](_0xacd7('0xa9'),'createdAt')[_0xacd7('0x7d')](_0xacd7('0xa9'),_0xacd7('0x5f'))[_0xacd7('0x7f')](_0xacd7('0xb2'))['where']('deletedAt\x20IS\x20NULL')[_0xacd7('0x49')](_0xacd7('0xaa'),_0x4e5420['CmListId'][_0xacd7('0x88')]())[_0xacd7('0x49')](_0xacd7('0xac')))[_0xacd7('0x88')]();_0x14e783['push'](db[_0xacd7('0xb4')]['query'](_0x472f25));}return BPromise[_0xacd7('0xb5')](_0x14e783);}})[_0xacd7('0x2a')](function(){return _0x9d1ce4;})[_0xacd7('0x2a')](respondWithResult(_0x4ff969,null))['catch'](handleError(_0x4ff969,null));};exports['removeBlackLists']=function(_0x34787e,_0x143c98,_0x54edb9){return db[_0xacd7('0x3a')][_0xacd7('0x33')]({'where':{'id':_0x34787e[_0xacd7('0x5d')]['id']}})[_0xacd7('0x2a')](handleEntityNotFound(_0x143c98,null))[_0xacd7('0x2a')](function(_0x266ff2){if(_0x266ff2){return _0x266ff2[_0xacd7('0xb9')](_0x34787e[_0xacd7('0x3f')][_0xacd7('0x8f')]);}})[_0xacd7('0x2a')](function(_0x225730){if(_0x225730){return db[_0xacd7('0x6a')][_0xacd7('0x92')]({'where':{'ListId':_0x34787e[_0xacd7('0x3f')][_0xacd7('0x8f')],'VoiceQueueId':_0x34787e[_0xacd7('0x5d')]['id']}})[_0xacd7('0x2a')](function(){return _0x225730;});}})['then'](respondWithStatusCode(_0x143c98,null))[_0xacd7('0x50')](handleError(_0x143c98,null));}; \ No newline at end of file +var _0xc26b=['./voiceQueue.socket','register','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','map','value','includes','type','name','end','sendStatus','stack','send','index','fieldName','model','keys','query','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','VoiceQueue','includeAll','include','rows','catch','show','params','rawAttributes','intersection','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','UserProfileSection','userProfileId','error','omit','createdAt','updatedAt','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','findOne','CmHopper','VoiceQueueId','findAll','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','User','Agents','online','voicePause','interface','flatMap','forEach','penalty','sequelize','transaction','each','TeamVoiceQueue','upsert','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','isNil','format','SIP/%s','emit','userVoiceQueue:save','ids','select','field','tq.TeamId','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','removeTeams','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','all','isArray','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','into','fromQuery','phone','scheduledAt','NOW()','ContactId','ListId','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','phone\x20NOT\x20IN\x20(?)','from','cm_hopper_final','cm_hopper','cm_contacts','phone\x20IS\x20NOT\x20NULL','COALESCE(phone,\x27\x27)','insert','removeLists','getBlackLists','addBlackLists','removeBlackLists','eml-format','zip-dir','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','localhost','redis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc26b,0xa1));var _0xbc26=function(_0x3ad720,_0x47f54c){_0x3ad720=_0x3ad720-0x0;var _0x93419a=_0xc26b[_0x3ad720];return _0x93419a;};'use strict';var emlformat=require(_0xbc26('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbc26('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xbc26('0x2'));var BPromise=require(_0xbc26('0x3'));var Mustache=require(_0xbc26('0x4'));var util=require(_0xbc26('0x5'));var path=require(_0xbc26('0x6'));var sox=require('sox');var csv=require(_0xbc26('0x7'));var ejs=require(_0xbc26('0x8'));var fs=require('fs');var fs_extra=require(_0xbc26('0x9'));var _=require(_0xbc26('0xa'));var squel=require('squel');var crypto=require(_0xbc26('0xb'));var jsforce=require(_0xbc26('0xc'));var deskjs=require(_0xbc26('0xd'));var toCsv=require(_0xbc26('0x7'));var querystring=require(_0xbc26('0xe'));var Papa=require(_0xbc26('0xf'));var Redis=require(_0xbc26('0x10'));var authService=require(_0xbc26('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbc26('0x12'));var logger=require(_0xbc26('0x13'))(_0xbc26('0x14'));var utils=require(_0xbc26('0x15'));var config=require(_0xbc26('0x16'));var licenseUtil=require(_0xbc26('0x17'));var db=require(_0xbc26('0x18'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xbc26('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbc26('0x1a')]));require(_0xbc26('0x1b'))[_0xbc26('0x1c')](socket);function respondWithStatusCode(_0x410d4f,_0x154d38){_0x154d38=_0x154d38||0xcc;return function(_0x25a302){if(_0x25a302){return _0x410d4f['sendStatus'](_0x154d38);}return _0x410d4f[_0xbc26('0x1d')](_0x154d38)['end']();};}function respondWithResult(_0xf54bb3,_0x4b53d8){_0x4b53d8=_0x4b53d8||0xc8;return function(_0x1ec5d7){if(_0x1ec5d7){return _0xf54bb3[_0xbc26('0x1d')](_0x4b53d8)[_0xbc26('0x1e')](_0x1ec5d7);}};}function respondWithFilteredResult(_0x1eb2fb,_0x3c481f){return function(_0x24105a){if(_0x24105a){var _0x36b716=typeof _0x3c481f[_0xbc26('0x1f')]===_0xbc26('0x20')&&typeof _0x3c481f['limit']===_0xbc26('0x20');var _0x4bbadb=_0x24105a[_0xbc26('0x21')];var _0x60838f=_0x36b716?0x0:_0x3c481f[_0xbc26('0x1f')];var _0x535268=_0x36b716?_0x24105a['count']:_0x3c481f['offset']+_0x3c481f[_0xbc26('0x22')];var _0xacaded;if(_0x535268>=_0x4bbadb){_0x535268=_0x4bbadb;_0xacaded=0xc8;}else{_0xacaded=0xce;}_0x1eb2fb['status'](_0xacaded);return _0x1eb2fb[_0xbc26('0x23')](_0xbc26('0x24'),_0x60838f+'-'+_0x535268+'/'+_0x4bbadb)['json'](_0x24105a);}return null;};}function patchUpdates(_0x4193a3){return function(_0x42e4a0){try{jsonpatch[_0xbc26('0x25')](_0x42e4a0,_0x4193a3,!![]);}catch(_0x548839){return BPromise[_0xbc26('0x26')](_0x548839);}return _0x42e4a0[_0xbc26('0x27')]();};}function saveUpdates(_0x2f5db4,_0x1b8e0d){return function(_0x3ebf1c){if(_0x3ebf1c){return _0x3ebf1c[_0xbc26('0x28')](_0x2f5db4)[_0xbc26('0x29')](function(_0x4602a5){return _0x4602a5;});}return null;};}function removeEntity(_0x56aedd,_0x3537a0){return function(_0x867ab){if(_0x867ab){return _0x867ab[_0xbc26('0x2a')]()[_0xbc26('0x29')](function(){var _0x34193b=_0x867ab[_0xbc26('0x2b')]({'plain':!![]});var _0xdd4cbb=[{'name':_0xbc26('0x2c'),'value':_0xbc26('0x2d'),'ignore':![]},{'name':_0xbc26('0x2e'),'value':_0xbc26('0x2f'),'ignore':![]}];var _0x2c17d6=_(_0xdd4cbb)[_0xbc26('0x30')]('ignore')[_0xbc26('0x31')](_0xbc26('0x32'))[_0xbc26('0x32')]();if(_[_0xbc26('0x33')](_0x2c17d6,_0x34193b['type'])){return;}var _0x3f008c=_['find'](_0xdd4cbb,[_0xbc26('0x32'),_0x34193b[_0xbc26('0x34')]])[_0xbc26('0x35')];return db['UserProfileResource'][_0xbc26('0x2a')]({'where':{'type':_0x3f008c,'resourceId':_0x34193b['id']}})[_0xbc26('0x29')](function(){return _0x867ab;});})[_0xbc26('0x29')](function(){_0x56aedd[_0xbc26('0x1d')](0xcc)[_0xbc26('0x36')]();});}};}function handleEntityNotFound(_0x11c4f6,_0x3c8874){return function(_0xf95cba){if(!_0xf95cba){_0x11c4f6[_0xbc26('0x37')](0x194);}return _0xf95cba;};}function handleError(_0xe7bbae,_0x456e01){_0x456e01=_0x456e01||0x1f4;return function(_0xa204d8){logger['error'](_0xa204d8[_0xbc26('0x38')]);if(_0xa204d8['name']){delete _0xa204d8[_0xbc26('0x35')];}_0xe7bbae[_0xbc26('0x1d')](_0x456e01)[_0xbc26('0x39')](_0xa204d8);};}exports[_0xbc26('0x3a')]=function(_0x37f520,_0x4cdbd0){var _0x472dc1={},_0x5d3f10={},_0x50df3f={'count':0x0,'rows':[]};var _0x148b17=_['map'](db['VoiceQueue']['rawAttributes'],function(_0x1e3afd){return{'name':_0x1e3afd[_0xbc26('0x3b')],'type':_0x1e3afd[_0xbc26('0x34')]['key']};});_0x5d3f10[_0xbc26('0x3c')]=_[_0xbc26('0x31')](_0x148b17,'name');_0x5d3f10['query']=_[_0xbc26('0x3d')](_0x37f520[_0xbc26('0x3e')]);_0x5d3f10[_0xbc26('0x3f')]=_['intersection'](_0x5d3f10['model'],_0x5d3f10[_0xbc26('0x3e')]);_0x472dc1[_0xbc26('0x40')]=_['intersection'](_0x5d3f10[_0xbc26('0x3c')],qs[_0xbc26('0x41')](_0x37f520[_0xbc26('0x3e')][_0xbc26('0x41')]));_0x472dc1[_0xbc26('0x40')]=_0x472dc1[_0xbc26('0x40')]['length']?_0x472dc1[_0xbc26('0x40')]:_0x5d3f10[_0xbc26('0x3c')];if(!_0x37f520[_0xbc26('0x3e')][_0xbc26('0x42')](_0xbc26('0x43'))){_0x472dc1[_0xbc26('0x22')]=qs[_0xbc26('0x22')](_0x37f520[_0xbc26('0x3e')][_0xbc26('0x22')]);_0x472dc1[_0xbc26('0x1f')]=qs[_0xbc26('0x1f')](_0x37f520[_0xbc26('0x3e')][_0xbc26('0x1f')]);}_0x472dc1[_0xbc26('0x44')]=qs[_0xbc26('0x45')](_0x37f520[_0xbc26('0x3e')]['sort']);_0x472dc1[_0xbc26('0x46')]=qs[_0xbc26('0x3f')](_[_0xbc26('0x47')](_0x37f520[_0xbc26('0x3e')],_0x5d3f10[_0xbc26('0x3f')]),_0x148b17);if(_0x37f520[_0xbc26('0x3e')][_0xbc26('0x30')]){_0x472dc1['where']=_[_0xbc26('0x48')](_0x472dc1['where'],{'$or':_['map'](_0x148b17,function(_0x11045c){if(_0x11045c[_0xbc26('0x34')]!==_0xbc26('0x49')){var _0x4e4697={};_0x4e4697[_0x11045c['name']]={'$like':'%'+_0x37f520[_0xbc26('0x3e')][_0xbc26('0x30')]+'%'};return _0x4e4697;}})});}_0x472dc1=_[_0xbc26('0x48')]({},_0x472dc1,_0x37f520[_0xbc26('0x4a')]);var _0x32a657={'where':_0x472dc1[_0xbc26('0x46')]};return db[_0xbc26('0x4b')][_0xbc26('0x21')](_0x32a657)[_0xbc26('0x29')](function(_0x5a61d2){_0x50df3f['count']=_0x5a61d2;if(_0x37f520['query'][_0xbc26('0x4c')]){_0x472dc1[_0xbc26('0x4d')]=[{'all':!![]}];}return db[_0xbc26('0x4b')]['findAll'](_0x472dc1);})['then'](function(_0x35215f){_0x50df3f[_0xbc26('0x4e')]=_0x35215f;return _0x50df3f;})[_0xbc26('0x29')](respondWithFilteredResult(_0x4cdbd0,_0x472dc1))[_0xbc26('0x4f')](handleError(_0x4cdbd0,null));};exports[_0xbc26('0x50')]=function(_0x4fb748,_0x1d633b){var _0x152877={'raw':![],'where':{'id':_0x4fb748[_0xbc26('0x51')]['id']}},_0x35b697={};_0x35b697['model']=_[_0xbc26('0x3d')](db[_0xbc26('0x4b')][_0xbc26('0x52')]);_0x35b697[_0xbc26('0x3e')]=_[_0xbc26('0x3d')](_0x4fb748[_0xbc26('0x3e')]);_0x35b697[_0xbc26('0x3f')]=_['intersection'](_0x35b697[_0xbc26('0x3c')],_0x35b697[_0xbc26('0x3e')]);_0x152877[_0xbc26('0x40')]=_[_0xbc26('0x53')](_0x35b697[_0xbc26('0x3c')],qs[_0xbc26('0x41')](_0x4fb748['query']['fields']));_0x152877[_0xbc26('0x40')]=_0x152877[_0xbc26('0x40')][_0xbc26('0x54')]?_0x152877[_0xbc26('0x40')]:_0x35b697[_0xbc26('0x3c')];if(_0x4fb748[_0xbc26('0x3e')]['includeAll']){_0x152877[_0xbc26('0x4d')]=[{'all':!![]}];}_0x152877=_[_0xbc26('0x48')]({},_0x152877,_0x4fb748['options']);return db[_0xbc26('0x4b')]['find'](_0x152877)['then'](handleEntityNotFound(_0x1d633b,null))['then'](respondWithResult(_0x1d633b,null))[_0xbc26('0x4f')](handleError(_0x1d633b,null));};exports['create']=function(_0x374939,_0x3f86fc){return db[_0xbc26('0x4b')][_0xbc26('0x55')](_0x374939[_0xbc26('0x56')],{})['then'](function(_0x2f3ab6){var _0x284067=_0x374939[_0xbc26('0x57')][_0xbc26('0x2b')]({'plain':!![]});if(!_0x284067)throw new Error(_0xbc26('0x58'));if(_0x284067[_0xbc26('0x59')]===_0xbc26('0x57')){var _0x31c9e0=_0x2f3ab6['get']({'plain':!![]});var _0x126615=[{'name':_0xbc26('0x2c'),'value':_0xbc26('0x2d')},{'name':_0xbc26('0x2e'),'value':_0xbc26('0x2f')}];var _0x16c469=_[_0xbc26('0x5a')](_0x126615,[_0xbc26('0x32'),_0x31c9e0[_0xbc26('0x34')]])['name'];return db[_0xbc26('0x5b')][_0xbc26('0x5a')]({'where':{'name':_0x16c469,'userProfileId':_0x284067[_0xbc26('0x5c')]},'raw':!![]})[_0xbc26('0x29')](function(_0x105ef9){if(_0x105ef9&&_0x105ef9['autoAssociation']===0x0){return db['UserProfileResource'][_0xbc26('0x55')]({'name':_0x31c9e0[_0xbc26('0x35')],'resourceId':_0x31c9e0['id'],'type':_0x105ef9[_0xbc26('0x35')],'sectionId':_0x105ef9['id']},{})[_0xbc26('0x29')](function(){return _0x2f3ab6;});}else{return _0x2f3ab6;}})['catch'](function(_0x29c81a){logger[_0xbc26('0x5d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x29c81a);throw _0x29c81a;});}return _0x2f3ab6;})[_0xbc26('0x29')](respondWithResult(_0x3f86fc,0xc9))[_0xbc26('0x4f')](handleError(_0x3f86fc,null));};exports['clone']=function(_0x596ebb,_0xb67fe2){var _0x34d180={'where':{'id':_0x596ebb[_0xbc26('0x51')]['id']}},_0x2f762d={};_0x2f762d['model']=_[_0xbc26('0x3d')](db['VoiceQueue'][_0xbc26('0x52')]);_0x34d180[_0xbc26('0x40')]=_[_0xbc26('0x53')](_0x2f762d[_0xbc26('0x3c')],qs[_0xbc26('0x41')](_0x596ebb[_0xbc26('0x3e')][_0xbc26('0x41')]));_0x34d180[_0xbc26('0x40')]=_0x34d180[_0xbc26('0x40')][_0xbc26('0x54')]?_0x34d180[_0xbc26('0x40')]:_0x2f762d[_0xbc26('0x3c')];if(_0x596ebb[_0xbc26('0x3e')]['includeAll']){_0x34d180[_0xbc26('0x4d')]=[{'all':!![]}];}_0x34d180=_['merge']({},_0x34d180,_0x596ebb[_0xbc26('0x4a')]);return db[_0xbc26('0x4b')][_0xbc26('0x5a')](_0x34d180)['then'](handleEntityNotFound(_0xb67fe2,null))[_0xbc26('0x29')](function(_0x118bcb){if(_0x118bcb){var _0x24259f=_0x118bcb[_0xbc26('0x2b')]({'plain':!![]});_0x24259f=qs[_0xbc26('0x5e')](_0x24259f,['id',_0xbc26('0x5f'),_0xbc26('0x60')]);_0x596ebb['body']=_['omit'](_0x596ebb[_0xbc26('0x56')],['id',_0xbc26('0x5f'),_0xbc26('0x60')]);return db[_0xbc26('0x4b')][_0xbc26('0x55')](_[_0xbc26('0x48')](_0x24259f,_0x596ebb[_0xbc26('0x56')]),{'include':_0x596ebb[_0xbc26('0x3e')][_0xbc26('0x4c')]?[{'all':!![]}]:undefined})[_0xbc26('0x29')](function(_0x3590f1){var _0x5b8b53=_0x596ebb[_0xbc26('0x57')][_0xbc26('0x2b')]({'plain':!![]});if(!_0x5b8b53)throw new Error(_0xbc26('0x58'));if(_0x5b8b53[_0xbc26('0x59')]===_0xbc26('0x57')){var _0x51c688=_0x3590f1[_0xbc26('0x2b')]({'plain':!![]});var _0x1df351=[{'name':_0xbc26('0x2c'),'value':_0xbc26('0x2d')},{'name':_0xbc26('0x2e'),'value':'outbound'}];var _0x3f6309=_[_0xbc26('0x5a')](_0x1df351,[_0xbc26('0x32'),_0x51c688[_0xbc26('0x34')]])['name'];return db[_0xbc26('0x5b')][_0xbc26('0x5a')]({'where':{'name':_0x3f6309,'userProfileId':_0x5b8b53[_0xbc26('0x5c')]},'raw':!![]})[_0xbc26('0x29')](function(_0x49c470){if(_0x49c470&&_0x49c470[_0xbc26('0x61')]===0x0){return db['UserProfileResource'][_0xbc26('0x55')]({'name':_0x51c688[_0xbc26('0x35')],'resourceId':_0x51c688['id'],'type':_0x49c470[_0xbc26('0x35')],'sectionId':_0x49c470['id']},{})[_0xbc26('0x29')](function(){return _0x3590f1;});}else{return _0x3590f1;}})[_0xbc26('0x4f')](function(_0x41763f){logger[_0xbc26('0x5d')](_0xbc26('0x62'),_0x41763f);throw _0x41763f;});}return _0x3590f1;});}})[_0xbc26('0x29')](respondWithResult(_0xb67fe2,0xc9))['catch'](handleError(_0xb67fe2,null));};exports[_0xbc26('0x28')]=function(_0x3c9bb7,_0x576426){if(_0x3c9bb7[_0xbc26('0x56')]['id']){delete _0x3c9bb7['body']['id'];}return db[_0xbc26('0x4b')][_0xbc26('0x5a')]({'where':{'id':_0x3c9bb7[_0xbc26('0x51')]['id']}})[_0xbc26('0x29')](handleEntityNotFound(_0x576426,null))[_0xbc26('0x29')](saveUpdates(_0x3c9bb7[_0xbc26('0x56')],null))[_0xbc26('0x29')](respondWithResult(_0x576426,null))['catch'](handleError(_0x576426,null));};exports[_0xbc26('0x2a')]=function(_0x402e15,_0xe3a61f){return db[_0xbc26('0x4b')][_0xbc26('0x5a')]({'where':{'id':_0x402e15[_0xbc26('0x51')]['id']}})[_0xbc26('0x29')](handleEntityNotFound(_0xe3a61f,null))[_0xbc26('0x29')](removeEntity(_0xe3a61f,null))['catch'](handleError(_0xe3a61f,null));};exports[_0xbc26('0x63')]=function(_0xd40ae8,_0x35c5c6,_0x3ba25e){var _0x4bde19={'raw':![],'where':{}};var _0x224137={};var _0x915ab={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xbc26('0x64')]({'where':{'id':_0xd40ae8[_0xbc26('0x51')]['id']}})[_0xbc26('0x29')](handleEntityNotFound(_0x35c5c6,null))[_0xbc26('0x29')](function(_0x207c65){if(_0x207c65){_0x224137['model']=_['keys'](db[_0xbc26('0x65')][_0xbc26('0x52')]);_0x224137[_0xbc26('0x3e')]=_[_0xbc26('0x3d')](_0xd40ae8[_0xbc26('0x3e')]);_0x224137[_0xbc26('0x3f')]=_['intersection'](_0x224137[_0xbc26('0x3c')],_0x224137[_0xbc26('0x3e')]);_0x4bde19[_0xbc26('0x40')]=_['intersection'](_0x224137[_0xbc26('0x3c')],qs[_0xbc26('0x41')](_0xd40ae8[_0xbc26('0x3e')][_0xbc26('0x41')]));_0x4bde19['attributes']=_0x4bde19['attributes'][_0xbc26('0x54')]?_0x4bde19[_0xbc26('0x40')]:_0x224137['model'];if(!_0xd40ae8[_0xbc26('0x3e')][_0xbc26('0x42')](_0xbc26('0x43'))){_0x4bde19['limit']=qs[_0xbc26('0x22')](_0xd40ae8[_0xbc26('0x3e')][_0xbc26('0x22')]);_0x4bde19[_0xbc26('0x1f')]=qs[_0xbc26('0x1f')](_0xd40ae8['query']['offset']);}_0x4bde19['order']=qs['sort'](_0xd40ae8[_0xbc26('0x3e')][_0xbc26('0x45')]);_0x4bde19[_0xbc26('0x46')]=qs['filters'](_[_0xbc26('0x47')](_0xd40ae8[_0xbc26('0x3e')],_0x224137[_0xbc26('0x3f')]));_0x4bde19['where'][_0xbc26('0x66')]=_0x207c65['id'];if(_0xd40ae8[_0xbc26('0x3e')][_0xbc26('0x30')]){_0x4bde19[_0xbc26('0x46')]=_[_0xbc26('0x48')](_0x4bde19['where'],{'$or':_[_0xbc26('0x31')](_0x4bde19[_0xbc26('0x40')],function(_0x2a7c33){var _0x3ba883={};_0x3ba883[_0x2a7c33]={'$like':'%'+_0xd40ae8[_0xbc26('0x3e')][_0xbc26('0x30')]+'%'};return _0x3ba883;})});}_0x4bde19=_[_0xbc26('0x48')]({},_0x4bde19,_0xd40ae8[_0xbc26('0x4a')]);return db['CmHopper'][_0xbc26('0x21')]({'where':_0x4bde19[_0xbc26('0x46')]})[_0xbc26('0x29')](function(_0x47b3c9){_0x915ab[_0xbc26('0x21')]=_0x47b3c9;if(_0xd40ae8[_0xbc26('0x3e')][_0xbc26('0x4c')]){_0x4bde19[_0xbc26('0x4d')]=[{'all':!![]}];}return db['CmHopper'][_0xbc26('0x67')](_0x4bde19);})[_0xbc26('0x29')](function(_0x566315){_0x915ab[_0xbc26('0x4e')]=_0x566315;return _0x915ab;});}})[_0xbc26('0x29')](respondWithFilteredResult(_0x35c5c6,_0x4bde19))['catch'](handleError(_0x35c5c6,null));};exports[_0xbc26('0x68')]=function(_0x1dd8b4,_0x563334,_0x4f9775){var _0xd8195d={'raw':!![],'where':{}};var _0x5bb1c9={};var _0x3703c8={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xbc26('0x64')]({'where':{'id':_0x1dd8b4[_0xbc26('0x51')]['id']}})[_0xbc26('0x29')](handleEntityNotFound(_0x563334,null))['then'](function(_0x5c5b11){if(_0x5c5b11){_0x5bb1c9[_0xbc26('0x3c')]=_[_0xbc26('0x3d')](db[_0xbc26('0x69')][_0xbc26('0x52')]);_0x5bb1c9[_0xbc26('0x3e')]=_[_0xbc26('0x3d')](_0x1dd8b4[_0xbc26('0x3e')]);_0x5bb1c9['filters']=_[_0xbc26('0x53')](_0x5bb1c9['model'],_0x5bb1c9[_0xbc26('0x3e')]);_0xd8195d[_0xbc26('0x40')]=_[_0xbc26('0x53')](_0x5bb1c9['model'],qs[_0xbc26('0x41')](_0x1dd8b4[_0xbc26('0x3e')][_0xbc26('0x41')]));_0xd8195d[_0xbc26('0x40')]=_0xd8195d[_0xbc26('0x40')]['length']?_0xd8195d[_0xbc26('0x40')]:_0x5bb1c9[_0xbc26('0x3c')];if(!_0x1dd8b4[_0xbc26('0x3e')][_0xbc26('0x42')](_0xbc26('0x43'))){_0xd8195d[_0xbc26('0x22')]=qs[_0xbc26('0x22')](_0x1dd8b4[_0xbc26('0x3e')][_0xbc26('0x22')]);_0xd8195d['offset']=qs['offset'](_0x1dd8b4[_0xbc26('0x3e')][_0xbc26('0x1f')]);}_0xd8195d[_0xbc26('0x44')]=qs[_0xbc26('0x45')](_0x1dd8b4[_0xbc26('0x3e')][_0xbc26('0x45')]);_0xd8195d[_0xbc26('0x46')]=qs[_0xbc26('0x3f')](_[_0xbc26('0x47')](_0x1dd8b4['query'],_0x5bb1c9['filters']));_0xd8195d[_0xbc26('0x46')][_0xbc26('0x66')]=_0x5c5b11['id'];if(_0x1dd8b4[_0xbc26('0x3e')]['filter']){_0xd8195d[_0xbc26('0x46')]=_[_0xbc26('0x48')](_0xd8195d['where'],{'$or':_[_0xbc26('0x31')](_0xd8195d['attributes'],function(_0x411b3b){var _0x4e20cc={};_0x4e20cc[_0x411b3b]={'$like':'%'+_0x1dd8b4[_0xbc26('0x3e')][_0xbc26('0x30')]+'%'};return _0x4e20cc;})});}_0xd8195d=_[_0xbc26('0x48')]({},_0xd8195d,_0x1dd8b4['options']);return db['CmHopperHistory']['count']({'where':_0xd8195d['where']})[_0xbc26('0x29')](function(_0x3d1d32){_0x3703c8[_0xbc26('0x21')]=_0x3d1d32;if(_0x1dd8b4[_0xbc26('0x3e')][_0xbc26('0x4c')]){_0xd8195d[_0xbc26('0x4d')]=[{'all':!![]}];}return db[_0xbc26('0x69')][_0xbc26('0x67')](_0xd8195d);})[_0xbc26('0x29')](function(_0xf43e84){_0x3703c8[_0xbc26('0x4e')]=_0xf43e84;return _0x3703c8;});}})[_0xbc26('0x29')](respondWithFilteredResult(_0x563334,_0xd8195d))[_0xbc26('0x4f')](handleError(_0x563334,null));};exports[_0xbc26('0x6a')]=function(_0x44e9c0,_0x5b0899,_0x479213){var _0x4247d2={'raw':!![],'where':{}};var _0x357f93={};var _0x7a646c={'count':0x0,'rows':[]};return db[_0xbc26('0x4b')][_0xbc26('0x64')]({'where':{'id':_0x44e9c0[_0xbc26('0x51')]['id']}})[_0xbc26('0x29')](handleEntityNotFound(_0x5b0899,null))[_0xbc26('0x29')](function(_0x1b88f4){if(_0x1b88f4){_0x357f93['model']=_['keys'](db[_0xbc26('0x6b')][_0xbc26('0x52')]);_0x357f93[_0xbc26('0x3e')]=_[_0xbc26('0x3d')](_0x44e9c0[_0xbc26('0x3e')]);_0x357f93[_0xbc26('0x3f')]=_[_0xbc26('0x53')](_0x357f93[_0xbc26('0x3c')],_0x357f93[_0xbc26('0x3e')]);_0x4247d2[_0xbc26('0x40')]=_[_0xbc26('0x53')](_0x357f93['model'],qs['fields'](_0x44e9c0['query'][_0xbc26('0x41')]));_0x4247d2['attributes']=_0x4247d2[_0xbc26('0x40')][_0xbc26('0x54')]?_0x4247d2[_0xbc26('0x40')]:_0x357f93['model'];if(!_0x44e9c0[_0xbc26('0x3e')][_0xbc26('0x42')](_0xbc26('0x43'))){_0x4247d2[_0xbc26('0x22')]=qs[_0xbc26('0x22')](_0x44e9c0['query'][_0xbc26('0x22')]);_0x4247d2[_0xbc26('0x1f')]=qs['offset'](_0x44e9c0[_0xbc26('0x3e')][_0xbc26('0x1f')]);}_0x4247d2[_0xbc26('0x44')]=qs[_0xbc26('0x45')](_0x44e9c0[_0xbc26('0x3e')][_0xbc26('0x45')]);_0x4247d2[_0xbc26('0x46')]=qs['filters'](_[_0xbc26('0x47')](_0x44e9c0[_0xbc26('0x3e')],_0x357f93['filters']));_0x4247d2[_0xbc26('0x46')]['VoiceQueueId']=_0x1b88f4['id'];if(_0x44e9c0[_0xbc26('0x3e')][_0xbc26('0x30')]){_0x4247d2[_0xbc26('0x46')]=_['merge'](_0x4247d2[_0xbc26('0x46')],{'$or':_[_0xbc26('0x31')](_0x4247d2[_0xbc26('0x40')],function(_0x4e7cd4){var _0x41e992={};_0x41e992[_0x4e7cd4]={'$like':'%'+_0x44e9c0['query'][_0xbc26('0x30')]+'%'};return _0x41e992;})});}_0x4247d2=_[_0xbc26('0x48')]({},_0x4247d2,_0x44e9c0[_0xbc26('0x4a')]);return db['CmHopperFinal'][_0xbc26('0x21')]({'where':_0x4247d2[_0xbc26('0x46')]})[_0xbc26('0x29')](function(_0x35ed05){_0x7a646c[_0xbc26('0x21')]=_0x35ed05;if(_0x44e9c0[_0xbc26('0x3e')]['includeAll']){_0x4247d2['include']=[{'all':!![]}];}return db[_0xbc26('0x6b')][_0xbc26('0x67')](_0x4247d2);})[_0xbc26('0x29')](function(_0x30834b){_0x7a646c['rows']=_0x30834b;return _0x7a646c;});}})[_0xbc26('0x29')](respondWithFilteredResult(_0x5b0899,_0x4247d2))[_0xbc26('0x4f')](handleError(_0x5b0899,null));};exports[_0xbc26('0x6c')]=function(_0x36b655,_0x154e06,_0x1ee592){var _0x1452be={'raw':!![],'where':{}};var _0xdb6489={};var _0x180ef6={'count':0x0,'rows':[]};return db[_0xbc26('0x4b')][_0xbc26('0x64')]({'where':{'id':_0x36b655[_0xbc26('0x51')]['id']}})[_0xbc26('0x29')](handleEntityNotFound(_0x154e06,null))[_0xbc26('0x29')](function(_0x49dd60){if(_0x49dd60){_0xdb6489[_0xbc26('0x3c')]=_[_0xbc26('0x3d')](db[_0xbc26('0x6d')][_0xbc26('0x52')]);_0xdb6489[_0xbc26('0x3e')]=_[_0xbc26('0x3d')](_0x36b655[_0xbc26('0x3e')]);_0xdb6489[_0xbc26('0x3f')]=_[_0xbc26('0x53')](_0xdb6489[_0xbc26('0x3c')],_0xdb6489[_0xbc26('0x3e')]);_0x1452be['attributes']=_[_0xbc26('0x53')](_0xdb6489[_0xbc26('0x3c')],qs[_0xbc26('0x41')](_0x36b655[_0xbc26('0x3e')][_0xbc26('0x41')]));_0x1452be[_0xbc26('0x40')]=_0x1452be[_0xbc26('0x40')][_0xbc26('0x54')]?_0x1452be[_0xbc26('0x40')]:_0xdb6489[_0xbc26('0x3c')];if(!_0x36b655[_0xbc26('0x3e')]['hasOwnProperty']('nolimit')){_0x1452be[_0xbc26('0x22')]=qs['limit'](_0x36b655[_0xbc26('0x3e')][_0xbc26('0x22')]);_0x1452be[_0xbc26('0x1f')]=qs['offset'](_0x36b655['query'][_0xbc26('0x1f')]);}_0x1452be[_0xbc26('0x44')]=qs[_0xbc26('0x45')](_0x36b655[_0xbc26('0x3e')]['sort']);_0x1452be['where']=qs[_0xbc26('0x3f')](_[_0xbc26('0x47')](_0x36b655[_0xbc26('0x3e')],_0xdb6489[_0xbc26('0x3f')]));_0x1452be['where'][_0xbc26('0x66')]=_0x49dd60['id'];if(_0x36b655['query']['filter']){_0x1452be[_0xbc26('0x46')]=_['merge'](_0x1452be['where'],{'$or':_[_0xbc26('0x31')](_0x1452be[_0xbc26('0x40')],function(_0x199cca){var _0x518560={};_0x518560[_0x199cca]={'$like':'%'+_0x36b655['query']['filter']+'%'};return _0x518560;})});}_0x1452be=_['merge']({},_0x1452be,_0x36b655[_0xbc26('0x4a')]);return db[_0xbc26('0x6d')][_0xbc26('0x21')]({'where':_0x1452be[_0xbc26('0x46')]})['then'](function(_0x5a3ae8){_0x180ef6['count']=_0x5a3ae8;if(_0x36b655[_0xbc26('0x3e')][_0xbc26('0x4c')]){_0x1452be[_0xbc26('0x4d')]=[{'all':!![]}];}return db[_0xbc26('0x6d')][_0xbc26('0x67')](_0x1452be);})[_0xbc26('0x29')](function(_0x54a7a8){_0x180ef6[_0xbc26('0x4e')]=_0x54a7a8;return _0x180ef6;});}})['then'](respondWithFilteredResult(_0x154e06,_0x1452be))[_0xbc26('0x4f')](handleError(_0x154e06,null));};exports[_0xbc26('0x6e')]=function(_0x23f6eb,_0x4fe16b,_0x3d5645){var _0x2842e2={};var _0x368ae2={};var _0x3dca6d;var _0x3ec727;return db[_0xbc26('0x4b')][_0xbc26('0x64')]({'where':{'id':_0x23f6eb[_0xbc26('0x51')]['id']}})[_0xbc26('0x29')](handleEntityNotFound(_0x4fe16b,null))[_0xbc26('0x29')](function(_0x527788){if(_0x527788){_0x3dca6d=_0x527788;_0x368ae2[_0xbc26('0x3c')]=_[_0xbc26('0x3d')](db[_0xbc26('0x6f')][_0xbc26('0x52')]);_0x368ae2['query']=_[_0xbc26('0x3d')](_0x23f6eb[_0xbc26('0x3e')]);_0x368ae2[_0xbc26('0x3f')]=_['intersection'](_0x368ae2[_0xbc26('0x3c')],_0x368ae2[_0xbc26('0x3e')]);_0x2842e2[_0xbc26('0x40')]=_[_0xbc26('0x53')](_0x368ae2[_0xbc26('0x3c')],qs[_0xbc26('0x41')](_0x23f6eb[_0xbc26('0x3e')][_0xbc26('0x41')]));_0x2842e2['attributes']=_0x2842e2['attributes'][_0xbc26('0x54')]?_0x2842e2[_0xbc26('0x40')]:_0x368ae2[_0xbc26('0x3c')];_0x2842e2[_0xbc26('0x44')]=qs['sort'](_0x23f6eb[_0xbc26('0x3e')][_0xbc26('0x45')]);_0x2842e2[_0xbc26('0x46')]=qs[_0xbc26('0x3f')](_[_0xbc26('0x47')](_0x23f6eb[_0xbc26('0x3e')],_0x368ae2[_0xbc26('0x3f')]));if(_0x23f6eb[_0xbc26('0x3e')]['filter']){_0x2842e2[_0xbc26('0x46')]=_[_0xbc26('0x48')](_0x2842e2[_0xbc26('0x46')],{'$or':_[_0xbc26('0x31')](_0x2842e2[_0xbc26('0x40')],function(_0x9941dc){var _0x39053b={};_0x39053b[_0x9941dc]={'$like':'%'+_0x23f6eb[_0xbc26('0x3e')]['filter']+'%'};return _0x39053b;})});}_0x2842e2=_['merge']({},_0x2842e2,_0x23f6eb[_0xbc26('0x4a')]);return _0x3dca6d[_0xbc26('0x6e')](_0x2842e2);}})[_0xbc26('0x29')](function(_0x450bdf){if(_0x450bdf){_0x3ec727=_0x450bdf[_0xbc26('0x54')];if(!_0x23f6eb[_0xbc26('0x3e')][_0xbc26('0x42')]('nolimit')){_0x2842e2[_0xbc26('0x22')]=qs[_0xbc26('0x22')](_0x23f6eb[_0xbc26('0x3e')][_0xbc26('0x22')]);_0x2842e2['offset']=qs['offset'](_0x23f6eb[_0xbc26('0x3e')]['offset']);}return _0x3dca6d[_0xbc26('0x6e')](_0x2842e2);}})[_0xbc26('0x29')](function(_0x260c88){if(_0x260c88){return _0x260c88?{'count':_0x3ec727,'rows':_0x260c88}:null;}})[_0xbc26('0x29')](respondWithResult(_0x4fe16b,null))[_0xbc26('0x4f')](handleError(_0x4fe16b,null));};exports[_0xbc26('0x70')]=function(_0x4ba30b,_0x3b7b29,_0x181eb5){var _0x28abd1=_0x4ba30b[_0xbc26('0x56')]['teams'];var _0x528bcd=_[_0xbc26('0x31')](_0x28abd1,'id');return db[_0xbc26('0x6f')]['findAll']({'where':{'id':_0x528bcd},'attributes':['id'],'include':[{'model':db[_0xbc26('0x71')],'as':_0xbc26('0x72'),'attributes':['id',_0xbc26('0x35'),_0xbc26('0x73'),_0xbc26('0x74'),_0xbc26('0x75')],'raw':!![]}]})[_0xbc26('0x29')](function(_0x4368ce){if(_0x4368ce){var _0x5687c0=_[_0xbc26('0x76')](_0x4368ce,function(_0x1c3ae6){var _0x2cea5c=_0x1c3ae6[_0xbc26('0x2b')]({'plain':!![]});_0x2cea5c[_0xbc26('0x72')][_0xbc26('0x77')](function(_0x726e66){_0x726e66[_0xbc26('0x78')]=_[_0xbc26('0x5a')](_0x28abd1,{'id':_0x2cea5c['id']})[_0xbc26('0x78')];});return _0x2cea5c['Agents'];});return db[_0xbc26('0x4b')][_0xbc26('0x5a')]({'where':{'id':_0x4ba30b[_0xbc26('0x51')]['id']}})[_0xbc26('0x29')](function(_0x19ce4a){return db[_0xbc26('0x79')][_0xbc26('0x7a')](function(_0x1cc87e){return _0x19ce4a['addTeams'](_0x528bcd,{'transaction':_0x1cc87e})[_0xbc26('0x29')](function(){return BPromise[_0xbc26('0x7b')](_0x28abd1,function(_0x56d3e1){return db[_0xbc26('0x7c')][_0xbc26('0x7d')]({'TeamId':_0x56d3e1['id'],'VoiceQueueId':_0x4ba30b[_0xbc26('0x51')]['id'],'penalty':_0x56d3e1[_0xbc26('0x78')]},{'transaction':_0x1cc87e});});})[_0xbc26('0x29')](function(){return BPromise[_0xbc26('0x7b')](_0x5687c0,function(_0x389332){return db[_0xbc26('0x7e')][_0xbc26('0x7f')]({'where':{'UserId':_0x389332['id'],'VoiceQueueId':_0x4ba30b[_0xbc26('0x51')]['id']},'defaults':{'penalty':_0x389332[_0xbc26('0x78')]},'transaction':_0x1cc87e});});})[_0xbc26('0x29')](function(){return BPromise[_0xbc26('0x7b')](_['filter'](_0x5687c0,{'online':!![]}),function(_0x3d10de){return db[_0xbc26('0x80')][_0xbc26('0x7d')]({'membername':_0x3d10de[_0xbc26('0x35')],'UserId':_0x3d10de['id'],'queue_name':_0x19ce4a[_0xbc26('0x35')],'VoiceQueueId':_0x19ce4a['id'],'interface':_[_0xbc26('0x81')](_0x3d10de[_0xbc26('0x75')])?util[_0xbc26('0x82')](_0xbc26('0x83'),_0x3d10de[_0xbc26('0x35')]):_0x3d10de[_0xbc26('0x75')],'paused':_0x3d10de[_0xbc26('0x74')]||![],'penalty':_0x3d10de[_0xbc26('0x78')]},{'transaction':_0x1cc87e});});})[_0xbc26('0x29')](function(){_0x5687c0[_0xbc26('0x77')](function(_0x57ce0e){socket[_0xbc26('0x84')](_0xbc26('0x85'),{'UserId':_0x57ce0e['id'],'VoiceQueueId':_0x19ce4a['id']});});});});});}})[_0xbc26('0x29')](respondWithStatusCode(_0x3b7b29,null))['catch'](handleError(_0x3b7b29,null));};exports['removeTeams']=function(_0x5528d3,_0x4d54d9,_0x3d8804){return db[_0xbc26('0x6f')][_0xbc26('0x67')]({'where':{'id':_0x5528d3[_0xbc26('0x3e')][_0xbc26('0x86')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xbc26('0x72'),'attributes':['id'],'raw':!![]}]})[_0xbc26('0x29')](handleEntityNotFound(_0x4d54d9,null))[_0xbc26('0x29')](function(_0x1d14e9){var _0x4664e9=_['map'](_0x1d14e9,'id');var _0x454735=[];var _0x5f3cac=[];var _0x474da7=squel[_0xbc26('0x87')]();_0x474da7[_0xbc26('0x88')](_0xbc26('0x89'))['from'](_0xbc26('0x8a'),'tq')[_0xbc26('0x8b')](_0xbc26('0x8c'),'ut',_0xbc26('0x8d'))[_0xbc26('0x46')](_0xbc26('0x8e'),_0x5528d3[_0xbc26('0x51')]['id']);for(var _0x46fc99=0x0;_0x46fc99<_0x1d14e9[_0xbc26('0x54')];_0x46fc99+=0x1){let _0x5a97b7=_0x1d14e9[_0x46fc99];for(var _0x1e71bd=0x0;_0x1e71bd<_0x5a97b7['Agents'][_0xbc26('0x54')];_0x1e71bd+=0x1){let _0x4d41ea=_0x5a97b7[_0xbc26('0x72')][_0x1e71bd];var _0xe9eec3=_0x474da7[_0xbc26('0x8f')]();_0xe9eec3[_0xbc26('0x46')](_0xbc26('0x90'),_0x4d41ea['id']);_0x5f3cac[_0xbc26('0x91')](db[_0xbc26('0x79')][_0xbc26('0x3e')](_0xe9eec3[_0xbc26('0x92')](),{'type':db[_0xbc26('0x79')][_0xbc26('0x93')][_0xbc26('0x94')]})[_0xbc26('0x29')](function(_0x5df1c0){if(_0x5df1c0['length']===0x1){return _0x4d41ea['id'];}else{var _0x1ba74b=_[_0xbc26('0x95')](_['map'](_0x5df1c0,_0xbc26('0x96')),function(_0x4bad61){return _[_0xbc26('0x33')](_0x4664e9,_0x4bad61);});if(_0x1ba74b){return _0x4d41ea['id'];}}}));}}return BPromise['all'](_0x5f3cac)['then'](function(_0x44fdbf){_0x454735=_(_0x454735)['union'](_0x44fdbf)['compact']()[_0xbc26('0x32')]();return db['VoiceQueue'][_0xbc26('0x5a')]({'where':{'id':_0x5528d3['params']['id']}})[_0xbc26('0x29')](function(_0x3cf9f9){return db[_0xbc26('0x79')][_0xbc26('0x7a')](function(_0x1bbd1f){return _0x3cf9f9[_0xbc26('0x97')](_0x5528d3[_0xbc26('0x3e')]['ids'],{'transaction':_0x1bbd1f})[_0xbc26('0x29')](function(){if(!_[_0xbc26('0x98')](_0x454735)){return _0x3cf9f9[_0xbc26('0x99')](_0x454735,{'transaction':_0x1bbd1f})[_0xbc26('0x29')](function(){return db[_0xbc26('0x80')][_0xbc26('0x2a')]({'where':{'VoiceQueueId':_0x5528d3['params']['id'],'UserId':_0x454735},'transaction':_0x1bbd1f});});}})[_0xbc26('0x29')](function(){_0x454735['forEach'](function(_0x4ae23a){socket['emit'](_0xbc26('0x9a'),{'UserId':_0x4ae23a,'VoiceQueueId':_0x3cf9f9['id']});});});});});});})[_0xbc26('0x29')](respondWithStatusCode(_0x4d54d9,null))[_0xbc26('0x4f')](handleError(_0x4d54d9,null));};exports[_0xbc26('0x9b')]=function(_0x213c17,_0x22d94e,_0x1fcec2){var _0x4f906c,_0x4ca5a4;return db[_0xbc26('0x4b')][_0xbc26('0x5a')]({'where':{'id':_0x213c17[_0xbc26('0x51')]['id']}})[_0xbc26('0x29')](handleEntityNotFound(_0x22d94e,null))[_0xbc26('0x29')](function(_0x21450e){if(_0x21450e){_0x4ca5a4=_0x21450e;return _0x21450e[_0xbc26('0x9b')](_0x213c17[_0xbc26('0x56')][_0xbc26('0x86')],_['omit'](_0x213c17[_0xbc26('0x56')],[_0xbc26('0x86'),'id'])||{})[_0xbc26('0x9c')](function(_0x5aeb57){for(var _0x527513=0x0;_0x527513<_0x213c17[_0xbc26('0x56')][_0xbc26('0x86')][_0xbc26('0x54')];_0x527513+=0x1){socket[_0xbc26('0x84')](_0xbc26('0x85'),{'UserId':Number(_0x213c17[_0xbc26('0x56')]['ids'][_0x527513]),'VoiceQueueId':Number(_0x213c17[_0xbc26('0x51')]['id'])});}return _0x5aeb57;});}})['then'](function(_0x269cfc){_0x4f906c=_0x269cfc||[];if(_0x4ca5a4){return db['User'][_0xbc26('0x67')]({'where':{'id':_0x213c17[_0xbc26('0x56')][_0xbc26('0x86')]},'attributes':['id',_0xbc26('0x35'),_0xbc26('0x73'),_0xbc26('0x74'),_0xbc26('0x75')],'raw':!![]});}})[_0xbc26('0x29')](function(_0x32f3ae){if(!_[_0xbc26('0x98')](_0x32f3ae)){var _0x52d095=[];for(var _0x4fb958=0x0;_0x4fb958<_0x32f3ae[_0xbc26('0x54')];_0x4fb958++){if(_0x32f3ae[_0x4fb958]['online']){_0x52d095[_0xbc26('0x91')](db[_0xbc26('0x80')]['upsert']({'membername':_0x32f3ae[_0x4fb958]['name'],'UserId':_0x32f3ae[_0x4fb958]['id'],'queue_name':_0x4ca5a4[_0xbc26('0x35')],'VoiceQueueId':_0x4ca5a4['id'],'interface':_[_0xbc26('0x81')](_0x32f3ae[_0x4fb958][_0xbc26('0x75')])?util[_0xbc26('0x82')](_0xbc26('0x83'),_0x32f3ae[_0x4fb958]['name']):_0x32f3ae[_0x4fb958][_0xbc26('0x75')],'paused':_0x32f3ae[_0x4fb958][_0xbc26('0x74')]||![],'penalty':_0x213c17[_0xbc26('0x56')][_0xbc26('0x78')]||0x0}));}}return BPromise[_0xbc26('0x9d')](_0x52d095);}})[_0xbc26('0x29')](function(){return _0x4f906c;})[_0xbc26('0x29')](respondWithResult(_0x22d94e,null))['catch'](handleError(_0x22d94e,null));};exports[_0xbc26('0x99')]=function(_0x4a9e72,_0x5baf43,_0x35d234){return db[_0xbc26('0x4b')][_0xbc26('0x5a')]({'where':{'id':_0x4a9e72[_0xbc26('0x51')]['id']}})[_0xbc26('0x29')](handleEntityNotFound(_0x5baf43,null))[_0xbc26('0x29')](function(_0x3e1e9f){if(_0x3e1e9f){return _0x3e1e9f[_0xbc26('0x99')](_0x4a9e72[_0xbc26('0x3e')][_0xbc26('0x86')])['then'](function(){if(_[_0xbc26('0x9e')](_0x4a9e72[_0xbc26('0x3e')][_0xbc26('0x86')])){for(var _0x485abe=0x0;_0x485abe<_0x4a9e72[_0xbc26('0x3e')]['ids'][_0xbc26('0x54')];_0x485abe+=0x1){socket[_0xbc26('0x84')]('userVoiceQueue:remove',{'UserId':Number(_0x4a9e72[_0xbc26('0x3e')][_0xbc26('0x86')][_0x485abe]),'VoiceQueueId':Number(_0x4a9e72[_0xbc26('0x51')]['id'])});}}else{socket[_0xbc26('0x84')](_0xbc26('0x9a'),{'UserId':Number(_0x4a9e72['query'][_0xbc26('0x86')]),'VoiceQueueId':Number(_0x4a9e72[_0xbc26('0x51')]['id'])});}});}})[_0xbc26('0x29')](function(_0x3803ca){return db[_0xbc26('0x80')]['destroy']({'where':{'VoiceQueueId':_0x4a9e72[_0xbc26('0x51')]['id'],'UserId':_0x4a9e72[_0xbc26('0x3e')][_0xbc26('0x86')]}})[_0xbc26('0x29')](function(){return _0x3803ca;});})[_0xbc26('0x29')](respondWithStatusCode(_0x5baf43,null))['catch'](handleError(_0x5baf43,null));};exports[_0xbc26('0x9f')]=function(_0x5bd491,_0x1e9133,_0x1c3295){var _0x23f22d={};var _0x5e53bd={};var _0x1b03b4;var _0xfb735d;return db['VoiceQueue']['findOne']({'where':{'id':_0x5bd491[_0xbc26('0x51')]['id']}})[_0xbc26('0x29')](handleEntityNotFound(_0x1e9133,null))[_0xbc26('0x29')](function(_0x26a227){if(_0x26a227){_0x1b03b4=_0x26a227;_0x5e53bd['model']=_[_0xbc26('0x3d')](db[_0xbc26('0x71')]['rawAttributes']);_0x5e53bd[_0xbc26('0x3e')]=_['keys'](_0x5bd491[_0xbc26('0x3e')]);_0x5e53bd[_0xbc26('0x3f')]=_[_0xbc26('0x53')](_0x5e53bd[_0xbc26('0x3c')],_0x5e53bd[_0xbc26('0x3e')]);_0x23f22d[_0xbc26('0x40')]=_[_0xbc26('0x53')](_0x5e53bd[_0xbc26('0x3c')],qs[_0xbc26('0x41')](_0x5bd491[_0xbc26('0x3e')][_0xbc26('0x41')]));_0x23f22d['attributes']=_0x23f22d[_0xbc26('0x40')][_0xbc26('0x54')]?_0x23f22d[_0xbc26('0x40')]:_0x5e53bd[_0xbc26('0x3c')];_0x23f22d[_0xbc26('0x44')]=qs[_0xbc26('0x45')](_0x5bd491[_0xbc26('0x3e')][_0xbc26('0x45')]);_0x23f22d['where']=qs[_0xbc26('0x3f')](_[_0xbc26('0x47')](_0x5bd491[_0xbc26('0x3e')],_0x5e53bd[_0xbc26('0x3f')]));if(_0x5bd491[_0xbc26('0x3e')][_0xbc26('0x30')]){_0x23f22d['where']=_['merge'](_0x23f22d[_0xbc26('0x46')],{'$or':_[_0xbc26('0x31')](_0x23f22d[_0xbc26('0x40')],function(_0x59cf99){var _0x31d51a={};_0x31d51a[_0x59cf99]={'$like':'%'+_0x5bd491[_0xbc26('0x3e')][_0xbc26('0x30')]+'%'};return _0x31d51a;})});}_0x23f22d=_['merge']({},_0x23f22d,_0x5bd491[_0xbc26('0x4a')]);return _0x1b03b4['getAgents'](_0x23f22d);}})['then'](function(_0x27c72d){if(_0x27c72d){_0xfb735d=_0x27c72d['length'];if(!_0x5bd491[_0xbc26('0x3e')][_0xbc26('0x42')]('nolimit')){_0x23f22d[_0xbc26('0x22')]=qs['limit'](_0x5bd491[_0xbc26('0x3e')][_0xbc26('0x22')]);_0x23f22d[_0xbc26('0x1f')]=qs[_0xbc26('0x1f')](_0x5bd491[_0xbc26('0x3e')]['offset']);}return _0x1b03b4[_0xbc26('0x9f')](_0x23f22d);}})[_0xbc26('0x29')](function(_0x2857ac){if(_0x2857ac){return _0x2857ac?{'count':_0xfb735d,'rows':_0x2857ac}:null;}})['then'](respondWithResult(_0x1e9133,null))['catch'](handleError(_0x1e9133,null));};exports[_0xbc26('0xa0')]=function(_0x1a3f9a,_0x15ab96,_0x5bf887){var _0x59fd3e={};var _0x536443={};var _0x2bef1d;var _0x3d3775;return db[_0xbc26('0x4b')]['findOne']({'where':{'id':_0x1a3f9a[_0xbc26('0x51')]['id']}})[_0xbc26('0x29')](handleEntityNotFound(_0x15ab96,null))[_0xbc26('0x29')](function(_0x4d5d3d){if(_0x4d5d3d){_0x2bef1d=_0x4d5d3d;_0x536443[_0xbc26('0x3c')]=_[_0xbc26('0x3d')](db[_0xbc26('0x80')]['rawAttributes']);_0x536443[_0xbc26('0x3e')]=_[_0xbc26('0x3d')](_0x1a3f9a[_0xbc26('0x3e')]);_0x536443[_0xbc26('0x3f')]=_['intersection'](_0x536443[_0xbc26('0x3c')],_0x536443['query']);_0x59fd3e[_0xbc26('0x40')]=_[_0xbc26('0x53')](_0x536443[_0xbc26('0x3c')],qs['fields'](_0x1a3f9a[_0xbc26('0x3e')][_0xbc26('0x41')]));_0x59fd3e['attributes']=_0x59fd3e[_0xbc26('0x40')][_0xbc26('0x54')]?_0x59fd3e['attributes']:_0x536443[_0xbc26('0x3c')];_0x59fd3e[_0xbc26('0x44')]=qs[_0xbc26('0x45')](_0x1a3f9a[_0xbc26('0x3e')][_0xbc26('0x45')]);_0x59fd3e['where']=qs[_0xbc26('0x3f')](_[_0xbc26('0x47')](_0x1a3f9a[_0xbc26('0x3e')],_0x536443[_0xbc26('0x3f')]));if(_0x1a3f9a[_0xbc26('0x3e')][_0xbc26('0x30')]){_0x59fd3e[_0xbc26('0x46')]=_[_0xbc26('0x48')](_0x59fd3e['where'],{'$or':_[_0xbc26('0x31')](_0x59fd3e['attributes'],function(_0x43b61b){var _0x5753ec={};_0x5753ec[_0x43b61b]={'$like':'%'+_0x1a3f9a['query'][_0xbc26('0x30')]+'%'};return _0x5753ec;})});}_0x59fd3e=_[_0xbc26('0x48')]({},_0x59fd3e,_0x1a3f9a[_0xbc26('0x4a')]);return _0x2bef1d['getMembers'](_0x59fd3e);}})[_0xbc26('0x29')](function(_0x2be4d4){if(_0x2be4d4){_0x3d3775=_0x2be4d4[_0xbc26('0x54')];if(!_0x1a3f9a['query']['hasOwnProperty'](_0xbc26('0x43'))){_0x59fd3e[_0xbc26('0x22')]=qs[_0xbc26('0x22')](_0x1a3f9a[_0xbc26('0x3e')]['limit']);_0x59fd3e[_0xbc26('0x1f')]=qs[_0xbc26('0x1f')](_0x1a3f9a[_0xbc26('0x3e')][_0xbc26('0x1f')]);}return _0x2bef1d[_0xbc26('0xa0')](_0x59fd3e);}})[_0xbc26('0x29')](function(_0x195dd8){return _0x195dd8?{'count':_0x3d3775,'rows':_0x195dd8}:null;})[_0xbc26('0x29')](respondWithResult(_0x15ab96,null))[_0xbc26('0x4f')](handleError(_0x15ab96,null));};exports[_0xbc26('0xa1')]=function(_0x48dbc9,_0x53e206,_0x219019){var _0xf2de91={};var _0x5902ab={};var _0x4028be;var _0x22da98;return db[_0xbc26('0x4b')]['findOne']({'where':{'id':_0x48dbc9[_0xbc26('0x51')]['id']}})[_0xbc26('0x29')](handleEntityNotFound(_0x53e206,null))['then'](function(_0x254baf){if(_0x254baf){_0x4028be=_0x254baf;_0x5902ab[_0xbc26('0x3c')]=_[_0xbc26('0x3d')](db[_0xbc26('0xa2')][_0xbc26('0x52')]);_0x5902ab[_0xbc26('0x3e')]=_['keys'](_0x48dbc9[_0xbc26('0x3e')]);_0x5902ab['filters']=_['intersection'](_0x5902ab['model'],_0x5902ab[_0xbc26('0x3e')]);_0xf2de91[_0xbc26('0x40')]=_['intersection'](_0x5902ab[_0xbc26('0x3c')],qs[_0xbc26('0x41')](_0x48dbc9[_0xbc26('0x3e')][_0xbc26('0x41')]));_0xf2de91['attributes']=_0xf2de91[_0xbc26('0x40')][_0xbc26('0x54')]?_0xf2de91['attributes']:_0x5902ab[_0xbc26('0x3c')];_0xf2de91[_0xbc26('0x44')]=qs[_0xbc26('0x45')](_0x48dbc9[_0xbc26('0x3e')][_0xbc26('0x45')]);_0xf2de91['where']=qs[_0xbc26('0x3f')](_[_0xbc26('0x47')](_0x48dbc9[_0xbc26('0x3e')],_0x5902ab[_0xbc26('0x3f')]));if(_0x48dbc9[_0xbc26('0x3e')][_0xbc26('0x30')]){_0xf2de91['where']=_[_0xbc26('0x48')](_0xf2de91['where'],{'$or':_[_0xbc26('0x31')](_0xf2de91[_0xbc26('0x40')],function(_0x5445ac){var _0x1f04a0={};_0x1f04a0[_0x5445ac]={'$like':'%'+_0x48dbc9[_0xbc26('0x3e')][_0xbc26('0x30')]+'%'};return _0x1f04a0;})});}_0xf2de91=_['merge']({},_0xf2de91,_0x48dbc9[_0xbc26('0x4a')]);return _0x4028be[_0xbc26('0xa1')](_0xf2de91);}})[_0xbc26('0x29')](function(_0x411120){if(_0x411120){_0x22da98=_0x411120[_0xbc26('0x54')];if(!_0x48dbc9['query'][_0xbc26('0x42')](_0xbc26('0x43'))){_0xf2de91[_0xbc26('0x22')]=qs[_0xbc26('0x22')](_0x48dbc9[_0xbc26('0x3e')][_0xbc26('0x22')]);_0xf2de91[_0xbc26('0x1f')]=qs['offset'](_0x48dbc9['query'][_0xbc26('0x1f')]);}return _0x4028be[_0xbc26('0xa1')](_0xf2de91);}})['then'](function(_0x181a5b){if(_0x181a5b){return _0x181a5b?{'count':_0x22da98,'rows':_0x181a5b}:null;}})[_0xbc26('0x29')](respondWithResult(_0x53e206,null))[_0xbc26('0x4f')](handleError(_0x53e206,null));};exports[_0xbc26('0xa3')]=function(_0x4dc95f,_0x3bd2da,_0x427fb5){var _0x58ca62,_0x15d44d;return db[_0xbc26('0x4b')][_0xbc26('0x5a')]({'where':{'id':_0x4dc95f[_0xbc26('0x51')]['id']}})[_0xbc26('0x29')](handleEntityNotFound(_0x3bd2da,null))[_0xbc26('0x29')](function(_0x22d27c){if(_0x22d27c){_0x15d44d=_0x22d27c;return _0x22d27c['addLists'](_0x4dc95f[_0xbc26('0x56')][_0xbc26('0x86')],_[_0xbc26('0x5e')](_0x4dc95f[_0xbc26('0x56')],['ids','id'])||{});}return null;})[_0xbc26('0x9c')](function(_0x49ab65){var _0x4af848;_0x58ca62=_0x49ab65||[];var _0xb682c1=[];if(_0x49ab65){for(var _0x8a78bb=0x0;_0x8a78bb<_0x49ab65[_0xbc26('0x54')];_0x8a78bb+=0x1){var _0x4c888a=_0x49ab65[_0x8a78bb][_0xbc26('0x2b')]({'plain':!![]});_0x15d44d[_0xbc26('0xa4')]=_0x4dc95f[_0xbc26('0x56')][_0xbc26('0xa4')]?_0x4dc95f[_0xbc26('0x56')][_0xbc26('0xa4')]:_0x15d44d[_0xbc26('0xa4')];switch(_0x15d44d[_0xbc26('0xa4')]){case _0xbc26('0xa5'):_0x4af848=squel['insert']()[_0xbc26('0xa6')]('cm_hopper')[_0xbc26('0xa7')]([_0xbc26('0xa8'),_0xbc26('0xa9'),'ContactId','ListId','VoiceQueueId',_0xbc26('0x5f'),_0xbc26('0x60')],squel[_0xbc26('0x87')]()['field'](_0xbc26('0xa8'),_0xbc26('0xa8'))[_0xbc26('0x88')](_0xbc26('0xaa'),_0xbc26('0xa9'))[_0xbc26('0x88')]('id',_0xbc26('0xab'))[_0xbc26('0x88')](_0x4c888a['CmListId'][_0xbc26('0x92')](),_0xbc26('0xac'))['field'](_0x4dc95f[_0xbc26('0x51')]['id'][_0xbc26('0x92')](),_0xbc26('0x66'))['field']('NOW()','createdAt')['field'](_0xbc26('0xaa'),_0xbc26('0x60'))['from']('cm_contacts')[_0xbc26('0x46')](_0xbc26('0xad'))[_0xbc26('0x46')](_0xbc26('0xae'),_0x4c888a[_0xbc26('0xaf')]['toString']())['where']('phone\x20IS\x20NOT\x20NULL')['where'](_0xbc26('0xb0'),squel[_0xbc26('0x87')]()[_0xbc26('0x88')]('COALESCE(calleridnum,\x27\x27)')[_0xbc26('0xb1')](_0xbc26('0xb2'))[_0xbc26('0x46')]('VoiceQueueId\x20=\x20?',_0x4dc95f['params']['id']['toString']()))[_0xbc26('0x46')]('phone\x20NOT\x20IN\x20(?)',squel[_0xbc26('0x87')]()['field']('COALESCE(phone,\x27\x27)')['from'](_0xbc26('0xb3'))[_0xbc26('0x46')](_0xbc26('0x8e'),_0x4dc95f['params']['id'][_0xbc26('0x92')]())))[_0xbc26('0x92')]();break;case'onlyIfOpen':_0x4af848=squel['insert']()['into'](_0xbc26('0xb3'))[_0xbc26('0xa7')]([_0xbc26('0xa8'),_0xbc26('0xa9'),_0xbc26('0xab'),_0xbc26('0xac'),_0xbc26('0x66'),_0xbc26('0x5f'),_0xbc26('0x60')],squel[_0xbc26('0x87')]()[_0xbc26('0x88')](_0xbc26('0xa8'),_0xbc26('0xa8'))[_0xbc26('0x88')](_0xbc26('0xaa'),_0xbc26('0xa9'))[_0xbc26('0x88')]('id',_0xbc26('0xab'))['field'](_0x4c888a['CmListId']['toString'](),'ListId')[_0xbc26('0x88')](_0x4dc95f[_0xbc26('0x51')]['id']['toString'](),'VoiceQueueId')['field'](_0xbc26('0xaa'),_0xbc26('0x5f'))[_0xbc26('0x88')](_0xbc26('0xaa'),'updatedAt')[_0xbc26('0xb1')](_0xbc26('0xb4'))[_0xbc26('0x46')](_0xbc26('0xad'))[_0xbc26('0x46')](_0xbc26('0xae'),_0x4c888a['CmListId'][_0xbc26('0x92')]())['where'](_0xbc26('0xb5'))['where'](_0xbc26('0xb0'),squel[_0xbc26('0x87')]()[_0xbc26('0x88')](_0xbc26('0xb6'))['from'](_0xbc26('0xb3'))[_0xbc26('0x46')](_0xbc26('0x8e'),_0x4dc95f['params']['id']['toString']())))['toString']();break;default:_0x4af848=squel[_0xbc26('0xb7')]()['into'](_0xbc26('0xb3'))[_0xbc26('0xa7')](['phone',_0xbc26('0xa9'),_0xbc26('0xab'),_0xbc26('0xac'),_0xbc26('0x66'),_0xbc26('0x5f'),'updatedAt'],squel[_0xbc26('0x87')]()[_0xbc26('0x88')](_0xbc26('0xa8'),_0xbc26('0xa8'))[_0xbc26('0x88')]('NOW()','scheduledAt')[_0xbc26('0x88')]('id','ContactId')[_0xbc26('0x88')](_0x4c888a[_0xbc26('0xaf')][_0xbc26('0x92')](),_0xbc26('0xac'))[_0xbc26('0x88')](_0x4dc95f[_0xbc26('0x51')]['id'][_0xbc26('0x92')](),_0xbc26('0x66'))[_0xbc26('0x88')](_0xbc26('0xaa'),'createdAt')['field'](_0xbc26('0xaa'),'updatedAt')[_0xbc26('0xb1')](_0xbc26('0xb4'))[_0xbc26('0x46')](_0xbc26('0xad'))[_0xbc26('0x46')](_0xbc26('0xae'),_0x4c888a[_0xbc26('0xaf')][_0xbc26('0x92')]())[_0xbc26('0x46')](_0xbc26('0xb5')))[_0xbc26('0x92')]();}_0xb682c1['push'](db[_0xbc26('0x79')][_0xbc26('0x3e')](_0x4af848));}return BPromise['all'](_0xb682c1);}})[_0xbc26('0x29')](function(){return _0x58ca62;})[_0xbc26('0x29')](respondWithResult(_0x3bd2da,null))[_0xbc26('0x4f')](handleError(_0x3bd2da,null));};exports[_0xbc26('0xb8')]=function(_0x11b9a3,_0x4554f2,_0x5da2a3){return db[_0xbc26('0x4b')][_0xbc26('0x5a')]({'where':{'id':_0x11b9a3[_0xbc26('0x51')]['id']}})[_0xbc26('0x29')](handleEntityNotFound(_0x4554f2,null))[_0xbc26('0x29')](function(_0x375c9b){if(_0x375c9b){return _0x375c9b[_0xbc26('0xb8')](_0x11b9a3[_0xbc26('0x3e')][_0xbc26('0x86')]);}})[_0xbc26('0x29')](function(_0x490639){if(_0x490639){return db['CmHopper'][_0xbc26('0x2a')]({'where':{'ListId':_0x11b9a3['query'][_0xbc26('0x86')],'VoiceQueueId':_0x11b9a3[_0xbc26('0x51')]['id']}})[_0xbc26('0x29')](function(){return _0x490639;});}})[_0xbc26('0x29')](respondWithStatusCode(_0x4554f2,null))[_0xbc26('0x4f')](handleError(_0x4554f2,null));};exports[_0xbc26('0xb9')]=function(_0x21cf24,_0x320344,_0x2623ae){var _0x26ffd3={};var _0x3ad4bd={};var _0x2986a0;var _0x4ae751;return db[_0xbc26('0x4b')][_0xbc26('0x64')]({'where':{'id':_0x21cf24[_0xbc26('0x51')]['id']}})[_0xbc26('0x29')](handleEntityNotFound(_0x320344,null))[_0xbc26('0x29')](function(_0x4e8fc3){if(_0x4e8fc3){_0x2986a0=_0x4e8fc3;_0x3ad4bd[_0xbc26('0x3c')]=_[_0xbc26('0x3d')](db[_0xbc26('0xa2')]['rawAttributes']);_0x3ad4bd[_0xbc26('0x3e')]=_[_0xbc26('0x3d')](_0x21cf24[_0xbc26('0x3e')]);_0x3ad4bd[_0xbc26('0x3f')]=_[_0xbc26('0x53')](_0x3ad4bd[_0xbc26('0x3c')],_0x3ad4bd[_0xbc26('0x3e')]);_0x26ffd3['attributes']=_['intersection'](_0x3ad4bd[_0xbc26('0x3c')],qs[_0xbc26('0x41')](_0x21cf24[_0xbc26('0x3e')][_0xbc26('0x41')]));_0x26ffd3[_0xbc26('0x40')]=_0x26ffd3['attributes']['length']?_0x26ffd3[_0xbc26('0x40')]:_0x3ad4bd[_0xbc26('0x3c')];_0x26ffd3[_0xbc26('0x44')]=qs[_0xbc26('0x45')](_0x21cf24[_0xbc26('0x3e')][_0xbc26('0x45')]);_0x26ffd3[_0xbc26('0x46')]=qs[_0xbc26('0x3f')](_[_0xbc26('0x47')](_0x21cf24[_0xbc26('0x3e')],_0x3ad4bd[_0xbc26('0x3f')]));if(_0x21cf24['query'][_0xbc26('0x30')]){_0x26ffd3['where']=_[_0xbc26('0x48')](_0x26ffd3[_0xbc26('0x46')],{'$or':_[_0xbc26('0x31')](_0x26ffd3['attributes'],function(_0x4b5c86){var _0x17ac40={};_0x17ac40[_0x4b5c86]={'$like':'%'+_0x21cf24[_0xbc26('0x3e')]['filter']+'%'};return _0x17ac40;})});}_0x26ffd3=_[_0xbc26('0x48')]({},_0x26ffd3,_0x21cf24['options']);return _0x2986a0['getBlackLists'](_0x26ffd3);}})[_0xbc26('0x29')](function(_0x5572a7){if(_0x5572a7){_0x4ae751=_0x5572a7[_0xbc26('0x54')];if(!_0x21cf24[_0xbc26('0x3e')][_0xbc26('0x42')](_0xbc26('0x43'))){_0x26ffd3['limit']=qs['limit'](_0x21cf24[_0xbc26('0x3e')][_0xbc26('0x22')]);_0x26ffd3[_0xbc26('0x1f')]=qs[_0xbc26('0x1f')](_0x21cf24['query']['offset']);}return _0x2986a0['getBlackLists'](_0x26ffd3);}})['then'](function(_0x5c0e5b){if(_0x5c0e5b){return _0x5c0e5b?{'count':_0x4ae751,'rows':_0x5c0e5b}:null;}})[_0xbc26('0x29')](respondWithResult(_0x320344,null))[_0xbc26('0x4f')](handleError(_0x320344,null));};exports[_0xbc26('0xba')]=function(_0x42ccbc,_0x3b9eb5,_0x51b747){var _0x17207e,_0x1c3bf9;return db['VoiceQueue']['find']({'where':{'id':_0x42ccbc['params']['id']}})[_0xbc26('0x29')](handleEntityNotFound(_0x3b9eb5,null))['then'](function(_0x5ee5a){if(_0x5ee5a){_0x1c3bf9=_0x5ee5a;return _0x5ee5a[_0xbc26('0xba')](_0x42ccbc['body'][_0xbc26('0x86')],_[_0xbc26('0x5e')](_0x42ccbc[_0xbc26('0x56')],[_0xbc26('0x86'),'id'])||{});}return null;})['spread'](function(_0x1a5ce2){var _0x2070d9;_0x17207e=_0x1a5ce2||[];var _0x347c36=[];if(_0x1a5ce2){for(var _0x57430f=0x0;_0x57430f<_0x1a5ce2[_0xbc26('0x54')];_0x57430f+=0x1){var _0x34eedb=_0x1a5ce2[_0x57430f]['get']({'plain':!![]});_0x2070d9=squel[_0xbc26('0xb7')]()[_0xbc26('0xa6')]('cm_hopper_black')[_0xbc26('0xa7')](['phone',_0xbc26('0xab'),_0xbc26('0xac'),_0xbc26('0x66'),'createdAt',_0xbc26('0x60')],squel[_0xbc26('0x87')]()[_0xbc26('0x88')](_0xbc26('0xa8'),'phone')['field']('id',_0xbc26('0xab'))[_0xbc26('0x88')](_0x34eedb['CmListId'][_0xbc26('0x92')](),_0xbc26('0xac'))['field'](_0x42ccbc[_0xbc26('0x51')]['id'][_0xbc26('0x92')](),'VoiceQueueId')['field']('NOW()',_0xbc26('0x5f'))[_0xbc26('0x88')](_0xbc26('0xaa'),_0xbc26('0x60'))[_0xbc26('0xb1')](_0xbc26('0xb4'))[_0xbc26('0x46')](_0xbc26('0xad'))[_0xbc26('0x46')](_0xbc26('0xae'),_0x34eedb['CmListId'][_0xbc26('0x92')]())[_0xbc26('0x46')](_0xbc26('0xb5')))['toString']();_0x347c36[_0xbc26('0x91')](db['sequelize'][_0xbc26('0x3e')](_0x2070d9));}return BPromise[_0xbc26('0x9d')](_0x347c36);}})['then'](function(){return _0x17207e;})['then'](respondWithResult(_0x3b9eb5,null))[_0xbc26('0x4f')](handleError(_0x3b9eb5,null));};exports[_0xbc26('0xbb')]=function(_0x418143,_0x185502,_0x2446f7){return db[_0xbc26('0x4b')][_0xbc26('0x5a')]({'where':{'id':_0x418143[_0xbc26('0x51')]['id']}})['then'](handleEntityNotFound(_0x185502,null))[_0xbc26('0x29')](function(_0x577ce1){if(_0x577ce1){return _0x577ce1[_0xbc26('0xbb')](_0x418143[_0xbc26('0x3e')][_0xbc26('0x86')]);}})['then'](function(_0x569802){if(_0x569802){return db[_0xbc26('0x6d')][_0xbc26('0x2a')]({'where':{'ListId':_0x418143[_0xbc26('0x3e')][_0xbc26('0x86')],'VoiceQueueId':_0x418143[_0xbc26('0x51')]['id']}})[_0xbc26('0x29')](function(){return _0x569802;});}})[_0xbc26('0x29')](respondWithStatusCode(_0x185502,null))[_0xbc26('0x4f')](handleError(_0x185502,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index ab8de1d..c3d9f1a 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 _0x34ad=['../../mysqldb','save','update','remove','hasOwnProperty','hook','exports','events'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x34ad,0x12f));var _0xd34a=function(_0x38c0b2,_0x6a67a5){_0x38c0b2=_0x38c0b2-0x0;var _0x283c00=_0x34ad[_0x38c0b2];return _0x283c00;};'use strict';var EventEmitter=require(_0xd34a('0x0'));var VoiceQueue=require(_0xd34a('0x1'))['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd34a('0x2'),'afterUpdate':_0xd34a('0x3'),'afterDestroy':_0xd34a('0x4')};function emitEvent(_0x270947){return function(_0x11d834,_0x5bdc18,_0x13fdf4){VoiceQueueEvents['emit'](_0x270947+':'+_0x11d834['id'],_0x11d834);VoiceQueueEvents['emit'](_0x270947,_0x11d834);_0x13fdf4(null);};}for(var e in events){if(events[_0xd34a('0x5')](e)){var event=events[e];VoiceQueue[_0xd34a('0x6')](e,emitEvent(event));}}module[_0xd34a('0x7')]=VoiceQueueEvents; \ No newline at end of file +var _0x7b1f=['exports','events','VoiceQueue','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x251de5,_0x42556f){var _0x14a647=function(_0x446bf7){while(--_0x446bf7){_0x251de5['push'](_0x251de5['shift']());}};_0x14a647(++_0x42556f);}(_0x7b1f,0x1f1));var _0xf7b1=function(_0x3b204d,_0x2868c6){_0x3b204d=_0x3b204d-0x0;var _0x31c4dd=_0x7b1f[_0x3b204d];return _0x31c4dd;};'use strict';var EventEmitter=require(_0xf7b1('0x0'));var VoiceQueue=require('../../mysqldb')['db'][_0xf7b1('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xf7b1('0x2')](0x0);var events={'afterCreate':_0xf7b1('0x3'),'afterUpdate':_0xf7b1('0x4'),'afterDestroy':'remove'};function emitEvent(_0x49396a){return function(_0x232089,_0x1d36f1,_0x91f84b){VoiceQueueEvents['emit'](_0x49396a+':'+_0x232089['id'],_0x232089);VoiceQueueEvents[_0xf7b1('0x5')](_0x49396a,_0x232089);_0x91f84b(null);};}for(var e in events){if(events[_0xf7b1('0x6')](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0xf7b1('0x7')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index fe9ea50..fadcbf6 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(_0x4c4981,_0x178530){var _0x2dc9c1=function(_0x15e2fb){while(--_0x15e2fb){_0x4c4981['push'](_0x4c4981['shift']());}};_0x2dc9c1(++_0x178530);}(_0x008c,0x188));var _0xc008=function(_0x8e579f,_0x5d7ddd){_0x8e579f=_0x8e579f-0x0;var _0x438bcb=_0x008c[_0x8e579f];return _0x438bcb;};'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 _0x55ca=['./voiceQueue.attributes','exports','define','voice_queues','lodash','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0xca1f0e,_0x2713d5){var _0x35e4ef=function(_0x44c40f){while(--_0x44c40f){_0xca1f0e['push'](_0xca1f0e['shift']());}};_0x35e4ef(++_0x2713d5);}(_0x55ca,0x126));var _0xa55c=function(_0x170772,_0x1f1ee7){_0x170772=_0x170772-0x0;var _0x3ef69c=_0x55ca[_0x170772];return _0x3ef69c;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa55c('0x2'));var rp=require(_0xa55c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var attributes=require(_0xa55c('0x6'));module[_0xa55c('0x7')]=function(_0x3c97c8,_0x279caa){return _0x3c97c8[_0xa55c('0x8')]('VoiceQueue',attributes,{'tableName':_0xa55c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index 3cefaf2..c577a33 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 _0x1256=['../../config/environment','jayson/promise','client','http','redis','localhost','./voiceQueue.socket','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','findAll','options','raw','where','attributes','limit','include','model','map','then','info','GetVoiceQueue','catch','VoiceQueue','ShowVoiceQueue','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc'];(function(_0x145880,_0x1365aa){var _0xd2f1c2=function(_0x5f44d8){while(--_0x5f44d8){_0x145880['push'](_0x145880['shift']());}};_0xd2f1c2(++_0x1365aa);}(_0x1256,0x14f));var _0x6125=function(_0x302a84,_0xfaf37c){_0x302a84=_0x302a84-0x0;var _0x28ef60=_0x1256[_0x302a84];return _0x28ef60;};'use strict';var _=require(_0x6125('0x0'));var util=require('util');var moment=require(_0x6125('0x1'));var BPromise=require(_0x6125('0x2'));var rs=require(_0x6125('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6125('0x4'))['db'];var utils=require(_0x6125('0x5'));var logger=require('../../config/logger')(_0x6125('0x6'));var config=require(_0x6125('0x7'));var jayson=require(_0x6125('0x8'));var client=jayson[_0x6125('0x9')][_0x6125('0xa')]({'port':0x232a});config[_0x6125('0xb')]=_['defaults'](config[_0x6125('0xb')],{'host':_0x6125('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6125('0xb')]));require(_0x6125('0xd'))['register'](socket);function respondWithRpcPromise(_0x173e80,_0x3b3f1a,_0x13aec3){return new BPromise(function(_0x1f7c9b,_0x4c0012){return client['request'](_0x173e80,_0x13aec3)['then'](function(_0x28d497){logger['info'](_0x6125('0xe'),_0x3b3f1a,_0x6125('0xf'));logger[_0x6125('0x10')](_0x6125('0x11'),_0x3b3f1a,_0x6125('0xf'),JSON[_0x6125('0x12')](_0x28d497));if(_0x28d497[_0x6125('0x13')]){if(_0x28d497[_0x6125('0x13')][_0x6125('0x14')]===0x1f4){logger[_0x6125('0x13')](_0x6125('0xe'),_0x3b3f1a,_0x28d497[_0x6125('0x13')]['message']);return _0x4c0012(_0x28d497[_0x6125('0x13')][_0x6125('0x15')]);}logger[_0x6125('0x13')]('VoiceQueue,\x20%s,\x20%s',_0x3b3f1a,_0x28d497[_0x6125('0x13')][_0x6125('0x15')]);return _0x1f7c9b(_0x28d497['error'][_0x6125('0x15')]);}else{logger['info'](_0x6125('0xe'),_0x3b3f1a,_0x6125('0xf'));_0x1f7c9b(_0x28d497[_0x6125('0x16')][_0x6125('0x15')]);}})['catch'](function(_0x5a0ff5){logger['error']('VoiceQueue,\x20%s,\x20%s',_0x3b3f1a,_0x5a0ff5);_0x4c0012(_0x5a0ff5);});});}exports['GetVoiceQueue']=function(_0x50f468){var _0x1f738e=this;return new Promise(function(_0x3a1df9,_0x574f5b){return db['VoiceQueue'][_0x6125('0x17')]({'raw':_0x50f468[_0x6125('0x18')]?_0x50f468['options'][_0x6125('0x19')]===undefined?!![]:![]:!![],'where':_0x50f468[_0x6125('0x18')]?_0x50f468[_0x6125('0x18')][_0x6125('0x1a')]||null:null,'attributes':_0x50f468[_0x6125('0x18')]?_0x50f468['options'][_0x6125('0x1b')]||null:null,'limit':_0x50f468['options']?_0x50f468[_0x6125('0x18')][_0x6125('0x1c')]||null:null,'include':_0x50f468[_0x6125('0x18')]?_0x50f468[_0x6125('0x18')][_0x6125('0x1d')]?_['map'](_0x50f468[_0x6125('0x18')][_0x6125('0x1d')],function(_0x37f435){return{'model':db[_0x37f435[_0x6125('0x1e')]],'as':_0x37f435['as'],'attributes':_0x37f435['attributes'],'include':_0x37f435[_0x6125('0x1d')]?_[_0x6125('0x1f')](_0x37f435[_0x6125('0x1d')],function(_0x1c1769){return{'model':db[_0x1c1769['model']],'as':_0x1c1769['as'],'attributes':_0x1c1769[_0x6125('0x1b')],'include':_0x1c1769[_0x6125('0x1d')]?_[_0x6125('0x1f')](_0x1c1769[_0x6125('0x1d')],function(_0x548f8f){return{'model':db[_0x548f8f[_0x6125('0x1e')]],'as':_0x548f8f['as'],'attributes':_0x548f8f[_0x6125('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x6125('0x20')](function(_0x20f3ee){logger[_0x6125('0x21')](_0x6125('0x22'),_0x50f468);logger[_0x6125('0x10')](_0x6125('0x22'),_0x50f468,JSON[_0x6125('0x12')](_0x20f3ee));_0x3a1df9(_0x20f3ee);})[_0x6125('0x23')](function(_0x55912e){logger[_0x6125('0x13')](_0x6125('0x22'),_0x55912e[_0x6125('0x15')],_0x50f468);_0x574f5b(_0x1f738e['error'](0x1f4,_0x55912e[_0x6125('0x15')]));});});};exports['ShowVoiceQueue']=function(_0x14e172){var _0x2245bc=this;return new Promise(function(_0x50f28d,_0x32f11c){return db[_0x6125('0x24')]['find']({'raw':_0x14e172['options']?_0x14e172[_0x6125('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x14e172[_0x6125('0x18')]?_0x14e172['options'][_0x6125('0x1a')]||null:null,'attributes':_0x14e172[_0x6125('0x18')]?_0x14e172[_0x6125('0x18')][_0x6125('0x1b')]||null:null,'include':_0x14e172[_0x6125('0x18')]?_0x14e172[_0x6125('0x18')][_0x6125('0x1d')]?_[_0x6125('0x1f')](_0x14e172[_0x6125('0x18')][_0x6125('0x1d')],function(_0x1f23a3){return{'model':db[_0x1f23a3['model']],'as':_0x1f23a3['as'],'attributes':_0x1f23a3[_0x6125('0x1b')],'include':_0x1f23a3[_0x6125('0x1d')]?_[_0x6125('0x1f')](_0x1f23a3['include'],function(_0x4536c1){return{'model':db[_0x4536c1['model']],'as':_0x4536c1['as'],'attributes':_0x4536c1[_0x6125('0x1b')],'include':_0x4536c1['include']?_[_0x6125('0x1f')](_0x4536c1[_0x6125('0x1d')],function(_0x3b9b8f){return{'model':db[_0x3b9b8f[_0x6125('0x1e')]],'as':_0x3b9b8f['as'],'attributes':_0x3b9b8f[_0x6125('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x935b4){logger[_0x6125('0x21')](_0x6125('0x25'),_0x14e172);logger[_0x6125('0x10')]('ShowVoiceQueue',_0x14e172,JSON[_0x6125('0x12')](_0x935b4));_0x50f28d(_0x935b4);})[_0x6125('0x23')](function(_0x1539eb){logger[_0x6125('0x13')](_0x6125('0x25'),_0x1539eb[_0x6125('0x15')],_0x14e172);_0x32f11c(_0x2245bc[_0x6125('0x13')](0x1f4,_0x1539eb[_0x6125('0x15')]));});});}; \ No newline at end of file +var _0x52cc=['where','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./voiceQueue.socket','register','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceQueue','options','raw','attributes','include','model','map','ShowVoiceQueue','VoiceQueue','find'];(function(_0x112e07,_0x3605ca){var _0x505787=function(_0x2f5c14){while(--_0x2f5c14){_0x112e07['push'](_0x112e07['shift']());}};_0x505787(++_0x3605ca);}(_0x52cc,0x1ef));var _0xc52c=function(_0x3f9996,_0x1ae6a){_0x3f9996=_0x3f9996-0x0;var _0x32e659=_0x52cc[_0x3f9996];return _0x32e659;};'use strict';var _=require(_0xc52c('0x0'));var util=require(_0xc52c('0x1'));var moment=require(_0xc52c('0x2'));var BPromise=require(_0xc52c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc52c('0x4'));var db=require(_0xc52c('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xc52c('0x6'));var jayson=require(_0xc52c('0x7'));var client=jayson[_0xc52c('0x8')][_0xc52c('0x9')]({'port':0x232a});config[_0xc52c('0xa')]=_[_0xc52c('0xb')](config[_0xc52c('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xc52c('0xc'))(new Redis(config[_0xc52c('0xa')]));require(_0xc52c('0xd'))[_0xc52c('0xe')](socket);function respondWithRpcPromise(_0x208be5,_0x3a8b06,_0x5caf75){return new BPromise(function(_0x2ae9bd,_0x3da821){return client['request'](_0x208be5,_0x5caf75)[_0xc52c('0xf')](function(_0x1bfb81){logger[_0xc52c('0x10')](_0xc52c('0x11'),_0x3a8b06,_0xc52c('0x12'));logger[_0xc52c('0x13')](_0xc52c('0x14'),_0x3a8b06,_0xc52c('0x12'),JSON[_0xc52c('0x15')](_0x1bfb81));if(_0x1bfb81[_0xc52c('0x16')]){if(_0x1bfb81[_0xc52c('0x16')][_0xc52c('0x17')]===0x1f4){logger[_0xc52c('0x16')](_0xc52c('0x11'),_0x3a8b06,_0x1bfb81[_0xc52c('0x16')][_0xc52c('0x18')]);return _0x3da821(_0x1bfb81[_0xc52c('0x16')][_0xc52c('0x18')]);}logger[_0xc52c('0x16')](_0xc52c('0x11'),_0x3a8b06,_0x1bfb81[_0xc52c('0x16')]['message']);return _0x2ae9bd(_0x1bfb81[_0xc52c('0x16')][_0xc52c('0x18')]);}else{logger[_0xc52c('0x10')](_0xc52c('0x11'),_0x3a8b06,_0xc52c('0x12'));_0x2ae9bd(_0x1bfb81[_0xc52c('0x19')][_0xc52c('0x18')]);}})[_0xc52c('0x1a')](function(_0x5b02a9){logger[_0xc52c('0x16')](_0xc52c('0x11'),_0x3a8b06,_0x5b02a9);_0x3da821(_0x5b02a9);});});}exports[_0xc52c('0x1b')]=function(_0x4a1b90){var _0x57c71f=this;return new Promise(function(_0x56b2be,_0x5a5883){return db['VoiceQueue']['findAll']({'raw':_0x4a1b90[_0xc52c('0x1c')]?_0x4a1b90[_0xc52c('0x1c')][_0xc52c('0x1d')]===undefined?!![]:![]:!![],'where':_0x4a1b90[_0xc52c('0x1c')]?_0x4a1b90[_0xc52c('0x1c')]['where']||null:null,'attributes':_0x4a1b90[_0xc52c('0x1c')]?_0x4a1b90[_0xc52c('0x1c')][_0xc52c('0x1e')]||null:null,'limit':_0x4a1b90[_0xc52c('0x1c')]?_0x4a1b90[_0xc52c('0x1c')]['limit']||null:null,'include':_0x4a1b90[_0xc52c('0x1c')]?_0x4a1b90['options'][_0xc52c('0x1f')]?_['map'](_0x4a1b90[_0xc52c('0x1c')][_0xc52c('0x1f')],function(_0x3f4850){return{'model':db[_0x3f4850[_0xc52c('0x20')]],'as':_0x3f4850['as'],'attributes':_0x3f4850['attributes'],'include':_0x3f4850['include']?_[_0xc52c('0x21')](_0x3f4850[_0xc52c('0x1f')],function(_0x5b5dd5){return{'model':db[_0x5b5dd5[_0xc52c('0x20')]],'as':_0x5b5dd5['as'],'attributes':_0x5b5dd5[_0xc52c('0x1e')],'include':_0x5b5dd5[_0xc52c('0x1f')]?_[_0xc52c('0x21')](_0x5b5dd5[_0xc52c('0x1f')],function(_0x162e42){return{'model':db[_0x162e42[_0xc52c('0x20')]],'as':_0x162e42['as'],'attributes':_0x162e42[_0xc52c('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x17edea){logger['info'](_0xc52c('0x1b'),_0x4a1b90);logger[_0xc52c('0x13')](_0xc52c('0x1b'),_0x4a1b90,JSON[_0xc52c('0x15')](_0x17edea));_0x56b2be(_0x17edea);})['catch'](function(_0x1892b5){logger[_0xc52c('0x16')]('GetVoiceQueue',_0x1892b5['message'],_0x4a1b90);_0x5a5883(_0x57c71f[_0xc52c('0x16')](0x1f4,_0x1892b5['message']));});});};exports[_0xc52c('0x22')]=function(_0x369f70){var _0x32fb08=this;return new Promise(function(_0x5b5e9f,_0x198b16){return db[_0xc52c('0x23')][_0xc52c('0x24')]({'raw':_0x369f70[_0xc52c('0x1c')]?_0x369f70[_0xc52c('0x1c')][_0xc52c('0x1d')]===undefined?!![]:![]:!![],'where':_0x369f70[_0xc52c('0x1c')]?_0x369f70['options'][_0xc52c('0x25')]||null:null,'attributes':_0x369f70['options']?_0x369f70[_0xc52c('0x1c')][_0xc52c('0x1e')]||null:null,'include':_0x369f70[_0xc52c('0x1c')]?_0x369f70[_0xc52c('0x1c')][_0xc52c('0x1f')]?_[_0xc52c('0x21')](_0x369f70[_0xc52c('0x1c')][_0xc52c('0x1f')],function(_0x34a9c8){return{'model':db[_0x34a9c8[_0xc52c('0x20')]],'as':_0x34a9c8['as'],'attributes':_0x34a9c8['attributes'],'include':_0x34a9c8['include']?_[_0xc52c('0x21')](_0x34a9c8[_0xc52c('0x1f')],function(_0xf480e2){return{'model':db[_0xf480e2[_0xc52c('0x20')]],'as':_0xf480e2['as'],'attributes':_0xf480e2[_0xc52c('0x1e')],'include':_0xf480e2['include']?_[_0xc52c('0x21')](_0xf480e2[_0xc52c('0x1f')],function(_0x23b6f9){return{'model':db[_0x23b6f9[_0xc52c('0x20')]],'as':_0x23b6f9['as'],'attributes':_0x23b6f9[_0xc52c('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xc52c('0xf')](function(_0x53c64e){logger[_0xc52c('0x10')](_0xc52c('0x22'),_0x369f70);logger['debug']('ShowVoiceQueue',_0x369f70,JSON[_0xc52c('0x15')](_0x53c64e));_0x5b5e9f(_0x53c64e);})['catch'](function(_0x42de0b){logger[_0xc52c('0x16')](_0xc52c('0x22'),_0x42de0b[_0xc52c('0x18')],_0x369f70);_0x198b16(_0x32fb08['error'](0x1f4,_0x42de0b[_0xc52c('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 576efe0..cb49285 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 _0x3ab1=['save','emit','removeListener','register','voiceQueue:','./voiceQueue.events'];(function(_0xb5736e,_0x487bb8){var _0x1d7b0e=function(_0x4f2976){while(--_0x4f2976){_0xb5736e['push'](_0xb5736e['shift']());}};_0x1d7b0e(++_0x487bb8);}(_0x3ab1,0x191));var _0x13ab=function(_0x4a0d28,_0x5367ba){_0x4a0d28=_0x4a0d28-0x0;var _0x582915=_0x3ab1[_0x4a0d28];return _0x582915;};'use strict';var VoiceQueueEvents=require(_0x13ab('0x0'));var events=[_0x13ab('0x1'),'remove','update'];function createListener(_0x18e81d,_0x18eee4){return function(_0x2b1f1a){_0x18eee4[_0x13ab('0x2')](_0x18e81d,_0x2b1f1a);};}function removeListener(_0x457557,_0xba82a5){return function(){VoiceQueueEvents[_0x13ab('0x3')](_0x457557,_0xba82a5);};}exports[_0x13ab('0x4')]=function(_0x17fb94){for(var _0x55cee9=0x0,_0x5990e5=events['length'];_0x55cee9<_0x5990e5;_0x55cee9++){var _0x39ef37=events[_0x55cee9];var _0x166b6b=createListener(_0x13ab('0x5')+_0x39ef37,_0x17fb94);VoiceQueueEvents['on'](_0x39ef37,_0x166b6b);}}; \ No newline at end of file +var _0x29ca=['save','update','emit','removeListener','register','length','voiceQueue:','./voiceQueue.events'];(function(_0x432ae6,_0x469095){var _0x5b26e6=function(_0x18af1f){while(--_0x18af1f){_0x432ae6['push'](_0x432ae6['shift']());}};_0x5b26e6(++_0x469095);}(_0x29ca,0xdf));var _0xa29c=function(_0x1344d6,_0x2181e6){_0x1344d6=_0x1344d6-0x0;var _0xf45b24=_0x29ca[_0x1344d6];return _0xf45b24;};'use strict';var VoiceQueueEvents=require(_0xa29c('0x0'));var events=[_0xa29c('0x1'),'remove',_0xa29c('0x2')];function createListener(_0x5b2497,_0x19037b){return function(_0x12bc2d){_0x19037b[_0xa29c('0x3')](_0x5b2497,_0x12bc2d);};}function removeListener(_0x3a9f22,_0x2122ba){return function(){VoiceQueueEvents[_0xa29c('0x4')](_0x3a9f22,_0x2122ba);};}exports[_0xa29c('0x5')]=function(_0x38982a){for(var _0x364d25=0x0,_0x3b779e=events[_0xa29c('0x6')];_0x364d25<_0x3b779e;_0x364d25++){var _0x47fa66=events[_0x364d25];var _0x412499=createListener(_0xa29c('0x7')+_0x47fa66,_0x38982a);VoiceQueueEvents['on'](_0x47fa66,_0x412499);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 82ee8f6..39f7b71 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 _0x339d=['create','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/index','getVoiceQueuesReport','show','post'];(function(_0x5466ab,_0x227b13){var _0x40751a=function(_0x477f9e){while(--_0x477f9e){_0x5466ab['push'](_0x5466ab['shift']());}};_0x40751a(++_0x227b13);}(_0x339d,0xb2));var _0xd339=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x339d[_0x57b54c];return _0x59cc19;};'use strict';var multer=require('multer');var util=require(_0xd339('0x0'));var path=require(_0xd339('0x1'));var timeout=require(_0xd339('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xd339('0x3'));var interaction=require(_0xd339('0x4'));var config=require(_0xd339('0x5'));var controller=require('./voiceQueueReport.controller');router['get']('/',auth[_0xd339('0x6')](),controller['index']);router[_0xd339('0x7')]('/describe',auth[_0xd339('0x6')](),controller['describe']);router[_0xd339('0x7')](_0xd339('0x8'),auth['isAuthenticated'](),controller[_0xd339('0x9')]);router['get']('/:id',auth[_0xd339('0x6')](),controller[_0xd339('0xa')]);router[_0xd339('0xb')]('/',auth[_0xd339('0x6')](),controller[_0xd339('0xc')]);router[_0xd339('0xd')](_0xd339('0xe'),auth['isAuthenticated'](),controller[_0xd339('0xf')]);router[_0xd339('0x10')](_0xd339('0xe'),auth['isAuthenticated'](),controller[_0xd339('0x11')]);module[_0xd339('0x12')]=router; \ No newline at end of file +var _0x079f=['/describe','describe','getVoiceQueuesReport','/:id','show','post','create','update','delete','destroy','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x2c3f37,_0x5a46b6){var _0x12a453=function(_0x506351){while(--_0x506351){_0x2c3f37['push'](_0x2c3f37['shift']());}};_0x12a453(++_0x5a46b6);}(_0x079f,0x10e));var _0xf079=function(_0x196a97,_0x48117d){_0x196a97=_0x196a97-0x0;var _0x3b009f=_0x079f[_0x196a97];return _0x3b009f;};'use strict';var multer=require(_0xf079('0x0'));var util=require(_0xf079('0x1'));var path=require('path');var timeout=require(_0xf079('0x2'));var express=require('express');var router=express[_0xf079('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xf079('0x4'));var interaction=require(_0xf079('0x5'));var config=require(_0xf079('0x6'));var controller=require('./voiceQueueReport.controller');router[_0xf079('0x7')]('/',auth[_0xf079('0x8')](),controller[_0xf079('0x9')]);router[_0xf079('0x7')](_0xf079('0xa'),auth[_0xf079('0x8')](),controller[_0xf079('0xb')]);router[_0xf079('0x7')]('/index',auth['isAuthenticated'](),controller[_0xf079('0xc')]);router[_0xf079('0x7')](_0xf079('0xd'),auth[_0xf079('0x8')](),controller[_0xf079('0xe')]);router[_0xf079('0xf')]('/',auth[_0xf079('0x8')](),controller[_0xf079('0x10')]);router['put'](_0xf079('0xd'),auth[_0xf079('0x8')](),controller[_0xf079('0x11')]);router[_0xf079('0x12')]('/:id',auth[_0xf079('0x8')](),controller[_0xf079('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index e7b9ff7..2833852 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 _0x0149=['exports','STRING','DATE','YYYY-MM-DD\x20HH:mm:ss','diff','setDataValue','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','moment'];(function(_0x55e43d,_0x47ce24){var _0x191ac2=function(_0xb7dc6e){while(--_0xb7dc6e){_0x55e43d['push'](_0x55e43d['shift']());}};_0x191ac2(++_0x47ce24);}(_0x0149,0x77));var _0x9014=function(_0x1489e1,_0x5c1b01){_0x1489e1=_0x1489e1-0x0;var _0x1f344d=_0x0149[_0x1489e1];return _0x1f344d;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x9014('0x0'));module[_0x9014('0x1')]={'type':{'type':Sequelize[_0x9014('0x2')]},'uniqueid':{'type':Sequelize[_0x9014('0x2')]},'calleridnum':{'type':Sequelize[_0x9014('0x2')]},'calleridname':{'type':Sequelize[_0x9014('0x2')]},'queue':{'type':Sequelize[_0x9014('0x2')]},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize[_0x9014('0x3')],'set':function(_0x5cf33e){var _0x4fabb9=moment(_0x5cf33e);var _0x5f30f4=moment(this['getDataValue']('queuecallerjoinAt'))['format'](_0x9014('0x4'));var _0x405150=_0x4fabb9[_0x9014('0x5')](_0x5f30f4,'seconds');this[_0x9014('0x6')]('queuecallerleaveAt',_0x5cf33e);this[_0x9014('0x6')](_0x9014('0x7'),_0x405150||null);}},'position':{'type':Sequelize[_0x9014('0x8')]},'count':{'type':Sequelize[_0x9014('0x8')]},'queuecallerabandon':{'type':Sequelize[_0x9014('0x9')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x9014('0x3')]},'queuecallercomplete':{'type':Sequelize[_0x9014('0x9')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x9014('0x3')]},'queuecallerexit':{'type':Sequelize[_0x9014('0x9')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x9014('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0x9014('0x2')],'comment':_0x9014('0xa')},'originalposition':{'type':Sequelize[_0x9014('0x8')]},'channel':{'type':Sequelize[_0x9014('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x9014('0x2')]},'accountcode':{'type':Sequelize[_0x9014('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x9014('0x2')]},'priority':{'type':Sequelize[_0x9014('0x2')]},'holdtime':{'type':Sequelize[_0x9014('0x8')]},'mohtime':{'type':Sequelize[_0x9014('0x8')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x9014('0x9')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x9014('0x2')]},'transfer':{'type':Sequelize[_0x9014('0x9')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x9014('0x2')],'comment':_0x9014('0xb')},'transferexten':{'type':Sequelize[_0x9014('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x9014('0x2')]},'thirdDisposition':{'type':Sequelize[_0x9014('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0x9014('0x8')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe3f5=['YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format'];(function(_0x53073a,_0x537636){var _0xde8164=function(_0x2842b8){while(--_0x2842b8){_0x53073a['push'](_0x53073a['shift']());}};_0xde8164(++_0x537636);}(_0xe3f5,0x1f0));var _0x5e3f=function(_0x288688,_0xc99b1){_0x288688=_0x288688-0x0;var _0x47d37b=_0xe3f5[_0x288688];return _0x47d37b;};'use strict';var Sequelize=require(_0x5e3f('0x0'));var moment=require(_0x5e3f('0x1'));module[_0x5e3f('0x2')]={'type':{'type':Sequelize[_0x5e3f('0x3')]},'uniqueid':{'type':Sequelize[_0x5e3f('0x3')]},'calleridnum':{'type':Sequelize[_0x5e3f('0x3')]},'calleridname':{'type':Sequelize[_0x5e3f('0x3')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0x5e3f('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0x5e3f('0x4')],'set':function(_0x14f048){var _0x11409b=moment(_0x14f048);var _0x9d3e26=moment(this[_0x5e3f('0x5')](_0x5e3f('0x6')))[_0x5e3f('0x7')](_0x5e3f('0x8'));var _0x224310=_0x11409b[_0x5e3f('0x9')](_0x9d3e26,_0x5e3f('0xa'));this[_0x5e3f('0xb')](_0x5e3f('0xc'),_0x14f048);this[_0x5e3f('0xb')](_0x5e3f('0xd'),_0x224310||null);}},'position':{'type':Sequelize[_0x5e3f('0xe')]},'count':{'type':Sequelize[_0x5e3f('0xe')]},'queuecallerabandon':{'type':Sequelize[_0x5e3f('0xf')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0x5e3f('0xf')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x5e3f('0x4')]},'queuecallerexit':{'type':Sequelize[_0x5e3f('0xf')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x5e3f('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0x5e3f('0x3')],'comment':_0x5e3f('0x10')},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize[_0x5e3f('0x3')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x5e3f('0x3')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x5e3f('0x3')]},'priority':{'type':Sequelize[_0x5e3f('0x3')]},'holdtime':{'type':Sequelize[_0x5e3f('0xe')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x5e3f('0xf')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x5e3f('0x3')]},'transfer':{'type':Sequelize[_0x5e3f('0xf')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x5e3f('0x3')],'comment':_0x5e3f('0x11')},'transferexten':{'type':Sequelize[_0x5e3f('0x3')]},'transferuniqueid':{'type':Sequelize[_0x5e3f('0x3')]},'disposition':{'type':Sequelize[_0x5e3f('0x3')]},'secondDisposition':{'type':Sequelize[_0x5e3f('0x3')]},'thirdDisposition':{'type':Sequelize[_0x5e3f('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0x5e3f('0xe')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 306395d..ba992a0 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 _0xdd68=['fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','keys','includeAll','create','body','find','params','destroy','describe','filter','getVoiceQueuesReport','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','stack','name','status','index','map','VoiceQueueReport','rawAttributes'];(function(_0x16a967,_0x2d6c86){var _0x523bc5=function(_0x57e51e){while(--_0x57e51e){_0x16a967['push'](_0x16a967['shift']());}};_0x523bc5(++_0x2d6c86);}(_0xdd68,0x76));var _0x8dd6=function(_0x4cee4b,_0x1dfff3){_0x4cee4b=_0x4cee4b-0x0;var _0x4d891d=_0xdd68[_0x4cee4b];return _0x4d891d;};'use strict';var emlformat=require(_0x8dd6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8dd6('0x1'));var jsonpatch=require(_0x8dd6('0x2'));var rp=require(_0x8dd6('0x3'));var moment=require('moment');var BPromise=require(_0x8dd6('0x4'));var Mustache=require(_0x8dd6('0x5'));var util=require('util');var path=require(_0x8dd6('0x6'));var sox=require(_0x8dd6('0x7'));var csv=require(_0x8dd6('0x8'));var ejs=require(_0x8dd6('0x9'));var fs=require('fs');var fs_extra=require(_0x8dd6('0xa'));var _=require(_0x8dd6('0xb'));var squel=require(_0x8dd6('0xc'));var crypto=require(_0x8dd6('0xd'));var jsforce=require(_0x8dd6('0xe'));var deskjs=require(_0x8dd6('0xf'));var toCsv=require('to-csv');var querystring=require(_0x8dd6('0x10'));var Papa=require(_0x8dd6('0x11'));var Redis=require(_0x8dd6('0x12'));var authService=require(_0x8dd6('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x8dd6('0x14'));var hardwareService=require(_0x8dd6('0x15'));var logger=require(_0x8dd6('0x16'))(_0x8dd6('0x17'));var utils=require(_0x8dd6('0x18'));var config=require(_0x8dd6('0x19'));var licenseUtil=require(_0x8dd6('0x1a'));var db=require(_0x8dd6('0x1b'))['db'];config[_0x8dd6('0x1c')]=_['defaults'](config[_0x8dd6('0x1c')],{'host':_0x8dd6('0x1d'),'port':0x18eb});var socket=require(_0x8dd6('0x1e'))(new Redis(config[_0x8dd6('0x1c')]));require(_0x8dd6('0x1f'))['register'](socket);function respondWithStatusCode(_0x202cba,_0x256ed2){_0x256ed2=_0x256ed2||0xcc;return function(_0x5703e1){if(_0x5703e1){return _0x202cba['sendStatus'](_0x256ed2);}return _0x202cba['status'](_0x256ed2)[_0x8dd6('0x20')]();};}function respondWithResult(_0x2898ee,_0x13d2e9){_0x13d2e9=_0x13d2e9||0xc8;return function(_0x40e300){if(_0x40e300){return _0x2898ee['status'](_0x13d2e9)[_0x8dd6('0x21')](_0x40e300);}};}function respondWithFilteredResult(_0x3ce987,_0x27ac37){return function(_0x36fcf0){if(_0x36fcf0){var _0x3270a2=typeof _0x27ac37[_0x8dd6('0x22')]===_0x8dd6('0x23')&&typeof _0x27ac37['limit']===_0x8dd6('0x23');var _0x471f45=_0x36fcf0[_0x8dd6('0x24')];var _0x1f7dc2=_0x3270a2?0x0:_0x27ac37[_0x8dd6('0x22')];var _0x2a68f7=_0x3270a2?_0x36fcf0[_0x8dd6('0x24')]:_0x27ac37[_0x8dd6('0x22')]+_0x27ac37[_0x8dd6('0x25')];var _0x1b26d3;if(_0x2a68f7>=_0x471f45){_0x2a68f7=_0x471f45;_0x1b26d3=0xc8;}else{_0x1b26d3=0xce;}_0x3ce987['status'](_0x1b26d3);return _0x3ce987[_0x8dd6('0x26')](_0x8dd6('0x27'),_0x1f7dc2+'-'+_0x2a68f7+'/'+_0x471f45)[_0x8dd6('0x21')](_0x36fcf0);}return null;};}function patchUpdates(_0x1fb40f){return function(_0x4e5d71){try{jsonpatch[_0x8dd6('0x28')](_0x4e5d71,_0x1fb40f,!![]);}catch(_0x4cedfc){return BPromise[_0x8dd6('0x29')](_0x4cedfc);}return _0x4e5d71[_0x8dd6('0x2a')]();};}function saveUpdates(_0x504164,_0x5dc4d1){return function(_0x79327d){if(_0x79327d){return _0x79327d[_0x8dd6('0x2b')](_0x504164)[_0x8dd6('0x2c')](function(_0xc20006){return _0xc20006;});}return null;};}function removeEntity(_0x28bd42,_0x4f2b82){return function(_0x1388e5){if(_0x1388e5){return _0x1388e5['destroy']()[_0x8dd6('0x2c')](function(){_0x28bd42['status'](0xcc)[_0x8dd6('0x20')]();});}};}function handleEntityNotFound(_0x4176dd,_0x216e1b){return function(_0x3df9b1){if(!_0x3df9b1){_0x4176dd['sendStatus'](0x194);}return _0x3df9b1;};}function handleError(_0x13c828,_0x36f0b8){_0x36f0b8=_0x36f0b8||0x1f4;return function(_0x3b7b28){logger['error'](_0x3b7b28[_0x8dd6('0x2d')]);if(_0x3b7b28[_0x8dd6('0x2e')]){delete _0x3b7b28[_0x8dd6('0x2e')];}_0x13c828[_0x8dd6('0x2f')](_0x36f0b8)['send'](_0x3b7b28);};}exports[_0x8dd6('0x30')]=function(_0x149837,_0x1dc5ff){var _0x522ccd={},_0x4fdfc8={},_0x4cad25={'count':0x0,'rows':[]};var _0x5b4734=_[_0x8dd6('0x31')](db[_0x8dd6('0x32')][_0x8dd6('0x33')],function(_0x7747ec){return{'name':_0x7747ec[_0x8dd6('0x34')],'type':_0x7747ec['type'][_0x8dd6('0x35')]};});_0x4fdfc8[_0x8dd6('0x36')]=_['map'](_0x5b4734,'name');_0x4fdfc8[_0x8dd6('0x37')]=_['keys'](_0x149837['query']);_0x4fdfc8[_0x8dd6('0x38')]=_[_0x8dd6('0x39')](_0x4fdfc8[_0x8dd6('0x36')],_0x4fdfc8['query']);_0x522ccd['attributes']=_[_0x8dd6('0x39')](_0x4fdfc8['model'],qs[_0x8dd6('0x3a')](_0x149837[_0x8dd6('0x37')][_0x8dd6('0x3a')]));_0x522ccd[_0x8dd6('0x3b')]=_0x522ccd['attributes'][_0x8dd6('0x3c')]?_0x522ccd[_0x8dd6('0x3b')]:_0x4fdfc8[_0x8dd6('0x36')];if(!_0x149837[_0x8dd6('0x37')][_0x8dd6('0x3d')](_0x8dd6('0x3e'))){_0x522ccd[_0x8dd6('0x25')]=qs[_0x8dd6('0x25')](_0x149837['query'][_0x8dd6('0x25')]);_0x522ccd[_0x8dd6('0x22')]=qs['offset'](_0x149837[_0x8dd6('0x37')][_0x8dd6('0x22')]);}_0x522ccd['order']=qs[_0x8dd6('0x3f')](_0x149837[_0x8dd6('0x37')][_0x8dd6('0x3f')]);_0x522ccd[_0x8dd6('0x40')]=qs[_0x8dd6('0x38')](_[_0x8dd6('0x41')](_0x149837[_0x8dd6('0x37')],_0x4fdfc8['filters']),_0x5b4734);if(_0x149837[_0x8dd6('0x37')]['filter']){_0x522ccd[_0x8dd6('0x40')]=_[_0x8dd6('0x42')](_0x522ccd[_0x8dd6('0x40')],{'$or':_['map'](_0x5b4734,function(_0x1cc555){if(_0x1cc555[_0x8dd6('0x43')]!==_0x8dd6('0x44')){var _0x13fdd5={};_0x13fdd5[_0x1cc555[_0x8dd6('0x2e')]]={'$like':'%'+_0x149837[_0x8dd6('0x37')]['filter']+'%'};return _0x13fdd5;}})});}_0x522ccd=_['merge']({},_0x522ccd,_0x149837[_0x8dd6('0x45')]);var _0x44e203={'where':_0x522ccd['where']};return db['VoiceQueueReport']['count'](_0x44e203)[_0x8dd6('0x2c')](function(_0x15ce9c){_0x4cad25[_0x8dd6('0x24')]=_0x15ce9c;if(_0x149837[_0x8dd6('0x37')]['includeAll']){_0x522ccd[_0x8dd6('0x46')]=[{'all':!![]}];}return db[_0x8dd6('0x32')][_0x8dd6('0x47')](_0x522ccd);})[_0x8dd6('0x2c')](function(_0x1a965){_0x4cad25[_0x8dd6('0x48')]=_0x1a965;return _0x4cad25;})[_0x8dd6('0x2c')](respondWithFilteredResult(_0x1dc5ff,_0x522ccd))[_0x8dd6('0x49')](handleError(_0x1dc5ff,null));};exports[_0x8dd6('0x4a')]=function(_0x2f67d9,_0x303b5c){var _0x38e765={'raw':![],'where':{'id':_0x2f67d9['params']['id']}},_0x7d290b={};_0x7d290b[_0x8dd6('0x36')]=_[_0x8dd6('0x4b')](db[_0x8dd6('0x32')][_0x8dd6('0x33')]);_0x7d290b[_0x8dd6('0x37')]=_[_0x8dd6('0x4b')](_0x2f67d9[_0x8dd6('0x37')]);_0x7d290b[_0x8dd6('0x38')]=_['intersection'](_0x7d290b[_0x8dd6('0x36')],_0x7d290b['query']);_0x38e765[_0x8dd6('0x3b')]=_[_0x8dd6('0x39')](_0x7d290b[_0x8dd6('0x36')],qs['fields'](_0x2f67d9['query'][_0x8dd6('0x3a')]));_0x38e765[_0x8dd6('0x3b')]=_0x38e765[_0x8dd6('0x3b')][_0x8dd6('0x3c')]?_0x38e765[_0x8dd6('0x3b')]:_0x7d290b[_0x8dd6('0x36')];if(_0x2f67d9[_0x8dd6('0x37')][_0x8dd6('0x4c')]){_0x38e765[_0x8dd6('0x46')]=[{'all':!![]}];}_0x38e765=_[_0x8dd6('0x42')]({},_0x38e765,_0x2f67d9['options']);return db[_0x8dd6('0x32')]['find'](_0x38e765)[_0x8dd6('0x2c')](handleEntityNotFound(_0x303b5c,null))[_0x8dd6('0x2c')](respondWithResult(_0x303b5c,null))[_0x8dd6('0x49')](handleError(_0x303b5c,null));};exports[_0x8dd6('0x4d')]=function(_0x258667,_0xcd6ecb){return db[_0x8dd6('0x32')][_0x8dd6('0x4d')](_0x258667['body'],{})[_0x8dd6('0x2c')](respondWithResult(_0xcd6ecb,0xc9))[_0x8dd6('0x49')](handleError(_0xcd6ecb,null));};exports['update']=function(_0x15b363,_0x4106a9){if(_0x15b363[_0x8dd6('0x4e')]['id']){delete _0x15b363[_0x8dd6('0x4e')]['id'];}return db['VoiceQueueReport'][_0x8dd6('0x4f')]({'where':{'id':_0x15b363[_0x8dd6('0x50')]['id']}})[_0x8dd6('0x2c')](handleEntityNotFound(_0x4106a9,null))[_0x8dd6('0x2c')](saveUpdates(_0x15b363[_0x8dd6('0x4e')],null))[_0x8dd6('0x2c')](respondWithResult(_0x4106a9,null))[_0x8dd6('0x49')](handleError(_0x4106a9,null));};exports[_0x8dd6('0x51')]=function(_0x18a2a7,_0x3d4d96){return db['VoiceQueueReport']['find']({'where':{'id':_0x18a2a7[_0x8dd6('0x50')]['id']}})[_0x8dd6('0x2c')](handleEntityNotFound(_0x3d4d96,null))[_0x8dd6('0x2c')](removeEntity(_0x3d4d96,null))[_0x8dd6('0x49')](handleError(_0x3d4d96,null));};exports[_0x8dd6('0x52')]=function(_0x13df47,_0x458b54){return db[_0x8dd6('0x32')][_0x8dd6('0x52')]()[_0x8dd6('0x2c')](respondWithResult(_0x458b54,null))['catch'](handleError(_0x458b54,null));};exports['getVoiceQueuesReport']=function(_0x39cbdd,_0x5de240){var _0x2c8cd9={},_0x2eb7d8={},_0x37bdd3={'count':0x0,'rows':[]};_0x2eb7d8[_0x8dd6('0x36')]=_[_0x8dd6('0x4b')](db[_0x8dd6('0x32')][_0x8dd6('0x33')]);_0x2eb7d8[_0x8dd6('0x37')]=_[_0x8dd6('0x4b')](_0x39cbdd[_0x8dd6('0x37')]);_0x2eb7d8[_0x8dd6('0x38')]=_[_0x8dd6('0x39')](_0x2eb7d8[_0x8dd6('0x36')],_0x2eb7d8[_0x8dd6('0x37')]);_0x2c8cd9['attributes']=_[_0x8dd6('0x39')](_0x2eb7d8['model'],qs[_0x8dd6('0x3a')](_0x39cbdd[_0x8dd6('0x37')][_0x8dd6('0x3a')]));_0x2c8cd9[_0x8dd6('0x3b')]=_0x2c8cd9[_0x8dd6('0x3b')][_0x8dd6('0x3c')]?_0x2c8cd9[_0x8dd6('0x3b')]:_0x2eb7d8[_0x8dd6('0x36')];if(!_0x39cbdd['query'][_0x8dd6('0x3d')](_0x8dd6('0x3e'))){_0x2c8cd9['limit']=qs[_0x8dd6('0x25')](_0x39cbdd['query']['limit']);_0x2c8cd9[_0x8dd6('0x22')]=qs[_0x8dd6('0x22')](_0x39cbdd[_0x8dd6('0x37')][_0x8dd6('0x22')]);}_0x2c8cd9['order']=qs[_0x8dd6('0x3f')](_0x39cbdd['query'][_0x8dd6('0x3f')]);_0x2c8cd9[_0x8dd6('0x40')]=qs['filters'](_['pick'](_0x39cbdd[_0x8dd6('0x37')],_0x2eb7d8[_0x8dd6('0x38')]));if(_0x39cbdd[_0x8dd6('0x37')][_0x8dd6('0x53')]){_0x2c8cd9[_0x8dd6('0x40')]=_['merge'](_0x2c8cd9[_0x8dd6('0x40')],{'$or':_[_0x8dd6('0x31')](_0x2c8cd9['attributes'],function(_0x4be499){var _0xb36bc={};_0xb36bc[_0x4be499]={'$like':'%'+_0x39cbdd['query']['filter']+'%'};return _0xb36bc;})});}_0x2c8cd9=_[_0x8dd6('0x42')]({},_0x2c8cd9,_0x39cbdd[_0x8dd6('0x45')]);var _0x5973fc={'where':_0x2c8cd9[_0x8dd6('0x40')]};return db['VoiceQueueReport']['count'](_0x5973fc)[_0x8dd6('0x2c')](function(_0x2a3f15){_0x37bdd3['count']=_0x2a3f15;if(_0x39cbdd[_0x8dd6('0x37')]['includeAll']){_0x2c8cd9['include']=[{'all':!![]}];}return db[_0x8dd6('0x32')][_0x8dd6('0x47')](_0x2c8cd9);})['then'](function(_0x4109b3){_0x37bdd3[_0x8dd6('0x48')]=_0x4109b3;return _0x37bdd3;})[_0x8dd6('0x2c')](respondWithFilteredResult(_0x5de240,_0x2c8cd9,_0x8dd6('0x54')))[_0x8dd6('0x49')](handleError(_0x5de240,null,_0x8dd6('0x54')));}; \ No newline at end of file +var _0x1770=['find','catch','create','body','describe','getVoiceQueuesReport','pick','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','jsforce','desk.js','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','register','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','name','send','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','VoiceQueueReport','rows','show','params'];(function(_0x35d59c,_0x341ef9){var _0x18cd27=function(_0x16a9c4){while(--_0x16a9c4){_0x35d59c['push'](_0x35d59c['shift']());}};_0x18cd27(++_0x341ef9);}(_0x1770,0x9f));var _0x0177=function(_0x3b6eb9,_0x409248){_0x3b6eb9=_0x3b6eb9-0x0;var _0x2d48a4=_0x1770[_0x3b6eb9];return _0x2d48a4;};'use strict';var emlformat=require(_0x0177('0x0'));var rimraf=require(_0x0177('0x1'));var zipdir=require(_0x0177('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0177('0x3'));var moment=require('moment');var BPromise=require(_0x0177('0x4'));var Mustache=require(_0x0177('0x5'));var util=require(_0x0177('0x6'));var path=require(_0x0177('0x7'));var sox=require(_0x0177('0x8'));var csv=require(_0x0177('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0177('0xa'));var _=require(_0x0177('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0177('0xc'));var deskjs=require(_0x0177('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x0177('0xe'));var as=require(_0x0177('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0177('0x10'))(_0x0177('0x11'));var utils=require(_0x0177('0x12'));var config=require(_0x0177('0x13'));var licenseUtil=require(_0x0177('0x14'));var db=require(_0x0177('0x15'))['db'];config[_0x0177('0x16')]=_[_0x0177('0x17')](config['redis'],{'host':_0x0177('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0177('0x16')]));require('./voiceQueueReport.socket')[_0x0177('0x19')](socket);function respondWithStatusCode(_0x53381b,_0x47cfac){_0x47cfac=_0x47cfac||0xcc;return function(_0x477ee6){if(_0x477ee6){return _0x53381b['sendStatus'](_0x47cfac);}return _0x53381b[_0x0177('0x1a')](_0x47cfac)[_0x0177('0x1b')]();};}function respondWithResult(_0x2403cb,_0x4d9323){_0x4d9323=_0x4d9323||0xc8;return function(_0x5b6385){if(_0x5b6385){return _0x2403cb['status'](_0x4d9323)['json'](_0x5b6385);}};}function respondWithFilteredResult(_0x335fa6,_0x363407){return function(_0x4af490){if(_0x4af490){var _0x1962be=typeof _0x363407[_0x0177('0x1c')]===_0x0177('0x1d')&&typeof _0x363407[_0x0177('0x1e')]==='undefined';var _0x5393a2=_0x4af490['count'];var _0x1ab65f=_0x1962be?0x0:_0x363407[_0x0177('0x1c')];var _0x554e34=_0x1962be?_0x4af490[_0x0177('0x1f')]:_0x363407[_0x0177('0x1c')]+_0x363407[_0x0177('0x1e')];var _0x1d3f22;if(_0x554e34>=_0x5393a2){_0x554e34=_0x5393a2;_0x1d3f22=0xc8;}else{_0x1d3f22=0xce;}_0x335fa6[_0x0177('0x1a')](_0x1d3f22);return _0x335fa6[_0x0177('0x20')](_0x0177('0x21'),_0x1ab65f+'-'+_0x554e34+'/'+_0x5393a2)[_0x0177('0x22')](_0x4af490);}return null;};}function patchUpdates(_0x11c724){return function(_0x566b75){try{jsonpatch[_0x0177('0x23')](_0x566b75,_0x11c724,!![]);}catch(_0x4ad540){return BPromise[_0x0177('0x24')](_0x4ad540);}return _0x566b75[_0x0177('0x25')]();};}function saveUpdates(_0x17bdb5,_0x597e8e){return function(_0x36259f){if(_0x36259f){return _0x36259f[_0x0177('0x26')](_0x17bdb5)[_0x0177('0x27')](function(_0x482b1b){return _0x482b1b;});}return null;};}function removeEntity(_0x4a38c9,_0x5e97ed){return function(_0x25883e){if(_0x25883e){return _0x25883e[_0x0177('0x28')]()[_0x0177('0x27')](function(){_0x4a38c9[_0x0177('0x1a')](0xcc)[_0x0177('0x1b')]();});}};}function handleEntityNotFound(_0x2d0ca2,_0x537be0){return function(_0x21a767){if(!_0x21a767){_0x2d0ca2['sendStatus'](0x194);}return _0x21a767;};}function handleError(_0x3f864b,_0x3e5644){_0x3e5644=_0x3e5644||0x1f4;return function(_0x6adc50){logger['error'](_0x6adc50['stack']);if(_0x6adc50[_0x0177('0x29')]){delete _0x6adc50['name'];}_0x3f864b[_0x0177('0x1a')](_0x3e5644)[_0x0177('0x2a')](_0x6adc50);};}exports['index']=function(_0x2801ec,_0x82bf9e){var _0x2975ab={},_0x4dacc5={},_0x6b5e3a={'count':0x0,'rows':[]};var _0x44673b=_[_0x0177('0x2b')](db['VoiceQueueReport'][_0x0177('0x2c')],function(_0x42f91d){return{'name':_0x42f91d['fieldName'],'type':_0x42f91d[_0x0177('0x2d')][_0x0177('0x2e')]};});_0x4dacc5[_0x0177('0x2f')]=_['map'](_0x44673b,_0x0177('0x29'));_0x4dacc5[_0x0177('0x30')]=_[_0x0177('0x31')](_0x2801ec['query']);_0x4dacc5[_0x0177('0x32')]=_[_0x0177('0x33')](_0x4dacc5[_0x0177('0x2f')],_0x4dacc5[_0x0177('0x30')]);_0x2975ab[_0x0177('0x34')]=_['intersection'](_0x4dacc5[_0x0177('0x2f')],qs[_0x0177('0x35')](_0x2801ec['query']['fields']));_0x2975ab['attributes']=_0x2975ab['attributes'][_0x0177('0x36')]?_0x2975ab[_0x0177('0x34')]:_0x4dacc5['model'];if(!_0x2801ec[_0x0177('0x30')][_0x0177('0x37')](_0x0177('0x38'))){_0x2975ab[_0x0177('0x1e')]=qs[_0x0177('0x1e')](_0x2801ec['query']['limit']);_0x2975ab[_0x0177('0x1c')]=qs['offset'](_0x2801ec['query'][_0x0177('0x1c')]);}_0x2975ab[_0x0177('0x39')]=qs[_0x0177('0x3a')](_0x2801ec[_0x0177('0x30')][_0x0177('0x3a')]);_0x2975ab[_0x0177('0x3b')]=qs[_0x0177('0x32')](_['pick'](_0x2801ec['query'],_0x4dacc5[_0x0177('0x32')]),_0x44673b);if(_0x2801ec[_0x0177('0x30')][_0x0177('0x3c')]){_0x2975ab[_0x0177('0x3b')]=_[_0x0177('0x3d')](_0x2975ab['where'],{'$or':_[_0x0177('0x2b')](_0x44673b,function(_0x3bc6ee){if(_0x3bc6ee[_0x0177('0x2d')]!=='VIRTUAL'){var _0x4a4e6c={};_0x4a4e6c[_0x3bc6ee[_0x0177('0x29')]]={'$like':'%'+_0x2801ec[_0x0177('0x30')][_0x0177('0x3c')]+'%'};return _0x4a4e6c;}})});}_0x2975ab=_[_0x0177('0x3d')]({},_0x2975ab,_0x2801ec[_0x0177('0x3e')]);var _0x58ed3a={'where':_0x2975ab[_0x0177('0x3b')]};return db['VoiceQueueReport']['count'](_0x58ed3a)['then'](function(_0x3369f7){_0x6b5e3a[_0x0177('0x1f')]=_0x3369f7;if(_0x2801ec[_0x0177('0x30')][_0x0177('0x3f')]){_0x2975ab[_0x0177('0x40')]=[{'all':!![]}];}return db[_0x0177('0x41')]['findAll'](_0x2975ab);})[_0x0177('0x27')](function(_0x4c18fc){_0x6b5e3a[_0x0177('0x42')]=_0x4c18fc;return _0x6b5e3a;})[_0x0177('0x27')](respondWithFilteredResult(_0x82bf9e,_0x2975ab))['catch'](handleError(_0x82bf9e,null));};exports[_0x0177('0x43')]=function(_0x59320c,_0x50213b){var _0x3afee2={'raw':![],'where':{'id':_0x59320c[_0x0177('0x44')]['id']}},_0x45a94d={};_0x45a94d[_0x0177('0x2f')]=_[_0x0177('0x31')](db[_0x0177('0x41')][_0x0177('0x2c')]);_0x45a94d['query']=_['keys'](_0x59320c[_0x0177('0x30')]);_0x45a94d[_0x0177('0x32')]=_[_0x0177('0x33')](_0x45a94d[_0x0177('0x2f')],_0x45a94d[_0x0177('0x30')]);_0x3afee2[_0x0177('0x34')]=_['intersection'](_0x45a94d[_0x0177('0x2f')],qs[_0x0177('0x35')](_0x59320c[_0x0177('0x30')][_0x0177('0x35')]));_0x3afee2[_0x0177('0x34')]=_0x3afee2[_0x0177('0x34')][_0x0177('0x36')]?_0x3afee2[_0x0177('0x34')]:_0x45a94d[_0x0177('0x2f')];if(_0x59320c[_0x0177('0x30')]['includeAll']){_0x3afee2[_0x0177('0x40')]=[{'all':!![]}];}_0x3afee2=_[_0x0177('0x3d')]({},_0x3afee2,_0x59320c[_0x0177('0x3e')]);return db['VoiceQueueReport'][_0x0177('0x45')](_0x3afee2)['then'](handleEntityNotFound(_0x50213b,null))[_0x0177('0x27')](respondWithResult(_0x50213b,null))[_0x0177('0x46')](handleError(_0x50213b,null));};exports[_0x0177('0x47')]=function(_0x4ce4d0,_0x22419a){return db[_0x0177('0x41')]['create'](_0x4ce4d0[_0x0177('0x48')],{})[_0x0177('0x27')](respondWithResult(_0x22419a,0xc9))[_0x0177('0x46')](handleError(_0x22419a,null));};exports[_0x0177('0x26')]=function(_0x81931,_0x895af9){if(_0x81931[_0x0177('0x48')]['id']){delete _0x81931[_0x0177('0x48')]['id'];}return db[_0x0177('0x41')]['find']({'where':{'id':_0x81931[_0x0177('0x44')]['id']}})[_0x0177('0x27')](handleEntityNotFound(_0x895af9,null))['then'](saveUpdates(_0x81931[_0x0177('0x48')],null))[_0x0177('0x27')](respondWithResult(_0x895af9,null))['catch'](handleError(_0x895af9,null));};exports[_0x0177('0x28')]=function(_0x5331f0,_0x17d729){return db[_0x0177('0x41')][_0x0177('0x45')]({'where':{'id':_0x5331f0[_0x0177('0x44')]['id']}})[_0x0177('0x27')](handleEntityNotFound(_0x17d729,null))[_0x0177('0x27')](removeEntity(_0x17d729,null))[_0x0177('0x46')](handleError(_0x17d729,null));};exports['describe']=function(_0x5d0ca4,_0x6bb2b5){return db[_0x0177('0x41')][_0x0177('0x49')]()[_0x0177('0x27')](respondWithResult(_0x6bb2b5,null))[_0x0177('0x46')](handleError(_0x6bb2b5,null));};exports[_0x0177('0x4a')]=function(_0x2b7f7b,_0x5c909b){var _0xf0bac2={},_0x52ddb1={},_0x32399b={'count':0x0,'rows':[]};_0x52ddb1['model']=_[_0x0177('0x31')](db['VoiceQueueReport']['rawAttributes']);_0x52ddb1[_0x0177('0x30')]=_[_0x0177('0x31')](_0x2b7f7b['query']);_0x52ddb1[_0x0177('0x32')]=_['intersection'](_0x52ddb1[_0x0177('0x2f')],_0x52ddb1[_0x0177('0x30')]);_0xf0bac2[_0x0177('0x34')]=_[_0x0177('0x33')](_0x52ddb1[_0x0177('0x2f')],qs[_0x0177('0x35')](_0x2b7f7b[_0x0177('0x30')][_0x0177('0x35')]));_0xf0bac2['attributes']=_0xf0bac2[_0x0177('0x34')][_0x0177('0x36')]?_0xf0bac2[_0x0177('0x34')]:_0x52ddb1[_0x0177('0x2f')];if(!_0x2b7f7b[_0x0177('0x30')][_0x0177('0x37')]('nolimit')){_0xf0bac2[_0x0177('0x1e')]=qs[_0x0177('0x1e')](_0x2b7f7b[_0x0177('0x30')][_0x0177('0x1e')]);_0xf0bac2[_0x0177('0x1c')]=qs[_0x0177('0x1c')](_0x2b7f7b[_0x0177('0x30')][_0x0177('0x1c')]);}_0xf0bac2[_0x0177('0x39')]=qs['sort'](_0x2b7f7b[_0x0177('0x30')][_0x0177('0x3a')]);_0xf0bac2[_0x0177('0x3b')]=qs[_0x0177('0x32')](_[_0x0177('0x4b')](_0x2b7f7b[_0x0177('0x30')],_0x52ddb1['filters']));if(_0x2b7f7b[_0x0177('0x30')][_0x0177('0x3c')]){_0xf0bac2['where']=_[_0x0177('0x3d')](_0xf0bac2[_0x0177('0x3b')],{'$or':_[_0x0177('0x2b')](_0xf0bac2['attributes'],function(_0xeeca7a){var _0xb0b29d={};_0xb0b29d[_0xeeca7a]={'$like':'%'+_0x2b7f7b['query'][_0x0177('0x3c')]+'%'};return _0xb0b29d;})});}_0xf0bac2=_['merge']({},_0xf0bac2,_0x2b7f7b[_0x0177('0x3e')]);var _0x5a4e28={'where':_0xf0bac2[_0x0177('0x3b')]};return db[_0x0177('0x41')]['count'](_0x5a4e28)[_0x0177('0x27')](function(_0x1734fc){_0x32399b['count']=_0x1734fc;if(_0x2b7f7b[_0x0177('0x30')]['includeAll']){_0xf0bac2['include']=[{'all':!![]}];}return db['VoiceQueueReport']['findAll'](_0xf0bac2);})['then'](function(_0x2ad3aa){_0x32399b[_0x0177('0x42')]=_0x2ad3aa;return _0x32399b;})['then'](respondWithFilteredResult(_0x5c909b,_0xf0bac2,'getVoiceQueuesReport'))['catch'](handleError(_0x5c909b,null,_0x0177('0x4a')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index b672b71..5f83a8e 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 _0xdc1e=['remove','emit','hasOwnProperty','hook','events','setMaxListeners'];(function(_0x6aad74,_0x32ecf4){var _0x5b1c38=function(_0x567477){while(--_0x567477){_0x6aad74['push'](_0x6aad74['shift']());}};_0x5b1c38(++_0x32ecf4);}(_0xdc1e,0x1a8));var _0xedc1=function(_0x5d3532,_0x349565){_0x5d3532=_0x5d3532-0x0;var _0x2231f6=_0xdc1e[_0x5d3532];return _0x2231f6;};'use strict';var EventEmitter=require(_0xedc1('0x0'));var VoiceQueueReport=require('../../mysqldb')['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xedc1('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xedc1('0x2')};function emitEvent(_0x14beb3){return function(_0x501e6c,_0x66a56e,_0xbb4fc){VoiceQueueReportEvents[_0xedc1('0x3')](_0x14beb3+':'+_0x501e6c['id'],_0x501e6c);VoiceQueueReportEvents[_0xedc1('0x3')](_0x14beb3,_0x501e6c);_0xbb4fc(null);};}for(var e in events){if(events[_0xedc1('0x4')](e)){var event=events[e];VoiceQueueReport[_0xedc1('0x5')](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file +var _0x1395=['exports','events','../../mysqldb','setMaxListeners','save','update','emit'];(function(_0xd65a07,_0x7cec65){var _0x1973d8=function(_0x47e641){while(--_0x47e641){_0xd65a07['push'](_0xd65a07['shift']());}};_0x1973d8(++_0x7cec65);}(_0x1395,0xcc));var _0x5139=function(_0x508697,_0x31e0e3){_0x508697=_0x508697-0x0;var _0x480d1f=_0x1395[_0x508697];return _0x480d1f;};'use strict';var EventEmitter=require(_0x5139('0x0'));var VoiceQueueReport=require(_0x5139('0x1'))['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x5139('0x2')](0x0);var events={'afterCreate':_0x5139('0x3'),'afterUpdate':_0x5139('0x4'),'afterDestroy':'remove'};function emitEvent(_0x551d92){return function(_0x1992cc,_0x340cbc,_0x187511){VoiceQueueReportEvents[_0x5139('0x5')](_0x551d92+':'+_0x1992cc['id'],_0x1992cc);VoiceQueueReportEvents[_0x5139('0x5')](_0x551d92,_0x1992cc);_0x187511(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module[_0x5139('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 5c4dacc..7fd6c5f 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 _0x8591=['define','VoiceQueueReport','report_queue','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceQueueReport.attributes','exports'];(function(_0x124a03,_0x25633e){var _0x4f3cbb=function(_0x24db35){while(--_0x24db35){_0x124a03['push'](_0x124a03['shift']());}};_0x4f3cbb(++_0x25633e);}(_0x8591,0x1c6));var _0x1859=function(_0x271b75,_0x124c76){_0x271b75=_0x271b75-0x0;var _0xcbf5a1=_0x8591[_0x271b75];return _0xcbf5a1;};'use strict';var _=require(_0x1859('0x0'));var util=require(_0x1859('0x1'));var logger=require(_0x1859('0x2'))(_0x1859('0x3'));var moment=require(_0x1859('0x4'));var BPromise=require('bluebird');var rp=require(_0x1859('0x5'));var fs=require('fs');var path=require(_0x1859('0x6'));var rimraf=require(_0x1859('0x7'));var config=require(_0x1859('0x8'));var attributes=require(_0x1859('0x9'));module[_0x1859('0xa')]=function(_0x15b5aa,_0x14ffe1){return _0x15b5aa[_0x1859('0xb')](_0x1859('0xc'),attributes,{'tableName':_0x1859('0xd'),'paranoid':![],'indexes':[{'fields':[_0x1859('0xe')]},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file +var _0x4d01=['moment','bluebird','../../config/environment','./voiceQueueReport.attributes','define','report_queue','uniqueid','calleridnum','lodash','util','../../config/logger','api'];(function(_0x36f47c,_0x38ef4d){var _0x296c55=function(_0x403eec){while(--_0x403eec){_0x36f47c['push'](_0x36f47c['shift']());}};_0x296c55(++_0x38ef4d);}(_0x4d01,0x158));var _0x14d0=function(_0x487b0c,_0x14ff74){_0x487b0c=_0x487b0c-0x0;var _0x1adbdc=_0x4d01[_0x487b0c];return _0x1adbdc;};'use strict';var _=require(_0x14d0('0x0'));var util=require(_0x14d0('0x1'));var logger=require(_0x14d0('0x2'))(_0x14d0('0x3'));var moment=require(_0x14d0('0x4'));var BPromise=require(_0x14d0('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x14d0('0x6'));var attributes=require(_0x14d0('0x7'));module['exports']=function(_0xed723c,_0x138e8d){return _0xed723c[_0x14d0('0x8')]('VoiceQueueReport',attributes,{'tableName':_0x14d0('0x9'),'paranoid':![],'indexes':[{'fields':[_0x14d0('0xa')]},{'fields':[_0x14d0('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 32dfa5b..36f2606 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 _0x36bc=['info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','where','limit','map','include','model','attributes','CreateVoiceQueueReport','body','stringify','UpdateVoiceQueueReport','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','request','then'];(function(_0x41a9f4,_0x2a8d7e){var _0x4f36ee=function(_0x2c5e71){while(--_0x2c5e71){_0x41a9f4['push'](_0x41a9f4['shift']());}};_0x4f36ee(++_0x2a8d7e);}(_0x36bc,0x1d0));var _0xc36b=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0x36bc[_0x4fc9e6];return _0x551d28;};'use strict';var _=require(_0xc36b('0x0'));var util=require('util');var moment=require(_0xc36b('0x1'));var BPromise=require(_0xc36b('0x2'));var rs=require(_0xc36b('0x3'));var fs=require('fs');var Redis=require(_0xc36b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc36b('0x5'));var logger=require('../../config/logger')(_0xc36b('0x6'));var config=require(_0xc36b('0x7'));var jayson=require(_0xc36b('0x8'));var client=jayson['client'][_0xc36b('0x9')]({'port':0x232a});config['redis']=_[_0xc36b('0xa')](config[_0xc36b('0xb')],{'host':_0xc36b('0xc'),'port':0x18eb});var socket=require(_0xc36b('0xd'))(new Redis(config[_0xc36b('0xb')]));require('./voiceQueueReport.socket')['register'](socket);function respondWithRpcPromise(_0x23ed56,_0x40a603,_0x50a2f7){return new BPromise(function(_0x117444,_0x309102){return client[_0xc36b('0xe')](_0x23ed56,_0x50a2f7)[_0xc36b('0xf')](function(_0x45bac1){logger[_0xc36b('0x10')](_0xc36b('0x11'),_0x40a603,_0xc36b('0x12'));logger[_0xc36b('0x13')](_0xc36b('0x14'),_0x40a603,'request\x20sent',JSON['stringify'](_0x45bac1));if(_0x45bac1[_0xc36b('0x15')]){if(_0x45bac1[_0xc36b('0x15')][_0xc36b('0x16')]===0x1f4){logger['error'](_0xc36b('0x11'),_0x40a603,_0x45bac1[_0xc36b('0x15')][_0xc36b('0x17')]);return _0x309102(_0x45bac1[_0xc36b('0x15')][_0xc36b('0x17')]);}logger[_0xc36b('0x15')](_0xc36b('0x11'),_0x40a603,_0x45bac1[_0xc36b('0x15')][_0xc36b('0x17')]);return _0x117444(_0x45bac1['error'][_0xc36b('0x17')]);}else{logger[_0xc36b('0x10')](_0xc36b('0x11'),_0x40a603,_0xc36b('0x12'));_0x117444(_0x45bac1['result'][_0xc36b('0x17')]);}})[_0xc36b('0x18')](function(_0x5c482d){logger['error'](_0xc36b('0x11'),_0x40a603,_0x5c482d);_0x309102(_0x5c482d);});});}exports[_0xc36b('0x19')]=function(_0x483689){var _0x33a0f6=this;return new Promise(function(_0x58e0d2,_0x3b1a63){return db[_0xc36b('0x1a')][_0xc36b('0x1b')]({'raw':_0x483689[_0xc36b('0x1c')]?_0x483689[_0xc36b('0x1c')][_0xc36b('0x1d')]===undefined?!![]:![]:!![],'where':_0x483689[_0xc36b('0x1c')]?_0x483689[_0xc36b('0x1c')][_0xc36b('0x1e')]||null:null,'attributes':_0x483689['options']?_0x483689[_0xc36b('0x1c')]['attributes']||null:null,'limit':_0x483689[_0xc36b('0x1c')]?_0x483689[_0xc36b('0x1c')][_0xc36b('0x1f')]||null:null,'include':_0x483689['options']?_0x483689[_0xc36b('0x1c')]['include']?_[_0xc36b('0x20')](_0x483689['options'][_0xc36b('0x21')],function(_0x8c3bd5){return{'model':db[_0x8c3bd5[_0xc36b('0x22')]],'as':_0x8c3bd5['as'],'attributes':_0x8c3bd5[_0xc36b('0x23')],'include':_0x8c3bd5[_0xc36b('0x21')]?_[_0xc36b('0x20')](_0x8c3bd5[_0xc36b('0x21')],function(_0x25c877){return{'model':db[_0x25c877['model']],'as':_0x25c877['as'],'attributes':_0x25c877[_0xc36b('0x23')],'include':_0x25c877[_0xc36b('0x21')]?_['map'](_0x25c877[_0xc36b('0x21')],function(_0x14dfc2){return{'model':db[_0x14dfc2[_0xc36b('0x22')]],'as':_0x14dfc2['as'],'attributes':_0x14dfc2['attributes']};}):[]};}):[]};}):[]:[]})[_0xc36b('0xf')](function(_0x4fc001){logger['info'](_0xc36b('0x19'),_0x483689);logger[_0xc36b('0x13')](_0xc36b('0x19'),_0x483689,JSON['stringify'](_0x4fc001));_0x58e0d2(_0x4fc001);})['catch'](function(_0x1fa1d8){logger['error']('GetVoiceQueueReport',_0x1fa1d8[_0xc36b('0x17')],_0x483689);_0x3b1a63(_0x33a0f6[_0xc36b('0x15')](0x1f4,_0x1fa1d8[_0xc36b('0x17')]));});});};exports[_0xc36b('0x24')]=function(_0x19c9a2){var _0x70933f=this;return new Promise(function(_0x219137,_0x16e4ed){return db[_0xc36b('0x1a')]['create'](_0x19c9a2[_0xc36b('0x25')],{'raw':_0x19c9a2[_0xc36b('0x1c')]?_0x19c9a2[_0xc36b('0x1c')][_0xc36b('0x1d')]===undefined?!![]:![]:!![]})[_0xc36b('0xf')](function(_0x377d4c){logger[_0xc36b('0x10')](_0xc36b('0x24'),_0x19c9a2);logger[_0xc36b('0x13')](_0xc36b('0x24'),_0x19c9a2,JSON[_0xc36b('0x26')](_0x377d4c));_0x219137(_0x377d4c);})[_0xc36b('0x18')](function(_0x22da83){logger['error'](_0xc36b('0x24'),_0x22da83['message'],_0x19c9a2);_0x16e4ed(_0x70933f[_0xc36b('0x15')](0x1f4,_0x22da83[_0xc36b('0x17')]));});});};exports[_0xc36b('0x27')]=function(_0x15c893){var _0x24eddf=this;return new Promise(function(_0x26792c,_0x92ff0b){return db[_0xc36b('0x1a')]['update'](_0x15c893[_0xc36b('0x25')],{'raw':_0x15c893[_0xc36b('0x1c')]?_0x15c893[_0xc36b('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x15c893[_0xc36b('0x1c')]?_0x15c893[_0xc36b('0x1c')][_0xc36b('0x1e')]||null:null,'attributes':_0x15c893['options']?_0x15c893[_0xc36b('0x1c')][_0xc36b('0x23')]||null:null,'limit':_0x15c893['options']?_0x15c893['options'][_0xc36b('0x1f')]||null:null})[_0xc36b('0xf')](function(_0x11cb1f){logger['info'](_0xc36b('0x27'),_0x15c893);logger[_0xc36b('0x13')](_0xc36b('0x27'),_0x15c893,JSON[_0xc36b('0x26')](_0x11cb1f));_0x26792c(_0x11cb1f);})[_0xc36b('0x18')](function(_0x37a1b8){logger[_0xc36b('0x15')]('UpdateVoiceQueueReport',_0x37a1b8[_0xc36b('0x17')],_0x15c893);_0x92ff0b(_0x24eddf['error'](0x1f4,_0x37a1b8[_0xc36b('0x17')]));});});}; \ No newline at end of file +var _0xcbef=['body','UpdateVoiceQueueReport','update','raw','where','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','then','info','VoiceQueueReport,\x20%s,\x20%s','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','findAll','options','attributes','limit','include','map','model','GetVoiceQueueReport','CreateVoiceQueueReport','VoiceQueueReport','create'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xcbef,0x155));var _0xfcbe=function(_0x37b9ad,_0x179adf){_0x37b9ad=_0x37b9ad-0x0;var _0x6264e2=_0xcbef[_0x37b9ad];return _0x6264e2;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xfcbe('0x0'));var BPromise=require(_0xfcbe('0x1'));var rs=require(_0xfcbe('0x2'));var fs=require('fs');var Redis=require(_0xfcbe('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xfcbe('0x4'));var logger=require(_0xfcbe('0x5'))(_0xfcbe('0x6'));var config=require(_0xfcbe('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xfcbe('0x8')][_0xfcbe('0x9')]({'port':0x232a});config['redis']=_[_0xfcbe('0xa')](config[_0xfcbe('0xb')],{'host':_0xfcbe('0xc'),'port':0x18eb});var socket=require(_0xfcbe('0xd'))(new Redis(config[_0xfcbe('0xb')]));require(_0xfcbe('0xe'))['register'](socket);function respondWithRpcPromise(_0x20ac92,_0x1ea9a8,_0x368804){return new BPromise(function(_0x52ef69,_0xfaccaa){return client['request'](_0x20ac92,_0x368804)[_0xfcbe('0xf')](function(_0x55e1bd){logger[_0xfcbe('0x10')](_0xfcbe('0x11'),_0x1ea9a8,'request\x20sent');logger[_0xfcbe('0x12')](_0xfcbe('0x13'),_0x1ea9a8,_0xfcbe('0x14'),JSON[_0xfcbe('0x15')](_0x55e1bd));if(_0x55e1bd[_0xfcbe('0x16')]){if(_0x55e1bd[_0xfcbe('0x16')]['code']===0x1f4){logger[_0xfcbe('0x16')]('VoiceQueueReport,\x20%s,\x20%s',_0x1ea9a8,_0x55e1bd['error'][_0xfcbe('0x17')]);return _0xfaccaa(_0x55e1bd[_0xfcbe('0x16')][_0xfcbe('0x17')]);}logger[_0xfcbe('0x16')](_0xfcbe('0x11'),_0x1ea9a8,_0x55e1bd[_0xfcbe('0x16')][_0xfcbe('0x17')]);return _0x52ef69(_0x55e1bd['error']['message']);}else{logger[_0xfcbe('0x10')](_0xfcbe('0x11'),_0x1ea9a8,_0xfcbe('0x14'));_0x52ef69(_0x55e1bd[_0xfcbe('0x18')]['message']);}})[_0xfcbe('0x19')](function(_0x25f0ce){logger[_0xfcbe('0x16')]('VoiceQueueReport,\x20%s,\x20%s',_0x1ea9a8,_0x25f0ce);_0xfaccaa(_0x25f0ce);});});}exports['GetVoiceQueueReport']=function(_0x2456f5){var _0x5972e5=this;return new Promise(function(_0x21f17c,_0x376ec8){return db['VoiceQueueReport'][_0xfcbe('0x1a')]({'raw':_0x2456f5[_0xfcbe('0x1b')]?_0x2456f5[_0xfcbe('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x2456f5[_0xfcbe('0x1b')]?_0x2456f5['options']['where']||null:null,'attributes':_0x2456f5[_0xfcbe('0x1b')]?_0x2456f5[_0xfcbe('0x1b')][_0xfcbe('0x1c')]||null:null,'limit':_0x2456f5[_0xfcbe('0x1b')]?_0x2456f5['options'][_0xfcbe('0x1d')]||null:null,'include':_0x2456f5[_0xfcbe('0x1b')]?_0x2456f5[_0xfcbe('0x1b')][_0xfcbe('0x1e')]?_[_0xfcbe('0x1f')](_0x2456f5[_0xfcbe('0x1b')]['include'],function(_0x480469){return{'model':db[_0x480469[_0xfcbe('0x20')]],'as':_0x480469['as'],'attributes':_0x480469[_0xfcbe('0x1c')],'include':_0x480469[_0xfcbe('0x1e')]?_[_0xfcbe('0x1f')](_0x480469[_0xfcbe('0x1e')],function(_0x1d1166){return{'model':db[_0x1d1166[_0xfcbe('0x20')]],'as':_0x1d1166['as'],'attributes':_0x1d1166[_0xfcbe('0x1c')],'include':_0x1d1166[_0xfcbe('0x1e')]?_['map'](_0x1d1166[_0xfcbe('0x1e')],function(_0x4a6d5d){return{'model':db[_0x4a6d5d[_0xfcbe('0x20')]],'as':_0x4a6d5d['as'],'attributes':_0x4a6d5d[_0xfcbe('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xfcbe('0xf')](function(_0x18038c){logger[_0xfcbe('0x10')]('GetVoiceQueueReport',_0x2456f5);logger[_0xfcbe('0x12')](_0xfcbe('0x21'),_0x2456f5,JSON[_0xfcbe('0x15')](_0x18038c));_0x21f17c(_0x18038c);})[_0xfcbe('0x19')](function(_0x277f89){logger[_0xfcbe('0x16')]('GetVoiceQueueReport',_0x277f89[_0xfcbe('0x17')],_0x2456f5);_0x376ec8(_0x5972e5['error'](0x1f4,_0x277f89[_0xfcbe('0x17')]));});});};exports[_0xfcbe('0x22')]=function(_0x367ec3){var _0x47377d=this;return new Promise(function(_0x5150ff,_0x2327a7){return db[_0xfcbe('0x23')][_0xfcbe('0x24')](_0x367ec3[_0xfcbe('0x25')],{'raw':_0x367ec3[_0xfcbe('0x1b')]?_0x367ec3[_0xfcbe('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0xfcbe('0xf')](function(_0x4ca1e1){logger[_0xfcbe('0x10')](_0xfcbe('0x22'),_0x367ec3);logger[_0xfcbe('0x12')](_0xfcbe('0x22'),_0x367ec3,JSON[_0xfcbe('0x15')](_0x4ca1e1));_0x5150ff(_0x4ca1e1);})[_0xfcbe('0x19')](function(_0x2c477e){logger['error'](_0xfcbe('0x22'),_0x2c477e[_0xfcbe('0x17')],_0x367ec3);_0x2327a7(_0x47377d[_0xfcbe('0x16')](0x1f4,_0x2c477e[_0xfcbe('0x17')]));});});};exports[_0xfcbe('0x26')]=function(_0x3fd498){var _0xa782e8=this;return new Promise(function(_0x52700d,_0x49d7c6){return db[_0xfcbe('0x23')][_0xfcbe('0x27')](_0x3fd498[_0xfcbe('0x25')],{'raw':_0x3fd498[_0xfcbe('0x1b')]?_0x3fd498[_0xfcbe('0x1b')][_0xfcbe('0x28')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3fd498[_0xfcbe('0x1b')]?_0x3fd498['options'][_0xfcbe('0x29')]||null:null,'attributes':_0x3fd498[_0xfcbe('0x1b')]?_0x3fd498[_0xfcbe('0x1b')]['attributes']||null:null,'limit':_0x3fd498[_0xfcbe('0x1b')]?_0x3fd498[_0xfcbe('0x1b')][_0xfcbe('0x1d')]||null:null})[_0xfcbe('0xf')](function(_0xc8ba1f){logger['info'](_0xfcbe('0x26'),_0x3fd498);logger[_0xfcbe('0x12')](_0xfcbe('0x26'),_0x3fd498,JSON['stringify'](_0xc8ba1f));_0x52700d(_0xc8ba1f);})[_0xfcbe('0x19')](function(_0x317923){logger[_0xfcbe('0x16')](_0xfcbe('0x26'),_0x317923[_0xfcbe('0x17')],_0x3fd498);_0x49d7c6(_0xa782e8[_0xfcbe('0x16')](0x1f4,_0x317923[_0xfcbe('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 019a8cd..2cb2408 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 _0x119a=['./voiceQueueReport.events','save','remove','emit','removeListener','register','length'];(function(_0x31c55d,_0x21b846){var _0x25788b=function(_0x3decdf){while(--_0x3decdf){_0x31c55d['push'](_0x31c55d['shift']());}};_0x25788b(++_0x21b846);}(_0x119a,0x69));var _0xa119=function(_0x2eb50f,_0x4bd249){_0x2eb50f=_0x2eb50f-0x0;var _0x31de5d=_0x119a[_0x2eb50f];return _0x31de5d;};'use strict';var VoiceQueueReportEvents=require(_0xa119('0x0'));var events=[_0xa119('0x1'),_0xa119('0x2'),'update'];function createListener(_0x4dfc84,_0x21e074){return function(_0x1efd4a){_0x21e074[_0xa119('0x3')](_0x4dfc84,_0x1efd4a);};}function removeListener(_0x53fbdf,_0x36321f){return function(){VoiceQueueReportEvents[_0xa119('0x4')](_0x53fbdf,_0x36321f);};}exports[_0xa119('0x5')]=function(_0x4528c6){for(var _0x12fa91=0x0,_0x3590f4=events[_0xa119('0x6')];_0x12fa91<_0x3590f4;_0x12fa91++){var _0x41490d=events[_0x12fa91];var _0x163f6e=createListener('voiceQueueReport:'+_0x41490d,_0x4528c6);VoiceQueueReportEvents['on'](_0x41490d,_0x163f6e);}}; \ No newline at end of file +var _0xe384=['update','emit','register','voiceQueueReport:','./voiceQueueReport.events','remove'];(function(_0x263a2f,_0x1e81e3){var _0x8020e8=function(_0x39f91a){while(--_0x39f91a){_0x263a2f['push'](_0x263a2f['shift']());}};_0x8020e8(++_0x1e81e3);}(_0xe384,0x160));var _0x4e38=function(_0x3aee94,_0x5c4b27){_0x3aee94=_0x3aee94-0x0;var _0xd9cf9=_0xe384[_0x3aee94];return _0xd9cf9;};'use strict';var VoiceQueueReportEvents=require(_0x4e38('0x0'));var events=['save',_0x4e38('0x1'),_0x4e38('0x2')];function createListener(_0x521a6f,_0x4820f4){return function(_0x5164a5){_0x4820f4[_0x4e38('0x3')](_0x521a6f,_0x5164a5);};}function removeListener(_0x1c4e12,_0x4a97d6){return function(){VoiceQueueReportEvents['removeListener'](_0x1c4e12,_0x4a97d6);};}exports[_0x4e38('0x4')]=function(_0x5a34a1){for(var _0x52fd5e=0x0,_0x2a1873=events['length'];_0x52fd5e<_0x2a1873;_0x52fd5e++){var _0x582197=events[_0x52fd5e];var _0x1030fd=createListener(_0x4e38('0x5')+_0x582197,_0x5a34a1);VoiceQueueReportEvents['on'](_0x582197,_0x1030fd);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 1cf777d..2106411 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 _0x23e1=['../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x22f72b,_0x3082dd){var _0x3cbf1c=function(_0x3f8e87){while(--_0x3f8e87){_0x22f72b['push'](_0x22f72b['shift']());}};_0x3cbf1c(++_0x3082dd);}(_0x23e1,0x1dc));var _0x123e=function(_0x5d2e6c,_0x291318){_0x5d2e6c=_0x5d2e6c-0x0;var _0x45a66e=_0x23e1[_0x5d2e6c];return _0x45a66e;};'use strict';var multer=require(_0x123e('0x0'));var util=require(_0x123e('0x1'));var path=require(_0x123e('0x2'));var timeout=require(_0x123e('0x3'));var express=require(_0x123e('0x4'));var router=express['Router']();var fs_extra=require(_0x123e('0x5'));var auth=require(_0x123e('0x6'));var interaction=require(_0x123e('0x7'));var config=require(_0x123e('0x8'));var controller=require(_0x123e('0x9'));router[_0x123e('0xa')]('/',auth[_0x123e('0xb')](),controller[_0x123e('0xc')]);router[_0x123e('0xa')](_0x123e('0xd'),auth['isAuthenticated'](),controller[_0x123e('0xe')]);router[_0x123e('0xf')]('/',auth['isAuthenticated'](),controller[_0x123e('0x10')]);router[_0x123e('0x11')](_0x123e('0xd'),auth['isAuthenticated'](),controller[_0x123e('0x12')]);router[_0x123e('0x13')](_0x123e('0xd'),auth[_0x123e('0xb')](),controller[_0x123e('0x14')]);module['exports']=router; \ No newline at end of file +var _0xb7c8=['exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy'];(function(_0x2e39a6,_0x4f512b){var _0x54004c=function(_0xa87b35){while(--_0xa87b35){_0x2e39a6['push'](_0x2e39a6['shift']());}};_0x54004c(++_0x4f512b);}(_0xb7c8,0x119));var _0x8b7c=function(_0xc4729a,_0x306067){_0xc4729a=_0xc4729a-0x0;var _0x25d290=_0xb7c8[_0xc4729a];return _0x25d290;};'use strict';var multer=require('multer');var util=require(_0x8b7c('0x0'));var path=require(_0x8b7c('0x1'));var timeout=require(_0x8b7c('0x2'));var express=require(_0x8b7c('0x3'));var router=express[_0x8b7c('0x4')]();var fs_extra=require(_0x8b7c('0x5'));var auth=require(_0x8b7c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8b7c('0x7'));var controller=require(_0x8b7c('0x8'));router[_0x8b7c('0x9')]('/',auth[_0x8b7c('0xa')](),controller[_0x8b7c('0xb')]);router[_0x8b7c('0x9')](_0x8b7c('0xc'),auth[_0x8b7c('0xa')](),controller[_0x8b7c('0xd')]);router[_0x8b7c('0xe')]('/',auth[_0x8b7c('0xa')](),controller[_0x8b7c('0xf')]);router['put'](_0x8b7c('0xc'),auth['isAuthenticated'](),controller[_0x8b7c('0x10')]);router[_0x8b7c('0x11')]('/:id',auth[_0x8b7c('0xa')](),controller[_0x8b7c('0x12')]);module[_0x8b7c('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 c85f65f..3c31190 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 _0xb983=['sequelize','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x19bc30,_0x1e3eab){var _0x3a1e47=function(_0x599a61){while(--_0x599a61){_0x19bc30['push'](_0x19bc30['shift']());}};_0x3a1e47(++_0x1e3eab);}(_0xb983,0x1db));var _0x3b98=function(_0x582d0b,_0x28f609){_0x582d0b=_0x582d0b-0x0;var _0x2e93e1=_0xb983[_0x582d0b];return _0x2e93e1;};'use strict';var Sequelize=require(_0x3b98('0x0'));var moment=require('moment');module['exports']={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x3b98('0x1')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x3b98('0x1')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x3b98('0x1')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x3b98('0x1')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x3b98('0x1')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x3b98('0x1')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x3b98('0x1')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x3b98('0x1')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x3b98('0x2')],'allowNull':![],'defaultValue':moment()[_0x3b98('0x3')](_0x3b98('0x4'))}}; \ No newline at end of file +var _0x227a=['DATE','YYYY-MM-DD\x20HH:mm:ss','sequelize','moment','exports','STRING'];(function(_0x1b6daf,_0x25c63e){var _0x216a87=function(_0x2f2881){while(--_0x2f2881){_0x1b6daf['push'](_0x1b6daf['shift']());}};_0x216a87(++_0x25c63e);}(_0x227a,0x1b2));var _0xa227=function(_0x5cdfc4,_0xb7d02a){_0x5cdfc4=_0x5cdfc4-0x0;var _0x1a44e3=_0x227a[_0x5cdfc4];return _0x1a44e3;};'use strict';var Sequelize=require(_0xa227('0x0'));var moment=require(_0xa227('0x1'));module[_0xa227('0x2')]={'time':{'type':Sequelize[_0xa227('0x3')]},'callid':{'type':Sequelize[_0xa227('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xa227('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xa227('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xa227('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xa227('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xa227('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xa227('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xa227('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xa227('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xa227('0x4')],'allowNull':![],'defaultValue':moment()['format'](_0xa227('0x5'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 4499813..a2033ba 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 _0x1e23=['sox','ejs','fs-extra','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','status','json','offset','limit','undefined','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','index','map','VoiceQueuesLog','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','count','rows','catch','show','params','keys','rawAttributes','includeAll','find','body','update','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util'];(function(_0xcd9ece,_0x33ff67){var _0x36f54f=function(_0x54ec76){while(--_0x54ec76){_0xcd9ece['push'](_0xcd9ece['shift']());}};_0x36f54f(++_0x33ff67);}(_0x1e23,0x87));var _0x31e2=function(_0x1189ab,_0x288e39){_0x1189ab=_0x1189ab-0x0;var _0x13c2af=_0x1e23[_0x1189ab];return _0x13c2af;};'use strict';var emlformat=require(_0x31e2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x31e2('0x1'));var jsonpatch=require(_0x31e2('0x2'));var rp=require(_0x31e2('0x3'));var moment=require(_0x31e2('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x31e2('0x5'));var util=require(_0x31e2('0x6'));var path=require('path');var sox=require(_0x31e2('0x7'));var csv=require('to-csv');var ejs=require(_0x31e2('0x8'));var fs=require('fs');var fs_extra=require(_0x31e2('0x9'));var _=require('lodash');var squel=require(_0x31e2('0xa'));var crypto=require('crypto');var jsforce=require(_0x31e2('0xb'));var deskjs=require(_0x31e2('0xc'));var toCsv=require(_0x31e2('0xd'));var querystring=require('querystring');var Papa=require(_0x31e2('0xe'));var Redis=require(_0x31e2('0xf'));var authService=require(_0x31e2('0x10'));var qs=require(_0x31e2('0x11'));var as=require(_0x31e2('0x12'));var hardwareService=require(_0x31e2('0x13'));var logger=require('../../config/logger')(_0x31e2('0x14'));var utils=require('../../config/utils');var config=require(_0x31e2('0x15'));var licenseUtil=require(_0x31e2('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x59d44a,_0x4c979f){_0x4c979f=_0x4c979f||0xcc;return function(_0x2d0212){if(_0x2d0212){return _0x59d44a['sendStatus'](_0x4c979f);}return _0x59d44a[_0x31e2('0x17')](_0x4c979f)['end']();};}function respondWithResult(_0x4097f7,_0x203b2c){_0x203b2c=_0x203b2c||0xc8;return function(_0x459121){if(_0x459121){return _0x4097f7[_0x31e2('0x17')](_0x203b2c)[_0x31e2('0x18')](_0x459121);}};}function respondWithFilteredResult(_0x286297,_0x5c5a7b){return function(_0x1784f4){if(_0x1784f4){var _0x3101b0=typeof _0x5c5a7b[_0x31e2('0x19')]==='undefined'&&typeof _0x5c5a7b[_0x31e2('0x1a')]===_0x31e2('0x1b');var _0x3a105c=_0x1784f4['count'];var _0x4ead45=_0x3101b0?0x0:_0x5c5a7b[_0x31e2('0x19')];var _0x3ec5ed=_0x3101b0?_0x1784f4['count']:_0x5c5a7b['offset']+_0x5c5a7b[_0x31e2('0x1a')];var _0x38e481;if(_0x3ec5ed>=_0x3a105c){_0x3ec5ed=_0x3a105c;_0x38e481=0xc8;}else{_0x38e481=0xce;}_0x286297[_0x31e2('0x17')](_0x38e481);return _0x286297['set'](_0x31e2('0x1c'),_0x4ead45+'-'+_0x3ec5ed+'/'+_0x3a105c)['json'](_0x1784f4);}return null;};}function patchUpdates(_0x28d1a0){return function(_0x18aa88){try{jsonpatch[_0x31e2('0x1d')](_0x18aa88,_0x28d1a0,!![]);}catch(_0x32e3ce){return BPromise[_0x31e2('0x1e')](_0x32e3ce);}return _0x18aa88[_0x31e2('0x1f')]();};}function saveUpdates(_0x20c4e2,_0x10c9ce){return function(_0x50b3d5){if(_0x50b3d5){return _0x50b3d5['update'](_0x20c4e2)[_0x31e2('0x20')](function(_0x3cc480){return _0x3cc480;});}return null;};}function removeEntity(_0x280f44,_0x360b26){return function(_0x5b7359){if(_0x5b7359){return _0x5b7359[_0x31e2('0x21')]()['then'](function(){_0x280f44[_0x31e2('0x17')](0xcc)[_0x31e2('0x22')]();});}};}function handleEntityNotFound(_0x5361b2,_0xb095e7){return function(_0x97b150){if(!_0x97b150){_0x5361b2['sendStatus'](0x194);}return _0x97b150;};}function handleError(_0xad7d04,_0x12e6b3){_0x12e6b3=_0x12e6b3||0x1f4;return function(_0x2588f1){logger[_0x31e2('0x23')](_0x2588f1[_0x31e2('0x24')]);if(_0x2588f1[_0x31e2('0x25')]){delete _0x2588f1['name'];}_0xad7d04[_0x31e2('0x17')](_0x12e6b3)['send'](_0x2588f1);};}exports[_0x31e2('0x26')]=function(_0x3823a7,_0x290386){var _0x5d79e6={},_0x16ed57={},_0x27b85c={'count':0x0,'rows':[]};var _0x39d990=_[_0x31e2('0x27')](db[_0x31e2('0x28')]['rawAttributes'],function(_0x2a659a){return{'name':_0x2a659a[_0x31e2('0x29')],'type':_0x2a659a[_0x31e2('0x2a')][_0x31e2('0x2b')]};});_0x16ed57[_0x31e2('0x2c')]=_[_0x31e2('0x27')](_0x39d990,_0x31e2('0x25'));_0x16ed57[_0x31e2('0x2d')]=_['keys'](_0x3823a7[_0x31e2('0x2d')]);_0x16ed57[_0x31e2('0x2e')]=_[_0x31e2('0x2f')](_0x16ed57[_0x31e2('0x2c')],_0x16ed57['query']);_0x5d79e6[_0x31e2('0x30')]=_[_0x31e2('0x2f')](_0x16ed57[_0x31e2('0x2c')],qs[_0x31e2('0x31')](_0x3823a7['query'][_0x31e2('0x31')]));_0x5d79e6[_0x31e2('0x30')]=_0x5d79e6[_0x31e2('0x30')][_0x31e2('0x32')]?_0x5d79e6['attributes']:_0x16ed57[_0x31e2('0x2c')];if(!_0x3823a7[_0x31e2('0x2d')]['hasOwnProperty'](_0x31e2('0x33'))){_0x5d79e6[_0x31e2('0x1a')]=qs[_0x31e2('0x1a')](_0x3823a7[_0x31e2('0x2d')][_0x31e2('0x1a')]);_0x5d79e6[_0x31e2('0x19')]=qs[_0x31e2('0x19')](_0x3823a7[_0x31e2('0x2d')][_0x31e2('0x19')]);}_0x5d79e6[_0x31e2('0x34')]=qs[_0x31e2('0x35')](_0x3823a7[_0x31e2('0x2d')]['sort']);_0x5d79e6[_0x31e2('0x36')]=qs['filters'](_[_0x31e2('0x37')](_0x3823a7['query'],_0x16ed57[_0x31e2('0x2e')]),_0x39d990);if(_0x3823a7['query'][_0x31e2('0x38')]){_0x5d79e6[_0x31e2('0x36')]=_['merge'](_0x5d79e6[_0x31e2('0x36')],{'$or':_['map'](_0x39d990,function(_0x127298){if(_0x127298[_0x31e2('0x2a')]!==_0x31e2('0x39')){var _0x4153da={};_0x4153da[_0x127298[_0x31e2('0x25')]]={'$like':'%'+_0x3823a7[_0x31e2('0x2d')]['filter']+'%'};return _0x4153da;}})});}_0x5d79e6=_[_0x31e2('0x3a')]({},_0x5d79e6,_0x3823a7[_0x31e2('0x3b')]);var _0x587ead={'where':_0x5d79e6[_0x31e2('0x36')]};return db[_0x31e2('0x28')][_0x31e2('0x3c')](_0x587ead)[_0x31e2('0x20')](function(_0x5e5093){_0x27b85c[_0x31e2('0x3c')]=_0x5e5093;if(_0x3823a7['query']['includeAll']){_0x5d79e6['include']=[{'all':!![]}];}return db[_0x31e2('0x28')]['findAll'](_0x5d79e6);})[_0x31e2('0x20')](function(_0x1a8ae3){_0x27b85c[_0x31e2('0x3d')]=_0x1a8ae3;return _0x27b85c;})['then'](respondWithFilteredResult(_0x290386,_0x5d79e6))[_0x31e2('0x3e')](handleError(_0x290386,null));};exports[_0x31e2('0x3f')]=function(_0x3ee1cb,_0x5b33da){var _0x29be32={'raw':!![],'where':{'id':_0x3ee1cb[_0x31e2('0x40')]['id']}},_0x67c6fa={};_0x67c6fa[_0x31e2('0x2c')]=_[_0x31e2('0x41')](db[_0x31e2('0x28')][_0x31e2('0x42')]);_0x67c6fa['query']=_[_0x31e2('0x41')](_0x3ee1cb[_0x31e2('0x2d')]);_0x67c6fa[_0x31e2('0x2e')]=_['intersection'](_0x67c6fa[_0x31e2('0x2c')],_0x67c6fa['query']);_0x29be32['attributes']=_[_0x31e2('0x2f')](_0x67c6fa[_0x31e2('0x2c')],qs[_0x31e2('0x31')](_0x3ee1cb['query']['fields']));_0x29be32['attributes']=_0x29be32[_0x31e2('0x30')][_0x31e2('0x32')]?_0x29be32[_0x31e2('0x30')]:_0x67c6fa[_0x31e2('0x2c')];if(_0x3ee1cb['query'][_0x31e2('0x43')]){_0x29be32['include']=[{'all':!![]}];}_0x29be32=_[_0x31e2('0x3a')]({},_0x29be32,_0x3ee1cb[_0x31e2('0x3b')]);return db[_0x31e2('0x28')][_0x31e2('0x44')](_0x29be32)['then'](handleEntityNotFound(_0x5b33da,null))['then'](respondWithResult(_0x5b33da,null))[_0x31e2('0x3e')](handleError(_0x5b33da,null));};exports['create']=function(_0x2b3a1a,_0x3d0384){return db['VoiceQueuesLog']['create'](_0x2b3a1a[_0x31e2('0x45')],{})['then'](respondWithResult(_0x3d0384,0xc9))[_0x31e2('0x3e')](handleError(_0x3d0384,null));};exports[_0x31e2('0x46')]=function(_0x65b777,_0x1f38e4){if(_0x65b777[_0x31e2('0x45')]['id']){delete _0x65b777[_0x31e2('0x45')]['id'];}return db['VoiceQueuesLog'][_0x31e2('0x44')]({'where':{'id':_0x65b777[_0x31e2('0x40')]['id']}})[_0x31e2('0x20')](handleEntityNotFound(_0x1f38e4,null))[_0x31e2('0x20')](saveUpdates(_0x65b777[_0x31e2('0x45')],null))['then'](respondWithResult(_0x1f38e4,null))[_0x31e2('0x3e')](handleError(_0x1f38e4,null));};exports[_0x31e2('0x21')]=function(_0x3cecc0,_0x1616ac){return db['VoiceQueuesLog']['find']({'where':{'id':_0x3cecc0[_0x31e2('0x40')]['id']}})[_0x31e2('0x20')](handleEntityNotFound(_0x1616ac,null))[_0x31e2('0x20')](removeEntity(_0x1616ac,null))[_0x31e2('0x3e')](handleError(_0x1616ac,null));}; \ No newline at end of file +var _0x6192=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','apply','save','update','then','error','stack','name','send','index','VoiceQueuesLog','rawAttributes','type','map','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','find','create','catch','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','fs-extra','lodash','jsforce','to-csv','querystring'];(function(_0xaf29da,_0x117f5a){var _0x295c51=function(_0x3feaf4){while(--_0x3feaf4){_0xaf29da['push'](_0xaf29da['shift']());}};_0x295c51(++_0x117f5a);}(_0x6192,0x10a));var _0x2619=function(_0x902cb3,_0x5f3122){_0x902cb3=_0x902cb3-0x0;var _0x1cb16b=_0x6192[_0x902cb3];return _0x1cb16b;};'use strict';var emlformat=require(_0x2619('0x0'));var rimraf=require(_0x2619('0x1'));var zipdir=require(_0x2619('0x2'));var jsonpatch=require(_0x2619('0x3'));var rp=require('request-promise');var moment=require(_0x2619('0x4'));var BPromise=require(_0x2619('0x5'));var Mustache=require('mustache');var util=require(_0x2619('0x6'));var path=require(_0x2619('0x7'));var sox=require(_0x2619('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2619('0x9'));var _=require(_0x2619('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2619('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x2619('0xc'));var querystring=require(_0x2619('0xd'));var Papa=require('papaparse');var Redis=require(_0x2619('0xe'));var authService=require(_0x2619('0xf'));var qs=require(_0x2619('0x10'));var as=require(_0x2619('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2619('0x12'))(_0x2619('0x13'));var utils=require('../../config/utils');var config=require(_0x2619('0x14'));var licenseUtil=require(_0x2619('0x15'));var db=require(_0x2619('0x16'))['db'];function respondWithStatusCode(_0x1681b1,_0x1dbea9){_0x1dbea9=_0x1dbea9||0xcc;return function(_0x1b6f10){if(_0x1b6f10){return _0x1681b1[_0x2619('0x17')](_0x1dbea9);}return _0x1681b1['status'](_0x1dbea9)[_0x2619('0x18')]();};}function respondWithResult(_0x29443a,_0xcac09){_0xcac09=_0xcac09||0xc8;return function(_0x932135){if(_0x932135){return _0x29443a[_0x2619('0x19')](_0xcac09)[_0x2619('0x1a')](_0x932135);}};}function respondWithFilteredResult(_0x39db18,_0x39982a){return function(_0x25ade1){if(_0x25ade1){var _0x139287=typeof _0x39982a[_0x2619('0x1b')]===_0x2619('0x1c')&&typeof _0x39982a['limit']===_0x2619('0x1c');var _0x2007c2=_0x25ade1[_0x2619('0x1d')];var _0x1f13e6=_0x139287?0x0:_0x39982a[_0x2619('0x1b')];var _0x368bd6=_0x139287?_0x25ade1[_0x2619('0x1d')]:_0x39982a[_0x2619('0x1b')]+_0x39982a[_0x2619('0x1e')];var _0x3c4cad;if(_0x368bd6>=_0x2007c2){_0x368bd6=_0x2007c2;_0x3c4cad=0xc8;}else{_0x3c4cad=0xce;}_0x39db18[_0x2619('0x19')](_0x3c4cad);return _0x39db18['set']('Content-Range',_0x1f13e6+'-'+_0x368bd6+'/'+_0x2007c2)[_0x2619('0x1a')](_0x25ade1);}return null;};}function patchUpdates(_0x4c82dc){return function(_0x5cd988){try{jsonpatch[_0x2619('0x1f')](_0x5cd988,_0x4c82dc,!![]);}catch(_0x18ee96){return BPromise['reject'](_0x18ee96);}return _0x5cd988[_0x2619('0x20')]();};}function saveUpdates(_0xfbf785,_0x269b89){return function(_0x537ac5){if(_0x537ac5){return _0x537ac5[_0x2619('0x21')](_0xfbf785)[_0x2619('0x22')](function(_0x312e60){return _0x312e60;});}return null;};}function removeEntity(_0x4dee91,_0x3e36df){return function(_0x2b319d){if(_0x2b319d){return _0x2b319d['destroy']()[_0x2619('0x22')](function(){_0x4dee91[_0x2619('0x19')](0xcc)[_0x2619('0x18')]();});}};}function handleEntityNotFound(_0x25eb97,_0x524bf5){return function(_0xe82f8b){if(!_0xe82f8b){_0x25eb97['sendStatus'](0x194);}return _0xe82f8b;};}function handleError(_0x2ca298,_0x3c74c2){_0x3c74c2=_0x3c74c2||0x1f4;return function(_0x33c8ca){logger[_0x2619('0x23')](_0x33c8ca[_0x2619('0x24')]);if(_0x33c8ca[_0x2619('0x25')]){delete _0x33c8ca[_0x2619('0x25')];}_0x2ca298[_0x2619('0x19')](_0x3c74c2)[_0x2619('0x26')](_0x33c8ca);};}exports[_0x2619('0x27')]=function(_0x32fc2c,_0x52e0ee){var _0x4677bd={},_0x54ad0e={},_0x15a0dc={'count':0x0,'rows':[]};var _0xdfd551=_['map'](db[_0x2619('0x28')][_0x2619('0x29')],function(_0x1a6d82){return{'name':_0x1a6d82['fieldName'],'type':_0x1a6d82[_0x2619('0x2a')]['key']};});_0x54ad0e['model']=_[_0x2619('0x2b')](_0xdfd551,_0x2619('0x25'));_0x54ad0e[_0x2619('0x2c')]=_[_0x2619('0x2d')](_0x32fc2c['query']);_0x54ad0e['filters']=_[_0x2619('0x2e')](_0x54ad0e[_0x2619('0x2f')],_0x54ad0e['query']);_0x4677bd['attributes']=_[_0x2619('0x2e')](_0x54ad0e[_0x2619('0x2f')],qs[_0x2619('0x30')](_0x32fc2c[_0x2619('0x2c')][_0x2619('0x30')]));_0x4677bd[_0x2619('0x31')]=_0x4677bd[_0x2619('0x31')][_0x2619('0x32')]?_0x4677bd[_0x2619('0x31')]:_0x54ad0e[_0x2619('0x2f')];if(!_0x32fc2c[_0x2619('0x2c')][_0x2619('0x33')](_0x2619('0x34'))){_0x4677bd[_0x2619('0x1e')]=qs['limit'](_0x32fc2c[_0x2619('0x2c')][_0x2619('0x1e')]);_0x4677bd[_0x2619('0x1b')]=qs[_0x2619('0x1b')](_0x32fc2c['query'][_0x2619('0x1b')]);}_0x4677bd[_0x2619('0x35')]=qs[_0x2619('0x36')](_0x32fc2c[_0x2619('0x2c')][_0x2619('0x36')]);_0x4677bd[_0x2619('0x37')]=qs[_0x2619('0x38')](_['pick'](_0x32fc2c[_0x2619('0x2c')],_0x54ad0e[_0x2619('0x38')]),_0xdfd551);if(_0x32fc2c[_0x2619('0x2c')][_0x2619('0x39')]){_0x4677bd[_0x2619('0x37')]=_[_0x2619('0x3a')](_0x4677bd[_0x2619('0x37')],{'$or':_[_0x2619('0x2b')](_0xdfd551,function(_0xa3774b){if(_0xa3774b[_0x2619('0x2a')]!==_0x2619('0x3b')){var _0x3a6a6b={};_0x3a6a6b[_0xa3774b['name']]={'$like':'%'+_0x32fc2c[_0x2619('0x2c')][_0x2619('0x39')]+'%'};return _0x3a6a6b;}})});}_0x4677bd=_[_0x2619('0x3a')]({},_0x4677bd,_0x32fc2c[_0x2619('0x3c')]);var _0x221177={'where':_0x4677bd[_0x2619('0x37')]};return db['VoiceQueuesLog'][_0x2619('0x1d')](_0x221177)[_0x2619('0x22')](function(_0x2de2ad){_0x15a0dc[_0x2619('0x1d')]=_0x2de2ad;if(_0x32fc2c['query'][_0x2619('0x3d')]){_0x4677bd[_0x2619('0x3e')]=[{'all':!![]}];}return db['VoiceQueuesLog'][_0x2619('0x3f')](_0x4677bd);})[_0x2619('0x22')](function(_0x2f9a34){_0x15a0dc[_0x2619('0x40')]=_0x2f9a34;return _0x15a0dc;})[_0x2619('0x22')](respondWithFilteredResult(_0x52e0ee,_0x4677bd))['catch'](handleError(_0x52e0ee,null));};exports['show']=function(_0x481c09,_0x1e8641){var _0x4840d0={'raw':!![],'where':{'id':_0x481c09[_0x2619('0x41')]['id']}},_0x28eaf7={};_0x28eaf7[_0x2619('0x2f')]=_['keys'](db[_0x2619('0x28')][_0x2619('0x29')]);_0x28eaf7[_0x2619('0x2c')]=_['keys'](_0x481c09[_0x2619('0x2c')]);_0x28eaf7['filters']=_[_0x2619('0x2e')](_0x28eaf7[_0x2619('0x2f')],_0x28eaf7[_0x2619('0x2c')]);_0x4840d0['attributes']=_['intersection'](_0x28eaf7['model'],qs[_0x2619('0x30')](_0x481c09[_0x2619('0x2c')][_0x2619('0x30')]));_0x4840d0['attributes']=_0x4840d0[_0x2619('0x31')][_0x2619('0x32')]?_0x4840d0[_0x2619('0x31')]:_0x28eaf7['model'];if(_0x481c09[_0x2619('0x2c')]['includeAll']){_0x4840d0[_0x2619('0x3e')]=[{'all':!![]}];}_0x4840d0=_[_0x2619('0x3a')]({},_0x4840d0,_0x481c09['options']);return db[_0x2619('0x28')][_0x2619('0x42')](_0x4840d0)[_0x2619('0x22')](handleEntityNotFound(_0x1e8641,null))[_0x2619('0x22')](respondWithResult(_0x1e8641,null))['catch'](handleError(_0x1e8641,null));};exports[_0x2619('0x43')]=function(_0xdf972c,_0x12a874){return db[_0x2619('0x28')]['create'](_0xdf972c['body'],{})[_0x2619('0x22')](respondWithResult(_0x12a874,0xc9))[_0x2619('0x44')](handleError(_0x12a874,null));};exports['update']=function(_0x4c5966,_0x34a35b){if(_0x4c5966['body']['id']){delete _0x4c5966[_0x2619('0x45')]['id'];}return db['VoiceQueuesLog'][_0x2619('0x42')]({'where':{'id':_0x4c5966[_0x2619('0x41')]['id']}})['then'](handleEntityNotFound(_0x34a35b,null))[_0x2619('0x22')](saveUpdates(_0x4c5966['body'],null))[_0x2619('0x22')](respondWithResult(_0x34a35b,null))[_0x2619('0x44')](handleError(_0x34a35b,null));};exports['destroy']=function(_0x1de282,_0x232e25){return db['VoiceQueuesLog'][_0x2619('0x42')]({'where':{'id':_0x1de282[_0x2619('0x41')]['id']}})[_0x2619('0x22')](handleEntityNotFound(_0x232e25,null))[_0x2619('0x22')](removeEntity(_0x232e25,null))['catch'](handleError(_0x232e25,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index cf778f5..8e2f4a5 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 _0xfd6b=['voice_queues_log','event_dtm','event','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','define'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xfd6b,0x1d1));var _0xbfd6=function(_0x565546,_0x6501e9){_0x565546=_0x565546-0x0;var _0x43b655=_0xfd6b[_0x565546];return _0x43b655;};'use strict';var _=require(_0xbfd6('0x0'));var util=require(_0xbfd6('0x1'));var logger=require(_0xbfd6('0x2'))(_0xbfd6('0x3'));var moment=require(_0xbfd6('0x4'));var BPromise=require(_0xbfd6('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbfd6('0x6'));var rimraf=require(_0xbfd6('0x7'));var config=require(_0xbfd6('0x8'));var attributes=require(_0xbfd6('0x9'));module['exports']=function(_0x249e43,_0x6f57ec){return _0x249e43[_0xbfd6('0xa')]('VoiceQueuesLog',attributes,{'tableName':_0xbfd6('0xb'),'paranoid':![],'indexes':[{'name':_0xbfd6('0xc'),'fields':[_0xbfd6('0xd'),'dtm']}],'timestamps':![]});}; \ No newline at end of file +var _0xb2b1=['bluebird','path','rimraf','exports','define','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm','lodash','util','../../config/logger','api','moment'];(function(_0x256684,_0x529c1e){var _0x37a0c9=function(_0x4b431b){while(--_0x4b431b){_0x256684['push'](_0x256684['shift']());}};_0x37a0c9(++_0x529c1e);}(_0xb2b1,0x190));var _0x1b2b=function(_0xbda77b,_0x1e473a){_0xbda77b=_0xbda77b-0x0;var _0x583a66=_0xb2b1[_0xbda77b];return _0x583a66;};'use strict';var _=require(_0x1b2b('0x0'));var util=require(_0x1b2b('0x1'));var logger=require(_0x1b2b('0x2'))(_0x1b2b('0x3'));var moment=require(_0x1b2b('0x4'));var BPromise=require(_0x1b2b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1b2b('0x6'));var rimraf=require(_0x1b2b('0x7'));var config=require('../../config/environment');var attributes=require('./voiceQueuesLog.attributes');module[_0x1b2b('0x8')]=function(_0x298b57,_0x4587ba){return _0x298b57[_0x1b2b('0x9')](_0x1b2b('0xa'),attributes,{'tableName':_0x1b2b('0xb'),'paranoid':![],'indexes':[{'name':_0x1b2b('0xc'),'fields':[_0x1b2b('0xd'),_0x1b2b('0xe')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 23a9a0e..f72b647 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 _0x1e72=['request\x20sent','debug','error','code','message','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','info','VoiceQueuesLog,\x20%s,\x20%s'];(function(_0x589470,_0x3e44d3){var _0x19874e=function(_0x4253dc){while(--_0x4253dc){_0x589470['push'](_0x589470['shift']());}};_0x19874e(++_0x3e44d3);}(_0x1e72,0xe9));var _0x21e7=function(_0x2aebf0,_0x2c5006){_0x2aebf0=_0x2aebf0-0x0;var _0x828d7=_0x1e72[_0x2aebf0];return _0x828d7;};'use strict';var _=require(_0x21e7('0x0'));var util=require(_0x21e7('0x1'));var moment=require(_0x21e7('0x2'));var BPromise=require(_0x21e7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x21e7('0x4'));var db=require(_0x21e7('0x5'))['db'];var utils=require(_0x21e7('0x6'));var logger=require('../../config/logger')(_0x21e7('0x7'));var config=require(_0x21e7('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x21e7('0x9')][_0x21e7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x55ad48,_0x56558c,_0x17c883){return new BPromise(function(_0x3f9970,_0x40330a){return client[_0x21e7('0xb')](_0x55ad48,_0x17c883)['then'](function(_0x5a7ab9){logger[_0x21e7('0xc')](_0x21e7('0xd'),_0x56558c,_0x21e7('0xe'));logger[_0x21e7('0xf')]('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x56558c,_0x21e7('0xe'),JSON['stringify'](_0x5a7ab9));if(_0x5a7ab9[_0x21e7('0x10')]){if(_0x5a7ab9[_0x21e7('0x10')][_0x21e7('0x11')]===0x1f4){logger[_0x21e7('0x10')]('VoiceQueuesLog,\x20%s,\x20%s',_0x56558c,_0x5a7ab9['error'][_0x21e7('0x12')]);return _0x40330a(_0x5a7ab9[_0x21e7('0x10')][_0x21e7('0x12')]);}logger[_0x21e7('0x10')](_0x21e7('0xd'),_0x56558c,_0x5a7ab9['error'][_0x21e7('0x12')]);return _0x3f9970(_0x5a7ab9['error'][_0x21e7('0x12')]);}else{logger['info']('VoiceQueuesLog,\x20%s,\x20%s',_0x56558c,_0x21e7('0xe'));_0x3f9970(_0x5a7ab9['result']['message']);}})['catch'](function(_0x263872){logger['error'](_0x21e7('0xd'),_0x56558c,_0x263872);_0x40330a(_0x263872);});});} \ No newline at end of file +var _0x98b8=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x10e13d,_0x5345e8){var _0x40eada=function(_0x2b0c5b){while(--_0x2b0c5b){_0x10e13d['push'](_0x10e13d['shift']());}};_0x40eada(++_0x5345e8);}(_0x98b8,0x93));var _0x898b=function(_0x159c66,_0x23a8d3){_0x159c66=_0x159c66-0x0;var _0x1d2cb8=_0x98b8[_0x159c66];return _0x1d2cb8;};'use strict';var _=require(_0x898b('0x0'));var util=require(_0x898b('0x1'));var moment=require(_0x898b('0x2'));var BPromise=require(_0x898b('0x3'));var rs=require(_0x898b('0x4'));var fs=require('fs');var Redis=require(_0x898b('0x5'));var db=require(_0x898b('0x6'))['db'];var utils=require(_0x898b('0x7'));var logger=require(_0x898b('0x8'))(_0x898b('0x9'));var config=require(_0x898b('0xa'));var jayson=require(_0x898b('0xb'));var client=jayson[_0x898b('0xc')][_0x898b('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x124030,_0x4e9410,_0x3989f9){return new BPromise(function(_0x32e2e,_0x4220a7){return client[_0x898b('0xe')](_0x124030,_0x3989f9)[_0x898b('0xf')](function(_0x46118b){logger[_0x898b('0x10')](_0x898b('0x11'),_0x4e9410,'request\x20sent');logger[_0x898b('0x12')]('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x4e9410,'request\x20sent',JSON[_0x898b('0x13')](_0x46118b));if(_0x46118b[_0x898b('0x14')]){if(_0x46118b[_0x898b('0x14')][_0x898b('0x15')]===0x1f4){logger[_0x898b('0x14')](_0x898b('0x11'),_0x4e9410,_0x46118b[_0x898b('0x14')][_0x898b('0x16')]);return _0x4220a7(_0x46118b[_0x898b('0x14')][_0x898b('0x16')]);}logger[_0x898b('0x14')](_0x898b('0x11'),_0x4e9410,_0x46118b['error'][_0x898b('0x16')]);return _0x32e2e(_0x46118b[_0x898b('0x14')][_0x898b('0x16')]);}else{logger['info']('VoiceQueuesLog,\x20%s,\x20%s',_0x4e9410,_0x898b('0x17'));_0x32e2e(_0x46118b[_0x898b('0x18')][_0x898b('0x16')]);}})[_0x898b('0x19')](function(_0x54cd3b){logger[_0x898b('0x14')]('VoiceQueuesLog,\x20%s,\x20%s',_0x4e9410,_0x54cd3b);_0x4220a7(_0x54cd3b);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index cc8a99a..69a255a 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 _0xb81e=['isAuthenticated','index','/describe','/:id','show','/:id/download','download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','put','update','delete','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceRecording.controller','get'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb81e,0x8d));var _0xeb81=function(_0x44232c,_0x5a7cc8){_0x44232c=_0x44232c-0x0;var _0x30683a=_0xb81e[_0x44232c];return _0x30683a;};'use strict';var multer=require('multer');var util=require(_0xeb81('0x0'));var path=require(_0xeb81('0x1'));var timeout=require(_0xeb81('0x2'));var express=require('express');var router=express[_0xeb81('0x3')]();var fs_extra=require(_0xeb81('0x4'));var auth=require(_0xeb81('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xeb81('0x6'));var controller=require(_0xeb81('0x7'));router[_0xeb81('0x8')]('/',auth[_0xeb81('0x9')](),controller[_0xeb81('0xa')]);router[_0xeb81('0x8')](_0xeb81('0xb'),auth[_0xeb81('0x9')](),controller['describe']);router[_0xeb81('0x8')](_0xeb81('0xc'),auth[_0xeb81('0x9')](),controller[_0xeb81('0xd')]);router['get'](_0xeb81('0xe'),auth[_0xeb81('0x9')](),controller[_0xeb81('0xf')]);router[_0xeb81('0x8')](_0xeb81('0x10'),controller[_0xeb81('0x11')]);router[_0xeb81('0x8')](_0xeb81('0x12'),auth[_0xeb81('0x9')](),controller[_0xeb81('0x13')]);router['post']('/',auth[_0xeb81('0x9')](),controller['create']);router[_0xeb81('0x14')](_0xeb81('0x12'),auth['isAuthenticated'](),controller['runTranscribe']);router[_0xeb81('0x15')]('/:id',auth[_0xeb81('0x9')](),controller[_0xeb81('0x16')]);router[_0xeb81('0x17')]('/:id',auth[_0xeb81('0x9')](),controller['destroy']);module[_0xeb81('0x18')]=router; \ No newline at end of file +var _0x293a=['put','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','download','downloads','/:id/transcribe','create','post','runTranscribe'];(function(_0x3e0156,_0x2b3343){var _0x23c1c3=function(_0x521afd){while(--_0x521afd){_0x3e0156['push'](_0x3e0156['shift']());}};_0x23c1c3(++_0x2b3343);}(_0x293a,0x81));var _0xa293=function(_0xbd1f50,_0x1abfa6){_0xbd1f50=_0xbd1f50-0x0;var _0x472bb2=_0x293a[_0xbd1f50];return _0x472bb2;};'use strict';var multer=require(_0xa293('0x0'));var util=require(_0xa293('0x1'));var path=require(_0xa293('0x2'));var timeout=require(_0xa293('0x3'));var express=require('express');var router=express[_0xa293('0x4')]();var fs_extra=require(_0xa293('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa293('0x6'));var config=require(_0xa293('0x7'));var controller=require('./voiceRecording.controller');router[_0xa293('0x8')]('/',auth[_0xa293('0x9')](),controller[_0xa293('0xa')]);router['get'](_0xa293('0xb'),auth[_0xa293('0x9')](),controller[_0xa293('0xc')]);router[_0xa293('0x8')](_0xa293('0xd'),auth[_0xa293('0x9')](),controller[_0xa293('0xe')]);router['get']('/:id/download',auth[_0xa293('0x9')](),controller[_0xa293('0xf')]);router[_0xa293('0x8')]('/:id/downloads',controller[_0xa293('0x10')]);router[_0xa293('0x8')](_0xa293('0x11'),auth['isAuthenticated'](),controller['downloadTranscribe']);router['post']('/',auth[_0xa293('0x9')](),controller[_0xa293('0x12')]);router[_0xa293('0x13')]('/:id/transcribe',auth[_0xa293('0x9')](),controller[_0xa293('0x14')]);router[_0xa293('0x15')]('/:id',auth[_0xa293('0x9')](),controller['update']);router[_0xa293('0x16')](_0xa293('0xd'),auth[_0xa293('0x9')](),controller[_0xa293('0x17')]);module[_0xa293('0x18')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 1fc72f8..a051e20 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(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0xa9e0,0x123));var _0x0a9e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0a9e('0x3')]('value')?path[_0x0a9e('0x4')](this[_0x0a9e('0x3')](_0x0a9e('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0x0a9e('0x6')]},'channel':{'type':Sequelize[_0x0a9e('0x6')],'set':function(_0x57b080){if(_0x57b080){this[_0x0a9e('0x7')](_0x0a9e('0x8'),_0x57b080);this[_0x0a9e('0x7')]('membername',_0x57b080['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x0a9e('0x6')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x0a9e('0x6')]},'connectedlinename':{'type':Sequelize[_0x0a9e('0x6')]},'accountcode':{'type':Sequelize[_0x0a9e('0x6')]},'context':{'type':Sequelize[_0x0a9e('0x6')]},'exten':{'type':Sequelize[_0x0a9e('0x6')]},'value':{'type':Sequelize[_0x0a9e('0x6')]},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'userThirdDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'location':{'type':Sequelize[_0x0a9e('0x9')]},'transcribeName':{'type':Sequelize[_0x0a9e('0x6')]},'transcribeStatus':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':_0x0a9e('0xa')},'fileUri':{'type':Sequelize['TEXT']},'fileText':{'type':Sequelize[_0x0a9e('0x9')]},'failureReason':{'type':Sequelize[_0x0a9e('0x9')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')]},'sPositive':{'type':Sequelize[_0x0a9e('0xb')]},'sNegative':{'type':Sequelize[_0x0a9e('0xb')]},'sNeutral':{'type':Sequelize[_0x0a9e('0xb')]},'sMixed':{'type':Sequelize['FLOAT']},'tempSentiment':{'type':Sequelize[_0x0a9e('0xc')],'defaultValue':![]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x0a9e('0x3')]('createdAt'))[_0x0a9e('0xd')](_0x0a9e('0xe'))['toString']();}},'updatedAt':{'type':Sequelize[_0x0a9e('0xf')],'get':function(){return moment(this['getDataValue'](_0x0a9e('0x10')))[_0x0a9e('0xd')](_0x0a9e('0xe'))[_0x0a9e('0x11')]();}}}; \ No newline at end of file +var _0xa9e0=['DATE','updatedAt','toString','sequelize','moment','path','getDataValue','extname','value','STRING','setDataValue','channel','TEXT','NEW','FLOAT','BOOLEAN','format','MM-DD-YYYY\x20HH:mm'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'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 fd1904d..b723292 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 _0x7d3d=['path','sox','ejs','fs-extra','squel','crypto','jsforce','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../mysqldb','end','offset','undefined','limit','count','status','set','Content-Range','json','apply','save','destroy','then','sendStatus','stack','name','map','VoiceRecording','fieldName','type','model','differenceBy','format','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','find','create','body','update','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','recording','ValidationError','download','filename','extname','unlink','message','VoiceRecording\x20not\x20found','downloads','sequelize','MD5','push','Sequelize','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','listBuckets','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','runTranscribe','../../components/encryptor','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','.txt','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','request-promise','util'];(function(_0x3cb52a,_0x5a586d){var _0x4e6bab=function(_0xd38f5){while(--_0xd38f5){_0x3cb52a['push'](_0x3cb52a['shift']());}};_0x4e6bab(++_0x5a586d);}(_0x7d3d,0x88));var _0xd7d3=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x7d3d[_0x2641f9];return _0x585741;};'use strict';var emlformat=require(_0xd7d3('0x0'));var rimraf=require(_0xd7d3('0x1'));var zipdir=require(_0xd7d3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd7d3('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd7d3('0x4'));var path=require(_0xd7d3('0x5'));var sox=require(_0xd7d3('0x6'));var csv=require('to-csv');var ejs=require(_0xd7d3('0x7'));var fs=require('fs');var fs_extra=require(_0xd7d3('0x8'));var _=require('lodash');var squel=require(_0xd7d3('0x9'));var crypto=require(_0xd7d3('0xa'));var jsforce=require(_0xd7d3('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xd7d3('0xc'));var querystring=require(_0xd7d3('0xd'));var Papa=require('papaparse');var AWS=require('aws-sdk');var uuidv4=require('uuid/v4');var Redis=require('ioredis');var authService=require(_0xd7d3('0xe'));var qs=require(_0xd7d3('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd7d3('0x10'));var logger=require(_0xd7d3('0x11'))(_0xd7d3('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xd7d3('0x13'))['db'];function respondWithStatusCode(_0xf55c42,_0x499443){_0x499443=_0x499443||0xcc;return function(_0x156b22){if(_0x156b22){return _0xf55c42['sendStatus'](_0x499443);}return _0xf55c42['status'](_0x499443)[_0xd7d3('0x14')]();};}function respondWithResult(_0x41c17a,_0x4d2232){_0x4d2232=_0x4d2232||0xc8;return function(_0x329dc2){if(_0x329dc2){return _0x41c17a['status'](_0x4d2232)['json'](_0x329dc2);}};}function respondWithFilteredResult(_0xcd9fdb,_0x2df385){return function(_0x3c1542){if(_0x3c1542){var _0x433ec1=typeof _0x2df385[_0xd7d3('0x15')]===_0xd7d3('0x16')&&typeof _0x2df385[_0xd7d3('0x17')]===_0xd7d3('0x16');var _0x3b7a3e=_0x3c1542[_0xd7d3('0x18')];var _0x45949f=_0x433ec1?0x0:_0x2df385[_0xd7d3('0x15')];var _0x3e7f3c=_0x433ec1?_0x3c1542[_0xd7d3('0x18')]:_0x2df385['offset']+_0x2df385[_0xd7d3('0x17')];var _0x15d1c4;if(_0x3e7f3c>=_0x3b7a3e){_0x3e7f3c=_0x3b7a3e;_0x15d1c4=0xc8;}else{_0x15d1c4=0xce;}_0xcd9fdb[_0xd7d3('0x19')](_0x15d1c4);return _0xcd9fdb[_0xd7d3('0x1a')](_0xd7d3('0x1b'),_0x45949f+'-'+_0x3e7f3c+'/'+_0x3b7a3e)[_0xd7d3('0x1c')](_0x3c1542);}return null;};}function patchUpdates(_0x473af2){return function(_0x1bcd80){try{jsonpatch[_0xd7d3('0x1d')](_0x1bcd80,_0x473af2,!![]);}catch(_0x3e0b57){return BPromise['reject'](_0x3e0b57);}return _0x1bcd80[_0xd7d3('0x1e')]();};}function saveUpdates(_0x54b072,_0x51220b){return function(_0xcf852c){if(_0xcf852c){return _0xcf852c['update'](_0x54b072)['then'](function(_0x433e7c){return _0x433e7c;});}return null;};}function removeEntity(_0x4b6a27,_0x4844a4){return function(_0x24518a){if(_0x24518a){return _0x24518a[_0xd7d3('0x1f')]()[_0xd7d3('0x20')](function(){_0x4b6a27['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x119078,_0x305c3a){return function(_0x5f396b){if(!_0x5f396b){_0x119078[_0xd7d3('0x21')](0x194);}return _0x5f396b;};}function handleError(_0x45eb5b,_0x32cfb9){_0x32cfb9=_0x32cfb9||0x1f4;return function(_0x4d9ce5){logger['error'](_0x4d9ce5[_0xd7d3('0x22')]);if(_0x4d9ce5[_0xd7d3('0x23')]){delete _0x4d9ce5['name'];}_0x45eb5b['status'](_0x32cfb9)['send'](_0x4d9ce5);};}exports['index']=function(_0x1186da,_0x1a8f0b){var _0xedd102={},_0x1f436e={},_0x5236d4={'count':0x0,'rows':[]};var _0x220814=_[_0xd7d3('0x24')](db[_0xd7d3('0x25')]['rawAttributes'],function(_0x1f83eb){return{'name':_0x1f83eb[_0xd7d3('0x26')],'type':_0x1f83eb[_0xd7d3('0x27')]['key']};});_0x1f436e[_0xd7d3('0x28')]=_[_0xd7d3('0x29')](_[_0xd7d3('0x24')](_0x220814,_0xd7d3('0x23')),[_0xd7d3('0x2a')]);_0x1f436e['query']=_[_0xd7d3('0x2b')](_0x1186da[_0xd7d3('0x2c')]);_0x1f436e[_0xd7d3('0x2d')]=_[_0xd7d3('0x2e')](_0x1f436e[_0xd7d3('0x28')],_0x1f436e['query']);_0xedd102['attributes']=_[_0xd7d3('0x2e')](_0x1f436e[_0xd7d3('0x28')],qs[_0xd7d3('0x2f')](_0x1186da['query'][_0xd7d3('0x2f')]));_0xedd102[_0xd7d3('0x30')]=_0xedd102[_0xd7d3('0x30')][_0xd7d3('0x31')]?_0xedd102[_0xd7d3('0x30')]:_0x1f436e[_0xd7d3('0x28')];if(!_0x1186da[_0xd7d3('0x2c')][_0xd7d3('0x32')](_0xd7d3('0x33'))){_0xedd102[_0xd7d3('0x17')]=qs['limit'](_0x1186da['query']['limit']);_0xedd102[_0xd7d3('0x15')]=qs[_0xd7d3('0x15')](_0x1186da['query']['offset']);}_0xedd102[_0xd7d3('0x34')]=qs[_0xd7d3('0x35')](_0x1186da[_0xd7d3('0x2c')][_0xd7d3('0x35')]);_0xedd102['where']=qs[_0xd7d3('0x2d')](_[_0xd7d3('0x36')](_0x1186da['query'],_0x1f436e[_0xd7d3('0x2d')]),_0x220814);if(_0x1186da[_0xd7d3('0x2c')][_0xd7d3('0x37')]){_0xedd102[_0xd7d3('0x38')]=_[_0xd7d3('0x39')](_0xedd102['where'],{'$or':_[_0xd7d3('0x24')](_0x220814,function(_0x5e5745){if(_0x5e5745[_0xd7d3('0x27')]!==_0xd7d3('0x3a')){var _0x913964={};_0x913964[_0x5e5745[_0xd7d3('0x23')]]={'$like':'%'+_0x1186da[_0xd7d3('0x2c')][_0xd7d3('0x37')]+'%'};return _0x913964;}})});}_0xedd102=_[_0xd7d3('0x39')]({},_0xedd102,_0x1186da[_0xd7d3('0x3b')]);var _0x4eabea={'where':_0xedd102[_0xd7d3('0x38')]};return db[_0xd7d3('0x25')][_0xd7d3('0x18')](_0x4eabea)['then'](function(_0xaeff0c){_0x5236d4[_0xd7d3('0x18')]=_0xaeff0c;if(_0x1186da['query'][_0xd7d3('0x3c')]){_0xedd102['include']=[{'all':!![]}];}return db[_0xd7d3('0x25')][_0xd7d3('0x3d')](_0xedd102);})[_0xd7d3('0x20')](function(_0x3518b1){_0x5236d4['rows']=_0x3518b1;return _0x5236d4;})[_0xd7d3('0x20')](respondWithFilteredResult(_0x1a8f0b,_0xedd102))[_0xd7d3('0x3e')](handleError(_0x1a8f0b,null));};exports[_0xd7d3('0x3f')]=function(_0x2ba494,_0x2bbb15){var _0x6b3050={'raw':![],'where':{'id':_0x2ba494[_0xd7d3('0x40')]['id']}},_0x3017fb={};_0x3017fb[_0xd7d3('0x28')]=_[_0xd7d3('0x2b')](db['VoiceRecording']['rawAttributes']);_0x3017fb[_0xd7d3('0x2c')]=_['keys'](_0x2ba494[_0xd7d3('0x2c')]);_0x3017fb[_0xd7d3('0x2d')]=_[_0xd7d3('0x2e')](_0x3017fb['model'],_0x3017fb['query']);_0x6b3050['attributes']=_[_0xd7d3('0x2e')](_0x3017fb[_0xd7d3('0x28')],qs[_0xd7d3('0x2f')](_0x2ba494[_0xd7d3('0x2c')][_0xd7d3('0x2f')]));_0x6b3050[_0xd7d3('0x30')]=_0x6b3050[_0xd7d3('0x30')][_0xd7d3('0x31')]?_0x6b3050[_0xd7d3('0x30')]:_0x3017fb[_0xd7d3('0x28')];if(_0x2ba494[_0xd7d3('0x2c')][_0xd7d3('0x3c')]){_0x6b3050['include']=[{'all':!![]}];}_0x6b3050=_[_0xd7d3('0x39')]({},_0x6b3050,_0x2ba494[_0xd7d3('0x3b')]);return db[_0xd7d3('0x25')][_0xd7d3('0x41')](_0x6b3050)[_0xd7d3('0x20')](handleEntityNotFound(_0x2bbb15,null))[_0xd7d3('0x20')](respondWithResult(_0x2bbb15,null))[_0xd7d3('0x3e')](handleError(_0x2bbb15,null));};exports[_0xd7d3('0x42')]=function(_0x2b14a0,_0x4bb50b){return db[_0xd7d3('0x25')][_0xd7d3('0x42')](_0x2b14a0[_0xd7d3('0x43')],{})['then'](respondWithResult(_0x4bb50b,0xc9))['catch'](handleError(_0x4bb50b,null));};exports[_0xd7d3('0x44')]=function(_0x1a84d4,_0x232886){if(_0x1a84d4[_0xd7d3('0x43')]['id']){delete _0x1a84d4[_0xd7d3('0x43')]['id'];}return db['VoiceRecording'][_0xd7d3('0x41')]({'where':{'id':_0x1a84d4[_0xd7d3('0x40')]['id']}})[_0xd7d3('0x20')](handleEntityNotFound(_0x232886,null))[_0xd7d3('0x20')](saveUpdates(_0x1a84d4['body'],null))[_0xd7d3('0x20')](respondWithResult(_0x232886,null))['catch'](handleError(_0x232886,null));};exports['describe']=function(_0x448220,_0x158a0b){return db[_0xd7d3('0x25')]['describe']()[_0xd7d3('0x20')](respondWithResult(_0x158a0b,null))[_0xd7d3('0x3e')](handleError(_0x158a0b,null));};exports['download']=function(_0x1bcde3,_0xebc612,_0x96c211){var _0x28df5d=require('../../components/encryptor');var _0x413ba3=![];var _0x1034a2={};if(_0x1bcde3[_0xd7d3('0x2c')][_0xd7d3('0x27')]&&_0x1bcde3[_0xd7d3('0x2c')][_0xd7d3('0x27')]===_0xd7d3('0x45')){_0x1034a2[_0xd7d3('0x45')]=_0x1bcde3[_0xd7d3('0x40')]['id'];}else{_0x1034a2['id']=_0x1bcde3['params']['id'];}return db[_0xd7d3('0x25')][_0xd7d3('0x41')]({'where':_0x1034a2,'attributes':['id',_0xd7d3('0x46')],'raw':!![]})['then'](handleEntityNotFound(_0xebc612,null))['then'](function(_0x16cede){if(_0x16cede){var _0x3a2d94=_0x16cede[_0xd7d3('0x46')];var _0x18eb22=util[_0xd7d3('0x2a')](_0xd7d3('0x47'),_0x3a2d94);if(fs[_0xd7d3('0x48')](_0x18eb22)){_0x413ba3=!![];return _0x28df5d[_0xd7d3('0x49')](_0x18eb22,_0x3a2d94,config[_0xd7d3('0x4a')][_0xd7d3('0x4b')])[_0xd7d3('0x20')](function(){return _0x16cede;});}return _0x16cede;}})[_0xd7d3('0x20')](function(_0x5c8bc4){if(_0x5c8bc4){var _0x466331=_0x5c8bc4[_0xd7d3('0x46')];if(!fs[_0xd7d3('0x48')](_0x466331)){throw new db['Sequelize'][(_0xd7d3('0x4c'))]('VoiceRecording\x20not\x20found');}if(_0x5c8bc4['filename']){return _0xebc612[_0xd7d3('0x4d')](_0x466331,_0x5c8bc4[_0xd7d3('0x4e')]+path[_0xd7d3('0x4f')](_0x466331),function(){if(_0x413ba3){fs[_0xd7d3('0x50')](_0x466331);}});}else{return _0xebc612[_0xd7d3('0x4d')](_0x466331,function(_0x3952f8){if(_0x413ba3){fs[_0xd7d3('0x50')](_0x466331);}});}}})[_0xd7d3('0x3e')](function(_0x41a650){if(_0x41a650[_0xd7d3('0x51')]===_0xd7d3('0x52')){_0xebc612[_0xd7d3('0x19')](0x194)['send']('Not\x20found');}else{return handleError(_0xebc612,null);}});};exports[_0xd7d3('0x53')]=function(_0x5e83d6,_0xd0c1a6,_0x277fe0){var _0x2291f2=require('../../components/encryptor');var _0x5a33a6=![];var _0x34ba90={'$and':[db['sequelize'][_0xd7d3('0x38')](db[_0xd7d3('0x54')]['fn'](_0xd7d3('0x55'),db[_0xd7d3('0x54')]['col']('uniqueid')),_0x5e83d6[_0xd7d3('0x2c')]['token'])]};if(_0x5e83d6['query'][_0xd7d3('0x27')]&&_0x5e83d6[_0xd7d3('0x2c')][_0xd7d3('0x27')]==='uniqueid'){_0x34ba90['$and'][_0xd7d3('0x56')]({'uniqueid':_0x5e83d6[_0xd7d3('0x40')]['id']});}else{_0x34ba90['$and'][_0xd7d3('0x56')]({'id':_0x5e83d6['params']['id']});}return db[_0xd7d3('0x25')]['find']({'where':_0x34ba90,'attributes':['id','value'],'raw':!![]})[_0xd7d3('0x20')](handleEntityNotFound(_0xd0c1a6,null))[_0xd7d3('0x20')](function(_0x478099){if(_0x478099){var _0x2e9e28=util[_0xd7d3('0x2a')](_0xd7d3('0x47'),_0x478099[_0xd7d3('0x46')]);if(fs['existsSync'](_0x2e9e28)){_0x5a33a6=!![];return _0x2291f2['decryptFile'](_0x2e9e28,_0x478099[_0xd7d3('0x46')],config[_0xd7d3('0x4a')][_0xd7d3('0x4b')])[_0xd7d3('0x20')](function(){return _0x478099;});}return _0x478099;}})['then'](function(_0x471993){if(_0x471993){if(!fs['existsSync'](_0x471993[_0xd7d3('0x46')])){throw new db[(_0xd7d3('0x57'))][(_0xd7d3('0x4c'))](_0xd7d3('0x52'));}if(_0x471993[_0xd7d3('0x4e')]){return _0xd0c1a6[_0xd7d3('0x4d')](_0x471993[_0xd7d3('0x46')],_0x471993[_0xd7d3('0x4e')]+path['extname'](_0x471993[_0xd7d3('0x46')]),function(){if(_0x5a33a6){fs['unlink'](_0x471993[_0xd7d3('0x46')]);}});}else{return _0xd0c1a6['download'](_0x471993[_0xd7d3('0x46')],function(_0x2f15dc){if(_0x5a33a6){fs['unlink'](_0x471993[_0xd7d3('0x46')]);}});}}})['catch'](handleError(_0xd0c1a6,null));};exports['destroy']=function(_0x1b726a,_0xc4c2c4){return db['VoiceRecording'][_0xd7d3('0x41')]({'where':{'id':_0x1b726a[_0xd7d3('0x40')]['id']}})[_0xd7d3('0x20')](function(_0x33b3b5){if(_[_0xd7d3('0x58')](_0x33b3b5)){throw new ReferenceError(_0xd7d3('0x59'));}return _0x33b3b5;})['then'](function(_0x27546e){var _0x1493d6=_0x27546e['value'];logger[_0xd7d3('0x5a')](_0xd7d3('0x5b'),_0x1493d6);if(!_['isNil'](_0x27546e[_0xd7d3('0x46')])&&fs[_0xd7d3('0x48')](_0x1493d6)){logger[_0xd7d3('0x5a')](_0xd7d3('0x5c')+_0x1493d6+_0xd7d3('0x5d'));fs[_0xd7d3('0x5e')](_0x1493d6);}_0x1493d6=_0x1493d6+_0xd7d3('0x5f');if(!_[_0xd7d3('0x58')](_0x27546e[_0xd7d3('0x46')])&&fs['existsSync'](_0x1493d6)){logger[_0xd7d3('0x5a')](_0xd7d3('0x5c')+_0x1493d6+_0xd7d3('0x5d'));fs[_0xd7d3('0x5e')](_0x1493d6);}return _0x27546e;})[_0xd7d3('0x20')](function(_0x166009){if(!_0x166009)throw new InternalError();return _0x166009['destroy']();})[_0xd7d3('0x20')](function(){_0xc4c2c4[_0xd7d3('0x19')](0xcc)[_0xd7d3('0x14')]();})['catch'](handleError(_0xc4c2c4,null));};function getBucketslist(_0x53453e,_0x5d1710,_0x406fbd){return new Promise(function(_0x3a5aa5,_0xc8b517){var _0x454ed5=new AWS['S3']({'accessKeyId':_0x5d1710,'secretAccessKey':_0x53453e,'region':_0x406fbd});_0x454ed5[_0xd7d3('0x60')]({},function(_0x5947dc,_0x536af4){if(_0x5947dc){return _0xc8b517(_0x5947dc);}else{return _0x3a5aa5(_0x536af4);}});});}function createBucket(_0x3d51ed,_0x20a80d,_0x4dbe53,_0x5aad43){return new Promise(function(_0x25ddf1,_0x790fba){var _0x50245e=new AWS['S3']({'accessKeyId':_0x20a80d,'secretAccessKey':_0x3d51ed,'region':_0x4dbe53});_0x50245e['createBucket']({'Bucket':_0x5aad43},function(_0x55e354,_0x204d56){if(_0x55e354){return _0x790fba(_0x55e354);}else{return _0x25ddf1(_0x204d56);}});});}function uploadFile(_0x2e673e,_0x4796c7,_0x2ae42f,_0x9188c9,_0x486a55,_0x39c0f3){return new Promise(function(_0xfda2d6,_0x2f88de){var _0x57350b=new AWS['S3']({'accessKeyId':_0x4796c7,'secretAccessKey':_0x2e673e,'region':_0x2ae42f});_0x57350b['upload']({'Bucket':_0x9188c9,'Key':_0x486a55,'Body':_0x39c0f3},function(_0x1cc0c2,_0xa81b85){if(_0x1cc0c2){return _0x2f88de(_0x1cc0c2);}else{return _0xfda2d6(_0xa81b85);}});});}function startTranscribe(_0x285c07,_0x4d06a0,_0x274224,_0xcaee25,_0x3b9b3b,_0x4cd4db){return new Promise(function(_0x5b8d32,_0x3a7917){var _0x4be24d=new AWS[(_0xd7d3('0x61'))]({'accessKeyId':_0x4d06a0,'secretAccessKey':_0x285c07,'region':_0x274224});_0x4be24d[_0xd7d3('0x62')]({'TranscriptionJobName':_0xcaee25,'LanguageCode':_0x3b9b3b,'Media':{'MediaFileUri':_0x4cd4db}},function(_0x137acf,_0x3974bb){if(_0x137acf){return _0x3a7917(_0x137acf);}else{return _0x5b8d32(_0x3974bb);}});});}function transcribe(_0xbc7bce,_0x51281e,_0x4666a5,_0xc72199,_0x3609b1,_0x2c2842,_0x2b9b7c){return new Promise(function(_0x26badd,_0x2678b5){var _0x3f9a8f={};logger[_0xd7d3('0x5a')](util[_0xd7d3('0x2a')](_0xd7d3('0x63'),_0xbc7bce,_0x3609b1));return uploadFile(_0x51281e,_0x4666a5,_0xc72199,_0x3609b1,path[_0xd7d3('0x64')](_0x2c2842),fs[_0xd7d3('0x65')](_0x2c2842))[_0xd7d3('0x20')](function(_0x374475){logger[_0xd7d3('0x5a')](util[_0xd7d3('0x2a')](_0xd7d3('0x66'),_0xbc7bce,_0x3609b1,_0x374475[_0xd7d3('0x67')]));_0x3f9a8f[_0xd7d3('0x68')]=_0x374475[_0xd7d3('0x69')];_0x3f9a8f[_0xd7d3('0x6a')]=_0x374475[_0xd7d3('0x67')];logger[_0xd7d3('0x5a')](util[_0xd7d3('0x2a')]('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0xbc7bce));return startTranscribe(_0x51281e,_0x4666a5,_0xc72199,uuidv4(),_0x2b9b7c,_0x374475[_0xd7d3('0x67')]);})[_0xd7d3('0x20')](function(_0x484271){logger[_0xd7d3('0x5a')](util[_0xd7d3('0x2a')]('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0xbc7bce,_0x484271[_0xd7d3('0x6b')][_0xd7d3('0x6c')]));_0x3f9a8f[_0xd7d3('0x6d')]=_0x484271[_0xd7d3('0x6b')]['TranscriptionJobName'];_0x3f9a8f[_0xd7d3('0x6e')]=_0x484271['TranscriptionJob']['TranscriptionJobStatus'];return _0x26badd(_0x3f9a8f);})['catch'](function(_0x12af50){return _0x2678b5(_0x12af50);});});}exports[_0xd7d3('0x6f')]=function(_0xb94a7e,_0x3cd9fa,_0x18ab94){var _0x5bfcbd;var _0x3333ee;var _0x5ec750;var _0x53f224=require(_0xd7d3('0x70'));return db['VoiceRecording'][_0xd7d3('0x71')]({'where':{'id':_0xb94a7e[_0xd7d3('0x40')]['id']}})[_0xd7d3('0x20')](function(_0x420ea0){if(_0x420ea0){var _0x4fd4e7=util[_0xd7d3('0x2a')]('%s.cypher',_0x420ea0[_0xd7d3('0x46')]);if(fs[_0xd7d3('0x48')](_0x4fd4e7)){cypher=!![];return _0x53f224[_0xd7d3('0x49')](_0x4fd4e7,_0x420ea0['value'],config[_0xd7d3('0x4a')][_0xd7d3('0x4b')])[_0xd7d3('0x20')](function(){return _0x420ea0;});}return _0x420ea0;}})[_0xd7d3('0x20')](function(_0x5ec4dd){if(!_0x5ec4dd){throw new db[(_0xd7d3('0x57'))][(_0xd7d3('0x4c'))](_0xd7d3('0x72'));}_0x3333ee=_0x5ec4dd;return db[_0xd7d3('0x73')][_0xd7d3('0x71')]({'where':{'id':0x1}});})[_0xd7d3('0x20')](handleEntityNotFound(_0x3cd9fa,null))[_0xd7d3('0x20')](function(_0xf57add){if(_0xf57add){_0x5bfcbd=_0xf57add;if(!_0x5bfcbd[_0xd7d3('0x74')]||!_0x5bfcbd[_0xd7d3('0x75')]||!_0x5bfcbd[_0xd7d3('0x76')]||!_0x5bfcbd[_0xd7d3('0x77')]||!_0x5bfcbd['bucket']){throw new db[(_0xd7d3('0x57'))][(_0xd7d3('0x4c'))](_0xd7d3('0x78'));}if(_0xb94a7e[_0xd7d3('0x43')][_0xd7d3('0x79')]&&(!_0x5bfcbd['sentiment']||!_0x5bfcbd['sentimentAccountId']||!_0x5bfcbd[_0xd7d3('0x7a')]||!_0x5bfcbd[_0xd7d3('0x77')]||!_0x5bfcbd['bucket'])){throw new db[(_0xd7d3('0x57'))][(_0xd7d3('0x4c'))](_0xd7d3('0x7b'));}return db['CloudProvider']['findOne']({'where':{'id':_0x5bfcbd['transcribeAccountId']}});}})['then'](function(_0x535400){if(!_0x535400){throw new db[(_0xd7d3('0x57'))][(_0xd7d3('0x4c'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x535400[_0xd7d3('0x7c')]||!_0x535400[_0xd7d3('0x7d')]){throw new db['Sequelize']['ValidationError'](_0xd7d3('0x7e'));}_0x5ec750=_0x535400;return getBucketslist(_0x5ec750[_0xd7d3('0x7c')],_0x5ec750['data2'],_0x5bfcbd[_0xd7d3('0x76')]);})[_0xd7d3('0x20')](function(_0x547236){if(_0x547236&&_0x547236[_0xd7d3('0x7f')]){var _0x48390d=_[_0xd7d3('0x41')](_0x547236[_0xd7d3('0x7f')],function(_0x389fd6){return _0x389fd6[_0xd7d3('0x80')]===_0x5bfcbd[_0xd7d3('0x68')];});if(!_0x48390d){logger[_0xd7d3('0x5a')](util[_0xd7d3('0x2a')](_0xd7d3('0x81'),_0xb94a7e[_0xd7d3('0x40')]['id'],_0x5bfcbd[_0xd7d3('0x68')]));return createBucket(_0x5ec750[_0xd7d3('0x7c')],_0x5ec750['data2'],_0x5bfcbd['transcribeRegion'],_0x5bfcbd['bucket']);}logger[_0xd7d3('0x5a')](util[_0xd7d3('0x2a')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0xb94a7e[_0xd7d3('0x40')]['id'],_0x5bfcbd[_0xd7d3('0x68')]));return;}})[_0xd7d3('0x20')](function(_0x3da23a){if(_0x3333ee['transcribeStatus']===_0xd7d3('0x82')){return transcribe(_0xb94a7e[_0xd7d3('0x40')]['id'],_0x5ec750['data1'],_0x5ec750[_0xd7d3('0x7d')],_0x5bfcbd[_0xd7d3('0x76')],_0x5bfcbd[_0xd7d3('0x68')],_0x3333ee[_0xd7d3('0x46')],_0x5bfcbd[_0xd7d3('0x77')]);}else{logger[_0xd7d3('0x5a')](util[_0xd7d3('0x2a')](_0xd7d3('0x83'),_0xb94a7e['params']['id']));return{'transcribeStatus':_0xd7d3('0x84')};}})[_0xd7d3('0x20')](function(_0x16a338){if(_0x16a338){_0x16a338[_0xd7d3('0x85')]=_0xb94a7e[_0xd7d3('0x43')][_0xd7d3('0x79')];return _0x3333ee[_0xd7d3('0x86')](_0x16a338);}})[_0xd7d3('0x20')](respondWithResult(_0x3cd9fa,null))[_0xd7d3('0x3e')](handleError(_0x3cd9fa,null));};function writeFile(_0x25052d,_0x4d9698){return new Promise(function(_0x2001bd,_0x4dc01c){fs[_0xd7d3('0x87')](_0x4d9698,_0x25052d,function(_0x159dda,_0x3fa612){if(_0x159dda){return _0x4dc01c(_0x159dda);}else{return _0x2001bd(_0x3fa612);}});});}exports[_0xd7d3('0x88')]=function(_0x39f4c1,_0x23decb,_0x36480b){return db[_0xd7d3('0x25')][_0xd7d3('0x71')]({'where':{'id':_0x39f4c1['params']['id']}})[_0xd7d3('0x20')](handleEntityNotFound(_0x23decb))[_0xd7d3('0x20')](function(_0x3f1c87){if(_0x3f1c87&&_0x3f1c87[_0xd7d3('0x89')]){var _0x388baf=_0x3f1c87['fileText'];var _0x5d3ead=config[_0xd7d3('0x8a')]+'/server/files/transcribes/transcribe_'+_0x3f1c87['id']+_0xd7d3('0x8b');if(fs[_0xd7d3('0x48')](_0x5d3ead)){return _0x5d3ead;}return writeFile(_0x388baf,_0x5d3ead)[_0xd7d3('0x20')](function(){return _0x5d3ead;});}else{throw new db[(_0xd7d3('0x57'))][(_0xd7d3('0x4c'))](_0xd7d3('0x8c'));}})['then'](function(_0x5d5e2d){return _0x23decb[_0xd7d3('0x4d')](_0x5d5e2d);})[_0xd7d3('0x3e')](handleError(_0x23decb));}; \ No newline at end of file +var _0xe610=['sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','reject','update','then','destroy','name','send','index','VoiceRecording','rawAttributes','fieldName','type','key','model','differenceBy','map','format','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','find','catch','create','body','describe','download','uniqueid','value','%s.cypher','decryptFile','secrets','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','../../components/encryptor','sequelize','col','token','push','$and','existsSync','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','createBucket','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','runTranscribe','Voice\x20Recording\x20not\x20found','Setting','findOne','transcribe','transcribeAccountId','transcribeRegion','Transcribe\x20not\x20configured','sentiment','sentimentAccountId','CloudProvider','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','language','IN_PROGRESS','tempSentiment','runSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x423a70,_0x3cd1f4){var _0x2b2ad3=function(_0x37aad6){while(--_0x37aad6){_0x423a70['push'](_0x423a70['shift']());}};_0x2b2ad3(++_0x3cd1f4);}(_0xe610,0x113));var _0x0e61=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xe610[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require(_0x0e61('0x0'));var rimraf=require(_0x0e61('0x1'));var zipdir=require(_0x0e61('0x2'));var jsonpatch=require(_0x0e61('0x3'));var rp=require(_0x0e61('0x4'));var moment=require('moment');var BPromise=require(_0x0e61('0x5'));var Mustache=require(_0x0e61('0x6'));var util=require(_0x0e61('0x7'));var path=require(_0x0e61('0x8'));var sox=require('sox');var csv=require(_0x0e61('0x9'));var ejs=require(_0x0e61('0xa'));var fs=require('fs');var fs_extra=require(_0x0e61('0xb'));var _=require(_0x0e61('0xc'));var squel=require(_0x0e61('0xd'));var crypto=require(_0x0e61('0xe'));var jsforce=require(_0x0e61('0xf'));var deskjs=require(_0x0e61('0x10'));var toCsv=require(_0x0e61('0x9'));var querystring=require(_0x0e61('0x11'));var Papa=require('papaparse');var AWS=require(_0x0e61('0x12'));var uuidv4=require(_0x0e61('0x13'));var Redis=require(_0x0e61('0x14'));var authService=require(_0x0e61('0x15'));var qs=require(_0x0e61('0x16'));var as=require(_0x0e61('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0e61('0x18'))(_0x0e61('0x19'));var utils=require(_0x0e61('0x1a'));var config=require(_0x0e61('0x1b'));var licenseUtil=require(_0x0e61('0x1c'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xba6d4d,_0x320ff0){_0x320ff0=_0x320ff0||0xcc;return function(_0x4e8f82){if(_0x4e8f82){return _0xba6d4d[_0x0e61('0x1d')](_0x320ff0);}return _0xba6d4d['status'](_0x320ff0)[_0x0e61('0x1e')]();};}function respondWithResult(_0x46121b,_0x3043cc){_0x3043cc=_0x3043cc||0xc8;return function(_0x31bd73){if(_0x31bd73){return _0x46121b['status'](_0x3043cc)[_0x0e61('0x1f')](_0x31bd73);}};}function respondWithFilteredResult(_0x4dafb7,_0x2aab4c){return function(_0x5d6a9a){if(_0x5d6a9a){var _0x27e04d=typeof _0x2aab4c[_0x0e61('0x20')]===_0x0e61('0x21')&&typeof _0x2aab4c[_0x0e61('0x22')]==='undefined';var _0x3eb303=_0x5d6a9a[_0x0e61('0x23')];var _0x55b782=_0x27e04d?0x0:_0x2aab4c[_0x0e61('0x20')];var _0x58ce11=_0x27e04d?_0x5d6a9a['count']:_0x2aab4c[_0x0e61('0x20')]+_0x2aab4c[_0x0e61('0x22')];var _0xece841;if(_0x58ce11>=_0x3eb303){_0x58ce11=_0x3eb303;_0xece841=0xc8;}else{_0xece841=0xce;}_0x4dafb7[_0x0e61('0x24')](_0xece841);return _0x4dafb7[_0x0e61('0x25')](_0x0e61('0x26'),_0x55b782+'-'+_0x58ce11+'/'+_0x3eb303)[_0x0e61('0x1f')](_0x5d6a9a);}return null;};}function patchUpdates(_0xcb045e){return function(_0x418f37){try{jsonpatch['apply'](_0x418f37,_0xcb045e,!![]);}catch(_0x3e27b5){return BPromise[_0x0e61('0x27')](_0x3e27b5);}return _0x418f37['save']();};}function saveUpdates(_0x58bffa,_0x4fa867){return function(_0x5849fd){if(_0x5849fd){return _0x5849fd[_0x0e61('0x28')](_0x58bffa)[_0x0e61('0x29')](function(_0x395a3a){return _0x395a3a;});}return null;};}function removeEntity(_0x167621,_0x7992c3){return function(_0x1539b5){if(_0x1539b5){return _0x1539b5[_0x0e61('0x2a')]()['then'](function(){_0x167621[_0x0e61('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f486d,_0x4d78d6){return function(_0x2da677){if(!_0x2da677){_0x2f486d[_0x0e61('0x1d')](0x194);}return _0x2da677;};}function handleError(_0x29a473,_0x3ce5ee){_0x3ce5ee=_0x3ce5ee||0x1f4;return function(_0x54f014){logger['error'](_0x54f014['stack']);if(_0x54f014[_0x0e61('0x2b')]){delete _0x54f014[_0x0e61('0x2b')];}_0x29a473['status'](_0x3ce5ee)[_0x0e61('0x2c')](_0x54f014);};}exports[_0x0e61('0x2d')]=function(_0x691e63,_0x195d36){var _0x58358a={},_0x449dcc={},_0x191902={'count':0x0,'rows':[]};var _0x45b506=_['map'](db[_0x0e61('0x2e')][_0x0e61('0x2f')],function(_0x420aa1){return{'name':_0x420aa1[_0x0e61('0x30')],'type':_0x420aa1[_0x0e61('0x31')][_0x0e61('0x32')]};});_0x449dcc[_0x0e61('0x33')]=_[_0x0e61('0x34')](_[_0x0e61('0x35')](_0x45b506,'name'),[_0x0e61('0x36')]);_0x449dcc[_0x0e61('0x37')]=_[_0x0e61('0x38')](_0x691e63[_0x0e61('0x37')]);_0x449dcc[_0x0e61('0x39')]=_[_0x0e61('0x3a')](_0x449dcc[_0x0e61('0x33')],_0x449dcc[_0x0e61('0x37')]);_0x58358a[_0x0e61('0x3b')]=_['intersection'](_0x449dcc[_0x0e61('0x33')],qs['fields'](_0x691e63[_0x0e61('0x37')][_0x0e61('0x3c')]));_0x58358a[_0x0e61('0x3b')]=_0x58358a[_0x0e61('0x3b')]['length']?_0x58358a[_0x0e61('0x3b')]:_0x449dcc['model'];if(!_0x691e63['query']['hasOwnProperty'](_0x0e61('0x3d'))){_0x58358a[_0x0e61('0x22')]=qs[_0x0e61('0x22')](_0x691e63[_0x0e61('0x37')][_0x0e61('0x22')]);_0x58358a[_0x0e61('0x20')]=qs[_0x0e61('0x20')](_0x691e63[_0x0e61('0x37')][_0x0e61('0x20')]);}_0x58358a[_0x0e61('0x3e')]=qs[_0x0e61('0x3f')](_0x691e63[_0x0e61('0x37')][_0x0e61('0x3f')]);_0x58358a[_0x0e61('0x40')]=qs[_0x0e61('0x39')](_['pick'](_0x691e63[_0x0e61('0x37')],_0x449dcc[_0x0e61('0x39')]),_0x45b506);if(_0x691e63[_0x0e61('0x37')][_0x0e61('0x41')]){_0x58358a['where']=_[_0x0e61('0x42')](_0x58358a[_0x0e61('0x40')],{'$or':_[_0x0e61('0x35')](_0x45b506,function(_0x4219fe){if(_0x4219fe['type']!==_0x0e61('0x43')){var _0x3daad4={};_0x3daad4[_0x4219fe[_0x0e61('0x2b')]]={'$like':'%'+_0x691e63['query']['filter']+'%'};return _0x3daad4;}})});}_0x58358a=_['merge']({},_0x58358a,_0x691e63[_0x0e61('0x44')]);var _0x4851e1={'where':_0x58358a[_0x0e61('0x40')]};return db[_0x0e61('0x2e')][_0x0e61('0x23')](_0x4851e1)['then'](function(_0x549a78){_0x191902['count']=_0x549a78;if(_0x691e63[_0x0e61('0x37')][_0x0e61('0x45')]){_0x58358a[_0x0e61('0x46')]=[{'all':!![]}];}return db[_0x0e61('0x2e')][_0x0e61('0x47')](_0x58358a);})[_0x0e61('0x29')](function(_0x5d3df8){_0x191902[_0x0e61('0x48')]=_0x5d3df8;return _0x191902;})[_0x0e61('0x29')](respondWithFilteredResult(_0x195d36,_0x58358a))['catch'](handleError(_0x195d36,null));};exports['show']=function(_0x3f22bb,_0xbc0f35){var _0x4c39fd={'raw':![],'where':{'id':_0x3f22bb[_0x0e61('0x49')]['id']}},_0x519731={};_0x519731[_0x0e61('0x33')]=_['keys'](db[_0x0e61('0x2e')]['rawAttributes']);_0x519731[_0x0e61('0x37')]=_[_0x0e61('0x38')](_0x3f22bb[_0x0e61('0x37')]);_0x519731[_0x0e61('0x39')]=_[_0x0e61('0x3a')](_0x519731['model'],_0x519731[_0x0e61('0x37')]);_0x4c39fd[_0x0e61('0x3b')]=_[_0x0e61('0x3a')](_0x519731[_0x0e61('0x33')],qs['fields'](_0x3f22bb['query']['fields']));_0x4c39fd[_0x0e61('0x3b')]=_0x4c39fd[_0x0e61('0x3b')]['length']?_0x4c39fd[_0x0e61('0x3b')]:_0x519731[_0x0e61('0x33')];if(_0x3f22bb[_0x0e61('0x37')][_0x0e61('0x45')]){_0x4c39fd[_0x0e61('0x46')]=[{'all':!![]}];}_0x4c39fd=_[_0x0e61('0x42')]({},_0x4c39fd,_0x3f22bb[_0x0e61('0x44')]);return db[_0x0e61('0x2e')][_0x0e61('0x4a')](_0x4c39fd)['then'](handleEntityNotFound(_0xbc0f35,null))[_0x0e61('0x29')](respondWithResult(_0xbc0f35,null))[_0x0e61('0x4b')](handleError(_0xbc0f35,null));};exports[_0x0e61('0x4c')]=function(_0x2dc42b,_0x14e0d5){return db[_0x0e61('0x2e')][_0x0e61('0x4c')](_0x2dc42b[_0x0e61('0x4d')],{})[_0x0e61('0x29')](respondWithResult(_0x14e0d5,0xc9))[_0x0e61('0x4b')](handleError(_0x14e0d5,null));};exports[_0x0e61('0x28')]=function(_0x3ed7e1,_0x1e565d){if(_0x3ed7e1[_0x0e61('0x4d')]['id']){delete _0x3ed7e1[_0x0e61('0x4d')]['id'];}return db[_0x0e61('0x2e')]['find']({'where':{'id':_0x3ed7e1['params']['id']}})[_0x0e61('0x29')](handleEntityNotFound(_0x1e565d,null))[_0x0e61('0x29')](saveUpdates(_0x3ed7e1[_0x0e61('0x4d')],null))[_0x0e61('0x29')](respondWithResult(_0x1e565d,null))[_0x0e61('0x4b')](handleError(_0x1e565d,null));};exports[_0x0e61('0x4e')]=function(_0x1cba73,_0x437073){return db['VoiceRecording']['describe']()[_0x0e61('0x29')](respondWithResult(_0x437073,null))[_0x0e61('0x4b')](handleError(_0x437073,null));};exports[_0x0e61('0x4f')]=function(_0x1875aa,_0x3e4516,_0x422bbe){var _0x5b05dd=require('../../components/encryptor');var _0x574974=![];var _0xcc3427={};if(_0x1875aa['query'][_0x0e61('0x31')]&&_0x1875aa[_0x0e61('0x37')]['type']===_0x0e61('0x50')){_0xcc3427[_0x0e61('0x50')]=_0x1875aa['params']['id'];}else{_0xcc3427['id']=_0x1875aa[_0x0e61('0x49')]['id'];}return db[_0x0e61('0x2e')]['find']({'where':_0xcc3427,'attributes':['id','value'],'raw':!![]})['then'](handleEntityNotFound(_0x3e4516,null))['then'](function(_0x3f678e){if(_0x3f678e){var _0x1ee2c3=_0x3f678e[_0x0e61('0x51')];var _0x1ff7a1=util[_0x0e61('0x36')](_0x0e61('0x52'),_0x1ee2c3);if(fs['existsSync'](_0x1ff7a1)){_0x574974=!![];return _0x5b05dd[_0x0e61('0x53')](_0x1ff7a1,_0x1ee2c3,config[_0x0e61('0x54')][_0x0e61('0x55')])[_0x0e61('0x29')](function(){return _0x3f678e;});}return _0x3f678e;}})['then'](function(_0x1c49dd){if(_0x1c49dd){var _0x4a9819=_0x1c49dd[_0x0e61('0x51')];if(!fs['existsSync'](_0x4a9819)){throw new db[(_0x0e61('0x56'))][(_0x0e61('0x57'))](_0x0e61('0x58'));}if(_0x1c49dd[_0x0e61('0x59')]){return _0x3e4516['download'](_0x4a9819,_0x1c49dd[_0x0e61('0x59')]+path[_0x0e61('0x5a')](_0x4a9819),function(){if(_0x574974){fs[_0x0e61('0x5b')](_0x4a9819);}});}else{return _0x3e4516[_0x0e61('0x4f')](_0x4a9819,function(_0x1c7650){if(_0x574974){fs['unlink'](_0x4a9819);}});}}})[_0x0e61('0x4b')](function(_0x39c81c){if(_0x39c81c[_0x0e61('0x5c')]==='VoiceRecording\x20not\x20found'){_0x3e4516[_0x0e61('0x24')](0x194)['send']('Not\x20found');}else{return handleError(_0x3e4516,null);}});};exports['downloads']=function(_0x3912c2,_0x253bc9,_0x2a00ad){var _0x2dd6e0=require(_0x0e61('0x5d'));var _0x15b41f=![];var _0x357aa7={'$and':[db[_0x0e61('0x5e')][_0x0e61('0x40')](db[_0x0e61('0x5e')]['fn']('MD5',db[_0x0e61('0x5e')][_0x0e61('0x5f')](_0x0e61('0x50'))),_0x3912c2[_0x0e61('0x37')][_0x0e61('0x60')])]};if(_0x3912c2['query'][_0x0e61('0x31')]&&_0x3912c2[_0x0e61('0x37')][_0x0e61('0x31')]===_0x0e61('0x50')){_0x357aa7['$and'][_0x0e61('0x61')]({'uniqueid':_0x3912c2['params']['id']});}else{_0x357aa7[_0x0e61('0x62')]['push']({'id':_0x3912c2['params']['id']});}return db['VoiceRecording'][_0x0e61('0x4a')]({'where':_0x357aa7,'attributes':['id',_0x0e61('0x51')],'raw':!![]})[_0x0e61('0x29')](handleEntityNotFound(_0x253bc9,null))[_0x0e61('0x29')](function(_0x281c12){if(_0x281c12){var _0x5d8627=util['format'](_0x0e61('0x52'),_0x281c12['value']);if(fs[_0x0e61('0x63')](_0x5d8627)){_0x15b41f=!![];return _0x2dd6e0['decryptFile'](_0x5d8627,_0x281c12[_0x0e61('0x51')],config[_0x0e61('0x54')][_0x0e61('0x55')])[_0x0e61('0x29')](function(){return _0x281c12;});}return _0x281c12;}})[_0x0e61('0x29')](function(_0x2ed680){if(_0x2ed680){if(!fs['existsSync'](_0x2ed680[_0x0e61('0x51')])){throw new db[(_0x0e61('0x56'))][(_0x0e61('0x57'))](_0x0e61('0x58'));}if(_0x2ed680['filename']){return _0x253bc9[_0x0e61('0x4f')](_0x2ed680[_0x0e61('0x51')],_0x2ed680[_0x0e61('0x59')]+path[_0x0e61('0x5a')](_0x2ed680[_0x0e61('0x51')]),function(){if(_0x15b41f){fs[_0x0e61('0x5b')](_0x2ed680[_0x0e61('0x51')]);}});}else{return _0x253bc9['download'](_0x2ed680[_0x0e61('0x51')],function(_0x23a08f){if(_0x15b41f){fs[_0x0e61('0x5b')](_0x2ed680['value']);}});}}})[_0x0e61('0x4b')](handleError(_0x253bc9,null));};exports['destroy']=function(_0x423036,_0x3fc66b){return db[_0x0e61('0x2e')][_0x0e61('0x4a')]({'where':{'id':_0x423036[_0x0e61('0x49')]['id']}})[_0x0e61('0x29')](function(_0x294646){if(_[_0x0e61('0x64')](_0x294646)){throw new ReferenceError(_0x0e61('0x65'));}return _0x294646;})['then'](function(_0x131766){var _0x2d2a86=_0x131766[_0x0e61('0x51')];logger[_0x0e61('0x66')](_0x0e61('0x67'),_0x2d2a86);if(!_[_0x0e61('0x64')](_0x131766[_0x0e61('0x51')])&&fs['existsSync'](_0x2d2a86)){logger[_0x0e61('0x66')](_0x0e61('0x68')+_0x2d2a86+_0x0e61('0x69'));fs[_0x0e61('0x6a')](_0x2d2a86);}_0x2d2a86=_0x2d2a86+'.cypher';if(!_[_0x0e61('0x64')](_0x131766['value'])&&fs[_0x0e61('0x63')](_0x2d2a86)){logger['info'](_0x0e61('0x68')+_0x2d2a86+_0x0e61('0x69'));fs[_0x0e61('0x6a')](_0x2d2a86);}return _0x131766;})[_0x0e61('0x29')](function(_0x14cbe7){if(!_0x14cbe7)throw new InternalError();return _0x14cbe7[_0x0e61('0x2a')]();})[_0x0e61('0x29')](function(){_0x3fc66b[_0x0e61('0x24')](0xcc)[_0x0e61('0x1e')]();})[_0x0e61('0x4b')](handleError(_0x3fc66b,null));};function getBucketslist(_0x972bcf,_0x2eaf33,_0x260268){return new Promise(function(_0x55528c,_0x365aac){var _0x2eaecb=new AWS['S3']({'accessKeyId':_0x2eaf33,'secretAccessKey':_0x972bcf,'region':_0x260268});_0x2eaecb['listBuckets']({},function(_0x31c527,_0x1d8d76){if(_0x31c527){return _0x365aac(_0x31c527);}else{return _0x55528c(_0x1d8d76);}});});}function createBucket(_0x20efce,_0x16cff2,_0x3c1416,_0x3c6951){return new Promise(function(_0x344283,_0x472ee1){var _0x29dcb4=new AWS['S3']({'accessKeyId':_0x16cff2,'secretAccessKey':_0x20efce,'region':_0x3c1416});_0x29dcb4[_0x0e61('0x6b')]({'Bucket':_0x3c6951},function(_0x6a10e2,_0x52419c){if(_0x6a10e2){return _0x472ee1(_0x6a10e2);}else{return _0x344283(_0x52419c);}});});}function uploadFile(_0x22917f,_0x5cdd4f,_0x3ebe6c,_0x3ab48a,_0x12a7f7,_0x298a08){return new Promise(function(_0x3d3a5a,_0x5f35cf){var _0x1f421e=new AWS['S3']({'accessKeyId':_0x5cdd4f,'secretAccessKey':_0x22917f,'region':_0x3ebe6c});_0x1f421e['upload']({'Bucket':_0x3ab48a,'Key':_0x12a7f7,'Body':_0x298a08},function(_0x4cc4c3,_0x320e9b){if(_0x4cc4c3){return _0x5f35cf(_0x4cc4c3);}else{return _0x3d3a5a(_0x320e9b);}});});}function startTranscribe(_0xea367f,_0x18ecd8,_0x57e5b8,_0x41e112,_0x1d14d3,_0x37411a){return new Promise(function(_0x5d65a4,_0x282c2c){var _0x5ac7fe=new AWS[(_0x0e61('0x6c'))]({'accessKeyId':_0x18ecd8,'secretAccessKey':_0xea367f,'region':_0x57e5b8});_0x5ac7fe[_0x0e61('0x6d')]({'TranscriptionJobName':_0x41e112,'LanguageCode':_0x1d14d3,'Media':{'MediaFileUri':_0x37411a}},function(_0x38f004,_0x59abe6){if(_0x38f004){return _0x282c2c(_0x38f004);}else{return _0x5d65a4(_0x59abe6);}});});}function transcribe(_0x317ca8,_0x3d01e5,_0xe75564,_0x1ea82e,_0x33204a,_0x361e47,_0x353d6a){return new Promise(function(_0x28898f,_0x57fbe5){var _0x2e19fb={};logger[_0x0e61('0x66')](util[_0x0e61('0x36')](_0x0e61('0x6e'),_0x317ca8,_0x33204a));return uploadFile(_0x3d01e5,_0xe75564,_0x1ea82e,_0x33204a,path['basename'](_0x361e47),fs[_0x0e61('0x6f')](_0x361e47))[_0x0e61('0x29')](function(_0x19a9a8){logger[_0x0e61('0x66')](util['format'](_0x0e61('0x70'),_0x317ca8,_0x33204a,_0x19a9a8[_0x0e61('0x71')]));_0x2e19fb[_0x0e61('0x72')]=_0x19a9a8[_0x0e61('0x73')];_0x2e19fb['location']=_0x19a9a8[_0x0e61('0x71')];logger[_0x0e61('0x66')](util[_0x0e61('0x36')]('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x317ca8));return startTranscribe(_0x3d01e5,_0xe75564,_0x1ea82e,uuidv4(),_0x353d6a,_0x19a9a8['Location']);})[_0x0e61('0x29')](function(_0x4bfdcc){logger[_0x0e61('0x66')](util[_0x0e61('0x36')](_0x0e61('0x74'),_0x317ca8,_0x4bfdcc[_0x0e61('0x75')][_0x0e61('0x76')]));_0x2e19fb[_0x0e61('0x77')]=_0x4bfdcc[_0x0e61('0x75')][_0x0e61('0x76')];_0x2e19fb[_0x0e61('0x78')]=_0x4bfdcc['TranscriptionJob'][_0x0e61('0x79')];return _0x28898f(_0x2e19fb);})['catch'](function(_0x336816){return _0x57fbe5(_0x336816);});});}exports[_0x0e61('0x7a')]=function(_0x302e59,_0x2161be,_0x1323a8){var _0x765fa9;var _0x122e8d;var _0x18f4f4;var _0x46ad99=require(_0x0e61('0x5d'));return db[_0x0e61('0x2e')]['findOne']({'where':{'id':_0x302e59['params']['id']}})['then'](function(_0x55f881){if(_0x55f881){var _0x214e4b=util[_0x0e61('0x36')](_0x0e61('0x52'),_0x55f881[_0x0e61('0x51')]);if(fs[_0x0e61('0x63')](_0x214e4b)){cypher=!![];return _0x46ad99[_0x0e61('0x53')](_0x214e4b,_0x55f881[_0x0e61('0x51')],config['secrets'][_0x0e61('0x55')])[_0x0e61('0x29')](function(){return _0x55f881;});}return _0x55f881;}})[_0x0e61('0x29')](function(_0x4af894){if(!_0x4af894){throw new db[(_0x0e61('0x56'))][(_0x0e61('0x57'))](_0x0e61('0x7b'));}_0x122e8d=_0x4af894;return db[_0x0e61('0x7c')][_0x0e61('0x7d')]({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x2161be,null))[_0x0e61('0x29')](function(_0xfe491a){if(_0xfe491a){_0x765fa9=_0xfe491a;if(!_0x765fa9[_0x0e61('0x7e')]||!_0x765fa9[_0x0e61('0x7f')]||!_0x765fa9[_0x0e61('0x80')]||!_0x765fa9['language']||!_0x765fa9[_0x0e61('0x72')]){throw new db[(_0x0e61('0x56'))]['ValidationError'](_0x0e61('0x81'));}if(_0x302e59[_0x0e61('0x4d')]['runSentiment']&&(!_0x765fa9[_0x0e61('0x82')]||!_0x765fa9[_0x0e61('0x83')]||!_0x765fa9['sentimentRegion']||!_0x765fa9['language']||!_0x765fa9[_0x0e61('0x72')])){throw new db[(_0x0e61('0x56'))][(_0x0e61('0x57'))]('Sentiment\x20Analysis\x20not\x20configured');}return db[_0x0e61('0x84')][_0x0e61('0x7d')]({'where':{'id':_0x765fa9[_0x0e61('0x7f')]}});}})[_0x0e61('0x29')](function(_0x5b1f41){if(!_0x5b1f41){throw new db[(_0x0e61('0x56'))][(_0x0e61('0x57'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x5b1f41[_0x0e61('0x85')]||!_0x5b1f41[_0x0e61('0x86')]){throw new db[(_0x0e61('0x56'))][(_0x0e61('0x57'))](_0x0e61('0x87'));}_0x18f4f4=_0x5b1f41;return getBucketslist(_0x18f4f4[_0x0e61('0x85')],_0x18f4f4[_0x0e61('0x86')],_0x765fa9['transcribeRegion']);})['then'](function(_0x55f8e0){if(_0x55f8e0&&_0x55f8e0[_0x0e61('0x88')]){var _0x2787cd=_[_0x0e61('0x4a')](_0x55f8e0[_0x0e61('0x88')],function(_0xf42cd3){return _0xf42cd3['Name']===_0x765fa9['bucket'];});if(!_0x2787cd){logger[_0x0e61('0x66')](util[_0x0e61('0x36')](_0x0e61('0x89'),_0x302e59[_0x0e61('0x49')]['id'],_0x765fa9[_0x0e61('0x72')]));return createBucket(_0x18f4f4[_0x0e61('0x85')],_0x18f4f4[_0x0e61('0x86')],_0x765fa9[_0x0e61('0x80')],_0x765fa9['bucket']);}logger[_0x0e61('0x66')](util[_0x0e61('0x36')](_0x0e61('0x8a'),_0x302e59[_0x0e61('0x49')]['id'],_0x765fa9['bucket']));return;}})[_0x0e61('0x29')](function(_0x97f3a5){if(_0x122e8d[_0x0e61('0x78')]===_0x0e61('0x8b')){return transcribe(_0x302e59['params']['id'],_0x18f4f4[_0x0e61('0x85')],_0x18f4f4[_0x0e61('0x86')],_0x765fa9[_0x0e61('0x80')],_0x765fa9[_0x0e61('0x72')],_0x122e8d['value'],_0x765fa9[_0x0e61('0x8c')]);}else{logger['info'](util[_0x0e61('0x36')]('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x302e59['params']['id']));return{'transcribeStatus':_0x0e61('0x8d')};}})[_0x0e61('0x29')](function(_0x4e8914){if(_0x4e8914){_0x4e8914[_0x0e61('0x8e')]=_0x302e59['body'][_0x0e61('0x8f')];return _0x122e8d[_0x0e61('0x90')](_0x4e8914);}})[_0x0e61('0x29')](respondWithResult(_0x2161be,null))['catch'](handleError(_0x2161be,null));};function writeFile(_0x468835,_0x4e3b8f){return new Promise(function(_0x6fcfc1,_0x302705){fs[_0x0e61('0x91')](_0x4e3b8f,_0x468835,function(_0x349847,_0x157d05){if(_0x349847){return _0x302705(_0x349847);}else{return _0x6fcfc1(_0x157d05);}});});}exports[_0x0e61('0x92')]=function(_0x2a7577,_0x583108,_0x235726){return db[_0x0e61('0x2e')][_0x0e61('0x7d')]({'where':{'id':_0x2a7577['params']['id']}})[_0x0e61('0x29')](handleEntityNotFound(_0x583108))[_0x0e61('0x29')](function(_0x5493bc){if(_0x5493bc&&_0x5493bc['fileText']){var _0x2b9dbf=_0x5493bc[_0x0e61('0x93')];var _0x548bdd=config[_0x0e61('0x94')]+_0x0e61('0x95')+_0x5493bc['id']+_0x0e61('0x96');if(fs[_0x0e61('0x63')](_0x548bdd)){return _0x548bdd;}return writeFile(_0x2b9dbf,_0x548bdd)[_0x0e61('0x29')](function(){return _0x548bdd;});}else{throw new db[(_0x0e61('0x56'))][(_0x0e61('0x57'))](_0x0e61('0x97'));}})[_0x0e61('0x29')](function(_0xc3075e){return _0x583108[_0x0e61('0x4f')](_0xc3075e);})[_0x0e61('0x4b')](handleError(_0x583108));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 711c4a0..c9aa28c 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 _0xe56e=['rimraf','../../config/environment','./voiceRecording.attributes','exports','define','VoiceRecording','voice_recordings','uniqueid','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x4e7d91,_0x4d71df){var _0x2a2972=function(_0x1d450a){while(--_0x1d450a){_0x4e7d91['push'](_0x4e7d91['shift']());}};_0x2a2972(++_0x4d71df);}(_0xe56e,0xd8));var _0xee56=function(_0x34ebf7,_0x5578d0){_0x34ebf7=_0x34ebf7-0x0;var _0x2b2633=_0xe56e[_0x34ebf7];return _0x2b2633;};'use strict';var _=require(_0xee56('0x0'));var util=require('util');var logger=require(_0xee56('0x1'))('api');var moment=require(_0xee56('0x2'));var BPromise=require(_0xee56('0x3'));var rp=require(_0xee56('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xee56('0x5'));var config=require(_0xee56('0x6'));var attributes=require(_0xee56('0x7'));module[_0xee56('0x8')]=function(_0x42d373,_0x59712f){return _0x42d373[_0xee56('0x9')](_0xee56('0xa'),attributes,{'tableName':_0xee56('0xb'),'paranoid':![],'indexes':[{'name':_0xee56('0xc'),'fields':[_0xee56('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6967=['moment','bluebird','path','rimraf','./voiceRecording.attributes','exports','define','VoiceRecording','uniqueid','lodash','util','api'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x6967,0x99));var _0x7696=function(_0x4a2c39,_0x4e56e7){_0x4a2c39=_0x4a2c39-0x0;var _0x2a62f1=_0x6967[_0x4a2c39];return _0x2a62f1;};'use strict';var _=require(_0x7696('0x0'));var util=require(_0x7696('0x1'));var logger=require('../../config/logger')(_0x7696('0x2'));var moment=require(_0x7696('0x3'));var BPromise=require(_0x7696('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7696('0x5'));var rimraf=require(_0x7696('0x6'));var config=require('../../config/environment');var attributes=require(_0x7696('0x7'));module[_0x7696('0x8')]=function(_0x1dff87,_0x256b5d){return _0x1dff87[_0x7696('0x9')](_0x7696('0xa'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0x7696('0xb'),'fields':[_0x7696('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index fdf803e..64515d5 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 _0x1a85=['existsSync','value','format','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','http','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateVoiceRecording','VoiceRecording','body','options','raw','where','attributes','limit','then','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','create'];(function(_0x265657,_0x311646){var _0x11bd12=function(_0x31920f){while(--_0x31920f){_0x265657['push'](_0x265657['shift']());}};_0x11bd12(++_0x311646);}(_0x1a85,0x178));var _0x51a8=function(_0x571a36,_0x5936f2){_0x571a36=_0x571a36-0x0;var _0x4dd68e=_0x1a85[_0x571a36];return _0x4dd68e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x51a8('0x0'));var BPromise=require(_0x51a8('0x1'));var rs=require(_0x51a8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x51a8('0x3'));var logger=require(_0x51a8('0x4'))(_0x51a8('0x5'));var config=require('../../config/environment');var jayson=require(_0x51a8('0x6'));var client=jayson['client'][_0x51a8('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5cf430,_0x331117,_0x16a21e){return new BPromise(function(_0x4f3919,_0x228c64){return client['request'](_0x5cf430,_0x16a21e)['then'](function(_0x39e06a){logger[_0x51a8('0x8')](_0x51a8('0x9'),_0x331117,_0x51a8('0xa'));logger[_0x51a8('0xb')](_0x51a8('0xc'),_0x331117,_0x51a8('0xa'),JSON[_0x51a8('0xd')](_0x39e06a));if(_0x39e06a[_0x51a8('0xe')]){if(_0x39e06a[_0x51a8('0xe')][_0x51a8('0xf')]===0x1f4){logger[_0x51a8('0xe')](_0x51a8('0x9'),_0x331117,_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);return _0x228c64(_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);}logger['error'](_0x51a8('0x9'),_0x331117,_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);return _0x4f3919(_0x39e06a['error'][_0x51a8('0x10')]);}else{logger['info'](_0x51a8('0x9'),_0x331117,_0x51a8('0xa'));_0x4f3919(_0x39e06a[_0x51a8('0x11')][_0x51a8('0x10')]);}})[_0x51a8('0x12')](function(_0x3e0603){logger[_0x51a8('0xe')]('VoiceRecording,\x20%s,\x20%s',_0x331117,_0x3e0603);_0x228c64(_0x3e0603);});});}exports[_0x51a8('0x13')]=function(_0x45a433){var _0xd52230=this;return new Promise(function(_0x23539e,_0x3bc1a2){return db[_0x51a8('0x14')]['update'](_0x45a433[_0x51a8('0x15')],{'raw':_0x45a433[_0x51a8('0x16')]?_0x45a433[_0x51a8('0x16')][_0x51a8('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x45a433[_0x51a8('0x16')]?_0x45a433[_0x51a8('0x16')][_0x51a8('0x18')]||null:null,'attributes':_0x45a433[_0x51a8('0x16')]?_0x45a433['options'][_0x51a8('0x19')]||null:null,'limit':_0x45a433['options']?_0x45a433[_0x51a8('0x16')][_0x51a8('0x1a')]||null:null})[_0x51a8('0x1b')](function(_0x3759d6){logger['info'](_0x51a8('0x13'),_0x45a433);logger['debug']('UpdateVoiceRecording',_0x45a433,JSON[_0x51a8('0xd')](_0x3759d6));_0x23539e(_0x3759d6);})['catch'](function(_0x384d25){logger[_0x51a8('0xe')](_0x51a8('0x13'),_0x384d25[_0x51a8('0x10')],_0x45a433);_0x3bc1a2(_0xd52230[_0x51a8('0xe')](0x1f4,_0x384d25[_0x51a8('0x10')]));});});};exports[_0x51a8('0x1c')]=function(_0x1326a2){var _0x5b3f49=this;return new Promise(function(_0x273ce2,_0x1b7577){var _0xca5746=require(_0x51a8('0x1d'));var _0x1c150d;return db[_0x51a8('0x1e')][_0x51a8('0x1f')]({'attributes':['id',_0x51a8('0x20')],'where':{'id':0x1},'raw':!![]})[_0x51a8('0x1b')](function(_0x4b5cda){_0x1c150d=_0x4b5cda;return db[_0x51a8('0x14')][_0x51a8('0x21')](_0x1326a2['body']);})[_0x51a8('0x1b')](function(_0x58cba0){if(_0x1c150d[_0x51a8('0x20')]&&fs[_0x51a8('0x22')](_0x58cba0[_0x51a8('0x23')])){var _0x41df56=util[_0x51a8('0x24')]('%s.cypher',_0x58cba0[_0x51a8('0x23')]);return _0xca5746['encryptFile'](_0x58cba0[_0x51a8('0x23')],_0x41df56,config[_0x51a8('0x25')][_0x51a8('0x26')])['then'](function(){fs[_0x51a8('0x27')](_0x58cba0['value']);logger[_0x51a8('0x8')](_0x51a8('0x28'));return _0x58cba0;});}return _0x58cba0;})[_0x51a8('0x1b')](function(_0x224099){logger[_0x51a8('0x8')]('CreateVoiceRecording',_0x1326a2);logger[_0x51a8('0xb')]('CreateVoiceRecording',_0x1326a2,JSON[_0x51a8('0xd')](_0x224099));_0x273ce2(_0x224099);})[_0x51a8('0x12')](function(_0x41561a){logger['error'](_0x51a8('0x1c'),_0x41561a[_0x51a8('0x10')],_0x1326a2);_0x1b7577(_0x5b3f49[_0x51a8('0xe')](0x1f4,_0x41561a[_0x51a8('0x10')]));});});}; \ No newline at end of file +var _0xd943=['info','request\x20sent','VoiceRecording,\x20%s,\x20%s,\x20%s','error','code','VoiceRecording,\x20%s,\x20%s','message','result','catch','UpdateVoiceRecording','VoiceRecording','body','options','raw','where','attributes','debug','stringify','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','existsSync','value','format','secrets','recording','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','then'];(function(_0x567fff,_0xd8acd8){var _0x465a37=function(_0x9d7bf7){while(--_0x9d7bf7){_0x567fff['push'](_0x567fff['shift']());}};_0x465a37(++_0xd8acd8);}(_0xd943,0x15d));var _0x3d94=function(_0x49527a,_0x5a05e7){_0x49527a=_0x49527a-0x0;var _0x53dbac=_0xd943[_0x49527a];return _0x53dbac;};'use strict';var _=require(_0x3d94('0x0'));var util=require(_0x3d94('0x1'));var moment=require(_0x3d94('0x2'));var BPromise=require(_0x3d94('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3d94('0x4'));var db=require(_0x3d94('0x5'))['db'];var utils=require(_0x3d94('0x6'));var logger=require(_0x3d94('0x7'))(_0x3d94('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3d94('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54e81f,_0x4d29e7,_0x20f4d1){return new BPromise(function(_0x35d36a,_0x5244c3){return client['request'](_0x54e81f,_0x20f4d1)[_0x3d94('0xa')](function(_0x27e381){logger[_0x3d94('0xb')]('VoiceRecording,\x20%s,\x20%s',_0x4d29e7,_0x3d94('0xc'));logger['debug'](_0x3d94('0xd'),_0x4d29e7,_0x3d94('0xc'),JSON['stringify'](_0x27e381));if(_0x27e381[_0x3d94('0xe')]){if(_0x27e381[_0x3d94('0xe')][_0x3d94('0xf')]===0x1f4){logger[_0x3d94('0xe')](_0x3d94('0x10'),_0x4d29e7,_0x27e381['error'][_0x3d94('0x11')]);return _0x5244c3(_0x27e381[_0x3d94('0xe')][_0x3d94('0x11')]);}logger['error'](_0x3d94('0x10'),_0x4d29e7,_0x27e381[_0x3d94('0xe')][_0x3d94('0x11')]);return _0x35d36a(_0x27e381['error'][_0x3d94('0x11')]);}else{logger[_0x3d94('0xb')](_0x3d94('0x10'),_0x4d29e7,_0x3d94('0xc'));_0x35d36a(_0x27e381[_0x3d94('0x12')][_0x3d94('0x11')]);}})[_0x3d94('0x13')](function(_0x9893cb){logger['error'](_0x3d94('0x10'),_0x4d29e7,_0x9893cb);_0x5244c3(_0x9893cb);});});}exports[_0x3d94('0x14')]=function(_0x2acee3){var _0x1c35a8=this;return new Promise(function(_0x4afc92,_0x3ca0e3){return db[_0x3d94('0x15')]['update'](_0x2acee3[_0x3d94('0x16')],{'raw':_0x2acee3['options']?_0x2acee3[_0x3d94('0x17')][_0x3d94('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2acee3[_0x3d94('0x17')]?_0x2acee3[_0x3d94('0x17')][_0x3d94('0x19')]||null:null,'attributes':_0x2acee3['options']?_0x2acee3['options'][_0x3d94('0x1a')]||null:null,'limit':_0x2acee3[_0x3d94('0x17')]?_0x2acee3[_0x3d94('0x17')]['limit']||null:null})[_0x3d94('0xa')](function(_0x2e8c91){logger[_0x3d94('0xb')](_0x3d94('0x14'),_0x2acee3);logger[_0x3d94('0x1b')](_0x3d94('0x14'),_0x2acee3,JSON[_0x3d94('0x1c')](_0x2e8c91));_0x4afc92(_0x2e8c91);})[_0x3d94('0x13')](function(_0xee7b8d){logger[_0x3d94('0xe')](_0x3d94('0x14'),_0xee7b8d[_0x3d94('0x11')],_0x2acee3);_0x3ca0e3(_0x1c35a8[_0x3d94('0xe')](0x1f4,_0xee7b8d[_0x3d94('0x11')]));});});};exports[_0x3d94('0x1d')]=function(_0x5b3b31){var _0x123183=this;return new Promise(function(_0x558fd2,_0x28a698){var _0x1d0a7a=require(_0x3d94('0x1e'));var _0x439173;return db[_0x3d94('0x1f')][_0x3d94('0x20')]({'attributes':['id',_0x3d94('0x21')],'where':{'id':0x1},'raw':!![]})['then'](function(_0x584c4a){_0x439173=_0x584c4a;return db[_0x3d94('0x15')]['create'](_0x5b3b31['body']);})[_0x3d94('0xa')](function(_0x58c0d0){if(_0x439173[_0x3d94('0x21')]&&fs[_0x3d94('0x22')](_0x58c0d0[_0x3d94('0x23')])){var _0x4cef9c=util[_0x3d94('0x24')]('%s.cypher',_0x58c0d0[_0x3d94('0x23')]);return _0x1d0a7a['encryptFile'](_0x58c0d0[_0x3d94('0x23')],_0x4cef9c,config[_0x3d94('0x25')][_0x3d94('0x26')])[_0x3d94('0xa')](function(){fs['unlink'](_0x58c0d0[_0x3d94('0x23')]);logger['info'](_0x3d94('0x27'));return _0x58c0d0;});}return _0x58c0d0;})[_0x3d94('0xa')](function(_0x51d308){logger['info'](_0x3d94('0x1d'),_0x5b3b31);logger[_0x3d94('0x1b')](_0x3d94('0x1d'),_0x5b3b31,JSON['stringify'](_0x51d308));_0x558fd2(_0x51d308);})[_0x3d94('0x13')](function(_0x3d29fd){logger['error'](_0x3d94('0x1d'),_0x3d29fd[_0x3d94('0x11')],_0x5b3b31);_0x28a698(_0x123183[_0x3d94('0xe')](0x1f4,_0x3d29fd[_0x3d94('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 1f25476..2643d9e 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 _0x91c8=['get','index','isAuthenticated','/:id','show','post','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voiceTransferReport.controller'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x91c8,0xf4));var _0x891c=function(_0x5d45dd,_0x176b77){_0x5d45dd=_0x5d45dd-0x0;var _0x4fb711=_0x91c8[_0x5d45dd];return _0x4fb711;};'use strict';var multer=require(_0x891c('0x0'));var util=require(_0x891c('0x1'));var path=require('path');var timeout=require(_0x891c('0x2'));var express=require(_0x891c('0x3'));var router=express[_0x891c('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x891c('0x5'));var interaction=require(_0x891c('0x6'));var config=require('../../config/environment');var controller=require(_0x891c('0x7'));router[_0x891c('0x8')]('/',auth['isAuthenticated'](),controller[_0x891c('0x9')]);router[_0x891c('0x8')]('/describe',auth[_0x891c('0xa')](),controller['describe']);router[_0x891c('0x8')](_0x891c('0xb'),auth[_0x891c('0xa')](),controller[_0x891c('0xc')]);router[_0x891c('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x891c('0xb'),auth[_0x891c('0xa')](),controller[_0x891c('0xe')]);router[_0x891c('0xf')]('/:id',auth[_0x891c('0xa')](),controller[_0x891c('0x10')]);module[_0x891c('0x11')]=router; \ No newline at end of file +var _0xc588=['delete','destroy','exports','multer','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index','/:id','post','create','put','update'];(function(_0x47a349,_0x4699d9){var _0x18ab75=function(_0x210796){while(--_0x210796){_0x47a349['push'](_0x47a349['shift']());}};_0x18ab75(++_0x4699d9);}(_0xc588,0x133));var _0x8c58=function(_0x288536,_0x369b51){_0x288536=_0x288536-0x0;var _0x525e94=_0xc588[_0x288536];return _0x525e94;};'use strict';var multer=require(_0x8c58('0x0'));var util=require('util');var path=require(_0x8c58('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8c58('0x2')]();var fs_extra=require(_0x8c58('0x3'));var auth=require(_0x8c58('0x4'));var interaction=require(_0x8c58('0x5'));var config=require(_0x8c58('0x6'));var controller=require(_0x8c58('0x7'));router[_0x8c58('0x8')]('/',auth[_0x8c58('0x9')](),controller[_0x8c58('0xa')]);router[_0x8c58('0x8')]('/describe',auth[_0x8c58('0x9')](),controller['describe']);router['get'](_0x8c58('0xb'),auth[_0x8c58('0x9')](),controller['show']);router[_0x8c58('0xc')]('/',auth[_0x8c58('0x9')](),controller[_0x8c58('0xd')]);router[_0x8c58('0xe')]('/:id',auth[_0x8c58('0x9')](),controller[_0x8c58('0xf')]);router[_0x8c58('0x10')]('/:id',auth[_0x8c58('0x9')](),controller[_0x8c58('0x11')]);module[_0x8c58('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 59043ab..1524577 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 _0xc33f=['STRING','ENUM','sequelize','exports','blind'];(function(_0x5bb3d6,_0x373494){var _0x23286b=function(_0x5beee4){while(--_0x5beee4){_0x5bb3d6['push'](_0x5bb3d6['shift']());}};_0x23286b(++_0x373494);}(_0xc33f,0x10b));var _0xfc33=function(_0x51e45b,_0x2f683d){_0x51e45b=_0x51e45b-0x0;var _0x1e0abe=_0xc33f[_0x51e45b];return _0x1e0abe;};'use strict';var Sequelize=require(_0xfc33('0x0'));var moment=require('moment');module[_0xfc33('0x1')]={'type':{'type':Sequelize['ENUM'](_0xfc33('0x2'),'attended')},'result':{'type':Sequelize[_0xfc33('0x3')]},'transfererchannel':{'type':Sequelize[_0xfc33('0x3')]},'transferercalleridnum':{'type':Sequelize[_0xfc33('0x3')]},'transferercalleridname':{'type':Sequelize[_0xfc33('0x3')]},'transfererconnectedlinenum':{'type':Sequelize[_0xfc33('0x3')]},'transfererconnectedlinename':{'type':Sequelize[_0xfc33('0x3')]},'transfereraccountcode':{'type':Sequelize[_0xfc33('0x3')]},'transferercontext':{'type':Sequelize[_0xfc33('0x3')]},'transfererexten':{'type':Sequelize[_0xfc33('0x3')]},'transfererlinkedid':{'type':Sequelize[_0xfc33('0x3')]},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize[_0xfc33('0x3')]},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize[_0xfc33('0x3')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0xfc33('0x3')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0xfc33('0x3')]},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize[_0xfc33('0x4')]('Yes','No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0xfc33('0x3')]}}; \ No newline at end of file +var _0x6971=['blind','attended','STRING','ENUM','Yes','moment','exports'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x6971,0x1e8));var _0x1697=function(_0x5d9304,_0x12cbe7){_0x5d9304=_0x5d9304-0x0;var _0x45e6dc=_0x6971[_0x5d9304];return _0x45e6dc;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x1697('0x0'));module[_0x1697('0x1')]={'type':{'type':Sequelize['ENUM'](_0x1697('0x2'),_0x1697('0x3'))},'result':{'type':Sequelize[_0x1697('0x4')]},'transfererchannel':{'type':Sequelize[_0x1697('0x4')]},'transferercalleridnum':{'type':Sequelize[_0x1697('0x4')]},'transferercalleridname':{'type':Sequelize[_0x1697('0x4')]},'transfererconnectedlinenum':{'type':Sequelize[_0x1697('0x4')]},'transfererconnectedlinename':{'type':Sequelize[_0x1697('0x4')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize[_0x1697('0x4')]},'transfererexten':{'type':Sequelize[_0x1697('0x4')]},'transfererlinkedid':{'type':Sequelize[_0x1697('0x4')]},'transfereechannel':{'type':Sequelize[_0x1697('0x4')]},'transfereecalleridnum':{'type':Sequelize[_0x1697('0x4')]},'transfereecalleridname':{'type':Sequelize[_0x1697('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x1697('0x4')]},'transfereeconnectedlinename':{'type':Sequelize[_0x1697('0x4')]},'transfereeaccountcode':{'type':Sequelize[_0x1697('0x4')]},'transfereecontext':{'type':Sequelize[_0x1697('0x4')]},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize[_0x1697('0x4')]},'isexternal':{'type':Sequelize[_0x1697('0x5')](_0x1697('0x6'),'No')},'context':{'type':Sequelize[_0x1697('0x4')]},'extension':{'type':Sequelize[_0x1697('0x4')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 1e9818d..f10ee45 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 _0x17b5=['fieldName','type','key','model','query','keys','intersection','attributes','fields','nolimit','order','sort','where','filters','filter','map','options','includeAll','findAll','catch','show','params','length','include','merge','find','create','body','describe','eml-format','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','destroy','then','error','name','index','VoiceTransferReport','rawAttributes'];(function(_0x32d457,_0x1a39c9){var _0x338386=function(_0x199d7a){while(--_0x199d7a){_0x32d457['push'](_0x32d457['shift']());}};_0x338386(++_0x1a39c9);}(_0x17b5,0x1d9));var _0x517b=function(_0x231068,_0x5bbe87){_0x231068=_0x231068-0x0;var _0x13aa8b=_0x17b5[_0x231068];return _0x13aa8b;};'use strict';var emlformat=require(_0x517b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x517b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x517b('0x2'));var BPromise=require(_0x517b('0x3'));var Mustache=require(_0x517b('0x4'));var util=require(_0x517b('0x5'));var path=require(_0x517b('0x6'));var sox=require(_0x517b('0x7'));var csv=require(_0x517b('0x8'));var ejs=require(_0x517b('0x9'));var fs=require('fs');var fs_extra=require(_0x517b('0xa'));var _=require(_0x517b('0xb'));var squel=require(_0x517b('0xc'));var crypto=require(_0x517b('0xd'));var jsforce=require(_0x517b('0xe'));var deskjs=require(_0x517b('0xf'));var toCsv=require('to-csv');var querystring=require(_0x517b('0x10'));var Papa=require(_0x517b('0x11'));var Redis=require('ioredis');var authService=require(_0x517b('0x12'));var qs=require(_0x517b('0x13'));var as=require(_0x517b('0x14'));var hardwareService=require(_0x517b('0x15'));var logger=require('../../config/logger')(_0x517b('0x16'));var utils=require('../../config/utils');var config=require(_0x517b('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x517b('0x18'))['db'];function respondWithStatusCode(_0x16621c,_0x2724b4){_0x2724b4=_0x2724b4||0xcc;return function(_0x5424af){if(_0x5424af){return _0x16621c[_0x517b('0x19')](_0x2724b4);}return _0x16621c[_0x517b('0x1a')](_0x2724b4)[_0x517b('0x1b')]();};}function respondWithResult(_0x565041,_0x1aa8e0){_0x1aa8e0=_0x1aa8e0||0xc8;return function(_0xf95017){if(_0xf95017){return _0x565041[_0x517b('0x1a')](_0x1aa8e0)['json'](_0xf95017);}};}function respondWithFilteredResult(_0x316164,_0x1afbd4){return function(_0x4fe06b){if(_0x4fe06b){var _0x1eb4bd=typeof _0x1afbd4[_0x517b('0x1c')]===_0x517b('0x1d')&&typeof _0x1afbd4[_0x517b('0x1e')]===_0x517b('0x1d');var _0x5f1a85=_0x4fe06b[_0x517b('0x1f')];var _0x2b2105=_0x1eb4bd?0x0:_0x1afbd4['offset'];var _0x4933dc=_0x1eb4bd?_0x4fe06b[_0x517b('0x1f')]:_0x1afbd4[_0x517b('0x1c')]+_0x1afbd4['limit'];var _0x4fc142;if(_0x4933dc>=_0x5f1a85){_0x4933dc=_0x5f1a85;_0x4fc142=0xc8;}else{_0x4fc142=0xce;}_0x316164[_0x517b('0x1a')](_0x4fc142);return _0x316164[_0x517b('0x20')](_0x517b('0x21'),_0x2b2105+'-'+_0x4933dc+'/'+_0x5f1a85)[_0x517b('0x22')](_0x4fe06b);}return null;};}function patchUpdates(_0x10f1b3){return function(_0x119871){try{jsonpatch[_0x517b('0x23')](_0x119871,_0x10f1b3,!![]);}catch(_0x4d3780){return BPromise[_0x517b('0x24')](_0x4d3780);}return _0x119871[_0x517b('0x25')]();};}function saveUpdates(_0x4a5dfc,_0x45b76a){return function(_0x3ea297){if(_0x3ea297){return _0x3ea297['update'](_0x4a5dfc)['then'](function(_0x6c7fb6){return _0x6c7fb6;});}return null;};}function removeEntity(_0x483f01,_0xe329b2){return function(_0x24c991){if(_0x24c991){return _0x24c991[_0x517b('0x26')]()[_0x517b('0x27')](function(){_0x483f01[_0x517b('0x1a')](0xcc)[_0x517b('0x1b')]();});}};}function handleEntityNotFound(_0x59f5cd,_0x4073f6){return function(_0x3200a1){if(!_0x3200a1){_0x59f5cd['sendStatus'](0x194);}return _0x3200a1;};}function handleError(_0x108886,_0x4ad6a6){_0x4ad6a6=_0x4ad6a6||0x1f4;return function(_0x376bfa){logger[_0x517b('0x28')](_0x376bfa['stack']);if(_0x376bfa[_0x517b('0x29')]){delete _0x376bfa[_0x517b('0x29')];}_0x108886[_0x517b('0x1a')](_0x4ad6a6)['send'](_0x376bfa);};}exports[_0x517b('0x2a')]=function(_0x489654,_0xd6b6bb){var _0x234b04={},_0x57f2d1={},_0x7b285c={'count':0x0,'rows':[]};var _0x44def8=_['map'](db[_0x517b('0x2b')][_0x517b('0x2c')],function(_0x407377){return{'name':_0x407377[_0x517b('0x2d')],'type':_0x407377[_0x517b('0x2e')][_0x517b('0x2f')]};});_0x57f2d1[_0x517b('0x30')]=_['map'](_0x44def8,_0x517b('0x29'));_0x57f2d1[_0x517b('0x31')]=_[_0x517b('0x32')](_0x489654[_0x517b('0x31')]);_0x57f2d1['filters']=_[_0x517b('0x33')](_0x57f2d1[_0x517b('0x30')],_0x57f2d1[_0x517b('0x31')]);_0x234b04[_0x517b('0x34')]=_[_0x517b('0x33')](_0x57f2d1[_0x517b('0x30')],qs[_0x517b('0x35')](_0x489654[_0x517b('0x31')][_0x517b('0x35')]));_0x234b04['attributes']=_0x234b04[_0x517b('0x34')]['length']?_0x234b04[_0x517b('0x34')]:_0x57f2d1[_0x517b('0x30')];if(!_0x489654[_0x517b('0x31')]['hasOwnProperty'](_0x517b('0x36'))){_0x234b04[_0x517b('0x1e')]=qs[_0x517b('0x1e')](_0x489654['query'][_0x517b('0x1e')]);_0x234b04[_0x517b('0x1c')]=qs[_0x517b('0x1c')](_0x489654['query'][_0x517b('0x1c')]);}_0x234b04[_0x517b('0x37')]=qs[_0x517b('0x38')](_0x489654[_0x517b('0x31')][_0x517b('0x38')]);_0x234b04[_0x517b('0x39')]=qs['filters'](_['pick'](_0x489654[_0x517b('0x31')],_0x57f2d1[_0x517b('0x3a')]),_0x44def8);if(_0x489654[_0x517b('0x31')][_0x517b('0x3b')]){_0x234b04[_0x517b('0x39')]=_['merge'](_0x234b04[_0x517b('0x39')],{'$or':_[_0x517b('0x3c')](_0x44def8,function(_0x34c21e){if(_0x34c21e['type']!=='VIRTUAL'){var _0x1d6ce2={};_0x1d6ce2[_0x34c21e['name']]={'$like':'%'+_0x489654[_0x517b('0x31')][_0x517b('0x3b')]+'%'};return _0x1d6ce2;}})});}_0x234b04=_['merge']({},_0x234b04,_0x489654[_0x517b('0x3d')]);var _0x172346={'where':_0x234b04['where']};return db['VoiceTransferReport']['count'](_0x172346)['then'](function(_0x2bcf86){_0x7b285c[_0x517b('0x1f')]=_0x2bcf86;if(_0x489654[_0x517b('0x31')][_0x517b('0x3e')]){_0x234b04['include']=[{'all':!![]}];}return db[_0x517b('0x2b')][_0x517b('0x3f')](_0x234b04);})[_0x517b('0x27')](function(_0x71fc38){_0x7b285c['rows']=_0x71fc38;return _0x7b285c;})[_0x517b('0x27')](respondWithFilteredResult(_0xd6b6bb,_0x234b04))[_0x517b('0x40')](handleError(_0xd6b6bb,null));};exports[_0x517b('0x41')]=function(_0x5b8050,_0x5e5249){var _0x32a7b5={'raw':!![],'where':{'id':_0x5b8050[_0x517b('0x42')]['id']}},_0x1fff0c={};_0x1fff0c['model']=_['keys'](db[_0x517b('0x2b')][_0x517b('0x2c')]);_0x1fff0c[_0x517b('0x31')]=_[_0x517b('0x32')](_0x5b8050[_0x517b('0x31')]);_0x1fff0c[_0x517b('0x3a')]=_[_0x517b('0x33')](_0x1fff0c[_0x517b('0x30')],_0x1fff0c[_0x517b('0x31')]);_0x32a7b5[_0x517b('0x34')]=_['intersection'](_0x1fff0c[_0x517b('0x30')],qs[_0x517b('0x35')](_0x5b8050[_0x517b('0x31')][_0x517b('0x35')]));_0x32a7b5[_0x517b('0x34')]=_0x32a7b5[_0x517b('0x34')][_0x517b('0x43')]?_0x32a7b5[_0x517b('0x34')]:_0x1fff0c['model'];if(_0x5b8050[_0x517b('0x31')][_0x517b('0x3e')]){_0x32a7b5[_0x517b('0x44')]=[{'all':!![]}];}_0x32a7b5=_[_0x517b('0x45')]({},_0x32a7b5,_0x5b8050[_0x517b('0x3d')]);return db['VoiceTransferReport'][_0x517b('0x46')](_0x32a7b5)[_0x517b('0x27')](handleEntityNotFound(_0x5e5249,null))[_0x517b('0x27')](respondWithResult(_0x5e5249,null))['catch'](handleError(_0x5e5249,null));};exports[_0x517b('0x47')]=function(_0x452209,_0x1e1b34){return db['VoiceTransferReport'][_0x517b('0x47')](_0x452209[_0x517b('0x48')],{})[_0x517b('0x27')](respondWithResult(_0x1e1b34,0xc9))['catch'](handleError(_0x1e1b34,null));};exports['update']=function(_0x5d1d26,_0x1cd2cd){if(_0x5d1d26[_0x517b('0x48')]['id']){delete _0x5d1d26[_0x517b('0x48')]['id'];}return db[_0x517b('0x2b')][_0x517b('0x46')]({'where':{'id':_0x5d1d26[_0x517b('0x42')]['id']}})[_0x517b('0x27')](handleEntityNotFound(_0x1cd2cd,null))[_0x517b('0x27')](saveUpdates(_0x5d1d26[_0x517b('0x48')],null))['then'](respondWithResult(_0x1cd2cd,null))[_0x517b('0x40')](handleError(_0x1cd2cd,null));};exports[_0x517b('0x26')]=function(_0x46325b,_0x405df7){return db[_0x517b('0x2b')][_0x517b('0x46')]({'where':{'id':_0x46325b['params']['id']}})[_0x517b('0x27')](handleEntityNotFound(_0x405df7,null))[_0x517b('0x27')](removeEntity(_0x405df7,null))[_0x517b('0x40')](handleError(_0x405df7,null));};exports[_0x517b('0x49')]=function(_0x1cecc9,_0x2539b2){return db[_0x517b('0x2b')]['describe']()[_0x517b('0x27')](respondWithResult(_0x2539b2,null))['catch'](handleError(_0x2539b2,null));}; \ No newline at end of file +var _0x9c1e=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','reject','update','then','destroy','error','stack','name','map','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','VoiceTransferReport','rawAttributes','create','body','find','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0x9c1e,0xd0));var _0xe9c1=function(_0x4ba43e,_0x55c7dc){_0x4ba43e=_0x4ba43e-0x0;var _0x54baf7=_0x9c1e[_0x4ba43e];return _0x54baf7;};'use strict';var emlformat=require(_0xe9c1('0x0'));var rimraf=require(_0xe9c1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe9c1('0x2'));var rp=require('request-promise');var moment=require(_0xe9c1('0x3'));var BPromise=require(_0xe9c1('0x4'));var Mustache=require(_0xe9c1('0x5'));var util=require(_0xe9c1('0x6'));var path=require(_0xe9c1('0x7'));var sox=require(_0xe9c1('0x8'));var csv=require(_0xe9c1('0x9'));var ejs=require(_0xe9c1('0xa'));var fs=require('fs');var fs_extra=require(_0xe9c1('0xb'));var _=require(_0xe9c1('0xc'));var squel=require(_0xe9c1('0xd'));var crypto=require(_0xe9c1('0xe'));var jsforce=require(_0xe9c1('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xe9c1('0x9'));var querystring=require(_0xe9c1('0x10'));var Papa=require('papaparse');var Redis=require(_0xe9c1('0x11'));var authService=require(_0xe9c1('0x12'));var qs=require(_0xe9c1('0x13'));var as=require(_0xe9c1('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe9c1('0x15'))(_0xe9c1('0x16'));var utils=require(_0xe9c1('0x17'));var config=require(_0xe9c1('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xe9c1('0x19'))['db'];function respondWithStatusCode(_0x142eae,_0x4d1ac9){_0x4d1ac9=_0x4d1ac9||0xcc;return function(_0x110449){if(_0x110449){return _0x142eae[_0xe9c1('0x1a')](_0x4d1ac9);}return _0x142eae[_0xe9c1('0x1b')](_0x4d1ac9)[_0xe9c1('0x1c')]();};}function respondWithResult(_0x4b28e9,_0x1f6486){_0x1f6486=_0x1f6486||0xc8;return function(_0x30fcd1){if(_0x30fcd1){return _0x4b28e9['status'](_0x1f6486)[_0xe9c1('0x1d')](_0x30fcd1);}};}function respondWithFilteredResult(_0x13c30c,_0x4b907c){return function(_0x530b6b){if(_0x530b6b){var _0x227c3e=typeof _0x4b907c['offset']==='undefined'&&typeof _0x4b907c['limit']===_0xe9c1('0x1e');var _0x2a4578=_0x530b6b[_0xe9c1('0x1f')];var _0x13bcee=_0x227c3e?0x0:_0x4b907c[_0xe9c1('0x20')];var _0x212c5e=_0x227c3e?_0x530b6b[_0xe9c1('0x1f')]:_0x4b907c[_0xe9c1('0x20')]+_0x4b907c[_0xe9c1('0x21')];var _0x12e0f1;if(_0x212c5e>=_0x2a4578){_0x212c5e=_0x2a4578;_0x12e0f1=0xc8;}else{_0x12e0f1=0xce;}_0x13c30c[_0xe9c1('0x1b')](_0x12e0f1);return _0x13c30c[_0xe9c1('0x22')](_0xe9c1('0x23'),_0x13bcee+'-'+_0x212c5e+'/'+_0x2a4578)['json'](_0x530b6b);}return null;};}function patchUpdates(_0x3e27f8){return function(_0x4b4683){try{jsonpatch['apply'](_0x4b4683,_0x3e27f8,!![]);}catch(_0x3e01c7){return BPromise[_0xe9c1('0x24')](_0x3e01c7);}return _0x4b4683['save']();};}function saveUpdates(_0x3d59c9,_0x2c6d65){return function(_0x16127f){if(_0x16127f){return _0x16127f[_0xe9c1('0x25')](_0x3d59c9)[_0xe9c1('0x26')](function(_0x432546){return _0x432546;});}return null;};}function removeEntity(_0x3cf47d,_0xe0e568){return function(_0x2652cf){if(_0x2652cf){return _0x2652cf[_0xe9c1('0x27')]()['then'](function(){_0x3cf47d['status'](0xcc)[_0xe9c1('0x1c')]();});}};}function handleEntityNotFound(_0x3c225d,_0x537ccd){return function(_0x2e63a1){if(!_0x2e63a1){_0x3c225d[_0xe9c1('0x1a')](0x194);}return _0x2e63a1;};}function handleError(_0x1a5224,_0x2b2af9){_0x2b2af9=_0x2b2af9||0x1f4;return function(_0x38fa52){logger[_0xe9c1('0x28')](_0x38fa52[_0xe9c1('0x29')]);if(_0x38fa52[_0xe9c1('0x2a')]){delete _0x38fa52[_0xe9c1('0x2a')];}_0x1a5224['status'](_0x2b2af9)['send'](_0x38fa52);};}exports['index']=function(_0xf302e6,_0x385c97){var _0x4e5744={},_0x44c1f6={},_0x5ecb9a={'count':0x0,'rows':[]};var _0x25d52f=_[_0xe9c1('0x2b')](db['VoiceTransferReport']['rawAttributes'],function(_0x1c8774){return{'name':_0x1c8774[_0xe9c1('0x2c')],'type':_0x1c8774[_0xe9c1('0x2d')]['key']};});_0x44c1f6[_0xe9c1('0x2e')]=_[_0xe9c1('0x2b')](_0x25d52f,_0xe9c1('0x2a'));_0x44c1f6[_0xe9c1('0x2f')]=_[_0xe9c1('0x30')](_0xf302e6['query']);_0x44c1f6[_0xe9c1('0x31')]=_[_0xe9c1('0x32')](_0x44c1f6['model'],_0x44c1f6[_0xe9c1('0x2f')]);_0x4e5744[_0xe9c1('0x33')]=_[_0xe9c1('0x32')](_0x44c1f6[_0xe9c1('0x2e')],qs['fields'](_0xf302e6['query'][_0xe9c1('0x34')]));_0x4e5744['attributes']=_0x4e5744[_0xe9c1('0x33')][_0xe9c1('0x35')]?_0x4e5744[_0xe9c1('0x33')]:_0x44c1f6[_0xe9c1('0x2e')];if(!_0xf302e6['query'][_0xe9c1('0x36')]('nolimit')){_0x4e5744[_0xe9c1('0x21')]=qs[_0xe9c1('0x21')](_0xf302e6[_0xe9c1('0x2f')][_0xe9c1('0x21')]);_0x4e5744[_0xe9c1('0x20')]=qs[_0xe9c1('0x20')](_0xf302e6['query'][_0xe9c1('0x20')]);}_0x4e5744[_0xe9c1('0x37')]=qs[_0xe9c1('0x38')](_0xf302e6['query'][_0xe9c1('0x38')]);_0x4e5744[_0xe9c1('0x39')]=qs[_0xe9c1('0x31')](_[_0xe9c1('0x3a')](_0xf302e6[_0xe9c1('0x2f')],_0x44c1f6[_0xe9c1('0x31')]),_0x25d52f);if(_0xf302e6['query'][_0xe9c1('0x3b')]){_0x4e5744[_0xe9c1('0x39')]=_[_0xe9c1('0x3c')](_0x4e5744['where'],{'$or':_[_0xe9c1('0x2b')](_0x25d52f,function(_0x23d3c6){if(_0x23d3c6['type']!=='VIRTUAL'){var _0x9e7852={};_0x9e7852[_0x23d3c6[_0xe9c1('0x2a')]]={'$like':'%'+_0xf302e6[_0xe9c1('0x2f')][_0xe9c1('0x3b')]+'%'};return _0x9e7852;}})});}_0x4e5744=_[_0xe9c1('0x3c')]({},_0x4e5744,_0xf302e6[_0xe9c1('0x3d')]);var _0x28b1ac={'where':_0x4e5744['where']};return db['VoiceTransferReport'][_0xe9c1('0x1f')](_0x28b1ac)['then'](function(_0x57317d){_0x5ecb9a['count']=_0x57317d;if(_0xf302e6[_0xe9c1('0x2f')][_0xe9c1('0x3e')]){_0x4e5744[_0xe9c1('0x3f')]=[{'all':!![]}];}return db['VoiceTransferReport'][_0xe9c1('0x40')](_0x4e5744);})['then'](function(_0x27e8e4){_0x5ecb9a[_0xe9c1('0x41')]=_0x27e8e4;return _0x5ecb9a;})[_0xe9c1('0x26')](respondWithFilteredResult(_0x385c97,_0x4e5744))[_0xe9c1('0x42')](handleError(_0x385c97,null));};exports[_0xe9c1('0x43')]=function(_0x1baa7e,_0x1b225f){var _0xf32f4f={'raw':!![],'where':{'id':_0x1baa7e[_0xe9c1('0x44')]['id']}},_0x2dcd25={};_0x2dcd25[_0xe9c1('0x2e')]=_[_0xe9c1('0x30')](db[_0xe9c1('0x45')][_0xe9c1('0x46')]);_0x2dcd25[_0xe9c1('0x2f')]=_[_0xe9c1('0x30')](_0x1baa7e['query']);_0x2dcd25[_0xe9c1('0x31')]=_[_0xe9c1('0x32')](_0x2dcd25[_0xe9c1('0x2e')],_0x2dcd25['query']);_0xf32f4f['attributes']=_[_0xe9c1('0x32')](_0x2dcd25[_0xe9c1('0x2e')],qs[_0xe9c1('0x34')](_0x1baa7e[_0xe9c1('0x2f')][_0xe9c1('0x34')]));_0xf32f4f['attributes']=_0xf32f4f['attributes'][_0xe9c1('0x35')]?_0xf32f4f['attributes']:_0x2dcd25[_0xe9c1('0x2e')];if(_0x1baa7e[_0xe9c1('0x2f')][_0xe9c1('0x3e')]){_0xf32f4f['include']=[{'all':!![]}];}_0xf32f4f=_['merge']({},_0xf32f4f,_0x1baa7e[_0xe9c1('0x3d')]);return db['VoiceTransferReport']['find'](_0xf32f4f)[_0xe9c1('0x26')](handleEntityNotFound(_0x1b225f,null))['then'](respondWithResult(_0x1b225f,null))['catch'](handleError(_0x1b225f,null));};exports[_0xe9c1('0x47')]=function(_0x1ec83e,_0x174032){return db[_0xe9c1('0x45')][_0xe9c1('0x47')](_0x1ec83e[_0xe9c1('0x48')],{})[_0xe9c1('0x26')](respondWithResult(_0x174032,0xc9))[_0xe9c1('0x42')](handleError(_0x174032,null));};exports[_0xe9c1('0x25')]=function(_0x24c0fc,_0x15d9f){if(_0x24c0fc['body']['id']){delete _0x24c0fc['body']['id'];}return db[_0xe9c1('0x45')][_0xe9c1('0x49')]({'where':{'id':_0x24c0fc[_0xe9c1('0x44')]['id']}})[_0xe9c1('0x26')](handleEntityNotFound(_0x15d9f,null))[_0xe9c1('0x26')](saveUpdates(_0x24c0fc[_0xe9c1('0x48')],null))[_0xe9c1('0x26')](respondWithResult(_0x15d9f,null))[_0xe9c1('0x42')](handleError(_0x15d9f,null));};exports[_0xe9c1('0x27')]=function(_0x56fc0a,_0xe262e5){return db[_0xe9c1('0x45')][_0xe9c1('0x49')]({'where':{'id':_0x56fc0a['params']['id']}})[_0xe9c1('0x26')](handleEntityNotFound(_0xe262e5,null))['then'](removeEntity(_0xe262e5,null))[_0xe9c1('0x42')](handleError(_0xe262e5,null));};exports[_0xe9c1('0x4a')]=function(_0x18ab95,_0xee4d0f){return db[_0xe9c1('0x45')][_0xe9c1('0x4a')]()[_0xe9c1('0x26')](respondWithResult(_0xee4d0f,null))['catch'](handleError(_0xee4d0f,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index b66e2ed..5b38ad2 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 _0xc111=['util','../../config/logger','api','moment','bluebird','request-promise','path','exports','define','report_call_transfer','lodash'];(function(_0x14f051,_0x85870b){var _0x3f59ee=function(_0xc8785a){while(--_0xc8785a){_0x14f051['push'](_0x14f051['shift']());}};_0x3f59ee(++_0x85870b);}(_0xc111,0x6d));var _0x1c11=function(_0x5869fc,_0x3a9705){_0x5869fc=_0x5869fc-0x0;var _0x1ae595=_0xc111[_0x5869fc];return _0x1ae595;};'use strict';var _=require(_0x1c11('0x0'));var util=require(_0x1c11('0x1'));var logger=require(_0x1c11('0x2'))(_0x1c11('0x3'));var moment=require(_0x1c11('0x4'));var BPromise=require(_0x1c11('0x5'));var rp=require(_0x1c11('0x6'));var fs=require('fs');var path=require(_0x1c11('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./voiceTransferReport.attributes');module[_0x1c11('0x8')]=function(_0x30fad2,_0x5c655d){return _0x30fad2[_0x1c11('0x9')]('VoiceTransferReport',attributes,{'tableName':_0x1c11('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x550a=['define','report_call_transfer','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./voiceTransferReport.attributes'];(function(_0x4a60b0,_0x432b5c){var _0x3d2e72=function(_0x3c374a){while(--_0x3c374a){_0x4a60b0['push'](_0x4a60b0['shift']());}};_0x3d2e72(++_0x432b5c);}(_0x550a,0x1be));var _0xa550=function(_0x50d73b,_0xbbe1c1){_0x50d73b=_0x50d73b-0x0;var _0x196d06=_0x550a[_0x50d73b];return _0x196d06;};'use strict';var _=require(_0xa550('0x0'));var util=require(_0xa550('0x1'));var logger=require(_0xa550('0x2'))(_0xa550('0x3'));var moment=require(_0xa550('0x4'));var BPromise=require(_0xa550('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa550('0x6'));var rimraf=require(_0xa550('0x7'));var config=require(_0xa550('0x8'));var attributes=require(_0xa550('0x9'));module['exports']=function(_0x54888f,_0x411302){return _0x54888f[_0xa550('0xa')]('VoiceTransferReport',attributes,{'tableName':_0xa550('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.rpc.js b/server/api/voiceTransferReport/voiceTransferReport.rpc.js index bedfb0c..d371649 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 _0x9317=['jayson/promise','client','http','request','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','VoiceTransferReport','create','options','raw','debug','CreateVoiceTransferReport','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment'];(function(_0x5e276b,_0x5b3d9d){var _0x3182d2=function(_0x30559f){while(--_0x30559f){_0x5e276b['push'](_0x5e276b['shift']());}};_0x3182d2(++_0x5b3d9d);}(_0x9317,0x17f));var _0x7931=function(_0xbf8ebe,_0x3b69a5){_0xbf8ebe=_0xbf8ebe-0x0;var _0x1e25e8=_0x9317[_0xbf8ebe];return _0x1e25e8;};'use strict';var _=require('lodash');var util=require(_0x7931('0x0'));var moment=require('moment');var BPromise=require(_0x7931('0x1'));var rs=require(_0x7931('0x2'));var fs=require('fs');var Redis=require(_0x7931('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7931('0x4'));var logger=require(_0x7931('0x5'))('rpc');var config=require(_0x7931('0x6'));var jayson=require(_0x7931('0x7'));var client=jayson[_0x7931('0x8')][_0x7931('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x277486,_0x365a10,_0x5d01e9){return new BPromise(function(_0x3ea3d0,_0x29037e){return client[_0x7931('0xa')](_0x277486,_0x5d01e9)[_0x7931('0xb')](function(_0x4c8813){logger[_0x7931('0xc')](_0x7931('0xd'),_0x365a10,_0x7931('0xe'));logger['debug']('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x365a10,_0x7931('0xe'),JSON[_0x7931('0xf')](_0x4c8813));if(_0x4c8813[_0x7931('0x10')]){if(_0x4c8813[_0x7931('0x10')][_0x7931('0x11')]===0x1f4){logger[_0x7931('0x10')](_0x7931('0xd'),_0x365a10,_0x4c8813[_0x7931('0x10')][_0x7931('0x12')]);return _0x29037e(_0x4c8813[_0x7931('0x10')][_0x7931('0x12')]);}logger[_0x7931('0x10')](_0x7931('0xd'),_0x365a10,_0x4c8813['error'][_0x7931('0x12')]);return _0x3ea3d0(_0x4c8813[_0x7931('0x10')][_0x7931('0x12')]);}else{logger['info'](_0x7931('0xd'),_0x365a10,_0x7931('0xe'));_0x3ea3d0(_0x4c8813['result'][_0x7931('0x12')]);}})[_0x7931('0x13')](function(_0x54a1fc){logger['error'](_0x7931('0xd'),_0x365a10,_0x54a1fc);_0x29037e(_0x54a1fc);});});}exports['CreateVoiceTransferReport']=function(_0x38d52b){var _0x1c2d5d=this;return new Promise(function(_0x382dbe,_0x2b9385){return db[_0x7931('0x14')][_0x7931('0x15')](_0x38d52b['body'],{'raw':_0x38d52b[_0x7931('0x16')]?_0x38d52b[_0x7931('0x16')][_0x7931('0x17')]===undefined?!![]:![]:!![]})[_0x7931('0xb')](function(_0x4303b3){logger[_0x7931('0xc')]('CreateVoiceTransferReport',_0x38d52b);logger[_0x7931('0x18')](_0x7931('0x19'),_0x38d52b,JSON[_0x7931('0xf')](_0x4303b3));_0x382dbe(_0x4303b3);})['catch'](function(_0x20fb87){logger[_0x7931('0x10')](_0x7931('0x19'),_0x20fb87[_0x7931('0x12')],_0x38d52b);_0x2b9385(_0x1c2d5d['error'](0x1f4,_0x20fb87[_0x7931('0x12')]));});});}; \ No newline at end of file +var _0x19b0=['request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','VoiceTransferReport,\x20%s,\x20%s','result','catch','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','raw','then','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','info'];(function(_0x1c2ff9,_0x4ba6aa){var _0x4362d1=function(_0x569ad3){while(--_0x569ad3){_0x1c2ff9['push'](_0x1c2ff9['shift']());}};_0x4362d1(++_0x4ba6aa);}(_0x19b0,0xdb));var _0x019b=function(_0x389c19,_0x5d57a0){_0x389c19=_0x389c19-0x0;var _0xcfebea=_0x19b0[_0x389c19];return _0xcfebea;};'use strict';var _=require(_0x019b('0x0'));var util=require('util');var moment=require(_0x019b('0x1'));var BPromise=require(_0x019b('0x2'));var rs=require(_0x019b('0x3'));var fs=require('fs');var Redis=require(_0x019b('0x4'));var db=require(_0x019b('0x5'))['db'];var utils=require(_0x019b('0x6'));var logger=require('../../config/logger')(_0x019b('0x7'));var config=require(_0x019b('0x8'));var jayson=require(_0x019b('0x9'));var client=jayson[_0x019b('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2d0a5b,_0x38bcf0,_0x1f4c65){return new BPromise(function(_0x40952b,_0x23ad74){return client[_0x019b('0xb')](_0x2d0a5b,_0x1f4c65)['then'](function(_0x5da287){logger[_0x019b('0xc')]('VoiceTransferReport,\x20%s,\x20%s',_0x38bcf0,_0x019b('0xd'));logger[_0x019b('0xe')](_0x019b('0xf'),_0x38bcf0,_0x019b('0xd'),JSON[_0x019b('0x10')](_0x5da287));if(_0x5da287[_0x019b('0x11')]){if(_0x5da287[_0x019b('0x11')]['code']===0x1f4){logger[_0x019b('0x11')]('VoiceTransferReport,\x20%s,\x20%s',_0x38bcf0,_0x5da287['error']['message']);return _0x23ad74(_0x5da287[_0x019b('0x11')][_0x019b('0x12')]);}logger[_0x019b('0x11')]('VoiceTransferReport,\x20%s,\x20%s',_0x38bcf0,_0x5da287['error'][_0x019b('0x12')]);return _0x40952b(_0x5da287[_0x019b('0x11')]['message']);}else{logger[_0x019b('0xc')](_0x019b('0x13'),_0x38bcf0,_0x019b('0xd'));_0x40952b(_0x5da287[_0x019b('0x14')][_0x019b('0x12')]);}})[_0x019b('0x15')](function(_0x17e0f4){logger[_0x019b('0x11')](_0x019b('0x13'),_0x38bcf0,_0x17e0f4);_0x23ad74(_0x17e0f4);});});}exports[_0x019b('0x16')]=function(_0x2dd1fd){var _0x5e6f76=this;return new Promise(function(_0x403654,_0x2c0692){return db[_0x019b('0x17')][_0x019b('0x18')](_0x2dd1fd[_0x019b('0x19')],{'raw':_0x2dd1fd[_0x019b('0x1a')]?_0x2dd1fd[_0x019b('0x1a')][_0x019b('0x1b')]===undefined?!![]:![]:!![]})[_0x019b('0x1c')](function(_0x1d451a){logger['info'](_0x019b('0x16'),_0x2dd1fd);logger['debug'](_0x019b('0x16'),_0x2dd1fd,JSON[_0x019b('0x10')](_0x1d451a));_0x403654(_0x1d451a);})[_0x019b('0x15')](function(_0x3a5061){logger[_0x019b('0x11')](_0x019b('0x16'),_0x3a5061['message'],_0x2dd1fd);_0x2c0692(_0x5e6f76['error'](0x1f4,_0x3a5061[_0x019b('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 36ccff6..5a50e92 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(_0x28f456,_0x20170a){var _0x48893b=function(_0x1cc906){while(--_0x1cc906){_0x28f456['push'](_0x28f456['shift']());}};_0x48893b(++_0x20170a);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x50cfc3,_0x526cc6){_0x50cfc3=_0x50cfc3-0x0;var _0x5c11ef=_0xb4e6[_0x50cfc3];return _0x5c11ef;};'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 _0xa9e0=['/transfer','transfer','exports','express','Router','../../components/auth/service','/originate','isWebrtcLicence','originate','post','/hangup','isAuthenticated','hangup','/answer','answer','hold','/unhold','calls'];(function(_0x215e78,_0x40680a){var _0x70ebb3=function(_0x4f5428){while(--_0x4f5428){_0x215e78['push'](_0x215e78['shift']());}};_0x70ebb3(++_0x40680a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xa9e0[_0x2a6809];return _0x11c371;};'use strict';var express=require(_0x0a9e('0x0'));var router=express[_0x0a9e('0x1')]();var auth=require(_0x0a9e('0x2'));var controller=require('./webbar.controller');router['post'](_0x0a9e('0x3'),auth['isAuthenticated'](),auth[_0x0a9e('0x4')](),controller[_0x0a9e('0x5')]);router[_0x0a9e('0x6')](_0x0a9e('0x7'),auth[_0x0a9e('0x8')](),auth['isWebrtcLicence'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x6')](_0x0a9e('0xa'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0x0a9e('0xb')]);router['post']('/hold',auth[_0x0a9e('0x8')](),auth[_0x0a9e('0x4')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0x6')](_0x0a9e('0xd'),auth[_0x0a9e('0x8')](),auth['isWebrtcLicence'](),controller['unhold']);router['post']('/calls',auth[_0x0a9e('0x8')](),auth[_0x0a9e('0x4')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x6')](_0x0a9e('0xf'),auth[_0x0a9e('0x8')](),auth['isWebrtcLicence'](),controller[_0x0a9e('0x10')]);module[_0x0a9e('0x11')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index b7dc9e9..ad704af 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 _0x07c3=['error','name','send','status','NotFound','request','then','code','message','catch','User','findOne','agent','VoiceChannels','all','rows','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','json','callbackUrl','entityFound:','format','webbar:originate','originate\x20executed!','hangup','hangup\x20fired:','userId','user:%s','webbar:hangup','hangup\x20executed!','answer','webbar:answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold\x20fired:','unhold\x20executed!','calls\x20fired:','filter','conference\x20fired:','webbar:conference','transfer\x20fired:','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','util','bluebird','jayson/promise','client','../../config/logger','webbarapi','ioredis','redis','defaults','localhost','socket.io-emitter','validate','number','userId\x20is\x20required','string','callNumber\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','log','handleError:'];(function(_0xf703e,_0x220972){var _0x5936c6=function(_0x51beda){while(--_0x51beda){_0xf703e['push'](_0xf703e['shift']());}};_0x5936c6(++_0x220972);}(_0x07c3,0x1bf));var _0x307c=function(_0x2f1a6e,_0x3082cb){_0x2f1a6e=_0x2f1a6e-0x0;var _0x5865e5=_0x07c3[_0x2f1a6e];return _0x5865e5;};'use strict';var path=require(_0x307c('0x0'));var fs=require('fs');var _=require(_0x307c('0x1'));var db=require(_0x307c('0x2'))['db'];var config=require(_0x307c('0x3'));var util=require(_0x307c('0x4'));var BPromise=require(_0x307c('0x5'));var jayson=require(_0x307c('0x6'));var amiClient=jayson[_0x307c('0x7')]['http']({'port':0x232a});var logger=require(_0x307c('0x8'))(_0x307c('0x9'));var Redis=require(_0x307c('0xa'));config[_0x307c('0xb')]=_[_0x307c('0xc')](config[_0x307c('0xb')],{'host':_0x307c('0xd'),'port':0x18eb});var io=require(_0x307c('0xe'))(new Redis(config[_0x307c('0xb')]));var Schema=require(_0x307c('0xf'));var originateValidation=new Schema({'userId':{'type':_0x307c('0x10'),'required':[!![],_0x307c('0x11')]},'callNumber':{'type':_0x307c('0x12'),'required':[!![],_0x307c('0x13')]},'callerId':{'type':_0x307c('0x12')},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':_0x307c('0x10'),'required':[!![],_0x307c('0x11')]},'sessionId':{'type':_0x307c('0x12'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x307c('0x10'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0x307c('0x10'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x307c('0x12'),'required':[!![],_0x307c('0x14')]},'transferNumber':{'type':'string','required':[!![],_0x307c('0x15')]}});var holdValidation=new Schema({'userId':{'type':_0x307c('0x10'),'required':[!![],_0x307c('0x11')]},'sessionId':{'type':_0x307c('0x12'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x307c('0x10'),'required':[!![],_0x307c('0x11')]},'sessionId':{'type':_0x307c('0x12'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x307c('0x10'),'required':[!![],_0x307c('0x11')]}});var conferenceValidation=new Schema({'userId':{'type':_0x307c('0x10'),'required':[!![],_0x307c('0x11')]}});function emit(_0x424a74,_0x53e2f4,_0x2a3edc){logger[_0x307c('0x16')](_0x424a74,_0x53e2f4,JSON[_0x307c('0x17')](_0x2a3edc));io['to'](_0x424a74)[_0x307c('0x18')](_0x53e2f4,_0x2a3edc);}function handleError(_0x301e1a){return function(_0x2e21a6){console[_0x307c('0x19')](_0x307c('0x1a'),_0x2e21a6,_0x2e21a6 instanceof RangeError);logger[_0x307c('0x1b')](_0x2e21a6['stack']);if(_0x2e21a6 instanceof RangeError){if(_0x2e21a6['name']){delete _0x2e21a6[_0x307c('0x1c')];}_0x301e1a['status'](0x194)[_0x307c('0x1d')](_0x2e21a6);}else{if(_0x2e21a6['name']){delete _0x2e21a6['name'];}_0x301e1a[_0x307c('0x1e')](0x1f4)[_0x307c('0x1d')](_0x2e21a6);}};}function checkError(){return function(_0x5eb73d){if(!_0x5eb73d){throw new RangeError(_0x307c('0x1f'));}return _0x5eb73d;};}function respondWithRpcPromise(_0xa79b24,_0x5b640f){return new BPromise(function(_0x1cdc48,_0x45fe2){var _0x574622=amiClient;return _0x574622[_0x307c('0x20')](_0xa79b24,_0x5b640f)[_0x307c('0x21')](function(_0x9a66a0){if(_0x9a66a0[_0x307c('0x1b')]){if(_0x9a66a0[_0x307c('0x1b')][_0x307c('0x22')]===0x1f4){return _0x45fe2(_0x9a66a0[_0x307c('0x1b')][_0x307c('0x23')]);}return _0x1cdc48(_0x9a66a0[_0x307c('0x1b')][_0x307c('0x23')]);}else{_0x1cdc48(_0x9a66a0['result']);}})[_0x307c('0x24')](function(_0x58c383){_0x45fe2(_0x58c383);});});}function getAgent(_0x598d43){return db[_0x307c('0x25')][_0x307c('0x26')]({'where':{'id':_0x598d43,'role':_0x307c('0x27')}})[_0x307c('0x21')](checkError());}function getAgentCheckSession(_0x25dede,_0x1591d1){return new BPromise(function(_0x4fd125,_0x1fbdda){var _0x181fa2=respondWithRpcPromise(_0x307c('0x28'));var _0x54da33=getAgent(_0x25dede);Promise[_0x307c('0x29')]([_0x181fa2,_0x54da33])[_0x307c('0x21')](function(_0xcb6ae6){var _0x12d9a9=_0xcb6ae6[0x0];var _0x3a58ec=_0xcb6ae6[0x1];var _0x1e5da0=_['filter'](_0x12d9a9[_0x307c('0x2a')],function(_0x1e448e){return _0x1e448e[_0x307c('0x2b')]==_0x3a58ec['id']&&_0x1e448e[_0x307c('0x2c')]==_0x1591d1;});if(_0x1e5da0[_0x307c('0x2d')]==0x1){_0x4fd125(_0x3a58ec);}else{_0x1fbdda(new RangeError(_0x307c('0x2e')+_0x1591d1+_0x307c('0x2f')));}});});}exports[_0x307c('0x30')]=function(_0x12b5f4,_0x55f4c0){logger[_0x307c('0x16')](_0x307c('0x31'),_0x12b5f4[_0x307c('0x32')]);var _0x1a706a=originateValidation[_0x307c('0xf')](_0x12b5f4[_0x307c('0x32')]);if(_0x1a706a[_0x307c('0x2d')]>0x0){return _0x55f4c0[_0x307c('0x1e')](0x190)[_0x307c('0x33')](_0x1a706a);}var _0x4338e2=_0x12b5f4[_0x307c('0x32')]['userId'];var _0x107518=_0x12b5f4[_0x307c('0x32')]['callNumber'];var _0x383e25=_0x12b5f4[_0x307c('0x32')]['callerId'];var _0x4fa969=_0x12b5f4['body'][_0x307c('0x34')];return getAgent(_0x4338e2)[_0x307c('0x21')](function(_0x878c8c){logger[_0x307c('0x16')](_0x307c('0x35'),_0x878c8c[_0x307c('0x1c')]);emit(util[_0x307c('0x36')]('user:%s',_0x878c8c[_0x307c('0x1c')]),_0x307c('0x37'),{'callNumber':_0x107518,'callerId':_0x383e25,'callbackUrl':_0x4fa969});return _0x55f4c0[_0x307c('0x1e')](0xc8)[_0x307c('0x33')]({'error':![],'message':_0x307c('0x38')});})[_0x307c('0x24')](handleError(_0x55f4c0));};exports[_0x307c('0x39')]=function(_0x5da51b,_0x5f085a){logger['info'](_0x307c('0x3a'),_0x5da51b[_0x307c('0x32')]);var _0x4e2873=hangupValidation['validate'](_0x5da51b[_0x307c('0x32')]);if(_0x4e2873['length']>0x0){return _0x5f085a[_0x307c('0x1e')](0x190)[_0x307c('0x33')](_0x4e2873);}var _0x31e3fa=_0x5da51b[_0x307c('0x32')][_0x307c('0x3b')];var _0x70fc50=_0x5da51b[_0x307c('0x32')][_0x307c('0x2c')];return getAgent(_0x31e3fa)['then'](function(_0x2d7544){logger['info'](_0x307c('0x35'),_0x2d7544['name']);emit(util[_0x307c('0x36')](_0x307c('0x3c'),_0x2d7544[_0x307c('0x1c')]),_0x307c('0x3d'),{'sessionId':_0x70fc50});return _0x5f085a[_0x307c('0x1e')](0xc8)[_0x307c('0x33')]({'error':![],'message':_0x307c('0x3e')});})[_0x307c('0x24')](handleError(_0x5f085a));};exports[_0x307c('0x3f')]=function(_0x1f645e,_0xaa4479){logger[_0x307c('0x16')]('answer\x20fired:',_0x1f645e['body']);var _0x3c8758=answerValidation[_0x307c('0xf')](_0x1f645e[_0x307c('0x32')]);if(_0x3c8758[_0x307c('0x2d')]>0x0){return _0xaa4479[_0x307c('0x1e')](0x190)[_0x307c('0x33')](_0x3c8758);}var _0x4a7f36=_0x1f645e['body'][_0x307c('0x3b')];var _0x5d7d0d=_0x1f645e[_0x307c('0x32')][_0x307c('0x2c')];return getAgent(_0x4a7f36)[_0x307c('0x21')](function(_0x4de79e){logger[_0x307c('0x16')](_0x307c('0x35'),_0x4de79e[_0x307c('0x1c')]);emit(util[_0x307c('0x36')](_0x307c('0x3c'),_0x4de79e['name']),_0x307c('0x40'),{'sessionId':_0x5d7d0d});return _0xaa4479[_0x307c('0x1e')](0xc8)['json']({'error':![],'message':_0x307c('0x41')});})[_0x307c('0x24')](handleError(_0xaa4479));};exports[_0x307c('0x42')]=function(_0x195b90,_0x3a9013){logger[_0x307c('0x16')](_0x307c('0x43'),_0x195b90['body']);var _0x3dee68=holdValidation[_0x307c('0xf')](_0x195b90[_0x307c('0x32')]);if(_0x3dee68['length']>0x0){return _0x3a9013[_0x307c('0x1e')](0x190)[_0x307c('0x33')](_0x3dee68);}var _0x2ced73=_0x195b90[_0x307c('0x32')]['userId'];var _0xa1faa0=_0x195b90['body']['sessionId'];return getAgent(_0x2ced73)['then'](function(_0x26081b){logger[_0x307c('0x16')](_0x307c('0x35'),_0x26081b[_0x307c('0x1c')]);emit(util['format'](_0x307c('0x3c'),_0x26081b[_0x307c('0x1c')]),_0x307c('0x44'),{'sessionId':_0xa1faa0});return _0x3a9013[_0x307c('0x1e')](0xc8)[_0x307c('0x33')]({'error':![],'message':_0x307c('0x45')});})[_0x307c('0x24')](handleError(_0x3a9013));};exports['unhold']=function(_0x50876a,_0x1f41c9){logger[_0x307c('0x16')](_0x307c('0x46'),_0x50876a[_0x307c('0x32')]);var _0x4006da=unholdValidation[_0x307c('0xf')](_0x50876a[_0x307c('0x32')]);if(_0x4006da['length']>0x0){return _0x1f41c9['status'](0x190)[_0x307c('0x33')](_0x4006da);}var _0x6d04b8=_0x50876a[_0x307c('0x32')][_0x307c('0x3b')];var _0x46f257=_0x50876a['body']['sessionId'];return getAgent(_0x6d04b8)['then'](function(_0x41cae0){logger[_0x307c('0x16')]('entityFound:',_0x41cae0[_0x307c('0x1c')]);emit(util[_0x307c('0x36')](_0x307c('0x3c'),_0x41cae0['name']),'webbar:unhold',{'sessionId':_0x46f257});return _0x1f41c9['status'](0xc8)[_0x307c('0x33')]({'error':![],'message':_0x307c('0x47')});})['catch'](handleError(_0x1f41c9));};exports['calls']=function(_0x46b41e,_0x38d1ff){logger['info'](_0x307c('0x48'),_0x38d1ff[_0x307c('0x32')]);var _0xd27876=callsValidation[_0x307c('0xf')](_0x46b41e['body']);if(_0xd27876[_0x307c('0x2d')]>0x0){return _0x38d1ff[_0x307c('0x1e')](0x190)[_0x307c('0x33')](_0xd27876);}var _0x3c2b3d=_0x46b41e[_0x307c('0x32')][_0x307c('0x3b')];var _0x34d223=respondWithRpcPromise(_0x307c('0x28'));var _0x560d36=getAgent(_0x3c2b3d);return Promise[_0x307c('0x29')]([_0x34d223,_0x560d36])[_0x307c('0x21')](function(_0x5d9fb4){var _0x55ecb7=_0x5d9fb4[0x0];var _0x10efed=_0x5d9fb4[0x1];var _0xe1ddea=_[_0x307c('0x49')](_0x55ecb7[_0x307c('0x2a')],function(_0x55c268){return _0x55c268['UserId']==_0x10efed['id'];});return _0x38d1ff[_0x307c('0x1e')](0xc8)[_0x307c('0x33')]({'count':_0xe1ddea['length'],'rows':_0xe1ddea});})['catch'](handleError(_0x38d1ff));};exports['conference']=function(_0x2bc93a,_0x3b68d2){logger[_0x307c('0x16')](_0x307c('0x4a'),_0x2bc93a[_0x307c('0x32')]);var _0xfe43a2=conferenceValidation['validate'](_0x2bc93a[_0x307c('0x32')]);if(_0xfe43a2[_0x307c('0x2d')]>0x0){return _0x3b68d2[_0x307c('0x1e')](0x190)[_0x307c('0x33')](_0xfe43a2);}var _0x54bfb3=_0x2bc93a[_0x307c('0x32')]['userId'];return getAgent(_0x54bfb3)[_0x307c('0x21')](function(_0x15d37b){logger['info'](_0x307c('0x35'),_0x15d37b['name']);emit(util[_0x307c('0x36')](_0x307c('0x3c'),_0x15d37b['name']),_0x307c('0x4b'));return _0x3b68d2[_0x307c('0x1e')](0xc8)[_0x307c('0x33')]({'error':![],'message':'conference\x20executed!'});})['catch'](handleError(_0x3b68d2));};exports['transfer']=function(_0x38cdfb,_0x32cc40){logger['info'](_0x307c('0x4c'),_0x38cdfb[_0x307c('0x32')]);var _0x580983=transferValidation['validate'](_0x38cdfb[_0x307c('0x32')]);if(_0x580983['length']>0x0){return _0x32cc40[_0x307c('0x1e')](0x190)['json'](_0x580983);}var _0x4307a9=_0x38cdfb['body'][_0x307c('0x3b')];var _0xa82555=_0x38cdfb['body'][_0x307c('0x2c')];var _0x12e471=_0x38cdfb['body']['transferNumber'];return getAgent(_0x4307a9)['then'](function(_0x27d0b2){logger[_0x307c('0x16')](_0x307c('0x35'),_0x27d0b2['name']);emit(util[_0x307c('0x36')](_0x307c('0x3c'),_0x27d0b2[_0x307c('0x1c')]),_0x307c('0x4d'),{'sessionId':_0xa82555,'transferNumber':_0x12e471});return _0x32cc40[_0x307c('0x1e')](0xc8)[_0x307c('0x33')]({'error':![],'message':_0x307c('0x4e')});})[_0x307c('0x24')](handleError(_0x32cc40));}; \ No newline at end of file +var _0xe28e=['../../mysqldb','../../config/environment','util','bluebird','jayson/promise','client','http','../../config/logger','webbarapi','ioredis','redis','localhost','socket.io-emitter','validate','number','userId\x20is\x20required','string','sessionId\x20is\x20required','transferNumber\x20is\x20required','stringify','handleError:','stack','name','send','status','NotFound','request','error','code','message','result','catch','findOne','VoiceChannels','all','then','filter','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','originate','info','body','json','callNumber','callerId','callbackUrl','entityFound:','user:%s','originate\x20executed!','hangup','hangup\x20fired:','userId','format','webbar:hangup','hangup\x20executed!','answer','webbar:answer','answer\x20executed!','hold','webbar:hold','hold\x20executed!','webbar:unhold','calls','rows','conference','conference\x20fired:','conference\x20executed!','transfer\x20fired:','transferNumber','path','lodash'];(function(_0x42f7bb,_0x36dcbe){var _0x5e8a4f=function(_0x19c52a){while(--_0x19c52a){_0x42f7bb['push'](_0x42f7bb['shift']());}};_0x5e8a4f(++_0x36dcbe);}(_0xe28e,0x1ba));var _0xee28=function(_0x4a5448,_0x2c4ee2){_0x4a5448=_0x4a5448-0x0;var _0x18bb16=_0xe28e[_0x4a5448];return _0x18bb16;};'use strict';var path=require(_0xee28('0x0'));var fs=require('fs');var _=require(_0xee28('0x1'));var db=require(_0xee28('0x2'))['db'];var config=require(_0xee28('0x3'));var util=require(_0xee28('0x4'));var BPromise=require(_0xee28('0x5'));var jayson=require(_0xee28('0x6'));var amiClient=jayson[_0xee28('0x7')][_0xee28('0x8')]({'port':0x232a});var logger=require(_0xee28('0x9'))(_0xee28('0xa'));var Redis=require(_0xee28('0xb'));config[_0xee28('0xc')]=_['defaults'](config[_0xee28('0xc')],{'host':_0xee28('0xd'),'port':0x18eb});var io=require(_0xee28('0xe'))(new Redis(config[_0xee28('0xc')]));var Schema=require(_0xee28('0xf'));var originateValidation=new Schema({'userId':{'type':_0xee28('0x10'),'required':[!![],_0xee28('0x11')]},'callNumber':{'type':'string','required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':'string'},'callbackUrl':{'type':_0xee28('0x12')}});var hangupValidation=new Schema({'userId':{'type':_0xee28('0x10'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xee28('0x12'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xee28('0x10'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xee28('0x12'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xee28('0x10'),'required':[!![],_0xee28('0x11')]},'sessionId':{'type':_0xee28('0x12'),'required':[!![],_0xee28('0x13')]},'transferNumber':{'type':_0xee28('0x12'),'required':[!![],_0xee28('0x14')]}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0xee28('0x11')]},'sessionId':{'type':_0xee28('0x12'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xee28('0x10'),'required':[!![],_0xee28('0x11')]},'sessionId':{'type':_0xee28('0x12'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0xee28('0x11')]}});var conferenceValidation=new Schema({'userId':{'type':_0xee28('0x10'),'required':[!![],_0xee28('0x11')]}});function emit(_0x343358,_0x1ff99e,_0x11c95d){logger['info'](_0x343358,_0x1ff99e,JSON[_0xee28('0x15')](_0x11c95d));io['to'](_0x343358)['emit'](_0x1ff99e,_0x11c95d);}function handleError(_0x37e429){return function(_0x19472a){console['log'](_0xee28('0x16'),_0x19472a,_0x19472a instanceof RangeError);logger['error'](_0x19472a[_0xee28('0x17')]);if(_0x19472a instanceof RangeError){if(_0x19472a['name']){delete _0x19472a[_0xee28('0x18')];}_0x37e429['status'](0x194)[_0xee28('0x19')](_0x19472a);}else{if(_0x19472a['name']){delete _0x19472a[_0xee28('0x18')];}_0x37e429[_0xee28('0x1a')](0x1f4)[_0xee28('0x19')](_0x19472a);}};}function checkError(){return function(_0x3674c7){if(!_0x3674c7){throw new RangeError(_0xee28('0x1b'));}return _0x3674c7;};}function respondWithRpcPromise(_0x1280f5,_0x2dbd49){return new BPromise(function(_0x4bda53,_0x342798){var _0x44d7ff=amiClient;return _0x44d7ff[_0xee28('0x1c')](_0x1280f5,_0x2dbd49)['then'](function(_0x5b500b){if(_0x5b500b[_0xee28('0x1d')]){if(_0x5b500b[_0xee28('0x1d')][_0xee28('0x1e')]===0x1f4){return _0x342798(_0x5b500b[_0xee28('0x1d')][_0xee28('0x1f')]);}return _0x4bda53(_0x5b500b[_0xee28('0x1d')][_0xee28('0x1f')]);}else{_0x4bda53(_0x5b500b[_0xee28('0x20')]);}})[_0xee28('0x21')](function(_0x733ca8){_0x342798(_0x733ca8);});});}function getAgent(_0x281c8a){return db['User'][_0xee28('0x22')]({'where':{'id':_0x281c8a,'role':'agent'}})['then'](checkError());}function getAgentCheckSession(_0x54528b,_0x587aac){return new BPromise(function(_0x51eae7,_0x8373a7){var _0x884e7d=respondWithRpcPromise(_0xee28('0x23'));var _0x469889=getAgent(_0x54528b);Promise[_0xee28('0x24')]([_0x884e7d,_0x469889])[_0xee28('0x25')](function(_0xbafd67){var _0x4fcc8f=_0xbafd67[0x0];var _0x84e0ba=_0xbafd67[0x1];var _0x7390dc=_[_0xee28('0x26')](_0x4fcc8f['rows'],function(_0x14f7c4){return _0x14f7c4[_0xee28('0x27')]==_0x84e0ba['id']&&_0x14f7c4[_0xee28('0x28')]==_0x587aac;});if(_0x7390dc[_0xee28('0x29')]==0x1){_0x51eae7(_0x84e0ba);}else{_0x8373a7(new RangeError(_0xee28('0x2a')+_0x587aac+_0xee28('0x2b')));}});});}exports[_0xee28('0x2c')]=function(_0x5d2a9d,_0x15f294){logger[_0xee28('0x2d')]('originate\x20fired:',_0x5d2a9d[_0xee28('0x2e')]);var _0x34dd11=originateValidation[_0xee28('0xf')](_0x5d2a9d[_0xee28('0x2e')]);if(_0x34dd11[_0xee28('0x29')]>0x0){return _0x15f294[_0xee28('0x1a')](0x190)[_0xee28('0x2f')](_0x34dd11);}var _0x5a4f48=_0x5d2a9d['body']['userId'];var _0x1a8ef0=_0x5d2a9d[_0xee28('0x2e')][_0xee28('0x30')];var _0x3402ce=_0x5d2a9d[_0xee28('0x2e')][_0xee28('0x31')];var _0x5b0c20=_0x5d2a9d[_0xee28('0x2e')][_0xee28('0x32')];return getAgent(_0x5a4f48)['then'](function(_0x51b28d){logger[_0xee28('0x2d')](_0xee28('0x33'),_0x51b28d['name']);emit(util['format'](_0xee28('0x34'),_0x51b28d[_0xee28('0x18')]),'webbar:originate',{'callNumber':_0x1a8ef0,'callerId':_0x3402ce,'callbackUrl':_0x5b0c20});return _0x15f294[_0xee28('0x1a')](0xc8)[_0xee28('0x2f')]({'error':![],'message':_0xee28('0x35')});})[_0xee28('0x21')](handleError(_0x15f294));};exports[_0xee28('0x36')]=function(_0x594116,_0x2a5d06){logger[_0xee28('0x2d')](_0xee28('0x37'),_0x594116[_0xee28('0x2e')]);var _0x43b587=hangupValidation[_0xee28('0xf')](_0x594116['body']);if(_0x43b587[_0xee28('0x29')]>0x0){return _0x2a5d06['status'](0x190)['json'](_0x43b587);}var _0x265ae5=_0x594116['body'][_0xee28('0x38')];var _0x5c5f08=_0x594116[_0xee28('0x2e')]['sessionId'];return getAgent(_0x265ae5)[_0xee28('0x25')](function(_0x211345){logger[_0xee28('0x2d')](_0xee28('0x33'),_0x211345['name']);emit(util[_0xee28('0x39')]('user:%s',_0x211345[_0xee28('0x18')]),_0xee28('0x3a'),{'sessionId':_0x5c5f08});return _0x2a5d06[_0xee28('0x1a')](0xc8)[_0xee28('0x2f')]({'error':![],'message':_0xee28('0x3b')});})[_0xee28('0x21')](handleError(_0x2a5d06));};exports[_0xee28('0x3c')]=function(_0x5a4b9c,_0x4d9d21){logger[_0xee28('0x2d')]('answer\x20fired:',_0x5a4b9c['body']);var _0x4064cf=answerValidation[_0xee28('0xf')](_0x5a4b9c['body']);if(_0x4064cf[_0xee28('0x29')]>0x0){return _0x4d9d21[_0xee28('0x1a')](0x190)[_0xee28('0x2f')](_0x4064cf);}var _0x24cfaa=_0x5a4b9c[_0xee28('0x2e')][_0xee28('0x38')];var _0x1735a9=_0x5a4b9c['body'][_0xee28('0x28')];return getAgent(_0x24cfaa)[_0xee28('0x25')](function(_0x2dd024){logger[_0xee28('0x2d')](_0xee28('0x33'),_0x2dd024['name']);emit(util[_0xee28('0x39')](_0xee28('0x34'),_0x2dd024['name']),_0xee28('0x3d'),{'sessionId':_0x1735a9});return _0x4d9d21[_0xee28('0x1a')](0xc8)[_0xee28('0x2f')]({'error':![],'message':_0xee28('0x3e')});})[_0xee28('0x21')](handleError(_0x4d9d21));};exports[_0xee28('0x3f')]=function(_0x54ab7b,_0x36e5bb){logger['info']('hold\x20fired:',_0x54ab7b[_0xee28('0x2e')]);var _0x2f240f=holdValidation['validate'](_0x54ab7b[_0xee28('0x2e')]);if(_0x2f240f[_0xee28('0x29')]>0x0){return _0x36e5bb[_0xee28('0x1a')](0x190)['json'](_0x2f240f);}var _0x57e57e=_0x54ab7b[_0xee28('0x2e')][_0xee28('0x38')];var _0x1bb1ac=_0x54ab7b[_0xee28('0x2e')][_0xee28('0x28')];return getAgent(_0x57e57e)[_0xee28('0x25')](function(_0x2574c5){logger[_0xee28('0x2d')](_0xee28('0x33'),_0x2574c5[_0xee28('0x18')]);emit(util['format'](_0xee28('0x34'),_0x2574c5['name']),_0xee28('0x40'),{'sessionId':_0x1bb1ac});return _0x36e5bb[_0xee28('0x1a')](0xc8)[_0xee28('0x2f')]({'error':![],'message':_0xee28('0x41')});})[_0xee28('0x21')](handleError(_0x36e5bb));};exports['unhold']=function(_0x5247fe,_0x5ca018){logger[_0xee28('0x2d')]('unhold\x20fired:',_0x5247fe['body']);var _0x659fc4=unholdValidation['validate'](_0x5247fe[_0xee28('0x2e')]);if(_0x659fc4[_0xee28('0x29')]>0x0){return _0x5ca018[_0xee28('0x1a')](0x190)[_0xee28('0x2f')](_0x659fc4);}var _0x398120=_0x5247fe[_0xee28('0x2e')][_0xee28('0x38')];var _0xc1bdba=_0x5247fe[_0xee28('0x2e')][_0xee28('0x28')];return getAgent(_0x398120)['then'](function(_0x1f3680){logger[_0xee28('0x2d')](_0xee28('0x33'),_0x1f3680['name']);emit(util['format']('user:%s',_0x1f3680['name']),_0xee28('0x42'),{'sessionId':_0xc1bdba});return _0x5ca018[_0xee28('0x1a')](0xc8)[_0xee28('0x2f')]({'error':![],'message':'unhold\x20executed!'});})[_0xee28('0x21')](handleError(_0x5ca018));};exports[_0xee28('0x43')]=function(_0x204bbe,_0x39b228){logger[_0xee28('0x2d')]('calls\x20fired:',_0x39b228[_0xee28('0x2e')]);var _0x1c6696=callsValidation[_0xee28('0xf')](_0x204bbe['body']);if(_0x1c6696[_0xee28('0x29')]>0x0){return _0x39b228[_0xee28('0x1a')](0x190)[_0xee28('0x2f')](_0x1c6696);}var _0x47794a=_0x204bbe[_0xee28('0x2e')][_0xee28('0x38')];var _0xfcca7e=respondWithRpcPromise('VoiceChannels');var _0x161394=getAgent(_0x47794a);return Promise['all']([_0xfcca7e,_0x161394])['then'](function(_0x5b7292){var _0x333d7e=_0x5b7292[0x0];var _0x7c51d5=_0x5b7292[0x1];var _0x3cad0a=_[_0xee28('0x26')](_0x333d7e[_0xee28('0x44')],function(_0x27d96d){return _0x27d96d[_0xee28('0x27')]==_0x7c51d5['id'];});return _0x39b228[_0xee28('0x1a')](0xc8)['json']({'count':_0x3cad0a[_0xee28('0x29')],'rows':_0x3cad0a});})[_0xee28('0x21')](handleError(_0x39b228));};exports[_0xee28('0x45')]=function(_0x2b8252,_0x209c3e){logger[_0xee28('0x2d')](_0xee28('0x46'),_0x2b8252['body']);var _0x438943=conferenceValidation['validate'](_0x2b8252[_0xee28('0x2e')]);if(_0x438943[_0xee28('0x29')]>0x0){return _0x209c3e['status'](0x190)[_0xee28('0x2f')](_0x438943);}var _0x2a5fa7=_0x2b8252[_0xee28('0x2e')][_0xee28('0x38')];return getAgent(_0x2a5fa7)['then'](function(_0x209d6d){logger[_0xee28('0x2d')](_0xee28('0x33'),_0x209d6d[_0xee28('0x18')]);emit(util[_0xee28('0x39')](_0xee28('0x34'),_0x209d6d[_0xee28('0x18')]),'webbar:conference');return _0x209c3e[_0xee28('0x1a')](0xc8)['json']({'error':![],'message':_0xee28('0x47')});})[_0xee28('0x21')](handleError(_0x209c3e));};exports['transfer']=function(_0x4b222a,_0x14bc7a){logger['info'](_0xee28('0x48'),_0x4b222a[_0xee28('0x2e')]);var _0x19f81a=transferValidation[_0xee28('0xf')](_0x4b222a[_0xee28('0x2e')]);if(_0x19f81a[_0xee28('0x29')]>0x0){return _0x14bc7a[_0xee28('0x1a')](0x190)['json'](_0x19f81a);}var _0x179ce6=_0x4b222a[_0xee28('0x2e')][_0xee28('0x38')];var _0x57ded5=_0x4b222a[_0xee28('0x2e')][_0xee28('0x28')];var _0x1e190f=_0x4b222a[_0xee28('0x2e')][_0xee28('0x49')];return getAgent(_0x179ce6)[_0xee28('0x25')](function(_0x5dc31e){logger[_0xee28('0x2d')](_0xee28('0x33'),_0x5dc31e[_0xee28('0x18')]);emit(util[_0xee28('0x39')](_0xee28('0x34'),_0x5dc31e[_0xee28('0x18')]),'webbar:transfer',{'sessionId':_0x57ded5,'transferNumber':_0x1e190f});return _0x14bc7a[_0xee28('0x1a')](0xc8)[_0xee28('0x2f')]({'error':![],'message':'transfer\x20executed!'});})['catch'](handleError(_0x14bc7a));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 8c2c7c5..7122504 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 _0x6343=['/:id/users','getAgents','/:id/applications','getApplications','post','create','addDisposition','addAnswer','addAgents','/:id/notify','notify','/:id/send','put','update','destroy','delete','removeAnswers','removeAgents','exports','path','connect-timeout','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers'];(function(_0x4820d1,_0x9ca326){var _0x4fd096=function(_0x57e865){while(--_0x57e865){_0x4820d1['push'](_0x4820d1['shift']());}};_0x4fd096(++_0x9ca326);}(_0x6343,0x168));var _0x3634=function(_0x38d28d,_0x352835){_0x38d28d=_0x38d28d-0x0;var _0x2b69a5=_0x6343[_0x38d28d];return _0x2b69a5;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3634('0x0'));var timeout=require(_0x3634('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x3634('0x2'));var config=require(_0x3634('0x3'));var controller=require('./whatsappAccount.controller');router[_0x3634('0x4')]('/',auth[_0x3634('0x5')](),controller['index']);router[_0x3634('0x4')](_0x3634('0x6'),auth['isAuthenticated'](),controller['describe']);router[_0x3634('0x4')](_0x3634('0x7'),auth[_0x3634('0x5')](),controller[_0x3634('0x8')]);router[_0x3634('0x4')](_0x3634('0x9'),auth['isAuthenticated'](),controller['getDispositions']);router[_0x3634('0x4')](_0x3634('0xa'),auth['isAuthenticated'](),controller[_0x3634('0xb')]);router[_0x3634('0x4')](_0x3634('0xc'),auth[_0x3634('0x5')](),controller[_0x3634('0xd')]);router[_0x3634('0x4')](_0x3634('0xe'),auth[_0x3634('0x5')](),controller[_0x3634('0xf')]);router[_0x3634('0x10')]('/',auth[_0x3634('0x5')](),controller[_0x3634('0x11')]);router[_0x3634('0x10')](_0x3634('0x9'),auth['isAuthenticated'](),controller[_0x3634('0x12')]);router['post'](_0x3634('0xa'),auth[_0x3634('0x5')](),controller[_0x3634('0x13')]);router[_0x3634('0x10')](_0x3634('0xc'),auth['isAuthenticated'](),controller[_0x3634('0x14')]);router['post']('/:id/applications',auth[_0x3634('0x5')](),controller['addApplications']);router[_0x3634('0x10')](_0x3634('0x15'),controller[_0x3634('0x16')]);router['post'](_0x3634('0x17'),auth[_0x3634('0x5')](),controller['send']);router[_0x3634('0x18')]('/:id',auth[_0x3634('0x5')](),controller[_0x3634('0x19')]);router['delete'](_0x3634('0x7'),auth[_0x3634('0x5')](),controller[_0x3634('0x1a')]);router['delete'](_0x3634('0x9'),auth[_0x3634('0x5')](),controller['removeDispositions']);router[_0x3634('0x1b')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x3634('0x1c')]);router[_0x3634('0x1b')]('/:id/users',auth[_0x3634('0x5')](),controller[_0x3634('0x1d')]);module[_0x3634('0x1e')]=router; \ No newline at end of file +var _0xc2c7=['/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','/:id/applications','getApplications','post','addAnswer','addAgents','addApplications','/:id/notify','notify','/:id/send','send','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','describe'];(function(_0x5700d2,_0x59b5fa){var _0x25c1e0=function(_0x461b91){while(--_0x461b91){_0x5700d2['push'](_0x5700d2['shift']());}};_0x25c1e0(++_0x59b5fa);}(_0xc2c7,0x134));var _0x7c2c=function(_0x83f536,_0x42bcff){_0x83f536=_0x83f536-0x0;var _0x2d1b2d=_0xc2c7[_0x83f536];return _0x2d1b2d;};'use strict';var multer=require('multer');var util=require(_0x7c2c('0x0'));var path=require(_0x7c2c('0x1'));var timeout=require(_0x7c2c('0x2'));var express=require(_0x7c2c('0x3'));var router=express[_0x7c2c('0x4')]();var fs_extra=require(_0x7c2c('0x5'));var auth=require(_0x7c2c('0x6'));var interaction=require(_0x7c2c('0x7'));var config=require('../../config/environment');var controller=require('./whatsappAccount.controller');router[_0x7c2c('0x8')]('/',auth[_0x7c2c('0x9')](),controller[_0x7c2c('0xa')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x7c2c('0xb')]);router[_0x7c2c('0x8')](_0x7c2c('0xc'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0xd')]);router['get'](_0x7c2c('0xe'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0xf')]);router[_0x7c2c('0x8')](_0x7c2c('0x10'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0x11')]);router[_0x7c2c('0x8')](_0x7c2c('0x12'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0x13')]);router[_0x7c2c('0x8')](_0x7c2c('0x14'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0x15')]);router[_0x7c2c('0x16')]('/',auth['isAuthenticated'](),controller['create']);router[_0x7c2c('0x16')](_0x7c2c('0xe'),auth[_0x7c2c('0x9')](),controller['addDisposition']);router[_0x7c2c('0x16')](_0x7c2c('0x10'),auth['isAuthenticated'](),controller[_0x7c2c('0x17')]);router['post'](_0x7c2c('0x12'),auth['isAuthenticated'](),controller[_0x7c2c('0x18')]);router[_0x7c2c('0x16')](_0x7c2c('0x14'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0x19')]);router[_0x7c2c('0x16')](_0x7c2c('0x1a'),controller[_0x7c2c('0x1b')]);router[_0x7c2c('0x16')](_0x7c2c('0x1c'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0x1d')]);router['put'](_0x7c2c('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x7c2c('0x1e')](_0x7c2c('0xc'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0x1f')]);router[_0x7c2c('0x1e')](_0x7c2c('0xe'),auth[_0x7c2c('0x9')](),controller['removeDispositions']);router[_0x7c2c('0x1e')]('/:id/canned_answers',auth[_0x7c2c('0x9')](),controller['removeAnswers']);router[_0x7c2c('0x1e')](_0x7c2c('0x12'),auth[_0x7c2c('0x9')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 261c755..5457d56 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 _0xc2a3=['randomstring','STRING','name','generate','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','sequelize'];(function(_0x5c298a,_0x579b14){var _0x3419fe=function(_0x340588){while(--_0x340588){_0x5c298a['push'](_0x5c298a['shift']());}};_0x3419fe(++_0x579b14);}(_0xc2a3,0x12f));var _0x3c2a=function(_0x58965a,_0x2e71db){_0x58965a=_0x58965a-0x0;var _0x254efc=_0xc2a3[_0x58965a];return _0x254efc;};'use strict';var Sequelize=require(_0x3c2a('0x0'));var rs=require(_0x3c2a('0x1'));module['exports']={'name':{'type':Sequelize[_0x3c2a('0x2')],'unique':_0x3c2a('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x3c2a('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x3c2a('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x3c2a('0x2')],'defaultValue':function(){return rs[_0x3c2a('0x4')]();}},'phone':{'type':Sequelize[_0x3c2a('0x2')]},'type':{'type':Sequelize[_0x3c2a('0x5')](_0x3c2a('0x6'),_0x3c2a('0x7'))},'accountSid':{'type':Sequelize[_0x3c2a('0x2')]},'baseUrl':{'type':Sequelize[_0x3c2a('0x2')]},'authToken':{'type':Sequelize[_0x3c2a('0x2')]},'notificationTemplate':{'type':Sequelize[_0x3c2a('0x8')],'defaultValue':function(){return _0x3c2a('0x9');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x3c2a('0xa')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x3c2a('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x3c2a('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x3c2a('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x3c2a('0xa')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x3c2a('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x3c2a('0xb')],'comment':_0x3c2a('0xc')},'mandatoryDisposition':{'type':Sequelize[_0x3c2a('0xa')],'defaultValue':![],'comment':_0x3c2a('0xd'),'set':function(_0x3e9701){if(!_0x3e9701){this[_0x3c2a('0xe')](_0x3c2a('0xf'),null);}this[_0x3c2a('0xe')]('mandatoryDisposition',_0x3e9701);}},'description':{'type':Sequelize[_0x3c2a('0x2')]}}; \ No newline at end of file +var _0xcf4f=['name','STRING','ENUM','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','randomstring'];(function(_0x1d19c3,_0x553330){var _0x3f9089=function(_0x35841e){while(--_0x35841e){_0x1d19c3['push'](_0x1d19c3['shift']());}};_0x3f9089(++_0x553330);}(_0xcf4f,0x167));var _0xfcf4=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0xcf4f[_0x173441];return _0x2423a8;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xfcf4('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xfcf4('0x1'),'allowNull':![]},'key':{'type':Sequelize[_0xfcf4('0x2')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0xfcf4('0x2')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0xfcf4('0x2')]},'type':{'type':Sequelize[_0xfcf4('0x3')]('twilio','sinch')},'accountSid':{'type':Sequelize[_0xfcf4('0x2')]},'baseUrl':{'type':Sequelize[_0xfcf4('0x2')]},'authToken':{'type':Sequelize[_0xfcf4('0x2')]},'notificationTemplate':{'type':Sequelize[_0xfcf4('0x4')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xfcf4('0x5')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xfcf4('0x5')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xfcf4('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xfcf4('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xfcf4('0x5')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xfcf4('0x6')],'comment':_0xfcf4('0x7')},'mandatoryDisposition':{'type':Sequelize[_0xfcf4('0x5')],'defaultValue':![],'comment':_0xfcf4('0x8'),'set':function(_0x161898){if(!_0x161898){this[_0xfcf4('0x9')]('mandatoryDispositionPauseId',null);}this[_0xfcf4('0x9')]('mandatoryDisposition',_0x161898);}},'description':{'type':Sequelize[_0xfcf4('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index cd20b42..551caf4 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 _0x8300=['ListId','mobile','from','replace','whatsapp:','Body','messageId','MessageSid','notifications','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','CmContact','Contacts','DESC','list','WhatsappInteraction','spread','interaction','autoclose','push','close','unmanaged','created','AttachmentId','UserId','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','WhatsappAccount,\x20%s,\x20%s,\x20%s','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','twilio','Content-Type','text/xml','to\x20is\x20mandatory','List','out','Messages','dataValues','eml-format','rimraf','zip-dir','request-promise','util','path','sox','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','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','http','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','sendStatus','status','end','json','limit','undefined','offset','set','Content-Range','apply','reject','then','destroy','get','WhatsappAccounts','UserProfileResource','stack','name','send','index','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','fieldName','type','model','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','catch','params','keys','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','Pause','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','order','rows','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','addAgents','omit','emit','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','transaction','Transaction','WhatsappApplication','findAndCountAll','priority','getApplications','notify','whatsapp','Applications','account','sinch','statuses','state','WhatsappMessage','update','timestamp','message_id','applications','orderBy','asc','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId'];(function(_0x22fc1d,_0x5b8ee1){var _0x29e032=function(_0x69e18a){while(--_0x69e18a){_0x22fc1d['push'](_0x22fc1d['shift']());}};_0x29e032(++_0x5b8ee1);}(_0x8300,0x1b9));var _0x0830=function(_0x1ebce2,_0x10e903){_0x1ebce2=_0x1ebce2-0x0;var _0x4a330c=_0x8300[_0x1ebce2];return _0x4a330c;};'use strict';var emlformat=require(_0x0830('0x0'));var rimraf=require(_0x0830('0x1'));var zipdir=require(_0x0830('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0830('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0830('0x4'));var path=require(_0x0830('0x5'));var sox=require(_0x0830('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0830('0x7'));var _=require(_0x0830('0x8'));var squel=require(_0x0830('0x9'));var crypto=require(_0x0830('0xa'));var jsforce=require(_0x0830('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0830('0xc'));var Papa=require(_0x0830('0xd'));var Redis=require(_0x0830('0xe'));var authService=require(_0x0830('0xf'));var qs=require(_0x0830('0x10'));var as=require(_0x0830('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0830('0x12'))(_0x0830('0x13'));var utils=require('../../config/utils');var config=require(_0x0830('0x14'));var licenseUtil=require(_0x0830('0x15'));var db=require('../../mysqldb')['db'];config[_0x0830('0x16')]=_[_0x0830('0x17')](config[_0x0830('0x16')],{'host':_0x0830('0x18'),'port':0x18eb});var socket=require(_0x0830('0x19'))(new Redis(config['redis']));require(_0x0830('0x1a'))[_0x0830('0x1b')](socket);var jayson=require(_0x0830('0x1c'));var client=jayson[_0x0830('0x1d')][_0x0830('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x3a1924,_0x1b7c0b,_0x53c85a,_0x1216a5){return new BPromise(function(_0x44a2af,_0x1c244d){var _0x3dc08f=_0x1216a5||client;return _0x3dc08f['request'](_0x3a1924,_0x53c85a)['then'](function(_0x368ad9){logger[_0x0830('0x1f')](_0x0830('0x20'),_0x1b7c0b,_0x0830('0x21'));logger[_0x0830('0x22')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x1b7c0b,_0x0830('0x21'),JSON[_0x0830('0x23')](_0x368ad9));if(_0x368ad9['error']){if(_0x368ad9['error'][_0x0830('0x24')]===0x1f4){logger[_0x0830('0x25')]('WhatsappAccount,\x20%s,\x20%s',_0x1b7c0b,_0x368ad9[_0x0830('0x25')][_0x0830('0x26')]);return _0x1c244d(_0x368ad9[_0x0830('0x25')][_0x0830('0x26')]);}logger[_0x0830('0x25')](_0x0830('0x20'),_0x1b7c0b,_0x368ad9[_0x0830('0x25')][_0x0830('0x26')]);return _0x44a2af(_0x368ad9['error'][_0x0830('0x26')]);}else{logger[_0x0830('0x1f')]('WhatsappAccount,\x20%s,\x20%s',_0x1b7c0b,'request\x20sent');_0x44a2af(_0x368ad9[_0x0830('0x27')][_0x0830('0x26')]);}})['catch'](function(_0x306a05){logger[_0x0830('0x25')](_0x0830('0x20'),_0x1b7c0b,_0x306a05);_0x1c244d(_0x306a05);});});}function respondWithStatusCode(_0x1fd53f,_0xccf22d){_0xccf22d=_0xccf22d||0xcc;return function(_0x334303){if(_0x334303){return _0x1fd53f[_0x0830('0x28')](_0xccf22d);}return _0x1fd53f[_0x0830('0x29')](_0xccf22d)[_0x0830('0x2a')]();};}function respondWithResult(_0x1ee9b6,_0x454af1){_0x454af1=_0x454af1||0xc8;return function(_0x2be53){if(_0x2be53){return _0x1ee9b6['status'](_0x454af1)[_0x0830('0x2b')](_0x2be53);}};}function respondWithFilteredResult(_0x31160c,_0x17c94a){return function(_0x4634ee){if(_0x4634ee){var _0xaf751d=typeof _0x17c94a['offset']==='undefined'&&typeof _0x17c94a[_0x0830('0x2c')]===_0x0830('0x2d');var _0x29879b=_0x4634ee['count'];var _0x4f6f6a=_0xaf751d?0x0:_0x17c94a['offset'];var _0x2a3382=_0xaf751d?_0x4634ee['count']:_0x17c94a[_0x0830('0x2e')]+_0x17c94a['limit'];var _0x16c409;if(_0x2a3382>=_0x29879b){_0x2a3382=_0x29879b;_0x16c409=0xc8;}else{_0x16c409=0xce;}_0x31160c[_0x0830('0x29')](_0x16c409);return _0x31160c[_0x0830('0x2f')](_0x0830('0x30'),_0x4f6f6a+'-'+_0x2a3382+'/'+_0x29879b)[_0x0830('0x2b')](_0x4634ee);}return null;};}function patchUpdates(_0x2bbfdf){return function(_0x2f04e6){try{jsonpatch[_0x0830('0x31')](_0x2f04e6,_0x2bbfdf,!![]);}catch(_0x414ce5){return BPromise[_0x0830('0x32')](_0x414ce5);}return _0x2f04e6['save']();};}function saveUpdates(_0x5a62c9,_0x86a7b3){return function(_0x59e49f){if(_0x59e49f){return _0x59e49f['update'](_0x5a62c9)[_0x0830('0x33')](function(_0x1380a5){return _0x1380a5;});}return null;};}function removeEntity(_0x11c285,_0xcd2c79){return function(_0xbe1f6e){if(_0xbe1f6e){return _0xbe1f6e[_0x0830('0x34')]()['then'](function(){var _0x430a66=_0xbe1f6e[_0x0830('0x35')]({'plain':!![]});var _0xdc209d=_0x0830('0x36');return db[_0x0830('0x37')][_0x0830('0x34')]({'where':{'type':_0xdc209d,'resourceId':_0x430a66['id']}})[_0x0830('0x33')](function(){return _0xbe1f6e;});})[_0x0830('0x33')](function(){_0x11c285[_0x0830('0x29')](0xcc)[_0x0830('0x2a')]();});}};}function handleEntityNotFound(_0x17384e,_0xd95335){return function(_0x20a8f0){if(!_0x20a8f0){_0x17384e['sendStatus'](0x194);}return _0x20a8f0;};}function handleError(_0x2dfed9,_0x3906ef){_0x3906ef=_0x3906ef||0x1f4;return function(_0x989f0a){logger['error'](_0x989f0a[_0x0830('0x38')]);if(_0x989f0a[_0x0830('0x39')]){delete _0x989f0a['name'];}_0x2dfed9['status'](_0x3906ef)[_0x0830('0x3a')](_0x989f0a);};}exports[_0x0830('0x3b')]=function(_0x1f4f35,_0x3cd46a){var _0x6e0192={'include':[{'model':db['Pause'],'as':_0x0830('0x3c')}]},_0x43bb40={},_0x139fed={'count':0x0,'rows':[]};var _0x372c35=_[_0x0830('0x3d')](db[_0x0830('0x3e')][_0x0830('0x3f')],function(_0x592713){return{'name':_0x592713[_0x0830('0x40')],'type':_0x592713[_0x0830('0x41')]['key']};});_0x43bb40[_0x0830('0x42')]=_[_0x0830('0x3d')](_0x372c35,_0x0830('0x39'));_0x43bb40['query']=_['keys'](_0x1f4f35['query']);_0x43bb40[_0x0830('0x43')]=_[_0x0830('0x44')](_0x43bb40[_0x0830('0x42')],_0x43bb40[_0x0830('0x45')]);_0x6e0192[_0x0830('0x46')]=_[_0x0830('0x44')](_0x43bb40[_0x0830('0x42')],qs[_0x0830('0x47')](_0x1f4f35['query']['fields']));_0x6e0192[_0x0830('0x46')]=_0x6e0192[_0x0830('0x46')][_0x0830('0x48')]?_0x6e0192[_0x0830('0x46')]:_0x43bb40[_0x0830('0x42')];if(!_0x1f4f35[_0x0830('0x45')][_0x0830('0x49')](_0x0830('0x4a'))){_0x6e0192['limit']=qs[_0x0830('0x2c')](_0x1f4f35[_0x0830('0x45')][_0x0830('0x2c')]);_0x6e0192[_0x0830('0x2e')]=qs[_0x0830('0x2e')](_0x1f4f35[_0x0830('0x45')][_0x0830('0x2e')]);}_0x6e0192['order']=qs[_0x0830('0x4b')](_0x1f4f35['query']['sort']);_0x6e0192[_0x0830('0x4c')]=qs['filters'](_[_0x0830('0x4d')](_0x1f4f35[_0x0830('0x45')],_0x43bb40[_0x0830('0x43')]),_0x372c35);if(_0x1f4f35['query'][_0x0830('0x4e')]){_0x6e0192[_0x0830('0x4c')]=_[_0x0830('0x4f')](_0x6e0192[_0x0830('0x4c')],{'$or':_[_0x0830('0x3d')](_0x372c35,function(_0x5d9951){if(_0x5d9951[_0x0830('0x41')]!==_0x0830('0x50')){var _0x3bdfff={};_0x3bdfff[_0x5d9951['name']]={'$like':'%'+_0x1f4f35[_0x0830('0x45')][_0x0830('0x4e')]+'%'};return _0x3bdfff;}})});}_0x6e0192=_[_0x0830('0x4f')]({},_0x6e0192,_0x1f4f35[_0x0830('0x51')]);var _0x4f4df4={'where':_0x6e0192['where']};return db[_0x0830('0x3e')][_0x0830('0x52')](_0x4f4df4)[_0x0830('0x33')](function(_0x40fb1a){_0x139fed[_0x0830('0x52')]=_0x40fb1a;if(_0x1f4f35[_0x0830('0x45')][_0x0830('0x53')]){_0x6e0192[_0x0830('0x54')]=[{'all':!![]}];}return db[_0x0830('0x3e')][_0x0830('0x55')](_0x6e0192);})[_0x0830('0x33')](function(_0x141a49){_0x139fed['rows']=_0x141a49;return _0x139fed;})[_0x0830('0x33')](respondWithFilteredResult(_0x3cd46a,_0x6e0192))[_0x0830('0x56')](handleError(_0x3cd46a,null));};exports['show']=function(_0x2258db,_0x39b733){var _0x4b40d4={'raw':![],'where':{'id':_0x2258db[_0x0830('0x57')]['id']},'include':[{'model':db['Pause'],'as':_0x0830('0x3c')}]},_0x4864d5={};_0x4864d5[_0x0830('0x42')]=_[_0x0830('0x58')](db[_0x0830('0x3e')][_0x0830('0x3f')]);_0x4864d5[_0x0830('0x45')]=_[_0x0830('0x58')](_0x2258db[_0x0830('0x45')]);_0x4864d5['filters']=_[_0x0830('0x44')](_0x4864d5[_0x0830('0x42')],_0x4864d5[_0x0830('0x45')]);_0x4b40d4['attributes']=_[_0x0830('0x44')](_0x4864d5['model'],qs[_0x0830('0x47')](_0x2258db[_0x0830('0x45')][_0x0830('0x47')]));_0x4b40d4[_0x0830('0x46')]=_0x4b40d4['attributes'][_0x0830('0x48')]?_0x4b40d4[_0x0830('0x46')]:_0x4864d5[_0x0830('0x42')];if(_0x2258db[_0x0830('0x45')]['includeAll']){_0x4b40d4[_0x0830('0x54')]=[{'all':!![]}];}_0x4b40d4=_[_0x0830('0x4f')]({},_0x4b40d4,_0x2258db[_0x0830('0x51')]);return db['WhatsappAccount'][_0x0830('0x59')](_0x4b40d4)[_0x0830('0x33')](handleEntityNotFound(_0x39b733,null))[_0x0830('0x33')](respondWithResult(_0x39b733,null))['catch'](handleError(_0x39b733,null));};exports[_0x0830('0x5a')]=function(_0x3984d1,_0x48fad0){return db[_0x0830('0x3e')][_0x0830('0x5a')](_0x3984d1['body'],{})[_0x0830('0x33')](function(_0x51e3bc){var _0x8b0091=_0x3984d1['user'][_0x0830('0x35')]({'plain':!![]});if(!_0x8b0091)throw new Error(_0x0830('0x5b'));if(_0x8b0091[_0x0830('0x5c')]===_0x0830('0x5d')){var _0x120b94=_0x51e3bc['get']({'plain':!![]});var _0x1cea11='WhatsappAccounts';return db[_0x0830('0x5e')][_0x0830('0x59')]({'where':{'name':_0x1cea11,'userProfileId':_0x8b0091[_0x0830('0x5f')]},'raw':!![]})[_0x0830('0x33')](function(_0x2d7bad){if(_0x2d7bad&&_0x2d7bad['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x120b94[_0x0830('0x39')],'resourceId':_0x120b94['id'],'type':_0x2d7bad[_0x0830('0x39')],'sectionId':_0x2d7bad['id']},{})[_0x0830('0x33')](function(){return _0x51e3bc;});}else{return _0x51e3bc;}})[_0x0830('0x56')](function(_0x2bd1d9){logger[_0x0830('0x25')](_0x0830('0x60'),_0x2bd1d9);throw _0x2bd1d9;});}return _0x51e3bc;})['then'](respondWithResult(_0x48fad0,0xc9))[_0x0830('0x56')](handleError(_0x48fad0,null));};exports['update']=function(_0x26aa57,_0xfda54c){if(_0x26aa57['body']['id']){delete _0x26aa57[_0x0830('0x61')]['id'];}return db['WhatsappAccount']['find']({'where':{'id':_0x26aa57[_0x0830('0x57')]['id']},'include':[{'model':db[_0x0830('0x62')],'as':'mandatoryDispositionPause'}]})[_0x0830('0x33')](handleEntityNotFound(_0xfda54c,null))[_0x0830('0x33')](saveUpdates(_0x26aa57['body'],null))[_0x0830('0x33')](respondWithResult(_0xfda54c,null))[_0x0830('0x56')](handleError(_0xfda54c,null));};exports['destroy']=function(_0xda99b8,_0x51ea96){return db[_0x0830('0x3e')][_0x0830('0x59')]({'where':{'id':_0xda99b8[_0x0830('0x57')]['id']}})[_0x0830('0x33')](handleEntityNotFound(_0x51ea96,null))[_0x0830('0x33')](removeEntity(_0x51ea96,null))['catch'](handleError(_0x51ea96,null));};exports[_0x0830('0x63')]=function(_0xf0ffe5,_0x4e0f30){return db[_0x0830('0x3e')][_0x0830('0x63')]()[_0x0830('0x33')](respondWithResult(_0x4e0f30,null))[_0x0830('0x56')](handleError(_0x4e0f30,null));};exports[_0x0830('0x64')]=function(_0x484d7e,_0x17d4ac,_0x437f20){if(_0x484d7e['body']['id']){delete _0x484d7e[_0x0830('0x61')]['id'];}return db['WhatsappAccount']['find']({'where':{'id':_0x484d7e[_0x0830('0x57')]['id']}})['then'](handleEntityNotFound(_0x17d4ac,null))[_0x0830('0x33')](function(_0x4209e2){if(_0x4209e2){_0x484d7e['body'][_0x0830('0x65')]=_0x4209e2['id'];return db[_0x0830('0x66')][_0x0830('0x5a')](_0x484d7e['body']);}})[_0x0830('0x33')](respondWithResult(_0x17d4ac,null))[_0x0830('0x56')](handleError(_0x17d4ac,null));};exports[_0x0830('0x67')]=function(_0x18cee3,_0x3412db,_0x26a75e){var _0x7d0f42={'raw':![],'where':{}};var _0x5d8081={};var _0x2977c7={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x0830('0x68')]({'where':{'id':_0x18cee3[_0x0830('0x57')]['id']}})[_0x0830('0x33')](handleEntityNotFound(_0x3412db,null))[_0x0830('0x33')](function(_0x43afe8){if(_0x43afe8){_0x5d8081[_0x0830('0x42')]=_['keys'](db[_0x0830('0x66')][_0x0830('0x3f')]);_0x5d8081['query']=_[_0x0830('0x58')](_0x18cee3['query']);_0x5d8081[_0x0830('0x43')]=_[_0x0830('0x44')](_0x5d8081[_0x0830('0x42')],_0x5d8081[_0x0830('0x45')]);_0x7d0f42[_0x0830('0x46')]=_[_0x0830('0x44')](_0x5d8081['model'],qs[_0x0830('0x47')](_0x18cee3[_0x0830('0x45')][_0x0830('0x47')]));_0x7d0f42[_0x0830('0x46')]=_0x7d0f42[_0x0830('0x46')][_0x0830('0x48')]?_0x7d0f42[_0x0830('0x46')]:_0x5d8081[_0x0830('0x42')];if(!_0x18cee3[_0x0830('0x45')][_0x0830('0x49')](_0x0830('0x4a'))){_0x7d0f42[_0x0830('0x2c')]=qs['limit'](_0x18cee3[_0x0830('0x45')][_0x0830('0x2c')]);_0x7d0f42[_0x0830('0x2e')]=qs[_0x0830('0x2e')](_0x18cee3[_0x0830('0x45')][_0x0830('0x2e')]);}_0x7d0f42[_0x0830('0x69')]=qs['sort'](_0x18cee3[_0x0830('0x45')]['sort']);_0x7d0f42[_0x0830('0x4c')]=qs[_0x0830('0x43')](_['pick'](_0x18cee3[_0x0830('0x45')],_0x5d8081['filters']));_0x7d0f42[_0x0830('0x4c')][_0x0830('0x65')]=_0x43afe8['id'];if(_0x18cee3[_0x0830('0x45')][_0x0830('0x4e')]){_0x7d0f42[_0x0830('0x4c')]=_['merge'](_0x7d0f42[_0x0830('0x4c')],{'$or':_[_0x0830('0x3d')](_0x7d0f42[_0x0830('0x46')],function(_0x531b1d){var _0x1173c7={};_0x1173c7[_0x531b1d]={'$like':'%'+_0x18cee3['query']['filter']+'%'};return _0x1173c7;})});}_0x7d0f42=_[_0x0830('0x4f')]({},_0x7d0f42,_0x18cee3[_0x0830('0x51')]);return db[_0x0830('0x66')][_0x0830('0x52')]({'where':_0x7d0f42['where']})[_0x0830('0x33')](function(_0x1fdf83){_0x2977c7[_0x0830('0x52')]=_0x1fdf83;if(_0x18cee3['query'][_0x0830('0x53')]){_0x7d0f42[_0x0830('0x54')]=[{'all':!![]}];}return db[_0x0830('0x66')][_0x0830('0x55')](_0x7d0f42);})[_0x0830('0x33')](function(_0x516688){_0x2977c7[_0x0830('0x6a')]=_0x516688;return _0x2977c7;});}})[_0x0830('0x33')](respondWithFilteredResult(_0x3412db,_0x7d0f42))[_0x0830('0x56')](handleError(_0x3412db,null));};exports[_0x0830('0x6b')]=function(_0x32d8b0,_0x32b1a0,_0x347111){return db[_0x0830('0x3e')]['find']({'where':{'id':_0x32d8b0[_0x0830('0x57')]['id']}})['then'](handleEntityNotFound(_0x32b1a0,null))['then'](function(_0x2871bb){if(_0x2871bb){return _0x2871bb[_0x0830('0x6b')](_0x32d8b0[_0x0830('0x45')]['ids']);}})['then'](respondWithStatusCode(_0x32b1a0,null))['catch'](handleError(_0x32b1a0,null));};exports[_0x0830('0x6c')]=function(_0x4ae0ab,_0x262226,_0x2dd71f){if(_0x4ae0ab['body']['id']){delete _0x4ae0ab[_0x0830('0x61')]['id'];}return db['WhatsappAccount'][_0x0830('0x59')]({'where':{'id':_0x4ae0ab[_0x0830('0x57')]['id']}})[_0x0830('0x33')](handleEntityNotFound(_0x262226,null))[_0x0830('0x33')](function(_0x23d593){if(_0x23d593){_0x4ae0ab[_0x0830('0x61')][_0x0830('0x65')]=_0x23d593['id'];return db[_0x0830('0x6d')][_0x0830('0x5a')](_0x4ae0ab['body']);}})[_0x0830('0x33')](respondWithResult(_0x262226,null))[_0x0830('0x56')](handleError(_0x262226,null));};exports[_0x0830('0x6e')]=function(_0xfc56bb,_0x508f68,_0x562a5c){var _0xdc0564={'raw':![],'where':{}};var _0x32e66e={};var _0x436d60={'count':0x0,'rows':[]};return db[_0x0830('0x3e')][_0x0830('0x68')]({'where':{'id':_0xfc56bb[_0x0830('0x57')]['id']}})[_0x0830('0x33')](handleEntityNotFound(_0x508f68,null))[_0x0830('0x33')](function(_0x56bcfb){if(_0x56bcfb){_0x32e66e[_0x0830('0x42')]=_['keys'](db['CannedAnswer'][_0x0830('0x3f')]);_0x32e66e[_0x0830('0x45')]=_[_0x0830('0x58')](_0xfc56bb[_0x0830('0x45')]);_0x32e66e[_0x0830('0x43')]=_[_0x0830('0x44')](_0x32e66e[_0x0830('0x42')],_0x32e66e[_0x0830('0x45')]);_0xdc0564['attributes']=_[_0x0830('0x44')](_0x32e66e[_0x0830('0x42')],qs[_0x0830('0x47')](_0xfc56bb['query'][_0x0830('0x47')]));_0xdc0564[_0x0830('0x46')]=_0xdc0564[_0x0830('0x46')][_0x0830('0x48')]?_0xdc0564['attributes']:_0x32e66e['model'];if(!_0xfc56bb[_0x0830('0x45')][_0x0830('0x49')](_0x0830('0x4a'))){_0xdc0564[_0x0830('0x2c')]=qs[_0x0830('0x2c')](_0xfc56bb[_0x0830('0x45')][_0x0830('0x2c')]);_0xdc0564[_0x0830('0x2e')]=qs[_0x0830('0x2e')](_0xfc56bb[_0x0830('0x45')][_0x0830('0x2e')]);}_0xdc0564[_0x0830('0x69')]=qs[_0x0830('0x4b')](_0xfc56bb[_0x0830('0x45')][_0x0830('0x4b')]);_0xdc0564['where']=qs[_0x0830('0x43')](_[_0x0830('0x4d')](_0xfc56bb[_0x0830('0x45')],_0x32e66e['filters']));_0xdc0564[_0x0830('0x4c')][_0x0830('0x65')]=_0x56bcfb['id'];if(_0xfc56bb[_0x0830('0x45')][_0x0830('0x4e')]){_0xdc0564[_0x0830('0x4c')]=_[_0x0830('0x4f')](_0xdc0564['where'],{'$or':_[_0x0830('0x3d')](_0xdc0564['attributes'],function(_0x385b5b){var _0x150012={};_0x150012[_0x385b5b]={'$like':'%'+_0xfc56bb[_0x0830('0x45')][_0x0830('0x4e')]+'%'};return _0x150012;})});}_0xdc0564=_[_0x0830('0x4f')]({},_0xdc0564,_0xfc56bb[_0x0830('0x51')]);return db['CannedAnswer']['count']({'where':_0xdc0564[_0x0830('0x4c')]})['then'](function(_0x15b0e2){_0x436d60[_0x0830('0x52')]=_0x15b0e2;if(_0xfc56bb[_0x0830('0x45')][_0x0830('0x53')]){_0xdc0564[_0x0830('0x54')]=[{'all':!![]}];}return db['CannedAnswer'][_0x0830('0x55')](_0xdc0564);})[_0x0830('0x33')](function(_0x246ba9){_0x436d60[_0x0830('0x6a')]=_0x246ba9;return _0x436d60;});}})[_0x0830('0x33')](respondWithFilteredResult(_0x508f68,_0xdc0564))[_0x0830('0x56')](handleError(_0x508f68,null));};exports[_0x0830('0x6f')]=function(_0x2ebf6e,_0x3c9380,_0x3d0851){return db['WhatsappAccount'][_0x0830('0x59')]({'where':{'id':_0x2ebf6e[_0x0830('0x57')]['id']}})[_0x0830('0x33')](handleEntityNotFound(_0x3c9380,null))[_0x0830('0x33')](function(_0x6ca111){if(_0x6ca111){return _0x6ca111[_0x0830('0x6f')](_0x2ebf6e[_0x0830('0x45')][_0x0830('0x70')]);}})[_0x0830('0x33')](respondWithStatusCode(_0x3c9380,null))[_0x0830('0x56')](handleError(_0x3c9380,null));};exports[_0x0830('0x71')]=function(_0x38c8ff,_0x3345bf,_0x3b4d9e){return db[_0x0830('0x3e')][_0x0830('0x59')]({'where':{'id':_0x38c8ff[_0x0830('0x57')]['id']}})[_0x0830('0x33')](handleEntityNotFound(_0x3345bf,null))['then'](function(_0xb1775f){if(_0xb1775f){return _0xb1775f[_0x0830('0x71')](_0x38c8ff['body'][_0x0830('0x70')],_[_0x0830('0x72')](_0x38c8ff[_0x0830('0x61')],[_0x0830('0x70'),'id'])||{})['spread'](function(_0x195adc){for(var _0x23e9ea=0x0;_0x23e9ea<_0x38c8ff[_0x0830('0x61')][_0x0830('0x70')][_0x0830('0x48')];_0x23e9ea+=0x1){socket[_0x0830('0x73')]('userWhatsappAccount:save',{'UserId':Number(_0x38c8ff[_0x0830('0x61')][_0x0830('0x70')][_0x23e9ea]),'WhatsappAccountId':Number(_0x38c8ff[_0x0830('0x57')]['id'])});}return _0x195adc;});}})[_0x0830('0x33')](respondWithResult(_0x3345bf,null))[_0x0830('0x56')](handleError(_0x3345bf,null));};exports[_0x0830('0x74')]=function(_0x4cfd26,_0x13fd2b,_0x4371ee){return db[_0x0830('0x3e')]['find']({'where':{'id':_0x4cfd26[_0x0830('0x57')]['id']}})[_0x0830('0x33')](handleEntityNotFound(_0x13fd2b,null))[_0x0830('0x33')](function(_0x4a8d66){if(_0x4a8d66){return _0x4a8d66[_0x0830('0x74')](_0x4cfd26[_0x0830('0x45')][_0x0830('0x70')])[_0x0830('0x33')](function(){if(_[_0x0830('0x75')](_0x4cfd26[_0x0830('0x45')][_0x0830('0x70')])){for(var _0x276cea=0x0;_0x276cea<_0x4cfd26[_0x0830('0x45')][_0x0830('0x70')][_0x0830('0x48')];_0x276cea+=0x1){socket['emit'](_0x0830('0x76'),{'UserId':Number(_0x4cfd26['query'][_0x0830('0x70')][_0x276cea]),'WhatsappAccountId':Number(_0x4cfd26[_0x0830('0x57')]['id'])});}}else{socket['emit']('userWhatsappAccount:remove',{'UserId':Number(_0x4cfd26[_0x0830('0x45')][_0x0830('0x70')]),'WhatsappAccountId':Number(_0x4cfd26[_0x0830('0x57')]['id'])});}});}})[_0x0830('0x33')](respondWithStatusCode(_0x13fd2b,null))[_0x0830('0x56')](handleError(_0x13fd2b,null));};exports[_0x0830('0x77')]=function(_0x195906,_0x53a817,_0x136635){var _0x37ed91={};var _0x269250={};var _0x2d779d;var _0x137beb;return db[_0x0830('0x3e')][_0x0830('0x68')]({'where':{'id':_0x195906[_0x0830('0x57')]['id']}})[_0x0830('0x33')](handleEntityNotFound(_0x53a817,null))['then'](function(_0x4aa0ca){if(_0x4aa0ca){_0x2d779d=_0x4aa0ca;_0x269250[_0x0830('0x42')]=_[_0x0830('0x58')](db[_0x0830('0x78')][_0x0830('0x3f')]);_0x269250[_0x0830('0x45')]=_[_0x0830('0x58')](_0x195906['query']);_0x269250[_0x0830('0x43')]=_[_0x0830('0x44')](_0x269250[_0x0830('0x42')],_0x269250[_0x0830('0x45')]);_0x37ed91[_0x0830('0x46')]=_[_0x0830('0x44')](_0x269250[_0x0830('0x42')],qs[_0x0830('0x47')](_0x195906[_0x0830('0x45')][_0x0830('0x47')]));_0x37ed91[_0x0830('0x46')]=_0x37ed91[_0x0830('0x46')]['length']?_0x37ed91['attributes']:_0x269250['model'];_0x37ed91[_0x0830('0x69')]=qs[_0x0830('0x4b')](_0x195906[_0x0830('0x45')][_0x0830('0x4b')]);_0x37ed91['where']=qs[_0x0830('0x43')](_[_0x0830('0x4d')](_0x195906[_0x0830('0x45')],_0x269250[_0x0830('0x43')]));if(_0x195906['query'][_0x0830('0x4e')]){_0x37ed91[_0x0830('0x4c')]=_['merge'](_0x37ed91[_0x0830('0x4c')],{'$or':_[_0x0830('0x3d')](_0x37ed91[_0x0830('0x46')],function(_0x40e70c){var _0x3e243e={};_0x3e243e[_0x40e70c]={'$like':'%'+_0x195906[_0x0830('0x45')][_0x0830('0x4e')]+'%'};return _0x3e243e;})});}_0x37ed91=_[_0x0830('0x4f')]({},_0x37ed91,_0x195906[_0x0830('0x51')]);return _0x2d779d[_0x0830('0x77')](_0x37ed91);}})[_0x0830('0x33')](function(_0x2cd58a){if(_0x2cd58a){_0x137beb=_0x2cd58a['length'];if(!_0x195906['query']['hasOwnProperty']('nolimit')){_0x37ed91[_0x0830('0x2c')]=qs['limit'](_0x195906[_0x0830('0x45')]['limit']);_0x37ed91[_0x0830('0x2e')]=qs[_0x0830('0x2e')](_0x195906[_0x0830('0x45')][_0x0830('0x2e')]);}return _0x2d779d[_0x0830('0x77')](_0x37ed91);}})[_0x0830('0x33')](function(_0x2c90dd){if(_0x2c90dd){return _0x2c90dd?{'count':_0x137beb,'rows':_0x2c90dd}:null;}})[_0x0830('0x33')](respondWithResult(_0x53a817,null))[_0x0830('0x56')](handleError(_0x53a817,null));};exports[_0x0830('0x79')]=function(_0x5c72ab,_0x35f11a){var _0x36dc54=_0x5c72ab[_0x0830('0x57')]['id'];var _0x2d5793=_0x5c72ab[_0x0830('0x61')];var _0x113a1a=0xc8;var _0x1082ac=null;return db[_0x0830('0x7a')][_0x0830('0x7b')]({'isolationLevel':db[_0x0830('0x7a')][_0x0830('0x7c')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x510c00){return db[_0x0830('0x3e')][_0x0830('0x68')]({'where':{'id':_0x36dc54},'transaction':_0x510c00})['then'](function(_0x4dc8a1){if(_0x4dc8a1){return db['WhatsappApplication']['destroy']({'where':{'WhatsappAccountId':_0x36dc54},'transaction':_0x510c00})[_0x0830('0x33')](function(){var _0x4a4925=_[_0x0830('0x3d')](_0x2d5793,function(_0x460585){_0x460585[_0x0830('0x65')]=_0x36dc54;return _0x460585;});return db[_0x0830('0x7d')]['bulkCreate'](_0x4a4925,{'transaction':_0x510c00});});}else{_0x113a1a=0x194;_0x1082ac=[];}});})[_0x0830('0x33')](function(){if(_0x113a1a!==0x194){return db['WhatsappApplication'][_0x0830('0x7e')]({'where':{'WhatsappAccountId':_0x36dc54},'order':_0x0830('0x7f')})[_0x0830('0x33')](function(_0xeb54b7){_0x1082ac=_0xeb54b7;});}})['catch'](function(_0x2f3887){_0x113a1a=0x1f4;logger['error'](_0x2f3887['stack']);if(_0x2f3887[_0x0830('0x39')]){delete _0x2f3887[_0x0830('0x39')];}_0x1082ac=_0x2f3887;})['finally'](function(){if(_0x1082ac===null){_0x35f11a['sendStatus'](_0x113a1a);}else{if(_0x113a1a===0x1f4){_0x35f11a['status'](_0x113a1a)['send'](_0x1082ac);}else{_0x35f11a['status'](_0x113a1a)[_0x0830('0x2b')](_0x1082ac);}}});};exports['getApplications']=function(_0x3e34de,_0x2cb164,_0x3962ca){var _0x403ec9={};var _0xba4b0c={};var _0x6649e9;var _0x117867;return db['WhatsappAccount'][_0x0830('0x68')]({'where':{'id':_0x3e34de['params']['id']}})['then'](handleEntityNotFound(_0x2cb164,null))[_0x0830('0x33')](function(_0x5b7b7d){if(_0x5b7b7d){_0x6649e9=_0x5b7b7d;_0xba4b0c[_0x0830('0x42')]=_[_0x0830('0x58')](db[_0x0830('0x7d')][_0x0830('0x3f')]);_0xba4b0c[_0x0830('0x45')]=_['keys'](_0x3e34de[_0x0830('0x45')]);_0xba4b0c['filters']=_[_0x0830('0x44')](_0xba4b0c[_0x0830('0x42')],_0xba4b0c[_0x0830('0x45')]);_0x403ec9[_0x0830('0x46')]=_[_0x0830('0x44')](_0xba4b0c['model'],qs[_0x0830('0x47')](_0x3e34de[_0x0830('0x45')][_0x0830('0x47')]));_0x403ec9[_0x0830('0x46')]=_0x403ec9[_0x0830('0x46')][_0x0830('0x48')]?_0x403ec9['attributes']:_0xba4b0c[_0x0830('0x42')];_0x403ec9[_0x0830('0x69')]=qs['sort'](_0x3e34de[_0x0830('0x45')]['sort']);_0x403ec9[_0x0830('0x4c')]=qs[_0x0830('0x43')](_['pick'](_0x3e34de['query'],_0xba4b0c['filters']));if(_0x3e34de[_0x0830('0x45')][_0x0830('0x4e')]){_0x403ec9[_0x0830('0x4c')]=_['merge'](_0x403ec9[_0x0830('0x4c')],{'$or':_[_0x0830('0x3d')](_0x403ec9[_0x0830('0x46')],function(_0x4cfc04){var _0x9daab1={};_0x9daab1[_0x4cfc04]={'$like':'%'+_0x3e34de[_0x0830('0x45')][_0x0830('0x4e')]+'%'};return _0x9daab1;})});}_0x403ec9=_[_0x0830('0x4f')]({},_0x403ec9,_0x3e34de[_0x0830('0x51')]);return _0x6649e9[_0x0830('0x80')](_0x403ec9);}})[_0x0830('0x33')](function(_0x12f815){if(_0x12f815){_0x117867=_0x12f815[_0x0830('0x48')];if(!_0x3e34de['query'][_0x0830('0x49')](_0x0830('0x4a'))){_0x403ec9[_0x0830('0x2c')]=qs['limit'](_0x3e34de['query']['limit']);_0x403ec9['offset']=qs[_0x0830('0x2e')](_0x3e34de['query'][_0x0830('0x2e')]);}return _0x6649e9[_0x0830('0x80')](_0x403ec9);}})[_0x0830('0x33')](function(_0x482c69){if(_0x482c69){return _0x482c69?{'count':_0x117867,'rows':_0x482c69}:null;}})[_0x0830('0x33')](respondWithResult(_0x2cb164,null))[_0x0830('0x56')](handleError(_0x2cb164,null));};exports[_0x0830('0x81')]=function(_0x150e42,_0x20043c,_0x557460){var _0x57b16a={'channel':_0x0830('0x82')};var _0x9133c6=[];var _0x50ebc4=[];var _0x2fd9ff={};return db[_0x0830('0x3e')][_0x0830('0x59')]({'where':{'id':_0x150e42[_0x0830('0x57')]['id']},'include':[{'model':db[_0x0830('0x7d')],'as':_0x0830('0x83')}]})[_0x0830('0x33')](handleEntityNotFound(_0x20043c,null))['then'](function(_0x5a4f8c){_0x57b16a[_0x0830('0x84')]=_0x5a4f8c;if(_0x57b16a[_0x0830('0x84')]&&_0x57b16a['account'][_0x0830('0x41')]===_0x0830('0x85')&&_0x150e42[_0x0830('0x61')]['statuses']){if(_0x150e42[_0x0830('0x61')][_0x0830('0x86')]['length']===0x0)return;if(_0x150e42[_0x0830('0x61')]['statuses'][0x0][_0x0830('0x87')]!=='read')return;return db[_0x0830('0x88')][_0x0830('0x89')]({'read':!![],'readAt':_0x150e42[_0x0830('0x61')]['statuses'][0x0][_0x0830('0x8a')]},{'where':{'messageId':_0x150e42[_0x0830('0x61')][_0x0830('0x86')][0x0][_0x0830('0x8b')]},'individualHooks':!![]})[_0x0830('0x33')](function(_0x482cb3){return _0x20043c[_0x0830('0x29')](0xc8)[_0x0830('0x2b')](_0x482cb3);});}_0x57b16a[_0x0830('0x8c')]=_[_0x0830('0x8d')](_0x5a4f8c[_0x0830('0x83')],[_0x0830('0x7f')],[_0x0830('0x8e')]);if(_0x57b16a[_0x0830('0x84')][_0x0830('0x83')]){delete _0x57b16a['account']['Applications'];}return db['CmContact'][_0x0830('0x63')]()['then'](function(_0x475daf){if(!_0x475daf){throw new db[(_0x0830('0x8f'))][(_0x0830('0x90'))](_0x0830('0x91'));}_0x9133c6=_[_0x0830('0x92')](_[_0x0830('0x58')](_0x475daf),['createdAt',_0x0830('0x93')]);_0x50ebc4=_['difference'](_['keys'](_0x475daf),[_0x0830('0x94'),'updatedAt',_0x0830('0x95'),_0x0830('0x96')]);_0x57b16a[_0x0830('0x61')]={'mapKey':_0x0830('0x97')};if(_0x57b16a[_0x0830('0x84')]&&_0x57b16a[_0x0830('0x84')][_0x0830('0x41')]==='twilio'){_0x57b16a[_0x0830('0x61')][_0x0830('0x98')]=_0x150e42[_0x0830('0x61')]['From'][_0x0830('0x99')](_0x0830('0x9a'),'');_0x57b16a[_0x0830('0x61')][_0x0830('0x61')]=_0x150e42[_0x0830('0x61')][_0x0830('0x9b')];_0x57b16a[_0x0830('0x61')][_0x0830('0x9c')]=_0x150e42[_0x0830('0x61')][_0x0830('0x9d')];}if(_0x57b16a[_0x0830('0x84')]&&_0x57b16a[_0x0830('0x84')][_0x0830('0x41')]==='sinch'){_0x57b16a[_0x0830('0x61')][_0x0830('0x98')]=_0x150e42[_0x0830('0x61')][_0x0830('0x9e')][0x0][_0x0830('0x98')];_0x57b16a[_0x0830('0x61')][_0x0830('0x61')]=_0x150e42[_0x0830('0x61')][_0x0830('0x9e')][0x0]['message'][_0x0830('0x61')];_0x57b16a['body'][_0x0830('0x9c')]=_0x150e42[_0x0830('0x61')][_0x0830('0x9e')][0x0][_0x0830('0x8b')];}if(_0x57b16a[_0x0830('0x61')]['id']){delete _0x57b16a['body']['id'];}if(_[_0x0830('0x9f')](_0x57b16a[_0x0830('0x61')][_0x0830('0x98')])){throw new db[(_0x0830('0x8f'))][(_0x0830('0x90'))](_0x0830('0xa0'));}if(_[_0x0830('0x9f')](_0x57b16a[_0x0830('0x61')][_0x0830('0x61')])||_0x57b16a['body'][_0x0830('0x61')]===''){throw new db['Sequelize']['ValidationError'](_0x0830('0xa1'));}if(_[_0x0830('0x9f')](_0x57b16a[_0x0830('0x61')][_0x0830('0xa2')])){throw new db['Sequelize']['ValidationError'](_0x0830('0xa3')+_0x50ebc4);}if(!_[_0x0830('0xa4')](_0x50ebc4,_0x57b16a[_0x0830('0x61')]['mapKey'])){throw new db['Sequelize'][(_0x0830('0x90'))](_0x0830('0xa5')+_0x50ebc4);}_0x2fd9ff[_0x57b16a[_0x0830('0x61')][_0x0830('0xa2')]]=_0x57b16a[_0x0830('0x61')]['from'];return db[_0x0830('0xa6')]['find']({'where':{'id':_0x57b16a[_0x0830('0x84')][_0x0830('0x96')]},'include':[{'model':db[_0x0830('0xa7')],'as':_0x0830('0xa8'),'where':_0x2fd9ff,'limit':0x1,'order':[[_0x0830('0x93'),_0x0830('0xa9')]]}]});})[_0x0830('0x33')](handleEntityNotFound(_0x20043c,null))[_0x0830('0x33')](function(_0x5d102f){if(_0x5d102f){_0x57b16a[_0x0830('0xaa')]=_[_0x0830('0x72')](_0x5d102f,['Contacts']);if(_0x5d102f[_0x0830('0xa8')]['length']){return _0x5d102f[_0x0830('0xa8')][0x0];}var _0x494751=_[_0x0830('0x17')](_0x57b16a[_0x0830('0x61')],{'firstName':_0x57b16a['body'][_0x0830('0x98')],'ListId':_0x5d102f['id']});_0x494751[_0x57b16a[_0x0830('0x61')][_0x0830('0xa2')]]=_0x57b16a[_0x0830('0x61')][_0x0830('0x98')];return db['CmContact']['create'](_0x494751,{'fields':_0x9133c6,'raw':!![]});}})['then'](handleEntityNotFound(_0x20043c,null))[_0x0830('0x33')](function(_0x4ba0e0){if(_0x4ba0e0){_0x57b16a['contact']=_0x4ba0e0;var _0x2f9012={'ContactId':_0x4ba0e0['id'],'phone':_0x57b16a['body'][_0x0830('0x98')],'WhatsappAccountId':_0x150e42[_0x0830('0x57')]['id']};var _0x120066={'ContactId':_0x4ba0e0['id'],'WhatsappAccountId':_0x150e42[_0x0830('0x57')]['id'],'closed':![]};return db[_0x0830('0xab')][_0x0830('0x59')]({'where':_0x120066})[_0x0830('0x33')](function(_0xc2da5c){if(_0xc2da5c){return[_0xc2da5c,![]];}return db[_0x0830('0xab')][_0x0830('0x5a')](_0x2f9012)[_0x0830('0x33')](function(_0x3b8946){return[_0x3b8946,!![]];});});}})[_0x0830('0xac')](function(_0x2bea70,_0x2130a3){_0x57b16a['interaction']=_0x2bea70[_0x0830('0x35')]({'plain':!![]});_0x57b16a[_0x0830('0xad')]['created']=![];if(_0x2130a3){if(_0x57b16a[_0x0830('0x84')][_0x0830('0xae')]){_0x57b16a['applications'][_0x0830('0xaf')]({'id':0x0,'priority':_0x57b16a[_0x0830('0x8c')]['length']+0x1,'app':_0x0830('0xb0'),'appdata':_0x0830('0xb1'),'interval':'*,*,*,*'});}_0x57b16a['interaction'][_0x0830('0xb2')]=!![];}return db['WhatsappMessage'][_0x0830('0x5a')]({'phone':_0x57b16a[_0x0830('0x61')][_0x0830('0x98')],'messageId':_0x57b16a[_0x0830('0x61')]['messageId'],'body':_0x57b16a[_0x0830('0x61')][_0x0830('0x61')],'WhatsappAccountId':_0x150e42[_0x0830('0x57')]['id'],'WhatsappInteractionId':_0x2bea70['id'],'direction':'in','ContactId':_0x2bea70['ContactId'],'AttachmentId':_0x57b16a[_0x0830('0x61')][_0x0830('0xb3')]});})[_0x0830('0x33')](function(_0x461282){_0x57b16a[_0x0830('0x26')]=_0x461282;if(_0x57b16a[_0x0830('0xad')][_0x0830('0xb4')]){return db[_0x0830('0x78')][_0x0830('0x59')]({'attributes':['id',_0x0830('0x39')],'where':{'id':_0x57b16a[_0x0830('0xad')][_0x0830('0xb4')]}})[_0x0830('0x33')](function(_0x472485){if(_0x472485){_0x57b16a[_0x0830('0x8c')]['unshift']({'id':0x0,'priority':0x0,'app':_0x0830('0xb5'),'appdata':_0x472485[_0x0830('0x39')]+','+(_0x57b16a[_0x0830('0x84')][_0x0830('0xb6')]||0xa),'interval':_0x0830('0xb7')});}return respondWithRpcPromise(_0x0830('0xb8'),_0x0830('0xb9'),_0x57b16a);});}return respondWithRpcPromise('Start','startRouting',_0x57b16a);})['then'](function(_0x4b5a51){if(_0x4b5a51){var _0x1ae5a6=0xc8;var _0x34f63d='receiveMessage';logger[_0x0830('0x1f')](_0x0830('0xba'),_0x34f63d,_0x1ae5a6,_0x0830('0xbb'));logger['debug'](_0x0830('0xbc'),_0x34f63d,_0x1ae5a6,_0x0830('0xbb'),JSON[_0x0830('0x23')](_0x4b5a51));if(_0x57b16a['account'][_0x0830('0x41')]===_0x0830('0xbd')){return _0x20043c[_0x0830('0x29')](_0x1ae5a6)[_0x0830('0x2f')](_0x0830('0xbe'),_0x0830('0xbf'))['send']('\x0a');}else{return _0x20043c[_0x0830('0x29')](_0x1ae5a6)['json'](_0x4b5a51);}}});})[_0x0830('0x56')](handleError(_0x20043c,null));};exports['send']=function(_0x4718f5,_0x44828d,_0x5853c6){var _0x5ce438,_0x961a53,_0x1c5374;if(_[_0x0830('0x9f')](_0x4718f5['body'][_0x0830('0x61')])||_0x4718f5[_0x0830('0x61')][_0x0830('0x61')]===''){throw new db['Sequelize'][(_0x0830('0x90'))](_0x0830('0xa1'));}if(_[_0x0830('0x9f')](_0x4718f5['body']['to'])){throw new db[(_0x0830('0x8f'))]['ValidationError'](_0x0830('0xc0'));}_0x5ce438=_0x4718f5[_0x0830('0x61')]['to'];return db[_0x0830('0x3e')][_0x0830('0x59')]({'where':{'id':_0x4718f5['params']['id']},'include':[{'model':db[_0x0830('0xa6')],'as':_0x0830('0xc1'),'include':[{'model':db[_0x0830('0xa7')],'as':'Contacts','where':{'mobile':_0x5ce438},'limit':0x1,'order':[['updatedAt',_0x0830('0xa9')]]}]}]})['then'](handleEntityNotFound(_0x44828d,null))[_0x0830('0x33')](function(_0x3ee673){if(_0x3ee673&&_0x3ee673[_0x0830('0xc1')]){_0x961a53=_0x3ee673[_0x0830('0x35')]({'plain':!![]});if(_0x961a53[_0x0830('0xc1')]&&_0x961a53[_0x0830('0xc1')][_0x0830('0xa8')]['length']){return _0x961a53['List'][_0x0830('0xa8')][0x0];}return db[_0x0830('0xa7')][_0x0830('0x5a')](_[_0x0830('0x17')](_0x4718f5[_0x0830('0x61')],{'firstName':_0x5ce438,'mobile':_0x5ce438,'phone':_0x5ce438,'ListId':_0x961a53['ListId']}));}})[_0x0830('0x33')](handleEntityNotFound(_0x44828d,null))[_0x0830('0x33')](function(_0x52c689){if(_0x52c689){_0x1c5374=_0x52c689;return db[_0x0830('0xab')]['find']({'where':{'ContactId':_0x1c5374['id'],'closed':![],'WhatsappAccountId':_0x961a53['id']}})[_0x0830('0x33')](function(_0x43ec19){if(_0x43ec19){return[_0x43ec19,![]];}return db[_0x0830('0xab')][_0x0830('0x5a')]({'UserId':_0x4718f5[_0x0830('0x5d')]['id'],'ContactId':_0x1c5374['id'],'WhatsappAccountId':_0x961a53['id'],'phone':_0x5ce438,'firstMsgDirection':_0x0830('0xc2'),'Messages':[_[_0x0830('0x4f')](_0x4718f5[_0x0830('0x61')],{'read':![],'body':_0x4718f5[_0x0830('0x61')][_0x0830('0x61')],'phone':_0x5ce438,'WhatsappAccountId':_0x961a53['id'],'UserId':_0x4718f5[_0x0830('0x5d')]['id'],'ContactId':_0x1c5374['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':_0x0830('0xc3')}]})['then'](function(_0x191d83){return[_0x191d83,!![]];});});}})['spread'](function(_0x2a89e4,_0x51054b){if(_0x51054b){return _0x2a89e4;}return db[_0x0830('0x88')]['create'](_['merge'](_0x4718f5[_0x0830('0x61')],{'read':![],'body':_0x4718f5[_0x0830('0x61')][_0x0830('0x61')],'phone':_0x5ce438,'WhatsappAccountId':_0x961a53['id'],'WhatsappInteractionId':_0x2a89e4['id'],'UserId':_0x4718f5[_0x0830('0x5d')]['id'],'ContactId':_0x1c5374['id']}))[_0x0830('0x33')](function(_0x380f2a){_0x2a89e4[_0x0830('0xc4')][_0x0830('0xc3')]=[];_0x2a89e4[_0x0830('0xc4')][_0x0830('0xc3')][_0x0830('0xaf')](_0x380f2a[_0x0830('0xc4')]);return _0x2a89e4;});})[_0x0830('0x33')](respondWithResult(_0x44828d,null))[_0x0830('0x56')](handleError(_0x44828d,null));}; \ No newline at end of file +var _0x5218=['query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','show','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','params','describe','WhatsappAccountId','getDispositions','findOne','Disposition','options','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','hasOwnProperty','removeAnswers','addAgents','spread','emit','removeAgents','isArray','userWhatsappAccount:remove','User','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','notify','whatsapp','Applications','account','sinch','statuses','state','timestamp','message_id','applications','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','twilio','from','replace','whatsapp:','Body','messageId','MessageSid','notifications','isNil','mapKey','CmList','Contacts','DESC','list','omit','defaults','contact','interaction','created','autoclose','close','unmanaged','*,*,*,*','ContactId','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','startRouting','Start','receiveMessage','text/xml','send','\x0a','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','List','WhatsappInteraction','WhatsappMessage','Messages','dataValues','push','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','http','then','info','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappAccount,\x20%s,\x20%s','message','request\x20sent','catch','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','destroy','get','WhatsappAccounts','stack','name','index','Pause','mandatoryDispositionPause','WhatsappAccount','type','key','model','map'];(function(_0x35f362,_0x4a283a){var _0x3a725a=function(_0x4b4d81){while(--_0x4b4d81){_0x35f362['push'](_0x35f362['shift']());}};_0x3a725a(++_0x4a283a);}(_0x5218,0x13d));var _0x8521=function(_0x16fb6f,_0x256abb){_0x16fb6f=_0x16fb6f-0x0;var _0x3f30eb=_0x5218[_0x16fb6f];return _0x3f30eb;};'use strict';var emlformat=require(_0x8521('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8521('0x1'));var jsonpatch=require(_0x8521('0x2'));var rp=require(_0x8521('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8521('0x4'));var util=require(_0x8521('0x5'));var path=require(_0x8521('0x6'));var sox=require(_0x8521('0x7'));var csv=require(_0x8521('0x8'));var ejs=require(_0x8521('0x9'));var fs=require('fs');var fs_extra=require(_0x8521('0xa'));var _=require(_0x8521('0xb'));var squel=require(_0x8521('0xc'));var crypto=require('crypto');var jsforce=require(_0x8521('0xd'));var deskjs=require(_0x8521('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8521('0xf'));var authService=require(_0x8521('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x8521('0x11'));var hardwareService=require(_0x8521('0x12'));var logger=require(_0x8521('0x13'))('api');var utils=require(_0x8521('0x14'));var config=require(_0x8521('0x15'));var licenseUtil=require(_0x8521('0x16'));var db=require(_0x8521('0x17'))['db'];config[_0x8521('0x18')]=_['defaults'](config[_0x8521('0x18')],{'host':_0x8521('0x19'),'port':0x18eb});var socket=require(_0x8521('0x1a'))(new Redis(config[_0x8521('0x18')]));require(_0x8521('0x1b'))[_0x8521('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x8521('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0x33d8b4,_0x4e65f9,_0xe9176d,_0x4081c1){return new BPromise(function(_0x15395c,_0x5576c6){var _0x5c810e=_0x4081c1||client;return _0x5c810e['request'](_0x33d8b4,_0xe9176d)[_0x8521('0x1e')](function(_0x179bcf){logger[_0x8521('0x1f')]('WhatsappAccount,\x20%s,\x20%s',_0x4e65f9,'request\x20sent');logger[_0x8521('0x20')](_0x8521('0x21'),_0x4e65f9,'request\x20sent',JSON[_0x8521('0x22')](_0x179bcf));if(_0x179bcf[_0x8521('0x23')]){if(_0x179bcf[_0x8521('0x23')][_0x8521('0x24')]===0x1f4){logger[_0x8521('0x23')](_0x8521('0x25'),_0x4e65f9,_0x179bcf['error'][_0x8521('0x26')]);return _0x5576c6(_0x179bcf[_0x8521('0x23')][_0x8521('0x26')]);}logger[_0x8521('0x23')](_0x8521('0x25'),_0x4e65f9,_0x179bcf[_0x8521('0x23')][_0x8521('0x26')]);return _0x15395c(_0x179bcf[_0x8521('0x23')][_0x8521('0x26')]);}else{logger[_0x8521('0x1f')](_0x8521('0x25'),_0x4e65f9,_0x8521('0x27'));_0x15395c(_0x179bcf['result'][_0x8521('0x26')]);}})[_0x8521('0x28')](function(_0x57039b){logger[_0x8521('0x23')](_0x8521('0x25'),_0x4e65f9,_0x57039b);_0x5576c6(_0x57039b);});});}function respondWithStatusCode(_0x47e3ad,_0x452720){_0x452720=_0x452720||0xcc;return function(_0x1cff70){if(_0x1cff70){return _0x47e3ad[_0x8521('0x29')](_0x452720);}return _0x47e3ad[_0x8521('0x2a')](_0x452720)[_0x8521('0x2b')]();};}function respondWithResult(_0x467887,_0x226c37){_0x226c37=_0x226c37||0xc8;return function(_0x2cd302){if(_0x2cd302){return _0x467887[_0x8521('0x2a')](_0x226c37)[_0x8521('0x2c')](_0x2cd302);}};}function respondWithFilteredResult(_0x4b3409,_0x472af7){return function(_0x5e3274){if(_0x5e3274){var _0x12a778=typeof _0x472af7[_0x8521('0x2d')]==='undefined'&&typeof _0x472af7[_0x8521('0x2e')]===_0x8521('0x2f');var _0x525937=_0x5e3274['count'];var _0x346321=_0x12a778?0x0:_0x472af7['offset'];var _0x43b215=_0x12a778?_0x5e3274[_0x8521('0x30')]:_0x472af7[_0x8521('0x2d')]+_0x472af7[_0x8521('0x2e')];var _0x5f34ce;if(_0x43b215>=_0x525937){_0x43b215=_0x525937;_0x5f34ce=0xc8;}else{_0x5f34ce=0xce;}_0x4b3409[_0x8521('0x2a')](_0x5f34ce);return _0x4b3409[_0x8521('0x31')](_0x8521('0x32'),_0x346321+'-'+_0x43b215+'/'+_0x525937)[_0x8521('0x2c')](_0x5e3274);}return null;};}function patchUpdates(_0x58612d){return function(_0x4baac1){try{jsonpatch['apply'](_0x4baac1,_0x58612d,!![]);}catch(_0x86d992){return BPromise[_0x8521('0x33')](_0x86d992);}return _0x4baac1[_0x8521('0x34')]();};}function saveUpdates(_0x1c0802,_0x3ebd35){return function(_0x5c4a9e){if(_0x5c4a9e){return _0x5c4a9e[_0x8521('0x35')](_0x1c0802)[_0x8521('0x1e')](function(_0x34da02){return _0x34da02;});}return null;};}function removeEntity(_0x121ab4,_0x266209){return function(_0x5a4722){if(_0x5a4722){return _0x5a4722[_0x8521('0x36')]()[_0x8521('0x1e')](function(){var _0x3c69df=_0x5a4722[_0x8521('0x37')]({'plain':!![]});var _0x1fab14=_0x8521('0x38');return db['UserProfileResource']['destroy']({'where':{'type':_0x1fab14,'resourceId':_0x3c69df['id']}})['then'](function(){return _0x5a4722;});})[_0x8521('0x1e')](function(){_0x121ab4[_0x8521('0x2a')](0xcc)[_0x8521('0x2b')]();});}};}function handleEntityNotFound(_0x580614,_0x37ce01){return function(_0xc7ce4f){if(!_0xc7ce4f){_0x580614[_0x8521('0x29')](0x194);}return _0xc7ce4f;};}function handleError(_0x1c43bf,_0x154920){_0x154920=_0x154920||0x1f4;return function(_0x47bb19){logger[_0x8521('0x23')](_0x47bb19[_0x8521('0x39')]);if(_0x47bb19[_0x8521('0x3a')]){delete _0x47bb19[_0x8521('0x3a')];}_0x1c43bf[_0x8521('0x2a')](_0x154920)['send'](_0x47bb19);};}exports[_0x8521('0x3b')]=function(_0x14d2b6,_0x217268){var _0x784c2f={'include':[{'model':db[_0x8521('0x3c')],'as':_0x8521('0x3d')}]},_0x180de7={},_0x546882={'count':0x0,'rows':[]};var _0x35a3ba=_['map'](db[_0x8521('0x3e')]['rawAttributes'],function(_0x5aa07a){return{'name':_0x5aa07a['fieldName'],'type':_0x5aa07a[_0x8521('0x3f')][_0x8521('0x40')]};});_0x180de7[_0x8521('0x41')]=_[_0x8521('0x42')](_0x35a3ba,'name');_0x180de7[_0x8521('0x43')]=_[_0x8521('0x44')](_0x14d2b6[_0x8521('0x43')]);_0x180de7[_0x8521('0x45')]=_[_0x8521('0x46')](_0x180de7[_0x8521('0x41')],_0x180de7[_0x8521('0x43')]);_0x784c2f[_0x8521('0x47')]=_[_0x8521('0x46')](_0x180de7[_0x8521('0x41')],qs['fields'](_0x14d2b6['query'][_0x8521('0x48')]));_0x784c2f['attributes']=_0x784c2f[_0x8521('0x47')][_0x8521('0x49')]?_0x784c2f[_0x8521('0x47')]:_0x180de7[_0x8521('0x41')];if(!_0x14d2b6[_0x8521('0x43')]['hasOwnProperty'](_0x8521('0x4a'))){_0x784c2f['limit']=qs[_0x8521('0x2e')](_0x14d2b6[_0x8521('0x43')]['limit']);_0x784c2f[_0x8521('0x2d')]=qs['offset'](_0x14d2b6[_0x8521('0x43')][_0x8521('0x2d')]);}_0x784c2f[_0x8521('0x4b')]=qs[_0x8521('0x4c')](_0x14d2b6['query'][_0x8521('0x4c')]);_0x784c2f['where']=qs[_0x8521('0x45')](_[_0x8521('0x4d')](_0x14d2b6[_0x8521('0x43')],_0x180de7[_0x8521('0x45')]),_0x35a3ba);if(_0x14d2b6[_0x8521('0x43')][_0x8521('0x4e')]){_0x784c2f[_0x8521('0x4f')]=_[_0x8521('0x50')](_0x784c2f[_0x8521('0x4f')],{'$or':_['map'](_0x35a3ba,function(_0x164377){if(_0x164377[_0x8521('0x3f')]!==_0x8521('0x51')){var _0x531a47={};_0x531a47[_0x164377[_0x8521('0x3a')]]={'$like':'%'+_0x14d2b6[_0x8521('0x43')][_0x8521('0x4e')]+'%'};return _0x531a47;}})});}_0x784c2f=_['merge']({},_0x784c2f,_0x14d2b6['options']);var _0x30f3b5={'where':_0x784c2f[_0x8521('0x4f')]};return db['WhatsappAccount'][_0x8521('0x30')](_0x30f3b5)['then'](function(_0x3d6ea2){_0x546882['count']=_0x3d6ea2;if(_0x14d2b6[_0x8521('0x43')][_0x8521('0x52')]){_0x784c2f[_0x8521('0x53')]=[{'all':!![]}];}return db['WhatsappAccount'][_0x8521('0x54')](_0x784c2f);})[_0x8521('0x1e')](function(_0x4feb7e){_0x546882[_0x8521('0x55')]=_0x4feb7e;return _0x546882;})['then'](respondWithFilteredResult(_0x217268,_0x784c2f))[_0x8521('0x28')](handleError(_0x217268,null));};exports[_0x8521('0x56')]=function(_0x53f7f2,_0x331a32){var _0x195cf6={'raw':![],'where':{'id':_0x53f7f2['params']['id']},'include':[{'model':db['Pause'],'as':_0x8521('0x3d')}]},_0x1de792={};_0x1de792['model']=_['keys'](db[_0x8521('0x3e')][_0x8521('0x57')]);_0x1de792[_0x8521('0x43')]=_[_0x8521('0x44')](_0x53f7f2[_0x8521('0x43')]);_0x1de792['filters']=_[_0x8521('0x46')](_0x1de792[_0x8521('0x41')],_0x1de792[_0x8521('0x43')]);_0x195cf6[_0x8521('0x47')]=_[_0x8521('0x46')](_0x1de792[_0x8521('0x41')],qs[_0x8521('0x48')](_0x53f7f2['query'][_0x8521('0x48')]));_0x195cf6[_0x8521('0x47')]=_0x195cf6['attributes'][_0x8521('0x49')]?_0x195cf6[_0x8521('0x47')]:_0x1de792[_0x8521('0x41')];if(_0x53f7f2[_0x8521('0x43')]['includeAll']){_0x195cf6[_0x8521('0x53')]=[{'all':!![]}];}_0x195cf6=_['merge']({},_0x195cf6,_0x53f7f2['options']);return db[_0x8521('0x3e')][_0x8521('0x58')](_0x195cf6)[_0x8521('0x1e')](handleEntityNotFound(_0x331a32,null))['then'](respondWithResult(_0x331a32,null))['catch'](handleError(_0x331a32,null));};exports['create']=function(_0x3bbb23,_0xba13d2){return db['WhatsappAccount'][_0x8521('0x59')](_0x3bbb23[_0x8521('0x5a')],{})[_0x8521('0x1e')](function(_0x1e72c6){var _0x6228ae=_0x3bbb23[_0x8521('0x5b')]['get']({'plain':!![]});if(!_0x6228ae)throw new Error(_0x8521('0x5c'));if(_0x6228ae[_0x8521('0x5d')]==='user'){var _0x1cd7bb=_0x1e72c6[_0x8521('0x37')]({'plain':!![]});var _0x2faa4c=_0x8521('0x38');return db[_0x8521('0x5e')][_0x8521('0x58')]({'where':{'name':_0x2faa4c,'userProfileId':_0x6228ae['userProfileId']},'raw':!![]})[_0x8521('0x1e')](function(_0x2dc3bb){if(_0x2dc3bb&&_0x2dc3bb[_0x8521('0x5f')]===0x0){return db[_0x8521('0x60')][_0x8521('0x59')]({'name':_0x1cd7bb[_0x8521('0x3a')],'resourceId':_0x1cd7bb['id'],'type':_0x2dc3bb['name'],'sectionId':_0x2dc3bb['id']},{})[_0x8521('0x1e')](function(){return _0x1e72c6;});}else{return _0x1e72c6;}})[_0x8521('0x28')](function(_0x2e7f80){logger[_0x8521('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2e7f80);throw _0x2e7f80;});}return _0x1e72c6;})[_0x8521('0x1e')](respondWithResult(_0xba13d2,0xc9))[_0x8521('0x28')](handleError(_0xba13d2,null));};exports[_0x8521('0x35')]=function(_0x2f53b2,_0x9b077f){if(_0x2f53b2[_0x8521('0x5a')]['id']){delete _0x2f53b2[_0x8521('0x5a')]['id'];}return db['WhatsappAccount'][_0x8521('0x58')]({'where':{'id':_0x2f53b2[_0x8521('0x61')]['id']},'include':[{'model':db[_0x8521('0x3c')],'as':_0x8521('0x3d')}]})[_0x8521('0x1e')](handleEntityNotFound(_0x9b077f,null))[_0x8521('0x1e')](saveUpdates(_0x2f53b2['body'],null))['then'](respondWithResult(_0x9b077f,null))[_0x8521('0x28')](handleError(_0x9b077f,null));};exports['destroy']=function(_0x2bed18,_0x1d96ab){return db[_0x8521('0x3e')][_0x8521('0x58')]({'where':{'id':_0x2bed18[_0x8521('0x61')]['id']}})['then'](handleEntityNotFound(_0x1d96ab,null))[_0x8521('0x1e')](removeEntity(_0x1d96ab,null))['catch'](handleError(_0x1d96ab,null));};exports[_0x8521('0x62')]=function(_0x13a9de,_0x1e754b){return db[_0x8521('0x3e')]['describe']()[_0x8521('0x1e')](respondWithResult(_0x1e754b,null))[_0x8521('0x28')](handleError(_0x1e754b,null));};exports['addDisposition']=function(_0x88ce1e,_0x5eccac,_0x521c08){if(_0x88ce1e['body']['id']){delete _0x88ce1e[_0x8521('0x5a')]['id'];}return db['WhatsappAccount']['find']({'where':{'id':_0x88ce1e['params']['id']}})[_0x8521('0x1e')](handleEntityNotFound(_0x5eccac,null))['then'](function(_0x4ad95e){if(_0x4ad95e){_0x88ce1e[_0x8521('0x5a')][_0x8521('0x63')]=_0x4ad95e['id'];return db['Disposition'][_0x8521('0x59')](_0x88ce1e[_0x8521('0x5a')]);}})[_0x8521('0x1e')](respondWithResult(_0x5eccac,null))[_0x8521('0x28')](handleError(_0x5eccac,null));};exports[_0x8521('0x64')]=function(_0x1655fa,_0x1b7939,_0x5a1d66){var _0x4f6a44={'raw':![],'where':{}};var _0x198c8c={};var _0x2ec63d={'count':0x0,'rows':[]};return db[_0x8521('0x3e')][_0x8521('0x65')]({'where':{'id':_0x1655fa[_0x8521('0x61')]['id']}})['then'](handleEntityNotFound(_0x1b7939,null))[_0x8521('0x1e')](function(_0x1235c8){if(_0x1235c8){_0x198c8c[_0x8521('0x41')]=_[_0x8521('0x44')](db[_0x8521('0x66')][_0x8521('0x57')]);_0x198c8c[_0x8521('0x43')]=_[_0x8521('0x44')](_0x1655fa[_0x8521('0x43')]);_0x198c8c['filters']=_[_0x8521('0x46')](_0x198c8c[_0x8521('0x41')],_0x198c8c['query']);_0x4f6a44[_0x8521('0x47')]=_[_0x8521('0x46')](_0x198c8c[_0x8521('0x41')],qs[_0x8521('0x48')](_0x1655fa['query'][_0x8521('0x48')]));_0x4f6a44[_0x8521('0x47')]=_0x4f6a44[_0x8521('0x47')][_0x8521('0x49')]?_0x4f6a44[_0x8521('0x47')]:_0x198c8c[_0x8521('0x41')];if(!_0x1655fa[_0x8521('0x43')]['hasOwnProperty'](_0x8521('0x4a'))){_0x4f6a44[_0x8521('0x2e')]=qs[_0x8521('0x2e')](_0x1655fa[_0x8521('0x43')]['limit']);_0x4f6a44[_0x8521('0x2d')]=qs[_0x8521('0x2d')](_0x1655fa[_0x8521('0x43')][_0x8521('0x2d')]);}_0x4f6a44[_0x8521('0x4b')]=qs[_0x8521('0x4c')](_0x1655fa[_0x8521('0x43')][_0x8521('0x4c')]);_0x4f6a44[_0x8521('0x4f')]=qs[_0x8521('0x45')](_['pick'](_0x1655fa[_0x8521('0x43')],_0x198c8c['filters']));_0x4f6a44['where'][_0x8521('0x63')]=_0x1235c8['id'];if(_0x1655fa['query'][_0x8521('0x4e')]){_0x4f6a44[_0x8521('0x4f')]=_[_0x8521('0x50')](_0x4f6a44[_0x8521('0x4f')],{'$or':_[_0x8521('0x42')](_0x4f6a44['attributes'],function(_0x38a1ef){var _0x4afa5a={};_0x4afa5a[_0x38a1ef]={'$like':'%'+_0x1655fa['query'][_0x8521('0x4e')]+'%'};return _0x4afa5a;})});}_0x4f6a44=_[_0x8521('0x50')]({},_0x4f6a44,_0x1655fa[_0x8521('0x67')]);return db[_0x8521('0x66')][_0x8521('0x30')]({'where':_0x4f6a44[_0x8521('0x4f')]})[_0x8521('0x1e')](function(_0x507d7e){_0x2ec63d['count']=_0x507d7e;if(_0x1655fa['query']['includeAll']){_0x4f6a44['include']=[{'all':!![]}];}return db['Disposition']['findAll'](_0x4f6a44);})[_0x8521('0x1e')](function(_0x3763af){_0x2ec63d[_0x8521('0x55')]=_0x3763af;return _0x2ec63d;});}})['then'](respondWithFilteredResult(_0x1b7939,_0x4f6a44))['catch'](handleError(_0x1b7939,null));};exports[_0x8521('0x68')]=function(_0x3d16ab,_0x3d6ede,_0x29e19c){return db[_0x8521('0x3e')][_0x8521('0x58')]({'where':{'id':_0x3d16ab[_0x8521('0x61')]['id']}})['then'](handleEntityNotFound(_0x3d6ede,null))['then'](function(_0x478f4a){if(_0x478f4a){return _0x478f4a[_0x8521('0x68')](_0x3d16ab['query'][_0x8521('0x69')]);}})[_0x8521('0x1e')](respondWithStatusCode(_0x3d6ede,null))[_0x8521('0x28')](handleError(_0x3d6ede,null));};exports[_0x8521('0x6a')]=function(_0x170a9a,_0x598423,_0x24a763){if(_0x170a9a[_0x8521('0x5a')]['id']){delete _0x170a9a[_0x8521('0x5a')]['id'];}return db[_0x8521('0x3e')][_0x8521('0x58')]({'where':{'id':_0x170a9a[_0x8521('0x61')]['id']}})[_0x8521('0x1e')](handleEntityNotFound(_0x598423,null))[_0x8521('0x1e')](function(_0x1e2053){if(_0x1e2053){_0x170a9a['body']['WhatsappAccountId']=_0x1e2053['id'];return db[_0x8521('0x6b')][_0x8521('0x59')](_0x170a9a[_0x8521('0x5a')]);}})[_0x8521('0x1e')](respondWithResult(_0x598423,null))[_0x8521('0x28')](handleError(_0x598423,null));};exports[_0x8521('0x6c')]=function(_0x2b1a92,_0x3fb6b5,_0x58d9da){var _0x3a0ebb={'raw':![],'where':{}};var _0x1d2d89={};var _0x559f14={'count':0x0,'rows':[]};return db[_0x8521('0x3e')][_0x8521('0x65')]({'where':{'id':_0x2b1a92['params']['id']}})[_0x8521('0x1e')](handleEntityNotFound(_0x3fb6b5,null))[_0x8521('0x1e')](function(_0x3ef7b9){if(_0x3ef7b9){_0x1d2d89[_0x8521('0x41')]=_[_0x8521('0x44')](db[_0x8521('0x6b')][_0x8521('0x57')]);_0x1d2d89[_0x8521('0x43')]=_[_0x8521('0x44')](_0x2b1a92[_0x8521('0x43')]);_0x1d2d89[_0x8521('0x45')]=_[_0x8521('0x46')](_0x1d2d89[_0x8521('0x41')],_0x1d2d89['query']);_0x3a0ebb[_0x8521('0x47')]=_[_0x8521('0x46')](_0x1d2d89[_0x8521('0x41')],qs[_0x8521('0x48')](_0x2b1a92[_0x8521('0x43')][_0x8521('0x48')]));_0x3a0ebb['attributes']=_0x3a0ebb['attributes'][_0x8521('0x49')]?_0x3a0ebb[_0x8521('0x47')]:_0x1d2d89[_0x8521('0x41')];if(!_0x2b1a92[_0x8521('0x43')][_0x8521('0x6d')](_0x8521('0x4a'))){_0x3a0ebb['limit']=qs['limit'](_0x2b1a92['query'][_0x8521('0x2e')]);_0x3a0ebb['offset']=qs['offset'](_0x2b1a92[_0x8521('0x43')]['offset']);}_0x3a0ebb['order']=qs['sort'](_0x2b1a92[_0x8521('0x43')][_0x8521('0x4c')]);_0x3a0ebb[_0x8521('0x4f')]=qs[_0x8521('0x45')](_['pick'](_0x2b1a92['query'],_0x1d2d89[_0x8521('0x45')]));_0x3a0ebb[_0x8521('0x4f')][_0x8521('0x63')]=_0x3ef7b9['id'];if(_0x2b1a92[_0x8521('0x43')][_0x8521('0x4e')]){_0x3a0ebb[_0x8521('0x4f')]=_[_0x8521('0x50')](_0x3a0ebb[_0x8521('0x4f')],{'$or':_[_0x8521('0x42')](_0x3a0ebb['attributes'],function(_0x1758d5){var _0x500920={};_0x500920[_0x1758d5]={'$like':'%'+_0x2b1a92[_0x8521('0x43')]['filter']+'%'};return _0x500920;})});}_0x3a0ebb=_['merge']({},_0x3a0ebb,_0x2b1a92[_0x8521('0x67')]);return db['CannedAnswer'][_0x8521('0x30')]({'where':_0x3a0ebb[_0x8521('0x4f')]})[_0x8521('0x1e')](function(_0x187907){_0x559f14[_0x8521('0x30')]=_0x187907;if(_0x2b1a92['query'][_0x8521('0x52')]){_0x3a0ebb[_0x8521('0x53')]=[{'all':!![]}];}return db['CannedAnswer'][_0x8521('0x54')](_0x3a0ebb);})[_0x8521('0x1e')](function(_0x477144){_0x559f14[_0x8521('0x55')]=_0x477144;return _0x559f14;});}})[_0x8521('0x1e')](respondWithFilteredResult(_0x3fb6b5,_0x3a0ebb))[_0x8521('0x28')](handleError(_0x3fb6b5,null));};exports[_0x8521('0x6e')]=function(_0x25f188,_0x36fa35,_0x59f43b){return db['WhatsappAccount']['find']({'where':{'id':_0x25f188[_0x8521('0x61')]['id']}})[_0x8521('0x1e')](handleEntityNotFound(_0x36fa35,null))[_0x8521('0x1e')](function(_0x5325b2){if(_0x5325b2){return _0x5325b2[_0x8521('0x6e')](_0x25f188[_0x8521('0x43')][_0x8521('0x69')]);}})[_0x8521('0x1e')](respondWithStatusCode(_0x36fa35,null))[_0x8521('0x28')](handleError(_0x36fa35,null));};exports[_0x8521('0x6f')]=function(_0x12b910,_0x43706b,_0x55ce68){return db['WhatsappAccount'][_0x8521('0x58')]({'where':{'id':_0x12b910[_0x8521('0x61')]['id']}})[_0x8521('0x1e')](handleEntityNotFound(_0x43706b,null))[_0x8521('0x1e')](function(_0x90f1af){if(_0x90f1af){return _0x90f1af['addAgents'](_0x12b910[_0x8521('0x5a')][_0x8521('0x69')],_['omit'](_0x12b910[_0x8521('0x5a')],['ids','id'])||{})[_0x8521('0x70')](function(_0x473579){for(var _0x55cdbd=0x0;_0x55cdbd<_0x12b910[_0x8521('0x5a')][_0x8521('0x69')]['length'];_0x55cdbd+=0x1){socket[_0x8521('0x71')]('userWhatsappAccount:save',{'UserId':Number(_0x12b910[_0x8521('0x5a')][_0x8521('0x69')][_0x55cdbd]),'WhatsappAccountId':Number(_0x12b910[_0x8521('0x61')]['id'])});}return _0x473579;});}})[_0x8521('0x1e')](respondWithResult(_0x43706b,null))['catch'](handleError(_0x43706b,null));};exports[_0x8521('0x72')]=function(_0x470133,_0x48b6d8,_0x5948ed){return db[_0x8521('0x3e')]['find']({'where':{'id':_0x470133[_0x8521('0x61')]['id']}})[_0x8521('0x1e')](handleEntityNotFound(_0x48b6d8,null))[_0x8521('0x1e')](function(_0x32c55c){if(_0x32c55c){return _0x32c55c[_0x8521('0x72')](_0x470133[_0x8521('0x43')][_0x8521('0x69')])['then'](function(){if(_[_0x8521('0x73')](_0x470133[_0x8521('0x43')][_0x8521('0x69')])){for(var _0x2c838e=0x0;_0x2c838e<_0x470133[_0x8521('0x43')][_0x8521('0x69')][_0x8521('0x49')];_0x2c838e+=0x1){socket[_0x8521('0x71')](_0x8521('0x74'),{'UserId':Number(_0x470133['query'][_0x8521('0x69')][_0x2c838e]),'WhatsappAccountId':Number(_0x470133['params']['id'])});}}else{socket[_0x8521('0x71')](_0x8521('0x74'),{'UserId':Number(_0x470133[_0x8521('0x43')][_0x8521('0x69')]),'WhatsappAccountId':Number(_0x470133[_0x8521('0x61')]['id'])});}});}})['then'](respondWithStatusCode(_0x48b6d8,null))[_0x8521('0x28')](handleError(_0x48b6d8,null));};exports['getAgents']=function(_0x3f206b,_0x53748f,_0xea1a15){var _0x59f7c5={};var _0x2666f0={};var _0x39336c;var _0x516760;return db['WhatsappAccount'][_0x8521('0x65')]({'where':{'id':_0x3f206b['params']['id']}})[_0x8521('0x1e')](handleEntityNotFound(_0x53748f,null))[_0x8521('0x1e')](function(_0x3c0d60){if(_0x3c0d60){_0x39336c=_0x3c0d60;_0x2666f0[_0x8521('0x41')]=_['keys'](db[_0x8521('0x75')]['rawAttributes']);_0x2666f0[_0x8521('0x43')]=_[_0x8521('0x44')](_0x3f206b[_0x8521('0x43')]);_0x2666f0[_0x8521('0x45')]=_[_0x8521('0x46')](_0x2666f0['model'],_0x2666f0[_0x8521('0x43')]);_0x59f7c5['attributes']=_[_0x8521('0x46')](_0x2666f0[_0x8521('0x41')],qs[_0x8521('0x48')](_0x3f206b[_0x8521('0x43')][_0x8521('0x48')]));_0x59f7c5[_0x8521('0x47')]=_0x59f7c5['attributes'][_0x8521('0x49')]?_0x59f7c5[_0x8521('0x47')]:_0x2666f0[_0x8521('0x41')];_0x59f7c5[_0x8521('0x4b')]=qs[_0x8521('0x4c')](_0x3f206b[_0x8521('0x43')][_0x8521('0x4c')]);_0x59f7c5['where']=qs['filters'](_[_0x8521('0x4d')](_0x3f206b['query'],_0x2666f0[_0x8521('0x45')]));if(_0x3f206b[_0x8521('0x43')][_0x8521('0x4e')]){_0x59f7c5[_0x8521('0x4f')]=_[_0x8521('0x50')](_0x59f7c5[_0x8521('0x4f')],{'$or':_[_0x8521('0x42')](_0x59f7c5['attributes'],function(_0x3f5068){var _0x4c97a9={};_0x4c97a9[_0x3f5068]={'$like':'%'+_0x3f206b['query'][_0x8521('0x4e')]+'%'};return _0x4c97a9;})});}_0x59f7c5=_[_0x8521('0x50')]({},_0x59f7c5,_0x3f206b['options']);return _0x39336c['getAgents'](_0x59f7c5);}})[_0x8521('0x1e')](function(_0x49d3bc){if(_0x49d3bc){_0x516760=_0x49d3bc[_0x8521('0x49')];if(!_0x3f206b[_0x8521('0x43')][_0x8521('0x6d')]('nolimit')){_0x59f7c5[_0x8521('0x2e')]=qs['limit'](_0x3f206b[_0x8521('0x43')][_0x8521('0x2e')]);_0x59f7c5['offset']=qs[_0x8521('0x2d')](_0x3f206b[_0x8521('0x43')][_0x8521('0x2d')]);}return _0x39336c['getAgents'](_0x59f7c5);}})[_0x8521('0x1e')](function(_0x23dc3d){if(_0x23dc3d){return _0x23dc3d?{'count':_0x516760,'rows':_0x23dc3d}:null;}})[_0x8521('0x1e')](respondWithResult(_0x53748f,null))[_0x8521('0x28')](handleError(_0x53748f,null));};exports[_0x8521('0x76')]=function(_0x5e2f48,_0x49a017){var _0x438fef=_0x5e2f48[_0x8521('0x61')]['id'];var _0x3785fc=_0x5e2f48['body'];var _0x365d30=0xc8;var _0x37ee73=null;return db[_0x8521('0x77')][_0x8521('0x78')]({'isolationLevel':db[_0x8521('0x77')][_0x8521('0x79')][_0x8521('0x7a')][_0x8521('0x7b')]},function(_0x5ac0e0){return db[_0x8521('0x3e')]['findOne']({'where':{'id':_0x438fef},'transaction':_0x5ac0e0})['then'](function(_0x569646){if(_0x569646){return db['WhatsappApplication'][_0x8521('0x36')]({'where':{'WhatsappAccountId':_0x438fef},'transaction':_0x5ac0e0})['then'](function(){var _0x4d5de7=_[_0x8521('0x42')](_0x3785fc,function(_0x389b1a){_0x389b1a[_0x8521('0x63')]=_0x438fef;return _0x389b1a;});return db[_0x8521('0x7c')][_0x8521('0x7d')](_0x4d5de7,{'transaction':_0x5ac0e0});});}else{_0x365d30=0x194;_0x37ee73=[];}});})[_0x8521('0x1e')](function(){if(_0x365d30!==0x194){return db[_0x8521('0x7c')][_0x8521('0x7e')]({'where':{'WhatsappAccountId':_0x438fef},'order':_0x8521('0x7f')})[_0x8521('0x1e')](function(_0x1a4ae1){_0x37ee73=_0x1a4ae1;});}})[_0x8521('0x28')](function(_0x125f38){_0x365d30=0x1f4;logger[_0x8521('0x23')](_0x125f38[_0x8521('0x39')]);if(_0x125f38[_0x8521('0x3a')]){delete _0x125f38['name'];}_0x37ee73=_0x125f38;})[_0x8521('0x80')](function(){if(_0x37ee73===null){_0x49a017[_0x8521('0x29')](_0x365d30);}else{if(_0x365d30===0x1f4){_0x49a017[_0x8521('0x2a')](_0x365d30)['send'](_0x37ee73);}else{_0x49a017[_0x8521('0x2a')](_0x365d30)[_0x8521('0x2c')](_0x37ee73);}}});};exports['getApplications']=function(_0x1031d2,_0x54b1e8,_0x8fec2){var _0x51537c={};var _0x40ed61={};var _0x2695e5;var _0x2112c1;return db['WhatsappAccount']['findOne']({'where':{'id':_0x1031d2['params']['id']}})[_0x8521('0x1e')](handleEntityNotFound(_0x54b1e8,null))[_0x8521('0x1e')](function(_0x578a04){if(_0x578a04){_0x2695e5=_0x578a04;_0x40ed61[_0x8521('0x41')]=_[_0x8521('0x44')](db[_0x8521('0x7c')]['rawAttributes']);_0x40ed61['query']=_[_0x8521('0x44')](_0x1031d2[_0x8521('0x43')]);_0x40ed61['filters']=_[_0x8521('0x46')](_0x40ed61[_0x8521('0x41')],_0x40ed61[_0x8521('0x43')]);_0x51537c[_0x8521('0x47')]=_[_0x8521('0x46')](_0x40ed61['model'],qs['fields'](_0x1031d2['query'][_0x8521('0x48')]));_0x51537c['attributes']=_0x51537c[_0x8521('0x47')][_0x8521('0x49')]?_0x51537c[_0x8521('0x47')]:_0x40ed61['model'];_0x51537c[_0x8521('0x4b')]=qs[_0x8521('0x4c')](_0x1031d2[_0x8521('0x43')][_0x8521('0x4c')]);_0x51537c[_0x8521('0x4f')]=qs[_0x8521('0x45')](_[_0x8521('0x4d')](_0x1031d2[_0x8521('0x43')],_0x40ed61['filters']));if(_0x1031d2[_0x8521('0x43')]['filter']){_0x51537c[_0x8521('0x4f')]=_['merge'](_0x51537c[_0x8521('0x4f')],{'$or':_[_0x8521('0x42')](_0x51537c['attributes'],function(_0x409f44){var _0x454e53={};_0x454e53[_0x409f44]={'$like':'%'+_0x1031d2[_0x8521('0x43')][_0x8521('0x4e')]+'%'};return _0x454e53;})});}_0x51537c=_[_0x8521('0x50')]({},_0x51537c,_0x1031d2[_0x8521('0x67')]);return _0x2695e5[_0x8521('0x81')](_0x51537c);}})['then'](function(_0x131029){if(_0x131029){_0x2112c1=_0x131029['length'];if(!_0x1031d2[_0x8521('0x43')][_0x8521('0x6d')](_0x8521('0x4a'))){_0x51537c[_0x8521('0x2e')]=qs['limit'](_0x1031d2[_0x8521('0x43')]['limit']);_0x51537c[_0x8521('0x2d')]=qs[_0x8521('0x2d')](_0x1031d2[_0x8521('0x43')][_0x8521('0x2d')]);}return _0x2695e5[_0x8521('0x81')](_0x51537c);}})['then'](function(_0x5c75c0){if(_0x5c75c0){return _0x5c75c0?{'count':_0x2112c1,'rows':_0x5c75c0}:null;}})['then'](respondWithResult(_0x54b1e8,null))[_0x8521('0x28')](handleError(_0x54b1e8,null));};exports[_0x8521('0x82')]=function(_0x244674,_0x58af28,_0x785c68){var _0x3411b6={'channel':_0x8521('0x83')};var _0x2fc3f2=[];var _0x463e98=[];var _0x354e7e={};return db[_0x8521('0x3e')][_0x8521('0x58')]({'where':{'id':_0x244674[_0x8521('0x61')]['id']},'include':[{'model':db['WhatsappApplication'],'as':_0x8521('0x84')}]})[_0x8521('0x1e')](handleEntityNotFound(_0x58af28,null))[_0x8521('0x1e')](function(_0x480b4f){_0x3411b6[_0x8521('0x85')]=_0x480b4f;if(_0x3411b6['account']&&_0x3411b6[_0x8521('0x85')][_0x8521('0x3f')]===_0x8521('0x86')&&_0x244674[_0x8521('0x5a')][_0x8521('0x87')]){if(_0x244674['body'][_0x8521('0x87')][_0x8521('0x49')]===0x0)return;if(_0x244674[_0x8521('0x5a')][_0x8521('0x87')][0x0][_0x8521('0x88')]!=='read')return;return db['WhatsappMessage'][_0x8521('0x35')]({'read':!![],'readAt':_0x244674[_0x8521('0x5a')][_0x8521('0x87')][0x0][_0x8521('0x89')]},{'where':{'messageId':_0x244674[_0x8521('0x5a')][_0x8521('0x87')][0x0][_0x8521('0x8a')]},'individualHooks':!![]})[_0x8521('0x1e')](function(_0x25d3fc){return _0x58af28['status'](0xc8)['json'](_0x25d3fc);});}_0x3411b6[_0x8521('0x8b')]=_['orderBy'](_0x480b4f[_0x8521('0x84')],[_0x8521('0x7f')],[_0x8521('0x8c')]);if(_0x3411b6[_0x8521('0x85')][_0x8521('0x84')]){delete _0x3411b6[_0x8521('0x85')][_0x8521('0x84')];}return db[_0x8521('0x8d')][_0x8521('0x62')]()[_0x8521('0x1e')](function(_0x77670b){if(!_0x77670b){throw new db[(_0x8521('0x8e'))][(_0x8521('0x8f'))](_0x8521('0x90'));}_0x2fc3f2=_[_0x8521('0x91')](_[_0x8521('0x44')](_0x77670b),[_0x8521('0x92'),_0x8521('0x93')]);_0x463e98=_[_0x8521('0x91')](_[_0x8521('0x44')](_0x77670b),[_0x8521('0x92'),_0x8521('0x93'),'CompanyId',_0x8521('0x94')]);_0x3411b6[_0x8521('0x5a')]={'mapKey':'mobile'};if(_0x3411b6[_0x8521('0x85')]&&_0x3411b6[_0x8521('0x85')][_0x8521('0x3f')]===_0x8521('0x95')){_0x3411b6[_0x8521('0x5a')][_0x8521('0x96')]=_0x244674[_0x8521('0x5a')]['From'][_0x8521('0x97')](_0x8521('0x98'),'');_0x3411b6[_0x8521('0x5a')][_0x8521('0x5a')]=_0x244674[_0x8521('0x5a')][_0x8521('0x99')];_0x3411b6[_0x8521('0x5a')][_0x8521('0x9a')]=_0x244674[_0x8521('0x5a')][_0x8521('0x9b')];}if(_0x3411b6[_0x8521('0x85')]&&_0x3411b6[_0x8521('0x85')][_0x8521('0x3f')]===_0x8521('0x86')){_0x3411b6[_0x8521('0x5a')][_0x8521('0x96')]=_0x244674[_0x8521('0x5a')][_0x8521('0x9c')][0x0][_0x8521('0x96')];_0x3411b6[_0x8521('0x5a')][_0x8521('0x5a')]=_0x244674[_0x8521('0x5a')][_0x8521('0x9c')][0x0][_0x8521('0x26')]['body'];_0x3411b6[_0x8521('0x5a')]['messageId']=_0x244674[_0x8521('0x5a')]['notifications'][0x0]['message_id'];}if(_0x3411b6[_0x8521('0x5a')]['id']){delete _0x3411b6[_0x8521('0x5a')]['id'];}if(_[_0x8521('0x9d')](_0x3411b6['body'][_0x8521('0x96')])){throw new db[(_0x8521('0x8e'))][(_0x8521('0x8f'))]('from\x20is\x20mandatory');}if(_[_0x8521('0x9d')](_0x3411b6[_0x8521('0x5a')][_0x8521('0x5a')])||_0x3411b6['body'][_0x8521('0x5a')]===''){throw new db[(_0x8521('0x8e'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x8521('0x9d')](_0x3411b6['body']['mapKey'])){throw new db[(_0x8521('0x8e'))][(_0x8521('0x8f'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x463e98);}if(!_['includes'](_0x463e98,_0x3411b6[_0x8521('0x5a')]['mapKey'])){throw new db[(_0x8521('0x8e'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x463e98);}_0x354e7e[_0x3411b6[_0x8521('0x5a')][_0x8521('0x9e')]]=_0x3411b6[_0x8521('0x5a')][_0x8521('0x96')];return db[_0x8521('0x9f')]['find']({'where':{'id':_0x3411b6[_0x8521('0x85')]['ListId']},'include':[{'model':db['CmContact'],'as':_0x8521('0xa0'),'where':_0x354e7e,'limit':0x1,'order':[[_0x8521('0x93'),_0x8521('0xa1')]]}]});})['then'](handleEntityNotFound(_0x58af28,null))['then'](function(_0x4122f7){if(_0x4122f7){_0x3411b6[_0x8521('0xa2')]=_[_0x8521('0xa3')](_0x4122f7,[_0x8521('0xa0')]);if(_0x4122f7[_0x8521('0xa0')]['length']){return _0x4122f7[_0x8521('0xa0')][0x0];}var _0x52822b=_[_0x8521('0xa4')](_0x3411b6[_0x8521('0x5a')],{'firstName':_0x3411b6[_0x8521('0x5a')][_0x8521('0x96')],'ListId':_0x4122f7['id']});_0x52822b[_0x3411b6[_0x8521('0x5a')][_0x8521('0x9e')]]=_0x3411b6[_0x8521('0x5a')]['from'];return db[_0x8521('0x8d')][_0x8521('0x59')](_0x52822b,{'fields':_0x2fc3f2,'raw':!![]});}})['then'](handleEntityNotFound(_0x58af28,null))[_0x8521('0x1e')](function(_0x5c37e7){if(_0x5c37e7){_0x3411b6[_0x8521('0xa5')]=_0x5c37e7;var _0x1a11f8={'ContactId':_0x5c37e7['id'],'phone':_0x3411b6[_0x8521('0x5a')][_0x8521('0x96')],'WhatsappAccountId':_0x244674[_0x8521('0x61')]['id']};var _0x413309={'ContactId':_0x5c37e7['id'],'WhatsappAccountId':_0x244674[_0x8521('0x61')]['id'],'closed':![]};return db['WhatsappInteraction']['find']({'where':_0x413309})['then'](function(_0x6f61e){if(_0x6f61e){return[_0x6f61e,![]];}return db['WhatsappInteraction'][_0x8521('0x59')](_0x1a11f8)[_0x8521('0x1e')](function(_0x4a8c95){return[_0x4a8c95,!![]];});});}})[_0x8521('0x70')](function(_0xc4a463,_0x1175d5){_0x3411b6[_0x8521('0xa6')]=_0xc4a463[_0x8521('0x37')]({'plain':!![]});_0x3411b6[_0x8521('0xa6')][_0x8521('0xa7')]=![];if(_0x1175d5){if(_0x3411b6[_0x8521('0x85')][_0x8521('0xa8')]){_0x3411b6[_0x8521('0x8b')]['push']({'id':0x0,'priority':_0x3411b6['applications'][_0x8521('0x49')]+0x1,'app':_0x8521('0xa9'),'appdata':_0x8521('0xaa'),'interval':_0x8521('0xab')});}_0x3411b6[_0x8521('0xa6')][_0x8521('0xa7')]=!![];}return db['WhatsappMessage'][_0x8521('0x59')]({'phone':_0x3411b6[_0x8521('0x5a')][_0x8521('0x96')],'messageId':_0x3411b6[_0x8521('0x5a')][_0x8521('0x9a')],'body':_0x3411b6['body'][_0x8521('0x5a')],'WhatsappAccountId':_0x244674[_0x8521('0x61')]['id'],'WhatsappInteractionId':_0xc4a463['id'],'direction':'in','ContactId':_0xc4a463[_0x8521('0xac')],'AttachmentId':_0x3411b6['body'][_0x8521('0xad')]});})[_0x8521('0x1e')](function(_0x11b2d0){_0x3411b6['message']=_0x11b2d0;if(_0x3411b6[_0x8521('0xa6')]['UserId']){return db[_0x8521('0x75')][_0x8521('0x58')]({'attributes':['id',_0x8521('0x3a')],'where':{'id':_0x3411b6[_0x8521('0xa6')][_0x8521('0xae')]}})[_0x8521('0x1e')](function(_0x44283b){if(_0x44283b){_0x3411b6[_0x8521('0x8b')][_0x8521('0xaf')]({'id':0x0,'priority':0x0,'app':_0x8521('0xb0'),'appdata':_0x44283b['name']+','+(_0x3411b6[_0x8521('0x85')][_0x8521('0xb1')]||0xa),'interval':_0x8521('0xab')});}return respondWithRpcPromise('Start',_0x8521('0xb2'),_0x3411b6);});}return respondWithRpcPromise(_0x8521('0xb3'),'startRouting',_0x3411b6);})[_0x8521('0x1e')](function(_0xe25095){if(_0xe25095){var _0x41797a=0xc8;var _0x570c15=_0x8521('0xb4');logger[_0x8521('0x1f')](_0x8521('0x21'),_0x570c15,_0x41797a,'entity\x20found');logger[_0x8521('0x20')]('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x570c15,_0x41797a,'entity\x20found',JSON[_0x8521('0x22')](_0xe25095));if(_0x3411b6['account']['type']===_0x8521('0x95')){return _0x58af28[_0x8521('0x2a')](_0x41797a)['set']('Content-Type',_0x8521('0xb5'))[_0x8521('0xb6')](_0x8521('0xb7'));}else{return _0x58af28['status'](_0x41797a)[_0x8521('0x2c')](_0xe25095);}}});})[_0x8521('0x28')](handleError(_0x58af28,null));};exports['send']=function(_0x114a3a,_0x233883,_0xb0890b){var _0x4de8de,_0x16894b,_0x116656;if(_['isNil'](_0x114a3a[_0x8521('0x5a')][_0x8521('0x5a')])||_0x114a3a[_0x8521('0x5a')][_0x8521('0x5a')]===''){throw new db['Sequelize'][(_0x8521('0x8f'))](_0x8521('0xb8'));}if(_[_0x8521('0x9d')](_0x114a3a[_0x8521('0x5a')]['to'])){throw new db[(_0x8521('0x8e'))][(_0x8521('0x8f'))](_0x8521('0xb9'));}_0x4de8de=_0x114a3a['body']['to'];return db[_0x8521('0x3e')]['find']({'where':{'id':_0x114a3a[_0x8521('0x61')]['id']},'include':[{'model':db['CmList'],'as':_0x8521('0xba'),'include':[{'model':db['CmContact'],'as':_0x8521('0xa0'),'where':{'mobile':_0x4de8de},'limit':0x1,'order':[[_0x8521('0x93'),_0x8521('0xa1')]]}]}]})['then'](handleEntityNotFound(_0x233883,null))[_0x8521('0x1e')](function(_0x15a2e6){if(_0x15a2e6&&_0x15a2e6[_0x8521('0xba')]){_0x16894b=_0x15a2e6[_0x8521('0x37')]({'plain':!![]});if(_0x16894b[_0x8521('0xba')]&&_0x16894b['List'][_0x8521('0xa0')]['length']){return _0x16894b[_0x8521('0xba')][_0x8521('0xa0')][0x0];}return db['CmContact'][_0x8521('0x59')](_[_0x8521('0xa4')](_0x114a3a[_0x8521('0x5a')],{'firstName':_0x4de8de,'mobile':_0x4de8de,'phone':_0x4de8de,'ListId':_0x16894b[_0x8521('0x94')]}));}})['then'](handleEntityNotFound(_0x233883,null))[_0x8521('0x1e')](function(_0x14ab07){if(_0x14ab07){_0x116656=_0x14ab07;return db[_0x8521('0xbb')]['find']({'where':{'ContactId':_0x116656['id'],'closed':![],'WhatsappAccountId':_0x16894b['id']}})[_0x8521('0x1e')](function(_0x2afb79){if(_0x2afb79){return[_0x2afb79,![]];}return db[_0x8521('0xbb')][_0x8521('0x59')]({'UserId':_0x114a3a[_0x8521('0x5b')]['id'],'ContactId':_0x116656['id'],'WhatsappAccountId':_0x16894b['id'],'phone':_0x4de8de,'firstMsgDirection':'out','Messages':[_[_0x8521('0x50')](_0x114a3a['body'],{'read':![],'body':_0x114a3a['body'][_0x8521('0x5a')],'phone':_0x4de8de,'WhatsappAccountId':_0x16894b['id'],'UserId':_0x114a3a[_0x8521('0x5b')]['id'],'ContactId':_0x116656['id']})]},{'include':[{'model':db[_0x8521('0xbc')],'as':_0x8521('0xbd')}]})[_0x8521('0x1e')](function(_0x1bc1a9){return[_0x1bc1a9,!![]];});});}})[_0x8521('0x70')](function(_0x2f3c0e,_0x4fdfc5){if(_0x4fdfc5){return _0x2f3c0e;}return db[_0x8521('0xbc')][_0x8521('0x59')](_[_0x8521('0x50')](_0x114a3a['body'],{'read':![],'body':_0x114a3a[_0x8521('0x5a')][_0x8521('0x5a')],'phone':_0x4de8de,'WhatsappAccountId':_0x16894b['id'],'WhatsappInteractionId':_0x2f3c0e['id'],'UserId':_0x114a3a[_0x8521('0x5b')]['id'],'ContactId':_0x116656['id']}))[_0x8521('0x1e')](function(_0x3690f2){_0x2f3c0e[_0x8521('0xbe')][_0x8521('0xbd')]=[];_0x2f3c0e['dataValues'][_0x8521('0xbd')][_0x8521('0xbf')](_0x3690f2[_0x8521('0xbe')]);return _0x2f3c0e;});})['then'](respondWithResult(_0x233883,null))['catch'](handleError(_0x233883,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 592ce05..5043892 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 _0xa4ab=['remove','emit','hasOwnProperty','hook','exports','events','WhatsappAccount','setMaxListeners','save','update'];(function(_0x4fa361,_0x5bfce3){var _0x342f18=function(_0x99eaa9){while(--_0x99eaa9){_0x4fa361['push'](_0x4fa361['shift']());}};_0x342f18(++_0x5bfce3);}(_0xa4ab,0x9b));var _0xba4a=function(_0x52ea08,_0x15d935){_0x52ea08=_0x52ea08-0x0;var _0x28d546=_0xa4ab[_0x52ea08];return _0x28d546;};'use strict';var EventEmitter=require(_0xba4a('0x0'));var WhatsappAccount=require('../../mysqldb')['db'][_0xba4a('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xba4a('0x2')](0x0);var events={'afterCreate':_0xba4a('0x3'),'afterUpdate':_0xba4a('0x4'),'afterDestroy':_0xba4a('0x5')};function emitEvent(_0x40f96e){return function(_0x400467,_0x18246c,_0x1215da){WhatsappAccountEvents[_0xba4a('0x6')](_0x40f96e+':'+_0x400467['id'],_0x400467);WhatsappAccountEvents[_0xba4a('0x6')](_0x40f96e,_0x400467);_0x1215da(null);};}for(var e in events){if(events[_0xba4a('0x7')](e)){var event=events[e];WhatsappAccount[_0xba4a('0x8')](e,emitEvent(event));}}module[_0xba4a('0x9')]=WhatsappAccountEvents; \ No newline at end of file +var _0x707d=['exports','events','../../mysqldb','WhatsappAccount','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x15236c,_0x2e6595){var _0xaedb45=function(_0x46b6a8){while(--_0x46b6a8){_0x15236c['push'](_0x15236c['shift']());}};_0xaedb45(++_0x2e6595);}(_0x707d,0x65));var _0xd707=function(_0x538af7,_0x1a7a74){_0x538af7=_0x538af7-0x0;var _0x2eff0d=_0x707d[_0x538af7];return _0x2eff0d;};'use strict';var EventEmitter=require(_0xd707('0x0'));var WhatsappAccount=require(_0xd707('0x1'))['db'][_0xd707('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd707('0x3'),'afterUpdate':_0xd707('0x4'),'afterDestroy':_0xd707('0x5')};function emitEvent(_0x3b8903){return function(_0xabad41,_0x23d6e6,_0x515d0d){WhatsappAccountEvents[_0xd707('0x6')](_0x3b8903+':'+_0xabad41['id'],_0xabad41);WhatsappAccountEvents[_0xd707('0x6')](_0x3b8903,_0xabad41);_0x515d0d(null);};}for(var e in events){if(events[_0xd707('0x7')](e)){var event=events[e];WhatsappAccount[_0xd707('0x8')](e,emitEvent(event));}}module[_0xd707('0x9')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 4edfdd2..90803f4 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 _0x4671=['../../config/environment','./whatsappAccount.attributes','exports','define','WhatsappAccount','whatsapp_accounts','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x5e53ba,_0x2e737d){var _0x248757=function(_0x45cf89){while(--_0x45cf89){_0x5e53ba['push'](_0x5e53ba['shift']());}};_0x248757(++_0x2e737d);}(_0x4671,0xd8));var _0x1467=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4671[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x1467('0x0'));var util=require(_0x1467('0x1'));var logger=require(_0x1467('0x2'))('api');var moment=require(_0x1467('0x3'));var BPromise=require(_0x1467('0x4'));var rp=require(_0x1467('0x5'));var fs=require('fs');var path=require(_0x1467('0x6'));var rimraf=require(_0x1467('0x7'));var config=require(_0x1467('0x8'));var attributes=require(_0x1467('0x9'));module[_0x1467('0xa')]=function(_0x1d6536,_0x31d589){return _0x1d6536[_0x1467('0xb')](_0x1467('0xc'),attributes,{'tableName':_0x1467('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x46e0=['util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./whatsappAccount.attributes','define','WhatsappAccount','lodash'];(function(_0x2c29e5,_0x2d9290){var _0x3a5bc4=function(_0x559fa8){while(--_0x559fa8){_0x2c29e5['push'](_0x2c29e5['shift']());}};_0x3a5bc4(++_0x2d9290);}(_0x46e0,0x196));var _0x046e=function(_0x515e05,_0xed366c){_0x515e05=_0x515e05-0x0;var _0x5efaf8=_0x46e0[_0x515e05];return _0x5efaf8;};'use strict';var _=require(_0x046e('0x0'));var util=require(_0x046e('0x1'));var logger=require(_0x046e('0x2'))('api');var moment=require(_0x046e('0x3'));var BPromise=require('bluebird');var rp=require(_0x046e('0x4'));var fs=require('fs');var path=require(_0x046e('0x5'));var rimraf=require(_0x046e('0x6'));var config=require(_0x046e('0x7'));var attributes=require(_0x046e('0x8'));module['exports']=function(_0x2888dd,_0x585df5){return _0x2888dd[_0x046e('0x9')](_0x046e('0xa'),attributes,{'tableName':'whatsapp_accounts','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 beec9d8..6febb29 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 _0xe5fc=['attributes','include','map','model','ShowWhatsappAccount','stringify','lodash','moment','bluebird','randomstring','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./whatsappAccount.socket','register','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','WhatsappAccount','find','options','raw','where'];(function(_0xf0bc07,_0x510ebf){var _0x1c50c2=function(_0x2e2bdf){while(--_0x2e2bdf){_0xf0bc07['push'](_0xf0bc07['shift']());}};_0x1c50c2(++_0x510ebf);}(_0xe5fc,0x109));var _0xce5f=function(_0x1431aa,_0x4d9845){_0x1431aa=_0x1431aa-0x0;var _0x5de3b1=_0xe5fc[_0x1431aa];return _0x5de3b1;};'use strict';var _=require(_0xce5f('0x0'));var util=require('util');var moment=require(_0xce5f('0x1'));var BPromise=require(_0xce5f('0x2'));var rs=require(_0xce5f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xce5f('0x4'))('rpc');var config=require(_0xce5f('0x5'));var jayson=require(_0xce5f('0x6'));var client=jayson[_0xce5f('0x7')][_0xce5f('0x8')]({'port':0x232a});config[_0xce5f('0x9')]=_[_0xce5f('0xa')](config[_0xce5f('0x9')],{'host':_0xce5f('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xce5f('0x9')]));require(_0xce5f('0xc'))[_0xce5f('0xd')](socket);function respondWithRpcPromise(_0x44f5aa,_0x36da1e,_0x131f10){return new BPromise(function(_0x2cec65,_0x509dfa){return client[_0xce5f('0xe')](_0x44f5aa,_0x131f10)[_0xce5f('0xf')](function(_0x15b0be){logger[_0xce5f('0x10')](_0xce5f('0x11'),_0x36da1e,_0xce5f('0x12'));logger[_0xce5f('0x13')](_0xce5f('0x14'),_0x36da1e,_0xce5f('0x12'),JSON['stringify'](_0x15b0be));if(_0x15b0be['error']){if(_0x15b0be['error'][_0xce5f('0x15')]===0x1f4){logger[_0xce5f('0x16')](_0xce5f('0x11'),_0x36da1e,_0x15b0be[_0xce5f('0x16')]['message']);return _0x509dfa(_0x15b0be[_0xce5f('0x16')][_0xce5f('0x17')]);}logger[_0xce5f('0x16')](_0xce5f('0x11'),_0x36da1e,_0x15b0be[_0xce5f('0x16')][_0xce5f('0x17')]);return _0x2cec65(_0x15b0be[_0xce5f('0x16')][_0xce5f('0x17')]);}else{logger[_0xce5f('0x10')](_0xce5f('0x11'),_0x36da1e,_0xce5f('0x12'));_0x2cec65(_0x15b0be[_0xce5f('0x18')][_0xce5f('0x17')]);}})[_0xce5f('0x19')](function(_0x1c4132){logger[_0xce5f('0x16')]('WhatsappAccount,\x20%s,\x20%s',_0x36da1e,_0x1c4132);_0x509dfa(_0x1c4132);});});}exports['ShowWhatsappAccount']=function(_0x530170){var _0x225854=this;return new Promise(function(_0x1087ea,_0x32a377){return db[_0xce5f('0x1a')][_0xce5f('0x1b')]({'raw':_0x530170[_0xce5f('0x1c')]?_0x530170[_0xce5f('0x1c')][_0xce5f('0x1d')]===undefined?!![]:![]:!![],'where':_0x530170[_0xce5f('0x1c')]?_0x530170['options'][_0xce5f('0x1e')]||null:null,'attributes':_0x530170[_0xce5f('0x1c')]?_0x530170['options'][_0xce5f('0x1f')]||null:null,'include':_0x530170[_0xce5f('0x1c')]?_0x530170[_0xce5f('0x1c')][_0xce5f('0x20')]?_[_0xce5f('0x21')](_0x530170['options']['include'],function(_0x3d44fc){return{'model':db[_0x3d44fc[_0xce5f('0x22')]],'as':_0x3d44fc['as'],'attributes':_0x3d44fc[_0xce5f('0x1f')],'include':_0x3d44fc[_0xce5f('0x20')]?_['map'](_0x3d44fc[_0xce5f('0x20')],function(_0x32cb28){return{'model':db[_0x32cb28[_0xce5f('0x22')]],'as':_0x32cb28['as'],'attributes':_0x32cb28[_0xce5f('0x1f')],'include':_0x32cb28[_0xce5f('0x20')]?_[_0xce5f('0x21')](_0x32cb28[_0xce5f('0x20')],function(_0x118ccf){return{'model':db[_0x118ccf[_0xce5f('0x22')]],'as':_0x118ccf['as'],'attributes':_0x118ccf[_0xce5f('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x219ede){logger[_0xce5f('0x10')](_0xce5f('0x23'),_0x530170);logger[_0xce5f('0x13')](_0xce5f('0x23'),_0x530170,JSON[_0xce5f('0x24')](_0x219ede));_0x1087ea(_0x219ede);})[_0xce5f('0x19')](function(_0x2c39fa){logger[_0xce5f('0x16')]('ShowWhatsappAccount',_0x2c39fa['message'],_0x530170);_0x32a377(_0x225854[_0xce5f('0x16')](0x1f4,_0x2c39fa['message']));});});}; \ No newline at end of file +var _0x7033=['request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','ShowWhatsappAccount','find','options','where','include','map','model','attributes','then','stringify','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./whatsappAccount.socket','register','WhatsappAccount,\x20%s,\x20%s'];(function(_0x393d69,_0x3a8c83){var _0x3cee37=function(_0x462682){while(--_0x462682){_0x393d69['push'](_0x393d69['shift']());}};_0x3cee37(++_0x3a8c83);}(_0x7033,0x19e));var _0x3703=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x7033[_0x53ccf2];return _0x5a2964;};'use strict';var _=require(_0x3703('0x0'));var util=require(_0x3703('0x1'));var moment=require(_0x3703('0x2'));var BPromise=require(_0x3703('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3703('0x4'));var db=require(_0x3703('0x5'))['db'];var utils=require(_0x3703('0x6'));var logger=require(_0x3703('0x7'))(_0x3703('0x8'));var config=require(_0x3703('0x9'));var jayson=require(_0x3703('0xa'));var client=jayson[_0x3703('0xb')][_0x3703('0xc')]({'port':0x232a});config[_0x3703('0xd')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x3703('0xe'))(new Redis(config[_0x3703('0xd')]));require(_0x3703('0xf'))[_0x3703('0x10')](socket);function respondWithRpcPromise(_0x97fbf8,_0x5b252d,_0x6acdb7){return new BPromise(function(_0x367148,_0x28e18d){return client['request'](_0x97fbf8,_0x6acdb7)['then'](function(_0x3a3a0f){logger['info'](_0x3703('0x11'),_0x5b252d,_0x3703('0x12'));logger[_0x3703('0x13')](_0x3703('0x14'),_0x5b252d,'request\x20sent',JSON['stringify'](_0x3a3a0f));if(_0x3a3a0f[_0x3703('0x15')]){if(_0x3a3a0f[_0x3703('0x15')][_0x3703('0x16')]===0x1f4){logger[_0x3703('0x15')](_0x3703('0x11'),_0x5b252d,_0x3a3a0f[_0x3703('0x15')][_0x3703('0x17')]);return _0x28e18d(_0x3a3a0f[_0x3703('0x15')][_0x3703('0x17')]);}logger[_0x3703('0x15')](_0x3703('0x11'),_0x5b252d,_0x3a3a0f[_0x3703('0x15')][_0x3703('0x17')]);return _0x367148(_0x3a3a0f[_0x3703('0x15')]['message']);}else{logger[_0x3703('0x18')]('WhatsappAccount,\x20%s,\x20%s',_0x5b252d,_0x3703('0x12'));_0x367148(_0x3a3a0f['result'][_0x3703('0x17')]);}})['catch'](function(_0x176ddc){logger[_0x3703('0x15')]('WhatsappAccount,\x20%s,\x20%s',_0x5b252d,_0x176ddc);_0x28e18d(_0x176ddc);});});}exports[_0x3703('0x19')]=function(_0x3f908d){var _0x40f9e3=this;return new Promise(function(_0x67686e,_0x2a4983){return db['WhatsappAccount'][_0x3703('0x1a')]({'raw':_0x3f908d[_0x3703('0x1b')]?_0x3f908d[_0x3703('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x3f908d[_0x3703('0x1b')]?_0x3f908d[_0x3703('0x1b')][_0x3703('0x1c')]||null:null,'attributes':_0x3f908d['options']?_0x3f908d['options']['attributes']||null:null,'include':_0x3f908d[_0x3703('0x1b')]?_0x3f908d[_0x3703('0x1b')][_0x3703('0x1d')]?_[_0x3703('0x1e')](_0x3f908d['options']['include'],function(_0x1bef7c){return{'model':db[_0x1bef7c['model']],'as':_0x1bef7c['as'],'attributes':_0x1bef7c['attributes'],'include':_0x1bef7c[_0x3703('0x1d')]?_[_0x3703('0x1e')](_0x1bef7c['include'],function(_0x21a95c){return{'model':db[_0x21a95c[_0x3703('0x1f')]],'as':_0x21a95c['as'],'attributes':_0x21a95c[_0x3703('0x20')],'include':_0x21a95c[_0x3703('0x1d')]?_[_0x3703('0x1e')](_0x21a95c['include'],function(_0x5abdbd){return{'model':db[_0x5abdbd[_0x3703('0x1f')]],'as':_0x5abdbd['as'],'attributes':_0x5abdbd['attributes']};}):[]};}):[]};}):[]:[]})[_0x3703('0x21')](function(_0x1b8211){logger['info']('ShowWhatsappAccount',_0x3f908d);logger[_0x3703('0x13')](_0x3703('0x19'),_0x3f908d,JSON[_0x3703('0x22')](_0x1b8211));_0x67686e(_0x1b8211);})[_0x3703('0x23')](function(_0x2c6c19){logger[_0x3703('0x15')](_0x3703('0x19'),_0x2c6c19[_0x3703('0x17')],_0x3f908d);_0x2a4983(_0x40f9e3[_0x3703('0x15')](0x1f4,_0x2c6c19[_0x3703('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 23cabcb..0b33c59 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 _0xc4b5=['whatsappAccount:','./whatsappAccount.events','save','remove','update','emit','removeListener','register'];(function(_0x35be76,_0x2aff90){var _0x51531d=function(_0x51e6f7){while(--_0x51e6f7){_0x35be76['push'](_0x35be76['shift']());}};_0x51531d(++_0x2aff90);}(_0xc4b5,0x69));var _0x5c4b=function(_0x2ba0d2,_0x1c7d0e){_0x2ba0d2=_0x2ba0d2-0x0;var _0x4cc14f=_0xc4b5[_0x2ba0d2];return _0x4cc14f;};'use strict';var WhatsappAccountEvents=require(_0x5c4b('0x0'));var events=[_0x5c4b('0x1'),_0x5c4b('0x2'),_0x5c4b('0x3')];function createListener(_0x547b46,_0x576917){return function(_0x2229b3){_0x576917[_0x5c4b('0x4')](_0x547b46,_0x2229b3);};}function removeListener(_0x2cef4a,_0x2b8583){return function(){WhatsappAccountEvents[_0x5c4b('0x5')](_0x2cef4a,_0x2b8583);};}exports[_0x5c4b('0x6')]=function(_0x3d55c6){for(var _0x3b6471=0x0,_0x30f265=events['length'];_0x3b6471<_0x30f265;_0x3b6471++){var _0x5ec5cf=events[_0x3b6471];var _0x876d75=createListener(_0x5c4b('0x7')+_0x5ec5cf,_0x3d55c6);WhatsappAccountEvents['on'](_0x5ec5cf,_0x876d75);}}; \ No newline at end of file +var _0xd046=['length','whatsappAccount:','./whatsappAccount.events','remove','emit','removeListener','register'];(function(_0x495d79,_0x42c95d){var _0x2206f3=function(_0x1167f6){while(--_0x1167f6){_0x495d79['push'](_0x495d79['shift']());}};_0x2206f3(++_0x42c95d);}(_0xd046,0x1a6));var _0x6d04=function(_0x4bef1c,_0x636e5f){_0x4bef1c=_0x4bef1c-0x0;var _0x5e66cb=_0xd046[_0x4bef1c];return _0x5e66cb;};'use strict';var WhatsappAccountEvents=require(_0x6d04('0x0'));var events=['save',_0x6d04('0x1'),'update'];function createListener(_0x53b100,_0x4ac7f6){return function(_0x2d0a78){_0x4ac7f6[_0x6d04('0x2')](_0x53b100,_0x2d0a78);};}function removeListener(_0x22653b,_0x4d9db5){return function(){WhatsappAccountEvents[_0x6d04('0x3')](_0x22653b,_0x4d9db5);};}exports[_0x6d04('0x4')]=function(_0x44bdaa){for(var _0x2b5a1e=0x0,_0x3fc1b8=events[_0x6d04('0x5')];_0x2b5a1e<_0x3fc1b8;_0x2b5a1e++){var _0x39129d=events[_0x2b5a1e];var _0x578fee=createListener(_0x6d04('0x6')+_0x39129d,_0x44bdaa);WhatsappAccountEvents['on'](_0x39129d,_0x578fee);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 1b5c756..b7f7ea9 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 _0xd6f3=['exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','isAuthenticated','get','/:id','show','post','put','update','delete','destroy'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0xd6f3,0x1cd));var _0x3d6f=function(_0x10c1bf,_0x36d7c9){_0x10c1bf=_0x10c1bf-0x0;var _0x4c7a26=_0xd6f3[_0x10c1bf];return _0x4c7a26;};'use strict';var multer=require(_0x3d6f('0x0'));var util=require(_0x3d6f('0x1'));var path=require(_0x3d6f('0x2'));var timeout=require(_0x3d6f('0x3'));var express=require('express');var router=express[_0x3d6f('0x4')]();var fs_extra=require(_0x3d6f('0x5'));var auth=require(_0x3d6f('0x6'));var interaction=require(_0x3d6f('0x7'));var config=require(_0x3d6f('0x8'));var controller=require(_0x3d6f('0x9'));router['get']('/',auth[_0x3d6f('0xa')](),controller['index']);router[_0x3d6f('0xb')](_0x3d6f('0xc'),auth['isAuthenticated'](),controller[_0x3d6f('0xd')]);router[_0x3d6f('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x3d6f('0xf')](_0x3d6f('0xc'),auth[_0x3d6f('0xa')](),controller[_0x3d6f('0x10')]);router[_0x3d6f('0x11')](_0x3d6f('0xc'),auth[_0x3d6f('0xa')](),controller[_0x3d6f('0x12')]);module[_0x3d6f('0x13')]=router; \ No newline at end of file +var _0xe9b9=['../../config/environment','./whatsappApplication.controller','get','index','isAuthenticated','show','post','create','put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x4fa1c8,_0x3465ae){var _0x5d5090=function(_0x5792bd){while(--_0x5792bd){_0x4fa1c8['push'](_0x4fa1c8['shift']());}};_0x5d5090(++_0x3465ae);}(_0xe9b9,0xa8));var _0x9e9b=function(_0x2c3b20,_0x23bada){_0x2c3b20=_0x2c3b20-0x0;var _0x26f206=_0xe9b9[_0x2c3b20];return _0x26f206;};'use strict';var multer=require(_0x9e9b('0x0'));var util=require(_0x9e9b('0x1'));var path=require(_0x9e9b('0x2'));var timeout=require(_0x9e9b('0x3'));var express=require(_0x9e9b('0x4'));var router=express['Router']();var fs_extra=require(_0x9e9b('0x5'));var auth=require(_0x9e9b('0x6'));var interaction=require(_0x9e9b('0x7'));var config=require(_0x9e9b('0x8'));var controller=require(_0x9e9b('0x9'));router[_0x9e9b('0xa')]('/',auth['isAuthenticated'](),controller[_0x9e9b('0xb')]);router[_0x9e9b('0xa')]('/:id',auth[_0x9e9b('0xc')](),controller[_0x9e9b('0xd')]);router[_0x9e9b('0xe')]('/',auth[_0x9e9b('0xc')](),controller[_0x9e9b('0xf')]);router[_0x9e9b('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x9e9b('0x11')]);router[_0x9e9b('0x12')](_0x9e9b('0x13'),auth[_0x9e9b('0xc')](),controller[_0x9e9b('0x14')]);module[_0x9e9b('0x15')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 8e4f07a..63156ba 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 _0xe147=['exports','INTEGER','noop','STRING','*,*,*,*'];(function(_0x55fb60,_0x4a926c){var _0x294b88=function(_0x5cf3b8){while(--_0x5cf3b8){_0x55fb60['push'](_0x55fb60['shift']());}};_0x294b88(++_0x4a926c);}(_0xe147,0x19a));var _0x7e14=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xe147[_0x432682];return _0x463d05;};'use strict';var Sequelize=require('sequelize');module[_0x7e14('0x0')]={'priority':{'type':Sequelize[_0x7e14('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x7e14('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x7e14('0x3')],'defaultValue':_0x7e14('0x4')}}; \ No newline at end of file +var _0xe45b=['TEXT','STRING','*,*,*,*','sequelize','INTEGER'];(function(_0x1af9f2,_0x2889d9){var _0x17aa0f=function(_0x23e44d){while(--_0x23e44d){_0x1af9f2['push'](_0x1af9f2['shift']());}};_0x17aa0f(++_0x2889d9);}(_0xe45b,0xcb));var _0xbe45=function(_0x1d7827,_0x42b0db){_0x1d7827=_0x1d7827-0x0;var _0xb449f1=_0xe45b[_0x1d7827];return _0xb449f1;};'use strict';var Sequelize=require(_0xbe45('0x0'));module['exports']={'priority':{'type':Sequelize[_0xbe45('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xbe45('0x2')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xbe45('0x3')],'defaultValue':_0xbe45('0x4')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 201b3df..85f9b4a 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 _0x7041=['WhatsappApplication','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','rows','catch','show','keys','find','create','body','params','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','ejs','fs-extra','lodash','squel','to-csv','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','Content-Range','apply','reject','update','destroy','then','stack','name','index','map'];(function(_0xe7e2f0,_0x544e64){var _0x2e6f61=function(_0x29e529){while(--_0x29e529){_0xe7e2f0['push'](_0xe7e2f0['shift']());}};_0x2e6f61(++_0x544e64);}(_0x7041,0xdd));var _0x1704=function(_0x20729c,_0x326855){_0x20729c=_0x20729c-0x0;var _0x5bc305=_0x7041[_0x20729c];return _0x5bc305;};'use strict';var emlformat=require(_0x1704('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1704('0x1'));var jsonpatch=require(_0x1704('0x2'));var rp=require('request-promise');var moment=require(_0x1704('0x3'));var BPromise=require(_0x1704('0x4'));var Mustache=require(_0x1704('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1704('0x6'));var fs=require('fs');var fs_extra=require(_0x1704('0x7'));var _=require(_0x1704('0x8'));var squel=require(_0x1704('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1704('0xa'));var querystring=require(_0x1704('0xb'));var Papa=require(_0x1704('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1704('0xd'));var hardwareService=require(_0x1704('0xe'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x1704('0xf'));var licenseUtil=require(_0x1704('0x10'));var db=require(_0x1704('0x11'))['db'];function respondWithStatusCode(_0x4be3e4,_0x4f4416){_0x4f4416=_0x4f4416||0xcc;return function(_0x47fdeb){if(_0x47fdeb){return _0x4be3e4[_0x1704('0x12')](_0x4f4416);}return _0x4be3e4[_0x1704('0x13')](_0x4f4416)[_0x1704('0x14')]();};}function respondWithResult(_0x2b0e20,_0x130722){_0x130722=_0x130722||0xc8;return function(_0x375274){if(_0x375274){return _0x2b0e20[_0x1704('0x13')](_0x130722)[_0x1704('0x15')](_0x375274);}};}function respondWithFilteredResult(_0x355253,_0x5df802){return function(_0x24d144){if(_0x24d144){var _0x1d0aa6=typeof _0x5df802[_0x1704('0x16')]==='undefined'&&typeof _0x5df802[_0x1704('0x17')]==='undefined';var _0x43940b=_0x24d144[_0x1704('0x18')];var _0x24fd08=_0x1d0aa6?0x0:_0x5df802[_0x1704('0x16')];var _0x84818b=_0x1d0aa6?_0x24d144[_0x1704('0x18')]:_0x5df802[_0x1704('0x16')]+_0x5df802['limit'];var _0x243c10;if(_0x84818b>=_0x43940b){_0x84818b=_0x43940b;_0x243c10=0xc8;}else{_0x243c10=0xce;}_0x355253[_0x1704('0x13')](_0x243c10);return _0x355253['set'](_0x1704('0x19'),_0x24fd08+'-'+_0x84818b+'/'+_0x43940b)['json'](_0x24d144);}return null;};}function patchUpdates(_0xfe2eb0){return function(_0x17177b){try{jsonpatch[_0x1704('0x1a')](_0x17177b,_0xfe2eb0,!![]);}catch(_0x36461e){return BPromise[_0x1704('0x1b')](_0x36461e);}return _0x17177b['save']();};}function saveUpdates(_0x18f8cc,_0x318137){return function(_0x588cc6){if(_0x588cc6){return _0x588cc6[_0x1704('0x1c')](_0x18f8cc)['then'](function(_0x52aba9){return _0x52aba9;});}return null;};}function removeEntity(_0x1af7a1,_0x17cb8d){return function(_0x8eb551){if(_0x8eb551){return _0x8eb551[_0x1704('0x1d')]()[_0x1704('0x1e')](function(){_0x1af7a1[_0x1704('0x13')](0xcc)[_0x1704('0x14')]();});}};}function handleEntityNotFound(_0x1786e5,_0x4527f8){return function(_0x2468cf){if(!_0x2468cf){_0x1786e5[_0x1704('0x12')](0x194);}return _0x2468cf;};}function handleError(_0x20a907,_0x375d3d){_0x375d3d=_0x375d3d||0x1f4;return function(_0x320404){logger['error'](_0x320404[_0x1704('0x1f')]);if(_0x320404[_0x1704('0x20')]){delete _0x320404['name'];}_0x20a907[_0x1704('0x13')](_0x375d3d)['send'](_0x320404);};}exports[_0x1704('0x21')]=function(_0x1917ef,_0x324be0){var _0x295faa={},_0xf7edb1={},_0x232509={'count':0x0,'rows':[]};var _0x446280=_[_0x1704('0x22')](db[_0x1704('0x23')][_0x1704('0x24')],function(_0x2a8ec3){return{'name':_0x2a8ec3['fieldName'],'type':_0x2a8ec3[_0x1704('0x25')][_0x1704('0x26')]};});_0xf7edb1[_0x1704('0x27')]=_[_0x1704('0x22')](_0x446280,_0x1704('0x20'));_0xf7edb1[_0x1704('0x28')]=_['keys'](_0x1917ef['query']);_0xf7edb1[_0x1704('0x29')]=_[_0x1704('0x2a')](_0xf7edb1[_0x1704('0x27')],_0xf7edb1[_0x1704('0x28')]);_0x295faa[_0x1704('0x2b')]=_[_0x1704('0x2a')](_0xf7edb1[_0x1704('0x27')],qs[_0x1704('0x2c')](_0x1917ef[_0x1704('0x28')][_0x1704('0x2c')]));_0x295faa[_0x1704('0x2b')]=_0x295faa[_0x1704('0x2b')][_0x1704('0x2d')]?_0x295faa[_0x1704('0x2b')]:_0xf7edb1['model'];if(!_0x1917ef[_0x1704('0x28')][_0x1704('0x2e')](_0x1704('0x2f'))){_0x295faa[_0x1704('0x17')]=qs[_0x1704('0x17')](_0x1917ef[_0x1704('0x28')]['limit']);_0x295faa['offset']=qs[_0x1704('0x16')](_0x1917ef['query']['offset']);}_0x295faa[_0x1704('0x30')]=qs[_0x1704('0x31')](_0x1917ef['query'][_0x1704('0x31')]);_0x295faa[_0x1704('0x32')]=qs['filters'](_['pick'](_0x1917ef[_0x1704('0x28')],_0xf7edb1[_0x1704('0x29')]),_0x446280);if(_0x1917ef[_0x1704('0x28')]['filter']){_0x295faa[_0x1704('0x32')]=_[_0x1704('0x33')](_0x295faa[_0x1704('0x32')],{'$or':_[_0x1704('0x22')](_0x446280,function(_0x4db440){if(_0x4db440[_0x1704('0x25')]!==_0x1704('0x34')){var _0x1a99fc={};_0x1a99fc[_0x4db440[_0x1704('0x20')]]={'$like':'%'+_0x1917ef[_0x1704('0x28')][_0x1704('0x35')]+'%'};return _0x1a99fc;}})});}_0x295faa=_['merge']({},_0x295faa,_0x1917ef[_0x1704('0x36')]);var _0x3765d1={'where':_0x295faa['where']};return db['WhatsappApplication'][_0x1704('0x18')](_0x3765d1)['then'](function(_0x44b5d8){_0x232509[_0x1704('0x18')]=_0x44b5d8;if(_0x1917ef[_0x1704('0x28')][_0x1704('0x37')]){_0x295faa['include']=[{'all':!![]}];}return db['WhatsappApplication']['findAll'](_0x295faa);})[_0x1704('0x1e')](function(_0x4c69dd){_0x232509[_0x1704('0x38')]=_0x4c69dd;return _0x232509;})['then'](respondWithFilteredResult(_0x324be0,_0x295faa))[_0x1704('0x39')](handleError(_0x324be0,null));};exports[_0x1704('0x3a')]=function(_0x1baaef,_0x4c5dcb){var _0x2f25b4={'raw':!![],'where':{'id':_0x1baaef['params']['id']}},_0x364bc9={};_0x364bc9[_0x1704('0x27')]=_['keys'](db[_0x1704('0x23')][_0x1704('0x24')]);_0x364bc9[_0x1704('0x28')]=_[_0x1704('0x3b')](_0x1baaef['query']);_0x364bc9[_0x1704('0x29')]=_['intersection'](_0x364bc9[_0x1704('0x27')],_0x364bc9[_0x1704('0x28')]);_0x2f25b4[_0x1704('0x2b')]=_['intersection'](_0x364bc9['model'],qs[_0x1704('0x2c')](_0x1baaef[_0x1704('0x28')]['fields']));_0x2f25b4[_0x1704('0x2b')]=_0x2f25b4[_0x1704('0x2b')][_0x1704('0x2d')]?_0x2f25b4[_0x1704('0x2b')]:_0x364bc9['model'];if(_0x1baaef[_0x1704('0x28')][_0x1704('0x37')]){_0x2f25b4['include']=[{'all':!![]}];}_0x2f25b4=_[_0x1704('0x33')]({},_0x2f25b4,_0x1baaef['options']);return db['WhatsappApplication'][_0x1704('0x3c')](_0x2f25b4)[_0x1704('0x1e')](handleEntityNotFound(_0x4c5dcb,null))[_0x1704('0x1e')](respondWithResult(_0x4c5dcb,null))['catch'](handleError(_0x4c5dcb,null));};exports['create']=function(_0x825d73,_0x20b7c9){return db[_0x1704('0x23')][_0x1704('0x3d')](_0x825d73['body'],{})[_0x1704('0x1e')](respondWithResult(_0x20b7c9,0xc9))[_0x1704('0x39')](handleError(_0x20b7c9,null));};exports['update']=function(_0x51985f,_0x44baff){if(_0x51985f['body']['id']){delete _0x51985f[_0x1704('0x3e')]['id'];}return db[_0x1704('0x23')]['find']({'where':{'id':_0x51985f['params']['id']}})['then'](handleEntityNotFound(_0x44baff,null))[_0x1704('0x1e')](saveUpdates(_0x51985f[_0x1704('0x3e')],null))['then'](respondWithResult(_0x44baff,null))[_0x1704('0x39')](handleError(_0x44baff,null));};exports[_0x1704('0x1d')]=function(_0x395b1f,_0x57b1df){return db[_0x1704('0x23')]['find']({'where':{'id':_0x395b1f[_0x1704('0x3f')]['id']}})[_0x1704('0x1e')](handleEntityNotFound(_0x57b1df,null))[_0x1704('0x1e')](removeEntity(_0x57b1df,null))['catch'](handleError(_0x57b1df,null));}; \ No newline at end of file +var _0xb8a0=['keys','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','VIRTUAL','merge','includeAll','include','findAll','catch','params','options','find','create','body','update','zip-dir','fast-json-patch','moment','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','then','destroy','error','stack','name','send','index','map','WhatsappApplication','rawAttributes','type','key','query'];(function(_0x1ddedd,_0x485606){var _0xa3e1ac=function(_0x580444){while(--_0x580444){_0x1ddedd['push'](_0x1ddedd['shift']());}};_0xa3e1ac(++_0x485606);}(_0xb8a0,0x1d5));var _0x0b8a=function(_0x2873f6,_0xb08358){_0x2873f6=_0x2873f6-0x0;var _0x3f520f=_0xb8a0[_0x2873f6];return _0x3f520f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0b8a('0x0'));var jsonpatch=require(_0x0b8a('0x1'));var rp=require('request-promise');var moment=require(_0x0b8a('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x0b8a('0x3'));var csv=require(_0x0b8a('0x4'));var ejs=require(_0x0b8a('0x5'));var fs=require('fs');var fs_extra=require(_0x0b8a('0x6'));var _=require(_0x0b8a('0x7'));var squel=require(_0x0b8a('0x8'));var crypto=require(_0x0b8a('0x9'));var jsforce=require(_0x0b8a('0xa'));var deskjs=require(_0x0b8a('0xb'));var toCsv=require(_0x0b8a('0x4'));var querystring=require(_0x0b8a('0xc'));var Papa=require(_0x0b8a('0xd'));var Redis=require(_0x0b8a('0xe'));var authService=require(_0x0b8a('0xf'));var qs=require(_0x0b8a('0x10'));var as=require(_0x0b8a('0x11'));var hardwareService=require(_0x0b8a('0x12'));var logger=require(_0x0b8a('0x13'))(_0x0b8a('0x14'));var utils=require(_0x0b8a('0x15'));var config=require(_0x0b8a('0x16'));var licenseUtil=require(_0x0b8a('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x43aaa3,_0x2f7f7b){_0x2f7f7b=_0x2f7f7b||0xcc;return function(_0x3c96c9){if(_0x3c96c9){return _0x43aaa3[_0x0b8a('0x18')](_0x2f7f7b);}return _0x43aaa3[_0x0b8a('0x19')](_0x2f7f7b)[_0x0b8a('0x1a')]();};}function respondWithResult(_0x12838b,_0x4066ef){_0x4066ef=_0x4066ef||0xc8;return function(_0x1313d1){if(_0x1313d1){return _0x12838b['status'](_0x4066ef)[_0x0b8a('0x1b')](_0x1313d1);}};}function respondWithFilteredResult(_0x318983,_0x233a61){return function(_0x554237){if(_0x554237){var _0x1afb89=typeof _0x233a61[_0x0b8a('0x1c')]===_0x0b8a('0x1d')&&typeof _0x233a61['limit']==='undefined';var _0x4b58d7=_0x554237[_0x0b8a('0x1e')];var _0x51d28e=_0x1afb89?0x0:_0x233a61[_0x0b8a('0x1c')];var _0x3c80c3=_0x1afb89?_0x554237[_0x0b8a('0x1e')]:_0x233a61[_0x0b8a('0x1c')]+_0x233a61[_0x0b8a('0x1f')];var _0x39da01;if(_0x3c80c3>=_0x4b58d7){_0x3c80c3=_0x4b58d7;_0x39da01=0xc8;}else{_0x39da01=0xce;}_0x318983[_0x0b8a('0x19')](_0x39da01);return _0x318983[_0x0b8a('0x20')](_0x0b8a('0x21'),_0x51d28e+'-'+_0x3c80c3+'/'+_0x4b58d7)[_0x0b8a('0x1b')](_0x554237);}return null;};}function patchUpdates(_0x313612){return function(_0x568e89){try{jsonpatch[_0x0b8a('0x22')](_0x568e89,_0x313612,!![]);}catch(_0x2d3b49){return BPromise['reject'](_0x2d3b49);}return _0x568e89[_0x0b8a('0x23')]();};}function saveUpdates(_0x1adeb4,_0xba351e){return function(_0x344653){if(_0x344653){return _0x344653['update'](_0x1adeb4)[_0x0b8a('0x24')](function(_0x48e7dd){return _0x48e7dd;});}return null;};}function removeEntity(_0x35c45c,_0x29dbf3){return function(_0x5afa76){if(_0x5afa76){return _0x5afa76[_0x0b8a('0x25')]()[_0x0b8a('0x24')](function(){_0x35c45c[_0x0b8a('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x65f12b,_0x2d876e){return function(_0x34c83c){if(!_0x34c83c){_0x65f12b['sendStatus'](0x194);}return _0x34c83c;};}function handleError(_0x37f47b,_0x499db6){_0x499db6=_0x499db6||0x1f4;return function(_0x1ed000){logger[_0x0b8a('0x26')](_0x1ed000[_0x0b8a('0x27')]);if(_0x1ed000[_0x0b8a('0x28')]){delete _0x1ed000[_0x0b8a('0x28')];}_0x37f47b[_0x0b8a('0x19')](_0x499db6)[_0x0b8a('0x29')](_0x1ed000);};}exports[_0x0b8a('0x2a')]=function(_0x94f6b4,_0xc94471){var _0x1e61f4={},_0x20b16d={},_0x4b56fc={'count':0x0,'rows':[]};var _0x28ab04=_[_0x0b8a('0x2b')](db[_0x0b8a('0x2c')][_0x0b8a('0x2d')],function(_0x1720bc){return{'name':_0x1720bc['fieldName'],'type':_0x1720bc[_0x0b8a('0x2e')][_0x0b8a('0x2f')]};});_0x20b16d['model']=_[_0x0b8a('0x2b')](_0x28ab04,_0x0b8a('0x28'));_0x20b16d[_0x0b8a('0x30')]=_[_0x0b8a('0x31')](_0x94f6b4[_0x0b8a('0x30')]);_0x20b16d['filters']=_[_0x0b8a('0x32')](_0x20b16d[_0x0b8a('0x33')],_0x20b16d[_0x0b8a('0x30')]);_0x1e61f4[_0x0b8a('0x34')]=_[_0x0b8a('0x32')](_0x20b16d['model'],qs[_0x0b8a('0x35')](_0x94f6b4[_0x0b8a('0x30')]['fields']));_0x1e61f4[_0x0b8a('0x34')]=_0x1e61f4[_0x0b8a('0x34')][_0x0b8a('0x36')]?_0x1e61f4[_0x0b8a('0x34')]:_0x20b16d['model'];if(!_0x94f6b4[_0x0b8a('0x30')][_0x0b8a('0x37')]('nolimit')){_0x1e61f4['limit']=qs[_0x0b8a('0x1f')](_0x94f6b4[_0x0b8a('0x30')][_0x0b8a('0x1f')]);_0x1e61f4[_0x0b8a('0x1c')]=qs['offset'](_0x94f6b4[_0x0b8a('0x30')][_0x0b8a('0x1c')]);}_0x1e61f4[_0x0b8a('0x38')]=qs['sort'](_0x94f6b4[_0x0b8a('0x30')][_0x0b8a('0x39')]);_0x1e61f4[_0x0b8a('0x3a')]=qs[_0x0b8a('0x3b')](_[_0x0b8a('0x3c')](_0x94f6b4[_0x0b8a('0x30')],_0x20b16d[_0x0b8a('0x3b')]),_0x28ab04);if(_0x94f6b4[_0x0b8a('0x30')][_0x0b8a('0x3d')]){_0x1e61f4[_0x0b8a('0x3a')]=_['merge'](_0x1e61f4[_0x0b8a('0x3a')],{'$or':_[_0x0b8a('0x2b')](_0x28ab04,function(_0x23f69d){if(_0x23f69d[_0x0b8a('0x2e')]!==_0x0b8a('0x3e')){var _0xe85b9={};_0xe85b9[_0x23f69d[_0x0b8a('0x28')]]={'$like':'%'+_0x94f6b4[_0x0b8a('0x30')]['filter']+'%'};return _0xe85b9;}})});}_0x1e61f4=_[_0x0b8a('0x3f')]({},_0x1e61f4,_0x94f6b4['options']);var _0x26ad24={'where':_0x1e61f4['where']};return db[_0x0b8a('0x2c')][_0x0b8a('0x1e')](_0x26ad24)['then'](function(_0x4c51b4){_0x4b56fc[_0x0b8a('0x1e')]=_0x4c51b4;if(_0x94f6b4['query'][_0x0b8a('0x40')]){_0x1e61f4[_0x0b8a('0x41')]=[{'all':!![]}];}return db['WhatsappApplication'][_0x0b8a('0x42')](_0x1e61f4);})[_0x0b8a('0x24')](function(_0x34e08d){_0x4b56fc['rows']=_0x34e08d;return _0x4b56fc;})[_0x0b8a('0x24')](respondWithFilteredResult(_0xc94471,_0x1e61f4))[_0x0b8a('0x43')](handleError(_0xc94471,null));};exports['show']=function(_0x2cb5b7,_0x4c9c41){var _0x47f9f1={'raw':!![],'where':{'id':_0x2cb5b7[_0x0b8a('0x44')]['id']}},_0x56a6ba={};_0x56a6ba[_0x0b8a('0x33')]=_[_0x0b8a('0x31')](db[_0x0b8a('0x2c')][_0x0b8a('0x2d')]);_0x56a6ba[_0x0b8a('0x30')]=_[_0x0b8a('0x31')](_0x2cb5b7[_0x0b8a('0x30')]);_0x56a6ba[_0x0b8a('0x3b')]=_['intersection'](_0x56a6ba[_0x0b8a('0x33')],_0x56a6ba['query']);_0x47f9f1['attributes']=_['intersection'](_0x56a6ba['model'],qs[_0x0b8a('0x35')](_0x2cb5b7[_0x0b8a('0x30')][_0x0b8a('0x35')]));_0x47f9f1[_0x0b8a('0x34')]=_0x47f9f1[_0x0b8a('0x34')][_0x0b8a('0x36')]?_0x47f9f1['attributes']:_0x56a6ba[_0x0b8a('0x33')];if(_0x2cb5b7['query'][_0x0b8a('0x40')]){_0x47f9f1['include']=[{'all':!![]}];}_0x47f9f1=_[_0x0b8a('0x3f')]({},_0x47f9f1,_0x2cb5b7[_0x0b8a('0x45')]);return db[_0x0b8a('0x2c')][_0x0b8a('0x46')](_0x47f9f1)[_0x0b8a('0x24')](handleEntityNotFound(_0x4c9c41,null))[_0x0b8a('0x24')](respondWithResult(_0x4c9c41,null))['catch'](handleError(_0x4c9c41,null));};exports[_0x0b8a('0x47')]=function(_0x12cf3f,_0x2cda2e){return db[_0x0b8a('0x2c')][_0x0b8a('0x47')](_0x12cf3f[_0x0b8a('0x48')],{})[_0x0b8a('0x24')](respondWithResult(_0x2cda2e,0xc9))[_0x0b8a('0x43')](handleError(_0x2cda2e,null));};exports[_0x0b8a('0x49')]=function(_0x3f9efa,_0x965d93){if(_0x3f9efa[_0x0b8a('0x48')]['id']){delete _0x3f9efa['body']['id'];}return db[_0x0b8a('0x2c')][_0x0b8a('0x46')]({'where':{'id':_0x3f9efa[_0x0b8a('0x44')]['id']}})['then'](handleEntityNotFound(_0x965d93,null))[_0x0b8a('0x24')](saveUpdates(_0x3f9efa[_0x0b8a('0x48')],null))[_0x0b8a('0x24')](respondWithResult(_0x965d93,null))['catch'](handleError(_0x965d93,null));};exports['destroy']=function(_0x1682bc,_0x598811){return db[_0x0b8a('0x2c')][_0x0b8a('0x46')]({'where':{'id':_0x1682bc[_0x0b8a('0x44')]['id']}})[_0x0b8a('0x24')](handleEntityNotFound(_0x598811,null))[_0x0b8a('0x24')](removeEntity(_0x598811,null))[_0x0b8a('0x43')](handleError(_0x598811,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 9954ccf..9e6fd3d 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 _0xd2bb=['util','api','moment','bluebird','request-promise','path','rimraf','./whatsappApplication.attributes','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci'];(function(_0x7d36a8,_0x2aefc6){var _0x4505ea=function(_0x2b4c19){while(--_0x2b4c19){_0x7d36a8['push'](_0x7d36a8['shift']());}};_0x4505ea(++_0x2aefc6);}(_0xd2bb,0x9a));var _0xbd2b=function(_0x4a4010,_0x19c888){_0x4a4010=_0x4a4010-0x0;var _0x127082=_0xd2bb[_0x4a4010];return _0x127082;};'use strict';var _=require('lodash');var util=require(_0xbd2b('0x0'));var logger=require('../../config/logger')(_0xbd2b('0x1'));var moment=require(_0xbd2b('0x2'));var BPromise=require(_0xbd2b('0x3'));var rp=require(_0xbd2b('0x4'));var fs=require('fs');var path=require(_0xbd2b('0x5'));var rimraf=require(_0xbd2b('0x6'));var config=require('../../config/environment');var attributes=require(_0xbd2b('0x7'));module[_0xbd2b('0x8')]=function(_0xdcd8bd,_0x2f64a8){return _0xdcd8bd[_0xbd2b('0x9')](_0xbd2b('0xa'),attributes,{'tableName':_0xbd2b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xbd2b('0xc'),'collate':_0xbd2b('0xd')});}; \ No newline at end of file +var _0x3c7b=['api','moment','../../config/environment','./whatsappApplication.attributes','define','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0x3c7b,0x11d));var _0xb3c7=function(_0x5d98b9,_0x5b4570){_0x5d98b9=_0x5d98b9-0x0;var _0x4d2111=_0x3c7b[_0x5d98b9];return _0x4d2111;};'use strict';var _=require(_0xb3c7('0x0'));var util=require(_0xb3c7('0x1'));var logger=require(_0xb3c7('0x2'))(_0xb3c7('0x3'));var moment=require(_0xb3c7('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb3c7('0x5'));var attributes=require(_0xb3c7('0x6'));module['exports']=function(_0x396a46,_0x5b810b){return _0x396a46[_0xb3c7('0x7')](_0xb3c7('0x8'),attributes,{'tableName':_0xb3c7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb3c7('0xa'),'collate':_0xb3c7('0xb')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 19e877f..59b9fcd 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 _0xa41a=['rpc','../../config/environment','client','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0xfad1ed,_0x4299b7){var _0x4f3325=function(_0x2449b5){while(--_0x2449b5){_0xfad1ed['push'](_0xfad1ed['shift']());}};_0x4f3325(++_0x4299b7);}(_0xa41a,0x6b));var _0xaa41=function(_0x49a2b5,_0x3cc18a){_0x49a2b5=_0x49a2b5-0x0;var _0x495a34=_0xa41a[_0x49a2b5];return _0x495a34;};'use strict';var _=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var moment=require('moment');var BPromise=require(_0xaa41('0x2'));var rs=require(_0xaa41('0x3'));var fs=require('fs');var Redis=require(_0xaa41('0x4'));var db=require(_0xaa41('0x5'))['db'];var utils=require(_0xaa41('0x6'));var logger=require(_0xaa41('0x7'))(_0xaa41('0x8'));var config=require(_0xaa41('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xaa41('0xa')][_0xaa41('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x54bc5a,_0x5b1fff,_0x179545){return new BPromise(function(_0x202cce,_0x588ab4){return client[_0xaa41('0xc')](_0x54bc5a,_0x179545)[_0xaa41('0xd')](function(_0x409dab){logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));logger[_0xaa41('0x11')](_0xaa41('0x12'),_0x5b1fff,_0xaa41('0x10'),JSON['stringify'](_0x409dab));if(_0x409dab[_0xaa41('0x13')]){if(_0x409dab[_0xaa41('0x13')]['code']===0x1f4){logger['error'](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x588ab4(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x202cce(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}else{logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));_0x202cce(_0x409dab[_0xaa41('0x15')]['message']);}})[_0xaa41('0x16')](function(_0x16b930){logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x16b930);_0x588ab4(_0x16b930);});});} \ No newline at end of file +var _0x24ca=['request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappApplication,\x20%s,\x20%s'];(function(_0x254a9f,_0x1cf3c7){var _0x2de3d=function(_0x1faac3){while(--_0x1faac3){_0x254a9f['push'](_0x254a9f['shift']());}};_0x2de3d(++_0x1cf3c7);}(_0x24ca,0x1bc));var _0xa24c=function(_0x4bb66f,_0x3cd682){_0x4bb66f=_0x4bb66f-0x0;var _0xf2772f=_0x24ca[_0x4bb66f];return _0xf2772f;};'use strict';var _=require(_0xa24c('0x0'));var util=require('util');var moment=require(_0xa24c('0x1'));var BPromise=require(_0xa24c('0x2'));var rs=require(_0xa24c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa24c('0x4'))['db'];var utils=require(_0xa24c('0x5'));var logger=require(_0xa24c('0x6'))(_0xa24c('0x7'));var config=require(_0xa24c('0x8'));var jayson=require(_0xa24c('0x9'));var client=jayson[_0xa24c('0xa')][_0xa24c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2dd348,_0x257264,_0x9a5013){return new BPromise(function(_0x481196,_0x42d89c){return client[_0xa24c('0xc')](_0x2dd348,_0x9a5013)[_0xa24c('0xd')](function(_0x5eac78){logger[_0xa24c('0xe')](_0xa24c('0xf'),_0x257264,_0xa24c('0x10'));logger[_0xa24c('0x11')](_0xa24c('0x12'),_0x257264,_0xa24c('0x10'),JSON[_0xa24c('0x13')](_0x5eac78));if(_0x5eac78[_0xa24c('0x14')]){if(_0x5eac78[_0xa24c('0x14')]['code']===0x1f4){logger[_0xa24c('0x14')](_0xa24c('0xf'),_0x257264,_0x5eac78[_0xa24c('0x14')][_0xa24c('0x15')]);return _0x42d89c(_0x5eac78['error'][_0xa24c('0x15')]);}logger[_0xa24c('0x14')](_0xa24c('0xf'),_0x257264,_0x5eac78[_0xa24c('0x14')][_0xa24c('0x15')]);return _0x481196(_0x5eac78[_0xa24c('0x14')][_0xa24c('0x15')]);}else{logger['info']('WhatsappApplication,\x20%s,\x20%s',_0x257264,_0xa24c('0x10'));_0x481196(_0x5eac78[_0xa24c('0x16')]['message']);}})['catch'](function(_0x221d21){logger[_0xa24c('0x14')]('WhatsappApplication,\x20%s,\x20%s',_0x257264,_0x221d21);_0x42d89c(_0x221d21);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 3d0e4ed..843332c 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 _0x2d72=['/:id/download','post','/:id/messages','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','delete','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','index','/describe','/:id','show','getMessages'];(function(_0x897324,_0x55d105){var _0x2be419=function(_0x29362e){while(--_0x29362e){_0x897324['push'](_0x897324['shift']());}};_0x2be419(++_0x55d105);}(_0x2d72,0xa8));var _0x22d7=function(_0x354206,_0x246bfa){_0x354206=_0x354206-0x0;var _0x1f5514=_0x2d72[_0x354206];return _0x1f5514;};'use strict';var multer=require(_0x22d7('0x0'));var util=require(_0x22d7('0x1'));var path=require(_0x22d7('0x2'));var timeout=require(_0x22d7('0x3'));var express=require(_0x22d7('0x4'));var router=express[_0x22d7('0x5')]();var fs_extra=require(_0x22d7('0x6'));var auth=require(_0x22d7('0x7'));var interaction=require(_0x22d7('0x8'));var config=require(_0x22d7('0x9'));var controller=require(_0x22d7('0xa'));router[_0x22d7('0xb')]('/',auth[_0x22d7('0xc')](),controller[_0x22d7('0xd')]);router['get'](_0x22d7('0xe'),auth[_0x22d7('0xc')](),controller['describe']);router[_0x22d7('0xb')](_0x22d7('0xf'),auth[_0x22d7('0xc')](),controller[_0x22d7('0x10')]);router['get']('/:id/messages',auth[_0x22d7('0xc')](),controller[_0x22d7('0x11')]);router[_0x22d7('0xb')](_0x22d7('0x12'),auth[_0x22d7('0xc')](),controller['download']);router['post']('/',auth[_0x22d7('0xc')](),controller['create']);router[_0x22d7('0x13')](_0x22d7('0x14'),auth['isAuthenticated'](),controller[_0x22d7('0x15')]);router[_0x22d7('0x13')](_0x22d7('0x16'),auth[_0x22d7('0xc')](),interaction[_0x22d7('0x17')](_0x22d7('0x18'),_0x22d7('0x19')),controller[_0x22d7('0x1a')]);router['put'](_0x22d7('0xf'),auth[_0x22d7('0xc')](),interaction[_0x22d7('0x17')]('whatsapp','whatsappinteraction:update'),controller['update']);router[_0x22d7('0x1b')](_0x22d7('0xf'),auth[_0x22d7('0xc')](),interaction[_0x22d7('0x17')](_0x22d7('0x18'),'whatsappinteraction:destroy'),controller[_0x22d7('0x1c')]);router[_0x22d7('0x1b')](_0x22d7('0x16'),auth['isAuthenticated'](),controller[_0x22d7('0x1d')]);module[_0x22d7('0x1e')]=router; \ No newline at end of file +var _0xdc97=['/:id/download','download','post','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','put','whatsappinteraction:update','update','delete','whatsappinteraction:destroy','destroy','removeTags','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','describe','/:id','show','/:id/messages','getMessages'];(function(_0x5b896c,_0x3d6695){var _0x591579=function(_0x3c0a61){while(--_0x3c0a61){_0x5b896c['push'](_0x5b896c['shift']());}};_0x591579(++_0x3d6695);}(_0xdc97,0x13b));var _0x7dc9=function(_0x5731fa,_0x16e57e){_0x5731fa=_0x5731fa-0x0;var _0x28f5eb=_0xdc97[_0x5731fa];return _0x28f5eb;};'use strict';var multer=require(_0x7dc9('0x0'));var util=require(_0x7dc9('0x1'));var path=require(_0x7dc9('0x2'));var timeout=require('connect-timeout');var express=require(_0x7dc9('0x3'));var router=express['Router']();var fs_extra=require(_0x7dc9('0x4'));var auth=require(_0x7dc9('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7dc9('0x6'));var controller=require(_0x7dc9('0x7'));router[_0x7dc9('0x8')]('/',auth[_0x7dc9('0x9')](),controller['index']);router[_0x7dc9('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x7dc9('0xa')]);router[_0x7dc9('0x8')](_0x7dc9('0xb'),auth[_0x7dc9('0x9')](),controller[_0x7dc9('0xc')]);router['get'](_0x7dc9('0xd'),auth[_0x7dc9('0x9')](),controller[_0x7dc9('0xe')]);router[_0x7dc9('0x8')](_0x7dc9('0xf'),auth[_0x7dc9('0x9')](),controller[_0x7dc9('0x10')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x7dc9('0xd'),auth[_0x7dc9('0x9')](),controller['addMessage']);router[_0x7dc9('0x11')](_0x7dc9('0x12'),auth[_0x7dc9('0x9')](),interaction[_0x7dc9('0x13')](_0x7dc9('0x14'),_0x7dc9('0x15')),controller['addTags']);router[_0x7dc9('0x16')](_0x7dc9('0xb'),auth[_0x7dc9('0x9')](),interaction[_0x7dc9('0x13')](_0x7dc9('0x14'),_0x7dc9('0x17')),controller[_0x7dc9('0x18')]);router[_0x7dc9('0x19')](_0x7dc9('0xb'),auth['isAuthenticated'](),interaction[_0x7dc9('0x13')]('whatsapp',_0x7dc9('0x1a')),controller[_0x7dc9('0x1b')]);router['delete'](_0x7dc9('0x12'),auth[_0x7dc9('0x9')](),controller[_0x7dc9('0x1c')]);module[_0x7dc9('0x1d')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index c5dbd7f..e0d7f0e 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 _0x11e5=['exports','BOOLEAN','STRING','out','DATE','ENUM','sequelize'];(function(_0x38aa12,_0x463127){var _0x249863=function(_0x3063d5){while(--_0x3063d5){_0x38aa12['push'](_0x38aa12['shift']());}};_0x249863(++_0x463127);}(_0x11e5,0x8b));var _0x511e=function(_0x56ce7d,_0x57d050){_0x56ce7d=_0x56ce7d-0x0;var _0x72a880=_0x11e5[_0x56ce7d];return _0x72a880;};'use strict';var Sequelize=require(_0x511e('0x0'));var moment=require('moment');module[_0x511e('0x1')]={'closed':{'type':Sequelize[_0x511e('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x511e('0x3')]},'secondDisposition':{'type':Sequelize[_0x511e('0x3')]},'thirdDisposition':{'type':Sequelize[_0x511e('0x3')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x511e('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x511e('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x511e('0x5')]},'lastMsgDirection':{'type':Sequelize[_0x511e('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x4672=['out','ENUM','sequelize','exports','BOOLEAN','STRING','DATE'];(function(_0x59b8f4,_0x252c02){var _0x32efd3=function(_0x53dba0){while(--_0x53dba0){_0x59b8f4['push'](_0x59b8f4['shift']());}};_0x32efd3(++_0x252c02);}(_0x4672,0x18a));var _0x2467=function(_0x549443,_0x2e04c8){_0x549443=_0x549443-0x0;var _0x372ed3=_0x4672[_0x549443];return _0x372ed3;};'use strict';var Sequelize=require(_0x2467('0x0'));var moment=require('moment');module[_0x2467('0x1')]={'closed':{'type':Sequelize[_0x2467('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x2467('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x2467('0x3')]},'note':{'type':Sequelize[_0x2467('0x3')]},'phone':{'type':Sequelize[_0x2467('0x3')]},'read1stAt':{'type':Sequelize[_0x2467('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x2467('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x2467('0x6')]('in',_0x2467('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x2467('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index ba0ff53..fc4d125 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 _0x1e24=['buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','WhatsappAccountId','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','isEmpty','t.id\x20IN\x20?','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','role','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','agent','sequelize','toString','keyBy','merge','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.*','c.firstName','Contact.firstName','c.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','push','all','rows','show','params','include','options','body','describe','addMessage','WhatsappMessage','ids','omit','getMessages','findOne','nolimit','includeAll','findAll','addTags','setTags','removeTags','download','join','server','files','tmp','root','attachments','format','transcript-%d-%s.zip','CmContact','Contact','firstName','lastName','Attachment','Messages','secret','Account','mkdirSync','Whatsapp','Owner','N.A.','closedAt','disposition','basename','existsSync','createReadStream','pipe','YYYY-MM-DD\x20HH:mm:ss','out','System','direction','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','err','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','save','update','then','destroy','error','name','send','Users','map','fullname','TagIds','Tags','split','forEach','catch','waiting','talking','answered','unmanaged','total','closed','UserId','WhatsappInteraction','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','select','field','color','from','u.id','u.fullname','ui.WhatsappInteractionId','user_has_whatsapp_interactions','left_join','users','whatsapp_interactions','cm_contacts','o.id\x20=\x20i.UserId','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','sqlOperator','conditions','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','operator','getFullTextValue','find','ContactId'];(function(_0x330919,_0x2e7cb7){var _0x5bef14=function(_0x4ba4c8){while(--_0x4ba4c8){_0x330919['push'](_0x330919['shift']());}};_0x5bef14(++_0x2e7cb7);}(_0x1e24,0x82));var _0x41e2=function(_0x11f226,_0x491e30){_0x11f226=_0x11f226-0x0;var _0x30be77=_0x1e24[_0x11f226];return _0x30be77;};'use strict';var emlformat=require(_0x41e2('0x0'));var rimraf=require(_0x41e2('0x1'));var zipdir=require(_0x41e2('0x2'));var jsonpatch=require(_0x41e2('0x3'));var rp=require('request-promise');var moment=require(_0x41e2('0x4'));var BPromise=require(_0x41e2('0x5'));var Mustache=require(_0x41e2('0x6'));var util=require(_0x41e2('0x7'));var path=require('path');var sox=require(_0x41e2('0x8'));var csv=require(_0x41e2('0x9'));var ejs=require(_0x41e2('0xa'));var fs=require('fs');var fs_extra=require(_0x41e2('0xb'));var _=require(_0x41e2('0xc'));var squel=require(_0x41e2('0xd'));var crypto=require(_0x41e2('0xe'));var jsforce=require(_0x41e2('0xf'));var deskjs=require(_0x41e2('0x10'));var toCsv=require('to-csv');var querystring=require(_0x41e2('0x11'));var Papa=require(_0x41e2('0x12'));var Redis=require(_0x41e2('0x13'));var authService=require(_0x41e2('0x14'));var qs=require(_0x41e2('0x15'));var as=require(_0x41e2('0x16'));var pdf=require(_0x41e2('0x17'));var hardwareService=require(_0x41e2('0x18'));var logger=require(_0x41e2('0x19'))('api');var utils=require(_0x41e2('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0x41e2('0x1b'));var db=require(_0x41e2('0x1c'))['db'];config[_0x41e2('0x1d')]=_['defaults'](config[_0x41e2('0x1d')],{'host':'localhost','port':0x18eb});var socket=require(_0x41e2('0x1e'))(new Redis(config['redis']));require(_0x41e2('0x1f'))[_0x41e2('0x20')](socket);function respondWithStatusCode(_0x44f807,_0x4b401e){_0x4b401e=_0x4b401e||0xcc;return function(_0x9aab16){if(_0x9aab16){return _0x44f807[_0x41e2('0x21')](_0x4b401e);}return _0x44f807[_0x41e2('0x22')](_0x4b401e)[_0x41e2('0x23')]();};}function respondWithResult(_0x491f50,_0x4041cd){_0x4041cd=_0x4041cd||0xc8;return function(_0x391c2a){if(_0x391c2a){return _0x491f50[_0x41e2('0x22')](_0x4041cd)[_0x41e2('0x24')](_0x391c2a);}};}function respondWithFilteredResult(_0x56b22d,_0x3dd4b7){return function(_0x463013){if(_0x463013){var _0x4505a6=typeof _0x3dd4b7[_0x41e2('0x25')]==='undefined'&&typeof _0x3dd4b7[_0x41e2('0x26')]===_0x41e2('0x27');var _0x3abe99=_0x463013[_0x41e2('0x28')];var _0x439d9c=_0x4505a6?0x0:_0x3dd4b7[_0x41e2('0x25')];var _0x3dc6be=_0x4505a6?_0x463013[_0x41e2('0x28')]:_0x3dd4b7[_0x41e2('0x25')]+_0x3dd4b7[_0x41e2('0x26')];var _0x2cb747;if(_0x3dc6be>=_0x3abe99){_0x3dc6be=_0x3abe99;_0x2cb747=0xc8;}else{_0x2cb747=0xce;}_0x56b22d[_0x41e2('0x22')](_0x2cb747);return _0x56b22d[_0x41e2('0x29')](_0x41e2('0x2a'),_0x439d9c+'-'+_0x3dc6be+'/'+_0x3abe99)[_0x41e2('0x24')](_0x463013);}return null;};}function patchUpdates(_0x46e9ae){return function(_0x2416fe){try{jsonpatch['apply'](_0x2416fe,_0x46e9ae,!![]);}catch(_0x892655){return BPromise['reject'](_0x892655);}return _0x2416fe[_0x41e2('0x2b')]();};}function saveUpdates(_0x24be7a,_0x198c9f){return function(_0x3dced4){if(_0x3dced4){return _0x3dced4[_0x41e2('0x2c')](_0x24be7a)[_0x41e2('0x2d')](function(_0x20a838){return _0x20a838;});}return null;};}function removeEntity(_0xb4aaad,_0x5ec732){return function(_0x4a10ad){if(_0x4a10ad){return _0x4a10ad[_0x41e2('0x2e')]()['then'](function(){_0xb4aaad['status'](0xcc)[_0x41e2('0x23')]();});}};}function handleEntityNotFound(_0x50c73d,_0x55aeba){return function(_0x18a14f){if(!_0x18a14f){_0x50c73d[_0x41e2('0x21')](0x194);}return _0x18a14f;};}function handleError(_0x43761d,_0x20df8a){_0x20df8a=_0x20df8a||0x1f4;return function(_0x314d8e){logger[_0x41e2('0x2f')](_0x314d8e['stack']);if(_0x314d8e[_0x41e2('0x30')]){delete _0x314d8e['name'];}_0x43761d[_0x41e2('0x22')](_0x20df8a)[_0x41e2('0x31')](_0x314d8e);};}function getInteractionUsers(_0x114ba1,_0x442062){return new BPromise(function(_0x3c4fe5,_0x575f92){try{if(_0x442062[_0x114ba1['id']]){_0x114ba1[_0x41e2('0x32')]=_[_0x41e2('0x33')](_0x442062[_0x114ba1['id']],function(_0x45ce6e){return{'id':_0x45ce6e['id'],'fullname':_0x45ce6e[_0x41e2('0x34')]};});}}catch(_0x271a24){_0x575f92(_0x271a24);}_0x3c4fe5(_0x114ba1);});}function getInteractionTags(_0x260589,_0x51a495){return new BPromise(function(_0x4c5dbb,_0x4330a1){try{if(_0x260589[_0x41e2('0x35')]){_0x260589[_0x41e2('0x36')]=[];_0x260589[_0x41e2('0x35')][_0x41e2('0x37')](',')[_0x41e2('0x38')](function(_0x9462f9){_0x260589[_0x41e2('0x36')]['push'](_0x51a495[_0x9462f9]);});}delete _0x260589[_0x41e2('0x35')];}catch(_0x2ed804){_0x4330a1(_0x2ed804);}_0x4c5dbb(_0x260589);});}function updateWhatsappInteraction(_0x4b130a,_0x39ec8c,_0x8deab1){return new BPromise(function(_0x4f8d36,_0x2ccc6b){return getInteractionUsers(_0x4b130a,_0x8deab1)[_0x41e2('0x2d')](function(_0xbb0b1d){return getInteractionTags(_0xbb0b1d,_0x39ec8c);})[_0x41e2('0x2d')](function(_0xb10977){return getStateInteraction(_0xb10977);})[_0x41e2('0x2d')](function(_0x2bbfcc){_0x4f8d36(_0x2bbfcc);})[_0x41e2('0x39')](function(_0x395cd7){_0x2ccc6b(_0x395cd7);});});}function getStateInteraction(_0x57963f){return new BPromise(function(_0x2a0fce){_0x57963f[_0x41e2('0x3a')]=0x0;_0x57963f[_0x41e2('0x3b')]=0x0;_0x57963f[_0x41e2('0x3c')]=0x0;_0x57963f[_0x41e2('0x3d')]=0x0;_0x57963f[_0x41e2('0x3e')]=0x0;if(!_0x57963f['closed']&&!_0x57963f['UserId']){_0x57963f[_0x41e2('0x3a')]+=0x1;}if(!_0x57963f[_0x41e2('0x3f')]&&_0x57963f[_0x41e2('0x40')]){_0x57963f[_0x41e2('0x3b')]+=0x1;if(_0x57963f[_0x41e2('0x3a')]){_0x57963f[_0x41e2('0x3a')]-=0x1;}}if(_0x57963f['closed']&&_0x57963f[_0x41e2('0x40')]){_0x57963f['answered']+=0x1;if(_0x57963f[_0x41e2('0x3b')]){_0x57963f[_0x41e2('0x3b')]-=0x1;}}if(_0x57963f[_0x41e2('0x3f')]&&!_0x57963f[_0x41e2('0x40')]){_0x57963f[_0x41e2('0x3d')]+=0x1;if(_0x57963f['waiting']){_0x57963f[_0x41e2('0x3a')]-=0x1;}}_0x57963f[_0x41e2('0x3e')]+=0x1;_0x2a0fce(_0x57963f);});}exports['index']=function(_0x1ee025,_0x190ac3){var _0x6c782e={},_0x19030b={},_0x2e848a={'count':0x0,'rows':[]};var _0x4a9058=_[_0x41e2('0x33')](db[_0x41e2('0x41')][_0x41e2('0x42')],function(_0x44fae1){return{'name':_0x44fae1[_0x41e2('0x43')],'type':_0x44fae1[_0x41e2('0x44')][_0x41e2('0x45')]};});_0x19030b[_0x41e2('0x46')]=_[_0x41e2('0x33')](_0x4a9058,_0x41e2('0x30'));_0x19030b['query']=_[_0x41e2('0x47')](_0x1ee025[_0x41e2('0x48')]);_0x19030b[_0x41e2('0x49')]=_[_0x41e2('0x4a')](_0x19030b[_0x41e2('0x46')],_0x19030b[_0x41e2('0x48')]);_0x6c782e[_0x41e2('0x4b')]=_[_0x41e2('0x4a')](_0x19030b['model'],qs['fields'](_0x1ee025[_0x41e2('0x48')][_0x41e2('0x4c')]));_0x6c782e[_0x41e2('0x4b')]=_0x6c782e[_0x41e2('0x4b')][_0x41e2('0x4d')]?_0x6c782e[_0x41e2('0x4b')]:_0x19030b[_0x41e2('0x46')];if(!_0x1ee025['query'][_0x41e2('0x4e')]('nolimit')){_0x6c782e['limit']=qs[_0x41e2('0x26')](_0x1ee025[_0x41e2('0x48')][_0x41e2('0x26')]);_0x6c782e['offset']=qs[_0x41e2('0x25')](_0x1ee025[_0x41e2('0x48')][_0x41e2('0x25')]);}_0x6c782e['order']=qs[_0x41e2('0x4f')](_0x1ee025[_0x41e2('0x48')][_0x41e2('0x4f')]);_0x6c782e[_0x41e2('0x50')]=qs[_0x41e2('0x49')](_[_0x41e2('0x51')](_0x1ee025[_0x41e2('0x48')],_0x19030b[_0x41e2('0x49')]),_0x4a9058);var _0x2b8bd0=[];var _0x40284f=squel[_0x41e2('0x52')]()[_0x41e2('0x53')]('id')[_0x41e2('0x53')](_0x41e2('0x30'))[_0x41e2('0x53')](_0x41e2('0x54'))[_0x41e2('0x55')]('tools_tags');var _0x11eb07=squel['select']()['field'](_0x41e2('0x56'))[_0x41e2('0x53')](_0x41e2('0x57'))['field'](_0x41e2('0x58'))['from'](_0x41e2('0x59'),'ui')[_0x41e2('0x5a')](_0x41e2('0x5b'),'u','u.id\x20=\x20ui.UserId');var _0x2a7943=squel[_0x41e2('0x52')]()[_0x41e2('0x55')](_0x41e2('0x5c'),'i')[_0x41e2('0x5a')](_0x41e2('0x5d'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x41e2('0x5a')](_0x41e2('0x5b'),'o',_0x41e2('0x5e'))[_0x41e2('0x5a')]('whatsapp_accounts','a',_0x41e2('0x5f'))[_0x41e2('0x5a')](_0x41e2('0x60'),'me',_0x41e2('0x61'))[_0x41e2('0x5a')](_0x41e2('0x62'),'it',_0x41e2('0x63'))['left_join']('tools_tags','t',_0x41e2('0x64'));var _0x45b8b3=squel[_0x41e2('0x65')]();var _0x1124b3=[];var _0x2e432d=squel[_0x41e2('0x65')]();var _0x25cf3b;if(_0x1ee025[_0x41e2('0x48')]['search']){_0x25cf3b=as[_0x41e2('0x66')](_0x1ee025['query']['search']);var _0x499b2f=_0x25cf3b[_0x41e2('0x67')];for(var _0x9d25bd=0x0;_0x9d25bd<_0x25cf3b[_0x41e2('0x68')]['length'];_0x9d25bd++){var _0x517e0a=_0x25cf3b[_0x41e2('0x68')][_0x9d25bd];var _0x9814cc='i';var _0xd560c0=_['find'](_0x4a9058,['name',_0x517e0a['field']]);if(!_0xd560c0){switch(_0x517e0a['field']){case _0x41e2('0x69'):if(_0x517e0a[_0x41e2('0x6a')]==0x1){_0x2a7943[_0x41e2('0x6b')]('`'+_0x517e0a['field']+_0x41e2('0x6c'));}else{_0x2a7943[_0x41e2('0x6b')]('`'+_0x517e0a[_0x41e2('0x53')]+_0x41e2('0x6d'));}break;case'Contact':if(_0x517e0a[_0x41e2('0x6e')]==='$substring'){if(_0x517e0a['value'][_0x41e2('0x37')]('\x20')[_0x41e2('0x4d')]>0x1){_0x45b8b3[_0x499b2f]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x41e2('0x6f')](_0x517e0a[_0x41e2('0x6a')]),null);}else{var _0x2ec3ba='%'+_0x517e0a['value']+'%';_0x45b8b3[_0x499b2f]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x2ec3ba,_0x2ec3ba,_0x2ec3ba);}}else{_0xd560c0=_[_0x41e2('0x70')](_0x4a9058,[_0x41e2('0x30'),_0x41e2('0x71')]);_0x517e0a[_0x41e2('0x53')]=_0x41e2('0x71');_0x3e622b=as[_0x41e2('0x72')](_0x9814cc,_0xd560c0[_0x41e2('0x44')],_0x517e0a);_0x45b8b3[_0x499b2f](_0x3e622b[_0x41e2('0x73')],_0x3e622b[_0x41e2('0x6a')][_0x41e2('0x74')],_0x3e622b['value'][_0x41e2('0x23')]);}break;case _0x41e2('0x75'):var _0xe3d74b=_0x517e0a['value'][_0x41e2('0x37')](',')[_0x41e2('0x33')](function(_0x449407){return Number(_0x449407);});_0xe3d74b[_0x41e2('0x38')](function(_0x5a42d3){_0x2e432d['or'](_0x41e2('0x76'),'%,'+_0x5a42d3+',%');});_0x1124b3=_[_0x41e2('0x77')](_0x1124b3,_0xe3d74b);break;case _0x41e2('0x78'):if(_0x517e0a[_0x41e2('0x6e')]===_0x41e2('0x79')){_0x45b8b3[_0x499b2f](_0x41e2('0x7a'),'%'+_0x517e0a[_0x41e2('0x6a')]+'%',null);}else{_0xd560c0=_[_0x41e2('0x70')](_0x4a9058,[_0x41e2('0x30'),_0x41e2('0x40')]);_0x517e0a[_0x41e2('0x53')]=_0x41e2('0x40');_0x3e622b=as[_0x41e2('0x72')](_0x9814cc,_0xd560c0['type'],_0x517e0a);_0x45b8b3[_0x499b2f](_0x3e622b[_0x41e2('0x73')],_0x3e622b[_0x41e2('0x6a')]['start'],_0x3e622b[_0x41e2('0x6a')][_0x41e2('0x23')]);}break;case'body':_0x3e622b=as[_0x41e2('0x72')]('me',null,_0x517e0a);_0x45b8b3[_0x499b2f](_0x3e622b[_0x41e2('0x73')],_0x3e622b[_0x41e2('0x6a')][_0x41e2('0x74')],_0x3e622b['value'][_0x41e2('0x23')]);break;}}else{var _0x3e622b=as[_0x41e2('0x72')](_0x9814cc,_0xd560c0[_0x41e2('0x44')],_0x517e0a);_0x45b8b3[_0x499b2f](_0x3e622b[_0x41e2('0x73')],_0x3e622b[_0x41e2('0x6a')][_0x41e2('0x74')],_0x3e622b[_0x41e2('0x6a')][_0x41e2('0x23')]);}}}else{var _0x225089=_(_0x1ee025[_0x41e2('0x48')])[_0x41e2('0x47')]()[_0x41e2('0x33')](function(_0x169aee){return _['some'](_0x4a9058,[_0x41e2('0x30'),_0x169aee])?_0x169aee:undefined;})['compact']()['value']();if(!_['isEmpty'](_0x225089)){_0x225089[_0x41e2('0x38')](function(_0x4185b8){if(_0x4185b8===_0x41e2('0x7b')){_0x2a7943['where']('i.WhatsappAccountId\x20IN\x20?',[]['concat'](_0x1ee025[_0x41e2('0x48')][_0x4185b8]));}else if(_0x4185b8===_0x41e2('0x7c')){var _0x2f4775=JSON[_0x41e2('0x7d')](_0x1ee025['query'][_0x4185b8])[_0x41e2('0x7e')];var _0xac7a44=JSON['parse'](_0x1ee025[_0x41e2('0x48')][_0x4185b8])['$lte'];_0x2a7943[_0x41e2('0x50')](_0x41e2('0x7f'),_0x2f4775,_0xac7a44);}else{if(_0x1ee025[_0x41e2('0x48')][_0x4185b8]===_0x41e2('0x80')){_0x2a7943['where']('i.'+_0x4185b8+_0x41e2('0x81'));}else{_0x2a7943[_0x41e2('0x50')]('i.'+_0x4185b8+'\x20=\x20?',_0x1ee025[_0x41e2('0x48')][_0x4185b8]);}}});}if(_0x1ee025[_0x41e2('0x48')][_0x41e2('0x82')]){if(_0x1ee025['query'][_0x41e2('0x82')]==0x1){_0x2a7943[_0x41e2('0x6b')]('`unreadMessages`\x20=\x200');}else{_0x2a7943[_0x41e2('0x6b')](_0x41e2('0x83'));}}if(_0x1ee025[_0x41e2('0x48')][_0x41e2('0x84')]){_0x1124b3=_[_0x41e2('0x85')](_0x1ee025[_0x41e2('0x48')]['tag'])?_0x1ee025[_0x41e2('0x48')][_0x41e2('0x84')]:new Array(_0x1ee025[_0x41e2('0x48')]['tag']);_0x1124b3[_0x41e2('0x38')](function(_0x253f8d){_0x2e432d['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x253f8d+',%');});}if(_0x1ee025[_0x41e2('0x48')][_0x41e2('0x86')]){var _0x39d3b9=_0x1ee025[_0x41e2('0x48')][_0x41e2('0x86')][_0x41e2('0x87')]('\x5c','\x5c\x5c')[_0x41e2('0x87')](/'/g,'\x27\x27');if(qs[_0x41e2('0x88')](_0x39d3b9)){_0x45b8b3['or'](_0x41e2('0x89'),_0x39d3b9+'%')['or'](_0x41e2('0x8a'),_0x39d3b9+'%');}else{_0x45b8b3['or'](_0x41e2('0x8b'),qs[_0x41e2('0x6f')](_0x39d3b9))['or'](_0x41e2('0x8c'),_0x39d3b9+'%');}}}_0x2a7943['where'](_0x45b8b3);_0x2a7943[_0x41e2('0x8d')](_0x41e2('0x8e'));var _0x46438c={'type':db[_0x41e2('0x8f')][_0x41e2('0x90')][_0x41e2('0x91')],'raw':!![]};var _0x702c06=_0x2a7943[_0x41e2('0x92')]();_0x702c06['field'](_0x41e2('0x8e'));_0x702c06['field'](_0x41e2('0x93'),_0x41e2('0x69'));if(_0x6c782e[_0x41e2('0x94')]){_0x6c782e['order'][_0x41e2('0x38')](function(_0xb344a2){var _0x262f32=_0xb344a2[0x0]==='contactName'?_0xb344a2[0x0]:'i.'+_0xb344a2[0x0];_0x2a7943['order'](_0x262f32,_0xb344a2[0x1]==='DESC'?![]:!![]);});}if(!_[_0x41e2('0x95')](_0x1124b3)){_0x2a7943[_0x41e2('0x6b')](_0x2e432d);_0x702c06[_0x41e2('0x50')](_0x41e2('0x96'),_0x1124b3);}BPromise[_0x41e2('0x97')]()[_0x41e2('0x2d')](function(){if(!_0x25cf3b){if(_0x1ee025[_0x41e2('0x48')][_0x41e2('0x7b')])return;_0x702c06[_0x41e2('0x50')](_0x41e2('0x98'));_0x2a7943[_0x41e2('0x50')]('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x1ee025[_0x41e2('0x99')][_0x41e2('0x9a')]!=='agent')return;return _0x1ee025[_0x41e2('0x99')][_0x41e2('0x9b')]({'attributes':['id'],'raw':!![]})['then'](function(_0x5ed2a0){if(_[_0x41e2('0x95')](_0x5ed2a0)){_0x702c06['where'](_0x41e2('0x9c'));_0x2a7943[_0x41e2('0x50')](_0x41e2('0x9c'));}else{_0x702c06['where']('i.WhatsappAccountId\x20IN\x20?',_[_0x41e2('0x33')](_0x5ed2a0,'id'));_0x2a7943[_0x41e2('0x50')]('i.WhatsappAccountId\x20IN\x20?',_[_0x41e2('0x33')](_0x5ed2a0,'id'));}});})[_0x41e2('0x2d')](function(){if(_0x1ee025[_0x41e2('0x99')][_0x41e2('0x9a')]===_0x41e2('0x9d')&&!_0x25cf3b&&!_0x1ee025[_0x41e2('0x48')]['WhatsappAccountId'])return[];return db['sequelize']['query'](_0x702c06['toString'](),_0x46438c);})[_0x41e2('0x2d')](function(_0x56f141){_0x2e848a[_0x41e2('0x28')]=_0x56f141['length'];if(_0x2e848a[_0x41e2('0x28')]===0x0)return[];return db[_0x41e2('0x9e')][_0x41e2('0x48')](_0x40284f[_0x41e2('0x9f')](),_0x46438c)['then'](function(_0x258908){_0x2b8bd0=_[_0x41e2('0xa0')](_0x258908,'id');_0x46438c=_[_0x41e2('0xa1')](_0x46438c,{'model':db['WhatsappInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1ee025[_0x41e2('0x48')]['fields']){_0x6c782e[_0x41e2('0x4b')][_0x41e2('0x38')](function(_0x4c5f3d){_0x2a7943[_0x41e2('0x53')]('i.'+_0x4c5f3d);});}else{_0x2a7943[_0x41e2('0x53')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x41e2('0x69'));_0x2a7943[_0x41e2('0x53')]('a.key',_0x41e2('0xa2'));_0x2a7943['field'](_0x41e2('0xa3'),_0x41e2('0xa4'));_0x2a7943[_0x41e2('0x53')](_0x41e2('0xa5'),_0x41e2('0xa6'));_0x2a7943[_0x41e2('0x53')](_0x41e2('0xa7'));_0x2a7943[_0x41e2('0x53')](_0x41e2('0xa8'),_0x41e2('0xa9'));_0x2a7943[_0x41e2('0x53')](_0x41e2('0xaa'),'Contact.lastName');_0x2a7943[_0x41e2('0x53')](_0x41e2('0xab'),_0x41e2('0xac'));_0x2a7943[_0x41e2('0x53')](_0x41e2('0xad'),_0x41e2('0xae'));_0x2a7943[_0x41e2('0x53')](_0x41e2('0xaf'),_0x41e2('0xb0'));_0x2a7943[_0x41e2('0x53')]('c.fax',_0x41e2('0xb1'));_0x2a7943['field'](_0x41e2('0xb2'),_0x41e2('0xb3'));_0x2a7943[_0x41e2('0x53')]('o.internal',_0x41e2('0xb4'));_0x2a7943[_0x41e2('0x53')](_0x41e2('0xb5'),_0x41e2('0x35'));}if(_0x6c782e[_0x41e2('0x26')])_0x2a7943[_0x41e2('0x26')](_0x6c782e[_0x41e2('0x26')]);if(_0x6c782e[_0x41e2('0x25')])_0x2a7943[_0x41e2('0x25')](_0x6c782e[_0x41e2('0x25')]);return db[_0x41e2('0x9e')][_0x41e2('0x48')](_0x2a7943[_0x41e2('0x9f')](),_0x46438c);})[_0x41e2('0x2d')](function(_0x47d120){if(_0x47d120[_0x41e2('0x4d')]>0x0)_0x11eb07[_0x41e2('0x50')](_0x41e2('0xb6'),_['map'](_0x47d120,'id'));return db[_0x41e2('0x9e')][_0x41e2('0x48')](_0x11eb07[_0x41e2('0x9f')](),_0x46438c)['then'](function(_0x115b06){var _0x2e1bc4=_[_0x41e2('0xb7')](_0x115b06,_0x41e2('0xb8'));var _0x587cdd=[];_0x47d120['forEach'](function(_0x3b65e4){_0x587cdd[_0x41e2('0xb9')](updateWhatsappInteraction(_0x3b65e4,_0x2b8bd0,_0x2e1bc4));});return BPromise[_0x41e2('0xba')](_0x587cdd);});});})['then'](function(_0x11a461){_0x2e848a[_0x41e2('0xbb')]=_0x11a461;return _0x2e848a;})['then'](respondWithFilteredResult(_0x190ac3,_0x6c782e))['catch'](handleError(_0x190ac3,null));};exports[_0x41e2('0xbc')]=function(_0x246bf8,_0x4ece18){var _0x468be5={'raw':![],'where':{'id':_0x246bf8[_0x41e2('0xbd')]['id']}},_0x53ec22={};_0x53ec22[_0x41e2('0x46')]=_[_0x41e2('0x47')](db[_0x41e2('0x41')]['rawAttributes']);_0x53ec22[_0x41e2('0x48')]=_[_0x41e2('0x47')](_0x246bf8[_0x41e2('0x48')]);_0x53ec22[_0x41e2('0x49')]=_[_0x41e2('0x4a')](_0x53ec22[_0x41e2('0x46')],_0x53ec22['query']);_0x468be5['attributes']=_[_0x41e2('0x4a')](_0x53ec22[_0x41e2('0x46')],qs[_0x41e2('0x4c')](_0x246bf8['query'][_0x41e2('0x4c')]));_0x468be5[_0x41e2('0x4b')]=_0x468be5['attributes']['length']?_0x468be5['attributes']:_0x53ec22[_0x41e2('0x46')];if(_0x246bf8[_0x41e2('0x48')]['includeAll']){_0x468be5[_0x41e2('0xbe')]=[{'all':!![]}];}_0x468be5=_['merge']({},_0x468be5,_0x246bf8[_0x41e2('0xbf')]);return db[_0x41e2('0x41')][_0x41e2('0x70')](_0x468be5)[_0x41e2('0x2d')](handleEntityNotFound(_0x4ece18,null))[_0x41e2('0x2d')](respondWithResult(_0x4ece18,null))[_0x41e2('0x39')](handleError(_0x4ece18,null));};exports['create']=function(_0x5bddcf,_0x4a4b29){return db[_0x41e2('0x41')]['create'](_0x5bddcf[_0x41e2('0xc0')],{})['then'](respondWithResult(_0x4a4b29,0xc9))[_0x41e2('0x39')](handleError(_0x4a4b29,null));};exports[_0x41e2('0x2c')]=function(_0x27114e,_0x982746){if(_0x27114e[_0x41e2('0xc0')]['id']){delete _0x27114e[_0x41e2('0xc0')]['id'];}return db['WhatsappInteraction'][_0x41e2('0x70')]({'where':{'id':_0x27114e[_0x41e2('0xbd')]['id']}})[_0x41e2('0x2d')](handleEntityNotFound(_0x982746,null))[_0x41e2('0x2d')](saveUpdates(_0x27114e['body'],null))['then'](respondWithResult(_0x982746,null))[_0x41e2('0x39')](handleError(_0x982746,null));};exports['destroy']=function(_0x448a91,_0x465417){return db[_0x41e2('0x41')][_0x41e2('0x70')]({'where':{'id':_0x448a91[_0x41e2('0xbd')]['id']}})[_0x41e2('0x2d')](handleEntityNotFound(_0x465417,null))[_0x41e2('0x2d')](removeEntity(_0x465417,null))['catch'](handleError(_0x465417,null));};exports['describe']=function(_0x381264,_0x31f3c4){return db['WhatsappInteraction'][_0x41e2('0xc1')]()[_0x41e2('0x2d')](respondWithResult(_0x31f3c4,null))['catch'](handleError(_0x31f3c4,null));};exports[_0x41e2('0xc2')]=function(_0x44d4db,_0x4e48b8,_0x51f15b){return db[_0x41e2('0xc3')][_0x41e2('0x70')]({'where':{'id':_0x44d4db[_0x41e2('0xbd')]['id']}})[_0x41e2('0x2d')](handleEntityNotFound(_0x4e48b8,null))[_0x41e2('0x2d')](function(_0x16d136){if(_0x16d136){return _0x16d136[_0x41e2('0xc2')](_0x44d4db[_0x41e2('0xc0')][_0x41e2('0xc4')],_[_0x41e2('0xc5')](_0x44d4db[_0x41e2('0xc0')],['ids','id'])||{});}})[_0x41e2('0x2d')](respondWithResult(_0x4e48b8,null))[_0x41e2('0x39')](handleError(_0x4e48b8,null));};exports[_0x41e2('0xc6')]=function(_0x404f0c,_0x5c8033,_0x2b7478){var _0x4efbb3={'raw':![],'where':{}};var _0x10254a={};var _0x105c85={'count':0x0,'rows':[]};return db[_0x41e2('0x41')][_0x41e2('0xc7')]({'where':{'id':_0x404f0c['params']['id']}})[_0x41e2('0x2d')](handleEntityNotFound(_0x5c8033,null))['then'](function(_0x5bb8eb){if(_0x5bb8eb){_0x10254a['model']=_[_0x41e2('0x47')](db[_0x41e2('0xc3')][_0x41e2('0x42')]);_0x10254a['query']=_[_0x41e2('0x47')](_0x404f0c[_0x41e2('0x48')]);_0x10254a[_0x41e2('0x49')]=_[_0x41e2('0x4a')](_0x10254a[_0x41e2('0x46')],_0x10254a[_0x41e2('0x48')]);_0x4efbb3[_0x41e2('0x4b')]=_[_0x41e2('0x4a')](_0x10254a['model'],qs[_0x41e2('0x4c')](_0x404f0c['query'][_0x41e2('0x4c')]));_0x4efbb3[_0x41e2('0x4b')]=_0x4efbb3[_0x41e2('0x4b')][_0x41e2('0x4d')]?_0x4efbb3['attributes']:_0x10254a['model'];if(!_0x404f0c[_0x41e2('0x48')]['hasOwnProperty'](_0x41e2('0xc8'))){_0x4efbb3[_0x41e2('0x26')]=qs[_0x41e2('0x26')](_0x404f0c[_0x41e2('0x48')]['limit']);_0x4efbb3[_0x41e2('0x25')]=qs['offset'](_0x404f0c[_0x41e2('0x48')][_0x41e2('0x25')]);}_0x4efbb3[_0x41e2('0x94')]=qs[_0x41e2('0x4f')](_0x404f0c[_0x41e2('0x48')][_0x41e2('0x4f')]);_0x4efbb3[_0x41e2('0x50')]=qs[_0x41e2('0x49')](_[_0x41e2('0x51')](_0x404f0c[_0x41e2('0x48')],_0x10254a[_0x41e2('0x49')]));_0x4efbb3[_0x41e2('0x50')][_0x41e2('0xb8')]=_0x5bb8eb['id'];if(_0x404f0c[_0x41e2('0x48')][_0x41e2('0x86')]){_0x4efbb3[_0x41e2('0x50')]=_[_0x41e2('0xa1')](_0x4efbb3[_0x41e2('0x50')],{'$or':_[_0x41e2('0x33')](_0x4efbb3[_0x41e2('0x4b')],function(_0x498537){var _0x2cf997={};_0x2cf997[_0x498537]={'$like':'%'+_0x404f0c[_0x41e2('0x48')]['filter']+'%'};return _0x2cf997;})});}if(_0x404f0c[_0x41e2('0x48')][_0x41e2('0x7e')]){var _0x36f1ab=_0x404f0c[_0x41e2('0x48')][_0x41e2('0x7e')][_0x41e2('0x37')](',');var _0x2c44ac={};_0x2c44ac[_0x36f1ab[0x0]]={'$gte':moment(_0x36f1ab[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x4efbb3[_0x41e2('0x50')]=_[_0x41e2('0xa1')](_0x4efbb3[_0x41e2('0x50')],_0x2c44ac);}_0x4efbb3=_[_0x41e2('0xa1')]({},_0x4efbb3,_0x404f0c[_0x41e2('0xbf')]);return db[_0x41e2('0xc3')][_0x41e2('0x28')]({'where':_0x4efbb3['where']})['then'](function(_0x49e038){_0x105c85['count']=_0x49e038;if(_0x404f0c[_0x41e2('0x48')][_0x41e2('0xc9')]){_0x4efbb3[_0x41e2('0xbe')]=[{'all':!![]}];}return db[_0x41e2('0xc3')][_0x41e2('0xca')](_0x4efbb3);})['then'](function(_0x1046d6){_0x105c85[_0x41e2('0xbb')]=_0x1046d6;return _0x105c85;});}})[_0x41e2('0x2d')](respondWithFilteredResult(_0x5c8033,_0x4efbb3))[_0x41e2('0x39')](handleError(_0x5c8033,null));};exports[_0x41e2('0xcb')]=function(_0x3dcde8,_0x3249a0,_0x516f14){return db['WhatsappInteraction'][_0x41e2('0x70')]({'where':{'id':_0x3dcde8[_0x41e2('0xbd')]['id']}})[_0x41e2('0x2d')](handleEntityNotFound(_0x3249a0,null))[_0x41e2('0x2d')](function(_0x153270){if(_0x153270){return _0x153270[_0x41e2('0xcc')](_0x3dcde8[_0x41e2('0xc0')][_0x41e2('0xc4')],_[_0x41e2('0xc5')](_0x3dcde8[_0x41e2('0xc0')],[_0x41e2('0xc4'),'id'])||{})['spread'](function(){return db[_0x41e2('0x75')][_0x41e2('0xca')]({'attributes':['id',_0x41e2('0x30'),_0x41e2('0x54')],'where':{'id':_0x3dcde8[_0x41e2('0xc0')][_0x41e2('0xc4')]}});})[_0x41e2('0x2d')](function(_0x19bdd3){socket['emit']('whatsappInteractionTags:save',{'id':Number(_0x3dcde8['params']['id']),'tags':_0x19bdd3||[]});return{'id':Number(_0x3dcde8['params']['id']),'tags':_0x19bdd3||[]};});}})[_0x41e2('0x2d')](respondWithResult(_0x3249a0,null))[_0x41e2('0x39')](handleError(_0x3249a0,null));};exports[_0x41e2('0xcd')]=function(_0xc8f748,_0x58e4e9,_0x2c363c){return db[_0x41e2('0x41')][_0x41e2('0x70')]({'where':{'id':_0xc8f748[_0x41e2('0xbd')]['id']}})['then'](handleEntityNotFound(_0x58e4e9,null))['then'](function(_0x2d05c9){if(_0x2d05c9){return _0x2d05c9[_0x41e2('0xcd')](_0xc8f748['query'][_0x41e2('0xc4')]);}})['then'](respondWithStatusCode(_0x58e4e9,null))[_0x41e2('0x39')](handleError(_0x58e4e9,null));};exports[_0x41e2('0xce')]=function(_0x15a60d,_0x3e5fe6){var _0x33c90d=moment()['unix']()['toString']();var _0x403468=path[_0x41e2('0xcf')](config['root'],_0x41e2('0xd0'),_0x41e2('0xd1'),_0x41e2('0xd2'));var _0x173e39=path['join'](config[_0x41e2('0xd3')],_0x41e2('0xd0'),_0x41e2('0xd1'),_0x41e2('0xd4'));var _0x4c10f3=path[_0x41e2('0xcf')](_0x403468,_0x33c90d);var _0x2d14ef=util[_0x41e2('0xd5')](_0x41e2('0xd6'),_0x15a60d[_0x41e2('0xbd')]['id'],_0x33c90d);var _0xf86394=path[_0x41e2('0xcf')](_0x403468,_0x2d14ef);var _0x25bc2b=[];_0x25bc2b['push']({'model':db[_0x41e2('0x78')],'as':_0x41e2('0x78'),'attributes':['id',_0x41e2('0x34')],'raw':!![]});_0x25bc2b[_0x41e2('0xb9')]({'model':db[_0x41e2('0xd7')],'as':_0x41e2('0xd8'),'attributes':['id',_0x41e2('0xd9'),_0x41e2('0xda')],'raw':!![]});if(_0x15a60d[_0x41e2('0x48')][_0x41e2('0xd4')]){_0x25bc2b['push']({'model':db[_0x41e2('0xdb')],'as':_0x41e2('0xdb'),'raw':!![]});}var _0x45dea9=[{'model':db['WhatsappMessage'],'as':_0x41e2('0xdc'),'attributes':['id','body',_0x41e2('0x7c'),'direction',_0x41e2('0xdd'),_0x41e2('0x82')],'include':_0x25bc2b}];_0x45dea9[_0x41e2('0xb9')]({'model':db['WhatsappAccount'],'as':_0x41e2('0xde'),'attributes':['id',_0x41e2('0x30')]});_0x45dea9['push']({'model':db[_0x41e2('0x78')],'as':'Owner','attributes':['id',_0x41e2('0x34')]});return db['WhatsappInteraction'][_0x41e2('0x70')]({'where':{'id':_0x15a60d['params']['id']},'include':_0x45dea9})[_0x41e2('0x2d')](handleEntityNotFound(_0x3e5fe6,null))['then'](function(_0xd08b22){if(_0xd08b22){var _0x2a97aa=_0xd08b22['get']({'plain':!![]});fs[_0x41e2('0xdf')](_0x4c10f3);var _0x287ad7={'channel':_0x41e2('0xe0'),'account':_0x2a97aa['Account']['name'],'agent':_0x2a97aa[_0x41e2('0xe1')]?_0x2a97aa['Owner'][_0x41e2('0x34')]:_0x41e2('0xe2'),'createdAt':moment(_0x2a97aa[_0x41e2('0x7c')])[_0x41e2('0xd5')]('YYYY-MM-DD\x20HH:mm:ss')[_0x41e2('0x9f')](),'closedAt':_0x2a97aa['closed']?moment(_0x2a97aa[_0x41e2('0xe3')])[_0x41e2('0xd5')]('YYYY-MM-DD\x20HH:mm:ss')[_0x41e2('0x9f')]():'','disposition':_0x2a97aa[_0x41e2('0xe4')],'messages':_(_0x2a97aa['Messages'])[_0x41e2('0x86')]({'secret':![]})[_0x41e2('0x33')](function(_0x4c7e16){if(_0x4c7e16[_0x41e2('0xdb')]){var _0x4443c9=path[_0x41e2('0xcf')](_0x173e39,_0x4c7e16[_0x41e2('0xdb')][_0x41e2('0xe5')]);if(fs[_0x41e2('0xe6')](_0x4443c9)){fs[_0x41e2('0xe7')](_0x4443c9)[_0x41e2('0xe8')](fs['createWriteStream'](path[_0x41e2('0xcf')](_0x4c10f3,_0x4c7e16[_0x41e2('0xdb')]['basename'])));}}return{'date':moment(_0x4c7e16[_0x41e2('0x7c')])[_0x41e2('0xd5')](_0x41e2('0xe9'))[_0x41e2('0x9f')](),'sender':_0x4c7e16['direction']===_0x41e2('0xea')?_0x4c7e16[_0x41e2('0x78')]?_0x4c7e16[_0x41e2('0x78')][_0x41e2('0x34')]:_0x41e2('0xeb'):_0x4c7e16[_0x41e2('0xd8')][_0x41e2('0xd9')]+(_0x4c7e16[_0x41e2('0xd8')][_0x41e2('0xda')]?'\x20'+_0x4c7e16[_0x41e2('0xd8')]['lastName']:''),'body':_0x4c7e16[_0x41e2('0xdb')]?_0x4c7e16[_0x41e2('0xdb')][_0x41e2('0xe5')]:_0x4c7e16[_0x41e2('0xc0')],'direction':_0x4c7e16[_0x41e2('0xec')]===_0x41e2('0xea')?'A':'C','secret':_0x4c7e16['secret'],'read':_0x4c7e16[_0x41e2('0x82')],'attachment':_0x4c7e16['Attachment']};})[_0x41e2('0x6a')]()};return ejs[_0x41e2('0xed')](path['join'](config[_0x41e2('0xd3')],_0x41e2('0xd0'),_0x41e2('0xee'),_0x41e2('0xef')),{'interaction':_0x287ad7})[_0x41e2('0x2d')](function(_0x59d479){var _0x7fedfb=path[_0x41e2('0xcf')](_0x4c10f3,_0x41e2('0xf0')+_0x2a97aa['id']+'-'+_0x33c90d+_0x41e2('0xf1'));var _0x177c69={'path':_0x7fedfb,'channel':_0x41e2('0xe0'),'interactionId':_0x2a97aa['id']};return pdf[_0x41e2('0xf2')](_0x59d479,_0x177c69);})[_0x41e2('0x2d')](function(){return new BPromise(function(_0x21b441,_0x3d5767){zipdir(_0x4c10f3,{'saveTo':_0xf86394},function(_0x375ba4,_0x328763){if(_0x375ba4)return _0x3d5767(_0x375ba4);return _0x21b441(_0x328763);});})[_0x41e2('0x2d')](function(){return new BPromise(function(_0x292f9c,_0x55c4e9){rimraf(_0x4c10f3,function(_0x12ab6c){if(_0x12ab6c)_0x55c4e9(_0x12ab6c);return _0x292f9c();});});})[_0x41e2('0x2d')](function(){return _0x3e5fe6[_0x41e2('0xce')](_0xf86394,_0x2d14ef,function(_0xb4a575){if(_0xb4a575){console['log'](_0x41e2('0xf3'),_0xb4a575);}else{fs['unlinkSync'](_0xf86394);}});});});}else{return _0x3e5fe6[_0x41e2('0x21')](0xc8);}})[_0x41e2('0x39')](handleError(_0x3e5fe6,null));}; \ No newline at end of file +var _0x2ef3=['Tags','split','forEach','push','waiting','unmanaged','total','closed','UserId','talking','answered','index','WhatsappInteraction','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','limit','order','sort','pick','select','field','color','from','u.id','u.fullname','ui.WhatsappInteractionId','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','o.id\x20=\x20i.UserId','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','tools_tags','t.id\x20=\x20it.TagId','expr','parseSearch','search','conditions','find','unreadMessages','`\x20=\x200','having','`\x20>\x200','Contact','operator','$substring','value','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','buildExpression','body','compact','WhatsappAccountId','where','i.WhatsappAccountId\x20IN\x20?','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','isNumeric','i.phone\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','isEmpty','t.id\x20IN\x20?','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getWhatsappAccounts','toString','keyBy','merge','a.key','Account.key','Account.mandatoryDisposition','i.*','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','c.mobile','Contact.mobile','Owner.fullname','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','sequelize','groupBy','all','catch','show','params','options','create','describe','WhatsappMessage','addMessage','ids','omit','getMessages','nolimit','WhatsappInteractionId','format','YYYY-MM-DD\x20HH:mm:ss','include','rows','setTags','spread','emit','whatsappInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','User','fullname','firstName','lastName','Attachment','Messages','WhatsappAccount','Account','Owner','mkdirSync','Whatsapp','N.A.','disposition','basename','pipe','direction','out','renderFile','views','downloadInteraction.ejs','transcript-','createPdfFromHTML','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','register','offset','undefined','count','status','Content-Range','json','reject','save','destroy','then','end','sendStatus','stack','name','Users','map','TagIds'];(function(_0x42f009,_0x5e27b1){var _0x22a1e0=function(_0x297993){while(--_0x297993){_0x42f009['push'](_0x42f009['shift']());}};_0x22a1e0(++_0x5e27b1);}(_0x2ef3,0xba));var _0x32ef=function(_0x4ce9cf,_0x2967b4){_0x4ce9cf=_0x4ce9cf-0x0;var _0x350e49=_0x2ef3[_0x4ce9cf];return _0x350e49;};'use strict';var emlformat=require(_0x32ef('0x0'));var rimraf=require(_0x32ef('0x1'));var zipdir=require(_0x32ef('0x2'));var jsonpatch=require(_0x32ef('0x3'));var rp=require(_0x32ef('0x4'));var moment=require(_0x32ef('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x32ef('0x6'));var util=require(_0x32ef('0x7'));var path=require('path');var sox=require(_0x32ef('0x8'));var csv=require(_0x32ef('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x32ef('0xa'));var squel=require(_0x32ef('0xb'));var crypto=require(_0x32ef('0xc'));var jsforce=require(_0x32ef('0xd'));var deskjs=require(_0x32ef('0xe'));var toCsv=require(_0x32ef('0x9'));var querystring=require(_0x32ef('0xf'));var Papa=require(_0x32ef('0x10'));var Redis=require(_0x32ef('0x11'));var authService=require(_0x32ef('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var pdf=require(_0x32ef('0x13'));var hardwareService=require(_0x32ef('0x14'));var logger=require(_0x32ef('0x15'))(_0x32ef('0x16'));var utils=require('../../config/utils');var config=require(_0x32ef('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x32ef('0x18'))['db'];config['redis']=_[_0x32ef('0x19')](config[_0x32ef('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x32ef('0x1a')]));require('./whatsappInteraction.socket')[_0x32ef('0x1b')](socket);function respondWithStatusCode(_0x40a6e6,_0x93d492){_0x93d492=_0x93d492||0xcc;return function(_0x54c7f5){if(_0x54c7f5){return _0x40a6e6['sendStatus'](_0x93d492);}return _0x40a6e6['status'](_0x93d492)['end']();};}function respondWithResult(_0x13db1a,_0x3950e6){_0x3950e6=_0x3950e6||0xc8;return function(_0xb5aed2){if(_0xb5aed2){return _0x13db1a['status'](_0x3950e6)['json'](_0xb5aed2);}};}function respondWithFilteredResult(_0x1eb468,_0x1a9476){return function(_0x286bfb){if(_0x286bfb){var _0x57863c=typeof _0x1a9476[_0x32ef('0x1c')]===_0x32ef('0x1d')&&typeof _0x1a9476['limit']===_0x32ef('0x1d');var _0x314ef1=_0x286bfb[_0x32ef('0x1e')];var _0x251084=_0x57863c?0x0:_0x1a9476[_0x32ef('0x1c')];var _0x3aec05=_0x57863c?_0x286bfb['count']:_0x1a9476[_0x32ef('0x1c')]+_0x1a9476['limit'];var _0x309866;if(_0x3aec05>=_0x314ef1){_0x3aec05=_0x314ef1;_0x309866=0xc8;}else{_0x309866=0xce;}_0x1eb468[_0x32ef('0x1f')](_0x309866);return _0x1eb468['set'](_0x32ef('0x20'),_0x251084+'-'+_0x3aec05+'/'+_0x314ef1)[_0x32ef('0x21')](_0x286bfb);}return null;};}function patchUpdates(_0x5e8898){return function(_0x55f7f2){try{jsonpatch['apply'](_0x55f7f2,_0x5e8898,!![]);}catch(_0x22f2d7){return BPromise[_0x32ef('0x22')](_0x22f2d7);}return _0x55f7f2[_0x32ef('0x23')]();};}function saveUpdates(_0x478bef,_0x59585f){return function(_0x19ea6){if(_0x19ea6){return _0x19ea6['update'](_0x478bef)['then'](function(_0x278495){return _0x278495;});}return null;};}function removeEntity(_0x14d4b3,_0x371540){return function(_0x1dbe98){if(_0x1dbe98){return _0x1dbe98[_0x32ef('0x24')]()[_0x32ef('0x25')](function(){_0x14d4b3[_0x32ef('0x1f')](0xcc)[_0x32ef('0x26')]();});}};}function handleEntityNotFound(_0x338f19,_0x2f52d7){return function(_0x1335e2){if(!_0x1335e2){_0x338f19[_0x32ef('0x27')](0x194);}return _0x1335e2;};}function handleError(_0x5a88a5,_0xd65fde){_0xd65fde=_0xd65fde||0x1f4;return function(_0x2f5d06){logger['error'](_0x2f5d06[_0x32ef('0x28')]);if(_0x2f5d06[_0x32ef('0x29')]){delete _0x2f5d06[_0x32ef('0x29')];}_0x5a88a5[_0x32ef('0x1f')](_0xd65fde)['send'](_0x2f5d06);};}function getInteractionUsers(_0x10e38c,_0x22bf86){return new BPromise(function(_0x31dbc3,_0x2ac686){try{if(_0x22bf86[_0x10e38c['id']]){_0x10e38c[_0x32ef('0x2a')]=_[_0x32ef('0x2b')](_0x22bf86[_0x10e38c['id']],function(_0x1a122d){return{'id':_0x1a122d['id'],'fullname':_0x1a122d['fullname']};});}}catch(_0x36ac37){_0x2ac686(_0x36ac37);}_0x31dbc3(_0x10e38c);});}function getInteractionTags(_0x537214,_0x38bf73){return new BPromise(function(_0x2b6c6a,_0x5a9565){try{if(_0x537214[_0x32ef('0x2c')]){_0x537214[_0x32ef('0x2d')]=[];_0x537214[_0x32ef('0x2c')][_0x32ef('0x2e')](',')[_0x32ef('0x2f')](function(_0x59a4a3){_0x537214['Tags'][_0x32ef('0x30')](_0x38bf73[_0x59a4a3]);});}delete _0x537214['TagIds'];}catch(_0x643dc4){_0x5a9565(_0x643dc4);}_0x2b6c6a(_0x537214);});}function updateWhatsappInteraction(_0x15b873,_0x2f1349,_0x390670){return new BPromise(function(_0x389583,_0x22fa1a){return getInteractionUsers(_0x15b873,_0x390670)['then'](function(_0x482d3a){return getInteractionTags(_0x482d3a,_0x2f1349);})['then'](function(_0x2261a6){return getStateInteraction(_0x2261a6);})[_0x32ef('0x25')](function(_0x136b02){_0x389583(_0x136b02);})['catch'](function(_0x4fb402){_0x22fa1a(_0x4fb402);});});}function getStateInteraction(_0x1c3633){return new BPromise(function(_0x2bd8a9){_0x1c3633[_0x32ef('0x31')]=0x0;_0x1c3633['talking']=0x0;_0x1c3633['answered']=0x0;_0x1c3633[_0x32ef('0x32')]=0x0;_0x1c3633[_0x32ef('0x33')]=0x0;if(!_0x1c3633[_0x32ef('0x34')]&&!_0x1c3633[_0x32ef('0x35')]){_0x1c3633[_0x32ef('0x31')]+=0x1;}if(!_0x1c3633[_0x32ef('0x34')]&&_0x1c3633[_0x32ef('0x35')]){_0x1c3633[_0x32ef('0x36')]+=0x1;if(_0x1c3633[_0x32ef('0x31')]){_0x1c3633['waiting']-=0x1;}}if(_0x1c3633[_0x32ef('0x34')]&&_0x1c3633[_0x32ef('0x35')]){_0x1c3633[_0x32ef('0x37')]+=0x1;if(_0x1c3633['talking']){_0x1c3633[_0x32ef('0x36')]-=0x1;}}if(_0x1c3633[_0x32ef('0x34')]&&!_0x1c3633[_0x32ef('0x35')]){_0x1c3633[_0x32ef('0x32')]+=0x1;if(_0x1c3633[_0x32ef('0x31')]){_0x1c3633[_0x32ef('0x31')]-=0x1;}}_0x1c3633[_0x32ef('0x33')]+=0x1;_0x2bd8a9(_0x1c3633);});}exports[_0x32ef('0x38')]=function(_0x2ed5cb,_0x57a3c0){var _0xb4db74={},_0x4615b4={},_0x48e071={'count':0x0,'rows':[]};var _0x3cac2e=_[_0x32ef('0x2b')](db[_0x32ef('0x39')][_0x32ef('0x3a')],function(_0x2f92f5){return{'name':_0x2f92f5[_0x32ef('0x3b')],'type':_0x2f92f5[_0x32ef('0x3c')]['key']};});_0x4615b4['model']=_[_0x32ef('0x2b')](_0x3cac2e,_0x32ef('0x29'));_0x4615b4[_0x32ef('0x3d')]=_[_0x32ef('0x3e')](_0x2ed5cb['query']);_0x4615b4[_0x32ef('0x3f')]=_[_0x32ef('0x40')](_0x4615b4['model'],_0x4615b4[_0x32ef('0x3d')]);_0xb4db74['attributes']=_[_0x32ef('0x40')](_0x4615b4[_0x32ef('0x41')],qs[_0x32ef('0x42')](_0x2ed5cb[_0x32ef('0x3d')][_0x32ef('0x42')]));_0xb4db74[_0x32ef('0x43')]=_0xb4db74[_0x32ef('0x43')][_0x32ef('0x44')]?_0xb4db74[_0x32ef('0x43')]:_0x4615b4[_0x32ef('0x41')];if(!_0x2ed5cb['query'][_0x32ef('0x45')]('nolimit')){_0xb4db74[_0x32ef('0x46')]=qs[_0x32ef('0x46')](_0x2ed5cb[_0x32ef('0x3d')]['limit']);_0xb4db74[_0x32ef('0x1c')]=qs[_0x32ef('0x1c')](_0x2ed5cb[_0x32ef('0x3d')][_0x32ef('0x1c')]);}_0xb4db74[_0x32ef('0x47')]=qs[_0x32ef('0x48')](_0x2ed5cb[_0x32ef('0x3d')]['sort']);_0xb4db74['where']=qs[_0x32ef('0x3f')](_[_0x32ef('0x49')](_0x2ed5cb[_0x32ef('0x3d')],_0x4615b4[_0x32ef('0x3f')]),_0x3cac2e);var _0x209361=[];var _0xd67dc9=squel[_0x32ef('0x4a')]()[_0x32ef('0x4b')]('id')[_0x32ef('0x4b')](_0x32ef('0x29'))[_0x32ef('0x4b')](_0x32ef('0x4c'))[_0x32ef('0x4d')]('tools_tags');var _0x420f00=squel[_0x32ef('0x4a')]()[_0x32ef('0x4b')](_0x32ef('0x4e'))[_0x32ef('0x4b')](_0x32ef('0x4f'))[_0x32ef('0x4b')](_0x32ef('0x50'))[_0x32ef('0x4d')](_0x32ef('0x51'),'ui')[_0x32ef('0x52')](_0x32ef('0x53'),'u',_0x32ef('0x54'));var _0x326445=squel[_0x32ef('0x4a')]()[_0x32ef('0x4d')](_0x32ef('0x55'),'i')[_0x32ef('0x52')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x32ef('0x52')](_0x32ef('0x53'),'o',_0x32ef('0x56'))[_0x32ef('0x52')](_0x32ef('0x57'),'a',_0x32ef('0x58'))[_0x32ef('0x52')](_0x32ef('0x59'),'me',_0x32ef('0x5a'))[_0x32ef('0x52')](_0x32ef('0x5b'),'it','it.WhatsappInteractionId\x20=\x20i.id')[_0x32ef('0x52')](_0x32ef('0x5c'),'t',_0x32ef('0x5d'));var _0x3fe01f=squel[_0x32ef('0x5e')]();var _0x387cf0=[];var _0x52c588=squel[_0x32ef('0x5e')]();var _0x1eeb3e;if(_0x2ed5cb[_0x32ef('0x3d')]['search']){_0x1eeb3e=as[_0x32ef('0x5f')](_0x2ed5cb['query'][_0x32ef('0x60')]);var _0xbe35b=_0x1eeb3e['sqlOperator'];for(var _0x206ad5=0x0;_0x206ad5<_0x1eeb3e['conditions'][_0x32ef('0x44')];_0x206ad5++){var _0x1d974c=_0x1eeb3e[_0x32ef('0x61')][_0x206ad5];var _0x3a3513='i';var _0x2c7bee=_[_0x32ef('0x62')](_0x3cac2e,[_0x32ef('0x29'),_0x1d974c['field']]);if(!_0x2c7bee){switch(_0x1d974c['field']){case _0x32ef('0x63'):if(_0x1d974c['value']==0x1){_0x326445['having']('`'+_0x1d974c[_0x32ef('0x4b')]+_0x32ef('0x64'));}else{_0x326445[_0x32ef('0x65')]('`'+_0x1d974c[_0x32ef('0x4b')]+_0x32ef('0x66'));}break;case _0x32ef('0x67'):if(_0x1d974c[_0x32ef('0x68')]===_0x32ef('0x69')){if(_0x1d974c[_0x32ef('0x6a')][_0x32ef('0x2e')]('\x20')['length']>0x1){_0x3fe01f[_0xbe35b]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x32ef('0x6b')](_0x1d974c[_0x32ef('0x6a')]),null);}else{var _0x5549b4='%'+_0x1d974c[_0x32ef('0x6a')]+'%';_0x3fe01f[_0xbe35b](_0x32ef('0x6c'),_0x5549b4,_0x5549b4,_0x5549b4);}}else{_0x2c7bee=_[_0x32ef('0x62')](_0x3cac2e,['name',_0x32ef('0x6d')]);_0x1d974c[_0x32ef('0x4b')]=_0x32ef('0x6d');_0x5ad75c=as['buildExpression'](_0x3a3513,_0x2c7bee['type'],_0x1d974c);_0x3fe01f[_0xbe35b](_0x5ad75c[_0x32ef('0x6e')],_0x5ad75c['value'][_0x32ef('0x6f')],_0x5ad75c['value']['end']);}break;case _0x32ef('0x70'):var _0x208989=_0x1d974c[_0x32ef('0x6a')]['split'](',')[_0x32ef('0x2b')](function(_0x222b24){return Number(_0x222b24);});_0x208989[_0x32ef('0x2f')](function(_0x58ecbb){_0x52c588['or'](_0x32ef('0x71'),'%,'+_0x58ecbb+',%');});_0x387cf0=_[_0x32ef('0x72')](_0x387cf0,_0x208989);break;case'User':if(_0x1d974c['operator']===_0x32ef('0x69')){_0x3fe01f[_0xbe35b](_0x32ef('0x73'),'%'+_0x1d974c[_0x32ef('0x6a')]+'%',null);}else{_0x2c7bee=_[_0x32ef('0x62')](_0x3cac2e,[_0x32ef('0x29'),_0x32ef('0x35')]);_0x1d974c['field']=_0x32ef('0x35');_0x5ad75c=as[_0x32ef('0x74')](_0x3a3513,_0x2c7bee[_0x32ef('0x3c')],_0x1d974c);_0x3fe01f[_0xbe35b](_0x5ad75c[_0x32ef('0x6e')],_0x5ad75c[_0x32ef('0x6a')][_0x32ef('0x6f')],_0x5ad75c[_0x32ef('0x6a')][_0x32ef('0x26')]);}break;case _0x32ef('0x75'):_0x5ad75c=as['buildExpression']('me',null,_0x1d974c);_0x3fe01f[_0xbe35b](_0x5ad75c[_0x32ef('0x6e')],_0x5ad75c[_0x32ef('0x6a')][_0x32ef('0x6f')],_0x5ad75c[_0x32ef('0x6a')][_0x32ef('0x26')]);break;}}else{var _0x5ad75c=as['buildExpression'](_0x3a3513,_0x2c7bee[_0x32ef('0x3c')],_0x1d974c);_0x3fe01f[_0xbe35b](_0x5ad75c[_0x32ef('0x6e')],_0x5ad75c[_0x32ef('0x6a')][_0x32ef('0x6f')],_0x5ad75c[_0x32ef('0x6a')]['end']);}}}else{var _0x3372d9=_(_0x2ed5cb['query'])[_0x32ef('0x3e')]()[_0x32ef('0x2b')](function(_0x48b6f4){return _['some'](_0x3cac2e,[_0x32ef('0x29'),_0x48b6f4])?_0x48b6f4:undefined;})[_0x32ef('0x76')]()[_0x32ef('0x6a')]();if(!_['isEmpty'](_0x3372d9)){_0x3372d9['forEach'](function(_0x3b4a8e){if(_0x3b4a8e===_0x32ef('0x77')){_0x326445[_0x32ef('0x78')](_0x32ef('0x79'),[]['concat'](_0x2ed5cb[_0x32ef('0x3d')][_0x3b4a8e]));}else if(_0x3b4a8e===_0x32ef('0x7a')){var _0x974974=JSON[_0x32ef('0x7b')](_0x2ed5cb[_0x32ef('0x3d')][_0x3b4a8e])[_0x32ef('0x7c')];var _0x43b176=JSON[_0x32ef('0x7b')](_0x2ed5cb[_0x32ef('0x3d')][_0x3b4a8e])[_0x32ef('0x7d')];_0x326445[_0x32ef('0x78')](_0x32ef('0x7e'),_0x974974,_0x43b176);}else{if(_0x2ed5cb['query'][_0x3b4a8e]==='null'){_0x326445[_0x32ef('0x78')]('i.'+_0x3b4a8e+_0x32ef('0x7f'));}else{_0x326445['where']('i.'+_0x3b4a8e+_0x32ef('0x80'),_0x2ed5cb['query'][_0x3b4a8e]);}}});}if(_0x2ed5cb[_0x32ef('0x3d')][_0x32ef('0x81')]){if(_0x2ed5cb[_0x32ef('0x3d')]['read']==0x1){_0x326445[_0x32ef('0x65')]('`unreadMessages`\x20=\x200');}else{_0x326445[_0x32ef('0x65')](_0x32ef('0x82'));}}if(_0x2ed5cb['query']['tag']){_0x387cf0=_[_0x32ef('0x83')](_0x2ed5cb['query'][_0x32ef('0x84')])?_0x2ed5cb['query'][_0x32ef('0x84')]:new Array(_0x2ed5cb[_0x32ef('0x3d')][_0x32ef('0x84')]);_0x387cf0['forEach'](function(_0x48b35e){_0x52c588['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x48b35e+',%');});}if(_0x2ed5cb[_0x32ef('0x3d')]['filter']){var _0x267364=_0x2ed5cb[_0x32ef('0x3d')][_0x32ef('0x85')][_0x32ef('0x86')]('\x5c','\x5c\x5c')[_0x32ef('0x86')](/'/g,'\x27\x27');if(qs[_0x32ef('0x87')](_0x267364)){_0x3fe01f['or']('i.id\x20LIKE\x20?',_0x267364+'%')['or'](_0x32ef('0x88'),_0x267364+'%');}else{_0x3fe01f['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x267364))['or'](_0x32ef('0x89'),_0x267364+'%');}}}_0x326445['where'](_0x3fe01f);_0x326445[_0x32ef('0x8a')](_0x32ef('0x8b'));var _0x4d64ec={'type':db[_0x32ef('0x8c')][_0x32ef('0x8d')][_0x32ef('0x8e')],'raw':!![]};var _0x4712dc=_0x326445[_0x32ef('0x8f')]();_0x4712dc[_0x32ef('0x4b')]('i.id');_0x4712dc['field'](_0x32ef('0x90'),'unreadMessages');if(_0xb4db74[_0x32ef('0x47')]){_0xb4db74[_0x32ef('0x47')][_0x32ef('0x2f')](function(_0x1782a5){var _0x238e4d=_0x1782a5[0x0]===_0x32ef('0x91')?_0x1782a5[0x0]:'i.'+_0x1782a5[0x0];_0x326445['order'](_0x238e4d,_0x1782a5[0x1]===_0x32ef('0x92')?![]:!![]);});}if(!_[_0x32ef('0x93')](_0x387cf0)){_0x326445[_0x32ef('0x65')](_0x52c588);_0x4712dc[_0x32ef('0x78')](_0x32ef('0x94'),_0x387cf0);}BPromise['resolve']()['then'](function(){if(!_0x1eeb3e){if(_0x2ed5cb[_0x32ef('0x3d')][_0x32ef('0x77')])return;_0x4712dc['where'](_0x32ef('0x95'));_0x326445[_0x32ef('0x78')](_0x32ef('0x95'));return;}if(_0x2ed5cb[_0x32ef('0x96')][_0x32ef('0x97')]!==_0x32ef('0x98'))return;return _0x2ed5cb[_0x32ef('0x96')][_0x32ef('0x99')]({'attributes':['id'],'raw':!![]})[_0x32ef('0x25')](function(_0x54e65d){if(_[_0x32ef('0x93')](_0x54e65d)){_0x4712dc[_0x32ef('0x78')]('i.WhatsappAccountId\x20IS\x20NULL');_0x326445[_0x32ef('0x78')]('i.WhatsappAccountId\x20IS\x20NULL');}else{_0x4712dc[_0x32ef('0x78')]('i.WhatsappAccountId\x20IN\x20?',_[_0x32ef('0x2b')](_0x54e65d,'id'));_0x326445[_0x32ef('0x78')](_0x32ef('0x79'),_[_0x32ef('0x2b')](_0x54e65d,'id'));}});})['then'](function(){if(_0x2ed5cb[_0x32ef('0x96')][_0x32ef('0x97')]===_0x32ef('0x98')&&!_0x1eeb3e&&!_0x2ed5cb['query']['WhatsappAccountId'])return[];return db['sequelize'][_0x32ef('0x3d')](_0x4712dc[_0x32ef('0x9a')](),_0x4d64ec);})[_0x32ef('0x25')](function(_0x34fd2b){_0x48e071[_0x32ef('0x1e')]=_0x34fd2b['length'];if(_0x48e071[_0x32ef('0x1e')]===0x0)return[];return db['sequelize'][_0x32ef('0x3d')](_0xd67dc9[_0x32ef('0x9a')](),_0x4d64ec)[_0x32ef('0x25')](function(_0x4baa7a){_0x209361=_[_0x32ef('0x9b')](_0x4baa7a,'id');_0x4d64ec=_[_0x32ef('0x9c')](_0x4d64ec,{'model':db[_0x32ef('0x39')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2ed5cb[_0x32ef('0x3d')][_0x32ef('0x42')]){_0xb4db74['attributes'][_0x32ef('0x2f')](function(_0x484df0){_0x326445[_0x32ef('0x4b')]('i.'+_0x484df0);});}else{_0x326445[_0x32ef('0x4b')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');_0x326445[_0x32ef('0x4b')](_0x32ef('0x9d'),_0x32ef('0x9e'));_0x326445[_0x32ef('0x4b')]('a.mandatoryDisposition',_0x32ef('0x9f'));_0x326445['field']('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',_0x32ef('0x91'));_0x326445['field'](_0x32ef('0xa0'));_0x326445[_0x32ef('0x4b')](_0x32ef('0xa1'),'Contact.firstName');_0x326445['field'](_0x32ef('0xa2'),_0x32ef('0xa3'));_0x326445[_0x32ef('0x4b')](_0x32ef('0xa4'),_0x32ef('0xa5'));_0x326445[_0x32ef('0x4b')](_0x32ef('0xa6'),'Contact.phone');_0x326445[_0x32ef('0x4b')](_0x32ef('0xa7'),_0x32ef('0xa8'));_0x326445[_0x32ef('0x4b')]('c.fax','Contact.fax');_0x326445[_0x32ef('0x4b')]('o.fullname',_0x32ef('0xa9'));_0x326445[_0x32ef('0x4b')]('o.internal','Owner.internal');_0x326445['field'](_0x32ef('0xaa'),_0x32ef('0x2c'));}if(_0xb4db74[_0x32ef('0x46')])_0x326445[_0x32ef('0x46')](_0xb4db74['limit']);if(_0xb4db74[_0x32ef('0x1c')])_0x326445[_0x32ef('0x1c')](_0xb4db74[_0x32ef('0x1c')]);return db['sequelize'][_0x32ef('0x3d')](_0x326445['toString'](),_0x4d64ec);})[_0x32ef('0x25')](function(_0x6c8ba){if(_0x6c8ba['length']>0x0)_0x420f00['where'](_0x32ef('0xab'),_[_0x32ef('0x2b')](_0x6c8ba,'id'));return db[_0x32ef('0xac')][_0x32ef('0x3d')](_0x420f00[_0x32ef('0x9a')](),_0x4d64ec)[_0x32ef('0x25')](function(_0x33c450){var _0xc78721=_[_0x32ef('0xad')](_0x33c450,'WhatsappInteractionId');var _0x10594a=[];_0x6c8ba['forEach'](function(_0x22d657){_0x10594a[_0x32ef('0x30')](updateWhatsappInteraction(_0x22d657,_0x209361,_0xc78721));});return BPromise[_0x32ef('0xae')](_0x10594a);});});})[_0x32ef('0x25')](function(_0x102f2f){_0x48e071['rows']=_0x102f2f;return _0x48e071;})[_0x32ef('0x25')](respondWithFilteredResult(_0x57a3c0,_0xb4db74))[_0x32ef('0xaf')](handleError(_0x57a3c0,null));};exports[_0x32ef('0xb0')]=function(_0x39d17d,_0x1db74d){var _0x1cfdd8={'raw':![],'where':{'id':_0x39d17d[_0x32ef('0xb1')]['id']}},_0x3ddb71={};_0x3ddb71[_0x32ef('0x41')]=_['keys'](db['WhatsappInteraction']['rawAttributes']);_0x3ddb71[_0x32ef('0x3d')]=_[_0x32ef('0x3e')](_0x39d17d['query']);_0x3ddb71[_0x32ef('0x3f')]=_['intersection'](_0x3ddb71[_0x32ef('0x41')],_0x3ddb71['query']);_0x1cfdd8['attributes']=_[_0x32ef('0x40')](_0x3ddb71[_0x32ef('0x41')],qs[_0x32ef('0x42')](_0x39d17d[_0x32ef('0x3d')][_0x32ef('0x42')]));_0x1cfdd8['attributes']=_0x1cfdd8[_0x32ef('0x43')]['length']?_0x1cfdd8[_0x32ef('0x43')]:_0x3ddb71['model'];if(_0x39d17d['query']['includeAll']){_0x1cfdd8['include']=[{'all':!![]}];}_0x1cfdd8=_['merge']({},_0x1cfdd8,_0x39d17d[_0x32ef('0xb2')]);return db[_0x32ef('0x39')]['find'](_0x1cfdd8)[_0x32ef('0x25')](handleEntityNotFound(_0x1db74d,null))[_0x32ef('0x25')](respondWithResult(_0x1db74d,null))[_0x32ef('0xaf')](handleError(_0x1db74d,null));};exports[_0x32ef('0xb3')]=function(_0x16c50e,_0x193f59){return db['WhatsappInteraction'][_0x32ef('0xb3')](_0x16c50e['body'],{})[_0x32ef('0x25')](respondWithResult(_0x193f59,0xc9))[_0x32ef('0xaf')](handleError(_0x193f59,null));};exports['update']=function(_0x123420,_0x59c554){if(_0x123420[_0x32ef('0x75')]['id']){delete _0x123420[_0x32ef('0x75')]['id'];}return db[_0x32ef('0x39')][_0x32ef('0x62')]({'where':{'id':_0x123420['params']['id']}})[_0x32ef('0x25')](handleEntityNotFound(_0x59c554,null))[_0x32ef('0x25')](saveUpdates(_0x123420[_0x32ef('0x75')],null))[_0x32ef('0x25')](respondWithResult(_0x59c554,null))['catch'](handleError(_0x59c554,null));};exports[_0x32ef('0x24')]=function(_0x520bea,_0x2d9e2e){return db[_0x32ef('0x39')][_0x32ef('0x62')]({'where':{'id':_0x520bea[_0x32ef('0xb1')]['id']}})[_0x32ef('0x25')](handleEntityNotFound(_0x2d9e2e,null))[_0x32ef('0x25')](removeEntity(_0x2d9e2e,null))['catch'](handleError(_0x2d9e2e,null));};exports[_0x32ef('0xb4')]=function(_0x510178,_0x530285){return db[_0x32ef('0x39')][_0x32ef('0xb4')]()[_0x32ef('0x25')](respondWithResult(_0x530285,null))[_0x32ef('0xaf')](handleError(_0x530285,null));};exports['addMessage']=function(_0x8d3b24,_0x642716,_0x21f9d8){return db[_0x32ef('0xb5')]['find']({'where':{'id':_0x8d3b24['params']['id']}})['then'](handleEntityNotFound(_0x642716,null))[_0x32ef('0x25')](function(_0x7811a6){if(_0x7811a6){return _0x7811a6[_0x32ef('0xb6')](_0x8d3b24[_0x32ef('0x75')][_0x32ef('0xb7')],_[_0x32ef('0xb8')](_0x8d3b24[_0x32ef('0x75')],[_0x32ef('0xb7'),'id'])||{});}})[_0x32ef('0x25')](respondWithResult(_0x642716,null))[_0x32ef('0xaf')](handleError(_0x642716,null));};exports[_0x32ef('0xb9')]=function(_0x5e535c,_0x1abe2b,_0x7c2649){var _0x42d79b={'raw':![],'where':{}};var _0x349e03={};var _0x766edf={'count':0x0,'rows':[]};return db[_0x32ef('0x39')]['findOne']({'where':{'id':_0x5e535c[_0x32ef('0xb1')]['id']}})[_0x32ef('0x25')](handleEntityNotFound(_0x1abe2b,null))[_0x32ef('0x25')](function(_0xfadbf5){if(_0xfadbf5){_0x349e03[_0x32ef('0x41')]=_[_0x32ef('0x3e')](db[_0x32ef('0xb5')][_0x32ef('0x3a')]);_0x349e03[_0x32ef('0x3d')]=_[_0x32ef('0x3e')](_0x5e535c[_0x32ef('0x3d')]);_0x349e03[_0x32ef('0x3f')]=_[_0x32ef('0x40')](_0x349e03[_0x32ef('0x41')],_0x349e03['query']);_0x42d79b[_0x32ef('0x43')]=_[_0x32ef('0x40')](_0x349e03[_0x32ef('0x41')],qs['fields'](_0x5e535c[_0x32ef('0x3d')]['fields']));_0x42d79b[_0x32ef('0x43')]=_0x42d79b[_0x32ef('0x43')][_0x32ef('0x44')]?_0x42d79b['attributes']:_0x349e03[_0x32ef('0x41')];if(!_0x5e535c['query'][_0x32ef('0x45')](_0x32ef('0xba'))){_0x42d79b['limit']=qs[_0x32ef('0x46')](_0x5e535c[_0x32ef('0x3d')][_0x32ef('0x46')]);_0x42d79b[_0x32ef('0x1c')]=qs[_0x32ef('0x1c')](_0x5e535c[_0x32ef('0x3d')][_0x32ef('0x1c')]);}_0x42d79b['order']=qs['sort'](_0x5e535c[_0x32ef('0x3d')]['sort']);_0x42d79b[_0x32ef('0x78')]=qs[_0x32ef('0x3f')](_['pick'](_0x5e535c[_0x32ef('0x3d')],_0x349e03[_0x32ef('0x3f')]));_0x42d79b['where'][_0x32ef('0xbb')]=_0xfadbf5['id'];if(_0x5e535c[_0x32ef('0x3d')][_0x32ef('0x85')]){_0x42d79b[_0x32ef('0x78')]=_[_0x32ef('0x9c')](_0x42d79b['where'],{'$or':_[_0x32ef('0x2b')](_0x42d79b[_0x32ef('0x43')],function(_0x47f540){var _0x73559c={};_0x73559c[_0x47f540]={'$like':'%'+_0x5e535c[_0x32ef('0x3d')][_0x32ef('0x85')]+'%'};return _0x73559c;})});}if(_0x5e535c[_0x32ef('0x3d')][_0x32ef('0x7c')]){var _0x522c22=_0x5e535c[_0x32ef('0x3d')][_0x32ef('0x7c')]['split'](',');var _0xb41a01={};_0xb41a01[_0x522c22[0x0]]={'$gte':moment(_0x522c22[0x1])[_0x32ef('0xbc')](_0x32ef('0xbd'))};_0x42d79b[_0x32ef('0x78')]=_[_0x32ef('0x9c')](_0x42d79b[_0x32ef('0x78')],_0xb41a01);}_0x42d79b=_[_0x32ef('0x9c')]({},_0x42d79b,_0x5e535c['options']);return db['WhatsappMessage'][_0x32ef('0x1e')]({'where':_0x42d79b[_0x32ef('0x78')]})[_0x32ef('0x25')](function(_0x484387){_0x766edf[_0x32ef('0x1e')]=_0x484387;if(_0x5e535c[_0x32ef('0x3d')]['includeAll']){_0x42d79b[_0x32ef('0xbe')]=[{'all':!![]}];}return db[_0x32ef('0xb5')]['findAll'](_0x42d79b);})['then'](function(_0x4445b6){_0x766edf[_0x32ef('0xbf')]=_0x4445b6;return _0x766edf;});}})[_0x32ef('0x25')](respondWithFilteredResult(_0x1abe2b,_0x42d79b))['catch'](handleError(_0x1abe2b,null));};exports['addTags']=function(_0x4ac84d,_0x24b572,_0x3a2c90){return db[_0x32ef('0x39')]['find']({'where':{'id':_0x4ac84d[_0x32ef('0xb1')]['id']}})[_0x32ef('0x25')](handleEntityNotFound(_0x24b572,null))[_0x32ef('0x25')](function(_0x58f659){if(_0x58f659){return _0x58f659[_0x32ef('0xc0')](_0x4ac84d[_0x32ef('0x75')]['ids'],_['omit'](_0x4ac84d[_0x32ef('0x75')],['ids','id'])||{})[_0x32ef('0xc1')](function(){return db[_0x32ef('0x70')]['findAll']({'attributes':['id','name',_0x32ef('0x4c')],'where':{'id':_0x4ac84d['body'][_0x32ef('0xb7')]}});})[_0x32ef('0x25')](function(_0x361820){socket[_0x32ef('0xc2')](_0x32ef('0xc3'),{'id':Number(_0x4ac84d[_0x32ef('0xb1')]['id']),'tags':_0x361820||[]});return{'id':Number(_0x4ac84d[_0x32ef('0xb1')]['id']),'tags':_0x361820||[]};});}})[_0x32ef('0x25')](respondWithResult(_0x24b572,null))[_0x32ef('0xaf')](handleError(_0x24b572,null));};exports[_0x32ef('0xc4')]=function(_0x4f265a,_0x49fdd7,_0x1e8096){return db[_0x32ef('0x39')][_0x32ef('0x62')]({'where':{'id':_0x4f265a[_0x32ef('0xb1')]['id']}})[_0x32ef('0x25')](handleEntityNotFound(_0x49fdd7,null))[_0x32ef('0x25')](function(_0x37bbda){if(_0x37bbda){return _0x37bbda[_0x32ef('0xc4')](_0x4f265a[_0x32ef('0x3d')][_0x32ef('0xb7')]);}})['then'](respondWithStatusCode(_0x49fdd7,null))[_0x32ef('0xaf')](handleError(_0x49fdd7,null));};exports[_0x32ef('0xc5')]=function(_0x2f45c2,_0xe3be2f){var _0x3307e2=moment()[_0x32ef('0xc6')]()[_0x32ef('0x9a')]();var _0x460ab8=path[_0x32ef('0xc7')](config[_0x32ef('0xc8')],_0x32ef('0xc9'),_0x32ef('0xca'),_0x32ef('0xcb'));var _0x5e584d=path[_0x32ef('0xc7')](config[_0x32ef('0xc8')],_0x32ef('0xc9'),_0x32ef('0xca'),_0x32ef('0xcc'));var _0xe331ee=path[_0x32ef('0xc7')](_0x460ab8,_0x3307e2);var _0x1b0e4b=util[_0x32ef('0xbc')](_0x32ef('0xcd'),_0x2f45c2['params']['id'],_0x3307e2);var _0x1d7329=path[_0x32ef('0xc7')](_0x460ab8,_0x1b0e4b);var _0x176d96=[];_0x176d96[_0x32ef('0x30')]({'model':db['User'],'as':_0x32ef('0xce'),'attributes':['id',_0x32ef('0xcf')],'raw':!![]});_0x176d96['push']({'model':db['CmContact'],'as':'Contact','attributes':['id',_0x32ef('0xd0'),_0x32ef('0xd1')],'raw':!![]});if(_0x2f45c2[_0x32ef('0x3d')][_0x32ef('0xcc')]){_0x176d96['push']({'model':db['Attachment'],'as':_0x32ef('0xd2'),'raw':!![]});}var _0x4f9e0a=[{'model':db['WhatsappMessage'],'as':_0x32ef('0xd3'),'attributes':['id',_0x32ef('0x75'),_0x32ef('0x7a'),'direction','secret','read'],'include':_0x176d96}];_0x4f9e0a[_0x32ef('0x30')]({'model':db[_0x32ef('0xd4')],'as':_0x32ef('0xd5'),'attributes':['id',_0x32ef('0x29')]});_0x4f9e0a[_0x32ef('0x30')]({'model':db[_0x32ef('0xce')],'as':_0x32ef('0xd6'),'attributes':['id',_0x32ef('0xcf')]});return db[_0x32ef('0x39')]['find']({'where':{'id':_0x2f45c2['params']['id']},'include':_0x4f9e0a})['then'](handleEntityNotFound(_0xe3be2f,null))[_0x32ef('0x25')](function(_0x155535){if(_0x155535){var _0x5d4311=_0x155535['get']({'plain':!![]});fs[_0x32ef('0xd7')](_0xe331ee);var _0x478be3={'channel':_0x32ef('0xd8'),'account':_0x5d4311[_0x32ef('0xd5')][_0x32ef('0x29')],'agent':_0x5d4311[_0x32ef('0xd6')]?_0x5d4311['Owner'][_0x32ef('0xcf')]:_0x32ef('0xd9'),'createdAt':moment(_0x5d4311[_0x32ef('0x7a')])[_0x32ef('0xbc')]('YYYY-MM-DD\x20HH:mm:ss')[_0x32ef('0x9a')](),'closedAt':_0x5d4311[_0x32ef('0x34')]?moment(_0x5d4311['closedAt'])['format'](_0x32ef('0xbd'))[_0x32ef('0x9a')]():'','disposition':_0x5d4311[_0x32ef('0xda')],'messages':_(_0x5d4311[_0x32ef('0xd3')])[_0x32ef('0x85')]({'secret':![]})[_0x32ef('0x2b')](function(_0xbe674c){if(_0xbe674c['Attachment']){var _0x3fad4c=path[_0x32ef('0xc7')](_0x5e584d,_0xbe674c[_0x32ef('0xd2')][_0x32ef('0xdb')]);if(fs['existsSync'](_0x3fad4c)){fs['createReadStream'](_0x3fad4c)[_0x32ef('0xdc')](fs['createWriteStream'](path[_0x32ef('0xc7')](_0xe331ee,_0xbe674c[_0x32ef('0xd2')][_0x32ef('0xdb')])));}}return{'date':moment(_0xbe674c[_0x32ef('0x7a')])[_0x32ef('0xbc')](_0x32ef('0xbd'))[_0x32ef('0x9a')](),'sender':_0xbe674c[_0x32ef('0xdd')]==='out'?_0xbe674c[_0x32ef('0xce')]?_0xbe674c['User'][_0x32ef('0xcf')]:'System':_0xbe674c['Contact']['firstName']+(_0xbe674c[_0x32ef('0x67')]['lastName']?'\x20'+_0xbe674c[_0x32ef('0x67')]['lastName']:''),'body':_0xbe674c[_0x32ef('0xd2')]?_0xbe674c['Attachment'][_0x32ef('0xdb')]:_0xbe674c[_0x32ef('0x75')],'direction':_0xbe674c['direction']===_0x32ef('0xde')?'A':'C','secret':_0xbe674c['secret'],'read':_0xbe674c[_0x32ef('0x81')],'attachment':_0xbe674c[_0x32ef('0xd2')]};})[_0x32ef('0x6a')]()};return ejs[_0x32ef('0xdf')](path[_0x32ef('0xc7')](config['root'],_0x32ef('0xc9'),_0x32ef('0xe0'),_0x32ef('0xe1')),{'interaction':_0x478be3})[_0x32ef('0x25')](function(_0x712b79){var _0x35aa0a=path[_0x32ef('0xc7')](_0xe331ee,_0x32ef('0xe2')+_0x5d4311['id']+'-'+_0x3307e2+'.pdf');var _0x372f93={'path':_0x35aa0a,'channel':'Whatsapp','interactionId':_0x5d4311['id']};return pdf[_0x32ef('0xe3')](_0x712b79,_0x372f93);})[_0x32ef('0x25')](function(){return new BPromise(function(_0x2c5250,_0x59cd48){zipdir(_0xe331ee,{'saveTo':_0x1d7329},function(_0x546560,_0x444622){if(_0x546560)return _0x59cd48(_0x546560);return _0x2c5250(_0x444622);});})[_0x32ef('0x25')](function(){return new BPromise(function(_0x2770cd,_0x10e7cc){rimraf(_0xe331ee,function(_0x3f5e5b){if(_0x3f5e5b)_0x10e7cc(_0x3f5e5b);return _0x2770cd();});});})[_0x32ef('0x25')](function(){return _0xe3be2f[_0x32ef('0xc5')](_0x1d7329,_0x1b0e4b,function(_0xa7f0b3){if(_0xa7f0b3){console[_0x32ef('0xe4')](_0x32ef('0xe5'),_0xa7f0b3);}else{fs[_0x32ef('0xe6')](_0x1d7329);}});});});}else{return _0xe3be2f['sendStatus'](0xc8);}})[_0x32ef('0xaf')](handleError(_0xe3be2f,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 4117a1d..861492b 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 _0x2e54=['hook','events','../../mysqldb','WhatsappMessage','setMaxListeners','save','update','remove','getUsers','Users','findAll','then','setDataValue','unreadMessages','length','emit','hasOwnProperty'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x2e54,0x1dd));var _0x42e5=function(_0x408edc,_0x8a18d2){_0x408edc=_0x408edc-0x0;var _0x4c8f07=_0x2e54[_0x408edc];return _0x4c8f07;};'use strict';var EventEmitter=require(_0x42e5('0x0'));var WhatsappInteraction=require('../../mysqldb')['db']['WhatsappInteraction'];var WhatsappMessage=require(_0x42e5('0x1'))['db'][_0x42e5('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x42e5('0x3')](0x0);var events={'afterCreate':_0x42e5('0x4'),'afterUpdate':_0x42e5('0x5'),'afterDestroy':_0x42e5('0x6')};function emitEvent(_0x42736b){return function(_0x528772,_0x171302,_0x455f48){_0x528772[_0x42e5('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x2af5bb){_0x528772['setDataValue'](_0x42e5('0x8'),_0x2af5bb['map'](function(_0x3a8494){return{'id':_0x3a8494['id']};}));return WhatsappMessage[_0x42e5('0x9')]({'where':{'WhatsappInteractionId':_0x528772['id'],'direction':'in','read':![]},'raw':!![]});})[_0x42e5('0xa')](function(_0x15f9f1){_0x528772[_0x42e5('0xb')](_0x42e5('0xc'),_0x15f9f1[_0x42e5('0xd')]);WhatsappInteractionEvents[_0x42e5('0xe')](_0x42736b+':'+_0x528772['id'],_0x528772);WhatsappInteractionEvents[_0x42e5('0xe')](_0x42736b,_0x528772);_0x455f48(null);})['catch'](_0x455f48(null));};}for(var e in events){if(events[_0x42e5('0xf')](e)){var event=events[e];WhatsappInteraction[_0x42e5('0x10')](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file +var _0x33a1=['setDataValue','map','findAll','length','emit','catch','hasOwnProperty','events','../../mysqldb','save','update','remove','then'];(function(_0x175ae2,_0x477b5b){var _0x45339b=function(_0x161a18){while(--_0x161a18){_0x175ae2['push'](_0x175ae2['shift']());}};_0x45339b(++_0x477b5b);}(_0x33a1,0x7c));var _0x133a=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x33a1[_0x502c7d];return _0x30b7ed;};'use strict';var EventEmitter=require(_0x133a('0x0'));var WhatsappInteraction=require(_0x133a('0x1'))['db']['WhatsappInteraction'];var WhatsappMessage=require('../../mysqldb')['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x133a('0x2'),'afterUpdate':_0x133a('0x3'),'afterDestroy':_0x133a('0x4')};function emitEvent(_0x53da00){return function(_0x51cfff,_0x219f25,_0x23c48d){_0x51cfff['getUsers']({'attributes':['id'],'raw':!![]})[_0x133a('0x5')](function(_0x1a6b64){_0x51cfff[_0x133a('0x6')]('Users',_0x1a6b64[_0x133a('0x7')](function(_0x1dd1bf){return{'id':_0x1dd1bf['id']};}));return WhatsappMessage[_0x133a('0x8')]({'where':{'WhatsappInteractionId':_0x51cfff['id'],'direction':'in','read':![]},'raw':!![]});})[_0x133a('0x5')](function(_0x4aa969){_0x51cfff['setDataValue']('unreadMessages',_0x4aa969[_0x133a('0x9')]);WhatsappInteractionEvents[_0x133a('0xa')](_0x53da00+':'+_0x51cfff['id'],_0x51cfff);WhatsappInteractionEvents[_0x133a('0xa')](_0x53da00,_0x51cfff);_0x23c48d(null);})[_0x133a('0xb')](_0x23c48d(null));};}for(var e in events){if(events[_0x133a('0xc')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 29b4473..2bb0588 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 _0x5458=['define','whatsapp_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','exports'];(function(_0x151721,_0x20d5bc){var _0x2deaa7=function(_0x499812){while(--_0x499812){_0x151721['push'](_0x151721['shift']());}};_0x2deaa7(++_0x20d5bc);}(_0x5458,0x1c7));var _0x8545=function(_0x42e694,_0x2bda04){_0x42e694=_0x42e694-0x0;var _0x16a539=_0x5458[_0x42e694];return _0x16a539;};'use strict';var _=require(_0x8545('0x0'));var util=require(_0x8545('0x1'));var logger=require(_0x8545('0x2'))('api');var moment=require(_0x8545('0x3'));var BPromise=require(_0x8545('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8545('0x5'));var rimraf=require(_0x8545('0x6'));var config=require(_0x8545('0x7'));var attributes=require('./whatsappInteraction.attributes');module[_0x8545('0x8')]=function(_0x2bd13a,_0x10792f){return _0x2bd13a[_0x8545('0x9')]('WhatsappInteraction',attributes,{'tableName':_0x8545('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x507ed8,_0x2cc4f4,_0xf25985){if(_0x507ed8[_0x8545('0xb')](_0x8545('0xc'))){_0x507ed8[_0x8545('0xd')]=moment()[_0x8545('0xe')](_0x8545('0xf'));}_0xf25985(null,_0x507ed8);}}});}; \ No newline at end of file +var _0xa88b=['util','../../config/logger','api','moment','bluebird','path','../../config/environment','./whatsappInteraction.attributes','define','whatsapp_interactions','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash'];(function(_0x277af0,_0x1f0361){var _0x43bd7c=function(_0x3ad480){while(--_0x3ad480){_0x277af0['push'](_0x277af0['shift']());}};_0x43bd7c(++_0x1f0361);}(_0xa88b,0x133));var _0xba88=function(_0x644ecd,_0x397f36){_0x644ecd=_0x644ecd-0x0;var _0x1c66ce=_0xa88b[_0x644ecd];return _0x1c66ce;};'use strict';var _=require(_0xba88('0x0'));var util=require(_0xba88('0x1'));var logger=require(_0xba88('0x2'))(_0xba88('0x3'));var moment=require(_0xba88('0x4'));var BPromise=require(_0xba88('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xba88('0x6'));var rimraf=require('rimraf');var config=require(_0xba88('0x7'));var attributes=require(_0xba88('0x8'));module['exports']=function(_0x78dc1b,_0x40e15a){return _0x78dc1b[_0xba88('0x9')]('WhatsappInteraction',attributes,{'tableName':_0xba88('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2d86de,_0x1aeedc,_0x5a914e){if(_0x2d86de['changed'](_0xba88('0xb'))){_0x2d86de[_0xba88('0xc')]=moment()['format'](_0xba88('0xd'));}_0x5a914e(null,_0x2d86de);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 59bc5c1..d793912 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 _0x3436=['spread','AddTags','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','./whatsappInteraction.socket','register','request','then','info','request\x20sent','debug','stringify','error','code','WhatsappInteraction,\x20%s,\x20%s','message','result','UpdateWhatsappInteraction','WhatsappInteraction','update','body','raw','options','limit','catch','AddTagsToWhatsappInteraction','find','omit','ids'];(function(_0x5970b9,_0x8715e9){var _0x102199=function(_0x48d154){while(--_0x48d154){_0x5970b9['push'](_0x5970b9['shift']());}};_0x102199(++_0x8715e9);}(_0x3436,0x9e));var _0x6343=function(_0x47b531,_0x2dea6b){_0x47b531=_0x47b531-0x0;var _0x7b83f0=_0x3436[_0x47b531];return _0x7b83f0;};'use strict';var _=require(_0x6343('0x0'));var util=require(_0x6343('0x1'));var moment=require(_0x6343('0x2'));var BPromise=require('bluebird');var rs=require(_0x6343('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6343('0x4'))['db'];var utils=require(_0x6343('0x5'));var logger=require(_0x6343('0x6'))('rpc');var config=require(_0x6343('0x7'));var jayson=require(_0x6343('0x8'));var client=jayson['client'][_0x6343('0x9')]({'port':0x232a});config[_0x6343('0xa')]=_[_0x6343('0xb')](config[_0x6343('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6343('0xa')]));require(_0x6343('0xc'))[_0x6343('0xd')](socket);function respondWithRpcPromise(_0x3b8291,_0x585c17,_0x235e4c){return new BPromise(function(_0x2f397d,_0x1e47e4){return client[_0x6343('0xe')](_0x3b8291,_0x235e4c)[_0x6343('0xf')](function(_0x57cee1){logger[_0x6343('0x10')]('WhatsappInteraction,\x20%s,\x20%s',_0x585c17,_0x6343('0x11'));logger[_0x6343('0x12')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x585c17,_0x6343('0x11'),JSON[_0x6343('0x13')](_0x57cee1));if(_0x57cee1['error']){if(_0x57cee1[_0x6343('0x14')][_0x6343('0x15')]===0x1f4){logger[_0x6343('0x14')](_0x6343('0x16'),_0x585c17,_0x57cee1['error'][_0x6343('0x17')]);return _0x1e47e4(_0x57cee1['error'][_0x6343('0x17')]);}logger[_0x6343('0x14')](_0x6343('0x16'),_0x585c17,_0x57cee1[_0x6343('0x14')][_0x6343('0x17')]);return _0x2f397d(_0x57cee1[_0x6343('0x14')][_0x6343('0x17')]);}else{logger['info']('WhatsappInteraction,\x20%s,\x20%s',_0x585c17,_0x6343('0x11'));_0x2f397d(_0x57cee1[_0x6343('0x18')][_0x6343('0x17')]);}})['catch'](function(_0x2c2db8){logger[_0x6343('0x14')](_0x6343('0x16'),_0x585c17,_0x2c2db8);_0x1e47e4(_0x2c2db8);});});}exports[_0x6343('0x19')]=function(_0x35c2f4){var _0x365600=this;return new Promise(function(_0x563e68,_0x58e91d){return db[_0x6343('0x1a')][_0x6343('0x1b')](_0x35c2f4[_0x6343('0x1c')],{'raw':_0x35c2f4['options']?_0x35c2f4['options'][_0x6343('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x35c2f4[_0x6343('0x1e')]?_0x35c2f4[_0x6343('0x1e')]['where']||null:null,'attributes':_0x35c2f4['options']?_0x35c2f4[_0x6343('0x1e')]['attributes']||null:null,'limit':_0x35c2f4[_0x6343('0x1e')]?_0x35c2f4['options'][_0x6343('0x1f')]||null:null})[_0x6343('0xf')](function(_0x249310){logger[_0x6343('0x10')](_0x6343('0x19'),_0x35c2f4);logger[_0x6343('0x12')](_0x6343('0x19'),_0x35c2f4,JSON[_0x6343('0x13')](_0x249310));_0x563e68(_0x249310);})[_0x6343('0x20')](function(_0x365501){logger[_0x6343('0x14')]('UpdateWhatsappInteraction',_0x365501[_0x6343('0x17')],_0x35c2f4);_0x58e91d(_0x365600[_0x6343('0x14')](0x1f4,_0x365501[_0x6343('0x17')]));});});};exports[_0x6343('0x21')]=function(_0x1c3d66){return new Promise(function(_0x42878c,_0x45e6dd){return db[_0x6343('0x1a')][_0x6343('0x22')]({'where':_0x1c3d66[_0x6343('0x1e')]?_0x1c3d66['options']['where']||null:null})['then'](function(_0x88b8d0){if(_0x88b8d0){return _0x88b8d0['addTags'](_0x1c3d66['body']['ids'],_[_0x6343('0x23')](_0x1c3d66['body'],[_0x6343('0x24'),'id'])||{});}})[_0x6343('0x25')](function(_0x963d61){logger[_0x6343('0x10')](_0x6343('0x26'),_0x1c3d66);logger[_0x6343('0x12')](_0x6343('0x26'),_0x1c3d66,JSON['stringify'](_0x963d61));_0x42878c(_0x963d61);})[_0x6343('0x20')](function(_0x537d44){logger[_0x6343('0x14')](_0x6343('0x26'),_0x537d44[_0x6343('0x17')],_0x1c3d66);_0x45e6dd(_this[_0x6343('0x14')](0x1f4,_0x537d44['message']));});});}; \ No newline at end of file +var _0x91da=['catch','AddTagsToWhatsappInteraction','WhatsappInteraction','find','addTags','ids','spread','info','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','defaults','localhost','socket.io-emitter','redis','register','then','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','UpdateWhatsappInteraction','update','body','options','raw','where','attributes'];(function(_0x52b7b9,_0x43ed4b){var _0x5b5d30=function(_0x4a5b9c){while(--_0x4a5b9c){_0x52b7b9['push'](_0x52b7b9['shift']());}};_0x5b5d30(++_0x43ed4b);}(_0x91da,0x1d7));var _0xa91d=function(_0x5f538b,_0x92292f){_0x5f538b=_0x5f538b-0x0;var _0x2d9e8d=_0x91da[_0x5f538b];return _0x2d9e8d;};'use strict';var _=require(_0xa91d('0x0'));var util=require(_0xa91d('0x1'));var moment=require(_0xa91d('0x2'));var BPromise=require(_0xa91d('0x3'));var rs=require(_0xa91d('0x4'));var fs=require('fs');var Redis=require(_0xa91d('0x5'));var db=require(_0xa91d('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa91d('0x7'));var config=require(_0xa91d('0x8'));var jayson=require(_0xa91d('0x9'));var client=jayson['client'][_0xa91d('0xa')]({'port':0x232a});config['redis']=_[_0xa91d('0xb')](config['redis'],{'host':_0xa91d('0xc'),'port':0x18eb});var socket=require(_0xa91d('0xd'))(new Redis(config[_0xa91d('0xe')]));require('./whatsappInteraction.socket')[_0xa91d('0xf')](socket);function respondWithRpcPromise(_0x262635,_0x112954,_0x1d908a){return new BPromise(function(_0x57ea25,_0x1d21d9){return client['request'](_0x262635,_0x1d908a)[_0xa91d('0x10')](function(_0x4a61f7){logger['info'](_0xa91d('0x11'),_0x112954,_0xa91d('0x12'));logger[_0xa91d('0x13')](_0xa91d('0x14'),_0x112954,'request\x20sent',JSON[_0xa91d('0x15')](_0x4a61f7));if(_0x4a61f7['error']){if(_0x4a61f7[_0xa91d('0x16')][_0xa91d('0x17')]===0x1f4){logger[_0xa91d('0x16')](_0xa91d('0x11'),_0x112954,_0x4a61f7[_0xa91d('0x16')][_0xa91d('0x18')]);return _0x1d21d9(_0x4a61f7[_0xa91d('0x16')][_0xa91d('0x18')]);}logger[_0xa91d('0x16')](_0xa91d('0x11'),_0x112954,_0x4a61f7['error']['message']);return _0x57ea25(_0x4a61f7[_0xa91d('0x16')][_0xa91d('0x18')]);}else{logger['info'](_0xa91d('0x11'),_0x112954,'request\x20sent');_0x57ea25(_0x4a61f7[_0xa91d('0x19')][_0xa91d('0x18')]);}})['catch'](function(_0x48c6f5){logger[_0xa91d('0x16')](_0xa91d('0x11'),_0x112954,_0x48c6f5);_0x1d21d9(_0x48c6f5);});});}exports[_0xa91d('0x1a')]=function(_0x4c9869){var _0x27911c=this;return new Promise(function(_0x456790,_0xd35955){return db['WhatsappInteraction'][_0xa91d('0x1b')](_0x4c9869[_0xa91d('0x1c')],{'raw':_0x4c9869[_0xa91d('0x1d')]?_0x4c9869['options'][_0xa91d('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4c9869['options']?_0x4c9869[_0xa91d('0x1d')][_0xa91d('0x1f')]||null:null,'attributes':_0x4c9869[_0xa91d('0x1d')]?_0x4c9869[_0xa91d('0x1d')][_0xa91d('0x20')]||null:null,'limit':_0x4c9869[_0xa91d('0x1d')]?_0x4c9869[_0xa91d('0x1d')]['limit']||null:null})['then'](function(_0x16fd4a){logger['info'](_0xa91d('0x1a'),_0x4c9869);logger[_0xa91d('0x13')](_0xa91d('0x1a'),_0x4c9869,JSON[_0xa91d('0x15')](_0x16fd4a));_0x456790(_0x16fd4a);})[_0xa91d('0x21')](function(_0x5b128f){logger[_0xa91d('0x16')]('UpdateWhatsappInteraction',_0x5b128f[_0xa91d('0x18')],_0x4c9869);_0xd35955(_0x27911c[_0xa91d('0x16')](0x1f4,_0x5b128f[_0xa91d('0x18')]));});});};exports[_0xa91d('0x22')]=function(_0x38be0c){return new Promise(function(_0x4a6620,_0x1915b1){return db[_0xa91d('0x23')][_0xa91d('0x24')]({'where':_0x38be0c['options']?_0x38be0c[_0xa91d('0x1d')][_0xa91d('0x1f')]||null:null})[_0xa91d('0x10')](function(_0x5d2152){if(_0x5d2152){return _0x5d2152[_0xa91d('0x25')](_0x38be0c[_0xa91d('0x1c')][_0xa91d('0x26')],_['omit'](_0x38be0c[_0xa91d('0x1c')],[_0xa91d('0x26'),'id'])||{});}})[_0xa91d('0x27')](function(_0x3797ac){logger[_0xa91d('0x28')](_0xa91d('0x29'),_0x38be0c);logger[_0xa91d('0x13')]('AddTags',_0x38be0c,JSON[_0xa91d('0x15')](_0x3797ac));_0x4a6620(_0x3797ac);})['catch'](function(_0x4eea9d){logger[_0xa91d('0x16')](_0xa91d('0x29'),_0x4eea9d['message'],_0x38be0c);_0x1915b1(_this[_0xa91d('0x16')](0x1f4,_0x4eea9d[_0xa91d('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 3ff2974..99f48bd 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 _0xe67b=['remove','update','emit','register','length','whatsappInteraction:','./whatsappInteraction.events','save'];(function(_0x4e5557,_0x4c98ba){var _0x336a10=function(_0x1d3b72){while(--_0x1d3b72){_0x4e5557['push'](_0x4e5557['shift']());}};_0x336a10(++_0x4c98ba);}(_0xe67b,0x19e));var _0xbe67=function(_0x16dbfd,_0x2f9431){_0x16dbfd=_0x16dbfd-0x0;var _0x382254=_0xe67b[_0x16dbfd];return _0x382254;};'use strict';var WhatsappInteractionEvents=require(_0xbe67('0x0'));var events=[_0xbe67('0x1'),_0xbe67('0x2'),_0xbe67('0x3')];function createListener(_0x24c558,_0x58ee55){return function(_0x22628e){_0x58ee55[_0xbe67('0x4')](_0x24c558,_0x22628e);};}function removeListener(_0x10d023,_0x2b391b){return function(){WhatsappInteractionEvents['removeListener'](_0x10d023,_0x2b391b);};}exports[_0xbe67('0x5')]=function(_0x7fd4f){for(var _0x2818c5=0x0,_0x37d811=events[_0xbe67('0x6')];_0x2818c5<_0x37d811;_0x2818c5++){var _0x3d4959=events[_0x2818c5];var _0x508545=createListener(_0xbe67('0x7')+_0x3d4959,_0x7fd4f);WhatsappInteractionEvents['on'](_0x3d4959,_0x508545);}}; \ No newline at end of file +var _0xa1d5=['./whatsappInteraction.events','save','remove','update','emit','removeListener','register','whatsappInteraction:'];(function(_0x19462e,_0xcaa065){var _0x94bcf8=function(_0x2a0039){while(--_0x2a0039){_0x19462e['push'](_0x19462e['shift']());}};_0x94bcf8(++_0xcaa065);}(_0xa1d5,0x118));var _0x5a1d=function(_0xb26ef,_0x27db02){_0xb26ef=_0xb26ef-0x0;var _0x5856b7=_0xa1d5[_0xb26ef];return _0x5856b7;};'use strict';var WhatsappInteractionEvents=require(_0x5a1d('0x0'));var events=[_0x5a1d('0x1'),_0x5a1d('0x2'),_0x5a1d('0x3')];function createListener(_0x1f763d,_0x1d5ee2){return function(_0x2e5548){_0x1d5ee2[_0x5a1d('0x4')](_0x1f763d,_0x2e5548);};}function removeListener(_0x518282,_0x1b8e1a){return function(){WhatsappInteractionEvents[_0x5a1d('0x5')](_0x518282,_0x1b8e1a);};}exports[_0x5a1d('0x6')]=function(_0xafd8c1){for(var _0x518929=0x0,_0x27c0c5=events['length'];_0x518929<_0x27c0c5;_0x518929++){var _0x56421b=events[_0x518929];var _0x190d85=createListener(_0x5a1d('0x7')+_0x56421b,_0xafd8c1);WhatsappInteractionEvents['on'](_0x56421b,_0x190d85);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index efdd266..2f3d03f 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 _0x3651=['describe','/:id','show','tracked','whatsapp','whatsappmessage:create','post','/:id/status','status','update','put','/:id/accept','accept','/:id/reject','reject','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','isAuthenticated','index','/describe'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0x3651,0x179));var _0x1365=function(_0x4a31e2,_0x2ae36c){_0x4a31e2=_0x4a31e2-0x0;var _0x41070d=_0x3651[_0x4a31e2];return _0x41070d;};'use strict';var multer=require('multer');var util=require(_0x1365('0x0'));var path=require(_0x1365('0x1'));var timeout=require(_0x1365('0x2'));var express=require(_0x1365('0x3'));var router=express[_0x1365('0x4')]();var fs_extra=require(_0x1365('0x5'));var auth=require(_0x1365('0x6'));var interaction=require(_0x1365('0x7'));var config=require(_0x1365('0x8'));var controller=require(_0x1365('0x9'));router['get']('/',auth[_0x1365('0xa')](),controller[_0x1365('0xb')]);router['get'](_0x1365('0xc'),auth[_0x1365('0xa')](),controller[_0x1365('0xd')]);router['get'](_0x1365('0xe'),auth['isAuthenticated'](),controller[_0x1365('0xf')]);router['post']('/',auth[_0x1365('0xa')](),interaction[_0x1365('0x10')](_0x1365('0x11'),_0x1365('0x12')),controller['create']);router[_0x1365('0x13')](_0x1365('0x14'),controller[_0x1365('0x15')]);router['put'](_0x1365('0xe'),auth[_0x1365('0xa')](),controller[_0x1365('0x16')]);router[_0x1365('0x17')](_0x1365('0x18'),auth[_0x1365('0xa')](),controller[_0x1365('0x19')]);router[_0x1365('0x17')](_0x1365('0x1a'),auth[_0x1365('0xa')](),controller[_0x1365('0x1b')]);router[_0x1365('0x1c')](_0x1365('0xe'),auth[_0x1365('0xa')](),controller[_0x1365('0x1d')]);module['exports']=router; \ No newline at end of file +var _0x9fb6=['/:id/reject','reject','delete','exports','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','/describe','/:id','show','tracked','whatsappmessage:create','create','post','/:id/status','status','update','put','/:id/accept'];(function(_0x28fca0,_0xe3a60a){var _0x5f422c=function(_0x32b069){while(--_0x32b069){_0x28fca0['push'](_0x28fca0['shift']());}};_0x5f422c(++_0xe3a60a);}(_0x9fb6,0x1ad));var _0x69fb=function(_0x4a7d1d,_0x5d6fe7){_0x4a7d1d=_0x4a7d1d-0x0;var _0x23bc9b=_0x9fb6[_0x4a7d1d];return _0x23bc9b;};'use strict';var multer=require(_0x69fb('0x0'));var util=require('util');var path=require(_0x69fb('0x1'));var timeout=require(_0x69fb('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x69fb('0x3'));var auth=require(_0x69fb('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x69fb('0x5'));var controller=require(_0x69fb('0x6'));router[_0x69fb('0x7')]('/',auth[_0x69fb('0x8')](),controller['index']);router[_0x69fb('0x7')](_0x69fb('0x9'),auth[_0x69fb('0x8')](),controller['describe']);router[_0x69fb('0x7')](_0x69fb('0xa'),auth[_0x69fb('0x8')](),controller[_0x69fb('0xb')]);router['post']('/',auth[_0x69fb('0x8')](),interaction[_0x69fb('0xc')]('whatsapp',_0x69fb('0xd')),controller[_0x69fb('0xe')]);router[_0x69fb('0xf')](_0x69fb('0x10'),controller[_0x69fb('0x11')]);router['put'](_0x69fb('0xa'),auth[_0x69fb('0x8')](),controller[_0x69fb('0x12')]);router[_0x69fb('0x13')](_0x69fb('0x14'),auth[_0x69fb('0x8')](),controller['accept']);router[_0x69fb('0x13')](_0x69fb('0x15'),auth[_0x69fb('0x8')](),controller[_0x69fb('0x16')]);router[_0x69fb('0x17')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x69fb('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 6a8fc3d..b2754c7 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 _0xd47c=['TEXT','BOOLEAN','ENUM','out','STRING','DATE','exports'];(function(_0x42abe4,_0xa1fd5){var _0x40280f=function(_0x5d5a33){while(--_0x5d5a33){_0x42abe4['push'](_0x42abe4['shift']());}};_0x40280f(++_0xa1fd5);}(_0xd47c,0x195));var _0xcd47=function(_0x5410fd,_0x42e056){_0x5410fd=_0x5410fd-0x0;var _0x1e98e4=_0xd47c[_0x5410fd];return _0x1e98e4;};'use strict';var Sequelize=require('sequelize');module[_0xcd47('0x0')]={'body':{'type':Sequelize[_0xcd47('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xcd47('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xcd47('0x3')]('in',_0xcd47('0x4')),'defaultValue':_0xcd47('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0xcd47('0x5')](0xbe)},'phone':{'type':Sequelize[_0xcd47('0x5')]},'readAt':{'type':Sequelize[_0xcd47('0x6')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0xcd47('0x5')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x4fde=['BOOLEAN','sequelize','exports','TEXT','medium','ENUM','out','STRING','DATE'];(function(_0x4bfac3,_0x58324d){var _0x15f0f2=function(_0xf0c511){while(--_0xf0c511){_0x4bfac3['push'](_0x4bfac3['shift']());}};_0x15f0f2(++_0x58324d);}(_0x4fde,0x19f));var _0xe4fd=function(_0x254abd,_0x1ab7f0){_0x254abd=_0x254abd-0x0;var _0x31bf1b=_0x4fde[_0x254abd];return _0x31bf1b;};'use strict';var Sequelize=require(_0xe4fd('0x0'));module[_0xe4fd('0x1')]={'body':{'type':Sequelize[_0xe4fd('0x2')](_0xe4fd('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xe4fd('0x4')]('in',_0xe4fd('0x5')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xe4fd('0x6')](0xbe)},'phone':{'type':Sequelize[_0xe4fd('0x6')]},'readAt':{'type':Sequelize[_0xe4fd('0x7')]},'secret':{'type':Sequelize[_0xe4fd('0x8')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xe4fd('0x6')]},'providerResponse':{'type':Sequelize[_0xe4fd('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 5e9dfc1..038fa9f 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 _0x7ecc=['email','manual','interface','SIP/%s','channel','motionChannel','event','acceptmessage','role','RejectMessage','rejectMessage','internal','EventManager','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','twilio','MessageSid','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','inspect','rimraf','fast-json-patch','moment','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','defaults','redis','localhost','socket.io-emitter','jayson/promise','http','request','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','end','name','send','index','map','WhatsappMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','includeAll','include','rows','show','params','options','find','create','body','describe','whatsapp-interactions','accept','whatsapp','read','format','UserId','user','get','WhatsappInteraction','WhatsappInteractionId','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','contact','User','agent','fullname'];(function(_0x2db9b7,_0x1b362c){var _0x5d9d8f=function(_0x2e8b7a){while(--_0x2e8b7a){_0x2db9b7['push'](_0x2db9b7['shift']());}};_0x5d9d8f(++_0x1b362c);}(_0x7ecc,0x126));var _0xc7ec=function(_0x43ce71,_0x2a63bd){_0x43ce71=_0x43ce71-0x0;var _0x53b032=_0x7ecc[_0x43ce71];return _0x53b032;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc7ec('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc7ec('0x1'));var rp=require('request-promise');var moment=require(_0xc7ec('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xc7ec('0x3'));var util=require('util');var path=require(_0xc7ec('0x4'));var sox=require(_0xc7ec('0x5'));var csv=require(_0xc7ec('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc7ec('0x7'));var _=require(_0xc7ec('0x8'));var squel=require(_0xc7ec('0x9'));var crypto=require(_0xc7ec('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xc7ec('0xb'));var toCsv=require(_0xc7ec('0x6'));var querystring=require(_0xc7ec('0xc'));var Papa=require(_0xc7ec('0xd'));var Redis=require(_0xc7ec('0xe'));var authService=require(_0xc7ec('0xf'));var qs=require(_0xc7ec('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc7ec('0x11'))(_0xc7ec('0x12'));var utils=require(_0xc7ec('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xc7ec('0x14'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xc7ec('0x15')](config[_0xc7ec('0x16')],{'host':_0xc7ec('0x17'),'port':0x18eb});var socket=require(_0xc7ec('0x18'))(new Redis(config['redis']));require('./whatsappMessage.socket')['register'](socket);var jayson=require(_0xc7ec('0x19'));var client=jayson['client'][_0xc7ec('0x1a')]({'port':0x232c});var client9002=jayson['client'][_0xc7ec('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x383787,_0x53889f,_0x4e5b45,_0x55a4f0){return new BPromise(function(_0x19dbcf,_0x33ac63){var _0x468715=_0x55a4f0||client;return _0x468715[_0xc7ec('0x1b')](_0x383787,_0x4e5b45)['then'](function(_0x16a9cf){logger[_0xc7ec('0x1c')](_0xc7ec('0x1d'),_0x53889f,_0xc7ec('0x1e'));logger[_0xc7ec('0x1f')](_0xc7ec('0x20'),_0x53889f,_0xc7ec('0x1e'),JSON['stringify'](_0x16a9cf));if(_0x16a9cf[_0xc7ec('0x21')]){if(_0x16a9cf['error'][_0xc7ec('0x22')]===0x1f4){logger[_0xc7ec('0x21')](_0xc7ec('0x1d'),_0x53889f,_0x16a9cf[_0xc7ec('0x21')]['message']);return _0x33ac63(_0x16a9cf[_0xc7ec('0x21')][_0xc7ec('0x23')]);}logger[_0xc7ec('0x21')](_0xc7ec('0x1d'),_0x53889f,_0x16a9cf[_0xc7ec('0x21')]['message']);return _0x19dbcf(_0x16a9cf[_0xc7ec('0x21')]['message']);}else{logger[_0xc7ec('0x1c')](_0xc7ec('0x1d'),_0x53889f,_0xc7ec('0x1e'));_0x19dbcf(_0x16a9cf[_0xc7ec('0x24')][_0xc7ec('0x23')]);}})[_0xc7ec('0x25')](function(_0x2ec99e){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x53889f,_0x2ec99e);_0x33ac63(_0x2ec99e);});});}function respondWithStatusCode(_0x42033e,_0x4d15e4){_0x4d15e4=_0x4d15e4||0xcc;return function(_0x12da80){if(_0x12da80){return _0x42033e['sendStatus'](_0x4d15e4);}return _0x42033e[_0xc7ec('0x26')](_0x4d15e4)['end']();};}function respondWithResult(_0x548844,_0x31ab61){_0x31ab61=_0x31ab61||0xc8;return function(_0x4636fe){if(_0x4636fe){return _0x548844[_0xc7ec('0x26')](_0x31ab61)['json'](_0x4636fe);}};}function respondWithFilteredResult(_0x19f73a,_0x9deb1b){return function(_0x970b0f){if(_0x970b0f){var _0x43bdf7=typeof _0x9deb1b[_0xc7ec('0x27')]===_0xc7ec('0x28')&&typeof _0x9deb1b[_0xc7ec('0x29')]===_0xc7ec('0x28');var _0x631f05=_0x970b0f['count'];var _0x51ff32=_0x43bdf7?0x0:_0x9deb1b[_0xc7ec('0x27')];var _0x3b8ee0=_0x43bdf7?_0x970b0f[_0xc7ec('0x2a')]:_0x9deb1b[_0xc7ec('0x27')]+_0x9deb1b['limit'];var _0x17d4e4;if(_0x3b8ee0>=_0x631f05){_0x3b8ee0=_0x631f05;_0x17d4e4=0xc8;}else{_0x17d4e4=0xce;}_0x19f73a[_0xc7ec('0x26')](_0x17d4e4);return _0x19f73a[_0xc7ec('0x2b')](_0xc7ec('0x2c'),_0x51ff32+'-'+_0x3b8ee0+'/'+_0x631f05)[_0xc7ec('0x2d')](_0x970b0f);}return null;};}function patchUpdates(_0x2a04e8){return function(_0x35c506){try{jsonpatch[_0xc7ec('0x2e')](_0x35c506,_0x2a04e8,!![]);}catch(_0x36ec2d){return BPromise[_0xc7ec('0x2f')](_0x36ec2d);}return _0x35c506[_0xc7ec('0x30')]();};}function saveUpdates(_0x3362fb,_0x580668){return function(_0x4ff3c7){if(_0x4ff3c7){return _0x4ff3c7[_0xc7ec('0x31')](_0x3362fb)[_0xc7ec('0x32')](function(_0xf6ddc6){return _0xf6ddc6;});}return null;};}function removeEntity(_0x3dd7ba,_0x31bf89){return function(_0xf9af91){if(_0xf9af91){return _0xf9af91[_0xc7ec('0x33')]()[_0xc7ec('0x32')](function(){_0x3dd7ba[_0xc7ec('0x26')](0xcc)[_0xc7ec('0x34')]();});}};}function handleEntityNotFound(_0x3b9a25,_0xda48e8){return function(_0x190c42){if(!_0x190c42){_0x3b9a25['sendStatus'](0x194);}return _0x190c42;};}function handleError(_0x2a1d2e,_0x186ac2){_0x186ac2=_0x186ac2||0x1f4;return function(_0x329cdf){logger['error'](_0x329cdf['stack']);if(_0x329cdf[_0xc7ec('0x35')]){delete _0x329cdf[_0xc7ec('0x35')];}_0x2a1d2e[_0xc7ec('0x26')](_0x186ac2)[_0xc7ec('0x36')](_0x329cdf);};}exports[_0xc7ec('0x37')]=function(_0x553d68,_0x5bfc1){var _0x4b8f9b={},_0x55ef27={},_0xa14585={'count':0x0,'rows':[]};var _0x4ab5ad=_[_0xc7ec('0x38')](db[_0xc7ec('0x39')][_0xc7ec('0x3a')],function(_0x13aade){return{'name':_0x13aade[_0xc7ec('0x3b')],'type':_0x13aade[_0xc7ec('0x3c')][_0xc7ec('0x3d')]};});_0x55ef27[_0xc7ec('0x3e')]=_['map'](_0x4ab5ad,'name');_0x55ef27[_0xc7ec('0x3f')]=_[_0xc7ec('0x40')](_0x553d68['query']);_0x55ef27[_0xc7ec('0x41')]=_[_0xc7ec('0x42')](_0x55ef27['model'],_0x55ef27[_0xc7ec('0x3f')]);_0x4b8f9b[_0xc7ec('0x43')]=_[_0xc7ec('0x42')](_0x55ef27[_0xc7ec('0x3e')],qs[_0xc7ec('0x44')](_0x553d68[_0xc7ec('0x3f')][_0xc7ec('0x44')]));_0x4b8f9b['attributes']=_0x4b8f9b[_0xc7ec('0x43')][_0xc7ec('0x45')]?_0x4b8f9b[_0xc7ec('0x43')]:_0x55ef27['model'];if(!_0x553d68[_0xc7ec('0x3f')][_0xc7ec('0x46')](_0xc7ec('0x47'))){_0x4b8f9b[_0xc7ec('0x29')]=qs['limit'](_0x553d68[_0xc7ec('0x3f')]['limit']);_0x4b8f9b[_0xc7ec('0x27')]=qs[_0xc7ec('0x27')](_0x553d68[_0xc7ec('0x3f')]['offset']);}_0x4b8f9b[_0xc7ec('0x48')]=qs['sort'](_0x553d68[_0xc7ec('0x3f')][_0xc7ec('0x49')]);_0x4b8f9b[_0xc7ec('0x4a')]=qs[_0xc7ec('0x41')](_[_0xc7ec('0x4b')](_0x553d68[_0xc7ec('0x3f')],_0x55ef27[_0xc7ec('0x41')]),_0x4ab5ad);if(_0x553d68['query']['filter']){_0x4b8f9b[_0xc7ec('0x4a')]=_[_0xc7ec('0x4c')](_0x4b8f9b[_0xc7ec('0x4a')],{'$or':_[_0xc7ec('0x38')](_0x4ab5ad,function(_0x1b6f5c){if(_0x1b6f5c[_0xc7ec('0x3c')]!==_0xc7ec('0x4d')){var _0x1a77e4={};_0x1a77e4[_0x1b6f5c['name']]={'$like':'%'+_0x553d68[_0xc7ec('0x3f')]['filter']+'%'};return _0x1a77e4;}})});}_0x4b8f9b=_[_0xc7ec('0x4c')]({},_0x4b8f9b,_0x553d68['options']);var _0x3b6a00={'where':_0x4b8f9b[_0xc7ec('0x4a')]};return db[_0xc7ec('0x39')]['count'](_0x3b6a00)[_0xc7ec('0x32')](function(_0x316e89){_0xa14585[_0xc7ec('0x2a')]=_0x316e89;if(_0x553d68[_0xc7ec('0x3f')][_0xc7ec('0x4e')]){_0x4b8f9b[_0xc7ec('0x4f')]=[{'all':!![]}];}return db[_0xc7ec('0x39')]['findAll'](_0x4b8f9b);})[_0xc7ec('0x32')](function(_0x3a13de){_0xa14585[_0xc7ec('0x50')]=_0x3a13de;return _0xa14585;})[_0xc7ec('0x32')](respondWithFilteredResult(_0x5bfc1,_0x4b8f9b))[_0xc7ec('0x25')](handleError(_0x5bfc1,null));};exports[_0xc7ec('0x51')]=function(_0x28fa22,_0x570cb3){var _0x2eb227={'raw':!![],'where':{'id':_0x28fa22[_0xc7ec('0x52')]['id']}},_0x8593a2={};_0x8593a2[_0xc7ec('0x3e')]=_[_0xc7ec('0x40')](db[_0xc7ec('0x39')][_0xc7ec('0x3a')]);_0x8593a2[_0xc7ec('0x3f')]=_['keys'](_0x28fa22[_0xc7ec('0x3f')]);_0x8593a2[_0xc7ec('0x41')]=_[_0xc7ec('0x42')](_0x8593a2['model'],_0x8593a2[_0xc7ec('0x3f')]);_0x2eb227[_0xc7ec('0x43')]=_[_0xc7ec('0x42')](_0x8593a2[_0xc7ec('0x3e')],qs[_0xc7ec('0x44')](_0x28fa22[_0xc7ec('0x3f')][_0xc7ec('0x44')]));_0x2eb227[_0xc7ec('0x43')]=_0x2eb227['attributes'][_0xc7ec('0x45')]?_0x2eb227['attributes']:_0x8593a2['model'];if(_0x28fa22[_0xc7ec('0x3f')][_0xc7ec('0x4e')]){_0x2eb227[_0xc7ec('0x4f')]=[{'all':!![]}];}_0x2eb227=_['merge']({},_0x2eb227,_0x28fa22[_0xc7ec('0x53')]);return db[_0xc7ec('0x39')][_0xc7ec('0x54')](_0x2eb227)['then'](handleEntityNotFound(_0x570cb3,null))[_0xc7ec('0x32')](respondWithResult(_0x570cb3,null))['catch'](handleError(_0x570cb3,null));};exports[_0xc7ec('0x55')]=function(_0x118324,_0x29a9ec){return db[_0xc7ec('0x39')][_0xc7ec('0x55')](_0x118324['body'],{})['then'](respondWithResult(_0x29a9ec,0xc9))[_0xc7ec('0x25')](handleError(_0x29a9ec,null));};exports['update']=function(_0x367f53,_0x245f8f){if(_0x367f53['body']['id']){delete _0x367f53[_0xc7ec('0x56')]['id'];}return db[_0xc7ec('0x39')]['find']({'where':{'id':_0x367f53['params']['id']}})['then'](handleEntityNotFound(_0x245f8f,null))[_0xc7ec('0x32')](saveUpdates(_0x367f53[_0xc7ec('0x56')],null))[_0xc7ec('0x32')](respondWithResult(_0x245f8f,null))[_0xc7ec('0x25')](handleError(_0x245f8f,null));};exports[_0xc7ec('0x33')]=function(_0x4b0b49,_0x15f4f2){return db[_0xc7ec('0x39')][_0xc7ec('0x54')]({'where':{'id':_0x4b0b49['params']['id']}})[_0xc7ec('0x32')](handleEntityNotFound(_0x15f4f2,null))[_0xc7ec('0x32')](removeEntity(_0x15f4f2,null))['catch'](handleError(_0x15f4f2,null));};exports[_0xc7ec('0x57')]=function(_0x5e3ab9,_0xa1bd62){return db[_0xc7ec('0x39')]['describe']()[_0xc7ec('0x32')](respondWithResult(_0xa1bd62,null))[_0xc7ec('0x25')](handleError(_0xa1bd62,null));};var interaction_log=require(_0xc7ec('0x11'))(_0xc7ec('0x58'));exports[_0xc7ec('0x59')]=function(_0x46a666,_0xca61ce,_0x56949e){var _0x25e6cd={'agent':{},'channel':_0xc7ec('0x5a')};if(_0x46a666['body']['id']){delete _0x46a666[_0xc7ec('0x56')]['id'];}_0x46a666['body'][_0xc7ec('0x5b')]=!![];_0x46a666['body']['readAt']=moment()[_0xc7ec('0x5c')]('YYYY-MM-DD\x20HH:mm:ss');_0x46a666['body'][_0xc7ec('0x5d')]=_0x46a666[_0xc7ec('0x56')][_0xc7ec('0x5d')]||_0x46a666[_0xc7ec('0x5e')]['id'];_0x25e6cd['agent']['id']=_0x46a666[_0xc7ec('0x56')][_0xc7ec('0x5d')];return db[_0xc7ec('0x39')][_0xc7ec('0x54')]({'where':{'id':_0x46a666['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0xca61ce,null))[_0xc7ec('0x32')](saveUpdates(_0x46a666[_0xc7ec('0x56')],null))[_0xc7ec('0x32')](function(_0x1b8191){if(_0x1b8191){_0x25e6cd[_0xc7ec('0x23')]=_0x1b8191[_0xc7ec('0x5f')]({'plain':!![]});return db[_0xc7ec('0x60')][_0xc7ec('0x54')]({'where':{'id':_0x1b8191[_0xc7ec('0x61')]}});}return null;})['then'](handleEntityNotFound(_0xca61ce,null))[_0xc7ec('0x32')](function(_0x5bb4c2){if(_0x5bb4c2){return _0x5bb4c2['update']({'UserId':_0x46a666[_0xc7ec('0x56')][_0xc7ec('0x5d')],'read1stAt':_['isNil'](_0x5bb4c2[_0xc7ec('0x62')])?moment()[_0xc7ec('0x5c')](_0xc7ec('0x63')):undefined});}return null;})[_0xc7ec('0x32')](function(_0x226577){if(_0x226577){_0x25e6cd[_0xc7ec('0x64')]=_0x226577[_0xc7ec('0x5f')]({'plain':!![]});interaction_log[_0xc7ec('0x1c')](_0xc7ec('0x65'),_0x46a666['user']['id'],_0x46a666[_0xc7ec('0x5e')][_0xc7ec('0x35')],_0x46a666['user']['role'],_0x25e6cd['interaction']['id'],_0x46a666[_0xc7ec('0x56')]?JSON[_0xc7ec('0x66')](_0x46a666[_0xc7ec('0x56')]):_0xc7ec('0x67'));return respondWithRpcPromise(_0xc7ec('0x68'),'acceptMessage',_0x25e6cd);}return null;})[_0xc7ec('0x32')](function(_0x436acb){var _0x27ecd6=_0xc7ec('0x69')+_0x436acb[_0xc7ec('0x23')][_0xc7ec('0x6a')];return db[_0xc7ec('0x6b')]['query'](_0x27ecd6,{'type':db[_0xc7ec('0x6c')]['QueryTypes'][_0xc7ec('0x6d')],'raw':!![]})[_0xc7ec('0x32')](function(_0x2dc0ce){return _0x2dc0ce;});})[_0xc7ec('0x32')](function(_0x51f49e){if(_0x51f49e){_0x25e6cd[_0xc7ec('0x23')][_0xc7ec('0x6e')]=_0x51f49e[0x0];if(!_0x46a666[_0xc7ec('0x56')][_0xc7ec('0x5d')])return;return db[_0xc7ec('0x6f')]['find']({'where':{'id':_0x46a666[_0xc7ec('0x56')][_0xc7ec('0x5d')],'role':_0xc7ec('0x70')},'attributes':['id',_0xc7ec('0x35'),_0xc7ec('0x71'),_0xc7ec('0x72'),'internal'],'raw':!![]});}return null;})[_0xc7ec('0x32')](function(_0x504107){if(!_0x504107)return null;_0x25e6cd[_0xc7ec('0x23')]['agent']=_0x504107;return _0x25e6cd;})[_0xc7ec('0x32')](function(_0x287bf3){if(_0x287bf3){if(_0x46a666[_0xc7ec('0x56')][_0xc7ec('0x73')]){_0x25e6cd[_0xc7ec('0x23')][_0xc7ec('0x74')]=util[_0xc7ec('0x5c')](_0xc7ec('0x75'),_0x46a666['user'][_0xc7ec('0x35')]);_0x25e6cd[_0xc7ec('0x23')][_0xc7ec('0x76')]=_0x25e6cd['channel'];_0x25e6cd[_0xc7ec('0x23')][_0xc7ec('0x77')]=_0x25e6cd['channel'];_0x25e6cd[_0xc7ec('0x23')][_0xc7ec('0x78')]='accept';return respondWithRpcPromise('EventManager','EventManager',{'event':_0xc7ec('0x79'),'message':_0x25e6cd[_0xc7ec('0x23')]},client9002)[_0xc7ec('0x32')](function(){return _0x25e6cd;});}return _0x25e6cd;}return null;})[_0xc7ec('0x32')](respondWithResult(_0xca61ce,null))[_0xc7ec('0x25')](handleError(_0xca61ce,null));};var interaction_log=require('../../config/logger')(_0xc7ec('0x58'));exports[_0xc7ec('0x2f')]=function(_0x45ff37,_0x1526a4,_0x2bb4ed){var _0xcf3191={'agent':{},'channel':_0xc7ec('0x5a')};if(_0x45ff37[_0xc7ec('0x56')]['id']){delete _0x45ff37['body']['id'];}_0x45ff37[_0xc7ec('0x56')]['UserId']=_0x45ff37[_0xc7ec('0x56')][_0xc7ec('0x5d')]||_0x45ff37[_0xc7ec('0x5e')]['id'];_0xcf3191['agent']['id']=_0x45ff37[_0xc7ec('0x56')][_0xc7ec('0x5d')];return db[_0xc7ec('0x39')][_0xc7ec('0x54')]({'where':{'id':_0x45ff37['params']['id'],'UserId':null}})[_0xc7ec('0x32')](handleEntityNotFound(_0x1526a4,null))[_0xc7ec('0x32')](function(_0xd7dd90){if(_0xd7dd90){_0xcf3191['message']=_0xd7dd90[_0xc7ec('0x5f')]({'plain':!![]});return db[_0xc7ec('0x60')][_0xc7ec('0x54')]({'where':{'id':_0xd7dd90[_0xc7ec('0x61')]}});}return null;})[_0xc7ec('0x32')](handleEntityNotFound(_0x1526a4,null))[_0xc7ec('0x32')](function(_0x3c5819){if(_0x3c5819){_0xcf3191['interaction']=_0x3c5819[_0xc7ec('0x5f')]({'plain':!![]});interaction_log[_0xc7ec('0x1c')]('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x45ff37[_0xc7ec('0x5e')]['id'],_0x45ff37[_0xc7ec('0x5e')][_0xc7ec('0x35')],_0x45ff37[_0xc7ec('0x5e')][_0xc7ec('0x7a')],_0xcf3191[_0xc7ec('0x64')]['id'],_0x45ff37['body']?JSON[_0xc7ec('0x66')](_0x45ff37['body']):'null');return respondWithRpcPromise(_0xc7ec('0x7b'),_0xc7ec('0x7c'),_0xcf3191);}return null;})['then'](function(_0xc1e276){var _0x3834b3='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0xc1e276[_0xc7ec('0x23')][_0xc7ec('0x6a')];return db['sequelize'][_0xc7ec('0x3f')](_0x3834b3,{'type':db['Sequelize']['QueryTypes'][_0xc7ec('0x6d')],'raw':!![]})['then'](function(_0x13653b){return _0x13653b;});})[_0xc7ec('0x32')](function(_0x290477){if(_0x290477){_0xcf3191[_0xc7ec('0x23')]['contact']=_0x290477[0x0];if(!_0x45ff37['body']['UserId'])return;return db[_0xc7ec('0x6f')][_0xc7ec('0x54')]({'where':{'id':_0x45ff37[_0xc7ec('0x56')][_0xc7ec('0x5d')],'role':'agent'},'attributes':['id',_0xc7ec('0x35'),'fullname','email',_0xc7ec('0x7d')],'raw':!![]});}return null;})[_0xc7ec('0x32')](function(_0x222692){if(!_0x222692)return null;_0xcf3191[_0xc7ec('0x23')][_0xc7ec('0x70')]=_0x222692;return _0xcf3191;})[_0xc7ec('0x32')](function(_0x22ef6f){if(_0x22ef6f){_0x22ef6f[_0xc7ec('0x23')][_0xc7ec('0x74')]=util[_0xc7ec('0x5c')](_0xc7ec('0x75'),_0x45ff37[_0xc7ec('0x5e')][_0xc7ec('0x35')]);_0x22ef6f[_0xc7ec('0x23')]['channel']=_0xcf3191[_0xc7ec('0x76')];_0x22ef6f[_0xc7ec('0x23')][_0xc7ec('0x77')]=_0xcf3191[_0xc7ec('0x76')];_0x22ef6f['message'][_0xc7ec('0x78')]=_0xc7ec('0x2f');respondWithRpcPromise(_0xc7ec('0x7e'),_0xc7ec('0x7e'),{'event':'rejectmessage','message':_0x22ef6f[_0xc7ec('0x23')]},client9002);return _0xcf3191;}return null;})[_0xc7ec('0x32')](respondWithResult(_0x1526a4,null))[_0xc7ec('0x25')](handleError(_0x1526a4,null));};exports[_0xc7ec('0x26')]=function(_0x293286,_0x56a53a,_0x213e17){if(_0x293286[_0xc7ec('0x56')]['id']){delete _0x293286[_0xc7ec('0x56')]['id'];}var _0xc3a719;return db[_0xc7ec('0x39')]['find']({'where':{'id':_0x293286['params']['id']}})[_0xc7ec('0x32')](handleEntityNotFound(_0x56a53a,null))['then'](function(_0x30914c){if(_0x30914c){_0xc3a719=_0x30914c;return db[_0xc7ec('0x7f')][_0xc7ec('0x54')]({'where':{'id':_0x30914c[_0xc7ec('0x80')]}});}})['then'](handleEntityNotFound(_0x56a53a,null))[_0xc7ec('0x32')](function(_0x4be68f){if(_0x4be68f){logger['debug'](_0xc7ec('0x81'),'status',_0xc7ec('0x82'),_0x4be68f[_0xc7ec('0x3c')],util['inspect'](_0x293286[_0xc7ec('0x56')],{'showHidden':![],'depth':null}));switch(_0x4be68f[_0xc7ec('0x3c')]){case _0xc7ec('0x83'):if(_0x293286[_0xc7ec('0x56')][_0xc7ec('0x84')]&&_0x293286[_0xc7ec('0x56')][_0xc7ec('0x84')]===_0xc3a719['messageId']&&_0x293286[_0xc7ec('0x56')][_0xc7ec('0x85')]&&_0x293286['body'][_0xc7ec('0x85')]===_0xc7ec('0x5b')){return _0xc3a719[_0xc7ec('0x31')]({'read':!![]});}else{logger['error'](_0xc7ec('0x86'),_0xc7ec('0x26'),'twilio',util[_0xc7ec('0x87')](_0x293286[_0xc7ec('0x56')],{'showHidden':![],'depth':null}));}break;}return _0xc3a719;}})['then'](respondWithResult(_0x56a53a,null))[_0xc7ec('0x25')](handleError(_0x56a53a,null));}; \ No newline at end of file +var _0x304b=['jayson/promise','client','http','request','then','debug','request\x20sent','stringify','error','code','message','info','result','catch','WhatsappMessage,\x20%s,\x20%s','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','stack','name','send','map','WhatsappMessage','rawAttributes','fieldName','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','keys','includeAll','find','create','body','destroy','describe','../../config/logger','whatsapp-interactions','accept','whatsapp','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','WhatsappInteraction','WhatsappInteractionId','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','User','fullname','internal','manual','SIP/%s','channel','motionChannel','event','EventManager','params','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','rejectMessage','email','interface','rejectmessage','WhatsappAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','register'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x304b,0x182));var _0xb304=function(_0x1189ab,_0x5ae0bb){_0x1189ab=_0x1189ab-0x0;var _0x2387f3=_0x304b[_0x1189ab];return _0x2387f3;};'use strict';var emlformat=require(_0xb304('0x0'));var rimraf=require(_0xb304('0x1'));var zipdir=require(_0xb304('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb304('0x3'));var moment=require(_0xb304('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb304('0x5'));var util=require('util');var path=require('path');var sox=require(_0xb304('0x6'));var csv=require(_0xb304('0x7'));var ejs=require(_0xb304('0x8'));var fs=require('fs');var fs_extra=require(_0xb304('0x9'));var _=require(_0xb304('0xa'));var squel=require(_0xb304('0xb'));var crypto=require(_0xb304('0xc'));var jsforce=require(_0xb304('0xd'));var deskjs=require(_0xb304('0xe'));var toCsv=require('to-csv');var querystring=require(_0xb304('0xf'));var Papa=require('papaparse');var Redis=require(_0xb304('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xb304('0x11'));var as=require(_0xb304('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb304('0x13'));var utils=require(_0xb304('0x14'));var config=require(_0xb304('0x15'));var licenseUtil=require(_0xb304('0x16'));var db=require(_0xb304('0x17'))['db'];config['redis']=_[_0xb304('0x18')](config[_0xb304('0x19')],{'host':_0xb304('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./whatsappMessage.socket')[_0xb304('0x1b')](socket);var jayson=require(_0xb304('0x1c'));var client=jayson[_0xb304('0x1d')][_0xb304('0x1e')]({'port':0x232c});var client9002=jayson[_0xb304('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x39cceb,_0x25b91b,_0x435125,_0x1039ab){return new BPromise(function(_0x3a0523,_0x1fc8a6){var _0x42865e=_0x1039ab||client;return _0x42865e[_0xb304('0x1f')](_0x39cceb,_0x435125)[_0xb304('0x20')](function(_0x5ecd04){logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x25b91b,'request\x20sent');logger[_0xb304('0x21')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x25b91b,_0xb304('0x22'),JSON[_0xb304('0x23')](_0x5ecd04));if(_0x5ecd04[_0xb304('0x24')]){if(_0x5ecd04[_0xb304('0x24')][_0xb304('0x25')]===0x1f4){logger[_0xb304('0x24')]('WhatsappMessage,\x20%s,\x20%s',_0x25b91b,_0x5ecd04[_0xb304('0x24')][_0xb304('0x26')]);return _0x1fc8a6(_0x5ecd04[_0xb304('0x24')][_0xb304('0x26')]);}logger[_0xb304('0x24')]('WhatsappMessage,\x20%s,\x20%s',_0x25b91b,_0x5ecd04[_0xb304('0x24')][_0xb304('0x26')]);return _0x3a0523(_0x5ecd04['error'][_0xb304('0x26')]);}else{logger[_0xb304('0x27')]('WhatsappMessage,\x20%s,\x20%s',_0x25b91b,_0xb304('0x22'));_0x3a0523(_0x5ecd04[_0xb304('0x28')][_0xb304('0x26')]);}})[_0xb304('0x29')](function(_0x25af72){logger[_0xb304('0x24')](_0xb304('0x2a'),_0x25b91b,_0x25af72);_0x1fc8a6(_0x25af72);});});}function respondWithStatusCode(_0x240e92,_0x4c10d7){_0x4c10d7=_0x4c10d7||0xcc;return function(_0x3e44eb){if(_0x3e44eb){return _0x240e92[_0xb304('0x2b')](_0x4c10d7);}return _0x240e92[_0xb304('0x2c')](_0x4c10d7)[_0xb304('0x2d')]();};}function respondWithResult(_0x13ed2c,_0x4c8f02){_0x4c8f02=_0x4c8f02||0xc8;return function(_0x4b0827){if(_0x4b0827){return _0x13ed2c[_0xb304('0x2c')](_0x4c8f02)['json'](_0x4b0827);}};}function respondWithFilteredResult(_0x5e37b8,_0x4e2ecd){return function(_0x45e6cc){if(_0x45e6cc){var _0x583474=typeof _0x4e2ecd[_0xb304('0x2e')]===_0xb304('0x2f')&&typeof _0x4e2ecd[_0xb304('0x30')]===_0xb304('0x2f');var _0x5ac268=_0x45e6cc[_0xb304('0x31')];var _0x48c51d=_0x583474?0x0:_0x4e2ecd[_0xb304('0x2e')];var _0x44c5ec=_0x583474?_0x45e6cc[_0xb304('0x31')]:_0x4e2ecd[_0xb304('0x2e')]+_0x4e2ecd[_0xb304('0x30')];var _0x50cd1e;if(_0x44c5ec>=_0x5ac268){_0x44c5ec=_0x5ac268;_0x50cd1e=0xc8;}else{_0x50cd1e=0xce;}_0x5e37b8[_0xb304('0x2c')](_0x50cd1e);return _0x5e37b8[_0xb304('0x32')](_0xb304('0x33'),_0x48c51d+'-'+_0x44c5ec+'/'+_0x5ac268)[_0xb304('0x34')](_0x45e6cc);}return null;};}function patchUpdates(_0x5b5ea1){return function(_0x548b8e){try{jsonpatch[_0xb304('0x35')](_0x548b8e,_0x5b5ea1,!![]);}catch(_0x49669f){return BPromise[_0xb304('0x36')](_0x49669f);}return _0x548b8e[_0xb304('0x37')]();};}function saveUpdates(_0x186993,_0x28dafe){return function(_0x18e00a){if(_0x18e00a){return _0x18e00a[_0xb304('0x38')](_0x186993)[_0xb304('0x20')](function(_0x1a1304){return _0x1a1304;});}return null;};}function removeEntity(_0x9d9b2e,_0x1ac0ec){return function(_0x42799f){if(_0x42799f){return _0x42799f['destroy']()['then'](function(){_0x9d9b2e[_0xb304('0x2c')](0xcc)[_0xb304('0x2d')]();});}};}function handleEntityNotFound(_0x2d3e7d,_0x39644c){return function(_0x1bcf3b){if(!_0x1bcf3b){_0x2d3e7d['sendStatus'](0x194);}return _0x1bcf3b;};}function handleError(_0x18f9a6,_0x3fa683){_0x3fa683=_0x3fa683||0x1f4;return function(_0xc9626d){logger[_0xb304('0x24')](_0xc9626d[_0xb304('0x39')]);if(_0xc9626d[_0xb304('0x3a')]){delete _0xc9626d['name'];}_0x18f9a6[_0xb304('0x2c')](_0x3fa683)[_0xb304('0x3b')](_0xc9626d);};}exports['index']=function(_0x1a153e,_0x3bc926){var _0x461166={},_0x12da5b={},_0x26d3c9={'count':0x0,'rows':[]};var _0x1e217f=_[_0xb304('0x3c')](db[_0xb304('0x3d')][_0xb304('0x3e')],function(_0xeba3d0){return{'name':_0xeba3d0[_0xb304('0x3f')],'type':_0xeba3d0['type']['key']};});_0x12da5b[_0xb304('0x40')]=_[_0xb304('0x3c')](_0x1e217f,'name');_0x12da5b[_0xb304('0x41')]=_['keys'](_0x1a153e['query']);_0x12da5b['filters']=_[_0xb304('0x42')](_0x12da5b[_0xb304('0x40')],_0x12da5b['query']);_0x461166[_0xb304('0x43')]=_[_0xb304('0x42')](_0x12da5b[_0xb304('0x40')],qs[_0xb304('0x44')](_0x1a153e[_0xb304('0x41')][_0xb304('0x44')]));_0x461166['attributes']=_0x461166[_0xb304('0x43')][_0xb304('0x45')]?_0x461166[_0xb304('0x43')]:_0x12da5b[_0xb304('0x40')];if(!_0x1a153e[_0xb304('0x41')][_0xb304('0x46')]('nolimit')){_0x461166['limit']=qs[_0xb304('0x30')](_0x1a153e[_0xb304('0x41')][_0xb304('0x30')]);_0x461166[_0xb304('0x2e')]=qs[_0xb304('0x2e')](_0x1a153e[_0xb304('0x41')][_0xb304('0x2e')]);}_0x461166[_0xb304('0x47')]=qs[_0xb304('0x48')](_0x1a153e[_0xb304('0x41')][_0xb304('0x48')]);_0x461166[_0xb304('0x49')]=qs[_0xb304('0x4a')](_[_0xb304('0x4b')](_0x1a153e[_0xb304('0x41')],_0x12da5b['filters']),_0x1e217f);if(_0x1a153e['query'][_0xb304('0x4c')]){_0x461166[_0xb304('0x49')]=_[_0xb304('0x4d')](_0x461166[_0xb304('0x49')],{'$or':_[_0xb304('0x3c')](_0x1e217f,function(_0x238add){if(_0x238add[_0xb304('0x4e')]!==_0xb304('0x4f')){var _0x3e25ed={};_0x3e25ed[_0x238add[_0xb304('0x3a')]]={'$like':'%'+_0x1a153e[_0xb304('0x41')][_0xb304('0x4c')]+'%'};return _0x3e25ed;}})});}_0x461166=_[_0xb304('0x4d')]({},_0x461166,_0x1a153e[_0xb304('0x50')]);var _0x56c4a8={'where':_0x461166['where']};return db[_0xb304('0x3d')][_0xb304('0x31')](_0x56c4a8)[_0xb304('0x20')](function(_0x265c02){_0x26d3c9[_0xb304('0x31')]=_0x265c02;if(_0x1a153e[_0xb304('0x41')]['includeAll']){_0x461166[_0xb304('0x51')]=[{'all':!![]}];}return db[_0xb304('0x3d')][_0xb304('0x52')](_0x461166);})['then'](function(_0x2d9772){_0x26d3c9[_0xb304('0x53')]=_0x2d9772;return _0x26d3c9;})[_0xb304('0x20')](respondWithFilteredResult(_0x3bc926,_0x461166))[_0xb304('0x29')](handleError(_0x3bc926,null));};exports['show']=function(_0x3f7c06,_0x1ef8f0){var _0x445f38={'raw':!![],'where':{'id':_0x3f7c06['params']['id']}},_0x584ee2={};_0x584ee2['model']=_[_0xb304('0x54')](db[_0xb304('0x3d')][_0xb304('0x3e')]);_0x584ee2[_0xb304('0x41')]=_[_0xb304('0x54')](_0x3f7c06['query']);_0x584ee2['filters']=_['intersection'](_0x584ee2[_0xb304('0x40')],_0x584ee2[_0xb304('0x41')]);_0x445f38[_0xb304('0x43')]=_[_0xb304('0x42')](_0x584ee2['model'],qs[_0xb304('0x44')](_0x3f7c06[_0xb304('0x41')][_0xb304('0x44')]));_0x445f38['attributes']=_0x445f38['attributes'][_0xb304('0x45')]?_0x445f38[_0xb304('0x43')]:_0x584ee2[_0xb304('0x40')];if(_0x3f7c06['query'][_0xb304('0x55')]){_0x445f38[_0xb304('0x51')]=[{'all':!![]}];}_0x445f38=_[_0xb304('0x4d')]({},_0x445f38,_0x3f7c06[_0xb304('0x50')]);return db[_0xb304('0x3d')][_0xb304('0x56')](_0x445f38)[_0xb304('0x20')](handleEntityNotFound(_0x1ef8f0,null))['then'](respondWithResult(_0x1ef8f0,null))[_0xb304('0x29')](handleError(_0x1ef8f0,null));};exports[_0xb304('0x57')]=function(_0x3f428c,_0x3824d7){return db['WhatsappMessage']['create'](_0x3f428c[_0xb304('0x58')],{})['then'](respondWithResult(_0x3824d7,0xc9))[_0xb304('0x29')](handleError(_0x3824d7,null));};exports[_0xb304('0x38')]=function(_0x26c9e5,_0x50563f){if(_0x26c9e5[_0xb304('0x58')]['id']){delete _0x26c9e5['body']['id'];}return db[_0xb304('0x3d')]['find']({'where':{'id':_0x26c9e5['params']['id']}})[_0xb304('0x20')](handleEntityNotFound(_0x50563f,null))['then'](saveUpdates(_0x26c9e5[_0xb304('0x58')],null))[_0xb304('0x20')](respondWithResult(_0x50563f,null))[_0xb304('0x29')](handleError(_0x50563f,null));};exports[_0xb304('0x59')]=function(_0x125323,_0x12bae6){return db[_0xb304('0x3d')]['find']({'where':{'id':_0x125323['params']['id']}})[_0xb304('0x20')](handleEntityNotFound(_0x12bae6,null))[_0xb304('0x20')](removeEntity(_0x12bae6,null))[_0xb304('0x29')](handleError(_0x12bae6,null));};exports[_0xb304('0x5a')]=function(_0x502911,_0x3d9712){return db[_0xb304('0x3d')][_0xb304('0x5a')]()[_0xb304('0x20')](respondWithResult(_0x3d9712,null))[_0xb304('0x29')](handleError(_0x3d9712,null));};var interaction_log=require(_0xb304('0x5b'))(_0xb304('0x5c'));exports[_0xb304('0x5d')]=function(_0xbf6fc7,_0x5154c9,_0x57cca6){var _0x6f8bec={'agent':{},'channel':_0xb304('0x5e')};if(_0xbf6fc7[_0xb304('0x58')]['id']){delete _0xbf6fc7[_0xb304('0x58')]['id'];}_0xbf6fc7[_0xb304('0x58')][_0xb304('0x5f')]=!![];_0xbf6fc7[_0xb304('0x58')][_0xb304('0x60')]=moment()['format'](_0xb304('0x61'));_0xbf6fc7[_0xb304('0x58')][_0xb304('0x62')]=_0xbf6fc7[_0xb304('0x58')][_0xb304('0x62')]||_0xbf6fc7[_0xb304('0x63')]['id'];_0x6f8bec[_0xb304('0x64')]['id']=_0xbf6fc7[_0xb304('0x58')][_0xb304('0x62')];return db[_0xb304('0x3d')]['find']({'where':{'id':_0xbf6fc7['params']['id'],'UserId':null}})[_0xb304('0x20')](handleEntityNotFound(_0x5154c9,null))[_0xb304('0x20')](saveUpdates(_0xbf6fc7[_0xb304('0x58')],null))[_0xb304('0x20')](function(_0x1013bc){if(_0x1013bc){_0x6f8bec[_0xb304('0x26')]=_0x1013bc[_0xb304('0x65')]({'plain':!![]});return db[_0xb304('0x66')][_0xb304('0x56')]({'where':{'id':_0x1013bc[_0xb304('0x67')]}});}return null;})[_0xb304('0x20')](handleEntityNotFound(_0x5154c9,null))[_0xb304('0x20')](function(_0xc8da0c){if(_0xc8da0c){return _0xc8da0c[_0xb304('0x38')]({'UserId':_0xbf6fc7['body'][_0xb304('0x62')],'read1stAt':_['isNil'](_0xc8da0c['read1stAt'])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x99859e){if(_0x99859e){_0x6f8bec[_0xb304('0x68')]=_0x99859e[_0xb304('0x65')]({'plain':!![]});interaction_log[_0xb304('0x27')](_0xb304('0x69'),_0xbf6fc7['user']['id'],_0xbf6fc7['user'][_0xb304('0x3a')],_0xbf6fc7[_0xb304('0x63')]['role'],_0x6f8bec['interaction']['id'],_0xbf6fc7[_0xb304('0x58')]?JSON['stringify'](_0xbf6fc7[_0xb304('0x58')]):_0xb304('0x6a'));return respondWithRpcPromise(_0xb304('0x6b'),'acceptMessage',_0x6f8bec);}return null;})[_0xb304('0x20')](function(_0x1ef01c){var _0x531b64=_0xb304('0x6c')+_0x1ef01c[_0xb304('0x26')][_0xb304('0x6d')];return db[_0xb304('0x6e')][_0xb304('0x41')](_0x531b64,{'type':db[_0xb304('0x6f')][_0xb304('0x70')][_0xb304('0x71')],'raw':!![]})['then'](function(_0x96ae34){return _0x96ae34;});})[_0xb304('0x20')](function(_0x234102){if(_0x234102){_0x6f8bec[_0xb304('0x26')]['contact']=_0x234102[0x0];if(!_0xbf6fc7['body'][_0xb304('0x62')])return;return db[_0xb304('0x72')][_0xb304('0x56')]({'where':{'id':_0xbf6fc7[_0xb304('0x58')][_0xb304('0x62')],'role':_0xb304('0x64')},'attributes':['id',_0xb304('0x3a'),_0xb304('0x73'),'email',_0xb304('0x74')],'raw':!![]});}return null;})[_0xb304('0x20')](function(_0x1137a4){if(!_0x1137a4)return null;_0x6f8bec['message'][_0xb304('0x64')]=_0x1137a4;return _0x6f8bec;})[_0xb304('0x20')](function(_0x232460){if(_0x232460){if(_0xbf6fc7['body'][_0xb304('0x75')]){_0x6f8bec[_0xb304('0x26')]['interface']=util['format'](_0xb304('0x76'),_0xbf6fc7[_0xb304('0x63')]['name']);_0x6f8bec[_0xb304('0x26')][_0xb304('0x77')]=_0x6f8bec[_0xb304('0x77')];_0x6f8bec[_0xb304('0x26')][_0xb304('0x78')]=_0x6f8bec[_0xb304('0x77')];_0x6f8bec[_0xb304('0x26')][_0xb304('0x79')]='accept';return respondWithRpcPromise(_0xb304('0x7a'),'EventManager',{'event':'acceptmessage','message':_0x6f8bec[_0xb304('0x26')]},client9002)['then'](function(){return _0x6f8bec;});}return _0x6f8bec;}return null;})[_0xb304('0x20')](respondWithResult(_0x5154c9,null))['catch'](handleError(_0x5154c9,null));};var interaction_log=require(_0xb304('0x5b'))('whatsapp-interactions');exports[_0xb304('0x36')]=function(_0x336c21,_0xbdf4f2,_0x2ddb62){var _0xe1be94={'agent':{},'channel':_0xb304('0x5e')};if(_0x336c21[_0xb304('0x58')]['id']){delete _0x336c21[_0xb304('0x58')]['id'];}_0x336c21[_0xb304('0x58')][_0xb304('0x62')]=_0x336c21[_0xb304('0x58')][_0xb304('0x62')]||_0x336c21[_0xb304('0x63')]['id'];_0xe1be94[_0xb304('0x64')]['id']=_0x336c21[_0xb304('0x58')][_0xb304('0x62')];return db[_0xb304('0x3d')][_0xb304('0x56')]({'where':{'id':_0x336c21[_0xb304('0x7b')]['id'],'UserId':null}})[_0xb304('0x20')](handleEntityNotFound(_0xbdf4f2,null))[_0xb304('0x20')](function(_0x1f3986){if(_0x1f3986){_0xe1be94[_0xb304('0x26')]=_0x1f3986[_0xb304('0x65')]({'plain':!![]});return db[_0xb304('0x66')][_0xb304('0x56')]({'where':{'id':_0x1f3986['WhatsappInteractionId']}});}return null;})[_0xb304('0x20')](handleEntityNotFound(_0xbdf4f2,null))['then'](function(_0x1b7b0d){if(_0x1b7b0d){_0xe1be94[_0xb304('0x68')]=_0x1b7b0d['get']({'plain':!![]});interaction_log[_0xb304('0x27')](_0xb304('0x7c'),_0x336c21[_0xb304('0x63')]['id'],_0x336c21[_0xb304('0x63')]['name'],_0x336c21[_0xb304('0x63')][_0xb304('0x7d')],_0xe1be94[_0xb304('0x68')]['id'],_0x336c21[_0xb304('0x58')]?JSON[_0xb304('0x23')](_0x336c21[_0xb304('0x58')]):_0xb304('0x6a'));return respondWithRpcPromise('RejectMessage',_0xb304('0x7e'),_0xe1be94);}return null;})[_0xb304('0x20')](function(_0xf2b25){var _0x10b960=_0xb304('0x6c')+_0xf2b25['message'][_0xb304('0x6d')];return db[_0xb304('0x6e')][_0xb304('0x41')](_0x10b960,{'type':db[_0xb304('0x6f')][_0xb304('0x70')][_0xb304('0x71')],'raw':!![]})[_0xb304('0x20')](function(_0x572759){return _0x572759;});})[_0xb304('0x20')](function(_0x56bf73){if(_0x56bf73){_0xe1be94[_0xb304('0x26')]['contact']=_0x56bf73[0x0];if(!_0x336c21[_0xb304('0x58')]['UserId'])return;return db[_0xb304('0x72')][_0xb304('0x56')]({'where':{'id':_0x336c21[_0xb304('0x58')]['UserId'],'role':_0xb304('0x64')},'attributes':['id',_0xb304('0x3a'),'fullname',_0xb304('0x7f'),_0xb304('0x74')],'raw':!![]});}return null;})[_0xb304('0x20')](function(_0x525d69){if(!_0x525d69)return null;_0xe1be94[_0xb304('0x26')][_0xb304('0x64')]=_0x525d69;return _0xe1be94;})['then'](function(_0x6f0884){if(_0x6f0884){_0x6f0884[_0xb304('0x26')][_0xb304('0x80')]=util['format'](_0xb304('0x76'),_0x336c21['user'][_0xb304('0x3a')]);_0x6f0884[_0xb304('0x26')]['channel']=_0xe1be94[_0xb304('0x77')];_0x6f0884['message'][_0xb304('0x78')]=_0xe1be94[_0xb304('0x77')];_0x6f0884[_0xb304('0x26')][_0xb304('0x79')]='reject';respondWithRpcPromise(_0xb304('0x7a'),_0xb304('0x7a'),{'event':_0xb304('0x81'),'message':_0x6f0884[_0xb304('0x26')]},client9002);return _0xe1be94;}return null;})[_0xb304('0x20')](respondWithResult(_0xbdf4f2,null))[_0xb304('0x29')](handleError(_0xbdf4f2,null));};exports[_0xb304('0x2c')]=function(_0x4491d2,_0x235e94,_0x1d0bcf){if(_0x4491d2['body']['id']){delete _0x4491d2[_0xb304('0x58')]['id'];}var _0x1829c9;return db[_0xb304('0x3d')][_0xb304('0x56')]({'where':{'id':_0x4491d2[_0xb304('0x7b')]['id']}})[_0xb304('0x20')](handleEntityNotFound(_0x235e94,null))['then'](function(_0x4b2010){if(_0x4b2010){_0x1829c9=_0x4b2010;return db['WhatsappAccount']['find']({'where':{'id':_0x4b2010[_0xb304('0x82')]}});}})[_0xb304('0x20')](handleEntityNotFound(_0x235e94,null))['then'](function(_0x1c2bce){if(_0x1c2bce){logger['debug']('WhatsppMessage,\x20%s,\x20%s,\x20%s',_0xb304('0x2c'),_0xb304('0x83'),_0x1c2bce[_0xb304('0x4e')],util[_0xb304('0x84')](_0x4491d2[_0xb304('0x58')],{'showHidden':![],'depth':null}));switch(_0x1c2bce[_0xb304('0x4e')]){case _0xb304('0x85'):if(_0x4491d2[_0xb304('0x58')][_0xb304('0x86')]&&_0x4491d2[_0xb304('0x58')]['MessageSid']===_0x1829c9[_0xb304('0x87')]&&_0x4491d2[_0xb304('0x58')][_0xb304('0x88')]&&_0x4491d2['body'][_0xb304('0x88')]===_0xb304('0x5f')){return _0x1829c9[_0xb304('0x38')]({'read':!![]});}else{logger['error'](_0xb304('0x89'),'status',_0xb304('0x85'),util['inspect'](_0x4491d2[_0xb304('0x58')],{'showHidden':![],'depth':null}));}break;}return _0x1829c9;}})[_0xb304('0x20')](respondWithResult(_0x235e94,null))[_0xb304('0x29')](handleError(_0x235e94,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 23bca91..39c0208 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 _0x693f=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','WhatsappMessage','setMaxListeners','update'];(function(_0x32e3eb,_0x30312f){var _0x489e3f=function(_0x5035fb){while(--_0x5035fb){_0x32e3eb['push'](_0x32e3eb['shift']());}};_0x489e3f(++_0x30312f);}(_0x693f,0x9d));var _0xf693=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x693f[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require(_0xf693('0x0'));var WhatsappMessage=require(_0xf693('0x1'))['db'][_0xf693('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xf693('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xf693('0x4'),'afterDestroy':_0xf693('0x5')};function emitEvent(_0xe37cf3){return function(_0x1d272f,_0x3d2e05,_0x6e749b){WhatsappMessageEvents[_0xf693('0x6')](_0xe37cf3+':'+_0x1d272f['id'],_0x1d272f);WhatsappMessageEvents['emit'](_0xe37cf3,_0x1d272f);_0x6e749b(null);};}for(var e in events){if(events[_0xf693('0x7')](e)){var event=events[e];WhatsappMessage[_0xf693('0x8')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file +var _0x235a=['../../mysqldb','WhatsappMessage','save','remove','emit','hasOwnProperty','exports','events'];(function(_0x1f2b06,_0x3200f1){var _0x1c1b67=function(_0x4c4df5){while(--_0x4c4df5){_0x1f2b06['push'](_0x1f2b06['shift']());}};_0x1c1b67(++_0x3200f1);}(_0x235a,0x1ef));var _0xa235=function(_0xd2403,_0x2bf7b5){_0xd2403=_0xd2403-0x0;var _0x5c0fb0=_0x235a[_0xd2403];return _0x5c0fb0;};'use strict';var EventEmitter=require(_0xa235('0x0'));var WhatsappMessage=require(_0xa235('0x1'))['db'][_0xa235('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa235('0x3'),'afterUpdate':'update','afterDestroy':_0xa235('0x4')};function emitEvent(_0x2f7920){return function(_0x277a68,_0x314ebf,_0x2e6eca){WhatsappMessageEvents[_0xa235('0x5')](_0x2f7920+':'+_0x277a68['id'],_0x277a68);WhatsappMessageEvents[_0xa235('0x5')](_0x2f7920,_0x277a68);_0x2e6eca(null);};}for(var e in events){if(events[_0xa235('0x6')](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module[_0xa235('0x7')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index fcf6a5e..4a0a660 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 _0xabae=['error','secret','WhatsappAccount','WhatsappAccountId','type','twilio','accountSid','authToken','phone','messages','create','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','sid','update','inspect','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','sinch','baseUrl','/whatsapp/v1/','/messages/','POST','Bearer\x20','application/json','statuses','message_id','err','WhatsappMessage,\x20%s','finally','utf8mb4','lodash','util','api','moment','node-fetch','./whatsappMessage.attributes','define','whatsapp_messages','messageId','fti_whatsapp_messages','body','models','get','direction','toLowerCase','out','isNil','UserId','WhatsappInteraction','findOne','then','createdAt','catch'];(function(_0x30623e,_0x39b154){var _0x8b5786=function(_0x34484a){while(--_0x34484a){_0x30623e['push'](_0x30623e['shift']());}};_0x8b5786(++_0x39b154);}(_0xabae,0x1ea));var _0xeaba=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xabae[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xeaba('0x0'));var util=require(_0xeaba('0x1'));var logger=require('../../config/logger')(_0xeaba('0x2'));var moment=require(_0xeaba('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fetch=require(_0xeaba('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xeaba('0x5'));module['exports']=function(_0x1512de,_0x59c776){return _0x1512de[_0xeaba('0x6')]('WhatsappMessage',attributes,{'tableName':_0xeaba('0x7'),'paranoid':![],'indexes':[{'name':_0xeaba('0x8'),'fields':[_0xeaba('0x8')]},{'name':_0xeaba('0x9'),'fields':[_0xeaba('0xa')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x322e2f,_0x282027,_0x448df6){var _0x3a7cdf=_0x1512de[_0xeaba('0xb')];var _0x486296=_0x322e2f[_0xeaba('0xc')]({'plain':!![]});if(_0x486296[_0xeaba('0xd')][_0xeaba('0xe')]()==='in'||_0x486296[_0xeaba('0xd')][_0xeaba('0xe')]()===_0xeaba('0xf')&&!_0x486296['secret']&&!_[_0xeaba('0x10')](_0x486296[_0xeaba('0x11')])){_0x3a7cdf[_0xeaba('0x12')][_0xeaba('0x13')]({'where':{'id':_0x486296['WhatsappInteractionId']}})[_0xeaba('0x14')](function(_0x23fa06){if(_0x23fa06){_0x23fa06['update']({'lastMsgAt':_0x486296[_0xeaba('0x15')],'lastMsgDirection':_0x486296[_0xeaba('0xd')]['toLowerCase']()});}})[_0xeaba('0x16')](function(_0x58cbb9){console[_0xeaba('0x17')](_0x58cbb9);});}if(_0x486296[_0xeaba('0xd')]===_0xeaba('0xf')&&!_0x486296[_0xeaba('0x18')]){var _0x1964c8;_0x3a7cdf[_0xeaba('0x19')]['find']({'where':{'id':_0x486296[_0xeaba('0x1a')]},'raw':!![]})['then'](function(_0x3c1a41){_0x1964c8=_0x3c1a41;if(_0x1964c8&&_0x1964c8[_0xeaba('0x1b')]){switch(_0x1964c8[_0xeaba('0x1b')]){case _0xeaba('0x1c'):var _0x538bd5=require(_0xeaba('0x1c'));if(_0x1964c8[_0xeaba('0x1d')]&&_0x1964c8[_0xeaba('0x1e')]&&_0x1964c8[_0xeaba('0x1f')]){var _0x2badd9=new _0x538bd5(_0x1964c8[_0xeaba('0x1d')],_0x1964c8[_0xeaba('0x1e')]);_0x2badd9[_0xeaba('0x20')][_0xeaba('0x21')]({'body':_0x486296['body'],'to':_0xeaba('0x22')+_0x486296[_0xeaba('0x1f')],'from':_0xeaba('0x22')+_0x1964c8[_0xeaba('0x1f')],'statusCallback':_0x1964c8[_0xeaba('0x23')]+_0xeaba('0x24')+_0x486296['id']+_0xeaba('0x25')+_0x1964c8[_0xeaba('0x26')]})[_0xeaba('0x14')](function(_0x131bd5){if(_0x131bd5[_0xeaba('0x27')]){return _0x322e2f[_0xeaba('0x28')]({'messageId':_0x131bd5['sid']});}})[_0xeaba('0x16')](function(_0x50ba29){logger[_0xeaba('0x17')]('WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xeaba('0x1c'),util[_0xeaba('0x29')](_0x50ba29,{'showHidden':![],'depth':null}));});}else{logger[_0xeaba('0x17')](_0xeaba('0x2a'),_0xeaba('0x2b'),'twilio','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0xeaba('0x2c'):var _0x4fbc71=_0x1964c8[_0xeaba('0x1d')];var _0xd71f2=_0x1964c8[_0xeaba('0x1e')];var _0x2ce3be=_0x1964c8[_0xeaba('0x2d')]+_0xeaba('0x2e')+_0x4fbc71+_0xeaba('0x2f');var _0x40c1b8={'to':[_0x486296[_0xeaba('0x1f')]],'message':{'type':'text','text':_0x486296[_0xeaba('0xa')]}};var _0x424575={'method':_0xeaba('0x30'),'uri':_0x2ce3be,'headers':{'Authorization':_0xeaba('0x31')+_0xd71f2,'Content-Type':_0xeaba('0x32')},'body':_0x40c1b8,'json':!![]};rp(_0x424575)[_0xeaba('0x14')](function(_0x36d15e){if(_0x36d15e[_0xeaba('0x33')][0x0][_0xeaba('0x34')]){return _0x322e2f['update']({'messageId':_0x36d15e['statuses'][0x0][_0xeaba('0x34')]});}})[_0xeaba('0x16')](function(_0x1dbfdd){logger[_0xeaba('0x35')](_0xeaba('0x36'),_0x1dbfdd);});break;}}})[_0xeaba('0x37')](function(){_0x448df6();});}else{_0x448df6();}}},'charset':_0xeaba('0x38'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x99c9=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','models','get','direction','toLowerCase','out','secret','isNil','UserId','findOne','WhatsappInteractionId','createdAt','catch','WhatsappAccount','WhatsappAccountId','then','type','twilio','accountSid','authToken','phone','messages','create','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','sid','update','error','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','sinch','baseUrl','/whatsapp/v1/','/messages/','text','POST','Bearer\x20','application/json','statuses','message_id','err','WhatsappMessage,\x20%s','finally','utf8mb4','lodash','util','../../config/logger','api'];(function(_0x125ff8,_0x41925f){var _0x2d9ef=function(_0x4ef34c){while(--_0x4ef34c){_0x125ff8['push'](_0x125ff8['shift']());}};_0x2d9ef(++_0x41925f);}(_0x99c9,0x13c));var _0x999c=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0x99c9[_0x346737];return _0x1ade2e;};'use strict';var _=require(_0x999c('0x0'));var util=require(_0x999c('0x1'));var logger=require(_0x999c('0x2'))(_0x999c('0x3'));var moment=require(_0x999c('0x4'));var BPromise=require(_0x999c('0x5'));var rp=require(_0x999c('0x6'));var fetch=require('node-fetch');var fs=require('fs');var path=require(_0x999c('0x7'));var rimraf=require(_0x999c('0x8'));var config=require(_0x999c('0x9'));var attributes=require(_0x999c('0xa'));module[_0x999c('0xb')]=function(_0x14df32,_0x34f100){return _0x14df32[_0x999c('0xc')](_0x999c('0xd'),attributes,{'tableName':_0x999c('0xe'),'paranoid':![],'indexes':[{'name':_0x999c('0xf'),'fields':[_0x999c('0xf')]},{'name':_0x999c('0x10'),'fields':[_0x999c('0x11')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1f3f8f,_0x2bf133,_0x574ba0){var _0x5b5436=_0x14df32[_0x999c('0x12')];var _0x97d9fd=_0x1f3f8f[_0x999c('0x13')]({'plain':!![]});if(_0x97d9fd[_0x999c('0x14')][_0x999c('0x15')]()==='in'||_0x97d9fd[_0x999c('0x14')][_0x999c('0x15')]()===_0x999c('0x16')&&!_0x97d9fd[_0x999c('0x17')]&&!_[_0x999c('0x18')](_0x97d9fd[_0x999c('0x19')])){_0x5b5436['WhatsappInteraction'][_0x999c('0x1a')]({'where':{'id':_0x97d9fd[_0x999c('0x1b')]}})['then'](function(_0x54a2fa){if(_0x54a2fa){_0x54a2fa['update']({'lastMsgAt':_0x97d9fd[_0x999c('0x1c')],'lastMsgDirection':_0x97d9fd[_0x999c('0x14')][_0x999c('0x15')]()});}})[_0x999c('0x1d')](function(_0x2a6667){console['error'](_0x2a6667);});}if(_0x97d9fd[_0x999c('0x14')]===_0x999c('0x16')&&!_0x97d9fd[_0x999c('0x17')]){var _0xc05363;_0x5b5436[_0x999c('0x1e')]['find']({'where':{'id':_0x97d9fd[_0x999c('0x1f')]},'raw':!![]})[_0x999c('0x20')](function(_0x3a8a99){_0xc05363=_0x3a8a99;if(_0xc05363&&_0xc05363[_0x999c('0x21')]){switch(_0xc05363[_0x999c('0x21')]){case'twilio':var _0x3630b8=require(_0x999c('0x22'));if(_0xc05363[_0x999c('0x23')]&&_0xc05363[_0x999c('0x24')]&&_0xc05363[_0x999c('0x25')]){var _0x1219d6=new _0x3630b8(_0xc05363['accountSid'],_0xc05363[_0x999c('0x24')]);_0x1219d6[_0x999c('0x26')][_0x999c('0x27')]({'body':_0x97d9fd[_0x999c('0x11')],'to':_0x999c('0x28')+_0x97d9fd[_0x999c('0x25')],'from':_0x999c('0x28')+_0xc05363[_0x999c('0x25')],'statusCallback':_0xc05363[_0x999c('0x29')]+_0x999c('0x2a')+_0x97d9fd['id']+_0x999c('0x2b')+_0xc05363['token']})[_0x999c('0x20')](function(_0x1862ee){if(_0x1862ee[_0x999c('0x2c')]){return _0x1f3f8f[_0x999c('0x2d')]({'messageId':_0x1862ee[_0x999c('0x2c')]});}})[_0x999c('0x1d')](function(_0x575897){logger[_0x999c('0x2e')](_0x999c('0x2f'),_0x999c('0x30'),'twilio',util[_0x999c('0x31')](_0x575897,{'showHidden':![],'depth':null}));});}else{logger[_0x999c('0x2e')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x999c('0x30'),'twilio','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x999c('0x32'):var _0x42cb25=_0xc05363[_0x999c('0x23')];var _0x2de6d5=_0xc05363[_0x999c('0x24')];var _0x42c2e8=_0xc05363[_0x999c('0x33')]+_0x999c('0x34')+_0x42cb25+_0x999c('0x35');var _0x3b836a={'to':[_0x97d9fd['phone']],'message':{'type':_0x999c('0x36'),'text':_0x97d9fd[_0x999c('0x11')]}};var _0x3f66ae={'method':_0x999c('0x37'),'uri':_0x42c2e8,'headers':{'Authorization':_0x999c('0x38')+_0x2de6d5,'Content-Type':_0x999c('0x39')},'body':_0x3b836a,'json':!![]};rp(_0x3f66ae)[_0x999c('0x20')](function(_0x362735){if(_0x362735['statuses'][0x0]['message_id']){return _0x1f3f8f[_0x999c('0x2d')]({'messageId':_0x362735[_0x999c('0x3a')][0x0][_0x999c('0x3b')]});}})[_0x999c('0x1d')](function(_0x57bfb5){logger[_0x999c('0x3c')](_0x999c('0x3d'),_0x57bfb5);});break;}}})[_0x999c('0x3e')](function(){_0x574ba0();});}else{_0x574ba0();}}},'charset':_0x999c('0x3f'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index c204edd..d6cb4a2 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 _0x7629=['WhatsappMessage,\x20%s,\x20%s','message','result','catch','CreateWhatsappMessage','body','raw','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0xb960db,_0x41c3a1){var _0x27f471=function(_0x52ca87){while(--_0x52ca87){_0xb960db['push'](_0xb960db['shift']());}};_0x27f471(++_0x41c3a1);}(_0x7629,0x147));var _0x9762=function(_0x42f982,_0x51e48f){_0x42f982=_0x42f982-0x0;var _0x2a32c3=_0x7629[_0x42f982];return _0x2a32c3;};'use strict';var _=require(_0x9762('0x0'));var util=require(_0x9762('0x1'));var moment=require(_0x9762('0x2'));var BPromise=require('bluebird');var rs=require(_0x9762('0x3'));var fs=require('fs');var Redis=require(_0x9762('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9762('0x5'));var logger=require('../../config/logger')(_0x9762('0x6'));var config=require(_0x9762('0x7'));var jayson=require(_0x9762('0x8'));var client=jayson[_0x9762('0x9')][_0x9762('0xa')]({'port':0x232a});config[_0x9762('0xb')]=_[_0x9762('0xc')](config[_0x9762('0xb')],{'host':_0x9762('0xd'),'port':0x18eb});var socket=require(_0x9762('0xe'))(new Redis(config[_0x9762('0xb')]));require('./whatsappMessage.socket')[_0x9762('0xf')](socket);function respondWithRpcPromise(_0x456637,_0x2a0e9b,_0x2edb07){return new BPromise(function(_0x46bb7a,_0x12727e){return client[_0x9762('0x10')](_0x456637,_0x2edb07)[_0x9762('0x11')](function(_0x37681c){logger[_0x9762('0x12')]('WhatsappMessage,\x20%s,\x20%s',_0x2a0e9b,_0x9762('0x13'));logger[_0x9762('0x14')](_0x9762('0x15'),_0x2a0e9b,'request\x20sent',JSON[_0x9762('0x16')](_0x37681c));if(_0x37681c[_0x9762('0x17')]){if(_0x37681c[_0x9762('0x17')][_0x9762('0x18')]===0x1f4){logger[_0x9762('0x17')](_0x9762('0x19'),_0x2a0e9b,_0x37681c[_0x9762('0x17')][_0x9762('0x1a')]);return _0x12727e(_0x37681c[_0x9762('0x17')][_0x9762('0x1a')]);}logger[_0x9762('0x17')](_0x9762('0x19'),_0x2a0e9b,_0x37681c[_0x9762('0x17')]['message']);return _0x46bb7a(_0x37681c['error'][_0x9762('0x1a')]);}else{logger[_0x9762('0x12')](_0x9762('0x19'),_0x2a0e9b,_0x9762('0x13'));_0x46bb7a(_0x37681c[_0x9762('0x1b')]['message']);}})[_0x9762('0x1c')](function(_0x90cc46){logger[_0x9762('0x17')](_0x9762('0x19'),_0x2a0e9b,_0x90cc46);_0x12727e(_0x90cc46);});});}exports[_0x9762('0x1d')]=function(_0xe9df39){var _0x248cc3=this;return new Promise(function(_0x5596c1,_0x1f350c){return db['WhatsappMessage']['create'](_0xe9df39[_0x9762('0x1e')],{'raw':_0xe9df39['options']?_0xe9df39['options'][_0x9762('0x1f')]===undefined?!![]:![]:!![]})[_0x9762('0x11')](function(_0xd9f92f){logger[_0x9762('0x12')](_0x9762('0x1d'),_0xe9df39);logger[_0x9762('0x14')]('CreateWhatsappMessage',_0xe9df39,JSON[_0x9762('0x16')](_0xd9f92f));_0x5596c1(_0xd9f92f);})[_0x9762('0x1c')](function(_0x4c159d){logger['error']('CreateWhatsappMessage',_0x4c159d[_0x9762('0x1a')],_0xe9df39);_0x1f350c(_0x248cc3[_0x9762('0x17')](0x1f4,_0x4c159d['message']));});});}; \ No newline at end of file +var _0xba6f=['request\x20sent','result','catch','CreateWhatsappMessage','create','options','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','redis','localhost','socket.io-emitter','./whatsappMessage.socket','request','then','info','WhatsappMessage,\x20%s,\x20%s','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x489b01,_0x597248){var _0x5dcc6c=function(_0xf8a48e){while(--_0xf8a48e){_0x489b01['push'](_0x489b01['shift']());}};_0x5dcc6c(++_0x597248);}(_0xba6f,0x145));var _0xfba6=function(_0x567bcb,_0x4978c1){_0x567bcb=_0x567bcb-0x0;var _0x4eebc2=_0xba6f[_0x567bcb];return _0x4eebc2;};'use strict';var _=require(_0xfba6('0x0'));var util=require(_0xfba6('0x1'));var moment=require(_0xfba6('0x2'));var BPromise=require(_0xfba6('0x3'));var rs=require(_0xfba6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfba6('0x5'))['db'];var utils=require(_0xfba6('0x6'));var logger=require('../../config/logger')(_0xfba6('0x7'));var config=require(_0xfba6('0x8'));var jayson=require(_0xfba6('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0xfba6('0xa')]=_['defaults'](config['redis'],{'host':_0xfba6('0xb'),'port':0x18eb});var socket=require(_0xfba6('0xc'))(new Redis(config[_0xfba6('0xa')]));require(_0xfba6('0xd'))['register'](socket);function respondWithRpcPromise(_0x4d8307,_0x29113c,_0x474707){return new BPromise(function(_0x207098,_0x1ae7ea){return client[_0xfba6('0xe')](_0x4d8307,_0x474707)[_0xfba6('0xf')](function(_0xaa742){logger[_0xfba6('0x10')](_0xfba6('0x11'),_0x29113c,'request\x20sent');logger[_0xfba6('0x12')](_0xfba6('0x13'),_0x29113c,'request\x20sent',JSON[_0xfba6('0x14')](_0xaa742));if(_0xaa742['error']){if(_0xaa742[_0xfba6('0x15')]['code']===0x1f4){logger[_0xfba6('0x15')](_0xfba6('0x11'),_0x29113c,_0xaa742[_0xfba6('0x15')][_0xfba6('0x16')]);return _0x1ae7ea(_0xaa742[_0xfba6('0x15')][_0xfba6('0x16')]);}logger['error'](_0xfba6('0x11'),_0x29113c,_0xaa742['error'][_0xfba6('0x16')]);return _0x207098(_0xaa742['error']['message']);}else{logger[_0xfba6('0x10')]('WhatsappMessage,\x20%s,\x20%s',_0x29113c,_0xfba6('0x17'));_0x207098(_0xaa742[_0xfba6('0x18')][_0xfba6('0x16')]);}})[_0xfba6('0x19')](function(_0x573331){logger[_0xfba6('0x15')](_0xfba6('0x11'),_0x29113c,_0x573331);_0x1ae7ea(_0x573331);});});}exports[_0xfba6('0x1a')]=function(_0x56f28a){var _0x5bd77a=this;return new Promise(function(_0x41cd1e,_0x1aa4f0){return db['WhatsappMessage'][_0xfba6('0x1b')](_0x56f28a['body'],{'raw':_0x56f28a[_0xfba6('0x1c')]?_0x56f28a[_0xfba6('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0xfba6('0xf')](function(_0x4e905f){logger[_0xfba6('0x10')]('CreateWhatsappMessage',_0x56f28a);logger[_0xfba6('0x12')]('CreateWhatsappMessage',_0x56f28a,JSON[_0xfba6('0x14')](_0x4e905f));_0x41cd1e(_0x4e905f);})[_0xfba6('0x19')](function(_0x40caaa){logger[_0xfba6('0x15')]('CreateWhatsappMessage',_0x40caaa[_0xfba6('0x16')],_0x56f28a);_0x1aa4f0(_0x5bd77a['error'](0x1f4,_0x40caaa['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 420ea5a..b818c5b 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 _0x87b6=['save','removeListener','register','length'];(function(_0x5400b,_0x55943a){var _0x36a39b=function(_0x56963c){while(--_0x56963c){_0x5400b['push'](_0x5400b['shift']());}};_0x36a39b(++_0x55943a);}(_0x87b6,0x1f0));var _0x687b=function(_0x33ca61,_0x26bebe){_0x33ca61=_0x33ca61-0x0;var _0x2aa545=_0x87b6[_0x33ca61];return _0x2aa545;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=[_0x687b('0x0'),'remove','update'];function createListener(_0x91cd4b,_0x25a9c4){return function(_0x2eab9a){_0x25a9c4['emit'](_0x91cd4b,_0x2eab9a);};}function removeListener(_0x495190,_0x291439){return function(){WhatsappMessageEvents[_0x687b('0x1')](_0x495190,_0x291439);};}exports[_0x687b('0x2')]=function(_0x2fb814){for(var _0x2990cd=0x0,_0x32a03e=events[_0x687b('0x3')];_0x2990cd<_0x32a03e;_0x2990cd++){var _0x2d1426=events[_0x2990cd];var _0x45f003=createListener('whatsappMessage:'+_0x2d1426,_0x2fb814);WhatsappMessageEvents['on'](_0x2d1426,_0x45f003);}}; \ No newline at end of file +var _0xaad2=['length','save','remove','emit','removeListener','register'];(function(_0x46ff2a,_0x4820de){var _0x1e75a1=function(_0x2e0b5b){while(--_0x2e0b5b){_0x46ff2a['push'](_0x46ff2a['shift']());}};_0x1e75a1(++_0x4820de);}(_0xaad2,0x1a5));var _0x2aad=function(_0x455150,_0x274121){_0x455150=_0x455150-0x0;var _0x12ca9c=_0xaad2[_0x455150];return _0x12ca9c;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=[_0x2aad('0x0'),_0x2aad('0x1'),'update'];function createListener(_0x40fc44,_0x111394){return function(_0x330498){_0x111394[_0x2aad('0x2')](_0x40fc44,_0x330498);};}function removeListener(_0x47c3b6,_0x54fe60){return function(){WhatsappMessageEvents[_0x2aad('0x3')](_0x47c3b6,_0x54fe60);};}exports[_0x2aad('0x4')]=function(_0x355e81){for(var _0x28a1ec=0x0,_0x5e67c3=events[_0x2aad('0x5')];_0x28a1ec<_0x5e67c3;_0x28a1ec++){var _0x38996f=events[_0x28a1ec];var _0x109ec1=createListener('whatsappMessage:'+_0x38996f,_0x355e81);WhatsappMessageEvents['on'](_0x38996f,_0x109ec1);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 787426c..c71fd60 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 _0x311d=['show','getMembers','/:id/teams','/:id/users','post','create','addTeams','addAgents','put','update','destroy','delete','exports','multer','util','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappQueue.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x3db7ac,_0x4b9b9c){var _0x390337=function(_0x1df948){while(--_0x1df948){_0x3db7ac['push'](_0x3db7ac['shift']());}};_0x390337(++_0x4b9b9c);}(_0x311d,0x120));var _0xd311=function(_0x2ea691,_0x1fb4c3){_0x2ea691=_0x2ea691-0x0;var _0x51d176=_0x311d[_0x2ea691];return _0x51d176;};'use strict';var multer=require(_0xd311('0x0'));var util=require(_0xd311('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xd311('0x2'));var auth=require(_0xd311('0x3'));var interaction=require(_0xd311('0x4'));var config=require('../../config/environment');var controller=require(_0xd311('0x5'));router[_0xd311('0x6')]('/',auth[_0xd311('0x7')](),controller[_0xd311('0x8')]);router[_0xd311('0x6')](_0xd311('0x9'),auth[_0xd311('0x7')](),controller[_0xd311('0xa')]);router['get'](_0xd311('0xb'),auth[_0xd311('0x7')](),controller[_0xd311('0xc')]);router[_0xd311('0x6')]('/:id/members',auth[_0xd311('0x7')](),controller[_0xd311('0xd')]);router[_0xd311('0x6')](_0xd311('0xe'),auth[_0xd311('0x7')](),controller['getTeams']);router['get'](_0xd311('0xf'),auth[_0xd311('0x7')](),controller['getAgents']);router[_0xd311('0x10')]('/',auth[_0xd311('0x7')](),controller[_0xd311('0x11')]);router[_0xd311('0x10')]('/:id/teams',auth['isAuthenticated'](),controller[_0xd311('0x12')]);router[_0xd311('0x10')](_0xd311('0xf'),auth[_0xd311('0x7')](),controller[_0xd311('0x13')]);router[_0xd311('0x14')]('/:id',auth[_0xd311('0x7')](),controller[_0xd311('0x15')]);router['delete'](_0xd311('0xb'),auth[_0xd311('0x7')](),controller[_0xd311('0x16')]);router[_0xd311('0x17')]('/:id/teams',auth[_0xd311('0x7')](),controller['removeTeams']);router[_0xd311('0x17')]('/:id/users',auth[_0xd311('0x7')](),controller['removeAgents']);module[_0xd311('0x18')]=router; \ No newline at end of file +var _0xa1f5=['../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','isAuthenticated','index','/describe','describe','get','/:id','show','/:id/members','getMembers','getTeams','post','/:id/teams','addTeams','/:id/users','addAgents','update','delete','destroy','removeTeams','multer','util','connect-timeout','express','Router'];(function(_0x35ccde,_0xbe027){var _0xbd6110=function(_0xba7aea){while(--_0xba7aea){_0x35ccde['push'](_0x35ccde['shift']());}};_0xbd6110(++_0xbe027);}(_0xa1f5,0x14b));var _0x5a1f=function(_0xa45c52,_0xc77982){_0xa45c52=_0xa45c52-0x0;var _0x2f6c50=_0xa1f5[_0xa45c52];return _0x2f6c50;};'use strict';var multer=require(_0x5a1f('0x0'));var util=require(_0x5a1f('0x1'));var path=require('path');var timeout=require(_0x5a1f('0x2'));var express=require(_0x5a1f('0x3'));var router=express[_0x5a1f('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x5a1f('0x5'));var interaction=require(_0x5a1f('0x6'));var config=require(_0x5a1f('0x7'));var controller=require(_0x5a1f('0x8'));router['get']('/',auth[_0x5a1f('0x9')](),controller[_0x5a1f('0xa')]);router['get'](_0x5a1f('0xb'),auth[_0x5a1f('0x9')](),controller[_0x5a1f('0xc')]);router[_0x5a1f('0xd')](_0x5a1f('0xe'),auth[_0x5a1f('0x9')](),controller[_0x5a1f('0xf')]);router[_0x5a1f('0xd')](_0x5a1f('0x10'),auth[_0x5a1f('0x9')](),controller[_0x5a1f('0x11')]);router[_0x5a1f('0xd')]('/:id/teams',auth['isAuthenticated'](),controller[_0x5a1f('0x12')]);router[_0x5a1f('0xd')]('/:id/users',auth[_0x5a1f('0x9')](),controller['getAgents']);router[_0x5a1f('0x13')]('/',auth[_0x5a1f('0x9')](),controller['create']);router[_0x5a1f('0x13')](_0x5a1f('0x14'),auth['isAuthenticated'](),controller[_0x5a1f('0x15')]);router[_0x5a1f('0x13')](_0x5a1f('0x16'),auth[_0x5a1f('0x9')](),controller[_0x5a1f('0x17')]);router['put'](_0x5a1f('0xe'),auth[_0x5a1f('0x9')](),controller[_0x5a1f('0x18')]);router[_0x5a1f('0x19')](_0x5a1f('0xe'),auth[_0x5a1f('0x9')](),controller[_0x5a1f('0x1a')]);router['delete'](_0x5a1f('0x14'),auth[_0x5a1f('0x9')](),controller[_0x5a1f('0x1b')]);router[_0x5a1f('0x19')](_0x5a1f('0x16'),auth[_0x5a1f('0x9')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 3eeb466..e318ecb 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 _0xd66c=['ENUM','beepall','roundrobin','sequelize','STRING','name','INTEGER'];(function(_0x244c88,_0x4c864d){var _0x598140=function(_0x1cf528){while(--_0x1cf528){_0x244c88['push'](_0x244c88['shift']());}};_0x598140(++_0x4c864d);}(_0xd66c,0x106));var _0xcd66=function(_0x211285,_0x42c9d4){_0x211285=_0x211285-0x0;var _0x14a40c=_0xd66c[_0x211285];return _0x14a40c;};'use strict';var Sequelize=require(_0xcd66('0x0'));module['exports']={'name':{'type':Sequelize[_0xcd66('0x1')],'unique':_0xcd66('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xcd66('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xcd66('0x4')]('rrmemory',_0xcd66('0x5'),_0xcd66('0x6'))},'description':{'type':Sequelize[_0xcd66('0x1')]}}; \ No newline at end of file +var _0x8b7c=['beepall','sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x8b7c,0x119));var _0xc8b7=function(_0x54a9b9,_0x31352f){_0x54a9b9=_0x54a9b9-0x0;var _0x2a34ef=_0x8b7c[_0x54a9b9];return _0x2a34ef;};'use strict';var Sequelize=require(_0xc8b7('0x0'));module[_0xc8b7('0x1')]={'name':{'type':Sequelize[_0xc8b7('0x2')],'unique':_0xc8b7('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xc8b7('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xc8b7('0x5')](_0xc8b7('0x6'),_0xc8b7('0x7'),'roundrobin')},'description':{'type':Sequelize[_0xc8b7('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 3ed0c23..01a2ed6 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 _0x8981=['length','order','WhatsappQueueId','UserWhatsappQueue','User','findAndCountAll','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','nolimit','ids','Agents','online','interface','sequelize','transaction','addTeams','findOrCreate','forEach','userWhatsappQueue:save','removeTeams','select','field','tq.TeamId','join','user_has_teams','WhatsappQueueId\x20=\x20?','clone','toString','SELECT','every','TeamId','all','union','compact','value','isEmpty','removeAgents','emit','omit','isArray','userWhatsappQueue:remove','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','fs-extra','lodash','squel','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','get','error','name','send','index','map','WhatsappQueue','fieldName','type','key','query','filters','intersection','model','fields','attributes','hasOwnProperty','sort','where','pick','merge','filter','includeAll','findAll','catch','show','keys','rawAttributes','include','options','find','create','body','user','WhatsappQueues','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0x8981,0x135));var _0x1898=function(_0x17912c,_0x4cd917){_0x17912c=_0x17912c-0x0;var _0x5bd368=_0x8981[_0x17912c];return _0x5bd368;};'use strict';var emlformat=require(_0x1898('0x0'));var rimraf=require(_0x1898('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1898('0x2'));var rp=require(_0x1898('0x3'));var moment=require(_0x1898('0x4'));var BPromise=require(_0x1898('0x5'));var Mustache=require(_0x1898('0x6'));var util=require(_0x1898('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1898('0x8'));var fs=require('fs');var fs_extra=require(_0x1898('0x9'));var _=require(_0x1898('0xa'));var squel=require(_0x1898('0xb'));var crypto=require('crypto');var jsforce=require(_0x1898('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x1898('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1898('0xe'));var qs=require(_0x1898('0xf'));var as=require(_0x1898('0x10'));var hardwareService=require(_0x1898('0x11'));var logger=require(_0x1898('0x12'))(_0x1898('0x13'));var utils=require(_0x1898('0x14'));var config=require(_0x1898('0x15'));var licenseUtil=require(_0x1898('0x16'));var db=require('../../mysqldb')['db'];config[_0x1898('0x17')]=_['defaults'](config[_0x1898('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x1898('0x18'))(new Redis(config[_0x1898('0x17')]));require('./whatsappQueue.socket')[_0x1898('0x19')](socket);function respondWithStatusCode(_0x510a05,_0x3e6ad6){_0x3e6ad6=_0x3e6ad6||0xcc;return function(_0x155199){if(_0x155199){return _0x510a05[_0x1898('0x1a')](_0x3e6ad6);}return _0x510a05[_0x1898('0x1b')](_0x3e6ad6)[_0x1898('0x1c')]();};}function respondWithResult(_0x2bdcfb,_0x31a29d){_0x31a29d=_0x31a29d||0xc8;return function(_0x4cc9f4){if(_0x4cc9f4){return _0x2bdcfb['status'](_0x31a29d)[_0x1898('0x1d')](_0x4cc9f4);}};}function respondWithFilteredResult(_0x2358c1,_0x23b231){return function(_0x300e27){if(_0x300e27){var _0x1cd1ae=typeof _0x23b231[_0x1898('0x1e')]===_0x1898('0x1f')&&typeof _0x23b231[_0x1898('0x20')]===_0x1898('0x1f');var _0x2ff8a8=_0x300e27[_0x1898('0x21')];var _0x2ff918=_0x1cd1ae?0x0:_0x23b231[_0x1898('0x1e')];var _0x2dedb5=_0x1cd1ae?_0x300e27[_0x1898('0x21')]:_0x23b231[_0x1898('0x1e')]+_0x23b231['limit'];var _0x20d2b4;if(_0x2dedb5>=_0x2ff8a8){_0x2dedb5=_0x2ff8a8;_0x20d2b4=0xc8;}else{_0x20d2b4=0xce;}_0x2358c1[_0x1898('0x1b')](_0x20d2b4);return _0x2358c1[_0x1898('0x22')]('Content-Range',_0x2ff918+'-'+_0x2dedb5+'/'+_0x2ff8a8)[_0x1898('0x1d')](_0x300e27);}return null;};}function patchUpdates(_0x4721ce){return function(_0x35e8ea){try{jsonpatch[_0x1898('0x23')](_0x35e8ea,_0x4721ce,!![]);}catch(_0x5ab5c8){return BPromise[_0x1898('0x24')](_0x5ab5c8);}return _0x35e8ea[_0x1898('0x25')]();};}function saveUpdates(_0x449a86,_0xc691aa){return function(_0x3b5f88){if(_0x3b5f88){return _0x3b5f88[_0x1898('0x26')](_0x449a86)['then'](function(_0x560eb5){return _0x560eb5;});}return null;};}function removeEntity(_0x45c589,_0x4cfdaf){return function(_0x1a3453){if(_0x1a3453){return _0x1a3453[_0x1898('0x27')]()[_0x1898('0x28')](function(){var _0x53e3de=_0x1a3453[_0x1898('0x29')]({'plain':!![]});var _0x52c3f9='WhatsappQueues';return db['UserProfileResource'][_0x1898('0x27')]({'where':{'type':_0x52c3f9,'resourceId':_0x53e3de['id']}})[_0x1898('0x28')](function(){return _0x1a3453;});})[_0x1898('0x28')](function(){_0x45c589[_0x1898('0x1b')](0xcc)[_0x1898('0x1c')]();});}};}function handleEntityNotFound(_0x407fa0,_0x3e63b4){return function(_0x1c1388){if(!_0x1c1388){_0x407fa0['sendStatus'](0x194);}return _0x1c1388;};}function handleError(_0x4915a0,_0x3da57f){_0x3da57f=_0x3da57f||0x1f4;return function(_0x41a812){logger[_0x1898('0x2a')](_0x41a812['stack']);if(_0x41a812[_0x1898('0x2b')]){delete _0x41a812[_0x1898('0x2b')];}_0x4915a0[_0x1898('0x1b')](_0x3da57f)[_0x1898('0x2c')](_0x41a812);};}exports[_0x1898('0x2d')]=function(_0x21e644,_0x4c9f79){var _0x166929={},_0x225645={},_0x4c10ac={'count':0x0,'rows':[]};var _0x183aa3=_[_0x1898('0x2e')](db[_0x1898('0x2f')]['rawAttributes'],function(_0x17401b){return{'name':_0x17401b[_0x1898('0x30')],'type':_0x17401b[_0x1898('0x31')][_0x1898('0x32')]};});_0x225645['model']=_[_0x1898('0x2e')](_0x183aa3,_0x1898('0x2b'));_0x225645[_0x1898('0x33')]=_['keys'](_0x21e644['query']);_0x225645[_0x1898('0x34')]=_[_0x1898('0x35')](_0x225645['model'],_0x225645['query']);_0x166929['attributes']=_[_0x1898('0x35')](_0x225645[_0x1898('0x36')],qs[_0x1898('0x37')](_0x21e644[_0x1898('0x33')]['fields']));_0x166929['attributes']=_0x166929[_0x1898('0x38')]['length']?_0x166929[_0x1898('0x38')]:_0x225645[_0x1898('0x36')];if(!_0x21e644[_0x1898('0x33')][_0x1898('0x39')]('nolimit')){_0x166929[_0x1898('0x20')]=qs['limit'](_0x21e644[_0x1898('0x33')][_0x1898('0x20')]);_0x166929[_0x1898('0x1e')]=qs[_0x1898('0x1e')](_0x21e644[_0x1898('0x33')]['offset']);}_0x166929['order']=qs[_0x1898('0x3a')](_0x21e644['query'][_0x1898('0x3a')]);_0x166929[_0x1898('0x3b')]=qs['filters'](_[_0x1898('0x3c')](_0x21e644[_0x1898('0x33')],_0x225645[_0x1898('0x34')]),_0x183aa3);if(_0x21e644['query']['filter']){_0x166929[_0x1898('0x3b')]=_[_0x1898('0x3d')](_0x166929[_0x1898('0x3b')],{'$or':_[_0x1898('0x2e')](_0x183aa3,function(_0x298ca6){if(_0x298ca6[_0x1898('0x31')]!=='VIRTUAL'){var _0x234e39={};_0x234e39[_0x298ca6[_0x1898('0x2b')]]={'$like':'%'+_0x21e644['query'][_0x1898('0x3e')]+'%'};return _0x234e39;}})});}_0x166929=_[_0x1898('0x3d')]({},_0x166929,_0x21e644['options']);var _0x42ad76={'where':_0x166929[_0x1898('0x3b')]};return db['WhatsappQueue'][_0x1898('0x21')](_0x42ad76)['then'](function(_0x20a82f){_0x4c10ac['count']=_0x20a82f;if(_0x21e644[_0x1898('0x33')][_0x1898('0x3f')]){_0x166929['include']=[{'all':!![]}];}return db[_0x1898('0x2f')][_0x1898('0x40')](_0x166929);})['then'](function(_0x31fc8a){_0x4c10ac['rows']=_0x31fc8a;return _0x4c10ac;})['then'](respondWithFilteredResult(_0x4c9f79,_0x166929))[_0x1898('0x41')](handleError(_0x4c9f79,null));};exports[_0x1898('0x42')]=function(_0x3169eb,_0x198703){var _0x1a3329={'raw':!![],'where':{'id':_0x3169eb['params']['id']}},_0x489ceb={};_0x489ceb['model']=_[_0x1898('0x43')](db[_0x1898('0x2f')][_0x1898('0x44')]);_0x489ceb[_0x1898('0x33')]=_[_0x1898('0x43')](_0x3169eb[_0x1898('0x33')]);_0x489ceb['filters']=_[_0x1898('0x35')](_0x489ceb[_0x1898('0x36')],_0x489ceb[_0x1898('0x33')]);_0x1a3329[_0x1898('0x38')]=_[_0x1898('0x35')](_0x489ceb[_0x1898('0x36')],qs[_0x1898('0x37')](_0x3169eb['query'][_0x1898('0x37')]));_0x1a3329[_0x1898('0x38')]=_0x1a3329['attributes']['length']?_0x1a3329[_0x1898('0x38')]:_0x489ceb['model'];if(_0x3169eb['query'][_0x1898('0x3f')]){_0x1a3329[_0x1898('0x45')]=[{'all':!![]}];}_0x1a3329=_['merge']({},_0x1a3329,_0x3169eb[_0x1898('0x46')]);return db[_0x1898('0x2f')][_0x1898('0x47')](_0x1a3329)[_0x1898('0x28')](handleEntityNotFound(_0x198703,null))[_0x1898('0x28')](respondWithResult(_0x198703,null))[_0x1898('0x41')](handleError(_0x198703,null));};exports['create']=function(_0x2e32c3,_0x26f541){return db['WhatsappQueue'][_0x1898('0x48')](_0x2e32c3[_0x1898('0x49')],{})['then'](function(_0xa5bc0b){var _0x5a9141=_0x2e32c3['user'][_0x1898('0x29')]({'plain':!![]});if(!_0x5a9141)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5a9141['role']===_0x1898('0x4a')){var _0x22dccf=_0xa5bc0b[_0x1898('0x29')]({'plain':!![]});var _0x424cc2=_0x1898('0x4b');return db[_0x1898('0x4c')][_0x1898('0x47')]({'where':{'name':_0x424cc2,'userProfileId':_0x5a9141[_0x1898('0x4d')]},'raw':!![]})['then'](function(_0x4156e2){if(_0x4156e2&&_0x4156e2['autoAssociation']===0x0){return db[_0x1898('0x4e')][_0x1898('0x48')]({'name':_0x22dccf[_0x1898('0x2b')],'resourceId':_0x22dccf['id'],'type':_0x4156e2[_0x1898('0x2b')],'sectionId':_0x4156e2['id']},{})[_0x1898('0x28')](function(){return _0xa5bc0b;});}else{return _0xa5bc0b;}})[_0x1898('0x41')](function(_0x5dd5d9){logger[_0x1898('0x2a')](_0x1898('0x4f'),_0x5dd5d9);throw _0x5dd5d9;});}return _0xa5bc0b;})[_0x1898('0x28')](respondWithResult(_0x26f541,0xc9))[_0x1898('0x41')](handleError(_0x26f541,null));};exports[_0x1898('0x26')]=function(_0xc54aaa,_0x176852){if(_0xc54aaa[_0x1898('0x49')]['id']){delete _0xc54aaa[_0x1898('0x49')]['id'];}return db[_0x1898('0x2f')]['find']({'where':{'id':_0xc54aaa['params']['id']}})[_0x1898('0x28')](handleEntityNotFound(_0x176852,null))[_0x1898('0x28')](saveUpdates(_0xc54aaa[_0x1898('0x49')],null))[_0x1898('0x28')](respondWithResult(_0x176852,null))[_0x1898('0x41')](handleError(_0x176852,null));};exports['destroy']=function(_0x50b955,_0x9851a9){return db[_0x1898('0x2f')][_0x1898('0x47')]({'where':{'id':_0x50b955[_0x1898('0x50')]['id']}})[_0x1898('0x28')](handleEntityNotFound(_0x9851a9,null))['then'](removeEntity(_0x9851a9,null))['catch'](handleError(_0x9851a9,null));};exports[_0x1898('0x51')]=function(_0x4177a2,_0x5ea4ca){return db[_0x1898('0x2f')]['describe']()['then'](respondWithResult(_0x5ea4ca,null))[_0x1898('0x41')](handleError(_0x5ea4ca,null));};exports[_0x1898('0x52')]=function(_0x57401c,_0x93bc7b,_0x58feb5){var _0x45be15={'raw':!![],'where':{}},_0x2b65b3={},_0x19c64f;return db[_0x1898('0x2f')][_0x1898('0x53')]({'where':{'id':_0x57401c[_0x1898('0x50')]['id']}})[_0x1898('0x28')](handleEntityNotFound(_0x93bc7b,null))[_0x1898('0x28')](function(_0x50063c){if(_0x50063c){_0x19c64f=_0x50063c['get']({'plain':!![]});_0x2b65b3['model']=_[_0x1898('0x43')](db['UserWhatsappQueue'][_0x1898('0x44')]);_0x2b65b3['query']=_[_0x1898('0x43')](_0x57401c[_0x1898('0x33')]);_0x2b65b3[_0x1898('0x34')]=_[_0x1898('0x35')](_0x2b65b3['model'],_0x2b65b3[_0x1898('0x33')]);_0x45be15[_0x1898('0x38')]=_['intersection'](_0x2b65b3[_0x1898('0x36')],qs[_0x1898('0x37')](_0x57401c[_0x1898('0x33')][_0x1898('0x37')]));_0x45be15['attributes']=_0x45be15[_0x1898('0x38')][_0x1898('0x54')]?_0x45be15['attributes']:_0x2b65b3[_0x1898('0x36')];if(!_0x57401c[_0x1898('0x33')][_0x1898('0x39')]('nolimit')){_0x45be15[_0x1898('0x20')]=qs[_0x1898('0x20')](_0x57401c[_0x1898('0x33')][_0x1898('0x20')]);_0x45be15[_0x1898('0x1e')]=qs[_0x1898('0x1e')](_0x57401c[_0x1898('0x33')][_0x1898('0x1e')]);}_0x45be15[_0x1898('0x55')]=qs[_0x1898('0x3a')](_0x57401c[_0x1898('0x33')][_0x1898('0x3a')]);_0x45be15['where']=qs[_0x1898('0x34')](_['pick'](_0x57401c[_0x1898('0x33')],_0x2b65b3['filters']));_0x45be15[_0x1898('0x3b')][_0x1898('0x56')]=_0x50063c['id'];if(_0x57401c[_0x1898('0x33')][_0x1898('0x3e')]){_0x45be15[_0x1898('0x3b')]=_[_0x1898('0x3d')](_0x45be15['where'],{'$or':_[_0x1898('0x2e')](_0x45be15['attributes'],function(_0x184376){var _0x3f171b={};_0x3f171b[_0x184376]={'$like':'%'+_0x57401c[_0x1898('0x33')][_0x1898('0x3e')]+'%'};return _0x3f171b;})});}_0x45be15=_[_0x1898('0x3d')]({},_0x45be15,_0x57401c[_0x1898('0x46')]);return db[_0x1898('0x57')][_0x1898('0x40')](_0x45be15);}})[_0x1898('0x28')](function(_0xbf0163){if(_0xbf0163){return db[_0x1898('0x58')][_0x1898('0x59')]({'where':{'id':_['map'](_0xbf0163,'UserId'),'role':'agent'},'attributes':['id',_0x1898('0x2b'),'whatsappPause',_0x1898('0x5a'),_0x1898('0x5b')]});}})[_0x1898('0x28')](function(_0x5701af){if(_0x5701af){return{'count':_0x5701af['count'],'rows':_[_0x1898('0x2e')](_0x5701af['rows'],function(_0x22ce45){return{'membername':_0x22ce45['name'],'UserId':_0x22ce45['id'],'queue_name':_0x19c64f[_0x1898('0x2b')],'WhatsappQueueId':_0x19c64f['id'],'interface':util[_0x1898('0x5c')](_0x1898('0x5d'),_0x1898('0x5e'),_0x22ce45[_0x1898('0x2b')]),'penalty':0x0,'paused':_0x22ce45['whatsappPause'],'createdAt':_0x22ce45['createdAt'],'updatedAt':_0x22ce45[_0x1898('0x5a')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x1898('0x28')](respondWithFilteredResult(_0x93bc7b,_0x45be15))['catch'](handleError(_0x93bc7b,null));};exports[_0x1898('0x5f')]=function(_0x56f57b,_0x55716e,_0x231dfa){var _0x509fd5={};var _0x5a36e9={};var _0xbad338;var _0x46a5ad;return db['WhatsappQueue']['findOne']({'where':{'id':_0x56f57b[_0x1898('0x50')]['id']}})[_0x1898('0x28')](handleEntityNotFound(_0x55716e,null))['then'](function(_0x120c48){if(_0x120c48){_0xbad338=_0x120c48;_0x5a36e9[_0x1898('0x36')]=_[_0x1898('0x43')](db[_0x1898('0x60')][_0x1898('0x44')]);_0x5a36e9['query']=_[_0x1898('0x43')](_0x56f57b[_0x1898('0x33')]);_0x5a36e9[_0x1898('0x34')]=_[_0x1898('0x35')](_0x5a36e9[_0x1898('0x36')],_0x5a36e9[_0x1898('0x33')]);_0x509fd5[_0x1898('0x38')]=_[_0x1898('0x35')](_0x5a36e9[_0x1898('0x36')],qs[_0x1898('0x37')](_0x56f57b['query'][_0x1898('0x37')]));_0x509fd5[_0x1898('0x38')]=_0x509fd5[_0x1898('0x38')][_0x1898('0x54')]?_0x509fd5[_0x1898('0x38')]:_0x5a36e9[_0x1898('0x36')];_0x509fd5[_0x1898('0x55')]=qs[_0x1898('0x3a')](_0x56f57b[_0x1898('0x33')]['sort']);_0x509fd5[_0x1898('0x3b')]=qs['filters'](_[_0x1898('0x3c')](_0x56f57b[_0x1898('0x33')],_0x5a36e9[_0x1898('0x34')]));if(_0x56f57b[_0x1898('0x33')]['filter']){_0x509fd5[_0x1898('0x3b')]=_[_0x1898('0x3d')](_0x509fd5['where'],{'$or':_[_0x1898('0x2e')](_0x509fd5[_0x1898('0x38')],function(_0x578836){var _0x1e98f2={};_0x1e98f2[_0x578836]={'$like':'%'+_0x56f57b[_0x1898('0x33')][_0x1898('0x3e')]+'%'};return _0x1e98f2;})});}_0x509fd5=_[_0x1898('0x3d')]({},_0x509fd5,_0x56f57b['options']);return _0xbad338[_0x1898('0x5f')](_0x509fd5);}})[_0x1898('0x28')](function(_0x444e1d){if(_0x444e1d){_0x46a5ad=_0x444e1d['length'];if(!_0x56f57b[_0x1898('0x33')]['hasOwnProperty'](_0x1898('0x61'))){_0x509fd5[_0x1898('0x20')]=qs['limit'](_0x56f57b['query'][_0x1898('0x20')]);_0x509fd5['offset']=qs[_0x1898('0x1e')](_0x56f57b['query'][_0x1898('0x1e')]);}return _0xbad338[_0x1898('0x5f')](_0x509fd5);}})[_0x1898('0x28')](function(_0x520e6b){if(_0x520e6b){return _0x520e6b?{'count':_0x46a5ad,'rows':_0x520e6b}:null;}})[_0x1898('0x28')](respondWithResult(_0x55716e,null))[_0x1898('0x41')](handleError(_0x55716e,null));};exports['addTeams']=function(_0x15c8f0,_0x346c4c,_0x2bdf2e){var _0x489193=_0x15c8f0[_0x1898('0x49')][_0x1898('0x62')];return db[_0x1898('0x60')][_0x1898('0x40')]({'where':{'id':_0x489193},'attributes':['id'],'include':[{'model':db['User'],'as':_0x1898('0x63'),'attributes':['id','name',_0x1898('0x64'),'voicePause',_0x1898('0x65')],'raw':!![]}]})['then'](function(_0x994033){if(_0x994033){var _0x3aa7bf=_['flatMap'](_0x994033,function(_0x5e4a82){var _0xcf7b6f=_0x5e4a82['get']({'plain':!![]});return _0xcf7b6f[_0x1898('0x63')];});return db[_0x1898('0x2f')][_0x1898('0x47')]({'where':{'id':_0x15c8f0[_0x1898('0x50')]['id']}})[_0x1898('0x28')](function(_0x1b4e49){return db[_0x1898('0x66')][_0x1898('0x67')](function(_0xcf518a){return _0x1b4e49[_0x1898('0x68')](_0x489193,{'transaction':_0xcf518a})['then'](function(){return BPromise['each'](_0x3aa7bf,function(_0x351ad2){return db[_0x1898('0x57')][_0x1898('0x69')]({'where':{'UserId':_0x351ad2['id'],'WhatsappQueueId':_0x15c8f0[_0x1898('0x50')]['id']},'transaction':_0xcf518a});});})['then'](function(){_0x3aa7bf[_0x1898('0x6a')](function(_0x3dd699){socket['emit'](_0x1898('0x6b'),{'UserId':_0x3dd699['id'],'WhatsappQueueId':_0x1b4e49['id']});});});});});}})[_0x1898('0x28')](respondWithStatusCode(_0x346c4c,null))[_0x1898('0x41')](handleError(_0x346c4c,null));};exports[_0x1898('0x6c')]=function(_0x42a8e7,_0x477902,_0x426953){return db['Team'][_0x1898('0x40')]({'where':{'id':_0x42a8e7[_0x1898('0x33')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x1898('0x63'),'attributes':['id'],'raw':!![]}]})[_0x1898('0x28')](handleEntityNotFound(_0x477902,null))[_0x1898('0x28')](function(_0x114e5c){var _0x33db15=_['map'](_0x114e5c,'id');var _0x5dbeb4=[];var _0x45b7ce=[];var _0x13052a=squel[_0x1898('0x6d')]();_0x13052a[_0x1898('0x6e')](_0x1898('0x6f'))['from']('team_has_whatsapp_queues','tq')[_0x1898('0x70')](_0x1898('0x71'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x1898('0x3b')](_0x1898('0x72'),_0x42a8e7[_0x1898('0x50')]['id']);for(var _0x252cb6=0x0;_0x252cb6<_0x114e5c[_0x1898('0x54')];_0x252cb6+=0x1){let _0x52dac7=_0x114e5c[_0x252cb6];for(var _0xcdcba8=0x0;_0xcdcba8<_0x52dac7[_0x1898('0x63')]['length'];_0xcdcba8+=0x1){let _0x386626=_0x52dac7[_0x1898('0x63')][_0xcdcba8];var _0x19c417=_0x13052a[_0x1898('0x73')]();_0x19c417[_0x1898('0x3b')]('ut.UserId\x20=\x20?',_0x386626['id']);_0x45b7ce['push'](db[_0x1898('0x66')]['query'](_0x19c417[_0x1898('0x74')](),{'type':db[_0x1898('0x66')]['QueryTypes'][_0x1898('0x75')]})['then'](function(_0x39e2e5){if(_0x39e2e5[_0x1898('0x54')]===0x1){return _0x386626['id'];}else{var _0x322f13=_[_0x1898('0x76')](_[_0x1898('0x2e')](_0x39e2e5,_0x1898('0x77')),function(_0x492456){return _['includes'](_0x33db15,_0x492456);});if(_0x322f13){return _0x386626['id'];}}}));}}return BPromise[_0x1898('0x78')](_0x45b7ce)[_0x1898('0x28')](function(_0x39faea){_0x5dbeb4=_(_0x5dbeb4)[_0x1898('0x79')](_0x39faea)[_0x1898('0x7a')]()[_0x1898('0x7b')]();return db['WhatsappQueue'][_0x1898('0x47')]({'where':{'id':_0x42a8e7['params']['id']}})[_0x1898('0x28')](function(_0x3dd063){return db[_0x1898('0x66')][_0x1898('0x67')](function(_0x3d6cc5){return _0x3dd063[_0x1898('0x6c')](_0x42a8e7[_0x1898('0x33')][_0x1898('0x62')],{'transaction':_0x3d6cc5})[_0x1898('0x28')](function(){if(!_[_0x1898('0x7c')](_0x5dbeb4)){return _0x3dd063[_0x1898('0x7d')](_0x5dbeb4,{'transaction':_0x3d6cc5});}})['then'](function(){_0x5dbeb4[_0x1898('0x6a')](function(_0x4eb2b3){socket[_0x1898('0x7e')]('userWhatsappQueue:remove',{'UserId':_0x4eb2b3,'WhatsappQueueId':_0x3dd063['id']});});});});});});})[_0x1898('0x28')](respondWithStatusCode(_0x477902,null))[_0x1898('0x41')](handleError(_0x477902,null));};exports['addAgents']=function(_0x5582dc,_0x42198d,_0x1e81ef){return db[_0x1898('0x2f')]['find']({'where':{'id':_0x5582dc[_0x1898('0x50')]['id']}})[_0x1898('0x28')](handleEntityNotFound(_0x42198d,null))[_0x1898('0x28')](function(_0x4c155b){if(_0x4c155b){return _0x4c155b['addAgents'](_0x5582dc[_0x1898('0x49')][_0x1898('0x62')],_[_0x1898('0x7f')](_0x5582dc[_0x1898('0x49')],['ids','id'])||{})['spread'](function(_0x52f66d){for(var _0x51cae5=0x0;_0x51cae5<_0x5582dc[_0x1898('0x49')][_0x1898('0x62')][_0x1898('0x54')];_0x51cae5+=0x1){socket[_0x1898('0x7e')](_0x1898('0x6b'),{'UserId':Number(_0x5582dc['body'][_0x1898('0x62')][_0x51cae5]),'WhatsappQueueId':Number(_0x5582dc[_0x1898('0x50')]['id'])});}return _0x52f66d;});}})[_0x1898('0x28')](respondWithResult(_0x42198d,null))['catch'](handleError(_0x42198d,null));};exports[_0x1898('0x7d')]=function(_0xaf1765,_0x31cc12,_0x5b8599){return db[_0x1898('0x2f')][_0x1898('0x47')]({'where':{'id':_0xaf1765['params']['id']}})[_0x1898('0x28')](handleEntityNotFound(_0x31cc12,null))[_0x1898('0x28')](function(_0x279751){if(_0x279751){return _0x279751['removeAgents'](_0xaf1765[_0x1898('0x33')][_0x1898('0x62')])[_0x1898('0x28')](function(){if(_[_0x1898('0x80')](_0xaf1765[_0x1898('0x33')][_0x1898('0x62')])){for(var _0x466183=0x0;_0x466183<_0xaf1765['query'][_0x1898('0x62')]['length'];_0x466183+=0x1){socket[_0x1898('0x7e')]('userWhatsappQueue:remove',{'UserId':Number(_0xaf1765['query'][_0x1898('0x62')][_0x466183]),'WhatsappQueueId':Number(_0xaf1765[_0x1898('0x50')]['id'])});}}else{socket[_0x1898('0x7e')](_0x1898('0x81'),{'UserId':Number(_0xaf1765[_0x1898('0x33')][_0x1898('0x62')]),'WhatsappQueueId':Number(_0xaf1765[_0x1898('0x50')]['id'])});}});}})[_0x1898('0x28')](respondWithStatusCode(_0x31cc12,null))['catch'](handleError(_0x31cc12,null));};exports[_0x1898('0x82')]=function(_0x1b6ed9,_0x45fb3e,_0x34cf66){var _0x28de95={};var _0xd1ab32={};var _0x148d17;var _0x3acadb;return db[_0x1898('0x2f')][_0x1898('0x53')]({'where':{'id':_0x1b6ed9[_0x1898('0x50')]['id']}})['then'](handleEntityNotFound(_0x45fb3e,null))[_0x1898('0x28')](function(_0x71b0be){if(_0x71b0be){_0x148d17=_0x71b0be;_0xd1ab32[_0x1898('0x36')]=_[_0x1898('0x43')](db[_0x1898('0x58')][_0x1898('0x44')]);_0xd1ab32[_0x1898('0x33')]=_['keys'](_0x1b6ed9[_0x1898('0x33')]);_0xd1ab32[_0x1898('0x34')]=_[_0x1898('0x35')](_0xd1ab32[_0x1898('0x36')],_0xd1ab32['query']);_0x28de95[_0x1898('0x38')]=_[_0x1898('0x35')](_0xd1ab32[_0x1898('0x36')],qs[_0x1898('0x37')](_0x1b6ed9[_0x1898('0x33')][_0x1898('0x37')]));_0x28de95[_0x1898('0x38')]=_0x28de95[_0x1898('0x38')][_0x1898('0x54')]?_0x28de95[_0x1898('0x38')]:_0xd1ab32[_0x1898('0x36')];_0x28de95[_0x1898('0x55')]=qs[_0x1898('0x3a')](_0x1b6ed9[_0x1898('0x33')][_0x1898('0x3a')]);_0x28de95[_0x1898('0x3b')]=qs[_0x1898('0x34')](_[_0x1898('0x3c')](_0x1b6ed9[_0x1898('0x33')],_0xd1ab32[_0x1898('0x34')]));if(_0x1b6ed9[_0x1898('0x33')][_0x1898('0x3e')]){_0x28de95[_0x1898('0x3b')]=_['merge'](_0x28de95[_0x1898('0x3b')],{'$or':_[_0x1898('0x2e')](_0x28de95[_0x1898('0x38')],function(_0x3afbeb){var _0x8e1de5={};_0x8e1de5[_0x3afbeb]={'$like':'%'+_0x1b6ed9['query'][_0x1898('0x3e')]+'%'};return _0x8e1de5;})});}_0x28de95=_[_0x1898('0x3d')]({},_0x28de95,_0x1b6ed9[_0x1898('0x46')]);return _0x148d17[_0x1898('0x82')](_0x28de95);}})[_0x1898('0x28')](function(_0x45da6d){if(_0x45da6d){_0x3acadb=_0x45da6d[_0x1898('0x54')];if(!_0x1b6ed9[_0x1898('0x33')][_0x1898('0x39')](_0x1898('0x61'))){_0x28de95[_0x1898('0x20')]=qs[_0x1898('0x20')](_0x1b6ed9['query']['limit']);_0x28de95[_0x1898('0x1e')]=qs[_0x1898('0x1e')](_0x1b6ed9[_0x1898('0x33')][_0x1898('0x1e')]);}return _0x148d17[_0x1898('0x82')](_0x28de95);}})[_0x1898('0x28')](function(_0x561084){if(_0x561084){return _0x561084?{'count':_0x3acadb,'rows':_0x561084}:null;}})[_0x1898('0x28')](respondWithResult(_0x45fb3e,null))['catch'](handleError(_0x45fb3e,null));}; \ No newline at end of file +var _0xb430=['findAll','User','findAndCountAll','UserId','agent','whatsappPause','updatedAt','createdAt','%s/%s','SIP','getTeams','ids','interface','flatMap','Agents','sequelize','transaction','addTeams','each','findOrCreate','forEach','userWhatsappQueue:save','removeTeams','select','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','union','compact','value','isEmpty','removeAgents','emit','userWhatsappQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./whatsappQueue.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','WhatsappQueues','UserProfileResource','destroy','error','stack','name','send','index','map','WhatsappQueue','rawAttributes','key','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','merge','filter','includeAll','include','rows','catch','params','options','find','create','body','user','get','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserWhatsappQueue','length','order','WhatsappQueueId'];(function(_0x270b71,_0x59e755){var _0x416c6e=function(_0x1055e9){while(--_0x1055e9){_0x270b71['push'](_0x270b71['shift']());}};_0x416c6e(++_0x59e755);}(_0xb430,0x143));var _0x0b43=function(_0x3e69ae,_0x366e8d){_0x3e69ae=_0x3e69ae-0x0;var _0x3d7f42=_0xb430[_0x3e69ae];return _0x3d7f42;};'use strict';var emlformat=require(_0x0b43('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0b43('0x1'));var BPromise=require(_0x0b43('0x2'));var Mustache=require(_0x0b43('0x3'));var util=require(_0x0b43('0x4'));var path=require(_0x0b43('0x5'));var sox=require(_0x0b43('0x6'));var csv=require(_0x0b43('0x7'));var ejs=require(_0x0b43('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0b43('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0b43('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0b43('0xb'));var Redis=require(_0x0b43('0xc'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0b43('0xd'));var hardwareService=require(_0x0b43('0xe'));var logger=require('../../config/logger')(_0x0b43('0xf'));var utils=require(_0x0b43('0x10'));var config=require(_0x0b43('0x11'));var licenseUtil=require(_0x0b43('0x12'));var db=require(_0x0b43('0x13'))['db'];config[_0x0b43('0x14')]=_[_0x0b43('0x15')](config['redis'],{'host':_0x0b43('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0b43('0x17'))[_0x0b43('0x18')](socket);function respondWithStatusCode(_0x1f0709,_0x5a0c60){_0x5a0c60=_0x5a0c60||0xcc;return function(_0x52defa){if(_0x52defa){return _0x1f0709[_0x0b43('0x19')](_0x5a0c60);}return _0x1f0709['status'](_0x5a0c60)[_0x0b43('0x1a')]();};}function respondWithResult(_0x1a7f14,_0x385ad3){_0x385ad3=_0x385ad3||0xc8;return function(_0x2b3f94){if(_0x2b3f94){return _0x1a7f14[_0x0b43('0x1b')](_0x385ad3)[_0x0b43('0x1c')](_0x2b3f94);}};}function respondWithFilteredResult(_0x3ea175,_0x4940c6){return function(_0x95de06){if(_0x95de06){var _0x4f1695=typeof _0x4940c6[_0x0b43('0x1d')]===_0x0b43('0x1e')&&typeof _0x4940c6[_0x0b43('0x1f')]===_0x0b43('0x1e');var _0x5a5cfe=_0x95de06['count'];var _0xa8bf78=_0x4f1695?0x0:_0x4940c6[_0x0b43('0x1d')];var _0xb458d7=_0x4f1695?_0x95de06[_0x0b43('0x20')]:_0x4940c6[_0x0b43('0x1d')]+_0x4940c6[_0x0b43('0x1f')];var _0x2b683e;if(_0xb458d7>=_0x5a5cfe){_0xb458d7=_0x5a5cfe;_0x2b683e=0xc8;}else{_0x2b683e=0xce;}_0x3ea175[_0x0b43('0x1b')](_0x2b683e);return _0x3ea175[_0x0b43('0x21')](_0x0b43('0x22'),_0xa8bf78+'-'+_0xb458d7+'/'+_0x5a5cfe)['json'](_0x95de06);}return null;};}function patchUpdates(_0x1d3fcf){return function(_0x25e0d4){try{jsonpatch['apply'](_0x25e0d4,_0x1d3fcf,!![]);}catch(_0x456273){return BPromise[_0x0b43('0x23')](_0x456273);}return _0x25e0d4[_0x0b43('0x24')]();};}function saveUpdates(_0xa5998d,_0x27c589){return function(_0x2e3b14){if(_0x2e3b14){return _0x2e3b14[_0x0b43('0x25')](_0xa5998d)[_0x0b43('0x26')](function(_0x5bab2e){return _0x5bab2e;});}return null;};}function removeEntity(_0x211fa2,_0x3750ed){return function(_0x4dc805){if(_0x4dc805){return _0x4dc805['destroy']()[_0x0b43('0x26')](function(){var _0x47ce42=_0x4dc805['get']({'plain':!![]});var _0x5c07ec=_0x0b43('0x27');return db[_0x0b43('0x28')][_0x0b43('0x29')]({'where':{'type':_0x5c07ec,'resourceId':_0x47ce42['id']}})[_0x0b43('0x26')](function(){return _0x4dc805;});})['then'](function(){_0x211fa2['status'](0xcc)[_0x0b43('0x1a')]();});}};}function handleEntityNotFound(_0x1c2c8d,_0x323399){return function(_0x4e7f47){if(!_0x4e7f47){_0x1c2c8d[_0x0b43('0x19')](0x194);}return _0x4e7f47;};}function handleError(_0x3eab1e,_0xf8aca1){_0xf8aca1=_0xf8aca1||0x1f4;return function(_0x4e2694){logger[_0x0b43('0x2a')](_0x4e2694[_0x0b43('0x2b')]);if(_0x4e2694[_0x0b43('0x2c')]){delete _0x4e2694[_0x0b43('0x2c')];}_0x3eab1e['status'](_0xf8aca1)[_0x0b43('0x2d')](_0x4e2694);};}exports[_0x0b43('0x2e')]=function(_0x22a1d1,_0x330fcf){var _0xd28776={},_0x3beb6={},_0x3444b6={'count':0x0,'rows':[]};var _0xb49a29=_[_0x0b43('0x2f')](db[_0x0b43('0x30')][_0x0b43('0x31')],function(_0x2d335d){return{'name':_0x2d335d['fieldName'],'type':_0x2d335d['type'][_0x0b43('0x32')]};});_0x3beb6[_0x0b43('0x33')]=_[_0x0b43('0x2f')](_0xb49a29,_0x0b43('0x2c'));_0x3beb6['query']=_[_0x0b43('0x34')](_0x22a1d1[_0x0b43('0x35')]);_0x3beb6[_0x0b43('0x36')]=_['intersection'](_0x3beb6[_0x0b43('0x33')],_0x3beb6['query']);_0xd28776[_0x0b43('0x37')]=_[_0x0b43('0x38')](_0x3beb6[_0x0b43('0x33')],qs[_0x0b43('0x39')](_0x22a1d1[_0x0b43('0x35')][_0x0b43('0x39')]));_0xd28776[_0x0b43('0x37')]=_0xd28776['attributes']['length']?_0xd28776[_0x0b43('0x37')]:_0x3beb6['model'];if(!_0x22a1d1[_0x0b43('0x35')][_0x0b43('0x3a')](_0x0b43('0x3b'))){_0xd28776[_0x0b43('0x1f')]=qs['limit'](_0x22a1d1['query']['limit']);_0xd28776[_0x0b43('0x1d')]=qs['offset'](_0x22a1d1['query']['offset']);}_0xd28776['order']=qs['sort'](_0x22a1d1[_0x0b43('0x35')][_0x0b43('0x3c')]);_0xd28776[_0x0b43('0x3d')]=qs[_0x0b43('0x36')](_[_0x0b43('0x3e')](_0x22a1d1[_0x0b43('0x35')],_0x3beb6[_0x0b43('0x36')]),_0xb49a29);if(_0x22a1d1[_0x0b43('0x35')]['filter']){_0xd28776[_0x0b43('0x3d')]=_[_0x0b43('0x3f')](_0xd28776['where'],{'$or':_['map'](_0xb49a29,function(_0x58ada7){if(_0x58ada7['type']!=='VIRTUAL'){var _0x47ab7b={};_0x47ab7b[_0x58ada7[_0x0b43('0x2c')]]={'$like':'%'+_0x22a1d1[_0x0b43('0x35')][_0x0b43('0x40')]+'%'};return _0x47ab7b;}})});}_0xd28776=_[_0x0b43('0x3f')]({},_0xd28776,_0x22a1d1['options']);var _0x45be1e={'where':_0xd28776[_0x0b43('0x3d')]};return db['WhatsappQueue']['count'](_0x45be1e)[_0x0b43('0x26')](function(_0x56165c){_0x3444b6[_0x0b43('0x20')]=_0x56165c;if(_0x22a1d1[_0x0b43('0x35')][_0x0b43('0x41')]){_0xd28776[_0x0b43('0x42')]=[{'all':!![]}];}return db[_0x0b43('0x30')]['findAll'](_0xd28776);})[_0x0b43('0x26')](function(_0x43d589){_0x3444b6[_0x0b43('0x43')]=_0x43d589;return _0x3444b6;})[_0x0b43('0x26')](respondWithFilteredResult(_0x330fcf,_0xd28776))[_0x0b43('0x44')](handleError(_0x330fcf,null));};exports['show']=function(_0x2b3412,_0x52c61e){var _0x2dc88e={'raw':!![],'where':{'id':_0x2b3412[_0x0b43('0x45')]['id']}},_0x178182={};_0x178182['model']=_[_0x0b43('0x34')](db[_0x0b43('0x30')][_0x0b43('0x31')]);_0x178182[_0x0b43('0x35')]=_[_0x0b43('0x34')](_0x2b3412[_0x0b43('0x35')]);_0x178182[_0x0b43('0x36')]=_['intersection'](_0x178182['model'],_0x178182[_0x0b43('0x35')]);_0x2dc88e[_0x0b43('0x37')]=_[_0x0b43('0x38')](_0x178182[_0x0b43('0x33')],qs[_0x0b43('0x39')](_0x2b3412['query']['fields']));_0x2dc88e[_0x0b43('0x37')]=_0x2dc88e[_0x0b43('0x37')]['length']?_0x2dc88e[_0x0b43('0x37')]:_0x178182['model'];if(_0x2b3412[_0x0b43('0x35')][_0x0b43('0x41')]){_0x2dc88e[_0x0b43('0x42')]=[{'all':!![]}];}_0x2dc88e=_['merge']({},_0x2dc88e,_0x2b3412[_0x0b43('0x46')]);return db[_0x0b43('0x30')][_0x0b43('0x47')](_0x2dc88e)[_0x0b43('0x26')](handleEntityNotFound(_0x52c61e,null))['then'](respondWithResult(_0x52c61e,null))['catch'](handleError(_0x52c61e,null));};exports['create']=function(_0x5ca1cb,_0x1dfdb5){return db[_0x0b43('0x30')][_0x0b43('0x48')](_0x5ca1cb[_0x0b43('0x49')],{})[_0x0b43('0x26')](function(_0x163a8a){var _0x18f222=_0x5ca1cb[_0x0b43('0x4a')][_0x0b43('0x4b')]({'plain':!![]});if(!_0x18f222)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x18f222[_0x0b43('0x4c')]===_0x0b43('0x4a')){var _0x5657d0=_0x163a8a[_0x0b43('0x4b')]({'plain':!![]});var _0x65dc42=_0x0b43('0x27');return db[_0x0b43('0x4d')][_0x0b43('0x47')]({'where':{'name':_0x65dc42,'userProfileId':_0x18f222[_0x0b43('0x4e')]},'raw':!![]})[_0x0b43('0x26')](function(_0x1bee4e){if(_0x1bee4e&&_0x1bee4e[_0x0b43('0x4f')]===0x0){return db[_0x0b43('0x28')]['create']({'name':_0x5657d0[_0x0b43('0x2c')],'resourceId':_0x5657d0['id'],'type':_0x1bee4e[_0x0b43('0x2c')],'sectionId':_0x1bee4e['id']},{})[_0x0b43('0x26')](function(){return _0x163a8a;});}else{return _0x163a8a;}})[_0x0b43('0x44')](function(_0x1dff5c){logger['error'](_0x0b43('0x50'),_0x1dff5c);throw _0x1dff5c;});}return _0x163a8a;})[_0x0b43('0x26')](respondWithResult(_0x1dfdb5,0xc9))[_0x0b43('0x44')](handleError(_0x1dfdb5,null));};exports[_0x0b43('0x25')]=function(_0x38cb3b,_0x2e0101){if(_0x38cb3b[_0x0b43('0x49')]['id']){delete _0x38cb3b[_0x0b43('0x49')]['id'];}return db[_0x0b43('0x30')]['find']({'where':{'id':_0x38cb3b[_0x0b43('0x45')]['id']}})['then'](handleEntityNotFound(_0x2e0101,null))['then'](saveUpdates(_0x38cb3b[_0x0b43('0x49')],null))['then'](respondWithResult(_0x2e0101,null))[_0x0b43('0x44')](handleError(_0x2e0101,null));};exports[_0x0b43('0x29')]=function(_0x3bc0d5,_0x268754){return db['WhatsappQueue'][_0x0b43('0x47')]({'where':{'id':_0x3bc0d5[_0x0b43('0x45')]['id']}})['then'](handleEntityNotFound(_0x268754,null))['then'](removeEntity(_0x268754,null))[_0x0b43('0x44')](handleError(_0x268754,null));};exports[_0x0b43('0x51')]=function(_0x617267,_0x59520b){return db[_0x0b43('0x30')][_0x0b43('0x51')]()[_0x0b43('0x26')](respondWithResult(_0x59520b,null))['catch'](handleError(_0x59520b,null));};exports[_0x0b43('0x52')]=function(_0x51c3ab,_0x4608a6,_0x73d648){var _0x179828={'raw':!![],'where':{}},_0x2f08f9={},_0x428e7b;return db[_0x0b43('0x30')][_0x0b43('0x53')]({'where':{'id':_0x51c3ab[_0x0b43('0x45')]['id']}})['then'](handleEntityNotFound(_0x4608a6,null))[_0x0b43('0x26')](function(_0x15db94){if(_0x15db94){_0x428e7b=_0x15db94['get']({'plain':!![]});_0x2f08f9[_0x0b43('0x33')]=_[_0x0b43('0x34')](db[_0x0b43('0x54')][_0x0b43('0x31')]);_0x2f08f9[_0x0b43('0x35')]=_[_0x0b43('0x34')](_0x51c3ab['query']);_0x2f08f9[_0x0b43('0x36')]=_[_0x0b43('0x38')](_0x2f08f9[_0x0b43('0x33')],_0x2f08f9[_0x0b43('0x35')]);_0x179828[_0x0b43('0x37')]=_[_0x0b43('0x38')](_0x2f08f9[_0x0b43('0x33')],qs['fields'](_0x51c3ab['query'][_0x0b43('0x39')]));_0x179828[_0x0b43('0x37')]=_0x179828['attributes'][_0x0b43('0x55')]?_0x179828[_0x0b43('0x37')]:_0x2f08f9[_0x0b43('0x33')];if(!_0x51c3ab[_0x0b43('0x35')]['hasOwnProperty'](_0x0b43('0x3b'))){_0x179828[_0x0b43('0x1f')]=qs[_0x0b43('0x1f')](_0x51c3ab[_0x0b43('0x35')][_0x0b43('0x1f')]);_0x179828['offset']=qs[_0x0b43('0x1d')](_0x51c3ab[_0x0b43('0x35')][_0x0b43('0x1d')]);}_0x179828[_0x0b43('0x56')]=qs[_0x0b43('0x3c')](_0x51c3ab[_0x0b43('0x35')][_0x0b43('0x3c')]);_0x179828[_0x0b43('0x3d')]=qs[_0x0b43('0x36')](_['pick'](_0x51c3ab['query'],_0x2f08f9[_0x0b43('0x36')]));_0x179828[_0x0b43('0x3d')][_0x0b43('0x57')]=_0x15db94['id'];if(_0x51c3ab['query'][_0x0b43('0x40')]){_0x179828[_0x0b43('0x3d')]=_[_0x0b43('0x3f')](_0x179828[_0x0b43('0x3d')],{'$or':_[_0x0b43('0x2f')](_0x179828['attributes'],function(_0x1ce916){var _0x5c5eb0={};_0x5c5eb0[_0x1ce916]={'$like':'%'+_0x51c3ab[_0x0b43('0x35')]['filter']+'%'};return _0x5c5eb0;})});}_0x179828=_['merge']({},_0x179828,_0x51c3ab[_0x0b43('0x46')]);return db[_0x0b43('0x54')][_0x0b43('0x58')](_0x179828);}})[_0x0b43('0x26')](function(_0x5b4860){if(_0x5b4860){return db[_0x0b43('0x59')][_0x0b43('0x5a')]({'where':{'id':_[_0x0b43('0x2f')](_0x5b4860,_0x0b43('0x5b')),'role':_0x0b43('0x5c')},'attributes':['id',_0x0b43('0x2c'),_0x0b43('0x5d'),_0x0b43('0x5e'),_0x0b43('0x5f')]});}})[_0x0b43('0x26')](function(_0x4ccc6f){if(_0x4ccc6f){return{'count':_0x4ccc6f[_0x0b43('0x20')],'rows':_[_0x0b43('0x2f')](_0x4ccc6f[_0x0b43('0x43')],function(_0x8bbc1a){return{'membername':_0x8bbc1a[_0x0b43('0x2c')],'UserId':_0x8bbc1a['id'],'queue_name':_0x428e7b[_0x0b43('0x2c')],'WhatsappQueueId':_0x428e7b['id'],'interface':util['format'](_0x0b43('0x60'),_0x0b43('0x61'),_0x8bbc1a[_0x0b43('0x2c')]),'penalty':0x0,'paused':_0x8bbc1a['whatsappPause'],'createdAt':_0x8bbc1a[_0x0b43('0x5f')],'updatedAt':_0x8bbc1a['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x0b43('0x26')](respondWithFilteredResult(_0x4608a6,_0x179828))[_0x0b43('0x44')](handleError(_0x4608a6,null));};exports[_0x0b43('0x62')]=function(_0x2b1cce,_0x55d882,_0x11f0d2){var _0x3c55ef={};var _0x388905={};var _0x3d95f5;var _0x53cab7;return db[_0x0b43('0x30')]['findOne']({'where':{'id':_0x2b1cce['params']['id']}})[_0x0b43('0x26')](handleEntityNotFound(_0x55d882,null))['then'](function(_0x1e4a2b){if(_0x1e4a2b){_0x3d95f5=_0x1e4a2b;_0x388905[_0x0b43('0x33')]=_[_0x0b43('0x34')](db['Team'][_0x0b43('0x31')]);_0x388905[_0x0b43('0x35')]=_[_0x0b43('0x34')](_0x2b1cce[_0x0b43('0x35')]);_0x388905[_0x0b43('0x36')]=_['intersection'](_0x388905[_0x0b43('0x33')],_0x388905[_0x0b43('0x35')]);_0x3c55ef['attributes']=_[_0x0b43('0x38')](_0x388905[_0x0b43('0x33')],qs[_0x0b43('0x39')](_0x2b1cce['query'][_0x0b43('0x39')]));_0x3c55ef[_0x0b43('0x37')]=_0x3c55ef[_0x0b43('0x37')]['length']?_0x3c55ef[_0x0b43('0x37')]:_0x388905[_0x0b43('0x33')];_0x3c55ef[_0x0b43('0x56')]=qs[_0x0b43('0x3c')](_0x2b1cce[_0x0b43('0x35')][_0x0b43('0x3c')]);_0x3c55ef[_0x0b43('0x3d')]=qs[_0x0b43('0x36')](_[_0x0b43('0x3e')](_0x2b1cce[_0x0b43('0x35')],_0x388905[_0x0b43('0x36')]));if(_0x2b1cce[_0x0b43('0x35')][_0x0b43('0x40')]){_0x3c55ef[_0x0b43('0x3d')]=_[_0x0b43('0x3f')](_0x3c55ef[_0x0b43('0x3d')],{'$or':_[_0x0b43('0x2f')](_0x3c55ef[_0x0b43('0x37')],function(_0x562c69){var _0x24b18b={};_0x24b18b[_0x562c69]={'$like':'%'+_0x2b1cce[_0x0b43('0x35')][_0x0b43('0x40')]+'%'};return _0x24b18b;})});}_0x3c55ef=_[_0x0b43('0x3f')]({},_0x3c55ef,_0x2b1cce[_0x0b43('0x46')]);return _0x3d95f5[_0x0b43('0x62')](_0x3c55ef);}})[_0x0b43('0x26')](function(_0x15ba8b){if(_0x15ba8b){_0x53cab7=_0x15ba8b[_0x0b43('0x55')];if(!_0x2b1cce[_0x0b43('0x35')][_0x0b43('0x3a')](_0x0b43('0x3b'))){_0x3c55ef[_0x0b43('0x1f')]=qs['limit'](_0x2b1cce[_0x0b43('0x35')]['limit']);_0x3c55ef[_0x0b43('0x1d')]=qs[_0x0b43('0x1d')](_0x2b1cce['query'][_0x0b43('0x1d')]);}return _0x3d95f5[_0x0b43('0x62')](_0x3c55ef);}})[_0x0b43('0x26')](function(_0x1dc11c){if(_0x1dc11c){return _0x1dc11c?{'count':_0x53cab7,'rows':_0x1dc11c}:null;}})[_0x0b43('0x26')](respondWithResult(_0x55d882,null))['catch'](handleError(_0x55d882,null));};exports['addTeams']=function(_0x1dd468,_0x425a50,_0x486716){var _0xd4c64=_0x1dd468[_0x0b43('0x49')][_0x0b43('0x63')];return db['Team']['findAll']({'where':{'id':_0xd4c64},'attributes':['id'],'include':[{'model':db[_0x0b43('0x59')],'as':'Agents','attributes':['id',_0x0b43('0x2c'),'online','voicePause',_0x0b43('0x64')],'raw':!![]}]})[_0x0b43('0x26')](function(_0xbd14b1){if(_0xbd14b1){var _0x55d636=_[_0x0b43('0x65')](_0xbd14b1,function(_0x371ef7){var _0x4e8df3=_0x371ef7['get']({'plain':!![]});return _0x4e8df3[_0x0b43('0x66')];});return db['WhatsappQueue'][_0x0b43('0x47')]({'where':{'id':_0x1dd468[_0x0b43('0x45')]['id']}})[_0x0b43('0x26')](function(_0x297e7d){return db[_0x0b43('0x67')][_0x0b43('0x68')](function(_0x9e5494){return _0x297e7d[_0x0b43('0x69')](_0xd4c64,{'transaction':_0x9e5494})[_0x0b43('0x26')](function(){return BPromise[_0x0b43('0x6a')](_0x55d636,function(_0x15bc47){return db[_0x0b43('0x54')][_0x0b43('0x6b')]({'where':{'UserId':_0x15bc47['id'],'WhatsappQueueId':_0x1dd468[_0x0b43('0x45')]['id']},'transaction':_0x9e5494});});})[_0x0b43('0x26')](function(){_0x55d636[_0x0b43('0x6c')](function(_0x5c9240){socket['emit'](_0x0b43('0x6d'),{'UserId':_0x5c9240['id'],'WhatsappQueueId':_0x297e7d['id']});});});});});}})[_0x0b43('0x26')](respondWithStatusCode(_0x425a50,null))[_0x0b43('0x44')](handleError(_0x425a50,null));};exports[_0x0b43('0x6e')]=function(_0x330de0,_0x65374d,_0x1b4d10){return db['Team'][_0x0b43('0x58')]({'where':{'id':_0x330de0[_0x0b43('0x35')][_0x0b43('0x63')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x65374d,null))[_0x0b43('0x26')](function(_0x4bac78){var _0x5866b=_[_0x0b43('0x2f')](_0x4bac78,'id');var _0x2a51ae=[];var _0x1101ec=[];var _0x17d340=squel[_0x0b43('0x6f')]();_0x17d340['field'](_0x0b43('0x70'))[_0x0b43('0x71')](_0x0b43('0x72'),'tq')[_0x0b43('0x73')](_0x0b43('0x74'),'ut',_0x0b43('0x75'))['where']('WhatsappQueueId\x20=\x20?',_0x330de0[_0x0b43('0x45')]['id']);for(var _0x4bb555=0x0;_0x4bb555<_0x4bac78['length'];_0x4bb555+=0x1){let _0x41bb1d=_0x4bac78[_0x4bb555];for(var _0xca9c2b=0x0;_0xca9c2b<_0x41bb1d[_0x0b43('0x66')][_0x0b43('0x55')];_0xca9c2b+=0x1){let _0x1afbe2=_0x41bb1d[_0x0b43('0x66')][_0xca9c2b];var _0x2b3a07=_0x17d340[_0x0b43('0x76')]();_0x2b3a07['where'](_0x0b43('0x77'),_0x1afbe2['id']);_0x1101ec[_0x0b43('0x78')](db['sequelize'][_0x0b43('0x35')](_0x2b3a07[_0x0b43('0x79')](),{'type':db['sequelize'][_0x0b43('0x7a')][_0x0b43('0x7b')]})[_0x0b43('0x26')](function(_0x540e3e){if(_0x540e3e[_0x0b43('0x55')]===0x1){return _0x1afbe2['id'];}else{var _0x1c6d95=_['every'](_[_0x0b43('0x2f')](_0x540e3e,_0x0b43('0x7c')),function(_0x8d5bd0){return _['includes'](_0x5866b,_0x8d5bd0);});if(_0x1c6d95){return _0x1afbe2['id'];}}}));}}return BPromise['all'](_0x1101ec)[_0x0b43('0x26')](function(_0x33d841){_0x2a51ae=_(_0x2a51ae)[_0x0b43('0x7d')](_0x33d841)[_0x0b43('0x7e')]()[_0x0b43('0x7f')]();return db['WhatsappQueue'][_0x0b43('0x47')]({'where':{'id':_0x330de0[_0x0b43('0x45')]['id']}})[_0x0b43('0x26')](function(_0x3d70af){return db[_0x0b43('0x67')][_0x0b43('0x68')](function(_0x5734e3){return _0x3d70af[_0x0b43('0x6e')](_0x330de0['query'][_0x0b43('0x63')],{'transaction':_0x5734e3})[_0x0b43('0x26')](function(){if(!_[_0x0b43('0x80')](_0x2a51ae)){return _0x3d70af[_0x0b43('0x81')](_0x2a51ae,{'transaction':_0x5734e3});}})['then'](function(){_0x2a51ae[_0x0b43('0x6c')](function(_0x47c36d){socket[_0x0b43('0x82')](_0x0b43('0x83'),{'UserId':_0x47c36d,'WhatsappQueueId':_0x3d70af['id']});});});});});});})[_0x0b43('0x26')](respondWithStatusCode(_0x65374d,null))['catch'](handleError(_0x65374d,null));};exports[_0x0b43('0x84')]=function(_0x42296e,_0x220673,_0x12f476){return db[_0x0b43('0x30')][_0x0b43('0x47')]({'where':{'id':_0x42296e['params']['id']}})['then'](handleEntityNotFound(_0x220673,null))['then'](function(_0x1d89a1){if(_0x1d89a1){return _0x1d89a1[_0x0b43('0x84')](_0x42296e['body'][_0x0b43('0x63')],_[_0x0b43('0x85')](_0x42296e[_0x0b43('0x49')],['ids','id'])||{})[_0x0b43('0x86')](function(_0x35d3e7){for(var _0x507e78=0x0;_0x507e78<_0x42296e[_0x0b43('0x49')][_0x0b43('0x63')]['length'];_0x507e78+=0x1){socket[_0x0b43('0x82')]('userWhatsappQueue:save',{'UserId':Number(_0x42296e[_0x0b43('0x49')][_0x0b43('0x63')][_0x507e78]),'WhatsappQueueId':Number(_0x42296e[_0x0b43('0x45')]['id'])});}return _0x35d3e7;});}})[_0x0b43('0x26')](respondWithResult(_0x220673,null))[_0x0b43('0x44')](handleError(_0x220673,null));};exports[_0x0b43('0x81')]=function(_0x101476,_0x14ac20,_0x4ce6d7){return db[_0x0b43('0x30')][_0x0b43('0x47')]({'where':{'id':_0x101476[_0x0b43('0x45')]['id']}})['then'](handleEntityNotFound(_0x14ac20,null))[_0x0b43('0x26')](function(_0x5cc752){if(_0x5cc752){return _0x5cc752['removeAgents'](_0x101476['query'][_0x0b43('0x63')])[_0x0b43('0x26')](function(){if(_[_0x0b43('0x87')](_0x101476[_0x0b43('0x35')][_0x0b43('0x63')])){for(var _0x1720cc=0x0;_0x1720cc<_0x101476[_0x0b43('0x35')][_0x0b43('0x63')][_0x0b43('0x55')];_0x1720cc+=0x1){socket['emit'](_0x0b43('0x83'),{'UserId':Number(_0x101476[_0x0b43('0x35')][_0x0b43('0x63')][_0x1720cc]),'WhatsappQueueId':Number(_0x101476[_0x0b43('0x45')]['id'])});}}else{socket[_0x0b43('0x82')](_0x0b43('0x83'),{'UserId':Number(_0x101476['query']['ids']),'WhatsappQueueId':Number(_0x101476[_0x0b43('0x45')]['id'])});}});}})[_0x0b43('0x26')](respondWithStatusCode(_0x14ac20,null))[_0x0b43('0x44')](handleError(_0x14ac20,null));};exports[_0x0b43('0x88')]=function(_0x5e4b7d,_0x1530eb,_0x554d29){var _0x5236b5={};var _0x65066c={};var _0x331e6d;var _0x16fc81;return db[_0x0b43('0x30')][_0x0b43('0x53')]({'where':{'id':_0x5e4b7d[_0x0b43('0x45')]['id']}})[_0x0b43('0x26')](handleEntityNotFound(_0x1530eb,null))[_0x0b43('0x26')](function(_0x42dbf6){if(_0x42dbf6){_0x331e6d=_0x42dbf6;_0x65066c[_0x0b43('0x33')]=_['keys'](db[_0x0b43('0x59')]['rawAttributes']);_0x65066c['query']=_['keys'](_0x5e4b7d[_0x0b43('0x35')]);_0x65066c[_0x0b43('0x36')]=_[_0x0b43('0x38')](_0x65066c[_0x0b43('0x33')],_0x65066c[_0x0b43('0x35')]);_0x5236b5[_0x0b43('0x37')]=_['intersection'](_0x65066c['model'],qs[_0x0b43('0x39')](_0x5e4b7d['query'][_0x0b43('0x39')]));_0x5236b5['attributes']=_0x5236b5[_0x0b43('0x37')]['length']?_0x5236b5['attributes']:_0x65066c['model'];_0x5236b5[_0x0b43('0x56')]=qs[_0x0b43('0x3c')](_0x5e4b7d[_0x0b43('0x35')][_0x0b43('0x3c')]);_0x5236b5['where']=qs['filters'](_[_0x0b43('0x3e')](_0x5e4b7d['query'],_0x65066c['filters']));if(_0x5e4b7d['query'][_0x0b43('0x40')]){_0x5236b5['where']=_[_0x0b43('0x3f')](_0x5236b5[_0x0b43('0x3d')],{'$or':_[_0x0b43('0x2f')](_0x5236b5[_0x0b43('0x37')],function(_0x4cd084){var _0x4701bf={};_0x4701bf[_0x4cd084]={'$like':'%'+_0x5e4b7d[_0x0b43('0x35')][_0x0b43('0x40')]+'%'};return _0x4701bf;})});}_0x5236b5=_[_0x0b43('0x3f')]({},_0x5236b5,_0x5e4b7d[_0x0b43('0x46')]);return _0x331e6d[_0x0b43('0x88')](_0x5236b5);}})[_0x0b43('0x26')](function(_0x4b00ea){if(_0x4b00ea){_0x16fc81=_0x4b00ea['length'];if(!_0x5e4b7d['query'][_0x0b43('0x3a')](_0x0b43('0x3b'))){_0x5236b5[_0x0b43('0x1f')]=qs[_0x0b43('0x1f')](_0x5e4b7d[_0x0b43('0x35')]['limit']);_0x5236b5['offset']=qs[_0x0b43('0x1d')](_0x5e4b7d[_0x0b43('0x35')]['offset']);}return _0x331e6d[_0x0b43('0x88')](_0x5236b5);}})[_0x0b43('0x26')](function(_0x57cc09){if(_0x57cc09){return _0x57cc09?{'count':_0x16fc81,'rows':_0x57cc09}:null;}})[_0x0b43('0x26')](respondWithResult(_0x1530eb,null))[_0x0b43('0x44')](handleError(_0x1530eb,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 8083ca7..744904f 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 _0x648d=['save','update','remove','emit','hasOwnProperty','exports','../../mysqldb','WhatsappQueue'];(function(_0x32e60f,_0xf00e7d){var _0x337c97=function(_0x497544){while(--_0x497544){_0x32e60f['push'](_0x32e60f['shift']());}};_0x337c97(++_0xf00e7d);}(_0x648d,0xf6));var _0xd648=function(_0x57f499,_0x3a9638){_0x57f499=_0x57f499-0x0;var _0xd62285=_0x648d[_0x57f499];return _0xd62285;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require(_0xd648('0x0'))['db'][_0xd648('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd648('0x2'),'afterUpdate':_0xd648('0x3'),'afterDestroy':_0xd648('0x4')};function emitEvent(_0x3b34aa){return function(_0x18a8bf,_0x3458c2,_0x563166){WhatsappQueueEvents['emit'](_0x3b34aa+':'+_0x18a8bf['id'],_0x18a8bf);WhatsappQueueEvents[_0xd648('0x5')](_0x3b34aa,_0x18a8bf);_0x563166(null);};}for(var e in events){if(events[_0xd648('0x6')](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0xd648('0x7')]=WhatsappQueueEvents; \ No newline at end of file +var _0x9535=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x5e8f5f,_0x43368f){var _0x2dc12a=function(_0x15ca58){while(--_0x15ca58){_0x5e8f5f['push'](_0x5e8f5f['shift']());}};_0x2dc12a(++_0x43368f);}(_0x9535,0x6b));var _0x5953=function(_0xe65f57,_0x295ee9){_0xe65f57=_0xe65f57-0x0;var _0x3d2210=_0x9535[_0xe65f57];return _0x3d2210;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require(_0x5953('0x0'))['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x5953('0x1')](0x0);var events={'afterCreate':_0x5953('0x2'),'afterUpdate':_0x5953('0x3'),'afterDestroy':_0x5953('0x4')};function emitEvent(_0x442fd1){return function(_0x1d71f6,_0x3d064b,_0x3a908c){WhatsappQueueEvents[_0x5953('0x5')](_0x442fd1+':'+_0x1d71f6['id'],_0x1d71f6);WhatsappQueueEvents[_0x5953('0x5')](_0x442fd1,_0x1d71f6);_0x3a908c(null);};}for(var e in events){if(events[_0x5953('0x6')](e)){var event=events[e];WhatsappQueue[_0x5953('0x7')](e,emitEvent(event));}}module[_0x5953('0x8')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 8fe13a0..59e8d01 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 _0xc144=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','WhatsappQueue','lodash'];(function(_0x5d965d,_0x22e2d9){var _0x1eaa43=function(_0x602def){while(--_0x602def){_0x5d965d['push'](_0x5d965d['shift']());}};_0x1eaa43(++_0x22e2d9);}(_0xc144,0x15b));var _0x4c14=function(_0x4c92c8,_0x3fc3f9){_0x4c92c8=_0x4c92c8-0x0;var _0x411ae0=_0xc144[_0x4c92c8];return _0x411ae0;};'use strict';var _=require(_0x4c14('0x0'));var util=require(_0x4c14('0x1'));var logger=require(_0x4c14('0x2'))(_0x4c14('0x3'));var moment=require(_0x4c14('0x4'));var BPromise=require(_0x4c14('0x5'));var rp=require(_0x4c14('0x6'));var fs=require('fs');var path=require(_0x4c14('0x7'));var rimraf=require(_0x4c14('0x8'));var config=require(_0x4c14('0x9'));var attributes=require('./whatsappQueue.attributes');module['exports']=function(_0x551e2b,_0x4c61c6){return _0x551e2b[_0x4c14('0xa')](_0x4c14('0xb'),attributes,{'tableName':'whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7e74=['request-promise','path','rimraf','./whatsappQueue.attributes','exports','define','WhatsappQueue','whatsapp_queues','lodash','util','../../config/logger','api','bluebird'];(function(_0x10c16d,_0x2b3e14){var _0x5896f4=function(_0x4306b9){while(--_0x4306b9){_0x10c16d['push'](_0x10c16d['shift']());}};_0x5896f4(++_0x2b3e14);}(_0x7e74,0x18e));var _0x47e7=function(_0x30fbcb,_0xf4fef1){_0x30fbcb=_0x30fbcb-0x0;var _0x544f10=_0x7e74[_0x30fbcb];return _0x544f10;};'use strict';var _=require(_0x47e7('0x0'));var util=require(_0x47e7('0x1'));var logger=require(_0x47e7('0x2'))(_0x47e7('0x3'));var moment=require('moment');var BPromise=require(_0x47e7('0x4'));var rp=require(_0x47e7('0x5'));var fs=require('fs');var path=require(_0x47e7('0x6'));var rimraf=require(_0x47e7('0x7'));var config=require('../../config/environment');var attributes=require(_0x47e7('0x8'));module[_0x47e7('0x9')]=function(_0x581c7b,_0x1e9514){return _0x581c7b[_0x47e7('0xa')](_0x47e7('0xb'),attributes,{'tableName':_0x47e7('0xc'),'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 25f2464..997f6ee 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 _0x8bdb=['http','redis','defaults','localhost','./whatsappQueue.socket','register','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','error','message','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','attributes','limit','include','map','model','find','where','ShowWhatsappQueue','stringify','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','jayson/promise'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0x8bdb,0x65));var _0xb8bd=function(_0x49d000,_0x4dcd9a){_0x49d000=_0x49d000-0x0;var _0x4809e2=_0x8bdb[_0x49d000];return _0x4809e2;};'use strict';var _=require(_0xb8bd('0x0'));var util=require(_0xb8bd('0x1'));var moment=require('moment');var BPromise=require(_0xb8bd('0x2'));var rs=require(_0xb8bd('0x3'));var fs=require('fs');var Redis=require(_0xb8bd('0x4'));var db=require(_0xb8bd('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xb8bd('0x6'));var client=jayson['client'][_0xb8bd('0x7')]({'port':0x232a});config[_0xb8bd('0x8')]=_[_0xb8bd('0x9')](config[_0xb8bd('0x8')],{'host':_0xb8bd('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xb8bd('0xb'))[_0xb8bd('0xc')](socket);function respondWithRpcPromise(_0x317af1,_0x5d189c,_0x26b529){return new BPromise(function(_0x4f5240,_0x3ff5bb){return client['request'](_0x317af1,_0x26b529)[_0xb8bd('0xd')](function(_0x4159f4){logger[_0xb8bd('0xe')](_0xb8bd('0xf'),_0x5d189c,_0xb8bd('0x10'));logger[_0xb8bd('0x11')](_0xb8bd('0x12'),_0x5d189c,_0xb8bd('0x10'),JSON['stringify'](_0x4159f4));if(_0x4159f4['error']){if(_0x4159f4[_0xb8bd('0x13')]['code']===0x1f4){logger['error']('WhatsappQueue,\x20%s,\x20%s',_0x5d189c,_0x4159f4['error']['message']);return _0x3ff5bb(_0x4159f4[_0xb8bd('0x13')][_0xb8bd('0x14')]);}logger[_0xb8bd('0x13')](_0xb8bd('0xf'),_0x5d189c,_0x4159f4[_0xb8bd('0x13')][_0xb8bd('0x14')]);return _0x4f5240(_0x4159f4[_0xb8bd('0x13')][_0xb8bd('0x14')]);}else{logger['info'](_0xb8bd('0xf'),_0x5d189c,_0xb8bd('0x10'));_0x4f5240(_0x4159f4['result'][_0xb8bd('0x14')]);}})[_0xb8bd('0x15')](function(_0x5ef6c3){logger[_0xb8bd('0x13')](_0xb8bd('0xf'),_0x5d189c,_0x5ef6c3);_0x3ff5bb(_0x5ef6c3);});});}exports[_0xb8bd('0x16')]=function(_0x157a36){var _0x33e53a=this;return new Promise(function(_0x8a0c72,_0x202c23){return db[_0xb8bd('0x17')][_0xb8bd('0x18')]({'raw':_0x157a36['options']?_0x157a36[_0xb8bd('0x19')][_0xb8bd('0x1a')]===undefined?!![]:![]:!![],'where':_0x157a36['options']?_0x157a36[_0xb8bd('0x19')]['where']||null:null,'attributes':_0x157a36[_0xb8bd('0x19')]?_0x157a36[_0xb8bd('0x19')][_0xb8bd('0x1b')]||null:null,'limit':_0x157a36[_0xb8bd('0x19')]?_0x157a36[_0xb8bd('0x19')][_0xb8bd('0x1c')]||null:null,'include':_0x157a36['options']?_0x157a36['options'][_0xb8bd('0x1d')]?_[_0xb8bd('0x1e')](_0x157a36[_0xb8bd('0x19')][_0xb8bd('0x1d')],function(_0x4bced8){return{'model':db[_0x4bced8['model']],'as':_0x4bced8['as'],'attributes':_0x4bced8[_0xb8bd('0x1b')],'include':_0x4bced8['include']?_[_0xb8bd('0x1e')](_0x4bced8['include'],function(_0x51ca6c){return{'model':db[_0x51ca6c['model']],'as':_0x51ca6c['as'],'attributes':_0x51ca6c[_0xb8bd('0x1b')],'include':_0x51ca6c[_0xb8bd('0x1d')]?_[_0xb8bd('0x1e')](_0x51ca6c[_0xb8bd('0x1d')],function(_0xc7089b){return{'model':db[_0xc7089b[_0xb8bd('0x1f')]],'as':_0xc7089b['as'],'attributes':_0xc7089b[_0xb8bd('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xb8bd('0xd')](function(_0x37870d){logger[_0xb8bd('0xe')](_0xb8bd('0x16'),_0x157a36);logger[_0xb8bd('0x11')](_0xb8bd('0x16'),_0x157a36,JSON['stringify'](_0x37870d));_0x8a0c72(_0x37870d);})[_0xb8bd('0x15')](function(_0xaf2963){logger[_0xb8bd('0x13')](_0xb8bd('0x16'),_0xaf2963[_0xb8bd('0x14')],_0x157a36);_0x202c23(_0x33e53a[_0xb8bd('0x13')](0x1f4,_0xaf2963[_0xb8bd('0x14')]));});});};exports['ShowWhatsappQueue']=function(_0x36941b){var _0xc47d5f=this;return new Promise(function(_0x559b73,_0x1ab714){return db[_0xb8bd('0x17')][_0xb8bd('0x20')]({'raw':_0x36941b[_0xb8bd('0x19')]?_0x36941b[_0xb8bd('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x36941b['options']?_0x36941b[_0xb8bd('0x19')][_0xb8bd('0x21')]||null:null,'attributes':_0x36941b[_0xb8bd('0x19')]?_0x36941b['options'][_0xb8bd('0x1b')]||null:null,'include':_0x36941b[_0xb8bd('0x19')]?_0x36941b[_0xb8bd('0x19')]['include']?_[_0xb8bd('0x1e')](_0x36941b[_0xb8bd('0x19')][_0xb8bd('0x1d')],function(_0x2c2069){return{'model':db[_0x2c2069[_0xb8bd('0x1f')]],'as':_0x2c2069['as'],'attributes':_0x2c2069[_0xb8bd('0x1b')],'include':_0x2c2069[_0xb8bd('0x1d')]?_['map'](_0x2c2069[_0xb8bd('0x1d')],function(_0x177d30){return{'model':db[_0x177d30[_0xb8bd('0x1f')]],'as':_0x177d30['as'],'attributes':_0x177d30[_0xb8bd('0x1b')],'include':_0x177d30[_0xb8bd('0x1d')]?_[_0xb8bd('0x1e')](_0x177d30[_0xb8bd('0x1d')],function(_0x3f13b9){return{'model':db[_0x3f13b9[_0xb8bd('0x1f')]],'as':_0x3f13b9['as'],'attributes':_0x3f13b9[_0xb8bd('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x144c9f){logger[_0xb8bd('0xe')](_0xb8bd('0x22'),_0x36941b);logger[_0xb8bd('0x11')](_0xb8bd('0x22'),_0x36941b,JSON[_0xb8bd('0x23')](_0x144c9f));_0x559b73(_0x144c9f);})[_0xb8bd('0x15')](function(_0x2c733a){logger[_0xb8bd('0x13')](_0xb8bd('0x22'),_0x2c733a['message'],_0x36941b);_0x1ab714(_0xc47d5f[_0xb8bd('0x13')](0x1f4,_0x2c733a[_0xb8bd('0x14')]));});});}; \ No newline at end of file +var _0x4d51=['request','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','where','attributes','limit','include','map','model','then','stringify','ShowWhatsappQueue','find','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./whatsappQueue.socket','register'];(function(_0x1769dd,_0x215946){var _0x33f47c=function(_0xf72ebc){while(--_0xf72ebc){_0x1769dd['push'](_0x1769dd['shift']());}};_0x33f47c(++_0x215946);}(_0x4d51,0x1ee));var _0x14d5=function(_0x805a59,_0x4fe4d1){_0x805a59=_0x805a59-0x0;var _0x3a982e=_0x4d51[_0x805a59];return _0x3a982e;};'use strict';var _=require(_0x14d5('0x0'));var util=require('util');var moment=require(_0x14d5('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x14d5('0x2'));var db=require(_0x14d5('0x3'))['db'];var utils=require(_0x14d5('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x14d5('0x5'));var jayson=require(_0x14d5('0x6'));var client=jayson[_0x14d5('0x7')][_0x14d5('0x8')]({'port':0x232a});config[_0x14d5('0x9')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x14d5('0xa'))(new Redis(config[_0x14d5('0x9')]));require(_0x14d5('0xb'))[_0x14d5('0xc')](socket);function respondWithRpcPromise(_0x3be5c4,_0x56bde4,_0x1e3783){return new BPromise(function(_0x49c71d,_0x3b6af4){return client[_0x14d5('0xd')](_0x3be5c4,_0x1e3783)['then'](function(_0x450e1e){logger[_0x14d5('0xe')](_0x14d5('0xf'),_0x56bde4,_0x14d5('0x10'));logger[_0x14d5('0x11')](_0x14d5('0x12'),_0x56bde4,_0x14d5('0x10'),JSON['stringify'](_0x450e1e));if(_0x450e1e[_0x14d5('0x13')]){if(_0x450e1e[_0x14d5('0x13')][_0x14d5('0x14')]===0x1f4){logger['error'](_0x14d5('0xf'),_0x56bde4,_0x450e1e[_0x14d5('0x13')][_0x14d5('0x15')]);return _0x3b6af4(_0x450e1e[_0x14d5('0x13')][_0x14d5('0x15')]);}logger[_0x14d5('0x13')](_0x14d5('0xf'),_0x56bde4,_0x450e1e['error']['message']);return _0x49c71d(_0x450e1e['error']['message']);}else{logger[_0x14d5('0xe')](_0x14d5('0xf'),_0x56bde4,'request\x20sent');_0x49c71d(_0x450e1e[_0x14d5('0x16')][_0x14d5('0x15')]);}})[_0x14d5('0x17')](function(_0xeedaf6){logger[_0x14d5('0x13')](_0x14d5('0xf'),_0x56bde4,_0xeedaf6);_0x3b6af4(_0xeedaf6);});});}exports[_0x14d5('0x18')]=function(_0x26558f){var _0x100b1d=this;return new Promise(function(_0x26b5d8,_0x5cf929){return db[_0x14d5('0x19')][_0x14d5('0x1a')]({'raw':_0x26558f['options']?_0x26558f[_0x14d5('0x1b')][_0x14d5('0x1c')]===undefined?!![]:![]:!![],'where':_0x26558f['options']?_0x26558f[_0x14d5('0x1b')][_0x14d5('0x1d')]||null:null,'attributes':_0x26558f[_0x14d5('0x1b')]?_0x26558f['options'][_0x14d5('0x1e')]||null:null,'limit':_0x26558f[_0x14d5('0x1b')]?_0x26558f[_0x14d5('0x1b')][_0x14d5('0x1f')]||null:null,'include':_0x26558f[_0x14d5('0x1b')]?_0x26558f['options'][_0x14d5('0x20')]?_[_0x14d5('0x21')](_0x26558f[_0x14d5('0x1b')][_0x14d5('0x20')],function(_0x3ca8b6){return{'model':db[_0x3ca8b6[_0x14d5('0x22')]],'as':_0x3ca8b6['as'],'attributes':_0x3ca8b6['attributes'],'include':_0x3ca8b6[_0x14d5('0x20')]?_[_0x14d5('0x21')](_0x3ca8b6[_0x14d5('0x20')],function(_0x415a68){return{'model':db[_0x415a68['model']],'as':_0x415a68['as'],'attributes':_0x415a68[_0x14d5('0x1e')],'include':_0x415a68[_0x14d5('0x20')]?_[_0x14d5('0x21')](_0x415a68[_0x14d5('0x20')],function(_0x4e9a8f){return{'model':db[_0x4e9a8f[_0x14d5('0x22')]],'as':_0x4e9a8f['as'],'attributes':_0x4e9a8f[_0x14d5('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x14d5('0x23')](function(_0x1af6d1){logger['info']('GetWhatsappQueue',_0x26558f);logger[_0x14d5('0x11')](_0x14d5('0x18'),_0x26558f,JSON[_0x14d5('0x24')](_0x1af6d1));_0x26b5d8(_0x1af6d1);})['catch'](function(_0x52a8ed){logger[_0x14d5('0x13')](_0x14d5('0x18'),_0x52a8ed[_0x14d5('0x15')],_0x26558f);_0x5cf929(_0x100b1d[_0x14d5('0x13')](0x1f4,_0x52a8ed['message']));});});};exports[_0x14d5('0x25')]=function(_0x336ced){var _0x3031fa=this;return new Promise(function(_0x1e1e11,_0x5924ad){return db[_0x14d5('0x19')][_0x14d5('0x26')]({'raw':_0x336ced[_0x14d5('0x1b')]?_0x336ced[_0x14d5('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x336ced['options']?_0x336ced['options'][_0x14d5('0x1d')]||null:null,'attributes':_0x336ced[_0x14d5('0x1b')]?_0x336ced['options'][_0x14d5('0x1e')]||null:null,'include':_0x336ced[_0x14d5('0x1b')]?_0x336ced[_0x14d5('0x1b')][_0x14d5('0x20')]?_[_0x14d5('0x21')](_0x336ced[_0x14d5('0x1b')][_0x14d5('0x20')],function(_0xf7dc82){return{'model':db[_0xf7dc82['model']],'as':_0xf7dc82['as'],'attributes':_0xf7dc82[_0x14d5('0x1e')],'include':_0xf7dc82[_0x14d5('0x20')]?_['map'](_0xf7dc82[_0x14d5('0x20')],function(_0x3ae65a){return{'model':db[_0x3ae65a[_0x14d5('0x22')]],'as':_0x3ae65a['as'],'attributes':_0x3ae65a['attributes'],'include':_0x3ae65a['include']?_['map'](_0x3ae65a[_0x14d5('0x20')],function(_0x2b8db0){return{'model':db[_0x2b8db0[_0x14d5('0x22')]],'as':_0x2b8db0['as'],'attributes':_0x2b8db0[_0x14d5('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x14d5('0x23')](function(_0x3ff161){logger['info']('ShowWhatsappQueue',_0x336ced);logger[_0x14d5('0x11')](_0x14d5('0x25'),_0x336ced,JSON[_0x14d5('0x24')](_0x3ff161));_0x1e1e11(_0x3ff161);})['catch'](function(_0x2a9c16){logger['error']('ShowWhatsappQueue',_0x2a9c16[_0x14d5('0x15')],_0x336ced);_0x5924ad(_0x3031fa[_0x14d5('0x13')](0x1f4,_0x2a9c16[_0x14d5('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 5f576af..a82e4e6 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 _0x3ffb=['./whatsappQueue.events','remove','update','removeListener','register','length','whatsappQueue:'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x3ffb,0x93));var _0xb3ff=function(_0x4a2613,_0xfe365d){_0x4a2613=_0x4a2613-0x0;var _0x4345e0=_0x3ffb[_0x4a2613];return _0x4345e0;};'use strict';var WhatsappQueueEvents=require(_0xb3ff('0x0'));var events=['save',_0xb3ff('0x1'),_0xb3ff('0x2')];function createListener(_0x4d2cc6,_0x5350fd){return function(_0x2d7024){_0x5350fd['emit'](_0x4d2cc6,_0x2d7024);};}function removeListener(_0x35f276,_0x4a6259){return function(){WhatsappQueueEvents[_0xb3ff('0x3')](_0x35f276,_0x4a6259);};}exports[_0xb3ff('0x4')]=function(_0x5e6d42){for(var _0x1d3915=0x0,_0x803907=events[_0xb3ff('0x5')];_0x1d3915<_0x803907;_0x1d3915++){var _0x39b578=events[_0x1d3915];var _0x508a0a=createListener(_0xb3ff('0x6')+_0x39b578,_0x5e6d42);WhatsappQueueEvents['on'](_0x39b578,_0x508a0a);}}; \ No newline at end of file +var _0x4867=['emit','removeListener','register','whatsappQueue:','./whatsappQueue.events','save','remove','update'];(function(_0x15d91e,_0x43b1ca){var _0x2468b2=function(_0x35fe17){while(--_0x35fe17){_0x15d91e['push'](_0x15d91e['shift']());}};_0x2468b2(++_0x43b1ca);}(_0x4867,0x144));var _0x7486=function(_0x534465,_0x437255){_0x534465=_0x534465-0x0;var _0x1054cd=_0x4867[_0x534465];return _0x1054cd;};'use strict';var WhatsappQueueEvents=require(_0x7486('0x0'));var events=[_0x7486('0x1'),_0x7486('0x2'),_0x7486('0x3')];function createListener(_0x3b87a1,_0x9158ac){return function(_0x59a218){_0x9158ac[_0x7486('0x4')](_0x3b87a1,_0x59a218);};}function removeListener(_0x18c36a,_0x4d6edf){return function(){WhatsappQueueEvents[_0x7486('0x5')](_0x18c36a,_0x4d6edf);};}exports[_0x7486('0x6')]=function(_0x3775af){for(var _0x47975a=0x0,_0x58ae57=events['length'];_0x47975a<_0x58ae57;_0x47975a++){var _0x3e67ce=events[_0x47975a];var _0x3f1cc0=createListener(_0x7486('0x7')+_0x3e67ce,_0x3775af);WhatsappQueueEvents['on'](_0x3e67ce,_0x3f1cc0);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 94d8242..afa417d 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 _0xad9f=['post','create','update','destroy','exports','util','path','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show'];(function(_0x1643a8,_0x57ca93){var _0x56adde=function(_0xfcacf3){while(--_0xfcacf3){_0x1643a8['push'](_0x1643a8['shift']());}};_0x56adde(++_0x57ca93);}(_0xad9f,0x75));var _0xfad9=function(_0xc4b2d7,_0x279c97){_0xc4b2d7=_0xc4b2d7-0x0;var _0x138c47=_0xad9f[_0xc4b2d7];return _0x138c47;};'use strict';var multer=require('multer');var util=require(_0xfad9('0x0'));var path=require(_0xfad9('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xfad9('0x2'));var auth=require(_0xfad9('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xfad9('0x4'));var controller=require('./whatsappQueueReport.controller');router[_0xfad9('0x5')]('/',auth[_0xfad9('0x6')](),controller['index']);router[_0xfad9('0x5')](_0xfad9('0x7'),auth[_0xfad9('0x6')](),controller[_0xfad9('0x8')]);router[_0xfad9('0x5')](_0xfad9('0x9'),auth[_0xfad9('0x6')](),controller[_0xfad9('0xa')]);router[_0xfad9('0xb')]('/',auth[_0xfad9('0x6')](),controller[_0xfad9('0xc')]);router['put'](_0xfad9('0x9'),auth['isAuthenticated'](),controller[_0xfad9('0xd')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xfad9('0xe')]);module[_0xfad9('0xf')]=router; \ No newline at end of file +var _0x41a0=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create'];(function(_0x39c734,_0x2f3e06){var _0xb2a2f9=function(_0x502f3f){while(--_0x502f3f){_0x39c734['push'](_0x39c734['shift']());}};_0xb2a2f9(++_0x2f3e06);}(_0x41a0,0x1e8));var _0x041a=function(_0x25ca1a,_0x42450c){_0x25ca1a=_0x25ca1a-0x0;var _0x4974d0=_0x41a0[_0x25ca1a];return _0x4974d0;};'use strict';var multer=require(_0x041a('0x0'));var util=require(_0x041a('0x1'));var path=require(_0x041a('0x2'));var timeout=require(_0x041a('0x3'));var express=require('express');var router=express[_0x041a('0x4')]();var fs_extra=require(_0x041a('0x5'));var auth=require(_0x041a('0x6'));var interaction=require(_0x041a('0x7'));var config=require(_0x041a('0x8'));var controller=require(_0x041a('0x9'));router[_0x041a('0xa')]('/',auth[_0x041a('0xb')](),controller[_0x041a('0xc')]);router[_0x041a('0xa')](_0x041a('0xd'),auth[_0x041a('0xb')](),controller[_0x041a('0xe')]);router[_0x041a('0xa')](_0x041a('0xf'),auth[_0x041a('0xb')](),controller[_0x041a('0x10')]);router['post']('/',auth[_0x041a('0xb')](),controller[_0x041a('0x11')]);router[_0x041a('0x12')](_0x041a('0xf'),auth[_0x041a('0xb')](),controller[_0x041a('0x13')]);router[_0x041a('0x14')](_0x041a('0xf'),auth[_0x041a('0xb')](),controller[_0x041a('0x15')]);module[_0x041a('0x16')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 05484df..ee21282 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(_0x2fb343,_0x23078f){var _0x9d9832=function(_0x2bf2db){while(--_0x2bf2db){_0x2fb343['push'](_0x2fb343['shift']());}};_0x9d9832(++_0x23078f);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file +var _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x2717bf,_0x2cb59c){var _0x419999=function(_0x192b84){while(--_0x192b84){_0x2717bf['push'](_0x2717bf['shift']());}};_0x419999(++_0x2cb59c);}(_0x7a54,0x106));var _0x47a5=function(_0x5ab942,_0x76c2ee){_0x5ab942=_0x5ab942-0x0;var _0x101102=_0x7a54[_0x5ab942];return _0x101102;};'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 2aabaa0..1a33643 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 _0x3266=['query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','show','params','keys','options','find','create','body','catch','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','count','set','Content-Range','save','update','then','destroy','end','stack','name','send','index','map','WhatsappQueueReport','rawAttributes','type','key','model'];(function(_0x55184c,_0x1b9317){var _0x1acbcf=function(_0x15df5a){while(--_0x15df5a){_0x55184c['push'](_0x55184c['shift']());}};_0x1acbcf(++_0x1b9317);}(_0x3266,0x6a));var _0x6326=function(_0x2642cb,_0x4b917f){_0x2642cb=_0x2642cb-0x0;var _0xe6e41=_0x3266[_0x2642cb];return _0xe6e41;};'use strict';var emlformat=require(_0x6326('0x0'));var rimraf=require(_0x6326('0x1'));var zipdir=require(_0x6326('0x2'));var jsonpatch=require(_0x6326('0x3'));var rp=require(_0x6326('0x4'));var moment=require(_0x6326('0x5'));var BPromise=require(_0x6326('0x6'));var Mustache=require(_0x6326('0x7'));var util=require(_0x6326('0x8'));var path=require('path');var sox=require(_0x6326('0x9'));var csv=require('to-csv');var ejs=require(_0x6326('0xa'));var fs=require('fs');var fs_extra=require(_0x6326('0xb'));var _=require(_0x6326('0xc'));var squel=require('squel');var crypto=require(_0x6326('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x6326('0xe'));var toCsv=require(_0x6326('0xf'));var querystring=require(_0x6326('0x10'));var Papa=require(_0x6326('0x11'));var Redis=require(_0x6326('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x6326('0x13'));var as=require(_0x6326('0x14'));var hardwareService=require(_0x6326('0x15'));var logger=require(_0x6326('0x16'))(_0x6326('0x17'));var utils=require(_0x6326('0x18'));var config=require(_0x6326('0x19'));var licenseUtil=require(_0x6326('0x1a'));var db=require(_0x6326('0x1b'))['db'];function respondWithStatusCode(_0x379358,_0x5c07e1){_0x5c07e1=_0x5c07e1||0xcc;return function(_0x5381d0){if(_0x5381d0){return _0x379358[_0x6326('0x1c')](_0x5c07e1);}return _0x379358[_0x6326('0x1d')](_0x5c07e1)['end']();};}function respondWithResult(_0x425878,_0x4caef3){_0x4caef3=_0x4caef3||0xc8;return function(_0x2d2d9b){if(_0x2d2d9b){return _0x425878[_0x6326('0x1d')](_0x4caef3)[_0x6326('0x1e')](_0x2d2d9b);}};}function respondWithFilteredResult(_0x41c352,_0x1ed3a3){return function(_0x2c1879){if(_0x2c1879){var _0x55923a=typeof _0x1ed3a3[_0x6326('0x1f')]==='undefined'&&typeof _0x1ed3a3['limit']==='undefined';var _0x51e7b9=_0x2c1879['count'];var _0x58e960=_0x55923a?0x0:_0x1ed3a3[_0x6326('0x1f')];var _0x1f4c11=_0x55923a?_0x2c1879[_0x6326('0x20')]:_0x1ed3a3['offset']+_0x1ed3a3['limit'];var _0x954ed5;if(_0x1f4c11>=_0x51e7b9){_0x1f4c11=_0x51e7b9;_0x954ed5=0xc8;}else{_0x954ed5=0xce;}_0x41c352[_0x6326('0x1d')](_0x954ed5);return _0x41c352[_0x6326('0x21')](_0x6326('0x22'),_0x58e960+'-'+_0x1f4c11+'/'+_0x51e7b9)[_0x6326('0x1e')](_0x2c1879);}return null;};}function patchUpdates(_0x25957a){return function(_0x21ee7d){try{jsonpatch['apply'](_0x21ee7d,_0x25957a,!![]);}catch(_0x22307f){return BPromise['reject'](_0x22307f);}return _0x21ee7d[_0x6326('0x23')]();};}function saveUpdates(_0x3c6cfa,_0x2482ef){return function(_0x24fb78){if(_0x24fb78){return _0x24fb78[_0x6326('0x24')](_0x3c6cfa)[_0x6326('0x25')](function(_0x225555){return _0x225555;});}return null;};}function removeEntity(_0x429bb0,_0x4781cc){return function(_0x2d0d00){if(_0x2d0d00){return _0x2d0d00[_0x6326('0x26')]()['then'](function(){_0x429bb0[_0x6326('0x1d')](0xcc)[_0x6326('0x27')]();});}};}function handleEntityNotFound(_0x575701,_0x4e272b){return function(_0x4d28fd){if(!_0x4d28fd){_0x575701[_0x6326('0x1c')](0x194);}return _0x4d28fd;};}function handleError(_0x4dae28,_0x33c466){_0x33c466=_0x33c466||0x1f4;return function(_0x1a48da){logger['error'](_0x1a48da[_0x6326('0x28')]);if(_0x1a48da[_0x6326('0x29')]){delete _0x1a48da[_0x6326('0x29')];}_0x4dae28[_0x6326('0x1d')](_0x33c466)[_0x6326('0x2a')](_0x1a48da);};}exports[_0x6326('0x2b')]=function(_0x40e036,_0x27802c){var _0x461e0f={},_0x127744={},_0x4980f6={'count':0x0,'rows':[]};var _0x2a8873=_[_0x6326('0x2c')](db[_0x6326('0x2d')][_0x6326('0x2e')],function(_0x20c5ab){return{'name':_0x20c5ab['fieldName'],'type':_0x20c5ab[_0x6326('0x2f')][_0x6326('0x30')]};});_0x127744[_0x6326('0x31')]=_['map'](_0x2a8873,_0x6326('0x29'));_0x127744['query']=_['keys'](_0x40e036[_0x6326('0x32')]);_0x127744[_0x6326('0x33')]=_[_0x6326('0x34')](_0x127744[_0x6326('0x31')],_0x127744[_0x6326('0x32')]);_0x461e0f[_0x6326('0x35')]=_[_0x6326('0x34')](_0x127744[_0x6326('0x31')],qs[_0x6326('0x36')](_0x40e036[_0x6326('0x32')][_0x6326('0x36')]));_0x461e0f[_0x6326('0x35')]=_0x461e0f['attributes'][_0x6326('0x37')]?_0x461e0f[_0x6326('0x35')]:_0x127744['model'];if(!_0x40e036[_0x6326('0x32')][_0x6326('0x38')](_0x6326('0x39'))){_0x461e0f['limit']=qs[_0x6326('0x3a')](_0x40e036['query']['limit']);_0x461e0f[_0x6326('0x1f')]=qs[_0x6326('0x1f')](_0x40e036[_0x6326('0x32')]['offset']);}_0x461e0f[_0x6326('0x3b')]=qs['sort'](_0x40e036[_0x6326('0x32')]['sort']);_0x461e0f[_0x6326('0x3c')]=qs[_0x6326('0x33')](_[_0x6326('0x3d')](_0x40e036[_0x6326('0x32')],_0x127744[_0x6326('0x33')]),_0x2a8873);if(_0x40e036[_0x6326('0x32')]['filter']){_0x461e0f[_0x6326('0x3c')]=_[_0x6326('0x3e')](_0x461e0f['where'],{'$or':_[_0x6326('0x2c')](_0x2a8873,function(_0x5ae140){if(_0x5ae140['type']!==_0x6326('0x3f')){var _0x1f8dcf={};_0x1f8dcf[_0x5ae140[_0x6326('0x29')]]={'$like':'%'+_0x40e036[_0x6326('0x32')][_0x6326('0x40')]+'%'};return _0x1f8dcf;}})});}_0x461e0f=_[_0x6326('0x3e')]({},_0x461e0f,_0x40e036['options']);var _0x485bed={'where':_0x461e0f[_0x6326('0x3c')]};return db['WhatsappQueueReport'][_0x6326('0x20')](_0x485bed)['then'](function(_0x282f33){_0x4980f6[_0x6326('0x20')]=_0x282f33;if(_0x40e036[_0x6326('0x32')][_0x6326('0x41')]){_0x461e0f[_0x6326('0x42')]=[{'all':!![]}];}return db[_0x6326('0x2d')][_0x6326('0x43')](_0x461e0f);})[_0x6326('0x25')](function(_0x3b089b){_0x4980f6[_0x6326('0x44')]=_0x3b089b;return _0x4980f6;})[_0x6326('0x25')](respondWithFilteredResult(_0x27802c,_0x461e0f))['catch'](handleError(_0x27802c,null));};exports[_0x6326('0x45')]=function(_0x5ce03a,_0x29f2fd){var _0x1d9d4c={'raw':!![],'where':{'id':_0x5ce03a[_0x6326('0x46')]['id']}},_0x16fc33={};_0x16fc33['model']=_[_0x6326('0x47')](db[_0x6326('0x2d')]['rawAttributes']);_0x16fc33[_0x6326('0x32')]=_[_0x6326('0x47')](_0x5ce03a[_0x6326('0x32')]);_0x16fc33[_0x6326('0x33')]=_['intersection'](_0x16fc33[_0x6326('0x31')],_0x16fc33[_0x6326('0x32')]);_0x1d9d4c[_0x6326('0x35')]=_[_0x6326('0x34')](_0x16fc33[_0x6326('0x31')],qs[_0x6326('0x36')](_0x5ce03a[_0x6326('0x32')]['fields']));_0x1d9d4c[_0x6326('0x35')]=_0x1d9d4c[_0x6326('0x35')][_0x6326('0x37')]?_0x1d9d4c[_0x6326('0x35')]:_0x16fc33['model'];if(_0x5ce03a[_0x6326('0x32')]['includeAll']){_0x1d9d4c[_0x6326('0x42')]=[{'all':!![]}];}_0x1d9d4c=_[_0x6326('0x3e')]({},_0x1d9d4c,_0x5ce03a[_0x6326('0x48')]);return db[_0x6326('0x2d')][_0x6326('0x49')](_0x1d9d4c)['then'](handleEntityNotFound(_0x29f2fd,null))[_0x6326('0x25')](respondWithResult(_0x29f2fd,null))['catch'](handleError(_0x29f2fd,null));};exports['create']=function(_0x2bca12,_0x44cf9d){return db['WhatsappQueueReport'][_0x6326('0x4a')](_0x2bca12[_0x6326('0x4b')],{})[_0x6326('0x25')](respondWithResult(_0x44cf9d,0xc9))[_0x6326('0x4c')](handleError(_0x44cf9d,null));};exports[_0x6326('0x24')]=function(_0x4f8dc0,_0x4af0ee){if(_0x4f8dc0[_0x6326('0x4b')]['id']){delete _0x4f8dc0[_0x6326('0x4b')]['id'];}return db[_0x6326('0x2d')][_0x6326('0x49')]({'where':{'id':_0x4f8dc0[_0x6326('0x46')]['id']}})[_0x6326('0x25')](handleEntityNotFound(_0x4af0ee,null))[_0x6326('0x25')](saveUpdates(_0x4f8dc0['body'],null))[_0x6326('0x25')](respondWithResult(_0x4af0ee,null))[_0x6326('0x4c')](handleError(_0x4af0ee,null));};exports[_0x6326('0x26')]=function(_0x3e7674,_0x1b5e9a){return db['WhatsappQueueReport'][_0x6326('0x49')]({'where':{'id':_0x3e7674['params']['id']}})[_0x6326('0x25')](handleEntityNotFound(_0x1b5e9a,null))[_0x6326('0x25')](removeEntity(_0x1b5e9a,null))['catch'](handleError(_0x1b5e9a,null));};exports[_0x6326('0x4d')]=function(_0x5040b1,_0xaa4c9d){return db[_0x6326('0x2d')][_0x6326('0x4d')]()[_0x6326('0x25')](respondWithResult(_0xaa4c9d,null))['catch'](handleError(_0xaa4c9d,null));}; \ No newline at end of file +var _0x1d2d=['options','WhatsappQueueReport','includeAll','findAll','catch','show','params','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge'];(function(_0x412ca9,_0x4d1676){var _0x2d7772=function(_0x30ce6a){while(--_0x30ce6a){_0x412ca9['push'](_0x412ca9['shift']());}};_0x2d7772(++_0x4d1676);}(_0x1d2d,0xf0));var _0xd1d2=function(_0x36cb95,_0x46a0e7){_0x36cb95=_0x36cb95-0x0;var _0x4e7348=_0x1d2d[_0x36cb95];return _0x4e7348;};'use strict';var emlformat=require(_0xd1d2('0x0'));var rimraf=require(_0xd1d2('0x1'));var zipdir=require(_0xd1d2('0x2'));var jsonpatch=require(_0xd1d2('0x3'));var rp=require(_0xd1d2('0x4'));var moment=require('moment');var BPromise=require(_0xd1d2('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd1d2('0x6'));var sox=require(_0xd1d2('0x7'));var csv=require(_0xd1d2('0x8'));var ejs=require(_0xd1d2('0x9'));var fs=require('fs');var fs_extra=require(_0xd1d2('0xa'));var _=require(_0xd1d2('0xb'));var squel=require('squel');var crypto=require(_0xd1d2('0xc'));var jsforce=require(_0xd1d2('0xd'));var deskjs=require(_0xd1d2('0xe'));var toCsv=require(_0xd1d2('0x8'));var querystring=require(_0xd1d2('0xf'));var Papa=require(_0xd1d2('0x10'));var Redis=require(_0xd1d2('0x11'));var authService=require(_0xd1d2('0x12'));var qs=require(_0xd1d2('0x13'));var as=require(_0xd1d2('0x14'));var hardwareService=require(_0xd1d2('0x15'));var logger=require(_0xd1d2('0x16'))(_0xd1d2('0x17'));var utils=require('../../config/utils');var config=require(_0xd1d2('0x18'));var licenseUtil=require(_0xd1d2('0x19'));var db=require(_0xd1d2('0x1a'))['db'];function respondWithStatusCode(_0x33f088,_0x129d8f){_0x129d8f=_0x129d8f||0xcc;return function(_0xc3ee82){if(_0xc3ee82){return _0x33f088[_0xd1d2('0x1b')](_0x129d8f);}return _0x33f088[_0xd1d2('0x1c')](_0x129d8f)[_0xd1d2('0x1d')]();};}function respondWithResult(_0x3f670f,_0x4cf702){_0x4cf702=_0x4cf702||0xc8;return function(_0x2e7fec){if(_0x2e7fec){return _0x3f670f[_0xd1d2('0x1c')](_0x4cf702)[_0xd1d2('0x1e')](_0x2e7fec);}};}function respondWithFilteredResult(_0x56de25,_0x35381b){return function(_0xc36ce){if(_0xc36ce){var _0x208425=typeof _0x35381b[_0xd1d2('0x1f')]===_0xd1d2('0x20')&&typeof _0x35381b[_0xd1d2('0x21')]===_0xd1d2('0x20');var _0x57f2f9=_0xc36ce['count'];var _0x3be186=_0x208425?0x0:_0x35381b['offset'];var _0x247b3a=_0x208425?_0xc36ce[_0xd1d2('0x22')]:_0x35381b[_0xd1d2('0x1f')]+_0x35381b[_0xd1d2('0x21')];var _0x4ab386;if(_0x247b3a>=_0x57f2f9){_0x247b3a=_0x57f2f9;_0x4ab386=0xc8;}else{_0x4ab386=0xce;}_0x56de25['status'](_0x4ab386);return _0x56de25[_0xd1d2('0x23')]('Content-Range',_0x3be186+'-'+_0x247b3a+'/'+_0x57f2f9)['json'](_0xc36ce);}return null;};}function patchUpdates(_0x1ab67c){return function(_0x27e26b){try{jsonpatch[_0xd1d2('0x24')](_0x27e26b,_0x1ab67c,!![]);}catch(_0x40170b){return BPromise['reject'](_0x40170b);}return _0x27e26b[_0xd1d2('0x25')]();};}function saveUpdates(_0xbb4d27,_0x24b8db){return function(_0x4eb082){if(_0x4eb082){return _0x4eb082['update'](_0xbb4d27)[_0xd1d2('0x26')](function(_0x3a1078){return _0x3a1078;});}return null;};}function removeEntity(_0x19d535,_0x2f92ee){return function(_0x3f229c){if(_0x3f229c){return _0x3f229c[_0xd1d2('0x27')]()[_0xd1d2('0x26')](function(){_0x19d535['status'](0xcc)[_0xd1d2('0x1d')]();});}};}function handleEntityNotFound(_0x42da6d,_0x41330f){return function(_0x2e1709){if(!_0x2e1709){_0x42da6d[_0xd1d2('0x1b')](0x194);}return _0x2e1709;};}function handleError(_0x39e991,_0x28b8be){_0x28b8be=_0x28b8be||0x1f4;return function(_0x34faf7){logger[_0xd1d2('0x28')](_0x34faf7[_0xd1d2('0x29')]);if(_0x34faf7[_0xd1d2('0x2a')]){delete _0x34faf7['name'];}_0x39e991['status'](_0x28b8be)[_0xd1d2('0x2b')](_0x34faf7);};}exports[_0xd1d2('0x2c')]=function(_0x1e6072,_0x2b4c1f){var _0xc815ea={},_0x48ade1={},_0x39d694={'count':0x0,'rows':[]};var _0x41171c=_[_0xd1d2('0x2d')](db['WhatsappQueueReport'][_0xd1d2('0x2e')],function(_0x1db17f){return{'name':_0x1db17f[_0xd1d2('0x2f')],'type':_0x1db17f['type'][_0xd1d2('0x30')]};});_0x48ade1[_0xd1d2('0x31')]=_[_0xd1d2('0x2d')](_0x41171c,_0xd1d2('0x2a'));_0x48ade1[_0xd1d2('0x32')]=_[_0xd1d2('0x33')](_0x1e6072[_0xd1d2('0x32')]);_0x48ade1[_0xd1d2('0x34')]=_[_0xd1d2('0x35')](_0x48ade1[_0xd1d2('0x31')],_0x48ade1[_0xd1d2('0x32')]);_0xc815ea[_0xd1d2('0x36')]=_[_0xd1d2('0x35')](_0x48ade1[_0xd1d2('0x31')],qs[_0xd1d2('0x37')](_0x1e6072[_0xd1d2('0x32')][_0xd1d2('0x37')]));_0xc815ea[_0xd1d2('0x36')]=_0xc815ea['attributes'][_0xd1d2('0x38')]?_0xc815ea[_0xd1d2('0x36')]:_0x48ade1[_0xd1d2('0x31')];if(!_0x1e6072['query'][_0xd1d2('0x39')]('nolimit')){_0xc815ea['limit']=qs[_0xd1d2('0x21')](_0x1e6072[_0xd1d2('0x32')][_0xd1d2('0x21')]);_0xc815ea[_0xd1d2('0x1f')]=qs[_0xd1d2('0x1f')](_0x1e6072[_0xd1d2('0x32')]['offset']);}_0xc815ea[_0xd1d2('0x3a')]=qs[_0xd1d2('0x3b')](_0x1e6072['query'][_0xd1d2('0x3b')]);_0xc815ea[_0xd1d2('0x3c')]=qs[_0xd1d2('0x34')](_[_0xd1d2('0x3d')](_0x1e6072['query'],_0x48ade1['filters']),_0x41171c);if(_0x1e6072[_0xd1d2('0x32')]['filter']){_0xc815ea['where']=_['merge'](_0xc815ea[_0xd1d2('0x3c')],{'$or':_['map'](_0x41171c,function(_0x3f4fd7){if(_0x3f4fd7['type']!=='VIRTUAL'){var _0x4bcea4={};_0x4bcea4[_0x3f4fd7[_0xd1d2('0x2a')]]={'$like':'%'+_0x1e6072[_0xd1d2('0x32')][_0xd1d2('0x3e')]+'%'};return _0x4bcea4;}})});}_0xc815ea=_[_0xd1d2('0x3f')]({},_0xc815ea,_0x1e6072[_0xd1d2('0x40')]);var _0xb5bec2={'where':_0xc815ea[_0xd1d2('0x3c')]};return db[_0xd1d2('0x41')][_0xd1d2('0x22')](_0xb5bec2)[_0xd1d2('0x26')](function(_0x2cedb4){_0x39d694[_0xd1d2('0x22')]=_0x2cedb4;if(_0x1e6072[_0xd1d2('0x32')][_0xd1d2('0x42')]){_0xc815ea['include']=[{'all':!![]}];}return db['WhatsappQueueReport'][_0xd1d2('0x43')](_0xc815ea);})[_0xd1d2('0x26')](function(_0x24fc93){_0x39d694['rows']=_0x24fc93;return _0x39d694;})['then'](respondWithFilteredResult(_0x2b4c1f,_0xc815ea))[_0xd1d2('0x44')](handleError(_0x2b4c1f,null));};exports[_0xd1d2('0x45')]=function(_0x4dc730,_0x2fe92a){var _0x4c5d49={'raw':!![],'where':{'id':_0x4dc730[_0xd1d2('0x46')]['id']}},_0x5a3790={};_0x5a3790['model']=_['keys'](db[_0xd1d2('0x41')][_0xd1d2('0x2e')]);_0x5a3790[_0xd1d2('0x32')]=_['keys'](_0x4dc730[_0xd1d2('0x32')]);_0x5a3790[_0xd1d2('0x34')]=_[_0xd1d2('0x35')](_0x5a3790[_0xd1d2('0x31')],_0x5a3790['query']);_0x4c5d49[_0xd1d2('0x36')]=_[_0xd1d2('0x35')](_0x5a3790['model'],qs[_0xd1d2('0x37')](_0x4dc730['query'][_0xd1d2('0x37')]));_0x4c5d49[_0xd1d2('0x36')]=_0x4c5d49[_0xd1d2('0x36')][_0xd1d2('0x38')]?_0x4c5d49[_0xd1d2('0x36')]:_0x5a3790['model'];if(_0x4dc730['query'][_0xd1d2('0x42')]){_0x4c5d49[_0xd1d2('0x47')]=[{'all':!![]}];}_0x4c5d49=_['merge']({},_0x4c5d49,_0x4dc730[_0xd1d2('0x40')]);return db[_0xd1d2('0x41')][_0xd1d2('0x48')](_0x4c5d49)[_0xd1d2('0x26')](handleEntityNotFound(_0x2fe92a,null))[_0xd1d2('0x26')](respondWithResult(_0x2fe92a,null))[_0xd1d2('0x44')](handleError(_0x2fe92a,null));};exports[_0xd1d2('0x49')]=function(_0x57c668,_0xed9e9){return db[_0xd1d2('0x41')]['create'](_0x57c668[_0xd1d2('0x4a')],{})[_0xd1d2('0x26')](respondWithResult(_0xed9e9,0xc9))['catch'](handleError(_0xed9e9,null));};exports['update']=function(_0x3d4fe3,_0x182ea8){if(_0x3d4fe3['body']['id']){delete _0x3d4fe3[_0xd1d2('0x4a')]['id'];}return db[_0xd1d2('0x41')][_0xd1d2('0x48')]({'where':{'id':_0x3d4fe3[_0xd1d2('0x46')]['id']}})[_0xd1d2('0x26')](handleEntityNotFound(_0x182ea8,null))['then'](saveUpdates(_0x3d4fe3['body'],null))[_0xd1d2('0x26')](respondWithResult(_0x182ea8,null))['catch'](handleError(_0x182ea8,null));};exports[_0xd1d2('0x27')]=function(_0xcd4b70,_0x4f4cb9){return db[_0xd1d2('0x41')][_0xd1d2('0x48')]({'where':{'id':_0xcd4b70['params']['id']}})['then'](handleEntityNotFound(_0x4f4cb9,null))[_0xd1d2('0x26')](removeEntity(_0x4f4cb9,null))[_0xd1d2('0x44')](handleError(_0x4f4cb9,null));};exports[_0xd1d2('0x4b')]=function(_0xfd8024,_0xa013ce){return db[_0xd1d2('0x41')][_0xd1d2('0x4b')]()[_0xd1d2('0x26')](respondWithResult(_0xa013ce,null))[_0xd1d2('0x44')](handleError(_0xa013ce,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 738065e..0784ec4 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 _0x4b4e=['./whatsappQueueReport.attributes','exports','define','uniqueid','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment'];(function(_0x2a2c3f,_0xbc7ac0){var _0x154fd3=function(_0xc6d215){while(--_0xc6d215){_0x2a2c3f['push'](_0x2a2c3f['shift']());}};_0x154fd3(++_0xbc7ac0);}(_0x4b4e,0x1d8));var _0xe4b4=function(_0x58bdb0,_0x3fd58a){_0x58bdb0=_0x58bdb0-0x0;var _0x2d77bc=_0x4b4e[_0x58bdb0];return _0x2d77bc;};'use strict';var _=require(_0xe4b4('0x0'));var util=require(_0xe4b4('0x1'));var logger=require(_0xe4b4('0x2'))(_0xe4b4('0x3'));var moment=require('moment');var BPromise=require(_0xe4b4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe4b4('0x5'));var rimraf=require(_0xe4b4('0x6'));var config=require(_0xe4b4('0x7'));var attributes=require(_0xe4b4('0x8'));module[_0xe4b4('0x9')]=function(_0x82c8a9,_0x22319d){return _0x82c8a9[_0xe4b4('0xa')]('WhatsappQueueReport',attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0xe4b4('0xb'),'fields':[_0xe4b4('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc6f4=['api','moment','bluebird','request-promise','path','rimraf','./whatsappQueueReport.attributes','exports','WhatsappQueueReport','report_whatsapp_queue','uniqueid','../../config/logger'];(function(_0x29f455,_0x365645){var _0xbb73c2=function(_0x957ad2){while(--_0x957ad2){_0x29f455['push'](_0x29f455['shift']());}};_0xbb73c2(++_0x365645);}(_0xc6f4,0x83));var _0x4c6f=function(_0x5b7975,_0x483a6f){_0x5b7975=_0x5b7975-0x0;var _0x2267a4=_0xc6f4[_0x5b7975];return _0x2267a4;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4c6f('0x0'))(_0x4c6f('0x1'));var moment=require(_0x4c6f('0x2'));var BPromise=require(_0x4c6f('0x3'));var rp=require(_0x4c6f('0x4'));var fs=require('fs');var path=require(_0x4c6f('0x5'));var rimraf=require(_0x4c6f('0x6'));var config=require('../../config/environment');var attributes=require(_0x4c6f('0x7'));module[_0x4c6f('0x8')]=function(_0x1f8fa6,_0x1bc9ed){return _0x1f8fa6['define'](_0x4c6f('0x9'),attributes,{'tableName':_0x4c6f('0xa'),'paranoid':![],'indexes':[{'name':_0x4c6f('0xb'),'fields':[_0x4c6f('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index aebed4f..ea95ea0 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 _0x4714=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','CreateWhatsappQueueReport','body','options','stringify','UpdateWhatsappQueueReport','raw','where','limit','util','moment','bluebird'];(function(_0x115f70,_0x18a247){var _0x251562=function(_0x29adcf){while(--_0x29adcf){_0x115f70['push'](_0x115f70['shift']());}};_0x251562(++_0x18a247);}(_0x4714,0x183));var _0x4471=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x4714[_0x42cae2];return _0x5f256f;};'use strict';var _=require('lodash');var util=require(_0x4471('0x0'));var moment=require(_0x4471('0x1'));var BPromise=require(_0x4471('0x2'));var rs=require(_0x4471('0x3'));var fs=require('fs');var Redis=require(_0x4471('0x4'));var db=require(_0x4471('0x5'))['db'];var utils=require(_0x4471('0x6'));var logger=require(_0x4471('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4471('0x8'));var client=jayson[_0x4471('0x9')][_0x4471('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3187bf,_0x5d081a,_0x864b73){return new BPromise(function(_0x4809d1,_0x9ba3e5){return client[_0x4471('0xb')](_0x3187bf,_0x864b73)[_0x4471('0xc')](function(_0x23fdc5){logger['info'](_0x4471('0xd'),_0x5d081a,_0x4471('0xe'));logger[_0x4471('0xf')](_0x4471('0x10'),_0x5d081a,_0x4471('0xe'),JSON['stringify'](_0x23fdc5));if(_0x23fdc5['error']){if(_0x23fdc5[_0x4471('0x11')]['code']===0x1f4){logger[_0x4471('0x11')](_0x4471('0xd'),_0x5d081a,_0x23fdc5['error'][_0x4471('0x12')]);return _0x9ba3e5(_0x23fdc5[_0x4471('0x11')]['message']);}logger[_0x4471('0x11')]('WhatsappQueueReport,\x20%s,\x20%s',_0x5d081a,_0x23fdc5['error'][_0x4471('0x12')]);return _0x4809d1(_0x23fdc5['error'][_0x4471('0x12')]);}else{logger[_0x4471('0x13')](_0x4471('0xd'),_0x5d081a,'request\x20sent');_0x4809d1(_0x23fdc5[_0x4471('0x14')]['message']);}})[_0x4471('0x15')](function(_0x32c9e6){logger[_0x4471('0x11')](_0x4471('0xd'),_0x5d081a,_0x32c9e6);_0x9ba3e5(_0x32c9e6);});});}exports[_0x4471('0x16')]=function(_0x5236e8){var _0x1bfc07=this;return new Promise(function(_0xf156be,_0xcfaf37){return db['WhatsappQueueReport']['create'](_0x5236e8[_0x4471('0x17')],{'raw':_0x5236e8[_0x4471('0x18')]?_0x5236e8[_0x4471('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x4471('0xc')](function(_0x32e5e5){logger[_0x4471('0x13')](_0x4471('0x16'),_0x5236e8);logger['debug']('CreateWhatsappQueueReport',_0x5236e8,JSON[_0x4471('0x19')](_0x32e5e5));_0xf156be(_0x32e5e5);})[_0x4471('0x15')](function(_0x143552){logger[_0x4471('0x11')](_0x4471('0x16'),_0x143552[_0x4471('0x12')],_0x5236e8);_0xcfaf37(_0x1bfc07[_0x4471('0x11')](0x1f4,_0x143552[_0x4471('0x12')]));});});};exports[_0x4471('0x1a')]=function(_0x295d51){var _0x586b02=this;return new Promise(function(_0x4fc82f,_0x44ec4a){return db['WhatsappQueueReport']['update'](_0x295d51[_0x4471('0x17')],{'raw':_0x295d51[_0x4471('0x18')]?_0x295d51[_0x4471('0x18')][_0x4471('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x295d51['options']?_0x295d51[_0x4471('0x18')][_0x4471('0x1c')]||null:null,'attributes':_0x295d51['options']?_0x295d51['options']['attributes']||null:null,'limit':_0x295d51['options']?_0x295d51[_0x4471('0x18')][_0x4471('0x1d')]||null:null})[_0x4471('0xc')](function(_0x23611f){logger[_0x4471('0x13')]('UpdateWhatsappQueueReport',_0x295d51);logger['debug'](_0x4471('0x1a'),_0x295d51,JSON[_0x4471('0x19')](_0x23611f));_0x4fc82f(_0x23611f);})['catch'](function(_0x488da9){logger[_0x4471('0x11')](_0x4471('0x1a'),_0x488da9['message'],_0x295d51);_0x44ec4a(_0x586b02[_0x4471('0x11')](0x1f4,_0x488da9[_0x4471('0x12')]));});});}; \ No newline at end of file +var _0x47a4=['where','UpdateWhatsappQueueReport','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','WhatsappQueueReport','create','raw','CreateWhatsappQueueReport','update','options'];(function(_0x4ebfa,_0x197d15){var _0x271f50=function(_0x5e6501){while(--_0x5e6501){_0x4ebfa['push'](_0x4ebfa['shift']());}};_0x271f50(++_0x197d15);}(_0x47a4,0x1a6));var _0x447a=function(_0xebf39,_0x2e4261){_0xebf39=_0xebf39-0x0;var _0x3ffc2f=_0x47a4[_0xebf39];return _0x3ffc2f;};'use strict';var _=require(_0x447a('0x0'));var util=require(_0x447a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x447a('0x2'));var fs=require('fs');var Redis=require(_0x447a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x447a('0x4'));var logger=require(_0x447a('0x5'))(_0x447a('0x6'));var config=require('../../config/environment');var jayson=require(_0x447a('0x7'));var client=jayson[_0x447a('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1c4ba7,_0x5a8723,_0x44182f){return new BPromise(function(_0x527f2e,_0xc8b125){return client[_0x447a('0x9')](_0x1c4ba7,_0x44182f)[_0x447a('0xa')](function(_0xd5cbfe){logger[_0x447a('0xb')](_0x447a('0xc'),_0x5a8723,_0x447a('0xd'));logger[_0x447a('0xe')](_0x447a('0xf'),_0x5a8723,_0x447a('0xd'),JSON[_0x447a('0x10')](_0xd5cbfe));if(_0xd5cbfe[_0x447a('0x11')]){if(_0xd5cbfe['error'][_0x447a('0x12')]===0x1f4){logger['error'](_0x447a('0xc'),_0x5a8723,_0xd5cbfe[_0x447a('0x11')]['message']);return _0xc8b125(_0xd5cbfe[_0x447a('0x11')]['message']);}logger[_0x447a('0x11')](_0x447a('0xc'),_0x5a8723,_0xd5cbfe['error'][_0x447a('0x13')]);return _0x527f2e(_0xd5cbfe['error'][_0x447a('0x13')]);}else{logger[_0x447a('0xb')](_0x447a('0xc'),_0x5a8723,_0x447a('0xd'));_0x527f2e(_0xd5cbfe[_0x447a('0x14')]['message']);}})[_0x447a('0x15')](function(_0x258786){logger[_0x447a('0x11')](_0x447a('0xc'),_0x5a8723,_0x258786);_0xc8b125(_0x258786);});});}exports['CreateWhatsappQueueReport']=function(_0x4aed54){var _0x475cd3=this;return new Promise(function(_0x12e4b7,_0x444e31){return db[_0x447a('0x16')][_0x447a('0x17')](_0x4aed54['body'],{'raw':_0x4aed54['options']?_0x4aed54['options'][_0x447a('0x18')]===undefined?!![]:![]:!![]})[_0x447a('0xa')](function(_0x200763){logger[_0x447a('0xb')](_0x447a('0x19'),_0x4aed54);logger[_0x447a('0xe')](_0x447a('0x19'),_0x4aed54,JSON[_0x447a('0x10')](_0x200763));_0x12e4b7(_0x200763);})[_0x447a('0x15')](function(_0x4851c9){logger[_0x447a('0x11')](_0x447a('0x19'),_0x4851c9[_0x447a('0x13')],_0x4aed54);_0x444e31(_0x475cd3[_0x447a('0x11')](0x1f4,_0x4851c9['message']));});});};exports['UpdateWhatsappQueueReport']=function(_0x10c97a){var _0x1f5522=this;return new Promise(function(_0x531f24,_0x3ec177){return db[_0x447a('0x16')][_0x447a('0x1a')](_0x10c97a['body'],{'raw':_0x10c97a[_0x447a('0x1b')]?_0x10c97a[_0x447a('0x1b')][_0x447a('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x10c97a[_0x447a('0x1b')]?_0x10c97a['options'][_0x447a('0x1c')]||null:null,'attributes':_0x10c97a[_0x447a('0x1b')]?_0x10c97a[_0x447a('0x1b')]['attributes']||null:null,'limit':_0x10c97a[_0x447a('0x1b')]?_0x10c97a['options']['limit']||null:null})['then'](function(_0x148a15){logger[_0x447a('0xb')](_0x447a('0x1d'),_0x10c97a);logger[_0x447a('0xe')](_0x447a('0x1d'),_0x10c97a,JSON[_0x447a('0x10')](_0x148a15));_0x531f24(_0x148a15);})['catch'](function(_0x51d24b){logger['error'](_0x447a('0x1d'),_0x51d24b[_0x447a('0x13')],_0x10c97a);_0x3ec177(_0x1f5522[_0x447a('0x11')](0x1f4,_0x51d24b[_0x447a('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 2b19efc..7f7bf7d 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 _0x45f6=['get','isAuthenticated','index','/describe','describe','/:id','post','create','update','delete','destroy','exports','path','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller'];(function(_0x3661da,_0x24153a){var _0xbccb74=function(_0x225583){while(--_0x225583){_0x3661da['push'](_0x3661da['shift']());}};_0xbccb74(++_0x24153a);}(_0x45f6,0x1c6));var _0x645f=function(_0x514c15,_0x486901){_0x514c15=_0x514c15-0x0;var _0x16283e=_0x45f6[_0x514c15];return _0x16283e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x645f('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x645f('0x1'));var interaction=require(_0x645f('0x2'));var config=require(_0x645f('0x3'));var controller=require(_0x645f('0x4'));router[_0x645f('0x5')]('/',auth[_0x645f('0x6')](),controller[_0x645f('0x7')]);router[_0x645f('0x5')](_0x645f('0x8'),auth[_0x645f('0x6')](),controller[_0x645f('0x9')]);router[_0x645f('0x5')](_0x645f('0xa'),auth[_0x645f('0x6')](),controller['show']);router[_0x645f('0xb')]('/',auth[_0x645f('0x6')](),controller[_0x645f('0xc')]);router['put']('/:id',auth[_0x645f('0x6')](),controller[_0x645f('0xd')]);router[_0x645f('0xe')](_0x645f('0xa'),auth[_0x645f('0x6')](),controller[_0x645f('0xf')]);module[_0x645f('0x10')]=router; \ No newline at end of file +var _0x1262=['show','post','create','update','delete','destroy','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','/describe','isAuthenticated','describe','/:id'];(function(_0x492221,_0x9e2521){var _0x398bf9=function(_0x303c5b){while(--_0x303c5b){_0x492221['push'](_0x492221['shift']());}};_0x398bf9(++_0x9e2521);}(_0x1262,0x138));var _0x2126=function(_0x383903,_0x42e1ac){_0x383903=_0x383903-0x0;var _0x1c1dbf=_0x1262[_0x383903];return _0x1c1dbf;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x2126('0x0'));var express=require(_0x2126('0x1'));var router=express[_0x2126('0x2')]();var fs_extra=require(_0x2126('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x2126('0x4'));var config=require(_0x2126('0x5'));var controller=require(_0x2126('0x6'));router[_0x2126('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x2126('0x7')](_0x2126('0x8'),auth[_0x2126('0x9')](),controller[_0x2126('0xa')]);router[_0x2126('0x7')](_0x2126('0xb'),auth[_0x2126('0x9')](),controller[_0x2126('0xc')]);router[_0x2126('0xd')]('/',auth[_0x2126('0x9')](),controller[_0x2126('0xe')]);router['put'](_0x2126('0xb'),auth['isAuthenticated'](),controller[_0x2126('0xf')]);router[_0x2126('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x2126('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index f7a25e4..3c2a3ea 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 _0xa5c9=['exports','STRING','ENUM','queue','DATE','sequelize'];(function(_0x59b3b2,_0x1a4853){var _0x5d2e1c=function(_0x5e4366){while(--_0x5e4366){_0x59b3b2['push'](_0x59b3b2['shift']());}};_0x5d2e1c(++_0x1a4853);}(_0xa5c9,0x143));var _0x9a5c=function(_0x2ca2d0,_0x3ea8e4){_0x2ca2d0=_0x2ca2d0-0x0;var _0x521c23=_0xa5c9[_0x2ca2d0];return _0x521c23;};'use strict';var Sequelize=require(_0x9a5c('0x0'));module[_0x9a5c('0x1')]={'uniqueid':{'type':Sequelize[_0x9a5c('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9a5c('0x3')]('account','agent',_0x9a5c('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x9a5c('0x5')]}}; \ No newline at end of file +var _0x73a1=['agent','queue','DATE','STRING','ENUM'];(function(_0xff9c5c,_0x59479b){var _0x26ba8e=function(_0x51e948){while(--_0x51e948){_0xff9c5c['push'](_0xff9c5c['shift']());}};_0x26ba8e(++_0x59479b);}(_0x73a1,0x161));var _0x173a=function(_0x510c60,_0x50247e){_0x510c60=_0x510c60-0x0;var _0x49c4aa=_0x73a1[_0x510c60];return _0x49c4aa;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x173a('0x0')],'allowNull':![]},'type':{'type':Sequelize[_0x173a('0x1')]('account',_0x173a('0x2'),_0x173a('0x3')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x173a('0x4')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 19dd630..1dfd06d 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 _0x2de3=['ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','destroy','end','error','name','index','map','WhatsappTransferReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','find','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','desk.js','querystring'];(function(_0x3838a4,_0x2ae1e6){var _0x3c56b4=function(_0x4cbf64){while(--_0x4cbf64){_0x3838a4['push'](_0x3838a4['shift']());}};_0x3c56b4(++_0x2ae1e6);}(_0x2de3,0x150));var _0x32de=function(_0x2235d9,_0x12d695){_0x2235d9=_0x2235d9-0x0;var _0x1b6a97=_0x2de3[_0x2235d9];return _0x1b6a97;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x32de('0x0'));var zipdir=require(_0x32de('0x1'));var jsonpatch=require(_0x32de('0x2'));var rp=require(_0x32de('0x3'));var moment=require(_0x32de('0x4'));var BPromise=require(_0x32de('0x5'));var Mustache=require(_0x32de('0x6'));var util=require('util');var path=require(_0x32de('0x7'));var sox=require(_0x32de('0x8'));var csv=require(_0x32de('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x32de('0xa'));var squel=require(_0x32de('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x32de('0xc'));var toCsv=require('to-csv');var querystring=require(_0x32de('0xd'));var Papa=require('papaparse');var Redis=require(_0x32de('0xe'));var authService=require(_0x32de('0xf'));var qs=require(_0x32de('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x32de('0x11'))(_0x32de('0x12'));var utils=require(_0x32de('0x13'));var config=require(_0x32de('0x14'));var licenseUtil=require(_0x32de('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x34f2b4,_0x1c14f9){_0x1c14f9=_0x1c14f9||0xcc;return function(_0x408afa){if(_0x408afa){return _0x34f2b4[_0x32de('0x16')](_0x1c14f9);}return _0x34f2b4['status'](_0x1c14f9)['end']();};}function respondWithResult(_0x53fa3a,_0x86457a){_0x86457a=_0x86457a||0xc8;return function(_0x39df6b){if(_0x39df6b){return _0x53fa3a[_0x32de('0x17')](_0x86457a)[_0x32de('0x18')](_0x39df6b);}};}function respondWithFilteredResult(_0x31e0de,_0x5c868f){return function(_0x2e9233){if(_0x2e9233){var _0x9e2050=typeof _0x5c868f['offset']===_0x32de('0x19')&&typeof _0x5c868f[_0x32de('0x1a')]===_0x32de('0x19');var _0x539113=_0x2e9233[_0x32de('0x1b')];var _0x589b74=_0x9e2050?0x0:_0x5c868f[_0x32de('0x1c')];var _0x4be62e=_0x9e2050?_0x2e9233['count']:_0x5c868f['offset']+_0x5c868f[_0x32de('0x1a')];var _0x5665aa;if(_0x4be62e>=_0x539113){_0x4be62e=_0x539113;_0x5665aa=0xc8;}else{_0x5665aa=0xce;}_0x31e0de[_0x32de('0x17')](_0x5665aa);return _0x31e0de[_0x32de('0x1d')](_0x32de('0x1e'),_0x589b74+'-'+_0x4be62e+'/'+_0x539113)[_0x32de('0x18')](_0x2e9233);}return null;};}function patchUpdates(_0x2a8a9e){return function(_0x43724a){try{jsonpatch[_0x32de('0x1f')](_0x43724a,_0x2a8a9e,!![]);}catch(_0x58865a){return BPromise['reject'](_0x58865a);}return _0x43724a[_0x32de('0x20')]();};}function saveUpdates(_0x27104f,_0x27d589){return function(_0xf806c8){if(_0xf806c8){return _0xf806c8[_0x32de('0x21')](_0x27104f)[_0x32de('0x22')](function(_0x3b532d){return _0x3b532d;});}return null;};}function removeEntity(_0x557b56,_0x5b8c44){return function(_0x5a6339){if(_0x5a6339){return _0x5a6339[_0x32de('0x23')]()[_0x32de('0x22')](function(){_0x557b56[_0x32de('0x17')](0xcc)[_0x32de('0x24')]();});}};}function handleEntityNotFound(_0x22ed22,_0x437f1d){return function(_0x1df91d){if(!_0x1df91d){_0x22ed22['sendStatus'](0x194);}return _0x1df91d;};}function handleError(_0x1885aa,_0x3116a8){_0x3116a8=_0x3116a8||0x1f4;return function(_0x29d0ef){logger[_0x32de('0x25')](_0x29d0ef['stack']);if(_0x29d0ef[_0x32de('0x26')]){delete _0x29d0ef[_0x32de('0x26')];}_0x1885aa[_0x32de('0x17')](_0x3116a8)['send'](_0x29d0ef);};}exports[_0x32de('0x27')]=function(_0x125533,_0x8e1f84){var _0x55948b={},_0x3eac53={},_0x349d65={'count':0x0,'rows':[]};var _0x48cc58=_[_0x32de('0x28')](db[_0x32de('0x29')][_0x32de('0x2a')],function(_0x5a5a8d){return{'name':_0x5a5a8d[_0x32de('0x2b')],'type':_0x5a5a8d[_0x32de('0x2c')][_0x32de('0x2d')]};});_0x3eac53[_0x32de('0x2e')]=_[_0x32de('0x28')](_0x48cc58,_0x32de('0x26'));_0x3eac53[_0x32de('0x2f')]=_[_0x32de('0x30')](_0x125533['query']);_0x3eac53['filters']=_[_0x32de('0x31')](_0x3eac53[_0x32de('0x2e')],_0x3eac53[_0x32de('0x2f')]);_0x55948b[_0x32de('0x32')]=_['intersection'](_0x3eac53[_0x32de('0x2e')],qs[_0x32de('0x33')](_0x125533[_0x32de('0x2f')]['fields']));_0x55948b['attributes']=_0x55948b[_0x32de('0x32')][_0x32de('0x34')]?_0x55948b[_0x32de('0x32')]:_0x3eac53[_0x32de('0x2e')];if(!_0x125533[_0x32de('0x2f')]['hasOwnProperty'](_0x32de('0x35'))){_0x55948b[_0x32de('0x1a')]=qs[_0x32de('0x1a')](_0x125533[_0x32de('0x2f')][_0x32de('0x1a')]);_0x55948b[_0x32de('0x1c')]=qs[_0x32de('0x1c')](_0x125533[_0x32de('0x2f')][_0x32de('0x1c')]);}_0x55948b[_0x32de('0x36')]=qs[_0x32de('0x37')](_0x125533[_0x32de('0x2f')][_0x32de('0x37')]);_0x55948b[_0x32de('0x38')]=qs[_0x32de('0x39')](_['pick'](_0x125533[_0x32de('0x2f')],_0x3eac53[_0x32de('0x39')]),_0x48cc58);if(_0x125533['query'][_0x32de('0x3a')]){_0x55948b[_0x32de('0x38')]=_['merge'](_0x55948b[_0x32de('0x38')],{'$or':_['map'](_0x48cc58,function(_0x3f3093){if(_0x3f3093[_0x32de('0x2c')]!==_0x32de('0x3b')){var _0x46385d={};_0x46385d[_0x3f3093[_0x32de('0x26')]]={'$like':'%'+_0x125533[_0x32de('0x2f')]['filter']+'%'};return _0x46385d;}})});}_0x55948b=_[_0x32de('0x3c')]({},_0x55948b,_0x125533[_0x32de('0x3d')]);var _0x2a5699={'where':_0x55948b[_0x32de('0x38')]};return db[_0x32de('0x29')][_0x32de('0x1b')](_0x2a5699)[_0x32de('0x22')](function(_0x4173d8){_0x349d65[_0x32de('0x1b')]=_0x4173d8;if(_0x125533[_0x32de('0x2f')][_0x32de('0x3e')]){_0x55948b[_0x32de('0x3f')]=[{'all':!![]}];}return db[_0x32de('0x29')][_0x32de('0x40')](_0x55948b);})[_0x32de('0x22')](function(_0x36d0e2){_0x349d65[_0x32de('0x41')]=_0x36d0e2;return _0x349d65;})[_0x32de('0x22')](respondWithFilteredResult(_0x8e1f84,_0x55948b))[_0x32de('0x42')](handleError(_0x8e1f84,null));};exports['show']=function(_0x1e9ea1,_0x194825){var _0x11b5a4={'raw':!![],'where':{'id':_0x1e9ea1[_0x32de('0x43')]['id']}},_0x3ace34={};_0x3ace34[_0x32de('0x2e')]=_[_0x32de('0x30')](db['WhatsappTransferReport'][_0x32de('0x2a')]);_0x3ace34[_0x32de('0x2f')]=_['keys'](_0x1e9ea1['query']);_0x3ace34[_0x32de('0x39')]=_[_0x32de('0x31')](_0x3ace34['model'],_0x3ace34[_0x32de('0x2f')]);_0x11b5a4[_0x32de('0x32')]=_[_0x32de('0x31')](_0x3ace34[_0x32de('0x2e')],qs[_0x32de('0x33')](_0x1e9ea1[_0x32de('0x2f')]['fields']));_0x11b5a4[_0x32de('0x32')]=_0x11b5a4[_0x32de('0x32')][_0x32de('0x34')]?_0x11b5a4['attributes']:_0x3ace34[_0x32de('0x2e')];if(_0x1e9ea1[_0x32de('0x2f')][_0x32de('0x3e')]){_0x11b5a4[_0x32de('0x3f')]=[{'all':!![]}];}_0x11b5a4=_[_0x32de('0x3c')]({},_0x11b5a4,_0x1e9ea1[_0x32de('0x3d')]);return db['WhatsappTransferReport'][_0x32de('0x44')](_0x11b5a4)[_0x32de('0x22')](handleEntityNotFound(_0x194825,null))[_0x32de('0x22')](respondWithResult(_0x194825,null))['catch'](handleError(_0x194825,null));};exports['create']=function(_0x59deb4,_0x27b901){return db['WhatsappTransferReport']['create'](_0x59deb4['body'],{})[_0x32de('0x22')](respondWithResult(_0x27b901,0xc9))[_0x32de('0x42')](handleError(_0x27b901,null));};exports[_0x32de('0x21')]=function(_0x18d552,_0x432bc4){if(_0x18d552['body']['id']){delete _0x18d552['body']['id'];}return db['WhatsappTransferReport']['find']({'where':{'id':_0x18d552[_0x32de('0x43')]['id']}})[_0x32de('0x22')](handleEntityNotFound(_0x432bc4,null))[_0x32de('0x22')](saveUpdates(_0x18d552['body'],null))['then'](respondWithResult(_0x432bc4,null))[_0x32de('0x42')](handleError(_0x432bc4,null));};exports[_0x32de('0x23')]=function(_0x2e8e14,_0x5ac094){return db[_0x32de('0x29')][_0x32de('0x44')]({'where':{'id':_0x2e8e14['params']['id']}})[_0x32de('0x22')](handleEntityNotFound(_0x5ac094,null))[_0x32de('0x22')](removeEntity(_0x5ac094,null))[_0x32de('0x42')](handleError(_0x5ac094,null));};exports[_0x32de('0x45')]=function(_0x15e420,_0x2d97c6){return db['WhatsappTransferReport']['describe']()[_0x32de('0x22')](respondWithResult(_0x2d97c6,null))[_0x32de('0x42')](handleError(_0x2d97c6,null));}; \ No newline at end of file +var _0x098f=['show','params','rawAttributes','length','body','describe','zip-dir','fast-json-patch','request-promise','bluebird','mustache','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','end','json','offset','count','limit','status','set','Content-Range','reject','save','update','destroy','then','error','stack','name','send','index','WhatsappTransferReport','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch'];(function(_0x41059a,_0x4df43f){var _0x574108=function(_0x41880a){while(--_0x41880a){_0x41059a['push'](_0x41059a['shift']());}};_0x574108(++_0x4df43f);}(_0x098f,0x1c8));var _0xf098=function(_0x648edd,_0x62d8f4){_0x648edd=_0x648edd-0x0;var _0x48d623=_0x098f[_0x648edd];return _0x48d623;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf098('0x0'));var jsonpatch=require(_0xf098('0x1'));var rp=require(_0xf098('0x2'));var moment=require('moment');var BPromise=require(_0xf098('0x3'));var Mustache=require(_0xf098('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf098('0x5'));var fs=require('fs');var fs_extra=require(_0xf098('0x6'));var _=require(_0xf098('0x7'));var squel=require(_0xf098('0x8'));var crypto=require(_0xf098('0x9'));var jsforce=require(_0xf098('0xa'));var deskjs=require(_0xf098('0xb'));var toCsv=require(_0xf098('0xc'));var querystring=require(_0xf098('0xd'));var Papa=require(_0xf098('0xe'));var Redis=require(_0xf098('0xf'));var authService=require(_0xf098('0x10'));var qs=require(_0xf098('0x11'));var as=require(_0xf098('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf098('0x13'))(_0xf098('0x14'));var utils=require(_0xf098('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf098('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a8014,_0x2b2364){_0x2b2364=_0x2b2364||0xcc;return function(_0x3b4af8){if(_0x3b4af8){return _0x1a8014[_0xf098('0x17')](_0x2b2364);}return _0x1a8014['status'](_0x2b2364)[_0xf098('0x18')]();};}function respondWithResult(_0x188749,_0x425bb1){_0x425bb1=_0x425bb1||0xc8;return function(_0x4e156d){if(_0x4e156d){return _0x188749['status'](_0x425bb1)[_0xf098('0x19')](_0x4e156d);}};}function respondWithFilteredResult(_0x315d87,_0x337c96){return function(_0x133eef){if(_0x133eef){var _0x9bc14c=typeof _0x337c96[_0xf098('0x1a')]==='undefined'&&typeof _0x337c96['limit']==='undefined';var _0x4eab93=_0x133eef['count'];var _0x2b6f5b=_0x9bc14c?0x0:_0x337c96[_0xf098('0x1a')];var _0x129f27=_0x9bc14c?_0x133eef[_0xf098('0x1b')]:_0x337c96['offset']+_0x337c96[_0xf098('0x1c')];var _0x541bed;if(_0x129f27>=_0x4eab93){_0x129f27=_0x4eab93;_0x541bed=0xc8;}else{_0x541bed=0xce;}_0x315d87[_0xf098('0x1d')](_0x541bed);return _0x315d87[_0xf098('0x1e')](_0xf098('0x1f'),_0x2b6f5b+'-'+_0x129f27+'/'+_0x4eab93)[_0xf098('0x19')](_0x133eef);}return null;};}function patchUpdates(_0x1b07da){return function(_0x4b6370){try{jsonpatch['apply'](_0x4b6370,_0x1b07da,!![]);}catch(_0x2eb829){return BPromise[_0xf098('0x20')](_0x2eb829);}return _0x4b6370[_0xf098('0x21')]();};}function saveUpdates(_0x2ab9b5,_0x2cd1b1){return function(_0x38614d){if(_0x38614d){return _0x38614d[_0xf098('0x22')](_0x2ab9b5)['then'](function(_0x519755){return _0x519755;});}return null;};}function removeEntity(_0x98c692,_0x25f278){return function(_0x46e200){if(_0x46e200){return _0x46e200[_0xf098('0x23')]()[_0xf098('0x24')](function(){_0x98c692[_0xf098('0x1d')](0xcc)[_0xf098('0x18')]();});}};}function handleEntityNotFound(_0x55eaf8,_0x553dcb){return function(_0x1069c2){if(!_0x1069c2){_0x55eaf8[_0xf098('0x17')](0x194);}return _0x1069c2;};}function handleError(_0x38ba5e,_0x509b1d){_0x509b1d=_0x509b1d||0x1f4;return function(_0x29f8ea){logger[_0xf098('0x25')](_0x29f8ea[_0xf098('0x26')]);if(_0x29f8ea[_0xf098('0x27')]){delete _0x29f8ea['name'];}_0x38ba5e['status'](_0x509b1d)[_0xf098('0x28')](_0x29f8ea);};}exports[_0xf098('0x29')]=function(_0x442090,_0x47d6d2){var _0x1b1e92={},_0x54fd06={},_0x3850ea={'count':0x0,'rows':[]};var _0x905927=_['map'](db[_0xf098('0x2a')]['rawAttributes'],function(_0x3e96ae){return{'name':_0x3e96ae[_0xf098('0x2b')],'type':_0x3e96ae[_0xf098('0x2c')][_0xf098('0x2d')]};});_0x54fd06[_0xf098('0x2e')]=_[_0xf098('0x2f')](_0x905927,'name');_0x54fd06[_0xf098('0x30')]=_[_0xf098('0x31')](_0x442090[_0xf098('0x30')]);_0x54fd06[_0xf098('0x32')]=_[_0xf098('0x33')](_0x54fd06['model'],_0x54fd06['query']);_0x1b1e92['attributes']=_[_0xf098('0x33')](_0x54fd06['model'],qs[_0xf098('0x34')](_0x442090['query']['fields']));_0x1b1e92[_0xf098('0x35')]=_0x1b1e92['attributes']['length']?_0x1b1e92[_0xf098('0x35')]:_0x54fd06[_0xf098('0x2e')];if(!_0x442090[_0xf098('0x30')][_0xf098('0x36')](_0xf098('0x37'))){_0x1b1e92[_0xf098('0x1c')]=qs[_0xf098('0x1c')](_0x442090['query']['limit']);_0x1b1e92[_0xf098('0x1a')]=qs['offset'](_0x442090[_0xf098('0x30')][_0xf098('0x1a')]);}_0x1b1e92[_0xf098('0x38')]=qs[_0xf098('0x39')](_0x442090[_0xf098('0x30')]['sort']);_0x1b1e92['where']=qs[_0xf098('0x32')](_[_0xf098('0x3a')](_0x442090[_0xf098('0x30')],_0x54fd06[_0xf098('0x32')]),_0x905927);if(_0x442090[_0xf098('0x30')][_0xf098('0x3b')]){_0x1b1e92[_0xf098('0x3c')]=_[_0xf098('0x3d')](_0x1b1e92['where'],{'$or':_['map'](_0x905927,function(_0x1dea0e){if(_0x1dea0e[_0xf098('0x2c')]!==_0xf098('0x3e')){var _0x4a4844={};_0x4a4844[_0x1dea0e[_0xf098('0x27')]]={'$like':'%'+_0x442090[_0xf098('0x30')][_0xf098('0x3b')]+'%'};return _0x4a4844;}})});}_0x1b1e92=_['merge']({},_0x1b1e92,_0x442090[_0xf098('0x3f')]);var _0x273453={'where':_0x1b1e92['where']};return db[_0xf098('0x2a')]['count'](_0x273453)['then'](function(_0x46d66a){_0x3850ea[_0xf098('0x1b')]=_0x46d66a;if(_0x442090[_0xf098('0x30')][_0xf098('0x40')]){_0x1b1e92[_0xf098('0x41')]=[{'all':!![]}];}return db[_0xf098('0x2a')][_0xf098('0x42')](_0x1b1e92);})[_0xf098('0x24')](function(_0x2f7145){_0x3850ea[_0xf098('0x43')]=_0x2f7145;return _0x3850ea;})['then'](respondWithFilteredResult(_0x47d6d2,_0x1b1e92))[_0xf098('0x44')](handleError(_0x47d6d2,null));};exports[_0xf098('0x45')]=function(_0x1cd425,_0x381bfa){var _0x3679ab={'raw':!![],'where':{'id':_0x1cd425[_0xf098('0x46')]['id']}},_0x95e396={};_0x95e396[_0xf098('0x2e')]=_[_0xf098('0x31')](db[_0xf098('0x2a')][_0xf098('0x47')]);_0x95e396[_0xf098('0x30')]=_[_0xf098('0x31')](_0x1cd425['query']);_0x95e396[_0xf098('0x32')]=_[_0xf098('0x33')](_0x95e396[_0xf098('0x2e')],_0x95e396['query']);_0x3679ab[_0xf098('0x35')]=_[_0xf098('0x33')](_0x95e396['model'],qs['fields'](_0x1cd425[_0xf098('0x30')]['fields']));_0x3679ab['attributes']=_0x3679ab[_0xf098('0x35')][_0xf098('0x48')]?_0x3679ab[_0xf098('0x35')]:_0x95e396['model'];if(_0x1cd425[_0xf098('0x30')][_0xf098('0x40')]){_0x3679ab['include']=[{'all':!![]}];}_0x3679ab=_['merge']({},_0x3679ab,_0x1cd425[_0xf098('0x3f')]);return db['WhatsappTransferReport']['find'](_0x3679ab)[_0xf098('0x24')](handleEntityNotFound(_0x381bfa,null))[_0xf098('0x24')](respondWithResult(_0x381bfa,null))['catch'](handleError(_0x381bfa,null));};exports['create']=function(_0x293260,_0x17abb0){return db[_0xf098('0x2a')]['create'](_0x293260['body'],{})[_0xf098('0x24')](respondWithResult(_0x17abb0,0xc9))['catch'](handleError(_0x17abb0,null));};exports[_0xf098('0x22')]=function(_0x37bc70,_0x38ee14){if(_0x37bc70[_0xf098('0x49')]['id']){delete _0x37bc70['body']['id'];}return db[_0xf098('0x2a')]['find']({'where':{'id':_0x37bc70['params']['id']}})[_0xf098('0x24')](handleEntityNotFound(_0x38ee14,null))[_0xf098('0x24')](saveUpdates(_0x37bc70[_0xf098('0x49')],null))[_0xf098('0x24')](respondWithResult(_0x38ee14,null))['catch'](handleError(_0x38ee14,null));};exports[_0xf098('0x23')]=function(_0x128f69,_0x40677e){return db['WhatsappTransferReport']['find']({'where':{'id':_0x128f69['params']['id']}})[_0xf098('0x24')](handleEntityNotFound(_0x40677e,null))[_0xf098('0x24')](removeEntity(_0x40677e,null))[_0xf098('0x44')](handleError(_0x40677e,null));};exports[_0xf098('0x4a')]=function(_0x52a47b,_0x33382b){return db['WhatsappTransferReport'][_0xf098('0x4a')]()[_0xf098('0x24')](respondWithResult(_0x33382b,null))[_0xf098('0x44')](handleError(_0x33382b,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 156ed3a..c97df44 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 _0x8ddc=['WhatsappTransferReport','uniqueid','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x3d65d0,_0x742683){var _0x391c00=function(_0x536c7d){while(--_0x536c7d){_0x3d65d0['push'](_0x3d65d0['shift']());}};_0x391c00(++_0x742683);}(_0x8ddc,0x152));var _0xc8dd=function(_0x45346d,_0xffd56b){_0x45346d=_0x45346d-0x0;var _0x5ce7ca=_0x8ddc[_0x45346d];return _0x5ce7ca;};'use strict';var _=require(_0xc8dd('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc8dd('0x1'));var moment=require(_0xc8dd('0x2'));var BPromise=require(_0xc8dd('0x3'));var rp=require(_0xc8dd('0x4'));var fs=require('fs');var path=require(_0xc8dd('0x5'));var rimraf=require(_0xc8dd('0x6'));var config=require(_0xc8dd('0x7'));var attributes=require('./whatsappTransferReport.attributes');module[_0xc8dd('0x8')]=function(_0x5bf4ce,_0x556f6d){return _0x5bf4ce[_0xc8dd('0x9')](_0xc8dd('0xa'),attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':_0xc8dd('0xb'),'fields':[_0xc8dd('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3aae=['rimraf','../../config/environment','./whatsappTransferReport.attributes','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','util','request-promise','path'];(function(_0x152121,_0x120c53){var _0x592a85=function(_0x241cab){while(--_0x241cab){_0x152121['push'](_0x152121['shift']());}};_0x592a85(++_0x120c53);}(_0x3aae,0x1d5));var _0xe3aa=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x3aae[_0x432682];return _0x463d05;};'use strict';var _=require(_0xe3aa('0x0'));var util=require(_0xe3aa('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe3aa('0x2'));var fs=require('fs');var path=require(_0xe3aa('0x3'));var rimraf=require(_0xe3aa('0x4'));var config=require(_0xe3aa('0x5'));var attributes=require(_0xe3aa('0x6'));module['exports']=function(_0x2c2a69,_0x4465e1){return _0x2c2a69[_0xe3aa('0x7')](_0xe3aa('0x8'),attributes,{'tableName':_0xe3aa('0x9'),'paranoid':![],'indexes':[{'name':_0xe3aa('0xa'),'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 9884d1f..6bdd577 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 _0x5d08=['http','request','info','request\x20sent','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappTransferReport,\x20%s,\x20%s','message','result','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x50dd0c,_0x23e831){var _0x111a82=function(_0x4b8911){while(--_0x4b8911){_0x50dd0c['push'](_0x50dd0c['shift']());}};_0x111a82(++_0x23e831);}(_0x5d08,0xd3));var _0x85d0=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x5d08[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x85d0('0x0'));var util=require('util');var moment=require(_0x85d0('0x1'));var BPromise=require(_0x85d0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x85d0('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x85d0('0x4'));var logger=require(_0x85d0('0x5'))('rpc');var config=require(_0x85d0('0x6'));var jayson=require(_0x85d0('0x7'));var client=jayson[_0x85d0('0x8')][_0x85d0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x105bd4,_0x463a7a,_0x15cfd8){return new BPromise(function(_0x287a39,_0x4a8bc3){return client[_0x85d0('0xa')](_0x105bd4,_0x15cfd8)['then'](function(_0x3757f7){logger[_0x85d0('0xb')]('WhatsappTransferReport,\x20%s,\x20%s',_0x463a7a,_0x85d0('0xc'));logger['debug'](_0x85d0('0xd'),_0x463a7a,_0x85d0('0xc'),JSON[_0x85d0('0xe')](_0x3757f7));if(_0x3757f7['error']){if(_0x3757f7[_0x85d0('0xf')][_0x85d0('0x10')]===0x1f4){logger[_0x85d0('0xf')](_0x85d0('0x11'),_0x463a7a,_0x3757f7['error'][_0x85d0('0x12')]);return _0x4a8bc3(_0x3757f7['error'][_0x85d0('0x12')]);}logger[_0x85d0('0xf')](_0x85d0('0x11'),_0x463a7a,_0x3757f7[_0x85d0('0xf')][_0x85d0('0x12')]);return _0x287a39(_0x3757f7[_0x85d0('0xf')]['message']);}else{logger[_0x85d0('0xb')](_0x85d0('0x11'),_0x463a7a,_0x85d0('0xc'));_0x287a39(_0x3757f7[_0x85d0('0x13')]['message']);}})['catch'](function(_0x4e7b8b){logger[_0x85d0('0xf')]('WhatsappTransferReport,\x20%s,\x20%s',_0x463a7a,_0x4e7b8b);_0x4a8bc3(_0x4e7b8b);});});} \ No newline at end of file +var _0x0273=['WhatsappTransferReport,\x20%s,\x20%s','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x2b6251,_0x562c65){var _0x284744=function(_0x2d5e1c){while(--_0x2d5e1c){_0x2b6251['push'](_0x2b6251['shift']());}};_0x284744(++_0x562c65);}(_0x0273,0x159));var _0x3027=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0273[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3027('0x0'));var util=require(_0x3027('0x1'));var moment=require('moment');var BPromise=require(_0x3027('0x2'));var rs=require(_0x3027('0x3'));var fs=require('fs');var Redis=require(_0x3027('0x4'));var db=require(_0x3027('0x5'))['db'];var utils=require(_0x3027('0x6'));var logger=require(_0x3027('0x7'))('rpc');var config=require(_0x3027('0x8'));var jayson=require(_0x3027('0x9'));var client=jayson[_0x3027('0xa')][_0x3027('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x563eb9,_0x5a1519,_0x4da48e){return new BPromise(function(_0x5ea4e2,_0x44e99b){return client[_0x3027('0xc')](_0x563eb9,_0x4da48e)[_0x3027('0xd')](function(_0x586df2){logger[_0x3027('0xe')](_0x3027('0xf'),_0x5a1519,'request\x20sent');logger[_0x3027('0x10')](_0x3027('0x11'),_0x5a1519,_0x3027('0x12'),JSON[_0x3027('0x13')](_0x586df2));if(_0x586df2['error']){if(_0x586df2['error'][_0x3027('0x14')]===0x1f4){logger[_0x3027('0x15')](_0x3027('0xf'),_0x5a1519,_0x586df2['error'][_0x3027('0x16')]);return _0x44e99b(_0x586df2[_0x3027('0x15')]['message']);}logger['error'](_0x3027('0xf'),_0x5a1519,_0x586df2[_0x3027('0x15')][_0x3027('0x16')]);return _0x5ea4e2(_0x586df2[_0x3027('0x15')]['message']);}else{logger[_0x3027('0xe')](_0x3027('0xf'),_0x5a1519,_0x3027('0x12'));_0x5ea4e2(_0x586df2[_0x3027('0x17')][_0x3027('0x16')]);}})['catch'](function(_0x15bafc){logger[_0x3027('0x15')](_0x3027('0xf'),_0x5a1519,_0x15bafc);_0x44e99b(_0x15bafc);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index d58c775..e62daa9 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa1a3=['./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/transcribe','sequelize','sync','listen','then','info','start','Online\x20apps:','map','online','name','join','Offline\x20apps:','None','seedDB','./config/seedDB','default','./config/license','catch','lodash','./rpc','./config/environment','./config/logger','app','./config/pm2'];(function(_0x39c734,_0x2f3e06){var _0xb2a2f9=function(_0x502f3f){while(--_0x502f3f){_0x39c734['push'](_0x39c734['shift']());}};_0xb2a2f9(++_0x2f3e06);}(_0xa1a3,0x6a));var _0x3a1a=function(_0x5a2604,_0x5b11e1){_0x5a2604=_0x5a2604-0x0;var _0x19257e=_0xa1a3[_0x5a2604];return _0x19257e;};'use strict';var _=require(_0x3a1a('0x0'));var mysqldb=require('./mysqldb');var rpc=require(_0x3a1a('0x1'));var config=require(_0x3a1a('0x2'));var logger=require(_0x3a1a('0x3'))(_0x3a1a('0x4'));var pm2=require(_0x3a1a('0x5'));var pm2Config=require(_0x3a1a('0x6'));var schedule=require(_0x3a1a('0x7'));var chat=require(_0x3a1a('0x8'));var whatsapp=require('./config/schedule/whatsapp');var transcribe=require(_0x3a1a('0x9'));function main(){return mysqldb['db'][_0x3a1a('0xa')][_0x3a1a('0xb')]()['then'](function(){return rpc[_0x3a1a('0xc')]();})[_0x3a1a('0xd')](function(_0x273d87){logger[_0x3a1a('0xe')](_0x273d87);return chat[_0x3a1a('0xf')]();})['then'](function(){return whatsapp['start']();})['then'](function(){return schedule[_0x3a1a('0xf')]();})[_0x3a1a('0xd')](function(){return transcribe[_0x3a1a('0xf')]();})[_0x3a1a('0xd')](function(_0x7b0c97){logger[_0x3a1a('0xe')](_0x7b0c97);return pm2[_0x3a1a('0xf')](pm2Config);})[_0x3a1a('0xd')](function(_0x5a00dc){logger[_0x3a1a('0xe')](_0x3a1a('0x10'),_[_0x3a1a('0x11')](_['filter'](_0x5a00dc,{'status':_0x3a1a('0x12')}),_0x3a1a('0x13'))[_0x3a1a('0x14')]());logger[_0x3a1a('0xe')](_0x3a1a('0x15'),_[_0x3a1a('0x11')](_['filter'](_0x5a00dc,function(_0x38adf0){return _0x38adf0['status']!=='online';}),_0x3a1a('0x13'))['join']()||_0x3a1a('0x16'));config[_0x3a1a('0x17')]&&require(_0x3a1a('0x18'))[_0x3a1a('0x19')]();require(_0x3a1a('0x1a'))[_0x3a1a('0x19')]();})[_0x3a1a('0x1b')](function(_0x3aa1e6){logger['error']('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x3aa1e6);process['exit'](0x1);});}main(); \ No newline at end of file +var _0xa90f=['info','start','map','filter','online','name','join','status','None','seedDB','./config/seedDB','default','./config/license','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','./mysqldb','./rpc','./config/logger','./config/pm2/config','./config/schedule','./config/schedule/chat','sequelize','sync','then'];(function(_0x395b75,_0x5e4170){var _0x21f76c=function(_0x18851e){while(--_0x18851e){_0x395b75['push'](_0x395b75['shift']());}};_0x21f76c(++_0x5e4170);}(_0xa90f,0x18f));var _0xfa90=function(_0x162cbe,_0x2bd216){_0x162cbe=_0x162cbe-0x0;var _0x2847ce=_0xa90f[_0x162cbe];return _0x2847ce;};'use strict';var _=require('lodash');var mysqldb=require(_0xfa90('0x0'));var rpc=require(_0xfa90('0x1'));var config=require('./config/environment');var logger=require(_0xfa90('0x2'))('app');var pm2=require('./config/pm2');var pm2Config=require(_0xfa90('0x3'));var schedule=require(_0xfa90('0x4'));var chat=require(_0xfa90('0x5'));var whatsapp=require('./config/schedule/whatsapp');var transcribe=require('./config/schedule/transcribe');function main(){return mysqldb['db'][_0xfa90('0x6')][_0xfa90('0x7')]()['then'](function(){return rpc['listen']();})[_0xfa90('0x8')](function(_0x2e35a8){logger[_0xfa90('0x9')](_0x2e35a8);return chat['start']();})['then'](function(){return whatsapp['start']();})[_0xfa90('0x8')](function(){return schedule['start']();})[_0xfa90('0x8')](function(){return transcribe[_0xfa90('0xa')]();})['then'](function(_0x3c3419){logger[_0xfa90('0x9')](_0x3c3419);return pm2[_0xfa90('0xa')](pm2Config);})[_0xfa90('0x8')](function(_0x48184d){logger['info']('Online\x20apps:',_[_0xfa90('0xb')](_[_0xfa90('0xc')](_0x48184d,{'status':_0xfa90('0xd')}),_0xfa90('0xe'))[_0xfa90('0xf')]());logger[_0xfa90('0x9')]('Offline\x20apps:',_[_0xfa90('0xb')](_[_0xfa90('0xc')](_0x48184d,function(_0x19694e){return _0x19694e[_0xfa90('0x10')]!=='online';}),_0xfa90('0xe'))[_0xfa90('0xf')]()||_0xfa90('0x11'));config[_0xfa90('0x12')]&&require(_0xfa90('0x13'))[_0xfa90('0x14')]();require(_0xfa90('0x15'))[_0xfa90('0x14')]();})[_0xfa90('0x16')](function(_0x3e2da3){logger['error'](_0xfa90('0x17'),_0x3e2da3);process['exit'](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 134de87..70865a2 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 _0x4fb9=['phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','interface','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','isChatInteractionAuthorized','use','ChatInteraction','closed','disposition','status','unmanaged','json','Unmanaged.','Forbidden.','catch','isAuthenticated','headers','authorization','startsWith','Basic','User','find','then','authenticate','Wrong\x20credentials.','Bearer','Unknown\x20authorization\x20format','getUuid','query','apikey','sub','Setting','findOne','allowedLoginAttempts','apiKeyNonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','blocked','blockedAt','add','blockDuration','Invalid\x20API\x20access\x20key','user','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','Forbidden','isWebrtcLicence','isMiddleware','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','redirect','/dashboards/general','retrieveApiKey','isNil','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','decryptString','split','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','length','splice','unshift','promisify','sign','secret','secrets','payload','options','verify','randomBytes','toString','now','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','lodash','composable-middleware','basic-auth','bluebird','util','moment','session','role','fullname','name','internal','email','userpic','permissions','md5secret','faxPause','openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarEnableRecording','phoneBarEnableSettings'];(function(_0x518374,_0x2d5ed6){var _0x28b0c7=function(_0x3b63f1){while(--_0x3b63f1){_0x518374['push'](_0x518374['shift']());}};_0x28b0c7(++_0x2d5ed6);}(_0x4fb9,0xd2));var _0x94fb=function(_0x214143,_0x478a75){_0x214143=_0x214143-0x0;var _0x3cc1e9=_0x4fb9[_0x214143];return _0x3cc1e9;};'use strict';var db=require(_0x94fb('0x0'))['db'];var config=require(_0x94fb('0x1'));var hardwareConf=require(_0x94fb('0x2'));var licenseUtil=require(_0x94fb('0x3'));var encryptor=require(_0x94fb('0x4'));var _=require(_0x94fb('0x5'));var jwt=require('jsonwebtoken');var expressJwt=require('express-jwt');var compose=require(_0x94fb('0x6'));var basicAuth=require(_0x94fb('0x7'));var crypto=require('crypto');var BPromise=require(_0x94fb('0x8'));var util=require(_0x94fb('0x9'));var moment=require(_0x94fb('0xa'));var validateJwt=expressJwt({'secret':config['secrets'][_0x94fb('0xb')]});var userAttributes=['id',_0x94fb('0xc'),_0x94fb('0xd'),_0x94fb('0xe'),_0x94fb('0xf'),_0x94fb('0x10'),_0x94fb('0x11'),_0x94fb('0x12'),_0x94fb('0x13'),'voicePause','chatPause','mailPause',_0x94fb('0x14'),'smsPause',_0x94fb('0x15'),_0x94fb('0x16'),_0x94fb('0x17'),_0x94fb('0x18'),_0x94fb('0x19'),_0x94fb('0x1a'),_0x94fb('0x1b'),_0x94fb('0x1c'),_0x94fb('0x1d'),'phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd',_0x94fb('0x1e'),'phoneBarEnableDtmfTone',_0x94fb('0x1f'),'phoneBarExpires',_0x94fb('0x20'),_0x94fb('0x21'),_0x94fb('0x22'),'hotdesk',_0x94fb('0x23'),'userProfileId','privacyEnabled','settingsEnabled',_0x94fb('0x24'),_0x94fb('0x25'),_0x94fb('0x26'),_0x94fb('0x27'),_0x94fb('0x28'),_0x94fb('0x29')];exports[_0x94fb('0x2a')]=function(){return this['isAuthenticated'](!![])[_0x94fb('0x2b')](function(_0x12d589,_0x29a5d9,_0x4f54c5){if(_0x12d589['user']){_0x4f54c5();}else{return db[_0x94fb('0x2c')]['findOne']({'where':{'id':_0x12d589['params']['id']},'attributes':['id',_0x94fb('0x2d'),_0x94fb('0x2e')],'raw':!![]})['then'](function(_0x2cc943){if(_0x2cc943&&_0x2cc943[_0x94fb('0x2d')]){return _0x29a5d9[_0x94fb('0x2f')](_0x2cc943[_0x94fb('0x2e')]===_0x94fb('0x30')?0x195:0x193)[_0x94fb('0x31')]({'message':_0x2cc943['disposition']==='unmanaged'?_0x94fb('0x32'):_0x94fb('0x33')});}else{_0x4f54c5();}})[_0x94fb('0x34')](function(_0xc01a98){_0x4f54c5(_0xc01a98);});}});};exports[_0x94fb('0x35')]=function isAuthenticated(_0x13c27a){return compose()[_0x94fb('0x2b')](function(_0x5b4b81,_0x5b292d,_0x40c394){var _0x18ddee;if(_0x5b4b81[_0x94fb('0x36')][_0x94fb('0x37')]){if(_[_0x94fb('0x38')](_0x5b4b81[_0x94fb('0x36')][_0x94fb('0x37')],_0x94fb('0x39'))){var _0x407717=basicAuth(_0x5b4b81);db[_0x94fb('0x3a')][_0x94fb('0x3b')]({'where':{'name':_0x407717[_0x94fb('0xe')]}})[_0x94fb('0x3c')](function(_0x36f89b){if(!_0x36f89b||!_0x36f89b[_0x94fb('0x3d')](_0x407717['pass'])){return _0x5b292d[_0x94fb('0x2f')](0x191)[_0x94fb('0x31')]({'message':_0x94fb('0x3e')});}_0x5b4b81['user']={'id':_0x36f89b['id']};_0x40c394();})[_0x94fb('0x34')](function(_0x3c3c2e){_0x40c394(_0x3c3c2e);});}else if(_[_0x94fb('0x38')](_0x5b4b81[_0x94fb('0x36')]['authorization'],_0x94fb('0x3f'))){validateJwt(_0x5b4b81,_0x5b292d,_0x40c394);}else{if(_0x13c27a){_0x40c394();}else{return _0x5b292d[_0x94fb('0x2f')](0x193)['json']({'message':_0x94fb('0x40')});}}}else if(_0x5b4b81['query']['apikey']){try{var _0x41f539={'audience':hardwareConf[_0x94fb('0x41')](),'issuer':hardwareConf[_0x94fb('0x41')]()};verifyJwt(_0x5b4b81[_0x94fb('0x42')][_0x94fb('0x43')],_0x41f539)[_0x94fb('0x3c')](function(_0x1639d7){return db[_0x94fb('0x3a')][_0x94fb('0x3b')]({'where':{'id':_0x1639d7[_0x94fb('0x44')]}})[_0x94fb('0x3c')](function(_0x136081){_0x18ddee=_0x136081;return db[_0x94fb('0x45')][_0x94fb('0x46')]({'where':{'id':0x1},'attributes':[_0x94fb('0x47'),'blockDuration'],'raw':!![]});})[_0x94fb('0x3c')](function(_0x2a608b){if(!_0x18ddee||!_['isEqual'](_0x18ddee[_0x94fb('0x48')],_0x1639d7['nonce'])){return _0x5b292d[_0x94fb('0x2f')](0x191)[_0x94fb('0x31')]({'message':_0x94fb('0x49')});}if(_0x18ddee[_0x94fb('0x4a')]){return _0x5b292d['status'](0x191)[_0x94fb('0x31')]({'message':'Invalid\x20API\x20access\x20key'});}if(_0x18ddee[_0x94fb('0x4b')]){if(_0x2a608b['blockDuration']>0x0){if(moment(_0x18ddee[_0x94fb('0x4c')])[_0x94fb('0x4d')](_0x2a608b[_0x94fb('0x4e')],'minutes')>moment()){return _0x5b292d[_0x94fb('0x2f')](0x191)[_0x94fb('0x31')]({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x5b292d[_0x94fb('0x2f')](0x191)[_0x94fb('0x31')]({'message':_0x94fb('0x4f')});}}_0x5b4b81[_0x94fb('0x50')]={'id':_0x18ddee['id']};_0x40c394();});})[_0x94fb('0x34')](function(){return _0x5b292d['status'](0x191)[_0x94fb('0x31')]({'message':_0x94fb('0x4f')});});}catch(_0x2ff027){_0x40c394(_0x2ff027);}}else if(_0x13c27a){_0x40c394();}else{return _0x5b292d['status'](0x193)[_0x94fb('0x31')]({'message':_0x94fb('0x40')});}})[_0x94fb('0x2b')](function(_0x205c09,_0x15af35,_0x38f4de){if(_0x205c09[_0x94fb('0x50')]){db[_0x94fb('0x3a')][_0x94fb('0x3b')]({'where':{'id':_0x205c09[_0x94fb('0x50')]['id']},'attributes':userAttributes})[_0x94fb('0x3c')](function(_0x5588ea){if(!_0x5588ea){return _0x15af35[_0x94fb('0x2f')](0x194)[_0x94fb('0x31')]({'message':_0x94fb('0x51')});}_0x205c09[_0x94fb('0x50')]=_0x5588ea;_0x38f4de();})['catch'](function(_0x9f8851){_0x38f4de(_0x9f8851);});}else if(_0x13c27a){_0x38f4de();}else{return _0x15af35[_0x94fb('0x2f')](0x194)[_0x94fb('0x31')]({'message':_0x94fb('0x52')});}});};exports[_0x94fb('0x53')]=function canUpdate(){return compose()[_0x94fb('0x2b')](function(_0x3938fb,_0x39f081,_0x240a86){return licenseUtil[_0x94fb('0x54')]()[_0x94fb('0x3c')](function(_0x22dcaa){if(_0x22dcaa['update']){_0x240a86();}else{return _0x39f081[_0x94fb('0x2f')](0x193)[_0x94fb('0x31')]({'message':_0x94fb('0x55')});}})['catch'](function(_0xddc447){_0x240a86(_0xddc447);});});};exports[_0x94fb('0x56')]=function isWebrtcLicence(){return compose()['use'](function(_0x1e47f2,_0x47a4e5,_0x509331){return licenseUtil[_0x94fb('0x54')]()[_0x94fb('0x3c')](function(_0x32964b){if(_0x32964b['webrtc']){_0x509331();}else{return _0x47a4e5['status'](0x193)[_0x94fb('0x31')]({'message':_0x94fb('0x55')});}})[_0x94fb('0x34')](function(_0x54e0b3){_0x509331(_0x54e0b3);});});};exports[_0x94fb('0x57')]=function(_0x4100c2,_0x397b85,_0x4b30b0){_0x4100c2[_0x94fb('0x57')]=!![];return _0x4b30b0();};exports['signToken']=function signToken(_0x1b92db){return signJwt(_0x1b92db);};exports['setTokenCookie']=function(_0x23d057,_0x477725){if(!_0x23d057[_0x94fb('0x50')]){return _0x477725['status'](0x194)[_0x94fb('0x31')]({'message':_0x94fb('0x58')});}var _0x1389f0={'payload':{'id':_0x23d057['user']['id'],'role':_0x23d057[_0x94fb('0x50')][_0x94fb('0xc')]},'options':{'expiresIn':0x15180}};return signJwt(_0x1389f0)[_0x94fb('0x3c')](function(_0x29529e){_0x477725[_0x94fb('0x59')]('motion.token',_0x29529e);_0x477725[_0x94fb('0x5a')](_0x94fb('0x5b'));})[_0x94fb('0x34')](function(_0x3d88ee){return _0x477725[_0x94fb('0x2f')](0x1f4)['send'](_0x3d88ee);});};exports[_0x94fb('0x5c')]=function(_0x58376e){if(_[_0x94fb('0x5d')](_0x58376e[_0x94fb('0x48')])||_[_0x94fb('0x5d')](_0x58376e[_0x94fb('0x5e')])){return null;}else{return createJwt(_0x58376e);}};exports[_0x94fb('0x5f')]=function(_0x561b49){_0x561b49['apiKeyNonce']=generateNonce();_0x561b49[_0x94fb('0x5e')]=generateIssuedAt();return createJwt(_0x561b49);};exports[_0x94fb('0x60')]=function(_0x4af9e1,_0x331a57){var _0x4a1a24=_0x4af9e1[_0x94fb('0x42')]['apikey'];if(_0x4a1a24){var _0xcba94a={'nonce':_0x331a57[_0x94fb('0x48')],'iat':_0x331a57[_0x94fb('0x5e')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x94fb('0x41')]()};return verifyJwt(_0x4a1a24,_0xcba94a)['then'](function(){return generateApiKey(_0x331a57);});}else{throw{'message':_0x94fb('0x61')};}};exports[_0x94fb('0x62')]=function(_0x2f1037){var _0x16e7ab=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x16e7ab[_0x94fb('0x63')](_0x2f1037))throw new db[(_0x94fb('0x64'))]['ValidationError'](_0x94fb('0x65'));return;};exports['validatePasswordHistory']=function(_0x104b8c,_0x4ef85e,_0x5844db){var _0x43e322=encryptor[_0x94fb('0x66')](_0x4ef85e)[_0x94fb('0x67')](',');for(var _0x1ab458=0x0;_0x1ab458<_0x5844db;_0x1ab458++){if(!_0x43e322[_0x1ab458])break;if(_0x104b8c['toLowerCase']()===_0x43e322[_0x1ab458]['toLowerCase']()){var _0x2b51f1=util[_0x94fb('0x68')]('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x5844db);if(_0x5844db===0x1){_0x2b51f1=_0x94fb('0x69');}throw new db['Sequelize']['ValidationError'](_0x2b51f1);}}return;};exports[_0x94fb('0x6a')]=function(_0xd3fd56,_0x525c76){var _0x161df4=_0x525c76?encryptor['decryptString'](_0x525c76)[_0x94fb('0x67')](','):[];if(_0x161df4[_0x94fb('0x6b')]===0x5){_0x161df4[_0x94fb('0x6c')](-0x1,0x1);}_0x161df4[_0x94fb('0x6d')](_0xd3fd56);return encryptor['encryptString'](_0x161df4['join'](','));};function signJwt(_0x3fea63){var _0x328b7a=BPromise[_0x94fb('0x6e')](jwt[_0x94fb('0x6f')],{'context':jwt});var _0x28b13d=_0x3fea63[_0x94fb('0x70')]||config[_0x94fb('0x71')][_0x94fb('0xb')];return new BPromise(function(_0x2b1a11,_0x400214){_0x328b7a(_0x3fea63[_0x94fb('0x72')],_0x28b13d,_0x3fea63[_0x94fb('0x73')])[_0x94fb('0x3c')](function(_0x393680){_0x2b1a11(_0x393680);})['catch'](function(_0x4aef58){_0x400214(_0x4aef58);});});}function verifyJwt(_0x5f14dc,_0x5b439d,_0x3fbe0b){var _0x47f541=BPromise[_0x94fb('0x6e')](jwt[_0x94fb('0x74')],{'context':jwt});var _0x6ac576=_0x3fbe0b||config['secrets'][_0x94fb('0xb')];return new BPromise(function(_0x2fefe4,_0x1db8e8){_0x47f541(_0x5f14dc,_0x6ac576,_0x5b439d)[_0x94fb('0x3c')](function(_0x4f0cb4){_0x2fefe4(_0x4f0cb4);})[_0x94fb('0x34')](function(_0x2b6a3c){_0x1db8e8(_0x2b6a3c);});});}function generateNonce(){return crypto[_0x94fb('0x75')](0x10)[_0x94fb('0x76')]('hex');}function generateIssuedAt(){return Math['floor'](Date[_0x94fb('0x77')]()/0x3e8)[_0x94fb('0x76')]();}function createJwt(_0x414c0c){var _0xc02d85={'payload':{'iat':_0x414c0c[_0x94fb('0x5e')],'nonce':_0x414c0c[_0x94fb('0x48')]},'options':{'algorithm':_0x94fb('0x78'),'subject':_0x414c0c['id'][_0x94fb('0x76')](),'issuer':hardwareConf[_0x94fb('0x41')](),'audience':hardwareConf[_0x94fb('0x41')]()}};return signJwt(_0xc02d85)[_0x94fb('0x3c')](function(_0x246eef){return{'iat':_0x414c0c['apiKeyIat'],'nonce':_0x414c0c[_0x94fb('0x48')],'token':_0x246eef};});} \ No newline at end of file +var _0x1f24=['ChatInteraction','findOne','closed','disposition','then','status','json','unmanaged','Unmanaged.','Forbidden.','catch','isAuthenticated','use','headers','authorization','startsWith','Basic','User','find','authenticate','pass','Wrong\x20credentials.','user','Bearer','Unknown\x20authorization\x20format','apikey','getUuid','query','sub','Setting','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','blocked','blockedAt','add','Invalid\x20API\x20access\x20key','User\x20object\x20not\x20found.','getLicense','update','isWebrtcLicence','webrtc','Forbidden','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','role','cookie','/dashboards/general','send','isNil','generateApiKey','apiKeyIat','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\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','unshift','join','promisify','payload','toString','hex','now','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','bluebird','util','secrets','session','fullname','name','internal','email','userpic','permissions','md5secret','chatPause','mailPause','faxPause','smsPause','showWebBar','lastPauseAt','allowmessenger','alias','phoneBarAutoAnswerDelay','phoneBarEnableRecording','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','hotdesk','interface','userProfileId','privacyEnabled','settingsEnabled','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign'];(function(_0xd0ddef,_0x1139e5){var _0x446555=function(_0x5b4fba){while(--_0x5b4fba){_0xd0ddef['push'](_0xd0ddef['shift']());}};_0x446555(++_0x1139e5);}(_0x1f24,0xc8));var _0x41f2=function(_0x5ef9b2,_0x53fc8e){_0x5ef9b2=_0x5ef9b2-0x0;var _0x4e3f75=_0x1f24[_0x5ef9b2];return _0x4e3f75;};'use strict';var db=require(_0x41f2('0x0'))['db'];var config=require(_0x41f2('0x1'));var hardwareConf=require(_0x41f2('0x2'));var licenseUtil=require(_0x41f2('0x3'));var encryptor=require(_0x41f2('0x4'));var _=require('lodash');var jwt=require(_0x41f2('0x5'));var expressJwt=require(_0x41f2('0x6'));var compose=require(_0x41f2('0x7'));var basicAuth=require(_0x41f2('0x8'));var crypto=require(_0x41f2('0x9'));var BPromise=require(_0x41f2('0xa'));var util=require(_0x41f2('0xb'));var moment=require('moment');var validateJwt=expressJwt({'secret':config[_0x41f2('0xc')][_0x41f2('0xd')]});var userAttributes=['id','role',_0x41f2('0xe'),_0x41f2('0xf'),_0x41f2('0x10'),_0x41f2('0x11'),_0x41f2('0x12'),_0x41f2('0x13'),_0x41f2('0x14'),'voicePause',_0x41f2('0x15'),_0x41f2('0x16'),_0x41f2('0x17'),_0x41f2('0x18'),'openchannelPause','pauseType',_0x41f2('0x19'),'lastLoginAt',_0x41f2('0x1a'),'crudPermissions',_0x41f2('0x1b'),'passwordResetAt',_0x41f2('0x1c'),'phoneBarAutoAnswer',_0x41f2('0x1d'),'phoneBarDnd',_0x41f2('0x1e'),'phoneBarEnableDtmfTone',_0x41f2('0x1f'),_0x41f2('0x20'),_0x41f2('0x21'),'phoneBarRemoteControl','phoneBarRemoteControlPort',_0x41f2('0x22'),_0x41f2('0x23'),_0x41f2('0x24'),_0x41f2('0x25'),_0x41f2('0x26'),'wssPort',_0x41f2('0x27'),_0x41f2('0x28'),_0x41f2('0x29'),_0x41f2('0x2a'),_0x41f2('0x2b')];exports['isChatInteractionAuthorized']=function(){return this['isAuthenticated'](!![])['use'](function(_0x2d18c7,_0x30358a,_0x15223a){if(_0x2d18c7['user']){_0x15223a();}else{return db[_0x41f2('0x2c')][_0x41f2('0x2d')]({'where':{'id':_0x2d18c7['params']['id']},'attributes':['id',_0x41f2('0x2e'),_0x41f2('0x2f')],'raw':!![]})[_0x41f2('0x30')](function(_0x4bd3ee){if(_0x4bd3ee&&_0x4bd3ee['closed']){return _0x30358a[_0x41f2('0x31')](_0x4bd3ee['disposition']==='unmanaged'?0x195:0x193)[_0x41f2('0x32')]({'message':_0x4bd3ee[_0x41f2('0x2f')]===_0x41f2('0x33')?_0x41f2('0x34'):_0x41f2('0x35')});}else{_0x15223a();}})[_0x41f2('0x36')](function(_0x43b600){_0x15223a(_0x43b600);});}});};exports[_0x41f2('0x37')]=function isAuthenticated(_0xb6b200){return compose()[_0x41f2('0x38')](function(_0x44c231,_0x497941,_0x3bc526){var _0x14bab8;if(_0x44c231[_0x41f2('0x39')][_0x41f2('0x3a')]){if(_[_0x41f2('0x3b')](_0x44c231[_0x41f2('0x39')]['authorization'],_0x41f2('0x3c'))){var _0x5920a9=basicAuth(_0x44c231);db[_0x41f2('0x3d')][_0x41f2('0x3e')]({'where':{'name':_0x5920a9['name']}})[_0x41f2('0x30')](function(_0x31964a){if(!_0x31964a||!_0x31964a[_0x41f2('0x3f')](_0x5920a9[_0x41f2('0x40')])){return _0x497941[_0x41f2('0x31')](0x191)[_0x41f2('0x32')]({'message':_0x41f2('0x41')});}_0x44c231[_0x41f2('0x42')]={'id':_0x31964a['id']};_0x3bc526();})[_0x41f2('0x36')](function(_0x41c365){_0x3bc526(_0x41c365);});}else if(_[_0x41f2('0x3b')](_0x44c231[_0x41f2('0x39')][_0x41f2('0x3a')],_0x41f2('0x43'))){validateJwt(_0x44c231,_0x497941,_0x3bc526);}else{if(_0xb6b200){_0x3bc526();}else{return _0x497941['status'](0x193)[_0x41f2('0x32')]({'message':_0x41f2('0x44')});}}}else if(_0x44c231['query'][_0x41f2('0x45')]){try{var _0xda67f5={'audience':hardwareConf[_0x41f2('0x46')](),'issuer':hardwareConf[_0x41f2('0x46')]()};verifyJwt(_0x44c231[_0x41f2('0x47')]['apikey'],_0xda67f5)['then'](function(_0x479434){return db['User'][_0x41f2('0x3e')]({'where':{'id':_0x479434[_0x41f2('0x48')]}})[_0x41f2('0x30')](function(_0x550326){_0x14bab8=_0x550326;return db[_0x41f2('0x49')][_0x41f2('0x2d')]({'where':{'id':0x1},'attributes':[_0x41f2('0x4a'),_0x41f2('0x4b')],'raw':!![]});})[_0x41f2('0x30')](function(_0x2e118d){if(!_0x14bab8||!_[_0x41f2('0x4c')](_0x14bab8[_0x41f2('0x4d')],_0x479434[_0x41f2('0x4e')])){return _0x497941['status'](0x191)[_0x41f2('0x32')]({'message':_0x41f2('0x4f')});}if(_0x14bab8['disabled']){return _0x497941[_0x41f2('0x31')](0x191)[_0x41f2('0x32')]({'message':'Invalid\x20API\x20access\x20key'});}if(_0x14bab8[_0x41f2('0x50')]){if(_0x2e118d[_0x41f2('0x4b')]>0x0){if(moment(_0x14bab8[_0x41f2('0x51')])[_0x41f2('0x52')](_0x2e118d[_0x41f2('0x4b')],'minutes')>moment()){return _0x497941['status'](0x191)[_0x41f2('0x32')]({'message':_0x41f2('0x53')});}}else{return _0x497941[_0x41f2('0x31')](0x191)[_0x41f2('0x32')]({'message':_0x41f2('0x53')});}}_0x44c231['user']={'id':_0x14bab8['id']};_0x3bc526();});})[_0x41f2('0x36')](function(){return _0x497941[_0x41f2('0x31')](0x191)[_0x41f2('0x32')]({'message':_0x41f2('0x53')});});}catch(_0xddd27f){_0x3bc526(_0xddd27f);}}else if(_0xb6b200){_0x3bc526();}else{return _0x497941[_0x41f2('0x31')](0x193)[_0x41f2('0x32')]({'message':_0x41f2('0x44')});}})[_0x41f2('0x38')](function(_0x6791b0,_0x34310c,_0x363e4e){if(_0x6791b0[_0x41f2('0x42')]){db[_0x41f2('0x3d')][_0x41f2('0x3e')]({'where':{'id':_0x6791b0[_0x41f2('0x42')]['id']},'attributes':userAttributes})[_0x41f2('0x30')](function(_0x370fbb){if(!_0x370fbb){return _0x34310c[_0x41f2('0x31')](0x194)[_0x41f2('0x32')]({'message':'User\x20not\x20found.'});}_0x6791b0['user']=_0x370fbb;_0x363e4e();})[_0x41f2('0x36')](function(_0x48ce0c){_0x363e4e(_0x48ce0c);});}else if(_0xb6b200){_0x363e4e();}else{return _0x34310c['status'](0x194)[_0x41f2('0x32')]({'message':_0x41f2('0x54')});}});};exports['canUpdate']=function canUpdate(){return compose()[_0x41f2('0x38')](function(_0x2d478f,_0x304930,_0x1f84b4){return licenseUtil[_0x41f2('0x55')]()[_0x41f2('0x30')](function(_0xa781c5){if(_0xa781c5[_0x41f2('0x56')]){_0x1f84b4();}else{return _0x304930[_0x41f2('0x31')](0x193)['json']({'message':'Forbidden'});}})[_0x41f2('0x36')](function(_0x43bd06){_0x1f84b4(_0x43bd06);});});};exports[_0x41f2('0x57')]=function isWebrtcLicence(){return compose()[_0x41f2('0x38')](function(_0x44f61f,_0x1968a4,_0x5ab262){return licenseUtil[_0x41f2('0x55')]()[_0x41f2('0x30')](function(_0x35a7c1){if(_0x35a7c1[_0x41f2('0x58')]){_0x5ab262();}else{return _0x1968a4[_0x41f2('0x31')](0x193)[_0x41f2('0x32')]({'message':_0x41f2('0x59')});}})[_0x41f2('0x36')](function(_0x1dc12c){_0x5ab262(_0x1dc12c);});});};exports[_0x41f2('0x5a')]=function(_0x661fa1,_0x50b4d,_0x4b7190){_0x661fa1[_0x41f2('0x5a')]=!![];return _0x4b7190();};exports[_0x41f2('0x5b')]=function signToken(_0x3aee6d){return signJwt(_0x3aee6d);};exports[_0x41f2('0x5c')]=function(_0x117c40,_0x1d05e2){if(!_0x117c40[_0x41f2('0x42')]){return _0x1d05e2[_0x41f2('0x31')](0x194)[_0x41f2('0x32')]({'message':_0x41f2('0x5d')});}var _0x37d1dc={'payload':{'id':_0x117c40[_0x41f2('0x42')]['id'],'role':_0x117c40['user'][_0x41f2('0x5e')]},'options':{'expiresIn':0x15180}};return signJwt(_0x37d1dc)[_0x41f2('0x30')](function(_0x50bde5){_0x1d05e2[_0x41f2('0x5f')]('motion.token',_0x50bde5);_0x1d05e2['redirect'](_0x41f2('0x60'));})['catch'](function(_0xcd5583){return _0x1d05e2[_0x41f2('0x31')](0x1f4)[_0x41f2('0x61')](_0xcd5583);});};exports['retrieveApiKey']=function(_0x3b0d64){if(_[_0x41f2('0x62')](_0x3b0d64[_0x41f2('0x4d')])||_[_0x41f2('0x62')](_0x3b0d64['apiKeyIat'])){return null;}else{return createJwt(_0x3b0d64);}};exports[_0x41f2('0x63')]=function(_0x55e7a1){_0x55e7a1['apiKeyNonce']=generateNonce();_0x55e7a1[_0x41f2('0x64')]=generateIssuedAt();return createJwt(_0x55e7a1);};exports[_0x41f2('0x65')]=function(_0xbfc53c,_0x6501a5){var _0x396cd3=_0xbfc53c[_0x41f2('0x47')][_0x41f2('0x45')];if(_0x396cd3){var _0x18c20d={'nonce':_0x6501a5['apiKeyNonce'],'iat':_0x6501a5[_0x41f2('0x64')],'audience':hardwareConf[_0x41f2('0x46')](),'issuer':hardwareConf[_0x41f2('0x46')]()};return verifyJwt(_0x396cd3,_0x18c20d)[_0x41f2('0x30')](function(){return generateApiKey(_0x6501a5);});}else{throw{'message':_0x41f2('0x66')};}};exports['validatePasswordPattern']=function(_0x1db692){var _0x30533a=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x30533a[_0x41f2('0x67')](_0x1db692))throw new db[(_0x41f2('0x68'))][(_0x41f2('0x69'))](_0x41f2('0x6a'));return;};exports['validatePasswordHistory']=function(_0x585dcd,_0x4296be,_0x293a17){var _0x48290f=encryptor[_0x41f2('0x6b')](_0x4296be)[_0x41f2('0x6c')](',');for(var _0x11a45e=0x0;_0x11a45e<_0x293a17;_0x11a45e++){if(!_0x48290f[_0x11a45e])break;if(_0x585dcd[_0x41f2('0x6d')]()===_0x48290f[_0x11a45e][_0x41f2('0x6d')]()){var _0x3f7c35=util[_0x41f2('0x6e')](_0x41f2('0x6f'),_0x293a17);if(_0x293a17===0x1){_0x3f7c35=_0x41f2('0x70');}throw new db[(_0x41f2('0x68'))][(_0x41f2('0x69'))](_0x3f7c35);}}return;};exports[_0x41f2('0x71')]=function(_0x11aa6b,_0x5d1db8){var _0x4e4c79=_0x5d1db8?encryptor[_0x41f2('0x6b')](_0x5d1db8)[_0x41f2('0x6c')](','):[];if(_0x4e4c79['length']===0x5){_0x4e4c79['splice'](-0x1,0x1);}_0x4e4c79[_0x41f2('0x72')](_0x11aa6b);return encryptor['encryptString'](_0x4e4c79[_0x41f2('0x73')](','));};function signJwt(_0x43736f){var _0x47ffdb=BPromise[_0x41f2('0x74')](jwt['sign'],{'context':jwt});var _0x3da0ac=_0x43736f['secret']||config['secrets'][_0x41f2('0xd')];return new BPromise(function(_0x4e2ca3,_0x11428c){_0x47ffdb(_0x43736f[_0x41f2('0x75')],_0x3da0ac,_0x43736f['options'])[_0x41f2('0x30')](function(_0x3a3b34){_0x4e2ca3(_0x3a3b34);})[_0x41f2('0x36')](function(_0x19fcca){_0x11428c(_0x19fcca);});});}function verifyJwt(_0x422ca1,_0x947cff,_0x55ce63){var _0x47eb26=BPromise['promisify'](jwt['verify'],{'context':jwt});var _0x3b0a28=_0x55ce63||config[_0x41f2('0xc')][_0x41f2('0xd')];return new BPromise(function(_0x314da0,_0xc1c2d7){_0x47eb26(_0x422ca1,_0x3b0a28,_0x947cff)[_0x41f2('0x30')](function(_0x53badb){_0x314da0(_0x53badb);})[_0x41f2('0x36')](function(_0x9f65a4){_0xc1c2d7(_0x9f65a4);});});}function generateNonce(){return crypto['randomBytes'](0x10)[_0x41f2('0x76')](_0x41f2('0x77'));}function generateIssuedAt(){return Math['floor'](Date[_0x41f2('0x78')]()/0x3e8)[_0x41f2('0x76')]();}function createJwt(_0x6f25a){var _0x19cb1c={'payload':{'iat':_0x6f25a[_0x41f2('0x64')],'nonce':_0x6f25a[_0x41f2('0x4d')]},'options':{'algorithm':_0x41f2('0x79'),'subject':_0x6f25a['id']['toString'](),'issuer':hardwareConf['getUuid'](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x19cb1c)[_0x41f2('0x30')](function(_0x4011e5){return{'iat':_0x6f25a['apiKeyIat'],'nonce':_0x6f25a['apiKeyNonce'],'token':_0x4011e5};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 17a7423..fd3bd5d 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 _0x1253=['aes192','encrypt','algorithm','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','getCiphers','hasOwnProperty','encryptFile','createReadStream','createCipher','update','binary','write','end','final','unlink','createWriteStream','createDecipher','data','encryptString','secret','base64','utf8','bluebird','lodash','../../config/environment','aes-256-ctr'];(function(_0x271567,_0x3381fc){var _0x48164f=function(_0x3d561f){while(--_0x3d561f){_0x271567['push'](_0x271567['shift']());}};_0x48164f(++_0x3381fc);}(_0x1253,0x14e));var _0x3125=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1253[_0x14add3];return _0x4a174f;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require(_0x3125('0x0'));var _=require(_0x3125('0x1'));var config=require(_0x3125('0x2'));var logger=require('../../config/logger')('app');const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config['secrets']['session'],'algorithm':_0x3125('0x3')};const fileOptions={'algorithm':_0x3125('0x4')};if(config[_0x3125('0x5')]&&config[_0x3125('0x5')]['algorithm']){var isSupported=isAlgorithmSupported(config[_0x3125('0x5')]['algorithm']);if(isSupported){fileOptions[_0x3125('0x6')]=config['encrypt'][_0x3125('0x6')];}else{var supportedAlgorithms=getSupportedCiphers()['join'](',\x20');logger['error'](config[_0x3125('0x5')][_0x3125('0x6')],_0x3125('0x7'),supportedAlgorithms);}}function isASupportedCipher(_0x29dbdf){return AES_SUPPORTED_RX['test'](_0x29dbdf);}function getSupportedCiphers(){return crypto[_0x3125('0x8')]()['filter'](isASupportedCipher);}function isAlgorithmSupported(_0x33dbf8){return getSupportedCiphers()['indexOf'](_0x33dbf8)>-0x1;}function combineOptions(_0x20d637){var _0x32f5ed={};for(var _0x7c0949 in fileOptions){if(fileOptions[_0x3125('0x9')](_0x7c0949)){_0x32f5ed[_0x7c0949]=fileOptions[_0x7c0949];}}if(_0x20d637){for(var _0x18b562 in _0x20d637){if(_0x20d637[_0x3125('0x9')](_0x18b562)){_0x32f5ed[_0x18b562]=_0x20d637[_0x18b562];}}}return _0x32f5ed;}exports[_0x3125('0xa')]=function(_0x2c9f81,_0x39cee3,_0x2d4043,_0x44020e){return new BPromise(function(_0x34c0d7,_0x4d5560){_0x44020e=combineOptions(_0x44020e);var _0x17bf84=new Buffer(_0x2d4043);var _0x274969=fs[_0x3125('0xb')](_0x2c9f81);var _0x429a3a=fs['createWriteStream'](_0x39cee3);var _0x7ed5cc=crypto[_0x3125('0xc')](_0x44020e[_0x3125('0x6')],_0x17bf84);_0x274969['on']('data',function(_0x36051e){var _0x329fe8=new Buffer(_0x7ed5cc[_0x3125('0xd')](_0x36051e),_0x3125('0xe'));_0x429a3a[_0x3125('0xf')](_0x329fe8);});_0x274969['on'](_0x3125('0x10'),function(){try{var _0x4b9c85=new Buffer(_0x7ed5cc[_0x3125('0x11')](_0x3125('0xe')),_0x3125('0xe'));_0x429a3a['write'](_0x4b9c85);_0x429a3a[_0x3125('0x10')]();_0x429a3a['on']('close',function(){return _0x34c0d7(_0x39cee3);});}catch(_0x1aeb93){fs[_0x3125('0x12')](_0x39cee3);return _0x4d5560(_0x1aeb93);}});});};exports['decryptFile']=function(_0x1d45fd,_0x4931f4,_0x559027,_0x38df23){return new BPromise(function(_0x230611,_0x18b366){_0x38df23=combineOptions(_0x38df23);var _0x2d8959=new Buffer(_0x559027);var _0x3772fb=fs[_0x3125('0xb')](_0x1d45fd);var _0x4f3e1d=fs[_0x3125('0x13')](_0x4931f4);var _0x173836=crypto[_0x3125('0x14')](_0x38df23[_0x3125('0x6')],_0x2d8959);_0x3772fb['on'](_0x3125('0x15'),function(_0x1290f2){var _0x2efbbc=new Buffer(_0x173836[_0x3125('0xd')](_0x1290f2),_0x3125('0xe'));_0x4f3e1d[_0x3125('0xf')](_0x2efbbc);});_0x3772fb['on'](_0x3125('0x10'),function(){try{var _0x2e705a=new Buffer(_0x173836[_0x3125('0x11')]('binary'),_0x3125('0xe'));_0x4f3e1d[_0x3125('0xf')](_0x2e705a);_0x4f3e1d[_0x3125('0x10')]();_0x4f3e1d['on']('close',function(){return _0x230611(_0x4931f4);});}catch(_0x542aa0){fs['unlink'](_0x4931f4);return _0x18b366(_0x542aa0);}});});};exports[_0x3125('0x16')]=function(_0x373fbf,_0x41db71,_0x33cac5){var _0x37452b=_0x33cac5||stringOptions['algorithm'];var _0x3e09fa=_0x41db71||stringOptions[_0x3125('0x17')];var _0x55501f=crypto[_0x3125('0xc')](_0x37452b,_0x3e09fa);var _0x4467aa=_0x55501f[_0x3125('0xd')](_0x373fbf,'utf8',_0x3125('0x18'));_0x4467aa+=_0x55501f[_0x3125('0x11')](_0x3125('0x18'));return _0x4467aa;};exports['decryptString']=function(_0x2777bc,_0x365e0e,_0x1d0289){var _0x50f94c=_0x1d0289||stringOptions[_0x3125('0x6')];var _0x5d0a52=_0x365e0e||stringOptions[_0x3125('0x17')];var _0x206530=crypto[_0x3125('0x14')](_0x50f94c,_0x5d0a52);var _0x2b81c0=_0x206530[_0x3125('0xd')](_0x2777bc,_0x3125('0x18'),_0x3125('0x19'));_0x2b81c0+=_0x206530[_0x3125('0x11')]('utf8');return _0x2b81c0;}; \ No newline at end of file +var _0xb114=['createReadStream','createCipher','data','update','binary','end','final','write','close','unlink','decryptFile','createWriteStream','createDecipher','encryptString','secret','utf8','base64','decryptString','crypto','lodash','../../config/environment','app','secrets','session','aes192','encrypt','algorithm','join','error','test','getCiphers','filter','indexOf','hasOwnProperty','encryptFile'];(function(_0x2c6bd9,_0x51d3e9){var _0x3df4c7=function(_0x4f9c68){while(--_0x4f9c68){_0x2c6bd9['push'](_0x2c6bd9['shift']());}};_0x3df4c7(++_0x51d3e9);}(_0xb114,0x1d9));var _0x4b11=function(_0x35da42,_0x5c2610){_0x35da42=_0x35da42-0x0;var _0x370035=_0xb114[_0x35da42];return _0x370035;};'use strict';var crypto=require(_0x4b11('0x0'));var fs=require('fs');var BPromise=require('bluebird');var _=require(_0x4b11('0x1'));var config=require(_0x4b11('0x2'));var logger=require('../../config/logger')(_0x4b11('0x3'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x4b11('0x4')][_0x4b11('0x5')],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':_0x4b11('0x6')};if(config[_0x4b11('0x7')]&&config[_0x4b11('0x7')][_0x4b11('0x8')]){var isSupported=isAlgorithmSupported(config[_0x4b11('0x7')][_0x4b11('0x8')]);if(isSupported){fileOptions[_0x4b11('0x8')]=config['encrypt'][_0x4b11('0x8')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x4b11('0x9')](',\x20');logger[_0x4b11('0xa')](config[_0x4b11('0x7')]['algorithm'],'is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:',supportedAlgorithms);}}function isASupportedCipher(_0x2b7a51){return AES_SUPPORTED_RX[_0x4b11('0xb')](_0x2b7a51);}function getSupportedCiphers(){return crypto[_0x4b11('0xc')]()[_0x4b11('0xd')](isASupportedCipher);}function isAlgorithmSupported(_0x8e22a){return getSupportedCiphers()[_0x4b11('0xe')](_0x8e22a)>-0x1;}function combineOptions(_0x47c7f5){var _0x1bdcdf={};for(var _0x4c641f in fileOptions){if(fileOptions[_0x4b11('0xf')](_0x4c641f)){_0x1bdcdf[_0x4c641f]=fileOptions[_0x4c641f];}}if(_0x47c7f5){for(var _0x55497e in _0x47c7f5){if(_0x47c7f5[_0x4b11('0xf')](_0x55497e)){_0x1bdcdf[_0x55497e]=_0x47c7f5[_0x55497e];}}}return _0x1bdcdf;}exports[_0x4b11('0x10')]=function(_0x5e5d4b,_0x27afb4,_0x24b252,_0x635571){return new BPromise(function(_0x1e6ed2,_0x4d2b30){_0x635571=combineOptions(_0x635571);var _0xadbf5c=new Buffer(_0x24b252);var _0x34fde2=fs[_0x4b11('0x11')](_0x5e5d4b);var _0x16becf=fs['createWriteStream'](_0x27afb4);var _0x490401=crypto[_0x4b11('0x12')](_0x635571[_0x4b11('0x8')],_0xadbf5c);_0x34fde2['on'](_0x4b11('0x13'),function(_0x42f42a){var _0x4c623b=new Buffer(_0x490401[_0x4b11('0x14')](_0x42f42a),_0x4b11('0x15'));_0x16becf['write'](_0x4c623b);});_0x34fde2['on'](_0x4b11('0x16'),function(){try{var _0x320c4f=new Buffer(_0x490401[_0x4b11('0x17')](_0x4b11('0x15')),_0x4b11('0x15'));_0x16becf[_0x4b11('0x18')](_0x320c4f);_0x16becf[_0x4b11('0x16')]();_0x16becf['on'](_0x4b11('0x19'),function(){return _0x1e6ed2(_0x27afb4);});}catch(_0x59bab2){fs[_0x4b11('0x1a')](_0x27afb4);return _0x4d2b30(_0x59bab2);}});});};exports[_0x4b11('0x1b')]=function(_0x4a0f86,_0x495a86,_0x26bfe7,_0x3bf8a8){return new BPromise(function(_0x51de91,_0x5855b3){_0x3bf8a8=combineOptions(_0x3bf8a8);var _0x8bb483=new Buffer(_0x26bfe7);var _0x1a9f7c=fs['createReadStream'](_0x4a0f86);var _0x5b8fae=fs[_0x4b11('0x1c')](_0x495a86);var _0x44ce2b=crypto[_0x4b11('0x1d')](_0x3bf8a8[_0x4b11('0x8')],_0x8bb483);_0x1a9f7c['on'](_0x4b11('0x13'),function(_0x5476ba){var _0x435b79=new Buffer(_0x44ce2b[_0x4b11('0x14')](_0x5476ba),_0x4b11('0x15'));_0x5b8fae[_0x4b11('0x18')](_0x435b79);});_0x1a9f7c['on'](_0x4b11('0x16'),function(){try{var _0x34d92e=new Buffer(_0x44ce2b[_0x4b11('0x17')](_0x4b11('0x15')),_0x4b11('0x15'));_0x5b8fae['write'](_0x34d92e);_0x5b8fae['end']();_0x5b8fae['on'](_0x4b11('0x19'),function(){return _0x51de91(_0x495a86);});}catch(_0x3dfe3b){fs[_0x4b11('0x1a')](_0x495a86);return _0x5855b3(_0x3dfe3b);}});});};exports[_0x4b11('0x1e')]=function(_0x28b734,_0x3f805e,_0x27236d){var _0x25f48f=_0x27236d||stringOptions[_0x4b11('0x8')];var _0x12307e=_0x3f805e||stringOptions[_0x4b11('0x1f')];var _0x310260=crypto[_0x4b11('0x12')](_0x25f48f,_0x12307e);var _0xb0c051=_0x310260[_0x4b11('0x14')](_0x28b734,_0x4b11('0x20'),_0x4b11('0x21'));_0xb0c051+=_0x310260[_0x4b11('0x17')](_0x4b11('0x21'));return _0xb0c051;};exports[_0x4b11('0x22')]=function(_0x76efb6,_0x16e81a,_0xacc636){var _0x2a9c9c=_0xacc636||stringOptions[_0x4b11('0x8')];var _0x29c567=_0x16e81a||stringOptions[_0x4b11('0x1f')];var _0x260c6d=crypto[_0x4b11('0x1d')](_0x2a9c9c,_0x29c567);var _0x24b8b8=_0x260c6d[_0x4b11('0x14')](_0x76efb6,'base64','utf8');_0x24b8b8+=_0x260c6d[_0x4b11('0x17')](_0x4b11('0x20'));return _0x24b8b8;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 59213ad..42f6d90 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 _0x77f6=['bluebird','rimraf','../../mysqldb','../../config/logger','analytics','argv','savename','update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','Empty','length','range','num','isInteger','forEach','push','format','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','dirname','basename','.csv','existsSync','join','mkdirSync','each','%s%d.%s','csv','%s.%s','zip','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','Failed','exit','util','path','to-csv'];(function(_0xddb185,_0x2689a9){var _0x558d7f=function(_0x32aa90){while(--_0x32aa90){_0xddb185['push'](_0xddb185['shift']());}};_0x558d7f(++_0x2689a9);}(_0x77f6,0x129));var _0x677f=function(_0x46f464,_0x4d4d5b){_0x46f464=_0x46f464-0x0;var _0x16ed63=_0x77f6[_0x46f464];return _0x16ed63;};'use strict';var util=require(_0x677f('0x0'));var path=require(_0x677f('0x1'));var _=require('lodash');var csv=require(_0x677f('0x2'));var fs=require('fs');var BPromise=require(_0x677f('0x3'));var zipdir=require('zip-dir');var rimraf=require(_0x677f('0x4'));var db=require(_0x677f('0x5'))['db'];var dbH=require('../../mysqldb')['dbH'];var logger=require(_0x677f('0x6'))(_0x677f('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0x677f('0x8')][0x2]);var QUERY=process[_0x677f('0x8')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x118d3b,_0x2bccef){var _0x22c8f3={'status':_0x118d3b};var _0x282b61={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2bccef){_0x22c8f3[_0x677f('0x9')]=_0x2bccef;}return db['AnalyticExtractedReport'][_0x677f('0xa')](_0x22c8f3,_0x282b61);}function main(){var _0x341320=0x1388;var _0x51ba2a;logger[_0x677f('0xb')](util['format'](_0x677f('0xc'),EXTRACTED_REPORT_ID,_0x677f('0xd')));return db[_0x677f('0xe')][_0x677f('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x677f('0x10'),_0x677f('0x11')]})[_0x677f('0x12')](function(_0x40572e){if(_0x40572e){_0x51ba2a=_0x40572e;_0x341320=_0x51ba2a[_0x677f('0x11')]||0x1388;}})[_0x677f('0x12')](function(){return dbH[_0x677f('0x13')][_0x677f('0x14')](util['format'](_0x677f('0x15'),QUERY),{'type':dbH[_0x677f('0x13')][_0x677f('0x16')]['SELECT']});})[_0x677f('0x12')](function(_0x108bbe){if(!_0x108bbe[0x0]['num']){return analyticExtractedReport(_0x677f('0x17'));}var _0x189e8c=[];var _0x28fcb8=0x0;if(_0x51ba2a['split']){if(_0x108bbe&&_0x108bbe[_0x677f('0x18')]){var _0x2b24c4=_[_0x677f('0x19')](_0x108bbe[0x0][_0x677f('0x1a')]/_0x341320);var _0xd5b31b=Number[_0x677f('0x1b')](_0x108bbe[0x0][_0x677f('0x1a')]/_0x341320)?_0x108bbe[0x0][_0x677f('0x1a')]%_0x341320:0x0;_0x2b24c4[_0x677f('0x1c')](function(_0x4640a0){if(_0x4640a0>0x0){_0x28fcb8+=_0x341320;}_0x189e8c[_0x677f('0x1d')](dbH[_0x677f('0x13')][_0x677f('0x14')](util[_0x677f('0x1e')](_0x677f('0x1f'),QUERY,_0x341320,_0x28fcb8),{'type':dbH[_0x677f('0x13')][_0x677f('0x16')][_0x677f('0x20')]}));});if(_0xd5b31b>0x0){_0x28fcb8+=_0x341320;_0x189e8c[_0x677f('0x1d')](dbH[_0x677f('0x13')][_0x677f('0x14')](util['format'](_0x677f('0x1f'),QUERY,_0xd5b31b,_0x28fcb8),{'type':dbH[_0x677f('0x13')][_0x677f('0x16')][_0x677f('0x20')]}));}}}else{_0x189e8c[_0x677f('0x1d')](dbH[_0x677f('0x13')][_0x677f('0x14')](QUERY,{'type':dbH[_0x677f('0x13')]['QueryTypes'][_0x677f('0x20')]}));}var _0x5e29e7=path[_0x677f('0x21')](PATH);var _0x20a0ee=path[_0x677f('0x22')](PATH,_0x677f('0x23'));var _0x48de63=_0x51ba2a[_0x677f('0x10')]&&_0x189e8c[_0x677f('0x18')]>0x1;var _0x251d9b=[];if(!fs[_0x677f('0x24')](path[_0x677f('0x25')](_0x5e29e7,_0x20a0ee))&&_0x48de63){fs[_0x677f('0x26')](path[_0x677f('0x25')](_0x5e29e7,_0x20a0ee));}return BPromise[_0x677f('0x27')](_0x189e8c,function(_0x4f93b9){_0x251d9b[_0x677f('0x1d')](_0x4f93b9);})[_0x677f('0x12')](function(){for(var _0x1f8049=0x0;_0x1f8049<_0x251d9b[_0x677f('0x18')];_0x1f8049+=0x1){var _0x135795;var _0x5e3402=_0x251d9b[_0x1f8049];if(_0x48de63){_0x135795=path[_0x677f('0x25')](_0x5e29e7,_0x20a0ee,util[_0x677f('0x1e')](_0x677f('0x28'),_0x20a0ee,_0x1f8049,'csv'));}else{_0x135795=path[_0x677f('0x25')](_0x5e29e7,util['format']('%s.%s',_0x20a0ee,_0x677f('0x29')));}fs['writeFileSync'](_0x135795,csv(_0x5e3402));}})[_0x677f('0x12')](function(){if(_0x48de63){return new Promise(function(_0x20f5a4){zipdir(path[_0x677f('0x25')](_0x5e29e7,_0x20a0ee),{'saveTo':path[_0x677f('0x25')](_0x5e29e7,util[_0x677f('0x1e')](_0x677f('0x2a'),_0x20a0ee,_0x677f('0x2b')))},function(_0xf0133e,_0xe42478){rimraf(path[_0x677f('0x25')](_0x5e29e7,_0x20a0ee),function(){});_0x20f5a4('zip\x20finished');});});}})[_0x677f('0x12')](function(){logger[_0x677f('0xb')](util[_0x677f('0x1e')](_0x677f('0x2c'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0x677f('0x2d'),_0x48de63?util[_0x677f('0x1e')](_0x677f('0x2a'),_0x20a0ee,_0x48de63?_0x677f('0x2b'):_0x677f('0x29')):null);});})[_0x677f('0x2e')](function(_0x16ad42){logger[_0x677f('0xb')](util['format'](_0x677f('0x2f'),EXTRACTED_REPORT_ID,_0x677f('0xd')),util['inspect'](_0x16ad42,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x677f('0x30'));})['finally'](function(){process[_0x677f('0x31')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x5d19=['push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.csv','existsSync','join','mkdirSync','each','%s%d.%s','%s.%s','csv','writeFileSync','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Failed','finally','exit','path','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','splitSizeCsv','sequelize','query','format','QueryTypes','SELECT','then','length','range','num','isInteger','forEach'];(function(_0x44a181,_0x26891e){var _0x3a3043=function(_0x4c8e7){while(--_0x4c8e7){_0x44a181['push'](_0x44a181['shift']());}};_0x3a3043(++_0x26891e);}(_0x5d19,0x16b));var _0x95d1=function(_0x47a40b,_0x443ecf){_0x47a40b=_0x47a40b-0x0;var _0x19610c=_0x5d19[_0x47a40b];return _0x19610c;};'use strict';var util=require('util');var path=require(_0x95d1('0x0'));var _=require('lodash');var csv=require('to-csv');var fs=require('fs');var BPromise=require(_0x95d1('0x1'));var zipdir=require(_0x95d1('0x2'));var rimraf=require(_0x95d1('0x3'));var db=require(_0x95d1('0x4'))['db'];var dbH=require('../../mysqldb')[_0x95d1('0x5')];var logger=require(_0x95d1('0x6'))(_0x95d1('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0x95d1('0x8')][0x2]);var QUERY=process[_0x95d1('0x8')][0x3];var PATH=process[_0x95d1('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x29a6db,_0x41bfcd){var _0x21f108={'status':_0x29a6db};var _0x3d8e06={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x41bfcd){_0x21f108[_0x95d1('0x9')]=_0x41bfcd;}return db[_0x95d1('0xa')][_0x95d1('0xb')](_0x21f108,_0x3d8e06);}function main(){var _0x3430a9=0x1388;var _0x128c64;logger['info'](util['format'](_0x95d1('0xc'),EXTRACTED_REPORT_ID,_0x95d1('0xd')));return db[_0x95d1('0xe')][_0x95d1('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x95d1('0x10'),_0x95d1('0x11')]})['then'](function(_0x24b107){if(_0x24b107){_0x128c64=_0x24b107;_0x3430a9=_0x128c64['splitSizeCsv']||0x1388;}})['then'](function(){return dbH[_0x95d1('0x12')][_0x95d1('0x13')](util[_0x95d1('0x14')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH['sequelize'][_0x95d1('0x15')][_0x95d1('0x16')]});})[_0x95d1('0x17')](function(_0x9ec54e){if(!_0x9ec54e[0x0]['num']){return analyticExtractedReport('Empty');}var _0x5c8934=[];var _0x3174ea=0x0;if(_0x128c64[_0x95d1('0x10')]){if(_0x9ec54e&&_0x9ec54e[_0x95d1('0x18')]){var _0x144f56=_[_0x95d1('0x19')](_0x9ec54e[0x0][_0x95d1('0x1a')]/_0x3430a9);var _0x3286e7=Number[_0x95d1('0x1b')](_0x9ec54e[0x0][_0x95d1('0x1a')]/_0x3430a9)?_0x9ec54e[0x0][_0x95d1('0x1a')]%_0x3430a9:0x0;_0x144f56[_0x95d1('0x1c')](function(_0x13612b){if(_0x13612b>0x0){_0x3174ea+=_0x3430a9;}_0x5c8934[_0x95d1('0x1d')](dbH[_0x95d1('0x12')]['query'](util[_0x95d1('0x14')](_0x95d1('0x1e'),QUERY,_0x3430a9,_0x3174ea),{'type':dbH[_0x95d1('0x12')]['QueryTypes'][_0x95d1('0x16')]}));});if(_0x3286e7>0x0){_0x3174ea+=_0x3430a9;_0x5c8934[_0x95d1('0x1d')](dbH[_0x95d1('0x12')][_0x95d1('0x13')](util[_0x95d1('0x14')](_0x95d1('0x1e'),QUERY,_0x3286e7,_0x3174ea),{'type':dbH[_0x95d1('0x12')]['QueryTypes']['SELECT']}));}}}else{_0x5c8934[_0x95d1('0x1d')](dbH[_0x95d1('0x12')][_0x95d1('0x13')](QUERY,{'type':dbH[_0x95d1('0x12')][_0x95d1('0x15')][_0x95d1('0x16')]}));}var _0x8f3169=path[_0x95d1('0x1f')](PATH);var _0x2db1e1=path[_0x95d1('0x20')](PATH,_0x95d1('0x21'));var _0x4a4e1b=_0x128c64[_0x95d1('0x10')]&&_0x5c8934[_0x95d1('0x18')]>0x1;var _0x576fb1=[];if(!fs[_0x95d1('0x22')](path[_0x95d1('0x23')](_0x8f3169,_0x2db1e1))&&_0x4a4e1b){fs[_0x95d1('0x24')](path['join'](_0x8f3169,_0x2db1e1));}return BPromise[_0x95d1('0x25')](_0x5c8934,function(_0x363987){_0x576fb1['push'](_0x363987);})[_0x95d1('0x17')](function(){for(var _0x51eead=0x0;_0x51eead<_0x576fb1[_0x95d1('0x18')];_0x51eead+=0x1){var _0x30ee41;var _0x2f7499=_0x576fb1[_0x51eead];if(_0x4a4e1b){_0x30ee41=path[_0x95d1('0x23')](_0x8f3169,_0x2db1e1,util[_0x95d1('0x14')](_0x95d1('0x26'),_0x2db1e1,_0x51eead,'csv'));}else{_0x30ee41=path[_0x95d1('0x23')](_0x8f3169,util[_0x95d1('0x14')](_0x95d1('0x27'),_0x2db1e1,_0x95d1('0x28')));}fs[_0x95d1('0x29')](_0x30ee41,csv(_0x2f7499));}})[_0x95d1('0x17')](function(){if(_0x4a4e1b){return new Promise(function(_0xe0b6af){zipdir(path[_0x95d1('0x23')](_0x8f3169,_0x2db1e1),{'saveTo':path[_0x95d1('0x23')](_0x8f3169,util[_0x95d1('0x14')](_0x95d1('0x27'),_0x2db1e1,_0x95d1('0x2a')))},function(_0x34500b,_0x35955c){rimraf(path[_0x95d1('0x23')](_0x8f3169,_0x2db1e1),function(){});_0xe0b6af('zip\x20finished');});});}})[_0x95d1('0x17')](function(){logger['info'](util['format'](_0x95d1('0x2b'),EXTRACTED_REPORT_ID,_0x95d1('0xd')));return analyticExtractedReport(_0x95d1('0x2c'),_0x4a4e1b?util[_0x95d1('0x14')]('%s.%s',_0x2db1e1,_0x4a4e1b?_0x95d1('0x2a'):_0x95d1('0x28')):null);});})[_0x95d1('0x2d')](function(_0x1e0acf){logger['info'](util[_0x95d1('0x14')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x95d1('0xd')),util['inspect'](_0x1e0acf,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x95d1('0x2e'));})[_0x95d1('0x2f')](function(){process[_0x95d1('0x30')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index df5d748..5d0d5dd 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 _0xefe9=['%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','query','dirname','.pdf','existsSync','join','each','flatten','%s%d.%s','pdf','all','%s.%s','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','AnalyticExtractedReport','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','inspect','Failed','finally','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','YYYY-MM-DD','Arial','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish','error','end','createPdfFromHTML','createPdfKitDocument','lodash','util','path','moment','pdfmake/src/printer','zip-dir','rimraf','jsdom','JSDOM','window','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','update','tableHeader','map','value','fill','length','auto','body','concat','forEach','push','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','endDate','header','pageBreak','before','margin','landscape','toString','\x20/\x20','black','num','find','split','splitSizePdf','then','range','isInteger','sequelize'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xefe9,0xe7));var _0x9efe=function(_0x13a1d0,_0x59dc20){_0x13a1d0=_0x13a1d0-0x0;var _0x3cabcc=_0xefe9[_0x13a1d0];return _0x3cabcc;};'use strict';var _=require(_0x9efe('0x0'));var fs=require('fs');var util=require(_0x9efe('0x1'));var path=require(_0x9efe('0x2'));var moment=require(_0x9efe('0x3'));var htmlToPdfmake=require('html-to-pdfmake');var PdfPrinter=require(_0x9efe('0x4'));var zipdir=require(_0x9efe('0x5'));var rimraf=require(_0x9efe('0x6'));var JSDOM=require(_0x9efe('0x7'))[_0x9efe('0x8')];var window=new JSDOM('')[_0x9efe('0x9')];var BPromise=require(_0x9efe('0xa'));var db=require('../../mysqldb')['db'];var dbH=require(_0x9efe('0xb'))[_0x9efe('0xc')];var logger=require(_0x9efe('0xd'))(_0x9efe('0xe'));var EXTRACTED_REPORT_ID=Number(process[_0x9efe('0xf')][0x2]);var QUERY=process[_0x9efe('0xf')][0x3];var PATH=process[_0x9efe('0xf')][0x4];var NAME=process[_0x9efe('0xf')][0x5];var FORMAT='MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a';var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x1cb1f6,_0x277a3f){var _0x333c1d={'status':_0x1cb1f6};var _0x6f5e14={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x277a3f){_0x333c1d['savename']=_0x277a3f;}return db['AnalyticExtractedReport'][_0x9efe('0x10')](_0x333c1d,_0x6f5e14);}function getHeaders(_0x16526a){return _['map'](_0x16526a,function(_0x1c4b22){return{'text':_0x1c4b22,'style':_0x9efe('0x11')};});}function getRows(_0x1283b9,_0x1158d7){return _['map'](_0x1158d7,function(_0x2fd585){return _(_0x2fd585)['pick'](_0x1283b9)[_0x9efe('0x12')](function(_0x4b91e3){return _0x4b91e3?_['toString'](_0x4b91e3):'';})[_0x9efe('0x13')]();});}function createTable(_0x3038bb,_0x31c545){var _0x3e3abf={'widths':_[_0x9efe('0x14')](Array(_0x3038bb[_0x9efe('0x15')]),0x91),'heights':function(_0x297891){return _0x297891===0x0?_0x9efe('0x16'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x158d51=getHeaders(_0x3038bb);_0x3e3abf[_0x9efe('0x17')]['push'](_0x158d51);var _0x2de859=getRows(_0x3038bb,_0x31c545);_0x3e3abf[_0x9efe('0x17')]=_0x3e3abf[_0x9efe('0x17')][_0x9efe('0x18')](_0x2de859);return _0x3e3abf;}function createTables(_0x482d02){var _0x380fa8=[];var _0x2b213d=_['chunk'](Object['keys'](_0x482d02[0x0]),0x5);_0x2b213d[_0x9efe('0x19')](function(_0x3cda27){_0x380fa8[_0x9efe('0x1a')](createTable(_0x3cda27,_0x482d02));});return _0x380fa8;}function getPDFDocDefinition(_0x3112c4){var _0x13a901=util[_0x9efe('0x1b')](_0x9efe('0x1c'),NAME,EXTRACTED_REPORT[_0x9efe('0x1d')],moment(EXTRACTED_REPORT[_0x9efe('0x1e')])[_0x9efe('0x1b')](FORMAT),moment(EXTRACTED_REPORT[_0x9efe('0x1f')])[_0x9efe('0x1b')](FORMAT));var _0x1d96ae=[];for(var _0x9455de=0x0;_0x9455de<_0x3112c4[_0x9efe('0x15')];_0x9455de++){var _0xe61bf2=[];if(_0x9455de===0x0){_0xe61bf2[_0x9efe('0x1a')]({'text':_0x13a901,'style':_0x9efe('0x20')});}var _0x11eee4={'table':_0x3112c4[_0x9455de]};if(_0x9455de>0x0){_0x11eee4[_0x9efe('0x21')]=_0x9efe('0x22');_0x11eee4[_0x9efe('0x23')]=[0x0,0x46,0x0,0x0];}_0xe61bf2['push'](_0x11eee4);_0x1d96ae[_0x9efe('0x1a')](_0xe61bf2);}return{'pageSize':'A4','pageOrientation':_0x9efe('0x24'),'content':_0x1d96ae,'footer':function(_0x4103f2,_0x2820ba){return{'text':_0x4103f2[_0x9efe('0x25')]()+_0x9efe('0x26')+_0x2820ba,'style':'footer'};},'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x9efe('0x27')},'footer':{'alignment':'right','margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x1c60f5){var _0x5507fc=0x1388;var _0x4b3629;if(!_0x1c60f5[0x0][_0x9efe('0x28')]){return analyticExtractedReport('Empty');}return db['Setting'][_0x9efe('0x29')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x9efe('0x2a'),_0x9efe('0x2b')]})[_0x9efe('0x2c')](function(_0x2f225a){if(_0x2f225a){_0x4b3629=_0x2f225a;_0x5507fc=_0x4b3629[_0x9efe('0x2b')]||0x3e8;}})[_0x9efe('0x2c')](function(){var _0x233c19=[];var _0x4e3c9d=0x0;if(_0x4b3629[_0x9efe('0x2a')]){if(_0x1c60f5&&_0x1c60f5[_0x9efe('0x15')]){var _0x471369=_[_0x9efe('0x2d')](_0x1c60f5[0x0][_0x9efe('0x28')]/_0x5507fc);var _0x49d6e4=Number[_0x9efe('0x2e')](_0x1c60f5[0x0][_0x9efe('0x28')]/_0x5507fc)?_0x1c60f5[0x0][_0x9efe('0x28')]%_0x5507fc:0x0;_0x471369[_0x9efe('0x19')](function(_0x1907d0){if(_0x1907d0>0x0){_0x4e3c9d+=_0x5507fc;}_0x233c19[_0x9efe('0x1a')](dbH[_0x9efe('0x2f')]['query'](util['format'](_0x9efe('0x30'),QUERY,_0x5507fc,_0x4e3c9d),{'type':dbH['sequelize'][_0x9efe('0x31')][_0x9efe('0x32')]}));});if(_0x49d6e4>0x0){_0x4e3c9d+=_0x5507fc;_0x233c19[_0x9efe('0x1a')](dbH[_0x9efe('0x2f')][_0x9efe('0x33')](util[_0x9efe('0x1b')](_0x9efe('0x30'),QUERY,_0x49d6e4,_0x4e3c9d),{'type':dbH[_0x9efe('0x2f')]['QueryTypes'][_0x9efe('0x32')]}));}}}else{_0x233c19[_0x9efe('0x1a')](dbH['sequelize']['query'](QUERY,{'type':dbH[_0x9efe('0x2f')][_0x9efe('0x31')][_0x9efe('0x32')]}));}var _0x413bbb=path[_0x9efe('0x34')](PATH);var _0x2ed0bb=path['basename'](PATH,_0x9efe('0x35'));var _0x4e3148=_0x4b3629['split']&&_0x233c19[_0x9efe('0x15')]>0x1;var _0xd31abb=[];if(!fs[_0x9efe('0x36')](path[_0x9efe('0x37')](_0x413bbb,_0x2ed0bb))&&_0x4e3148){fs['mkdirSync'](path[_0x9efe('0x37')](_0x413bbb,_0x2ed0bb));}return BPromise[_0x9efe('0x38')](_0x233c19,function(_0x1fcd0d){_0xd31abb[_0x9efe('0x1a')](_0x1fcd0d);})[_0x9efe('0x2c')](function(){var _0x5d206c=[];for(var _0x352d9d=0x0;_0x352d9d<_0xd31abb[_0x9efe('0x15')];_0x352d9d+=0x1){var _0x517261=_0xd31abb[_0x352d9d];var _0x7d89bd=createTables(_[_0x9efe('0x39')](_0x517261));var _0x32eeff;var _0x303914=getPDFDocDefinition(_0x7d89bd);var _0x173e21=getPDFPrinter();var _0x13b5da=_0x173e21['createPdfKitDocument'](_0x303914);if(_0x4e3148){_0x32eeff=path[_0x9efe('0x37')](_0x413bbb,_0x2ed0bb,util['format'](_0x9efe('0x3a'),_0x2ed0bb,_0x352d9d,_0x9efe('0x3b')));}else{_0x32eeff=path[_0x9efe('0x37')](_0x413bbb,util[_0x9efe('0x1b')]('%s.%s',_0x2ed0bb,_0x9efe('0x3b')));}_0x5d206c['push'](writePDFDocument(_0x13b5da,_0x32eeff));}return Promise[_0x9efe('0x3c')](_0x5d206c);})['then'](function(){if(_0x4e3148){return new Promise(function(_0x324695){zipdir(path[_0x9efe('0x37')](_0x413bbb,_0x2ed0bb),{'saveTo':path['join'](_0x413bbb,util[_0x9efe('0x1b')](_0x9efe('0x3d'),_0x2ed0bb,_0x9efe('0x3e')))},function(){rimraf(path['join'](_0x413bbb,_0x2ed0bb),function(){});_0x324695(_0x9efe('0x3f'));});});}})[_0x9efe('0x2c')](function(){if(!_0x4e3148)return;rimraf(path['join'](_0x413bbb,_0x2ed0bb),function(){});})[_0x9efe('0x2c')](function(){logger[_0x9efe('0x40')](util['format'](_0x9efe('0x41'),EXTRACTED_REPORT_ID,_0x9efe('0x42')));return analyticExtractedReport(_0x9efe('0x43'),_0x4e3148?util[_0x9efe('0x1b')]('%s.%s',_0x2ed0bb,_0x4e3148?_0x9efe('0x3e'):_0x9efe('0x3b')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger['info'](util[_0x9efe('0x1b')](_0x9efe('0x44'),EXTRACTED_REPORT_ID,_0x9efe('0x42')));return db[_0x9efe('0x45')]['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})[_0x9efe('0x2c')](function(_0x42d183){EXTRACTED_REPORT=_0x42d183;return dbH[_0x9efe('0x2f')][_0x9efe('0x33')](util[_0x9efe('0x1b')](_0x9efe('0x46'),QUERY),{'type':dbH[_0x9efe('0x2f')][_0x9efe('0x31')]['SELECT']});})[_0x9efe('0x2c')](extractReport)[_0x9efe('0x47')](function(_0xef538d){logger[_0x9efe('0x40')](util[_0x9efe('0x1b')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x9efe('0x42')),util[_0x9efe('0x48')](_0xef538d,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x9efe('0x49'));})[_0x9efe('0x4a')](function(){process['exit'](EXIT_CODE);});}main();function getPDFPrinter(){var _0x5a6c40=new PdfPrinter({'Arial':{'normal':__dirname+_0x9efe('0x4b'),'bold':__dirname+_0x9efe('0x4c'),'italics':__dirname+'/fonts/arial-italic.ttf','bolditalics':__dirname+_0x9efe('0x4d')}});return _0x5a6c40;}function getPDFDocDefinitionFromHTML(_0x28f467,_0x474262){var _0x138eaa=util['format'](_0x9efe('0x4e'),_0x474262[_0x9efe('0x4f')],_0x474262[_0x9efe('0x50')]);var _0x551aad=moment()[_0x9efe('0x1b')](_0x9efe('0x51'))[_0x9efe('0x25')]();var _0x583377=htmlToPdfmake(_0x28f467,{'window':window,'tableAutoSize':!![]});return{'content':[_0x583377],'defaultStyle':{'font':_0x9efe('0x52')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x9efe('0x53'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':'center','margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x9efe('0x53')}},'header':function(){return[{'text':_0x9efe('0x54'),'style':_0x9efe('0x20')}];},'footer':function(_0x2c43ca,_0x393f81){return[{'text':util['format'](_0x9efe('0x55'),_0x138eaa,_0x2c43ca,_0x393f81,_0x551aad),'style':'footer'}];}};}function writePDFDocument(_0x3732c5,_0x4faefd){return new Promise(function(_0x29822c,_0x26fa3f){var _0x3f14e3=_0x3732c5[_0x9efe('0x56')](fs[_0x9efe('0x57')](_0x4faefd));_0x3f14e3['on']('finish',function(){_0x29822c(_0x9efe('0x58'));});_0x3f14e3['on'](_0x9efe('0x59'),function(_0x3fe4f5){_0x26fa3f(_0x3fe4f5);});_0x3732c5[_0x9efe('0x5a')]();});}exports[_0x9efe('0x5b')]=function(_0x54634d,_0x4c0a25){var _0x1efb4c=getPDFPrinter();var _0x2523b3=getPDFDocDefinitionFromHTML(_0x54634d,_0x4c0a25);var _0x44b753=_0x1efb4c[_0x9efe('0x5c')](_0x2523b3);return writePDFDocument(_0x44b753,_0x4c0a25[_0x9efe('0x2')])[_0x9efe('0x47')](function(_0x2e2b33){throw _0x2e2b33;});}; \ No newline at end of file +var _0xc114=['num','Empty','find','split','splitSizePdf','then','range','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','QueryTypes','dirname','basename','.pdf','existsSync','join','each','flatten','createPdfKitDocument','pdf','all','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','%s.%s','zip','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','/fonts/arial-bold.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','toString','center','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish','end','createPdfFromHTML','util','path','moment','html-to-pdfmake','pdfmake/src/printer','rimraf','jsdom','JSDOM','window','bluebird','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','tableHeader','map','pick','value','fill','length','auto','push','chunk','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','startDate','endDate','pageBreak','before','landscape','\x20/\x20','footer','Arial','black','right'];(function(_0x417d13,_0x3a4d19){var _0x19b497=function(_0x1cee2e){while(--_0x1cee2e){_0x417d13['push'](_0x417d13['shift']());}};_0x19b497(++_0x3a4d19);}(_0xc114,0x18d));var _0x4c11=function(_0x6cae94,_0xdc5922){_0x6cae94=_0x6cae94-0x0;var _0x4b7efd=_0xc114[_0x6cae94];return _0x4b7efd;};'use strict';var _=require('lodash');var fs=require('fs');var util=require(_0x4c11('0x0'));var path=require(_0x4c11('0x1'));var moment=require(_0x4c11('0x2'));var htmlToPdfmake=require(_0x4c11('0x3'));var PdfPrinter=require(_0x4c11('0x4'));var zipdir=require('zip-dir');var rimraf=require(_0x4c11('0x5'));var JSDOM=require(_0x4c11('0x6'))[_0x4c11('0x7')];var window=new JSDOM('')[_0x4c11('0x8')];var BPromise=require(_0x4c11('0x9'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')['dbH'];var logger=require('../../config/logger')(_0x4c11('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0x4c11('0xb')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x4c11('0xb')][0x4];var NAME=process['argv'][0x5];var FORMAT=_0x4c11('0xc');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x4eb0c3,_0x442d14){var _0x3908bd={'status':_0x4eb0c3};var _0x2bd4d6={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x442d14){_0x3908bd[_0x4c11('0xd')]=_0x442d14;}return db[_0x4c11('0xe')][_0x4c11('0xf')](_0x3908bd,_0x2bd4d6);}function getHeaders(_0x5c7855){return _['map'](_0x5c7855,function(_0x3e8048){return{'text':_0x3e8048,'style':_0x4c11('0x10')};});}function getRows(_0x3aacc0,_0x2490f2){return _[_0x4c11('0x11')](_0x2490f2,function(_0x30cc69){return _(_0x30cc69)[_0x4c11('0x12')](_0x3aacc0)['map'](function(_0x4d94a4){return _0x4d94a4?_['toString'](_0x4d94a4):'';})[_0x4c11('0x13')]();});}function createTable(_0x5d301f,_0x5ea49c){var _0x1894ca={'widths':_[_0x4c11('0x14')](Array(_0x5d301f[_0x4c11('0x15')]),0x91),'heights':function(_0x74456e){return _0x74456e===0x0?_0x4c11('0x16'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0xa75597=getHeaders(_0x5d301f);_0x1894ca['body'][_0x4c11('0x17')](_0xa75597);var _0x355933=getRows(_0x5d301f,_0x5ea49c);_0x1894ca['body']=_0x1894ca['body']['concat'](_0x355933);return _0x1894ca;}function createTables(_0x2b2cc9){var _0x1f63d2=[];var _0x7708bb=_[_0x4c11('0x18')](Object['keys'](_0x2b2cc9[0x0]),0x5);_0x7708bb[_0x4c11('0x19')](function(_0x558ae1){_0x1f63d2['push'](createTable(_0x558ae1,_0x2b2cc9));});return _0x1f63d2;}function getPDFDocDefinition(_0x4baa2d){var _0x282cff=util[_0x4c11('0x1a')](_0x4c11('0x1b'),NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT[_0x4c11('0x1c')])['format'](FORMAT),moment(EXTRACTED_REPORT[_0x4c11('0x1d')])['format'](FORMAT));var _0x25718a=[];for(var _0x111ea1=0x0;_0x111ea1<_0x4baa2d[_0x4c11('0x15')];_0x111ea1++){var _0x3bfa99=[];if(_0x111ea1===0x0){_0x3bfa99['push']({'text':_0x282cff,'style':'header'});}var _0x465ee9={'table':_0x4baa2d[_0x111ea1]};if(_0x111ea1>0x0){_0x465ee9[_0x4c11('0x1e')]=_0x4c11('0x1f');_0x465ee9['margin']=[0x0,0x46,0x0,0x0];}_0x3bfa99[_0x4c11('0x17')](_0x465ee9);_0x25718a[_0x4c11('0x17')](_0x3bfa99);}return{'pageSize':'A4','pageOrientation':_0x4c11('0x20'),'content':_0x25718a,'footer':function(_0xfc18e4,_0x1cdec3){return{'text':_0xfc18e4['toString']()+_0x4c11('0x21')+_0x1cdec3,'style':_0x4c11('0x22')};},'defaultStyle':{'font':_0x4c11('0x23')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x4c11('0x24')},'footer':{'alignment':_0x4c11('0x25'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x423163){var _0x532266=0x1388;var _0x531264;if(!_0x423163[0x0][_0x4c11('0x26')]){return analyticExtractedReport(_0x4c11('0x27'));}return db['Setting'][_0x4c11('0x28')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x4c11('0x29'),_0x4c11('0x2a')]})['then'](function(_0x52d92d){if(_0x52d92d){_0x531264=_0x52d92d;_0x532266=_0x531264[_0x4c11('0x2a')]||0x3e8;}})[_0x4c11('0x2b')](function(){var _0x2455b7=[];var _0x4e3798=0x0;if(_0x531264[_0x4c11('0x29')]){if(_0x423163&&_0x423163[_0x4c11('0x15')]){var _0x5e478e=_[_0x4c11('0x2c')](_0x423163[0x0][_0x4c11('0x26')]/_0x532266);var _0x449746=Number['isInteger'](_0x423163[0x0][_0x4c11('0x26')]/_0x532266)?_0x423163[0x0][_0x4c11('0x26')]%_0x532266:0x0;_0x5e478e[_0x4c11('0x19')](function(_0x1699a1){if(_0x1699a1>0x0){_0x4e3798+=_0x532266;}_0x2455b7[_0x4c11('0x17')](dbH[_0x4c11('0x2d')][_0x4c11('0x2e')](util[_0x4c11('0x1a')](_0x4c11('0x2f'),QUERY,_0x532266,_0x4e3798),{'type':dbH[_0x4c11('0x2d')]['QueryTypes'][_0x4c11('0x30')]}));});if(_0x449746>0x0){_0x4e3798+=_0x532266;_0x2455b7[_0x4c11('0x17')](dbH['sequelize'][_0x4c11('0x2e')](util['format'](_0x4c11('0x2f'),QUERY,_0x449746,_0x4e3798),{'type':dbH[_0x4c11('0x2d')][_0x4c11('0x31')][_0x4c11('0x30')]}));}}}else{_0x2455b7[_0x4c11('0x17')](dbH[_0x4c11('0x2d')]['query'](QUERY,{'type':dbH[_0x4c11('0x2d')][_0x4c11('0x31')][_0x4c11('0x30')]}));}var _0x2ef9cc=path[_0x4c11('0x32')](PATH);var _0x459fb7=path[_0x4c11('0x33')](PATH,_0x4c11('0x34'));var _0x29f172=_0x531264[_0x4c11('0x29')]&&_0x2455b7[_0x4c11('0x15')]>0x1;var _0x32b933=[];if(!fs[_0x4c11('0x35')](path[_0x4c11('0x36')](_0x2ef9cc,_0x459fb7))&&_0x29f172){fs['mkdirSync'](path[_0x4c11('0x36')](_0x2ef9cc,_0x459fb7));}return BPromise[_0x4c11('0x37')](_0x2455b7,function(_0x31c609){_0x32b933['push'](_0x31c609);})['then'](function(){var _0x4bfdcf=[];for(var _0x326f0f=0x0;_0x326f0f<_0x32b933[_0x4c11('0x15')];_0x326f0f+=0x1){var _0x4dbf69=_0x32b933[_0x326f0f];var _0x1a29d5=createTables(_[_0x4c11('0x38')](_0x4dbf69));var _0x510238;var _0x44fba1=getPDFDocDefinition(_0x1a29d5);var _0x3298c0=getPDFPrinter();var _0x2ed26a=_0x3298c0[_0x4c11('0x39')](_0x44fba1);if(_0x29f172){_0x510238=path[_0x4c11('0x36')](_0x2ef9cc,_0x459fb7,util[_0x4c11('0x1a')]('%s%d.%s',_0x459fb7,_0x326f0f,_0x4c11('0x3a')));}else{_0x510238=path[_0x4c11('0x36')](_0x2ef9cc,util['format']('%s.%s',_0x459fb7,_0x4c11('0x3a')));}_0x4bfdcf[_0x4c11('0x17')](writePDFDocument(_0x2ed26a,_0x510238));}return Promise[_0x4c11('0x3b')](_0x4bfdcf);})[_0x4c11('0x2b')](function(){if(_0x29f172){return new Promise(function(_0x18a102){zipdir(path['join'](_0x2ef9cc,_0x459fb7),{'saveTo':path[_0x4c11('0x36')](_0x2ef9cc,util[_0x4c11('0x1a')]('%s.%s',_0x459fb7,'zip'))},function(){rimraf(path[_0x4c11('0x36')](_0x2ef9cc,_0x459fb7),function(){});_0x18a102(_0x4c11('0x3c'));});});}})['then'](function(){if(!_0x29f172)return;rimraf(path[_0x4c11('0x36')](_0x2ef9cc,_0x459fb7),function(){});})[_0x4c11('0x2b')](function(){logger['info'](util[_0x4c11('0x1a')](_0x4c11('0x3d'),EXTRACTED_REPORT_ID,_0x4c11('0x3e')));return analyticExtractedReport(_0x4c11('0x3f'),_0x29f172?util['format'](_0x4c11('0x40'),_0x459fb7,_0x29f172?_0x4c11('0x41'):_0x4c11('0x3a')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x4c11('0x42')](util[_0x4c11('0x1a')](_0x4c11('0x43'),EXTRACTED_REPORT_ID,_0x4c11('0x3e')));return db[_0x4c11('0xe')]['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})[_0x4c11('0x2b')](function(_0x54bb9f){EXTRACTED_REPORT=_0x54bb9f;return dbH[_0x4c11('0x2d')][_0x4c11('0x2e')](util[_0x4c11('0x1a')](_0x4c11('0x44'),QUERY),{'type':dbH[_0x4c11('0x2d')][_0x4c11('0x31')][_0x4c11('0x30')]});})[_0x4c11('0x2b')](extractReport)[_0x4c11('0x45')](function(_0x448325){logger[_0x4c11('0x42')](util['format'](_0x4c11('0x46'),EXTRACTED_REPORT_ID,_0x4c11('0x3e')),util[_0x4c11('0x47')](_0x448325,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x4c11('0x48'));})[_0x4c11('0x49')](function(){process['exit'](EXIT_CODE);});}main();function getPDFPrinter(){var _0x3f0e8f=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+_0x4c11('0x4a'),'italics':__dirname+'/fonts/arial-italic.ttf','bolditalics':__dirname+_0x4c11('0x4b')}});return _0x3f0e8f;}function getPDFDocDefinitionFromHTML(_0x44a3f5,_0x4b2f12){var _0x1a08bb=util[_0x4c11('0x1a')](_0x4c11('0x4c'),_0x4b2f12[_0x4c11('0x4d')],_0x4b2f12[_0x4c11('0x4e')]);var _0x27d4ee=moment()[_0x4c11('0x1a')]('YYYY-MM-DD')[_0x4c11('0x4f')]();var _0x52adce=htmlToPdfmake(_0x44a3f5,{'window':window,'tableAutoSize':!![]});return{'content':[_0x52adce],'defaultStyle':{'font':_0x4c11('0x23')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x4c11('0x50'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x4c11('0x50'),'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':'header'}];},'footer':function(_0x978b17,_0xf1abb3){return[{'text':util[_0x4c11('0x1a')](_0x4c11('0x51'),_0x1a08bb,_0x978b17,_0xf1abb3,_0x27d4ee),'style':_0x4c11('0x22')}];}};}function writePDFDocument(_0x25a053,_0x4f22ab){return new Promise(function(_0x54ed5c,_0x2604b1){var _0x27ebd2=_0x25a053[_0x4c11('0x52')](fs[_0x4c11('0x53')](_0x4f22ab));_0x27ebd2['on']('finish',function(){_0x54ed5c(_0x4c11('0x54'));});_0x27ebd2['on']('error',function(_0xfdf07e){_0x2604b1(_0xfdf07e);});_0x25a053[_0x4c11('0x55')]();});}exports[_0x4c11('0x56')]=function(_0x58994d,_0x2eadc9){var _0x43c037=getPDFPrinter();var _0x29b2c0=getPDFDocDefinitionFromHTML(_0x58994d,_0x2eadc9);var _0x10fc89=_0x43c037[_0x4c11('0x39')](_0x29b2c0);return writePDFDocument(_0x10fc89,_0x2eadc9[_0x4c11('0x1')])[_0x4c11('0x45')](function(_0x4b970f){throw _0x4b970f;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 0ff0df9..0352ca0 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 _0xdebb=['then','sequelize','QueryTypes','SELECT','num','Empty','length','isInteger','forEach','query','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.xlsx','join','mkdirSync','each','push','%s%d.%s','xlsx','writeFileSync','%s.%s','zip','zip\x20finished','Completed','inspect','Failed','finally','util','path','lodash','json2xls','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','split','splitSizeXlsx'];(function(_0x16e3f4,_0x4799a1){var _0x2460e1=function(_0x14c475){while(--_0x14c475){_0x16e3f4['push'](_0x16e3f4['shift']());}};_0x2460e1(++_0x4799a1);}(_0xdebb,0x19c));var _0xbdeb=function(_0xdc2de4,_0x751109){_0xdc2de4=_0xdc2de4-0x0;var _0x11e0da=_0xdebb[_0xdc2de4];return _0x11e0da;};'use strict';var util=require(_0xbdeb('0x0'));var path=require(_0xbdeb('0x1'));var _=require(_0xbdeb('0x2'));var fs=require('fs');var json2xls=require(_0xbdeb('0x3'));var BPromise=require('bluebird');var zipdir=require(_0xbdeb('0x4'));var rimraf=require(_0xbdeb('0x5'));var db=require(_0xbdeb('0x6'))['db'];var dbH=require(_0xbdeb('0x6'))[_0xbdeb('0x7')];var logger=require(_0xbdeb('0x8'))(_0xbdeb('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0xbdeb('0xa')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xbdeb('0xa')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x4624f5,_0x4c9224){var _0x31b202={'status':_0x4624f5};var _0xfc86bb={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4c9224){_0x31b202['savename']=_0x4c9224;}return db[_0xbdeb('0xb')][_0xbdeb('0xc')](_0x31b202,_0xfc86bb);}function main(){var _0x27dec9=0x1388;var _0x2d043c;logger[_0xbdeb('0xd')](util[_0xbdeb('0xe')](_0xbdeb('0xf'),EXTRACTED_REPORT_ID,_0xbdeb('0x10')));return db[_0xbdeb('0x11')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xbdeb('0x12'),_0xbdeb('0x13')]})['then'](function(_0x20d670){if(_0x20d670){_0x2d043c=_0x20d670;_0x27dec9=_0x2d043c['splitSizeXlsx']||0x1388;}})[_0xbdeb('0x14')](function(){return dbH[_0xbdeb('0x15')]['query'](util[_0xbdeb('0xe')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xbdeb('0x15')][_0xbdeb('0x16')][_0xbdeb('0x17')]});})['then'](function(_0x46dc21){if(!_0x46dc21[0x0][_0xbdeb('0x18')]){return analyticExtractedReport(_0xbdeb('0x19'));}var _0xc21e9f=[];var _0x30213b=0x0;if(_0x2d043c[_0xbdeb('0x12')]){if(_0x46dc21&&_0x46dc21[_0xbdeb('0x1a')]){var _0x175bb6=_['range'](_0x46dc21[0x0][_0xbdeb('0x18')]/_0x27dec9);var _0x4e5cbb=Number[_0xbdeb('0x1b')](_0x46dc21[0x0][_0xbdeb('0x18')]/_0x27dec9)?_0x46dc21[0x0][_0xbdeb('0x18')]%_0x27dec9:0x0;_0x175bb6[_0xbdeb('0x1c')](function(_0x54d26e){if(_0x54d26e>0x0){_0x30213b+=_0x27dec9;}_0xc21e9f['push'](dbH['sequelize'][_0xbdeb('0x1d')](util[_0xbdeb('0xe')](_0xbdeb('0x1e'),QUERY,_0x27dec9,_0x30213b),{'type':dbH['sequelize']['QueryTypes'][_0xbdeb('0x17')]}));});if(_0x4e5cbb>0x0){_0x30213b+=_0x27dec9;_0xc21e9f['push'](dbH[_0xbdeb('0x15')][_0xbdeb('0x1d')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x4e5cbb,_0x30213b),{'type':dbH[_0xbdeb('0x15')][_0xbdeb('0x16')]['SELECT']}));}}}else{_0xc21e9f['push'](dbH[_0xbdeb('0x15')][_0xbdeb('0x1d')](QUERY,{'type':dbH[_0xbdeb('0x15')][_0xbdeb('0x16')][_0xbdeb('0x17')]}));}var _0x220f13=path[_0xbdeb('0x1f')](PATH);var _0x4edeb8=path[_0xbdeb('0x20')](PATH,_0xbdeb('0x21'));var _0x3dcac8=_0x2d043c[_0xbdeb('0x12')]&&_0xc21e9f[_0xbdeb('0x1a')]>0x1;var _0x446238=[];if(!fs['existsSync'](path[_0xbdeb('0x22')](_0x220f13,_0x4edeb8))&&_0x3dcac8){fs[_0xbdeb('0x23')](path[_0xbdeb('0x22')](_0x220f13,_0x4edeb8));}return BPromise[_0xbdeb('0x24')](_0xc21e9f,function(_0x129282){_0x446238[_0xbdeb('0x25')](_0x129282);})[_0xbdeb('0x14')](function(){for(var _0x58a411=0x0;_0x58a411<_0x446238['length'];_0x58a411+=0x1){var _0xc018be;var _0x68cd66=_0x446238[_0x58a411];if(_0x3dcac8){_0xc018be=path[_0xbdeb('0x22')](_0x220f13,_0x4edeb8,util[_0xbdeb('0xe')](_0xbdeb('0x26'),_0x4edeb8,_0x58a411,_0xbdeb('0x27')));}else{_0xc018be=path['join'](_0x220f13,util[_0xbdeb('0xe')]('%s.%s',_0x4edeb8,_0xbdeb('0x27')));}fs[_0xbdeb('0x28')](_0xc018be,json2xls(_0x68cd66),'binary');}})[_0xbdeb('0x14')](function(){if(_0x3dcac8){return new Promise(function(_0x2de52f){zipdir(path[_0xbdeb('0x22')](_0x220f13,_0x4edeb8),{'saveTo':path[_0xbdeb('0x22')](_0x220f13,util[_0xbdeb('0xe')](_0xbdeb('0x29'),_0x4edeb8,_0xbdeb('0x2a')))},function(_0xce8349,_0xa28c29){rimraf(path[_0xbdeb('0x22')](_0x220f13,_0x4edeb8),function(){});_0x2de52f(_0xbdeb('0x2b'));});});}})['then'](function(){logger[_0xbdeb('0xd')](util[_0xbdeb('0xe')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xbdeb('0x10')));return analyticExtractedReport(_0xbdeb('0x2c'),_0x3dcac8?util['format'](_0xbdeb('0x29'),_0x4edeb8,_0x3dcac8?_0xbdeb('0x2a'):_0xbdeb('0x27')):null);});})['catch'](function(_0xe9f590){logger[_0xbdeb('0xd')](util[_0xbdeb('0xe')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xbdeb('0x10')),util[_0xbdeb('0x2d')](_0xe9f590,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xbdeb('0x2e'));})[_0xbdeb('0x2f')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file +var _0x7317=['zip\x20finished','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','exit','util','path','lodash','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','find','split','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','range','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.xlsx','existsSync','join','mkdirSync','each','length','%s%d.%s','xlsx','%s.%s','writeFileSync','binary','zip'];(function(_0x33b9bd,_0x1cac78){var _0x3b13fc=function(_0x270d40){while(--_0x270d40){_0x33b9bd['push'](_0x33b9bd['shift']());}};_0x3b13fc(++_0x1cac78);}(_0x7317,0xac));var _0x7731=function(_0x3bce06,_0x56f4d2){_0x3bce06=_0x3bce06-0x0;var _0x20c2fe=_0x7317[_0x3bce06];return _0x20c2fe;};'use strict';var util=require(_0x7731('0x0'));var path=require(_0x7731('0x1'));var _=require(_0x7731('0x2'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require(_0x7731('0x3'));var zipdir=require(_0x7731('0x4'));var rimraf=require(_0x7731('0x5'));var db=require(_0x7731('0x6'))['db'];var dbH=require('../../mysqldb')[_0x7731('0x7')];var logger=require(_0x7731('0x8'))(_0x7731('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0x7731('0xa')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x7731('0xa')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x41c8af,_0x16095c){var _0x336fef={'status':_0x41c8af};var _0x2c0a7e={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x16095c){_0x336fef[_0x7731('0xb')]=_0x16095c;}return db[_0x7731('0xc')][_0x7731('0xd')](_0x336fef,_0x2c0a7e);}function main(){var _0x1c4490=0x1388;var _0x4013cc;logger[_0x7731('0xe')](util[_0x7731('0xf')](_0x7731('0x10'),EXTRACTED_REPORT_ID,_0x7731('0x11')));return db['Setting'][_0x7731('0x12')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x7731('0x13'),_0x7731('0x14')]})['then'](function(_0x2223b0){if(_0x2223b0){_0x4013cc=_0x2223b0;_0x1c4490=_0x4013cc['splitSizeXlsx']||0x1388;}})[_0x7731('0x15')](function(){return dbH[_0x7731('0x16')][_0x7731('0x17')](util['format'](_0x7731('0x18'),QUERY),{'type':dbH[_0x7731('0x16')][_0x7731('0x19')][_0x7731('0x1a')]});})[_0x7731('0x15')](function(_0x318512){if(!_0x318512[0x0][_0x7731('0x1b')]){return analyticExtractedReport(_0x7731('0x1c'));}var _0x16a738=[];var _0x2faa85=0x0;if(_0x4013cc[_0x7731('0x13')]){if(_0x318512&&_0x318512['length']){var _0x35db42=_[_0x7731('0x1d')](_0x318512[0x0][_0x7731('0x1b')]/_0x1c4490);var _0x17e2b5=Number[_0x7731('0x1e')](_0x318512[0x0][_0x7731('0x1b')]/_0x1c4490)?_0x318512[0x0][_0x7731('0x1b')]%_0x1c4490:0x0;_0x35db42[_0x7731('0x1f')](function(_0x1d9686){if(_0x1d9686>0x0){_0x2faa85+=_0x1c4490;}_0x16a738[_0x7731('0x20')](dbH[_0x7731('0x16')]['query'](util[_0x7731('0xf')](_0x7731('0x21'),QUERY,_0x1c4490,_0x2faa85),{'type':dbH[_0x7731('0x16')][_0x7731('0x19')][_0x7731('0x1a')]}));});if(_0x17e2b5>0x0){_0x2faa85+=_0x1c4490;_0x16a738[_0x7731('0x20')](dbH[_0x7731('0x16')][_0x7731('0x17')](util[_0x7731('0xf')](_0x7731('0x21'),QUERY,_0x17e2b5,_0x2faa85),{'type':dbH[_0x7731('0x16')][_0x7731('0x19')][_0x7731('0x1a')]}));}}}else{_0x16a738[_0x7731('0x20')](dbH[_0x7731('0x16')][_0x7731('0x17')](QUERY,{'type':dbH['sequelize'][_0x7731('0x19')][_0x7731('0x1a')]}));}var _0x103f52=path[_0x7731('0x22')](PATH);var _0x14fdee=path[_0x7731('0x23')](PATH,_0x7731('0x24'));var _0x28666e=_0x4013cc[_0x7731('0x13')]&&_0x16a738['length']>0x1;var _0x107266=[];if(!fs[_0x7731('0x25')](path[_0x7731('0x26')](_0x103f52,_0x14fdee))&&_0x28666e){fs[_0x7731('0x27')](path[_0x7731('0x26')](_0x103f52,_0x14fdee));}return BPromise[_0x7731('0x28')](_0x16a738,function(_0xa549f8){_0x107266[_0x7731('0x20')](_0xa549f8);})[_0x7731('0x15')](function(){for(var _0x466af8=0x0;_0x466af8<_0x107266[_0x7731('0x29')];_0x466af8+=0x1){var _0x5bb561;var _0x162f00=_0x107266[_0x466af8];if(_0x28666e){_0x5bb561=path[_0x7731('0x26')](_0x103f52,_0x14fdee,util['format'](_0x7731('0x2a'),_0x14fdee,_0x466af8,_0x7731('0x2b')));}else{_0x5bb561=path[_0x7731('0x26')](_0x103f52,util[_0x7731('0xf')](_0x7731('0x2c'),_0x14fdee,_0x7731('0x2b')));}fs[_0x7731('0x2d')](_0x5bb561,json2xls(_0x162f00),_0x7731('0x2e'));}})[_0x7731('0x15')](function(){if(_0x28666e){return new Promise(function(_0x3ddc4f){zipdir(path['join'](_0x103f52,_0x14fdee),{'saveTo':path[_0x7731('0x26')](_0x103f52,util[_0x7731('0xf')](_0x7731('0x2c'),_0x14fdee,_0x7731('0x2f')))},function(_0x3984f1,_0x4ec8c6){rimraf(path[_0x7731('0x26')](_0x103f52,_0x14fdee),function(){});_0x3ddc4f(_0x7731('0x30'));});});}})[_0x7731('0x15')](function(){logger[_0x7731('0xe')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x7731('0x11')));return analyticExtractedReport(_0x7731('0x31'),_0x28666e?util['format'](_0x7731('0x2c'),_0x14fdee,_0x28666e?'zip':_0x7731('0x2b')):null);});})[_0x7731('0x32')](function(_0x34a049){logger[_0x7731('0xe')](util[_0x7731('0xf')](_0x7731('0x33'),EXTRACTED_REPORT_ID,_0x7731('0x11')),util['inspect'](_0x34a049,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x7731('0x34'));})[_0x7731('0x35')](function(){process[_0x7731('0x36')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 3046817..6a3f935 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 _0x7149=['$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1',',${EXTEN},','last','concat','Hangup','destroy','bulkCreate','sortBy','catch','rewrite','lodash','util','models','Interval','findAll','then','intervals','VoiceExtension','IntervalId','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','queue','playback','hasOwnProperty','extension','find','push','type','format','CDR(type)=%s','context','inbound','Set','CDR(routeid)=','priority','VoiceExtensionId','outbound','extensions','CDR(destination)=','cutdigits','${EXTEN}','ExecIf'];(function(_0x1e98a8,_0xdc9fa){var _0x5551c9=function(_0x22a675){while(--_0x22a675){_0x1e98a8['push'](_0x1e98a8['shift']());}};_0x5551c9(++_0xdc9fa);}(_0x7149,0x193));var _0x9714=function(_0x2daf29,_0x4ae526){_0x2daf29=_0x2daf29-0x0;var _0x6ea37d=_0x7149[_0x2daf29];return _0x6ea37d;};'use strict';var _=require(_0x9714('0x0'));var util=require(_0x9714('0x1'));function rewrite(_0x574b20,_0x424693){var _0x1de700=this;return _0x574b20[_0x9714('0x2')][_0x9714('0x3')][_0x9714('0x4')]({'raw':!![]})[_0x9714('0x5')](function(_0x19ce2b){_0x1de700[_0x9714('0x6')]=_0x19ce2b;return _0x574b20['models'][_0x9714('0x7')]['findAll']({'where':{'IntervalId':_0x424693[_0x9714('0x8')]},'raw':!![]});})[_0x9714('0x5')](function(_0x557419){return _0x574b20[_0x9714('0x2')][_0x9714('0x7')][_0x9714('0x4')]({'where':{'exten':{'$in':_[_0x9714('0x9')](_[_0x9714('0xa')](_0x557419,_0x9714('0xb')))}},'order':[{'raw':_0x9714('0xc')}],'raw':!![]});})[_0x9714('0x5')](function(_0x50960e){var _0x52aad5=_[_0x9714('0xd')](_0x50960e,{'priority':'1'});var _0x35392a=_[_0x9714('0xd')](_0x50960e,{'isApp':0x1});var _0x109350=_['groupBy'](_0x35392a,_0x9714('0xb'));var _0x20dc7a=[_0x9714('0xe'),_0x9714('0xf')];var _0x414da1=[];var _0x574804=[];for(var _0x3867b9 in _0x109350){if(_0x109350[_0x9714('0x10')](_0x3867b9)){_0x1de700['priority']=0x2;_0x1de700['extensions']=[];_0x1de700[_0x9714('0x11')]=_[_0x9714('0x12')](_0x52aad5,{'exten':_0x109350[_0x3867b9][0x0][_0x9714('0xb')]});_0x1de700['extensions'][_0x9714('0x13')]({'type':_0x109350[_0x3867b9][0x0][_0x9714('0x14')],'app':'Set','appdata':util[_0x9714('0x15')](_0x9714('0x16'),_0x109350[_0x3867b9][0x0][_0x9714('0x14')]),'context':_0x109350[_0x3867b9][0x0][_0x9714('0x17')],'exten':_0x109350[_0x3867b9][0x0][_0x9714('0xb')],'priority':_0x1de700['priority']++,'VoiceExtensionId':_0x109350[_0x3867b9][0x0]['VoiceExtensionId']});if(_0x109350[_0x3867b9][0x0]['type']===_0x9714('0x18')){_0x1de700['extensions'][_0x9714('0x13')]({'type':_0x109350[_0x3867b9][0x0][_0x9714('0x14')],'app':_0x9714('0x19'),'appdata':_0x9714('0x1a')+_0x109350[_0x3867b9][0x0]['VoiceExtensionId'],'context':_0x109350[_0x3867b9][0x0][_0x9714('0x17')],'exten':_0x109350[_0x3867b9][0x0][_0x9714('0xb')],'priority':_0x1de700[_0x9714('0x1b')]++,'VoiceExtensionId':_0x109350[_0x3867b9][0x0][_0x9714('0x1c')]});}else if(_0x109350[_0x3867b9][0x0][_0x9714('0x14')]===_0x9714('0x1d')){if(_0x1de700[_0x9714('0x11')]){_0x1de700[_0x9714('0x1e')][_0x9714('0x13')]({'type':_0x109350[_0x3867b9][0x0][_0x9714('0x14')],'app':_0x9714('0x19'),'appdata':_0x9714('0x1f')+(_0x1de700[_0x9714('0x11')][_0x9714('0x20')]?'${EXTEN:'+_0x1de700[_0x9714('0x11')][_0x9714('0x20')]+'}':_0x9714('0x21')),'context':_0x109350[_0x3867b9][0x0]['context'],'exten':_0x109350[_0x3867b9][0x0][_0x9714('0xb')],'priority':_0x1de700[_0x9714('0x1b')]++,'VoiceExtensionId':_0x109350[_0x3867b9][0x0][_0x9714('0x1c')]});}_0x1de700[_0x9714('0x1e')]['push']({'type':_0x109350[_0x3867b9][0x0][_0x9714('0x14')],'app':'Set','appdata':_0x9714('0x1a')+_0x109350[_0x3867b9][0x0]['VoiceExtensionId'],'context':_0x109350[_0x3867b9][0x0][_0x9714('0x17')],'exten':_0x109350[_0x3867b9][0x0][_0x9714('0xb')],'priority':_0x1de700[_0x9714('0x1b')]++,'VoiceExtensionId':_0x109350[_0x3867b9][0x0][_0x9714('0x1c')]});var _0x266649=_0x1de700['priority']++;_0x1de700[_0x9714('0x1e')][_0x9714('0x13')]({'type':_0x109350[_0x3867b9][0x0][_0x9714('0x14')],'app':_0x9714('0x22'),'appdata':_0x9714('0x23')+(_0x266649+0x2)+_0x9714('0x24')+(_0x266649+0x1)+')','context':_0x109350[_0x3867b9][0x0][_0x9714('0x17')],'exten':_0x109350[_0x3867b9][0x0][_0x9714('0xb')],'priority':_0x266649,'VoiceExtensionId':_0x109350[_0x3867b9][0x0][_0x9714('0x1c')]});if(_0x1de700[_0x9714('0x11')]){_0x1de700[_0x9714('0x1e')][_0x9714('0x13')]({'type':_0x109350[_0x3867b9][0x0][_0x9714('0x14')],'app':_0x9714('0x19'),'appdata':_0x1de700['extension'][_0x9714('0x20')]?'CDR(prefix)=${EXTEN:0:'+_0x1de700[_0x9714('0x11')][_0x9714('0x20')]+'}':_0x9714('0x25'),'context':_0x109350[_0x3867b9][0x0][_0x9714('0x17')],'exten':_0x109350[_0x3867b9][0x0]['exten'],'priority':_0x1de700[_0x9714('0x1b')]++,'VoiceExtensionId':_0x109350[_0x3867b9][0x0][_0x9714('0x1c')]});}_0x1de700[_0x9714('0x1e')][_0x9714('0x13')]({'type':_0x109350[_0x3867b9][0x0][_0x9714('0x14')],'app':_0x9714('0x19'),'appdata':_0x9714('0x26')+_0x109350[_0x3867b9][0x0][_0x9714('0x1c')],'context':_0x109350[_0x3867b9][0x0][_0x9714('0x17')],'exten':_0x109350[_0x3867b9][0x0][_0x9714('0xb')],'priority':_0x1de700['priority']++,'VoiceExtensionId':_0x109350[_0x3867b9][0x0][_0x9714('0x1c')]});if(_0x1de700['extension']&&_0x1de700[_0x9714('0x11')]['hasOwnProperty'](_0x9714('0x27'))&&_0x1de700[_0x9714('0x11')][_0x9714('0x27')]!==_0x9714('0x28')){_0x1de700[_0x9714('0x1e')][_0x9714('0x13')]({'type':_0x109350[_0x3867b9][0x0][_0x9714('0x14')],'app':_0x9714('0x19'),'appdata':_0x9714('0x29'),'context':_0x109350[_0x3867b9][0x0]['context'],'exten':_0x109350[_0x3867b9][0x0][_0x9714('0xb')],'priority':_0x1de700[_0x9714('0x1b')]++,'VoiceExtensionId':_0x109350[_0x3867b9][0x0]['VoiceExtensionId']});_0x1de700[_0x9714('0x1e')][_0x9714('0x13')]({'type':_0x109350[_0x3867b9][0x0][_0x9714('0x14')],'app':_0x9714('0x19'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x1de700[_0x9714('0x11')][_0x9714('0x27')]||_0x9714('0x2a'),'context':_0x109350[_0x3867b9][0x0][_0x9714('0x17')],'exten':_0x109350[_0x3867b9][0x0][_0x9714('0xb')],'priority':_0x1de700[_0x9714('0x1b')]++,'VoiceExtensionId':_0x109350[_0x3867b9][0x0]['VoiceExtensionId']});}}_0x1de700[_0x9714('0x1e')][_0x9714('0x13')]({'type':_0x109350[_0x3867b9][0x0][_0x9714('0x14')],'app':'Set','appdata':_0x9714('0x2b'),'context':_0x109350[_0x3867b9][0x0][_0x9714('0x17')],'exten':_0x109350[_0x3867b9][0x0][_0x9714('0xb')],'priority':_0x1de700['priority']++,'VoiceExtensionId':_0x109350[_0x3867b9][0x0][_0x9714('0x1c')]});_0x1de700[_0x9714('0x1e')][_0x9714('0x13')]({'type':_0x109350[_0x3867b9][0x0][_0x9714('0x14')],'app':'Set','appdata':_0x9714('0x2c'),'context':_0x109350[_0x3867b9][0x0][_0x9714('0x17')],'exten':_0x109350[_0x3867b9][0x0][_0x9714('0xb')],'priority':_0x1de700[_0x9714('0x1b')]++,'VoiceExtensionId':_0x109350[_0x3867b9][0x0][_0x9714('0x1c')]});_0x1de700['extensions'][_0x9714('0x13')]({'type':_0x109350[_0x3867b9][0x0][_0x9714('0x14')],'app':'Set','appdata':_0x9714('0x2d'),'context':_0x109350[_0x3867b9][0x0][_0x9714('0x17')],'exten':_0x109350[_0x3867b9][0x0][_0x9714('0xb')],'priority':_0x1de700[_0x9714('0x1b')]++,'VoiceExtensionId':_0x109350[_0x3867b9][0x0][_0x9714('0x1c')]});for(var _0x196a4d=0x0,_0x2ee928=0x0;_0x196a4d<_0x109350[_0x3867b9][_0x9714('0x2e')];_0x196a4d+=0x1,_0x2ee928=0x0){var _0x1ece6f=_0x109350[_0x3867b9][_0x196a4d];if(_0x1ece6f['type']){_0x1ece6f['type']=_0x1ece6f[_0x9714('0x14')][_0x9714('0x2f')]();}var _0x275672=[];var _0x48ff54=[];delete _0x1ece6f['id'];delete _0x1ece6f[_0x9714('0x30')];delete _0x1ece6f[_0x9714('0x31')];var _0xb09b2c=_0x1ece6f[_0x9714('0x32')]!==_0x9714('0x33')?[_0x1ece6f['interval']]:_0x1ece6f[_0x9714('0x8')]?_[_0x9714('0xa')](_[_0x9714('0xd')](_0x1de700[_0x9714('0x6')],{'IntervalId':_0x1ece6f[_0x9714('0x8')]}),_0x9714('0x32')):[];if(_0x1ece6f[_0x9714('0x10')](_0x9714('0x34'))){if(_0x1ece6f[_0x9714('0x34')]&&_0x1ece6f[_0x9714('0x34')]!=='--'){_0x275672[_0x9714('0x13')]({'type':_0x1ece6f[_0x9714('0x14')],'app':_0x9714('0x19'),'appdata':_0x9714('0x35')+_0x1ece6f[_0x9714('0x34')],'context':_0x1ece6f[_0x9714('0x17')],'exten':_0x1ece6f[_0x9714('0xb')],'priority':_0xb09b2c[_0x9714('0x2e')]+_0x1de700[_0x9714('0x1b')]+_0x2ee928++,'VoiceExtensionId':_0x1ece6f[_0x9714('0x1c')]});}}if(_0x1ece6f['type']===_0x9714('0x1d')&&_0x1ece6f[_0x9714('0x10')](_0x9714('0x36'))){if(_0x1ece6f[_0x9714('0x36')]){_0x275672['push']({'type':_0x1ece6f[_0x9714('0x14')],'app':_0x9714('0x22'),'appdata':_0x9714('0x37')+_0x1ece6f[_0x9714('0x36')]+')','context':_0x1ece6f[_0x9714('0x17')],'exten':_0x1ece6f[_0x9714('0xb')],'priority':_0xb09b2c[_0x9714('0x2e')]+_0x1de700['priority']+_0x2ee928++,'VoiceExtensionId':_0x1ece6f[_0x9714('0x1c')]});}else{_0x275672[_0x9714('0x13')]({'type':_0x1ece6f['type'],'app':'ExecIf','appdata':_0x9714('0x38'),'context':_0x1ece6f[_0x9714('0x17')],'exten':_0x1ece6f[_0x9714('0xb')],'priority':_0xb09b2c[_0x9714('0x2e')]+_0x1de700[_0x9714('0x1b')]+_0x2ee928++,'VoiceExtensionId':_0x1ece6f[_0x9714('0x1c')]});}}if(_0x1ece6f[_0x9714('0x10')](_0x9714('0x39'))){if(_0x20dc7a['indexOf'](_0x1ece6f[_0x9714('0x3a')][_0x9714('0x2f')]())>=0x0&&_0x1ece6f[_0x9714('0x3b')]!==_0x9714('0x3c')){if(_0x1ece6f[_0x9714('0x39')]){_0x275672[_0x9714('0x13')]({'type':_0x1ece6f[_0x9714('0x14')],'app':_0x9714('0x22'),'appdata':_0x9714('0x3d'),'context':_0x1ece6f[_0x9714('0x17')],'exten':_0x1ece6f[_0x9714('0xb')],'priority':_0xb09b2c[_0x9714('0x2e')]+_0x1de700[_0x9714('0x1b')]+_0x2ee928++,'VoiceExtensionId':_0x1ece6f[_0x9714('0x1c')]});_0x275672[_0x9714('0x13')]({'type':_0x1ece6f['type'],'app':'Set','appdata':'XCALLY-MOTION-ANSWER=1','context':_0x1ece6f[_0x9714('0x17')],'exten':_0x1ece6f[_0x9714('0xb')],'priority':_0xb09b2c[_0x9714('0x2e')]+_0x1de700[_0x9714('0x1b')]+_0x2ee928++,'VoiceExtensionId':_0x1ece6f[_0x9714('0x1c')]});}else{_0x275672[_0x9714('0x13')]({'type':_0x1ece6f['type'],'app':_0x9714('0x22'),'appdata':_0x9714('0x3e'),'context':_0x1ece6f[_0x9714('0x17')],'exten':_0x1ece6f[_0x9714('0xb')],'priority':_0xb09b2c[_0x9714('0x2e')]+_0x1de700[_0x9714('0x1b')]+_0x2ee928++,'VoiceExtensionId':_0x1ece6f[_0x9714('0x1c')]});_0x275672['push']({'type':_0x1ece6f[_0x9714('0x14')],'app':'Set','appdata':_0x9714('0x3f'),'context':_0x1ece6f['context'],'exten':_0x1ece6f[_0x9714('0xb')],'priority':_0xb09b2c[_0x9714('0x2e')]+_0x1de700[_0x9714('0x1b')]+_0x2ee928++,'VoiceExtensionId':_0x1ece6f[_0x9714('0x1c')]});}}}for(var _0x4916b9=0x0;_0x4916b9<_0xb09b2c['length'];_0x4916b9+=0x1){var _0x1b818e=_0x1de700[_0x9714('0x1b')]+_0xb09b2c[_0x9714('0x2e')];var _0x3378e0=_0x4916b9===_0xb09b2c[_0x9714('0x2e')]-0x1?_0x1de700['priority']+_0x275672[_0x9714('0x2e')]+_0x48ff54[_0x9714('0x2e')]+0x2:_0x1de700[_0x9714('0x1b')]+_0x4916b9+0x1;_0x275672['splice'](_0x4916b9,0x0,{'type':_0x1ece6f[_0x9714('0x14')],'app':'GotoIfTime','appdata':_0xb09b2c[_0x4916b9]+'?'+_0x1ece6f['context']+_0x9714('0x40')+_0x1b818e+':'+_0x1ece6f[_0x9714('0x17')]+_0x9714('0x40')+_0x3378e0,'exten':_0x1ece6f['exten'],'context':_0x1ece6f[_0x9714('0x17')],'priority':_0x1de700['priority']+_0x4916b9,'VoiceExtensionId':_0x109350[_0x3867b9][0x0][_0x9714('0x1c')]});}_0x1ece6f['priority']=_0x275672[_0x9714('0x2e')]?_[_0x9714('0x41')](_0x275672)[_0x9714('0x1b')]+0x1:_0x1de700[_0x9714('0x1b')];_0x1de700[_0x9714('0x1b')]=(_0x48ff54[_0x9714('0x2e')]?_[_0x9714('0x41')](_0x48ff54)['priority']:_0x1ece6f[_0x9714('0x1b')])+0x1;_0x1de700[_0x9714('0x1e')]=_[_0x9714('0x42')](_0x1de700[_0x9714('0x1e')],_0x275672,[_0x1ece6f],_0x48ff54);}_0x1de700[_0x9714('0x1e')][_0x9714('0x13')]({'type':_0x109350[_0x3867b9][0x0]['type'],'app':_0x9714('0x43'),'exten':_0x109350[_0x3867b9][0x0][_0x9714('0xb')],'context':_0x109350[_0x3867b9][0x0]['context'],'priority':_0x1de700[_0x9714('0x1b')],'VoiceExtensionId':_0x109350[_0x3867b9][0x0][_0x9714('0x1c')]});_0x414da1[_0x9714('0x13')](_0x109350[_0x3867b9][0x0][_0x9714('0x1c')]);_0x574804=_[_0x9714('0x42')](_0x574804,_0x1de700[_0x9714('0x1e')]);}}return _0x574b20['transaction'](function(_0x1fbf6c){return _0x574b20[_0x9714('0x2')][_0x9714('0x7')][_0x9714('0x44')]({'where':{'VoiceExtensionId':{'$in':_0x414da1}},'transaction':_0x1fbf6c})[_0x9714('0x5')](function(_0x3de5d1){return _0x574b20[_0x9714('0x2')]['VoiceExtension'][_0x9714('0x45')](_[_0x9714('0x46')](_0x574804,_0x9714('0x1b')),{'transaction':_0x1fbf6c});});});})[_0x9714('0x47')](function(_0x5e5731){console['error'](_0x5e5731);});}exports[_0x9714('0x48')]=rewrite; \ No newline at end of file +var _0xee47=['splice',',${EXTEN},','last','Hangup','concat','transaction','sortBy','catch','error','rewrite','lodash','models','Interval','findAll','then','intervals','VoiceExtension','IntervalId','uniq','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','queue','hasOwnProperty','extensions','extension','push','Set','format','CDR(type)=%s','type','context','priority','VoiceExtensionId','inbound','outbound','CDR(destination)=','cutdigits','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','interval','map','tag','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','answer','indexOf','app','appType','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1'];(function(_0x3a7a9c,_0x24f7d6){var _0x59156e=function(_0x5bc930){while(--_0x5bc930){_0x3a7a9c['push'](_0x3a7a9c['shift']());}};_0x59156e(++_0x24f7d6);}(_0xee47,0x19c));var _0x7ee4=function(_0x51d907,_0x40c9f6){_0x51d907=_0x51d907-0x0;var _0x4595d8=_0xee47[_0x51d907];return _0x4595d8;};'use strict';var _=require(_0x7ee4('0x0'));var util=require('util');function rewrite(_0x3d1168,_0x18ca1d){var _0x371b36=this;return _0x3d1168[_0x7ee4('0x1')][_0x7ee4('0x2')][_0x7ee4('0x3')]({'raw':!![]})[_0x7ee4('0x4')](function(_0x564aad){_0x371b36[_0x7ee4('0x5')]=_0x564aad;return _0x3d1168[_0x7ee4('0x1')][_0x7ee4('0x6')]['findAll']({'where':{'IntervalId':_0x18ca1d[_0x7ee4('0x7')]},'raw':!![]});})[_0x7ee4('0x4')](function(_0x2f425b){return _0x3d1168['models'][_0x7ee4('0x6')][_0x7ee4('0x3')]({'where':{'exten':{'$in':_[_0x7ee4('0x8')](_['map'](_0x2f425b,_0x7ee4('0x9')))}},'order':[{'raw':_0x7ee4('0xa')}],'raw':!![]});})['then'](function(_0x21ab36){var _0x1c1bc3=_['filter'](_0x21ab36,{'priority':'1'});var _0x532d91=_[_0x7ee4('0xb')](_0x21ab36,{'isApp':0x1});var _0x328c5d=_['groupBy'](_0x532d91,_0x7ee4('0x9'));var _0x1bb2db=[_0x7ee4('0xc'),'playback'];var _0x25e1d1=[];var _0x49cd82=[];for(var _0x191c6e in _0x328c5d){if(_0x328c5d[_0x7ee4('0xd')](_0x191c6e)){_0x371b36['priority']=0x2;_0x371b36[_0x7ee4('0xe')]=[];_0x371b36[_0x7ee4('0xf')]=_['find'](_0x1c1bc3,{'exten':_0x328c5d[_0x191c6e][0x0][_0x7ee4('0x9')]});_0x371b36['extensions'][_0x7ee4('0x10')]({'type':_0x328c5d[_0x191c6e][0x0]['type'],'app':_0x7ee4('0x11'),'appdata':util[_0x7ee4('0x12')](_0x7ee4('0x13'),_0x328c5d[_0x191c6e][0x0][_0x7ee4('0x14')]),'context':_0x328c5d[_0x191c6e][0x0][_0x7ee4('0x15')],'exten':_0x328c5d[_0x191c6e][0x0][_0x7ee4('0x9')],'priority':_0x371b36[_0x7ee4('0x16')]++,'VoiceExtensionId':_0x328c5d[_0x191c6e][0x0][_0x7ee4('0x17')]});if(_0x328c5d[_0x191c6e][0x0][_0x7ee4('0x14')]===_0x7ee4('0x18')){_0x371b36[_0x7ee4('0xe')][_0x7ee4('0x10')]({'type':_0x328c5d[_0x191c6e][0x0][_0x7ee4('0x14')],'app':_0x7ee4('0x11'),'appdata':'CDR(routeid)='+_0x328c5d[_0x191c6e][0x0][_0x7ee4('0x17')],'context':_0x328c5d[_0x191c6e][0x0][_0x7ee4('0x15')],'exten':_0x328c5d[_0x191c6e][0x0][_0x7ee4('0x9')],'priority':_0x371b36[_0x7ee4('0x16')]++,'VoiceExtensionId':_0x328c5d[_0x191c6e][0x0]['VoiceExtensionId']});}else if(_0x328c5d[_0x191c6e][0x0][_0x7ee4('0x14')]===_0x7ee4('0x19')){if(_0x371b36[_0x7ee4('0xf')]){_0x371b36[_0x7ee4('0xe')]['push']({'type':_0x328c5d[_0x191c6e][0x0][_0x7ee4('0x14')],'app':_0x7ee4('0x11'),'appdata':_0x7ee4('0x1a')+(_0x371b36['extension'][_0x7ee4('0x1b')]?'${EXTEN:'+_0x371b36['extension']['cutdigits']+'}':'${EXTEN}'),'context':_0x328c5d[_0x191c6e][0x0]['context'],'exten':_0x328c5d[_0x191c6e][0x0][_0x7ee4('0x9')],'priority':_0x371b36[_0x7ee4('0x16')]++,'VoiceExtensionId':_0x328c5d[_0x191c6e][0x0][_0x7ee4('0x17')]});}_0x371b36[_0x7ee4('0xe')][_0x7ee4('0x10')]({'type':_0x328c5d[_0x191c6e][0x0][_0x7ee4('0x14')],'app':_0x7ee4('0x11'),'appdata':_0x7ee4('0x1c')+_0x328c5d[_0x191c6e][0x0][_0x7ee4('0x17')],'context':_0x328c5d[_0x191c6e][0x0][_0x7ee4('0x15')],'exten':_0x328c5d[_0x191c6e][0x0][_0x7ee4('0x9')],'priority':_0x371b36['priority']++,'VoiceExtensionId':_0x328c5d[_0x191c6e][0x0][_0x7ee4('0x17')]});var _0x54e0ae=_0x371b36[_0x7ee4('0x16')]++;_0x371b36['extensions']['push']({'type':_0x328c5d[_0x191c6e][0x0][_0x7ee4('0x14')],'app':_0x7ee4('0x1d'),'appdata':_0x7ee4('0x1e')+(_0x54e0ae+0x2)+_0x7ee4('0x1f')+(_0x54e0ae+0x1)+')','context':_0x328c5d[_0x191c6e][0x0][_0x7ee4('0x15')],'exten':_0x328c5d[_0x191c6e][0x0][_0x7ee4('0x9')],'priority':_0x54e0ae,'VoiceExtensionId':_0x328c5d[_0x191c6e][0x0][_0x7ee4('0x17')]});if(_0x371b36[_0x7ee4('0xf')]){_0x371b36[_0x7ee4('0xe')][_0x7ee4('0x10')]({'type':_0x328c5d[_0x191c6e][0x0][_0x7ee4('0x14')],'app':_0x7ee4('0x11'),'appdata':_0x371b36[_0x7ee4('0xf')][_0x7ee4('0x1b')]?_0x7ee4('0x20')+_0x371b36[_0x7ee4('0xf')][_0x7ee4('0x1b')]+'}':_0x7ee4('0x21'),'context':_0x328c5d[_0x191c6e][0x0][_0x7ee4('0x15')],'exten':_0x328c5d[_0x191c6e][0x0]['exten'],'priority':_0x371b36[_0x7ee4('0x16')]++,'VoiceExtensionId':_0x328c5d[_0x191c6e][0x0]['VoiceExtensionId']});}_0x371b36['extensions'][_0x7ee4('0x10')]({'type':_0x328c5d[_0x191c6e][0x0][_0x7ee4('0x14')],'app':'Set','appdata':'outboundrouteid='+_0x328c5d[_0x191c6e][0x0][_0x7ee4('0x17')],'context':_0x328c5d[_0x191c6e][0x0][_0x7ee4('0x15')],'exten':_0x328c5d[_0x191c6e][0x0][_0x7ee4('0x9')],'priority':_0x371b36[_0x7ee4('0x16')]++,'VoiceExtensionId':_0x328c5d[_0x191c6e][0x0][_0x7ee4('0x17')]});if(_0x371b36[_0x7ee4('0xf')]&&_0x371b36[_0x7ee4('0xf')][_0x7ee4('0xd')](_0x7ee4('0x22'))&&_0x371b36[_0x7ee4('0xf')][_0x7ee4('0x22')]!==_0x7ee4('0x23')){_0x371b36[_0x7ee4('0xe')][_0x7ee4('0x10')]({'type':_0x328c5d[_0x191c6e][0x0]['type'],'app':_0x7ee4('0x11'),'appdata':_0x7ee4('0x24'),'context':_0x328c5d[_0x191c6e][0x0]['context'],'exten':_0x328c5d[_0x191c6e][0x0][_0x7ee4('0x9')],'priority':_0x371b36['priority']++,'VoiceExtensionId':_0x328c5d[_0x191c6e][0x0][_0x7ee4('0x17')]});_0x371b36[_0x7ee4('0xe')][_0x7ee4('0x10')]({'type':_0x328c5d[_0x191c6e][0x0][_0x7ee4('0x14')],'app':'Set','appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x371b36['extension'][_0x7ee4('0x22')]||_0x7ee4('0x25'),'context':_0x328c5d[_0x191c6e][0x0][_0x7ee4('0x15')],'exten':_0x328c5d[_0x191c6e][0x0][_0x7ee4('0x9')],'priority':_0x371b36['priority']++,'VoiceExtensionId':_0x328c5d[_0x191c6e][0x0]['VoiceExtensionId']});}}_0x371b36['extensions'][_0x7ee4('0x10')]({'type':_0x328c5d[_0x191c6e][0x0][_0x7ee4('0x14')],'app':_0x7ee4('0x11'),'appdata':_0x7ee4('0x26'),'context':_0x328c5d[_0x191c6e][0x0][_0x7ee4('0x15')],'exten':_0x328c5d[_0x191c6e][0x0][_0x7ee4('0x9')],'priority':_0x371b36[_0x7ee4('0x16')]++,'VoiceExtensionId':_0x328c5d[_0x191c6e][0x0][_0x7ee4('0x17')]});_0x371b36['extensions'][_0x7ee4('0x10')]({'type':_0x328c5d[_0x191c6e][0x0][_0x7ee4('0x14')],'app':_0x7ee4('0x11'),'appdata':_0x7ee4('0x27'),'context':_0x328c5d[_0x191c6e][0x0]['context'],'exten':_0x328c5d[_0x191c6e][0x0]['exten'],'priority':_0x371b36['priority']++,'VoiceExtensionId':_0x328c5d[_0x191c6e][0x0]['VoiceExtensionId']});_0x371b36[_0x7ee4('0xe')]['push']({'type':_0x328c5d[_0x191c6e][0x0][_0x7ee4('0x14')],'app':_0x7ee4('0x11'),'appdata':_0x7ee4('0x28'),'context':_0x328c5d[_0x191c6e][0x0]['context'],'exten':_0x328c5d[_0x191c6e][0x0][_0x7ee4('0x9')],'priority':_0x371b36['priority']++,'VoiceExtensionId':_0x328c5d[_0x191c6e][0x0][_0x7ee4('0x17')]});for(var _0x506c52=0x0,_0x1fa766=0x0;_0x506c52<_0x328c5d[_0x191c6e][_0x7ee4('0x29')];_0x506c52+=0x1,_0x1fa766=0x0){var _0x28e6f4=_0x328c5d[_0x191c6e][_0x506c52];if(_0x28e6f4[_0x7ee4('0x14')]){_0x28e6f4[_0x7ee4('0x14')]=_0x28e6f4[_0x7ee4('0x14')][_0x7ee4('0x2a')]();}var _0x37f79e=[];var _0x55a1fe=[];delete _0x28e6f4['id'];delete _0x28e6f4[_0x7ee4('0x2b')];delete _0x28e6f4[_0x7ee4('0x2c')];var _0x4e73c3=_0x28e6f4[_0x7ee4('0x2d')]!=='*,*,*,*'?[_0x28e6f4[_0x7ee4('0x2d')]]:_0x28e6f4[_0x7ee4('0x7')]?_[_0x7ee4('0x2e')](_['filter'](_0x371b36[_0x7ee4('0x5')],{'IntervalId':_0x28e6f4[_0x7ee4('0x7')]}),'interval'):[];if(_0x28e6f4['hasOwnProperty'](_0x7ee4('0x2f'))){if(_0x28e6f4[_0x7ee4('0x2f')]&&_0x28e6f4[_0x7ee4('0x2f')]!=='--'){_0x37f79e[_0x7ee4('0x10')]({'type':_0x28e6f4[_0x7ee4('0x14')],'app':_0x7ee4('0x11'),'appdata':'CDR(tag)='+_0x28e6f4[_0x7ee4('0x2f')],'context':_0x28e6f4['context'],'exten':_0x28e6f4[_0x7ee4('0x9')],'priority':_0x4e73c3[_0x7ee4('0x29')]+_0x371b36[_0x7ee4('0x16')]+_0x1fa766++,'VoiceExtensionId':_0x28e6f4[_0x7ee4('0x17')]});}}if(_0x28e6f4[_0x7ee4('0x14')]===_0x7ee4('0x19')&&_0x28e6f4[_0x7ee4('0xd')]('callerID')){if(_0x28e6f4[_0x7ee4('0x30')]){_0x37f79e[_0x7ee4('0x10')]({'type':_0x28e6f4[_0x7ee4('0x14')],'app':_0x7ee4('0x1d'),'appdata':_0x7ee4('0x31')+_0x28e6f4[_0x7ee4('0x30')]+')','context':_0x28e6f4[_0x7ee4('0x15')],'exten':_0x28e6f4[_0x7ee4('0x9')],'priority':_0x4e73c3['length']+_0x371b36[_0x7ee4('0x16')]+_0x1fa766++,'VoiceExtensionId':_0x28e6f4[_0x7ee4('0x17')]});}else{_0x37f79e[_0x7ee4('0x10')]({'type':_0x28e6f4[_0x7ee4('0x14')],'app':'ExecIf','appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x28e6f4[_0x7ee4('0x15')],'exten':_0x28e6f4[_0x7ee4('0x9')],'priority':_0x4e73c3[_0x7ee4('0x29')]+_0x371b36[_0x7ee4('0x16')]+_0x1fa766++,'VoiceExtensionId':_0x28e6f4[_0x7ee4('0x17')]});}}if(_0x28e6f4[_0x7ee4('0xd')](_0x7ee4('0x32'))){if(_0x1bb2db[_0x7ee4('0x33')](_0x28e6f4[_0x7ee4('0x34')][_0x7ee4('0x2a')]())>=0x0&&_0x28e6f4[_0x7ee4('0x35')]!=='custom'){if(_0x28e6f4[_0x7ee4('0x32')]){_0x37f79e['push']({'type':_0x28e6f4[_0x7ee4('0x14')],'app':_0x7ee4('0x1d'),'appdata':_0x7ee4('0x36'),'context':_0x28e6f4[_0x7ee4('0x15')],'exten':_0x28e6f4['exten'],'priority':_0x4e73c3[_0x7ee4('0x29')]+_0x371b36[_0x7ee4('0x16')]+_0x1fa766++,'VoiceExtensionId':_0x28e6f4[_0x7ee4('0x17')]});_0x37f79e['push']({'type':_0x28e6f4['type'],'app':_0x7ee4('0x11'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x28e6f4['context'],'exten':_0x28e6f4['exten'],'priority':_0x4e73c3[_0x7ee4('0x29')]+_0x371b36[_0x7ee4('0x16')]+_0x1fa766++,'VoiceExtensionId':_0x28e6f4[_0x7ee4('0x17')]});}else{_0x37f79e[_0x7ee4('0x10')]({'type':_0x28e6f4[_0x7ee4('0x14')],'app':_0x7ee4('0x1d'),'appdata':_0x7ee4('0x37'),'context':_0x28e6f4[_0x7ee4('0x15')],'exten':_0x28e6f4[_0x7ee4('0x9')],'priority':_0x4e73c3[_0x7ee4('0x29')]+_0x371b36[_0x7ee4('0x16')]+_0x1fa766++,'VoiceExtensionId':_0x28e6f4[_0x7ee4('0x17')]});_0x37f79e['push']({'type':_0x28e6f4[_0x7ee4('0x14')],'app':_0x7ee4('0x11'),'appdata':_0x7ee4('0x38'),'context':_0x28e6f4[_0x7ee4('0x15')],'exten':_0x28e6f4['exten'],'priority':_0x4e73c3[_0x7ee4('0x29')]+_0x371b36[_0x7ee4('0x16')]+_0x1fa766++,'VoiceExtensionId':_0x28e6f4[_0x7ee4('0x17')]});}}}for(var _0xf79180=0x0;_0xf79180<_0x4e73c3[_0x7ee4('0x29')];_0xf79180+=0x1){var _0x2df3c3=_0x371b36[_0x7ee4('0x16')]+_0x4e73c3['length'];var _0x263a9c=_0xf79180===_0x4e73c3['length']-0x1?_0x371b36['priority']+_0x37f79e[_0x7ee4('0x29')]+_0x55a1fe[_0x7ee4('0x29')]+0x2:_0x371b36[_0x7ee4('0x16')]+_0xf79180+0x1;_0x37f79e[_0x7ee4('0x39')](_0xf79180,0x0,{'type':_0x28e6f4[_0x7ee4('0x14')],'app':'GotoIfTime','appdata':_0x4e73c3[_0xf79180]+'?'+_0x28e6f4[_0x7ee4('0x15')]+_0x7ee4('0x3a')+_0x2df3c3+':'+_0x28e6f4[_0x7ee4('0x15')]+_0x7ee4('0x3a')+_0x263a9c,'exten':_0x28e6f4['exten'],'context':_0x28e6f4[_0x7ee4('0x15')],'priority':_0x371b36[_0x7ee4('0x16')]+_0xf79180,'VoiceExtensionId':_0x328c5d[_0x191c6e][0x0][_0x7ee4('0x17')]});}_0x28e6f4['priority']=_0x37f79e[_0x7ee4('0x29')]?_[_0x7ee4('0x3b')](_0x37f79e)['priority']+0x1:_0x371b36['priority'];_0x371b36[_0x7ee4('0x16')]=(_0x55a1fe[_0x7ee4('0x29')]?_[_0x7ee4('0x3b')](_0x55a1fe)[_0x7ee4('0x16')]:_0x28e6f4[_0x7ee4('0x16')])+0x1;_0x371b36[_0x7ee4('0xe')]=_['concat'](_0x371b36[_0x7ee4('0xe')],_0x37f79e,[_0x28e6f4],_0x55a1fe);}_0x371b36[_0x7ee4('0xe')]['push']({'type':_0x328c5d[_0x191c6e][0x0][_0x7ee4('0x14')],'app':_0x7ee4('0x3c'),'exten':_0x328c5d[_0x191c6e][0x0]['exten'],'context':_0x328c5d[_0x191c6e][0x0][_0x7ee4('0x15')],'priority':_0x371b36[_0x7ee4('0x16')],'VoiceExtensionId':_0x328c5d[_0x191c6e][0x0][_0x7ee4('0x17')]});_0x25e1d1['push'](_0x328c5d[_0x191c6e][0x0][_0x7ee4('0x17')]);_0x49cd82=_[_0x7ee4('0x3d')](_0x49cd82,_0x371b36[_0x7ee4('0xe')]);}}return _0x3d1168[_0x7ee4('0x3e')](function(_0x108ebc){return _0x3d1168[_0x7ee4('0x1')][_0x7ee4('0x6')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0x25e1d1}},'transaction':_0x108ebc})[_0x7ee4('0x4')](function(_0xe39f3){return _0x3d1168[_0x7ee4('0x1')]['VoiceExtension']['bulkCreate'](_[_0x7ee4('0x3f')](_0x49cd82,_0x7ee4('0x16')),{'transaction':_0x108ebc});});});})[_0x7ee4('0x40')](function(_0x4e9eec){console[_0x7ee4('0x41')](_0x4e9eec);});}exports[_0x7ee4('0x42')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index ed15e3b..68f8337 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 _0xc48f=['VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','get','sequelize','VoiceQueueId','catch','query','all','BlackLists','Campaign','always','CampaignId','onlyIfOpen','cmContact,\x20%s,\x20%s','message','Error\x20processing\x20rows\x20block:','stringify','finally','emit','resolve','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','CmContact','createReadStream','parse','duplicate','pause','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','lodash','squel','papaparse','ioredis','../../../config/environment','../../../config/logger','defaults','localhost','socket.io-emitter','redis','../../../api/cmContact/cmContact.socket','argv','undefined','Missing\x20filepath\x20parameter!','null','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20socket_timestamp\x20parameter!','error','contact','test','isNil','errors','length','join','hasOwnProperty','data','firstName','phone','birthDate','isValid','email','email\x20format\x20is\x20not\x20valid!','ListId','find','Duplicate\x20Contact','keys','then','push','cmContact','checkHopper','inspect','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','select','field','toString','NOW()','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','from','\x20=\x20?','cm_contacts','id\x20IN\x20?','str','cm_hopper_black'];(function(_0x2d93dc,_0x1e9771){var _0x45cf53=function(_0x15e7fb){while(--_0x15e7fb){_0x2d93dc['push'](_0x2d93dc['shift']());}};_0x45cf53(++_0x1e9771);}(_0xc48f,0x159));var _0xfc48=function(_0x45d388,_0x2e53c8){_0x45d388=_0x45d388-0x0;var _0xec117c=_0xc48f[_0x45d388];return _0xec117c;};'use strict';var BPromise=require(_0xfc48('0x0'));var util=require('util');var _=require(_0xfc48('0x1'));var fs=require('fs');var squel=require(_0xfc48('0x2'));var Papa=require(_0xfc48('0x3'));var Redis=require(_0xfc48('0x4'));var db=require('../../../mysqldb')['db'];var config=require(_0xfc48('0x5'));var logger=require(_0xfc48('0x6'))('api');config['redis']=_[_0xfc48('0x7')](config['redis'],{'host':_0xfc48('0x8'),'port':0x18eb});var socket=require(_0xfc48('0x9'))(new Redis(config[_0xfc48('0xa')]));require(_0xfc48('0xb'))['register'](socket);try{if(!process[_0xfc48('0xc')][0x2]||process[_0xfc48('0xc')][0x2]===_0xfc48('0xd')||process[_0xfc48('0xc')][0x2]==='null'){throw new Error(_0xfc48('0xe'));}var FILEPATH=process[_0xfc48('0xc')][0x2];if(!process[_0xfc48('0xc')][0x3]||process[_0xfc48('0xc')][0x3]===_0xfc48('0xd')||process[_0xfc48('0xc')][0x3]===_0xfc48('0xf')||!process['argv'][0x4]||process[_0xfc48('0xc')][0x4]===_0xfc48('0xd')||process[_0xfc48('0xc')][0x4]===_0xfc48('0xf')){throw new Error(_0xfc48('0x10'));}var FIELDS=_[_0xfc48('0x11')](process[_0xfc48('0xc')][0x3]['split'](','),process[_0xfc48('0xc')][0x4][_0xfc48('0x12')](','));if(!process['argv'][0x5]||process[_0xfc48('0xc')][0x5]===_0xfc48('0xd')||process['argv'][0x5]==='null'){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process['argv'][0x5];var COMPANYID=process[_0xfc48('0xc')][0x6]&&process[_0xfc48('0xc')][0x6]!=='undefined'&&process[_0xfc48('0xc')][0x6]!==_0xfc48('0xf')?process[_0xfc48('0xc')][0x6]:null;var DUPLICATES=process[_0xfc48('0xc')][0x7]&&process[_0xfc48('0xc')][0x7]!==_0xfc48('0xd')&&process[_0xfc48('0xc')][0x7]!==_0xfc48('0xf')?process['argv'][0x7]:null;if(!process[_0xfc48('0xc')][0x8]||process[_0xfc48('0xc')][0x8]===_0xfc48('0xd')||process['argv'][0x8]==='null'){throw new Error(_0xfc48('0x13'));}var SOCKET_TIMESTAMP=process[_0xfc48('0xc')][0x8];}catch(_0x4b446d){logger[_0xfc48('0x14')](_0x4b446d);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(_0x57c816,_0x46851c,_0x173896,_0x527876){var _0x170ec1={'message':_0x46851c};_0x170ec1[_0x57c816]=!![];if(_0x173896){_0x170ec1[_0xfc48('0x15')]=_0x173896;}if(_0x527876){_0x170ec1['index']=_0x527876;}return _0x170ec1;}function isEmail(_0xe0a280){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))*$/[_0xfc48('0x16')](_0xe0a280);}function checkRow(_0x201754,_0x2953ba,_0x45f123){return new BPromise(function(_0x36376e,_0x298e40){if(_[_0xfc48('0x17')](_0x201754)){return _0x298e40(handleCheckRowError(_0xfc48('0x14'),'The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x45f123));}if(_0x201754[_0xfc48('0x18')]&&_0x201754[_0xfc48('0x18')][_0xfc48('0x19')]){var _0x5c578b=_['map'](_0x201754[_0xfc48('0x18')],'message')[_0xfc48('0x1a')](';');return _0x298e40(handleCheckRowError(_0xfc48('0x14'),_0x5c578b,null,_0x45f123));}var _0x26c4f7={};for(var _0x353756 in FIELDS){if(FIELDS[_0xfc48('0x1b')](_0x353756)&&FIELDS[_0x353756]){_0x26c4f7[_0x353756]=_0x201754[_0xfc48('0x1c')][0x0][FIELDS[_0x353756]]||_0x201754[_0xfc48('0x1c')][0x0]['\ufeff'+FIELDS[_0x353756]];}}if(!_0x26c4f7[_0xfc48('0x1d')]){return _0x298e40(handleCheckRowError(_0xfc48('0x14'),'firstName\x20not\x20specified!',null,_0x45f123));}if(!_0x26c4f7[_0xfc48('0x1e')]){return _0x298e40(handleCheckRowError(_0xfc48('0x14'),'phone\x20not\x20specified!',null,_0x45f123));}if(_0x26c4f7['birthDate']){var _0x5a03cd=moment(_0x26c4f7[_0xfc48('0x1f')],'YYYY-MM-DD');if(!_0x5a03cd[_0xfc48('0x20')]()){return _0x298e40(handleCheckRowError('error','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x45f123));}}if(_0x26c4f7[_0xfc48('0x21')]){if(!isEmail(_0x26c4f7[_0xfc48('0x21')])){return _0x298e40(handleCheckRowError('error',_0xfc48('0x22'),null,_0x45f123));}}_0x26c4f7[_0xfc48('0x23')]=LISTID;_0x26c4f7['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x2953ba){var _0x4cf878={};for(var _0x406622=0x0,_0x5ce025=DUPLICATES[_0xfc48('0x19')];_0x406622<_0x5ce025;_0x406622+=0x1){_0x4cf878[DUPLICATES[_0x406622]]=_0x26c4f7[DUPLICATES[_0x406622]];}var _0x3f65c7=_[_0xfc48('0x24')](_0x2953ba,_0x4cf878);if(_0x3f65c7){return _0x298e40(handleCheckRowError('duplicate',_0xfc48('0x25'),_0x3f65c7,_0x45f123));}}return db['CmContact']['create'](_0x26c4f7,{'raw':!![],'hooks':![],'fields':_[_0xfc48('0x26')](_0x26c4f7)})[_0xfc48('0x27')](function(_0x397b5b){if(DUPLICATES&&DUPLICATES[_0xfc48('0x19')]&&_0x2953ba){_0x2953ba[_0xfc48('0x28')](_['pick'](_0x26c4f7,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x397b5b['id'];return _0x36376e();})['catch'](function(_0x4abfc6){return _0x298e40(handleCheckRowError(_0xfc48('0x14'),'Error\x20while\x20creating\x20contact:\x20'+(_0x4abfc6['message']||JSON['stringify'](_0x4abfc6)),null,_0x45f123));});});}function checkHopper(){function _0x575852(){return function(_0x22aef1){logger['error'](_0xfc48('0x29'),_0xfc48('0x2a'),util[_0xfc48('0x2b')](_0x22aef1,{'showHidden':![],'depth':null}));};}var _0xd7d3d1=function(_0x58ed3c,_0x4a9582){var _0xf880cb=squel[_0xfc48('0x2c')]()[_0xfc48('0x2d')](_0xfc48('0x2e'))[_0xfc48('0x2f')]([_0xfc48('0x1e'),_0xfc48('0x30'),_0xfc48('0x31'),_0xfc48('0x23'),_0x4a9582,_0xfc48('0x32'),_0xfc48('0x33')],squel[_0xfc48('0x34')]()['field'](_0xfc48('0x1e'),_0xfc48('0x1e'))[_0xfc48('0x35')]('NOW()','scheduledAt')['field']('id',_0xfc48('0x31'))[_0xfc48('0x35')](LISTID[_0xfc48('0x36')](),'ListId')[_0xfc48('0x35')](_0x58ed3c['id'][_0xfc48('0x36')](),_0x4a9582)[_0xfc48('0x35')]('NOW()',_0xfc48('0x32'))[_0xfc48('0x35')](_0xfc48('0x37'),_0xfc48('0x33'))['from']('cm_contacts')[_0xfc48('0x38')](_0xfc48('0x39'))[_0xfc48('0x38')](_0xfc48('0x3a'),LISTID[_0xfc48('0x36')]())[_0xfc48('0x38')](_0xfc48('0x3b'))[_0xfc48('0x38')](_0xfc48('0x3c'),squel[_0xfc48('0x34')]()[_0xfc48('0x35')](_0xfc48('0x1e'))[_0xfc48('0x3d')](_0xfc48('0x2e'))[_0xfc48('0x38')](_0x4a9582+_0xfc48('0x3e'),_0x58ed3c['id'][_0xfc48('0x36')]())))[_0xfc48('0x36')]();return _0xf880cb;};var _0x30f804=function(_0x4703a0,_0x26253d){var _0xfef406=squel['insert']()['into'](_0xfc48('0x2e'))['fromQuery'](['phone',_0xfc48('0x30'),_0xfc48('0x31'),_0xfc48('0x23'),_0x26253d,'createdAt','updatedAt'],squel[_0xfc48('0x34')]()['field']('phone',_0xfc48('0x1e'))[_0xfc48('0x35')](_0xfc48('0x37'),_0xfc48('0x30'))[_0xfc48('0x35')]('id',_0xfc48('0x31'))[_0xfc48('0x35')](LISTID['toString'](),_0xfc48('0x23'))[_0xfc48('0x35')](_0x4703a0['id'][_0xfc48('0x36')](),_0x26253d)[_0xfc48('0x35')](_0xfc48('0x37'),_0xfc48('0x32'))[_0xfc48('0x35')]('NOW()',_0xfc48('0x33'))['from'](_0xfc48('0x3f'))['where'](_0xfc48('0x39'))[_0xfc48('0x38')](_0xfc48('0x3a'),LISTID[_0xfc48('0x36')]())[_0xfc48('0x38')](_0xfc48('0x40'),squel[_0xfc48('0x41')](hopperContacts))[_0xfc48('0x38')](_0xfc48('0x3b'))[_0xfc48('0x38')](_0xfc48('0x3c'),squel[_0xfc48('0x34')]()['field']('calleridnum')['from']('cm_hopper_final')['where'](_0x26253d+_0xfc48('0x3e'),_0x4703a0['id'][_0xfc48('0x36')]()))[_0xfc48('0x38')](_0xfc48('0x3c'),squel[_0xfc48('0x34')]()[_0xfc48('0x35')](_0xfc48('0x1e'))[_0xfc48('0x3d')](_0xfc48('0x2e'))[_0xfc48('0x38')](_0x26253d+_0xfc48('0x3e'),_0x4703a0['id'][_0xfc48('0x36')]())))[_0xfc48('0x36')]();return _0xfef406;};function _0x53c20f(_0x9ae381,_0x2f42a6){var _0x275a59=squel['insert']()['into'](_0xfc48('0x2e'))[_0xfc48('0x2f')]([_0xfc48('0x1e'),_0xfc48('0x30'),'ContactId','ListId',_0x2f42a6,_0xfc48('0x32'),'updatedAt'],squel[_0xfc48('0x34')]()[_0xfc48('0x35')]('phone',_0xfc48('0x1e'))[_0xfc48('0x35')]('NOW()',_0xfc48('0x30'))['field']('id',_0xfc48('0x31'))[_0xfc48('0x35')](LISTID[_0xfc48('0x36')](),'ListId')[_0xfc48('0x35')](_0x9ae381['id'][_0xfc48('0x36')](),_0x2f42a6)[_0xfc48('0x35')](_0xfc48('0x37'),'createdAt')['field']('NOW()',_0xfc48('0x33'))[_0xfc48('0x3d')](_0xfc48('0x3f'))[_0xfc48('0x38')](_0xfc48('0x39'))['where'](_0xfc48('0x3a'),LISTID['toString']())['where'](_0xfc48('0x40'),squel[_0xfc48('0x41')](hopperContacts))['where'](_0xfc48('0x3b')))[_0xfc48('0x36')]();return _0x275a59;}function _0x3d4d5d(_0x114067,_0x4a9b7b){var _0x44c016=squel[_0xfc48('0x2c')]()[_0xfc48('0x2d')](_0xfc48('0x42'))[_0xfc48('0x2f')](['phone','ContactId',_0xfc48('0x23'),_0x4a9b7b,_0xfc48('0x32'),_0xfc48('0x33')],squel[_0xfc48('0x34')]()[_0xfc48('0x35')](_0xfc48('0x1e'),_0xfc48('0x1e'))['field']('id',_0xfc48('0x31'))[_0xfc48('0x35')](LISTID['toString'](),_0xfc48('0x23'))[_0xfc48('0x35')](_0x114067['id'][_0xfc48('0x36')](),_0x4a9b7b)[_0xfc48('0x35')](_0xfc48('0x37'),'createdAt')[_0xfc48('0x35')]('NOW()','updatedAt')['from']('cm_contacts')['where'](_0xfc48('0x39'))[_0xfc48('0x38')](_0xfc48('0x3a'),LISTID['toString']())[_0xfc48('0x38')]('id\x20IN\x20?',squel[_0xfc48('0x41')](hopperContacts))[_0xfc48('0x38')](_0xfc48('0x3b')))[_0xfc48('0x36')]();return _0x44c016;}return db[_0xfc48('0x43')][_0xfc48('0x44')]({'where':{'type':_0xfc48('0x45')},'attributes':['id',_0xfc48('0x46')],'include':[{'model':db[_0xfc48('0x47')],'as':_0xfc48('0x48'),'where':{'id':LISTID}}]})[_0xfc48('0x27')](function(_0x1bc837){var _0x43ee7a=[];if(_0x1bc837){var _0x259957;for(var _0x4efb34=0x0,_0x31b78f;_0x4efb34<_0x1bc837[_0xfc48('0x19')];_0x4efb34+=0x1){_0x31b78f=_0x1bc837[_0x4efb34][_0xfc48('0x49')]({'plain':!![]});switch(_0x31b78f['dialCheckDuplicateType']){case'always':_0x43ee7a['push'](db[_0xfc48('0x4a')]['query'](_0x30f804(_0x31b78f,_0xfc48('0x4b')))[_0xfc48('0x27')](function(){})[_0xfc48('0x4c')](_0x575852()));break;case'onlyIfOpen':_0x43ee7a[_0xfc48('0x28')](db[_0xfc48('0x4a')][_0xfc48('0x4d')](_0xd7d3d1(_0x31b78f,_0xfc48('0x4b')))[_0xfc48('0x27')](function(){})['catch'](_0x575852()));break;default:_0x43ee7a[_0xfc48('0x28')](db[_0xfc48('0x4a')][_0xfc48('0x4d')](_0x53c20f(_0x31b78f,'VoiceQueueId'))['then'](function(){})[_0xfc48('0x4c')](_0x575852()));}}}return _0x43ee7a;})[_0xfc48('0x4e')]()[_0xfc48('0x27')](function(){return db[_0xfc48('0x43')][_0xfc48('0x44')]({'where':{'type':_0xfc48('0x45')},'attributes':['id'],'include':[{'model':db[_0xfc48('0x47')],'as':_0xfc48('0x4f'),'where':{'id':LISTID}}]})['then'](function(_0x3ecf34){var _0xb7c2b6=[];if(_0x3ecf34){var _0x83b4e3;for(var _0x115442=0x0,_0x3f49bb;_0x115442<_0x3ecf34[_0xfc48('0x19')];_0x115442+=0x1){_0x3f49bb=_0x3ecf34[_0x115442][_0xfc48('0x49')]({'plain':!![]});_0xb7c2b6[_0xfc48('0x28')](db['sequelize']['query'](_0x3d4d5d(_0x3f49bb,_0xfc48('0x4b')))[_0xfc48('0x27')](function(){})['catch'](_0x575852()));}}return _0xb7c2b6;})[_0xfc48('0x4e')]();})[_0xfc48('0x27')](function(){return db[_0xfc48('0x50')]['findAll']({'attributes':['id',_0xfc48('0x46')],'include':[{'model':db[_0xfc48('0x47')],'as':_0xfc48('0x48'),'where':{'id':LISTID}}]})[_0xfc48('0x27')](function(_0x12e876){var _0x2a59ee=[];if(_0x12e876){for(var _0x5b444c=0x0,_0x4f5206;_0x5b444c<_0x12e876[_0xfc48('0x19')];_0x5b444c+=0x1){_0x4f5206=_0x12e876[_0x5b444c]['get']({'plain':!![]});switch(_0x4f5206[_0xfc48('0x46')]){case _0xfc48('0x51'):_0x2a59ee[_0xfc48('0x28')](db['sequelize'][_0xfc48('0x4d')](_0x30f804(_0x4f5206,_0xfc48('0x52')))[_0xfc48('0x27')](function(){})['catch'](_0x575852()));break;case _0xfc48('0x53'):_0x2a59ee[_0xfc48('0x28')](db[_0xfc48('0x4a')][_0xfc48('0x4d')](_0xd7d3d1(_0x4f5206,_0xfc48('0x52')))[_0xfc48('0x27')](function(){})[_0xfc48('0x4c')](_0x575852()));break;default:_0x2a59ee['push'](db[_0xfc48('0x4a')][_0xfc48('0x4d')](_0x53c20f(_0x4f5206,_0xfc48('0x52')))['then'](function(){})[_0xfc48('0x4c')](_0x575852()));}}}return _0x2a59ee;})[_0xfc48('0x4e')]();})[_0xfc48('0x27')](function(){return db['Campaign'][_0xfc48('0x44')]({'attributes':['id'],'include':[{'model':db[_0xfc48('0x47')],'as':'BlackLists','where':{'id':LISTID}}]})[_0xfc48('0x27')](function(_0x12953d){var _0x859b27=[];if(_0x12953d){for(var _0x300697=0x0,_0x32861d;_0x300697<_0x12953d['length'];_0x300697+=0x1){_0x32861d=_0x12953d[_0x300697]['get']({'plain':!![]});_0x859b27[_0xfc48('0x28')](db[_0xfc48('0x4a')][_0xfc48('0x4d')](_0x3d4d5d(_0x32861d,'CampaignId'))[_0xfc48('0x27')](function(){})['catch'](_0x575852()));}}return _0x859b27;})[_0xfc48('0x4e')]();})[_0xfc48('0x4c')](function(_0x32d6c3){logger[_0xfc48('0x14')](_0xfc48('0x54'),'generalCheckHopper',_0x32d6c3[_0xfc48('0x55')]);});}var processPromises=function(_0x4589a8){return BPromise[_0xfc48('0x4e')](promises)['then'](function(_0x5a1851){})[_0xfc48('0x4c')](function(_0x840b75){logger[_0xfc48('0x14')](_0xfc48('0x56'),JSON[_0xfc48('0x57')](_0x840b75));})[_0xfc48('0x58')](function(){socket[_0xfc48('0x59')]('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x4589a8){return _0x4589a8['resume']();}});};var endCsv=function(){return BPromise[_0xfc48('0x5a')]()[_0xfc48('0x27')](function(){if(hopperContacts){return checkHopper();}})[_0xfc48('0x27')](function(){socket[_0xfc48('0x59')]('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0x105be0){logger[_0xfc48('0x14')](_0xfc48('0x5b'),JSON[_0xfc48('0x57')](_0x105be0));}finally{process[_0xfc48('0x5c')](0x0);}});};process['on'](_0xfc48('0x5d'),function(){logger[_0xfc48('0x5e')](_0xfc48('0x5f'));endCsv();});function main(){return BPromise[_0xfc48('0x5a')]()[_0xfc48('0x27')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db[_0xfc48('0x60')][_0xfc48('0x44')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x584deb){var _0x138423=fs[_0xfc48('0x61')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xfc48('0x62')](_0x138423,{'header':!![],'skipEmptyLines':!![],'step':function(_0x33b5be,_0x594ae9){total+=0x1;var _0x47a476=total;promises['push'](checkRow(_0x33b5be,_0x584deb,_0x47a476)[_0xfc48('0x27')](function(){success+=0x1;})[_0xfc48('0x4c')](function(_0x1b294d){if(_0x1b294d['error']){errors+=0x1;delete _0x1b294d['error'];}else if(_0x1b294d[_0xfc48('0x63')]){duplicates+=0x1;delete _0x1b294d[_0xfc48('0x63')];}rows[_0xfc48('0x28')](_0x1b294d);}));if(total%0xc8===0x0){_0x594ae9[_0xfc48('0x64')]();return processPromises(_0x594ae9);}},'complete':function(){return processPromises()['then'](function(){logger[_0xfc48('0x5e')]('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x2f6fea,_0x212867){logger[_0xfc48('0x5e')](_0xfc48('0x65'),JSON[_0xfc48('0x57')](_0x2f6fea));endCsv();}});})[_0xfc48('0x4c')](function(_0x3c2bd3){logger[_0xfc48('0x14')](_0xfc48('0x66'),JSON[_0xfc48('0x57')](_0x3c2bd3));});}main(); \ No newline at end of file +var _0x3a44=['resolve','contact:csv_','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','parse','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','squel','papaparse','ioredis','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','register','argv','null','undefined','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','error','contact','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','message','join','data','firstName\x20not\x20specified!','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','length','duplicate','Duplicate\x20Contact','CmContact','create','keys','then','push','pick','catch','stringify','cmContact','checkHopper','inspect','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','select','field','phone','NOW()','toString','createdAt','updatedAt','from','deletedAt\x20IS\x20NULL','where','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','cm_contacts','id\x20IN\x20?','calleridnum','cm_hopper_final','str','cm_hopper_black','VoiceQueue','dialCheckDuplicateType','CmList','get','sequelize','query','onlyIfOpen','VoiceQueueId','all','findAll','BlackLists','Campaign','Lists','always','CampaignId','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:','finally','emit','resume'];(function(_0x45161c,_0x5494fc){var _0x186581=function(_0x78fada){while(--_0x78fada){_0x45161c['push'](_0x45161c['shift']());}};_0x186581(++_0x5494fc);}(_0x3a44,0x1d0));var _0x43a4=function(_0x268624,_0x4cf65b){_0x268624=_0x268624-0x0;var _0x3fd487=_0x3a44[_0x268624];return _0x3fd487;};'use strict';var BPromise=require(_0x43a4('0x0'));var util=require(_0x43a4('0x1'));var _=require(_0x43a4('0x2'));var fs=require('fs');var squel=require(_0x43a4('0x3'));var Papa=require(_0x43a4('0x4'));var Redis=require(_0x43a4('0x5'));var db=require('../../../mysqldb')['db'];var config=require(_0x43a4('0x6'));var logger=require(_0x43a4('0x7'))(_0x43a4('0x8'));config[_0x43a4('0x9')]=_[_0x43a4('0xa')](config[_0x43a4('0x9')],{'host':_0x43a4('0xb'),'port':0x18eb});var socket=require(_0x43a4('0xc'))(new Redis(config[_0x43a4('0x9')]));require('../../../api/cmContact/cmContact.socket')[_0x43a4('0xd')](socket);try{if(!process[_0x43a4('0xe')][0x2]||process[_0x43a4('0xe')][0x2]==='undefined'||process[_0x43a4('0xe')][0x2]===_0x43a4('0xf')){throw new Error('Missing\x20filepath\x20parameter!');}var FILEPATH=process[_0x43a4('0xe')][0x2];if(!process['argv'][0x3]||process[_0x43a4('0xe')][0x3]===_0x43a4('0x10')||process['argv'][0x3]===_0x43a4('0xf')||!process[_0x43a4('0xe')][0x4]||process['argv'][0x4]===_0x43a4('0x10')||process[_0x43a4('0xe')][0x4]===_0x43a4('0xf')){throw new Error(_0x43a4('0x11'));}var FIELDS=_[_0x43a4('0x12')](process[_0x43a4('0xe')][0x3][_0x43a4('0x13')](','),process[_0x43a4('0xe')][0x4][_0x43a4('0x13')](','));if(!process['argv'][0x5]||process[_0x43a4('0xe')][0x5]===_0x43a4('0x10')||process[_0x43a4('0xe')][0x5]===_0x43a4('0xf')){throw new Error(_0x43a4('0x14'));}var LISTID=process[_0x43a4('0xe')][0x5];var COMPANYID=process['argv'][0x6]&&process[_0x43a4('0xe')][0x6]!==_0x43a4('0x10')&&process['argv'][0x6]!==_0x43a4('0xf')?process['argv'][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process['argv'][0x7]!==_0x43a4('0x10')&&process['argv'][0x7]!==_0x43a4('0xf')?process[_0x43a4('0xe')][0x7]:null;if(!process[_0x43a4('0xe')][0x8]||process['argv'][0x8]===_0x43a4('0x10')||process[_0x43a4('0xe')][0x8]===_0x43a4('0xf')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x43a4('0xe')][0x8];}catch(_0x2e894e){logger[_0x43a4('0x15')](_0x2e894e);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(_0x316653,_0x525330,_0xe6c9de,_0x59fbc7){var _0x59a040={'message':_0x525330};_0x59a040[_0x316653]=!![];if(_0xe6c9de){_0x59a040[_0x43a4('0x16')]=_0xe6c9de;}if(_0x59fbc7){_0x59a040[_0x43a4('0x17')]=_0x59fbc7;}return _0x59a040;}function isEmail(_0x542d0f){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))*$/[_0x43a4('0x18')](_0x542d0f);}function checkRow(_0x11f913,_0x3fb355,_0x124147){return new BPromise(function(_0x415b6e,_0x4d7204){if(_[_0x43a4('0x19')](_0x11f913)){return _0x4d7204(handleCheckRowError('error',_0x43a4('0x1a'),null,_0x124147));}if(_0x11f913[_0x43a4('0x1b')]&&_0x11f913[_0x43a4('0x1b')]['length']){var _0x1a90ac=_['map'](_0x11f913['errors'],_0x43a4('0x1c'))[_0x43a4('0x1d')](';');return _0x4d7204(handleCheckRowError('error',_0x1a90ac,null,_0x124147));}var _0x2e2d72={};for(var _0x22326a in FIELDS){if(FIELDS['hasOwnProperty'](_0x22326a)&&FIELDS[_0x22326a]){_0x2e2d72[_0x22326a]=_0x11f913[_0x43a4('0x1e')][0x0][FIELDS[_0x22326a]]||_0x11f913[_0x43a4('0x1e')][0x0]['\ufeff'+FIELDS[_0x22326a]];}}if(!_0x2e2d72['firstName']){return _0x4d7204(handleCheckRowError('error',_0x43a4('0x1f'),null,_0x124147));}if(!_0x2e2d72['phone']){return _0x4d7204(handleCheckRowError(_0x43a4('0x15'),_0x43a4('0x20'),null,_0x124147));}if(_0x2e2d72[_0x43a4('0x21')]){var _0x44c07f=moment(_0x2e2d72[_0x43a4('0x21')],_0x43a4('0x22'));if(!_0x44c07f[_0x43a4('0x23')]()){return _0x4d7204(handleCheckRowError('error',_0x43a4('0x24'),null,_0x124147));}}if(_0x2e2d72[_0x43a4('0x25')]){if(!isEmail(_0x2e2d72[_0x43a4('0x25')])){return _0x4d7204(handleCheckRowError('error',_0x43a4('0x26'),null,_0x124147));}}_0x2e2d72[_0x43a4('0x27')]=LISTID;_0x2e2d72[_0x43a4('0x28')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x3fb355){var _0x5ca6fe={};for(var _0x1f0aba=0x0,_0x3fdfb8=DUPLICATES[_0x43a4('0x29')];_0x1f0aba<_0x3fdfb8;_0x1f0aba+=0x1){_0x5ca6fe[DUPLICATES[_0x1f0aba]]=_0x2e2d72[DUPLICATES[_0x1f0aba]];}var _0x2e239b=_['find'](_0x3fb355,_0x5ca6fe);if(_0x2e239b){return _0x4d7204(handleCheckRowError(_0x43a4('0x2a'),_0x43a4('0x2b'),_0x2e239b,_0x124147));}}return db[_0x43a4('0x2c')][_0x43a4('0x2d')](_0x2e2d72,{'raw':!![],'hooks':![],'fields':_[_0x43a4('0x2e')](_0x2e2d72)})[_0x43a4('0x2f')](function(_0xcaa951){if(DUPLICATES&&DUPLICATES[_0x43a4('0x29')]&&_0x3fb355){_0x3fb355[_0x43a4('0x30')](_[_0x43a4('0x31')](_0x2e2d72,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0xcaa951['id'];return _0x415b6e();})[_0x43a4('0x32')](function(_0x3c8948){return _0x4d7204(handleCheckRowError('error','Error\x20while\x20creating\x20contact:\x20'+(_0x3c8948[_0x43a4('0x1c')]||JSON[_0x43a4('0x33')](_0x3c8948)),null,_0x124147));});});}function checkHopper(){function _0x505344(){return function(_0x1ec89b){logger[_0x43a4('0x15')](_0x43a4('0x34'),_0x43a4('0x35'),util[_0x43a4('0x36')](_0x1ec89b,{'showHidden':![],'depth':null}));};}var _0x1eb2ef=function(_0x2184a4,_0x4a0145){var _0x994320=squel[_0x43a4('0x37')]()[_0x43a4('0x38')](_0x43a4('0x39'))[_0x43a4('0x3a')](['phone',_0x43a4('0x3b'),_0x43a4('0x3c'),_0x43a4('0x27'),_0x4a0145,'createdAt','updatedAt'],squel[_0x43a4('0x3d')]()[_0x43a4('0x3e')](_0x43a4('0x3f'),_0x43a4('0x3f'))['field'](_0x43a4('0x40'),_0x43a4('0x3b'))[_0x43a4('0x3e')]('id',_0x43a4('0x3c'))[_0x43a4('0x3e')](LISTID[_0x43a4('0x41')](),_0x43a4('0x27'))[_0x43a4('0x3e')](_0x2184a4['id'][_0x43a4('0x41')](),_0x4a0145)[_0x43a4('0x3e')](_0x43a4('0x40'),_0x43a4('0x42'))[_0x43a4('0x3e')](_0x43a4('0x40'),_0x43a4('0x43'))[_0x43a4('0x44')]('cm_contacts')['where'](_0x43a4('0x45'))[_0x43a4('0x46')](_0x43a4('0x47'),LISTID[_0x43a4('0x41')]())[_0x43a4('0x46')](_0x43a4('0x48'))[_0x43a4('0x46')](_0x43a4('0x49'),squel['select']()['field'](_0x43a4('0x3f'))[_0x43a4('0x44')](_0x43a4('0x39'))[_0x43a4('0x46')](_0x4a0145+_0x43a4('0x4a'),_0x2184a4['id'][_0x43a4('0x41')]())))[_0x43a4('0x41')]();return _0x994320;};var _0x377519=function(_0x9c5c3d,_0x1dbf84){var _0x336ba8=squel[_0x43a4('0x37')]()[_0x43a4('0x38')](_0x43a4('0x39'))[_0x43a4('0x3a')]([_0x43a4('0x3f'),'scheduledAt',_0x43a4('0x3c'),_0x43a4('0x27'),_0x1dbf84,_0x43a4('0x42'),_0x43a4('0x43')],squel[_0x43a4('0x3d')]()[_0x43a4('0x3e')](_0x43a4('0x3f'),_0x43a4('0x3f'))[_0x43a4('0x3e')](_0x43a4('0x40'),'scheduledAt')[_0x43a4('0x3e')]('id',_0x43a4('0x3c'))[_0x43a4('0x3e')](LISTID[_0x43a4('0x41')](),'ListId')['field'](_0x9c5c3d['id'][_0x43a4('0x41')](),_0x1dbf84)[_0x43a4('0x3e')](_0x43a4('0x40'),_0x43a4('0x42'))[_0x43a4('0x3e')]('NOW()',_0x43a4('0x43'))[_0x43a4('0x44')](_0x43a4('0x4b'))[_0x43a4('0x46')](_0x43a4('0x45'))[_0x43a4('0x46')](_0x43a4('0x47'),LISTID[_0x43a4('0x41')]())['where'](_0x43a4('0x4c'),squel['str'](hopperContacts))[_0x43a4('0x46')](_0x43a4('0x48'))[_0x43a4('0x46')](_0x43a4('0x49'),squel[_0x43a4('0x3d')]()['field'](_0x43a4('0x4d'))[_0x43a4('0x44')](_0x43a4('0x4e'))['where'](_0x1dbf84+_0x43a4('0x4a'),_0x9c5c3d['id'][_0x43a4('0x41')]()))[_0x43a4('0x46')](_0x43a4('0x49'),squel[_0x43a4('0x3d')]()['field'](_0x43a4('0x3f'))[_0x43a4('0x44')](_0x43a4('0x39'))['where'](_0x1dbf84+_0x43a4('0x4a'),_0x9c5c3d['id'][_0x43a4('0x41')]())))[_0x43a4('0x41')]();return _0x336ba8;};function _0x5c7f5f(_0x4a5fe6,_0x276ae3){var _0x3abfcb=squel[_0x43a4('0x37')]()[_0x43a4('0x38')]('cm_hopper')[_0x43a4('0x3a')](['phone',_0x43a4('0x3b'),_0x43a4('0x3c'),_0x43a4('0x27'),_0x276ae3,'createdAt',_0x43a4('0x43')],squel[_0x43a4('0x3d')]()['field']('phone',_0x43a4('0x3f'))[_0x43a4('0x3e')](_0x43a4('0x40'),_0x43a4('0x3b'))[_0x43a4('0x3e')]('id',_0x43a4('0x3c'))[_0x43a4('0x3e')](LISTID[_0x43a4('0x41')](),_0x43a4('0x27'))['field'](_0x4a5fe6['id'][_0x43a4('0x41')](),_0x276ae3)[_0x43a4('0x3e')](_0x43a4('0x40'),'createdAt')['field'](_0x43a4('0x40'),'updatedAt')[_0x43a4('0x44')](_0x43a4('0x4b'))['where'](_0x43a4('0x45'))[_0x43a4('0x46')](_0x43a4('0x47'),LISTID['toString']())[_0x43a4('0x46')](_0x43a4('0x4c'),squel[_0x43a4('0x4f')](hopperContacts))['where'](_0x43a4('0x48')))['toString']();return _0x3abfcb;}function _0x34cae8(_0xfbc452,_0x27083e){var _0x52e281=squel['insert']()[_0x43a4('0x38')](_0x43a4('0x50'))[_0x43a4('0x3a')]([_0x43a4('0x3f'),_0x43a4('0x3c'),_0x43a4('0x27'),_0x27083e,'createdAt','updatedAt'],squel['select']()['field'](_0x43a4('0x3f'),_0x43a4('0x3f'))['field']('id',_0x43a4('0x3c'))[_0x43a4('0x3e')](LISTID[_0x43a4('0x41')](),'ListId')[_0x43a4('0x3e')](_0xfbc452['id'][_0x43a4('0x41')](),_0x27083e)[_0x43a4('0x3e')](_0x43a4('0x40'),'createdAt')[_0x43a4('0x3e')](_0x43a4('0x40'),_0x43a4('0x43'))[_0x43a4('0x44')]('cm_contacts')[_0x43a4('0x46')]('deletedAt\x20IS\x20NULL')[_0x43a4('0x46')](_0x43a4('0x47'),LISTID[_0x43a4('0x41')]())[_0x43a4('0x46')](_0x43a4('0x4c'),squel[_0x43a4('0x4f')](hopperContacts))[_0x43a4('0x46')]('phone\x20IS\x20NOT\x20NULL'))['toString']();return _0x52e281;}return db[_0x43a4('0x51')]['findAll']({'where':{'type':'outbound'},'attributes':['id',_0x43a4('0x52')],'include':[{'model':db[_0x43a4('0x53')],'as':'Lists','where':{'id':LISTID}}]})[_0x43a4('0x2f')](function(_0x1afa9d){var _0x3eb2e3=[];if(_0x1afa9d){var _0xf7ba88;for(var _0x26cdf1=0x0,_0x1146c3;_0x26cdf1<_0x1afa9d[_0x43a4('0x29')];_0x26cdf1+=0x1){_0x1146c3=_0x1afa9d[_0x26cdf1][_0x43a4('0x54')]({'plain':!![]});switch(_0x1146c3['dialCheckDuplicateType']){case'always':_0x3eb2e3[_0x43a4('0x30')](db[_0x43a4('0x55')][_0x43a4('0x56')](_0x377519(_0x1146c3,'VoiceQueueId'))[_0x43a4('0x2f')](function(){})[_0x43a4('0x32')](_0x505344()));break;case _0x43a4('0x57'):_0x3eb2e3[_0x43a4('0x30')](db[_0x43a4('0x55')][_0x43a4('0x56')](_0x1eb2ef(_0x1146c3,_0x43a4('0x58')))[_0x43a4('0x2f')](function(){})[_0x43a4('0x32')](_0x505344()));break;default:_0x3eb2e3['push'](db['sequelize'][_0x43a4('0x56')](_0x5c7f5f(_0x1146c3,_0x43a4('0x58')))[_0x43a4('0x2f')](function(){})[_0x43a4('0x32')](_0x505344()));}}}return _0x3eb2e3;})[_0x43a4('0x59')]()[_0x43a4('0x2f')](function(){return db[_0x43a4('0x51')][_0x43a4('0x5a')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db[_0x43a4('0x53')],'as':_0x43a4('0x5b'),'where':{'id':LISTID}}]})[_0x43a4('0x2f')](function(_0x5c571e){var _0x7032fe=[];if(_0x5c571e){var _0x324209;for(var _0x6db69f=0x0,_0x4ba628;_0x6db69f<_0x5c571e[_0x43a4('0x29')];_0x6db69f+=0x1){_0x4ba628=_0x5c571e[_0x6db69f][_0x43a4('0x54')]({'plain':!![]});_0x7032fe[_0x43a4('0x30')](db[_0x43a4('0x55')]['query'](_0x34cae8(_0x4ba628,_0x43a4('0x58')))[_0x43a4('0x2f')](function(){})[_0x43a4('0x32')](_0x505344()));}}return _0x7032fe;})[_0x43a4('0x59')]();})[_0x43a4('0x2f')](function(){return db[_0x43a4('0x5c')][_0x43a4('0x5a')]({'attributes':['id',_0x43a4('0x52')],'include':[{'model':db[_0x43a4('0x53')],'as':_0x43a4('0x5d'),'where':{'id':LISTID}}]})[_0x43a4('0x2f')](function(_0x5087c4){var _0x1df29e=[];if(_0x5087c4){for(var _0x38ea58=0x0,_0x52febc;_0x38ea58<_0x5087c4[_0x43a4('0x29')];_0x38ea58+=0x1){_0x52febc=_0x5087c4[_0x38ea58]['get']({'plain':!![]});switch(_0x52febc[_0x43a4('0x52')]){case _0x43a4('0x5e'):_0x1df29e['push'](db[_0x43a4('0x55')]['query'](_0x377519(_0x52febc,_0x43a4('0x5f')))[_0x43a4('0x2f')](function(){})[_0x43a4('0x32')](_0x505344()));break;case _0x43a4('0x57'):_0x1df29e[_0x43a4('0x30')](db['sequelize'][_0x43a4('0x56')](_0x1eb2ef(_0x52febc,'CampaignId'))[_0x43a4('0x2f')](function(){})[_0x43a4('0x32')](_0x505344()));break;default:_0x1df29e[_0x43a4('0x30')](db[_0x43a4('0x55')][_0x43a4('0x56')](_0x5c7f5f(_0x52febc,_0x43a4('0x5f')))[_0x43a4('0x2f')](function(){})[_0x43a4('0x32')](_0x505344()));}}}return _0x1df29e;})[_0x43a4('0x59')]();})[_0x43a4('0x2f')](function(){return db['Campaign'][_0x43a4('0x5a')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x43a4('0x5b'),'where':{'id':LISTID}}]})['then'](function(_0x55c179){var _0x16b362=[];if(_0x55c179){for(var _0x44ac40=0x0,_0x18c318;_0x44ac40<_0x55c179[_0x43a4('0x29')];_0x44ac40+=0x1){_0x18c318=_0x55c179[_0x44ac40][_0x43a4('0x54')]({'plain':!![]});_0x16b362[_0x43a4('0x30')](db[_0x43a4('0x55')][_0x43a4('0x56')](_0x34cae8(_0x18c318,'CampaignId'))['then'](function(){})[_0x43a4('0x32')](_0x505344()));}}return _0x16b362;})[_0x43a4('0x59')]();})['catch'](function(_0x473b5f){logger[_0x43a4('0x15')](_0x43a4('0x60'),'generalCheckHopper',_0x473b5f[_0x43a4('0x1c')]);});}var processPromises=function(_0x449f0f){return BPromise[_0x43a4('0x59')](promises)[_0x43a4('0x2f')](function(_0x84a936){})[_0x43a4('0x32')](function(_0x3779a1){logger[_0x43a4('0x15')](_0x43a4('0x61'),JSON[_0x43a4('0x33')](_0x3779a1));})[_0x43a4('0x62')](function(){socket[_0x43a4('0x63')]('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x449f0f){return _0x449f0f[_0x43a4('0x64')]();}});};var endCsv=function(){return BPromise[_0x43a4('0x65')]()[_0x43a4('0x2f')](function(){if(hopperContacts){return checkHopper();}})[_0x43a4('0x2f')](function(){socket[_0x43a4('0x63')](_0x43a4('0x66')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0x902ffc){logger[_0x43a4('0x15')](_0x43a4('0x67'),JSON['stringify'](_0x902ffc));}finally{process[_0x43a4('0x68')](0x0);}});};process['on'](_0x43a4('0x69'),function(){logger[_0x43a4('0x6a')](_0x43a4('0x6b'));endCsv();});function main(){return BPromise['resolve']()[_0x43a4('0x2f')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x43a4('0x13')](',');return db[_0x43a4('0x2c')]['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x43a4('0x2f')](function(_0x45ebb7){var _0x392d5b=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x43a4('0x6c')](_0x392d5b,{'header':!![],'skipEmptyLines':!![],'step':function(_0x3d665f,_0x3d1941){total+=0x1;var _0xc4bc82=total;promises[_0x43a4('0x30')](checkRow(_0x3d665f,_0x45ebb7,_0xc4bc82)[_0x43a4('0x2f')](function(){success+=0x1;})[_0x43a4('0x32')](function(_0x48737f){if(_0x48737f[_0x43a4('0x15')]){errors+=0x1;delete _0x48737f['error'];}else if(_0x48737f[_0x43a4('0x2a')]){duplicates+=0x1;delete _0x48737f['duplicate'];}rows[_0x43a4('0x30')](_0x48737f);}));if(total%0xc8===0x0){_0x3d1941[_0x43a4('0x6d')]();return processPromises(_0x3d1941);}},'complete':function(){return processPromises()[_0x43a4('0x2f')](function(){logger['info'](_0x43a4('0x6e'));endCsv();});},'error':function(_0x43f499,_0x9e48aa){logger['info'](_0x43a4('0x6f'),JSON[_0x43a4('0x33')](_0x43f499));endCsv();}});})[_0x43a4('0x32')](function(_0x333914){logger[_0x43a4('0x15')](_0x43a4('0x70'),JSON[_0x43a4('0x33')](_0x333914));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 39f542d..971a505 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 _0xffe3=['campaigns_has_cm_blacklists','then','affectedRows','emit','unlink','catch','complete','argv','arguments\x20\x20\x20','server/files/tmp','existsSync','file\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','parse','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','util','bluebird','moment','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','defaults','socket.io-emitter','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','from','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','join','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','ContactId','createdAt','updatedAt','priority','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.phone','cm_hopper_black','ListId','ListId\x20=\x20?','\x20=\x20?','toString','concat','CompanyId','deletedAt\x20IS\x20NULL','MIN(id)','min_id','info','Received\x20SIGINT','error','message','exit','errors','push','code','sequelize','query','spread','send','binding','socket_timestamp','root','.csv','keys','header','writeFileSync','createReadStream','data','length','rows','hasOwnProperty','trim','replace','scheduledat','isNaN','UserId','isNumber','agent\x20not\x20exists','email','email\x20wrong\x20format','isValid','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','SystemRow','appendFileSync','contact:import:','Abort\x20parser','abort','SystemError','step','cm_contacts_','CREATE\x20TABLE\x20','format','isNil','duplicates','DROP\x20TABLE\x20','voice_queues_has_cm_lists','VoiceQueueId','voice_queues','campaigns_has_cm_lists','campaigns','CampaignId'];(function(_0x2179f1,_0x21c653){var _0x176ec9=function(_0x4c4a4c){while(--_0x4c4a4c){_0x2179f1['push'](_0x2179f1['shift']());}};_0x176ec9(++_0x21c653);}(_0xffe3,0x1a8));var _0x3ffe=function(_0x449efd,_0x2daea5){_0x449efd=_0x449efd-0x0;var _0x16d17c=_0xffe3[_0x449efd];return _0x16d17c;};'use strict';var fs=require('fs');var path=require(_0x3ffe('0x0'));var _=require(_0x3ffe('0x1'));var Papa=require(_0x3ffe('0x2'));var util=require(_0x3ffe('0x3'));var BPromise=require(_0x3ffe('0x4'));var moment=require(_0x3ffe('0x5'));var squel=require('squel');var Redis=require('ioredis');var db=require(_0x3ffe('0x6'))['db'];var config=require(_0x3ffe('0x7'));var logger=require(_0x3ffe('0x8'))(_0x3ffe('0x9'));config[_0x3ffe('0xa')]=_[_0x3ffe('0xb')](config[_0x3ffe('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x3ffe('0xc'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()['format'](_0x3ffe('0xd'));function isEmail(_0x3600fa){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))*$/[_0x3ffe('0xe')](_0x3600fa);}function selectNotIn(_0x206b2e,_0x2c7c0b,_0x561b31,_0x2025cb,_0x1d66cc){return squel[_0x3ffe('0xf')]()[_0x3ffe('0x10')](_0x3ffe('0x11'))[_0x3ffe('0x12')](_0x2025cb)['join'](_0x2c7c0b,null,_0x2c7c0b+_0x3ffe('0x13')+_0x2025cb+'.'+_0x561b31)[_0x3ffe('0x14')](_0x2025cb+'.'+_0x561b31+_0x3ffe('0x15')+_0x206b2e+'.'+_0x561b31)[_0x3ffe('0x14')](_0x2c7c0b+_0x3ffe('0x16')+_0x1d66cc[_0x3ffe('0x17')]()+')');}function insertCmHopper(_0x2d829a,_0x3175ce,_0x5b1996,_0x17825b,_0x2e0a47){var _0x5047e9=['cm_contacts.phone',_0x3ffe('0x18'),_0x3ffe('0x19'),_0x3ffe('0x1a'),_0x3175ce+'.'+_0x17825b,_0x3ffe('0x1b'),_0x3ffe('0x1c'),_0x3ffe('0x1d'),_0x3ffe('0x1e'),'\x22'+_0x2e0a47+'\x22'];return squel[_0x3ffe('0x1f')]()[_0x3ffe('0x20')](_0x3ffe('0x21'))[_0x3ffe('0x22')]([_0x3ffe('0x11'),'scheduledat',_0x3ffe('0x23'),'ListId',_0x17825b,_0x3ffe('0x24'),_0x3ffe('0x25'),_0x3ffe('0x26'),'UserId',_0x3ffe('0x27')],squel[_0x3ffe('0xf')]()[_0x3ffe('0x28')](_0x5047e9)[_0x3ffe('0x12')](_0x3175ce)[_0x3ffe('0x17')](_0x3ffe('0x29'),null,_0x3ffe('0x2a')+_0x3175ce+_0x3ffe('0x2b'))[_0x3ffe('0x17')](_0x5b1996,null,_0x5b1996+_0x3ffe('0x13')+_0x3175ce+'.'+_0x17825b)['where'](_0x3175ce+_0x3ffe('0x2c'),_0x2d829a)[_0x3ffe('0x14')](_0x3ffe('0x2d'),NOW)['where'](_0x3ffe('0x2e'),selectNotIn(_0x3175ce,_0x5b1996,_0x17825b,_0x3ffe('0x21'),[_0x3ffe('0x2f'),_0x3ffe('0x30')]))[_0x3ffe('0x14')](_0x3ffe('0x2e'),selectNotIn(_0x3175ce,_0x5b1996,_0x17825b,'cm_hopper',[_0x3ffe('0x2f')])))['toString']();}function insertCmHopperBlack(_0x5158cf,_0x4feb3c,_0x2ad9ef,_0x2e9639){var _0xf0d6cc=[_0x3ffe('0x31'),_0x3ffe('0x19'),_0x3ffe('0x1a'),_0x4feb3c+'.'+_0x2e9639,'cm_contacts.createdAt',_0x3ffe('0x1c')];return squel[_0x3ffe('0x1f')]()[_0x3ffe('0x20')](_0x3ffe('0x32'))['fromQuery'](['phone','ContactId',_0x3ffe('0x33'),_0x2e9639,_0x3ffe('0x24'),_0x3ffe('0x25')],squel['select']()[_0x3ffe('0x28')](_0xf0d6cc)[_0x3ffe('0x12')](_0x4feb3c)[_0x3ffe('0x17')](_0x3ffe('0x29'),null,_0x3ffe('0x2a')+_0x4feb3c+_0x3ffe('0x2b'))['join'](_0x2ad9ef,null,_0x2ad9ef+'.id\x20=\x20'+_0x4feb3c+'.'+_0x2e9639)[_0x3ffe('0x14')](_0x4feb3c+_0x3ffe('0x2c'),_0x5158cf)[_0x3ffe('0x14')](_0x3ffe('0x2d'),NOW)[_0x3ffe('0x14')](_0x3ffe('0x2e'),squel[_0x3ffe('0xf')]()['field'](_0x3ffe('0x11'))[_0x3ffe('0x12')]('cm_hopper_black')[_0x3ffe('0x14')](_0x3ffe('0x34'),_0x5158cf)['where'](_0x2e9639+_0x3ffe('0x35'),_0x4feb3c+'.'+_0x2e9639)))[_0x3ffe('0x36')]();}function insertCmContact(_0x15e5b3,_0x1c5688,_0x54f181,_0x28bff5){var _0x43bd4d=_[_0x3ffe('0x37')](_['keys'](_0x28bff5),[_0x3ffe('0x33'),_0x3ffe('0x38'),'createdAt','updatedAt']);return squel['insert']()[_0x3ffe('0x20')](_0x3ffe('0x29'))[_0x3ffe('0x22')](_0x43bd4d,squel[_0x3ffe('0xf')]()[_0x3ffe('0x28')](_0x43bd4d)[_0x3ffe('0x12')](_0x1c5688)['where']('('+_0x54f181[_0x3ffe('0x17')](',')+')\x20NOT\x20IN\x20?',squel['select']()['fields'](_0x54f181)[_0x3ffe('0x12')]('cm_contacts')['where'](_0x3ffe('0x34'),_0x15e5b3)[_0x3ffe('0x14')](_0x3ffe('0x39')))[_0x3ffe('0x14')]('id\x20IN\x20?',squel['select']()[_0x3ffe('0x10')](_0x3ffe('0x3a'),_0x3ffe('0x3b'))[_0x3ffe('0x12')](_0x1c5688)['group'](_0x54f181['join'](','))))[_0x3ffe('0x36')]();}function handleStop(){logger[_0x3ffe('0x3c')](_0x3ffe('0x3d'));stopped=!![];}function handleUncaughtException(_0x3cd4ef){logger[_0x3ffe('0x3e')](_0x3cd4ef[_0x3ffe('0x3f')]);process[_0x3ffe('0x40')](0x1);}function handleError(_0x16b5ac,_0x44f5fc){stats[_0x3ffe('0x41')][_0x3ffe('0x42')]({'name':_0x44f5fc[_0x3ffe('0x43')],'message':_0x44f5fc[_0x3ffe('0x3f')],'row':_0x16b5ac});}function handleQuery(_0x1e8f61){logger[_0x3ffe('0x3c')](_0x1e8f61);return db[_0x3ffe('0x44')][_0x3ffe('0x45')](_0x1e8f61)[_0x3ffe('0x46')](function(_0x265632){results[_0x3ffe('0x42')](_0x265632);})['catch'](function(_0x50a6d4){logger[_0x3ffe('0x3e')](_0x50a6d4[_0x3ffe('0x3f')]);});}function main(_0x4cbaf8,_0x1fd3f3,_0x5316a4,_0x42cf3a){logger[_0x3ffe('0x3c')]('main',_0x4cbaf8,JSON['stringify'](_0x1fd3f3));process[_0x3ffe('0x47')]('start');var _0x5c489d=_0x1fd3f3[_0x3ffe('0x48')];var _0x552c9e=_0x1fd3f3[_0x3ffe('0x49')];var _0x772af1=path[_0x3ffe('0x17')](config[_0x3ffe('0x4a')],'server/files/tmp',_0x552c9e+_0x3ffe('0x4b'));var _0x333d1a=_[_0x3ffe('0x4c')](_0x5c489d)[_0x3ffe('0x17')]();logger[_0x3ffe('0x3c')](_0x3ffe('0x4d'),_0x333d1a);fs[_0x3ffe('0x4e')](_0x772af1,_0x333d1a+'\x0a');Papa['parse'](fs[_0x3ffe('0x4f')](_0x4cbaf8),{'header':!![],'skipEmptyLines':!![],'step':function(_0x907e80,_0x2b3f4f){try{for(var _0x1b11ac=0x0,_0x56a1bb=[];_0x1b11ac<_0x907e80[_0x3ffe('0x50')][_0x3ffe('0x51')];_0x1b11ac++){stats[_0x3ffe('0x52')]+=0x1;if(_0x907e80['errors'][_0x1b11ac]){handleError(_0x907e80['data'][_0x1b11ac],_0x907e80['errors'][_0x1b11ac]);}else{var _0x43ff92=[];for(var _0x11896f in _0x5c489d){if(_0x5c489d[_0x3ffe('0x53')](_0x11896f)){if(_0x907e80[_0x3ffe('0x50')][_0x1b11ac][_0x5c489d[_0x11896f]]){var _0x2a0bcf=_[_0x3ffe('0x54')](_0x907e80[_0x3ffe('0x50')][_0x1b11ac][_0x5c489d[_0x11896f]][_0x3ffe('0x55')](/"/g,'\x27'));switch(_0x11896f){case _0x3ffe('0x56'):var _0x2a151e=moment(_0x2a0bcf,_0x3ffe('0xd'),!![]);if(_0x2a151e['isValid']()){_0x56a1bb[_0x3ffe('0x42')]('\x22'+_0x2a0bcf+'\x22');}else{_0x43ff92[_0x3ffe('0x42')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0x3ffe('0x26'):var _0xc1d05c=parseInt(_0x2a0bcf);_0x2a0bcf=_[_0x3ffe('0x57')](_0xc1d05c)||_0xc1d05c<0x0||_0xc1d05c>0x4?_0x42cf3a?0x3:0x2:_0xc1d05c;_0x56a1bb[_0x3ffe('0x42')]('\x22'+_0x2a0bcf+'\x22');break;case _0x3ffe('0x58'):var _0x59601d=parseInt(_0x2a0bcf);if(_[_0x3ffe('0x59')](_0x59601d)&&_['includes'](_0x5316a4,_0x59601d)){_0x56a1bb[_0x3ffe('0x42')]('\x22'+_0x59601d+'\x22');}else{_0x43ff92[_0x3ffe('0x42')](_0x3ffe('0x5a'));}break;case _0x3ffe('0x5b'):if(isEmail(_0x2a0bcf)){_0x56a1bb[_0x3ffe('0x42')]('\x22'+_0x2a0bcf+'\x22');}else{_0x43ff92[_0x3ffe('0x42')](_0x3ffe('0x5c'));}break;case'dateOfBirth':var _0x312318=moment(_0x2a0bcf,'YYYY-MM-DD',!![]);if(_0x312318[_0x3ffe('0x5d')]()){_0x56a1bb[_0x3ffe('0x42')]('\x22'+_0x2a0bcf+'\x22');}else{_0x43ff92[_0x3ffe('0x42')](_0x3ffe('0x5e'));}break;default:_0x56a1bb[_0x3ffe('0x42')]('\x22'+_0x2a0bcf+'\x22');}}else{switch(_0x11896f){case _0x3ffe('0x5f'):case'phone':_0x43ff92[_0x3ffe('0x42')](_0x11896f+_0x3ffe('0x60'));break;default:_0x56a1bb[_0x3ffe('0x42')]('\x22\x22');}}}}if(_0x43ff92[_0x3ffe('0x51')]){handleError(_0x907e80[_0x3ffe('0x50')][_0x1b11ac],{'code':_0x3ffe('0x61'),'message':_0x43ff92[_0x3ffe('0x17')]()});}else{fs[_0x3ffe('0x62')](_0x772af1,_0x56a1bb['join']()+'\x0a');}_0x56a1bb=[];}if(!(stats[_0x3ffe('0x52')]%0xc8)){socket['emit'](_0x3ffe('0x63')+_0x552c9e,stats);stats[_0x3ffe('0x41')]=[];}}if(stopped){logger[_0x3ffe('0x3c')](_0x3ffe('0x64'));_0x2b3f4f[_0x3ffe('0x65')]();}}catch(_0x59a0fd){handleError(_0x907e80[_0x3ffe('0x50')][_0x1b11ac],{'code':_0x3ffe('0x66'),'message':_0x59a0fd['message']});logger[_0x3ffe('0x3e')](_0x3ffe('0x67'),_0x59a0fd[_0x3ffe('0x3f')]);}},'complete':function(){try{var _0x403bed=[];var _0x480c5d=_0x3ffe('0x29');if(_0x1fd3f3['duplicates']&&_0x1fd3f3['duplicates'][_0x3ffe('0x51')]){_0x480c5d=_0x3ffe('0x68')+_0x552c9e;_0x403bed['push'](_0x3ffe('0x69')+_0x480c5d+'\x20LIKE\x20cm_contacts;');}var _0x3920e4=util[_0x3ffe('0x6a')]('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',_0x772af1,_0x480c5d,_0x333d1a,_0x1fd3f3['ListId'],_0x1fd3f3[_0x3ffe('0x38')]||null,NOW,NOW);if(_[_0x3ffe('0x6b')](_0x5c489d[_0x3ffe('0x56')])){_0x3920e4+=',\x20scheduledAt\x20=\x20NOW()';}_0x403bed['push'](_0x3920e4);if(_0x1fd3f3[_0x3ffe('0x6c')]&&_0x1fd3f3[_0x3ffe('0x6c')][_0x3ffe('0x51')]){_0x403bed[_0x3ffe('0x42')](insertCmContact(_0x1fd3f3[_0x3ffe('0x33')],_0x480c5d,_0x1fd3f3[_0x3ffe('0x6c')],_0x5c489d));_0x403bed[_0x3ffe('0x42')](_0x3ffe('0x6d')+_0x480c5d+';');}_0x403bed[_0x3ffe('0x42')](insertCmHopper(_0x1fd3f3['ListId'],_0x3ffe('0x6e'),'voice_queues',_0x3ffe('0x6f'),_0x42cf3a));_0x403bed[_0x3ffe('0x42')](insertCmHopperBlack(_0x1fd3f3[_0x3ffe('0x33')],'voice_queues_has_cm_blacklists',_0x3ffe('0x70'),_0x3ffe('0x6f')));_0x403bed[_0x3ffe('0x42')](insertCmHopper(_0x1fd3f3[_0x3ffe('0x33')],_0x3ffe('0x71'),_0x3ffe('0x72'),_0x3ffe('0x73'),_0x42cf3a));_0x403bed[_0x3ffe('0x42')](insertCmHopperBlack(_0x1fd3f3[_0x3ffe('0x33')],_0x3ffe('0x74'),'campaigns',_0x3ffe('0x73')));BPromise['each'](_0x403bed,handleQuery)[_0x3ffe('0x75')](function(_0x123928){stats['finish']=!![];stats[_0x3ffe('0x76')]=_0x1fd3f3[_0x3ffe('0x6c')]&&_0x1fd3f3['duplicates'][_0x3ffe('0x51')]?results[0x2][_0x3ffe('0x76')]:results[0x0][_0x3ffe('0x76')];socket[_0x3ffe('0x77')]('contact:import:'+_0x552c9e,stats);fs[_0x3ffe('0x78')](_0x4cbaf8);fs[_0x3ffe('0x78')](_0x772af1);process[_0x3ffe('0x40')](0x0);})[_0x3ffe('0x79')](function(_0x3330f5){logger[_0x3ffe('0x3e')](_0x3330f5[_0x3ffe('0x3f')]);process['exit'](0x1);});}catch(_0x7e1357){logger[_0x3ffe('0x3e')](_0x3ffe('0x7a'),_0x7e1357[_0x3ffe('0x3f')]);process[_0x3ffe('0x40')](0x1);}},'error':function(_0x4dabac,_0x267fbd,_0x5b61d5,_0xa70ca){throw new Error(_0xa70ca);}});}function validate(){if(process['argv']&&process[_0x3ffe('0x7b')][_0x3ffe('0x51')]<0x4){throw new Error(_0x3ffe('0x7c'));}var _0x2024c6=path[_0x3ffe('0x17')](config[_0x3ffe('0x4a')],_0x3ffe('0x7d'),process[_0x3ffe('0x7b')][0x2]);if(!fs[_0x3ffe('0x7e')](_0x2024c6)){throw new Error(_0x3ffe('0x7f'));}var _0x3ec88b={};try{_0x3ec88b=JSON['parse'](process[_0x3ffe('0x7b')][0x3]);if(!_0x3ec88b[_0x3ffe('0x48')]){throw new Error('binding\x20doesn\x27t\x20exists');}if(!_0x3ec88b[_0x3ffe('0x48')][_0x3ffe('0x11')]){throw new Error(_0x3ffe('0x80'));}if(!_0x3ec88b['binding'][_0x3ffe('0x5f')]){throw new Error(_0x3ffe('0x81'));}var _0x515602=0x0;if(_0x3ec88b['binding'][_0x3ffe('0x58')]){_0x515602=0x1;}if(!_0x3ec88b[_0x3ffe('0x33')]){throw new Error(_0x3ffe('0x82'));}}catch(_0x432a02){throw new Error('body\x20id\x20mandatory');}var _0x477453=[];try{_0x477453=_['map'](JSON[_0x3ffe('0x83')](process[_0x3ffe('0x7b')][0x4]),'id');}catch(_0x459ce4){logger[_0x3ffe('0x3c')](_0x3ffe('0x84'));}main(_0x2024c6,_0x3ec88b,_0x477453,_0x515602);}validate();process['on'](_0x3ffe('0x85'),handleStop);process['on'](_0x3ffe('0x86'),handleUncaughtException); \ No newline at end of file +var _0xc062=['ListId\x20=\x20?','\x20=\x20?','concat','CompanyId','MIN(id)','min_id','group','info','Received\x20SIGINT','error','exit','push','code','sequelize','spread','catch','message','main','stringify','socket_timestamp','root','server/files/tmp','.csv','keys','header','writeFileSync','parse','createReadStream','data','rows','errors','hasOwnProperty','trim','replace','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','agent\x20not\x20exists','YYYY-MM-DD','isValid','\x20not\x20specified','length','SystemRow','appendFileSync','abort','SystemError','step','duplicates','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','isNil','scheduledat',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','voice_queues','VoiceQueueId','campaigns_has_cm_lists','campaigns','CampaignId','campaigns_has_cm_blacklists','each','then','finish','affectedRows','contact:import:','complete','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','binding','phone\x20is\x20mandatory','firstName','ListId\x20is\x20mandatory','map','No\x20agent\x20available','uncaughtException','papaparse','util','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','import','defaults','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','field','phone','join','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.createdAt','cm_contacts.priority','insert','into','cm_hopper','ContactId','ListId','updatedAt','priority','UserId','recallme','select','fields','from','cm_contacts','cm_contacts.ListId\x20=\x20','.id\x20=\x20','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.id','cm_contacts.ListId','cm_hopper_black','fromQuery','createdAt','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?'];(function(_0x176a71,_0x4bbab9){var _0x465818=function(_0x2ed644){while(--_0x2ed644){_0x176a71['push'](_0x176a71['shift']());}};_0x465818(++_0x4bbab9);}(_0xc062,0xce));var _0x2c06=function(_0x9054d6,_0x22f359){_0x9054d6=_0x9054d6-0x0;var _0x1f84ca=_0xc062[_0x9054d6];return _0x1f84ca;};'use strict';var fs=require('fs');var path=require('path');var _=require('lodash');var Papa=require(_0x2c06('0x0'));var util=require(_0x2c06('0x1'));var BPromise=require('bluebird');var moment=require(_0x2c06('0x2'));var squel=require(_0x2c06('0x3'));var Redis=require(_0x2c06('0x4'));var db=require(_0x2c06('0x5'))['db'];var config=require(_0x2c06('0x6'));var logger=require(_0x2c06('0x7'))(_0x2c06('0x8'));config['redis']=_[_0x2c06('0x9')](config[_0x2c06('0xa')],{'host':_0x2c06('0xb'),'port':0x18eb});var socket=require(_0x2c06('0xc'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0x2c06('0xd')](_0x2c06('0xe'));function isEmail(_0x23f73f){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))*$/[_0x2c06('0xf')](_0x23f73f);}function selectNotIn(_0x299f7c,_0x2d6f48,_0x35850b,_0x3017d2,_0x1dae95){return squel['select']()[_0x2c06('0x10')](_0x2c06('0x11'))['from'](_0x3017d2)[_0x2c06('0x12')](_0x2d6f48,null,_0x2d6f48+'.id\x20=\x20'+_0x3017d2+'.'+_0x35850b)[_0x2c06('0x13')](_0x3017d2+'.'+_0x35850b+_0x2c06('0x14')+_0x299f7c+'.'+_0x35850b)[_0x2c06('0x13')](_0x2d6f48+_0x2c06('0x15')+_0x1dae95[_0x2c06('0x12')]()+')');}function insertCmHopper(_0x1eb976,_0x43beb7,_0xeef37f,_0x1f794b,_0x2378d1){var _0x301da1=[_0x2c06('0x16'),'cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId',_0x43beb7+'.'+_0x1f794b,_0x2c06('0x17'),'cm_contacts.updatedAt',_0x2c06('0x18'),'cm_contacts.UserId','\x22'+_0x2378d1+'\x22'];return squel[_0x2c06('0x19')]()[_0x2c06('0x1a')](_0x2c06('0x1b'))['fromQuery']([_0x2c06('0x11'),'scheduledat',_0x2c06('0x1c'),_0x2c06('0x1d'),_0x1f794b,'createdAt',_0x2c06('0x1e'),_0x2c06('0x1f'),_0x2c06('0x20'),_0x2c06('0x21')],squel[_0x2c06('0x22')]()[_0x2c06('0x23')](_0x301da1)[_0x2c06('0x24')](_0x43beb7)[_0x2c06('0x12')](_0x2c06('0x25'),null,_0x2c06('0x26')+_0x43beb7+'.CmListId')[_0x2c06('0x12')](_0xeef37f,null,_0xeef37f+_0x2c06('0x27')+_0x43beb7+'.'+_0x1f794b)['where'](_0x43beb7+'.CmListId\x20=\x20?',_0x1eb976)['where']('cm_contacts.createdAt\x20=\x20?',NOW)[_0x2c06('0x13')](_0x2c06('0x28'),selectNotIn(_0x43beb7,_0xeef37f,_0x1f794b,_0x2c06('0x1b'),[_0x2c06('0x29'),_0x2c06('0x2a')]))[_0x2c06('0x13')](_0x2c06('0x28'),selectNotIn(_0x43beb7,_0xeef37f,_0x1f794b,_0x2c06('0x1b'),[_0x2c06('0x29')])))[_0x2c06('0x2b')]();}function insertCmHopperBlack(_0x228fc6,_0x4fc6bb,_0x5b5f78,_0x568a87){var _0x751fbd=[_0x2c06('0x16'),_0x2c06('0x2c'),_0x2c06('0x2d'),_0x4fc6bb+'.'+_0x568a87,'cm_contacts.createdAt','cm_contacts.updatedAt'];return squel['insert']()[_0x2c06('0x1a')](_0x2c06('0x2e'))[_0x2c06('0x2f')](['phone','ContactId',_0x2c06('0x1d'),_0x568a87,_0x2c06('0x30'),_0x2c06('0x1e')],squel[_0x2c06('0x22')]()[_0x2c06('0x23')](_0x751fbd)[_0x2c06('0x24')](_0x4fc6bb)[_0x2c06('0x12')](_0x2c06('0x25'),null,_0x2c06('0x26')+_0x4fc6bb+_0x2c06('0x31'))['join'](_0x5b5f78,null,_0x5b5f78+_0x2c06('0x27')+_0x4fc6bb+'.'+_0x568a87)[_0x2c06('0x13')](_0x4fc6bb+_0x2c06('0x32'),_0x228fc6)[_0x2c06('0x13')](_0x2c06('0x33'),NOW)['where'](_0x2c06('0x28'),squel[_0x2c06('0x22')]()['field'](_0x2c06('0x11'))[_0x2c06('0x24')](_0x2c06('0x2e'))[_0x2c06('0x13')](_0x2c06('0x34'),_0x228fc6)[_0x2c06('0x13')](_0x568a87+_0x2c06('0x35'),_0x4fc6bb+'.'+_0x568a87)))['toString']();}function insertCmContact(_0x1001ad,_0x1583c3,_0x2b16c9,_0x3fbb6f){var _0x4712dc=_[_0x2c06('0x36')](_['keys'](_0x3fbb6f),[_0x2c06('0x1d'),_0x2c06('0x37'),_0x2c06('0x30'),_0x2c06('0x1e')]);return squel['insert']()[_0x2c06('0x1a')](_0x2c06('0x25'))[_0x2c06('0x2f')](_0x4712dc,squel[_0x2c06('0x22')]()['fields'](_0x4712dc)[_0x2c06('0x24')](_0x1583c3)['where']('('+_0x2b16c9[_0x2c06('0x12')](',')+')\x20NOT\x20IN\x20?',squel['select']()[_0x2c06('0x23')](_0x2b16c9)[_0x2c06('0x24')](_0x2c06('0x25'))[_0x2c06('0x13')](_0x2c06('0x34'),_0x1001ad)[_0x2c06('0x13')]('deletedAt\x20IS\x20NULL'))[_0x2c06('0x13')]('id\x20IN\x20?',squel[_0x2c06('0x22')]()[_0x2c06('0x10')](_0x2c06('0x38'),_0x2c06('0x39'))[_0x2c06('0x24')](_0x1583c3)[_0x2c06('0x3a')](_0x2b16c9[_0x2c06('0x12')](','))))[_0x2c06('0x2b')]();}function handleStop(){logger[_0x2c06('0x3b')](_0x2c06('0x3c'));stopped=!![];}function handleUncaughtException(_0x2b1b3e){logger[_0x2c06('0x3d')](_0x2b1b3e['message']);process[_0x2c06('0x3e')](0x1);}function handleError(_0x287ea3,_0x2e5dc9){stats['errors'][_0x2c06('0x3f')]({'name':_0x2e5dc9[_0x2c06('0x40')],'message':_0x2e5dc9['message'],'row':_0x287ea3});}function handleQuery(_0x269e9a){logger['info'](_0x269e9a);return db[_0x2c06('0x41')]['query'](_0x269e9a)[_0x2c06('0x42')](function(_0x515f35){results[_0x2c06('0x3f')](_0x515f35);})[_0x2c06('0x43')](function(_0x247065){logger['error'](_0x247065[_0x2c06('0x44')]);});}function main(_0x4a2b18,_0x4a668e,_0x5b4212,_0x55f6fd){logger[_0x2c06('0x3b')](_0x2c06('0x45'),_0x4a2b18,JSON[_0x2c06('0x46')](_0x4a668e));process['send']('start');var _0x3588f7=_0x4a668e['binding'];var _0x55889f=_0x4a668e[_0x2c06('0x47')];var _0x4650ef=path[_0x2c06('0x12')](config[_0x2c06('0x48')],_0x2c06('0x49'),_0x55889f+_0x2c06('0x4a'));var _0x3e4a1d=_[_0x2c06('0x4b')](_0x3588f7)[_0x2c06('0x12')]();logger['info'](_0x2c06('0x4c'),_0x3e4a1d);fs[_0x2c06('0x4d')](_0x4650ef,_0x3e4a1d+'\x0a');Papa[_0x2c06('0x4e')](fs[_0x2c06('0x4f')](_0x4a2b18),{'header':!![],'skipEmptyLines':!![],'step':function(_0x4bf580,_0x59ed47){try{for(var _0x2189f4=0x0,_0x5ac54d=[];_0x2189f4<_0x4bf580[_0x2c06('0x50')]['length'];_0x2189f4++){stats[_0x2c06('0x51')]+=0x1;if(_0x4bf580['errors'][_0x2189f4]){handleError(_0x4bf580['data'][_0x2189f4],_0x4bf580[_0x2c06('0x52')][_0x2189f4]);}else{var _0x20aba7=[];for(var _0x5b78be in _0x3588f7){if(_0x3588f7[_0x2c06('0x53')](_0x5b78be)){if(_0x4bf580[_0x2c06('0x50')][_0x2189f4][_0x3588f7[_0x5b78be]]){var _0x3b15bd=_[_0x2c06('0x54')](_0x4bf580[_0x2c06('0x50')][_0x2189f4][_0x3588f7[_0x5b78be]][_0x2c06('0x55')](/"/g,'\x27'));switch(_0x5b78be){case'scheduledat':var _0x41c894=moment(_0x3b15bd,_0x2c06('0xe'),!![]);if(_0x41c894['isValid']()){_0x5ac54d[_0x2c06('0x3f')]('\x22'+_0x3b15bd+'\x22');}else{_0x20aba7['push'](_0x2c06('0x56'));}break;case _0x2c06('0x1f'):var _0x31d0f2=parseInt(_0x3b15bd);_0x3b15bd=_[_0x2c06('0x57')](_0x31d0f2)||_0x31d0f2<0x0||_0x31d0f2>0x4?_0x55f6fd?0x3:0x2:_0x31d0f2;_0x5ac54d[_0x2c06('0x3f')]('\x22'+_0x3b15bd+'\x22');break;case _0x2c06('0x20'):var _0x5cdb0b=parseInt(_0x3b15bd);if(_[_0x2c06('0x58')](_0x5cdb0b)&&_['includes'](_0x5b4212,_0x5cdb0b)){_0x5ac54d[_0x2c06('0x3f')]('\x22'+_0x5cdb0b+'\x22');}else{_0x20aba7[_0x2c06('0x3f')](_0x2c06('0x59'));}break;case'email':if(isEmail(_0x3b15bd)){_0x5ac54d[_0x2c06('0x3f')]('\x22'+_0x3b15bd+'\x22');}else{_0x20aba7[_0x2c06('0x3f')]('email\x20wrong\x20format');}break;case'dateOfBirth':var _0x2e0646=moment(_0x3b15bd,_0x2c06('0x5a'),!![]);if(_0x2e0646[_0x2c06('0x5b')]()){_0x5ac54d['push']('\x22'+_0x3b15bd+'\x22');}else{_0x20aba7[_0x2c06('0x3f')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x5ac54d['push']('\x22'+_0x3b15bd+'\x22');}}else{switch(_0x5b78be){case'firstName':case'phone':_0x20aba7[_0x2c06('0x3f')](_0x5b78be+_0x2c06('0x5c'));break;default:_0x5ac54d[_0x2c06('0x3f')]('\x22\x22');}}}}if(_0x20aba7[_0x2c06('0x5d')]){handleError(_0x4bf580['data'][_0x2189f4],{'code':_0x2c06('0x5e'),'message':_0x20aba7[_0x2c06('0x12')]()});}else{fs[_0x2c06('0x5f')](_0x4650ef,_0x5ac54d['join']()+'\x0a');}_0x5ac54d=[];}if(!(stats['rows']%0xc8)){socket['emit']('contact:import:'+_0x55889f,stats);stats[_0x2c06('0x52')]=[];}}if(stopped){logger[_0x2c06('0x3b')]('Abort\x20parser');_0x59ed47[_0x2c06('0x60')]();}}catch(_0x2f23cc){handleError(_0x4bf580[_0x2c06('0x50')][_0x2189f4],{'code':_0x2c06('0x61'),'message':_0x2f23cc['message']});logger['error'](_0x2c06('0x62'),_0x2f23cc[_0x2c06('0x44')]);}},'complete':function(){try{var _0x2487d9=[];var _0xa0549b='cm_contacts';if(_0x4a668e[_0x2c06('0x63')]&&_0x4a668e[_0x2c06('0x63')]['length']){_0xa0549b='cm_contacts_'+_0x55889f;_0x2487d9[_0x2c06('0x3f')]('CREATE\x20TABLE\x20'+_0xa0549b+'\x20LIKE\x20cm_contacts;');}var _0x5398d1=util[_0x2c06('0xd')](_0x2c06('0x64'),_0x4650ef,_0xa0549b,_0x3e4a1d,_0x4a668e[_0x2c06('0x1d')],_0x4a668e['CompanyId']||null,NOW,NOW);if(_[_0x2c06('0x65')](_0x3588f7[_0x2c06('0x66')])){_0x5398d1+=_0x2c06('0x67');}_0x2487d9[_0x2c06('0x3f')](_0x5398d1);if(_0x4a668e[_0x2c06('0x63')]&&_0x4a668e[_0x2c06('0x63')][_0x2c06('0x5d')]){_0x2487d9[_0x2c06('0x3f')](insertCmContact(_0x4a668e[_0x2c06('0x1d')],_0xa0549b,_0x4a668e[_0x2c06('0x63')],_0x3588f7));_0x2487d9[_0x2c06('0x3f')](_0x2c06('0x68')+_0xa0549b+';');}_0x2487d9[_0x2c06('0x3f')](insertCmHopper(_0x4a668e[_0x2c06('0x1d')],'voice_queues_has_cm_lists',_0x2c06('0x69'),_0x2c06('0x6a'),_0x55f6fd));_0x2487d9[_0x2c06('0x3f')](insertCmHopperBlack(_0x4a668e['ListId'],'voice_queues_has_cm_blacklists',_0x2c06('0x69'),_0x2c06('0x6a')));_0x2487d9[_0x2c06('0x3f')](insertCmHopper(_0x4a668e[_0x2c06('0x1d')],_0x2c06('0x6b'),_0x2c06('0x6c'),_0x2c06('0x6d'),_0x55f6fd));_0x2487d9[_0x2c06('0x3f')](insertCmHopperBlack(_0x4a668e[_0x2c06('0x1d')],_0x2c06('0x6e'),_0x2c06('0x6c'),_0x2c06('0x6d')));BPromise[_0x2c06('0x6f')](_0x2487d9,handleQuery)[_0x2c06('0x70')](function(_0x553abf){stats[_0x2c06('0x71')]=!![];stats[_0x2c06('0x72')]=_0x4a668e['duplicates']&&_0x4a668e[_0x2c06('0x63')][_0x2c06('0x5d')]?results[0x2][_0x2c06('0x72')]:results[0x0][_0x2c06('0x72')];socket['emit'](_0x2c06('0x73')+_0x55889f,stats);fs['unlink'](_0x4a2b18);fs['unlink'](_0x4650ef);process[_0x2c06('0x3e')](0x0);})['catch'](function(_0x3d756c){logger[_0x2c06('0x3d')](_0x3d756c[_0x2c06('0x44')]);process['exit'](0x1);});}catch(_0x1915c3){logger[_0x2c06('0x3d')](_0x2c06('0x74'),_0x1915c3[_0x2c06('0x44')]);process[_0x2c06('0x3e')](0x1);}},'error':function(_0x5c25f5,_0x1487d9,_0x2d5980,_0x41317f){throw new Error(_0x41317f);}});}function validate(){if(process[_0x2c06('0x75')]&&process['argv'][_0x2c06('0x5d')]<0x4){throw new Error(_0x2c06('0x76'));}var _0x328dda=path[_0x2c06('0x12')](config[_0x2c06('0x48')],_0x2c06('0x49'),process[_0x2c06('0x75')][0x2]);if(!fs[_0x2c06('0x77')](_0x328dda)){throw new Error(_0x2c06('0x78'));}var _0x3603a7={};try{_0x3603a7=JSON[_0x2c06('0x4e')](process[_0x2c06('0x75')][0x3]);if(!_0x3603a7['binding']){throw new Error(_0x2c06('0x79'));}if(!_0x3603a7[_0x2c06('0x7a')][_0x2c06('0x11')]){throw new Error(_0x2c06('0x7b'));}if(!_0x3603a7[_0x2c06('0x7a')][_0x2c06('0x7c')]){throw new Error('firstName\x20is\x20mandatory');}var _0x383b4e=0x0;if(_0x3603a7['binding'][_0x2c06('0x20')]){_0x383b4e=0x1;}if(!_0x3603a7[_0x2c06('0x1d')]){throw new Error(_0x2c06('0x7d'));}}catch(_0x5671f7){throw new Error('body\x20id\x20mandatory');}var _0x3e7b25=[];try{_0x3e7b25=_[_0x2c06('0x7e')](JSON['parse'](process[_0x2c06('0x75')][0x4]),'id');}catch(_0x3dcaf3){logger[_0x2c06('0x3b')](_0x2c06('0x7f'));}main(_0x328dda,_0x3603a7,_0x3e7b25,_0x383b4e);}validate();process['on']('SIGINT',handleStop);process['on'](_0x2c06('0x80'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index b464bb0..a9e0d67 100644 --- a/server/components/integrations/configuration.js +++ b/server/components/integrations/configuration.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb861=['Agent\x20Complete','agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time','talktime','outbound','Called\x20Number','Member\x20Name','membername','Answer\x20Time','answertime','Duration','duration','Billable\x20Time','billableseconds','getSubjects','string','toLowerCase','voice','inbound','push','queue','variable','calleridnum','getDescriptions','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','calleridname','Call\x20To','destexten','Queue','UniqueId','uniqueid','Date','agentcalledAt','Agent\x20Name','destcalleridname','Agent\x20Number','destcalleridnum','***\x20Time\x20Info\x20***','Agent\x20Ring','Agent\x20Connect'];(function(_0x39ea42,_0x3c1f50){var _0x33f5b7=function(_0x5d8e73){while(--_0x5d8e73){_0x39ea42['push'](_0x39ea42['shift']());}};_0x33f5b7(++_0x3c1f50);}(_0xb861,0x170));var _0x1b86=function(_0x1a0ef3,_0x535bbf){_0x1a0ef3=_0x1a0ef3-0x0;var _0x2b86da=_0xb861[_0x1a0ef3];return _0x2b86da;};'use strict';exports[_0x1b86('0x0')]=function(_0x292f64,_0x1ff632){var _0x140386=[{'type':_0x1b86('0x1'),'content':'[xCALLY\x20Ticket]','variableName':null}];switch(_0x292f64[_0x1b86('0x2')]()){case _0x1b86('0x3'):switch(_0x1ff632['toLowerCase']()){case _0x1b86('0x4'):_0x140386[_0x1b86('0x5')]({'type':'variable','content':'','variableName':_0x1b86('0x6')});_0x140386[_0x1b86('0x5')]({'type':_0x1b86('0x7'),'content':'','variableName':_0x1b86('0x8')});break;case'outbound':_0x140386[_0x1b86('0x5')]({'type':'string','content':'Outbound\x20Call','variableName':null});_0x140386[_0x1b86('0x5')]({'type':_0x1b86('0x7'),'content':'','variableName':'destcalleridnum'});break;}}return _0x140386;};exports[_0x1b86('0x9')]=function(_0x3c660f,_0x338aa8){var _0xf5419a=[];switch(_0x3c660f['toLowerCase']()){case _0x1b86('0x3'):switch(_0x338aa8[_0x1b86('0x2')]()){case _0x1b86('0x4'):_0xf5419a=[{'type':_0x1b86('0x1'),'content':_0x1b86('0xa'),'key':null,'keyType':null,'variableName':null},{'type':_0x1b86('0xb'),'content':'','key':_0x1b86('0xc'),'keyType':_0x1b86('0x7'),'variableName':_0x1b86('0x8')},{'type':_0x1b86('0xb'),'content':'','key':'Caller\x20Name','keyType':_0x1b86('0x7'),'variableName':_0x1b86('0xd')},{'type':_0x1b86('0xb'),'content':'','key':_0x1b86('0xe'),'keyType':'variable','variableName':_0x1b86('0xf')},{'type':'keyValue','content':'','key':_0x1b86('0x10'),'keyType':'variable','variableName':_0x1b86('0x6')},{'type':_0x1b86('0xb'),'content':'','key':_0x1b86('0x11'),'keyType':_0x1b86('0x7'),'variableName':_0x1b86('0x12')},{'type':_0x1b86('0xb'),'content':'','key':_0x1b86('0x13'),'keyType':_0x1b86('0x7'),'variableName':_0x1b86('0x14')},{'type':_0x1b86('0x1'),'content':'***\x20Agent\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0x1b86('0xb'),'content':'','key':_0x1b86('0x15'),'keyType':'variable','variableName':_0x1b86('0x16')},{'type':'keyValue','content':'','key':_0x1b86('0x17'),'keyType':_0x1b86('0x7'),'variableName':_0x1b86('0x18')},{'type':_0x1b86('0x1'),'content':_0x1b86('0x19'),'key':null,'keyType':null,'variableName':null},{'type':_0x1b86('0xb'),'content':'','key':_0x1b86('0x1a'),'keyType':_0x1b86('0x7'),'variableName':'agentcalledAt'},{'type':_0x1b86('0xb'),'content':'','key':_0x1b86('0x1b'),'keyType':_0x1b86('0x7'),'variableName':'agentconnectAt'},{'type':_0x1b86('0xb'),'content':'','key':_0x1b86('0x1c'),'keyType':_0x1b86('0x7'),'variableName':_0x1b86('0x1d')},{'type':_0x1b86('0xb'),'content':'','key':_0x1b86('0x1e'),'keyType':_0x1b86('0x7'),'variableName':_0x1b86('0x1f')},{'type':_0x1b86('0xb'),'content':'','key':_0x1b86('0x20'),'keyType':'variable','variableName':_0x1b86('0x21')}];break;case _0x1b86('0x22'):_0xf5419a=[{'type':'string','content':_0x1b86('0xa'),'variableName':null},{'type':_0x1b86('0xb'),'content':'','key':_0x1b86('0x23'),'keyType':'variable','keyContent':'','variableName':_0x1b86('0x18')},{'type':_0x1b86('0xb'),'content':'','key':_0x1b86('0x24'),'keyType':_0x1b86('0x7'),'keyContent':'','variableName':_0x1b86('0x25')},{'type':'keyValue','content':'','key':_0x1b86('0x11'),'keyType':_0x1b86('0x7'),'keyContent':'','variableName':_0x1b86('0x12')},{'type':_0x1b86('0xb'),'content':'','key':_0x1b86('0x13'),'keyType':_0x1b86('0x7'),'keyContent':'','variableName':'starttime'},{'type':_0x1b86('0x1'),'content':_0x1b86('0x19')},{'type':_0x1b86('0xb'),'content':'','key':_0x1b86('0x26'),'keyType':_0x1b86('0x7'),'keyContent':'','variableName':_0x1b86('0x27')},{'type':_0x1b86('0xb'),'content':'','key':'Complete\x20Time','keyType':_0x1b86('0x7'),'keyContent':'','variableName':'endtime'},{'type':_0x1b86('0xb'),'content':'','key':_0x1b86('0x28'),'keyType':'variable','keyContent':'','variableName':_0x1b86('0x29')},{'type':_0x1b86('0xb'),'content':'','key':_0x1b86('0x2a'),'keyType':_0x1b86('0x7'),'keyContent':'','variableName':_0x1b86('0x2b')}];break;}}return _0xf5419a;}; \ No newline at end of file +var _0x54a2=['Date','starttime','answertime','Complete\x20Time','endtime','Duration','duration','Billable\x20Time','getSubjects','string','toLowerCase','voice','inbound','variable','queue','push','getDescriptions','***\x20Call\x20Info\x20***','keyValue','calleridnum','Call\x20To','destexten','uniqueid','***\x20Agent\x20Info\x20***','Agent\x20Name','Agent\x20Number','destcalleridnum','***\x20Time\x20Info\x20***','Agent\x20Ring','agentcalledAt','Agent\x20Connect','agentconnectAt','Agent\x20Complete','agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time','talktime','Called\x20Number','Member\x20Name','membername'];(function(_0x1cb03f,_0x59ba9f){var _0x3596ba=function(_0x1bf0d0){while(--_0x1bf0d0){_0x1cb03f['push'](_0x1cb03f['shift']());}};_0x3596ba(++_0x59ba9f);}(_0x54a2,0xfe));var _0x254a=function(_0x20f76a,_0x2605e2){_0x20f76a=_0x20f76a-0x0;var _0x30016d=_0x54a2[_0x20f76a];return _0x30016d;};'use strict';exports[_0x254a('0x0')]=function(_0x3fa107,_0x28eda7){var _0x3d4dd5=[{'type':_0x254a('0x1'),'content':'[xCALLY\x20Ticket]','variableName':null}];switch(_0x3fa107[_0x254a('0x2')]()){case _0x254a('0x3'):switch(_0x28eda7[_0x254a('0x2')]()){case _0x254a('0x4'):_0x3d4dd5['push']({'type':_0x254a('0x5'),'content':'','variableName':_0x254a('0x6')});_0x3d4dd5['push']({'type':_0x254a('0x5'),'content':'','variableName':'calleridnum'});break;case'outbound':_0x3d4dd5[_0x254a('0x7')]({'type':'string','content':'Outbound\x20Call','variableName':null});_0x3d4dd5[_0x254a('0x7')]({'type':_0x254a('0x5'),'content':'','variableName':'destcalleridnum'});break;}}return _0x3d4dd5;};exports[_0x254a('0x8')]=function(_0x747fde,_0x2e2dd5){var _0x4b8207=[];switch(_0x747fde[_0x254a('0x2')]()){case _0x254a('0x3'):switch(_0x2e2dd5[_0x254a('0x2')]()){case _0x254a('0x4'):_0x4b8207=[{'type':_0x254a('0x1'),'content':_0x254a('0x9'),'key':null,'keyType':null,'variableName':null},{'type':_0x254a('0xa'),'content':'','key':'Caller\x20Number','keyType':_0x254a('0x5'),'variableName':_0x254a('0xb')},{'type':_0x254a('0xa'),'content':'','key':'Caller\x20Name','keyType':'variable','variableName':'calleridname'},{'type':_0x254a('0xa'),'content':'','key':_0x254a('0xc'),'keyType':_0x254a('0x5'),'variableName':_0x254a('0xd')},{'type':_0x254a('0xa'),'content':'','key':'Queue','keyType':_0x254a('0x5'),'variableName':_0x254a('0x6')},{'type':_0x254a('0xa'),'content':'','key':'UniqueId','keyType':_0x254a('0x5'),'variableName':_0x254a('0xe')},{'type':_0x254a('0xa'),'content':'','key':'Date','keyType':_0x254a('0x5'),'variableName':'agentcalledAt'},{'type':_0x254a('0x1'),'content':_0x254a('0xf'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x254a('0x10'),'keyType':_0x254a('0x5'),'variableName':'destcalleridname'},{'type':'keyValue','content':'','key':_0x254a('0x11'),'keyType':_0x254a('0x5'),'variableName':_0x254a('0x12')},{'type':_0x254a('0x1'),'content':_0x254a('0x13'),'key':null,'keyType':null,'variableName':null},{'type':_0x254a('0xa'),'content':'','key':_0x254a('0x14'),'keyType':_0x254a('0x5'),'variableName':_0x254a('0x15')},{'type':'keyValue','content':'','key':_0x254a('0x16'),'keyType':'variable','variableName':_0x254a('0x17')},{'type':'keyValue','content':'','key':_0x254a('0x18'),'keyType':_0x254a('0x5'),'variableName':_0x254a('0x19')},{'type':'keyValue','content':'','key':_0x254a('0x1a'),'keyType':_0x254a('0x5'),'variableName':_0x254a('0x1b')},{'type':_0x254a('0xa'),'content':'','key':_0x254a('0x1c'),'keyType':'variable','variableName':_0x254a('0x1d')}];break;case'outbound':_0x4b8207=[{'type':'string','content':_0x254a('0x9'),'variableName':null},{'type':_0x254a('0xa'),'content':'','key':_0x254a('0x1e'),'keyType':_0x254a('0x5'),'keyContent':'','variableName':_0x254a('0x12')},{'type':_0x254a('0xa'),'content':'','key':_0x254a('0x1f'),'keyType':_0x254a('0x5'),'keyContent':'','variableName':_0x254a('0x20')},{'type':_0x254a('0xa'),'content':'','key':'UniqueId','keyType':_0x254a('0x5'),'keyContent':'','variableName':'uniqueid'},{'type':'keyValue','content':'','key':_0x254a('0x21'),'keyType':_0x254a('0x5'),'keyContent':'','variableName':_0x254a('0x22')},{'type':_0x254a('0x1'),'content':_0x254a('0x13')},{'type':'keyValue','content':'','key':'Answer\x20Time','keyType':'variable','keyContent':'','variableName':_0x254a('0x23')},{'type':_0x254a('0xa'),'content':'','key':_0x254a('0x24'),'keyType':_0x254a('0x5'),'keyContent':'','variableName':_0x254a('0x25')},{'type':'keyValue','content':'','key':_0x254a('0x26'),'keyType':_0x254a('0x5'),'keyContent':'','variableName':_0x254a('0x27')},{'type':_0x254a('0xa'),'content':'','key':_0x254a('0x28'),'keyType':_0x254a('0x5'),'keyContent':'','variableName':'billableseconds'}];break;}}return _0x4b8207;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index b7c3f39..f1bcfeb 100644 --- a/server/components/interaction/service.js +++ b/server/components/interaction/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xce5c=['omit','html','phone','fax','mobile','lodash','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','upperFirst','InteractionId','unknown','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','null','findOne','then','update','info','catch','error','tracked','query','clone','body'];(function(_0x17a3cd,_0x3f4e25){var _0x2e12f2=function(_0x208927){while(--_0x208927){_0x17a3cd['push'](_0x17a3cd['shift']());}};_0x2e12f2(++_0x3f4e25);}(_0xce5c,0xaa));var _0xcce5=function(_0x424357,_0x9ebe3e){_0x424357=_0x424357-0x0;var _0x29c68e=_0xce5c[_0x424357];return _0x29c68e;};'use strict';var _=require(_0xcce5('0x0'));var db=require(_0xcce5('0x1'))['db'];var loggers={'openchannel':require(_0xcce5('0x2'))(_0xcce5('0x3')),'mail':require(_0xcce5('0x2'))(_0xcce5('0x4')),'fax':require('../../config/logger')(_0xcce5('0x5')),'sms':require(_0xcce5('0x2'))(_0xcce5('0x6')),'chat':require(_0xcce5('0x2'))(_0xcce5('0x7')),'whatsapp':require('../../config/logger')(_0xcce5('0x8'))};function getInteractionId(_0x1d5bc4,_0x1baf52,_0x4ee3b2){if(_0x1d5bc4&&_0x1d5bc4[_[_0xcce5('0x9')](_0x4ee3b2)+_0xcce5('0xa')]){return _0x1d5bc4[_[_0xcce5('0x9')](_0x4ee3b2)+_0xcce5('0xa')];}else if(_0x1d5bc4&&_0x1d5bc4['id']){return _0x1d5bc4['id'];}else if(_0x1baf52&&_0x1baf52['id']){return _0x1baf52['id'];}else{return _0xcce5('0xb');}}function log(_0x1faf15,_0x6bfd1f,_0x5eca4b,_0x116b8c,_0xba21e9,_0x5814c1){loggers[_0xba21e9[_0xcce5('0xc')]()][_0x1faf15](_0xcce5('0xd'),_0x5814c1[_0xcce5('0xe')](),_0x6bfd1f?_0x6bfd1f['id']:null,_0x6bfd1f?_0x6bfd1f[_0xcce5('0xf')]:null,_0x6bfd1f?_0x6bfd1f[_0xcce5('0x10')]:null,getInteractionId(_0x5eca4b,_0x116b8c,_0xba21e9),_0x5eca4b?JSON['stringify'](_0x5eca4b):_0xcce5('0x11'));}function updateUser(_0x91a337,_0x29eb4c,_0x119604,_0x8557cf,_0x595b13){db[_['upperFirst'](_0x8557cf)+'Interaction'][_0xcce5('0x12')]({'where':{'id':getInteractionId(_0x29eb4c,_0x119604,_0x8557cf)}})[_0xcce5('0x13')](function(_0xe0f255){if(_0xe0f255){return _0xe0f255[_0xcce5('0x14')]({'UserId':_0x91a337?_0x91a337['id']:null});}})['then'](function(_0x4414d5){if(_0x4414d5){log(_0xcce5('0x15'),_0x91a337,_0x29eb4c,_0x119604,_0x8557cf,_0x595b13);}})[_0xcce5('0x16')](function(){log(_0xcce5('0x17'),_0x91a337,_0x29eb4c,_0x119604,_0x8557cf,_0x595b13);});}exports[_0xcce5('0x18')]=function(_0x7552c9,_0x4325b1){return function(_0x4dd595,_0x24d243,_0x167b49){var _0x47d1c2=_0x4dd595['user'];var _0x20b8cd={};var _0xa6c25a=_0x4dd595[_0xcce5('0x19')];if(_0x20b8cd){_0x20b8cd=_[_0xcce5('0x1a')](_0x4dd595[_0xcce5('0x1b')]);_0x20b8cd=_[_0xcce5('0x1c')](_0x20b8cd,[_0xcce5('0x1b'),_0xcce5('0x1d'),_0xcce5('0x1e'),_0xcce5('0x1f'),_0xcce5('0x20')]);}updateUser(_0x47d1c2,_0x20b8cd,_0xa6c25a,_0x7552c9,_0x4325b1);_0x167b49(null);};}; \ No newline at end of file +var _0x5c3c=['html','phone','mobile','../../mysqldb','../../config/logger','openchannel-interactions','sms-interactions','chat-interactions','whatsapp-interactions','upperFirst','InteractionId','unknown','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','role','null','Interaction','findOne','then','update','info','catch','error','tracked','body'];(function(_0xd0ecf7,_0x1342b7){var _0x32e795=function(_0x34c97d){while(--_0x34c97d){_0xd0ecf7['push'](_0xd0ecf7['shift']());}};_0x32e795(++_0x1342b7);}(_0x5c3c,0x16f));var _0xc5c3=function(_0x3305de,_0x16582f){_0x3305de=_0x3305de-0x0;var _0x3b5a84=_0x5c3c[_0x3305de];return _0x3b5a84;};'use strict';var _=require('lodash');var db=require(_0xc5c3('0x0'))['db'];var loggers={'openchannel':require(_0xc5c3('0x1'))(_0xc5c3('0x2')),'mail':require(_0xc5c3('0x1'))('mail-interactions'),'fax':require(_0xc5c3('0x1'))('fax-interactions'),'sms':require('../../config/logger')(_0xc5c3('0x3')),'chat':require(_0xc5c3('0x1'))(_0xc5c3('0x4')),'whatsapp':require(_0xc5c3('0x1'))(_0xc5c3('0x5'))};function getInteractionId(_0x5c76d6,_0x4dfb2a,_0x47fd9d){if(_0x5c76d6&&_0x5c76d6[_[_0xc5c3('0x6')](_0x47fd9d)+_0xc5c3('0x7')]){return _0x5c76d6[_[_0xc5c3('0x6')](_0x47fd9d)+_0xc5c3('0x7')];}else if(_0x5c76d6&&_0x5c76d6['id']){return _0x5c76d6['id'];}else if(_0x4dfb2a&&_0x4dfb2a['id']){return _0x4dfb2a['id'];}else{return _0xc5c3('0x8');}}function log(_0xc989b4,_0x4cfec9,_0x5d68f6,_0x5049aa,_0x47d616,_0x2bf186){loggers[_0x47d616[_0xc5c3('0x9')]()][_0xc989b4](_0xc5c3('0xa'),_0x2bf186[_0xc5c3('0xb')](),_0x4cfec9?_0x4cfec9['id']:null,_0x4cfec9?_0x4cfec9['name']:null,_0x4cfec9?_0x4cfec9[_0xc5c3('0xc')]:null,getInteractionId(_0x5d68f6,_0x5049aa,_0x47d616),_0x5d68f6?JSON['stringify'](_0x5d68f6):_0xc5c3('0xd'));}function updateUser(_0x30b0c5,_0x4b4011,_0x23ec9b,_0x1b9a11,_0x3ea3f3){db[_[_0xc5c3('0x6')](_0x1b9a11)+_0xc5c3('0xe')][_0xc5c3('0xf')]({'where':{'id':getInteractionId(_0x4b4011,_0x23ec9b,_0x1b9a11)}})[_0xc5c3('0x10')](function(_0x3be4f5){if(_0x3be4f5){return _0x3be4f5[_0xc5c3('0x11')]({'UserId':_0x30b0c5?_0x30b0c5['id']:null});}})[_0xc5c3('0x10')](function(_0x4d55fb){if(_0x4d55fb){log(_0xc5c3('0x12'),_0x30b0c5,_0x4b4011,_0x23ec9b,_0x1b9a11,_0x3ea3f3);}})[_0xc5c3('0x13')](function(){log(_0xc5c3('0x14'),_0x30b0c5,_0x4b4011,_0x23ec9b,_0x1b9a11,_0x3ea3f3);});}exports[_0xc5c3('0x15')]=function(_0x402dc1,_0xb8944){return function(_0x224e80,_0x4b15b0,_0x298e85){var _0x3c78bb=_0x224e80['user'];var _0x59f363={};var _0x24dbf1=_0x224e80['query'];if(_0x59f363){_0x59f363=_['clone'](_0x224e80['body']);_0x59f363=_['omit'](_0x59f363,[_0xc5c3('0x16'),_0xc5c3('0x17'),_0xc5c3('0x18'),'fax',_0xc5c3('0x19')]);}updateUser(_0x3c78bb,_0x59f363,_0x24dbf1,_0x402dc1,_0xb8944);_0x298e85(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index fa67ce7..321634b 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 _0x1654=['hasOwnProperty','use','then','count','status','json','catch','users','User','user','isUserLimit','../../mysqldb','data1','license','split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','base64','final','utf8','parse'];(function(_0x5a1686,_0x56b6c0){var _0x21a488=function(_0x499eed){while(--_0x499eed){_0x5a1686['push'](_0x5a1686['shift']());}};_0x21a488(++_0x56b6c0);}(_0x1654,0x143));var _0x4165=function(_0x172eed,_0x5b3e16){_0x172eed=_0x172eed-0x0;var _0x291654=_0x1654[_0x172eed];return _0x291654;};'use strict';var crypto=require('crypto');var util=require('util');var compose=require('composable-middleware');var db=require(_0x4165('0x0'))['db'];var config=require('../../config/environment');function getValueFromLicense(_0x21d561,_0xd8e63){if(_0x21d561&&_0xd8e63){if(_0xd8e63[_0x4165('0x1')]&&_0xd8e63[_0x4165('0x2')]){var _0x14b3ed=_0xd8e63[_0x4165('0x1')];var _0x1efd62=_0xd8e63[_0x4165('0x2')];var _0x117f57=_0x14b3ed[_0x4165('0x3')]('-')[0x4];var _0x90b39e=_0x14b3ed[_0x4165('0x3')]('-')[0x0];var _0x5ccf92=crypto[_0x4165('0x4')](_0x4165('0x5'),util[_0x4165('0x6')](_0x4165('0x7'),_0x117f57,_0x14b3ed,_0x90b39e));var _0x53a1a7=_0x5ccf92[_0x4165('0x8')](_0x1efd62,_0x4165('0x9'),'utf8');_0x53a1a7+=_0x5ccf92[_0x4165('0xa')](_0x4165('0xb'));var _0x42fe59=JSON[_0x4165('0xc')](_0x53a1a7);return _0x42fe59[_0x4165('0xd')](_0x21d561)?_0x42fe59[_0x21d561]:null;}}return null;}function isLimit(_0x415ed7,_0xf9ee52,_0x4be8c6,_0x4d90fe){var _0xa49004=_0xf9ee52;return compose()[_0x4165('0xe')](function(_0x22ac6a,_0x27381a,_0x42faee){return db['License']['findOne']({'where':{'id':0x1},'raw':!![]})[_0x4165('0xf')](function(_0x727497){var _0x5099c8=getValueFromLicense(_0x415ed7,_0x727497);return _0x5099c8?_0x5099c8:_0xa49004;})['then'](function(_0x168b4d){_0xa49004=_0x168b4d;return _0x4be8c6[_0x4165('0x10')](_0x4d90fe);})[_0x4165('0xf')](function(_0x46fbae){if(_0x46fbae>=_0xa49004){return _0x27381a[_0x4165('0x11')](0x193)[_0x4165('0x12')]({'message':util['format']('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x415ed7)});}_0x42faee();})[_0x4165('0x13')](function(_0x5416da){_0x42faee(_0x5416da);});});}function isUserLimit(){return isLimit(_0x4165('0x14'),0x1,db[_0x4165('0x15')],{'where':{'$or':[{'role':'admin'},{'role':_0x4165('0x16')}]}});}exports[_0x4165('0x17')]=isUserLimit; \ No newline at end of file +var _0xddf5=['final','use','License','findOne','then','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','user','isUserLimit','util','composable-middleware','../../mysqldb','../../config/environment','data1','license','split','createDecipher','format','%s:%s:%s','update','base64','utf8'];(function(_0x5a2b99,_0xb0e62){var _0x46b640=function(_0x29b4f1){while(--_0x29b4f1){_0x5a2b99['push'](_0x5a2b99['shift']());}};_0x46b640(++_0xb0e62);}(_0xddf5,0xdd));var _0x5ddf=function(_0x6affe9,_0x28b831){_0x6affe9=_0x6affe9-0x0;var _0x38a96f=_0xddf5[_0x6affe9];return _0x38a96f;};'use strict';var crypto=require('crypto');var util=require(_0x5ddf('0x0'));var compose=require(_0x5ddf('0x1'));var db=require(_0x5ddf('0x2'))['db'];var config=require(_0x5ddf('0x3'));function getValueFromLicense(_0x987137,_0x26ac29){if(_0x987137&&_0x26ac29){if(_0x26ac29[_0x5ddf('0x4')]&&_0x26ac29['license']){var _0x49143b=_0x26ac29['data1'];var _0x2d54fd=_0x26ac29[_0x5ddf('0x5')];var _0x2eaba7=_0x49143b[_0x5ddf('0x6')]('-')[0x4];var _0x420324=_0x49143b[_0x5ddf('0x6')]('-')[0x0];var _0x25e7ab=crypto[_0x5ddf('0x7')]('aes-256-ctr',util[_0x5ddf('0x8')](_0x5ddf('0x9'),_0x2eaba7,_0x49143b,_0x420324));var _0x451f6c=_0x25e7ab[_0x5ddf('0xa')](_0x2d54fd,_0x5ddf('0xb'),_0x5ddf('0xc'));_0x451f6c+=_0x25e7ab[_0x5ddf('0xd')](_0x5ddf('0xc'));var _0x233522=JSON['parse'](_0x451f6c);return _0x233522['hasOwnProperty'](_0x987137)?_0x233522[_0x987137]:null;}}return null;}function isLimit(_0x5479bb,_0x1614a1,_0x387afc,_0x237c50){var _0x2b2d8c=_0x1614a1;return compose()[_0x5ddf('0xe')](function(_0x1d3cbd,_0x42783b,_0x34bee0){return db[_0x5ddf('0xf')][_0x5ddf('0x10')]({'where':{'id':0x1},'raw':!![]})[_0x5ddf('0x11')](function(_0x1d0ea4){var _0x31e639=getValueFromLicense(_0x5479bb,_0x1d0ea4);return _0x31e639?_0x31e639:_0x2b2d8c;})['then'](function(_0x2cc55){_0x2b2d8c=_0x2cc55;return _0x387afc['count'](_0x237c50);})[_0x5ddf('0x11')](function(_0x1b0fda){if(_0x1b0fda>=_0x2b2d8c){return _0x42783b[_0x5ddf('0x12')](0x193)[_0x5ddf('0x13')]({'message':util[_0x5ddf('0x8')](_0x5ddf('0x14'),_0x5479bb)});}_0x34bee0();})[_0x5ddf('0x15')](function(_0x1fdd87){_0x34bee0(_0x1fdd87);});});}function isUserLimit(){return isLimit(_0x5ddf('0x16'),0x1,db[_0x5ddf('0x17')],{'where':{'$or':[{'role':'admin'},{'role':_0x5ddf('0x18')}]}});}exports[_0x5ddf('0x19')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 574e76c..6f74579 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 _0xffe0=['$lt','>\x20?','<=\x20?','>=\x20?','start','pop','utcOffset','add','seconds','lodash','moment','sqlOperator','[$or]','replace','[$and]','split','slice','shift','forEach','filter','indexOf','conditions','push','buildExpression','DATE','operator','$between','value','includes','$gt','$lte','days','format','YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','=\x20?','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?'];(function(_0x29df9a,_0x42aff3){var _0x3a8e96=function(_0x70fbe7){while(--_0x70fbe7){_0x29df9a['push'](_0x29df9a['shift']());}};_0x3a8e96(++_0x42aff3);}(_0xffe0,0x103));var _0x0ffe=function(_0x4b41a2,_0x35314a){_0x4b41a2=_0x4b41a2-0x0;var _0x55d34f=_0xffe0[_0x4b41a2];return _0x55d34f;};'use strict';var _=require(_0x0ffe('0x0'));var moment=require(_0x0ffe('0x1'));exports['parseSearch']=function(_0x3d9659){var _0x431fe3={'conditions':[]};_0x431fe3[_0x0ffe('0x2')]=_['startsWith'](_0x3d9659,_0x0ffe('0x3'))?'or':'and';var _0x49f23d=_0x3d9659[_0x0ffe('0x4')](_0x0ffe('0x5'),'')[_0x0ffe('0x4')](_0x0ffe('0x3'),'')[_0x0ffe('0x6')]('||');for(var _0x433566=0x0;_0x433566<_0x49f23d['length'];_0x433566++){var _0x2c2470=_0x49f23d[_0x433566]['split'](':=');var _0x5f3d90=_0x2c2470[0x0];var _0x4ac690=_0x2c2470[_0x0ffe('0x7')](0x1);_0x4ac690['forEach'](function(_0x2086be){var _0x40157e=_0x2086be[_0x0ffe('0x6')]('[')[_0x0ffe('0x8')]();var _0x2cc5f9=_0x2086be['match'](/\[(.*?)\]/g);_0x2cc5f9[_0x0ffe('0x9')](function(_0x42964d){var _0x6e3d02=_0x42964d[_0x0ffe('0x6')]('[')[_0x0ffe('0xa')](function(_0x104cd1){return _0x104cd1[_0x0ffe('0xb')](']')>-0x1;})['map'](function(_0x274d7c){return _0x274d7c[_0x0ffe('0x6')](']')[0x0];})[0x0];_0x431fe3[_0x0ffe('0xc')][_0x0ffe('0xd')]({'field':_0x5f3d90,'operator':_0x40157e,'value':_0x6e3d02});});});}return _0x431fe3;};exports[_0x0ffe('0xe')]=function(_0x385978,_0x37c459,_0x4ba6c8){var _0x157bc1={};if(_0x37c459===_0x0ffe('0xf')){if(_0x4ba6c8['operator']==='$eq'){_0x4ba6c8[_0x0ffe('0x10')]=_0x0ffe('0x11');_0x4ba6c8[_0x0ffe('0x12')]+=','+_0x4ba6c8[_0x0ffe('0x12')];}else if(_[_0x0ffe('0x13')]([_0x0ffe('0x14'),_0x0ffe('0x15')],_0x4ba6c8['operator'])){_0x4ba6c8[_0x0ffe('0x12')]=moment(_0x4ba6c8[_0x0ffe('0x12')])['add'](0x1,_0x0ffe('0x16'))[_0x0ffe('0x17')](_0x0ffe('0x18'));}}if(_0x4ba6c8[_0x0ffe('0x19')]){_0x37c459=_0x4ba6c8[_0x0ffe('0x19')];_0x157bc1[_0x0ffe('0x1a')]=_0x0ffe('0x1b')+_0x385978+'.'+_0x4ba6c8[_0x0ffe('0x1c')]+_0x0ffe('0x1d')+_0x4ba6c8[_0x0ffe('0x19')]+')\x20'+parseOperator(_0x4ba6c8[_0x0ffe('0x10')]);}else{_0x157bc1[_0x0ffe('0x1a')]=_0x385978+'.'+_0x4ba6c8[_0x0ffe('0x1c')]+'\x20'+parseOperator(_0x4ba6c8[_0x0ffe('0x10')]);}if(_[_0x0ffe('0x13')]([_0x0ffe('0x1e'),_0x0ffe('0x1f')],_0x4ba6c8['operator']))_0x157bc1['text']='('+_0x157bc1[_0x0ffe('0x1a')]+_0x0ffe('0x20')+_0x385978+'.'+_0x4ba6c8['field']+_0x0ffe('0x21');_0x157bc1[_0x0ffe('0x12')]=parseValue(_0x37c459,_0x4ba6c8['operator'],_0x4ba6c8[_0x0ffe('0x12')]);return _0x157bc1;};function parseOperator(_0x371dbf){var _0x447c5c;switch(_0x371dbf){case _0x0ffe('0x22'):_0x447c5c='IN\x20?';break;case _0x0ffe('0x1f'):_0x447c5c='NOT\x20IN\x20?';break;case'$eq':_0x447c5c=_0x0ffe('0x23');break;case _0x0ffe('0x1e'):_0x447c5c=_0x0ffe('0x24');break;case _0x0ffe('0x25'):case _0x0ffe('0x26'):case _0x0ffe('0x27'):_0x447c5c=_0x0ffe('0x28');break;case _0x0ffe('0x29'):_0x447c5c='<\x20?';break;case _0x0ffe('0x14'):_0x447c5c=_0x0ffe('0x2a');break;case _0x0ffe('0x15'):_0x447c5c=_0x0ffe('0x2b');break;case'$gte':_0x447c5c=_0x0ffe('0x2c');break;case _0x0ffe('0x11'):_0x447c5c='BETWEEN\x20?\x20AND\x20?';break;}return _0x447c5c;}function parseValue(_0x4c3235,_0x4b5e25,_0x47fb67){var _0x343643={'start':undefined,'end':undefined};switch(_0x4b5e25){case _0x0ffe('0x22'):case'$notIn':_0x343643['start']=_0x47fb67[_0x0ffe('0x6')](',');break;case _0x0ffe('0x25'):_0x343643[_0x0ffe('0x2d')]='%'+_0x47fb67+'%';break;case _0x0ffe('0x26'):_0x343643['start']=_0x47fb67+'%';break;case _0x0ffe('0x27'):_0x343643[_0x0ffe('0x2d')]='%'+_0x47fb67;break;case _0x0ffe('0x11'):var _0x2efe2f=_0x47fb67['split'](',');var _0x47fb67=_0x2efe2f[_0x0ffe('0x8')]();var _0x4df6e8=_0x2efe2f[_0x0ffe('0x2e')]();if(_0x4c3235===_0x0ffe('0xf')){_0x47fb67=moment(_0x47fb67)['utcOffset'](0x0,!![])[_0x0ffe('0x17')]();_0x4df6e8=moment(_0x4df6e8)[_0x0ffe('0x2f')](0x0,!![])[_0x0ffe('0x30')](0x17,'hours')[_0x0ffe('0x30')](0x3b,'minutes')['add'](0x3b,_0x0ffe('0x31'))[_0x0ffe('0x17')]();}_0x343643={'start':_0x47fb67,'end':_0x4df6e8};break;default:_0x343643['start']=_0x47fb67;break;}return _0x343643;} \ No newline at end of file +var _0x8b60=['>\x20?','$lte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','shift','pop','DATE','utcOffset','hours','minutes','format','lodash','moment','parseSearch','sqlOperator','[$or]','and','[$and]','replace','split','length','slice','forEach','filter','indexOf','map','conditions','push','buildExpression','operator','$eq','$between','value','includes','$gt','add','days','YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','=\x20?','$substring','$endsWith','LIKE\x20?'];(function(_0x382c73,_0x199cab){var _0x1dd0bf=function(_0x358747){while(--_0x358747){_0x382c73['push'](_0x382c73['shift']());}};_0x1dd0bf(++_0x199cab);}(_0x8b60,0x78));var _0x08b6=function(_0x301760,_0x1626d2){_0x301760=_0x301760-0x0;var _0x2abef5=_0x8b60[_0x301760];return _0x2abef5;};'use strict';var _=require(_0x08b6('0x0'));var moment=require(_0x08b6('0x1'));exports[_0x08b6('0x2')]=function(_0x4c0749){var _0x44c43d={'conditions':[]};_0x44c43d[_0x08b6('0x3')]=_['startsWith'](_0x4c0749,_0x08b6('0x4'))?'or':_0x08b6('0x5');var _0x324c95=_0x4c0749['replace'](_0x08b6('0x6'),'')[_0x08b6('0x7')](_0x08b6('0x4'),'')[_0x08b6('0x8')]('||');for(var _0x52c969=0x0;_0x52c969<_0x324c95[_0x08b6('0x9')];_0x52c969++){var _0x33d1fb=_0x324c95[_0x52c969][_0x08b6('0x8')](':=');var _0x3acc0f=_0x33d1fb[0x0];var _0x547418=_0x33d1fb[_0x08b6('0xa')](0x1);_0x547418[_0x08b6('0xb')](function(_0x2c5c0d){var _0x306561=_0x2c5c0d['split']('[')['shift']();var _0x33eeb1=_0x2c5c0d['match'](/\[(.*?)\]/g);_0x33eeb1[_0x08b6('0xb')](function(_0x35e311){var _0x1c9751=_0x35e311['split']('[')[_0x08b6('0xc')](function(_0x1fc4d8){return _0x1fc4d8[_0x08b6('0xd')](']')>-0x1;})[_0x08b6('0xe')](function(_0x254395){return _0x254395['split'](']')[0x0];})[0x0];_0x44c43d[_0x08b6('0xf')][_0x08b6('0x10')]({'field':_0x3acc0f,'operator':_0x306561,'value':_0x1c9751});});});}return _0x44c43d;};exports[_0x08b6('0x11')]=function(_0x3ee208,_0x51a2a4,_0x174f5f){var _0x4f4517={};if(_0x51a2a4==='DATE'){if(_0x174f5f[_0x08b6('0x12')]===_0x08b6('0x13')){_0x174f5f['operator']=_0x08b6('0x14');_0x174f5f[_0x08b6('0x15')]+=','+_0x174f5f[_0x08b6('0x15')];}else if(_[_0x08b6('0x16')]([_0x08b6('0x17'),'$lte'],_0x174f5f[_0x08b6('0x12')])){_0x174f5f[_0x08b6('0x15')]=moment(_0x174f5f[_0x08b6('0x15')])[_0x08b6('0x18')](0x1,_0x08b6('0x19'))['format'](_0x08b6('0x1a'));}}if(_0x174f5f[_0x08b6('0x1b')]){_0x51a2a4=_0x174f5f['castTo'];_0x4f4517[_0x08b6('0x1c')]=_0x08b6('0x1d')+_0x3ee208+'.'+_0x174f5f[_0x08b6('0x1e')]+_0x08b6('0x1f')+_0x174f5f[_0x08b6('0x1b')]+')\x20'+parseOperator(_0x174f5f['operator']);}else{_0x4f4517[_0x08b6('0x1c')]=_0x3ee208+'.'+_0x174f5f[_0x08b6('0x1e')]+'\x20'+parseOperator(_0x174f5f['operator']);}if(_[_0x08b6('0x16')]([_0x08b6('0x20'),_0x08b6('0x21')],_0x174f5f['operator']))_0x4f4517[_0x08b6('0x1c')]='('+_0x4f4517[_0x08b6('0x1c')]+_0x08b6('0x22')+_0x3ee208+'.'+_0x174f5f[_0x08b6('0x1e')]+_0x08b6('0x23');_0x4f4517[_0x08b6('0x15')]=parseValue(_0x51a2a4,_0x174f5f[_0x08b6('0x12')],_0x174f5f[_0x08b6('0x15')]);return _0x4f4517;};function parseOperator(_0x2b11b0){var _0x2bfff0;switch(_0x2b11b0){case _0x08b6('0x24'):_0x2bfff0=_0x08b6('0x25');break;case _0x08b6('0x21'):_0x2bfff0='NOT\x20IN\x20?';break;case'$eq':_0x2bfff0=_0x08b6('0x26');break;case _0x08b6('0x20'):_0x2bfff0='<>\x20?';break;case _0x08b6('0x27'):case'$startsWith':case _0x08b6('0x28'):_0x2bfff0=_0x08b6('0x29');break;case'$lt':_0x2bfff0='<\x20?';break;case _0x08b6('0x17'):_0x2bfff0=_0x08b6('0x2a');break;case _0x08b6('0x2b'):_0x2bfff0='<=\x20?';break;case'$gte':_0x2bfff0=_0x08b6('0x2c');break;case _0x08b6('0x14'):_0x2bfff0=_0x08b6('0x2d');break;}return _0x2bfff0;}function parseValue(_0x462191,_0x159752,_0x5c4eb0){var _0x5312f8={'start':undefined,'end':undefined};switch(_0x159752){case _0x08b6('0x24'):case _0x08b6('0x21'):_0x5312f8[_0x08b6('0x2e')]=_0x5c4eb0[_0x08b6('0x8')](',');break;case _0x08b6('0x27'):_0x5312f8['start']='%'+_0x5c4eb0+'%';break;case'$startsWith':_0x5312f8[_0x08b6('0x2e')]=_0x5c4eb0+'%';break;case _0x08b6('0x28'):_0x5312f8[_0x08b6('0x2e')]='%'+_0x5c4eb0;break;case _0x08b6('0x14'):var _0x2f7fc5=_0x5c4eb0[_0x08b6('0x8')](',');var _0x5c4eb0=_0x2f7fc5[_0x08b6('0x2f')]();var _0x3a81a0=_0x2f7fc5[_0x08b6('0x30')]();if(_0x462191===_0x08b6('0x31')){_0x5c4eb0=moment(_0x5c4eb0)[_0x08b6('0x32')](0x0,!![])['format']();_0x3a81a0=moment(_0x3a81a0)['utcOffset'](0x0,!![])[_0x08b6('0x18')](0x17,_0x08b6('0x33'))[_0x08b6('0x18')](0x3b,_0x08b6('0x34'))[_0x08b6('0x18')](0x3b,'seconds')[_0x08b6('0x35')]();}_0x5312f8={'start':_0x5c4eb0,'end':_0x3a81a0};break;default:_0x5312f8[_0x08b6('0x2e')]=_0x5c4eb0;break;}return _0x5312f8;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 45d4d91..26d5b6f 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 _0x78e0=['where','pick','filter','columns','merge','VIRTUAL','lower','options','sequelize','moment','keys','includes','parse','fields','split','filters','isEmpty','forOwn','find','type','DATE','isPlainObject','$gte','format','utc','YYYY-MM-DD','subtract','name','sort','map','priority','cast','col','unsigned','DESC','ASC','omit','isArray','length','isObject','isString','unset','hasOwnProperty','isNumeric','match','getFullTextValue','forEach','push','join','getOptions','query','$id','intersection','model','attributes','nolimit','limit','offset'];(function(_0x4d4216,_0x351e90){var _0x8b1e35=function(_0x551f37){while(--_0x551f37){_0x4d4216['push'](_0x4d4216['shift']());}};_0x8b1e35(++_0x351e90);}(_0x78e0,0x12a));var _0x078e=function(_0x3ee771,_0x2b8251){_0x3ee771=_0x3ee771-0x0;var _0x1e99fa=_0x78e0[_0x3ee771];return _0x1e99fa;};'use strict';var _=require('lodash');var sequelize=require(_0x078e('0x0'));var moment=require(_0x078e('0x1'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x2642bb){var _0xba07f9=['ne'];try{var _0x4a324b=JSON['parse'](_0x2642bb);var _0x478d21=Object[_0x078e('0x2')](_0x4a324b)[0x0];return _0xba07f9[_0x078e('0x3')](_0x478d21);}catch(_0x31b808){return![];}}function getOperatorValue(_0x4b7de6){var _0x5420e9=JSON[_0x078e('0x4')](_0x4b7de6);var _0x56eff5=Object[_0x078e('0x2')](_0x5420e9)[0x0];var _0x2b8496=_0x5420e9[_0x56eff5];return{['$'+_0x56eff5]:_0x2b8496};}exports[_0x078e('0x5')]=function(_0x44a46e){var _0x5c6364=null;if(_0x44a46e){_0x5c6364=_0x44a46e[_0x078e('0x6')](',');}return _0x5c6364;};exports[_0x078e('0x7')]=function(_0x2271b3,_0x1ef381){var _0x451752={};if(!_[_0x078e('0x8')](_0x2271b3)){_[_0x078e('0x9')](_0x2271b3,function(_0x59203c,_0x284464){try{if(_0x1ef381){var _0x392829=_[_0x078e('0xa')](_0x1ef381,{'name':_0x284464})||{};if(hasSequelizeOperator(_0x59203c)){_0x451752[_0x284464]=getOperatorValue(_0x59203c);}else if(_0x392829[_0x078e('0xb')]===_0x078e('0xc')&&_[_0x078e('0xd')](_0x59203c)){var _0x4822eb=JSON['parse'](_0x59203c);var _0xb4fc70={'$gte':moment(moment(_0x4822eb[_0x078e('0xe')])[_0x078e('0xf')]('YYYY-MM-DD'))[_0x078e('0x10')]()['format'](),'$lte':moment(moment(_0x4822eb['$lte'])[_0x078e('0xf')](_0x078e('0x11')))['utc']()[_0x078e('0x12')](0x1,'s')[_0x078e('0xf')]()};_0x451752[_0x284464]=_0xb4fc70;}else if(_0x392829[_0x078e('0x13')]==='uniqueid'){_0x451752[_0x284464]=_0x59203c;}else{_0x451752[_0x284464]=_['isArray'](_0x59203c)?_0x59203c:JSON[_0x078e('0x4')](_0x59203c);}}else{_0x451752[_0x284464]=_['isArray'](_0x59203c)?_0x59203c:JSON[_0x078e('0x4')](_0x59203c);}}catch(_0x238ade){_0x451752[_0x284464]=_0x59203c[_0x078e('0x6')](',');}});}return _0x451752;};exports['limit']=function(_0x5c873e){_0x5c873e=parseInt(_0x5c873e,0xa);if(!_0x5c873e||_0x5c873e<0x0){_0x5c873e=LIMIT_VALUE;}return _0x5c873e;};exports['offset']=function(_0x79764b){_0x79764b=parseInt(_0x79764b,0xa);if(!_0x79764b||_0x79764b<0x0){_0x79764b=0x0;}return _0x79764b;};exports[_0x078e('0x14')]=function(_0x217bdc){var _0x5e9567,_0x3b7921=null;if(_0x217bdc){_0x5e9567=_0x217bdc['split'](',');_0x3b7921=_[_0x078e('0x15')](_0x5e9567,function(_0x1894d7){if(_0x1894d7['indexOf']('-')===0x0){return[_0x1894d7===_0x078e('0x16')?sequelize[_0x078e('0x17')](sequelize[_0x078e('0x18')](_0x078e('0x16')),_0x078e('0x19')):_0x1894d7['substr'](0x1),_0x078e('0x1a')];}else{return[_0x1894d7===_0x078e('0x16')?sequelize[_0x078e('0x17')](sequelize[_0x078e('0x18')]('priority'),_0x078e('0x19')):_0x1894d7,_0x078e('0x1b')];}});}return _0x3b7921;};exports[_0x078e('0x1c')]=function(_0x24bfc4,_0x389c67){if(_[_0x078e('0x8')](_0x24bfc4)){return _0x24bfc4;}if(_[_0x078e('0x1d')](_0x24bfc4)){for(var _0x522f8b=0x0;_0x522f8b<_0x24bfc4[_0x078e('0x1e')];_0x522f8b+=0x1){_0x24bfc4[_0x522f8b]=this[_0x078e('0x1c')](_0x24bfc4[_0x522f8b],_0x389c67);}return _0x24bfc4;}if(!_[_0x078e('0x1f')](_0x24bfc4)){return _0x24bfc4;}if(_[_0x078e('0x20')](_0x389c67)){_0x389c67=[_0x389c67];}if(!_[_0x078e('0x1d')](_0x389c67)){return _0x24bfc4;}for(var _0x4d9f2a=0x0;_0x4d9f2a<_0x389c67[_0x078e('0x1e')];_0x4d9f2a+=0x1){_[_0x078e('0x21')](_0x24bfc4,_0x389c67[_0x4d9f2a]);}for(var _0x15f290 in _0x24bfc4){if(_0x24bfc4[_0x078e('0x22')](_0x15f290)){_0x24bfc4[_0x15f290]=this[_0x078e('0x1c')](_0x24bfc4[_0x15f290],_0x389c67);}}return _0x24bfc4;};exports[_0x078e('0x23')]=function(_0x1b625d){return _0x1b625d['match'](RegExp('^[+]?[0-9]*$'))?!![]:![];};exports['isEmail']=function(_0x48f787){return _0x48f787[_0x078e('0x24')](/^\S+@\S+$/)?!![]:![];};exports[_0x078e('0x25')]=function(_0x5c2a86){var _0x23fab8=[];_0x5c2a86[_0x078e('0x6')](/[ ,]+/)[_0x078e('0x26')](function(_0x5cf9ad){_0x5cf9ad=_0x5cf9ad['replace'](/([^:]")"+/g,'$1');_0x5cf9ad='+'+_0x5cf9ad+'*';var _0x4d387c=/[ `!@#$%^&*()_\-?~]/;if(_0x5cf9ad['match'](_0x4d387c))_0x5cf9ad='\x22'+_0x5cf9ad+'\x22';_0x23fab8[_0x078e('0x27')](_0x5cf9ad);});return _0x23fab8[_0x078e('0x28')]('\x20');};exports[_0x078e('0x29')]=function(_0x5e9140,_0x4f6051,_0x4b3c70){var _0x2e775b={},_0x470100={};if(_0x4f6051[_0x078e('0x2a')]['$id']){_0x4f6051[_0x078e('0x2a')]['id']=_0x4f6051['query'][_0x078e('0x2b')];delete _0x4f6051['query'][_0x078e('0x2b')];}_0x2e775b['model']=_[_0x078e('0x15')](_0x5e9140,_0x078e('0x13'));_0x2e775b['query']=_[_0x078e('0x2')](_0x4f6051[_0x078e('0x2a')]);_0x2e775b[_0x078e('0x7')]=_[_0x078e('0x2c')](_0x2e775b[_0x078e('0x2d')],_0x2e775b[_0x078e('0x2a')]);_0x470100[_0x078e('0x2e')]=_['intersection'](_0x2e775b[_0x078e('0x2d')],this[_0x078e('0x5')](_0x4f6051[_0x078e('0x2a')][_0x078e('0x5')]));_0x470100[_0x078e('0x2e')]=_0x470100['attributes'][_0x078e('0x1e')]?_0x470100[_0x078e('0x2e')]:_0x2e775b[_0x078e('0x2d')];if(!_0x4f6051[_0x078e('0x2a')]['hasOwnProperty'](_0x078e('0x2f'))){_0x470100[_0x078e('0x30')]=this['limit'](_0x4f6051['query']['limit']);_0x470100['offset']=this[_0x078e('0x31')](_0x4f6051['query']['offset']);}_0x470100['order']=this['sort'](_0x4f6051['query']['sort']);_0x470100[_0x078e('0x32')]=this['filters'](_[_0x078e('0x33')](_0x4f6051[_0x078e('0x2a')],_0x2e775b[_0x078e('0x7')]),_0x5e9140);if(_0x4f6051[_0x078e('0x2a')]['filter']){var _0x76fa85=_0x5e9140;var _0x5f58d9=_0x4f6051[_0x078e('0x2a')][_0x078e('0x34')];if(typeof _0x5f58d9==='object'){_0x76fa85=_[_0x078e('0x34')](_0x5e9140,function(_0x4b50b9){return _['includes'](_0x5f58d9[_0x078e('0x35')],_0x4b50b9[_0x078e('0x13')]);});_0x5f58d9=_0x5f58d9['value'];}_0x470100['where']=_[_0x078e('0x36')](_0x470100['where'],{'$or':_['map'](_0x76fa85,function(_0x2ddd86){if(_0x2ddd86[_0x078e('0xb')]!==_0x078e('0x37')){if(_0x4b3c70){return sequelize[_0x078e('0x32')](sequelize['fn']('lower',sequelize['col'](_0x2ddd86[_0x078e('0x13')])),{'$like':sequelize['fn'](_0x078e('0x38'),'%'+_0x4f6051[_0x078e('0x2a')][_0x078e('0x34')]+'%')});}else{var _0x540652={};_0x540652[_0x2ddd86[_0x078e('0x13')]]={'$like':'%'+_0x4f6051[_0x078e('0x2a')][_0x078e('0x34')]+'%'};return _0x540652;}}})});}_0x470100=_[_0x078e('0x36')]({},_0x470100,_0x4f6051[_0x078e('0x39')]);return _0x470100;}; \ No newline at end of file +var _0xe3d8=['name','uniqueid','isArray','offset','sort','indexOf','cast','col','priority','unsigned','substr','omit','isObject','isString','length','unset','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','isEmail','getFullTextValue','forEach','push','join','getOptions','query','$id','intersection','model','attributes','nolimit','limit','order','where','pick','filter','object','columns','value','merge','map','lower','options','lodash','sequelize','moment','parse','keys','includes','fields','split','filters','isEmpty','forOwn','type','DATE','isPlainObject','$gte','format','YYYY-MM-DD','utc','subtract'];(function(_0x5da27f,_0x504b76){var _0x54a3fb=function(_0x3b65a8){while(--_0x3b65a8){_0x5da27f['push'](_0x5da27f['shift']());}};_0x54a3fb(++_0x504b76);}(_0xe3d8,0xaa));var _0x8e3d=function(_0x5a6186,_0x32d332){_0x5a6186=_0x5a6186-0x0;var _0x425c33=_0xe3d8[_0x5a6186];return _0x425c33;};'use strict';var _=require(_0x8e3d('0x0'));var sequelize=require(_0x8e3d('0x1'));var moment=require(_0x8e3d('0x2'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x487edb){var _0x351d38=['ne'];try{var _0x270e19=JSON[_0x8e3d('0x3')](_0x487edb);var _0x153351=Object[_0x8e3d('0x4')](_0x270e19)[0x0];return _0x351d38[_0x8e3d('0x5')](_0x153351);}catch(_0x24349f){return![];}}function getOperatorValue(_0x2d5091){var _0x4a946a=JSON[_0x8e3d('0x3')](_0x2d5091);var _0x3ea10a=Object[_0x8e3d('0x4')](_0x4a946a)[0x0];var _0x49510b=_0x4a946a[_0x3ea10a];return{['$'+_0x3ea10a]:_0x49510b};}exports[_0x8e3d('0x6')]=function(_0x589f1c){var _0x571a6f=null;if(_0x589f1c){_0x571a6f=_0x589f1c[_0x8e3d('0x7')](',');}return _0x571a6f;};exports[_0x8e3d('0x8')]=function(_0x4578c4,_0x5e23ba){var _0x13f666={};if(!_[_0x8e3d('0x9')](_0x4578c4)){_[_0x8e3d('0xa')](_0x4578c4,function(_0x3ec791,_0x422a5a){try{if(_0x5e23ba){var _0x2086ad=_['find'](_0x5e23ba,{'name':_0x422a5a})||{};if(hasSequelizeOperator(_0x3ec791)){_0x13f666[_0x422a5a]=getOperatorValue(_0x3ec791);}else if(_0x2086ad[_0x8e3d('0xb')]===_0x8e3d('0xc')&&_[_0x8e3d('0xd')](_0x3ec791)){var _0x452c0f=JSON['parse'](_0x3ec791);var _0x1d2488={'$gte':moment(moment(_0x452c0f[_0x8e3d('0xe')])[_0x8e3d('0xf')](_0x8e3d('0x10')))[_0x8e3d('0x11')]()[_0x8e3d('0xf')](),'$lte':moment(moment(_0x452c0f['$lte'])[_0x8e3d('0xf')](_0x8e3d('0x10')))[_0x8e3d('0x11')]()[_0x8e3d('0x12')](0x1,'s')[_0x8e3d('0xf')]()};_0x13f666[_0x422a5a]=_0x1d2488;}else if(_0x2086ad[_0x8e3d('0x13')]===_0x8e3d('0x14')){_0x13f666[_0x422a5a]=_0x3ec791;}else{_0x13f666[_0x422a5a]=_[_0x8e3d('0x15')](_0x3ec791)?_0x3ec791:JSON['parse'](_0x3ec791);}}else{_0x13f666[_0x422a5a]=_[_0x8e3d('0x15')](_0x3ec791)?_0x3ec791:JSON[_0x8e3d('0x3')](_0x3ec791);}}catch(_0x44d653){_0x13f666[_0x422a5a]=_0x3ec791['split'](',');}});}return _0x13f666;};exports['limit']=function(_0x2de04e){_0x2de04e=parseInt(_0x2de04e,0xa);if(!_0x2de04e||_0x2de04e<0x0){_0x2de04e=LIMIT_VALUE;}return _0x2de04e;};exports[_0x8e3d('0x16')]=function(_0x166cf6){_0x166cf6=parseInt(_0x166cf6,0xa);if(!_0x166cf6||_0x166cf6<0x0){_0x166cf6=0x0;}return _0x166cf6;};exports[_0x8e3d('0x17')]=function(_0x231857){var _0x142789,_0x512473=null;if(_0x231857){_0x142789=_0x231857[_0x8e3d('0x7')](',');_0x512473=_['map'](_0x142789,function(_0x5741d7){if(_0x5741d7[_0x8e3d('0x18')]('-')===0x0){return[_0x5741d7==='priority'?sequelize[_0x8e3d('0x19')](sequelize[_0x8e3d('0x1a')](_0x8e3d('0x1b')),_0x8e3d('0x1c')):_0x5741d7[_0x8e3d('0x1d')](0x1),'DESC'];}else{return[_0x5741d7===_0x8e3d('0x1b')?sequelize[_0x8e3d('0x19')](sequelize[_0x8e3d('0x1a')](_0x8e3d('0x1b')),_0x8e3d('0x1c')):_0x5741d7,'ASC'];}});}return _0x512473;};exports[_0x8e3d('0x1e')]=function(_0xe022f,_0x1991b0){if(_[_0x8e3d('0x9')](_0xe022f)){return _0xe022f;}if(_[_0x8e3d('0x15')](_0xe022f)){for(var _0x363d8a=0x0;_0x363d8a<_0xe022f['length'];_0x363d8a+=0x1){_0xe022f[_0x363d8a]=this['omit'](_0xe022f[_0x363d8a],_0x1991b0);}return _0xe022f;}if(!_[_0x8e3d('0x1f')](_0xe022f)){return _0xe022f;}if(_[_0x8e3d('0x20')](_0x1991b0)){_0x1991b0=[_0x1991b0];}if(!_[_0x8e3d('0x15')](_0x1991b0)){return _0xe022f;}for(var _0x48ad2f=0x0;_0x48ad2f<_0x1991b0[_0x8e3d('0x21')];_0x48ad2f+=0x1){_[_0x8e3d('0x22')](_0xe022f,_0x1991b0[_0x48ad2f]);}for(var _0x3ce5b3 in _0xe022f){if(_0xe022f[_0x8e3d('0x23')](_0x3ce5b3)){_0xe022f[_0x3ce5b3]=this[_0x8e3d('0x1e')](_0xe022f[_0x3ce5b3],_0x1991b0);}}return _0xe022f;};exports[_0x8e3d('0x24')]=function(_0x2126a4){return _0x2126a4[_0x8e3d('0x25')](RegExp(_0x8e3d('0x26')))?!![]:![];};exports[_0x8e3d('0x27')]=function(_0x393fa2){return _0x393fa2[_0x8e3d('0x25')](/^\S+@\S+$/)?!![]:![];};exports[_0x8e3d('0x28')]=function(_0x5a0e5a){var _0x30b960=[];_0x5a0e5a[_0x8e3d('0x7')](/[ ,]+/)[_0x8e3d('0x29')](function(_0x1f65c0){_0x1f65c0=_0x1f65c0['replace'](/([^:]")"+/g,'$1');_0x1f65c0='+'+_0x1f65c0+'*';var _0x361dc0=/[ `!@#$%^&*()_\-?~]/;if(_0x1f65c0[_0x8e3d('0x25')](_0x361dc0))_0x1f65c0='\x22'+_0x1f65c0+'\x22';_0x30b960[_0x8e3d('0x2a')](_0x1f65c0);});return _0x30b960[_0x8e3d('0x2b')]('\x20');};exports[_0x8e3d('0x2c')]=function(_0x1bfc77,_0x5d31a5,_0x178af9){var _0x5192b0={},_0xe92357={};if(_0x5d31a5[_0x8e3d('0x2d')][_0x8e3d('0x2e')]){_0x5d31a5[_0x8e3d('0x2d')]['id']=_0x5d31a5[_0x8e3d('0x2d')][_0x8e3d('0x2e')];delete _0x5d31a5[_0x8e3d('0x2d')][_0x8e3d('0x2e')];}_0x5192b0['model']=_['map'](_0x1bfc77,_0x8e3d('0x13'));_0x5192b0[_0x8e3d('0x2d')]=_[_0x8e3d('0x4')](_0x5d31a5[_0x8e3d('0x2d')]);_0x5192b0[_0x8e3d('0x8')]=_[_0x8e3d('0x2f')](_0x5192b0[_0x8e3d('0x30')],_0x5192b0[_0x8e3d('0x2d')]);_0xe92357[_0x8e3d('0x31')]=_[_0x8e3d('0x2f')](_0x5192b0['model'],this[_0x8e3d('0x6')](_0x5d31a5[_0x8e3d('0x2d')][_0x8e3d('0x6')]));_0xe92357[_0x8e3d('0x31')]=_0xe92357[_0x8e3d('0x31')][_0x8e3d('0x21')]?_0xe92357[_0x8e3d('0x31')]:_0x5192b0[_0x8e3d('0x30')];if(!_0x5d31a5[_0x8e3d('0x2d')][_0x8e3d('0x23')](_0x8e3d('0x32'))){_0xe92357['limit']=this[_0x8e3d('0x33')](_0x5d31a5[_0x8e3d('0x2d')][_0x8e3d('0x33')]);_0xe92357['offset']=this['offset'](_0x5d31a5[_0x8e3d('0x2d')][_0x8e3d('0x16')]);}_0xe92357[_0x8e3d('0x34')]=this['sort'](_0x5d31a5[_0x8e3d('0x2d')][_0x8e3d('0x17')]);_0xe92357[_0x8e3d('0x35')]=this['filters'](_[_0x8e3d('0x36')](_0x5d31a5[_0x8e3d('0x2d')],_0x5192b0[_0x8e3d('0x8')]),_0x1bfc77);if(_0x5d31a5[_0x8e3d('0x2d')][_0x8e3d('0x37')]){var _0x53a099=_0x1bfc77;var _0x39facc=_0x5d31a5[_0x8e3d('0x2d')][_0x8e3d('0x37')];if(typeof _0x39facc===_0x8e3d('0x38')){_0x53a099=_[_0x8e3d('0x37')](_0x1bfc77,function(_0x38248d){return _[_0x8e3d('0x5')](_0x39facc[_0x8e3d('0x39')],_0x38248d['name']);});_0x39facc=_0x39facc[_0x8e3d('0x3a')];}_0xe92357['where']=_[_0x8e3d('0x3b')](_0xe92357[_0x8e3d('0x35')],{'$or':_[_0x8e3d('0x3c')](_0x53a099,function(_0xdfe93d){if(_0xdfe93d['type']!=='VIRTUAL'){if(_0x178af9){return sequelize[_0x8e3d('0x35')](sequelize['fn'](_0x8e3d('0x3d'),sequelize[_0x8e3d('0x1a')](_0xdfe93d['name'])),{'$like':sequelize['fn'](_0x8e3d('0x3d'),'%'+_0x5d31a5[_0x8e3d('0x2d')]['filter']+'%')});}else{var _0x32fa93={};_0x32fa93[_0xdfe93d[_0x8e3d('0x13')]]={'$like':'%'+_0x5d31a5[_0x8e3d('0x2d')][_0x8e3d('0x37')]+'%'};return _0x32fa93;}}})});}_0xe92357=_[_0x8e3d('0x3b')]({},_0xe92357,_0x5d31a5[_0x8e3d('0x3e')]);return _0xe92357;}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 373ee5f..e249742 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6d34=['set','use','json\x20replacer','toISOString','split','static','appPath','views','/server/views','engine','html','renderFile','50mb','json','initialize','express','body-parser','method-override','cookie-parser','errorhandler','path','passport','moment','./environment','../mysqldb','get','join','root','public','development','test'];(function(_0x1f9f40,_0x3e83fe){var _0x2e5022=function(_0x2658cf){while(--_0x2658cf){_0x1f9f40['push'](_0x1f9f40['shift']());}};_0x2e5022(++_0x3e83fe);}(_0x6d34,0x6c));var _0x46d3=function(_0xd2d734,_0x515b4e){_0xd2d734=_0xd2d734-0x0;var _0x5d4dbc=_0x6d34[_0xd2d734];return _0x5d4dbc;};'use strict';var express=require(_0x46d3('0x0'));var favicon=require('serve-favicon');var bodyParser=require(_0x46d3('0x1'));var methodOverride=require(_0x46d3('0x2'));var cookieParser=require(_0x46d3('0x3'));var errorHandler=require(_0x46d3('0x4'));var path=require(_0x46d3('0x5'));var passport=require(_0x46d3('0x6'));var cors=require('cors');var moment=require(_0x46d3('0x7'));var config=require(_0x46d3('0x8'));var db=require(_0x46d3('0x9'))['db'];exports['default']=function(_0x1cab1d){var _0x2680e6=_0x1cab1d[_0x46d3('0xa')]('env');if(_0x2680e6==='production'){_0x1cab1d['set']('appPath',path[_0x46d3('0xb')](config[_0x46d3('0xc')],_0x46d3('0xd')));}if(_0x2680e6===_0x46d3('0xe')||_0x2680e6===_0x46d3('0xf')){_0x1cab1d[_0x46d3('0x10')]('appPath',path['join'](config[_0x46d3('0xc')],'client'));_0x1cab1d[_0x46d3('0x11')](errorHandler());}_0x1cab1d[_0x46d3('0x10')](_0x46d3('0x12'),function(_0x39afa1,_0x3566a7){if(this[_0x39afa1]instanceof Date){_0x3566a7=this[_0x39afa1][_0x46d3('0x13')]()[_0x46d3('0x14')]('.')[0x0]+'Z';}return _0x3566a7;});_0x1cab1d['use'](express[_0x46d3('0x15')](_0x1cab1d[_0x46d3('0xa')](_0x46d3('0x16'))));_0x1cab1d['set'](_0x46d3('0x17'),config['root']+_0x46d3('0x18'));_0x1cab1d[_0x46d3('0x19')](_0x46d3('0x1a'),require('ejs')[_0x46d3('0x1b')]);_0x1cab1d['set']('view\x20engine',_0x46d3('0x1a'));_0x1cab1d[_0x46d3('0x11')](bodyParser['urlencoded']({'limit':_0x46d3('0x1c'),'extended':!![]}));_0x1cab1d[_0x46d3('0x11')](bodyParser[_0x46d3('0x1d')]({'limit':'50mb'}));_0x1cab1d[_0x46d3('0x11')](cors());_0x1cab1d[_0x46d3('0x11')](methodOverride());_0x1cab1d[_0x46d3('0x11')](cookieParser());_0x1cab1d[_0x46d3('0x11')](passport[_0x46d3('0x1e')]());}; \ No newline at end of file +var _0x7f44=['engine','html','urlencoded','50mb','json','express','serve-favicon','method-override','cookie-parser','errorhandler','path','moment','./environment','default','get','env','production','set','join','root','public','test','appPath','use','json\x20replacer','toISOString','split','/server/views'];(function(_0x339b32,_0x365fc2){var _0x4b0e32=function(_0xad0cc6){while(--_0xad0cc6){_0x339b32['push'](_0x339b32['shift']());}};_0x4b0e32(++_0x365fc2);}(_0x7f44,0x75));var _0x47f4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7f44[_0x3dd15e];return _0x231fd0;};'use strict';var express=require(_0x47f4('0x0'));var favicon=require(_0x47f4('0x1'));var bodyParser=require('body-parser');var methodOverride=require(_0x47f4('0x2'));var cookieParser=require(_0x47f4('0x3'));var errorHandler=require(_0x47f4('0x4'));var path=require(_0x47f4('0x5'));var passport=require('passport');var cors=require('cors');var moment=require(_0x47f4('0x6'));var config=require(_0x47f4('0x7'));var db=require('../mysqldb')['db'];exports[_0x47f4('0x8')]=function(_0x5d247d){var _0x173672=_0x5d247d[_0x47f4('0x9')](_0x47f4('0xa'));if(_0x173672===_0x47f4('0xb')){_0x5d247d[_0x47f4('0xc')]('appPath',path[_0x47f4('0xd')](config[_0x47f4('0xe')],_0x47f4('0xf')));}if(_0x173672==='development'||_0x173672===_0x47f4('0x10')){_0x5d247d[_0x47f4('0xc')](_0x47f4('0x11'),path['join'](config[_0x47f4('0xe')],'client'));_0x5d247d[_0x47f4('0x12')](errorHandler());}_0x5d247d[_0x47f4('0xc')](_0x47f4('0x13'),function(_0x7bf209,_0x5846d5){if(this[_0x7bf209]instanceof Date){_0x5846d5=this[_0x7bf209][_0x47f4('0x14')]()[_0x47f4('0x15')]('.')[0x0]+'Z';}return _0x5846d5;});_0x5d247d[_0x47f4('0x12')](express['static'](_0x5d247d[_0x47f4('0x9')](_0x47f4('0x11'))));_0x5d247d['set']('views',config[_0x47f4('0xe')]+_0x47f4('0x16'));_0x5d247d[_0x47f4('0x17')](_0x47f4('0x18'),require('ejs')['renderFile']);_0x5d247d[_0x47f4('0xc')]('view\x20engine',_0x47f4('0x18'));_0x5d247d[_0x47f4('0x12')](bodyParser[_0x47f4('0x19')]({'limit':_0x47f4('0x1a'),'extended':!![]}));_0x5d247d['use'](bodyParser[_0x47f4('0x1b')]({'limit':_0x47f4('0x1a')}));_0x5d247d['use'](cors());_0x5d247d[_0x47f4('0x12')](methodOverride());_0x5d247d['use'](cookieParser());_0x5d247d[_0x47f4('0x12')](passport['initialize']());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index abc2819..11aa972 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 _0x3744=['mac','00:00:00:00:00:00','address','127.0.0.1','cpus','map','model','createHash','md5','digest','hex','getUuid','licenseToken','test','dmidecode\x20--string\x20system-uuid','utf8','hostname','macAddress','ipAddress','update','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','../environment','orderBy','keys','filter','family','head'];(function(_0x3df93e,_0x5af13a){var _0x2d4f2a=function(_0x14c85c){while(--_0x14c85c){_0x3df93e['push'](_0x3df93e['shift']());}};_0x2d4f2a(++_0x5af13a);}(_0x3744,0x1d5));var _0x4374=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x3744[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x4374('0x0'));var os=require('os');var crypto=require(_0x4374('0x1'));var machine=require(_0x4374('0x2'));var exec=require(_0x4374('0x3'))[_0x4374('0x4')];var config=require(_0x4374('0x5'));function getInterfaces(){var _0x1fc475=[];var _0x488350=os['networkInterfaces']();var _0x181f0a=_[_0x4374('0x6')](_[_0x4374('0x7')](_0x488350));for(var _0x16cd7e=0x0;_0x16cd7e<_0x181f0a['length'];_0x16cd7e++){var _0x57c583=_0x488350[_0x181f0a[_0x16cd7e]][_0x4374('0x8')](function(_0x26e4aa){return _0x26e4aa[_0x4374('0x9')]==='IPv4'&&_0x26e4aa['internal']===![];});_0x1fc475=_0x1fc475['concat'](_0x57c583);}return _0x1fc475;}function getFirstInterface(){var _0x30cbaa=_[_0x4374('0xa')](getInterfaces());return{'macAddress':_0x30cbaa&&_0x30cbaa[_0x4374('0xb')]?_0x30cbaa['mac']:_0x4374('0xc'),'ipAddress':_0x30cbaa&&_0x30cbaa[_0x4374('0xd')]?_0x30cbaa[_0x4374('0xd')]:_0x4374('0xe')};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x75a194=_[_0x4374('0x6')](os[_0x4374('0xf')]()[_0x4374('0x10')](function(_0x36f345){return _0x36f345[_0x4374('0x11')];}))['join'](':');return crypto[_0x4374('0x12')](_0x4374('0x13'))['update'](_0x75a194)[_0x4374('0x14')](_0x4374('0x15'));}exports[_0x4374('0x16')]=function(){var _0x4ae190=os['platform']();var _0xc9306a=/[0-9a-f-]{36}/;if(config[_0x4374('0x17')]&&_0xc9306a[_0x4374('0x18')](config[_0x4374('0x17')])){return config[_0x4374('0x17')];}else if(_0x4ae190==='win32'){return exec(_0x4374('0x19'),{'encoding':_0x4374('0x1a')})['replace']('\x0d\x0a','');}else{var _0x5a051e=getFirstInterface();var _0x125054=getCPUhash();var _0x2dd432=_0x125054+'|'+os[_0x4374('0x1b')]()+'|'+_0x5a051e[_0x4374('0x1c')]+'|'+_0x5a051e[_0x4374('0x1d')];var _0x4bd29b=crypto[_0x4374('0x12')]('md5')[_0x4374('0x1e')](_0x2dd432)[_0x4374('0x14')](_0x4374('0x15'));return _0x4bd29b['substring'](0x0,0x8)+'-'+_0x4bd29b['substring'](0x8,0xc)+'-'+_0x4bd29b[_0x4374('0x1f')](0xc,0x10)+'-'+_0x4bd29b[_0x4374('0x1f')](0x10,0x14)+'-'+_0x4bd29b[_0x4374('0x1f')](0x14);}}; \ No newline at end of file +var _0x85a4=['lodash','crypto','bimedia-machine-uuid','child_process','../environment','orderBy','filter','family','IPv4','internal','head','00:00:00:00:00:00','address','127.0.0.1','map','model','md5','update','digest','hex','platform','test','licenseToken','win32','dmidecode\x20--string\x20system-uuid','utf8','hostname','macAddress','ipAddress','createHash','substring'];(function(_0x187e30,_0x561a47){var _0x4ff407=function(_0x48a142){while(--_0x48a142){_0x187e30['push'](_0x187e30['shift']());}};_0x4ff407(++_0x561a47);}(_0x85a4,0x1b2));var _0x485a=function(_0x23279c,_0x2f40af){_0x23279c=_0x23279c-0x0;var _0x599c85=_0x85a4[_0x23279c];return _0x599c85;};'use strict';var _=require(_0x485a('0x0'));var os=require('os');var crypto=require(_0x485a('0x1'));var machine=require(_0x485a('0x2'));var exec=require(_0x485a('0x3'))['execSync'];var config=require(_0x485a('0x4'));function getInterfaces(){var _0x42e470=[];var _0x10c21c=os['networkInterfaces']();var _0x138338=_[_0x485a('0x5')](_['keys'](_0x10c21c));for(var _0x42754d=0x0;_0x42754d<_0x138338['length'];_0x42754d++){var _0xd57b98=_0x10c21c[_0x138338[_0x42754d]][_0x485a('0x6')](function(_0x362bb5){return _0x362bb5[_0x485a('0x7')]===_0x485a('0x8')&&_0x362bb5[_0x485a('0x9')]===![];});_0x42e470=_0x42e470['concat'](_0xd57b98);}return _0x42e470;}function getFirstInterface(){var _0x4ebc15=_[_0x485a('0xa')](getInterfaces());return{'macAddress':_0x4ebc15&&_0x4ebc15['mac']?_0x4ebc15['mac']:_0x485a('0xb'),'ipAddress':_0x4ebc15&&_0x4ebc15[_0x485a('0xc')]?_0x4ebc15[_0x485a('0xc')]:_0x485a('0xd')};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x3636f6=_['orderBy'](os['cpus']()[_0x485a('0xe')](function(_0x337a72){return _0x337a72[_0x485a('0xf')];}))['join'](':');return crypto['createHash'](_0x485a('0x10'))[_0x485a('0x11')](_0x3636f6)[_0x485a('0x12')](_0x485a('0x13'));}exports['getUuid']=function(){var _0x3f1ae4=os[_0x485a('0x14')]();var _0x31a84c=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x31a84c[_0x485a('0x15')](config[_0x485a('0x16')])){return config[_0x485a('0x16')];}else if(_0x3f1ae4===_0x485a('0x17')){return exec(_0x485a('0x18'),{'encoding':_0x485a('0x19')})['replace']('\x0d\x0a','');}else{var _0x42e6de=getFirstInterface();var _0x5ed5da=getCPUhash();var _0x3dc3de=_0x5ed5da+'|'+os[_0x485a('0x1a')]()+'|'+_0x42e6de[_0x485a('0x1b')]+'|'+_0x42e6de[_0x485a('0x1c')];var _0x4dd77d=crypto[_0x485a('0x1d')]('md5')[_0x485a('0x11')](_0x3dc3de)['digest']('hex');return _0x4dd77d['substring'](0x0,0x8)+'-'+_0x4dd77d[_0x485a('0x1e')](0x8,0xc)+'-'+_0x4dd77d[_0x485a('0x1e')](0xc,0x10)+'-'+_0x4dd77d[_0x485a('0x1e')](0x10,0x14)+'-'+_0x4dd77d[_0x485a('0x1e')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 04ecf3d..d700a75 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 _0x0fb5=['../../mysqldb','../../components/encryptor','./hardware','../logger','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','version','GET','then','catch','get','data1','data2','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','update','encryptString','diff','decryptString','days','error','message','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','moment','request-promise','pkginfo'];(function(_0x51e75b,_0x1682d5){var _0x1c9bf6=function(_0x3d7630){while(--_0x3d7630){_0x51e75b['push'](_0x51e75b['shift']());}};_0x1c9bf6(++_0x1682d5);}(_0x0fb5,0x196));var _0x50fb=function(_0x2c446d,_0x44601d){_0x2c446d=_0x2c446d-0x0;var _0x4fce44=_0x0fb5[_0x2c446d];return _0x4fce44;};'use strict';var util=require(_0x50fb('0x0'));var moment=require(_0x50fb('0x1'));var rp=require(_0x50fb('0x2'));var BPromise=require('bluebird');var pkginfo=require(_0x50fb('0x3'))(module,'version');var db=require(_0x50fb('0x4'))['db'];var encryptor=require(_0x50fb('0x5'));var hardware=require(_0x50fb('0x6'));var logger=require(_0x50fb('0x7'))(_0x50fb('0x8'));var HOST=_0x50fb('0x9');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x411b6b){return new BPromise(function(_0xdf6ecd,_0x586bf2){var _0x650f09=util[_0x50fb('0xa')](_0x50fb('0xb'),HOST,_0x411b6b,module['exports'][_0x50fb('0xc')]);if(oldToken){_0x650f09=util[_0x50fb('0xa')]('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x411b6b,module['exports'][_0x50fb('0xc')],oldToken);}var _0x324e46={'uri':_0x650f09,'method':_0x50fb('0xd'),'timeout':0xea60,'json':!![]};return rp(_0x324e46)[_0x50fb('0xe')](function(_0x35403a){_0xdf6ecd(_0x35403a);})[_0x50fb('0xf')](function(_0x18a7ea){_0x586bf2(_0x18a7ea);});});}function manageLicense(_0x4c9a34,_0x4ecfb6){var _0x502618=_0x4ecfb6[_0x50fb('0x10')]({'plain':!![]});if(!isOldTokenSent&&_0x502618[_0x50fb('0x11')]!==_0x4c9a34&&!_0x502618[_0x50fb('0x12')]){oldToken=_0x502618[_0x50fb('0x11')];}httpRequest(_0x4c9a34)['then'](function(_0x2d6c06){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x2d6c06[_0x50fb('0x13')]){isOldTokenSent=![];if(!_0x502618['license']&&_0x502618[_0x50fb('0x8')]!=_0x2d6c06[_0x50fb('0x8')]||_0x502618[_0x50fb('0x8')]&&_0x502618[_0x50fb('0x12')]){logger[_0x50fb('0x14')](_0x50fb('0x15'));}if(_0x502618[_0x50fb('0x8')]&&!_0x502618[_0x50fb('0x12')]&&_0x502618[_0x50fb('0x8')]!=_0x2d6c06[_0x50fb('0x8')]){logger[_0x50fb('0x14')](_0x50fb('0x16'));}if(_0x502618[_0x50fb('0x8')]&&!_0x502618['data2']&&_0x502618['license']==_0x2d6c06[_0x50fb('0x8')]){return _0x4ecfb6;}return _0x4ecfb6['update']({'data1':_0x4c9a34,'data2':null,'license':_0x2d6c06[_0x50fb('0x8')]});}else{if(_0x2d6c06[_0x50fb('0x8')]||_0x502618[_0x50fb('0x8')]){if(!_0x502618[_0x50fb('0x12')]){if(_0x502618['data1']==_0x4c9a34){GRAY_PERIOD_REASON='Disabled';logger[_0x50fb('0x14')](_0x50fb('0x17'));}else{GRAY_PERIOD_REASON=_0x50fb('0x18');logger[_0x50fb('0x14')](_0x50fb('0x19'),_0x502618[_0x50fb('0x11')],_0x4c9a34);}logger[_0x50fb('0x14')]('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON[_0x50fb('0x1a')](),moment()[_0x50fb('0xa')](_0x50fb('0x1b')));return _0x4ecfb6[_0x50fb('0x1c')]({'data2':encryptor[_0x50fb('0x1d')](moment()[_0x50fb('0xa')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()[_0x50fb('0x1e')](encryptor[_0x50fb('0x1f')](_0x502618[_0x50fb('0x12')]),_0x50fb('0x20'))>DAYS){logger['info']('DEMO\x20START\x20AT\x20%s',moment()['format'](_0x50fb('0x1b')));isOldTokenSent=![];return _0x4ecfb6[_0x50fb('0x1c')]({'data1':_0x4c9a34,'data2':null,'license':null});}}}else{if(_0x502618[_0x50fb('0x11')]!=_0x4c9a34){logger[_0x50fb('0x14')](_0x50fb('0x19'),_0x502618[_0x50fb('0x11')],_0x4c9a34);return _0x4ecfb6[_0x50fb('0x1c')]({'data1':_0x4c9a34,'data2':null,'license':null});}}}return _0x4ecfb6;})[_0x50fb('0xe')](function(_0x3b7ac7){_0x4ecfb6=_0x3b7ac7;})[_0x50fb('0xf')](function(_0x209a22){logger[_0x50fb('0x21')](_0x209a22[_0x50fb('0x22')]);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0x50fb('0x23')](),_0x4ecfb6);},TIME);});}function defaultLicense(){var _0x56651c=hardware['getUuid']();if(_0x56651c){return db[_0x50fb('0x24')][_0x50fb('0x25')]({'where':{'id':0x1},'defaults':{'data1':_0x56651c}})[_0x50fb('0x26')](function(_0x5a2da6,_0x33c29e){logger[_0x50fb('0x14')](_0x50fb('0x27'),_0x56651c);manageLicense(_0x56651c,_0x5a2da6);})[_0x50fb('0xf')](function(_0x2847e8){logger[_0x50fb('0x21')](_0x2847e8[_0x50fb('0x22')]);});}}exports[_0x50fb('0x28')]=defaultLicense; \ No newline at end of file +var _0x017f=['data2','active','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','update','Disabled','info','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','YYYY-MM-DD\x20HH:mm','encryptString','diff','decryptString','error','message','finally','getUuid','License','spread','util','moment','request-promise','bluebird','pkginfo','version','../../mysqldb','../../components/encryptor','../logger','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','get','data1'];(function(_0x1f36bb,_0x8af718){var _0xaf97fa=function(_0xeca489){while(--_0xeca489){_0x1f36bb['push'](_0x1f36bb['shift']());}};_0xaf97fa(++_0x8af718);}(_0x017f,0x154));var _0xf017=function(_0x4b0702,_0x14ec4a){_0x4b0702=_0x4b0702-0x0;var _0x4e9358=_0x017f[_0x4b0702];return _0x4e9358;};'use strict';var util=require(_0xf017('0x0'));var moment=require(_0xf017('0x1'));var rp=require(_0xf017('0x2'));var BPromise=require(_0xf017('0x3'));var pkginfo=require(_0xf017('0x4'))(module,_0xf017('0x5'));var db=require(_0xf017('0x6'))['db'];var encryptor=require(_0xf017('0x7'));var hardware=require('./hardware');var logger=require(_0xf017('0x8'))(_0xf017('0x9'));var HOST=_0xf017('0xa');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x5894ed){return new BPromise(function(_0x30481c,_0x25947a){var _0xa27fe3=util[_0xf017('0xb')](_0xf017('0xc'),HOST,_0x5894ed,module[_0xf017('0xd')][_0xf017('0x5')]);if(oldToken){_0xa27fe3=util[_0xf017('0xb')](_0xf017('0xe'),HOST,_0x5894ed,module['exports'][_0xf017('0x5')],oldToken);}var _0x5561e1={'uri':_0xa27fe3,'method':_0xf017('0xf'),'timeout':0xea60,'json':!![]};return rp(_0x5561e1)[_0xf017('0x10')](function(_0x5dce7f){_0x30481c(_0x5dce7f);})[_0xf017('0x11')](function(_0x24a97a){_0x25947a(_0x24a97a);});});}function manageLicense(_0x2fe353,_0x59b0fd){var _0x19c959=_0x59b0fd[_0xf017('0x12')]({'plain':!![]});if(!isOldTokenSent&&_0x19c959[_0xf017('0x13')]!==_0x2fe353&&!_0x19c959[_0xf017('0x14')]){oldToken=_0x19c959[_0xf017('0x13')];}httpRequest(_0x2fe353)[_0xf017('0x10')](function(_0x2fdb43){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x2fdb43[_0xf017('0x15')]){isOldTokenSent=![];if(!_0x19c959['license']&&_0x19c959['license']!=_0x2fdb43[_0xf017('0x9')]||_0x19c959[_0xf017('0x9')]&&_0x19c959['data2']){logger['info'](_0xf017('0x16'));}if(_0x19c959['license']&&!_0x19c959[_0xf017('0x14')]&&_0x19c959[_0xf017('0x9')]!=_0x2fdb43['license']){logger['info']('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x19c959['license']&&!_0x19c959['data2']&&_0x19c959[_0xf017('0x9')]==_0x2fdb43[_0xf017('0x9')]){return _0x59b0fd;}return _0x59b0fd[_0xf017('0x17')]({'data1':_0x2fe353,'data2':null,'license':_0x2fdb43[_0xf017('0x9')]});}else{if(_0x2fdb43[_0xf017('0x9')]||_0x19c959['license']){if(!_0x19c959['data2']){if(_0x19c959[_0xf017('0x13')]==_0x2fe353){GRAY_PERIOD_REASON=_0xf017('0x18');logger[_0xf017('0x19')](_0xf017('0x1a'));}else{GRAY_PERIOD_REASON=_0xf017('0x1b');logger['info'](_0xf017('0x1c'),_0x19c959[_0xf017('0x13')],_0x2fe353);}logger[_0xf017('0x19')](_0xf017('0x1d'),GRAY_PERIOD_REASON['toUpperCase'](),moment()[_0xf017('0xb')](_0xf017('0x1e')));return _0x59b0fd[_0xf017('0x17')]({'data2':encryptor[_0xf017('0x1f')](moment()[_0xf017('0xb')](_0xf017('0x1e')))});}else{if(moment()[_0xf017('0x20')](encryptor[_0xf017('0x21')](_0x19c959[_0xf017('0x14')]),'days')>DAYS){logger[_0xf017('0x19')]('DEMO\x20START\x20AT\x20%s',moment()[_0xf017('0xb')](_0xf017('0x1e')));isOldTokenSent=![];return _0x59b0fd[_0xf017('0x17')]({'data1':_0x2fe353,'data2':null,'license':null});}}}else{if(_0x19c959[_0xf017('0x13')]!=_0x2fe353){logger[_0xf017('0x19')](_0xf017('0x1c'),_0x19c959[_0xf017('0x13')],_0x2fe353);return _0x59b0fd[_0xf017('0x17')]({'data1':_0x2fe353,'data2':null,'license':null});}}}return _0x59b0fd;})[_0xf017('0x10')](function(_0x534444){_0x59b0fd=_0x534444;})['catch'](function(_0x1d82f2){logger[_0xf017('0x22')](_0x1d82f2[_0xf017('0x23')]);})[_0xf017('0x24')](function(){setTimeout(function(){manageLicense(hardware[_0xf017('0x25')](),_0x59b0fd);},TIME);});}function defaultLicense(){var _0x401249=hardware[_0xf017('0x25')]();if(_0x401249){return db[_0xf017('0x26')]['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x401249}})[_0xf017('0x27')](function(_0x445506,_0x3b406e){logger[_0xf017('0x19')]('SERVICE\x20LICENSE\x20STARTED\x20%s',_0x401249);manageLicense(_0x401249,_0x445506);})[_0xf017('0x11')](function(_0x2bf7dd){logger[_0xf017('0x22')](_0x2bf7dd[_0xf017('0x23')]);});}}exports['default']=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 6442036..27fee13 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 _0xa443=['days','grayReason','changed','disabled','User','sequelize','COUNT','role','admin','user','telephone','users','forEach','count','pick','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','moment','bluebird','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','getUuid','License','find','defaults','then','catch','uuid','data1','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','decryptString','format','parse','machineUuid','deadline'];(function(_0x4761e1,_0x237f6f){var _0x5385d5=function(_0x3460fc){while(--_0x3460fc){_0x4761e1['push'](_0x4761e1['shift']());}};_0x5385d5(++_0x237f6f);}(_0xa443,0xea));var _0x3a44=function(_0x2c2781,_0x5f1153){_0x2c2781=_0x2c2781-0x0;var _0x3fe469=_0xa443[_0x2c2781];return _0x3fe469;};'use strict';var util=require(_0x3a44('0x0'));var _=require('lodash');var moment=require(_0x3a44('0x1'));var BPromise=require(_0x3a44('0x2'));var hardware=require(_0x3a44('0x3'));var encryptor=require(_0x3a44('0x4'));var db=require(_0x3a44('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x3a44('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','machineUuid':hardware[_0x3a44('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x3a44('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware[_0x3a44('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x115799){return new BPromise(function(_0x327fa7,_0x1d7294){return db[_0x3a44('0x8')][_0x3a44('0x9')](_[_0x3a44('0xa')](_0x115799,{'raw':!![],'where':{'id':0x1}}))[_0x3a44('0xb')](function(_0x5bb18b){return checkLicense(_0x5bb18b,null);})['then'](function(_0x1ae74f){_0x327fa7(_0x1ae74f);return;})[_0x3a44('0xc')](function(_0x54fd96){_0x1d7294(_0x54fd96);});});}function checkLicense(_0x57b184,_0x5c5f33){if(!_0x57b184){demoLicense[_0x3a44('0xd')]=_0x57b184[_0x3a44('0xe')];return demoLicense;}try{var _0xf796c7=_0x5c5f33||_0x57b184['license'];if(_[_0x3a44('0xf')](_0xf796c7)){throw new Error(_0x3a44('0x10'));}var _0x33caa5=_0x57b184['data1'];var _0x49d75d=_0x57b184[_0x3a44('0x11')];var _0x31b71c=_0x33caa5['split']('-')[0x4];var _0x2a6025=_0x33caa5[_0x3a44('0x12')]('-')[0x0];var _0x129c8c=encryptor[_0x3a44('0x13')](_0xf796c7,util[_0x3a44('0x14')]('%s:%s:%s',_0x31b71c,_0x33caa5,_0x2a6025));var _0x4fb0de=JSON[_0x3a44('0x15')](_0x129c8c);_0x4fb0de['demo']=![];_0x4fb0de[_0x3a44('0xd')]=_0x33caa5;_0x4fb0de[_0x3a44('0x16')]=hardware[_0x3a44('0x7')]();if(_0x49d75d){var _0x31e46d=encryptor[_0x3a44('0x13')](_0x49d75d);_0x4fb0de['gray']=_0x31e46d;_0x4fb0de[_0x3a44('0x17')]=moment(_0x31e46d)['add'](0x7,_0x3a44('0x18'))[_0x3a44('0x14')]();_0x4fb0de[_0x3a44('0x19')]=_0x4fb0de['uuid']!=_0x4fb0de[_0x3a44('0x16')]?_0x3a44('0x1a'):_0x3a44('0x1b');}return _0x4fb0de;}catch(_0x2a10b4){breakingLicense[_0x3a44('0xd')]=_0x57b184[_0x3a44('0xe')];breakingLicense['message']=_0x2a10b4['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x5a85de,_0x294831){getLicense()[_0x3a44('0xb')](function(_0x6f3a6c){return db[_0x3a44('0x1c')]['findAll']({'attributes':['role',[db[_0x3a44('0x1d')]['fn'](_0x3a44('0x1e'),db[_0x3a44('0x1d')]['col']('role')),'count']],'group':_0x3a44('0x1f'),'where':{'role':{'$or':[_0x3a44('0x20'),_0x3a44('0x21'),_0x3a44('0x22')]}},'raw':!![]})[_0x3a44('0xb')](function(_0x313285){var _0x286fb1={'user':_0x6f3a6c[_0x3a44('0x23')]||0x0,'telephone':_0x6f3a6c['telephones']||0x0};_0x313285[_0x3a44('0x24')](function(_0x523438){var _0x3ab991=_0x523438['role']===_0x3a44('0x20')?_0x3a44('0x21'):_0x523438[_0x3a44('0x1f')];_0x286fb1[_0x3ab991]-=_0x523438[_0x3a44('0x25')];if(_0x286fb1[_0x3ab991]<0x0)_0x286fb1[_0x3ab991]=0x0;});_0x5a85de(_0x286fb1);return;});})['catch'](function(_0x43dbed){_0x294831(_0x43dbed);});});}function checkUserLimits(_0x170643){return new BPromise(function(_0x826a18,_0x544c0c){getLimits()['then'](function(_0x16c816){var _0x248c32=_[_0x3a44('0x26')](_[_0x3a44('0x27')](_0x170643,_0x3a44('0x1f')),[_0x3a44('0x20'),_0x3a44('0x21'),_0x3a44('0x22')]);var _0x50f842=(_0x248c32[_0x3a44('0x20')]||0x0)+(_0x248c32[_0x3a44('0x21')]||0x0);var _0x3317f4=_0x248c32['telephone']||0x0;if(_0x50f842>_0x16c816['user'])return _0x544c0c(_0x3a44('0x28'));if(_0x3317f4>_0x16c816[_0x3a44('0x22')])return _0x544c0c(_0x3a44('0x29'));return _0x826a18();})[_0x3a44('0xc')](function(_0x59facf){_0x544c0c(_0x59facf);});});}module[_0x3a44('0x2a')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x01d2=['grayReason','changed','disabled','message','User','findAll','role','sequelize','COUNT','col','count','admin','user','telephone','users','telephones','pick','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment','bluebird','../../components/encryptor','2027-01-01T00:00:00.000Z','getUuid','defaults','then','catch','data1','License\x20key\x20value\x20not\x20found','data2','split','decryptString','%s:%s:%s','parse','uuid','machineUuid','gray','deadline','add','days','format'];(function(_0x51beba,_0x202d19){var _0x167ee0=function(_0x2d5b21){while(--_0x2d5b21){_0x51beba['push'](_0x51beba['shift']());}};_0x167ee0(++_0x202d19);}(_0x01d2,0xf6));var _0x201d=function(_0x43d638,_0x1868d2){_0x43d638=_0x43d638-0x0;var _0x2d06c7=_0x01d2[_0x43d638];return _0x2d06c7;};'use strict';var util=require(_0x201d('0x0'));var _=require(_0x201d('0x1'));var moment=require(_0x201d('0x2'));var BPromise=require(_0x201d('0x3'));var hardware=require('./hardware');var encryptor=require(_0x201d('0x4'));var db=require('../../mysqldb')['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x201d('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','machineUuid':hardware[_0x201d('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x201d('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware[_0x201d('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x412116){return new BPromise(function(_0x5c9238,_0x3223f8){return db['License']['find'](_[_0x201d('0x7')](_0x412116,{'raw':!![],'where':{'id':0x1}}))[_0x201d('0x8')](function(_0x4fed46){return checkLicense(_0x4fed46,null);})[_0x201d('0x8')](function(_0x202a2d){_0x5c9238(_0x202a2d);return;})[_0x201d('0x9')](function(_0x182958){_0x3223f8(_0x182958);});});}function checkLicense(_0x174ece,_0xc68971){if(!_0x174ece){demoLicense['uuid']=_0x174ece[_0x201d('0xa')];return demoLicense;}try{var _0x3cc0d9=_0xc68971||_0x174ece['license'];if(_['isEmpty'](_0x3cc0d9)){throw new Error(_0x201d('0xb'));}var _0x402cb6=_0x174ece['data1'];var _0x5ac600=_0x174ece[_0x201d('0xc')];var _0xe936b1=_0x402cb6[_0x201d('0xd')]('-')[0x4];var _0x218fd4=_0x402cb6[_0x201d('0xd')]('-')[0x0];var _0x41ed85=encryptor[_0x201d('0xe')](_0x3cc0d9,util['format'](_0x201d('0xf'),_0xe936b1,_0x402cb6,_0x218fd4));var _0x18f239=JSON[_0x201d('0x10')](_0x41ed85);_0x18f239['demo']=![];_0x18f239[_0x201d('0x11')]=_0x402cb6;_0x18f239[_0x201d('0x12')]=hardware[_0x201d('0x6')]();if(_0x5ac600){var _0x5e1084=encryptor['decryptString'](_0x5ac600);_0x18f239[_0x201d('0x13')]=_0x5e1084;_0x18f239[_0x201d('0x14')]=moment(_0x5e1084)[_0x201d('0x15')](0x7,_0x201d('0x16'))[_0x201d('0x17')]();_0x18f239[_0x201d('0x18')]=_0x18f239[_0x201d('0x11')]!=_0x18f239[_0x201d('0x12')]?_0x201d('0x19'):_0x201d('0x1a');}return _0x18f239;}catch(_0x39f0e9){breakingLicense['uuid']=_0x174ece['data1'];breakingLicense[_0x201d('0x1b')]=_0x39f0e9['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x16897f,_0x1eaf61){getLicense()[_0x201d('0x8')](function(_0x6ad652){return db[_0x201d('0x1c')][_0x201d('0x1d')]({'attributes':[_0x201d('0x1e'),[db[_0x201d('0x1f')]['fn'](_0x201d('0x20'),db['sequelize'][_0x201d('0x21')]('role')),_0x201d('0x22')]],'group':_0x201d('0x1e'),'where':{'role':{'$or':[_0x201d('0x23'),_0x201d('0x24'),_0x201d('0x25')]}},'raw':!![]})[_0x201d('0x8')](function(_0x590a76){var _0x1d0a34={'user':_0x6ad652[_0x201d('0x26')]||0x0,'telephone':_0x6ad652[_0x201d('0x27')]||0x0};_0x590a76['forEach'](function(_0x5d5e60){var _0x37f2a2=_0x5d5e60[_0x201d('0x1e')]===_0x201d('0x23')?'user':_0x5d5e60['role'];_0x1d0a34[_0x37f2a2]-=_0x5d5e60[_0x201d('0x22')];if(_0x1d0a34[_0x37f2a2]<0x0)_0x1d0a34[_0x37f2a2]=0x0;});_0x16897f(_0x1d0a34);return;});})['catch'](function(_0x324e3d){_0x1eaf61(_0x324e3d);});});}function checkUserLimits(_0x2acd82){return new BPromise(function(_0x437b94,_0x48c995){getLimits()['then'](function(_0x112a10){var _0x2c97ea=_[_0x201d('0x28')](_[_0x201d('0x29')](_0x2acd82,'role'),[_0x201d('0x23'),_0x201d('0x24'),'telephone']);var _0x67ac93=(_0x2c97ea[_0x201d('0x23')]||0x0)+(_0x2c97ea['user']||0x0);var _0x8c4b50=_0x2c97ea['telephone']||0x0;if(_0x67ac93>_0x112a10[_0x201d('0x24')])return _0x48c995(_0x201d('0x2a'));if(_0x8c4b50>_0x112a10[_0x201d('0x25')])return _0x48c995(_0x201d('0x2b'));return _0x437b94();})[_0x201d('0x9')](function(_0xaebeea){_0x48c995(_0xaebeea);});});}module[_0x201d('0x2c')]={'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 9d7b068..17e1c19 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 _0xe511=['app-id','exports','http://localhost:9000'];(function(_0x1e1970,_0x42a940){var _0x2d232c=function(_0x2006f6){while(--_0x2006f6){_0x1e1970['push'](_0x1e1970['shift']());}};_0x2d232c(++_0x42a940);}(_0xe511,0x16f));var _0x1e51=function(_0x1bab70,_0x399ccf){_0x1bab70=_0x1bab70-0x0;var _0x44a639=_0xe511[_0x1bab70];return _0x44a639;};'use strict';module[_0x1e51('0x0')]={'DOMAIN':_0x1e51('0x1'),'SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0x1e51('0x2'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file +var _0x66fa=['http://localhost:9000','app-id','secret','exports'];(function(_0x6cb701,_0x6e56db){var _0x28259e=function(_0x556354){while(--_0x556354){_0x6cb701['push'](_0x6cb701['shift']());}};_0x28259e(++_0x6e56db);}(_0x66fa,0x117));var _0xa66f=function(_0x2302f0,_0x1afef2){_0x2302f0=_0x2302f0-0x0;var _0x23db84=_0x66fa[_0x2302f0];return _0x23db84;};'use strict';module[_0xa66f('0x0')]={'DOMAIN':_0xa66f('0x1'),'SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0xa66f('0x2'),'GOOGLE_SECRET':_0xa66f('0x3'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 72b4249..ca24e10 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x93c2=['[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','exports','Logger','transports','%s-%s','File','info','Console','env','moment','winston','path','INFO','join','log','xcally','format','message','replace','{{{'];(function(_0x38080e,_0x95512d){var _0x4e4c87=function(_0x2be6b3){while(--_0x2be6b3){_0x38080e['push'](_0x38080e['shift']());}};_0x4e4c87(++_0x95512d);}(_0x93c2,0xad));var _0x293c=function(_0x30a69d,_0xa9f8fb){_0x30a69d=_0x30a69d-0x0;var _0x38ded8=_0x93c2[_0x30a69d];return _0x38ded8;};'use strict';var moment=require(_0x293c('0x0'));var winston=require(_0x293c('0x1'));var util=require('util');var path=require(_0x293c('0x2'));var debugLevel=_0x293c('0x3');function filename(_0x3abb24,_0x390668){return path[_0x293c('0x4')]('/var',_0x293c('0x5'),_0x293c('0x6'),util[_0x293c('0x7')]('%s-%s.log',_0x3abb24,_0x390668));}function formatter(_0x147e45,_0x2d7bad){_0x2d7bad['message']=_0x2d7bad[_0x293c('0x8')][_0x293c('0x9')](/@@{/g,_0x293c('0xa'))[_0x293c('0x9')](/}@@/g,'}}}')[_0x293c('0x9')](/@{/g,'{{')[_0x293c('0x9')](/}@/g,'}}');return util['format'](_0x293c('0xb'),moment()[_0x293c('0x7')](_0x293c('0xc')),_0x2d7bad[_0x293c('0xd')][_0x293c('0xe')](),_0x147e45,_0x2d7bad['message']);}module[_0x293c('0xf')]=function(_0xecc051){return new winston[(_0x293c('0x10'))]({'transports':[new winston[(_0x293c('0x11'))]['File']({'name':util[_0x293c('0x7')](_0x293c('0x12'),_0xecc051,'error'),'filename':filename(_0xecc051,'error'),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x3f98b6){return formatter(_0xecc051,_0x3f98b6);}}),new winston[(_0x293c('0x11'))][(_0x293c('0x13'))]({'name':util['format'](_0x293c('0x12'),_0xecc051,_0x293c('0x14')),'filename':filename(_0xecc051,'info'),'level':_0x293c('0x14'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0xb2dde5){return formatter(_0xecc051,_0xb2dde5);}}),new winston[(_0x293c('0x11'))][(_0x293c('0x15'))]({'level':process[_0x293c('0x16')]['debugLevel']||debugLevel,'json':![],'formatter':function(_0x492794){return formatter(_0xecc051,_0x492794);}})]});}; \ No newline at end of file +var _0x44bf=['%s-%s','info','Console','debugLevel','moment','util','path','INFO','join','/var','xcally','format','%s-%s.log','message','}}}','replace','YYYY-MM-DD\x20HH:mm:ss','level','exports','transports','File','error'];(function(_0x42268e,_0x145d9d){var _0x55602a=function(_0x1d53bf){while(--_0x1d53bf){_0x42268e['push'](_0x42268e['shift']());}};_0x55602a(++_0x145d9d);}(_0x44bf,0x88));var _0xf44b=function(_0x56cce6,_0x2895f6){_0x56cce6=_0x56cce6-0x0;var _0x4e45e8=_0x44bf[_0x56cce6];return _0x4e45e8;};'use strict';var moment=require(_0xf44b('0x0'));var winston=require('winston');var util=require(_0xf44b('0x1'));var path=require(_0xf44b('0x2'));var debugLevel=_0xf44b('0x3');function filename(_0x26283c,_0x3e6002){return path[_0xf44b('0x4')](_0xf44b('0x5'),'log',_0xf44b('0x6'),util[_0xf44b('0x7')](_0xf44b('0x8'),_0x26283c,_0x3e6002));}function formatter(_0x12b98f,_0x949e94){_0x949e94[_0xf44b('0x9')]=_0x949e94[_0xf44b('0x9')]['replace'](/@@{/g,'{{{')['replace'](/}@@/g,_0xf44b('0xa'))[_0xf44b('0xb')](/@{/g,'{{')[_0xf44b('0xb')](/}@/g,'}}');return util[_0xf44b('0x7')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()['format'](_0xf44b('0xc')),_0x949e94[_0xf44b('0xd')]['toUpperCase'](),_0x12b98f,_0x949e94[_0xf44b('0x9')]);}module[_0xf44b('0xe')]=function(_0x63a8fb){return new winston['Logger']({'transports':[new winston[(_0xf44b('0xf'))][(_0xf44b('0x10'))]({'name':util[_0xf44b('0x7')]('%s-%s',_0x63a8fb,_0xf44b('0x11')),'filename':filename(_0x63a8fb,'error'),'level':_0xf44b('0x11'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x26fd96){return formatter(_0x63a8fb,_0x26fd96);}}),new winston[(_0xf44b('0xf'))][(_0xf44b('0x10'))]({'name':util[_0xf44b('0x7')](_0xf44b('0x12'),_0x63a8fb,_0xf44b('0x13')),'filename':filename(_0x63a8fb,_0xf44b('0x13')),'level':_0xf44b('0x13'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x5769da){return formatter(_0x63a8fb,_0x5769da);}}),new winston[(_0xf44b('0xf'))][(_0xf44b('0x14'))]({'level':process['env'][_0xf44b('0x15')]||debugLevel,'json':![],'formatter':function(_0x24cae0){return formatter(_0x63a8fb,_0x24cae0);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 1c2b1e2..930a225 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 _0x10c1=['express','join','ami','../../services/agi/index.js','email','routing','xdr','exports','path'];(function(_0x6a9229,_0x302284){var _0x41d3eb=function(_0x5cc4e0){while(--_0x5cc4e0){_0x6a9229['push'](_0x6a9229['shift']());}};_0x41d3eb(++_0x302284);}(_0x10c1,0x19d));var _0x110c=function(_0x4756a3,_0xa452c){_0x4756a3=_0x4756a3-0x0;var _0x296254=_0x10c1[_0x4756a3];return _0x296254;};'use strict';var path=require(_0x110c('0x0'));var os=require('os');var config={'apps':[{'name':_0x110c('0x1'),'script':path[_0x110c('0x2')](__dirname,'../../services/express/index.js')},{'name':_0x110c('0x3'),'script':path[_0x110c('0x2')](__dirname,'../../services/ami/index.js')},{'name':'agi','script':path[_0x110c('0x2')](__dirname,_0x110c('0x4'))},{'name':_0x110c('0x5'),'script':path[_0x110c('0x2')](__dirname,'../../services/email/index.js')},{'name':_0x110c('0x6'),'script':path[_0x110c('0x2')](__dirname,'../../services/routing/index.js')},{'name':_0x110c('0x7'),'script':path[_0x110c('0x2')](__dirname,'../../services/xdr/index.js')}]};module[_0x110c('0x8')]=config; \ No newline at end of file +var _0x6157=['ami','join','../../services/ami/index.js','email','routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','path','express','../../services/express/index.js'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x6157,0x110));var _0x7615=function(_0xb74591,_0x521d33){_0xb74591=_0xb74591-0x0;var _0xd932f0=_0x6157[_0xb74591];return _0xd932f0;};'use strict';var path=require(_0x7615('0x0'));var os=require('os');var config={'apps':[{'name':_0x7615('0x1'),'script':path['join'](__dirname,_0x7615('0x2'))},{'name':_0x7615('0x3'),'script':path[_0x7615('0x4')](__dirname,_0x7615('0x5'))},{'name':'agi','script':path[_0x7615('0x4')](__dirname,'../../services/agi/index.js')},{'name':_0x7615('0x6'),'script':path[_0x7615('0x4')](__dirname,'../../services/email/index.js')},{'name':_0x7615('0x7'),'script':path['join'](__dirname,_0x7615('0x8'))},{'name':_0x7615('0x9'),'script':path['join'](__dirname,_0x7615('0xa'))}]};module['exports']=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index a77545d..177b59c 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 _0x0755=['pm2','./config','connect','connected','start','then','disconnect','stop','restart','list','describe','delete','dump','saved'];(function(_0x53db99,_0x37ba31){var _0x4be572=function(_0x14d5b0){while(--_0x14d5b0){_0x53db99['push'](_0x53db99['shift']());}};_0x4be572(++_0x37ba31);}(_0x0755,0x196));var _0x5075=function(_0x1c0928,_0x3a5f09){_0x1c0928=_0x1c0928-0x0;var _0x557de8=_0x0755[_0x1c0928];return _0x557de8;};'use strict';var pm2=require(_0x5075('0x0'));var BPromise=require('bluebird');var config=require(_0x5075('0x1'));function connect(){return new BPromise(function(_0x5c8812,_0x431de8){return pm2[_0x5075('0x2')](function(_0x3a73b1){if(_0x3a73b1){return _0x431de8(_0x3a73b1);}return _0x5c8812(_0x5075('0x3'));});});};exports[_0x5075('0x4')]=function(_0x363f07){return connect()[_0x5075('0x5')](function(){return new BPromise(function(_0x41edfb,_0x30776c){return pm2['start'](_0x363f07,function(_0x10542d,_0x46dfb4){if(_0x10542d){return _0x30776c(_0x10542d);}pm2[_0x5075('0x6')]();return _0x41edfb(_0x46dfb4);});});});};exports['stop']=function(_0x2527fd){return connect()[_0x5075('0x5')](function(){return new BPromise(function(_0x12f3a4,_0xee426){return pm2[_0x5075('0x7')](_0x2527fd,function(_0x116a16,_0x2d6fb5){if(_0x116a16){return _0xee426(_0x116a16);}pm2[_0x5075('0x6')]();return _0x12f3a4(_0x2d6fb5);});});});};exports[_0x5075('0x8')]=function(_0x476fa0){return connect()[_0x5075('0x5')](function(){return new BPromise(function(_0x2bdbfd,_0x55ffb5){return pm2['restart'](_0x476fa0,function(_0x1d1cbd,_0x1a0009){if(_0x1d1cbd){return _0x55ffb5(_0x1d1cbd);}pm2['disconnect']();return _0x2bdbfd(_0x1a0009);});});});};exports['list']=function(){return connect()['then'](function(){return new BPromise(function(_0xbb66f9,_0x2cbada){return pm2[_0x5075('0x9')](function(_0x45f713,_0x4e61d0){if(_0x45f713){return _0x2cbada(_0x45f713);}pm2[_0x5075('0x6')]();return _0xbb66f9(_0x4e61d0);});});});};exports[_0x5075('0xa')]=function(_0x436101){return connect()[_0x5075('0x5')](function(){return new BPromise(function(_0x3b5642,_0x58c77e){return pm2['describe'](_0x436101,function(_0x36ff67,_0x5a847a){if(_0x36ff67){return _0x58c77e(_0x36ff67);}pm2[_0x5075('0x6')]();return _0x3b5642(_0x5a847a);});});});};exports[_0x5075('0xb')]=function(_0x370b05){return connect()['then'](function(){return new BPromise(function(_0x52c683,_0x23bae6){return pm2[_0x5075('0xb')](_0x370b05,function(_0x6d72b,_0x2c90be){if(_0x6d72b){return _0x23bae6(_0x6d72b);}pm2[_0x5075('0x6')]();return _0x52c683(_0x2c90be);});});});};exports['dump']=function(){return connect()[_0x5075('0x5')](function(){return new BPromise(function(_0x27deed,_0x1a41b6){return pm2[_0x5075('0xc')](function(_0x5d0174){if(_0x5d0174){return _0x1a41b6(_0x5d0174);}return _0x27deed(_0x5075('0xd'));});});});}; \ No newline at end of file +var _0xa6de=['connected','start','disconnect','stop','then','restart','list','describe','delete','dump','saved','pm2','bluebird','./config','connect'];(function(_0x48e532,_0x49672b){var _0x17403f=function(_0x57b455){while(--_0x57b455){_0x48e532['push'](_0x48e532['shift']());}};_0x17403f(++_0x49672b);}(_0xa6de,0x128));var _0xea6d=function(_0x23a959,_0x5c39dd){_0x23a959=_0x23a959-0x0;var _0x2b73dd=_0xa6de[_0x23a959];return _0x2b73dd;};'use strict';var pm2=require(_0xea6d('0x0'));var BPromise=require(_0xea6d('0x1'));var config=require(_0xea6d('0x2'));function connect(){return new BPromise(function(_0x361051,_0x17c572){return pm2[_0xea6d('0x3')](function(_0x2f9151){if(_0x2f9151){return _0x17c572(_0x2f9151);}return _0x361051(_0xea6d('0x4'));});});};exports[_0xea6d('0x5')]=function(_0xc5d72){return connect()['then'](function(){return new BPromise(function(_0x1d840d,_0x3ca39b){return pm2[_0xea6d('0x5')](_0xc5d72,function(_0x56bd2a,_0x481285){if(_0x56bd2a){return _0x3ca39b(_0x56bd2a);}pm2[_0xea6d('0x6')]();return _0x1d840d(_0x481285);});});});};exports[_0xea6d('0x7')]=function(_0x24fbaf){return connect()[_0xea6d('0x8')](function(){return new BPromise(function(_0xda1922,_0x542db2){return pm2[_0xea6d('0x7')](_0x24fbaf,function(_0x1a6afa,_0x20e6de){if(_0x1a6afa){return _0x542db2(_0x1a6afa);}pm2[_0xea6d('0x6')]();return _0xda1922(_0x20e6de);});});});};exports[_0xea6d('0x9')]=function(_0x1a8afa){return connect()[_0xea6d('0x8')](function(){return new BPromise(function(_0x21f22b,_0x3add06){return pm2[_0xea6d('0x9')](_0x1a8afa,function(_0x262490,_0x2b4758){if(_0x262490){return _0x3add06(_0x262490);}pm2['disconnect']();return _0x21f22b(_0x2b4758);});});});};exports[_0xea6d('0xa')]=function(){return connect()['then'](function(){return new BPromise(function(_0x3fb50b,_0x549abf){return pm2[_0xea6d('0xa')](function(_0x164dde,_0x3a9531){if(_0x164dde){return _0x549abf(_0x164dde);}pm2[_0xea6d('0x6')]();return _0x3fb50b(_0x3a9531);});});});};exports[_0xea6d('0xb')]=function(_0x2be37e){return connect()[_0xea6d('0x8')](function(){return new BPromise(function(_0x59725f,_0x1d178f){return pm2[_0xea6d('0xb')](_0x2be37e,function(_0x3c79d8,_0x4e2bfa){if(_0x3c79d8){return _0x1d178f(_0x3c79d8);}pm2[_0xea6d('0x6')]();return _0x59725f(_0x4e2bfa);});});});};exports[_0xea6d('0xc')]=function(_0x327739){return connect()['then'](function(){return new BPromise(function(_0x4ffa2,_0x2e2444){return pm2[_0xea6d('0xc')](_0x327739,function(_0x5aed5f,_0x1ba840){if(_0x5aed5f){return _0x2e2444(_0x5aed5f);}pm2['disconnect']();return _0x4ffa2(_0x1ba840);});});});};exports[_0xea6d('0xd')]=function(){return connect()[_0xea6d('0x8')](function(){return new BPromise(function(_0x107383,_0x1e5f4d){return pm2[_0xea6d('0xd')](function(_0x5229de){if(_0x5229de){return _0x1e5f4d(_0x5229de);}return _0x107383(_0xea6d('0xe'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 2ae1c1f..42c1f61 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 _0x92d6=['util','../../config/environment','../../mysqldb','../logger','redis','defaults','localhost','Setting','then','chatTimeout','ChatInteraction','findAll','lastMsgAt','subtract','minutes','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','chatInteraction:update','catch','[CHAT]\x20Error\x20closing\x20interactions','inspect','moment','ioredis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x92d6,0x1a2));var _0x692d=function(_0x5a181b,_0x1a3a7b){_0x5a181b=_0x5a181b-0x0;var _0x11e304=_0x92d6[_0x5a181b];return _0x11e304;};'use strict';var _=require('lodash');var moment=require(_0x692d('0x0'));var Redis=require(_0x692d('0x1'));var util=require(_0x692d('0x2'));var config=require(_0x692d('0x3'));var db=require(_0x692d('0x4'))['db'];var logger=require(_0x692d('0x5'))('schedule');config[_0x692d('0x6')]=_[_0x692d('0x7')](config[_0x692d('0x6')],{'host':_0x692d('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x692d('0x6')]));function closeInteractions(){var _0x489d13=0x0;var _0x454b17=[];return db[_0x692d('0x9')]['find']({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0x692d('0xa')](function(_0x39eeb6){_0x489d13=_0x39eeb6[_0x692d('0xb')];if(_0x489d13){return db[_0x692d('0xc')][_0x692d('0xd')]({'raw':!![],'attributes':['id',_0x692d('0xe')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x692d('0xf')](_0x39eeb6['chatTimeout'],_0x692d('0x10'))}}});}else{return[];}})['then'](function(_0x3ca325){if(_0x3ca325&&_0x3ca325[_0x692d('0x11')]){_0x454b17=_[_0x692d('0x12')](_0x3ca325||[],'id');logger[_0x692d('0x13')](_0x692d('0x14'),_0x454b17[_0x692d('0x15')]());return db[_0x692d('0xc')]['update']({'closeReason':_0x692d('0x16'),'disposition':_0x692d('0x17'),'closed':!![],'closedAt':moment()[_0x692d('0x18')](_0x692d('0x19'))},{'where':{'id':_0x454b17}});}})[_0x692d('0xa')](function(){if(_0x454b17&&_0x454b17['length']){logger[_0x692d('0x13')]('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0x454b17[_0x692d('0x15')]());for(var _0x1b386f=0x0;_0x1b386f<_0x454b17[_0x692d('0x11')];_0x1b386f++){io['emit'](_0x692d('0x1a'),{'id':_0x454b17[_0x1b386f],'closed':!![]});}}})[_0x692d('0x1b')](function(_0x51bd84){logger['error'](_0x692d('0x1c'),_0x51bd84?util[_0x692d('0x1d')](_0x51bd84,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xdbe0=['ChatInteraction','update','system','timeout','YYYY-MM-DD\x20HH:mm:ss','length','info','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','../../config/environment','../logger','defaults','redis','socket.io-emitter','Setting','find','chatTimeout','then','findAll','lastMsgAt','minutes','map'];(function(_0x58ad48,_0x4a0e8f){var _0x4025aa=function(_0x526886){while(--_0x526886){_0x58ad48['push'](_0x58ad48['shift']());}};_0x4025aa(++_0x4a0e8f);}(_0xdbe0,0x9e));var _0x0dbe=function(_0x5e257f,_0x84f44c){_0x5e257f=_0x5e257f-0x0;var _0x14273b=_0xdbe0[_0x5e257f];return _0x14273b;};'use strict';var _=require(_0x0dbe('0x0'));var moment=require(_0x0dbe('0x1'));var Redis=require(_0x0dbe('0x2'));var util=require('util');var config=require(_0x0dbe('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0x0dbe('0x4'))('schedule');config['redis']=_[_0x0dbe('0x5')](config[_0x0dbe('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x0dbe('0x7'))(new Redis(config[_0x0dbe('0x6')]));function closeInteractions(){var _0x9846bd=0x0;var _0x34773f=[];return db[_0x0dbe('0x8')][_0x0dbe('0x9')]({'raw':!![],'attributes':['id',_0x0dbe('0xa')],'where':{'id':0x1}})[_0x0dbe('0xb')](function(_0x294880){_0x9846bd=_0x294880[_0x0dbe('0xa')];if(_0x9846bd){return db['ChatInteraction'][_0x0dbe('0xc')]({'raw':!![],'attributes':['id',_0x0dbe('0xd')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x294880[_0x0dbe('0xa')],_0x0dbe('0xe'))}}});}else{return[];}})[_0x0dbe('0xb')](function(_0x473bb0){if(_0x473bb0&&_0x473bb0['length']){_0x34773f=_[_0x0dbe('0xf')](_0x473bb0||[],'id');logger['info']('[CHAT]\x20Interactions\x20to\x20close:',_0x34773f['join']());return db[_0x0dbe('0x10')][_0x0dbe('0x11')]({'closeReason':_0x0dbe('0x12'),'disposition':_0x0dbe('0x13'),'closed':!![],'closedAt':moment()['format'](_0x0dbe('0x14'))},{'where':{'id':_0x34773f}});}})[_0x0dbe('0xb')](function(){if(_0x34773f&&_0x34773f[_0x0dbe('0x15')]){logger[_0x0dbe('0x16')](_0x0dbe('0x17'),_0x34773f['join']());for(var _0x723f4f=0x0;_0x723f4f<_0x34773f[_0x0dbe('0x15')];_0x723f4f++){io['emit']('chatInteraction:update',{'id':_0x34773f[_0x723f4f],'closed':!![]});}}})[_0x0dbe('0x18')](function(_0x16adda){logger[_0x0dbe('0x19')](_0x0dbe('0x1a'),_0x16adda?util[_0x0dbe('0x1b')](_0x16adda,{'showHidden':![],'depth':null}):'');});}exports[_0x0dbe('0x1c')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 4408410..7c5a734 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 _0x1f19=['existsSync','Sent','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','status','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error','error\x20mail','email\x20sent','catch','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit','subtractUnit\x20null\x20or\x20undefined','subtract','exec\x20defaul\x20report\x20id:%s','runReport','exec\x20custom\x20report\x20id:%s','CustomReportId','no\x20report\x20id','Schedule','findAll','MailServerOut','keys','map','keyBy','toString','difference','length','exists','stop','deleteJob','delete\x20cron','toRun','index','resolve','run\x20job','cron','isBetween','startAt','endAt','add','start','add\x20cron','stop\x20cron','active','update','run','util','path','lodash','cron-job-manager','../logger','schedule','../../api/analyticCustomReport/analyticCustomReport.controller','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','Smtp','service','host','port','secure','authentication','auth','pass','\x22%s\x22\x20<%s>','user','bcc','format','Report\x20%s\x20last\x20%s\x20%s','name','subtractNumber','join','../../files/reports','savename','%s.%s','extname'];(function(_0x54d4b9,_0xfd4c7f){var _0x39683e=function(_0x244d16){while(--_0x244d16){_0x54d4b9['push'](_0x54d4b9['shift']());}};_0x39683e(++_0xfd4c7f);}(_0x1f19,0x19d));var _0x91f1=function(_0x13ed0c,_0x8457df){_0x13ed0c=_0x13ed0c-0x0;var _0x5b83c1=_0x1f19[_0x13ed0c];return _0x5b83c1;};'use strict';var fs=require('fs');var util=require(_0x91f1('0x0'));var path=require(_0x91f1('0x1'));var _=require(_0x91f1('0x2'));var moment=require('moment');var CronJobManager=require(_0x91f1('0x3'));var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0x91f1('0x4'))(_0x91f1('0x5'));var db=require('../../mysqldb')['db'];var analyticCustomReportController=require(_0x91f1('0x6'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson['client'][_0x91f1('0x7')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x3f51b8,_0x2ac6a0){return function(){logger[_0x91f1('0x8')](_0x91f1('0x9'),_0x3f51b8[_0x91f1('0xa')]);var _0x559685=!![];var _0x3eba00={'tls':{'rejectUnauthorized':![]}};if(_0x3f51b8[_0x91f1('0xb')][_0x91f1('0xc')][_0x91f1('0xd')]){_0x3eba00['service']=_0x3f51b8['MailAccount']['Smtp'][_0x91f1('0xd')];}else{_0x3eba00[_0x91f1('0xe')]=_0x3f51b8['MailAccount'][_0x91f1('0xc')][_0x91f1('0xe')];_0x3eba00['port']=_0x3f51b8['MailAccount'][_0x91f1('0xc')][_0x91f1('0xf')];_0x3eba00[_0x91f1('0x10')]=_0x3f51b8[_0x91f1('0xb')][_0x91f1('0xc')][_0x91f1('0x10')];}if(_0x3f51b8[_0x91f1('0xb')][_0x91f1('0xc')][_0x91f1('0x11')]){_0x3eba00[_0x91f1('0x12')]={'user':_0x3f51b8['MailAccount'][_0x91f1('0xc')]['user'],'pass':_0x3f51b8[_0x91f1('0xb')][_0x91f1('0xc')][_0x91f1('0x13')]};}var _0x18ca05={'account':_0x3eba00,'message':{'from':util['format'](_0x91f1('0x14'),_0x3f51b8[_0x91f1('0xb')]['name'],_0x3f51b8['MailAccount'][_0x91f1('0xa')]||_0x3f51b8[_0x91f1('0xb')][_0x91f1('0xc')][_0x91f1('0x15')]),'to':_0x3f51b8[_0x91f1('0xa')],'cc':_0x3f51b8['cc'],'bcc':_0x3f51b8[_0x91f1('0x16')],'subject':util[_0x91f1('0x17')](_0x91f1('0x18'),_0x2ac6a0[_0x91f1('0x19')],_0x3f51b8[_0x91f1('0x1a')],_0x3f51b8['subtractUnit'])}};var _0x4190af=path[_0x91f1('0x1b')](__dirname,_0x91f1('0x1c'));var _0x4011c3=_0x2ac6a0[_0x91f1('0x1d')];var _0x4814e5=util[_0x91f1('0x17')](_0x91f1('0x1e'),path['basename'](_0x2ac6a0[_0x91f1('0x1d')],path[_0x91f1('0x1f')](_0x2ac6a0[_0x91f1('0x1d')])),'zip');var _0x2c4d21=path[_0x91f1('0x1b')](_0x4190af,_0x4011c3);var _0x2caa80=path[_0x91f1('0x1b')](_0x4190af,_0x4814e5);if(fs[_0x91f1('0x20')](_0x2c4d21)){_0x2ac6a0['status']=_0x91f1('0x21');_0x18ca05[_0x91f1('0x22')][_0x91f1('0x23')]=[{'filename':_0x4011c3,'path':_0x2c4d21}];_0x18ca05[_0x91f1('0x22')][_0x91f1('0x24')]=util[_0x91f1('0x17')](_0x91f1('0x25'),JSON[_0x91f1('0x26')](_0x2ac6a0,null,0x2));}else if(fs['existsSync'](_0x2caa80)){_0x2ac6a0[_0x91f1('0x27')]=_0x91f1('0x21');_0x18ca05[_0x91f1('0x22')][_0x91f1('0x23')]=[{'filename':_0x4814e5,'path':_0x2caa80}];}else{_0x18ca05['message'][_0x91f1('0x24')]=_0x91f1('0x28');if(!_0x3f51b8[_0x91f1('0x29')]){_0x559685=![];logger[_0x91f1('0x8')](_0x91f1('0x2a'));}}if(_0x559685){return client[_0x91f1('0x2b')](_0x91f1('0x2c'),_0x18ca05)[_0x91f1('0x2d')](function(_0x3b192c){if(_0x3b192c['error']){return logger[_0x91f1('0x2e')](_0x91f1('0x2f'),JSON[_0x91f1('0x26')](_0x3b192c));}return logger[_0x91f1('0x8')](_0x91f1('0x30'));})[_0x91f1('0x31')](function(_0x3d35cd){return logger[_0x91f1('0x2e')]('error\x20mail',JSON['stringify'](_0x3d35cd));});}};}function handleError(){return function(_0x34d1d7){return logger[_0x91f1('0x2e')](JSON[_0x91f1('0x26')](_0x34d1d7));};}function handleResult(_0x15b714){return function(_0x461e76){logger[_0x91f1('0x8')](_0x91f1('0x32'),JSON['stringify'](_0x461e76));if(_0x15b714[_0x91f1('0xb')]&&_0x15b714[_0x91f1('0xb')][_0x91f1('0xc')]&&!_[_0x91f1('0x33')](_0x15b714[_0x91f1('0xa')])){setTimeout(handleSendEmail(_0x15b714,_0x461e76),0x3c*0x3e8);}};}function handleJob(_0x1dcd4e){return function(){try{if(_[_0x91f1('0x33')](_0x1dcd4e[_0x91f1('0x1a')])){return logger[_0x91f1('0x8')](_0x91f1('0x34'));}if(_[_0x91f1('0x33')](_0x1dcd4e[_0x91f1('0x35')])){return logger[_0x91f1('0x8')](_0x91f1('0x36'));}var _0x2d8aad={'startDate':moment()[_0x91f1('0x37')](_0x1dcd4e[_0x91f1('0x1a')],_0x1dcd4e['subtractUnit'])[_0x91f1('0x17')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()[_0x91f1('0x17')]('YYYY-MM-DD\x20HH:mm:ss'),'type':'scheduled','output':_0x1dcd4e['output'],'name':_0x1dcd4e[_0x91f1('0x19')]};if(!_[_0x91f1('0x33')](_0x1dcd4e['DefaultReportId'])){logger[_0x91f1('0x8')](_0x91f1('0x38'),_0x1dcd4e['DefaultReportId']);return analyticDefaultReportController[_0x91f1('0x39')]({'id':_0x1dcd4e['DefaultReportId']},_0x2d8aad)[_0x91f1('0x2d')](handleResult(_0x1dcd4e))['catch'](handleError());}if(!_['isNil'](_0x1dcd4e['CustomReportId'])){logger[_0x91f1('0x8')](_0x91f1('0x3a'),_0x1dcd4e[_0x91f1('0x3b')]);return analyticCustomReportController[_0x91f1('0x39')]({'id':_0x1dcd4e[_0x91f1('0x3b')]},_0x2d8aad)[_0x91f1('0x2d')](handleResult(_0x1dcd4e))[_0x91f1('0x31')](handleError());}}catch(_0x317df3){logger['error'](JSON[_0x91f1('0x26')](_0x317df3));}return logger[_0x91f1('0x8')](_0x91f1('0x3c'));};}function getJobs(_0x3a4609){var _0x132ed5={};if(_0x3a4609){_0x132ed5['id']=_0x3a4609;}return db[_0x91f1('0x3d')][_0x91f1('0x3e')]({'where':_0x132ed5,'include':[{'model':db['MailAccount'],'attributes':['id',_0x91f1('0x19'),_0x91f1('0xa')],'include':[{'model':db[_0x91f1('0x3f')],'as':_0x91f1('0xc')}]}]})[_0x91f1('0x2d')](function(_0x8c4a0a){var _0x2247a0=_[_0x91f1('0x40')](manager['jobs']);var _0x37e2a8=_[_0x91f1('0x41')](_0x8c4a0a,function(_0x312e4a){return _0x312e4a['id']['toString']();});var _0x2230cd=_[_0x91f1('0x42')](_0x8c4a0a,function(_0x21c301){return _0x21c301['id'][_0x91f1('0x43')]();});var _0xeb3c0a=_0x3a4609?_0x37e2a8:_[_0x91f1('0x44')](_0x37e2a8,_0x2247a0);var _0x41dc82=_['intersection'](_0x37e2a8,_0x2247a0);var _0x95ae5c=_['difference'](_0x2247a0,_0x37e2a8);var _0x1ec230;var _0x361cf9;for(_0x1ec230=0x0;_0x1ec230<_0x95ae5c[_0x91f1('0x45')]&&!_0x3a4609;_0x1ec230+=0x1){_0x361cf9=_0x95ae5c[_0x1ec230][_0x91f1('0x43')]();if(manager[_0x91f1('0x46')](_0x361cf9)){manager[_0x91f1('0x47')](_0x361cf9);manager[_0x91f1('0x48')](_0x361cf9);logger[_0x91f1('0x8')](_0x91f1('0x49'),_0x361cf9);}}logger['info'](_0x91f1('0x4a'),JSON['stringify'](_0xeb3c0a));for(_0x1ec230=0x0;_0x1ec230<_0xeb3c0a['length'];_0x1ec230+=0x1){_0x361cf9=_0xeb3c0a[_0x1ec230][_0x91f1('0x43')]();logger['info'](_0x91f1('0x4b'),_0x361cf9);if(_0x3a4609){logger[_0x91f1('0x8')]('my\x20id',_0x3a4609);logger[_0x91f1('0x8')](JSON['stringify'](_0x2230cd[_0x361cf9]));BPromise[_0x91f1('0x4c')]()[_0x91f1('0x2d')](handleJob(_0x2230cd[_0x361cf9]));logger[_0x91f1('0x8')](_0x91f1('0x4d'),_0x2230cd[_0x361cf9][_0x91f1('0x19')],_0x2230cd[_0x361cf9][_0x91f1('0x4e')]);}else if(_0x2230cd[_0x361cf9][_0x91f1('0x4e')]&&_0x2230cd[_0x361cf9]['active']&&moment()[_0x91f1('0x4f')](_0x2230cd[_0x361cf9][_0x91f1('0x50')],_0x2230cd[_0x361cf9][_0x91f1('0x51')])){manager[_0x91f1('0x52')](_0x361cf9,_0x2230cd[_0x361cf9][_0x91f1('0x4e')],handleJob(_0x2230cd[_0x361cf9]));manager[_0x91f1('0x53')](_0x361cf9);logger[_0x91f1('0x8')](_0x91f1('0x54'),_0x2230cd[_0x361cf9][_0x91f1('0x19')],_0x2230cd[_0x361cf9][_0x91f1('0x4e')]);}else if(manager[_0x91f1('0x46')](_0x361cf9)){manager[_0x91f1('0x47')](_0x361cf9);manager['deleteJob'](_0x361cf9);logger[_0x91f1('0x8')](_0x91f1('0x55'),_0x2230cd[_0x361cf9][_0x91f1('0x19')],_0x2230cd[_0x361cf9][_0x91f1('0x4e')]);}}for(_0x1ec230=0x0,_0x361cf9;_0x1ec230<_0x41dc82[_0x91f1('0x45')]&&!_0x3a4609;_0x1ec230+=0x1){_0x361cf9=_0x41dc82[_0x1ec230][_0x91f1('0x43')]();if(manager[_0x91f1('0x46')](_0x361cf9)){if(_0x2230cd[_0x361cf9]['cron']&&_0x2230cd[_0x361cf9][_0x91f1('0x56')]&&moment()[_0x91f1('0x4f')](_0x2230cd[_0x361cf9]['startAt'],_0x2230cd[_0x361cf9][_0x91f1('0x51')])){manager[_0x91f1('0x57')](_0x361cf9,_0x2230cd[_0x361cf9][_0x91f1('0x4e')],handleJob(_0x2230cd[_0x361cf9]));logger[_0x91f1('0x8')]('update\x20cron',_0x2230cd[_0x361cf9][_0x91f1('0x19')],_0x2230cd[_0x361cf9][_0x91f1('0x4e')]);}else{manager['stop'](_0x361cf9);manager[_0x91f1('0x48')](_0x361cf9);logger[_0x91f1('0x8')](_0x91f1('0x55'),_0x2230cd[_0x361cf9][_0x91f1('0x19')],_0x2230cd[_0x361cf9]['cron']);}}}})[_0x91f1('0x31')](function(_0x4f9459){logger[_0x91f1('0x2e')](JSON[_0x91f1('0x26')](_0x4f9459));});}exports[_0x91f1('0x58')]=function(_0x53d1c6){return getJobs(_0x53d1c6);};exports[_0x91f1('0x53')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x3dea=['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','Sent','text','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error\x20mail','email\x20sent','catch','error','data','isNil','subtractNumber','subtractUnit','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','MailServerOut','jobs','map','keyBy','toString','difference','exists','stop','deleteJob','delete\x20cron','length','index','my\x20id','cron','active','isBetween','startAt','endAt','add','start','add\x20cron','stop\x20cron','update','update\x20cron','run','util','path','lodash','moment','cron-job-manager','jayson/promise','../logger','schedule','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','Smtp','service','host','port','secure','authentication','auth','user','pass','format','bcc','Report\x20%s\x20last\x20%s\x20%s','name','join','savename','%s.%s','basename','zip','existsSync','message','attachments'];(function(_0x146598,_0x484aad){var _0x48e92b=function(_0x1c472a){while(--_0x1c472a){_0x146598['push'](_0x146598['shift']());}};_0x48e92b(++_0x484aad);}(_0x3dea,0xed));var _0xa3de=function(_0x5956d2,_0x555e2e){_0x5956d2=_0x5956d2-0x0;var _0x5cc2d2=_0x3dea[_0x5956d2];return _0x5cc2d2;};'use strict';var fs=require('fs');var util=require(_0xa3de('0x0'));var path=require(_0xa3de('0x1'));var _=require(_0xa3de('0x2'));var moment=require(_0xa3de('0x3'));var CronJobManager=require(_0xa3de('0x4'));var jayson=require(_0xa3de('0x5'));var BPromise=require('bluebird');var logger=require(_0xa3de('0x6'))(_0xa3de('0x7'));var db=require('../../mysqldb')['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0xa3de('0x8'));var client=jayson[_0xa3de('0x9')][_0xa3de('0xa')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x19d6d5,_0x4ffe03){return function(){logger[_0xa3de('0xb')](_0xa3de('0xc'),_0x19d6d5[_0xa3de('0xd')]);var _0x7d922d=!![];var _0x197699={'tls':{'rejectUnauthorized':![]}};if(_0x19d6d5[_0xa3de('0xe')][_0xa3de('0xf')][_0xa3de('0x10')]){_0x197699['service']=_0x19d6d5[_0xa3de('0xe')][_0xa3de('0xf')][_0xa3de('0x10')];}else{_0x197699[_0xa3de('0x11')]=_0x19d6d5[_0xa3de('0xe')][_0xa3de('0xf')][_0xa3de('0x11')];_0x197699[_0xa3de('0x12')]=_0x19d6d5[_0xa3de('0xe')][_0xa3de('0xf')][_0xa3de('0x12')];_0x197699[_0xa3de('0x13')]=_0x19d6d5['MailAccount'][_0xa3de('0xf')][_0xa3de('0x13')];}if(_0x19d6d5[_0xa3de('0xe')][_0xa3de('0xf')][_0xa3de('0x14')]){_0x197699[_0xa3de('0x15')]={'user':_0x19d6d5['MailAccount'][_0xa3de('0xf')][_0xa3de('0x16')],'pass':_0x19d6d5[_0xa3de('0xe')][_0xa3de('0xf')][_0xa3de('0x17')]};}var _0x2ab324={'account':_0x197699,'message':{'from':util[_0xa3de('0x18')]('\x22%s\x22\x20<%s>',_0x19d6d5['MailAccount']['name'],_0x19d6d5[_0xa3de('0xe')][_0xa3de('0xd')]||_0x19d6d5['MailAccount']['Smtp'][_0xa3de('0x16')]),'to':_0x19d6d5[_0xa3de('0xd')],'cc':_0x19d6d5['cc'],'bcc':_0x19d6d5[_0xa3de('0x19')],'subject':util[_0xa3de('0x18')](_0xa3de('0x1a'),_0x4ffe03[_0xa3de('0x1b')],_0x19d6d5['subtractNumber'],_0x19d6d5['subtractUnit'])}};var _0x281dec=path[_0xa3de('0x1c')](__dirname,'../../files/reports');var _0x17770f=_0x4ffe03[_0xa3de('0x1d')];var _0x4f33f6=util[_0xa3de('0x18')](_0xa3de('0x1e'),path[_0xa3de('0x1f')](_0x4ffe03[_0xa3de('0x1d')],path['extname'](_0x4ffe03[_0xa3de('0x1d')])),_0xa3de('0x20'));var _0x1d9360=path[_0xa3de('0x1c')](_0x281dec,_0x17770f);var _0x3405f9=path['join'](_0x281dec,_0x4f33f6);if(fs[_0xa3de('0x21')](_0x1d9360)){_0x4ffe03['status']='Sent';_0x2ab324[_0xa3de('0x22')][_0xa3de('0x23')]=[{'filename':_0x17770f,'path':_0x1d9360}];_0x2ab324[_0xa3de('0x22')]['text']=util[_0xa3de('0x18')](_0xa3de('0x24'),JSON[_0xa3de('0x25')](_0x4ffe03,null,0x2));}else if(fs['existsSync'](_0x3405f9)){_0x4ffe03[_0xa3de('0x26')]=_0xa3de('0x27');_0x2ab324[_0xa3de('0x22')][_0xa3de('0x23')]=[{'filename':_0x4f33f6,'path':_0x3405f9}];}else{_0x2ab324[_0xa3de('0x22')][_0xa3de('0x28')]=_0xa3de('0x29');if(!_0x19d6d5[_0xa3de('0x2a')]){_0x7d922d=![];logger['info'](_0xa3de('0x2b'));}}if(_0x7d922d){return client[_0xa3de('0x2c')](_0xa3de('0x2d'),_0x2ab324)[_0xa3de('0x2e')](function(_0x1c00f7){if(_0x1c00f7['error']){return logger['error'](_0xa3de('0x2f'),JSON[_0xa3de('0x25')](_0x1c00f7));}return logger['info'](_0xa3de('0x30'));})[_0xa3de('0x31')](function(_0x1c1e54){return logger['error'](_0xa3de('0x2f'),JSON[_0xa3de('0x25')](_0x1c1e54));});}};}function handleError(){return function(_0x30d8fe){return logger[_0xa3de('0x32')](JSON[_0xa3de('0x25')](_0x30d8fe));};}function handleResult(_0x73a9e8){return function(_0x1ffd67){logger['info'](_0xa3de('0x33'),JSON[_0xa3de('0x25')](_0x1ffd67));if(_0x73a9e8['MailAccount']&&_0x73a9e8[_0xa3de('0xe')][_0xa3de('0xf')]&&!_[_0xa3de('0x34')](_0x73a9e8['email'])){setTimeout(handleSendEmail(_0x73a9e8,_0x1ffd67),0x3c*0x3e8);}};}function handleJob(_0x3349a3){return function(){try{if(_['isNil'](_0x3349a3[_0xa3de('0x35')])){return logger['info']('subtractNumber\x20null\x20or\x20undefined');}if(_[_0xa3de('0x34')](_0x3349a3[_0xa3de('0x36')])){return logger[_0xa3de('0xb')](_0xa3de('0x37'));}var _0x1297ac={'startDate':moment()[_0xa3de('0x38')](_0x3349a3['subtractNumber'],_0x3349a3[_0xa3de('0x36')])['format'](_0xa3de('0x39')),'endDate':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'type':_0xa3de('0x3a'),'output':_0x3349a3['output'],'name':_0x3349a3[_0xa3de('0x1b')]};if(!_[_0xa3de('0x34')](_0x3349a3[_0xa3de('0x3b')])){logger[_0xa3de('0xb')](_0xa3de('0x3c'),_0x3349a3[_0xa3de('0x3b')]);return analyticDefaultReportController[_0xa3de('0x3d')]({'id':_0x3349a3[_0xa3de('0x3b')]},_0x1297ac)['then'](handleResult(_0x3349a3))[_0xa3de('0x31')](handleError());}if(!_[_0xa3de('0x34')](_0x3349a3[_0xa3de('0x3e')])){logger[_0xa3de('0xb')](_0xa3de('0x3f'),_0x3349a3[_0xa3de('0x3e')]);return analyticCustomReportController[_0xa3de('0x3d')]({'id':_0x3349a3[_0xa3de('0x3e')]},_0x1297ac)[_0xa3de('0x2e')](handleResult(_0x3349a3))['catch'](handleError());}}catch(_0x382c77){logger['error'](JSON[_0xa3de('0x25')](_0x382c77));}return logger[_0xa3de('0xb')](_0xa3de('0x40'));};}function getJobs(_0x571f5d){var _0x19f17d={};if(_0x571f5d){_0x19f17d['id']=_0x571f5d;}return db[_0xa3de('0x41')]['findAll']({'where':_0x19f17d,'include':[{'model':db[_0xa3de('0xe')],'attributes':['id',_0xa3de('0x1b'),'email'],'include':[{'model':db[_0xa3de('0x42')],'as':_0xa3de('0xf')}]}]})[_0xa3de('0x2e')](function(_0x482c6f){var _0x1c09b1=_['keys'](manager[_0xa3de('0x43')]);var _0x58fba5=_[_0xa3de('0x44')](_0x482c6f,function(_0x11ebda){return _0x11ebda['id']['toString']();});var _0x1f8de9=_[_0xa3de('0x45')](_0x482c6f,function(_0x2b86e0){return _0x2b86e0['id'][_0xa3de('0x46')]();});var _0x5f4cc7=_0x571f5d?_0x58fba5:_[_0xa3de('0x47')](_0x58fba5,_0x1c09b1);var _0x28b3e4=_['intersection'](_0x58fba5,_0x1c09b1);var _0x323c6f=_[_0xa3de('0x47')](_0x1c09b1,_0x58fba5);var _0x3fe7c5;var _0x1fdff5;for(_0x3fe7c5=0x0;_0x3fe7c5<_0x323c6f['length']&&!_0x571f5d;_0x3fe7c5+=0x1){_0x1fdff5=_0x323c6f[_0x3fe7c5][_0xa3de('0x46')]();if(manager[_0xa3de('0x48')](_0x1fdff5)){manager[_0xa3de('0x49')](_0x1fdff5);manager[_0xa3de('0x4a')](_0x1fdff5);logger[_0xa3de('0xb')](_0xa3de('0x4b'),_0x1fdff5);}}logger[_0xa3de('0xb')]('toRun',JSON[_0xa3de('0x25')](_0x5f4cc7));for(_0x3fe7c5=0x0;_0x3fe7c5<_0x5f4cc7[_0xa3de('0x4c')];_0x3fe7c5+=0x1){_0x1fdff5=_0x5f4cc7[_0x3fe7c5][_0xa3de('0x46')]();logger[_0xa3de('0xb')](_0xa3de('0x4d'),_0x1fdff5);if(_0x571f5d){logger[_0xa3de('0xb')](_0xa3de('0x4e'),_0x571f5d);logger['info'](JSON[_0xa3de('0x25')](_0x1f8de9[_0x1fdff5]));BPromise['resolve']()['then'](handleJob(_0x1f8de9[_0x1fdff5]));logger['info']('run\x20job',_0x1f8de9[_0x1fdff5]['name'],_0x1f8de9[_0x1fdff5]['cron']);}else if(_0x1f8de9[_0x1fdff5][_0xa3de('0x4f')]&&_0x1f8de9[_0x1fdff5][_0xa3de('0x50')]&&moment()[_0xa3de('0x51')](_0x1f8de9[_0x1fdff5][_0xa3de('0x52')],_0x1f8de9[_0x1fdff5][_0xa3de('0x53')])){manager[_0xa3de('0x54')](_0x1fdff5,_0x1f8de9[_0x1fdff5][_0xa3de('0x4f')],handleJob(_0x1f8de9[_0x1fdff5]));manager[_0xa3de('0x55')](_0x1fdff5);logger[_0xa3de('0xb')](_0xa3de('0x56'),_0x1f8de9[_0x1fdff5][_0xa3de('0x1b')],_0x1f8de9[_0x1fdff5][_0xa3de('0x4f')]);}else if(manager['exists'](_0x1fdff5)){manager[_0xa3de('0x49')](_0x1fdff5);manager[_0xa3de('0x4a')](_0x1fdff5);logger['info'](_0xa3de('0x57'),_0x1f8de9[_0x1fdff5][_0xa3de('0x1b')],_0x1f8de9[_0x1fdff5][_0xa3de('0x4f')]);}}for(_0x3fe7c5=0x0,_0x1fdff5;_0x3fe7c5<_0x28b3e4[_0xa3de('0x4c')]&&!_0x571f5d;_0x3fe7c5+=0x1){_0x1fdff5=_0x28b3e4[_0x3fe7c5][_0xa3de('0x46')]();if(manager[_0xa3de('0x48')](_0x1fdff5)){if(_0x1f8de9[_0x1fdff5]['cron']&&_0x1f8de9[_0x1fdff5][_0xa3de('0x50')]&&moment()[_0xa3de('0x51')](_0x1f8de9[_0x1fdff5]['startAt'],_0x1f8de9[_0x1fdff5][_0xa3de('0x53')])){manager[_0xa3de('0x58')](_0x1fdff5,_0x1f8de9[_0x1fdff5][_0xa3de('0x4f')],handleJob(_0x1f8de9[_0x1fdff5]));logger['info'](_0xa3de('0x59'),_0x1f8de9[_0x1fdff5][_0xa3de('0x1b')],_0x1f8de9[_0x1fdff5]['cron']);}else{manager[_0xa3de('0x49')](_0x1fdff5);manager[_0xa3de('0x4a')](_0x1fdff5);logger[_0xa3de('0xb')](_0xa3de('0x57'),_0x1f8de9[_0x1fdff5][_0xa3de('0x1b')],_0x1f8de9[_0x1fdff5]['cron']);}}}})[_0xa3de('0x31')](function(_0xcfc714){logger[_0xa3de('0x32')](JSON[_0xa3de('0x25')](_0xcfc714));});}exports[_0xa3de('0x5a')]=function(_0x17aaf4){return getJobs(_0x17aaf4);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file diff --git a/server/config/schedule/transcribe.js b/server/config/schedule/transcribe.js index f77881a..3befa01 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 _0x01d3=['error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','findAll','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribe','transcribeAccountId','bucket','forEach','push','all','inspect','start','lodash','aws-sdk','request-promise','util','../../mysqldb','../../config/logger','TranscribeService','getTranscriptionJob','detectSentiment','substring','info','format','data1','data2','transcribeRegion','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','transcribeName','TranscriptionJob','TranscriptionJobStatus','fileText','Transcript','[RECORDING:%d]\x20Get\x20transcript','then','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentRegion','Transcript\x20not\x20available','sentimentAccountId','CloudProvider','findOne','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','language','Sentiment','SentimentScore','Positive','Negative','Mixed','Neutral','FAILED','update','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','tempSentiment','Sequelize','Sentiment\x20Analysis\x20not\x20configured','Cloud\x20Provider\x20not\x20available','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','COMPLETED','catch','name','SequelizeValidationError'];(function(_0x4709c8,_0x3384ca){var _0x478cdd=function(_0x5193ce){while(--_0x5193ce){_0x4709c8['push'](_0x4709c8['shift']());}};_0x478cdd(++_0x3384ca);}(_0x01d3,0xa2));var _0x301d=function(_0x14d2ce,_0x55f131){_0x14d2ce=_0x14d2ce-0x0;var _0x54516d=_0x01d3[_0x14d2ce];return _0x54516d;};var _=require(_0x301d('0x0'));var AWS=require(_0x301d('0x1'));var rp=require(_0x301d('0x2'));var util=require(_0x301d('0x3'));var BPromise=require('bluebird');var db=require(_0x301d('0x4'))['db'];var logger=require(_0x301d('0x5'))('transcribe');function getTranscriptionJob(_0x1b5c75,_0x20d62c,_0x45562b,_0x337347){return new Promise(function(_0x5d1462,_0x318074){var _0x2d8fc2=new AWS[(_0x301d('0x6'))]({'accessKeyId':_0x20d62c,'secretAccessKey':_0x1b5c75,'region':_0x45562b});_0x2d8fc2[_0x301d('0x7')]({'TranscriptionJobName':_0x337347},function(_0x35e760,_0x3ba019){if(_0x35e760){return _0x318074(_0x35e760);}else{return _0x5d1462(_0x3ba019);}});});}function sentiment(_0x130666,_0x26ce06,_0x35ae14,_0x18b853,_0x4c2760){return new Promise(function(_0x1f33fa,_0x2d1d2b){var _0x3cff9d=new AWS['Comprehend']({'accessKeyId':_0x26ce06,'secretAccessKey':_0x130666,'region':_0x35ae14});_0x3cff9d[_0x301d('0x8')]({'Text':_0x18b853,'LanguageCode':_0x4c2760[_0x301d('0x9')](0x0,0x2)},function(_0x5c5d69,_0x5050d3){if(_0x5c5d69){return _0x2d1d2b(_0x5c5d69);}else{return _0x1f33fa(_0x5050d3);}});});}function checkTranscribeJob(_0x4a666b,_0x36a891,_0x2d1684){var _0x467b08;return new BPromise(function(_0x47cc84,_0xe192e6){logger[_0x301d('0xa')](util[_0x301d('0xb')]('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x4a666b['id'],_0x4a666b['transcribeName']));return getTranscriptionJob(_0x2d1684[_0x301d('0xc')],_0x2d1684[_0x301d('0xd')],_0x36a891[_0x301d('0xe')],_0x4a666b['transcribeName'])['then'](function(_0x4f0f10){logger['info'](util[_0x301d('0xb')](_0x301d('0xf'),_0x4a666b['id'],_0x4a666b[_0x301d('0x10')],_0x4f0f10[_0x301d('0x11')][_0x301d('0x12')]));if(!_0x4a666b[_0x301d('0x13')]){switch(_0x4f0f10['TranscriptionJob'][_0x301d('0x12')]){case'COMPLETED':var _0x4eb5eb={'transcribeStatus':_0x4f0f10[_0x301d('0x11')][_0x301d('0x12')],'fileUri':_0x4f0f10['TranscriptionJob'][_0x301d('0x14')]['TranscriptFileUri']};logger[_0x301d('0xa')](util[_0x301d('0xb')](_0x301d('0x15'),_0x4a666b['id']));return rp({'uri':_0x4f0f10['TranscriptionJob'][_0x301d('0x14')]['TranscriptFileUri'],'json':!![]})[_0x301d('0x16')](function(_0x420cf7){logger[_0x301d('0xa')](util['format'](_0x301d('0x17'),_0x4a666b['id']));if(_0x420cf7&&_0x420cf7[_0x301d('0x18')]&&_0x420cf7[_0x301d('0x18')][_0x301d('0x19')]&&_0x420cf7[_0x301d('0x18')][_0x301d('0x19')][_0x301d('0x1a')]){_0x4eb5eb['fileText']='';for(var _0x2f3b71=0x0;_0x2f3b71<_0x420cf7[_0x301d('0x18')][_0x301d('0x19')]['length'];_0x2f3b71++){_0x4eb5eb[_0x301d('0x13')]+=_0x420cf7[_0x301d('0x18')]['transcripts'][_0x2f3b71][_0x301d('0x1b')]+'';}}return _0x4a666b['update'](_0x4eb5eb);})[_0x301d('0x16')](function(){logger[_0x301d('0xa')](util['format'](_0x301d('0x1c'),_0x4a666b['id']));if(!_0x4a666b['tempSentiment']){throw new db['Sequelize'][(_0x301d('0x1d'))](_0x301d('0x1e'));}if(!_0x36a891[_0x301d('0x1f')]||!_0x36a891['sentimentAccountId']||!_0x36a891[_0x301d('0x20')]||!_0x36a891['language']||!_0x36a891['bucket']){throw new db['Sequelize'][(_0x301d('0x1d'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x4eb5eb[_0x301d('0x13')]){throw new Error(_0x301d('0x21'));}if(_0x36a891[_0x301d('0x22')]===_0x2d1684['id']){return _0x2d1684;}else{return db[_0x301d('0x23')][_0x301d('0x24')]({'where':{'id':_settings[_0x301d('0x22')]}});}})[_0x301d('0x16')](function(_0x1b1d83){if(!_0x1b1d83){throw new db['Sequelize'][(_0x301d('0x1d'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x1b1d83[_0x301d('0xc')]||!_0x1b1d83[_0x301d('0xd')]){throw new db['Sequelize']['ValidationError'](_0x301d('0x25'));}_0x467b08=_0x1b1d83;logger['info'](util[_0x301d('0xb')](_0x301d('0x26'),_0x4a666b['id']));return sentiment(_0x467b08[_0x301d('0xc')],_0x467b08[_0x301d('0xd')],_0x36a891[_0x301d('0x20')],_0x4eb5eb[_0x301d('0x13')],_0x36a891[_0x301d('0x27')]);})[_0x301d('0x16')](function(_0x6d751){logger[_0x301d('0xa')](util['format']('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x4a666b['id']));return _0x4a666b['update']({'sentiment':_0x6d751[_0x301d('0x28')],'sPositive':_0x6d751[_0x301d('0x29')][_0x301d('0x2a')],'sNegative':_0x6d751['SentimentScore'][_0x301d('0x2b')],'sMixed':_0x6d751[_0x301d('0x29')][_0x301d('0x2c')],'sNeutral':_0x6d751['SentimentScore'][_0x301d('0x2d')]});})[_0x301d('0x16')](function(){logger[_0x301d('0xa')](util['format'](_0x301d('0x1c'),_0x4a666b['id']));_0x47cc84();});case _0x301d('0x2e'):return _0x4a666b[_0x301d('0x2f')]({'transcribeStatus':_0x301d('0x2e'),'failureReason':_0x4f0f10[_0x301d('0x11')][_0x301d('0x30')]})[_0x301d('0x16')](function(){logger[_0x301d('0xa')](util[_0x301d('0xb')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x4a666b['id']));_0x47cc84();});default:logger['info'](util[_0x301d('0xb')](_0x301d('0x31'),_0x4a666b['id']));break;}}else{return BPromise[_0x301d('0x32')]()[_0x301d('0x16')](function(){if(!_0x4a666b[_0x301d('0x33')]){throw new db[(_0x301d('0x34'))][(_0x301d('0x1d'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x36a891[_0x301d('0x1f')]||!_0x36a891['sentimentAccountId']||!_0x36a891['sentimentRegion']||!_0x36a891[_0x301d('0x27')]||!_0x36a891['bucket']){throw new db[(_0x301d('0x34'))][(_0x301d('0x1d'))](_0x301d('0x35'));}if(!_0x4a666b['fileText']){throw new Error('Transcript\x20not\x20available');}if(_0x36a891[_0x301d('0x22')]===_0x2d1684['id']){return _0x2d1684;}else{return db[_0x301d('0x23')]['findOne']({'where':{'id':_settings['sentimentAccountId']}});}})[_0x301d('0x16')](function(_0x4c56a6){if(!_0x4c56a6){throw new db['Sequelize'][(_0x301d('0x1d'))](_0x301d('0x36'));}if(!_0x4c56a6[_0x301d('0xc')]||!_0x4c56a6[_0x301d('0xd')]){throw new db[(_0x301d('0x34'))][(_0x301d('0x1d'))]('Cloud\x20Provider\x20not\x20configured');}_0x467b08=_0x4c56a6;logger['info'](util['format']('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x4a666b['id']));return sentiment(_0x467b08[_0x301d('0xc')],_0x467b08[_0x301d('0xd')],_0x36a891[_0x301d('0x20')],_0x4a666b[_0x301d('0x13')],_0x36a891[_0x301d('0x27')]);})[_0x301d('0x16')](function(_0x57c90f){logger[_0x301d('0xa')](util[_0x301d('0xb')](_0x301d('0x37'),_0x4a666b['id']));return _0x4a666b[_0x301d('0x2f')]({'sentiment':_0x57c90f[_0x301d('0x28')],'sPositive':_0x57c90f[_0x301d('0x29')][_0x301d('0x2a')],'sNegative':_0x57c90f['SentimentScore'][_0x301d('0x2b')],'sMixed':_0x57c90f[_0x301d('0x29')][_0x301d('0x2c')],'sNeutral':_0x57c90f['SentimentScore'][_0x301d('0x2d')],'transcribeStatus':_0x301d('0x38')});})[_0x301d('0x16')](function(){logger[_0x301d('0xa')](util[_0x301d('0xb')](_0x301d('0x1c'),_0x4a666b['id']));_0x47cc84();});}})[_0x301d('0x39')](function(_0x415d54){if(_0x415d54){if(!_0x415d54['name']||_0x415d54[_0x301d('0x3a')]!==_0x301d('0x3b')){logger[_0x301d('0x3c')](util['format'](_0x301d('0x3d'),_0x4a666b['id']),util['inspect'](_0x415d54,{'showHidden':![],'depth':null}));}}_0x47cc84();});});}function checkTranscribe(){var _0x2b6fde;var _0x130e2a;var _0x58d3a9;return db['VoiceRecording'][_0x301d('0x3e')]({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0x301d('0x16')](function(_0x3bd320){if(!_0x3bd320||!_0x3bd320['length']){throw new db[(_0x301d('0x34'))][(_0x301d('0x1d'))](_0x301d('0x3f'));}_0x2b6fde=_0x3bd320;return db[_0x301d('0x40')][_0x301d('0x24')]({'where':{'id':0x1}});})[_0x301d('0x16')](function(_0x267630){if(!_0x267630){throw new db[(_0x301d('0x34'))][(_0x301d('0x1d'))](_0x301d('0x41'));}_0x130e2a=_0x267630;if(!_0x130e2a[_0x301d('0x42')]||!_0x130e2a[_0x301d('0x43')]||!_0x130e2a['transcribeRegion']||!_0x130e2a[_0x301d('0x27')]||!_0x130e2a[_0x301d('0x44')]){throw new db[(_0x301d('0x34'))]['ValidationError']('Transcribe\x20not\x20configured');}return db[_0x301d('0x23')][_0x301d('0x24')]({'where':{'id':_0x130e2a[_0x301d('0x43')]}});})[_0x301d('0x16')](function(_0x12d114){if(!_0x12d114){throw new db['Sequelize'][(_0x301d('0x1d'))](_0x301d('0x36'));}if(!_0x12d114[_0x301d('0xc')]||!_0x12d114[_0x301d('0xd')]){throw new db['Sequelize'][(_0x301d('0x1d'))](_0x301d('0x25'));}_0x58d3a9=_0x12d114;var _0x548c1e=[];_0x2b6fde[_0x301d('0x45')](function(_0x201718){_0x548c1e[_0x301d('0x46')](checkTranscribeJob(_0x201718,_0x130e2a,_0x58d3a9));});return BPromise[_0x301d('0x47')](_0x548c1e);})[_0x301d('0x39')](function(_0x32665c){if(_0x32665c){if(!_0x32665c[_0x301d('0x3a')]||_0x32665c['name']!==_0x301d('0x3b')){logger[_0x301d('0x3c')](util[_0x301d('0x48')](_0x32665c,{'showHidden':![],'depth':null}));}}});}exports[_0x301d('0x49')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x6cb4=['sentimentAccountId','sentimentRegion','language','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','Mixed','Neutral','update','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','bucket','Sentiment\x20Analysis\x20not\x20configured','catch','SequelizeValidationError','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','findAll','IN_PROGRESS','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','forEach','push','all','name','error','lodash','aws-sdk','request-promise','util','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','transcribeRegion','then','TranscriptionJob','TranscriptionJobStatus','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','fileText','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment'];(function(_0x1562a2,_0x2e4655){var _0x39a636=function(_0x25483a){while(--_0x25483a){_0x1562a2['push'](_0x1562a2['shift']());}};_0x39a636(++_0x2e4655);}(_0x6cb4,0xff));var _0x46cb=function(_0x22e36a,_0x4b6443){_0x22e36a=_0x22e36a-0x0;var _0x2e8b08=_0x6cb4[_0x22e36a];return _0x2e8b08;};var _=require(_0x46cb('0x0'));var AWS=require(_0x46cb('0x1'));var rp=require(_0x46cb('0x2'));var util=require(_0x46cb('0x3'));var BPromise=require(_0x46cb('0x4'));var db=require(_0x46cb('0x5'))['db'];var logger=require(_0x46cb('0x6'))(_0x46cb('0x7'));function getTranscriptionJob(_0x2efd19,_0x5032a4,_0x1a3fe4,_0x5cb9a4){return new Promise(function(_0x3d9d3c,_0x4d9f1d){var _0x11262d=new AWS[(_0x46cb('0x8'))]({'accessKeyId':_0x5032a4,'secretAccessKey':_0x2efd19,'region':_0x1a3fe4});_0x11262d[_0x46cb('0x9')]({'TranscriptionJobName':_0x5cb9a4},function(_0x2d6c29,_0x24b4f5){if(_0x2d6c29){return _0x4d9f1d(_0x2d6c29);}else{return _0x3d9d3c(_0x24b4f5);}});});}function sentiment(_0x196a93,_0x56258a,_0x3d7663,_0x34f9e9,_0x48101c){return new Promise(function(_0x206f10,_0x106a87){var _0x4a60b2=new AWS[(_0x46cb('0xa'))]({'accessKeyId':_0x56258a,'secretAccessKey':_0x196a93,'region':_0x3d7663});_0x4a60b2[_0x46cb('0xb')]({'Text':_0x34f9e9,'LanguageCode':_0x48101c['substring'](0x0,0x2)},function(_0x490b14,_0x57a5b3){if(_0x490b14){return _0x106a87(_0x490b14);}else{return _0x206f10(_0x57a5b3);}});});}function checkTranscribeJob(_0x1e5f96,_0x323ac2,_0x1058a8){var _0xf22158;return new BPromise(function(_0x553440,_0x8497cd){logger[_0x46cb('0xc')](util[_0x46cb('0xd')](_0x46cb('0xe'),_0x1e5f96['id'],_0x1e5f96[_0x46cb('0xf')]));return getTranscriptionJob(_0x1058a8[_0x46cb('0x10')],_0x1058a8[_0x46cb('0x11')],_0x323ac2[_0x46cb('0x12')],_0x1e5f96[_0x46cb('0xf')])[_0x46cb('0x13')](function(_0x136215){logger['info'](util[_0x46cb('0xd')]('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0x1e5f96['id'],_0x1e5f96[_0x46cb('0xf')],_0x136215['TranscriptionJob']['TranscriptionJobStatus']));if(!_0x1e5f96['fileText']){switch(_0x136215[_0x46cb('0x14')][_0x46cb('0x15')]){case _0x46cb('0x16'):var _0xcc8e2={'transcribeStatus':_0x136215[_0x46cb('0x14')][_0x46cb('0x15')],'fileUri':_0x136215[_0x46cb('0x14')][_0x46cb('0x17')][_0x46cb('0x18')]};logger[_0x46cb('0xc')](util[_0x46cb('0xd')](_0x46cb('0x19'),_0x1e5f96['id']));return rp({'uri':_0x136215[_0x46cb('0x14')][_0x46cb('0x17')][_0x46cb('0x18')],'json':!![]})[_0x46cb('0x13')](function(_0x7084b2){logger[_0x46cb('0xc')](util[_0x46cb('0xd')](_0x46cb('0x1a'),_0x1e5f96['id']));if(_0x7084b2&&_0x7084b2[_0x46cb('0x1b')]&&_0x7084b2[_0x46cb('0x1b')][_0x46cb('0x1c')]&&_0x7084b2[_0x46cb('0x1b')][_0x46cb('0x1c')]['length']){_0xcc8e2['fileText']='';for(var _0x6588f3=0x0;_0x6588f3<_0x7084b2[_0x46cb('0x1b')][_0x46cb('0x1c')][_0x46cb('0x1d')];_0x6588f3++){_0xcc8e2[_0x46cb('0x1e')]+=_0x7084b2['results'][_0x46cb('0x1c')][_0x6588f3]['transcript']+'';}}return _0x1e5f96['update'](_0xcc8e2);})['then'](function(){logger[_0x46cb('0xc')](util[_0x46cb('0xd')](_0x46cb('0x1f'),_0x1e5f96['id']));if(!_0x1e5f96[_0x46cb('0x20')]){throw new db[(_0x46cb('0x21'))][(_0x46cb('0x22'))](_0x46cb('0x23'));}if(!_0x323ac2[_0x46cb('0x24')]||!_0x323ac2[_0x46cb('0x25')]||!_0x323ac2[_0x46cb('0x26')]||!_0x323ac2[_0x46cb('0x27')]||!_0x323ac2['bucket']){throw new db[(_0x46cb('0x21'))][(_0x46cb('0x22'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0xcc8e2['fileText']){throw new Error(_0x46cb('0x28'));}if(_0x323ac2['sentimentAccountId']===_0x1058a8['id']){return _0x1058a8;}else{return db[_0x46cb('0x29')][_0x46cb('0x2a')]({'where':{'id':_settings[_0x46cb('0x25')]}});}})[_0x46cb('0x13')](function(_0x9b9d03){if(!_0x9b9d03){throw new db[(_0x46cb('0x21'))]['ValidationError'](_0x46cb('0x2b'));}if(!_0x9b9d03['data1']||!_0x9b9d03[_0x46cb('0x11')]){throw new db[(_0x46cb('0x21'))]['ValidationError'](_0x46cb('0x2c'));}_0xf22158=_0x9b9d03;logger[_0x46cb('0xc')](util[_0x46cb('0xd')](_0x46cb('0x2d'),_0x1e5f96['id']));return sentiment(_0xf22158[_0x46cb('0x10')],_0xf22158['data2'],_0x323ac2[_0x46cb('0x26')],_0xcc8e2['fileText'],_0x323ac2[_0x46cb('0x27')]);})[_0x46cb('0x13')](function(_0x2630e0){logger['info'](util[_0x46cb('0xd')](_0x46cb('0x2e'),_0x1e5f96['id']));return _0x1e5f96['update']({'sentiment':_0x2630e0[_0x46cb('0x2f')],'sPositive':_0x2630e0[_0x46cb('0x30')][_0x46cb('0x31')],'sNegative':_0x2630e0[_0x46cb('0x30')][_0x46cb('0x32')],'sMixed':_0x2630e0[_0x46cb('0x30')][_0x46cb('0x33')],'sNeutral':_0x2630e0[_0x46cb('0x30')][_0x46cb('0x34')]});})[_0x46cb('0x13')](function(){logger[_0x46cb('0xc')](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x1e5f96['id']));_0x553440();});case'FAILED':return _0x1e5f96[_0x46cb('0x35')]({'transcribeStatus':_0x46cb('0x36'),'failureReason':_0x136215[_0x46cb('0x14')][_0x46cb('0x37')]})[_0x46cb('0x13')](function(){logger[_0x46cb('0xc')](util['format'](_0x46cb('0x1f'),_0x1e5f96['id']));_0x553440();});default:logger['info'](util['format'](_0x46cb('0x38'),_0x1e5f96['id']));break;}}else{return BPromise['resolve']()['then'](function(){if(!_0x1e5f96[_0x46cb('0x20')]){throw new db['Sequelize']['ValidationError'](_0x46cb('0x23'));}if(!_0x323ac2[_0x46cb('0x24')]||!_0x323ac2[_0x46cb('0x25')]||!_0x323ac2[_0x46cb('0x26')]||!_0x323ac2[_0x46cb('0x27')]||!_0x323ac2[_0x46cb('0x39')]){throw new db[(_0x46cb('0x21'))]['ValidationError'](_0x46cb('0x3a'));}if(!_0x1e5f96['fileText']){throw new Error(_0x46cb('0x28'));}if(_0x323ac2['sentimentAccountId']===_0x1058a8['id']){return _0x1058a8;}else{return db[_0x46cb('0x29')][_0x46cb('0x2a')]({'where':{'id':_settings[_0x46cb('0x25')]}});}})['then'](function(_0x43b5d2){if(!_0x43b5d2){throw new db[(_0x46cb('0x21'))]['ValidationError'](_0x46cb('0x2b'));}if(!_0x43b5d2[_0x46cb('0x10')]||!_0x43b5d2[_0x46cb('0x11')]){throw new db[(_0x46cb('0x21'))][(_0x46cb('0x22'))]('Cloud\x20Provider\x20not\x20configured');}_0xf22158=_0x43b5d2;logger['info'](util[_0x46cb('0xd')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x1e5f96['id']));return sentiment(_0xf22158[_0x46cb('0x10')],_0xf22158[_0x46cb('0x11')],_0x323ac2['sentimentRegion'],_0x1e5f96[_0x46cb('0x1e')],_0x323ac2[_0x46cb('0x27')]);})[_0x46cb('0x13')](function(_0x5d94db){logger['info'](util['format']('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x1e5f96['id']));return _0x1e5f96[_0x46cb('0x35')]({'sentiment':_0x5d94db[_0x46cb('0x2f')],'sPositive':_0x5d94db[_0x46cb('0x30')][_0x46cb('0x31')],'sNegative':_0x5d94db[_0x46cb('0x30')]['Negative'],'sMixed':_0x5d94db['SentimentScore'][_0x46cb('0x33')],'sNeutral':_0x5d94db[_0x46cb('0x30')]['Neutral'],'transcribeStatus':_0x46cb('0x16')});})[_0x46cb('0x13')](function(){logger[_0x46cb('0xc')](util[_0x46cb('0xd')](_0x46cb('0x1f'),_0x1e5f96['id']));_0x553440();});}})[_0x46cb('0x3b')](function(_0x438b5d){if(_0x438b5d){if(!_0x438b5d['name']||_0x438b5d['name']!==_0x46cb('0x3c')){logger['error'](util[_0x46cb('0xd')](_0x46cb('0x3d'),_0x1e5f96['id']),util[_0x46cb('0x3e')](_0x438b5d,{'showHidden':![],'depth':null}));}}_0x553440();});});}function checkTranscribe(){var _0x54f9ff;var _0x37163b;var _0x5c1665;return db['VoiceRecording'][_0x46cb('0x3f')]({'where':{'transcribeStatus':_0x46cb('0x40')}})[_0x46cb('0x13')](function(_0x4748b9){if(!_0x4748b9||!_0x4748b9[_0x46cb('0x1d')]){throw new db[(_0x46cb('0x21'))][(_0x46cb('0x22'))]('No\x20transcribe\x20job\x20to\x20check');}_0x54f9ff=_0x4748b9;return db['Setting'][_0x46cb('0x2a')]({'where':{'id':0x1}});})[_0x46cb('0x13')](function(_0x52e479){if(!_0x52e479){throw new db[(_0x46cb('0x21'))][(_0x46cb('0x22'))](_0x46cb('0x41'));}_0x37163b=_0x52e479;if(!_0x37163b[_0x46cb('0x7')]||!_0x37163b[_0x46cb('0x42')]||!_0x37163b['transcribeRegion']||!_0x37163b[_0x46cb('0x27')]||!_0x37163b[_0x46cb('0x39')]){throw new db[(_0x46cb('0x21'))]['ValidationError'](_0x46cb('0x43'));}return db['CloudProvider']['findOne']({'where':{'id':_0x37163b[_0x46cb('0x42')]}});})[_0x46cb('0x13')](function(_0x2fe0b1){if(!_0x2fe0b1){throw new db[(_0x46cb('0x21'))][(_0x46cb('0x22'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x2fe0b1[_0x46cb('0x10')]||!_0x2fe0b1[_0x46cb('0x11')]){throw new db['Sequelize']['ValidationError'](_0x46cb('0x2c'));}_0x5c1665=_0x2fe0b1;var _0xfccf57=[];_0x54f9ff[_0x46cb('0x44')](function(_0x5c2190){_0xfccf57[_0x46cb('0x45')](checkTranscribeJob(_0x5c2190,_0x37163b,_0x5c1665));});return BPromise[_0x46cb('0x46')](_0xfccf57);})[_0x46cb('0x3b')](function(_0x61aef9){if(_0x61aef9){if(!_0x61aef9[_0x46cb('0x47')]||_0x61aef9[_0x46cb('0x47')]!==_0x46cb('0x3c')){logger[_0x46cb('0x48')](util[_0x46cb('0x3e')](_0x61aef9,{'showHidden':![],'depth':null}));}}});}exports['start']=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file diff --git a/server/config/schedule/whatsapp.js b/server/config/schedule/whatsapp.js index dfa2052..c108f22 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 _0xada7=['info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','error','inspect','start','lodash','moment','util','../../config/environment','../../mysqldb','../logger','schedule','defaults','redis','localhost','socket.io-emitter','findAll','hours','then','length','map'];(function(_0x3aeeec,_0x36b936){var _0x290404=function(_0x5334b3){while(--_0x5334b3){_0x3aeeec['push'](_0x3aeeec['shift']());}};_0x290404(++_0x36b936);}(_0xada7,0x186));var _0x7ada=function(_0x4e6d1f,_0x5abde6){_0x4e6d1f=_0x4e6d1f-0x0;var _0x127c9a=_0xada7[_0x4e6d1f];return _0x127c9a;};'use strict';var _=require(_0x7ada('0x0'));var moment=require(_0x7ada('0x1'));var Redis=require('ioredis');var util=require(_0x7ada('0x2'));var config=require(_0x7ada('0x3'));var db=require(_0x7ada('0x4'))['db'];var logger=require(_0x7ada('0x5'))(_0x7ada('0x6'));config['redis']=_[_0x7ada('0x7')](config[_0x7ada('0x8')],{'host':_0x7ada('0x9'),'port':0x18eb});var io=require(_0x7ada('0xa'))(new Redis(config[_0x7ada('0x8')]));function closeInteractions(){var _0x312ccd=[];return db['WhatsappInteraction'][_0x7ada('0xb')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,_0x7ada('0xc'))}}})[_0x7ada('0xd')](function(_0x55af80){if(_0x55af80&&_0x55af80[_0x7ada('0xe')]){_0x312ccd=_[_0x7ada('0xf')](_0x55af80||[],'id');logger[_0x7ada('0x10')](_0x7ada('0x11'),_0x312ccd[_0x7ada('0x12')]());return db['WhatsappInteraction'][_0x7ada('0x13')]({'closeReason':_0x7ada('0x14'),'disposition':_0x7ada('0x15'),'closed':!![],'closedAt':moment()[_0x7ada('0x16')](_0x7ada('0x17'))},{'where':{'id':_0x312ccd}});}})[_0x7ada('0xd')](function(){if(_0x312ccd&&_0x312ccd[_0x7ada('0xe')]){logger[_0x7ada('0x10')](_0x7ada('0x18'),_0x312ccd[_0x7ada('0x12')]());for(var _0x33d2f1=0x0;_0x33d2f1<_0x312ccd[_0x7ada('0xe')];_0x33d2f1++){io[_0x7ada('0x19')]('whatsappInteraction:update',{'id':_0x312ccd[_0x33d2f1],'closed':!![]});}}})['catch'](function(_0x46a6fc){logger[_0x7ada('0x1a')]('[WHATSAPP]\x20Error\x20closing\x20interactions',_0x46a6fc?util[_0x7ada('0x1b')](_0x46a6fc,{'showHidden':![],'depth':null}):'');});}exports[_0x7ada('0x1c')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x65ac=['moment','ioredis','util','../../mysqldb','../logger','schedule','redis','localhost','socket.io-emitter','findAll','lastMsgAt','hours','then','map','[WHATSAPP]\x20Interactions\x20to\x20close:','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','length','info','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','join','emit','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash'];(function(_0x545a5e,_0x324f8e){var _0x2d7a7c=function(_0x4ff093){while(--_0x4ff093){_0x545a5e['push'](_0x545a5e['shift']());}};_0x2d7a7c(++_0x324f8e);}(_0x65ac,0x1a3));var _0xc65a=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x65ac[_0x15bc81];return _0x59440e;};'use strict';var _=require(_0xc65a('0x0'));var moment=require(_0xc65a('0x1'));var Redis=require(_0xc65a('0x2'));var util=require(_0xc65a('0x3'));var config=require('../../config/environment');var db=require(_0xc65a('0x4'))['db'];var logger=require(_0xc65a('0x5'))(_0xc65a('0x6'));config['redis']=_['defaults'](config[_0xc65a('0x7')],{'host':_0xc65a('0x8'),'port':0x18eb});var io=require(_0xc65a('0x9'))(new Redis(config['redis']));function closeInteractions(){var _0x1d16ae=[];return db['WhatsappInteraction'][_0xc65a('0xa')]({'raw':!![],'attributes':['id',_0xc65a('0xb')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,_0xc65a('0xc'))}}})[_0xc65a('0xd')](function(_0x42c854){if(_0x42c854&&_0x42c854['length']){_0x1d16ae=_[_0xc65a('0xe')](_0x42c854||[],'id');logger['info'](_0xc65a('0xf'),_0x1d16ae['join']());return db['WhatsappInteraction']['update']({'closeReason':_0xc65a('0x10'),'disposition':_0xc65a('0x11'),'closed':!![],'closedAt':moment()[_0xc65a('0x12')](_0xc65a('0x13'))},{'where':{'id':_0x1d16ae}});}})['then'](function(){if(_0x1d16ae&&_0x1d16ae[_0xc65a('0x14')]){logger[_0xc65a('0x15')](_0xc65a('0x16'),_0x1d16ae[_0xc65a('0x17')]());for(var _0x18af57=0x0;_0x18af57<_0x1d16ae[_0xc65a('0x14')];_0x18af57++){io[_0xc65a('0x18')]('whatsappInteraction:update',{'id':_0x1d16ae[_0x18af57],'closed':!![]});}}})['catch'](function(_0x302d54){logger['error'](_0xc65a('0x19'),_0x302d54?util[_0xc65a('0x1a')](_0x302d54,{'showHidden':![],'depth':null}):'');});}exports[_0xc65a('0x1b')]=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 b292bd3..5c346f1 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3596=['now','Biondo','innocenzo.biondo','destroy','CmContact','then','log','finished\x20populating','contacts1','CmHopper','bulkCreate','contacts2','hopper2','catch','util','../mysqldb','push','Innocenzo','@xcally.com'];(function(_0x53c81a,_0xfe65a1){var _0x29ad48=function(_0x578805){while(--_0x578805){_0x53c81a['push'](_0x53c81a['shift']());}};_0x29ad48(++_0xfe65a1);}(_0x3596,0xa6));var _0x6359=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0x3596[_0x1f9f37];return _0x21c080;};'use strict';var util=require(_0x6359('0x0'));var db=require(_0x6359('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x6359('0x2')]({'id':i,'firstName':_0x6359('0x3')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x6359('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x6359('0x2')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x6359('0x5')](),'updatedAt':Date[_0x6359('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0x6359('0x3')+i,'lastName':_0x6359('0x6')+i,'phone':0xf879fb460+i,'email':_0x6359('0x7')+i+_0x6359('0x4')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x6359('0x2')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x6359('0x5')](),'updatedAt':Date[_0x6359('0x5')]()});}db['CmContact'][_0x6359('0x8')]({'where':{}})['then'](function(){return db[_0x6359('0x9')]['bulkCreate'](contacts);})[_0x6359('0xa')](function(){console[_0x6359('0xb')](_0x6359('0xc'),_0x6359('0xd'));return db[_0x6359('0xe')][_0x6359('0x8')]({'where':{}});})[_0x6359('0xa')](function(){return db[_0x6359('0xe')]['bulkCreate'](hopper);})['then'](function(){console[_0x6359('0xb')](_0x6359('0xc'),'hopper1');return db[_0x6359('0x9')][_0x6359('0xf')](contacts2);})[_0x6359('0xa')](function(){console[_0x6359('0xb')](_0x6359('0xc'),_0x6359('0x10'));return db[_0x6359('0xe')][_0x6359('0xf')](hopper2);})['then'](function(){console[_0x6359('0xb')](_0x6359('0xc'),_0x6359('0x11'));})[_0x6359('0x12')](function(_0x5a7766){console[_0x6359('0xb')](_0x5a7766);}); \ No newline at end of file +var _0x296b=['now','destroy','CmContact','bulkCreate','log','finished\x20populating','contacts1','CmHopper','then','hopper1','contacts2','hopper2','catch','util','../mysqldb','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','push'];(function(_0x259c9f,_0x447312){var _0x187ae4=function(_0x750b80){while(--_0x750b80){_0x259c9f['push'](_0x259c9f['shift']());}};_0x187ae4(++_0x447312);}(_0x296b,0x175));var _0xb296=function(_0x1b91c7,_0x539acd){_0x1b91c7=_0x1b91c7-0x0;var _0xbbe014=_0x296b[_0x1b91c7];return _0xbbe014;};'use strict';var util=require(_0xb296('0x0'));var db=require(_0xb296('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0xb296('0x2')+i,'lastName':_0xb296('0x3')+i,'phone':0xf879fb460+i,'email':_0xb296('0x4')+i+_0xb296('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xb296('0x6')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xb296('0x7')](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xb296('0x6')]({'id':i,'firstName':_0xb296('0x2')+i,'lastName':_0xb296('0x3')+i,'phone':0xf879fb460+i,'email':_0xb296('0x4')+i+_0xb296('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xb296('0x6')]({'id':i,'active':![],'scheduledat':Date[_0xb296('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xb296('0x7')](),'updatedAt':Date[_0xb296('0x7')]()});}db['CmContact'][_0xb296('0x8')]({'where':{}})['then'](function(){return db[_0xb296('0x9')][_0xb296('0xa')](contacts);})['then'](function(){console[_0xb296('0xb')](_0xb296('0xc'),_0xb296('0xd'));return db[_0xb296('0xe')]['destroy']({'where':{}});})[_0xb296('0xf')](function(){return db[_0xb296('0xe')][_0xb296('0xa')](hopper);})['then'](function(){console[_0xb296('0xb')](_0xb296('0xc'),_0xb296('0x10'));return db[_0xb296('0x9')][_0xb296('0xa')](contacts2);})['then'](function(){console[_0xb296('0xb')](_0xb296('0xc'),_0xb296('0x11'));return db['CmHopper'][_0xb296('0xa')](hopper2);})[_0xb296('0xf')](function(){console['log'](_0xb296('0xc'),_0xb296('0x12'));})[_0xb296('0x13')](function(_0x44303a){console[_0xb296('0xb')](_0x44303a);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index e7b529a..fb0ffc7 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8d89=['ulaw','yes','/etc/pki/tls/certs/motion.crt','actpass','\x22%s\x22\x20<%s>','bulkCreate','then','log','add\x20user','catch','util','../mysqldb','format','%s%s','agent','password','friend','udp','wss','all'];(function(_0x1ec9ad,_0x697a3f){var _0x35f747=function(_0x4b2e2f){while(--_0x4b2e2f){_0x1ec9ad['push'](_0x1ec9ad['shift']());}};_0x35f747(++_0x697a3f);}(_0x8d89,0xfa));var _0x98d8=function(_0x5722b7,_0x475f4e){_0x5722b7=_0x5722b7-0x0;var _0xf2325d=_0x8d89[_0x5722b7];return _0xf2325d;};'use strict';var util=require(_0x98d8('0x0'));var db=require(_0x98d8('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util[_0x98d8('0x2')](_0x98d8('0x3'),_0x98d8('0x4'),i),'fullname':util['format'](_0x98d8('0x3'),_0x98d8('0x4'),i),'email':util[_0x98d8('0x2')]('%s%s@xcally.com',_0x98d8('0x4'),i),'role':_0x98d8('0x4'),'password':_0x98d8('0x5'),'internal':0xfa0+i,'type':_0x98d8('0x6'),'transport':[_0x98d8('0x7'),'ws',_0x98d8('0x8')],'disallow':[_0x98d8('0x9')],'allow':[_0x98d8('0xa')],'defaultuser':util[_0x98d8('0x2')](_0x98d8('0x3'),_0x98d8('0x4'),i),'encryption':_0x98d8('0xb'),'avpf':_0x98d8('0xb'),'force_avp':_0x98d8('0xb'),'icesupport':'yes','dtlsenable':_0x98d8('0xb'),'dtlsverify':'no','dtlscertfile':_0x98d8('0xc'),'dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':_0x98d8('0xd'),'callerid':util[_0x98d8('0x2')](_0x98d8('0xe'),util['format'](_0x98d8('0x3'),_0x98d8('0x4'),i),0xfa0+i)});}db['User'][_0x98d8('0xf')](users)[_0x98d8('0x10')](function(){console[_0x98d8('0x11')](_0x98d8('0x12'));})[_0x98d8('0x13')](function(_0x4ceb0c){console[_0x98d8('0x11')](_0x4ceb0c);}); \ No newline at end of file +var _0xd6dd=['util','../mysqldb','push','format','%s%s','agent','friend','udp','wss','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','bulkCreate','then','log','add\x20user'];(function(_0x1eda20,_0x1149f4){var _0x31b953=function(_0x25f0d8){while(--_0x25f0d8){_0x1eda20['push'](_0x1eda20['shift']());}};_0x31b953(++_0x1149f4);}(_0xd6dd,0x18f));var _0xdd6d=function(_0x15f43a,_0x57c8b5){_0x15f43a=_0x15f43a-0x0;var _0x2369bc=_0xd6dd[_0x15f43a];return _0x2369bc;};'use strict';var util=require(_0xdd6d('0x0'));var db=require(_0xdd6d('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xdd6d('0x2')]({'name':util[_0xdd6d('0x3')](_0xdd6d('0x4'),_0xdd6d('0x5'),i),'fullname':util[_0xdd6d('0x3')]('%s%s','agent',i),'email':util[_0xdd6d('0x3')]('%s%s@xcally.com',_0xdd6d('0x5'),i),'role':'agent','password':'password','internal':0xfa0+i,'type':_0xdd6d('0x6'),'transport':[_0xdd6d('0x7'),'ws',_0xdd6d('0x8')],'disallow':['all'],'allow':[_0xdd6d('0x9')],'defaultuser':util['format'](_0xdd6d('0x4'),'agent',i),'encryption':'yes','avpf':'yes','force_avp':_0xdd6d('0xa'),'icesupport':_0xdd6d('0xa'),'dtlsenable':_0xdd6d('0xa'),'dtlsverify':'no','dtlscertfile':_0xdd6d('0xb'),'dtlsprivatekey':_0xdd6d('0xc'),'dtlssetup':_0xdd6d('0xd'),'callerid':util['format'](_0xdd6d('0xe'),util[_0xdd6d('0x3')]('%s%s',_0xdd6d('0x5'),i),0xfa0+i)});}db['User'][_0xdd6d('0xf')](users)[_0xdd6d('0x10')](function(){console[_0xdd6d('0x11')](_0xdd6d('0x12'));})['catch'](function(_0x469012){console[_0xdd6d('0x11')](_0x469012);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index c6b09ba..d1e7e17 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xffd6=['push','VoiceQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','Trunk','user','SmsQueues','WhatsappQueue','getVoiceQueues','getChatQueues','getFaxQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','chat','sms','mail','openchannel','whatsapp','campaign:%s:%s','leave','removeChatInteractions','emit','user_has_chat_interactions:remove','MailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','WhatsappInteractions','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','log','join','connection','setMaxListeners','request','remoteAddress','remotePort','connectedAt','SocketIO\x20','nsp','address','disconnect','DISCONNECTED','CONNECTED','lodash','util','bluebird','name','Agents','User','role','agent','telephone','type','ivr','findOne','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','MailQueues','OpenchannelQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','where','Campaign','length','format','handshake','query','userProfileId','ChatInteractions','MailInteraction','FaxInteractions','SmsInteraction','SmsInteractions','WhatsappInteraction','user:%s','admin','voice:inbound','voice:outbound','hasOwnProperty','include'];(function(_0x2ff4bd,_0x4780a6){var _0x28edc6=function(_0x792380){while(--_0x792380){_0x2ff4bd['push'](_0x2ff4bd['shift']());}};_0x28edc6(++_0x4780a6);}(_0xffd6,0x97));var _0x6ffd=function(_0x31bab3,_0x44554f){_0x31bab3=_0x31bab3-0x0;var _0x4fd382=_0xffd6[_0x31bab3];return _0x4fd382;};'use strict';var _=require(_0x6ffd('0x0'));var util=require(_0x6ffd('0x1'));var BPromise=require(_0x6ffd('0x2'));var db=require('../mysqldb')['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0x6ffd('0x3')],'include':[{'as':_0x6ffd('0x4'),'model':db[_0x6ffd('0x5')],'attributes':['id','name',_0x6ffd('0x6')],'raw':!![],'where':{'role':_0x6ffd('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x6ffd('0x3')],'where':{'role':_0x6ffd('0x8')}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id',_0x6ffd('0x3')],'where':{'role':_0x6ffd('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x6ffd('0x3'),_0x6ffd('0x9')],'where':{'type':_0x6ffd('0xa')}};function getAssociatedResources(_0x4a9f85,_0x455dda,_0x417f34){return db['UserProfileSection'][_0x6ffd('0xb')]({'where':{'name':_0x4a9f85,'userProfileId':_0x455dda},'raw':!![]})[_0x6ffd('0xc')](function(_0x23f7f2){if(_0x23f7f2){if(_0x23f7f2[_0x6ffd('0xd')]){switch(_0x4a9f85){case _0x6ffd('0xe'):case _0x6ffd('0xf'):case _0x6ffd('0x10'):case'SmsQueues':case _0x6ffd('0x11'):case _0x6ffd('0x12'):case'WhatsappQueues':return db[_0x417f34][_0x6ffd('0x13')](queryQueues);case _0x6ffd('0x14'):return db[_0x417f34][_0x6ffd('0x13')](queryTelephones);case _0x6ffd('0x15'):return db[_0x417f34]['findAll'](queryTrunks);case _0x6ffd('0x16'):return db[_0x417f34]['findAll'](queryCampaigns);}}else{return db[_0x6ffd('0x17')]['findAll']({'attributes':[_0x6ffd('0x18')],'where':{'sectionId':_0x23f7f2['id']},'raw':!![]})[_0x6ffd('0xc')](function(_0x45db49){if(_0x45db49){var _0x5d8aff={'where':{'id':_[_0x6ffd('0x19')](_0x45db49,_0x6ffd('0x18'))},'raw':!![]};switch(_0x417f34){case _0x6ffd('0x5'):_0x5d8aff[_0x6ffd('0x1a')][_0x6ffd('0x6')]=_0x6ffd('0x8');break;case _0x6ffd('0x1b'):_0x5d8aff[_0x6ffd('0x1a')]['type']=_0x6ffd('0xa');break;}return db[_0x417f34]['findAll'](_0x5d8aff);}else{return[];}});}}else{return[];}})['then'](function(_0x2f5ec4){return _0x2f5ec4;});}function joinOrLeaveQueues(_0x359d09,_0x50aaa2,_0x34c3c1,_0x4612a3){_0x359d09[_0x50aaa2](util['format']('%s:queue:%s',_0x34c3c1,_0x4612a3[_0x6ffd('0x3')]));if(_0x4612a3[_0x6ffd('0x4')]){for(var _0x4dcc50=0x0;_0x4dcc50<_0x4612a3[_0x6ffd('0x4')][_0x6ffd('0x1c')];_0x4dcc50+=0x1){_0x359d09[_0x50aaa2](util[_0x6ffd('0x1d')]('user:%s',_0x4612a3[_0x6ffd('0x4')][_0x4dcc50][_0x6ffd('0x3')]));}}}function joinOrLeave(_0x50896b,_0x356c9c,_0x438d1a){var _0x50c19a;if(_0x50896b[_0x6ffd('0x1e')][_0x6ffd('0x1f')]['id']){db[_0x6ffd('0x5')]['find']({'attributes':['id',_0x6ffd('0x3'),_0x6ffd('0x6'),_0x6ffd('0x20')],'where':{'id':_0x50896b['handshake'][_0x6ffd('0x1f')]['id']},'include':[{'model':db['ChatInteraction'],'as':_0x6ffd('0x21'),'attributes':['id'],'raw':!![]},{'model':db[_0x6ffd('0x22')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':_0x6ffd('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0x6ffd('0x24')],'as':_0x6ffd('0x25'),'attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x6ffd('0x26')],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})[_0x6ffd('0xc')](function(_0x20c007){if(_0x20c007){_0x50c19a=_0x20c007;_0x50896b[_0x356c9c](util['format'](_0x6ffd('0x27'),_0x20c007[_0x6ffd('0x3')]));var _0x442b2c=[];switch(_0x20c007[_0x6ffd('0x6')]){case _0x6ffd('0x28'):_0x50896b[_0x356c9c](_0x6ffd('0x29'));_0x50896b[_0x356c9c](_0x6ffd('0x2a'));if(queryQueues[_0x6ffd('0x2b')](_0x6ffd('0x2c'))){delete queryQueues[_0x6ffd('0x2c')];}_0x442b2c[_0x6ffd('0x2d')](db[_0x6ffd('0x2e')][_0x6ffd('0x13')](queryQueues));_0x442b2c['push'](db['ChatQueue']['findAll'](queryQueues));_0x442b2c[_0x6ffd('0x2d')](db[_0x6ffd('0x2f')][_0x6ffd('0x13')](queryQueues));_0x442b2c[_0x6ffd('0x2d')](db[_0x6ffd('0x30')][_0x6ffd('0x13')](queryQueues));_0x442b2c[_0x6ffd('0x2d')](db[_0x6ffd('0x31')][_0x6ffd('0x13')](queryQueues));_0x442b2c[_0x6ffd('0x2d')](db[_0x6ffd('0x32')][_0x6ffd('0x13')](queryQueues));_0x442b2c[_0x6ffd('0x2d')](db['WhatsappQueue'][_0x6ffd('0x13')](queryQueues));_0x442b2c[_0x6ffd('0x2d')](db[_0x6ffd('0x5')][_0x6ffd('0x13')](queryTelephones));_0x442b2c['push'](db[_0x6ffd('0x33')]['findAll'](queryTrunks));_0x442b2c['push'](db[_0x6ffd('0x1b')][_0x6ffd('0x13')](queryCampaigns));_0x442b2c[_0x6ffd('0x2d')](db[_0x6ffd('0x5')]['findAll'](queryAgents));break;case _0x6ffd('0x34'):_0x50896b[_0x356c9c]('voice:inbound');_0x50896b[_0x356c9c](_0x6ffd('0x2a'));_0x442b2c[_0x6ffd('0x2d')](getAssociatedResources(_0x6ffd('0xe'),_0x20c007[_0x6ffd('0x20')],_0x6ffd('0x2e')));_0x442b2c['push'](getAssociatedResources('ChatQueues',_0x20c007[_0x6ffd('0x20')],'ChatQueue'));_0x442b2c[_0x6ffd('0x2d')](getAssociatedResources(_0x6ffd('0x10'),_0x20c007[_0x6ffd('0x20')],_0x6ffd('0x2f')));_0x442b2c[_0x6ffd('0x2d')](getAssociatedResources(_0x6ffd('0x35'),_0x20c007['userProfileId'],_0x6ffd('0x30')));_0x442b2c[_0x6ffd('0x2d')](getAssociatedResources(_0x6ffd('0x11'),_0x20c007[_0x6ffd('0x20')],'MailQueue'));_0x442b2c[_0x6ffd('0x2d')](getAssociatedResources('OpenchannelQueues',_0x20c007[_0x6ffd('0x20')],_0x6ffd('0x32')));_0x442b2c[_0x6ffd('0x2d')](getAssociatedResources('WhatsappQueues',_0x20c007[_0x6ffd('0x20')],_0x6ffd('0x36')));_0x442b2c[_0x6ffd('0x2d')](getAssociatedResources(_0x6ffd('0x14'),_0x20c007[_0x6ffd('0x20')],_0x6ffd('0x5')));_0x442b2c[_0x6ffd('0x2d')](getAssociatedResources('Trunks',_0x20c007['userProfileId'],'Trunk'));_0x442b2c[_0x6ffd('0x2d')](getAssociatedResources(_0x6ffd('0x16'),_0x20c007['userProfileId'],_0x6ffd('0x1b')));_0x442b2c[_0x6ffd('0x2d')](db[_0x6ffd('0x5')][_0x6ffd('0x13')](queryAgents));break;case'agent':_0x50896b[_0x356c9c](_0x6ffd('0x29'));_0x50896b[_0x356c9c](_0x6ffd('0x2a'));_0x442b2c[_0x6ffd('0x2d')](_0x20c007[_0x6ffd('0x37')]({'attributes':['id',_0x6ffd('0x3')]}));_0x442b2c[_0x6ffd('0x2d')](_0x20c007[_0x6ffd('0x38')]({'attributes':['id',_0x6ffd('0x3')]}));_0x442b2c[_0x6ffd('0x2d')](_0x20c007[_0x6ffd('0x39')]({'attributes':['id',_0x6ffd('0x3')]}));_0x442b2c['push'](_0x20c007['getSmsQueues']({'attributes':['id','name']}));_0x442b2c[_0x6ffd('0x2d')](_0x20c007[_0x6ffd('0x3a')]({'attributes':['id','name']}));_0x442b2c[_0x6ffd('0x2d')](_0x20c007[_0x6ffd('0x3b')]({'attributes':['id',_0x6ffd('0x3')]}));_0x442b2c[_0x6ffd('0x2d')](_0x20c007[_0x6ffd('0x3c')]({'attributes':['id','name']}));break;}return BPromise[_0x6ffd('0x3d')](_0x442b2c);}})[_0x6ffd('0xc')](function(_0x45f4aa){if(_0x45f4aa&&_0x45f4aa['length']){for(var _0x2bf7c3=0x0;_0x2bf7c3<_0x45f4aa[_0x6ffd('0x1c')];_0x2bf7c3+=0x1){for(var _0x2f8dfb=0x0;_0x2f8dfb<_0x45f4aa[_0x2bf7c3][_0x6ffd('0x1c')];_0x2f8dfb+=0x1){switch(_0x2bf7c3){case 0x0:joinOrLeaveQueues(_0x50896b,_0x356c9c,_0x6ffd('0x3e'),_0x45f4aa[_0x2bf7c3][_0x2f8dfb]);break;case 0x1:joinOrLeaveQueues(_0x50896b,_0x356c9c,_0x6ffd('0x3f'),_0x45f4aa[_0x2bf7c3][_0x2f8dfb]);break;case 0x2:joinOrLeaveQueues(_0x50896b,_0x356c9c,'fax',_0x45f4aa[_0x2bf7c3][_0x2f8dfb]);break;case 0x3:joinOrLeaveQueues(_0x50896b,_0x356c9c,_0x6ffd('0x40'),_0x45f4aa[_0x2bf7c3][_0x2f8dfb]);break;case 0x4:joinOrLeaveQueues(_0x50896b,_0x356c9c,_0x6ffd('0x41'),_0x45f4aa[_0x2bf7c3][_0x2f8dfb]);break;case 0x5:joinOrLeaveQueues(_0x50896b,_0x356c9c,_0x6ffd('0x42'),_0x45f4aa[_0x2bf7c3][_0x2f8dfb]);break;case 0x6:joinOrLeaveQueues(_0x50896b,_0x356c9c,_0x6ffd('0x43'),_0x45f4aa[_0x2bf7c3][_0x2f8dfb]);break;case 0x7:if(_0x50c19a[_0x6ffd('0x6')]!==_0x6ffd('0x7'))_0x50896b[_0x356c9c](util[_0x6ffd('0x1d')]('telephone:%s',_0x45f4aa[_0x2bf7c3][_0x2f8dfb][_0x6ffd('0x3')]));break;case 0x8:if(_0x50c19a[_0x6ffd('0x6')]!=='agent')_0x50896b[_0x356c9c](util['format']('trunk:%s',_0x45f4aa[_0x2bf7c3][_0x2f8dfb][_0x6ffd('0x3')]));break;case 0x9:if(_0x50c19a['role']!==_0x6ffd('0x7'))_0x50896b[_0x356c9c](util[_0x6ffd('0x1d')](_0x6ffd('0x44'),_0x45f4aa[_0x2bf7c3][_0x2f8dfb][_0x6ffd('0x9')],_0x45f4aa[_0x2bf7c3][_0x2f8dfb]['name']));break;case 0xa:_0x50896b[_0x356c9c](util[_0x6ffd('0x1d')](_0x6ffd('0x27'),_0x45f4aa[_0x2bf7c3][_0x2f8dfb][_0x6ffd('0x3')]));break;}}}}})['then'](function(){if(_0x356c9c===_0x6ffd('0x45')){var _0x16b6b5=_['map'](_0x50c19a['ChatInteractions'],'id');return _0x50c19a[_0x6ffd('0x46')](_0x16b6b5)[_0x6ffd('0xc')](function(){for(var _0x25d7e3=0x0;_0x25d7e3<_0x16b6b5[_0x6ffd('0x1c')];_0x25d7e3+=0x1){_0x438d1a[_0x6ffd('0x47')](_0x6ffd('0x48'),{'ChatInteractionId':Number(_0x16b6b5[_0x25d7e3]),'UserId':Number(_0x50c19a['id'])});}});}})[_0x6ffd('0xc')](function(){if(_0x356c9c==='leave'){var _0x1e5834=_[_0x6ffd('0x19')](_0x50c19a[_0x6ffd('0x49')],'id');return _0x50c19a['removeMailInteractions'](_0x1e5834)['then'](function(){for(var _0x41043f=0x0;_0x41043f<_0x1e5834[_0x6ffd('0x1c')];_0x41043f+=0x1){_0x438d1a[_0x6ffd('0x47')](_0x6ffd('0x4a'),{'MailInteractionId':Number(_0x1e5834[_0x41043f]),'UserId':Number(_0x50c19a['id'])});}});}})['then'](function(){if(_0x356c9c===_0x6ffd('0x45')){var _0x3fc72f=_[_0x6ffd('0x19')](_0x50c19a[_0x6ffd('0x23')],'id');return _0x50c19a[_0x6ffd('0x4b')](_0x3fc72f)[_0x6ffd('0xc')](function(){for(var _0x4ca29b=0x0;_0x4ca29b<_0x3fc72f[_0x6ffd('0x1c')];_0x4ca29b+=0x1){_0x438d1a[_0x6ffd('0x47')](_0x6ffd('0x4c'),{'FaxInteractionId':Number(_0x3fc72f[_0x4ca29b]),'UserId':Number(_0x50c19a['id'])});}});}})[_0x6ffd('0xc')](function(){if(_0x356c9c===_0x6ffd('0x45')){var _0x4b87fc=_[_0x6ffd('0x19')](_0x50c19a[_0x6ffd('0x25')],'id');return _0x50c19a[_0x6ffd('0x4d')](_0x4b87fc)[_0x6ffd('0xc')](function(){for(var _0x3f8ef3=0x0;_0x3f8ef3<_0x4b87fc['length'];_0x3f8ef3+=0x1){_0x438d1a[_0x6ffd('0x47')](_0x6ffd('0x4e'),{'SmsInteractionId':Number(_0x4b87fc[_0x3f8ef3]),'UserId':Number(_0x50c19a['id'])});}});}})[_0x6ffd('0xc')](function(){if(_0x356c9c==='leave'){var _0x3ba9c5=_[_0x6ffd('0x19')](_0x50c19a['OpenchannelInteractions'],'id');return _0x50c19a[_0x6ffd('0x4f')](_0x3ba9c5)['then'](function(){for(var _0x1c060a=0x0;_0x1c060a<_0x3ba9c5[_0x6ffd('0x1c')];_0x1c060a+=0x1){_0x438d1a['emit'](_0x6ffd('0x50'),{'OpenchannelInteractionId':Number(_0x3ba9c5[_0x1c060a]),'UserId':Number(_0x50c19a['id'])});}});}})['then'](function(){if(_0x356c9c===_0x6ffd('0x45')){var _0x186f1e=_[_0x6ffd('0x19')](_0x50c19a[_0x6ffd('0x51')],'id');return _0x50c19a[_0x6ffd('0x52')](_0x186f1e)['then'](function(){for(var _0x111a7d=0x0;_0x111a7d<_0x186f1e[_0x6ffd('0x1c')];_0x111a7d+=0x1){_0x438d1a[_0x6ffd('0x47')](_0x6ffd('0x53'),{'WhatsappInteractionId':Number(_0x186f1e[_0x111a7d]),'UserId':Number(_0x50c19a['id'])});}});}})['catch'](function(_0x38a627){_0x50896b[_0x6ffd('0x54')](_0x38a627);});}}function onDisconnect(_0x46f9bc,_0x4e1198){joinOrLeave(_0x46f9bc,_0x6ffd('0x45'),_0x4e1198);}function onConnect(_0x51cf91){joinOrLeave(_0x51cf91,_0x6ffd('0x55'));}exports['default']=function(_0x363959){_0x363959['on'](_0x6ffd('0x56'),function(_0xb618ef){_0xb618ef[_0x6ffd('0x57')](0x0);_0xb618ef['address']=_0xb618ef[_0x6ffd('0x58')][_0x6ffd('0x56')][_0x6ffd('0x59')]+':'+_0xb618ef[_0x6ffd('0x58')][_0x6ffd('0x56')][_0x6ffd('0x5a')];_0xb618ef[_0x6ffd('0x5b')]=new Date();_0xb618ef[_0x6ffd('0x54')]=function(_0x3c9f20){console[_0x6ffd('0x54')](_0x6ffd('0x5c')+_0xb618ef[_0x6ffd('0x5d')][_0x6ffd('0x3')]+'['+_0xb618ef[_0x6ffd('0x5e')]+']',_0x3c9f20);};_0xb618ef['on'](_0x6ffd('0x5f'),function(){onDisconnect(_0xb618ef,_0x363959);_0xb618ef[_0x6ffd('0x54')](_0x6ffd('0x60'));});onConnect(_0xb618ef);_0xb618ef[_0x6ffd('0x54')](_0x6ffd('0x61'));});}; \ No newline at end of file +var _0xf03d=['MailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','join','setMaxListeners','address','request','connection','remoteAddress','remotePort','connectedAt','log','SocketIO\x20','DISCONNECTED','CONNECTED','lodash','util','bluebird','./environment','name','Agents','User','role','agent','telephone','ivr','then','autoAssociation','SmsQueues','MailQueues','WhatsappQueues','findAll','Telephones','Trunks','UserProfileResource','resourceId','map','where','Campaign','type','format','handshake','query','find','ChatInteraction','MailInteraction','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','user:%s','voice:inbound','include','push','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','voice:outbound','userProfileId','VoiceQueue','ChatQueues','OpenchannelQueues','IvrCampaigns','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','all','length','voice','chat','sms','openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','leave','ChatInteractions','removeChatInteractions','emit'];(function(_0x2fd69d,_0xeb1037){var _0x5d5ef3=function(_0xa9ea9e){while(--_0xa9ea9e){_0x2fd69d['push'](_0x2fd69d['shift']());}};_0x5d5ef3(++_0xeb1037);}(_0xf03d,0x1a7));var _0xdf03=function(_0x25f1ca,_0x537517){_0x25f1ca=_0x25f1ca-0x0;var _0x191ccb=_0xf03d[_0x25f1ca];return _0x191ccb;};'use strict';var _=require(_0xdf03('0x0'));var util=require(_0xdf03('0x1'));var BPromise=require(_0xdf03('0x2'));var db=require('../mysqldb')['db'];var config=require(_0xdf03('0x3'));var queryQueues={'attributes':['id',_0xdf03('0x4')],'include':[{'as':_0xdf03('0x5'),'model':db[_0xdf03('0x6')],'attributes':['id',_0xdf03('0x4'),_0xdf03('0x7')],'raw':!![],'where':{'role':_0xdf03('0x8')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xdf03('0x4')],'where':{'role':_0xdf03('0x9')}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id',_0xdf03('0x4')],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id',_0xdf03('0x4'),'type'],'where':{'type':_0xdf03('0xa')}};function getAssociatedResources(_0x71aa5f,_0x456961,_0x2ed1d2){return db['UserProfileSection']['findOne']({'where':{'name':_0x71aa5f,'userProfileId':_0x456961},'raw':!![]})[_0xdf03('0xb')](function(_0xda7f09){if(_0xda7f09){if(_0xda7f09[_0xdf03('0xc')]){switch(_0x71aa5f){case'VoiceQueues':case'ChatQueues':case'FaxQueues':case _0xdf03('0xd'):case _0xdf03('0xe'):case'OpenchannelQueues':case _0xdf03('0xf'):return db[_0x2ed1d2][_0xdf03('0x10')](queryQueues);case _0xdf03('0x11'):return db[_0x2ed1d2][_0xdf03('0x10')](queryTelephones);case _0xdf03('0x12'):return db[_0x2ed1d2]['findAll'](queryTrunks);case'IvrCampaigns':return db[_0x2ed1d2]['findAll'](queryCampaigns);}}else{return db[_0xdf03('0x13')][_0xdf03('0x10')]({'attributes':[_0xdf03('0x14')],'where':{'sectionId':_0xda7f09['id']},'raw':!![]})[_0xdf03('0xb')](function(_0x5c82e3){if(_0x5c82e3){var _0x43ab5d={'where':{'id':_[_0xdf03('0x15')](_0x5c82e3,_0xdf03('0x14'))},'raw':!![]};switch(_0x2ed1d2){case _0xdf03('0x6'):_0x43ab5d[_0xdf03('0x16')][_0xdf03('0x7')]=_0xdf03('0x9');break;case _0xdf03('0x17'):_0x43ab5d['where'][_0xdf03('0x18')]='ivr';break;}return db[_0x2ed1d2][_0xdf03('0x10')](_0x43ab5d);}else{return[];}});}}else{return[];}})[_0xdf03('0xb')](function(_0x1af90e){return _0x1af90e;});}function joinOrLeaveQueues(_0x472b47,_0xe37f16,_0x3e5585,_0x134802){_0x472b47[_0xe37f16](util[_0xdf03('0x19')]('%s:queue:%s',_0x3e5585,_0x134802[_0xdf03('0x4')]));if(_0x134802[_0xdf03('0x5')]){for(var _0x5f1abb=0x0;_0x5f1abb<_0x134802[_0xdf03('0x5')]['length'];_0x5f1abb+=0x1){_0x472b47[_0xe37f16](util[_0xdf03('0x19')]('user:%s',_0x134802[_0xdf03('0x5')][_0x5f1abb][_0xdf03('0x4')]));}}}function joinOrLeave(_0x3f35ea,_0x4a8890,_0xca8804){var _0x3879f4;if(_0x3f35ea[_0xdf03('0x1a')][_0xdf03('0x1b')]['id']){db[_0xdf03('0x6')][_0xdf03('0x1c')]({'attributes':['id',_0xdf03('0x4'),'role','userProfileId'],'where':{'id':_0x3f35ea[_0xdf03('0x1a')][_0xdf03('0x1b')]['id']},'include':[{'model':db[_0xdf03('0x1d')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xdf03('0x1e')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xdf03('0x1f')],'as':_0xdf03('0x20'),'attributes':['id'],'raw':!![]},{'model':db[_0xdf03('0x21')],'as':_0xdf03('0x22'),'attributes':['id'],'raw':!![]},{'model':db[_0xdf03('0x23')],'as':_0xdf03('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0xdf03('0x25')],'as':_0xdf03('0x26'),'attributes':['id'],'raw':!![]}]})[_0xdf03('0xb')](function(_0x587303){if(_0x587303){_0x3879f4=_0x587303;_0x3f35ea[_0x4a8890](util[_0xdf03('0x19')](_0xdf03('0x27'),_0x587303['name']));var _0x31c04b=[];switch(_0x587303[_0xdf03('0x7')]){case'admin':_0x3f35ea[_0x4a8890](_0xdf03('0x28'));_0x3f35ea[_0x4a8890]('voice:outbound');if(queryQueues['hasOwnProperty'](_0xdf03('0x29'))){delete queryQueues[_0xdf03('0x29')];}_0x31c04b[_0xdf03('0x2a')](db['VoiceQueue'][_0xdf03('0x10')](queryQueues));_0x31c04b['push'](db[_0xdf03('0x2b')]['findAll'](queryQueues));_0x31c04b['push'](db[_0xdf03('0x2c')]['findAll'](queryQueues));_0x31c04b['push'](db[_0xdf03('0x2d')]['findAll'](queryQueues));_0x31c04b[_0xdf03('0x2a')](db[_0xdf03('0x2e')]['findAll'](queryQueues));_0x31c04b[_0xdf03('0x2a')](db[_0xdf03('0x2f')]['findAll'](queryQueues));_0x31c04b[_0xdf03('0x2a')](db[_0xdf03('0x30')]['findAll'](queryQueues));_0x31c04b[_0xdf03('0x2a')](db[_0xdf03('0x6')]['findAll'](queryTelephones));_0x31c04b[_0xdf03('0x2a')](db[_0xdf03('0x31')]['findAll'](queryTrunks));_0x31c04b[_0xdf03('0x2a')](db[_0xdf03('0x17')]['findAll'](queryCampaigns));_0x31c04b[_0xdf03('0x2a')](db[_0xdf03('0x6')][_0xdf03('0x10')](queryAgents));break;case _0xdf03('0x32'):_0x3f35ea[_0x4a8890](_0xdf03('0x28'));_0x3f35ea[_0x4a8890](_0xdf03('0x33'));_0x31c04b[_0xdf03('0x2a')](getAssociatedResources('VoiceQueues',_0x587303[_0xdf03('0x34')],_0xdf03('0x35')));_0x31c04b[_0xdf03('0x2a')](getAssociatedResources(_0xdf03('0x36'),_0x587303[_0xdf03('0x34')],_0xdf03('0x2b')));_0x31c04b[_0xdf03('0x2a')](getAssociatedResources('FaxQueues',_0x587303[_0xdf03('0x34')],_0xdf03('0x2c')));_0x31c04b[_0xdf03('0x2a')](getAssociatedResources('SmsQueues',_0x587303[_0xdf03('0x34')],_0xdf03('0x2d')));_0x31c04b[_0xdf03('0x2a')](getAssociatedResources(_0xdf03('0xe'),_0x587303['userProfileId'],_0xdf03('0x2e')));_0x31c04b[_0xdf03('0x2a')](getAssociatedResources(_0xdf03('0x37'),_0x587303['userProfileId'],_0xdf03('0x2f')));_0x31c04b[_0xdf03('0x2a')](getAssociatedResources(_0xdf03('0xf'),_0x587303[_0xdf03('0x34')],'WhatsappQueue'));_0x31c04b['push'](getAssociatedResources('Telephones',_0x587303[_0xdf03('0x34')],_0xdf03('0x6')));_0x31c04b[_0xdf03('0x2a')](getAssociatedResources(_0xdf03('0x12'),_0x587303[_0xdf03('0x34')],_0xdf03('0x31')));_0x31c04b['push'](getAssociatedResources(_0xdf03('0x38'),_0x587303[_0xdf03('0x34')],_0xdf03('0x17')));_0x31c04b[_0xdf03('0x2a')](db['User'][_0xdf03('0x10')](queryAgents));break;case _0xdf03('0x8'):_0x3f35ea[_0x4a8890](_0xdf03('0x28'));_0x3f35ea[_0x4a8890]('voice:outbound');_0x31c04b['push'](_0x587303[_0xdf03('0x39')]({'attributes':['id',_0xdf03('0x4')]}));_0x31c04b['push'](_0x587303[_0xdf03('0x3a')]({'attributes':['id',_0xdf03('0x4')]}));_0x31c04b['push'](_0x587303[_0xdf03('0x3b')]({'attributes':['id',_0xdf03('0x4')]}));_0x31c04b[_0xdf03('0x2a')](_0x587303[_0xdf03('0x3c')]({'attributes':['id',_0xdf03('0x4')]}));_0x31c04b[_0xdf03('0x2a')](_0x587303[_0xdf03('0x3d')]({'attributes':['id','name']}));_0x31c04b[_0xdf03('0x2a')](_0x587303[_0xdf03('0x3e')]({'attributes':['id','name']}));_0x31c04b['push'](_0x587303['getWhatsappQueues']({'attributes':['id',_0xdf03('0x4')]}));break;}return BPromise[_0xdf03('0x3f')](_0x31c04b);}})[_0xdf03('0xb')](function(_0x214bbc){if(_0x214bbc&&_0x214bbc[_0xdf03('0x40')]){for(var _0xc76cd9=0x0;_0xc76cd9<_0x214bbc[_0xdf03('0x40')];_0xc76cd9+=0x1){for(var _0x285949=0x0;_0x285949<_0x214bbc[_0xc76cd9][_0xdf03('0x40')];_0x285949+=0x1){switch(_0xc76cd9){case 0x0:joinOrLeaveQueues(_0x3f35ea,_0x4a8890,_0xdf03('0x41'),_0x214bbc[_0xc76cd9][_0x285949]);break;case 0x1:joinOrLeaveQueues(_0x3f35ea,_0x4a8890,_0xdf03('0x42'),_0x214bbc[_0xc76cd9][_0x285949]);break;case 0x2:joinOrLeaveQueues(_0x3f35ea,_0x4a8890,'fax',_0x214bbc[_0xc76cd9][_0x285949]);break;case 0x3:joinOrLeaveQueues(_0x3f35ea,_0x4a8890,_0xdf03('0x43'),_0x214bbc[_0xc76cd9][_0x285949]);break;case 0x4:joinOrLeaveQueues(_0x3f35ea,_0x4a8890,'mail',_0x214bbc[_0xc76cd9][_0x285949]);break;case 0x5:joinOrLeaveQueues(_0x3f35ea,_0x4a8890,_0xdf03('0x44'),_0x214bbc[_0xc76cd9][_0x285949]);break;case 0x6:joinOrLeaveQueues(_0x3f35ea,_0x4a8890,_0xdf03('0x45'),_0x214bbc[_0xc76cd9][_0x285949]);break;case 0x7:if(_0x3879f4[_0xdf03('0x7')]!=='agent')_0x3f35ea[_0x4a8890](util[_0xdf03('0x19')](_0xdf03('0x46'),_0x214bbc[_0xc76cd9][_0x285949][_0xdf03('0x4')]));break;case 0x8:if(_0x3879f4[_0xdf03('0x7')]!=='agent')_0x3f35ea[_0x4a8890](util[_0xdf03('0x19')](_0xdf03('0x47'),_0x214bbc[_0xc76cd9][_0x285949]['name']));break;case 0x9:if(_0x3879f4['role']!==_0xdf03('0x8'))_0x3f35ea[_0x4a8890](util[_0xdf03('0x19')](_0xdf03('0x48'),_0x214bbc[_0xc76cd9][_0x285949][_0xdf03('0x18')],_0x214bbc[_0xc76cd9][_0x285949][_0xdf03('0x4')]));break;case 0xa:_0x3f35ea[_0x4a8890](util['format'](_0xdf03('0x27'),_0x214bbc[_0xc76cd9][_0x285949][_0xdf03('0x4')]));break;}}}}})[_0xdf03('0xb')](function(){if(_0x4a8890===_0xdf03('0x49')){var _0x1b71e6=_[_0xdf03('0x15')](_0x3879f4[_0xdf03('0x4a')],'id');return _0x3879f4[_0xdf03('0x4b')](_0x1b71e6)['then'](function(){for(var _0x3cd3fb=0x0;_0x3cd3fb<_0x1b71e6[_0xdf03('0x40')];_0x3cd3fb+=0x1){_0xca8804[_0xdf03('0x4c')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x1b71e6[_0x3cd3fb]),'UserId':Number(_0x3879f4['id'])});}});}})[_0xdf03('0xb')](function(){if(_0x4a8890==='leave'){var _0x25781d=_[_0xdf03('0x15')](_0x3879f4[_0xdf03('0x4d')],'id');return _0x3879f4['removeMailInteractions'](_0x25781d)[_0xdf03('0xb')](function(){for(var _0x582553=0x0;_0x582553<_0x25781d[_0xdf03('0x40')];_0x582553+=0x1){_0xca8804[_0xdf03('0x4c')](_0xdf03('0x4e'),{'MailInteractionId':Number(_0x25781d[_0x582553]),'UserId':Number(_0x3879f4['id'])});}});}})['then'](function(){if(_0x4a8890===_0xdf03('0x49')){var _0x3c9180=_[_0xdf03('0x15')](_0x3879f4[_0xdf03('0x20')],'id');return _0x3879f4[_0xdf03('0x4f')](_0x3c9180)[_0xdf03('0xb')](function(){for(var _0x22952f=0x0;_0x22952f<_0x3c9180[_0xdf03('0x40')];_0x22952f+=0x1){_0xca8804[_0xdf03('0x4c')](_0xdf03('0x50'),{'FaxInteractionId':Number(_0x3c9180[_0x22952f]),'UserId':Number(_0x3879f4['id'])});}});}})[_0xdf03('0xb')](function(){if(_0x4a8890===_0xdf03('0x49')){var _0x3fc0b5=_['map'](_0x3879f4[_0xdf03('0x22')],'id');return _0x3879f4[_0xdf03('0x51')](_0x3fc0b5)[_0xdf03('0xb')](function(){for(var _0x2136f3=0x0;_0x2136f3<_0x3fc0b5[_0xdf03('0x40')];_0x2136f3+=0x1){_0xca8804[_0xdf03('0x4c')](_0xdf03('0x52'),{'SmsInteractionId':Number(_0x3fc0b5[_0x2136f3]),'UserId':Number(_0x3879f4['id'])});}});}})['then'](function(){if(_0x4a8890===_0xdf03('0x49')){var _0x3301dc=_[_0xdf03('0x15')](_0x3879f4['OpenchannelInteractions'],'id');return _0x3879f4[_0xdf03('0x53')](_0x3301dc)[_0xdf03('0xb')](function(){for(var _0x30e709=0x0;_0x30e709<_0x3301dc[_0xdf03('0x40')];_0x30e709+=0x1){_0xca8804[_0xdf03('0x4c')](_0xdf03('0x54'),{'OpenchannelInteractionId':Number(_0x3301dc[_0x30e709]),'UserId':Number(_0x3879f4['id'])});}});}})[_0xdf03('0xb')](function(){if(_0x4a8890===_0xdf03('0x49')){var _0xf02a97=_['map'](_0x3879f4[_0xdf03('0x26')],'id');return _0x3879f4[_0xdf03('0x55')](_0xf02a97)[_0xdf03('0xb')](function(){for(var _0x107387=0x0;_0x107387<_0xf02a97[_0xdf03('0x40')];_0x107387+=0x1){_0xca8804['emit'](_0xdf03('0x56'),{'WhatsappInteractionId':Number(_0xf02a97[_0x107387]),'UserId':Number(_0x3879f4['id'])});}});}})[_0xdf03('0x57')](function(_0x420148){_0x3f35ea['log'](_0x420148);});}}function onDisconnect(_0x31ae71,_0x2fd38d){joinOrLeave(_0x31ae71,_0xdf03('0x49'),_0x2fd38d);}function onConnect(_0x5d2c9e){joinOrLeave(_0x5d2c9e,_0xdf03('0x58'));}exports['default']=function(_0x778de2){_0x778de2['on']('connection',function(_0x3591da){_0x3591da[_0xdf03('0x59')](0x0);_0x3591da[_0xdf03('0x5a')]=_0x3591da[_0xdf03('0x5b')][_0xdf03('0x5c')][_0xdf03('0x5d')]+':'+_0x3591da['request']['connection'][_0xdf03('0x5e')];_0x3591da[_0xdf03('0x5f')]=new Date();_0x3591da[_0xdf03('0x60')]=function(_0x49c98b){console[_0xdf03('0x60')](_0xdf03('0x61')+_0x3591da['nsp'][_0xdf03('0x4')]+'['+_0x3591da[_0xdf03('0x5a')]+']',_0x49c98b);};_0x3591da['on']('disconnect',function(){onDisconnect(_0x3591da,_0x778de2);_0x3591da[_0xdf03('0x60')](_0xdf03('0x62'));});onConnect(_0x3591da);_0x3591da[_0xdf03('0x60')](_0xdf03('0x63'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 428061b..df19547 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 _0xb913=['SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','query','Sequelize','QueryTypes','SELECT','contact','UserId','undefined','format','SIP/%s','agent','outgoingmessage','AfterCreateMessage','event','opened','interface','AfterCreate','changed','closed','substatus','AfterUpdate','User','name','fullname','email','internal','default','length','model','hook','callback','toLowerCase','condition','jayson/promise','../logger','triggers','client','http','newinteraction','Chat','ChatInteraction','afterUpdate','ChatMessage','newmessage','Sms','SmsInteraction','afterCreate','closedinteraction','SmsMessage','Whatsapp','WhatsappInteraction','WhatsappMessage','Fax','FaxInteraction','FaxMessage','MailInteraction','Mail','MailMessage','Openchannel','OpenchannelInteraction','request','EventManager','info','Trigger,\x20%s','error','code','catch','get','channel','motionChannel','direction','resolve','then','ContactId'];(function(_0x22357d,_0x4e220b){var _0x4a42a9=function(_0x4bc4c5){while(--_0x4bc4c5){_0x22357d['push'](_0x22357d['shift']());}};_0x4a42a9(++_0x4e220b);}(_0xb913,0x6b));var _0x3b91=function(_0x5be4f4,_0x2c2924){_0x5be4f4=_0x5be4f4-0x0;var _0x241aeb=_0xb913[_0x5be4f4];return _0x241aeb;};'use strict';var util=require('util');var db=require('../../mysqldb')['db'];var jayson=require(_0x3b91('0x0'));var logger=require(_0x3b91('0x1'))(_0x3b91('0x2'));var client=jayson[_0x3b91('0x3')][_0x3b91('0x4')]({'port':0x232a});var triggers=[{'channel':'Chat','model':'ChatInteraction','event':'afterCreate','condition':_0x3b91('0x5'),'callback':afterCreate},{'channel':_0x3b91('0x6'),'model':_0x3b91('0x7'),'event':_0x3b91('0x8'),'condition':'closedinteraction','callback':afterUpdate},{'channel':'Chat','model':_0x3b91('0x9'),'event':'afterCreate','condition':_0x3b91('0xa'),'callback':afterCreateMessage},{'channel':_0x3b91('0xb'),'model':_0x3b91('0xc'),'event':_0x3b91('0xd'),'condition':_0x3b91('0x5'),'callback':afterCreate},{'channel':_0x3b91('0xb'),'model':_0x3b91('0xc'),'event':_0x3b91('0x8'),'condition':_0x3b91('0xe'),'callback':afterUpdate},{'channel':_0x3b91('0xb'),'model':_0x3b91('0xf'),'event':_0x3b91('0xd'),'condition':_0x3b91('0xa'),'callback':afterCreateMessage},{'channel':_0x3b91('0x10'),'model':'WhatsappInteraction','event':_0x3b91('0xd'),'condition':_0x3b91('0x5'),'callback':afterCreate},{'channel':_0x3b91('0x10'),'model':_0x3b91('0x11'),'event':_0x3b91('0x8'),'condition':_0x3b91('0xe'),'callback':afterUpdate},{'channel':'Whatsapp','model':_0x3b91('0x12'),'event':_0x3b91('0xd'),'condition':_0x3b91('0xa'),'callback':afterCreateMessage},{'channel':_0x3b91('0x13'),'model':_0x3b91('0x14'),'event':_0x3b91('0xd'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x3b91('0x13'),'model':'FaxInteraction','event':_0x3b91('0x8'),'condition':_0x3b91('0xe'),'callback':afterUpdate},{'channel':_0x3b91('0x13'),'model':_0x3b91('0x15'),'event':_0x3b91('0xd'),'condition':_0x3b91('0xa'),'callback':afterCreateMessage},{'channel':'Mail','model':_0x3b91('0x16'),'event':_0x3b91('0xd'),'condition':_0x3b91('0x5'),'callback':afterCreate},{'channel':_0x3b91('0x17'),'model':_0x3b91('0x16'),'event':_0x3b91('0x8'),'condition':_0x3b91('0xe'),'callback':afterUpdate},{'channel':_0x3b91('0x17'),'model':_0x3b91('0x18'),'event':_0x3b91('0xd'),'condition':_0x3b91('0xa'),'callback':afterCreateMessage},{'channel':_0x3b91('0x19'),'model':_0x3b91('0x1a'),'event':_0x3b91('0xd'),'condition':_0x3b91('0x5'),'callback':afterCreate},{'channel':_0x3b91('0x19'),'model':_0x3b91('0x1a'),'event':'afterUpdate','condition':_0x3b91('0xe'),'callback':afterUpdate},{'channel':_0x3b91('0x19'),'model':'OpenchannelMessage','event':'afterCreate','condition':'newmessage','callback':afterCreateMessage}];function request(_0x521d2a){return client[_0x3b91('0x1b')](_0x3b91('0x1c'),_0x521d2a)['then'](function(_0x147ef9){logger[_0x3b91('0x1d')](_0x3b91('0x1e'),_0x3b91('0x1c'),_0x147ef9);if(_0x147ef9[_0x3b91('0x1f')]){if(_0x147ef9['error'][_0x3b91('0x20')]===0x1f4){logger[_0x3b91('0x1f')](_0x3b91('0x1e'),_0x3b91('0x1c'),_0x147ef9[_0x3b91('0x1f')]);}}})[_0x3b91('0x21')](function(_0x3a736e){logger[_0x3b91('0x1f')]('Trigger,\x20%s',_0x3b91('0x1c'),_0x3a736e);});}function afterCreateMessage(_0x57c512){return function(_0x441b16){_0x441b16=_0x441b16[_0x3b91('0x22')]({'plain':!![]});_0x441b16[_0x3b91('0x23')]=_0x57c512;_0x441b16[_0x3b91('0x24')]=_0x57c512;_0x441b16['event']=_0x441b16[_0x3b91('0x25')];Promise[_0x3b91('0x26')]()[_0x3b91('0x27')](function(){if(typeof _0x441b16[_0x3b91('0x28')]==='undefined')return null;var _0x3fa42d=_0x3b91('0x29')+_0x441b16['ContactId'];return db['sequelize'][_0x3b91('0x2a')](_0x3fa42d,{'type':db[_0x3b91('0x2b')][_0x3b91('0x2c')][_0x3b91('0x2d')],'raw':!![]});})[_0x3b91('0x27')](function(_0x1d91f3){if(_0x1d91f3){_0x441b16[_0x3b91('0x2e')]=_0x1d91f3[0x0];}if(typeof _0x441b16[_0x3b91('0x2f')]===_0x3b91('0x30'))return;return getAgent(_0x441b16[_0x3b91('0x2f')]);})[_0x3b91('0x27')](function(_0xacfe86){if(_0xacfe86){_0x441b16['interface']=util[_0x3b91('0x31')](_0x3b91('0x32'),_0xacfe86['name']);_0x441b16[_0x3b91('0x33')]=_0xacfe86;_0x441b16['channel']=_0x57c512;return request({'event':'incomingmessage','message':_0x441b16});}else{return request({'event':_0x3b91('0x34'),'message':_0x441b16});}})['catch'](function(_0x40ad5f){logger['error'](_0x3b91('0x1e'),_0x3b91('0x35'),_0x40ad5f);});};}function afterCreate(_0x53b330,_0x279373){return function(_0x1113a7){_0x1113a7=_0x1113a7[_0x3b91('0x22')]({'plain':!![]});_0x1113a7['channel']=_0x53b330;_0x1113a7[_0x3b91('0x24')]=_0x53b330;_0x1113a7[_0x3b91('0x36')]=_0x3b91('0x37');Promise[_0x3b91('0x26')]()[_0x3b91('0x27')](function(){var _0x29cc18='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x1113a7[_0x3b91('0x28')];return db['sequelize'][_0x3b91('0x2a')](_0x29cc18,{'type':db[_0x3b91('0x2b')][_0x3b91('0x2c')][_0x3b91('0x2d')],'raw':!![]});})[_0x3b91('0x27')](function(_0x239f4c){if(_0x239f4c){_0x1113a7[_0x3b91('0x2e')]=_0x239f4c[0x0];}if(typeof _0x1113a7['UserId']===_0x3b91('0x30'))return;return getAgent(_0x1113a7[_0x3b91('0x2f')]);})[_0x3b91('0x27')](function(_0x1db2a7){if(_0x1db2a7){_0x1113a7[_0x3b91('0x38')]=util[_0x3b91('0x31')](_0x3b91('0x32'),_0x1db2a7['name']);_0x1113a7[_0x3b91('0x33')]=_0x1db2a7;}return request({'event':_0x279373,'message':_0x1113a7});})[_0x3b91('0x21')](function(_0x37df22){logger[_0x3b91('0x1f')]('Trigger,\x20%s',_0x3b91('0x39'),_0x37df22);});};}function afterUpdate(_0x3e3d16){return function(_0xa456b4){var _0xfe4b90=_0xa456b4[_0x3b91('0x3a')](_0x3b91('0x3b'))&&_0xa456b4[_0x3b91('0x3b')];var _0x48bbc6=_0xa456b4['changed'](_0x3b91('0x3c'));if(_0xfe4b90||_0x48bbc6){var _0x321d79=_0xfe4b90?'closedinteraction':_0x3b91('0x3c');var _0x37ee45=_0xa456b4[_0x3b91('0x22')]({'plain':!![]});_0x37ee45[_0x3b91('0x23')]=_0x3e3d16;_0x37ee45[_0x3b91('0x24')]=_0x3e3d16;_0x37ee45['event']=_0xfe4b90?'closed':_0x3b91('0x3c');var _0x250ae9='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x37ee45[_0x3b91('0x28')];return db['sequelize'][_0x3b91('0x2a')](_0x250ae9,{'type':db[_0x3b91('0x2b')][_0x3b91('0x2c')][_0x3b91('0x2d')],'raw':!![]})[_0x3b91('0x27')](function(_0x21f2ee){if(_0x21f2ee){_0x37ee45[_0x3b91('0x2e')]=_0x21f2ee[0x0];}if(typeof _0x37ee45['UserId']===_0x3b91('0x30'))return;return getAgent(_0x37ee45[_0x3b91('0x2f')]);})['then'](function(_0x2396d2){if(_0x2396d2){_0x37ee45['interface']=util['format']('SIP/%s',_0x2396d2['name']);_0x37ee45[_0x3b91('0x33')]=_0x2396d2;}return request({'event':_0x321d79,'message':_0x37ee45});})[_0x3b91('0x21')](function(_0x510df6){logger[_0x3b91('0x1f')]('Trigger,\x20%s',_0x3b91('0x3d'),_0x510df6);});}};}function getAgent(_0x544894){return db[_0x3b91('0x3e')]['find']({'where':{'id':_0x544894},'attributes':['id',_0x3b91('0x3f'),_0x3b91('0x40'),_0x3b91('0x41'),_0x3b91('0x42')],'raw':!![]})[_0x3b91('0x27')](function(_0x2c9e6a){return _0x2c9e6a;});}exports[_0x3b91('0x43')]=function(){for(var _0x221b06=0x0;_0x221b06=_0xf52bd4[_0x0640('0x12')]){throw Error(_0x0640('0x13'));}_0x50b67a(_0xe8bfef);})[_0x0640('0x14')](function(_0x5a295b){_0x4f0503(_0x5a295b);});});}; \ No newline at end of file +var _0x2626=['getChannels','isUndefined','blockedAt','updateAttributes','getLicense','role','agent','then','agents','Maximum\x20login\x20has\x20been\x20reached','catch','lodash','../mysqldb','./license/util','voice','chat','fax','sms','whatsapp','openchannel'];(function(_0x5defd0,_0x370ed8){var _0x2aa994=function(_0x48eda4){while(--_0x48eda4){_0x5defd0['push'](_0x5defd0['shift']());}};_0x2aa994(++_0x370ed8);}(_0x2626,0x123));var _0x6262=function(_0xdcd51,_0x1c41fd){_0xdcd51=_0xdcd51-0x0;var _0x2a173b=_0x2626[_0xdcd51];return _0x2a173b;};'use strict';var _=require(_0x6262('0x0'));var BPromise=require('bluebird');var db=require(_0x6262('0x1'))['db'];var util=require(_0x6262('0x2'));var channels=[_0x6262('0x3'),'mail',_0x6262('0x4'),_0x6262('0x5'),_0x6262('0x6'),_0x6262('0x7'),_0x6262('0x8')];exports[_0x6262('0x9')]=function(){return channels;};exports['isValidChannel']=function(_0x4447cc){_0x4447cc=_0x4447cc['toLowerCase']();return _['includes'](channels,_0x4447cc);};exports['clearBlockUser']=function(_0x3bb6ce,_0x311a58,_0x410a57,_0x5844aa){var _0x4bcc0d={'loginAttempts':_0x311a58,'blocked':_0x410a57};if(!_[_0x6262('0xa')](_0x5844aa)){_0x4bcc0d[_0x6262('0xb')]=_0x5844aa;}return _0x3bb6ce[_0x6262('0xc')](_0x4bcc0d);};exports[_0x6262('0xd')]=function(_0x20a334){return new BPromise(function(_0x4034c5,_0x252351){var _0x47986a=0x0;if(_0x20a334[_0x6262('0xe')]!=='agent'){_0x4034c5(_0x20a334);}db['User']['count']({'where':{'role':_0x6262('0xf'),'online':!![],'id':{'$ne':_0x20a334['id']}}})[_0x6262('0x10')](function(_0x9c3225){_0x47986a=_0x9c3225;return util[_0x6262('0xd')]();})[_0x6262('0x10')](function(_0x9db801){if(_0x9db801&&_0x9db801[_0x6262('0x11')]&&_0x47986a>=_0x9db801['agents']){throw Error(_0x6262('0x12'));}_0x4034c5(_0x20a334);})[_0x6262('0x13')](function(_0x277efa){_0x252351(_0x277efa);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 926df2b..f8ffe7f 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x90a8=['exports','404','status','render','send'];(function(_0x491faa,_0x4f2907){var _0x414440=function(_0x310864){while(--_0x310864){_0x491faa['push'](_0x491faa['shift']());}};_0x414440(++_0x4f2907);}(_0x90a8,0x14a));var _0x890a=function(_0x451aec,_0x56fea4){_0x451aec=_0x451aec-0x0;var _0x5ce4f3=_0x90a8[_0x451aec];return _0x5ce4f3;};'use strict';module[_0x890a('0x0')][0x194]=function pageNotFound(_0x18cdf1,_0x5ef106){var _0x42438f=_0x890a('0x1');var _0x253ad2=0x194;var _0x9c25c8={'status':_0x253ad2};_0x5ef106[_0x890a('0x2')](_0x9c25c8[_0x890a('0x2')]);_0x5ef106[_0x890a('0x3')](_0x42438f,{},function(_0x3c2902,_0x455c74){if(_0x3c2902){return _0x5ef106[_0x890a('0x2')](_0x9c25c8[_0x890a('0x2')])['json'](_0x9c25c8);}_0x5ef106[_0x890a('0x4')](_0x455c74);});}; \ No newline at end of file +var _0xe82c=['send','exports','404','status'];(function(_0xa221e7,_0x172120){var _0x7a6a7f=function(_0x1f56b8){while(--_0x1f56b8){_0xa221e7['push'](_0xa221e7['shift']());}};_0x7a6a7f(++_0x172120);}(_0xe82c,0x1dd));var _0xce82=function(_0x22e52f,_0x456eff){_0x22e52f=_0x22e52f-0x0;var _0x5f258d=_0xe82c[_0x22e52f];return _0x5f258d;};'use strict';module[_0xce82('0x0')][0x194]=function pageNotFound(_0x2329c2,_0x419d6a){var _0x50cbc9=_0xce82('0x1');var _0x2375dd=0x194;var _0x474374={'status':_0x2375dd};_0x419d6a[_0xce82('0x2')](_0x474374[_0xce82('0x2')]);_0x419d6a['render'](_0x50cbc9,{},function(_0xc35f81,_0x459e19){if(_0xc35f81){return _0x419d6a[_0xce82('0x2')](_0x474374[_0xce82('0x2')])['json'](_0x474374);}_0x419d6a[_0xce82('0x3')](_0x459e19);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 8963460..06e52a5 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe189=['OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../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','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.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','Interval','../api/interval/interval.model','Pause','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Sound','../api/sound/sound.model','Tag','Template','../api/trigger/trigger.model','Variable','Integration','../api/integration/integration.model','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','AnalyticTreeReport','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','ZendeskField','../api/intZendeskField/intZendeskField.model','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','../api/intFreshsalesField/intFreshsalesField.model','Network','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','SquareReport','SquareDetailsReport','JscriptyProject','Setting','../api/setting/setting.model','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','../api/team/team.model','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','SmsTransferReport','CmList','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','../api/whatsappInteraction/whatsappInteraction.model','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','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','User','hasOne','cascade','Recordings','hasMany','VoiceQueuesRt','Extensions','HopperFinals','UserId','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','WhatsappInteractions','SenderId','belongsTo','userProfileId','belongsToMany','Groups','chat_group_has_users','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_teams','MailInteractions','user_has_mail_interactions','FaxInteractions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','WhatsappInteraction','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','MailQueues','UserMailQueue','ChatQueues','FaxQueues','SmsQueues','OpenchannelQueues','UserOpenchannelQueue','WhatsappQueues','ChatWebsite','ChatWebsites','user_has_chat_websites','FaxAccounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccount','SmsAccounts','user_has_sms_accounts','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','SpiedAgents','VoiceContext','Applications','Sounds','VoiceQueueId','Hoppers','CmHopperFinal','HopperBlacks','JscriptySessions','Trunk','TrunkId','TrunkBackupId','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','VoiceCallReport','uniqueid','Contact','ContactId','MailAccountId','CloudProviderId','restrict','Imap','Smtp','Dispositions','List','Team','team_has_mail_queues','MailInteractionId','Account','Owner','Tags','mail_interaction_has_tags','ThroughTags','Users','Interaction','ChatWebsiteId','ChatOfflineMessageId','Dashboard','DashboardItem','Items','FaxAccountId','Answers','Exntensions','ListId','user_has_fax_accounts','FaxMessage','FaxInteractionId','fax_interaction_has_tags','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','Interactions','OpenchannelAccountId','OpenchannelApplication','OpenchannelInteractionId','OpenchannelQueueId','team_has_openchannel_queues','Agent','ChatQueueId','Website','TagId','ChatInteractionId','chat_interaction_has_tags','user_has_chat_interactions','Attachments','team_has_chat_queues','ChatGroupId','Members','CompanyId','HopperHistories','Company','cm_contact_has_tags','Queue','OwnerId','CampaignId','Automation','AutomationAllId','Any','AutomationAnyId','Actions','AutomationId','ParentId','Intervals','MailApplications','FaxApplications','SmsApplications','Schedule','DefaultReportId','CustomReportId','Mohs','moh_has_sounds','openchannel_interaction_has_tags','whatsapp_interaction_has_tags','Trigger','AllConditions','AnyConditions','AnyCondition','TriggerAnyId','AnalyticCustomReport','Fields','AnalyticMetric','MetricId','SalesforceConfiguration','Configurations','Subjects','Descriptions','DescriptionId','AccountId','Subject','SubjectId','Description','FieldId','VariableId','SugarcrmConfiguration','DeskAccount','int_desk_configuration_has_tags','Field','ZendeskConfiguration','int_zendesk_configuration_has_tags','FreshdeskAccount','VtigerConfiguration','Dynamics365Field','FreshsalesConfiguration','FreshsalesField','FromId','ToId','SessionId','SmsQueueReport','ProjectId','JscriptyQuestionReport','TeamVoiceQueue','team_has_fax_queues','team_has_whatsapp_queues','TrunkBackup','SquareProjectId','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromUserId','ToUserId','ToAgent','ToMailQueueId','ToAccount','FromChatWebsiteId','FromAgent','ToQueue','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsAccountId','Queues','UserProfileSection','UserProfileSections','sectionId','WhatsappAccountId','WhatsappMessage','WhatsappApplication','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','exports','../config/environment','jstz','determine','sequelize','defaultsDeep','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','utf8','utf8_general_ci','sequelizeHistory','motion2','name','database','options','username','../api/user/user.model','VoiceChanSpy','import','VoiceExtension','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','VoiceMail','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','MemberReport','../api/memberReport/memberReport.model','../api/trunk/trunk.model','VoiceTransferReport','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','FaxInteraction','../api/faxInteraction/faxInteraction.model','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','../api/chatWebsite/chatWebsite.model'];(function(_0x284706,_0x534975){var _0x288ce4=function(_0x3c7099){while(--_0x3c7099){_0x284706['push'](_0x284706['shift']());}};_0x288ce4(++_0x534975);}(_0xe189,0x194));var _0x9e18=function(_0x3e141f,_0x2c7976){_0x3e141f=_0x3e141f-0x0;var _0x57bc6f=_0xe189[_0x3e141f];return _0x57bc6f;};'use strict';var config=require(_0x9e18('0x0'));var Sequelize=require('sequelize');var _=require('lodash');var jstz=require(_0x9e18('0x1'));var timezone=jstz[_0x9e18('0x2')]();config[_0x9e18('0x3')]=_[_0x9e18('0x4')](config['sequelize'],{'database':'motion2','username':_0x9e18('0x5'),'password':_0x9e18('0x6'),'options':{'host':_0x9e18('0x7'),'port':0xcea,'dialect':_0x9e18('0x8'),'dialectOptions':{'charset':_0x9e18('0x9')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0x9e18('0xa'),'collate':_0x9e18('0xb')}}});config[_0x9e18('0xc')]=_['defaultsDeep'](config[_0x9e18('0xc')],{'database':_0x9e18('0xd'),'username':_0x9e18('0x5'),'password':'xC@LL1234','options':{'host':_0x9e18('0x7'),'port':0xcea,'dialect':_0x9e18('0x8'),'dialectOptions':{'charset':_0x9e18('0x9')},'logging':![],'timezone':timezone[_0x9e18('0xe')](),'define':{'charset':_0x9e18('0xa'),'collate':_0x9e18('0xb')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x9e18('0x3')][_0x9e18('0xf')],config[_0x9e18('0x3')]['username'],config[_0x9e18('0x3')]['password'],config[_0x9e18('0x3')][_0x9e18('0x10')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x9e18('0xf')],config[_0x9e18('0xc')][_0x9e18('0x11')],config[_0x9e18('0xc')]['password'],config[_0x9e18('0xc')]['options'])};db['User']=db[_0x9e18('0x3')]['import'](_0x9e18('0x12'));db[_0x9e18('0x13')]=db[_0x9e18('0x3')][_0x9e18('0x14')]('../api/voiceChanSpy/voiceChanSpy.model');db['VoiceContext']=db[_0x9e18('0x3')][_0x9e18('0x14')]('../api/voiceContext/voiceContext.model');db[_0x9e18('0x15')]=db['sequelize'][_0x9e18('0x14')]('../api/voiceExtension/voiceExtension.model');db[_0x9e18('0x16')]=db[_0x9e18('0x3')][_0x9e18('0x14')](_0x9e18('0x17'));db[_0x9e18('0x18')]=db[_0x9e18('0x3')][_0x9e18('0x14')](_0x9e18('0x19'));db[_0x9e18('0x1a')]=db['sequelize'][_0x9e18('0x14')](_0x9e18('0x1b'));db[_0x9e18('0x1c')]=db['sequelize'][_0x9e18('0x14')]('../api/screenRecording/screenRecording.model');db[_0x9e18('0x1d')]=db['sequelize'][_0x9e18('0x14')]('../api/voiceMail/voiceMail.model');db[_0x9e18('0x1e')]=db[_0x9e18('0x3')]['import'](_0x9e18('0x1f'));db['VoiceCallReport']=db['sequelize'][_0x9e18('0x14')]('../api/voiceCallReport/voiceCallReport.model');db[_0x9e18('0x20')]=db['sequelize'][_0x9e18('0x14')](_0x9e18('0x21'));db[_0x9e18('0x22')]=db[_0x9e18('0x3')][_0x9e18('0x14')](_0x9e18('0x23'));db[_0x9e18('0x24')]=db[_0x9e18('0x3')][_0x9e18('0x14')]('../api/voiceQueueReport/voiceQueueReport.model');db[_0x9e18('0x25')]=db[_0x9e18('0x3')][_0x9e18('0x14')](_0x9e18('0x26'));db['Trunk']=db['sequelize'][_0x9e18('0x14')](_0x9e18('0x27'));db[_0x9e18('0x28')]=db[_0x9e18('0x3')][_0x9e18('0x14')]('../api/voiceTransferReport/voiceTransferReport.model');db[_0x9e18('0x29')]=db[_0x9e18('0x3')][_0x9e18('0x14')](_0x9e18('0x2a'));db[_0x9e18('0x2b')]=db[_0x9e18('0x3')]['import'](_0x9e18('0x2c'));db[_0x9e18('0x2d')]=db[_0x9e18('0x3')][_0x9e18('0x14')](_0x9e18('0x2e'));db['UserMailQueue']=db['sequelize'][_0x9e18('0x14')](_0x9e18('0x2f'));db[_0x9e18('0x30')]=db[_0x9e18('0x3')]['import'](_0x9e18('0x31'));db[_0x9e18('0x32')]=db[_0x9e18('0x3')]['import'](_0x9e18('0x33'));db['UserOpenchannelQueue']=db[_0x9e18('0x3')]['import'](_0x9e18('0x34'));db[_0x9e18('0x35')]=db[_0x9e18('0x3')][_0x9e18('0x14')](_0x9e18('0x36'));db[_0x9e18('0x37')]=db[_0x9e18('0x3')][_0x9e18('0x14')](_0x9e18('0x38'));db[_0x9e18('0x39')]=db[_0x9e18('0x3')]['import'](_0x9e18('0x3a'));db[_0x9e18('0x3b')]=db[_0x9e18('0x3')][_0x9e18('0x14')](_0x9e18('0x3c'));db[_0x9e18('0x3d')]=db[_0x9e18('0x3')][_0x9e18('0x14')](_0x9e18('0x3e'));db[_0x9e18('0x3f')]=db[_0x9e18('0x3')][_0x9e18('0x14')](_0x9e18('0x40'));db[_0x9e18('0x41')]=db['sequelize'][_0x9e18('0x14')](_0x9e18('0x42'));db[_0x9e18('0x43')]=db['sequelize'][_0x9e18('0x14')](_0x9e18('0x44'));db[_0x9e18('0x45')]=db[_0x9e18('0x3')][_0x9e18('0x14')](_0x9e18('0x46'));db[_0x9e18('0x47')]=db[_0x9e18('0x3')][_0x9e18('0x14')](_0x9e18('0x48'));db['Dashboard']=db['sequelize']['import'](_0x9e18('0x49'));db['DashboardItem']=db['sequelize'][_0x9e18('0x14')](_0x9e18('0x4a'));db[_0x9e18('0x4b')]=db['sequelize'][_0x9e18('0x14')](_0x9e18('0x4c'));db[_0x9e18('0x4d')]=db[_0x9e18('0x3')][_0x9e18('0x14')]('../api/faxApplication/faxApplication.model');db[_0x9e18('0x4e')]=db[_0x9e18('0x3')][_0x9e18('0x14')](_0x9e18('0x4f'));db['FaxMessage']=db[_0x9e18('0x3')][_0x9e18('0x14')](_0x9e18('0x50'));db[_0x9e18('0x51')]=db[_0x9e18('0x3')]['import'](_0x9e18('0x52'));db[_0x9e18('0x53')]=db[_0x9e18('0x3')][_0x9e18('0x14')](_0x9e18('0x54'));db['SmsAccount']=db['sequelize']['import']('../api/smsAccount/smsAccount.model');db[_0x9e18('0x55')]=db[_0x9e18('0x3')][_0x9e18('0x14')](_0x9e18('0x56'));db[_0x9e18('0x57')]=db['sequelize'][_0x9e18('0x14')](_0x9e18('0x58'));db[_0x9e18('0x59')]=db[_0x9e18('0x3')]['import']('../api/smsMessage/smsMessage.model');db[_0x9e18('0x5a')]=db[_0x9e18('0x3')][_0x9e18('0x14')](_0x9e18('0x5b'));db[_0x9e18('0x5c')]=db[_0x9e18('0x3')]['import'](_0x9e18('0x5d'));db['OpenchannelApplication']=db[_0x9e18('0x3')][_0x9e18('0x14')](_0x9e18('0x5e'));db[_0x9e18('0x5f')]=db[_0x9e18('0x3')][_0x9e18('0x14')](_0x9e18('0x60'));db[_0x9e18('0x61')]=db[_0x9e18('0x3')][_0x9e18('0x14')](_0x9e18('0x62'));db[_0x9e18('0x63')]=db[_0x9e18('0x3')][_0x9e18('0x14')](_0x9e18('0x64'));db['ChatWebsite']=db[_0x9e18('0x3')][_0x9e18('0x14')](_0x9e18('0x65'));db[_0x9e18('0x66')]=db[_0x9e18('0x3')]['import'](_0x9e18('0x67'));db[_0x9e18('0x68')]=db[_0x9e18('0x3')][_0x9e18('0x14')](_0x9e18('0x69'));db[_0x9e18('0x6a')]=db[_0x9e18('0x3')][_0x9e18('0x14')](_0x9e18('0x6b'));db[_0x9e18('0x6c')]=db[_0x9e18('0x3')][_0x9e18('0x14')](_0x9e18('0x6d'));db[_0x9e18('0x6e')]=db[_0x9e18('0x3')][_0x9e18('0x14')](_0x9e18('0x6f'));db[_0x9e18('0x70')]=db[_0x9e18('0x3')][_0x9e18('0x14')](_0x9e18('0x71'));db[_0x9e18('0x72')]=db[_0x9e18('0x3')][_0x9e18('0x14')](_0x9e18('0x73'));db[_0x9e18('0x74')]=db[_0x9e18('0x3')]['import'](_0x9e18('0x75'));db[_0x9e18('0x76')]=db[_0x9e18('0x3')][_0x9e18('0x14')](_0x9e18('0x77'));db[_0x9e18('0x78')]=db[_0x9e18('0x3')]['import'](_0x9e18('0x79'));db[_0x9e18('0x7a')]=db[_0x9e18('0x3')][_0x9e18('0x14')](_0x9e18('0x7b'));db[_0x9e18('0x7c')]=db[_0x9e18('0x3')][_0x9e18('0x14')](_0x9e18('0x7d'));db['CmHopperFinal']=db[_0x9e18('0x3')][_0x9e18('0x14')]('../api/cmHopperFinal/cmHopperFinal.model');db[_0x9e18('0x7e')]=db[_0x9e18('0x3')][_0x9e18('0x14')](_0x9e18('0x7f'));db[_0x9e18('0x80')]=db[_0x9e18('0x3')][_0x9e18('0x14')](_0x9e18('0x81'));db[_0x9e18('0x82')]=db['sequelize'][_0x9e18('0x14')](_0x9e18('0x83'));db[_0x9e18('0x84')]=db[_0x9e18('0x3')]['import'](_0x9e18('0x85'));db['Automation']=db[_0x9e18('0x3')][_0x9e18('0x14')](_0x9e18('0x86'));db[_0x9e18('0x87')]=db[_0x9e18('0x3')][_0x9e18('0x14')](_0x9e18('0x88'));db[_0x9e18('0x89')]=db['sequelize'][_0x9e18('0x14')](_0x9e18('0x8a'));db[_0x9e18('0x8b')]=db[_0x9e18('0x3')]['import']('../api/condition/condition.model');db[_0x9e18('0x8c')]=db[_0x9e18('0x3')][_0x9e18('0x14')](_0x9e18('0x8d'));db[_0x9e18('0x8e')]=db[_0x9e18('0x3')]['import']('../api/pause/pause.model');db[_0x9e18('0x8f')]=db[_0x9e18('0x3')][_0x9e18('0x14')](_0x9e18('0x90'));db[_0x9e18('0x91')]=db[_0x9e18('0x3')]['import'](_0x9e18('0x92'));db['Schedule']=db['sequelize']['import']('../api/schedule/schedule.model');db[_0x9e18('0x93')]=db[_0x9e18('0x3')][_0x9e18('0x14')](_0x9e18('0x94'));db[_0x9e18('0x95')]=db[_0x9e18('0x3')][_0x9e18('0x14')]('../api/tag/tag.model');db[_0x9e18('0x96')]=db[_0x9e18('0x3')]['import']('../api/template/template.model');db['Trigger']=db['sequelize'][_0x9e18('0x14')](_0x9e18('0x97'));db[_0x9e18('0x98')]=db[_0x9e18('0x3')]['import']('../api/variable/variable.model');db[_0x9e18('0x99')]=db[_0x9e18('0x3')][_0x9e18('0x14')](_0x9e18('0x9a'));db['IntegrationReport']=db['sequelize']['import'](_0x9e18('0x9b'));db['AnalyticCustomReport']=db[_0x9e18('0x3')][_0x9e18('0x14')](_0x9e18('0x9c'));db[_0x9e18('0x9d')]=db[_0x9e18('0x3')][_0x9e18('0x14')](_0x9e18('0x9e'));db[_0x9e18('0x9f')]=db[_0x9e18('0x3')]['import'](_0x9e18('0xa0'));db['AnalyticMetric']=db['sequelize'][_0x9e18('0x14')](_0x9e18('0xa1'));db[_0x9e18('0xa2')]=db[_0x9e18('0x3')][_0x9e18('0x14')]('../api/analyticFieldReport/analyticFieldReport.model');db[_0x9e18('0xa3')]=db[_0x9e18('0x3')][_0x9e18('0x14')]('../api/analyticTreeReport/analyticTreeReport.model');db[_0x9e18('0xa4')]=db[_0x9e18('0x3')]['import'](_0x9e18('0xa5'));db['SalesforceConfiguration']=db['sequelize']['import'](_0x9e18('0xa6'));db[_0x9e18('0xa7')]=db['sequelize'][_0x9e18('0x14')](_0x9e18('0xa8'));db[_0x9e18('0xa9')]=db['sequelize']['import'](_0x9e18('0xaa'));db['SugarcrmConfiguration']=db[_0x9e18('0x3')][_0x9e18('0x14')]('../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model');db[_0x9e18('0xab')]=db['sequelize'][_0x9e18('0x14')](_0x9e18('0xac'));db['DeskAccount']=db[_0x9e18('0x3')][_0x9e18('0x14')]('../api/intDeskAccount/intDeskAccount.model');db[_0x9e18('0xad')]=db[_0x9e18('0x3')][_0x9e18('0x14')](_0x9e18('0xae'));db[_0x9e18('0xaf')]=db[_0x9e18('0x3')][_0x9e18('0x14')](_0x9e18('0xb0'));db[_0x9e18('0xb1')]=db[_0x9e18('0x3')][_0x9e18('0x14')](_0x9e18('0xb2'));db[_0x9e18('0xb3')]=db['sequelize']['import'](_0x9e18('0xb4'));db[_0x9e18('0xb5')]=db['sequelize'][_0x9e18('0x14')](_0x9e18('0xb6'));db[_0x9e18('0xb7')]=db[_0x9e18('0x3')][_0x9e18('0x14')]('../api/intZendeskAccount/intZendeskAccount.model');db['ZendeskConfiguration']=db[_0x9e18('0x3')][_0x9e18('0x14')]('../api/intZendeskConfiguration/intZendeskConfiguration.model');db[_0x9e18('0xb8')]=db[_0x9e18('0x3')][_0x9e18('0x14')](_0x9e18('0xb9'));db['FreshdeskAccount']=db[_0x9e18('0x3')]['import'](_0x9e18('0xba'));db[_0x9e18('0xbb')]=db[_0x9e18('0x3')][_0x9e18('0x14')](_0x9e18('0xbc'));db[_0x9e18('0xbd')]=db[_0x9e18('0x3')][_0x9e18('0x14')]('../api/intFreshdeskField/intFreshdeskField.model');db[_0x9e18('0xbe')]=db[_0x9e18('0x3')][_0x9e18('0x14')](_0x9e18('0xbf'));db['VtigerConfiguration']=db['sequelize'][_0x9e18('0x14')](_0x9e18('0xc0'));db[_0x9e18('0xc1')]=db[_0x9e18('0x3')][_0x9e18('0x14')](_0x9e18('0xc2'));db[_0x9e18('0xc3')]=db[_0x9e18('0x3')][_0x9e18('0x14')](_0x9e18('0xc4'));db[_0x9e18('0xc5')]=db[_0x9e18('0x3')][_0x9e18('0x14')]('../api/intServicenowConfiguration/intServicenowConfiguration.model');db[_0x9e18('0xc6')]=db[_0x9e18('0x3')]['import'](_0x9e18('0xc7'));db[_0x9e18('0xc8')]=db[_0x9e18('0x3')][_0x9e18('0x14')](_0x9e18('0xc9'));db[_0x9e18('0xca')]=db[_0x9e18('0x3')]['import'](_0x9e18('0xcb'));db['Dynamics365Field']=db[_0x9e18('0x3')][_0x9e18('0x14')](_0x9e18('0xcc'));db[_0x9e18('0xcd')]=db[_0x9e18('0x3')][_0x9e18('0x14')]('../api/intFreshsalesAccount/intFreshsalesAccount.model');db['FreshsalesConfiguration']=db['sequelize'][_0x9e18('0x14')](_0x9e18('0xce'));db['FreshsalesField']=db[_0x9e18('0x3')]['import'](_0x9e18('0xcf'));db['Integration']=db[_0x9e18('0x3')][_0x9e18('0x14')](_0x9e18('0x9a'));db[_0x9e18('0xd0')]=db[_0x9e18('0x3')]['import']('../api/network/network.model');db[_0x9e18('0xd1')]=db['sequelize']['import'](_0x9e18('0xd2'));db[_0x9e18('0xd3')]=db[_0x9e18('0x3')][_0x9e18('0x14')](_0x9e18('0xd4'));db[_0x9e18('0xd5')]=db['sequelize'][_0x9e18('0x14')](_0x9e18('0xd6'));db['JscriptyQuestionReport']=db[_0x9e18('0x3')]['import'](_0x9e18('0xd7'));db[_0x9e18('0xd8')]=db[_0x9e18('0x3')][_0x9e18('0x14')]('../api/jscriptySessionReport/jscriptySessionReport.model');db['SmsQueueReport']=db[_0x9e18('0x3')]['import']('../api/smsQueueReport/smsQueueReport.model');db[_0x9e18('0xd9')]=db[_0x9e18('0x3')]['import']('../api/squareReport/squareReport.model');db[_0x9e18('0xda')]=db[_0x9e18('0x3')]['import']('../api/squareReportDetail/squareReportDetail.model');db[_0x9e18('0xdb')]=db['sequelize'][_0x9e18('0x14')]('../api/jscriptyProject/jscriptyProject.model');db[_0x9e18('0xdc')]=db[_0x9e18('0x3')]['import'](_0x9e18('0xdd'));db['SquareOdbc']=db['sequelize'][_0x9e18('0x14')](_0x9e18('0xde'));db[_0x9e18('0xdf')]=db['sequelize']['import']('../api/squareProject/squareProject.model');db['SquareRecording']=db[_0x9e18('0x3')]['import'](_0x9e18('0xe0'));db[_0x9e18('0xe1')]=db[_0x9e18('0x3')]['import'](_0x9e18('0xe2'));db['Team']=db['sequelize']['import'](_0x9e18('0xe3'));db[_0x9e18('0xe4')]=db[_0x9e18('0x3')][_0x9e18('0x14')](_0x9e18('0xe5'));db[_0x9e18('0xe6')]=db['sequelize']['import'](_0x9e18('0xe7'));db[_0x9e18('0xe8')]=db[_0x9e18('0x3')][_0x9e18('0x14')](_0x9e18('0xe9'));db[_0x9e18('0xea')]=db[_0x9e18('0x3')][_0x9e18('0x14')](_0x9e18('0xeb'));db[_0x9e18('0xec')]=db[_0x9e18('0x3')]['import'](_0x9e18('0xed'));db['MailTransferReport']=db[_0x9e18('0x3')][_0x9e18('0x14')](_0x9e18('0xee'));db[_0x9e18('0xef')]=db[_0x9e18('0x3')][_0x9e18('0x14')]('../api/chatTransferReport/chatTransferReport.model');db[_0x9e18('0xf0')]=db['sequelize'][_0x9e18('0x14')](_0x9e18('0xf1'));db[_0x9e18('0xf2')]=db[_0x9e18('0x3')][_0x9e18('0x14')]('../api/openchannelTransferReport/openchannelTransferReport.model');db[_0x9e18('0xf3')]=db[_0x9e18('0x3')][_0x9e18('0x14')]('../api/smsTransferReport/smsTransferReport.model');db[_0x9e18('0xf4')]=db['sequelize']['import']('../api/cmList/cmList.model');db[_0x9e18('0xf5')]=db[_0x9e18('0x3')][_0x9e18('0x14')](_0x9e18('0xf6'));db[_0x9e18('0xf7')]=db['sequelize'][_0x9e18('0x14')](_0x9e18('0xf8'));db['UserProfileSection']=db[_0x9e18('0x3')][_0x9e18('0x14')](_0x9e18('0xf9'));db[_0x9e18('0xfa')]=db['sequelize']['import'](_0x9e18('0xfb'));db[_0x9e18('0xfc')]=db[_0x9e18('0x3')][_0x9e18('0x14')](_0x9e18('0xfd'));db[_0x9e18('0xfe')]=db['sequelize'][_0x9e18('0x14')](_0x9e18('0xff'));db['WhatsappApplication']=db['sequelize'][_0x9e18('0x14')]('../api/whatsappApplication/whatsappApplication.model');db['WhatsappInteraction']=db['sequelize'][_0x9e18('0x14')](_0x9e18('0x100'));db['WhatsappMessage']=db[_0x9e18('0x3')][_0x9e18('0x14')]('../api/whatsappMessage/whatsappMessage.model');db[_0x9e18('0x101')]=db[_0x9e18('0x3')]['import'](_0x9e18('0x102'));db[_0x9e18('0x103')]=db[_0x9e18('0x3')][_0x9e18('0x14')](_0x9e18('0x104'));db[_0x9e18('0x105')]=db[_0x9e18('0x3')][_0x9e18('0x14')](_0x9e18('0x106'));db[_0x9e18('0x107')]=db[_0x9e18('0x3')][_0x9e18('0x14')](_0x9e18('0x108'));db['TeamVoiceQueue']=db[_0x9e18('0x3')][_0x9e18('0x14')](_0x9e18('0x109'));db[_0x9e18('0x10a')]=db[_0x9e18('0x3')][_0x9e18('0x14')](_0x9e18('0x10b'));db[_0x9e18('0x10c')]=db[_0x9e18('0x3')][_0x9e18('0x14')](_0x9e18('0x10d'));db[_0x9e18('0x10e')][_0x9e18('0x10f')](db[_0x9e18('0x1d')],{'as':'VoiceMail','onDelete':_0x9e18('0x110'),'foreignKey':'UserId'});db[_0x9e18('0x10e')]['hasMany'](db[_0x9e18('0x1a')],{'as':_0x9e18('0x111'),'foreignKey':'UserId'});db['User'][_0x9e18('0x112')](db[_0x9e18('0x29')],{'as':_0x9e18('0x113'),'foreignKey':'UserId'});db['User']['hasMany'](db[_0x9e18('0x15')],{'as':_0x9e18('0x114'),'onDelete':_0x9e18('0x110'),'hooks':!![]});db[_0x9e18('0x10e')][_0x9e18('0x112')](db['CmHopperFinal'],{'as':_0x9e18('0x115'),'foreignKey':_0x9e18('0x116')});db[_0x9e18('0x10e')][_0x9e18('0x112')](db['CmHopperHistory'],{'as':_0x9e18('0x117'),'foreignKey':_0x9e18('0x116')});db[_0x9e18('0x10e')][_0x9e18('0x112')](db[_0x9e18('0x80')],{'as':'ReportAgentPreview','foreignKey':_0x9e18('0x116')});db[_0x9e18('0x10e')][_0x9e18('0x112')](db['OpenchannelInteraction'],{'as':_0x9e18('0x118'),'foreignKey':_0x9e18('0x116')});db[_0x9e18('0x10e')]['hasMany'](db[_0x9e18('0x6a')],{'as':_0x9e18('0x119'),'foreignKey':_0x9e18('0x116')});db[_0x9e18('0x10e')][_0x9e18('0x112')](db[_0x9e18('0x57')],{'as':_0x9e18('0x11a'),'foreignKey':'UserId'});db['User']['hasMany'](db[_0x9e18('0x4e')],{'as':'FaxInteractions','foreignKey':'UserId'});db[_0x9e18('0x10e')]['hasMany'](db[_0x9e18('0x41')],{'as':'MailInteractions','foreignKey':_0x9e18('0x116')});db['User']['hasMany'](db['WhatsappInteraction'],{'as':_0x9e18('0x11b'),'foreignKey':_0x9e18('0x116')});db[_0x9e18('0x10e')][_0x9e18('0x112')](db['UserNotification'],{'as':'UserNotifications','foreignKey':_0x9e18('0x11c')});db[_0x9e18('0x10e')][_0x9e18('0x11d')](db[_0x9e18('0xf7')],{'as':_0x9e18('0xf7'),'foreignKey':_0x9e18('0x11e')});db[_0x9e18('0x10e')][_0x9e18('0x11f')](db[_0x9e18('0x72')],{'as':_0x9e18('0x120'),'through':_0x9e18('0x121')});db['User']['belongsToMany'](db['CmContact'],{'as':_0x9e18('0x122'),'through':_0x9e18('0x123')});db[_0x9e18('0x10e')][_0x9e18('0x11f')](db['CmList'],{'as':_0x9e18('0x124'),'through':_0x9e18('0x125')});db[_0x9e18('0x10e')][_0x9e18('0x11f')](db['Team'],{'through':_0x9e18('0x126')});db[_0x9e18('0x10e')][_0x9e18('0x11f')](db[_0x9e18('0x41')],{'as':_0x9e18('0x127'),'through':_0x9e18('0x128')});db[_0x9e18('0x10e')][_0x9e18('0x11f')](db[_0x9e18('0x6a')],{'as':_0x9e18('0x119'),'through':'user_has_chat_interactions'});db[_0x9e18('0x10e')][_0x9e18('0x11f')](db[_0x9e18('0x4e')],{'as':_0x9e18('0x129'),'through':_0x9e18('0x12a')});db[_0x9e18('0x10e')][_0x9e18('0x11f')](db[_0x9e18('0x57')],{'as':_0x9e18('0x11a'),'through':_0x9e18('0x12b')});db['User']['belongsToMany'](db[_0x9e18('0x5f')],{'as':_0x9e18('0x118'),'through':_0x9e18('0x12c')});db[_0x9e18('0x10e')]['belongsToMany'](db[_0x9e18('0x12d')],{'as':_0x9e18('0x11b'),'through':_0x9e18('0x12e')});db['User'][_0x9e18('0x11f')](db['VoiceQueue'],{'as':_0x9e18('0x12f'),'through':_0x9e18('0x2b'),'required':![]});db[_0x9e18('0x10e')][_0x9e18('0x11f')](db[_0x9e18('0xf5')],{'as':_0x9e18('0x130'),'through':_0x9e18('0x10c'),'required':![]});db['User']['belongsToMany'](db[_0x9e18('0x3d')],{'as':_0x9e18('0x131'),'through':_0x9e18('0x132'),'required':![]});db[_0x9e18('0x10e')][_0x9e18('0x11f')](db[_0x9e18('0x70')],{'as':_0x9e18('0x133'),'through':'UserChatQueue','required':![],'hooks':!![]});db[_0x9e18('0x10e')][_0x9e18('0x11f')](db[_0x9e18('0x51')],{'as':_0x9e18('0x134'),'through':_0x9e18('0x30'),'required':![]});db[_0x9e18('0x10e')][_0x9e18('0x11f')](db[_0x9e18('0x5a')],{'as':_0x9e18('0x135'),'through':_0x9e18('0x32'),'required':![]});db[_0x9e18('0x10e')][_0x9e18('0x11f')](db[_0x9e18('0x63')],{'as':_0x9e18('0x136'),'through':_0x9e18('0x137'),'required':![]});db[_0x9e18('0x10e')][_0x9e18('0x11f')](db[_0x9e18('0x105')],{'as':_0x9e18('0x138'),'through':_0x9e18('0x35'),'required':![]});db[_0x9e18('0x10e')]['belongsToMany'](db[_0x9e18('0xf4')],{'through':_0x9e18('0x125')});db[_0x9e18('0x10e')][_0x9e18('0x11f')](db[_0x9e18('0x139')],{'as':_0x9e18('0x13a'),'through':_0x9e18('0x13b')});db[_0x9e18('0x10e')][_0x9e18('0x11f')](db['FaxAccount'],{'as':_0x9e18('0x13c'),'through':'user_has_fax_accounts'});db[_0x9e18('0x10e')]['belongsToMany'](db[_0x9e18('0x3b')],{'as':_0x9e18('0x13d'),'through':_0x9e18('0x13e')});db[_0x9e18('0x10e')]['belongsToMany'](db[_0x9e18('0x5c')],{'as':_0x9e18('0x13f'),'through':_0x9e18('0x140')});db[_0x9e18('0x10e')][_0x9e18('0x11f')](db[_0x9e18('0x141')],{'as':_0x9e18('0x142'),'through':_0x9e18('0x143')});db[_0x9e18('0x10e')][_0x9e18('0x11f')](db['WhatsappAccount'],{'as':'WhatsappAccounts','through':_0x9e18('0x144')});db[_0x9e18('0x10e')]['belongsToMany'](db['SquareProject'],{'as':_0x9e18('0x145'),'through':_0x9e18('0x146')});db[_0x9e18('0x13')][_0x9e18('0x112')](db[_0x9e18('0x15')],{'as':_0x9e18('0x147'),'onDelete':_0x9e18('0x110'),'foreignKey':'ChanSpyId'});db[_0x9e18('0x148')][_0x9e18('0x112')](db['VoiceExtension'],{'onDelete':_0x9e18('0x110')});db[_0x9e18('0x15')][_0x9e18('0x112')](db[_0x9e18('0x15')],{'as':_0x9e18('0x149'),'onDelete':_0x9e18('0x110')});db[_0x9e18('0x16')]['belongsToMany'](db[_0x9e18('0x93')],{'as':_0x9e18('0x14a'),'through':'moh_has_sounds'});db[_0x9e18('0x18')]['hasMany'](db[_0x9e18('0x29')],{'as':'Members','foreignKey':_0x9e18('0x14b')});db[_0x9e18('0x18')][_0x9e18('0x112')](db[_0x9e18('0x7a')],{'as':_0x9e18('0x14c'),'foreignKey':_0x9e18('0x14b')});db[_0x9e18('0x18')][_0x9e18('0x112')](db[_0x9e18('0x14d')],{'as':'HopperFinals','foreignKey':_0x9e18('0x14b')});db[_0x9e18('0x18')][_0x9e18('0x112')](db[_0x9e18('0x7e')],{'as':'HopperHistories','foreignKey':_0x9e18('0x14b')});db['VoiceQueue'][_0x9e18('0x112')](db[_0x9e18('0x80')],{'as':_0x9e18('0x80'),'foreignKey':_0x9e18('0x14b')});db[_0x9e18('0x18')][_0x9e18('0x112')](db[_0x9e18('0x7c')],{'as':_0x9e18('0x14e'),'foreignKey':'VoiceQueueId'});db[_0x9e18('0x18')][_0x9e18('0x112')](db[_0x9e18('0xd8')],{'as':_0x9e18('0x14f'),'foreignKey':_0x9e18('0x14b')});db[_0x9e18('0x18')][_0x9e18('0x11d')](db[_0x9e18('0x150')],{'as':_0x9e18('0x150'),'foreignKey':_0x9e18('0x151')});db['VoiceQueue'][_0x9e18('0x11d')](db['Trunk'],{'as':'TrunkBackup','foreignKey':_0x9e18('0x152')});db[_0x9e18('0x18')]['belongsTo'](db[_0x9e18('0x8c')],{'as':_0x9e18('0x8c'),'foreignKey':_0x9e18('0x153')});db[_0x9e18('0x18')][_0x9e18('0x11d')](db['Pause'],{'as':_0x9e18('0x154'),'foreignKey':_0x9e18('0x155')});db['VoiceQueue'][_0x9e18('0x11f')](db[_0x9e18('0xf4')],{'as':_0x9e18('0x124'),'through':_0x9e18('0x156')});db[_0x9e18('0x18')]['belongsToMany'](db[_0x9e18('0x10e')],{'as':_0x9e18('0x157'),'through':'UserVoiceQueue'});db[_0x9e18('0x18')][_0x9e18('0x11f')](db['Team'],{'as':_0x9e18('0x158'),'through':'TeamVoiceQueue'});db[_0x9e18('0x18')]['belongsToMany'](db[_0x9e18('0xf4')],{'as':_0x9e18('0x159'),'through':_0x9e18('0x15a')});db[_0x9e18('0x1a')]['belongsTo'](db['User'],{'as':'User','foreignKey':_0x9e18('0x116')});db[_0x9e18('0x1c')][_0x9e18('0x11d')](db[_0x9e18('0x10e')],{'as':_0x9e18('0x10e'),'foreignKey':_0x9e18('0x116')});db[_0x9e18('0x1d')]['hasMany'](db['VoiceMailMessage'],{'as':_0x9e18('0x15b'),'onDelete':_0x9e18('0x110'),'foreignKey':_0x9e18('0x15c'),'sourceKey':_0x9e18('0x15d')});db[_0x9e18('0x1e')][_0x9e18('0x11d')](db[_0x9e18('0x1d')],{'foreignKey':_0x9e18('0x15c'),'targetKey':_0x9e18('0x15d')});db[_0x9e18('0x15e')][_0x9e18('0x112')](db[_0x9e18('0x24')],{'as':'QueueCalls','foreignKey':_0x9e18('0x15f'),'constraints':![]});db[_0x9e18('0x15e')][_0x9e18('0x112')](db[_0x9e18('0x22')],{'as':'AgentReports','foreignKey':_0x9e18('0x15f'),'constraints':![]});db[_0x9e18('0x15e')][_0x9e18('0x11d')](db['User'],{'as':_0x9e18('0x10e'),'foreignKey':_0x9e18('0x116')});db[_0x9e18('0x15e')][_0x9e18('0x11d')](db[_0x9e18('0x78')],{'as':_0x9e18('0x160'),'foreignKey':_0x9e18('0x161')});db[_0x9e18('0x37')][_0x9e18('0x11d')](db[_0x9e18('0x3b')],{'as':_0x9e18('0x3b'),'foreignKey':_0x9e18('0x162')});db[_0x9e18('0x37')]['belongsTo'](db[_0x9e18('0x107')],{'as':_0x9e18('0x107'),'foreignKey':_0x9e18('0x163'),'onDelete':_0x9e18('0x164')});db[_0x9e18('0x39')][_0x9e18('0x11d')](db[_0x9e18('0x3b')],{'as':'MailAccount','foreignKey':_0x9e18('0x162')});db[_0x9e18('0x39')][_0x9e18('0x11d')](db[_0x9e18('0x107')],{'as':_0x9e18('0x107'),'foreignKey':'CloudProviderId','onDelete':_0x9e18('0x164')});db[_0x9e18('0x3b')][_0x9e18('0x10f')](db[_0x9e18('0x37')],{'as':_0x9e18('0x165'),'onDelete':_0x9e18('0x110')});db[_0x9e18('0x3b')]['hasOne'](db[_0x9e18('0x39')],{'as':_0x9e18('0x166'),'onDelete':'cascade'});db[_0x9e18('0x3b')][_0x9e18('0x112')](db[_0x9e18('0x89')],{'as':_0x9e18('0x167'),'foreignKey':_0x9e18('0x162'),'onDelete':'cascade'});db[_0x9e18('0x3b')][_0x9e18('0x112')](db[_0x9e18('0x87')],{'as':'Answers','foreignKey':_0x9e18('0x162')});db[_0x9e18('0x3b')]['hasMany'](db[_0x9e18('0x43')],{'as':_0x9e18('0x15b'),'foreignKey':_0x9e18('0x162')});db[_0x9e18('0x3b')]['hasMany'](db[_0x9e18('0x41')],{'as':'Interactions'});db[_0x9e18('0x3b')][_0x9e18('0x112')](db['MailApplication'],{'as':_0x9e18('0x149')});db['MailAccount'][_0x9e18('0x11d')](db[_0x9e18('0xf4')],{'as':_0x9e18('0x168'),'foreignKey':'ListId'});db['MailAccount']['belongsTo'](db[_0x9e18('0x96')],{'as':_0x9e18('0x96'),'foreignKey':'TemplateId'});db[_0x9e18('0x3b')][_0x9e18('0x11d')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x9e18('0x155')});db[_0x9e18('0x3b')]['belongsToMany'](db[_0x9e18('0x10e')],{'as':_0x9e18('0x157'),'through':_0x9e18('0x13e')});db[_0x9e18('0x3d')][_0x9e18('0x11f')](db[_0x9e18('0x10e')],{'as':_0x9e18('0x157'),'through':_0x9e18('0x132')});db[_0x9e18('0x3d')][_0x9e18('0x11f')](db[_0x9e18('0x169')],{'through':_0x9e18('0x16a'),'as':'Teams'});db['MailInteraction'][_0x9e18('0x112')](db['MailMessage'],{'as':_0x9e18('0x15b'),'onDelete':_0x9e18('0x110'),'foreignKey':_0x9e18('0x16b')});db[_0x9e18('0x41')]['belongsTo'](db[_0x9e18('0x3b')],{'as':_0x9e18('0x16c'),'foreignKey':'MailAccountId'});db[_0x9e18('0x41')][_0x9e18('0x11d')](db['CmContact'],{'as':'Contact','foreignKey':'ContactId'});db[_0x9e18('0x41')]['belongsTo'](db[_0x9e18('0x10e')],{'as':_0x9e18('0x16d'),'foreignKey':'UserId'});db[_0x9e18('0x41')][_0x9e18('0x11f')](db[_0x9e18('0x95')],{'through':'mail_interaction_has_tags','as':_0x9e18('0x16e')});db['MailInteraction'][_0x9e18('0x11f')](db[_0x9e18('0x95')],{'through':_0x9e18('0x16f'),'as':_0x9e18('0x170')});db['MailInteraction'][_0x9e18('0x11f')](db[_0x9e18('0x10e')],{'as':_0x9e18('0x171'),'through':_0x9e18('0x128'),'foreignKey':'MailInteractionId'});db[_0x9e18('0x43')][_0x9e18('0x112')](db['Attachment'],{'as':'Attachments','onDelete':_0x9e18('0x110')});db[_0x9e18('0x43')]['belongsTo'](db[_0x9e18('0x10e')],{'as':_0x9e18('0x10e')});db[_0x9e18('0x43')]['belongsTo'](db['CmContact'],{'onDelete':_0x9e18('0x110'),'as':_0x9e18('0x160')});db['MailMessage']['belongsTo'](db[_0x9e18('0x41')],{'as':_0x9e18('0x172'),'foreignKey':'MailInteractionId'});db['MailMessage']['belongsTo'](db['MailAccount'],{'as':_0x9e18('0x16c'),'foreignKey':'MailAccountId'});db[_0x9e18('0x43')][_0x9e18('0x11d')](db[_0x9e18('0x139')],{'as':_0x9e18('0x139'),'foreignKey':_0x9e18('0x173')});db[_0x9e18('0x43')][_0x9e18('0x11d')](db[_0x9e18('0x6e')],{'as':_0x9e18('0x6e'),'foreignKey':_0x9e18('0x174')});db[_0x9e18('0x45')]['belongsTo'](db[_0x9e18('0x10e')],{'onDelete':'restrict'});db['MailApplication']['belongsTo'](db[_0x9e18('0x3d')],{'onDelete':_0x9e18('0x164')});db[_0x9e18('0x45')][_0x9e18('0x11d')](db['MailAccount'],{'onDelete':_0x9e18('0x164')});db[_0x9e18('0x45')][_0x9e18('0x11d')](db[_0x9e18('0x8c')],{'onDelete':_0x9e18('0x164'),'foreignKey':'IntervalId'});db[_0x9e18('0x45')]['belongsTo'](db[_0x9e18('0x95')],{'onDelete':'restrict','foreignKey':'TagId'});db[_0x9e18('0x47')][_0x9e18('0x11d')](db[_0x9e18('0x3b')],{});db[_0x9e18('0x47')][_0x9e18('0x11d')](db['CmList'],{'as':_0x9e18('0x168'),'foreignKey':'ListId'});db[_0x9e18('0x47')][_0x9e18('0x11d')](db[_0x9e18('0x78')],{'as':'Contact','foreignKey':_0x9e18('0x161')});db[_0x9e18('0x47')]['belongsTo'](db['MailInteraction'],{});db[_0x9e18('0x47')][_0x9e18('0x11d')](db['MailMessage'],{});db[_0x9e18('0x47')][_0x9e18('0x11d')](db[_0x9e18('0x10e')],{});db['MailQueueReport'][_0x9e18('0x11d')](db[_0x9e18('0x3d')],{});db[_0x9e18('0x175')][_0x9e18('0x112')](db[_0x9e18('0x176')],{'as':_0x9e18('0x177'),'onDelete':_0x9e18('0x110')});db[_0x9e18('0x4b')][_0x9e18('0x112')](db[_0x9e18('0x89')],{'as':'Dispositions','foreignKey':_0x9e18('0x178'),'onDelete':_0x9e18('0x110')});db[_0x9e18('0x4b')][_0x9e18('0x112')](db[_0x9e18('0x87')],{'as':_0x9e18('0x179'),'foreignKey':_0x9e18('0x178')});db[_0x9e18('0x4b')][_0x9e18('0x112')](db[_0x9e18('0x4e')],{'as':'Interactions'});db['FaxAccount'][_0x9e18('0x112')](db[_0x9e18('0x4d')],{'as':'Applications'});db[_0x9e18('0x4b')][_0x9e18('0x112')](db[_0x9e18('0x15')],{'as':_0x9e18('0x17a'),'onDelete':_0x9e18('0x110')});db[_0x9e18('0x4b')][_0x9e18('0x112')](db['FaxMessage'],{'as':_0x9e18('0x15b')});db[_0x9e18('0x4b')][_0x9e18('0x11d')](db[_0x9e18('0x150')],{'as':'Trunk'});db[_0x9e18('0x4b')][_0x9e18('0x11d')](db['CmList'],{'as':_0x9e18('0x168'),'foreignKey':_0x9e18('0x17b')});db[_0x9e18('0x4b')][_0x9e18('0x11d')](db[_0x9e18('0x8e')],{'as':'mandatoryDispositionPause','foreignKey':_0x9e18('0x155')});db[_0x9e18('0x4b')][_0x9e18('0x11f')](db['User'],{'as':_0x9e18('0x157'),'through':_0x9e18('0x17c')});db[_0x9e18('0x4d')]['belongsTo'](db['User'],{'onDelete':_0x9e18('0x164')});db[_0x9e18('0x4d')][_0x9e18('0x11d')](db[_0x9e18('0x51')],{'onDelete':_0x9e18('0x164')});db['FaxApplication'][_0x9e18('0x11d')](db[_0x9e18('0x4b')],{'onDelete':_0x9e18('0x164')});db[_0x9e18('0x4d')][_0x9e18('0x11d')](db[_0x9e18('0x95')],{'onDelete':_0x9e18('0x164'),'foreignKey':'TagId'});db[_0x9e18('0x4e')][_0x9e18('0x112')](db[_0x9e18('0x17d')],{'as':_0x9e18('0x15b'),'onDelete':_0x9e18('0x110'),'foreignKey':_0x9e18('0x17e')});db[_0x9e18('0x4e')][_0x9e18('0x11d')](db[_0x9e18('0x4b')],{'as':_0x9e18('0x16c'),'foreignKey':_0x9e18('0x178')});db[_0x9e18('0x4e')]['belongsTo'](db['CmContact'],{'as':_0x9e18('0x160'),'foreignKey':_0x9e18('0x161')});db[_0x9e18('0x4e')]['belongsTo'](db[_0x9e18('0x10e')],{'as':_0x9e18('0x16d'),'foreignKey':_0x9e18('0x116')});db[_0x9e18('0x4e')][_0x9e18('0x11f')](db[_0x9e18('0x95')],{'through':_0x9e18('0x17f'),'as':'Tags'});db[_0x9e18('0x4e')][_0x9e18('0x11f')](db[_0x9e18('0x95')],{'through':_0x9e18('0x17f'),'as':_0x9e18('0x170')});db['FaxInteraction'][_0x9e18('0x11f')](db['User'],{'as':_0x9e18('0x171'),'through':_0x9e18('0x12a'),'foreignKey':_0x9e18('0x17e')});db[_0x9e18('0x17d')][_0x9e18('0x11d')](db[_0x9e18('0x10e')],{'onDelete':_0x9e18('0x110'),'as':_0x9e18('0x10e')});db[_0x9e18('0x17d')][_0x9e18('0x11d')](db[_0x9e18('0x4e')],{'as':_0x9e18('0x172'),'foreignKey':'FaxInteractionId'});db[_0x9e18('0x17d')][_0x9e18('0x11d')](db[_0x9e18('0x78')],{'onDelete':_0x9e18('0x110'),'as':'Contact'});db[_0x9e18('0x17d')]['belongsTo'](db[_0x9e18('0xea')],{'as':_0x9e18('0xea'),'foreignKey':'AttachmentId'});db[_0x9e18('0x17d')]['belongsTo'](db['FaxAccount'],{'as':_0x9e18('0x16c'),'foreignKey':_0x9e18('0x178')});db[_0x9e18('0x51')][_0x9e18('0x11f')](db['User'],{'as':'Agents','through':_0x9e18('0x30')});db[_0x9e18('0x51')][_0x9e18('0x11f')](db[_0x9e18('0x169')],{'through':'team_has_fax_queues','as':_0x9e18('0x158')});db['FaxQueueReport']['belongsTo'](db[_0x9e18('0x4b')],{});db[_0x9e18('0x53')][_0x9e18('0x11d')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0x9e18('0x53')]['belongsTo'](db[_0x9e18('0x78')],{'as':'Contact','foreignKey':'ContactId'});db[_0x9e18('0x53')][_0x9e18('0x11d')](db[_0x9e18('0x4e')],{});db[_0x9e18('0x53')]['belongsTo'](db[_0x9e18('0x17d')],{});db[_0x9e18('0x53')][_0x9e18('0x11d')](db[_0x9e18('0x10e')],{});db['FaxQueueReport'][_0x9e18('0x11d')](db[_0x9e18('0x51')],{});db[_0x9e18('0x141')][_0x9e18('0x112')](db[_0x9e18('0x89')],{'as':'Dispositions','foreignKey':_0x9e18('0x180'),'onDelete':_0x9e18('0x110')});db[_0x9e18('0x141')][_0x9e18('0x112')](db[_0x9e18('0x87')],{'as':_0x9e18('0x179'),'foreignKey':_0x9e18('0x180')});db[_0x9e18('0x141')][_0x9e18('0x112')](db[_0x9e18('0x59')],{'as':_0x9e18('0x15b'),'foreignKey':_0x9e18('0x180')});db[_0x9e18('0x141')][_0x9e18('0x112')](db[_0x9e18('0x57')],{'as':'Interactions'});db[_0x9e18('0x141')][_0x9e18('0x112')](db[_0x9e18('0x55')],{'as':_0x9e18('0x149')});db[_0x9e18('0x141')][_0x9e18('0x11d')](db[_0x9e18('0xf4')],{'as':'List','foreignKey':_0x9e18('0x17b')});db['SmsAccount']['belongsTo'](db[_0x9e18('0x8e')],{'as':'mandatoryDispositionPause','foreignKey':_0x9e18('0x155')});db[_0x9e18('0x141')][_0x9e18('0x11f')](db[_0x9e18('0x10e')],{'as':_0x9e18('0x157'),'through':_0x9e18('0x143')});db[_0x9e18('0x55')][_0x9e18('0x11d')](db[_0x9e18('0x10e')],{'onDelete':'restrict'});db[_0x9e18('0x55')][_0x9e18('0x11d')](db[_0x9e18('0x5a')],{'onDelete':'restrict'});db[_0x9e18('0x55')]['belongsTo'](db[_0x9e18('0x141')],{'onDelete':_0x9e18('0x164')});db[_0x9e18('0x55')]['belongsTo'](db[_0x9e18('0x8c')],{'onDelete':'restrict','foreignKey':_0x9e18('0x153')});db['SmsApplication'][_0x9e18('0x11d')](db[_0x9e18('0x95')],{'onDelete':'restrict','foreignKey':'TagId'});db[_0x9e18('0x57')][_0x9e18('0x112')](db[_0x9e18('0x59')],{'as':_0x9e18('0x15b'),'onDelete':_0x9e18('0x110'),'foreignKey':_0x9e18('0x181')});db[_0x9e18('0x57')][_0x9e18('0x11d')](db[_0x9e18('0x141')],{'as':'Account','foreignKey':_0x9e18('0x180')});db['SmsInteraction'][_0x9e18('0x11d')](db[_0x9e18('0x78')],{'as':_0x9e18('0x160'),'foreignKey':'ContactId'});db[_0x9e18('0x57')][_0x9e18('0x11d')](db['User'],{'as':_0x9e18('0x16d'),'foreignKey':_0x9e18('0x116')});db[_0x9e18('0x57')][_0x9e18('0x11f')](db[_0x9e18('0x95')],{'through':_0x9e18('0x182'),'as':_0x9e18('0x16e')});db[_0x9e18('0x57')]['belongsToMany'](db['Tag'],{'through':_0x9e18('0x182'),'as':_0x9e18('0x170')});db[_0x9e18('0x57')][_0x9e18('0x11f')](db['User'],{'as':_0x9e18('0x171'),'through':_0x9e18('0x12b'),'foreignKey':_0x9e18('0x181')});db[_0x9e18('0x59')][_0x9e18('0x11d')](db['User'],{'as':_0x9e18('0x10e')});db[_0x9e18('0x59')][_0x9e18('0x11d')](db['CmContact'],{'onDelete':_0x9e18('0x110'),'as':'Contact'});db[_0x9e18('0x59')][_0x9e18('0x11d')](db[_0x9e18('0x57')],{'onDelete':_0x9e18('0x110'),'as':_0x9e18('0x172'),'foreignKey':_0x9e18('0x181')});db[_0x9e18('0x59')][_0x9e18('0x11d')](db[_0x9e18('0x141')],{'as':_0x9e18('0x16c'),'foreignKey':_0x9e18('0x180')});db[_0x9e18('0x5a')]['belongsToMany'](db['User'],{'as':_0x9e18('0x157'),'through':_0x9e18('0x32'),'foreignKey':_0x9e18('0x183')});db[_0x9e18('0x5a')][_0x9e18('0x11f')](db[_0x9e18('0x169')],{'through':_0x9e18('0x184'),'as':_0x9e18('0x158')});db['OpenchannelAccount'][_0x9e18('0x112')](db[_0x9e18('0x89')],{'as':_0x9e18('0x167'),'foreignKey':'OpenchannelAccountId','onDelete':_0x9e18('0x110')});db[_0x9e18('0x5c')][_0x9e18('0x112')](db[_0x9e18('0x87')],{'as':'Answers','foreignKey':'OpenchannelAccountId'});db[_0x9e18('0x5c')][_0x9e18('0x112')](db['OpenchannelInteraction'],{'as':_0x9e18('0x185'),'foreignKey':_0x9e18('0x186')});db['OpenchannelAccount'][_0x9e18('0x112')](db[_0x9e18('0x61')],{'as':_0x9e18('0x15b'),'foreignKey':_0x9e18('0x186')});db[_0x9e18('0x5c')][_0x9e18('0x112')](db[_0x9e18('0x187')],{'as':_0x9e18('0x149'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x9e18('0x11d')](db[_0x9e18('0xf4')],{'as':_0x9e18('0x168'),'foreignKey':_0x9e18('0x17b')});db[_0x9e18('0x5c')][_0x9e18('0x11d')](db[_0x9e18('0x8e')],{'as':_0x9e18('0x154'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x9e18('0x5c')][_0x9e18('0x11f')](db['User'],{'as':'Agents','through':'user_has_openchannel_accounts'});db[_0x9e18('0x187')]['belongsTo'](db[_0x9e18('0x10e')],{'onDelete':_0x9e18('0x164')});db[_0x9e18('0x187')][_0x9e18('0x11d')](db[_0x9e18('0x63')],{'onDelete':_0x9e18('0x164'),'foreignKey':'OpenchannelQueueId'});db[_0x9e18('0x187')][_0x9e18('0x11d')](db['OpenchannelAccount'],{'onDelete':'restrict','foreignKey':_0x9e18('0x186')});db[_0x9e18('0x187')][_0x9e18('0x11d')](db['Interval'],{'onDelete':_0x9e18('0x164'),'foreignKey':_0x9e18('0x153')});db['OpenchannelApplication'][_0x9e18('0x11d')](db[_0x9e18('0x95')],{'onDelete':_0x9e18('0x164'),'foreignKey':'TagId'});db[_0x9e18('0x5f')][_0x9e18('0x112')](db['OpenchannelMessage'],{'as':'Messages','onDelete':_0x9e18('0x110'),'foreignKey':_0x9e18('0x188')});db[_0x9e18('0x5f')][_0x9e18('0x11d')](db[_0x9e18('0x5c')],{'as':_0x9e18('0x16c'),'foreignKey':_0x9e18('0x186')});db[_0x9e18('0x5f')][_0x9e18('0x11d')](db[_0x9e18('0x78')],{'as':_0x9e18('0x160'),'foreignKey':'ContactId'});db[_0x9e18('0x5f')][_0x9e18('0x11d')](db[_0x9e18('0x10e')],{'as':'Owner','foreignKey':_0x9e18('0x116')});db['OpenchannelInteraction'][_0x9e18('0x11f')](db[_0x9e18('0x95')],{'through':'openchannel_interaction_has_tags','as':_0x9e18('0x16e')});db['OpenchannelInteraction']['belongsToMany'](db[_0x9e18('0x95')],{'through':'openchannel_interaction_has_tags','as':_0x9e18('0x170')});db[_0x9e18('0x5f')]['belongsToMany'](db['User'],{'as':'Users','through':_0x9e18('0x12c'),'foreignKey':_0x9e18('0x188')});db[_0x9e18('0x61')][_0x9e18('0x11d')](db[_0x9e18('0x10e')],{'onDelete':_0x9e18('0x110'),'as':_0x9e18('0x10e')});db[_0x9e18('0x61')][_0x9e18('0x11d')](db[_0x9e18('0x78')],{'onDelete':_0x9e18('0x110'),'as':_0x9e18('0x160')});db['OpenchannelMessage'][_0x9e18('0x11d')](db[_0x9e18('0x5f')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x9e18('0x188')});db[_0x9e18('0x61')][_0x9e18('0x11d')](db['Attachment'],{'as':_0x9e18('0xea'),'foreignKey':'AttachmentId'});db['OpenchannelMessage'][_0x9e18('0x11d')](db[_0x9e18('0x5c')],{'as':'Account','foreignKey':_0x9e18('0x186')});db[_0x9e18('0x63')][_0x9e18('0x11f')](db[_0x9e18('0x10e')],{'as':_0x9e18('0x157'),'through':_0x9e18('0x137'),'foreignKey':_0x9e18('0x189')});db[_0x9e18('0x63')][_0x9e18('0x11f')](db[_0x9e18('0x169')],{'through':_0x9e18('0x18a'),'as':'Teams'});db[_0x9e18('0x139')][_0x9e18('0x112')](db[_0x9e18('0x89')],{'as':_0x9e18('0x167'),'foreignKey':'ChatWebsiteId','onDelete':_0x9e18('0x110')});db[_0x9e18('0x139')][_0x9e18('0x112')](db[_0x9e18('0x87')],{'as':_0x9e18('0x179'),'foreignKey':_0x9e18('0x173')});db[_0x9e18('0x139')][_0x9e18('0x112')](db[_0x9e18('0x74')],{'as':'ProactiveActions'});db['ChatWebsite'][_0x9e18('0x112')](db[_0x9e18('0x6a')],{'as':'Interactions'});db[_0x9e18('0x139')][_0x9e18('0x112')](db['ChatApplication'],{'as':_0x9e18('0x149')});db[_0x9e18('0x139')][_0x9e18('0x112')](db['ChatMessage'],{'as':_0x9e18('0x15b')});db[_0x9e18('0x139')][_0x9e18('0x11d')](db[_0x9e18('0xf4')],{'as':_0x9e18('0x168'),'foreignKey':'ListId'});db[_0x9e18('0x139')][_0x9e18('0x11d')](db['Interval'],{'as':_0x9e18('0x8c'),'foreignKey':'IntervalId'});db[_0x9e18('0x139')][_0x9e18('0x11d')](db[_0x9e18('0x3b')],{'as':_0x9e18('0x3b'),'foreignKey':'MailAccountId'});db['ChatWebsite'][_0x9e18('0x11d')](db['Pause'],{'as':_0x9e18('0x154'),'foreignKey':_0x9e18('0x155')});db[_0x9e18('0x139')][_0x9e18('0x11f')](db[_0x9e18('0x10e')],{'as':_0x9e18('0x157'),'through':_0x9e18('0x13b')});db['OpenchannelQueueReport'][_0x9e18('0x11d')](db[_0x9e18('0x5c')],{});db['OpenchannelQueueReport'][_0x9e18('0x11d')](db[_0x9e18('0xf4')],{'as':'List','foreignKey':_0x9e18('0x17b')});db[_0x9e18('0x66')][_0x9e18('0x11d')](db[_0x9e18('0x78')],{'as':_0x9e18('0x160'),'foreignKey':_0x9e18('0x161')});db[_0x9e18('0x66')][_0x9e18('0x11d')](db['OpenchannelInteraction'],{});db[_0x9e18('0x66')][_0x9e18('0x11d')](db[_0x9e18('0x61')],{});db[_0x9e18('0x66')][_0x9e18('0x11d')](db[_0x9e18('0x10e')],{});db[_0x9e18('0x66')]['belongsTo'](db[_0x9e18('0x63')],{});db[_0x9e18('0x68')][_0x9e18('0x11d')](db['User'],{'as':_0x9e18('0x18b'),'foreignKey':_0x9e18('0x116'),'onDelete':_0x9e18('0x164')});db[_0x9e18('0x68')][_0x9e18('0x11d')](db[_0x9e18('0x70')],{'as':'Queue','foreignKey':_0x9e18('0x18c'),'onDelete':'restrict'});db[_0x9e18('0x68')][_0x9e18('0x11d')](db[_0x9e18('0x139')],{'as':_0x9e18('0x18d'),'foreignKey':_0x9e18('0x173'),'onDelete':_0x9e18('0x164')});db['ChatApplication'][_0x9e18('0x11d')](db[_0x9e18('0x95')],{'onDelete':_0x9e18('0x164'),'foreignKey':_0x9e18('0x18e')});db['ChatInteraction'][_0x9e18('0x112')](db['ChatMessage'],{'as':_0x9e18('0x15b'),'onDelete':_0x9e18('0x110'),'foreignKey':_0x9e18('0x18f')});db[_0x9e18('0x6a')][_0x9e18('0x11d')](db['ChatWebsite'],{'as':_0x9e18('0x16c'),'foreignKey':_0x9e18('0x173')});db[_0x9e18('0x6a')][_0x9e18('0x11d')](db[_0x9e18('0x78')],{'as':_0x9e18('0x160'),'foreignKey':'ContactId'});db[_0x9e18('0x6a')]['belongsTo'](db['User'],{'as':'Owner','foreignKey':_0x9e18('0x116')});db[_0x9e18('0x6a')][_0x9e18('0x11f')](db[_0x9e18('0x95')],{'through':_0x9e18('0x190'),'as':_0x9e18('0x16e')});db[_0x9e18('0x6a')][_0x9e18('0x11f')](db[_0x9e18('0x95')],{'through':_0x9e18('0x190'),'as':_0x9e18('0x170')});db[_0x9e18('0x6a')][_0x9e18('0x11f')](db[_0x9e18('0x10e')],{'as':_0x9e18('0x171'),'through':_0x9e18('0x191'),'foreignKey':_0x9e18('0x18f')});db[_0x9e18('0x6c')]['belongsTo'](db[_0x9e18('0x10e')],{'onDelete':_0x9e18('0x110'),'as':'User'});db[_0x9e18('0x6c')]['belongsTo'](db[_0x9e18('0x78')],{'onDelete':'cascade','as':_0x9e18('0x160'),'foreignKey':_0x9e18('0x161')});db[_0x9e18('0x6c')][_0x9e18('0x11d')](db[_0x9e18('0x6a')],{'onDelete':_0x9e18('0x110'),'as':'Interaction','foreignKey':_0x9e18('0x18f')});db[_0x9e18('0x6c')][_0x9e18('0x11d')](db[_0x9e18('0xea')],{'as':_0x9e18('0xea'),'foreignKey':'AttachmentId'});db[_0x9e18('0x6c')][_0x9e18('0x11d')](db[_0x9e18('0x139')],{'as':_0x9e18('0x16c'),'foreignKey':_0x9e18('0x173')});db[_0x9e18('0x6e')]['hasMany'](db[_0x9e18('0xea')],{'as':_0x9e18('0x192'),'foreignKey':_0x9e18('0x174'),'onDelete':_0x9e18('0x110'),'hooks':!![]});db['ChatOfflineMessage'][_0x9e18('0x11d')](db['CmContact'],{'onDelete':'cascade','as':_0x9e18('0x160'),'foreignKey':_0x9e18('0x161')});db['ChatOfflineMessage'][_0x9e18('0x11d')](db[_0x9e18('0x139')],{'as':_0x9e18('0x16c'),'foreignKey':'ChatWebsiteId'});db[_0x9e18('0x70')][_0x9e18('0x11f')](db[_0x9e18('0x10e')],{'as':_0x9e18('0x157'),'through':'UserChatQueue','hooks':!![]});db['ChatQueue'][_0x9e18('0x11f')](db[_0x9e18('0x169')],{'through':_0x9e18('0x193'),'as':_0x9e18('0x158')});db['ChatGroup'][_0x9e18('0x112')](db[_0x9e18('0xd3')],{'as':_0x9e18('0x15b'),'foreignKey':_0x9e18('0x194'),'onDelete':'cascade'});db[_0x9e18('0x72')][_0x9e18('0x11f')](db[_0x9e18('0x10e')],{'as':_0x9e18('0x195'),'through':_0x9e18('0x121')});db[_0x9e18('0x74')]['belongsTo'](db[_0x9e18('0x139')],{'as':'Website','foreignKey':_0x9e18('0x173')});db[_0x9e18('0x76')][_0x9e18('0x112')](db['CmContact'],{'as':_0x9e18('0x122'),'foreignKey':_0x9e18('0x196')});db[_0x9e18('0x78')][_0x9e18('0x112')](db[_0x9e18('0x7a')],{'as':_0x9e18('0x14c'),'foreignKey':'ContactId'});db[_0x9e18('0x78')][_0x9e18('0x112')](db[_0x9e18('0x14d')],{'as':'HopperFinals','foreignKey':_0x9e18('0x161')});db['CmContact']['hasMany'](db[_0x9e18('0x7e')],{'as':_0x9e18('0x197'),'foreignKey':'ContactId'});db['CmContact'][_0x9e18('0x112')](db[_0x9e18('0x80')],{'as':_0x9e18('0x80'),'foreignKey':_0x9e18('0x161')});db['CmContact'][_0x9e18('0x112')](db['JscriptySessionReport'],{'as':_0x9e18('0x14f'),'foreignKey':_0x9e18('0x161')});db['CmContact'][_0x9e18('0x112')](db['OpenchannelInteraction'],{'as':_0x9e18('0x118'),'foreignKey':_0x9e18('0x161'),'onDelete':_0x9e18('0x164')});db['CmContact'][_0x9e18('0x112')](db[_0x9e18('0x6a')],{'as':_0x9e18('0x119'),'foreignKey':_0x9e18('0x161'),'onDelete':_0x9e18('0x164')});db['CmContact'][_0x9e18('0x112')](db[_0x9e18('0x57')],{'as':_0x9e18('0x11a'),'foreignKey':'ContactId','onDelete':_0x9e18('0x164')});db[_0x9e18('0x78')]['hasMany'](db[_0x9e18('0x4e')],{'as':_0x9e18('0x129'),'foreignKey':_0x9e18('0x161'),'onDelete':'restrict'});db[_0x9e18('0x78')][_0x9e18('0x112')](db['MailInteraction'],{'as':_0x9e18('0x127'),'foreignKey':'ContactId','onDelete':_0x9e18('0x164')});db[_0x9e18('0x78')][_0x9e18('0x11d')](db[_0x9e18('0x76')],{'as':_0x9e18('0x198'),'foreignKey':'CompanyId'});db[_0x9e18('0x78')]['belongsTo'](db[_0x9e18('0xf4')],{'as':'List','foreignKey':_0x9e18('0x17b'),'onDelete':_0x9e18('0x110')});db['CmContact']['belongsToMany'](db[_0x9e18('0x10e')],{'as':_0x9e18('0x171'),'through':'cm_user_has_contacts'});db[_0x9e18('0x78')]['belongsToMany'](db[_0x9e18('0x95')],{'as':_0x9e18('0x16e'),'through':_0x9e18('0x199')});db['CmContact'][_0x9e18('0x11f')](db[_0x9e18('0x95')],{'through':_0x9e18('0x199'),'as':'ThroughTags'});db['CmHopper'][_0x9e18('0x11d')](db[_0x9e18('0x78')],{'as':_0x9e18('0x160'),'foreignKey':_0x9e18('0x161'),'onDelete':'cascade'});db[_0x9e18('0x7a')][_0x9e18('0x11d')](db[_0x9e18('0xf4')],{'as':_0x9e18('0x168'),'foreignKey':'ListId','onDelete':_0x9e18('0x110')});db[_0x9e18('0x7a')][_0x9e18('0x11d')](db[_0x9e18('0x10e')],{'as':_0x9e18('0x18b'),'foreignKey':_0x9e18('0x116')});db['CmHopper'][_0x9e18('0x11d')](db[_0x9e18('0x18')],{'as':_0x9e18('0x19a'),'foreignKey':_0x9e18('0x14b'),'onDelete':'cascade'});db['CmHopper'][_0x9e18('0x11d')](db[_0x9e18('0xe6')],{'as':_0x9e18('0xe6'),'foreignKey':'CampaignId','onDelete':_0x9e18('0x110')});db['CmHopper'][_0x9e18('0x11d')](db[_0x9e18('0x10e')],{'as':_0x9e18('0x16d'),'foreignKey':_0x9e18('0x19b')});db[_0x9e18('0x7c')][_0x9e18('0x11d')](db['CmContact'],{'as':'Contact','foreignKey':_0x9e18('0x161'),'onDelete':_0x9e18('0x110')});db[_0x9e18('0x7c')]['belongsTo'](db[_0x9e18('0xf4')],{'as':_0x9e18('0x168'),'foreignKey':_0x9e18('0x17b'),'onDelete':_0x9e18('0x110')});db['CmHopperBlack'][_0x9e18('0x11d')](db['VoiceQueue'],{'as':_0x9e18('0x19a'),'foreignKey':'VoiceQueueId','onDelete':_0x9e18('0x110')});db[_0x9e18('0x7c')][_0x9e18('0x11d')](db['Campaign'],{'as':'Campaign','foreignKey':_0x9e18('0x19c'),'onDelete':_0x9e18('0x110')});db[_0x9e18('0x19d')][_0x9e18('0x112')](db[_0x9e18('0x8b')],{'as':{'plural':'All','singular':'OneAll'},'foreignKey':_0x9e18('0x19e'),'onDelete':'cascade','hooks':!![]});db[_0x9e18('0x19d')]['hasMany'](db[_0x9e18('0x8b')],{'as':{'plural':_0x9e18('0x19f'),'singular':'OneAny'},'foreignKey':_0x9e18('0x1a0'),'onDelete':_0x9e18('0x110'),'hooks':!![]});db['Automation'][_0x9e18('0x112')](db['Action'],{'as':_0x9e18('0x1a1'),'foreignKey':_0x9e18('0x1a2'),'onDelete':_0x9e18('0x110'),'hooks':!![]});db[_0x9e18('0x89')][_0x9e18('0x112')](db[_0x9e18('0x89')],{'as':_0x9e18('0x167'),'foreignKey':_0x9e18('0x1a3'),'onDelete':'cascade'});db[_0x9e18('0x8c')][_0x9e18('0x112')](db['Interval'],{'as':_0x9e18('0x1a4'),'foreignKey':_0x9e18('0x153'),'onDelete':_0x9e18('0x110'),'hooks':!![],'required':![]});db['Interval'][_0x9e18('0x112')](db['VoiceExtension'],{'as':_0x9e18('0x114'),'foreignKey':_0x9e18('0x153'),'onDelete':'restrict'});db[_0x9e18('0x8c')][_0x9e18('0x112')](db[_0x9e18('0x45')],{'as':_0x9e18('0x1a5'),'foreignKey':_0x9e18('0x153')});db['Interval'][_0x9e18('0x112')](db[_0x9e18('0x68')],{'as':'ChatApplications','foreignKey':_0x9e18('0x153')});db[_0x9e18('0x8c')]['hasMany'](db['FaxApplication'],{'as':_0x9e18('0x1a6'),'foreignKey':_0x9e18('0x153')});db[_0x9e18('0x8c')][_0x9e18('0x112')](db[_0x9e18('0x55')],{'as':_0x9e18('0x1a7'),'foreignKey':_0x9e18('0x153')});db[_0x9e18('0x1a8')]['belongsTo'](db['MailAccount'],{});db[_0x9e18('0x1a8')][_0x9e18('0x11d')](db[_0x9e18('0x9d')],{'foreignKey':_0x9e18('0x1a9')});db[_0x9e18('0x1a8')][_0x9e18('0x11d')](db['AnalyticCustomReport'],{'foreignKey':_0x9e18('0x1aa')});db[_0x9e18('0x93')][_0x9e18('0x11f')](db[_0x9e18('0x16')],{'as':_0x9e18('0x1ab'),'through':_0x9e18('0x1ac'),'onDelete':_0x9e18('0x164')});db[_0x9e18('0x95')]['belongsToMany'](db[_0x9e18('0x78')],{'through':'cm_contact_has_tags'});db['Tag'][_0x9e18('0x11f')](db[_0x9e18('0x6a')],{'through':_0x9e18('0x190')});db[_0x9e18('0x95')][_0x9e18('0x11f')](db[_0x9e18('0x41')],{'through':_0x9e18('0x16f')});db['Tag'][_0x9e18('0x11f')](db[_0x9e18('0x57')],{'through':_0x9e18('0x182')});db[_0x9e18('0x95')]['belongsToMany'](db[_0x9e18('0x4e')],{'through':'fax_interaction_has_tags'});db['Tag']['belongsToMany'](db[_0x9e18('0x5f')],{'through':_0x9e18('0x1ad')});db['Tag']['belongsToMany'](db[_0x9e18('0x12d')],{'through':_0x9e18('0x1ae')});db[_0x9e18('0x1af')][_0x9e18('0x112')](db[_0x9e18('0x8b')],{'as':{'plural':_0x9e18('0x1b0'),'singular':'AllCondition'},'foreignKey':'TriggerAllId','onDelete':_0x9e18('0x110'),'hooks':!![]});db[_0x9e18('0x1af')][_0x9e18('0x112')](db[_0x9e18('0x8b')],{'as':{'plural':_0x9e18('0x1b1'),'singular':_0x9e18('0x1b2')},'foreignKey':_0x9e18('0x1b3'),'onDelete':_0x9e18('0x110'),'hooks':!![]});db['Trigger'][_0x9e18('0x112')](db['Action'],{'as':_0x9e18('0x1a1'),'foreignKey':'TriggerId','onDelete':_0x9e18('0x110'),'hooks':!![]});db[_0x9e18('0x1b4')][_0x9e18('0x112')](db[_0x9e18('0xa2')],{'as':_0x9e18('0x1b5'),'onDelete':'cascade','foreignKey':'CustomReportId','hooks':!![]});db['AnalyticDefaultReport']['hasMany'](db[_0x9e18('0xa2')],{'as':'Fields','onDelete':_0x9e18('0x110'),'foreignKey':_0x9e18('0x1a9')});db[_0x9e18('0x1b6')][_0x9e18('0x112')](db[_0x9e18('0xa2')],{'as':_0x9e18('0x1b5'),'onDelete':_0x9e18('0x110'),'foreignKey':_0x9e18('0x1b7')});db['AnalyticFieldReport'][_0x9e18('0x11d')](db[_0x9e18('0x1b6')],{'foreignKey':_0x9e18('0x1b7')});db[_0x9e18('0xa4')][_0x9e18('0x112')](db[_0x9e18('0x1b8')],{'as':_0x9e18('0x1b9'),'onDelete':_0x9e18('0x110'),'foreignKey':'AccountId'});db[_0x9e18('0x1b8')][_0x9e18('0x112')](db[_0x9e18('0xa7')],{'as':_0x9e18('0x1ba'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x9e18('0x1b8')]['hasMany'](db[_0x9e18('0xa7')],{'as':_0x9e18('0x1bb'),'onDelete':_0x9e18('0x110'),'foreignKey':_0x9e18('0x1bc')});db[_0x9e18('0x1b8')][_0x9e18('0x112')](db[_0x9e18('0xa7')],{'as':_0x9e18('0x1b5'),'onDelete':'cascade','foreignKey':'FieldId'});db['SalesforceConfiguration']['belongsTo'](db['SalesforceAccount'],{'as':'Account','foreignKey':_0x9e18('0x1bd')});db[_0x9e18('0xa7')][_0x9e18('0x112')](db[_0x9e18('0xa7')],{'as':_0x9e18('0x1be'),'foreignKey':_0x9e18('0x1bf')});db[_0x9e18('0xa7')]['hasMany'](db[_0x9e18('0xa7')],{'as':_0x9e18('0x1c0'),'foreignKey':_0x9e18('0x1bc')});db[_0x9e18('0xa7')][_0x9e18('0x112')](db['SalesforceField'],{'as':'Field','foreignKey':_0x9e18('0x1c1')});db[_0x9e18('0xa7')][_0x9e18('0x11d')](db[_0x9e18('0x98')],{'as':_0x9e18('0x98'),'foreignKey':_0x9e18('0x1c2')});db[_0x9e18('0xa9')][_0x9e18('0x112')](db[_0x9e18('0x1c3')],{'as':_0x9e18('0x1b9'),'onDelete':_0x9e18('0x110'),'foreignKey':_0x9e18('0x1bd')});db[_0x9e18('0x1c3')][_0x9e18('0x112')](db[_0x9e18('0xab')],{'as':'Subjects','onDelete':_0x9e18('0x110'),'foreignKey':_0x9e18('0x1bf')});db[_0x9e18('0x1c3')]['hasMany'](db[_0x9e18('0xab')],{'as':'Descriptions','onDelete':_0x9e18('0x110'),'foreignKey':_0x9e18('0x1bc')});db[_0x9e18('0x1c3')][_0x9e18('0x112')](db[_0x9e18('0xab')],{'as':_0x9e18('0x1b5'),'onDelete':'cascade','foreignKey':'FieldId'});db[_0x9e18('0x1c3')][_0x9e18('0x11d')](db[_0x9e18('0xa9')],{'as':_0x9e18('0x16c'),'foreignKey':_0x9e18('0x1bd')});db[_0x9e18('0xab')]['hasMany'](db[_0x9e18('0xab')],{'as':'Subject','foreignKey':_0x9e18('0x1bf')});db['SugarcrmField']['hasMany'](db[_0x9e18('0xab')],{'as':_0x9e18('0x1c0'),'foreignKey':_0x9e18('0x1bc')});db[_0x9e18('0xab')][_0x9e18('0x112')](db[_0x9e18('0xab')],{'as':'Field','foreignKey':_0x9e18('0x1c1')});db[_0x9e18('0xab')]['belongsTo'](db[_0x9e18('0x98')],{'as':_0x9e18('0x98'),'foreignKey':_0x9e18('0x1c2')});db[_0x9e18('0x1c4')]['hasMany'](db[_0x9e18('0xad')],{'as':_0x9e18('0x1b9'),'onDelete':'cascade','foreignKey':_0x9e18('0x1bd')});db[_0x9e18('0xad')][_0x9e18('0x112')](db['DeskField'],{'as':_0x9e18('0x1ba'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x9e18('0xad')][_0x9e18('0x112')](db[_0x9e18('0xaf')],{'as':_0x9e18('0x1bb'),'onDelete':_0x9e18('0x110'),'foreignKey':_0x9e18('0x1bc')});db[_0x9e18('0xad')][_0x9e18('0x112')](db[_0x9e18('0xaf')],{'as':_0x9e18('0x1b5'),'onDelete':_0x9e18('0x110'),'foreignKey':'FieldId'});db[_0x9e18('0xad')]['belongsTo'](db[_0x9e18('0x1c4')],{'as':'Account','foreignKey':'AccountId'});db['DeskConfiguration'][_0x9e18('0x11f')](db[_0x9e18('0x95')],{'through':_0x9e18('0x1c5')});db[_0x9e18('0xaf')][_0x9e18('0x112')](db[_0x9e18('0xaf')],{'as':_0x9e18('0x1be'),'foreignKey':_0x9e18('0x1bf')});db[_0x9e18('0xaf')][_0x9e18('0x112')](db[_0x9e18('0xaf')],{'as':_0x9e18('0x1c0'),'foreignKey':_0x9e18('0x1bc')});db[_0x9e18('0xaf')][_0x9e18('0x112')](db[_0x9e18('0xaf')],{'as':_0x9e18('0x1c6'),'foreignKey':'FieldId'});db[_0x9e18('0xaf')][_0x9e18('0x11d')](db[_0x9e18('0x98')],{'as':_0x9e18('0x98'),'foreignKey':'VariableId'});db[_0x9e18('0xb1')][_0x9e18('0x112')](db[_0x9e18('0xb3')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x9e18('0x1bd')});db[_0x9e18('0xb3')][_0x9e18('0x112')](db[_0x9e18('0xb5')],{'as':'Subjects','onDelete':_0x9e18('0x110'),'foreignKey':_0x9e18('0x1bf')});db['ZohoConfiguration'][_0x9e18('0x112')](db[_0x9e18('0xb5')],{'as':_0x9e18('0x1bb'),'onDelete':_0x9e18('0x110'),'foreignKey':'DescriptionId'});db[_0x9e18('0xb3')][_0x9e18('0x112')](db[_0x9e18('0xb5')],{'as':'Fields','onDelete':_0x9e18('0x110'),'foreignKey':'FieldId'});db[_0x9e18('0xb3')][_0x9e18('0x11d')](db[_0x9e18('0xb1')],{'as':_0x9e18('0x16c'),'foreignKey':_0x9e18('0x1bd')});db['ZohoField']['hasMany'](db['ZohoField'],{'as':_0x9e18('0x1be'),'foreignKey':_0x9e18('0x1bf')});db['ZohoField'][_0x9e18('0x112')](db[_0x9e18('0xb5')],{'as':_0x9e18('0x1c0'),'foreignKey':'DescriptionId'});db[_0x9e18('0xb5')][_0x9e18('0x112')](db['ZohoField'],{'as':_0x9e18('0x1c6'),'foreignKey':_0x9e18('0x1c1')});db['ZohoField'][_0x9e18('0x11d')](db[_0x9e18('0x98')],{'as':_0x9e18('0x98'),'foreignKey':_0x9e18('0x1c2')});db['ZendeskAccount']['hasMany'](db[_0x9e18('0x1c7')],{'as':_0x9e18('0x1b9'),'onDelete':_0x9e18('0x110'),'foreignKey':_0x9e18('0x1bd')});db[_0x9e18('0x1c7')]['hasMany'](db['ZendeskField'],{'as':_0x9e18('0x1ba'),'foreignKey':_0x9e18('0x1bf')});db[_0x9e18('0x1c7')][_0x9e18('0x112')](db[_0x9e18('0xb8')],{'as':_0x9e18('0x1bb'),'foreignKey':_0x9e18('0x1bc')});db['ZendeskConfiguration'][_0x9e18('0x112')](db[_0x9e18('0xb8')],{'as':'Fields','foreignKey':_0x9e18('0x1c1')});db['ZendeskConfiguration']['belongsTo'](db['ZendeskAccount'],{'as':_0x9e18('0x16c'),'foreignKey':_0x9e18('0x1bd')});db['ZendeskConfiguration'][_0x9e18('0x11f')](db[_0x9e18('0x95')],{'through':_0x9e18('0x1c8')});db[_0x9e18('0xb8')]['hasMany'](db[_0x9e18('0xb8')],{'as':_0x9e18('0x1be'),'foreignKey':_0x9e18('0x1bf')});db['ZendeskField'][_0x9e18('0x112')](db[_0x9e18('0xb8')],{'as':_0x9e18('0x1c0'),'foreignKey':_0x9e18('0x1bc')});db[_0x9e18('0xb8')][_0x9e18('0x112')](db[_0x9e18('0xb8')],{'as':_0x9e18('0x1c6'),'foreignKey':_0x9e18('0x1c1')});db['ZendeskField']['belongsTo'](db[_0x9e18('0x98')],{'as':_0x9e18('0x98'),'foreignKey':_0x9e18('0x1c2')});db[_0x9e18('0x1c9')][_0x9e18('0x112')](db[_0x9e18('0xbb')],{'as':_0x9e18('0x1b9'),'onDelete':'cascade','foreignKey':_0x9e18('0x1bd')});db[_0x9e18('0xbb')][_0x9e18('0x112')](db['FreshdeskField'],{'as':_0x9e18('0x1ba'),'onDelete':_0x9e18('0x110'),'foreignKey':_0x9e18('0x1bf')});db[_0x9e18('0xbb')]['hasMany'](db[_0x9e18('0xbd')],{'as':_0x9e18('0x1bb'),'onDelete':_0x9e18('0x110'),'foreignKey':'DescriptionId'});db[_0x9e18('0xbb')][_0x9e18('0x112')](db[_0x9e18('0xbd')],{'as':'Fields','onDelete':_0x9e18('0x110'),'foreignKey':'FieldId'});db[_0x9e18('0xbb')][_0x9e18('0x11d')](db[_0x9e18('0x1c9')],{'as':_0x9e18('0x16c'),'foreignKey':_0x9e18('0x1bd')});db[_0x9e18('0xbb')][_0x9e18('0x11f')](db[_0x9e18('0x95')],{'through':'int_freshdesk_configuration_has_tags'});db[_0x9e18('0xbd')][_0x9e18('0x112')](db['FreshdeskField'],{'as':'Subject','foreignKey':_0x9e18('0x1bf')});db[_0x9e18('0xbd')][_0x9e18('0x112')](db[_0x9e18('0xbd')],{'as':'Description','foreignKey':_0x9e18('0x1bc')});db[_0x9e18('0xbd')]['hasMany'](db[_0x9e18('0xbd')],{'as':_0x9e18('0x1c6'),'foreignKey':_0x9e18('0x1c1')});db[_0x9e18('0xbd')]['belongsTo'](db['Variable'],{'as':'Variable','foreignKey':_0x9e18('0x1c2')});db[_0x9e18('0xbe')][_0x9e18('0x112')](db['VtigerConfiguration'],{'as':_0x9e18('0x1b9'),'onDelete':'cascade','foreignKey':_0x9e18('0x1bd')});db[_0x9e18('0x1ca')][_0x9e18('0x112')](db[_0x9e18('0xc1')],{'as':_0x9e18('0x1ba'),'foreignKey':'SubjectId'});db['VtigerConfiguration'][_0x9e18('0x112')](db[_0x9e18('0xc1')],{'as':_0x9e18('0x1bb'),'foreignKey':_0x9e18('0x1bc')});db[_0x9e18('0x1ca')][_0x9e18('0x112')](db[_0x9e18('0xc1')],{'as':_0x9e18('0x1b5'),'foreignKey':_0x9e18('0x1c1')});db[_0x9e18('0x1ca')]['belongsTo'](db[_0x9e18('0xbe')],{'as':_0x9e18('0x16c'),'foreignKey':_0x9e18('0x1bd')});db[_0x9e18('0xc1')][_0x9e18('0x112')](db['VtigerField'],{'as':_0x9e18('0x1be'),'foreignKey':_0x9e18('0x1bf')});db[_0x9e18('0xc1')][_0x9e18('0x112')](db[_0x9e18('0xc1')],{'as':'Description','foreignKey':_0x9e18('0x1bc')});db[_0x9e18('0xc1')][_0x9e18('0x112')](db[_0x9e18('0xc1')],{'as':'Field','foreignKey':_0x9e18('0x1c1')});db[_0x9e18('0xc1')][_0x9e18('0x11d')](db['Variable'],{'as':_0x9e18('0x98'),'foreignKey':_0x9e18('0x1c2')});db['ServicenowAccount'][_0x9e18('0x112')](db['ServicenowConfiguration'],{'as':_0x9e18('0x1b9'),'onDelete':_0x9e18('0x110'),'foreignKey':_0x9e18('0x1bd')});db[_0x9e18('0xc5')][_0x9e18('0x112')](db['ServicenowField'],{'as':_0x9e18('0x1ba'),'foreignKey':'SubjectId'});db['ServicenowConfiguration'][_0x9e18('0x112')](db[_0x9e18('0xc6')],{'as':_0x9e18('0x1bb'),'foreignKey':_0x9e18('0x1bc')});db[_0x9e18('0xc5')]['hasMany'](db[_0x9e18('0xc6')],{'as':_0x9e18('0x1b5'),'foreignKey':'FieldId'});db[_0x9e18('0xc5')][_0x9e18('0x11d')](db[_0x9e18('0xc3')],{'as':'Account','foreignKey':_0x9e18('0x1bd')});db[_0x9e18('0xc6')][_0x9e18('0x112')](db[_0x9e18('0xc6')],{'as':_0x9e18('0x1be'),'foreignKey':_0x9e18('0x1bf')});db[_0x9e18('0xc6')][_0x9e18('0x112')](db['ServicenowField'],{'as':_0x9e18('0x1c0'),'foreignKey':_0x9e18('0x1bc')});db[_0x9e18('0xc6')]['hasMany'](db[_0x9e18('0xc6')],{'as':'Field','foreignKey':_0x9e18('0x1c1')});db[_0x9e18('0xc6')][_0x9e18('0x11d')](db[_0x9e18('0x98')],{'as':_0x9e18('0x98'),'foreignKey':_0x9e18('0x1c2')});db[_0x9e18('0xc8')][_0x9e18('0x112')](db['Dynamics365Configuration'],{'as':_0x9e18('0x1b9'),'onDelete':_0x9e18('0x110'),'foreignKey':_0x9e18('0x1bd')});db[_0x9e18('0xca')]['hasMany'](db[_0x9e18('0x1cb')],{'as':_0x9e18('0x1ba'),'onDelete':_0x9e18('0x110'),'foreignKey':_0x9e18('0x1bf')});db[_0x9e18('0xca')][_0x9e18('0x112')](db[_0x9e18('0x1cb')],{'as':_0x9e18('0x1bb'),'onDelete':_0x9e18('0x110'),'foreignKey':'DescriptionId'});db[_0x9e18('0xca')][_0x9e18('0x112')](db[_0x9e18('0x1cb')],{'as':_0x9e18('0x1b5'),'onDelete':_0x9e18('0x110'),'foreignKey':_0x9e18('0x1c1')});db[_0x9e18('0xca')][_0x9e18('0x11d')](db[_0x9e18('0xc8')],{'as':'Account','foreignKey':_0x9e18('0x1bd')});db[_0x9e18('0x1cb')][_0x9e18('0x112')](db[_0x9e18('0x1cb')],{'as':_0x9e18('0x1be'),'foreignKey':_0x9e18('0x1bf')});db['Dynamics365Field'][_0x9e18('0x112')](db['Dynamics365Field'],{'as':_0x9e18('0x1c0'),'foreignKey':_0x9e18('0x1bc')});db[_0x9e18('0x1cb')][_0x9e18('0x112')](db['Dynamics365Field'],{'as':_0x9e18('0x1c6'),'foreignKey':_0x9e18('0x1c1')});db['Dynamics365Field']['belongsTo'](db['Variable'],{'as':'Variable','foreignKey':_0x9e18('0x1c2')});db[_0x9e18('0xcd')]['hasMany'](db[_0x9e18('0x1cc')],{'as':_0x9e18('0x1b9'),'onDelete':'cascade','foreignKey':_0x9e18('0x1bd')});db[_0x9e18('0x1cc')]['hasMany'](db[_0x9e18('0x1cd')],{'as':'Subjects','foreignKey':'SubjectId'});db['FreshsalesConfiguration'][_0x9e18('0x112')](db[_0x9e18('0x1cd')],{'as':_0x9e18('0x1bb'),'foreignKey':'DescriptionId'});db[_0x9e18('0x1cc')][_0x9e18('0x112')](db[_0x9e18('0x1cd')],{'as':_0x9e18('0x1b5'),'foreignKey':_0x9e18('0x1c1')});db['FreshsalesConfiguration'][_0x9e18('0x11d')](db[_0x9e18('0xcd')],{'as':_0x9e18('0x16c'),'foreignKey':_0x9e18('0x1bd')});db[_0x9e18('0x1cd')][_0x9e18('0x112')](db[_0x9e18('0x1cd')],{'as':_0x9e18('0x1be'),'foreignKey':_0x9e18('0x1bf')});db[_0x9e18('0x1cd')]['hasMany'](db[_0x9e18('0x1cd')],{'as':_0x9e18('0x1c0'),'foreignKey':_0x9e18('0x1bc')});db[_0x9e18('0x1cd')][_0x9e18('0x112')](db[_0x9e18('0x1cd')],{'as':'Field','foreignKey':_0x9e18('0x1c1')});db[_0x9e18('0x1cd')]['belongsTo'](db[_0x9e18('0x98')],{'as':'Variable','foreignKey':_0x9e18('0x1c2')});db[_0x9e18('0xd1')][_0x9e18('0x11d')](db[_0x9e18('0x139')],{});db[_0x9e18('0xd1')]['belongsTo'](db[_0x9e18('0xf4')],{'as':'List','foreignKey':_0x9e18('0x17b')});db[_0x9e18('0xd1')][_0x9e18('0x11d')](db[_0x9e18('0x78')],{'as':'Contact','foreignKey':_0x9e18('0x161')});db['ChatQueueReport']['belongsTo'](db[_0x9e18('0x6a')],{});db['ChatQueueReport']['belongsTo'](db['ChatMessage'],{});db['ChatQueueReport']['belongsTo'](db[_0x9e18('0x10e')],{});db[_0x9e18('0xd1')][_0x9e18('0x11d')](db['ChatQueue'],{});db['ChatInternalMessage'][_0x9e18('0x11d')](db[_0x9e18('0x10e')],{'onDelete':_0x9e18('0x110'),'foreignKey':_0x9e18('0x1ce')});db[_0x9e18('0xd3')][_0x9e18('0x11d')](db[_0x9e18('0x10e')],{'onDelete':_0x9e18('0x110'),'foreignKey':_0x9e18('0x1cf')});db[_0x9e18('0xd8')][_0x9e18('0x112')](db['JscriptyQuestionReport'],{'foreignKey':'SessionId','onDelete':_0x9e18('0x110')});db[_0x9e18('0xd8')][_0x9e18('0x112')](db[_0x9e18('0xd5')],{'foreignKey':_0x9e18('0x1d0'),'onDelete':_0x9e18('0x110')});db[_0x9e18('0x1d1')][_0x9e18('0x11d')](db['SmsAccount'],{});db[_0x9e18('0x1d1')]['belongsTo'](db['CmList'],{'as':_0x9e18('0x168'),'foreignKey':'ListId'});db[_0x9e18('0x1d1')][_0x9e18('0x11d')](db[_0x9e18('0x78')],{'as':_0x9e18('0x160'),'foreignKey':_0x9e18('0x161')});db[_0x9e18('0x1d1')]['belongsTo'](db['SmsInteraction'],{});db['SmsQueueReport'][_0x9e18('0x11d')](db[_0x9e18('0x59')],{});db[_0x9e18('0x1d1')][_0x9e18('0x11d')](db[_0x9e18('0x10e')],{});db[_0x9e18('0x1d1')][_0x9e18('0x11d')](db[_0x9e18('0x5a')],{});db[_0x9e18('0xdb')][_0x9e18('0x112')](db[_0x9e18('0xd8')],{'foreignKey':_0x9e18('0x1d2')});db[_0x9e18('0xdb')]['hasMany'](db[_0x9e18('0x1d3')],{'foreignKey':'ProjectId'});db['JscriptyProject'][_0x9e18('0x112')](db[_0x9e18('0xd5')],{'foreignKey':_0x9e18('0x1d2')});db[_0x9e18('0xdf')][_0x9e18('0x11f')](db['User'],{'as':_0x9e18('0x171'),'through':_0x9e18('0x146')});db[_0x9e18('0x169')][_0x9e18('0x11f')](db[_0x9e18('0x10e')],{'as':_0x9e18('0x157'),'through':_0x9e18('0x126')});db[_0x9e18('0x169')][_0x9e18('0x11f')](db['VoiceQueue'],{'through':_0x9e18('0x1d4'),'as':_0x9e18('0x12f')});db['Team'][_0x9e18('0x11f')](db[_0x9e18('0x3d')],{'through':_0x9e18('0x16a'),'as':_0x9e18('0x131')});db[_0x9e18('0x169')][_0x9e18('0x11f')](db[_0x9e18('0x70')],{'through':_0x9e18('0x193'),'as':_0x9e18('0x133')});db[_0x9e18('0x169')]['belongsToMany'](db[_0x9e18('0x51')],{'through':_0x9e18('0x1d5'),'as':_0x9e18('0x134')});db[_0x9e18('0x169')][_0x9e18('0x11f')](db['SmsQueue'],{'through':_0x9e18('0x184'),'as':_0x9e18('0x135')});db[_0x9e18('0x169')][_0x9e18('0x11f')](db[_0x9e18('0x63')],{'through':_0x9e18('0x18a'),'as':'OpenchannelQueues'});db[_0x9e18('0x169')][_0x9e18('0x11f')](db[_0x9e18('0x105')],{'through':_0x9e18('0x1d6'),'as':_0x9e18('0x138')});db[_0x9e18('0x169')]['belongsToMany'](db[_0x9e18('0xf5')],{'through':_0x9e18('0x10a'),'as':_0x9e18('0x130')});db[_0x9e18('0xe6')][_0x9e18('0x112')](db[_0x9e18('0x7a')],{'as':_0x9e18('0x14c'),'foreignKey':_0x9e18('0x19c')});db[_0x9e18('0xe6')][_0x9e18('0x112')](db[_0x9e18('0x14d')],{'as':_0x9e18('0x115'),'foreignKey':_0x9e18('0x19c')});db['Campaign']['hasMany'](db[_0x9e18('0x7e')],{'as':_0x9e18('0x197'),'foreignKey':'CampaignId'});db[_0x9e18('0xe6')][_0x9e18('0x112')](db[_0x9e18('0x7c')],{'as':_0x9e18('0x14e'),'foreignKey':_0x9e18('0x19c')});db['Campaign'][_0x9e18('0x11d')](db['Trunk'],{'as':'Trunk','foreignKey':'TrunkId'});db[_0x9e18('0xe6')][_0x9e18('0x11d')](db[_0x9e18('0x150')],{'as':_0x9e18('0x1d7'),'foreignKey':_0x9e18('0x152')});db['Campaign'][_0x9e18('0x11d')](db[_0x9e18('0x8c')],{'as':'Interval','foreignKey':_0x9e18('0x153')});db[_0x9e18('0xe6')]['belongsTo'](db[_0x9e18('0xdf')],{'as':_0x9e18('0xdf'),'foreignKey':_0x9e18('0x1d8')});db[_0x9e18('0xe6')][_0x9e18('0x11f')](db[_0x9e18('0xf4')],{'as':_0x9e18('0x124'),'through':'campaigns_has_cm_lists'});db[_0x9e18('0xe6')][_0x9e18('0x11f')](db[_0x9e18('0xf4')],{'as':_0x9e18('0x159'),'through':_0x9e18('0x1d9')});db[_0x9e18('0xea')]['belongsTo'](db[_0x9e18('0x6e')],{'as':'ChatOfflineMessage','foreignKey':_0x9e18('0x174')});db[_0x9e18('0x1da')][_0x9e18('0x11d')](db[_0x9e18('0x43')],{});db[_0x9e18('0x1da')][_0x9e18('0x11d')](db[_0x9e18('0x41')],{});db[_0x9e18('0x1da')][_0x9e18('0x11d')](db[_0x9e18('0x3b')],{'foreignKey':_0x9e18('0x1db'),'as':_0x9e18('0x1dc')});db['MailTransferReport'][_0x9e18('0x11d')](db[_0x9e18('0x10e')],{'foreignKey':_0x9e18('0x1dd'),'as':'FromAgent'});db[_0x9e18('0x1da')]['belongsTo'](db[_0x9e18('0x10e')],{'foreignKey':_0x9e18('0x1de'),'as':_0x9e18('0x1df')});db['MailTransferReport'][_0x9e18('0x11d')](db[_0x9e18('0x3d')],{'foreignKey':_0x9e18('0x1e0'),'as':'ToQueue'});db[_0x9e18('0x1da')][_0x9e18('0x11d')](db[_0x9e18('0x3b')],{'foreignKey':'ToMailAccountId','as':_0x9e18('0x1e1')});db[_0x9e18('0xef')]['belongsTo'](db[_0x9e18('0x6c')],{});db['ChatTransferReport']['belongsTo'](db[_0x9e18('0x6a')],{});db[_0x9e18('0xef')][_0x9e18('0x11d')](db[_0x9e18('0x139')],{'foreignKey':_0x9e18('0x1e2'),'as':_0x9e18('0x1dc')});db[_0x9e18('0xef')][_0x9e18('0x11d')](db[_0x9e18('0x10e')],{'foreignKey':_0x9e18('0x1dd'),'as':_0x9e18('0x1e3')});db[_0x9e18('0xef')][_0x9e18('0x11d')](db[_0x9e18('0x10e')],{'foreignKey':_0x9e18('0x1de'),'as':_0x9e18('0x1df')});db[_0x9e18('0xef')][_0x9e18('0x11d')](db['ChatQueue'],{'foreignKey':'ToChatQueueId','as':_0x9e18('0x1e4')});db[_0x9e18('0xef')][_0x9e18('0x11d')](db[_0x9e18('0x139')],{'foreignKey':'ToChatWebsiteId','as':_0x9e18('0x1e1')});db['FaxTransferReport'][_0x9e18('0x11d')](db[_0x9e18('0x17d')],{});db[_0x9e18('0xf0')]['belongsTo'](db[_0x9e18('0x4e')],{});db[_0x9e18('0xf0')][_0x9e18('0x11d')](db[_0x9e18('0x4b')],{'foreignKey':_0x9e18('0x1e5'),'as':_0x9e18('0x1dc')});db['FaxTransferReport'][_0x9e18('0x11d')](db[_0x9e18('0x10e')],{'foreignKey':_0x9e18('0x1dd'),'as':'FromAgent'});db[_0x9e18('0xf0')][_0x9e18('0x11d')](db[_0x9e18('0x10e')],{'foreignKey':'ToUserId','as':_0x9e18('0x1df')});db[_0x9e18('0xf0')][_0x9e18('0x11d')](db[_0x9e18('0x51')],{'foreignKey':_0x9e18('0x1e6'),'as':_0x9e18('0x1e4')});db[_0x9e18('0xf0')]['belongsTo'](db['FaxAccount'],{'foreignKey':_0x9e18('0x1e7'),'as':_0x9e18('0x1e1')});db[_0x9e18('0xf2')][_0x9e18('0x11d')](db[_0x9e18('0x61')],{});db[_0x9e18('0xf2')][_0x9e18('0x11d')](db[_0x9e18('0x5f')],{});db[_0x9e18('0xf2')][_0x9e18('0x11d')](db[_0x9e18('0x5c')],{'foreignKey':_0x9e18('0x1e8'),'as':_0x9e18('0x1dc')});db[_0x9e18('0xf2')]['belongsTo'](db[_0x9e18('0x10e')],{'foreignKey':_0x9e18('0x1dd'),'as':_0x9e18('0x1e3')});db['OpenchannelTransferReport']['belongsTo'](db[_0x9e18('0x10e')],{'foreignKey':_0x9e18('0x1de'),'as':_0x9e18('0x1df')});db['OpenchannelTransferReport'][_0x9e18('0x11d')](db[_0x9e18('0x63')],{'foreignKey':_0x9e18('0x1e9'),'as':_0x9e18('0x1e4')});db['OpenchannelTransferReport'][_0x9e18('0x11d')](db['OpenchannelAccount'],{'foreignKey':_0x9e18('0x1ea'),'as':_0x9e18('0x1e1')});db['SmsTransferReport']['belongsTo'](db[_0x9e18('0x59')],{});db['SmsTransferReport'][_0x9e18('0x11d')](db['SmsInteraction'],{});db[_0x9e18('0xf3')][_0x9e18('0x11d')](db[_0x9e18('0x141')],{'foreignKey':_0x9e18('0x1eb'),'as':'FromAccount'});db[_0x9e18('0xf3')][_0x9e18('0x11d')](db[_0x9e18('0x10e')],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0x9e18('0xf3')][_0x9e18('0x11d')](db[_0x9e18('0x10e')],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0x9e18('0xf3')][_0x9e18('0x11d')](db[_0x9e18('0x5a')],{'foreignKey':'ToSmsQueueId','as':_0x9e18('0x1e4')});db[_0x9e18('0xf3')][_0x9e18('0x11d')](db['SmsAccount'],{'foreignKey':_0x9e18('0x1ec'),'as':'ToAccount'});db[_0x9e18('0xf4')][_0x9e18('0x112')](db[_0x9e18('0x89')],{'as':_0x9e18('0x167'),'foreignKey':_0x9e18('0x17b'),'onDelete':_0x9e18('0x110')});db[_0x9e18('0xf4')]['hasMany'](db['CmCustomField'],{'as':'CustomFields','foreignKey':'ListId'});db['CmList'][_0x9e18('0x112')](db['CmContact'],{'as':_0x9e18('0x122'),'onDelete':_0x9e18('0x110'),'foreignKey':_0x9e18('0x17b')});db[_0x9e18('0xf4')][_0x9e18('0x112')](db[_0x9e18('0x14d')],{'as':_0x9e18('0x115'),'foreignKey':_0x9e18('0x17b')});db['CmList'][_0x9e18('0x112')](db[_0x9e18('0x7e')],{'as':_0x9e18('0x117'),'foreignKey':_0x9e18('0x17b')});db[_0x9e18('0xf4')][_0x9e18('0x112')](db['ReportAgentPreview'],{'as':_0x9e18('0x80'),'foreignKey':_0x9e18('0x17b')});db[_0x9e18('0xf4')][_0x9e18('0x11f')](db[_0x9e18('0x18')],{'as':_0x9e18('0x1ed'),'through':_0x9e18('0x156')});db[_0x9e18('0xf4')][_0x9e18('0x11f')](db[_0x9e18('0x10e')],{'as':_0x9e18('0x157'),'through':'cm_user_has_lists'});db['VoicePrefix']['hasMany'](db[_0x9e18('0x15')],{'as':'Extensions','onDelete':_0x9e18('0x110')});db[_0x9e18('0xf5')][_0x9e18('0x11f')](db[_0x9e18('0x10e')],{'as':'Agents','through':_0x9e18('0x10c')});db['VoicePrefix'][_0x9e18('0x11f')](db[_0x9e18('0x169')],{'through':'TeamVoicePrefix','as':_0x9e18('0x158')});db['UserProfile'][_0x9e18('0x112')](db[_0x9e18('0x10e')],{'as':_0x9e18('0x171'),'foreignKey':_0x9e18('0x11e')});db[_0x9e18('0xf7')][_0x9e18('0x112')](db[_0x9e18('0x1ee')],{'as':_0x9e18('0x1ef'),'foreignKey':_0x9e18('0x11e'),'onDelete':_0x9e18('0x110')});db[_0x9e18('0x1ee')][_0x9e18('0x112')](db['UserProfileResource'],{'as':'Resources','foreignKey':_0x9e18('0x1f0'),'onDelete':'cascade'});db[_0x9e18('0xfe')][_0x9e18('0x112')](db[_0x9e18('0x89')],{'as':_0x9e18('0x167'),'foreignKey':'WhatsappAccountId','onDelete':_0x9e18('0x110')});db[_0x9e18('0xfe')][_0x9e18('0x112')](db['CannedAnswer'],{'as':_0x9e18('0x179'),'foreignKey':_0x9e18('0x1f1')});db[_0x9e18('0xfe')][_0x9e18('0x112')](db[_0x9e18('0x1f2')],{'as':_0x9e18('0x15b'),'foreignKey':_0x9e18('0x1f1')});db['WhatsappAccount'][_0x9e18('0x112')](db['WhatsappInteraction'],{'as':_0x9e18('0x185')});db[_0x9e18('0xfe')][_0x9e18('0x112')](db[_0x9e18('0x1f3')],{'as':_0x9e18('0x149')});db[_0x9e18('0xfe')]['belongsTo'](db['CmList'],{'as':_0x9e18('0x168'),'foreignKey':_0x9e18('0x17b')});db[_0x9e18('0xfe')][_0x9e18('0x11d')](db[_0x9e18('0x8e')],{'as':_0x9e18('0x154'),'foreignKey':_0x9e18('0x155')});db[_0x9e18('0xfe')]['belongsToMany'](db[_0x9e18('0x10e')],{'as':'Agents','through':'user_has_whatsapp_accounts'});db['WhatsappApplication'][_0x9e18('0x11d')](db['User'],{'onDelete':'restrict'});db[_0x9e18('0x1f3')][_0x9e18('0x11d')](db[_0x9e18('0x105')],{'onDelete':_0x9e18('0x164')});db['WhatsappApplication'][_0x9e18('0x11d')](db[_0x9e18('0xfe')],{'onDelete':'restrict'});db['WhatsappApplication'][_0x9e18('0x11d')](db['Interval'],{'onDelete':_0x9e18('0x164'),'foreignKey':_0x9e18('0x153')});db[_0x9e18('0x1f3')][_0x9e18('0x11d')](db[_0x9e18('0x95')],{'onDelete':_0x9e18('0x164'),'foreignKey':_0x9e18('0x18e')});db['WhatsappInteraction'][_0x9e18('0x112')](db[_0x9e18('0x1f2')],{'as':_0x9e18('0x15b'),'onDelete':_0x9e18('0x110'),'foreignKey':'WhatsappInteractionId'});db['WhatsappInteraction'][_0x9e18('0x11d')](db[_0x9e18('0xfe')],{'as':'Account','foreignKey':_0x9e18('0x1f1')});db[_0x9e18('0x12d')][_0x9e18('0x11d')](db[_0x9e18('0x78')],{'as':_0x9e18('0x160'),'foreignKey':_0x9e18('0x161')});db['WhatsappInteraction'][_0x9e18('0x11d')](db['User'],{'as':_0x9e18('0x16d'),'foreignKey':_0x9e18('0x116')});db[_0x9e18('0x12d')][_0x9e18('0x11f')](db[_0x9e18('0x95')],{'through':_0x9e18('0x1ae'),'as':_0x9e18('0x16e')});db[_0x9e18('0x12d')][_0x9e18('0x11f')](db[_0x9e18('0x95')],{'through':'whatsapp_interaction_has_tags','as':_0x9e18('0x170')});db[_0x9e18('0x12d')][_0x9e18('0x11f')](db['User'],{'as':_0x9e18('0x171'),'through':_0x9e18('0x12e'),'foreignKey':_0x9e18('0x1f4')});db[_0x9e18('0x1f2')][_0x9e18('0x11d')](db['User'],{'as':'User'});db[_0x9e18('0x1f2')][_0x9e18('0x11d')](db[_0x9e18('0x78')],{'onDelete':'cascade','as':_0x9e18('0x160')});db['WhatsappMessage']['belongsTo'](db[_0x9e18('0x12d')],{'onDelete':_0x9e18('0x110'),'as':_0x9e18('0x172'),'foreignKey':_0x9e18('0x1f4')});db[_0x9e18('0x1f2')]['belongsTo'](db[_0x9e18('0xfe')],{'as':_0x9e18('0x16c'),'foreignKey':_0x9e18('0x1f1')});db['WhatsappQueueReport'][_0x9e18('0x11d')](db[_0x9e18('0xfe')],{});db['WhatsappQueueReport'][_0x9e18('0x11d')](db[_0x9e18('0xf4')],{'as':_0x9e18('0x168'),'foreignKey':_0x9e18('0x17b')});db[_0x9e18('0x101')][_0x9e18('0x11d')](db[_0x9e18('0x78')],{'as':_0x9e18('0x160'),'foreignKey':_0x9e18('0x161')});db[_0x9e18('0x101')][_0x9e18('0x11d')](db[_0x9e18('0x12d')],{});db[_0x9e18('0x101')]['belongsTo'](db[_0x9e18('0x105')],{});db[_0x9e18('0x101')]['belongsTo'](db[_0x9e18('0x1f2')],{});db[_0x9e18('0x101')][_0x9e18('0x11d')](db[_0x9e18('0x10e')],{});db[_0x9e18('0x103')][_0x9e18('0x11d')](db[_0x9e18('0x1f2')],{});db[_0x9e18('0x103')][_0x9e18('0x11d')](db[_0x9e18('0x12d')],{});db[_0x9e18('0x103')][_0x9e18('0x11d')](db['WhatsappAccount'],{'foreignKey':_0x9e18('0x1f5'),'as':'FromAccount'});db[_0x9e18('0x103')][_0x9e18('0x11d')](db[_0x9e18('0xfe')],{'foreignKey':_0x9e18('0x1f6'),'as':'ToAccount'});db['WhatsappTransferReport'][_0x9e18('0x11d')](db[_0x9e18('0x105')],{'foreignKey':_0x9e18('0x1f7'),'as':_0x9e18('0x1e4')});db[_0x9e18('0x103')][_0x9e18('0x11d')](db[_0x9e18('0x10e')],{'foreignKey':_0x9e18('0x1dd'),'as':_0x9e18('0x1e3')});db[_0x9e18('0x103')][_0x9e18('0x11d')](db[_0x9e18('0x10e')],{'foreignKey':'ToUserId','as':_0x9e18('0x1df')});db['WhatsappQueue'][_0x9e18('0x11f')](db['User'],{'as':'Agents','through':'UserWhatsappQueue','foreignKey':_0x9e18('0x1f8')});db['WhatsappQueue'][_0x9e18('0x11f')](db['Team'],{'through':'team_has_whatsapp_queues','as':_0x9e18('0x158')});db[_0x9e18('0x107')][_0x9e18('0x10f')](db['MailServerIn'],{'as':_0x9e18('0x165'),'onDelete':'restrict'});db[_0x9e18('0x107')][_0x9e18('0x10f')](db['MailServerOut'],{'as':_0x9e18('0x166'),'onDelete':_0x9e18('0x164')});module[_0x9e18('0x1f9')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x6597=['../api/condition/condition.model','Interval','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','Schedule','../api/schedule/schedule.model','Sound','Tag','../api/tag/tag.model','Template','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','IntegrationReport','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','../api/analyticDefaultReport/analyticDefaultReport.model','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmAccount','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','DeskConfiguration','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','VtigerField','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/integration/integration.model','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','SquareRecording','SquareMessage','../api/squareMessage/squareMessage.model','../api/team/team.model','License','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','../api/attachment/attachment.model','Plugin','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','UserProfileResource','UserNotification','../api/userNotification/userNotification.model','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','../api/whatsappMessage/whatsappMessage.model','../api/whatsappQueueReport/whatsappQueueReport.model','../api/whatsappTransferReport/whatsappTransferReport.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','hasOne','VoiceMail','cascade','UserId','hasMany','Recordings','Extensions','HopperFinals','HopperHistory','OpenchannelInteractions','ChatInteraction','ChatInteractions','SmsInteraction','FaxInteractions','MailInteractions','WhatsappInteractions','SenderId','belongsTo','belongsToMany','Groups','chat_group_has_users','Contacts','cm_user_has_contacts','Lists','Team','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','SmsInteractions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefix','VoicePrefixes','MailQueues','ChatQueue','SmsQueues','WhatsappQueue','WhatsappQueues','ChatWebsite','ChatWebsites','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccount','WhatsappAccounts','user_has_square_projects','SpiedAgents','ChanSpyId','Applications','Sounds','moh_has_sounds','Members','Hoppers','VoiceQueueId','HopperHistories','JscriptySessions','TrunkId','TrunkBackup','TrunkBackupId','mandatoryDispositionPause','mandatoryDispositionPauseId','Agents','Teams','BlackLists','voice_queues_has_cm_blacklists','mailboxuser','mailbox','QueueCalls','uniqueid','Contact','ContactId','MailServerIn','MailAccountId','CloudProvider','restrict','CloudProviderId','Smtp','Dispositions','Answers','Interactions','List','ListId','TemplateId','team_has_mail_queues','Messages','Owner','ThroughTags','Users','MailInteractionId','Attachment','Attachments','Interaction','Account','ChatWebsiteId','ChatOfflineMessageId','TagId','Items','FaxAccountId','Exntensions','FaxInteractionId','fax_interaction_has_tags','Tags','AttachmentId','team_has_fax_queues','SmsAccountId','SmsApplication','IntervalId','sms_interaction_has_tags','SmsInteractionId','SmsMessage','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','team_has_openchannel_queues','ChatProactiveAction','ProactiveActions','user_has_chat_websites','Agent','Queue','ChatQueueId','Website','chat_interaction_has_tags','ChatInteractionId','ChatMessage','team_has_chat_queues','ChatGroupId','CompanyId','cm_contact_has_tags','CampaignId','OwnerId','Condition','OneAll','AutomationAllId','Automation','Any','OneAny','AutomationAnyId','Actions','AutomationId','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','AnalyticDefaultReport','DefaultReportId','CustomReportId','Mohs','mail_interaction_has_tags','whatsapp_interaction_has_tags','AllConditions','AllCondition','TriggerAnyId','TriggerId','Fields','MetricId','Configurations','SalesforceConfiguration','SubjectId','DescriptionId','FieldId','AccountId','Subject','VariableId','Subjects','Descriptions','Field','int_desk_configuration_has_tags','Description','int_zendesk_configuration_has_tags','FromId','SessionId','ProjectId','ChatQueues','FaxQueues','OpenchannelQueues','HopperBlacks','SquareProjectId','campaigns_has_cm_blacklists','FromMailAccountId','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToMailAccountId','ToAccount','ChatTransferReport','FromChatWebsiteId','FromAccount','ToChatQueueId','ToQueue','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','FromOpenchannelAccountId','ToOpenchannelAccountId','FromSmsAccountId','Queues','voice_queues_has_cm_lists','cm_user_has_lists','userProfileId','UserProfileSections','Resources','WhatsappAccountId','WhatsappMessage','user_has_whatsapp_accounts','WhatsappInteractionId','WhatsappQueueReport','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','../config/environment','sequelize','lodash','determine','defaultsDeep','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','sequelizeHistory','motion2','utf8','database','username','password','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','VoiceQueueReport','MemberReport','../api/memberReport/memberReport.model','Trunk','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','MailApplication','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','SmsAccount','../api/smsAccount/smsAccount.model','../api/smsApplication/smsApplication.model','../api/smsInteraction/smsInteraction.model','../api/smsMessage/smsMessage.model','SmsQueue','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','../api/chatInteraction/chatInteraction.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','../api/chatQueue/chatQueue.model','ChatGroup','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','CannedAnswer','Disposition','../api/disposition/disposition.model'];(function(_0x53c876,_0x1a9ff6){var _0x110e95=function(_0x4f3423){while(--_0x4f3423){_0x53c876['push'](_0x53c876['shift']());}};_0x110e95(++_0x1a9ff6);}(_0x6597,0x16e));var _0x7659=function(_0x1135f9,_0x41be52){_0x1135f9=_0x1135f9-0x0;var _0x15e182=_0x6597[_0x1135f9];return _0x15e182;};'use strict';var config=require(_0x7659('0x0'));var Sequelize=require(_0x7659('0x1'));var _=require(_0x7659('0x2'));var jstz=require('jstz');var timezone=jstz[_0x7659('0x3')]();config['sequelize']=_[_0x7659('0x4')](config['sequelize'],{'database':'motion2','username':'xcall','password':_0x7659('0x5'),'options':{'host':_0x7659('0x6'),'port':0xcea,'dialect':_0x7659('0x7'),'dialectOptions':{'charset':_0x7659('0x8')},'logging':![],'timezone':timezone[_0x7659('0x9')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});config[_0x7659('0xa')]=_[_0x7659('0x4')](config[_0x7659('0xa')],{'database':_0x7659('0xb'),'username':'xcall','password':_0x7659('0x5'),'options':{'host':_0x7659('0x6'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x7659('0x8')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0x7659('0xc'),'collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x7659('0x1')][_0x7659('0xd')],config['sequelize'][_0x7659('0xe')],config[_0x7659('0x1')]['password'],config[_0x7659('0x1')]['options'])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x7659('0xd')],config[_0x7659('0xa')][_0x7659('0xe')],config[_0x7659('0xa')][_0x7659('0xf')],config['sequelizeHistory']['options'])};db[_0x7659('0x10')]=db[_0x7659('0x1')][_0x7659('0x11')](_0x7659('0x12'));db[_0x7659('0x13')]=db[_0x7659('0x1')]['import'](_0x7659('0x14'));db[_0x7659('0x15')]=db[_0x7659('0x1')][_0x7659('0x11')](_0x7659('0x16'));db[_0x7659('0x17')]=db[_0x7659('0x1')][_0x7659('0x11')](_0x7659('0x18'));db[_0x7659('0x19')]=db[_0x7659('0x1')][_0x7659('0x11')](_0x7659('0x1a'));db[_0x7659('0x1b')]=db[_0x7659('0x1')]['import'](_0x7659('0x1c'));db[_0x7659('0x1d')]=db[_0x7659('0x1')][_0x7659('0x11')]('../api/voiceRecording/voiceRecording.model');db['ScreenRecording']=db[_0x7659('0x1')][_0x7659('0x11')](_0x7659('0x1e'));db['VoiceMail']=db[_0x7659('0x1')][_0x7659('0x11')](_0x7659('0x1f'));db['VoiceMailMessage']=db[_0x7659('0x1')][_0x7659('0x11')](_0x7659('0x20'));db[_0x7659('0x21')]=db[_0x7659('0x1')][_0x7659('0x11')](_0x7659('0x22'));db[_0x7659('0x23')]=db[_0x7659('0x1')]['import'](_0x7659('0x24'));db[_0x7659('0x25')]=db['sequelize'][_0x7659('0x11')]('../api/voiceAgentReport/voiceAgentReport.model');db[_0x7659('0x26')]=db[_0x7659('0x1')][_0x7659('0x11')]('../api/voiceQueueReport/voiceQueueReport.model');db[_0x7659('0x27')]=db[_0x7659('0x1')][_0x7659('0x11')](_0x7659('0x28'));db[_0x7659('0x29')]=db[_0x7659('0x1')][_0x7659('0x11')]('../api/trunk/trunk.model');db['VoiceTransferReport']=db[_0x7659('0x1')][_0x7659('0x11')]('../api/voiceTransferReport/voiceTransferReport.model');db[_0x7659('0x2a')]=db[_0x7659('0x1')]['import'](_0x7659('0x2b'));db[_0x7659('0x2c')]=db[_0x7659('0x1')]['import']('../api/userVoiceQueue/userVoiceQueue.model');db[_0x7659('0x2d')]=db[_0x7659('0x1')][_0x7659('0x11')](_0x7659('0x2e'));db[_0x7659('0x2f')]=db[_0x7659('0x1')]['import']('../api/userMailQueue/userMailQueue.model');db[_0x7659('0x30')]=db[_0x7659('0x1')][_0x7659('0x11')](_0x7659('0x31'));db[_0x7659('0x32')]=db[_0x7659('0x1')][_0x7659('0x11')]('../api/userSmsQueue/userSmsQueue.model');db[_0x7659('0x33')]=db[_0x7659('0x1')][_0x7659('0x11')](_0x7659('0x34'));db[_0x7659('0x35')]=db[_0x7659('0x1')][_0x7659('0x11')](_0x7659('0x36'));db['MailServerIn']=db[_0x7659('0x1')]['import'](_0x7659('0x37'));db[_0x7659('0x38')]=db[_0x7659('0x1')][_0x7659('0x11')](_0x7659('0x39'));db[_0x7659('0x3a')]=db[_0x7659('0x1')]['import'](_0x7659('0x3b'));db[_0x7659('0x3c')]=db['sequelize'][_0x7659('0x11')](_0x7659('0x3d'));db[_0x7659('0x3e')]=db[_0x7659('0x1')][_0x7659('0x11')](_0x7659('0x3f'));db[_0x7659('0x40')]=db[_0x7659('0x1')][_0x7659('0x11')](_0x7659('0x41'));db[_0x7659('0x42')]=db[_0x7659('0x1')]['import']('../api/mailMessage/mailMessage.model');db[_0x7659('0x43')]=db[_0x7659('0x1')][_0x7659('0x11')]('../api/mailApplication/mailApplication.model');db[_0x7659('0x44')]=db[_0x7659('0x1')]['import'](_0x7659('0x45'));db[_0x7659('0x46')]=db[_0x7659('0x1')][_0x7659('0x11')](_0x7659('0x47'));db[_0x7659('0x48')]=db[_0x7659('0x1')][_0x7659('0x11')](_0x7659('0x49'));db[_0x7659('0x4a')]=db[_0x7659('0x1')][_0x7659('0x11')](_0x7659('0x4b'));db[_0x7659('0x4c')]=db[_0x7659('0x1')][_0x7659('0x11')](_0x7659('0x4d'));db[_0x7659('0x4e')]=db[_0x7659('0x1')]['import'](_0x7659('0x4f'));db[_0x7659('0x50')]=db[_0x7659('0x1')]['import'](_0x7659('0x51'));db[_0x7659('0x52')]=db[_0x7659('0x1')][_0x7659('0x11')](_0x7659('0x53'));db[_0x7659('0x54')]=db[_0x7659('0x1')][_0x7659('0x11')]('../api/faxQueueReport/faxQueueReport.model');db[_0x7659('0x55')]=db[_0x7659('0x1')]['import'](_0x7659('0x56'));db['SmsApplication']=db[_0x7659('0x1')][_0x7659('0x11')](_0x7659('0x57'));db['SmsInteraction']=db[_0x7659('0x1')][_0x7659('0x11')](_0x7659('0x58'));db['SmsMessage']=db[_0x7659('0x1')][_0x7659('0x11')](_0x7659('0x59'));db[_0x7659('0x5a')]=db['sequelize'][_0x7659('0x11')]('../api/smsQueue/smsQueue.model');db[_0x7659('0x5b')]=db['sequelize'][_0x7659('0x11')](_0x7659('0x5c'));db[_0x7659('0x5d')]=db[_0x7659('0x1')][_0x7659('0x11')](_0x7659('0x5e'));db[_0x7659('0x5f')]=db['sequelize'][_0x7659('0x11')](_0x7659('0x60'));db[_0x7659('0x61')]=db[_0x7659('0x1')][_0x7659('0x11')](_0x7659('0x62'));db[_0x7659('0x63')]=db['sequelize']['import'](_0x7659('0x64'));db['ChatWebsite']=db[_0x7659('0x1')][_0x7659('0x11')](_0x7659('0x65'));db[_0x7659('0x66')]=db[_0x7659('0x1')][_0x7659('0x11')](_0x7659('0x67'));db[_0x7659('0x68')]=db[_0x7659('0x1')][_0x7659('0x11')](_0x7659('0x69'));db['ChatInteraction']=db[_0x7659('0x1')][_0x7659('0x11')](_0x7659('0x6a'));db['ChatMessage']=db[_0x7659('0x1')]['import']('../api/chatMessage/chatMessage.model');db[_0x7659('0x6b')]=db[_0x7659('0x1')]['import'](_0x7659('0x6c'));db['ChatQueue']=db[_0x7659('0x1')]['import'](_0x7659('0x6d'));db[_0x7659('0x6e')]=db[_0x7659('0x1')][_0x7659('0x11')]('../api/chatGroup/chatGroup.model');db['ChatProactiveAction']=db[_0x7659('0x1')]['import']('../api/chatProactiveAction/chatProactiveAction.model');db[_0x7659('0x6f')]=db[_0x7659('0x1')][_0x7659('0x11')](_0x7659('0x70'));db[_0x7659('0x71')]=db[_0x7659('0x1')][_0x7659('0x11')](_0x7659('0x72'));db[_0x7659('0x73')]=db[_0x7659('0x1')][_0x7659('0x11')](_0x7659('0x74'));db[_0x7659('0x75')]=db[_0x7659('0x1')][_0x7659('0x11')](_0x7659('0x76'));db[_0x7659('0x77')]=db[_0x7659('0x1')][_0x7659('0x11')](_0x7659('0x78'));db[_0x7659('0x79')]=db[_0x7659('0x1')][_0x7659('0x11')](_0x7659('0x7a'));db[_0x7659('0x7b')]=db[_0x7659('0x1')][_0x7659('0x11')]('../api/reportAgentPreview/reportAgentPreview.model');db[_0x7659('0x7c')]=db['sequelize'][_0x7659('0x11')](_0x7659('0x7d'));db[_0x7659('0x7e')]=db[_0x7659('0x1')][_0x7659('0x11')]('../api/action/action.model');db['Automation']=db[_0x7659('0x1')][_0x7659('0x11')]('../api/automation/automation.model');db[_0x7659('0x7f')]=db[_0x7659('0x1')]['import']('../api/cannedAnswer/cannedAnswer.model');db[_0x7659('0x80')]=db['sequelize'][_0x7659('0x11')](_0x7659('0x81'));db['Condition']=db[_0x7659('0x1')][_0x7659('0x11')](_0x7659('0x82'));db[_0x7659('0x83')]=db[_0x7659('0x1')][_0x7659('0x11')]('../api/interval/interval.model');db[_0x7659('0x84')]=db[_0x7659('0x1')][_0x7659('0x11')](_0x7659('0x85'));db[_0x7659('0x86')]=db[_0x7659('0x1')][_0x7659('0x11')](_0x7659('0x87'));db[_0x7659('0x88')]=db[_0x7659('0x1')][_0x7659('0x11')]('../api/voiceQueuesLog/voiceQueuesLog.model');db[_0x7659('0x89')]=db['sequelize'][_0x7659('0x11')](_0x7659('0x8a'));db[_0x7659('0x8b')]=db[_0x7659('0x1')][_0x7659('0x11')]('../api/sound/sound.model');db[_0x7659('0x8c')]=db[_0x7659('0x1')][_0x7659('0x11')](_0x7659('0x8d'));db[_0x7659('0x8e')]=db['sequelize']['import']('../api/template/template.model');db[_0x7659('0x8f')]=db['sequelize'][_0x7659('0x11')](_0x7659('0x90'));db[_0x7659('0x91')]=db[_0x7659('0x1')][_0x7659('0x11')](_0x7659('0x92'));db[_0x7659('0x93')]=db['sequelize'][_0x7659('0x11')]('../api/integration/integration.model');db[_0x7659('0x94')]=db['sequelize']['import']('../api/integrationReport/integrationReport.model');db[_0x7659('0x95')]=db['sequelize'][_0x7659('0x11')](_0x7659('0x96'));db['AnalyticDefaultReport']=db[_0x7659('0x1')][_0x7659('0x11')](_0x7659('0x97'));db['AnalyticExtractedReport']=db[_0x7659('0x1')][_0x7659('0x11')](_0x7659('0x98'));db[_0x7659('0x99')]=db[_0x7659('0x1')][_0x7659('0x11')]('../api/analyticMetric/analyticMetric.model');db[_0x7659('0x9a')]=db[_0x7659('0x1')][_0x7659('0x11')](_0x7659('0x9b'));db['AnalyticTreeReport']=db[_0x7659('0x1')]['import']('../api/analyticTreeReport/analyticTreeReport.model');db[_0x7659('0x9c')]=db['sequelize'][_0x7659('0x11')](_0x7659('0x9d'));db['SalesforceConfiguration']=db[_0x7659('0x1')][_0x7659('0x11')](_0x7659('0x9e'));db[_0x7659('0x9f')]=db[_0x7659('0x1')][_0x7659('0x11')]('../api/intSalesforceField/intSalesforceField.model');db[_0x7659('0xa0')]=db[_0x7659('0x1')]['import']('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x7659('0xa1')]=db[_0x7659('0x1')][_0x7659('0x11')](_0x7659('0xa2'));db[_0x7659('0xa3')]=db[_0x7659('0x1')][_0x7659('0x11')](_0x7659('0xa4'));db[_0x7659('0xa5')]=db['sequelize'][_0x7659('0x11')]('../api/intDeskAccount/intDeskAccount.model');db[_0x7659('0xa6')]=db[_0x7659('0x1')][_0x7659('0x11')]('../api/intDeskConfiguration/intDeskConfiguration.model');db[_0x7659('0xa7')]=db[_0x7659('0x1')][_0x7659('0x11')](_0x7659('0xa8'));db[_0x7659('0xa9')]=db['sequelize'][_0x7659('0x11')](_0x7659('0xaa'));db[_0x7659('0xab')]=db[_0x7659('0x1')][_0x7659('0x11')](_0x7659('0xac'));db[_0x7659('0xad')]=db[_0x7659('0x1')][_0x7659('0x11')](_0x7659('0xae'));db[_0x7659('0xaf')]=db[_0x7659('0x1')]['import']('../api/intZendeskAccount/intZendeskAccount.model');db[_0x7659('0xb0')]=db[_0x7659('0x1')][_0x7659('0x11')](_0x7659('0xb1'));db[_0x7659('0xb2')]=db[_0x7659('0x1')]['import'](_0x7659('0xb3'));db[_0x7659('0xb4')]=db[_0x7659('0x1')][_0x7659('0x11')](_0x7659('0xb5'));db[_0x7659('0xb6')]=db[_0x7659('0x1')][_0x7659('0x11')](_0x7659('0xb7'));db[_0x7659('0xb8')]=db[_0x7659('0x1')][_0x7659('0x11')](_0x7659('0xb9'));db[_0x7659('0xba')]=db['sequelize'][_0x7659('0x11')](_0x7659('0xbb'));db[_0x7659('0xbc')]=db[_0x7659('0x1')][_0x7659('0x11')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x7659('0xbd')]=db['sequelize'][_0x7659('0x11')]('../api/intVtigerField/intVtigerField.model');db[_0x7659('0xbe')]=db[_0x7659('0x1')][_0x7659('0x11')](_0x7659('0xbf'));db[_0x7659('0xc0')]=db['sequelize'][_0x7659('0x11')](_0x7659('0xc1'));db[_0x7659('0xc2')]=db[_0x7659('0x1')][_0x7659('0x11')](_0x7659('0xc3'));db[_0x7659('0xc4')]=db[_0x7659('0x1')][_0x7659('0x11')](_0x7659('0xc5'));db[_0x7659('0xc6')]=db[_0x7659('0x1')]['import']('../api/intDynamics365Configuration/intDynamics365Configuration.model');db[_0x7659('0xc7')]=db[_0x7659('0x1')][_0x7659('0x11')](_0x7659('0xc8'));db[_0x7659('0xc9')]=db[_0x7659('0x1')][_0x7659('0x11')](_0x7659('0xca'));db[_0x7659('0xcb')]=db[_0x7659('0x1')][_0x7659('0x11')](_0x7659('0xcc'));db[_0x7659('0xcd')]=db[_0x7659('0x1')][_0x7659('0x11')](_0x7659('0xce'));db['Integration']=db[_0x7659('0x1')][_0x7659('0x11')](_0x7659('0xcf'));db[_0x7659('0xd0')]=db[_0x7659('0x1')][_0x7659('0x11')](_0x7659('0xd1'));db[_0x7659('0xd2')]=db['sequelize'][_0x7659('0x11')](_0x7659('0xd3'));db[_0x7659('0xd4')]=db[_0x7659('0x1')]['import'](_0x7659('0xd5'));db[_0x7659('0xd6')]=db[_0x7659('0x1')][_0x7659('0x11')]('../api/jscriptyAnswerReport/jscriptyAnswerReport.model');db[_0x7659('0xd7')]=db[_0x7659('0x1')][_0x7659('0x11')](_0x7659('0xd8'));db[_0x7659('0xd9')]=db[_0x7659('0x1')]['import'](_0x7659('0xda'));db[_0x7659('0xdb')]=db['sequelize'][_0x7659('0x11')](_0x7659('0xdc'));db[_0x7659('0xdd')]=db[_0x7659('0x1')]['import'](_0x7659('0xde'));db['SquareDetailsReport']=db[_0x7659('0x1')][_0x7659('0x11')](_0x7659('0xdf'));db[_0x7659('0xe0')]=db[_0x7659('0x1')][_0x7659('0x11')](_0x7659('0xe1'));db[_0x7659('0xe2')]=db[_0x7659('0x1')][_0x7659('0x11')](_0x7659('0xe3'));db[_0x7659('0xe4')]=db['sequelize'][_0x7659('0x11')](_0x7659('0xe5'));db[_0x7659('0xe6')]=db[_0x7659('0x1')][_0x7659('0x11')]('../api/squareProject/squareProject.model');db[_0x7659('0xe7')]=db[_0x7659('0x1')][_0x7659('0x11')]('../api/squareRecording/squareRecording.model');db[_0x7659('0xe8')]=db['sequelize'][_0x7659('0x11')](_0x7659('0xe9'));db['Team']=db[_0x7659('0x1')][_0x7659('0x11')](_0x7659('0xea'));db[_0x7659('0xeb')]=db[_0x7659('0x1')][_0x7659('0x11')]('../api/license/license.model');db[_0x7659('0xec')]=db['sequelize'][_0x7659('0x11')](_0x7659('0xed'));db[_0x7659('0xee')]=db['sequelize'][_0x7659('0x11')](_0x7659('0xef'));db['Attachment']=db[_0x7659('0x1')][_0x7659('0x11')](_0x7659('0xf0'));db[_0x7659('0xf1')]=db[_0x7659('0x1')][_0x7659('0x11')]('../api/plugin/plugin.model');db[_0x7659('0xf2')]=db[_0x7659('0x1')][_0x7659('0x11')](_0x7659('0xf3'));db['ChatTransferReport']=db['sequelize'][_0x7659('0x11')](_0x7659('0xf4'));db[_0x7659('0xf5')]=db[_0x7659('0x1')][_0x7659('0x11')]('../api/faxTransferReport/faxTransferReport.model');db[_0x7659('0xf6')]=db[_0x7659('0x1')][_0x7659('0x11')](_0x7659('0xf7'));db[_0x7659('0xf8')]=db['sequelize'][_0x7659('0x11')](_0x7659('0xf9'));db[_0x7659('0xfa')]=db['sequelize']['import']('../api/cmList/cmList.model');db['VoicePrefix']=db[_0x7659('0x1')][_0x7659('0x11')](_0x7659('0xfb'));db[_0x7659('0xfc')]=db[_0x7659('0x1')][_0x7659('0x11')](_0x7659('0xfd'));db[_0x7659('0xfe')]=db[_0x7659('0x1')]['import']('../api/userProfileSection/userProfileSection.model');db[_0x7659('0xff')]=db[_0x7659('0x1')][_0x7659('0x11')]('../api/userProfileResource/userProfileResource.model');db[_0x7659('0x100')]=db[_0x7659('0x1')][_0x7659('0x11')](_0x7659('0x101'));db['WhatsappAccount']=db[_0x7659('0x1')][_0x7659('0x11')](_0x7659('0x102'));db[_0x7659('0x103')]=db[_0x7659('0x1')][_0x7659('0x11')](_0x7659('0x104'));db[_0x7659('0x105')]=db[_0x7659('0x1')]['import'](_0x7659('0x106'));db['WhatsappMessage']=db['sequelize'][_0x7659('0x11')](_0x7659('0x107'));db['WhatsappQueueReport']=db[_0x7659('0x1')]['import'](_0x7659('0x108'));db['WhatsappTransferReport']=db[_0x7659('0x1')][_0x7659('0x11')](_0x7659('0x109'));db['WhatsappQueue']=db['sequelize']['import']('../api/whatsappQueue/whatsappQueue.model');db['CloudProvider']=db[_0x7659('0x1')][_0x7659('0x11')]('../api/cloudProvider/cloudProvider.model');db[_0x7659('0x10a')]=db[_0x7659('0x1')][_0x7659('0x11')](_0x7659('0x10b'));db[_0x7659('0x10c')]=db['sequelize']['import'](_0x7659('0x10d'));db[_0x7659('0x10e')]=db[_0x7659('0x1')][_0x7659('0x11')](_0x7659('0x10f'));db[_0x7659('0x10')][_0x7659('0x110')](db[_0x7659('0x111')],{'as':_0x7659('0x111'),'onDelete':_0x7659('0x112'),'foreignKey':_0x7659('0x113')});db[_0x7659('0x10')][_0x7659('0x114')](db[_0x7659('0x1d')],{'as':_0x7659('0x115'),'foreignKey':_0x7659('0x113')});db[_0x7659('0x10')]['hasMany'](db['UserVoiceQueueRt'],{'as':'VoiceQueuesRt','foreignKey':'UserId'});db[_0x7659('0x10')][_0x7659('0x114')](db[_0x7659('0x17')],{'as':_0x7659('0x116'),'onDelete':_0x7659('0x112'),'hooks':!![]});db[_0x7659('0x10')][_0x7659('0x114')](db[_0x7659('0x77')],{'as':_0x7659('0x117'),'foreignKey':'UserId'});db[_0x7659('0x10')][_0x7659('0x114')](db[_0x7659('0x79')],{'as':_0x7659('0x118'),'foreignKey':'UserId'});db['User'][_0x7659('0x114')](db[_0x7659('0x7b')],{'as':_0x7659('0x7b'),'foreignKey':_0x7659('0x113')});db[_0x7659('0x10')][_0x7659('0x114')](db[_0x7659('0x5f')],{'as':_0x7659('0x119'),'foreignKey':'UserId'});db[_0x7659('0x10')][_0x7659('0x114')](db[_0x7659('0x11a')],{'as':_0x7659('0x11b'),'foreignKey':_0x7659('0x113')});db[_0x7659('0x10')][_0x7659('0x114')](db[_0x7659('0x11c')],{'as':'SmsInteractions','foreignKey':_0x7659('0x113')});db[_0x7659('0x10')]['hasMany'](db['FaxInteraction'],{'as':_0x7659('0x11d'),'foreignKey':'UserId'});db[_0x7659('0x10')]['hasMany'](db[_0x7659('0x40')],{'as':_0x7659('0x11e'),'foreignKey':_0x7659('0x113')});db[_0x7659('0x10')][_0x7659('0x114')](db[_0x7659('0x105')],{'as':_0x7659('0x11f'),'foreignKey':_0x7659('0x113')});db['User'][_0x7659('0x114')](db[_0x7659('0x100')],{'as':'UserNotifications','foreignKey':_0x7659('0x120')});db['User'][_0x7659('0x121')](db[_0x7659('0xfc')],{'as':_0x7659('0xfc'),'foreignKey':'userProfileId'});db[_0x7659('0x10')][_0x7659('0x122')](db[_0x7659('0x6e')],{'as':_0x7659('0x123'),'through':_0x7659('0x124')});db['User'][_0x7659('0x122')](db[_0x7659('0x71')],{'as':_0x7659('0x125'),'through':_0x7659('0x126')});db[_0x7659('0x10')][_0x7659('0x122')](db[_0x7659('0xfa')],{'as':_0x7659('0x127'),'through':'cm_user_has_lists'});db[_0x7659('0x10')][_0x7659('0x122')](db[_0x7659('0x128')],{'through':_0x7659('0x129')});db[_0x7659('0x10')]['belongsToMany'](db[_0x7659('0x40')],{'as':'MailInteractions','through':_0x7659('0x12a')});db[_0x7659('0x10')][_0x7659('0x122')](db['ChatInteraction'],{'as':_0x7659('0x11b'),'through':_0x7659('0x12b')});db[_0x7659('0x10')][_0x7659('0x122')](db[_0x7659('0x4e')],{'as':_0x7659('0x11d'),'through':_0x7659('0x12c')});db[_0x7659('0x10')][_0x7659('0x122')](db['SmsInteraction'],{'as':_0x7659('0x12d'),'through':_0x7659('0x12e')});db['User'][_0x7659('0x122')](db['OpenchannelInteraction'],{'as':_0x7659('0x119'),'through':_0x7659('0x12f')});db[_0x7659('0x10')]['belongsToMany'](db[_0x7659('0x105')],{'as':'WhatsappInteractions','through':_0x7659('0x130')});db[_0x7659('0x10')][_0x7659('0x122')](db[_0x7659('0x1b')],{'as':_0x7659('0x131'),'through':_0x7659('0x2c'),'required':![]});db[_0x7659('0x10')][_0x7659('0x122')](db[_0x7659('0x132')],{'as':_0x7659('0x133'),'through':_0x7659('0x10e'),'required':![]});db[_0x7659('0x10')][_0x7659('0x122')](db[_0x7659('0x3c')],{'as':_0x7659('0x134'),'through':_0x7659('0x2f'),'required':![]});db[_0x7659('0x10')][_0x7659('0x122')](db[_0x7659('0x135')],{'as':'ChatQueues','through':_0x7659('0x2d'),'required':![],'hooks':!![]});db[_0x7659('0x10')]['belongsToMany'](db[_0x7659('0x52')],{'as':'FaxQueues','through':_0x7659('0x30'),'required':![]});db[_0x7659('0x10')][_0x7659('0x122')](db[_0x7659('0x5a')],{'as':_0x7659('0x136'),'through':_0x7659('0x32'),'required':![]});db[_0x7659('0x10')][_0x7659('0x122')](db[_0x7659('0x63')],{'as':'OpenchannelQueues','through':_0x7659('0x33'),'required':![]});db[_0x7659('0x10')][_0x7659('0x122')](db[_0x7659('0x137')],{'as':_0x7659('0x138'),'through':'UserWhatsappQueue','required':![]});db[_0x7659('0x10')][_0x7659('0x122')](db['CmList'],{'through':'cm_user_has_lists'});db[_0x7659('0x10')][_0x7659('0x122')](db[_0x7659('0x139')],{'as':_0x7659('0x13a'),'through':'user_has_chat_websites'});db[_0x7659('0x10')][_0x7659('0x122')](db['FaxAccount'],{'as':'FaxAccounts','through':_0x7659('0x13b')});db[_0x7659('0x10')][_0x7659('0x122')](db[_0x7659('0x3a')],{'as':_0x7659('0x13c'),'through':_0x7659('0x13d')});db[_0x7659('0x10')][_0x7659('0x122')](db[_0x7659('0x5b')],{'as':'OpenchannelAccounts','through':_0x7659('0x13e')});db[_0x7659('0x10')]['belongsToMany'](db[_0x7659('0x55')],{'as':_0x7659('0x13f'),'through':_0x7659('0x140')});db[_0x7659('0x10')][_0x7659('0x122')](db[_0x7659('0x141')],{'as':_0x7659('0x142'),'through':'user_has_whatsapp_accounts'});db[_0x7659('0x10')]['belongsToMany'](db[_0x7659('0xe6')],{'as':'SquareProjects','through':_0x7659('0x143')});db['VoiceChanSpy'][_0x7659('0x114')](db[_0x7659('0x17')],{'as':_0x7659('0x144'),'onDelete':'cascade','foreignKey':_0x7659('0x145')});db[_0x7659('0x15')]['hasMany'](db[_0x7659('0x17')],{'onDelete':'cascade'});db['VoiceExtension']['hasMany'](db[_0x7659('0x17')],{'as':_0x7659('0x146'),'onDelete':_0x7659('0x112')});db[_0x7659('0x19')][_0x7659('0x122')](db[_0x7659('0x8b')],{'as':_0x7659('0x147'),'through':_0x7659('0x148')});db['VoiceQueue'][_0x7659('0x114')](db[_0x7659('0x2a')],{'as':_0x7659('0x149'),'foreignKey':'VoiceQueueId'});db[_0x7659('0x1b')]['hasMany'](db[_0x7659('0x73')],{'as':_0x7659('0x14a'),'foreignKey':'VoiceQueueId'});db[_0x7659('0x1b')][_0x7659('0x114')](db[_0x7659('0x77')],{'as':_0x7659('0x117'),'foreignKey':_0x7659('0x14b')});db[_0x7659('0x1b')]['hasMany'](db[_0x7659('0x79')],{'as':_0x7659('0x14c'),'foreignKey':_0x7659('0x14b')});db[_0x7659('0x1b')][_0x7659('0x114')](db[_0x7659('0x7b')],{'as':_0x7659('0x7b'),'foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x7659('0x114')](db['CmHopperBlack'],{'as':'HopperBlacks','foreignKey':_0x7659('0x14b')});db[_0x7659('0x1b')]['hasMany'](db[_0x7659('0xd9')],{'as':_0x7659('0x14d'),'foreignKey':_0x7659('0x14b')});db[_0x7659('0x1b')][_0x7659('0x121')](db[_0x7659('0x29')],{'as':'Trunk','foreignKey':_0x7659('0x14e')});db['VoiceQueue'][_0x7659('0x121')](db['Trunk'],{'as':_0x7659('0x14f'),'foreignKey':_0x7659('0x150')});db[_0x7659('0x1b')][_0x7659('0x121')](db[_0x7659('0x83')],{'as':_0x7659('0x83'),'foreignKey':'IntervalId'});db['VoiceQueue'][_0x7659('0x121')](db[_0x7659('0x84')],{'as':_0x7659('0x151'),'foreignKey':_0x7659('0x152')});db[_0x7659('0x1b')]['belongsToMany'](db[_0x7659('0xfa')],{'as':_0x7659('0x127'),'through':'voice_queues_has_cm_lists'});db[_0x7659('0x1b')][_0x7659('0x122')](db[_0x7659('0x10')],{'as':_0x7659('0x153'),'through':_0x7659('0x2c')});db[_0x7659('0x1b')]['belongsToMany'](db[_0x7659('0x128')],{'as':_0x7659('0x154'),'through':_0x7659('0x10a')});db[_0x7659('0x1b')][_0x7659('0x122')](db[_0x7659('0xfa')],{'as':_0x7659('0x155'),'through':_0x7659('0x156')});db[_0x7659('0x1d')][_0x7659('0x121')](db[_0x7659('0x10')],{'as':'User','foreignKey':_0x7659('0x113')});db['ScreenRecording'][_0x7659('0x121')](db[_0x7659('0x10')],{'as':_0x7659('0x10'),'foreignKey':_0x7659('0x113')});db[_0x7659('0x111')][_0x7659('0x114')](db['VoiceMailMessage'],{'as':'Messages','onDelete':_0x7659('0x112'),'foreignKey':_0x7659('0x157'),'sourceKey':_0x7659('0x158')});db['VoiceMailMessage']['belongsTo'](db[_0x7659('0x111')],{'foreignKey':_0x7659('0x157'),'targetKey':_0x7659('0x158')});db['VoiceCallReport'][_0x7659('0x114')](db[_0x7659('0x26')],{'as':_0x7659('0x159'),'foreignKey':_0x7659('0x15a'),'constraints':![]});db[_0x7659('0x21')][_0x7659('0x114')](db[_0x7659('0x25')],{'as':'AgentReports','foreignKey':_0x7659('0x15a'),'constraints':![]});db[_0x7659('0x21')][_0x7659('0x121')](db[_0x7659('0x10')],{'as':'User','foreignKey':_0x7659('0x113')});db[_0x7659('0x21')][_0x7659('0x121')](db['CmContact'],{'as':_0x7659('0x15b'),'foreignKey':_0x7659('0x15c')});db[_0x7659('0x15d')]['belongsTo'](db[_0x7659('0x3a')],{'as':_0x7659('0x3a'),'foreignKey':_0x7659('0x15e')});db[_0x7659('0x15d')][_0x7659('0x121')](db[_0x7659('0x15f')],{'as':_0x7659('0x15f'),'foreignKey':'CloudProviderId','onDelete':_0x7659('0x160')});db[_0x7659('0x38')][_0x7659('0x121')](db[_0x7659('0x3a')],{'as':'MailAccount','foreignKey':_0x7659('0x15e')});db[_0x7659('0x38')]['belongsTo'](db[_0x7659('0x15f')],{'as':'CloudProvider','foreignKey':_0x7659('0x161'),'onDelete':'restrict'});db['MailAccount'][_0x7659('0x110')](db[_0x7659('0x15d')],{'as':'Imap','onDelete':_0x7659('0x112')});db[_0x7659('0x3a')][_0x7659('0x110')](db[_0x7659('0x38')],{'as':_0x7659('0x162'),'onDelete':_0x7659('0x112')});db[_0x7659('0x3a')][_0x7659('0x114')](db[_0x7659('0x80')],{'as':_0x7659('0x163'),'foreignKey':'MailAccountId','onDelete':_0x7659('0x112')});db[_0x7659('0x3a')][_0x7659('0x114')](db['CannedAnswer'],{'as':_0x7659('0x164'),'foreignKey':'MailAccountId'});db[_0x7659('0x3a')][_0x7659('0x114')](db[_0x7659('0x42')],{'as':'Messages','foreignKey':_0x7659('0x15e')});db['MailAccount'][_0x7659('0x114')](db[_0x7659('0x40')],{'as':_0x7659('0x165')});db[_0x7659('0x3a')]['hasMany'](db[_0x7659('0x43')],{'as':'Applications'});db[_0x7659('0x3a')][_0x7659('0x121')](db[_0x7659('0xfa')],{'as':_0x7659('0x166'),'foreignKey':_0x7659('0x167')});db['MailAccount'][_0x7659('0x121')](db[_0x7659('0x8e')],{'as':_0x7659('0x8e'),'foreignKey':_0x7659('0x168')});db[_0x7659('0x3a')][_0x7659('0x121')](db[_0x7659('0x84')],{'as':_0x7659('0x151'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x7659('0x3a')]['belongsToMany'](db[_0x7659('0x10')],{'as':_0x7659('0x153'),'through':_0x7659('0x13d')});db[_0x7659('0x3c')][_0x7659('0x122')](db[_0x7659('0x10')],{'as':_0x7659('0x153'),'through':'UserMailQueue'});db[_0x7659('0x3c')][_0x7659('0x122')](db[_0x7659('0x128')],{'through':_0x7659('0x169'),'as':_0x7659('0x154')});db[_0x7659('0x40')][_0x7659('0x114')](db[_0x7659('0x42')],{'as':_0x7659('0x16a'),'onDelete':_0x7659('0x112'),'foreignKey':'MailInteractionId'});db[_0x7659('0x40')][_0x7659('0x121')](db[_0x7659('0x3a')],{'as':'Account','foreignKey':_0x7659('0x15e')});db[_0x7659('0x40')][_0x7659('0x121')](db[_0x7659('0x71')],{'as':_0x7659('0x15b'),'foreignKey':_0x7659('0x15c')});db[_0x7659('0x40')][_0x7659('0x121')](db[_0x7659('0x10')],{'as':_0x7659('0x16b'),'foreignKey':_0x7659('0x113')});db[_0x7659('0x40')]['belongsToMany'](db[_0x7659('0x8c')],{'through':'mail_interaction_has_tags','as':'Tags'});db[_0x7659('0x40')][_0x7659('0x122')](db[_0x7659('0x8c')],{'through':'mail_interaction_has_tags','as':_0x7659('0x16c')});db['MailInteraction'][_0x7659('0x122')](db[_0x7659('0x10')],{'as':_0x7659('0x16d'),'through':'user_has_mail_interactions','foreignKey':_0x7659('0x16e')});db['MailMessage']['hasMany'](db[_0x7659('0x16f')],{'as':_0x7659('0x170'),'onDelete':_0x7659('0x112')});db[_0x7659('0x42')]['belongsTo'](db[_0x7659('0x10')],{'as':_0x7659('0x10')});db[_0x7659('0x42')]['belongsTo'](db[_0x7659('0x71')],{'onDelete':'cascade','as':_0x7659('0x15b')});db[_0x7659('0x42')][_0x7659('0x121')](db[_0x7659('0x40')],{'as':_0x7659('0x171'),'foreignKey':_0x7659('0x16e')});db[_0x7659('0x42')][_0x7659('0x121')](db[_0x7659('0x3a')],{'as':_0x7659('0x172'),'foreignKey':'MailAccountId'});db[_0x7659('0x42')][_0x7659('0x121')](db[_0x7659('0x139')],{'as':_0x7659('0x139'),'foreignKey':_0x7659('0x173')});db['MailMessage'][_0x7659('0x121')](db[_0x7659('0x6b')],{'as':'ChatOfflineMessage','foreignKey':_0x7659('0x174')});db[_0x7659('0x43')][_0x7659('0x121')](db[_0x7659('0x10')],{'onDelete':_0x7659('0x160')});db[_0x7659('0x43')][_0x7659('0x121')](db['MailQueue'],{'onDelete':_0x7659('0x160')});db[_0x7659('0x43')][_0x7659('0x121')](db[_0x7659('0x3a')],{'onDelete':_0x7659('0x160')});db[_0x7659('0x43')][_0x7659('0x121')](db[_0x7659('0x83')],{'onDelete':_0x7659('0x160'),'foreignKey':'IntervalId'});db[_0x7659('0x43')]['belongsTo'](db[_0x7659('0x8c')],{'onDelete':_0x7659('0x160'),'foreignKey':_0x7659('0x175')});db[_0x7659('0x44')]['belongsTo'](db['MailAccount'],{});db[_0x7659('0x44')][_0x7659('0x121')](db[_0x7659('0xfa')],{'as':_0x7659('0x166'),'foreignKey':_0x7659('0x167')});db[_0x7659('0x44')]['belongsTo'](db[_0x7659('0x71')],{'as':'Contact','foreignKey':_0x7659('0x15c')});db[_0x7659('0x44')][_0x7659('0x121')](db['MailInteraction'],{});db[_0x7659('0x44')][_0x7659('0x121')](db[_0x7659('0x42')],{});db[_0x7659('0x44')]['belongsTo'](db[_0x7659('0x10')],{});db[_0x7659('0x44')][_0x7659('0x121')](db[_0x7659('0x3c')],{});db[_0x7659('0x46')][_0x7659('0x114')](db['DashboardItem'],{'as':_0x7659('0x176'),'onDelete':_0x7659('0x112')});db[_0x7659('0x4a')][_0x7659('0x114')](db[_0x7659('0x80')],{'as':'Dispositions','foreignKey':_0x7659('0x177'),'onDelete':_0x7659('0x112')});db[_0x7659('0x4a')]['hasMany'](db['CannedAnswer'],{'as':_0x7659('0x164'),'foreignKey':_0x7659('0x177')});db[_0x7659('0x4a')]['hasMany'](db[_0x7659('0x4e')],{'as':_0x7659('0x165')});db[_0x7659('0x4a')][_0x7659('0x114')](db[_0x7659('0x4c')],{'as':_0x7659('0x146')});db['FaxAccount'][_0x7659('0x114')](db['VoiceExtension'],{'as':_0x7659('0x178'),'onDelete':_0x7659('0x112')});db[_0x7659('0x4a')][_0x7659('0x114')](db[_0x7659('0x50')],{'as':_0x7659('0x16a')});db[_0x7659('0x4a')][_0x7659('0x121')](db['Trunk'],{'as':_0x7659('0x29')});db[_0x7659('0x4a')][_0x7659('0x121')](db[_0x7659('0xfa')],{'as':'List','foreignKey':_0x7659('0x167')});db[_0x7659('0x4a')][_0x7659('0x121')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x7659('0x152')});db[_0x7659('0x4a')]['belongsToMany'](db[_0x7659('0x10')],{'as':'Agents','through':'user_has_fax_accounts'});db[_0x7659('0x4c')][_0x7659('0x121')](db['User'],{'onDelete':_0x7659('0x160')});db[_0x7659('0x4c')][_0x7659('0x121')](db[_0x7659('0x52')],{'onDelete':_0x7659('0x160')});db[_0x7659('0x4c')][_0x7659('0x121')](db[_0x7659('0x4a')],{'onDelete':_0x7659('0x160')});db[_0x7659('0x4c')][_0x7659('0x121')](db[_0x7659('0x8c')],{'onDelete':_0x7659('0x160'),'foreignKey':_0x7659('0x175')});db[_0x7659('0x4e')][_0x7659('0x114')](db[_0x7659('0x50')],{'as':_0x7659('0x16a'),'onDelete':_0x7659('0x112'),'foreignKey':_0x7659('0x179')});db['FaxInteraction'][_0x7659('0x121')](db[_0x7659('0x4a')],{'as':_0x7659('0x172'),'foreignKey':'FaxAccountId'});db[_0x7659('0x4e')]['belongsTo'](db[_0x7659('0x71')],{'as':_0x7659('0x15b'),'foreignKey':_0x7659('0x15c')});db['FaxInteraction'][_0x7659('0x121')](db[_0x7659('0x10')],{'as':_0x7659('0x16b'),'foreignKey':'UserId'});db[_0x7659('0x4e')]['belongsToMany'](db['Tag'],{'through':_0x7659('0x17a'),'as':_0x7659('0x17b')});db[_0x7659('0x4e')][_0x7659('0x122')](db[_0x7659('0x8c')],{'through':_0x7659('0x17a'),'as':_0x7659('0x16c')});db[_0x7659('0x4e')][_0x7659('0x122')](db[_0x7659('0x10')],{'as':_0x7659('0x16d'),'through':_0x7659('0x12c'),'foreignKey':_0x7659('0x179')});db['FaxMessage'][_0x7659('0x121')](db['User'],{'onDelete':'cascade','as':_0x7659('0x10')});db['FaxMessage'][_0x7659('0x121')](db[_0x7659('0x4e')],{'as':_0x7659('0x171'),'foreignKey':_0x7659('0x179')});db['FaxMessage'][_0x7659('0x121')](db[_0x7659('0x71')],{'onDelete':_0x7659('0x112'),'as':_0x7659('0x15b')});db[_0x7659('0x50')][_0x7659('0x121')](db[_0x7659('0x16f')],{'as':_0x7659('0x16f'),'foreignKey':_0x7659('0x17c')});db[_0x7659('0x50')][_0x7659('0x121')](db[_0x7659('0x4a')],{'as':_0x7659('0x172'),'foreignKey':_0x7659('0x177')});db[_0x7659('0x52')][_0x7659('0x122')](db[_0x7659('0x10')],{'as':_0x7659('0x153'),'through':_0x7659('0x30')});db[_0x7659('0x52')][_0x7659('0x122')](db['Team'],{'through':_0x7659('0x17d'),'as':_0x7659('0x154')});db[_0x7659('0x54')][_0x7659('0x121')](db[_0x7659('0x4a')],{});db[_0x7659('0x54')]['belongsTo'](db['CmList'],{'as':_0x7659('0x166'),'foreignKey':_0x7659('0x167')});db[_0x7659('0x54')][_0x7659('0x121')](db['CmContact'],{'as':'Contact','foreignKey':_0x7659('0x15c')});db[_0x7659('0x54')][_0x7659('0x121')](db[_0x7659('0x4e')],{});db['FaxQueueReport'][_0x7659('0x121')](db[_0x7659('0x50')],{});db[_0x7659('0x54')]['belongsTo'](db[_0x7659('0x10')],{});db[_0x7659('0x54')][_0x7659('0x121')](db[_0x7659('0x52')],{});db['SmsAccount']['hasMany'](db[_0x7659('0x80')],{'as':_0x7659('0x163'),'foreignKey':_0x7659('0x17e'),'onDelete':_0x7659('0x112')});db[_0x7659('0x55')][_0x7659('0x114')](db[_0x7659('0x7f')],{'as':_0x7659('0x164'),'foreignKey':_0x7659('0x17e')});db[_0x7659('0x55')][_0x7659('0x114')](db['SmsMessage'],{'as':'Messages','foreignKey':'SmsAccountId'});db[_0x7659('0x55')][_0x7659('0x114')](db['SmsInteraction'],{'as':_0x7659('0x165')});db[_0x7659('0x55')][_0x7659('0x114')](db['SmsApplication'],{'as':'Applications'});db[_0x7659('0x55')]['belongsTo'](db['CmList'],{'as':_0x7659('0x166'),'foreignKey':_0x7659('0x167')});db[_0x7659('0x55')][_0x7659('0x121')](db[_0x7659('0x84')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0x7659('0x55')][_0x7659('0x122')](db[_0x7659('0x10')],{'as':'Agents','through':_0x7659('0x140')});db[_0x7659('0x17f')][_0x7659('0x121')](db[_0x7659('0x10')],{'onDelete':_0x7659('0x160')});db[_0x7659('0x17f')][_0x7659('0x121')](db['SmsQueue'],{'onDelete':_0x7659('0x160')});db[_0x7659('0x17f')][_0x7659('0x121')](db[_0x7659('0x55')],{'onDelete':_0x7659('0x160')});db[_0x7659('0x17f')][_0x7659('0x121')](db['Interval'],{'onDelete':_0x7659('0x160'),'foreignKey':_0x7659('0x180')});db[_0x7659('0x17f')]['belongsTo'](db[_0x7659('0x8c')],{'onDelete':_0x7659('0x160'),'foreignKey':_0x7659('0x175')});db['SmsInteraction'][_0x7659('0x114')](db['SmsMessage'],{'as':_0x7659('0x16a'),'onDelete':_0x7659('0x112'),'foreignKey':'SmsInteractionId'});db[_0x7659('0x11c')][_0x7659('0x121')](db[_0x7659('0x55')],{'as':_0x7659('0x172'),'foreignKey':_0x7659('0x17e')});db[_0x7659('0x11c')][_0x7659('0x121')](db['CmContact'],{'as':_0x7659('0x15b'),'foreignKey':_0x7659('0x15c')});db[_0x7659('0x11c')][_0x7659('0x121')](db['User'],{'as':_0x7659('0x16b'),'foreignKey':_0x7659('0x113')});db['SmsInteraction'][_0x7659('0x122')](db['Tag'],{'through':_0x7659('0x181'),'as':_0x7659('0x17b')});db['SmsInteraction'][_0x7659('0x122')](db[_0x7659('0x8c')],{'through':_0x7659('0x181'),'as':_0x7659('0x16c')});db['SmsInteraction'][_0x7659('0x122')](db[_0x7659('0x10')],{'as':_0x7659('0x16d'),'through':_0x7659('0x12e'),'foreignKey':_0x7659('0x182')});db['SmsMessage'][_0x7659('0x121')](db[_0x7659('0x10')],{'as':_0x7659('0x10')});db[_0x7659('0x183')][_0x7659('0x121')](db['CmContact'],{'onDelete':_0x7659('0x112'),'as':_0x7659('0x15b')});db[_0x7659('0x183')]['belongsTo'](db[_0x7659('0x11c')],{'onDelete':_0x7659('0x112'),'as':_0x7659('0x171'),'foreignKey':_0x7659('0x182')});db[_0x7659('0x183')][_0x7659('0x121')](db[_0x7659('0x55')],{'as':'Account','foreignKey':_0x7659('0x17e')});db['SmsQueue']['belongsToMany'](db['User'],{'as':_0x7659('0x153'),'through':'UserSmsQueue','foreignKey':_0x7659('0x184')});db[_0x7659('0x5a')][_0x7659('0x122')](db[_0x7659('0x128')],{'through':_0x7659('0x185'),'as':'Teams'});db[_0x7659('0x5b')][_0x7659('0x114')](db[_0x7659('0x80')],{'as':_0x7659('0x163'),'foreignKey':'OpenchannelAccountId','onDelete':_0x7659('0x112')});db[_0x7659('0x5b')][_0x7659('0x114')](db[_0x7659('0x7f')],{'as':_0x7659('0x164'),'foreignKey':_0x7659('0x186')});db[_0x7659('0x5b')][_0x7659('0x114')](db[_0x7659('0x5f')],{'as':'Interactions','foreignKey':_0x7659('0x186')});db[_0x7659('0x5b')][_0x7659('0x114')](db['OpenchannelMessage'],{'as':'Messages','foreignKey':_0x7659('0x186')});db[_0x7659('0x5b')]['hasMany'](db['OpenchannelApplication'],{'as':_0x7659('0x146'),'foreignKey':_0x7659('0x186')});db[_0x7659('0x5b')][_0x7659('0x121')](db['CmList'],{'as':_0x7659('0x166'),'foreignKey':'ListId'});db[_0x7659('0x5b')][_0x7659('0x121')](db[_0x7659('0x84')],{'as':'mandatoryDispositionPause','foreignKey':_0x7659('0x152')});db[_0x7659('0x5b')]['belongsToMany'](db[_0x7659('0x10')],{'as':_0x7659('0x153'),'through':_0x7659('0x13e')});db[_0x7659('0x5d')][_0x7659('0x121')](db['User'],{'onDelete':_0x7659('0x160')});db[_0x7659('0x5d')][_0x7659('0x121')](db['OpenchannelQueue'],{'onDelete':_0x7659('0x160'),'foreignKey':_0x7659('0x187')});db['OpenchannelApplication'][_0x7659('0x121')](db[_0x7659('0x5b')],{'onDelete':_0x7659('0x160'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelApplication'][_0x7659('0x121')](db[_0x7659('0x83')],{'onDelete':_0x7659('0x160'),'foreignKey':_0x7659('0x180')});db[_0x7659('0x5d')][_0x7659('0x121')](db['Tag'],{'onDelete':_0x7659('0x160'),'foreignKey':'TagId'});db['OpenchannelInteraction']['hasMany'](db[_0x7659('0x61')],{'as':'Messages','onDelete':'cascade','foreignKey':_0x7659('0x188')});db['OpenchannelInteraction'][_0x7659('0x121')](db[_0x7659('0x5b')],{'as':_0x7659('0x172'),'foreignKey':_0x7659('0x186')});db[_0x7659('0x5f')]['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':_0x7659('0x15c')});db[_0x7659('0x5f')][_0x7659('0x121')](db[_0x7659('0x10')],{'as':_0x7659('0x16b'),'foreignKey':_0x7659('0x113')});db[_0x7659('0x5f')][_0x7659('0x122')](db[_0x7659('0x8c')],{'through':_0x7659('0x189'),'as':_0x7659('0x17b')});db[_0x7659('0x5f')][_0x7659('0x122')](db[_0x7659('0x8c')],{'through':_0x7659('0x189'),'as':_0x7659('0x16c')});db[_0x7659('0x5f')][_0x7659('0x122')](db[_0x7659('0x10')],{'as':_0x7659('0x16d'),'through':_0x7659('0x12f'),'foreignKey':_0x7659('0x188')});db[_0x7659('0x61')]['belongsTo'](db[_0x7659('0x10')],{'onDelete':_0x7659('0x112'),'as':_0x7659('0x10')});db[_0x7659('0x61')][_0x7659('0x121')](db[_0x7659('0x71')],{'onDelete':_0x7659('0x112'),'as':_0x7659('0x15b')});db[_0x7659('0x61')]['belongsTo'](db[_0x7659('0x5f')],{'onDelete':'cascade','as':_0x7659('0x171'),'foreignKey':'OpenchannelInteractionId'});db[_0x7659('0x61')][_0x7659('0x121')](db['Attachment'],{'as':_0x7659('0x16f'),'foreignKey':_0x7659('0x17c')});db['OpenchannelMessage'][_0x7659('0x121')](db[_0x7659('0x5b')],{'as':_0x7659('0x172'),'foreignKey':_0x7659('0x186')});db[_0x7659('0x63')][_0x7659('0x122')](db[_0x7659('0x10')],{'as':_0x7659('0x153'),'through':'UserOpenchannelQueue','foreignKey':_0x7659('0x187')});db[_0x7659('0x63')][_0x7659('0x122')](db[_0x7659('0x128')],{'through':_0x7659('0x18a'),'as':'Teams'});db[_0x7659('0x139')][_0x7659('0x114')](db[_0x7659('0x80')],{'as':'Dispositions','foreignKey':_0x7659('0x173'),'onDelete':_0x7659('0x112')});db[_0x7659('0x139')][_0x7659('0x114')](db['CannedAnswer'],{'as':'Answers','foreignKey':'ChatWebsiteId'});db[_0x7659('0x139')][_0x7659('0x114')](db[_0x7659('0x18b')],{'as':_0x7659('0x18c')});db[_0x7659('0x139')][_0x7659('0x114')](db[_0x7659('0x11a')],{'as':_0x7659('0x165')});db['ChatWebsite'][_0x7659('0x114')](db[_0x7659('0x68')],{'as':_0x7659('0x146')});db[_0x7659('0x139')][_0x7659('0x114')](db['ChatMessage'],{'as':'Messages'});db['ChatWebsite'][_0x7659('0x121')](db[_0x7659('0xfa')],{'as':_0x7659('0x166'),'foreignKey':_0x7659('0x167')});db[_0x7659('0x139')]['belongsTo'](db['Interval'],{'as':_0x7659('0x83'),'foreignKey':_0x7659('0x180')});db[_0x7659('0x139')][_0x7659('0x121')](db['MailAccount'],{'as':'MailAccount','foreignKey':_0x7659('0x15e')});db['ChatWebsite'][_0x7659('0x121')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x7659('0x152')});db[_0x7659('0x139')][_0x7659('0x122')](db[_0x7659('0x10')],{'as':_0x7659('0x153'),'through':_0x7659('0x18d')});db['OpenchannelQueueReport'][_0x7659('0x121')](db[_0x7659('0x5b')],{});db['OpenchannelQueueReport']['belongsTo'](db[_0x7659('0xfa')],{'as':_0x7659('0x166'),'foreignKey':_0x7659('0x167')});db[_0x7659('0x66')][_0x7659('0x121')](db[_0x7659('0x71')],{'as':_0x7659('0x15b'),'foreignKey':'ContactId'});db[_0x7659('0x66')][_0x7659('0x121')](db[_0x7659('0x5f')],{});db[_0x7659('0x66')]['belongsTo'](db[_0x7659('0x61')],{});db[_0x7659('0x66')]['belongsTo'](db[_0x7659('0x10')],{});db[_0x7659('0x66')][_0x7659('0x121')](db[_0x7659('0x63')],{});db['ChatApplication'][_0x7659('0x121')](db[_0x7659('0x10')],{'as':_0x7659('0x18e'),'foreignKey':_0x7659('0x113'),'onDelete':_0x7659('0x160')});db['ChatApplication'][_0x7659('0x121')](db[_0x7659('0x135')],{'as':_0x7659('0x18f'),'foreignKey':_0x7659('0x190'),'onDelete':_0x7659('0x160')});db[_0x7659('0x68')]['belongsTo'](db[_0x7659('0x139')],{'as':_0x7659('0x191'),'foreignKey':_0x7659('0x173'),'onDelete':_0x7659('0x160')});db['ChatApplication'][_0x7659('0x121')](db['Tag'],{'onDelete':'restrict','foreignKey':_0x7659('0x175')});db[_0x7659('0x11a')][_0x7659('0x114')](db['ChatMessage'],{'as':'Messages','onDelete':'cascade','foreignKey':'ChatInteractionId'});db[_0x7659('0x11a')][_0x7659('0x121')](db['ChatWebsite'],{'as':_0x7659('0x172'),'foreignKey':_0x7659('0x173')});db[_0x7659('0x11a')][_0x7659('0x121')](db[_0x7659('0x71')],{'as':_0x7659('0x15b'),'foreignKey':_0x7659('0x15c')});db[_0x7659('0x11a')][_0x7659('0x121')](db['User'],{'as':_0x7659('0x16b'),'foreignKey':'UserId'});db['ChatInteraction'][_0x7659('0x122')](db['Tag'],{'through':_0x7659('0x192'),'as':_0x7659('0x17b')});db[_0x7659('0x11a')][_0x7659('0x122')](db[_0x7659('0x8c')],{'through':_0x7659('0x192'),'as':'ThroughTags'});db[_0x7659('0x11a')][_0x7659('0x122')](db[_0x7659('0x10')],{'as':_0x7659('0x16d'),'through':'user_has_chat_interactions','foreignKey':_0x7659('0x193')});db[_0x7659('0x194')][_0x7659('0x121')](db['User'],{'onDelete':_0x7659('0x112'),'as':'User'});db['ChatMessage']['belongsTo'](db[_0x7659('0x71')],{'onDelete':_0x7659('0x112'),'as':'Contact','foreignKey':_0x7659('0x15c')});db['ChatMessage']['belongsTo'](db[_0x7659('0x11a')],{'onDelete':_0x7659('0x112'),'as':_0x7659('0x171'),'foreignKey':_0x7659('0x193')});db[_0x7659('0x194')][_0x7659('0x121')](db[_0x7659('0x16f')],{'as':_0x7659('0x16f'),'foreignKey':_0x7659('0x17c')});db['ChatMessage'][_0x7659('0x121')](db[_0x7659('0x139')],{'as':_0x7659('0x172'),'foreignKey':_0x7659('0x173')});db[_0x7659('0x6b')][_0x7659('0x114')](db[_0x7659('0x16f')],{'as':_0x7659('0x170'),'foreignKey':_0x7659('0x174'),'onDelete':_0x7659('0x112'),'hooks':!![]});db[_0x7659('0x6b')]['belongsTo'](db[_0x7659('0x71')],{'onDelete':_0x7659('0x112'),'as':_0x7659('0x15b'),'foreignKey':'ContactId'});db[_0x7659('0x6b')]['belongsTo'](db[_0x7659('0x139')],{'as':'Account','foreignKey':_0x7659('0x173')});db['ChatQueue']['belongsToMany'](db['User'],{'as':_0x7659('0x153'),'through':_0x7659('0x2d'),'hooks':!![]});db[_0x7659('0x135')][_0x7659('0x122')](db[_0x7659('0x128')],{'through':_0x7659('0x195'),'as':_0x7659('0x154')});db[_0x7659('0x6e')][_0x7659('0x114')](db[_0x7659('0xd4')],{'as':_0x7659('0x16a'),'foreignKey':_0x7659('0x196'),'onDelete':_0x7659('0x112')});db[_0x7659('0x6e')][_0x7659('0x122')](db[_0x7659('0x10')],{'as':_0x7659('0x149'),'through':_0x7659('0x124')});db['ChatProactiveAction'][_0x7659('0x121')](db[_0x7659('0x139')],{'as':_0x7659('0x191'),'foreignKey':_0x7659('0x173')});db[_0x7659('0x6f')]['hasMany'](db[_0x7659('0x71')],{'as':'Contacts','foreignKey':'CompanyId'});db[_0x7659('0x71')][_0x7659('0x114')](db['CmHopper'],{'as':_0x7659('0x14a'),'foreignKey':_0x7659('0x15c')});db[_0x7659('0x71')][_0x7659('0x114')](db[_0x7659('0x77')],{'as':_0x7659('0x117'),'foreignKey':_0x7659('0x15c')});db['CmContact'][_0x7659('0x114')](db[_0x7659('0x79')],{'as':'HopperHistories','foreignKey':'ContactId'});db[_0x7659('0x71')]['hasMany'](db[_0x7659('0x7b')],{'as':_0x7659('0x7b'),'foreignKey':'ContactId'});db[_0x7659('0x71')]['hasMany'](db['JscriptySessionReport'],{'as':_0x7659('0x14d'),'foreignKey':'ContactId'});db[_0x7659('0x71')]['hasMany'](db[_0x7659('0x5f')],{'as':'OpenchannelInteractions','foreignKey':_0x7659('0x15c'),'onDelete':_0x7659('0x160')});db[_0x7659('0x71')]['hasMany'](db['ChatInteraction'],{'as':_0x7659('0x11b'),'foreignKey':_0x7659('0x15c'),'onDelete':_0x7659('0x160')});db[_0x7659('0x71')][_0x7659('0x114')](db[_0x7659('0x11c')],{'as':_0x7659('0x12d'),'foreignKey':_0x7659('0x15c'),'onDelete':_0x7659('0x160')});db[_0x7659('0x71')][_0x7659('0x114')](db[_0x7659('0x4e')],{'as':_0x7659('0x11d'),'foreignKey':_0x7659('0x15c'),'onDelete':_0x7659('0x160')});db[_0x7659('0x71')]['hasMany'](db[_0x7659('0x40')],{'as':'MailInteractions','foreignKey':_0x7659('0x15c'),'onDelete':_0x7659('0x160')});db['CmContact'][_0x7659('0x121')](db[_0x7659('0x6f')],{'as':'Company','foreignKey':_0x7659('0x197')});db[_0x7659('0x71')]['belongsTo'](db['CmList'],{'as':_0x7659('0x166'),'foreignKey':_0x7659('0x167'),'onDelete':_0x7659('0x112')});db[_0x7659('0x71')]['belongsToMany'](db[_0x7659('0x10')],{'as':_0x7659('0x16d'),'through':_0x7659('0x126')});db['CmContact'][_0x7659('0x122')](db[_0x7659('0x8c')],{'as':_0x7659('0x17b'),'through':_0x7659('0x198')});db[_0x7659('0x71')]['belongsToMany'](db[_0x7659('0x8c')],{'through':_0x7659('0x198'),'as':_0x7659('0x16c')});db[_0x7659('0x73')]['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':_0x7659('0x15c'),'onDelete':_0x7659('0x112')});db[_0x7659('0x73')]['belongsTo'](db[_0x7659('0xfa')],{'as':_0x7659('0x166'),'foreignKey':'ListId','onDelete':_0x7659('0x112')});db['CmHopper'][_0x7659('0x121')](db[_0x7659('0x10')],{'as':_0x7659('0x18e'),'foreignKey':_0x7659('0x113')});db[_0x7659('0x73')][_0x7659('0x121')](db[_0x7659('0x1b')],{'as':_0x7659('0x18f'),'foreignKey':_0x7659('0x14b'),'onDelete':'cascade'});db[_0x7659('0x73')][_0x7659('0x121')](db['Campaign'],{'as':'Campaign','foreignKey':_0x7659('0x199'),'onDelete':_0x7659('0x112')});db[_0x7659('0x73')][_0x7659('0x121')](db[_0x7659('0x10')],{'as':'Owner','foreignKey':_0x7659('0x19a')});db['CmHopperBlack'][_0x7659('0x121')](db[_0x7659('0x71')],{'as':_0x7659('0x15b'),'foreignKey':_0x7659('0x15c'),'onDelete':_0x7659('0x112')});db['CmHopperBlack'][_0x7659('0x121')](db['CmList'],{'as':_0x7659('0x166'),'foreignKey':_0x7659('0x167'),'onDelete':_0x7659('0x112')});db[_0x7659('0x75')][_0x7659('0x121')](db[_0x7659('0x1b')],{'as':_0x7659('0x18f'),'foreignKey':_0x7659('0x14b'),'onDelete':_0x7659('0x112')});db[_0x7659('0x75')][_0x7659('0x121')](db[_0x7659('0xec')],{'as':_0x7659('0xec'),'foreignKey':_0x7659('0x199'),'onDelete':_0x7659('0x112')});db['Automation'][_0x7659('0x114')](db[_0x7659('0x19b')],{'as':{'plural':'All','singular':_0x7659('0x19c')},'foreignKey':_0x7659('0x19d'),'onDelete':_0x7659('0x112'),'hooks':!![]});db[_0x7659('0x19e')][_0x7659('0x114')](db[_0x7659('0x19b')],{'as':{'plural':_0x7659('0x19f'),'singular':_0x7659('0x1a0')},'foreignKey':_0x7659('0x1a1'),'onDelete':_0x7659('0x112'),'hooks':!![]});db[_0x7659('0x19e')][_0x7659('0x114')](db[_0x7659('0x7e')],{'as':_0x7659('0x1a2'),'foreignKey':_0x7659('0x1a3'),'onDelete':_0x7659('0x112'),'hooks':!![]});db[_0x7659('0x80')]['hasMany'](db[_0x7659('0x80')],{'as':'Dispositions','foreignKey':_0x7659('0x1a4'),'onDelete':_0x7659('0x112')});db[_0x7659('0x83')][_0x7659('0x114')](db[_0x7659('0x83')],{'as':_0x7659('0x1a5'),'foreignKey':'IntervalId','onDelete':'cascade','hooks':!![],'required':![]});db[_0x7659('0x83')][_0x7659('0x114')](db['VoiceExtension'],{'as':'Extensions','foreignKey':'IntervalId','onDelete':_0x7659('0x160')});db[_0x7659('0x83')][_0x7659('0x114')](db['MailApplication'],{'as':_0x7659('0x1a6'),'foreignKey':'IntervalId'});db[_0x7659('0x83')][_0x7659('0x114')](db[_0x7659('0x68')],{'as':_0x7659('0x1a7'),'foreignKey':'IntervalId'});db['Interval'][_0x7659('0x114')](db[_0x7659('0x4c')],{'as':_0x7659('0x1a8'),'foreignKey':_0x7659('0x180')});db[_0x7659('0x83')][_0x7659('0x114')](db['SmsApplication'],{'as':_0x7659('0x1a9'),'foreignKey':'IntervalId'});db['Schedule'][_0x7659('0x121')](db[_0x7659('0x3a')],{});db[_0x7659('0x89')][_0x7659('0x121')](db[_0x7659('0x1aa')],{'foreignKey':_0x7659('0x1ab')});db[_0x7659('0x89')][_0x7659('0x121')](db[_0x7659('0x95')],{'foreignKey':_0x7659('0x1ac')});db[_0x7659('0x8b')][_0x7659('0x122')](db[_0x7659('0x19')],{'as':_0x7659('0x1ad'),'through':_0x7659('0x148'),'onDelete':'restrict'});db[_0x7659('0x8c')][_0x7659('0x122')](db[_0x7659('0x71')],{'through':_0x7659('0x198')});db['Tag'][_0x7659('0x122')](db['ChatInteraction'],{'through':_0x7659('0x192')});db['Tag'][_0x7659('0x122')](db['MailInteraction'],{'through':_0x7659('0x1ae')});db['Tag'][_0x7659('0x122')](db[_0x7659('0x11c')],{'through':_0x7659('0x181')});db[_0x7659('0x8c')]['belongsToMany'](db['FaxInteraction'],{'through':'fax_interaction_has_tags'});db['Tag']['belongsToMany'](db[_0x7659('0x5f')],{'through':'openchannel_interaction_has_tags'});db[_0x7659('0x8c')]['belongsToMany'](db[_0x7659('0x105')],{'through':_0x7659('0x1af')});db[_0x7659('0x8f')][_0x7659('0x114')](db[_0x7659('0x19b')],{'as':{'plural':_0x7659('0x1b0'),'singular':_0x7659('0x1b1')},'foreignKey':'TriggerAllId','onDelete':_0x7659('0x112'),'hooks':!![]});db['Trigger'][_0x7659('0x114')](db[_0x7659('0x19b')],{'as':{'plural':'AnyConditions','singular':'AnyCondition'},'foreignKey':_0x7659('0x1b2'),'onDelete':_0x7659('0x112'),'hooks':!![]});db[_0x7659('0x8f')][_0x7659('0x114')](db['Action'],{'as':_0x7659('0x1a2'),'foreignKey':_0x7659('0x1b3'),'onDelete':'cascade','hooks':!![]});db[_0x7659('0x95')]['hasMany'](db[_0x7659('0x9a')],{'as':'Fields','onDelete':_0x7659('0x112'),'foreignKey':_0x7659('0x1ac'),'hooks':!![]});db[_0x7659('0x1aa')][_0x7659('0x114')](db[_0x7659('0x9a')],{'as':'Fields','onDelete':_0x7659('0x112'),'foreignKey':_0x7659('0x1ab')});db[_0x7659('0x99')][_0x7659('0x114')](db[_0x7659('0x9a')],{'as':_0x7659('0x1b4'),'onDelete':_0x7659('0x112'),'foreignKey':_0x7659('0x1b5')});db[_0x7659('0x9a')]['belongsTo'](db[_0x7659('0x99')],{'foreignKey':_0x7659('0x1b5')});db[_0x7659('0x9c')][_0x7659('0x114')](db['SalesforceConfiguration'],{'as':_0x7659('0x1b6'),'onDelete':_0x7659('0x112'),'foreignKey':'AccountId'});db[_0x7659('0x1b7')][_0x7659('0x114')](db[_0x7659('0x9f')],{'as':'Subjects','onDelete':_0x7659('0x112'),'foreignKey':_0x7659('0x1b8')});db['SalesforceConfiguration']['hasMany'](db['SalesforceField'],{'as':'Descriptions','onDelete':_0x7659('0x112'),'foreignKey':_0x7659('0x1b9')});db[_0x7659('0x1b7')]['hasMany'](db[_0x7659('0x9f')],{'as':'Fields','onDelete':_0x7659('0x112'),'foreignKey':_0x7659('0x1ba')});db['SalesforceConfiguration']['belongsTo'](db[_0x7659('0x9c')],{'as':_0x7659('0x172'),'foreignKey':_0x7659('0x1bb')});db['SalesforceField']['hasMany'](db[_0x7659('0x9f')],{'as':_0x7659('0x1bc'),'foreignKey':'SubjectId'});db[_0x7659('0x9f')]['hasMany'](db[_0x7659('0x9f')],{'as':'Description','foreignKey':_0x7659('0x1b9')});db[_0x7659('0x9f')][_0x7659('0x114')](db['SalesforceField'],{'as':'Field','foreignKey':_0x7659('0x1ba')});db['SalesforceField'][_0x7659('0x121')](db['Variable'],{'as':_0x7659('0x91'),'foreignKey':_0x7659('0x1bd')});db[_0x7659('0xa0')][_0x7659('0x114')](db[_0x7659('0xa1')],{'as':_0x7659('0x1b6'),'onDelete':_0x7659('0x112'),'foreignKey':_0x7659('0x1bb')});db[_0x7659('0xa1')][_0x7659('0x114')](db[_0x7659('0xa3')],{'as':_0x7659('0x1be'),'onDelete':_0x7659('0x112'),'foreignKey':'SubjectId'});db[_0x7659('0xa1')]['hasMany'](db[_0x7659('0xa3')],{'as':_0x7659('0x1bf'),'onDelete':'cascade','foreignKey':_0x7659('0x1b9')});db['SugarcrmConfiguration'][_0x7659('0x114')](db['SugarcrmField'],{'as':_0x7659('0x1b4'),'onDelete':_0x7659('0x112'),'foreignKey':'FieldId'});db[_0x7659('0xa1')][_0x7659('0x121')](db[_0x7659('0xa0')],{'as':_0x7659('0x172'),'foreignKey':_0x7659('0x1bb')});db[_0x7659('0xa3')][_0x7659('0x114')](db[_0x7659('0xa3')],{'as':'Subject','foreignKey':_0x7659('0x1b8')});db['SugarcrmField']['hasMany'](db[_0x7659('0xa3')],{'as':'Description','foreignKey':_0x7659('0x1b9')});db[_0x7659('0xa3')][_0x7659('0x114')](db['SugarcrmField'],{'as':_0x7659('0x1c0'),'foreignKey':'FieldId'});db[_0x7659('0xa3')][_0x7659('0x121')](db[_0x7659('0x91')],{'as':'Variable','foreignKey':_0x7659('0x1bd')});db[_0x7659('0xa5')][_0x7659('0x114')](db[_0x7659('0xa6')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x7659('0x1bb')});db[_0x7659('0xa6')]['hasMany'](db['DeskField'],{'as':'Subjects','onDelete':_0x7659('0x112'),'foreignKey':_0x7659('0x1b8')});db[_0x7659('0xa6')][_0x7659('0x114')](db[_0x7659('0xa7')],{'as':'Descriptions','onDelete':_0x7659('0x112'),'foreignKey':_0x7659('0x1b9')});db[_0x7659('0xa6')][_0x7659('0x114')](db[_0x7659('0xa7')],{'as':_0x7659('0x1b4'),'onDelete':_0x7659('0x112'),'foreignKey':_0x7659('0x1ba')});db[_0x7659('0xa6')]['belongsTo'](db[_0x7659('0xa5')],{'as':_0x7659('0x172'),'foreignKey':'AccountId'});db[_0x7659('0xa6')]['belongsToMany'](db[_0x7659('0x8c')],{'through':_0x7659('0x1c1')});db['DeskField'][_0x7659('0x114')](db[_0x7659('0xa7')],{'as':_0x7659('0x1bc'),'foreignKey':_0x7659('0x1b8')});db[_0x7659('0xa7')][_0x7659('0x114')](db[_0x7659('0xa7')],{'as':_0x7659('0x1c2'),'foreignKey':_0x7659('0x1b9')});db[_0x7659('0xa7')][_0x7659('0x114')](db[_0x7659('0xa7')],{'as':_0x7659('0x1c0'),'foreignKey':_0x7659('0x1ba')});db[_0x7659('0xa7')][_0x7659('0x121')](db[_0x7659('0x91')],{'as':_0x7659('0x91'),'foreignKey':_0x7659('0x1bd')});db['ZohoAccount']['hasMany'](db['ZohoConfiguration'],{'as':_0x7659('0x1b6'),'onDelete':_0x7659('0x112'),'foreignKey':_0x7659('0x1bb')});db[_0x7659('0xab')]['hasMany'](db[_0x7659('0xad')],{'as':'Subjects','onDelete':_0x7659('0x112'),'foreignKey':_0x7659('0x1b8')});db[_0x7659('0xab')][_0x7659('0x114')](db[_0x7659('0xad')],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0x7659('0x1b9')});db[_0x7659('0xab')][_0x7659('0x114')](db[_0x7659('0xad')],{'as':_0x7659('0x1b4'),'onDelete':_0x7659('0x112'),'foreignKey':_0x7659('0x1ba')});db[_0x7659('0xab')][_0x7659('0x121')](db['ZohoAccount'],{'as':'Account','foreignKey':_0x7659('0x1bb')});db[_0x7659('0xad')][_0x7659('0x114')](db[_0x7659('0xad')],{'as':_0x7659('0x1bc'),'foreignKey':_0x7659('0x1b8')});db[_0x7659('0xad')][_0x7659('0x114')](db[_0x7659('0xad')],{'as':_0x7659('0x1c2'),'foreignKey':'DescriptionId'});db[_0x7659('0xad')][_0x7659('0x114')](db[_0x7659('0xad')],{'as':_0x7659('0x1c0'),'foreignKey':_0x7659('0x1ba')});db[_0x7659('0xad')][_0x7659('0x121')](db[_0x7659('0x91')],{'as':_0x7659('0x91'),'foreignKey':_0x7659('0x1bd')});db[_0x7659('0xaf')]['hasMany'](db['ZendeskConfiguration'],{'as':_0x7659('0x1b6'),'onDelete':_0x7659('0x112'),'foreignKey':'AccountId'});db[_0x7659('0xb0')][_0x7659('0x114')](db[_0x7659('0xb2')],{'as':'Subjects','foreignKey':_0x7659('0x1b8')});db[_0x7659('0xb0')]['hasMany'](db['ZendeskField'],{'as':_0x7659('0x1bf'),'foreignKey':_0x7659('0x1b9')});db[_0x7659('0xb0')]['hasMany'](db[_0x7659('0xb2')],{'as':_0x7659('0x1b4'),'foreignKey':'FieldId'});db[_0x7659('0xb0')][_0x7659('0x121')](db[_0x7659('0xaf')],{'as':_0x7659('0x172'),'foreignKey':_0x7659('0x1bb')});db[_0x7659('0xb0')][_0x7659('0x122')](db[_0x7659('0x8c')],{'through':_0x7659('0x1c3')});db[_0x7659('0xb2')][_0x7659('0x114')](db[_0x7659('0xb2')],{'as':_0x7659('0x1bc'),'foreignKey':'SubjectId'});db[_0x7659('0xb2')][_0x7659('0x114')](db[_0x7659('0xb2')],{'as':_0x7659('0x1c2'),'foreignKey':_0x7659('0x1b9')});db[_0x7659('0xb2')][_0x7659('0x114')](db[_0x7659('0xb2')],{'as':_0x7659('0x1c0'),'foreignKey':_0x7659('0x1ba')});db[_0x7659('0xb2')][_0x7659('0x121')](db[_0x7659('0x91')],{'as':_0x7659('0x91'),'foreignKey':_0x7659('0x1bd')});db[_0x7659('0xb4')]['hasMany'](db[_0x7659('0xb6')],{'as':'Configurations','onDelete':_0x7659('0x112'),'foreignKey':'AccountId'});db[_0x7659('0xb6')][_0x7659('0x114')](db['FreshdeskField'],{'as':_0x7659('0x1be'),'onDelete':'cascade','foreignKey':'SubjectId'});db['FreshdeskConfiguration']['hasMany'](db[_0x7659('0xb8')],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0x7659('0x1b9')});db[_0x7659('0xb6')][_0x7659('0x114')](db[_0x7659('0xb8')],{'as':'Fields','onDelete':_0x7659('0x112'),'foreignKey':'FieldId'});db[_0x7659('0xb6')]['belongsTo'](db[_0x7659('0xb4')],{'as':'Account','foreignKey':_0x7659('0x1bb')});db[_0x7659('0xb6')][_0x7659('0x122')](db['Tag'],{'through':'int_freshdesk_configuration_has_tags'});db['FreshdeskField'][_0x7659('0x114')](db[_0x7659('0xb8')],{'as':_0x7659('0x1bc'),'foreignKey':_0x7659('0x1b8')});db[_0x7659('0xb8')][_0x7659('0x114')](db[_0x7659('0xb8')],{'as':_0x7659('0x1c2'),'foreignKey':'DescriptionId'});db[_0x7659('0xb8')][_0x7659('0x114')](db[_0x7659('0xb8')],{'as':_0x7659('0x1c0'),'foreignKey':_0x7659('0x1ba')});db[_0x7659('0xb8')][_0x7659('0x121')](db[_0x7659('0x91')],{'as':_0x7659('0x91'),'foreignKey':'VariableId'});db[_0x7659('0xba')][_0x7659('0x114')](db[_0x7659('0xbc')],{'as':_0x7659('0x1b6'),'onDelete':_0x7659('0x112'),'foreignKey':'AccountId'});db[_0x7659('0xbc')][_0x7659('0x114')](db[_0x7659('0xbd')],{'as':_0x7659('0x1be'),'foreignKey':_0x7659('0x1b8')});db[_0x7659('0xbc')][_0x7659('0x114')](db[_0x7659('0xbd')],{'as':_0x7659('0x1bf'),'foreignKey':_0x7659('0x1b9')});db[_0x7659('0xbc')][_0x7659('0x114')](db[_0x7659('0xbd')],{'as':_0x7659('0x1b4'),'foreignKey':'FieldId'});db[_0x7659('0xbc')]['belongsTo'](db[_0x7659('0xba')],{'as':'Account','foreignKey':_0x7659('0x1bb')});db[_0x7659('0xbd')][_0x7659('0x114')](db[_0x7659('0xbd')],{'as':_0x7659('0x1bc'),'foreignKey':_0x7659('0x1b8')});db[_0x7659('0xbd')][_0x7659('0x114')](db[_0x7659('0xbd')],{'as':_0x7659('0x1c2'),'foreignKey':'DescriptionId'});db[_0x7659('0xbd')][_0x7659('0x114')](db['VtigerField'],{'as':'Field','foreignKey':_0x7659('0x1ba')});db[_0x7659('0xbd')][_0x7659('0x121')](db['Variable'],{'as':_0x7659('0x91'),'foreignKey':'VariableId'});db[_0x7659('0xbe')][_0x7659('0x114')](db[_0x7659('0xc0')],{'as':_0x7659('0x1b6'),'onDelete':_0x7659('0x112'),'foreignKey':_0x7659('0x1bb')});db['ServicenowConfiguration'][_0x7659('0x114')](db[_0x7659('0xc2')],{'as':_0x7659('0x1be'),'foreignKey':_0x7659('0x1b8')});db[_0x7659('0xc0')][_0x7659('0x114')](db[_0x7659('0xc2')],{'as':_0x7659('0x1bf'),'foreignKey':_0x7659('0x1b9')});db['ServicenowConfiguration'][_0x7659('0x114')](db['ServicenowField'],{'as':_0x7659('0x1b4'),'foreignKey':_0x7659('0x1ba')});db['ServicenowConfiguration'][_0x7659('0x121')](db['ServicenowAccount'],{'as':_0x7659('0x172'),'foreignKey':_0x7659('0x1bb')});db[_0x7659('0xc2')][_0x7659('0x114')](db['ServicenowField'],{'as':_0x7659('0x1bc'),'foreignKey':_0x7659('0x1b8')});db[_0x7659('0xc2')][_0x7659('0x114')](db['ServicenowField'],{'as':'Description','foreignKey':_0x7659('0x1b9')});db[_0x7659('0xc2')][_0x7659('0x114')](db[_0x7659('0xc2')],{'as':_0x7659('0x1c0'),'foreignKey':'FieldId'});db[_0x7659('0xc2')][_0x7659('0x121')](db[_0x7659('0x91')],{'as':_0x7659('0x91'),'foreignKey':_0x7659('0x1bd')});db[_0x7659('0xc4')][_0x7659('0x114')](db['Dynamics365Configuration'],{'as':_0x7659('0x1b6'),'onDelete':'cascade','foreignKey':_0x7659('0x1bb')});db['Dynamics365Configuration'][_0x7659('0x114')](db[_0x7659('0xc7')],{'as':'Subjects','onDelete':_0x7659('0x112'),'foreignKey':_0x7659('0x1b8')});db[_0x7659('0xc6')][_0x7659('0x114')](db[_0x7659('0xc7')],{'as':'Descriptions','onDelete':_0x7659('0x112'),'foreignKey':'DescriptionId'});db[_0x7659('0xc6')]['hasMany'](db[_0x7659('0xc7')],{'as':_0x7659('0x1b4'),'onDelete':_0x7659('0x112'),'foreignKey':_0x7659('0x1ba')});db['Dynamics365Configuration']['belongsTo'](db[_0x7659('0xc4')],{'as':_0x7659('0x172'),'foreignKey':_0x7659('0x1bb')});db['Dynamics365Field'][_0x7659('0x114')](db[_0x7659('0xc7')],{'as':_0x7659('0x1bc'),'foreignKey':_0x7659('0x1b8')});db['Dynamics365Field'][_0x7659('0x114')](db[_0x7659('0xc7')],{'as':'Description','foreignKey':_0x7659('0x1b9')});db[_0x7659('0xc7')][_0x7659('0x114')](db[_0x7659('0xc7')],{'as':_0x7659('0x1c0'),'foreignKey':_0x7659('0x1ba')});db['Dynamics365Field']['belongsTo'](db[_0x7659('0x91')],{'as':_0x7659('0x91'),'foreignKey':_0x7659('0x1bd')});db[_0x7659('0xc9')][_0x7659('0x114')](db[_0x7659('0xcb')],{'as':_0x7659('0x1b6'),'onDelete':'cascade','foreignKey':_0x7659('0x1bb')});db[_0x7659('0xcb')][_0x7659('0x114')](db['FreshsalesField'],{'as':'Subjects','foreignKey':_0x7659('0x1b8')});db[_0x7659('0xcb')][_0x7659('0x114')](db['FreshsalesField'],{'as':_0x7659('0x1bf'),'foreignKey':_0x7659('0x1b9')});db[_0x7659('0xcb')][_0x7659('0x114')](db[_0x7659('0xcd')],{'as':_0x7659('0x1b4'),'foreignKey':_0x7659('0x1ba')});db[_0x7659('0xcb')][_0x7659('0x121')](db[_0x7659('0xc9')],{'as':'Account','foreignKey':_0x7659('0x1bb')});db[_0x7659('0xcd')][_0x7659('0x114')](db[_0x7659('0xcd')],{'as':'Subject','foreignKey':_0x7659('0x1b8')});db[_0x7659('0xcd')][_0x7659('0x114')](db[_0x7659('0xcd')],{'as':_0x7659('0x1c2'),'foreignKey':_0x7659('0x1b9')});db['FreshsalesField']['hasMany'](db['FreshsalesField'],{'as':_0x7659('0x1c0'),'foreignKey':_0x7659('0x1ba')});db['FreshsalesField']['belongsTo'](db[_0x7659('0x91')],{'as':'Variable','foreignKey':_0x7659('0x1bd')});db['ChatQueueReport'][_0x7659('0x121')](db['ChatWebsite'],{});db['ChatQueueReport'][_0x7659('0x121')](db[_0x7659('0xfa')],{'as':_0x7659('0x166'),'foreignKey':_0x7659('0x167')});db[_0x7659('0xd2')][_0x7659('0x121')](db['CmContact'],{'as':_0x7659('0x15b'),'foreignKey':_0x7659('0x15c')});db['ChatQueueReport'][_0x7659('0x121')](db[_0x7659('0x11a')],{});db[_0x7659('0xd2')][_0x7659('0x121')](db['ChatMessage'],{});db[_0x7659('0xd2')]['belongsTo'](db['User'],{});db[_0x7659('0xd2')][_0x7659('0x121')](db[_0x7659('0x135')],{});db['ChatInternalMessage'][_0x7659('0x121')](db[_0x7659('0x10')],{'onDelete':_0x7659('0x112'),'foreignKey':_0x7659('0x1c4')});db[_0x7659('0xd4')][_0x7659('0x121')](db['User'],{'onDelete':_0x7659('0x112'),'foreignKey':'ToId'});db[_0x7659('0xd9')][_0x7659('0x114')](db[_0x7659('0xd7')],{'foreignKey':_0x7659('0x1c5'),'onDelete':_0x7659('0x112')});db['JscriptySessionReport'][_0x7659('0x114')](db['JscriptyAnswerReport'],{'foreignKey':_0x7659('0x1c5'),'onDelete':_0x7659('0x112')});db[_0x7659('0xdb')][_0x7659('0x121')](db[_0x7659('0x55')],{});db[_0x7659('0xdb')][_0x7659('0x121')](db['CmList'],{'as':_0x7659('0x166'),'foreignKey':'ListId'});db['SmsQueueReport'][_0x7659('0x121')](db[_0x7659('0x71')],{'as':_0x7659('0x15b'),'foreignKey':_0x7659('0x15c')});db[_0x7659('0xdb')][_0x7659('0x121')](db[_0x7659('0x11c')],{});db[_0x7659('0xdb')][_0x7659('0x121')](db[_0x7659('0x183')],{});db[_0x7659('0xdb')][_0x7659('0x121')](db['User'],{});db[_0x7659('0xdb')][_0x7659('0x121')](db['SmsQueue'],{});db['JscriptyProject'][_0x7659('0x114')](db[_0x7659('0xd9')],{'foreignKey':_0x7659('0x1c6')});db['JscriptyProject'][_0x7659('0x114')](db['JscriptyQuestionReport'],{'foreignKey':_0x7659('0x1c6')});db[_0x7659('0xe0')][_0x7659('0x114')](db[_0x7659('0xd6')],{'foreignKey':_0x7659('0x1c6')});db[_0x7659('0xe6')][_0x7659('0x122')](db[_0x7659('0x10')],{'as':_0x7659('0x16d'),'through':_0x7659('0x143')});db['Team'][_0x7659('0x122')](db['User'],{'as':_0x7659('0x153'),'through':_0x7659('0x129')});db[_0x7659('0x128')]['belongsToMany'](db[_0x7659('0x1b')],{'through':_0x7659('0x10a'),'as':_0x7659('0x131')});db[_0x7659('0x128')][_0x7659('0x122')](db[_0x7659('0x3c')],{'through':_0x7659('0x169'),'as':_0x7659('0x134')});db[_0x7659('0x128')][_0x7659('0x122')](db[_0x7659('0x135')],{'through':_0x7659('0x195'),'as':_0x7659('0x1c7')});db[_0x7659('0x128')][_0x7659('0x122')](db[_0x7659('0x52')],{'through':_0x7659('0x17d'),'as':_0x7659('0x1c8')});db[_0x7659('0x128')][_0x7659('0x122')](db[_0x7659('0x5a')],{'through':_0x7659('0x185'),'as':'SmsQueues'});db[_0x7659('0x128')]['belongsToMany'](db['OpenchannelQueue'],{'through':'team_has_openchannel_queues','as':_0x7659('0x1c9')});db[_0x7659('0x128')]['belongsToMany'](db[_0x7659('0x137')],{'through':'team_has_whatsapp_queues','as':_0x7659('0x138')});db[_0x7659('0x128')][_0x7659('0x122')](db[_0x7659('0x132')],{'through':_0x7659('0x10c'),'as':_0x7659('0x133')});db[_0x7659('0xec')]['hasMany'](db[_0x7659('0x73')],{'as':_0x7659('0x14a'),'foreignKey':'CampaignId'});db[_0x7659('0xec')]['hasMany'](db[_0x7659('0x77')],{'as':_0x7659('0x117'),'foreignKey':_0x7659('0x199')});db[_0x7659('0xec')][_0x7659('0x114')](db[_0x7659('0x79')],{'as':_0x7659('0x14c'),'foreignKey':_0x7659('0x199')});db[_0x7659('0xec')][_0x7659('0x114')](db[_0x7659('0x75')],{'as':_0x7659('0x1ca'),'foreignKey':_0x7659('0x199')});db[_0x7659('0xec')][_0x7659('0x121')](db[_0x7659('0x29')],{'as':'Trunk','foreignKey':_0x7659('0x14e')});db['Campaign']['belongsTo'](db[_0x7659('0x29')],{'as':_0x7659('0x14f'),'foreignKey':'TrunkBackupId'});db[_0x7659('0xec')][_0x7659('0x121')](db[_0x7659('0x83')],{'as':_0x7659('0x83'),'foreignKey':_0x7659('0x180')});db[_0x7659('0xec')][_0x7659('0x121')](db[_0x7659('0xe6')],{'as':_0x7659('0xe6'),'foreignKey':_0x7659('0x1cb')});db[_0x7659('0xec')]['belongsToMany'](db[_0x7659('0xfa')],{'as':_0x7659('0x127'),'through':'campaigns_has_cm_lists'});db[_0x7659('0xec')][_0x7659('0x122')](db['CmList'],{'as':'BlackLists','through':_0x7659('0x1cc')});db[_0x7659('0x16f')][_0x7659('0x121')](db[_0x7659('0x6b')],{'as':'ChatOfflineMessage','foreignKey':_0x7659('0x174')});db['MailTransferReport']['belongsTo'](db[_0x7659('0x42')],{});db[_0x7659('0xf2')]['belongsTo'](db[_0x7659('0x40')],{});db[_0x7659('0xf2')][_0x7659('0x121')](db[_0x7659('0x3a')],{'foreignKey':_0x7659('0x1cd'),'as':'FromAccount'});db[_0x7659('0xf2')][_0x7659('0x121')](db[_0x7659('0x10')],{'foreignKey':_0x7659('0x1ce'),'as':_0x7659('0x1cf')});db['MailTransferReport'][_0x7659('0x121')](db['User'],{'foreignKey':_0x7659('0x1d0'),'as':_0x7659('0x1d1')});db[_0x7659('0xf2')][_0x7659('0x121')](db['MailQueue'],{'foreignKey':_0x7659('0x1d2'),'as':'ToQueue'});db[_0x7659('0xf2')][_0x7659('0x121')](db['MailAccount'],{'foreignKey':_0x7659('0x1d3'),'as':_0x7659('0x1d4')});db[_0x7659('0x1d5')]['belongsTo'](db[_0x7659('0x194')],{});db[_0x7659('0x1d5')][_0x7659('0x121')](db[_0x7659('0x11a')],{});db[_0x7659('0x1d5')][_0x7659('0x121')](db[_0x7659('0x139')],{'foreignKey':_0x7659('0x1d6'),'as':_0x7659('0x1d7')});db[_0x7659('0x1d5')][_0x7659('0x121')](db[_0x7659('0x10')],{'foreignKey':_0x7659('0x1ce'),'as':_0x7659('0x1cf')});db[_0x7659('0x1d5')][_0x7659('0x121')](db['User'],{'foreignKey':'ToUserId','as':_0x7659('0x1d1')});db[_0x7659('0x1d5')][_0x7659('0x121')](db[_0x7659('0x135')],{'foreignKey':_0x7659('0x1d8'),'as':_0x7659('0x1d9')});db[_0x7659('0x1d5')]['belongsTo'](db[_0x7659('0x139')],{'foreignKey':_0x7659('0x1da'),'as':_0x7659('0x1d4')});db[_0x7659('0xf5')][_0x7659('0x121')](db[_0x7659('0x50')],{});db[_0x7659('0xf5')]['belongsTo'](db['FaxInteraction'],{});db[_0x7659('0xf5')][_0x7659('0x121')](db[_0x7659('0x4a')],{'foreignKey':_0x7659('0x1db'),'as':_0x7659('0x1d7')});db[_0x7659('0xf5')][_0x7659('0x121')](db[_0x7659('0x10')],{'foreignKey':'FromUserId','as':_0x7659('0x1cf')});db[_0x7659('0xf5')]['belongsTo'](db[_0x7659('0x10')],{'foreignKey':_0x7659('0x1d0'),'as':_0x7659('0x1d1')});db[_0x7659('0xf5')][_0x7659('0x121')](db[_0x7659('0x52')],{'foreignKey':_0x7659('0x1dc'),'as':'ToQueue'});db[_0x7659('0xf5')][_0x7659('0x121')](db['FaxAccount'],{'foreignKey':'ToFaxAccountId','as':_0x7659('0x1d4')});db[_0x7659('0xf6')]['belongsTo'](db[_0x7659('0x61')],{});db[_0x7659('0xf6')][_0x7659('0x121')](db[_0x7659('0x5f')],{});db[_0x7659('0xf6')]['belongsTo'](db[_0x7659('0x5b')],{'foreignKey':_0x7659('0x1dd'),'as':'FromAccount'});db[_0x7659('0xf6')][_0x7659('0x121')](db[_0x7659('0x10')],{'foreignKey':_0x7659('0x1ce'),'as':_0x7659('0x1cf')});db[_0x7659('0xf6')][_0x7659('0x121')](db['User'],{'foreignKey':_0x7659('0x1d0'),'as':_0x7659('0x1d1')});db[_0x7659('0xf6')][_0x7659('0x121')](db['OpenchannelQueue'],{'foreignKey':'ToOpenchannelQueueId','as':_0x7659('0x1d9')});db[_0x7659('0xf6')][_0x7659('0x121')](db[_0x7659('0x5b')],{'foreignKey':_0x7659('0x1de'),'as':_0x7659('0x1d4')});db[_0x7659('0xf8')]['belongsTo'](db[_0x7659('0x183')],{});db[_0x7659('0xf8')][_0x7659('0x121')](db[_0x7659('0x11c')],{});db[_0x7659('0xf8')][_0x7659('0x121')](db['SmsAccount'],{'foreignKey':_0x7659('0x1df'),'as':'FromAccount'});db[_0x7659('0xf8')][_0x7659('0x121')](db[_0x7659('0x10')],{'foreignKey':_0x7659('0x1ce'),'as':_0x7659('0x1cf')});db[_0x7659('0xf8')][_0x7659('0x121')](db[_0x7659('0x10')],{'foreignKey':_0x7659('0x1d0'),'as':'ToAgent'});db[_0x7659('0xf8')][_0x7659('0x121')](db[_0x7659('0x5a')],{'foreignKey':'ToSmsQueueId','as':_0x7659('0x1d9')});db['SmsTransferReport'][_0x7659('0x121')](db['SmsAccount'],{'foreignKey':'ToSmsAccountId','as':'ToAccount'});db[_0x7659('0xfa')][_0x7659('0x114')](db[_0x7659('0x80')],{'as':_0x7659('0x163'),'foreignKey':_0x7659('0x167'),'onDelete':_0x7659('0x112')});db[_0x7659('0xfa')][_0x7659('0x114')](db[_0x7659('0x7c')],{'as':'CustomFields','foreignKey':_0x7659('0x167')});db[_0x7659('0xfa')][_0x7659('0x114')](db[_0x7659('0x71')],{'as':_0x7659('0x125'),'onDelete':_0x7659('0x112'),'foreignKey':'ListId'});db[_0x7659('0xfa')][_0x7659('0x114')](db['CmHopperFinal'],{'as':_0x7659('0x117'),'foreignKey':_0x7659('0x167')});db[_0x7659('0xfa')]['hasMany'](db[_0x7659('0x79')],{'as':_0x7659('0x118'),'foreignKey':'ListId'});db[_0x7659('0xfa')][_0x7659('0x114')](db['ReportAgentPreview'],{'as':_0x7659('0x7b'),'foreignKey':_0x7659('0x167')});db['CmList'][_0x7659('0x122')](db[_0x7659('0x1b')],{'as':_0x7659('0x1e0'),'through':_0x7659('0x1e1')});db[_0x7659('0xfa')][_0x7659('0x122')](db[_0x7659('0x10')],{'as':_0x7659('0x153'),'through':_0x7659('0x1e2')});db[_0x7659('0x132')]['hasMany'](db['VoiceExtension'],{'as':_0x7659('0x116'),'onDelete':_0x7659('0x112')});db[_0x7659('0x132')][_0x7659('0x122')](db[_0x7659('0x10')],{'as':_0x7659('0x153'),'through':'UserVoicePrefix'});db[_0x7659('0x132')]['belongsToMany'](db['Team'],{'through':_0x7659('0x10c'),'as':_0x7659('0x154')});db['UserProfile'][_0x7659('0x114')](db[_0x7659('0x10')],{'as':'Users','foreignKey':_0x7659('0x1e3')});db[_0x7659('0xfc')][_0x7659('0x114')](db[_0x7659('0xfe')],{'as':_0x7659('0x1e4'),'foreignKey':'userProfileId','onDelete':_0x7659('0x112')});db[_0x7659('0xfe')][_0x7659('0x114')](db[_0x7659('0xff')],{'as':_0x7659('0x1e5'),'foreignKey':'sectionId','onDelete':'cascade'});db[_0x7659('0x141')][_0x7659('0x114')](db[_0x7659('0x80')],{'as':_0x7659('0x163'),'foreignKey':_0x7659('0x1e6'),'onDelete':_0x7659('0x112')});db['WhatsappAccount'][_0x7659('0x114')](db[_0x7659('0x7f')],{'as':_0x7659('0x164'),'foreignKey':_0x7659('0x1e6')});db[_0x7659('0x141')][_0x7659('0x114')](db[_0x7659('0x1e7')],{'as':_0x7659('0x16a'),'foreignKey':'WhatsappAccountId'});db[_0x7659('0x141')][_0x7659('0x114')](db[_0x7659('0x105')],{'as':_0x7659('0x165')});db[_0x7659('0x141')]['hasMany'](db['WhatsappApplication'],{'as':_0x7659('0x146')});db[_0x7659('0x141')][_0x7659('0x121')](db[_0x7659('0xfa')],{'as':'List','foreignKey':_0x7659('0x167')});db[_0x7659('0x141')][_0x7659('0x121')](db[_0x7659('0x84')],{'as':_0x7659('0x151'),'foreignKey':_0x7659('0x152')});db[_0x7659('0x141')][_0x7659('0x122')](db[_0x7659('0x10')],{'as':_0x7659('0x153'),'through':_0x7659('0x1e8')});db[_0x7659('0x103')][_0x7659('0x121')](db[_0x7659('0x10')],{'onDelete':_0x7659('0x160')});db['WhatsappApplication'][_0x7659('0x121')](db[_0x7659('0x137')],{'onDelete':_0x7659('0x160')});db[_0x7659('0x103')]['belongsTo'](db[_0x7659('0x141')],{'onDelete':_0x7659('0x160')});db['WhatsappApplication'][_0x7659('0x121')](db[_0x7659('0x83')],{'onDelete':'restrict','foreignKey':'IntervalId'});db[_0x7659('0x103')][_0x7659('0x121')](db['Tag'],{'onDelete':'restrict','foreignKey':_0x7659('0x175')});db[_0x7659('0x105')][_0x7659('0x114')](db['WhatsappMessage'],{'as':_0x7659('0x16a'),'onDelete':'cascade','foreignKey':_0x7659('0x1e9')});db['WhatsappInteraction'][_0x7659('0x121')](db['WhatsappAccount'],{'as':_0x7659('0x172'),'foreignKey':'WhatsappAccountId'});db['WhatsappInteraction'][_0x7659('0x121')](db[_0x7659('0x71')],{'as':_0x7659('0x15b'),'foreignKey':_0x7659('0x15c')});db[_0x7659('0x105')][_0x7659('0x121')](db[_0x7659('0x10')],{'as':_0x7659('0x16b'),'foreignKey':'UserId'});db[_0x7659('0x105')][_0x7659('0x122')](db['Tag'],{'through':_0x7659('0x1af'),'as':_0x7659('0x17b')});db[_0x7659('0x105')]['belongsToMany'](db[_0x7659('0x8c')],{'through':'whatsapp_interaction_has_tags','as':_0x7659('0x16c')});db['WhatsappInteraction']['belongsToMany'](db[_0x7659('0x10')],{'as':_0x7659('0x16d'),'through':'user_has_whatsapp_interactions','foreignKey':_0x7659('0x1e9')});db[_0x7659('0x1e7')][_0x7659('0x121')](db[_0x7659('0x10')],{'as':_0x7659('0x10')});db[_0x7659('0x1e7')][_0x7659('0x121')](db[_0x7659('0x71')],{'onDelete':'cascade','as':_0x7659('0x15b')});db[_0x7659('0x1e7')][_0x7659('0x121')](db['WhatsappInteraction'],{'onDelete':_0x7659('0x112'),'as':'Interaction','foreignKey':'WhatsappInteractionId'});db['WhatsappMessage'][_0x7659('0x121')](db['WhatsappAccount'],{'as':'Account','foreignKey':_0x7659('0x1e6')});db[_0x7659('0x1ea')][_0x7659('0x121')](db[_0x7659('0x141')],{});db['WhatsappQueueReport'][_0x7659('0x121')](db[_0x7659('0xfa')],{'as':_0x7659('0x166'),'foreignKey':_0x7659('0x167')});db['WhatsappQueueReport'][_0x7659('0x121')](db['CmContact'],{'as':_0x7659('0x15b'),'foreignKey':_0x7659('0x15c')});db[_0x7659('0x1ea')]['belongsTo'](db[_0x7659('0x105')],{});db[_0x7659('0x1ea')][_0x7659('0x121')](db['WhatsappQueue'],{});db[_0x7659('0x1ea')][_0x7659('0x121')](db['WhatsappMessage'],{});db[_0x7659('0x1ea')][_0x7659('0x121')](db[_0x7659('0x10')],{});db['WhatsappTransferReport']['belongsTo'](db[_0x7659('0x1e7')],{});db[_0x7659('0x1eb')][_0x7659('0x121')](db[_0x7659('0x105')],{});db[_0x7659('0x1eb')]['belongsTo'](db[_0x7659('0x141')],{'foreignKey':_0x7659('0x1ec'),'as':_0x7659('0x1d7')});db[_0x7659('0x1eb')]['belongsTo'](db['WhatsappAccount'],{'foreignKey':_0x7659('0x1ed'),'as':_0x7659('0x1d4')});db[_0x7659('0x1eb')][_0x7659('0x121')](db['WhatsappQueue'],{'foreignKey':_0x7659('0x1ee'),'as':_0x7659('0x1d9')});db[_0x7659('0x1eb')]['belongsTo'](db[_0x7659('0x10')],{'foreignKey':'FromUserId','as':_0x7659('0x1cf')});db[_0x7659('0x1eb')][_0x7659('0x121')](db[_0x7659('0x10')],{'foreignKey':'ToUserId','as':_0x7659('0x1d1')});db['WhatsappQueue'][_0x7659('0x122')](db[_0x7659('0x10')],{'as':_0x7659('0x153'),'through':'UserWhatsappQueue','foreignKey':_0x7659('0x1ef')});db[_0x7659('0x137')]['belongsToMany'](db[_0x7659('0x128')],{'through':'team_has_whatsapp_queues','as':_0x7659('0x154')});db[_0x7659('0x15f')][_0x7659('0x110')](db[_0x7659('0x15d')],{'as':'Imap','onDelete':_0x7659('0x160')});db[_0x7659('0x15f')][_0x7659('0x110')](db[_0x7659('0x38')],{'as':_0x7659('0x162'),'onDelete':_0x7659('0x160')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index ebd30cf..2de9b40 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf8d1=['./api/squareReport','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/projects','./api/squareProject','./api/squareRecording','/api/square/messages','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','/api/fax/reports/transfer','/api/openchannel/reports/transfer','./api/openchannelTransferReport','./api/smsTransferReport','/api/cm/lists','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/version','/api/system','./api/system','/api/pm2','./api/pm2','./api/webbar','/apidoc','static','join','root','/www','/demo','/snippet','3.0.0','/plugins','/server/files/plugins','route','get','sendFile','resolve','appPath','/index.html','username','password','newPassword','apiKey','firstName','lastName','street','mobile','fax','email','clientId','clientSecret','securityToken','code','tenantId','token','channelSecret','accessTokenSecret','authToken','consumerKey','membername','calleridnum','exten','vidaooApiKey','clientEmail','privateKey','secretaccesskey','key','pass','accountSid','localstationid','dsn','registry','isArray','length','isPlainObject','isString','replace','@@{','}@@','includes','lodash','path','express','express-winston','util','./errors','./config/environment','api','./config/logger','auth','default','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','body','format','method','headers','x-forwarded-for','connection','remoteAddress','statusCode','responseTime','user','name','role','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','agent_id','url','device','other','agent_name','test','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','/api/voice/extensions','./api/voiceExtension','./api/voiceMusicOnHold','/api/voice/queues','/api/voice/recordings','./api/voiceRecording','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','/api/voice/dials/reports','/api/voice/agents/reports','/api/members/reports','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','./api/mailServerOut','/api/mail/accounts','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','/api/fax/messages','./api/faxMessage','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','/api/sms/applications','/api/sms/interactions','./api/smsMessage','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','/api/openchannel/interactions','./api/openchannelInteraction','./api/openchannelMessage','/api/openchannel/queues','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatInteraction','/api/chat/messages','./api/chatMessage','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','/api/actions','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','./api/condition','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/cdr','/api/schedules','/api/sounds','./api/sound','/api/tags','./api/tag','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','/api/analytics/default_reports','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','./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/intDeskConfiguration','/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/freshdesk/configurations','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','./api/intVtigerField','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','/api/integrations/freshsales/fields','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','/api/jscripty/answers/reports','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue'];(function(_0x414648,_0x34a290){var _0x3fae7=function(_0x37fe41){while(--_0x37fe41){_0x414648['push'](_0x414648['shift']());}};_0x3fae7(++_0x34a290);}(_0xf8d1,0x7a));var _0x1f8d=function(_0x582f86,_0x610533){_0x582f86=_0x582f86-0x0;var _0x1a9433=_0xf8d1[_0x582f86];return _0x1a9433;};'use strict';var _=require(_0x1f8d('0x0'));var path=require(_0x1f8d('0x1'));var express=require(_0x1f8d('0x2'));var ewinston=require(_0x1f8d('0x3'));var util=require(_0x1f8d('0x4'));var errors=require(_0x1f8d('0x5'));var config=require(_0x1f8d('0x6'));var logger=require('./config/logger')(_0x1f8d('0x7'));var authLogger=require(_0x1f8d('0x8'))(_0x1f8d('0x9'));var safeTemplate=require('./safe-template')['safeTemplate'];exports[_0x1f8d('0xa')]=function(_0x46c86c){_0x46c86c[_0x1f8d('0xb')](ewinston[_0x1f8d('0xc')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x206db7,_0x364cd9){var _0x287aeb=_0x1f8d('0xd');if(!_['isEmpty'](_0x206db7[_0x1f8d('0xe')])){_0x287aeb+='\x20body=%s';var _0x1c8241=_0x206db7[_0x1f8d('0xe')];maskSensitiveData(_0x1c8241);}return safeTemplate(util[_0x1f8d('0xf')](_0x287aeb,_0x206db7[_0x1f8d('0x10')],_0x206db7[_0x1f8d('0x11')][_0x1f8d('0x12')]?_0x206db7[_0x1f8d('0x11')]['x-forwarded-for']:_0x206db7[_0x1f8d('0x13')][_0x1f8d('0x14')]||_0x206db7['ip'],_0x206db7['url'],_0x364cd9[_0x1f8d('0x15')],_0x364cd9[_0x1f8d('0x16')],_0x206db7[_0x1f8d('0x17')]?_0x206db7[_0x1f8d('0x17')]['id']:null,_0x206db7['user']?_0x206db7['user'][_0x1f8d('0x18')]:null,_0x206db7['user']?_0x206db7[_0x1f8d('0x17')][_0x1f8d('0x19')]:null,_0x1c8241?util[_0x1f8d('0x1a')](_0x1c8241,![],null):''));}}));_0x46c86c[_0x1f8d('0xb')](ewinston[_0x1f8d('0xc')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x434507,_0x1e6a9b){var _0x518d23=_0x1f8d('0x1b');if(_0x434507[_0x1f8d('0xe')]&&_0x434507[_0x1f8d('0xe')]['device']&&_0x434507[_0x1f8d('0xe')][_0x1f8d('0x1c')]){_0x518d23='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0x1f8d('0xf')](_0x518d23,_0x434507[_0x1f8d('0x10')],_0x434507[_0x1f8d('0x11')]['x-forwarded-for']?_0x434507['headers'][_0x1f8d('0x12')]:_0x434507['connection'][_0x1f8d('0x14')]||_0x434507['ip'],_0x434507[_0x1f8d('0x1d')],_0x1e6a9b[_0x1f8d('0x15')],_0x1e6a9b['responseTime'],_0x434507['user']?_0x434507['user']['id']:null,_0x434507[_0x1f8d('0x17')]?_0x434507[_0x1f8d('0x17')][_0x1f8d('0x18')]:null,_0x434507[_0x1f8d('0x17')]?_0x434507[_0x1f8d('0x17')][_0x1f8d('0x19')]:null,_0x434507[_0x1f8d('0xe')]&&_0x434507[_0x1f8d('0xe')]['device']?_0x434507[_0x1f8d('0xe')][_0x1f8d('0x1e')]:_0x1f8d('0x1f'),_0x434507['body']&&_0x434507[_0x1f8d('0xe')][_0x1f8d('0x1c')]?_0x434507[_0x1f8d('0xe')][_0x1f8d('0x1c')]:'',_0x434507[_0x1f8d('0xe')]&&_0x434507[_0x1f8d('0xe')][_0x1f8d('0x20')]?_0x434507[_0x1f8d('0xe')]['agent_name']:'');},'ignoreRoute':function(_0x3fd0fe){var _0x35c4d0=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x35c4d0[_0x1f8d('0x21')](_0x3fd0fe[_0x1f8d('0x1d')]);}}));_0x46c86c[_0x1f8d('0xb')](_0x1f8d('0x22'),require(_0x1f8d('0x23')));_0x46c86c[_0x1f8d('0xb')](_0x1f8d('0x24'),require(_0x1f8d('0x25')));_0x46c86c[_0x1f8d('0xb')](_0x1f8d('0x26'),require('./api/voiceContext'));_0x46c86c[_0x1f8d('0xb')](_0x1f8d('0x27'),require(_0x1f8d('0x28')));_0x46c86c[_0x1f8d('0xb')]('/api/voice/mohs',require(_0x1f8d('0x29')));_0x46c86c[_0x1f8d('0xb')](_0x1f8d('0x2a'),require('./api/voiceQueue'));_0x46c86c['use'](_0x1f8d('0x2b'),require(_0x1f8d('0x2c')));_0x46c86c[_0x1f8d('0xb')]('/api/screen/recordings',require(_0x1f8d('0x2d')));_0x46c86c['use'](_0x1f8d('0x2e'),require(_0x1f8d('0x2f')));_0x46c86c['use'](_0x1f8d('0x30'),require(_0x1f8d('0x31')));_0x46c86c[_0x1f8d('0xb')](_0x1f8d('0x32'),require('./api/voiceCallReport'));_0x46c86c[_0x1f8d('0xb')](_0x1f8d('0x33'),require('./api/voiceDialReport'));_0x46c86c['use'](_0x1f8d('0x34'),require('./api/voiceAgentReport'));_0x46c86c[_0x1f8d('0xb')]('/api/voice/queues/reports',require('./api/voiceQueueReport'));_0x46c86c[_0x1f8d('0xb')](_0x1f8d('0x35'),require('./api/memberReport'));_0x46c86c[_0x1f8d('0xb')](_0x1f8d('0x36'),require(_0x1f8d('0x37')));_0x46c86c[_0x1f8d('0xb')](_0x1f8d('0x38'),require(_0x1f8d('0x39')));_0x46c86c['use']('/api/mail/out_servers',require(_0x1f8d('0x3a')));_0x46c86c['use'](_0x1f8d('0x3b'),require('./api/mailAccount'));_0x46c86c[_0x1f8d('0xb')](_0x1f8d('0x3c'),require(_0x1f8d('0x3d')));_0x46c86c[_0x1f8d('0xb')](_0x1f8d('0x3e'),require(_0x1f8d('0x3f')));_0x46c86c[_0x1f8d('0xb')](_0x1f8d('0x40'),require(_0x1f8d('0x41')));_0x46c86c[_0x1f8d('0xb')](_0x1f8d('0x42'),require('./api/mailMessage'));_0x46c86c[_0x1f8d('0xb')]('/api/mail/applications',require(_0x1f8d('0x43')));_0x46c86c[_0x1f8d('0xb')](_0x1f8d('0x44'),require(_0x1f8d('0x45')));_0x46c86c[_0x1f8d('0xb')](_0x1f8d('0x46'),require(_0x1f8d('0x47')));_0x46c86c[_0x1f8d('0xb')](_0x1f8d('0x48'),require(_0x1f8d('0x49')));_0x46c86c[_0x1f8d('0xb')](_0x1f8d('0x4a'),require(_0x1f8d('0x4b')));_0x46c86c[_0x1f8d('0xb')](_0x1f8d('0x4c'),require(_0x1f8d('0x4d')));_0x46c86c[_0x1f8d('0xb')](_0x1f8d('0x4e'),require('./api/faxInteraction'));_0x46c86c[_0x1f8d('0xb')](_0x1f8d('0x4f'),require(_0x1f8d('0x50')));_0x46c86c[_0x1f8d('0xb')]('/api/fax/queues',require(_0x1f8d('0x51')));_0x46c86c[_0x1f8d('0xb')](_0x1f8d('0x52'),require(_0x1f8d('0x53')));_0x46c86c['use'](_0x1f8d('0x54'),require('./api/smsAccount'));_0x46c86c[_0x1f8d('0xb')](_0x1f8d('0x55'),require('./api/smsApplication'));_0x46c86c['use'](_0x1f8d('0x56'),require('./api/smsInteraction'));_0x46c86c[_0x1f8d('0xb')]('/api/sms/messages',require(_0x1f8d('0x57')));_0x46c86c[_0x1f8d('0xb')]('/api/sms/queues',require(_0x1f8d('0x58')));_0x46c86c[_0x1f8d('0xb')](_0x1f8d('0x59'),require(_0x1f8d('0x5a')));_0x46c86c[_0x1f8d('0xb')](_0x1f8d('0x5b'),require('./api/openchannelApplication'));_0x46c86c[_0x1f8d('0xb')](_0x1f8d('0x5c'),require(_0x1f8d('0x5d')));_0x46c86c['use']('/api/openchannel/messages',require(_0x1f8d('0x5e')));_0x46c86c[_0x1f8d('0xb')](_0x1f8d('0x5f'),require('./api/openchannelQueue'));_0x46c86c[_0x1f8d('0xb')](_0x1f8d('0x60'),require(_0x1f8d('0x61')));_0x46c86c[_0x1f8d('0xb')](_0x1f8d('0x62'),require(_0x1f8d('0x63')));_0x46c86c[_0x1f8d('0xb')](_0x1f8d('0x64'),require('./api/chatApplication'));_0x46c86c[_0x1f8d('0xb')]('/api/chat/interactions',require(_0x1f8d('0x65')));_0x46c86c[_0x1f8d('0xb')](_0x1f8d('0x66'),require(_0x1f8d('0x67')));_0x46c86c['use']('/api/chat/offline_messages',require(_0x1f8d('0x68')));_0x46c86c[_0x1f8d('0xb')](_0x1f8d('0x69'),require(_0x1f8d('0x6a')));_0x46c86c[_0x1f8d('0xb')](_0x1f8d('0x6b'),require('./api/chatGroup'));_0x46c86c[_0x1f8d('0xb')]('/api/chat/proactive_actions',require('./api/chatProactiveAction'));_0x46c86c[_0x1f8d('0xb')]('/api/cm/companies',require('./api/cmCompany'));_0x46c86c[_0x1f8d('0xb')](_0x1f8d('0x6c'),require(_0x1f8d('0x6d')));_0x46c86c[_0x1f8d('0xb')](_0x1f8d('0x6e'),require(_0x1f8d('0x6f')));_0x46c86c['use'](_0x1f8d('0x70'),require('./api/cmHopperBlack'));_0x46c86c[_0x1f8d('0xb')](_0x1f8d('0x71'),require(_0x1f8d('0x72')));_0x46c86c['use'](_0x1f8d('0x73'),require(_0x1f8d('0x74')));_0x46c86c['use'](_0x1f8d('0x75'),require('./api/cmCustomField'));_0x46c86c['use'](_0x1f8d('0x76'),require(_0x1f8d('0x77')));_0x46c86c[_0x1f8d('0xb')](_0x1f8d('0x78'),require(_0x1f8d('0x79')));_0x46c86c[_0x1f8d('0xb')](_0x1f8d('0x7a'),require(_0x1f8d('0x7b')));_0x46c86c[_0x1f8d('0xb')](_0x1f8d('0x7c'),require(_0x1f8d('0x7d')));_0x46c86c[_0x1f8d('0xb')]('/api/conditions',require(_0x1f8d('0x7e')));_0x46c86c['use']('/api/intervals',require(_0x1f8d('0x7f')));_0x46c86c[_0x1f8d('0xb')](_0x1f8d('0x80'),require(_0x1f8d('0x81')));_0x46c86c[_0x1f8d('0xb')](_0x1f8d('0x82'),require(_0x1f8d('0x83')));_0x46c86c['use']('/api/voiceQueuesLog',require('./api/voiceQueuesLog'));_0x46c86c['use'](_0x1f8d('0x84'),require('./api/schedule'));_0x46c86c[_0x1f8d('0xb')](_0x1f8d('0x85'),require(_0x1f8d('0x86')));_0x46c86c['use'](_0x1f8d('0x87'),require(_0x1f8d('0x88')));_0x46c86c[_0x1f8d('0xb')]('/api/templates',require('./api/template'));_0x46c86c[_0x1f8d('0xb')](_0x1f8d('0x89'),require(_0x1f8d('0x8a')));_0x46c86c[_0x1f8d('0xb')](_0x1f8d('0x8b'),require(_0x1f8d('0x8c')));_0x46c86c[_0x1f8d('0xb')](_0x1f8d('0x8d'),require(_0x1f8d('0x8e')));_0x46c86c[_0x1f8d('0xb')](_0x1f8d('0x8f'),require(_0x1f8d('0x90')));_0x46c86c[_0x1f8d('0xb')](_0x1f8d('0x91'),require('./api/analyticCustomReport'));_0x46c86c['use'](_0x1f8d('0x92'),require('./api/analyticDefaultReport'));_0x46c86c[_0x1f8d('0xb')](_0x1f8d('0x93'),require(_0x1f8d('0x94')));_0x46c86c['use'](_0x1f8d('0x95'),require(_0x1f8d('0x96')));_0x46c86c[_0x1f8d('0xb')]('/api/analytics/field_reports',require('./api/analyticFieldReport'));_0x46c86c[_0x1f8d('0xb')]('/api/analytics/tree_reports',require(_0x1f8d('0x97')));_0x46c86c['use'](_0x1f8d('0x98'),require(_0x1f8d('0x99')));_0x46c86c[_0x1f8d('0xb')](_0x1f8d('0x9a'),require(_0x1f8d('0x9b')));_0x46c86c[_0x1f8d('0xb')]('/api/integrations/salesforce/fields',require('./api/intSalesforceField'));_0x46c86c[_0x1f8d('0xb')](_0x1f8d('0x9c'),require(_0x1f8d('0x9d')));_0x46c86c['use'](_0x1f8d('0x9e'),require(_0x1f8d('0x9f')));_0x46c86c[_0x1f8d('0xb')](_0x1f8d('0xa0'),require(_0x1f8d('0xa1')));_0x46c86c[_0x1f8d('0xb')](_0x1f8d('0xa2'),require(_0x1f8d('0xa3')));_0x46c86c[_0x1f8d('0xb')]('/api/integrations/desk/configurations',require(_0x1f8d('0xa4')));_0x46c86c['use'](_0x1f8d('0xa5'),require('./api/intDeskField'));_0x46c86c[_0x1f8d('0xb')]('/api/integrations/zoho/accounts',require(_0x1f8d('0xa6')));_0x46c86c[_0x1f8d('0xb')](_0x1f8d('0xa7'),require(_0x1f8d('0xa8')));_0x46c86c[_0x1f8d('0xb')](_0x1f8d('0xa9'),require('./api/intZohoField'));_0x46c86c['use'](_0x1f8d('0xaa'),require('./api/intZendeskAccount'));_0x46c86c[_0x1f8d('0xb')](_0x1f8d('0xab'),require(_0x1f8d('0xac')));_0x46c86c['use'](_0x1f8d('0xad'),require(_0x1f8d('0xae')));_0x46c86c['use'](_0x1f8d('0xaf'),require(_0x1f8d('0xb0')));_0x46c86c[_0x1f8d('0xb')](_0x1f8d('0xb1'),require('./api/intFreshdeskConfiguration'));_0x46c86c['use'](_0x1f8d('0xb2'),require(_0x1f8d('0xb3')));_0x46c86c[_0x1f8d('0xb')](_0x1f8d('0xb4'),require(_0x1f8d('0xb5')));_0x46c86c['use'](_0x1f8d('0xb6'),require(_0x1f8d('0xb7')));_0x46c86c[_0x1f8d('0xb')]('/api/integrations/vtiger/fields',require(_0x1f8d('0xb8')));_0x46c86c[_0x1f8d('0xb')]('/api/integrations/servicenow/accounts',require(_0x1f8d('0xb9')));_0x46c86c[_0x1f8d('0xb')](_0x1f8d('0xba'),require(_0x1f8d('0xbb')));_0x46c86c[_0x1f8d('0xb')](_0x1f8d('0xbc'),require(_0x1f8d('0xbd')));_0x46c86c[_0x1f8d('0xb')]('/api/integrations/dynamics365/accounts',require('./api/intDynamics365Account'));_0x46c86c['use'](_0x1f8d('0xbe'),require(_0x1f8d('0xbf')));_0x46c86c[_0x1f8d('0xb')](_0x1f8d('0xc0'),require(_0x1f8d('0xc1')));_0x46c86c[_0x1f8d('0xb')]('/api/integrations/freshsales/accounts',require(_0x1f8d('0xc2')));_0x46c86c['use'](_0x1f8d('0xc3'),require('./api/intFreshsalesConfiguration'));_0x46c86c[_0x1f8d('0xb')](_0x1f8d('0xc4'),require('./api/intFreshsalesField'));_0x46c86c[_0x1f8d('0xb')]('/api/networks',require(_0x1f8d('0xc5')));_0x46c86c[_0x1f8d('0xb')](_0x1f8d('0xc6'),require(_0x1f8d('0xc7')));_0x46c86c['use'](_0x1f8d('0xc8'),require('./api/chatInternalMessage'));_0x46c86c[_0x1f8d('0xb')](_0x1f8d('0xc9'),require('./api/jscriptyAnswerReport'));_0x46c86c[_0x1f8d('0xb')](_0x1f8d('0xca'),require(_0x1f8d('0xcb')));_0x46c86c[_0x1f8d('0xb')](_0x1f8d('0xcc'),require(_0x1f8d('0xcd')));_0x46c86c[_0x1f8d('0xb')](_0x1f8d('0xce'),require('./api/smsQueueReport'));_0x46c86c[_0x1f8d('0xb')]('/api/square/reports',require(_0x1f8d('0xcf')));_0x46c86c['use']('/api/square/details/reports',require('./api/squareReportDetail'));_0x46c86c[_0x1f8d('0xb')](_0x1f8d('0xd0'),require(_0x1f8d('0xd1')));_0x46c86c[_0x1f8d('0xb')](_0x1f8d('0xd2'),require(_0x1f8d('0xd3')));_0x46c86c[_0x1f8d('0xb')]('/api/square/odbc',require('./api/squareOdbc'));_0x46c86c['use'](_0x1f8d('0xd4'),require(_0x1f8d('0xd5')));_0x46c86c[_0x1f8d('0xb')]('/api/square/recordings',require(_0x1f8d('0xd6')));_0x46c86c[_0x1f8d('0xb')](_0x1f8d('0xd7'),require('./api/squareMessage'));_0x46c86c[_0x1f8d('0xb')](_0x1f8d('0xd8'),require(_0x1f8d('0xd9')));_0x46c86c[_0x1f8d('0xb')](_0x1f8d('0xda'),require(_0x1f8d('0xdb')));_0x46c86c['use'](_0x1f8d('0xdc'),require(_0x1f8d('0xdd')));_0x46c86c['use'](_0x1f8d('0xde'),require(_0x1f8d('0xdf')));_0x46c86c['use'](_0x1f8d('0xe0'),require(_0x1f8d('0xe1')));_0x46c86c[_0x1f8d('0xb')](_0x1f8d('0xe2'),require(_0x1f8d('0xe3')));_0x46c86c[_0x1f8d('0xb')](_0x1f8d('0xe4'),require(_0x1f8d('0xe5')));_0x46c86c[_0x1f8d('0xb')](_0x1f8d('0xe6'),require('./api/chatTransferReport'));_0x46c86c[_0x1f8d('0xb')](_0x1f8d('0xe7'),require('./api/faxTransferReport'));_0x46c86c['use'](_0x1f8d('0xe8'),require(_0x1f8d('0xe9')));_0x46c86c[_0x1f8d('0xb')]('/api/sms/reports/transfer',require(_0x1f8d('0xea')));_0x46c86c[_0x1f8d('0xb')](_0x1f8d('0xeb'),require('./api/cmList'));_0x46c86c[_0x1f8d('0xb')](_0x1f8d('0xec'),require(_0x1f8d('0xed')));_0x46c86c[_0x1f8d('0xb')](_0x1f8d('0xee'),require('./api/userProfile'));_0x46c86c[_0x1f8d('0xb')](_0x1f8d('0xef'),require(_0x1f8d('0xf0')));_0x46c86c['use'](_0x1f8d('0xf1'),require(_0x1f8d('0xf2')));_0x46c86c[_0x1f8d('0xb')]('/api/userNotifications',require(_0x1f8d('0xf3')));_0x46c86c[_0x1f8d('0xb')](_0x1f8d('0xf4'),require(_0x1f8d('0xf5')));_0x46c86c[_0x1f8d('0xb')](_0x1f8d('0xf6'),require('./api/whatsappApplication'));_0x46c86c['use']('/api/whatsapp/interactions',require('./api/whatsappInteraction'));_0x46c86c['use']('/api/whatsapp/messages',require(_0x1f8d('0xf7')));_0x46c86c[_0x1f8d('0xb')](_0x1f8d('0xf8'),require('./api/whatsappQueueReport'));_0x46c86c[_0x1f8d('0xb')]('/api/whatsapp/reports/transfer',require(_0x1f8d('0xf9')));_0x46c86c[_0x1f8d('0xb')](_0x1f8d('0xfa'),require(_0x1f8d('0xfb')));_0x46c86c[_0x1f8d('0xb')](_0x1f8d('0xfc'),require(_0x1f8d('0xfd')));_0x46c86c['use'](_0x1f8d('0xfe'),require(_0x1f8d('0xff')));_0x46c86c[_0x1f8d('0xb')](_0x1f8d('0x100'),require(_0x1f8d('0x101')));_0x46c86c['use'](_0x1f8d('0x102'),require(_0x1f8d('0x103')));_0x46c86c['use'](_0x1f8d('0x104'),require(_0x1f8d('0x105')));_0x46c86c['use'](_0x1f8d('0x106'),require(_0x1f8d('0x107')));_0x46c86c[_0x1f8d('0xb')](_0x1f8d('0x108'),require(_0x1f8d('0x109')));_0x46c86c[_0x1f8d('0xb')](_0x1f8d('0x10a'),require('./api/version'));_0x46c86c[_0x1f8d('0xb')](_0x1f8d('0x10b'),require(_0x1f8d('0x10c')));_0x46c86c[_0x1f8d('0xb')](_0x1f8d('0x10d'),require(_0x1f8d('0x10e')));_0x46c86c[_0x1f8d('0xb')]('/api/webbar',require(_0x1f8d('0x10f')));_0x46c86c[_0x1f8d('0xb')](_0x1f8d('0x110'),express[_0x1f8d('0x111')](path[_0x1f8d('0x112')](config[_0x1f8d('0x113')],_0x1f8d('0x110'))));_0x46c86c[_0x1f8d('0xb')](_0x1f8d('0x114'),express['static'](path['join'](config[_0x1f8d('0x113')],_0x1f8d('0x114'))));_0x46c86c['use'](_0x1f8d('0x115'),express[_0x1f8d('0x111')](path[_0x1f8d('0x112')](config[_0x1f8d('0x113')],_0x1f8d('0x115'))));_0x46c86c[_0x1f8d('0xb')](_0x1f8d('0x116'),express[_0x1f8d('0x111')](path[_0x1f8d('0x112')](config[_0x1f8d('0x113')],'snippet',_0x1f8d('0x117'))));_0x46c86c[_0x1f8d('0xb')](_0x1f8d('0x118'),express[_0x1f8d('0x111')](path['join'](config['root'],_0x1f8d('0x119'))));_0x46c86c[_0x1f8d('0x11a')]('/:url(api|auth|components|app|bower_components|assets)/*')[_0x1f8d('0x11b')](errors[0x194]);_0x46c86c[_0x1f8d('0x11a')]('/*')['get'](function(_0x4035c1,_0x13e9e4){_0x13e9e4[_0x1f8d('0x11c')](path[_0x1f8d('0x11d')](_0x46c86c['get'](_0x1f8d('0x11e'))+_0x1f8d('0x11f')));});};var sensitiveFields=[_0x1f8d('0x120'),_0x1f8d('0x121'),_0x1f8d('0x122'),_0x1f8d('0x123'),_0x1f8d('0x124'),_0x1f8d('0x125'),_0x1f8d('0x126'),'phone',_0x1f8d('0x127'),_0x1f8d('0x128'),_0x1f8d('0x129'),_0x1f8d('0x12a'),_0x1f8d('0x12b'),_0x1f8d('0x12c'),_0x1f8d('0x12d'),'accessKey',_0x1f8d('0x12e'),_0x1f8d('0x12f'),_0x1f8d('0x130'),'accessToken',_0x1f8d('0x131'),_0x1f8d('0x132'),_0x1f8d('0x133'),'consumerSecret',_0x1f8d('0x134'),'calleridname',_0x1f8d('0x135'),_0x1f8d('0x136'),_0x1f8d('0x137'),_0x1f8d('0x138'),_0x1f8d('0x139'),'accesskeyid',_0x1f8d('0x13a'),_0x1f8d('0x13b'),_0x1f8d('0x17'),_0x1f8d('0x13c'),_0x1f8d('0x13d'),_0x1f8d('0x13e'),_0x1f8d('0x13f'),'secret',_0x1f8d('0x140'),'oldPassword'];function maskSensitiveData(_0x41ae62){var _0x54d1fe=/(?!^)[\s\S](?!$)/g;if(!_['isPlainObject'](_0x41ae62))return;for(var _0x19ec7b in _0x41ae62){if(_[_0x1f8d('0x141')](_0x41ae62[_0x19ec7b])){for(var _0x5843ab=0x0;_0x5843ab<_0x41ae62[_0x19ec7b][_0x1f8d('0x142')];_0x5843ab++){maskSensitiveData(_0x41ae62[_0x19ec7b][_0x5843ab]);}}else if(_[_0x1f8d('0x143')](_0x41ae62[_0x19ec7b])){maskSensitiveData(_0x41ae62[_0x19ec7b]);}else if(_[_0x1f8d('0x144')](_0x41ae62[_0x19ec7b])){_0x41ae62[_0x19ec7b]=_0x41ae62[_0x19ec7b][_0x1f8d('0x145')](/{{{/g,_0x1f8d('0x146'))[_0x1f8d('0x145')](/}}}/g,_0x1f8d('0x147'))[_0x1f8d('0x145')](/{{/g,'@{')[_0x1f8d('0x145')](/}}/g,'}@');if(_[_0x1f8d('0x148')](sensitiveFields,_0x19ec7b)){_0x41ae62[_0x19ec7b]=_0x41ae62[_0x19ec7b][_0x1f8d('0x145')](_0x54d1fe,'*');}}}} \ No newline at end of file +var _0x3445=['./api/migration','/api/attachments','./api/attachment','/api/plugins','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','./api/voicePrefix','/api/userProfiles','/api/userProfile/sections','./api/userProfileSection','./api/userProfileResource','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','./api/pm2','/api/webbar','./api/webbar','/apidoc','static','join','root','/www','/demo','/snippet','snippet','3.0.0','/plugins','route','get','sendFile','resolve','/index.html','username','password','newPassword','firstName','lastName','phone','mobile','fax','email','clientId','clientSecret','securityToken','code','accessKey','tenantId','token','channelSecret','accessToken','authToken','consumerSecret','membername','calleridname','calleridnum','exten','vidaooApiKey','clientEmail','accesskeyid','secretaccesskey','pass','accountSid','localstationid','dsn','registry','oldPassword','isPlainObject','length','isString','replace','@@{','}@@','lodash','path','express','express-winston','util','./errors','./config/environment','./config/logger','auth','./safe-template','safeTemplate','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','format','method','headers','x-forwarded-for','connection','url','responseTime','user','name','role','inspect','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','remoteAddress','statusCode','other','agent_id','agent_name','test','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','./api/memberReport','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailAccount','/api/mail/queues','./api/mailQueue','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','/api/fax/accounts','/api/fax/applications','/api/fax/interactions','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/smsAccount','./api/smsApplication','./api/smsInteraction','/api/sms/queues','./api/smsQueue','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','/api/openchannel/queues','/api/chat/websites','./api/chatWebsite','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','./api/chatInteraction','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','/api/chat/proactive_actions','./api/chatProactiveAction','./api/cmCompany','/api/cm/contacts','/api/cm/hopper','./api/cmHopper','./api/cmHopperBlack','/api/cm/hopper_final','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','./api/disposition','/api/conditions','/api/intervals','/api/pauses','./api/pause','./api/cdr','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','/api/tags','/api/templates','./api/template','/api/triggers','/api/variables','./api/variable','/api/integrations','./api/integration','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/fields','./api/intSugarcrmAccount','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','./api/intZendeskField','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','/api/integrations/freshdesk/fields','/api/integrations/vtiger/accounts','/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/intDynamics365Account','/api/integrations/dynamics365/configurations','/api/integrations/freshsales/accounts','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','./api/intFreshsalesField','/api/networks','./api/network','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','./api/squareReportDetail','/api/settings','./api/setting','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations'];(function(_0x101a17,_0x5d047a){var _0x3b76ee=function(_0x89be1b){while(--_0x89be1b){_0x101a17['push'](_0x101a17['shift']());}};_0x3b76ee(++_0x5d047a);}(_0x3445,0x1b7));var _0x5344=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3445[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5344('0x0'));var path=require(_0x5344('0x1'));var express=require(_0x5344('0x2'));var ewinston=require(_0x5344('0x3'));var util=require(_0x5344('0x4'));var errors=require(_0x5344('0x5'));var config=require(_0x5344('0x6'));var logger=require('./config/logger')('api');var authLogger=require(_0x5344('0x7'))(_0x5344('0x8'));var safeTemplate=require(_0x5344('0x9'))[_0x5344('0xa')];exports['default']=function(_0x4ffe5f){_0x4ffe5f['use'](ewinston['logger']({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x3f638c,_0x4adb8a){var _0x5ee298=_0x5344('0xb');if(!_[_0x5344('0xc')](_0x3f638c[_0x5344('0xd')])){_0x5ee298+='\x20body=%s';var _0x10546c=_0x3f638c[_0x5344('0xd')];maskSensitiveData(_0x10546c);}return safeTemplate(util[_0x5344('0xe')](_0x5ee298,_0x3f638c[_0x5344('0xf')],_0x3f638c[_0x5344('0x10')][_0x5344('0x11')]?_0x3f638c['headers'][_0x5344('0x11')]:_0x3f638c[_0x5344('0x12')]['remoteAddress']||_0x3f638c['ip'],_0x3f638c[_0x5344('0x13')],_0x4adb8a['statusCode'],_0x4adb8a[_0x5344('0x14')],_0x3f638c['user']?_0x3f638c['user']['id']:null,_0x3f638c['user']?_0x3f638c[_0x5344('0x15')][_0x5344('0x16')]:null,_0x3f638c[_0x5344('0x15')]?_0x3f638c[_0x5344('0x15')][_0x5344('0x17')]:null,_0x10546c?util[_0x5344('0x18')](_0x10546c,![],null):''));}}));_0x4ffe5f[_0x5344('0x19')](ewinston[_0x5344('0x1a')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x41906d,_0x405630){var _0x4ae241=_0x5344('0x1b');if(_0x41906d[_0x5344('0xd')]&&_0x41906d[_0x5344('0xd')][_0x5344('0x1c')]&&_0x41906d['body']['agent_id']){_0x4ae241='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0x5344('0xe')](_0x4ae241,_0x41906d['method'],_0x41906d['headers']['x-forwarded-for']?_0x41906d['headers'][_0x5344('0x11')]:_0x41906d[_0x5344('0x12')][_0x5344('0x1d')]||_0x41906d['ip'],_0x41906d[_0x5344('0x13')],_0x405630[_0x5344('0x1e')],_0x405630[_0x5344('0x14')],_0x41906d[_0x5344('0x15')]?_0x41906d[_0x5344('0x15')]['id']:null,_0x41906d[_0x5344('0x15')]?_0x41906d[_0x5344('0x15')]['name']:null,_0x41906d['user']?_0x41906d[_0x5344('0x15')][_0x5344('0x17')]:null,_0x41906d[_0x5344('0xd')]&&_0x41906d[_0x5344('0xd')][_0x5344('0x1c')]?_0x41906d['body'][_0x5344('0x1c')]:_0x5344('0x1f'),_0x41906d[_0x5344('0xd')]&&_0x41906d[_0x5344('0xd')]['agent_id']?_0x41906d[_0x5344('0xd')][_0x5344('0x20')]:'',_0x41906d[_0x5344('0xd')]&&_0x41906d[_0x5344('0xd')]['agent_name']?_0x41906d['body'][_0x5344('0x21')]:'');},'ignoreRoute':function(_0x30f6f8){var _0x3471a9=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x3471a9[_0x5344('0x22')](_0x30f6f8['url']);}}));_0x4ffe5f[_0x5344('0x19')](_0x5344('0x23'),require(_0x5344('0x24')));_0x4ffe5f[_0x5344('0x19')](_0x5344('0x25'),require(_0x5344('0x26')));_0x4ffe5f[_0x5344('0x19')]('/api/voice/contexts',require(_0x5344('0x27')));_0x4ffe5f['use'](_0x5344('0x28'),require(_0x5344('0x29')));_0x4ffe5f[_0x5344('0x19')](_0x5344('0x2a'),require(_0x5344('0x2b')));_0x4ffe5f[_0x5344('0x19')](_0x5344('0x2c'),require(_0x5344('0x2d')));_0x4ffe5f[_0x5344('0x19')]('/api/voice/recordings',require(_0x5344('0x2e')));_0x4ffe5f[_0x5344('0x19')](_0x5344('0x2f'),require(_0x5344('0x30')));_0x4ffe5f['use'](_0x5344('0x31'),require(_0x5344('0x32')));_0x4ffe5f['use'](_0x5344('0x33'),require(_0x5344('0x34')));_0x4ffe5f['use'](_0x5344('0x35'),require(_0x5344('0x36')));_0x4ffe5f['use'](_0x5344('0x37'),require(_0x5344('0x38')));_0x4ffe5f['use'](_0x5344('0x39'),require(_0x5344('0x3a')));_0x4ffe5f[_0x5344('0x19')](_0x5344('0x3b'),require(_0x5344('0x3c')));_0x4ffe5f['use']('/api/members/reports',require(_0x5344('0x3d')));_0x4ffe5f['use']('/api/trunks',require('./api/trunk'));_0x4ffe5f[_0x5344('0x19')](_0x5344('0x3e'),require(_0x5344('0x3f')));_0x4ffe5f['use'](_0x5344('0x40'),require('./api/mailServerOut'));_0x4ffe5f['use']('/api/mail/accounts',require(_0x5344('0x41')));_0x4ffe5f[_0x5344('0x19')](_0x5344('0x42'),require(_0x5344('0x43')));_0x4ffe5f[_0x5344('0x19')]('/api/mail/substatuses',require(_0x5344('0x44')));_0x4ffe5f[_0x5344('0x19')](_0x5344('0x45'),require(_0x5344('0x46')));_0x4ffe5f['use'](_0x5344('0x47'),require(_0x5344('0x48')));_0x4ffe5f[_0x5344('0x19')](_0x5344('0x49'),require(_0x5344('0x4a')));_0x4ffe5f[_0x5344('0x19')](_0x5344('0x4b'),require(_0x5344('0x4c')));_0x4ffe5f['use'](_0x5344('0x4d'),require(_0x5344('0x4e')));_0x4ffe5f[_0x5344('0x19')](_0x5344('0x4f'),require('./api/dashboardItem'));_0x4ffe5f[_0x5344('0x19')](_0x5344('0x50'),require('./api/faxAccount'));_0x4ffe5f[_0x5344('0x19')](_0x5344('0x51'),require('./api/faxApplication'));_0x4ffe5f[_0x5344('0x19')](_0x5344('0x52'),require('./api/faxInteraction'));_0x4ffe5f[_0x5344('0x19')](_0x5344('0x53'),require(_0x5344('0x54')));_0x4ffe5f[_0x5344('0x19')](_0x5344('0x55'),require(_0x5344('0x56')));_0x4ffe5f[_0x5344('0x19')](_0x5344('0x57'),require('./api/faxQueueReport'));_0x4ffe5f[_0x5344('0x19')]('/api/sms/accounts',require(_0x5344('0x58')));_0x4ffe5f['use']('/api/sms/applications',require(_0x5344('0x59')));_0x4ffe5f['use']('/api/sms/interactions',require(_0x5344('0x5a')));_0x4ffe5f[_0x5344('0x19')]('/api/sms/messages',require('./api/smsMessage'));_0x4ffe5f[_0x5344('0x19')](_0x5344('0x5b'),require(_0x5344('0x5c')));_0x4ffe5f[_0x5344('0x19')]('/api/openchannel/accounts',require(_0x5344('0x5d')));_0x4ffe5f['use'](_0x5344('0x5e'),require(_0x5344('0x5f')));_0x4ffe5f[_0x5344('0x19')](_0x5344('0x60'),require(_0x5344('0x61')));_0x4ffe5f['use'](_0x5344('0x62'),require('./api/openchannelMessage'));_0x4ffe5f[_0x5344('0x19')](_0x5344('0x63'),require('./api/openchannelQueue'));_0x4ffe5f[_0x5344('0x19')](_0x5344('0x64'),require(_0x5344('0x65')));_0x4ffe5f[_0x5344('0x19')]('/api/openchannel/reports/queue',require(_0x5344('0x66')));_0x4ffe5f[_0x5344('0x19')](_0x5344('0x67'),require(_0x5344('0x68')));_0x4ffe5f[_0x5344('0x19')]('/api/chat/interactions',require(_0x5344('0x69')));_0x4ffe5f[_0x5344('0x19')]('/api/chat/messages',require(_0x5344('0x6a')));_0x4ffe5f['use'](_0x5344('0x6b'),require(_0x5344('0x6c')));_0x4ffe5f[_0x5344('0x19')](_0x5344('0x6d'),require(_0x5344('0x6e')));_0x4ffe5f[_0x5344('0x19')](_0x5344('0x6f'),require('./api/chatGroup'));_0x4ffe5f[_0x5344('0x19')](_0x5344('0x70'),require(_0x5344('0x71')));_0x4ffe5f[_0x5344('0x19')]('/api/cm/companies',require(_0x5344('0x72')));_0x4ffe5f[_0x5344('0x19')](_0x5344('0x73'),require('./api/cmContact'));_0x4ffe5f[_0x5344('0x19')](_0x5344('0x74'),require(_0x5344('0x75')));_0x4ffe5f['use']('/api/cm/hopper_black',require(_0x5344('0x76')));_0x4ffe5f[_0x5344('0x19')](_0x5344('0x77'),require('./api/cmHopperFinal'));_0x4ffe5f[_0x5344('0x19')](_0x5344('0x78'),require(_0x5344('0x79')));_0x4ffe5f[_0x5344('0x19')](_0x5344('0x7a'),require(_0x5344('0x7b')));_0x4ffe5f['use'](_0x5344('0x7c'),require(_0x5344('0x7d')));_0x4ffe5f[_0x5344('0x19')](_0x5344('0x7e'),require(_0x5344('0x7f')));_0x4ffe5f[_0x5344('0x19')](_0x5344('0x80'),require(_0x5344('0x81')));_0x4ffe5f['use']('/api/dispositions',require(_0x5344('0x82')));_0x4ffe5f[_0x5344('0x19')](_0x5344('0x83'),require('./api/condition'));_0x4ffe5f[_0x5344('0x19')](_0x5344('0x84'),require('./api/interval'));_0x4ffe5f[_0x5344('0x19')](_0x5344('0x85'),require(_0x5344('0x86')));_0x4ffe5f['use']('/api/cdr',require(_0x5344('0x87')));_0x4ffe5f['use']('/api/voiceQueuesLog',require(_0x5344('0x88')));_0x4ffe5f[_0x5344('0x19')](_0x5344('0x89'),require(_0x5344('0x8a')));_0x4ffe5f[_0x5344('0x19')](_0x5344('0x8b'),require('./api/sound'));_0x4ffe5f[_0x5344('0x19')](_0x5344('0x8c'),require('./api/tag'));_0x4ffe5f[_0x5344('0x19')](_0x5344('0x8d'),require(_0x5344('0x8e')));_0x4ffe5f[_0x5344('0x19')](_0x5344('0x8f'),require('./api/trigger'));_0x4ffe5f[_0x5344('0x19')](_0x5344('0x90'),require(_0x5344('0x91')));_0x4ffe5f[_0x5344('0x19')](_0x5344('0x92'),require(_0x5344('0x93')));_0x4ffe5f[_0x5344('0x19')]('/api/integrations/reports',require(_0x5344('0x94')));_0x4ffe5f[_0x5344('0x19')](_0x5344('0x95'),require(_0x5344('0x96')));_0x4ffe5f['use'](_0x5344('0x97'),require(_0x5344('0x98')));_0x4ffe5f[_0x5344('0x19')](_0x5344('0x99'),require(_0x5344('0x9a')));_0x4ffe5f['use'](_0x5344('0x9b'),require(_0x5344('0x9c')));_0x4ffe5f[_0x5344('0x19')]('/api/analytics/field_reports',require(_0x5344('0x9d')));_0x4ffe5f[_0x5344('0x19')](_0x5344('0x9e'),require(_0x5344('0x9f')));_0x4ffe5f[_0x5344('0x19')](_0x5344('0xa0'),require(_0x5344('0xa1')));_0x4ffe5f[_0x5344('0x19')]('/api/integrations/salesforce/configurations',require('./api/intSalesforceConfiguration'));_0x4ffe5f[_0x5344('0x19')](_0x5344('0xa2'),require('./api/intSalesforceField'));_0x4ffe5f[_0x5344('0x19')]('/api/integrations/sugarcrm/accounts',require(_0x5344('0xa3')));_0x4ffe5f[_0x5344('0x19')]('/api/integrations/sugarcrm/configurations',require(_0x5344('0xa4')));_0x4ffe5f[_0x5344('0x19')](_0x5344('0xa5'),require('./api/intSugarcrmField'));_0x4ffe5f['use'](_0x5344('0xa6'),require(_0x5344('0xa7')));_0x4ffe5f[_0x5344('0x19')](_0x5344('0xa8'),require('./api/intDeskConfiguration'));_0x4ffe5f[_0x5344('0x19')]('/api/integrations/desk/fields',require(_0x5344('0xa9')));_0x4ffe5f[_0x5344('0x19')](_0x5344('0xaa'),require(_0x5344('0xab')));_0x4ffe5f[_0x5344('0x19')]('/api/integrations/zoho/configurations',require(_0x5344('0xac')));_0x4ffe5f['use'](_0x5344('0xad'),require(_0x5344('0xae')));_0x4ffe5f[_0x5344('0x19')]('/api/integrations/zendesk/accounts',require(_0x5344('0xaf')));_0x4ffe5f[_0x5344('0x19')](_0x5344('0xb0'),require(_0x5344('0xb1')));_0x4ffe5f[_0x5344('0x19')]('/api/integrations/zendesk/fields',require(_0x5344('0xb2')));_0x4ffe5f[_0x5344('0x19')]('/api/integrations/freshdesk/accounts',require(_0x5344('0xb3')));_0x4ffe5f['use'](_0x5344('0xb4'),require('./api/intFreshdeskConfiguration'));_0x4ffe5f[_0x5344('0x19')](_0x5344('0xb5'),require('./api/intFreshdeskField'));_0x4ffe5f[_0x5344('0x19')](_0x5344('0xb6'),require('./api/intVtigerAccount'));_0x4ffe5f[_0x5344('0x19')](_0x5344('0xb7'),require(_0x5344('0xb8')));_0x4ffe5f[_0x5344('0x19')](_0x5344('0xb9'),require(_0x5344('0xba')));_0x4ffe5f[_0x5344('0x19')](_0x5344('0xbb'),require(_0x5344('0xbc')));_0x4ffe5f[_0x5344('0x19')](_0x5344('0xbd'),require(_0x5344('0xbe')));_0x4ffe5f['use'](_0x5344('0xbf'),require(_0x5344('0xc0')));_0x4ffe5f[_0x5344('0x19')](_0x5344('0xc1'),require(_0x5344('0xc2')));_0x4ffe5f[_0x5344('0x19')](_0x5344('0xc3'),require('./api/intDynamics365Configuration'));_0x4ffe5f[_0x5344('0x19')]('/api/integrations/dynamics365/fields',require('./api/intDynamics365Field'));_0x4ffe5f['use'](_0x5344('0xc4'),require('./api/intFreshsalesAccount'));_0x4ffe5f['use'](_0x5344('0xc5'),require(_0x5344('0xc6')));_0x4ffe5f[_0x5344('0x19')]('/api/integrations/freshsales/fields',require(_0x5344('0xc7')));_0x4ffe5f[_0x5344('0x19')](_0x5344('0xc8'),require(_0x5344('0xc9')));_0x4ffe5f['use']('/api/chat/reports/queue',require('./api/chatQueueReport'));_0x4ffe5f[_0x5344('0x19')]('/api/chat/internal/messages',require(_0x5344('0xca')));_0x4ffe5f[_0x5344('0x19')](_0x5344('0xcb'),require(_0x5344('0xcc')));_0x4ffe5f[_0x5344('0x19')](_0x5344('0xcd'),require(_0x5344('0xce')));_0x4ffe5f[_0x5344('0x19')](_0x5344('0xcf'),require('./api/jscriptySessionReport'));_0x4ffe5f['use'](_0x5344('0xd0'),require(_0x5344('0xd1')));_0x4ffe5f[_0x5344('0x19')](_0x5344('0xd2'),require(_0x5344('0xd3')));_0x4ffe5f['use']('/api/square/details/reports',require(_0x5344('0xd4')));_0x4ffe5f[_0x5344('0x19')]('/api/jscripty/projects',require('./api/jscriptyProject'));_0x4ffe5f['use'](_0x5344('0xd5'),require(_0x5344('0xd6')));_0x4ffe5f[_0x5344('0x19')]('/api/square/odbc',require(_0x5344('0xd7')));_0x4ffe5f['use'](_0x5344('0xd8'),require(_0x5344('0xd9')));_0x4ffe5f[_0x5344('0x19')](_0x5344('0xda'),require('./api/squareRecording'));_0x4ffe5f[_0x5344('0x19')]('/api/square/messages',require(_0x5344('0xdb')));_0x4ffe5f[_0x5344('0x19')](_0x5344('0xdc'),require(_0x5344('0xdd')));_0x4ffe5f['use'](_0x5344('0xde'),require(_0x5344('0xdf')));_0x4ffe5f[_0x5344('0x19')](_0x5344('0xe0'),require(_0x5344('0xe1')));_0x4ffe5f['use'](_0x5344('0xe2'),require(_0x5344('0xe3')));_0x4ffe5f[_0x5344('0x19')](_0x5344('0xe4'),require(_0x5344('0xe5')));_0x4ffe5f[_0x5344('0x19')](_0x5344('0xe6'),require('./api/plugin'));_0x4ffe5f[_0x5344('0x19')](_0x5344('0xe7'),require(_0x5344('0xe8')));_0x4ffe5f[_0x5344('0x19')](_0x5344('0xe9'),require(_0x5344('0xea')));_0x4ffe5f[_0x5344('0x19')](_0x5344('0xeb'),require('./api/faxTransferReport'));_0x4ffe5f['use']('/api/openchannel/reports/transfer',require(_0x5344('0xec')));_0x4ffe5f[_0x5344('0x19')](_0x5344('0xed'),require(_0x5344('0xee')));_0x4ffe5f['use'](_0x5344('0xef'),require(_0x5344('0xf0')));_0x4ffe5f[_0x5344('0x19')]('/api/voice/prefixes',require(_0x5344('0xf1')));_0x4ffe5f[_0x5344('0x19')](_0x5344('0xf2'),require('./api/userProfile'));_0x4ffe5f[_0x5344('0x19')](_0x5344('0xf3'),require(_0x5344('0xf4')));_0x4ffe5f['use']('/api/userProfile/resources',require(_0x5344('0xf5')));_0x4ffe5f[_0x5344('0x19')]('/api/userNotifications',require(_0x5344('0xf6')));_0x4ffe5f[_0x5344('0x19')](_0x5344('0xf7'),require(_0x5344('0xf8')));_0x4ffe5f[_0x5344('0x19')](_0x5344('0xf9'),require(_0x5344('0xfa')));_0x4ffe5f['use'](_0x5344('0xfb'),require(_0x5344('0xfc')));_0x4ffe5f['use'](_0x5344('0xfd'),require(_0x5344('0xfe')));_0x4ffe5f['use'](_0x5344('0xff'),require(_0x5344('0x100')));_0x4ffe5f[_0x5344('0x19')](_0x5344('0x101'),require(_0x5344('0x102')));_0x4ffe5f[_0x5344('0x19')]('/api/whatsapp/queues',require(_0x5344('0x103')));_0x4ffe5f[_0x5344('0x19')](_0x5344('0x104'),require(_0x5344('0x105')));_0x4ffe5f['use']('/api/realtime',require('./api/realtime'));_0x4ffe5f[_0x5344('0x19')](_0x5344('0x106'),require(_0x5344('0x107')));_0x4ffe5f[_0x5344('0x19')](_0x5344('0x108'),require(_0x5344('0x109')));_0x4ffe5f[_0x5344('0x19')](_0x5344('0x10a'),require('./api/authActiveDirectory'));_0x4ffe5f[_0x5344('0x19')](_0x5344('0x10b'),require(_0x5344('0x10c')));_0x4ffe5f[_0x5344('0x19')](_0x5344('0x10d'),require(_0x5344('0x10e')));_0x4ffe5f[_0x5344('0x19')](_0x5344('0x10f'),require(_0x5344('0x110')));_0x4ffe5f[_0x5344('0x19')](_0x5344('0x111'),require(_0x5344('0x112')));_0x4ffe5f[_0x5344('0x19')]('/api/pm2',require(_0x5344('0x113')));_0x4ffe5f['use'](_0x5344('0x114'),require(_0x5344('0x115')));_0x4ffe5f[_0x5344('0x19')](_0x5344('0x116'),express[_0x5344('0x117')](path[_0x5344('0x118')](config[_0x5344('0x119')],_0x5344('0x116'))));_0x4ffe5f[_0x5344('0x19')]('/www',express['static'](path[_0x5344('0x118')](config[_0x5344('0x119')],_0x5344('0x11a'))));_0x4ffe5f[_0x5344('0x19')](_0x5344('0x11b'),express['static'](path[_0x5344('0x118')](config[_0x5344('0x119')],'/demo')));_0x4ffe5f[_0x5344('0x19')](_0x5344('0x11c'),express[_0x5344('0x117')](path[_0x5344('0x118')](config['root'],_0x5344('0x11d'),_0x5344('0x11e'))));_0x4ffe5f[_0x5344('0x19')](_0x5344('0x11f'),express[_0x5344('0x117')](path[_0x5344('0x118')](config[_0x5344('0x119')],'/server/files/plugins')));_0x4ffe5f[_0x5344('0x120')]('/:url(api|auth|components|app|bower_components|assets)/*')[_0x5344('0x121')](errors[0x194]);_0x4ffe5f[_0x5344('0x120')]('/*')['get'](function(_0x356301,_0x2c03b6){_0x2c03b6[_0x5344('0x122')](path[_0x5344('0x123')](_0x4ffe5f[_0x5344('0x121')]('appPath')+_0x5344('0x124')));});};var sensitiveFields=[_0x5344('0x125'),_0x5344('0x126'),_0x5344('0x127'),'apiKey',_0x5344('0x128'),_0x5344('0x129'),'street',_0x5344('0x12a'),_0x5344('0x12b'),_0x5344('0x12c'),_0x5344('0x12d'),_0x5344('0x12e'),_0x5344('0x12f'),_0x5344('0x130'),_0x5344('0x131'),_0x5344('0x132'),_0x5344('0x133'),_0x5344('0x134'),_0x5344('0x135'),_0x5344('0x136'),'accessTokenSecret',_0x5344('0x137'),'consumerKey',_0x5344('0x138'),_0x5344('0x139'),_0x5344('0x13a'),_0x5344('0x13b'),_0x5344('0x13c'),_0x5344('0x13d'),_0x5344('0x13e'),'privateKey',_0x5344('0x13f'),_0x5344('0x140'),'key','user',_0x5344('0x141'),_0x5344('0x142'),_0x5344('0x143'),_0x5344('0x144'),'secret',_0x5344('0x145'),_0x5344('0x146')];function maskSensitiveData(_0x514e98){var _0x392805=/(?!^)[\s\S](?!$)/g;if(!_[_0x5344('0x147')](_0x514e98))return;for(var _0x399a6e in _0x514e98){if(_['isArray'](_0x514e98[_0x399a6e])){for(var _0x3c2352=0x0;_0x3c2352<_0x514e98[_0x399a6e][_0x5344('0x148')];_0x3c2352++){maskSensitiveData(_0x514e98[_0x399a6e][_0x3c2352]);}}else if(_[_0x5344('0x147')](_0x514e98[_0x399a6e])){maskSensitiveData(_0x514e98[_0x399a6e]);}else if(_[_0x5344('0x149')](_0x514e98[_0x399a6e])){_0x514e98[_0x399a6e]=_0x514e98[_0x399a6e][_0x5344('0x14a')](/{{{/g,_0x5344('0x14b'))[_0x5344('0x14a')](/}}}/g,_0x5344('0x14c'))[_0x5344('0x14a')](/{{/g,'@{')[_0x5344('0x14a')](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x399a6e)){_0x514e98[_0x399a6e]=_0x514e98[_0x399a6e][_0x5344('0x14a')](_0x392805,'*');}}}} \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 763fae7..45eb750 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfc10=['../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','localhost','error','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','bluebird','lodash','../config/environment','listen','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/trunk/trunk.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailMessage/mailMessage.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc'];(function(_0x3afe18,_0x26922c){var _0x19ed1f=function(_0x1c0660){while(--_0x1c0660){_0x3afe18['push'](_0x3afe18['shift']());}};_0x19ed1f(++_0x26922c);}(_0xfc10,0x180));var _0x0fc1=function(_0x214cd1,_0x49a18e){_0x214cd1=_0x214cd1-0x0;var _0x364810=_0xfc10[_0x214cd1];return _0x364810;};'use strict';var jayson=require(_0x0fc1('0x0'));var BPromise=require(_0x0fc1('0x1'));var _=require(_0x0fc1('0x2'));var config=require(_0x0fc1('0x3'));exports[_0x0fc1('0x4')]=function(){return new BPromise(function(_0x14bab4,_0x4f7a3f){var _0x1cfdb2={};_0x1cfdb2=_[_0x0fc1('0x5')](_0x1cfdb2,require('../api/user/user.rpc'));_0x1cfdb2=_['merge'](_0x1cfdb2,require(_0x0fc1('0x6')));_0x1cfdb2=_['merge'](_0x1cfdb2,require('../api/voiceQueue/voiceQueue.rpc'));_0x1cfdb2=_[_0x0fc1('0x5')](_0x1cfdb2,require(_0x0fc1('0x7')));_0x1cfdb2=_[_0x0fc1('0x5')](_0x1cfdb2,require(_0x0fc1('0x8')));_0x1cfdb2=_[_0x0fc1('0x5')](_0x1cfdb2,require(_0x0fc1('0x9')));_0x1cfdb2=_[_0x0fc1('0x5')](_0x1cfdb2,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x1cfdb2=_[_0x0fc1('0x5')](_0x1cfdb2,require(_0x0fc1('0xa')));_0x1cfdb2=_['merge'](_0x1cfdb2,require('../api/memberReport/memberReport.rpc'));_0x1cfdb2=_['merge'](_0x1cfdb2,require(_0x0fc1('0xb')));_0x1cfdb2=_[_0x0fc1('0x5')](_0x1cfdb2,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x1cfdb2=_[_0x0fc1('0x5')](_0x1cfdb2,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x1cfdb2=_['merge'](_0x1cfdb2,require(_0x0fc1('0xc')));_0x1cfdb2=_['merge'](_0x1cfdb2,require(_0x0fc1('0xd')));_0x1cfdb2=_[_0x0fc1('0x5')](_0x1cfdb2,require(_0x0fc1('0xe')));_0x1cfdb2=_[_0x0fc1('0x5')](_0x1cfdb2,require('../api/mailInteraction/mailInteraction.rpc'));_0x1cfdb2=_[_0x0fc1('0x5')](_0x1cfdb2,require(_0x0fc1('0xf')));_0x1cfdb2=_[_0x0fc1('0x5')](_0x1cfdb2,require('../api/mailApplication/mailApplication.rpc'));_0x1cfdb2=_[_0x0fc1('0x5')](_0x1cfdb2,require(_0x0fc1('0x10')));_0x1cfdb2=_[_0x0fc1('0x5')](_0x1cfdb2,require(_0x0fc1('0x11')));_0x1cfdb2=_[_0x0fc1('0x5')](_0x1cfdb2,require(_0x0fc1('0x12')));_0x1cfdb2=_['merge'](_0x1cfdb2,require(_0x0fc1('0x13')));_0x1cfdb2=_[_0x0fc1('0x5')](_0x1cfdb2,require(_0x0fc1('0x14')));_0x1cfdb2=_[_0x0fc1('0x5')](_0x1cfdb2,require('../api/faxQueue/faxQueue.rpc'));_0x1cfdb2=_[_0x0fc1('0x5')](_0x1cfdb2,require(_0x0fc1('0x15')));_0x1cfdb2=_[_0x0fc1('0x5')](_0x1cfdb2,require(_0x0fc1('0x16')));_0x1cfdb2=_[_0x0fc1('0x5')](_0x1cfdb2,require(_0x0fc1('0x17')));_0x1cfdb2=_[_0x0fc1('0x5')](_0x1cfdb2,require(_0x0fc1('0x18')));_0x1cfdb2=_[_0x0fc1('0x5')](_0x1cfdb2,require('../api/smsQueue/smsQueue.rpc'));_0x1cfdb2=_['merge'](_0x1cfdb2,require(_0x0fc1('0x19')));_0x1cfdb2=_[_0x0fc1('0x5')](_0x1cfdb2,require(_0x0fc1('0x1a')));_0x1cfdb2=_[_0x0fc1('0x5')](_0x1cfdb2,require(_0x0fc1('0x1b')));_0x1cfdb2=_[_0x0fc1('0x5')](_0x1cfdb2,require(_0x0fc1('0x1c')));_0x1cfdb2=_[_0x0fc1('0x5')](_0x1cfdb2,require(_0x0fc1('0x1d')));_0x1cfdb2=_['merge'](_0x1cfdb2,require(_0x0fc1('0x1e')));_0x1cfdb2=_[_0x0fc1('0x5')](_0x1cfdb2,require(_0x0fc1('0x1f')));_0x1cfdb2=_[_0x0fc1('0x5')](_0x1cfdb2,require(_0x0fc1('0x20')));_0x1cfdb2=_['merge'](_0x1cfdb2,require(_0x0fc1('0x21')));_0x1cfdb2=_[_0x0fc1('0x5')](_0x1cfdb2,require('../api/cmHopper/cmHopper.rpc'));_0x1cfdb2=_[_0x0fc1('0x5')](_0x1cfdb2,require(_0x0fc1('0x22')));_0x1cfdb2=_['merge'](_0x1cfdb2,require(_0x0fc1('0x23')));_0x1cfdb2=_[_0x0fc1('0x5')](_0x1cfdb2,require(_0x0fc1('0x24')));_0x1cfdb2=_[_0x0fc1('0x5')](_0x1cfdb2,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x1cfdb2=_['merge'](_0x1cfdb2,require(_0x0fc1('0x25')));_0x1cfdb2=_['merge'](_0x1cfdb2,require(_0x0fc1('0x26')));_0x1cfdb2=_[_0x0fc1('0x5')](_0x1cfdb2,require(_0x0fc1('0x27')));_0x1cfdb2=_['merge'](_0x1cfdb2,require(_0x0fc1('0x28')));_0x1cfdb2=_[_0x0fc1('0x5')](_0x1cfdb2,require(_0x0fc1('0x29')));_0x1cfdb2=_[_0x0fc1('0x5')](_0x1cfdb2,require(_0x0fc1('0x2a')));_0x1cfdb2=_[_0x0fc1('0x5')](_0x1cfdb2,require(_0x0fc1('0x2b')));_0x1cfdb2=_[_0x0fc1('0x5')](_0x1cfdb2,require(_0x0fc1('0x2c')));_0x1cfdb2=_[_0x0fc1('0x5')](_0x1cfdb2,require(_0x0fc1('0x2d')));_0x1cfdb2=_['merge'](_0x1cfdb2,require(_0x0fc1('0x2e')));_0x1cfdb2=_[_0x0fc1('0x5')](_0x1cfdb2,require(_0x0fc1('0x2f')));_0x1cfdb2=_['merge'](_0x1cfdb2,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x1cfdb2=_[_0x0fc1('0x5')](_0x1cfdb2,require(_0x0fc1('0x30')));_0x1cfdb2=_['merge'](_0x1cfdb2,require(_0x0fc1('0x31')));_0x1cfdb2=_['merge'](_0x1cfdb2,require(_0x0fc1('0x32')));_0x1cfdb2=_['merge'](_0x1cfdb2,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x1cfdb2=_['merge'](_0x1cfdb2,require(_0x0fc1('0x33')));_0x1cfdb2=_[_0x0fc1('0x5')](_0x1cfdb2,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x1cfdb2=_[_0x0fc1('0x5')](_0x1cfdb2,require(_0x0fc1('0x34')));_0x1cfdb2=_[_0x0fc1('0x5')](_0x1cfdb2,require(_0x0fc1('0x35')));_0x1cfdb2=_['merge'](_0x1cfdb2,require(_0x0fc1('0x36')));_0x1cfdb2=_[_0x0fc1('0x5')](_0x1cfdb2,require(_0x0fc1('0x37')));_0x1cfdb2=_['merge'](_0x1cfdb2,require(_0x0fc1('0x38')));_0x1cfdb2=_[_0x0fc1('0x5')](_0x1cfdb2,require('../api/squareRecording/squareRecording.rpc'));_0x1cfdb2=_[_0x0fc1('0x5')](_0x1cfdb2,require(_0x0fc1('0x39')));_0x1cfdb2=_[_0x0fc1('0x5')](_0x1cfdb2,require(_0x0fc1('0x3a')));_0x1cfdb2=_[_0x0fc1('0x5')](_0x1cfdb2,require('../api/attachment/attachment.rpc'));_0x1cfdb2=_[_0x0fc1('0x5')](_0x1cfdb2,require('../api/plugin/plugin.rpc'));_0x1cfdb2=_[_0x0fc1('0x5')](_0x1cfdb2,require('../api/whatsappAccount/whatsappAccount.rpc'));_0x1cfdb2=_[_0x0fc1('0x5')](_0x1cfdb2,require(_0x0fc1('0x3b')));_0x1cfdb2=_[_0x0fc1('0x5')](_0x1cfdb2,require(_0x0fc1('0x3c')));_0x1cfdb2=_[_0x0fc1('0x5')](_0x1cfdb2,require(_0x0fc1('0x3d')));_0x1cfdb2=_[_0x0fc1('0x5')](_0x1cfdb2,require(_0x0fc1('0x3e')));var _0x4498fc=jayson[_0x0fc1('0x3f')](_0x1cfdb2)[_0x0fc1('0x40')]();var _0x53c0eb=config[_0x0fc1('0x41')][_0x0fc1('0x42')]||config[_0x0fc1('0x42')]+0x1;var _0x3efe47=config[_0x0fc1('0x41')]['ip']||_0x0fc1('0x43');_0x4498fc['on'](_0x0fc1('0x44'),function(_0x791370){return _0x4f7a3f(_0x791370);});_0x4498fc[_0x0fc1('0x4')](_0x53c0eb,_0x3efe47,function(){console['log']('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x3efe47,_0x53c0eb);require(_0x0fc1('0x45'))[_0x0fc1('0x46')]();return _0x14bab4(_0x0fc1('0x47')+_0x3efe47+':'+_0x53c0eb);});});}; \ No newline at end of file +var _0xed64=['../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','http','rpc','port','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','bluebird','lodash','../config/environment','listen','../api/user/user.rpc','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsMessage/smsMessage.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc'];(function(_0x5a9c0c,_0x4ec485){var _0x53c77d=function(_0x1cf384){while(--_0x1cf384){_0x5a9c0c['push'](_0x5a9c0c['shift']());}};_0x53c77d(++_0x4ec485);}(_0xed64,0x102));var _0x4ed6=function(_0x4855fa,_0x490cf3){_0x4855fa=_0x4855fa-0x0;var _0x4b7a91=_0xed64[_0x4855fa];return _0x4b7a91;};'use strict';var jayson=require(_0x4ed6('0x0'));var BPromise=require(_0x4ed6('0x1'));var _=require(_0x4ed6('0x2'));var config=require(_0x4ed6('0x3'));exports[_0x4ed6('0x4')]=function(){return new BPromise(function(_0x549c06,_0x3b2c53){var _0x1af58a={};_0x1af58a=_['merge'](_0x1af58a,require(_0x4ed6('0x5')));_0x1af58a=_[_0x4ed6('0x6')](_0x1af58a,require(_0x4ed6('0x7')));_0x1af58a=_[_0x4ed6('0x6')](_0x1af58a,require(_0x4ed6('0x8')));_0x1af58a=_['merge'](_0x1af58a,require(_0x4ed6('0x9')));_0x1af58a=_['merge'](_0x1af58a,require(_0x4ed6('0xa')));_0x1af58a=_[_0x4ed6('0x6')](_0x1af58a,require('../api/voiceDialReport/voiceDialReport.rpc'));_0x1af58a=_[_0x4ed6('0x6')](_0x1af58a,require(_0x4ed6('0xb')));_0x1af58a=_[_0x4ed6('0x6')](_0x1af58a,require(_0x4ed6('0xc')));_0x1af58a=_[_0x4ed6('0x6')](_0x1af58a,require(_0x4ed6('0xd')));_0x1af58a=_[_0x4ed6('0x6')](_0x1af58a,require('../api/trunk/trunk.rpc'));_0x1af58a=_['merge'](_0x1af58a,require(_0x4ed6('0xe')));_0x1af58a=_['merge'](_0x1af58a,require(_0x4ed6('0xf')));_0x1af58a=_[_0x4ed6('0x6')](_0x1af58a,require(_0x4ed6('0x10')));_0x1af58a=_[_0x4ed6('0x6')](_0x1af58a,require('../api/mailAccount/mailAccount.rpc'));_0x1af58a=_[_0x4ed6('0x6')](_0x1af58a,require(_0x4ed6('0x11')));_0x1af58a=_['merge'](_0x1af58a,require(_0x4ed6('0x12')));_0x1af58a=_['merge'](_0x1af58a,require(_0x4ed6('0x13')));_0x1af58a=_[_0x4ed6('0x6')](_0x1af58a,require(_0x4ed6('0x14')));_0x1af58a=_[_0x4ed6('0x6')](_0x1af58a,require(_0x4ed6('0x15')));_0x1af58a=_[_0x4ed6('0x6')](_0x1af58a,require(_0x4ed6('0x16')));_0x1af58a=_[_0x4ed6('0x6')](_0x1af58a,require(_0x4ed6('0x17')));_0x1af58a=_['merge'](_0x1af58a,require('../api/faxInteraction/faxInteraction.rpc'));_0x1af58a=_['merge'](_0x1af58a,require(_0x4ed6('0x18')));_0x1af58a=_[_0x4ed6('0x6')](_0x1af58a,require(_0x4ed6('0x19')));_0x1af58a=_['merge'](_0x1af58a,require(_0x4ed6('0x1a')));_0x1af58a=_['merge'](_0x1af58a,require('../api/smsAccount/smsAccount.rpc'));_0x1af58a=_[_0x4ed6('0x6')](_0x1af58a,require('../api/smsInteraction/smsInteraction.rpc'));_0x1af58a=_['merge'](_0x1af58a,require(_0x4ed6('0x1b')));_0x1af58a=_['merge'](_0x1af58a,require('../api/smsQueue/smsQueue.rpc'));_0x1af58a=_[_0x4ed6('0x6')](_0x1af58a,require(_0x4ed6('0x1c')));_0x1af58a=_['merge'](_0x1af58a,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x1af58a=_[_0x4ed6('0x6')](_0x1af58a,require(_0x4ed6('0x1d')));_0x1af58a=_[_0x4ed6('0x6')](_0x1af58a,require(_0x4ed6('0x1e')));_0x1af58a=_['merge'](_0x1af58a,require(_0x4ed6('0x1f')));_0x1af58a=_['merge'](_0x1af58a,require(_0x4ed6('0x20')));_0x1af58a=_[_0x4ed6('0x6')](_0x1af58a,require(_0x4ed6('0x21')));_0x1af58a=_['merge'](_0x1af58a,require(_0x4ed6('0x22')));_0x1af58a=_[_0x4ed6('0x6')](_0x1af58a,require('../api/cmContact/cmContact.rpc'));_0x1af58a=_[_0x4ed6('0x6')](_0x1af58a,require('../api/cmHopper/cmHopper.rpc'));_0x1af58a=_[_0x4ed6('0x6')](_0x1af58a,require(_0x4ed6('0x23')));_0x1af58a=_[_0x4ed6('0x6')](_0x1af58a,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x1af58a=_['merge'](_0x1af58a,require(_0x4ed6('0x24')));_0x1af58a=_[_0x4ed6('0x6')](_0x1af58a,require(_0x4ed6('0x25')));_0x1af58a=_[_0x4ed6('0x6')](_0x1af58a,require(_0x4ed6('0x26')));_0x1af58a=_['merge'](_0x1af58a,require(_0x4ed6('0x27')));_0x1af58a=_[_0x4ed6('0x6')](_0x1af58a,require(_0x4ed6('0x28')));_0x1af58a=_[_0x4ed6('0x6')](_0x1af58a,require('../api/template/template.rpc'));_0x1af58a=_[_0x4ed6('0x6')](_0x1af58a,require('../api/trigger/trigger.rpc'));_0x1af58a=_['merge'](_0x1af58a,require('../api/variable/variable.rpc'));_0x1af58a=_[_0x4ed6('0x6')](_0x1af58a,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x1af58a=_[_0x4ed6('0x6')](_0x1af58a,require(_0x4ed6('0x29')));_0x1af58a=_[_0x4ed6('0x6')](_0x1af58a,require(_0x4ed6('0x2a')));_0x1af58a=_['merge'](_0x1af58a,require(_0x4ed6('0x2b')));_0x1af58a=_[_0x4ed6('0x6')](_0x1af58a,require(_0x4ed6('0x2c')));_0x1af58a=_['merge'](_0x1af58a,require(_0x4ed6('0x2d')));_0x1af58a=_[_0x4ed6('0x6')](_0x1af58a,require(_0x4ed6('0x2e')));_0x1af58a=_['merge'](_0x1af58a,require(_0x4ed6('0x2f')));_0x1af58a=_[_0x4ed6('0x6')](_0x1af58a,require(_0x4ed6('0x30')));_0x1af58a=_['merge'](_0x1af58a,require(_0x4ed6('0x31')));_0x1af58a=_[_0x4ed6('0x6')](_0x1af58a,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x1af58a=_[_0x4ed6('0x6')](_0x1af58a,require(_0x4ed6('0x32')));_0x1af58a=_['merge'](_0x1af58a,require(_0x4ed6('0x33')));_0x1af58a=_['merge'](_0x1af58a,require(_0x4ed6('0x34')));_0x1af58a=_['merge'](_0x1af58a,require(_0x4ed6('0x35')));_0x1af58a=_[_0x4ed6('0x6')](_0x1af58a,require(_0x4ed6('0x36')));_0x1af58a=_[_0x4ed6('0x6')](_0x1af58a,require(_0x4ed6('0x37')));_0x1af58a=_[_0x4ed6('0x6')](_0x1af58a,require(_0x4ed6('0x38')));_0x1af58a=_[_0x4ed6('0x6')](_0x1af58a,require(_0x4ed6('0x39')));_0x1af58a=_[_0x4ed6('0x6')](_0x1af58a,require(_0x4ed6('0x3a')));_0x1af58a=_[_0x4ed6('0x6')](_0x1af58a,require(_0x4ed6('0x3b')));_0x1af58a=_[_0x4ed6('0x6')](_0x1af58a,require(_0x4ed6('0x3c')));_0x1af58a=_[_0x4ed6('0x6')](_0x1af58a,require(_0x4ed6('0x3d')));_0x1af58a=_[_0x4ed6('0x6')](_0x1af58a,require(_0x4ed6('0x3e')));_0x1af58a=_['merge'](_0x1af58a,require(_0x4ed6('0x3f')));_0x1af58a=_['merge'](_0x1af58a,require(_0x4ed6('0x40')));_0x1af58a=_[_0x4ed6('0x6')](_0x1af58a,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0xebf7c8=jayson['server'](_0x1af58a)[_0x4ed6('0x41')]();var _0x1b0857=config[_0x4ed6('0x42')][_0x4ed6('0x43')]||config[_0x4ed6('0x43')]+0x1;var _0x16c4e1=config[_0x4ed6('0x42')]['ip']||_0x4ed6('0x44');_0xebf7c8['on'](_0x4ed6('0x45'),function(_0x5b4983){return _0x3b2c53(_0x5b4983);});_0xebf7c8[_0x4ed6('0x4')](_0x1b0857,_0x16c4e1,function(){console[_0x4ed6('0x46')](_0x4ed6('0x47'),_0x16c4e1,_0x1b0857);require(_0x4ed6('0x48'))[_0x4ed6('0x49')]();return _0x549c06(_0x4ed6('0x4a')+_0x16c4e1+':'+_0x1b0857);});});}; \ No newline at end of file diff --git a/server/safe-template.js b/server/safe-template.js index 1eb417f..b6c7773 100644 --- a/server/safe-template.js +++ b/server/safe-template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x896e=['map','isPlainObject','reduce','exports','safeTemplate','lodash','{\x20{\x20','\x20}\x20}','string','replace','isArray'];(function(_0x2d55d5,_0x1742a3){var _0x14dd7d=function(_0x2b3d67){while(--_0x2b3d67){_0x2d55d5['push'](_0x2d55d5['shift']());}};_0x14dd7d(++_0x1742a3);}(_0x896e,0x1e9));var _0xe896=function(_0x43d2b6,_0x29f6d8){_0x43d2b6=_0x43d2b6-0x0;var _0x1f61a0=_0x896e[_0x43d2b6];return _0x1f61a0;};var _=require(_0xe896('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x1bab19){return _0x1bab19==='{{'?_0xe896('0x1'):_0xe896('0x2');}function safeTemplate(_0x36085e){var _0x26d296=_0x36085e;if(typeof _0x36085e===_0xe896('0x3')){_0x26d296=_0x36085e[_0xe896('0x4')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0xe896('0x5')](_0x36085e)){_0x26d296=_0x36085e[_0xe896('0x6')](function(_0x244f68){return safeTemplate(_0x244f68);});}else if(_[_0xe896('0x7')](_0x36085e)){_0x26d296=Object['keys'](_0x36085e)[_0xe896('0x8')](function(_0x7a0721,_0x3b902c){_0x7a0721[_0x3b902c]=safeTemplate(_0x36085e[_0x3b902c]);return _0x7a0721;},{});}return _0x26d296;}module[_0xe896('0x9')][_0xe896('0xa')]=safeTemplate; \ No newline at end of file +var _0x6cb4=['keys','exports','safeTemplate','lodash','{\x20{\x20','\x20}\x20}','string','replace','isArray'];(function(_0x493d44,_0x19c8cb){var _0xc60219=function(_0x347393){while(--_0x347393){_0x493d44['push'](_0x493d44['shift']());}};_0xc60219(++_0x19c8cb);}(_0x6cb4,0xff));var _0x46cb=function(_0x4848d2,_0x1b0245){_0x4848d2=_0x4848d2-0x0;var _0x458513=_0x6cb4[_0x4848d2];return _0x458513;};var _=require(_0x46cb('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x338f2b){return _0x338f2b==='{{'?_0x46cb('0x1'):_0x46cb('0x2');}function safeTemplate(_0x375bef){var _0x36add6=_0x375bef;if(typeof _0x375bef===_0x46cb('0x3')){_0x36add6=_0x375bef[_0x46cb('0x4')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x46cb('0x5')](_0x375bef)){_0x36add6=_0x375bef['map'](function(_0x1a3fe4){return safeTemplate(_0x1a3fe4);});}else if(_['isPlainObject'](_0x375bef)){_0x36add6=Object[_0x46cb('0x6')](_0x375bef)['reduce'](function(_0x11262d,_0x148d0f){_0x11262d[_0x148d0f]=safeTemplate(_0x375bef[_0x148d0f]);return _0x11262d;},{});}return _0x36add6;}module[_0x46cb('0x7')][_0x46cb('0x8')]=safeTemplate; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 15ea049..d0c746b 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 _0xec66=['join','setContext','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','extension','setExtension','noop','GOTO\x20%s\x20%s\x20%s','getVariable','recordFile','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','exec','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','exports','util','lodash','events','EventEmitter','./error','call','utf8','setTimeout','setEncoding','headers','ready','line','toLowerCase','hangup','emit','substring','520-Invalid','520\x20End\x20of\x20proper','function','no\x20code','replace','result=','indexOf','startsWith','split','length','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','pipe','command','write','inherits','prototype','sendRequest','sync','answer','beep','format','isArray','EXEC\x20%s\x20%s'];(function(_0xe0d814,_0x4e76f3){var _0x182a3c=function(_0x23af8e){while(--_0x23af8e){_0xe0d814['push'](_0xe0d814['shift']());}};_0x182a3c(++_0x4e76f3);}(_0xec66,0x103));var _0x6ec6=function(_0x3f6b1b,_0x58d3d6){_0x3f6b1b=_0x3f6b1b-0x0;var _0x4a3d2b=_0xec66[_0x3f6b1b];return _0x4a3d2b;};'use strict';var util=require(_0x6ec6('0x0'));var _=require(_0x6ec6('0x1'));var EventEmitter=require(_0x6ec6('0x2'))[_0x6ec6('0x3')];var AGIReply=require('./reply');var AGIError=require(_0x6ec6('0x4'));function AGIChannel(_0x1fe192){var _0x785a46=this,_0x58a0b5=new AGIReply(),_0x1222b9=![],_0x4cc593={};EventEmitter[_0x6ec6('0x5')](_0x785a46);_0x1fe192['setEncoding'](_0x6ec6('0x6'));_0x1fe192[_0x6ec6('0x7')](0x8*0x3c*0x3c*0x3e8);_0x58a0b5[_0x6ec6('0x8')](_0x6ec6('0x6'));_0x58a0b5['on'](_0x6ec6('0x9'),function(_0x524d02){for(var _0x486113 in _0x524d02){_0x785a46[_0x486113]=_0x524d02[_0x486113];}_0x785a46['emit'](_0x6ec6('0xa'));});_0x58a0b5['on'](_0x6ec6('0xb'),function(_0x1b7a70){if(_0x1b7a70[_0x6ec6('0xc')]()==_0x6ec6('0xd')){_0x785a46[_0x6ec6('0xe')](_0x6ec6('0xd'));return;}if(_0x1b7a70[_0x6ec6('0xf')](0x0,0xb)==_0x6ec6('0x10')){_0x1222b9=!![];}if(_0x1222b9){_0x4cc593['rx']+=_0x1b7a70+'\x0a';if(_0x1b7a70['search'](_0x6ec6('0x11'))!=-0x1){_0x1222b9=![];}}else{_0x4cc593['rx']=_0x1b7a70;}if(_0x1222b9){return;}if(typeof _0x4cc593['cb']==_0x6ec6('0x12')){var _0x45726b=_0x4cc593['rx'][_0x6ec6('0xf')](0x0,0x3),_0x3ae057=null,_0x233b6c=null;_0x45726b=parseInt(_0x45726b);if(isNaN(_0x45726b)){_0x4cc593['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x6ec6('0x13')});return;}if(_0x45726b!=0xc8){_0x4cc593['cb'](null,{'code':_0x45726b,'result':-0x1,'extra':'KO'});return;}_0x3ae057=_0x4cc593['rx'][_0x6ec6('0xf')](0x4)[_0x6ec6('0x14')](_0x6ec6('0x15'),'');if(_0x3ae057['indexOf']('\x20')!=-0x1){_0x3ae057=_0x3ae057['substr'](0x0,_0x3ae057[_0x6ec6('0x16')]('\x20'));}if(_[_0x6ec6('0x17')](_0x3ae057,'-1')){_0x3ae057=parseInt(_0x3ae057);}_0x233b6c=_0x4cc593['rx'][_0x6ec6('0x18')]('\x20');if(_0x233b6c[_0x6ec6('0x19')]==0x3){_0x233b6c=_0x233b6c[0x2][_0x6ec6('0xf')](0x1,_0x233b6c[0x2][_0x6ec6('0x19')]-0x1);}else if(_0x233b6c['length']>0x3){var _0x12ad2f=/\((.+)\)/;var _0x15962f=_0x4cc593['rx']['match'](_0x12ad2f);if(_0x15962f){_0x233b6c=_0x15962f[0x1];}else{_0x233b6c=null;}}else{_0x233b6c=null;}_0x4cc593['cb'](null,{'code':_0x45726b,'result':_0x3ae057,'extra':_0x233b6c});}});_0x1fe192['on']('error',function(_0xc41b0a){_0x785a46[_0x6ec6('0xe')](_0x6ec6('0x1a'),new AGIError(_0x6ec6('0x1b'),_0xc41b0a[_0x6ec6('0x1c')]));});_0x1fe192['on']('close',function(){_0x785a46[_0x6ec6('0xe')](_0x6ec6('0x1d'),new AGIError(_0x6ec6('0x1e')));});_0x1fe192['on'](_0x6ec6('0x1f'),function(){_0x785a46[_0x6ec6('0xe')](_0x6ec6('0x1f'),new AGIError(_0x6ec6('0x20')));_0x1fe192['destroy']();});_0x1fe192[_0x6ec6('0x21')](_0x58a0b5);this[_0x6ec6('0x22')]=function(_0x544a2d,_0x477fbb){var _0x544a2d=_0x544a2d||'',_0x477fbb=typeof _0x477fbb==_0x6ec6('0x12')?_0x477fbb:new Function();_0x4cc593={'tx':_0x544a2d,'rx':'','cb':_0x477fbb};_0x1fe192[_0x6ec6('0x23')](_0x544a2d+'\x0a');},this[_0x6ec6('0x1d')]=function(){_0x1fe192['destroy']();};}util[_0x6ec6('0x24')](AGIChannel,EventEmitter);AGIChannel[_0x6ec6('0x25')][_0x6ec6('0x26')]=function(_0x192abd){return this[_0x6ec6('0x22')][_0x6ec6('0x27')](this,_0x192abd);};AGIChannel[_0x6ec6('0x25')][_0x6ec6('0x28')]=function(){return this[_0x6ec6('0x26')]('ANSWER');};AGIChannel[_0x6ec6('0x25')]['getData']=function(_0x2306cb,_0x30bd78,_0x1aa7e2){_0x2306cb=_0x2306cb===undefined?_0x6ec6('0x29'):_0x2306cb;_0x30bd78=_0x30bd78===undefined?'5':_0x30bd78;_0x1aa7e2=_0x1aa7e2===undefined?'1':_0x1aa7e2;return this[_0x6ec6('0x26')](util['format']('GET\x20DATA\x20\x22%s\x22\x20%s\x20%s',_0x2306cb,_0x30bd78*0x3e8,_0x1aa7e2));};AGIChannel[_0x6ec6('0x25')]['noop']=function(_0x2df116){_0x2df116=_0x2df116||'NO\x20MESSAGE';return this[_0x6ec6('0x26')](util[_0x6ec6('0x2a')]('VERBOSE\x20\x22%s\x22',_0x2df116));};AGIChannel[_0x6ec6('0x25')]['exec']=function(_0x5a85e1,_0x10c4f9){if(_[_0x6ec6('0x2b')](_0x10c4f9)){return this['sendRequest'](util[_0x6ec6('0x2a')](_0x6ec6('0x2c'),_0x5a85e1,_0x10c4f9[_0x6ec6('0x2d')](',')));}return this[_0x6ec6('0x26')](util[_0x6ec6('0x2a')]('EXEC\x20%s\x20%s',_0x5a85e1,_0x10c4f9));};AGIChannel[_0x6ec6('0x25')][_0x6ec6('0x2e')]=function(_0x10cba4){return this[_0x6ec6('0x26')](util['format']('SET\x20CONTEXT\x20%s',_0x10cba4));};AGIChannel['prototype']['setExtension']=function(_0x4b2452){return this[_0x6ec6('0x26')](util[_0x6ec6('0x2a')](_0x6ec6('0x2f'),_0x4b2452));};AGIChannel[_0x6ec6('0x25')][_0x6ec6('0x30')]=function(_0x59cb7b){return this[_0x6ec6('0x26')](util['format'](_0x6ec6('0x31'),_0x59cb7b));};AGIChannel[_0x6ec6('0x25')]['hangup']=function(){return this['sendRequest'](_0x6ec6('0x32'));};AGIChannel[_0x6ec6('0x25')]['setVariable']=function(_0x475db6,_0x1496ff){var _0x3bdf7e=_['isBoolean'](_0x1496ff)||_[_0x6ec6('0x33')](_0x1496ff)?_0x1496ff[_0x6ec6('0x34')]():_0x1496ff;return this[_0x6ec6('0x26')](util[_0x6ec6('0x2a')](_0x6ec6('0x35'),_0x475db6,_0x3bdf7e?_0x3bdf7e['toString']()[_0x6ec6('0x14')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x6ec6('0x25')]['sayNumber']=function(_0x1c565e,_0x5871af){return this['sendRequest'](util['format'](_0x6ec6('0x36'),_0x1c565e,_0x5871af));};AGIChannel[_0x6ec6('0x25')][_0x6ec6('0x37')]=function(_0x51000d,_0x1257b9){return this[_0x6ec6('0x26')](util[_0x6ec6('0x2a')](_0x6ec6('0x38'),_0x51000d,_0x1257b9));};AGIChannel['prototype'][_0x6ec6('0x39')]=function(_0x5ddd92,_0x31540c){return this[_0x6ec6('0x26')](util[_0x6ec6('0x2a')](_0x6ec6('0x3a'),_0x5ddd92,_0x31540c));};AGIChannel[_0x6ec6('0x25')]['continueAt']=function(_0x990d0c,_0x2e708a,_0x2c65b7){_0x2e708a=_0x2e708a||this[_0x6ec6('0x3b')];_0x2c65b7=_0x2c65b7||0x1;this[_0x6ec6('0x2e')](_0x990d0c);this[_0x6ec6('0x3c')](_0x2e708a);this[_0x6ec6('0x30')](_0x2c65b7);return this[_0x6ec6('0x3d')](util[_0x6ec6('0x2a')](_0x6ec6('0x3e'),_0x990d0c,_0x2e708a,_0x2c65b7));};AGIChannel[_0x6ec6('0x25')][_0x6ec6('0x3f')]=function(_0x2f3f95){return this['sendRequest'](util['format']('GET\x20VARIABLE\x20\x22%s\x22',_0x2f3f95));};AGIChannel[_0x6ec6('0x25')][_0x6ec6('0x40')]=function(_0xcc67d0,_0xfe40aa,_0x2d6182,_0x212f60,_0x2e1ba3,_0x2340a7){_0xfe40aa=_0xfe40aa||'wav';_0x2d6182=_0x2d6182||'';_0x212f60=_0x212f60===undefined?-0x1:_0x212f60==='-1'?-0x1:_0x212f60*0x3e8;_0x2e1ba3=_0x2e1ba3===undefined?'':'s='+_0x2e1ba3;_0x2340a7=_0x2340a7?_0x6ec6('0x41'):'';return this[_0x6ec6('0x26')](util[_0x6ec6('0x2a')](_0x6ec6('0x42'),_0xcc67d0,_0xfe40aa,_0x2d6182,_0x212f60,_0x2340a7,_0x2e1ba3));};AGIChannel[_0x6ec6('0x25')][_0x6ec6('0x43')]=function(_0x313a81,_0x2b31da){_0x2b31da=_0x2b31da||'';return this[_0x6ec6('0x26')](util[_0x6ec6('0x2a')](_0x6ec6('0x44'),_0x313a81,_0x2b31da));};AGIChannel[_0x6ec6('0x25')][_0x6ec6('0x45')]=function(_0x24cfa5){return this[_0x6ec6('0x46')](_0x6ec6('0x47'),_0x24cfa5);};AGIChannel['prototype'][_0x6ec6('0x48')]=function(_0x1571e2){return this[_0x6ec6('0x46')](_0x6ec6('0x49'),_0x1571e2);};AGIChannel[_0x6ec6('0x25')]['error']=function(_0x2c0381,_0x38f37c){this[_0x6ec6('0x3d')](util[_0x6ec6('0x2a')](_0x6ec6('0x4a'),_0x2c0381['id'],_0x2c0381['label'],_0x38f37c));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x6ec6('0x4b')]=AGIChannel; \ No newline at end of file +var _0x1a21=['join','EXEC\x20%s\x20%s','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','setContext','noop','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','util','lodash','events','EventEmitter','./reply','./error','call','setEncoding','utf8','headers','ready','line','toLowerCase','emit','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','no\x20code','replace','result=','indexOf','substr','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','timeout','command','function','write','inherits','prototype','sendRequest','sync','answer','ANSWER','getData','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','VERBOSE\x20\x22%s\x22','exec'];(function(_0x3f9c25,_0x37a70f){var _0x419f59=function(_0x3e2096){while(--_0x3e2096){_0x3f9c25['push'](_0x3f9c25['shift']());}};_0x419f59(++_0x37a70f);}(_0x1a21,0x1bd));var _0x11a2=function(_0x26da89,_0x264785){_0x26da89=_0x26da89-0x0;var _0xc95b7b=_0x1a21[_0x26da89];return _0xc95b7b;};'use strict';var util=require(_0x11a2('0x0'));var _=require(_0x11a2('0x1'));var EventEmitter=require(_0x11a2('0x2'))[_0x11a2('0x3')];var AGIReply=require(_0x11a2('0x4'));var AGIError=require(_0x11a2('0x5'));function AGIChannel(_0x51dc7a){var _0x1a849a=this,_0x5a9aa3=new AGIReply(),_0x14487f=![],_0x34f712={};EventEmitter[_0x11a2('0x6')](_0x1a849a);_0x51dc7a[_0x11a2('0x7')](_0x11a2('0x8'));_0x51dc7a['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x5a9aa3['setEncoding']('utf8');_0x5a9aa3['on'](_0x11a2('0x9'),function(_0x117238){for(var _0xd5391b in _0x117238){_0x1a849a[_0xd5391b]=_0x117238[_0xd5391b];}_0x1a849a['emit'](_0x11a2('0xa'));});_0x5a9aa3['on'](_0x11a2('0xb'),function(_0x5e6691){if(_0x5e6691[_0x11a2('0xc')]()=='hangup'){_0x1a849a[_0x11a2('0xd')](_0x11a2('0xe'));return;}if(_0x5e6691[_0x11a2('0xf')](0x0,0xb)==_0x11a2('0x10')){_0x14487f=!![];}if(_0x14487f){_0x34f712['rx']+=_0x5e6691+'\x0a';if(_0x5e6691[_0x11a2('0x11')](_0x11a2('0x12'))!=-0x1){_0x14487f=![];}}else{_0x34f712['rx']=_0x5e6691;}if(_0x14487f){return;}if(typeof _0x34f712['cb']=='function'){var _0x2730d7=_0x34f712['rx'][_0x11a2('0xf')](0x0,0x3),_0x2f2218=null,_0x308f5c=null;_0x2730d7=parseInt(_0x2730d7);if(isNaN(_0x2730d7)){_0x34f712['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x11a2('0x13')});return;}if(_0x2730d7!=0xc8){_0x34f712['cb'](null,{'code':_0x2730d7,'result':-0x1,'extra':'KO'});return;}_0x2f2218=_0x34f712['rx'][_0x11a2('0xf')](0x4)[_0x11a2('0x14')](_0x11a2('0x15'),'');if(_0x2f2218[_0x11a2('0x16')]('\x20')!=-0x1){_0x2f2218=_0x2f2218[_0x11a2('0x17')](0x0,_0x2f2218[_0x11a2('0x16')]('\x20'));}if(_[_0x11a2('0x18')](_0x2f2218,'-1')){_0x2f2218=parseInt(_0x2f2218);}_0x308f5c=_0x34f712['rx'][_0x11a2('0x19')]('\x20');if(_0x308f5c[_0x11a2('0x1a')]==0x3){_0x308f5c=_0x308f5c[0x2][_0x11a2('0xf')](0x1,_0x308f5c[0x2][_0x11a2('0x1a')]-0x1);}else if(_0x308f5c['length']>0x3){var _0x2731cc=/\((.+)\)/;var _0x19c34d=_0x34f712['rx'][_0x11a2('0x1b')](_0x2731cc);if(_0x19c34d){_0x308f5c=_0x19c34d[0x1];}else{_0x308f5c=null;}}else{_0x308f5c=null;}_0x34f712['cb'](null,{'code':_0x2730d7,'result':_0x2f2218,'extra':_0x308f5c});}});_0x51dc7a['on'](_0x11a2('0x1c'),function(_0x5e6901){_0x1a849a[_0x11a2('0xd')](_0x11a2('0x1c'),new AGIError(_0x11a2('0x1d'),_0x5e6901[_0x11a2('0x1e')]));});_0x51dc7a['on'](_0x11a2('0x1f'),function(){_0x1a849a[_0x11a2('0xd')](_0x11a2('0x1f'),new AGIError('E_AGI_SOCKET_CLOSE'));});_0x51dc7a['on'](_0x11a2('0x20'),function(){_0x1a849a['emit'](_0x11a2('0x20'),new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x51dc7a['destroy']();});_0x51dc7a['pipe'](_0x5a9aa3);this[_0x11a2('0x21')]=function(_0x289d38,_0x14c359){var _0x289d38=_0x289d38||'',_0x14c359=typeof _0x14c359==_0x11a2('0x22')?_0x14c359:new Function();_0x34f712={'tx':_0x289d38,'rx':'','cb':_0x14c359};_0x51dc7a[_0x11a2('0x23')](_0x289d38+'\x0a');},this[_0x11a2('0x1f')]=function(){_0x51dc7a['destroy']();};}util[_0x11a2('0x24')](AGIChannel,EventEmitter);AGIChannel[_0x11a2('0x25')][_0x11a2('0x26')]=function(_0x3a0241){return this['command'][_0x11a2('0x27')](this,_0x3a0241);};AGIChannel[_0x11a2('0x25')][_0x11a2('0x28')]=function(){return this['sendRequest'](_0x11a2('0x29'));};AGIChannel[_0x11a2('0x25')][_0x11a2('0x2a')]=function(_0x217bdf,_0x1c4703,_0x2b4537){_0x217bdf=_0x217bdf===undefined?'beep':_0x217bdf;_0x1c4703=_0x1c4703===undefined?'5':_0x1c4703;_0x2b4537=_0x2b4537===undefined?'1':_0x2b4537;return this[_0x11a2('0x26')](util[_0x11a2('0x2b')](_0x11a2('0x2c'),_0x217bdf,_0x1c4703*0x3e8,_0x2b4537));};AGIChannel[_0x11a2('0x25')]['noop']=function(_0x1c35ab){_0x1c35ab=_0x1c35ab||'NO\x20MESSAGE';return this[_0x11a2('0x26')](util[_0x11a2('0x2b')](_0x11a2('0x2d'),_0x1c35ab));};AGIChannel[_0x11a2('0x25')][_0x11a2('0x2e')]=function(_0x44d561,_0x195654){if(_['isArray'](_0x195654)){return this[_0x11a2('0x26')](util[_0x11a2('0x2b')]('EXEC\x20%s\x20%s',_0x44d561,_0x195654[_0x11a2('0x2f')](',')));}return this[_0x11a2('0x26')](util[_0x11a2('0x2b')](_0x11a2('0x30'),_0x44d561,_0x195654));};AGIChannel['prototype']['setContext']=function(_0x543d8e){return this[_0x11a2('0x26')](util[_0x11a2('0x2b')](_0x11a2('0x31'),_0x543d8e));};AGIChannel[_0x11a2('0x25')][_0x11a2('0x32')]=function(_0x50c411){return this[_0x11a2('0x26')](util[_0x11a2('0x2b')](_0x11a2('0x33'),_0x50c411));};AGIChannel[_0x11a2('0x25')][_0x11a2('0x34')]=function(_0x1ad4fb){return this[_0x11a2('0x26')](util[_0x11a2('0x2b')](_0x11a2('0x35'),_0x1ad4fb));};AGIChannel[_0x11a2('0x25')][_0x11a2('0xe')]=function(){return this[_0x11a2('0x26')](_0x11a2('0x36'));};AGIChannel[_0x11a2('0x25')][_0x11a2('0x37')]=function(_0x2912d9,_0x372423){var _0x40f99e=_[_0x11a2('0x38')](_0x372423)||_[_0x11a2('0x39')](_0x372423)?_0x372423[_0x11a2('0x3a')]():_0x372423;return this[_0x11a2('0x26')](util[_0x11a2('0x2b')](_0x11a2('0x3b'),_0x2912d9,_0x40f99e?_0x40f99e[_0x11a2('0x3a')]()[_0x11a2('0x14')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x11a2('0x25')][_0x11a2('0x3c')]=function(_0x45929a,_0x54ef52){return this[_0x11a2('0x26')](util[_0x11a2('0x2b')]('SAY\x20NUMBER\x20%s\x20%s',_0x45929a,_0x54ef52));};AGIChannel['prototype'][_0x11a2('0x3d')]=function(_0xb1fda1,_0x26e380){return this[_0x11a2('0x26')](util[_0x11a2('0x2b')](_0x11a2('0x3e'),_0xb1fda1,_0x26e380));};AGIChannel[_0x11a2('0x25')][_0x11a2('0x3f')]=function(_0x3af557,_0x1b21f8){return this[_0x11a2('0x26')](util[_0x11a2('0x2b')](_0x11a2('0x40'),_0x3af557,_0x1b21f8));};AGIChannel[_0x11a2('0x25')][_0x11a2('0x41')]=function(_0x4ce9bd,_0x2690b9,_0x21cfb5){_0x2690b9=_0x2690b9||this[_0x11a2('0x42')];_0x21cfb5=_0x21cfb5||0x1;this[_0x11a2('0x43')](_0x4ce9bd);this[_0x11a2('0x32')](_0x2690b9);this[_0x11a2('0x34')](_0x21cfb5);return this[_0x11a2('0x44')](util[_0x11a2('0x2b')]('GOTO\x20%s\x20%s\x20%s',_0x4ce9bd,_0x2690b9,_0x21cfb5));};AGIChannel['prototype'][_0x11a2('0x45')]=function(_0x53754e){return this[_0x11a2('0x26')](util[_0x11a2('0x2b')](_0x11a2('0x46'),_0x53754e));};AGIChannel[_0x11a2('0x25')][_0x11a2('0x47')]=function(_0x32eead,_0x2c84e2,_0x34f4fd,_0x48d67e,_0x54ccef,_0x1b93a8){_0x2c84e2=_0x2c84e2||'wav';_0x34f4fd=_0x34f4fd||'';_0x48d67e=_0x48d67e===undefined?-0x1:_0x48d67e==='-1'?-0x1:_0x48d67e*0x3e8;_0x54ccef=_0x54ccef===undefined?'':'s='+_0x54ccef;_0x1b93a8=_0x1b93a8?_0x11a2('0x48'):'';return this[_0x11a2('0x26')](util[_0x11a2('0x2b')](_0x11a2('0x49'),_0x32eead,_0x2c84e2,_0x34f4fd,_0x48d67e,_0x1b93a8,_0x54ccef));};AGIChannel['prototype'][_0x11a2('0x4a')]=function(_0x39267c,_0x1516bd){_0x1516bd=_0x1516bd||'';return this['sendRequest'](util[_0x11a2('0x2b')](_0x11a2('0x4b'),_0x39267c,_0x1516bd));};AGIChannel[_0x11a2('0x25')][_0x11a2('0x4c')]=function(_0x49a235){return this[_0x11a2('0x2e')](_0x11a2('0x4d'),_0x49a235);};AGIChannel[_0x11a2('0x25')][_0x11a2('0x4e')]=function(_0xfe1846){return this[_0x11a2('0x2e')](_0x11a2('0x4f'),_0xfe1846);};AGIChannel['prototype'][_0x11a2('0x1c')]=function(_0x594946,_0x293ec9){this[_0x11a2('0x44')](util[_0x11a2('0x2b')](_0x11a2('0x50'),_0x594946['id'],_0x594946[_0x11a2('0x51')],_0x293ec9));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 17b5968..030f0bb 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 _0xff19=['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\x20closed.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_UNDEFINED','push','message','name','exports','util','Undefined\x20error.'];(function(_0x48c363,_0x3aa848){var _0x39c4a7=function(_0xb33a30){while(--_0xb33a30){_0x48c363['push'](_0x48c363['shift']());}};_0x39c4a7(++_0x3aa848);}(_0xff19,0xdf));var _0x9ff1=function(_0x3240e2,_0x350be9){_0x3240e2=_0x3240e2-0x0;var _0x41679a=_0xff19[_0x3240e2];return _0x41679a;};'use strict';var util=require(_0x9ff1('0x0'));var error={'E_AGI_UNDEFINED':_0x9ff1('0x1'),'E_AGI_ARGUMENT_PORT':_0x9ff1('0x2'),'E_AGI_SERVER_ERROR':_0x9ff1('0x3'),'E_AGI_SERVER_CLOSE':_0x9ff1('0x4'),'E_AGI_SERVER_MAXCONNECTION':_0x9ff1('0x5'),'E_AGI_SERVER_VOICE_DISABLED':_0x9ff1('0x6'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':_0x9ff1('0x7'),'E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':_0x9ff1('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x9ff1('0x9'),'E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x47a7e7){var _0x47a7e7=_0x47a7e7||null,_0x23a566=_0x23a566||[],_0xd916=0x1,_0x5eb68a='';if(!error[_0x47a7e7]){_0x47a7e7=_0x9ff1('0xa');}_0x23a566['push'](error[_0x47a7e7]);while(arguments[_0xd916]){_0x23a566[_0x9ff1('0xb')](arguments[_0xd916]);_0xd916++;}_0x5eb68a=util['format']['apply'](util,_0x23a566);this[_0x9ff1('0xc')]=_0x5eb68a;this[_0x9ff1('0xd')]=_0x47a7e7;}module[_0x9ff1('0xe')]=AGIError; \ No newline at end of file +var _0x44a6=['[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','E_AGI_UNDEFINED','push','format','apply','message','name','exports','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.'];(function(_0x384447,_0x41669a){var _0x3810db=function(_0x3f1288){while(--_0x3f1288){_0x384447['push'](_0x384447['shift']());}};_0x3810db(++_0x41669a);}(_0x44a6,0x84));var _0x644a=function(_0x31e34f,_0x4b6339){_0x31e34f=_0x31e34f-0x0;var _0x14fbbc=_0x44a6[_0x31e34f];return _0x14fbbc;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':_0x644a('0x0'),'E_AGI_SERVER_ERROR':_0x644a('0x1'),'E_AGI_SERVER_CLOSE':_0x644a('0x2'),'E_AGI_SERVER_MAXCONNECTION':_0x644a('0x3'),'E_AGI_SERVER_VOICE_DISABLED':_0x644a('0x4'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':_0x644a('0x5'),'E_AGI_SOCKET_TIMEOUT':_0x644a('0x6'),'E_AGI_COMMAND_EMPTY':_0x644a('0x7'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x2b46ce){var _0x2b46ce=_0x2b46ce||null,_0x37274b=_0x37274b||[],_0x53bf54=0x1,_0x5ebf6d='';if(!error[_0x2b46ce]){_0x2b46ce=_0x644a('0x8');}_0x37274b['push'](error[_0x2b46ce]);while(arguments[_0x53bf54]){_0x37274b[_0x644a('0x9')](arguments[_0x53bf54]);_0x53bf54++;}_0x5ebf6d=util[_0x644a('0xa')][_0x644a('0xb')](util,_0x37274b);this[_0x644a('0xc')]=_0x5ebf6d;this[_0x644a('0xd')]=_0x2b46ce;}module[_0x644a('0xe')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index af24252..92522ef 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 _0x2a77=['getdigits','getsecretdigits','vertices','edges','numberOfEdges','prototype','addEdge','push','size','getVertex','traverseBFS','info','no\x20vertex\x20found','stop\x20traverse','length','no\x20edge/s\x20available','condition','split','vswitch','target','default','agicommand','menu','invalid','default\x20on\x20switch\x20not\x20found','includes','exports','lodash','../../../config/logger','agi'];(function(_0x312ff8,_0x5d7167){var _0x4e144b=function(_0x8c0bd5){while(--_0x8c0bd5){_0x312ff8['push'](_0x312ff8['shift']());}};_0x4e144b(++_0x5d7167);}(_0x2a77,0xcf));var _0x72a7=function(_0x32a773,_0x57b5c7){_0x32a773=_0x32a773-0x0;var _0x430dcb=_0x2a77[_0x32a773];return _0x430dcb;};'use strict';var _=require(_0x72a7('0x0'));var logger=require(_0x72a7('0x1'))(_0x72a7('0x2'));var verticesWithRetry=['menu',_0x72a7('0x3'),_0x72a7('0x4')];var Graph=function(){this[_0x72a7('0x5')]={};this[_0x72a7('0x6')]={};this[_0x72a7('0x7')]=0x0;};Graph[_0x72a7('0x8')]['addVertex']=function(_0x3ad507){this[_0x72a7('0x5')][_0x3ad507['id']]=_0x3ad507;this['edges'][_0x3ad507['id']]=[];};Graph['prototype'][_0x72a7('0x9')]=function(_0x484736,_0x121d24,_0x2778a3){this[_0x72a7('0x6')][_0x484736][_0x72a7('0xa')]({'target':_0x121d24,'condition':_0x2778a3});this[_0x72a7('0x7')]+=0x1;};Graph[_0x72a7('0x8')][_0x72a7('0xb')]=function(){return _[_0x72a7('0xb')](this[_0x72a7('0x5')]);};Graph[_0x72a7('0x8')]['relations']=function(){return this[_0x72a7('0x7')];};Graph['prototype'][_0x72a7('0xc')]=function(_0x332290){return this[_0x72a7('0x5')][_0x332290];};Graph[_0x72a7('0x8')][_0x72a7('0xd')]=function(_0x5d3b2e,_0x1c2636){if(!this[_0x72a7('0x5')][_0x5d3b2e]){return logger[_0x72a7('0xe')](_0x72a7('0xf'));}var _0x484979=_0x1c2636(this[_0x72a7('0x5')][_0x5d3b2e]);if(!_0x484979){return logger['info'](_0x72a7('0x10'));}if(this[_0x72a7('0x6')][_0x5d3b2e][_0x72a7('0x11')]===0x0){return logger['info'](_0x72a7('0x12'));}for(var _0x1f78eb=0x0,_0x4c6b46=[],_0x3c2d30=![];_0x1f78eb\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','callerid','dnid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','uniqueid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','toJson','agicommand','hasOwnProperty','retry','maxRetry','addVertex','omit','mxCell','isArray','source','target','value','getSquareProject','then','catch','createSquareReport','indexOf','agi_','substring','inspect','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','timeout','hangup','production','start','root','joinAt','YYYY-MM-DD\x20HH:mm:ss','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','code','result','response','isUndefined','toString','agicommand\x20not\x20found','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','finally','clear','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20published','close','Project\x20%s\x20not\x20found','voice','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','./server','listening','xml2json','lodash','syncho','util'];(function(_0x2ae7b0,_0x30137f){var _0x111498=function(_0x5efbce){while(--_0x5efbce){_0x2ae7b0['push'](_0x2ae7b0['shift']());}};_0x111498(++_0x30137f);}(_0xe6e5,0x10a));var _0x5e6e=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0xe6e5[_0x4ae6ef];return _0x3cbb4e;};'use strict';var parser=require(_0x5e6e('0x0'));var _=require(_0x5e6e('0x1'));var syncho=require(_0x5e6e('0x2'));var util=require(_0x5e6e('0x3'));var moment=require(_0x5e6e('0x4'));var config=require(_0x5e6e('0x5'));var logger=require('../../config/logger')('agi');var utilLicense=require('../../config/license/util');var rpc=require(_0x5e6e('0x6'));var mailRpc=require(_0x5e6e('0x7'));var Graph=require(_0x5e6e('0x8'));var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config['agi']=_[_0x5e6e('0x9')](config[_0x5e6e('0xa')],{'ip':_0x5e6e('0xb'),'port':0x11dd});function connectionHandler(_0x7e4367){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x7e4367);agiHandler(_0x7e4367);}catch(_0x553920){logger[_0x5e6e('0xc')](_0x553920[_0x5e6e('0xd')]);}});});}function listeningHandler(){console[_0x5e6e('0xe')](_0x5e6e('0xf'),config[_0x5e6e('0xa')][_0x5e6e('0x10')]);logger['info'](util[_0x5e6e('0x11')]('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config[_0x5e6e('0xa')]['ip'],config[_0x5e6e('0xa')]['port']));}function errorHandler(_0x1c413c){if(_0x1c413c&&_0x1c413c[_0x5e6e('0x12')]&&_0x1c413c[_0x5e6e('0x13')]){logger[_0x5e6e('0xc')](util[_0x5e6e('0x11')](_0x5e6e('0x14'),_0x1c413c[_0x5e6e('0x12')],_0x1c413c[_0x5e6e('0x13')]));}else{logger[_0x5e6e('0xc')](util[_0x5e6e('0x11')]('[ERROR]\x20%s',_0x1c413c[_0x5e6e('0xd')]));}}function closeHandler(){logger[_0x5e6e('0x15')](util[_0x5e6e('0x11')](_0x5e6e('0x16'),this[_0x5e6e('0x17')],this['calleridname'],this[_0x5e6e('0x18')],this[_0x5e6e('0x19')],this['uniqueid']));try{createSquareReport(this);}catch(_0x4ac66c){logger['error'](_0x4ac66c[_0x5e6e('0xd')]);}}function timeoutHandler(){logger[_0x5e6e('0x15')](util[_0x5e6e('0x11')](_0x5e6e('0x1a'),this[_0x5e6e('0x17')],this[_0x5e6e('0x1b')],this[_0x5e6e('0x18')],this[_0x5e6e('0x19')],this[_0x5e6e('0x1c')]));}function hangupHandler(){logger[_0x5e6e('0x15')](util['format'](_0x5e6e('0x1d'),this['arg_1'],this[_0x5e6e('0x1b')],this[_0x5e6e('0x18')],this['dnid'],this[_0x5e6e('0x1c')]));this[_0x5e6e('0x1e')]=!![];}function getRoot(_0xe8d2fb){return parser[_0x5e6e('0x1f')](_0xe8d2fb,{'object':!![]})['mxGraphModel']['root'];}function addVertex(_0x105e65,_0x36ddda,_0x5e9562){_0x36ddda[_0x5e6e('0x20')]=_0x5e9562;if(_0x36ddda[_0x5e6e('0x21')](_0x5e6e('0x22'))){_0x36ddda[_0x5e6e('0x23')]=parseInt(_0x36ddda[_0x5e6e('0x22')],0xa);}_0x105e65[_0x5e6e('0x24')](_[_0x5e6e('0x25')](_0x36ddda,_0x5e6e('0x26')));}function initGraph(_0x3173fd,_0x1ff37d){var _0x3e8c22=new Graph();for(var _0x373621 in _0x3173fd){if(_0x3173fd[_0x5e6e('0x21')](_0x373621)){if(_[_0x5e6e('0x27')](_0x3173fd[_0x373621])){for(var _0x2c1dce=0x0;_0x2c1dce<_0x3173fd[_0x373621]['length'];_0x2c1dce+=0x1){addVertex(_0x3e8c22,_0x3173fd[_0x373621][_0x2c1dce],_0x373621);}}else{addVertex(_0x3e8c22,_0x3173fd[_0x373621],_0x373621);}}}for(var _0x5330ee=0x0;_0x5330ee<_0x1ff37d['length'];_0x5330ee+=0x1){if(_0x1ff37d[_0x5330ee][_0x5e6e('0x28')]&&_0x1ff37d[_0x5330ee][_0x5e6e('0x29')]){_0x3e8c22['addEdge'](_0x1ff37d[_0x5330ee][_0x5e6e('0x28')],_0x1ff37d[_0x5330ee]['target'],_0x1ff37d[_0x5330ee][_0x5e6e('0x2a')]);}}return _0x3e8c22;}function getSquareProject(_0x3d6e50,_0x7b14f5){rpc[_0x5e6e('0x2b')](_0x3d6e50)[_0x5e6e('0x2c')](function(_0x582204){_0x7b14f5(null,_0x582204);})[_0x5e6e('0x2d')](function(_0x21ba0a){_0x7b14f5(null,_0x21ba0a);});}function createSquareReport(_0x555d36,_0x2bea7e){rpc[_0x5e6e('0x2e')](_0x555d36)[_0x5e6e('0x2c')](function(_0x2580f1){if(_0x2bea7e){_0x2bea7e(null,_0x2580f1);}})[_0x5e6e('0x2d')](function(_0x52c262){if(_0x2bea7e){_0x2bea7e(null,_0x52c262);}});}function setChannelVariables(_0x4db0f1){for(var _0x546202 in _0x4db0f1){if(_0x4db0f1[_0x5e6e('0x21')](_0x546202)){if(_0x546202[_0x5e6e('0x2f')](_0x5e6e('0x30'))===0x0){_0x4db0f1[_0x546202[_0x5e6e('0x31')](0x4)]=_0x4db0f1[_0x546202];delete _0x4db0f1[_0x546202];}}}}function getLogFromObject(_0x35b8ee){return util[_0x5e6e('0x32')](_0x35b8ee,{'showHidden':![],'depth':null});}function agiHandler(_0x4e7b9a){var _0x3f720d,_0x442759,_0x374e88,_0x550e5f,_0x37b545;logger[_0x5e6e('0x33')](_0x5e6e('0x34'),JSON[_0x5e6e('0x35')](_0x4e7b9a,null,0x2));logger[_0x5e6e('0x15')](util[_0x5e6e('0x11')](_0x5e6e('0x36'),_0x4e7b9a[_0x5e6e('0x17')],_0x4e7b9a[_0x5e6e('0x1b')],_0x4e7b9a[_0x5e6e('0x18')],_0x4e7b9a[_0x5e6e('0x19')],_0x4e7b9a['uniqueid']));_0x4e7b9a['on'](_0x5e6e('0xc'),errorHandler);_0x4e7b9a['on']('close',closeHandler);_0x4e7b9a['on'](_0x5e6e('0x37'),timeoutHandler);_0x4e7b9a[_0x5e6e('0x1e')]=![];_0x4e7b9a['on'](_0x5e6e('0x38'),hangupHandler);var _0xf222d9=getSquareProject['sync'](null,_0x4e7b9a['arg_1']);if(_0xf222d9){if(_0xf222d9[_0x5e6e('0x39')]){_0x3f720d=getRoot(_0xf222d9[_0x5e6e('0x39')]);if(_0x3f720d&&_0x3f720d[_0x5e6e('0x3a')]){logger['debug'](_0x5e6e('0x3b'),JSON[_0x5e6e('0x35')](_0x3f720d,null,0x2));_0x4e7b9a[_0x5e6e('0x3c')]=moment()[_0x5e6e('0x11')](_0x5e6e('0x3d'));_0x442759=initGraph(_[_0x5e6e('0x25')](_0x3f720d,_0x5e6e('0x26')),_0x3f720d[_0x5e6e('0x26')]);_0x374e88=new Vertices(_0x4e7b9a,rpc,mailRpc);logger[_0x5e6e('0x15')](util[_0x5e6e('0x11')](_0x5e6e('0x3e'),_0x4e7b9a[_0x5e6e('0x17')],_0x4e7b9a[_0x5e6e('0x1b')],_0x4e7b9a[_0x5e6e('0x18')],_0x4e7b9a[_0x5e6e('0x19')],_0x4e7b9a['uniqueid']));_0x442759[_0x5e6e('0x3f')](_0x3f720d['start']['id'],function(_0x4382b7){try{_0x4382b7=_0x374e88['clear'](_0x4382b7);logger['debug']('vertex',JSON['stringify'](_0x4382b7,null,0x2));if(_0x4382b7[_0x5e6e('0x20')]==='gotoc'){logger[_0x5e6e('0x15')](_0x5e6e('0x40'));_0x4e7b9a[_0x5e6e('0x41')]=_0x4382b7['context']||_0x4e7b9a[_0x5e6e('0x41')];_0x4e7b9a[_0x5e6e('0x42')]=_0x4382b7[_0x5e6e('0x42')];_0x4e7b9a['priority']=_0x4382b7['priority']?_0x4382b7[_0x5e6e('0x43')]-0x1:0x1;return null;}else if(_0x4382b7&&_0x374e88[_0x4382b7['agicommand']]){_0x37b545=_0x374e88[_0x4382b7[_0x5e6e('0x20')]](_0x4382b7);logger[_0x5e6e('0x15')]('response',JSON[_0x5e6e('0x35')](_0x37b545,null,0x2));if(_0x37b545&&_0x37b545[_0x5e6e('0x44')]===AGI_CODE_SUCCESS&&_0x37b545[_0x5e6e('0x45')]!==AGI_RESULT_ERROR&&!_0x4e7b9a[_0x5e6e('0x1e')]){logger['debug'](_0x5e6e('0x46'),getLogFromObject(_0x37b545));return _[_0x5e6e('0x47')](_0x37b545['result'])?null:_0x37b545[_0x5e6e('0x45')][_0x5e6e('0x48')]();}else{logger[_0x5e6e('0xc')](_0x5e6e('0x46'),getLogFromObject(_0x37b545));return null;}}else{logger['error'](_0x5e6e('0x49'));return null;}}catch(_0x4d0c1b){logger[_0x5e6e('0xc')](_0x4d0c1b['stack']);return null;}});if(_0x3f720d['finally']){logger[_0x5e6e('0x15')](util[_0x5e6e('0x11')](_0x5e6e('0x4a'),_0x4e7b9a['arg_1'],_0x4e7b9a[_0x5e6e('0x1b')],_0x4e7b9a[_0x5e6e('0x18')],_0x4e7b9a[_0x5e6e('0x19')],_0x4e7b9a['uniqueid']));_0x442759[_0x5e6e('0x3f')](_0x3f720d[_0x5e6e('0x4b')]['id'],function(_0x380c16){try{_0x380c16=_0x374e88[_0x5e6e('0x4c')](_0x380c16);logger[_0x5e6e('0x33')]('vertex',JSON[_0x5e6e('0x35')](_0x380c16,null,0x2));if(_0x380c16&&_0x374e88[_0x380c16[_0x5e6e('0x20')]]){_0x37b545=_0x374e88[_0x380c16[_0x5e6e('0x20')]](_0x380c16);if(_0x37b545){logger[_0x5e6e('0x33')](_0x5e6e('0x46'),getLogFromObject(_0x37b545));return _[_0x5e6e('0x47')](_0x37b545[_0x5e6e('0x45')])?null:_0x37b545['result'][_0x5e6e('0x48')]();}else{logger['error'](_0x5e6e('0x46'),getLogFromObject(_0x37b545));return null;}}else{logger[_0x5e6e('0xc')](_0x5e6e('0x49'));return null;}}catch(_0x3d7073){logger['error'](_0x3d7073[_0x5e6e('0xd')]);return null;}});}logger[_0x5e6e('0x15')](util[_0x5e6e('0x11')](_0x5e6e('0x4d'),_0x4e7b9a[_0x5e6e('0x17')],_0x4e7b9a['calleridname'],_0x4e7b9a[_0x5e6e('0x18')],_0x4e7b9a['dnid'],_0x4e7b9a['uniqueid']));logger[_0x5e6e('0x15')](util['format'](_0x5e6e('0x4e'),_0x4e7b9a[_0x5e6e('0x41')],_0x4e7b9a['extension'],parseInt(_0x4e7b9a[_0x5e6e('0x43')],0xa)+0x1));_0x4e7b9a[_0x5e6e('0x4f')](_0x4e7b9a['context'],_0x4e7b9a['extension'],parseInt(_0x4e7b9a[_0x5e6e('0x43')],0xa)+0x1);_0x4e7b9a['close']();}}else{logger[_0x5e6e('0xc')](util[_0x5e6e('0x11')](_0x5e6e('0x50'),_0x4e7b9a[_0x5e6e('0x17')]));_0x4e7b9a[_0x5e6e('0x4f')](_0x4e7b9a[_0x5e6e('0x41')],_0x4e7b9a[_0x5e6e('0x42')],parseInt(_0x4e7b9a['priority'],0xa)+0x1);_0x4e7b9a[_0x5e6e('0x51')]();}}else{logger[_0x5e6e('0xc')](util[_0x5e6e('0x11')](_0x5e6e('0x52'),_0x4e7b9a['arg_1']));_0x4e7b9a[_0x5e6e('0x4f')](_0x4e7b9a[_0x5e6e('0x41')],_0x4e7b9a[_0x5e6e('0x42')],parseInt(_0x4e7b9a[_0x5e6e('0x43')],0xa)+0x1);_0x4e7b9a[_0x5e6e('0x51')]();}}function main(){var _0x2a7b4c;return utilLicense['getLicense']()[_0x5e6e('0x2c')](function(_0x4bc828){if(_0x4bc828){if(_0x4bc828[_0x5e6e('0x53')]){if(_0x4bc828[_0x5e6e('0x54')]&&_0x4bc828['callysquare']>0x0){logger[_0x5e6e('0x15')](util[_0x5e6e('0x11')]('[LICENSE]\x20CHANNELS:\x20%s',_0x4bc828[_0x5e6e('0x54')]));_0x2a7b4c=_0x4bc828[_0x5e6e('0x54')];}else{logger[_0x5e6e('0x15')](_0x5e6e('0x55'));}}else{logger[_0x5e6e('0x15')](_0x5e6e('0x56'));_0x2a7b4c=-0x1;}}})[_0x5e6e('0x2d')](function(_0x4072f0){logger[_0x5e6e('0xc')](_0x5e6e('0x57'),_0x4072f0[_0x5e6e('0xd')]);})['finally'](function(){var _0x3dab36=require(_0x5e6e('0x58'))(config[_0x5e6e('0xa')][_0x5e6e('0x10')],config['agi']['ip'],_0x2a7b4c);_0x3dab36['on'](_0x5e6e('0xc'),errorHandler);_0x3dab36['on'](_0x5e6e('0x59'),listeningHandler);_0x3dab36['on']('connection',connectionHandler);_0x3dab36['on'](_0x5e6e('0x51'),closeHandler);});}main(); \ No newline at end of file +var _0xc3c7=['context','extension','priority','response','result','isUndefined','toString','finally','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20found','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','./server','listening','xml2json','lodash','util','moment','../../config/environment','agi','../../config/license/util','./rpc','./mailRpc','./vertices','defaults','nextTick','error','stack','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','message','[%s]\x20%s','name','arg_1','calleridname','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','toJson','root','agicommand','hasOwnProperty','maxRetry','retry','omit','mxCell','isArray','length','source','target','addEdge','value','getSquareProject','then','catch','createSquareReport','indexOf','substring','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','sync','production','start','joinAt','YYYY-MM-DD\x20HH:mm:ss','traverseBFS','clear','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS'];(function(_0x74d1f,_0x93f9d6){var _0x1bf764=function(_0xac6dd5){while(--_0xac6dd5){_0x74d1f['push'](_0x74d1f['shift']());}};_0x1bf764(++_0x93f9d6);}(_0xc3c7,0x1cd));var _0x7c3c=function(_0x30b159,_0x3fbb50){_0x30b159=_0x30b159-0x0;var _0x23c3f9=_0xc3c7[_0x30b159];return _0x23c3f9;};'use strict';var parser=require(_0x7c3c('0x0'));var _=require(_0x7c3c('0x1'));var syncho=require('syncho');var util=require(_0x7c3c('0x2'));var moment=require(_0x7c3c('0x3'));var config=require(_0x7c3c('0x4'));var logger=require('../../config/logger')(_0x7c3c('0x5'));var utilLicense=require(_0x7c3c('0x6'));var rpc=require(_0x7c3c('0x7'));var mailRpc=require(_0x7c3c('0x8'));var Graph=require('./graph');var Vertices=require(_0x7c3c('0x9'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config['agi']=_[_0x7c3c('0xa')](config[_0x7c3c('0x5')],{'ip':'127.0.0.1','port':0x11dd});function connectionHandler(_0x18d8b2){process[_0x7c3c('0xb')](function(){syncho(function(){try{setChannelVariables(_0x18d8b2);agiHandler(_0x18d8b2);}catch(_0x843fdd){logger[_0x7c3c('0xc')](_0x843fdd[_0x7c3c('0xd')]);}});});}function listeningHandler(){console[_0x7c3c('0xe')](_0x7c3c('0xf'),config[_0x7c3c('0x5')][_0x7c3c('0x10')]);logger[_0x7c3c('0x11')](util[_0x7c3c('0x12')](_0x7c3c('0x13'),config[_0x7c3c('0x5')]['ip'],config[_0x7c3c('0x5')][_0x7c3c('0x10')]));}function errorHandler(_0xbf3ea9){if(_0xbf3ea9&&_0xbf3ea9['name']&&_0xbf3ea9[_0x7c3c('0x14')]){logger[_0x7c3c('0xc')](util['format'](_0x7c3c('0x15'),_0xbf3ea9[_0x7c3c('0x16')],_0xbf3ea9[_0x7c3c('0x14')]));}else{logger['error'](util['format']('[ERROR]\x20%s',_0xbf3ea9[_0x7c3c('0xd')]));}}function closeHandler(){logger[_0x7c3c('0x11')](util[_0x7c3c('0x12')]('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x7c3c('0x17')],this[_0x7c3c('0x18')],this[_0x7c3c('0x19')],this[_0x7c3c('0x1a')],this[_0x7c3c('0x1b')]));try{createSquareReport(this);}catch(_0x270537){logger[_0x7c3c('0xc')](_0x270537[_0x7c3c('0xd')]);}}function timeoutHandler(){logger['info'](util[_0x7c3c('0x12')](_0x7c3c('0x1c'),this[_0x7c3c('0x17')],this[_0x7c3c('0x18')],this['callerid'],this[_0x7c3c('0x1a')],this[_0x7c3c('0x1b')]));}function hangupHandler(){logger['info'](util[_0x7c3c('0x12')](_0x7c3c('0x1d'),this['arg_1'],this[_0x7c3c('0x18')],this[_0x7c3c('0x19')],this['dnid'],this['uniqueid']));this[_0x7c3c('0x1e')]=!![];}function getRoot(_0x57bbf7){return parser[_0x7c3c('0x1f')](_0x57bbf7,{'object':!![]})['mxGraphModel'][_0x7c3c('0x20')];}function addVertex(_0x5e350c,_0x236b4d,_0x3aa392){_0x236b4d[_0x7c3c('0x21')]=_0x3aa392;if(_0x236b4d[_0x7c3c('0x22')]('retry')){_0x236b4d[_0x7c3c('0x23')]=parseInt(_0x236b4d[_0x7c3c('0x24')],0xa);}_0x5e350c['addVertex'](_[_0x7c3c('0x25')](_0x236b4d,_0x7c3c('0x26')));}function initGraph(_0x550134,_0x4e552a){var _0x19b17d=new Graph();for(var _0x5bff34 in _0x550134){if(_0x550134[_0x7c3c('0x22')](_0x5bff34)){if(_[_0x7c3c('0x27')](_0x550134[_0x5bff34])){for(var _0x1dea51=0x0;_0x1dea51<_0x550134[_0x5bff34][_0x7c3c('0x28')];_0x1dea51+=0x1){addVertex(_0x19b17d,_0x550134[_0x5bff34][_0x1dea51],_0x5bff34);}}else{addVertex(_0x19b17d,_0x550134[_0x5bff34],_0x5bff34);}}}for(var _0x3d59da=0x0;_0x3d59da<_0x4e552a[_0x7c3c('0x28')];_0x3d59da+=0x1){if(_0x4e552a[_0x3d59da][_0x7c3c('0x29')]&&_0x4e552a[_0x3d59da][_0x7c3c('0x2a')]){_0x19b17d[_0x7c3c('0x2b')](_0x4e552a[_0x3d59da][_0x7c3c('0x29')],_0x4e552a[_0x3d59da]['target'],_0x4e552a[_0x3d59da][_0x7c3c('0x2c')]);}}return _0x19b17d;}function getSquareProject(_0x545e77,_0x5917cb){rpc[_0x7c3c('0x2d')](_0x545e77)[_0x7c3c('0x2e')](function(_0x1e80e1){_0x5917cb(null,_0x1e80e1);})[_0x7c3c('0x2f')](function(_0x58fff7){_0x5917cb(null,_0x58fff7);});}function createSquareReport(_0x19fba0,_0x160217){rpc[_0x7c3c('0x30')](_0x19fba0)['then'](function(_0x10324a){if(_0x160217){_0x160217(null,_0x10324a);}})[_0x7c3c('0x2f')](function(_0x4b1718){if(_0x160217){_0x160217(null,_0x4b1718);}});}function setChannelVariables(_0x3e7e2c){for(var _0x1bd5bf in _0x3e7e2c){if(_0x3e7e2c[_0x7c3c('0x22')](_0x1bd5bf)){if(_0x1bd5bf[_0x7c3c('0x31')]('agi_')===0x0){_0x3e7e2c[_0x1bd5bf[_0x7c3c('0x32')](0x4)]=_0x3e7e2c[_0x1bd5bf];delete _0x3e7e2c[_0x1bd5bf];}}}}function getLogFromObject(_0x59573f){return util['inspect'](_0x59573f,{'showHidden':![],'depth':null});}function agiHandler(_0x1ec734){var _0x1fb50d,_0x541769,_0x5c92f1,_0x102d13,_0x1567d6;logger[_0x7c3c('0x33')](_0x7c3c('0x34'),JSON[_0x7c3c('0x35')](_0x1ec734,null,0x2));logger[_0x7c3c('0x11')](util[_0x7c3c('0x12')](_0x7c3c('0x36'),_0x1ec734['arg_1'],_0x1ec734['calleridname'],_0x1ec734[_0x7c3c('0x19')],_0x1ec734['dnid'],_0x1ec734[_0x7c3c('0x1b')]));_0x1ec734['on'](_0x7c3c('0xc'),errorHandler);_0x1ec734['on'](_0x7c3c('0x37'),closeHandler);_0x1ec734['on'](_0x7c3c('0x38'),timeoutHandler);_0x1ec734['evtHangup']=![];_0x1ec734['on']('hangup',hangupHandler);var _0x32dd5c=getSquareProject[_0x7c3c('0x39')](null,_0x1ec734[_0x7c3c('0x17')]);if(_0x32dd5c){if(_0x32dd5c[_0x7c3c('0x3a')]){_0x1fb50d=getRoot(_0x32dd5c[_0x7c3c('0x3a')]);if(_0x1fb50d&&_0x1fb50d[_0x7c3c('0x3b')]){logger[_0x7c3c('0x33')]('root',JSON[_0x7c3c('0x35')](_0x1fb50d,null,0x2));_0x1ec734[_0x7c3c('0x3c')]=moment()[_0x7c3c('0x12')](_0x7c3c('0x3d'));_0x541769=initGraph(_['omit'](_0x1fb50d,_0x7c3c('0x26')),_0x1fb50d['mxCell']);_0x5c92f1=new Vertices(_0x1ec734,rpc,mailRpc);logger['info'](util['format']('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x1ec734[_0x7c3c('0x17')],_0x1ec734[_0x7c3c('0x18')],_0x1ec734['callerid'],_0x1ec734['dnid'],_0x1ec734[_0x7c3c('0x1b')]));_0x541769[_0x7c3c('0x3e')](_0x1fb50d[_0x7c3c('0x3b')]['id'],function(_0x129440){try{_0x129440=_0x5c92f1[_0x7c3c('0x3f')](_0x129440);logger[_0x7c3c('0x33')](_0x7c3c('0x40'),JSON['stringify'](_0x129440,null,0x2));if(_0x129440[_0x7c3c('0x21')]===_0x7c3c('0x41')){logger[_0x7c3c('0x11')](_0x7c3c('0x42'));_0x1ec734[_0x7c3c('0x43')]=_0x129440[_0x7c3c('0x43')]||_0x1ec734['context'];_0x1ec734[_0x7c3c('0x44')]=_0x129440[_0x7c3c('0x44')];_0x1ec734[_0x7c3c('0x45')]=_0x129440['priority']?_0x129440[_0x7c3c('0x45')]-0x1:0x1;return null;}else if(_0x129440&&_0x5c92f1[_0x129440[_0x7c3c('0x21')]]){_0x1567d6=_0x5c92f1[_0x129440[_0x7c3c('0x21')]](_0x129440);logger[_0x7c3c('0x11')](_0x7c3c('0x46'),JSON[_0x7c3c('0x35')](_0x1567d6,null,0x2));if(_0x1567d6&&_0x1567d6['code']===AGI_CODE_SUCCESS&&_0x1567d6[_0x7c3c('0x47')]!==AGI_RESULT_ERROR&&!_0x1ec734['evtHangup']){logger[_0x7c3c('0x33')](_0x7c3c('0x46'),getLogFromObject(_0x1567d6));return _[_0x7c3c('0x48')](_0x1567d6[_0x7c3c('0x47')])?null:_0x1567d6[_0x7c3c('0x47')][_0x7c3c('0x49')]();}else{logger[_0x7c3c('0xc')]('response',getLogFromObject(_0x1567d6));return null;}}else{logger[_0x7c3c('0xc')]('agicommand\x20not\x20found');return null;}}catch(_0x288eb5){logger[_0x7c3c('0xc')](_0x288eb5[_0x7c3c('0xd')]);return null;}});if(_0x1fb50d[_0x7c3c('0x4a')]){logger[_0x7c3c('0x11')](util[_0x7c3c('0x12')]('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x1ec734['arg_1'],_0x1ec734[_0x7c3c('0x18')],_0x1ec734[_0x7c3c('0x19')],_0x1ec734[_0x7c3c('0x1a')],_0x1ec734['uniqueid']));_0x541769[_0x7c3c('0x3e')](_0x1fb50d[_0x7c3c('0x4a')]['id'],function(_0x4b98de){try{_0x4b98de=_0x5c92f1[_0x7c3c('0x3f')](_0x4b98de);logger['debug'](_0x7c3c('0x40'),JSON[_0x7c3c('0x35')](_0x4b98de,null,0x2));if(_0x4b98de&&_0x5c92f1[_0x4b98de[_0x7c3c('0x21')]]){_0x1567d6=_0x5c92f1[_0x4b98de[_0x7c3c('0x21')]](_0x4b98de);if(_0x1567d6){logger[_0x7c3c('0x33')](_0x7c3c('0x46'),getLogFromObject(_0x1567d6));return _[_0x7c3c('0x48')](_0x1567d6[_0x7c3c('0x47')])?null:_0x1567d6[_0x7c3c('0x47')][_0x7c3c('0x49')]();}else{logger['error'](_0x7c3c('0x46'),getLogFromObject(_0x1567d6));return null;}}else{logger[_0x7c3c('0xc')]('agicommand\x20not\x20found');return null;}}catch(_0x298b6e){logger['error'](_0x298b6e[_0x7c3c('0xd')]);return null;}});}logger[_0x7c3c('0x11')](util[_0x7c3c('0x12')](_0x7c3c('0x4b'),_0x1ec734[_0x7c3c('0x17')],_0x1ec734[_0x7c3c('0x18')],_0x1ec734['callerid'],_0x1ec734[_0x7c3c('0x1a')],_0x1ec734[_0x7c3c('0x1b')]));logger[_0x7c3c('0x11')](util[_0x7c3c('0x12')](_0x7c3c('0x4c'),_0x1ec734['context'],_0x1ec734[_0x7c3c('0x44')],parseInt(_0x1ec734[_0x7c3c('0x45')],0xa)+0x1));_0x1ec734[_0x7c3c('0x4d')](_0x1ec734[_0x7c3c('0x43')],_0x1ec734[_0x7c3c('0x44')],parseInt(_0x1ec734[_0x7c3c('0x45')],0xa)+0x1);_0x1ec734[_0x7c3c('0x37')]();}}else{logger['error'](util['format']('Project\x20%s\x20not\x20published',_0x1ec734[_0x7c3c('0x17')]));_0x1ec734['continueAt'](_0x1ec734[_0x7c3c('0x43')],_0x1ec734[_0x7c3c('0x44')],parseInt(_0x1ec734[_0x7c3c('0x45')],0xa)+0x1);_0x1ec734[_0x7c3c('0x37')]();}}else{logger['error'](util[_0x7c3c('0x12')](_0x7c3c('0x4e'),_0x1ec734[_0x7c3c('0x17')]));_0x1ec734['continueAt'](_0x1ec734[_0x7c3c('0x43')],_0x1ec734[_0x7c3c('0x44')],parseInt(_0x1ec734['priority'],0xa)+0x1);_0x1ec734[_0x7c3c('0x37')]();}}function main(){var _0x18d4b4;return utilLicense[_0x7c3c('0x4f')]()[_0x7c3c('0x2e')](function(_0x32b4a3){if(_0x32b4a3){if(_0x32b4a3[_0x7c3c('0x50')]){if(_0x32b4a3[_0x7c3c('0x51')]&&_0x32b4a3[_0x7c3c('0x51')]>0x0){logger['info'](util[_0x7c3c('0x12')](_0x7c3c('0x52'),_0x32b4a3[_0x7c3c('0x51')]));_0x18d4b4=_0x32b4a3[_0x7c3c('0x51')];}else{logger[_0x7c3c('0x11')](_0x7c3c('0x53'));}}else{logger[_0x7c3c('0x11')](_0x7c3c('0x54'));_0x18d4b4=-0x1;}}})[_0x7c3c('0x2f')](function(_0x541b60){logger[_0x7c3c('0xc')](_0x7c3c('0x55'),_0x541b60[_0x7c3c('0xd')]);})[_0x7c3c('0x4a')](function(){var _0x147d21=require(_0x7c3c('0x56'))(config[_0x7c3c('0x5')][_0x7c3c('0x10')],config[_0x7c3c('0x5')]['ip'],_0x18d4b4);_0x147d21['on'](_0x7c3c('0xc'),errorHandler);_0x147d21['on'](_0x7c3c('0x57'),listeningHandler);_0x147d21['on']('connection',connectionHandler);_0x147d21['on'](_0x7c3c('0x37'),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 7399238..f108a34 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 _0x272c=['bluebird','jayson/promise','http','request','then','error','message','result','catch','sendMailMessage','SendMail'];(function(_0x5d9867,_0x5e9030){var _0x7d2118=function(_0x2e5149){while(--_0x2e5149){_0x5d9867['push'](_0x5d9867['shift']());}};_0x7d2118(++_0x5e9030);}(_0x272c,0x155));var _0xc272=function(_0x5ded75,_0x29be08){_0x5ded75=_0x5ded75-0x0;var _0x4e3733=_0x272c[_0x5ded75];return _0x4e3733;};'use strict';var BPromise=require(_0xc272('0x0'));var jayson=require(_0xc272('0x1'));var client=jayson['client'][_0xc272('0x2')]({'port':0x232b});function request(_0xc61b7b,_0x2beb54){return new BPromise(function(_0x367b49,_0x513e10){return client[_0xc272('0x3')](_0xc61b7b,_0x2beb54)[_0xc272('0x4')](function(_0x443d3d){if(_0x443d3d[_0xc272('0x5')]){return _0x513e10(_0x443d3d[_0xc272('0x5')][_0xc272('0x6')]);}else{return _0x367b49(_0x443d3d[_0xc272('0x7')]);}})[_0xc272('0x8')](function(_0x1dfe51){return _0x513e10(_0x1dfe51);});});}exports[_0xc272('0x9')]=function(_0x467c5f,_0x2d573b){return request(_0xc272('0xa'),{'account':_0x467c5f,'message':_0x2d573b});}; \ No newline at end of file +var _0xebe7=['error','catch','sendMailMessage','SendMail','bluebird','jayson/promise','request'];(function(_0x37c403,_0x960a9e){var _0x2452fe=function(_0x105193){while(--_0x105193){_0x37c403['push'](_0x37c403['shift']());}};_0x2452fe(++_0x960a9e);}(_0xebe7,0x17e));var _0x7ebe=function(_0x59c27a,_0x165647){_0x59c27a=_0x59c27a-0x0;var _0x462f01=_0xebe7[_0x59c27a];return _0x462f01;};'use strict';var BPromise=require(_0x7ebe('0x0'));var jayson=require(_0x7ebe('0x1'));var client=jayson['client']['http']({'port':0x232b});function request(_0x43482,_0x19a2ec){return new BPromise(function(_0x193f50,_0x41c9f8){return client[_0x7ebe('0x2')](_0x43482,_0x19a2ec)['then'](function(_0x3888f0){if(_0x3888f0[_0x7ebe('0x3')]){return _0x41c9f8(_0x3888f0[_0x7ebe('0x3')]['message']);}else{return _0x193f50(_0x3888f0['result']);}})[_0x7ebe('0x4')](function(_0x43679b){return _0x41c9f8(_0x43679b);});});}exports[_0x7ebe('0x5')]=function(_0x413ef5,_0x59fbca){return request(_0x7ebe('0x6'),{'account':_0x413ef5,'message':_0x59fbca});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 2ba2811..c8b3663 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 _0xd11d=['_transform','\x0d\x0a\x0d\x0a','_localBuffer','toString','indexOf','substring','split','slice','trim','length','emit','exports','util','call','_inBody','inherits','prototype'];(function(_0x29ce14,_0x334166){var _0x48f289=function(_0x288d11){while(--_0x288d11){_0x29ce14['push'](_0x29ce14['shift']());}};_0x48f289(++_0x334166);}(_0xd11d,0x94));var _0xdd11=function(_0x106ff7,_0x536d8c){_0x106ff7=_0x106ff7-0x0;var _0x10f25b=_0xd11d[_0x106ff7];return _0x10f25b;};'use strict';var util=require(_0xdd11('0x0'));var Transform=require('stream')['Transform'];function AGIReply(_0x1821a0){Transform[_0xdd11('0x1')](this,_0x1821a0);this['_localBuffer']='';this[_0xdd11('0x2')]=![];}util[_0xdd11('0x3')](AGIReply,Transform);AGIReply[_0xdd11('0x4')][_0xdd11('0x5')]=function(_0x51ffc4,_0x10d3f9,_0x1b257a){var _0x34a25d='\x0a',_0x486956=['\x0a\x0a',_0xdd11('0x6')],_0x67e862=-0x1,_0x7d41ba=-0x1,_0x10d15b='',_0x39f16b=0x0,_0x103143='',_0x4e435c='';this[_0xdd11('0x7')]+=_0x51ffc4[_0xdd11('0x8')]();_0x103143=this[_0xdd11('0x7')];if(!this[_0xdd11('0x2')]){_0x39f16b=0x0;while(_0x486956[_0x39f16b]){while((_0x7d41ba=_0x103143[_0xdd11('0x9')](_0x486956[_0x39f16b]))!=-0x1){_0x10d15b=_0x486956[_0x39f16b];_0x4e435c=_0x103143[_0xdd11('0xa')](0x0,_0x7d41ba);_0x103143=_0x103143[_0xdd11('0xa')](_0x7d41ba+_0x10d15b['length']);var _0x27c053=_0x4e435c[_0xdd11('0xb')](_0x34a25d),_0x5aaf8b=0x0,_0x4dc7c3={},_0xf1787a='',_0xc1a561='',_0x5b09d4=-0x1;while(_0x27c053[_0x5aaf8b]){_0x5b09d4=_0x27c053[_0x5aaf8b]['indexOf'](':');if(_0x5b09d4!=-0x1){_0xf1787a=_0x27c053[_0x5aaf8b][_0xdd11('0xc')](0x0,_0x5b09d4)[_0xdd11('0xd')]();_0xc1a561=_0x27c053[_0x5aaf8b][_0xdd11('0xc')](_0x5b09d4+0x1)[_0xdd11('0xd')]();if(_0xf1787a[_0xdd11('0xe')]>0x0){_0x4dc7c3[_0xf1787a]=_0xc1a561;}}else{}_0x5aaf8b++;}this[_0xdd11('0xf')]('headers',_0x4dc7c3);this[_0xdd11('0x2')]=!![];}_0x39f16b++;}this['_localBuffer']=_0x103143;}else{while((_0x67e862=_0x103143[_0xdd11('0x9')](_0x34a25d))!=-0x1){_0x4e435c=_0x103143[_0xdd11('0xa')](0x0,_0x67e862);this[_0xdd11('0xf')]('line',_0x4e435c);_0x103143=_0x103143[_0xdd11('0xa')](_0x67e862+_0x34a25d[_0xdd11('0xe')]);}this['_localBuffer']=_0x103143;}_0x1b257a();};module[_0xdd11('0x10')]=AGIReply; \ No newline at end of file +var _0x8729=['line','util','stream','_localBuffer','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','toString','indexOf','substring','length','slice','trim','emit'];(function(_0x4456d0,_0x109429){var _0x59210e=function(_0x234b3d){while(--_0x234b3d){_0x4456d0['push'](_0x4456d0['shift']());}};_0x59210e(++_0x109429);}(_0x8729,0x181));var _0x9872=function(_0x636c25,_0x45c026){_0x636c25=_0x636c25-0x0;var _0x1474ef=_0x8729[_0x636c25];return _0x1474ef;};'use strict';var util=require(_0x9872('0x0'));var Transform=require(_0x9872('0x1'))['Transform'];function AGIReply(_0x1c2ffc){Transform['call'](this,_0x1c2ffc);this[_0x9872('0x2')]='';this[_0x9872('0x3')]=![];}util[_0x9872('0x4')](AGIReply,Transform);AGIReply[_0x9872('0x5')][_0x9872('0x6')]=function(_0x1fcc84,_0x4e3eb8,_0x7ef701){var _0x33402e='\x0a',_0x233ee1=['\x0a\x0a',_0x9872('0x7')],_0x2a8e7a=-0x1,_0x14890f=-0x1,_0xb78d8d='',_0x54a76d=0x0,_0x56bb80='',_0x5e100a='';this['_localBuffer']+=_0x1fcc84[_0x9872('0x8')]();_0x56bb80=this[_0x9872('0x2')];if(!this[_0x9872('0x3')]){_0x54a76d=0x0;while(_0x233ee1[_0x54a76d]){while((_0x14890f=_0x56bb80[_0x9872('0x9')](_0x233ee1[_0x54a76d]))!=-0x1){_0xb78d8d=_0x233ee1[_0x54a76d];_0x5e100a=_0x56bb80[_0x9872('0xa')](0x0,_0x14890f);_0x56bb80=_0x56bb80[_0x9872('0xa')](_0x14890f+_0xb78d8d[_0x9872('0xb')]);var _0x39c0be=_0x5e100a['split'](_0x33402e),_0x2774b3=0x0,_0x5a6f7a={},_0x253350='',_0x5bd15e='',_0x559df0=-0x1;while(_0x39c0be[_0x2774b3]){_0x559df0=_0x39c0be[_0x2774b3]['indexOf'](':');if(_0x559df0!=-0x1){_0x253350=_0x39c0be[_0x2774b3]['slice'](0x0,_0x559df0)['trim']();_0x5bd15e=_0x39c0be[_0x2774b3][_0x9872('0xc')](_0x559df0+0x1)[_0x9872('0xd')]();if(_0x253350[_0x9872('0xb')]>0x0){_0x5a6f7a[_0x253350]=_0x5bd15e;}}else{}_0x2774b3++;}this[_0x9872('0xe')]('headers',_0x5a6f7a);this[_0x9872('0x3')]=!![];}_0x54a76d++;}this['_localBuffer']=_0x56bb80;}else{while((_0x2a8e7a=_0x56bb80[_0x9872('0x9')](_0x33402e))!=-0x1){_0x5e100a=_0x56bb80['substring'](0x0,_0x2a8e7a);this[_0x9872('0xe')](_0x9872('0xf'),_0x5e100a);_0x56bb80=_0x56bb80['substring'](_0x2a8e7a+_0x33402e[_0x9872('0xb')]);}this[_0x9872('0x2')]=_0x56bb80;}_0x7ef701();};module['exports']=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 942384b..3ea9a05 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 _0x7daa=['ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareReport','CreateSquareReport','arg_1','arg_2','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','ShowCmHopper','phone','ListId','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','lodash','util','jayson/promise','client','http','request','then','error','message','result','catch','getSquareProject','production','getMailAccountById','Smtp','name','email','getSquareProjectById','ShowVoiceQueue','getVariableById','ShowVariable','ShowSquareOdbc','getTrunkById','ShowTrunk','ShowSound','save_name','getIntervalById','ShowInterval','Interval','Intervals'];(function(_0x478cf9,_0x3d99f2){var _0x34e354=function(_0x401a8c){while(--_0x401a8c){_0x478cf9['push'](_0x478cf9['shift']());}};_0x34e354(++_0x3d99f2);}(_0x7daa,0xfa));var _0xa7da=function(_0x50523c,_0xb27ebb){_0x50523c=_0x50523c-0x0;var _0x5531ed=_0x7daa[_0x50523c];return _0x5531ed;};'use strict';var BPromise=require('bluebird');var moment=require('moment');var _=require(_0xa7da('0x0'));var util=require(_0xa7da('0x1'));var jayson=require(_0xa7da('0x2'));var client=jayson[_0xa7da('0x3')][_0xa7da('0x4')]({'port':0x2329});function request(_0x2d409e,_0x33131b){return new BPromise(function(_0x3d0f88,_0x59eeb6){return client[_0xa7da('0x5')](_0x2d409e,_0x33131b)[_0xa7da('0x6')](function(_0x2cf64e){if(_0x2cf64e[_0xa7da('0x7')]){return _0x59eeb6(_0x2cf64e[_0xa7da('0x7')][_0xa7da('0x8')]);}else{return _0x3d0f88(_0x2cf64e[_0xa7da('0x9')]);}})[_0xa7da('0xa')](function(_0x48b99f){return _0x59eeb6(_0x48b99f);});});}exports[_0xa7da('0xb')]=function(_0x4b0b09){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x4b0b09},'attributes':[_0xa7da('0xc')]}});};exports[_0xa7da('0xd')]=function(_0x26b48d){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x26b48d},'include':[{'model':'MailServerOut','as':_0xa7da('0xe')}],'attributes':['id',_0xa7da('0xf'),_0xa7da('0x10')]}});};exports[_0xa7da('0x11')]=function(_0x19933e){return request('ShowSquareProject',{'options':{'where':{'id':_0x19933e},'attributes':[_0xa7da('0xf')]}});};exports['getVoiceQueueById']=function(_0x2a8a10){return request(_0xa7da('0x12'),{'options':{'where':{'id':_0x2a8a10},'attributes':[_0xa7da('0xf')]}});};exports[_0xa7da('0x13')]=function(_0x4bf415){return request(_0xa7da('0x14'),{'options':{'where':{'id':_0x4bf415},'attributes':['name']}});};exports['getSquareOdbcById']=function(_0x40d57f){return request(_0xa7da('0x15'),{'options':{'where':{'id':_0x40d57f},'attributes':['dsn']}});};exports['getUserById']=function(_0x3949e9){return request('ShowUser',{'options':{'where':{'id':_0x3949e9},'attributes':[_0xa7da('0xf')]}});};exports[_0xa7da('0x16')]=function(_0x13a29d){return request(_0xa7da('0x17'),{'options':{'where':{'id':_0x13a29d},'attributes':[_0xa7da('0xf')]}});};exports['getSoundById']=function(_0x5e27fb){return request(_0xa7da('0x18'),{'options':{'where':{'id':_0x5e27fb},'attributes':[_0xa7da('0x19')]}});};exports[_0xa7da('0x1a')]=function(_0x17402f){return request(_0xa7da('0x1b'),{'options':{'raw':![],'where':{'id':_0x17402f},'include':[{'model':_0xa7da('0x1c'),'as':_0xa7da('0x1d')}]}});};exports['getSmsAccountById']=function(_0x38fda4){return request(_0xa7da('0x1e'),{'options':{'where':{'id':_0x38fda4},'attributes':['id',_0xa7da('0xf')]}});};exports[_0xa7da('0x1f')]=function(_0x2692eb){return request(_0xa7da('0x20'),{'body':_0x2692eb});};exports['createSquareDetailsReport']=function(_0x539444){return request('CreateSquareDetailsReport',{'body':_0x539444});};exports[_0xa7da('0x21')]=function(_0x41204c){return request(_0xa7da('0x22'),{'body':_['merge'](_0x41204c,{'project_name':_0x41204c[_0xa7da('0x23')],'prev_project_name':_0x41204c[_0xa7da('0x24')]||'','is_subproject':_0x41204c[_0xa7da('0x24')]?!![]:![],'leaveAt':moment()['format'](_0xa7da('0x25'))})});};exports[_0xa7da('0x26')]=function(_0x58e696){return request(_0xa7da('0x27'),{'body':_0x58e696});};exports[_0xa7da('0x28')]=function(_0x5a9b97){return request(_0xa7da('0x29'),{'body':_0x5a9b97});};exports['createCmContact']=function(_0x10880c){return request(_0xa7da('0x2a'),{'options':{'raw':![],'where':{'phone':_0x10880c[_0xa7da('0x2b')],'ListId':_0x10880c[_0xa7da('0x2c')]}}})['then'](function(_0x3706e6){if(_0x3706e6){return _0x3706e6;}return request(_0xa7da('0x2d'),{'body':_0x10880c});});};exports[_0xa7da('0x2e')]=function(_0x2f177d){return request(_0xa7da('0x2f'),{'options':{'where':{'id':_0x2f177d},'attributes':[_0xa7da('0xf')]}});};exports[_0xa7da('0x30')]=function(_0x3ab2da,_0x99e896){return request(_0xa7da('0x31'),{'body':{'interface':_0x99e896},'options':{'where':_0x3ab2da}});};exports[_0xa7da('0x32')]=function(_0x83f8a3,_0x42fede,_0x4a26dd){return request(_0xa7da('0x33'),{'body':{'type':_0x42fede,'uniqueid':_0x4a26dd},'options':{'where':_0x83f8a3}});};exports[_0xa7da('0x34')]=function(_0x2485ef){return request(_0xa7da('0x35'),{'body':{},'options':{'where':_0x2485ef}});};exports[_0xa7da('0x36')]=function(_0x209716){return request(_0xa7da('0x37'),{'body':{},'options':{'where':_0x209716}});}; \ No newline at end of file +var _0x2d6b=['getSoundById','save_name','getIntervalById','ShowInterval','Interval','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','phone','ListId','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','LogoutUser','bluebird','moment','lodash','util','jayson/promise','client','then','result','getSquareProject','ShowSquareProject','production','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','name','getVariableById','ShowVariable','getSquareOdbcById','ShowUser','getTrunkById','ShowTrunk'];(function(_0x459d6b,_0x2454f2){var _0x4afdc5=function(_0x1c30bd){while(--_0x1c30bd){_0x459d6b['push'](_0x459d6b['shift']());}};_0x4afdc5(++_0x2454f2);}(_0x2d6b,0x103));var _0xb2d6=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0x2d6b[_0x2235bf];return _0x4c3a64;};'use strict';var BPromise=require(_0xb2d6('0x0'));var moment=require(_0xb2d6('0x1'));var _=require(_0xb2d6('0x2'));var util=require(_0xb2d6('0x3'));var jayson=require(_0xb2d6('0x4'));var client=jayson[_0xb2d6('0x5')]['http']({'port':0x2329});function request(_0x2e9c99,_0x12b1ee){return new BPromise(function(_0x2706ab,_0xd0437e){return client['request'](_0x2e9c99,_0x12b1ee)[_0xb2d6('0x6')](function(_0x2ab614){if(_0x2ab614['error']){return _0xd0437e(_0x2ab614['error']['message']);}else{return _0x2706ab(_0x2ab614[_0xb2d6('0x7')]);}})['catch'](function(_0x99464a){return _0xd0437e(_0x99464a);});});}exports[_0xb2d6('0x8')]=function(_0x521ec6){return request(_0xb2d6('0x9'),{'options':{'raw':![],'where':{'name':_0x521ec6},'attributes':[_0xb2d6('0xa')]}});};exports[_0xb2d6('0xb')]=function(_0x1ba148){return request(_0xb2d6('0xc'),{'options':{'raw':![],'where':{'id':_0x1ba148},'include':[{'model':_0xb2d6('0xd'),'as':_0xb2d6('0xe')}],'attributes':['id','name',_0xb2d6('0xf')]}});};exports[_0xb2d6('0x10')]=function(_0x450a87){return request(_0xb2d6('0x9'),{'options':{'where':{'id':_0x450a87},'attributes':['name']}});};exports[_0xb2d6('0x11')]=function(_0x8f13e3){return request(_0xb2d6('0x12'),{'options':{'where':{'id':_0x8f13e3},'attributes':[_0xb2d6('0x13')]}});};exports[_0xb2d6('0x14')]=function(_0x56a882){return request(_0xb2d6('0x15'),{'options':{'where':{'id':_0x56a882},'attributes':[_0xb2d6('0x13')]}});};exports[_0xb2d6('0x16')]=function(_0x2a12a1){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x2a12a1},'attributes':['dsn']}});};exports['getUserById']=function(_0x2d4db7){return request(_0xb2d6('0x17'),{'options':{'where':{'id':_0x2d4db7},'attributes':['name']}});};exports[_0xb2d6('0x18')]=function(_0x3bd288){return request(_0xb2d6('0x19'),{'options':{'where':{'id':_0x3bd288},'attributes':[_0xb2d6('0x13')]}});};exports[_0xb2d6('0x1a')]=function(_0x150694){return request('ShowSound',{'options':{'where':{'id':_0x150694},'attributes':[_0xb2d6('0x1b')]}});};exports[_0xb2d6('0x1c')]=function(_0x28b8a4){return request(_0xb2d6('0x1d'),{'options':{'raw':![],'where':{'id':_0x28b8a4},'include':[{'model':_0xb2d6('0x1e'),'as':'Intervals'}]}});};exports[_0xb2d6('0x1f')]=function(_0x37fe10){return request(_0xb2d6('0x20'),{'options':{'where':{'id':_0x37fe10},'attributes':['id',_0xb2d6('0x13')]}});};exports[_0xb2d6('0x21')]=function(_0x4c26b9){return request(_0xb2d6('0x22'),{'body':_0x4c26b9});};exports[_0xb2d6('0x23')]=function(_0x24847b){return request('CreateSquareDetailsReport',{'body':_0x24847b});};exports[_0xb2d6('0x24')]=function(_0x5dc1b5){return request(_0xb2d6('0x25'),{'body':_[_0xb2d6('0x26')](_0x5dc1b5,{'project_name':_0x5dc1b5[_0xb2d6('0x27')],'prev_project_name':_0x5dc1b5[_0xb2d6('0x28')]||'','is_subproject':_0x5dc1b5[_0xb2d6('0x28')]?!![]:![],'leaveAt':moment()['format'](_0xb2d6('0x29'))})});};exports[_0xb2d6('0x2a')]=function(_0x54a644){return request(_0xb2d6('0x2b'),{'body':_0x54a644});};exports[_0xb2d6('0x2c')]=function(_0x10c456){return request(_0xb2d6('0x2d'),{'body':_0x10c456});};exports[_0xb2d6('0x2e')]=function(_0x3798e1){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x3798e1[_0xb2d6('0x2f')],'ListId':_0x3798e1[_0xb2d6('0x30')]}}})['then'](function(_0xcf2bf4){if(_0xcf2bf4){return _0xcf2bf4;}return request(_0xb2d6('0x31'),{'body':_0x3798e1});});};exports[_0xb2d6('0x32')]=function(_0x37b65e){return request(_0xb2d6('0x33'),{'options':{'where':{'id':_0x37b65e},'attributes':[_0xb2d6('0x13')]}});};exports[_0xb2d6('0x34')]=function(_0x4afaa,_0x4713a8){return request(_0xb2d6('0x35'),{'body':{'interface':_0x4713a8},'options':{'where':_0x4afaa}});};exports[_0xb2d6('0x36')]=function(_0x42bf5c,_0x657e5b,_0x2d9567){return request(_0xb2d6('0x37'),{'body':{'type':_0x657e5b,'uniqueid':_0x2d9567},'options':{'where':_0x42bf5c}});};exports['agentUnpause']=function(_0x41bf10){return request('UnpauseUser',{'body':{},'options':{'where':_0x41bf10}});};exports['agentLogout']=function(_0x219023){return request(_0xb2d6('0x38'),{'body':{},'options':{'where':_0x219023}});}; \ 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 aaac228..f9209fa 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 _0x9e8a=['exports','./polly','./lex'];(function(_0x42bc89,_0x3d4cea){var _0x45875b=function(_0x5afe14){while(--_0x5afe14){_0x42bc89['push'](_0x42bc89['shift']());}};_0x45875b(++_0x3d4cea);}(_0x9e8a,0x112));var _0xa9e8=function(_0x540231,_0x117b98){_0x540231=_0x540231-0x0;var _0x31334b=_0x9e8a[_0x540231];return _0x31334b;};var polly=require(_0xa9e8('0x0'));var lex=require(_0xa9e8('0x1'));module[_0xa9e8('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0xab36=['./lex','exports','./polly'];(function(_0x40b3f2,_0x2c4f5f){var _0x4ce90c=function(_0x516f31){while(--_0x516f31){_0x40b3f2['push'](_0x40b3f2['shift']());}};_0x4ce90c(++_0x2c4f5f);}(_0xab36,0x1df));var _0x6ab3=function(_0xbba61d,_0x3359c4){_0xbba61d=_0xbba61d-0x0;var _0x3ee666=_0xab36[_0xbba61d];return _0x3ee666;};var polly=require(_0x6ab3('0x0'));var lex=require(_0x6ab3('0x1'));module[_0x6ab3('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 6071a8a..4729896 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 _0xaa88=['exports','./lib/api'];(function(_0x4af779,_0x3b166a){var _0x40a990=function(_0x5e6ff4){while(--_0x5e6ff4){_0x4af779['push'](_0x4af779['shift']());}};_0x40a990(++_0x3b166a);}(_0xaa88,0x137));var _0x8aa8=function(_0xe66cf2,_0x32ba5f){_0xe66cf2=_0xe66cf2-0x0;var _0x2d84e7=_0xaa88[_0xe66cf2];return _0x2d84e7;};'use strict';var lex=require(_0x8aa8('0x0'));module[_0x8aa8('0x1')]=function(_0x1643a6,_0x51c79b,_0x4aee38,_0x4ba9dd,_0x3a5b12,_0x43f7e4){return lex(_0x1643a6,_0x51c79b,_0x4aee38,_0x4ba9dd,_0x3a5b12,_0x43f7e4);}; \ No newline at end of file +var _0x5ff3=['exports'];(function(_0x126864,_0x4dfe8b){var _0x180277=function(_0x1b0e6c){while(--_0x1b0e6c){_0x126864['push'](_0x126864['shift']());}};_0x180277(++_0x4dfe8b);}(_0x5ff3,0x17d));var _0x35ff=function(_0xda0c5,_0x27741e){_0xda0c5=_0xda0c5-0x0;var _0x4430b1=_0x5ff3[_0xda0c5];return _0x4430b1;};'use strict';var lex=require('./lib/api');module[_0x35ff('0x0')]=function(_0x48cbf7,_0x1763a,_0x47c98d,_0x380f54,_0x1bb200,_0x3bd66a){return lex(_0x48cbf7,_0x1763a,_0x47c98d,_0x380f54,_0x1bb200,_0x3bd66a);}; \ 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 798a575..7923da2 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(_0x4f507a,_0x37c8bd){var _0x5066ed=function(_0x1745ca){while(--_0x1745ca){_0x4f507a['push'](_0x4f507a['shift']());}};_0x5066ed(++_0x37c8bd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'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(_0x462f68,_0x39adb8){var _0x230076=function(_0x2b8bce){while(--_0x2b8bce){_0x462f68['push'](_0x462f68['shift']());}};_0x230076(++_0x39adb8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'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 fad3ef2..18e31e1 100644 --- a/server/services/agi/scripts/aws/polly/index.js +++ b/server/services/agi/scripts/aws/polly/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -'use strict';var polly=require('./lib/api');module['exports']=function(_0x45192d,_0x2cfe59,_0x1ce22e,_0x318d0d,_0x32d59c,_0x1c8354,_0x17edd0){return polly(_0x45192d,_0x2cfe59,_0x1ce22e,_0x318d0d,_0x32d59c,_0x1c8354,_0x17edd0);}; \ No newline at end of file +var _0x89f1=['exports','./lib/api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x89f1,0xbf));var _0x189f=function(_0x319f60,_0x4f36b0){_0x319f60=_0x319f60-0x0;var _0x1d4491=_0x89f1[_0x319f60];return _0x1d4491;};'use strict';var polly=require(_0x189f('0x0'));module[_0x189f('0x1')]=function(_0x2c99b6,_0x3e936a,_0x2018bc,_0x14437b,_0x4631ab,_0xa7281a,_0x4f358c){return polly(_0x2c99b6,_0x3e936a,_0x2018bc,_0x14437b,_0x4631ab,_0xa7281a,_0x4f358c);}; \ 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 5e1e290..fdcb938 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 _0x1670=['writeFile','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','mp3','path','bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream'];(function(_0x3e112d,_0x2bb132){var _0x531c31=function(_0x1954bc){while(--_0x1954bc){_0x3e112d['push'](_0x3e112d['shift']());}};_0x531c31(++_0x2bb132);}(_0x1670,0x165));var _0x0167=function(_0x185d2a,_0x308609){_0x185d2a=_0x185d2a-0x0;var _0x4dea27=_0x1670[_0x185d2a];return _0x4dea27;};'use strict';var fs=require('fs');var path=require(_0x0167('0x0'));var BPromise=require(_0x0167('0x1'));var rs=require(_0x0167('0x2'));var AWS=require(_0x0167('0x3'));function pollyResult(_0x598f6b,_0x335e77,_0x44577b){return new BPromise(function(_0x4de25b,_0x2dd45a){_0x598f6b[_0x0167('0x4')](_0x335e77,function(_0x384c0e,_0x4ed1dd){if(_0x384c0e){_0x2dd45a(_0x384c0e);}else if(_0x4ed1dd){if(_0x4ed1dd[_0x0167('0x5')]instanceof Buffer){fs[_0x0167('0x6')](_0x44577b,_0x4ed1dd[_0x0167('0x5')],function(_0x34d33e){if(_0x34d33e){_0x2dd45a(_0x34d33e);}else{_0x4de25b();}});}else{_0x2dd45a(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x2dd45a(new Error(_0x0167('0x7')));}});});}module[_0x0167('0x8')]=function(_0x85850d,_0x216f56,_0x1ed130,_0x283199,_0x4dbba9,_0x2a899f,_0x4ae5a5){var _0xa8dae2=new AWS[(_0x0167('0x9'))]({'accessKeyId':_0x85850d,'secretAccessKey':_0x216f56,'region':_0x1ed130});var _0x1eae55={'Text':_0x4dbba9,'TextType':_0x2a899f||'text','OutputFormat':_0x0167('0xa'),'VoiceId':_0x283199};return pollyResult(_0xa8dae2,_0x1eae55,_0x4ae5a5);}; \ No newline at end of file +var _0x0551=['path','bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','Polly'];(function(_0x2e78f1,_0x1e53e7){var _0x1cfdf0=function(_0x256ba5){while(--_0x256ba5){_0x2e78f1['push'](_0x2e78f1['shift']());}};_0x1cfdf0(++_0x1e53e7);}(_0x0551,0x118));var _0x1055=function(_0x5dee43,_0x35aa9b){_0x5dee43=_0x5dee43-0x0;var _0x3bcfb0=_0x0551[_0x5dee43];return _0x3bcfb0;};'use strict';var fs=require('fs');var path=require(_0x1055('0x0'));var BPromise=require(_0x1055('0x1'));var rs=require(_0x1055('0x2'));var AWS=require(_0x1055('0x3'));function pollyResult(_0x5df5b3,_0x539087,_0x42e00f){return new BPromise(function(_0x334414,_0x308a12){_0x5df5b3[_0x1055('0x4')](_0x539087,function(_0x1ecc03,_0x11d849){if(_0x1ecc03){_0x308a12(_0x1ecc03);}else if(_0x11d849){if(_0x11d849[_0x1055('0x5')]instanceof Buffer){fs[_0x1055('0x6')](_0x42e00f,_0x11d849[_0x1055('0x5')],function(_0x165caf){if(_0x165caf){_0x308a12(_0x165caf);}else{_0x334414();}});}else{_0x308a12(new Error(_0x1055('0x7')));}}else{_0x308a12(new Error(_0x1055('0x8')));}});});}module['exports']=function(_0x5b14fd,_0x154d9e,_0x3efc7b,_0x7a4065,_0x14bcdc,_0x38dba5,_0x2f3c3d){var _0x1a559e=new AWS[(_0x1055('0x9'))]({'accessKeyId':_0x5b14fd,'secretAccessKey':_0x154d9e,'region':_0x3efc7b});var _0x220523={'Text':_0x14bcdc,'TextType':_0x38dba5||'text','OutputFormat':'mp3','VoiceId':_0x7a4065};return pollyResult(_0x1a559e,_0x220523,_0x2f3c3d);}; \ 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 3193c29..fe27a8b 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 _0xcacc=['./lib/api','exports'];(function(_0x4223a5,_0x30a74b){var _0x40dfb8=function(_0x39a921){while(--_0x39a921){_0x4223a5['push'](_0x4223a5['shift']());}};_0x40dfb8(++_0x30a74b);}(_0xcacc,0x74));var _0xccac=function(_0x11c86e,_0x577687){_0x11c86e=_0x11c86e-0x0;var _0x2a141a=_0xcacc[_0x11c86e];return _0x2a141a;};'use strict';var asr=require(_0xccac('0x0'));module[_0xccac('0x1')]=function(_0x106ace,_0x391bf3,_0xe2d5cb,_0x518305){return asr(_0x106ace,_0x391bf3,_0xe2d5cb);}; \ No newline at end of file +var _0x0260=['./lib/api','exports'];(function(_0x5ecbe8,_0x42522f){var _0x1c6e21=function(_0x593f92){while(--_0x593f92){_0x5ecbe8['push'](_0x5ecbe8['shift']());}};_0x1c6e21(++_0x42522f);}(_0x0260,0x1c4));var _0x0026=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0x0260[_0x164eca];return _0x2ce562;};'use strict';var asr=require(_0x0026('0x0'));module[_0x0026('0x1')]=function(_0x2f620b,_0xb77827,_0x43e512,_0x4113bf){return asr(_0x2f620b,_0xb77827,_0x43e512);}; \ 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 f906770..f34c3bf 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 _0xad95=['/v1/speech:recognize?key=','8000','url','bluebird','https://speech.googleapis.com','length','key\x20should\x20be\x20a\x20string','undefined','string','readFileSync','POST'];(function(_0x286639,_0x1bf3dc){var _0x21e141=function(_0x2352bd){while(--_0x2352bd){_0x286639['push'](_0x286639['shift']());}};_0x21e141(++_0x1bf3dc);}(_0xad95,0x70));var _0x5ad9=function(_0x36645a,_0x2221ba){_0x36645a=_0x36645a-0x0;var _0x2a8998=_0xad95[_0x36645a];return _0x2a8998;};'use strict';var url=require(_0x5ad9('0x0'));var BPromise=require(_0x5ad9('0x1'));var fs=require('fs');var host=_0x5ad9('0x2');module['exports']=function(_0x52ad89,_0x409d5b,_0x235c61){return new BPromise(function(_0x59809d,_0x5c9fd6){var _0x185bff;if(typeof _0x52ad89!=='string'||_0x52ad89['length']===0x0){return _0x5c9fd6('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x409d5b!=='string'||_0x409d5b[_0x5ad9('0x3')]===0x0){return _0x5c9fd6(_0x5ad9('0x4'));}if(typeof _0x235c61!==_0x5ad9('0x5')&&(typeof _0x235c61!==_0x5ad9('0x6')||_0x235c61[_0x5ad9('0x3')]===0x0)){return _0x5c9fd6('lang\x20should\x20be\x20a\x20string');}try{_0x185bff=fs[_0x5ad9('0x7')](_0x52ad89)['toString']('base64');}catch(_0x301e69){return _0x5c9fd6(_0x301e69);}return _0x59809d({'method':_0x5ad9('0x8'),'uri':host+_0x5ad9('0x9')+_0x409d5b,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':_0x5ad9('0xa'),'languageCode':_0x235c61},'audio':{'content':_0x185bff}},'json':!![]});});}; \ No newline at end of file +var _0xde2c=['LINEAR16','url','bluebird','https://speech.googleapis.com','exports','string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined','readFileSync','toString','POST','/v1/speech:recognize?key='];(function(_0x3a7fe5,_0x500ea4){var _0x5aa050=function(_0x24547b){while(--_0x24547b){_0x3a7fe5['push'](_0x3a7fe5['shift']());}};_0x5aa050(++_0x500ea4);}(_0xde2c,0x7f));var _0xcde2=function(_0xab9f3d,_0xb336fa){_0xab9f3d=_0xab9f3d-0x0;var _0x5283bf=_0xde2c[_0xab9f3d];return _0x5283bf;};'use strict';var url=require(_0xcde2('0x0'));var BPromise=require(_0xcde2('0x1'));var fs=require('fs');var host=_0xcde2('0x2');module[_0xcde2('0x3')]=function(_0x7595ed,_0x40fa0a,_0x33bb0c){return new BPromise(function(_0x3a309f,_0x55c175){var _0x4353c8;if(typeof _0x7595ed!==_0xcde2('0x4')||_0x7595ed[_0xcde2('0x5')]===0x0){return _0x55c175(_0xcde2('0x6'));}if(typeof _0x40fa0a!==_0xcde2('0x4')||_0x40fa0a['length']===0x0){return _0x55c175(_0xcde2('0x7'));}if(typeof _0x33bb0c!==_0xcde2('0x8')&&(typeof _0x33bb0c!==_0xcde2('0x4')||_0x33bb0c['length']===0x0)){return _0x55c175('lang\x20should\x20be\x20a\x20string');}try{_0x4353c8=fs[_0xcde2('0x9')](_0x7595ed)[_0xcde2('0xa')]('base64');}catch(_0x181a73){return _0x55c175(_0x181a73);}return _0x3a309f({'method':_0xcde2('0xb'),'uri':host+_0xcde2('0xc')+_0x40fa0a,'body':{'config':{'encoding':_0xcde2('0xd'),'sampleRateHertz':'8000','languageCode':_0x33bb0c},'audio':{'content':_0x4353c8}},'json':!![]});});}; \ No newline at end of file diff --git a/server/services/agi/scripts/google/index.js b/server/services/agi/scripts/google/index.js index 96d1274..e5aa3c2 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 _0xa04c=['./asr','exports'];(function(_0x6ce342,_0x1882d6){var _0x2adb0d=function(_0x1ac32a){while(--_0x1ac32a){_0x6ce342['push'](_0x6ce342['shift']());}};_0x2adb0d(++_0x1882d6);}(_0xa04c,0x196));var _0xca04=function(_0x1d10f5,_0x554f47){_0x1d10f5=_0x1d10f5-0x0;var _0x2b5b53=_0xa04c[_0x1d10f5];return _0x2b5b53;};var asr=require(_0xca04('0x0'));module[_0xca04('0x1')]={'asr':asr}; \ No newline at end of file +var _0x2260=['exports'];(function(_0x58381c,_0x3b9374){var _0x1a7440=function(_0x2bc7f1){while(--_0x2bc7f1){_0x58381c['push'](_0x58381c['shift']());}};_0x1a7440(++_0x3b9374);}(_0x2260,0xf0));var _0x0226=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x2260[_0x422905];return _0x33dc6c;};var asr=require('./asr');module[_0x0226('0x0')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index b6f8e1c..d974e33 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 _0xb8e8=['googleDialogflow','textRequest','result','source','resolvedQuery','actionIncomplete','fulfillment','speech','status','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','replace','detectIntent','action','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','intent','languageCode','queryText','responseId','intentDetectionConfidence','fulfillmentText','tildeASR','Tilde\x20ASR\x20confidence','awsPolly','awsLex','lex','ispeechTTS','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','freeform=3','sestekNDA','nda','CustomAction','channelData','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','bluebird','http','https','md5','path','querystring','randomstring','sox','url','parse','util','./google','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','WHAT_EVER','get','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','close','error','unlink','download\x20error','pipe','end','statusCode','error\x20convert','info','finish\x20to\x20convert','resolve','generate','.wav','writeFileSync','base64','then','chmodSync','split','toString','googleCloudTTS','?key=','ssml','input','voice','audioConfig','POST','tmp','.mp3','audioContent','777','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','stringify','jQ1olc','null','parse\x20response\x20failed:\x0a','data','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','goggleTTS\x20path','googleASR','uri','map','transcript','alternatives','join','results','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','name'];(function(_0x42bd9f,_0x1d5404){var _0x403266=function(_0x88b361){while(--_0x88b361){_0x42bd9f['push'](_0x42bd9f['shift']());}};_0x403266(++_0x1d5404);}(_0xb8e8,0x134));var _0x8b8e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xb8e8[_0x5b644e];return _0x49c6bf;};'use strict';var apiai=require(_0x8b8e('0x0'));var BPromise=require(_0x8b8e('0x1'));var dialogflow=require('dialogflow');var fs=require('fs');var http=require(_0x8b8e('0x2'));var https=require(_0x8b8e('0x3'));var md5=require(_0x8b8e('0x4'));var path=require(_0x8b8e('0x5'));var querystring=require(_0x8b8e('0x6'));var rp=require('request-promise');var rs=require(_0x8b8e('0x7'));var sox=require(_0x8b8e('0x8'));var tts=require('google-tts-api');var urlParse=require(_0x8b8e('0x9'))[_0x8b8e('0xa')];var util=require(_0x8b8e('0xb'));var aws=require('./aws');var google=require(_0x8b8e('0xc'));var sestek=require('./sestek');var tilde=require(_0x8b8e('0xd'));var logger=require(_0x8b8e('0xe'))(_0x8b8e('0xf'));var ISPEECH_API=_0x8b8e('0x10');function downloadFile(_0x3758d5,_0x40c1f5){return new BPromise(function(_0x152d57,_0x3296f9){var _0xa19373=urlParse(_0x3758d5);var _0x115482=_0xa19373[_0x8b8e('0x11')]===_0x8b8e('0x12')?https:http;var _0x25c66d={'host':_0xa19373['host'],'path':_0xa19373['path'],'headers':{'user-agent':_0x8b8e('0x13')}};_0x115482[_0x8b8e('0x14')](_0x25c66d,function(_0x461c3d){if(_0x461c3d['statusCode']!==0xc8){logger['error'](_0x8b8e('0x15')+_0x3758d5+_0x8b8e('0x16')+_0x461c3d['statusCode']+'\x20('+_0x461c3d['statusMessage']+')');_0x3296f9(new Error(_0x8b8e('0x15')+_0x3758d5+_0x8b8e('0x16')+_0x461c3d['statusCode']+'\x20('+_0x461c3d[_0x8b8e('0x17')]+')'));return;}var _0x46969a=fs[_0x8b8e('0x18')](_0x40c1f5);_0x46969a['on']('finish',function(){logger['info']('finish\x20download\x20file');_0x46969a[_0x8b8e('0x19')](_0x152d57);});_0x46969a['on'](_0x8b8e('0x1a'),function(_0x417e43){fs[_0x8b8e('0x1b')](_0x40c1f5);logger[_0x8b8e('0x1a')](_0x8b8e('0x1c'),_0x417e43);_0x3296f9(_0x417e43);});_0x461c3d[_0x8b8e('0x1d')](_0x46969a);})['on'](_0x8b8e('0x1a'),function(_0x261ea4){logger[_0x8b8e('0x1a')](_0x261ea4);_0x3296f9(_0x261ea4);})[_0x8b8e('0x1e')]();});}function uploadFile(_0xea51c0){return new BPromise(function(_0x31b09f,_0x5ceca2){var _0x2e6818=urlParse(_0xea51c0);var _0xc21ea9=_0x2e6818[_0x8b8e('0x11')]===_0x8b8e('0x12')?https:http;var _0x3ebebd={'host':_0x2e6818['host'],'path':_0x2e6818[_0x8b8e('0x5')],'headers':{'user-agent':'WHAT_EVER'}};_0xc21ea9[_0x8b8e('0x14')](_0x3ebebd,function(_0x2f0ed4){if(_0x2f0ed4['statusCode']!==0xc8){_0x5ceca2(new Error(_0x8b8e('0x15')+_0xea51c0+_0x8b8e('0x16')+_0x2f0ed4[_0x8b8e('0x1f')]+'\x20('+_0x2f0ed4[_0x8b8e('0x17')]+')'));return;}var _0x374535='';_0x2f0ed4['on']('data',function(_0x2e8e92){_0x374535+=_0x2e8e92;});_0x2f0ed4['on'](_0x8b8e('0x1e'),function(){_0x31b09f(_0x374535);});})['on']('error',function(_0x52c15e){_0x5ceca2(_0x52c15e);})[_0x8b8e('0x1e')]();});}function convertFile(_0x2e4ec3,_0x3aee4b){return new BPromise(function(_0x66e0ac,_0x3545c1){var _0x331d71=sox['transcode'](_0x2e4ec3,_0x3aee4b,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x331d71['on'](_0x8b8e('0x1a'),function(_0x4b5a63){logger[_0x8b8e('0x1a')](_0x8b8e('0x20'),_0x4b5a63);_0x3545c1(_0x4b5a63);});_0x331d71['on']('end',function(){logger[_0x8b8e('0x21')](_0x8b8e('0x22'));_0x66e0ac();});_0x331d71['start']();});}function base64Decode(_0x2dfebb,_0x29bb44){var _0x5b34dc=path[_0x8b8e('0x23')](__dirname,'tmp',rs[_0x8b8e('0x24')](0x4)+_0x8b8e('0x25'));fs[_0x8b8e('0x26')](_0x5b34dc,_0x2dfebb,_0x8b8e('0x27'));return convertFile(_0x5b34dc,_0x29bb44)[_0x8b8e('0x28')](function(){try{fs[_0x8b8e('0x1b')](_0x5b34dc);fs[_0x8b8e('0x29')](_0x29bb44,'777');}catch(_0x461cde){logger[_0x8b8e('0x1a')](_0x461cde);}return _0x29bb44[_0x8b8e('0x2a')]('.')[0x0];});}function base64Encode(_0x1ffe11){var _0x3d21ea=fs['readFileSync'](_0x1ffe11);return new Buffer(_0x3d21ea)[_0x8b8e('0x2b')](_0x8b8e('0x27'));}exports[_0x8b8e('0x2c')]=function(_0x331d7f,_0x23a5c6,_0x378b00,_0x3e255a,_0x1b3b01,_0x32c605){var _0x24853b,_0x58476e;var _0x1ebec8='https://texttospeech.googleapis.com/v1/';var _0x29e7f7=_0x8b8e('0x2d')+_0x331d7f;var _0x237a10={};if(_0x23a5c6===_0x8b8e('0x2e')){_0x237a10[_0x8b8e('0x2f')]={'ssml':_0x378b00};}else{_0x237a10['input']={'text':_0x378b00};};_0x237a10[_0x8b8e('0x30')]={'languageCode':_0x3e255a,'ssmlGender':_0x1b3b01};_0x237a10[_0x8b8e('0x31')]={'audioEncoding':'MP3','sampleRateHertz':0x1f40};var _0x54cd90={'url':_0x1ebec8+'text:synthesize'+_0x29e7f7,'method':_0x8b8e('0x32'),'json':!![],'body':_0x237a10};return rp(_0x54cd90)[_0x8b8e('0x28')](function(_0x298d98){return new BPromise(function(_0x43b577,_0x2f0d1f){_0x24853b=path[_0x8b8e('0x23')](__dirname,_0x8b8e('0x33'),rs[_0x8b8e('0x24')](0x4)+_0x8b8e('0x34'));var _0xdeb104=Buffer['from'](_0x298d98[_0x8b8e('0x35')],'base64');return fs['writeFile'](_0x24853b,_0xdeb104,function(_0x165ffc){_0x2f0d1f(_0x165ffc);},function(_0x2a3372){fs['chmodSync'](_0x24853b,'777');_0x43b577(_0x2a3372);});});})[_0x8b8e('0x28')](function(_0x58a5cc){_0x58476e=path[_0x8b8e('0x23')](__dirname,'tmp',rs['generate'](0x4)+_0x8b8e('0x25'));return convertFile(_0x24853b,_0x58476e);})[_0x8b8e('0x28')](function(){try{fs[_0x8b8e('0x1b')](_0x24853b);fs[_0x8b8e('0x29')](_0x58476e,_0x8b8e('0x36'));}catch(_0x1c7848){logger['error'](_0x1c7848);}logger[_0x8b8e('0x21')](_0x8b8e('0x37'),_0x58476e['split']('.')[0x0]);return _0x58476e[_0x8b8e('0x2a')]('.')[0x0];});};exports[_0x8b8e('0x38')]=function(_0x1e7161,_0x596ddd){var _0x20bd53=_0x8b8e('0x39');var _0x5bc68c,_0x254011;var _0x25af04;var _0x1a165={'encoding':_0x8b8e('0x3a'),'method':_0x8b8e('0x32'),'timeout':0x2710,'url':_0x20bd53,'headers':{'Content-Type':_0x8b8e('0x3b')},'body':'f.req='+encodeURIComponent(JSON[_0x8b8e('0x3c')]([[[_0x8b8e('0x3d'),JSON[_0x8b8e('0x3c')]([_0x1e7161,_0x596ddd||'en',![],_0x8b8e('0x3e')]),null,'generic']]]))};return rp(_0x1a165)[_0x8b8e('0x28')](function(_0x1b6c98){try{_0x25af04=eval(_0x1b6c98['slice'](0x5))[0x0][0x2];}catch(_0x33a69c){throw new Error(_0x8b8e('0x3f')+_0x1b6c98[_0x8b8e('0x40')]);}if(!_0x25af04){if(_0x1e7161[_0x8b8e('0x41')]>0xc8){throw new Error(_0x8b8e('0x42'));}else{throw new Error(_0x8b8e('0x43')+_0x596ddd+_0x8b8e('0x44'));}}try{_0x25af04=eval(_0x25af04)[0x0];}catch(_0x47b4ee){throw new Error(_0x8b8e('0x3f')+res[_0x8b8e('0x40')]);}const _0x4c9ff8=_0x25af04;_0x5bc68c=path['resolve'](__dirname,_0x8b8e('0x33'),rs[_0x8b8e('0x24')](0x4)+_0x8b8e('0x34'));fs[_0x8b8e('0x26')](_0x5bc68c,_0x25af04,{'encoding':_0x8b8e('0x27')});_0x254011=path[_0x8b8e('0x23')](__dirname,_0x8b8e('0x33'),rs[_0x8b8e('0x24')](0x4)+'.wav');return convertFile(_0x5bc68c,_0x254011);})[_0x8b8e('0x28')](function(){try{fs[_0x8b8e('0x1b')](_0x5bc68c);fs[_0x8b8e('0x29')](_0x254011,'777');}catch(_0x9664a9){logger[_0x8b8e('0x1a')](_0x9664a9);}logger[_0x8b8e('0x21')](_0x8b8e('0x45'),_0x254011['split']('.')[0x0]);return _0x254011[_0x8b8e('0x2a')]('.')[0x0];});};exports[_0x8b8e('0x46')]=function(_0x287794,_0xce8af0,_0x10558a){return google['asr'](_0x287794,_0xce8af0,_0x10558a)[_0x8b8e('0x28')](function(_0xa5a90){logger[_0x8b8e('0x21')](_0xa5a90[_0x8b8e('0x47')]);return rp(_0xa5a90);})[_0x8b8e('0x28')](function(_0x2986b0){var _0x144bfd='';var _0xc2bd85=0x0;try{fs[_0x8b8e('0x1b')](_0x287794);}catch(_0x4d571f){logger[_0x8b8e('0x1a')](_0x4d571f);}if(_0x2986b0&&_0x2986b0['results']){_0x144bfd=_0x2986b0['results'][_0x8b8e('0x48')](function(_0x2424fc){return _0x2424fc&&_0x2424fc['alternatives'][0x0]&&_0x2424fc['alternatives'][0x0][_0x8b8e('0x49')]?_0x2424fc[_0x8b8e('0x4a')][0x0][_0x8b8e('0x49')]:'';})[_0x8b8e('0x4b')]('\x0a');_0xc2bd85=_0x2986b0[_0x8b8e('0x4c')][_0x8b8e('0x48')](function(_0x315d23){return _0x315d23&&_0x315d23[_0x8b8e('0x4a')][0x0]&&_0x315d23['alternatives'][0x0][_0x8b8e('0x4d')]?_0x315d23[_0x8b8e('0x4a')][0x0]['confidence']:0x0;})[_0x8b8e('0x4b')]('\x0a');}logger[_0x8b8e('0x21')](_0x8b8e('0x4e'),_0x144bfd);logger['info'](_0x8b8e('0x4f'),_0xc2bd85);return{'transcript':_0x144bfd,'confidence':_0xc2bd85};})[_0x8b8e('0x50')](function(_0x29bcc2){logger[_0x8b8e('0x1a')]('[%s]\x20%s:%s',_0x29bcc2[_0x8b8e('0x1f')],_0x29bcc2[_0x8b8e('0x51')],_0x29bcc2['message']);});};exports[_0x8b8e('0x52')]=function(_0x11ded0,_0x25fe49,_0x56dd06,_0x301c10){var _0x25424d=apiai(_0x25fe49,{'language':_0x301c10||'en'});return _0x25424d[_0x8b8e('0x53')](_0x56dd06,{'sessionId':md5(_0x11ded0)})[_0x8b8e('0x28')](function(_0x18cd2e){logger[_0x8b8e('0x21')](JSON['stringify'](_0x18cd2e));return{'source':_0x18cd2e[_0x8b8e('0x54')][_0x8b8e('0x55')],'resolvedQuery':_0x18cd2e[_0x8b8e('0x54')][_0x8b8e('0x56')],'action':_0x18cd2e[_0x8b8e('0x54')]['action'],'actionIncomplete':_0x18cd2e[_0x8b8e('0x54')][_0x8b8e('0x57')],'speech':_0x18cd2e['result'][_0x8b8e('0x58')][_0x8b8e('0x59')],'score':_0x18cd2e['result']['score'],'statusCode':_0x18cd2e[_0x8b8e('0x5a')][_0x8b8e('0x5b')],'endConversation':_0x18cd2e[_0x8b8e('0x54')][_0x8b8e('0x5c')][_0x8b8e('0x5d')]||![],'isFallbackIntent':_0x18cd2e[_0x8b8e('0x54')][_0x8b8e('0x5c')][_0x8b8e('0x5e')]};});};exports[_0x8b8e('0x5f')]=function(_0x34942b,_0x299ebb,_0x3d2efc,_0x281335,_0x7dfd09,_0x843517){var _0x3b864c=_0x281335[_0x8b8e('0x60')](/\\n/g,'\x0a');var _0xc21d14={'credentials':{'private_key':_0x3b864c,'client_email':_0x3d2efc}};var _0x26c0a3=new dialogflow['SessionsClient'](_0xc21d14);var _0x138d27=_0x26c0a3['sessionPath'](_0x299ebb,md5(_0x34942b));var _0x6791be={'session':_0x138d27,'queryInput':{'text':{'text':_0x7dfd09,'languageCode':_0x843517}}};return _0x26c0a3[_0x8b8e('0x61')](_0x6791be)[_0x8b8e('0x28')](function(_0x466c2a){if(_0x466c2a&&_0x466c2a[_0x8b8e('0x41')]){logger[_0x8b8e('0x21')]('Dialogflow\x20V2\x20response:',JSON[_0x8b8e('0x3c')](_0x466c2a));var _0x35b521=_0x466c2a[0x0];if(_0x35b521){var _0x36440b={'action':_0x35b521['queryResult'][_0x8b8e('0x62')],'allRequiredParamsPresent':_0x35b521[_0x8b8e('0x63')][_0x8b8e('0x64')],'endConversation':_0x35b521['queryResult'][_0x8b8e('0x65')]&&_0x35b521[_0x8b8e('0x63')]['diagnosticInfo'][_0x8b8e('0x66')]?_0x35b521[_0x8b8e('0x63')][_0x8b8e('0x65')][_0x8b8e('0x66')][_0x8b8e('0x67')][_0x8b8e('0x68')]:![],'fulfillmentText':_0x35b521[_0x8b8e('0x63')]['fulfillmentText'],'intentName':_0x35b521[_0x8b8e('0x63')][_0x8b8e('0x69')]['name'],'intentDisplayName':_0x35b521[_0x8b8e('0x63')][_0x8b8e('0x69')]['displayName'],'isFallbackIntent':_0x35b521[_0x8b8e('0x63')][_0x8b8e('0x69')]['isFallback'],'languageCode':_0x35b521[_0x8b8e('0x63')][_0x8b8e('0x6a')],'queryText':_0x35b521['queryResult'][_0x8b8e('0x6b')],'responseId':_0x35b521[_0x8b8e('0x6c')],'score':_0x35b521[_0x8b8e('0x63')][_0x8b8e('0x6d')],'speech':_0x35b521[_0x8b8e('0x63')][_0x8b8e('0x6e')],'providerResponse':JSON[_0x8b8e('0x3c')](_0x466c2a)};return _0x36440b;}}});};exports[_0x8b8e('0x6f')]=function(_0x316a6a,_0x546dff,_0x13b9fd,_0x478afa){return tilde['asr'](_0x316a6a,_0x546dff,_0x13b9fd,_0x478afa)['then'](function(_0x57c46f){try{fs[_0x8b8e('0x1b')](_0x316a6a);}catch(_0x11aecf){logger['error'](_0x11aecf);}logger['info']('Tilde\x20ASR\x20transcription',_0x57c46f[_0x8b8e('0x49')]);logger[_0x8b8e('0x21')](_0x8b8e('0x70'),_0x57c46f[_0x8b8e('0x4d')]);return _0x57c46f;});};exports[_0x8b8e('0x71')]=function(_0x737ea3,_0x3ba072,_0x466a03,_0x8792f7,_0x214a0a,_0x1e7fcf){var _0x5711bd=path[_0x8b8e('0x23')](__dirname,_0x8b8e('0x33'),rs[_0x8b8e('0x24')](0x4)+'.mp3');var _0x3f7c74;return aws['polly'](_0x737ea3,_0x3ba072,_0x466a03,_0x8792f7,_0x214a0a,_0x1e7fcf,_0x5711bd)[_0x8b8e('0x28')](function(){_0x3f7c74=path[_0x8b8e('0x23')](__dirname,'tmp',rs[_0x8b8e('0x24')](0x4)+_0x8b8e('0x25'));return convertFile(_0x5711bd,_0x3f7c74);})[_0x8b8e('0x28')](function(){try{fs[_0x8b8e('0x1b')](_0x5711bd);fs['chmodSync'](_0x3f7c74,'777');}catch(_0x4c65e0){logger['error'](_0x4c65e0);}return _0x3f7c74[_0x8b8e('0x2a')]('.')[0x0];});};exports[_0x8b8e('0x72')]=function(_0x19d068,_0x3a6f74,_0x4a6928,_0x99bb,_0xb3f303,_0x4364d1){return aws[_0x8b8e('0x73')](_0x19d068,_0x3a6f74,_0x4a6928,_0x99bb,_0xb3f303,_0x4364d1)['then'](function(_0x17dc60){logger[_0x8b8e('0x21')](JSON[_0x8b8e('0x3c')](_0x17dc60));return _0x17dc60;});};exports[_0x8b8e('0x74')]=function(_0x4aa75f,_0x442eea,_0x59df7d,_0x3aac6f){var _0x6df8af=util['format'](_0x8b8e('0x75'),ISPEECH_API,_0x4aa75f,encodeURIComponent(_0x442eea),_0x59df7d,_0x3aac6f);var _0x56d179=path[_0x8b8e('0x23')](__dirname,_0x8b8e('0x33'),rs[_0x8b8e('0x24')](0x4)+_0x8b8e('0x34'));var _0xe043ed;return downloadFile(_0x6df8af,_0x56d179)[_0x8b8e('0x28')](function(){_0xe043ed=path[_0x8b8e('0x23')](__dirname,'tmp',rs[_0x8b8e('0x24')](0x4)+_0x8b8e('0x25'));return convertFile(_0x56d179,_0xe043ed);})[_0x8b8e('0x28')](function(){try{fs[_0x8b8e('0x1b')](_0x56d179);fs['chmodSync'](_0xe043ed,_0x8b8e('0x36'));}catch(_0x36730f){logger['error'](_0x36730f);}return _0xe043ed[_0x8b8e('0x2a')]('.')[0x0];});};exports[_0x8b8e('0x76')]=function(_0x27ba68,_0x725d6f,_0x9fa039,_0x11e331){var _0x133195=util['format'](_0x8b8e('0x77'),ISPEECH_API,_0x725d6f,_0x9fa039,base64Encode(_0x27ba68),_0x11e331?util['format']('model=%s',encodeURIComponent(_0x11e331)):_0x8b8e('0x78'));return uploadFile(_0x133195)[_0x8b8e('0x28')](function(_0x48a5ae){return querystring[_0x8b8e('0xa')](_0x48a5ae);});};exports[_0x8b8e('0x79')]=function(_0x108c22,_0x35cbb1){return sestek[_0x8b8e('0x7a')](_0x108c22,_0x35cbb1)[_0x8b8e('0x28')](function(_0x26fa73){logger[_0x8b8e('0x21')](JSON[_0x8b8e('0x3c')](_0x26fa73));var _0x195bb1={'speech':_0x26fa73['text'],'action':_0x26fa73['channelData']?_0x26fa73['channelData'][_0x8b8e('0x7b')]:undefined,'actiondata':_0x26fa73[_0x8b8e('0x7c')]?_0x26fa73[_0x8b8e('0x7c')][_0x8b8e('0x7d')]:undefined};if(_0x26fa73['channelData']&&_0x26fa73[_0x8b8e('0x7c')][_0x8b8e('0x7e')]){return base64Decode(_0x26fa73[_0x8b8e('0x7c')]['AudioFromTts'][_0x8b8e('0x7f')],path[_0x8b8e('0x23')](__dirname,_0x8b8e('0x33'),rs[_0x8b8e('0x24')](0x4)+_0x8b8e('0x25')))['then'](function(_0x2fcfb7){_0x195bb1[_0x8b8e('0x80')]=_0x2fcfb7;return _0x195bb1;});}return _0x195bb1;});};exports[_0x8b8e('0x81')]=function(){return __dirname;}; \ No newline at end of file +var _0xa566=['end_conversation','boolValue','fulfillmentText','intent','displayName','queryText','responseId','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','ispeechTTS','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','format','model=%s','parse','sestekNDA','nda','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','apiai-promise','bluebird','dialogflow','http','https','md5','path','querystring','randomstring','sox','google-tts-api','url','util','./aws','./google','./tilde','https:','WHAT_EVER','statusCode','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','info','close','error','unlink','download\x20error','pipe','protocol','host','get','data','end','wav','error\x20convert','start','tmp','generate','base64','then','777','split','toString','https://texttospeech.googleapis.com/v1/','input','voice','resolve','.mp3','audioContent','writeFile','chmodSync','.wav','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','POST','stringify','null','generic','slice','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','writeFileSync','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','transcript','join','confidence','catch','[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','result','source','action','actionIncomplete','speech','endConversation','metadata','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields'];(function(_0x100ea5,_0x2258d6){var _0x4ff965=function(_0x2e0059){while(--_0x2e0059){_0x100ea5['push'](_0x100ea5['shift']());}};_0x4ff965(++_0x2258d6);}(_0xa566,0x11c));var _0x6a56=function(_0x187c55,_0x14c34d){_0x187c55=_0x187c55-0x0;var _0x872437=_0xa566[_0x187c55];return _0x872437;};'use strict';var apiai=require(_0x6a56('0x0'));var BPromise=require(_0x6a56('0x1'));var dialogflow=require(_0x6a56('0x2'));var fs=require('fs');var http=require(_0x6a56('0x3'));var https=require(_0x6a56('0x4'));var md5=require(_0x6a56('0x5'));var path=require(_0x6a56('0x6'));var querystring=require(_0x6a56('0x7'));var rp=require('request-promise');var rs=require(_0x6a56('0x8'));var sox=require(_0x6a56('0x9'));var tts=require(_0x6a56('0xa'));var urlParse=require(_0x6a56('0xb'))['parse'];var util=require(_0x6a56('0xc'));var aws=require(_0x6a56('0xd'));var google=require(_0x6a56('0xe'));var sestek=require('./sestek');var tilde=require(_0x6a56('0xf'));var logger=require('../../../config/logger')('agi');var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0x315107,_0x541fd1){return new BPromise(function(_0x6bf9a7,_0x5a71ae){var _0x440bd8=urlParse(_0x315107);var _0x4e062e=_0x440bd8['protocol']===_0x6a56('0x10')?https:http;var _0x382eb3={'host':_0x440bd8['host'],'path':_0x440bd8[_0x6a56('0x6')],'headers':{'user-agent':_0x6a56('0x11')}};_0x4e062e['get'](_0x382eb3,function(_0x347536){if(_0x347536[_0x6a56('0x12')]!==0xc8){logger['error'](_0x6a56('0x13')+_0x315107+_0x6a56('0x14')+_0x347536[_0x6a56('0x12')]+'\x20('+_0x347536[_0x6a56('0x15')]+')');_0x5a71ae(new Error('request\x20to\x20'+_0x315107+'\x20failed,\x20status\x20code\x20=\x20'+_0x347536[_0x6a56('0x12')]+'\x20('+_0x347536[_0x6a56('0x15')]+')'));return;}var _0x584f73=fs[_0x6a56('0x16')](_0x541fd1);_0x584f73['on'](_0x6a56('0x17'),function(){logger[_0x6a56('0x18')]('finish\x20download\x20file');_0x584f73[_0x6a56('0x19')](_0x6bf9a7);});_0x584f73['on'](_0x6a56('0x1a'),function(_0x1496ea){fs[_0x6a56('0x1b')](_0x541fd1);logger[_0x6a56('0x1a')](_0x6a56('0x1c'),_0x1496ea);_0x5a71ae(_0x1496ea);});_0x347536[_0x6a56('0x1d')](_0x584f73);})['on'](_0x6a56('0x1a'),function(_0x467cd2){logger[_0x6a56('0x1a')](_0x467cd2);_0x5a71ae(_0x467cd2);})['end']();});}function uploadFile(_0x771103){return new BPromise(function(_0x46fbc3,_0x205a07){var _0x1efa66=urlParse(_0x771103);var _0xdae46e=_0x1efa66[_0x6a56('0x1e')]===_0x6a56('0x10')?https:http;var _0x222ee9={'host':_0x1efa66[_0x6a56('0x1f')],'path':_0x1efa66[_0x6a56('0x6')],'headers':{'user-agent':_0x6a56('0x11')}};_0xdae46e[_0x6a56('0x20')](_0x222ee9,function(_0x562159){if(_0x562159[_0x6a56('0x12')]!==0xc8){_0x205a07(new Error(_0x6a56('0x13')+_0x771103+_0x6a56('0x14')+_0x562159['statusCode']+'\x20('+_0x562159[_0x6a56('0x15')]+')'));return;}var _0x3898d6='';_0x562159['on'](_0x6a56('0x21'),function(_0x59b11d){_0x3898d6+=_0x59b11d;});_0x562159['on']('end',function(){_0x46fbc3(_0x3898d6);});})['on'](_0x6a56('0x1a'),function(_0x1ce17a){_0x205a07(_0x1ce17a);})[_0x6a56('0x22')]();});}function convertFile(_0x2be27f,_0x5148e6){return new BPromise(function(_0x5738e1,_0x2d68af){var _0x1eccff=sox['transcode'](_0x2be27f,_0x5148e6,{'sampleRate':0x1f40,'format':_0x6a56('0x23'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x1eccff['on']('error',function(_0x225251){logger['error'](_0x6a56('0x24'),_0x225251);_0x2d68af(_0x225251);});_0x1eccff['on'](_0x6a56('0x22'),function(){logger[_0x6a56('0x18')]('finish\x20to\x20convert');_0x5738e1();});_0x1eccff[_0x6a56('0x25')]();});}function base64Decode(_0x125b68,_0x1285ef){var _0x25d883=path['resolve'](__dirname,_0x6a56('0x26'),rs[_0x6a56('0x27')](0x4)+'.wav');fs['writeFileSync'](_0x25d883,_0x125b68,_0x6a56('0x28'));return convertFile(_0x25d883,_0x1285ef)[_0x6a56('0x29')](function(){try{fs[_0x6a56('0x1b')](_0x25d883);fs['chmodSync'](_0x1285ef,_0x6a56('0x2a'));}catch(_0x11ab7){logger['error'](_0x11ab7);}return _0x1285ef[_0x6a56('0x2b')]('.')[0x0];});}function base64Encode(_0x3f5596){var _0x5210ff=fs['readFileSync'](_0x3f5596);return new Buffer(_0x5210ff)[_0x6a56('0x2c')](_0x6a56('0x28'));}exports['googleCloudTTS']=function(_0xc38671,_0x7ecba7,_0x58a5f2,_0xe975be,_0x1fa7b2,_0x5a36de){var _0x28c220,_0x110e4e;var _0x38171e=_0x6a56('0x2d');var _0x5dceac='?key='+_0xc38671;var _0x4528cb={};if(_0x7ecba7==='ssml'){_0x4528cb['input']={'ssml':_0x58a5f2};}else{_0x4528cb[_0x6a56('0x2e')]={'text':_0x58a5f2};};_0x4528cb[_0x6a56('0x2f')]={'languageCode':_0xe975be,'ssmlGender':_0x1fa7b2};_0x4528cb['audioConfig']={'audioEncoding':'MP3','sampleRateHertz':0x1f40};var _0x5d0e43={'url':_0x38171e+'text:synthesize'+_0x5dceac,'method':'POST','json':!![],'body':_0x4528cb};return rp(_0x5d0e43)['then'](function(_0x36853a){return new BPromise(function(_0xf5eac,_0x94af2b){_0x28c220=path[_0x6a56('0x30')](__dirname,_0x6a56('0x26'),rs[_0x6a56('0x27')](0x4)+_0x6a56('0x31'));var _0x400c32=Buffer['from'](_0x36853a[_0x6a56('0x32')],_0x6a56('0x28'));return fs[_0x6a56('0x33')](_0x28c220,_0x400c32,function(_0x39f106){_0x94af2b(_0x39f106);},function(_0x588ed2){fs[_0x6a56('0x34')](_0x28c220,'777');_0xf5eac(_0x588ed2);});});})['then'](function(_0x4c5fc3){_0x110e4e=path[_0x6a56('0x30')](__dirname,_0x6a56('0x26'),rs['generate'](0x4)+_0x6a56('0x35'));return convertFile(_0x28c220,_0x110e4e);})['then'](function(){try{fs[_0x6a56('0x1b')](_0x28c220);fs[_0x6a56('0x34')](_0x110e4e,_0x6a56('0x2a'));}catch(_0x12a7c6){logger['error'](_0x12a7c6);}logger['info'](_0x6a56('0x36'),_0x110e4e[_0x6a56('0x2b')]('.')[0x0]);return _0x110e4e['split']('.')[0x0];});};exports[_0x6a56('0x37')]=function(_0x380058,_0x1013c7){var _0x61ce60=_0x6a56('0x38');var _0x2b5e8b,_0x137d64;var _0x51da8e;var _0x16c789={'encoding':_0x6a56('0x39'),'method':_0x6a56('0x3a'),'timeout':0x2710,'url':_0x61ce60,'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':'f.req='+encodeURIComponent(JSON[_0x6a56('0x3b')]([[['jQ1olc',JSON[_0x6a56('0x3b')]([_0x380058,_0x1013c7||'en',![],_0x6a56('0x3c')]),null,_0x6a56('0x3d')]]]))};return rp(_0x16c789)['then'](function(_0x3f2125){try{_0x51da8e=eval(_0x3f2125[_0x6a56('0x3e')](0x5))[0x0][0x2];}catch(_0x561d81){throw new Error(_0x6a56('0x3f')+_0x3f2125[_0x6a56('0x21')]);}if(!_0x51da8e){if(_0x380058[_0x6a56('0x40')]>0xc8){throw new Error(_0x6a56('0x41'));}else{throw new Error(_0x6a56('0x42')+_0x1013c7+_0x6a56('0x43'));}}try{_0x51da8e=eval(_0x51da8e)[0x0];}catch(_0x10fbe0){throw new Error(_0x6a56('0x3f')+res[_0x6a56('0x21')]);}const _0xf7df41=_0x51da8e;_0x2b5e8b=path['resolve'](__dirname,_0x6a56('0x26'),rs[_0x6a56('0x27')](0x4)+_0x6a56('0x31'));fs[_0x6a56('0x44')](_0x2b5e8b,_0x51da8e,{'encoding':_0x6a56('0x28')});_0x137d64=path['resolve'](__dirname,_0x6a56('0x26'),rs['generate'](0x4)+_0x6a56('0x35'));return convertFile(_0x2b5e8b,_0x137d64);})[_0x6a56('0x29')](function(){try{fs[_0x6a56('0x1b')](_0x2b5e8b);fs[_0x6a56('0x34')](_0x137d64,_0x6a56('0x2a'));}catch(_0xa000b6){logger[_0x6a56('0x1a')](_0xa000b6);}logger['info'](_0x6a56('0x45'),_0x137d64['split']('.')[0x0]);return _0x137d64['split']('.')[0x0];});};exports[_0x6a56('0x46')]=function(_0x145829,_0x1bfb30,_0x2f07ec){return google[_0x6a56('0x47')](_0x145829,_0x1bfb30,_0x2f07ec)[_0x6a56('0x29')](function(_0x19704e){logger[_0x6a56('0x18')](_0x19704e[_0x6a56('0x48')]);return rp(_0x19704e);})['then'](function(_0x460e92){var _0x4f7265='';var _0x57695d=0x0;try{fs[_0x6a56('0x1b')](_0x145829);}catch(_0x2eb065){logger['error'](_0x2eb065);}if(_0x460e92&&_0x460e92[_0x6a56('0x49')]){_0x4f7265=_0x460e92['results'][_0x6a56('0x4a')](function(_0x4a7bef){return _0x4a7bef&&_0x4a7bef[_0x6a56('0x4b')][0x0]&&_0x4a7bef[_0x6a56('0x4b')][0x0][_0x6a56('0x4c')]?_0x4a7bef[_0x6a56('0x4b')][0x0]['transcript']:'';})[_0x6a56('0x4d')]('\x0a');_0x57695d=_0x460e92['results'][_0x6a56('0x4a')](function(_0x360dc3){return _0x360dc3&&_0x360dc3[_0x6a56('0x4b')][0x0]&&_0x360dc3[_0x6a56('0x4b')][0x0]['confidence']?_0x360dc3[_0x6a56('0x4b')][0x0][_0x6a56('0x4e')]:0x0;})[_0x6a56('0x4d')]('\x0a');}logger[_0x6a56('0x18')]('googleASR\x20transcription',_0x4f7265);logger[_0x6a56('0x18')]('googleASR\x20confidence',_0x57695d);return{'transcript':_0x4f7265,'confidence':_0x57695d};})[_0x6a56('0x4f')](function(_0x550481){logger['error'](_0x6a56('0x50'),_0x550481[_0x6a56('0x12')],_0x550481[_0x6a56('0x51')],_0x550481[_0x6a56('0x52')]);});};exports[_0x6a56('0x53')]=function(_0xb4cfcf,_0xd1bf57,_0x2e9e4f,_0x2b2493){var _0x218947=apiai(_0xd1bf57,{'language':_0x2b2493||'en'});return _0x218947[_0x6a56('0x54')](_0x2e9e4f,{'sessionId':md5(_0xb4cfcf)})[_0x6a56('0x29')](function(_0xd09804){logger[_0x6a56('0x18')](JSON[_0x6a56('0x3b')](_0xd09804));return{'source':_0xd09804[_0x6a56('0x55')][_0x6a56('0x56')],'resolvedQuery':_0xd09804[_0x6a56('0x55')]['resolvedQuery'],'action':_0xd09804[_0x6a56('0x55')][_0x6a56('0x57')],'actionIncomplete':_0xd09804[_0x6a56('0x55')][_0x6a56('0x58')],'speech':_0xd09804[_0x6a56('0x55')]['fulfillment'][_0x6a56('0x59')],'score':_0xd09804[_0x6a56('0x55')]['score'],'statusCode':_0xd09804['status']['code'],'endConversation':_0xd09804[_0x6a56('0x55')]['metadata'][_0x6a56('0x5a')]||![],'isFallbackIntent':_0xd09804[_0x6a56('0x55')][_0x6a56('0x5b')][_0x6a56('0x5c')]};});};exports[_0x6a56('0x5d')]=function(_0x5afe3a,_0x4e822e,_0x1938fd,_0x11e4b9,_0x3a397f,_0x154c20){var _0x17b9af=_0x11e4b9[_0x6a56('0x5e')](/\\n/g,'\x0a');var _0xf69709={'credentials':{'private_key':_0x17b9af,'client_email':_0x1938fd}};var _0x23e993=new dialogflow[(_0x6a56('0x5f'))](_0xf69709);var _0x182fea=_0x23e993[_0x6a56('0x60')](_0x4e822e,md5(_0x5afe3a));var _0x527e2a={'session':_0x182fea,'queryInput':{'text':{'text':_0x3a397f,'languageCode':_0x154c20}}};return _0x23e993[_0x6a56('0x61')](_0x527e2a)[_0x6a56('0x29')](function(_0x3b85c0){if(_0x3b85c0&&_0x3b85c0[_0x6a56('0x40')]){logger['info'](_0x6a56('0x62'),JSON[_0x6a56('0x3b')](_0x3b85c0));var _0x1df530=_0x3b85c0[0x0];if(_0x1df530){var _0xd76107={'action':_0x1df530[_0x6a56('0x63')][_0x6a56('0x57')],'allRequiredParamsPresent':_0x1df530[_0x6a56('0x63')][_0x6a56('0x64')],'endConversation':_0x1df530[_0x6a56('0x63')][_0x6a56('0x65')]&&_0x1df530[_0x6a56('0x63')][_0x6a56('0x65')][_0x6a56('0x66')]?_0x1df530[_0x6a56('0x63')][_0x6a56('0x65')]['fields'][_0x6a56('0x67')][_0x6a56('0x68')]:![],'fulfillmentText':_0x1df530['queryResult'][_0x6a56('0x69')],'intentName':_0x1df530[_0x6a56('0x63')]['intent'][_0x6a56('0x51')],'intentDisplayName':_0x1df530[_0x6a56('0x63')][_0x6a56('0x6a')][_0x6a56('0x6b')],'isFallbackIntent':_0x1df530[_0x6a56('0x63')][_0x6a56('0x6a')]['isFallback'],'languageCode':_0x1df530[_0x6a56('0x63')]['languageCode'],'queryText':_0x1df530[_0x6a56('0x63')][_0x6a56('0x6c')],'responseId':_0x1df530[_0x6a56('0x6d')],'score':_0x1df530[_0x6a56('0x63')]['intentDetectionConfidence'],'speech':_0x1df530['queryResult'][_0x6a56('0x69')],'providerResponse':JSON['stringify'](_0x3b85c0)};return _0xd76107;}}});};exports[_0x6a56('0x6e')]=function(_0x5535ef,_0x1f6f09,_0x5a99bb,_0xc1b9b1){return tilde[_0x6a56('0x47')](_0x5535ef,_0x1f6f09,_0x5a99bb,_0xc1b9b1)[_0x6a56('0x29')](function(_0x306d42){try{fs['unlink'](_0x5535ef);}catch(_0x41600b){logger[_0x6a56('0x1a')](_0x41600b);}logger[_0x6a56('0x18')](_0x6a56('0x6f'),_0x306d42['transcript']);logger['info'](_0x6a56('0x70'),_0x306d42[_0x6a56('0x4e')]);return _0x306d42;});};exports[_0x6a56('0x71')]=function(_0x4eb202,_0x287e72,_0x5e9e59,_0x330427,_0x32d16f,_0x41bf47){var _0x4b59ee=path[_0x6a56('0x30')](__dirname,_0x6a56('0x26'),rs[_0x6a56('0x27')](0x4)+_0x6a56('0x31'));var _0x2301ce;return aws[_0x6a56('0x72')](_0x4eb202,_0x287e72,_0x5e9e59,_0x330427,_0x32d16f,_0x41bf47,_0x4b59ee)[_0x6a56('0x29')](function(){_0x2301ce=path[_0x6a56('0x30')](__dirname,'tmp',rs[_0x6a56('0x27')](0x4)+_0x6a56('0x35'));return convertFile(_0x4b59ee,_0x2301ce);})[_0x6a56('0x29')](function(){try{fs[_0x6a56('0x1b')](_0x4b59ee);fs[_0x6a56('0x34')](_0x2301ce,_0x6a56('0x2a'));}catch(_0x1519b2){logger[_0x6a56('0x1a')](_0x1519b2);}return _0x2301ce[_0x6a56('0x2b')]('.')[0x0];});};exports[_0x6a56('0x73')]=function(_0x1764ca,_0x49f825,_0x5e049a,_0x11225b,_0x21c449,_0x5deaef){return aws['lex'](_0x1764ca,_0x49f825,_0x5e049a,_0x11225b,_0x21c449,_0x5deaef)[_0x6a56('0x29')](function(_0x563d6d){logger[_0x6a56('0x18')](JSON[_0x6a56('0x3b')](_0x563d6d));return _0x563d6d;});};exports[_0x6a56('0x74')]=function(_0xefb1f2,_0x533648,_0x4aad97,_0x17d77f){var _0x562c4c=util['format']('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0xefb1f2,encodeURIComponent(_0x533648),_0x4aad97,_0x17d77f);var _0x3ab4e5=path[_0x6a56('0x30')](__dirname,'tmp',rs[_0x6a56('0x27')](0x4)+_0x6a56('0x31'));var _0x432979;return downloadFile(_0x562c4c,_0x3ab4e5)['then'](function(){_0x432979=path[_0x6a56('0x30')](__dirname,_0x6a56('0x26'),rs[_0x6a56('0x27')](0x4)+'.wav');return convertFile(_0x3ab4e5,_0x432979);})['then'](function(){try{fs['unlink'](_0x3ab4e5);fs[_0x6a56('0x34')](_0x432979,_0x6a56('0x2a'));}catch(_0x522e07){logger[_0x6a56('0x1a')](_0x522e07);}return _0x432979[_0x6a56('0x2b')]('.')[0x0];});};exports['ispeechASR']=function(_0x563993,_0x5f51fb,_0x4583f0,_0xf9b220){var _0x3b8b3b=util['format'](_0x6a56('0x75'),ISPEECH_API,_0x5f51fb,_0x4583f0,base64Encode(_0x563993),_0xf9b220?util[_0x6a56('0x76')](_0x6a56('0x77'),encodeURIComponent(_0xf9b220)):'freeform=3');return uploadFile(_0x3b8b3b)['then'](function(_0x3b821a){return querystring[_0x6a56('0x78')](_0x3b821a);});};exports[_0x6a56('0x79')]=function(_0x22a1ab,_0x24807e){return sestek[_0x6a56('0x7a')](_0x22a1ab,_0x24807e)[_0x6a56('0x29')](function(_0x36a475){logger['info'](JSON['stringify'](_0x36a475));var _0x5b1d42={'speech':_0x36a475['text'],'action':_0x36a475[_0x6a56('0x7b')]?_0x36a475['channelData'][_0x6a56('0x7c')]:undefined,'actiondata':_0x36a475['channelData']?_0x36a475[_0x6a56('0x7b')][_0x6a56('0x7d')]:undefined};if(_0x36a475['channelData']&&_0x36a475['channelData']['AudioFromTts']){return base64Decode(_0x36a475[_0x6a56('0x7b')][_0x6a56('0x7e')][_0x6a56('0x7f')],path[_0x6a56('0x30')](__dirname,_0x6a56('0x26'),rs[_0x6a56('0x27')](0x4)+'.wav'))['then'](function(_0x23c630){_0x5b1d42[_0x6a56('0x80')]=_0x23c630;return _0x5b1d42;});}return _0x5b1d42;});};exports['dirName']=function(){return __dirname;}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/index.js b/server/services/agi/scripts/sestek/index.js index 6ae22fa..1d1ecdc 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 _0x02ff=['./nda','exports'];(function(_0x543249,_0x46c918){var _0xf0257c=function(_0x3cfab3){while(--_0x3cfab3){_0x543249['push'](_0x543249['shift']());}};_0xf0257c(++_0x46c918);}(_0x02ff,0x114));var _0xf02f=function(_0x3d386d,_0x211f97){_0x3d386d=_0x3d386d-0x0;var _0x947b15=_0x02ff[_0x3d386d];return _0x947b15;};var nda=require(_0xf02f('0x0'));module[_0xf02f('0x1')]={'nda':nda}; \ No newline at end of file +var _0xfd88=['exports'];(function(_0x3c2666,_0x15fd23){var _0x10c814=function(_0x4660c0){while(--_0x4660c0){_0x3c2666['push'](_0x3c2666['shift']());}};_0x10c814(++_0x15fd23);}(_0xfd88,0x135));var _0x8fd8=function(_0x57cbfb,_0x2de760){_0x57cbfb=_0x57cbfb-0x0;var _0x4cb933=_0xfd88[_0x57cbfb];return _0x4cb933;};var nda=require('./nda');module[_0x8fd8('0x0')]={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index 99d922b..e45e323 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 _0xf958=['/token','password','username','resolve','ndassistant_url','ndaactivity_type','message','uniqueid','callerid','calleridname','extension','text','Bearer\x20','project','body','channelData','ndagenerate_audio','AudioOutputSettings','audio/wav','custom_action','CustomActionData','custom_action_data','request-promise','../../../../../config/logger','exports','POST'];(function(_0x5771fc,_0x5eeb99){var _0x59ef6e=function(_0x7051af){while(--_0x7051af){_0x5771fc['push'](_0x5771fc['shift']());}};_0x59ef6e(++_0x5eeb99);}(_0xf958,0xe6));var _0x8f95=function(_0x4e75a4,_0x4e5c87){_0x4e75a4=_0x4e75a4-0x0;var _0x4bfc7a=_0xf958[_0x4e75a4];return _0x4bfc7a;};'use strict';var rp=require(_0x8f95('0x0'));var url=require('url');var logger=require(_0x8f95('0x1'))('agi');module[_0x8f95('0x2')]=function(_0x4de6f3,_0x3155dc){var _0x3fbf4f={'method':_0x8f95('0x3'),'uri':url['resolve'](_0x3155dc['ndauth_url'],_0x8f95('0x4')),'form':{'grant_type':_0x8f95('0x5'),'username':_0x3155dc[_0x8f95('0x6')],'password':_0x3155dc[_0x8f95('0x5')]},'json':!![]};return rp(_0x3fbf4f)['then'](function(_0x1ae9c4){var _0x109bed={'method':_0x8f95('0x3'),'uri':url[_0x8f95('0x7')](_0x3155dc[_0x8f95('0x8')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x3155dc[_0x8f95('0x9')]||_0x8f95('0xa'),'channelId':'Nda','conversation':{'id':_0x4de6f3[_0x8f95('0xb')]},'from':{'id':_0x4de6f3[_0x8f95('0xc')],'name':_0x4de6f3[_0x8f95('0xd')]},'recipient':{'id':_0x4de6f3['dnid'],'name':_0x4de6f3[_0x8f95('0xe')]},'text':_0x3155dc[_0x8f95('0xf')],'channelData':{}},'headers':{'Authorization':_0x8f95('0x10')+_0x1ae9c4['access_token']},'json':!![]};if(_0x3155dc[_0x8f95('0x11')]){_0x109bed[_0x8f95('0x12')][_0x8f95('0x13')]['ProjectName']=_0x3155dc[_0x8f95('0x11')];}if(_0x3155dc[_0x8f95('0x14')]=='1'){_0x109bed[_0x8f95('0x12')][_0x8f95('0x13')][_0x8f95('0x15')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x8f95('0x16')};}if(_0x3155dc[_0x8f95('0x17')]){_0x109bed['body']['channelData']['CustomAction']=_0x3155dc['custom_action'];if(_0x3155dc['custom_action_data']){_0x109bed[_0x8f95('0x12')][_0x8f95('0x13')][_0x8f95('0x18')]=_0x3155dc[_0x8f95('0x19')];}}logger['info'](JSON['stringify'](_0x109bed));return rp(_0x109bed);});}; \ No newline at end of file +var _0x8482=['calleridname','dnid','extension','access_token','project','body','ProjectName','ndagenerate_audio','channelData','audio/wav','CustomAction','CustomActionData','custom_action_data','info','stringify','url','../../../../../config/logger','agi','exports','POST','resolve','ndauth_url','password','username','then','ndassistant_url','Nda','uniqueid','callerid'];(function(_0x5e735f,_0x19f6b1){var _0x51cdfb=function(_0x43c8e0){while(--_0x43c8e0){_0x5e735f['push'](_0x5e735f['shift']());}};_0x51cdfb(++_0x19f6b1);}(_0x8482,0x14e));var _0x2848=function(_0x34c038,_0x3176ef){_0x34c038=_0x34c038-0x0;var _0x234a5f=_0x8482[_0x34c038];return _0x234a5f;};'use strict';var rp=require('request-promise');var url=require(_0x2848('0x0'));var logger=require(_0x2848('0x1'))(_0x2848('0x2'));module[_0x2848('0x3')]=function(_0x3ac5ad,_0x212891){var _0x7b4edd={'method':_0x2848('0x4'),'uri':url[_0x2848('0x5')](_0x212891[_0x2848('0x6')],'/token'),'form':{'grant_type':_0x2848('0x7'),'username':_0x212891[_0x2848('0x8')],'password':_0x212891['password']},'json':!![]};return rp(_0x7b4edd)[_0x2848('0x9')](function(_0x48c0f3){var _0x53c865={'method':_0x2848('0x4'),'uri':url['resolve'](_0x212891[_0x2848('0xa')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x212891['ndaactivity_type']||'message','channelId':_0x2848('0xb'),'conversation':{'id':_0x3ac5ad[_0x2848('0xc')]},'from':{'id':_0x3ac5ad[_0x2848('0xd')],'name':_0x3ac5ad[_0x2848('0xe')]},'recipient':{'id':_0x3ac5ad[_0x2848('0xf')],'name':_0x3ac5ad[_0x2848('0x10')]},'text':_0x212891['text'],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x48c0f3[_0x2848('0x11')]},'json':!![]};if(_0x212891[_0x2848('0x12')]){_0x53c865[_0x2848('0x13')]['channelData'][_0x2848('0x14')]=_0x212891[_0x2848('0x12')];}if(_0x212891[_0x2848('0x15')]=='1'){_0x53c865['body'][_0x2848('0x16')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x2848('0x17')};}if(_0x212891['custom_action']){_0x53c865[_0x2848('0x13')][_0x2848('0x16')][_0x2848('0x18')]=_0x212891['custom_action'];if(_0x212891['custom_action_data']){_0x53c865['body']['channelData'][_0x2848('0x19')]=_0x212891[_0x2848('0x1a')];}}logger[_0x2848('0x1b')](JSON[_0x2848('0x1c')](_0x53c865));return rp(_0x53c865);});}; \ 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 358d532..cdcd920 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 _0xd0ce=['exports','./lib/api'];(function(_0x875d46,_0xc9b2f0){var _0x39fbdf=function(_0x6e41cc){while(--_0x6e41cc){_0x875d46['push'](_0x875d46['shift']());}};_0x39fbdf(++_0xc9b2f0);}(_0xd0ce,0x105));var _0xed0c=function(_0x17f145,_0x3422bb){_0x17f145=_0x17f145-0x0;var _0x2d5420=_0xd0ce[_0x17f145];return _0x2d5420;};'use strict';var asr=require(_0xed0c('0x0'));module[_0xed0c('0x1')]=function(_0x337f43,_0xbfe69a,_0x193e7a,_0x26a485){return asr(_0x337f43,_0xbfe69a,_0x193e7a,_0x26a485);}; \ No newline at end of file +var _0x4ec1=['./lib/api','exports'];(function(_0x45b29d,_0x44ce43){var _0x32d74=function(_0x559eff){while(--_0x559eff){_0x45b29d['push'](_0x45b29d['shift']());}};_0x32d74(++_0x44ce43);}(_0x4ec1,0x144));var _0x14ec=function(_0x3e4ee8,_0x4194f6){_0x3e4ee8=_0x3e4ee8-0x0;var _0x10b191=_0x4ec1[_0x3e4ee8];return _0x10b191;};'use strict';var asr=require(_0x14ec('0x0'));module[_0x14ec('0x1')]=function(_0x4c4e6b,_0x2a3df1,_0x57a918,_0x13541b){return asr(_0x4c4e6b,_0x2a3df1,_0x57a918,_0x13541b);}; \ 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 25ba25b..e75442c 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 _0xcf34=['All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','isNil','isObject','message','moment','crypto','agi','exports','info','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','hex','Open\x20Tilde\x20ASR\x20socket','send','createReadStream','data','close','EOS','error','Tilde\x20ASR\x20send\x20error','terminate','parse','result','Tilde\x20ASR\x20hypoteses','stringify','hypotheses','transcript','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.'];(function(_0x203c0a,_0x710fe){var _0xd1f1e8=function(_0x2d83e5){while(--_0x2d83e5){_0x203c0a['push'](_0x203c0a['shift']());}};_0xd1f1e8(++_0x710fe);}(_0xcf34,0x1d9));var _0x4cf3=function(_0x492af5,_0xd51471){_0x492af5=_0x492af5-0x0;var _0x59f529=_0xcf34[_0x492af5];return _0x59f529;};'use strict';var BPromise=require('bluebird');var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x4cf3('0x0'));var crypto=require(_0x4cf3('0x1'));var logger=require('../../../../../../config/logger')(_0x4cf3('0x2'));module[_0x4cf3('0x3')]=function(_0x1ea6f5,_0x557bd3,_0x324e4c,_0x421663){return new BPromise(function(_0x427638,_0x18bb97){logger[_0x4cf3('0x4')]('Tilde\x20URI',_0x421663||_0x4cf3('0x5'));var _0xa8af1e=new WebSocket(_0x421663||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0xcbadbc='';var _0x1c2a2d='0';var _0x55af34='1';var _0x51975d=_0x4cf3('0x6');function _0x2da845(_0x295430){var _0x3ddfaf=crypto[_0x4cf3('0x7')](_0x4cf3('0x8'));_0x3ddfaf[_0x4cf3('0x9')](_0x295430);return _0x3ddfaf['digest'](_0x4cf3('0xa'));}function _0x4d30a8(){try{logger[_0x4cf3('0x4')](_0x4cf3('0xb'));var _0xb7a75d=moment()['unix']();var _0x2995e8=_0x2da845(_0xb7a75d+_0x557bd3+_0x324e4c);_0xa8af1e[_0x4cf3('0xc')](JSON['stringify']({'appID':_0x557bd3,'timestamp':_0xb7a75d,'appKey':_0x2995e8}));var _0x22c45d=fs[_0x4cf3('0xd')](_0x1ea6f5);_0x22c45d['on'](_0x4cf3('0xe'),function(_0x3bb3c0){_0xa8af1e[_0x4cf3('0xc')](_0x3bb3c0);});_0x22c45d['on'](_0x4cf3('0xf'),function(){_0xa8af1e[_0x4cf3('0xc')](_0x4cf3('0x10'));});}catch(_0x5f36cf){logger[_0x4cf3('0x11')](_0x4cf3('0x12'),JSON['stringify'](_0x5f36cf));_0xa8af1e[_0x4cf3('0x13')]();}}function _0x3953bb(_0x7a8c9c){try{if(_0x7a8c9c){var _0x448b9f=JSON[_0x4cf3('0x14')](_0x7a8c9c);switch(_0x448b9f['status']){case 0x0:if(_0x448b9f[_0x4cf3('0x15')]){if(_0x448b9f[_0x4cf3('0x15')]['final']){logger[_0x4cf3('0x4')](_0x4cf3('0x16'),JSON[_0x4cf3('0x17')](_0x448b9f[_0x4cf3('0x15')][_0x4cf3('0x18')]));_0xcbadbc=_0x448b9f[_0x4cf3('0x15')][_0x4cf3('0x18')][0x0][_0x4cf3('0x19')];_0x1c2a2d=_0x448b9f[_0x4cf3('0x15')][_0x4cf3('0x18')][0x0][_0x4cf3('0x1a')];_0x55af34='0';_0x51975d=_0x4cf3('0x1b');_0xa8af1e[_0x4cf3('0x13')]();}}break;case 0x1:logger[_0x4cf3('0x4')](_0x4cf3('0x6'));_0x55af34='1';_0x51975d=_0x4cf3('0x6');break;case 0x2:logger[_0x4cf3('0x4')](_0x4cf3('0x1c'));_0x55af34='2';_0x51975d=_0x4cf3('0x1c');break;case 0x9:logger[_0x4cf3('0x4')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x55af34='9';_0x51975d=_0x4cf3('0x1d');break;case 0xa:logger[_0x4cf3('0x4')](_0x4cf3('0x1e'));_0x55af34='10';_0x51975d=_0x4cf3('0x1e');break;case 0xb:logger[_0x4cf3('0x4')]('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0x55af34='11';_0x51975d=_0x4cf3('0x1f');}}}catch(_0xfd0673){logger['error'](_0x4cf3('0x20'),JSON['stringify'](_0xfd0673));_0xa8af1e[_0x4cf3('0x13')]();}}function _0x420010(){logger[_0x4cf3('0x4')]('Close\x20Tilde\x20ASR\x20socket');_0x427638({'transcript':_0xcbadbc,'confidence':_0x1c2a2d,'status':_0x55af34,'status_message':_0x51975d});}function _0x4c553f(_0x19561b){logger[_0x4cf3('0x11')]('Error\x20Tilde\x20ASR\x20socket');if(!_[_0x4cf3('0x21')](_0x19561b)){logger[_0x4cf3('0x11')](_[_0x4cf3('0x22')](_0x19561b)?JSON[_0x4cf3('0x17')](_0x19561b):_0x19561b);}}_0xa8af1e['on']('open',_0x4d30a8);_0xa8af1e['on'](_0x4cf3('0x23'),_0x3953bb);_0xa8af1e['on']('close',_0x420010);_0xa8af1e['on'](_0x4cf3('0x11'),_0x4c553f);});}; \ No newline at end of file +var _0x2bf3=['close','EOS','error','status','result','final','Tilde\x20ASR\x20hypoteses','stringify','hypotheses','likelihood','Success.','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','open','message','bluebird','moment','crypto','../../../../../../config/logger','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','createHash','sha1','update','hex','Open\x20Tilde\x20ASR\x20socket','unix','createReadStream','data','send'];(function(_0xe4202f,_0x384ef5){var _0x1876a4=function(_0x2832d3){while(--_0x2832d3){_0xe4202f['push'](_0xe4202f['shift']());}};_0x1876a4(++_0x384ef5);}(_0x2bf3,0xd9));var _0x32bf=function(_0x527a9d,_0x22824d){_0x527a9d=_0x527a9d-0x0;var _0x50105a=_0x2bf3[_0x527a9d];return _0x50105a;};'use strict';var BPromise=require(_0x32bf('0x0'));var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x32bf('0x1'));var crypto=require(_0x32bf('0x2'));var logger=require(_0x32bf('0x3'))('agi');module[_0x32bf('0x4')]=function(_0x260baa,_0x953658,_0xdf6325,_0x248fb8){return new BPromise(function(_0x3a9792,_0x45d8c6){logger[_0x32bf('0x5')](_0x32bf('0x6'),_0x248fb8||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x1321e0=new WebSocket(_0x248fb8||_0x32bf('0x7'),{'perMessageDeflate':![]});var _0x49d358='';var _0x22fe1d='0';var _0x5627ed='1';var _0x1cbda3='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x3d0f6f(_0x1c1338){var _0x1937fd=crypto[_0x32bf('0x8')](_0x32bf('0x9'));_0x1937fd[_0x32bf('0xa')](_0x1c1338);return _0x1937fd['digest'](_0x32bf('0xb'));}function _0x422784(){try{logger['info'](_0x32bf('0xc'));var _0x5eae7d=moment()[_0x32bf('0xd')]();var _0x274fa4=_0x3d0f6f(_0x5eae7d+_0x953658+_0xdf6325);_0x1321e0['send'](JSON['stringify']({'appID':_0x953658,'timestamp':_0x5eae7d,'appKey':_0x274fa4}));var _0x422352=fs[_0x32bf('0xe')](_0x260baa);_0x422352['on'](_0x32bf('0xf'),function(_0x3b1928){_0x1321e0[_0x32bf('0x10')](_0x3b1928);});_0x422352['on'](_0x32bf('0x11'),function(){_0x1321e0[_0x32bf('0x10')](_0x32bf('0x12'));});}catch(_0x30213f){logger[_0x32bf('0x13')]('Tilde\x20ASR\x20send\x20error',JSON['stringify'](_0x30213f));_0x1321e0['terminate']();}}function _0x1a8ed5(_0x17fb60){try{if(_0x17fb60){var _0x34d8a7=JSON['parse'](_0x17fb60);switch(_0x34d8a7[_0x32bf('0x14')]){case 0x0:if(_0x34d8a7[_0x32bf('0x15')]){if(_0x34d8a7[_0x32bf('0x15')][_0x32bf('0x16')]){logger[_0x32bf('0x5')](_0x32bf('0x17'),JSON[_0x32bf('0x18')](_0x34d8a7[_0x32bf('0x15')]['hypotheses']));_0x49d358=_0x34d8a7['result'][_0x32bf('0x19')][0x0]['transcript'];_0x22fe1d=_0x34d8a7[_0x32bf('0x15')][_0x32bf('0x19')][0x0][_0x32bf('0x1a')];_0x5627ed='0';_0x1cbda3=_0x32bf('0x1b');_0x1321e0['terminate']();}}break;case 0x1:logger[_0x32bf('0x5')](_0x32bf('0x1c'));_0x5627ed='1';_0x1cbda3=_0x32bf('0x1c');break;case 0x2:logger[_0x32bf('0x5')](_0x32bf('0x1d'));_0x5627ed='2';_0x1cbda3=_0x32bf('0x1d');break;case 0x9:logger[_0x32bf('0x5')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x5627ed='9';_0x1cbda3=_0x32bf('0x1e');break;case 0xa:logger[_0x32bf('0x5')]('Authentication\x20failed.');_0x5627ed='10';_0x1cbda3=_0x32bf('0x1f');break;case 0xb:logger[_0x32bf('0x5')](_0x32bf('0x20'));_0x5627ed='11';_0x1cbda3=_0x32bf('0x20');}}}catch(_0x1b0a46){logger[_0x32bf('0x13')](_0x32bf('0x21'),JSON[_0x32bf('0x18')](_0x1b0a46));_0x1321e0['terminate']();}}function _0x58dd8e(){logger[_0x32bf('0x5')](_0x32bf('0x22'));_0x3a9792({'transcript':_0x49d358,'confidence':_0x22fe1d,'status':_0x5627ed,'status_message':_0x1cbda3});}function _0x326662(_0x3af220){logger['error'](_0x32bf('0x23'));if(!_[_0x32bf('0x24')](_0x3af220)){logger[_0x32bf('0x13')](_['isObject'](_0x3af220)?JSON[_0x32bf('0x18')](_0x3af220):_0x3af220);}}_0x1321e0['on'](_0x32bf('0x25'),_0x422784);_0x1321e0['on'](_0x32bf('0x26'),_0x1a8ed5);_0x1321e0['on'](_0x32bf('0x11'),_0x58dd8e);_0x1321e0['on']('error',_0x326662);});}; \ 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 df73069..10cb4be 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 _0x7847=['./asr','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7847,0x1c0));var _0x7784=function(_0x5a959e,_0x668fa5){_0x5a959e=_0x5a959e-0x0;var _0x8cd2fb=_0x7847[_0x5a959e];return _0x8cd2fb;};var asr=require(_0x7784('0x0'));module[_0x7784('0x1')]={'asr':asr}; \ No newline at end of file +var asr=require('./asr');module['exports']={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 808e1c8..23ee97c 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 _0x177e=['emit','connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_MAXCONNECTION','destroy','ready','code','close','nextTick','inherits','util','events','EventEmitter','./error','./channel','127.0.0.1','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening'];(function(_0x906119,_0x50d09c){var _0x1004fb=function(_0x37dc63){while(--_0x37dc63){_0x906119['push'](_0x906119['shift']());}};_0x1004fb(++_0x50d09c);}(_0x177e,0xbb));var _0xe177=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x177e[_0x20a584];return _0x4b41a8;};'use strict';var util=require(_0xe177('0x0'));var net=require('net');var EventEmitter=require(_0xe177('0x1'))[_0xe177('0x2')];var AGIError=require(_0xe177('0x3'));var AGIChannel=require(_0xe177('0x4'));var AGIServer=function(_0x5441d3,_0x17fa14,_0x4aef19){var _0x11398f=this,_0x5441d3=_0x5441d3||0x11dd,_0x17fa14=_0x17fa14||_0xe177('0x5'),_0x3c9bce=null,_0xf71b1e=0x0;EventEmitter['call'](_0x11398f);function _0x367e05(){if(!_0x5441d3){_0x11398f['emit'](_0xe177('0x6'),new AGIError(_0xe177('0x7')));return![];}_0x3c9bce=net[_0xe177('0x8')]();_0x3c9bce[_0xe177('0x9')](_0x5441d3,_0x17fa14);_0x3c9bce['on'](_0xe177('0xa'),function(){_0x11398f[_0xe177('0xb')](_0xe177('0xa'));});_0x3c9bce['on'](_0xe177('0xc'),function(_0x3cedee){_0x3c9bce[_0xe177('0xd')](function(_0x15811d,_0x2b2af2){if(_0x15811d){_0x11398f['emit']('error',new AGIError(_0xe177('0xe'),_0x15811d));}else if(_0x4aef19&&_0x4aef19<0x0){_0x11398f[_0xe177('0xb')](_0xe177('0x6'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x3cedee['destroy']();}else if(_0x4aef19&&_0x4aef19>0x0&&_0x4aef19<_0x2b2af2){_0xf71b1e+=0x1;_0x11398f[_0xe177('0xb')](_0xe177('0x6'),new AGIError(_0xe177('0xf'),_0xf71b1e));_0x3cedee[_0xe177('0x10')]();}else{var _0x4128c8=new AGIChannel(_0x3cedee);_0x4128c8['on'](_0xe177('0x11'),function(){_0x11398f[_0xe177('0xb')](_0xe177('0xc'),_0x4128c8);});}});});_0x3c9bce['on'](_0xe177('0x6'),function(_0x42d31a){_0x11398f[_0xe177('0xb')]('error',new AGIError(_0xe177('0xe'),_0x42d31a[_0xe177('0x12')]));});_0x3c9bce['on'](_0xe177('0x13'),function(){_0x11398f['emit'](_0xe177('0x13'),new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0xe177('0x14')](function(){_0x367e05();});};util[_0xe177('0x15')](AGIServer,EventEmitter);module['exports']=function(_0x2ec4d6,_0x1f323b,_0x71e980){return new AGIServer(_0x2ec4d6,_0x1f323b,_0x71e980);}; \ No newline at end of file +var _0x61a1=['util','net','events','EventEmitter','./error','127.0.0.1','emit','E_AGI_ARGUMENT_PORT','listen','listening','connection','getConnections','error','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','close','E_AGI_SERVER_CLOSE','inherits','exports'];(function(_0x593302,_0x3f266c){var _0x5167c8=function(_0x227dd0){while(--_0x227dd0){_0x593302['push'](_0x593302['shift']());}};_0x5167c8(++_0x3f266c);}(_0x61a1,0x1b9));var _0x161a=function(_0x57b236,_0x30614e){_0x57b236=_0x57b236-0x0;var _0x4feb29=_0x61a1[_0x57b236];return _0x4feb29;};'use strict';var util=require(_0x161a('0x0'));var net=require(_0x161a('0x1'));var EventEmitter=require(_0x161a('0x2'))[_0x161a('0x3')];var AGIError=require(_0x161a('0x4'));var AGIChannel=require('./channel');var AGIServer=function(_0x477171,_0x2f8cb8,_0x1948aa){var _0x1ad88c=this,_0x477171=_0x477171||0x11dd,_0x2f8cb8=_0x2f8cb8||_0x161a('0x5'),_0x542a63=null,_0x345bff=0x0;EventEmitter['call'](_0x1ad88c);function _0x31f3d5(){if(!_0x477171){_0x1ad88c[_0x161a('0x6')]('error',new AGIError(_0x161a('0x7')));return![];}_0x542a63=net['createServer']();_0x542a63[_0x161a('0x8')](_0x477171,_0x2f8cb8);_0x542a63['on'](_0x161a('0x9'),function(){_0x1ad88c[_0x161a('0x6')](_0x161a('0x9'));});_0x542a63['on'](_0x161a('0xa'),function(_0x2a2a47){_0x542a63[_0x161a('0xb')](function(_0x1f029c,_0x3fb082){if(_0x1f029c){_0x1ad88c['emit'](_0x161a('0xc'),new AGIError(_0x161a('0xd'),_0x1f029c));}else if(_0x1948aa&&_0x1948aa<0x0){_0x1ad88c['emit'](_0x161a('0xc'),new AGIError(_0x161a('0xe')));_0x2a2a47[_0x161a('0xf')]();}else if(_0x1948aa&&_0x1948aa>0x0&&_0x1948aa<_0x3fb082){_0x345bff+=0x1;_0x1ad88c[_0x161a('0x6')](_0x161a('0xc'),new AGIError(_0x161a('0x10'),_0x345bff));_0x2a2a47[_0x161a('0xf')]();}else{var _0x4499ce=new AGIChannel(_0x2a2a47);_0x4499ce['on']('ready',function(){_0x1ad88c[_0x161a('0x6')]('connection',_0x4499ce);});}});});_0x542a63['on']('error',function(_0x36ba3c){_0x1ad88c[_0x161a('0x6')]('error',new AGIError(_0x161a('0xd'),_0x36ba3c['code']));});_0x542a63['on'](_0x161a('0x11'),function(){_0x1ad88c['emit'](_0x161a('0x11'),new AGIError(_0x161a('0x12')));});}process['nextTick'](function(){_0x31f3d5();});};util[_0x161a('0x13')](AGIServer,EventEmitter);module[_0x161a('0x14')]=function(_0x3550f1,_0x3bf655,_0x3bbde2){return new AGIServer(_0x3550f1,_0x3bf655,_0x3bbde2);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index a82182f..cef8e62 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 _0xdffd=['isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','aws_text_type','awsLex','aws_lex_region','googleASR','tildeASR','appid','appsecret','clear','agicommand','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','hasOwnProperty','isArray','length','isString','saveRestApiResult','isPlainObject','%s.%s','setVariable','split','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','retry','maxRetry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','RECOG_INSTANCE()','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','Enter\x20in\x20ANSWER\x20(%s)\x20block','answer','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','add','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','application','Executed\x20command\x20%s\x20%s','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20odbc\x20database\x20found','no\x20query\x20configured','replace','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','keys','forEach','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','no\x20user\x20selected','sip_id','no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','dialogflow','Dialogflow\x20is\x20unreachable','no\x20project_id\x20configured','no\x20client_email\x20configured','private_key','no\x20private_key\x20configured','no\x20anguage\x20configured','providerResponse','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','username','no\x20username\x20configured','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','sesteknda','audiofile','unlink','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','no\x20trunk\x20selected','trunk_id','no\x20trunk\x20found','trunk_name','SIP/%s/%s','finally','getdigits','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','getData','response','maxdigit','mindigit','hiddendigitsnum','generate','first','substr','getsecretdigits','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','.wav','aws\x20Polly\x20is\x20unreachable','awslex','aws_bot_name','no\x20bot\x20name\x20configured','amazonlex','Amazon\x20Lex\x20Result\x20%s','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','NOBEEP','recordFile','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','no\x20appid\x20configured','beep','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','context','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','true','false','EVAL\x20CONDITION\x20%s\x20%s','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','%s/recordings/%s','ispeechASR','ISPEECH_ASR_%s','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20%s\x20file\x20created','streamFile','intKey','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','math\x20%s','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20found','digit','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','getVoiceQueue','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','digits','saynumber','sayphonetic','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','getMailAccount','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','subject','service','host','port','secure','auth','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sendSMS\x20message','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','Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','apiKey','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','replaceAll','join','exports','path','util','lodash','shelljs','randomstring','request-promise','../../config/logger','agi','../../config/environment','./scripts','rawBody','menu','channel','rpc','mailRpc','prototype','getVariable','getVariableById','then','name','catch','getVoiceQueueById','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUser','getUserById','getTrunk','getSound','getSoundPath','save_name','getMailAccountById','sendMailMessage','getIntervalById','IntervalId','interval','map','Intervals','format','%s/sounds/converted/%s','getQueryOdbc','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','label','arg_1','callerid','createSquareRecording','uniqueid','calleridname','extension','priority','accountcode','dnid','file','createSquareMessage','createCmContact','isNil','random','isEmpty','lastName','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','shellCommand','exec','googleCloudTTS','google_cloud_tts_text_type','text','en-US','ssmlGender','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','method','timeout','number','includes','POST','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','rawHeaders','computedVariables','sync','uri','render','url','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusMessage','statusCode','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeech_asr_language'];(function(_0x49a2e6,_0x40ca47){var _0x473061=function(_0x2d4cfc){while(--_0x2d4cfc){_0x49a2e6['push'](_0x49a2e6['shift']());}};_0x473061(++_0x40ca47);}(_0xdffd,0x13f));var _0xddff=function(_0x293814,_0x50a678){_0x293814=_0x293814-0x0;var _0x3aab37=_0xdffd[_0x293814];return _0x3aab37;};'use strict';var fs=require('fs');var path=require(_0xddff('0x0'));var util=require(_0xddff('0x1'));var _=require(_0xddff('0x2'));var sh=require(_0xddff('0x3'));var odbc=require('odbc')();var rs=require(_0xddff('0x4'));var moment=require('moment');var Mustache=require('mustache');var rp=require(_0xddff('0x5'));var logger=require(_0xddff('0x6'))(_0xddff('0x7'));var config=require(_0xddff('0x8'));var scripts=require(_0xddff('0x9'));var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=['rawHeaders',_0xddff('0xa')];var verticesWithRetry=[_0xddff('0xb'),'getdigits','getsecretdigits'];var AGIVertices=function(_0x2db018,_0x1ec1aa,_0xdf210c){this[_0xddff('0xc')]=_0x2db018;this[_0xddff('0xd')]=_0x1ec1aa;this[_0xddff('0xe')]=_0xdf210c;};AGIVertices[_0xddff('0xf')][_0xddff('0x10')]=function(_0x20c2a7,_0xf2a3e){this[_0xddff('0xd')][_0xddff('0x11')](_0x20c2a7)[_0xddff('0x12')](function(_0x1c9943){_0xf2a3e(null,_0x1c9943?_0x1c9943[_0xddff('0x13')]:![]);})[_0xddff('0x14')](function(_0x1ab5d1){_0xf2a3e(_0x1ab5d1);});};AGIVertices[_0xddff('0xf')]['getVoiceQueue']=function(_0x6cb6a0,_0x3d92ed){this[_0xddff('0xd')][_0xddff('0x15')](_0x6cb6a0)['then'](function(_0x5b5eca){_0x3d92ed(null,_0x5b5eca?_0x5b5eca[_0xddff('0x13')]:![]);})[_0xddff('0x14')](function(_0x4e0682){_0x3d92ed(_0x4e0682);});};AGIVertices[_0xddff('0xf')][_0xddff('0x16')]=function(_0x20bd52,_0x2f7b7f){this['rpc'][_0xddff('0x17')](_0x20bd52)[_0xddff('0x12')](function(_0x4dea9e){_0x2f7b7f(null,_0x4dea9e?_0x4dea9e[_0xddff('0x13')]:![]);})[_0xddff('0x14')](function(_0xaf583f){_0x2f7b7f(_0xaf583f);});};AGIVertices[_0xddff('0xf')][_0xddff('0x18')]=function(_0x592289,_0xee47f){this[_0xddff('0xd')][_0xddff('0x19')](_0x592289)['then'](function(_0x1355d8){_0xee47f(null,_0x1355d8?_0x1355d8[_0xddff('0x1a')]:![]);})['catch'](function(_0x40f5b9){_0xee47f(_0x40f5b9);});};AGIVertices['prototype'][_0xddff('0x1b')]=function(_0x21f208,_0x37f800){this[_0xddff('0xd')][_0xddff('0x1c')](_0x21f208)['then'](function(_0x17a1e1){_0x37f800(null,_0x17a1e1?_0x17a1e1[_0xddff('0x13')]:![]);})['catch'](function(_0x242e4b){_0x37f800(_0x242e4b);});};AGIVertices[_0xddff('0xf')][_0xddff('0x1d')]=function(_0x4c3dfe,_0x1325e7){this[_0xddff('0xd')]['getTrunkById'](_0x4c3dfe)[_0xddff('0x12')](function(_0x5e80a0){_0x1325e7(null,_0x5e80a0?_0x5e80a0['name']:![]);})[_0xddff('0x14')](function(_0x51eb09){_0x1325e7(_0x51eb09);});};AGIVertices[_0xddff('0xf')][_0xddff('0x1e')]=function(_0x176dd6,_0x3d5f53){var _0x489c00=this;this[_0xddff('0xd')]['getSoundById'](_0x176dd6)[_0xddff('0x12')](function(_0x36a8f4){_0x3d5f53(null,_0x36a8f4?_0x489c00[_0xddff('0x1f')](_0x36a8f4[_0xddff('0x20')]):![]);})['catch'](function(_0x28a299){_0x3d5f53(_0x28a299);});};AGIVertices[_0xddff('0xf')]['getMailAccount']=function(_0x414459,_0x2e7ca5){this['rpc'][_0xddff('0x21')](_0x414459)[_0xddff('0x12')](function(_0x302913){_0x2e7ca5(null,_0x302913?_0x302913:![]);})[_0xddff('0x14')](function(_0x395af6){_0x2e7ca5(_0x395af6);});};AGIVertices[_0xddff('0xf')][_0xddff('0x22')]=function(_0x4b6955,_0x5a84a4,_0xc08ca4){this[_0xddff('0xe')]['sendMailMessage'](_0x4b6955,_0x5a84a4)[_0xddff('0x12')](function(){_0xc08ca4(null);})[_0xddff('0x14')](function(_0x304713){_0xc08ca4(_0x304713);});};AGIVertices[_0xddff('0xf')]['getIntervals']=function(_0x11d519,_0x2c14a2){this[_0xddff('0xd')][_0xddff('0x23')](_0x11d519)[_0xddff('0x12')](function(_0x64537c){if(_0x64537c){if(_0x64537c[_0xddff('0x24')]){_0x2c14a2(null,[_0x64537c[_0xddff('0x25')]]);}else{_0x2c14a2(null,_[_0xddff('0x26')](_0x64537c[_0xddff('0x27')],_0xddff('0x25')));}}else{_0x2c14a2(null,![]);}})[_0xddff('0x14')](function(_0x5874a9){_0x2c14a2(_0x5874a9);});};AGIVertices[_0xddff('0xf')][_0xddff('0x1f')]=function(_0xd72ca9){return util[_0xddff('0x28')](_0xddff('0x29'),FILES_PATH,_0xd72ca9);};AGIVertices[_0xddff('0xf')][_0xddff('0x2a')]=function(_0x6ea500,_0x77c3a4,_0x3c19af){odbc['open'](_0x6ea500,function(_0x201071){if(_0x201071){logger[_0xddff('0x2b')](_0xddff('0x2c'),_0x201071);_0x3c19af(_0x201071);}else{logger[_0xddff('0x2d')]('ODBC\x20connection\x20successfully');odbc[_0xddff('0x2e')](_0x77c3a4,function(_0x3c58dd,_0x5096ec){if(_0x3c58dd){logger[_0xddff('0x2d')](_0xddff('0x2f'),_0x77c3a4);_0x3c19af(_0x3c58dd);}else{logger[_0xddff('0x2d')](_0xddff('0x30'),_0x77c3a4);odbc[_0xddff('0x31')](function(_0x5c1d69){if(_0x5c1d69){logger[_0xddff('0x2b')](_0xddff('0x32'),_0x5c1d69);}_0x3c19af(null,_0x5096ec);});}});}});};AGIVertices[_0xddff('0xf')][_0xddff('0x33')]=function(_0x2fd659,_0x1a82ff){this[_0xddff('0xd')][_0xddff('0x34')](_0x2fd659)[_0xddff('0x12')](function(_0x3e4477){_0x1a82ff(null,_0x3e4477?_0x3e4477:![]);})[_0xddff('0x14')](function(_0x23b8e0){_0x1a82ff(_0x23b8e0);});};AGIVertices[_0xddff('0xf')]['createSmsMessage']=function(_0x1f07a8,_0x5edc5a){this[_0xddff('0xd')][_0xddff('0x35')](_0x1f07a8)[_0xddff('0x12')](function(_0x11475e){_0x5edc5a(null,_0x11475e);})['catch'](function(_0x13b3d8){_0x5edc5a(_0x13b3d8);});};AGIVertices[_0xddff('0xf')][_0xddff('0x36')]=function(_0x1e0776,_0x4c1e6c,_0x4a05d1){this[_0xddff('0xd')][_0xddff('0x36')]({'uniqueid':this['channel']['uniqueid'],'node':_0x1e0776[_0xddff('0x37')],'application':_0x1e0776['agicommand'],'data':_0x4c1e6c||null,'project_name':this[_0xddff('0xc')][_0xddff('0x38')],'callerid':this[_0xddff('0xc')][_0xddff('0x39')]})[_0xddff('0x12')](function(_0x159a69){if(_0x4a05d1){_0x4a05d1(null,_0x159a69);}})[_0xddff('0x14')](function(_0x16ce57){if(_0x4a05d1){_0x4a05d1(_0x16ce57);}});};AGIVertices[_0xddff('0xf')]['createSquareRecording']=function(_0x12596b,_0x1b5020,_0x40ec2d,_0x5b64db){this['rpc'][_0xddff('0x3a')]({'uniqueid':this[_0xddff('0xc')][_0xddff('0x3b')],'callerid':this['channel'][_0xddff('0x39')],'calleridname':this[_0xddff('0xc')][_0xddff('0x3c')],'context':this[_0xddff('0xc')]['context'],'extension':this[_0xddff('0xc')][_0xddff('0x3d')],'priority':this[_0xddff('0xc')][_0xddff('0x3e')],'accountcode':this[_0xddff('0xc')][_0xddff('0x3f')],'dnid':this[_0xddff('0xc')][_0xddff('0x40')],'projectName':this[_0xddff('0xc')][_0xddff('0x38')],'saveName':_0x1b5020,'filename':_0x12596b[_0xddff('0x41')]||_0x1b5020,'savePath':_0x40ec2d})['then'](function(_0xca3cc5){_0x5b64db(null,_0xca3cc5);})['catch'](function(_0x3945e0){_0x5b64db(_0x3945e0);});};AGIVertices[_0xddff('0xf')][_0xddff('0x42')]=function(_0x37f4c5,_0xe5d78b,_0x11d920,_0x5e3abe,_0x1a37e4){this[_0xddff('0xd')][_0xddff('0x42')]({'uniqueid':this[_0xddff('0xc')][_0xddff('0x3b')],'body':_0x37f4c5,'direction':_0xe5d78b,'providerName':_0x11d920,'providerResponse':_0x5e3abe})[_0xddff('0x12')](function(_0x134801){if(_0x1a37e4){_0x1a37e4(null,_0x134801);}})[_0xddff('0x14')](function(_0x7a7a4c){if(_0x1a37e4){_0x1a37e4(_0x7a7a4c);}});};AGIVertices[_0xddff('0xf')][_0xddff('0x43')]=function(_0x57fc34,_0x37676c){this[_0xddff('0xd')][_0xddff('0x43')]({'firstName':_['isEmpty'](_0x57fc34[_0xddff('0x13')])||_[_0xddff('0x44')](_0x57fc34['name'])?'callback_'+Math[_0xddff('0x45')]():_0x57fc34['name'],'lastName':_[_0xddff('0x46')](_0x57fc34[_0xddff('0x47')])||_[_0xddff('0x44')](_0x57fc34['lastName'])?null:_0x57fc34[_0xddff('0x47')],'phone':_0x57fc34[_0xddff('0x48')],'ListId':_0x57fc34[_0xddff('0x49')],'scheduledat':_0x57fc34[_0xddff('0x4a')],'callbackUniqueid':this[_0xddff('0xc')]['uniqueid'],'tags':_0xddff('0x4b'),'description':_0xddff('0x4c')+_0x57fc34[_0xddff('0x4a')][_0xddff('0x4d')](),'priority':_0x57fc34[_0xddff('0x4e')]})[_0xddff('0x12')](function(_0x279d99){_0x37676c(null,_0x279d99);})['catch'](function(_0x1d5ece){_0x37676c(_0x1d5ece);});};AGIVertices['prototype']['getPause']=function(_0x20daac,_0x20d497){this[_0xddff('0xd')][_0xddff('0x4f')](_0x20daac)['then'](function(_0x567f69){_0x20d497(null,_0x567f69?_0x567f69['name']:![]);})[_0xddff('0x14')](function(_0x2c08f6){_0x20d497(_0x2c08f6);});};AGIVertices[_0xddff('0xf')][_0xddff('0x50')]=function(_0xd356b6,_0x298f71,_0x19cfb3){var _0x2233c8={'role':_0xddff('0x51')};_0x2233c8[_0xd356b6]=this[_0xddff('0xc')][_0xddff('0x39')];this['rpc'][_0xddff('0x50')](_0x2233c8,_0x298f71,this[_0xddff('0xc')][_0xddff('0x3b')])[_0xddff('0x12')](function(_0x35cb7b){_0x19cfb3(null,_['isNil'](_0x35cb7b)?![]:!![]);})[_0xddff('0x14')](function(_0x532521){logger[_0xddff('0x2b')](_0x532521);_0x19cfb3(null,![]);});};AGIVertices['prototype'][_0xddff('0x52')]=function(_0x4fffec,_0x2bc999){var _0xff85ac={'role':'agent'};_0xff85ac[_0x4fffec]=this['channel'][_0xddff('0x39')];this[_0xddff('0xd')][_0xddff('0x52')](_0xff85ac)[_0xddff('0x12')](function(_0x14b3c0){_0x2bc999(null,_[_0xddff('0x44')](_0x14b3c0)?![]:!![]);})[_0xddff('0x14')](function(_0x3d59c9){logger[_0xddff('0x2b')](_0x3d59c9);_0x2bc999(null,![]);});};AGIVertices[_0xddff('0xf')][_0xddff('0x53')]=function(_0x23b4a9,_0x1532ed){var _0x4c4560={'role':'agent'};_0x4c4560[_0x23b4a9]=this[_0xddff('0xc')]['callerid'];this[_0xddff('0xd')][_0xddff('0x53')](_0x4c4560)['then'](function(_0x280de7){_0x1532ed(null,_[_0xddff('0x44')](_0x280de7)?![]:!![]);})[_0xddff('0x14')](function(_0x31c6dc){logger[_0xddff('0x2b')](_0x31c6dc);_0x1532ed(null,![]);});};AGIVertices[_0xddff('0xf')][_0xddff('0x54')]=function(_0x1aa73a,_0x39d5d8){var _0xee3a7c={'role':_0xddff('0x51')};_0xee3a7c[_0x1aa73a]=this[_0xddff('0xc')][_0xddff('0x39')];var _0x417ca0=_0x1aa73a!=_0xddff('0x55')?util[_0xddff('0x28')](_0xddff('0x56'),'LOCAL',this[_0xddff('0xc')][_0xddff('0x39')]):undefined;this[_0xddff('0xd')][_0xddff('0x54')](_0xee3a7c,_0x417ca0)['then'](function(_0xee6650){_0x39d5d8(null,_[_0xddff('0x44')](_0xee6650)?![]:!![]);})[_0xddff('0x14')](function(_0x41d617){logger[_0xddff('0x2b')](_0x41d617);_0x39d5d8(null,![]);});};AGIVertices[_0xddff('0xf')][_0xddff('0x57')]=function(_0x1c30f9,_0x175557){sh[_0xddff('0x58')](_['trim'](_0x1c30f9),function(_0x193b98,_0x5c1cb7){var _0x28ce34=_0x5c1cb7['replace'](/(\r\n|\n|\r)/gm,'');_0x175557(null,_0x28ce34);});};AGIVertices[_0xddff('0xf')][_0xddff('0x59')]=function(_0x444b49,_0x3c6fa4){scripts[_0xddff('0x59')](_0x444b49['apiKey'],_0x444b49[_0xddff('0x5a')]||_0xddff('0x5b'),_0x444b49[_0xddff('0x5b')],_0x444b49['languageCode']||_0xddff('0x5c'),_0x444b49[_0xddff('0x5d')]||'MALE',_0x444b49[_0xddff('0x5e')]||_0xddff('0x5f'))[_0xddff('0x12')](function(_0x5cfbed){_0x3c6fa4(null,_0x5cfbed);})[_0xddff('0x14')](function(_0x34dd18){_0x3c6fa4(_0x34dd18);});};AGIVertices[_0xddff('0xf')][_0xddff('0x60')]=function(_0x57ade1,_0x512089){scripts['googleTTS'](_0x57ade1[_0xddff('0x5b')],_0x57ade1[_0xddff('0x61')]||'en',0x1)[_0xddff('0x12')](function(_0x49775c){_0x512089(null,_0x49775c);})[_0xddff('0x14')](function(_0x2aacda){_0x512089(_0x2aacda);});};AGIVertices[_0xddff('0xf')][_0xddff('0x62')]=function(_0x4ea647,_0x4cf5f1){var _0x3be9e0={'uri':_0x4ea647['url'],'method':_0x4ea647[_0xddff('0x63')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x4ea647[_0xddff('0x64')])===_0xddff('0x65')&&parseInt(_0x4ea647[_0xddff('0x64')])>=0x1?parseInt(_0x4ea647['timeout'])*0x3e8:0x5*0x3e8};if(_[_0xddff('0x66')]([_0xddff('0x67'),'PUT'],_0x3be9e0[_0xddff('0x63')][_0xddff('0x68')]())){try{_0x3be9e0[_0xddff('0x69')]=_0x4ea647[_0xddff('0xa')]?JSON[_0xddff('0x6a')](_0x4ea647[_0xddff('0xa')]):{};}catch(_0xcf9199){logger[_0xddff('0x2b')](_0xddff('0x6b'),_0xcf9199);}}try{_0x3be9e0[_0xddff('0x6c')]=_0x4ea647[_0xddff('0x6d')]?JSON['parse'](_0x4ea647['rawHeaders']):{};}catch(_0x5960b3){logger[_0xddff('0x2b')]('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x5960b3);}if(_0x4ea647['computedVariables']){try{var _0x5675ee=require(_0x4ea647[_0xddff('0x6e')])[_0xddff('0x6f')](this,_0x3be9e0);_0x3be9e0[_0xddff('0x70')]=Mustache[_0xddff('0x71')](_0x4ea647[_0xddff('0x72')],_0x5675ee,{},['$$','$$']);if(_0x3be9e0[_0xddff('0x6c')]){_0x3be9e0[_0xddff('0x6c')]=JSON['parse'](Mustache[_0xddff('0x71')](JSON['stringify'](_0x3be9e0[_0xddff('0x6c')]),_0x5675ee,{},['$$','$$']));}if(_0x3be9e0[_0xddff('0x69')]){_0x3be9e0[_0xddff('0x69')]=JSON['parse'](Mustache['render'](JSON[_0xddff('0x73')](_0x3be9e0['body']),_0x5675ee,{},['$$','$$']));}}catch(_0x48e1a7){logger[_0xddff('0x2b')](_0xddff('0x74'),_0x48e1a7);}}rp(_0x3be9e0)[_0xddff('0x12')](function(_0x532b61){var _0x8a95f2={'statusCode':_0x532b61['statusCode']||0xc8,'statusMessage':_0x532b61[_0xddff('0x75')]||'OK','headers':_0x532b61['headers']||{},'body':_0x532b61[_0xddff('0x69')]||{}};_0x4cf5f1(null,_0x8a95f2);})['catch'](function(_0x259dac){var _0x3fe6c2={'statusCode':_0x259dac[_0xddff('0x76')]||0x1f4,'statusMessage':_0x259dac[_0xddff('0x77')]||_0xddff('0x78'),'headers':_0x259dac[_0xddff('0x79')]['headers']||{},'body':_0x259dac[_0xddff('0x79')]['body']||{}};_0x4cf5f1(null,_0x3fe6c2);});};AGIVertices['prototype']['googleDialogflow']=function(_0x47dd99,_0x200948){scripts[_0xddff('0x7a')](this[_0xddff('0xc')][_0xddff('0x3b')],_0x47dd99[_0xddff('0x7b')],_0x47dd99[_0xddff('0x5b')],_0x47dd99[_0xddff('0x7c')]||'en')['then'](function(_0x2b8245){_0x200948(null,_0x2b8245);})['catch'](function(_0x249979){_0x200948(_0x249979);});};AGIVertices[_0xddff('0xf')][_0xddff('0x7d')]=function(_0x251c4a,_0x54b2b3){scripts['googleDialogflowV2'](this[_0xddff('0xc')][_0xddff('0x3b')],_0x251c4a[_0xddff('0x7e')],_0x251c4a[_0xddff('0x7f')],_0x251c4a['private_key'],_0x251c4a[_0xddff('0x5b')],_0x251c4a[_0xddff('0x80')]||'en')[_0xddff('0x12')](function(_0x3a9d7c){_0x54b2b3(null,_0x3a9d7c);})[_0xddff('0x14')](function(_0x31da39){_0x54b2b3(_0x31da39);});};AGIVertices[_0xddff('0xf')][_0xddff('0x81')]=function(_0x42f6a8,_0x50ab32){scripts[_0xddff('0x81')](this[_0xddff('0xc')],_0x42f6a8)['then'](function(_0x4db72e){_0x50ab32(null,_0x4db72e);})[_0xddff('0x14')](function(_0x1077d9){_0x50ab32(_0x1077d9);});};AGIVertices[_0xddff('0xf')][_0xddff('0x82')]=function(_0x104c8c,_0x2bd1e9){scripts[_0xddff('0x82')](_0x104c8c[_0xddff('0x7b')],_0x104c8c[_0xddff('0x5b')],_0x104c8c[_0xddff('0x83')]||_0xddff('0x5c'),_0x104c8c[_0xddff('0x84')])[_0xddff('0x12')](function(_0x37baf8){_0x2bd1e9(null,_0x37baf8);})[_0xddff('0x14')](function(_0x505e00){_0x2bd1e9(_0x505e00);});};AGIVertices[_0xddff('0xf')]['ispeechASR']=function(_0x46bf75,_0x4c85fa,_0x333cc4){scripts['ispeechASR'](_0x4c85fa,_0x46bf75[_0xddff('0x7b')],_0x46bf75[_0xddff('0x85')]||_0xddff('0x5c'),this[_0xddff('0x86')](_0x46bf75[_0xddff('0x87')])?_0x46bf75['model']:undefined)['then'](function(_0x5dca41){_0x333cc4(null,_0x5dca41);})[_0xddff('0x14')](function(_0x5a50c0){_0x333cc4(_0x5a50c0);});};AGIVertices['prototype'][_0xddff('0x88')]=function(_0x5e2cce,_0x564085){scripts['awsPolly'](_0x5e2cce[_0xddff('0x89')],_0x5e2cce[_0xddff('0x8a')],_0x5e2cce[_0xddff('0x8b')],_0x5e2cce[_0xddff('0x8c')]||'Amy',_0x5e2cce['text'],_0x5e2cce[_0xddff('0x8d')]||'text')[_0xddff('0x12')](function(_0x39083b){_0x564085(null,_0x39083b);})[_0xddff('0x14')](function(_0x312dfb){_0x564085(_0x312dfb);});};AGIVertices[_0xddff('0xf')][_0xddff('0x8e')]=function(_0x4fe9eb,_0x1ae634){scripts[_0xddff('0x8e')](this['channel'][_0xddff('0x3b')],_0x4fe9eb[_0xddff('0x89')],_0x4fe9eb[_0xddff('0x8a')],_0x4fe9eb[_0xddff('0x8f')],_0x4fe9eb[_0xddff('0x5b')],_0x4fe9eb['aws_bot_name'])[_0xddff('0x12')](function(_0x20868f){_0x1ae634(null,_0x20868f);})[_0xddff('0x14')](function(_0x391cc9){_0x1ae634(_0x391cc9);});};AGIVertices[_0xddff('0xf')][_0xddff('0x90')]=function(_0x224287,_0x51ef18,_0x107592){scripts[_0xddff('0x90')](_0x51ef18,_0x224287['key'],_0x224287['google_asr_language']||_0xddff('0x5c'))['then'](function(_0x213181){_0x107592(null,_0x213181);})[_0xddff('0x14')](function(_0x1b8b2d){_0x107592(_0x1b8b2d);});};AGIVertices['prototype'][_0xddff('0x91')]=function(_0xe4e433,_0x59b67a,_0x312d58){scripts[_0xddff('0x91')](_0x59b67a,_0xe4e433[_0xddff('0x92')],_0xe4e433[_0xddff('0x93')],_0xe4e433[_0xddff('0x70')])[_0xddff('0x12')](function(_0x178fce){_0x312d58(null,_0x178fce);})[_0xddff('0x14')](function(_0x51ad3d){_0x312d58(_0x51ad3d);});};AGIVertices[_0xddff('0xf')][_0xddff('0x94')]=function(_0x191e0a){var _0x2ed7c4=_[_0xddff('0x66')](verticesWithRetry,_0x191e0a[_0xddff('0x95')])?_0x191e0a:_['clone'](_0x191e0a);for(var _0xf46c0a in _0x2ed7c4){if(_0x2ed7c4['hasOwnProperty'](_0xf46c0a)){if(_0x2ed7c4[_0xf46c0a]&&_['isString'](_0x2ed7c4[_0xf46c0a])){if(_[_0xddff('0x66')](recursiveMapAttributes,_0xf46c0a)){_0x2ed7c4[_0xf46c0a]=this[_0xddff('0x96')](_0x2ed7c4[_0xf46c0a]);}else{_0x2ed7c4[_0xf46c0a]=this[_0xddff('0x97')](_0x2ed7c4[_0xf46c0a]);}}}}return _0x2ed7c4;};AGIVertices[_0xddff('0xf')][_0xddff('0x98')]=function(_0x3d7a55){for(var _0x4d2429 in _0x3d7a55){if(_0x3d7a55[_0xddff('0x99')](_0x4d2429)){if(_['isPlainObject'](_0x3d7a55[_0x4d2429])){this['recursiveNodeIndex'](_0x3d7a55[_0x4d2429]);}else if(_[_0xddff('0x9a')](_0x3d7a55[_0x4d2429])){for(var _0x473994=0x0;_0x473994<_0x3d7a55[_0x4d2429][_0xddff('0x9b')];_0x473994++){this[_0xddff('0x98')](_0x3d7a55[_0x4d2429][_0x473994]);}}else if(_[_0xddff('0x9c')](_0x3d7a55[_0x4d2429])){_0x3d7a55[_0x4d2429]=this[_0xddff('0x97')](_0x3d7a55[_0x4d2429]);}}}};AGIVertices[_0xddff('0xf')][_0xddff('0x9d')]=function(_0x34991e,_0x2ab2ec){for(var _0x5766c8 in _0x34991e){if(_0x34991e[_0xddff('0x99')](_0x5766c8)){if(_[_0xddff('0x9e')](_0x34991e[_0x5766c8])){if(!_[_0xddff('0x46')](_0x34991e[_0x5766c8])){this[_0xddff('0x9d')](_0x34991e[_0x5766c8],util[_0xddff('0x28')]('%s.%s',_0x2ab2ec,_0x5766c8));}}else if(_[_0xddff('0x9a')](_0x34991e[_0x5766c8])){for(var _0xa19c42=0x0;_0xa19c42<_0x34991e[_0x5766c8][_0xddff('0x9b')];_0xa19c42++){this[_0xddff('0x9d')](_0x34991e[_0x5766c8][_0xa19c42],util[_0xddff('0x28')](_0xddff('0x9f'),_0x2ab2ec,_0x5766c8+'['+_0xa19c42+']'));}}else{if(!_[_0xddff('0x44')](_0x34991e[_0x5766c8])){this[_0xddff('0xc')][_0xddff('0xa0')](util[_0xddff('0x28')]('%s.%s',_0x2ab2ec,_0x5766c8),_0x34991e[_0x5766c8]);}}}}};AGIVertices[_0xddff('0xf')][_0xddff('0x96')]=function(_0x5c748a){try{var _0x5bb6ae=JSON[_0xddff('0x6a')](_0x5c748a);this['recursiveNodeIndex'](_0x5bb6ae);return JSON[_0xddff('0x73')](_0x5bb6ae);}catch(_0x22516b){return this[_0xddff('0x97')](_0x5c748a);}};AGIVertices[_0xddff('0xf')]['replaceAllVariables']=function(_0x22df5a){var _0x123f83=_0x22df5a[_0xddff('0xa1')]('{');for(var _0x43d221=0x1;_0x43d221<_0x123f83['length'];_0x43d221+=0x1){var _0x11fecc=_0x123f83[_0x43d221]['split']('}');if(_0x11fecc[_0xddff('0x9b')]>0x1){_0x22df5a=_0x22df5a['replaceAll']('{'+_0x11fecc[0x0]+'}',this[_0xddff('0xc')]['getVariable'](_0x11fecc[0x0])[_0xddff('0xa2')]||_0x11fecc[0x0]);}}if(_0x123f83['length']===0x1){return _0x22df5a[_0xddff('0x4d')]();}return this[_0xddff('0x97')](_0x22df5a);};AGIVertices[_0xddff('0xf')][_0xddff('0xa3')]=function(_0x542977,_0xf3053c){var _0x1c9311=this[_0xddff('0xc')][_0xddff('0x10')](_0x542977);if(_0x1c9311[_0xddff('0xa4')]===-0x1){return _0x1c9311;}logger[_0xddff('0x2d')](util[_0xddff('0x28')](_0xddff('0xa5'),_0xf3053c,_0x1c9311[_0xddff('0xa2')]));return this['channel'][_0xddff('0xa0')](_0xf3053c,_0x1c9311[_0xddff('0xa2')]);};AGIVertices['prototype'][_0xddff('0x86')]=function(_0x50d059){return _0x50d059&&_0x50d059!=='0'&&_0x50d059!=='-1'&&_0x50d059!=='';};AGIVertices['prototype']['maxRetry']=function(_0x25903b){this[_0xddff('0x36')][_0xddff('0x6f')](this,_0x25903b,'-');_0x25903b[_0xddff('0xa6')]=_0x25903b[_0xddff('0xa7')];return{'code':0xc8,'result':'-'};};AGIVertices[_0xddff('0xf')][_0xddff('0xa8')]=function(_0x54a53e){logger['info'](util[_0xddff('0x28')](_0xddff('0xa9'),_0x54a53e[_0xddff('0x37')]));if(!this[_0xddff('0x86')](_0x54a53e['text'])){return this[_0xddff('0xc')][_0xddff('0xaa')](_0xddff('0xab'));}var _0x85d035='\x22'+_0x54a53e[_0xddff('0x5b')]+'\x22';if(this[_0xddff('0x86')](_0x54a53e['options'])){_0x85d035+=','+_0x54a53e[_0xddff('0x79')];}var _0x260f1d=this[_0xddff('0xc')][_0xddff('0x58')](_0xddff('0xac'),_0x85d035);if(_0x260f1d['result']===-0x1){return _0x260f1d;}return this['channel'][_0xddff('0xaa')](util['format'](_0xddff('0xad'),_0x85d035));};AGIVertices[_0xddff('0xf')][_0xddff('0xae')]=function(_0x3c4a18){logger['info'](util['format'](_0xddff('0xaf'),_0x3c4a18[_0xddff('0x37')]));if(!this[_0xddff('0x86')](_0x3c4a18[_0xddff('0xb0')])){return this[_0xddff('0xc')][_0xddff('0xaa')](_0xddff('0xb1'));}var _0x576987=_0x3c4a18[_0xddff('0xb0')];if(this[_0xddff('0x86')](_0x3c4a18[_0xddff('0x79')])){_0x576987+=','+_0x3c4a18['options'];}var _0x5c14cd=this[_0xddff('0xc')]['exec'](_0xddff('0xb2'),_0x576987);if(_0x5c14cd['result']===-0x1){return _0x5c14cd;}var _0x26f4ff=this[_0xddff('0xa3')](_0xddff('0xb3'),_0xddff('0xb4'));if(_0x26f4ff[_0xddff('0xa4')]===-0x1){return _0x26f4ff;}var _0x1ddfa6=this[_0xddff('0xa3')](_0xddff('0xb5'),'MRCP_RECOG_TRANSCRIPT');if(_0x1ddfa6[_0xddff('0xa4')]===-0x1){return _0x1ddfa6;}var _0x480220=this[_0xddff('0xa3')](_0xddff('0xb6'),'MRCP_RECOG_INSTANCE');if(_0x480220[_0xddff('0xa4')]===-0x1){return _0x480220;}return this['channel'][_0xddff('0xaa')](util['format'](_0xddff('0xb7'),_0x576987));};AGIVertices[_0xddff('0xf')][_0xddff('0x7')]=function(_0x21e70d){logger[_0xddff('0x2d')](util[_0xddff('0x28')](_0xddff('0xb8'),_0x21e70d[_0xddff('0x37')]));return this[_0xddff('0xc')][_0xddff('0x7')]([_0x21e70d[_0xddff('0xb9')],_0x21e70d['args']]);};AGIVertices[_0xddff('0xf')]['answer']=function(_0xf09f4c){logger[_0xddff('0x2d')](util[_0xddff('0x28')](_0xddff('0xba'),_0xf09f4c[_0xddff('0x37')]));if(this[_0xddff('0x86')](_0xf09f4c['timeout'])){logger[_0xddff('0x2d')](util[_0xddff('0x28')]('Wait\x20%s\x20seconds\x20before\x20answer',_0xf09f4c['timeout']));var _0x2d9a4d=this[_0xddff('0xc')]['wait'](_0xf09f4c[_0xddff('0x64')]);if(_0x2d9a4d[_0xddff('0xa4')]===-0x1){return _0x2d9a4d;}}return this['channel'][_0xddff('0xbb')]();};AGIVertices['prototype'][_0xddff('0x4b')]=function(_0x3dde9f){logger[_0xddff('0x2d')](util[_0xddff('0x28')](_0xddff('0xbc'),_0x3dde9f[_0xddff('0x37')]));if(!this['isConfigured'](_0x3dde9f[_0xddff('0x49')])){return this[_0xddff('0xc')][_0xddff('0x2b')](_0x3dde9f,_0xddff('0xbd'));}_0x3dde9f[_0xddff('0x4a')]=moment();if(this[_0xddff('0x86')](_0x3dde9f[_0xddff('0xbe')])){_0x3dde9f['scheduledAt']=moment()[_0xddff('0xbf')](_0x3dde9f[_0xddff('0xbe')],_0xddff('0xc0'));}if(!this[_0xddff('0x86')](_0x3dde9f[_0xddff('0x4e')])){_0x3dde9f[_0xddff('0x4e')]=0x2;}this[_0xddff('0x43')][_0xddff('0x6f')](this,_0x3dde9f);return this[_0xddff('0xc')][_0xddff('0xaa')](util['format'](_0xddff('0xc1'),_0x3dde9f[_0xddff('0x48')],_0x3dde9f[_0xddff('0x49')],_0x3dde9f[_0xddff('0x4a')]));};AGIVertices['prototype'][_0xddff('0xc2')]=function(_0x57a4ba){logger[_0xddff('0x2d')](util[_0xddff('0x28')]('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x57a4ba[_0xddff('0x37')]));var _0x265efd=this[_0xddff('0xc')]['exec'](_0x57a4ba[_0xddff('0xc3')],_0x57a4ba[_0xddff('0x79')]);if(_0x265efd[_0xddff('0xa4')]===-0x1){return _0x265efd;}return this['channel'][_0xddff('0xaa')](util[_0xddff('0x28')](_0xddff('0xc4'),_0x57a4ba[_0xddff('0xc3')],_0x57a4ba[_0xddff('0x79')]));};AGIVertices[_0xddff('0xf')]['lumenvoxtts']=function(_0x360600){logger[_0xddff('0x2d')](util[_0xddff('0x28')](_0xddff('0xc5'),_0x360600[_0xddff('0x37')]));if(!this[_0xddff('0x86')](_0x360600[_0xddff('0x5b')])){return this[_0xddff('0xc')]['noop']('no\x20text\x20configured');}var _0x12efa9='\x22'+_0x360600[_0xddff('0x5b')]+'\x22';if(this['isConfigured'](_0x360600[_0xddff('0x79')])){_0x12efa9+=','+_0x360600['options'];}var _0x5950d0=this[_0xddff('0xc')][_0xddff('0x58')](_0xddff('0xac'),_0x12efa9);if(_0x5950d0['result']===-0x1){return _0x5950d0;}return this['channel'][_0xddff('0xaa')](util['format'](_0xddff('0xad'),_0x12efa9));};AGIVertices['prototype'][_0xddff('0xc6')]=function(_0x1dbb38){logger[_0xddff('0x2d')](util['format'](_0xddff('0xc7'),_0x1dbb38[_0xddff('0x37')]));if(!this[_0xddff('0x86')](_0x1dbb38[_0xddff('0x5b')])){return this['channel'][_0xddff('0xaa')](_0xddff('0xab'));}var _0x5afab9='\x22'+_0x1dbb38[_0xddff('0x5b')]+'\x22';if(this['isConfigured'](_0x1dbb38[_0xddff('0x79')])){_0x5afab9+=','+_0x1dbb38['options'];}var _0x101696=this[_0xddff('0xc')]['exec'](_0xddff('0xac'),_0x5afab9);if(_0x101696[_0xddff('0xa4')]===-0x1){return _0x101696;}return this[_0xddff('0xc')][_0xddff('0xaa')](util[_0xddff('0x28')](_0xddff('0xad'),_0x5afab9));};AGIVertices[_0xddff('0xf')]['lumenvoxasr']=function(_0x231b74){logger[_0xddff('0x2d')](util[_0xddff('0x28')](_0xddff('0xc8'),_0x231b74['label']));if(!this['isConfigured'](_0x231b74[_0xddff('0xb0')])){return this[_0xddff('0xc')][_0xddff('0xaa')](_0xddff('0xb1'));}var _0x4454b5=_0x231b74['grammar'];if(this[_0xddff('0x86')](_0x231b74[_0xddff('0x79')])){_0x4454b5+=','+_0x231b74[_0xddff('0x79')];}var _0x4bd56a=this['channel'][_0xddff('0x58')](_0xddff('0xb2'),_0x4454b5);if(_0x4bd56a[_0xddff('0xa4')]===-0x1){return _0x4bd56a;}var _0x34645e=this[_0xddff('0xa3')](_0xddff('0xb3'),_0xddff('0xc9'));if(_0x34645e['result']===-0x1){return _0x34645e;}var _0x464b1d=this[_0xddff('0xa3')]('RECOG_INPUT()',_0xddff('0xca'));if(_0x464b1d[_0xddff('0xa4')]===-0x1){return _0x464b1d;}var _0x247a00=this['getAndSetVariable'](_0xddff('0xb6'),_0xddff('0xcb'));if(_0x247a00['result']===-0x1){return _0x247a00;}return this[_0xddff('0xc')]['noop'](util[_0xddff('0x28')](_0xddff('0xb7'),_0x4454b5));};AGIVertices[_0xddff('0xf')]['sestekasr']=function(_0x5032e7){logger[_0xddff('0x2d')](util[_0xddff('0x28')](_0xddff('0xcc'),_0x5032e7[_0xddff('0x37')]));if(!this[_0xddff('0x86')](_0x5032e7[_0xddff('0xb0')])){return this[_0xddff('0xc')][_0xddff('0xaa')](_0xddff('0xb1'));}var _0x597bcd=_0x5032e7[_0xddff('0xb0')];if(this[_0xddff('0x86')](_0x5032e7[_0xddff('0x79')])){_0x597bcd+=','+_0x5032e7[_0xddff('0x79')];}var _0x33f30d=this['channel']['exec'](_0xddff('0xb2'),_0x597bcd);if(_0x33f30d[_0xddff('0xa4')]===-0x1){return _0x33f30d;}var _0x5ce538=this['getAndSetVariable'](_0xddff('0xb3'),_0xddff('0xcd'));if(_0x5ce538[_0xddff('0xa4')]===-0x1){return _0x5ce538;}var _0x22a473=this['getAndSetVariable'](_0xddff('0xb5'),'SESTEK_ASR_TRANSCRIPT');if(_0x22a473[_0xddff('0xa4')]===-0x1){return _0x22a473;}var _0x15f44b=this[_0xddff('0xa3')](_0xddff('0xb6'),_0xddff('0xce'));if(_0x15f44b[_0xddff('0xa4')]===-0x1){return _0x15f44b;}return this['channel'][_0xddff('0xaa')](util[_0xddff('0x28')](_0xddff('0xb7'),_0x597bcd));};AGIVertices[_0xddff('0xf')][_0xddff('0xcf')]=function(_0x439c07){logger[_0xddff('0x2d')](util[_0xddff('0x28')](_0xddff('0xd0'),_0x439c07[_0xddff('0x37')]));if(!this[_0xddff('0x86')](_0x439c07[_0xddff('0xd1')])){return this[_0xddff('0xc')][_0xddff('0x2b')](_0x439c07,'no\x20database\x20selected');}var _0x43e5c7=this[_0xddff('0x18')][_0xddff('0x6f')](this,_0x439c07['odbc_id']);if(!_0x43e5c7){return this[_0xddff('0xc')][_0xddff('0x2b')](_0x439c07,_0xddff('0xd2'));}if(!this[_0xddff('0x86')](_0x439c07[_0xddff('0x2e')])){return this[_0xddff('0xc')]['error'](_0x439c07,_0xddff('0xd3'));}var _0x436619=_0x439c07[_0xddff('0x2e')][_0xddff('0xd4')](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0xddff('0xaa')](util[_0xddff('0x28')](_0xddff('0xd5'),_0x436619));var _0x56680b=this[_0xddff('0x2a')][_0xddff('0x6f')](this,_0x43e5c7,_0x436619);this[_0xddff('0x36')][_0xddff('0x6f')](this,_0x439c07,_0x436619);if(!this['isConfigured'](_0x439c07[_0xddff('0xd6')])){return this['channel'][_0xddff('0xaa')](_0xddff('0xd7'));}var _0x4c53e8=this[_0xddff('0x10')][_0xddff('0x6f')](this,_0x439c07[_0xddff('0xd6')]);if(!_0x4c53e8){return this[_0xddff('0xc')][_0xddff('0x2b')](_0x439c07,_0xddff('0xd8'));}var _0x5b7e82=this;_0x56680b['forEach'](function(_0x1abeee,_0x4c8942){Object[_0xddff('0xd9')](_0x1abeee)[_0xddff('0xda')](function(_0x296ee9){_0x5b7e82[_0xddff('0xc')][_0xddff('0xa0')](util[_0xddff('0x28')]('%s[%s][%s]',_0x4c53e8,_0x4c8942,_0x296ee9),_0x1abeee[_0x296ee9]);});});this['channel'][_0xddff('0xa0')](util[_0xddff('0x28')]('%s_ROWS_COUNT',_0x4c53e8),_0x56680b['length']);return this['channel'][_0xddff('0xaa')](util[_0xddff('0x28')](_0xddff('0xdb'),_0x4c53e8));};AGIVertices['prototype'][_0xddff('0xdc')]=function(_0x5d7427){logger[_0xddff('0xdd')](util['format'](_0xddff('0xde'),_0x5d7427[_0xddff('0x37')]));if(!this[_0xddff('0x86')](_0x5d7427['sip_id'])){return this['channel']['error'](_0x5d7427,_0xddff('0xdf'));}var _0x3d12c2=this['getUser'][_0xddff('0x6f')](this,_0x5d7427[_0xddff('0xe0')]);if(!_0x3d12c2){return this[_0xddff('0xc')][_0xddff('0x2b')](_0x5d7427,_0xddff('0xe1'));}var _0x54c50a=this['channel']['exec'](_0xddff('0xe2'),[util[_0xddff('0x28')](_0xddff('0xe3'),_0x3d12c2),_0x5d7427['timeout'],_0x5d7427[_0xddff('0xe4')],_0x5d7427[_0xddff('0x72')]]);if(_0x54c50a[_0xddff('0xa4')]===-0x1){return _0x54c50a;}return this[_0xddff('0xc')][_0xddff('0xaa')](util[_0xddff('0x28')](_0xddff('0xe5'),_0xddff('0xe2')));};AGIVertices[_0xddff('0xf')]['dialogflow']=function(_0x594024){logger[_0xddff('0x2d')](util[_0xddff('0x28')](_0xddff('0xe6'),_0x594024['label']));if(!this[_0xddff('0x86')](_0x594024[_0xddff('0x7b')])){return this[_0xddff('0xc')][_0xddff('0xaa')](_0xddff('0xe7'));}if(!this['isConfigured'](_0x594024['text'])){return this[_0xddff('0xc')][_0xddff('0xaa')](_0xddff('0xab'));}this[_0xddff('0xc')][_0xddff('0xe8')]=!![];this['createSquareDetailsReport'](_0x594024);this[_0xddff('0x42')](_0x594024[_0xddff('0x5b')],'in','','');this['channel']['noop'](util['format'](_0xddff('0xe9'),_0x594024[_0xddff('0x5b')]));var _0x5df55f=this[_0xddff('0x7a')][_0xddff('0x6f')](this,_0x594024);if(_0x5df55f){for(var _0x1e5f96 in _0x5df55f){if(_0x5df55f['hasOwnProperty'](_0x1e5f96)){this[_0xddff('0xc')][_0xddff('0xa0')](util[_0xddff('0x28')](_0xddff('0xea'),_0x1e5f96[_0xddff('0x68')]()),_0x5df55f[_0x1e5f96]);}}this['createSquareMessage'](_0x5df55f[_0xddff('0xeb')],_0xddff('0xec'),_0xddff('0xed'),'');return this[_0xddff('0xc')][_0xddff('0xaa')](util[_0xddff('0x28')]('Dialogflow\x20Result\x20%s',_0x5df55f[_0xddff('0xeb')]));}return this[_0xddff('0xc')][_0xddff('0x2b')](_0x594024,_0xddff('0xee'));};AGIVertices[_0xddff('0xf')]['dialogflowV2']=function(_0x55a435){logger[_0xddff('0x2d')](util['format']('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x55a435[_0xddff('0x37')]));if(!this[_0xddff('0x86')](_0x55a435[_0xddff('0x7e')])){return this['channel'][_0xddff('0xaa')](_0xddff('0xef'));}if(!this[_0xddff('0x86')](_0x55a435[_0xddff('0x7f')])){return this['channel']['noop'](_0xddff('0xf0'));}if(!this[_0xddff('0x86')](_0x55a435[_0xddff('0xf1')])){return this[_0xddff('0xc')][_0xddff('0xaa')](_0xddff('0xf2'));}if(!this[_0xddff('0x86')](_0x55a435[_0xddff('0x80')])){return this[_0xddff('0xc')][_0xddff('0xaa')](_0xddff('0xf3'));}if(!this[_0xddff('0x86')](_0x55a435[_0xddff('0x5b')])){return this[_0xddff('0xc')]['noop'](_0xddff('0xab'));}this[_0xddff('0xc')][_0xddff('0xe8')]=!![];this['createSquareDetailsReport'](_0x55a435);this['createSquareMessage'](_0x55a435[_0xddff('0x5b')],'in','','');this[_0xddff('0xc')]['noop'](util[_0xddff('0x28')]('Trying\x20DialogflowV2:\x20%s',_0x55a435[_0xddff('0x5b')]));var _0x2cb3d2=this[_0xddff('0x7d')]['sync'](this,_0x55a435);if(_0x2cb3d2){for(var _0x62f64a in _0x2cb3d2){if(_0x2cb3d2['hasOwnProperty'](_0x62f64a)){if(_0x62f64a!==_0xddff('0xf4')){this[_0xddff('0xc')]['setVariable'](util[_0xddff('0x28')](_0xddff('0xea'),_0x62f64a[_0xddff('0x68')]()),_0x2cb3d2[_0x62f64a]);}}}this[_0xddff('0x42')](_0x2cb3d2[_0xddff('0xeb')],_0xddff('0xec'),'dialogflowV2',_0x2cb3d2[_0xddff('0xf4')]);return this['channel'][_0xddff('0xaa')](util[_0xddff('0x28')]('DialogflowV2\x20Result\x20%s',_0x2cb3d2[_0xddff('0xeb')]));}return this['channel']['error'](_0x55a435,'DialogflowV2\x20is\x20unreachable');};AGIVertices[_0xddff('0xf')]['sesteknda']=function(_0x2ecbe5){logger[_0xddff('0x2d')](util[_0xddff('0x28')](_0xddff('0xf5'),_0x2ecbe5[_0xddff('0x37')]));if(!this[_0xddff('0x86')](_0x2ecbe5['ndauth_url'])){return this[_0xddff('0xc')][_0xddff('0xaa')]('no\x20ndauth\x20url\x20configured');}if(!this['isConfigured'](_0x2ecbe5[_0xddff('0xf6')])){return this[_0xddff('0xc')][_0xddff('0xaa')](_0xddff('0xf7'));}if(!this[_0xddff('0x86')](_0x2ecbe5['password'])){return this[_0xddff('0xc')][_0xddff('0xaa')](_0xddff('0xf8'));}if(!this['isConfigured'](_0x2ecbe5[_0xddff('0xf9')])){return this[_0xddff('0xc')][_0xddff('0xaa')]('no\x20text\x20configured');}this[_0xddff('0xc')][_0xddff('0xe8')]=!![];this[_0xddff('0x36')](_0x2ecbe5);this[_0xddff('0x42')](_0x2ecbe5[_0xddff('0x5b')],'in','','');this[_0xddff('0xc')]['noop'](util[_0xddff('0x28')](_0xddff('0xfa'),_0x2ecbe5[_0xddff('0x5b')]));var _0x5b8e4d=this[_0xddff('0x81')]['sync'](this,_0x2ecbe5);if(_0x5b8e4d){for(var _0x4cb824 in _0x5b8e4d){if(_0x5b8e4d['hasOwnProperty'](_0x4cb824)){this[_0xddff('0xc')][_0xddff('0xa0')](util['format'](_0xddff('0xfb'),_0x4cb824[_0xddff('0x68')]()),_0x5b8e4d[_0x4cb824]);}}this['createSquareMessage'](_0x5b8e4d['speech'],_0xddff('0xec'),_0xddff('0xfc'),'');if(_0x5b8e4d[_0xddff('0xfd')]){this['channel'][_0xddff('0xaa')](util[_0xddff('0x28')]('Sestek\x20NDA\x20%s\x20file\x20created',_0x5b8e4d[_0xddff('0xfd')]));var _0x16279e=this[_0xddff('0xc')]['streamFile'](_0x5b8e4d[_0xddff('0xfd')]);try{fs[_0xddff('0xfe')](_0x5b8e4d[_0xddff('0xfd')]+'.wav');}catch(_0x12b7fd){logger[_0xddff('0x2b')](_0x12b7fd);}return _0x16279e;}else{return this[_0xddff('0xc')][_0xddff('0xaa')](util['format'](_0xddff('0xff'),_0x5b8e4d['speech']));}}return this['channel']['error'](_0x2ecbe5,_0xddff('0x100'));};AGIVertices[_0xddff('0xf')][_0xddff('0x101')]=function(_0x4a6d0f){logger[_0xddff('0x2d')](util[_0xddff('0x28')](_0xddff('0x102'),_0x4a6d0f[_0xddff('0x37')]));return this[_0xddff('0xc')][_0xddff('0xaa')]('end');};AGIVertices[_0xddff('0xf')][_0xddff('0x103')]=function(_0x1e690c){logger[_0xddff('0x2d')](util[_0xddff('0x28')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x1e690c[_0xddff('0x37')]));var _0x2c5eee='';if(_0x1e690c['trunk_id']){if(!this['isConfigured'](_0x1e690c['trunk_id'])){return this[_0xddff('0xc')][_0xddff('0x2b')](_0x1e690c,_0xddff('0x104'));}else{var _0x41d7d5=parseInt(_0x1e690c[_0xddff('0x105')],0xa);if(isNaN(_0x41d7d5)){_0x2c5eee=_0x1e690c[_0xddff('0x105')];}else{_0x2c5eee=this[_0xddff('0x1d')]['sync'](this,_0x1e690c['trunk_id']);if(!_0x2c5eee){return this[_0xddff('0xc')][_0xddff('0x2b')](_0x1e690c,_0xddff('0x106'));}}}}else if(_0x1e690c[_0xddff('0x107')]){_0x2c5eee=_0x1e690c[_0xddff('0x107')];}else{return this[_0xddff('0xc')][_0xddff('0x2b')](_0x1e690c,_0xddff('0x104'));}var _0xee176d=this[_0xddff('0xc')][_0xddff('0x58')](_0xddff('0xe2'),[util['format'](_0xddff('0x108'),_0x2c5eee,_0x1e690c[_0xddff('0x48')]),_0x1e690c[_0xddff('0x64')],_0x1e690c[_0xddff('0xe4')],_0x1e690c[_0xddff('0x72')]]);if(_0xee176d[_0xddff('0xa4')]===-0x1){return _0xee176d;}return this[_0xddff('0xc')][_0xddff('0xaa')](util['format'](_0xddff('0xe5'),_0xddff('0xe2')));};AGIVertices['prototype'][_0xddff('0x109')]=function(_0x1fccdb){logger[_0xddff('0x2d')](util[_0xddff('0x28')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x1fccdb[_0xddff('0x37')]));return this['channel']['noop'](_0xddff('0x109'));};AGIVertices[_0xddff('0xf')][_0xddff('0x10a')]=function(_0x25672a){logger[_0xddff('0x2d')](util[_0xddff('0x28')](_0xddff('0x10b'),_0x25672a['label']));if(_0x25672a[_0xddff('0xa6')]===0x0){return this['maxRetry'](_0x25672a);}_0x25672a['retry']-=0x1;if(!this[_0xddff('0x86')](_0x25672a[_0xddff('0x10c')])){return this[_0xddff('0xc')][_0xddff('0x2b')](_0x25672a,'no\x20file\x20audio\x20selected');}var _0x508276=this[_0xddff('0x1e')]['sync'](this,_0x25672a[_0xddff('0x10c')]);if(!_0x508276){return this[_0xddff('0xc')]['error'](_0x25672a,'no\x20file\x20audio\x20found');}if(!this[_0xddff('0x86')](_0x25672a[_0xddff('0xd6')])){return this['channel']['error'](_0xddff('0xd7'));}var _0x3258a5=this['channel'][_0xddff('0x10d')](_0x508276,_0x25672a[_0xddff('0x10e')],_0x25672a[_0xddff('0x10f')]);var _0x496056=_0x3258a5['result']?_0x3258a5[_0xddff('0xa4')][_0xddff('0x4d')]():'';logger[_0xddff('0x2d')]('test',JSON[_0xddff('0x73')](_0x3258a5));if(_0x3258a5[_0xddff('0xa4')]===-0x1){this[_0xddff('0x36')][_0xddff('0x6f')](this,_0x25672a,_0x496056);return _0x3258a5;}else if(_0x3258a5[_0xddff('0xa2')]===_0xddff('0x64')){_0x3258a5[_0xddff('0xa4')]=_0x496056[_0xddff('0x9b')]>=parseInt(_0x25672a['mindigit'])?'x':'i';}else{_0x3258a5[_0xddff('0xa4')]=_0x496056[_0xddff('0x9b')]>=parseInt(_0x25672a[_0xddff('0x110')])&&_0x496056[_0xddff('0x9b')]<=parseInt(_0x25672a['maxdigit'])?'x':'i';}var _0x3221c9=this[_0xddff('0x10')]['sync'](this,_0x25672a['variable_id']);if(!_0x3221c9){return this[_0xddff('0xc')][_0xddff('0x2b')](_0x25672a,'no\x20variable\x20found');}this[_0xddff('0xc')][_0xddff('0xa0')](_0x3221c9,_0x496056);if(this[_0xddff('0x86')](_0x25672a[_0xddff('0x111')])){var _0x29d54c=parseInt(_0x25672a[_0xddff('0x111')],0xa);var _0x438cde=rs[_0xddff('0x112')]({'charset':'*','length':_0x29d54c});var _0xd1e0c1=_0x496056[_0xddff('0x9b')];if(_0xd1e0c1>0x0){if(_0xd1e0c1>_0x29d54c){this['createSquareDetailsReport'][_0xddff('0x6f')](this,_0x25672a,_0x25672a['hiddendigitspos']===_0xddff('0x113')?_0x438cde+_0x496056['substr'](_0x29d54c):_0x496056[_0xddff('0x114')](0x0,_0xd1e0c1-_0x29d54c)+_0x438cde);}else{this[_0xddff('0x36')][_0xddff('0x6f')](this,_0x25672a,rs[_0xddff('0x112')]({'charset':'*','length':_0xd1e0c1}));}}else{this['createSquareDetailsReport'][_0xddff('0x6f')](this,_0x25672a,'');}}else{this[_0xddff('0x36')][_0xddff('0x6f')](this,_0x25672a,_0x496056);}return _0x3258a5;};AGIVertices[_0xddff('0xf')][_0xddff('0x115')]=function(_0x401cf3){logger[_0xddff('0x2d')](util[_0xddff('0x28')](_0xddff('0x116'),_0x401cf3[_0xddff('0x37')]));return this['getdigits'](_0x401cf3);};AGIVertices[_0xddff('0xf')][_0xddff('0x117')]=function(_0x366f10){logger[_0xddff('0x2d')](util[_0xddff('0x28')](_0xddff('0x118'),_0x366f10[_0xddff('0x37')]));this[_0xddff('0x36')][_0xddff('0x6f')](this,_0x366f10,_0x366f10[_0xddff('0x119')]);return this[_0xddff('0xc')][_0xddff('0xaa')](util[_0xddff('0x28')](_0xddff('0x11a'),_0x366f10[_0xddff('0x119')]));};AGIVertices[_0xddff('0xf')][_0xddff('0x11b')]=function(_0x2df2ce){logger[_0xddff('0x2d')](util[_0xddff('0x28')](_0xddff('0x11c'),_0x2df2ce[_0xddff('0x37')]));if(!this[_0xddff('0x86')](_0x2df2ce[_0xddff('0x89')])||!this[_0xddff('0x86')](_0x2df2ce[_0xddff('0x8a')])){return this[_0xddff('0xc')][_0xddff('0xaa')](_0xddff('0x11d'));}if(!this[_0xddff('0x86')](_0x2df2ce[_0xddff('0x5b')])){return this['channel'][_0xddff('0xaa')](_0xddff('0xab'));}this['channel'][_0xddff('0xaa')](util[_0xddff('0x28')](_0xddff('0x11e'),_0x2df2ce[_0xddff('0x5b')]));var _0x5b6aaa=this['awsPolly'][_0xddff('0x6f')](this,_0x2df2ce);if(_0x5b6aaa){this['channel'][_0xddff('0xaa')](util[_0xddff('0x28')]('aws\x20Polly\x20%s\x20file\x20created',_0x5b6aaa));var _0x429bde=this[_0xddff('0xc')]['streamFile'](_0x5b6aaa);try{fs[_0xddff('0xfe')](_0x5b6aaa+_0xddff('0x11f'));}catch(_0x34c54f){logger[_0xddff('0x2b')](_0x34c54f);}return _0x429bde;}return this[_0xddff('0xc')][_0xddff('0x2b')](_0x2df2ce,_0xddff('0x120'));};AGIVertices[_0xddff('0xf')][_0xddff('0x121')]=function(_0x174042){logger[_0xddff('0x2d')](util[_0xddff('0x28')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x174042[_0xddff('0x37')]));if(!this[_0xddff('0x86')](_0x174042[_0xddff('0x89')])||!this[_0xddff('0x86')](_0x174042[_0xddff('0x8a')])){return this[_0xddff('0xc')]['noop'](_0xddff('0x11d'));}if(!this['isConfigured'](_0x174042[_0xddff('0x122')])){return this[_0xddff('0xc')]['noop'](_0xddff('0x123'));}if(!this[_0xddff('0x86')](_0x174042[_0xddff('0x5b')])){return this[_0xddff('0xc')][_0xddff('0xaa')]('no\x20text\x20configured');}this[_0xddff('0xc')][_0xddff('0xe8')]=!![];this[_0xddff('0x36')](_0x174042);this[_0xddff('0x42')](_0x174042['text'],'in','','');this[_0xddff('0xc')]['noop'](util[_0xddff('0x28')]('Trying\x20Amazon\x20Lex:\x20%s',_0x174042[_0xddff('0x5b')]));var _0x43b9ff=this[_0xddff('0x8e')][_0xddff('0x6f')](this,_0x174042);if(_0x43b9ff){for(var _0x48595e in _0x43b9ff){if(_0x43b9ff['hasOwnProperty'](_0x48595e)&&_[_0xddff('0x9c')](_0x43b9ff[_0x48595e])){this[_0xddff('0xc')]['setVariable'](util[_0xddff('0x28')]('AWS_LEX_%s',_0x48595e[_0xddff('0x68')]()),_0x43b9ff[_0x48595e]);}}if(_[_0xddff('0x44')](_0x43b9ff[_0xddff('0x77')])){return this[_0xddff('0xc')][_0xddff('0xaa')]('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this[_0xddff('0x42')](_0x43b9ff[_0xddff('0x77')],_0xddff('0xec'),_0xddff('0x124'),'');return this['channel'][_0xddff('0xaa')](util[_0xddff('0x28')](_0xddff('0x125'),_0x43b9ff['message']));}}return this[_0xddff('0xc')][_0xddff('0x2b')](_0x174042,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices['prototype'][_0xddff('0x126')]=function(_0x9cc13d){logger[_0xddff('0x2d')](util[_0xddff('0x28')](_0xddff('0x127'),_0x9cc13d[_0xddff('0x37')],_0x9cc13d[_0xddff('0x64')]));if(!this['isConfigured'](_0x9cc13d['key'])){return this['channel'][_0xddff('0xaa')](_0xddff('0xe7'));}var _0x106c7f=_0xddff('0x128');var _0x4d7a31=util[_0xddff('0x28')]('%s/recordings/%s',FILES_PATH,rs['generate'](0x4));var _0x3a4fe8=util[_0xddff('0x28')](_0xddff('0x9f'),_0x4d7a31,_0x106c7f);var _0x4d02b=!![];if(_0x9cc13d['beep']===_0xddff('0x129')){_0x4d02b=![];}var _0x1236d5=this[_0xddff('0xc')][_0xddff('0x12a')](_0x4d7a31,_0x106c7f,_0x9cc13d['intKey'],_0x9cc13d['timeout'],undefined,_0x4d02b);if(_0x1236d5[_0xddff('0xa4')]!==-0x1){this[_0xddff('0xc')]['noop'](util[_0xddff('0x28')](_0xddff('0x12b'),_0x3a4fe8));var _0x4ecfeb=this[_0xddff('0x90')][_0xddff('0x6f')](this,_0x9cc13d,_0x3a4fe8);if(_0x4ecfeb){for(var _0x8f7b70 in _0x4ecfeb){if(_0x4ecfeb['hasOwnProperty'](_0x8f7b70)){this[_0xddff('0xc')]['setVariable'](util[_0xddff('0x28')](_0xddff('0x12c'),_0x8f7b70[_0xddff('0x68')]()),_0x4ecfeb[_0x8f7b70]);}}return this[_0xddff('0xc')]['noop'](util['format'](_0xddff('0x12d'),JSON[_0xddff('0x73')](_0x4ecfeb)));}}return _0x1236d5;};AGIVertices[_0xddff('0xf')]['tildeasr']=function(_0x7cf43){logger[_0xddff('0x2d')](util[_0xddff('0x28')]('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x7cf43['label']));if(!this[_0xddff('0x86')](_0x7cf43[_0xddff('0x92')])){return this[_0xddff('0xc')][_0xddff('0xaa')](_0xddff('0x12e'));}if(!this[_0xddff('0x86')](_0x7cf43['appsecret'])){return this[_0xddff('0xc')][_0xddff('0xaa')]('no\x20appsecret\x20configured');}var _0x3f3408='wav';var _0x233954=util[_0xddff('0x28')]('%s/recordings/%s',FILES_PATH,rs[_0xddff('0x112')](0x4));var _0x5ab35b=util['format']('%s.%s',_0x233954,_0x3f3408);var _0x34b48a=!![];if(_0x7cf43[_0xddff('0x12f')]===_0xddff('0x129')){_0x34b48a=![];}var _0x4e1826=this['channel'][_0xddff('0x12a')](_0x233954,_0x3f3408,_0x7cf43['intKey'],_0x7cf43['timeout'],undefined,_0x34b48a);if(_0x4e1826[_0xddff('0xa4')]!==-0x1){this[_0xddff('0xc')][_0xddff('0xaa')](util[_0xddff('0x28')](_0xddff('0x130'),_0x5ab35b));var _0x1719f2=this['tildeASR'][_0xddff('0x6f')](this,_0x7cf43,_0x5ab35b);if(_0x1719f2){for(var _0x196e51 in _0x1719f2){if(_0x1719f2[_0xddff('0x99')](_0x196e51)){this[_0xddff('0xc')]['setVariable'](util['format'](_0xddff('0x131'),_0x196e51['toUpperCase']()),_0x1719f2[_0x196e51]);}}return this[_0xddff('0xc')][_0xddff('0xaa')](util[_0xddff('0x28')](_0xddff('0x132'),JSON['stringify'](_0x1719f2)));}}return _0x4e1826;};AGIVertices[_0xddff('0xf')][_0xddff('0x133')]=function(_0x32580a){logger[_0xddff('0x2d')](util[_0xddff('0x28')](_0xddff('0x134'),_0x32580a[_0xddff('0x37')]));return this[_0xddff('0xc')][_0xddff('0x135')](_0x32580a[_0xddff('0x136')],_0x32580a[_0xddff('0x3d')],_0x32580a[_0xddff('0x3e')]);};AGIVertices[_0xddff('0xf')][_0xddff('0x137')]=function(_0x27fd36){logger['info'](util[_0xddff('0x28')](_0xddff('0x138'),_0x27fd36['label']));if(!this[_0xddff('0x86')](_0x27fd36[_0xddff('0x139')])){return this[_0xddff('0xc')]['error'](_0x27fd36,'no\x20condition\x20configured');}try{var _0x2ddb60=eval(_0x27fd36[_0xddff('0x139')])?_0xddff('0x13a'):_0xddff('0x13b');this[_0xddff('0xc')][_0xddff('0xaa')](util[_0xddff('0x28')](_0xddff('0x13c'),_0x27fd36[_0xddff('0x139')],_0x2ddb60));return{'code':0xc8,'result':_0x2ddb60};}catch(_0xc4a60d){return{'code':0xc8,'result':_0xddff('0x13b')};}};AGIVertices[_0xddff('0xf')]['gotoiftime']=function(_0x210e8b){logger[_0xddff('0x2d')](util[_0xddff('0x28')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x210e8b['label']));if(!this[_0xddff('0x86')](_0x210e8b[_0xddff('0x13d')])){return this['channel'][_0xddff('0x2b')](_0x210e8b,'no\x20interval\x20configured');}var _0x435a54=this['getIntervals']['sync'](this,_0x210e8b[_0xddff('0x13d')]);if(!_0x435a54){return this['channel']['error'](_0x210e8b,_0xddff('0x13e'));}for(var _0x2ac7d9=0x0;_0x2ac7d9<_0x435a54[_0xddff('0x9b')];_0x2ac7d9+=0x1){var _0x3a78b6=this[_0xddff('0xc')][_0xddff('0x10')](util[_0xddff('0x28')](_0xddff('0x13f'),_0x435a54[_0x2ac7d9]));if(_0x3a78b6[_0xddff('0xa4')]===-0x1){return _0x3a78b6;}logger[_0xddff('0x2d')](util[_0xddff('0x28')](_0xddff('0x140'),_0x435a54[_0x2ac7d9],_0x3a78b6[_0xddff('0xa2')]));if(_0x3a78b6[_0xddff('0xa2')]==='true'){logger['info'](util[_0xddff('0x28')]('IFTIME\x20%s\x20%s',_0x435a54[_0x2ac7d9],'true'));this['channel'][_0xddff('0xaa')](util['format'](_0xddff('0x140'),_0x435a54[_0x2ac7d9],_0xddff('0x13a')));return{'code':0xc8,'result':'true'};}else{logger[_0xddff('0x2d')](util[_0xddff('0x28')](_0xddff('0x140'),_0x435a54[_0x2ac7d9],_0xddff('0x13b')));this[_0xddff('0xc')]['noop'](util[_0xddff('0x28')](_0xddff('0x140'),_0x435a54[_0x2ac7d9],_0xddff('0x13b')));}}return{'code':0xc8,'result':_0xddff('0x13b')};};AGIVertices[_0xddff('0xf')][_0xddff('0x141')]=function(_0x1d15fd){logger[_0xddff('0x2d')](util[_0xddff('0x28')](_0xddff('0x142'),_0x1d15fd['label']));return this[_0xddff('0xc')][_0xddff('0x141')]();};AGIVertices[_0xddff('0xf')][_0xddff('0x143')]=function(_0x47ca70){logger[_0xddff('0x2d')](util['format'](_0xddff('0x144'),_0x47ca70[_0xddff('0x37')]));if(!this[_0xddff('0x86')](_0x47ca70[_0xddff('0x7b')])){return this['channel'][_0xddff('0xaa')](_0xddff('0xe7'));}var _0x136025=_0xddff('0x128');var _0x4d4e15=util[_0xddff('0x28')](_0xddff('0x145'),FILES_PATH,rs[_0xddff('0x112')](0x4));var _0x3afbbc=util['format']('%s.%s',_0x4d4e15,_0x136025);var _0x15ec19=!![];if(_0x47ca70[_0xddff('0x12f')]===_0xddff('0x129')){_0x15ec19=![];}var _0x84c8de=this[_0xddff('0xc')][_0xddff('0x12a')](_0x4d4e15,_0x136025,_0x47ca70['intKey'],_0x47ca70[_0xddff('0x64')],undefined,_0x15ec19);if(_0x84c8de[_0xddff('0xa4')]!==-0x1){this[_0xddff('0xc')]['noop'](util[_0xddff('0x28')]('ispeech\x20%s\x20file\x20created',_0x3afbbc));var _0xa6250f=this[_0xddff('0x146')][_0xddff('0x6f')](this,_0x47ca70,_0x3afbbc);if(_0xa6250f){for(var _0x16a028 in _0xa6250f){if(_0xa6250f[_0xddff('0x99')](_0x16a028)){this[_0xddff('0xc')][_0xddff('0xa0')](util['format'](_0xddff('0x147'),_0x16a028[_0xddff('0x68')]()),_0xa6250f[_0x16a028]);}}return this[_0xddff('0xc')]['noop'](util[_0xddff('0x28')]('IspeechASR\x20Result\x20%s',JSON['stringify'](_0xa6250f)));}}return _0x84c8de;};AGIVertices[_0xddff('0xf')]['ispeechtts']=function(_0x3c4c7d){logger['info'](util[_0xddff('0x28')]('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x3c4c7d[_0xddff('0x37')]));if(!this[_0xddff('0x86')](_0x3c4c7d[_0xddff('0x7b')])){return this[_0xddff('0xc')]['noop']('no\x20key\x20configured');}if(!this[_0xddff('0x86')](_0x3c4c7d[_0xddff('0x5b')])){return this['channel']['noop'](_0xddff('0xab'));}this[_0xddff('0xc')]['noop'](util[_0xddff('0x28')](_0xddff('0x148'),_0x3c4c7d[_0xddff('0x5b')]));var _0x57cc61=this[_0xddff('0x82')][_0xddff('0x6f')](this,_0x3c4c7d);if(_0x57cc61){this[_0xddff('0xc')][_0xddff('0xaa')](util[_0xddff('0x28')](_0xddff('0x149'),_0x57cc61));var _0x157e4d=this[_0xddff('0xc')][_0xddff('0x14a')](_0x57cc61,_0x3c4c7d[_0xddff('0x14b')]);try{fs[_0xddff('0xfe')](_0x57cc61+'.wav');}catch(_0x3e6394){logger[_0xddff('0x2b')](_0x3e6394);}return _0x157e4d;}return this['channel'][_0xddff('0x2b')](_0x3c4c7d,_0xddff('0x14c'));};AGIVertices[_0xddff('0xf')][_0xddff('0x14d')]=function(_0x2e31f7){logger[_0xddff('0x2d')](util[_0xddff('0x28')](_0xddff('0x14e'),_0x2e31f7[_0xddff('0x37')]));if(!this[_0xddff('0x86')](_0x2e31f7[_0xddff('0x14f')])){return this[_0xddff('0xc')][_0xddff('0x2b')](_0x2e31f7,_0xddff('0x150'));}logger[_0xddff('0x2d')](util[_0xddff('0x28')](_0xddff('0x151'),this[_0xddff('0xc')][_0xddff('0x39')],_0x2e31f7[_0xddff('0x14f')]));var _0x47db2a=this[_0xddff('0x54')]['sync'](this,_0x2e31f7[_0xddff('0x14f')]);if(_0x47db2a){logger[_0xddff('0x2d')](util[_0xddff('0x28')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xddff('0xc')][_0xddff('0x39')],_0x2e31f7[_0xddff('0x14f')]));this[_0xddff('0xc')][_0xddff('0xaa')](util['format'](_0xddff('0x152'),this[_0xddff('0xc')][_0xddff('0x39')],_0x2e31f7[_0xddff('0x14f')]));return{'code':0xc8,'result':_0xddff('0x153')};}else{logger['info'](util['format'](_0xddff('0x154'),this['channel']['callerid'],_0x2e31f7[_0xddff('0x14f')]));this[_0xddff('0xc')][_0xddff('0xaa')](util[_0xddff('0x28')](_0xddff('0x154'),this[_0xddff('0xc')][_0xddff('0x39')],_0x2e31f7[_0xddff('0x14f')]));return{'code':0xc8,'result':_0xddff('0x155')};}};AGIVertices[_0xddff('0xf')][_0xddff('0x156')]=function(_0x5afca2){logger[_0xddff('0x2d')](util[_0xddff('0x28')](_0xddff('0x157'),_0x5afca2['label']));if(!this['isConfigured'](_0x5afca2[_0xddff('0x14f')])){return this[_0xddff('0xc')][_0xddff('0x2b')](_0x5afca2,_0xddff('0x150'));}logger[_0xddff('0x2d')](util['format'](_0xddff('0x151'),this[_0xddff('0xc')][_0xddff('0x39')],_0x5afca2[_0xddff('0x14f')]));var _0x2db790=this[_0xddff('0x53')]['sync'](this,_0x5afca2[_0xddff('0x14f')]);if(_0x2db790){logger['info'](util[_0xddff('0x28')](_0xddff('0x152'),this['channel'][_0xddff('0x39')],_0x5afca2[_0xddff('0x14f')]));this[_0xddff('0xc')][_0xddff('0xaa')](util[_0xddff('0x28')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xddff('0xc')][_0xddff('0x39')],_0x5afca2[_0xddff('0x14f')]));return{'code':0xc8,'result':_0xddff('0x153')};}else{logger[_0xddff('0x2d')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0xddff('0x39')],_0x5afca2[_0xddff('0x14f')]));this[_0xddff('0xc')][_0xddff('0xaa')](util[_0xddff('0x28')](_0xddff('0x154'),this[_0xddff('0xc')][_0xddff('0x39')],_0x5afca2[_0xddff('0x14f')]));return{'code':0xc8,'result':_0xddff('0x155')};}};AGIVertices['prototype'][_0xddff('0x158')]=function(_0x212cfe){logger[_0xddff('0x2d')](util[_0xddff('0x28')](_0xddff('0x159'),_0x212cfe['label']));if(!this[_0xddff('0x86')](_0x212cfe[_0xddff('0x15a')])){return this[_0xddff('0xc')][_0xddff('0x2b')](_0x212cfe,'no\x20operation\x20configured');}this['channel'][_0xddff('0xaa')](util[_0xddff('0x28')](_0xddff('0x15b'),_0x212cfe[_0xddff('0x15a')]));var _0x31cccf=eval(_0x212cfe[_0xddff('0x15a')]);if(!this[_0xddff('0x86')](_0x212cfe[_0xddff('0xd6')])){return this['channel'][_0xddff('0xaa')](_0xddff('0xd7'));}var _0x249e74=this[_0xddff('0x10')][_0xddff('0x6f')](this,_0x212cfe[_0xddff('0xd6')]);if(!_0x249e74){return this[_0xddff('0xc')][_0xddff('0x2b')](_0x212cfe,_0xddff('0xd8'));}if(_['isArray'](_0x31cccf)){var _0x4de3e6=this;_0x31cccf[_0xddff('0xda')](function(_0x235484,_0x17aa08){_0x4de3e6['channel'][_0xddff('0xa0')](util[_0xddff('0x28')]('%s[%s]',_0x249e74,_0x17aa08),_0x235484);});return this[_0xddff('0xc')]['noop'](util[_0xddff('0x28')](_0xddff('0x15c'),_0x249e74));}else{return this[_0xddff('0xc')]['setVariable'](_0x249e74,_0x31cccf);}};AGIVertices[_0xddff('0xf')][_0xddff('0xb')]=function(_0x2b5532){logger['info'](util['format'](_0xddff('0x15d'),_0x2b5532[_0xddff('0x37')]));if(_0x2b5532[_0xddff('0xa6')]===0x0){return this['maxRetry'](_0x2b5532);}_0x2b5532[_0xddff('0xa6')]-=0x1;if(!this[_0xddff('0x86')](_0x2b5532[_0xddff('0x10c')])){return this[_0xddff('0xc')][_0xddff('0x2b')](_0x2b5532,'no\x20file\x20audio\x20selected');}var _0x330e10=this[_0xddff('0x1e')][_0xddff('0x6f')](this,_0x2b5532[_0xddff('0x10c')]);if(!_0x330e10){return this[_0xddff('0xc')]['error'](_0x2b5532,_0xddff('0x15e'));}var _0x4e207c=this[_0xddff('0xc')]['getData'](_0x330e10,_0x2b5532[_0xddff('0x10e')],_0x2b5532[_0xddff('0x15f')]);var _0x17863c=_0x4e207c[_0xddff('0xa4')];if(_0x4e207c[_0xddff('0xa4')]===-0x1){this[_0xddff('0x36')][_0xddff('0x6f')](this,_0x2b5532,'-1');return _0x4e207c;}else if(_0x4e207c[_0xddff('0xa2')]===_0xddff('0x64')){_0x4e207c[_0xddff('0xa4')]=_0x4e207c[_0xddff('0xa4')]['length']>0x0?_0x4e207c[_0xddff('0xa4')]:'t';}else if(_[_0xddff('0x46')](_0x4e207c['result'])){_0x4e207c[_0xddff('0xa4')]='#';_0x17863c='#';}if(!this['isConfigured'](_0x2b5532[_0xddff('0xd6')])){this[_0xddff('0xc')][_0xddff('0xaa')](_0xddff('0xd7'));}else{var _0x2abf1f=this[_0xddff('0x10')][_0xddff('0x6f')](this,_0x2b5532[_0xddff('0xd6')]);if(!_0x2abf1f){return this['channel'][_0xddff('0x2b')](_0x2b5532,_0xddff('0xd8'));}this['channel']['setVariable'](_0x2abf1f,_0x17863c);}this['createSquareDetailsReport'][_0xddff('0x6f')](this,_0x2b5532,_0x17863c);return _0x4e207c;};AGIVertices[_0xddff('0xf')][_0xddff('0xaa')]=function(_0xb5105f){logger['info'](util['format']('Enter\x20in\x20NOOP\x20(%s)\x20block',_0xb5105f[_0xddff('0x37')]));return this['channel']['noop'](_0xb5105f[_0xddff('0x160')]||_0xb5105f[_0xddff('0x37')]);};AGIVertices[_0xddff('0xf')]['pause']=function(_0x1f43f4){logger[_0xddff('0x2d')](util['format'](_0xddff('0x161'),_0x1f43f4[_0xddff('0x37')]));if(!this['isConfigured'](_0x1f43f4['findBy'])){return this[_0xddff('0xc')][_0xddff('0x2b')](_0x1f43f4,'no\x20find\x20by\x20configured');}logger[_0xddff('0x2d')](util[_0xddff('0x28')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xddff('0xc')]['callerid'],_0x1f43f4['findBy']));var _0x3b98bf=this['getPause']['sync'](this,_0x1f43f4[_0xddff('0x162')]);var _0x1b2f1a=this[_0xddff('0x50')]['sync'](this,_0x1f43f4[_0xddff('0x14f')],_0x3b98bf);if(_0x1b2f1a){logger[_0xddff('0x2d')](util[_0xddff('0x28')](_0xddff('0x152'),this[_0xddff('0xc')][_0xddff('0x39')],_0x1f43f4[_0xddff('0x14f')]));this[_0xddff('0xc')]['noop'](util[_0xddff('0x28')](_0xddff('0x152'),this['channel'][_0xddff('0x39')],_0x1f43f4[_0xddff('0x14f')]));return{'code':0xc8,'result':_0xddff('0x153')};}else{logger[_0xddff('0x2d')](util['format'](_0xddff('0x154'),this[_0xddff('0xc')]['callerid'],_0x1f43f4[_0xddff('0x14f')]));this['channel'][_0xddff('0xaa')](util[_0xddff('0x28')](_0xddff('0x152'),this[_0xddff('0xc')][_0xddff('0x39')],_0x1f43f4['findBy']));return{'code':0xc8,'result':_0xddff('0x155')};}};AGIVertices[_0xddff('0xf')][_0xddff('0x163')]=function(_0x5c1cdc){logger[_0xddff('0x2d')](util[_0xddff('0x28')](_0xddff('0x164'),_0x5c1cdc[_0xddff('0x37')]));if(!this[_0xddff('0x86')](_0x5c1cdc[_0xddff('0x10c')])){return this['channel'][_0xddff('0x2b')](_0x5c1cdc,'no\x20file\x20audio\x20selected');}var _0x4f2bc3=this[_0xddff('0x1e')]['sync'](this,_0x5c1cdc[_0xddff('0x10c')]);if(!_0x4f2bc3){return this[_0xddff('0xc')][_0xddff('0x2b')](_0x5c1cdc,_0xddff('0x15e'));}var _0x38a3ce=this[_0xddff('0xc')][_0xddff('0x58')](_0xddff('0x165'),[_0x4f2bc3,_0x5c1cdc['opts']]);if(_0x38a3ce[_0xddff('0xa4')]===-0x1){return _0x38a3ce;}return this[_0xddff('0xc')][_0xddff('0xaa')](util[_0xddff('0x28')](_0xddff('0xc4'),_0xddff('0x165'),_0x4f2bc3));};AGIVertices[_0xddff('0xf')][_0xddff('0x166')]=function(_0x2eb984){logger['info'](util['format'](_0xddff('0x167'),_0x2eb984[_0xddff('0x37')]));if(!this['isConfigured'](_0x2eb984[_0xddff('0x168')])){return this[_0xddff('0xc')][_0xddff('0x2b')](_0x2eb984,_0xddff('0x169'));}var _0x4cd77d='';var _0x1dbb83=parseInt(_0x2eb984[_0xddff('0x168')],0xa);if(isNaN(_0x1dbb83)){_0x4cd77d=_0x2eb984[_0xddff('0x168')];}else{_0x4cd77d=this[_0xddff('0x16a')][_0xddff('0x6f')](this,_0x2eb984[_0xddff('0x168')]);if(!_0x4cd77d){return this['channel'][_0xddff('0x2b')](_0x2eb984,_0xddff('0x16b'));}}var _0x3cfd08='';if(this[_0xddff('0x86')](_0x2eb984['file_id'])){var _0x2c7e4d=this[_0xddff('0x1e')][_0xddff('0x6f')](this,_0x2eb984['file_id']);if(_0x2c7e4d){_0x3cfd08=_0x2c7e4d;}}this['createSquareDetailsReport'][_0xddff('0x6f')](this,_0x2eb984,_0x4cd77d);if(_0x2eb984['opts'][_0xddff('0x16c')]('x')<0x0){_0x2eb984[_0xddff('0xe4')]+='x';}if(_0x2eb984['opts'][_0xddff('0x16c')]('X')<0x0){_0x2eb984[_0xddff('0xe4')]+='X';}this[_0xddff('0xc')][_0xddff('0xa0')](_0xddff('0x16d'),_0x4cd77d?_0x4cd77d[_0xddff('0x16e')]():'');var _0x230fba=this[_0xddff('0xc')][_0xddff('0x58')](_0xddff('0x16f'),[_0x4cd77d,_0x2eb984[_0xddff('0xe4')],_0x2eb984[_0xddff('0x72')],_0x3cfd08,_0x2eb984[_0xddff('0x64')],_0x2eb984[_0xddff('0x7')],_0x2eb984[_0xddff('0x170')],_0x2eb984['gosub'],'',_0x2eb984[_0xddff('0x171')]]);if(_0x230fba[_0xddff('0xa4')]===-0x1){return _0x230fba;}return this['channel'][_0xddff('0xaa')](util[_0xddff('0x28')](_0xddff('0xc4'),_0xddff('0x16f'),_0x4cd77d));};AGIVertices[_0xddff('0xf')][_0xddff('0x172')]=function(_0x59a01c){logger[_0xddff('0x2d')](util['format'](_0xddff('0x173'),_0x59a01c[_0xddff('0x37')]));var _0x53e973=_0x59a01c[_0xddff('0x174')]||'wav';var _0x4c5245=util['format']('%s_%s',this[_0xddff('0xc')][_0xddff('0x3b')],rs[_0xddff('0x112')](0x5));var _0x4df0da=util['format']('%s/recordings/%s.%s',FILES_PATH,_0x4c5245,_0x53e973);var _0x384fc8=util[_0xddff('0x28')](_0xddff('0x145'),FILES_PATH,_0x4c5245);this[_0xddff('0x3a')][_0xddff('0x6f')](this,_0x59a01c,_0x4c5245,_0x4df0da);this['channel'][_0xddff('0xa0')](_0xddff('0x175'),_0x4c5245);logger[_0xddff('0x2d')](_0xddff('0x176'),_0x384fc8,_0x53e973,_0x59a01c[_0xddff('0x177')],_0x59a01c[_0xddff('0x64')]);return this[_0xddff('0xc')][_0xddff('0x12a')](_0x384fc8,_0x53e973,_0x59a01c[_0xddff('0x177')],_0x59a01c[_0xddff('0x64')],undefined,!![]);};AGIVertices['prototype'][_0xddff('0x178')]=function(_0x570ce2){logger[_0xddff('0x2d')](util[_0xddff('0x28')](_0xddff('0x179'),_0x570ce2[_0xddff('0x37')]));if(!this[_0xddff('0x86')](_0x570ce2[_0xddff('0x72')])){return this[_0xddff('0xc')][_0xddff('0xaa')](_0xddff('0x17a'));}var _0x21eb06=this[_0xddff('0x62')][_0xddff('0x6f')](this,_0x570ce2);logger[_0xddff('0x2d')](util[_0xddff('0x28')](_0xddff('0x17b'),util[_0xddff('0x17c')](_0x21eb06,{'showHidden':![],'depth':null})));if(!this[_0xddff('0x86')](_0x570ce2[_0xddff('0xd6')])){return this['channel'][_0xddff('0xaa')]('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x141587=this[_0xddff('0x10')][_0xddff('0x6f')](this,_0x570ce2[_0xddff('0xd6')]);if(!_0x141587){return this[_0xddff('0xc')][_0xddff('0x2b')](_0x570ce2,'no\x20variable\x20found');}this[_0xddff('0xc')][_0xddff('0xa0')](util[_0xddff('0x28')](_0xddff('0x17d'),_0x141587),_0x21eb06[_0xddff('0x76')]?_0x21eb06[_0xddff('0x76')]:_0xddff('0x17e'));this[_0xddff('0xc')][_0xddff('0xa0')](util[_0xddff('0x28')](_0xddff('0x17f'),_0x141587),_0x21eb06[_0xddff('0x75')]?_0x21eb06[_0xddff('0x75')]:'OK');if(_0x21eb06[_0xddff('0x69')]){try{this['saveRestApiResult'](_0x21eb06[_0xddff('0x69')],_0x141587);}catch(_0x11c512){logger[_0xddff('0x2b')](util[_0xddff('0x28')](_0xddff('0x180'),_0x141587));}}return this[_0xddff('0xc')]['noop'](util[_0xddff('0x28')](_0xddff('0xdb'),_0x141587));};AGIVertices['prototype'][_0xddff('0x181')]=function(_0x504161){logger[_0xddff('0x2d')](util[_0xddff('0x28')](_0xddff('0x182'),_0x504161[_0xddff('0x37')]));return this[_0xddff('0xc')]['sayDigits'](_0x504161[_0xddff('0x183')][_0xddff('0xd4')](/\s+/g,''),_0x504161[_0xddff('0x177')]);};AGIVertices[_0xddff('0xf')][_0xddff('0x184')]=function(_0x5a043a){logger['info'](util[_0xddff('0x28')]('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x5a043a[_0xddff('0x37')]));return this[_0xddff('0xc')]['sayNumber'](_0x5a043a[_0xddff('0x65')][_0xddff('0xd4')](/\s+/g,''),_0x5a043a[_0xddff('0x177')]);};AGIVertices[_0xddff('0xf')][_0xddff('0x185')]=function(_0x4a8980){logger[_0xddff('0x2d')](util[_0xddff('0x28')]('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x4a8980[_0xddff('0x37')]));return this['channel'][_0xddff('0x186')](_0x4a8980[_0xddff('0x5b')],_0x4a8980[_0xddff('0x177')]);};AGIVertices['prototype'][_0xddff('0x187')]=function(_0x3baac0){logger['info'](util[_0xddff('0x28')](_0xddff('0x188'),_0x3baac0[_0xddff('0x37')]));if(!this['isConfigured'](_0x3baac0[_0xddff('0x189')])){return this[_0xddff('0xc')]['noop'](_0xddff('0x18a'));}var _0xeb4a62=this[_0xddff('0x18b')][_0xddff('0x6f')](this,_0x3baac0[_0xddff('0x189')]);if(!_0xeb4a62||!_0xeb4a62[_0xddff('0x18c')]){return this[_0xddff('0xc')][_0xddff('0x2b')](_0x3baac0,_0xddff('0x18d'));}var _0x37e7db={'from':util[_0xddff('0x28')](_0xddff('0x18e'),_0xeb4a62[_0xddff('0x13')],_0xeb4a62[_0xddff('0x18f')]||_0xeb4a62['Smtp']['user']),'to':_0x3baac0['to']||'','cc':_0x3baac0['cc']||'','bcc':_0x3baac0['bcc']||'','subject':_0x3baac0[_0xddff('0x190')],'html':_0x3baac0[_0xddff('0x5b')],'text':_0x3baac0[_0xddff('0x5b')]};var _0x6e5a={'tls':{'rejectUnauthorized':![]}};if(_0xeb4a62[_0xddff('0x18c')][_0xddff('0x191')]){_0x6e5a['service']=_0xeb4a62[_0xddff('0x18c')][_0xddff('0x191')];}else{_0x6e5a[_0xddff('0x192')]=_0xeb4a62[_0xddff('0x18c')]['host'];_0x6e5a['port']=_0xeb4a62[_0xddff('0x18c')][_0xddff('0x193')];_0x6e5a[_0xddff('0x194')]=_0xeb4a62['Smtp'][_0xddff('0x194')];}if(_0xeb4a62[_0xddff('0x18c')]['authentication']){_0x6e5a[_0xddff('0x195')]={'user':_0xeb4a62[_0xddff('0x18c')]['user'],'pass':_0xeb4a62[_0xddff('0x18c')]['pass']};}if(this[_0xddff('0x86')](_0x3baac0[_0xddff('0x196')])){}logger[_0xddff('0xdd')](_0xddff('0x197'),JSON['stringify'](_0x37e7db));this[_0xddff('0x36')][_0xddff('0x6f')](this,_0x3baac0,_0x3baac0[_0xddff('0x189')]);this['channel'][_0xddff('0xaa')](util[_0xddff('0x28')](_0xddff('0x198'),_0xeb4a62[_0xddff('0x13')]));this[_0xddff('0x22')][_0xddff('0x6f')](this,_0x6e5a,_0x37e7db);return this[_0xddff('0xc')][_0xddff('0xaa')](_0xddff('0x199'));};AGIVertices['prototype'][_0xddff('0x19a')]=function(_0x3e2d62){logger[_0xddff('0x2d')](util[_0xddff('0x28')](_0xddff('0x19b'),_0x3e2d62[_0xddff('0x37')]));return this[_0xddff('0xc')]['noop']('SENDFAX\x20block\x20not\x20implemented');};AGIVertices[_0xddff('0xf')]['sendSMS']=function(_0x526246){logger[_0xddff('0x2d')](util[_0xddff('0x28')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x526246[_0xddff('0x37')]));if(!this[_0xddff('0x86')](_0x526246[_0xddff('0x19c')])){return this['channel'][_0xddff('0xaa')](_0xddff('0x19d'));}var _0x1cc2e9=this[_0xddff('0x33')][_0xddff('0x6f')](this,_0x526246[_0xddff('0x19c')]);if(!_0x1cc2e9){return this[_0xddff('0xc')][_0xddff('0x2b')](_0x526246,_0xddff('0x19e'));}var _0x3cede4={'body':_0x526246['sms_text'],'phone':_0x526246['to']||'','SmsAccountId':_0x1cc2e9['id']};logger[_0xddff('0xdd')](_0xddff('0x19f'),JSON[_0xddff('0x73')](_0x3cede4));this[_0xddff('0x36')][_0xddff('0x6f')](this,_0x526246,_0x526246['sms_account_id']);this[_0xddff('0xc')][_0xddff('0xaa')](util[_0xddff('0x28')]('Trying\x20SendSMS\x20with\x20account\x20%s',_0x1cc2e9[_0xddff('0x13')]));this[_0xddff('0x35')]['sync'](this,_0x3cede4);return this['channel']['noop'](_0xddff('0x1a0'));};AGIVertices[_0xddff('0xf')][_0xddff('0x1a1')]=function(_0x228b6d){logger[_0xddff('0x2d')](util[_0xddff('0x28')](_0xddff('0x1a2'),_0x228b6d[_0xddff('0x37')]));if(!this[_0xddff('0x86')](_0x228b6d[_0xddff('0xd6')])){return this[_0xddff('0xc')]['error'](_0x228b6d,_0xddff('0x1a3'));}var _0x1a70b3=this[_0xddff('0x10')][_0xddff('0x6f')](this,_0x228b6d[_0xddff('0xd6')]);if(!_0x1a70b3){return this[_0xddff('0xc')][_0xddff('0x2b')](_0x228b6d,'no\x20variable\x20found');}return this['channel'][_0xddff('0xa0')](_0x1a70b3,_0x228b6d[_0xddff('0x1a4')]);};AGIVertices[_0xddff('0xf')][_0xddff('0x1a5')]=function(_0x44bd38){logger[_0xddff('0x2d')](util['format'](_0xddff('0x1a6'),_0x44bd38[_0xddff('0x37')]));this['channel'][_0xddff('0xaa')](_0xddff('0x1a7'));if(_0x44bd38[_0xddff('0xbb')]==='yes'){this[_0xddff('0xc')][_0xddff('0xaa')](_0xddff('0x1a8'));return this['channel'][_0xddff('0xbb')]();}return this['channel'][_0xddff('0xaa')]('Skipped\x20Answer');};AGIVertices[_0xddff('0xf')][_0xddff('0x1a9')]=function(_0x49a7f4){logger['info'](util['format'](_0xddff('0x1aa'),_0x49a7f4['label']));if(!this[_0xddff('0x86')](_0x49a7f4[_0xddff('0x1ab')])){return this[_0xddff('0xc')][_0xddff('0x2b')](_0x49a7f4,_0xddff('0x1ac'));}var _0x1c809a=this['getSquareProject']['sync'](this,_0x49a7f4[_0xddff('0x1ab')]);if(!this[_0xddff('0x86')](_0x1c809a)){return this['channel'][_0xddff('0x2b')](_0x49a7f4,util[_0xddff('0x28')]('no\x20subproject\x20found\x20with\x20id\x20%d',_0x49a7f4[_0xddff('0x1ab')]));}if(_0x1c809a===this['channel'][_0xddff('0x38')]){return this[_0xddff('0xc')][_0xddff('0x2b')](_0x49a7f4,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this['createSquareDetailsReport'][_0xddff('0x6f')](this,_0x49a7f4,_0x1c809a);var _0x1e82e6=this[_0xddff('0xc')]['exec'](_0xddff('0x1ad'),util[_0xddff('0x28')](_0xddff('0x1ae'),config[_0xddff('0x7')][_0xddff('0x192')]||_0xddff('0x1af'),_0x1c809a,this[_0xddff('0xc')][_0xddff('0x38')]));if(_0x1e82e6[_0xddff('0xa4')]===-0x1){return _0x1e82e6;}return this[_0xddff('0xc')][_0xddff('0xaa')](util[_0xddff('0x28')](_0xddff('0xc4'),_0xddff('0x1ad'),_0x1c809a));};AGIVertices[_0xddff('0xf')]['system']=function(_0x560c90){logger['info'](util[_0xddff('0x28')](_0xddff('0x1b0'),_0x560c90['label']));var _0x228c64=this['shellCommand'][_0xddff('0x6f')](this,_0x560c90[_0xddff('0xb9')]);this[_0xddff('0x36')][_0xddff('0x6f')](this,_0x560c90,_0x560c90['command']);if(this[_0xddff('0x86')](_0x560c90['variable_id'])){var _0x55e31c=this[_0xddff('0x10')][_0xddff('0x6f')](this,_0x560c90[_0xddff('0xd6')]);if(_0x55e31c){this[_0xddff('0xc')][_0xddff('0xa0')](_0x55e31c,_0x228c64);return this[_0xddff('0xc')][_0xddff('0xaa')](util['format'](_0xddff('0x1b1'),_0x560c90[_0xddff('0xb9')],_0x55e31c));}}return this[_0xddff('0xc')][_0xddff('0xaa')](util[_0xddff('0x28')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x560c90['command']));};AGIVertices['prototype'][_0xddff('0x1b2')]=function(_0x14cfa5){logger[_0xddff('0x2d')](util['format'](_0xddff('0x1b3'),_0x14cfa5[_0xddff('0x37')]));_0x14cfa5['text']=_0x14cfa5[_0xddff('0x5b')][_0xddff('0xd4')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xddff('0x86')](_0x14cfa5[_0xddff('0x1b4')])){return this['channel'][_0xddff('0xaa')](_0xddff('0x1b5'));}if(!this['isConfigured'](_0x14cfa5[_0xddff('0x5b')])){return this[_0xddff('0xc')]['noop'](_0xddff('0xab'));}this['channel'][_0xddff('0xaa')](util[_0xddff('0x28')](_0xddff('0x1b6'),_0x14cfa5['text']));var _0x19604d=this[_0xddff('0x59')]['sync'](this,_0x14cfa5);if(_0x19604d){this['channel']['noop'](util[_0xddff('0x28')]('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x19604d));var _0x3df67b=this[_0xddff('0xc')][_0xddff('0x14a')](_0x19604d);try{fs[_0xddff('0xfe')](_0x19604d+'.wav');}catch(_0x5d449b){logger[_0xddff('0x2b')](_0x5d449b);}return _0x3df67b;}return this[_0xddff('0xc')][_0xddff('0x2b')](_0x14cfa5,_0xddff('0x1b7'));};AGIVertices['prototype'][_0xddff('0x1b8')]=function(_0x4b1696){logger['info'](util[_0xddff('0x28')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x4b1696[_0xddff('0x37')]));_0x4b1696[_0xddff('0x5b')]=_0x4b1696['text']['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xddff('0x86')](_0x4b1696[_0xddff('0x5b')])){return this['channel']['noop'](_0xddff('0xab'));}this['channel']['noop'](util[_0xddff('0x28')](_0xddff('0x1b9'),_0x4b1696[_0xddff('0x5b')]));var _0x429e71=this[_0xddff('0x60')][_0xddff('0x6f')](this,_0x4b1696);if(_0x429e71){this[_0xddff('0xc')]['noop'](util[_0xddff('0x28')](_0xddff('0x1ba'),_0x429e71));var _0x5e247b=this[_0xddff('0xc')][_0xddff('0x14a')](_0x429e71);try{fs[_0xddff('0xfe')](_0x429e71+'.wav');}catch(_0x384bce){logger[_0xddff('0x2b')](_0x384bce);}return _0x5e247b;}return this['channel']['error'](_0x4b1696,'Google\x20TTS\x20is\x20unreachable');};AGIVertices['prototype'][_0xddff('0x1bb')]=function(_0x5badf6){logger[_0xddff('0x2d')](util[_0xddff('0x28')](_0xddff('0x1bc'),_0x5badf6[_0xddff('0x37')]));if(!this[_0xddff('0x86')](_0x5badf6[_0xddff('0x14f')])){return this[_0xddff('0xc')][_0xddff('0x2b')](_0x5badf6,_0xddff('0x150'));}logger[_0xddff('0x2d')](util[_0xddff('0x28')](_0xddff('0x151'),this[_0xddff('0xc')][_0xddff('0x39')],_0x5badf6['findBy']));var _0x5dced6=this[_0xddff('0x52')][_0xddff('0x6f')](this,_0x5badf6[_0xddff('0x14f')]);if(_0x5dced6){logger[_0xddff('0x2d')](util[_0xddff('0x28')](_0xddff('0x152'),this[_0xddff('0xc')][_0xddff('0x39')],_0x5badf6[_0xddff('0x14f')]));this[_0xddff('0xc')][_0xddff('0xaa')](util['format'](_0xddff('0x152'),this[_0xddff('0xc')][_0xddff('0x39')],_0x5badf6[_0xddff('0x14f')]));return{'code':0xc8,'result':_0xddff('0x153')};}else{logger['info'](util['format'](_0xddff('0x154'),this['channel'][_0xddff('0x39')],_0x5badf6[_0xddff('0x14f')]));this[_0xddff('0xc')][_0xddff('0xaa')](util[_0xddff('0x28')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0xddff('0x39')],_0x5badf6[_0xddff('0x14f')]));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype'][_0xddff('0x1bd')]=function(_0x5405ce){logger[_0xddff('0x2d')](util[_0xddff('0x28')](_0xddff('0x1be'),_0x5405ce[_0xddff('0x37')]));var _0x2369c2=this[_0xddff('0xc')][_0xddff('0x58')](_0xddff('0x1bf'),[_0x5405ce[_0xddff('0x1c0')],_0x5405ce[_0xddff('0x79')]]);if(_0x2369c2[_0xddff('0xa4')]===-0x1){return _0x2369c2;}return this['channel'][_0xddff('0xaa')](util[_0xddff('0x28')](_0xddff('0xc4'),_0xddff('0x1bf'),_0x5405ce[_0xddff('0x1c0')]));};AGIVertices[_0xddff('0xf')][_0xddff('0x1c1')]=function(_0x268bc4){logger[_0xddff('0x2d')](util['format']('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x268bc4['label']));if(!this[_0xddff('0x86')](_0x268bc4[_0xddff('0xd6')])){return this[_0xddff('0xc')]['error'](_0x268bc4,_0xddff('0x1a3'));}var _0xaa7e7=this[_0xddff('0x10')][_0xddff('0x6f')](this,_0x268bc4[_0xddff('0xd6')]);if(!_0xaa7e7){return this[_0xddff('0xc')]['error'](_0x268bc4,_0xddff('0xd8'));}var _0x4edc4e=this['channel']['getVariable'](_0xaa7e7);return{'code':0xc8,'result':_0x4edc4e['extra']?_0x4edc4e[_0xddff('0xa2')]:'-'};};String[_0xddff('0xf')][_0xddff('0x1c2')]=function(_0x3a3f9e,_0x5d9897){return this[_0xddff('0xa1')](_0x3a3f9e)[_0xddff('0x1c3')](_0x5d9897);};module[_0xddff('0x1c4')]=AGIVertices; \ No newline at end of file +var _0x005f=['IntervalId','interval','map','Intervals','format','getQueryOdbc','open','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Query\x20executed\x20correctly\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','channel','uniqueid','arg_1','callerid','createSquareRecording','context','extension','priority','accountcode','dnid','createSquareMessage','createCmContact','isEmpty','isNil','random','lastName','list_id','callback','Callback\x20scheduled\x20at\x20','callback_priority','getPause','getPauseById','agentPause','error','agent','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','exec','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','en-US','ssmlGender','MALE','MP3','googleTTS','google_tts_language','restAPI','timeout','includes','PUT','method','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','headers','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusMessage','statusCode','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','ispeechASR','ispeech_asr_language','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','awsLex','googleASR','google_asr_language','tildeASR','appid','clear','clone','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','hasOwnProperty','isArray','length','saveRestApiResult','%s.%s','setVariable','split','replaceAll','extra','getAndSetVariable','getVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','isConfigured','maxRetry','createSquareDetailsReport','retry','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','label','MRCPSynth','noop','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Enter\x20in\x20AGI\x20(%s)\x20block','command','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','scheduledAt','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','no\x20text\x20configured','lumenvoxasr','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','Executed\x20command\x20MRCPRecog\x20%s','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_TRANSCRIPT','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','getUser','SIP/%s','opts','url','DIAL','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','Trying\x20Dialogflow:\x20%s','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\x20anguage\x20configured','bot','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','SestekNDA\x20is\x20unreachable','end','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','phone','Executed\x20command\x20%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','response','maxdigit','toString','test','hiddendigitsnum','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','goalname','awspolly','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','aws_bot_name','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','message','Amazon\x20Lex\x20ready\x20for\x20fulfillment','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','generate','beep','recordFile','intKey','GoogleASR\x20Result\x20%s','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','appsecret','no\x20appsecret\x20configured','NOBEEP','TILDE_ASR_%s','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','true','EVAL\x20CONDITION\x20%s\x20%s','false','gotoiftime','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','%s/recordings/%s','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Trying\x20ispeech\x20TTS\x20%s','.wav','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','Enter\x20in\x20LOGOUT\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','getData','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','PLAYBACK','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','gosub','position','Executed\x20command\x20%s\x20%s','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','200','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','number','sayphonetic','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','bcc','subject','service','host','port','secure','authentication','auth','pass','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','yes','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','AGI','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','shellCommand','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','exports','path','util','lodash','odbc','randomstring','moment','mustache','request-promise','../../config/logger','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','getsecretdigits','rpc','mailRpc','prototype','getVariableById','catch','getVoiceQueue','getVoiceQueueById','name','getSquareProjectById','then','getSquareOdbcById','dsn','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById'];(function(_0x2a6754,_0x277259){var _0x17feda=function(_0x5745be){while(--_0x5745be){_0x2a6754['push'](_0x2a6754['shift']());}};_0x17feda(++_0x277259);}(_0x005f,0x19e));var _0xf005=function(_0x10a606,_0x3756a5){_0x10a606=_0x10a606-0x0;var _0x2b8ac6=_0x005f[_0x10a606];return _0x2b8ac6;};'use strict';var fs=require('fs');var path=require(_0xf005('0x0'));var util=require(_0xf005('0x1'));var _=require(_0xf005('0x2'));var sh=require('shelljs');var odbc=require(_0xf005('0x3'))();var rs=require(_0xf005('0x4'));var moment=require(_0xf005('0x5'));var Mustache=require(_0xf005('0x6'));var rp=require(_0xf005('0x7'));var logger=require(_0xf005('0x8'))(_0xf005('0x9'));var config=require(_0xf005('0xa'));var scripts=require(_0xf005('0xb'));var FILES_PATH=_0xf005('0xc');var recursiveMapAttributes=[_0xf005('0xd'),_0xf005('0xe')];var verticesWithRetry=[_0xf005('0xf'),_0xf005('0x10'),_0xf005('0x11')];var AGIVertices=function(_0x475d9c,_0x12021e,_0x5b0776){this['channel']=_0x475d9c;this[_0xf005('0x12')]=_0x12021e;this[_0xf005('0x13')]=_0x5b0776;};AGIVertices[_0xf005('0x14')]['getVariable']=function(_0x45a259,_0x52bceb){this[_0xf005('0x12')][_0xf005('0x15')](_0x45a259)['then'](function(_0x156869){_0x52bceb(null,_0x156869?_0x156869['name']:![]);})[_0xf005('0x16')](function(_0x674892){_0x52bceb(_0x674892);});};AGIVertices[_0xf005('0x14')][_0xf005('0x17')]=function(_0x43c7e0,_0x569c83){this['rpc'][_0xf005('0x18')](_0x43c7e0)['then'](function(_0xa8addd){_0x569c83(null,_0xa8addd?_0xa8addd[_0xf005('0x19')]:![]);})[_0xf005('0x16')](function(_0x50dbd2){_0x569c83(_0x50dbd2);});};AGIVertices[_0xf005('0x14')]['getSquareProject']=function(_0x9a9dc2,_0x4f906f){this[_0xf005('0x12')][_0xf005('0x1a')](_0x9a9dc2)[_0xf005('0x1b')](function(_0x1d333d){_0x4f906f(null,_0x1d333d?_0x1d333d[_0xf005('0x19')]:![]);})[_0xf005('0x16')](function(_0x2388b4){_0x4f906f(_0x2388b4);});};AGIVertices['prototype']['getSquareOdbc']=function(_0x415990,_0x4782d7){this[_0xf005('0x12')][_0xf005('0x1c')](_0x415990)['then'](function(_0x41ea92){_0x4782d7(null,_0x41ea92?_0x41ea92[_0xf005('0x1d')]:![]);})[_0xf005('0x16')](function(_0x2f941b){_0x4782d7(_0x2f941b);});};AGIVertices[_0xf005('0x14')]['getUser']=function(_0x1c9652,_0x398a25){this[_0xf005('0x12')][_0xf005('0x1e')](_0x1c9652)[_0xf005('0x1b')](function(_0x3add10){_0x398a25(null,_0x3add10?_0x3add10['name']:![]);})[_0xf005('0x16')](function(_0x5995f6){_0x398a25(_0x5995f6);});};AGIVertices[_0xf005('0x14')][_0xf005('0x1f')]=function(_0x449f9c,_0x3d2836){this[_0xf005('0x12')][_0xf005('0x20')](_0x449f9c)[_0xf005('0x1b')](function(_0x2a07ed){_0x3d2836(null,_0x2a07ed?_0x2a07ed[_0xf005('0x19')]:![]);})[_0xf005('0x16')](function(_0x2b4fae){_0x3d2836(_0x2b4fae);});};AGIVertices[_0xf005('0x14')][_0xf005('0x21')]=function(_0x36b33f,_0x565d08){var _0x2653ff=this;this[_0xf005('0x12')][_0xf005('0x22')](_0x36b33f)[_0xf005('0x1b')](function(_0x4b1f5d){_0x565d08(null,_0x4b1f5d?_0x2653ff[_0xf005('0x23')](_0x4b1f5d['save_name']):![]);})[_0xf005('0x16')](function(_0x2adb39){_0x565d08(_0x2adb39);});};AGIVertices[_0xf005('0x14')][_0xf005('0x24')]=function(_0x3912aa,_0x3e3b7a){this['rpc'][_0xf005('0x25')](_0x3912aa)[_0xf005('0x1b')](function(_0x27651c){_0x3e3b7a(null,_0x27651c?_0x27651c:![]);})[_0xf005('0x16')](function(_0x3d427c){_0x3e3b7a(_0x3d427c);});};AGIVertices['prototype']['sendMailMessage']=function(_0x38dc8f,_0x3d3a8c,_0x55d68c){this[_0xf005('0x13')][_0xf005('0x26')](_0x38dc8f,_0x3d3a8c)[_0xf005('0x1b')](function(){_0x55d68c(null);})[_0xf005('0x16')](function(_0x2821f7){_0x55d68c(_0x2821f7);});};AGIVertices[_0xf005('0x14')][_0xf005('0x27')]=function(_0x44590d,_0x301bb9){this['rpc'][_0xf005('0x28')](_0x44590d)['then'](function(_0x4bdfd1){if(_0x4bdfd1){if(_0x4bdfd1[_0xf005('0x29')]){_0x301bb9(null,[_0x4bdfd1[_0xf005('0x2a')]]);}else{_0x301bb9(null,_[_0xf005('0x2b')](_0x4bdfd1[_0xf005('0x2c')],_0xf005('0x2a')));}}else{_0x301bb9(null,![]);}})[_0xf005('0x16')](function(_0x357a76){_0x301bb9(_0x357a76);});};AGIVertices[_0xf005('0x14')]['getSoundPath']=function(_0x4320cb){return util[_0xf005('0x2d')]('%s/sounds/converted/%s',FILES_PATH,_0x4320cb);};AGIVertices[_0xf005('0x14')][_0xf005('0x2e')]=function(_0x1a6f0a,_0x3690a5,_0x2e88c3){odbc[_0xf005('0x2f')](_0x1a6f0a,function(_0x2d4c6d){if(_0x2d4c6d){logger['error'](_0xf005('0x30'),_0x2d4c6d);_0x2e88c3(_0x2d4c6d);}else{logger[_0xf005('0x31')](_0xf005('0x32'));odbc[_0xf005('0x33')](_0x3690a5,function(_0x444d9e,_0x201569){if(_0x444d9e){logger['info']('Error\x20executing\x20query\x20%s',_0x3690a5);_0x2e88c3(_0x444d9e);}else{logger[_0xf005('0x31')](_0xf005('0x34'),_0x3690a5);odbc['close'](function(_0x455c74){if(_0x455c74){logger['error']('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x455c74);}_0x2e88c3(null,_0x201569);});}});}});};AGIVertices[_0xf005('0x14')][_0xf005('0x35')]=function(_0xc4a11c,_0x1e7937){this[_0xf005('0x12')][_0xf005('0x36')](_0xc4a11c)[_0xf005('0x1b')](function(_0x34d470){_0x1e7937(null,_0x34d470?_0x34d470:![]);})[_0xf005('0x16')](function(_0x71e230){_0x1e7937(_0x71e230);});};AGIVertices[_0xf005('0x14')][_0xf005('0x37')]=function(_0x429457,_0x596cdc){this[_0xf005('0x12')][_0xf005('0x37')](_0x429457)[_0xf005('0x1b')](function(_0x1da304){_0x596cdc(null,_0x1da304);})[_0xf005('0x16')](function(_0xbeefe){_0x596cdc(_0xbeefe);});};AGIVertices[_0xf005('0x14')]['createSquareDetailsReport']=function(_0x4fd547,_0x36a597,_0x148f3e){this['rpc']['createSquareDetailsReport']({'uniqueid':this[_0xf005('0x38')][_0xf005('0x39')],'node':_0x4fd547['label'],'application':_0x4fd547['agicommand'],'data':_0x36a597||null,'project_name':this[_0xf005('0x38')][_0xf005('0x3a')],'callerid':this[_0xf005('0x38')][_0xf005('0x3b')]})['then'](function(_0x3dd927){if(_0x148f3e){_0x148f3e(null,_0x3dd927);}})[_0xf005('0x16')](function(_0x48d7c2){if(_0x148f3e){_0x148f3e(_0x48d7c2);}});};AGIVertices['prototype'][_0xf005('0x3c')]=function(_0x5a46ee,_0x452406,_0x1d484f,_0x3b1749){this[_0xf005('0x12')][_0xf005('0x3c')]({'uniqueid':this['channel']['uniqueid'],'callerid':this[_0xf005('0x38')][_0xf005('0x3b')],'calleridname':this[_0xf005('0x38')]['calleridname'],'context':this['channel'][_0xf005('0x3d')],'extension':this[_0xf005('0x38')][_0xf005('0x3e')],'priority':this[_0xf005('0x38')][_0xf005('0x3f')],'accountcode':this[_0xf005('0x38')][_0xf005('0x40')],'dnid':this[_0xf005('0x38')][_0xf005('0x41')],'projectName':this['channel']['arg_1'],'saveName':_0x452406,'filename':_0x5a46ee['file']||_0x452406,'savePath':_0x1d484f})['then'](function(_0x29d400){_0x3b1749(null,_0x29d400);})[_0xf005('0x16')](function(_0x55f2ce){_0x3b1749(_0x55f2ce);});};AGIVertices['prototype'][_0xf005('0x42')]=function(_0x5ea76c,_0x55ae24,_0x5346be,_0x53723f,_0x335971){this[_0xf005('0x12')][_0xf005('0x42')]({'uniqueid':this[_0xf005('0x38')][_0xf005('0x39')],'body':_0x5ea76c,'direction':_0x55ae24,'providerName':_0x5346be,'providerResponse':_0x53723f})[_0xf005('0x1b')](function(_0x18b5c2){if(_0x335971){_0x335971(null,_0x18b5c2);}})['catch'](function(_0x28d42e){if(_0x335971){_0x335971(_0x28d42e);}});};AGIVertices[_0xf005('0x14')][_0xf005('0x43')]=function(_0x7398db,_0xb469e9){this['rpc']['createCmContact']({'firstName':_[_0xf005('0x44')](_0x7398db[_0xf005('0x19')])||_[_0xf005('0x45')](_0x7398db[_0xf005('0x19')])?'callback_'+Math[_0xf005('0x46')]():_0x7398db['name'],'lastName':_[_0xf005('0x44')](_0x7398db['lastName'])||_[_0xf005('0x45')](_0x7398db['lastName'])?null:_0x7398db[_0xf005('0x47')],'phone':_0x7398db['phone'],'ListId':_0x7398db[_0xf005('0x48')],'scheduledat':_0x7398db['scheduledAt'],'callbackUniqueid':this['channel']['uniqueid'],'tags':_0xf005('0x49'),'description':_0xf005('0x4a')+_0x7398db['scheduledAt']['toString'](),'priority':_0x7398db[_0xf005('0x4b')]})[_0xf005('0x1b')](function(_0x16326d){_0xb469e9(null,_0x16326d);})[_0xf005('0x16')](function(_0x11ecde){_0xb469e9(_0x11ecde);});};AGIVertices[_0xf005('0x14')][_0xf005('0x4c')]=function(_0x21e242,_0x5e23cd){this[_0xf005('0x12')][_0xf005('0x4d')](_0x21e242)[_0xf005('0x1b')](function(_0x2ed991){_0x5e23cd(null,_0x2ed991?_0x2ed991[_0xf005('0x19')]:![]);})[_0xf005('0x16')](function(_0xe8d240){_0x5e23cd(_0xe8d240);});};AGIVertices[_0xf005('0x14')][_0xf005('0x4e')]=function(_0x5a7f06,_0x2f0dba,_0x2d30ea){var _0x1fcd46={'role':'agent'};_0x1fcd46[_0x5a7f06]=this[_0xf005('0x38')][_0xf005('0x3b')];this[_0xf005('0x12')][_0xf005('0x4e')](_0x1fcd46,_0x2f0dba,this[_0xf005('0x38')][_0xf005('0x39')])['then'](function(_0x2171f7){_0x2d30ea(null,_[_0xf005('0x45')](_0x2171f7)?![]:!![]);})['catch'](function(_0x2d09bc){logger[_0xf005('0x4f')](_0x2d09bc);_0x2d30ea(null,![]);});};AGIVertices[_0xf005('0x14')]['agentUnpause']=function(_0x25a339,_0x1e518e){var _0x18d0c4={'role':_0xf005('0x50')};_0x18d0c4[_0x25a339]=this[_0xf005('0x38')][_0xf005('0x3b')];this['rpc'][_0xf005('0x51')](_0x18d0c4)[_0xf005('0x1b')](function(_0x31e3fa){_0x1e518e(null,_['isNil'](_0x31e3fa)?![]:!![]);})[_0xf005('0x16')](function(_0x3b0532){logger[_0xf005('0x4f')](_0x3b0532);_0x1e518e(null,![]);});};AGIVertices['prototype'][_0xf005('0x52')]=function(_0x4cc35a,_0x5dc317){var _0x228c30={'role':_0xf005('0x50')};_0x228c30[_0x4cc35a]=this[_0xf005('0x38')][_0xf005('0x3b')];this[_0xf005('0x12')][_0xf005('0x52')](_0x228c30)[_0xf005('0x1b')](function(_0x2bcfb7){_0x5dc317(null,_[_0xf005('0x45')](_0x2bcfb7)?![]:!![]);})['catch'](function(_0xcfa982){logger[_0xf005('0x4f')](_0xcfa982);_0x5dc317(null,![]);});};AGIVertices[_0xf005('0x14')][_0xf005('0x53')]=function(_0xdfd476,_0x4b2cc4){var _0x1d5b67={'role':_0xf005('0x50')};_0x1d5b67[_0xdfd476]=this['channel'][_0xf005('0x3b')];var _0x534940=_0xdfd476!=_0xf005('0x54')?util[_0xf005('0x2d')](_0xf005('0x55'),_0xf005('0x56'),this['channel'][_0xf005('0x3b')]):undefined;this[_0xf005('0x12')][_0xf005('0x53')](_0x1d5b67,_0x534940)[_0xf005('0x1b')](function(_0x52d057){_0x4b2cc4(null,_[_0xf005('0x45')](_0x52d057)?![]:!![]);})['catch'](function(_0x5158ef){logger['error'](_0x5158ef);_0x4b2cc4(null,![]);});};AGIVertices[_0xf005('0x14')]['shellCommand']=function(_0x5d311a,_0x2f22a4){sh[_0xf005('0x57')](_['trim'](_0x5d311a),function(_0x462069,_0x34379e){var _0x33dd3f=_0x34379e[_0xf005('0x58')](/(\r\n|\n|\r)/gm,'');_0x2f22a4(null,_0x33dd3f);});};AGIVertices[_0xf005('0x14')][_0xf005('0x59')]=function(_0x36b6af,_0x260de1){scripts[_0xf005('0x59')](_0x36b6af[_0xf005('0x5a')],_0x36b6af[_0xf005('0x5b')]||_0xf005('0x5c'),_0x36b6af[_0xf005('0x5c')],_0x36b6af['languageCode']||_0xf005('0x5d'),_0x36b6af[_0xf005('0x5e')]||_0xf005('0x5f'),_0x36b6af['audioEncoding']||_0xf005('0x60'))[_0xf005('0x1b')](function(_0x111cc6){_0x260de1(null,_0x111cc6);})[_0xf005('0x16')](function(_0x2f1417){_0x260de1(_0x2f1417);});};AGIVertices[_0xf005('0x14')][_0xf005('0x61')]=function(_0x2b2245,_0x5c0c3a){scripts[_0xf005('0x61')](_0x2b2245[_0xf005('0x5c')],_0x2b2245[_0xf005('0x62')]||'en',0x1)[_0xf005('0x1b')](function(_0x2796b1){_0x5c0c3a(null,_0x2796b1);})[_0xf005('0x16')](function(_0x5b3b0e){_0x5c0c3a(_0x5b3b0e);});};AGIVertices['prototype'][_0xf005('0x63')]=function(_0x8bdc27,_0x5ae43e){var _0x4be05b={'uri':_0x8bdc27['url'],'method':_0x8bdc27['method'],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x8bdc27[_0xf005('0x64')])==='number'&&parseInt(_0x8bdc27['timeout'])>=0x1?parseInt(_0x8bdc27['timeout'])*0x3e8:0x5*0x3e8};if(_[_0xf005('0x65')](['POST',_0xf005('0x66')],_0x4be05b[_0xf005('0x67')][_0xf005('0x68')]())){try{_0x4be05b[_0xf005('0x69')]=_0x8bdc27['rawBody']?JSON['parse'](_0x8bdc27[_0xf005('0xe')]):{};}catch(_0x1289a2){logger[_0xf005('0x4f')]('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x1289a2);}}try{_0x4be05b['headers']=_0x8bdc27[_0xf005('0xd')]?JSON[_0xf005('0x6a')](_0x8bdc27['rawHeaders']):{};}catch(_0x119c46){logger['error'](_0xf005('0x6b'),_0x119c46);}if(_0x8bdc27[_0xf005('0x6c')]){try{var _0x5e391c=require(_0x8bdc27[_0xf005('0x6c')])[_0xf005('0x6d')](this,_0x4be05b);_0x4be05b['uri']=Mustache['render'](_0x8bdc27['url'],_0x5e391c,{},['$$','$$']);if(_0x4be05b[_0xf005('0x6e')]){_0x4be05b[_0xf005('0x6e')]=JSON[_0xf005('0x6a')](Mustache[_0xf005('0x6f')](JSON[_0xf005('0x70')](_0x4be05b['headers']),_0x5e391c,{},['$$','$$']));}if(_0x4be05b['body']){_0x4be05b['body']=JSON[_0xf005('0x6a')](Mustache['render'](JSON[_0xf005('0x70')](_0x4be05b[_0xf005('0x69')]),_0x5e391c,{},['$$','$$']));}}catch(_0x53ca5b){logger['error'](_0xf005('0x71'),_0x53ca5b);}}rp(_0x4be05b)[_0xf005('0x1b')](function(_0x22e910){var _0x21edb5={'statusCode':_0x22e910['statusCode']||0xc8,'statusMessage':_0x22e910[_0xf005('0x72')]||'OK','headers':_0x22e910[_0xf005('0x6e')]||{},'body':_0x22e910['body']||{}};_0x5ae43e(null,_0x21edb5);})['catch'](function(_0x444b87){var _0x10d968={'statusCode':_0x444b87[_0xf005('0x73')]||0x1f4,'statusMessage':_0x444b87['message']||_0xf005('0x74'),'headers':_0x444b87[_0xf005('0x75')][_0xf005('0x6e')]||{},'body':_0x444b87[_0xf005('0x75')][_0xf005('0x69')]||{}};_0x5ae43e(null,_0x10d968);});};AGIVertices[_0xf005('0x14')][_0xf005('0x76')]=function(_0x295c18,_0xe86788){scripts[_0xf005('0x76')](this[_0xf005('0x38')]['uniqueid'],_0x295c18[_0xf005('0x77')],_0x295c18[_0xf005('0x5c')],_0x295c18[_0xf005('0x78')]||'en')[_0xf005('0x1b')](function(_0xed0512){_0xe86788(null,_0xed0512);})[_0xf005('0x16')](function(_0x23ac50){_0xe86788(_0x23ac50);});};AGIVertices[_0xf005('0x14')][_0xf005('0x79')]=function(_0x1ec435,_0x52b8c7){scripts[_0xf005('0x79')](this[_0xf005('0x38')][_0xf005('0x39')],_0x1ec435[_0xf005('0x7a')],_0x1ec435['client_email'],_0x1ec435[_0xf005('0x7b')],_0x1ec435[_0xf005('0x5c')],_0x1ec435[_0xf005('0x7c')]||'en')[_0xf005('0x1b')](function(_0x4abcce){_0x52b8c7(null,_0x4abcce);})['catch'](function(_0x4529ca){_0x52b8c7(_0x4529ca);});};AGIVertices[_0xf005('0x14')][_0xf005('0x7d')]=function(_0x35453d,_0x4dd884){scripts['sestekNDA'](this[_0xf005('0x38')],_0x35453d)[_0xf005('0x1b')](function(_0x4fb714){_0x4dd884(null,_0x4fb714);})[_0xf005('0x16')](function(_0x16769f){_0x4dd884(_0x16769f);});};AGIVertices[_0xf005('0x14')][_0xf005('0x7e')]=function(_0x31064d,_0x4dea4c){scripts['ispeechTTS'](_0x31064d[_0xf005('0x77')],_0x31064d['text'],_0x31064d[_0xf005('0x7f')]||_0xf005('0x5d'),_0x31064d['speed'])[_0xf005('0x1b')](function(_0x26e6af){_0x4dea4c(null,_0x26e6af);})[_0xf005('0x16')](function(_0x41e482){_0x4dea4c(_0x41e482);});};AGIVertices['prototype']['ispeechASR']=function(_0x96e7ca,_0x466ec0,_0x4c9380){scripts[_0xf005('0x80')](_0x466ec0,_0x96e7ca['key'],_0x96e7ca[_0xf005('0x81')]||'en-US',this['isConfigured'](_0x96e7ca[_0xf005('0x82')])?_0x96e7ca['model']:undefined)[_0xf005('0x1b')](function(_0xdf4f91){_0x4c9380(null,_0xdf4f91);})['catch'](function(_0x4c5688){_0x4c9380(_0x4c5688);});};AGIVertices[_0xf005('0x14')][_0xf005('0x83')]=function(_0x59729c,_0x240871){scripts['awsPolly'](_0x59729c[_0xf005('0x84')],_0x59729c[_0xf005('0x85')],_0x59729c[_0xf005('0x86')],_0x59729c[_0xf005('0x87')]||_0xf005('0x88'),_0x59729c['text'],_0x59729c['aws_text_type']||'text')[_0xf005('0x1b')](function(_0x4631bf){_0x240871(null,_0x4631bf);})[_0xf005('0x16')](function(_0x2d072){_0x240871(_0x2d072);});};AGIVertices['prototype']['awsLex']=function(_0x5f3ec6,_0x1eab11){scripts[_0xf005('0x89')](this[_0xf005('0x38')]['uniqueid'],_0x5f3ec6['aws_access_key_id'],_0x5f3ec6[_0xf005('0x85')],_0x5f3ec6['aws_lex_region'],_0x5f3ec6['text'],_0x5f3ec6['aws_bot_name'])[_0xf005('0x1b')](function(_0x42c18d){_0x1eab11(null,_0x42c18d);})[_0xf005('0x16')](function(_0x22ee6d){_0x1eab11(_0x22ee6d);});};AGIVertices['prototype'][_0xf005('0x8a')]=function(_0x58a775,_0x336c2a,_0x56c5a5){scripts[_0xf005('0x8a')](_0x336c2a,_0x58a775[_0xf005('0x77')],_0x58a775[_0xf005('0x8b')]||_0xf005('0x5d'))[_0xf005('0x1b')](function(_0x45c154){_0x56c5a5(null,_0x45c154);})['catch'](function(_0x33ea9f){_0x56c5a5(_0x33ea9f);});};AGIVertices['prototype'][_0xf005('0x8c')]=function(_0x32274a,_0x2b261f,_0x1e4b26){scripts[_0xf005('0x8c')](_0x2b261f,_0x32274a[_0xf005('0x8d')],_0x32274a['appsecret'],_0x32274a['uri'])['then'](function(_0x196300){_0x1e4b26(null,_0x196300);})[_0xf005('0x16')](function(_0xfdf178){_0x1e4b26(_0xfdf178);});};AGIVertices['prototype'][_0xf005('0x8e')]=function(_0x15748f){var _0x3589fb=_['includes'](verticesWithRetry,_0x15748f['agicommand'])?_0x15748f:_[_0xf005('0x8f')](_0x15748f);for(var _0x4a9996 in _0x3589fb){if(_0x3589fb['hasOwnProperty'](_0x4a9996)){if(_0x3589fb[_0x4a9996]&&_[_0xf005('0x90')](_0x3589fb[_0x4a9996])){if(_[_0xf005('0x65')](recursiveMapAttributes,_0x4a9996)){_0x3589fb[_0x4a9996]=this[_0xf005('0x91')](_0x3589fb[_0x4a9996]);}else{_0x3589fb[_0x4a9996]=this[_0xf005('0x92')](_0x3589fb[_0x4a9996]);}}}}return _0x3589fb;};AGIVertices[_0xf005('0x14')][_0xf005('0x93')]=function(_0x1567d3){for(var _0x14815a in _0x1567d3){if(_0x1567d3[_0xf005('0x94')](_0x14815a)){if(_['isPlainObject'](_0x1567d3[_0x14815a])){this[_0xf005('0x93')](_0x1567d3[_0x14815a]);}else if(_[_0xf005('0x95')](_0x1567d3[_0x14815a])){for(var _0x5ecd50=0x0;_0x5ecd50<_0x1567d3[_0x14815a][_0xf005('0x96')];_0x5ecd50++){this[_0xf005('0x93')](_0x1567d3[_0x14815a][_0x5ecd50]);}}else if(_[_0xf005('0x90')](_0x1567d3[_0x14815a])){_0x1567d3[_0x14815a]=this[_0xf005('0x92')](_0x1567d3[_0x14815a]);}}}};AGIVertices[_0xf005('0x14')][_0xf005('0x97')]=function(_0x2d545c,_0x4de540){for(var _0x1563f8 in _0x2d545c){if(_0x2d545c[_0xf005('0x94')](_0x1563f8)){if(_['isPlainObject'](_0x2d545c[_0x1563f8])){if(!_[_0xf005('0x44')](_0x2d545c[_0x1563f8])){this['saveRestApiResult'](_0x2d545c[_0x1563f8],util[_0xf005('0x2d')](_0xf005('0x98'),_0x4de540,_0x1563f8));}}else if(_['isArray'](_0x2d545c[_0x1563f8])){for(var _0x3a1115=0x0;_0x3a1115<_0x2d545c[_0x1563f8][_0xf005('0x96')];_0x3a1115++){this['saveRestApiResult'](_0x2d545c[_0x1563f8][_0x3a1115],util[_0xf005('0x2d')]('%s.%s',_0x4de540,_0x1563f8+'['+_0x3a1115+']'));}}else{if(!_[_0xf005('0x45')](_0x2d545c[_0x1563f8])){this[_0xf005('0x38')][_0xf005('0x99')](util['format'](_0xf005('0x98'),_0x4de540,_0x1563f8),_0x2d545c[_0x1563f8]);}}}}};AGIVertices[_0xf005('0x14')][_0xf005('0x91')]=function(_0x1d6a1e){try{var _0x4a9ac9=JSON[_0xf005('0x6a')](_0x1d6a1e);this[_0xf005('0x93')](_0x4a9ac9);return JSON[_0xf005('0x70')](_0x4a9ac9);}catch(_0x49baa7){return this[_0xf005('0x92')](_0x1d6a1e);}};AGIVertices[_0xf005('0x14')][_0xf005('0x92')]=function(_0x281534){var _0x44761f=_0x281534['split']('{');for(var _0x311d38=0x1;_0x311d38<_0x44761f[_0xf005('0x96')];_0x311d38+=0x1){var _0x3666e3=_0x44761f[_0x311d38][_0xf005('0x9a')]('}');if(_0x3666e3['length']>0x1){_0x281534=_0x281534[_0xf005('0x9b')]('{'+_0x3666e3[0x0]+'}',this[_0xf005('0x38')]['getVariable'](_0x3666e3[0x0])[_0xf005('0x9c')]||_0x3666e3[0x0]);}}if(_0x44761f[_0xf005('0x96')]===0x1){return _0x281534['toString']();}return this['replaceAllVariables'](_0x281534);};AGIVertices['prototype'][_0xf005('0x9d')]=function(_0x29d0f8,_0x2c7d53){var _0x575978=this['channel'][_0xf005('0x9e')](_0x29d0f8);if(_0x575978[_0xf005('0x9f')]===-0x1){return _0x575978;}logger[_0xf005('0x31')](util[_0xf005('0x2d')](_0xf005('0xa0'),_0x2c7d53,_0x575978[_0xf005('0x9c')]));return this[_0xf005('0x38')][_0xf005('0x99')](_0x2c7d53,_0x575978[_0xf005('0x9c')]);};AGIVertices[_0xf005('0x14')][_0xf005('0xa1')]=function(_0x22a727){return _0x22a727&&_0x22a727!=='0'&&_0x22a727!=='-1'&&_0x22a727!=='';};AGIVertices['prototype'][_0xf005('0xa2')]=function(_0x3e9aab){this[_0xf005('0xa3')][_0xf005('0x6d')](this,_0x3e9aab,'-');_0x3e9aab[_0xf005('0xa4')]=_0x3e9aab[_0xf005('0xa2')];return{'code':0xc8,'result':'-'};};AGIVertices[_0xf005('0x14')]['mrcpsynth']=function(_0x254df1){logger[_0xf005('0x31')](util[_0xf005('0x2d')](_0xf005('0xa5'),_0x254df1[_0xf005('0xa6')]));if(!this[_0xf005('0xa1')](_0x254df1[_0xf005('0x5c')])){return this['channel']['noop']('no\x20text\x20configured');}var _0x1142c9='\x22'+_0x254df1[_0xf005('0x5c')]+'\x22';if(this[_0xf005('0xa1')](_0x254df1[_0xf005('0x75')])){_0x1142c9+=','+_0x254df1[_0xf005('0x75')];}var _0x1ed2a6=this[_0xf005('0x38')]['exec'](_0xf005('0xa7'),_0x1142c9);if(_0x1ed2a6[_0xf005('0x9f')]===-0x1){return _0x1ed2a6;}return this[_0xf005('0x38')][_0xf005('0xa8')](util[_0xf005('0x2d')](_0xf005('0xa9'),_0x1142c9));};AGIVertices[_0xf005('0x14')][_0xf005('0xaa')]=function(_0x753bd9){logger[_0xf005('0x31')](util['format']('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x753bd9[_0xf005('0xa6')]));if(!this[_0xf005('0xa1')](_0x753bd9[_0xf005('0xab')])){return this['channel'][_0xf005('0xa8')](_0xf005('0xac'));}var _0x1f8b92=_0x753bd9[_0xf005('0xab')];if(this[_0xf005('0xa1')](_0x753bd9[_0xf005('0x75')])){_0x1f8b92+=','+_0x753bd9['options'];}var _0x5d34a4=this[_0xf005('0x38')]['exec'](_0xf005('0xad'),_0x1f8b92);if(_0x5d34a4[_0xf005('0x9f')]===-0x1){return _0x5d34a4;}var _0x48f662=this[_0xf005('0x9d')](_0xf005('0xae'),_0xf005('0xaf'));if(_0x48f662[_0xf005('0x9f')]===-0x1){return _0x48f662;}var _0x54a769=this[_0xf005('0x9d')](_0xf005('0xb0'),_0xf005('0xb1'));if(_0x54a769[_0xf005('0x9f')]===-0x1){return _0x54a769;}var _0x3d7990=this[_0xf005('0x9d')](_0xf005('0xb2'),_0xf005('0xb3'));if(_0x3d7990['result']===-0x1){return _0x3d7990;}return this[_0xf005('0x38')][_0xf005('0xa8')](util[_0xf005('0x2d')]('Executed\x20command\x20MRCPRecog\x20%s',_0x1f8b92));};AGIVertices['prototype']['agi']=function(_0x4bc66e){logger[_0xf005('0x31')](util[_0xf005('0x2d')](_0xf005('0xb4'),_0x4bc66e[_0xf005('0xa6')]));return this[_0xf005('0x38')][_0xf005('0x9')]([_0x4bc66e[_0xf005('0xb5')],_0x4bc66e['args']]);};AGIVertices[_0xf005('0x14')][_0xf005('0xb6')]=function(_0x4573b3){logger['info'](util['format'](_0xf005('0xb7'),_0x4573b3[_0xf005('0xa6')]));if(this[_0xf005('0xa1')](_0x4573b3[_0xf005('0x64')])){logger[_0xf005('0x31')](util[_0xf005('0x2d')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x4573b3[_0xf005('0x64')]));var _0x1a7043=this[_0xf005('0x38')][_0xf005('0xb8')](_0x4573b3[_0xf005('0x64')]);if(_0x1a7043[_0xf005('0x9f')]===-0x1){return _0x1a7043;}}return this[_0xf005('0x38')]['answer']();};AGIVertices[_0xf005('0x14')]['callback']=function(_0x2f19fd){logger[_0xf005('0x31')](util[_0xf005('0x2d')](_0xf005('0xb9'),_0x2f19fd[_0xf005('0xa6')]));if(!this[_0xf005('0xa1')](_0x2f19fd['list_id'])){return this['channel'][_0xf005('0x4f')](_0x2f19fd,'no\x20list\x20selected');}_0x2f19fd[_0xf005('0xba')]=moment();if(this[_0xf005('0xa1')](_0x2f19fd['delay'])){_0x2f19fd[_0xf005('0xba')]=moment()['add'](_0x2f19fd['delay'],'minutes');}if(!this[_0xf005('0xa1')](_0x2f19fd['callback_priority'])){_0x2f19fd[_0xf005('0x4b')]=0x2;}this[_0xf005('0x43')][_0xf005('0x6d')](this,_0x2f19fd);return this[_0xf005('0x38')][_0xf005('0xa8')](util[_0xf005('0x2d')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x2f19fd['phone'],_0x2f19fd[_0xf005('0x48')],_0x2f19fd[_0xf005('0xba')]));};AGIVertices[_0xf005('0x14')][_0xf005('0xbb')]=function(_0x283a5a){logger[_0xf005('0x31')](util['format'](_0xf005('0xbc'),_0x283a5a[_0xf005('0xa6')]));var _0x575574=this[_0xf005('0x38')]['exec'](_0x283a5a[_0xf005('0xbd')],_0x283a5a[_0xf005('0x75')]);if(_0x575574[_0xf005('0x9f')]===-0x1){return _0x575574;}return this[_0xf005('0x38')][_0xf005('0xa8')](util['format']('Executed\x20command\x20%s\x20%s',_0x283a5a[_0xf005('0xbd')],_0x283a5a[_0xf005('0x75')]));};AGIVertices['prototype'][_0xf005('0xbe')]=function(_0x5fa02a){logger[_0xf005('0x31')](util[_0xf005('0x2d')](_0xf005('0xbf'),_0x5fa02a[_0xf005('0xa6')]));if(!this['isConfigured'](_0x5fa02a[_0xf005('0x5c')])){return this[_0xf005('0x38')]['noop']('no\x20text\x20configured');}var _0x57f1c7='\x22'+_0x5fa02a[_0xf005('0x5c')]+'\x22';if(this[_0xf005('0xa1')](_0x5fa02a['options'])){_0x57f1c7+=','+_0x5fa02a[_0xf005('0x75')];}var _0x1491c4=this[_0xf005('0x38')][_0xf005('0x57')](_0xf005('0xa7'),_0x57f1c7);if(_0x1491c4['result']===-0x1){return _0x1491c4;}return this[_0xf005('0x38')][_0xf005('0xa8')](util[_0xf005('0x2d')](_0xf005('0xa9'),_0x57f1c7));};AGIVertices['prototype']['sestektts']=function(_0x2a33eb){logger[_0xf005('0x31')](util[_0xf005('0x2d')](_0xf005('0xc0'),_0x2a33eb['label']));if(!this['isConfigured'](_0x2a33eb['text'])){return this[_0xf005('0x38')]['noop'](_0xf005('0xc1'));}var _0x2352d6='\x22'+_0x2a33eb[_0xf005('0x5c')]+'\x22';if(this[_0xf005('0xa1')](_0x2a33eb[_0xf005('0x75')])){_0x2352d6+=','+_0x2a33eb[_0xf005('0x75')];}var _0x159bf0=this['channel'][_0xf005('0x57')](_0xf005('0xa7'),_0x2352d6);if(_0x159bf0['result']===-0x1){return _0x159bf0;}return this[_0xf005('0x38')]['noop'](util[_0xf005('0x2d')]('Executed\x20command\x20MRCPSynth\x20%s',_0x2352d6));};AGIVertices[_0xf005('0x14')][_0xf005('0xc2')]=function(_0x2f6fb8){logger['info'](util['format']('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x2f6fb8[_0xf005('0xa6')]));if(!this[_0xf005('0xa1')](_0x2f6fb8[_0xf005('0xab')])){return this[_0xf005('0x38')][_0xf005('0xa8')](_0xf005('0xac'));}var _0x2c506c=_0x2f6fb8['grammar'];if(this['isConfigured'](_0x2f6fb8[_0xf005('0x75')])){_0x2c506c+=','+_0x2f6fb8[_0xf005('0x75')];}var _0x573f02=this[_0xf005('0x38')][_0xf005('0x57')](_0xf005('0xad'),_0x2c506c);if(_0x573f02[_0xf005('0x9f')]===-0x1){return _0x573f02;}var _0x27ce1e=this[_0xf005('0x9d')]('RECOG_CONFIDENCE()',_0xf005('0xc3'));if(_0x27ce1e['result']===-0x1){return _0x27ce1e;}var _0x530a63=this['getAndSetVariable'](_0xf005('0xb0'),_0xf005('0xc4'));if(_0x530a63['result']===-0x1){return _0x530a63;}var _0x198ee3=this[_0xf005('0x9d')]('RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE');if(_0x198ee3[_0xf005('0x9f')]===-0x1){return _0x198ee3;}return this['channel'][_0xf005('0xa8')](util['format'](_0xf005('0xc5'),_0x2c506c));};AGIVertices['prototype'][_0xf005('0xc6')]=function(_0x97339f){logger[_0xf005('0x31')](util[_0xf005('0x2d')](_0xf005('0xc7'),_0x97339f[_0xf005('0xa6')]));if(!this[_0xf005('0xa1')](_0x97339f['grammar'])){return this[_0xf005('0x38')]['noop'](_0xf005('0xac'));}var _0x165c34=_0x97339f['grammar'];if(this['isConfigured'](_0x97339f[_0xf005('0x75')])){_0x165c34+=','+_0x97339f[_0xf005('0x75')];}var _0x648dfb=this['channel'][_0xf005('0x57')](_0xf005('0xad'),_0x165c34);if(_0x648dfb[_0xf005('0x9f')]===-0x1){return _0x648dfb;}var _0x380f41=this[_0xf005('0x9d')](_0xf005('0xae'),'SESTEK_ASR_CONFIDENCE');if(_0x380f41['result']===-0x1){return _0x380f41;}var _0x21ece5=this[_0xf005('0x9d')](_0xf005('0xb0'),_0xf005('0xc8'));if(_0x21ece5[_0xf005('0x9f')]===-0x1){return _0x21ece5;}var _0xd11fc3=this[_0xf005('0x9d')](_0xf005('0xb2'),'SESTEK_ASR_INSTANCE');if(_0xd11fc3[_0xf005('0x9f')]===-0x1){return _0xd11fc3;}return this[_0xf005('0x38')][_0xf005('0xa8')](util[_0xf005('0x2d')](_0xf005('0xc5'),_0x165c34));};AGIVertices[_0xf005('0x14')][_0xf005('0xc9')]=function(_0xdbb6a6){logger[_0xf005('0x31')](util[_0xf005('0x2d')](_0xf005('0xca'),_0xdbb6a6[_0xf005('0xa6')]));if(!this[_0xf005('0xa1')](_0xdbb6a6[_0xf005('0xcb')])){return this[_0xf005('0x38')][_0xf005('0x4f')](_0xdbb6a6,_0xf005('0xcc'));}var _0x2c38a4=this['getSquareOdbc']['sync'](this,_0xdbb6a6['odbc_id']);if(!_0x2c38a4){return this[_0xf005('0x38')][_0xf005('0x4f')](_0xdbb6a6,_0xf005('0xcd'));}if(!this[_0xf005('0xa1')](_0xdbb6a6[_0xf005('0x33')])){return this[_0xf005('0x38')]['error'](_0xdbb6a6,'no\x20query\x20configured');}var _0x152dc3=_0xdbb6a6[_0xf005('0x33')][_0xf005('0x58')](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0xf005('0xa8')](util[_0xf005('0x2d')]('query:\x20%s',_0x152dc3));var _0xfc9f85=this[_0xf005('0x2e')][_0xf005('0x6d')](this,_0x2c38a4,_0x152dc3);this[_0xf005('0xa3')][_0xf005('0x6d')](this,_0xdbb6a6,_0x152dc3);if(!this[_0xf005('0xa1')](_0xdbb6a6[_0xf005('0xce')])){return this[_0xf005('0x38')][_0xf005('0xa8')](_0xf005('0xcf'));}var _0xd5041d=this['getVariable'][_0xf005('0x6d')](this,_0xdbb6a6['variable_id']);if(!_0xd5041d){return this[_0xf005('0x38')][_0xf005('0x4f')](_0xdbb6a6,_0xf005('0xd0'));}var _0xd89908=this;_0xfc9f85[_0xf005('0xd1')](function(_0x3614af,_0x1e55b4){Object[_0xf005('0xd2')](_0x3614af)['forEach'](function(_0x3b3032){_0xd89908[_0xf005('0x38')][_0xf005('0x99')](util[_0xf005('0x2d')](_0xf005('0xd3'),_0xd5041d,_0x1e55b4,_0x3b3032),_0x3614af[_0x3b3032]);});});this['channel'][_0xf005('0x99')](util[_0xf005('0x2d')](_0xf005('0xd4'),_0xd5041d),_0xfc9f85[_0xf005('0x96')]);return this['channel'][_0xf005('0xa8')](util[_0xf005('0x2d')](_0xf005('0xd5'),_0xd5041d));};AGIVertices[_0xf005('0x14')][_0xf005('0xd6')]=function(_0x8416ab){logger[_0xf005('0xd7')](util[_0xf005('0x2d')](_0xf005('0xd8'),_0x8416ab[_0xf005('0xa6')]));if(!this[_0xf005('0xa1')](_0x8416ab[_0xf005('0xd9')])){return this[_0xf005('0x38')][_0xf005('0x4f')](_0x8416ab,_0xf005('0xda'));}var _0x3acc53=this[_0xf005('0xdb')][_0xf005('0x6d')](this,_0x8416ab['sip_id']);if(!_0x3acc53){return this[_0xf005('0x38')][_0xf005('0x4f')](_0x8416ab,'no\x20user\x20found');}var _0xd93b88=this['channel']['exec']('DIAL',[util[_0xf005('0x2d')](_0xf005('0xdc'),_0x3acc53),_0x8416ab[_0xf005('0x64')],_0x8416ab[_0xf005('0xdd')],_0x8416ab[_0xf005('0xde')]]);if(_0xd93b88[_0xf005('0x9f')]===-0x1){return _0xd93b88;}return this[_0xf005('0x38')][_0xf005('0xa8')](util['format']('Executed\x20command\x20%s',_0xf005('0xdf')));};AGIVertices[_0xf005('0x14')][_0xf005('0xe0')]=function(_0x4b145a){logger[_0xf005('0x31')](util[_0xf005('0x2d')](_0xf005('0xe1'),_0x4b145a[_0xf005('0xa6')]));if(!this[_0xf005('0xa1')](_0x4b145a[_0xf005('0x77')])){return this[_0xf005('0x38')]['noop'](_0xf005('0xe2'));}if(!this[_0xf005('0xa1')](_0x4b145a[_0xf005('0x5c')])){return this['channel'][_0xf005('0xa8')](_0xf005('0xc1'));}this[_0xf005('0x38')]['bot']=!![];this[_0xf005('0xa3')](_0x4b145a);this[_0xf005('0x42')](_0x4b145a[_0xf005('0x5c')],'in','','');this[_0xf005('0x38')][_0xf005('0xa8')](util[_0xf005('0x2d')](_0xf005('0xe3'),_0x4b145a[_0xf005('0x5c')]));var _0x12162d=this[_0xf005('0x76')][_0xf005('0x6d')](this,_0x4b145a);if(_0x12162d){for(var _0xdaa84f in _0x12162d){if(_0x12162d[_0xf005('0x94')](_0xdaa84f)){this[_0xf005('0x38')]['setVariable'](util[_0xf005('0x2d')]('DIALOGFLOW_%s',_0xdaa84f[_0xf005('0x68')]()),_0x12162d[_0xdaa84f]);}}this[_0xf005('0x42')](_0x12162d[_0xf005('0xe4')],_0xf005('0xe5'),_0xf005('0xe0'),'');return this['channel'][_0xf005('0xa8')](util[_0xf005('0x2d')](_0xf005('0xe6'),_0x12162d[_0xf005('0xe4')]));}return this['channel'][_0xf005('0x4f')](_0x4b145a,_0xf005('0xe7'));};AGIVertices[_0xf005('0x14')][_0xf005('0xe8')]=function(_0x3f0b48){logger[_0xf005('0x31')](util[_0xf005('0x2d')](_0xf005('0xe9'),_0x3f0b48['label']));if(!this[_0xf005('0xa1')](_0x3f0b48['dialogflowV2_project_id'])){return this[_0xf005('0x38')][_0xf005('0xa8')](_0xf005('0xea'));}if(!this[_0xf005('0xa1')](_0x3f0b48[_0xf005('0xeb')])){return this[_0xf005('0x38')][_0xf005('0xa8')](_0xf005('0xec'));}if(!this[_0xf005('0xa1')](_0x3f0b48['private_key'])){return this[_0xf005('0x38')]['noop']('no\x20private_key\x20configured');}if(!this['isConfigured'](_0x3f0b48['dialogflowV2_language'])){return this['channel']['noop'](_0xf005('0xed'));}if(!this['isConfigured'](_0x3f0b48[_0xf005('0x5c')])){return this[_0xf005('0x38')][_0xf005('0xa8')](_0xf005('0xc1'));}this['channel'][_0xf005('0xee')]=!![];this[_0xf005('0xa3')](_0x3f0b48);this[_0xf005('0x42')](_0x3f0b48[_0xf005('0x5c')],'in','','');this[_0xf005('0x38')][_0xf005('0xa8')](util[_0xf005('0x2d')](_0xf005('0xef'),_0x3f0b48[_0xf005('0x5c')]));var _0x5129fe=this[_0xf005('0x79')]['sync'](this,_0x3f0b48);if(_0x5129fe){for(var _0x4a8f5f in _0x5129fe){if(_0x5129fe[_0xf005('0x94')](_0x4a8f5f)){if(_0x4a8f5f!==_0xf005('0xf0')){this[_0xf005('0x38')][_0xf005('0x99')](util[_0xf005('0x2d')]('DIALOGFLOW_%s',_0x4a8f5f[_0xf005('0x68')]()),_0x5129fe[_0x4a8f5f]);}}}this['createSquareMessage'](_0x5129fe[_0xf005('0xe4')],_0xf005('0xe5'),'dialogflowV2',_0x5129fe[_0xf005('0xf0')]);return this[_0xf005('0x38')][_0xf005('0xa8')](util[_0xf005('0x2d')]('DialogflowV2\x20Result\x20%s',_0x5129fe[_0xf005('0xe4')]));}return this[_0xf005('0x38')][_0xf005('0x4f')](_0x3f0b48,_0xf005('0xf1'));};AGIVertices[_0xf005('0x14')][_0xf005('0xf2')]=function(_0x3e819f){logger['info'](util['format'](_0xf005('0xf3'),_0x3e819f[_0xf005('0xa6')]));if(!this['isConfigured'](_0x3e819f[_0xf005('0xf4')])){return this[_0xf005('0x38')][_0xf005('0xa8')](_0xf005('0xf5'));}if(!this['isConfigured'](_0x3e819f[_0xf005('0xf6')])){return this[_0xf005('0x38')]['noop'](_0xf005('0xf7'));}if(!this[_0xf005('0xa1')](_0x3e819f[_0xf005('0xf8')])){return this[_0xf005('0x38')][_0xf005('0xa8')](_0xf005('0xf9'));}if(!this[_0xf005('0xa1')](_0x3e819f[_0xf005('0xfa')])){return this['channel']['noop'](_0xf005('0xc1'));}this['channel']['bot']=!![];this['createSquareDetailsReport'](_0x3e819f);this[_0xf005('0x42')](_0x3e819f[_0xf005('0x5c')],'in','','');this['channel'][_0xf005('0xa8')](util[_0xf005('0x2d')](_0xf005('0xfb'),_0x3e819f[_0xf005('0x5c')]));var _0x41855a=this[_0xf005('0x7d')][_0xf005('0x6d')](this,_0x3e819f);if(_0x41855a){for(var _0x3e1925 in _0x41855a){if(_0x41855a['hasOwnProperty'](_0x3e1925)){this['channel'][_0xf005('0x99')](util[_0xf005('0x2d')]('SESTEK_NDA_%s',_0x3e1925['toUpperCase']()),_0x41855a[_0x3e1925]);}}this[_0xf005('0x42')](_0x41855a['speech'],'out','sesteknda','');if(_0x41855a[_0xf005('0xfc')]){this['channel'][_0xf005('0xa8')](util[_0xf005('0x2d')](_0xf005('0xfd'),_0x41855a[_0xf005('0xfc')]));var _0x88840e=this[_0xf005('0x38')][_0xf005('0xfe')](_0x41855a['audiofile']);try{fs[_0xf005('0xff')](_0x41855a['audiofile']+'.wav');}catch(_0xcfd2a5){logger[_0xf005('0x4f')](_0xcfd2a5);}return _0x88840e;}else{return this[_0xf005('0x38')]['noop'](util[_0xf005('0x2d')]('SestekNDA\x20Result\x20%s',_0x41855a[_0xf005('0xe4')]));}}return this[_0xf005('0x38')][_0xf005('0x4f')](_0x3e819f,_0xf005('0x100'));};AGIVertices[_0xf005('0x14')][_0xf005('0x101')]=function(_0x57c630){logger[_0xf005('0x31')](util['format']('Enter\x20in\x20END\x20(%s)\x20block',_0x57c630[_0xf005('0xa6')]));return this[_0xf005('0x38')][_0xf005('0xa8')](_0xf005('0x101'));};AGIVertices[_0xf005('0x14')][_0xf005('0x102')]=function(_0x1eddac){logger['info'](util['format'](_0xf005('0x103'),_0x1eddac[_0xf005('0xa6')]));var _0x56532e='';if(_0x1eddac[_0xf005('0x104')]){if(!this['isConfigured'](_0x1eddac['trunk_id'])){return this[_0xf005('0x38')][_0xf005('0x4f')](_0x1eddac,_0xf005('0x105'));}else{var _0x3bf797=parseInt(_0x1eddac['trunk_id'],0xa);if(isNaN(_0x3bf797)){_0x56532e=_0x1eddac['trunk_id'];}else{_0x56532e=this[_0xf005('0x1f')][_0xf005('0x6d')](this,_0x1eddac['trunk_id']);if(!_0x56532e){return this[_0xf005('0x38')]['error'](_0x1eddac,_0xf005('0x106'));}}}}else if(_0x1eddac[_0xf005('0x107')]){_0x56532e=_0x1eddac[_0xf005('0x107')];}else{return this[_0xf005('0x38')][_0xf005('0x4f')](_0x1eddac,'no\x20trunk\x20selected');}var _0x8a4a5f=this[_0xf005('0x38')]['exec'](_0xf005('0xdf'),[util['format']('SIP/%s/%s',_0x56532e,_0x1eddac[_0xf005('0x108')]),_0x1eddac['timeout'],_0x1eddac[_0xf005('0xdd')],_0x1eddac['url']]);if(_0x8a4a5f[_0xf005('0x9f')]===-0x1){return _0x8a4a5f;}return this[_0xf005('0x38')][_0xf005('0xa8')](util[_0xf005('0x2d')](_0xf005('0x109'),_0xf005('0xdf')));};AGIVertices[_0xf005('0x14')][_0xf005('0x10a')]=function(_0xec9d83){logger[_0xf005('0x31')](util[_0xf005('0x2d')](_0xf005('0x10b'),_0xec9d83[_0xf005('0xa6')]));return this[_0xf005('0x38')][_0xf005('0xa8')](_0xf005('0x10a'));};AGIVertices['prototype']['getdigits']=function(_0xdf8f2){logger['info'](util['format'](_0xf005('0x10c'),_0xdf8f2[_0xf005('0xa6')]));if(_0xdf8f2[_0xf005('0xa4')]===0x0){return this[_0xf005('0xa2')](_0xdf8f2);}_0xdf8f2[_0xf005('0xa4')]-=0x1;if(!this['isConfigured'](_0xdf8f2[_0xf005('0x10d')])){return this[_0xf005('0x38')][_0xf005('0x4f')](_0xdf8f2,'no\x20file\x20audio\x20selected');}var _0x186352=this['getSound'][_0xf005('0x6d')](this,_0xdf8f2[_0xf005('0x10d')]);if(!_0x186352){return this[_0xf005('0x38')][_0xf005('0x4f')](_0xdf8f2,'no\x20file\x20audio\x20found');}if(!this[_0xf005('0xa1')](_0xdf8f2[_0xf005('0xce')])){return this[_0xf005('0x38')]['error']('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x5cd655=this[_0xf005('0x38')]['getData'](_0x186352,_0xdf8f2[_0xf005('0x10e')],_0xdf8f2[_0xf005('0x10f')]);var _0x1aa28e=_0x5cd655[_0xf005('0x9f')]?_0x5cd655[_0xf005('0x9f')][_0xf005('0x110')]():'';logger[_0xf005('0x31')](_0xf005('0x111'),JSON[_0xf005('0x70')](_0x5cd655));if(_0x5cd655[_0xf005('0x9f')]===-0x1){this[_0xf005('0xa3')][_0xf005('0x6d')](this,_0xdf8f2,_0x1aa28e);return _0x5cd655;}else if(_0x5cd655[_0xf005('0x9c')]===_0xf005('0x64')){_0x5cd655[_0xf005('0x9f')]=_0x1aa28e[_0xf005('0x96')]>=parseInt(_0xdf8f2['mindigit'])?'x':'i';}else{_0x5cd655[_0xf005('0x9f')]=_0x1aa28e['length']>=parseInt(_0xdf8f2['mindigit'])&&_0x1aa28e[_0xf005('0x96')]<=parseInt(_0xdf8f2[_0xf005('0x10f')])?'x':'i';}var _0x34cb59=this[_0xf005('0x9e')][_0xf005('0x6d')](this,_0xdf8f2[_0xf005('0xce')]);if(!_0x34cb59){return this['channel']['error'](_0xdf8f2,_0xf005('0xd0'));}this[_0xf005('0x38')][_0xf005('0x99')](_0x34cb59,_0x1aa28e);if(this['isConfigured'](_0xdf8f2[_0xf005('0x112')])){var _0x1ed545=parseInt(_0xdf8f2[_0xf005('0x112')],0xa);var _0x73201f=rs['generate']({'charset':'*','length':_0x1ed545});var _0x3120aa=_0x1aa28e[_0xf005('0x96')];if(_0x3120aa>0x0){if(_0x3120aa>_0x1ed545){this[_0xf005('0xa3')][_0xf005('0x6d')](this,_0xdf8f2,_0xdf8f2[_0xf005('0x113')]===_0xf005('0x114')?_0x73201f+_0x1aa28e[_0xf005('0x115')](_0x1ed545):_0x1aa28e['substr'](0x0,_0x3120aa-_0x1ed545)+_0x73201f);}else{this[_0xf005('0xa3')][_0xf005('0x6d')](this,_0xdf8f2,rs['generate']({'charset':'*','length':_0x3120aa}));}}else{this[_0xf005('0xa3')][_0xf005('0x6d')](this,_0xdf8f2,'');}}else{this[_0xf005('0xa3')][_0xf005('0x6d')](this,_0xdf8f2,_0x1aa28e);}return _0x5cd655;};AGIVertices[_0xf005('0x14')][_0xf005('0x11')]=function(_0x54836f){logger[_0xf005('0x31')](util[_0xf005('0x2d')](_0xf005('0x116'),_0x54836f[_0xf005('0xa6')]));return this[_0xf005('0x10')](_0x54836f);};AGIVertices[_0xf005('0x14')][_0xf005('0x117')]=function(_0xaa177b){logger[_0xf005('0x31')](util[_0xf005('0x2d')]('Enter\x20in\x20GOAL\x20(%s)\x20block',_0xaa177b[_0xf005('0xa6')]));this[_0xf005('0xa3')]['sync'](this,_0xaa177b,_0xaa177b[_0xf005('0x118')]);return this['channel'][_0xf005('0xa8')](util['format']('GOAL\x20%s',_0xaa177b[_0xf005('0x118')]));};AGIVertices[_0xf005('0x14')][_0xf005('0x119')]=function(_0x575ea1){logger[_0xf005('0x31')](util[_0xf005('0x2d')]('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x575ea1['label']));if(!this[_0xf005('0xa1')](_0x575ea1[_0xf005('0x84')])||!this[_0xf005('0xa1')](_0x575ea1[_0xf005('0x85')])){return this['channel'][_0xf005('0xa8')](_0xf005('0x11a'));}if(!this[_0xf005('0xa1')](_0x575ea1[_0xf005('0x5c')])){return this[_0xf005('0x38')][_0xf005('0xa8')](_0xf005('0xc1'));}this[_0xf005('0x38')][_0xf005('0xa8')](util['format'](_0xf005('0x11b'),_0x575ea1[_0xf005('0x5c')]));var _0xc3178d=this[_0xf005('0x83')][_0xf005('0x6d')](this,_0x575ea1);if(_0xc3178d){this['channel'][_0xf005('0xa8')](util['format'](_0xf005('0x11c'),_0xc3178d));var _0x3a78fe=this[_0xf005('0x38')][_0xf005('0xfe')](_0xc3178d);try{fs[_0xf005('0xff')](_0xc3178d+'.wav');}catch(_0x429097){logger[_0xf005('0x4f')](_0x429097);}return _0x3a78fe;}return this[_0xf005('0x38')][_0xf005('0x4f')](_0x575ea1,'aws\x20Polly\x20is\x20unreachable');};AGIVertices['prototype'][_0xf005('0x11d')]=function(_0x5580ea){logger[_0xf005('0x31')](util['format'](_0xf005('0x11e'),_0x5580ea['label']));if(!this['isConfigured'](_0x5580ea[_0xf005('0x84')])||!this[_0xf005('0xa1')](_0x5580ea[_0xf005('0x85')])){return this[_0xf005('0x38')][_0xf005('0xa8')]('no\x20valid\x20credentials\x20configured');}if(!this['isConfigured'](_0x5580ea[_0xf005('0x11f')])){return this[_0xf005('0x38')][_0xf005('0xa8')](_0xf005('0x120'));}if(!this[_0xf005('0xa1')](_0x5580ea[_0xf005('0x5c')])){return this['channel'][_0xf005('0xa8')](_0xf005('0xc1'));}this[_0xf005('0x38')][_0xf005('0xee')]=!![];this[_0xf005('0xa3')](_0x5580ea);this[_0xf005('0x42')](_0x5580ea[_0xf005('0x5c')],'in','','');this[_0xf005('0x38')][_0xf005('0xa8')](util[_0xf005('0x2d')](_0xf005('0x121'),_0x5580ea[_0xf005('0x5c')]));var _0x26d812=this[_0xf005('0x89')][_0xf005('0x6d')](this,_0x5580ea);if(_0x26d812){for(var _0x35a43e in _0x26d812){if(_0x26d812[_0xf005('0x94')](_0x35a43e)&&_[_0xf005('0x90')](_0x26d812[_0x35a43e])){this['channel']['setVariable'](util[_0xf005('0x2d')]('AWS_LEX_%s',_0x35a43e['toUpperCase']()),_0x26d812[_0x35a43e]);}}if(_[_0xf005('0x45')](_0x26d812[_0xf005('0x122')])){return this['channel']['noop'](_0xf005('0x123'));}else{this[_0xf005('0x42')](_0x26d812['message'],_0xf005('0xe5'),'amazonlex','');return this[_0xf005('0x38')][_0xf005('0xa8')](util[_0xf005('0x2d')]('Amazon\x20Lex\x20Result\x20%s',_0x26d812[_0xf005('0x122')]));}}return this[_0xf005('0x38')]['error'](_0x5580ea,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices[_0xf005('0x14')][_0xf005('0x124')]=function(_0x35ade3){logger[_0xf005('0x31')](util['format'](_0xf005('0x125'),_0x35ade3[_0xf005('0xa6')],_0x35ade3['timeout']));if(!this[_0xf005('0xa1')](_0x35ade3[_0xf005('0x77')])){return this[_0xf005('0x38')][_0xf005('0xa8')](_0xf005('0xe2'));}var _0x52467f=_0xf005('0x126');var _0x3b1640=util['format']('%s/recordings/%s',FILES_PATH,rs[_0xf005('0x127')](0x4));var _0x3a40ef=util['format'](_0xf005('0x98'),_0x3b1640,_0x52467f);var _0x4f0cd3=!![];if(_0x35ade3[_0xf005('0x128')]==='NOBEEP'){_0x4f0cd3=![];}var _0x3ddadf=this[_0xf005('0x38')][_0xf005('0x129')](_0x3b1640,_0x52467f,_0x35ade3[_0xf005('0x12a')],_0x35ade3[_0xf005('0x64')],undefined,_0x4f0cd3);if(_0x3ddadf[_0xf005('0x9f')]!==-0x1){this['channel'][_0xf005('0xa8')](util['format']('google\x20%s\x20file\x20created',_0x3a40ef));var _0x182df7=this[_0xf005('0x8a')][_0xf005('0x6d')](this,_0x35ade3,_0x3a40ef);if(_0x182df7){for(var _0x3fb47e in _0x182df7){if(_0x182df7[_0xf005('0x94')](_0x3fb47e)){this[_0xf005('0x38')][_0xf005('0x99')](util['format']('GOOGLE_ASR_%s',_0x3fb47e[_0xf005('0x68')]()),_0x182df7[_0x3fb47e]);}}return this[_0xf005('0x38')][_0xf005('0xa8')](util[_0xf005('0x2d')](_0xf005('0x12b'),JSON['stringify'](_0x182df7)));}}return _0x3ddadf;};AGIVertices[_0xf005('0x14')]['tildeasr']=function(_0x55fee6){logger[_0xf005('0x31')](util['format'](_0xf005('0x12c'),_0x55fee6[_0xf005('0xa6')]));if(!this[_0xf005('0xa1')](_0x55fee6[_0xf005('0x8d')])){return this['channel']['noop'](_0xf005('0x12d'));}if(!this['isConfigured'](_0x55fee6[_0xf005('0x12e')])){return this[_0xf005('0x38')][_0xf005('0xa8')](_0xf005('0x12f'));}var _0x2a6b3d='wav';var _0x4aaa24=util[_0xf005('0x2d')]('%s/recordings/%s',FILES_PATH,rs['generate'](0x4));var _0x49f6c5=util[_0xf005('0x2d')](_0xf005('0x98'),_0x4aaa24,_0x2a6b3d);var _0x52e9fc=!![];if(_0x55fee6[_0xf005('0x128')]===_0xf005('0x130')){_0x52e9fc=![];}var _0x4c5f3e=this[_0xf005('0x38')][_0xf005('0x129')](_0x4aaa24,_0x2a6b3d,_0x55fee6[_0xf005('0x12a')],_0x55fee6['timeout'],undefined,_0x52e9fc);if(_0x4c5f3e['result']!==-0x1){this[_0xf005('0x38')]['noop'](util[_0xf005('0x2d')]('tilde\x20%s\x20file\x20created',_0x49f6c5));var _0xe21e91=this[_0xf005('0x8c')]['sync'](this,_0x55fee6,_0x49f6c5);if(_0xe21e91){for(var _0x134dad in _0xe21e91){if(_0xe21e91[_0xf005('0x94')](_0x134dad)){this[_0xf005('0x38')][_0xf005('0x99')](util['format'](_0xf005('0x131'),_0x134dad['toUpperCase']()),_0xe21e91[_0x134dad]);}}return this['channel'][_0xf005('0xa8')](util[_0xf005('0x2d')]('TildeASR\x20Result\x20%s',JSON['stringify'](_0xe21e91)));}}return _0x4c5f3e;};AGIVertices[_0xf005('0x14')]['gotoc']=function(_0x1423ac){logger[_0xf005('0x31')](util[_0xf005('0x2d')](_0xf005('0x132'),_0x1423ac[_0xf005('0xa6')]));return this[_0xf005('0x38')][_0xf005('0x133')](_0x1423ac[_0xf005('0x3d')],_0x1423ac['extension'],_0x1423ac['priority']);};AGIVertices[_0xf005('0x14')][_0xf005('0x134')]=function(_0x5c5738){logger[_0xf005('0x31')](util[_0xf005('0x2d')](_0xf005('0x135'),_0x5c5738[_0xf005('0xa6')]));if(!this[_0xf005('0xa1')](_0x5c5738[_0xf005('0x136')])){return this[_0xf005('0x38')][_0xf005('0x4f')](_0x5c5738,'no\x20condition\x20configured');}try{var _0x2ac10e=eval(_0x5c5738[_0xf005('0x136')])?_0xf005('0x137'):'false';this[_0xf005('0x38')]['noop'](util[_0xf005('0x2d')](_0xf005('0x138'),_0x5c5738['condition'],_0x2ac10e));return{'code':0xc8,'result':_0x2ac10e};}catch(_0x13ec89){return{'code':0xc8,'result':_0xf005('0x139')};}};AGIVertices['prototype'][_0xf005('0x13a')]=function(_0xd44ab4){logger['info'](util[_0xf005('0x2d')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0xd44ab4[_0xf005('0xa6')]));if(!this[_0xf005('0xa1')](_0xd44ab4[_0xf005('0x13b')])){return this[_0xf005('0x38')][_0xf005('0x4f')](_0xd44ab4,_0xf005('0x13c'));}var _0x2b166c=this['getIntervals'][_0xf005('0x6d')](this,_0xd44ab4[_0xf005('0x13b')]);if(!_0x2b166c){return this[_0xf005('0x38')]['error'](_0xd44ab4,_0xf005('0x13d'));}for(var _0x154505=0x0;_0x154505<_0x2b166c[_0xf005('0x96')];_0x154505+=0x1){var _0x30723f=this[_0xf005('0x38')][_0xf005('0x9e')](util[_0xf005('0x2d')](_0xf005('0x13e'),_0x2b166c[_0x154505]));if(_0x30723f[_0xf005('0x9f')]===-0x1){return _0x30723f;}logger[_0xf005('0x31')](util[_0xf005('0x2d')]('IFTIME\x20%s\x20%s',_0x2b166c[_0x154505],_0x30723f[_0xf005('0x9c')]));if(_0x30723f[_0xf005('0x9c')]==='true'){logger['info'](util['format'](_0xf005('0x13f'),_0x2b166c[_0x154505],_0xf005('0x137')));this[_0xf005('0x38')][_0xf005('0xa8')](util[_0xf005('0x2d')](_0xf005('0x13f'),_0x2b166c[_0x154505],_0xf005('0x137')));return{'code':0xc8,'result':_0xf005('0x137')};}else{logger[_0xf005('0x31')](util['format'](_0xf005('0x13f'),_0x2b166c[_0x154505],_0xf005('0x139')));this[_0xf005('0x38')][_0xf005('0xa8')](util[_0xf005('0x2d')](_0xf005('0x13f'),_0x2b166c[_0x154505],_0xf005('0x139')));}}return{'code':0xc8,'result':_0xf005('0x139')};};AGIVertices[_0xf005('0x14')][_0xf005('0x140')]=function(_0x1a8964){logger[_0xf005('0x31')](util[_0xf005('0x2d')](_0xf005('0x141'),_0x1a8964[_0xf005('0xa6')]));return this['channel'][_0xf005('0x140')]();};AGIVertices[_0xf005('0x14')]['ispeechasr']=function(_0x5223ff){logger[_0xf005('0x31')](util[_0xf005('0x2d')](_0xf005('0x142'),_0x5223ff[_0xf005('0xa6')]));if(!this['isConfigured'](_0x5223ff[_0xf005('0x77')])){return this[_0xf005('0x38')][_0xf005('0xa8')]('no\x20key\x20configured');}var _0x38a324=_0xf005('0x126');var _0x4b41f5=util[_0xf005('0x2d')](_0xf005('0x143'),FILES_PATH,rs[_0xf005('0x127')](0x4));var _0x507218=util[_0xf005('0x2d')]('%s.%s',_0x4b41f5,_0x38a324);var _0x10667f=!![];if(_0x5223ff[_0xf005('0x128')]==='NOBEEP'){_0x10667f=![];}var _0x179f00=this['channel'][_0xf005('0x129')](_0x4b41f5,_0x38a324,_0x5223ff[_0xf005('0x12a')],_0x5223ff[_0xf005('0x64')],undefined,_0x10667f);if(_0x179f00[_0xf005('0x9f')]!==-0x1){this[_0xf005('0x38')][_0xf005('0xa8')](util[_0xf005('0x2d')](_0xf005('0x144'),_0x507218));var _0xdbf66=this['ispeechASR'][_0xf005('0x6d')](this,_0x5223ff,_0x507218);if(_0xdbf66){for(var _0x3ef9b9 in _0xdbf66){if(_0xdbf66[_0xf005('0x94')](_0x3ef9b9)){this[_0xf005('0x38')][_0xf005('0x99')](util[_0xf005('0x2d')](_0xf005('0x145'),_0x3ef9b9[_0xf005('0x68')]()),_0xdbf66[_0x3ef9b9]);}}return this[_0xf005('0x38')]['noop'](util[_0xf005('0x2d')](_0xf005('0x146'),JSON[_0xf005('0x70')](_0xdbf66)));}}return _0x179f00;};AGIVertices[_0xf005('0x14')][_0xf005('0x147')]=function(_0xde1f64){logger['info'](util[_0xf005('0x2d')]('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0xde1f64[_0xf005('0xa6')]));if(!this['isConfigured'](_0xde1f64[_0xf005('0x77')])){return this['channel'][_0xf005('0xa8')]('no\x20key\x20configured');}if(!this[_0xf005('0xa1')](_0xde1f64[_0xf005('0x5c')])){return this[_0xf005('0x38')][_0xf005('0xa8')](_0xf005('0xc1'));}this[_0xf005('0x38')][_0xf005('0xa8')](util[_0xf005('0x2d')](_0xf005('0x148'),_0xde1f64[_0xf005('0x5c')]));var _0x24d85b=this[_0xf005('0x7e')][_0xf005('0x6d')](this,_0xde1f64);if(_0x24d85b){this[_0xf005('0x38')]['noop'](util['format'](_0xf005('0x144'),_0x24d85b));var _0x4fe1b2=this['channel']['streamFile'](_0x24d85b,_0xde1f64['intKey']);try{fs['unlink'](_0x24d85b+_0xf005('0x149'));}catch(_0x34dbab){logger[_0xf005('0x4f')](_0x34dbab);}return _0x4fe1b2;}return this[_0xf005('0x38')][_0xf005('0x4f')](_0xde1f64,_0xf005('0x14a'));};AGIVertices[_0xf005('0x14')][_0xf005('0x14b')]=function(_0x547334){logger['info'](util[_0xf005('0x2d')](_0xf005('0x14c'),_0x547334[_0xf005('0xa6')]));if(!this[_0xf005('0xa1')](_0x547334[_0xf005('0x14d')])){return this[_0xf005('0x38')][_0xf005('0x4f')](_0x547334,_0xf005('0x14e'));}logger[_0xf005('0x31')](util[_0xf005('0x2d')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xf005('0x38')]['callerid'],_0x547334[_0xf005('0x14d')]));var _0x2d7e39=this[_0xf005('0x53')][_0xf005('0x6d')](this,_0x547334['findBy']);if(_0x2d7e39){logger[_0xf005('0x31')](util[_0xf005('0x2d')](_0xf005('0x14f'),this[_0xf005('0x38')]['callerid'],_0x547334[_0xf005('0x14d')]));this[_0xf005('0x38')]['noop'](util[_0xf005('0x2d')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xf005('0x38')][_0xf005('0x3b')],_0x547334[_0xf005('0x14d')]));return{'code':0xc8,'result':_0xf005('0x150')};}else{logger[_0xf005('0x31')](util[_0xf005('0x2d')](_0xf005('0x151'),this[_0xf005('0x38')][_0xf005('0x3b')],_0x547334[_0xf005('0x14d')]));this['channel'][_0xf005('0xa8')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xf005('0x38')][_0xf005('0x3b')],_0x547334[_0xf005('0x14d')]));return{'code':0xc8,'result':_0xf005('0x152')};}};AGIVertices[_0xf005('0x14')]['logout']=function(_0x271d26){logger['info'](util[_0xf005('0x2d')](_0xf005('0x153'),_0x271d26['label']));if(!this[_0xf005('0xa1')](_0x271d26[_0xf005('0x14d')])){return this[_0xf005('0x38')][_0xf005('0x4f')](_0x271d26,_0xf005('0x14e'));}logger[_0xf005('0x31')](util[_0xf005('0x2d')](_0xf005('0x154'),this[_0xf005('0x38')]['callerid'],_0x271d26[_0xf005('0x14d')]));var _0x340da0=this[_0xf005('0x52')][_0xf005('0x6d')](this,_0x271d26['findBy']);if(_0x340da0){logger[_0xf005('0x31')](util[_0xf005('0x2d')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xf005('0x38')][_0xf005('0x3b')],_0x271d26[_0xf005('0x14d')]));this[_0xf005('0x38')][_0xf005('0xa8')](util['format'](_0xf005('0x14f'),this[_0xf005('0x38')][_0xf005('0x3b')],_0x271d26[_0xf005('0x14d')]));return{'code':0xc8,'result':_0xf005('0x150')};}else{logger[_0xf005('0x31')](util[_0xf005('0x2d')](_0xf005('0x151'),this[_0xf005('0x38')][_0xf005('0x3b')],_0x271d26['findBy']));this[_0xf005('0x38')]['noop'](util[_0xf005('0x2d')](_0xf005('0x151'),this['channel'][_0xf005('0x3b')],_0x271d26['findBy']));return{'code':0xc8,'result':_0xf005('0x152')};}};AGIVertices[_0xf005('0x14')][_0xf005('0x155')]=function(_0x1beb4c){logger[_0xf005('0x31')](util['format'](_0xf005('0x156'),_0x1beb4c[_0xf005('0xa6')]));if(!this[_0xf005('0xa1')](_0x1beb4c[_0xf005('0x157')])){return this['channel'][_0xf005('0x4f')](_0x1beb4c,_0xf005('0x158'));}this['channel'][_0xf005('0xa8')](util[_0xf005('0x2d')]('math\x20%s',_0x1beb4c['operation']));var _0x4c72a6=eval(_0x1beb4c[_0xf005('0x157')]);if(!this[_0xf005('0xa1')](_0x1beb4c['variable_id'])){return this[_0xf005('0x38')][_0xf005('0xa8')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x3d0397=this['getVariable'][_0xf005('0x6d')](this,_0x1beb4c[_0xf005('0xce')]);if(!_0x3d0397){return this[_0xf005('0x38')][_0xf005('0x4f')](_0x1beb4c,_0xf005('0xd0'));}if(_[_0xf005('0x95')](_0x4c72a6)){var _0x371adc=this;_0x4c72a6[_0xf005('0xd1')](function(_0x217dd2,_0xfdcaeb){_0x371adc['channel'][_0xf005('0x99')](util[_0xf005('0x2d')]('%s[%s]',_0x3d0397,_0xfdcaeb),_0x217dd2);});return this[_0xf005('0x38')][_0xf005('0xa8')](util[_0xf005('0x2d')](_0xf005('0x159'),_0x3d0397));}else{return this[_0xf005('0x38')][_0xf005('0x99')](_0x3d0397,_0x4c72a6);}};AGIVertices[_0xf005('0x14')][_0xf005('0xf')]=function(_0x4490bc){logger[_0xf005('0x31')](util[_0xf005('0x2d')](_0xf005('0x15a'),_0x4490bc[_0xf005('0xa6')]));if(_0x4490bc['retry']===0x0){return this[_0xf005('0xa2')](_0x4490bc);}_0x4490bc[_0xf005('0xa4')]-=0x1;if(!this[_0xf005('0xa1')](_0x4490bc[_0xf005('0x10d')])){return this[_0xf005('0x38')][_0xf005('0x4f')](_0x4490bc,'no\x20file\x20audio\x20selected');}var _0x1af4db=this[_0xf005('0x21')][_0xf005('0x6d')](this,_0x4490bc['file_id']);if(!_0x1af4db){return this[_0xf005('0x38')][_0xf005('0x4f')](_0x4490bc,'no\x20file\x20audio\x20found');}var _0x2a92bc=this['channel'][_0xf005('0x15b')](_0x1af4db,_0x4490bc[_0xf005('0x10e')],_0x4490bc['digit']);var _0x918b28=_0x2a92bc[_0xf005('0x9f')];if(_0x2a92bc[_0xf005('0x9f')]===-0x1){this[_0xf005('0xa3')]['sync'](this,_0x4490bc,'-1');return _0x2a92bc;}else if(_0x2a92bc[_0xf005('0x9c')]===_0xf005('0x64')){_0x2a92bc['result']=_0x2a92bc[_0xf005('0x9f')][_0xf005('0x96')]>0x0?_0x2a92bc[_0xf005('0x9f')]:'t';}else if(_[_0xf005('0x44')](_0x2a92bc[_0xf005('0x9f')])){_0x2a92bc[_0xf005('0x9f')]='#';_0x918b28='#';}if(!this['isConfigured'](_0x4490bc['variable_id'])){this['channel'][_0xf005('0xa8')](_0xf005('0xcf'));}else{var _0x3bb59a=this[_0xf005('0x9e')][_0xf005('0x6d')](this,_0x4490bc[_0xf005('0xce')]);if(!_0x3bb59a){return this[_0xf005('0x38')][_0xf005('0x4f')](_0x4490bc,_0xf005('0xd0'));}this['channel'][_0xf005('0x99')](_0x3bb59a,_0x918b28);}this[_0xf005('0xa3')]['sync'](this,_0x4490bc,_0x918b28);return _0x2a92bc;};AGIVertices[_0xf005('0x14')]['noop']=function(_0x2a25f0){logger[_0xf005('0x31')](util[_0xf005('0x2d')](_0xf005('0x15c'),_0x2a25f0['label']));return this[_0xf005('0x38')][_0xf005('0xa8')](_0x2a25f0[_0xf005('0x15d')]||_0x2a25f0[_0xf005('0xa6')]);};AGIVertices['prototype'][_0xf005('0x15e')]=function(_0x41993d){logger[_0xf005('0x31')](util[_0xf005('0x2d')](_0xf005('0x15f'),_0x41993d[_0xf005('0xa6')]));if(!this[_0xf005('0xa1')](_0x41993d['findBy'])){return this[_0xf005('0x38')][_0xf005('0x4f')](_0x41993d,_0xf005('0x14e'));}logger[_0xf005('0x31')](util[_0xf005('0x2d')](_0xf005('0x154'),this[_0xf005('0x38')][_0xf005('0x3b')],_0x41993d[_0xf005('0x14d')]));var _0x296203=this[_0xf005('0x4c')][_0xf005('0x6d')](this,_0x41993d[_0xf005('0x160')]);var _0x2686b1=this['agentPause']['sync'](this,_0x41993d[_0xf005('0x14d')],_0x296203);if(_0x2686b1){logger['info'](util[_0xf005('0x2d')](_0xf005('0x14f'),this[_0xf005('0x38')][_0xf005('0x3b')],_0x41993d['findBy']));this[_0xf005('0x38')]['noop'](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0xf005('0x38')][_0xf005('0x3b')],_0x41993d[_0xf005('0x14d')]));return{'code':0xc8,'result':_0xf005('0x150')};}else{logger['info'](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0xf005('0x3b')],_0x41993d[_0xf005('0x14d')]));this['channel'][_0xf005('0xa8')](util['format'](_0xf005('0x14f'),this['channel']['callerid'],_0x41993d[_0xf005('0x14d')]));return{'code':0xc8,'result':_0xf005('0x152')};}};AGIVertices['prototype'][_0xf005('0x161')]=function(_0x4ca0d2){logger[_0xf005('0x31')](util[_0xf005('0x2d')](_0xf005('0x162'),_0x4ca0d2[_0xf005('0xa6')]));if(!this[_0xf005('0xa1')](_0x4ca0d2['file_id'])){return this[_0xf005('0x38')][_0xf005('0x4f')](_0x4ca0d2,_0xf005('0x163'));}var _0x335868=this['getSound'][_0xf005('0x6d')](this,_0x4ca0d2[_0xf005('0x10d')]);if(!_0x335868){return this[_0xf005('0x38')][_0xf005('0x4f')](_0x4ca0d2,_0xf005('0x164'));}var _0x9f9b0d=this[_0xf005('0x38')]['exec'](_0xf005('0x165'),[_0x335868,_0x4ca0d2[_0xf005('0xdd')]]);if(_0x9f9b0d['result']===-0x1){return _0x9f9b0d;}return this[_0xf005('0x38')][_0xf005('0xa8')](util['format']('Executed\x20command\x20%s\x20%s',_0xf005('0x165'),_0x335868));};AGIVertices[_0xf005('0x14')]['queue']=function(_0x9b88b1){logger['info'](util[_0xf005('0x2d')](_0xf005('0x166'),_0x9b88b1['label']));if(!this['isConfigured'](_0x9b88b1[_0xf005('0x167')])){return this[_0xf005('0x38')][_0xf005('0x4f')](_0x9b88b1,_0xf005('0x168'));}var _0x1b240e='';var _0x47b5e1=parseInt(_0x9b88b1[_0xf005('0x167')],0xa);if(isNaN(_0x47b5e1)){_0x1b240e=_0x9b88b1[_0xf005('0x167')];}else{_0x1b240e=this[_0xf005('0x17')][_0xf005('0x6d')](this,_0x9b88b1[_0xf005('0x167')]);if(!_0x1b240e){return this['channel'][_0xf005('0x4f')](_0x9b88b1,_0xf005('0x169'));}}var _0x42f59f='';if(this['isConfigured'](_0x9b88b1[_0xf005('0x10d')])){var _0x5b493c=this[_0xf005('0x21')]['sync'](this,_0x9b88b1[_0xf005('0x10d')]);if(_0x5b493c){_0x42f59f=_0x5b493c;}}this['createSquareDetailsReport']['sync'](this,_0x9b88b1,_0x1b240e);if(_0x9b88b1[_0xf005('0xdd')][_0xf005('0x16a')]('x')<0x0){_0x9b88b1['opts']+='x';}if(_0x9b88b1['opts'][_0xf005('0x16a')]('X')<0x0){_0x9b88b1['opts']+='X';}this[_0xf005('0x38')][_0xf005('0x99')](_0xf005('0x16b'),_0x1b240e?_0x1b240e[_0xf005('0x16c')]():'');var _0x3bf266=this[_0xf005('0x38')]['exec'](_0xf005('0x16d'),[_0x1b240e,_0x9b88b1[_0xf005('0xdd')],_0x9b88b1[_0xf005('0xde')],_0x42f59f,_0x9b88b1[_0xf005('0x64')],_0x9b88b1[_0xf005('0x9')],_0x9b88b1['macro'],_0x9b88b1[_0xf005('0x16e')],'',_0x9b88b1[_0xf005('0x16f')]]);if(_0x3bf266[_0xf005('0x9f')]===-0x1){return _0x3bf266;}return this[_0xf005('0x38')]['noop'](util['format'](_0xf005('0x170'),_0xf005('0x16d'),_0x1b240e));};AGIVertices['prototype'][_0xf005('0x171')]=function(_0x44269b){logger['info'](util[_0xf005('0x2d')](_0xf005('0x172'),_0x44269b[_0xf005('0xa6')]));var _0x2c9f80=_0x44269b[_0xf005('0x173')]||'wav';var _0x29a5e3=util[_0xf005('0x2d')](_0xf005('0x174'),this['channel'][_0xf005('0x39')],rs[_0xf005('0x127')](0x5));var _0x5beef6=util[_0xf005('0x2d')](_0xf005('0x175'),FILES_PATH,_0x29a5e3,_0x2c9f80);var _0x32f9d8=util['format'](_0xf005('0x143'),FILES_PATH,_0x29a5e3);this[_0xf005('0x3c')][_0xf005('0x6d')](this,_0x44269b,_0x29a5e3,_0x5beef6);this[_0xf005('0x38')]['setVariable'](_0xf005('0x176'),_0x29a5e3);logger[_0xf005('0x31')](_0xf005('0x177'),_0x32f9d8,_0x2c9f80,_0x44269b[_0xf005('0x178')],_0x44269b[_0xf005('0x64')]);return this['channel'][_0xf005('0x129')](_0x32f9d8,_0x2c9f80,_0x44269b[_0xf005('0x178')],_0x44269b[_0xf005('0x64')],undefined,!![]);};AGIVertices[_0xf005('0x14')]['restapi']=function(_0x90680d){logger[_0xf005('0x31')](util[_0xf005('0x2d')](_0xf005('0x179'),_0x90680d['label']));if(!this[_0xf005('0xa1')](_0x90680d[_0xf005('0xde')])){return this[_0xf005('0x38')][_0xf005('0xa8')](_0xf005('0x17a'));}var _0x2eea7e=this[_0xf005('0x63')][_0xf005('0x6d')](this,_0x90680d);logger[_0xf005('0x31')](util[_0xf005('0x2d')]('Response:',util[_0xf005('0x17b')](_0x2eea7e,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x90680d[_0xf005('0xce')])){return this[_0xf005('0x38')][_0xf005('0xa8')](_0xf005('0x17c'));}var _0x418933=this['getVariable'][_0xf005('0x6d')](this,_0x90680d[_0xf005('0xce')]);if(!_0x418933){return this['channel']['error'](_0x90680d,_0xf005('0xd0'));}this[_0xf005('0x38')][_0xf005('0x99')](util['format']('%s_STATUS_CODE',_0x418933),_0x2eea7e[_0xf005('0x73')]?_0x2eea7e[_0xf005('0x73')]:_0xf005('0x17d'));this[_0xf005('0x38')][_0xf005('0x99')](util['format']('%s_STATUS_MESSAGE',_0x418933),_0x2eea7e[_0xf005('0x72')]?_0x2eea7e[_0xf005('0x72')]:'OK');if(_0x2eea7e[_0xf005('0x69')]){try{this[_0xf005('0x97')](_0x2eea7e[_0xf005('0x69')],_0x418933);}catch(_0x14fa88){logger['error'](util['format'](_0xf005('0x17e'),_0x418933));}}return this['channel']['noop'](util[_0xf005('0x2d')](_0xf005('0xd5'),_0x418933));};AGIVertices[_0xf005('0x14')][_0xf005('0x17f')]=function(_0x1ed09e){logger[_0xf005('0x31')](util[_0xf005('0x2d')](_0xf005('0x180'),_0x1ed09e[_0xf005('0xa6')]));return this[_0xf005('0x38')]['sayDigits'](_0x1ed09e[_0xf005('0x181')][_0xf005('0x58')](/\s+/g,''),_0x1ed09e[_0xf005('0x178')]);};AGIVertices[_0xf005('0x14')][_0xf005('0x182')]=function(_0x53b75a){logger[_0xf005('0x31')](util[_0xf005('0x2d')](_0xf005('0x183'),_0x53b75a[_0xf005('0xa6')]));return this[_0xf005('0x38')][_0xf005('0x184')](_0x53b75a[_0xf005('0x185')][_0xf005('0x58')](/\s+/g,''),_0x53b75a[_0xf005('0x178')]);};AGIVertices[_0xf005('0x14')][_0xf005('0x186')]=function(_0xa7b6a){logger[_0xf005('0x31')](util[_0xf005('0x2d')]('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0xa7b6a[_0xf005('0xa6')]));return this[_0xf005('0x38')]['sayPhonetic'](_0xa7b6a[_0xf005('0x5c')],_0xa7b6a[_0xf005('0x178')]);};AGIVertices[_0xf005('0x14')]['sendMail']=function(_0x5cee80){logger[_0xf005('0x31')](util[_0xf005('0x2d')](_0xf005('0x187'),_0x5cee80[_0xf005('0xa6')]));if(!this[_0xf005('0xa1')](_0x5cee80['account_id'])){return this[_0xf005('0x38')][_0xf005('0xa8')]('no\x20mail\x20account\x20configured');}var _0x408752=this[_0xf005('0x24')][_0xf005('0x6d')](this,_0x5cee80[_0xf005('0x188')]);if(!_0x408752||!_0x408752[_0xf005('0x189')]){return this['channel'][_0xf005('0x4f')](_0x5cee80,_0xf005('0x18a'));}var _0x9c63a6={'from':util[_0xf005('0x2d')](_0xf005('0x18b'),_0x408752[_0xf005('0x19')],_0x408752[_0xf005('0x18c')]||_0x408752[_0xf005('0x189')][_0xf005('0x18d')]),'to':_0x5cee80['to']||'','cc':_0x5cee80['cc']||'','bcc':_0x5cee80[_0xf005('0x18e')]||'','subject':_0x5cee80[_0xf005('0x18f')],'html':_0x5cee80[_0xf005('0x5c')],'text':_0x5cee80[_0xf005('0x5c')]};var _0x5bb377={'tls':{'rejectUnauthorized':![]}};if(_0x408752[_0xf005('0x189')][_0xf005('0x190')]){_0x5bb377[_0xf005('0x190')]=_0x408752[_0xf005('0x189')][_0xf005('0x190')];}else{_0x5bb377[_0xf005('0x191')]=_0x408752[_0xf005('0x189')][_0xf005('0x191')];_0x5bb377[_0xf005('0x192')]=_0x408752[_0xf005('0x189')]['port'];_0x5bb377[_0xf005('0x193')]=_0x408752[_0xf005('0x189')][_0xf005('0x193')];}if(_0x408752[_0xf005('0x189')][_0xf005('0x194')]){_0x5bb377[_0xf005('0x195')]={'user':_0x408752['Smtp']['user'],'pass':_0x408752[_0xf005('0x189')][_0xf005('0x196')]};}if(this[_0xf005('0xa1')](_0x5cee80[_0xf005('0x197')])){}logger[_0xf005('0xd7')](_0xf005('0x198'),JSON[_0xf005('0x70')](_0x9c63a6));this[_0xf005('0xa3')][_0xf005('0x6d')](this,_0x5cee80,_0x5cee80[_0xf005('0x188')]);this[_0xf005('0x38')]['noop'](util['format'](_0xf005('0x199'),_0x408752[_0xf005('0x19')]));this[_0xf005('0x26')]['sync'](this,_0x5bb377,_0x9c63a6);return this[_0xf005('0x38')][_0xf005('0xa8')](_0xf005('0x19a'));};AGIVertices[_0xf005('0x14')][_0xf005('0x19b')]=function(_0x2eb810){logger['info'](util[_0xf005('0x2d')](_0xf005('0x19c'),_0x2eb810[_0xf005('0xa6')]));return this[_0xf005('0x38')][_0xf005('0xa8')](_0xf005('0x19d'));};AGIVertices['prototype'][_0xf005('0x19e')]=function(_0x4b878f){logger[_0xf005('0x31')](util['format'](_0xf005('0x19f'),_0x4b878f['label']));if(!this[_0xf005('0xa1')](_0x4b878f[_0xf005('0x1a0')])){return this['channel'][_0xf005('0xa8')](_0xf005('0x1a1'));}var _0x329a70=this[_0xf005('0x35')][_0xf005('0x6d')](this,_0x4b878f[_0xf005('0x1a0')]);if(!_0x329a70){return this[_0xf005('0x38')][_0xf005('0x4f')](_0x4b878f,'no\x20sms\x20account\x20found');}var _0x1215a4={'body':_0x4b878f[_0xf005('0x1a2')],'phone':_0x4b878f['to']||'','SmsAccountId':_0x329a70['id']};logger[_0xf005('0xd7')](_0xf005('0x1a3'),JSON['stringify'](_0x1215a4));this[_0xf005('0xa3')][_0xf005('0x6d')](this,_0x4b878f,_0x4b878f[_0xf005('0x1a0')]);this[_0xf005('0x38')][_0xf005('0xa8')](util[_0xf005('0x2d')](_0xf005('0x1a4'),_0x329a70['name']));this[_0xf005('0x37')][_0xf005('0x6d')](this,_0x1215a4);return this['channel'][_0xf005('0xa8')](_0xf005('0x1a5'));};AGIVertices['prototype'][_0xf005('0x1a6')]=function(_0x1a0e28){logger[_0xf005('0x31')](util[_0xf005('0x2d')]('Enter\x20in\x20SET\x20(%s)\x20block',_0x1a0e28[_0xf005('0xa6')]));if(!this[_0xf005('0xa1')](_0x1a0e28[_0xf005('0xce')])){return this[_0xf005('0x38')][_0xf005('0x4f')](_0x1a0e28,_0xf005('0x1a7'));}var _0xf91dd=this[_0xf005('0x9e')][_0xf005('0x6d')](this,_0x1a0e28['variable_id']);if(!_0xf91dd){return this[_0xf005('0x38')]['error'](_0x1a0e28,_0xf005('0xd0'));}return this[_0xf005('0x38')]['setVariable'](_0xf91dd,_0x1a0e28[_0xf005('0x1a8')]);};AGIVertices['prototype'][_0xf005('0x1a9')]=function(_0x3ef835){logger['info'](util[_0xf005('0x2d')](_0xf005('0x1aa'),_0x3ef835[_0xf005('0xa6')]));this[_0xf005('0x38')][_0xf005('0xa8')]('START\x20CALLY\x20SQUARE');if(_0x3ef835[_0xf005('0xb6')]===_0xf005('0x1ab')){this['channel'][_0xf005('0xa8')](_0xf005('0x1ac'));return this[_0xf005('0x38')][_0xf005('0xb6')]();}return this[_0xf005('0x38')][_0xf005('0xa8')](_0xf005('0x1ad'));};AGIVertices['prototype'][_0xf005('0x1ae')]=function(_0x31660a){logger[_0xf005('0x31')](util[_0xf005('0x2d')](_0xf005('0x1af'),_0x31660a['label']));if(!this[_0xf005('0xa1')](_0x31660a[_0xf005('0x1b0')])){return this[_0xf005('0x38')][_0xf005('0x4f')](_0x31660a,'no\x20subproject\x20selected');}var _0x50932a=this['getSquareProject']['sync'](this,_0x31660a[_0xf005('0x1b0')]);if(!this[_0xf005('0xa1')](_0x50932a)){return this[_0xf005('0x38')][_0xf005('0x4f')](_0x31660a,util['format']('no\x20subproject\x20found\x20with\x20id\x20%d',_0x31660a['project_id']));}if(_0x50932a===this[_0xf005('0x38')]['arg_1']){return this['channel'][_0xf005('0x4f')](_0x31660a,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this[_0xf005('0xa3')][_0xf005('0x6d')](this,_0x31660a,_0x50932a);var _0x1fafec=this[_0xf005('0x38')][_0xf005('0x57')](_0xf005('0x1b1'),util[_0xf005('0x2d')]('agi://%s/square,\x22%s\x22,\x22%s\x22',config['agi'][_0xf005('0x191')]||_0xf005('0x1b2'),_0x50932a,this[_0xf005('0x38')]['arg_1']));if(_0x1fafec['result']===-0x1){return _0x1fafec;}return this[_0xf005('0x38')][_0xf005('0xa8')](util[_0xf005('0x2d')]('Executed\x20command\x20%s\x20%s','AGI',_0x50932a));};AGIVertices[_0xf005('0x14')][_0xf005('0x1b3')]=function(_0x39494f){logger['info'](util['format'](_0xf005('0x1b4'),_0x39494f[_0xf005('0xa6')]));var _0x358c6f=this[_0xf005('0x1b5')]['sync'](this,_0x39494f[_0xf005('0xb5')]);this['createSquareDetailsReport'][_0xf005('0x6d')](this,_0x39494f,_0x39494f['command']);if(this[_0xf005('0xa1')](_0x39494f[_0xf005('0xce')])){var _0x48de18=this[_0xf005('0x9e')][_0xf005('0x6d')](this,_0x39494f[_0xf005('0xce')]);if(_0x48de18){this[_0xf005('0x38')][_0xf005('0x99')](_0x48de18,_0x358c6f);return this['channel'][_0xf005('0xa8')](util[_0xf005('0x2d')](_0xf005('0x1b6'),_0x39494f[_0xf005('0xb5')],_0x48de18));}}return this[_0xf005('0x38')][_0xf005('0xa8')](util[_0xf005('0x2d')](_0xf005('0x1b7'),_0x39494f['command']));};AGIVertices['prototype']['google_cloud_tts']=function(_0x5a8812){logger[_0xf005('0x31')](util[_0xf005('0x2d')](_0xf005('0x1b8'),_0x5a8812[_0xf005('0xa6')]));_0x5a8812[_0xf005('0x5c')]=_0x5a8812[_0xf005('0x5c')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x5a8812['apiKey'])){return this[_0xf005('0x38')]['noop'](_0xf005('0x1b9'));}if(!this[_0xf005('0xa1')](_0x5a8812['text'])){return this['channel'][_0xf005('0xa8')](_0xf005('0xc1'));}this['channel'][_0xf005('0xa8')](util[_0xf005('0x2d')](_0xf005('0x1ba'),_0x5a8812[_0xf005('0x5c')]));var _0x4c6dfd=this[_0xf005('0x59')][_0xf005('0x6d')](this,_0x5a8812);if(_0x4c6dfd){this[_0xf005('0x38')][_0xf005('0xa8')](util[_0xf005('0x2d')]('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x4c6dfd));var _0x2e0163=this['channel'][_0xf005('0xfe')](_0x4c6dfd);try{fs['unlink'](_0x4c6dfd+_0xf005('0x149'));}catch(_0xd1ef1f){logger['error'](_0xd1ef1f);}return _0x2e0163;}return this[_0xf005('0x38')][_0xf005('0x4f')](_0x5a8812,_0xf005('0x1bb'));};AGIVertices[_0xf005('0x14')][_0xf005('0x1bc')]=function(_0x570f68){logger[_0xf005('0x31')](util[_0xf005('0x2d')](_0xf005('0x1bd'),_0x570f68[_0xf005('0xa6')]));_0x570f68[_0xf005('0x5c')]=_0x570f68[_0xf005('0x5c')][_0xf005('0x58')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xf005('0xa1')](_0x570f68['text'])){return this['channel']['noop'](_0xf005('0xc1'));}this['channel']['noop'](util[_0xf005('0x2d')](_0xf005('0x1be'),_0x570f68['text']));var _0x2920d3=this['googleTTS'][_0xf005('0x6d')](this,_0x570f68);if(_0x2920d3){this['channel']['noop'](util[_0xf005('0x2d')]('Google\x20TTS\x20%s\x20file\x20created',_0x2920d3));var _0x26d7f=this[_0xf005('0x38')][_0xf005('0xfe')](_0x2920d3);try{fs[_0xf005('0xff')](_0x2920d3+_0xf005('0x149'));}catch(_0x14fee0){logger[_0xf005('0x4f')](_0x14fee0);}return _0x26d7f;}return this[_0xf005('0x38')][_0xf005('0x4f')](_0x570f68,_0xf005('0x1bf'));};AGIVertices[_0xf005('0x14')][_0xf005('0x1c0')]=function(_0x4d9b5f){logger[_0xf005('0x31')](util[_0xf005('0x2d')](_0xf005('0x1c1'),_0x4d9b5f[_0xf005('0xa6')]));if(!this[_0xf005('0xa1')](_0x4d9b5f[_0xf005('0x14d')])){return this[_0xf005('0x38')]['error'](_0x4d9b5f,_0xf005('0x14e'));}logger[_0xf005('0x31')](util[_0xf005('0x2d')](_0xf005('0x154'),this[_0xf005('0x38')][_0xf005('0x3b')],_0x4d9b5f['findBy']));var _0x138bf5=this['agentUnpause'][_0xf005('0x6d')](this,_0x4d9b5f[_0xf005('0x14d')]);if(_0x138bf5){logger[_0xf005('0x31')](util[_0xf005('0x2d')](_0xf005('0x14f'),this['channel'][_0xf005('0x3b')],_0x4d9b5f[_0xf005('0x14d')]));this[_0xf005('0x38')][_0xf005('0xa8')](util[_0xf005('0x2d')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0xf005('0x3b')],_0x4d9b5f[_0xf005('0x14d')]));return{'code':0xc8,'result':_0xf005('0x150')};}else{logger[_0xf005('0x31')](util[_0xf005('0x2d')](_0xf005('0x151'),this['channel'][_0xf005('0x3b')],_0x4d9b5f[_0xf005('0x14d')]));this[_0xf005('0x38')]['noop'](util[_0xf005('0x2d')](_0xf005('0x151'),this[_0xf005('0x38')][_0xf005('0x3b')],_0x4d9b5f['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xf005('0x14')][_0xf005('0x1c2')]=function(_0x1d04d4){logger[_0xf005('0x31')](util['format'](_0xf005('0x1c3'),_0x1d04d4['label']));var _0x3b8bf7=this['channel'][_0xf005('0x57')](_0xf005('0x1c4'),[_0x1d04d4[_0xf005('0x1c5')],_0x1d04d4[_0xf005('0x75')]]);if(_0x3b8bf7['result']===-0x1){return _0x3b8bf7;}return this[_0xf005('0x38')][_0xf005('0xa8')](util[_0xf005('0x2d')](_0xf005('0x170'),_0xf005('0x1c4'),_0x1d04d4['mailbox']));};AGIVertices['prototype']['vswitch']=function(_0x5494da){logger[_0xf005('0x31')](util[_0xf005('0x2d')]('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x5494da['label']));if(!this[_0xf005('0xa1')](_0x5494da['variable_id'])){return this['channel']['error'](_0x5494da,_0xf005('0x1a7'));}var _0x5e14f8=this['getVariable'][_0xf005('0x6d')](this,_0x5494da['variable_id']);if(!_0x5e14f8){return this[_0xf005('0x38')][_0xf005('0x4f')](_0x5494da,'no\x20variable\x20found');}var _0xaf328f=this[_0xf005('0x38')]['getVariable'](_0x5e14f8);return{'code':0xc8,'result':_0xaf328f[_0xf005('0x9c')]?_0xaf328f[_0xf005('0x9c')]:'-'};};String[_0xf005('0x14')]['replaceAll']=function(_0x3873f0,_0x45a07e){return this[_0xf005('0x9a')](_0x3873f0)['join'](_0x45a07e);};module[_0xf005('0x1c6')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 1ed3242..ec1f4eb 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 _0xb155=['uniqueid','lastPauseAt','update','catch','error','[%s][UPDATE][ERRORS:%s]','[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','interface','[ACW][syncAgentConnect]\x20%s','prototype','mandatoryDisposition','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','moment','../ami','acw','../rpc/voiceAgentReport','agents','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','seconds','startAcw','queue','ACW','mandatoryDispositionPause','name','QueuePause','then','getAgent','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','timers','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','voiceQueues','timer','stopAcw','acwTimeout','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0xa60623,_0x2d4e4f){var _0x4a6487=function(_0xba6cbe){while(--_0xba6cbe){_0xa60623['push'](_0xa60623['shift']());}};_0x4a6487(++_0x2d4e4f);}(_0xb155,0xd9));var _0x5b15=function(_0x39772f,_0x5605cb){_0x39772f=_0x39772f-0x0;var _0xc9edbf=_0xb155[_0x39772f];return _0xc9edbf;};'use strict';var util=require(_0x5b15('0x0'));var _=require(_0x5b15('0x1'));var moment=require(_0x5b15('0x2'));var ami=require(_0x5b15('0x3'));var logger=require('../../../config/logger')(_0x5b15('0x4'));var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0x5b15('0x5'));function Acw(_0x4d1ac2){this['voiceQueues']=_0x4d1ac2['voiceQueues'];this[_0x5b15('0x6')]=_0x4d1ac2['agents'];this['timers']=_0x4d1ac2['timers'];this[_0x5b15('0x7')]={};ami['on'](_0x5b15('0x8'),this[_0x5b15('0x9')][_0x5b15('0xa')](this));ami['on'](_0x5b15('0xb'),this[_0x5b15('0xc')][_0x5b15('0xa')](this));ami['on'](_0x5b15('0xd'),this[_0x5b15('0xe')][_0x5b15('0xa')](this));ami['on'](_0x5b15('0xf'),this[_0x5b15('0x10')]['bind'](this));ami['on'](_0x5b15('0x11'),this[_0x5b15('0x12')]['bind'](this));ami['on'](_0x5b15('0x13'),this[_0x5b15('0x14')][_0x5b15('0xa')](this));ami['on'](_0x5b15('0x15'),this[_0x5b15('0x16')][_0x5b15('0xa')](this));}function getDiff(_0x33f8d9){var _0x11a10a=moment()[_0x5b15('0x17')](0x0);var _0x5de402=moment(_0x33f8d9)[_0x5b15('0x17')](0x0);return _0x11a10a['diff'](_0x5de402,_0x5b15('0x18'));}Acw['prototype'][_0x5b15('0x19')]=function(_0x317876){try{var _0x2db023=this;var _0x1aed74=this[_0x5b15('0x7')][_0x317876]['interface'];var _0x47bd70=this[_0x5b15('0x7')][_0x317876][_0x5b15('0x1a')];var _0xc75749=this['voiceQueues'][_0x47bd70];var _0x44f660=![];var _0x28dbdf=_0x5b15('0x1b');if(_0xc75749['mandatoryDisposition']){if(_0xc75749[_0x5b15('0x1c')]['name']){_0x44f660=!![];_0x28dbdf=_0xc75749[_0x5b15('0x1c')][_0x5b15('0x1d')];}}ami['Action']({'action':_0x5b15('0x1e'),'interface':_0x1aed74,'paused':!![],'reason':_0x28dbdf})[_0x5b15('0x1f')](function(_0x534dfb){if(_0x2db023[_0x5b15('0x6')][_0x1aed74]){return RpcUser[_0x5b15('0x20')](_0x2db023[_0x5b15('0x6')][_0x1aed74]['id'])[_0x5b15('0x1f')](function(_0x56496c){if(_0x56496c&&!_0x56496c[_0x5b15('0x21')]){logger[_0x5b15('0x22')](_0x5b15('0x23'),_0x317876,_0x1aed74,_0x47bd70);var _0x50b746=_0x2db023[_0x5b15('0x7')][_0x317876][_0x5b15('0x24')]&&_0x2db023[_0x5b15('0x7')][_0x317876][_0x5b15('0x25')]?_0x2db023['channels'][_0x317876][_0x5b15('0x25')]:_0x317876;return RpcUser[_0x5b15('0x26')](_0x2db023[_0x5b15('0x6')][_0x1aed74],_0x28dbdf,_0x50b746)['then'](function(_0xf4c3e5){if(!_0x44f660){_0x2db023[_0x5b15('0x27')][_0x1aed74]={};logger[_0x5b15('0x22')](_0x5b15('0x28'),_0x317876,_0x2db023[_0x5b15('0x29')][_0x47bd70]['acwTimeout'],_0x1aed74,_0x47bd70);_0x2db023[_0x5b15('0x27')][_0x1aed74][_0x5b15('0x2a')]=setTimeout(_0x2db023[_0x5b15('0x2b')][_0x5b15('0xa')](_0x2db023,_0x1aed74),_0x2db023[_0x5b15('0x29')][_0x47bd70][_0x5b15('0x2c')]*0x3e8);_0x2db023[_0x5b15('0x27')][_0x1aed74]['lastPauseAt']=moment()[_0x5b15('0x2d')](_0x5b15('0x2e'));_0x2db023[_0x5b15('0x27')][_0x1aed74][_0x5b15('0x2f')]=_0x317876;_0x2db023['timers'][_0x1aed74][_0x5b15('0x1a')]=_0x47bd70;_0x2db023[_0x5b15('0x27')][_0x1aed74]['updateAcw']=function(){var _0x2f794f=getDiff(_0x2db023[_0x5b15('0x27')][_0x1aed74][_0x5b15('0x30')]);clearTimeout(_0x2db023['timers'][_0x1aed74][_0x5b15('0x2a')]);_0x2db023[_0x5b15('0x27')][_0x1aed74][_0x5b15('0x2a')]=![];RpcVoiceAgentReport[_0x5b15('0x31')]({'acwtime':_0x2f794f},_0x2db023['timers'][_0x1aed74]['uniqueid'],_0x1aed74)[_0x5b15('0x1f')](function(_0x51c041){logger[_0x5b15('0x22')]('[%s][UPDATE][ACWTIME:%s]',_0x317876,_0x2f794f,_0x51c041);})[_0x5b15('0x32')](function(_0x544700){logger[_0x5b15('0x33')](_0x5b15('0x34'),_0x317876,_0x544700);});delete _0x2db023[_0x5b15('0x27')][_0x1aed74];};}});}else{logger[_0x5b15('0x22')]('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0x317876,_0x1aed74,_0x47bd70);}});}})[_0x5b15('0x32')](function(_0x3ecbe4){logger[_0x5b15('0x33')](_0x5b15('0x28'),_0x317876,_0x2db023[_0x5b15('0x29')][_0x47bd70][_0x5b15('0x2c')],_0x1aed74,_0x47bd70);})['finally'](function(){delete _0x2db023[_0x5b15('0x7')][_0x317876];});}catch(_0x25d6f5){logger[_0x5b15('0x33')](_0x5b15('0x35'),_0x25d6f5[_0x5b15('0x36')]);}};Acw['prototype']['stopAcw']=function(_0x1b1e9c){try{var _0x650c7f=this;if(_0x650c7f[_0x5b15('0x27')][_0x1b1e9c]){_0x650c7f[_0x5b15('0x27')][_0x1b1e9c][_0x5b15('0x2a')]=![];var _0x11c9b3=_0x650c7f[_0x5b15('0x27')][_0x1b1e9c]['uniqueid'];var _0x1fe812=_0x650c7f[_0x5b15('0x27')][_0x1b1e9c][_0x5b15('0x1a')];var _0x1ccaae=_0x650c7f[_0x5b15('0x29')][_0x1fe812][_0x5b15('0x2c')];logger['info'](_0x5b15('0x37'),_0x11c9b3,_0x1b1e9c);RpcUser[_0x5b15('0x38')](this[_0x5b15('0x6')][_0x1b1e9c]);RpcVoiceAgentReport[_0x5b15('0x31')]({'acwtime':_0x1ccaae,'agentacw':!![]},_0x11c9b3,_0x1b1e9c)['then'](function(_0x2bd44a){logger[_0x5b15('0x22')]('[%s][UPDATE][ACWTIME:%s]',_0x11c9b3,_0x1ccaae,_0x2bd44a);})['catch'](function(_0x17741b){logger[_0x5b15('0x33')]('[%s][UPDATE][ERRORS:%s]',_0x11c9b3,_0x17741b);});}else{logger[_0x5b15('0x33')]('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x1b1e9c);if(_0x650c7f[_0x5b15('0x27')]){logger[_0x5b15('0x22')](_0x5b15('0x39'),JSON[_0x5b15('0x3a')](_0x650c7f[_0x5b15('0x27')]));}}}catch(_0x186bf5){logger[_0x5b15('0x33')](_0x5b15('0x3b'),_0x186bf5[_0x5b15('0x36')]);}};Acw['prototype'][_0x5b15('0x9')]=function(_0xccad94){try{if(this[_0x5b15('0x29')][_0xccad94[_0x5b15('0x1a')]]&&(this[_0x5b15('0x29')][_0xccad94[_0x5b15('0x1a')]]['acw']||this[_0x5b15('0x29')][_0xccad94[_0x5b15('0x1a')]]['mandatoryDisposition'])){if(this['agents'][_0xccad94[_0x5b15('0x3c')]]){this[_0x5b15('0x7')][_0xccad94[_0x5b15('0x2f')]]={'queue':_0xccad94[_0x5b15('0x1a')],'interface':_0xccad94[_0x5b15('0x3c')],'destlinkedid':_0xccad94[_0x5b15('0x25')]};}}}catch(_0x3f006f){logger[_0x5b15('0x33')](_0x5b15('0x3d'),_0x3f006f[_0x5b15('0x36')]);}};Acw[_0x5b15('0x3e')][_0x5b15('0x16')]=function(_0x13fc5d){try{if(this['voiceQueues'][_0x13fc5d[_0x5b15('0x1a')]]&&(this[_0x5b15('0x29')][_0x13fc5d[_0x5b15('0x1a')]]['acw']||this[_0x5b15('0x29')][_0x13fc5d['queue']][_0x5b15('0x3f')])){if(this[_0x5b15('0x6')][_0x13fc5d['interface']]){this[_0x5b15('0x7')][_0x13fc5d['uniqueid']]={'queue':_0x13fc5d[_0x5b15('0x1a')],'interface':_0x13fc5d[_0x5b15('0x3c')]};}}}catch(_0x586369){logger['error'](_0x5b15('0x40'),_0x586369['message']);}};Acw[_0x5b15('0x3e')]['syncHangupRequest']=function(_0x2c1217){try{if(this[_0x5b15('0x7')][_0x2c1217[_0x5b15('0x2f')]]&&_[_0x5b15('0x41')](this[_0x5b15('0x7')][_0x2c1217[_0x5b15('0x2f')]][_0x5b15('0x24')])){logger[_0x5b15('0x22')](_0x5b15('0x42'),_0x2c1217[_0x5b15('0x2f')]);this[_0x5b15('0x19')](_0x2c1217[_0x5b15('0x2f')]);}else if(this[_0x5b15('0x7')][_0x2c1217[_0x5b15('0x43')]]&&_['isUndefined'](this[_0x5b15('0x7')][_0x2c1217['linkedid']]['attended'])){logger['info']('[%s][HANGUP:LINKEDID]',_0x2c1217['linkedid']);this[_0x5b15('0x19')](_0x2c1217[_0x5b15('0x43')]);}}catch(_0x17b92f){logger[_0x5b15('0x33')](_0x5b15('0x44'),_0x17b92f[_0x5b15('0x36')]);}};Acw[_0x5b15('0x3e')]['syncHangup']=function(_0x834112){try{if(this['channels'][_0x834112[_0x5b15('0x2f')]]&&this['channels'][_0x834112[_0x5b15('0x2f')]][_0x5b15('0x24')]){logger[_0x5b15('0x22')](_0x5b15('0x45'),_0x834112[_0x5b15('0x2f')]);this[_0x5b15('0x19')](_0x834112[_0x5b15('0x2f')]);}else if(this[_0x5b15('0x7')][_0x834112['linkedid']]&&this[_0x5b15('0x7')][_0x834112[_0x5b15('0x43')]][_0x5b15('0x24')]){logger['info'](_0x5b15('0x46'),_0x834112['linkedid']);this[_0x5b15('0x19')](_0x834112[_0x5b15('0x43')]);}}catch(_0x591dbc){logger[_0x5b15('0x33')](_0x5b15('0x47'),_0x591dbc[_0x5b15('0x36')]);}};Acw[_0x5b15('0x3e')][_0x5b15('0x12')]=function(_0x1a4dec){try{if(!_[_0x5b15('0x48')](this[_0x5b15('0x7')][_0x1a4dec[_0x5b15('0x49')]])){this['startAcw'](_0x1a4dec['transfereeuniqueid']);if(this[_0x5b15('0x7')][_0x1a4dec[_0x5b15('0x4a')]]){this[_0x5b15('0x7')][_0x1a4dec[_0x5b15('0x4a')]][_0x5b15('0x24')]=!![];this['channels'][_0x1a4dec['transfertargetuniqueid']]=this[_0x5b15('0x7')][_0x1a4dec[_0x5b15('0x4a')]];delete this[_0x5b15('0x7')][_0x1a4dec['secondtransfereruniqueid']];}}else if(!_[_0x5b15('0x48')](this['channels'][_0x1a4dec['transfertargetuniqueid']])){this[_0x5b15('0x19')](_0x1a4dec['transfertargetuniqueid']);if(this[_0x5b15('0x7')][_0x1a4dec['origtransfereruniqueid']]){this[_0x5b15('0x7')][_0x1a4dec[_0x5b15('0x4b')]][_0x5b15('0x24')]=!![];this[_0x5b15('0x7')][_0x1a4dec[_0x5b15('0x49')]]=this[_0x5b15('0x7')][_0x1a4dec[_0x5b15('0x4b')]];delete this[_0x5b15('0x7')][_0x1a4dec[_0x5b15('0x4b')]];}}}catch(_0x10c60c){logger[_0x5b15('0x33')](_0x5b15('0x4c'),_0x10c60c[_0x5b15('0x36')]);}};Acw[_0x5b15('0x3e')][_0x5b15('0x14')]=function(_0x49b162){try{if(this['channels'][_0x49b162[_0x5b15('0x4d')]]){logger[_0x5b15('0x22')](_0x5b15('0x4e'),JSON[_0x5b15('0x3a')](_0x49b162[_0x5b15('0x4d')]));this[_0x5b15('0x19')](_0x49b162[_0x5b15('0x4d')]);}else if(this['channels'][_0x49b162[_0x5b15('0x4f')]]){logger[_0x5b15('0x22')](_0x5b15('0x50'),JSON[_0x5b15('0x3a')](_0x49b162[_0x5b15('0x4f')]));this[_0x5b15('0x19')](_0x49b162[_0x5b15('0x4f')]);}}catch(_0x5190a7){logger['error'](_0x5b15('0x51'),_0x5190a7['message']);}};Acw[_0x5b15('0x3e')][_0x5b15('0x10')]=function(_0x3b3d13){try{if(this[_0x5b15('0x29')][_0x3b3d13[_0x5b15('0x1a')]]&&this[_0x5b15('0x29')][_0x3b3d13[_0x5b15('0x1a')]][_0x5b15('0x52')]===_0x5b15('0x53')){if(this[_0x5b15('0x6')][_0x3b3d13[_0x5b15('0x3c')]]){logger[_0x5b15('0x22')](_0x5b15('0x54'),_0x3b3d13['uniqueid'],_0x3b3d13['interface'],_0x3b3d13['queue']);return RpcUser[_0x5b15('0x26')](this[_0x5b15('0x6')][_0x3b3d13['interface']],_0x5b15('0x55'),_0x3b3d13[_0x5b15('0x2f')]);}}}catch(_0x380396){logger['error'](_0x5b15('0x56'),_0x380396[_0x5b15('0x36')]);}};module[_0x5b15('0x57')]=Acw; \ No newline at end of file +var _0xe19b=['queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','then','getAgent','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','acwTimeout','timer','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','finally','[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','update','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','stringify','[ACW][STOP]\x20%s','acw','interface','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','linkedid','isUndefined','[%s][HANGUP:LINKEDID]','startAcw','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','syncAttendedTransfer','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','[%s][BLINDTRANSFER:UNIQUEID]','transfereruniqueid','transfererlinkedid','autopause','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','moment','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','agentconnect','syncAgentConnect','bind','syncHangupRequest','hangup','syncHangup','syncAgentRingNoAnswer','attendedtransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','channels'];(function(_0xb4901a,_0x391bbe){var _0x36a9ee=function(_0x514836){while(--_0x514836){_0xb4901a['push'](_0xb4901a['shift']());}};_0x36a9ee(++_0x391bbe);}(_0xe19b,0xef));var _0xbe19=function(_0x35db4b,_0xcf68bb){_0x35db4b=_0x35db4b-0x0;var _0x36a649=_0xe19b[_0x35db4b];return _0x36a649;};'use strict';var util=require(_0xbe19('0x0'));var _=require(_0xbe19('0x1'));var moment=require(_0xbe19('0x2'));var ami=require('../ami');var logger=require('../../../config/logger')('acw');var RpcUser=require(_0xbe19('0x3'));var RpcVoiceAgentReport=require(_0xbe19('0x4'));function Acw(_0x4b7a2b){this[_0xbe19('0x5')]=_0x4b7a2b['voiceQueues'];this['agents']=_0x4b7a2b[_0xbe19('0x6')];this[_0xbe19('0x7')]=_0x4b7a2b[_0xbe19('0x7')];this['channels']={};ami['on'](_0xbe19('0x8'),this[_0xbe19('0x9')][_0xbe19('0xa')](this));ami['on']('hanguprequest',this[_0xbe19('0xb')][_0xbe19('0xa')](this));ami['on'](_0xbe19('0xc'),this[_0xbe19('0xd')]['bind'](this));ami['on']('agentringnoanswer',this[_0xbe19('0xe')][_0xbe19('0xa')](this));ami['on'](_0xbe19('0xf'),this['syncAttendedTransfer'][_0xbe19('0xa')](this));ami['on'](_0xbe19('0x10'),this[_0xbe19('0x11')][_0xbe19('0xa')](this));ami['on'](_0xbe19('0x12'),this[_0xbe19('0x13')]['bind'](this));}function getDiff(_0x1cd005){var _0x337755=moment()[_0xbe19('0x14')](0x0);var _0x435042=moment(_0x1cd005)[_0xbe19('0x14')](0x0);return _0x337755[_0xbe19('0x15')](_0x435042,_0xbe19('0x16'));}Acw[_0xbe19('0x17')]['startAcw']=function(_0x5a5dd2){try{var _0x3e7cd7=this;var _0x536ed7=this[_0xbe19('0x18')][_0x5a5dd2]['interface'];var _0x45dac6=this[_0xbe19('0x18')][_0x5a5dd2][_0xbe19('0x19')];var _0xf1caa7=this[_0xbe19('0x5')][_0x45dac6];var _0x2a8af7=![];var _0x589f5a=_0xbe19('0x1a');if(_0xf1caa7[_0xbe19('0x1b')]){if(_0xf1caa7['mandatoryDispositionPause']['name']){_0x2a8af7=!![];_0x589f5a=_0xf1caa7[_0xbe19('0x1c')][_0xbe19('0x1d')];}}ami[_0xbe19('0x1e')]({'action':_0xbe19('0x1f'),'interface':_0x536ed7,'paused':!![],'reason':_0x589f5a})[_0xbe19('0x20')](function(_0x1adf95){if(_0x3e7cd7['agents'][_0x536ed7]){return RpcUser[_0xbe19('0x21')](_0x3e7cd7[_0xbe19('0x6')][_0x536ed7]['id'])[_0xbe19('0x20')](function(_0x3d7af0){if(_0x3d7af0&&!_0x3d7af0[_0xbe19('0x22')]){logger[_0xbe19('0x23')](_0xbe19('0x24'),_0x5a5dd2,_0x536ed7,_0x45dac6);var _0x57119e=_0x3e7cd7[_0xbe19('0x18')][_0x5a5dd2][_0xbe19('0x25')]&&_0x3e7cd7[_0xbe19('0x18')][_0x5a5dd2]['destlinkedid']?_0x3e7cd7[_0xbe19('0x18')][_0x5a5dd2][_0xbe19('0x26')]:_0x5a5dd2;return RpcUser[_0xbe19('0x27')](_0x3e7cd7[_0xbe19('0x6')][_0x536ed7],_0x589f5a,_0x57119e)[_0xbe19('0x20')](function(_0x3fea99){if(!_0x2a8af7){_0x3e7cd7[_0xbe19('0x7')][_0x536ed7]={};logger[_0xbe19('0x23')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x5a5dd2,_0x3e7cd7['voiceQueues'][_0x45dac6][_0xbe19('0x28')],_0x536ed7,_0x45dac6);_0x3e7cd7[_0xbe19('0x7')][_0x536ed7][_0xbe19('0x29')]=setTimeout(_0x3e7cd7[_0xbe19('0x2a')][_0xbe19('0xa')](_0x3e7cd7,_0x536ed7),_0x3e7cd7[_0xbe19('0x5')][_0x45dac6][_0xbe19('0x28')]*0x3e8);_0x3e7cd7[_0xbe19('0x7')][_0x536ed7][_0xbe19('0x2b')]=moment()[_0xbe19('0x2c')](_0xbe19('0x2d'));_0x3e7cd7[_0xbe19('0x7')][_0x536ed7]['uniqueid']=_0x5a5dd2;_0x3e7cd7[_0xbe19('0x7')][_0x536ed7][_0xbe19('0x19')]=_0x45dac6;_0x3e7cd7[_0xbe19('0x7')][_0x536ed7]['updateAcw']=function(){var _0x5bffe6=getDiff(_0x3e7cd7[_0xbe19('0x7')][_0x536ed7][_0xbe19('0x2b')]);clearTimeout(_0x3e7cd7['timers'][_0x536ed7][_0xbe19('0x29')]);_0x3e7cd7[_0xbe19('0x7')][_0x536ed7][_0xbe19('0x29')]=![];RpcVoiceAgentReport['update']({'acwtime':_0x5bffe6},_0x3e7cd7[_0xbe19('0x7')][_0x536ed7][_0xbe19('0x2e')],_0x536ed7)['then'](function(_0x2b8e31){logger[_0xbe19('0x23')](_0xbe19('0x2f'),_0x5a5dd2,_0x5bffe6,_0x2b8e31);})[_0xbe19('0x30')](function(_0x1450b9){logger[_0xbe19('0x31')](_0xbe19('0x32'),_0x5a5dd2,_0x1450b9);});delete _0x3e7cd7[_0xbe19('0x7')][_0x536ed7];};}});}else{logger[_0xbe19('0x23')](_0xbe19('0x33'),_0x5a5dd2,_0x536ed7,_0x45dac6);}});}})[_0xbe19('0x30')](function(_0x10cc5d){logger['error'](_0xbe19('0x34'),_0x5a5dd2,_0x3e7cd7[_0xbe19('0x5')][_0x45dac6][_0xbe19('0x28')],_0x536ed7,_0x45dac6);})[_0xbe19('0x35')](function(){delete _0x3e7cd7[_0xbe19('0x18')][_0x5a5dd2];});}catch(_0x2c198b){logger[_0xbe19('0x31')](_0xbe19('0x36'),_0x2c198b[_0xbe19('0x37')]);}};Acw['prototype']['stopAcw']=function(_0x30324a){try{var _0x360a8d=this;if(_0x360a8d[_0xbe19('0x7')][_0x30324a]){_0x360a8d[_0xbe19('0x7')][_0x30324a][_0xbe19('0x29')]=![];var _0x2f2577=_0x360a8d[_0xbe19('0x7')][_0x30324a][_0xbe19('0x2e')];var _0x1410b2=_0x360a8d['timers'][_0x30324a][_0xbe19('0x19')];var _0x52ab3d=_0x360a8d['voiceQueues'][_0x1410b2]['acwTimeout'];logger[_0xbe19('0x23')](_0xbe19('0x38'),_0x2f2577,_0x30324a);RpcUser['saveUnpause'](this[_0xbe19('0x6')][_0x30324a]);RpcVoiceAgentReport[_0xbe19('0x39')]({'acwtime':_0x52ab3d,'agentacw':!![]},_0x2f2577,_0x30324a)[_0xbe19('0x20')](function(_0x93c138){logger[_0xbe19('0x23')](_0xbe19('0x2f'),_0x2f2577,_0x52ab3d,_0x93c138);})['catch'](function(_0x4b45e6){logger[_0xbe19('0x31')](_0xbe19('0x32'),_0x2f2577,_0x4b45e6);});}else{logger['error'](_0xbe19('0x3a'),_0x30324a);if(_0x360a8d[_0xbe19('0x7')]){logger[_0xbe19('0x23')]('[ACW][TIMERS]',JSON[_0xbe19('0x3b')](_0x360a8d[_0xbe19('0x7')]));}}}catch(_0x263668){logger[_0xbe19('0x31')](_0xbe19('0x3c'),_0x263668[_0xbe19('0x37')]);}};Acw[_0xbe19('0x17')][_0xbe19('0x9')]=function(_0x3f95d0){try{if(this[_0xbe19('0x5')][_0x3f95d0[_0xbe19('0x19')]]&&(this[_0xbe19('0x5')][_0x3f95d0['queue']][_0xbe19('0x3d')]||this[_0xbe19('0x5')][_0x3f95d0[_0xbe19('0x19')]]['mandatoryDisposition'])){if(this[_0xbe19('0x6')][_0x3f95d0[_0xbe19('0x3e')]]){this[_0xbe19('0x18')][_0x3f95d0[_0xbe19('0x2e')]]={'queue':_0x3f95d0[_0xbe19('0x19')],'interface':_0x3f95d0[_0xbe19('0x3e')],'destlinkedid':_0x3f95d0[_0xbe19('0x26')]};}}}catch(_0x399edc){logger[_0xbe19('0x31')](_0xbe19('0x3f'),_0x399edc['message']);}};Acw[_0xbe19('0x17')][_0xbe19('0x13')]=function(_0x49e26a){try{if(this[_0xbe19('0x5')][_0x49e26a[_0xbe19('0x19')]]&&(this[_0xbe19('0x5')][_0x49e26a[_0xbe19('0x19')]]['acw']||this[_0xbe19('0x5')][_0x49e26a[_0xbe19('0x19')]][_0xbe19('0x1b')])){if(this['agents'][_0x49e26a['interface']]){this[_0xbe19('0x18')][_0x49e26a[_0xbe19('0x2e')]]={'queue':_0x49e26a['queue'],'interface':_0x49e26a['interface']};}}}catch(_0x493d9b){logger[_0xbe19('0x31')](_0xbe19('0x40'),_0x493d9b['message']);}};Acw[_0xbe19('0x17')][_0xbe19('0xb')]=function(_0x32ae15){try{if(this[_0xbe19('0x18')][_0x32ae15[_0xbe19('0x2e')]]&&_['isUndefined'](this['channels'][_0x32ae15[_0xbe19('0x2e')]]['attended'])){logger[_0xbe19('0x23')]('[%s][HANGUP:UNIQUEID]',_0x32ae15[_0xbe19('0x2e')]);this['startAcw'](_0x32ae15[_0xbe19('0x2e')]);}else if(this[_0xbe19('0x18')][_0x32ae15[_0xbe19('0x41')]]&&_[_0xbe19('0x42')](this[_0xbe19('0x18')][_0x32ae15[_0xbe19('0x41')]][_0xbe19('0x25')])){logger[_0xbe19('0x23')](_0xbe19('0x43'),_0x32ae15[_0xbe19('0x41')]);this[_0xbe19('0x44')](_0x32ae15[_0xbe19('0x41')]);}}catch(_0x3a884a){logger[_0xbe19('0x31')](_0xbe19('0x45'),_0x3a884a['message']);}};Acw['prototype'][_0xbe19('0xd')]=function(_0x66cc8b){try{if(this[_0xbe19('0x18')][_0x66cc8b[_0xbe19('0x2e')]]&&this[_0xbe19('0x18')][_0x66cc8b['uniqueid']][_0xbe19('0x25')]){logger[_0xbe19('0x23')](_0xbe19('0x46'),_0x66cc8b[_0xbe19('0x2e')]);this[_0xbe19('0x44')](_0x66cc8b[_0xbe19('0x2e')]);}else if(this[_0xbe19('0x18')][_0x66cc8b[_0xbe19('0x41')]]&&this[_0xbe19('0x18')][_0x66cc8b['linkedid']][_0xbe19('0x25')]){logger[_0xbe19('0x23')](_0xbe19('0x47'),_0x66cc8b[_0xbe19('0x41')]);this[_0xbe19('0x44')](_0x66cc8b['linkedid']);}}catch(_0x36e182){logger[_0xbe19('0x31')](_0xbe19('0x48'),_0x36e182[_0xbe19('0x37')]);}};Acw[_0xbe19('0x17')][_0xbe19('0x49')]=function(_0x5a6193){try{if(!_[_0xbe19('0x4a')](this[_0xbe19('0x18')][_0x5a6193[_0xbe19('0x4b')]])){this['startAcw'](_0x5a6193[_0xbe19('0x4b')]);if(this['channels'][_0x5a6193[_0xbe19('0x4c')]]){this[_0xbe19('0x18')][_0x5a6193[_0xbe19('0x4c')]]['attended']=!![];this[_0xbe19('0x18')][_0x5a6193['transfertargetuniqueid']]=this[_0xbe19('0x18')][_0x5a6193[_0xbe19('0x4c')]];delete this[_0xbe19('0x18')][_0x5a6193[_0xbe19('0x4c')]];}}else if(!_[_0xbe19('0x4a')](this[_0xbe19('0x18')][_0x5a6193[_0xbe19('0x4d')]])){this[_0xbe19('0x44')](_0x5a6193['transfertargetuniqueid']);if(this[_0xbe19('0x18')][_0x5a6193[_0xbe19('0x4e')]]){this[_0xbe19('0x18')][_0x5a6193['origtransfereruniqueid']][_0xbe19('0x25')]=!![];this[_0xbe19('0x18')][_0x5a6193['transfereeuniqueid']]=this[_0xbe19('0x18')][_0x5a6193[_0xbe19('0x4e')]];delete this[_0xbe19('0x18')][_0x5a6193[_0xbe19('0x4e')]];}}}catch(_0x388d55){logger[_0xbe19('0x31')](_0xbe19('0x4f'),_0x388d55[_0xbe19('0x37')]);}};Acw[_0xbe19('0x17')][_0xbe19('0x11')]=function(_0x44ae21){try{if(this['channels'][_0x44ae21['transfereruniqueid']]){logger['info'](_0xbe19('0x50'),JSON[_0xbe19('0x3b')](_0x44ae21[_0xbe19('0x51')]));this[_0xbe19('0x44')](_0x44ae21[_0xbe19('0x51')]);}else if(this[_0xbe19('0x18')][_0x44ae21[_0xbe19('0x52')]]){logger['info']('[%s][BLINDTRANSFER:LINKEDID]',JSON[_0xbe19('0x3b')](_0x44ae21[_0xbe19('0x52')]));this[_0xbe19('0x44')](_0x44ae21[_0xbe19('0x52')]);}}catch(_0x5d6ad6){logger[_0xbe19('0x31')]('[ACW][syncBlindTransfer]\x20%s',_0x5d6ad6[_0xbe19('0x37')]);}};Acw[_0xbe19('0x17')][_0xbe19('0xe')]=function(_0x316d1d){try{if(this['voiceQueues'][_0x316d1d['queue']]&&this[_0xbe19('0x5')][_0x316d1d[_0xbe19('0x19')]][_0xbe19('0x53')]==='all'){if(this['agents'][_0x316d1d[_0xbe19('0x3e')]]){logger[_0xbe19('0x23')](_0xbe19('0x54'),_0x316d1d['uniqueid'],_0x316d1d['interface'],_0x316d1d[_0xbe19('0x19')]);return RpcUser[_0xbe19('0x27')](this[_0xbe19('0x6')][_0x316d1d[_0xbe19('0x3e')]],_0xbe19('0x55'),_0x316d1d[_0xbe19('0x2e')]);}}}catch(_0x14ccf7){logger['error'](_0xbe19('0x56'),_0x14ccf7[_0xbe19('0x37')]);}};module[_0xbe19('0x57')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 6fa4018..860ae29 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 _0xd8b0=['actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','[ami.js][fullybooted]','exports','asterisk-manager','bluebird','../../config/logger','ami','../../config/environment','asterisk','port','username','password','Action','promisify','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus'];(function(_0x107661,_0x40ba27){var _0x6db223=function(_0x932ce7){while(--_0x932ce7){_0x107661['push'](_0x107661['shift']());}};_0x6db223(++_0x40ba27);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Manager=require(_0x0d8b('0x0'));var BPromise=require(_0x0d8b('0x1'));var moment=require('moment');var util=require('util');var _=require('lodash');var logger=require(_0x0d8b('0x2'))(_0x0d8b('0x3'));var config=require(_0x0d8b('0x4'));var ami=new Manager(config[_0x0d8b('0x5')][_0x0d8b('0x6')],config['asterisk']['ip'],config['asterisk'][_0x0d8b('0x7')],config[_0x0d8b('0x5')][_0x0d8b('0x8')],!![]);ami['keepConnected']();ami[_0x0d8b('0x9')]=BPromise[_0x0d8b('0xa')](ami['action']);function error(_0x129310){logger[_0x0d8b('0xb')](util[_0x0d8b('0xc')](_0x0d8b('0xd'),config[_0x0d8b('0x5')][_0x0d8b('0x7')],config[_0x0d8b('0x5')]['ip'],config[_0x0d8b('0x5')]['port'],util[_0x0d8b('0xe')](_0x129310,![],null)));}function close(){logger['error'](util[_0x0d8b('0xc')](_0x0d8b('0xf'),config[_0x0d8b('0x5')][_0x0d8b('0x7')],config[_0x0d8b('0x5')]['ip'],config[_0x0d8b('0x5')][_0x0d8b('0x6')]));}ami[_0x0d8b('0x10')]=function(){return function(){return ami[_0x0d8b('0x9')]({'action':_0x0d8b('0x11')});};};ami[_0x0d8b('0x12')]=function(){return function(){return ami[_0x0d8b('0x9')]({'action':_0x0d8b('0x13')});};};ami[_0x0d8b('0x14')]=function(){return function(){return ami['Action']({'action':_0x0d8b('0x15')});};};ami[_0x0d8b('0x16')]=function(){return function(){return ami[_0x0d8b('0x9')]({'action':_0x0d8b('0x17')});};};ami[_0x0d8b('0x18')]=function(){return function(){return ami['Action']({'action':_0x0d8b('0x19')});};};function connect(_0x4586c2){logger[_0x0d8b('0x1a')](util[_0x0d8b('0xc')](_0x0d8b('0x1b'),config[_0x0d8b('0x5')][_0x0d8b('0x7')],config[_0x0d8b('0x5')]['ip'],config['asterisk'][_0x0d8b('0x6')]));ami[_0x0d8b('0x1c')](_0x0d8b('0xb'),error);ami[_0x0d8b('0x1c')](_0x0d8b('0x1d'),close);}ami['on'](_0x0d8b('0x1e'),connect);ami['on'](_0x0d8b('0x1f'),function(_0x352c17){logger['info'](util['format'](_0x0d8b('0x20'),config['asterisk']['username'],config['asterisk']['ip'],config[_0x0d8b('0x5')][_0x0d8b('0x6')],util[_0x0d8b('0xe')](_0x352c17,![],null)));});ami['on'](_0x0d8b('0x21'),function(_0x221071){logger[_0x0d8b('0x1a')](util[_0x0d8b('0xc')](_0x0d8b('0x22'),config[_0x0d8b('0x5')]['username'],config[_0x0d8b('0x5')]['ip'],config[_0x0d8b('0x5')]['port']));return BPromise[_0x0d8b('0x23')]()['then'](ami[_0x0d8b('0x10')]())[_0x0d8b('0x24')](ami[_0x0d8b('0x12')]())['then'](ami['actionSipPeerStatus']())[_0x0d8b('0x24')](ami[_0x0d8b('0x16')]())['then'](ami[_0x0d8b('0x18')]())['catch'](function(_0x1b2b59){logger['error'](_0x0d8b('0x25'),util['inspect'](_0x1b2b59,{'showHidden':![],'depth':null}));});});ami[_0x0d8b('0x1c')]('error',error);ami[_0x0d8b('0x1c')]('close',close);module[_0x0d8b('0x26')]=ami; \ No newline at end of file +var _0xbaf0=['once','close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','then','actionSipShowRegistry','catch','[ami.js][fullybooted]','exports','bluebird','moment','util','lodash','../../config/logger','ami','asterisk','port','username','password','keepConnected','Action','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s'];(function(_0x24e3cf,_0x3f5c23){var _0x52dde0=function(_0x5be91a){while(--_0x5be91a){_0x24e3cf['push'](_0x24e3cf['shift']());}};_0x52dde0(++_0x3f5c23);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xbaf0[_0x6131cd];return _0x47e916;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0x0baf('0x0'));var moment=require(_0x0baf('0x1'));var util=require(_0x0baf('0x2'));var _=require(_0x0baf('0x3'));var logger=require(_0x0baf('0x4'))(_0x0baf('0x5'));var config=require('../../config/environment');var ami=new Manager(config[_0x0baf('0x6')][_0x0baf('0x7')],config[_0x0baf('0x6')]['ip'],config[_0x0baf('0x6')][_0x0baf('0x8')],config[_0x0baf('0x6')][_0x0baf('0x9')],!![]);ami[_0x0baf('0xa')]();ami[_0x0baf('0xb')]=BPromise['promisify'](ami[_0x0baf('0xc')]);function error(_0x5f20aa){logger[_0x0baf('0xd')](util[_0x0baf('0xe')](_0x0baf('0xf'),config[_0x0baf('0x6')][_0x0baf('0x8')],config[_0x0baf('0x6')]['ip'],config[_0x0baf('0x6')][_0x0baf('0x7')],util[_0x0baf('0x10')](_0x5f20aa,![],null)));}function close(){logger[_0x0baf('0xd')](util[_0x0baf('0xe')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config['asterisk'][_0x0baf('0x8')],config[_0x0baf('0x6')]['ip'],config[_0x0baf('0x6')][_0x0baf('0x7')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0x0baf('0xb')]({'action':'sipshowregistry'});};};ami[_0x0baf('0x11')]=function(){return function(){return ami[_0x0baf('0xb')]({'action':_0x0baf('0x12')});};};ami[_0x0baf('0x13')]=function(){return function(){return ami[_0x0baf('0xb')]({'action':_0x0baf('0x14')});};};ami['actionQueueSummary']=function(){return function(){return ami['Action']({'action':_0x0baf('0x15')});};};ami[_0x0baf('0x16')]=function(){return function(){return ami[_0x0baf('0xb')]({'action':_0x0baf('0x17')});};};function connect(_0x2cf7da){logger[_0x0baf('0x18')](util['format'](_0x0baf('0x19'),config[_0x0baf('0x6')][_0x0baf('0x8')],config[_0x0baf('0x6')]['ip'],config[_0x0baf('0x6')][_0x0baf('0x7')]));ami['once']('error',error);ami[_0x0baf('0x1a')](_0x0baf('0x1b'),close);}ami['on'](_0x0baf('0x1c'),connect);ami['on'](_0x0baf('0x1d'),function(_0x1fa92b){logger[_0x0baf('0x18')](util[_0x0baf('0xe')](_0x0baf('0x1e'),config[_0x0baf('0x6')][_0x0baf('0x8')],config['asterisk']['ip'],config[_0x0baf('0x6')]['port'],util[_0x0baf('0x10')](_0x1fa92b,![],null)));});ami['on']('fullybooted',function(_0x4de74c){logger[_0x0baf('0x18')](util['format']('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0x0baf('0x6')][_0x0baf('0x8')],config[_0x0baf('0x6')]['ip'],config[_0x0baf('0x6')][_0x0baf('0x7')]));return BPromise['resolve']()[_0x0baf('0x1f')](ami[_0x0baf('0x20')]())[_0x0baf('0x1f')](ami[_0x0baf('0x11')]())[_0x0baf('0x1f')](ami[_0x0baf('0x13')]())[_0x0baf('0x1f')](ami['actionQueueSummary']())[_0x0baf('0x1f')](ami[_0x0baf('0x16')]())[_0x0baf('0x21')](function(_0x265915){logger['error'](_0x0baf('0x22'),util[_0x0baf('0x10')](_0x265915,{'showHidden':![],'depth':null}));});});ami['once'](_0x0baf('0xd'),error);ami[_0x0baf('0x1a')](_0x0baf('0x1b'),close);module[_0x0baf('0x23')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 4fda060..e7b319a 100644 --- a/server/services/ami/client.js +++ b/server/services/ami/client.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['result','catch','exports','jayson/promise','bluebird','../../config/logger','http','request','debug','rpc','error','message'];(function(_0x594de8,_0x46d0d2){var _0x5fcbf=function(_0x48c215){while(--_0x48c215){_0x594de8['push'](_0x594de8['shift']());}};_0x5fcbf(++_0x46d0d2);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('ami');var client=jayson['client'][_0x0a9e('0x3')]({'port':0x2329});client['Request']=function(_0x333808,_0x432180){return new BPromise(function(_0x2ab90b,_0x991246){return client[_0x0a9e('0x4')](_0x333808,_0x432180)['then'](function(_0x219af0){logger[_0x0a9e('0x5')](_0x0a9e('0x6'),'memberReport',_0x333808,_0x432180,_0x219af0);if(_0x219af0['error']){logger[_0x0a9e('0x7')]('rpc','memberReport',_0x333808,_0x219af0[_0x0a9e('0x7')][_0x0a9e('0x8')],_0x432180);return _0x991246(_0x219af0[_0x0a9e('0x7')][_0x0a9e('0x8')]);}else{return _0x2ab90b(_0x219af0[_0x0a9e('0x9')]);}})[_0x0a9e('0xa')](function(_0x4a4c56){logger['error']('rpc','memberReport',_0x333808,_0x4a4c56,_0x432180);return _0x991246(_0x4a4c56);});});};module[_0x0a9e('0xb')]=client; \ No newline at end of file +var _0x9bde=['message','result','catch','exports','bluebird','ami','http','Request','request','debug','rpc','memberReport','error'];(function(_0x4849f6,_0x104836){var _0x1a3dcd=function(_0x494d3c){while(--_0x494d3c){_0x4849f6['push'](_0x4849f6['shift']());}};_0x1a3dcd(++_0x104836);}(_0x9bde,0xe1));var _0xe9bd=function(_0x1d06eb,_0x4c92e2){_0x1d06eb=_0x1d06eb-0x0;var _0xe20f5b=_0x9bde[_0x1d06eb];return _0xe20f5b;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xe9bd('0x0'));var logger=require('../../config/logger')(_0xe9bd('0x1'));var client=jayson['client'][_0xe9bd('0x2')]({'port':0x2329});client[_0xe9bd('0x3')]=function(_0x131f6a,_0x1c1b34){return new BPromise(function(_0x10822d,_0x1a4d14){return client[_0xe9bd('0x4')](_0x131f6a,_0x1c1b34)['then'](function(_0x4763e9){logger[_0xe9bd('0x5')](_0xe9bd('0x6'),_0xe9bd('0x7'),_0x131f6a,_0x1c1b34,_0x4763e9);if(_0x4763e9[_0xe9bd('0x8')]){logger[_0xe9bd('0x8')](_0xe9bd('0x6'),_0xe9bd('0x7'),_0x131f6a,_0x4763e9[_0xe9bd('0x8')][_0xe9bd('0x9')],_0x1c1b34);return _0x1a4d14(_0x4763e9['error']['message']);}else{return _0x10822d(_0x4763e9[_0xe9bd('0xa')]);}})[_0xe9bd('0xb')](function(_0x2601ac){logger['error'](_0xe9bd('0x6'),_0xe9bd('0x7'),_0x131f6a,_0x2601ac,_0x1c1b34);return _0x1a4d14(_0x2601ac);});});};module[_0xe9bd('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 637e510..d92f3d9 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 _0x2460=['scheduledat','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','callback','callbackuniqueid','callbackat','recallme','originatecalleridname','prototype','getCaller','format','\x22%s\x22\x20<%s>','voiceQueue','dialCutDigit','substring','exports','util','lodash','moment','isNil','string','uniqueid','name','Contact','phone','firstName','lastName','number','queue','active','type','dialQueueTimeout'];(function(_0x53480f,_0x16516e){var _0x20032a=function(_0x3eca52){while(--_0x3eca52){_0x53480f['push'](_0x53480f['shift']());}};_0x20032a(++_0x16516e);}(_0x2460,0x12b));var _0x0246=function(_0x270b72,_0x129a7a){_0x270b72=_0x270b72-0x0;var _0x2e09ca=_0x2460[_0x270b72];return _0x2e09ca;};'use strict';var util=require(_0x0246('0x0'));var _=require(_0x0246('0x1'));var moment=require(_0x0246('0x2'));function checkNameSurname(_0xb53050,_0x35a7fe,_0xfadbaa){var _0x1b9f71='';if(!_[_0x0246('0x3')](_0x35a7fe)&&'string'===typeof _0x35a7fe){_0x1b9f71+=_0x35a7fe;}if(!_[_0x0246('0x3')](_0xfadbaa)&&_0x0246('0x4')===typeof _0xfadbaa){_0x1b9f71+='\x20'+_0xfadbaa;}if(_0x1b9f71!==''){return _0x1b9f71;}return _0xb53050;}function Action(_0x27441f,_0x7b6c13,_0x4d34c1){this['voiceQueue']=_0x27441f;this[_0x0246('0x5')]=_0x4d34c1||undefined;this[_0x0246('0x6')]=checkNameSurname(_0x7b6c13[_0x0246('0x7')][_0x0246('0x8')],_0x7b6c13[_0x0246('0x7')][_0x0246('0x9')],_0x7b6c13[_0x0246('0x7')][_0x0246('0xa')]);this[_0x0246('0xb')]=_0x7b6c13['Contact'][_0x0246('0x8')];this[_0x0246('0xc')]=_0x27441f[_0x0246('0x6')];this[_0x0246('0xd')]=_0x7b6c13[_0x0246('0xd')]||![];this[_0x0246('0xe')]=_0x27441f[_0x0246('0xe')];this[_0x0246('0xf')]=_0x27441f['dialQueueTimeout']||0x3;this[_0x0246('0x10')]=_0x7b6c13[_0x0246('0x10')];this['countbusyretry']=_0x7b6c13['countbusyretry'];this[_0x0246('0x11')]=_0x7b6c13[_0x0246('0x11')];this[_0x0246('0x12')]=_0x7b6c13[_0x0246('0x12')];this[_0x0246('0x13')]=_0x7b6c13['countnosuchnumberretry'];this[_0x0246('0x14')]=_0x7b6c13[_0x0246('0x14')];this[_0x0246('0x15')]=_0x7b6c13['countabandonedretry'];this[_0x0246('0x16')]=_0x7b6c13[_0x0246('0x16')];this[_0x0246('0x17')]=_0x7b6c13['countagentrejectretry'];this[_0x0246('0x18')]=_0x7b6c13[_0x0246('0x18')];this['ListId']=_0x7b6c13[_0x0246('0x19')];this['UserId']=_0x7b6c13[_0x0246('0x1a')];this[_0x0246('0x1b')]=_0x7b6c13[_0x0246('0x1b')];this[_0x0246('0x1c')]=_0x7b6c13['CampaignId'];this[_0x0246('0x1d')]=_0x7b6c13['id'];this[_0x0246('0x1e')]=_0x7b6c13['Contact'][_0x0246('0x9')]||'';this[_0x0246('0x1f')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this['callback']=_0x7b6c13[_0x0246('0x20')];this['callbackuniqueid']=_0x7b6c13[_0x0246('0x21')];this[_0x0246('0x22')]=_0x7b6c13[_0x0246('0x22')];this['recallme']=_0x7b6c13[_0x0246('0x23')];this['originatecalleridnum']='';this[_0x0246('0x24')]='';}Action[_0x0246('0x25')][_0x0246('0x26')]=function(){return util[_0x0246('0x27')](_0x0246('0x28'),this[_0x0246('0x6')],this[_0x0246('0x29')][_0x0246('0x2a')]>0x0?this[_0x0246('0xb')][_0x0246('0x2b')](this['voiceQueue'][_0x0246('0x2a')]):this[_0x0246('0xb')]);};Action[_0x0246('0x25')]['getQueue']=function(){return this['queue'];};module[_0x0246('0x2c')]=Action; \ No newline at end of file +var _0x9dac=['isNil','string','voiceQueue','uniqueid','name','Contact','phone','firstName','lastName','number','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','getQueue','queue','exports','util','lodash','moment'];(function(_0x2673bb,_0x292576){var _0x3edc1c=function(_0x210d91){while(--_0x210d91){_0x2673bb['push'](_0x2673bb['shift']());}};_0x3edc1c(++_0x292576);}(_0x9dac,0x1a4));var _0xc9da=function(_0x2c9178,_0x55765e){_0x2c9178=_0x2c9178-0x0;var _0x3b8b6f=_0x9dac[_0x2c9178];return _0x3b8b6f;};'use strict';var util=require(_0xc9da('0x0'));var _=require(_0xc9da('0x1'));var moment=require(_0xc9da('0x2'));function checkNameSurname(_0x25078d,_0xf62148,_0x3cb1c5){var _0x403000='';if(!_[_0xc9da('0x3')](_0xf62148)&&_0xc9da('0x4')===typeof _0xf62148){_0x403000+=_0xf62148;}if(!_[_0xc9da('0x3')](_0x3cb1c5)&&'string'===typeof _0x3cb1c5){_0x403000+='\x20'+_0x3cb1c5;}if(_0x403000!==''){return _0x403000;}return _0x25078d;}function Action(_0x467f1c,_0x997a0e,_0x4f172c){this[_0xc9da('0x5')]=_0x467f1c;this[_0xc9da('0x6')]=_0x4f172c||undefined;this[_0xc9da('0x7')]=checkNameSurname(_0x997a0e[_0xc9da('0x8')][_0xc9da('0x9')],_0x997a0e[_0xc9da('0x8')][_0xc9da('0xa')],_0x997a0e[_0xc9da('0x8')][_0xc9da('0xb')]);this[_0xc9da('0xc')]=_0x997a0e[_0xc9da('0x8')]['phone'];this['queue']=_0x467f1c[_0xc9da('0x7')];this['active']=_0x997a0e['active']||![];this[_0xc9da('0xd')]=_0x467f1c[_0xc9da('0xd')];this[_0xc9da('0xe')]=_0x467f1c[_0xc9da('0xe')]||0x3;this[_0xc9da('0xf')]=_0x997a0e[_0xc9da('0xf')];this[_0xc9da('0x10')]=_0x997a0e[_0xc9da('0x10')];this[_0xc9da('0x11')]=_0x997a0e['countcongestionretry'];this['countnoanswerretry']=_0x997a0e[_0xc9da('0x12')];this['countnosuchnumberretry']=_0x997a0e[_0xc9da('0x13')];this[_0xc9da('0x14')]=_0x997a0e[_0xc9da('0x14')];this[_0xc9da('0x15')]=_0x997a0e[_0xc9da('0x15')];this[_0xc9da('0x16')]=_0x997a0e['countmachineretry'];this[_0xc9da('0x17')]=_0x997a0e[_0xc9da('0x17')];this[_0xc9da('0x18')]=_0x997a0e[_0xc9da('0x18')];this[_0xc9da('0x19')]=_0x997a0e[_0xc9da('0x19')];this[_0xc9da('0x1a')]=_0x997a0e[_0xc9da('0x1a')];this['VoiceQueueId']=_0x997a0e[_0xc9da('0x1b')];this['CampaignId']=_0x997a0e[_0xc9da('0x1c')];this[_0xc9da('0x1d')]=_0x997a0e['id'];this[_0xc9da('0x1e')]=_0x997a0e['Contact'][_0xc9da('0xa')]||'';this[_0xc9da('0x1f')]=moment()[_0xc9da('0x20')](_0xc9da('0x21'));this['callback']=_0x997a0e[_0xc9da('0x22')];this['callbackuniqueid']=_0x997a0e[_0xc9da('0x23')];this[_0xc9da('0x24')]=_0x997a0e[_0xc9da('0x24')];this[_0xc9da('0x25')]=_0x997a0e[_0xc9da('0x25')];this[_0xc9da('0x26')]='';this[_0xc9da('0x27')]='';}Action[_0xc9da('0x28')][_0xc9da('0x29')]=function(){return util['format'](_0xc9da('0x2a'),this['name'],this[_0xc9da('0x5')]['dialCutDigit']>0x0?this[_0xc9da('0xc')]['substring'](this[_0xc9da('0x5')][_0xc9da('0x2b')]):this[_0xc9da('0xc')]);};Action[_0xc9da('0x28')][_0xc9da('0x2c')]=function(){return this[_0xc9da('0x2d')];};module[_0xc9da('0x2e')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index 4e34f26..db64ef6 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 _0x8e8a=['number','starttime','responsetime','answertime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','membername','reason','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','diff','seconds','state','statedesc','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','uniqueid','calleridname','name','calleridnum'];(function(_0x254abd,_0x1ab7f0){var _0x31bf1b=function(_0x447fd8){while(--_0x447fd8){_0x254abd['push'](_0x254abd['shift']());}};_0x31bf1b(++_0x1ab7f0);}(_0x8e8a,0x9d));var _0xa8e8=function(_0x2443a8,_0x4500a4){_0x2443a8=_0x2443a8-0x0;var _0x538bdc=_0x8e8a[_0x2443a8];return _0x538bdc;};'use strict';var util=require('util');var _=require(_0xa8e8('0x0'));var moment=require(_0xa8e8('0x1'));function getSeconds(_0x5632da,_0x4768af){var _0x31d08f=moment(_0x5632da)[_0xa8e8('0x2')](0x0);var _0x1f797e=moment(_0x4768af)[_0xa8e8('0x2')](0x0);return _0x31d08f[_0xa8e8('0x3')](_0x1f797e,_0xa8e8('0x4'));}function AgentComplete(_0x61439d,_0x4e742c){this[_0xa8e8('0x5')]=0x4;this[_0xa8e8('0x6')]='Answer';this[_0xa8e8('0x7')]=_0x61439d[_0xa8e8('0x7')];this[_0xa8e8('0x8')]=_0x61439d[_0xa8e8('0x8')];this['campaigntype']=_0x61439d['type']===_0xa8e8('0x9')?_0xa8e8('0xa'):_0x61439d[_0xa8e8('0x8')];this[_0xa8e8('0xb')]=_0x61439d[_0xa8e8('0xb')];this[_0xa8e8('0xc')]=_0x61439d[_0xa8e8('0xc')];this[_0xa8e8('0xd')]=_0x61439d[_0xa8e8('0xd')];this['countglobal']=_0x61439d[_0xa8e8('0xb')]+_0x61439d[_0xa8e8('0xc')]+_0x61439d[_0xa8e8('0xd')]+_0x61439d[_0xa8e8('0xe')]+_0x61439d['countdropretry']+_0x61439d[_0xa8e8('0xf')]+_0x61439d[_0xa8e8('0x10')]+_0x61439d[_0xa8e8('0x11')];this[_0xa8e8('0xe')]=_0x61439d[_0xa8e8('0xe')];this[_0xa8e8('0x12')]=_0x61439d[_0xa8e8('0x12')];this[_0xa8e8('0xf')]=_0x61439d[_0xa8e8('0xf')];this[_0xa8e8('0x10')]=_0x61439d[_0xa8e8('0x10')];this[_0xa8e8('0x11')]=_0x61439d[_0xa8e8('0x11')];this['uniqueid']=_0x4e742c[_0xa8e8('0x13')];this[_0xa8e8('0x14')]=_0x61439d[_0xa8e8('0x15')];this[_0xa8e8('0x16')]=_0x61439d[_0xa8e8('0x17')];this[_0xa8e8('0x18')]=_0x61439d[_0xa8e8('0x18')];this[_0xa8e8('0x19')]=_0x61439d[_0xa8e8('0x19')];this[_0xa8e8('0x1a')]=_0x61439d[_0xa8e8('0x1a')];this['endtime']=moment()[_0xa8e8('0x1b')](_0xa8e8('0x1c'));this[_0xa8e8('0x1d')]=getSeconds(_0x61439d[_0xa8e8('0x19')],_0x61439d[_0xa8e8('0x18')]);this[_0xa8e8('0x1e')]=getSeconds(_0x61439d[_0xa8e8('0x1a')],_0x61439d[_0xa8e8('0x19')]);this[_0xa8e8('0x1f')]=getSeconds(this['endtime'],_0x61439d['answertime']);this[_0xa8e8('0xa')]=_0x4e742c[_0xa8e8('0xa')];this[_0xa8e8('0x20')]=_0x4e742c['membername'];this[_0xa8e8('0x21')]=_0x4e742c[_0xa8e8('0x21')];this['callback']=_0x61439d['callback'];this['callbackuniqueid']=_0x61439d[_0xa8e8('0x22')];this[_0xa8e8('0x23')]=_0x61439d[_0xa8e8('0x23')];this[_0xa8e8('0x24')]=_0x61439d[_0xa8e8('0x24')];this[_0xa8e8('0x25')]=_0x61439d[_0xa8e8('0x25')];this[_0xa8e8('0x26')]=_0x61439d['ListId'];this[_0xa8e8('0x27')]=_0x61439d[_0xa8e8('0x27')];this[_0xa8e8('0x28')]=_0x61439d[_0xa8e8('0x28')];this[_0xa8e8('0x29')]=_0x61439d[_0xa8e8('0x29')];this[_0xa8e8('0x2a')]=_0x61439d[_0xa8e8('0x2a')]||'';this['originatecalleridname']=_0x61439d[_0xa8e8('0x2b')]||'';}module[_0xa8e8('0x2c')]=AgentComplete; \ No newline at end of file +var _0xc0cc=['uniqueid','name','starttime','responsetime','answertime','format','ringtime','talktime','endtime','membername','reason','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','lodash','moment','milliseconds','diff','seconds','state','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countmachineretry','countagentrejectretry','countdropretry','countabandonedretry'];(function(_0x2041f7,_0x49509d){var _0x3fbc1b=function(_0x34c3a4){while(--_0x34c3a4){_0x2041f7['push'](_0x2041f7['shift']());}};_0x3fbc1b(++_0x49509d);}(_0xc0cc,0x65));var _0xcc0c=function(_0x108f25,_0x7783e2){_0x108f25=_0x108f25-0x0;var _0x329412=_0xc0cc[_0x108f25];return _0x329412;};'use strict';var util=require('util');var _=require(_0xcc0c('0x0'));var moment=require(_0xcc0c('0x1'));function getSeconds(_0x4ff483,_0x1a03f5){var _0x42d5fa=moment(_0x4ff483)[_0xcc0c('0x2')](0x0);var _0x51ae96=moment(_0x1a03f5)[_0xcc0c('0x2')](0x0);return _0x42d5fa[_0xcc0c('0x3')](_0x51ae96,_0xcc0c('0x4'));}function AgentComplete(_0x372829,_0x4d27f2){this[_0xcc0c('0x5')]=0x4;this['statedesc']='Answer';this[_0xcc0c('0x6')]=_0x372829[_0xcc0c('0x6')];this[_0xcc0c('0x7')]=_0x372829[_0xcc0c('0x7')];this[_0xcc0c('0x8')]=_0x372829[_0xcc0c('0x7')]==='outbound'?_0xcc0c('0x9'):_0x372829[_0xcc0c('0x7')];this[_0xcc0c('0xa')]=_0x372829[_0xcc0c('0xa')];this[_0xcc0c('0xb')]=_0x372829['countcongestionretry'];this[_0xcc0c('0xc')]=_0x372829['countnoanswerretry'];this[_0xcc0c('0xd')]=_0x372829[_0xcc0c('0xa')]+_0x372829[_0xcc0c('0xb')]+_0x372829['countnoanswerretry']+_0x372829[_0xcc0c('0xe')]+_0x372829['countdropretry']+_0x372829['countabandonedretry']+_0x372829[_0xcc0c('0xf')]+_0x372829[_0xcc0c('0x10')];this[_0xcc0c('0xe')]=_0x372829[_0xcc0c('0xe')];this[_0xcc0c('0x11')]=_0x372829[_0xcc0c('0x11')];this[_0xcc0c('0x12')]=_0x372829[_0xcc0c('0x12')];this[_0xcc0c('0xf')]=_0x372829[_0xcc0c('0xf')];this[_0xcc0c('0x10')]=_0x372829['countagentrejectretry'];this['uniqueid']=_0x4d27f2[_0xcc0c('0x13')];this['calleridname']=_0x372829[_0xcc0c('0x14')];this['calleridnum']=_0x372829['number'];this[_0xcc0c('0x15')]=_0x372829['starttime'];this[_0xcc0c('0x16')]=_0x372829[_0xcc0c('0x16')];this[_0xcc0c('0x17')]=_0x372829['answertime'];this['endtime']=moment()[_0xcc0c('0x18')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xcc0c('0x19')]=getSeconds(_0x372829[_0xcc0c('0x16')],_0x372829[_0xcc0c('0x15')]);this['holdtime']=getSeconds(_0x372829[_0xcc0c('0x17')],_0x372829['responsetime']);this[_0xcc0c('0x1a')]=getSeconds(this[_0xcc0c('0x1b')],_0x372829[_0xcc0c('0x17')]);this[_0xcc0c('0x9')]=_0x4d27f2['queue'];this[_0xcc0c('0x1c')]=_0x4d27f2[_0xcc0c('0x1c')];this['reason']=_0x4d27f2[_0xcc0c('0x1d')];this[_0xcc0c('0x1e')]=_0x372829[_0xcc0c('0x1e')];this[_0xcc0c('0x1f')]=_0x372829[_0xcc0c('0x1f')];this[_0xcc0c('0x20')]=_0x372829[_0xcc0c('0x20')];this['recallme']=_0x372829['recallme'];this[_0xcc0c('0x21')]=_0x372829['ContactId'];this['ListId']=_0x372829[_0xcc0c('0x22')];this[_0xcc0c('0x23')]=_0x372829[_0xcc0c('0x23')];this[_0xcc0c('0x24')]=_0x372829[_0xcc0c('0x24')];this[_0xcc0c('0x25')]=_0x372829[_0xcc0c('0x25')];this['originatecalleridnum']=_0x372829[_0xcc0c('0x26')]||'';this[_0xcc0c('0x27')]=_0x372829[_0xcc0c('0x27')]||'';}module['exports']=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index 29b1fc8..421ffe8 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 _0x8ece=['UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','queue','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x8ece,0x195));var _0xe8ec=function(_0x268319,_0x53fc42){_0x268319=_0x268319-0x0;var _0x1f9479=_0x8ece[_0x268319];return _0x1f9479;};'use strict';var util=require(_0xe8ec('0x0'));var _=require(_0xe8ec('0x1'));var moment=require(_0xe8ec('0x2'));function getSeconds(_0x309040,_0x4dd5dd){var _0x47b1c1=moment(_0x309040)[_0xe8ec('0x3')](0x0);var _0x30c05a=moment(_0x4dd5dd)[_0xe8ec('0x3')](0x0);return _0x47b1c1[_0xe8ec('0x4')](_0x30c05a,_0xe8ec('0x5'));}function Final(_0x4f2e7f){this[_0xe8ec('0x6')]=_0x4f2e7f[_0xe8ec('0x6')];this[_0xe8ec('0x7')]=_0x4f2e7f[_0xe8ec('0x7')];this[_0xe8ec('0x8')]=_0x4f2e7f[_0xe8ec('0x8')];this[_0xe8ec('0x9')]=_0x4f2e7f['type']===_0xe8ec('0xa')?'queue':_0x4f2e7f[_0xe8ec('0x8')];this['countbusyretry']=_0x4f2e7f[_0xe8ec('0xb')];this[_0xe8ec('0xc')]=_0x4f2e7f[_0xe8ec('0xc')];this[_0xe8ec('0xd')]=_0x4f2e7f[_0xe8ec('0xd')];this[_0xe8ec('0xe')]=_0x4f2e7f[_0xe8ec('0xb')]+_0x4f2e7f[_0xe8ec('0xc')]+_0x4f2e7f[_0xe8ec('0xd')]+_0x4f2e7f[_0xe8ec('0xf')]+_0x4f2e7f[_0xe8ec('0x10')]+_0x4f2e7f[_0xe8ec('0x11')]+_0x4f2e7f[_0xe8ec('0x12')]+_0x4f2e7f['countagentrejectretry'];this[_0xe8ec('0xf')]=_0x4f2e7f[_0xe8ec('0xf')];this[_0xe8ec('0x10')]=_0x4f2e7f[_0xe8ec('0x10')];this[_0xe8ec('0x11')]=_0x4f2e7f[_0xe8ec('0x11')];this[_0xe8ec('0x12')]=_0x4f2e7f[_0xe8ec('0x12')];this['countagentrejectretry']=_0x4f2e7f[_0xe8ec('0x13')];this[_0xe8ec('0x14')]=_0x4f2e7f[_0xe8ec('0x14')];this['calleridname']=_0x4f2e7f[_0xe8ec('0x15')];this[_0xe8ec('0x16')]=_0x4f2e7f[_0xe8ec('0x16')];this[_0xe8ec('0x17')]=_0x4f2e7f[_0xe8ec('0x17')];this[_0xe8ec('0x18')]=_0x4f2e7f[_0xe8ec('0x18')];this[_0xe8ec('0x19')]=_0x4f2e7f['responsetime'];this[_0xe8ec('0x1a')]=_0x4f2e7f[_0xe8ec('0x1a')]||0x0;this[_0xe8ec('0x1b')]=_0x4f2e7f[_0xe8ec('0x1b')]||0x0;this[_0xe8ec('0x1c')]=_0x4f2e7f[_0xe8ec('0x1c')]||0x0;this[_0xe8ec('0x1d')]=_0x4f2e7f[_0xe8ec('0x1d')];this[_0xe8ec('0x1e')]=_0x4f2e7f['callbackuniqueid'];this[_0xe8ec('0x1f')]=_0x4f2e7f[_0xe8ec('0x1f')];this[_0xe8ec('0x20')]=_0x4f2e7f[_0xe8ec('0x20')];this[_0xe8ec('0x21')]=_0x4f2e7f['ContactId'];this[_0xe8ec('0x22')]=_0x4f2e7f[_0xe8ec('0x22')];this[_0xe8ec('0x23')]=_0x4f2e7f[_0xe8ec('0x23')];this[_0xe8ec('0x24')]=_0x4f2e7f[_0xe8ec('0x24')];this['CampaignId']=_0x4f2e7f['CampaignId'];this[_0xe8ec('0x25')]=_0x4f2e7f[_0xe8ec('0x25')]||'';this[_0xe8ec('0x26')]=_0x4f2e7f[_0xe8ec('0x26')]||'';}module[_0xe8ec('0x27')]=Final; \ No newline at end of file +var _0xd0bb=['callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridnum','starttime','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid'];(function(_0x5924ef,_0x4f2f8e){var _0x1ff06d=function(_0x269520){while(--_0x269520){_0x5924ef['push'](_0x5924ef['shift']());}};_0x1ff06d(++_0x4f2f8e);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0x5be1d6,_0x52ab2a){_0x5be1d6=_0x5be1d6-0x0;var _0x5d9bd4=_0xd0bb[_0x5be1d6];return _0x5d9bd4;};'use strict';var util=require(_0xbd0b('0x0'));var _=require(_0xbd0b('0x1'));var moment=require(_0xbd0b('0x2'));function getSeconds(_0x5793c9,_0x68ea36){var _0x4ab08f=moment(_0x5793c9)[_0xbd0b('0x3')](0x0);var _0x1f6ec3=moment(_0x68ea36)['milliseconds'](0x0);return _0x4ab08f[_0xbd0b('0x4')](_0x1f6ec3,'seconds');}function Final(_0x2236ce){this[_0xbd0b('0x5')]=_0x2236ce[_0xbd0b('0x5')];this[_0xbd0b('0x6')]=_0x2236ce[_0xbd0b('0x6')];this['type']=_0x2236ce[_0xbd0b('0x7')];this[_0xbd0b('0x8')]=_0x2236ce[_0xbd0b('0x7')]===_0xbd0b('0x9')?_0xbd0b('0xa'):_0x2236ce['type'];this['countbusyretry']=_0x2236ce[_0xbd0b('0xb')];this[_0xbd0b('0xc')]=_0x2236ce['countcongestionretry'];this[_0xbd0b('0xd')]=_0x2236ce[_0xbd0b('0xd')];this['countglobal']=_0x2236ce[_0xbd0b('0xb')]+_0x2236ce[_0xbd0b('0xc')]+_0x2236ce[_0xbd0b('0xd')]+_0x2236ce[_0xbd0b('0xe')]+_0x2236ce[_0xbd0b('0xf')]+_0x2236ce[_0xbd0b('0x10')]+_0x2236ce[_0xbd0b('0x11')]+_0x2236ce[_0xbd0b('0x12')];this[_0xbd0b('0xe')]=_0x2236ce[_0xbd0b('0xe')];this[_0xbd0b('0xf')]=_0x2236ce['countdropretry'];this[_0xbd0b('0x10')]=_0x2236ce['countabandonedretry'];this['countmachineretry']=_0x2236ce[_0xbd0b('0x11')];this[_0xbd0b('0x12')]=_0x2236ce[_0xbd0b('0x12')];this[_0xbd0b('0xa')]=_0x2236ce[_0xbd0b('0xa')];this['calleridname']=_0x2236ce['calleridname'];this[_0xbd0b('0x13')]=_0x2236ce[_0xbd0b('0x13')];this[_0xbd0b('0x14')]=_0x2236ce[_0xbd0b('0x14')];this[_0xbd0b('0x15')]=_0x2236ce[_0xbd0b('0x15')];this['endtime']=_0x2236ce[_0xbd0b('0x15')];this['ringtime']=_0x2236ce[_0xbd0b('0x16')]||0x0;this[_0xbd0b('0x17')]=_0x2236ce[_0xbd0b('0x17')]||0x0;this[_0xbd0b('0x18')]=_0x2236ce['talktime']||0x0;this[_0xbd0b('0x19')]=_0x2236ce[_0xbd0b('0x19')];this[_0xbd0b('0x1a')]=_0x2236ce['callbackuniqueid'];this[_0xbd0b('0x1b')]=_0x2236ce['callbackat'];this[_0xbd0b('0x1c')]=_0x2236ce[_0xbd0b('0x1c')];this[_0xbd0b('0x1d')]=_0x2236ce[_0xbd0b('0x1d')];this[_0xbd0b('0x1e')]=_0x2236ce['ListId'];this[_0xbd0b('0x1f')]=_0x2236ce['UserId'];this[_0xbd0b('0x20')]=_0x2236ce[_0xbd0b('0x20')];this[_0xbd0b('0x21')]=_0x2236ce[_0xbd0b('0x21')];this[_0xbd0b('0x22')]=_0x2236ce[_0xbd0b('0x22')]||'';this['originatecalleridname']=_0x2236ce[_0xbd0b('0x23')]||'';}module[_0xbd0b('0x24')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index 3539eee..3dab0eb 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 _0x2145=['UserId','VoiceQueueId','CampaignId','exports','lodash','moment','milliseconds','seconds','statedesc','scheduledat','type','campaigntype','queue','countbusyretry','countnoanswerretry','countglobal','countcongestionretry','countnosuchnumberretry','countabandonedretry','countagentrejectretry','countdropretry','countmachineretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','membername','IVR','reason','callbackuniqueid','callbackat','recallme','ContactId','ListId'];(function(_0x5a9cdc,_0x2acffd){var _0x27319d=function(_0x10d8c4){while(--_0x10d8c4){_0x5a9cdc['push'](_0x5a9cdc['shift']());}};_0x27319d(++_0x2acffd);}(_0x2145,0x1d2));var _0x5214=function(_0xac2d31,_0x57fe45){_0xac2d31=_0xac2d31-0x0;var _0x469f89=_0x2145[_0xac2d31];return _0x469f89;};'use strict';var util=require('util');var _=require(_0x5214('0x0'));var moment=require(_0x5214('0x1'));function getSeconds(_0x37f7bc,_0x26e17c){var _0x378d37=moment(_0x37f7bc)[_0x5214('0x2')](0x0);var _0x4efd67=moment(_0x26e17c)[_0x5214('0x2')](0x0);return _0x378d37['diff'](_0x4efd67,_0x5214('0x3'));}function Hangup(_0x270662,_0x53bf92){this['state']=0x4;this[_0x5214('0x4')]='Answer';this[_0x5214('0x5')]=_0x270662[_0x5214('0x5')];this[_0x5214('0x6')]=_0x270662[_0x5214('0x6')];this[_0x5214('0x7')]=_0x270662[_0x5214('0x6')]==='outbound'?_0x5214('0x8'):_0x270662['type'];this[_0x5214('0x9')]=_0x270662['countbusyretry'];this['countcongestionretry']=_0x270662['countcongestionretry'];this[_0x5214('0xa')]=_0x270662[_0x5214('0xa')];this[_0x5214('0xb')]=_0x270662[_0x5214('0x9')]+_0x270662[_0x5214('0xc')]+_0x270662[_0x5214('0xa')]+_0x270662[_0x5214('0xd')]+_0x270662['countdropretry']+_0x270662[_0x5214('0xe')]+_0x270662['countmachineretry']+_0x270662[_0x5214('0xf')];this[_0x5214('0xd')]=_0x270662['countnosuchnumberretry'];this[_0x5214('0x10')]=_0x270662[_0x5214('0x10')];this[_0x5214('0xe')]=_0x270662[_0x5214('0xe')];this[_0x5214('0x11')]=_0x270662['countmachineretry'];this[_0x5214('0xf')]=_0x270662[_0x5214('0xf')];this['uniqueid']=_0x53bf92[_0x5214('0x12')];this[_0x5214('0x13')]=_0x270662[_0x5214('0x14')];this[_0x5214('0x15')]=_0x270662[_0x5214('0x16')];this[_0x5214('0x17')]=_0x270662[_0x5214('0x17')];this[_0x5214('0x18')]=_0x270662['responsetime'];this[_0x5214('0x19')]=moment()[_0x5214('0x1a')](_0x5214('0x1b'));this[_0x5214('0x1c')]=getSeconds(_0x270662[_0x5214('0x18')],_0x270662[_0x5214('0x17')]);this[_0x5214('0x1d')]=0x0;this['talktime']=getSeconds(this['endtime'],_0x270662['responsetime']);this[_0x5214('0x8')]=_0x270662[_0x5214('0x8')];this[_0x5214('0x1e')]=_0x5214('0x1f');this[_0x5214('0x20')]=_0x53bf92['cause-txt'];this['callback']=_0x270662['callback'];this[_0x5214('0x21')]=_0x270662[_0x5214('0x21')];this[_0x5214('0x22')]=_0x270662[_0x5214('0x22')];this[_0x5214('0x23')]=_0x270662[_0x5214('0x23')];this[_0x5214('0x24')]=_0x270662[_0x5214('0x24')];this[_0x5214('0x25')]=_0x270662['ListId'];this[_0x5214('0x26')]=_0x270662[_0x5214('0x26')];this[_0x5214('0x27')]=_0x270662['VoiceQueueId'];this[_0x5214('0x28')]=_0x270662['CampaignId'];}module[_0x5214('0x29')]=Hangup; \ No newline at end of file +var _0xc0db=['name','calleridnum','number','starttime','responsetime','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','membername','IVR','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','moment','milliseconds','seconds','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname'];(function(_0x3c7555,_0x2d262a){var _0x5cea6a=function(_0x1c6cb8){while(--_0x1c6cb8){_0x3c7555['push'](_0x3c7555['shift']());}};_0x5cea6a(++_0x2d262a);}(_0xc0db,0x1ae));var _0xbc0d=function(_0x29581f,_0x578913){_0x29581f=_0x29581f-0x0;var _0x18660e=_0xc0db[_0x29581f];return _0x18660e;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0xbc0d('0x0'));function getSeconds(_0xf10c68,_0x287721){var _0x456dcf=moment(_0xf10c68)[_0xbc0d('0x1')](0x0);var _0x3ef326=moment(_0x287721)[_0xbc0d('0x1')](0x0);return _0x456dcf['diff'](_0x3ef326,_0xbc0d('0x2'));}function Hangup(_0x476f34,_0x3906cf){this['state']=0x4;this[_0xbc0d('0x3')]=_0xbc0d('0x4');this[_0xbc0d('0x5')]=_0x476f34[_0xbc0d('0x5')];this[_0xbc0d('0x6')]=_0x476f34[_0xbc0d('0x6')];this[_0xbc0d('0x7')]=_0x476f34['type']===_0xbc0d('0x8')?_0xbc0d('0x9'):_0x476f34[_0xbc0d('0x6')];this[_0xbc0d('0xa')]=_0x476f34[_0xbc0d('0xa')];this[_0xbc0d('0xb')]=_0x476f34[_0xbc0d('0xb')];this['countnoanswerretry']=_0x476f34[_0xbc0d('0xc')];this[_0xbc0d('0xd')]=_0x476f34[_0xbc0d('0xa')]+_0x476f34[_0xbc0d('0xb')]+_0x476f34[_0xbc0d('0xc')]+_0x476f34[_0xbc0d('0xe')]+_0x476f34[_0xbc0d('0xf')]+_0x476f34[_0xbc0d('0x10')]+_0x476f34[_0xbc0d('0x11')]+_0x476f34['countagentrejectretry'];this[_0xbc0d('0xe')]=_0x476f34[_0xbc0d('0xe')];this[_0xbc0d('0xf')]=_0x476f34[_0xbc0d('0xf')];this[_0xbc0d('0x10')]=_0x476f34[_0xbc0d('0x10')];this[_0xbc0d('0x11')]=_0x476f34[_0xbc0d('0x11')];this[_0xbc0d('0x12')]=_0x476f34[_0xbc0d('0x12')];this[_0xbc0d('0x13')]=_0x3906cf[_0xbc0d('0x13')];this[_0xbc0d('0x14')]=_0x476f34[_0xbc0d('0x15')];this[_0xbc0d('0x16')]=_0x476f34[_0xbc0d('0x17')];this['starttime']=_0x476f34[_0xbc0d('0x18')];this[_0xbc0d('0x19')]=_0x476f34['responsetime'];this['endtime']=moment()['format'](_0xbc0d('0x1a'));this[_0xbc0d('0x1b')]=getSeconds(_0x476f34[_0xbc0d('0x19')],_0x476f34[_0xbc0d('0x18')]);this[_0xbc0d('0x1c')]=0x0;this['talktime']=getSeconds(this['endtime'],_0x476f34['responsetime']);this[_0xbc0d('0x9')]=_0x476f34['queue'];this[_0xbc0d('0x1d')]=_0xbc0d('0x1e');this['reason']=_0x3906cf[_0xbc0d('0x1f')];this[_0xbc0d('0x20')]=_0x476f34['callback'];this[_0xbc0d('0x21')]=_0x476f34[_0xbc0d('0x21')];this['callbackat']=_0x476f34[_0xbc0d('0x22')];this['recallme']=_0x476f34[_0xbc0d('0x23')];this[_0xbc0d('0x24')]=_0x476f34[_0xbc0d('0x24')];this[_0xbc0d('0x25')]=_0x476f34[_0xbc0d('0x25')];this[_0xbc0d('0x26')]=_0x476f34[_0xbc0d('0x26')];this['VoiceQueueId']=_0x476f34[_0xbc0d('0x27')];this[_0xbc0d('0x28')]=_0x476f34[_0xbc0d('0x28')];}module['exports']=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index dd17dad..350ae6a 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 _0x1d2f=['callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridname','exports','util','moment','milliseconds','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','name','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime'];(function(_0x110ea2,_0x4f13ea){var _0x704849=function(_0x69fa38){while(--_0x69fa38){_0x110ea2['push'](_0x110ea2['shift']());}};_0x704849(++_0x4f13ea);}(_0x1d2f,0x143));var _0xf1d2=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x1d2f[_0xfae23b];return _0x200640;};'use strict';var util=require(_0xf1d2('0x0'));var _=require('lodash');var moment=require(_0xf1d2('0x1'));function getSeconds(_0x273be6,_0x1c9b03){var _0x3997d5=moment(_0x273be6)[_0xf1d2('0x2')](0x0);var _0x2cbce7=moment(_0x1c9b03)[_0xf1d2('0x2')](0x0);return _0x3997d5['diff'](_0x2cbce7,_0xf1d2('0x3'));}function History(_0x2b2e96){this[_0xf1d2('0x4')]=_0x2b2e96[_0xf1d2('0x4')];this[_0xf1d2('0x5')]=_0x2b2e96[_0xf1d2('0x5')]||undefined;this['type']=_0x2b2e96[_0xf1d2('0x6')];this[_0xf1d2('0x7')]=_0x2b2e96['type']===_0xf1d2('0x8')?_0xf1d2('0x9'):_0x2b2e96['type'];this[_0xf1d2('0xa')]=_0x2b2e96[_0xf1d2('0xa')];this[_0xf1d2('0xb')]=_0x2b2e96[_0xf1d2('0xb')];this[_0xf1d2('0xc')]=_0x2b2e96[_0xf1d2('0xc')];this[_0xf1d2('0xd')]=_0x2b2e96['countbusyretry']+_0x2b2e96[_0xf1d2('0xb')]+_0x2b2e96[_0xf1d2('0xc')]+_0x2b2e96[_0xf1d2('0xe')]+_0x2b2e96[_0xf1d2('0xf')]+_0x2b2e96[_0xf1d2('0x10')]+_0x2b2e96[_0xf1d2('0x11')]+_0x2b2e96[_0xf1d2('0x12')];this['countnosuchnumberretry']=_0x2b2e96[_0xf1d2('0xe')];this[_0xf1d2('0xf')]=_0x2b2e96[_0xf1d2('0xf')];this[_0xf1d2('0x10')]=_0x2b2e96[_0xf1d2('0x10')];this[_0xf1d2('0x11')]=_0x2b2e96[_0xf1d2('0x11')];this['countagentrejectretry']=_0x2b2e96[_0xf1d2('0x12')];this[_0xf1d2('0x9')]=_0x2b2e96[_0xf1d2('0x9')];this[_0xf1d2('0x13')]=_0x2b2e96[_0xf1d2('0x14')];this[_0xf1d2('0x15')]=_0x2b2e96['number'];this[_0xf1d2('0x16')]=_0x2b2e96['starttime'];this[_0xf1d2('0x17')]=_0x2b2e96[_0xf1d2('0x17')];this[_0xf1d2('0x18')]=_0x2b2e96[_0xf1d2('0x17')];this[_0xf1d2('0x19')]=getSeconds(_0x2b2e96[_0xf1d2('0x17')],_0x2b2e96[_0xf1d2('0x16')]);this[_0xf1d2('0x1a')]=0x0;this[_0xf1d2('0x1b')]=0x0;this[_0xf1d2('0x1c')]=_0x2b2e96[_0xf1d2('0x1c')];this['callbackuniqueid']=_0x2b2e96[_0xf1d2('0x1d')];this[_0xf1d2('0x1e')]=_0x2b2e96['callbackat'];this[_0xf1d2('0x1f')]=_0x2b2e96[_0xf1d2('0x1f')];this[_0xf1d2('0x20')]=_0x2b2e96['ContactId'];this[_0xf1d2('0x21')]=_0x2b2e96[_0xf1d2('0x21')];this[_0xf1d2('0x22')]=_0x2b2e96[_0xf1d2('0x22')];this['VoiceQueueId']=_0x2b2e96[_0xf1d2('0x23')];this[_0xf1d2('0x24')]=_0x2b2e96[_0xf1d2('0x24')];this['originatecalleridnum']=_0x2b2e96['originatecalleridnum']||'';this[_0xf1d2('0x25')]=_0x2b2e96[_0xf1d2('0x25')]||'';}module[_0xf1d2('0x26')]=History; \ No newline at end of file +var _0x51af=['queue','calleridname','name','number','starttime','responsetime','endtime','ringtime','holdtime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','campaigntype','type','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry'];(function(_0x3a1cca,_0xf9cf7e){var _0x53b71c=function(_0x56c49f){while(--_0x56c49f){_0x3a1cca['push'](_0x3a1cca['shift']());}};_0x53b71c(++_0xf9cf7e);}(_0x51af,0x1c2));var _0xf51a=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0x51af[_0xaa1b3e];return _0x454d7d;};'use strict';var util=require(_0xf51a('0x0'));var _=require(_0xf51a('0x1'));var moment=require(_0xf51a('0x2'));function getSeconds(_0x3008c1,_0x3a07fb){var _0x2e0195=moment(_0x3008c1)[_0xf51a('0x3')](0x0);var _0xb56e84=moment(_0x3a07fb)[_0xf51a('0x3')](0x0);return _0x2e0195[_0xf51a('0x4')](_0xb56e84,_0xf51a('0x5'));}function History(_0x38b165){this[_0xf51a('0x6')]=_0x38b165[_0xf51a('0x6')];this[_0xf51a('0x7')]=_0x38b165[_0xf51a('0x7')]||undefined;this['type']=_0x38b165['type'];this[_0xf51a('0x8')]=_0x38b165[_0xf51a('0x9')]==='outbound'?'queue':_0x38b165[_0xf51a('0x9')];this[_0xf51a('0xa')]=_0x38b165['countbusyretry'];this[_0xf51a('0xb')]=_0x38b165[_0xf51a('0xb')];this[_0xf51a('0xc')]=_0x38b165[_0xf51a('0xc')];this['countglobal']=_0x38b165[_0xf51a('0xa')]+_0x38b165[_0xf51a('0xb')]+_0x38b165[_0xf51a('0xc')]+_0x38b165[_0xf51a('0xd')]+_0x38b165['countdropretry']+_0x38b165[_0xf51a('0xe')]+_0x38b165[_0xf51a('0xf')]+_0x38b165[_0xf51a('0x10')];this['countnosuchnumberretry']=_0x38b165['countnosuchnumberretry'];this[_0xf51a('0x11')]=_0x38b165['countdropretry'];this[_0xf51a('0xe')]=_0x38b165[_0xf51a('0xe')];this['countmachineretry']=_0x38b165[_0xf51a('0xf')];this['countagentrejectretry']=_0x38b165['countagentrejectretry'];this[_0xf51a('0x12')]=_0x38b165[_0xf51a('0x12')];this[_0xf51a('0x13')]=_0x38b165[_0xf51a('0x14')];this['calleridnum']=_0x38b165[_0xf51a('0x15')];this['starttime']=_0x38b165[_0xf51a('0x16')];this[_0xf51a('0x17')]=_0x38b165[_0xf51a('0x17')];this[_0xf51a('0x18')]=_0x38b165['responsetime'];this[_0xf51a('0x19')]=getSeconds(_0x38b165[_0xf51a('0x17')],_0x38b165[_0xf51a('0x16')]);this[_0xf51a('0x1a')]=0x0;this['talktime']=0x0;this['callback']=_0x38b165[_0xf51a('0x1b')];this['callbackuniqueid']=_0x38b165[_0xf51a('0x1c')];this[_0xf51a('0x1d')]=_0x38b165[_0xf51a('0x1d')];this['recallme']=_0x38b165[_0xf51a('0x1e')];this[_0xf51a('0x1f')]=_0x38b165[_0xf51a('0x1f')];this[_0xf51a('0x20')]=_0x38b165[_0xf51a('0x20')];this[_0xf51a('0x21')]=_0x38b165[_0xf51a('0x21')];this[_0xf51a('0x22')]=_0x38b165[_0xf51a('0x22')];this[_0xf51a('0x23')]=_0x38b165[_0xf51a('0x23')];this[_0xf51a('0x24')]=_0x38b165[_0xf51a('0x24')]||'';this[_0xf51a('0x25')]=_0x38b165[_0xf51a('0x25')]||'';}module[_0xf51a('0x26')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 5cf31b1..a2dcf1c 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 _0xa122=['dialQueueProject2','\x22%s,%s%s,,,%s\x22','dialAgiAfterHangupAgent','ACTIVE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','createdAt','updatedAt','XMD-','toUpper','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','dialCutDigit','substring','from-sip','[originateError]:\x20%s','OriginateError','[originate][error]','Error','originate\x20action\x20Error','getQueue','response','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerMaxRetry','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','NoAnswer','custom:agentnoanswer','reason\x203\x20ringing\x20no\x20answer','custom:agentbusy','reason\x205\x20busy','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','outboundAbandonedCallsDay','reason\x2011\x20abandoned','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','dialAgentRejectMaxRetry','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','Success','[moveContactManagedDialer][0]','contact\x20not\x20moved','round','predictiveIntervalMinThreshold','available','floor','erlangAbandonmentRate','predictiveIntervalHitRate','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','startMethodPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','dialPredictiveOptimizationPercentage','abandonmentRate','agentBusyFactor','check\x20failure','getDataPredictiveOld','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','busyFactor','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','actionOriginate','scheduledat','dialRecallMeTimeout','Agent','unlockContact','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','dialOrderByScheduledAt','[getContactCampaign2][Empty]','ivrTotalCallsDays','[actionOriginate]\x20','Contact.phone','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','[countReScheduled]\x20','RUNNING','tryOriginatePredictive','[handlePredictive][limitChannel]','[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','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','interval\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','p\x20=\x20','Umin\x20=\x20','exports','util','lodash','bluebird','uuid','moment','md5','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictiveCalls','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./history','./final','./agentComplete','./queueCallerAbandon','env','XCALLY_IP_AGI','127.0.0.1','roundrobin','enqueue','tail','finally','sequence','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','actions','contactsId','uniqueId','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','custom:queuesummary','syncQueueSummary','hangup','syncHangup','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','isUndefined','message','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','Interval','INTERVAL_IS_NULL','name','\x20INTERVAL_IS_NULL','isEmpty','[ifTime][Action]','stringify','milliseconds','diff','seconds','emit','outbound','strategy','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','total','type','unmanaged','abandoned','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','originated','erlangCalls','erlangCallToSecond','erlangBusyFactor','Trunk','callerid','voice_queue:save','ivr','format','campaign:ivr:%s','campaign:save','info','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','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','predictiveIntervalTotalCalls','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','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','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','handlePredictive','clearing\x20variable\x20handle\x20predictive','preview','string','\x22%s\x22\x20<%s>','error','inspect','stack','length','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contactsRescheduled','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','talking','waiting','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','endtime','starttime','clearZombieChannels','prototype','catch','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','countReScheduled','resolve','then','checkIsBlackList','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','rescheduleContact','[rescheduleContact]\x20','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[updateOriginated]\x20object\x20originated\x20is\x20negative','loggerHandler','emptyContact','notFound','saveInDb','pick','ContactId','ListId','UserId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','isTrunkReachable','active','SIP/%s','status','reachable','createHistory','moveContactManagedDialer','uniqueid','variable','isNil','amdstatus','exten','xcally-motion-dialer','dialAMDActive','outboundAnswerAgiCallsDay','HangupInAMD','membername','AMD','custom:amd','amd','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','value','MACHINE','state','statedesc','Machine','countmachineretry','countglobal','buildObj','[syncAgentComplete][createHistory][0]','countbusyretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','createStateFinal','add','dialMachineRetryFrequency','YYYY-MM-DD\x20HH:mm:ss','VoiceQueueId','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','countcongestionretry','dialMachineMaxRetry','reason\x2019\x20machine....','minutes','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','AnswerAGI','AGI','dialQueueProject','cause-txt','Unknow','syncAgentComplete','reason','agent','agiafterat','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dialQueueTimeout','Drop','dropreason','dialDropMaxRetry','dialDropRetryFrequency','[rescheduleContact][Drop]','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','CALLEREXIT','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','channel','actionid','locked','paused','stateinterface','rrmemory','push','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','queueStatusComplete','run','idHopper','[Catch][Preview][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','[booked][RR][finaly]','[unlock][syncQueueStatusComplete]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','resetActiveCalls','syncCampaigns','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','checkIfTimeIntervals','Intervals','\x20Intervals\x20is\x20null\x20','ifTime','Failure','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','command','content','indexOf','true','Action','iftime\x20%s,%s','all','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','progressive','power','handlePower','dialPowerLevel','predictive','Queue','launchHandleIvr','handleIvr','checkIsTrunkReachable','dialGlobalInterval','dialTimezone','[syncQueueSummary]','[syncCampaigns]','\x5cw{0,','pow','match','object','originate','voiceQueue\x20is\x20undefine','phone','Contact','contact\x20is\x20undefine','getCaller','NONE'];(function(_0x17d7e,_0x52bcfb){var _0x22dbca=function(_0xca3846){while(--_0xca3846){_0x17d7e['push'](_0x17d7e['shift']());}};_0x22dbca(++_0x52bcfb);}(_0xa122,0xae));var _0x2a12=function(_0x258d3f,_0x3dffb0){_0x258d3f=_0x258d3f-0x0;var _0x34d529=_0xa122[_0x258d3f];return _0x34d529;};'use strict';var util=require(_0x2a12('0x0'));var _=require(_0x2a12('0x1'));var BPromise=require(_0x2a12('0x2'));var uuid=require(_0x2a12('0x3'));var moment=require(_0x2a12('0x4'));var rr=require('rr');var md5=require(_0x2a12('0x5'));var Redis=require(_0x2a12('0x6'));var ut=require(_0x2a12('0x7'));var config=require(_0x2a12('0x8'));var logger=require(_0x2a12('0x9'))(_0x2a12('0xa'));var loggerBooked=require(_0x2a12('0x9'))(_0x2a12('0xb'));var loggerPredictive=require(_0x2a12('0x9'))('predictive');var loggerPredictiveCalls=require(_0x2a12('0x9'))(_0x2a12('0xc'));var loggerSyncQueueSummary=require(_0x2a12('0x9'))('syncQueueSummary');var ami=require(_0x2a12('0xd'));config[_0x2a12('0xe')]=_[_0x2a12('0xf')](config[_0x2a12('0xe')],{'host':_0x2a12('0x10'),'port':0x18eb});var io=require(_0x2a12('0x11'))(new Redis(config[_0x2a12('0xe')]));var cmHopper=require(_0x2a12('0x12'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0x2a12('0x13'));var voiceQueueRt=require(_0x2a12('0x14'));var Action=require(_0x2a12('0x15'));var History=require(_0x2a12('0x16'));var Final=require(_0x2a12('0x17'));var AgentComplete=require(_0x2a12('0x18'));var QueueCallerAbandon=require(_0x2a12('0x19'));var Hangup=require('./hangup');var ipAgi=process[_0x2a12('0x1a')][_0x2a12('0x1b')]||_0x2a12('0x1c');var strategy={'rrmemory':'rrmemory','roundrobin':_0x2a12('0x1d')};var Sequence=function(){};Sequence['prototype'][_0x2a12('0x1e')]=function(_0x18fc6e){this[_0x2a12('0x1f')]=this[_0x2a12('0x1f')]?this['tail'][_0x2a12('0x20')](_0x18fc6e):_0x18fc6e();};function Dialer(_0x5ab383,_0x17116a){this[_0x2a12('0x21')]=new Sequence();this['preview']=_0x17116a;this['voiceQueues']=_0x5ab383[_0x2a12('0x22')];this[_0x2a12('0x23')]=_0x5ab383['campaigns'];this[_0x2a12('0x24')]=_0x5ab383[_0x2a12('0x24')];this[_0x2a12('0x25')]=_0x5ab383[_0x2a12('0x25')];this['maxNumberOriginate']=config[_0x2a12('0x26')]||0x2;this['channels']={};this[_0x2a12('0x27')]={};this[_0x2a12('0x28')]={};this[_0x2a12('0x29')]={};this['optionPredictive']={};this[_0x2a12('0x2a')]={};this[_0x2a12('0x2b')]={};this[_0x2a12('0x2c')]={};this[_0x2a12('0x2d')]={};this[_0x2a12('0x2e')]={};ami['on'](_0x2a12('0x2f'),this[_0x2a12('0x30')][_0x2a12('0x31')](this));ami['on'](_0x2a12('0x32'),this[_0x2a12('0x33')][_0x2a12('0x31')](this));ami['on'](_0x2a12('0x34'),this[_0x2a12('0x35')][_0x2a12('0x31')](this));ami['on'](_0x2a12('0x36'),this['syncAgentComplete'][_0x2a12('0x31')](this));ami['on'](_0x2a12('0x37'),this[_0x2a12('0x38')][_0x2a12('0x31')](this));ami['on'](_0x2a12('0x39'),this[_0x2a12('0x3a')][_0x2a12('0x31')](this));ami['on']('newexten',this[_0x2a12('0x3b')][_0x2a12('0x31')](this));ami['on'](_0x2a12('0x3c'),this[_0x2a12('0x3d')][_0x2a12('0x31')](this));ami['on'](_0x2a12('0x3e'),this[_0x2a12('0x3f')]['bind'](this));ami['on'](_0x2a12('0x40'),this[_0x2a12('0x41')][_0x2a12('0x31')](this));this[_0x2a12('0x42')]();this[_0x2a12('0x43')]();}function isNotNull(_0x1fc33e){return _0x1fc33e!==null&&!_[_0x2a12('0x44')](_0x1fc33e);}function checkIsLoggedIn(_0xb7f051,_0x85a60d){return function(){if(_0x85a60d<=0x0){_0xb7f051[_0x2a12('0x45')]='AGENTS_NOT_LOGGED';throw _0xb7f051['name']+_0x2a12('0x46');}};}function isActive(_0x2d5e1a){return _0x2d5e1a;}function checkIsActive(_0x3282d8,_0x4e65e2){return function(){if(!isActive(_0x4e65e2)){_0x3282d8['message']=_0x2a12('0x47');throw _0x3282d8['name']+'\x20NOT\x20Active';}};}function checkInterval(_0x8a566d){return function(){if(!isNotNull(_0x8a566d[_0x2a12('0x48')])){_0x8a566d[_0x2a12('0x45')]=_0x2a12('0x49');throw _0x8a566d[_0x2a12('0x4a')]+_0x2a12('0x4b');}if(!isNotNull(_0x8a566d[_0x2a12('0x48')]['Intervals'])){_0x8a566d[_0x2a12('0x45')]=_0x2a12('0x49');throw _0x8a566d['name']+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_[_0x2a12('0x4c')](_0x8a566d[_0x2a12('0x48')]['Intervals']))){_0x8a566d[_0x2a12('0x45')]=_0x2a12('0x49');throw _0x8a566d[_0x2a12('0x4a')]+_0x2a12('0x4b');}};}function msgResponse(_0x26922c,_0x55409e,_0x36da7f){return{'action':_0x26922c,'response':_0x55409e,'message':_0x36da7f,'stack':_0x36da7f};}function myreject(_0x46cbd3){return function(_0x388a9d){return _0x46cbd3(msgResponse(_0x2a12('0x4d'),'Error',JSON[_0x2a12('0x4e')](_0x388a9d)));};}function getSeconds(_0x5917cc,_0x5eab92){var _0x26c500=moment(_0x5917cc)['milliseconds'](0x0);var _0x374838=moment(_0x5eab92)[_0x2a12('0x4f')](0x0);return _0x26c500[_0x2a12('0x50')](_0x374838,_0x2a12('0x51'));}function emit(_0x522201,_0x2d9f06,_0x4cf99b){io['to'](_0x522201)[_0x2a12('0x52')](_0x2d9f06,_0x4cf99b);}function emitVoiceQueueSummary(_0x1eacb5){if(_0x1eacb5['type']===_0x2a12('0x53')){var _0x507161={'id':_0x1eacb5['id'],'name':_0x1eacb5[_0x2a12('0x4a')],'strategy':_0x1eacb5[_0x2a12('0x54')],'answered':_0x1eacb5['answered'],'available':_0x1eacb5['available'],'loggedIn':_0x1eacb5[_0x2a12('0x55')],'pTalking':_0x1eacb5[_0x2a12('0x56')],'sumBillable':_0x1eacb5[_0x2a12('0x57')],'sumDuration':_0x1eacb5[_0x2a12('0x58')],'sumHoldTime':_0x1eacb5[_0x2a12('0x59')]||0x0,'talking':_0x1eacb5['talking'],'total':_0x1eacb5[_0x2a12('0x5a')],'type':_0x1eacb5[_0x2a12('0x5b')],'unmanaged':_0x1eacb5[_0x2a12('0x5c')],'abandoned':_0x1eacb5[_0x2a12('0x5d')],'waiting':_0x1eacb5['waiting'],'loggedInDb':_0x1eacb5[_0x2a12('0x5e')],'dialActive':_0x1eacb5[_0x2a12('0x5f')],'dialMethod':_0x1eacb5[_0x2a12('0x60')],'dialOriginateCallerIdName':_0x1eacb5[_0x2a12('0x61')],'dialOriginateCallerIdNumber':_0x1eacb5[_0x2a12('0x62')],'dialOriginateTimeout':_0x1eacb5[_0x2a12('0x63')],'dialPrefix':_0x1eacb5[_0x2a12('0x64')],'outboundAnswerAgiCallsDay':_0x1eacb5['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x1eacb5[_0x2a12('0x65')],'outboundBlacklistCallsDay':_0x1eacb5[_0x2a12('0x66')],'outboundBusyCallsDay':_0x1eacb5[_0x2a12('0x67')],'outboundCongestionCallsDay':_0x1eacb5[_0x2a12('0x68')],'outboundDropCallsDayACS':_0x1eacb5[_0x2a12('0x69')],'outboundDropCallsDayCallersExit':_0x1eacb5[_0x2a12('0x6a')],'outboundDropCallsDayTimeout':_0x1eacb5[_0x2a12('0x6b')],'outboundNoAnswerCallsDay':_0x1eacb5['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x1eacb5[_0x2a12('0x6c')],'outboundOriginateFailureCallsDay':_0x1eacb5[_0x2a12('0x6d')],'outboundReCallsDay':_0x1eacb5['outboundReCallsDay'],'outboundRejectCallsDay':_0x1eacb5[_0x2a12('0x6e')],'outboundUnknownCallsDay':_0x1eacb5[_0x2a12('0x6f')],'predictiveIntervalAnsweredCalls':_0x1eacb5[_0x2a12('0x70')],'predictiveIntervalAvgHoldtime':_0x1eacb5[_0x2a12('0x71')],'predictiveIntervalAvgTalktime':_0x1eacb5['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x1eacb5[_0x2a12('0x72')],'predictiveIntervalDroppedCallsTimeout':_0x1eacb5[_0x2a12('0x73')],'predictiveIntervalErlangCalls':_0x1eacb5[_0x2a12('0x74')],'predictiveIntervalErlangCallsDroppedCalls':_0x1eacb5[_0x2a12('0x75')],'predictiveIntervalHitRate':_0x1eacb5['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x1eacb5[_0x2a12('0x76')],'predictiveIntervalPauses':_0x1eacb5['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x1eacb5[_0x2a12('0x77')],'predictiveIntervalTotalCalls':_0x1eacb5['predictiveIntervalTotalCalls'],'message':_0x1eacb5['message'],'originated':_0x1eacb5[_0x2a12('0x78')],'erlangCalls':_0x1eacb5[_0x2a12('0x79')],'erlangCallToSecond':_0x1eacb5[_0x2a12('0x7a')],'erlangAbandonmentRate':_0x1eacb5['erlangAbandonmentRate'],'erlangBusyFactor':_0x1eacb5[_0x2a12('0x7b')],'startPredictive':_0x1eacb5[_0x2a12('0x2a')],'startProgressive':_0x1eacb5['startProgressive']};if(_0x1eacb5[_0x2a12('0x7c')]){_0x507161[_0x2a12('0x7c')]={'id':_0x1eacb5[_0x2a12('0x7c')]['id'],'name':_0x1eacb5[_0x2a12('0x7c')][_0x2a12('0x4a')],'active':_0x1eacb5['Trunk']['active'],'callerid':_0x1eacb5[_0x2a12('0x7c')][_0x2a12('0x7d')]};}if(_0x1eacb5[_0x2a12('0x48')]){_0x507161[_0x2a12('0x48')]={'id':_0x1eacb5[_0x2a12('0x48')]['id'],'name':_0x1eacb5[_0x2a12('0x48')][_0x2a12('0x4a')]};}var _0xef7380=md5(JSON[_0x2a12('0x4e')](_0x507161));if(_0x1eacb5['md5']!==_0xef7380){_0x1eacb5[_0x2a12('0x5')]=_0xef7380;emit(util['format']('voice:queue:%s',_0x507161[_0x2a12('0x4a')]),_0x2a12('0x7e'),_0x507161);}}}function emitCampaignSummary(_0x4a2ada){if(_0x4a2ada[_0x2a12('0x5b')]===_0x2a12('0x7f')){emit(util[_0x2a12('0x80')](_0x2a12('0x81'),_0x4a2ada[_0x2a12('0x4a')]),_0x2a12('0x82'),_0x4a2ada);}}function checkGetDataPredictive(_0x2c8f28){if(isNotNull(_0x2c8f28)&&!_[_0x2a12('0x4c')](_0x2c8f28)){loggerPredictive[_0x2a12('0x83')]('-----\x20Stats\x20Predictive\x20---');loggerPredictive[_0x2a12('0x83')](_0x2a12('0x84'),_0x2c8f28['predictiveIntervalTotalCalls']);loggerPredictive[_0x2a12('0x83')](_0x2a12('0x85'),_0x2c8f28['predictiveIntervalAnsweredCalls']);loggerPredictive[_0x2a12('0x83')](_0x2a12('0x86'),_0x2c8f28[_0x2a12('0x73')]);loggerPredictive[_0x2a12('0x83')]('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2c8f28[_0x2a12('0x72')]);loggerPredictive[_0x2a12('0x83')]('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2c8f28['predictiveIntervalAvgHoldtime']);loggerPredictive[_0x2a12('0x83')](_0x2a12('0x87'),_0x2c8f28[_0x2a12('0x88')]);loggerPredictive[_0x2a12('0x83')](_0x2a12('0x89'));if(_0x2c8f28[_0x2a12('0x8a')]>0x0){if(!_['isUndefined'](_0x2c8f28[_0x2a12('0x88')])&&_0x2c8f28[_0x2a12('0x88')]>0x0){return!![];}loggerPredictive[_0x2a12('0x83')](_0x2a12('0x8b'));if(!_[_0x2a12('0x44')](_0x2c8f28['predictiveIntervalAvgHoldtime'])&&_0x2c8f28[_0x2a12('0x71')]>0x0){return!![];}loggerPredictive['info'](_0x2a12('0x8c'));}else{loggerPredictive[_0x2a12('0x83')](_0x2a12('0x8d'));}}else{loggerPredictive[_0x2a12('0x83')](_0x2a12('0x8e'));}return![];}function mergeDataErlangB(_0x36cdb2){return function(_0x23ee99){loggerPredictive['info'](_0x2a12('0x8f'));loggerPredictive[_0x2a12('0x83')](_0x2a12('0x90'),_0x23ee99[_0x2a12('0x79')]);loggerPredictive[_0x2a12('0x83')]('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x23ee99[_0x2a12('0x7a')]);loggerPredictive[_0x2a12('0x83')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x23ee99['erlangAbandonmentRate']);loggerPredictive[_0x2a12('0x83')](_0x2a12('0x91'),_0x23ee99[_0x2a12('0x7b')]);loggerPredictive[_0x2a12('0x83')](_0x2a12('0x92'),_0x23ee99['erlangAbandonmentRate']);loggerPredictive[_0x2a12('0x83')](_0x2a12('0x89'));_[_0x2a12('0x93')](_0x36cdb2,_0x23ee99);};}function getDiff(_0x198a7c){var _0x111016=moment()[_0x2a12('0x4f')](0x0);var _0x299392=moment(_0x198a7c)[_0x2a12('0x4f')](0x0);return _0x111016['diff'](_0x299392,_0x2a12('0x51'));}function ifInterval(_0x4d757b,_0x3dd601){if(_['isUndefined'](_0x3dd601)){return![];}return getDiff(_0x3dd601)<_0x4d757b*0x3c;}function freeVariablesPredictive(_0x1e97bc){if(isNotNull(_0x1e97bc)){if(!_[_0x2a12('0x44')](_0x1e97bc['startProgressive'])){_0x1e97bc[_0x2a12('0x2b')]=undefined;loggerPredictive['info'](_0x1e97bc[_0x2a12('0x4a')],'clearing\x20variable\x20start\x20progressive');}if(!_[_0x2a12('0x44')](_0x1e97bc[_0x2a12('0x2a')])){_0x1e97bc[_0x2a12('0x2a')]=undefined;loggerPredictive[_0x2a12('0x83')](_0x1e97bc['name'],'clearing\x20variable\x20start\x20predictive');}if(!_[_0x2a12('0x44')](_0x1e97bc[_0x2a12('0x94')])){clearInterval(_0x1e97bc[_0x2a12('0x94')]);_0x1e97bc['handlePredictive']=undefined;loggerPredictive[_0x2a12('0x83')](_0x1e97bc[_0x2a12('0x4a')],_0x2a12('0x95'));}}}function erlangb(_0x2c567e,_0x25e301){if(_0x25e301===0x0){return 0x0;}var _0x1f7f0f=0x1;for(var _0x2ec7b8=0x1;_0x2ec7b8<=_0x25e301;_0x2ec7b8+=0x1){_0x1f7f0f=0x1+_0x1f7f0f*_0x2ec7b8/_0x2c567e;}return 0x1/_0x1f7f0f;}function isVoiceQueueOutbound(_0x175840){return _0x175840==='outbound';}function isNotPreview(_0x49b169){return _0x49b169!==_0x2a12('0x96');}function isCampaignIvr(_0x53169d){return _0x53169d==='ivr';}function getCallerId(_0x4a6a25,_0x193362,_0x4aead9){if(!_[_0x2a12('0x44')](_0x4aead9)&&typeof _0x4aead9===_0x2a12('0x97')&&!_['isEmpty'](_0x4aead9)){if(!_[_0x2a12('0x44')](_0x193362)&&typeof _0x193362===_0x2a12('0x97')&&!_['isEmpty'](_0x193362)){return util[_0x2a12('0x80')](_0x2a12('0x98'),_0x193362,_0x4aead9);}return util['format'](_0x2a12('0x98'),_0x4aead9,_0x4aead9);}if(!_[_0x2a12('0x44')](_0x4a6a25)&&typeof _0x4a6a25===_0x2a12('0x97')&&!_['isEmpty'](_0x4a6a25)){return _0x4a6a25;}return'\x22\x22\x20<>';}function loggerCatchQueueSummary(_0x1b0cd9,_0x2bbc62){return function(_0x53758b){freeVariablesPredictive(_0x2bbc62);emitVoiceQueueSummary(_0x2bbc62);emitCampaignSummary(_0x2bbc62);loggerSyncQueueSummary[_0x2a12('0x99')](_0x1b0cd9,util[_0x2a12('0x9a')](_0x53758b,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x57dde6,_0x4af924){return function(_0x45e04f){loggerPredictive['error'](_0x4af924['name'],_0x57dde6);loggerPredictive[_0x2a12('0x99')](_0x45e04f[_0x2a12('0x9b')]);freeVariablesPredictive(_0x4af924);};}function loggerCatch(_0x55d1a7){return function(_0x1788e0){logger[_0x2a12('0x99')](_0x55d1a7,util[_0x2a12('0x9a')](_0x1788e0,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x311065){return _0x311065&&!_['isUndefined'](_0x311065)&&_0x311065[_0x2a12('0x9c')]>0x0;}function decremetOriginate(_0x221367){if(!_[_0x2a12('0x44')](_0x221367)&&_0x221367!==null){if(typeof _0x221367[_0x2a12('0x78')]!==_0x2a12('0x9d')){if(_0x221367[_0x2a12('0x78')]>0x0){_0x221367['originated']-=0x1;}else{logger[_0x2a12('0x99')](_0x2a12('0x9e'));}}}else{logger[_0x2a12('0x99')]('[decremetOriginate]\x20is\x20null\x20or\x20undefined');}}function checkContactLowerLimitOriginate(_0x4150a5,_0x3d2c25,_0x349e77){if(_0x3d2c25>_0x349e77){for(var _0x3abe99=0x0;_0x3abe99<_0x3d2c25-_0x349e77;_0x3abe99+=0x1){decremetOriginate(_0x4150a5);}}}function loggerGetContactDialer(_0x1eb5e3,_0x50746a,_0x22a778){return function(_0x2bab07){checkContactLowerLimitOriginate(_0x50746a,_0x22a778,0x0);logger[_0x2a12('0x99')](_0x1eb5e3,util['inspect'](_0x2bab07,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x509a74){return function(_0x35d8d6){if(isNotNull(_0x35d8d6)&&isNotNull(_0x35d8d6[0x0])){if(_0x35d8d6[0x0]['contactsRescheduled']>0x0){_0x509a74[_0x2a12('0x45')]=_0x2a12('0x9f');logger[_0x2a12('0x83')](_0x2a12('0xa0')+_0x509a74[_0x2a12('0x4a')],_0x35d8d6[0x0][_0x2a12('0xa1')],'contacts');}else{_0x509a74['message']=_0x2a12('0xa2');logger[_0x2a12('0x83')](_0x2a12('0xa3')+_0x509a74['name']);}}};}function notSendMessagesQueue(_0xa52d51){if(_0xa52d51[_0x2a12('0xa4')]){freeVariablesPredictive(_0xa52d51);if(_0xa52d51[_0x2a12('0x78')]===0x0&&_0xa52d51[_0x2a12('0xa5')]===0x0&&_0xa52d51[_0x2a12('0xa6')]===0x0&&(_0xa52d51[_0x2a12('0x56')]||0x0)===0x0){_0xa52d51[_0x2a12('0xa4')]=![];_0xa52d51['available']=0x0;_0xa52d51[_0x2a12('0x45')]=_0x2a12('0x47');loggerSyncQueueSummary[_0x2a12('0x99')](_0x2a12('0xa7'),_0xa52d51[_0x2a12('0x4a')],_0x2a12('0xa8'));}else{_0xa52d51['message']=_0x2a12('0xa9');loggerSyncQueueSummary['error']('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0xa52d51['name'],_0x2a12('0xaa'));}emitVoiceQueueSummary(_0xa52d51);}}function notSendMessagesCampaign(_0x3156b0){if(_0x3156b0['sendMessageOneNotActive']){if(_0x3156b0['originated']===0x0){_0x3156b0[_0x2a12('0xa4')]=![];_0x3156b0[_0x2a12('0x45')]='NOT_ACTIVE';loggerSyncQueueSummary[_0x2a12('0x99')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x3156b0[_0x2a12('0x4a')],_0x2a12('0xa8'));}else{_0x3156b0[_0x2a12('0x45')]=_0x2a12('0xa9');loggerSyncQueueSummary['error'](_0x2a12('0xab'),_0x3156b0[_0x2a12('0x4a')],_0x2a12('0xaa'));}emitCampaignSummary(_0x3156b0);}}function createObjHistory(_0x4f664e,_0x1e48c1,_0x19999a,_0x4ce239,_0x5f03b8){_0x4f664e[_0x2a12('0x45')]=_0x19999a;var _0x4b0861=new Action(_0x4f664e,_0x1e48c1);var _0x503471=new History(_0x4b0861);_0x503471['state']=_0x4ce239;_0x503471['statedesc']=_0x5f03b8;_0x503471[_0x2a12('0xac')]=_0x4b0861[_0x2a12('0xad')];return _0x503471;}Dialer['prototype'][_0x2a12('0x43')]=function(){var _0x5195a0=this;setInterval(function(){_0x5195a0[_0x2a12('0xae')](_0x5195a0[_0x2a12('0x29')],'[uniqueid]');_0x5195a0['clearZombieChannels'](_0x5195a0[_0x2a12('0x27')],'[actions]');},0x32c8);};Dialer[_0x2a12('0xaf')][_0x2a12('0xae')]=function(_0x23549d,_0x1f1545){var _0x58a809=this;for(var _0x47ffef in _0x23549d){if(typeof _0x23549d[_0x47ffef]!=='undefined'){this[_0x2a12('0x21')][_0x2a12('0x1e')](function(){if(!_['isNil'](_0x23549d[_0x47ffef])){return ami['Action']({'action':'status','channel':_0x23549d[_0x47ffef]['channel']})[_0x2a12('0xb0')](function(_0x47910a){if(_0x47910a[_0x2a12('0x45')]===_0x2a12('0xb1')){setTimeout(function(){if(_0x23549d[_0x47ffef]&&_0x23549d[_0x47ffef][_0x2a12('0x5b')]!=='ivr'){_0x58a809[_0x2a12('0xb2')](_0x58a809[_0x2a12('0x22')][_0x23549d[_0x47ffef][_0x2a12('0xb3')]]);logger[_0x2a12('0x99')](_0x2a12('0xb4'),_0x1f1545,_0x47ffef,_0x23549d[_0x47ffef]['queue']);delete _0x23549d[_0x47ffef];}if(_0x23549d[_0x47ffef]&&_0x23549d[_0x47ffef][_0x2a12('0x5b')]===_0x2a12('0x7f')){_0x58a809['updateOriginated'](_0x58a809['campaigns'][_0x23549d[_0x47ffef]['queue']]);logger['error'](_0x2a12('0xb5'),_0x1f1545,_0x47ffef,_0x23549d[_0x47ffef][_0x2a12('0xb3')]);delete _0x23549d[_0x47ffef];}},0x2328);}});}});}}};Dialer[_0x2a12('0xaf')][_0x2a12('0xb6')]=function(_0x4f0b8a){return BPromise[_0x2a12('0xb7')]()[_0x2a12('0xb8')](cmHopper[_0x2a12('0xb6')](_0x4f0b8a))[_0x2a12('0xb0')](loggerCatch('[countReScheduled]\x20'));};Dialer[_0x2a12('0xaf')][_0x2a12('0xb9')]=function(_0x110e0f){return BPromise[_0x2a12('0xb7')]()[_0x2a12('0xb8')](cmHopperBlack['checkIsBlackList'](_0x110e0f))[_0x2a12('0xb0')](loggerCatch('[checkIsBlackList]\x20'));};Dialer[_0x2a12('0xaf')][_0x2a12('0xba')]=function(_0x591bb4){return BPromise[_0x2a12('0xb7')]()[_0x2a12('0xb8')](cmHopperBlack['checkIsBlackListIvr'](_0x591bb4))['catch'](loggerCatch(_0x2a12('0xbb')));};Dialer[_0x2a12('0xaf')][_0x2a12('0xbc')]=function(_0x241db2){return BPromise['resolve']()[_0x2a12('0xb8')](cmHopperHistory[_0x2a12('0xbd')](_0x241db2))[_0x2a12('0xb0')](loggerCatch('[averageHandleTime]\x20'));};Dialer['prototype'][_0x2a12('0xbe')]=function(_0x23d6e8){return BPromise[_0x2a12('0xb7')]()[_0x2a12('0xb8')](cmHopper[_0x2a12('0xbe')](_0x23d6e8))[_0x2a12('0xb0')](loggerCatch(_0x2a12('0xbf')));};Dialer[_0x2a12('0xaf')]['unlockContact']=function(_0x3e390d,_0x2b5e05,_0x42cc86){return BPromise[_0x2a12('0xb7')]()['then'](cmHopper['unlockContact'](_0x3e390d,_0x2b5e05,_0x42cc86))[_0x2a12('0xb0')](loggerCatch('[unlockContact]\x20'));};Dialer[_0x2a12('0xaf')][_0x2a12('0xc0')]=function(_0x512694,_0x2adc33,_0x3cc16d,_0x4e4756,_0x513a14){return BPromise[_0x2a12('0xb7')]()[_0x2a12('0xb8')](cmHopper[_0x2a12('0xc0')](_0x512694,_0x2adc33,_0x3cc16d,_0x4e4756))[_0x2a12('0xb0')](function(_0x2640e2){_0x513a14[_0x2a12('0xc1')]-=_0x3cc16d;_0x513a14['temp']=_0x513a14[_0x2a12('0xc1')]>0x0?_0x513a14[_0x2a12('0xc1')]:0x0;loggerCatch(_0x2a12('0xc2'))(_0x2640e2);});};Dialer[_0x2a12('0xaf')][_0x2a12('0xc3')]=function(_0x2a2a8d,_0x45aacd,_0x29db73,_0x4c427f){return BPromise['resolve']()['then'](cmHopper[_0x2a12('0xc3')](_0x2a2a8d,_0x45aacd,_0x29db73))['catch'](function(_0x46e8d7){_0x4c427f[_0x2a12('0xc1')]-=_0x45aacd;_0x4c427f[_0x2a12('0xc1')]=_0x4c427f[_0x2a12('0xc1')]>0x0?_0x4c427f[_0x2a12('0xc1')]:0x0;loggerCatch(_0x2a12('0xc4'))(_0x46e8d7);});};Dialer['prototype'][_0x2a12('0xc5')]=function(_0x2ac05a){return BPromise[_0x2a12('0xb7')]()[_0x2a12('0xb8')](voiceQueueRt[_0x2a12('0xc5')](_0x2ac05a))[_0x2a12('0xb0')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0x2a12('0xaf')]['moveContactManagedDialer']=function(_0x3b0193){return BPromise[_0x2a12('0xb7')]()['then'](cmHopper['moveContactManagedDialer'](_0x3b0193))[_0x2a12('0xb0')](loggerCatch('[moveContactManagedDialer]\x20'));};Dialer['prototype']['createHistory']=function(_0x1a66f9){return BPromise[_0x2a12('0xb7')]()[_0x2a12('0xb8')](cmHopperHistory['createHistory'](_0x1a66f9))[_0x2a12('0xb0')](loggerCatch('[createHistory]\x20'));};Dialer[_0x2a12('0xaf')][_0x2a12('0xb2')]=function(_0x4b9169){if(!_['isUndefined'](_0x4b9169)&&_0x4b9169!==null){if(typeof _0x4b9169['originated']!==_0x2a12('0x9d')){if(_0x4b9169[_0x2a12('0x78')]>0x0){_0x4b9169['originated']-=0x1;}else{logger[_0x2a12('0x99')](_0x2a12('0xc6'));}}}else{logger[_0x2a12('0x99')]('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer[_0x2a12('0xaf')][_0x2a12('0xc7')]=function(_0x4ed330,_0x12740b){var _0x55d5ac=this;return function(_0x2f4067){_0x55d5ac[_0x2a12('0xb2')](_0x12740b);logger[_0x2a12('0x99')](_0x4ed330,util[_0x2a12('0x9a')](_0x2f4067,{'showHidden':![],'depth':null}));};};Dialer[_0x2a12('0xaf')][_0x2a12('0xc8')]=function(_0x5c3a79,_0x5e2eb0,_0x178342){var _0x2c6653={'state':0x19,'statedesc':_0x2a12('0xc9')};this['updateOriginated'](_0x5e2eb0);this[_0x2a12('0xca')](_[_0x2a12('0x93')](_0x2c6653,_[_0x2a12('0xcb')](_0x178342,[_0x2a12('0xcc'),_0x2a12('0xcd'),_0x2a12('0xce'),'VoiceQueueId',_0x2a12('0xcf')])),_0x2a12('0xd0'),_0x2a12('0xd1'));logger[_0x2a12('0x99')](_0x5c3a79);};Dialer[_0x2a12('0xaf')][_0x2a12('0xd2')]=function(_0x38f7c8){return _0x38f7c8==='Success';};Dialer[_0x2a12('0xaf')][_0x2a12('0xd3')]=function(_0x483ad5){return!_[_0x2a12('0x44')](_0x483ad5)&&_0x483ad5&&!_['isUndefined'](_0x483ad5[_0x2a12('0x4a')])&&!_['isUndefined'](_0x483ad5[_0x2a12('0xd4')])&&_0x483ad5[_0x2a12('0xd4')]&&(this[_0x2a12('0x25')][util[_0x2a12('0x80')](_0x2a12('0xd5'),_0x483ad5[_0x2a12('0x4a')])][_0x2a12('0xd6')]===_0x2a12('0xd7')||this[_0x2a12('0x25')][util[_0x2a12('0x80')](_0x2a12('0xd5'),_0x483ad5['name'])][_0x2a12('0xd6')]==='unmonitored');};Dialer[_0x2a12('0xaf')][_0x2a12('0xca')]=function(_0x4364c7,_0x1324eb,_0x4c1810){this[_0x2a12('0xd8')](_0x4364c7)['catch'](loggerCatch(_0x1324eb));this[_0x2a12('0xd9')](_0x4364c7)['catch'](loggerCatch(_0x4c1810));};Dialer[_0x2a12('0xaf')][_0x2a12('0x3d')]=function(_0x153c59){var _0x4aaa64=this[_0x2a12('0x29')][_0x153c59[_0x2a12('0xda')]];var _0x543a4f;if(!_['isNil'](_0x153c59)&&!_['isNil'](_0x153c59[_0x2a12('0xdb')])&&!_[_0x2a12('0xdc')](_0x153c59[_0x2a12('0xdb')][_0x2a12('0xdd')])&&_0x153c59[_0x2a12('0xde')]===_0x2a12('0xdf')&&_0x4aaa64){if(_0x4aaa64[_0x2a12('0x5b')]!==_0x2a12('0x7f')&&this[_0x2a12('0x22')][_0x4aaa64['queue']][_0x2a12('0xe0')]&&_0x153c59['value']==='HANGUP'){delete this['uniqueId'][_0x153c59[_0x2a12('0xda')]];this['updateOriginated'](this['voiceQueues'][_0x4aaa64[_0x2a12('0xb3')]]);this[_0x2a12('0x22')][_0x4aaa64[_0x2a12('0xb3')]][_0x2a12('0x65')]+=0x1;this[_0x2a12('0x22')][_0x4aaa64[_0x2a12('0xb3')]][_0x2a12('0xe1')]+=0x1;_0x543a4f=new Hangup(_0x4aaa64,_0x153c59);_0x543a4f['state']=0x12;_0x543a4f['statedesc']=_0x2a12('0xe2');_0x543a4f[_0x2a12('0xe3')]=_0x2a12('0xe4');ami[_0x2a12('0x52')](_0x2a12('0xe5'),ut['buildObj'](_0x543a4f,_0x2a12('0xe6')));this[_0x2a12('0xca')](_0x543a4f,_0x2a12('0xe7'),_0x2a12('0xe8'));}if(_0x4aaa64[_0x2a12('0x5b')]!==_0x2a12('0x7f')&&this[_0x2a12('0x22')][_0x4aaa64[_0x2a12('0xb3')]][_0x2a12('0xe0')]&&_0x153c59[_0x2a12('0xe9')]===_0x2a12('0xea')){var _0x2066e8=this;return new BPromise(function(_0x2cf056,_0x474a6a){delete _0x2066e8[_0x2a12('0x29')][_0x153c59[_0x2a12('0xda')]];_0x2066e8[_0x2a12('0xb2')](_0x2066e8[_0x2a12('0x22')][_0x4aaa64['queue']]);_0x2066e8[_0x2a12('0x22')][_0x4aaa64[_0x2a12('0xb3')]][_0x2a12('0x65')]+=0x1;_0x2066e8[_0x2a12('0x22')][_0x4aaa64[_0x2a12('0xb3')]][_0x2a12('0xe1')]+=0x1;var _0x241dd5=_0x2066e8['voiceQueues'][_0x4aaa64[_0x2a12('0xb3')]];var _0x49f51f=new Hangup(_0x4aaa64,_0x153c59);_0x49f51f[_0x2a12('0xeb')]=0x13;_0x49f51f[_0x2a12('0xec')]=_0x2a12('0xed');_0x49f51f['membername']=_0x2a12('0xe4');_0x49f51f[_0x2a12('0xee')]+=0x1;_0x49f51f[_0x2a12('0xef')]+=0x1;_0x49f51f[_0x2a12('0xe6')]=!![];ami[_0x2a12('0x52')]('custom:amd',ut[_0x2a12('0xf0')](_0x49f51f,_0x2a12('0xe6')));_0x2066e8[_0x2a12('0xd8')](_0x49f51f)[_0x2a12('0xb0')](loggerCatch(_0x2a12('0xf1')));if(_0x49f51f[_0x2a12('0xf2')]+_0x49f51f['countcongestionretry']+_0x49f51f[_0x2a12('0xf3')]+_0x49f51f[_0x2a12('0xf4')]+_0x49f51f[_0x2a12('0xf5')]+_0x49f51f[_0x2a12('0xf6')]+_0x49f51f[_0x2a12('0xee')]+_0x49f51f[_0x2a12('0xf7')]>=_0x241dd5[_0x2a12('0xf8')]){_0x2066e8[_0x2a12('0xf9')](_0x49f51f,_0x2cf056,_0x474a6a,_0x2a12('0xfa'));}else{if(_0x49f51f[_0x2a12('0xee')]>=_0x241dd5['dialMachineMaxRetry']){_0x2066e8[_0x2a12('0xfb')](_0x49f51f,_0x2cf056,_0x474a6a,'reason\x2019\x20machine....');}else{_0x2066e8['rescheduleContact']({'active':![],'countmachineretry':_0x49f51f[_0x2a12('0xee')],'scheduledat':moment()[_0x2a12('0xfc')](_0x241dd5[_0x2a12('0xfd')],'minutes')[_0x2a12('0x80')](_0x2a12('0xfe')),'ContactId':_0x49f51f['ContactId'],'ListId':_0x49f51f[_0x2a12('0xcd')],'VoiceQueueId':_0x49f51f[_0x2a12('0xff')]||undefined,'CampaignId':_0x49f51f[_0x2a12('0xcf')]||undefined})['catch'](loggerCatch(_0x2a12('0x100')));_0x2cf056({'reschedule':0x1});}}});}if(_0x4aaa64[_0x2a12('0x5b')]===_0x2a12('0x7f')&&this[_0x2a12('0x23')][_0x4aaa64[_0x2a12('0xb3')]][_0x2a12('0xe0')]&&_0x153c59[_0x2a12('0xe9')]==='HANGUP'){delete this[_0x2a12('0x29')][_0x153c59[_0x2a12('0xda')]];this['updateOriginated'](this['campaigns'][_0x4aaa64[_0x2a12('0xb3')]]);_0x543a4f=new Hangup(_0x4aaa64,_0x153c59);_0x543a4f[_0x2a12('0xeb')]=0x12;_0x543a4f['statedesc']=_0x2a12('0xe2');_0x543a4f[_0x2a12('0xe3')]=_0x2a12('0xe4');ami[_0x2a12('0x52')]('custom:amd',ut[_0x2a12('0xf0')](_0x543a4f,_0x2a12('0xe6')));this[_0x2a12('0xca')](_0x543a4f,_0x2a12('0x101'),'[syncHangupInAMDIvr]');}if(_0x4aaa64[_0x2a12('0x5b')]==='ivr'&&this[_0x2a12('0x23')][_0x4aaa64['queue']][_0x2a12('0xe0')]&&_0x153c59['value']===_0x2a12('0xea')){var _0x2066e8=this;return new BPromise(function(_0x3bab03,_0x32be3e){delete _0x2066e8['uniqueId'][_0x153c59[_0x2a12('0xda')]];_0x2066e8[_0x2a12('0xb2')](_0x2066e8[_0x2a12('0x23')][_0x4aaa64[_0x2a12('0xb3')]]);_0x2066e8[_0x2a12('0x23')][_0x4aaa64[_0x2a12('0xb3')]][_0x2a12('0x65')]+=0x1;_0x2066e8[_0x2a12('0x23')][_0x4aaa64['queue']][_0x2a12('0xe1')]+=0x1;var _0x4511c4=_0x2066e8[_0x2a12('0x23')][_0x4aaa64[_0x2a12('0xb3')]];var _0x1a8543=new Hangup(_0x4aaa64,_0x153c59);_0x1a8543[_0x2a12('0xeb')]=0x13;_0x1a8543['statedesc']=_0x2a12('0xed');_0x1a8543[_0x2a12('0xe3')]=_0x2a12('0xe4');_0x1a8543[_0x2a12('0xee')]+=0x1;_0x1a8543[_0x2a12('0xef')]+=0x1;_0x1a8543[_0x2a12('0xe6')]=!![];ami[_0x2a12('0x52')](_0x2a12('0xe5'),ut[_0x2a12('0xf0')](_0x1a8543,_0x2a12('0xe6')));_0x2066e8['createHistory'](_0x1a8543)[_0x2a12('0xb0')](loggerCatch(_0x2a12('0xf1')));if(_0x1a8543[_0x2a12('0xf2')]+_0x1a8543[_0x2a12('0x102')]+_0x1a8543[_0x2a12('0xf3')]+_0x1a8543[_0x2a12('0xf4')]+_0x1a8543['countdropretry']+_0x1a8543[_0x2a12('0xf6')]+_0x1a8543[_0x2a12('0xee')]+_0x1a8543['countagentrejectretry']>=_0x4511c4[_0x2a12('0xf8')]){_0x2066e8[_0x2a12('0xf9')](_0x1a8543,_0x3bab03,_0x32be3e,_0x2a12('0xfa'));}else{if(_0x1a8543[_0x2a12('0xee')]>=_0x4511c4[_0x2a12('0x103')]){_0x2066e8[_0x2a12('0xfb')](_0x1a8543,_0x3bab03,_0x32be3e,_0x2a12('0x104'));}else{_0x2066e8[_0x2a12('0xbe')]({'active':![],'countmachineretry':_0x1a8543[_0x2a12('0xee')],'scheduledat':moment()['add'](_0x4511c4['dialMachineRetryFrequency'],_0x2a12('0x105'))[_0x2a12('0x80')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1a8543[_0x2a12('0xcc')],'ListId':_0x1a8543['ListId'],'VoiceQueueId':_0x1a8543[_0x2a12('0xff')]||undefined,'CampaignId':_0x1a8543[_0x2a12('0xcf')]||undefined})[_0x2a12('0xb0')](loggerCatch(_0x2a12('0x100')));_0x3bab03({'reschedule':0x1});}}});}}};Dialer[_0x2a12('0xaf')]['syncHangup']=function(_0x1590f4){var _0x5d28b7=this[_0x2a12('0x29')][_0x1590f4['uniqueid']];var _0x3db969=this;var _0x4af299;if(_0x5d28b7&&_0x5d28b7['type']===_0x2a12('0x7f')){delete this[_0x2a12('0x29')][_0x1590f4[_0x2a12('0xda')]];this['updateOriginated'](this['campaigns'][_0x5d28b7['queue']]);this[_0x2a12('0x23')][_0x5d28b7[_0x2a12('0xb3')]][_0x2a12('0x106')]+=0x1;_0x4af299=new Hangup(_0x5d28b7,_0x1590f4);this['createHistory'](_0x4af299)['catch'](loggerCatch(_0x2a12('0x107')));this[_0x2a12('0xd9')](_0x4af299)[_0x2a12('0xb0')](loggerCatch(_0x2a12('0x108')));}if(_0x5d28b7&&_0x5d28b7[_0x2a12('0x5b')]!==_0x2a12('0x7f')&&isNotNull(this[_0x2a12('0x22')][_0x5d28b7[_0x2a12('0xb3')]]['dialQueueProject'])){delete this[_0x2a12('0x29')][_0x1590f4[_0x2a12('0xda')]];this[_0x2a12('0xb2')](this[_0x2a12('0x22')][_0x5d28b7[_0x2a12('0xb3')]]);this[_0x2a12('0x22')][_0x5d28b7[_0x2a12('0xb3')]][_0x2a12('0x65')]+=0x1;this[_0x2a12('0x22')][_0x5d28b7['queue']][_0x2a12('0xe1')]+=0x1;_0x4af299=new Hangup(_0x5d28b7,_0x1590f4);_0x4af299['state']=0x10;_0x4af299['statedesc']=_0x2a12('0x109');_0x4af299[_0x2a12('0xe3')]=_0x2a12('0x10a');this[_0x2a12('0xd8')](_0x4af299)[_0x2a12('0xb0')](loggerCatch(_0x2a12('0x107')));this['moveContactManagedDialer'](_0x4af299)[_0x2a12('0xb0')](loggerCatch(_0x2a12('0x108')));}if(_0x5d28b7&&_0x5d28b7[_0x2a12('0x5b')]!==_0x2a12('0x7f')&&!isNotNull(this[_0x2a12('0x22')][_0x5d28b7['queue']][_0x2a12('0x10b')])){delete this[_0x2a12('0x29')][_0x1590f4['uniqueid']];this[_0x2a12('0xb2')](this['voiceQueues'][_0x5d28b7[_0x2a12('0xb3')]]);this[_0x2a12('0x22')][_0x5d28b7[_0x2a12('0xb3')]][_0x2a12('0x6f')]+=0x1;_0x4af299=new Hangup(_0x5d28b7,_0x1590f4);_0x4af299['state']=0xc;_0x4af299['statedesc']=_0x1590f4[_0x2a12('0x10c')];_0x4af299[_0x2a12('0xe3')]=_0x2a12('0x10d');this[_0x2a12('0xd8')](_0x4af299)[_0x2a12('0xb0')](loggerCatch(_0x2a12('0x107')));this[_0x2a12('0xd9')](_0x4af299)[_0x2a12('0xb0')](loggerCatch(_0x2a12('0x108')));}};Dialer[_0x2a12('0xaf')][_0x2a12('0x10e')]=function(_0x1863bd){var _0x5f4502=this[_0x2a12('0x29')][_0x1863bd[_0x2a12('0xda')]];var _0x1b16fc=this;if(this[_0x2a12('0x22')][_0x1863bd[_0x2a12('0xb3')]]){if(_0x5f4502&&_0x5f4502['type']!==_0x2a12('0x7f')){delete this[_0x2a12('0x29')][_0x1863bd[_0x2a12('0xda')]];this[_0x2a12('0x22')][_0x1863bd['queue']][_0x2a12('0x65')]+=0x1;var _0xf56b2c=new AgentComplete(_0x5f4502,_0x1863bd);if(_0x1863bd[_0x2a12('0x10f')]===_0x2a12('0x110')){_0xf56b2c[_0x2a12('0x111')]=this['voiceQueues'][_0x1863bd[_0x2a12('0xb3')]]['dialQueueProject2']&&this['voiceQueues'][_0x1863bd['queue']]['dialAgiAfterHangupAgent']?moment()[_0x2a12('0x80')](_0x2a12('0xfe')):undefined;}this[_0x2a12('0xd8')](_0xf56b2c)[_0x2a12('0xb0')](loggerCatch('[syncAgentComplete][createHistory]'));this[_0x2a12('0xd9')](_0xf56b2c)['catch'](loggerCatch(_0x2a12('0x112')));}}};Dialer['prototype'][_0x2a12('0x30')]=function(_0x40a3c4){if(this[_0x2a12('0x22')][_0x40a3c4[_0x2a12('0xb3')]]){if(this[_0x2a12('0x29')][_0x40a3c4[_0x2a12('0xda')]]&&this[_0x2a12('0x29')][_0x40a3c4[_0x2a12('0xda')]][_0x2a12('0x5b')]!==_0x2a12('0x7f')){this['updateOriginated'](this[_0x2a12('0x22')][_0x40a3c4[_0x2a12('0xb3')]]);this[_0x2a12('0x29')][_0x40a3c4[_0x2a12('0xda')]][_0x2a12('0x113')]=moment()['format'](_0x2a12('0xfe'));}}};Dialer[_0x2a12('0xaf')][_0x2a12('0x114')]=function(_0x433233){this[_0x2a12('0xd8')](_0x433233)[_0x2a12('0xb0')](loggerCatch('[syncAgentComplete][createHistory]'));this[_0x2a12('0xd9')](_0x433233)[_0x2a12('0xb0')](loggerCatch(_0x2a12('0x115')));};Dialer[_0x2a12('0xaf')][_0x2a12('0x33')]=function(_0x1a4e60){var _0x507f69=this['uniqueId'][_0x1a4e60[_0x2a12('0xda')]];var _0x5a7f2b=this;if(this['voiceQueues'][_0x1a4e60['queue']]){if(_0x507f69&&_0x507f69[_0x2a12('0x5b')]!==_0x2a12('0x7f')){delete this[_0x2a12('0x29')][_0x1a4e60[_0x2a12('0xda')]];this['updateOriginated'](this[_0x2a12('0x22')][_0x1a4e60[_0x2a12('0xb3')]]);_0x507f69['droptime']=moment()[_0x2a12('0x80')](_0x2a12('0xfe'));var _0x4bc5f1=new QueueCallerAbandon(_0x507f69,_0x1a4e60);if(getSeconds(_0x507f69[_0x2a12('0x116')],_0x507f69[_0x2a12('0x117')])>=_0x507f69[_0x2a12('0x118')]){this[_0x2a12('0x22')][_0x1a4e60[_0x2a12('0xb3')]][_0x2a12('0x73')]+=0x1;this['voiceQueues'][_0x1a4e60[_0x2a12('0xb3')]][_0x2a12('0x6b')]+=0x1;this[_0x2a12('0x22')][_0x1a4e60[_0x2a12('0xb3')]][_0x2a12('0x75')]+=0x1;_0x4bc5f1[_0x2a12('0xeb')]=0xa;_0x4bc5f1[_0x2a12('0xec')]=_0x2a12('0x119');_0x4bc5f1[_0x2a12('0x11a')]='TIMEOUT';_0x4bc5f1[_0x2a12('0x111')]=this[_0x2a12('0x22')][_0x1a4e60['queue']]['dialQueueProject2']?moment()[_0x2a12('0x80')](_0x2a12('0xfe')):undefined;_0x4bc5f1[_0x2a12('0xf5')]+=0x1;_0x4bc5f1[_0x2a12('0xef')]+=0x1;if(_0x4bc5f1['countdropretry']>=this[_0x2a12('0x22')][_0x1a4e60[_0x2a12('0xb3')]][_0x2a12('0x11b')]){this['queueCallerAbandonCreateState'](_0x4bc5f1);}else{this['rescheduleContact']({'active':![],'countdropretry':_0x4bc5f1[_0x2a12('0xf5')],'scheduledat':moment()[_0x2a12('0xfc')](this['voiceQueues'][_0x1a4e60[_0x2a12('0xb3')]][_0x2a12('0x11c')],'minutes')[_0x2a12('0x80')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x507f69[_0x2a12('0xcc')],'ListId':_0x507f69[_0x2a12('0xcd')],'VoiceQueueId':_0x507f69[_0x2a12('0xff')]||undefined,'CampaignId':_0x507f69[_0x2a12('0xcf')]||undefined})[_0x2a12('0xb0')](loggerCatch(_0x2a12('0x11d')));var _0x316a3d=new History(_0x4bc5f1);_0x316a3d[_0x2a12('0xeb')]=0xa;_0x316a3d['statedesc']='Drop';_0x316a3d[_0x2a12('0xad')]=moment()[_0x2a12('0x80')](_0x2a12('0xfe'));_0x316a3d[_0x2a12('0xac')]=_0x316a3d[_0x2a12('0xad')];_0x316a3d[_0x2a12('0x11e')]=_0x4bc5f1[_0x2a12('0x11e')];_0x316a3d[_0x2a12('0x11f')]=_0x4bc5f1[_0x2a12('0x11f')];this[_0x2a12('0xd8')](_0x316a3d)[_0x2a12('0xb0')](loggerCatch(_0x2a12('0x120')));}}else{this['voiceQueues'][_0x1a4e60[_0x2a12('0xb3')]][_0x2a12('0x72')]+=0x1;this[_0x2a12('0x22')][_0x1a4e60[_0x2a12('0xb3')]][_0x2a12('0x6a')]+=0x1;_0x4bc5f1[_0x2a12('0xeb')]=0xb;_0x4bc5f1['statedesc']=_0x2a12('0x121');_0x4bc5f1[_0x2a12('0x11a')]=_0x2a12('0x122');_0x4bc5f1[_0x2a12('0xf6')]+=0x1;_0x4bc5f1['countglobal']+=0x1;if(_0x4bc5f1['countabandonedretry']>=this['voiceQueues'][_0x1a4e60[_0x2a12('0xb3')]]['dialAbandonedMaxRetry']){this['queueCallerAbandonCreateState'](_0x4bc5f1);}else{this['rescheduleContact']({'active':![],'countabandonedretry':_0x4bc5f1[_0x2a12('0xf6')],'scheduledat':moment()[_0x2a12('0xfc')](this[_0x2a12('0x22')][_0x1a4e60['queue']]['dialAbandonedRetryFrequency'],_0x2a12('0x105'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x507f69[_0x2a12('0xcc')],'ListId':_0x507f69['ListId'],'VoiceQueueId':_0x507f69[_0x2a12('0xff')]||undefined,'CampaignId':_0x507f69[_0x2a12('0xcf')]||undefined})[_0x2a12('0xb0')](loggerCatch(_0x2a12('0x123')));var _0x316a3d=new History(_0x4bc5f1);_0x316a3d[_0x2a12('0xeb')]=0xb;_0x316a3d[_0x2a12('0xec')]=_0x2a12('0x121');_0x316a3d['starttime']=moment()[_0x2a12('0x80')](_0x2a12('0xfe'));_0x316a3d[_0x2a12('0xac')]=_0x316a3d['starttime'];_0x316a3d[_0x2a12('0x11e')]=_0x4bc5f1[_0x2a12('0x11e')];_0x316a3d[_0x2a12('0x11f')]=_0x4bc5f1[_0x2a12('0x11f')];this[_0x2a12('0xd8')](_0x316a3d)[_0x2a12('0xb0')](loggerCatch(_0x2a12('0x124')));}}}}};Dialer[_0x2a12('0xaf')]['syncNewExten']=function(_0x1ee363){if(this[_0x2a12('0x27')][_0x1ee363[_0x2a12('0xda')]]){this[_0x2a12('0x27')][_0x1ee363[_0x2a12('0xda')]]['channel']=_0x1ee363[_0x2a12('0x125')];}if(this[_0x2a12('0x29')][_0x1ee363['uniqueid']]){this['uniqueId'][_0x1ee363['uniqueid']][_0x2a12('0x125')]=_0x1ee363[_0x2a12('0x125')];}};Dialer[_0x2a12('0xaf')]['syncQueueMember']=function(_0x56dcbc){if(strategy[this['voiceQueues'][this[_0x2a12('0x27')][_0x56dcbc[_0x2a12('0x126')]][_0x2a12('0xb3')]][_0x2a12('0x54')]]===_0x2a12('0x1d')){if(this[_0x2a12('0x27')][_0x56dcbc[_0x2a12('0x126')]]&&_[_0x2a12('0xdc')](this[_0x2a12('0x27')][_0x56dcbc['actionid']][_0x2a12('0x127')])&&_0x56dcbc[_0x2a12('0xd6')]==='1'&&_0x56dcbc[_0x2a12('0x128')]==='0'){if(this['agents'][_0x56dcbc[_0x2a12('0x129')]]){if(!this['agents'][_0x56dcbc['stateinterface']][_0x2a12('0x127')]){this['agents'][_0x56dcbc[_0x2a12('0x129')]][_0x2a12('0x127')]=!![];this[_0x2a12('0x27')][_0x56dcbc[_0x2a12('0x126')]][_0x2a12('0x127')]=!![];this[_0x2a12('0x27')][_0x56dcbc[_0x2a12('0x126')]][_0x2a12('0x129')]=_0x56dcbc['stateinterface'];}}}}else if((strategy[this[_0x2a12('0x22')][this[_0x2a12('0x27')][_0x56dcbc[_0x2a12('0x126')]]['queue']][_0x2a12('0x54')]]||_0x2a12('0x12a'))===_0x2a12('0x12a')){if(this[_0x2a12('0x27')][_0x56dcbc[_0x2a12('0x126')]]){if(this[_0x2a12('0x24')][_0x56dcbc[_0x2a12('0x129')]]){this[_0x2a12('0x27')][_0x56dcbc[_0x2a12('0x126')]]['stateinterface']=_0x56dcbc[_0x2a12('0x129')];if(_['isNil'](this[_0x2a12('0x2d')][this[_0x2a12('0x27')][_0x56dcbc[_0x2a12('0x126')]][_0x2a12('0xb3')]])){this[_0x2a12('0x2d')][this[_0x2a12('0x27')][_0x56dcbc[_0x2a12('0x126')]][_0x2a12('0xb3')]]=[];}this[_0x2a12('0x2d')][this['actions'][_0x56dcbc[_0x2a12('0x126')]]['queue']][_0x2a12('0x12b')](_['merge'](_[_0x2a12('0xcb')](this['actions'][_0x56dcbc['actionid']],['idHopper',_0x2a12('0x129')]),{'status':_0x56dcbc['status'],'paused':_0x56dcbc[_0x2a12('0x128')]}));}}}};function unlockQueueStatus(_0x2a5e92,_0x1997e5){setTimeout(function(){if(_['isUndefined'](_0x2a5e92['queueStatusComplete'])){loggerBooked['error'](_0x2a12('0x12c'),_0x1997e5);}_0x2a5e92['queueStatusComplete']=!![];loggerBooked[_0x2a12('0x83')](_0x2a12('0x12d'),_0x1997e5,JSON['stringify'](_[_0x2a12('0xcb')](_0x2a5e92,[_0x2a12('0x4a'),_0x2a12('0x12e')])));},0x1f3);}Dialer[_0x2a12('0xaf')][_0x2a12('0x41')]=function(_0x4c2919){var _0x1122e9=this;var _0x213cf8=_0x1122e9['voiceQueues'][_0x1122e9[_0x2a12('0x27')][_0x4c2919[_0x2a12('0x126')]]['queue']];if(strategy[this[_0x2a12('0x22')][this['actions'][_0x4c2919[_0x2a12('0x126')]][_0x2a12('0xb3')]][_0x2a12('0x54')]]==='roundrobin'){if(this['actions'][_0x4c2919[_0x2a12('0x126')]]&&this['actions'][_0x4c2919['actionid']][_0x2a12('0x129')]){this[_0x2a12('0x96')][_0x2a12('0x12f')](this[_0x2a12('0x27')][_0x4c2919[_0x2a12('0x126')]][_0x2a12('0x130')],this['actions'][_0x4c2919[_0x2a12('0x126')]][_0x2a12('0x129')])[_0x2a12('0xb0')](function(_0x28a893){logger[_0x2a12('0x99')](_0x2a12('0x131'),util['inspect'](_0x28a893,{'showHidden':![],'depth':null}));})[_0x2a12('0x20')](function(){_0x1122e9[_0x2a12('0xb2')](_0x1122e9[_0x2a12('0x22')][_0x1122e9[_0x2a12('0x27')][_0x4c2919[_0x2a12('0x126')]]['queue']]);_0x1122e9[_0x2a12('0x24')][_0x1122e9[_0x2a12('0x27')][_0x4c2919['actionid']][_0x2a12('0x129')]][_0x2a12('0x127')]=![];delete _0x1122e9[_0x2a12('0x27')][_0x4c2919['actionid']];unlockQueueStatus(_0x213cf8);});}else{this[_0x2a12('0xb2')](this['voiceQueues'][this['actions'][_0x4c2919['actionid']][_0x2a12('0xb3')]]);this['rescheduleContact']({'active':![],'ContactId':this[_0x2a12('0x27')][_0x4c2919[_0x2a12('0x126')]]['ContactId'],'ListId':this['actions'][_0x4c2919[_0x2a12('0x126')]][_0x2a12('0xcd')],'VoiceQueueId':this['actions'][_0x4c2919[_0x2a12('0x126')]]['VoiceQueueId']||undefined,'CampaignId':this['actions'][_0x4c2919['actionid']][_0x2a12('0xcf')]||undefined})[_0x2a12('0xb0')](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this[_0x2a12('0x27')][_0x4c2919[_0x2a12('0x126')]];unlockQueueStatus(_0x213cf8);}}else if((strategy[this['voiceQueues'][this[_0x2a12('0x27')][_0x4c2919[_0x2a12('0x126')]][_0x2a12('0xb3')]][_0x2a12('0x54')]]||'rrmemory')===_0x2a12('0x12a')){var _0x472be5;if(this[_0x2a12('0x27')][_0x4c2919[_0x2a12('0x126')]]&&!_['isEmpty'](this['queueBooked'][this['actions'][_0x4c2919[_0x2a12('0x126')]]['queue']])){if(this['queueBookedRR'][_0x1122e9['actions'][_0x4c2919[_0x2a12('0x126')]][_0x2a12('0xb3')]]){this[_0x2a12('0x2e')][_0x1122e9['actions'][_0x4c2919['actionid']]['queue']]=this[_0x2a12('0x2e')][this[_0x2a12('0x27')][_0x4c2919['actionid']][_0x2a12('0xb3')]]?this[_0x2a12('0x2e')][this[_0x2a12('0x27')][_0x4c2919['actionid']][_0x2a12('0xb3')]]:this['queueBooked'][this[_0x2a12('0x27')][_0x4c2919['actionid']][_0x2a12('0xb3')]]?this[_0x2a12('0x2d')][this[_0x2a12('0x27')][_0x4c2919['actionid']][_0x2a12('0xb3')]][_0x2a12('0x132')]||0x0:0x0;}this['queueBooked'][this[_0x2a12('0x27')][_0x4c2919[_0x2a12('0x126')]]['queue']]['_rr']=this[_0x2a12('0x2e')][this[_0x2a12('0x27')][_0x4c2919[_0x2a12('0x126')]][_0x2a12('0xb3')]];for(var _0x5d384f=0x0;_0x5d384f=0x0;})[_0x2a12('0xb0')](myreject(_0x23491e)));}}else{_0x396157[_0x2a12('0x12b')](ami[_0x2a12('0x14f')]({'action':'command','command':util[_0x2a12('0x80')](_0x2a12('0x150'),_0x2ff9c2,!_[_0x2a12('0x44')](config['timezones'][_0x49e478])?_0x49e478:'')})[_0x2a12('0xb8')](function(_0x59b904){return _0x59b904[_0x2a12('0x14c')][_0x2a12('0x14d')](_0x2a12('0x14e'))>=0x0;})[_0x2a12('0xb0')](myreject(_0x23491e)));}BPromise[_0x2a12('0x151')](_0x396157)[_0x2a12('0xb8')](function(_0x377aec){var _0x1d95c5=_[_0x2a12('0x152')](_0x377aec);if(_0x1d95c5){return _0x1a0a2a(_0x1d95c5);}else{_0x575428[_0x2a12('0x45')]=_0x8a1b21?_0x2a12('0x153'):_0x2a12('0x154');return _0x23491e(msgResponse(_0x2a12('0x155'),_0x2a12('0x145'),_0x2a12('0x156')+_0x8a1b21+'\x20'+_0x4b4f77+_0x2a12('0x157')+util['inspect'](_0x2ff9c2,{'showHidden':![],'depth':null})+_0x2a12('0x158')+_0x49e478));}})[_0x2a12('0xb0')](function(_0x41ef92){return _0x23491e(msgResponse('ifTime',_0x2a12('0x145'),JSON[_0x2a12('0x4e')](_0x41ef92)));});});};Dialer[_0x2a12('0xaf')][_0x2a12('0x159')]=function(_0x2f434f){var _0x400cd9=this;return function(){switch(_0x2f434f[_0x2a12('0x60')]){case _0x2a12('0x15a'):freeVariablesPredictive(_0x2f434f);_0x400cd9['handlePower'](_0x2f434f,0x1);break;case _0x2a12('0x15b'):freeVariablesPredictive(_0x2f434f);_0x400cd9[_0x2a12('0x15c')](_0x2f434f,_0x2f434f[_0x2a12('0x15d')]);break;case'predictive':_0x400cd9[_0x2a12('0x15e')](_0x2f434f);break;case _0x2a12('0xb'):freeVariablesPredictive(_0x2f434f);_0x400cd9[_0x2a12('0x15c')](_0x2f434f,0x1);break;default:freeVariablesPredictive(_0x2f434f);logger['error'](_0x2a12('0x15f'),_0x2f434f[_0x2a12('0x4a')],'method\x20not\x20recognized');}};};Dialer[_0x2a12('0xaf')][_0x2a12('0x160')]=function(_0x4f8630){var _0x12e4f3=this;return function(){_0x12e4f3[_0x2a12('0x161')](_0x4f8630);};};Dialer[_0x2a12('0xaf')]['syncQueueSummary']=function(_0x387f6e){var _0x2e9d60=this;if(isNotPreview(_0x387f6e[_0x2a12('0x60')])){if(isVoiceQueueOutbound(_0x387f6e[_0x2a12('0x5b')])&&isActive(_0x387f6e[_0x2a12('0x5f')])){_0x387f6e[_0x2a12('0xa4')]=!![];BPromise[_0x2a12('0xb7')]()[_0x2a12('0xb8')](checkIsLoggedIn(_0x387f6e,_0x387f6e['loggedIn']))['then'](checkIsActive(_0x387f6e,_0x387f6e['dialActive']))['then'](checkInterval(_0x387f6e))['then'](_0x2e9d60[_0x2a12('0x162')](_0x387f6e))[_0x2a12('0xb8')](_0x2e9d60[_0x2a12('0x140')](_0x387f6e[_0x2a12('0x163')],_0x387f6e[_0x2a12('0x164')],_0x387f6e[_0x2a12('0x4a')],_0x387f6e))[_0x2a12('0xb8')](_0x2e9d60[_0x2a12('0x141')](_0x387f6e[_0x2a12('0x48')],_0x387f6e[_0x2a12('0x164')],_0x387f6e['name'],_0x387f6e))[_0x2a12('0xb8')](_0x2e9d60[_0x2a12('0x159')](_0x387f6e))[_0x2a12('0xb0')](loggerCatchQueueSummary(_0x2a12('0x165'),_0x387f6e));}else{notSendMessagesQueue(_0x387f6e);}}else{freeVariablesPredictive(_0x387f6e);}};Dialer['prototype']['syncCampaigns']=function(){var _0x3189f0=this;var _0x4207a2;for(var _0x142931 in this[_0x2a12('0x23')]){if(typeof this['campaigns'][_0x142931]!==_0x2a12('0x9d')){_0x4207a2=this[_0x2a12('0x23')][_0x142931];if(isCampaignIvr(_0x4207a2[_0x2a12('0x5b')])&&isActive(_0x4207a2[_0x2a12('0xd4')])){_0x4207a2[_0x2a12('0xa4')]=!![];BPromise[_0x2a12('0xb7')]()['then'](checkIsActive(_0x4207a2,_0x4207a2[_0x2a12('0xd4')]))[_0x2a12('0xb8')](checkInterval(_0x4207a2))[_0x2a12('0xb8')](_0x3189f0[_0x2a12('0x162')](_0x4207a2))['then'](_0x3189f0[_0x2a12('0x140')](_0x4207a2[_0x2a12('0x163')],_0x4207a2[_0x2a12('0x164')],_0x4207a2[_0x2a12('0x4a')],_0x4207a2))[_0x2a12('0xb8')](_0x3189f0[_0x2a12('0x141')](_0x4207a2[_0x2a12('0x48')],_0x4207a2[_0x2a12('0x164')],_0x4207a2['name'],_0x4207a2))[_0x2a12('0xb8')](_0x3189f0[_0x2a12('0x160')](_0x4207a2))[_0x2a12('0xb0')](loggerCatchQueueSummary(_0x2a12('0x166'),_0x4207a2));}else{notSendMessagesCampaign(_0x4207a2);}}}};function getCallerIdRandom(_0x417760,_0x38b7ae){var _0x1ce090;var _0x12558f;var _0x105492;if(_0x38b7ae<=0x0){_0x38b7ae=0x1;}_0x1ce090=new RegExp(_0x2a12('0x167')+_0x38b7ae+'}$');_0x12558f=Math[_0x2a12('0x168')](0xa,_0x38b7ae-0x1);_0x105492=Math[_0x2a12('0x168')](0xa,_0x38b7ae)-0x1;return util[_0x2a12('0x80')]('%s',_['replace'](_0x417760,_0x1ce090,_['random'](_0x12558f,_0x105492)));}function extractCalleridName(_0x2ae939){var _0x35d7ad=_0x2ae939[_0x2a12('0x169')](/"(.*?)"/);return _0x35d7ad?_0x35d7ad[0x1]:_0x2ae939;}function extractCalleridNumber(_0x46ac42){var _0x3ebadd=_0x46ac42[_0x2a12('0x169')](/<(.*?)>/);return _0x3ebadd?_0x3ebadd[0x1]:_0x46ac42;}Dialer[_0x2a12('0xaf')]['actionOriginate']=function(_0xce7e56,_0x3e2693){var _0x502e87=this;var _0x30d5e0=uuid['v4']();this['actions'][_0x30d5e0]=new Action(_0xce7e56,_0x3e2693,_0x30d5e0);return new BPromise(function(_0x3b5fc5,_0x4dfe03){if(_[_0x2a12('0x44')](_0xce7e56)&&typeof _0xce7e56!==_0x2a12('0x16a')){return _0x4dfe03(msgResponse(_0x2a12('0x16b'),_0x2a12('0x145'),_0x2a12('0x16c')));}if(_[_0x2a12('0x44')](_0x3e2693['Contact'][_0x2a12('0x16d')])||_0x3e2693[_0x2a12('0x16e')]['phone']===null){return _0x4dfe03(msgResponse(_0x2a12('0x16b'),_0x2a12('0x145'),_0x2a12('0x16f')));}var _0x3600fb={'XMD-CALLERID':_0x502e87[_0x2a12('0x27')][_0x30d5e0][_0x2a12('0x170')](),'XMD-AGI':_0xce7e56['dialQueueProject']?util[_0x2a12('0x80')]('\x22agi://%s/square,%s\x22',ipAgi,_0xce7e56['dialQueueProject']):_0x2a12('0x171'),'XMD-AGIAFTER':_0xce7e56[_0x2a12('0x172')]?util[_0x2a12('0x80')]('\x22agi://%s/square,%s\x22',ipAgi,_0xce7e56['dialQueueProject2']):_0x2a12('0x171'),'XMD-QUEUE':_0xce7e56[_0x2a12('0x5b')]===_0x2a12('0x53')?util[_0x2a12('0x80')](_0x2a12('0x173'),_0xce7e56['name'],_0xce7e56['dialQueueOptions']||'',_0xce7e56[_0x2a12('0x174')]?'c':'',_0xce7e56[_0x2a12('0x118')]||0x3):'NONE','XMD-CONTACTID':_0x3e2693[_0x2a12('0xcc')],'XMD-CDRTYPE':_0x2a12('0xa'),'CALLERID(all)':_0x502e87[_0x2a12('0x27')][_0x30d5e0]['getCaller'](),'XMD-AMD':_0xce7e56[_0x2a12('0xe0')]?_0x2a12('0x175'):_0x2a12('0x171'),'XMD-DESTINATION':_0x2a12('0xdf')};if(_0xce7e56[_0x2a12('0xe0')]){_0x3600fb['XMD-AMDINITIALSILENCE']=_0xce7e56[_0x2a12('0x176')]||0x9c4;_0x3600fb[_0x2a12('0x177')]=_0xce7e56[_0x2a12('0x178')]||0x5dc;_0x3600fb[_0x2a12('0x179')]=_0xce7e56[_0x2a12('0x17a')]||0x320;_0x3600fb['XMD-AMDTOTALANALYSISTIME']=_0xce7e56['dialAMDTotalAnalysisTime']||0x1388;_0x3600fb['XMD-AMDMINWORDLENGTH']=_0xce7e56[_0x2a12('0x17b')]||0x64;_0x3600fb[_0x2a12('0x17c')]=_0xce7e56[_0x2a12('0x17d')]||0x32;_0x3600fb[_0x2a12('0x17e')]=_0xce7e56[_0x2a12('0x17f')]||0x3;_0x3600fb[_0x2a12('0x180')]=_0xce7e56['dialAMDSilenceThreshold']||0x100;_0x3600fb[_0x2a12('0x181')]=_0xce7e56[_0x2a12('0x182')]||0x1388;}if(_0xce7e56[_0x2a12('0x5b')]==='outbound'){_0x3600fb[_0x2a12('0x183')]=_0x3e2693['VoiceQueueId'];}else{_0x3600fb[_0x2a12('0x184')]=_0x3e2693[_0x2a12('0xcf')];}for(var _0x55d6cd in _0x3e2693[_0x2a12('0x16e')]){if(typeof _0x3e2693[_0x2a12('0x16e')][_0x55d6cd]!==_0x2a12('0x9d')){if(isNotNull(_0x3e2693[_0x2a12('0x16e')][_0x55d6cd])&&_0x55d6cd!=='id'&&_0x55d6cd!==_0x2a12('0x185')&&_0x55d6cd!==_0x2a12('0x186')&&_0x55d6cd!==_0x2a12('0x187')){_0x3600fb[util['format']('%s%s',_0x2a12('0x188'),_[_0x2a12('0x189')](_0x55d6cd))]=_0x3e2693[_0x2a12('0x16e')][_0x55d6cd];}}}var _0x5dbd91=_0x502e87[_0x2a12('0xd3')](_0xce7e56[_0x2a12('0x7c')])?getCallerId(_0xce7e56[_0x2a12('0x7c')][_0x2a12('0x7d')],_0xce7e56[_0x2a12('0x61')],_0xce7e56[_0x2a12('0x18a')]>0x0?getCallerIdRandom(_0xce7e56['dialOriginateCallerIdNumber'],_0xce7e56[_0x2a12('0x18a')]):_0xce7e56[_0x2a12('0x62')]):getCallerId(_[_0x2a12('0xdc')](_0xce7e56[_0x2a12('0x13d')])?_0xce7e56[_0x2a12('0x7c')][_0x2a12('0x7d')]:_0xce7e56[_0x2a12('0x13d')][_0x2a12('0x7d')],_0xce7e56[_0x2a12('0x61')],_0xce7e56[_0x2a12('0x18a')]>0x0?getCallerIdRandom(_0xce7e56[_0x2a12('0x62')],_0xce7e56[_0x2a12('0x18a')]):_0xce7e56['dialOriginateCallerIdNumber']);if(_0x5dbd91){_0x3600fb[_0x2a12('0x18b')]=_0x502e87['actions'][_0x30d5e0]['originatecalleridname']=extractCalleridName(_0x5dbd91);_0x3600fb[_0x2a12('0x18c')]=_0x502e87[_0x2a12('0x27')][_0x30d5e0][_0x2a12('0x18d')]=extractCalleridNumber(_0x5dbd91);}return ami['Action']({'actionid':_0x30d5e0,'action':'originate','channel':_0x502e87[_0x2a12('0xd3')](_0xce7e56[_0x2a12('0x7c')])?util[_0x2a12('0x80')](_0x2a12('0x18e'),_0xce7e56[_0x2a12('0x7c')][_0x2a12('0x4a')],isNotNull(_0xce7e56[_0x2a12('0x64')])?_0xce7e56[_0x2a12('0x64')]['trim']()||'':'',_0xce7e56[_0x2a12('0x18f')]>0x0?_0x3e2693['Contact'][_0x2a12('0x16d')][_0x2a12('0x190')](_0xce7e56[_0x2a12('0x18f')]):_0x3e2693['Contact']['phone']):util[_0x2a12('0x80')](_0x2a12('0x18e'),_[_0x2a12('0xdc')](_0xce7e56['TrunkBackup'])?_0xce7e56[_0x2a12('0x7c')][_0x2a12('0x4a')]:_0xce7e56[_0x2a12('0x13d')]['name'],isNotNull(_0xce7e56['dialPrefix'])?_0xce7e56[_0x2a12('0x64')]['trim']()||'':'',_0xce7e56[_0x2a12('0x18f')]>0x0?_0x3e2693[_0x2a12('0x16e')][_0x2a12('0x16d')]['substring'](_0xce7e56[_0x2a12('0x18f')]):_0x3e2693[_0x2a12('0x16e')][_0x2a12('0x16d')]),'callerid':_0x5dbd91,'Exten':_0x2a12('0xdf'),'Context':_0x2a12('0x191'),'Priority':'1','variable':_0x3600fb,'timeout':(_0xce7e56[_0x2a12('0x63')]||0x1e)*0x3e8,'async':!![],'channelid':_0x30d5e0})['then'](function(_0x5c36ed){return _0x3b5fc5(_0x5c36ed);})[_0x2a12('0xb0')](function(_0xde6dc2){_0xce7e56[_0x2a12('0x6d')]+=0x1;var _0x3e9788=new History(_0x502e87[_0x2a12('0x27')][_0x30d5e0]);logger[_0x2a12('0x99')](util[_0x2a12('0x80')](_0x2a12('0x192'),JSON[_0x2a12('0x4e')](_0xde6dc2)));_0x3e9788['state']=0xe;_0x3e9788[_0x2a12('0xec')]=_0x2a12('0x193');_0x3e9788[_0x2a12('0xad')]=moment()[_0x2a12('0x80')](_0x2a12('0xfe'));_0x3e9788[_0x2a12('0xac')]=_0x3e9788['starttime'];_0x502e87['createHistory'](_0x3e9788)[_0x2a12('0xb0')](loggerCatch(_0x2a12('0x194')));_0x502e87[_0x2a12('0xd9')](_0x3e9788)[_0x2a12('0xb0')](loggerCatch(_0x2a12('0x194')))[_0x2a12('0x20')](function(){delete _0x502e87['actions'][_0x30d5e0];return _0x4dfe03(msgResponse(_0x2a12('0x16b'),_0x2a12('0x195'),_0x2a12('0x196')));});});});};Dialer['prototype'][_0x2a12('0x35')]=function(_0x40c555){var _0x1a0904=this[_0x2a12('0x27')][_0x40c555[_0x2a12('0x126')]];if(_0x1a0904){delete this[_0x2a12('0x27')][_0x40c555[_0x2a12('0x126')]];_0x1a0904['responsetime']=moment()[_0x2a12('0x80')](_0x2a12('0xfe'));var _0x1111c2=_0x1a0904[_0x2a12('0x5b')]===_0x2a12('0x7f')?this['campaigns'][_0x1a0904[_0x2a12('0xb3')]]:this['voiceQueues'][_0x1a0904[_0x2a12('0x197')]()];if(!this[_0x2a12('0xd2')](_0x40c555[_0x2a12('0x198')])){this[_0x2a12('0xb2')](_0x1111c2);return this[_0x2a12('0x199')](_0x1a0904,_0x1111c2,_0x40c555)['catch'](loggerCatch(_0x2a12('0x19a')));}this[_0x2a12('0x29')][_0x40c555[_0x2a12('0xda')]]=_0x1a0904;}};Dialer[_0x2a12('0xaf')][_0x2a12('0x19b')]=function(_0x498ea9,_0x4d72a2,_0x1d5942){var _0x2cca44=new History(_0x4d72a2);if(_0x2cca44[_0x2a12('0xf2')]+_0x2cca44[_0x2a12('0x102')]+_0x2cca44['countnoanswerretry']+_0x2cca44[_0x2a12('0xf4')]+_0x2cca44[_0x2a12('0xf5')]+_0x2cca44[_0x2a12('0xf6')]+_0x2cca44['countmachineretry']+_0x2cca44['countagentrejectretry']>=_0x1d5942[_0x2a12('0xf8')]-0x1){return!![];}switch(_0x498ea9){case 0x3:if(_0x2cca44[_0x2a12('0xf3')]>=_0x1d5942[_0x2a12('0x19c')]-0x1){return!![];}this[_0x2a12('0xbe')]({'active':![],'countnoanswerretry':_0x2cca44['countnoanswerretry']+=0x1,'scheduledat':moment()[_0x2a12('0xfc')](_0x1d5942['dialNoAnswerRetryFrequency'],_0x2a12('0x105'))[_0x2a12('0x80')](_0x2a12('0xfe')),'ContactId':_0x2cca44[_0x2a12('0xcc')],'ListId':_0x2cca44[_0x2a12('0xcd')],'VoiceQueueId':_0x2cca44[_0x2a12('0xff')]||undefined,'CampaignId':_0x2cca44[_0x2a12('0xcf')]||undefined})[_0x2a12('0xb0')](loggerCatch(_0x2a12('0x19d')));break;case 0x5:if(_0x2cca44[_0x2a12('0xf2')]>=_0x1d5942[_0x2a12('0x19e')]-0x1){return!![];}this[_0x2a12('0xbe')]({'active':![],'countbusyretry':_0x2cca44[_0x2a12('0xf2')]+=0x1,'scheduledat':moment()[_0x2a12('0xfc')](_0x1d5942['dialBusyRetryFrequency'],_0x2a12('0x105'))['format'](_0x2a12('0xfe')),'ContactId':_0x2cca44[_0x2a12('0xcc')],'ListId':_0x2cca44[_0x2a12('0xcd')],'VoiceQueueId':_0x2cca44[_0x2a12('0xff')]||undefined,'CampaignId':_0x2cca44[_0x2a12('0xcf')]||undefined})[_0x2a12('0xb0')](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0x2cca44[_0x2a12('0x102')]>=_0x1d5942[_0x2a12('0x19f')]-0x1){return!![];}this[_0x2a12('0xbe')]({'active':![],'countcongestionretry':_0x2cca44[_0x2a12('0x102')]+=0x1,'scheduledat':moment()[_0x2a12('0xfc')](_0x1d5942[_0x2a12('0x1a0')],_0x2a12('0x105'))[_0x2a12('0x80')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2cca44['ContactId'],'ListId':_0x2cca44[_0x2a12('0xcd')],'VoiceQueueId':_0x2cca44[_0x2a12('0xff')]||undefined,'CampaignId':_0x2cca44[_0x2a12('0xcf')]||undefined})[_0x2a12('0xb0')](loggerCatch('[rescheduleContact]\x20[Congestion]'));break;case 0x0:if(_0x2cca44[_0x2a12('0xf4')]>=_0x1d5942[_0x2a12('0x1a1')]-0x1){return!![];}else{this[_0x2a12('0xbe')]({'active':![],'countnosuchnumberretry':_0x2cca44[_0x2a12('0xf4')]+=0x1,'scheduledat':moment()[_0x2a12('0xfc')](_0x1d5942[_0x2a12('0x1a2')],_0x2a12('0x105'))['format'](_0x2a12('0xfe')),'ContactId':_0x2cca44[_0x2a12('0xcc')],'ListId':_0x2cca44[_0x2a12('0xcd')],'VoiceQueueId':_0x2cca44[_0x2a12('0xff')]||undefined,'CampaignId':_0x2cca44[_0x2a12('0xcf')]||undefined})['catch'](loggerCatch(_0x2a12('0x1a3')));}break;case 0xa:if(_0x2cca44[_0x2a12('0xf5')]>=_0x1d5942[_0x2a12('0x11b')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countdropretry':_0x2cca44[_0x2a12('0xf5')]+=0x1,'scheduledat':moment()[_0x2a12('0xfc')](_0x1d5942[_0x2a12('0x11c')],_0x2a12('0x105'))[_0x2a12('0x80')](_0x2a12('0xfe')),'ContactId':_0x2cca44[_0x2a12('0xcc')],'ListId':_0x2cca44[_0x2a12('0xcd')],'VoiceQueueId':_0x2cca44[_0x2a12('0xff')]||undefined,'CampaignId':_0x2cca44[_0x2a12('0xcf')]||undefined})['catch'](loggerCatch(_0x2a12('0x11d')));break;case 0xb:if(_0x2cca44[_0x2a12('0xf6')]>=_0x1d5942[_0x2a12('0x1a4')]-0x1){return!![];}this[_0x2a12('0xbe')]({'active':![],'countabandonedretry':_0x2cca44[_0x2a12('0xf6')]+=0x1,'scheduledat':moment()['add'](_0x1d5942[_0x2a12('0x1a5')],'minutes')[_0x2a12('0x80')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2cca44[_0x2a12('0xcc')],'ListId':_0x2cca44[_0x2a12('0xcd')],'VoiceQueueId':_0x2cca44[_0x2a12('0xff')]||undefined,'CampaignId':_0x2cca44['CampaignId']||undefined})[_0x2a12('0xb0')](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0x2cca44[_0x2a12('0xee')]>=_0x1d5942[_0x2a12('0x103')]-0x1){return!![];}this[_0x2a12('0xbe')]({'active':![],'countmachineretry':_0x2cca44[_0x2a12('0xee')]+=0x1,'scheduledat':moment()[_0x2a12('0xfc')](_0x1d5942[_0x2a12('0xfd')],_0x2a12('0x105'))[_0x2a12('0x80')](_0x2a12('0xfe')),'ContactId':_0x2cca44['ContactId'],'ListId':_0x2cca44['ListId'],'VoiceQueueId':_0x2cca44[_0x2a12('0xff')]||undefined,'CampaignId':_0x2cca44[_0x2a12('0xcf')]||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0x2cca44[_0x2a12('0xf7')]>=_0x1d5942['dialAgentRejectMaxRetry']-0x1){return!![];}this[_0x2a12('0xbe')]({'active':![],'countagentrejectretry':_0x2cca44['countagentrejectretry']+=0x1,'scheduledat':moment()['add'](_0x1d5942[_0x2a12('0x1a6')],_0x2a12('0x105'))[_0x2a12('0x80')](_0x2a12('0xfe')),'ContactId':_0x2cca44['ContactId'],'ListId':_0x2cca44[_0x2a12('0xcd')],'VoiceQueueId':_0x2cca44[_0x2a12('0xff')]||undefined,'CampaignId':_0x2cca44[_0x2a12('0xcf')]||undefined})[_0x2a12('0xb0')](loggerCatch(_0x2a12('0x1a7')));break;default:return!![];}};Dialer['prototype'][_0x2a12('0x199')]=function(_0xc86776,_0x2bf6c6,_0x27f1e8){var _0x1ef4f7=this;var _0x4c835b=new History(_0xc86776);return new BPromise(function(_0x41145c,_0x109440){if(_[_0x2a12('0x44')](_0x2bf6c6)&&typeof _0x2bf6c6!==_0x2a12('0x16a')){return _0x109440(msgResponse(_0x2a12('0x1a8'),'Failure',_0x2a12('0x1a9')));}if(_['isUndefined'](_0x27f1e8)&&typeof _0x27f1e8!==_0x2a12('0x16a')){return _0x109440(msgResponse('[callProgressDetecting]',_0x2a12('0x145'),_0x2a12('0x1aa')));}switch(_0x27f1e8['reason']){case'0':_0x2bf6c6[_0x2a12('0x6c')]+=0x1;_0x4c835b[_0x2a12('0xeb')]=0x0;_0x4c835b[_0x2a12('0xec')]=_0x2a12('0x1ab');_0x4c835b[_0x2a12('0xf4')]+=0x1;_0x4c835b[_0x2a12('0xef')]+=0x1;ami[_0x2a12('0x52')](_0x2a12('0x1ac'),ut[_0x2a12('0xf0')](_0xc86776,_0x2a12('0x1ad')));_0x1ef4f7[_0x2a12('0xd8')](_0x4c835b)['catch'](loggerCatch(_0x2a12('0xf1')));if(_0x1ef4f7[_0x2a12('0x19b')](0x0,_0xc86776,_0x2bf6c6)){if(_0x4c835b['countnosuchnumberretry']>=_0x2bf6c6[_0x2a12('0x1a1')]){_0x1ef4f7[_0x2a12('0xfb')](_0x4c835b,_0x41145c,_0x109440,_0x2a12('0x1ae'));}else{_0x1ef4f7['stateGlobal'](_0x4c835b,_0x41145c,_0x109440,_0x2a12('0x1ae'));}}break;case'3':_0x2bf6c6['outboundNoAnswerCallsDay']+=0x1;_0x4c835b[_0x2a12('0xeb')]=0x3;_0x4c835b['statedesc']=_0x2a12('0x1af');_0x4c835b[_0x2a12('0xf3')]+=0x1;_0x4c835b[_0x2a12('0xef')]+=0x1;ami[_0x2a12('0x52')](_0x2a12('0x1b0'),ut[_0x2a12('0xf0')](_0xc86776,'noanswer'));_0x1ef4f7[_0x2a12('0xd8')](_0x4c835b)['catch'](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x1ef4f7[_0x2a12('0x19b')](0x3,_0xc86776,_0x2bf6c6)){if(_0x4c835b[_0x2a12('0xf3')]>=_0x2bf6c6[_0x2a12('0x19c')]){_0x1ef4f7[_0x2a12('0xfb')](_0x4c835b,_0x41145c,_0x109440,_0x2a12('0x1b1'));}else{_0x1ef4f7[_0x2a12('0xf9')](_0x4c835b,_0x41145c,_0x109440,_0x2a12('0x1b1'));}}break;case'5':_0x2bf6c6[_0x2a12('0x67')]+=0x1;_0x4c835b['state']=0x5;_0x4c835b[_0x2a12('0xec')]='Busy';_0x4c835b['countbusyretry']+=0x1;_0x4c835b[_0x2a12('0xef')]+=0x1;ami[_0x2a12('0x52')](_0x2a12('0x1b2'),ut[_0x2a12('0xf0')](_0xc86776,'busy'));_0x1ef4f7['createHistory'](_0x4c835b)[_0x2a12('0xb0')](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x1ef4f7['checkRetriveMax'](0x5,_0xc86776,_0x2bf6c6)){if(_0x4c835b[_0x2a12('0xf2')]>=_0x2bf6c6['dialBusyMaxRetry']){_0x1ef4f7[_0x2a12('0xfb')](_0x4c835b,_0x41145c,_0x109440,_0x2a12('0x1b3'));}else{_0x1ef4f7['stateGlobal'](_0x4c835b,_0x41145c,_0x109440,_0x2a12('0x1b3'));}}break;case'8':_0x2bf6c6[_0x2a12('0x68')]+=0x1;_0x4c835b[_0x2a12('0xeb')]=0x8;_0x4c835b[_0x2a12('0xec')]='Congestion';_0x4c835b[_0x2a12('0x102')]+=0x1;_0x4c835b[_0x2a12('0xef')]+=0x1;ami['emit'](_0x2a12('0x1b4'),ut[_0x2a12('0xf0')](_0xc86776,_0x2a12('0x1b5')));_0x1ef4f7[_0x2a12('0xd8')](_0x4c835b)[_0x2a12('0xb0')](loggerCatch(_0x2a12('0x1b6')));if(_0x1ef4f7[_0x2a12('0x19b')](0x8,_0xc86776,_0x2bf6c6)){if(_0x4c835b[_0x2a12('0x102')]>=_0x2bf6c6[_0x2a12('0x19f')]){_0x1ef4f7[_0x2a12('0xfb')](_0x4c835b,_0x41145c,_0x109440,'reason\x208\x20congestion');}else{_0x1ef4f7['stateGlobal'](_0x4c835b,_0x41145c,_0x109440,'reason\x208\x20congestion');}}break;case'11':_0x2bf6c6[_0x2a12('0x1b7')]+=0x1;_0x4c835b[_0x2a12('0xeb')]=0xb;_0x4c835b['statedesc']=_0x2a12('0x121');_0x4c835b[_0x2a12('0xf6')]+=0x1;_0x4c835b[_0x2a12('0xef')]+=0x1;_0x1ef4f7['createHistory'](_0x4c835b)[_0x2a12('0xb0')](loggerCatch(_0x2a12('0x124')));if(_0x1ef4f7[_0x2a12('0x19b')](0xb,_0xc86776,_0x2bf6c6)){if(_0x4c835b['countabandonedretry']>=_0x2bf6c6['dialAbandonedMaxRetry']){_0x1ef4f7[_0x2a12('0xfb')](_0x4c835b,_0x41145c,_0x109440,_0x2a12('0x1b8'));}else{_0x1ef4f7[_0x2a12('0xf9')](_0x4c835b,_0x41145c,_0x109440,_0x2a12('0x1b8'));}}break;case'20':_0x2bf6c6[_0x2a12('0x6e')]+=0x1;_0x4c835b[_0x2a12('0xeb')]=0x14;_0x4c835b['statedesc']=_0x2a12('0x1b9');_0x4c835b[_0x2a12('0xf7')]+=0x1;_0x4c835b['countglobal']+=0x1;ami['emit'](_0x2a12('0x1ba'),ut[_0x2a12('0xf0')](_0xc86776,_0x2a12('0x1bb')));_0x1ef4f7['createHistory'](_0x4c835b)['catch'](loggerCatch(_0x2a12('0x1bc')));if(_0x1ef4f7[_0x2a12('0x19b')](0x14,_0xc86776,_0x2bf6c6)){if(_0x4c835b['countagentrejectretry']>=_0x2bf6c6[_0x2a12('0x1bd')]){_0x1ef4f7[_0x2a12('0xfb')](_0x4c835b,_0x41145c,_0x109440,'reason\x2020\x20agentreject');}else{_0x1ef4f7[_0x2a12('0xf9')](_0x4c835b,_0x41145c,_0x109440,_0x2a12('0x1be'));}}break;default:_0x2bf6c6[_0x2a12('0x6f')]+=0x1;_0x4c835b[_0x2a12('0xeb')]=0xc;_0x4c835b[_0x2a12('0xec')]=_0x27f1e8[_0x2a12('0x10f')];_0x1ef4f7[_0x2a12('0xd8')](_0x4c835b)[_0x2a12('0xb0')](loggerCatch(_0x2a12('0x1bf')));if(_0x1ef4f7['checkRetriveMax'](_0x27f1e8['reason'],_0xc86776,_0x2bf6c6)){if(_0x4c835b['countbusyretry']+_0x4c835b[_0x2a12('0x102')]+_0x4c835b[_0x2a12('0xf3')]+_0x4c835b[_0x2a12('0xf4')]+_0x4c835b[_0x2a12('0xf5')]+_0x4c835b['countabandonedretry']+_0x4c835b[_0x2a12('0xee')]+_0x4c835b[_0x2a12('0xf7')]>=_0x2bf6c6[_0x2a12('0xf8')]){_0x1ef4f7[_0x2a12('0xf9')](_0x4c835b,_0x41145c,_0x109440,_0x27f1e8['reason']);}else{_0x1ef4f7['createStateFinal'](_0x4c835b,_0x41145c,_0x109440,_0x27f1e8[_0x2a12('0x10f')]);}}}});};Dialer[_0x2a12('0xaf')][_0x2a12('0xf9')]=function(_0xe0a427,_0x5a9ef8,_0x4f991c,_0x3dedae){var _0xa58aa4=new Final(_0xe0a427);_0xa58aa4[_0x2a12('0xeb')]=0xf;_0xa58aa4[_0x2a12('0xec')]=_0x2a12('0x1c0');this[_0x2a12('0xfb')](_0xa58aa4,_0x5a9ef8,_0x4f991c,_0x3dedae);};Dialer[_0x2a12('0xaf')][_0x2a12('0xfb')]=function(_0x27eaa7,_0xfea3c3,_0x45ddcc,_0x50b0a8){this[_0x2a12('0xd9')](_0x27eaa7)['then'](function(){return _0xfea3c3(msgResponse('[callProgressDetecting]',_0x2a12('0x1c1'),_0x50b0a8));})[_0x2a12('0xb0')](function(){return _0x45ddcc(msgResponse(_0x2a12('0x1c2'),'Failure',_0x2a12('0x1c3')));});};Dialer['prototype'][_0x2a12('0x15e')]=function(_0x4e9fac){var _0x5e35f9=_0x4e9fac['dialPredictiveOptimizationPercentage']/0x64;var _0x2c56eb=_0x4e9fac[_0x2a12('0x6b')]/(_0x4e9fac['outboundDropCallsDayTimeout']+_0x4e9fac[_0x2a12('0x65')]);var _0x471ce2=Math[_0x2a12('0x1c4')](_0x4e9fac[_0x2a12('0x77')]*(_0x4e9fac['predictiveIntervalMaxThreshold']/0x64));var _0xcda375=Math[_0x2a12('0x1c4')](_0x4e9fac[_0x2a12('0x77')]*(_0x4e9fac[_0x2a12('0x1c5')]/0x64));var _0x3e5e79=_0x4e9fac[_0x2a12('0x1c6')]+_0x4e9fac['talking'];var _0x55e2ca=Math[_0x2a12('0x1c7')](_0x4e9fac[_0x2a12('0x79')]*_0x4e9fac[_0x2a12('0x1c8')]*_0x4e9fac[_0x2a12('0x1c9')]*_0x4e9fac[_0x2a12('0x76')]);if(_['isUndefined'](_0x4e9fac[_0x2a12('0x2b')])){if(!_[_0x2a12('0x44')](_0x4e9fac[_0x2a12('0x2a')])){_0x4e9fac[_0x2a12('0x2a')]=undefined;loggerPredictive[_0x2a12('0x99')](_0x2a12('0x1ca'),_0x2a12('0x1cb'));}if(!_[_0x2a12('0x44')](_0x4e9fac[_0x2a12('0x94')])){loggerPredictive[_0x2a12('0x99')](_0x2a12('0x1ca'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x4e9fac[_0x2a12('0x94')]);_0x4e9fac[_0x2a12('0x94')]=undefined;}_0x4e9fac[_0x2a12('0x2b')]=moment()[_0x2a12('0x80')](_0x2a12('0xfe'));loggerPredictive[_0x2a12('0x83')](_0x4e9fac['name'],'collection\x20data\x20in\x20progressive\x20at',_0x4e9fac[_0x2a12('0x2b')]);this['handlePower'](_0x4e9fac,0x1);}else if(ifInterval(_0x4e9fac[_0x2a12('0x1cc')],_0x4e9fac['startProgressive'])){this[_0x2a12('0x15c')](_0x4e9fac,0x1);loggerPredictiveCalls[_0x2a12('0x83')](_0x2a12('0x1cd'),_0x4e9fac[_0x2a12('0x2b')],_0x4e9fac[_0x2a12('0x4a')]);_0x4e9fac['erlangCalls']=0x0;_0x4e9fac['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x5e35f9<_0x2c56eb&&_0x4e9fac['dialPredictiveOptimization']===_0x2a12('0x1ce')){freeVariablesPredictive(_0x4e9fac);loggerPredictive['info'](_0x2a12('0x1cf'),_0x2a12('0x1d0'),_0x2c56eb,_0x2a12('0x2b'),_0x4e9fac['name']);}else if(_0x55e2ca<_0x4e9fac[_0x2a12('0x75')]&&_0x4e9fac[_0x2a12('0x1d1')]===_0x2a12('0x1ce')){freeVariablesPredictive(_0x4e9fac);loggerPredictive[_0x2a12('0x83')](_0x2a12('0x1d2'),_0x2a12('0x1d3'),_0x55e2ca,_0x2a12('0x1d4'),_0x4e9fac['predictiveIntervalErlangCallsDroppedCalls'],_0x2a12('0x2b'),_0x4e9fac[_0x2a12('0x4a')]);}else if(!ifInterval(_0x4e9fac['dialPredictiveInterval'],_0x4e9fac[_0x2a12('0x2b')])&&_['isUndefined'](_0x4e9fac[_0x2a12('0x2a')])&&!_[_0x2a12('0x44')](_0x4e9fac[_0x2a12('0x2b')])){_0x4e9fac['startPredictive']=moment()[_0x2a12('0x80')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x2a12('0x83')](_0x4e9fac['name'],'started\x20in\x20predictive\x20at',_0x4e9fac[_0x2a12('0x2a')]);this[_0x2a12('0xbc')](_0x4e9fac[_0x2a12('0x1cc')])[_0x2a12('0xb8')](this['getDataPredictive'](_0x4e9fac))[_0x2a12('0xb8')](mergeDataErlangB(_0x4e9fac))[_0x2a12('0xb8')](this['startMethodPredictive'](_0x4e9fac))[_0x2a12('0xb0')](loggerCatchPredictive(_0x2a12('0x1d5'),_0x4e9fac));}else if(!ifInterval(_0x4e9fac[_0x2a12('0x1cc')],_0x4e9fac[_0x2a12('0x2a')])){_0x4e9fac['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x4e9fac[_0x2a12('0x2a')]=moment()[_0x2a12('0x80')](_0x2a12('0xfe'));loggerPredictive[_0x2a12('0x83')](_0x4e9fac['name'],_0x2a12('0x1d6'),_0x4e9fac[_0x2a12('0x2a')]);clearInterval(_0x4e9fac['handlePredictive']);_0x4e9fac[_0x2a12('0x94')]=undefined;this['averageHandleTime'](_0x4e9fac[_0x2a12('0x1cc')])[_0x2a12('0xb8')](this['getDataPredictive'](_0x4e9fac))[_0x2a12('0xb8')](mergeDataErlangB(_0x4e9fac))[_0x2a12('0xb8')](this[_0x2a12('0x1d7')](_0x4e9fac))[_0x2a12('0xb0')](loggerCatchPredictive(_0x2a12('0x1d8'),_0x4e9fac));}else if(_0x4e9fac['predictiveIntervalAvailable']&&_0x3e5e79<_0x4e9fac[_0x2a12('0x77')]-_0xcda375){freeVariablesPredictive(_0x4e9fac);loggerPredictive[_0x2a12('0x83')](_0x4e9fac[_0x2a12('0x4a')],_0x2a12('0x1d9'),_0x3e5e79,_0x2a12('0x1da'),_0x4e9fac[_0x2a12('0x77')],'-',_0xcda375,'=',_0x4e9fac['predictiveIntervalAvailable']-_0xcda375,')');}else if(_0x4e9fac['predictiveIntervalAvailable']&&_0x3e5e79>_0x4e9fac[_0x2a12('0x77')]+_0x471ce2){freeVariablesPredictive(_0x4e9fac);loggerPredictive['info'](_0x4e9fac['name'],_0x2a12('0x1d9'),_0x3e5e79,_0x2a12('0x1db'),_0x4e9fac[_0x2a12('0x77')],'+',_0x471ce2,'=',_0x4e9fac[_0x2a12('0x77')]+_0x471ce2,')');}};Dialer[_0x2a12('0xaf')]['getDataPredictive']=function(_0x558b7b){var _0x4766d2=this;return function(_0x905c55){return new BPromise(function(_0x1ea29c,_0x2ed3ab){_[_0x2a12('0x93')](_0x558b7b,_0x905c55[0x0]);if(checkGetDataPredictive(_0x905c55[0x0])){var _0x5fff6e=_0x558b7b[_0x2a12('0x77')]=_0x558b7b[_0x2a12('0xa5')]+_0x558b7b[_0x2a12('0x1c6')];var _0x50bf4b=_0x558b7b[_0x2a12('0x1cc')]*0x3c;var _0x495206=_0x905c55[0x0][_0x2a12('0x88')]+_0x905c55[0x0][_0x2a12('0x71')];var _0x3acd52=(_0x905c55[0x0]['predictiveIntervalAnsweredCalls']+_0x905c55[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x905c55[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x905c55[0x0][_0x2a12('0x8a')];_0x558b7b[_0x2a12('0x1c9')]=_0x3acd52>0x0?_0x3acd52:0x1;switch(_0x558b7b[_0x2a12('0x1d1')]){case'dropRate':var _0x3d35ce=_0x558b7b[_0x2a12('0x1dc')]/0x64;return _0x4766d2[_0x2a12('0x1dd')](_0x5fff6e,_0x50bf4b,_0x495206,_0x3acd52,_0x3d35ce)[_0x2a12('0xb8')](function(_0x590c0d){return _0x1ea29c(_0x590c0d);});case _0x2a12('0x1de'):var _0x182bda=_0x558b7b[_0x2a12('0x1dc')]/0x64;return _0x4766d2['busyFactor'](_0x5fff6e,_0x50bf4b,_0x495206,_0x3acd52,_0x182bda)[_0x2a12('0xb8')](function(_0x5ef8e0){return _0x1ea29c(_0x5ef8e0);});default:return _0x2ed3ab(msgResponse('[getDataPredictive]',_0x2a12('0x145'),'Unknown\x20Predictive'));}}else{return _0x2ed3ab(msgResponse('[getDataPredictive]',_0x2a12('0x145'),_0x2a12('0x1df')));}});};};Dialer[_0x2a12('0xaf')][_0x2a12('0x1e0')]=function(_0x300c81){var _0x96040e=this;return function(_0x344bec){return new BPromise(function(_0x2f0dec,_0x35afd7){_[_0x2a12('0x93')](_0x300c81,_0x344bec[0x0]);if(checkGetDataPredictive(_0x344bec[0x0])){loggerPredictive[_0x2a12('0x83')](JSON[_0x2a12('0x4e')](_0x344bec[0x0]));if(_0x300c81[_0x2a12('0x1d1')]==='dropRate'){return _0x96040e[_0x2a12('0xc5')](_0x300c81['id'])[_0x2a12('0xb8')](function(_0x2ca73b){var _0x365ec6=_0x300c81['loggedIn']-_0x2ca73b[0x0][_0x2a12('0x1e1')];var _0x1fc5f2=_0x300c81[_0x2a12('0x1cc')]*0x3c;var _0xf1c841=_0x344bec[0x0][_0x2a12('0x88')]+_0x344bec[0x0][_0x2a12('0x71')];var _0x382d81=(_0x344bec[0x0]['predictiveIntervalAnsweredCalls']+_0x344bec[0x0][_0x2a12('0x73')]+_0x344bec[0x0][_0x2a12('0x72')])/_0x344bec[0x0][_0x2a12('0x8a')];var _0x351926=_0x300c81[_0x2a12('0x1dc')]/0x64;_0x300c81[_0x2a12('0x1e2')]=_0x2ca73b[0x0][_0x2a12('0x1e1')]||0x0;_0x300c81[_0x2a12('0x1c9')]=_0x382d81>0x0?_0x382d81:0x1;return _0x96040e[_0x2a12('0x1dd')](_0x365ec6,_0x1fc5f2,_0xf1c841,_0x382d81,_0x351926);})[_0x2a12('0xb8')](function(_0x396f1a){return _0x2f0dec(_0x396f1a);})[_0x2a12('0xb0')](function(_0x36c305){return _0x35afd7(msgResponse(_0x2a12('0x1e3'),_0x2a12('0x145'),JSON['stringify'](_0x36c305)));});}if(_0x300c81[_0x2a12('0x1d1')]===_0x2a12('0x1de')){return _0x96040e['getVoiceQueueRtPauses'](_0x300c81['id'])[_0x2a12('0xb8')](function(_0x922072){var _0x3a3399=_0x300c81['loggedIn']-_0x922072[0x0][_0x2a12('0x1e1')];var _0x48ac35=_0x300c81['dialPredictiveInterval']*0x3c;var _0x282445=_0x344bec[0x0][_0x2a12('0x88')]+_0x344bec[0x0]['predictiveIntervalAvgHoldtime'];var _0x2411a1=(_0x344bec[0x0][_0x2a12('0x70')]+_0x344bec[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x344bec[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x344bec[0x0]['predictiveIntervalTotalCalls'];var _0x3c42f4=_0x300c81[_0x2a12('0x1dc')]/0x64;_0x300c81[_0x2a12('0x1e2')]=_0x922072[0x0]['outboundQueuePauses']||0x0;_0x300c81[_0x2a12('0x1c9')]=_0x2411a1>0x0?_0x2411a1:0x1;return _0x96040e[_0x2a12('0x1e4')](_0x3a3399,_0x48ac35,_0x282445,_0x2411a1,_0x3c42f4);})[_0x2a12('0xb8')](function(_0x313bfe){return _0x2f0dec(_0x313bfe);})[_0x2a12('0xb0')](function(_0x52cc60){return _0x35afd7(msgResponse(_0x2a12('0x1e3'),'Failure',JSON[_0x2a12('0x4e')](_0x52cc60)));});}}else{return _0x35afd7(msgResponse('[getDataPredictive]',_0x2a12('0x145'),_0x2a12('0x1df')));}});};};Dialer[_0x2a12('0xaf')][_0x2a12('0x1d7')]=function(_0x1a7076){var _0x57d4be=this;return function(){var _0x4a6a3d=0x0;var _0xf2718c=Math[_0x2a12('0x1c7')](_0x1a7076['erlangCallToSecond']*0x3e8);if(_0xf2718c>0x0){_0xf2718c=_0xf2718c<0x64?0x64:_0xf2718c;loggerPredictive['info'](_0x1a7076[_0x2a12('0x4a')],'one\x20call\x20every:',_0xf2718c,_0x2a12('0x4f'));_0x1a7076['handlePredictive']=setInterval(function(){_0x57d4be[_0x2a12('0x94')](_0x1a7076);loggerPredictiveCalls['info'](_0x2a12('0x1e5'),_0x4a6a3d+=0x1);},_0xf2718c);}else{loggerPredictive[_0x2a12('0x83')](_0x1a7076[_0x2a12('0x4a')],_0x2a12('0x1e6'));}};};Dialer[_0x2a12('0xaf')][_0x2a12('0x1e7')]=function(_0x3bb72c,_0x37deb4){var _0x4d8bb0=this;return function(_0x5541ec){if(_[_0x2a12('0x4c')](_0x5541ec)){if(_[_0x2a12('0xdc')](_0x37deb4[_0x2a12('0xce')])||!_0x37deb4[_0x2a12('0x1e8')]){if(_0x3bb72c[_0x2a12('0x60')]==='booked'){_0x3bb72c['queueStatusComplete']=_[_0x2a12('0x44')](_0x3bb72c['queueStatusComplete'])?!![]:_0x3bb72c[_0x2a12('0x12e')];var _0x150556=uuid['v4']();_0x4d8bb0[_0x2a12('0x27')][_0x150556]=new Action(_0x3bb72c,_0x37deb4,_0x150556);loggerBooked[_0x2a12('0x83')](_0x2a12('0x1e9'),_0x150556,_0x2a12('0x1ea'),JSON[_0x2a12('0x4e')](_0x3bb72c[_0x2a12('0x12e')]),_0x2a12('0x1eb'),_0x3bb72c[_0x2a12('0x4a')]);if(_0x3bb72c[_0x2a12('0x12e')]){_0x3bb72c['queueStatusComplete']=![];_0x4d8bb0[_0x2a12('0x2d')][_0x4d8bb0[_0x2a12('0x27')][_0x150556][_0x2a12('0xb3')]]=[];ami['Action']({'actionid':_0x150556,'action':'queuestatus','queue':_0x3bb72c['name']})[_0x2a12('0xb0')](function(){_0x4d8bb0[_0x2a12('0xb2')](_0x3bb72c);_0x4d8bb0[_0x2a12('0xbe')]({'active':![],'ContactId':_0x4d8bb0[_0x2a12('0x27')][_0x150556][_0x2a12('0xcc')],'ListId':_0x4d8bb0['actions'][_0x150556][_0x2a12('0xcd')],'VoiceQueueId':_0x4d8bb0[_0x2a12('0x27')][_0x150556]['VoiceQueueId']||undefined,'CampaignId':_0x4d8bb0['actions'][_0x150556]['CampaignId']||undefined})[_0x2a12('0xb0')](loggerCatch(_0x2a12('0x1ec')));delete _0x4d8bb0[_0x2a12('0x27')][_0x150556];});}else{loggerBooked[_0x2a12('0x83')](_0x2a12('0x1ed'),JSON[_0x2a12('0x4e')](_0x3bb72c[_0x2a12('0x12e')]),_0x2a12('0x1eb'),_0x3bb72c[_0x2a12('0x4a')]);_0x4d8bb0[_0x2a12('0xb2')](_0x3bb72c);_0x4d8bb0[_0x2a12('0xbe')]({'active':![],'ContactId':_0x4d8bb0[_0x2a12('0x27')][_0x150556][_0x2a12('0xcc')],'ListId':_0x4d8bb0[_0x2a12('0x27')][_0x150556][_0x2a12('0xcd')],'VoiceQueueId':_0x4d8bb0['actions'][_0x150556][_0x2a12('0xff')]||undefined,'CampaignId':_0x4d8bb0[_0x2a12('0x27')][_0x150556]['CampaignId']||undefined})[_0x2a12('0xb0')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x4d8bb0['actions'][_0x150556];}}else{return _0x4d8bb0[_0x2a12('0x1ee')](_0x3bb72c,_0x37deb4);}}else{if(getDiff(_0x37deb4[_0x2a12('0x1ef')])<_0x3bb72c[_0x2a12('0x1f0')]*0x3c){if(_0x37deb4[_0x2a12('0x1f1')]&&!_0x37deb4['Agent']['voicePause']){_0x4d8bb0[_0x2a12('0x96')][_0x2a12('0x12f')](_0x37deb4['id'])[_0x2a12('0x20')](function(){_0x4d8bb0['updateOriginated'](_0x3bb72c);});}else{_0x4d8bb0[_0x2a12('0x1f2')]({'active':![]},_0x37deb4['id'],0x1)['finally'](function(){_0x4d8bb0['updateOriginated'](_0x3bb72c);});}}else{_0x3bb72c[_0x2a12('0x1f3')]+=0x1;_0x4d8bb0[_0x2a12('0xb2')](_0x3bb72c);if(_0x3bb72c[_0x2a12('0x1f4')]){_0x4d8bb0[_0x2a12('0xbe')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x37deb4[_0x2a12('0xcc')],'ListId':_0x37deb4['ListId'],'VoiceQueueId':_0x37deb4['VoiceQueueId']||undefined,'CampaignId':_0x37deb4['CampaignId']||undefined})['catch'](loggerCatch(_0x2a12('0x1f5')));_0x4d8bb0[_0x2a12('0xd8')](createObjHistory(_0x3bb72c,_0x37deb4,_0x2a12('0x1f6'),0x17,_0x2a12('0x1f7')))['catch'](loggerCatch(_0x2a12('0x1f8')));}else{_0x4d8bb0[_0x2a12('0xca')](createObjHistory(_0x3bb72c,_0x37deb4,_0x2a12('0x1f9'),0x16,'RecallFailedTimeout'),_0x2a12('0x1fa'),_0x2a12('0x1fb'));}}}}else{_0x3bb72c[_0x2a12('0x66')]+=0x1;_0x4d8bb0[_0x2a12('0xca')](createObjHistory(_0x3bb72c,_0x37deb4,'BLACKLIST',0xd,_0x2a12('0x1fc')),_0x2a12('0x1fd'),_0x2a12('0x1fe'));throw _0x2a12('0x1ff');}};};Dialer[_0x2a12('0xaf')]['handleIvr']=function(_0x532882){var _0x111448=this;var _0x5e2cf8=_0x532882[_0x2a12('0x200')]-_0x532882[_0x2a12('0x78')]-_0x532882[_0x2a12('0xc1')];emitCampaignSummary(_0x532882);if(_0x5e2cf8>0x0){if(_0x5e2cf8>this[_0x2a12('0x26')]){_0x5e2cf8=this[_0x2a12('0x26')];}_0x532882['temp']+=_0x5e2cf8;this['getContactDialerIvr'](_0x532882['id'],_0x5e2cf8,_0x532882[_0x2a12('0x201')],_0x532882)[_0x2a12('0xb8')](function(_0x2bca9c){_0x532882[_0x2a12('0xc1')]-=_0x5e2cf8;_0x532882[_0x2a12('0xc1')]=_0x532882[_0x2a12('0xc1')]>0x0?_0x532882[_0x2a12('0xc1')]:0x0;if(!checkContactEmpty(_0x2bca9c)){_0x532882[_0x2a12('0x45')]=_0x2a12('0xa2');logger[_0x2a12('0x83')](_0x2a12('0x202')+_0x532882[_0x2a12('0x4a')]);}else{_0x532882['originated']+=_0x2bca9c[_0x2a12('0x9c')];_0x532882[_0x2a12('0x45')]='RUNNING';for(var _0x38b085=0x0;_0x38b085<_0x2bca9c['length'];_0x38b085+=0x1){_0x532882[_0x2a12('0x203')]+=0x1;if(_[_0x2a12('0xdc')](_0x2bca9c[_0x38b085])||_[_0x2a12('0xdc')](_0x2bca9c[_0x38b085][_0x2a12('0x16e')])||_[_0x2a12('0xdc')](_0x2bca9c[_0x38b085]['Contact'][_0x2a12('0x16d')])){_0x111448[_0x2a12('0xc8')](_0x2a12('0x204'),_0x532882,_0x2bca9c[_0x38b085]);}else{_0x111448[_0x2a12('0xba')](_[_0x2a12('0xcb')](_0x2bca9c[_0x38b085],[_0x2a12('0xcf'),_0x2a12('0x205')]))[_0x2a12('0xb8')](_0x111448[_0x2a12('0x1e7')](_0x532882,_0x2bca9c[_0x38b085]))['catch'](_0x111448['loggerHandler'](_0x2a12('0x206'),_0x532882));}}}})[_0x2a12('0xb0')](loggerGetContactDialer(_0x2a12('0x207'),_0x532882,_0x5e2cf8));}};Dialer[_0x2a12('0xaf')][_0x2a12('0x15c')]=function(_0x180fb0,_0x196100){var _0x4cb301=this;var _0x219400=[];var _0x4bd98f=_0x196100>=0x1?_0x196100:0x1;if(_0x180fb0['dialMethod']==='booked'){_0x4bd98f=0x1;}var _0x3bf445=Math['floor'](_0x180fb0['available']*_0x4bd98f)-_0x180fb0[_0x2a12('0x78')]-_0x180fb0[_0x2a12('0xc1')];emitVoiceQueueSummary(_0x180fb0);if(_0x180fb0[_0x2a12('0x208')]>0x0){var _0x7c01ce=_0x180fb0['dialLimitQueue']-_0x180fb0[_0x2a12('0x78')]-_0x180fb0[_0x2a12('0xa5')]-_0x180fb0['temp']-_0x180fb0[_0x2a12('0x56')];if(_0x3bf445>_0x7c01ce){_0x3bf445=_0x7c01ce;}}if(_0x3bf445>0x0){if(_0x180fb0['dialMethod']==='booked'){_0x3bf445=0x1;}if(_0x3bf445>this['maxNumberOriginate']){_0x3bf445=this[_0x2a12('0x26')];}_0x180fb0[_0x2a12('0xc1')]+=_0x3bf445;for(var _0x1e2e6a in this[_0x2a12('0x24')]){if(typeof this[_0x2a12('0x24')][_0x1e2e6a]!==_0x2a12('0x9d')){if(this[_0x2a12('0x24')][_0x1e2e6a][_0x2a12('0xeb')]===_0x2a12('0x209')&&this[_0x2a12('0x24')][_0x1e2e6a][_0x2a12('0xd6')]===_0x2a12('0xd7')){_0x219400['push'](this[_0x2a12('0x24')][_0x1e2e6a]['id']);}}}this['getContactDialer'](_0x180fb0['id'],_0x219400,_0x3bf445,_0x180fb0['dialOrderByScheduledAt'],_0x180fb0)[_0x2a12('0xb8')](function(_0x29bf42){_0x180fb0['temp']-=_0x3bf445;_0x180fb0[_0x2a12('0xc1')]=_0x180fb0['temp']>0x0?_0x180fb0['temp']:0x0;if(!checkContactEmpty(_0x29bf42)){_0x4cb301[_0x2a12('0xb6')](_0x180fb0)[_0x2a12('0xb8')](sendMessageReschedule(_0x180fb0))[_0x2a12('0xb0')](loggerCatch(_0x2a12('0x20a')));}else{_0x180fb0[_0x2a12('0x78')]+=_0x29bf42['length'];_0x180fb0['message']=_0x180fb0['dialMethod']===_0x2a12('0xb')?_0x2a12('0x175'):_0x2a12('0x20b');for(var _0x5bc6d1=0x0;_0x5bc6d1<_0x29bf42[_0x2a12('0x9c')];_0x5bc6d1+=0x1){if(_[_0x2a12('0xdc')](_0x29bf42[_0x5bc6d1])||_[_0x2a12('0xdc')](_0x29bf42[_0x5bc6d1]['Contact'])||_[_0x2a12('0xdc')](_0x29bf42[_0x5bc6d1]['Contact']['phone'])){_0x4cb301['emptyContact'](_0x2a12('0x204'),_0x180fb0,_0x29bf42[_0x5bc6d1]);}else{_0x4cb301[_0x2a12('0xb9')](_[_0x2a12('0xcb')](_0x29bf42[_0x5bc6d1],[_0x2a12('0xff'),_0x2a12('0x205')]))['then'](_0x4cb301[_0x2a12('0x1e7')](_0x180fb0,_0x29bf42[_0x5bc6d1]))[_0x2a12('0xb0')](_0x4cb301[_0x2a12('0xc7')](_0x2a12('0x204'),_0x180fb0));}}}})[_0x2a12('0xb0')](loggerGetContactDialer('[getContactDialer2]',_0x180fb0,_0x3bf445));}};Dialer[_0x2a12('0xaf')]['handlePredictive']=function(_0x4d2ae6){if(_0x4d2ae6[_0x2a12('0x208')]>0x0){var _0x3f9cdd=_0x4d2ae6['dialLimitQueue']-_0x4d2ae6['originated']-_0x4d2ae6[_0x2a12('0xa5')];if(_0x3f9cdd>0x0){this[_0x2a12('0x20c')](_0x4d2ae6);}else{loggerPredictiveCalls[_0x2a12('0x83')](_0x2a12('0x20d'));}}else{this[_0x2a12('0x20c')](_0x4d2ae6);}};Dialer[_0x2a12('0xaf')][_0x2a12('0x20c')]=function(_0x1228a6){var _0x38bd89=this;var _0x12fa5f=[];_0x1228a6[_0x2a12('0x78')]+=0x1;for(var _0x3da636 in this[_0x2a12('0x24')]){if(typeof this[_0x2a12('0x24')][_0x3da636]!==_0x2a12('0x9d')){if(this[_0x2a12('0x24')][_0x3da636][_0x2a12('0xeb')]===_0x2a12('0x209')&&this[_0x2a12('0x24')][_0x3da636][_0x2a12('0xd6')]===_0x2a12('0xd7')){_0x12fa5f['push'](this[_0x2a12('0x24')][_0x3da636]['id']);}}}this[_0x2a12('0xc0')](_0x1228a6['id'],_0x12fa5f,0x1,_0x1228a6['dialOrderByScheduledAt'],_0x1228a6)[_0x2a12('0xb8')](function(_0x23bdc5){if(!checkContactEmpty(_0x23bdc5)){checkContactLowerLimitOriginate(_0x1228a6,0x1,0x0);_0x38bd89[_0x2a12('0xb6')](_0x1228a6)[_0x2a12('0xb8')](sendMessageReschedule(_0x1228a6))['catch'](loggerCatch('[countReScheduled]\x20'));}else{_0x1228a6[_0x2a12('0x45')]=_0x2a12('0x20b');if(_[_0x2a12('0xdc')](_0x23bdc5[0x0])||_[_0x2a12('0xdc')](_0x23bdc5[0x0][_0x2a12('0x16e')])||_['isNil'](_0x23bdc5[0x0][_0x2a12('0x16e')]['phone'])){_0x38bd89[_0x2a12('0xc8')](_0x2a12('0x204'),_0x1228a6,_0x23bdc5[0x0]);}else{_0x38bd89['checkIsBlackList'](_['pick'](_0x23bdc5[0x0],['VoiceQueueId',_0x2a12('0x205')]))['then'](_0x38bd89[_0x2a12('0x1e7')](_0x1228a6,_0x23bdc5[0x0]))[_0x2a12('0xb0')](_0x38bd89[_0x2a12('0xc7')](_0x2a12('0x20e'),_0x1228a6));}}})[_0x2a12('0xb0')](loggerGetContactDialer(_0x2a12('0x20f'),_0x1228a6,0x1));emitVoiceQueueSummary(_0x1228a6);};Dialer['prototype'][_0x2a12('0x1dd')]=function(_0x985d57,_0x5d1bde,_0x45bf50,_0x42b8f3,_0x4afbaa,_0x5c79fb){loggerPredictive[_0x2a12('0x83')](_0x2a12('0x210'));loggerPredictive[_0x2a12('0x83')](_0x2a12('0x211'),_0x985d57);loggerPredictive[_0x2a12('0x83')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5d1bde);loggerPredictive[_0x2a12('0x83')](_0x2a12('0x212'),_0x45bf50);loggerPredictive[_0x2a12('0x83')](_0x2a12('0x213'),_0x42b8f3);loggerPredictive['info']('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4afbaa);loggerPredictive[_0x2a12('0x83')](_0x2a12('0x89'));return new BPromise(function(_0x4b9a2d,_0xec4af8){if(_0x985d57<=0x0||isNaN(_0x985d57)){return _0xec4af8(msgResponse(_0x2a12('0x214'),'Error',_0x2a12('0x215')+_0x985d57));}if(_0x45bf50<=0x0||isNaN(_0x45bf50)){return _0xec4af8(msgResponse('[abandonmentRate]','Error',_0x2a12('0x216')+_0x45bf50));}if(_0x42b8f3<=0x0||isNaN(_0x42b8f3)){return _0xec4af8(msgResponse(_0x2a12('0x214'),_0x2a12('0x195'),'p\x20=\x20'+_0x42b8f3));}if(_0x5d1bde<=0x0||isNaN(_0x5d1bde)){return _0xec4af8(msgResponse(_0x2a12('0x214'),_0x2a12('0x195'),_0x2a12('0x217')+_0x5d1bde));}if(_0x4afbaa<=0x0||isNaN(_0x4afbaa)){return _0xec4af8(msgResponse('[abandonmentRate]','Error',_0x2a12('0x218')+_0x4afbaa));}_0x5c79fb=_0x5c79fb||0x0;var _0x19a11f=0x1/_0x45bf50;var _0x2b6efc=0x0;var _0x549426=0x0;var _0x36bcf5=0x0;var _0x54df1f=0x0;for(var _0x41384c=0x0;_0x36bcf5<_0x4afbaa;_0x41384c+=0x1){_0x549426=_0x41384c/_0x5d1bde;_0x2b6efc=(_0x42b8f3*_0x549426+_0x5c79fb)/_0x19a11f;_0x36bcf5=erlangb(_0x2b6efc,_0x985d57);_0x54df1f=_0x2b6efc/_0x985d57*(0x1-erlangb(_0x2b6efc,_0x985d57));}return _0x4b9a2d({'erlangCalls':_0x41384c,'erlangCallToSecond':_0x5d1bde/_0x41384c,'erlangAbandonmentRate':_0x36bcf5,'erlangBusyFactor':_0x54df1f});});};Dialer[_0x2a12('0xaf')][_0x2a12('0x1e4')]=function(_0x1944fa,_0xdac4f,_0x600033,_0x3262ab,_0x4763f0,_0x1c11a7){loggerPredictive['info'](_0x2a12('0x219'));loggerPredictive[_0x2a12('0x83')](_0x2a12('0x211'),_0x1944fa);loggerPredictive['info'](_0x2a12('0x21a'),_0xdac4f);loggerPredictive[_0x2a12('0x83')](_0x2a12('0x212'),_0x600033);loggerPredictive['info'](_0x2a12('0x213'),_0x3262ab);loggerPredictive[_0x2a12('0x83')](_0x2a12('0x21b'),_0x4763f0);loggerPredictive[_0x2a12('0x83')]('---------------------------');return new BPromise(function(_0x49ba47,_0x244b25){if(_0x1944fa<=0x0||isNaN(_0x1944fa)){return _0x244b25(msgResponse(_0x2a12('0x21c'),'Error',_0x2a12('0x215')+_0x1944fa));}if(_0x600033<=0x0||isNaN(_0x600033)){return _0x244b25(msgResponse(_0x2a12('0x21c'),_0x2a12('0x195'),'Ts\x20=\x20'+_0x600033));}if(_0x3262ab<=0x0||isNaN(_0x3262ab)){return _0x244b25(msgResponse(_0x2a12('0x21c'),'Error',_0x2a12('0x21d')+_0x3262ab));}if(_0xdac4f<=0x0||isNaN(_0xdac4f)){return _0x244b25(msgResponse('[busyFactor]',_0x2a12('0x195'),'interval\x20=\x20'+_0xdac4f));}if(_0x4763f0<=0x0||isNaN(_0x4763f0)){return _0x244b25(msgResponse(_0x2a12('0x21c'),_0x2a12('0x195'),_0x2a12('0x21e')+_0x4763f0));}_0x1c11a7=_0x1c11a7||0x0;var _0x471cb6=0x1/_0x600033;var _0x33d91d=0x0;var _0x27405a=0x0;var _0x54524b=0x0;var _0x406c06=0x0;for(var _0x176666=0x0;_0x406c06<_0x4763f0;_0x176666+=0x1){_0x27405a=_0x176666/_0xdac4f;_0x33d91d=(_0x3262ab*_0x27405a+_0x1c11a7)/_0x471cb6;_0x54524b=erlangb(_0x33d91d,_0x1944fa);_0x406c06=_0x33d91d/_0x1944fa*(0x1-erlangb(_0x33d91d,_0x1944fa));}return _0x49ba47({'erlangCalls':_0x176666,'erlangCallToSecond':_0xdac4f/_0x176666,'erlangAbandonmentRate':_0x54524b,'erlangBusyFactor':_0x406c06});});};module[_0x2a12('0x21f')]=Dialer; \ No newline at end of file +var _0xe40e=['dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','channel','actionid','locked','stateinterface','push','idHopper','paused','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','pick','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','unlockRR','run','[booked][RR][finaly]','contactAgent-idHopper:\x20','[booked][unlock2]','[unlock3][syncQueueStatusComplete]','resetActiveCalls','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','Failure','\x20Intervals\x20is\x20null\x20','\x20Intervals\x20is\x20empty\x20','timezones','\x20Timezone\x20unknow\x20','isArray','command','iftime\x20%s,%s','interval','content','indexOf','true','all','GLOBAL_INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','dialMethod','progressive','handlePower','power','dialPowerLevel','launchHandleIvr','checkIsTrunkReachable','dialGlobalInterval','dialTimezone','checkIfTimeIntervals','[syncQueueSummary]','syncCampaigns','[syncCampaigns]','pow','replace','random','match','actionOriginate','originate','voiceQueue\x20is\x20undefine','Contact','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','dialQueueOptions','dialQueueTimeout','dialer','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-VOICEQUEUEID','tags','createdAt','updatedAt','%s%s','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','originatecalleridname','originatecalleridnum','SIP/%s/%s%s','dialCutDigit','trim','substring','from-sip','outboundOriginateFailureCallsDay','[originateError]:\x20%s','[originate][error]','originate\x20action\x20Error','response','[callProgressDetecting]\x20','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','callProgressDetecting','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','checkRetriveMax','reason\x200\x20no\x20such\x20number....','NoAnswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','congestion','[syncAgentComplete][createHistory][8]','dialCongestionMaxRetry','outboundAbandonedCallsDay','reason\x2011\x20abandoned','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','dialPredictiveOptimizationPercentage','outboundDropCallsDayTimeout','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','round','predictiveIntervalMinThreshold','floor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval',')\x20are\x20less\x20than\x20threshold\x20(','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','talking','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','scheduledat','dialRecallMeTimeout','Agent','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','Contact.phone','loggerHandler','[actionOriginateIvr]\x20','[getContactCampaign2]','not_inuse','[actionOriginate]\x20','[getContactDialer2]','dialLimitQueue','tryOriginatePredictive','[handlePredictive][limitChannel]','dialOrderByScheduledAt','checkContactBlack','[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','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','interval\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','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','p\x20=\x20','Umin\x20=\x20','exports','util','lodash','uuid','moment','ioredis','../../../config/logger','booked','predictive','predictiveCalls','syncQueueSummary','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./history','./final','./agentComplete','./queueCallerAbandon','./hangup','XCALLY_IP_AGI','rrmemory','roundrobin','prototype','tail','finally','sequence','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','syncAgentComplete','custom:queuesummary','hangup','syncHangup','newexten','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','isUndefined','message','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','Intervals','\x20INTERVAL_IS_NULL','isEmpty','[ifTime][Action]','Error','stringify','milliseconds','seconds','emit','outbound','strategy','answered','available','loggedIn','pTalking','sumBillable','sumHoldTime','total','unmanaged','waiting','loggedInDb','dialActive','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','Trunk','active','callerid','md5','format','voice_queue:save','type','ivr','campaign:ivr:%s','campaign:save','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','predictiveIntervalAvgHoldtime','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','diff','clearing\x20variable\x20start\x20predictive','handlePredictive','preview','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','length','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','NOT_ACTIVE','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','IS_DISACTIVED','state','endtime','starttime','[uniqueid]','clearZombieChannels','actions','[actions]','undefined','enqueue','isNil','Action','status','No\x20such\x20channel','queue','[Dialer][checkChannel]','updateOriginated','[Dialer][checkChannel][ivr]','countReScheduled','resolve','then','catch','[countReScheduled]\x20','checkIsBlackList','[checkIsBlackList]\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','UserId','VoiceQueueId','CampaignId','isSuccess','Success','isTrunkReachable','SIP/%s','reachable','unmonitored','uniqueid','variable','amdstatus','exten','xcally-motion-dialer','value','HANGUP','statedesc','HangupInAMD','membername','AMD','custom:amd','buildObj','amd','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','dialAMDActive','MACHINE','Machine','countmachineretry','countglobal','[syncAgentComplete][createHistory][0]','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','dialGlobalMaxRetry','stateGlobal','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','dialMachineRetryFrequency','YYYY-MM-DD\x20HH:mm:ss','ListId','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','countbusyretry','countdropretry','countagentrejectretry','reason19\x20machine....','add','minutes','ivrAnswerCallsDay','[syncHangupIvr]','dialQueueProject','AnswerAGI','[syncHangupIvr][createHistory]','cause-txt','reason','dialAgiAfterHangupAgent','answertime','queueCallerAbandonCreateState','droptime','responsetime','dropreason','TIMEOUT','agiafterat','dialQueueProject2','dialDropMaxRetry','dialDropRetryFrequency','[rescheduleContact][Drop]','Drop','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','dialAbandonedMaxRetry'];(function(_0x59e620,_0x5b3ca2){var _0x515ccd=function(_0x9d3fd1){while(--_0x9d3fd1){_0x59e620['push'](_0x59e620['shift']());}};_0x515ccd(++_0x5b3ca2);}(_0xe40e,0xf5));var _0xee40=function(_0x2e6bf8,_0x189e9f){_0x2e6bf8=_0x2e6bf8-0x0;var _0x53920c=_0xe40e[_0x2e6bf8];return _0x53920c;};'use strict';var util=require(_0xee40('0x0'));var _=require(_0xee40('0x1'));var BPromise=require('bluebird');var uuid=require(_0xee40('0x2'));var moment=require(_0xee40('0x3'));var rr=require('rr');var md5=require('md5');var Redis=require(_0xee40('0x4'));var ut=require('../preview/util/util');var config=require('../../../config/environment/');var logger=require(_0xee40('0x5'))('dialer');var loggerBooked=require(_0xee40('0x5'))(_0xee40('0x6'));var loggerPredictive=require('../../../config/logger')(_0xee40('0x7'));var loggerPredictiveCalls=require(_0xee40('0x5'))(_0xee40('0x8'));var loggerSyncQueueSummary=require(_0xee40('0x5'))(_0xee40('0x9'));var ami=require(_0xee40('0xa'));config[_0xee40('0xb')]=_[_0xee40('0xc')](config[_0xee40('0xb')],{'host':_0xee40('0xd'),'port':0x18eb});var io=require(_0xee40('0xe'))(new Redis(config[_0xee40('0xb')]));var cmHopper=require(_0xee40('0xf'));var cmHopperHistory=require(_0xee40('0x10'));var cmHopperBlack=require(_0xee40('0x11'));var voiceQueueRt=require(_0xee40('0x12'));var Action=require('./action');var History=require(_0xee40('0x13'));var Final=require(_0xee40('0x14'));var AgentComplete=require(_0xee40('0x15'));var QueueCallerAbandon=require(_0xee40('0x16'));var Hangup=require(_0xee40('0x17'));var ipAgi=process['env'][_0xee40('0x18')]||'127.0.0.1';var strategy={'rrmemory':_0xee40('0x19'),'roundrobin':_0xee40('0x1a')};var Sequence=function(){};Sequence[_0xee40('0x1b')]['enqueue']=function(_0x52d5b8){this['tail']=this[_0xee40('0x1c')]?this[_0xee40('0x1c')][_0xee40('0x1d')](_0x52d5b8):_0x52d5b8();};function Dialer(_0xee0d7b,_0x350816){this[_0xee40('0x1e')]=new Sequence();this['preview']=_0x350816;this[_0xee40('0x1f')]=_0xee0d7b['voiceQueues'];this['campaigns']=_0xee0d7b[_0xee40('0x20')];this[_0xee40('0x21')]=_0xee0d7b[_0xee40('0x21')];this[_0xee40('0x22')]=_0xee0d7b[_0xee40('0x22')];this[_0xee40('0x23')]=config[_0xee40('0x23')]||0x2;this[_0xee40('0x24')]={};this['actions']={};this[_0xee40('0x25')]={};this[_0xee40('0x26')]={};this[_0xee40('0x27')]={};this[_0xee40('0x28')]={};this[_0xee40('0x29')]={};this[_0xee40('0x2a')]={};this[_0xee40('0x2b')]={};this['queueBookedRR']={};ami['on'](_0xee40('0x2c'),this[_0xee40('0x2d')][_0xee40('0x2e')](this));ami['on'](_0xee40('0x2f'),this[_0xee40('0x30')][_0xee40('0x2e')](this));ami['on'](_0xee40('0x31'),this[_0xee40('0x32')]['bind'](this));ami['on']('agentcomplete',this[_0xee40('0x33')]['bind'](this));ami['on'](_0xee40('0x34'),this[_0xee40('0x9')][_0xee40('0x2e')](this));ami['on'](_0xee40('0x35'),this[_0xee40('0x36')][_0xee40('0x2e')](this));ami['on'](_0xee40('0x37'),this[_0xee40('0x38')][_0xee40('0x2e')](this));ami['on'](_0xee40('0x39'),this[_0xee40('0x3a')][_0xee40('0x2e')](this));ami['on'](_0xee40('0x3b'),this[_0xee40('0x3c')][_0xee40('0x2e')](this));ami['on'](_0xee40('0x3d'),this[_0xee40('0x3e')]['bind'](this));this[_0xee40('0x3f')]();this[_0xee40('0x40')]();}function isNotNull(_0x5b8a65){return _0x5b8a65!==null&&!_[_0xee40('0x41')](_0x5b8a65);}function checkIsLoggedIn(_0x3f8ca1,_0xded1d3){return function(){if(_0xded1d3<=0x0){_0x3f8ca1[_0xee40('0x42')]=_0xee40('0x43');throw _0x3f8ca1[_0xee40('0x44')]+_0xee40('0x45');}};}function isActive(_0x4d6803){return _0x4d6803;}function checkIsActive(_0x3cbe9a,_0x2eee26){return function(){if(!isActive(_0x2eee26)){_0x3cbe9a[_0xee40('0x42')]='NOT_ACTIVE';throw _0x3cbe9a[_0xee40('0x44')]+_0xee40('0x46');}};}function checkInterval(_0x1bb284){return function(){if(!isNotNull(_0x1bb284[_0xee40('0x47')])){_0x1bb284[_0xee40('0x42')]=_0xee40('0x48');throw _0x1bb284[_0xee40('0x44')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x1bb284[_0xee40('0x47')][_0xee40('0x49')])){_0x1bb284['message']=_0xee40('0x48');throw _0x1bb284['name']+_0xee40('0x4a');}if(!isNotNull(_[_0xee40('0x4b')](_0x1bb284[_0xee40('0x47')]['Intervals']))){_0x1bb284['message']=_0xee40('0x48');throw _0x1bb284[_0xee40('0x44')]+'\x20INTERVAL_IS_NULL';}};}function msgResponse(_0x2c5ead,_0x28f97a,_0x5f2584){return{'action':_0x2c5ead,'response':_0x28f97a,'message':_0x5f2584,'stack':_0x5f2584};}function myreject(_0x4a84a7){return function(_0x29759d){return _0x4a84a7(msgResponse(_0xee40('0x4c'),_0xee40('0x4d'),JSON[_0xee40('0x4e')](_0x29759d)));};}function getSeconds(_0x3ad733,_0x1803ab){var _0x5c89b1=moment(_0x3ad733)[_0xee40('0x4f')](0x0);var _0x29a7eb=moment(_0x1803ab)[_0xee40('0x4f')](0x0);return _0x5c89b1['diff'](_0x29a7eb,_0xee40('0x50'));}function emit(_0x17ac35,_0x27663b,_0x1dcb0f){io['to'](_0x17ac35)[_0xee40('0x51')](_0x27663b,_0x1dcb0f);}function emitVoiceQueueSummary(_0x33120d){if(_0x33120d['type']===_0xee40('0x52')){var _0x15cc08={'id':_0x33120d['id'],'name':_0x33120d[_0xee40('0x44')],'strategy':_0x33120d[_0xee40('0x53')],'answered':_0x33120d[_0xee40('0x54')],'available':_0x33120d[_0xee40('0x55')],'loggedIn':_0x33120d[_0xee40('0x56')],'pTalking':_0x33120d[_0xee40('0x57')],'sumBillable':_0x33120d[_0xee40('0x58')],'sumDuration':_0x33120d['sumDuration'],'sumHoldTime':_0x33120d[_0xee40('0x59')]||0x0,'talking':_0x33120d['talking'],'total':_0x33120d[_0xee40('0x5a')],'type':_0x33120d['type'],'unmanaged':_0x33120d[_0xee40('0x5b')],'abandoned':_0x33120d['abandoned'],'waiting':_0x33120d[_0xee40('0x5c')],'loggedInDb':_0x33120d[_0xee40('0x5d')],'dialActive':_0x33120d[_0xee40('0x5e')],'dialMethod':_0x33120d['dialMethod'],'dialOriginateCallerIdName':_0x33120d['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x33120d[_0xee40('0x5f')],'dialOriginateTimeout':_0x33120d[_0xee40('0x60')],'dialPrefix':_0x33120d[_0xee40('0x61')],'outboundAnswerAgiCallsDay':_0x33120d[_0xee40('0x62')],'outboundAnswerCallsDay':_0x33120d[_0xee40('0x63')],'outboundBlacklistCallsDay':_0x33120d[_0xee40('0x64')],'outboundBusyCallsDay':_0x33120d[_0xee40('0x65')],'outboundCongestionCallsDay':_0x33120d[_0xee40('0x66')],'outboundDropCallsDayACS':_0x33120d['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x33120d['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x33120d['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x33120d[_0xee40('0x67')],'outboundNoSuchCallsDay':_0x33120d[_0xee40('0x68')],'outboundOriginateFailureCallsDay':_0x33120d['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x33120d['outboundReCallsDay'],'outboundRejectCallsDay':_0x33120d[_0xee40('0x69')],'outboundUnknownCallsDay':_0x33120d[_0xee40('0x6a')],'predictiveIntervalAnsweredCalls':_0x33120d['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x33120d['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x33120d['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x33120d[_0xee40('0x6b')],'predictiveIntervalDroppedCallsTimeout':_0x33120d[_0xee40('0x6c')],'predictiveIntervalErlangCalls':_0x33120d[_0xee40('0x6d')],'predictiveIntervalErlangCallsDroppedCalls':_0x33120d[_0xee40('0x6e')],'predictiveIntervalHitRate':_0x33120d[_0xee40('0x6f')],'predictiveIntervalMultiplicativeFactor':_0x33120d[_0xee40('0x70')],'predictiveIntervalPauses':_0x33120d[_0xee40('0x71')],'predictiveIntervalAvailable':_0x33120d['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x33120d[_0xee40('0x72')],'message':_0x33120d[_0xee40('0x42')],'originated':_0x33120d[_0xee40('0x73')],'erlangCalls':_0x33120d[_0xee40('0x74')],'erlangCallToSecond':_0x33120d[_0xee40('0x75')],'erlangAbandonmentRate':_0x33120d[_0xee40('0x76')],'erlangBusyFactor':_0x33120d[_0xee40('0x77')],'startPredictive':_0x33120d[_0xee40('0x28')],'startProgressive':_0x33120d[_0xee40('0x29')]};if(_0x33120d['Trunk']){_0x15cc08[_0xee40('0x78')]={'id':_0x33120d['Trunk']['id'],'name':_0x33120d[_0xee40('0x78')][_0xee40('0x44')],'active':_0x33120d[_0xee40('0x78')][_0xee40('0x79')],'callerid':_0x33120d['Trunk'][_0xee40('0x7a')]};}if(_0x33120d['Interval']){_0x15cc08[_0xee40('0x47')]={'id':_0x33120d[_0xee40('0x47')]['id'],'name':_0x33120d[_0xee40('0x47')][_0xee40('0x44')]};}var _0x155cae=md5(JSON[_0xee40('0x4e')](_0x15cc08));if(_0x33120d['md5']!==_0x155cae){_0x33120d[_0xee40('0x7b')]=_0x155cae;emit(util[_0xee40('0x7c')]('voice:queue:%s',_0x15cc08['name']),_0xee40('0x7d'),_0x15cc08);}}}function emitCampaignSummary(_0x9a6f82){if(_0x9a6f82[_0xee40('0x7e')]===_0xee40('0x7f')){emit(util[_0xee40('0x7c')](_0xee40('0x80'),_0x9a6f82[_0xee40('0x44')]),_0xee40('0x81'),_0x9a6f82);}}function checkGetDataPredictive(_0x3f5a41){if(isNotNull(_0x3f5a41)&&!_[_0xee40('0x4b')](_0x3f5a41)){loggerPredictive[_0xee40('0x82')](_0xee40('0x83'));loggerPredictive[_0xee40('0x82')](_0xee40('0x84'),_0x3f5a41['predictiveIntervalTotalCalls']);loggerPredictive['info']('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3f5a41[_0xee40('0x85')]);loggerPredictive[_0xee40('0x82')](_0xee40('0x86'),_0x3f5a41['predictiveIntervalDroppedCallsTimeout']);loggerPredictive[_0xee40('0x82')](_0xee40('0x87'),_0x3f5a41[_0xee40('0x6b')]);loggerPredictive[_0xee40('0x82')](_0xee40('0x88'),_0x3f5a41['predictiveIntervalAvgHoldtime']);loggerPredictive[_0xee40('0x82')](_0xee40('0x89'),_0x3f5a41[_0xee40('0x8a')]);loggerPredictive[_0xee40('0x82')](_0xee40('0x8b'));if(_0x3f5a41[_0xee40('0x72')]>0x0){if(!_[_0xee40('0x41')](_0x3f5a41[_0xee40('0x8a')])&&_0x3f5a41['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive[_0xee40('0x82')](_0xee40('0x8c'));if(!_[_0xee40('0x41')](_0x3f5a41[_0xee40('0x8d')])&&_0x3f5a41['predictiveIntervalAvgHoldtime']>0x0){return!![];}loggerPredictive[_0xee40('0x82')](_0xee40('0x8e'));}else{loggerPredictive[_0xee40('0x82')]('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive['info']('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x1c0050){return function(_0x57798f){loggerPredictive['info'](_0xee40('0x8f'));loggerPredictive['info'](_0xee40('0x90'),_0x57798f[_0xee40('0x74')]);loggerPredictive[_0xee40('0x82')]('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x57798f[_0xee40('0x75')]);loggerPredictive[_0xee40('0x82')](_0xee40('0x91'),_0x57798f[_0xee40('0x76')]);loggerPredictive['info']('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x57798f['erlangBusyFactor']);loggerPredictive[_0xee40('0x82')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x57798f[_0xee40('0x76')]);loggerPredictive[_0xee40('0x82')](_0xee40('0x8b'));_[_0xee40('0x92')](_0x1c0050,_0x57798f);};}function getDiff(_0x3f3873){var _0x73a7a2=moment()['milliseconds'](0x0);var _0x4dcc55=moment(_0x3f3873)[_0xee40('0x4f')](0x0);return _0x73a7a2[_0xee40('0x93')](_0x4dcc55,_0xee40('0x50'));}function ifInterval(_0x1aa729,_0x42b8bb){if(_[_0xee40('0x41')](_0x42b8bb)){return![];}return getDiff(_0x42b8bb)<_0x1aa729*0x3c;}function freeVariablesPredictive(_0x3ee0bd){if(isNotNull(_0x3ee0bd)){if(!_['isUndefined'](_0x3ee0bd[_0xee40('0x29')])){_0x3ee0bd[_0xee40('0x29')]=undefined;loggerPredictive[_0xee40('0x82')](_0x3ee0bd[_0xee40('0x44')],'clearing\x20variable\x20start\x20progressive');}if(!_[_0xee40('0x41')](_0x3ee0bd[_0xee40('0x28')])){_0x3ee0bd[_0xee40('0x28')]=undefined;loggerPredictive[_0xee40('0x82')](_0x3ee0bd[_0xee40('0x44')],_0xee40('0x94'));}if(!_['isUndefined'](_0x3ee0bd[_0xee40('0x95')])){clearInterval(_0x3ee0bd[_0xee40('0x95')]);_0x3ee0bd[_0xee40('0x95')]=undefined;loggerPredictive[_0xee40('0x82')](_0x3ee0bd[_0xee40('0x44')],'clearing\x20variable\x20handle\x20predictive');}}}function erlangb(_0x5a730e,_0x3223de){if(_0x3223de===0x0){return 0x0;}var _0x1dc3ca=0x1;for(var _0x464f46=0x1;_0x464f46<=_0x3223de;_0x464f46+=0x1){_0x1dc3ca=0x1+_0x1dc3ca*_0x464f46/_0x5a730e;}return 0x1/_0x1dc3ca;}function isVoiceQueueOutbound(_0x20dc06){return _0x20dc06==='outbound';}function isNotPreview(_0x166829){return _0x166829!==_0xee40('0x96');}function isCampaignIvr(_0x5c6f36){return _0x5c6f36===_0xee40('0x7f');}function getCallerId(_0x57e455,_0x1c6eb5,_0x538c8b){if(!_[_0xee40('0x41')](_0x538c8b)&&typeof _0x538c8b===_0xee40('0x97')&&!_[_0xee40('0x4b')](_0x538c8b)){if(!_[_0xee40('0x41')](_0x1c6eb5)&&typeof _0x1c6eb5===_0xee40('0x97')&&!_['isEmpty'](_0x1c6eb5)){return util[_0xee40('0x7c')](_0xee40('0x98'),_0x1c6eb5,_0x538c8b);}return util[_0xee40('0x7c')](_0xee40('0x98'),_0x538c8b,_0x538c8b);}if(!_[_0xee40('0x41')](_0x57e455)&&typeof _0x57e455===_0xee40('0x97')&&!_[_0xee40('0x4b')](_0x57e455)){return _0x57e455;}return _0xee40('0x99');}function loggerCatchQueueSummary(_0x3dc0c8,_0x4407c){return function(_0x597649){freeVariablesPredictive(_0x4407c);emitVoiceQueueSummary(_0x4407c);emitCampaignSummary(_0x4407c);loggerSyncQueueSummary[_0xee40('0x9a')](_0x3dc0c8,util[_0xee40('0x9b')](_0x597649,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x12e18e,_0x37fbe5){return function(_0x330b3d){loggerPredictive[_0xee40('0x9a')](_0x37fbe5[_0xee40('0x44')],_0x12e18e);loggerPredictive[_0xee40('0x9a')](_0x330b3d['stack']);freeVariablesPredictive(_0x37fbe5);};}function loggerCatch(_0x250c10){return function(_0xf6f1de){logger[_0xee40('0x9a')](_0x250c10,util[_0xee40('0x9b')](_0xf6f1de,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x3b8516){return _0x3b8516&&!_[_0xee40('0x41')](_0x3b8516)&&_0x3b8516[_0xee40('0x9c')]>0x0;}function decremetOriginate(_0x3bdbd9){if(!_[_0xee40('0x41')](_0x3bdbd9)&&_0x3bdbd9!==null){if(typeof _0x3bdbd9[_0xee40('0x73')]!=='undefined'){if(_0x3bdbd9[_0xee40('0x73')]>0x0){_0x3bdbd9['originated']-=0x1;}else{logger[_0xee40('0x9a')](_0xee40('0x9d'));}}}else{logger['error'](_0xee40('0x9e'));}}function checkContactLowerLimitOriginate(_0x536e49,_0x5b62e3,_0x259c0a){if(_0x5b62e3>_0x259c0a){for(var _0x1dd25e=0x0;_0x1dd25e<_0x5b62e3-_0x259c0a;_0x1dd25e+=0x1){decremetOriginate(_0x536e49);}}}function loggerGetContactDialer(_0x2e1cf9,_0x27e65a,_0xbb2bc9){return function(_0x916133){checkContactLowerLimitOriginate(_0x27e65a,_0xbb2bc9,0x0);logger[_0xee40('0x9a')](_0x2e1cf9,util['inspect'](_0x916133,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x5df557){return function(_0x58566e){if(isNotNull(_0x58566e)&&isNotNull(_0x58566e[0x0])){if(_0x58566e[0x0][_0xee40('0x9f')]>0x0){_0x5df557[_0xee40('0x42')]=_0xee40('0xa0');logger[_0xee40('0x82')](_0xee40('0xa1')+_0x5df557[_0xee40('0x44')],_0x58566e[0x0][_0xee40('0x9f')],_0xee40('0xa2'));}else{_0x5df557[_0xee40('0x42')]=_0xee40('0xa3');logger[_0xee40('0x82')](_0xee40('0xa4')+_0x5df557[_0xee40('0x44')]);}}};}function notSendMessagesQueue(_0x5c87e2){if(_0x5c87e2['sendMessageOneNotActive']){freeVariablesPredictive(_0x5c87e2);if(_0x5c87e2[_0xee40('0x73')]===0x0&&_0x5c87e2['talking']===0x0&&_0x5c87e2[_0xee40('0x5c')]===0x0&&(_0x5c87e2['pTalking']||0x0)===0x0){_0x5c87e2[_0xee40('0xa5')]=![];_0x5c87e2[_0xee40('0x55')]=0x0;_0x5c87e2[_0xee40('0x42')]=_0xee40('0xa6');loggerSyncQueueSummary[_0xee40('0x9a')](_0xee40('0xa7'),_0x5c87e2[_0xee40('0x44')],'is\x20not\x20active');}else{_0x5c87e2[_0xee40('0x42')]='IS_DISACTIVED';loggerSyncQueueSummary[_0xee40('0x9a')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x5c87e2[_0xee40('0x44')],_0xee40('0xa8'));}emitVoiceQueueSummary(_0x5c87e2);}}function notSendMessagesCampaign(_0x422346){if(_0x422346['sendMessageOneNotActive']){if(_0x422346[_0xee40('0x73')]===0x0){_0x422346[_0xee40('0xa5')]=![];_0x422346['message']=_0xee40('0xa6');loggerSyncQueueSummary[_0xee40('0x9a')](_0xee40('0xa9'),_0x422346['name'],_0xee40('0xaa'));}else{_0x422346[_0xee40('0x42')]=_0xee40('0xab');loggerSyncQueueSummary[_0xee40('0x9a')](_0xee40('0xa9'),_0x422346[_0xee40('0x44')],_0xee40('0xa8'));}emitCampaignSummary(_0x422346);}}function createObjHistory(_0x4de9c2,_0x59bf0d,_0x4b9a09,_0x2da1bb,_0x579cd6){_0x4de9c2[_0xee40('0x42')]=_0x4b9a09;var _0x35114e=new Action(_0x4de9c2,_0x59bf0d);var _0x4a5ce8=new History(_0x35114e);_0x4a5ce8[_0xee40('0xac')]=_0x2da1bb;_0x4a5ce8['statedesc']=_0x579cd6;_0x4a5ce8[_0xee40('0xad')]=_0x35114e[_0xee40('0xae')];return _0x4a5ce8;}Dialer['prototype'][_0xee40('0x40')]=function(){var _0x5ae4bd=this;setInterval(function(){_0x5ae4bd['clearZombieChannels'](_0x5ae4bd[_0xee40('0x26')],_0xee40('0xaf'));_0x5ae4bd[_0xee40('0xb0')](_0x5ae4bd[_0xee40('0xb1')],_0xee40('0xb2'));},0x32c8);};Dialer[_0xee40('0x1b')]['clearZombieChannels']=function(_0x5b4389,_0x54c981){var _0x2aa4d0=this;for(var _0x2c60e5 in _0x5b4389){if(typeof _0x5b4389[_0x2c60e5]!==_0xee40('0xb3')){this[_0xee40('0x1e')][_0xee40('0xb4')](function(){if(!_[_0xee40('0xb5')](_0x5b4389[_0x2c60e5])){return ami[_0xee40('0xb6')]({'action':_0xee40('0xb7'),'channel':_0x5b4389[_0x2c60e5]['channel']})['catch'](function(_0x9da2e5){if(_0x9da2e5[_0xee40('0x42')]===_0xee40('0xb8')){setTimeout(function(){if(_0x5b4389[_0x2c60e5]&&_0x5b4389[_0x2c60e5][_0xee40('0x7e')]!==_0xee40('0x7f')){_0x2aa4d0['updateOriginated'](_0x2aa4d0[_0xee40('0x1f')][_0x5b4389[_0x2c60e5][_0xee40('0xb9')]]);logger['error'](_0xee40('0xba'),_0x54c981,_0x2c60e5,_0x5b4389[_0x2c60e5][_0xee40('0xb9')]);delete _0x5b4389[_0x2c60e5];}if(_0x5b4389[_0x2c60e5]&&_0x5b4389[_0x2c60e5]['type']===_0xee40('0x7f')){_0x2aa4d0[_0xee40('0xbb')](_0x2aa4d0['campaigns'][_0x5b4389[_0x2c60e5][_0xee40('0xb9')]]);logger[_0xee40('0x9a')](_0xee40('0xbc'),_0x54c981,_0x2c60e5,_0x5b4389[_0x2c60e5][_0xee40('0xb9')]);delete _0x5b4389[_0x2c60e5];}},0x2328);}});}});}}};Dialer[_0xee40('0x1b')][_0xee40('0xbd')]=function(_0x161bac){return BPromise[_0xee40('0xbe')]()[_0xee40('0xbf')](cmHopper[_0xee40('0xbd')](_0x161bac))[_0xee40('0xc0')](loggerCatch(_0xee40('0xc1')));};Dialer[_0xee40('0x1b')][_0xee40('0xc2')]=function(_0x3d9549){return BPromise['resolve']()[_0xee40('0xbf')](cmHopperBlack[_0xee40('0xc2')](_0x3d9549))['catch'](loggerCatch(_0xee40('0xc3')));};Dialer['prototype'][_0xee40('0xc4')]=function(_0x85accb){return BPromise[_0xee40('0xbe')]()['then'](cmHopperBlack[_0xee40('0xc4')](_0x85accb))[_0xee40('0xc0')](loggerCatch(_0xee40('0xc5')));};Dialer[_0xee40('0x1b')][_0xee40('0xc6')]=function(_0x3a1c4f){return BPromise['resolve']()['then'](cmHopperHistory[_0xee40('0xc7')](_0x3a1c4f))['catch'](loggerCatch(_0xee40('0xc8')));};Dialer[_0xee40('0x1b')][_0xee40('0xc9')]=function(_0x3ce131){return BPromise[_0xee40('0xbe')]()[_0xee40('0xbf')](cmHopper[_0xee40('0xc9')](_0x3ce131))[_0xee40('0xc0')](loggerCatch(_0xee40('0xca')));};Dialer[_0xee40('0x1b')][_0xee40('0xcb')]=function(_0x4f8742,_0x174e6a,_0x3e2c2e){return BPromise[_0xee40('0xbe')]()[_0xee40('0xbf')](cmHopper[_0xee40('0xcb')](_0x4f8742,_0x174e6a,_0x3e2c2e))[_0xee40('0xc0')](loggerCatch(_0xee40('0xcc')));};Dialer['prototype']['getContactDialer']=function(_0x412f63,_0x57cf6f,_0x2e3996,_0x1dd081,_0xee55d){return BPromise[_0xee40('0xbe')]()['then'](cmHopper[_0xee40('0xcd')](_0x412f63,_0x57cf6f,_0x2e3996,_0x1dd081))['catch'](function(_0x128a91){_0xee55d[_0xee40('0xce')]-=_0x2e3996;_0xee55d['temp']=_0xee55d[_0xee40('0xce')]>0x0?_0xee55d['temp']:0x0;loggerCatch(_0xee40('0xcf'))(_0x128a91);});};Dialer[_0xee40('0x1b')]['getContactDialerIvr']=function(_0x68aa35,_0x5364bd,_0x1c15a3,_0x29c585){return BPromise[_0xee40('0xbe')]()['then'](cmHopper[_0xee40('0xd0')](_0x68aa35,_0x5364bd,_0x1c15a3))[_0xee40('0xc0')](function(_0x4a41d5){_0x29c585[_0xee40('0xce')]-=_0x5364bd;_0x29c585[_0xee40('0xce')]=_0x29c585[_0xee40('0xce')]>0x0?_0x29c585[_0xee40('0xce')]:0x0;loggerCatch(_0xee40('0xd1'))(_0x4a41d5);});};Dialer[_0xee40('0x1b')][_0xee40('0xd2')]=function(_0xf02a8d){return BPromise[_0xee40('0xbe')]()['then'](voiceQueueRt[_0xee40('0xd2')](_0xf02a8d))[_0xee40('0xc0')](loggerCatch(_0xee40('0xd3')));};Dialer['prototype'][_0xee40('0xd4')]=function(_0x28fd78){return BPromise[_0xee40('0xbe')]()[_0xee40('0xbf')](cmHopper[_0xee40('0xd4')](_0x28fd78))['catch'](loggerCatch(_0xee40('0xd5')));};Dialer[_0xee40('0x1b')]['createHistory']=function(_0x5528b2){return BPromise[_0xee40('0xbe')]()[_0xee40('0xbf')](cmHopperHistory[_0xee40('0xd6')](_0x5528b2))[_0xee40('0xc0')](loggerCatch(_0xee40('0xd7')));};Dialer[_0xee40('0x1b')][_0xee40('0xbb')]=function(_0x5cc8d6){if(!_[_0xee40('0x41')](_0x5cc8d6)&&_0x5cc8d6!==null){if(typeof _0x5cc8d6[_0xee40('0x73')]!=='undefined'){if(_0x5cc8d6['originated']>0x0){_0x5cc8d6[_0xee40('0x73')]-=0x1;}else{logger[_0xee40('0x9a')](_0xee40('0xd8'));}}}else{logger[_0xee40('0x9a')](_0xee40('0xd9'));}};Dialer[_0xee40('0x1b')]['loggerHandler']=function(_0x1a086f,_0x5d7831){var _0x5e0bf0=this;return function(_0x1772ea){_0x5e0bf0['updateOriginated'](_0x5d7831);logger['error'](_0x1a086f,util[_0xee40('0x9b')](_0x1772ea,{'showHidden':![],'depth':null}));};};Dialer[_0xee40('0x1b')][_0xee40('0xda')]=function(_0x2c111a,_0x599f0b,_0x32f730){var _0x45c3bb={'state':0x19,'statedesc':_0xee40('0xdb')};this['updateOriginated'](_0x599f0b);this[_0xee40('0xdc')](_[_0xee40('0x92')](_0x45c3bb,_['pick'](_0x32f730,[_0xee40('0xdd'),'ListId',_0xee40('0xde'),_0xee40('0xdf'),_0xee40('0xe0')])),'[emptyContact][createHistory]','[emptyContact]');logger[_0xee40('0x9a')](_0x2c111a);};Dialer[_0xee40('0x1b')][_0xee40('0xe1')]=function(_0x90842){return _0x90842===_0xee40('0xe2');};Dialer[_0xee40('0x1b')][_0xee40('0xe3')]=function(_0x47b4a6){return!_[_0xee40('0x41')](_0x47b4a6)&&_0x47b4a6&&!_['isUndefined'](_0x47b4a6[_0xee40('0x44')])&&!_['isUndefined'](_0x47b4a6[_0xee40('0x79')])&&_0x47b4a6[_0xee40('0x79')]&&(this[_0xee40('0x22')][util[_0xee40('0x7c')](_0xee40('0xe4'),_0x47b4a6[_0xee40('0x44')])][_0xee40('0xb7')]===_0xee40('0xe5')||this[_0xee40('0x22')][util[_0xee40('0x7c')](_0xee40('0xe4'),_0x47b4a6['name'])]['status']===_0xee40('0xe6'));};Dialer[_0xee40('0x1b')]['saveInDb']=function(_0x71c5f1,_0x2e00ec,_0xc35f0c){this[_0xee40('0xd6')](_0x71c5f1)[_0xee40('0xc0')](loggerCatch(_0x2e00ec));this[_0xee40('0xd4')](_0x71c5f1)[_0xee40('0xc0')](loggerCatch(_0xc35f0c));};Dialer[_0xee40('0x1b')]['syncVarSet']=function(_0x346276){var _0x56e85d=this[_0xee40('0x26')][_0x346276[_0xee40('0xe7')]];var _0x359bec;if(!_[_0xee40('0xb5')](_0x346276)&&!_[_0xee40('0xb5')](_0x346276['variable'])&&!_['isNil'](_0x346276[_0xee40('0xe8')][_0xee40('0xe9')])&&_0x346276[_0xee40('0xea')]===_0xee40('0xeb')&&_0x56e85d){if(_0x56e85d[_0xee40('0x7e')]!=='ivr'&&this['voiceQueues'][_0x56e85d[_0xee40('0xb9')]]['dialAMDActive']&&_0x346276[_0xee40('0xec')]===_0xee40('0xed')){delete this[_0xee40('0x26')][_0x346276[_0xee40('0xe7')]];this[_0xee40('0xbb')](this[_0xee40('0x1f')][_0x56e85d['queue']]);this[_0xee40('0x1f')][_0x56e85d[_0xee40('0xb9')]][_0xee40('0x63')]+=0x1;this[_0xee40('0x1f')][_0x56e85d[_0xee40('0xb9')]][_0xee40('0x62')]+=0x1;_0x359bec=new Hangup(_0x56e85d,_0x346276);_0x359bec[_0xee40('0xac')]=0x12;_0x359bec[_0xee40('0xee')]=_0xee40('0xef');_0x359bec[_0xee40('0xf0')]=_0xee40('0xf1');ami[_0xee40('0x51')](_0xee40('0xf2'),ut[_0xee40('0xf3')](_0x359bec,_0xee40('0xf4')));this[_0xee40('0xdc')](_0x359bec,_0xee40('0xf5'),_0xee40('0xf6'));}if(_0x56e85d[_0xee40('0x7e')]!==_0xee40('0x7f')&&this[_0xee40('0x1f')][_0x56e85d['queue']][_0xee40('0xf7')]&&_0x346276[_0xee40('0xec')]===_0xee40('0xf8')){var _0x42926e=this;return new BPromise(function(_0x3fa539,_0x3e4283){delete _0x42926e[_0xee40('0x26')][_0x346276[_0xee40('0xe7')]];_0x42926e[_0xee40('0xbb')](_0x42926e[_0xee40('0x1f')][_0x56e85d[_0xee40('0xb9')]]);_0x42926e[_0xee40('0x1f')][_0x56e85d[_0xee40('0xb9')]][_0xee40('0x63')]+=0x1;_0x42926e[_0xee40('0x1f')][_0x56e85d['queue']][_0xee40('0x62')]+=0x1;var _0x5d3e8a=_0x42926e[_0xee40('0x1f')][_0x56e85d[_0xee40('0xb9')]];var _0x4b3b88=new Hangup(_0x56e85d,_0x346276);_0x4b3b88['state']=0x13;_0x4b3b88['statedesc']=_0xee40('0xf9');_0x4b3b88['membername']='AMD';_0x4b3b88[_0xee40('0xfa')]+=0x1;_0x4b3b88[_0xee40('0xfb')]+=0x1;_0x4b3b88[_0xee40('0xf4')]=!![];ami[_0xee40('0x51')]('custom:amd',ut[_0xee40('0xf3')](_0x4b3b88,'amd'));_0x42926e[_0xee40('0xd6')](_0x4b3b88)[_0xee40('0xc0')](loggerCatch(_0xee40('0xfc')));if(_0x4b3b88['countbusyretry']+_0x4b3b88[_0xee40('0xfd')]+_0x4b3b88[_0xee40('0xfe')]+_0x4b3b88[_0xee40('0xff')]+_0x4b3b88['countdropretry']+_0x4b3b88[_0xee40('0x100')]+_0x4b3b88[_0xee40('0xfa')]+_0x4b3b88['countagentrejectretry']>=_0x5d3e8a[_0xee40('0x101')]){_0x42926e[_0xee40('0x102')](_0x4b3b88,_0x3fa539,_0x3e4283,'reason19\x20machine....');}else{if(_0x4b3b88[_0xee40('0xfa')]>=_0x5d3e8a[_0xee40('0x103')]){_0x42926e[_0xee40('0x104')](_0x4b3b88,_0x3fa539,_0x3e4283,_0xee40('0x105'));}else{_0x42926e[_0xee40('0xc9')]({'active':![],'countmachineretry':_0x4b3b88[_0xee40('0xfa')],'scheduledat':moment()['add'](_0x5d3e8a[_0xee40('0x106')],'minutes')[_0xee40('0x7c')](_0xee40('0x107')),'ContactId':_0x4b3b88['ContactId'],'ListId':_0x4b3b88[_0xee40('0x108')],'VoiceQueueId':_0x4b3b88[_0xee40('0xdf')]||undefined,'CampaignId':_0x4b3b88[_0xee40('0xe0')]||undefined})['catch'](loggerCatch(_0xee40('0x109')));_0x3fa539({'reschedule':0x1});}}});}if(_0x56e85d['type']===_0xee40('0x7f')&&this['campaigns'][_0x56e85d[_0xee40('0xb9')]][_0xee40('0xf7')]&&_0x346276[_0xee40('0xec')]===_0xee40('0xed')){delete this[_0xee40('0x26')][_0x346276[_0xee40('0xe7')]];this[_0xee40('0xbb')](this['campaigns'][_0x56e85d[_0xee40('0xb9')]]);_0x359bec=new Hangup(_0x56e85d,_0x346276);_0x359bec[_0xee40('0xac')]=0x12;_0x359bec[_0xee40('0xee')]=_0xee40('0xef');_0x359bec['membername']='AMD';ami[_0xee40('0x51')](_0xee40('0xf2'),ut['buildObj'](_0x359bec,_0xee40('0xf4')));this[_0xee40('0xdc')](_0x359bec,_0xee40('0x10a'),_0xee40('0x10b'));}if(_0x56e85d[_0xee40('0x7e')]===_0xee40('0x7f')&&this['campaigns'][_0x56e85d[_0xee40('0xb9')]][_0xee40('0xf7')]&&_0x346276['value']===_0xee40('0xf8')){var _0x42926e=this;return new BPromise(function(_0x401f65,_0x104425){delete _0x42926e[_0xee40('0x26')][_0x346276[_0xee40('0xe7')]];_0x42926e[_0xee40('0xbb')](_0x42926e[_0xee40('0x20')][_0x56e85d[_0xee40('0xb9')]]);_0x42926e['campaigns'][_0x56e85d[_0xee40('0xb9')]][_0xee40('0x63')]+=0x1;_0x42926e[_0xee40('0x20')][_0x56e85d[_0xee40('0xb9')]][_0xee40('0x62')]+=0x1;var _0x3ad177=_0x42926e[_0xee40('0x20')][_0x56e85d[_0xee40('0xb9')]];var _0x593f3c=new Hangup(_0x56e85d,_0x346276);_0x593f3c[_0xee40('0xac')]=0x13;_0x593f3c[_0xee40('0xee')]=_0xee40('0xf9');_0x593f3c[_0xee40('0xf0')]='AMD';_0x593f3c[_0xee40('0xfa')]+=0x1;_0x593f3c[_0xee40('0xfb')]+=0x1;_0x593f3c[_0xee40('0xf4')]=!![];ami[_0xee40('0x51')](_0xee40('0xf2'),ut['buildObj'](_0x593f3c,_0xee40('0xf4')));_0x42926e[_0xee40('0xd6')](_0x593f3c)[_0xee40('0xc0')](loggerCatch(_0xee40('0xfc')));if(_0x593f3c[_0xee40('0x10c')]+_0x593f3c['countcongestionretry']+_0x593f3c[_0xee40('0xfe')]+_0x593f3c[_0xee40('0xff')]+_0x593f3c[_0xee40('0x10d')]+_0x593f3c[_0xee40('0x100')]+_0x593f3c[_0xee40('0xfa')]+_0x593f3c[_0xee40('0x10e')]>=_0x3ad177[_0xee40('0x101')]){_0x42926e[_0xee40('0x102')](_0x593f3c,_0x401f65,_0x104425,_0xee40('0x10f'));}else{if(_0x593f3c[_0xee40('0xfa')]>=_0x3ad177[_0xee40('0x103')]){_0x42926e[_0xee40('0x104')](_0x593f3c,_0x401f65,_0x104425,_0xee40('0x105'));}else{_0x42926e[_0xee40('0xc9')]({'active':![],'countmachineretry':_0x593f3c[_0xee40('0xfa')],'scheduledat':moment()[_0xee40('0x110')](_0x3ad177[_0xee40('0x106')],_0xee40('0x111'))[_0xee40('0x7c')](_0xee40('0x107')),'ContactId':_0x593f3c[_0xee40('0xdd')],'ListId':_0x593f3c['ListId'],'VoiceQueueId':_0x593f3c[_0xee40('0xdf')]||undefined,'CampaignId':_0x593f3c[_0xee40('0xe0')]||undefined})[_0xee40('0xc0')](loggerCatch(_0xee40('0x109')));_0x401f65({'reschedule':0x1});}}});}}};Dialer['prototype']['syncHangup']=function(_0x3735ec){var _0x191d19=this[_0xee40('0x26')][_0x3735ec[_0xee40('0xe7')]];var _0x5282ae=this;var _0x4cc8fb;if(_0x191d19&&_0x191d19[_0xee40('0x7e')]===_0xee40('0x7f')){delete this[_0xee40('0x26')][_0x3735ec[_0xee40('0xe7')]];this[_0xee40('0xbb')](this[_0xee40('0x20')][_0x191d19[_0xee40('0xb9')]]);this[_0xee40('0x20')][_0x191d19['queue']][_0xee40('0x112')]+=0x1;_0x4cc8fb=new Hangup(_0x191d19,_0x3735ec);this[_0xee40('0xd6')](_0x4cc8fb)[_0xee40('0xc0')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0xee40('0xd4')](_0x4cc8fb)[_0xee40('0xc0')](loggerCatch(_0xee40('0x113')));}if(_0x191d19&&_0x191d19['type']!==_0xee40('0x7f')&&isNotNull(this[_0xee40('0x1f')][_0x191d19[_0xee40('0xb9')]][_0xee40('0x114')])){delete this[_0xee40('0x26')][_0x3735ec['uniqueid']];this[_0xee40('0xbb')](this['voiceQueues'][_0x191d19[_0xee40('0xb9')]]);this['voiceQueues'][_0x191d19[_0xee40('0xb9')]][_0xee40('0x63')]+=0x1;this['voiceQueues'][_0x191d19[_0xee40('0xb9')]][_0xee40('0x62')]+=0x1;_0x4cc8fb=new Hangup(_0x191d19,_0x3735ec);_0x4cc8fb['state']=0x10;_0x4cc8fb['statedesc']=_0xee40('0x115');_0x4cc8fb['membername']='AGI';this[_0xee40('0xd6')](_0x4cc8fb)[_0xee40('0xc0')](loggerCatch(_0xee40('0x116')));this[_0xee40('0xd4')](_0x4cc8fb)['catch'](loggerCatch(_0xee40('0x113')));}if(_0x191d19&&_0x191d19[_0xee40('0x7e')]!==_0xee40('0x7f')&&!isNotNull(this['voiceQueues'][_0x191d19[_0xee40('0xb9')]]['dialQueueProject'])){delete this[_0xee40('0x26')][_0x3735ec[_0xee40('0xe7')]];this[_0xee40('0xbb')](this[_0xee40('0x1f')][_0x191d19[_0xee40('0xb9')]]);this[_0xee40('0x1f')][_0x191d19[_0xee40('0xb9')]][_0xee40('0x6a')]+=0x1;_0x4cc8fb=new Hangup(_0x191d19,_0x3735ec);_0x4cc8fb[_0xee40('0xac')]=0xc;_0x4cc8fb[_0xee40('0xee')]=_0x3735ec[_0xee40('0x117')];_0x4cc8fb[_0xee40('0xf0')]='Unknow';this[_0xee40('0xd6')](_0x4cc8fb)['catch'](loggerCatch(_0xee40('0x116')));this[_0xee40('0xd4')](_0x4cc8fb)[_0xee40('0xc0')](loggerCatch(_0xee40('0x113')));}};Dialer['prototype'][_0xee40('0x33')]=function(_0x33648e){var _0x1473b4=this[_0xee40('0x26')][_0x33648e[_0xee40('0xe7')]];var _0x1d7da6=this;if(this[_0xee40('0x1f')][_0x33648e[_0xee40('0xb9')]]){if(_0x1473b4&&_0x1473b4[_0xee40('0x7e')]!=='ivr'){delete this[_0xee40('0x26')][_0x33648e[_0xee40('0xe7')]];this[_0xee40('0x1f')][_0x33648e[_0xee40('0xb9')]]['outboundAnswerCallsDay']+=0x1;var _0x3bab98=new AgentComplete(_0x1473b4,_0x33648e);if(_0x33648e[_0xee40('0x118')]==='agent'){_0x3bab98['agiafterat']=this[_0xee40('0x1f')][_0x33648e[_0xee40('0xb9')]]['dialQueueProject2']&&this[_0xee40('0x1f')][_0x33648e[_0xee40('0xb9')]][_0xee40('0x119')]?moment()[_0xee40('0x7c')](_0xee40('0x107')):undefined;}this[_0xee40('0xd6')](_0x3bab98)[_0xee40('0xc0')](loggerCatch('[syncAgentComplete][createHistory]'));this['moveContactManagedDialer'](_0x3bab98)[_0xee40('0xc0')](loggerCatch('[syncAgentComplete]'));}}};Dialer[_0xee40('0x1b')][_0xee40('0x2d')]=function(_0x5c6944){if(this[_0xee40('0x1f')][_0x5c6944['queue']]){if(this[_0xee40('0x26')][_0x5c6944[_0xee40('0xe7')]]&&this['uniqueId'][_0x5c6944[_0xee40('0xe7')]][_0xee40('0x7e')]!=='ivr'){this[_0xee40('0xbb')](this['voiceQueues'][_0x5c6944[_0xee40('0xb9')]]);this[_0xee40('0x26')][_0x5c6944[_0xee40('0xe7')]][_0xee40('0x11a')]=moment()[_0xee40('0x7c')](_0xee40('0x107'));}}};Dialer[_0xee40('0x1b')][_0xee40('0x11b')]=function(_0x68084){this['createHistory'](_0x68084)[_0xee40('0xc0')](loggerCatch('[syncAgentComplete][createHistory]'));this[_0xee40('0xd4')](_0x68084)[_0xee40('0xc0')](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));};Dialer[_0xee40('0x1b')][_0xee40('0x30')]=function(_0x3fe2cd){var _0x1f9700=this[_0xee40('0x26')][_0x3fe2cd['uniqueid']];var _0x2a1ded=this;if(this[_0xee40('0x1f')][_0x3fe2cd[_0xee40('0xb9')]]){if(_0x1f9700&&_0x1f9700[_0xee40('0x7e')]!==_0xee40('0x7f')){delete this[_0xee40('0x26')][_0x3fe2cd[_0xee40('0xe7')]];this[_0xee40('0xbb')](this[_0xee40('0x1f')][_0x3fe2cd[_0xee40('0xb9')]]);_0x1f9700[_0xee40('0x11c')]=moment()[_0xee40('0x7c')]('YYYY-MM-DD\x20HH:mm:ss');var _0x99b32f=new QueueCallerAbandon(_0x1f9700,_0x3fe2cd);if(getSeconds(_0x1f9700['droptime'],_0x1f9700[_0xee40('0x11d')])>=_0x1f9700['dialQueueTimeout']){this[_0xee40('0x1f')][_0x3fe2cd[_0xee40('0xb9')]][_0xee40('0x6c')]+=0x1;this[_0xee40('0x1f')][_0x3fe2cd['queue']]['outboundDropCallsDayTimeout']+=0x1;this['voiceQueues'][_0x3fe2cd[_0xee40('0xb9')]][_0xee40('0x6e')]+=0x1;_0x99b32f[_0xee40('0xac')]=0xa;_0x99b32f[_0xee40('0xee')]='Drop';_0x99b32f[_0xee40('0x11e')]=_0xee40('0x11f');_0x99b32f[_0xee40('0x120')]=this['voiceQueues'][_0x3fe2cd[_0xee40('0xb9')]][_0xee40('0x121')]?moment()[_0xee40('0x7c')](_0xee40('0x107')):undefined;_0x99b32f[_0xee40('0x10d')]+=0x1;_0x99b32f[_0xee40('0xfb')]+=0x1;if(_0x99b32f[_0xee40('0x10d')]>=this[_0xee40('0x1f')][_0x3fe2cd[_0xee40('0xb9')]][_0xee40('0x122')]){this[_0xee40('0x11b')](_0x99b32f);}else{this[_0xee40('0xc9')]({'active':![],'countdropretry':_0x99b32f[_0xee40('0x10d')],'scheduledat':moment()['add'](this[_0xee40('0x1f')][_0x3fe2cd[_0xee40('0xb9')]][_0xee40('0x123')],'minutes')[_0xee40('0x7c')](_0xee40('0x107')),'ContactId':_0x1f9700[_0xee40('0xdd')],'ListId':_0x1f9700[_0xee40('0x108')],'VoiceQueueId':_0x1f9700['VoiceQueueId']||undefined,'CampaignId':_0x1f9700['CampaignId']||undefined})[_0xee40('0xc0')](loggerCatch(_0xee40('0x124')));var _0x57d366=new History(_0x99b32f);_0x57d366[_0xee40('0xac')]=0xa;_0x57d366[_0xee40('0xee')]=_0xee40('0x125');_0x57d366[_0xee40('0xae')]=moment()[_0xee40('0x7c')](_0xee40('0x107'));_0x57d366[_0xee40('0xad')]=_0x57d366[_0xee40('0xae')];_0x57d366[_0xee40('0x126')]=_0x99b32f[_0xee40('0x126')];_0x57d366[_0xee40('0x127')]=_0x99b32f[_0xee40('0x127')];this[_0xee40('0xd6')](_0x57d366)[_0xee40('0xc0')](loggerCatch(_0xee40('0x128')));}}else{this[_0xee40('0x1f')][_0x3fe2cd[_0xee40('0xb9')]][_0xee40('0x6b')]+=0x1;this[_0xee40('0x1f')][_0x3fe2cd[_0xee40('0xb9')]]['outboundDropCallsDayCallersExit']+=0x1;_0x99b32f[_0xee40('0xac')]=0xb;_0x99b32f[_0xee40('0xee')]=_0xee40('0x129');_0x99b32f[_0xee40('0x11e')]='CALLEREXIT';_0x99b32f[_0xee40('0x100')]+=0x1;_0x99b32f[_0xee40('0xfb')]+=0x1;if(_0x99b32f[_0xee40('0x100')]>=this[_0xee40('0x1f')][_0x3fe2cd[_0xee40('0xb9')]][_0xee40('0x12a')]){this['queueCallerAbandonCreateState'](_0x99b32f);}else{this[_0xee40('0xc9')]({'active':![],'countabandonedretry':_0x99b32f[_0xee40('0x100')],'scheduledat':moment()[_0xee40('0x110')](this[_0xee40('0x1f')][_0x3fe2cd[_0xee40('0xb9')]][_0xee40('0x12b')],_0xee40('0x111'))[_0xee40('0x7c')](_0xee40('0x107')),'ContactId':_0x1f9700[_0xee40('0xdd')],'ListId':_0x1f9700[_0xee40('0x108')],'VoiceQueueId':_0x1f9700[_0xee40('0xdf')]||undefined,'CampaignId':_0x1f9700[_0xee40('0xe0')]||undefined})[_0xee40('0xc0')](loggerCatch(_0xee40('0x12c')));var _0x57d366=new History(_0x99b32f);_0x57d366[_0xee40('0xac')]=0xb;_0x57d366['statedesc']=_0xee40('0x129');_0x57d366[_0xee40('0xae')]=moment()[_0xee40('0x7c')](_0xee40('0x107'));_0x57d366[_0xee40('0xad')]=_0x57d366[_0xee40('0xae')];_0x57d366[_0xee40('0x126')]=_0x99b32f['calleridname'];_0x57d366['calleridnum']=_0x99b32f[_0xee40('0x127')];this[_0xee40('0xd6')](_0x57d366)[_0xee40('0xc0')](loggerCatch(_0xee40('0x12d')));}}}}};Dialer[_0xee40('0x1b')]['syncNewExten']=function(_0xef8c9){if(this[_0xee40('0xb1')][_0xef8c9['uniqueid']]){this[_0xee40('0xb1')][_0xef8c9[_0xee40('0xe7')]][_0xee40('0x12e')]=_0xef8c9[_0xee40('0x12e')];}if(this[_0xee40('0x26')][_0xef8c9['uniqueid']]){this[_0xee40('0x26')][_0xef8c9[_0xee40('0xe7')]][_0xee40('0x12e')]=_0xef8c9[_0xee40('0x12e')];}};Dialer[_0xee40('0x1b')][_0xee40('0x3c')]=function(_0x3ec7e8){if(strategy[this['voiceQueues'][this['actions'][_0x3ec7e8['actionid']][_0xee40('0xb9')]][_0xee40('0x53')]]===_0xee40('0x1a')){if(this[_0xee40('0xb1')][_0x3ec7e8[_0xee40('0x12f')]]&&_[_0xee40('0xb5')](this['actions'][_0x3ec7e8['actionid']][_0xee40('0x130')])&&_0x3ec7e8['status']==='1'&&_0x3ec7e8['paused']==='0'){if(this[_0xee40('0x21')][_0x3ec7e8['stateinterface']]){if(!this[_0xee40('0x21')][_0x3ec7e8[_0xee40('0x131')]][_0xee40('0x130')]){this['agents'][_0x3ec7e8['stateinterface']][_0xee40('0x130')]=!![];this[_0xee40('0xb1')][_0x3ec7e8[_0xee40('0x12f')]][_0xee40('0x130')]=!![];this[_0xee40('0xb1')][_0x3ec7e8[_0xee40('0x12f')]][_0xee40('0x131')]=_0x3ec7e8[_0xee40('0x131')];}}}}else if((strategy[this[_0xee40('0x1f')][this[_0xee40('0xb1')][_0x3ec7e8[_0xee40('0x12f')]][_0xee40('0xb9')]]['strategy']]||_0xee40('0x19'))===_0xee40('0x19')){if(this['actions'][_0x3ec7e8[_0xee40('0x12f')]]){if(this[_0xee40('0x21')][_0x3ec7e8[_0xee40('0x131')]]){this[_0xee40('0xb1')][_0x3ec7e8[_0xee40('0x12f')]][_0xee40('0x131')]=_0x3ec7e8['stateinterface'];if(_[_0xee40('0xb5')](this[_0xee40('0x2b')][this[_0xee40('0xb1')][_0x3ec7e8['actionid']]['queue']])){this[_0xee40('0x2b')][this['actions'][_0x3ec7e8[_0xee40('0x12f')]]['queue']]=[];}this[_0xee40('0x2b')][this[_0xee40('0xb1')][_0x3ec7e8[_0xee40('0x12f')]]['queue']][_0xee40('0x132')](_[_0xee40('0x92')](_['pick'](this['actions'][_0x3ec7e8['actionid']],[_0xee40('0x133'),'stateinterface']),{'status':_0x3ec7e8[_0xee40('0xb7')],'paused':_0x3ec7e8[_0xee40('0x134')]}));}}}};function unlockQueueStatus(_0x402154,_0x217b3c){setTimeout(function(){if(_[_0xee40('0x41')](_0x402154[_0xee40('0x135')])){loggerBooked[_0xee40('0x9a')](_0xee40('0x136'),_0x217b3c);}_0x402154[_0xee40('0x135')]=!![];loggerBooked[_0xee40('0x82')](_0xee40('0x137'),_0x217b3c,JSON[_0xee40('0x4e')](_[_0xee40('0x138')](_0x402154,[_0xee40('0x44'),_0xee40('0x135')])));},0x1f3);}Dialer[_0xee40('0x1b')][_0xee40('0x3e')]=function(_0x484541){var _0x267f0d=this;var _0x4fa404=_0x267f0d[_0xee40('0x1f')][_0x267f0d[_0xee40('0xb1')][_0x484541['actionid']]['queue']];if(strategy[this[_0xee40('0x1f')][this[_0xee40('0xb1')][_0x484541[_0xee40('0x12f')]][_0xee40('0xb9')]][_0xee40('0x53')]]===_0xee40('0x1a')){if(this['actions'][_0x484541[_0xee40('0x12f')]]&&this[_0xee40('0xb1')][_0x484541[_0xee40('0x12f')]][_0xee40('0x131')]){this[_0xee40('0x96')]['run'](this['actions'][_0x484541[_0xee40('0x12f')]][_0xee40('0x133')],this[_0xee40('0xb1')][_0x484541['actionid']]['stateinterface'])[_0xee40('0xc0')](function(_0x5317a8){logger[_0xee40('0x9a')](_0xee40('0x139'),util[_0xee40('0x9b')](_0x5317a8,{'showHidden':![],'depth':null}));})[_0xee40('0x1d')](function(){_0x267f0d[_0xee40('0xbb')](_0x267f0d[_0xee40('0x1f')][_0x267f0d[_0xee40('0xb1')][_0x484541[_0xee40('0x12f')]][_0xee40('0xb9')]]);_0x267f0d[_0xee40('0x21')][_0x267f0d[_0xee40('0xb1')][_0x484541['actionid']][_0xee40('0x131')]][_0xee40('0x130')]=![];delete _0x267f0d[_0xee40('0xb1')][_0x484541[_0xee40('0x12f')]];unlockQueueStatus(_0x4fa404);});}else{this['updateOriginated'](this['voiceQueues'][this[_0xee40('0xb1')][_0x484541[_0xee40('0x12f')]]['queue']]);this['rescheduleContact']({'active':![],'ContactId':this['actions'][_0x484541['actionid']]['ContactId'],'ListId':this[_0xee40('0xb1')][_0x484541['actionid']]['ListId'],'VoiceQueueId':this[_0xee40('0xb1')][_0x484541['actionid']][_0xee40('0xdf')]||undefined,'CampaignId':this[_0xee40('0xb1')][_0x484541[_0xee40('0x12f')]][_0xee40('0xe0')]||undefined})['catch'](loggerCatch(_0xee40('0x13a')));delete this['actions'][_0x484541['actionid']];unlockQueueStatus(_0x4fa404);}}else if((strategy[this[_0xee40('0x1f')][this['actions'][_0x484541[_0xee40('0x12f')]]['queue']]['strategy']]||_0xee40('0x19'))===_0xee40('0x19')){var _0x5cbc99;if(this[_0xee40('0xb1')][_0x484541[_0xee40('0x12f')]]&&!_[_0xee40('0x4b')](this[_0xee40('0x2b')][this['actions'][_0x484541['actionid']][_0xee40('0xb9')]])){if(this['queueBookedRR'][_0x267f0d[_0xee40('0xb1')][_0x484541[_0xee40('0x12f')]][_0xee40('0xb9')]]){this['queueBookedRR'][_0x267f0d[_0xee40('0xb1')][_0x484541[_0xee40('0x12f')]]['queue']]=this['queueBookedRR'][this[_0xee40('0xb1')][_0x484541[_0xee40('0x12f')]]['queue']]?this[_0xee40('0x13b')][this[_0xee40('0xb1')][_0x484541[_0xee40('0x12f')]][_0xee40('0xb9')]]:this['queueBooked'][this['actions'][_0x484541['actionid']]['queue']]?this[_0xee40('0x2b')][this['actions'][_0x484541[_0xee40('0x12f')]][_0xee40('0xb9')]]['_rr']||0x0:0x0;}this[_0xee40('0x2b')][this[_0xee40('0xb1')][_0x484541[_0xee40('0x12f')]][_0xee40('0xb9')]][_0xee40('0x13c')]=this[_0xee40('0x13b')][this[_0xee40('0xb1')][_0x484541[_0xee40('0x12f')]][_0xee40('0xb9')]];for(var _0x1650e9=0x0;_0x1650e9=0x0;})[_0xee40('0xc0')](myreject(_0x4c72d1)));}}else{_0x1762fb['push'](ami[_0xee40('0xb6')]({'action':_0xee40('0x14f'),'command':util[_0xee40('0x7c')](_0xee40('0x150'),_0x4d85f7,!_[_0xee40('0x41')](config[_0xee40('0x14c')][_0x14c10a])?_0x14c10a:'')})[_0xee40('0xbf')](function(_0x2106cc){return _0x2106cc[_0xee40('0x152')]['indexOf'](_0xee40('0x154'))>=0x0;})[_0xee40('0xc0')](myreject(_0x4c72d1)));}BPromise[_0xee40('0x155')](_0x1762fb)[_0xee40('0xbf')](function(_0x31b3c3){var _0x54fcdd=_['some'](_0x31b3c3);if(_0x54fcdd){return _0xcd48a4(_0x54fcdd);}else{_0x1bce40[_0xee40('0x42')]=_0x2ff07f?_0xee40('0x156'):'INTERVAL_IS_OVERTIME';return _0x4c72d1(msgResponse(_0xee40('0x157'),_0xee40('0x149'),_0xee40('0x158')+_0x2ff07f+'\x20'+_0x175286+_0xee40('0x159')+util[_0xee40('0x9b')](_0x4d85f7,{'showHidden':![],'depth':null})+_0xee40('0x15a')+_0x14c10a));}})['catch'](function(_0x384f44){return _0x4c72d1(msgResponse(_0xee40('0x148'),_0xee40('0x149'),JSON[_0xee40('0x4e')](_0x384f44)));});});};Dialer[_0xee40('0x1b')][_0xee40('0x15b')]=function(_0x46b1a5){var _0x545c90=this;return function(){switch(_0x46b1a5[_0xee40('0x15c')]){case _0xee40('0x15d'):freeVariablesPredictive(_0x46b1a5);_0x545c90[_0xee40('0x15e')](_0x46b1a5,0x1);break;case _0xee40('0x15f'):freeVariablesPredictive(_0x46b1a5);_0x545c90[_0xee40('0x15e')](_0x46b1a5,_0x46b1a5[_0xee40('0x160')]);break;case _0xee40('0x7'):_0x545c90[_0xee40('0x7')](_0x46b1a5);break;case'booked':freeVariablesPredictive(_0x46b1a5);_0x545c90[_0xee40('0x15e')](_0x46b1a5,0x1);break;default:freeVariablesPredictive(_0x46b1a5);logger[_0xee40('0x9a')]('Queue',_0x46b1a5['name'],'method\x20not\x20recognized');}};};Dialer[_0xee40('0x1b')][_0xee40('0x161')]=function(_0x473630){var _0x2a6b5a=this;return function(){_0x2a6b5a['handleIvr'](_0x473630);};};Dialer[_0xee40('0x1b')][_0xee40('0x9')]=function(_0x1c4ddb){var _0x546fd7=this;if(isNotPreview(_0x1c4ddb[_0xee40('0x15c')])){if(isVoiceQueueOutbound(_0x1c4ddb['type'])&&isActive(_0x1c4ddb[_0xee40('0x5e')])){_0x1c4ddb['sendMessageOneNotActive']=!![];BPromise[_0xee40('0xbe')]()[_0xee40('0xbf')](checkIsLoggedIn(_0x1c4ddb,_0x1c4ddb['loggedIn']))[_0xee40('0xbf')](checkIsActive(_0x1c4ddb,_0x1c4ddb['dialActive']))[_0xee40('0xbf')](checkInterval(_0x1c4ddb))[_0xee40('0xbf')](_0x546fd7[_0xee40('0x162')](_0x1c4ddb))[_0xee40('0xbf')](_0x546fd7['checkIfTime'](_0x1c4ddb[_0xee40('0x163')],_0x1c4ddb[_0xee40('0x164')],_0x1c4ddb[_0xee40('0x44')],_0x1c4ddb))[_0xee40('0xbf')](_0x546fd7[_0xee40('0x165')](_0x1c4ddb[_0xee40('0x47')],_0x1c4ddb[_0xee40('0x164')],_0x1c4ddb['name'],_0x1c4ddb))[_0xee40('0xbf')](_0x546fd7[_0xee40('0x15b')](_0x1c4ddb))['catch'](loggerCatchQueueSummary(_0xee40('0x166'),_0x1c4ddb));}else{notSendMessagesQueue(_0x1c4ddb);}}else{freeVariablesPredictive(_0x1c4ddb);}};Dialer['prototype'][_0xee40('0x167')]=function(){var _0x208313=this;var _0x51870a;for(var _0x2e7490 in this[_0xee40('0x20')]){if(typeof this[_0xee40('0x20')][_0x2e7490]!==_0xee40('0xb3')){_0x51870a=this[_0xee40('0x20')][_0x2e7490];if(isCampaignIvr(_0x51870a[_0xee40('0x7e')])&&isActive(_0x51870a['active'])){_0x51870a[_0xee40('0xa5')]=!![];BPromise[_0xee40('0xbe')]()[_0xee40('0xbf')](checkIsActive(_0x51870a,_0x51870a[_0xee40('0x79')]))[_0xee40('0xbf')](checkInterval(_0x51870a))[_0xee40('0xbf')](_0x208313[_0xee40('0x162')](_0x51870a))['then'](_0x208313[_0xee40('0x147')](_0x51870a[_0xee40('0x163')],_0x51870a[_0xee40('0x164')],_0x51870a['name'],_0x51870a))[_0xee40('0xbf')](_0x208313[_0xee40('0x165')](_0x51870a[_0xee40('0x47')],_0x51870a[_0xee40('0x164')],_0x51870a['name'],_0x51870a))[_0xee40('0xbf')](_0x208313[_0xee40('0x161')](_0x51870a))[_0xee40('0xc0')](loggerCatchQueueSummary(_0xee40('0x168'),_0x51870a));}else{notSendMessagesCampaign(_0x51870a);}}}};function getCallerIdRandom(_0x708249,_0x3f4709){var _0x47b438;var _0x8eaea6;var _0x1d0242;if(_0x3f4709<=0x0){_0x3f4709=0x1;}_0x47b438=new RegExp('\x5cw{0,'+_0x3f4709+'}$');_0x8eaea6=Math[_0xee40('0x169')](0xa,_0x3f4709-0x1);_0x1d0242=Math[_0xee40('0x169')](0xa,_0x3f4709)-0x1;return util[_0xee40('0x7c')]('%s',_[_0xee40('0x16a')](_0x708249,_0x47b438,_[_0xee40('0x16b')](_0x8eaea6,_0x1d0242)));}function extractCalleridName(_0x54e4c0){var _0x48272f=_0x54e4c0[_0xee40('0x16c')](/"(.*?)"/);return _0x48272f?_0x48272f[0x1]:_0x54e4c0;}function extractCalleridNumber(_0x5e0dcc){var _0x2651a8=_0x5e0dcc[_0xee40('0x16c')](/<(.*?)>/);return _0x2651a8?_0x2651a8[0x1]:_0x5e0dcc;}Dialer[_0xee40('0x1b')][_0xee40('0x16d')]=function(_0x5842ec,_0x3e4a3a){var _0x21ea6b=this;var _0x29729e=uuid['v4']();this[_0xee40('0xb1')][_0x29729e]=new Action(_0x5842ec,_0x3e4a3a,_0x29729e);return new BPromise(function(_0x3f2557,_0x11d282){if(_[_0xee40('0x41')](_0x5842ec)&&typeof _0x5842ec!=='object'){return _0x11d282(msgResponse(_0xee40('0x16e'),_0xee40('0x149'),_0xee40('0x16f')));}if(_[_0xee40('0x41')](_0x3e4a3a[_0xee40('0x170')][_0xee40('0x171')])||_0x3e4a3a[_0xee40('0x170')][_0xee40('0x171')]===null){return _0x11d282(msgResponse(_0xee40('0x16e'),_0xee40('0x149'),_0xee40('0x172')));}var _0x58fd83={'XMD-CALLERID':_0x21ea6b[_0xee40('0xb1')][_0x29729e][_0xee40('0x173')](),'XMD-AGI':_0x5842ec[_0xee40('0x114')]?util['format'](_0xee40('0x174'),ipAgi,_0x5842ec[_0xee40('0x114')]):_0xee40('0x175'),'XMD-AGIAFTER':_0x5842ec[_0xee40('0x121')]?util[_0xee40('0x7c')](_0xee40('0x174'),ipAgi,_0x5842ec['dialQueueProject2']):_0xee40('0x175'),'XMD-QUEUE':_0x5842ec['type']===_0xee40('0x52')?util['format']('\x22%s,%s%s,,,%s\x22',_0x5842ec[_0xee40('0x44')],_0x5842ec[_0xee40('0x176')]||'',_0x5842ec[_0xee40('0x119')]?'c':'',_0x5842ec[_0xee40('0x177')]||0x3):_0xee40('0x175'),'XMD-CONTACTID':_0x3e4a3a[_0xee40('0xdd')],'XMD-CDRTYPE':_0xee40('0x178'),'CALLERID(all)':_0x21ea6b[_0xee40('0xb1')][_0x29729e][_0xee40('0x173')](),'XMD-AMD':_0x5842ec[_0xee40('0xf7')]?_0xee40('0x179'):_0xee40('0x175'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x5842ec[_0xee40('0xf7')]){_0x58fd83[_0xee40('0x17a')]=_0x5842ec[_0xee40('0x17b')]||0x9c4;_0x58fd83[_0xee40('0x17c')]=_0x5842ec[_0xee40('0x17d')]||0x5dc;_0x58fd83['XMD-AMDAFTERGREETINGSILENCE']=_0x5842ec[_0xee40('0x17e')]||0x320;_0x58fd83[_0xee40('0x17f')]=_0x5842ec[_0xee40('0x180')]||0x1388;_0x58fd83[_0xee40('0x181')]=_0x5842ec[_0xee40('0x182')]||0x64;_0x58fd83[_0xee40('0x183')]=_0x5842ec[_0xee40('0x184')]||0x32;_0x58fd83[_0xee40('0x185')]=_0x5842ec[_0xee40('0x186')]||0x3;_0x58fd83[_0xee40('0x187')]=_0x5842ec[_0xee40('0x188')]||0x100;_0x58fd83['XMD-AMDMAXIMUMWORDLENGTH']=_0x5842ec['dialAMDMaximumWordLength']||0x1388;}if(_0x5842ec['type']===_0xee40('0x52')){_0x58fd83[_0xee40('0x189')]=_0x3e4a3a['VoiceQueueId'];}else{_0x58fd83['XMD-CAMPAIGNID']=_0x3e4a3a[_0xee40('0xe0')];}for(var _0x36161a in _0x3e4a3a[_0xee40('0x170')]){if(typeof _0x3e4a3a[_0xee40('0x170')][_0x36161a]!==_0xee40('0xb3')){if(isNotNull(_0x3e4a3a['Contact'][_0x36161a])&&_0x36161a!=='id'&&_0x36161a!==_0xee40('0x18a')&&_0x36161a!==_0xee40('0x18b')&&_0x36161a!==_0xee40('0x18c')){_0x58fd83[util[_0xee40('0x7c')](_0xee40('0x18d'),'XMD-',_['toUpper'](_0x36161a))]=_0x3e4a3a[_0xee40('0x170')][_0x36161a];}}}var _0x1d2662=_0x21ea6b[_0xee40('0xe3')](_0x5842ec[_0xee40('0x78')])?getCallerId(_0x5842ec['Trunk'][_0xee40('0x7a')],_0x5842ec[_0xee40('0x18e')],_0x5842ec[_0xee40('0x18f')]>0x0?getCallerIdRandom(_0x5842ec[_0xee40('0x5f')],_0x5842ec[_0xee40('0x18f')]):_0x5842ec[_0xee40('0x5f')]):getCallerId(_[_0xee40('0xb5')](_0x5842ec[_0xee40('0x144')])?_0x5842ec[_0xee40('0x78')][_0xee40('0x7a')]:_0x5842ec[_0xee40('0x144')]['callerid'],_0x5842ec[_0xee40('0x18e')],_0x5842ec[_0xee40('0x18f')]>0x0?getCallerIdRandom(_0x5842ec['dialOriginateCallerIdNumber'],_0x5842ec[_0xee40('0x18f')]):_0x5842ec[_0xee40('0x5f')]);if(_0x1d2662){_0x58fd83['XMD-ORIGINATECALLERIDNAME']=_0x21ea6b[_0xee40('0xb1')][_0x29729e][_0xee40('0x190')]=extractCalleridName(_0x1d2662);_0x58fd83['XMD-ORIGINATECALLERIDNUM']=_0x21ea6b[_0xee40('0xb1')][_0x29729e][_0xee40('0x191')]=extractCalleridNumber(_0x1d2662);}return ami[_0xee40('0xb6')]({'actionid':_0x29729e,'action':_0xee40('0x16e'),'channel':_0x21ea6b['isTrunkReachable'](_0x5842ec[_0xee40('0x78')])?util['format'](_0xee40('0x192'),_0x5842ec[_0xee40('0x78')][_0xee40('0x44')],isNotNull(_0x5842ec[_0xee40('0x61')])?_0x5842ec['dialPrefix']['trim']()||'':'',_0x5842ec[_0xee40('0x193')]>0x0?_0x3e4a3a['Contact'][_0xee40('0x171')]['substring'](_0x5842ec[_0xee40('0x193')]):_0x3e4a3a['Contact'][_0xee40('0x171')]):util[_0xee40('0x7c')](_0xee40('0x192'),_[_0xee40('0xb5')](_0x5842ec[_0xee40('0x144')])?_0x5842ec[_0xee40('0x78')][_0xee40('0x44')]:_0x5842ec[_0xee40('0x144')][_0xee40('0x44')],isNotNull(_0x5842ec[_0xee40('0x61')])?_0x5842ec[_0xee40('0x61')][_0xee40('0x194')]()||'':'',_0x5842ec[_0xee40('0x193')]>0x0?_0x3e4a3a['Contact']['phone'][_0xee40('0x195')](_0x5842ec[_0xee40('0x193')]):_0x3e4a3a[_0xee40('0x170')]['phone']),'callerid':_0x1d2662,'Exten':'xcally-motion-dialer','Context':_0xee40('0x196'),'Priority':'1','variable':_0x58fd83,'timeout':(_0x5842ec[_0xee40('0x60')]||0x1e)*0x3e8,'async':!![],'channelid':_0x29729e})[_0xee40('0xbf')](function(_0x559dea){return _0x3f2557(_0x559dea);})[_0xee40('0xc0')](function(_0x832228){_0x5842ec[_0xee40('0x197')]+=0x1;var _0x336954=new History(_0x21ea6b[_0xee40('0xb1')][_0x29729e]);logger[_0xee40('0x9a')](util[_0xee40('0x7c')](_0xee40('0x198'),JSON[_0xee40('0x4e')](_0x832228)));_0x336954[_0xee40('0xac')]=0xe;_0x336954[_0xee40('0xee')]='OriginateError';_0x336954[_0xee40('0xae')]=moment()[_0xee40('0x7c')](_0xee40('0x107'));_0x336954['endtime']=_0x336954[_0xee40('0xae')];_0x21ea6b[_0xee40('0xd6')](_0x336954)[_0xee40('0xc0')](loggerCatch(_0xee40('0x199')));_0x21ea6b['moveContactManagedDialer'](_0x336954)[_0xee40('0xc0')](loggerCatch(_0xee40('0x199')))[_0xee40('0x1d')](function(){delete _0x21ea6b[_0xee40('0xb1')][_0x29729e];return _0x11d282(msgResponse('originate','Error',_0xee40('0x19a')));});});});};Dialer[_0xee40('0x1b')][_0xee40('0x32')]=function(_0x97bc29){var _0x5e3ab5=this[_0xee40('0xb1')][_0x97bc29[_0xee40('0x12f')]];if(_0x5e3ab5){delete this[_0xee40('0xb1')][_0x97bc29['actionid']];_0x5e3ab5[_0xee40('0x11d')]=moment()[_0xee40('0x7c')]('YYYY-MM-DD\x20HH:mm:ss');var _0x112cb7=_0x5e3ab5[_0xee40('0x7e')]===_0xee40('0x7f')?this['campaigns'][_0x5e3ab5[_0xee40('0xb9')]]:this[_0xee40('0x1f')][_0x5e3ab5['getQueue']()];if(!this[_0xee40('0xe1')](_0x97bc29[_0xee40('0x19b')])){this['updateOriginated'](_0x112cb7);return this['callProgressDetecting'](_0x5e3ab5,_0x112cb7,_0x97bc29)[_0xee40('0xc0')](loggerCatch(_0xee40('0x19c')));}this[_0xee40('0x26')][_0x97bc29[_0xee40('0xe7')]]=_0x5e3ab5;}};Dialer[_0xee40('0x1b')]['checkRetriveMax']=function(_0xf26cda,_0x4b9b3c,_0x24193a){var _0x5a1b39=new History(_0x4b9b3c);if(_0x5a1b39[_0xee40('0x10c')]+_0x5a1b39[_0xee40('0xfd')]+_0x5a1b39[_0xee40('0xfe')]+_0x5a1b39[_0xee40('0xff')]+_0x5a1b39['countdropretry']+_0x5a1b39[_0xee40('0x100')]+_0x5a1b39['countmachineretry']+_0x5a1b39[_0xee40('0x10e')]>=_0x24193a[_0xee40('0x101')]-0x1){return!![];}switch(_0xf26cda){case 0x3:if(_0x5a1b39['countnoanswerretry']>=_0x24193a[_0xee40('0x19d')]-0x1){return!![];}this[_0xee40('0xc9')]({'active':![],'countnoanswerretry':_0x5a1b39['countnoanswerretry']+=0x1,'scheduledat':moment()['add'](_0x24193a[_0xee40('0x19e')],_0xee40('0x111'))[_0xee40('0x7c')](_0xee40('0x107')),'ContactId':_0x5a1b39[_0xee40('0xdd')],'ListId':_0x5a1b39['ListId'],'VoiceQueueId':_0x5a1b39[_0xee40('0xdf')]||undefined,'CampaignId':_0x5a1b39[_0xee40('0xe0')]||undefined})[_0xee40('0xc0')](loggerCatch(_0xee40('0x19f')));break;case 0x5:if(_0x5a1b39[_0xee40('0x10c')]>=_0x24193a[_0xee40('0x1a0')]-0x1){return!![];}this[_0xee40('0xc9')]({'active':![],'countbusyretry':_0x5a1b39['countbusyretry']+=0x1,'scheduledat':moment()[_0xee40('0x110')](_0x24193a[_0xee40('0x1a1')],_0xee40('0x111'))[_0xee40('0x7c')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5a1b39[_0xee40('0xdd')],'ListId':_0x5a1b39[_0xee40('0x108')],'VoiceQueueId':_0x5a1b39[_0xee40('0xdf')]||undefined,'CampaignId':_0x5a1b39[_0xee40('0xe0')]||undefined})[_0xee40('0xc0')](loggerCatch(_0xee40('0x1a2')));break;case 0x8:if(_0x5a1b39[_0xee40('0xfd')]>=_0x24193a['dialCongestionMaxRetry']-0x1){return!![];}this['rescheduleContact']({'active':![],'countcongestionretry':_0x5a1b39[_0xee40('0xfd')]+=0x1,'scheduledat':moment()[_0xee40('0x110')](_0x24193a[_0xee40('0x1a3')],_0xee40('0x111'))['format'](_0xee40('0x107')),'ContactId':_0x5a1b39[_0xee40('0xdd')],'ListId':_0x5a1b39[_0xee40('0x108')],'VoiceQueueId':_0x5a1b39[_0xee40('0xdf')]||undefined,'CampaignId':_0x5a1b39[_0xee40('0xe0')]||undefined})['catch'](loggerCatch('[rescheduleContact]\x20[Congestion]'));break;case 0x0:if(_0x5a1b39[_0xee40('0xff')]>=_0x24193a[_0xee40('0x1a4')]-0x1){return!![];}else{this[_0xee40('0xc9')]({'active':![],'countnosuchnumberretry':_0x5a1b39[_0xee40('0xff')]+=0x1,'scheduledat':moment()[_0xee40('0x110')](_0x24193a[_0xee40('0x1a5')],_0xee40('0x111'))[_0xee40('0x7c')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5a1b39[_0xee40('0xdd')],'ListId':_0x5a1b39[_0xee40('0x108')],'VoiceQueueId':_0x5a1b39[_0xee40('0xdf')]||undefined,'CampaignId':_0x5a1b39[_0xee40('0xe0')]||undefined})[_0xee40('0xc0')](loggerCatch(_0xee40('0x1a6')));}break;case 0xa:if(_0x5a1b39[_0xee40('0x10d')]>=_0x24193a[_0xee40('0x122')]-0x1){return!![];}this[_0xee40('0xc9')]({'active':![],'countdropretry':_0x5a1b39[_0xee40('0x10d')]+=0x1,'scheduledat':moment()[_0xee40('0x110')](_0x24193a[_0xee40('0x123')],'minutes')[_0xee40('0x7c')](_0xee40('0x107')),'ContactId':_0x5a1b39[_0xee40('0xdd')],'ListId':_0x5a1b39[_0xee40('0x108')],'VoiceQueueId':_0x5a1b39['VoiceQueueId']||undefined,'CampaignId':_0x5a1b39[_0xee40('0xe0')]||undefined})[_0xee40('0xc0')](loggerCatch(_0xee40('0x124')));break;case 0xb:if(_0x5a1b39[_0xee40('0x100')]>=_0x24193a['dialAbandonedMaxRetry']-0x1){return!![];}this[_0xee40('0xc9')]({'active':![],'countabandonedretry':_0x5a1b39[_0xee40('0x100')]+=0x1,'scheduledat':moment()[_0xee40('0x110')](_0x24193a['dialAbandonedRetryFrequency'],'minutes')[_0xee40('0x7c')](_0xee40('0x107')),'ContactId':_0x5a1b39[_0xee40('0xdd')],'ListId':_0x5a1b39[_0xee40('0x108')],'VoiceQueueId':_0x5a1b39[_0xee40('0xdf')]||undefined,'CampaignId':_0x5a1b39[_0xee40('0xe0')]||undefined})[_0xee40('0xc0')](loggerCatch(_0xee40('0x12c')));break;case 0x13:if(_0x5a1b39[_0xee40('0xfa')]>=_0x24193a[_0xee40('0x103')]-0x1){return!![];}this[_0xee40('0xc9')]({'active':![],'countmachineretry':_0x5a1b39[_0xee40('0xfa')]+=0x1,'scheduledat':moment()[_0xee40('0x110')](_0x24193a[_0xee40('0x106')],_0xee40('0x111'))[_0xee40('0x7c')](_0xee40('0x107')),'ContactId':_0x5a1b39[_0xee40('0xdd')],'ListId':_0x5a1b39[_0xee40('0x108')],'VoiceQueueId':_0x5a1b39[_0xee40('0xdf')]||undefined,'CampaignId':_0x5a1b39[_0xee40('0xe0')]||undefined})[_0xee40('0xc0')](loggerCatch(_0xee40('0x109')));break;case 0x14:if(_0x5a1b39[_0xee40('0x10e')]>=_0x24193a[_0xee40('0x1a7')]-0x1){return!![];}this[_0xee40('0xc9')]({'active':![],'countagentrejectretry':_0x5a1b39[_0xee40('0x10e')]+=0x1,'scheduledat':moment()['add'](_0x24193a[_0xee40('0x1a8')],_0xee40('0x111'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5a1b39[_0xee40('0xdd')],'ListId':_0x5a1b39[_0xee40('0x108')],'VoiceQueueId':_0x5a1b39[_0xee40('0xdf')]||undefined,'CampaignId':_0x5a1b39['CampaignId']||undefined})[_0xee40('0xc0')](loggerCatch(_0xee40('0x1a9')));break;default:return!![];}};Dialer[_0xee40('0x1b')][_0xee40('0x1aa')]=function(_0x1bbba9,_0x3a551f,_0x4ff912){var _0x62a588=this;var _0x19bbce=new History(_0x1bbba9);return new BPromise(function(_0x2e8501,_0x55c3a6){if(_[_0xee40('0x41')](_0x3a551f)&&typeof _0x3a551f!=='object'){return _0x55c3a6(msgResponse(_0xee40('0x1ab'),_0xee40('0x149'),_0xee40('0x1ac')));}if(_['isUndefined'](_0x4ff912)&&typeof _0x4ff912!=='object'){return _0x55c3a6(msgResponse(_0xee40('0x1ab'),_0xee40('0x149'),_0xee40('0x1ad')));}switch(_0x4ff912['reason']){case'0':_0x3a551f[_0xee40('0x68')]+=0x1;_0x19bbce[_0xee40('0xac')]=0x0;_0x19bbce[_0xee40('0xee')]=_0xee40('0x1ae');_0x19bbce['countnosuchnumberretry']+=0x1;_0x19bbce[_0xee40('0xfb')]+=0x1;ami[_0xee40('0x51')](_0xee40('0x1af'),ut[_0xee40('0xf3')](_0x1bbba9,_0xee40('0x1b0')));_0x62a588[_0xee40('0xd6')](_0x19bbce)[_0xee40('0xc0')](loggerCatch(_0xee40('0xfc')));if(_0x62a588[_0xee40('0x1b1')](0x0,_0x1bbba9,_0x3a551f)){if(_0x19bbce[_0xee40('0xff')]>=_0x3a551f[_0xee40('0x1a4')]){_0x62a588[_0xee40('0x104')](_0x19bbce,_0x2e8501,_0x55c3a6,'reason\x200\x20no\x20such\x20number....');}else{_0x62a588['stateGlobal'](_0x19bbce,_0x2e8501,_0x55c3a6,_0xee40('0x1b2'));}}break;case'3':_0x3a551f[_0xee40('0x67')]+=0x1;_0x19bbce['state']=0x3;_0x19bbce[_0xee40('0xee')]=_0xee40('0x1b3');_0x19bbce[_0xee40('0xfe')]+=0x1;_0x19bbce[_0xee40('0xfb')]+=0x1;ami[_0xee40('0x51')]('custom:agentnoanswer',ut['buildObj'](_0x1bbba9,'noanswer'));_0x62a588['createHistory'](_0x19bbce)[_0xee40('0xc0')](loggerCatch(_0xee40('0x1b4')));if(_0x62a588[_0xee40('0x1b1')](0x3,_0x1bbba9,_0x3a551f)){if(_0x19bbce['countnoanswerretry']>=_0x3a551f[_0xee40('0x19d')]){_0x62a588[_0xee40('0x104')](_0x19bbce,_0x2e8501,_0x55c3a6,_0xee40('0x1b5'));}else{_0x62a588[_0xee40('0x102')](_0x19bbce,_0x2e8501,_0x55c3a6,_0xee40('0x1b5'));}}break;case'5':_0x3a551f[_0xee40('0x65')]+=0x1;_0x19bbce['state']=0x5;_0x19bbce[_0xee40('0xee')]=_0xee40('0x1b6');_0x19bbce['countbusyretry']+=0x1;_0x19bbce[_0xee40('0xfb')]+=0x1;ami[_0xee40('0x51')](_0xee40('0x1b7'),ut[_0xee40('0xf3')](_0x1bbba9,_0xee40('0x1b8')));_0x62a588[_0xee40('0xd6')](_0x19bbce)[_0xee40('0xc0')](loggerCatch(_0xee40('0x1b9')));if(_0x62a588['checkRetriveMax'](0x5,_0x1bbba9,_0x3a551f)){if(_0x19bbce[_0xee40('0x10c')]>=_0x3a551f['dialBusyMaxRetry']){_0x62a588[_0xee40('0x104')](_0x19bbce,_0x2e8501,_0x55c3a6,_0xee40('0x1ba'));}else{_0x62a588[_0xee40('0x102')](_0x19bbce,_0x2e8501,_0x55c3a6,_0xee40('0x1ba'));}}break;case'8':_0x3a551f[_0xee40('0x66')]+=0x1;_0x19bbce[_0xee40('0xac')]=0x8;_0x19bbce[_0xee40('0xee')]=_0xee40('0x1bb');_0x19bbce[_0xee40('0xfd')]+=0x1;_0x19bbce[_0xee40('0xfb')]+=0x1;ami[_0xee40('0x51')]('custom:agentcongestion',ut[_0xee40('0xf3')](_0x1bbba9,_0xee40('0x1bc')));_0x62a588[_0xee40('0xd6')](_0x19bbce)[_0xee40('0xc0')](loggerCatch(_0xee40('0x1bd')));if(_0x62a588['checkRetriveMax'](0x8,_0x1bbba9,_0x3a551f)){if(_0x19bbce['countcongestionretry']>=_0x3a551f[_0xee40('0x1be')]){_0x62a588[_0xee40('0x104')](_0x19bbce,_0x2e8501,_0x55c3a6,'reason\x208\x20congestion');}else{_0x62a588[_0xee40('0x102')](_0x19bbce,_0x2e8501,_0x55c3a6,'reason\x208\x20congestion');}}break;case'11':_0x3a551f[_0xee40('0x1bf')]+=0x1;_0x19bbce[_0xee40('0xac')]=0xb;_0x19bbce[_0xee40('0xee')]=_0xee40('0x129');_0x19bbce[_0xee40('0x100')]+=0x1;_0x19bbce['countglobal']+=0x1;_0x62a588['createHistory'](_0x19bbce)[_0xee40('0xc0')](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x62a588[_0xee40('0x1b1')](0xb,_0x1bbba9,_0x3a551f)){if(_0x19bbce[_0xee40('0x100')]>=_0x3a551f[_0xee40('0x12a')]){_0x62a588[_0xee40('0x104')](_0x19bbce,_0x2e8501,_0x55c3a6,_0xee40('0x1c0'));}else{_0x62a588['stateGlobal'](_0x19bbce,_0x2e8501,_0x55c3a6,_0xee40('0x1c0'));}}break;case'20':_0x3a551f[_0xee40('0x69')]+=0x1;_0x19bbce['state']=0x14;_0x19bbce[_0xee40('0xee')]='AgentReject';_0x19bbce[_0xee40('0x10e')]+=0x1;_0x19bbce[_0xee40('0xfb')]+=0x1;ami[_0xee40('0x51')](_0xee40('0x1c1'),ut[_0xee40('0xf3')](_0x1bbba9,_0xee40('0x1c2')));_0x62a588[_0xee40('0xd6')](_0x19bbce)['catch'](loggerCatch(_0xee40('0x1c3')));if(_0x62a588[_0xee40('0x1b1')](0x14,_0x1bbba9,_0x3a551f)){if(_0x19bbce['countagentrejectretry']>=_0x3a551f[_0xee40('0x1a7')]){_0x62a588['createStateFinal'](_0x19bbce,_0x2e8501,_0x55c3a6,_0xee40('0x1c4'));}else{_0x62a588['stateGlobal'](_0x19bbce,_0x2e8501,_0x55c3a6,_0xee40('0x1c4'));}}break;default:_0x3a551f[_0xee40('0x6a')]+=0x1;_0x19bbce[_0xee40('0xac')]=0xc;_0x19bbce['statedesc']=_0x4ff912['reason'];_0x62a588[_0xee40('0xd6')](_0x19bbce)[_0xee40('0xc0')](loggerCatch(_0xee40('0x1c5')));if(_0x62a588['checkRetriveMax'](_0x4ff912[_0xee40('0x118')],_0x1bbba9,_0x3a551f)){if(_0x19bbce[_0xee40('0x10c')]+_0x19bbce['countcongestionretry']+_0x19bbce[_0xee40('0xfe')]+_0x19bbce['countnosuchnumberretry']+_0x19bbce[_0xee40('0x10d')]+_0x19bbce[_0xee40('0x100')]+_0x19bbce[_0xee40('0xfa')]+_0x19bbce[_0xee40('0x10e')]>=_0x3a551f['dialGlobalMaxRetry']){_0x62a588[_0xee40('0x102')](_0x19bbce,_0x2e8501,_0x55c3a6,_0x4ff912[_0xee40('0x118')]);}else{_0x62a588[_0xee40('0x104')](_0x19bbce,_0x2e8501,_0x55c3a6,_0x4ff912['reason']);}}}});};Dialer[_0xee40('0x1b')][_0xee40('0x102')]=function(_0xf24a0,_0x30e686,_0x124866,_0x2ef1eb){var _0x3c7a31=new Final(_0xf24a0);_0x3c7a31[_0xee40('0xac')]=0xf;_0x3c7a31[_0xee40('0xee')]='Global';this[_0xee40('0x104')](_0x3c7a31,_0x30e686,_0x124866,_0x2ef1eb);};Dialer['prototype']['createStateFinal']=function(_0x1c6d5b,_0x271843,_0x2aaaed,_0x2a43b3){this[_0xee40('0xd4')](_0x1c6d5b)[_0xee40('0xbf')](function(){return _0x271843(msgResponse(_0xee40('0x1ab'),_0xee40('0xe2'),_0x2a43b3));})['catch'](function(){return _0x2aaaed(msgResponse('[moveContactManagedDialer][0]','Failure','contact\x20not\x20moved'));});};Dialer['prototype'][_0xee40('0x7')]=function(_0x137b41){var _0x21e5c5=_0x137b41[_0xee40('0x1c6')]/0x64;var _0x324dca=_0x137b41[_0xee40('0x1c7')]/(_0x137b41[_0xee40('0x1c7')]+_0x137b41[_0xee40('0x63')]);var _0x4d949b=Math['round'](_0x137b41[_0xee40('0x1c8')]*(_0x137b41[_0xee40('0x1c9')]/0x64));var _0x5368bf=Math[_0xee40('0x1ca')](_0x137b41[_0xee40('0x1c8')]*(_0x137b41[_0xee40('0x1cb')]/0x64));var _0x1574ef=_0x137b41[_0xee40('0x55')]+_0x137b41['talking'];var _0x50590a=Math[_0xee40('0x1cc')](_0x137b41['erlangCalls']*_0x137b41[_0xee40('0x76')]*_0x137b41['predictiveIntervalHitRate']*_0x137b41['predictiveIntervalMultiplicativeFactor']);if(_['isUndefined'](_0x137b41[_0xee40('0x29')])){if(!_[_0xee40('0x41')](_0x137b41[_0xee40('0x28')])){_0x137b41[_0xee40('0x28')]=undefined;loggerPredictive['error'](_0xee40('0x1cd'),_0xee40('0x1ce'));}if(!_['isUndefined'](_0x137b41[_0xee40('0x95')])){loggerPredictive['error'](_0xee40('0x1cd'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x137b41[_0xee40('0x95')]);_0x137b41['handlePredictive']=undefined;}_0x137b41[_0xee40('0x29')]=moment()[_0xee40('0x7c')](_0xee40('0x107'));loggerPredictive[_0xee40('0x82')](_0x137b41[_0xee40('0x44')],_0xee40('0x1cf'),_0x137b41['startProgressive']);this[_0xee40('0x15e')](_0x137b41,0x1);}else if(ifInterval(_0x137b41[_0xee40('0x1d0')],_0x137b41['startProgressive'])){this[_0xee40('0x15e')](_0x137b41,0x1);loggerPredictiveCalls[_0xee40('0x82')](_0xee40('0x1d1'),_0x137b41[_0xee40('0x29')],_0x137b41[_0xee40('0x44')]);_0x137b41[_0xee40('0x74')]=0x0;_0x137b41[_0xee40('0x6e')]=0x0;}else if(_0x21e5c5<_0x324dca&&_0x137b41[_0xee40('0x1d2')]===_0xee40('0x1d3')){freeVariablesPredictive(_0x137b41);loggerPredictive[_0xee40('0x82')](_0xee40('0x1d4'),'Dropped\x20calls\x20day',_0x324dca,_0xee40('0x29'),_0x137b41[_0xee40('0x44')]);}else if(_0x50590a<_0x137b41['predictiveIntervalErlangCallsDroppedCalls']&&_0x137b41[_0xee40('0x1d2')]===_0xee40('0x1d3')){freeVariablesPredictive(_0x137b41);loggerPredictive[_0xee40('0x82')](_0xee40('0x1d5'),'Max\x20Drop\x20',_0x50590a,_0xee40('0x1d6'),_0x137b41[_0xee40('0x6e')],_0xee40('0x29'),_0x137b41[_0xee40('0x44')]);}else if(!ifInterval(_0x137b41[_0xee40('0x1d0')],_0x137b41[_0xee40('0x29')])&&_[_0xee40('0x41')](_0x137b41[_0xee40('0x28')])&&!_[_0xee40('0x41')](_0x137b41[_0xee40('0x29')])){_0x137b41[_0xee40('0x28')]=moment()[_0xee40('0x7c')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0xee40('0x82')](_0x137b41[_0xee40('0x44')],_0xee40('0x1d7'),_0x137b41[_0xee40('0x28')]);this[_0xee40('0xc6')](_0x137b41[_0xee40('0x1d0')])['then'](this[_0xee40('0x1d8')](_0x137b41))[_0xee40('0xbf')](mergeDataErlangB(_0x137b41))[_0xee40('0xbf')](this[_0xee40('0x1d9')](_0x137b41))['catch'](loggerCatchPredictive(_0xee40('0x1da'),_0x137b41));}else if(!ifInterval(_0x137b41[_0xee40('0x1d0')],_0x137b41['startPredictive'])){_0x137b41['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x137b41[_0xee40('0x28')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0xee40('0x82')](_0x137b41[_0xee40('0x44')],_0xee40('0x1db'),_0x137b41[_0xee40('0x28')]);clearInterval(_0x137b41[_0xee40('0x95')]);_0x137b41['handlePredictive']=undefined;this[_0xee40('0xc6')](_0x137b41[_0xee40('0x1d0')])[_0xee40('0xbf')](this[_0xee40('0x1d8')](_0x137b41))[_0xee40('0xbf')](mergeDataErlangB(_0x137b41))[_0xee40('0xbf')](this[_0xee40('0x1d9')](_0x137b41))[_0xee40('0xc0')](loggerCatchPredictive(_0xee40('0x1dc'),_0x137b41));}else if(_0x137b41[_0xee40('0x1c8')]&&_0x1574ef<_0x137b41['predictiveIntervalAvailable']-_0x5368bf){freeVariablesPredictive(_0x137b41);loggerPredictive['info'](_0x137b41[_0xee40('0x44')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x1574ef,_0xee40('0x1dd'),_0x137b41['predictiveIntervalAvailable'],'-',_0x5368bf,'=',_0x137b41['predictiveIntervalAvailable']-_0x5368bf,')');}else if(_0x137b41[_0xee40('0x1c8')]&&_0x1574ef>_0x137b41[_0xee40('0x1c8')]+_0x4d949b){freeVariablesPredictive(_0x137b41);loggerPredictive[_0xee40('0x82')](_0x137b41[_0xee40('0x44')],_0xee40('0x1de'),_0x1574ef,_0xee40('0x1df'),_0x137b41[_0xee40('0x1c8')],'+',_0x4d949b,'=',_0x137b41[_0xee40('0x1c8')]+_0x4d949b,')');}};Dialer[_0xee40('0x1b')]['getDataPredictive']=function(_0x2f2cf5){var _0x31fe49=this;return function(_0x450382){return new BPromise(function(_0x381476,_0xf2bf3c){_[_0xee40('0x92')](_0x2f2cf5,_0x450382[0x0]);if(checkGetDataPredictive(_0x450382[0x0])){var _0x5d2566=_0x2f2cf5['predictiveIntervalAvailable']=_0x2f2cf5[_0xee40('0x1e0')]+_0x2f2cf5[_0xee40('0x55')];var _0x4447d1=_0x2f2cf5[_0xee40('0x1d0')]*0x3c;var _0x2765f7=_0x450382[0x0][_0xee40('0x8a')]+_0x450382[0x0][_0xee40('0x8d')];var _0x55f32f=(_0x450382[0x0]['predictiveIntervalAnsweredCalls']+_0x450382[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x450382[0x0][_0xee40('0x6b')])/_0x450382[0x0][_0xee40('0x72')];_0x2f2cf5[_0xee40('0x6f')]=_0x55f32f>0x0?_0x55f32f:0x1;switch(_0x2f2cf5['dialPredictiveOptimization']){case'dropRate':var _0x50e5cb=_0x2f2cf5[_0xee40('0x1c6')]/0x64;return _0x31fe49[_0xee40('0x1e1')](_0x5d2566,_0x4447d1,_0x2765f7,_0x55f32f,_0x50e5cb)[_0xee40('0xbf')](function(_0x333fc9){return _0x381476(_0x333fc9);});case _0xee40('0x1e2'):var _0x488556=_0x2f2cf5[_0xee40('0x1c6')]/0x64;return _0x31fe49[_0xee40('0x1e3')](_0x5d2566,_0x4447d1,_0x2765f7,_0x55f32f,_0x488556)[_0xee40('0xbf')](function(_0x10c576){return _0x381476(_0x10c576);});default:return _0xf2bf3c(msgResponse(_0xee40('0x1e4'),_0xee40('0x149'),_0xee40('0x1e5')));}}else{return _0xf2bf3c(msgResponse(_0xee40('0x1e4'),'Failure','check\x20failure'));}});};};Dialer[_0xee40('0x1b')][_0xee40('0x1e6')]=function(_0x399304){var _0x25de46=this;return function(_0x47a56c){return new BPromise(function(_0x48d751,_0x31025c){_[_0xee40('0x92')](_0x399304,_0x47a56c[0x0]);if(checkGetDataPredictive(_0x47a56c[0x0])){loggerPredictive[_0xee40('0x82')](JSON[_0xee40('0x4e')](_0x47a56c[0x0]));if(_0x399304[_0xee40('0x1d2')]===_0xee40('0x1d3')){return _0x25de46[_0xee40('0xd2')](_0x399304['id'])['then'](function(_0x202be9){var _0x2bf100=_0x399304[_0xee40('0x56')]-_0x202be9[0x0][_0xee40('0x1e7')];var _0x51ef73=_0x399304[_0xee40('0x1d0')]*0x3c;var _0x423919=_0x47a56c[0x0]['predictiveIntervalAvgTalktime']+_0x47a56c[0x0][_0xee40('0x8d')];var _0x527759=(_0x47a56c[0x0][_0xee40('0x85')]+_0x47a56c[0x0][_0xee40('0x6c')]+_0x47a56c[0x0][_0xee40('0x6b')])/_0x47a56c[0x0][_0xee40('0x72')];var _0x379681=_0x399304[_0xee40('0x1c6')]/0x64;_0x399304[_0xee40('0x71')]=_0x202be9[0x0][_0xee40('0x1e7')]||0x0;_0x399304[_0xee40('0x6f')]=_0x527759>0x0?_0x527759:0x1;return _0x25de46[_0xee40('0x1e1')](_0x2bf100,_0x51ef73,_0x423919,_0x527759,_0x379681);})[_0xee40('0xbf')](function(_0x19bc28){return _0x48d751(_0x19bc28);})[_0xee40('0xc0')](function(_0x35c1a4){return _0x31025c(msgResponse('[CatchErlangB]',_0xee40('0x149'),JSON['stringify'](_0x35c1a4)));});}if(_0x399304[_0xee40('0x1d2')]==='agentBusyFactor'){return _0x25de46[_0xee40('0xd2')](_0x399304['id'])[_0xee40('0xbf')](function(_0x1b2525){var _0x5eecfe=_0x399304['loggedIn']-_0x1b2525[0x0][_0xee40('0x1e7')];var _0x5c0391=_0x399304[_0xee40('0x1d0')]*0x3c;var _0x40f5ac=_0x47a56c[0x0][_0xee40('0x8a')]+_0x47a56c[0x0]['predictiveIntervalAvgHoldtime'];var _0x3aa50e=(_0x47a56c[0x0][_0xee40('0x85')]+_0x47a56c[0x0][_0xee40('0x6c')]+_0x47a56c[0x0][_0xee40('0x6b')])/_0x47a56c[0x0][_0xee40('0x72')];var _0x2e11ea=_0x399304[_0xee40('0x1c6')]/0x64;_0x399304[_0xee40('0x71')]=_0x1b2525[0x0][_0xee40('0x1e7')]||0x0;_0x399304[_0xee40('0x6f')]=_0x3aa50e>0x0?_0x3aa50e:0x1;return _0x25de46['busyFactor'](_0x5eecfe,_0x5c0391,_0x40f5ac,_0x3aa50e,_0x2e11ea);})[_0xee40('0xbf')](function(_0x2681fa){return _0x48d751(_0x2681fa);})[_0xee40('0xc0')](function(_0x5b2f92){return _0x31025c(msgResponse(_0xee40('0x1e8'),_0xee40('0x149'),JSON[_0xee40('0x4e')](_0x5b2f92)));});}}else{return _0x31025c(msgResponse(_0xee40('0x1e4'),_0xee40('0x149'),'check\x20failure'));}});};};Dialer[_0xee40('0x1b')]['startMethodPredictive']=function(_0x22a268){var _0x342068=this;return function(){var _0xe3a50=0x0;var _0xce6a10=Math[_0xee40('0x1cc')](_0x22a268[_0xee40('0x75')]*0x3e8);if(_0xce6a10>0x0){_0xce6a10=_0xce6a10<0x64?0x64:_0xce6a10;loggerPredictive[_0xee40('0x82')](_0x22a268[_0xee40('0x44')],_0xee40('0x1e9'),_0xce6a10,'milliseconds');_0x22a268[_0xee40('0x95')]=setInterval(function(){_0x342068[_0xee40('0x95')](_0x22a268);loggerPredictiveCalls[_0xee40('0x82')](_0xee40('0x1ea'),_0xe3a50+=0x1);},_0xce6a10);}else{loggerPredictive[_0xee40('0x82')](_0x22a268[_0xee40('0x44')],_0xee40('0x1eb'));}};};Dialer[_0xee40('0x1b')]['checkContactBlack']=function(_0x5f57ef,_0x13dea5){var _0x5f3167=this;return function(_0x2eb705){if(_['isEmpty'](_0x2eb705)){if(_['isNil'](_0x13dea5[_0xee40('0xde')])||!_0x13dea5[_0xee40('0x1ec')]){if(_0x5f57ef['dialMethod']===_0xee40('0x6')){_0x5f57ef['queueStatusComplete']=_[_0xee40('0x41')](_0x5f57ef[_0xee40('0x135')])?!![]:_0x5f57ef[_0xee40('0x135')];var _0x35d621=uuid['v4']();_0x5f3167[_0xee40('0xb1')][_0x35d621]=new Action(_0x5f57ef,_0x13dea5,_0x35d621);loggerBooked[_0xee40('0x82')](_0xee40('0x1ed'),_0x35d621,_0xee40('0x1ee'),JSON[_0xee40('0x4e')](_0x5f57ef[_0xee40('0x135')]),_0xee40('0x1ef'),_0x5f57ef[_0xee40('0x44')]);if(_0x5f57ef[_0xee40('0x135')]){_0x5f57ef[_0xee40('0x135')]=![];_0x5f3167[_0xee40('0x2b')][_0x5f3167[_0xee40('0xb1')][_0x35d621][_0xee40('0xb9')]]=[];ami['Action']({'actionid':_0x35d621,'action':_0xee40('0x1f0'),'queue':_0x5f57ef[_0xee40('0x44')]})[_0xee40('0xc0')](function(){_0x5f3167['updateOriginated'](_0x5f57ef);_0x5f3167[_0xee40('0xc9')]({'active':![],'ContactId':_0x5f3167[_0xee40('0xb1')][_0x35d621][_0xee40('0xdd')],'ListId':_0x5f3167[_0xee40('0xb1')][_0x35d621][_0xee40('0x108')],'VoiceQueueId':_0x5f3167[_0xee40('0xb1')][_0x35d621][_0xee40('0xdf')]||undefined,'CampaignId':_0x5f3167['actions'][_0x35d621]['CampaignId']||undefined})[_0xee40('0xc0')](loggerCatch(_0xee40('0x1f1')));delete _0x5f3167['actions'][_0x35d621];});}else{loggerBooked['info']('[booked][checkContactBlack][else]',JSON[_0xee40('0x4e')](_0x5f57ef[_0xee40('0x135')]),_0xee40('0x1ef'),_0x5f57ef[_0xee40('0x44')]);_0x5f3167[_0xee40('0xbb')](_0x5f57ef);_0x5f3167[_0xee40('0xc9')]({'active':![],'ContactId':_0x5f3167[_0xee40('0xb1')][_0x35d621]['ContactId'],'ListId':_0x5f3167['actions'][_0x35d621]['ListId'],'VoiceQueueId':_0x5f3167[_0xee40('0xb1')][_0x35d621][_0xee40('0xdf')]||undefined,'CampaignId':_0x5f3167[_0xee40('0xb1')][_0x35d621]['CampaignId']||undefined})[_0xee40('0xc0')](loggerCatch(_0xee40('0x1f1')));delete _0x5f3167['actions'][_0x35d621];}}else{return _0x5f3167['actionOriginate'](_0x5f57ef,_0x13dea5);}}else{if(getDiff(_0x13dea5[_0xee40('0x1f2')])<_0x5f57ef[_0xee40('0x1f3')]*0x3c){if(_0x13dea5['Agent']&&!_0x13dea5[_0xee40('0x1f4')]['voicePause']){_0x5f3167[_0xee40('0x96')]['run'](_0x13dea5['id'])[_0xee40('0x1d')](function(){_0x5f3167['updateOriginated'](_0x5f57ef);});}else{_0x5f3167['unlockContact']({'active':![]},_0x13dea5['id'],0x1)[_0xee40('0x1d')](function(){_0x5f3167[_0xee40('0xbb')](_0x5f57ef);});}}else{_0x5f57ef[_0xee40('0x1f5')]+=0x1;_0x5f3167[_0xee40('0xbb')](_0x5f57ef);if(_0x5f57ef[_0xee40('0x1f6')]){_0x5f3167[_0xee40('0xc9')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x13dea5[_0xee40('0xdd')],'ListId':_0x13dea5[_0xee40('0x108')],'VoiceQueueId':_0x13dea5[_0xee40('0xdf')]||undefined,'CampaignId':_0x13dea5[_0xee40('0xe0')]||undefined})[_0xee40('0xc0')](loggerCatch(_0xee40('0x1f7')));_0x5f3167[_0xee40('0xd6')](createObjHistory(_0x5f57ef,_0x13dea5,_0xee40('0x1f8'),0x17,'RecallInQueue'))[_0xee40('0xc0')](loggerCatch(_0xee40('0x1f9')));}else{_0x5f3167[_0xee40('0xdc')](createObjHistory(_0x5f57ef,_0x13dea5,_0xee40('0x1fa'),0x16,'RecallFailedTimeout'),'[Originate][HistoryRecallClose][historyCatch]',_0xee40('0x1fb'));}}}}else{_0x5f57ef['outboundBlacklistCallsDay']+=0x1;_0x5f3167[_0xee40('0xdc')](createObjHistory(_0x5f57ef,_0x13dea5,_0xee40('0x1fc'),0xd,_0xee40('0x1fd')),_0xee40('0x1fe'),_0xee40('0x1ff'));throw _0xee40('0x200');}};};Dialer[_0xee40('0x1b')]['handleIvr']=function(_0x82390e){var _0x1f3212=this;var _0x57fd15=_0x82390e[_0xee40('0x201')]-_0x82390e[_0xee40('0x73')]-_0x82390e['temp'];emitCampaignSummary(_0x82390e);if(_0x57fd15>0x0){if(_0x57fd15>this[_0xee40('0x23')]){_0x57fd15=this[_0xee40('0x23')];}_0x82390e[_0xee40('0xce')]+=_0x57fd15;this[_0xee40('0xd0')](_0x82390e['id'],_0x57fd15,_0x82390e['dialOrderByScheduledAt'],_0x82390e)[_0xee40('0xbf')](function(_0x13972b){_0x82390e[_0xee40('0xce')]-=_0x57fd15;_0x82390e['temp']=_0x82390e[_0xee40('0xce')]>0x0?_0x82390e[_0xee40('0xce')]:0x0;if(!checkContactEmpty(_0x13972b)){_0x82390e['message']=_0xee40('0xa3');logger['info'](_0xee40('0x202')+_0x82390e[_0xee40('0x44')]);}else{_0x82390e[_0xee40('0x73')]+=_0x13972b[_0xee40('0x9c')];_0x82390e[_0xee40('0x42')]=_0xee40('0x203');for(var _0x4e78fd=0x0;_0x4e78fd<_0x13972b[_0xee40('0x9c')];_0x4e78fd+=0x1){_0x82390e[_0xee40('0x204')]+=0x1;if(_[_0xee40('0xb5')](_0x13972b[_0x4e78fd])||_['isNil'](_0x13972b[_0x4e78fd][_0xee40('0x170')])||_['isNil'](_0x13972b[_0x4e78fd]['Contact'][_0xee40('0x171')])){_0x1f3212['emptyContact']('[actionOriginate]\x20',_0x82390e,_0x13972b[_0x4e78fd]);}else{_0x1f3212[_0xee40('0xc4')](_['pick'](_0x13972b[_0x4e78fd],[_0xee40('0xe0'),_0xee40('0x205')]))[_0xee40('0xbf')](_0x1f3212['checkContactBlack'](_0x82390e,_0x13972b[_0x4e78fd]))[_0xee40('0xc0')](_0x1f3212[_0xee40('0x206')](_0xee40('0x207'),_0x82390e));}}}})['catch'](loggerGetContactDialer(_0xee40('0x208'),_0x82390e,_0x57fd15));}};Dialer['prototype'][_0xee40('0x15e')]=function(_0x631b18,_0x1c69ae){var _0x1a6de7=this;var _0x191379=[];var _0x5bb04=_0x1c69ae>=0x1?_0x1c69ae:0x1;if(_0x631b18[_0xee40('0x15c')]==='booked'){_0x5bb04=0x1;}var _0x213f77=Math[_0xee40('0x1cc')](_0x631b18['available']*_0x5bb04)-_0x631b18['originated']-_0x631b18[_0xee40('0xce')];emitVoiceQueueSummary(_0x631b18);if(_0x631b18['dialLimitQueue']>0x0){var _0x29703a=_0x631b18['dialLimitQueue']-_0x631b18['originated']-_0x631b18[_0xee40('0x1e0')]-_0x631b18[_0xee40('0xce')]-_0x631b18[_0xee40('0x57')];if(_0x213f77>_0x29703a){_0x213f77=_0x29703a;}}if(_0x213f77>0x0){if(_0x631b18[_0xee40('0x15c')]===_0xee40('0x6')){_0x213f77=0x1;}if(_0x213f77>this['maxNumberOriginate']){_0x213f77=this[_0xee40('0x23')];}_0x631b18['temp']+=_0x213f77;for(var _0x167bd1 in this['agents']){if(typeof this[_0xee40('0x21')][_0x167bd1]!=='undefined'){if(this['agents'][_0x167bd1][_0xee40('0xac')]===_0xee40('0x209')&&this[_0xee40('0x21')][_0x167bd1][_0xee40('0xb7')]===_0xee40('0xe5')){_0x191379[_0xee40('0x132')](this[_0xee40('0x21')][_0x167bd1]['id']);}}}this[_0xee40('0xcd')](_0x631b18['id'],_0x191379,_0x213f77,_0x631b18['dialOrderByScheduledAt'],_0x631b18)[_0xee40('0xbf')](function(_0x5cdccb){_0x631b18[_0xee40('0xce')]-=_0x213f77;_0x631b18['temp']=_0x631b18['temp']>0x0?_0x631b18[_0xee40('0xce')]:0x0;if(!checkContactEmpty(_0x5cdccb)){_0x1a6de7[_0xee40('0xbd')](_0x631b18)[_0xee40('0xbf')](sendMessageReschedule(_0x631b18))[_0xee40('0xc0')](loggerCatch('[countReScheduled]\x20'));}else{_0x631b18['originated']+=_0x5cdccb['length'];_0x631b18['message']=_0x631b18['dialMethod']===_0xee40('0x6')?_0xee40('0x179'):_0xee40('0x203');for(var _0x36f2b0=0x0;_0x36f2b0<_0x5cdccb['length'];_0x36f2b0+=0x1){if(_['isNil'](_0x5cdccb[_0x36f2b0])||_['isNil'](_0x5cdccb[_0x36f2b0][_0xee40('0x170')])||_['isNil'](_0x5cdccb[_0x36f2b0][_0xee40('0x170')]['phone'])){_0x1a6de7[_0xee40('0xda')](_0xee40('0x20a'),_0x631b18,_0x5cdccb[_0x36f2b0]);}else{_0x1a6de7['checkIsBlackList'](_[_0xee40('0x138')](_0x5cdccb[_0x36f2b0],[_0xee40('0xdf'),_0xee40('0x205')]))[_0xee40('0xbf')](_0x1a6de7['checkContactBlack'](_0x631b18,_0x5cdccb[_0x36f2b0]))[_0xee40('0xc0')](_0x1a6de7[_0xee40('0x206')]('[actionOriginate]\x20',_0x631b18));}}}})[_0xee40('0xc0')](loggerGetContactDialer(_0xee40('0x20b'),_0x631b18,_0x213f77));}};Dialer[_0xee40('0x1b')][_0xee40('0x95')]=function(_0xb4039a){if(_0xb4039a[_0xee40('0x20c')]>0x0){var _0x1df66a=_0xb4039a['dialLimitQueue']-_0xb4039a['originated']-_0xb4039a[_0xee40('0x1e0')];if(_0x1df66a>0x0){this[_0xee40('0x20d')](_0xb4039a);}else{loggerPredictiveCalls[_0xee40('0x82')](_0xee40('0x20e'));}}else{this[_0xee40('0x20d')](_0xb4039a);}};Dialer['prototype'][_0xee40('0x20d')]=function(_0x5cf5dd){var _0x209d14=this;var _0x3d5027=[];_0x5cf5dd[_0xee40('0x73')]+=0x1;for(var _0x1a3929 in this[_0xee40('0x21')]){if(typeof this[_0xee40('0x21')][_0x1a3929]!==_0xee40('0xb3')){if(this['agents'][_0x1a3929][_0xee40('0xac')]===_0xee40('0x209')&&this[_0xee40('0x21')][_0x1a3929][_0xee40('0xb7')]===_0xee40('0xe5')){_0x3d5027['push'](this[_0xee40('0x21')][_0x1a3929]['id']);}}}this[_0xee40('0xcd')](_0x5cf5dd['id'],_0x3d5027,0x1,_0x5cf5dd[_0xee40('0x20f')],_0x5cf5dd)[_0xee40('0xbf')](function(_0x5073b7){if(!checkContactEmpty(_0x5073b7)){checkContactLowerLimitOriginate(_0x5cf5dd,0x1,0x0);_0x209d14['countReScheduled'](_0x5cf5dd)[_0xee40('0xbf')](sendMessageReschedule(_0x5cf5dd))[_0xee40('0xc0')](loggerCatch(_0xee40('0xc1')));}else{_0x5cf5dd['message']='RUNNING';if(_[_0xee40('0xb5')](_0x5073b7[0x0])||_[_0xee40('0xb5')](_0x5073b7[0x0]['Contact'])||_['isNil'](_0x5073b7[0x0]['Contact'][_0xee40('0x171')])){_0x209d14[_0xee40('0xda')](_0xee40('0x20a'),_0x5cf5dd,_0x5073b7[0x0]);}else{_0x209d14[_0xee40('0xc2')](_[_0xee40('0x138')](_0x5073b7[0x0],[_0xee40('0xdf'),'Contact.phone']))['then'](_0x209d14[_0xee40('0x210')](_0x5cf5dd,_0x5073b7[0x0]))['catch'](_0x209d14[_0xee40('0x206')](_0xee40('0x211'),_0x5cf5dd));}}})[_0xee40('0xc0')](loggerGetContactDialer('[getContactDialerPredictive]',_0x5cf5dd,0x1));emitVoiceQueueSummary(_0x5cf5dd);};Dialer[_0xee40('0x1b')][_0xee40('0x1e1')]=function(_0x32dbb3,_0x64c075,_0x4ce000,_0x25faab,_0x32fa3b,_0x3c39d6){loggerPredictive['info']('--------\x20Drop\x20Rate\x20--------');loggerPredictive[_0xee40('0x82')](_0xee40('0x212'),_0x32dbb3);loggerPredictive[_0xee40('0x82')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x64c075);loggerPredictive[_0xee40('0x82')]('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',_0x4ce000);loggerPredictive['info'](_0xee40('0x213'),_0x25faab);loggerPredictive[_0xee40('0x82')](_0xee40('0x214'),_0x32fa3b);loggerPredictive['info'](_0xee40('0x8b'));return new BPromise(function(_0xe5fa34,_0xbc119){if(_0x32dbb3<=0x0||isNaN(_0x32dbb3)){return _0xbc119(msgResponse('[abandonmentRate]',_0xee40('0x4d'),_0xee40('0x215')+_0x32dbb3));}if(_0x4ce000<=0x0||isNaN(_0x4ce000)){return _0xbc119(msgResponse(_0xee40('0x216'),'Error',_0xee40('0x217')+_0x4ce000));}if(_0x25faab<=0x0||isNaN(_0x25faab)){return _0xbc119(msgResponse('[abandonmentRate]','Error','p\x20=\x20'+_0x25faab));}if(_0x64c075<=0x0||isNaN(_0x64c075)){return _0xbc119(msgResponse(_0xee40('0x216'),_0xee40('0x4d'),_0xee40('0x218')+_0x64c075));}if(_0x32fa3b<=0x0||isNaN(_0x32fa3b)){return _0xbc119(msgResponse(_0xee40('0x216'),_0xee40('0x4d'),'Amax\x20=\x20'+_0x32fa3b));}_0x3c39d6=_0x3c39d6||0x0;var _0x54996c=0x1/_0x4ce000;var _0x62e122=0x0;var _0x4f2926=0x0;var _0x54c255=0x0;var _0x392dfb=0x0;for(var _0x1abba6=0x0;_0x54c255<_0x32fa3b;_0x1abba6+=0x1){_0x4f2926=_0x1abba6/_0x64c075;_0x62e122=(_0x25faab*_0x4f2926+_0x3c39d6)/_0x54996c;_0x54c255=erlangb(_0x62e122,_0x32dbb3);_0x392dfb=_0x62e122/_0x32dbb3*(0x1-erlangb(_0x62e122,_0x32dbb3));}return _0xe5fa34({'erlangCalls':_0x1abba6,'erlangCallToSecond':_0x64c075/_0x1abba6,'erlangAbandonmentRate':_0x54c255,'erlangBusyFactor':_0x392dfb});});};Dialer[_0xee40('0x1b')]['busyFactor']=function(_0xbfbb0,_0x1415fa,_0x473741,_0x3eed94,_0x512ce9,_0x5d2d5d){loggerPredictive['info']('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive[_0xee40('0x82')]('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',_0xbfbb0);loggerPredictive[_0xee40('0x82')](_0xee40('0x219'),_0x1415fa);loggerPredictive[_0xee40('0x82')](_0xee40('0x21a'),_0x473741);loggerPredictive[_0xee40('0x82')](_0xee40('0x213'),_0x3eed94);loggerPredictive[_0xee40('0x82')](_0xee40('0x21b'),_0x512ce9);loggerPredictive[_0xee40('0x82')](_0xee40('0x8b'));return new BPromise(function(_0x282588,_0x2d8c75){if(_0xbfbb0<=0x0||isNaN(_0xbfbb0)){return _0x2d8c75(msgResponse(_0xee40('0x21c'),'Error',_0xee40('0x215')+_0xbfbb0));}if(_0x473741<=0x0||isNaN(_0x473741)){return _0x2d8c75(msgResponse(_0xee40('0x21c'),_0xee40('0x4d'),_0xee40('0x217')+_0x473741));}if(_0x3eed94<=0x0||isNaN(_0x3eed94)){return _0x2d8c75(msgResponse(_0xee40('0x21c'),_0xee40('0x4d'),_0xee40('0x21d')+_0x3eed94));}if(_0x1415fa<=0x0||isNaN(_0x1415fa)){return _0x2d8c75(msgResponse(_0xee40('0x21c'),_0xee40('0x4d'),'interval\x20=\x20'+_0x1415fa));}if(_0x512ce9<=0x0||isNaN(_0x512ce9)){return _0x2d8c75(msgResponse('[busyFactor]',_0xee40('0x4d'),_0xee40('0x21e')+_0x512ce9));}_0x5d2d5d=_0x5d2d5d||0x0;var _0x36e522=0x1/_0x473741;var _0x34eb54=0x0;var _0x3981eb=0x0;var _0x2ac085=0x0;var _0x5cdceb=0x0;for(var _0x237938=0x0;_0x5cdceb<_0x512ce9;_0x237938+=0x1){_0x3981eb=_0x237938/_0x1415fa;_0x34eb54=(_0x3eed94*_0x3981eb+_0x5d2d5d)/_0x36e522;_0x2ac085=erlangb(_0x34eb54,_0xbfbb0);_0x5cdceb=_0x34eb54/_0xbfbb0*(0x1-erlangb(_0x34eb54,_0xbfbb0));}return _0x282588({'erlangCalls':_0x237938,'erlangCallToSecond':_0x1415fa/_0x237938,'erlangAbandonmentRate':_0x2ac085,'erlangBusyFactor':_0x5cdceb});});};module[_0xee40('0x21f')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index 534512b..7b6e268 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 _0xabec=['milliseconds','diff','seconds','scheduledat','type','campaigntype','outbound','queue','countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','endtime','holdtime','reason','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment'];(function(_0x18d4a2,_0x342829){var _0x5baae5=function(_0x18339f){while(--_0x18339f){_0x18d4a2['push'](_0x18d4a2['shift']());}};_0x5baae5(++_0x342829);}(_0xabec,0xcf));var _0xcabe=function(_0xaf0b0f,_0x209e37){_0xaf0b0f=_0xaf0b0f-0x0;var _0x9ed5e9=_0xabec[_0xaf0b0f];return _0x9ed5e9;};'use strict';var util=require(_0xcabe('0x0'));var _=require(_0xcabe('0x1'));var moment=require(_0xcabe('0x2'));function getSeconds(_0x10278c,_0x2accf6){var _0x230127=moment(_0x10278c)[_0xcabe('0x3')](0x0);var _0x2dc23e=moment(_0x2accf6)[_0xcabe('0x3')](0x0);return _0x230127[_0xcabe('0x4')](_0x2dc23e,_0xcabe('0x5'));}function QueueCallerAbandon(_0x28d71a,_0x212061){this[_0xcabe('0x6')]=_0x28d71a[_0xcabe('0x6')];this['type']=_0x28d71a[_0xcabe('0x7')];this[_0xcabe('0x8')]=_0x28d71a[_0xcabe('0x7')]===_0xcabe('0x9')?_0xcabe('0xa'):_0x28d71a[_0xcabe('0x7')];this['countbusyretry']=_0x28d71a['countbusyretry'];this['countcongestionretry']=_0x28d71a[_0xcabe('0xb')];this[_0xcabe('0xc')]=_0x28d71a[_0xcabe('0xc')];this[_0xcabe('0xd')]=_0x28d71a[_0xcabe('0xe')]+_0x28d71a[_0xcabe('0xb')]+_0x28d71a[_0xcabe('0xc')]+_0x28d71a[_0xcabe('0xf')]+_0x28d71a[_0xcabe('0x10')]+_0x28d71a[_0xcabe('0x11')]+_0x28d71a[_0xcabe('0x12')]+_0x28d71a[_0xcabe('0x13')];this[_0xcabe('0xf')]=_0x28d71a['countnosuchnumberretry'];this[_0xcabe('0x10')]=_0x28d71a[_0xcabe('0x10')];this[_0xcabe('0x11')]=_0x28d71a[_0xcabe('0x11')];this['countmachineretry']=_0x28d71a[_0xcabe('0x12')];this[_0xcabe('0x13')]=_0x28d71a[_0xcabe('0x13')];this[_0xcabe('0x14')]=_0x212061['uniqueid'];this[_0xcabe('0x15')]=_0x28d71a[_0xcabe('0x16')];this[_0xcabe('0x17')]=_0x28d71a[_0xcabe('0x18')];this[_0xcabe('0x19')]=_0x28d71a[_0xcabe('0x19')];this[_0xcabe('0x1a')]=_0x28d71a[_0xcabe('0x1a')];this[_0xcabe('0x1b')]=_0x28d71a[_0xcabe('0x1b')];this[_0xcabe('0x1c')]=this['droptime'];this['ringtime']=getSeconds(_0x28d71a[_0xcabe('0x1a')],_0x28d71a[_0xcabe('0x19')]);this[_0xcabe('0x1d')]=getSeconds(this['droptime'],_0x28d71a['responsetime']);this['talktime']=0x0;this[_0xcabe('0xa')]=_0x212061[_0xcabe('0xa')];this['membername']=_0x212061['connectedlinename'];this[_0xcabe('0x1e')]=_0x212061[_0xcabe('0x1e')];this[_0xcabe('0x1f')]=_0x28d71a[_0xcabe('0x1f')];this[_0xcabe('0x20')]=_0x28d71a[_0xcabe('0x20')];this['callbackat']=_0x28d71a['callbackat'];this[_0xcabe('0x21')]=_0x28d71a[_0xcabe('0x21')];this[_0xcabe('0x22')]=_0x28d71a[_0xcabe('0x22')];this['ListId']=_0x28d71a[_0xcabe('0x23')];this[_0xcabe('0x24')]=_0x28d71a['UserId'];this[_0xcabe('0x25')]=_0x28d71a[_0xcabe('0x25')];this['CampaignId']=_0x28d71a[_0xcabe('0x26')];this[_0xcabe('0x27')]=_0x28d71a['originatecalleridnum']||'';this[_0xcabe('0x28')]=_0x28d71a[_0xcabe('0x28')]||'';}module[_0xcabe('0x29')]=QueueCallerAbandon; \ No newline at end of file +var _0x2469=['countabandonedretry','countmachineretry','countnosuchnumberretry','countdropretry','countagentrejectretry','calleridname','name','calleridnum','number','responsetime','droptime','starttime','holdtime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','moment','milliseconds','diff','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2469,0x183));var _0x9246=function(_0x3cc1d8,_0x369235){_0x3cc1d8=_0x3cc1d8-0x0;var _0x52b924=_0x2469[_0x3cc1d8];return _0x52b924;};'use strict';var util=require(_0x9246('0x0'));var _=require('lodash');var moment=require(_0x9246('0x1'));function getSeconds(_0x4d4ab3,_0x58e30f){var _0x265b36=moment(_0x4d4ab3)[_0x9246('0x2')](0x0);var _0x10253a=moment(_0x58e30f)[_0x9246('0x2')](0x0);return _0x265b36[_0x9246('0x3')](_0x10253a,'seconds');}function QueueCallerAbandon(_0x1a0c8d,_0x53a862){this[_0x9246('0x4')]=_0x1a0c8d['scheduledat'];this[_0x9246('0x5')]=_0x1a0c8d[_0x9246('0x5')];this[_0x9246('0x6')]=_0x1a0c8d[_0x9246('0x5')]===_0x9246('0x7')?_0x9246('0x8'):_0x1a0c8d['type'];this[_0x9246('0x9')]=_0x1a0c8d[_0x9246('0x9')];this['countcongestionretry']=_0x1a0c8d[_0x9246('0xa')];this[_0x9246('0xb')]=_0x1a0c8d[_0x9246('0xb')];this[_0x9246('0xc')]=_0x1a0c8d[_0x9246('0x9')]+_0x1a0c8d[_0x9246('0xa')]+_0x1a0c8d['countnoanswerretry']+_0x1a0c8d['countnosuchnumberretry']+_0x1a0c8d['countdropretry']+_0x1a0c8d[_0x9246('0xd')]+_0x1a0c8d[_0x9246('0xe')]+_0x1a0c8d['countagentrejectretry'];this[_0x9246('0xf')]=_0x1a0c8d[_0x9246('0xf')];this['countdropretry']=_0x1a0c8d[_0x9246('0x10')];this[_0x9246('0xd')]=_0x1a0c8d[_0x9246('0xd')];this[_0x9246('0xe')]=_0x1a0c8d[_0x9246('0xe')];this[_0x9246('0x11')]=_0x1a0c8d[_0x9246('0x11')];this['uniqueid']=_0x53a862['uniqueid'];this[_0x9246('0x12')]=_0x1a0c8d[_0x9246('0x13')];this[_0x9246('0x14')]=_0x1a0c8d[_0x9246('0x15')];this['starttime']=_0x1a0c8d['starttime'];this[_0x9246('0x16')]=_0x1a0c8d[_0x9246('0x16')];this[_0x9246('0x17')]=_0x1a0c8d[_0x9246('0x17')];this['endtime']=this[_0x9246('0x17')];this['ringtime']=getSeconds(_0x1a0c8d['responsetime'],_0x1a0c8d[_0x9246('0x18')]);this[_0x9246('0x19')]=getSeconds(this[_0x9246('0x17')],_0x1a0c8d[_0x9246('0x16')]);this['talktime']=0x0;this['queue']=_0x53a862['queue'];this[_0x9246('0x1a')]=_0x53a862['connectedlinename'];this[_0x9246('0x1b')]=_0x53a862['reason'];this['callback']=_0x1a0c8d[_0x9246('0x1c')];this[_0x9246('0x1d')]=_0x1a0c8d[_0x9246('0x1d')];this[_0x9246('0x1e')]=_0x1a0c8d[_0x9246('0x1e')];this[_0x9246('0x1f')]=_0x1a0c8d['recallme'];this['ContactId']=_0x1a0c8d[_0x9246('0x20')];this[_0x9246('0x21')]=_0x1a0c8d[_0x9246('0x21')];this[_0x9246('0x22')]=_0x1a0c8d[_0x9246('0x22')];this[_0x9246('0x23')]=_0x1a0c8d[_0x9246('0x23')];this[_0x9246('0x24')]=_0x1a0c8d[_0x9246('0x24')];this['originatecalleridnum']=_0x1a0c8d[_0x9246('0x25')]||'';this[_0x9246('0x26')]=_0x1a0c8d[_0x9246('0x26')]||'';}module[_0x9246('0x27')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 4d430ef..d6f1f2d 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(_0x295553,_0x4a3628){var _0x5b6347=function(_0x18a711){while(--_0x18a711){_0x295553['push'](_0x295553['shift']());}};_0x5b6347(++_0x4a3628);}(_0xa9e0,0x123));var _0x0a9e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa9e0[_0x31e29a];return _0x32d892;};'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(_0xb51e29,_0x15fe47){var _0x150fb9=function(_0x52cf87){while(--_0x52cf87){_0xb51e29['push'](_0xb51e29['shift']());}};_0x150fb9(++_0x15fe47);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'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 beb3f94..64b34fa 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 _0x5eb8=['remotestationid','pagestransferred','resolution','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','.pdf','application/pdf','then','parse','catch','\x20notify\x20','stringify','error','\x20receiveFax\x20','syncOriginateResponse','merge','pick','response','AttachmentId','update','SENDING\x20FAILED\x20','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','[Fax][Message][Updated]','logger','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','faxstatus','updateStatus','faxstatusstring','SENDING\x20FAILED','send','FaxAccountId','Fax\x20received','[Fax][execOriginate][failure]','checkTrunk','Trunk','isValid','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','isNil','active','SIP/%s','reachable','unmonitored','isTrunkReachable','\x20Trunk\x20is\x20not\x20active','[Fax][checkTrunk][Empty\x20Fax]','[Fax][checkTrunk][Empty\x20path]','Is\x20Valid','exports','bluebird','uuid','moment','path','tiff2pdf','./util/gs','../../../config/logger','fax','../ami','./rpcDb','./channel','./util/util','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','syncVarSet','syncNewState','newexten','syncNewExten','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','prototype','hasOwnProperty','exten','localstationid','uniqueid','name','channel','info','\x20syncNewchannel\x20','variable','channelstate','channelstatedesc','value','operation','status','filename'];(function(_0x269058,_0x57f7d7){var _0x3beb82=function(_0x229db5){while(--_0x229db5){_0x269058['push'](_0x269058['shift']());}};_0x3beb82(++_0x57f7d7);}(_0x5eb8,0xb0));var _0x85eb=function(_0x2ca2d0,_0x3ea8e4){_0x2ca2d0=_0x2ca2d0-0x0;var _0x521c23=_0x5eb8[_0x2ca2d0];return _0x521c23;};'use strict';var util=require('util');var _=require('lodash');var BPromise=require(_0x85eb('0x0'));var uuid=require(_0x85eb('0x1'));var moment=require(_0x85eb('0x2'));var path=require(_0x85eb('0x3'));var tiff2pdf=require(_0x85eb('0x4'));var gs=require(_0x85eb('0x5'));var logger=require(_0x85eb('0x6'))(_0x85eb('0x7'));var ami=require(_0x85eb('0x8'));var rpcDb=require(_0x85eb('0x9'));var Channel=require(_0x85eb('0xa'));var ut=require(_0x85eb('0xb'));var Action=require('./action');var faxAccount=require(_0x85eb('0xc'));var attachment=require(_0x85eb('0xd'));var faxMessage=require(_0x85eb('0xe'));function Fax(_0x5cd4ec){this[_0x85eb('0xf')]={};this['faxAccounts']=_0x5cd4ec[_0x85eb('0x10')];this[_0x85eb('0x11')]=_0x5cd4ec[_0x85eb('0x11')];this[_0x85eb('0x12')]={};ami['on'](_0x85eb('0x13'),this[_0x85eb('0x14')][_0x85eb('0x15')](this));ami['on']('varset',this[_0x85eb('0x16')][_0x85eb('0x15')](this));ami['on']('newstate',this[_0x85eb('0x17')][_0x85eb('0x15')](this));ami['on'](_0x85eb('0x18'),this[_0x85eb('0x19')]['bind'](this));ami['on']('faxstatus',this[_0x85eb('0x1a')]['bind'](this));ami['on'](_0x85eb('0x1b'),this[_0x85eb('0x1c')][_0x85eb('0x15')](this));ami['on'](_0x85eb('0x1d'),this[_0x85eb('0x1e')]['bind'](this));ami['on'](_0x85eb('0x1f'),this['syncOriginateResponse'][_0x85eb('0x15')](this));}Fax[_0x85eb('0x20')][_0x85eb('0x14')]=function(_0x5deab1){if(_0x5deab1['context']==='from-voip-provider'){for(var _0x50d2a8 in this[_0x85eb('0x10')]){if(this[_0x85eb('0x10')][_0x85eb('0x21')](_0x50d2a8)){if(_0x5deab1[_0x85eb('0x22')]===this[_0x85eb('0x10')][_0x50d2a8][_0x85eb('0x23')]){this['channels'][_0x5deab1[_0x85eb('0x24')]]={};this[_0x85eb('0xf')][_0x5deab1[_0x85eb('0x24')]]['channel']=_0x5deab1['channel'];this['channels'][_0x5deab1['uniqueid']]['id']=this[_0x85eb('0x10')][_0x50d2a8]['id'];this[_0x85eb('0xf')][_0x5deab1[_0x85eb('0x24')]][_0x85eb('0x25')]=this[_0x85eb('0x10')][_0x50d2a8][_0x85eb('0x25')];logger['info'](_0x5deab1['uniqueid'],'\x20syncNewchannel\x20');}}}}if(this[_0x85eb('0x12')][_0x5deab1[_0x85eb('0x24')]]){this[_0x85eb('0xf')][_0x5deab1[_0x85eb('0x24')]]={};this[_0x85eb('0xf')][_0x5deab1[_0x85eb('0x24')]]['channel']=_0x5deab1[_0x85eb('0x26')];logger[_0x85eb('0x27')](_0x5deab1[_0x85eb('0x24')],_0x85eb('0x28'));}};Fax[_0x85eb('0x20')]['syncVarSet']=function(_0x2e5aa3){if(this[_0x85eb('0xf')][_0x2e5aa3[_0x85eb('0x24')]]){for(var _0x3e7eb9 in _0x2e5aa3[_0x85eb('0x29')]){if(_0x2e5aa3[_0x85eb('0x29')]['hasOwnProperty'](_0x3e7eb9)){this['channels'][_0x2e5aa3[_0x85eb('0x24')]][_0x3e7eb9]=_0x2e5aa3['value'];}}}};Fax[_0x85eb('0x20')]['syncNewState']=function(_0x4229e9){if(this[_0x85eb('0xf')][_0x4229e9[_0x85eb('0x24')]]){this[_0x85eb('0xf')][_0x4229e9[_0x85eb('0x24')]][_0x85eb('0x2a')]=_0x4229e9[_0x85eb('0x2a')];this['channels'][_0x4229e9[_0x85eb('0x24')]][_0x85eb('0x2b')]=_0x4229e9['channelstatedesc'];}};Fax[_0x85eb('0x20')]['syncNewExten']=function(_0x5439aa){if(this[_0x85eb('0xf')][_0x5439aa[_0x85eb('0x24')]]){for(var _0x3e6f34 in _0x5439aa[_0x85eb('0x29')]){if(_0x5439aa[_0x85eb('0x29')][_0x85eb('0x21')](_0x3e6f34)){this[_0x85eb('0xf')][_0x5439aa[_0x85eb('0x24')]][_0x3e6f34]=_0x5439aa[_0x85eb('0x2c')];}}}};Fax[_0x85eb('0x20')]['syncFaxStatus']=function(_0x14fe58){if(this[_0x85eb('0xf')][_0x14fe58['uniqueid']]){this['channels'][_0x14fe58[_0x85eb('0x24')]][_0x85eb('0x2d')]=_0x14fe58[_0x85eb('0x2d')];this[_0x85eb('0xf')][_0x14fe58[_0x85eb('0x24')]][_0x85eb('0x2e')]=_0x14fe58[_0x85eb('0x2e')];this[_0x85eb('0xf')][_0x14fe58[_0x85eb('0x24')]][_0x85eb('0x23')]=_0x14fe58[_0x85eb('0x23')];this[_0x85eb('0xf')][_0x14fe58[_0x85eb('0x24')]][_0x85eb('0x2f')]=_0x14fe58['filename'];logger[_0x85eb('0x27')](_0x14fe58[_0x85eb('0x24')],'\x20syncFaxStatus\x20');}};Fax['prototype'][_0x85eb('0x1c')]=function(_0xe22d16){var _0x5389d8=this;if(this[_0x85eb('0xf')][_0xe22d16['uniqueid']]){var _0x4440ec=this['channels'][_0xe22d16[_0x85eb('0x24')]]['id'];this['channels'][_0xe22d16[_0x85eb('0x24')]]['remotestationid']=_0xe22d16[_0x85eb('0x30')];this[_0x85eb('0xf')][_0xe22d16['uniqueid']][_0x85eb('0x31')]=_0xe22d16['pagestransferred'];this[_0x85eb('0xf')][_0xe22d16[_0x85eb('0x24')]]['localstationid']=_0xe22d16[_0x85eb('0x23')];this['channels'][_0xe22d16['uniqueid']][_0x85eb('0x32')]=_0xe22d16['resolution'];this[_0x85eb('0xf')][_0xe22d16[_0x85eb('0x24')]]['transferrate']=_0xe22d16['transferrate'];this[_0x85eb('0xf')][_0xe22d16[_0x85eb('0x24')]]['filename']=_0xe22d16['filename'];this[_0x85eb('0xf')][_0xe22d16[_0x85eb('0x24')]][_0x85eb('0x33')]=_0xe22d16[_0x85eb('0x33')];if(this[_0x85eb('0xf')][_0xe22d16['uniqueid']][_0x85eb('0x31')]>0x0){tiff2pdf(_0xe22d16[_0x85eb('0x2f')],_0x85eb('0x34'),function(_0x3b096b){logger[_0x85eb('0x27')](_0xe22d16[_0x85eb('0x24')],_0x85eb('0x35'),_0x3b096b[_0x85eb('0x36')]);attachment[_0x85eb('0x37')]({'name':path['parse'](_0xe22d16[_0x85eb('0x2f')])[_0x85eb('0x25')],'basename':path['parse'](_0xe22d16[_0x85eb('0x2f')])[_0x85eb('0x25')]+_0x85eb('0x38'),'type':_0x85eb('0x39')})[_0x85eb('0x3a')](function(_0x2372ad){faxAccount['notify'](_0x4440ec,{'from':_0xe22d16[_0x85eb('0x33')],'mapKey':_0x85eb('0x7'),'body':path[_0x85eb('0x3b')](_0xe22d16[_0x85eb('0x2f')])[_0x85eb('0x25')]+_0x85eb('0x38'),'AttachmentId':_0x2372ad['id']})[_0x85eb('0x3c')](function(_0x202590){logger['error'](_0xe22d16[_0x85eb('0x24')],_0x85eb('0x3d'),JSON[_0x85eb('0x3e')](_0x202590));});})[_0x85eb('0x3c')](function(_0x154399){logger[_0x85eb('0x3f')](_0xe22d16[_0x85eb('0x24')],_0x85eb('0x40'),JSON[_0x85eb('0x3e')](_0x154399));});});}logger[_0x85eb('0x27')](_0xe22d16[_0x85eb('0x24')],_0x85eb('0x40'));}};Fax['prototype'][_0x85eb('0x41')]=function(_0x2c951b){if(this[_0x85eb('0x12')][_0x2c951b['uniqueid']]){_[_0x85eb('0x42')](this[_0x85eb('0xf')][_0x2c951b[_0x85eb('0x24')]],_[_0x85eb('0x43')](_0x2c951b,[_0x85eb('0x44'),'reason']));}};function updateStatus(_0x2ef4d1){if(_0x2ef4d1[_0x85eb('0x45')]){faxMessage[_0x85eb('0x46')](_0x2ef4d1['AttachmentId'],{'failMessage':_0x85eb('0x47')})[_0x85eb('0x3a')](function(_0x1efc6f){ut['logger']('[Fax][Message][Error][Updated]',_0x1efc6f);})[_0x85eb('0x3c')](function(_0x52996f){ut['logger'](_0x85eb('0x48'),_0x52996f);});}else{ut['logger'](_0x85eb('0x49'));}}Fax[_0x85eb('0x20')]['updateStatus']=function(_0x4abe5e,_0x27ce2a,_0x249511){var _0x178d76=this;var _0x40d64d={};if(_0x27ce2a){_0x40d64d={'read':_0x27ce2a};}else{_0x40d64d={'failMessage':_0x249511};}if(this[_0x85eb('0x12')][_0x4abe5e]['AttachmentId']){faxMessage[_0x85eb('0x46')](this[_0x85eb('0x12')][_0x4abe5e][_0x85eb('0x45')],_0x40d64d)[_0x85eb('0x3a')](function(_0x1614dd){ut['logger'](_0x85eb('0x4a'),_0x1614dd);})['catch'](function(_0xd2e792){ut[_0x85eb('0x4b')]('[Fax][Message][NoUpdate1]',_0xd2e792);})[_0x85eb('0x4c')](function(){delete _0x178d76[_0x85eb('0xf')][_0x4abe5e];delete _0x178d76[_0x85eb('0x12')][_0x4abe5e];});}else{ut[_0x85eb('0x4b')](_0x85eb('0x4d'));delete this[_0x85eb('0xf')][_0x4abe5e];delete this['actions'][_0x4abe5e];}};Fax[_0x85eb('0x20')]['syncHangup']=function(_0x311857){var _0x20f4b3=this;if(this['channels'][_0x311857[_0x85eb('0x24')]]){if(this[_0x85eb('0x12')][_0x311857['uniqueid']]){this[_0x85eb('0xf')][_0x311857['uniqueid']]['id']=this[_0x85eb('0x12')][_0x311857[_0x85eb('0x24')]]['id'];this[_0x85eb('0xf')][_0x311857[_0x85eb('0x24')]][_0x85eb('0x25')]=this[_0x85eb('0x12')][_0x311857['uniqueid']][_0x85eb('0x25')];}logger[_0x85eb('0x27')](_0x311857[_0x85eb('0x24')],this[_0x85eb('0x12')][_0x311857[_0x85eb('0x24')]]?_0x85eb('0x4e'):_0x85eb('0x4f'),JSON[_0x85eb('0x3e')](this[_0x85eb('0xf')][_0x311857[_0x85eb('0x24')]]));if(this[_0x85eb('0x12')][_0x311857['uniqueid']]){if(this[_0x85eb('0xf')][_0x311857[_0x85eb('0x24')]][_0x85eb('0x50')]>0x0&&this[_0x85eb('0xf')][_0x311857[_0x85eb('0x24')]][_0x85eb('0x51')]==='SUCCESS'){this[_0x85eb('0x52')](_0x311857['uniqueid'],!![]);}else{this[_0x85eb('0x52')](_0x311857[_0x85eb('0x24')],![],this[_0x85eb('0xf')][_0x311857[_0x85eb('0x24')]][_0x85eb('0x53')]?'SENDING\x20FAILED:\x20'+this[_0x85eb('0xf')][_0x311857[_0x85eb('0x24')]][_0x85eb('0x53')]:_0x85eb('0x54'));}}}};Fax[_0x85eb('0x20')][_0x85eb('0x55')]=function(_0x23fcf9){var _0x5de716=this;return new BPromise(function(_0x5b611f,_0x3b896a){_0x5de716['execOriginate'](_0x23fcf9,_0x5de716[_0x85eb('0x10')][_0x23fcf9[_0x85eb('0x56')]])[_0x85eb('0x3a')](function(_0x41960f){ut[_0x85eb('0x4b')]('[Fax][execOriginate][success]',_0x41960f);_0x5b611f(ut[_0x85eb('0x36')](_0x85eb('0x57')));})[_0x85eb('0x3c')](function(_0x235fde){ut[_0x85eb('0x4b')](_0x85eb('0x58'),_0x235fde);updateStatus(_0x23fcf9);_0x3b896a(ut['message']('Fax\x20failed'));});});};Fax[_0x85eb('0x20')]['checkAfterSend']=function(_0x1378f4){var _0xc4b933=this;return new BPromise(function(_0xe08b39,_0x23f24a){var _0x232e3f=_0xc4b933[_0x85eb('0x59')](_0xc4b933['faxAccounts'][_0x1378f4[_0x85eb('0x56')]][_0x85eb('0x5a')],_0x1378f4);if(_0x232e3f[_0x85eb('0x5b')]){_0xe08b39(ut[_0x85eb('0x36')]('Trunk\x20Reachable'));}else{_0x23f24a(ut[_0x85eb('0x36')](_0x232e3f[_0x85eb('0x36')]));}});};function originate(_0xcc7da3,_0x14bf0e,_0x5037c7){return new BPromise(function(_0x459317,_0x2e6734){if(_0x5037c7){var _0x13a040=util[_0x85eb('0x5c')](_0x85eb('0x5d'),path[_0x85eb('0x3b')](_0xcc7da3[_0x85eb('0x3')])[_0x85eb('0x25')],_0xcc7da3[_0x85eb('0x3')]);gs[_0x85eb('0x5e')](_0x13a040)[_0x85eb('0x3a')](function(){_0xcc7da3[_0x85eb('0x3')]=util[_0x85eb('0x5c')](_0x85eb('0x5f'),path[_0x85eb('0x3b')](_0xcc7da3[_0x85eb('0x3')])[_0x85eb('0x60')],path[_0x85eb('0x3b')](_0xcc7da3[_0x85eb('0x3')])['name']);_0x14bf0e[_0x85eb('0x61')]=_0xcc7da3['path'];ut[_0x85eb('0x4b')](_0x85eb('0x62'),'');ami[_0x85eb('0x63')](ut[_0x85eb('0x64')](_0xcc7da3,_0x14bf0e))[_0x85eb('0x3a')](function(_0x3de724){_0x459317(_0x3de724);})[_0x85eb('0x3c')](function(_0x3076df){_0x2e6734(_0x3076df);});})[_0x85eb('0x3c')](function(_0x569ebe){_0x2e6734(_0x569ebe);});}else{ami[_0x85eb('0x63')](ut[_0x85eb('0x64')](_0xcc7da3,_0x14bf0e))[_0x85eb('0x3a')](function(_0x31f977){_0x459317(_0x31f977);})[_0x85eb('0x3c')](function(_0x496216){_0x2e6734(_0x496216);});}});}Fax[_0x85eb('0x20')]['execOriginate']=function(_0x24e609,_0x330c2b){var _0x29600d=this;return new BPromise(function(_0x55bab0,_0x2daa64){var _0x2e358d=uuid['v4']();var _0x1169c8=ut['addVariables'](_0x24e609,_0x330c2b);_0x29600d['actions'][_0x2e358d]=new Action(_0x2e358d,_0x330c2b,_0x24e609);var _0x45a1ef=_0x29600d[_0x85eb('0x12')][_0x2e358d];if(path[_0x85eb('0x3b')](_0x24e609[_0x85eb('0x3')])['ext']===_0x85eb('0x38')){originate(_0x45a1ef,_0x1169c8,!![])['then'](function(_0x11a3bd){_0x55bab0(_0x11a3bd);})[_0x85eb('0x3c')](function(_0x528d2e){_0x2daa64(_0x528d2e);});}else{originate(_0x45a1ef,_0x1169c8,![])[_0x85eb('0x3a')](function(_0x404663){_0x55bab0(_0x404663);})[_0x85eb('0x3c')](function(_0x53cf37){_0x2daa64(_0x53cf37);});}});};Fax[_0x85eb('0x20')]['isTrunkReachable']=function(_0x18049b){return!_[_0x85eb('0x65')](_0x18049b)&&!_[_0x85eb('0x65')](_0x18049b[_0x85eb('0x25')])&&!_[_0x85eb('0x65')](_0x18049b[_0x85eb('0x66')])&&_0x18049b[_0x85eb('0x66')]&&!_[_0x85eb('0x65')](this[_0x85eb('0x11')][util['format'](_0x85eb('0x67'),_0x18049b[_0x85eb('0x25')])])&&!_['isNil'](this['trunks'][util[_0x85eb('0x5c')]('SIP/%s',_0x18049b[_0x85eb('0x25')])]['status'])&&(this[_0x85eb('0x11')][util['format'](_0x85eb('0x67'),_0x18049b[_0x85eb('0x25')])]['status']===_0x85eb('0x68')||this[_0x85eb('0x11')][util['format'](_0x85eb('0x67'),_0x18049b[_0x85eb('0x25')])][_0x85eb('0x2e')]===_0x85eb('0x69'));};Fax['prototype'][_0x85eb('0x59')]=function(_0x53ccc5,_0x3acae9){if(!this[_0x85eb('0x6a')](_0x53ccc5)){ut[_0x85eb('0x4b')]('[Fax][checkTrunk][Trunk\x20not\x20work]',_[_0x85eb('0x65')](_0x53ccc5)?'':_0x53ccc5[_0x85eb('0x25')]+_0x85eb('0x6b'));return{'isValid':![],'message':'Trunk\x20not\x20working'};}if(_[_0x85eb('0x65')](_0x3acae9['fax'])){ut[_0x85eb('0x4b')](_0x85eb('0x6c'),JSON[_0x85eb('0x3e')](_0x3acae9));return{'isValid':![],'message':'Empty\x20Fax'};}if(_['isNil'](_0x3acae9['path'])){ut[_0x85eb('0x4b')](_0x85eb('0x6d'),JSON[_0x85eb('0x3e')](_0x3acae9));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':_0x85eb('0x6e')};};module[_0x85eb('0x6f')]=Fax; \ No newline at end of file +var _0xda3f=['variablesAction','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20work]','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Is\x20Valid','exports','lodash','bluebird','tiff2pdf','../../../config/logger','fax','./rpcDb','./channel','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','varset','syncVarSet','bind','newstate','syncNewState','newexten','faxstatus','syncReceiveFax','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','name','info','\x20syncNewchannel\x20','channel','variable','value','channelstatedesc','syncNewExten','syncFaxStatus','operation','status','filename','remotestationid','pagestransferred','resolution','transferrate','\x20result\x20conversion\x20file\x20','create','parse','.pdf','application/pdf','then','notify','calleridnum','catch','\x20notify\x20','stringify','error','\x20receiveFax\x20','merge','response','reason','update','AttachmentId','SENDING\x20FAILED\x20','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','logger','[Fax][Message][Error][NoUpdate2]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','syncHangup','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','SUCCESS','updateStatus','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','execOriginate','FaxAccountId','[Fax][execOriginate][success]','message','Fax\x20received','checkAfterSend','checkTrunk','isValid','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','path','%s/%s.tif','XMF-PATH','Action'];(function(_0x4acc38,_0xfe31d0){var _0x59f3ac=function(_0x309a0c){while(--_0x309a0c){_0x4acc38['push'](_0x4acc38['shift']());}};_0x59f3ac(++_0xfe31d0);}(_0xda3f,0xec));var _0xfda3=function(_0x481ef7,_0x4f93ff){_0x481ef7=_0x481ef7-0x0;var _0x35a6d4=_0xda3f[_0x481ef7];return _0x35a6d4;};'use strict';var util=require('util');var _=require(_0xfda3('0x0'));var BPromise=require(_0xfda3('0x1'));var uuid=require('uuid');var moment=require('moment');var path=require('path');var tiff2pdf=require(_0xfda3('0x2'));var gs=require('./util/gs');var logger=require(_0xfda3('0x3'))(_0xfda3('0x4'));var ami=require('../ami');var rpcDb=require(_0xfda3('0x5'));var Channel=require(_0xfda3('0x6'));var ut=require('./util/util');var Action=require('./action');var faxAccount=require(_0xfda3('0x7'));var attachment=require(_0xfda3('0x8'));var faxMessage=require(_0xfda3('0x9'));function Fax(_0x4018c0){this[_0xfda3('0xa')]={};this[_0xfda3('0xb')]=_0x4018c0[_0xfda3('0xb')];this[_0xfda3('0xc')]=_0x4018c0[_0xfda3('0xc')];this[_0xfda3('0xd')]={};ami['on'](_0xfda3('0xe'),this[_0xfda3('0xf')]['bind'](this));ami['on'](_0xfda3('0x10'),this[_0xfda3('0x11')][_0xfda3('0x12')](this));ami['on'](_0xfda3('0x13'),this[_0xfda3('0x14')]['bind'](this));ami['on'](_0xfda3('0x15'),this['syncNewExten'][_0xfda3('0x12')](this));ami['on'](_0xfda3('0x16'),this['syncFaxStatus']['bind'](this));ami['on']('receivefax',this[_0xfda3('0x17')][_0xfda3('0x12')](this));ami['on']('hangup',this['syncHangup']['bind'](this));ami['on'](_0xfda3('0x18'),this[_0xfda3('0x19')][_0xfda3('0x12')](this));}Fax[_0xfda3('0x1a')][_0xfda3('0xf')]=function(_0x40d702){if(_0x40d702[_0xfda3('0x1b')]===_0xfda3('0x1c')){for(var _0x4680bf in this[_0xfda3('0xb')]){if(this['faxAccounts'][_0xfda3('0x1d')](_0x4680bf)){if(_0x40d702[_0xfda3('0x1e')]===this[_0xfda3('0xb')][_0x4680bf][_0xfda3('0x1f')]){this['channels'][_0x40d702[_0xfda3('0x20')]]={};this[_0xfda3('0xa')][_0x40d702[_0xfda3('0x20')]]['channel']=_0x40d702['channel'];this[_0xfda3('0xa')][_0x40d702[_0xfda3('0x20')]]['id']=this[_0xfda3('0xb')][_0x4680bf]['id'];this['channels'][_0x40d702[_0xfda3('0x20')]][_0xfda3('0x21')]=this[_0xfda3('0xb')][_0x4680bf][_0xfda3('0x21')];logger[_0xfda3('0x22')](_0x40d702[_0xfda3('0x20')],_0xfda3('0x23'));}}}}if(this[_0xfda3('0xd')][_0x40d702[_0xfda3('0x20')]]){this['channels'][_0x40d702[_0xfda3('0x20')]]={};this[_0xfda3('0xa')][_0x40d702[_0xfda3('0x20')]]['channel']=_0x40d702[_0xfda3('0x24')];logger[_0xfda3('0x22')](_0x40d702[_0xfda3('0x20')],_0xfda3('0x23'));}};Fax[_0xfda3('0x1a')][_0xfda3('0x11')]=function(_0x514d2a){if(this[_0xfda3('0xa')][_0x514d2a[_0xfda3('0x20')]]){for(var _0x2bef2b in _0x514d2a[_0xfda3('0x25')]){if(_0x514d2a[_0xfda3('0x25')]['hasOwnProperty'](_0x2bef2b)){this[_0xfda3('0xa')][_0x514d2a[_0xfda3('0x20')]][_0x2bef2b]=_0x514d2a[_0xfda3('0x26')];}}}};Fax[_0xfda3('0x1a')][_0xfda3('0x14')]=function(_0x3cfeb2){if(this[_0xfda3('0xa')][_0x3cfeb2['uniqueid']]){this['channels'][_0x3cfeb2[_0xfda3('0x20')]]['channelstate']=_0x3cfeb2['channelstate'];this[_0xfda3('0xa')][_0x3cfeb2[_0xfda3('0x20')]][_0xfda3('0x27')]=_0x3cfeb2[_0xfda3('0x27')];}};Fax[_0xfda3('0x1a')][_0xfda3('0x28')]=function(_0x404531){if(this[_0xfda3('0xa')][_0x404531[_0xfda3('0x20')]]){for(var _0x5825bd in _0x404531[_0xfda3('0x25')]){if(_0x404531[_0xfda3('0x25')][_0xfda3('0x1d')](_0x5825bd)){this[_0xfda3('0xa')][_0x404531[_0xfda3('0x20')]][_0x5825bd]=_0x404531[_0xfda3('0x26')];}}}};Fax[_0xfda3('0x1a')][_0xfda3('0x29')]=function(_0x2bb705){if(this['channels'][_0x2bb705['uniqueid']]){this[_0xfda3('0xa')][_0x2bb705[_0xfda3('0x20')]]['operation']=_0x2bb705[_0xfda3('0x2a')];this[_0xfda3('0xa')][_0x2bb705[_0xfda3('0x20')]]['status']=_0x2bb705[_0xfda3('0x2b')];this[_0xfda3('0xa')][_0x2bb705[_0xfda3('0x20')]][_0xfda3('0x1f')]=_0x2bb705[_0xfda3('0x1f')];this['channels'][_0x2bb705[_0xfda3('0x20')]][_0xfda3('0x2c')]=_0x2bb705[_0xfda3('0x2c')];logger['info'](_0x2bb705[_0xfda3('0x20')],'\x20syncFaxStatus\x20');}};Fax[_0xfda3('0x1a')][_0xfda3('0x17')]=function(_0x43a58a){var _0x36a506=this;if(this[_0xfda3('0xa')][_0x43a58a[_0xfda3('0x20')]]){var _0x151f32=this[_0xfda3('0xa')][_0x43a58a['uniqueid']]['id'];this[_0xfda3('0xa')][_0x43a58a[_0xfda3('0x20')]][_0xfda3('0x2d')]=_0x43a58a[_0xfda3('0x2d')];this['channels'][_0x43a58a[_0xfda3('0x20')]][_0xfda3('0x2e')]=_0x43a58a[_0xfda3('0x2e')];this['channels'][_0x43a58a['uniqueid']][_0xfda3('0x1f')]=_0x43a58a[_0xfda3('0x1f')];this[_0xfda3('0xa')][_0x43a58a[_0xfda3('0x20')]][_0xfda3('0x2f')]=_0x43a58a[_0xfda3('0x2f')];this[_0xfda3('0xa')][_0x43a58a[_0xfda3('0x20')]][_0xfda3('0x30')]=_0x43a58a[_0xfda3('0x30')];this['channels'][_0x43a58a[_0xfda3('0x20')]][_0xfda3('0x2c')]=_0x43a58a['filename'];this[_0xfda3('0xa')][_0x43a58a['uniqueid']]['calleridnum']=_0x43a58a['calleridnum'];if(this[_0xfda3('0xa')][_0x43a58a[_0xfda3('0x20')]][_0xfda3('0x2e')]>0x0){tiff2pdf(_0x43a58a[_0xfda3('0x2c')],'/var/opt/motion2/server/files/attachments/',function(_0x8f0905){logger[_0xfda3('0x22')](_0x43a58a[_0xfda3('0x20')],_0xfda3('0x31'),_0x8f0905['message']);attachment[_0xfda3('0x32')]({'name':path[_0xfda3('0x33')](_0x43a58a[_0xfda3('0x2c')])['name'],'basename':path['parse'](_0x43a58a[_0xfda3('0x2c')])[_0xfda3('0x21')]+_0xfda3('0x34'),'type':_0xfda3('0x35')})[_0xfda3('0x36')](function(_0x73e8e4){faxAccount[_0xfda3('0x37')](_0x151f32,{'from':_0x43a58a[_0xfda3('0x38')],'mapKey':_0xfda3('0x4'),'body':path[_0xfda3('0x33')](_0x43a58a[_0xfda3('0x2c')])[_0xfda3('0x21')]+_0xfda3('0x34'),'AttachmentId':_0x73e8e4['id']})[_0xfda3('0x39')](function(_0x57013b){logger['error'](_0x43a58a[_0xfda3('0x20')],_0xfda3('0x3a'),JSON[_0xfda3('0x3b')](_0x57013b));});})[_0xfda3('0x39')](function(_0x597e5a){logger[_0xfda3('0x3c')](_0x43a58a[_0xfda3('0x20')],_0xfda3('0x3d'),JSON[_0xfda3('0x3b')](_0x597e5a));});});}logger[_0xfda3('0x22')](_0x43a58a['uniqueid'],_0xfda3('0x3d'));}};Fax[_0xfda3('0x1a')][_0xfda3('0x19')]=function(_0x36aa3a){if(this[_0xfda3('0xd')][_0x36aa3a['uniqueid']]){_[_0xfda3('0x3e')](this[_0xfda3('0xa')][_0x36aa3a[_0xfda3('0x20')]],_['pick'](_0x36aa3a,[_0xfda3('0x3f'),_0xfda3('0x40')]));}};function updateStatus(_0x11addf){if(_0x11addf['AttachmentId']){faxMessage[_0xfda3('0x41')](_0x11addf[_0xfda3('0x42')],{'failMessage':_0xfda3('0x43')})[_0xfda3('0x36')](function(_0x1ab4a8){ut['logger'](_0xfda3('0x44'),_0x1ab4a8);})['catch'](function(_0x17fe20){ut['logger'](_0xfda3('0x45'),_0x17fe20);});}else{ut[_0xfda3('0x46')](_0xfda3('0x47'));}}Fax[_0xfda3('0x1a')]['updateStatus']=function(_0x244c24,_0x3b430d,_0x2f2c32){var _0x372f15=this;var _0x18425a={};if(_0x3b430d){_0x18425a={'read':_0x3b430d};}else{_0x18425a={'failMessage':_0x2f2c32};}if(this[_0xfda3('0xd')][_0x244c24][_0xfda3('0x42')]){faxMessage['update'](this['actions'][_0x244c24][_0xfda3('0x42')],_0x18425a)[_0xfda3('0x36')](function(_0x218ee5){ut['logger']('[Fax][Message][Updated]',_0x218ee5);})[_0xfda3('0x39')](function(_0x1d6606){ut[_0xfda3('0x46')](_0xfda3('0x48'),_0x1d6606);})[_0xfda3('0x49')](function(){delete _0x372f15['channels'][_0x244c24];delete _0x372f15[_0xfda3('0xd')][_0x244c24];});}else{ut[_0xfda3('0x46')](_0xfda3('0x4a'));delete this[_0xfda3('0xa')][_0x244c24];delete this[_0xfda3('0xd')][_0x244c24];}};Fax[_0xfda3('0x1a')][_0xfda3('0x4b')]=function(_0x1c5073){var _0x3a8c51=this;if(this[_0xfda3('0xa')][_0x1c5073[_0xfda3('0x20')]]){if(this[_0xfda3('0xd')][_0x1c5073['uniqueid']]){this[_0xfda3('0xa')][_0x1c5073[_0xfda3('0x20')]]['id']=this[_0xfda3('0xd')][_0x1c5073[_0xfda3('0x20')]]['id'];this[_0xfda3('0xa')][_0x1c5073[_0xfda3('0x20')]][_0xfda3('0x21')]=this['actions'][_0x1c5073['uniqueid']][_0xfda3('0x21')];}logger[_0xfda3('0x22')](_0x1c5073['uniqueid'],this[_0xfda3('0xd')][_0x1c5073[_0xfda3('0x20')]]?_0xfda3('0x4c'):_0xfda3('0x4d'),JSON['stringify'](this['channels'][_0x1c5073[_0xfda3('0x20')]]));if(this[_0xfda3('0xd')][_0x1c5073[_0xfda3('0x20')]]){if(this['channels'][_0x1c5073[_0xfda3('0x20')]]['faxpages']>0x0&&this[_0xfda3('0xa')][_0x1c5073[_0xfda3('0x20')]][_0xfda3('0x16')]===_0xfda3('0x4e')){this[_0xfda3('0x4f')](_0x1c5073[_0xfda3('0x20')],!![]);}else{this['updateStatus'](_0x1c5073[_0xfda3('0x20')],![],this[_0xfda3('0xa')][_0x1c5073[_0xfda3('0x20')]][_0xfda3('0x50')]?_0xfda3('0x51')+this['channels'][_0x1c5073['uniqueid']][_0xfda3('0x50')]:_0xfda3('0x52'));}}}};Fax['prototype']['send']=function(_0x512d7b){var _0x248174=this;return new BPromise(function(_0x2c93d4,_0x4f3e45){_0x248174[_0xfda3('0x53')](_0x512d7b,_0x248174[_0xfda3('0xb')][_0x512d7b[_0xfda3('0x54')]])[_0xfda3('0x36')](function(_0x51e463){ut[_0xfda3('0x46')](_0xfda3('0x55'),_0x51e463);_0x2c93d4(ut[_0xfda3('0x56')](_0xfda3('0x57')));})[_0xfda3('0x39')](function(_0xf252ce){ut['logger']('[Fax][execOriginate][failure]',_0xf252ce);updateStatus(_0x512d7b);_0x4f3e45(ut[_0xfda3('0x56')]('Fax\x20failed'));});});};Fax[_0xfda3('0x1a')][_0xfda3('0x58')]=function(_0x20704a){var _0x3884b1=this;return new BPromise(function(_0x1d6547,_0x3c0155){var _0x44185c=_0x3884b1[_0xfda3('0x59')](_0x3884b1[_0xfda3('0xb')][_0x20704a[_0xfda3('0x54')]]['Trunk'],_0x20704a);if(_0x44185c[_0xfda3('0x5a')]){_0x1d6547(ut['message']('Trunk\x20Reachable'));}else{_0x3c0155(ut[_0xfda3('0x56')](_0x44185c[_0xfda3('0x56')]));}});};function originate(_0x531874,_0xa3b2e0,_0x26e1f5){return new BPromise(function(_0x42e387,_0x589c7a){if(_0x26e1f5){var _0x1a825c=util[_0xfda3('0x5b')](_0xfda3('0x5c'),path[_0xfda3('0x33')](_0x531874[_0xfda3('0x5d')])['name'],_0x531874['path']);gs['execute'](_0x1a825c)[_0xfda3('0x36')](function(){_0x531874[_0xfda3('0x5d')]=util[_0xfda3('0x5b')](_0xfda3('0x5e'),path[_0xfda3('0x33')](_0x531874[_0xfda3('0x5d')])['dir'],path[_0xfda3('0x33')](_0x531874[_0xfda3('0x5d')])[_0xfda3('0x21')]);_0xa3b2e0[_0xfda3('0x5f')]=_0x531874['path'];ut[_0xfda3('0x46')]('Convert\x20pdf\x20to\x20tif','');ami[_0xfda3('0x60')](ut[_0xfda3('0x61')](_0x531874,_0xa3b2e0))[_0xfda3('0x36')](function(_0x16e8f0){_0x42e387(_0x16e8f0);})[_0xfda3('0x39')](function(_0x291695){_0x589c7a(_0x291695);});})[_0xfda3('0x39')](function(_0x5af4bd){_0x589c7a(_0x5af4bd);});}else{ami[_0xfda3('0x60')](ut[_0xfda3('0x61')](_0x531874,_0xa3b2e0))[_0xfda3('0x36')](function(_0x2c3a49){_0x42e387(_0x2c3a49);})[_0xfda3('0x39')](function(_0x119564){_0x589c7a(_0x119564);});}});}Fax['prototype'][_0xfda3('0x53')]=function(_0x15041,_0x17161f){var _0x3ebf07=this;return new BPromise(function(_0x3ce543,_0x4a0a1c){var _0x174167=uuid['v4']();var _0x1d5b7a=ut[_0xfda3('0x62')](_0x15041,_0x17161f);_0x3ebf07[_0xfda3('0xd')][_0x174167]=new Action(_0x174167,_0x17161f,_0x15041);var _0xcb7ff4=_0x3ebf07[_0xfda3('0xd')][_0x174167];if(path[_0xfda3('0x33')](_0x15041[_0xfda3('0x5d')])[_0xfda3('0x63')]===_0xfda3('0x34')){originate(_0xcb7ff4,_0x1d5b7a,!![])['then'](function(_0x1c0e07){_0x3ce543(_0x1c0e07);})[_0xfda3('0x39')](function(_0x46210d){_0x4a0a1c(_0x46210d);});}else{originate(_0xcb7ff4,_0x1d5b7a,![])[_0xfda3('0x36')](function(_0x213bb1){_0x3ce543(_0x213bb1);})['catch'](function(_0x5e54e5){_0x4a0a1c(_0x5e54e5);});}});};Fax[_0xfda3('0x1a')][_0xfda3('0x64')]=function(_0x120fe9){return!_[_0xfda3('0x65')](_0x120fe9)&&!_[_0xfda3('0x65')](_0x120fe9[_0xfda3('0x21')])&&!_[_0xfda3('0x65')](_0x120fe9[_0xfda3('0x66')])&&_0x120fe9[_0xfda3('0x66')]&&!_[_0xfda3('0x65')](this[_0xfda3('0xc')][util['format'](_0xfda3('0x67'),_0x120fe9['name'])])&&!_['isNil'](this['trunks'][util[_0xfda3('0x5b')]('SIP/%s',_0x120fe9[_0xfda3('0x21')])][_0xfda3('0x2b')])&&(this['trunks'][util[_0xfda3('0x5b')](_0xfda3('0x67'),_0x120fe9['name'])][_0xfda3('0x2b')]==='reachable'||this[_0xfda3('0xc')][util[_0xfda3('0x5b')]('SIP/%s',_0x120fe9[_0xfda3('0x21')])][_0xfda3('0x2b')]===_0xfda3('0x68'));};Fax[_0xfda3('0x1a')][_0xfda3('0x59')]=function(_0x4e5791,_0x2bde10){if(!this[_0xfda3('0x64')](_0x4e5791)){ut[_0xfda3('0x46')](_0xfda3('0x69'),_[_0xfda3('0x65')](_0x4e5791)?'':_0x4e5791['name']+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':'Trunk\x20not\x20working'};}if(_[_0xfda3('0x65')](_0x2bde10[_0xfda3('0x4')])){ut[_0xfda3('0x46')](_0xfda3('0x6a'),JSON[_0xfda3('0x3b')](_0x2bde10));return{'isValid':![],'message':_0xfda3('0x6b')};}if(_[_0xfda3('0x65')](_0x2bde10[_0xfda3('0x5d')])){ut['logger'](_0xfda3('0x6c'),JSON[_0xfda3('0x3b')](_0x2bde10));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':_0xfda3('0x6d')};};module[_0xfda3('0x6e')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index b6f2b7e..f127402 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 _0x0fcc=['notify','then','util','bluebird','../../../config/logger','preview','lodash','../rpc/faxAccount','error','inspect'];(function(_0x1762b4,_0x33d836){var _0x29beda=function(_0x31c2fa){while(--_0x31c2fa){_0x1762b4['push'](_0x1762b4['shift']());}};_0x29beda(++_0x33d836);}(_0x0fcc,0x138));var _0xc0fc=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0x0fcc[_0x5f09c5];return _0x426ad9;};'use strict';var util=require(_0xc0fc('0x0'));var BPromise=require(_0xc0fc('0x1'));var logger=require(_0xc0fc('0x2'))(_0xc0fc('0x3'));var _=require(_0xc0fc('0x4'));var faxAccount=require(_0xc0fc('0x5'));function loggerCatch(_0x5a376b){return function(_0x4b5f80){logger[_0xc0fc('0x6')](_0x5a376b,util[_0xc0fc('0x7')](_0x4b5f80,{'showHidden':![],'depth':null}));};}exports[_0xc0fc('0x8')]=function(_0x3b20c2,_0x1397c8){return BPromise['resolve']()[_0xc0fc('0x9')](faxAccount[_0xc0fc('0x8')](_0x3b20c2,_0x1397c8))['catch'](loggerCatch('[Notify]\x20'));}; \ No newline at end of file +var _0x523e=['inspect','notify','resolve','util','bluebird','../../../config/logger','preview','lodash','../rpc/faxAccount','error'];(function(_0x5ec454,_0xfcd77e){var _0x5ebf50=function(_0x29de85){while(--_0x29de85){_0x5ec454['push'](_0x5ec454['shift']());}};_0x5ebf50(++_0xfcd77e);}(_0x523e,0xad));var _0xe523=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x523e[_0x17d9e3];return _0x14192d;};'use strict';var util=require(_0xe523('0x0'));var BPromise=require(_0xe523('0x1'));var logger=require(_0xe523('0x2'))(_0xe523('0x3'));var _=require(_0xe523('0x4'));var faxAccount=require(_0xe523('0x5'));function loggerCatch(_0x1a05e3){return function(_0x3d8fd6){logger[_0xe523('0x6')](_0x1a05e3,util[_0xe523('0x7')](_0x3d8fd6,{'showHidden':![],'depth':null}));};}exports[_0xe523('0x8')]=function(_0x517f2c,_0x593590){return BPromise[_0xe523('0x9')]()['then'](faxAccount['notify'](_0x517f2c,_0x593590))['catch'](loggerCatch('[Notify]\x20'));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index db07801..f372150 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 _0x34a3=['child_process','exec','execute','Exec\x20gs','\x20Error\x20:','inspect','../../../../config/logger','fax'];(function(_0x545bc4,_0x135d48){var _0x2d478e=function(_0x42ab1f){while(--_0x42ab1f){_0x545bc4['push'](_0x545bc4['shift']());}};_0x2d478e(++_0x135d48);}(_0x34a3,0x86));var _0x334a=function(_0x9cf391,_0x3b631f){_0x9cf391=_0x9cf391-0x0;var _0xb7069f=_0x34a3[_0x9cf391];return _0xb7069f;};'use strict';var util=require('util');var logger=require(_0x334a('0x0'))(_0x334a('0x1'));var BPromise=require('bluebird');var exec=require(_0x334a('0x2'))[_0x334a('0x3')];exports[_0x334a('0x4')]=function(_0x5880bc){return new BPromise(function(_0x5d6ee7,_0x1f07bc){exec(_0x5880bc,function(_0x36db46,_0x3596dc,_0x15081a){logger['info']('Exec\x20gs',_0x3596dc);if(_0x36db46){logger['info'](_0x334a('0x5'),_0x334a('0x6'),util[_0x334a('0x7')](_0x36db46,{'showHidden':![],'depth':null}),_0x3596dc,_0x15081a);_0x1f07bc(_0x36db46);}_0x5d6ee7(_0x3596dc);});});}; \ No newline at end of file +var _0x94f2=['Exec\x20gs','\x20Error\x20:','inspect','util','../../../../config/logger','fax','bluebird','exec','execute','info'];(function(_0x272d97,_0x3cb745){var _0x40fc01=function(_0x1ad071){while(--_0x1ad071){_0x272d97['push'](_0x272d97['shift']());}};_0x40fc01(++_0x3cb745);}(_0x94f2,0x99));var _0x294f=function(_0x267049,_0x85a490){_0x267049=_0x267049-0x0;var _0x152882=_0x94f2[_0x267049];return _0x152882;};'use strict';var util=require(_0x294f('0x0'));var logger=require(_0x294f('0x1'))(_0x294f('0x2'));var BPromise=require(_0x294f('0x3'));var exec=require('child_process')[_0x294f('0x4')];exports[_0x294f('0x5')]=function(_0x1172f6){return new BPromise(function(_0x15ab29,_0x587643){exec(_0x1172f6,function(_0x5cd1f3,_0x897a2c,_0x3dc0b3){logger[_0x294f('0x6')](_0x294f('0x7'),_0x897a2c);if(_0x5cd1f3){logger[_0x294f('0x6')](_0x294f('0x7'),_0x294f('0x8'),util[_0x294f('0x9')](_0x5cd1f3,{'showHidden':![],'depth':null}),_0x897a2c,_0x3dc0b3);_0x587643(_0x5cd1f3);}_0x15ab29(_0x897a2c);});});}; \ 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 00e8bc6..3a88a05 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 _0x15c8=['\x22%s\x22\x20<%s>','localstationid','util','moment','../../../../config/logger','fax','inspect','addVariables','ecm','headerinfo','minrate','maxrate','format','\x22%s\x22','modem','gateway','faxdetect','variablesAction','uniqueid','originate','channel','xcally-motion-fax','from-sip'];(function(_0x432707,_0xf0f34c){var _0x340b83=function(_0x52ee21){while(--_0x52ee21){_0x432707['push'](_0x432707['shift']());}};_0x340b83(++_0xf0f34c);}(_0x15c8,0x116));var _0x815c=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x15c8[_0xa464c9];return _0x3d73c4;};'use strict';var util=require(_0x815c('0x0'));var _=require('lodash');var moment=require(_0x815c('0x1'));var logger=require(_0x815c('0x2'))(_0x815c('0x3'));exports['message']=function(_0x10afad){return{'message':_0x10afad};};exports['logger']=function(_0x3ee811,_0x592437){logger['info'](_0x3ee811,util[_0x815c('0x4')](_0x592437,{'showHidden':![],'depth':null}));};exports[_0x815c('0x5')]=function(_0xf3ab1d,_0x224d98){var _0x2bbf33={'XMF-ECM':_0x224d98[_0x815c('0x6')],'XMF-HEADERINFO':_0x224d98[_0x815c('0x7')],'XMF-MINRATE':_0x224d98[_0x815c('0x8')],'XMF-MAXRATE':_0x224d98[_0x815c('0x9')],'XMF-MODEM':util[_0x815c('0xa')](_0x815c('0xb'),_0x224d98[_0x815c('0xc')]),'XMF-GATEWAY':_0x224d98[_0x815c('0xd')],'XMF-FAXDETECT':_0x224d98[_0x815c('0xe')],'XMF-T38TIMEOUT':_0x224d98['t38timeout'],'XMF-LOCALSTATIONID':_0x224d98['localstationid'],'XMF-PATH':_0xf3ab1d['path']};return _0x2bbf33;};exports[_0x815c('0xf')]=function(_0x2a6896,_0x4b8029){return{'actionid':_0x2a6896[_0x815c('0x10')],'action':_0x815c('0x11'),'channel':_0x2a6896[_0x815c('0x12')],'Exten':_0x815c('0x13'),'Context':_0x815c('0x14'),'Priority':'1','callerid':util[_0x815c('0xa')](_0x815c('0x15'),_0x2a6896['headerinfo']?_0x2a6896[_0x815c('0x7')]:'',_0x2a6896[_0x815c('0x16')]),'variable':_0x4b8029,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x2a6896[_0x815c('0x10')]};}; \ No newline at end of file +var _0x4105=['gateway','faxdetect','t38timeout','localstationid','path','uniqueid','from-sip','\x22%s\x22\x20<%s>','util','lodash','../../../../config/logger','message','info','inspect','addVariables','headerinfo','minrate','format','\x22%s\x22'];(function(_0x2bdf1c,_0x41de2f){var _0x435abc=function(_0x2fc094){while(--_0x2fc094){_0x2bdf1c['push'](_0x2bdf1c['shift']());}};_0x435abc(++_0x41de2f);}(_0x4105,0x1e3));var _0x5410=function(_0x26158f,_0x3f9339){_0x26158f=_0x26158f-0x0;var _0x48f262=_0x4105[_0x26158f];return _0x48f262;};'use strict';var util=require(_0x5410('0x0'));var _=require(_0x5410('0x1'));var moment=require('moment');var logger=require(_0x5410('0x2'))('fax');exports[_0x5410('0x3')]=function(_0x17ee70){return{'message':_0x17ee70};};exports['logger']=function(_0x400701,_0x16f867){logger[_0x5410('0x4')](_0x400701,util[_0x5410('0x5')](_0x16f867,{'showHidden':![],'depth':null}));};exports[_0x5410('0x6')]=function(_0x1c3ab1,_0x45b80a){var _0x1ac6ce={'XMF-ECM':_0x45b80a['ecm'],'XMF-HEADERINFO':_0x45b80a[_0x5410('0x7')],'XMF-MINRATE':_0x45b80a[_0x5410('0x8')],'XMF-MAXRATE':_0x45b80a['maxrate'],'XMF-MODEM':util[_0x5410('0x9')](_0x5410('0xa'),_0x45b80a['modem']),'XMF-GATEWAY':_0x45b80a[_0x5410('0xb')],'XMF-FAXDETECT':_0x45b80a[_0x5410('0xc')],'XMF-T38TIMEOUT':_0x45b80a[_0x5410('0xd')],'XMF-LOCALSTATIONID':_0x45b80a[_0x5410('0xe')],'XMF-PATH':_0x1c3ab1[_0x5410('0xf')]};return _0x1ac6ce;};exports['variablesAction']=function(_0x5c1a01,_0x4ce8a5){return{'actionid':_0x5c1a01[_0x5410('0x10')],'action':'originate','channel':_0x5c1a01['channel'],'Exten':'xcally-motion-fax','Context':_0x5410('0x11'),'Priority':'1','callerid':util['format'](_0x5410('0x12'),_0x5c1a01['headerinfo']?_0x5c1a01[_0x5410('0x7')]:'',_0x5c1a01[_0x5410('0xe')]),'variable':_0x4ce8a5,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x5c1a01[_0x5410('0x10')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 5e97c49..2f9e0dd 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 _0xfb74=['getVoiceQueueReports','getVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','error','[index.js][initParams]','listen','[index.js][main]','inspect','bluebird','util','moment','./server','./realtime','./report','./acw','./trigger','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/cmHopperHistory','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','ami','get','hour','resolve','then','getAgents','initAgents','getTelephones','getTrunks','initTrunks','initVoiceQueues','getTriggers','initTriggers','getZendeskAccounts','initSalesforceAccounts','initSugarcrmAccounts','getFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','getDynamics365Accounts','getCampaigns','getVoiceExtensions','getFaxAccounts','initFaxAccounts'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0xfb74,0x11c));var _0x4fb7=function(_0x52ca59,_0x279dda){_0x52ca59=_0x52ca59-0x0;var _0x1ab7e5=_0xfb74[_0x52ca59];return _0x1ab7e5;};'use strict';var BPromise=require(_0x4fb7('0x0'));var util=require(_0x4fb7('0x1'));var moment=require(_0x4fb7('0x2'));var server=require(_0x4fb7('0x3'));var Realtime=require(_0x4fb7('0x4'));var Report=require(_0x4fb7('0x5'));var Acw=require(_0x4fb7('0x6'));var Trigger=require(_0x4fb7('0x7'));var Dialer=require('./dialer');var Preview=require('./preview');var Fax=require(_0x4fb7('0x8'));var user=require(_0x4fb7('0x9'));var voiceQueue=require(_0x4fb7('0xa'));var voiceQueueReport=require(_0x4fb7('0xb'));var voiceCallReport=require(_0x4fb7('0xc'));var trunk=require(_0x4fb7('0xd'));var trigger=require(_0x4fb7('0xe'));var template=require('./rpc/template');var cmHopperHistory=require(_0x4fb7('0xf'));var campaign=require('./rpc/campaign');var voiceExtension=require(_0x4fb7('0x10'));var faxAccount=require(_0x4fb7('0x11'));var zendesk=require('./rpc/integrations/zendesk');var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0x4fb7('0x12'));var freshdesk=require(_0x4fb7('0x13'));var desk=require(_0x4fb7('0x14'));var zoho=require(_0x4fb7('0x15'));var vtiger=require('./rpc/integrations/vtiger');var freshsales=require(_0x4fb7('0x16'));var servicenow=require(_0x4fb7('0x17'));var dynamics365=require(_0x4fb7('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(_0x4fb7('0x19'))(_0x4fb7('0x1a'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x4fb7('0x1b')](_0x4fb7('0x1c'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x4fb7('0x1b')]('hour')===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x4fb7('0x1d')]()[_0x4fb7('0x1e')](user[_0x4fb7('0x1f')]())['then'](realtime[_0x4fb7('0x20')]())[_0x4fb7('0x1e')](user[_0x4fb7('0x21')]())[_0x4fb7('0x1e')](realtime['initTelephones']())['then'](trunk[_0x4fb7('0x22')]())[_0x4fb7('0x1e')](realtime[_0x4fb7('0x23')]())[_0x4fb7('0x1e')](voiceQueue['getVoiceQueues']())[_0x4fb7('0x1e')](realtime[_0x4fb7('0x24')]())[_0x4fb7('0x1e')](trigger[_0x4fb7('0x25')]())[_0x4fb7('0x1e')](realtime[_0x4fb7('0x26')]())[_0x4fb7('0x1e')](template['getTemplates']())[_0x4fb7('0x1e')](realtime['initTemplates']())[_0x4fb7('0x1e')](zendesk[_0x4fb7('0x27')]())[_0x4fb7('0x1e')](realtime['initZendeskAccounts']())[_0x4fb7('0x1e')](salesforce['getSalesforceAccounts']())[_0x4fb7('0x1e')](realtime[_0x4fb7('0x28')]())[_0x4fb7('0x1e')](sugarcrm['getSugarcrmAccounts']())[_0x4fb7('0x1e')](realtime[_0x4fb7('0x29')]())['then'](freshdesk[_0x4fb7('0x2a')]())['then'](realtime['initFreshdeskAccounts']())[_0x4fb7('0x1e')](desk[_0x4fb7('0x2b')]())[_0x4fb7('0x1e')](realtime[_0x4fb7('0x2c')]())['then'](zoho[_0x4fb7('0x2d')]())['then'](realtime[_0x4fb7('0x2e')]())['then'](vtiger[_0x4fb7('0x2f')]())[_0x4fb7('0x1e')](realtime['initVtigerAccounts']())[_0x4fb7('0x1e')](freshsales[_0x4fb7('0x30')]())[_0x4fb7('0x1e')](realtime[_0x4fb7('0x31')]())['then'](servicenow[_0x4fb7('0x32')]())[_0x4fb7('0x1e')](realtime['initServicenowAccounts']())['then'](dynamics365[_0x4fb7('0x33')]())[_0x4fb7('0x1e')](realtime['initDynamics365Accounts']())[_0x4fb7('0x1e')](campaign[_0x4fb7('0x34')]())['then'](realtime['initCampaigns']())[_0x4fb7('0x1e')](voiceExtension[_0x4fb7('0x35')]())[_0x4fb7('0x1e')](realtime['initVoiceExtensions']())['then'](faxAccount[_0x4fb7('0x36')]())[_0x4fb7('0x1e')](realtime[_0x4fb7('0x37')]())[_0x4fb7('0x1e')](function(){return realtime;});}function initParams(){return BPromise[_0x4fb7('0x1d')]()[_0x4fb7('0x1e')](voiceQueueReport[_0x4fb7('0x38')]())[_0x4fb7('0x1e')](realtime['initVoiceQueueReports']())[_0x4fb7('0x1e')](cmHopperHistory[_0x4fb7('0x39')]())['then'](realtime['initVoiceQueueHopperHistory']())['then'](cmHopperHistory[_0x4fb7('0x3a')]())[_0x4fb7('0x1e')](realtime[_0x4fb7('0x3b')]())[_0x4fb7('0x1e')](voiceCallReport[_0x4fb7('0x3c')]())[_0x4fb7('0x1e')](realtime[_0x4fb7('0x3d')]())[_0x4fb7('0x3e')](function(_0x567018){logger[_0x4fb7('0x3f')](_0x4fb7('0x40'),util['inspect'](_0x567018,{'showHidden':![],'depth':null}));});}function main(){return server[_0x4fb7('0x41')](realtime,preview,fax)[_0x4fb7('0x1e')](function(_0x15f0b6){return initRealtime();})[_0x4fb7('0x1e')](function(){return initParams();})['then'](function(){report['sync']();setInterval(initRealtime,0x1388);})['catch'](function(_0x5ad29b){logger[_0x4fb7('0x3f')](_0x4fb7('0x42'),util[_0x4fb7('0x43')](_0x5ad29b,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x84fd=['initFaxAccounts','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','error','[index.js][initParams]','inspect','listen','sync','[index.js][main]','bluebird','./server','./realtime','./report','./acw','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','hour','then','initAgents','getTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','getTemplates','initTemplates','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','initVoiceExtensions','getFaxAccounts'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0x84fd,0x170));var _0xd84f=function(_0x5e0781,_0x3f2de7){_0x5e0781=_0x5e0781-0x0;var _0x2c694e=_0x84fd[_0x5e0781];return _0x2c694e;};'use strict';var BPromise=require(_0xd84f('0x0'));var util=require('util');var moment=require('moment');var server=require(_0xd84f('0x1'));var Realtime=require(_0xd84f('0x2'));var Report=require(_0xd84f('0x3'));var Acw=require(_0xd84f('0x4'));var Trigger=require(_0xd84f('0x5'));var Dialer=require(_0xd84f('0x6'));var Preview=require(_0xd84f('0x7'));var Fax=require(_0xd84f('0x8'));var user=require(_0xd84f('0x9'));var voiceQueue=require(_0xd84f('0xa'));var voiceQueueReport=require(_0xd84f('0xb'));var voiceCallReport=require(_0xd84f('0xc'));var trunk=require(_0xd84f('0xd'));var trigger=require('./rpc/trigger');var template=require(_0xd84f('0xe'));var cmHopperHistory=require(_0xd84f('0xf'));var campaign=require(_0xd84f('0x10'));var voiceExtension=require(_0xd84f('0x11'));var faxAccount=require(_0xd84f('0x12'));var zendesk=require(_0xd84f('0x13'));var salesforce=require(_0xd84f('0x14'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require(_0xd84f('0x15'));var desk=require(_0xd84f('0x16'));var zoho=require(_0xd84f('0x17'));var vtiger=require(_0xd84f('0x18'));var freshsales=require(_0xd84f('0x19'));var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require('./rpc/integrations/dynamics365');var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require('../../config/logger')('ami');var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get'](_0xd84f('0x1a'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get'](_0xd84f('0x1a'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise['resolve']()['then'](user['getAgents']())[_0xd84f('0x1b')](realtime[_0xd84f('0x1c')]())[_0xd84f('0x1b')](user[_0xd84f('0x1d')]())['then'](realtime['initTelephones']())[_0xd84f('0x1b')](trunk[_0xd84f('0x1e')]())[_0xd84f('0x1b')](realtime[_0xd84f('0x1f')]())[_0xd84f('0x1b')](voiceQueue[_0xd84f('0x20')]())[_0xd84f('0x1b')](realtime[_0xd84f('0x21')]())['then'](trigger[_0xd84f('0x22')]())[_0xd84f('0x1b')](realtime['initTriggers']())[_0xd84f('0x1b')](template[_0xd84f('0x23')]())[_0xd84f('0x1b')](realtime[_0xd84f('0x24')]())[_0xd84f('0x1b')](zendesk['getZendeskAccounts']())[_0xd84f('0x1b')](realtime[_0xd84f('0x25')]())['then'](salesforce[_0xd84f('0x26')]())[_0xd84f('0x1b')](realtime[_0xd84f('0x27')]())[_0xd84f('0x1b')](sugarcrm['getSugarcrmAccounts']())[_0xd84f('0x1b')](realtime[_0xd84f('0x28')]())[_0xd84f('0x1b')](freshdesk[_0xd84f('0x29')]())[_0xd84f('0x1b')](realtime[_0xd84f('0x2a')]())[_0xd84f('0x1b')](desk['getDeskAccounts']())[_0xd84f('0x1b')](realtime[_0xd84f('0x2b')]())['then'](zoho[_0xd84f('0x2c')]())[_0xd84f('0x1b')](realtime[_0xd84f('0x2d')]())[_0xd84f('0x1b')](vtiger[_0xd84f('0x2e')]())[_0xd84f('0x1b')](realtime[_0xd84f('0x2f')]())['then'](freshsales[_0xd84f('0x30')]())['then'](realtime[_0xd84f('0x31')]())[_0xd84f('0x1b')](servicenow[_0xd84f('0x32')]())['then'](realtime[_0xd84f('0x33')]())[_0xd84f('0x1b')](dynamics365[_0xd84f('0x34')]())[_0xd84f('0x1b')](realtime[_0xd84f('0x35')]())[_0xd84f('0x1b')](campaign[_0xd84f('0x36')]())[_0xd84f('0x1b')](realtime[_0xd84f('0x37')]())[_0xd84f('0x1b')](voiceExtension['getVoiceExtensions']())[_0xd84f('0x1b')](realtime[_0xd84f('0x38')]())[_0xd84f('0x1b')](faxAccount[_0xd84f('0x39')]())['then'](realtime[_0xd84f('0x3a')]())[_0xd84f('0x1b')](function(){return realtime;});}function initParams(){return BPromise['resolve']()[_0xd84f('0x1b')](voiceQueueReport['getVoiceQueueReports']())[_0xd84f('0x1b')](realtime[_0xd84f('0x3b')]())['then'](cmHopperHistory[_0xd84f('0x3c')]())[_0xd84f('0x1b')](realtime[_0xd84f('0x3d')]())['then'](cmHopperHistory[_0xd84f('0x3e')]())['then'](realtime[_0xd84f('0x3f')]())[_0xd84f('0x1b')](voiceCallReport[_0xd84f('0x40')]())[_0xd84f('0x1b')](realtime['initVoiceCallReports']())['catch'](function(_0x4417f9){logger[_0xd84f('0x41')](_0xd84f('0x42'),util[_0xd84f('0x43')](_0x4417f9,{'showHidden':![],'depth':null}));});}function main(){return server[_0xd84f('0x44')](realtime,preview,fax)['then'](function(_0x415b97){return initRealtime();})[_0xd84f('0x1b')](function(){return initParams();})[_0xd84f('0x1b')](function(){report[_0xd84f('0x45')]();setInterval(initRealtime,0x1388);})['catch'](function(_0x27bf14){logger['error'](_0xd84f('0x46'),util[_0xd84f('0x43')](_0x27bf14,{'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 1b80948..6f1617e 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 _0xcb91=['name','email','accountcode','fullname','unknown','stateTime','status','address','mobile','interface','online','voiceStatus','voiceStatusQueue','onhold','local','updateStatusRealtime','state','idle','inuse','talking','statePause','voiceStatusTime','toNumber','voiceStatusCallerIdNumber','stringify','format','emit','user:presence','exports','moment','md5','ioredis','../../../config/environment','defaults','redis','socket.io-emitter'];(function(_0x4e1fb5,_0x1fb5a5){var _0xed52ca=function(_0x453ee8){while(--_0x453ee8){_0x4e1fb5['push'](_0x4e1fb5['shift']());}};_0xed52ca(++_0x1fb5a5);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x11f226,_0x491e30){_0x11f226=_0x11f226-0x0;var _0x30be77=_0xcb91[_0x11f226];return _0x30be77;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var md5=require(_0x1cb9('0x1'));var Redis=require(_0x1cb9('0x2'));var config=require(_0x1cb9('0x3'));config['redis']=_[_0x1cb9('0x4')](config[_0x1cb9('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x1cb9('0x6'))(new Redis(config[_0x1cb9('0x5')]));function Agent(_0x53ffbd){this['id']=_0x53ffbd['id']||0x0;this[_0x1cb9('0x7')]=_0x53ffbd[_0x1cb9('0x7')]||'';this['email']=_0x53ffbd[_0x1cb9('0x8')]||'';this[_0x1cb9('0x9')]=_0x53ffbd['accountcode']||'';this[_0x1cb9('0xa')]=_0x53ffbd['fullname']||'';this['state']=_0x1cb9('0xb');this[_0x1cb9('0xc')]=0x0;this[_0x1cb9('0xd')]=_0x1cb9('0xb');this[_0x1cb9('0xe')]='';this['phone']='';this[_0x1cb9('0xf')]='';this[_0x1cb9('0x10')]='';this[_0x1cb9('0x11')]=_0x53ffbd[_0x1cb9('0x11')]||![];this[_0x1cb9('0x12')]='unknown';this['voiceStatusTime']=0x0;this['voiceStatusCallerIdNumber']='';this[_0x1cb9('0x13')]='';this[_0x1cb9('0x14')]=![];this[_0x1cb9('0x15')]=![];this[_0x1cb9('0x1')]='';}Agent['prototype'][_0x1cb9('0x16')]=function(_0x6ef389){var _0x1b3cd7;if(_0x6ef389&&_0x6ef389[_0x1cb9('0x17')]){_0x1b3cd7=_0x6ef389[_0x1cb9('0x17')]['toLowerCase']();switch(_0x1b3cd7){case'not_inuse':_0x1b3cd7=_0x1cb9('0x18');break;case _0x1cb9('0x19'):_0x1b3cd7=_0x1cb9('0x1a');break;}}if(_0x1b3cd7&&this[_0x1cb9('0x12')]!==_0x1b3cd7||_0x6ef389[_0x1cb9('0x1b')]){this[_0x1cb9('0x1c')]=_[_0x1cb9('0x1d')](moment()['format']('x'));}if(_0x1b3cd7){this['voiceStatus']=_0x1b3cd7;}var _0x1b2fa6={'id':this['id'],'name':this[_0x1cb9('0x7')],'email':this[_0x1cb9('0x8')],'accountcode':this[_0x1cb9('0x9')],'fullname':this[_0x1cb9('0xa')],'state':this[_0x1cb9('0x17')],'stateTime':this[_0x1cb9('0xc')],'status':this['status'],'address':this['address'],'online':this[_0x1cb9('0x11')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this[_0x1cb9('0x1c')],'voiceStatusCallerIdNumber':this[_0x1cb9('0x1e')],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this['interface'],'onhold':this[_0x1cb9('0x14')]};var _0x325637=md5(JSON[_0x1cb9('0x1f')](_0x1b2fa6));if(this[_0x1cb9('0x1')]!==_0x325637){this[_0x1cb9('0x1')]=_0x325637;io['to'](util[_0x1cb9('0x20')]('user:%s',_0x1b2fa6['name']))[_0x1cb9('0x21')]('user:save',_0x1b2fa6);io[_0x1cb9('0x21')](_0x1cb9('0x22'),_0x1b2fa6);}};module[_0x1cb9('0x23')]=Agent; \ No newline at end of file +var _0xe706=['address','phone','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','updateStatusRealtime','not_inuse','inuse','talking','format','interface','stringify','md5','user:%s','emit','user:presence','lodash','util','moment','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime','status'];(function(_0x4b7dda,_0x48da5b){var _0x5cb6c9=function(_0x5e8bc8){while(--_0x5e8bc8){_0x4b7dda['push'](_0x4b7dda['shift']());}};_0x5cb6c9(++_0x48da5b);}(_0xe706,0xa3));var _0x6e70=function(_0x64924c,_0x472da8){_0x64924c=_0x64924c-0x0;var _0x1b8e46=_0xe706[_0x64924c];return _0x1b8e46;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var md5=require('md5');var Redis=require(_0x6e70('0x3'));var config=require(_0x6e70('0x4'));config[_0x6e70('0x5')]=_[_0x6e70('0x6')](config[_0x6e70('0x5')],{'host':_0x6e70('0x7'),'port':0x18eb});var io=require(_0x6e70('0x8'))(new Redis(config[_0x6e70('0x5')]));function Agent(_0x1b0389){this['id']=_0x1b0389['id']||0x0;this[_0x6e70('0x9')]=_0x1b0389[_0x6e70('0x9')]||'';this[_0x6e70('0xa')]=_0x1b0389[_0x6e70('0xa')]||'';this[_0x6e70('0xb')]=_0x1b0389[_0x6e70('0xb')]||'';this[_0x6e70('0xc')]=_0x1b0389[_0x6e70('0xc')]||'';this[_0x6e70('0xd')]=_0x6e70('0xe');this[_0x6e70('0xf')]=0x0;this[_0x6e70('0x10')]=_0x6e70('0xe');this[_0x6e70('0x11')]='';this[_0x6e70('0x12')]='';this['mobile']='';this['interface']='';this[_0x6e70('0x13')]=_0x1b0389[_0x6e70('0x13')]||![];this[_0x6e70('0x14')]=_0x6e70('0xe');this[_0x6e70('0x15')]=0x0;this[_0x6e70('0x16')]='';this[_0x6e70('0x17')]='';this[_0x6e70('0x18')]=![];this['local']=![];this['md5']='';}Agent['prototype'][_0x6e70('0x19')]=function(_0x5a37a6){var _0x53aed0;if(_0x5a37a6&&_0x5a37a6[_0x6e70('0xd')]){_0x53aed0=_0x5a37a6[_0x6e70('0xd')]['toLowerCase']();switch(_0x53aed0){case _0x6e70('0x1a'):_0x53aed0='idle';break;case _0x6e70('0x1b'):_0x53aed0=_0x6e70('0x1c');break;}}if(_0x53aed0&&this['voiceStatus']!==_0x53aed0||_0x5a37a6['statePause']){this[_0x6e70('0x15')]=_['toNumber'](moment()[_0x6e70('0x1d')]('x'));}if(_0x53aed0){this[_0x6e70('0x14')]=_0x53aed0;}var _0x53acdc={'id':this['id'],'name':this['name'],'email':this[_0x6e70('0xa')],'accountcode':this[_0x6e70('0xb')],'fullname':this[_0x6e70('0xc')],'state':this[_0x6e70('0xd')],'stateTime':this[_0x6e70('0xf')],'status':this[_0x6e70('0x10')],'address':this[_0x6e70('0x11')],'online':this[_0x6e70('0x13')],'voiceStatus':this[_0x6e70('0x14')],'voiceStatusTime':this[_0x6e70('0x15')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x6e70('0x17')],'interface':this[_0x6e70('0x1e')],'onhold':this[_0x6e70('0x18')]};var _0x502b2d=md5(JSON[_0x6e70('0x1f')](_0x53acdc));if(this[_0x6e70('0x20')]!==_0x502b2d){this[_0x6e70('0x20')]=_0x502b2d;io['to'](util['format'](_0x6e70('0x21'),_0x53acdc['name']))['emit']('user:save',_0x53acdc);io[_0x6e70('0x22')](_0x6e70('0x23'),_0x53acdc);}};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 01102fd..0039677 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 _0xd60b=['dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','name','type','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency'];(function(_0x2a8b1d,_0x1057e8){var _0x3d9ee9=function(_0x386cd2){while(--_0x386cd2){_0x2a8b1d['push'](_0x2a8b1d['shift']());}};_0x3d9ee9(++_0x1057e8);}(_0xd60b,0xa3));var _0xbd60=function(_0x5d4c1d,_0x3d64f8){_0x5d4c1d=_0x5d4c1d-0x0;var _0xb58922=_0xd60b[_0x5d4c1d];return _0xb58922;};'use strict';function Campaign(_0x5bddef){this['id']=_0x5bddef['id']||0x0;this['name']=_0x5bddef[_0xbd60('0x0')]||'';this[_0xbd60('0x1')]=_0x5bddef[_0xbd60('0x1')]||_0xbd60('0x2');this[_0xbd60('0x3')]=0x0;this[_0xbd60('0x4')]=0x0;this[_0xbd60('0x5')]=0x0;this[_0xbd60('0x6')]=0x0;this['message']='';this['sendMessageOneNotActive']=!![];this[_0xbd60('0x7')]=_0x5bddef[_0xbd60('0x7')];this[_0xbd60('0x8')]=_0x5bddef['limitCalls'];this[_0xbd60('0x9')]=_0x5bddef[_0xbd60('0x9')]||null;this[_0xbd60('0xa')]=_0x5bddef['dialGlobalInterval']?_0x5bddef[_0xbd60('0xa')]:null;this[_0xbd60('0xb')]=_0x5bddef[_0xbd60('0xb')];this[_0xbd60('0xc')]=_0x5bddef[_0xbd60('0xc')];this['dialOriginateTimeout']=_0x5bddef[_0xbd60('0xd')]||0x1e;this['dialCongestionMaxRetry']=_0x5bddef[_0xbd60('0xe')];this[_0xbd60('0xf')]=_0x5bddef[_0xbd60('0xf')];this[_0xbd60('0x10')]=_0x5bddef[_0xbd60('0x10')];this[_0xbd60('0x11')]=_0x5bddef[_0xbd60('0x11')];this['dialNoAnswerMaxRetry']=_0x5bddef[_0xbd60('0x12')];this[_0xbd60('0x13')]=_0x5bddef[_0xbd60('0x13')];this[_0xbd60('0x14')]=_0x5bddef[_0xbd60('0x14')];this[_0xbd60('0x15')]=_0x5bddef[_0xbd60('0x15')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x5bddef[_0xbd60('0x16')]||0x96;this[_0xbd60('0x17')]=_0x5bddef[_0xbd60('0x17')]||0x3;this[_0xbd60('0x18')]=_0x5bddef[_0xbd60('0x18')]||0x96;this[_0xbd60('0x19')]=_0x5bddef[_0xbd60('0x19')]||0x3;this[_0xbd60('0x1a')]=_0x5bddef[_0xbd60('0x1a')]||0x96;this[_0xbd60('0x1b')]=_0x5bddef['dialMachineMaxRetry']||0x3;this[_0xbd60('0x1c')]=_0x5bddef['dialMachineRetryFrequency']||0x96;this[_0xbd60('0x1d')]=_0x5bddef['dialAgentRejectMaxRetry']||0x3;this[_0xbd60('0x1e')]=_0x5bddef[_0xbd60('0x1e')]||0x96;this[_0xbd60('0x1f')]=_0x5bddef[_0xbd60('0x1f')]||_0xbd60('0x20');this['dialPrefix']=_0x5bddef[_0xbd60('0x21')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x5bddef[_0xbd60('0x22')]||undefined;this['dialCutDigit']=_0x5bddef['dialCutDigit']||undefined;this[_0xbd60('0x23')]=_0x5bddef['TrunkBackup']?_0x5bddef[_0xbd60('0x23')]:undefined;this[_0xbd60('0x24')]=_0x5bddef[_0xbd60('0x24')]?_0x5bddef[_0xbd60('0x24')]:undefined;this['Interval']=_0x5bddef[_0xbd60('0x25')]?_0x5bddef[_0xbd60('0x25')]:undefined;this['SquareProject']=_0x5bddef[_0xbd60('0x26')]?_0x5bddef[_0xbd60('0x26')]:undefined;this[_0xbd60('0x27')]=_0x5bddef[_0xbd60('0x26')]?_0x5bddef[_0xbd60('0x26')][_0xbd60('0x0')]:undefined;this[_0xbd60('0x28')]=_0x5bddef[_0xbd60('0x28')]||![];this[_0xbd60('0x29')]=_0x5bddef[_0xbd60('0x29')];this[_0xbd60('0x2a')]=_0x5bddef[_0xbd60('0x2a')];this['dialAMDAfterGreetingSilence']=_0x5bddef['dialAMDAfterGreetingSilence'];this[_0xbd60('0x2b')]=_0x5bddef[_0xbd60('0x2b')];this[_0xbd60('0x2c')]=_0x5bddef[_0xbd60('0x2c')];this['dialAMDBetweenWordsSilence']=_0x5bddef[_0xbd60('0x2d')];this['dialAMDMaximumNumberOfWords']=_0x5bddef['dialAMDMaximumNumberOfWords'];this[_0xbd60('0x2e')]=_0x5bddef[_0xbd60('0x2e')];this[_0xbd60('0x2f')]=_0x5bddef[_0xbd60('0x2f')];}module['exports']=Campaign; \ No newline at end of file +var _0xf57f=['dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','originated','temp','ivrTotalCallsDays','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0xf57f,0xa3));var _0xff57=function(_0xa201ee,_0x37da32){_0xa201ee=_0xa201ee-0x0;var _0x3e104d=_0xf57f[_0xa201ee];return _0x3e104d;};'use strict';function Campaign(_0x4935df){this['id']=_0x4935df['id']||0x0;this[_0xff57('0x0')]=_0x4935df['name']||'';this[_0xff57('0x1')]=_0x4935df[_0xff57('0x1')]||'campaign';this[_0xff57('0x2')]=0x0;this[_0xff57('0x3')]=0x0;this['ivrAnswerCallsDay']=0x0;this[_0xff57('0x4')]=0x0;this['message']='';this['sendMessageOneNotActive']=!![];this['active']=_0x4935df[_0xff57('0x5')];this[_0xff57('0x6')]=_0x4935df[_0xff57('0x6')];this[_0xff57('0x7')]=_0x4935df[_0xff57('0x7')]||null;this[_0xff57('0x8')]=_0x4935df[_0xff57('0x8')]?_0x4935df[_0xff57('0x8')]:null;this[_0xff57('0x9')]=_0x4935df[_0xff57('0x9')];this['dialOriginateCallerIdNumber']=_0x4935df[_0xff57('0xa')];this[_0xff57('0xb')]=_0x4935df['dialOriginateTimeout']||0x1e;this['dialCongestionMaxRetry']=_0x4935df[_0xff57('0xc')];this[_0xff57('0xd')]=_0x4935df[_0xff57('0xd')];this[_0xff57('0xe')]=_0x4935df[_0xff57('0xe')];this[_0xff57('0xf')]=_0x4935df['dialBusyRetryFrequency'];this[_0xff57('0x10')]=_0x4935df['dialNoAnswerMaxRetry'];this['dialNoAnswerRetryFrequency']=_0x4935df[_0xff57('0x11')];this[_0xff57('0x12')]=_0x4935df[_0xff57('0x12')];this[_0xff57('0x13')]=_0x4935df[_0xff57('0x13')]||0x3;this[_0xff57('0x14')]=_0x4935df[_0xff57('0x14')]||0x96;this[_0xff57('0x15')]=_0x4935df[_0xff57('0x15')]||0x3;this['dialDropRetryFrequency']=_0x4935df[_0xff57('0x16')]||0x96;this['dialAbandonedMaxRetry']=_0x4935df[_0xff57('0x17')]||0x3;this[_0xff57('0x18')]=_0x4935df[_0xff57('0x18')]||0x96;this[_0xff57('0x19')]=_0x4935df['dialMachineMaxRetry']||0x3;this[_0xff57('0x1a')]=_0x4935df[_0xff57('0x1a')]||0x96;this[_0xff57('0x1b')]=_0x4935df['dialAgentRejectMaxRetry']||0x3;this[_0xff57('0x1c')]=_0x4935df[_0xff57('0x1c')]||0x96;this[_0xff57('0x1d')]=_0x4935df[_0xff57('0x1d')]||'DESC';this[_0xff57('0x1e')]=_0x4935df[_0xff57('0x1e')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x4935df[_0xff57('0x1f')]||undefined;this['dialCutDigit']=_0x4935df['dialCutDigit']||undefined;this[_0xff57('0x20')]=_0x4935df[_0xff57('0x20')]?_0x4935df[_0xff57('0x20')]:undefined;this[_0xff57('0x21')]=_0x4935df[_0xff57('0x21')]?_0x4935df[_0xff57('0x21')]:undefined;this[_0xff57('0x22')]=_0x4935df['Interval']?_0x4935df[_0xff57('0x22')]:undefined;this['SquareProject']=_0x4935df[_0xff57('0x23')]?_0x4935df['SquareProject']:undefined;this[_0xff57('0x24')]=_0x4935df['SquareProject']?_0x4935df[_0xff57('0x23')][_0xff57('0x0')]:undefined;this['dialAMDActive']=_0x4935df[_0xff57('0x25')]||![];this[_0xff57('0x26')]=_0x4935df['dialAMDInitialSilence'];this['dialAMDGreeting']=_0x4935df[_0xff57('0x27')];this[_0xff57('0x28')]=_0x4935df['dialAMDAfterGreetingSilence'];this[_0xff57('0x29')]=_0x4935df[_0xff57('0x29')];this[_0xff57('0x2a')]=_0x4935df['dialAMDMinWordLength'];this[_0xff57('0x2b')]=_0x4935df['dialAMDBetweenWordsSilence'];this[_0xff57('0x2c')]=_0x4935df[_0xff57('0x2c')];this[_0xff57('0x2d')]=_0x4935df[_0xff57('0x2d')];this[_0xff57('0x2e')]=_0x4935df[_0xff57('0x2e')];}module[_0xff57('0x2f')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 1d6fa5e..3901e36 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 _0x7e27=['monitorFilename','monitors','transfercalleridnum','mohtime','exports','starttime','channel','calleridnum','calleridname','connectedlinenum','connectedlinename','context','uniqueid','linkedid','answered','endtime','unmanaged','lastapplication','lastdata','duration','billableseconds','holdtime','type','tag'];(function(_0x22961d,_0x121c25){var _0x1cad3d=function(_0x1d4ed5){while(--_0x1d4ed5){_0x22961d['push'](_0x22961d['shift']());}};_0x1cad3d(++_0x121c25);}(_0x7e27,0xdd));var _0x77e2=function(_0xccb07e,_0x4c12cf){_0xccb07e=_0xccb07e-0x0;var _0x3d4ca9=_0x7e27[_0xccb07e];return _0x3d4ca9;};'use strict';function Channel(){this[_0x77e2('0x0')]=null;this[_0x77e2('0x1')]='';this['destinationchannel']='';this[_0x77e2('0x2')]=0x0;this[_0x77e2('0x3')]='';this[_0x77e2('0x4')]=undefined;this[_0x77e2('0x5')]=undefined;this['accountcode']=0x0;this[_0x77e2('0x6')]='';this[_0x77e2('0x7')]=0x0;this[_0x77e2('0x8')]=0x0;this['exten']=0x0;this[_0x77e2('0x9')]=![];this['answertime']=null;this[_0x77e2('0xa')]=null;this[_0x77e2('0xb')]=![];this['abandoned']=![];this[_0x77e2('0xc')]='';this[_0x77e2('0xd')]='';this[_0x77e2('0xe')]=0x0;this[_0x77e2('0xf')]=0x0;this[_0x77e2('0x10')]=0x0;this[_0x77e2('0x11')]=null;this[_0x77e2('0x12')]=null;this['disposition']=null;this['monitor']=![];this[_0x77e2('0x13')]=null;this['queue']=null;this[_0x77e2('0x14')]=[];this[_0x77e2('0x15')]=undefined;this['transferconnectedlinenum']=undefined;this['transferType']=undefined;this[_0x77e2('0x16')]=0x0;}module[_0x77e2('0x17')]=Channel; \ No newline at end of file +var _0xf4ce=['mohtime','exports','starttime','calleridnum','calleridname','connectedlinenum','connectedlinename','answered','answertime','endtime','unmanaged','abandoned','lastapplication','duration','billableseconds','disposition','monitor','monitorFilename','queue','transfercalleridnum'];(function(_0x303219,_0xe9c181){var _0xd9f2f4=function(_0x3f50a3){while(--_0x3f50a3){_0x303219['push'](_0x303219['shift']());}};_0xd9f2f4(++_0xe9c181);}(_0xf4ce,0xf2));var _0xef4c=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xf4ce[_0x501510];return _0x1e6ee5;};'use strict';function Channel(){this[_0xef4c('0x0')]=null;this['channel']='';this['destinationchannel']='';this[_0xef4c('0x1')]=0x0;this[_0xef4c('0x2')]='';this[_0xef4c('0x3')]=undefined;this[_0xef4c('0x4')]=undefined;this['accountcode']=0x0;this['context']='';this['uniqueid']=0x0;this['linkedid']=0x0;this['exten']=0x0;this[_0xef4c('0x5')]=![];this[_0xef4c('0x6')]=null;this[_0xef4c('0x7')]=null;this[_0xef4c('0x8')]=![];this[_0xef4c('0x9')]=![];this[_0xef4c('0xa')]='';this['lastdata']='';this[_0xef4c('0xb')]=0x0;this[_0xef4c('0xc')]=0x0;this['holdtime']=0x0;this['type']=null;this['tag']=null;this[_0xef4c('0xd')]=null;this[_0xef4c('0xe')]=![];this[_0xef4c('0xf')]=null;this[_0xef4c('0x10')]=null;this['monitors']=[];this[_0xef4c('0x11')]=undefined;this['transferconnectedlinenum']=undefined;this['transferType']=undefined;this[_0xef4c('0x12')]=0x0;}module[_0xef4c('0x13')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 054977f..28f160a 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 _0x47f7=['password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri','authType'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0x47f7,0xbf));var _0x747f=function(_0x11c221,_0x65c6a5){_0x11c221=_0x11c221-0x0;var _0x26deef=_0x47f7[_0x11c221];return _0x26deef;};'use strict';function DeskAccount(_0x43a4c2){this['id']=_0x43a4c2['id']||0x0;this[_0x747f('0x0')]=_0x43a4c2[_0x747f('0x0')]||'';this[_0x747f('0x1')]=_0x43a4c2['username']||'';this[_0x747f('0x2')]=_0x43a4c2[_0x747f('0x2')]||'';this[_0x747f('0x3')]=_0x43a4c2['authType']||'';this[_0x747f('0x4')]=_0x43a4c2[_0x747f('0x4')]||'';this[_0x747f('0x5')]=_0x43a4c2['consumerKey']||'';this[_0x747f('0x6')]=_0x43a4c2['consumerSecret']||'';this[_0x747f('0x7')]=_0x43a4c2[_0x747f('0x7')]||'';this[_0x747f('0x8')]=_0x43a4c2[_0x747f('0x8')]||'';this[_0x747f('0x9')]=_0x43a4c2[_0x747f('0x9')]||'';this[_0x747f('0xa')]=_0x43a4c2['serverUrl']||'';this[_0x747f('0xb')]=_0x43a4c2['Configurations']||{};}module[_0x747f('0xc')]=DeskAccount; \ No newline at end of file +var _0x0fad=['serverUrl','Configurations','exports','name','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type'];(function(_0x4237e9,_0x485914){var _0x1a9078=function(_0x43ebfb){while(--_0x43ebfb){_0x4237e9['push'](_0x4237e9['shift']());}};_0x1a9078(++_0x485914);}(_0x0fad,0xd3));var _0xd0fa=function(_0x5d9c08,_0x68d66e){_0x5d9c08=_0x5d9c08-0x0;var _0x3d07ae=_0x0fad[_0x5d9c08];return _0x3d07ae;};'use strict';function DeskAccount(_0x4aff05){this['id']=_0x4aff05['id']||0x0;this[_0xd0fa('0x0')]=_0x4aff05[_0xd0fa('0x0')]||'';this['username']=_0x4aff05[_0xd0fa('0x1')]||'';this['remoteUri']=_0x4aff05[_0xd0fa('0x2')]||'';this[_0xd0fa('0x3')]=_0x4aff05[_0xd0fa('0x3')]||'';this[_0xd0fa('0x4')]=_0x4aff05[_0xd0fa('0x4')]||'';this['consumerKey']=_0x4aff05[_0xd0fa('0x5')]||'';this[_0xd0fa('0x6')]=_0x4aff05[_0xd0fa('0x6')]||'';this[_0xd0fa('0x7')]=_0x4aff05[_0xd0fa('0x7')]||'';this['tokenSecret']=_0x4aff05[_0xd0fa('0x8')]||'';this[_0xd0fa('0x9')]=_0x4aff05[_0xd0fa('0x9')]||'';this[_0xd0fa('0xa')]=_0x4aff05[_0xd0fa('0xa')]||'';this[_0xd0fa('0xb')]=_0x4aff05[_0xd0fa('0xb')]||{};}module[_0xd0fa('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 b4a73b1..9be8a0f 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 _0xbaf0=['Configurations','name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl'];(function(_0x23e1ec,_0x475540){var _0x4002b0=function(_0x505781){while(--_0x505781){_0x23e1ec['push'](_0x23e1ec['shift']());}};_0x4002b0(++_0x475540);}(_0xbaf0,0x12a));var _0x0baf=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xbaf0[_0x465028];return _0xb783d4;};'use strict';function Dynamics365Account(_0x61caa9){this['id']=_0x61caa9['id']||0x0;this[_0x0baf('0x0')]=_0x61caa9[_0x0baf('0x0')]||'';this[_0x0baf('0x1')]=_0x61caa9[_0x0baf('0x1')]||'';this[_0x0baf('0x2')]=_0x61caa9[_0x0baf('0x2')]||'';this['remoteUri']=_0x61caa9[_0x0baf('0x3')]||'';this[_0x0baf('0x4')]=_0x61caa9[_0x0baf('0x4')]||'';this[_0x0baf('0x5')]=_0x61caa9[_0x0baf('0x5')]||'';this[_0x0baf('0x6')]=_0x61caa9[_0x0baf('0x6')]||{};this[_0x0baf('0x7')]=_0x61caa9[_0x0baf('0x7')]||'';this['Configurations']=_0x61caa9[_0x0baf('0x8')]||{};}module['exports']=Dynamics365Account; \ No newline at end of file +var _0x6324=['password','remoteUri','tenantId','clientId','clientSecret','serverUrl','Configurations','name','username'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x6324,0x142));var _0x4632=function(_0x4a705c,_0x5196c3){_0x4a705c=_0x4a705c-0x0;var _0x3e1195=_0x6324[_0x4a705c];return _0x3e1195;};'use strict';function Dynamics365Account(_0x3396c7){this['id']=_0x3396c7['id']||0x0;this[_0x4632('0x0')]=_0x3396c7[_0x4632('0x0')]||'';this[_0x4632('0x1')]=_0x3396c7['username']||'';this[_0x4632('0x2')]=_0x3396c7['password']||'';this[_0x4632('0x3')]=_0x3396c7['remoteUri']||'';this[_0x4632('0x4')]=_0x3396c7['tenantId']||'';this[_0x4632('0x5')]=_0x3396c7[_0x4632('0x5')]||'';this[_0x4632('0x6')]=_0x3396c7[_0x4632('0x6')]||{};this['serverUrl']=_0x3396c7[_0x4632('0x7')]||'';this[_0x4632('0x8')]=_0x3396c7[_0x4632('0x8')]||{};}module['exports']=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index dca8dc0..cf9b3f8 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 _0x0137=['headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','exports','name','description','ecm'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x0137,0x162));var _0x7013=function(_0x9ec1a9,_0x5f2e98){_0x9ec1a9=_0x9ec1a9-0x0;var _0x2eba69=_0x0137[_0x9ec1a9];return _0x2eba69;};'use strict';function FaxAccount(_0x1887b6){this['id']=_0x1887b6['id']||0x0;this[_0x7013('0x0')]=_0x1887b6[_0x7013('0x0')]||'';this[_0x7013('0x1')]=_0x1887b6[_0x7013('0x1')];this[_0x7013('0x2')]=_0x1887b6[_0x7013('0x2')];this[_0x7013('0x3')]=_0x1887b6[_0x7013('0x3')];this[_0x7013('0x4')]=_0x1887b6[_0x7013('0x4')];this[_0x7013('0x5')]=_0x1887b6['minrate']||0x960;this[_0x7013('0x6')]=_0x1887b6['maxrate']||0x3840;this[_0x7013('0x7')]=_0x1887b6[_0x7013('0x7')]||_0x7013('0x8');this['gateway']=_0x1887b6['gateway']||'no';this[_0x7013('0x9')]=_0x1887b6[_0x7013('0x9')]||'no';this['t38timeout']=_0x1887b6[_0x7013('0xa')]||0x1388;this['tech']=_0x1887b6[_0x7013('0xb')]||_0x7013('0xc');this[_0x7013('0xd')]=_0x1887b6[_0x7013('0xd')]?_0x1887b6[_0x7013('0xd')]:undefined;this[_0x7013('0xe')]=_0x1887b6['ListId'];this[_0x7013('0xf')]=_0x1887b6['key'];}module[_0x7013('0x10')]=FaxAccount; \ No newline at end of file +var _0x56b9=['key','exports','name','description','ecm','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId'];(function(_0xaad4cb,_0x4b0df9){var _0x155aff=function(_0x3d8703){while(--_0x3d8703){_0xaad4cb['push'](_0xaad4cb['shift']());}};_0x155aff(++_0x4b0df9);}(_0x56b9,0x1de));var _0x956b=function(_0x571f36,_0x58551e){_0x571f36=_0x571f36-0x0;var _0x12724f=_0x56b9[_0x571f36];return _0x12724f;};'use strict';function FaxAccount(_0x372111){this['id']=_0x372111['id']||0x0;this[_0x956b('0x0')]=_0x372111[_0x956b('0x0')]||'';this[_0x956b('0x1')]=_0x372111[_0x956b('0x1')];this[_0x956b('0x2')]=_0x372111['ecm'];this['headerinfo']=_0x372111['headerinfo'];this[_0x956b('0x3')]=_0x372111[_0x956b('0x3')];this['minrate']=_0x372111[_0x956b('0x4')]||0x960;this[_0x956b('0x5')]=_0x372111[_0x956b('0x5')]||0x3840;this[_0x956b('0x6')]=_0x372111[_0x956b('0x6')]||_0x956b('0x7');this[_0x956b('0x8')]=_0x372111[_0x956b('0x8')]||'no';this[_0x956b('0x9')]=_0x372111[_0x956b('0x9')]||'no';this[_0x956b('0xa')]=_0x372111[_0x956b('0xa')]||0x1388;this[_0x956b('0xb')]=_0x372111['tech']||_0x956b('0xc');this['Trunk']=_0x372111['Trunk']?_0x372111[_0x956b('0xd')]:undefined;this[_0x956b('0xe')]=_0x372111[_0x956b('0xe')];this[_0x956b('0xf')]=_0x372111[_0x956b('0xf')];}module[_0x956b('0x10')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index c33f08b..1771f13 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 _0xa109=['username','apiKey','token','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x37a591,_0x241d96){var _0x40f911=function(_0x33437a){while(--_0x33437a){_0x37a591['push'](_0x37a591['shift']());}};_0x40f911(++_0x241d96);}(_0xa109,0xd7));var _0x9a10=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xa109[_0x126558];return _0x1f6d14;};'use strict';function FreshdeskAccount(_0x2a3b0d){this['id']=_0x2a3b0d['id']||0x0;this[_0x9a10('0x0')]=_0x2a3b0d[_0x9a10('0x0')]||'';this['username']=_0x2a3b0d[_0x9a10('0x1')]||'';this[_0x9a10('0x2')]=_0x2a3b0d[_0x9a10('0x3')]||'';this[_0x9a10('0x4')]=_0x2a3b0d[_0x9a10('0x4')]||'';this[_0x9a10('0x5')]=_0x2a3b0d['serverUrl']||'';this['Configurations']=_0x2a3b0d[_0x9a10('0x6')]||{};}module[_0x9a10('0x7')]=FreshdeskAccount; \ No newline at end of file +var _0x018a=['token','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x568bd6,_0x3f9922){var _0x41835e=function(_0x995ae9){while(--_0x995ae9){_0x568bd6['push'](_0x568bd6['shift']());}};_0x41835e(++_0x3f9922);}(_0x018a,0xd0));var _0xa018=function(_0x350396,_0x391ad2){_0x350396=_0x350396-0x0;var _0xf306b1=_0x018a[_0x350396];return _0xf306b1;};'use strict';function FreshdeskAccount(_0x43f38e){this['id']=_0x43f38e['id']||0x0;this[_0xa018('0x0')]=_0x43f38e[_0xa018('0x0')]||'';this[_0xa018('0x1')]=_0x43f38e['username']||'';this['apiKey']=_0x43f38e[_0xa018('0x2')]||'';this[_0xa018('0x3')]=_0x43f38e[_0xa018('0x3')]||'';this[_0xa018('0x4')]=_0x43f38e[_0xa018('0x4')]||'';this['Configurations']=_0x43f38e[_0xa018('0x5')]||{};}module[_0xa018('0x6')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 3eea266..667a39b 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 _0x522b=['serverUrl','Configurations','exports','name','username','token','remoteUri'];(function(_0x1fbde3,_0x59da39){var _0x2b092f=function(_0x18bd24){while(--_0x18bd24){_0x1fbde3['push'](_0x1fbde3['shift']());}};_0x2b092f(++_0x59da39);}(_0x522b,0x1c3));var _0xb522=function(_0x4e1a49,_0x4da738){_0x4e1a49=_0x4e1a49-0x0;var _0x136aae=_0x522b[_0x4e1a49];return _0x136aae;};'use strict';function FreshsalesAccount(_0x5dc096){this['id']=_0x5dc096['id']||0x0;this[_0xb522('0x0')]=_0x5dc096['name']||'';this[_0xb522('0x1')]=_0x5dc096['username']||'';this['apiKey']=_0x5dc096[_0xb522('0x2')]||'';this[_0xb522('0x3')]=_0x5dc096['remoteUri']||'';this[_0xb522('0x4')]=_0x5dc096[_0xb522('0x4')]||'';this[_0xb522('0x5')]=_0x5dc096[_0xb522('0x5')]||{};}module[_0xb522('0x6')]=FreshsalesAccount; \ No newline at end of file +var _0x647c=['serverUrl','Configurations','exports','name','username','apiKey','token','remoteUri'];(function(_0x54b9c6,_0x2c697e){var _0x251824=function(_0x269f7c){while(--_0x269f7c){_0x54b9c6['push'](_0x54b9c6['shift']());}};_0x251824(++_0x2c697e);}(_0x647c,0x1d3));var _0xc647=function(_0x469f97,_0x1d2bd0){_0x469f97=_0x469f97-0x0;var _0x557d30=_0x647c[_0x469f97];return _0x557d30;};'use strict';function FreshsalesAccount(_0x473a5d){this['id']=_0x473a5d['id']||0x0;this['name']=_0x473a5d[_0xc647('0x0')]||'';this[_0xc647('0x1')]=_0x473a5d['username']||'';this[_0xc647('0x2')]=_0x473a5d[_0xc647('0x3')]||'';this[_0xc647('0x4')]=_0x473a5d[_0xc647('0x4')]||'';this[_0xc647('0x5')]=_0x473a5d['serverUrl']||'';this[_0xc647('0x6')]=_0x473a5d[_0xc647('0x6')]||{};}module[_0xc647('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 fb473bc..6345432 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 _0x866e=['exports','type','inbound','uniqueid','calleridnum','queue','queuecallerjoinAt','queuecallerleaveAt','position','queuecallerabandon','queuecallerexitAt','originalposition','channel','connectedlinenum','accountcode','context','exten','priority','holdtime','assigned','lastAssignedTo','motionChannel','voice','variables'];(function(_0x11c8cd,_0x3ecada){var _0xe65263=function(_0x306c69){while(--_0x306c69){_0x11c8cd['push'](_0x11c8cd['shift']());}};_0xe65263(++_0x3ecada);}(_0x866e,0x151));var _0xe866=function(_0xb4fe59,_0x34508e){_0xb4fe59=_0xb4fe59-0x0;var _0x525151=_0x866e[_0xb4fe59];return _0x525151;};'use strict';function QueueReport(){this[_0xe866('0x0')]=_0xe866('0x1');this[_0xe866('0x2')]='';this[_0xe866('0x3')]='';this['calleridname']='';this[_0xe866('0x4')]='';this[_0xe866('0x5')]=null;this[_0xe866('0x6')]=null;this[_0xe866('0x7')]=0x1;this['count']=0x1;this[_0xe866('0x8')]=![];this['queuecallerabandonAt']=null;this['queuecallercomplete']=![];this['queuecallercompleteAt']=null;this['queuecallerexit']=![];this[_0xe866('0x9')]=null;this[_0xe866('0xa')]=0x1;this[_0xe866('0xb')]='';this[_0xe866('0xc')]='';this['connectedlinename']='';this[_0xe866('0xd')]='';this[_0xe866('0xe')]='';this[_0xe866('0xf')]='';this[_0xe866('0x10')]='';this[_0xe866('0x11')]=0x0;this[_0xe866('0x12')]=![];this[_0xe866('0x13')]='';this[_0xe866('0x14')]=_0xe866('0x15');this['mohtime']=0x0;this[_0xe866('0x16')]={};}module[_0xe866('0x17')]=QueueReport; \ No newline at end of file +var _0x6e75=['context','exten','priority','holdtime','assigned','lastAssignedTo','motionChannel','voice','mohtime','variables','uniqueid','calleridnum','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinenum','connectedlinename','accountcode'];(function(_0x13e270,_0x68a9d0){var _0x54c1b1=function(_0x3e4a77){while(--_0x3e4a77){_0x13e270['push'](_0x13e270['shift']());}};_0x54c1b1(++_0x68a9d0);}(_0x6e75,0xac));var _0x56e7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6e75[_0x3dd15e];return _0x231fd0;};'use strict';function QueueReport(){this['type']='inbound';this[_0x56e7('0x0')]='';this[_0x56e7('0x1')]='';this['calleridname']='';this['queue']='';this[_0x56e7('0x2')]=null;this[_0x56e7('0x3')]=null;this[_0x56e7('0x4')]=0x1;this[_0x56e7('0x5')]=0x1;this[_0x56e7('0x6')]=![];this[_0x56e7('0x7')]=null;this[_0x56e7('0x8')]=![];this[_0x56e7('0x9')]=null;this[_0x56e7('0xa')]=![];this[_0x56e7('0xb')]=null;this[_0x56e7('0xc')]=0x1;this[_0x56e7('0xd')]='';this[_0x56e7('0xe')]='';this[_0x56e7('0xf')]='';this[_0x56e7('0x10')]='';this[_0x56e7('0x11')]='';this[_0x56e7('0x12')]='';this[_0x56e7('0x13')]='';this[_0x56e7('0x14')]=0x0;this[_0x56e7('0x15')]=![];this[_0x56e7('0x16')]='';this[_0x56e7('0x17')]=_0x56e7('0x18');this[_0x56e7('0x19')]=0x0;this[_0x56e7('0x1a')]={};}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 7149b7b..44dcf5e 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 _0x2243=['clientId','clientSecret','securityToken','type','serverUrl','Configurations','exports','name','username','remoteUri','password'];(function(_0x2c4c89,_0x49b9b1){var _0x25ff39=function(_0x4b2b0f){while(--_0x4b2b0f){_0x2c4c89['push'](_0x2c4c89['shift']());}};_0x25ff39(++_0x49b9b1);}(_0x2243,0x13b));var _0x3224=function(_0x4f116f,_0x52ab56){_0x4f116f=_0x4f116f-0x0;var _0x35599e=_0x2243[_0x4f116f];return _0x35599e;};'use strict';function SalesforceAccount(_0x3840cd){this['id']=_0x3840cd['id']||0x0;this[_0x3224('0x0')]=_0x3840cd[_0x3224('0x0')]||'';this[_0x3224('0x1')]=_0x3840cd[_0x3224('0x1')]||'';this[_0x3224('0x2')]=_0x3840cd[_0x3224('0x2')]||'';this[_0x3224('0x3')]=_0x3840cd[_0x3224('0x3')]||'';this[_0x3224('0x4')]=_0x3840cd[_0x3224('0x4')]||'';this[_0x3224('0x5')]=_0x3840cd[_0x3224('0x5')]||'';this['securityToken']=_0x3840cd[_0x3224('0x6')]||'';this[_0x3224('0x7')]=_0x3840cd[_0x3224('0x7')]||'integrationTab';this[_0x3224('0x8')]=_0x3840cd['serverUrl']||'';this['Configurations']=_0x3840cd[_0x3224('0x9')]||{};}module[_0x3224('0xa')]=SalesforceAccount; \ No newline at end of file +var _0x07c3=['remoteUri','password','clientId','clientSecret','securityToken','serverUrl','Configurations','exports','username'];(function(_0x388b47,_0x5cdac5){var _0x4859df=function(_0x466a16){while(--_0x466a16){_0x388b47['push'](_0x388b47['shift']());}};_0x4859df(++_0x5cdac5);}(_0x07c3,0xe0));var _0x307c=function(_0x49ebed,_0x2ed245){_0x49ebed=_0x49ebed-0x0;var _0x247194=_0x07c3[_0x49ebed];return _0x247194;};'use strict';function SalesforceAccount(_0x1b45d7){this['id']=_0x1b45d7['id']||0x0;this['name']=_0x1b45d7['name']||'';this[_0x307c('0x0')]=_0x1b45d7[_0x307c('0x0')]||'';this[_0x307c('0x1')]=_0x1b45d7['remoteUri']||'';this[_0x307c('0x2')]=_0x1b45d7[_0x307c('0x2')]||'';this[_0x307c('0x3')]=_0x1b45d7['clientId']||'';this[_0x307c('0x4')]=_0x1b45d7[_0x307c('0x4')]||'';this['securityToken']=_0x1b45d7[_0x307c('0x5')]||'';this['type']=_0x1b45d7['type']||'integrationTab';this['serverUrl']=_0x1b45d7[_0x307c('0x6')]||'';this[_0x307c('0x7')]=_0x1b45d7['Configurations']||{};}module[_0x307c('0x8')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 1850b74..cd84494 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 _0xafe0=['password','remoteUri','serverUrl','Configurations','name','username'];(function(_0x1761f0,_0x27fe8b){var _0x371d9f=function(_0x4b1a4e){while(--_0x4b1a4e){_0x1761f0['push'](_0x1761f0['shift']());}};_0x371d9f(++_0x27fe8b);}(_0xafe0,0x13c));var _0x0afe=function(_0x3f2647,_0x4447ac){_0x3f2647=_0x3f2647-0x0;var _0xbd8415=_0xafe0[_0x3f2647];return _0xbd8415;};'use strict';function ServicenowAccount(_0xa95914){this['id']=_0xa95914['id']||0x0;this['name']=_0xa95914[_0x0afe('0x0')]||'';this['username']=_0xa95914[_0x0afe('0x1')]||'';this[_0x0afe('0x2')]=_0xa95914[_0x0afe('0x2')]||'';this[_0x0afe('0x3')]=_0xa95914['remoteUri']||'';this['serverUrl']=_0xa95914[_0x0afe('0x4')]||'';this[_0x0afe('0x5')]=_0xa95914[_0x0afe('0x5')]||{};}module['exports']=ServicenowAccount; \ No newline at end of file +var _0x4196=['Configurations','name','username','password','remoteUri','serverUrl'];(function(_0x2e6887,_0x29bdeb){var _0x88d762=function(_0x1e2784){while(--_0x1e2784){_0x2e6887['push'](_0x2e6887['shift']());}};_0x88d762(++_0x29bdeb);}(_0x4196,0x67));var _0x6419=function(_0x165d37,_0x39b2b3){_0x165d37=_0x165d37-0x0;var _0x4bf427=_0x4196[_0x165d37];return _0x4bf427;};'use strict';function ServicenowAccount(_0x3a6ad4){this['id']=_0x3a6ad4['id']||0x0;this[_0x6419('0x0')]=_0x3a6ad4[_0x6419('0x0')]||'';this[_0x6419('0x1')]=_0x3a6ad4[_0x6419('0x1')]||'';this[_0x6419('0x2')]=_0x3a6ad4[_0x6419('0x2')]||'';this[_0x6419('0x3')]=_0x3a6ad4[_0x6419('0x3')]||'';this['serverUrl']=_0x3a6ad4[_0x6419('0x4')]||'';this['Configurations']=_0x3a6ad4[_0x6419('0x5')]||{};}module['exports']=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 9674758..ab7823a 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 _0x32f1=['serverUrl','Configurations','exports','name','username','password','remoteUri'];(function(_0x24eeed,_0x51c3cc){var _0x33c864=function(_0x3330f0){while(--_0x3330f0){_0x24eeed['push'](_0x24eeed['shift']());}};_0x33c864(++_0x51c3cc);}(_0x32f1,0xc0));var _0x132f=function(_0x11a4cf,_0x58226e){_0x11a4cf=_0x11a4cf-0x0;var _0x331e05=_0x32f1[_0x11a4cf];return _0x331e05;};'use strict';function SugarcrmAccount(_0x29f230){this['id']=_0x29f230['id']||0x0;this['name']=_0x29f230[_0x132f('0x0')]||'';this['username']=_0x29f230[_0x132f('0x1')]||'';this[_0x132f('0x2')]=_0x29f230[_0x132f('0x2')]||'';this[_0x132f('0x3')]=_0x29f230[_0x132f('0x3')]||'';this[_0x132f('0x4')]=_0x29f230[_0x132f('0x4')]||'';this[_0x132f('0x5')]=_0x29f230['Configurations']||{};}module[_0x132f('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0x9da1=['name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x261522,_0x1adc1f){var _0x98a25a=function(_0x1b0f9c){while(--_0x1b0f9c){_0x261522['push'](_0x261522['shift']());}};_0x98a25a(++_0x1adc1f);}(_0x9da1,0x1a4));var _0x19da=function(_0x3f7101,_0x3af08b){_0x3f7101=_0x3f7101-0x0;var _0x1a30a0=_0x9da1[_0x3f7101];return _0x1a30a0;};'use strict';function SugarcrmAccount(_0x52078e){this['id']=_0x52078e['id']||0x0;this[_0x19da('0x0')]=_0x52078e[_0x19da('0x0')]||'';this[_0x19da('0x1')]=_0x52078e['username']||'';this['password']=_0x52078e[_0x19da('0x2')]||'';this[_0x19da('0x3')]=_0x52078e[_0x19da('0x3')]||'';this[_0x19da('0x4')]=_0x52078e['serverUrl']||'';this['Configurations']=_0x52078e[_0x19da('0x5')]||{};}module['exports']=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 04da560..0312af6 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 _0x105f=['state','stateTime','status','unknown','address','name'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0x105f,0x71));var _0xf105=function(_0x25f69b,_0x1b5fe3){_0x25f69b=_0x25f69b-0x0;var _0x1baaf5=_0x105f[_0x25f69b];return _0x1baaf5;};'use strict';function Telephone(_0x3fe1fe){this['id']=_0x3fe1fe['id']||0x0;this[_0xf105('0x0')]=_0x3fe1fe['name']||'';this['accountcode']=_0x3fe1fe['accountcode']||'';this[_0xf105('0x1')]='unknown';this[_0xf105('0x2')]=0x0;this[_0xf105('0x3')]=_0xf105('0x4');this[_0xf105('0x5')]='';}module['exports']=Telephone; \ No newline at end of file +var _0x205c=['unknown','address','name','accountcode','state','status'];(function(_0x8e60b7,_0x1a9839){var _0x2be1dc=function(_0x379509){while(--_0x379509){_0x8e60b7['push'](_0x8e60b7['shift']());}};_0x2be1dc(++_0x1a9839);}(_0x205c,0x122));var _0xc205=function(_0x2fc012,_0x503e5b){_0x2fc012=_0x2fc012-0x0;var _0x2891f9=_0x205c[_0x2fc012];return _0x2891f9;};'use strict';function Telephone(_0x2b8bcb){this['id']=_0x2b8bcb['id']||0x0;this['name']=_0x2b8bcb[_0xc205('0x0')]||'';this[_0xc205('0x1')]=_0x2b8bcb[_0xc205('0x1')]||'';this[_0xc205('0x2')]='unknown';this['stateTime']=0x0;this[_0xc205('0x3')]=_0xc205('0x4');this[_0xc205('0x5')]='';}module['exports']=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 4362ae3..27e3943 100644 --- a/server/services/ami/model/template.js +++ b/server/services/ami/model/template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['exports','name'];(function(_0x3d486e,_0x190d81){var _0x59f2c2=function(_0x391a46){while(--_0x391a46){_0x3d486e['push'](_0x3d486e['shift']());}};_0x59f2c2(++_0x190d81);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xa9e0[_0x5037ab];return _0x512adb;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file +var _0xb10b=['name','html'];(function(_0x2cd5b3,_0x135214){var _0x2f591e=function(_0x24df55){while(--_0x24df55){_0x2cd5b3['push'](_0x2cd5b3['shift']());}};_0x2f591e(++_0x135214);}(_0xb10b,0x12a));var _0xbb10=function(_0x2adb04,_0x4d4356){_0x2adb04=_0x2adb04-0x0;var _0x3c1bca=_0xb10b[_0x2adb04];return _0x3c1bca;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 27dfff6..9bc661c 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 _0x5f66=['AllConditions','AnyConditions','Actions','name','channel','voice','status'];(function(_0x3aaf0a,_0x450970){var _0x33e6bc=function(_0x1db54d){while(--_0x1db54d){_0x3aaf0a['push'](_0x3aaf0a['shift']());}};_0x33e6bc(++_0x450970);}(_0x5f66,0x1a0));var _0x65f6=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x5f66[_0x4243a3];return _0x1b2a33;};'use strict';function Trigger(_0x253044){this['id']=_0x253044['id']||0x0;this[_0x65f6('0x0')]=_0x253044['name']||'';this[_0x65f6('0x1')]=_0x253044[_0x65f6('0x1')]||_0x65f6('0x2');this[_0x65f6('0x3')]=_0x253044[_0x65f6('0x3')]||![];this['AllConditions']=_0x253044[_0x65f6('0x4')]||[];this['AnyConditions']=_0x253044[_0x65f6('0x5')]||[];this[_0x65f6('0x6')]=_0x253044['Actions']||[];}module['exports']=Trigger; \ No newline at end of file +var _0x1a85=['status','AllConditions','AnyConditions','Actions','name','channel'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x1a85,0x178));var _0x51a8=function(_0x5f519b,_0x5b606f){_0x5f519b=_0x5f519b-0x0;var _0x2461e2=_0x1a85[_0x5f519b];return _0x2461e2;};'use strict';function Trigger(_0x4570ac){this['id']=_0x4570ac['id']||0x0;this['name']=_0x4570ac[_0x51a8('0x0')]||'';this[_0x51a8('0x1')]=_0x4570ac[_0x51a8('0x1')]||'voice';this['status']=_0x4570ac[_0x51a8('0x2')]||![];this[_0x51a8('0x3')]=_0x4570ac[_0x51a8('0x3')]||[];this['AnyConditions']=_0x4570ac[_0x51a8('0x4')]||[];this['Actions']=_0x4570ac[_0x51a8('0x5')]||[];}module['exports']=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 19324e9..8590dc1 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 _0xedcf=['registry','split','domain','domainport','stateRegistry','registrationtime','address','defaultuser','active','name','state','stateTime'];(function(_0x239fd1,_0x263a2a){var _0x58e0e6=function(_0x115224){while(--_0x115224){_0x239fd1['push'](_0x239fd1['shift']());}};_0x58e0e6(++_0x263a2a);}(_0xedcf,0x128));var _0xfedc=function(_0x29cd30,_0x136b4b){_0x29cd30=_0x29cd30-0x0;var _0x6fe1d0=_0xedcf[_0x29cd30];return _0x6fe1d0;};'use strict';function Trunk(_0x553aeb){this['id']=_0x553aeb['id']||0x0;this[_0xfedc('0x0')]=_0x553aeb[_0xfedc('0x0')]||![];this['name']=_0x553aeb[_0xfedc('0x1')]||'';this[_0xfedc('0x2')]='unknown';this[_0xfedc('0x3')]=0x0;this['status']='unknown';this[_0xfedc('0x4')]=_0x553aeb[_0xfedc('0x4')]&&_0x553aeb[_0xfedc('0x4')]['indexOf'](':')?_0x553aeb[_0xfedc('0x4')][_0xfedc('0x5')](':')[0x0]:'';this['host']='';this['port']='';this[_0xfedc('0x6')]='';this[_0xfedc('0x7')]='';this['refresh']='';this[_0xfedc('0x8')]='unknown';this[_0xfedc('0x9')]='';this[_0xfedc('0xa')]='';this[_0xfedc('0xb')]=_0x553aeb['defaultuser']||'';}module['exports']=Trunk; \ No newline at end of file +var _0x2c0e=['host','port','domain','domainport','refresh','stateRegistry','registrationtime','address','defaultuser','exports','active','name','state','stateTime','status','unknown','registry','indexOf','split'];(function(_0x6ba1a4,_0x184e8b){var _0x200ce6=function(_0x3017aa){while(--_0x3017aa){_0x6ba1a4['push'](_0x6ba1a4['shift']());}};_0x200ce6(++_0x184e8b);}(_0x2c0e,0xdb));var _0xe2c0=function(_0x132399,_0x1c4b0f){_0x132399=_0x132399-0x0;var _0x2a27e9=_0x2c0e[_0x132399];return _0x2a27e9;};'use strict';function Trunk(_0x36040f){this['id']=_0x36040f['id']||0x0;this[_0xe2c0('0x0')]=_0x36040f[_0xe2c0('0x0')]||![];this['name']=_0x36040f[_0xe2c0('0x1')]||'';this[_0xe2c0('0x2')]='unknown';this[_0xe2c0('0x3')]=0x0;this[_0xe2c0('0x4')]=_0xe2c0('0x5');this[_0xe2c0('0x6')]=_0x36040f[_0xe2c0('0x6')]&&_0x36040f[_0xe2c0('0x6')][_0xe2c0('0x7')](':')?_0x36040f[_0xe2c0('0x6')][_0xe2c0('0x8')](':')[0x0]:'';this[_0xe2c0('0x9')]='';this[_0xe2c0('0xa')]='';this[_0xe2c0('0xb')]='';this[_0xe2c0('0xc')]='';this[_0xe2c0('0xd')]='';this[_0xe2c0('0xe')]=_0xe2c0('0x5');this[_0xe2c0('0xf')]='';this[_0xe2c0('0x10')]='';this[_0xe2c0('0x11')]=_0x36040f[_0xe2c0('0x11')]||'';}module[_0xe2c0('0x12')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 05d026f..6edded3 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 _0x1a15=['mandatoryDisposition','exports','exten','recordingFormat','none'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1a15,0x1d3));var _0x51a1=function(_0x423a5f,_0x4f3d2b){_0x423a5f=_0x423a5f-0x0;var _0x38825a=_0x1a15[_0x423a5f];return _0x38825a;};'use strict';function voiceExtension(_0x203280){this['id']=_0x203280['id']||0x0;this[_0x51a1('0x0')]=_0x203280[_0x51a1('0x0')]||'';this[_0x51a1('0x1')]=_0x203280[_0x51a1('0x1')]||_0x51a1('0x2');this[_0x51a1('0x3')]=_0x203280['mandatoryDisposition']||![];}module[_0x51a1('0x4')]=voiceExtension; \ No newline at end of file +var _0x7a65=['recordingFormat','none','mandatoryDisposition','exports','exten'];(function(_0x397843,_0xa7173e){var _0x2ba028=function(_0x243ab4){while(--_0x243ab4){_0x397843['push'](_0x397843['shift']());}};_0x2ba028(++_0xa7173e);}(_0x7a65,0x185));var _0x57a6=function(_0x5431b9,_0x302558){_0x5431b9=_0x5431b9-0x0;var _0x4c2f3f=_0x7a65[_0x5431b9];return _0x4c2f3f;};'use strict';function voiceExtension(_0x5d01ae){this['id']=_0x5d01ae['id']||0x0;this[_0x57a6('0x0')]=_0x5d01ae[_0x57a6('0x0')]||'';this['recordingFormat']=_0x5d01ae[_0x57a6('0x1')]||_0x57a6('0x2');this[_0x57a6('0x3')]=_0x5d01ae['mandatoryDisposition']||![];}module[_0x57a6('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 fca7461..6183488 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 _0x6d56=['dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundReCallsDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgTalktime','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','inuse','busy','invalid','unavailable','ringinuse','onhold','wav','gsm','rrmemory','name','monitor_format','type','waiting','total','answered','sumDuration','sumHoldTime','sumBillable','abandoned','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry'];(function(_0x286889,_0x333b6b){var _0x8b6d2d=function(_0x494813){while(--_0x494813){_0x286889['push'](_0x286889['shift']());}};_0x8b6d2d(++_0x333b6b);}(_0x6d56,0xbd));var _0x66d5=function(_0xa369d8,_0x3a1c1b){_0xa369d8=_0xa369d8-0x0;var _0x324e51=_0x6d56[_0xa369d8];return _0x324e51;};'use strict';var statusDesc=[_0x66d5('0x0'),'not_inuse',_0x66d5('0x1'),_0x66d5('0x2'),_0x66d5('0x3'),_0x66d5('0x4'),'ringing',_0x66d5('0x5'),_0x66d5('0x6')];var monitorFormat={'wav':_0x66d5('0x7'),'wav49':'wav49','gsm':_0x66d5('0x8')};var strategy={'rrmemory':_0x66d5('0x9'),'roundrobin':'roundrobin'};function VoiceQueue(_0x5cfce0){this['id']=_0x5cfce0['id']||0x0;this[_0x66d5('0xa')]=_0x5cfce0[_0x66d5('0xa')]||'';this[_0x66d5('0xb')]=_0x5cfce0['monitor_format']||'';this['type']=_0x5cfce0[_0x66d5('0xc')]||'inbound';this[_0x66d5('0xd')]=0x0;this['talking']=0x0;this[_0x66d5('0xe')]=0x0;this[_0x66d5('0xf')]=0x0;this[_0x66d5('0x10')]=0x0;this[_0x66d5('0x11')]=0x0;this[_0x66d5('0x12')]=0x0;this['unmanaged']=0x0;this[_0x66d5('0x13')]=0x0;this[_0x66d5('0x14')]=0x0;this[_0x66d5('0x15')]=0x0;this[_0x66d5('0x16')]=_0x5cfce0['acw']||![];this['acwTimeout']=_0x5cfce0[_0x66d5('0x17')]||0xa;this[_0x66d5('0x18')]=_0x5cfce0[_0x66d5('0x18')]||'no';this[_0x66d5('0x19')]=!![];this[_0x66d5('0x1a')]='';this[_0x66d5('0x1b')]=0x0;this[_0x66d5('0x1c')]=0x0;this[_0x66d5('0x1d')]=_0x5cfce0['dialTimezone']||null;this[_0x66d5('0x1e')]=_0x5cfce0[_0x66d5('0x1e')]?_0x5cfce0['dialGlobalInterval']:null;this[_0x66d5('0x1f')]=_0x5cfce0['dialActive'];this[_0x66d5('0x20')]=_0x5cfce0[_0x66d5('0x20')]||_0x66d5('0x21');this[_0x66d5('0x22')]=_0x5cfce0[_0x66d5('0x22')]||0x0;this[_0x66d5('0x23')]=_0x5cfce0['dialLimitQueue']||0x0;this['dialPowerLevel']=_0x5cfce0['dialPowerLevel']||0x1;this[_0x66d5('0x24')]=_0x5cfce0[_0x66d5('0x24')]||_0x66d5('0x25');this[_0x66d5('0x26')]=_0x5cfce0[_0x66d5('0x26')]||0.03;this[_0x66d5('0x27')]=_0x5cfce0[_0x66d5('0x27')]||0x258;this[_0x66d5('0x28')]=_0x5cfce0['dialOriginateCallerIdName']||_0x66d5('0x29');this['dialOriginateCallerIdNumber']=_0x5cfce0[_0x66d5('0x2a')]||_0x66d5('0x29');this[_0x66d5('0x2b')]=_0x5cfce0[_0x66d5('0x2b')]||0x1e;this[_0x66d5('0x2c')]=_0x5cfce0[_0x66d5('0x2c')]||_0x66d5('0x2d');this['dialQueueTimeout']=_0x5cfce0[_0x66d5('0x2e')]||0x3;this[_0x66d5('0x2f')]=_0x5cfce0['dialQueueProject']||undefined;this['dialCongestionMaxRetry']=_0x5cfce0[_0x66d5('0x30')]||0x3;this['dialCongestionRetryFrequency']=_0x5cfce0[_0x66d5('0x31')]||0x96;this[_0x66d5('0x32')]=_0x5cfce0['dialBusyMaxRetry']||0x3;this['dialBusyRetryFrequency']=_0x5cfce0[_0x66d5('0x33')]||0x96;this[_0x66d5('0x34')]=_0x5cfce0[_0x66d5('0x34')]||0x3;this[_0x66d5('0x35')]=_0x5cfce0[_0x66d5('0x35')]||0x96;this[_0x66d5('0x36')]=_0x5cfce0['dialNoSuchNumberMaxRetry']||0x3;this[_0x66d5('0x37')]=_0x5cfce0[_0x66d5('0x37')]||0x96;this[_0x66d5('0x38')]=_0x5cfce0[_0x66d5('0x38')]||0x3;this[_0x66d5('0x39')]=_0x5cfce0['dialDropRetryFrequency']||0x96;this[_0x66d5('0x3a')]=_0x5cfce0[_0x66d5('0x3a')]||0x3;this[_0x66d5('0x3b')]=_0x5cfce0['dialAbandonedRetryFrequency']||0x96;this['dialMachineMaxRetry']=_0x5cfce0['dialMachineMaxRetry']||0x3;this[_0x66d5('0x3c')]=_0x5cfce0[_0x66d5('0x3c')]||0x96;this['dialAgentRejectMaxRetry']=_0x5cfce0[_0x66d5('0x3d')]||0x3;this['dialAgentRejectRetryFrequency']=_0x5cfce0[_0x66d5('0x3e')]||0x96;this[_0x66d5('0x3f')]=_0x5cfce0[_0x66d5('0x3f')]||0x4;this[_0x66d5('0x40')]=_0x5cfce0[_0x66d5('0x40')]?_0x5cfce0[_0x66d5('0x40')]:undefined;this[_0x66d5('0x41')]=_0x5cfce0[_0x66d5('0x41')]?_0x5cfce0[_0x66d5('0x41')]:undefined;this[_0x66d5('0x42')]=_0x5cfce0[_0x66d5('0x42')]||undefined;this[_0x66d5('0x43')]=_0x5cfce0[_0x66d5('0x43')]?_0x5cfce0[_0x66d5('0x43')]:undefined;this[_0x66d5('0x44')]=_0x5cfce0[_0x66d5('0x44')]||_0x66d5('0x45');this['dialRandomLastDigitCallerIdNumber']=_0x5cfce0[_0x66d5('0x46')]||undefined;this[_0x66d5('0x47')]=_0x5cfce0[_0x66d5('0x47')]||undefined;this['strategy']=strategy[_0x5cfce0[_0x66d5('0x48')]]||_0x66d5('0x9');this[_0x66d5('0x49')]=!![];this['dialAMDActive']=_0x5cfce0[_0x66d5('0x4a')]||![];this[_0x66d5('0x4b')]=_0x5cfce0[_0x66d5('0x4b')];this['dialAMDGreeting']=_0x5cfce0['dialAMDGreeting'];this[_0x66d5('0x4c')]=_0x5cfce0[_0x66d5('0x4c')];this[_0x66d5('0x4d')]=_0x5cfce0[_0x66d5('0x4d')];this[_0x66d5('0x4e')]=_0x5cfce0['dialAMDMinWordLength'];this[_0x66d5('0x4f')]=_0x5cfce0[_0x66d5('0x4f')];this[_0x66d5('0x50')]=_0x5cfce0[_0x66d5('0x50')];this[_0x66d5('0x51')]=_0x5cfce0[_0x66d5('0x51')];this[_0x66d5('0x52')]=_0x5cfce0[_0x66d5('0x52')];this[_0x66d5('0x53')]=0x0;this[_0x66d5('0x54')]=0x0;this[_0x66d5('0x55')]=_0x5cfce0[_0x66d5('0x55')];this[_0x66d5('0x56')]=0x0;this[_0x66d5('0x57')]=0x0;this[_0x66d5('0x58')]=0x0;this[_0x66d5('0x59')]=0x0;this['outboundCongestionCallsDay']=0x0;this[_0x66d5('0x5a')]=0x0;this['outboundUnknownCallsDay']=0x0;this[_0x66d5('0x5b')]=0x0;this[_0x66d5('0x5c')]=0x0;this[_0x66d5('0x5d')]=0x0;this[_0x66d5('0x5e')]=0x0;this['outboundDropCallsDayACS']=0x0;this[_0x66d5('0x5f')]=0x0;this['outboundAbandonedDay']=0x0;this[_0x66d5('0x60')]=undefined;this[_0x66d5('0x61')]=undefined;this[_0x66d5('0x62')]=undefined;this[_0x66d5('0x63')]=1.05;this[_0x66d5('0x64')]=0x0;this[_0x66d5('0x65')]=0x0;this[_0x66d5('0x66')]=0x0;this[_0x66d5('0x67')]=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this[_0x66d5('0x68')]=0x0;this['predictiveIntervalPauses']=0x0;this[_0x66d5('0x69')]=0x0;this[_0x66d5('0x6a')]=_0x5cfce0['dialPredictiveIntervalMaxThreshold']||0x14;this['predictiveIntervalMinThreshold']=_0x5cfce0[_0x66d5('0x6b')]||0xa;this[_0x66d5('0x6c')]=0x0;this[_0x66d5('0x6d')]=0x0;this[_0x66d5('0x6e')]=0x1;this[_0x66d5('0x6f')]=0x0;this[_0x66d5('0x70')]=0x0;this[_0x66d5('0x71')]=0x0;this[_0x66d5('0x72')]=0x0;this[_0x66d5('0x73')]=_0x5cfce0[_0x66d5('0x73')]||0x1e;this[_0x66d5('0x74')]=_0x5cfce0['dialRecallInQueue']||![];this[_0x66d5('0x75')]=!!_0x5cfce0[_0x66d5('0x75')]||![];this['dialQueueProject2']=_0x5cfce0['dialQueueProject2']||undefined;this['dialAgiAfterHangupClient']=_0x5cfce0['dialAgiAfterHangupClient']||![];this[_0x66d5('0x76')]=_0x5cfce0['dialAgiAfterHangupAgent']||![];this[_0x66d5('0xb')]=monitorFormat[_0x5cfce0[_0x66d5('0xb')]]?monitorFormat[_0x5cfce0['monitor_format']]:undefined;this[_0x66d5('0x77')]=_0x5cfce0[_0x66d5('0x77')]||![];this[_0x66d5('0x78')]=_0x5cfce0[_0x66d5('0x78')]?_0x5cfce0[_0x66d5('0x78')]:undefined;}module[_0x66d5('0x79')]=VoiceQueue; \ No newline at end of file +var _0xb30d=['dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','pTalking','timeout','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startPredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','busy','ringing','ringinuse','wav','wav49','rrmemory','roundrobin','name','monitor_format','type','answered','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence'];(function(_0x551c32,_0x3d7c5e){var _0x2cca9a=function(_0x53817a){while(--_0x53817a){_0x551c32['push'](_0x551c32['shift']());}};_0x2cca9a(++_0x3d7c5e);}(_0xb30d,0x184));var _0xdb30=function(_0xdd2bfa,_0x5bd304){_0xdd2bfa=_0xdd2bfa-0x0;var _0x55397e=_0xb30d[_0xdd2bfa];return _0x55397e;};'use strict';var statusDesc=[_0xdb30('0x0'),_0xdb30('0x1'),'inuse',_0xdb30('0x2'),'invalid','unavailable',_0xdb30('0x3'),_0xdb30('0x4'),'onhold'];var monitorFormat={'wav':_0xdb30('0x5'),'wav49':_0xdb30('0x6'),'gsm':'gsm'};var strategy={'rrmemory':_0xdb30('0x7'),'roundrobin':_0xdb30('0x8')};function VoiceQueue(_0x308349){this['id']=_0x308349['id']||0x0;this['name']=_0x308349[_0xdb30('0x9')]||'';this[_0xdb30('0xa')]=_0x308349[_0xdb30('0xa')]||'';this[_0xdb30('0xb')]=_0x308349[_0xdb30('0xb')]||'inbound';this['waiting']=0x0;this['talking']=0x0;this['total']=0x0;this[_0xdb30('0xc')]=0x0;this[_0xdb30('0xd')]=0x0;this[_0xdb30('0xe')]=0x0;this[_0xdb30('0xf')]=0x0;this[_0xdb30('0x10')]=0x0;this[_0xdb30('0x11')]=0x0;this[_0xdb30('0x12')]=0x0;this[_0xdb30('0x13')]=0x0;this[_0xdb30('0x14')]=_0x308349[_0xdb30('0x14')]||![];this[_0xdb30('0x15')]=_0x308349[_0xdb30('0x15')]||0xa;this['autopause']=_0x308349[_0xdb30('0x16')]||'no';this[_0xdb30('0x17')]=!![];this[_0xdb30('0x18')]='';this[_0xdb30('0x19')]=0x0;this['temp']=0x0;this[_0xdb30('0x1a')]=_0x308349[_0xdb30('0x1a')]||null;this[_0xdb30('0x1b')]=_0x308349[_0xdb30('0x1b')]?_0x308349['dialGlobalInterval']:null;this[_0xdb30('0x1c')]=_0x308349[_0xdb30('0x1c')];this[_0xdb30('0x1d')]=_0x308349[_0xdb30('0x1d')]||_0xdb30('0x1e');this[_0xdb30('0x1f')]=_0x308349[_0xdb30('0x1f')]||0x0;this[_0xdb30('0x20')]=_0x308349[_0xdb30('0x20')]||0x0;this['dialPowerLevel']=_0x308349['dialPowerLevel']||0x1;this[_0xdb30('0x21')]=_0x308349['dialPredictiveOptimization']||_0xdb30('0x22');this[_0xdb30('0x23')]=_0x308349['dialPredictiveOptimizationPercentage']||0.03;this[_0xdb30('0x24')]=_0x308349['dialPredictiveInterval']||0x258;this[_0xdb30('0x25')]=_0x308349[_0xdb30('0x25')]||'anonymous';this[_0xdb30('0x26')]=_0x308349[_0xdb30('0x26')]||'anonymous';this[_0xdb30('0x27')]=_0x308349[_0xdb30('0x27')]||0x1e;this[_0xdb30('0x28')]=_0x308349[_0xdb30('0x28')]||_0xdb30('0x29');this[_0xdb30('0x2a')]=_0x308349[_0xdb30('0x2a')]||0x3;this[_0xdb30('0x2b')]=_0x308349['dialQueueProject']||undefined;this[_0xdb30('0x2c')]=_0x308349[_0xdb30('0x2c')]||0x3;this[_0xdb30('0x2d')]=_0x308349[_0xdb30('0x2d')]||0x96;this['dialBusyMaxRetry']=_0x308349[_0xdb30('0x2e')]||0x3;this[_0xdb30('0x2f')]=_0x308349[_0xdb30('0x2f')]||0x96;this[_0xdb30('0x30')]=_0x308349['dialNoAnswerMaxRetry']||0x3;this[_0xdb30('0x31')]=_0x308349['dialNoAnswerRetryFrequency']||0x96;this[_0xdb30('0x32')]=_0x308349[_0xdb30('0x32')]||0x3;this[_0xdb30('0x33')]=_0x308349[_0xdb30('0x33')]||0x96;this[_0xdb30('0x34')]=_0x308349[_0xdb30('0x34')]||0x3;this[_0xdb30('0x35')]=_0x308349[_0xdb30('0x35')]||0x96;this['dialAbandonedMaxRetry']=_0x308349[_0xdb30('0x36')]||0x3;this[_0xdb30('0x37')]=_0x308349[_0xdb30('0x37')]||0x96;this[_0xdb30('0x38')]=_0x308349[_0xdb30('0x38')]||0x3;this[_0xdb30('0x39')]=_0x308349[_0xdb30('0x39')]||0x96;this[_0xdb30('0x3a')]=_0x308349[_0xdb30('0x3a')]||0x3;this[_0xdb30('0x3b')]=_0x308349['dialAgentRejectRetryFrequency']||0x96;this['dialGlobalMaxRetry']=_0x308349['dialGlobalMaxRetry']||0x4;this['Trunk']=_0x308349[_0xdb30('0x3c')]?_0x308349[_0xdb30('0x3c')]:undefined;this[_0xdb30('0x3d')]=_0x308349[_0xdb30('0x3d')]?_0x308349[_0xdb30('0x3d')]:undefined;this[_0xdb30('0x3e')]=_0x308349['dialPrefix']||undefined;this[_0xdb30('0x3f')]=_0x308349[_0xdb30('0x3f')]?_0x308349[_0xdb30('0x3f')]:undefined;this[_0xdb30('0x40')]=_0x308349[_0xdb30('0x40')]||_0xdb30('0x41');this[_0xdb30('0x42')]=_0x308349[_0xdb30('0x42')]||undefined;this[_0xdb30('0x43')]=_0x308349[_0xdb30('0x43')]||undefined;this['strategy']=strategy[_0x308349['strategy']]||_0xdb30('0x7');this['queueStatusComplete']=!![];this[_0xdb30('0x44')]=_0x308349[_0xdb30('0x44')]||![];this[_0xdb30('0x45')]=_0x308349[_0xdb30('0x45')];this[_0xdb30('0x46')]=_0x308349['dialAMDGreeting'];this[_0xdb30('0x47')]=_0x308349['dialAMDAfterGreetingSilence'];this[_0xdb30('0x48')]=_0x308349[_0xdb30('0x48')];this[_0xdb30('0x49')]=_0x308349['dialAMDMinWordLength'];this[_0xdb30('0x4a')]=_0x308349[_0xdb30('0x4a')];this['dialAMDMaximumNumberOfWords']=_0x308349[_0xdb30('0x4b')];this[_0xdb30('0x4c')]=_0x308349[_0xdb30('0x4c')];this[_0xdb30('0x4d')]=_0x308349[_0xdb30('0x4d')];this['outboundRejectCallsDay']=0x0;this[_0xdb30('0x4e')]=0x0;this['timeout']=_0x308349[_0xdb30('0x4f')];this['outboundAnswerCallsDay']=0x0;this[_0xdb30('0x50')]=0x0;this[_0xdb30('0x51')]=0x0;this['outboundBusyCallsDay']=0x0;this[_0xdb30('0x52')]=0x0;this[_0xdb30('0x53')]=0x0;this['outboundUnknownCallsDay']=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0xdb30('0x54')]=0x0;this[_0xdb30('0x55')]=0x0;this[_0xdb30('0x56')]=0x0;this[_0xdb30('0x57')]=0x0;this[_0xdb30('0x58')]=0x0;this[_0xdb30('0x59')]=0x0;this['startProgressive']=undefined;this[_0xdb30('0x5a')]=undefined;this['handlePredictive']=undefined;this[_0xdb30('0x5b')]=1.05;this[_0xdb30('0x5c')]=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0xdb30('0x5d')]=0x0;this[_0xdb30('0x5e')]=0x0;this[_0xdb30('0x5f')]=0x0;this['predictiveIntervalPauses']=0x0;this[_0xdb30('0x60')]=0x0;this[_0xdb30('0x61')]=_0x308349['dialPredictiveIntervalMaxThreshold']||0x14;this[_0xdb30('0x62')]=_0x308349[_0xdb30('0x63')]||0xa;this['predictiveIntervalErlangCalls']=0x0;this[_0xdb30('0x64')]=0x0;this[_0xdb30('0x65')]=0x1;this[_0xdb30('0x66')]=0x0;this[_0xdb30('0x67')]=0x0;this[_0xdb30('0x68')]=0x0;this[_0xdb30('0x69')]=0x0;this[_0xdb30('0x6a')]=_0x308349[_0xdb30('0x6a')]||0x1e;this[_0xdb30('0x6b')]=_0x308349[_0xdb30('0x6b')]||![];this[_0xdb30('0x6c')]=!!_0x308349[_0xdb30('0x6c')]||![];this['dialQueueProject2']=_0x308349[_0xdb30('0x6d')]||undefined;this[_0xdb30('0x6e')]=_0x308349[_0xdb30('0x6e')]||![];this['dialAgiAfterHangupAgent']=_0x308349[_0xdb30('0x6f')]||![];this['monitor_format']=monitorFormat[_0x308349[_0xdb30('0xa')]]?monitorFormat[_0x308349[_0xdb30('0xa')]]:undefined;this[_0xdb30('0x70')]=_0x308349['mandatoryDisposition']||![];this[_0xdb30('0x71')]=_0x308349[_0xdb30('0x71')]?_0x308349[_0xdb30('0x71')]:undefined;}module[_0xdb30('0x72')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 8885859..d27826c 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 _0x59a5=['name','username','accessKey','remoteUri','Configurations'];(function(_0x424501,_0x42096d){var _0xb719af=function(_0x37adcf){while(--_0x37adcf){_0x424501['push'](_0x424501['shift']());}};_0xb719af(++_0x42096d);}(_0x59a5,0x1c7));var _0x559a=function(_0x55c46e,_0x3d30ee){_0x55c46e=_0x55c46e-0x0;var _0x340ac8=_0x59a5[_0x55c46e];return _0x340ac8;};'use strict';function VtigerAccount(_0x4d02cd){this['id']=_0x4d02cd['id']||0x0;this[_0x559a('0x0')]=_0x4d02cd[_0x559a('0x0')]||'';this[_0x559a('0x1')]=_0x4d02cd['username']||'';this[_0x559a('0x2')]=_0x4d02cd['accessKey']||'';this[_0x559a('0x3')]=_0x4d02cd[_0x559a('0x3')]||'';this['serverUrl']=_0x4d02cd['serverUrl']||'';this[_0x559a('0x4')]=_0x4d02cd[_0x559a('0x4')]||{};}module['exports']=VtigerAccount; \ No newline at end of file +var _0x7c8e=['exports','name','username','remoteUri','serverUrl','Configurations'];(function(_0x1b6311,_0x42ec20){var _0x25aab6=function(_0x139a77){while(--_0x139a77){_0x1b6311['push'](_0x1b6311['shift']());}};_0x25aab6(++_0x42ec20);}(_0x7c8e,0x18d));var _0xe7c8=function(_0x3a411d,_0x3b5646){_0x3a411d=_0x3a411d-0x0;var _0x14b4b0=_0x7c8e[_0x3a411d];return _0x14b4b0;};'use strict';function VtigerAccount(_0x233769){this['id']=_0x233769['id']||0x0;this[_0xe7c8('0x0')]=_0x233769[_0xe7c8('0x0')]||'';this['username']=_0x233769[_0xe7c8('0x1')]||'';this['accessKey']=_0x233769['accessKey']||'';this[_0xe7c8('0x2')]=_0x233769[_0xe7c8('0x2')]||'';this[_0xe7c8('0x3')]=_0x233769['serverUrl']||'';this[_0xe7c8('0x4')]=_0x233769[_0xe7c8('0x4')]||{};}module[_0xe7c8('0x5')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index a9512b6..418a740 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 _0x94ff=['remoteUri','authType','type','integrationTab','serverUrl','Configurations','name','username','password'];(function(_0xf10ab2,_0x4139fa){var _0x4c6629=function(_0x1be701){while(--_0x1be701){_0xf10ab2['push'](_0xf10ab2['shift']());}};_0x4c6629(++_0x4139fa);}(_0x94ff,0xe7));var _0xf94f=function(_0xbad54c,_0x282fab){_0xbad54c=_0xbad54c-0x0;var _0x5de4cd=_0x94ff[_0xbad54c];return _0x5de4cd;};'use strict';function ZendeskAccount(_0x4206ee){this['id']=_0x4206ee['id']||0x0;this['name']=_0x4206ee[_0xf94f('0x0')]||'';this[_0xf94f('0x1')]=_0x4206ee[_0xf94f('0x1')]||'';this[_0xf94f('0x2')]=_0x4206ee['password']||'';this['token']=_0x4206ee['token']||'';this[_0xf94f('0x3')]=_0x4206ee['remoteUri']||'';this[_0xf94f('0x4')]=_0x4206ee[_0xf94f('0x4')]||'';this['type']=_0x4206ee[_0xf94f('0x5')]||_0xf94f('0x6');this[_0xf94f('0x7')]=_0x4206ee['serverUrl']||'';this[_0xf94f('0x8')]=_0x4206ee['Configurations']||{};}module['exports']=ZendeskAccount; \ No newline at end of file +var _0x21a7=['serverUrl','username','password','token','remoteUri','authType','type'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x21a7,0x7f));var _0x721a=function(_0x4bf10b,_0x271b6f){_0x4bf10b=_0x4bf10b-0x0;var _0x2aba74=_0x21a7[_0x4bf10b];return _0x2aba74;};'use strict';function ZendeskAccount(_0x41f15a){this['id']=_0x41f15a['id']||0x0;this['name']=_0x41f15a['name']||'';this[_0x721a('0x0')]=_0x41f15a[_0x721a('0x0')]||'';this[_0x721a('0x1')]=_0x41f15a[_0x721a('0x1')]||'';this['token']=_0x41f15a[_0x721a('0x2')]||'';this[_0x721a('0x3')]=_0x41f15a[_0x721a('0x3')]||'';this[_0x721a('0x4')]=_0x41f15a[_0x721a('0x4')]||'';this['type']=_0x41f15a[_0x721a('0x5')]||'integrationTab';this[_0x721a('0x6')]=_0x41f15a['serverUrl']||'';this['Configurations']=_0x41f15a['Configurations']||{};}module['exports']=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 79b75f9..c58d2de 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 _0x1828=['serverUrl','code','refreshToken','Configurations','exports','name','description','host','clientId','clientSecret'];(function(_0x265dc5,_0x5a5417){var _0x23cfc2=function(_0x1b29d0){while(--_0x1b29d0){_0x265dc5['push'](_0x265dc5['shift']());}};_0x23cfc2(++_0x5a5417);}(_0x1828,0x195));var _0x8182=function(_0x176c16,_0x1e1474){_0x176c16=_0x176c16-0x0;var _0x5a06a3=_0x1828[_0x176c16];return _0x5a06a3;};'use strict';function ZohoAccount(_0x4c1d8e){this['id']=_0x4c1d8e['id']||0x0;this[_0x8182('0x0')]=_0x4c1d8e[_0x8182('0x0')]||'';this['description']=_0x4c1d8e[_0x8182('0x1')]||'';this[_0x8182('0x2')]=_0x4c1d8e[_0x8182('0x2')]||'';this['zone']=_0x4c1d8e['zone']||'';this[_0x8182('0x3')]=_0x4c1d8e[_0x8182('0x3')]||'';this['clientSecret']=_0x4c1d8e[_0x8182('0x4')]||'';this[_0x8182('0x5')]=_0x4c1d8e[_0x8182('0x5')]||'';this[_0x8182('0x6')]=_0x4c1d8e[_0x8182('0x6')]||'';this[_0x8182('0x7')]=_0x4c1d8e[_0x8182('0x7')]||'';this[_0x8182('0x8')]=_0x4c1d8e['Configurations']||{};}module[_0x8182('0x9')]=ZohoAccount; \ No newline at end of file +var _0xc874=['name','host','zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations'];(function(_0x5d5849,_0x3b63a7){var _0x1be67f=function(_0x3c28ce){while(--_0x3c28ce){_0x5d5849['push'](_0x5d5849['shift']());}};_0x1be67f(++_0x3b63a7);}(_0xc874,0x10e));var _0x4c87=function(_0x175a55,_0x4082fd){_0x175a55=_0x175a55-0x0;var _0x167adf=_0xc874[_0x175a55];return _0x167adf;};'use strict';function ZohoAccount(_0x2e8475){this['id']=_0x2e8475['id']||0x0;this[_0x4c87('0x0')]=_0x2e8475['name']||'';this['description']=_0x2e8475['description']||'';this[_0x4c87('0x1')]=_0x2e8475[_0x4c87('0x1')]||'';this['zone']=_0x2e8475[_0x4c87('0x2')]||'';this['clientId']=_0x2e8475[_0x4c87('0x3')]||'';this[_0x4c87('0x4')]=_0x2e8475[_0x4c87('0x4')]||'';this[_0x4c87('0x5')]=_0x2e8475['serverUrl']||'';this['code']=_0x2e8475[_0x4c87('0x6')]||'';this[_0x4c87('0x7')]=_0x2e8475[_0x4c87('0x7')]||'';this[_0x4c87('0x8')]=_0x2e8475[_0x4c87('0x8')]||{};}module['exports']=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index c38cf26..0aa4439 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 _0x4b02=['callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','getCaller','format','\x22%s\x22\x20<%s>','exports','util','lodash','moment','string','uniqueid','idContact','queue','name','type','dialAnswer','isNil','Agent','channelAgent','membername','SIP/%s','Contact','lastName','active','calleridnum','phone','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callbackuniqueid'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x4b02,0x1d9));var _0x24b0=function(_0x4fbcf8,_0x43828c){_0x4fbcf8=_0x4fbcf8-0x0;var _0x1d148b=_0x4b02[_0x4fbcf8];return _0x1d148b;};'use strict';var util=require(_0x24b0('0x0'));var _=require(_0x24b0('0x1'));var moment=require(_0x24b0('0x2'));function checkNameSurname(_0xa51fc4,_0x37b2e1,_0x10d7af){var _0xbd896d='';if(!_['isNil'](_0x37b2e1)&&_0x24b0('0x3')===typeof _0x37b2e1){_0xbd896d+=_0x37b2e1;}if(!_['isNil'](_0x10d7af)&&_0x24b0('0x3')===typeof _0x10d7af){_0xbd896d+='\x20'+_0x10d7af;}if(_0xbd896d!==''){return _0xbd896d;}return _0xa51fc4;}function Action(_0x42aba5,_0x26c0db,_0x41b1a0,_0x1a2a23,_0x2182aa){this[_0x24b0('0x4')]=_0x41b1a0||undefined;this[_0x24b0('0x5')]=_0x42aba5['id'];this[_0x24b0('0x6')]=_0x26c0db[_0x24b0('0x7')];this['type']=_0x26c0db[_0x24b0('0x8')];this['campaigntype']=_0x24b0('0x6');this[_0x24b0('0x9')]=![];this['membername']=_[_0x24b0('0xa')](_0x42aba5[_0x24b0('0xb')])?undefined:_0x42aba5[_0x24b0('0xb')][_0x24b0('0x7')];this[_0x24b0('0xc')]=this[_0x24b0('0xd')]?util['format'](_0x24b0('0xe'),this['membername']):_0x1a2a23||undefined;this['calleridname']=checkNameSurname(_0x42aba5[_0x24b0('0xf')]['phone'],_0x42aba5['Contact']['firstName'],_0x42aba5['Contact'][_0x24b0('0x10')]);this[_0x24b0('0x11')]=_0x42aba5['active']||![];this[_0x24b0('0x12')]=_0x42aba5['Contact'][_0x24b0('0x13')];this['scheduledat']=_0x42aba5[_0x24b0('0x14')];this[_0x24b0('0x15')]=_0x42aba5['countbusyretry']||0x0;this['countcongestionretry']=_0x42aba5[_0x24b0('0x16')]||0x0;this[_0x24b0('0x17')]=_0x42aba5[_0x24b0('0x17')]||0x0;this[_0x24b0('0x18')]=(_0x42aba5[_0x24b0('0x15')]||0x0)+(_0x42aba5['countcongestionretry']||0x0)+(_0x42aba5['countnoanswerretry']||0x0)+(_0x42aba5[_0x24b0('0x19')]||0x0)+(_0x42aba5[_0x24b0('0x1a')]||0x0)+(_0x42aba5[_0x24b0('0x1b')]||0x0)+(_0x42aba5[_0x24b0('0x1c')]||0x0)+(_0x42aba5['countagentrejectretry']||0x0);this[_0x24b0('0x19')]=_0x42aba5[_0x24b0('0x19')]||0x0;this[_0x24b0('0x1a')]=_0x42aba5[_0x24b0('0x1a')]||0x0;this[_0x24b0('0x1b')]=_0x42aba5['countabandonedretry']||0x0;this[_0x24b0('0x1c')]=_0x42aba5[_0x24b0('0x1c')]||0x0;this['countagentrejectretry']=_0x42aba5[_0x24b0('0x1d')]||0x0;this['callback']=_0x42aba5['callback'];this[_0x24b0('0x1e')]=_0x42aba5[_0x24b0('0x1e')];this['callbackat']=_0x42aba5[_0x24b0('0x1f')];this[_0x24b0('0x20')]=_0x42aba5[_0x24b0('0x20')];this[_0x24b0('0x21')]=_0x42aba5[_0x24b0('0x21')];this[_0x24b0('0x22')]=_0x42aba5[_0x24b0('0x22')];this[_0x24b0('0x23')]=_[_0x24b0('0xa')](_0x42aba5[_0x24b0('0xb')])?_0x42aba5[_0x24b0('0x23')]:_0x42aba5[_0x24b0('0xb')]['id'];this[_0x24b0('0x24')]=_0x42aba5[_0x24b0('0x24')];this[_0x24b0('0x25')]='';this['originatecalleridname']='';}Action['prototype'][_0x24b0('0x26')]=function(){return util[_0x24b0('0x27')](_0x24b0('0x28'),this['calleridname'],this['number']);};module[_0x24b0('0x29')]=Action; \ No newline at end of file +var _0x55a2=['\x22%s\x22\x20<%s>','exports','util','lodash','moment','isNil','string','uniqueid','idContact','queue','name','type','dialAnswer','Agent','channelAgent','membername','format','calleridname','Contact','phone','lastName','active','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','originatecalleridnum','originatecalleridname','getCaller'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x55a2,0xfe));var _0x255a=function(_0x4dab14,_0x164ea0){_0x4dab14=_0x4dab14-0x0;var _0xf41aa=_0x55a2[_0x4dab14];return _0xf41aa;};'use strict';var util=require(_0x255a('0x0'));var _=require(_0x255a('0x1'));var moment=require(_0x255a('0x2'));function checkNameSurname(_0x444b9a,_0x5b27d0,_0xd979ba){var _0x5f1085='';if(!_[_0x255a('0x3')](_0x5b27d0)&&_0x255a('0x4')===typeof _0x5b27d0){_0x5f1085+=_0x5b27d0;}if(!_[_0x255a('0x3')](_0xd979ba)&&_0x255a('0x4')===typeof _0xd979ba){_0x5f1085+='\x20'+_0xd979ba;}if(_0x5f1085!==''){return _0x5f1085;}return _0x444b9a;}function Action(_0x465210,_0x41308e,_0x3e5eb0,_0x5b43ef,_0x2514f5){this[_0x255a('0x5')]=_0x3e5eb0||undefined;this[_0x255a('0x6')]=_0x465210['id'];this[_0x255a('0x7')]=_0x41308e[_0x255a('0x8')];this[_0x255a('0x9')]=_0x41308e[_0x255a('0x9')];this['campaigntype']=_0x255a('0x7');this[_0x255a('0xa')]=![];this['membername']=_[_0x255a('0x3')](_0x465210['Agent'])?undefined:_0x465210[_0x255a('0xb')]['name'];this[_0x255a('0xc')]=this[_0x255a('0xd')]?util[_0x255a('0xe')]('SIP/%s',this['membername']):_0x5b43ef||undefined;this[_0x255a('0xf')]=checkNameSurname(_0x465210[_0x255a('0x10')][_0x255a('0x11')],_0x465210[_0x255a('0x10')]['firstName'],_0x465210[_0x255a('0x10')][_0x255a('0x12')]);this[_0x255a('0x13')]=_0x465210['active']||![];this['calleridnum']=_0x465210[_0x255a('0x10')][_0x255a('0x11')];this['scheduledat']=_0x465210[_0x255a('0x14')];this[_0x255a('0x15')]=_0x465210['countbusyretry']||0x0;this[_0x255a('0x16')]=_0x465210[_0x255a('0x16')]||0x0;this[_0x255a('0x17')]=_0x465210[_0x255a('0x17')]||0x0;this[_0x255a('0x18')]=(_0x465210['countbusyretry']||0x0)+(_0x465210[_0x255a('0x16')]||0x0)+(_0x465210[_0x255a('0x17')]||0x0)+(_0x465210[_0x255a('0x19')]||0x0)+(_0x465210[_0x255a('0x1a')]||0x0)+(_0x465210['countabandonedretry']||0x0)+(_0x465210[_0x255a('0x1b')]||0x0)+(_0x465210[_0x255a('0x1c')]||0x0);this[_0x255a('0x19')]=_0x465210[_0x255a('0x19')]||0x0;this['countdropretry']=_0x465210[_0x255a('0x1a')]||0x0;this[_0x255a('0x1d')]=_0x465210['countabandonedretry']||0x0;this[_0x255a('0x1b')]=_0x465210[_0x255a('0x1b')]||0x0;this[_0x255a('0x1c')]=_0x465210[_0x255a('0x1c')]||0x0;this[_0x255a('0x1e')]=_0x465210[_0x255a('0x1e')];this['callbackuniqueid']=_0x465210[_0x255a('0x1f')];this[_0x255a('0x20')]=_0x465210[_0x255a('0x20')];this[_0x255a('0x21')]=_0x465210['recallme'];this[_0x255a('0x22')]=_0x465210[_0x255a('0x22')];this['ListId']=_0x465210[_0x255a('0x23')];this['UserId']=_['isNil'](_0x465210['Agent'])?_0x465210['UserId']:_0x465210[_0x255a('0xb')]['id'];this['VoiceQueueId']=_0x465210[_0x255a('0x24')];this[_0x255a('0x25')]='';this[_0x255a('0x26')]='';}Action['prototype'][_0x255a('0x27')]=function(){return util[_0x255a('0xe')](_0x255a('0x28'),this[_0x255a('0xf')],this['number']);};module[_0x255a('0x29')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index bd5bf30..e13694a 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 _0x5636=['erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','name','active','callerid','Interval','format','voice:queue:%s','info','stringify','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','available','paused','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20disactive','prototype','syncCampaigns','clockClearZombieChannels','booked','outbound','hasOwnProperty','setMessage','dialPreviewAutoRecallMe','recallMe','enqueue','[clearZombieChannels][talking]','Queue','queue','originated:\x20','dialAnswer','pick','UserId','ListId','Action','status','channel','catch','No\x20such\x20channel','updateOriginated','decrementTalkink','loggerError','[Dialer][checkChannel][Preview]','clearZombieChannels','size','clearZombieChannel','agentReadyId','then','isNil','length','getDiff','dialRecallMeTimeout','Agent','voicePause','logger2','[RecallMe]','disableContact','starttime','logCustomer','rescheduleContactInQueue','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','loggedIn','NOT_ACTIVE','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','countnosuchnumberretry','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','dialNoSuchNumberRetryFrequency','unlockAgent','activeContact','linkedid','ANSWER','YYYY-MM-DD\x20HH:mm:ss','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','pTalking:\x20','custom:agentconnect','buildObj','acw','custom:agentConnectPreview','buildAcw','complete','total','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumBillable','talktime','BUSY','countbusyretry','Busy','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','dialBusyMaxRetry','NOANSWER','NoAnswer','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','countnoanswerretry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','CONGESTION','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','countcongestionretry','dialBusyRetryFrequency','CANCEL','countagentrejectretry','AgentReject','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','dialAgentRejectMaxRetry','[callProgressDetectingCustomer][logAgentReject]','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedRetryFrequency','countmachineretry','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','cause-txt','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','callProgressDetectingAgent','isUndefined','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','checkInBlack','Contact','phone','Contact\x20is\x20undefined','isEmpty','execCall','Queue:\x20','\x20IdHopper:\x20','idContact','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','createHistory','[Blacklist][error]','SIP/%s','reachable','unmonitored','run','execRun','unlock','unlockContact','getContactPreview','recallme','validateContact','VoiceQueueId','Contact.phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','isActive','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','trim','substring','dialCutDigit','getCallerId','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','extractCalleridName','originatecalleridnum','addVariables','merge','toLowerVariables','[originateFailure][logOriginateFailure]','syncNewExten','actionid','lookAgent','clone','response','custom:agentringnoanswer','rejected','Answer','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','channelstate','transfer','[syncHangup][talking][transfer]','destlinkedid','addVariable','variables','filterKey','keys','variable','value','[syncVarSet][Preview]','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','md5','ioredis','../../../config/environment','preview','../../../config/logger','actionPreview','../ami','./rpcDb','./action','./util/util','redis','defaults','localhost','socket.io-emitter','tail','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','originateresponse','bind','hangup','syncHangup','syncHangupRequest','dialend','syncDialEnd','newexten','syncVarSet','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','type','strategy','answered','pTalking','sumDuration','sumHoldTime','talking','abandoned','waiting','dialActive','dialMethod','dialOriginateCallerIdNumber','dialPrefix','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','originated'];(function(_0x37d3f3,_0xca010f){var _0x185c9c=function(_0x5e2bf2){while(--_0x5e2bf2){_0x37d3f3['push'](_0x37d3f3['shift']());}};_0x185c9c(++_0xca010f);}(_0x5636,0x102));var _0x6563=function(_0x2a5438,_0xe70581){_0x2a5438=_0x2a5438-0x0;var _0x475e1b=_0x5636[_0x2a5438];return _0x475e1b;};'use strict';var util=require(_0x6563('0x0'));var _=require(_0x6563('0x1'));var BPromise=require('bluebird');var uuid=require('uuid');var moment=require('moment');var md5=require(_0x6563('0x2'));var Redis=require(_0x6563('0x3'));var config=require(_0x6563('0x4'));var logger=require('../../../config/logger')(_0x6563('0x5'));var loggerAction=require(_0x6563('0x6'))(_0x6563('0x7'));var ami=require(_0x6563('0x8'));var rpcDb=require(_0x6563('0x9'));var Action=require(_0x6563('0xa'));var ut=require(_0x6563('0xb'));config[_0x6563('0xc')]=_[_0x6563('0xd')](config[_0x6563('0xc')],{'host':_0x6563('0xe'),'port':0x18eb});var io=require(_0x6563('0xf'))(new Redis(config[_0x6563('0xc')]));var Sequence=function(){};Sequence['prototype']['enqueue']=function(_0x2946f3){this[_0x6563('0x10')]=this['tail']?this['tail']['finally'](_0x2946f3):_0x2946f3();};function Preview(_0x1ef002){this[_0x6563('0x11')]=new Sequence();this[_0x6563('0x12')]=_0x1ef002[_0x6563('0x13')];this[_0x6563('0x14')]=_0x1ef002[_0x6563('0x14')];this[_0x6563('0x15')]={};this[_0x6563('0x16')]=_0x1ef002[_0x6563('0x16')];this['clockClearZombieChannels']=0x0;ami['on'](_0x6563('0x17'),this['syncOriginateResponse'][_0x6563('0x18')](this));ami['on'](_0x6563('0x19'),this[_0x6563('0x1a')][_0x6563('0x18')](this));ami['on']('hanguprequest',this[_0x6563('0x1b')][_0x6563('0x18')](this));ami['on'](_0x6563('0x1c'),this[_0x6563('0x1d')]['bind'](this));ami['on'](_0x6563('0x1e'),this['syncNewExten']['bind'](this));ami['on']('varset',this[_0x6563('0x1f')]['bind'](this));ami['on']('attendedtransfer',this[_0x6563('0x20')][_0x6563('0x18')](this));ami['on'](_0x6563('0x21'),this[_0x6563('0x22')][_0x6563('0x18')](this));this[_0x6563('0x23')](this[_0x6563('0x12')]);}function emit(_0x93a45,_0x2a70f0,_0x5bf608){io['to'](_0x93a45)[_0x6563('0x24')](_0x2a70f0,_0x5bf608);}function emitCampaignPreview(_0x9c3da7){if(_0x9c3da7[_0x6563('0x25')]==='outbound'){var _0x293db2={'id':_0x9c3da7['id'],'name':_0x9c3da7['name'],'strategy':_0x9c3da7[_0x6563('0x26')],'answered':_0x9c3da7[_0x6563('0x27')],'available':_0x9c3da7['available'],'loggedIn':_0x9c3da7['loggedIn'],'pTalking':_0x9c3da7[_0x6563('0x28')],'sumBillable':_0x9c3da7['sumBillable'],'sumDuration':_0x9c3da7[_0x6563('0x29')],'sumHoldTime':_0x9c3da7[_0x6563('0x2a')]||0x0,'talking':_0x9c3da7[_0x6563('0x2b')],'total':_0x9c3da7['total'],'type':_0x9c3da7[_0x6563('0x25')],'unmanaged':_0x9c3da7['unmanaged'],'abandoned':_0x9c3da7[_0x6563('0x2c')],'waiting':_0x9c3da7[_0x6563('0x2d')],'loggedInDb':_0x9c3da7['loggedInDb'],'dialActive':_0x9c3da7[_0x6563('0x2e')],'dialMethod':_0x9c3da7[_0x6563('0x2f')],'dialOriginateCallerIdName':_0x9c3da7['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x9c3da7[_0x6563('0x30')],'dialOriginateTimeout':_0x9c3da7['dialOriginateTimeout'],'dialPrefix':_0x9c3da7[_0x6563('0x31')],'outboundAnswerAgiCallsDay':_0x9c3da7['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x9c3da7['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x9c3da7[_0x6563('0x32')],'outboundBusyCallsDay':_0x9c3da7[_0x6563('0x33')],'outboundCongestionCallsDay':_0x9c3da7[_0x6563('0x34')],'outboundDropCallsDayACS':_0x9c3da7[_0x6563('0x35')],'outboundDropCallsDayCallersExit':_0x9c3da7[_0x6563('0x36')],'outboundDropCallsDayTimeout':_0x9c3da7['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x9c3da7[_0x6563('0x37')],'outboundNoSuchCallsDay':_0x9c3da7['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x9c3da7['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x9c3da7[_0x6563('0x38')],'outboundRejectCallsDay':_0x9c3da7[_0x6563('0x39')],'outboundUnknownCallsDay':_0x9c3da7[_0x6563('0x3a')],'outboundAbandonedCallsDay':_0x9c3da7[_0x6563('0x3b')],'predictiveIntervalAnsweredCalls':_0x9c3da7[_0x6563('0x3c')],'predictiveIntervalAvgHoldtime':_0x9c3da7[_0x6563('0x3d')],'predictiveIntervalAvgTalktime':_0x9c3da7[_0x6563('0x3e')],'predictiveIntervalDroppedCallsCallersExit':_0x9c3da7[_0x6563('0x3f')],'predictiveIntervalDroppedCallsTimeout':_0x9c3da7[_0x6563('0x40')],'predictiveIntervalErlangCalls':_0x9c3da7[_0x6563('0x41')],'predictiveIntervalErlangCallsDroppedCalls':_0x9c3da7['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x9c3da7[_0x6563('0x42')],'predictiveIntervalMultiplicativeFactor':_0x9c3da7[_0x6563('0x43')],'predictiveIntervalPauses':_0x9c3da7[_0x6563('0x44')],'predictiveIntervalAvailable':_0x9c3da7[_0x6563('0x45')],'predictiveIntervalTotalCalls':_0x9c3da7[_0x6563('0x46')],'message':_0x9c3da7[_0x6563('0x47')],'originated':_0x9c3da7[_0x6563('0x48')],'erlangCalls':_0x9c3da7['erlangCalls'],'erlangCallToSecond':_0x9c3da7[_0x6563('0x49')],'erlangAbandonmentRate':_0x9c3da7[_0x6563('0x4a')],'erlangBusyFactor':_0x9c3da7[_0x6563('0x4b')],'startPredictive':_0x9c3da7[_0x6563('0x4c')],'startProgressive':_0x9c3da7[_0x6563('0x4d')]};if(_0x9c3da7[_0x6563('0x4e')]){_0x293db2['Trunk']={'id':_0x9c3da7[_0x6563('0x4e')]['id'],'name':_0x9c3da7[_0x6563('0x4e')][_0x6563('0x4f')],'active':_0x9c3da7[_0x6563('0x4e')][_0x6563('0x50')],'callerid':_0x9c3da7[_0x6563('0x4e')][_0x6563('0x51')]};}if(_0x9c3da7['Interval']){_0x293db2[_0x6563('0x52')]={'id':_0x9c3da7[_0x6563('0x52')]['id'],'name':_0x9c3da7['Interval'][_0x6563('0x4f')]};}var _0x1ff47d=md5(JSON['stringify'](_0x293db2));if(_0x9c3da7['md5']!==_0x1ff47d){_0x9c3da7[_0x6563('0x2')]=_0x1ff47d;emit(util[_0x6563('0x53')](_0x6563('0x54'),_0x293db2[_0x6563('0x4f')]),'voice_queue:save',_0x293db2);}}}function emitVoiceQueueChannelRemove(_0x2d36d4){logger[_0x6563('0x55')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON[_0x6563('0x56')](_0x2d36d4));emit(util[_0x6563('0x53')](_0x6563('0x54'),_0x2d36d4[_0x6563('0x4f')]),_0x6563('0x57'),_0x2d36d4);io[_0x6563('0x24')](_0x6563('0x58'),_0x2d36d4);}function notSendMessagesQueue(_0x15c23e){if(_0x15c23e[_0x6563('0x59')]){if(_0x15c23e['originated']===0x0&&_0x15c23e[_0x6563('0x28')]===0x0){_0x15c23e[_0x6563('0x59')]=![];_0x15c23e[_0x6563('0x5a')]=0x0;_0x15c23e[_0x6563('0x5b')]=0x0;_0x15c23e['message']='NOT_ACTIVE';ut[_0x6563('0x5c')](_0x6563('0x5d'),_0x15c23e[_0x6563('0x4f')]+'\x20is\x20not\x20active');}else{_0x15c23e[_0x6563('0x47')]='IS_DISACTIVED';ut[_0x6563('0x5c')](_0x6563('0x5d'),_0x15c23e['name']+_0x6563('0x5e'));}emitCampaignPreview(_0x15c23e);}}Preview[_0x6563('0x5f')][_0x6563('0x23')]=function(){var _0xcf92cd=this;setInterval(function(){_0xcf92cd[_0x6563('0x60')]();},0x7cf);};Preview[_0x6563('0x5f')][_0x6563('0x60')]=function(){var _0x32932f=this[_0x6563('0x12')];this[_0x6563('0x61')]+=0x1;for(var _0x2acb52 in _0x32932f){if(_0x32932f['hasOwnProperty'](_0x2acb52)&&(_0x32932f[_0x2acb52]['dialMethod']===_0x6563('0x5')||_0x32932f[_0x2acb52][_0x6563('0x2f')]===_0x6563('0x62'))&&_0x32932f[_0x2acb52][_0x6563('0x25')]===_0x6563('0x63')){if(this[_0x6563('0x61')]>0x7){this[_0x6563('0x61')]=0x0;this['clearZombieChannels']();}}if(_0x32932f[_0x6563('0x64')](_0x2acb52)&&_0x32932f[_0x2acb52][_0x6563('0x2f')]===_0x6563('0x5')&&_0x32932f[_0x2acb52][_0x6563('0x25')]==='outbound'){if(_0x32932f[_0x2acb52][_0x6563('0x2e')]){this[_0x6563('0x65')](_0x32932f[_0x2acb52]);if(_0x32932f[_0x2acb52][_0x6563('0x66')])this[_0x6563('0x67')](_0x32932f[_0x2acb52]);}else{notSendMessagesQueue(_0x32932f[_0x2acb52]);}}}};Preview[_0x6563('0x5f')]['clearZombieChannel']=function(_0x496602){var _0x1504ca=this;this[_0x6563('0x11')][_0x6563('0x68')](function(){if(!_['isNil'](_0x1504ca[_0x6563('0x15')][_0x496602])){loggerAction[_0x6563('0x55')](_0x6563('0x69'),_0x496602,_0x6563('0x6a'),_0x1504ca['actions'][_0x496602][_0x6563('0x6b')],_0x6563('0x6c'),JSON[_0x6563('0x56')](_0x1504ca['campaignsPreview'][_0x1504ca[_0x6563('0x15')][_0x496602]['queue']][_0x6563('0x48')]),'pTalking:\x20',JSON['stringify'](_0x1504ca[_0x6563('0x12')][_0x1504ca[_0x6563('0x15')][_0x496602][_0x6563('0x6b')]][_0x6563('0x28')]),JSON[_0x6563('0x56')](_0x1504ca[_0x6563('0x15')][_0x496602][_0x6563('0x6d')]),JSON[_0x6563('0x56')](_[_0x6563('0x6e')](_0x1504ca[_0x6563('0x15')][_0x496602],['contactId',_0x6563('0x6f'),'VoiceQueueId',_0x6563('0x70')])));return ami[_0x6563('0x71')]({'action':_0x6563('0x72'),'channel':_0x1504ca['actions'][_0x496602][_0x6563('0x73')]})[_0x6563('0x74')](function(_0x4f9884){if(_0x4f9884[_0x6563('0x47')]===_0x6563('0x75')){setTimeout(function(){if(_0x1504ca[_0x6563('0x15')][_0x496602]){ut[_0x6563('0x76')](_0x1504ca[_0x6563('0x12')][_0x1504ca['actions'][_0x496602][_0x6563('0x6b')]],'[clearZombieChannel]');if(_0x1504ca[_0x6563('0x15')][_0x496602]['dialAnswer']===!![]){ut[_0x6563('0x77')](_0x1504ca['campaignsPreview'][_0x1504ca['actions'][_0x496602]['queue']],'[clearZombieChannel]');ut[_0x6563('0x78')]('[Dialer][checkChannel][pTalking][Preview]'+_0x496602,_0x1504ca[_0x6563('0x15')][_0x496602]['queue']);}ut[_0x6563('0x78')](_0x6563('0x79')+_0x496602,_0x1504ca[_0x6563('0x15')][_0x496602][_0x6563('0x6b')]);delete _0x1504ca[_0x6563('0x15')][_0x496602];}},0x2328);}});}});};Preview[_0x6563('0x5f')][_0x6563('0x7a')]=function(){var _0xdc94f8=this;loggerAction[_0x6563('0x55')]('[action]',_[_0x6563('0x7b')](this[_0x6563('0x15')]));for(var _0x97ee3 in this[_0x6563('0x15')]){if(_0xdc94f8[_0x6563('0x15')][_0x6563('0x64')](_0x97ee3)){_0xdc94f8[_0x6563('0x7c')](_0x97ee3);}}};Preview[_0x6563('0x5f')][_0x6563('0x67')]=function(_0x2c7e9d){var _0x1fc431=this;rpcDb['getContactRecallMe'](_0x2c7e9d['id'],ut[_0x6563('0x7d')](this[_0x6563('0x16')]))[_0x6563('0x7e')](function(_0x2e9c69){if(!_[_0x6563('0x7f')](_0x2e9c69)){for(var _0x3c06ac=0x0;_0x3c06ac<_0x2e9c69[_0x6563('0x80')];_0x3c06ac+=0x1){if(ut[_0x6563('0x81')](_0x2e9c69[_0x3c06ac]['scheduledat'])<_0x2c7e9d[_0x6563('0x82')]*0x3c){if(_0x2e9c69[_0x3c06ac]['Agent']&&!_0x2e9c69[_0x3c06ac][_0x6563('0x83')][_0x6563('0x84')]){_0x1fc431['run'](_0x2e9c69[_0x3c06ac]['id'])['then'](ut[_0x6563('0x85')](_0x6563('0x86')))[_0x6563('0x74')](ut[_0x6563('0x85')]('[RecallMe]'));}else{rpcDb[_0x6563('0x87')](_0x2e9c69[_0x3c06ac]['id']);}}else{var _0x49c1e0=new Action(_0x2e9c69[_0x3c06ac],_0x2c7e9d);_0x49c1e0[_0x6563('0x88')]=moment()[_0x6563('0x53')]('YYYY-MM-DD\x20HH:mm:ss');_0x2c7e9d['outboundReCallsDay']+=0x1;ut[_0x6563('0x89')](_0x49c1e0,0x17,'RecallInQueue');if(_0x2c7e9d['dialRecallInQueue']){rpcDb[_0x6563('0x8a')](ut['createBody'](_0x2e9c69[_0x3c06ac]));rpcDb[_0x6563('0x8b')](_0x49c1e0,_0x6563('0x8c'));}else{ut[_0x6563('0x89')](_0x49c1e0,0x16,_0x6563('0x8d'));rpcDb['createCustomerHistory'](_0x49c1e0,_0x6563('0x8e'));rpcDb[_0x6563('0x8f')](_0x49c1e0,_0x6563('0x8e'));}}}}})[_0x6563('0x74')](ut[_0x6563('0x85')](_0x6563('0x90')));};Preview[_0x6563('0x5f')][_0x6563('0x65')]=function(_0x58728d){_0x58728d['sendMessageOneNotActive']=!![];if(ut[_0x6563('0x91')](_0x58728d[_0x6563('0x92')])){_0x58728d['message']='AGENTS_NOT_LOGGED';}else if(!ut['isActive'](_0x58728d[_0x6563('0x2e')])){_0x58728d[_0x6563('0x47')]=_0x6563('0x93');}else if(!this[_0x6563('0x94')](_0x58728d['Trunk'])){if(!this[_0x6563('0x94')](_0x58728d[_0x6563('0x95')])){_0x58728d[_0x6563('0x47')]=_0x6563('0x96');}else{_0x58728d[_0x6563('0x47')]='ACTIVE';}}else{_0x58728d['message']=_0x6563('0x97');}emitCampaignPreview(_0x58728d);};Preview[_0x6563('0x5f')][_0x6563('0x98')]=function(_0x5d365e,_0x23a3e2,_0x5e8a05){var _0x311036=this;var _0x29dfff=this[_0x6563('0x15')][_0x23a3e2];var _0x2ddaac=this[_0x6563('0x12')][_0x29dfff[_0x6563('0x6b')]];var _0x500aa1;if(_0x2ddaac){switch(_0x5e8a05){case'1':_0x2ddaac['outboundNoSuchCallsDay']+=0x1;_0x29dfff['countnosuchnumberretry']+=0x1;_0x29dfff[_0x6563('0x99')]=ut[_0x6563('0x9a')](_0x29dfff);ut[_0x6563('0x89')](_0x29dfff,0x0,_0x6563('0x9b'));ami[_0x6563('0x24')](_0x6563('0x9c'),ut['buildObj'](_0x29dfff,'nosuchnumber'));rpcDb['createCustomerHistory'](_0x29dfff,_0x6563('0x9d'));if(ut[_0x6563('0x9a')](_0x29dfff)>=_0x2ddaac[_0x6563('0x9e')]){_0x500aa1=ut[_0x6563('0x9f')](_0x29dfff,0xf,_0x6563('0xa0'));rpcDb['createCustomerFinal'](_0x500aa1,_0x6563('0xa1'));}else{if(_0x29dfff[_0x6563('0xa2')]>=_0x2ddaac[_0x6563('0xa3')]){rpcDb[_0x6563('0x8f')](_0x29dfff,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{rpcDb[_0x6563('0xa4')](ut[_0x6563('0xa5')](_0x29dfff,_0x6563('0xa2'),_0x2ddaac[_0x6563('0xa6')]),_0x29dfff[_0x6563('0xa7')],_0x29dfff[_0x6563('0xa8')]);}}delete this[_0x6563('0x15')][_0x5d365e[_0x6563('0xa9')]];break;case _0x6563('0xaa'):var _0x1e08a8=moment()[_0x6563('0x53')](_0x6563('0xab'));_0x29dfff[_0x6563('0xac')]=_0x1e08a8;_0x29dfff[_0x6563('0xad')]=_0x1e08a8;_0x29dfff[_0x6563('0x6d')]=!![];_0x2ddaac['pTalking']+=0x1;logger[_0x6563('0x55')](_0x6563('0xae'),_0x29dfff[_0x6563('0xaf')],_0x6563('0xb0'),_0x2ddaac[_0x6563('0x4f')],_0x6563('0xb1'),_0x2ddaac[_0x6563('0x28')]);ami[_0x6563('0x24')](_0x6563('0xb2'),ut[_0x6563('0xb3')](_0x29dfff,'connect',this[_0x6563('0x12')][_0x29dfff[_0x6563('0x6b')]]));if(_0x2ddaac[_0x6563('0xb4')]){ami[_0x6563('0x24')](_0x6563('0xb5'),ut[_0x6563('0xb6')](_0x29dfff));}break;case'16':ami[_0x6563('0x24')]('custom:agentcomplete',ut[_0x6563('0xb3')](_0x29dfff,_0x6563('0xb7'),this[_0x6563('0x12')][_0x29dfff[_0x6563('0x6b')]]));emitVoiceQueueChannelRemove(ut[_0x6563('0xb3')](_0x29dfff,_0x6563('0xb7')));_0x2ddaac['outboundAnswerCallsDay']+=0x1;_0x2ddaac[_0x6563('0xb8')]+=0x1;_0x2ddaac[_0x6563('0x27')]+=0x1;ut[_0x6563('0x77')](_0x2ddaac,'[16]');_0x29dfff[_0x6563('0x99')]=ut[_0x6563('0x9a')](_0x29dfff);ut[_0x6563('0x89')](_0x29dfff,0x4,'Answer');rpcDb['createCustomerHistory'](_0x29dfff,'[callProgressDetectingCustomer][logAnswer]');rpcDb[_0x6563('0x8f')](_0x29dfff,_0x6563('0xb9'));rpcDb[_0x6563('0xba')](_0x29dfff);_0x2ddaac[_0x6563('0x29')]+=_0x29dfff['talktime'];_0x2ddaac[_0x6563('0xbb')]+=_0x29dfff[_0x6563('0xbc')];logger['info']('[syncHangup][talking][decrement]',_0x29dfff[_0x6563('0xaf')],_0x6563('0xb0'),_0x2ddaac[_0x6563('0x4f')],_0x6563('0xb1'),_0x2ddaac['pTalking']);delete this[_0x6563('0x15')][_0x5d365e[_0x6563('0xa9')]];break;case _0x6563('0xbd'):_0x2ddaac[_0x6563('0x33')]+=0x1;_0x29dfff[_0x6563('0xbe')]+=0x1;_0x29dfff[_0x6563('0x99')]=ut[_0x6563('0x9a')](_0x29dfff);ut[_0x6563('0x89')](_0x29dfff,0x5,_0x6563('0xbf'));ami['emit'](_0x6563('0xc0'),ut[_0x6563('0xb3')](_0x29dfff,_0x6563('0xc1')));rpcDb[_0x6563('0x8b')](_0x29dfff,_0x6563('0xc2'));if(ut[_0x6563('0x9a')](_0x29dfff)>=_0x2ddaac['dialGlobalMaxRetry']){_0x500aa1=ut[_0x6563('0x9f')](_0x29dfff,0xf,_0x6563('0xa0'));rpcDb[_0x6563('0x8f')](_0x500aa1,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0x29dfff['countbusyretry']>=_0x2ddaac[_0x6563('0xc3')]){rpcDb[_0x6563('0x8f')](_0x29dfff,_0x6563('0xc2'));}else{rpcDb[_0x6563('0xa4')](ut[_0x6563('0xa5')](_0x29dfff,'countbusyretry',_0x2ddaac['dialBusyRetryFrequency']),_0x29dfff[_0x6563('0xa7')],_0x29dfff['activeContact']);}}break;case _0x6563('0xc4'):_0x2ddaac['outboundNoAnswerCallsDay']+=0x1;_0x29dfff['countnoanswerretry']+=0x1;_0x29dfff[_0x6563('0x99')]=ut[_0x6563('0x9a')](_0x29dfff);ut[_0x6563('0x89')](_0x29dfff,0x3,_0x6563('0xc5'));ami[_0x6563('0x24')](_0x6563('0xc6'),ut[_0x6563('0xb3')](_0x29dfff,_0x6563('0xc7')));rpcDb['createCustomerHistory'](_0x29dfff,_0x6563('0xc8'));if(ut[_0x6563('0x9a')](_0x29dfff)>=_0x2ddaac[_0x6563('0x9e')]){_0x500aa1=ut[_0x6563('0x9f')](_0x29dfff,0xf,'Global');rpcDb[_0x6563('0x8f')](_0x500aa1,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x29dfff[_0x6563('0xc9')]>=_0x2ddaac[_0x6563('0xca')]){rpcDb[_0x6563('0x8f')](_0x29dfff,_0x6563('0xc8'));}else{rpcDb[_0x6563('0xa4')](ut[_0x6563('0xa5')](_0x29dfff,_0x6563('0xc9'),_0x2ddaac[_0x6563('0xcb')]),_0x29dfff[_0x6563('0xa7')],_0x29dfff[_0x6563('0xa8')]);}}break;case _0x6563('0xcc'):_0x2ddaac[_0x6563('0x34')]+=0x1;_0x29dfff['countcongestionretry']+=0x1;_0x29dfff[_0x6563('0x99')]=ut['totalGlobal'](_0x29dfff);ut[_0x6563('0x89')](_0x29dfff,0x8,_0x6563('0xcd'));ami[_0x6563('0x24')](_0x6563('0xce'),ut[_0x6563('0xb3')](_0x29dfff,_0x6563('0xcf')));rpcDb[_0x6563('0x8b')](_0x29dfff,_0x6563('0xd0'));if(ut[_0x6563('0x9a')](_0x29dfff)>=_0x2ddaac[_0x6563('0x9e')]){_0x500aa1=ut[_0x6563('0x9f')](_0x29dfff,0xf,'Global');rpcDb[_0x6563('0x8f')](_0x500aa1,_0x6563('0xd1'));}else{if(_0x29dfff[_0x6563('0xd2')]>=_0x2ddaac['dialCongestionMaxRetry']){rpcDb[_0x6563('0x8f')](_0x29dfff,_0x6563('0xd0'));}else{rpcDb[_0x6563('0xa4')](ut[_0x6563('0xa5')](_0x29dfff,_0x6563('0xd2'),_0x2ddaac[_0x6563('0xd3')]),_0x29dfff['unlockAgent'],_0x29dfff[_0x6563('0xa8')]);}}break;case _0x6563('0xd4'):_0x2ddaac['outboundRejectCallsDay']+=0x1;_0x29dfff[_0x6563('0xd5')]+=0x1;_0x29dfff['countglobal']=ut['totalGlobal'](_0x29dfff);ut[_0x6563('0x89')](_0x29dfff,0x14,_0x6563('0xd6'));ami[_0x6563('0x24')](_0x6563('0xd7'),ut[_0x6563('0xb3')](_0x29dfff,_0x6563('0xd8')));rpcDb[_0x6563('0x8b')](_0x29dfff,_0x6563('0xd9'));if(ut[_0x6563('0x9a')](_0x29dfff)>=_0x2ddaac[_0x6563('0x9e')]){_0x500aa1=ut['cloneAction'](_0x29dfff,0x14,_0x6563('0xd6'));rpcDb[_0x6563('0x8f')](_0x500aa1,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x29dfff['countagentrejectretry']>=_0x2ddaac[_0x6563('0xda')]){rpcDb[_0x6563('0x8f')](_0x29dfff,_0x6563('0xdb'));}else{rpcDb[_0x6563('0xa4')](ut['scheduledAt'](_0x29dfff,_0x6563('0xd5'),_0x2ddaac['dialAgentRejectRetryFrequency']),_0x29dfff[_0x6563('0xa7')],_0x29dfff[_0x6563('0xa8')]);}}break;case _0x6563('0xdc'):_0x2ddaac[_0x6563('0x3b')]+=0x1;_0x29dfff[_0x6563('0xdd')]+=0x1;_0x29dfff[_0x6563('0x99')]=ut['totalGlobal'](_0x29dfff);ut['logCustomer'](_0x29dfff,0xb,_0x6563('0xde'));rpcDb[_0x6563('0x8b')](_0x29dfff,'[callProgressDetectingCustomer][logAbandoned]');if(ut[_0x6563('0x9a')](_0x29dfff)>=_0x2ddaac['dialGlobalMaxRetry']){_0x500aa1=ut['cloneAction'](_0x29dfff,0xf,_0x6563('0xa0'));rpcDb[_0x6563('0x8f')](_0x500aa1,_0x6563('0xdf'));}else{if(_0x29dfff[_0x6563('0xe0')]>=_0x2ddaac['dialAbandonedMaxRety']){rpcDb[_0x6563('0x8f')](_0x29dfff,_0x6563('0xdf'));}else{rpcDb[_0x6563('0xa4')](ut[_0x6563('0xa5')](_0x29dfff,_0x6563('0xdd'),_0x2ddaac[_0x6563('0xe1')]),_0x29dfff[_0x6563('0xa7')],_0x29dfff['activeContact']);}}break;case'18':_0x2ddaac[_0x6563('0x3a')]+=0x1;_0x29dfff[_0x6563('0xe2')]+=0x1;_0x29dfff[_0x6563('0x99')]=ut[_0x6563('0x9a')](_0x29dfff);ut['logCustomer'](_0x29dfff,0x12,_0x5d365e['cause-txt']||_0x5d365e[_0x6563('0xe3')]);ami[_0x6563('0x24')](_0x6563('0xe4'),ut[_0x6563('0xb3')](_0x29dfff,_0x6563('0xe5')));rpcDb[_0x6563('0x8b')](_0x29dfff,_0x6563('0xe6'));if(ut[_0x6563('0x9a')](_0x29dfff)>=_0x2ddaac[_0x6563('0x9e')]){_0x500aa1=ut['cloneAction'](_0x29dfff,0xf,'Global');rpcDb[_0x6563('0x8f')](_0x500aa1,_0x6563('0xe6'));}else{rpcDb[_0x6563('0x8f')](_0x29dfff,_0x6563('0xe6'));}delete this[_0x6563('0x15')][_0x5d365e[_0x6563('0xa9')]];break;case'19':_0x2ddaac['outboundUnknownCallsDay']+=0x1;_0x29dfff[_0x6563('0x99')]=ut[_0x6563('0x9a')](_0x29dfff);ut[_0x6563('0x89')](_0x29dfff,0x13,_0x5d365e[_0x6563('0xe7')]||_0x5d365e[_0x6563('0xe3')]);ami[_0x6563('0x24')](_0x6563('0xe4'),ut['buildObj'](_0x29dfff,_0x6563('0xe5')));rpcDb[_0x6563('0x8b')](_0x29dfff,_0x6563('0xe8'));if(ut[_0x6563('0x9a')](_0x29dfff)>=_0x2ddaac['dialGlobalMaxRetry']){_0x500aa1=ut[_0x6563('0x9f')](_0x29dfff,0xf,_0x6563('0xa0'));rpcDb[_0x6563('0x8f')](_0x500aa1,_0x6563('0xe8'));}else{rpcDb[_0x6563('0x8f')](_0x29dfff,_0x6563('0xe8'));}delete this[_0x6563('0x15')][_0x5d365e['linkedid']];break;default:if(_0x29dfff['dialAnswer']){ut[_0x6563('0x77')](_0x2ddaac,_0x6563('0xe9'));ut[_0x6563('0x78')](_0x6563('0xea')+_0x2ddaac['name'],_0x5d365e);}_0x2ddaac['outboundUnknownCallsDay']+=0x1;_0x29dfff[_0x6563('0x99')]=ut[_0x6563('0x9a')](_0x29dfff);ut['logCustomer'](_0x29dfff,0xc,_0x5d365e[_0x6563('0xe7')]||_0x5d365e['dialstatus']);rpcDb[_0x6563('0x8b')](_0x29dfff,'[callProgressDetectingCustomer][logUnknown]');if(ut[_0x6563('0x9a')](_0x29dfff)>=_0x2ddaac[_0x6563('0x9e')]){_0x500aa1=ut[_0x6563('0x9f')](_0x29dfff,0xf,'Global');rpcDb[_0x6563('0x8f')](_0x500aa1,_0x6563('0xeb'));}else{rpcDb[_0x6563('0x8f')](_0x29dfff,_0x6563('0xeb'));}delete this[_0x6563('0x15')][_0x5d365e[_0x6563('0xa9')]];}if(!(_0x29dfff['dialAnswer']&&_0x5e8a05==='16')){ut[_0x6563('0x76')](_0x2ddaac,_0x6563('0xec'));logger[_0x6563('0x55')](_0x6563('0xed'),_0x29dfff[_0x6563('0xaf')],_0x6563('0xb0'),_0x2ddaac[_0x6563('0x4f')],_0x6563('0x6c'),_0x2ddaac['originated']);}if(_0x5e8a05!==_0x6563('0xaa')){delete this['actions'][_0x5d365e[_0x6563('0xa9')]];delete this[_0x6563('0x15')][_0x5d365e['destlinkedid']];}}};Preview[_0x6563('0x5f')][_0x6563('0xee')]=function(_0x3a6135,_0x3a1c66,_0x367404){if(_[_0x6563('0xef')](_0x3a1c66)&&_0x6563('0xf0')!==typeof _0x3a1c66){return;}if(_['isUndefined'](_0x367404)&&_0x6563('0xf0')!==typeof _0x367404){return;}switch(_0x367404[_0x6563('0xf1')]){case'0':ut[_0x6563('0xf2')](_0x3a6135,0x0,_0x6563('0x9b'));rpcDb[_0x6563('0xf3')](_0x3a6135,_0x6563('0xf4'));break;case'3':ut[_0x6563('0xf2')](_0x3a6135,0x3,'NoAnswer');rpcDb['createAgentHistory'](_0x3a6135,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut[_0x6563('0xf2')](_0x3a6135,0x5,_0x6563('0xbf'));rpcDb['createAgentHistory'](_0x3a6135,_0x6563('0xf5'));break;case'8':ut[_0x6563('0xf2')](_0x3a6135,0x8,_0x6563('0xcd'));rpcDb[_0x6563('0xf3')](_0x3a6135,_0x6563('0xf6'));break;case'22':ut[_0x6563('0xf2')](_0x3a6135,0x16,_0x6563('0xf7'));rpcDb['createAgentHistory'](_0x3a6135,_0x6563('0xf8'));break;default:ut[_0x6563('0xf2')](_0x3a6135,0xc,_0x367404[_0x6563('0xf1')]);rpcDb[_0x6563('0xf3')](_0x3a6135,_0x6563('0xf6'));}ut[_0x6563('0x76')](_0x3a1c66,_0x6563('0xf9'));logger[_0x6563('0x55')]('[originated][decrement][callProgressDetectingAgent]',_0x3a6135[_0x6563('0xaf')],'\x20Queue',_0x3a1c66[_0x6563('0x4f')],_0x6563('0x6c'),_0x3a1c66[_0x6563('0x48')]);delete this[_0x6563('0x15')][_0x3a6135['uniqueid']];};Preview[_0x6563('0x5f')][_0x6563('0xfa')]=function(_0x399926,_0x471981,_0x6fef3d,_0x8dea03,_0x141eb9){var _0x7f3bbd=this;return new BPromise(function(_0x4fd06b,_0x438160){if(_['isNil'](_0x471981)||_[_0x6563('0x7f')](_0x471981[_0x6563('0xfb')])||_[_0x6563('0x7f')](_0x471981[_0x6563('0xfb')][_0x6563('0xfc')])||_['isNil'](_0x471981['VoiceQueueId'])){_0x438160(ut['message'](_0x6563('0xfd'),_0x8dea03,_0x141eb9));return;}var _0x49ff52=uuid['v4']();var _0x25cd9e=_0x7f3bbd['campaignsPreview'][_0x471981[_0x6563('0x6a')][_0x6563('0x4f')]];var _0x1e75f7=_0x6fef3d?_0x7f3bbd[_0x6563('0x16')][_0x6fef3d]['id']:undefined;_0x7f3bbd[_0x6563('0x15')][_0x49ff52]=new Action(_0x471981,_0x25cd9e,_0x49ff52,_0x6fef3d,_0x1e75f7);var _0x1f75f7=_0x7f3bbd['actions'][_0x49ff52];_0x1f75f7['unlockAgent']=_0x8dea03;_0x1f75f7[_0x6563('0xa8')]=_0x141eb9;_0x1f75f7['lookAgent']=_0x6fef3d;if(_[_0x6563('0xfe')](_0x399926)){_0x7f3bbd[_0x6563('0xff')](_0x1f75f7,_0x25cd9e,_0x471981,_0x6fef3d)['then'](function(_0x374780){logger[_0x6563('0x55')]('[Preview][execCall][success]',_0x6563('0x100')+_0x1f75f7[_0x6563('0x6b')]+_0x6563('0x101')+_0x1f75f7[_0x6563('0x102')],JSON[_0x6563('0x56')](_0x374780));ami['emit'](_0x6563('0x103'),ut[_0x6563('0xb3')](_0x1f75f7,_0x6563('0x104'),_0x7f3bbd[_0x6563('0x12')][_0x1f75f7[_0x6563('0x6b')]]));_0x4fd06b(ut[_0x6563('0x47')](_0x6563('0x105')));})[_0x6563('0x74')](function(_0x35cbd2){ut[_0x6563('0x5c')](_0x6563('0x106'),_0x35cbd2);_0x438160(ut[_0x6563('0x47')](_0x6563('0x107'),_0x8dea03,_0x141eb9));});}else{_0x25cd9e[_0x6563('0x32')]+=0x1;ut[_0x6563('0x108')](_0x1f75f7);rpcDb[_0x6563('0x109')](_0x1f75f7,_0x6563('0x10a'));delete _0x7f3bbd[_0x6563('0x15')][_0x49ff52];_0x438160(ut[_0x6563('0x47')]('Contact\x20in\x20black\x20List',_0x8dea03,_0x141eb9));}});};Preview[_0x6563('0x5f')][_0x6563('0x94')]=function(_0x1a8f03){return!_[_0x6563('0x7f')](_0x1a8f03)&&!_[_0x6563('0x7f')](_0x1a8f03[_0x6563('0x4f')])&&!_[_0x6563('0x7f')](_0x1a8f03[_0x6563('0x50')])&&_0x1a8f03[_0x6563('0x50')]&&!_['isNil'](this[_0x6563('0x14')][util['format'](_0x6563('0x10b'),_0x1a8f03[_0x6563('0x4f')])])&&!_[_0x6563('0x7f')](this['trunks'][util[_0x6563('0x53')](_0x6563('0x10b'),_0x1a8f03['name'])][_0x6563('0x72')])&&(this[_0x6563('0x14')][util[_0x6563('0x53')]('SIP/%s',_0x1a8f03[_0x6563('0x4f')])]['status']===_0x6563('0x10c')||this[_0x6563('0x14')][util['format'](_0x6563('0x10b'),_0x1a8f03['name'])]['status']===_0x6563('0x10d'));};Preview[_0x6563('0x5f')][_0x6563('0x10e')]=function(_0x1036f0,_0x7a1eca){var _0x32f037=this;return new BPromise(function(_0x32ee06,_0x399455){_0x32f037[_0x6563('0x10f')](_0x1036f0,_0x7a1eca)[_0x6563('0x7e')](function(_0x2d0e3b){_0x32ee06(_[_0x6563('0x6e')](_0x2d0e3b,[_0x6563('0x47')]));})[_0x6563('0x74')](function(_0x5e5c86){if(_0x5e5c86[_0x6563('0x110')]){rpcDb[_0x6563('0x111')](_0x1036f0);}if(_0x5e5c86[_0x6563('0x50')]){rpcDb['disableContact'](_0x1036f0);}_0x399455(_[_0x6563('0x6e')](_0x5e5c86,['message']));});});};Preview[_0x6563('0x5f')][_0x6563('0x10f')]=function(_0x32f54a,_0x52f5a8){var _0x474a74=this;return new BPromise(function(_0x425980,_0x4a66cb){var _0x2cef73,_0x13b2dc;rpcDb[_0x6563('0x112')](_0x32f54a)[_0x6563('0x7e')](function(_0x3c8318){if(!_['isNil'](_0x3c8318[0x0])){_0x13b2dc=_0x3c8318[0x0][_0x6563('0x113')]?![]:!![];_0x2cef73=_0x3c8318[0x0][_0x6563('0x113')]?!![]:![];_0x2cef73=_0x52f5a8?!![]:_0x2cef73;}var _0x5ab66e=_0x474a74[_0x6563('0x114')](_0x3c8318);if(_0x5ab66e['isValid']){rpcDb['checkIsBlackList'](_[_0x6563('0x6e')](_0x3c8318[0x0],[_0x6563('0x115'),_0x6563('0x116')]))[_0x6563('0x7e')](function(_0x12a51c){_0x474a74[_0x6563('0xfa')](_0x12a51c,_0x3c8318[0x0],_0x52f5a8,_0x13b2dc,_0x2cef73)[_0x6563('0x7e')](function(_0x134f0a){_0x425980(_0x134f0a);})[_0x6563('0x74')](function(_0x2dd813){_0x4a66cb(_0x2dd813);});})['catch'](function(_0x361107){ut[_0x6563('0x5c')](_0x6563('0x117'),_0x361107);_0x4a66cb(ut[_0x6563('0x47')](_0x6563('0x118'),_0x13b2dc,_0x2cef73));});}else{_0x4a66cb(ut[_0x6563('0x47')](_0x5ab66e['message'],_0x13b2dc,_0x2cef73));}})[_0x6563('0x74')](function(_0x11f51d){ut[_0x6563('0x5c')](_0x6563('0x119'),_0x11f51d);_0x4a66cb(ut[_0x6563('0x47')](_0x6563('0x118'),![],!![]));});});};Preview[_0x6563('0x5f')][_0x6563('0x114')]=function(_0x11359a){if(_[_0x6563('0x7f')](_0x11359a)||_['isEmpty'](_0x11359a)||!_['isNil'](_0x11359a[0x0][_0x6563('0x83')])&&_['isNil'](_0x11359a[0x0][_0x6563('0x83')][_0x6563('0x4f')])){ut[_0x6563('0x5c')]('[Preview][validateContact][Empty\x20Contact]',_0x11359a);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x262de2=this['campaignsPreview'][_0x11359a[0x0]['Queue'][_0x6563('0x4f')]];_0x262de2['message']=_0x6563('0x97');if(_[_0x6563('0x7f')](_0x262de2)){ut[_0x6563('0x5c')]('[Preview][validateContact][Empty\x20Campaign]',_0x262de2);return{'isValid':![],'message':'Empty\x20Campaign'};}if(!this[_0x6563('0x94')](_0x262de2['Trunk'])){ut[_0x6563('0x5c')](_0x6563('0x11a'),_0x6563('0x11b')+_0x262de2[_0x6563('0x4f')]+_0x6563('0x11c'));if(!this[_0x6563('0x94')](_0x262de2[_0x6563('0x95')])){ut[_0x6563('0x5c')](_0x6563('0x11a'),_0x262de2[_0x6563('0x4f')]+_0x6563('0x11d'));return{'isValid':![],'message':_0x6563('0x11e')};}}if(!ut[_0x6563('0x11f')](_0x262de2[_0x6563('0x2e')])){ut[_0x6563('0x5c')](_0x6563('0x120'),_0x262de2[_0x6563('0x4f')]+_0x6563('0x121'));return{'isValid':![],'message':_0x6563('0x11b')+_0x262de2[_0x6563('0x4f')]+_0x6563('0x121')};}return{'isValid':!![],'message':_0x6563('0x122')};};Preview[_0x6563('0x5f')][_0x6563('0xff')]=function(_0x2eccd6,_0x4ae945,_0x4a8de0,_0x324cc1){var _0x2ca1c7=this;return new BPromise(function(_0x4ce85c,_0xf30ae6){var _0x251555=_0x2eccd6['uniqueid'];var _0xdcdce=_0x2ca1c7[_0x6563('0x94')](_0x4ae945[_0x6563('0x4e')])?util[_0x6563('0x53')](_0x6563('0x123'),_0x4ae945[_0x6563('0x4e')]['name'],_['isNil'](_0x4ae945[_0x6563('0x31')])?'':_0x4ae945[_0x6563('0x31')][_0x6563('0x124')]()||'',_0x4ae945['dialCutDigit']>0x0?_0x4a8de0[_0x6563('0xfb')][_0x6563('0xfc')][_0x6563('0x125')](_0x4ae945[_0x6563('0x126')]):_0x4a8de0[_0x6563('0xfb')][_0x6563('0xfc')]):util[_0x6563('0x53')]('SIP/%s/%s%s',_[_0x6563('0x7f')](_0x4ae945[_0x6563('0x95')])?_0x4ae945[_0x6563('0x4e')]['name']:_0x4ae945[_0x6563('0x95')][_0x6563('0x4f')],_['isNil'](_0x4ae945[_0x6563('0x31')])?'':_0x4ae945['dialPrefix'][_0x6563('0x124')]()||'',_0x4ae945[_0x6563('0x126')]>0x0?_0x4a8de0[_0x6563('0xfb')][_0x6563('0xfc')]['substring'](_0x4ae945[_0x6563('0x126')]):_0x4a8de0[_0x6563('0xfb')][_0x6563('0xfc')]);var _0x183752=_0x2ca1c7[_0x6563('0x94')](_0x4ae945[_0x6563('0x4e')])?ut[_0x6563('0x127')](_0x4ae945['Trunk'][_0x6563('0x51')],_0x4ae945[_0x6563('0x128')],_0x4ae945[_0x6563('0x129')]>0x0?ut[_0x6563('0x12a')](_0x4ae945[_0x6563('0x30')],_0x4ae945[_0x6563('0x129')]):_0x4ae945['dialOriginateCallerIdNumber']):ut[_0x6563('0x127')](_[_0x6563('0x7f')](_0x4ae945['TrunkBackup'])?_0x4ae945['Trunk'][_0x6563('0x51')]:_0x4ae945[_0x6563('0x95')][_0x6563('0x51')],_0x4ae945['dialOriginateCallerIdName'],_0x4ae945[_0x6563('0x129')]>0x0?ut[_0x6563('0x12a')](_0x4ae945[_0x6563('0x30')],_0x4ae945[_0x6563('0x129')]):_0x4ae945['dialOriginateCallerIdNumber']);if(_0x183752){_0x2eccd6['originatecalleridname']=ut[_0x6563('0x12b')](_0x183752);_0x2eccd6[_0x6563('0x12c')]=ut['extractCalleridNumber'](_0x183752);}var _0x18b7f7=ut[_0x6563('0x12d')](_0x4ae945,_0x4a8de0,_0xdcdce,_0x183752,_0x251555,_0x2eccd6);_[_0x6563('0x12e')](_0x2eccd6,ut[_0x6563('0x12f')](_0x18b7f7));_0x2eccd6[_0x6563('0x88')]=moment()[_0x6563('0x53')](_0x6563('0xab'));ami[_0x6563('0x71')](ut['variablesAction'](_0x2eccd6,_0x4ae945,_0x18b7f7,_0x2eccd6[_0x6563('0xa8')],_0x324cc1))[_0x6563('0x7e')](function(_0x67ad58){_0x4ae945[_0x6563('0x48')]+=0x1;logger[_0x6563('0x55')]('[originated][increment]',_0x251555,_0x6563('0xb0'),_0x4ae945[_0x6563('0x4f')],_0x6563('0x6c'),_0x4ae945[_0x6563('0x48')]);_0x4ce85c(_0x67ad58);})[_0x6563('0x74')](function(_0x1fe118){ut[_0x6563('0xf2')](_0x2eccd6,0xe,'OriginateError');rpcDb[_0x6563('0xf3')](_0x2eccd6,_0x6563('0x130'));_0xf30ae6(_0x1fe118);});});};Preview[_0x6563('0x5f')][_0x6563('0x131')]=function(_0xf7c630){if(this[_0x6563('0x15')][_0xf7c630[_0x6563('0xa9')]]){this[_0x6563('0x15')][_0xf7c630[_0x6563('0xa9')]][_0x6563('0x73')]=_0xf7c630[_0x6563('0x73')];}};Preview[_0x6563('0x5f')]['syncOriginateResponse']=function(_0x4db603){var _0x10e9e0=this;var _0x23b935=this['actions'][_0x4db603[_0x6563('0x132')]];if(_0x23b935){if(_0x23b935[_0x6563('0x133')]&&this['agents'][_0x23b935['lookAgent']]){ut['logLookAgent'](_0x23b935,this[_0x6563('0x16')][_0x23b935[_0x6563('0x133')]]['name'],this[_0x6563('0x16')][_0x23b935['lookAgent']]['id']);}var _0xca19b5=_[_0x6563('0x134')](_0x23b935);_0xca19b5['responsetime']=moment()[_0x6563('0x53')](_0x6563('0xab'));var _0x3078a4=_0x10e9e0[_0x6563('0x12')][_0x23b935[_0x6563('0x6b')]];if(ut['isFailure'](_0x4db603[_0x6563('0x135')])){if(_0x23b935['unlockAgent']){rpcDb[_0x6563('0x111')](_0x23b935[_0x6563('0x102')]);}if(_0x23b935[_0x6563('0xa8')]){rpcDb['disableContact'](_0x23b935[_0x6563('0x102')]);}ami['emit'](_0x6563('0x136'),ut[_0x6563('0xb3')](_0x23b935,_0x6563('0x137'),this[_0x6563('0x12')][_0x23b935['queue']]));this[_0x6563('0xee')](_0xca19b5,_0x3078a4,_0x4db603);}else{_0x23b935[_0x6563('0x88')]=moment()[_0x6563('0x53')](_0x6563('0xab'));ut[_0x6563('0xf2')](_0xca19b5,0x4,_0x6563('0x138'));rpcDb['createAgentHistory'](_0xca19b5,'[callProgressDetectingAgent][logAnswer]');}}};Preview[_0x6563('0x5f')][_0x6563('0x1a')]=function(_0x4f0647){var _0x4c5265=this;var _0x9d364f=this[_0x6563('0x15')][_0x4f0647['linkedid']];var _0x38ae7f;if(_0x9d364f){_0x38ae7f=this[_0x6563('0x12')][_0x9d364f[_0x6563('0x6b')]];logger[_0x6563('0x55')](_0x6563('0x139'),_0x4f0647[_0x6563('0xa9')],_0x6563('0xb0'),_0x38ae7f['name'],_0x6563('0xb1'),_0x38ae7f[_0x6563('0x28')]);}if(this[_0x6563('0x15')][_0x4f0647[_0x6563('0xa9')]]&&_0x4f0647[_0x6563('0xa9')]!==_0x4f0647[_0x6563('0xaf')]){if(_0x4f0647['cause']==='16'&&this['actions'][_0x4f0647[_0x6563('0xa9')]][_0x6563('0x6d')]){this[_0x6563('0x98')](_0x4f0647,_0x4f0647['linkedid'],_0x4f0647[_0x6563('0x13a')]);}else if(this[_0x6563('0x15')][_0x4f0647['linkedid']][_0x6563('0x6d')]){logger[_0x6563('0x55')](_0x6563('0x13b'),_0x4f0647['linkedid'],_0x4f0647[_0x6563('0x13a')],_0x6563('0xb0'),_0x38ae7f[_0x6563('0x4f')],_0x6563('0xb1'),_0x38ae7f[_0x6563('0x28')]);this[_0x6563('0x98')](_0x4f0647,_0x4f0647[_0x6563('0xa9')],_0x4f0647[_0x6563('0x13a')]);}}else if(_0x9d364f&&_[_0x6563('0x7f')](_0x9d364f[_0x6563('0x13c')])&&_0x38ae7f['dialQueueProject']&&_0x4f0647['linkedid']===_0x4f0647[_0x6563('0xaf')]&&_[_0x6563('0x7f')](_0x4f0647['reason'])&&_0x4f0647['cause']==='16'&&_0x4f0647[_0x6563('0x13d')]==='6'&&_[_0x6563('0xef')](_0x9d364f[_0x6563('0x13e')])){if(_0x9d364f[_0x6563('0xa7')]){rpcDb['unlockContact'](_0x9d364f['idContact']);}if(_0x9d364f['activeContact']){rpcDb['disableContact'](_0x9d364f[_0x6563('0x102')]);}_0x4f0647['reason']='22';this[_0x6563('0xee')](_0x9d364f,_0x38ae7f,_0x4f0647);}else if(_0x9d364f&&_0x9d364f[_0x6563('0x13e')]){if(_0x4f0647['cause']==='16'&&this[_0x6563('0x15')][_0x4f0647['linkedid']]['dialAnswer']){logger['info'](_0x6563('0x13f'),_0x4f0647[_0x6563('0xa9')],_0x4f0647['cause'],'\x20Queue',_0x38ae7f[_0x6563('0x4f')],_0x6563('0xb1'),_0x38ae7f[_0x6563('0x28')]);this[_0x6563('0x98')](_0x4f0647,_0x4f0647['linkedid'],_0x4f0647[_0x6563('0x13a')]);}else if(this['actions'][_0x4f0647[_0x6563('0xa9')]]['dialAnswer']){logger[_0x6563('0x55')](_0x6563('0x13b'),_0x4f0647[_0x6563('0xa9')],_0x4f0647['cause'],'\x20Queue',_0x38ae7f[_0x6563('0x4f')],_0x6563('0xb1'),_0x38ae7f[_0x6563('0x28')]);this[_0x6563('0x98')](_0x4f0647,_0x4f0647['linkedid'],_0x4f0647['cause']);}}};Preview['prototype'][_0x6563('0x1d')]=function(_0x90878e){if(this[_0x6563('0x15')][_0x90878e[_0x6563('0x140')]]&&_0x90878e[_0x6563('0x140')]!==_0x90878e['destuniqueid']){this[_0x6563('0x98')](_0x90878e,_0x90878e[_0x6563('0x140')],_0x90878e[_0x6563('0xe3')]);}};Preview['prototype'][_0x6563('0x1b')]=function(_0x5ab964){if(this[_0x6563('0x15')][_0x5ab964[_0x6563('0xa9')]]&&_0x5ab964['linkedid']!==_0x5ab964['uniqueid']&&!this[_0x6563('0x15')][_0x5ab964[_0x6563('0xa9')]][_0x6563('0x6d')]){if(_0x5ab964[_0x6563('0x13a')]==='1'){this[_0x6563('0x98')](_0x5ab964,_0x5ab964['linkedid'],_0x5ab964[_0x6563('0x13a')]);}}};Preview['prototype'][_0x6563('0x141')]=function(_0x546047,_0x32c097,_0xf809af){if(this['actions'][_0x546047]){if(_['isNil'](this[_0x6563('0x15')][_0x546047][_0x6563('0x142')])){this[_0x6563('0x15')][_0x546047][_0x6563('0x142')]={};}this[_0x6563('0x15')][_0x546047][_0x6563('0x142')][_0x32c097]=_0xf809af;}};Preview[_0x6563('0x5f')][_0x6563('0x1f')]=function(_0x35989a){try{if(!_[_0x6563('0x7f')](_0x35989a)){if(ut[_0x6563('0x143')](_[_0x6563('0x144')](_0x35989a[_0x6563('0x145')])[0x0])){this[_0x6563('0x141')](_0x35989a[_0x6563('0xaf')],_[_0x6563('0x144')](_0x35989a[_0x6563('0x145')])[0x0],_0x35989a[_0x6563('0x146')]);}}}catch(_0x370d72){logger['error'](_0x6563('0x147'),util['inspect'](_0x370d72,{'showHidden':![],'depth':null}));}};Preview[_0x6563('0x5f')]['syncAttendedTransfer']=function(_0x5b4722){if(_0x5b4722){if(this[_0x6563('0x15')][_0x5b4722[_0x6563('0x148')]]){this[_0x6563('0x15')][_0x5b4722[_0x6563('0x148')]]['transfer']=!![];}}};Preview[_0x6563('0x5f')][_0x6563('0x22')]=function(_0x451bc0){if(_0x451bc0){if(this[_0x6563('0x15')][_0x451bc0[_0x6563('0x149')]]){this[_0x6563('0x15')][_0x451bc0[_0x6563('0x149')]]['transfer']=!![];}}};module[_0x6563('0x14a')]=Preview; \ No newline at end of file +var _0x3baf=['syncCampaigns','clockClearZombieChannels','hasOwnProperty','dialMethod','outbound','clearZombieChannels','setMessage','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','isNil','[clearZombieChannels][talking]','queue','originated:\x20','pTalking:\x20','dialAnswer','pick','contactId','UserId','VoiceQueueId','ListId','Action','channel','catch','No\x20such\x20channel','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','size','agentReadyId','then','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','[RecallMe]','logger2','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','dialNoSuchNumberRetryFrequency','unlockAgent','linkedid','ANSWER','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','custom:agentconnect','connect','acw','custom:agentConnectPreview','custom:agentcomplete','complete','outboundAnswerCallsDay','[16]','countglobal','[callProgressDetectingCustomer][logAnswer]','crateCustomerReportQueue','sumDuration','talktime','sumBillable','BUSY','countbusyretry','Busy','custom:agentbusy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','activeContact','outboundNoAnswerCallsDay','countnoanswerretry','NoAnswer','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','CONGESTION','countcongestionretry','Congestion','custom:agentcongestion','congestion','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','dialBusyRetryFrequency','CANCEL','countagentrejectretry','custom:agentreject','AgentReject','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','ABANDONED','countabandonedretry','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','countmachineretry','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','outboundUnknownCallsDay','cause-txt','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','object','isUndefined','reason','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','logAgent','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','\x20Queue','Contact\x20is\x20undefined','Queue','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','idContact','custom:agentcalled','called','Calling','[Preview][execCall][failure]','outboundBlacklistCallsDay','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','status','reachable','run','unlock','unlockContact','disableContact','recallme','validateContact','isValid','Contact.phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','campaign\x20Name:\x20','[Preview][validateContact][Trunk\x20not\x20work]','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','dialPrefix','Contact','dialCutDigit','phone','SIP/%s/%s%s','trim','substring','getCallerId','callerid','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','syncOriginateResponse','lookAgent','logLookAgent','isFailure','custom:agentringnoanswer','rejected','[syncHangup][talking]','cause','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','destuniqueid','syncHangupRequest','variables','syncVarSet','variable','addVariable','keys','value','error','[syncVarSet][Preview]','syncAttendedTransfer','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','bluebird','uuid','moment','md5','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','../ami','./rpcDb','./action','redis','socket.io-emitter','prototype','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','originateresponse','bind','hangup','syncHangup','hanguprequest','dialend','syncDialEnd','newexten','syncNewExten','varset','attendedtransfer','blindtransfer','syncBlindTransfer','emit','type','strategy','answered','available','loggedIn','pTalking','sumHoldTime','talking','unmanaged','loggedInDb','dialActive','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundReCallsDay','outboundRejectCallsDay','outboundAbandonedCallsDay','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalTotalCalls','message','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startProgressive','Trunk','name','active','Interval','stringify','format','voice:queue:%s','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','\x20is\x20disactive','loopCampaigns'];(function(_0x4261e7,_0x4515e4){var _0x5657bc=function(_0x303ac8){while(--_0x303ac8){_0x4261e7['push'](_0x4261e7['shift']());}};_0x5657bc(++_0x4515e4);}(_0x3baf,0xf7));var _0xf3ba=function(_0x3e5608,_0x8b6979){_0x3e5608=_0x3e5608-0x0;var _0x4128d3=_0x3baf[_0x3e5608];return _0x4128d3;};'use strict';var util=require(_0xf3ba('0x0'));var _=require(_0xf3ba('0x1'));var BPromise=require(_0xf3ba('0x2'));var uuid=require(_0xf3ba('0x3'));var moment=require(_0xf3ba('0x4'));var md5=require(_0xf3ba('0x5'));var Redis=require(_0xf3ba('0x6'));var config=require(_0xf3ba('0x7'));var logger=require(_0xf3ba('0x8'))(_0xf3ba('0x9'));var loggerAction=require(_0xf3ba('0x8'))(_0xf3ba('0xa'));var ami=require(_0xf3ba('0xb'));var rpcDb=require(_0xf3ba('0xc'));var Action=require(_0xf3ba('0xd'));var ut=require('./util/util');config['redis']=_['defaults'](config[_0xf3ba('0xe')],{'host':'localhost','port':0x18eb});var io=require(_0xf3ba('0xf'))(new Redis(config[_0xf3ba('0xe')]));var Sequence=function(){};Sequence[_0xf3ba('0x10')][_0xf3ba('0x11')]=function(_0x3a5714){this[_0xf3ba('0x12')]=this[_0xf3ba('0x12')]?this[_0xf3ba('0x12')][_0xf3ba('0x13')](_0x3a5714):_0x3a5714();};function Preview(_0x301ca1){this[_0xf3ba('0x14')]=new Sequence();this[_0xf3ba('0x15')]=_0x301ca1[_0xf3ba('0x16')];this[_0xf3ba('0x17')]=_0x301ca1[_0xf3ba('0x17')];this[_0xf3ba('0x18')]={};this[_0xf3ba('0x19')]=_0x301ca1[_0xf3ba('0x19')];this['clockClearZombieChannels']=0x0;ami['on'](_0xf3ba('0x1a'),this['syncOriginateResponse'][_0xf3ba('0x1b')](this));ami['on'](_0xf3ba('0x1c'),this[_0xf3ba('0x1d')][_0xf3ba('0x1b')](this));ami['on'](_0xf3ba('0x1e'),this['syncHangupRequest'][_0xf3ba('0x1b')](this));ami['on'](_0xf3ba('0x1f'),this[_0xf3ba('0x20')]['bind'](this));ami['on'](_0xf3ba('0x21'),this[_0xf3ba('0x22')][_0xf3ba('0x1b')](this));ami['on'](_0xf3ba('0x23'),this['syncVarSet'][_0xf3ba('0x1b')](this));ami['on'](_0xf3ba('0x24'),this['syncAttendedTransfer']['bind'](this));ami['on'](_0xf3ba('0x25'),this[_0xf3ba('0x26')][_0xf3ba('0x1b')](this));this['loopCampaigns'](this[_0xf3ba('0x15')]);}function emit(_0x327723,_0x35d6d4,_0x7ebcea){io['to'](_0x327723)[_0xf3ba('0x27')](_0x35d6d4,_0x7ebcea);}function emitCampaignPreview(_0x3480cb){if(_0x3480cb[_0xf3ba('0x28')]==='outbound'){var _0x4e94a7={'id':_0x3480cb['id'],'name':_0x3480cb['name'],'strategy':_0x3480cb[_0xf3ba('0x29')],'answered':_0x3480cb[_0xf3ba('0x2a')],'available':_0x3480cb[_0xf3ba('0x2b')],'loggedIn':_0x3480cb[_0xf3ba('0x2c')],'pTalking':_0x3480cb[_0xf3ba('0x2d')],'sumBillable':_0x3480cb['sumBillable'],'sumDuration':_0x3480cb['sumDuration'],'sumHoldTime':_0x3480cb[_0xf3ba('0x2e')]||0x0,'talking':_0x3480cb[_0xf3ba('0x2f')],'total':_0x3480cb['total'],'type':_0x3480cb[_0xf3ba('0x28')],'unmanaged':_0x3480cb[_0xf3ba('0x30')],'abandoned':_0x3480cb['abandoned'],'waiting':_0x3480cb['waiting'],'loggedInDb':_0x3480cb[_0xf3ba('0x31')],'dialActive':_0x3480cb[_0xf3ba('0x32')],'dialMethod':_0x3480cb['dialMethod'],'dialOriginateCallerIdName':_0x3480cb[_0xf3ba('0x33')],'dialOriginateCallerIdNumber':_0x3480cb[_0xf3ba('0x34')],'dialOriginateTimeout':_0x3480cb[_0xf3ba('0x35')],'dialPrefix':_0x3480cb['dialPrefix'],'outboundAnswerAgiCallsDay':_0x3480cb[_0xf3ba('0x36')],'outboundAnswerCallsDay':_0x3480cb['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x3480cb['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x3480cb[_0xf3ba('0x37')],'outboundCongestionCallsDay':_0x3480cb[_0xf3ba('0x38')],'outboundDropCallsDayACS':_0x3480cb['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x3480cb[_0xf3ba('0x39')],'outboundDropCallsDayTimeout':_0x3480cb[_0xf3ba('0x3a')],'outboundNoAnswerCallsDay':_0x3480cb['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x3480cb['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x3480cb['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x3480cb[_0xf3ba('0x3b')],'outboundRejectCallsDay':_0x3480cb[_0xf3ba('0x3c')],'outboundUnknownCallsDay':_0x3480cb['outboundUnknownCallsDay'],'outboundAbandonedCallsDay':_0x3480cb[_0xf3ba('0x3d')],'predictiveIntervalAnsweredCalls':_0x3480cb['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x3480cb['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x3480cb[_0xf3ba('0x3e')],'predictiveIntervalDroppedCallsCallersExit':_0x3480cb[_0xf3ba('0x3f')],'predictiveIntervalDroppedCallsTimeout':_0x3480cb[_0xf3ba('0x40')],'predictiveIntervalErlangCalls':_0x3480cb[_0xf3ba('0x41')],'predictiveIntervalErlangCallsDroppedCalls':_0x3480cb[_0xf3ba('0x42')],'predictiveIntervalHitRate':_0x3480cb[_0xf3ba('0x43')],'predictiveIntervalMultiplicativeFactor':_0x3480cb['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x3480cb[_0xf3ba('0x44')],'predictiveIntervalAvailable':_0x3480cb['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x3480cb[_0xf3ba('0x45')],'message':_0x3480cb[_0xf3ba('0x46')],'originated':_0x3480cb['originated'],'erlangCalls':_0x3480cb[_0xf3ba('0x47')],'erlangCallToSecond':_0x3480cb[_0xf3ba('0x48')],'erlangAbandonmentRate':_0x3480cb[_0xf3ba('0x49')],'erlangBusyFactor':_0x3480cb[_0xf3ba('0x4a')],'startPredictive':_0x3480cb['startPredictive'],'startProgressive':_0x3480cb[_0xf3ba('0x4b')]};if(_0x3480cb['Trunk']){_0x4e94a7['Trunk']={'id':_0x3480cb['Trunk']['id'],'name':_0x3480cb[_0xf3ba('0x4c')][_0xf3ba('0x4d')],'active':_0x3480cb[_0xf3ba('0x4c')][_0xf3ba('0x4e')],'callerid':_0x3480cb[_0xf3ba('0x4c')]['callerid']};}if(_0x3480cb[_0xf3ba('0x4f')]){_0x4e94a7['Interval']={'id':_0x3480cb[_0xf3ba('0x4f')]['id'],'name':_0x3480cb['Interval'][_0xf3ba('0x4d')]};}var _0x4355fe=md5(JSON[_0xf3ba('0x50')](_0x4e94a7));if(_0x3480cb[_0xf3ba('0x5')]!==_0x4355fe){_0x3480cb['md5']=_0x4355fe;emit(util[_0xf3ba('0x51')](_0xf3ba('0x52'),_0x4e94a7['name']),_0xf3ba('0x53'),_0x4e94a7);}}}function emitVoiceQueueChannelRemove(_0x2405e5){logger[_0xf3ba('0x54')](_0xf3ba('0x55'),JSON[_0xf3ba('0x50')](_0x2405e5));emit(util[_0xf3ba('0x51')](_0xf3ba('0x52'),_0x2405e5['name']),_0xf3ba('0x56'),_0x2405e5);io['emit'](_0xf3ba('0x57'),_0x2405e5);}function notSendMessagesQueue(_0x5a5ed3){if(_0x5a5ed3[_0xf3ba('0x58')]){if(_0x5a5ed3[_0xf3ba('0x59')]===0x0&&_0x5a5ed3[_0xf3ba('0x2d')]===0x0){_0x5a5ed3[_0xf3ba('0x58')]=![];_0x5a5ed3[_0xf3ba('0x2b')]=0x0;_0x5a5ed3['paused']=0x0;_0x5a5ed3['message']=_0xf3ba('0x5a');ut[_0xf3ba('0x5b')](_0xf3ba('0x5c'),_0x5a5ed3[_0xf3ba('0x4d')]+_0xf3ba('0x5d'));}else{_0x5a5ed3[_0xf3ba('0x46')]='IS_DISACTIVED';ut[_0xf3ba('0x5b')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x5a5ed3[_0xf3ba('0x4d')]+_0xf3ba('0x5e'));}emitCampaignPreview(_0x5a5ed3);}}Preview[_0xf3ba('0x10')][_0xf3ba('0x5f')]=function(){var _0x25f68e=this;setInterval(function(){_0x25f68e[_0xf3ba('0x60')]();},0x7cf);};Preview[_0xf3ba('0x10')][_0xf3ba('0x60')]=function(){var _0x5b9a0c=this[_0xf3ba('0x15')];this[_0xf3ba('0x61')]+=0x1;for(var _0x28f857 in _0x5b9a0c){if(_0x5b9a0c[_0xf3ba('0x62')](_0x28f857)&&(_0x5b9a0c[_0x28f857][_0xf3ba('0x63')]===_0xf3ba('0x9')||_0x5b9a0c[_0x28f857][_0xf3ba('0x63')]==='booked')&&_0x5b9a0c[_0x28f857][_0xf3ba('0x28')]===_0xf3ba('0x64')){if(this['clockClearZombieChannels']>0x7){this[_0xf3ba('0x61')]=0x0;this[_0xf3ba('0x65')]();}}if(_0x5b9a0c[_0xf3ba('0x62')](_0x28f857)&&_0x5b9a0c[_0x28f857][_0xf3ba('0x63')]===_0xf3ba('0x9')&&_0x5b9a0c[_0x28f857][_0xf3ba('0x28')]===_0xf3ba('0x64')){if(_0x5b9a0c[_0x28f857][_0xf3ba('0x32')]){this[_0xf3ba('0x66')](_0x5b9a0c[_0x28f857]);if(_0x5b9a0c[_0x28f857][_0xf3ba('0x67')])this[_0xf3ba('0x68')](_0x5b9a0c[_0x28f857]);}else{notSendMessagesQueue(_0x5b9a0c[_0x28f857]);}}}};Preview[_0xf3ba('0x10')][_0xf3ba('0x69')]=function(_0x422655){var _0xfffcfa=this;this[_0xf3ba('0x14')][_0xf3ba('0x11')](function(){if(!_[_0xf3ba('0x6a')](_0xfffcfa['actions'][_0x422655])){loggerAction[_0xf3ba('0x54')](_0xf3ba('0x6b'),_0x422655,'Queue',_0xfffcfa[_0xf3ba('0x18')][_0x422655][_0xf3ba('0x6c')],_0xf3ba('0x6d'),JSON[_0xf3ba('0x50')](_0xfffcfa['campaignsPreview'][_0xfffcfa['actions'][_0x422655][_0xf3ba('0x6c')]][_0xf3ba('0x59')]),_0xf3ba('0x6e'),JSON[_0xf3ba('0x50')](_0xfffcfa['campaignsPreview'][_0xfffcfa[_0xf3ba('0x18')][_0x422655][_0xf3ba('0x6c')]][_0xf3ba('0x2d')]),JSON['stringify'](_0xfffcfa[_0xf3ba('0x18')][_0x422655][_0xf3ba('0x6f')]),JSON[_0xf3ba('0x50')](_[_0xf3ba('0x70')](_0xfffcfa[_0xf3ba('0x18')][_0x422655],[_0xf3ba('0x71'),_0xf3ba('0x72'),_0xf3ba('0x73'),_0xf3ba('0x74')])));return ami[_0xf3ba('0x75')]({'action':'status','channel':_0xfffcfa[_0xf3ba('0x18')][_0x422655][_0xf3ba('0x76')]})[_0xf3ba('0x77')](function(_0x3bbf79){if(_0x3bbf79['message']===_0xf3ba('0x78')){setTimeout(function(){if(_0xfffcfa['actions'][_0x422655]){ut['updateOriginated'](_0xfffcfa[_0xf3ba('0x15')][_0xfffcfa[_0xf3ba('0x18')][_0x422655][_0xf3ba('0x6c')]],_0xf3ba('0x79'));if(_0xfffcfa[_0xf3ba('0x18')][_0x422655][_0xf3ba('0x6f')]===!![]){ut[_0xf3ba('0x7a')](_0xfffcfa[_0xf3ba('0x15')][_0xfffcfa['actions'][_0x422655][_0xf3ba('0x6c')]],_0xf3ba('0x79'));ut[_0xf3ba('0x7b')](_0xf3ba('0x7c')+_0x422655,_0xfffcfa['actions'][_0x422655]['queue']);}ut[_0xf3ba('0x7b')](_0xf3ba('0x7d')+_0x422655,_0xfffcfa[_0xf3ba('0x18')][_0x422655][_0xf3ba('0x6c')]);delete _0xfffcfa[_0xf3ba('0x18')][_0x422655];}},0x2328);}});}});};Preview['prototype'][_0xf3ba('0x65')]=function(){var _0x531827=this;loggerAction[_0xf3ba('0x54')]('[action]',_[_0xf3ba('0x7e')](this['actions']));for(var _0x175690 in this[_0xf3ba('0x18')]){if(_0x531827[_0xf3ba('0x18')][_0xf3ba('0x62')](_0x175690)){_0x531827[_0xf3ba('0x69')](_0x175690);}}};Preview['prototype'][_0xf3ba('0x68')]=function(_0x461e80){var _0xe7cb69=this;rpcDb['getContactRecallMe'](_0x461e80['id'],ut[_0xf3ba('0x7f')](this['agents']))[_0xf3ba('0x80')](function(_0x14b7b1){if(!_[_0xf3ba('0x6a')](_0x14b7b1)){for(var _0x21b9c6=0x0;_0x21b9c6<_0x14b7b1[_0xf3ba('0x81')];_0x21b9c6+=0x1){if(ut[_0xf3ba('0x82')](_0x14b7b1[_0x21b9c6][_0xf3ba('0x83')])<_0x461e80[_0xf3ba('0x84')]*0x3c){if(_0x14b7b1[_0x21b9c6][_0xf3ba('0x85')]&&!_0x14b7b1[_0x21b9c6][_0xf3ba('0x85')][_0xf3ba('0x86')]){_0xe7cb69['run'](_0x14b7b1[_0x21b9c6]['id'])[_0xf3ba('0x80')](ut['logger2'](_0xf3ba('0x87')))[_0xf3ba('0x77')](ut[_0xf3ba('0x88')](_0xf3ba('0x87')));}else{rpcDb['disableContact'](_0x14b7b1[_0x21b9c6]['id']);}}else{var _0x26fd3e=new Action(_0x14b7b1[_0x21b9c6],_0x461e80);_0x26fd3e[_0xf3ba('0x89')]=moment()[_0xf3ba('0x51')](_0xf3ba('0x8a'));_0x461e80[_0xf3ba('0x3b')]+=0x1;ut[_0xf3ba('0x8b')](_0x26fd3e,0x17,_0xf3ba('0x8c'));if(_0x461e80[_0xf3ba('0x8d')]){rpcDb[_0xf3ba('0x8e')](ut[_0xf3ba('0x8f')](_0x14b7b1[_0x21b9c6]));rpcDb['createCustomerHistory'](_0x26fd3e,'[HistoryDialRecallInQueue][historyCatch]');}else{ut['logCustomer'](_0x26fd3e,0x16,'RecallFailedTimeout');rpcDb[_0xf3ba('0x90')](_0x26fd3e,_0xf3ba('0x91'));rpcDb[_0xf3ba('0x92')](_0x26fd3e,'[HistoryRecallClose]');}}}}})[_0xf3ba('0x77')](ut['logger2'](_0xf3ba('0x93')));};Preview[_0xf3ba('0x10')]['setMessage']=function(_0x505a62){_0x505a62[_0xf3ba('0x58')]=!![];if(ut['IsNotLoggedIn'](_0x505a62[_0xf3ba('0x2c')])){_0x505a62['message']=_0xf3ba('0x94');}else if(!ut[_0xf3ba('0x95')](_0x505a62[_0xf3ba('0x32')])){_0x505a62[_0xf3ba('0x46')]='NOT_ACTIVE';}else if(!this[_0xf3ba('0x96')](_0x505a62['Trunk'])){if(!this['isTrunkReachable'](_0x505a62[_0xf3ba('0x97')])){_0x505a62[_0xf3ba('0x46')]=_0xf3ba('0x98');}else{_0x505a62[_0xf3ba('0x46')]=_0xf3ba('0x99');}}else{_0x505a62[_0xf3ba('0x46')]='ACTIVE';}emitCampaignPreview(_0x505a62);};Preview[_0xf3ba('0x10')][_0xf3ba('0x9a')]=function(_0x1c7afc,_0x4797c5,_0x11e37e){var _0xc53698=this;var _0x1eea8c=this[_0xf3ba('0x18')][_0x4797c5];var _0x57a3b8=this[_0xf3ba('0x15')][_0x1eea8c[_0xf3ba('0x6c')]];var _0x3250bf;if(_0x57a3b8){switch(_0x11e37e){case'1':_0x57a3b8[_0xf3ba('0x9b')]+=0x1;_0x1eea8c[_0xf3ba('0x9c')]+=0x1;_0x1eea8c['countglobal']=ut[_0xf3ba('0x9d')](_0x1eea8c);ut[_0xf3ba('0x8b')](_0x1eea8c,0x0,_0xf3ba('0x9e'));ami[_0xf3ba('0x27')](_0xf3ba('0x9f'),ut[_0xf3ba('0xa0')](_0x1eea8c,_0xf3ba('0xa1')));rpcDb[_0xf3ba('0x90')](_0x1eea8c,_0xf3ba('0xa2'));if(ut[_0xf3ba('0x9d')](_0x1eea8c)>=_0x57a3b8[_0xf3ba('0xa3')]){_0x3250bf=ut[_0xf3ba('0xa4')](_0x1eea8c,0xf,_0xf3ba('0xa5'));rpcDb['createCustomerFinal'](_0x3250bf,_0xf3ba('0xa6'));}else{if(_0x1eea8c['countnosuchnumberretry']>=_0x57a3b8[_0xf3ba('0xa7')]){rpcDb[_0xf3ba('0x92')](_0x1eea8c,_0xf3ba('0xa6'));}else{rpcDb[_0xf3ba('0xa8')](ut[_0xf3ba('0xa9')](_0x1eea8c,_0xf3ba('0x9c'),_0x57a3b8[_0xf3ba('0xaa')]),_0x1eea8c[_0xf3ba('0xab')],_0x1eea8c['activeContact']);}}delete this[_0xf3ba('0x18')][_0x1c7afc[_0xf3ba('0xac')]];break;case _0xf3ba('0xad'):var _0x5ed946=moment()[_0xf3ba('0x51')](_0xf3ba('0x8a'));_0x1eea8c[_0xf3ba('0xae')]=_0x5ed946;_0x1eea8c[_0xf3ba('0xaf')]=_0x5ed946;_0x1eea8c[_0xf3ba('0x6f')]=!![];_0x57a3b8[_0xf3ba('0x2d')]+=0x1;logger[_0xf3ba('0x54')](_0xf3ba('0xb0'),_0x1eea8c[_0xf3ba('0xb1')],'\x20Queue',_0x57a3b8['name'],_0xf3ba('0x6e'),_0x57a3b8[_0xf3ba('0x2d')]);ami['emit'](_0xf3ba('0xb2'),ut['buildObj'](_0x1eea8c,_0xf3ba('0xb3'),this['campaignsPreview'][_0x1eea8c[_0xf3ba('0x6c')]]));if(_0x57a3b8[_0xf3ba('0xb4')]){ami['emit'](_0xf3ba('0xb5'),ut['buildAcw'](_0x1eea8c));}break;case'16':ami[_0xf3ba('0x27')](_0xf3ba('0xb6'),ut[_0xf3ba('0xa0')](_0x1eea8c,_0xf3ba('0xb7'),this[_0xf3ba('0x15')][_0x1eea8c[_0xf3ba('0x6c')]]));emitVoiceQueueChannelRemove(ut[_0xf3ba('0xa0')](_0x1eea8c,_0xf3ba('0xb7')));_0x57a3b8[_0xf3ba('0xb8')]+=0x1;_0x57a3b8['total']+=0x1;_0x57a3b8[_0xf3ba('0x2a')]+=0x1;ut[_0xf3ba('0x7a')](_0x57a3b8,_0xf3ba('0xb9'));_0x1eea8c[_0xf3ba('0xba')]=ut[_0xf3ba('0x9d')](_0x1eea8c);ut[_0xf3ba('0x8b')](_0x1eea8c,0x4,'Answer');rpcDb[_0xf3ba('0x90')](_0x1eea8c,_0xf3ba('0xbb'));rpcDb[_0xf3ba('0x92')](_0x1eea8c,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0xf3ba('0xbc')](_0x1eea8c);_0x57a3b8[_0xf3ba('0xbd')]+=_0x1eea8c[_0xf3ba('0xbe')];_0x57a3b8[_0xf3ba('0xbf')]+=_0x1eea8c[_0xf3ba('0xbe')];logger[_0xf3ba('0x54')]('[syncHangup][talking][decrement]',_0x1eea8c[_0xf3ba('0xb1')],'\x20Queue',_0x57a3b8['name'],_0xf3ba('0x6e'),_0x57a3b8[_0xf3ba('0x2d')]);delete this['actions'][_0x1c7afc['linkedid']];break;case _0xf3ba('0xc0'):_0x57a3b8[_0xf3ba('0x37')]+=0x1;_0x1eea8c[_0xf3ba('0xc1')]+=0x1;_0x1eea8c[_0xf3ba('0xba')]=ut[_0xf3ba('0x9d')](_0x1eea8c);ut[_0xf3ba('0x8b')](_0x1eea8c,0x5,_0xf3ba('0xc2'));ami['emit'](_0xf3ba('0xc3'),ut[_0xf3ba('0xa0')](_0x1eea8c,'busy'));rpcDb[_0xf3ba('0x90')](_0x1eea8c,_0xf3ba('0xc4'));if(ut[_0xf3ba('0x9d')](_0x1eea8c)>=_0x57a3b8[_0xf3ba('0xa3')]){_0x3250bf=ut[_0xf3ba('0xa4')](_0x1eea8c,0xf,_0xf3ba('0xa5'));rpcDb[_0xf3ba('0x92')](_0x3250bf,_0xf3ba('0xc5'));}else{if(_0x1eea8c['countbusyretry']>=_0x57a3b8['dialBusyMaxRetry']){rpcDb['createCustomerFinal'](_0x1eea8c,_0xf3ba('0xc4'));}else{rpcDb[_0xf3ba('0xa8')](ut['scheduledAt'](_0x1eea8c,'countbusyretry',_0x57a3b8['dialBusyRetryFrequency']),_0x1eea8c[_0xf3ba('0xab')],_0x1eea8c[_0xf3ba('0xc6')]);}}break;case'NOANSWER':_0x57a3b8[_0xf3ba('0xc7')]+=0x1;_0x1eea8c[_0xf3ba('0xc8')]+=0x1;_0x1eea8c[_0xf3ba('0xba')]=ut[_0xf3ba('0x9d')](_0x1eea8c);ut[_0xf3ba('0x8b')](_0x1eea8c,0x3,_0xf3ba('0xc9'));ami[_0xf3ba('0x27')](_0xf3ba('0xca'),ut[_0xf3ba('0xa0')](_0x1eea8c,'noanswer'));rpcDb[_0xf3ba('0x90')](_0x1eea8c,_0xf3ba('0xcb'));if(ut[_0xf3ba('0x9d')](_0x1eea8c)>=_0x57a3b8[_0xf3ba('0xa3')]){_0x3250bf=ut[_0xf3ba('0xa4')](_0x1eea8c,0xf,_0xf3ba('0xa5'));rpcDb[_0xf3ba('0x92')](_0x3250bf,_0xf3ba('0xcc'));}else{if(_0x1eea8c[_0xf3ba('0xc8')]>=_0x57a3b8[_0xf3ba('0xcd')]){rpcDb[_0xf3ba('0x92')](_0x1eea8c,_0xf3ba('0xcb'));}else{rpcDb[_0xf3ba('0xa8')](ut[_0xf3ba('0xa9')](_0x1eea8c,'countnoanswerretry',_0x57a3b8[_0xf3ba('0xce')]),_0x1eea8c[_0xf3ba('0xab')],_0x1eea8c[_0xf3ba('0xc6')]);}}break;case _0xf3ba('0xcf'):_0x57a3b8[_0xf3ba('0x38')]+=0x1;_0x1eea8c[_0xf3ba('0xd0')]+=0x1;_0x1eea8c['countglobal']=ut[_0xf3ba('0x9d')](_0x1eea8c);ut[_0xf3ba('0x8b')](_0x1eea8c,0x8,_0xf3ba('0xd1'));ami[_0xf3ba('0x27')](_0xf3ba('0xd2'),ut['buildObj'](_0x1eea8c,_0xf3ba('0xd3')));rpcDb[_0xf3ba('0x90')](_0x1eea8c,'[callProgressDetectingCustomer][logCongestion]');if(ut[_0xf3ba('0x9d')](_0x1eea8c)>=_0x57a3b8[_0xf3ba('0xa3')]){_0x3250bf=ut['cloneAction'](_0x1eea8c,0xf,_0xf3ba('0xa5'));rpcDb[_0xf3ba('0x92')](_0x3250bf,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x1eea8c[_0xf3ba('0xd0')]>=_0x57a3b8[_0xf3ba('0xd4')]){rpcDb[_0xf3ba('0x92')](_0x1eea8c,_0xf3ba('0xd5'));}else{rpcDb['rescheduleContact'](ut[_0xf3ba('0xa9')](_0x1eea8c,_0xf3ba('0xd0'),_0x57a3b8[_0xf3ba('0xd6')]),_0x1eea8c['unlockAgent'],_0x1eea8c[_0xf3ba('0xc6')]);}}break;case _0xf3ba('0xd7'):_0x57a3b8[_0xf3ba('0x3c')]+=0x1;_0x1eea8c[_0xf3ba('0xd8')]+=0x1;_0x1eea8c[_0xf3ba('0xba')]=ut[_0xf3ba('0x9d')](_0x1eea8c);ut[_0xf3ba('0x8b')](_0x1eea8c,0x14,'AgentReject');ami['emit'](_0xf3ba('0xd9'),ut[_0xf3ba('0xa0')](_0x1eea8c,'agentreject'));rpcDb['createCustomerHistory'](_0x1eea8c,'[syncHangupRequest][logAgentReject]');if(ut[_0xf3ba('0x9d')](_0x1eea8c)>=_0x57a3b8[_0xf3ba('0xa3')]){_0x3250bf=ut['cloneAction'](_0x1eea8c,0x14,_0xf3ba('0xda'));rpcDb[_0xf3ba('0x92')](_0x3250bf,_0xf3ba('0xdb'));}else{if(_0x1eea8c[_0xf3ba('0xd8')]>=_0x57a3b8[_0xf3ba('0xdc')]){rpcDb['createCustomerFinal'](_0x1eea8c,_0xf3ba('0xdb'));}else{rpcDb[_0xf3ba('0xa8')](ut['scheduledAt'](_0x1eea8c,'countagentrejectretry',_0x57a3b8[_0xf3ba('0xdd')]),_0x1eea8c[_0xf3ba('0xab')],_0x1eea8c[_0xf3ba('0xc6')]);}}break;case _0xf3ba('0xde'):_0x57a3b8['outboundAbandonedCallsDay']+=0x1;_0x1eea8c[_0xf3ba('0xdf')]+=0x1;_0x1eea8c['countglobal']=ut['totalGlobal'](_0x1eea8c);ut['logCustomer'](_0x1eea8c,0xb,'Abandoned');rpcDb[_0xf3ba('0x90')](_0x1eea8c,_0xf3ba('0xe0'));if(ut[_0xf3ba('0x9d')](_0x1eea8c)>=_0x57a3b8[_0xf3ba('0xa3')]){_0x3250bf=ut[_0xf3ba('0xa4')](_0x1eea8c,0xf,_0xf3ba('0xa5'));rpcDb['createCustomerFinal'](_0x3250bf,_0xf3ba('0xe0'));}else{if(_0x1eea8c['countabandonedetry']>=_0x57a3b8[_0xf3ba('0xe1')]){rpcDb[_0xf3ba('0x92')](_0x1eea8c,_0xf3ba('0xe0'));}else{rpcDb['rescheduleContact'](ut[_0xf3ba('0xa9')](_0x1eea8c,_0xf3ba('0xdf'),_0x57a3b8['dialAbandonedRetryFrequency']),_0x1eea8c[_0xf3ba('0xab')],_0x1eea8c[_0xf3ba('0xc6')]);}}break;case'18':_0x57a3b8['outboundUnknownCallsDay']+=0x1;_0x1eea8c[_0xf3ba('0xe2')]+=0x1;_0x1eea8c[_0xf3ba('0xba')]=ut[_0xf3ba('0x9d')](_0x1eea8c);ut[_0xf3ba('0x8b')](_0x1eea8c,0x12,_0x1c7afc['cause-txt']||_0x1c7afc[_0xf3ba('0xe3')]);ami[_0xf3ba('0x27')](_0xf3ba('0xe4'),ut[_0xf3ba('0xa0')](_0x1eea8c,_0xf3ba('0xe5')));rpcDb[_0xf3ba('0x90')](_0x1eea8c,'[callProgressDetectingCustomer][hangupInAMD]');if(ut['totalGlobal'](_0x1eea8c)>=_0x57a3b8[_0xf3ba('0xa3')]){_0x3250bf=ut[_0xf3ba('0xa4')](_0x1eea8c,0xf,_0xf3ba('0xa5'));rpcDb['createCustomerFinal'](_0x3250bf,'[callProgressDetectingCustomer][hangupInAMD]');}else{rpcDb[_0xf3ba('0x92')](_0x1eea8c,_0xf3ba('0xe6'));}delete this['actions'][_0x1c7afc[_0xf3ba('0xac')]];break;case'19':_0x57a3b8['outboundUnknownCallsDay']+=0x1;_0x1eea8c[_0xf3ba('0xba')]=ut['totalGlobal'](_0x1eea8c);ut[_0xf3ba('0x8b')](_0x1eea8c,0x13,_0x1c7afc['cause-txt']||_0x1c7afc[_0xf3ba('0xe3')]);ami[_0xf3ba('0x27')](_0xf3ba('0xe4'),ut['buildObj'](_0x1eea8c,_0xf3ba('0xe5')));rpcDb[_0xf3ba('0x90')](_0x1eea8c,_0xf3ba('0xe7'));if(ut['totalGlobal'](_0x1eea8c)>=_0x57a3b8[_0xf3ba('0xa3')]){_0x3250bf=ut['cloneAction'](_0x1eea8c,0xf,_0xf3ba('0xa5'));rpcDb[_0xf3ba('0x92')](_0x3250bf,'[callProgressDetectingCustomer][machine]');}else{rpcDb[_0xf3ba('0x92')](_0x1eea8c,_0xf3ba('0xe7'));}delete this[_0xf3ba('0x18')][_0x1c7afc[_0xf3ba('0xac')]];break;default:if(_0x1eea8c['dialAnswer']){ut[_0xf3ba('0x7a')](_0x57a3b8,_0xf3ba('0xe8'));ut[_0xf3ba('0x7b')](_0xf3ba('0xe9')+_0x57a3b8[_0xf3ba('0x4d')],_0x1c7afc);}_0x57a3b8[_0xf3ba('0xea')]+=0x1;_0x1eea8c['countglobal']=ut[_0xf3ba('0x9d')](_0x1eea8c);ut[_0xf3ba('0x8b')](_0x1eea8c,0xc,_0x1c7afc[_0xf3ba('0xeb')]||_0x1c7afc[_0xf3ba('0xe3')]);rpcDb[_0xf3ba('0x90')](_0x1eea8c,_0xf3ba('0xec'));if(ut[_0xf3ba('0x9d')](_0x1eea8c)>=_0x57a3b8['dialGlobalMaxRetry']){_0x3250bf=ut['cloneAction'](_0x1eea8c,0xf,'Global');rpcDb['createCustomerFinal'](_0x3250bf,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb['createCustomerFinal'](_0x1eea8c,_0xf3ba('0xed'));}delete this[_0xf3ba('0x18')][_0x1c7afc[_0xf3ba('0xac')]];}if(!(_0x1eea8c['dialAnswer']&&_0x11e37e==='16')){ut[_0xf3ba('0xee')](_0x57a3b8,'[callProgressDetectingCustomer]');logger[_0xf3ba('0x54')](_0xf3ba('0xef'),_0x1eea8c['uniqueid'],'\x20Queue',_0x57a3b8[_0xf3ba('0x4d')],_0xf3ba('0x6d'),_0x57a3b8[_0xf3ba('0x59')]);}if(_0x11e37e!==_0xf3ba('0xad')){delete this[_0xf3ba('0x18')][_0x1c7afc['linkedid']];delete this[_0xf3ba('0x18')][_0x1c7afc[_0xf3ba('0xf0')]];}}};Preview[_0xf3ba('0x10')][_0xf3ba('0xf1')]=function(_0xd6e467,_0x4fcc3f,_0x494616){if(_['isUndefined'](_0x4fcc3f)&&_0xf3ba('0xf2')!==typeof _0x4fcc3f){return;}if(_[_0xf3ba('0xf3')](_0x494616)&&'object'!==typeof _0x494616){return;}switch(_0x494616[_0xf3ba('0xf4')]){case'0':ut['logAgent'](_0xd6e467,0x0,_0xf3ba('0x9e'));rpcDb[_0xf3ba('0xf5')](_0xd6e467,_0xf3ba('0xf6'));break;case'3':ut[_0xf3ba('0xf7')](_0xd6e467,0x3,_0xf3ba('0xc9'));rpcDb[_0xf3ba('0xf5')](_0xd6e467,_0xf3ba('0xf8'));break;case'5':ut[_0xf3ba('0xf7')](_0xd6e467,0x5,_0xf3ba('0xc2'));rpcDb[_0xf3ba('0xf5')](_0xd6e467,_0xf3ba('0xf9'));break;case'8':ut[_0xf3ba('0xf7')](_0xd6e467,0x8,'Congestion');rpcDb[_0xf3ba('0xf5')](_0xd6e467,_0xf3ba('0xfa'));break;case'22':ut[_0xf3ba('0xf7')](_0xd6e467,0x16,'AnswerAGI');rpcDb['createAgentHistory'](_0xd6e467,_0xf3ba('0xfb'));break;default:ut[_0xf3ba('0xf7')](_0xd6e467,0xc,_0x494616['reason']);rpcDb[_0xf3ba('0xf5')](_0xd6e467,_0xf3ba('0xfa'));}ut[_0xf3ba('0xee')](_0x4fcc3f,_0xf3ba('0xfc'));logger[_0xf3ba('0x54')](_0xf3ba('0xfd'),_0xd6e467[_0xf3ba('0xb1')],_0xf3ba('0xfe'),_0x4fcc3f[_0xf3ba('0x4d')],_0xf3ba('0x6d'),_0x4fcc3f['originated']);delete this[_0xf3ba('0x18')][_0xd6e467[_0xf3ba('0xb1')]];};Preview['prototype']['checkInBlack']=function(_0x49a32e,_0x1b07d2,_0x4ab4ef,_0x5e07f0,_0x1fd311){var _0x2ec782=this;return new BPromise(function(_0x1d2f2d,_0x7a9f4){if(_[_0xf3ba('0x6a')](_0x1b07d2)||_[_0xf3ba('0x6a')](_0x1b07d2['Contact'])||_[_0xf3ba('0x6a')](_0x1b07d2['Contact']['phone'])||_['isNil'](_0x1b07d2[_0xf3ba('0x73')])){_0x7a9f4(ut[_0xf3ba('0x46')](_0xf3ba('0xff'),_0x5e07f0,_0x1fd311));return;}var _0x300110=uuid['v4']();var _0x278954=_0x2ec782[_0xf3ba('0x15')][_0x1b07d2[_0xf3ba('0x100')]['name']];var _0x38b782=_0x4ab4ef?_0x2ec782[_0xf3ba('0x19')][_0x4ab4ef]['id']:undefined;_0x2ec782[_0xf3ba('0x18')][_0x300110]=new Action(_0x1b07d2,_0x278954,_0x300110,_0x4ab4ef,_0x38b782);var _0x37de8a=_0x2ec782[_0xf3ba('0x18')][_0x300110];_0x37de8a[_0xf3ba('0xab')]=_0x5e07f0;_0x37de8a[_0xf3ba('0xc6')]=_0x1fd311;_0x37de8a['lookAgent']=_0x4ab4ef;if(_[_0xf3ba('0x101')](_0x49a32e)){_0x2ec782[_0xf3ba('0x102')](_0x37de8a,_0x278954,_0x1b07d2,_0x4ab4ef)['then'](function(_0x1ae1e9){logger[_0xf3ba('0x54')](_0xf3ba('0x103'),_0xf3ba('0x104')+_0x37de8a[_0xf3ba('0x6c')]+_0xf3ba('0x105')+_0x37de8a[_0xf3ba('0x106')],JSON[_0xf3ba('0x50')](_0x1ae1e9));ami[_0xf3ba('0x27')](_0xf3ba('0x107'),ut[_0xf3ba('0xa0')](_0x37de8a,_0xf3ba('0x108'),_0x2ec782[_0xf3ba('0x15')][_0x37de8a[_0xf3ba('0x6c')]]));_0x1d2f2d(ut['message'](_0xf3ba('0x109')));})[_0xf3ba('0x77')](function(_0x15372e){ut[_0xf3ba('0x5b')](_0xf3ba('0x10a'),_0x15372e);_0x7a9f4(ut[_0xf3ba('0x46')]('Call\x20failed',_0x5e07f0,_0x1fd311));});}else{_0x278954[_0xf3ba('0x10b')]+=0x1;ut['logBlacklist'](_0x37de8a);rpcDb[_0xf3ba('0x10c')](_0x37de8a,_0xf3ba('0x10d'));delete _0x2ec782['actions'][_0x300110];_0x7a9f4(ut[_0xf3ba('0x46')](_0xf3ba('0x10e'),_0x5e07f0,_0x1fd311));}});};Preview['prototype'][_0xf3ba('0x96')]=function(_0x166ad8){return!_[_0xf3ba('0x6a')](_0x166ad8)&&!_['isNil'](_0x166ad8[_0xf3ba('0x4d')])&&!_[_0xf3ba('0x6a')](_0x166ad8[_0xf3ba('0x4e')])&&_0x166ad8[_0xf3ba('0x4e')]&&!_['isNil'](this['trunks'][util[_0xf3ba('0x51')](_0xf3ba('0x10f'),_0x166ad8[_0xf3ba('0x4d')])])&&!_['isNil'](this['trunks'][util[_0xf3ba('0x51')]('SIP/%s',_0x166ad8[_0xf3ba('0x4d')])][_0xf3ba('0x110')])&&(this['trunks'][util[_0xf3ba('0x51')](_0xf3ba('0x10f'),_0x166ad8[_0xf3ba('0x4d')])]['status']===_0xf3ba('0x111')||this[_0xf3ba('0x17')][util['format']('SIP/%s',_0x166ad8['name'])]['status']==='unmonitored');};Preview[_0xf3ba('0x10')][_0xf3ba('0x112')]=function(_0x2ac957,_0xe1f8c6){var _0x337e8f=this;return new BPromise(function(_0x53c44e,_0x5b9a5e){_0x337e8f['execRun'](_0x2ac957,_0xe1f8c6)[_0xf3ba('0x80')](function(_0x5e4721){_0x53c44e(_['pick'](_0x5e4721,['message']));})[_0xf3ba('0x77')](function(_0x4852c0){if(_0x4852c0[_0xf3ba('0x113')]){rpcDb[_0xf3ba('0x114')](_0x2ac957);}if(_0x4852c0['active']){rpcDb[_0xf3ba('0x115')](_0x2ac957);}_0x5b9a5e(_[_0xf3ba('0x70')](_0x4852c0,[_0xf3ba('0x46')]));});});};Preview[_0xf3ba('0x10')]['execRun']=function(_0x396614,_0x3a0291){var _0x110e43=this;return new BPromise(function(_0x110c41,_0x4afbb3){var _0x22e4b9,_0x30e0d3;rpcDb['getContactPreview'](_0x396614)[_0xf3ba('0x80')](function(_0x5670b9){if(!_[_0xf3ba('0x6a')](_0x5670b9[0x0])){_0x30e0d3=_0x5670b9[0x0][_0xf3ba('0x116')]?![]:!![];_0x22e4b9=_0x5670b9[0x0][_0xf3ba('0x116')]?!![]:![];_0x22e4b9=_0x3a0291?!![]:_0x22e4b9;}var _0x2044ce=_0x110e43[_0xf3ba('0x117')](_0x5670b9);if(_0x2044ce[_0xf3ba('0x118')]){rpcDb['checkIsBlackList'](_['pick'](_0x5670b9[0x0],[_0xf3ba('0x73'),_0xf3ba('0x119')]))[_0xf3ba('0x80')](function(_0x244795){_0x110e43['checkInBlack'](_0x244795,_0x5670b9[0x0],_0x3a0291,_0x30e0d3,_0x22e4b9)[_0xf3ba('0x80')](function(_0x5ad80f){_0x110c41(_0x5ad80f);})[_0xf3ba('0x77')](function(_0x58ba38){_0x4afbb3(_0x58ba38);});})[_0xf3ba('0x77')](function(_0x3c8027){ut[_0xf3ba('0x5b')](_0xf3ba('0x11a'),_0x3c8027);_0x4afbb3(ut[_0xf3ba('0x46')](_0xf3ba('0x11b'),_0x30e0d3,_0x22e4b9));});}else{_0x4afbb3(ut[_0xf3ba('0x46')](_0x2044ce[_0xf3ba('0x46')],_0x30e0d3,_0x22e4b9));}})[_0xf3ba('0x77')](function(_0x467c95){ut['logger'](_0xf3ba('0x11c'),_0x467c95);_0x4afbb3(ut[_0xf3ba('0x46')](_0xf3ba('0x11b'),![],!![]));});});};Preview[_0xf3ba('0x10')][_0xf3ba('0x117')]=function(_0x2a2ab7){if(_[_0xf3ba('0x6a')](_0x2a2ab7)||_[_0xf3ba('0x101')](_0x2a2ab7)||!_['isNil'](_0x2a2ab7[0x0][_0xf3ba('0x85')])&&_[_0xf3ba('0x6a')](_0x2a2ab7[0x0][_0xf3ba('0x85')][_0xf3ba('0x4d')])){ut['logger'](_0xf3ba('0x11d'),_0x2a2ab7);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x44f885=this['campaignsPreview'][_0x2a2ab7[0x0]['Queue'][_0xf3ba('0x4d')]];_0x44f885[_0xf3ba('0x46')]=_0xf3ba('0x99');if(_[_0xf3ba('0x6a')](_0x44f885)){ut[_0xf3ba('0x5b')](_0xf3ba('0x11e'),_0x44f885);return{'isValid':![],'message':_0xf3ba('0x11f')};}if(!this[_0xf3ba('0x96')](_0x44f885[_0xf3ba('0x4c')])){ut[_0xf3ba('0x5b')]('[Preview][validateContact][Trunk\x20not\x20work]',_0xf3ba('0x120')+_0x44f885[_0xf3ba('0x4d')]+'\x20Trunk\x20is\x20not\x20active');if(!this[_0xf3ba('0x96')](_0x44f885[_0xf3ba('0x97')])){ut[_0xf3ba('0x5b')](_0xf3ba('0x121'),_0x44f885[_0xf3ba('0x4d')]+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0xf3ba('0x122')};}}if(!ut[_0xf3ba('0x95')](_0x44f885[_0xf3ba('0x32')])){ut[_0xf3ba('0x5b')](_0xf3ba('0x123'),_0x44f885[_0xf3ba('0x4d')]+_0xf3ba('0x124'));return{'isValid':![],'message':_0xf3ba('0x120')+_0x44f885[_0xf3ba('0x4d')]+_0xf3ba('0x124')};}return{'isValid':!![],'message':_0xf3ba('0x125')};};Preview[_0xf3ba('0x10')]['execCall']=function(_0x4e14c6,_0x1b491,_0x1bf1ea,_0x446c82){var _0x5d949f=this;return new BPromise(function(_0x32476c,_0x3d7ba1){var _0x5c8917=_0x4e14c6[_0xf3ba('0xb1')];var _0x24d80c=_0x5d949f[_0xf3ba('0x96')](_0x1b491[_0xf3ba('0x4c')])?util['format']('SIP/%s/%s%s',_0x1b491[_0xf3ba('0x4c')]['name'],_[_0xf3ba('0x6a')](_0x1b491['dialPrefix'])?'':_0x1b491[_0xf3ba('0x126')]['trim']()||'',_0x1b491['dialCutDigit']>0x0?_0x1bf1ea[_0xf3ba('0x127')]['phone']['substring'](_0x1b491[_0xf3ba('0x128')]):_0x1bf1ea['Contact'][_0xf3ba('0x129')]):util[_0xf3ba('0x51')](_0xf3ba('0x12a'),_[_0xf3ba('0x6a')](_0x1b491[_0xf3ba('0x97')])?_0x1b491['Trunk'][_0xf3ba('0x4d')]:_0x1b491['TrunkBackup'][_0xf3ba('0x4d')],_['isNil'](_0x1b491[_0xf3ba('0x126')])?'':_0x1b491[_0xf3ba('0x126')][_0xf3ba('0x12b')]()||'',_0x1b491[_0xf3ba('0x128')]>0x0?_0x1bf1ea['Contact'][_0xf3ba('0x129')][_0xf3ba('0x12c')](_0x1b491[_0xf3ba('0x128')]):_0x1bf1ea[_0xf3ba('0x127')]['phone']);var _0x4fb52b=_0x5d949f['isTrunkReachable'](_0x1b491[_0xf3ba('0x4c')])?ut[_0xf3ba('0x12d')](_0x1b491[_0xf3ba('0x4c')][_0xf3ba('0x12e')],_0x1b491['dialOriginateCallerIdName'],_0x1b491[_0xf3ba('0x12f')]>0x0?ut[_0xf3ba('0x130')](_0x1b491[_0xf3ba('0x34')],_0x1b491[_0xf3ba('0x12f')]):_0x1b491[_0xf3ba('0x34')]):ut[_0xf3ba('0x12d')](_[_0xf3ba('0x6a')](_0x1b491['TrunkBackup'])?_0x1b491[_0xf3ba('0x4c')][_0xf3ba('0x12e')]:_0x1b491[_0xf3ba('0x97')][_0xf3ba('0x12e')],_0x1b491['dialOriginateCallerIdName'],_0x1b491[_0xf3ba('0x12f')]>0x0?ut[_0xf3ba('0x130')](_0x1b491[_0xf3ba('0x34')],_0x1b491[_0xf3ba('0x12f')]):_0x1b491[_0xf3ba('0x34')]);if(_0x4fb52b){_0x4e14c6[_0xf3ba('0x131')]=ut[_0xf3ba('0x132')](_0x4fb52b);_0x4e14c6[_0xf3ba('0x133')]=ut[_0xf3ba('0x134')](_0x4fb52b);}var _0x30f6a2=ut[_0xf3ba('0x135')](_0x1b491,_0x1bf1ea,_0x24d80c,_0x4fb52b,_0x5c8917,_0x4e14c6);_[_0xf3ba('0x136')](_0x4e14c6,ut[_0xf3ba('0x137')](_0x30f6a2));_0x4e14c6[_0xf3ba('0x89')]=moment()[_0xf3ba('0x51')]('YYYY-MM-DD\x20HH:mm:ss');ami[_0xf3ba('0x75')](ut[_0xf3ba('0x138')](_0x4e14c6,_0x1b491,_0x30f6a2,_0x4e14c6[_0xf3ba('0xc6')],_0x446c82))[_0xf3ba('0x80')](function(_0x38bde8){_0x1b491['originated']+=0x1;logger[_0xf3ba('0x54')](_0xf3ba('0x139'),_0x5c8917,'\x20Queue',_0x1b491[_0xf3ba('0x4d')],_0xf3ba('0x6d'),_0x1b491[_0xf3ba('0x59')]);_0x32476c(_0x38bde8);})[_0xf3ba('0x77')](function(_0x37738e){ut[_0xf3ba('0xf7')](_0x4e14c6,0xe,_0xf3ba('0x13a'));rpcDb['createAgentHistory'](_0x4e14c6,_0xf3ba('0x13b'));_0x3d7ba1(_0x37738e);});});};Preview[_0xf3ba('0x10')][_0xf3ba('0x22')]=function(_0x218d49){if(this[_0xf3ba('0x18')][_0x218d49['linkedid']]){this[_0xf3ba('0x18')][_0x218d49[_0xf3ba('0xac')]]['channel']=_0x218d49[_0xf3ba('0x76')];}};Preview[_0xf3ba('0x10')][_0xf3ba('0x13c')]=function(_0x113dbb){var _0x21d3b0=this;var _0x1b1cee=this[_0xf3ba('0x18')][_0x113dbb['actionid']];if(_0x1b1cee){if(_0x1b1cee[_0xf3ba('0x13d')]&&this[_0xf3ba('0x19')][_0x1b1cee[_0xf3ba('0x13d')]]){ut[_0xf3ba('0x13e')](_0x1b1cee,this['agents'][_0x1b1cee['lookAgent']][_0xf3ba('0x4d')],this[_0xf3ba('0x19')][_0x1b1cee['lookAgent']]['id']);}var _0x5ad438=_['clone'](_0x1b1cee);_0x5ad438['responsetime']=moment()[_0xf3ba('0x51')](_0xf3ba('0x8a'));var _0x3c3f9c=_0x21d3b0[_0xf3ba('0x15')][_0x1b1cee[_0xf3ba('0x6c')]];if(ut[_0xf3ba('0x13f')](_0x113dbb['response'])){if(_0x1b1cee['unlockAgent']){rpcDb[_0xf3ba('0x114')](_0x1b1cee['idContact']);}if(_0x1b1cee[_0xf3ba('0xc6')]){rpcDb[_0xf3ba('0x115')](_0x1b1cee[_0xf3ba('0x106')]);}ami[_0xf3ba('0x27')](_0xf3ba('0x140'),ut['buildObj'](_0x1b1cee,_0xf3ba('0x141'),this[_0xf3ba('0x15')][_0x1b1cee[_0xf3ba('0x6c')]]));this[_0xf3ba('0xf1')](_0x5ad438,_0x3c3f9c,_0x113dbb);}else{_0x1b1cee[_0xf3ba('0x89')]=moment()[_0xf3ba('0x51')](_0xf3ba('0x8a'));ut['logAgent'](_0x5ad438,0x4,'Answer');rpcDb['createAgentHistory'](_0x5ad438,'[callProgressDetectingAgent][logAnswer]');}}};Preview[_0xf3ba('0x10')][_0xf3ba('0x1d')]=function(_0x17243d){var _0x4423ad=this;var _0x2e14f2=this[_0xf3ba('0x18')][_0x17243d['linkedid']];var _0x9e10b4;if(_0x2e14f2){_0x9e10b4=this['campaignsPreview'][_0x2e14f2[_0xf3ba('0x6c')]];logger['info'](_0xf3ba('0x142'),_0x17243d[_0xf3ba('0xac')],_0xf3ba('0xfe'),_0x9e10b4[_0xf3ba('0x4d')],_0xf3ba('0x6e'),_0x9e10b4[_0xf3ba('0x2d')]);}if(this[_0xf3ba('0x18')][_0x17243d['linkedid']]&&_0x17243d[_0xf3ba('0xac')]!==_0x17243d['uniqueid']){if(_0x17243d[_0xf3ba('0x143')]==='16'&&this['actions'][_0x17243d['linkedid']]['dialAnswer']){this[_0xf3ba('0x9a')](_0x17243d,_0x17243d['linkedid'],_0x17243d[_0xf3ba('0x143')]);}else if(this[_0xf3ba('0x18')][_0x17243d['linkedid']][_0xf3ba('0x6f')]){logger[_0xf3ba('0x54')]('[syncHangup][talking][cause]',_0x17243d['linkedid'],_0x17243d['cause'],_0xf3ba('0xfe'),_0x9e10b4['name'],_0xf3ba('0x6e'),_0x9e10b4['pTalking']);this[_0xf3ba('0x9a')](_0x17243d,_0x17243d[_0xf3ba('0xac')],_0x17243d[_0xf3ba('0x143')]);}}else if(_0x2e14f2&&_[_0xf3ba('0x6a')](_0x2e14f2[_0xf3ba('0x144')])&&_0x9e10b4[_0xf3ba('0x145')]&&_0x17243d[_0xf3ba('0xac')]===_0x17243d[_0xf3ba('0xb1')]&&_[_0xf3ba('0x6a')](_0x17243d[_0xf3ba('0xf4')])&&_0x17243d[_0xf3ba('0x143')]==='16'&&_0x17243d[_0xf3ba('0x146')]==='6'&&_[_0xf3ba('0xf3')](_0x2e14f2[_0xf3ba('0x147')])){if(_0x2e14f2['unlockAgent']){rpcDb['unlockContact'](_0x2e14f2['idContact']);}if(_0x2e14f2[_0xf3ba('0xc6')]){rpcDb['disableContact'](_0x2e14f2[_0xf3ba('0x106')]);}_0x17243d[_0xf3ba('0xf4')]='22';this[_0xf3ba('0xf1')](_0x2e14f2,_0x9e10b4,_0x17243d);}else if(_0x2e14f2&&_0x2e14f2[_0xf3ba('0x147')]){if(_0x17243d[_0xf3ba('0x143')]==='16'&&this[_0xf3ba('0x18')][_0x17243d['linkedid']][_0xf3ba('0x6f')]){logger[_0xf3ba('0x54')](_0xf3ba('0x148'),_0x17243d[_0xf3ba('0xac')],_0x17243d[_0xf3ba('0x143')],_0xf3ba('0xfe'),_0x9e10b4[_0xf3ba('0x4d')],_0xf3ba('0x6e'),_0x9e10b4[_0xf3ba('0x2d')]);this[_0xf3ba('0x9a')](_0x17243d,_0x17243d[_0xf3ba('0xac')],_0x17243d['cause']);}else if(this[_0xf3ba('0x18')][_0x17243d['linkedid']][_0xf3ba('0x6f')]){logger['info']('[syncHangup][talking][cause]',_0x17243d[_0xf3ba('0xac')],_0x17243d[_0xf3ba('0x143')],_0xf3ba('0xfe'),_0x9e10b4['name'],'pTalking:\x20',_0x9e10b4['pTalking']);this[_0xf3ba('0x9a')](_0x17243d,_0x17243d[_0xf3ba('0xac')],_0x17243d['cause']);}}};Preview['prototype'][_0xf3ba('0x20')]=function(_0x12e79c){if(this[_0xf3ba('0x18')][_0x12e79c[_0xf3ba('0xf0')]]&&_0x12e79c[_0xf3ba('0xf0')]!==_0x12e79c[_0xf3ba('0x149')]){this[_0xf3ba('0x9a')](_0x12e79c,_0x12e79c['destlinkedid'],_0x12e79c[_0xf3ba('0xe3')]);}};Preview[_0xf3ba('0x10')][_0xf3ba('0x14a')]=function(_0x48b172){if(this[_0xf3ba('0x18')][_0x48b172['linkedid']]&&_0x48b172['linkedid']!==_0x48b172['uniqueid']&&!this['actions'][_0x48b172[_0xf3ba('0xac')]][_0xf3ba('0x6f')]){if(_0x48b172[_0xf3ba('0x143')]==='1'){this[_0xf3ba('0x9a')](_0x48b172,_0x48b172[_0xf3ba('0xac')],_0x48b172[_0xf3ba('0x143')]);}}};Preview['prototype']['addVariable']=function(_0x4e6fff,_0x392021,_0x2421d0){if(this[_0xf3ba('0x18')][_0x4e6fff]){if(_[_0xf3ba('0x6a')](this['actions'][_0x4e6fff][_0xf3ba('0x14b')])){this[_0xf3ba('0x18')][_0x4e6fff][_0xf3ba('0x14b')]={};}this['actions'][_0x4e6fff][_0xf3ba('0x14b')][_0x392021]=_0x2421d0;}};Preview[_0xf3ba('0x10')][_0xf3ba('0x14c')]=function(_0x215f0b){try{if(!_[_0xf3ba('0x6a')](_0x215f0b)){if(ut['filterKey'](_['keys'](_0x215f0b[_0xf3ba('0x14d')])[0x0])){this[_0xf3ba('0x14e')](_0x215f0b[_0xf3ba('0xb1')],_[_0xf3ba('0x14f')](_0x215f0b['variable'])[0x0],_0x215f0b[_0xf3ba('0x150')]);}}}catch(_0x3cd801){logger[_0xf3ba('0x151')](_0xf3ba('0x152'),util['inspect'](_0x3cd801,{'showHidden':![],'depth':null}));}};Preview[_0xf3ba('0x10')][_0xf3ba('0x153')]=function(_0x20ea29){if(_0x20ea29){if(this[_0xf3ba('0x18')][_0x20ea29['transfertargetlinkedid']]){this[_0xf3ba('0x18')][_0x20ea29[_0xf3ba('0x154')]]['transfer']=!![];}}};Preview[_0xf3ba('0x10')]['syncBlindTransfer']=function(_0x2df87b){if(_0x2df87b){if(this[_0xf3ba('0x18')][_0x2df87b[_0xf3ba('0x155')]]){this[_0xf3ba('0x18')][_0x2df87b[_0xf3ba('0x155')]][_0xf3ba('0x147')]=!![];}}};module[_0xf3ba('0x156')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index f182c24..81cc51d 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 _0x808e=['answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','from-sip','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','membername','queuecallerexitreason','COMPLETED','create','getContactRecallMe','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','../../../config/logger','preview','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','error','inspect','then','createHistory','catch','[createHistory]\x20','resolve','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','[getContactPreview]\x20','createAgentHistory','rescheduleContact','UserId','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt'];(function(_0x8df671,_0x92ff2f){var _0x34c072=function(_0x555f32){while(--_0x555f32){_0x8df671['push'](_0x8df671['shift']());}};_0x34c072(++_0x92ff2f);}(_0x808e,0x83));var _0xe808=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x808e[_0x550d12];return _0x12103d;};'use strict';var util=require(_0xe808('0x0'));var BPromise=require('bluebird');var logger=require(_0xe808('0x1'))(_0xe808('0x2'));var _=require(_0xe808('0x3'));var cmHopper=require(_0xe808('0x4'));var cmHopperFinal=require(_0xe808('0x5'));var cmHopperHistory=require(_0xe808('0x6'));var cmHopperBlack=require(_0xe808('0x7'));var voiceQueueRt=require(_0xe808('0x8'));var agentReportPreview=require(_0xe808('0x9'));var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x24e331){return function(_0x296a2c){logger[_0xe808('0xa')](_0x24e331,util[_0xe808('0xb')](_0x296a2c,{'showHidden':![],'depth':null}));};}function create(_0x569968){return BPromise['resolve']()[_0xe808('0xc')](cmHopperHistory[_0xe808('0xd')](_0x569968))[_0xe808('0xe')](loggerCatch(_0xe808('0xf')));}function createAgent(_0x21ff1c){return BPromise['resolve']()[_0xe808('0xc')](agentReportPreview[_0xe808('0xd')](_0x21ff1c))[_0xe808('0xe')](loggerCatch(_0xe808('0xf')));}function moveContact(_0x47d91a){return BPromise[_0xe808('0x10')]()[_0xe808('0xc')](cmHopper[_0xe808('0x11')](_0x47d91a,!![]))['catch'](loggerCatch(_0xe808('0x12')));}exports[_0xe808('0x13')]=function(_0x2cc40c){return BPromise[_0xe808('0x10')]()[_0xe808('0xc')](cmHopperBlack['checkIsBlackList'](_0x2cc40c))[_0xe808('0xe')](loggerCatch(_0xe808('0x14')));};exports['getContactPreview']=function(_0x498cd6){return BPromise[_0xe808('0x10')]()[_0xe808('0xc')](cmHopper['getContactPreview'](_0x498cd6))['catch'](loggerCatch(_0xe808('0x15')));};exports[_0xe808('0xd')]=function(_0x403964,_0x43af26){create(_0x403964)[_0xe808('0xe')](loggerCatch(_0x43af26));moveContact(_0x403964)['catch'](loggerCatch(_0x43af26));};exports[_0xe808('0x16')]=function(_0x27d263,_0x1c3749){createAgent(_0x27d263)[_0xe808('0xe')](loggerCatch(_0x1c3749));};exports['createCustomerHistory']=function(_0x59325e,_0x156526){create(_0x59325e)[_0xe808('0xe')](loggerCatch(_0x156526));};exports['createCustomerFinal']=function(_0x2edf70,_0x3e191d){moveContact(_0x2edf70)[_0xe808('0xe')](loggerCatch(_0x3e191d));};exports[_0xe808('0x17')]=function(_0x50faaa,_0x13d1b2,_0x5ebf37){if(_0x13d1b2){_0x50faaa[_0xe808('0x18')]=null;}if(_0x5ebf37){_0x50faaa['active']=![];}return BPromise[_0xe808('0x10')]()[_0xe808('0xc')](cmHopper[_0xe808('0x17')](_0x50faaa))[_0xe808('0xe')](loggerCatch('[rescheduleContact]\x20'));};exports['countReScheduled']=function(_0x56df93){return BPromise[_0xe808('0x10')]()['then'](cmHopper[_0xe808('0x19')](_0x56df93))['catch'](loggerCatch(_0xe808('0x1a')));};exports['unlockContact']=function(_0x1a35ec){return BPromise['resolve']()[_0xe808('0xc')](cmHopper[_0xe808('0x1b')]({'UserId':null},_0x1a35ec,0x1))['catch'](loggerCatch(_0xe808('0x1c')));};exports['disableContact']=function(_0x14d0dd){return BPromise[_0xe808('0x10')]()[_0xe808('0xc')](cmHopper[_0xe808('0x1b')]({'active':![]},_0x14d0dd,0x1))[_0xe808('0xe')](loggerCatch(_0xe808('0x1d')));};exports[_0xe808('0x1e')]=function(_0x2e07ed){var _0x5e3bee={};_0x5e3bee[_0xe808('0x1f')]=_0x2e07ed[_0xe808('0x1f')];_0x5e3bee[_0xe808('0x20')]=_0x2e07ed['uniqueid'];_0x5e3bee[_0xe808('0x21')]=_0x2e07ed[_0xe808('0x21')];_0x5e3bee[_0xe808('0x22')]=_0x2e07ed[_0xe808('0x22')];_0x5e3bee[_0xe808('0x23')]=_0x2e07ed['queue'];_0x5e3bee[_0xe808('0x24')]=_0x2e07ed[_0xe808('0x25')];_0x5e3bee[_0xe808('0x26')]=_0x2e07ed[_0xe808('0x25')];_0x5e3bee[_0xe808('0x27')]=0x1;_0x5e3bee[_0xe808('0x28')]=_0x2e07ed[_0xe808('0x29')];_0x5e3bee[_0xe808('0x2a')]=_0x2e07ed['membername'];_0x5e3bee['context']=_0xe808('0x2b');_0x5e3bee[_0xe808('0x2c')]=_0xe808('0x2d');_0x5e3bee[_0xe808('0x2e')]=0x0;_0x5e3bee[_0xe808('0x2f')]=0x1;_0x5e3bee[_0xe808('0x30')]=_0x2e07ed[_0xe808('0x31')];_0x5e3bee[_0xe808('0x32')]=_0xe808('0x33');return BPromise[_0xe808('0x10')]()[_0xe808('0xc')](voiceQueueReport[_0xe808('0x34')](_0x5e3bee))[_0xe808('0xe')](loggerCatch('[voiceQueueReport]\x20'));};exports[_0xe808('0x35')]=function(_0x4b4576,_0x7974dd){return BPromise[_0xe808('0x10')]()[_0xe808('0xc')](cmHopper['getContactRecallMe'](_0x4b4576,_0x7974dd))[_0xe808('0xe')](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0xe808('0x36')]=function(_0x1d1357){return BPromise[_0xe808('0x10')]()[_0xe808('0xc')](cmHopper[_0xe808('0x17')](_0x1d1357,!![],!![]))[_0xe808('0xe')](loggerCatch(_0xe808('0x37')));}; \ No newline at end of file +var _0xf401=['../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','resolve','then','createHistory','catch','[createHistory]\x20','moveContactManagedDialer','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerFinal','UserId','active','rescheduleContact','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','context','from-sip','holdtime','assigned','lastAssignedTo','membername','queuecallerexitreason','COMPLETED','[voiceQueueReport]\x20','getContactRecallMe','util','bluebird','../../../config/logger','preview','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory'];(function(_0x217a6f,_0x3ecd8b){var _0x5553f3=function(_0x24b9c0){while(--_0x24b9c0){_0x217a6f['push'](_0x217a6f['shift']());}};_0x5553f3(++_0x3ecd8b);}(_0xf401,0x1de));var _0x1f40=function(_0x3075ee,_0x45b794){_0x3075ee=_0x3075ee-0x0;var _0x55196a=_0xf401[_0x3075ee];return _0x55196a;};'use strict';var util=require(_0x1f40('0x0'));var BPromise=require(_0x1f40('0x1'));var logger=require(_0x1f40('0x2'))(_0x1f40('0x3'));var _=require(_0x1f40('0x4'));var cmHopper=require(_0x1f40('0x5'));var cmHopperFinal=require(_0x1f40('0x6'));var cmHopperHistory=require(_0x1f40('0x7'));var cmHopperBlack=require(_0x1f40('0x8'));var voiceQueueRt=require(_0x1f40('0x9'));var agentReportPreview=require(_0x1f40('0xa'));var voiceQueueReport=require(_0x1f40('0xb'));function loggerCatch(_0x4c2d87){return function(_0x14be4b){logger[_0x1f40('0xc')](_0x4c2d87,util['inspect'](_0x14be4b,{'showHidden':![],'depth':null}));};}function create(_0x1701b9){return BPromise[_0x1f40('0xd')]()[_0x1f40('0xe')](cmHopperHistory[_0x1f40('0xf')](_0x1701b9))[_0x1f40('0x10')](loggerCatch(_0x1f40('0x11')));}function createAgent(_0x37fccd){return BPromise[_0x1f40('0xd')]()[_0x1f40('0xe')](agentReportPreview[_0x1f40('0xf')](_0x37fccd))[_0x1f40('0x10')](loggerCatch(_0x1f40('0x11')));}function moveContact(_0x28dbdb){return BPromise[_0x1f40('0xd')]()[_0x1f40('0xe')](cmHopper[_0x1f40('0x12')](_0x28dbdb,!![]))[_0x1f40('0x10')](loggerCatch('[moveContactManagedDialer]\x20'));}exports['checkIsBlackList']=function(_0x1340ed){return BPromise[_0x1f40('0xd')]()[_0x1f40('0xe')](cmHopperBlack['checkIsBlackList'](_0x1340ed))[_0x1f40('0x10')](loggerCatch(_0x1f40('0x13')));};exports[_0x1f40('0x14')]=function(_0x2fe973){return BPromise[_0x1f40('0xd')]()[_0x1f40('0xe')](cmHopper[_0x1f40('0x14')](_0x2fe973))[_0x1f40('0x10')](loggerCatch(_0x1f40('0x15')));};exports[_0x1f40('0xf')]=function(_0x31674c,_0x35497e){create(_0x31674c)[_0x1f40('0x10')](loggerCatch(_0x35497e));moveContact(_0x31674c)[_0x1f40('0x10')](loggerCatch(_0x35497e));};exports[_0x1f40('0x16')]=function(_0x10bc3e,_0x36adf3){createAgent(_0x10bc3e)['catch'](loggerCatch(_0x36adf3));};exports['createCustomerHistory']=function(_0x554ce0,_0x238768){create(_0x554ce0)[_0x1f40('0x10')](loggerCatch(_0x238768));};exports[_0x1f40('0x17')]=function(_0x52b3c5,_0x2e245b){moveContact(_0x52b3c5)[_0x1f40('0x10')](loggerCatch(_0x2e245b));};exports['rescheduleContact']=function(_0x15a10d,_0x2d7841,_0x512e25){if(_0x2d7841){_0x15a10d[_0x1f40('0x18')]=null;}if(_0x512e25){_0x15a10d[_0x1f40('0x19')]=![];}return BPromise[_0x1f40('0xd')]()[_0x1f40('0xe')](cmHopper[_0x1f40('0x1a')](_0x15a10d))[_0x1f40('0x10')](loggerCatch(_0x1f40('0x1b')));};exports[_0x1f40('0x1c')]=function(_0x5ec6e0){return BPromise['resolve']()[_0x1f40('0xe')](cmHopper[_0x1f40('0x1c')](_0x5ec6e0))['catch'](loggerCatch(_0x1f40('0x1d')));};exports['unlockContact']=function(_0x3a887b){return BPromise[_0x1f40('0xd')]()[_0x1f40('0xe')](cmHopper[_0x1f40('0x1e')]({'UserId':null},_0x3a887b,0x1))['catch'](loggerCatch(_0x1f40('0x1f')));};exports[_0x1f40('0x20')]=function(_0x3d585a){return BPromise[_0x1f40('0xd')]()[_0x1f40('0xe')](cmHopper[_0x1f40('0x1e')]({'active':![]},_0x3d585a,0x1))[_0x1f40('0x10')](loggerCatch(_0x1f40('0x21')));};exports[_0x1f40('0x22')]=function(_0x47adbb){var _0x531a75={};_0x531a75[_0x1f40('0x23')]=_0x47adbb[_0x1f40('0x23')];_0x531a75[_0x1f40('0x24')]=_0x47adbb[_0x1f40('0x24')];_0x531a75['calleridnum']=_0x47adbb[_0x1f40('0x25')];_0x531a75[_0x1f40('0x26')]=_0x47adbb['calleridname'];_0x531a75[_0x1f40('0x27')]=_0x47adbb[_0x1f40('0x27')];_0x531a75[_0x1f40('0x28')]=_0x47adbb[_0x1f40('0x29')];_0x531a75[_0x1f40('0x2a')]=_0x47adbb['answertime'];_0x531a75[_0x1f40('0x2b')]=0x1;_0x531a75['queuecallercompleteAt']=_0x47adbb['endtime'];_0x531a75['connectedlinename']=_0x47adbb['membername'];_0x531a75[_0x1f40('0x2c')]=_0x1f40('0x2d');_0x531a75['exten']='xcally-motion-preview';_0x531a75[_0x1f40('0x2e')]=0x0;_0x531a75[_0x1f40('0x2f')]=0x1;_0x531a75[_0x1f40('0x30')]=_0x47adbb[_0x1f40('0x31')];_0x531a75[_0x1f40('0x32')]=_0x1f40('0x33');return BPromise[_0x1f40('0xd')]()[_0x1f40('0xe')](voiceQueueReport['create'](_0x531a75))[_0x1f40('0x10')](loggerCatch(_0x1f40('0x34')));};exports[_0x1f40('0x35')]=function(_0x50ece7,_0x274aee){return BPromise[_0x1f40('0xd')]()[_0x1f40('0xe')](cmHopper[_0x1f40('0x35')](_0x50ece7,_0x274aee))[_0x1f40('0x10')](loggerCatch('[GetContactRecallMe]\x20'));};exports['rescheduleContactInQueue']=function(_0x4cff6e){return BPromise['resolve']()[_0x1f40('0xe')](cmHopper[_0x1f40('0x1a')](_0x4cff6e,!![],!![]))[_0x1f40('0x10')](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ No newline at end of file diff --git a/server/services/ami/preview/util/util.js b/server/services/ami/preview/util/util.js index d7ab1a3..d5d2b5a 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 _0x02c5=['Failure','variablesAction','RECALL','BOOKED','uniqueid','originate','channelAgent','from-sip','timeout','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','cloneAction','clone','Global','scheduledAt','scheduledat','add','minutes','ListId','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','IsNotLoggedIn','buildObj','lastevent','queue','interface','motionChannel','voice','buildAcw','agentReadyId','not_inuse','getDiff','seconds','CampaignId','filterKey','idContact','type','campaigntype','dialAnswer','active','callback','callbackat','recallme','UserId','sipcallid','xmd-voicequeueid','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialchannel','xmd-contactid','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosjitter','rtpaudioqoslossbridged','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','match','lodash','moment','../../../../config/logger','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','inspect','loggerError','error','logger2','info','message','isEmpty','isUndefined','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','addVariables','Queue','name','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','monitor_format','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','isNil','tags','createdAt','updatedAt','XMD-','toUpper','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','Blacklist','starttime','responsetime','logAgent','YYYY-MM-DD\x20HH:mm:ss','statedesc','logLookAgent','membername','logCustomer','state','endtime','talktime','answertime'];(function(_0x43d11d,_0xccff91){var _0x38cd08=function(_0x131ae2){while(--_0x131ae2){_0x43d11d['push'](_0x43d11d['shift']());}};_0x38cd08(++_0xccff91);}(_0x02c5,0x1e8));var _0x502c=function(_0x36436d,_0x20292c){_0x36436d=_0x36436d-0x0;var _0x34615d=_0x02c5[_0x36436d];return _0x34615d;};'use strict';var util=require('util');var _=require(_0x502c('0x0'));var moment=require(_0x502c('0x1'));var logger=require(_0x502c('0x2'))('preview');var ipAgi=process[_0x502c('0x3')][_0x502c('0x4')]||_0x502c('0x5');function getSeconds(_0x5d71a9,_0x13eb5a){var _0x69826c=moment(_0x5d71a9)['milliseconds'](0x0);var _0x3f4b85=moment(_0x13eb5a)[_0x502c('0x6')](0x0);return _0x69826c[_0x502c('0x7')](_0x3f4b85,'seconds');}exports['loggerCatch']=function(_0x25543a){return function(_0x96348c){logger['error'](_0x25543a,util[_0x502c('0x8')](_0x96348c,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x5d7377,_0x52a544){logger['info'](_0x5d7377,util[_0x502c('0x8')](_0x52a544,{'showHidden':![],'depth':null}));};exports[_0x502c('0x9')]=function(_0x19efbd,_0x6bae8f){logger[_0x502c('0xa')](_0x19efbd,util[_0x502c('0x8')](_0x6bae8f,{'showHidden':![],'depth':null}));};exports[_0x502c('0xb')]=function(_0x571d4c){return function(_0x4477a7){logger[_0x502c('0xc')](_0x571d4c,util[_0x502c('0x8')](_0x4477a7,{'showHidden':![],'depth':null}));};};exports[_0x502c('0xd')]=function(_0x275c9f,_0x35b327,_0xfe4e38){return{'message':_0x275c9f,'unlock':_0x35b327,'active':_0xfe4e38};};exports['getCallerId']=function(_0x37abe2,_0x30ab7a,_0x29d1dd){if(!_['isUndefined'](_0x29d1dd)&&'string'===typeof _0x29d1dd&&!_[_0x502c('0xe')](_0x29d1dd)){if(!_[_0x502c('0xf')](_0x30ab7a)&&_0x502c('0x10')===typeof _0x30ab7a&&!_['isEmpty'](_0x30ab7a)){return util[_0x502c('0x11')](_0x502c('0x12'),_0x30ab7a,_0x29d1dd);}return util['format'](_0x502c('0x12'),_0x29d1dd,_0x29d1dd);}if(!_['isUndefined'](_0x37abe2)&&'string'===typeof _0x37abe2&&!_[_0x502c('0xe')](_0x37abe2)){return _0x37abe2;}return _0x502c('0x13');};exports[_0x502c('0x14')]=function(_0x56589e){if(_['isNil'](_0x56589e)){return![];}return _0x56589e;};exports[_0x502c('0x15')]=function(_0x11798c,_0x47ccf5,_0x179fc5,_0xb6d628,_0x4802fc,_0x44222c){var _0x140a31={'XMD-QUEUE':_0x47ccf5['Queue']?_0x47ccf5[_0x502c('0x16')][_0x502c('0x17')]:'','XMD-CALLERID':_0xb6d628,'XMD-CALLERID-PREVIEW':_0x44222c?util[_0x502c('0x11')](_0x502c('0x12'),_0x44222c[_0x502c('0x18')],_0x44222c[_0x502c('0x19')]):_0xb6d628,'XMD-DIALID':_0x4802fc,'XMD-CONTACTID':_0x47ccf5[_0x502c('0x1a')],'XMD-CDRTYPE':_0x502c('0x1b'),'CALLERID(all)':_0xb6d628,'XMD-VOICEQUEUEID':_0x47ccf5[_0x502c('0x1c')],'XMD-DIALCHANNEL':_0x179fc5,'XMD-DIALTIMEOUT':_0x11798c[_0x502c('0x1d')]||0x1e,'XMD-DIALOPTIONS':util[_0x502c('0x11')](_0x502c('0x1e'),_0x11798c[_0x502c('0x1f')]?'g':'',_['isEmpty'](_0x11798c['monitor_format'])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x11798c['dialPreviewUrl']||'','XMD-AGI':_0x11798c[_0x502c('0x20')]?util[_0x502c('0x11')](_0x502c('0x21'),ipAgi,_0x11798c['dialQueueProject']):'NONE','XMD-AGIAFTER':_0x11798c['dialQueueProject2']?util[_0x502c('0x11')](_0x502c('0x21'),ipAgi,_0x11798c[_0x502c('0x1f')]):_0x502c('0x22'),'XMD-ORIGINATECALLERIDNUM':_0x44222c?_0x44222c[_0x502c('0x23')]:'','XMD-ORIGINATECALLERIDNAME':_0x44222c?_0x44222c[_0x502c('0x24')]:'','XMD-DESTINATION':_0x502c('0x25'),'SIPADDHEADER':'Call-Type:\x20PREVIEW'};if(!_['isEmpty'](_0x11798c[_0x502c('0x26')])){_0x140a31[util[_0x502c('0x11')]('%s',_0x502c('0x27'))]=_0x11798c[_0x502c('0x26')];_0x140a31[util[_0x502c('0x11')]('%s',_0x502c('0x28'))]=_0x4802fc;}if(_0x47ccf5&&_0x47ccf5[_0x502c('0x29')]){for(var _0x81231 in _0x47ccf5[_0x502c('0x29')]){if(_0x47ccf5[_0x502c('0x29')][_0x502c('0x2a')](_0x81231)){if(!_[_0x502c('0x2b')](_0x47ccf5[_0x502c('0x29')][_0x81231])&&_0x81231!=='id'&&_0x81231!==_0x502c('0x2c')&&_0x81231!==_0x502c('0x2d')&&_0x81231!==_0x502c('0x2e')){_0x140a31[util[_0x502c('0x11')]('%s%s',_0x502c('0x2f'),_[_0x502c('0x30')](_0x81231))]=_0x47ccf5['Contact'][_0x81231];}}}}return _0x140a31;};exports['toLowerVariables']=function(_0x1e35dd){var _0x793d1a={};for(var _0x3a6c01 in _0x1e35dd){if(_0x1e35dd[_0x502c('0x2a')](_0x3a6c01)){_0x793d1a[util[_0x502c('0x11')]('%s',_[_0x502c('0x31')](_0x3a6c01))]=_0x1e35dd[_0x3a6c01];}}return{'variables':_0x793d1a};};exports[_0x502c('0x32')]=function(_0x14046f,_0x363ec0){if(!_['isNil'](_0x14046f)){if(_0x14046f[_0x502c('0x2a')](_0x502c('0x33'))){if(_0x14046f['originated']>0x0){_0x14046f[_0x502c('0x33')]-=0x1;}else{logger['error'](_0x502c('0x34'),_0x363ec0);}}}else{logger[_0x502c('0xa')](_0x502c('0x35'),_0x363ec0);}};exports[_0x502c('0x36')]=function(_0x475ba8){var _0x1303a2=moment()[_0x502c('0x11')]('YYYY-MM-DD\x20HH:mm:ss');_0x475ba8['state']=0xd;_0x475ba8['statedesc']=_0x502c('0x37');_0x475ba8[_0x502c('0x38')]=_0x1303a2;_0x475ba8[_0x502c('0x39')]=_0x1303a2;_0x475ba8['endtime']=_0x1303a2;};exports[_0x502c('0x3a')]=function(_0x55af7b,_0x33aea7,_0x45900e){var _0x2f1003=moment()[_0x502c('0x11')](_0x502c('0x3b'));_0x55af7b['state']=_0x33aea7;_0x55af7b[_0x502c('0x3c')]=_0x45900e;_0x55af7b[_0x502c('0x39')]=_0x2f1003;_0x55af7b['ringtime']=getSeconds(_0x55af7b['responsetime'],_0x55af7b[_0x502c('0x38')]);};exports[_0x502c('0x3d')]=function(_0x4a9c02,_0x11490c,_0x5fd306){_0x4a9c02[_0x502c('0x3e')]=_0x11490c;_0x4a9c02['UserId']=_0x5fd306;};exports[_0x502c('0x3f')]=function(_0x153140,_0x1d14f4,_0x4d45c2){var _0x5ac2e7=moment()['format'](_0x502c('0x3b'));_0x153140[_0x502c('0x40')]=_0x1d14f4;_0x153140[_0x502c('0x3c')]=_0x4d45c2;_0x153140[_0x502c('0x39')]=_0x153140[_0x502c('0x39')]?_0x153140[_0x502c('0x39')]:_0x5ac2e7;_0x153140[_0x502c('0x41')]=_0x153140[_0x502c('0x41')]?_0x153140[_0x502c('0x41')]:_0x5ac2e7;_0x153140['ringtime']=getSeconds(_0x153140[_0x502c('0x39')]||0x0,_0x153140['starttime']||0x0);_0x153140[_0x502c('0x42')]=_0x153140[_0x502c('0x43')]?getSeconds(_0x153140['endtime'],_0x153140[_0x502c('0x43')]):0x0;};exports['isFailure']=function(_0x6f8bd0){return _0x6f8bd0===_0x502c('0x44');};exports[_0x502c('0x45')]=function(_0x4708d3,_0x9763a1,_0x2b2dcf,_0x180002,_0x5c12a3){var _0x21a828=_0x180002?_0x502c('0x46'):_0x4708d3[_0x502c('0x18')];_0x21a828=_0x5c12a3?_0x502c('0x47'):_0x21a828;return{'actionid':_0x4708d3[_0x502c('0x48')],'action':_0x502c('0x49'),'channel':_0x4708d3[_0x502c('0x4a')],'callerid':util[_0x502c('0x11')](_0x502c('0x12'),_0x21a828,_0x4708d3[_0x502c('0x19')]),'Exten':_0x502c('0x25'),'Context':_0x502c('0x4b'),'Priority':'1','variable':_0x2b2dcf,'timeout':(_0x9763a1[_0x502c('0x4c')]||0x1e)*0x3e8,'async':!![],'channelid':_0x4708d3[_0x502c('0x48')]};};exports['totalGlobal']=function(_0x212d37){return _0x212d37[_0x502c('0x4d')]+_0x212d37[_0x502c('0x4e')]+_0x212d37[_0x502c('0x4f')]+_0x212d37[_0x502c('0x50')]+_0x212d37['countnosuchnumberretry'];};exports[_0x502c('0x51')]=function(_0x349806){var _0x364456=_[_0x502c('0x52')](_0x349806);_0x364456[_0x502c('0x40')]=0xf;_0x364456[_0x502c('0x3c')]=_0x502c('0x53');return _0x364456;};exports[_0x502c('0x54')]=function(_0x45563a,_0x31c70e,_0x5e48fd){var _0x1cc938={};_0x1cc938[_0x31c70e]=_0x45563a[_0x31c70e];_0x1cc938['active']=![];_0x1cc938[_0x502c('0x55')]=moment()[_0x502c('0x56')](_0x5e48fd,_0x502c('0x57'))['format'](_0x502c('0x3b'));_0x1cc938[_0x502c('0x1a')]=_0x45563a[_0x502c('0x1a')];_0x1cc938[_0x502c('0x58')]=_0x45563a[_0x502c('0x58')];_0x1cc938['VoiceQueueId']=_0x45563a['VoiceQueueId']||undefined;return _0x1cc938;};exports['decrementTalkink']=function(_0x5e061e,_0x5e3193){if(!_[_0x502c('0x2b')](_0x5e061e)){if(_0x5e061e['pTalking']>0x0){_0x5e061e[_0x502c('0x59')]-=0x1;}else{logger[_0x502c('0xa')](_0x5e3193,_0x502c('0x5a'));}}else{logger['error'](_0x5e3193,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports[_0x502c('0x5b')]=function(_0x194f92){if(_0x194f92<=0x0){return!![];}return![];};exports[_0x502c('0x5c')]=function(_0x19b8f4,_0x32b83c,_0x398547){_0x19b8f4[_0x502c('0x5d')]=_0x32b83c;_0x19b8f4[_0x502c('0x17')]=_0x19b8f4[_0x502c('0x5e')];_0x19b8f4[_0x502c('0x5f')]=_0x19b8f4[_0x502c('0x4a')];_0x19b8f4[_0x502c('0x60')]=_0x502c('0x61');if(_0x398547){_0x19b8f4['mandatoryDisposition']=_0x398547['mandatoryDisposition'];}return _0x19b8f4;};exports[_0x502c('0x62')]=function(_0x1818e5){var _0x57ed87={};_0x57ed87[_0x502c('0x5e')]=_0x1818e5[_0x502c('0x5e')];_0x57ed87[_0x502c('0x5f')]=_0x1818e5[_0x502c('0x4a')];_0x57ed87[_0x502c('0x48')]=_0x1818e5[_0x502c('0x48')];return _0x57ed87;};exports[_0x502c('0x63')]=function(_0x1cc4a7){var _0x582ca6=[];for(var _0x66878d in _0x1cc4a7){if(_0x1cc4a7[_0x502c('0x2a')](_0x66878d)){if(!_[_0x502c('0x2b')](_0x1cc4a7[_0x66878d])&&_0x1cc4a7[_0x66878d]['state']===_0x502c('0x64')&&_0x1cc4a7[_0x66878d]['status']==='reachable'){_0x582ca6['push'](_0x1cc4a7[_0x66878d]['id']);}}}return _0x582ca6;};exports[_0x502c('0x65')]=function(_0x2f99f3){var _0x332594=moment()['milliseconds'](0x0);var _0x350829=moment(_0x2f99f3)['milliseconds'](0x0);return _0x332594[_0x502c('0x7')](_0x350829,_0x502c('0x66'));};exports['createBody']=function(_0x21506f){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x21506f['ContactId'],'ListId':_0x21506f[_0x502c('0x58')],'VoiceQueueId':_0x21506f['VoiceQueueId']||undefined,'CampaignId':_0x21506f[_0x502c('0x67')]||undefined};};exports[_0x502c('0x68')]=function(_0x1dbf98){if(_0x1dbf98===_0x502c('0x48')||_0x1dbf98===_0x502c('0x69')||_0x1dbf98===_0x502c('0x5e')||_0x1dbf98===_0x502c('0x6a')||_0x1dbf98===_0x502c('0x6b')||_0x1dbf98===_0x502c('0x6c')||_0x1dbf98==='membername'||_0x1dbf98===_0x502c('0x4a')||_0x1dbf98===_0x502c('0x18')||_0x1dbf98===_0x502c('0x6d')||_0x1dbf98===_0x502c('0x19')||_0x1dbf98===_0x502c('0x55')||_0x1dbf98==='countbusyretry'||_0x1dbf98===_0x502c('0x4e')||_0x1dbf98===_0x502c('0x4f')||_0x1dbf98==='countglobal'||_0x1dbf98===_0x502c('0x6e')||_0x1dbf98==='callbackuniqueid'||_0x1dbf98===_0x502c('0x6f')||_0x1dbf98===_0x502c('0x70')||_0x1dbf98===_0x502c('0x1a')||_0x1dbf98===_0x502c('0x58')||_0x1dbf98===_0x502c('0x71')||_0x1dbf98===_0x502c('0x1c')||_0x1dbf98===_0x502c('0x72')||_0x1dbf98===_0x502c('0x73')||_0x1dbf98==='xmd-queue'||_0x1dbf98===_0x502c('0x74')||_0x1dbf98===_0x502c('0x75')||_0x1dbf98===_0x502c('0x76')||_0x1dbf98===_0x502c('0x77')||_0x1dbf98==='xmd-dialoptions'||_0x1dbf98==='xmd-dialid'||_0x1dbf98===_0x502c('0x78')||_0x1dbf98===_0x502c('0x79')||_0x1dbf98==='xmd-cdrtype'||_0x1dbf98===_0x502c('0x7a')||_0x1dbf98===_0x502c('0x7b')||_0x1dbf98===_0x502c('0x7c')||_0x1dbf98===_0x502c('0x7d')||_0x1dbf98==='rtpaudioqosbridged'||_0x1dbf98==='rtpaudioqosjitter'||_0x1dbf98===_0x502c('0x7e')||_0x1dbf98===_0x502c('0x7f')||_0x1dbf98==='rtpaudioqoslossbridged'||_0x1dbf98===_0x502c('0x80')||_0x1dbf98===_0x502c('0x81')||_0x1dbf98===_0x502c('0x7d')||_0x1dbf98==='rtpaudioqosbridged'||_0x1dbf98===_0x502c('0x82')||_0x1dbf98===_0x502c('0x7e')||_0x1dbf98==='rtpaudioqosloss'||_0x1dbf98===_0x502c('0x83')||_0x1dbf98===_0x502c('0x80')||_0x1dbf98===_0x502c('0x81')||_0x1dbf98==='bridgepeer'||_0x1dbf98==='bridgepvtcallid'||_0x1dbf98==='state'||_0x1dbf98==='statedesc'){return![];}return!![];};exports[_0x502c('0x84')]=function(_0x47fdb9,_0x12a523){var _0x55945e,_0x2f8d00,_0x2f7f43;if(_0x12a523<=0x0){_0x12a523=0x1;}_0x55945e=new RegExp(_0x502c('0x85')+_0x12a523+'}$');_0x2f8d00=Math[_0x502c('0x86')](0xa,_0x12a523-0x1);_0x2f7f43=Math[_0x502c('0x86')](0xa,_0x12a523)-0x1;return util['format']('%s',_[_0x502c('0x87')](_0x47fdb9,_0x55945e,_[_0x502c('0x88')](_0x2f8d00,_0x2f7f43)));};exports[_0x502c('0x89')]=function(_0x1006a5){var _0x3e88d=_0x1006a5[_0x502c('0x8a')](/"(.*?)"/);return _0x3e88d?_0x3e88d[0x1]:_0x1006a5;};exports['extractCalleridNumber']=function(_0x89b8eb){var _0x522599=_0x89b8eb[_0x502c('0x8a')](/<(.*?)>/);return _0x522599?_0x522599[0x1]:_0x89b8eb;}; \ No newline at end of file +var _0xd308=['reachable','getDiff','diff','createBody','CampaignId','filterKey','type','campaigntype','dialAnswer','scheduledat','countbusyretry','countglobal','callback','callbackuniqueid','callbackat','recallme','UserId','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','match','extractCalleridNumber','util','lodash','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','seconds','loggerCatch','error','inspect','logger','loggerError','logger2','message','getCallerId','string','isEmpty','isUndefined','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','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_UNIQUEID','Contact','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','toLower','updateOriginated','hasOwnProperty','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','logBlacklist','state','statedesc','Blacklist','starttime','responsetime','endtime','logAgent','YYYY-MM-DD\x20HH:mm:ss','ringtime','logLookAgent','membername','logCustomer','answertime','isFailure','Failure','variablesAction','RECALL','BOOKED','uniqueid','originate','channelAgent','from-sip','totalGlobal','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','scheduledAt','active','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','name','queue','interface','motionChannel','voice','mandatoryDisposition','buildAcw','agentReadyId','not_inuse','status'];(function(_0x486d1c,_0x4fcad7){var _0x5f1cd4=function(_0xf88bb3){while(--_0xf88bb3){_0x486d1c['push'](_0x486d1c['shift']());}};_0x5f1cd4(++_0x4fcad7);}(_0xd308,0xc6));var _0x8d30=function(_0x39d1c5,_0xd7e6d2){_0x39d1c5=_0x39d1c5-0x0;var _0x101f45=_0xd308[_0x39d1c5];return _0x101f45;};'use strict';var util=require(_0x8d30('0x0'));var _=require(_0x8d30('0x1'));var moment=require(_0x8d30('0x2'));var logger=require(_0x8d30('0x3'))(_0x8d30('0x4'));var ipAgi=process[_0x8d30('0x5')][_0x8d30('0x6')]||_0x8d30('0x7');function getSeconds(_0x172642,_0x578c01){var _0x575c20=moment(_0x172642)[_0x8d30('0x8')](0x0);var _0x112b29=moment(_0x578c01)['milliseconds'](0x0);return _0x575c20['diff'](_0x112b29,_0x8d30('0x9'));}exports[_0x8d30('0xa')]=function(_0x3bcf6e){return function(_0x4690f9){logger[_0x8d30('0xb')](_0x3bcf6e,util[_0x8d30('0xc')](_0x4690f9,{'showHidden':![],'depth':null}));};};exports[_0x8d30('0xd')]=function(_0x34bb9f,_0x42df70){logger['info'](_0x34bb9f,util['inspect'](_0x42df70,{'showHidden':![],'depth':null}));};exports[_0x8d30('0xe')]=function(_0x50454b,_0x45eb01){logger[_0x8d30('0xb')](_0x50454b,util['inspect'](_0x45eb01,{'showHidden':![],'depth':null}));};exports[_0x8d30('0xf')]=function(_0x32224e){return function(_0x471dc9){logger['info'](_0x32224e,util[_0x8d30('0xc')](_0x471dc9,{'showHidden':![],'depth':null}));};};exports[_0x8d30('0x10')]=function(_0x12006a,_0x146a3b,_0x43e0ba){return{'message':_0x12006a,'unlock':_0x146a3b,'active':_0x43e0ba};};exports[_0x8d30('0x11')]=function(_0x35042c,_0x370754,_0x3cbb54){if(!_['isUndefined'](_0x3cbb54)&&_0x8d30('0x12')===typeof _0x3cbb54&&!_[_0x8d30('0x13')](_0x3cbb54)){if(!_[_0x8d30('0x14')](_0x370754)&&'string'===typeof _0x370754&&!_[_0x8d30('0x13')](_0x370754)){return util[_0x8d30('0x15')](_0x8d30('0x16'),_0x370754,_0x3cbb54);}return util[_0x8d30('0x15')]('\x22%s\x22\x20<%s>',_0x3cbb54,_0x3cbb54);}if(!_[_0x8d30('0x14')](_0x35042c)&&_0x8d30('0x12')===typeof _0x35042c&&!_[_0x8d30('0x13')](_0x35042c)){return _0x35042c;}return _0x8d30('0x17');};exports[_0x8d30('0x18')]=function(_0x290de9){if(_[_0x8d30('0x19')](_0x290de9)){return![];}return _0x290de9;};exports[_0x8d30('0x1a')]=function(_0x598c63,_0x1c813f,_0x2a943e,_0x511f0c,_0x1912d8,_0x1178a2){var _0x47eb04={'XMD-QUEUE':_0x1c813f[_0x8d30('0x1b')]?_0x1c813f[_0x8d30('0x1b')]['name']:'','XMD-CALLERID':_0x511f0c,'XMD-CALLERID-PREVIEW':_0x1178a2?util[_0x8d30('0x15')]('\x22%s\x22\x20<%s>',_0x1178a2[_0x8d30('0x1c')],_0x1178a2[_0x8d30('0x1d')]):_0x511f0c,'XMD-DIALID':_0x1912d8,'XMD-CONTACTID':_0x1c813f[_0x8d30('0x1e')],'XMD-CDRTYPE':_0x8d30('0x1f'),'CALLERID(all)':_0x511f0c,'XMD-VOICEQUEUEID':_0x1c813f[_0x8d30('0x20')],'XMD-DIALCHANNEL':_0x2a943e,'XMD-DIALTIMEOUT':_0x598c63[_0x8d30('0x21')]||0x1e,'XMD-DIALOPTIONS':util['format']('\x22rtTxX%s%s\x22',_0x598c63[_0x8d30('0x22')]?'g':'',_['isEmpty'](_0x598c63[_0x8d30('0x23')])?'':_0x8d30('0x24')),'XMD-DIALURL':_0x598c63[_0x8d30('0x25')]||'','XMD-AGI':_0x598c63[_0x8d30('0x26')]?util[_0x8d30('0x15')](_0x8d30('0x27'),ipAgi,_0x598c63[_0x8d30('0x26')]):_0x8d30('0x28'),'XMD-AGIAFTER':_0x598c63[_0x8d30('0x22')]?util[_0x8d30('0x15')]('\x22agi://%s/square,%s\x22',ipAgi,_0x598c63[_0x8d30('0x22')]):_0x8d30('0x28'),'XMD-ORIGINATECALLERIDNUM':_0x1178a2?_0x1178a2[_0x8d30('0x29')]:'','XMD-ORIGINATECALLERIDNAME':_0x1178a2?_0x1178a2['originatecalleridname']:'','XMD-DESTINATION':_0x8d30('0x2a'),'SIPADDHEADER':_0x8d30('0x2b')};if(!_[_0x8d30('0x13')](_0x598c63['monitor_format'])){_0x47eb04[util['format']('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x598c63[_0x8d30('0x23')];_0x47eb04[util['format']('%s',_0x8d30('0x2c'))]=_0x1912d8;}if(_0x1c813f&&_0x1c813f[_0x8d30('0x2d')]){for(var _0x55f573 in _0x1c813f['Contact']){if(_0x1c813f[_0x8d30('0x2d')]['hasOwnProperty'](_0x55f573)){if(!_[_0x8d30('0x19')](_0x1c813f[_0x8d30('0x2d')][_0x55f573])&&_0x55f573!=='id'&&_0x55f573!==_0x8d30('0x2e')&&_0x55f573!==_0x8d30('0x2f')&&_0x55f573!==_0x8d30('0x30')){_0x47eb04[util[_0x8d30('0x15')](_0x8d30('0x31'),_0x8d30('0x32'),_[_0x8d30('0x33')](_0x55f573))]=_0x1c813f[_0x8d30('0x2d')][_0x55f573];}}}}return _0x47eb04;};exports['toLowerVariables']=function(_0x10eac5){var _0x3abc8c={};for(var _0x3d34a1 in _0x10eac5){if(_0x10eac5['hasOwnProperty'](_0x3d34a1)){_0x3abc8c[util[_0x8d30('0x15')]('%s',_[_0x8d30('0x34')](_0x3d34a1))]=_0x10eac5[_0x3d34a1];}}return{'variables':_0x3abc8c};};exports[_0x8d30('0x35')]=function(_0x502290,_0x561cf8){if(!_[_0x8d30('0x19')](_0x502290)){if(_0x502290[_0x8d30('0x36')]('originated')){if(_0x502290['originated']>0x0){_0x502290[_0x8d30('0x37')]-=0x1;}else{logger['error'](_0x8d30('0x38'),_0x561cf8);}}}else{logger['error']('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x561cf8);}};exports[_0x8d30('0x39')]=function(_0x9737a){var _0x1f5db6=moment()[_0x8d30('0x15')]('YYYY-MM-DD\x20HH:mm:ss');_0x9737a[_0x8d30('0x3a')]=0xd;_0x9737a[_0x8d30('0x3b')]=_0x8d30('0x3c');_0x9737a[_0x8d30('0x3d')]=_0x1f5db6;_0x9737a[_0x8d30('0x3e')]=_0x1f5db6;_0x9737a[_0x8d30('0x3f')]=_0x1f5db6;};exports[_0x8d30('0x40')]=function(_0x5dd395,_0x4bafa9,_0x32a1ec){var _0x5477f4=moment()[_0x8d30('0x15')](_0x8d30('0x41'));_0x5dd395[_0x8d30('0x3a')]=_0x4bafa9;_0x5dd395[_0x8d30('0x3b')]=_0x32a1ec;_0x5dd395['responsetime']=_0x5477f4;_0x5dd395[_0x8d30('0x42')]=getSeconds(_0x5dd395[_0x8d30('0x3e')],_0x5dd395[_0x8d30('0x3d')]);};exports[_0x8d30('0x43')]=function(_0x424b0f,_0xbe5b6c,_0x137e01){_0x424b0f[_0x8d30('0x44')]=_0xbe5b6c;_0x424b0f['UserId']=_0x137e01;};exports[_0x8d30('0x45')]=function(_0x89da84,_0x4daad1,_0x35e77c){var _0x300c48=moment()['format'](_0x8d30('0x41'));_0x89da84['state']=_0x4daad1;_0x89da84[_0x8d30('0x3b')]=_0x35e77c;_0x89da84[_0x8d30('0x3e')]=_0x89da84[_0x8d30('0x3e')]?_0x89da84['responsetime']:_0x300c48;_0x89da84[_0x8d30('0x3f')]=_0x89da84[_0x8d30('0x3f')]?_0x89da84[_0x8d30('0x3f')]:_0x300c48;_0x89da84[_0x8d30('0x42')]=getSeconds(_0x89da84['responsetime']||0x0,_0x89da84[_0x8d30('0x3d')]||0x0);_0x89da84['talktime']=_0x89da84[_0x8d30('0x46')]?getSeconds(_0x89da84[_0x8d30('0x3f')],_0x89da84['answertime']):0x0;};exports[_0x8d30('0x47')]=function(_0x3ea0b1){return _0x3ea0b1===_0x8d30('0x48');};exports[_0x8d30('0x49')]=function(_0x56c4bf,_0x297460,_0x3cc82d,_0x211741,_0x3d367c){var _0x5ab7a2=_0x211741?_0x8d30('0x4a'):_0x56c4bf[_0x8d30('0x1c')];_0x5ab7a2=_0x3d367c?_0x8d30('0x4b'):_0x5ab7a2;return{'actionid':_0x56c4bf[_0x8d30('0x4c')],'action':_0x8d30('0x4d'),'channel':_0x56c4bf[_0x8d30('0x4e')],'callerid':util[_0x8d30('0x15')](_0x8d30('0x16'),_0x5ab7a2,_0x56c4bf[_0x8d30('0x1d')]),'Exten':_0x8d30('0x2a'),'Context':_0x8d30('0x4f'),'Priority':'1','variable':_0x3cc82d,'timeout':(_0x297460['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x56c4bf['uniqueid']};};exports[_0x8d30('0x50')]=function(_0x3eb145){return _0x3eb145['countbusyretry']+_0x3eb145[_0x8d30('0x51')]+_0x3eb145[_0x8d30('0x52')]+_0x3eb145[_0x8d30('0x53')]+_0x3eb145[_0x8d30('0x54')];};exports[_0x8d30('0x55')]=function(_0x22fd39){var _0x7444ff=_[_0x8d30('0x56')](_0x22fd39);_0x7444ff[_0x8d30('0x3a')]=0xf;_0x7444ff['statedesc']='Global';return _0x7444ff;};exports[_0x8d30('0x57')]=function(_0x276837,_0x4d0e74,_0x1ae841){var _0x44ab39={};_0x44ab39[_0x4d0e74]=_0x276837[_0x4d0e74];_0x44ab39[_0x8d30('0x58')]=![];_0x44ab39['scheduledat']=moment()['add'](_0x1ae841,_0x8d30('0x59'))[_0x8d30('0x15')]('YYYY-MM-DD\x20HH:mm:ss');_0x44ab39[_0x8d30('0x1e')]=_0x276837[_0x8d30('0x1e')];_0x44ab39[_0x8d30('0x5a')]=_0x276837[_0x8d30('0x5a')];_0x44ab39['VoiceQueueId']=_0x276837[_0x8d30('0x20')]||undefined;return _0x44ab39;};exports[_0x8d30('0x5b')]=function(_0x1ad676,_0x28dd36){if(!_[_0x8d30('0x19')](_0x1ad676)){if(_0x1ad676['pTalking']>0x0){_0x1ad676[_0x8d30('0x5c')]-=0x1;}else{logger['error'](_0x28dd36,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0x8d30('0xb')](_0x28dd36,_0x8d30('0x5d'));}};exports[_0x8d30('0x5e')]=function(_0x51c80b){if(_0x51c80b<=0x0){return!![];}return![];};exports['buildObj']=function(_0x5f4a9f,_0x1df86b,_0x1b6c82){_0x5f4a9f[_0x8d30('0x5f')]=_0x1df86b;_0x5f4a9f[_0x8d30('0x60')]=_0x5f4a9f[_0x8d30('0x61')];_0x5f4a9f[_0x8d30('0x62')]=_0x5f4a9f[_0x8d30('0x4e')];_0x5f4a9f[_0x8d30('0x63')]=_0x8d30('0x64');if(_0x1b6c82){_0x5f4a9f['mandatoryDisposition']=_0x1b6c82[_0x8d30('0x65')];}return _0x5f4a9f;};exports[_0x8d30('0x66')]=function(_0x2823c4){var _0x10d39c={};_0x10d39c[_0x8d30('0x61')]=_0x2823c4[_0x8d30('0x61')];_0x10d39c[_0x8d30('0x62')]=_0x2823c4[_0x8d30('0x4e')];_0x10d39c[_0x8d30('0x4c')]=_0x2823c4['uniqueid'];return _0x10d39c;};exports[_0x8d30('0x67')]=function(_0x93d6ee){var _0x39e893=[];for(var _0x47c7dc in _0x93d6ee){if(_0x93d6ee[_0x8d30('0x36')](_0x47c7dc)){if(!_[_0x8d30('0x19')](_0x93d6ee[_0x47c7dc])&&_0x93d6ee[_0x47c7dc][_0x8d30('0x3a')]===_0x8d30('0x68')&&_0x93d6ee[_0x47c7dc][_0x8d30('0x69')]===_0x8d30('0x6a')){_0x39e893['push'](_0x93d6ee[_0x47c7dc]['id']);}}}return _0x39e893;};exports[_0x8d30('0x6b')]=function(_0x488e7e){var _0x44a6f3=moment()[_0x8d30('0x8')](0x0);var _0x5e0e66=moment(_0x488e7e)[_0x8d30('0x8')](0x0);return _0x44a6f3[_0x8d30('0x6c')](_0x5e0e66,_0x8d30('0x9'));};exports[_0x8d30('0x6d')]=function(_0x346ba2){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x346ba2[_0x8d30('0x1e')],'ListId':_0x346ba2[_0x8d30('0x5a')],'VoiceQueueId':_0x346ba2[_0x8d30('0x20')]||undefined,'CampaignId':_0x346ba2[_0x8d30('0x6e')]||undefined};};exports[_0x8d30('0x6f')]=function(_0x4f8c23){if(_0x4f8c23===_0x8d30('0x4c')||_0x4f8c23==='idContact'||_0x4f8c23===_0x8d30('0x61')||_0x4f8c23===_0x8d30('0x70')||_0x4f8c23===_0x8d30('0x71')||_0x4f8c23===_0x8d30('0x72')||_0x4f8c23==='membername'||_0x4f8c23===_0x8d30('0x4e')||_0x4f8c23==='calleridname'||_0x4f8c23===_0x8d30('0x58')||_0x4f8c23===_0x8d30('0x1d')||_0x4f8c23===_0x8d30('0x73')||_0x4f8c23===_0x8d30('0x74')||_0x4f8c23===_0x8d30('0x51')||_0x4f8c23===_0x8d30('0x52')||_0x4f8c23===_0x8d30('0x75')||_0x4f8c23===_0x8d30('0x76')||_0x4f8c23===_0x8d30('0x77')||_0x4f8c23===_0x8d30('0x78')||_0x4f8c23===_0x8d30('0x79')||_0x4f8c23===_0x8d30('0x1e')||_0x4f8c23===_0x8d30('0x5a')||_0x4f8c23===_0x8d30('0x7a')||_0x4f8c23===_0x8d30('0x20')||_0x4f8c23==='sipcallid'||_0x4f8c23===_0x8d30('0x7b')||_0x4f8c23===_0x8d30('0x7c')||_0x4f8c23===_0x8d30('0x7d')||_0x4f8c23===_0x8d30('0x7e')||_0x4f8c23===_0x8d30('0x7f')||_0x4f8c23===_0x8d30('0x80')||_0x4f8c23===_0x8d30('0x81')||_0x4f8c23===_0x8d30('0x82')||_0x4f8c23===_0x8d30('0x83')||_0x4f8c23===_0x8d30('0x84')||_0x4f8c23===_0x8d30('0x85')||_0x4f8c23===_0x8d30('0x86')||_0x4f8c23===_0x8d30('0x87')||_0x4f8c23==='xmd-agi'||_0x4f8c23===_0x8d30('0x88')||_0x4f8c23===_0x8d30('0x89')||_0x4f8c23===_0x8d30('0x8a')||_0x4f8c23===_0x8d30('0x8b')||_0x4f8c23===_0x8d30('0x8c')||_0x4f8c23==='rtpaudioqoslossbridged'||_0x4f8c23===_0x8d30('0x8d')||_0x4f8c23===_0x8d30('0x8e')||_0x4f8c23==='rtpaudioqos'||_0x4f8c23===_0x8d30('0x89')||_0x4f8c23===_0x8d30('0x8a')||_0x4f8c23===_0x8d30('0x8b')||_0x4f8c23===_0x8d30('0x8c')||_0x4f8c23==='rtpaudioqoslossbridged'||_0x4f8c23===_0x8d30('0x8d')||_0x4f8c23===_0x8d30('0x8e')||_0x4f8c23==='bridgepeer'||_0x4f8c23===_0x8d30('0x8f')||_0x4f8c23===_0x8d30('0x3a')||_0x4f8c23===_0x8d30('0x3b')){return![];}return!![];};exports[_0x8d30('0x90')]=function(_0x3f8c56,_0x406fa4){var _0x3f15e2,_0x241f12,_0x492054;if(_0x406fa4<=0x0){_0x406fa4=0x1;}_0x3f15e2=new RegExp(_0x8d30('0x91')+_0x406fa4+'}$');_0x241f12=Math[_0x8d30('0x92')](0xa,_0x406fa4-0x1);_0x492054=Math[_0x8d30('0x92')](0xa,_0x406fa4)-0x1;return util[_0x8d30('0x15')]('%s',_[_0x8d30('0x93')](_0x3f8c56,_0x3f15e2,_[_0x8d30('0x94')](_0x241f12,_0x492054)));};exports[_0x8d30('0x95')]=function(_0x30e52b){var _0x10b41f=_0x30e52b[_0x8d30('0x96')](/"(.*?)"/);return _0x10b41f?_0x10b41f[0x1]:_0x30e52b;};exports[_0x8d30('0x97')]=function(_0x4f53b7){var _0x560975=_0x4f53b7[_0x8d30('0x96')](/<(.*?)>/);return _0x560975?_0x560975[0x1]:_0x4f53b7;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 6a29d1c..6bf2acc 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 _0x3899=['boolean','queueremove','queuepause','reload','voicequeuechannel','voicechannel','queueadd','string','number'];(function(_0x13d97d,_0x145deb){var _0x4b065a=function(_0x2157a6){while(--_0x2157a6){_0x13d97d['push'](_0x13d97d['shift']());}};_0x4b065a(++_0x145deb);}(_0x3899,0x126));var _0x9389=function(_0x16ed05,_0x568394){_0x16ed05=_0x16ed05-0x0;var _0x48a3c4=_0x3899[_0x16ed05];return _0x48a3c4;};'use strict';exports[_0x9389('0x0')]={'queue':{'type':_0x9389('0x1'),'required':!![]},'interface':{'type':_0x9389('0x1'),'required':!![]},'membername':{'type':_0x9389('0x1'),'required':!![]},'penalty':{'type':_0x9389('0x2'),'required':![]},'paused':{'type':_0x9389('0x3'),'required':![]}};exports[_0x9389('0x4')]={'queue':{'type':_0x9389('0x1'),'required':!![]},'interface':{'type':'string','required':!![]}};exports[_0x9389('0x5')]={'interface':{'type':_0x9389('0x1'),'required':!![]},'paused':{'type':_0x9389('0x3')},'reason':{'type':'string','required':![]}};exports[_0x9389('0x6')]={'module':{'type':_0x9389('0x1'),'required':![]}};exports[_0x9389('0x7')]={'uniqueid':{'type':_0x9389('0x1'),'required':!![]}};exports[_0x9389('0x8')]={'uniqueid':{'type':'string','required':!![]},'filename':{'type':_0x9389('0x1')},'format':{'type':_0x9389('0x1')},'mixmonitorid':{'type':'string'}};exports['voicequeuechannelhangup']={'uniqueid':{'type':_0x9389('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0x9389('0x1'),'required':!![]},'exten':{'type':_0x9389('0x1'),'required':!![]},'context':{'type':_0x9389('0x1')}}; \ No newline at end of file +var _0x19ff=['voicequeuechannelhangup','queueadd','string','number','boolean','queueremove','queuepause','reload','voicequeuechannel'];(function(_0xe9dc03,_0xcbed4c){var _0x575006=function(_0x4d720a){while(--_0x4d720a){_0xe9dc03['push'](_0xe9dc03['shift']());}};_0x575006(++_0xcbed4c);}(_0x19ff,0xd0));var _0xf19f=function(_0x3231e8,_0x41df58){_0x3231e8=_0x3231e8-0x0;var _0x13a897=_0x19ff[_0x3231e8];return _0x13a897;};'use strict';exports[_0xf19f('0x0')]={'queue':{'type':_0xf19f('0x1'),'required':!![]},'interface':{'type':_0xf19f('0x1'),'required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':_0xf19f('0x2'),'required':![]},'paused':{'type':_0xf19f('0x3'),'required':![]}};exports[_0xf19f('0x4')]={'queue':{'type':_0xf19f('0x1'),'required':!![]},'interface':{'type':_0xf19f('0x1'),'required':!![]}};exports[_0xf19f('0x5')]={'interface':{'type':'string','required':!![]},'paused':{'type':'boolean'},'reason':{'type':_0xf19f('0x1'),'required':![]}};exports[_0xf19f('0x6')]={'module':{'type':_0xf19f('0x1'),'required':![]}};exports[_0xf19f('0x7')]={'uniqueid':{'type':_0xf19f('0x1'),'required':!![]}};exports['voicechannel']={'uniqueid':{'type':_0xf19f('0x1'),'required':!![]},'filename':{'type':_0xf19f('0x1')},'format':{'type':_0xf19f('0x1')},'mixmonitorid':{'type':_0xf19f('0x1')}};exports[_0xf19f('0x8')]={'uniqueid':{'type':_0xf19f('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0xf19f('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 1b1a0e4..fb2a171 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 _0x1d5c=['moment','../model/agent','../model/telephone','../model/trunk','../model/template','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','voiceQueues','triggers','campaigns','templates','outbound','voiceExtensions','channels','queueChannels','outboundChannels','settings','zendeskAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','SIP/%s','name','hasOwnProperty','isNil','interface','format','total','sumHoldTime','sumDuration','isEmpty','answered','abandoned','sumBillable','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundRejectCallsDay','outboundReCallsDay','queueStatusComplete','prototype','length','isUndefined','mergeFromDatabase','initTelephones','trunks','initTriggers','initTemplates','initZendeskAccounts','salesforceAccounts','initFreshdeskAccounts','initZohoAccounts','initDeskAccounts','deskAccounts','initSugarcrmAccounts','initVtigerAccounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','uniqueid','queue','queuecallerexit','queuecallerabandon','diff','queuecallerjoinAt','seconds','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','queuecallercompleteAt','queuecallerleaveAt','duration','ANSWERED','billableseconds','initCampaigns','dialQueueProject','SquareProject','initVoiceExtensions','initFaxAccounts','exports','lodash'];(function(_0x593310,_0x17b9e9){var _0x1ea007=function(_0x4eaceb){while(--_0x4eaceb){_0x593310['push'](_0x593310['shift']());}};_0x1ea007(++_0x17b9e9);}(_0x1d5c,0x1f3));var _0xc1d5=function(_0x2cb984,_0x365f50){_0x2cb984=_0x2cb984-0x0;var _0x2f73e6=_0x1d5c[_0x2cb984];return _0x2f73e6;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0xc1d5('0x0'));var moment=require(_0xc1d5('0x1'));var Agent=require(_0xc1d5('0x2'));var Telephone=require(_0xc1d5('0x3'));var Trunk=require(_0xc1d5('0x4'));var VoiceQueue=require('../model/voiceQueue');var Trigger=require('../model/trigger');var Template=require(_0xc1d5('0x5'));var Campaign=require(_0xc1d5('0x6'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0xc1d5('0x7'));var SalesforceAccount=require(_0xc1d5('0x8'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require(_0xc1d5('0x9'));var ZohoAccount=require(_0xc1d5('0xa'));var DeskAccount=require(_0xc1d5('0xb'));var VtigerAccount=require(_0xc1d5('0xc'));var ServicenowAccount=require(_0xc1d5('0xd'));var Dynamics365Account=require(_0xc1d5('0xe'));var FreshsalesAccount=require(_0xc1d5('0xf'));var FaxAccount=require(_0xc1d5('0x10'));var Realtime=function(){this[_0xc1d5('0x11')]={};this[_0xc1d5('0x12')]={};this['trunks']={};this[_0xc1d5('0x13')]={};this[_0xc1d5('0x14')]={};this[_0xc1d5('0x15')]={};this[_0xc1d5('0x16')]={};this[_0xc1d5('0x17')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xc1d5('0x18')]={};this[_0xc1d5('0x19')]={};this[_0xc1d5('0x1a')]={};this[_0xc1d5('0x1b')]={};this['timers']={};this[_0xc1d5('0x1c')]={};this[_0xc1d5('0x1d')]={};this['salesforceAccounts']={};this[_0xc1d5('0x1e')]={};this[_0xc1d5('0x1f')]={};this[_0xc1d5('0x20')]={};this['deskAccounts']={};this[_0xc1d5('0x21')]={};this[_0xc1d5('0x22')]={};this[_0xc1d5('0x23')]={};this[_0xc1d5('0x24')]={};this[_0xc1d5('0x25')]={};};function freeIsNotKey(_0x2cf467,_0x46394a,_0x2bd9b3){var _0x63dd1f=_[_0xc1d5('0x26')](_0x2cf467,function(_0x191005,_0x4b641f){return _0x191005[_0x2bd9b3];});for(var _0x30dcda in _0x46394a){if(_0x46394a['hasOwnProperty'](_0x30dcda)){if(!_0x63dd1f[_0x30dcda]){delete _0x46394a[_0x30dcda];}}}}function freeIsNotKeySip(_0x471d27,_0xe847c9){var _0x20b5c4=_[_0xc1d5('0x26')](_0x471d27,function(_0x2e7420,_0x2fddb5){return util['format'](_0xc1d5('0x27'),_0x2e7420[_0xc1d5('0x28')]);});for(var _0x280bd9 in _0xe847c9){if(_0xe847c9[_0xc1d5('0x29')](_0x280bd9)){if(!_0x20b5c4[_0x280bd9]){delete _0xe847c9[_0x280bd9];}}}}function freeIsNotKeyAgent(_0x221ac0,_0x53eae7){var _0x47e284=_['mapKeys'](_0x221ac0,function(_0x5f9500,_0x359016){var _0x5dfda4=_[_0xc1d5('0x2a')](_0x5f9500[_0xc1d5('0x2b')])?util[_0xc1d5('0x2c')](_0xc1d5('0x27'),_0x5f9500[_0xc1d5('0x28')]):_0x5f9500[_0xc1d5('0x2b')];return _0x5dfda4;});for(var _0x77ed42 in _0x53eae7){if(_0x53eae7['hasOwnProperty'](_0x77ed42)){if(!_0x47e284[_0x77ed42]){delete _0x53eae7[_0x77ed42];}}}}function clearVoiceCallReports(_0x4a800e){_0x4a800e[_0xc1d5('0x2d')]=0x0;_0x4a800e['answered']=0x0;_0x4a800e[_0xc1d5('0x2e')]=0x0;_0x4a800e[_0xc1d5('0x2f')]=0x0;_0x4a800e['sumBillable']=0x0;}function clearCampaigns(_0xf099a7){if(!_[_0xc1d5('0x30')](_0xf099a7)){for(var _0x123231 in _0xf099a7){if(_0xf099a7['hasOwnProperty'](_0x123231)){_0xf099a7[_0x123231]['ivrTotalCallsDays']=0x0;_0xf099a7[_0x123231]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x5ae403){if(!_['isEmpty'](_0x5ae403)){for(var _0x2f02d1 in _0x5ae403){if(_0x5ae403['hasOwnProperty'](_0x2f02d1)){_0x5ae403[_0x2f02d1][_0xc1d5('0x2d')]=0x0;_0x5ae403[_0x2f02d1][_0xc1d5('0x31')]=0x0;_0x5ae403[_0x2f02d1]['unmanaged']=0x0;_0x5ae403[_0x2f02d1][_0xc1d5('0x32')]=0x0;_0x5ae403[_0x2f02d1]['sumHoldTime']=0x0;_0x5ae403[_0x2f02d1][_0xc1d5('0x2f')]=0x0;_0x5ae403[_0x2f02d1][_0xc1d5('0x33')]=0x0;_0x5ae403[_0x2f02d1]['outboundAnswerAgiCallsDay']=0x0;_0x5ae403[_0x2f02d1]['outboundNoAnswerCallsDay']=0x0;_0x5ae403[_0x2f02d1][_0xc1d5('0x34')]=0x0;_0x5ae403[_0x2f02d1][_0xc1d5('0x35')]=0x0;_0x5ae403[_0x2f02d1][_0xc1d5('0x36')]=0x0;_0x5ae403[_0x2f02d1][_0xc1d5('0x37')]=0x0;_0x5ae403[_0x2f02d1]['outboundDropCallsDayTimeout']=0x0;_0x5ae403[_0x2f02d1]['outboundDropCallsDayCallersExit']=0x0;_0x5ae403[_0x2f02d1]['outboundBlacklistCallsDay']=0x0;_0x5ae403[_0x2f02d1]['outboundOriginateFailureCallsDay']=0x0;_0x5ae403[_0x2f02d1][_0xc1d5('0x38')]=0x0;_0x5ae403[_0x2f02d1][_0xc1d5('0x39')]=0x0;_0x5ae403[_0x2f02d1]['outboundAnswerAgiCallsDay']=0x0;_0x5ae403[_0x2f02d1]['outboundAnswerCallsDay']=0x0;_0x5ae403[_0x2f02d1][_0xc1d5('0x3a')]=!![];}}}}Realtime[_0xc1d5('0x3b')]['mergeFromDatabase']=function(_0x5c4a85,_0x1f943c){for(var _0x5638e3 in _0x1f943c){if(_0x5c4a85[_0xc1d5('0x29')](_0x5638e3)){_0x5c4a85[_0x5638e3]=_0x1f943c[_0x5638e3];}}};Realtime[_0xc1d5('0x3b')]['initAgents']=function(){var _0x566c8f=this;return function(_0x4ab078){if(_0x4ab078){freeIsNotKeyAgent(_0x4ab078,_0x566c8f['agents']);for(var _0x4a316c=0x0,_0x5bfb3a={},_0x5ba7fb={};_0x4a316c<_0x4ab078[_0xc1d5('0x3c')];_0x4a316c+=0x1){_0x5bfb3a=_0x4ab078[_0x4a316c];var _0x5e02c8=_[_0xc1d5('0x2a')](_0x5bfb3a['interface'])?util['format'](_0xc1d5('0x27'),_0x5bfb3a[_0xc1d5('0x28')]):_0x5bfb3a[_0xc1d5('0x2b')];if(_[_0xc1d5('0x3d')](_0x566c8f[_0xc1d5('0x11')][_0x5e02c8])){_0x566c8f[_0xc1d5('0x11')][_0x5e02c8]=new Agent(_0x5bfb3a);}else{_0x566c8f[_0xc1d5('0x3e')](_0x566c8f[_0xc1d5('0x11')][_0x5e02c8],_0x5bfb3a);}}}return _0x566c8f[_0xc1d5('0x11')];};};Realtime[_0xc1d5('0x3b')][_0xc1d5('0x3f')]=function(){var _0x387c47=this;return function(_0x312bfd){if(_0x312bfd){freeIsNotKeySip(_0x312bfd,_0x387c47['telephones']);for(var _0x5794f9=0x0,_0x484338={},_0x188426={};_0x5794f9<_0x312bfd['length'];_0x5794f9+=0x1){_0x484338=_0x312bfd[_0x5794f9];if(_[_0xc1d5('0x3d')](_0x387c47[_0xc1d5('0x12')][util[_0xc1d5('0x2c')]('SIP/%s',_0x484338[_0xc1d5('0x28')])])){_0x387c47[_0xc1d5('0x12')][util[_0xc1d5('0x2c')](_0xc1d5('0x27'),_0x484338[_0xc1d5('0x28')])]=new Telephone(_0x484338);}else{_0x387c47[_0xc1d5('0x3e')](_0x387c47['telephones'][util[_0xc1d5('0x2c')](_0xc1d5('0x27'),_0x484338[_0xc1d5('0x28')])],_0x484338);}}}return _0x387c47[_0xc1d5('0x12')];};};Realtime[_0xc1d5('0x3b')]['initTrunks']=function(){var _0x5a78d4=this;return function(_0x304092){if(_0x304092){freeIsNotKeySip(_0x304092,_0x5a78d4[_0xc1d5('0x40')]);for(var _0x2c79c5=0x0,_0x171428={},_0xd1f0b9={};_0x2c79c5<_0x304092['length'];_0x2c79c5+=0x1){_0x171428=_0x304092[_0x2c79c5];if(_['isUndefined'](_0x5a78d4[_0xc1d5('0x40')][util[_0xc1d5('0x2c')](_0xc1d5('0x27'),_0x171428[_0xc1d5('0x28')])])){_0x5a78d4[_0xc1d5('0x40')][util[_0xc1d5('0x2c')]('SIP/%s',_0x171428[_0xc1d5('0x28')])]=new Trunk(_0x171428);}else{_0x5a78d4['mergeFromDatabase'](_0x5a78d4[_0xc1d5('0x40')][util[_0xc1d5('0x2c')](_0xc1d5('0x27'),_0x171428['name'])],_0x171428);}}}return _0x5a78d4[_0xc1d5('0x40')];};};Realtime[_0xc1d5('0x3b')]['initVoiceQueues']=function(){var _0x1410c0=this;return function(_0x271ec7){if(_0x271ec7){freeIsNotKey(_0x271ec7,_0x1410c0['voiceQueues'],_0xc1d5('0x28'));for(var _0x326723=0x0,_0x4df86a={},_0x16adae={};_0x326723<_0x271ec7[_0xc1d5('0x3c')];_0x326723+=0x1){_0x4df86a=_0x271ec7[_0x326723];if(_[_0xc1d5('0x3d')](_0x1410c0[_0xc1d5('0x13')][_0x4df86a['name']])){_0x1410c0[_0xc1d5('0x13')][_0x4df86a['name']]=new VoiceQueue(_0x4df86a);}else{_0x1410c0[_0xc1d5('0x3e')](_0x1410c0[_0xc1d5('0x13')][_0x4df86a[_0xc1d5('0x28')]],_0x4df86a);}}}return _0x1410c0[_0xc1d5('0x13')];};};Realtime[_0xc1d5('0x3b')][_0xc1d5('0x41')]=function(){var _0x4bfe25=this;return function(_0x3bb1d6){if(_0x3bb1d6){freeIsNotKey(_0x3bb1d6,_0x4bfe25[_0xc1d5('0x14')],'id');for(var _0x1d342e=0x0,_0x3af5e7={},_0x310a52={};_0x1d342e<_0x3bb1d6['length'];_0x1d342e+=0x1){_0x3af5e7=_0x3bb1d6[_0x1d342e];if(_[_0xc1d5('0x3d')](_0x4bfe25[_0xc1d5('0x14')][_0x3af5e7['id']])){_0x4bfe25['triggers'][_0x3af5e7['id']]=new Trigger(_0x3af5e7);}else{_0x4bfe25[_0xc1d5('0x3e')](_0x4bfe25[_0xc1d5('0x14')][_0x3af5e7['id']],_0x3af5e7);}}}return _0x4bfe25['triggers'];};};Realtime[_0xc1d5('0x3b')][_0xc1d5('0x42')]=function(){var _0x185f7f=this;return function(_0x913977){if(_0x913977){freeIsNotKey(_0x913977,_0x185f7f[_0xc1d5('0x16')],'id');for(var _0x1cc576=0x0,_0x4349ab={},_0x493bff={};_0x1cc576<_0x913977[_0xc1d5('0x3c')];_0x1cc576+=0x1){_0x4349ab=_0x913977[_0x1cc576];if(_['isUndefined'](_0x185f7f['templates'][_0x4349ab['id']])){_0x185f7f['templates'][_0x4349ab['id']]=new Template(_0x4349ab);}else{_0x185f7f[_0xc1d5('0x3e')](_0x185f7f['templates'][_0x4349ab['id']],_0x4349ab);}}}return _0x185f7f[_0xc1d5('0x16')];};};Realtime[_0xc1d5('0x3b')][_0xc1d5('0x43')]=function(){var _0x11694b=this;return function(_0x3e521a){if(_0x3e521a){freeIsNotKey(_0x3e521a,_0x11694b[_0xc1d5('0x1d')],'id');for(var _0x132a6d=0x0,_0x31a1a4={},_0x1bd88f={};_0x132a6d<_0x3e521a[_0xc1d5('0x3c')];_0x132a6d+=0x1){_0x31a1a4=_0x3e521a[_0x132a6d];if(_[_0xc1d5('0x3d')](_0x11694b[_0xc1d5('0x1d')][_0x31a1a4['id']])){_0x11694b[_0xc1d5('0x1d')][_0x31a1a4['id']]=new ZendeskAccount(_0x31a1a4);}else{_0x11694b[_0xc1d5('0x3e')](_0x11694b[_0xc1d5('0x1d')][_0x31a1a4['id']],_0x31a1a4);}}}return _0x11694b[_0xc1d5('0x1d')];};};Realtime[_0xc1d5('0x3b')]['initSalesforceAccounts']=function(){var _0x668e89=this;return function(_0x501899){if(_0x501899){freeIsNotKey(_0x501899,_0x668e89[_0xc1d5('0x44')],'id');for(var _0x680719=0x0,_0x16c60c={},_0x449a79={};_0x680719<_0x501899[_0xc1d5('0x3c')];_0x680719+=0x1){_0x16c60c=_0x501899[_0x680719];if(_[_0xc1d5('0x3d')](_0x668e89[_0xc1d5('0x44')][_0x16c60c['id']])){_0x668e89['salesforceAccounts'][_0x16c60c['id']]=new SalesforceAccount(_0x16c60c);}else{_0x668e89[_0xc1d5('0x3e')](_0x668e89[_0xc1d5('0x44')][_0x16c60c['id']],_0x16c60c);}}}return _0x668e89[_0xc1d5('0x44')];};};Realtime['prototype'][_0xc1d5('0x45')]=function(){var _0x1bfa1a=this;return function(_0x4abded){if(_0x4abded){freeIsNotKey(_0x4abded,_0x1bfa1a[_0xc1d5('0x1f')],'id');for(var _0x2ae8f7=0x0,_0x5da7cb={},_0x343638={};_0x2ae8f7<_0x4abded[_0xc1d5('0x3c')];_0x2ae8f7+=0x1){_0x5da7cb=_0x4abded[_0x2ae8f7];if(_[_0xc1d5('0x3d')](_0x1bfa1a[_0xc1d5('0x1f')][_0x5da7cb['id']])){_0x1bfa1a['freshdeskAccounts'][_0x5da7cb['id']]=new FreshdeskAccount(_0x5da7cb);}else{_0x1bfa1a[_0xc1d5('0x3e')](_0x1bfa1a[_0xc1d5('0x1f')][_0x5da7cb['id']],_0x5da7cb);}}}return _0x1bfa1a[_0xc1d5('0x1f')];};};Realtime[_0xc1d5('0x3b')][_0xc1d5('0x46')]=function(){var _0x29e56a=this;return function(_0x53ac39){if(_0x53ac39){freeIsNotKey(_0x53ac39,_0x29e56a['zohoAccounts'],'id');for(var _0x16e1fe=0x0,_0x2d8d4a={},_0x2f669f={};_0x16e1fe<_0x53ac39[_0xc1d5('0x3c')];_0x16e1fe+=0x1){_0x2d8d4a=_0x53ac39[_0x16e1fe];if(_[_0xc1d5('0x3d')](_0x29e56a[_0xc1d5('0x20')][_0x2d8d4a['id']])){_0x29e56a[_0xc1d5('0x20')][_0x2d8d4a['id']]=new ZohoAccount(_0x2d8d4a);}else{_0x29e56a[_0xc1d5('0x3e')](_0x29e56a[_0xc1d5('0x20')][_0x2d8d4a['id']],_0x2d8d4a);}}}return _0x29e56a['zohoAccounts'];};};Realtime['prototype'][_0xc1d5('0x47')]=function(){var _0x49ccf2=this;return function(_0x473cd8){if(_0x473cd8){freeIsNotKey(_0x473cd8,_0x49ccf2[_0xc1d5('0x48')],'id');for(var _0x4e966e=0x0,_0xf1a2cc={},_0x595863={};_0x4e966e<_0x473cd8[_0xc1d5('0x3c')];_0x4e966e+=0x1){_0xf1a2cc=_0x473cd8[_0x4e966e];if(_[_0xc1d5('0x3d')](_0x49ccf2[_0xc1d5('0x48')][_0xf1a2cc['id']])){_0x49ccf2[_0xc1d5('0x48')][_0xf1a2cc['id']]=new DeskAccount(_0xf1a2cc);}else{_0x49ccf2[_0xc1d5('0x3e')](_0x49ccf2[_0xc1d5('0x48')][_0xf1a2cc['id']],_0xf1a2cc);}}}return _0x49ccf2['deskAccounts'];};};Realtime[_0xc1d5('0x3b')][_0xc1d5('0x49')]=function(){var _0x4926b1=this;return function(_0x3007e5){if(_0x3007e5){freeIsNotKey(_0x3007e5,_0x4926b1['sugarcrmAccounts'],'id');for(var _0x583719=0x0,_0x3b4b88={},_0x34cd08={};_0x583719<_0x3007e5[_0xc1d5('0x3c')];_0x583719+=0x1){_0x3b4b88=_0x3007e5[_0x583719];if(_['isUndefined'](_0x4926b1[_0xc1d5('0x1e')][_0x3b4b88['id']])){_0x4926b1['sugarcrmAccounts'][_0x3b4b88['id']]=new SugarcrmAccount(_0x3b4b88);}else{_0x4926b1['mergeFromDatabase'](_0x4926b1[_0xc1d5('0x1e')][_0x3b4b88['id']],_0x3b4b88);}}}return _0x4926b1[_0xc1d5('0x1e')];};};Realtime[_0xc1d5('0x3b')][_0xc1d5('0x4a')]=function(){var _0xc488d3=this;return function(_0xb0a509){if(_0xb0a509){freeIsNotKey(_0xb0a509,_0xc488d3['vtigerAccounts'],'id');for(var _0x3fd377=0x0,_0x5ce1ce={},_0x2a5c55={};_0x3fd377<_0xb0a509[_0xc1d5('0x3c')];_0x3fd377+=0x1){_0x5ce1ce=_0xb0a509[_0x3fd377];if(_[_0xc1d5('0x3d')](_0xc488d3['vtigerAccounts'][_0x5ce1ce['id']])){_0xc488d3['vtigerAccounts'][_0x5ce1ce['id']]=new VtigerAccount(_0x5ce1ce);}else{_0xc488d3[_0xc1d5('0x3e')](_0xc488d3[_0xc1d5('0x21')][_0x5ce1ce['id']],_0x5ce1ce);}}}return _0xc488d3[_0xc1d5('0x21')];};};Realtime[_0xc1d5('0x3b')]['initServicenowAccounts']=function(){var _0x2bc2b8=this;return function(_0x4f2f58){if(_0x4f2f58){freeIsNotKey(_0x4f2f58,_0x2bc2b8['servicenowAccounts'],'id');for(var _0x3cedda=0x0,_0x456f80={},_0x576647={};_0x3cedda<_0x4f2f58['length'];_0x3cedda+=0x1){_0x456f80=_0x4f2f58[_0x3cedda];if(_[_0xc1d5('0x3d')](_0x2bc2b8['servicenowAccounts'][_0x456f80['id']])){_0x2bc2b8[_0xc1d5('0x22')][_0x456f80['id']]=new ServicenowAccount(_0x456f80);}else{_0x2bc2b8[_0xc1d5('0x3e')](_0x2bc2b8[_0xc1d5('0x22')][_0x456f80['id']],_0x456f80);}}}return _0x2bc2b8[_0xc1d5('0x22')];};};Realtime['prototype']['initDynamics365Accounts']=function(){var _0x172ac5=this;return function(_0x155d12){if(_0x155d12){freeIsNotKey(_0x155d12,_0x172ac5[_0xc1d5('0x23')],'id');for(var _0x1e3ab0=0x0,_0x34c4de={},_0x5428bd={};_0x1e3ab0<_0x155d12['length'];_0x1e3ab0+=0x1){_0x34c4de=_0x155d12[_0x1e3ab0];if(_['isUndefined'](_0x172ac5[_0xc1d5('0x23')][_0x34c4de['id']])){_0x172ac5[_0xc1d5('0x23')][_0x34c4de['id']]=new Dynamics365Account(_0x34c4de);}else{_0x172ac5[_0xc1d5('0x3e')](_0x172ac5['dynamics365Accounts'][_0x34c4de['id']],_0x34c4de);}}}return _0x172ac5['dynamics365Accounts'];};};Realtime[_0xc1d5('0x3b')][_0xc1d5('0x4b')]=function(){var _0x2ba914=this;return function(_0x13085a){if(_0x13085a){freeIsNotKey(_0x13085a,_0x2ba914['freshsalesAccounts'],'id');for(var _0x12a2c0=0x0,_0x4bea7f={},_0x3b1be0={};_0x12a2c0<_0x13085a[_0xc1d5('0x3c')];_0x12a2c0+=0x1){_0x4bea7f=_0x13085a[_0x12a2c0];if(_['isUndefined'](_0x2ba914['freshsalesAccounts'][_0x4bea7f['id']])){_0x2ba914[_0xc1d5('0x24')][_0x4bea7f['id']]=new FreshsalesAccount(_0x4bea7f);}else{_0x2ba914[_0xc1d5('0x3e')](_0x2ba914[_0xc1d5('0x24')][_0x4bea7f['id']],_0x4bea7f);}}}return _0x2ba914[_0xc1d5('0x24')];};};Realtime[_0xc1d5('0x3b')][_0xc1d5('0x4c')]=function(){var _0x9187d4=this;return function(_0x327dd0){for(var _0x533995=0x0;_0x533995<_0x327dd0[_0xc1d5('0x3c')];_0x533995+=0x1){_[_0xc1d5('0x4d')](_0x9187d4['voiceQueues'][_0x327dd0[_0x533995][_0xc1d5('0x28')]],_0x327dd0[_0x533995]);}return _0x9187d4['voiceQueues'];};};Realtime['prototype'][_0xc1d5('0x4e')]=function(){var _0x158e6c=this;return function(_0x5a35b1){clearVoiceQueues(_0x158e6c['voiceQueues']);if(_0x5a35b1){_0x5a35b1=_['groupBy'](_0x5a35b1,_0xc1d5('0x4f'));for(var _0x22bb39 in _0x5a35b1){if(_0x5a35b1[_0xc1d5('0x29')](_0x22bb39)){var _0xcaf5b7={};for(var _0x55c62f=0x0;_0x55c62f<_0x5a35b1[_0x22bb39][_0xc1d5('0x3c')];_0x55c62f+=0x1){var _0x2a3e1f=_0x5a35b1[_0x22bb39][_0x55c62f][_0xc1d5('0x50')];if(_0x158e6c[_0xc1d5('0x13')][_0x2a3e1f]){if(_0x5a35b1[_0x22bb39][_0x55c62f][_0xc1d5('0x51')]){_0x158e6c[_0xc1d5('0x13')][_0x2a3e1f]['unmanaged']+=0x1;}if(_0x5a35b1[_0x22bb39][_0x55c62f][_0xc1d5('0x52')]){_0x158e6c['voiceQueues'][_0x2a3e1f][_0xc1d5('0x32')]+=0x1;}_0x158e6c[_0xc1d5('0x13')][_0x2a3e1f]['sumHoldTime']+=moment(_0x5a35b1[_0x22bb39][_0x55c62f]['queuecallerleaveAt'])[_0xc1d5('0x53')](moment(_0x5a35b1[_0x22bb39][_0x55c62f][_0xc1d5('0x54')]),_0xc1d5('0x55'))||0x0;if(_0x55c62f===_0x5a35b1[_0x22bb39][_0xc1d5('0x3c')]-0x1){_0x158e6c[_0xc1d5('0x13')][_0x2a3e1f][_0xc1d5('0x2f')]+=moment(_0x5a35b1[_0x22bb39][_0x55c62f]['queuecallercompleteAt']||_0x5a35b1[_0x22bb39][_0x55c62f][_0xc1d5('0x56')]||_0x5a35b1[_0x22bb39][_0x55c62f][_0xc1d5('0x57')])[_0xc1d5('0x53')](moment(_0x5a35b1[_0x22bb39][_0x55c62f][_0xc1d5('0x54')]),_0xc1d5('0x55'))||0x0;_0x158e6c[_0xc1d5('0x13')][_0x2a3e1f][_0xc1d5('0x2d')]+=0x1;if(_0x5a35b1[_0x22bb39][_0x55c62f][_0xc1d5('0x58')]){_0x158e6c[_0xc1d5('0x13')][_0x2a3e1f][_0xc1d5('0x31')]+=0x1;_0x158e6c[_0xc1d5('0x13')][_0x2a3e1f][_0xc1d5('0x33')]+=moment(_0x5a35b1[_0x22bb39][_0x55c62f][_0xc1d5('0x59')])[_0xc1d5('0x53')](moment(_0x5a35b1[_0x22bb39][_0x55c62f][_0xc1d5('0x5a')]),'seconds')||0x0;}}else{_0x158e6c[_0xc1d5('0x13')][_0x2a3e1f][_0xc1d5('0x2f')]+=_0x158e6c[_0xc1d5('0x13')][_0x2a3e1f][_0xc1d5('0x2e')]||0x0;}}}}}}return _0x158e6c[_0xc1d5('0x13')];};};Realtime[_0xc1d5('0x3b')]['initVoiceCallReports']=function(){var _0x1b8425=this;return function(_0x4fef02){clearVoiceCallReports(_0x1b8425[_0xc1d5('0x17')]);if(_0x4fef02){for(var _0x5879e4=0x0;_0x5879e4<_0x4fef02[_0xc1d5('0x3c')];_0x5879e4+=0x1){_0x1b8425[_0xc1d5('0x17')][_0xc1d5('0x2d')]+=0x1;_0x1b8425[_0xc1d5('0x17')][_0xc1d5('0x2f')]+=_0x4fef02[_0x5879e4][_0xc1d5('0x5b')];if(_0x4fef02[_0x5879e4]['disposition']===_0xc1d5('0x5c')){_0x1b8425[_0xc1d5('0x17')][_0xc1d5('0x31')]+=0x1;_0x1b8425[_0xc1d5('0x17')][_0xc1d5('0x2e')]+=_0x4fef02[_0x5879e4]['duration']-_0x4fef02[_0x5879e4][_0xc1d5('0x5d')]||0x0;_0x1b8425[_0xc1d5('0x17')][_0xc1d5('0x33')]+=_0x4fef02[_0x5879e4][_0xc1d5('0x5d')];}}}return _0x1b8425[_0xc1d5('0x17')];};};Realtime['prototype'][_0xc1d5('0x5e')]=function(){var _0x5d46e7=this;return function(_0x3450f7){if(_0x3450f7){freeIsNotKey(_0x3450f7,_0x5d46e7[_0xc1d5('0x15')],_0xc1d5('0x28'));for(var _0x1fb3b5=0x0,_0x4466f3={};_0x1fb3b5<_0x3450f7[_0xc1d5('0x3c')];_0x1fb3b5+=0x1){_0x4466f3=_0x3450f7[_0x1fb3b5];if(_[_0xc1d5('0x3d')](_0x5d46e7[_0xc1d5('0x15')][_0x4466f3[_0xc1d5('0x28')]])){_0x5d46e7[_0xc1d5('0x15')][_0x4466f3[_0xc1d5('0x28')]]=new Campaign(_0x4466f3);}else{_0x5d46e7['mergeFromDatabase'](_0x5d46e7[_0xc1d5('0x15')][_0x4466f3['name']],_0x4466f3);_0x5d46e7[_0xc1d5('0x15')][_0x4466f3[_0xc1d5('0x28')]][_0xc1d5('0x5f')]=_0x4466f3[_0xc1d5('0x60')]?_0x4466f3[_0xc1d5('0x60')][_0xc1d5('0x28')]:undefined;}}}return _0x5d46e7[_0xc1d5('0x15')];};};Realtime[_0xc1d5('0x3b')][_0xc1d5('0x61')]=function(){var _0x1c9ab4=this;return function(_0x164eb8){if(_0x164eb8){freeIsNotKey(_0x164eb8,_0x1c9ab4[_0xc1d5('0x18')],'id');for(var _0x56643e=0x0,_0x554edd={};_0x56643e<_0x164eb8[_0xc1d5('0x3c')];_0x56643e+=0x1){_0x554edd=_0x164eb8[_0x56643e];if(_[_0xc1d5('0x3d')](_0x1c9ab4[_0xc1d5('0x18')][_0x554edd['id']])){_0x1c9ab4['voiceExtensions'][_0x554edd['id']]=new VoiceExtension(_0x554edd);}else{_0x1c9ab4['mergeFromDatabase'](_0x1c9ab4[_0xc1d5('0x18')][_0x554edd['id']],_0x554edd);}}}return _0x1c9ab4['voiceExtensions'];};};Realtime[_0xc1d5('0x3b')]['initCampaignHopperHistory']=function(){var _0x2c5b3b=this;return function(_0x45159a){clearCampaigns(_0x2c5b3b[_0xc1d5('0x15')]);for(var _0x320a33=0x0;_0x320a33<_0x45159a['length'];_0x320a33+=0x1){_[_0xc1d5('0x4d')](_0x2c5b3b[_0xc1d5('0x15')][_0x45159a[_0x320a33]['name']],_0x45159a[_0x320a33]);}return _0x2c5b3b[_0xc1d5('0x15')];};};Realtime[_0xc1d5('0x3b')][_0xc1d5('0x62')]=function(){var _0x4e7cc9=this;return function(_0x302c97){if(_0x302c97){freeIsNotKey(_0x302c97,_0x4e7cc9['faxAccounts'],'id');for(var _0x2849fd=0x0,_0xa610eb={},_0x2dbe7f={};_0x2849fd<_0x302c97[_0xc1d5('0x3c')];_0x2849fd+=0x1){_0xa610eb=_0x302c97[_0x2849fd];if(_['isUndefined'](_0x4e7cc9['faxAccounts'][_0xa610eb['id']])){_0x4e7cc9[_0xc1d5('0x25')][_0xa610eb['id']]=new FaxAccount(_0xa610eb);}else{_0x4e7cc9[_0xc1d5('0x3e')](_0x4e7cc9['faxAccounts'][_0xa610eb['id']],_0xa610eb);}}}return _0x4e7cc9[_0xc1d5('0x25')];};};module[_0xc1d5('0x63')]=Realtime; \ No newline at end of file +var _0x0331=['exports','bluebird','util','lodash','moment','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','voiceQueues','triggers','campaigns','outbound','voiceExtensions','channels','outboundChannels','timers','settings','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','faxAccounts','mapKeys','hasOwnProperty','format','SIP/%s','name','isNil','interface','answered','sumHoldTime','sumDuration','ivrTotalCallsDays','ivrAnswerCallsDay','isEmpty','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','prototype','initAgents','length','initTelephones','initTrunks','initVoiceQueues','isUndefined','initTriggers','initTemplates','templates','initZendeskAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','freshsalesAccounts','initVoiceQueueHopperHistory','initVoiceQueueReports','groupBy','queue','queuecallerexit','queuecallerabandon','queuecallerleaveAt','diff','seconds','queuecallerexitAt','queuecallerjoinAt','queuecallercomplete','sumBillable','initVoiceCallReports','total','disposition','ANSWERED','duration','billableseconds','initCampaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts'];(function(_0x1b199d,_0x3629ad){var _0x3204a0=function(_0x5c10d6){while(--_0x5c10d6){_0x1b199d['push'](_0x1b199d['shift']());}};_0x3204a0(++_0x3629ad);}(_0x0331,0x74));var _0x1033=function(_0x503950,_0x5022eb){_0x503950=_0x503950-0x0;var _0x1657a9=_0x0331[_0x503950];return _0x1657a9;};'use strict';var BPromise=require(_0x1033('0x0'));var util=require(_0x1033('0x1'));var _=require(_0x1033('0x2'));var moment=require(_0x1033('0x3'));var Agent=require(_0x1033('0x4'));var Telephone=require(_0x1033('0x5'));var Trunk=require(_0x1033('0x6'));var VoiceQueue=require(_0x1033('0x7'));var Trigger=require(_0x1033('0x8'));var Template=require(_0x1033('0x9'));var Campaign=require(_0x1033('0xa'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0x1033('0xb'));var SalesforceAccount=require(_0x1033('0xc'));var FreshdeskAccount=require(_0x1033('0xd'));var SugarcrmAccount=require(_0x1033('0xe'));var ZohoAccount=require(_0x1033('0xf'));var DeskAccount=require(_0x1033('0x10'));var VtigerAccount=require(_0x1033('0x11'));var ServicenowAccount=require(_0x1033('0x12'));var Dynamics365Account=require(_0x1033('0x13'));var FreshsalesAccount=require(_0x1033('0x14'));var FaxAccount=require(_0x1033('0x15'));var Realtime=function(){this[_0x1033('0x16')]={};this[_0x1033('0x17')]={};this[_0x1033('0x18')]={};this[_0x1033('0x19')]={};this[_0x1033('0x1a')]={};this[_0x1033('0x1b')]={};this['templates']={};this[_0x1033('0x1c')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x1033('0x1d')]={};this[_0x1033('0x1e')]={};this['queueChannels']={};this[_0x1033('0x1f')]={};this[_0x1033('0x20')]={};this[_0x1033('0x21')]={};this[_0x1033('0x22')]={};this[_0x1033('0x23')]={};this[_0x1033('0x24')]={};this[_0x1033('0x25')]={};this[_0x1033('0x26')]={};this[_0x1033('0x27')]={};this[_0x1033('0x28')]={};this[_0x1033('0x29')]={};this[_0x1033('0x2a')]={};this['freshsalesAccounts']={};this[_0x1033('0x2b')]={};};function freeIsNotKey(_0x3829db,_0x4d2f00,_0x5e6fbf){var _0x581a30=_[_0x1033('0x2c')](_0x3829db,function(_0x27c284,_0xe99429){return _0x27c284[_0x5e6fbf];});for(var _0x4e2c35 in _0x4d2f00){if(_0x4d2f00[_0x1033('0x2d')](_0x4e2c35)){if(!_0x581a30[_0x4e2c35]){delete _0x4d2f00[_0x4e2c35];}}}}function freeIsNotKeySip(_0x256241,_0x5b6f99){var _0xaa5d7e=_[_0x1033('0x2c')](_0x256241,function(_0x3e49d8,_0x57311e){return util[_0x1033('0x2e')](_0x1033('0x2f'),_0x3e49d8[_0x1033('0x30')]);});for(var _0xae7942 in _0x5b6f99){if(_0x5b6f99[_0x1033('0x2d')](_0xae7942)){if(!_0xaa5d7e[_0xae7942]){delete _0x5b6f99[_0xae7942];}}}}function freeIsNotKeyAgent(_0x376da0,_0x1c021e){var _0x15ea52=_['mapKeys'](_0x376da0,function(_0x199528,_0xb2b70d){var _0xa37e5e=_[_0x1033('0x31')](_0x199528['interface'])?util[_0x1033('0x2e')](_0x1033('0x2f'),_0x199528[_0x1033('0x30')]):_0x199528[_0x1033('0x32')];return _0xa37e5e;});for(var _0x56e3ad in _0x1c021e){if(_0x1c021e[_0x1033('0x2d')](_0x56e3ad)){if(!_0x15ea52[_0x56e3ad]){delete _0x1c021e[_0x56e3ad];}}}}function clearVoiceCallReports(_0x5d2c1f){_0x5d2c1f['total']=0x0;_0x5d2c1f[_0x1033('0x33')]=0x0;_0x5d2c1f[_0x1033('0x34')]=0x0;_0x5d2c1f[_0x1033('0x35')]=0x0;_0x5d2c1f['sumBillable']=0x0;}function clearCampaigns(_0x59fde9){if(!_['isEmpty'](_0x59fde9)){for(var _0x11731 in _0x59fde9){if(_0x59fde9[_0x1033('0x2d')](_0x11731)){_0x59fde9[_0x11731][_0x1033('0x36')]=0x0;_0x59fde9[_0x11731][_0x1033('0x37')]=0x0;}}}}function clearVoiceQueues(_0x1140fe){if(!_[_0x1033('0x38')](_0x1140fe)){for(var _0x5a2b78 in _0x1140fe){if(_0x1140fe[_0x1033('0x2d')](_0x5a2b78)){_0x1140fe[_0x5a2b78]['total']=0x0;_0x1140fe[_0x5a2b78][_0x1033('0x33')]=0x0;_0x1140fe[_0x5a2b78][_0x1033('0x39')]=0x0;_0x1140fe[_0x5a2b78][_0x1033('0x3a')]=0x0;_0x1140fe[_0x5a2b78][_0x1033('0x34')]=0x0;_0x1140fe[_0x5a2b78][_0x1033('0x35')]=0x0;_0x1140fe[_0x5a2b78]['sumBillable']=0x0;_0x1140fe[_0x5a2b78][_0x1033('0x3b')]=0x0;_0x1140fe[_0x5a2b78][_0x1033('0x3c')]=0x0;_0x1140fe[_0x5a2b78]['outboundBusyCallsDay']=0x0;_0x1140fe[_0x5a2b78]['outboundCongestionCallsDay']=0x0;_0x1140fe[_0x5a2b78][_0x1033('0x3d')]=0x0;_0x1140fe[_0x5a2b78][_0x1033('0x3e')]=0x0;_0x1140fe[_0x5a2b78]['outboundDropCallsDayTimeout']=0x0;_0x1140fe[_0x5a2b78][_0x1033('0x3f')]=0x0;_0x1140fe[_0x5a2b78][_0x1033('0x40')]=0x0;_0x1140fe[_0x5a2b78][_0x1033('0x41')]=0x0;_0x1140fe[_0x5a2b78][_0x1033('0x42')]=0x0;_0x1140fe[_0x5a2b78][_0x1033('0x43')]=0x0;_0x1140fe[_0x5a2b78]['outboundAnswerAgiCallsDay']=0x0;_0x1140fe[_0x5a2b78][_0x1033('0x44')]=0x0;_0x1140fe[_0x5a2b78][_0x1033('0x45')]=!![];}}}}Realtime['prototype'][_0x1033('0x46')]=function(_0x13a0b0,_0x5e1b31){for(var _0x16aab0 in _0x5e1b31){if(_0x13a0b0[_0x1033('0x2d')](_0x16aab0)){_0x13a0b0[_0x16aab0]=_0x5e1b31[_0x16aab0];}}};Realtime[_0x1033('0x47')][_0x1033('0x48')]=function(){var _0x33571c=this;return function(_0x4cc456){if(_0x4cc456){freeIsNotKeyAgent(_0x4cc456,_0x33571c[_0x1033('0x16')]);for(var _0x2fe302=0x0,_0x16c974={},_0x1e8013={};_0x2fe302<_0x4cc456[_0x1033('0x49')];_0x2fe302+=0x1){_0x16c974=_0x4cc456[_0x2fe302];var _0x3bb25b=_[_0x1033('0x31')](_0x16c974[_0x1033('0x32')])?util['format'](_0x1033('0x2f'),_0x16c974[_0x1033('0x30')]):_0x16c974['interface'];if(_['isUndefined'](_0x33571c['agents'][_0x3bb25b])){_0x33571c[_0x1033('0x16')][_0x3bb25b]=new Agent(_0x16c974);}else{_0x33571c['mergeFromDatabase'](_0x33571c[_0x1033('0x16')][_0x3bb25b],_0x16c974);}}}return _0x33571c[_0x1033('0x16')];};};Realtime[_0x1033('0x47')][_0x1033('0x4a')]=function(){var _0x30618d=this;return function(_0x36c5ce){if(_0x36c5ce){freeIsNotKeySip(_0x36c5ce,_0x30618d[_0x1033('0x17')]);for(var _0x478346=0x0,_0x56af1c={},_0x1baa51={};_0x478346<_0x36c5ce[_0x1033('0x49')];_0x478346+=0x1){_0x56af1c=_0x36c5ce[_0x478346];if(_['isUndefined'](_0x30618d[_0x1033('0x17')][util[_0x1033('0x2e')](_0x1033('0x2f'),_0x56af1c[_0x1033('0x30')])])){_0x30618d[_0x1033('0x17')][util[_0x1033('0x2e')](_0x1033('0x2f'),_0x56af1c[_0x1033('0x30')])]=new Telephone(_0x56af1c);}else{_0x30618d[_0x1033('0x46')](_0x30618d[_0x1033('0x17')][util[_0x1033('0x2e')](_0x1033('0x2f'),_0x56af1c[_0x1033('0x30')])],_0x56af1c);}}}return _0x30618d['telephones'];};};Realtime[_0x1033('0x47')][_0x1033('0x4b')]=function(){var _0x3a3ca3=this;return function(_0x2defd3){if(_0x2defd3){freeIsNotKeySip(_0x2defd3,_0x3a3ca3[_0x1033('0x18')]);for(var _0x119544=0x0,_0x280241={},_0x2f936f={};_0x119544<_0x2defd3[_0x1033('0x49')];_0x119544+=0x1){_0x280241=_0x2defd3[_0x119544];if(_['isUndefined'](_0x3a3ca3['trunks'][util['format'](_0x1033('0x2f'),_0x280241[_0x1033('0x30')])])){_0x3a3ca3[_0x1033('0x18')][util[_0x1033('0x2e')](_0x1033('0x2f'),_0x280241['name'])]=new Trunk(_0x280241);}else{_0x3a3ca3[_0x1033('0x46')](_0x3a3ca3[_0x1033('0x18')][util[_0x1033('0x2e')](_0x1033('0x2f'),_0x280241[_0x1033('0x30')])],_0x280241);}}}return _0x3a3ca3[_0x1033('0x18')];};};Realtime[_0x1033('0x47')][_0x1033('0x4c')]=function(){var _0x36e579=this;return function(_0x43c939){if(_0x43c939){freeIsNotKey(_0x43c939,_0x36e579[_0x1033('0x19')],_0x1033('0x30'));for(var _0x16c872=0x0,_0x480fdc={},_0x360a38={};_0x16c872<_0x43c939[_0x1033('0x49')];_0x16c872+=0x1){_0x480fdc=_0x43c939[_0x16c872];if(_[_0x1033('0x4d')](_0x36e579[_0x1033('0x19')][_0x480fdc[_0x1033('0x30')]])){_0x36e579[_0x1033('0x19')][_0x480fdc[_0x1033('0x30')]]=new VoiceQueue(_0x480fdc);}else{_0x36e579['mergeFromDatabase'](_0x36e579[_0x1033('0x19')][_0x480fdc[_0x1033('0x30')]],_0x480fdc);}}}return _0x36e579[_0x1033('0x19')];};};Realtime[_0x1033('0x47')][_0x1033('0x4e')]=function(){var _0x297f5d=this;return function(_0xf7ba7a){if(_0xf7ba7a){freeIsNotKey(_0xf7ba7a,_0x297f5d[_0x1033('0x1a')],'id');for(var _0x389517=0x0,_0x335af0={},_0x5da930={};_0x389517<_0xf7ba7a['length'];_0x389517+=0x1){_0x335af0=_0xf7ba7a[_0x389517];if(_['isUndefined'](_0x297f5d['triggers'][_0x335af0['id']])){_0x297f5d[_0x1033('0x1a')][_0x335af0['id']]=new Trigger(_0x335af0);}else{_0x297f5d[_0x1033('0x46')](_0x297f5d[_0x1033('0x1a')][_0x335af0['id']],_0x335af0);}}}return _0x297f5d[_0x1033('0x1a')];};};Realtime[_0x1033('0x47')][_0x1033('0x4f')]=function(){var _0x451f25=this;return function(_0x5fd630){if(_0x5fd630){freeIsNotKey(_0x5fd630,_0x451f25['templates'],'id');for(var _0x588a92=0x0,_0x308df9={},_0xbe27b7={};_0x588a92<_0x5fd630[_0x1033('0x49')];_0x588a92+=0x1){_0x308df9=_0x5fd630[_0x588a92];if(_[_0x1033('0x4d')](_0x451f25[_0x1033('0x50')][_0x308df9['id']])){_0x451f25[_0x1033('0x50')][_0x308df9['id']]=new Template(_0x308df9);}else{_0x451f25['mergeFromDatabase'](_0x451f25[_0x1033('0x50')][_0x308df9['id']],_0x308df9);}}}return _0x451f25[_0x1033('0x50')];};};Realtime[_0x1033('0x47')][_0x1033('0x51')]=function(){var _0xa56f83=this;return function(_0x193821){if(_0x193821){freeIsNotKey(_0x193821,_0xa56f83['zendeskAccounts'],'id');for(var _0x278a2f=0x0,_0x3ed1b4={},_0x4a4d66={};_0x278a2f<_0x193821[_0x1033('0x49')];_0x278a2f+=0x1){_0x3ed1b4=_0x193821[_0x278a2f];if(_[_0x1033('0x4d')](_0xa56f83[_0x1033('0x22')][_0x3ed1b4['id']])){_0xa56f83[_0x1033('0x22')][_0x3ed1b4['id']]=new ZendeskAccount(_0x3ed1b4);}else{_0xa56f83[_0x1033('0x46')](_0xa56f83[_0x1033('0x22')][_0x3ed1b4['id']],_0x3ed1b4);}}}return _0xa56f83['zendeskAccounts'];};};Realtime[_0x1033('0x47')]['initSalesforceAccounts']=function(){var _0x39ddf0=this;return function(_0x1a3ce7){if(_0x1a3ce7){freeIsNotKey(_0x1a3ce7,_0x39ddf0['salesforceAccounts'],'id');for(var _0x524dfb=0x0,_0x1e4fdd={},_0x4f1440={};_0x524dfb<_0x1a3ce7[_0x1033('0x49')];_0x524dfb+=0x1){_0x1e4fdd=_0x1a3ce7[_0x524dfb];if(_[_0x1033('0x4d')](_0x39ddf0[_0x1033('0x23')][_0x1e4fdd['id']])){_0x39ddf0[_0x1033('0x23')][_0x1e4fdd['id']]=new SalesforceAccount(_0x1e4fdd);}else{_0x39ddf0[_0x1033('0x46')](_0x39ddf0[_0x1033('0x23')][_0x1e4fdd['id']],_0x1e4fdd);}}}return _0x39ddf0[_0x1033('0x23')];};};Realtime[_0x1033('0x47')][_0x1033('0x52')]=function(){var _0x300c5b=this;return function(_0x408f70){if(_0x408f70){freeIsNotKey(_0x408f70,_0x300c5b[_0x1033('0x25')],'id');for(var _0x1e453e=0x0,_0x5d640e={},_0x21fc86={};_0x1e453e<_0x408f70[_0x1033('0x49')];_0x1e453e+=0x1){_0x5d640e=_0x408f70[_0x1e453e];if(_[_0x1033('0x4d')](_0x300c5b[_0x1033('0x25')][_0x5d640e['id']])){_0x300c5b[_0x1033('0x25')][_0x5d640e['id']]=new FreshdeskAccount(_0x5d640e);}else{_0x300c5b[_0x1033('0x46')](_0x300c5b[_0x1033('0x25')][_0x5d640e['id']],_0x5d640e);}}}return _0x300c5b[_0x1033('0x25')];};};Realtime[_0x1033('0x47')]['initZohoAccounts']=function(){var _0x2f0939=this;return function(_0x2700cd){if(_0x2700cd){freeIsNotKey(_0x2700cd,_0x2f0939[_0x1033('0x26')],'id');for(var _0x28451b=0x0,_0x3c4298={},_0x515923={};_0x28451b<_0x2700cd[_0x1033('0x49')];_0x28451b+=0x1){_0x3c4298=_0x2700cd[_0x28451b];if(_[_0x1033('0x4d')](_0x2f0939['zohoAccounts'][_0x3c4298['id']])){_0x2f0939[_0x1033('0x26')][_0x3c4298['id']]=new ZohoAccount(_0x3c4298);}else{_0x2f0939['mergeFromDatabase'](_0x2f0939[_0x1033('0x26')][_0x3c4298['id']],_0x3c4298);}}}return _0x2f0939['zohoAccounts'];};};Realtime[_0x1033('0x47')][_0x1033('0x53')]=function(){var _0x7e8441=this;return function(_0x2a0892){if(_0x2a0892){freeIsNotKey(_0x2a0892,_0x7e8441[_0x1033('0x27')],'id');for(var _0x102de3=0x0,_0x3a95d0={},_0x41cfd2={};_0x102de3<_0x2a0892[_0x1033('0x49')];_0x102de3+=0x1){_0x3a95d0=_0x2a0892[_0x102de3];if(_[_0x1033('0x4d')](_0x7e8441[_0x1033('0x27')][_0x3a95d0['id']])){_0x7e8441['deskAccounts'][_0x3a95d0['id']]=new DeskAccount(_0x3a95d0);}else{_0x7e8441['mergeFromDatabase'](_0x7e8441['deskAccounts'][_0x3a95d0['id']],_0x3a95d0);}}}return _0x7e8441[_0x1033('0x27')];};};Realtime[_0x1033('0x47')][_0x1033('0x54')]=function(){var _0xddfac9=this;return function(_0x146a19){if(_0x146a19){freeIsNotKey(_0x146a19,_0xddfac9[_0x1033('0x24')],'id');for(var _0x277454=0x0,_0x55c616={},_0x1c21c9={};_0x277454<_0x146a19[_0x1033('0x49')];_0x277454+=0x1){_0x55c616=_0x146a19[_0x277454];if(_['isUndefined'](_0xddfac9['sugarcrmAccounts'][_0x55c616['id']])){_0xddfac9['sugarcrmAccounts'][_0x55c616['id']]=new SugarcrmAccount(_0x55c616);}else{_0xddfac9[_0x1033('0x46')](_0xddfac9[_0x1033('0x24')][_0x55c616['id']],_0x55c616);}}}return _0xddfac9[_0x1033('0x24')];};};Realtime[_0x1033('0x47')]['initVtigerAccounts']=function(){var _0x277e6d=this;return function(_0xe084d6){if(_0xe084d6){freeIsNotKey(_0xe084d6,_0x277e6d[_0x1033('0x28')],'id');for(var _0x3de185=0x0,_0x5c17b1={},_0x5230fb={};_0x3de185<_0xe084d6[_0x1033('0x49')];_0x3de185+=0x1){_0x5c17b1=_0xe084d6[_0x3de185];if(_[_0x1033('0x4d')](_0x277e6d['vtigerAccounts'][_0x5c17b1['id']])){_0x277e6d[_0x1033('0x28')][_0x5c17b1['id']]=new VtigerAccount(_0x5c17b1);}else{_0x277e6d[_0x1033('0x46')](_0x277e6d[_0x1033('0x28')][_0x5c17b1['id']],_0x5c17b1);}}}return _0x277e6d['vtigerAccounts'];};};Realtime[_0x1033('0x47')][_0x1033('0x55')]=function(){var _0x3509a7=this;return function(_0x2f9f78){if(_0x2f9f78){freeIsNotKey(_0x2f9f78,_0x3509a7[_0x1033('0x29')],'id');for(var _0x282722=0x0,_0x1874f7={},_0x7f37b5={};_0x282722<_0x2f9f78['length'];_0x282722+=0x1){_0x1874f7=_0x2f9f78[_0x282722];if(_['isUndefined'](_0x3509a7['servicenowAccounts'][_0x1874f7['id']])){_0x3509a7[_0x1033('0x29')][_0x1874f7['id']]=new ServicenowAccount(_0x1874f7);}else{_0x3509a7['mergeFromDatabase'](_0x3509a7['servicenowAccounts'][_0x1874f7['id']],_0x1874f7);}}}return _0x3509a7['servicenowAccounts'];};};Realtime[_0x1033('0x47')][_0x1033('0x56')]=function(){var _0x53aac3=this;return function(_0x45ab69){if(_0x45ab69){freeIsNotKey(_0x45ab69,_0x53aac3[_0x1033('0x2a')],'id');for(var _0x1c1f03=0x0,_0x4221e3={},_0x347efa={};_0x1c1f03<_0x45ab69[_0x1033('0x49')];_0x1c1f03+=0x1){_0x4221e3=_0x45ab69[_0x1c1f03];if(_[_0x1033('0x4d')](_0x53aac3[_0x1033('0x2a')][_0x4221e3['id']])){_0x53aac3[_0x1033('0x2a')][_0x4221e3['id']]=new Dynamics365Account(_0x4221e3);}else{_0x53aac3[_0x1033('0x46')](_0x53aac3[_0x1033('0x2a')][_0x4221e3['id']],_0x4221e3);}}}return _0x53aac3[_0x1033('0x2a')];};};Realtime[_0x1033('0x47')][_0x1033('0x57')]=function(){var _0x40dde2=this;return function(_0x452c7f){if(_0x452c7f){freeIsNotKey(_0x452c7f,_0x40dde2[_0x1033('0x58')],'id');for(var _0x4db4ae=0x0,_0x4be05c={},_0x5d3e3d={};_0x4db4ae<_0x452c7f[_0x1033('0x49')];_0x4db4ae+=0x1){_0x4be05c=_0x452c7f[_0x4db4ae];if(_['isUndefined'](_0x40dde2['freshsalesAccounts'][_0x4be05c['id']])){_0x40dde2[_0x1033('0x58')][_0x4be05c['id']]=new FreshsalesAccount(_0x4be05c);}else{_0x40dde2[_0x1033('0x46')](_0x40dde2['freshsalesAccounts'][_0x4be05c['id']],_0x4be05c);}}}return _0x40dde2[_0x1033('0x58')];};};Realtime[_0x1033('0x47')][_0x1033('0x59')]=function(){var _0x35eb26=this;return function(_0x9810a7){for(var _0x2700a9=0x0;_0x2700a9<_0x9810a7[_0x1033('0x49')];_0x2700a9+=0x1){_['merge'](_0x35eb26[_0x1033('0x19')][_0x9810a7[_0x2700a9][_0x1033('0x30')]],_0x9810a7[_0x2700a9]);}return _0x35eb26['voiceQueues'];};};Realtime['prototype'][_0x1033('0x5a')]=function(){var _0xce80ad=this;return function(_0xa0ed09){clearVoiceQueues(_0xce80ad[_0x1033('0x19')]);if(_0xa0ed09){_0xa0ed09=_[_0x1033('0x5b')](_0xa0ed09,'uniqueid');for(var _0x2ef708 in _0xa0ed09){if(_0xa0ed09[_0x1033('0x2d')](_0x2ef708)){var _0x5eb5a2={};for(var _0x363534=0x0;_0x363534<_0xa0ed09[_0x2ef708][_0x1033('0x49')];_0x363534+=0x1){var _0x5be768=_0xa0ed09[_0x2ef708][_0x363534][_0x1033('0x5c')];if(_0xce80ad[_0x1033('0x19')][_0x5be768]){if(_0xa0ed09[_0x2ef708][_0x363534][_0x1033('0x5d')]){_0xce80ad[_0x1033('0x19')][_0x5be768]['unmanaged']+=0x1;}if(_0xa0ed09[_0x2ef708][_0x363534][_0x1033('0x5e')]){_0xce80ad[_0x1033('0x19')][_0x5be768][_0x1033('0x3a')]+=0x1;}_0xce80ad[_0x1033('0x19')][_0x5be768][_0x1033('0x34')]+=moment(_0xa0ed09[_0x2ef708][_0x363534][_0x1033('0x5f')])[_0x1033('0x60')](moment(_0xa0ed09[_0x2ef708][_0x363534]['queuecallerjoinAt']),_0x1033('0x61'))||0x0;if(_0x363534===_0xa0ed09[_0x2ef708][_0x1033('0x49')]-0x1){_0xce80ad['voiceQueues'][_0x5be768][_0x1033('0x35')]+=moment(_0xa0ed09[_0x2ef708][_0x363534]['queuecallercompleteAt']||_0xa0ed09[_0x2ef708][_0x363534]['queuecallerabandonAt']||_0xa0ed09[_0x2ef708][_0x363534][_0x1033('0x62')])['diff'](moment(_0xa0ed09[_0x2ef708][_0x363534][_0x1033('0x63')]),_0x1033('0x61'))||0x0;_0xce80ad['voiceQueues'][_0x5be768]['total']+=0x1;if(_0xa0ed09[_0x2ef708][_0x363534][_0x1033('0x64')]){_0xce80ad['voiceQueues'][_0x5be768][_0x1033('0x33')]+=0x1;_0xce80ad[_0x1033('0x19')][_0x5be768][_0x1033('0x65')]+=moment(_0xa0ed09[_0x2ef708][_0x363534]['queuecallercompleteAt'])[_0x1033('0x60')](moment(_0xa0ed09[_0x2ef708][_0x363534][_0x1033('0x5f')]),_0x1033('0x61'))||0x0;}}else{_0xce80ad[_0x1033('0x19')][_0x5be768][_0x1033('0x35')]+=_0xce80ad[_0x1033('0x19')][_0x5be768][_0x1033('0x34')]||0x0;}}}}}}return _0xce80ad[_0x1033('0x19')];};};Realtime[_0x1033('0x47')][_0x1033('0x66')]=function(){var _0x96f222=this;return function(_0x423e98){clearVoiceCallReports(_0x96f222[_0x1033('0x1c')]);if(_0x423e98){for(var _0x5bca3f=0x0;_0x5bca3f<_0x423e98[_0x1033('0x49')];_0x5bca3f+=0x1){_0x96f222[_0x1033('0x1c')][_0x1033('0x67')]+=0x1;_0x96f222[_0x1033('0x1c')][_0x1033('0x35')]+=_0x423e98[_0x5bca3f]['duration'];if(_0x423e98[_0x5bca3f][_0x1033('0x68')]===_0x1033('0x69')){_0x96f222[_0x1033('0x1c')][_0x1033('0x33')]+=0x1;_0x96f222[_0x1033('0x1c')][_0x1033('0x34')]+=_0x423e98[_0x5bca3f][_0x1033('0x6a')]-_0x423e98[_0x5bca3f][_0x1033('0x6b')]||0x0;_0x96f222['outbound'][_0x1033('0x65')]+=_0x423e98[_0x5bca3f][_0x1033('0x6b')];}}}return _0x96f222[_0x1033('0x1c')];};};Realtime[_0x1033('0x47')][_0x1033('0x6c')]=function(){var _0x5ed420=this;return function(_0x36f906){if(_0x36f906){freeIsNotKey(_0x36f906,_0x5ed420[_0x1033('0x1b')],_0x1033('0x30'));for(var _0x53dc4c=0x0,_0x586df1={};_0x53dc4c<_0x36f906[_0x1033('0x49')];_0x53dc4c+=0x1){_0x586df1=_0x36f906[_0x53dc4c];if(_['isUndefined'](_0x5ed420[_0x1033('0x1b')][_0x586df1[_0x1033('0x30')]])){_0x5ed420['campaigns'][_0x586df1['name']]=new Campaign(_0x586df1);}else{_0x5ed420[_0x1033('0x46')](_0x5ed420[_0x1033('0x1b')][_0x586df1[_0x1033('0x30')]],_0x586df1);_0x5ed420[_0x1033('0x1b')][_0x586df1[_0x1033('0x30')]][_0x1033('0x6d')]=_0x586df1[_0x1033('0x6e')]?_0x586df1['SquareProject']['name']:undefined;}}}return _0x5ed420[_0x1033('0x1b')];};};Realtime[_0x1033('0x47')][_0x1033('0x6f')]=function(){var _0x24bb61=this;return function(_0x1d063a){if(_0x1d063a){freeIsNotKey(_0x1d063a,_0x24bb61[_0x1033('0x1d')],'id');for(var _0x11d3d2=0x0,_0xbe977a={};_0x11d3d2<_0x1d063a[_0x1033('0x49')];_0x11d3d2+=0x1){_0xbe977a=_0x1d063a[_0x11d3d2];if(_[_0x1033('0x4d')](_0x24bb61[_0x1033('0x1d')][_0xbe977a['id']])){_0x24bb61[_0x1033('0x1d')][_0xbe977a['id']]=new VoiceExtension(_0xbe977a);}else{_0x24bb61[_0x1033('0x46')](_0x24bb61[_0x1033('0x1d')][_0xbe977a['id']],_0xbe977a);}}}return _0x24bb61[_0x1033('0x1d')];};};Realtime[_0x1033('0x47')][_0x1033('0x70')]=function(){var _0x3f4a52=this;return function(_0x174daf){clearCampaigns(_0x3f4a52[_0x1033('0x1b')]);for(var _0x1a0d86=0x0;_0x1a0d86<_0x174daf[_0x1033('0x49')];_0x1a0d86+=0x1){_['merge'](_0x3f4a52[_0x1033('0x1b')][_0x174daf[_0x1a0d86][_0x1033('0x30')]],_0x174daf[_0x1a0d86]);}return _0x3f4a52['campaigns'];};};Realtime['prototype'][_0x1033('0x71')]=function(){var _0x99e083=this;return function(_0x51c1e3){if(_0x51c1e3){freeIsNotKey(_0x51c1e3,_0x99e083[_0x1033('0x2b')],'id');for(var _0x139ee5=0x0,_0x255ea6={},_0x56440a={};_0x139ee5<_0x51c1e3[_0x1033('0x49')];_0x139ee5+=0x1){_0x255ea6=_0x51c1e3[_0x139ee5];if(_['isUndefined'](_0x99e083[_0x1033('0x2b')][_0x255ea6['id']])){_0x99e083[_0x1033('0x2b')][_0x255ea6['id']]=new FaxAccount(_0x255ea6);}else{_0x99e083['mergeFromDatabase'](_0x99e083['faxAccounts'][_0x255ea6['id']],_0x255ea6);}}}return _0x99e083[_0x1033('0x2b')];};};module[_0x1033('0x72')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 1ffbc24..6f2ddd6 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 _0x17eb=['calleridnum','outbound','internal','destination','type','queue','lastdata','context','from-voip-provider','callerid','calleridpreview','originatecalleridnum','destinationchannel','disposition','ANSWERED','\x22%s\x22\x20<%s>','transfers','linkedid','uniqueid','UserId','membername','monitor','monitors','monitorFilename','createdAt','xcally-motion-preview','calleridname','connectedlinename','exten','xcally-motion-dialer','forEach','Local','substring','indexOf','phone','lastIndexOf','exports','moment','util','../../../config/environment','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/voiceQueueReport','../rpc/voiceRecording','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','telephones','prototype','sync','xdr','disabled','bind','voiceCallReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','find','agents','accountcode','name','isNil','interface','connectedlinenum','assigned','lastAssignedTo','format','SIP/%s','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','voiceQueueReport','create','match','getAgentByInternal','length','getCallType','channel'];(function(_0x19f72f,_0x4688f8){var _0x112e5c=function(_0x3eed6e){while(--_0x3eed6e){_0x19f72f['push'](_0x19f72f['shift']());}};_0x112e5c(++_0x4688f8);}(_0x17eb,0x12d));var _0xb17e=function(_0x2e9a8f,_0x37c8b2){_0x2e9a8f=_0x2e9a8f-0x0;var _0x4ba021=_0x17eb[_0x2e9a8f];return _0x4ba021;};'use strict';var _=require('lodash');var moment=require(_0xb17e('0x0'));var util=require(_0xb17e('0x1'));var config=require(_0xb17e('0x2'));var ami=require('../ami');var RpcVoiceAgentReport=require(_0xb17e('0x3'));var RpcVoiceCallReport=require(_0xb17e('0x4'));var RpcVoiceDialReport=require(_0xb17e('0x5'));var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require(_0xb17e('0x6'));var RpcVoiceRecording=require(_0xb17e('0x7'));var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require(_0xb17e('0x8'));var VoiceAgentReport=require(_0xb17e('0x9'));var VoiceDialReport=require(_0xb17e('0xa'));var UserReport=require(_0xb17e('0xb'));function Report(_0x35ff94){this[_0xb17e('0xc')]=_0x35ff94;this['agents']=_0x35ff94['agents'];this[_0xb17e('0xd')]=_0x35ff94[_0xb17e('0xd')];}Report[_0xb17e('0xe')][_0xb17e('0xf')]=function(_0x345773){var _0x3b8426=new VoiceQueueReport(this['realtime']);var _0x294d90=new VoiceAgentReport(this['realtime']);var _0x2920af=new VoiceDialReport(this[_0xb17e('0xc')]);var _0x7c1499=new VoiceCallReport(this[_0xb17e('0xc')]);var _0xe13c6f=new UserReport(this[_0xb17e('0xc')]);if(config[_0xb17e('0x10')]&&config[_0xb17e('0x10')][_0xb17e('0x11')]){ami['on']('custom:voiceQueueReport',this['voiceQueueReport'][_0xb17e('0x12')](this));ami['on']('custom:voiceCallReport',this[_0xb17e('0x13')][_0xb17e('0x12')](this));ami['on']('custom:voiceAgentReport',this[_0xb17e('0x14')]['bind'](this));ami['on'](_0xb17e('0x15'),this[_0xb17e('0x16')][_0xb17e('0x12')](this));ami['on'](_0xb17e('0x17'),this[_0xb17e('0x18')][_0xb17e('0x12')](this));ami['on'](_0xb17e('0x19'),this[_0xb17e('0x1a')][_0xb17e('0x12')](this));}};Report[_0xb17e('0xe')][_0xb17e('0x1b')]=function(_0x3c9491){var _0x527558;_0x527558=_[_0xb17e('0x1c')](this[_0xb17e('0x1d')],function(_0x230116){return _0x230116[_0xb17e('0x1e')]==_0x3c9491||_0x230116[_0xb17e('0x1f')]==_0x3c9491;});if(_[_0xb17e('0x20')](_0x527558)){var _0x5ae16d=_[_0xb17e('0x1c')](this[_0xb17e('0xd')],function(_0x357d4b){return _0x357d4b[_0xb17e('0x1e')]==_0x3c9491||_0x357d4b['name']==_0x3c9491;});if(_0x5ae16d){_0x527558=_['find'](this[_0xb17e('0x1d')],function(_0x2a3391){return _0x2a3391[_0xb17e('0x21')]==util['format']('SIP/%s',_0x5ae16d[_0xb17e('0x1f')]);});}}return _0x527558;};Report[_0xb17e('0xe')]['voiceQueueReport']=function(_0x4e278d){for(var _0x4d9754=0x0;_0x4d9754<_0x4e278d['length'];_0x4d9754+=0x1){var _0x1fbd92=this[_0xb17e('0x1b')](_0x4e278d[_0x4d9754][_0xb17e('0x22')]);if(_0x1fbd92){_0x4e278d[_0x4d9754]['accountcode']=_0x1fbd92[_0xb17e('0x1e')];_0x4e278d[_0x4d9754][_0xb17e('0x23')]=!![];_0x4e278d[_0x4d9754][_0xb17e('0x24')]=_0x1fbd92[_0xb17e('0x1f')];_0x4e278d[_0x4d9754][_0xb17e('0x21')]=_[_0xb17e('0x20')](_0x1fbd92['interface'])?util[_0xb17e('0x25')](_0xb17e('0x26'),_0x1fbd92[_0xb17e('0x1f')]):_0x1fbd92[_0xb17e('0x21')];if(_0x4e278d[_0x4d9754][_0xb17e('0x27')]){_0x4e278d[_0x4d9754][_0xb17e('0x28')]=moment()[_0xb17e('0x25')](_0xb17e('0x29'));}if(_0x4e278d[_0x4d9754][_0xb17e('0x2a')]){_0x4e278d[_0x4d9754][_0xb17e('0x2b')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport[_0xb17e('0x2c')](_0x4e278d[_0x4d9754]);}RpcVoiceQueueReport[_0xb17e('0x2d')](_0x4e278d[_0x4d9754]);}};function extractCalleridNumber(_0x39441c){var _0x3c61f9=_0x39441c[_0xb17e('0x2e')](/<(.*?)>/);return _0x3c61f9?_0x3c61f9[0x1]:_0x39441c;}Report[_0xb17e('0xe')][_0xb17e('0x2f')]=function(_0x4b2284){for(var _0x557288=0x0;_0x557288','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','membername','create','monitor','monitorFilename','monitors','filename','createdAt'];(function(_0x26660c,_0xa474ef){var _0x21fb98=function(_0xcedc16){while(--_0xcedc16){_0x26660c['push'](_0x26660c['shift']());}};_0x21fb98(++_0xa474ef);}(_0x6228,0x175));var _0x8622=function(_0x3c165d,_0xcbcca0){_0x3c165d=_0x3c165d-0x0;var _0x2ed713=_0x6228[_0x3c165d];return _0x2ed713;};'use strict';var _=require(_0x8622('0x0'));var moment=require(_0x8622('0x1'));var util=require('util');var config=require(_0x8622('0x2'));var ami=require(_0x8622('0x3'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require(_0x8622('0x4'));var RpcVoiceDialReport=require(_0x8622('0x5'));var RpcMemberReport=require(_0x8622('0x6'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0x8622('0x7'));var RpcVoiceTransferReport=require(_0x8622('0x8'));var VoiceQueueReport=require(_0x8622('0x9'));var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0x8622('0xa'));var VoiceDialReport=require(_0x8622('0xb'));var UserReport=require(_0x8622('0xc'));function Report(_0x13f1a7){this[_0x8622('0xd')]=_0x13f1a7;this[_0x8622('0xe')]=_0x13f1a7[_0x8622('0xe')];this[_0x8622('0xf')]=_0x13f1a7[_0x8622('0xf')];}Report[_0x8622('0x10')]['sync']=function(_0x45a440){var _0x30c0a6=new VoiceQueueReport(this[_0x8622('0xd')]);var _0x4cfd54=new VoiceAgentReport(this['realtime']);var _0x27ac52=new VoiceDialReport(this[_0x8622('0xd')]);var _0x153056=new VoiceCallReport(this[_0x8622('0xd')]);var _0x118b4=new UserReport(this[_0x8622('0xd')]);if(config[_0x8622('0x11')]&&config[_0x8622('0x11')][_0x8622('0x12')]){ami['on'](_0x8622('0x13'),this[_0x8622('0x14')]['bind'](this));ami['on'](_0x8622('0x15'),this[_0x8622('0x16')][_0x8622('0x17')](this));ami['on'](_0x8622('0x18'),this[_0x8622('0x19')]['bind'](this));ami['on'](_0x8622('0x1a'),this[_0x8622('0x1b')][_0x8622('0x17')](this));ami['on']('blindtransfer',this[_0x8622('0x1c')][_0x8622('0x17')](this));ami['on'](_0x8622('0x1d'),this[_0x8622('0x1e')]['bind'](this));}};Report[_0x8622('0x10')][_0x8622('0x1f')]=function(_0x2f8f99){var _0x9c79b;_0x9c79b=_[_0x8622('0x20')](this[_0x8622('0xe')],function(_0x4da361){return _0x4da361[_0x8622('0x21')]==_0x2f8f99||_0x4da361[_0x8622('0x22')]==_0x2f8f99;});if(_[_0x8622('0x23')](_0x9c79b)){var _0x1d290a=_['find'](this[_0x8622('0xf')],function(_0x25fff1){return _0x25fff1['accountcode']==_0x2f8f99||_0x25fff1['name']==_0x2f8f99;});if(_0x1d290a){_0x9c79b=_[_0x8622('0x20')](this['agents'],function(_0x3d617a){return _0x3d617a[_0x8622('0x24')]==util[_0x8622('0x25')](_0x8622('0x26'),_0x1d290a[_0x8622('0x22')]);});}}return _0x9c79b;};Report[_0x8622('0x10')][_0x8622('0x14')]=function(_0x490196){for(var _0x131ec7=0x0;_0x131ec7<_0x490196[_0x8622('0x27')];_0x131ec7+=0x1){var _0x5834b5=this[_0x8622('0x1f')](_0x490196[_0x131ec7][_0x8622('0x28')]);if(_0x5834b5){_0x490196[_0x131ec7][_0x8622('0x21')]=_0x5834b5[_0x8622('0x21')];_0x490196[_0x131ec7][_0x8622('0x29')]=!![];_0x490196[_0x131ec7][_0x8622('0x2a')]=_0x5834b5['name'];_0x490196[_0x131ec7]['interface']=_[_0x8622('0x23')](_0x5834b5[_0x8622('0x24')])?util[_0x8622('0x25')](_0x8622('0x26'),_0x5834b5[_0x8622('0x22')]):_0x5834b5[_0x8622('0x24')];if(_0x490196[_0x131ec7][_0x8622('0x2b')]){_0x490196[_0x131ec7][_0x8622('0x2c')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}if(_0x490196[_0x131ec7][_0x8622('0x2d')]){_0x490196[_0x131ec7][_0x8622('0x2e')]=moment()['format'](_0x8622('0x2f'));}RpcMemberReport[_0x8622('0x14')](_0x490196[_0x131ec7]);}RpcVoiceQueueReport['create'](_0x490196[_0x131ec7]);}};function extractCalleridNumber(_0x18629d){var _0x39940c=_0x18629d['match'](/<(.*?)>/);return _0x39940c?_0x39940c[0x1]:_0x18629d;}Report['prototype'][_0x8622('0x30')]=function(_0x3833d7){for(var _0x50ae81=0x0;_0x50ae810x0?_0x17febe:0x0;this['voiceQueues'][_0x642347[_0xc4ab('0x63')]][_0xc4ab('0x2e')]=this[_0xc4ab('0x13')][_0x642347[_0xc4ab('0x63')]]['talking']>_[_0xc4ab('0x6a')](_0x642347[_0xc4ab('0x69')])?_[_0xc4ab('0x6a')](_0x642347['loggedin']):this[_0xc4ab('0x13')][_0x642347[_0xc4ab('0x63')]][_0xc4ab('0x2e')];this[_0xc4ab('0x4b')](this['voiceQueues'][_0x642347[_0xc4ab('0x63')]],'queuesummary');}logger[_0xc4ab('0x43')](_0xc4ab('0x6b'),util['inspect'](this['voiceQueues'][_0x642347['queue']],{'showHidden':![],'depth':null}));ami[_0xc4ab('0x41')](_0xc4ab('0x6c'),this['voiceQueues'][_0x642347[_0xc4ab('0x63')]]);}}}catch(_0x2c4379){logger[_0xc4ab('0x39')](_0xc4ab('0x61'),util[_0xc4ab('0x3a')](_0x2c4379,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xc4ab('0xb')][_0xc4ab('0x16')]=function(_0x314dab){logger[_0xc4ab('0x43')](_0xc4ab('0x6d'),util[_0xc4ab('0x3a')](_0x314dab,{'showHidden':![],'depth':null}));this[_0xc4ab('0x5f')]=!![];};VoiceQueueReport['prototype'][_0xc4ab('0x19')]=function(_0x2f205c){try{if(this[_0xc4ab('0x5b')](_0x2f205c)){logger['debug'](_0xc4ab('0x6e'),_0x2f205c[_0xc4ab('0x46')],util[_0xc4ab('0x3a')](_0x2f205c,{'showHidden':![],'depth':null}));if(_[_0xc4ab('0x5c')](this[_0xc4ab('0x3b')][_0x2f205c[_0xc4ab('0x46')]]))this[_0xc4ab('0x3b')][_0x2f205c['uniqueid']]=[];if(_[_0xc4ab('0x5c')](this[_0xc4ab('0x11')][_0x2f205c['uniqueid']]))this[_0xc4ab('0x11')][_0x2f205c['uniqueid']]={};var _0x16a97e=new QueueReport();_0x16a97e[_0xc4ab('0x48')]=_0x2f205c[_0xc4ab('0x63')];_0x16a97e[_0xc4ab('0x4c')]=this[_0xc4ab('0x13')][_0x16a97e['name']]&&this[_0xc4ab('0x13')][_0x16a97e[_0xc4ab('0x48')]][_0xc4ab('0x4c')]?this[_0xc4ab('0x13')][_0x16a97e[_0xc4ab('0x48')]][_0xc4ab('0x4c')]||'inbound':_0xc4ab('0x4d');_0x16a97e[_0xc4ab('0x63')]=_0x2f205c[_0xc4ab('0x63')];_0x16a97e[_0xc4ab('0x6f')]=moment()[_0xc4ab('0x47')]('YYYY-MM-DD\x20HH:mm:ss');_0x16a97e[_0xc4ab('0x70')]=_0x2f205c[_0xc4ab('0x70')];_0x16a97e[_0xc4ab('0x71')]=_0x2f205c[_0xc4ab('0x71')];_0x16a97e['uniqueid']=_0x2f205c[_0xc4ab('0x46')];_0x16a97e['routealias']=this[_0xc4ab('0x11')][_0x2f205c['uniqueid']][_0xc4ab('0x72')];logger[_0xc4ab('0x65')]('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x16a97e[_0xc4ab('0x48')],_0x16a97e['type']);_[_0xc4ab('0x73')](_0x16a97e,_[_0xc4ab('0x74')](_0x2f205c,_[_0xc4ab('0x75')](_0x16a97e)));this['queueReports'][_0x2f205c['uniqueid']][_0xc4ab('0x76')](_0x16a97e);this[_0xc4ab('0x11')][_0x2f205c['uniqueid']]=_0x16a97e;this[_0xc4ab('0x42')](_0x16a97e,_0xc4ab('0x18'));}}catch(_0x2290c5){logger[_0xc4ab('0x39')]('[%s][voiceQueueReport][queuecallerjoin]',_0x2f205c['uniqueid'],util[_0xc4ab('0x3a')](_0x2290c5,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xc4ab('0xb')][_0xc4ab('0x1b')]=function(_0x391b5d){try{if(this[_0xc4ab('0x5b')](_0x391b5d)){logger[_0xc4ab('0x43')]('[%s][voiceQueueReport][queuecallerabandon]',_0x391b5d[_0xc4ab('0x46')],util[_0xc4ab('0x3a')](_0x391b5d,{'showHidden':![],'depth':null}));if(this[_0xc4ab('0x3b')][_0x391b5d[_0xc4ab('0x46')]]){var _0xf93220=_[_0xc4ab('0x77')](this[_0xc4ab('0x3b')][_0x391b5d['uniqueid']]);_0xf93220[_0xc4ab('0x78')]=![];_0xf93220[_0xc4ab('0x79')]=null;_0xf93220[_0xc4ab('0x7a')]=_0x391b5d['holdtime'];_0xf93220[_0xc4ab('0x7b')]=_0x391b5d[_0xc4ab('0x7b')];_0xf93220[_0xc4ab('0x1a')]=!![];_0xf93220[_0xc4ab('0x7c')]=moment()[_0xc4ab('0x47')]('YYYY-MM-DD\x20HH:mm:ss');_0xf93220[_0xc4ab('0x7d')]='ABANDONED';_0xf93220[_0xc4ab('0x7e')]=null;logger['info'](_0xc4ab('0x7f'),_0xf93220[_0xc4ab('0x48')],_0xf93220[_0xc4ab('0x4c')]);this[_0xc4ab('0x11')][_0x391b5d[_0xc4ab('0x46')]]=_0xf93220;this[_0xc4ab('0x3f')](_0xf93220,_0xc4ab('0x1a'));}}}catch(_0x594397){logger[_0xc4ab('0x39')]('[%s][voiceQueueReport][queuecallerabandon]',_0x391b5d['uniqueid'],util[_0xc4ab('0x3a')](_0x594397,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xc4ab('0x1d')]=function(_0x5fac1c){try{if(this[_0xc4ab('0x5b')](_0x5fac1c)){logger[_0xc4ab('0x43')](_0xc4ab('0x80'),_0x5fac1c[_0xc4ab('0x46')],util[_0xc4ab('0x3a')](_0x5fac1c,{'showHidden':![],'depth':null}));if(this[_0xc4ab('0x3b')][_0x5fac1c[_0xc4ab('0x46')]]){var _0x4aa6d9=_[_0xc4ab('0x77')](this[_0xc4ab('0x3b')][_0x5fac1c[_0xc4ab('0x46')]]);_0x4aa6d9[_0xc4ab('0x81')]=moment()['format'](_0xc4ab('0x82'));_0x4aa6d9['connectedlinenum']=_0x5fac1c[_0xc4ab('0x83')];_0x4aa6d9[_0xc4ab('0x84')]=_0x5fac1c[_0xc4ab('0x84')];logger[_0xc4ab('0x65')](_0xc4ab('0x85'),_0x4aa6d9[_0xc4ab('0x48')],_0x4aa6d9[_0xc4ab('0x4c')],_0x5fac1c[_0xc4ab('0x83')],_0x5fac1c[_0xc4ab('0x84')]);this[_0xc4ab('0x11')][_0x5fac1c[_0xc4ab('0x46')]]=_0x4aa6d9;this[_0xc4ab('0x42')](_0x4aa6d9,'queuecallerleave');}}}catch(_0x416f2d){logger[_0xc4ab('0x39')]('[%s][voiceQueueReport][queuecallerleave]',_0x5fac1c['uniqueid'],util['inspect'](_0x416f2d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xc4ab('0xb')]['syncAgentConnect']=function(_0x5a619d){try{if(this[_0xc4ab('0x5b')](_0x5a619d)){logger[_0xc4ab('0x43')](_0xc4ab('0x86'),_0x5a619d[_0xc4ab('0x46')],util[_0xc4ab('0x3a')](_0x5a619d,{'showHidden':![],'depth':null}));if(this[_0xc4ab('0x3b')][_0x5a619d[_0xc4ab('0x46')]]){var _0x5232a8=_[_0xc4ab('0x77')](this['queueReports'][_0x5a619d[_0xc4ab('0x46')]]);_0x5232a8['queuecallercomplete']=!![];_0x5232a8[_0xc4ab('0x7d')]=_0xc4ab('0x87');logger[_0xc4ab('0x65')](_0xc4ab('0x88'),_0x5232a8[_0xc4ab('0x48')],_0x5232a8[_0xc4ab('0x4c')]);}}}catch(_0x1b537d){logger[_0xc4ab('0x39')](_0xc4ab('0x86'),_0x5a619d[_0xc4ab('0x46')],util[_0xc4ab('0x3a')](_0x1b537d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xc4ab('0xb')]['syncAgentComplete']=function(_0x2bf3c9){try{if(this['isNotNull'](_0x2bf3c9)){logger[_0xc4ab('0x43')](_0xc4ab('0x89'),_0x2bf3c9[_0xc4ab('0x46')],util['inspect'](_0x2bf3c9,{'showHidden':![],'depth':null}));if(this[_0xc4ab('0x3b')][_0x2bf3c9[_0xc4ab('0x46')]]){var _0x364e70=_['last'](this[_0xc4ab('0x3b')][_0x2bf3c9[_0xc4ab('0x46')]]);_0x364e70[_0xc4ab('0x1a')]=![];_0x364e70['queuecallerabandonAt']=null;_0x364e70[_0xc4ab('0x8a')]=!![];_0x364e70['lastAssignedTo']=_0x2bf3c9[_0xc4ab('0x8b')];_0x364e70['holdtime']=_0x2bf3c9['holdtime'];_0x364e70[_0xc4ab('0x78')]=!![];_0x364e70[_0xc4ab('0x8c')]=![];_0x364e70[_0xc4ab('0x8d')]=null;if(!_0x364e70[_0xc4ab('0x8e')]){if(_0x2bf3c9[_0xc4ab('0x8f')]==_0xc4ab('0x8e')){_0x364e70['queuecallerexitreason']=_0xc4ab('0x90');logger['info']('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x364e70['name'],_0x364e70[_0xc4ab('0x4c')]);}else{if(_['startsWith'](_0x2bf3c9[_0xc4ab('0x37')][_0xc4ab('0x91')](),'local/')){if(this[_0xc4ab('0x3b')][_0x2bf3c9['linkedid']]){var _0x286df3=_['last'](this[_0xc4ab('0x3b')][_0x2bf3c9[_0xc4ab('0x92')]]);_0x286df3[_0xc4ab('0x78')]=![];_0x286df3['queuecallerexit']=!![];_0x286df3[_0xc4ab('0x8d')]=moment(_0x364e70[_0xc4ab('0x6f')])[_0xc4ab('0x93')](_0x2bf3c9[_0xc4ab('0x7a')],_0xc4ab('0x94'))[_0xc4ab('0x47')](_0xc4ab('0x82'));_0x286df3[_0xc4ab('0x7d')]=_0xc4ab('0x95');_0x286df3[_0xc4ab('0x8e')]=!![];_0x286df3[_0xc4ab('0x96')]='FORWARD';_0x286df3[_0xc4ab('0x97')]=_0x2bf3c9['destexten'];_0x286df3['transferuniqueid']=_0x2bf3c9['uniqueid'];logger[_0xc4ab('0x65')](_0xc4ab('0x98'),_0x286df3[_0xc4ab('0x48')],_0x286df3[_0xc4ab('0x4c')]);var _0x34b76a=this[_0xc4ab('0x3b')][_0x2bf3c9[_0xc4ab('0x92')]];this[_0xc4ab('0x3b')][_0x2bf3c9[_0xc4ab('0x92')]]=this[_0xc4ab('0x3b')][_0x2bf3c9[_0xc4ab('0x46')]];this[_0xc4ab('0x3b')][_0x2bf3c9[_0xc4ab('0x46')]]=_0x34b76a;}}else{_0x364e70[_0xc4ab('0x7d')]=_0xc4ab('0x99')+_0x2bf3c9['reason'][_0xc4ab('0x9a')]();logger[_0xc4ab('0x65')](_0xc4ab('0x9b'),_0x364e70[_0xc4ab('0x48')],_0x364e70[_0xc4ab('0x4c')],_0x364e70[_0xc4ab('0x7d')]);}}}this[_0xc4ab('0x11')][_0x2bf3c9[_0xc4ab('0x46')]]=_0x364e70;this[_0xc4ab('0x3f')](_0x364e70,_0xc4ab('0x1e'));}}}catch(_0xf7c116){logger[_0xc4ab('0x39')](_0xc4ab('0x89'),_0x2bf3c9[_0xc4ab('0x46')],util[_0xc4ab('0x3a')](_0xf7c116,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xc4ab('0xb')][_0xc4ab('0x9c')]=function(_0x547484){try{if(this[_0xc4ab('0x5b')](_0x547484)){logger['debug'](_0xc4ab('0x9d'),_0x547484[_0xc4ab('0x46')],util[_0xc4ab('0x3a')](_0x547484,{'showHidden':![],'depth':null}));this[_0xc4ab('0x9e')](_0x547484[_0xc4ab('0x46')],_['keys'](_0x547484[_0xc4ab('0x9f')])[0x0],_0x547484['value']);if(this[_0xc4ab('0x3b')][_0x547484[_0xc4ab('0x46')]]){var _0xb546c6=_[_0xc4ab('0x77')](this[_0xc4ab('0x3b')][_0x547484[_0xc4ab('0x46')]]);if(_0xb546c6){if(this[_0xc4ab('0x5b')](_0x547484[_0xc4ab('0x9f')])&&this['isNotNull'](_0x547484[_0xc4ab('0x9f')][_0xc4ab('0xa0')])){switch(_0x547484[_0xc4ab('0xa1')]){case _0xc4ab('0xa2'):_0xb546c6['queuecallerexit']=![];_0xb546c6[_0xc4ab('0x8d')]=null;break;case _0xc4ab('0xa3'):_0xb546c6[_0xc4ab('0xa4')]=_0xc4ab('0xa5');_0xb546c6[_0xc4ab('0x8c')]=!![];_0xb546c6[_0xc4ab('0x8d')]=moment()[_0xc4ab('0x47')](_0xc4ab('0x82'));_0xb546c6['queuecallerleaveAt']=moment()[_0xc4ab('0x47')](_0xc4ab('0x82'));logger[_0xc4ab('0x43')](_0xc4ab('0xa6'),_0x547484[_0xc4ab('0x46')],util[_0xc4ab('0x3a')](_0xb546c6,{'showHidden':![],'depth':null}));ami[_0xc4ab('0x41')]('custom:timeout',_0xb546c6);break;default:_0xb546c6[_0xc4ab('0x8c')]=!![];_0xb546c6[_0xc4ab('0x8d')]=moment()[_0xc4ab('0x47')](_0xc4ab('0x82'));_0xb546c6['queuecallerleaveAt']=moment()['format'](_0xc4ab('0x82'));}_0xb546c6['queuecallerabandon']=![];_0xb546c6[_0xc4ab('0x7c')]=null;_0xb546c6[_0xc4ab('0x7d')]=_0x547484[_0xc4ab('0xa1')];this[_0xc4ab('0x11')][_0x547484[_0xc4ab('0x46')]]=_0xb546c6;this[_0xc4ab('0x3f')](_0xb546c6,_0xc4ab('0x21'));}else if(this[_0xc4ab('0x5b')](_0x547484[_0xc4ab('0x9f')])&&this[_0xc4ab('0x5b')](_0x547484[_0xc4ab('0x9f')][_0xc4ab('0xa7')])){if(!_0xb546c6[_0xc4ab('0x1a')]){_0xb546c6['queuecallerexit']=!![];_0xb546c6[_0xc4ab('0x8d')]=moment()[_0xc4ab('0x47')](_0xc4ab('0x82'));_0xb546c6[_0xc4ab('0x7d')]=_0xc4ab('0xa8');_0xb546c6[_0xc4ab('0x81')]=moment()[_0xc4ab('0x47')](_0xc4ab('0x82'));this[_0xc4ab('0x11')][_0x547484['uniqueid']]=_0xb546c6;}}logger['info']('[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s',_0x547484[_0xc4ab('0x46')],_0xb546c6[_0xc4ab('0x48')],_0xb546c6[_0xc4ab('0x4c')],_[_0xc4ab('0x75')](_0x547484['variable'])[0x0],_0x547484[_0xc4ab('0xa1')]);_0xb546c6['variables']=this[_0xc4ab('0x15')][_0x547484[_0xc4ab('0x46')]];}}}}catch(_0x33da4a){logger[_0xc4ab('0x39')](_0xc4ab('0x9d'),_0x547484[_0xc4ab('0x46')],util[_0xc4ab('0x3a')](_0x33da4a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xc4ab('0xb')][_0xc4ab('0x9e')]=function(_0x48d49d,_0x44a972,_0x51bb86){var _0x24e811=['rtpaudioqos',_0xc4ab('0xa9'),_0xc4ab('0xaa'),'rtpaudioqosjitterbridged','rtpaudioqosloss',_0xc4ab('0xab'),_0xc4ab('0xac'),_0xc4ab('0xad'),_0xc4ab('0xae'),_0xc4ab('0xaf'),'bridgepeer','bridgepvtcallid',_0xc4ab('0xb0'),_0xc4ab('0xb1'),_0xc4ab('0xb2'),_0xc4ab('0xb3'),'membername',_0xc4ab('0xb4'),_0xc4ab('0xb5')];if(!_[_0xc4ab('0x34')](_0x44a972)&&!_[_0xc4ab('0xb6')](_0x24e811,_0x44a972)){if(_[_0xc4ab('0x5c')](this[_0xc4ab('0x15')][_0x48d49d])){this[_0xc4ab('0x15')][_0x48d49d]={};}this[_0xc4ab('0x15')][_0x48d49d][_0x44a972]=_0x51bb86;}};VoiceQueueReport['prototype'][_0xc4ab('0xb7')]=function(_0x3f079a){try{if(this[_0xc4ab('0x5b')](_0x3f079a)){logger[_0xc4ab('0x43')](_0xc4ab('0xb8'),_0x3f079a['uniqueid'],util[_0xc4ab('0x3a')](_0x3f079a,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x3f079a[_0xc4ab('0x46')]]){for(var _0x2e8517=0x0,_0x1833aa={};_0x2e85170x0?_0x45fbf5:0x0;this[_0x92c0('0x12')][_0x3ac777[_0x92c0('0x6d')]][_0x92c0('0x30')]=this[_0x92c0('0x12')][_0x3ac777[_0x92c0('0x6d')]][_0x92c0('0x30')]>_[_0x92c0('0x70')](_0x3ac777[_0x92c0('0x71')])?_[_0x92c0('0x70')](_0x3ac777['loggedin']):this[_0x92c0('0x12')][_0x3ac777[_0x92c0('0x6d')]][_0x92c0('0x30')];this['emitVoiceQueueSummary'](this[_0x92c0('0x12')][_0x3ac777[_0x92c0('0x6d')]],_0x92c0('0x72'));}logger[_0x92c0('0x46')](_0x92c0('0x73'),util[_0x92c0('0x3d')](this[_0x92c0('0x12')][_0x3ac777[_0x92c0('0x6d')]],{'showHidden':![],'depth':null}));ami['emit'](_0x92c0('0x74'),this[_0x92c0('0x12')][_0x3ac777['queue']]);}}}catch(_0x108e60){logger['error'](_0x92c0('0x6b'),util['inspect'](_0x108e60,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x92c0('0xb')]['syncQueueSummaryComplete']=function(_0x15b076){logger[_0x92c0('0x46')](_0x92c0('0x75'),util['inspect'](_0x15b076,{'showHidden':![],'depth':null}));this[_0x92c0('0x13')]=!![];};VoiceQueueReport[_0x92c0('0xb')][_0x92c0('0x19')]=function(_0x202fe6){try{if(this[_0x92c0('0x6c')](_0x202fe6)){logger[_0x92c0('0x46')](_0x92c0('0x76'),_0x202fe6[_0x92c0('0x49')],util[_0x92c0('0x3d')](_0x202fe6,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0x92c0('0xe')][_0x202fe6[_0x92c0('0x49')]]))this[_0x92c0('0xe')][_0x202fe6[_0x92c0('0x49')]]=[];if(_[_0x92c0('0x66')](this['channels'][_0x202fe6[_0x92c0('0x49')]]))this['channels'][_0x202fe6[_0x92c0('0x49')]]={};var _0x1100ec=new QueueReport();_0x1100ec['name']=_0x202fe6[_0x92c0('0x6d')];_0x1100ec[_0x92c0('0x5b')]=this['voiceQueues'][_0x1100ec[_0x92c0('0x4c')]]&&this[_0x92c0('0x12')][_0x1100ec['name']][_0x92c0('0x5b')]?this[_0x92c0('0x12')][_0x1100ec[_0x92c0('0x4c')]][_0x92c0('0x5b')]||_0x92c0('0x51'):_0x92c0('0x51');_0x1100ec['queue']=_0x202fe6[_0x92c0('0x6d')];_0x1100ec[_0x92c0('0x77')]=moment()[_0x92c0('0x4a')](_0x92c0('0x78'));_0x1100ec[_0x92c0('0x79')]=_0x202fe6[_0x92c0('0x79')];_0x1100ec[_0x92c0('0x7a')]=_0x202fe6['count'];_0x1100ec[_0x92c0('0x49')]=_0x202fe6[_0x92c0('0x49')];_0x1100ec[_0x92c0('0x7b')]=this[_0x92c0('0x10')][_0x202fe6[_0x92c0('0x49')]][_0x92c0('0x7b')];logger[_0x92c0('0x7c')](_0x92c0('0x7d'),_0x1100ec['name'],_0x1100ec[_0x92c0('0x5b')]);_[_0x92c0('0x7e')](_0x1100ec,_[_0x92c0('0x7f')](_0x202fe6,_[_0x92c0('0x80')](_0x1100ec)));this['queueReports'][_0x202fe6[_0x92c0('0x49')]][_0x92c0('0x81')](_0x1100ec);this[_0x92c0('0x10')][_0x202fe6['uniqueid']]=_0x1100ec;this[_0x92c0('0x45')](_0x1100ec,_0x92c0('0x18'));}}catch(_0x3dc5fd){logger[_0x92c0('0x40')](_0x92c0('0x76'),_0x202fe6['uniqueid'],util['inspect'](_0x3dc5fd,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x92c0('0xb')][_0x92c0('0x82')]=function(_0x491196){try{if(this[_0x92c0('0x6c')](_0x491196)){logger[_0x92c0('0x46')](_0x92c0('0x83'),_0x491196[_0x92c0('0x49')],util['inspect'](_0x491196,{'showHidden':![],'depth':null}));if(this[_0x92c0('0xe')][_0x491196[_0x92c0('0x49')]]){var _0x91e9bf=_['last'](this[_0x92c0('0xe')][_0x491196[_0x92c0('0x49')]]);_0x91e9bf['queuecallercomplete']=![];_0x91e9bf[_0x92c0('0x84')]=null;_0x91e9bf[_0x92c0('0x85')]=_0x491196[_0x92c0('0x85')];_0x91e9bf[_0x92c0('0x86')]=_0x491196[_0x92c0('0x86')];_0x91e9bf[_0x92c0('0x87')]=!![];_0x91e9bf[_0x92c0('0x88')]=moment()[_0x92c0('0x4a')](_0x92c0('0x78'));_0x91e9bf[_0x92c0('0x89')]=_0x92c0('0x8a');_0x91e9bf[_0x92c0('0x8b')]=null;logger[_0x92c0('0x7c')](_0x92c0('0x8c'),_0x91e9bf[_0x92c0('0x4c')],_0x91e9bf[_0x92c0('0x5b')]);this[_0x92c0('0x10')][_0x491196['uniqueid']]=_0x91e9bf;this['emitVoiceQueueChannelRemove'](_0x91e9bf,_0x92c0('0x87'));}}}catch(_0x156307){logger[_0x92c0('0x40')](_0x92c0('0x83'),_0x491196[_0x92c0('0x49')],util[_0x92c0('0x3d')](_0x156307,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x92c0('0xb')]['syncQueueCallerLeave']=function(_0x476ad0){try{if(this[_0x92c0('0x6c')](_0x476ad0)){logger[_0x92c0('0x46')](_0x92c0('0x8d'),_0x476ad0[_0x92c0('0x49')],util['inspect'](_0x476ad0,{'showHidden':![],'depth':null}));if(this[_0x92c0('0xe')][_0x476ad0[_0x92c0('0x49')]]){var _0x26f8c2=_['last'](this[_0x92c0('0xe')][_0x476ad0[_0x92c0('0x49')]]);_0x26f8c2[_0x92c0('0x8e')]=moment()[_0x92c0('0x4a')](_0x92c0('0x78'));_0x26f8c2[_0x92c0('0x8f')]=_0x476ad0[_0x92c0('0x8f')];_0x26f8c2['connectedlinename']=_0x476ad0[_0x92c0('0x90')];logger[_0x92c0('0x7c')]('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x26f8c2[_0x92c0('0x4c')],_0x26f8c2['type'],_0x476ad0[_0x92c0('0x8f')],_0x476ad0['connectedlinename']);this[_0x92c0('0x10')][_0x476ad0[_0x92c0('0x49')]]=_0x26f8c2;this['emitVoiceQueueChannelSave'](_0x26f8c2,_0x92c0('0x1a'));}}}catch(_0x5adc9e){logger[_0x92c0('0x40')]('[%s][voiceQueueReport][queuecallerleave]',_0x476ad0[_0x92c0('0x49')],util[_0x92c0('0x3d')](_0x5adc9e,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x92c0('0x1f')]=function(_0x5d03b5){try{if(this[_0x92c0('0x6c')](_0x5d03b5)){logger[_0x92c0('0x46')](_0x92c0('0x91'),_0x5d03b5[_0x92c0('0x49')],util[_0x92c0('0x3d')](_0x5d03b5,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x5d03b5[_0x92c0('0x49')]]){var _0x15e351=_[_0x92c0('0x92')](this[_0x92c0('0xe')][_0x5d03b5[_0x92c0('0x49')]]);_0x15e351[_0x92c0('0x93')]=!![];_0x15e351[_0x92c0('0x89')]='COMPLETEDBYAGENT';logger[_0x92c0('0x7c')]('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0x15e351[_0x92c0('0x4c')],_0x15e351[_0x92c0('0x5b')]);}}}catch(_0x537fd0){logger[_0x92c0('0x40')](_0x92c0('0x91'),_0x5d03b5[_0x92c0('0x49')],util[_0x92c0('0x3d')](_0x537fd0,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x92c0('0xb')][_0x92c0('0x1d')]=function(_0x38f6c1){try{if(this['isNotNull'](_0x38f6c1)){logger[_0x92c0('0x46')]('[%s][voiceQueueReport][agentcomplete]',_0x38f6c1[_0x92c0('0x49')],util[_0x92c0('0x3d')](_0x38f6c1,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x38f6c1[_0x92c0('0x49')]]){var _0x4010e9=_[_0x92c0('0x92')](this[_0x92c0('0xe')][_0x38f6c1['uniqueid']]);_0x4010e9[_0x92c0('0x87')]=![];_0x4010e9['queuecallerabandonAt']=null;_0x4010e9[_0x92c0('0x94')]=!![];_0x4010e9[_0x92c0('0x8b')]=_0x38f6c1[_0x92c0('0x95')];_0x4010e9['holdtime']=_0x38f6c1[_0x92c0('0x85')];_0x4010e9[_0x92c0('0x93')]=!![];_0x4010e9[_0x92c0('0x96')]=![];_0x4010e9[_0x92c0('0x97')]=null;if(!_0x4010e9[_0x92c0('0x98')]){if(_0x38f6c1[_0x92c0('0x99')]==_0x92c0('0x98')){_0x4010e9['queuecallerexitreason']='COMPLETED';logger[_0x92c0('0x7c')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x4010e9[_0x92c0('0x4c')],_0x4010e9[_0x92c0('0x5b')]);}else{if(_[_0x92c0('0x9a')](_0x38f6c1[_0x92c0('0x39')][_0x92c0('0x9b')](),_0x92c0('0x9c'))){if(this[_0x92c0('0xe')][_0x38f6c1['linkedid']]){var _0x4cf6d7=_[_0x92c0('0x92')](this['queueReports'][_0x38f6c1[_0x92c0('0x9d')]]);_0x4cf6d7[_0x92c0('0x93')]=![];_0x4cf6d7['queuecallerexit']=!![];_0x4cf6d7[_0x92c0('0x97')]=moment(_0x4010e9[_0x92c0('0x77')])[_0x92c0('0x9e')](_0x38f6c1['holdtime'],_0x92c0('0x9f'))[_0x92c0('0x4a')](_0x92c0('0x78'));_0x4cf6d7[_0x92c0('0x89')]=_0x92c0('0xa0');_0x4cf6d7[_0x92c0('0x98')]=!![];_0x4cf6d7[_0x92c0('0xa1')]=_0x92c0('0xa2');_0x4cf6d7[_0x92c0('0xa3')]=_0x38f6c1['destexten'];_0x4cf6d7['transferuniqueid']=_0x38f6c1[_0x92c0('0x49')];logger[_0x92c0('0x7c')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0x4cf6d7['name'],_0x4cf6d7[_0x92c0('0x5b')]);var _0xafaedc=this['queueReports'][_0x38f6c1[_0x92c0('0x9d')]];this[_0x92c0('0xe')][_0x38f6c1[_0x92c0('0x9d')]]=this[_0x92c0('0xe')][_0x38f6c1['uniqueid']];this[_0x92c0('0xe')][_0x38f6c1[_0x92c0('0x49')]]=_0xafaedc;}}else{_0x4010e9['queuecallerexitreason']='COMPLETEDBY'+_0x38f6c1[_0x92c0('0x99')]['toUpperCase']();logger['info'](_0x92c0('0xa4'),_0x4010e9[_0x92c0('0x4c')],_0x4010e9[_0x92c0('0x5b')],_0x4010e9[_0x92c0('0x89')]);}}}this[_0x92c0('0x10')][_0x38f6c1[_0x92c0('0x49')]]=_0x4010e9;this['emitVoiceQueueChannelRemove'](_0x4010e9,'agentcomplete');}}}catch(_0x581aa5){logger[_0x92c0('0x40')]('[%s][voiceQueueReport][agentcomplete]',_0x38f6c1['uniqueid'],util['inspect'](_0x581aa5,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x92c0('0x20')]=function(_0xf27356){try{if(this[_0x92c0('0x6c')](_0xf27356)){logger[_0x92c0('0x46')](_0x92c0('0xa5'),_0xf27356[_0x92c0('0x49')],util['inspect'](_0xf27356,{'showHidden':![],'depth':null}));this[_0x92c0('0xa6')](_0xf27356[_0x92c0('0x49')],_[_0x92c0('0x80')](_0xf27356[_0x92c0('0xa7')])[0x0],_0xf27356[_0x92c0('0xa8')]);if(this[_0x92c0('0xe')][_0xf27356[_0x92c0('0x49')]]){var _0x3afac8=_[_0x92c0('0x92')](this[_0x92c0('0xe')][_0xf27356[_0x92c0('0x49')]]);if(_0x3afac8){if(this[_0x92c0('0x6c')](_0xf27356[_0x92c0('0xa7')])&&this[_0x92c0('0x6c')](_0xf27356['variable'][_0x92c0('0xa9')])){switch(_0xf27356['value']){case'CONTINUE':_0x3afac8[_0x92c0('0x96')]=![];_0x3afac8[_0x92c0('0x97')]=null;break;case'TIMEOUT':_0x3afac8['lastevent']=_0x92c0('0xaa');_0x3afac8[_0x92c0('0x96')]=!![];_0x3afac8[_0x92c0('0x97')]=moment()[_0x92c0('0x4a')](_0x92c0('0x78'));_0x3afac8[_0x92c0('0x8e')]=moment()[_0x92c0('0x4a')](_0x92c0('0x78'));logger[_0x92c0('0x46')]('[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:',_0xf27356[_0x92c0('0x49')],util[_0x92c0('0x3d')](_0x3afac8,{'showHidden':![],'depth':null}));ami['emit']('custom:timeout',_0x3afac8);break;default:_0x3afac8[_0x92c0('0x96')]=!![];_0x3afac8['queuecallerexitAt']=moment()[_0x92c0('0x4a')](_0x92c0('0x78'));_0x3afac8[_0x92c0('0x8e')]=moment()[_0x92c0('0x4a')](_0x92c0('0x78'));}_0x3afac8['queuecallerabandon']=![];_0x3afac8[_0x92c0('0x88')]=null;_0x3afac8[_0x92c0('0x89')]=_0xf27356['value'];this[_0x92c0('0x10')][_0xf27356[_0x92c0('0x49')]]=_0x3afac8;this['emitVoiceQueueChannelRemove'](_0x3afac8,'varset');}else if(this['isNotNull'](_0xf27356[_0x92c0('0xa7')])&&this[_0x92c0('0x6c')](_0xf27356[_0x92c0('0xa7')][_0x92c0('0xab')])){if(!_0x3afac8[_0x92c0('0x87')]){_0x3afac8[_0x92c0('0x96')]=!![];_0x3afac8['queuecallerexitAt']=moment()[_0x92c0('0x4a')](_0x92c0('0x78'));_0x3afac8[_0x92c0('0x89')]='EXITWITHKEY';_0x3afac8['queuecallerleaveAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x92c0('0x10')][_0xf27356[_0x92c0('0x49')]]=_0x3afac8;}}logger['info'](_0x92c0('0xac'),_0xf27356[_0x92c0('0x49')],_0x3afac8[_0x92c0('0x4c')],_0x3afac8[_0x92c0('0x5b')],_['keys'](_0xf27356[_0x92c0('0xa7')])[0x0],_0xf27356['value']);_0x3afac8[_0x92c0('0x3f')]=this[_0x92c0('0x3f')][_0xf27356['uniqueid']];}}}}catch(_0x1fb5e2){logger['error'](_0x92c0('0xa5'),_0xf27356[_0x92c0('0x49')],util[_0x92c0('0x3d')](_0x1fb5e2,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['addVariable']=function(_0x3344fd,_0x11928c,_0x503363){var _0x10046e=[_0x92c0('0xad'),_0x92c0('0xae'),'rtpaudioqosjitter',_0x92c0('0xaf'),'rtpaudioqosloss',_0x92c0('0xb0'),_0x92c0('0xb1'),_0x92c0('0xb2'),'sipcallid','sipuri',_0x92c0('0xb3'),'bridgepvtcallid',_0x92c0('0xb4'),_0x92c0('0xb5'),_0x92c0('0xb6'),'memberlastcall','membername',_0x92c0('0xb7'),'memberrealtime'];if(!_[_0x92c0('0x37')](_0x11928c)&&!_['includes'](_0x10046e,_0x11928c)){if(_[_0x92c0('0x66')](this[_0x92c0('0x3f')][_0x3344fd])){this[_0x92c0('0x3f')][_0x3344fd]={};}this['variables'][_0x3344fd][_0x11928c]=_0x503363;}};VoiceQueueReport[_0x92c0('0xb')]['syncHangup']=function(_0x517caf){try{if(this[_0x92c0('0x6c')](_0x517caf)){logger[_0x92c0('0x46')](_0x92c0('0xb8'),_0x517caf['uniqueid'],util['inspect'](_0x517caf,{'showHidden':![],'depth':null}));if(this[_0x92c0('0xe')][_0x517caf[_0x92c0('0x49')]]){for(var _0x4652f8=0x0,_0x5309d6={};_0x4652f8=0x0?moment(_0xd52609['endtime'])['diff'](_0xd52609['starttime'],_0x9ac9('0xd')):null,'data1':_0x9ac9('0x15'),'data2':_0xd52609[_0x9ac9('0x11')],'data3':_0xd52609[_0x9ac9('0xf')],'data4':_0xd52609[_0x9ac9('0x16')]||null,'role':_0x9ac9('0x17'),'internal':_0xd52609[_0x9ac9('0x11')]?_[_0x9ac9('0x12')](_0xd52609[_0x9ac9('0x11')]):undefined,'uniqueid':_0xd52609[_0x9ac9('0x18')]},'log':_0x9ac9('0x4')});}; \ No newline at end of file +var _0xfbf4=['voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','CreateMemberReport','lastAssignedTo','isNil','interface','TALKING','queuecallerleaveAt','diff','calleridnum','exten','queue','toNumber','accountcode','uniqueid','voiceDialReport','Request','voice','membername','starttime','endtime','seconds','dialstring','agent','moment','lodash','../client'];(function(_0x27a1a0,_0x32380c){var _0x38cf5c=function(_0x2c6cc5){while(--_0x2c6cc5){_0x27a1a0['push'](_0x27a1a0['shift']());}};_0x38cf5c(++_0x32380c);}(_0xfbf4,0x131));var _0x4fbf=function(_0x286cef,_0x5e2e2e){_0x286cef=_0x286cef-0x0;var _0x108f5e=_0xfbf4[_0x286cef];return _0x108f5e;};'use strict';var moment=require(_0x4fbf('0x0'));var _=require(_0x4fbf('0x1'));var util=require('util');var client=require(_0x4fbf('0x2'));exports[_0x4fbf('0x3')]=function(_0x54bcd9){var _0x2d8618=_0x54bcd9[_0x4fbf('0x4')]||_0x54bcd9[_0x4fbf('0x5')];return client['Request'](_0x4fbf('0x6'),{'body':{'channel':'voice','membername':_0x54bcd9[_0x4fbf('0x7')],'interface':_[_0x4fbf('0x8')](_0x54bcd9[_0x4fbf('0x9')])?util['format']('SIP/%s',_0x54bcd9[_0x4fbf('0x7')]):_0x54bcd9['interface'],'type':_0x4fbf('0xa'),'enterAt':_0x54bcd9[_0x4fbf('0xb')],'exitAt':_0x2d8618,'duration':moment(_0x2d8618)[_0x4fbf('0xc')](_0x54bcd9[_0x4fbf('0xb')],'seconds'),'data1':'inbound','data2':_0x54bcd9[_0x4fbf('0xd')],'data3':_0x54bcd9[_0x4fbf('0xe')],'data4':null,'data5':_0x54bcd9[_0x4fbf('0xf')],'role':'agent','internal':_0x54bcd9['accountcode']?_[_0x4fbf('0x10')](_0x54bcd9[_0x4fbf('0x11')]):undefined,'uniqueid':_0x54bcd9[_0x4fbf('0x12')]},'log':_0x4fbf('0x6')});};exports[_0x4fbf('0x13')]=function(_0x419785){return client[_0x4fbf('0x14')](_0x4fbf('0x6'),{'body':{'channel':_0x4fbf('0x15'),'membername':_0x419785[_0x4fbf('0x16')],'interface':_0x419785['interface'],'type':_0x4fbf('0xa'),'enterAt':_0x419785[_0x4fbf('0x17')],'exitAt':_0x419785[_0x4fbf('0x18')],'duration':moment(_0x419785[_0x4fbf('0x18')])[_0x4fbf('0xc')](_0x419785[_0x4fbf('0x17')],_0x4fbf('0x19'))>=0x0?moment(_0x419785['endtime'])[_0x4fbf('0xc')](_0x419785[_0x4fbf('0x17')],_0x4fbf('0x19')):null,'data1':'outbound','data2':_0x419785[_0x4fbf('0x11')],'data3':_0x419785[_0x4fbf('0xe')],'data4':_0x419785[_0x4fbf('0x1a')]||null,'role':_0x4fbf('0x1b'),'internal':_0x419785[_0x4fbf('0x11')]?_[_0x4fbf('0x10')](_0x419785['accountcode']):undefined,'uniqueid':_0x419785[_0x4fbf('0x12')]},'log':_0x4fbf('0x6')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index f9dd1bd..1651bba 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 _0xac92=['ShowSetting','stopRecordingOnTransfer','GetSettings','../client','getSettings','Request'];(function(_0x8afdd0,_0x548ad1){var _0x3de7ac=function(_0x2dc2c4){while(--_0x2dc2c4){_0x8afdd0['push'](_0x8afdd0['shift']());}};_0x3de7ac(++_0x548ad1);}(_0xac92,0x7b));var _0x2ac9=function(_0x4cab9c,_0xf772d9){_0x4cab9c=_0x4cab9c-0x0;var _0x578898=_0xac92[_0x4cab9c];return _0x578898;};'use strict';var client=require(_0x2ac9('0x0'));exports[_0x2ac9('0x1')]=function(){return client[_0x2ac9('0x2')](_0x2ac9('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x2ac9('0x4')]},'log':_0x2ac9('0x5')});}; \ No newline at end of file +var _0x570f=['Request','GetSettings','../client','getSettings'];(function(_0x4bf593,_0x4ca2cf){var _0x392854=function(_0x275799){while(--_0x275799){_0x4bf593['push'](_0x4bf593['shift']());}};_0x392854(++_0x4ca2cf);}(_0x570f,0x152));var _0xf570=function(_0x426e99,_0x2ec5fd){_0x426e99=_0x426e99-0x0;var _0x421bd2=_0x570f[_0x426e99];return _0x421bd2;};'use strict';var client=require(_0xf570('0x0'));exports[_0xf570('0x1')]=function(){return client[_0xf570('0x2')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':['stopRecordingOnTransfer']},'log':_0xf570('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 9dd90f9..39ccaf4 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 _0x5843=['../client','Request','GetTemplate','name'];(function(_0x55df8d,_0x21225e){var _0x18cd9b=function(_0x3be621){while(--_0x3be621){_0x55df8d['push'](_0x55df8d['shift']());}};_0x18cd9b(++_0x21225e);}(_0x5843,0x74));var _0x3584=function(_0x1e5cb3,_0x2e0133){_0x1e5cb3=_0x1e5cb3-0x0;var _0x693572=_0x5843[_0x1e5cb3];return _0x693572;};'use strict';var client=require(_0x3584('0x0'));exports['getTemplates']=function(_0x170d21){return function(_0x3c7a35){return client[_0x3584('0x1')](_0x3584('0x2'),{'options':{'raw':!![],'attributes':['id',_0x3584('0x3'),'html']},'log':_0x3584('0x2')});};}; \ No newline at end of file +var _0x59c4=['name','../client','Request','GetTemplate'];(function(_0x3799bf,_0x937a88){var _0x633b0a=function(_0x192fc7){while(--_0x192fc7){_0x3799bf['push'](_0x3799bf['shift']());}};_0x633b0a(++_0x937a88);}(_0x59c4,0x79));var _0x459c=function(_0x1b2647,_0x463281){_0x1b2647=_0x1b2647-0x0;var _0x5fde1a=_0x59c4[_0x1b2647];return _0x5fde1a;};'use strict';var client=require(_0x459c('0x0'));exports['getTemplates']=function(_0x44911d){return function(_0x1cd4d7){return client[_0x459c('0x1')](_0x459c('0x2'),{'options':{'raw':!![],'attributes':['id',_0x459c('0x3'),'html']},'log':_0x459c('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 889e8f8..64ca767 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 _0xfd88=['data2','data4','data5','data6','data7','../client','getTriggers','Request','channel','status','Condition','AllConditions','AnyConditions','field','operator','value','Action','Actions','action','data1'];(function(_0x526269,_0x5bfb14){var _0x5d21e0=function(_0x516d2d){while(--_0x516d2d){_0x526269['push'](_0x526269['shift']());}};_0x5d21e0(++_0x5bfb14);}(_0xfd88,0xcd));var _0x8fd8=function(_0x272d90,_0x5e70ff){_0x272d90=_0x272d90-0x0;var _0x2bf4a2=_0xfd88[_0x272d90];return _0x2bf4a2;};'use strict';var client=require(_0x8fd8('0x0'));exports[_0x8fd8('0x1')]=function(_0x52f3df){return function(_0x174ff8){return client[_0x8fd8('0x2')]('GetTrigger',{'options':{'raw':![],'attributes':['id','name',_0x8fd8('0x3'),_0x8fd8('0x4')],'include':[{'model':_0x8fd8('0x5'),'as':_0x8fd8('0x6'),'attributes':['id','field','operator','value']},{'model':_0x8fd8('0x5'),'as':_0x8fd8('0x7'),'attributes':['id',_0x8fd8('0x8'),_0x8fd8('0x9'),_0x8fd8('0xa')]},{'model':_0x8fd8('0xb'),'as':_0x8fd8('0xc'),'attributes':['id',_0x8fd8('0xd'),_0x8fd8('0xe'),_0x8fd8('0xf'),'data3',_0x8fd8('0x10'),_0x8fd8('0x11'),_0x8fd8('0x12'),_0x8fd8('0x13')]}]},'log':'GetTrigger'});};}; \ No newline at end of file +var _0x9bec=['value','AnyConditions','Action','Actions','data1','data2','data3','data4','data5','data6','data7','../client','getTriggers','Request','GetTrigger','name','channel','Condition','AllConditions','field','operator'];(function(_0xf52322,_0x4e2427){var _0x528e53=function(_0x41ed72){while(--_0x41ed72){_0xf52322['push'](_0xf52322['shift']());}};_0x528e53(++_0x4e2427);}(_0x9bec,0x146));var _0xc9be=function(_0x34843e,_0x4c4224){_0x34843e=_0x34843e-0x0;var _0x598f7f=_0x9bec[_0x34843e];return _0x598f7f;};'use strict';var client=require(_0xc9be('0x0'));exports[_0xc9be('0x1')]=function(_0x1488bb){return function(_0x22a116){return client[_0xc9be('0x2')](_0xc9be('0x3'),{'options':{'raw':![],'attributes':['id',_0xc9be('0x4'),_0xc9be('0x5'),'status'],'include':[{'model':_0xc9be('0x6'),'as':_0xc9be('0x7'),'attributes':['id',_0xc9be('0x8'),_0xc9be('0x9'),_0xc9be('0xa')]},{'model':_0xc9be('0x6'),'as':_0xc9be('0xb'),'attributes':['id',_0xc9be('0x8'),_0xc9be('0x9'),_0xc9be('0xa')]},{'model':_0xc9be('0xc'),'as':_0xc9be('0xd'),'attributes':['id','action',_0xc9be('0xe'),_0xc9be('0xf'),_0xc9be('0x10'),_0xc9be('0x11'),_0xc9be('0x12'),_0xc9be('0x13'),_0xc9be('0x14')]}]},'log':'GetTrigger'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index c5557d5..4adf41d 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 _0x590c=['registry','defaultuser','../client','Request','GetTrunk','name'];(function(_0x2b429e,_0x3395b3){var _0x43ff8a=function(_0x22fa95){while(--_0x22fa95){_0x2b429e['push'](_0x2b429e['shift']());}};_0x43ff8a(++_0x3395b3);}(_0x590c,0x80));var _0xc590=function(_0xfeeea4,_0x30e65b){_0xfeeea4=_0xfeeea4-0x0;var _0x118b57=_0x590c[_0xfeeea4];return _0x118b57;};'use strict';var client=require(_0xc590('0x0'));exports['getTrunks']=function(_0x53d81b){return function(_0x3ce18b){return client[_0xc590('0x1')](_0xc590('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xc590('0x3'),_0xc590('0x4'),_0xc590('0x5')]},'log':_0xc590('0x2')});};}; \ No newline at end of file +var _0xc999=['getTrunks','defaultuser'];(function(_0xa8e878,_0x2c0e1d){var _0x1bab2b=function(_0x1bb54f){while(--_0x1bb54f){_0xa8e878['push'](_0xa8e878['shift']());}};_0x1bab2b(++_0x2c0e1d);}(_0xc999,0x176));var _0x9c99=function(_0xcda377,_0x1e2678){_0xcda377=_0xcda377-0x0;var _0x1c024f=_0xc999[_0xcda377];return _0x1c024f;};'use strict';var client=require('../client');exports[_0x9c99('0x0')]=function(_0x7c806){return function(_0x22a35f){return client['Request']('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name','registry',_0x9c99('0x1')]},'log':'GetTrunk'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index c4c5cb5..70fe679 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 _0x34e8=['../client','getAgents','Request','GetUser','name','email','accountcode','fullname','online','lastLoginAt','pauseType','voicePause','mobile','interface','getTelephones','telephone','internal','savePause','PauseUser','saveUnpause','UnpauseUser','getAgent','ShowUser','agent','lastPauseAt'];(function(_0x3a0f07,_0x26e3a2){var _0x14c670=function(_0x22c235){while(--_0x22c235){_0x3a0f07['push'](_0x3a0f07['shift']());}};_0x14c670(++_0x26e3a2);}(_0x34e8,0x12c));var _0x834e=function(_0x3bbb49,_0x5162c7){_0x3bbb49=_0x3bbb49-0x0;var _0x5dca1e=_0x34e8[_0x3bbb49];return _0x5dca1e;};'use strict';var client=require(_0x834e('0x0'));exports[_0x834e('0x1')]=function(){return function(){return client[_0x834e('0x2')](_0x834e('0x3'),{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6'),_0x834e('0x7'),_0x834e('0x8'),_0x834e('0x9'),_0x834e('0xa'),'lastPauseAt',_0x834e('0xb'),'phone',_0x834e('0xc'),_0x834e('0xd')]},'log':_0x834e('0x1')});};};exports[_0x834e('0xe')]=function(){return function(){return client[_0x834e('0x2')](_0x834e('0x3'),{'options':{'raw':!![],'where':{'role':_0x834e('0xf')},'attributes':['id',_0x834e('0x4'),_0x834e('0x6'),_0x834e('0x10')]},'log':_0x834e('0xe')});};};exports[_0x834e('0x11')]=function(_0x14038b,_0x2e1a37,_0x293514){return client[_0x834e('0x2')](_0x834e('0x12'),{'body':{'type':_0x2e1a37,'uniqueid':_0x293514},'options':{'where':{'id':_0x14038b['id']}},'log':'savePause'});};exports[_0x834e('0x13')]=function(_0x6cd9b9){return client['Request'](_0x834e('0x14'),{'body':{},'options':{'where':{'id':_0x6cd9b9['id']}},'log':_0x834e('0x11')});};exports[_0x834e('0x15')]=function(_0x21cc0a){return client['Request'](_0x834e('0x16'),{'options':{'raw':![],'where':{'role':_0x834e('0x17'),'id':_0x21cc0a},'attributes':['id','name',_0x834e('0x5'),'accountcode',_0x834e('0x7'),_0x834e('0x8'),'lastLoginAt',_0x834e('0xa'),_0x834e('0x18'),_0x834e('0xb'),'interface']},'log':_0x834e('0x15')});}; \ No newline at end of file +var _0xedd9=['mobile','getTelephones','internal','PauseUser','savePause','saveUnpause','UnpauseUser','ShowUser','interface','getAgent','getAgents','Request','GetUser','agent','name','email','accountcode','fullname','lastLoginAt','pauseType','lastPauseAt','voicePause'];(function(_0x52ae12,_0x5d1580){var _0x8816ea=function(_0x3615d2){while(--_0x3615d2){_0x52ae12['push'](_0x52ae12['shift']());}};_0x8816ea(++_0x5d1580);}(_0xedd9,0xfc));var _0x9edd=function(_0x486f67,_0x31a5ba){_0x486f67=_0x486f67-0x0;var _0x51e075=_0xedd9[_0x486f67];return _0x51e075;};'use strict';var client=require('../client');exports[_0x9edd('0x0')]=function(){return function(){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'options':{'raw':![],'where':{'role':_0x9edd('0x3')},'attributes':['id',_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6'),_0x9edd('0x7'),'online',_0x9edd('0x8'),_0x9edd('0x9'),_0x9edd('0xa'),_0x9edd('0xb'),'phone',_0x9edd('0xc'),'interface']},'log':_0x9edd('0x0')});};};exports[_0x9edd('0xd')]=function(){return function(){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x9edd('0x4'),'accountcode',_0x9edd('0xe')]},'log':_0x9edd('0xd')});};};exports['savePause']=function(_0xbf9da6,_0x13dc4f,_0x5b6c00){return client[_0x9edd('0x1')](_0x9edd('0xf'),{'body':{'type':_0x13dc4f,'uniqueid':_0x5b6c00},'options':{'where':{'id':_0xbf9da6['id']}},'log':_0x9edd('0x10')});};exports[_0x9edd('0x11')]=function(_0x287ddd){return client[_0x9edd('0x1')](_0x9edd('0x12'),{'body':{},'options':{'where':{'id':_0x287ddd['id']}},'log':_0x9edd('0x10')});};exports['getAgent']=function(_0x176bfa){return client[_0x9edd('0x1')](_0x9edd('0x13'),{'options':{'raw':![],'where':{'role':_0x9edd('0x3'),'id':_0x176bfa},'attributes':['id',_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6'),_0x9edd('0x7'),'online',_0x9edd('0x8'),_0x9edd('0x9'),_0x9edd('0xa'),'voicePause',_0x9edd('0x14')]},'log':_0x9edd('0x15')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index e2b44dd..5688b02 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 _0x1343=['UpdateVoiceAgentReport','create','Request','CreateVoiceAgentReport','update'];(function(_0x17ef74,_0x155828){var _0x576658=function(_0x47babb){while(--_0x47babb){_0x17ef74['push'](_0x17ef74['shift']());}};_0x576658(++_0x155828);}(_0x1343,0x1f0));var _0x3134=function(_0x11f083,_0x38a7dd){_0x11f083=_0x11f083-0x0;var _0x1a41f3=_0x1343[_0x11f083];return _0x1a41f3;};'use strict';var client=require('../client');exports[_0x3134('0x0')]=function(_0x5e7d26){return client[_0x3134('0x1')](_0x3134('0x2'),{'body':_0x5e7d26,'log':_0x3134('0x2')});};exports[_0x3134('0x3')]=function(_0x3f710e,_0x6c1b26,_0x543dbb){return client[_0x3134('0x1')](_0x3134('0x4'),{'body':_0x3f710e,'options':{'where':{'uniqueid':_0x6c1b26,'interface':_0x543dbb,'agentcomplete':!![]}},'log':_0x3134('0x4')});}; \ No newline at end of file +var _0x6029=['update','UpdateVoiceAgentReport','../client','create','Request','CreateVoiceAgentReport'];(function(_0x299784,_0xb0918f){var _0x5ab008=function(_0x49c1f5){while(--_0x49c1f5){_0x299784['push'](_0x299784['shift']());}};_0x5ab008(++_0xb0918f);}(_0x6029,0x1e2));var _0x9602=function(_0x5f0a42,_0x7f36f8){_0x5f0a42=_0x5f0a42-0x0;var _0x1153be=_0x6029[_0x5f0a42];return _0x1153be;};'use strict';var client=require(_0x9602('0x0'));exports[_0x9602('0x1')]=function(_0x13aae3){return client[_0x9602('0x2')](_0x9602('0x3'),{'body':_0x13aae3,'log':_0x9602('0x3')});};exports[_0x9602('0x4')]=function(_0xc96ada,_0x1b1736,_0x529e31){return client[_0x9602('0x2')](_0x9602('0x5'),{'body':_0xc96ada,'options':{'where':{'uniqueid':_0x1b1736,'interface':_0x529e31,'agentcomplete':!![]}},'log':_0x9602('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index e3182d6..c024122 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 _0x7dd7=['duration','billableseconds','GetVoiceCallReports','util','lodash','Request','CreateVoiceCallReport','merge','calleridnum','context','callerid','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound','day','format','endOf','disposition'];(function(_0x4ffafb,_0x20171a){var _0x4ab472=function(_0x1afc75){while(--_0x1afc75){_0x4ffafb['push'](_0x4ffafb['shift']());}};_0x4ab472(++_0x20171a);}(_0x7dd7,0x1b8));var _0x77dd=function(_0x468a77,_0x1382be){_0x468a77=_0x468a77-0x0;var _0x2d1c33=_0x7dd7[_0x468a77];return _0x2d1c33;};'use strict';var moment=require('moment');var util=require(_0x77dd('0x0'));var _=require(_0x77dd('0x1'));var client=require('../client');exports['create']=function(_0x4a7c10){return client[_0x77dd('0x2')](_0x77dd('0x3'),{'body':_[_0x77dd('0x4')](_0x4a7c10,{'source':_0x4a7c10[_0x77dd('0x5')],'destinationcontext':_0x4a7c10[_0x77dd('0x6')],'callerid':_0x4a7c10[_0x77dd('0x7')],'amaflags':_0x77dd('0x8')}),'log':'CreateVoiceCallReport'});};exports[_0x77dd('0x9')]=function(){return function(){return client[_0x77dd('0x2')](_0x77dd('0xa'),{'options':{'where':{'type':[_0x77dd('0xb')],'createdAt':{'$between':[moment()['startOf'](_0x77dd('0xc'))[_0x77dd('0xd')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0x77dd('0xe')](_0x77dd('0xc'))[_0x77dd('0xd')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':['type',_0x77dd('0xf'),_0x77dd('0x10'),_0x77dd('0x11')]},'log':_0x77dd('0x12')});};}; \ No newline at end of file +var _0xa64d=['format','YYYY-MM-DD\x20HH:mm:ss','endOf','day','type','disposition','duration','billableseconds','moment','util','../client','create','Request','merge','context','callerid','DOCUMENTATION','GetVoiceCallReport'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa64d,0x194));var _0xda64=function(_0x3686e4,_0x5d5621){_0x3686e4=_0x3686e4-0x0;var _0x509e6d=_0xa64d[_0x3686e4];return _0x509e6d;};'use strict';var moment=require(_0xda64('0x0'));var util=require(_0xda64('0x1'));var _=require('lodash');var client=require(_0xda64('0x2'));exports[_0xda64('0x3')]=function(_0x1ad06f){return client[_0xda64('0x4')]('CreateVoiceCallReport',{'body':_[_0xda64('0x5')](_0x1ad06f,{'source':_0x1ad06f['calleridnum'],'destinationcontext':_0x1ad06f[_0xda64('0x6')],'callerid':_0x1ad06f[_0xda64('0x7')],'amaflags':_0xda64('0x8')}),'log':'CreateVoiceCallReport'});};exports['getVoiceCallReports']=function(){return function(){return client[_0xda64('0x4')](_0xda64('0x9'),{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()['startOf']('day')[_0xda64('0xa')](_0xda64('0xb')),moment()[_0xda64('0xc')](_0xda64('0xd'))[_0xda64('0xa')](_0xda64('0xb'))]}},'attributes':[_0xda64('0xe'),_0xda64('0xf'),_0xda64('0x10'),_0xda64('0x11')]},'log':'GetVoiceCallReports'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index b4660b9..2e8d7d8 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 _0x2f67=['Request','CreateVoiceDialReport','../client'];(function(_0x325a5a,_0x58984d){var _0x54dee6=function(_0x3b0eb2){while(--_0x3b0eb2){_0x325a5a['push'](_0x325a5a['shift']());}};_0x54dee6(++_0x58984d);}(_0x2f67,0x167));var _0x72f6=function(_0x6ae23f,_0x5ad8f6){_0x6ae23f=_0x6ae23f-0x0;var _0x2b9cc3=_0x2f67[_0x6ae23f];return _0x2b9cc3;};'use strict';var client=require(_0x72f6('0x0'));exports['create']=function(_0x475d21){return client[_0x72f6('0x1')]('CreateVoiceDialReport',{'body':_0x475d21,'log':_0x72f6('0x2')});}; \ No newline at end of file +var _0xecdf=['Request','CreateVoiceDialReport','../client','create'];(function(_0x5700c5,_0x3f8f18){var _0x771cca=function(_0x5543f8){while(--_0x5543f8){_0x5700c5['push'](_0x5700c5['shift']());}};_0x771cca(++_0x3f8f18);}(_0xecdf,0xc6));var _0xfecd=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xecdf[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0xfecd('0x0'));exports[_0xfecd('0x1')]=function(_0x34509e){return client[_0xfecd('0x2')](_0xfecd('0x3'),{'body':_0x34509e,'log':_0xfecd('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 5cdf671..3136cc4 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 _0xe28e=['Request','GetVoiceExtension','exten','recordingFormat','../client','getVoiceExtensions'];(function(_0x1b828b,_0x344400){var _0x98da1a=function(_0x1a0f5b){while(--_0x1a0f5b){_0x1b828b['push'](_0x1b828b['shift']());}};_0x98da1a(++_0x344400);}(_0xe28e,0x1ba));var _0xee28=function(_0x4e9fa8,_0x39a916){_0x4e9fa8=_0x4e9fa8-0x0;var _0x3c0df6=_0xe28e[_0x4e9fa8];return _0x3c0df6;};'use strict';var client=require(_0xee28('0x0'));exports[_0xee28('0x1')]=function(){return function(){return client[_0xee28('0x2')](_0xee28('0x3'),{'options':{'raw':!![],'attributes':['id',_0xee28('0x4'),_0xee28('0x5')],'where':{'VoiceExtensionId':null}},'log':_0xee28('0x1')});};}; \ No newline at end of file +var _0xbdb7=['exten','recordingFormat','../client','getVoiceExtensions','Request','GetVoiceExtension'];(function(_0x176362,_0xc54a7f){var _0x352765=function(_0x36002a){while(--_0x36002a){_0x176362['push'](_0x176362['shift']());}};_0x352765(++_0xc54a7f);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x148316,_0x6c9dc){_0x148316=_0x148316-0x0;var _0xdbe95d=_0xbdb7[_0x148316];return _0xdbe95d;};'use strict';var client=require(_0x7bdb('0x0'));exports[_0x7bdb('0x1')]=function(){return function(){return client[_0x7bdb('0x2')](_0x7bdb('0x3'),{'options':{'raw':!![],'attributes':['id',_0x7bdb('0x4'),_0x7bdb('0x5')],'where':{'VoiceExtensionId':null}},'log':_0x7bdb('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 641530f..72d3fed 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 _0xf072=['dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalInterval','dialPrefix','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialRecallMeTimeout','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','dialPreviewAutoRecallMe','Trunk','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','../client','getVoiceQueues','Request','name','acwTimeout','autopause','monitor_format','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber'];(function(_0x1e2b89,_0x456916){var _0x3aec4e=function(_0x1a4c27){while(--_0x1a4c27){_0x1e2b89['push'](_0x1e2b89['shift']());}};_0x3aec4e(++_0x456916);}(_0xf072,0x1cf));var _0x2f07=function(_0xa26b7b,_0x13c525){_0xa26b7b=_0xa26b7b-0x0;var _0x458101=_0xf072[_0xa26b7b];return _0x458101;};'use strict';var client=require(_0x2f07('0x0'));exports[_0x2f07('0x1')]=function(){return function(){return client[_0x2f07('0x2')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0x2f07('0x3'),'acw',_0x2f07('0x4'),_0x2f07('0x5'),_0x2f07('0x6'),'type',_0x2f07('0x7'),_0x2f07('0x8'),_0x2f07('0x9'),_0x2f07('0xa'),_0x2f07('0xb'),_0x2f07('0xc'),_0x2f07('0xd'),_0x2f07('0xe'),_0x2f07('0xf'),_0x2f07('0x10'),_0x2f07('0x11'),_0x2f07('0x12'),_0x2f07('0x13'),_0x2f07('0x14'),_0x2f07('0x15'),'dialCongestionRetryFrequency',_0x2f07('0x16'),_0x2f07('0x17'),_0x2f07('0x18'),_0x2f07('0x19'),'dialGlobalMaxRetry','dialTimezone',_0x2f07('0x1a'),_0x2f07('0x1b'),'dialCheckDuplicateType',_0x2f07('0x1c'),_0x2f07('0x1d'),_0x2f07('0x1e'),'dialAMDAfterGreetingSilence',_0x2f07('0x1f'),_0x2f07('0x20'),_0x2f07('0x21'),_0x2f07('0x22'),_0x2f07('0x23'),_0x2f07('0x24'),'timeout',_0x2f07('0x25'),'dialRecallInQueue',_0x2f07('0x26'),_0x2f07('0x27'),_0x2f07('0x28'),_0x2f07('0x29'),_0x2f07('0x6'),_0x2f07('0x2a'),_0x2f07('0x2b'),_0x2f07('0x2c'),'dialNoSuchNumberMaxRetry',_0x2f07('0x2d'),'dialDropMaxRetry',_0x2f07('0x2e'),_0x2f07('0x2f'),_0x2f07('0x30'),_0x2f07('0x31'),_0x2f07('0x32'),'dialAgentRejectMaxRetry',_0x2f07('0x33'),'mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold',_0x2f07('0x34')],'include':[{'model':'Trunk','as':_0x2f07('0x35'),'attributes':['id','name',_0x2f07('0x36'),_0x2f07('0x37')]},{'model':_0x2f07('0x38'),'as':_0x2f07('0x39'),'attributes':['id','name']},{'model':_0x2f07('0x35'),'as':_0x2f07('0x3a'),'attributes':['id',_0x2f07('0x3'),'callerid',_0x2f07('0x37')]},{'model':_0x2f07('0x3b'),'as':'Interval','attributes':['id',_0x2f07('0x3')],'include':[{'model':_0x2f07('0x3b'),'as':'Intervals','attributes':['id',_0x2f07('0x3'),'interval']}]}]},'log':_0x2f07('0x1')});};}; \ No newline at end of file +var _0x5a63=['dialPredictiveOptimization','dialPredictiveInterval','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','active','Pause','mandatoryDispositionPause','TrunkBackup','callerid','Interval','Intervals','../client','getVoiceQueues','name','autopause','monitor_format','type','dialActive','dialMethod','dialLimitQueue'];(function(_0x3c5b46,_0x1528e9){var _0x188b3e=function(_0x4dcf44){while(--_0x4dcf44){_0x3c5b46['push'](_0x3c5b46['shift']());}};_0x188b3e(++_0x1528e9);}(_0x5a63,0xe3));var _0x35a6=function(_0x726ebf,_0x5c22a9){_0x726ebf=_0x726ebf-0x0;var _0x25410d=_0x5a63[_0x726ebf];return _0x25410d;};'use strict';var client=require(_0x35a6('0x0'));exports[_0x35a6('0x1')]=function(){return function(){return client['Request']('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0x35a6('0x2'),'acw','acwTimeout',_0x35a6('0x3'),_0x35a6('0x4'),_0x35a6('0x5'),_0x35a6('0x6'),_0x35a6('0x7'),'dialLimitChannel',_0x35a6('0x8'),'dialPowerLevel',_0x35a6('0x9'),'dialPredictiveOptimizationPercentage',_0x35a6('0xa'),'dialOriginateCallerIdName',_0x35a6('0xb'),_0x35a6('0xc'),_0x35a6('0xd'),_0x35a6('0xe'),_0x35a6('0xf'),'dialCongestionMaxRetry',_0x35a6('0x10'),_0x35a6('0x11'),_0x35a6('0x12'),'dialNoAnswerMaxRetry',_0x35a6('0x13'),'dialGlobalMaxRetry',_0x35a6('0x14'),_0x35a6('0x15'),_0x35a6('0x16'),_0x35a6('0x17'),_0x35a6('0x18'),'dialAMDInitialSilence',_0x35a6('0x19'),_0x35a6('0x1a'),_0x35a6('0x1b'),_0x35a6('0x1c'),_0x35a6('0x1d'),_0x35a6('0x1e'),'dialAMDSilenceThreshold',_0x35a6('0x1f'),_0x35a6('0x20'),_0x35a6('0x21'),_0x35a6('0x22'),_0x35a6('0x23'),_0x35a6('0x24'),'dialAgiAfterHangupClient',_0x35a6('0x25'),_0x35a6('0x4'),_0x35a6('0x26'),_0x35a6('0x27'),_0x35a6('0x28'),_0x35a6('0x29'),_0x35a6('0x2a'),'dialDropMaxRetry',_0x35a6('0x2b'),_0x35a6('0x2c'),_0x35a6('0x2d'),'dialMachineMaxRetry',_0x35a6('0x2e'),_0x35a6('0x2f'),_0x35a6('0x30'),'mandatoryDisposition',_0x35a6('0x31'),_0x35a6('0x32'),'dialPreviewAutoRecallMe'],'include':[{'model':_0x35a6('0x33'),'as':_0x35a6('0x33'),'attributes':['id','name','callerid',_0x35a6('0x34')]},{'model':_0x35a6('0x35'),'as':_0x35a6('0x36'),'attributes':['id',_0x35a6('0x2')]},{'model':_0x35a6('0x33'),'as':_0x35a6('0x37'),'attributes':['id',_0x35a6('0x2'),_0x35a6('0x38'),_0x35a6('0x34')]},{'model':_0x35a6('0x39'),'as':_0x35a6('0x39'),'attributes':['id',_0x35a6('0x2')],'include':[{'model':_0x35a6('0x39'),'as':_0x35a6('0x3a'),'attributes':['id',_0x35a6('0x2'),'interval']}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index f0a8797..40753e4 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(_0x286c27,_0x2bf6a4){var _0x54f834=function(_0x57c998){while(--_0x57c998){_0x286c27['push'](_0x286c27['shift']());}};_0x54f834(++_0x2bf6a4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'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(_0x2eb9e9,_0x3dfdd7){var _0x3279aa=function(_0x1ef168){while(--_0x1ef168){_0x2eb9e9['push'](_0x2eb9e9['shift']());}};_0x3279aa(++_0x3dfdd7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xa9e0[_0x3c2a69];return _0x596bc8;};'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 b64ac77..739c696 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 _0x82c3=['getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses','../client'];(function(_0x203225,_0x479478){var _0x37ffc5=function(_0x4ac6e3){while(--_0x4ac6e3){_0x203225['push'](_0x203225['shift']());}};_0x37ffc5(++_0x479478);}(_0x82c3,0x133));var _0x382c=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0x82c3[_0x3054be];return _0x3df150;};'use strict';var client=require(_0x382c('0x0'));exports[_0x382c('0x1')]=function(_0x689cc5){return function(){return client[_0x382c('0x2')](_0x382c('0x3'),{'options':{'where':{'VoiceQueueId':_0x689cc5,'paused':!![]},'raw':!![]},'log':_0x382c('0x1')});};}; \ No newline at end of file +var _0xad3e=['getVoiceQueueRtPauses','Request','../client'];(function(_0x3a81c2,_0x1f0f03){var _0x41a0d0=function(_0x1b50f1){while(--_0x1b50f1){_0x3a81c2['push'](_0x3a81c2['shift']());}};_0x41a0d0(++_0x1f0f03);}(_0xad3e,0xc8));var _0xead3=function(_0x3fa3a2,_0x432c29){_0x3fa3a2=_0x3fa3a2-0x0;var _0x252b9f=_0xad3e[_0x3fa3a2];return _0x252b9f;};'use strict';var client=require(_0xead3('0x0'));exports[_0xead3('0x1')]=function(_0x1c7aa2){return function(){return client[_0xead3('0x2')]('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x1c7aa2,'paused':!![]},'raw':!![]},'log':_0xead3('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 71dd8fb..c313d81 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 _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x31a909,_0x163fa9){var _0x2f1e38=function(_0x22ef25){while(--_0x22ef25){_0x31a909['push'](_0x31a909['shift']());}};_0x2f1e38(++_0x163fa9);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'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 +var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x1b6630,_0x50d15d){var _0x14bef3=function(_0x479351){while(--_0x479351){_0x1b6630['push'](_0x1b6630['shift']());}};_0x14bef3(++_0x50d15d);}(_0x7a54,0x106));var _0x47a5=function(_0x337e51,_0x13a8ef){_0x337e51=_0x337e51-0x0;var _0x6470a5=_0x7a54[_0x337e51];return _0x6470a5;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 4615510..6dd4c94 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 _0xae36=['transfers','blindTransfer','Request','CreateVoiceTransferReport','transfererchannel','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereelinkedid','isexternal','context','origtransferercalleridnum','secondtransfererconnectedlinename','secondtransfererexten','origtransfererlinkedid','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client'];(function(_0x156d31,_0xa1806e){var _0x4c54eb=function(_0x5cc938){while(--_0x5cc938){_0x156d31['push'](_0x156d31['shift']());}};_0x4c54eb(++_0xa1806e);}(_0xae36,0xae));var _0x6ae3=function(_0x335248,_0x1fb018){_0x335248=_0x335248-0x0;var _0x2c9bae=_0xae36[_0x335248];return _0x2c9bae;};'use strict';var client=require(_0x6ae3('0x0'));exports[_0x6ae3('0x1')]={};exports[_0x6ae3('0x2')]=function(_0x282bd7){return client[_0x6ae3('0x3')](_0x6ae3('0x4'),{'body':{'result':_0x282bd7['result'],'transfererchannel':_0x282bd7[_0x6ae3('0x5')],'transferercalleridnum':_0x282bd7['transferercalleridnum'],'transferercalleridname':_0x282bd7[_0x6ae3('0x6')],'transfererconnectedlinenum':_0x282bd7[_0x6ae3('0x7')],'transfererconnectedlinename':_0x282bd7[_0x6ae3('0x8')],'transfereraccountcode':_0x282bd7[_0x6ae3('0x9')],'transferercontext':_0x282bd7[_0x6ae3('0xa')],'transfererexten':_0x282bd7[_0x6ae3('0xb')],'transfererlinkedid':_0x282bd7[_0x6ae3('0xc')],'transfereechannel':_0x282bd7[_0x6ae3('0xd')],'transfereecalleridnum':_0x282bd7[_0x6ae3('0xe')],'transfereecalleridname':_0x282bd7[_0x6ae3('0xf')],'transfereeconnectedlinenum':_0x282bd7[_0x6ae3('0x10')],'transfereeconnectedlinename':_0x282bd7[_0x6ae3('0x11')],'transfereeaccountcode':_0x282bd7[_0x6ae3('0x12')],'transfereecontext':_0x282bd7[_0x6ae3('0x13')],'transfereeexten':_0x282bd7['transfereeexten'],'transfereelinkedid':_0x282bd7[_0x6ae3('0x14')],'isexternal':_0x282bd7[_0x6ae3('0x15')],'context':_0x282bd7[_0x6ae3('0x16')],'extension':_0x282bd7['extension'],'type':'blind'},'log':'CreateVoiceTransferReport'});};exports['attendedTransfer']=function(_0x3c558c){return client[_0x6ae3('0x3')](_0x6ae3('0x4'),{'body':{'result':_0x3c558c['result'],'transfererchannel':_0x3c558c['origtransfererchannel'],'transferercalleridnum':_0x3c558c[_0x6ae3('0x17')],'transferercalleridname':_0x3c558c['origtransferercalleridname'],'transfererconnectedlinenum':_0x3c558c['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x3c558c[_0x6ae3('0x18')],'transfereraccountcode':_0x3c558c['origtransfereraccountcode'],'transferercontext':_0x3c558c['secondtransferercontext'],'transfererexten':_0x3c558c[_0x6ae3('0x19')],'transfererlinkedid':_0x3c558c[_0x6ae3('0x1a')],'transfereechannel':_0x3c558c['transfertargetchannel'],'transfereecalleridnum':_0x3c558c['transfertargetcalleridnum'],'transfereecalleridname':_0x3c558c['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x3c558c[_0x6ae3('0x1b')],'transfereeconnectedlinename':_0x3c558c[_0x6ae3('0x1c')],'transfereeaccountcode':_0x3c558c[_0x6ae3('0x1d')],'transfereecontext':_0x3c558c[_0x6ae3('0x1e')],'transfereeexten':_0x3c558c['transfertargetexten'],'transfereelinkedid':_0x3c558c[_0x6ae3('0x1f')],'isexternal':_0x3c558c['isexternal'],'context':_0x3c558c[_0x6ae3('0x20')],'extension':_0x3c558c[_0x6ae3('0x21')],'type':_0x6ae3('0x22')},'log':_0x6ae3('0x4')});}; \ No newline at end of file +var _0x68a3=['transfertargetcontext','transfertargetexten','transfertargetlinkedid','isexternal','origtransferercontext','origtransfererexten','attended','transfers','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel','transfererconnectedlinenum','transfererconnectedlinename','transferercontext','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereecontext','transfereelinkedid','context','extension','blind','attendedTransfer','origtransfererchannel','origtransferercalleridname','secondtransferercontext','secondtransfererexten','transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinename'];(function(_0x508685,_0x9f94af){var _0x976a76=function(_0x1bcb05){while(--_0x1bcb05){_0x508685['push'](_0x508685['shift']());}};_0x976a76(++_0x9f94af);}(_0x68a3,0x6d));var _0x368a=function(_0x12699c,_0xf9dd49){_0x12699c=_0x12699c-0x0;var _0x54360e=_0x68a3[_0x12699c];return _0x54360e;};'use strict';var client=require('../client');exports[_0x368a('0x0')]={};exports[_0x368a('0x1')]=function(_0x1d3c85){return client[_0x368a('0x2')](_0x368a('0x3'),{'body':{'result':_0x1d3c85[_0x368a('0x4')],'transfererchannel':_0x1d3c85[_0x368a('0x5')],'transferercalleridnum':_0x1d3c85['transferercalleridnum'],'transferercalleridname':_0x1d3c85['transferercalleridname'],'transfererconnectedlinenum':_0x1d3c85[_0x368a('0x6')],'transfererconnectedlinename':_0x1d3c85[_0x368a('0x7')],'transfereraccountcode':_0x1d3c85['transfereraccountcode'],'transferercontext':_0x1d3c85[_0x368a('0x8')],'transfererexten':_0x1d3c85['transfererexten'],'transfererlinkedid':_0x1d3c85[_0x368a('0x9')],'transfereechannel':_0x1d3c85[_0x368a('0xa')],'transfereecalleridnum':_0x1d3c85[_0x368a('0xb')],'transfereecalleridname':_0x1d3c85[_0x368a('0xc')],'transfereeconnectedlinenum':_0x1d3c85[_0x368a('0xd')],'transfereeconnectedlinename':_0x1d3c85['transfereeconnectedlinename'],'transfereeaccountcode':_0x1d3c85['transfereeaccountcode'],'transfereecontext':_0x1d3c85[_0x368a('0xe')],'transfereeexten':_0x1d3c85['transfereeexten'],'transfereelinkedid':_0x1d3c85[_0x368a('0xf')],'isexternal':_0x1d3c85['isexternal'],'context':_0x1d3c85[_0x368a('0x10')],'extension':_0x1d3c85[_0x368a('0x11')],'type':_0x368a('0x12')},'log':'CreateVoiceTransferReport'});};exports[_0x368a('0x13')]=function(_0x275f2c){return client['Request'](_0x368a('0x3'),{'body':{'result':_0x275f2c[_0x368a('0x4')],'transfererchannel':_0x275f2c[_0x368a('0x14')],'transferercalleridnum':_0x275f2c['origtransferercalleridnum'],'transferercalleridname':_0x275f2c[_0x368a('0x15')],'transfererconnectedlinenum':_0x275f2c['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x275f2c['secondtransfererconnectedlinename'],'transfereraccountcode':_0x275f2c['origtransfereraccountcode'],'transferercontext':_0x275f2c[_0x368a('0x16')],'transfererexten':_0x275f2c[_0x368a('0x17')],'transfererlinkedid':_0x275f2c['origtransfererlinkedid'],'transfereechannel':_0x275f2c[_0x368a('0x18')],'transfereecalleridnum':_0x275f2c[_0x368a('0x19')],'transfereecalleridname':_0x275f2c['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x275f2c['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x275f2c[_0x368a('0x1a')],'transfereeaccountcode':_0x275f2c['transfertargetaccountcode'],'transfereecontext':_0x275f2c[_0x368a('0x1b')],'transfereeexten':_0x275f2c[_0x368a('0x1c')],'transfereelinkedid':_0x275f2c[_0x368a('0x1d')],'isexternal':_0x275f2c[_0x368a('0x1e')],'context':_0x275f2c[_0x368a('0x1f')],'extension':_0x275f2c[_0x368a('0x20')],'type':_0x368a('0x21')},'log':_0x368a('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 5c2081c..bd01b6a 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 _0x4fb4=['format','%s/%s','SIP','name','timers','timer','updateAcw','agents','updateStatusRealtime','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Action','then','message','catch','Command','content','voiceQueues','strategy','answered','available','loggedIn','pTalking','sumBillable','total','unmanaged','abandoned','loggedInDb','type','outbound','dialActive','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','Interval','find','omit','undefined','channels','uniqueid','channel','%s.%s','filename','wav','MixMonitor','isNil','monitors','push','/var/spool/asterisk/monitor/','toLowerCase','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','voicechannel','length','map','StopMixMonitor','destinationchannel','stop','StopMixMonitor\x20Success','values','queueChannels','voicequeuechannelhangup','Redirect','exten','context','trunks','campaigns','run','event','Event\x20name\x20mandatory','emit','custom:','faxAccounts','send','server','http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','util','jayson/promise','validate','bluebird','moment','../../../config/environment','../ami','listen'];(function(_0x330e31,_0x5d8c29){var _0x111a91=function(_0x53dfa8){while(--_0x53dfa8){_0x330e31['push'](_0x330e31['shift']());}};_0x111a91(++_0x5d8c29);}(_0x4fb4,0x190));var _0x44fb=function(_0x498d93,_0x1fd043){_0x498d93=_0x498d93-0x0;var _0x3413c1=_0x4fb4[_0x498d93];return _0x3413c1;};'use strict';var _=require('lodash');var util=require(_0x44fb('0x0'));var jayson=require(_0x44fb('0x1'));var schema=require(_0x44fb('0x2'));var BPromise=require(_0x44fb('0x3'));var moment=require(_0x44fb('0x4'));var config=require(_0x44fb('0x5'));var properties=require('../properties');var ami=require(_0x44fb('0x6'));exports[_0x44fb('0x7')]=function(_0x308b96,_0x26fbd6,_0x375d33){return new BPromise(function(_0x173e70,_0x464af5){var _0x2a4d75={'QueuePause':function(_0x59aa6d){return new Promise(function(_0x87f716,_0xd4ead0){var _0x5405a8=util[_0x44fb('0x8')](_0x44fb('0x9'),_0x44fb('0xa'),_0x59aa6d[_0x44fb('0xb')]);if(_0x308b96[_0x44fb('0xc')]&&_0x308b96[_0x44fb('0xc')][_0x5405a8]&&_0x308b96[_0x44fb('0xc')][_0x5405a8][_0x44fb('0xd')]){_0x308b96[_0x44fb('0xc')][_0x5405a8][_0x44fb('0xe')]();}if(_0x308b96['agents'][_0x5405a8]){_0x308b96[_0x44fb('0xf')][_0x5405a8][_0x44fb('0x10')]({'statePause':_0x59aa6d[_0x44fb('0x11')]?!![]:![]});}_0x87f716({'code':0xc8,'message':_0x44fb('0x12')});});},'Reload':function(_0x1c1cbc){var _0x47c87b=this;return new Promise(function(_0x1fc8fa,_0xaedd7f){if(ami[_0x44fb('0x13')]()==![]){return _0xaedd7f(_0x47c87b[_0x44fb('0x14')](0x1f4,[config[_0x44fb('0x15')]['ip'],config['asterisk'][_0x44fb('0x16')],_0x44fb('0x17')][_0x44fb('0x18')]('\x20')));}_0x1c1cbc=_[_0x44fb('0x19')](_0x1c1cbc,_[_0x44fb('0x1a')](properties[_0x44fb('0x1b')]));_0x1c1cbc[_0x44fb('0x1c')]='Reload';return ami[_0x44fb('0x1d')](_0x1c1cbc)[_0x44fb('0x1e')](function(_0x2e0efd){_0x1fc8fa({'code':0xc8,'message':_0x2e0efd[_0x44fb('0x1f')]});})[_0x44fb('0x20')](function(_0x22c2eb){_0xaedd7f(_0x47c87b[_0x44fb('0x14')](0x1f5,_0x22c2eb[_0x44fb('0x1f')]));});});},'Command':function(_0x44e6de){var _0x1fc48c=this;return new Promise(function(_0x5eafcb,_0x4bd157){if(ami['isConnected']()==![]){return _0x4bd157(_0x1fc48c[_0x44fb('0x14')](0x1f4,[config[_0x44fb('0x15')]['ip'],config[_0x44fb('0x15')]['username'],_0x44fb('0x17')][_0x44fb('0x18')]('\x20')));}_0x44e6de=_[_0x44fb('0x19')](_0x44e6de,'command');_0x44e6de['action']=_0x44fb('0x21');return ami[_0x44fb('0x1d')](_0x44e6de)[_0x44fb('0x1e')](function(_0x4fc66d){_0x5eafcb({'code':0xc8,'message':_0x4fc66d[_0x44fb('0x22')]});})[_0x44fb('0x20')](function(_0x1f3d5c){_0x4bd157(_0x1fc48c['error'](0x1f5,_0x1f3d5c['message']));});});},'VoiceQueues':function(_0x105b88){return new Promise(function(_0xa50a49,_0x1c831e){var _0x733c=[];for(var _0x5e7116 in _0x308b96[_0x44fb('0x23')]){if(_0x308b96[_0x44fb('0x23')]['hasOwnProperty'](_0x5e7116)){var _0x5b6ce5=_0x308b96[_0x44fb('0x23')][_0x5e7116];var _0x2611d6={'id':_0x5b6ce5['id'],'name':_0x5b6ce5[_0x44fb('0xb')],'strategy':_0x5b6ce5[_0x44fb('0x24')],'answered':_0x5b6ce5[_0x44fb('0x25')],'available':_0x5b6ce5[_0x44fb('0x26')],'loggedIn':_0x5b6ce5[_0x44fb('0x27')],'pTalking':_0x5b6ce5[_0x44fb('0x28')],'sumBillable':_0x5b6ce5[_0x44fb('0x29')],'sumDuration':_0x5b6ce5['sumDuration'],'sumHoldTime':_0x5b6ce5['sumHoldTime']||0x0,'talking':_0x5b6ce5['talking'],'total':_0x5b6ce5[_0x44fb('0x2a')],'type':_0x5b6ce5['type'],'unmanaged':_0x5b6ce5[_0x44fb('0x2b')],'abandoned':_0x5b6ce5[_0x44fb('0x2c')],'waiting':_0x5b6ce5['waiting'],'loggedInDb':_0x5b6ce5[_0x44fb('0x2d')]};if(_0x5b6ce5[_0x44fb('0x2e')]===_0x44fb('0x2f')){_0x2611d6[_0x44fb('0x30')]=_0x5b6ce5[_0x44fb('0x30')];_0x2611d6['dialMethod']=_0x5b6ce5['dialMethod'];_0x2611d6[_0x44fb('0x31')]=_0x5b6ce5['dialOriginateCallerIdName'];_0x2611d6[_0x44fb('0x32')]=_0x5b6ce5[_0x44fb('0x32')];_0x2611d6[_0x44fb('0x33')]=_0x5b6ce5[_0x44fb('0x33')];_0x2611d6[_0x44fb('0x34')]=_0x5b6ce5[_0x44fb('0x34')];_0x2611d6[_0x44fb('0x35')]=_0x5b6ce5[_0x44fb('0x35')];_0x2611d6[_0x44fb('0x36')]=_0x5b6ce5[_0x44fb('0x36')];_0x2611d6[_0x44fb('0x37')]=_0x5b6ce5[_0x44fb('0x37')];_0x2611d6[_0x44fb('0x38')]=_0x5b6ce5[_0x44fb('0x38')];_0x2611d6[_0x44fb('0x39')]=_0x5b6ce5['outboundBusyCallsDay'];_0x2611d6['outboundCongestionCallsDay']=_0x5b6ce5['outboundCongestionCallsDay'];_0x2611d6[_0x44fb('0x3a')]=_0x5b6ce5[_0x44fb('0x3a')];_0x2611d6[_0x44fb('0x3b')]=_0x5b6ce5[_0x44fb('0x3b')];_0x2611d6['outboundDropCallsDayTimeout']=_0x5b6ce5[_0x44fb('0x3c')];_0x2611d6[_0x44fb('0x3d')]=_0x5b6ce5['outboundNoAnswerCallsDay'];_0x2611d6[_0x44fb('0x3e')]=_0x5b6ce5['outboundNoSuchCallsDay'];_0x2611d6[_0x44fb('0x3f')]=_0x5b6ce5['outboundOriginateFailureCallsDay'];_0x2611d6[_0x44fb('0x40')]=_0x5b6ce5['outboundReCallsDay'];_0x2611d6[_0x44fb('0x41')]=_0x5b6ce5['outboundRejectCallsDay'];_0x2611d6['outboundUnknownCallsDay']=_0x5b6ce5[_0x44fb('0x42')];_0x2611d6[_0x44fb('0x43')]=_0x5b6ce5[_0x44fb('0x43')];_0x2611d6[_0x44fb('0x44')]=_0x5b6ce5[_0x44fb('0x44')];_0x2611d6[_0x44fb('0x45')]=_0x5b6ce5[_0x44fb('0x45')];_0x2611d6[_0x44fb('0x46')]=_0x5b6ce5[_0x44fb('0x46')];_0x2611d6[_0x44fb('0x47')]=_0x5b6ce5['predictiveIntervalDroppedCallsTimeout'];_0x2611d6[_0x44fb('0x48')]=_0x5b6ce5[_0x44fb('0x48')];_0x2611d6[_0x44fb('0x49')]=_0x5b6ce5[_0x44fb('0x49')];_0x2611d6[_0x44fb('0x4a')]=_0x5b6ce5['predictiveIntervalHitRate'];_0x2611d6[_0x44fb('0x4b')]=_0x5b6ce5[_0x44fb('0x4b')];_0x2611d6['predictiveIntervalPauses']=_0x5b6ce5['predictiveIntervalPauses'];_0x2611d6[_0x44fb('0x4c')]=_0x5b6ce5[_0x44fb('0x4c')];_0x2611d6[_0x44fb('0x4d')]=_0x5b6ce5['predictiveIntervalTotalCalls'];_0x2611d6[_0x44fb('0x1f')]=_0x5b6ce5[_0x44fb('0x1f')];_0x2611d6[_0x44fb('0x4e')]=_0x5b6ce5[_0x44fb('0x4e')];_0x2611d6[_0x44fb('0x4f')]=_0x5b6ce5[_0x44fb('0x4f')];_0x2611d6['erlangCallToSecond']=_0x5b6ce5[_0x44fb('0x50')];_0x2611d6['erlangAbandonmentRate']=_0x5b6ce5[_0x44fb('0x51')];_0x2611d6[_0x44fb('0x52')]=_0x5b6ce5[_0x44fb('0x52')];_0x2611d6[_0x44fb('0x53')]=_0x5b6ce5['startPredictive'];_0x2611d6[_0x44fb('0x54')]=_0x5b6ce5[_0x44fb('0x54')];}if(_0x5b6ce5[_0x44fb('0x55')]){_0x2611d6[_0x44fb('0x55')]={'id':_0x5b6ce5[_0x44fb('0x55')]['id'],'name':_0x5b6ce5['Trunk'][_0x44fb('0xb')],'active':_0x5b6ce5[_0x44fb('0x55')][_0x44fb('0x56')],'callerid':_0x5b6ce5[_0x44fb('0x55')]['callerid']};}if(_0x5b6ce5['Interval']){_0x2611d6[_0x44fb('0x57')]={'id':_0x5b6ce5[_0x44fb('0x57')]['id'],'name':_0x5b6ce5['Interval'][_0x44fb('0xb')]};}_0x733c['push'](_0x2611d6);}}_0xa50a49({'count':_0x733c['length'],'rows':_0x733c});});},'UpdateVoiceQueue':function(_0x5519d9){return new Promise(function(_0x5d5317,_0x396bdc){var _0x1a7acd=_[_0x44fb('0x58')](_0x308b96[_0x44fb('0x23')],{'id':parseInt(_0x5519d9['id'])});var _0x48fc96=_[_0x44fb('0x59')](_0x5519d9,['id']);if(_0x1a7acd){for(var _0x2bf1e0 in _0x48fc96){if(typeof _0x48fc96[_0x2bf1e0]!==_0x44fb('0x5a')&&typeof _0x1a7acd[_0x2bf1e0]!==_0x44fb('0x5a')){_0x1a7acd[_0x2bf1e0]=_0x48fc96[_0x2bf1e0];}}_0x5d5317(_0x1a7acd);}else{_0x396bdc();}});},'VoiceChannels':function(_0x1b6495){return new Promise(function(_0x204d54,_0x3eb4a1){var _0x15084d=_['values'](_0x308b96[_0x44fb('0x5b')]);_0x204d54({'count':_0x15084d['length'],'rows':_0x15084d});});},'VoiceChannelMixMonitor':function(_0x484529){var _0x304a0f=this;return new Promise(function(_0x16d8c2,_0x174e33){if(ami['isConnected']()==![]){return _0x174e33(_0x304a0f[_0x44fb('0x14')](0x1f4,[config[_0x44fb('0x15')]['ip'],config[_0x44fb('0x15')][_0x44fb('0x16')],_0x44fb('0x17')][_0x44fb('0x18')]('\x20')));}var _0x24eb8a=schema(properties['voicechannel'])[_0x44fb('0x2')](_0x484529);if(_0x24eb8a['length']>0x0){return _0x174e33(_0x304a0f[_0x44fb('0x14')](0x1f4,_['map'](_0x24eb8a,_0x44fb('0x1f'))[_0x44fb('0x18')](',\x20')));}var _0xf56878=_[_0x44fb('0x58')](_0x308b96['channels'],{'uniqueid':_0x484529[_0x44fb('0x5c')]});if(_0xf56878&&_0xf56878[_0x44fb('0x5d')]){var _0x247266=util[_0x44fb('0x8')](_0x44fb('0x5e'),_0x484529[_0x44fb('0x5f')]||_0x484529[_0x44fb('0x5c')],_0x484529[_0x44fb('0x8')]||_0x44fb('0x60'));return ami[_0x44fb('0x1d')]({'action':_0x44fb('0x61'),'channel':_0xf56878[_0x44fb('0x5d')],'file':_0x247266,'options':'ai(mixmonitorid)'})[_0x44fb('0x1e')](function(_0x4d0803){var _0x13a799=_[_0x44fb('0x58')](_0xf56878['monitors'],{'filename':'/var/spool/asterisk/monitor/'+_0x247266['toLowerCase']()});if(_[_0x44fb('0x62')](_0x13a799)){_0xf56878[_0x44fb('0x63')][_0x44fb('0x64')]({'filename':_0x44fb('0x65')+_0x247266[_0x44fb('0x66')](),'createdAt':moment()[_0x44fb('0x8')](_0x44fb('0x67')),'mixmonitorid':_0x4d0803[_0x44fb('0x68')],'status':_0x44fb('0x69')});}else{_0x13a799[_0x44fb('0x68')]=_0x4d0803[_0x44fb('0x68')];_0x13a799[_0x44fb('0x6a')]=_0x44fb('0x69');}_0x16d8c2({'code':0xc8,'message':[_0x484529[_0x44fb('0x5c')],_0x44fb('0x6b'),_0x4d0803[_0x44fb('0x68')]][_0x44fb('0x18')]('\x20'),'mixmonitorid':_0x4d0803[_0x44fb('0x68')]});})[_0x44fb('0x20')](function(_0x4dfba3){_0x174e33(_0x304a0f['error'](0x1f5,[_0x484529[_0x44fb('0x5c')],_0x4dfba3['message']['toLowerCase']()]['join']('\x20')));});}else{return _0x174e33(_0x304a0f[_0x44fb('0x14')](0x1f5,_0x44fb('0x6c')));}});},'VoiceChannelStopMixMonitor':function(_0x174fcf){var _0x55f28f=this;return new Promise(function(_0x986ca,_0x5ad3af){if(ami[_0x44fb('0x13')]()==![]){return _0x5ad3af(_0x55f28f['error'](0x1f4,[config[_0x44fb('0x15')]['ip'],config[_0x44fb('0x15')][_0x44fb('0x16')],'ami\x20disconnected'][_0x44fb('0x18')]('\x20')));}var _0x14cfc4=schema(properties[_0x44fb('0x6d')])['validate'](_0x174fcf);if(_0x14cfc4[_0x44fb('0x6e')]>0x0){return _0x5ad3af(_0x55f28f[_0x44fb('0x14')](0x1f4,_[_0x44fb('0x6f')](_0x14cfc4,'message')['join'](',\x20')));}var _0x1ed4a0=_[_0x44fb('0x58')](_0x308b96[_0x44fb('0x5b')],{'uniqueid':_0x174fcf[_0x44fb('0x5c')]});if(_0x1ed4a0){return BPromise['resolve']()['then'](function(){if(_0x1ed4a0[_0x44fb('0x5d')]){return ami[_0x44fb('0x1d')]({'action':_0x44fb('0x70'),'channel':_0x1ed4a0[_0x44fb('0x5d')],'mixmonitorid':_0x174fcf[_0x44fb('0x68')]})[_0x44fb('0x20')](function(_0x5a7d27){});}})[_0x44fb('0x1e')](function(){if(_0x1ed4a0[_0x44fb('0x71')]){return ami[_0x44fb('0x1d')]({'action':_0x44fb('0x70'),'channel':_0x1ed4a0['destinationchannel'],'mixmonitorid':_0x174fcf['mixmonitorid']})[_0x44fb('0x20')](function(_0xf0c095){});}})[_0x44fb('0x1e')](function(_0x5edbb9){var _0x269270=_['find'](_0x1ed4a0[_0x44fb('0x63')],{'mixmonitorid':_0x174fcf[_0x44fb('0x68')]});if(_0x269270){_0x269270[_0x44fb('0x6a')]=_0x44fb('0x72');}})[_0x44fb('0x1e')](function(){var _0x4796b1=util[_0x44fb('0x8')](_0x44fb('0x5e'),_0x174fcf[_0x44fb('0x5f')]||_0x174fcf[_0x44fb('0x5c')],_0x174fcf['format']||_0x44fb('0x60'));var _0x26a86e=_[_0x44fb('0x58')](_0x1ed4a0[_0x44fb('0x63')],{'filename':_0x44fb('0x65')+_0x4796b1[_0x44fb('0x66')]()});if(_0x26a86e){_0x26a86e[_0x44fb('0x6a')]=_0x44fb('0x72');}})[_0x44fb('0x1e')](function(){_0x986ca({'code':0xc8,'message':[_0x174fcf[_0x44fb('0x5c')],_0x44fb('0x73')][_0x44fb('0x18')]('\x20')});})[_0x44fb('0x20')](function(_0x2cb5c5){_0x5ad3af(_0x55f28f[_0x44fb('0x14')](0x1f5,[_0x174fcf[_0x44fb('0x5c')],_0x2cb5c5[_0x44fb('0x1f')][_0x44fb('0x66')]()][_0x44fb('0x18')]('\x20')));});}else{return _0x5ad3af(_0x55f28f['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0x3d51db){return new Promise(function(_0x3cc62c,_0x3781a9){var _0x1feabd=_[_0x44fb('0x74')](_0x308b96[_0x44fb('0x75')]);_0x3cc62c({'count':_0x1feabd['length'],'rows':_0x1feabd});});},'VoiceQueuesChannel':function(_0x56e968){var _0x40a471=this;return new Promise(function(_0x443b6b,_0x149e96){var _0x25d64f=schema(properties['voicequeuechannel'])[_0x44fb('0x2')](_0x56e968);if(_0x25d64f[_0x44fb('0x6e')]>0x0){return _0x149e96(_0x40a471[_0x44fb('0x14')](0x1f4,_[_0x44fb('0x6f')](_0x25d64f,_0x44fb('0x1f'))[_0x44fb('0x18')](',\x20')));}var _0xf77a1a=_[_0x44fb('0x58')](_0x308b96[_0x44fb('0x75')],{'uniqueid':_0x56e968[_0x44fb('0x5c')]});if(_0xf77a1a){_0x443b6b(_0xf77a1a);}else{return _0x149e96(_0x40a471['error'](0x1f5,_0x44fb('0x6c')));}});},'VoiceQueuesChannelHangup':function(_0x2d1bb9){var _0x5b9ba8=this;return new Promise(function(_0x4395ae,_0x443e66){if(ami['isConnected']()==![]){return _0x443e66(_0x5b9ba8[_0x44fb('0x14')](0x1f4,[config[_0x44fb('0x15')]['ip'],config[_0x44fb('0x15')]['username'],'ami\x20disconnected']['join']('\x20')));}var _0x1e506a=schema(properties[_0x44fb('0x76')])[_0x44fb('0x2')](_0x2d1bb9);if(_0x1e506a[_0x44fb('0x6e')]>0x0){return _0x443e66(_0x5b9ba8[_0x44fb('0x14')](0x1f4,_[_0x44fb('0x6f')](_0x1e506a,_0x44fb('0x1f'))[_0x44fb('0x18')](',\x20')));}var _0x55905f=_[_0x44fb('0x58')](_0x308b96[_0x44fb('0x75')],{'uniqueid':_0x2d1bb9[_0x44fb('0x5c')]});if(_0x55905f&&_0x55905f[_0x44fb('0x5d')]){return ami[_0x44fb('0x1d')]({'action':'Hangup','channel':_0x55905f[_0x44fb('0x5d')]})[_0x44fb('0x1e')](function(_0x31d02d){_0x4395ae({'code':0xc8,'message':[_0x2d1bb9['uniqueid'],_0x31d02d[_0x44fb('0x1f')][_0x44fb('0x66')]()][_0x44fb('0x18')]('\x20')});})[_0x44fb('0x20')](function(_0xcc7787){_0x443e66(_0x5b9ba8[_0x44fb('0x14')](0x1f5,[_0x2d1bb9[_0x44fb('0x5c')],_0xcc7787[_0x44fb('0x1f')][_0x44fb('0x66')]()][_0x44fb('0x18')]('\x20')));});}else{return _0x443e66(_0x5b9ba8[_0x44fb('0x14')](0x1f5,_0x44fb('0x6c')));}});},'VoiceQueuesChannelRedirect':function(_0x3d1f34){var _0x650ea9=this;return new Promise(function(_0x5aef90,_0x45045e){if(ami[_0x44fb('0x13')]()==![]){return _0x45045e(_0x650ea9[_0x44fb('0x14')](0x1f4,[config[_0x44fb('0x15')]['ip'],config[_0x44fb('0x15')][_0x44fb('0x16')],_0x44fb('0x17')][_0x44fb('0x18')]('\x20')));}var _0x34268f=schema(properties['voicequeuechannelredirect'])[_0x44fb('0x2')](_0x3d1f34);if(_0x34268f['length']>0x0){return _0x45045e(_0x650ea9[_0x44fb('0x14')](0x1f4,_[_0x44fb('0x6f')](_0x34268f,'message')['join'](',\x20')));}var _0x358042=_[_0x44fb('0x58')](_0x308b96['queueChannels'],{'uniqueid':_0x3d1f34[_0x44fb('0x5c')]});if(_0x358042&&_0x358042['channel']){return ami['Action']({'action':_0x44fb('0x77'),'channel':_0x358042[_0x44fb('0x5d')],'exten':_0x3d1f34[_0x44fb('0x78')],'context':_0x3d1f34[_0x44fb('0x79')]||_0x358042[_0x44fb('0x79')],'priority':0x1})['then'](function(_0x57191f){_0x5aef90({'code':0xc8,'message':[_0x3d1f34['uniqueid'],_0x57191f[_0x44fb('0x1f')][_0x44fb('0x66')]()][_0x44fb('0x18')]('\x20')});})[_0x44fb('0x20')](function(_0x2be4c5){_0x45045e(_0x650ea9[_0x44fb('0x14')](0x1f5,[_0x3d1f34[_0x44fb('0x5c')],_0x2be4c5[_0x44fb('0x1f')][_0x44fb('0x66')]()][_0x44fb('0x18')]('\x20')));});}else{return _0x45045e(_0x650ea9[_0x44fb('0x14')](0x1f5,_0x44fb('0x6c')));}});},'Agents':function(_0xf37376){return new Promise(function(_0x26c134,_0x55f5c8){var _0x8b4613=_['values'](_0x308b96[_0x44fb('0xf')]);_0x26c134({'count':_0x8b4613[_0x44fb('0x6e')],'rows':_0x8b4613});});},'Telephones':function(_0x5e1c14){return new Promise(function(_0x1792e7,_0x152963){var _0x2b5583=_[_0x44fb('0x74')](_0x308b96['telephones']);_0x1792e7({'count':_0x2b5583['length'],'rows':_0x2b5583});});},'Trunks':function(_0x173b35){return new Promise(function(_0x385c6b,_0x4a88bd){var _0x399142=_[_0x44fb('0x74')](_0x308b96[_0x44fb('0x7a')]);_0x385c6b({'count':_0x399142[_0x44fb('0x6e')],'rows':_0x399142});});},'OutboundChannels':function(_0x3fac48){return new Promise(function(_0x37db10,_0x1e7329){var _0x4f5c7f=_['values'](_0x308b96['outboundChannels']);_0x37db10({'count':_0x4f5c7f[_0x44fb('0x6e')],'rows':_0x4f5c7f});});},'Outbound':function(_0x4fd096){return new Promise(function(_0x385e5e,_0x2f677f){_0x385e5e(_0x308b96[_0x44fb('0x2f')]);});},'Campaigns':function(_0x15c6ee){return new Promise(function(_0x1294c1,_0x55a021){var _0x498fff=_['values'](_0x308b96[_0x44fb('0x7b')]);_0x1294c1({'count':_0x498fff[_0x44fb('0x6e')],'rows':_0x498fff});});},'VoiceQueuesPreview':function(_0x5ee6e1){var _0x268197=this;return new Promise(function(_0x55be2f,_0x4e7074){_0x26fbd6[_0x44fb('0x7c')](_0x5ee6e1['id'])[_0x44fb('0x1e')](function(_0x4c4843){_0x55be2f({'code':0xc8,'message':_0x4c4843[_0x44fb('0x1f')]});})[_0x44fb('0x20')](function(_0x214496){_0x4e7074(_0x268197[_0x44fb('0x14')](0x1f4,_0x214496['message']));});});},'EventManager':function(_0x20a3ec){var _0x35b928=this;return new Promise(function(_0x145f21,_0x11f460){if(!_0x20a3ec[_0x44fb('0x7d')]){return _0x11f460(_0x35b928[_0x44fb('0x14')](0x1f4,_0x44fb('0x7e')));}ami[_0x44fb('0x7f')](_0x44fb('0x80')+_0x20a3ec[_0x44fb('0x7d')],_0x20a3ec[_0x44fb('0x1f')]);_0x145f21({'code':0xc8,'message':_0x20a3ec});});},'FaxAccounts':function(_0x127bec){return new Promise(function(_0x10c4c9,_0x172fba){var _0x167293=_[_0x44fb('0x74')](_0x308b96[_0x44fb('0x81')]);_0x10c4c9({'count':_0x167293['length'],'rows':_0x167293});});},'SendFax':function(_0x3607a7){var _0x4bf099=this;return new Promise(function(_0x50f5bd,_0x215272){_0x375d33[_0x44fb('0x82')](_0x3607a7)[_0x44fb('0x1e')](function(_0x5a6ac3){_0x50f5bd({'code':0xc8,'message':_0x5a6ac3[_0x44fb('0x1f')]});})[_0x44fb('0x20')](function(_0x2a7f1a){_0x215272(_0x4bf099[_0x44fb('0x14')](0x1f4,_0x2a7f1a[_0x44fb('0x1f')]));});});},'CheckAfterSend':function(_0x158bfd){var _0x37aa8c=this;return new Promise(function(_0x45f8d3,_0x190e04){_0x375d33['checkAfterSend'](_0x158bfd)[_0x44fb('0x1e')](function(_0x41726c){_0x45f8d3({'code':0xc8,'message':_0x41726c['message']});})[_0x44fb('0x20')](function(_0x1a0c70){_0x190e04(_0x37aa8c[_0x44fb('0x14')](0x1f4,_0x1a0c70['message']));});});}};var _0x404e4a=jayson[_0x44fb('0x83')](_0x2a4d75)[_0x44fb('0x84')]();_0x404e4a['on'](_0x44fb('0x14'),function(_0x2257be){return _0x464af5(_0x2257be);});_0x404e4a[_0x44fb('0x7')](0x232a,_0x44fb('0x85'),function(){console[_0x44fb('0x86')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x173e70(_0x44fb('0x87')+0x232a);});});}; \ No newline at end of file +var _0xdbb1=['asterisk','username','join','pick','keys','action','Reload','then','message','catch','ami\x20disconnected','command','Command','Action','content','voiceQueues','strategy','answered','loggedIn','pTalking','sumBillable','talking','unmanaged','abandoned','waiting','loggedInDb','type','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','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','Interval','push','omit','undefined','values','length','voicechannel','validate','map','channels','uniqueid','channel','format','%s.%s','filename','wav','MixMonitor','ai(mixmonitorid)','find','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','stop','StopMixMonitor\x20Success','queueChannels','voicequeuechannel','voicequeuechannelhangup','Hangup','Redirect','exten','context','telephones','outboundChannels','campaigns','event','Event\x20name\x20mandatory','emit','send','checkAfterSend','server','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','bluebird','../properties','listen','%s/%s','SIP','name','timers','timer','updateAcw','agents','pause','QueuePause','isConnected','error'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xdbb1,0x105));var _0x1dbb=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0xdbb1[_0x5f09c5];return _0x426ad9;};'use strict';var _=require(_0x1dbb('0x0'));var util=require('util');var jayson=require('jayson/promise');var schema=require('validate');var BPromise=require(_0x1dbb('0x1'));var moment=require('moment');var config=require('../../../config/environment');var properties=require(_0x1dbb('0x2'));var ami=require('../ami');exports[_0x1dbb('0x3')]=function(_0xd53e45,_0x550e25,_0x55df0f){return new BPromise(function(_0xd43ce8,_0x38259d){var _0x2070a8={'QueuePause':function(_0x7c2269){return new Promise(function(_0x5e622c,_0x3ffb54){var _0xf42424=util['format'](_0x1dbb('0x4'),_0x1dbb('0x5'),_0x7c2269[_0x1dbb('0x6')]);if(_0xd53e45[_0x1dbb('0x7')]&&_0xd53e45[_0x1dbb('0x7')][_0xf42424]&&_0xd53e45[_0x1dbb('0x7')][_0xf42424][_0x1dbb('0x8')]){_0xd53e45[_0x1dbb('0x7')][_0xf42424][_0x1dbb('0x9')]();}if(_0xd53e45[_0x1dbb('0xa')][_0xf42424]){_0xd53e45[_0x1dbb('0xa')][_0xf42424]['updateStatusRealtime']({'statePause':_0x7c2269[_0x1dbb('0xb')]?!![]:![]});}_0x5e622c({'code':0xc8,'message':_0x1dbb('0xc')});});},'Reload':function(_0x332380){var _0xd3fea1=this;return new Promise(function(_0x539f2c,_0x506db4){if(ami[_0x1dbb('0xd')]()==![]){return _0x506db4(_0xd3fea1[_0x1dbb('0xe')](0x1f4,[config[_0x1dbb('0xf')]['ip'],config[_0x1dbb('0xf')][_0x1dbb('0x10')],'ami\x20disconnected'][_0x1dbb('0x11')]('\x20')));}_0x332380=_[_0x1dbb('0x12')](_0x332380,_[_0x1dbb('0x13')](properties['module']));_0x332380[_0x1dbb('0x14')]=_0x1dbb('0x15');return ami['Action'](_0x332380)[_0x1dbb('0x16')](function(_0x376daa){_0x539f2c({'code':0xc8,'message':_0x376daa[_0x1dbb('0x17')]});})[_0x1dbb('0x18')](function(_0xb21bc5){_0x506db4(_0xd3fea1[_0x1dbb('0xe')](0x1f5,_0xb21bc5[_0x1dbb('0x17')]));});});},'Command':function(_0x239082){var _0x58aa43=this;return new Promise(function(_0x550dd4,_0x4802ba){if(ami[_0x1dbb('0xd')]()==![]){return _0x4802ba(_0x58aa43[_0x1dbb('0xe')](0x1f4,[config['asterisk']['ip'],config[_0x1dbb('0xf')][_0x1dbb('0x10')],_0x1dbb('0x19')][_0x1dbb('0x11')]('\x20')));}_0x239082=_[_0x1dbb('0x12')](_0x239082,_0x1dbb('0x1a'));_0x239082[_0x1dbb('0x14')]=_0x1dbb('0x1b');return ami[_0x1dbb('0x1c')](_0x239082)[_0x1dbb('0x16')](function(_0x2a2458){_0x550dd4({'code':0xc8,'message':_0x2a2458[_0x1dbb('0x1d')]});})[_0x1dbb('0x18')](function(_0x429253){_0x4802ba(_0x58aa43[_0x1dbb('0xe')](0x1f5,_0x429253[_0x1dbb('0x17')]));});});},'VoiceQueues':function(_0x2945ec){return new Promise(function(_0xc33a9f,_0x18f188){var _0x57a9f0=[];for(var _0x44eff7 in _0xd53e45['voiceQueues']){if(_0xd53e45[_0x1dbb('0x1e')]['hasOwnProperty'](_0x44eff7)){var _0x72cfed=_0xd53e45[_0x1dbb('0x1e')][_0x44eff7];var _0x346372={'id':_0x72cfed['id'],'name':_0x72cfed[_0x1dbb('0x6')],'strategy':_0x72cfed[_0x1dbb('0x1f')],'answered':_0x72cfed[_0x1dbb('0x20')],'available':_0x72cfed['available'],'loggedIn':_0x72cfed[_0x1dbb('0x21')],'pTalking':_0x72cfed[_0x1dbb('0x22')],'sumBillable':_0x72cfed[_0x1dbb('0x23')],'sumDuration':_0x72cfed['sumDuration'],'sumHoldTime':_0x72cfed['sumHoldTime']||0x0,'talking':_0x72cfed[_0x1dbb('0x24')],'total':_0x72cfed['total'],'type':_0x72cfed['type'],'unmanaged':_0x72cfed[_0x1dbb('0x25')],'abandoned':_0x72cfed[_0x1dbb('0x26')],'waiting':_0x72cfed[_0x1dbb('0x27')],'loggedInDb':_0x72cfed[_0x1dbb('0x28')]};if(_0x72cfed[_0x1dbb('0x29')]===_0x1dbb('0x2a')){_0x346372[_0x1dbb('0x2b')]=_0x72cfed[_0x1dbb('0x2b')];_0x346372[_0x1dbb('0x2c')]=_0x72cfed['dialMethod'];_0x346372['dialOriginateCallerIdName']=_0x72cfed[_0x1dbb('0x2d')];_0x346372[_0x1dbb('0x2e')]=_0x72cfed[_0x1dbb('0x2e')];_0x346372['dialOriginateTimeout']=_0x72cfed['dialOriginateTimeout'];_0x346372[_0x1dbb('0x2f')]=_0x72cfed[_0x1dbb('0x2f')];_0x346372[_0x1dbb('0x30')]=_0x72cfed['temp'];_0x346372['outboundAnswerAgiCallsDay']=_0x72cfed[_0x1dbb('0x31')];_0x346372[_0x1dbb('0x32')]=_0x72cfed['outboundAnswerCallsDay'];_0x346372[_0x1dbb('0x33')]=_0x72cfed[_0x1dbb('0x33')];_0x346372[_0x1dbb('0x34')]=_0x72cfed[_0x1dbb('0x34')];_0x346372['outboundCongestionCallsDay']=_0x72cfed[_0x1dbb('0x35')];_0x346372[_0x1dbb('0x36')]=_0x72cfed[_0x1dbb('0x36')];_0x346372[_0x1dbb('0x37')]=_0x72cfed[_0x1dbb('0x37')];_0x346372[_0x1dbb('0x38')]=_0x72cfed['outboundDropCallsDayTimeout'];_0x346372[_0x1dbb('0x39')]=_0x72cfed[_0x1dbb('0x39')];_0x346372['outboundNoSuchCallsDay']=_0x72cfed[_0x1dbb('0x3a')];_0x346372[_0x1dbb('0x3b')]=_0x72cfed[_0x1dbb('0x3b')];_0x346372[_0x1dbb('0x3c')]=_0x72cfed[_0x1dbb('0x3c')];_0x346372['outboundRejectCallsDay']=_0x72cfed[_0x1dbb('0x3d')];_0x346372[_0x1dbb('0x3e')]=_0x72cfed[_0x1dbb('0x3e')];_0x346372[_0x1dbb('0x3f')]=_0x72cfed[_0x1dbb('0x3f')];_0x346372[_0x1dbb('0x40')]=_0x72cfed['predictiveIntervalAvgHoldtime'];_0x346372[_0x1dbb('0x41')]=_0x72cfed[_0x1dbb('0x41')];_0x346372['predictiveIntervalDroppedCallsCallersExit']=_0x72cfed[_0x1dbb('0x42')];_0x346372[_0x1dbb('0x43')]=_0x72cfed[_0x1dbb('0x43')];_0x346372[_0x1dbb('0x44')]=_0x72cfed[_0x1dbb('0x44')];_0x346372[_0x1dbb('0x45')]=_0x72cfed[_0x1dbb('0x45')];_0x346372[_0x1dbb('0x46')]=_0x72cfed[_0x1dbb('0x46')];_0x346372[_0x1dbb('0x47')]=_0x72cfed[_0x1dbb('0x47')];_0x346372[_0x1dbb('0x48')]=_0x72cfed[_0x1dbb('0x48')];_0x346372['predictiveIntervalAvailable']=_0x72cfed[_0x1dbb('0x49')];_0x346372[_0x1dbb('0x4a')]=_0x72cfed[_0x1dbb('0x4a')];_0x346372[_0x1dbb('0x17')]=_0x72cfed[_0x1dbb('0x17')];_0x346372[_0x1dbb('0x4b')]=_0x72cfed[_0x1dbb('0x4b')];_0x346372[_0x1dbb('0x4c')]=_0x72cfed[_0x1dbb('0x4c')];_0x346372[_0x1dbb('0x4d')]=_0x72cfed[_0x1dbb('0x4d')];_0x346372[_0x1dbb('0x4e')]=_0x72cfed[_0x1dbb('0x4e')];_0x346372['erlangBusyFactor']=_0x72cfed[_0x1dbb('0x4f')];_0x346372[_0x1dbb('0x50')]=_0x72cfed[_0x1dbb('0x50')];_0x346372[_0x1dbb('0x51')]=_0x72cfed['startProgressive'];}if(_0x72cfed[_0x1dbb('0x52')]){_0x346372[_0x1dbb('0x52')]={'id':_0x72cfed[_0x1dbb('0x52')]['id'],'name':_0x72cfed[_0x1dbb('0x52')][_0x1dbb('0x6')],'active':_0x72cfed[_0x1dbb('0x52')][_0x1dbb('0x53')],'callerid':_0x72cfed[_0x1dbb('0x52')]['callerid']};}if(_0x72cfed[_0x1dbb('0x54')]){_0x346372[_0x1dbb('0x54')]={'id':_0x72cfed[_0x1dbb('0x54')]['id'],'name':_0x72cfed[_0x1dbb('0x54')][_0x1dbb('0x6')]};}_0x57a9f0[_0x1dbb('0x55')](_0x346372);}}_0xc33a9f({'count':_0x57a9f0['length'],'rows':_0x57a9f0});});},'UpdateVoiceQueue':function(_0x4541bc){return new Promise(function(_0x4a8507,_0x11ae4c){var _0xa2942d=_['find'](_0xd53e45[_0x1dbb('0x1e')],{'id':parseInt(_0x4541bc['id'])});var _0x4349a6=_[_0x1dbb('0x56')](_0x4541bc,['id']);if(_0xa2942d){for(var _0x13972d in _0x4349a6){if(typeof _0x4349a6[_0x13972d]!==_0x1dbb('0x57')&&typeof _0xa2942d[_0x13972d]!=='undefined'){_0xa2942d[_0x13972d]=_0x4349a6[_0x13972d];}}_0x4a8507(_0xa2942d);}else{_0x11ae4c();}});},'VoiceChannels':function(_0x3ac569){return new Promise(function(_0x163437,_0x1406a4){var _0x436b78=_[_0x1dbb('0x58')](_0xd53e45['channels']);_0x163437({'count':_0x436b78[_0x1dbb('0x59')],'rows':_0x436b78});});},'VoiceChannelMixMonitor':function(_0x520fe4){var _0x5bad3f=this;return new Promise(function(_0x1273a0,_0x5dd627){if(ami[_0x1dbb('0xd')]()==![]){return _0x5dd627(_0x5bad3f[_0x1dbb('0xe')](0x1f4,[config[_0x1dbb('0xf')]['ip'],config[_0x1dbb('0xf')][_0x1dbb('0x10')],_0x1dbb('0x19')]['join']('\x20')));}var _0x16cf4f=schema(properties[_0x1dbb('0x5a')])[_0x1dbb('0x5b')](_0x520fe4);if(_0x16cf4f[_0x1dbb('0x59')]>0x0){return _0x5dd627(_0x5bad3f[_0x1dbb('0xe')](0x1f4,_[_0x1dbb('0x5c')](_0x16cf4f,'message')['join'](',\x20')));}var _0xc071cc=_['find'](_0xd53e45[_0x1dbb('0x5d')],{'uniqueid':_0x520fe4[_0x1dbb('0x5e')]});if(_0xc071cc&&_0xc071cc[_0x1dbb('0x5f')]){var _0x4c3b99=util[_0x1dbb('0x60')](_0x1dbb('0x61'),_0x520fe4[_0x1dbb('0x62')]||_0x520fe4[_0x1dbb('0x5e')],_0x520fe4['format']||_0x1dbb('0x63'));return ami[_0x1dbb('0x1c')]({'action':_0x1dbb('0x64'),'channel':_0xc071cc[_0x1dbb('0x5f')],'file':_0x4c3b99,'options':_0x1dbb('0x65')})[_0x1dbb('0x16')](function(_0x191a13){var _0x7a64a3=_[_0x1dbb('0x66')](_0xc071cc[_0x1dbb('0x67')],{'filename':_0x1dbb('0x68')+_0x4c3b99[_0x1dbb('0x69')]()});if(_[_0x1dbb('0x6a')](_0x7a64a3)){_0xc071cc[_0x1dbb('0x67')]['push']({'filename':'/var/spool/asterisk/monitor/'+_0x4c3b99[_0x1dbb('0x69')](),'createdAt':moment()['format'](_0x1dbb('0x6b')),'mixmonitorid':_0x191a13[_0x1dbb('0x6c')],'status':_0x1dbb('0x6d')});}else{_0x7a64a3[_0x1dbb('0x6c')]=_0x191a13[_0x1dbb('0x6c')];_0x7a64a3[_0x1dbb('0x6e')]=_0x1dbb('0x6d');}_0x1273a0({'code':0xc8,'message':[_0x520fe4[_0x1dbb('0x5e')],_0x1dbb('0x6f'),_0x191a13[_0x1dbb('0x6c')]][_0x1dbb('0x11')]('\x20'),'mixmonitorid':_0x191a13['mixmonitorid']});})[_0x1dbb('0x18')](function(_0x46b18e){_0x5dd627(_0x5bad3f['error'](0x1f5,[_0x520fe4[_0x1dbb('0x5e')],_0x46b18e[_0x1dbb('0x17')][_0x1dbb('0x69')]()]['join']('\x20')));});}else{return _0x5dd627(_0x5bad3f[_0x1dbb('0xe')](0x1f5,_0x1dbb('0x70')));}});},'VoiceChannelStopMixMonitor':function(_0x1d8594){var _0xeb117b=this;return new Promise(function(_0x453726,_0x18ecbc){if(ami[_0x1dbb('0xd')]()==![]){return _0x18ecbc(_0xeb117b[_0x1dbb('0xe')](0x1f4,[config[_0x1dbb('0xf')]['ip'],config[_0x1dbb('0xf')][_0x1dbb('0x10')],_0x1dbb('0x19')][_0x1dbb('0x11')]('\x20')));}var _0x1fd605=schema(properties[_0x1dbb('0x5a')])[_0x1dbb('0x5b')](_0x1d8594);if(_0x1fd605[_0x1dbb('0x59')]>0x0){return _0x18ecbc(_0xeb117b['error'](0x1f4,_[_0x1dbb('0x5c')](_0x1fd605,_0x1dbb('0x17'))[_0x1dbb('0x11')](',\x20')));}var _0x1d8b95=_[_0x1dbb('0x66')](_0xd53e45[_0x1dbb('0x5d')],{'uniqueid':_0x1d8594[_0x1dbb('0x5e')]});if(_0x1d8b95){return BPromise[_0x1dbb('0x71')]()[_0x1dbb('0x16')](function(){if(_0x1d8b95[_0x1dbb('0x5f')]){return ami[_0x1dbb('0x1c')]({'action':'StopMixMonitor','channel':_0x1d8b95['channel'],'mixmonitorid':_0x1d8594[_0x1dbb('0x6c')]})[_0x1dbb('0x18')](function(_0x341b1b){});}})[_0x1dbb('0x16')](function(){if(_0x1d8b95['destinationchannel']){return ami['Action']({'action':_0x1dbb('0x72'),'channel':_0x1d8b95[_0x1dbb('0x73')],'mixmonitorid':_0x1d8594[_0x1dbb('0x6c')]})[_0x1dbb('0x18')](function(_0x2e42dc){});}})[_0x1dbb('0x16')](function(_0x2b2746){var _0x5b7de7=_[_0x1dbb('0x66')](_0x1d8b95[_0x1dbb('0x67')],{'mixmonitorid':_0x1d8594[_0x1dbb('0x6c')]});if(_0x5b7de7){_0x5b7de7[_0x1dbb('0x6e')]='stop';}})[_0x1dbb('0x16')](function(){var _0x7e4e28=util[_0x1dbb('0x60')](_0x1dbb('0x61'),_0x1d8594[_0x1dbb('0x62')]||_0x1d8594[_0x1dbb('0x5e')],_0x1d8594[_0x1dbb('0x60')]||_0x1dbb('0x63'));var _0x30a6ef=_['find'](_0x1d8b95[_0x1dbb('0x67')],{'filename':_0x1dbb('0x68')+_0x7e4e28[_0x1dbb('0x69')]()});if(_0x30a6ef){_0x30a6ef[_0x1dbb('0x6e')]=_0x1dbb('0x74');}})['then'](function(){_0x453726({'code':0xc8,'message':[_0x1d8594[_0x1dbb('0x5e')],_0x1dbb('0x75')]['join']('\x20')});})[_0x1dbb('0x18')](function(_0x2c4a2e){_0x18ecbc(_0xeb117b[_0x1dbb('0xe')](0x1f5,[_0x1d8594[_0x1dbb('0x5e')],_0x2c4a2e[_0x1dbb('0x17')][_0x1dbb('0x69')]()][_0x1dbb('0x11')]('\x20')));});}else{return _0x18ecbc(_0xeb117b['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0xaa3950){return new Promise(function(_0x30d7dc,_0x16fd57){var _0x44d430=_[_0x1dbb('0x58')](_0xd53e45[_0x1dbb('0x76')]);_0x30d7dc({'count':_0x44d430['length'],'rows':_0x44d430});});},'VoiceQueuesChannel':function(_0x3d62d9){var _0x51999d=this;return new Promise(function(_0x5a2713,_0x2d8e37){var _0x3aac00=schema(properties[_0x1dbb('0x77')])[_0x1dbb('0x5b')](_0x3d62d9);if(_0x3aac00[_0x1dbb('0x59')]>0x0){return _0x2d8e37(_0x51999d[_0x1dbb('0xe')](0x1f4,_[_0x1dbb('0x5c')](_0x3aac00,_0x1dbb('0x17'))['join'](',\x20')));}var _0x2bf585=_[_0x1dbb('0x66')](_0xd53e45[_0x1dbb('0x76')],{'uniqueid':_0x3d62d9[_0x1dbb('0x5e')]});if(_0x2bf585){_0x5a2713(_0x2bf585);}else{return _0x2d8e37(_0x51999d['error'](0x1f5,_0x1dbb('0x70')));}});},'VoiceQueuesChannelHangup':function(_0x5f1076){var _0x44bf98=this;return new Promise(function(_0x44549d,_0x5e0bbd){if(ami[_0x1dbb('0xd')]()==![]){return _0x5e0bbd(_0x44bf98[_0x1dbb('0xe')](0x1f4,[config[_0x1dbb('0xf')]['ip'],config[_0x1dbb('0xf')][_0x1dbb('0x10')],'ami\x20disconnected'][_0x1dbb('0x11')]('\x20')));}var _0x2752c1=schema(properties[_0x1dbb('0x78')])[_0x1dbb('0x5b')](_0x5f1076);if(_0x2752c1[_0x1dbb('0x59')]>0x0){return _0x5e0bbd(_0x44bf98[_0x1dbb('0xe')](0x1f4,_['map'](_0x2752c1,_0x1dbb('0x17'))['join'](',\x20')));}var _0x520f45=_[_0x1dbb('0x66')](_0xd53e45['queueChannels'],{'uniqueid':_0x5f1076[_0x1dbb('0x5e')]});if(_0x520f45&&_0x520f45[_0x1dbb('0x5f')]){return ami[_0x1dbb('0x1c')]({'action':_0x1dbb('0x79'),'channel':_0x520f45[_0x1dbb('0x5f')]})[_0x1dbb('0x16')](function(_0x4f60b4){_0x44549d({'code':0xc8,'message':[_0x5f1076[_0x1dbb('0x5e')],_0x4f60b4[_0x1dbb('0x17')][_0x1dbb('0x69')]()][_0x1dbb('0x11')]('\x20')});})[_0x1dbb('0x18')](function(_0x59d7c3){_0x5e0bbd(_0x44bf98['error'](0x1f5,[_0x5f1076[_0x1dbb('0x5e')],_0x59d7c3[_0x1dbb('0x17')]['toLowerCase']()][_0x1dbb('0x11')]('\x20')));});}else{return _0x5e0bbd(_0x44bf98[_0x1dbb('0xe')](0x1f5,_0x1dbb('0x70')));}});},'VoiceQueuesChannelRedirect':function(_0x541051){var _0x57f8c5=this;return new Promise(function(_0x2968f5,_0x29be95){if(ami[_0x1dbb('0xd')]()==![]){return _0x29be95(_0x57f8c5[_0x1dbb('0xe')](0x1f4,[config[_0x1dbb('0xf')]['ip'],config[_0x1dbb('0xf')][_0x1dbb('0x10')],_0x1dbb('0x19')][_0x1dbb('0x11')]('\x20')));}var _0x986f4f=schema(properties['voicequeuechannelredirect'])[_0x1dbb('0x5b')](_0x541051);if(_0x986f4f[_0x1dbb('0x59')]>0x0){return _0x29be95(_0x57f8c5[_0x1dbb('0xe')](0x1f4,_[_0x1dbb('0x5c')](_0x986f4f,_0x1dbb('0x17'))[_0x1dbb('0x11')](',\x20')));}var _0x2c6b00=_[_0x1dbb('0x66')](_0xd53e45[_0x1dbb('0x76')],{'uniqueid':_0x541051['uniqueid']});if(_0x2c6b00&&_0x2c6b00[_0x1dbb('0x5f')]){return ami['Action']({'action':_0x1dbb('0x7a'),'channel':_0x2c6b00['channel'],'exten':_0x541051[_0x1dbb('0x7b')],'context':_0x541051[_0x1dbb('0x7c')]||_0x2c6b00['context'],'priority':0x1})[_0x1dbb('0x16')](function(_0x1232ce){_0x2968f5({'code':0xc8,'message':[_0x541051[_0x1dbb('0x5e')],_0x1232ce[_0x1dbb('0x17')][_0x1dbb('0x69')]()]['join']('\x20')});})[_0x1dbb('0x18')](function(_0x3a2536){_0x29be95(_0x57f8c5[_0x1dbb('0xe')](0x1f5,[_0x541051[_0x1dbb('0x5e')],_0x3a2536[_0x1dbb('0x17')][_0x1dbb('0x69')]()]['join']('\x20')));});}else{return _0x29be95(_0x57f8c5[_0x1dbb('0xe')](0x1f5,_0x1dbb('0x70')));}});},'Agents':function(_0x2939a0){return new Promise(function(_0x471573,_0x5a5cb5){var _0x23b2aa=_[_0x1dbb('0x58')](_0xd53e45[_0x1dbb('0xa')]);_0x471573({'count':_0x23b2aa[_0x1dbb('0x59')],'rows':_0x23b2aa});});},'Telephones':function(_0x20b43a){return new Promise(function(_0x3e9bba,_0xec8c13){var _0x3e22a7=_[_0x1dbb('0x58')](_0xd53e45[_0x1dbb('0x7d')]);_0x3e9bba({'count':_0x3e22a7[_0x1dbb('0x59')],'rows':_0x3e22a7});});},'Trunks':function(_0x3e0274){return new Promise(function(_0x5eb878,_0x2e3fd8){var _0x3270de=_[_0x1dbb('0x58')](_0xd53e45['trunks']);_0x5eb878({'count':_0x3270de[_0x1dbb('0x59')],'rows':_0x3270de});});},'OutboundChannels':function(_0x36ada9){return new Promise(function(_0x298141,_0x5339d9){var _0x5264ef=_[_0x1dbb('0x58')](_0xd53e45[_0x1dbb('0x7e')]);_0x298141({'count':_0x5264ef[_0x1dbb('0x59')],'rows':_0x5264ef});});},'Outbound':function(_0x6bb668){return new Promise(function(_0x34d856,_0x49274e){_0x34d856(_0xd53e45[_0x1dbb('0x2a')]);});},'Campaigns':function(_0x1cd71c){return new Promise(function(_0x24921d,_0x43ee89){var _0x492c33=_[_0x1dbb('0x58')](_0xd53e45[_0x1dbb('0x7f')]);_0x24921d({'count':_0x492c33[_0x1dbb('0x59')],'rows':_0x492c33});});},'VoiceQueuesPreview':function(_0x24dca8){var _0x373ee8=this;return new Promise(function(_0x3c0dc4,_0x5d3fe4){_0x550e25['run'](_0x24dca8['id'])[_0x1dbb('0x16')](function(_0x1c459e){_0x3c0dc4({'code':0xc8,'message':_0x1c459e[_0x1dbb('0x17')]});})[_0x1dbb('0x18')](function(_0x44fd09){_0x5d3fe4(_0x373ee8[_0x1dbb('0xe')](0x1f4,_0x44fd09['message']));});});},'EventManager':function(_0x52e5b0){var _0x21db27=this;return new Promise(function(_0xc01d4c,_0x43a488){if(!_0x52e5b0[_0x1dbb('0x80')]){return _0x43a488(_0x21db27['error'](0x1f4,_0x1dbb('0x81')));}ami[_0x1dbb('0x82')]('custom:'+_0x52e5b0[_0x1dbb('0x80')],_0x52e5b0[_0x1dbb('0x17')]);_0xc01d4c({'code':0xc8,'message':_0x52e5b0});});},'FaxAccounts':function(_0x4cac08){return new Promise(function(_0x52bb25,_0x3c4d97){var _0x311d6d=_[_0x1dbb('0x58')](_0xd53e45['faxAccounts']);_0x52bb25({'count':_0x311d6d['length'],'rows':_0x311d6d});});},'SendFax':function(_0x4653d9){var _0x4ecc56=this;return new Promise(function(_0x446cbf,_0x2a7b73){_0x55df0f[_0x1dbb('0x83')](_0x4653d9)[_0x1dbb('0x16')](function(_0x467b90){_0x446cbf({'code':0xc8,'message':_0x467b90[_0x1dbb('0x17')]});})[_0x1dbb('0x18')](function(_0x19657e){_0x2a7b73(_0x4ecc56['error'](0x1f4,_0x19657e['message']));});});},'CheckAfterSend':function(_0x17d5c7){var _0x5ec2d7=this;return new Promise(function(_0xfb92a2,_0x99b718){_0x55df0f[_0x1dbb('0x84')](_0x17d5c7)[_0x1dbb('0x16')](function(_0x31e859){_0xfb92a2({'code':0xc8,'message':_0x31e859[_0x1dbb('0x17')]});})[_0x1dbb('0x18')](function(_0x1a96c3){_0x99b718(_0x5ec2d7[_0x1dbb('0xe')](0x1f4,_0x1a96c3['message']));});});}};var _0x4f2c36=jayson[_0x1dbb('0x85')](_0x2070a8)['http']();_0x4f2c36['on'](_0x1dbb('0xe'),function(_0x458b6e){return _0x38259d(_0x458b6e);});_0x4f2c36[_0x1dbb('0x3')](0x232a,_0x1dbb('0x86'),function(){console[_0x1dbb('0x87')](_0x1dbb('0x88'),0x232a);return _0xd43ce8(_0x1dbb('0x89')+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 a977de3..d360922 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 _0x4b84=['calleridnum','lastName','phone','fax','createdAt','scheduledAt','updatedAt','union','resolve','then','getContacts','length','info','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','destcalleridnum','calleridname','Unknown','firstName','destcalleridname','','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','name','trigger:%s','action','toLowerCase','merge','lodash','bluebird','../../../../config/environment','../../rpc/cmContact','redis','defaults','[CM][%s][%s]','stringify','emit','data1','data2','isNil','data5','ListId','data3','map','routeId'];(function(_0x3b1b23,_0x21bccd){var _0x1efc85=function(_0x102a95){while(--_0x102a95){_0x3b1b23['push'](_0x3b1b23['shift']());}};_0x1efc85(++_0x21bccd);}(_0x4b84,0x1cc));var _0x44b8=function(_0x4f0c2b,_0x2c9d14){_0x4f0c2b=_0x4f0c2b-0x0;var _0x526436=_0x4b84[_0x4f0c2b];return _0x526436;};'use strict';var _=require(_0x44b8('0x0'));var BPromise=require(_0x44b8('0x1'));var Redis=require('ioredis');var util=require('util');var config=require(_0x44b8('0x2'));var logger=require('../../../../config/logger')('trigger');var cmContactRpc=require(_0x44b8('0x3'));config[_0x44b8('0x4')]=_[_0x44b8('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x44b8('0x4')]));function emit(_0x54274b,_0x327f59,_0x5947f7,_0x3e87c5,_0x5a2353){logger['info'](_0x44b8('0x6'),_0x54274b,_0x327f59['id'],_0x5947f7,_0x3e87c5,JSON[_0x44b8('0x7')](_0x5a2353));io['to'](_0x5947f7)[_0x44b8('0x8')](_0x3e87c5,_0x5a2353);}exports['exec']=function(_0xc650ec,_0x2cc74b,_0x4315f6,_0x9b6048){var _0x24dd10,_0x37e471;var _0xe9a025={};var _0x4ae8a1=Number(_0x4315f6[_0x44b8('0x9')]);var _0x4301a6=_0x4315f6['data2']?Boolean(Number(_0x4315f6[_0x44b8('0xa')])):![];var _0x490bc6;var _0x833ea3=![];if(!_[_0x44b8('0xb')](_0x4315f6['data5'])){if(_0x4315f6[_0x44b8('0xc')]=='1')_0x833ea3=!![];}if(!_0x833ea3){if(_0x9b6048['xmd-contactid']){_0xe9a025['id']=_0x9b6048['xmd-contactid'];}}if(!_0xe9a025['id']){_0xe9a025[_0x44b8('0xd')]=_0x4ae8a1;_0x490bc6=_0x4315f6[_0x44b8('0xe')]&&_0x4315f6[_0x44b8('0xe')]!=='0'?_0x4315f6[_0x44b8('0xe')]['split'](','):['phone'];_0xe9a025['$or']=_[_0x44b8('0xf')](_0x490bc6,function(_0x5b7803){var _0x28ef36={};_0x28ef36[_0x5b7803]=_0x9b6048[_0x44b8('0x10')]?_0x9b6048['destcalleridnum']:_0x9b6048[_0x44b8('0x11')];return _0x28ef36;});}var _0xe3de8f=['id','firstName',_0x44b8('0x12'),_0x44b8('0x13'),'mobile',_0x44b8('0x14'),_0x44b8('0xd'),_0x44b8('0x15'),_0x44b8('0x16'),_0x44b8('0x17')];var _0x369c09=_[_0x44b8('0x18')](_0xe3de8f,_0x490bc6);BPromise[_0x44b8('0x19')]()[_0x44b8('0x1a')](cmContactRpc[_0x44b8('0x1b')]({'attributes':_0x369c09,'where':_0xe9a025}))[_0x44b8('0x1a')](function(_0x14996c){_0x37e471=_0x14996c;if(!_['isEmpty'](_0x37e471)){if(_0x37e471[_0x44b8('0x1c')]===0x1){_0x24dd10=_0x37e471[0x0];logger[_0x44b8('0x1d')](_0x44b8('0x1e'),_0x9b6048[_0x44b8('0x1f')],_0x2cc74b['id'],_0x24dd10['id']);}else{logger[_0x44b8('0x1d')]('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x9b6048[_0x44b8('0x1f')],_0x2cc74b['id'],_['map'](_0x37e471,'id')[_0x44b8('0x20')](','));}return;}else{logger[_0x44b8('0x1d')](_0x44b8('0x21'),_0x9b6048[_0x44b8('0x1f')],_0x2cc74b['id']);var _0x230a3d={'ListId':_0x4ae8a1};var _0x59acbc=_0x4315f6[_0x44b8('0x22')]&&_0x4315f6['data4']!=='0'?_0x4315f6[_0x44b8('0x22')]:_0x44b8('0x13');if(_0x4301a6){logger['info'](_0x44b8('0x23'),_0x9b6048[_0x44b8('0x1f')],_0x2cc74b['id']);_0x230a3d[_0x59acbc]=_[_0x44b8('0xb')](_0x9b6048['routeId'])?_0x9b6048[_0x44b8('0x11')]:_0x9b6048[_0x44b8('0x24')];if(_['isNil'](_0x9b6048[_0x44b8('0x10')])){_0x230a3d['firstName']=_0x9b6048[_0x44b8('0x25')]&&_0x9b6048['calleridname']!==''?_0x9b6048['calleridname']:_0x44b8('0x26');}else{_0x230a3d[_0x44b8('0x27')]=_0x9b6048[_0x44b8('0x28')]&&_0x9b6048[_0x44b8('0x28')]!==_0x44b8('0x29')?_0x9b6048[_0x44b8('0x28')]:_0x44b8('0x26');}return BPromise[_0x44b8('0x19')]()[_0x44b8('0x1a')](cmContactRpc[_0x44b8('0x2a')](_0x230a3d))[_0x44b8('0x1a')](function(_0x417d81){_0x24dd10=_0x417d81;_0x37e471[_0x44b8('0x2b')](_0x417d81);if(_0x24dd10){logger['info'](_0x44b8('0x2c'),_0x9b6048['uniqueid'],_0x2cc74b['id'],_0x24dd10['id']);}return;});}else{logger[_0x44b8('0x1d')](_0x44b8('0x2d'),_0x9b6048[_0x44b8('0x1f')],_0x2cc74b['id']);_0x230a3d[_0x59acbc]=_[_0x44b8('0xb')](_0x9b6048[_0x44b8('0x10')])?_0x9b6048['calleridnum']:_0x9b6048[_0x44b8('0x24')];if(_[_0x44b8('0xb')](_0x9b6048[_0x44b8('0x10')])){_0x230a3d[_0x44b8('0x27')]=_0x9b6048[_0x44b8('0x25')]&&_0x9b6048['calleridname']!==_0x44b8('0x29')?_0x9b6048[_0x44b8('0x25')]:_0x44b8('0x26');}else{_0x230a3d[_0x44b8('0x27')]=_0x9b6048[_0x44b8('0x28')]&&_0x9b6048[_0x44b8('0x28')]!==_0x44b8('0x29')?_0x9b6048[_0x44b8('0x28')]:_0x44b8('0x26');}_0x24dd10=_0x230a3d;_0x37e471[_0x44b8('0x2b')](_0x230a3d);return;}}})[_0x44b8('0x1a')](function(){if(_0xc650ec){emit(_0x9b6048[_0x44b8('0x1f')],_0x2cc74b,util[_0x44b8('0x2e')](_0x44b8('0x2f'),_0xc650ec[_0x44b8('0x30')]),util[_0x44b8('0x2e')](_0x44b8('0x31'),_0x4315f6[_0x44b8('0x32')][_0x44b8('0x33')]()),{'evt':_[_0x44b8('0x34')](_0x9b6048,{'autoCreate':_0x4301a6}),'contact':_0x24dd10===undefined?{}:_0x24dd10,'contacts':_0x37e471[_0x44b8('0x1c')]===0x0?undefined:_0x37e471});}});}; \ No newline at end of file +var _0xb821=['routeId','destcalleridnum','calleridname','Unknown','destcalleridname','','push','format','name','trigger:%s','action','toLowerCase','merge','length','bluebird','ioredis','../../../../config/logger','redis','defaults','localhost','info','[CM][%s][%s]','stringify','exec','data1','data2','data5','xmd-contactid','ListId','data3','phone','map','calleridnum','firstName','lastName','fax','createdAt','scheduledAt','updatedAt','union','resolve','then','getContacts','isEmpty','[CM][%s][%s]\x20Contact\x20found:%s','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','uniqueid','join','data4','[CM][%s][%s]\x20Autocreate\x20enabled','isNil'];(function(_0x12d812,_0x496bb7){var _0x3711ab=function(_0x3259da){while(--_0x3259da){_0x12d812['push'](_0x12d812['shift']());}};_0x3711ab(++_0x496bb7);}(_0xb821,0xa7));var _0x1b82=function(_0x210456,_0x269bd0){_0x210456=_0x210456-0x0;var _0x44b198=_0xb821[_0x210456];return _0x44b198;};'use strict';var _=require('lodash');var BPromise=require(_0x1b82('0x0'));var Redis=require(_0x1b82('0x1'));var util=require('util');var config=require('../../../../config/environment');var logger=require(_0x1b82('0x2'))('trigger');var cmContactRpc=require('../../rpc/cmContact');config[_0x1b82('0x3')]=_[_0x1b82('0x4')](config[_0x1b82('0x3')],{'host':_0x1b82('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x1b82('0x3')]));function emit(_0x192434,_0x202a5f,_0x3632dd,_0x18f45f,_0x7b87e8){logger[_0x1b82('0x6')](_0x1b82('0x7'),_0x192434,_0x202a5f['id'],_0x3632dd,_0x18f45f,JSON[_0x1b82('0x8')](_0x7b87e8));io['to'](_0x3632dd)['emit'](_0x18f45f,_0x7b87e8);}exports[_0x1b82('0x9')]=function(_0x30c6ee,_0x44dfd4,_0x14c57a,_0xcffb87){var _0x17a96b,_0x739f99;var _0x1ce719={};var _0x5f521f=Number(_0x14c57a[_0x1b82('0xa')]);var _0x241d11=_0x14c57a[_0x1b82('0xb')]?Boolean(Number(_0x14c57a[_0x1b82('0xb')])):![];var _0x50aed7;var _0x1a6285=![];if(!_['isNil'](_0x14c57a['data5'])){if(_0x14c57a[_0x1b82('0xc')]=='1')_0x1a6285=!![];}if(!_0x1a6285){if(_0xcffb87['xmd-contactid']){_0x1ce719['id']=_0xcffb87[_0x1b82('0xd')];}}if(!_0x1ce719['id']){_0x1ce719[_0x1b82('0xe')]=_0x5f521f;_0x50aed7=_0x14c57a['data3']&&_0x14c57a[_0x1b82('0xf')]!=='0'?_0x14c57a['data3']['split'](','):[_0x1b82('0x10')];_0x1ce719['$or']=_[_0x1b82('0x11')](_0x50aed7,function(_0x25228b){var _0xf42818={};_0xf42818[_0x25228b]=_0xcffb87['routeId']?_0xcffb87['destcalleridnum']:_0xcffb87[_0x1b82('0x12')];return _0xf42818;});}var _0x5d66c3=['id',_0x1b82('0x13'),_0x1b82('0x14'),_0x1b82('0x10'),'mobile',_0x1b82('0x15'),_0x1b82('0xe'),_0x1b82('0x16'),_0x1b82('0x17'),_0x1b82('0x18')];var _0x47e99b=_[_0x1b82('0x19')](_0x5d66c3,_0x50aed7);BPromise[_0x1b82('0x1a')]()[_0x1b82('0x1b')](cmContactRpc[_0x1b82('0x1c')]({'attributes':_0x47e99b,'where':_0x1ce719}))[_0x1b82('0x1b')](function(_0x31fd64){_0x739f99=_0x31fd64;if(!_[_0x1b82('0x1d')](_0x739f99)){if(_0x739f99['length']===0x1){_0x17a96b=_0x739f99[0x0];logger[_0x1b82('0x6')](_0x1b82('0x1e'),_0xcffb87['uniqueid'],_0x44dfd4['id'],_0x17a96b['id']);}else{logger[_0x1b82('0x6')](_0x1b82('0x1f'),_0xcffb87[_0x1b82('0x20')],_0x44dfd4['id'],_['map'](_0x739f99,'id')[_0x1b82('0x21')](','));}return;}else{logger['info']('[CM][%s][%s]\x20Contact\x20not\x20found',_0xcffb87['uniqueid'],_0x44dfd4['id']);var _0xf2e556={'ListId':_0x5f521f};var _0x149d0f=_0x14c57a[_0x1b82('0x22')]&&_0x14c57a[_0x1b82('0x22')]!=='0'?_0x14c57a['data4']:_0x1b82('0x10');if(_0x241d11){logger[_0x1b82('0x6')](_0x1b82('0x23'),_0xcffb87[_0x1b82('0x20')],_0x44dfd4['id']);_0xf2e556[_0x149d0f]=_[_0x1b82('0x24')](_0xcffb87[_0x1b82('0x25')])?_0xcffb87[_0x1b82('0x12')]:_0xcffb87[_0x1b82('0x26')];if(_[_0x1b82('0x24')](_0xcffb87[_0x1b82('0x25')])){_0xf2e556[_0x1b82('0x13')]=_0xcffb87[_0x1b82('0x27')]&&_0xcffb87[_0x1b82('0x27')]!==''?_0xcffb87[_0x1b82('0x27')]:_0x1b82('0x28');}else{_0xf2e556[_0x1b82('0x13')]=_0xcffb87[_0x1b82('0x29')]&&_0xcffb87[_0x1b82('0x29')]!==_0x1b82('0x2a')?_0xcffb87[_0x1b82('0x29')]:_0x1b82('0x28');}return BPromise[_0x1b82('0x1a')]()[_0x1b82('0x1b')](cmContactRpc['createContact'](_0xf2e556))[_0x1b82('0x1b')](function(_0x29a31e){_0x17a96b=_0x29a31e;_0x739f99[_0x1b82('0x2b')](_0x29a31e);if(_0x17a96b){logger[_0x1b82('0x6')]('[CM][%s][%s]\x20Contact\x20created:%s',_0xcffb87[_0x1b82('0x20')],_0x44dfd4['id'],_0x17a96b['id']);}return;});}else{logger[_0x1b82('0x6')]('[CM][%s][%s]\x20Autocreate\x20disabled',_0xcffb87[_0x1b82('0x20')],_0x44dfd4['id']);_0xf2e556[_0x149d0f]=_[_0x1b82('0x24')](_0xcffb87[_0x1b82('0x25')])?_0xcffb87['calleridnum']:_0xcffb87['destcalleridnum'];if(_[_0x1b82('0x24')](_0xcffb87['routeId'])){_0xf2e556['firstName']=_0xcffb87[_0x1b82('0x27')]&&_0xcffb87[_0x1b82('0x27')]!==_0x1b82('0x2a')?_0xcffb87['calleridname']:_0x1b82('0x28');}else{_0xf2e556[_0x1b82('0x13')]=_0xcffb87[_0x1b82('0x29')]&&_0xcffb87[_0x1b82('0x29')]!==''?_0xcffb87[_0x1b82('0x29')]:_0x1b82('0x28');}_0x17a96b=_0xf2e556;_0x739f99[_0x1b82('0x2b')](_0xf2e556);return;}}})['then'](function(){if(_0x30c6ee){emit(_0xcffb87['uniqueid'],_0x44dfd4,util[_0x1b82('0x2c')]('user:%s',_0x30c6ee[_0x1b82('0x2d')]),util[_0x1b82('0x2c')](_0x1b82('0x2e'),_0x14c57a[_0x1b82('0x2f')][_0x1b82('0x30')]()),{'evt':_[_0x1b82('0x31')](_0xcffb87,{'autoCreate':_0x241d11}),'contact':_0x17a96b===undefined?{}:_0x17a96b,'contacts':_0x739f99[_0x1b82('0x32')]===0x0?undefined:_0x739f99});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 6c3ad1c..3aad1d9 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 _0x9f7e=['custom:closedinteraction','custom:substatus','custom:incomingmessage','custom:acceptmessage','custom:rejectmessage','prototype','emit','info','stringify','clone','motionChannel','undefined','voice','interface','checkTriggers','hasOwnProperty','status','checkTrigger','merge','variables','Actions','action','contactmanager','motionbar','data1','popup','TemplateId','html','render','template\x20not\x20found','uri','buildUri','data3','isNil','data4','location','uriLocation','windowWidth','windowHeight','600','data6','winApplication','data2','winArguments','format','trigger:%s:%s','toLowerCase','jscripty','name','trigger:%s','user:%s','routeId','urlforward','exec','script','parse','query','replace','channel','AllConditions','length','every','checkConditions','AnyConditions','some','field','ChatWebsiteId','upperFirst','AccountId','value','interaction','event','operator','queue','agent','membername','lastevent','util','lodash','url','mustache','./urlforward','./integration','./cmContact','./script','../../../config/environment','../../../config/logger','../ami','redis','localhost','socket.io-emitter','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','custom:agentcalled','syncCustomEvent','bind','custom:agentconnect','custom:agentringnoanswer','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:amd','custom:timeout','custom:dialbegin','custom:dialconnect','syncAgentDial','custom:dialend','custom:newinteraction'];(function(_0x388986,_0x41d723){var _0x28918c=function(_0x38494f){while(--_0x38494f){_0x388986['push'](_0x388986['shift']());}};_0x28918c(++_0x41d723);}(_0x9f7e,0x1c1));var _0xe9f7=function(_0x5301f5,_0x58be9e){_0x5301f5=_0x5301f5-0x0;var _0x5aa247=_0x9f7e[_0x5301f5];return _0x5aa247;};'use strict';var util=require(_0xe9f7('0x0'));var _=require(_0xe9f7('0x1'));var url=require(_0xe9f7('0x2'));var Mustache=require(_0xe9f7('0x3'));var Redis=require('ioredis');var urlforward=require(_0xe9f7('0x4'));var integration=require(_0xe9f7('0x5'));var cmContact=require(_0xe9f7('0x6'));var script=require(_0xe9f7('0x7'));var config=require(_0xe9f7('0x8'));var logger=require(_0xe9f7('0x9'))('trigger');var ami=require(_0xe9f7('0xa'));config[_0xe9f7('0xb')]=_['defaults'](config[_0xe9f7('0xb')],{'host':_0xe9f7('0xc'),'port':0x18eb});var io=require(_0xe9f7('0xd'))(new Redis(config['redis']));var operators={'equals':function(_0x9b5513,_0x2b1724){return _0x9b5513==_0x2b1724;},'not_equals':function(_0x2cbc29,_0x4e7b81){return _0x2cbc29!=_0x4e7b81;}};var barAndWebActions=['popup','url',_0xe9f7('0xe')];function Trigger(_0x2b060f){this[_0xe9f7('0xf')]=_0x2b060f['triggers'];this[_0xe9f7('0x10')]=_0x2b060f[_0xe9f7('0x10')];this[_0xe9f7('0x11')]=_0x2b060f['voiceQueues'];this['templates']=_0x2b060f[_0xe9f7('0x12')];this['voiceExtensions']=_0x2b060f[_0xe9f7('0x13')];this['zendeskAccounts']=_0x2b060f[_0xe9f7('0x14')];this['freshdeskAccounts']=_0x2b060f[_0xe9f7('0x15')];this['salesforceAccounts']=_0x2b060f[_0xe9f7('0x16')];this[_0xe9f7('0x17')]=_0x2b060f[_0xe9f7('0x17')];this[_0xe9f7('0x18')]=_0x2b060f['zohoAccounts'];this[_0xe9f7('0x19')]=_0x2b060f[_0xe9f7('0x19')];this[_0xe9f7('0x1a')]=_0x2b060f[_0xe9f7('0x1a')];this['servicenowAccounts']=_0x2b060f[_0xe9f7('0x1b')];this[_0xe9f7('0x1c')]=_0x2b060f[_0xe9f7('0x1c')];this[_0xe9f7('0x1d')]=_0x2b060f[_0xe9f7('0x1d')];this[_0xe9f7('0x1e')]={'zendesk':this[_0xe9f7('0x14')],'salesforce':this[_0xe9f7('0x16')],'freshdesk':this['freshdeskAccounts'],'sugarcrm':this[_0xe9f7('0x17')],'zoho':this[_0xe9f7('0x18')],'desk':this[_0xe9f7('0x19')],'vtiger':this[_0xe9f7('0x1a')],'dynamics365':this[_0xe9f7('0x1c')],'freshsales':this[_0xe9f7('0x1d')],'servicenow':this['servicenowAccounts']};ami['on'](_0xe9f7('0x1f'),this[_0xe9f7('0x20')][_0xe9f7('0x21')](this));ami['on'](_0xe9f7('0x22'),this[_0xe9f7('0x20')]['bind'](this));ami['on'](_0xe9f7('0x23'),this[_0xe9f7('0x20')]['bind'](this));ami['on']('custom:agentcomplete',this[_0xe9f7('0x20')]['bind'](this));ami['on'](_0xe9f7('0x24'),this[_0xe9f7('0x20')][_0xe9f7('0x21')](this));ami['on'](_0xe9f7('0x25'),this['syncCustomEvent'][_0xe9f7('0x21')](this));ami['on'](_0xe9f7('0x26'),this['syncCustomEvent']['bind'](this));ami['on'](_0xe9f7('0x27'),this[_0xe9f7('0x20')][_0xe9f7('0x21')](this));ami['on']('custom:agentreject',this[_0xe9f7('0x20')][_0xe9f7('0x21')](this));ami['on'](_0xe9f7('0x28'),this[_0xe9f7('0x20')][_0xe9f7('0x21')](this));ami['on']('custom:queuecallerabandon',this[_0xe9f7('0x20')][_0xe9f7('0x21')](this));ami['on'](_0xe9f7('0x29'),this['syncCustomEvent']['bind'](this));ami['on'](_0xe9f7('0x2a'),this['syncAgentDial']['bind'](this));ami['on'](_0xe9f7('0x2b'),this[_0xe9f7('0x2c')]['bind'](this));ami['on'](_0xe9f7('0x2d'),this[_0xe9f7('0x2c')][_0xe9f7('0x21')](this));ami['on'](_0xe9f7('0x2e'),this['syncCustomEvent'][_0xe9f7('0x21')](this));ami['on'](_0xe9f7('0x2f'),this[_0xe9f7('0x20')][_0xe9f7('0x21')](this));ami['on'](_0xe9f7('0x30'),this['syncCustomEvent'][_0xe9f7('0x21')](this));ami['on'](_0xe9f7('0x31'),this[_0xe9f7('0x20')][_0xe9f7('0x21')](this));ami['on']('custom:outgoingmessage',this['syncCustomEvent']['bind'](this));ami['on'](_0xe9f7('0x32'),this['syncCustomEvent'][_0xe9f7('0x21')](this));ami['on'](_0xe9f7('0x33'),this[_0xe9f7('0x20')][_0xe9f7('0x21')](this));}Trigger[_0xe9f7('0x34')][_0xe9f7('0x35')]=function(_0x250478,_0x46c903,_0x15814d){logger[_0xe9f7('0x36')](_0x250478,_0x46c903,JSON[_0xe9f7('0x37')](_0x15814d));io['to'](_0x250478)['emit'](_0x46c903,_0x15814d);};Trigger[_0xe9f7('0x34')]['syncCustomEvent']=function(_0x148de7){var _0x5c3530=_[_0xe9f7('0x38')](_0x148de7);if(typeof _0x5c3530[_0xe9f7('0x39')]===_0xe9f7('0x3a')){_0x5c3530[_0xe9f7('0x39')]=_0xe9f7('0x3b');}this['checkTriggers'](_0x5c3530);};Trigger[_0xe9f7('0x34')][_0xe9f7('0x2c')]=function(_0x3365bb){if(this[_0xe9f7('0x10')][_0x3365bb[_0xe9f7('0x3c')]]){this['syncCustomEvent'](_0x3365bb);}};Trigger[_0xe9f7('0x34')][_0xe9f7('0x3d')]=function(_0x57c8e8){var _0x5cecd2;for(var _0x510536 in this['triggers']){if(this[_0xe9f7('0xf')][_0xe9f7('0x3e')](_0x510536)){if(this[_0xe9f7('0xf')][_0x510536][_0xe9f7('0x3f')]){_0x5cecd2=this[_0xe9f7('0x40')](this[_0xe9f7('0xf')][_0x510536],_0x57c8e8);if(_0x5cecd2){_[_0xe9f7('0x41')](_0x57c8e8,_0x57c8e8[_0xe9f7('0x42')]);for(var _0x4d00c1=0x0,_0x5a109b,_0xfc18,_0x2a4689;_0x4d00c10x0){_0x328a08=_[_0xb814('0x2c')](_0x5a6291,_0x271aa8);}return _0x328a08;}function getCustomFields(_0x37d24d,_0x530744){var _0x499f22=[];var _0x20577b={'custom_fields':{}};if(_0x37d24d[_0xb814('0x2d')]>0x0){_['forEach'](_0x37d24d,function(_0x338a28){if(_['includes']([_0xb814('0x2e'),'picklist'],_0x338a28['type'])&&_0x338a28[_0xb814('0x2f')]&&!_0x338a28['customField']){_0x20577b[_0x338a28[_0xb814('0x2f')][_0xb814('0x30')]()]=_0x338a28[_0xb814('0x31')]['toString']();}else if(_['includes']([_0xb814('0x2e'),_0xb814('0x32')],_0x338a28['type'])&&_0x338a28[_0xb814('0x33')]&&_0x338a28[_0xb814('0x34')]){_0x20577b[_0xb814('0x35')][_0x338a28[_0xb814('0x33')]]=_0x338a28[_0xb814('0x31')][_0xb814('0x23')]();}else if(_0x338a28[_0xb814('0x36')]==='variable'&&_0x338a28[_0xb814('0x37')]&&_0x338a28[_0xb814('0x33')]&&_0x338a28[_0xb814('0x34')]){_0x530744[_0x338a28[_0xb814('0x37')]]&&(_0x20577b[_0xb814('0x35')][_0x338a28['idField']]=_0x530744[_0x338a28[_0xb814('0x37')]]['toString']());}else if(_0x338a28[_0xb814('0x36')]===_0xb814('0x38')&&_0x338a28[_0xb814('0x39')]&&_0x338a28['Variable'][_0xb814('0x3a')]&&_0x338a28[_0xb814('0x33')]&&_0x338a28['customField']){_0x530744[_0x338a28[_0xb814('0x39')][_0xb814('0x3a')][_0xb814('0x30')]()]&&(_0x20577b[_0xb814('0x35')][_0x338a28[_0xb814('0x33')]]=_0x530744[_0x338a28[_0xb814('0x39')]['name'][_0xb814('0x30')]()]['toString']());}});}if(_0x20577b[_0xb814('0x3b')]){_0x20577b['priority']=Number(_0x20577b[_0xb814('0x3b')]);}return _0x20577b;}function getTicket(_0x4b9233,_0x2f8a2e,_0x26675a,_0x54a7fb,_0x4d308a){logger['info']('Creating\x20new\x20ticket...');var _0x17549e=_[_0xb814('0x3c')]({'subject':intUtil[_0xb814('0x3d')](_0x54a7fb[_0xb814('0x3e')],_0x4d308a,'\x20'),'type':'phone','status':'new','labels':[_0xb814('0x3f'),'Motion',_0xb814('0x40')][_0xb814('0x41')](getTags(_0x54a7fb[_0xb814('0x42')],_0xb814('0x3a'))),'description':intUtil[_0xb814('0x3d')](_0x54a7fb[_0xb814('0x43')],_0x4d308a,'\x0a'),'_links':{'assigned_user':{'href':util[_0xb814('0x10')](_0xb814('0x44'),_0x2f8a2e['id']),'class':_0xb814('0x45')}},'message':{'direction':'in','body':intUtil['getString'](_0x54a7fb['Descriptions'],_0x4d308a,'\x0a')}},getCustomFields(_0x54a7fb['Fields'],_0x4d308a));return request({'uri':util[_0xb814('0x10')]('%s/customers/%d/cases',_0x4b9233[_0xb814('0x1a')],_0x26675a['id']),'method':'POST','body':_0x17549e});}exports[_0xb814('0x46')]=function(_0x44ff56,_0x9ef639,_0x2e97cc,_0x4fae23,_0x30fc57,_0x15f01a){var _0x2b23c7,_0x22cf27;_0x15f01a[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x15f01a['remoteUri']);_0x15f01a[_0xb814('0x48')]=intUtil[_0xb814('0x47')](_0x15f01a[_0xb814('0x48')]);if(_0x30fc57&&_0x30fc57[_0xb814('0x49')]){logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x4b'));_0x9ef639['recordingURL']=util['format'](_0xb814('0x4c'),_0x15f01a[_0xb814('0x48')],_0x9ef639[_0xb814('0x4d')],md5(_0x9ef639[_0xb814('0x4d')]));}else{_0x9ef639[_0xb814('0x4e')]='';}headers[_0xb814('0x4f')]=getAuth(_0x15f01a);return getUser(_0x15f01a,_0x4fae23[_0xb814('0x50')])[_0xb814('0x12')](function(_0x2eb9b6){_0x2b23c7=_0x2eb9b6;logger[_0xb814('0xe')](_0xb814('0x51'),_0x2b23c7['id']);return getEndUser(_0x15f01a,_0x9ef639['calleridname'],_0x9ef639[_0xb814('0x52')]);})[_0xb814('0x12')](function(_0x4a76bb){_0x22cf27=_0x4a76bb;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x22cf27['id']);return getTicket(_0x15f01a,_0x2b23c7,_0x22cf27,_0x2e97cc,_0x9ef639);})[_0xb814('0x12')](function(_0x37866f){if(_0x37866f){logger[_0xb814('0xe')](_0xb814('0x53'));logger[_0xb814('0xe')](_0xb814('0x54'),_0x37866f['id']);switch(_0x15f01a[_0xb814('0x36')]){case _0xb814('0x55'):logger[_0xb814('0xe')](_0xb814('0x4a'),'Displaying\x20ticket\x20to\x20agent...');emit(util['format'](_0xb814('0x56'),_0x4fae23[_0xb814('0x3a')]),_0xb814('0x57'),{'recordId':_0x37866f['id']});break;case _0xb814('0x58'):logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x59'));emit(util['format'](_0xb814('0x56'),_0x4fae23[_0xb814('0x3a')]),_0xb814('0x5a'),{'uri':util['format'](_0xb814('0x5b'),_0x37866f['id'])});break;default:logger['error'](_0xb814('0x4a'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0xb814('0x5c')](function(_0x3cf8f8){console['error'](_0x3cf8f8);logger[_0xb814('0x5d')](_0xb814('0x4a'),JSON[_0xb814('0x5e')](_0x3cf8f8));});};exports['outbound']=function(_0x3da050,_0x5f0e58,_0x13bdcf,_0x158893,_0x4aed78,_0x39952d,_0x4a3f84){var _0x539be7,_0x3b9709;_0x39952d[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x39952d['remoteUri']);_0x39952d[_0xb814('0x48')]=intUtil['stripTrailingSlash'](_0x39952d[_0xb814('0x48')]);if(_0x4a3f84&&_0x4a3f84[_0xb814('0x5f')]&&_0x4a3f84['recordingFormat']!==_0xb814('0x60')){logger['info'](_0xb814('0x61'),_0xb814('0x4b'));_0x5f0e58[_0xb814('0x4e')]=util[_0xb814('0x10')](_0xb814('0x4c'),_0x39952d[_0xb814('0x48')],_0x5f0e58[_0xb814('0x4d')],md5(_0x5f0e58[_0xb814('0x4d')]));}headers['Authorization']=getAuth(_0x39952d);return getUser(_0x39952d,_0x158893[_0xb814('0x50')])[_0xb814('0x12')](function(_0x5d71d5){_0x539be7=_0x5d71d5;logger[_0xb814('0xe')](_0xb814('0x51'),_0x539be7['id']);return getEndUser(_0x39952d,_0x5f0e58['destcalleridname'],_0x5f0e58[_0xb814('0x62')]);})['then'](function(_0x48362c){_0x3b9709=_0x48362c;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x3b9709['id']);return getTicket(_0x39952d,_0x539be7,_0x3b9709,_0x13bdcf,_0x5f0e58);})[_0xb814('0x12')](function(_0xd1cd8b){if(_0xd1cd8b){logger[_0xb814('0xe')]('Ticket\x20created!');logger[_0xb814('0xe')]('The\x20Ticket\x20ID\x20is:',_0xd1cd8b['id']);switch(_0x39952d[_0xb814('0x36')]){case _0xb814('0x55'):logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x63'));emit(util[_0xb814('0x10')](_0xb814('0x56'),_0x158893[_0xb814('0x3a')]),_0xb814('0x57'),{'recordId':_0xd1cd8b['id']});break;case'newTab':logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x59'));emit(util[_0xb814('0x10')](_0xb814('0x56'),_0x158893[_0xb814('0x3a')]),'trigger:browser:url',{'uri':util[_0xb814('0x10')]('%s/agent/tickets/%s',_0x39952d[_0xb814('0x1a')],_0xd1cd8b['id'])});break;default:logger[_0xb814('0x5d')](_0xb814('0x61'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0xb814('0x5c')](function(_0x579351){logger[_0xb814('0x5d')]('[OUTBOUND]',JSON[_0xb814('0x5e')](_0x579351));});};exports[_0xb814('0x64')]=function(_0xa03cd2,_0x1b024f,_0x3377d4,_0x167d82,_0x143518,_0x4d44e3){var _0x44088d,_0x51ca51;_0x4d44e3[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x4d44e3[_0xb814('0x1a')]);_0x4d44e3[_0xb814('0x48')]=intUtil[_0xb814('0x47')](_0x4d44e3[_0xb814('0x48')]);if(_0x143518&&_0x143518['monitor_format']){logger[_0xb814('0xe')]('['+_0x1b024f[_0xb814('0x65')]['toUpperCase']()+']',_0xb814('0x4b'));_0x1b024f[_0xb814('0x4e')]=util[_0xb814('0x10')](_0xb814('0x4c'),_0x4d44e3[_0xb814('0x48')],_0x1b024f['uniqueid'],md5(_0x1b024f[_0xb814('0x4d')]));}else{_0x1b024f['recordingURL']='';}headers[_0xb814('0x4f')]=getAuth(_0x4d44e3);return getUser(_0x4d44e3)[_0xb814('0x12')](function(_0x2645f6){_0x44088d=_0x2645f6;logger[_0xb814('0xe')](_0xb814('0x51'),_0x44088d['id']);return getEndUser(_0x4d44e3,_0x1b024f[_0xb814('0x66')],_0x1b024f['calleridnum']);})['then'](function(_0x5d064b){_0x51ca51=_0x5d064b;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x51ca51['id']);return getTicket(_0x4d44e3,_0x44088d,_0x51ca51,_0x3377d4,_0x1b024f);})[_0xb814('0x12')](function(_0x1d3954){if(_0x1d3954){logger[_0xb814('0xe')]('Ticket\x20created!');logger[_0xb814('0xe')](_0xb814('0x54'),_0x1d3954['id']);}})[_0xb814('0x5c')](function(_0x5aabbe){logger[_0xb814('0x5d')]('['+_0x1b024f[_0xb814('0x65')][_0xb814('0x67')]()+']',JSON[_0xb814('0x5e')](_0x5aabbe));});}; \ No newline at end of file +var _0xe14b=['CTI','concat','Tags','Descriptions','/api/v2/users/%d','user','%s/customers/%d/cases','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','error','Desk\x20account\x20type\x20not\x20recognized','recordingFormat','none','[OUTBOUND]','Authorization','destcalleridname','destcalleridnum','integrationTab','newTab','catch','unmanaged','lastevent','toUpperCase','calleridname','lodash','request-promise','ioredis','./util','../../../../config/logger','defaults','redis','localhost','socket.io-emitter','application/json','validateEmail','format','%s/users','then','total_entries','find','_embedded','entries','info','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/users/me','debug','[HTTP]','stringify','GET','authType','basic','%s:%s','username','password','token','%s/token:%s','Basic\x20%s','base64','Searching\x20enduser\x20with\x20phone','%s/customers/search','Enduser\x20found!','%s/customers','remoteUri','POST','length','map','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','content','toString','idField','variableName','custom_fields','Variable','name','priority','Creating\x20new\x20ticket...','merge','getString','Subjects','phone','new','xCALLY'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe14b,0x93));var _0xbe14=function(_0x47eec8,_0x51658e){_0x47eec8=_0x47eec8-0x0;var _0x161ab0=_0xe14b[_0x47eec8];return _0x161ab0;};'use strict';var _=require(_0xbe14('0x0'));var rp=require(_0xbe14('0x1'));var md5=require('md5');var util=require('util');var Redis=require(_0xbe14('0x2'));var intUtil=require(_0xbe14('0x3'));var config=require('../../../../config/environment');var logger=require(_0xbe14('0x4'))('desk');config['redis']=_[_0xbe14('0x5')](config[_0xbe14('0x6')],{'host':_0xbe14('0x7'),'port':0x18eb});var io=require(_0xbe14('0x8'))(new Redis(config[_0xbe14('0x6')]));function emit(_0x39387e,_0x196fca,_0x566ae7){io['to'](_0x39387e)['emit'](_0x196fca,_0x566ae7);}var headers={'Content-Type':'application/json','Accept':_0xbe14('0x9')};function getUser(_0x6fceff,_0xd68cd7){if(intUtil[_0xbe14('0xa')](_0xd68cd7)===!![]){logger['info']('Getting\x20agent\x20with\x20email',_0xd68cd7);return request({'uri':util[_0xbe14('0xb')](_0xbe14('0xc'),_0x6fceff['remoteUri'])})[_0xbe14('0xd')](function(_0x35aa19){if(_0x35aa19[_0xbe14('0xe')]){return _[_0xbe14('0xf')](_0x35aa19[_0xbe14('0x10')][_0xbe14('0x11')],{'email':_0xd68cd7});}})[_0xbe14('0xd')](function(_0x2850cb){if(_0x2850cb){logger[_0xbe14('0x12')](_0xbe14('0x13'));return _0x2850cb;}else{logger[_0xbe14('0x12')](_0xbe14('0x14'));return request({'uri':util[_0xbe14('0xb')]('%s/users/me',_0x6fceff['remoteUri'])});}});}else{logger[_0xbe14('0x12')](_0xbe14('0x15'));return request({'uri':util[_0xbe14('0xb')](_0xbe14('0x16'),_0x6fceff['remoteUri'])});}}function request(_0x21c789){logger[_0xbe14('0x17')](_0xbe14('0x18'),JSON[_0xbe14('0x19')](_0x21c789));return rp(_[_0xbe14('0x5')](_0x21c789,{'method':_0xbe14('0x1a'),'headers':headers,'json':!![]}));}function getAuth(_0x17ae86){var _0x5ea1f8;if(_0x17ae86[_0xbe14('0x1b')]===_0xbe14('0x1c')){_0x5ea1f8=util[_0xbe14('0xb')](_0xbe14('0x1d'),_0x17ae86[_0xbe14('0x1e')],_0x17ae86[_0xbe14('0x1f')]);}else if(_0x17ae86['authType']===_0xbe14('0x20')){_0x5ea1f8=util[_0xbe14('0xb')](_0xbe14('0x21'),_0x17ae86[_0xbe14('0x1e')],_0x17ae86[_0xbe14('0x20')]);}return util['format'](_0xbe14('0x22'),new Buffer(_0x5ea1f8)['toString'](_0xbe14('0x23')));}function getEndUser(_0x56e80c,_0x32e8eb,_0x4a25fa){logger[_0xbe14('0x12')](_0xbe14('0x24'),_0x4a25fa);return request({'uri':util['format'](_0xbe14('0x25'),_0x56e80c['remoteUri']),'qs':{'phone':_0x4a25fa}})[_0xbe14('0xd')](function(_0x4851f8){if(_0x4851f8[_0xbe14('0xe')]){logger[_0xbe14('0x12')](_0xbe14('0x26'));return _0x4851f8[_0xbe14('0x10')][_0xbe14('0x11')][0x0];}else{logger[_0xbe14('0x12')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0xbe14('0xb')](_0xbe14('0x27'),_0x56e80c[_0xbe14('0x28')]),'method':_0xbe14('0x29'),'body':{'first_name':_0x32e8eb,'title':_0x32e8eb,'phone_numbers':[{'type':'work','value':_0x4a25fa}]}});}});}function getTags(_0x16f884,_0x29fc64){var _0x59bf34=[];if(_0x16f884&&_0x16f884[_0xbe14('0x2a')]>0x0){_0x59bf34=_[_0xbe14('0x2b')](_0x16f884,_0x29fc64);}return _0x59bf34;}function getCustomFields(_0x1c7cc7,_0x19252f){var _0x34d648=[];var _0x36d4b2={'custom_fields':{}};if(_0x1c7cc7[_0xbe14('0x2a')]>0x0){_[_0xbe14('0x2c')](_0x1c7cc7,function(_0x4168c8){if(_[_0xbe14('0x2d')]([_0xbe14('0x2e'),_0xbe14('0x2f')],_0x4168c8[_0xbe14('0x30')])&&_0x4168c8[_0xbe14('0x31')]&&!_0x4168c8[_0xbe14('0x32')]){_0x36d4b2[_0x4168c8[_0xbe14('0x31')][_0xbe14('0x33')]()]=_0x4168c8[_0xbe14('0x34')][_0xbe14('0x35')]();}else if(_[_0xbe14('0x2d')](['string',_0xbe14('0x2f')],_0x4168c8['type'])&&_0x4168c8['idField']&&_0x4168c8[_0xbe14('0x32')]){_0x36d4b2['custom_fields'][_0x4168c8[_0xbe14('0x36')]]=_0x4168c8[_0xbe14('0x34')]['toString']();}else if(_0x4168c8['type']==='variable'&&_0x4168c8[_0xbe14('0x37')]&&_0x4168c8[_0xbe14('0x36')]&&_0x4168c8['customField']){_0x19252f[_0x4168c8[_0xbe14('0x37')]]&&(_0x36d4b2[_0xbe14('0x38')][_0x4168c8[_0xbe14('0x36')]]=_0x19252f[_0x4168c8[_0xbe14('0x37')]][_0xbe14('0x35')]());}else if(_0x4168c8['type']==='customVariable'&&_0x4168c8[_0xbe14('0x39')]&&_0x4168c8['Variable']['name']&&_0x4168c8['idField']&&_0x4168c8[_0xbe14('0x32')]){_0x19252f[_0x4168c8[_0xbe14('0x39')][_0xbe14('0x3a')][_0xbe14('0x33')]()]&&(_0x36d4b2[_0xbe14('0x38')][_0x4168c8[_0xbe14('0x36')]]=_0x19252f[_0x4168c8[_0xbe14('0x39')][_0xbe14('0x3a')][_0xbe14('0x33')]()][_0xbe14('0x35')]());}});}if(_0x36d4b2[_0xbe14('0x3b')]){_0x36d4b2[_0xbe14('0x3b')]=Number(_0x36d4b2['priority']);}return _0x36d4b2;}function getTicket(_0x4f51f8,_0x43cdaa,_0x2951e1,_0x13bfcf,_0x520e09){logger[_0xbe14('0x12')](_0xbe14('0x3c'));var _0xeda70e=_[_0xbe14('0x3d')]({'subject':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x3f')],_0x520e09,'\x20'),'type':_0xbe14('0x40'),'status':_0xbe14('0x41'),'labels':[_0xbe14('0x42'),'Motion',_0xbe14('0x43')][_0xbe14('0x44')](getTags(_0x13bfcf[_0xbe14('0x45')],_0xbe14('0x3a'))),'description':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x46')],_0x520e09,'\x0a'),'_links':{'assigned_user':{'href':util['format'](_0xbe14('0x47'),_0x43cdaa['id']),'class':_0xbe14('0x48')}},'message':{'direction':'in','body':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x46')],_0x520e09,'\x0a')}},getCustomFields(_0x13bfcf['Fields'],_0x520e09));return request({'uri':util['format'](_0xbe14('0x49'),_0x4f51f8[_0xbe14('0x28')],_0x2951e1['id']),'method':_0xbe14('0x29'),'body':_0xeda70e});}exports['queue']=function(_0x5d5318,_0x6b6aa8,_0x59ae4d,_0x5657fe,_0x3593f8,_0x1f0355){var _0x8216c3,_0x5051e4;_0x1f0355['remoteUri']=intUtil['stripTrailingSlash'](_0x1f0355[_0xbe14('0x28')]);_0x1f0355[_0xbe14('0x4a')]=intUtil[_0xbe14('0x4b')](_0x1f0355['serverUrl']);if(_0x3593f8&&_0x3593f8[_0xbe14('0x4c')]){logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x4e'));_0x6b6aa8['recordingURL']=util['format'](_0xbe14('0x4f'),_0x1f0355[_0xbe14('0x4a')],_0x6b6aa8[_0xbe14('0x50')],md5(_0x6b6aa8[_0xbe14('0x50')]));}else{_0x6b6aa8[_0xbe14('0x51')]='';}headers['Authorization']=getAuth(_0x1f0355);return getUser(_0x1f0355,_0x5657fe['email'])[_0xbe14('0xd')](function(_0x2a3623){_0x8216c3=_0x2a3623;logger[_0xbe14('0x12')](_0xbe14('0x52'),_0x8216c3['id']);return getEndUser(_0x1f0355,_0x6b6aa8['calleridname'],_0x6b6aa8[_0xbe14('0x53')]);})[_0xbe14('0xd')](function(_0x53e8ab){_0x5051e4=_0x53e8ab;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x5051e4['id']);return getTicket(_0x1f0355,_0x8216c3,_0x5051e4,_0x59ae4d,_0x6b6aa8);})[_0xbe14('0xd')](function(_0x36c20c){if(_0x36c20c){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x36c20c['id']);switch(_0x1f0355['type']){case'integrationTab':logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x56'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x5657fe[_0xbe14('0x3a')]),_0xbe14('0x58'),{'recordId':_0x36c20c['id']});break;case'newTab':logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x59'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x5657fe['name']),_0xbe14('0x5a'),{'uri':util[_0xbe14('0xb')](_0xbe14('0x5b'),_0x36c20c['id'])});break;default:logger[_0xbe14('0x5c')](_0xbe14('0x4d'),_0xbe14('0x5d'));}}})['catch'](function(_0x5aeea9){console[_0xbe14('0x5c')](_0x5aeea9);logger[_0xbe14('0x5c')](_0xbe14('0x4d'),JSON['stringify'](_0x5aeea9));});};exports['outbound']=function(_0x44fe0d,_0x134878,_0x50d78f,_0x339a86,_0x32496a,_0x50c2a0,_0x28f995){var _0x4a40d2,_0x41ba58;_0x50c2a0[_0xbe14('0x28')]=intUtil[_0xbe14('0x4b')](_0x50c2a0['remoteUri']);_0x50c2a0[_0xbe14('0x4a')]=intUtil[_0xbe14('0x4b')](_0x50c2a0['serverUrl']);if(_0x28f995&&_0x28f995[_0xbe14('0x5e')]&&_0x28f995[_0xbe14('0x5e')]!==_0xbe14('0x5f')){logger[_0xbe14('0x12')](_0xbe14('0x60'),'Recording\x20is\x20enabled!');_0x134878[_0xbe14('0x51')]=util[_0xbe14('0xb')](_0xbe14('0x4f'),_0x50c2a0[_0xbe14('0x4a')],_0x134878[_0xbe14('0x50')],md5(_0x134878[_0xbe14('0x50')]));}headers[_0xbe14('0x61')]=getAuth(_0x50c2a0);return getUser(_0x50c2a0,_0x339a86['email'])[_0xbe14('0xd')](function(_0x1b47a4){_0x4a40d2=_0x1b47a4;logger[_0xbe14('0x12')](_0xbe14('0x52'),_0x4a40d2['id']);return getEndUser(_0x50c2a0,_0x134878[_0xbe14('0x62')],_0x134878[_0xbe14('0x63')]);})[_0xbe14('0xd')](function(_0x32df3c){_0x41ba58=_0x32df3c;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x41ba58['id']);return getTicket(_0x50c2a0,_0x4a40d2,_0x41ba58,_0x50d78f,_0x134878);})[_0xbe14('0xd')](function(_0x4bccfc){if(_0x4bccfc){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x4bccfc['id']);switch(_0x50c2a0[_0xbe14('0x30')]){case _0xbe14('0x64'):logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x56'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x339a86[_0xbe14('0x3a')]),_0xbe14('0x58'),{'recordId':_0x4bccfc['id']});break;case _0xbe14('0x65'):logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x59'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x339a86[_0xbe14('0x3a')]),_0xbe14('0x5a'),{'uri':util[_0xbe14('0xb')]('%s/agent/tickets/%s',_0x50c2a0[_0xbe14('0x28')],_0x4bccfc['id'])});break;default:logger[_0xbe14('0x5c')](_0xbe14('0x60'),_0xbe14('0x5d'));}}})[_0xbe14('0x66')](function(_0x222944){logger[_0xbe14('0x5c')](_0xbe14('0x60'),JSON[_0xbe14('0x19')](_0x222944));});};exports[_0xbe14('0x67')]=function(_0x5917d5,_0x18be56,_0x442ec4,_0x2d4dd4,_0xfd32a3,_0x3ac6d8){var _0x5a1ea6,_0x42b341;_0x3ac6d8[_0xbe14('0x28')]=intUtil[_0xbe14('0x4b')](_0x3ac6d8[_0xbe14('0x28')]);_0x3ac6d8[_0xbe14('0x4a')]=intUtil['stripTrailingSlash'](_0x3ac6d8[_0xbe14('0x4a')]);if(_0xfd32a3&&_0xfd32a3[_0xbe14('0x4c')]){logger[_0xbe14('0x12')]('['+_0x18be56[_0xbe14('0x68')][_0xbe14('0x69')]()+']',_0xbe14('0x4e'));_0x18be56[_0xbe14('0x51')]=util[_0xbe14('0xb')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3ac6d8[_0xbe14('0x4a')],_0x18be56[_0xbe14('0x50')],md5(_0x18be56[_0xbe14('0x50')]));}else{_0x18be56[_0xbe14('0x51')]='';}headers[_0xbe14('0x61')]=getAuth(_0x3ac6d8);return getUser(_0x3ac6d8)[_0xbe14('0xd')](function(_0x445302){_0x5a1ea6=_0x445302;logger['info']('The\x20User\x20ID\x20is:',_0x5a1ea6['id']);return getEndUser(_0x3ac6d8,_0x18be56[_0xbe14('0x6a')],_0x18be56[_0xbe14('0x53')]);})[_0xbe14('0xd')](function(_0x2510a0){_0x42b341=_0x2510a0;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x42b341['id']);return getTicket(_0x3ac6d8,_0x5a1ea6,_0x42b341,_0x442ec4,_0x18be56);})[_0xbe14('0xd')](function(_0x43511e){if(_0x43511e){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x43511e['id']);}})[_0xbe14('0x66')](function(_0x57729f){logger[_0xbe14('0x5c')]('['+_0x18be56[_0xbe14('0x68')][_0xbe14('0x69')]()+']',JSON[_0xbe14('0x19')](_0x57729f));});}; \ 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 6f45945..0614b1c 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 _0xa561=['../../../../config/environment','redis','defaults','localhost','socket.io-emitter','POST','clientId','remoteUri','username','password','clientSecret','then','access_token','error','toUpperCase',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','4.0','value','isNil','email','userEmail','length','internalemailaddress','isdisabled','info',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','catch','toLowerCase','outbound','contacts','/systemusers(','Bearer\x20','substring','lastIndexOf','enduserId','contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27','contactid',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','includes','string','type','nameField','customField','idField','indexOf','content','ticketType','incidents','assign','getString','Subjects','Descriptions','/contacts(','Fields','phonecall','queue','callDirection','phonecalls','calleridnum','headers','odata-entityid','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','format','https://login.microsoftonline.com/%s/oauth2/token','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:','ticketId',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','lodash','request-promise','util','./util','md5','../../../../config/logger'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0xa561,0x18e));var _0x1a56=function(_0x156408,_0x2d2eb7){_0x156408=_0x156408-0x0;var _0x10d081=_0xa561[_0x156408];return _0x10d081;};'use strict';var _=require(_0x1a56('0x0'));var BPromise=require('bluebird');var rp=require(_0x1a56('0x1'));var util=require(_0x1a56('0x2'));var intUtil=require(_0x1a56('0x3'));var md5=require(_0x1a56('0x4'));var Redis=require('ioredis');var logger=require(_0x1a56('0x5'))('dynamics365');var config=require(_0x1a56('0x6'));config[_0x1a56('0x7')]=_[_0x1a56('0x8')](config[_0x1a56('0x7')],{'host':_0x1a56('0x9'),'port':0x18eb});var io=require(_0x1a56('0xa'))(new Redis(config[_0x1a56('0x7')]));function getAuthToken(_0x1bc3fd,_0xd8ae78,_0x1f9500){var _0x4e0430={'method':_0x1a56('0xb'),'uri':_0xd8ae78,'form':{'client_id':_0x1bc3fd[_0x1a56('0xc')],'resource':_0x1bc3fd[_0x1a56('0xd')],'username':_0x1bc3fd[_0x1a56('0xe')],'password':_0x1bc3fd[_0x1a56('0xf')],'grant_type':'password','client_secret':_0x1bc3fd[_0x1a56('0x10')]},'json':!![]};return rp(_0x4e0430)[_0x1a56('0x11')](function(_0x313208){return _0x313208[_0x1a56('0x12')];})['catch'](function(_0x5402f2){logger[_0x1a56('0x13')]('['+[_0x1f9500[_0x1a56('0x14')]()]+_0x1a56('0x15'));return _0x5402f2[_0x1a56('0x16')];});}function getUser(_0xa5f836,_0x5e4375,_0x1c1794,_0x3a1a1c,_0x147691,_0x155068){return new BPromise(function(_0x4c4353,_0x4453d1){return getAuthToken(_0x5e4375,_0x3a1a1c,_0x155068)[_0x1a56('0x11')](function(_0x3b0827){var _0x2ec06a={'method':_0x1a56('0x17'),'uri':_0x147691+_0x1a56('0x18'),'headers':{'Authorization':'Bearer\x20'+_0x3b0827,'OData-Version':_0x1a56('0x19')},'json':!![]};return rp(_0x2ec06a);})[_0x1a56('0x11')](function(_0x40a80e){var _0x11a41f=_0x40a80e[_0x1a56('0x1a')];var _0x3d2341=![];var _0x287285=null;if(!_[_0x1a56('0x1b')](_0x1c1794)){if(intUtil['validateEmail'](_0x1c1794[_0x1a56('0x1c')])){_0xa5f836[_0x1a56('0x1d')]=_0x1c1794[_0x1a56('0x1c')];for(_0x287285=0x0;_0x287285<_0x11a41f[_0x1a56('0x1e')];_0x287285++){if(_0x11a41f[_0x287285][_0x1a56('0x1f')]===_0x1c1794[_0x1a56('0x1c')]&&!_0x11a41f[_0x287285][_0x1a56('0x20')]){_0x3d2341=!![];logger[_0x1a56('0x21')]('['+[_0x155068[_0x1a56('0x14')]()]+_0x1a56('0x22')+_0x11a41f[_0x287285][_0x1a56('0x23')]+'!');_0xa5f836[_0x1a56('0x24')]=_0x11a41f[_0x287285][_0x1a56('0x23')];}}}}if(!_0x3d2341){logger[_0x1a56('0x21')]('['+[_0x155068[_0x1a56('0x14')]()]+_0x1a56('0x25'));_0xa5f836[_0x1a56('0x1d')]=_0x5e4375[_0x1a56('0xe')];for(_0x287285=0x0;_0x287285<_0x11a41f[_0x1a56('0x1e')];_0x287285++){if(_0x11a41f[_0x287285][_0x1a56('0x1f')]===_0x5e4375[_0x1a56('0xe')]){_0xa5f836[_0x1a56('0x24')]=_0x11a41f[_0x287285][_0x1a56('0x23')];}}}_0x4c4353(_0xa5f836);})[_0x1a56('0x26')](function(_0xdba56b){_0x4453d1(_0xdba56b[_0x1a56('0x16')]);});});}function createEndUser(_0x4bcc60,_0x591c8b,_0x388b9a,_0x436584,_0x22ed1f,_0x21382c){return new BPromise(function(_0xbac6b8,_0x9d2c2){return getAuthToken(_0x591c8b,_0x388b9a,_0x21382c)[_0x1a56('0x11')](function(_0x37827c){var _0x422f74=_0x21382c[_0x1a56('0x27')]()===_0x1a56('0x28')?_0x22ed1f['destcalleridnum']:_0x22ed1f['calleridnum'];var _0x5c026c={'method':_0x1a56('0xb'),'uri':_0x436584+_0x1a56('0x29'),'body':{'telephone1':_0x422f74,'fullname':_0x422f74,'firstname':_0x422f74,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x1a56('0x2a')+_0x4bcc60['userId']+')'},'headers':{'Authorization':_0x1a56('0x2b')+_0x37827c,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x5c026c);})[_0x1a56('0x11')](function(_0x230224){var _0x37fcb7=_0x230224['headers']['odata-entityid'];var _0x424e03=_0x37fcb7[_0x1a56('0x2c')](_0x37fcb7[_0x1a56('0x2d')]('(')+0x1,_0x37fcb7['lastIndexOf'](')'));_0x4bcc60[_0x1a56('0x2e')]=_0x424e03;_0xbac6b8(_0x4bcc60);})[_0x1a56('0x26')](function(_0x1b1e9a){_0x9d2c2(_0x1b1e9a[_0x1a56('0x16')]);});});}function getEndUser(_0x51fd80,_0x57ee9e,_0x1de7d1,_0x13fae4,_0x4d3ec9,_0xf5ea11,_0x5313a6){var _0x55ae98=_0xf5ea11[_0x1a56('0x27')]()===_0x1a56('0x28')?_0x4d3ec9['destcalleridnum']:_0x4d3ec9['calleridnum'];return getAuthToken(_0x57ee9e,_0x1de7d1,_0xf5ea11)[_0x1a56('0x11')](function(_0x48fc56){var _0x8f44f0={'method':_0x1a56('0x17'),'uri':_0x13fae4+_0x1a56('0x2f')+_0x55ae98['replace']('+','%2b')+'\x27','headers':{'Authorization':'Bearer\x20'+_0x48fc56,'If-None-Match':null,'OData-Version':_0x1a56('0x19')},'json':!![]};return rp(_0x8f44f0);})[_0x1a56('0x11')](function(_0x129a7d){var _0x28f135=![];if(!_0x129a7d)return _0x28f135;var _0x51bafa=_0x129a7d[_0x1a56('0x1a')];for(var _0x2ce60f=0x0;_0x2ce60f<_0x51bafa[_0x1a56('0x1e')];_0x2ce60f++){if(_0x51bafa[_0x2ce60f]['telephone1']===_0x55ae98){_0x28f135=!![];_0x51fd80[_0x1a56('0x2e')]=_0x51bafa[_0x2ce60f][_0x1a56('0x30')];}}return _0x28f135;})[_0x1a56('0x11')](function(_0x9a9dc9){if(_0x9a9dc9)return _0x51fd80;if(_0x5313a6==='nothing'){logger[_0x1a56('0x21')]('['+[_0xf5ea11['toUpperCase']()]+_0x1a56('0x31'));return _0x51fd80;}return createEndUser(_0x51fd80,_0x57ee9e,_0x1de7d1,_0x13fae4,_0x4d3ec9,_0xf5ea11)[_0x1a56('0x11')](function(_0x5d293d){logger[_0x1a56('0x21')]('['+[_0xf5ea11[_0x1a56('0x14')]()]+_0x1a56('0x32'),_0x5d293d[_0x1a56('0x2e')]);return _0x5d293d;});});}function getCustomFields(_0x2d093b,_0x5132d7,_0x27696e){var _0x5a6d2b={};if(_0x2d093b[_0x1a56('0x1e')]>0x0){_[_0x1a56('0x33')](_0x2d093b,function(_0x12fd10){if(_[_0x1a56('0x34')]([_0x1a56('0x35'),'picklist'],_0x12fd10[_0x1a56('0x36')])&&_0x12fd10[_0x1a56('0x37')]&&!_0x12fd10[_0x1a56('0x38')]){var _0x1c35c5=_0x12fd10[_0x1a56('0x39')]['toLowerCase']();var _0x6f4b28=_0x1c35c5['substring'](0x0,_0x1c35c5[_0x1a56('0x3a')]('_'));var _0x1d6adb=_0x1c35c5[_0x1a56('0x2c')](_0x1c35c5[_0x1a56('0x3a')]('_')+0x1);if(_0x6f4b28===_0x27696e){_0x5a6d2b[_0x1d6adb]=_0x12fd10[_0x1a56('0x3b')];}}});}return _0x5a6d2b;}function getTicket(_0xde3c8d,_0x2c90fc,_0x25c849,_0x571878,_0x4d5517,_0x2e95ea,_0x10ecbc){return new BPromise(function(_0xb89fb4,_0x5ddccd){var _0x342138;return getAuthToken(_0x2c90fc,_0x25c849,_0x10ecbc)['then'](function(_0x57c266){if(_0x2e95ea[_0x1a56('0x3c')]==='incident'){_0x342138={'method':'POST','uri':_0x571878+_0x1a56('0x3d'),'body':Object[_0x1a56('0x3e')]({},{'title':intUtil[_0x1a56('0x3f')](_0x2e95ea[_0x1a56('0x40')],_0x4d5517,'\x20'),'description':intUtil[_0x1a56('0x3f')](_0x2e95ea[_0x1a56('0x41')],_0x4d5517,'\x0a'),'customerid_contact@odata.bind':_0xde3c8d[_0x1a56('0x2e')]?_0x1a56('0x42')+_0xde3c8d['enduserId']+')':undefined,'ownerid@odata.bind':'/systemusers('+_0xde3c8d[_0x1a56('0x24')]+')','caseorigincode':'1'},getCustomFields(_0x2e95ea[_0x1a56('0x43')],_0x4d5517,_0x2e95ea[_0x1a56('0x3c')])),'headers':{'Authorization':_0x1a56('0x2b')+_0x57c266,'OData-Version':_0x1a56('0x19')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x2e95ea[_0x1a56('0x3c')]===_0x1a56('0x44')){var _0x2b155b=_0xde3c8d[_0x1a56('0x2e')]?[{'partyid_systemuser@odata.bind':'/systemusers('+_0xde3c8d[_0x1a56('0x24')]+')','participationtypemask':_0xde3c8d['callDirection']===_0x1a56('0x45')?0x2:0x1},{'partyid_contact@odata.bind':_0x1a56('0x42')+_0xde3c8d[_0x1a56('0x2e')]+')','participationtypemask':_0xde3c8d[_0x1a56('0x46')]==='queue'?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x1a56('0x2a')+_0xde3c8d[_0x1a56('0x24')]+')','participationtypemask':_0xde3c8d[_0x1a56('0x46')]===_0x1a56('0x45')?0x2:0x1}];_0x342138={'method':_0x1a56('0xb'),'uri':_0x571878+_0x1a56('0x47'),'body':Object[_0x1a56('0x3e')]({},{'subject':intUtil['getString'](_0x2e95ea[_0x1a56('0x40')],_0x4d5517,'\x20'),'phonenumber':String(_0x4d5517[_0x1a56('0x48')]),'description':intUtil['getString'](_0x2e95ea[_0x1a56('0x41')],_0x4d5517,'\x0a'),'regardingobjectid_contact@odata.bind':_0xde3c8d[_0x1a56('0x2e')]?_0x1a56('0x42')+_0xde3c8d['enduserId']+')':undefined,'ownerid@odata.bind':_0x1a56('0x2a')+_0xde3c8d['userId']+')','directioncode':_0xde3c8d[_0x1a56('0x46')]===_0x1a56('0x45')?![]:!![],'phonecall_activity_parties':_0x2b155b},getCustomFields(_0x2e95ea['Fields'],_0x4d5517,_0x2e95ea[_0x1a56('0x3c')])),'headers':{'Authorization':_0x1a56('0x2b')+_0x57c266,'OData-Version':_0x1a56('0x19')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x342138);})['then'](function(_0x142f54){var _0x1b745b=_0x142f54[_0x1a56('0x49')][_0x1a56('0x4a')];var _0x29a453=_0x1b745b['substring'](_0x1b745b[_0x1a56('0x2d')]('(')+0x1,_0x1b745b[_0x1a56('0x2d')](')'));_0xde3c8d['ticketId']=_0x29a453;_0xb89fb4(_0xde3c8d);})['catch'](function(_0x4ab7c9){_0x5ddccd(_0x4ab7c9[_0x1a56('0x16')]);});});}function emit(_0x2b9241,_0x5cca5b,_0x16784c,_0x219519){var _0x6965bc={'uri':util['format'](_0x1a56('0x4b'),_0x2b9241,_0x16784c,_0x219519)};io['to'](util['format']('user:%s',_0x5cca5b))[_0x1a56('0x4c')](_0x1a56('0x4d'),_0x6965bc);}exports['cs']=function(_0x490024,_0x5cd8c3,_0x173f2a,_0x206580,_0x33cd92,_0xa63207,_0x1c2a11,_0x446c7c){var _0x41c59e={};_0xa63207['remoteUri']=intUtil[_0x1a56('0x4e')](_0xa63207['remoteUri']);_0xa63207[_0x1a56('0x4f')]=intUtil[_0x1a56('0x4e')](_0xa63207[_0x1a56('0x4f')]);_0x41c59e[_0x1a56('0x46')]=_0x446c7c===_0x1a56('0x45')||_0x446c7c===_0x1a56('0x50')?_0x1a56('0x45'):'outbound';var _0x26c3da=util[_0x1a56('0x51')]('%s/api/data/v9.0/',_0xa63207[_0x1a56('0xd')]);var _0x8b86b7=util['format'](_0x1a56('0x52'),_0xa63207[_0x1a56('0x53')]);var _0x5c9cc3=util[_0x1a56('0x51')](_0x1a56('0x54'),_0xa63207[_0x1a56('0x4f')],_0x5cd8c3[_0x1a56('0x55')],md5(_0x5cd8c3['uniqueid']));if(_0x33cd92&&_0x33cd92[_0x1a56('0x56')]){logger[_0x1a56('0x21')]('[QUEUE]',_0x1a56('0x57'));_0x5cd8c3[_0x1a56('0x58')]=_0x5c9cc3;}else if(_0x1c2a11&&_0x1c2a11[_0x1a56('0x59')]&&_0x1c2a11[_0x1a56('0x59')]!==_0x1a56('0x5a')){logger[_0x1a56('0x21')]('[OUTBOUND]',_0x1a56('0x57'));_0x5cd8c3[_0x1a56('0x58')]=_0x5c9cc3;}else{_0x5cd8c3[_0x1a56('0x58')]='';}return getUser(_0x41c59e,_0xa63207,_0x206580,_0x8b86b7,_0x26c3da,_0x446c7c)[_0x1a56('0x11')](function(_0x2b51f8){logger['info']('['+_0x446c7c['toUpperCase']()+_0x1a56('0x5b'),_0x2b51f8[_0x1a56('0x24')]);logger[_0x1a56('0x21')]('['+_0x446c7c[_0x1a56('0x14')]()+_0x1a56('0x5c'),_0x2b51f8[_0x1a56('0x1d')]);return getEndUser(_0x2b51f8,_0xa63207,_0x8b86b7,_0x26c3da,_0x5cd8c3,_0x446c7c,_0x173f2a['moduleCreate']);})['then'](function(_0x22c406){logger[_0x1a56('0x21')]('['+_0x446c7c[_0x1a56('0x14')]()+_0x1a56('0x5d'),_0x22c406[_0x1a56('0x2e')]);logger[_0x1a56('0x21')]('['+_0x446c7c[_0x1a56('0x14')]()+_0x1a56('0x5e'),_0x5cd8c3[_0x1a56('0x48')]);return getTicket(_0x22c406,_0xa63207,_0x8b86b7,_0x26c3da,_0x5cd8c3,_0x173f2a,_0x446c7c);})[_0x1a56('0x11')](function(_0x399c62){logger[_0x1a56('0x21')](util[_0x1a56('0x51')]('['+_0x446c7c[_0x1a56('0x14')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x173f2a[_0x1a56('0x3c')],_0x399c62[_0x1a56('0x5f')]));logger[_0x1a56('0x21')](util['format']('['+_0x446c7c['toUpperCase']()+_0x1a56('0x60'),_0x446c7c));if(_0x446c7c!==_0x1a56('0x50')){logger[_0x1a56('0x21')]('['+_0x446c7c[_0x1a56('0x14')]()+']',_0x1a56('0x61'));emit(_0xa63207[_0x1a56('0xd')],_0x206580[_0x1a56('0x62')],_0x173f2a[_0x1a56('0x3c')],_0x399c62[_0x1a56('0x5f')]);}})[_0x1a56('0x26')](function(_0x10a905){logger['error']('['+_0x446c7c[_0x1a56('0x14')]()+_0x1a56('0x63'),util[_0x1a56('0x64')](_0x10a905,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xf956=['enduserId','contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27','replace','%2b','telephone1','contactid',']\x20Enduser\x20created!','forEach','includes','string','picklist','type','nameField','indexOf','ticketType','incidents','assign','getString','Subjects','Descriptions','/contacts(','/systemusers(','Fields','phonecall','callDirection','queue','headers','substring','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','serverUrl','stripTrailingSlash','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','userEmail','moduleCreate',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','lodash','bluebird','util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','localhost','POST','clientId','remoteUri','username','password','clientSecret','then','access_token','catch','error','toUpperCase','message','GET','4.0','value','validateEmail','email','length','internalemailaddress','isdisabled','info',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','toLowerCase','outbound','destcalleridnum','calleridnum','Bearer\x20','odata-entityid','lastIndexOf'];(function(_0x14f458,_0x5dd219){var _0x4ff2da=function(_0x473b86){while(--_0x473b86){_0x14f458['push'](_0x14f458['shift']());}};_0x4ff2da(++_0x5dd219);}(_0xf956,0x105));var _0x6f95=function(_0x463b6f,_0x3c8a37){_0x463b6f=_0x463b6f-0x0;var _0x1b0162=_0xf956[_0x463b6f];return _0x1b0162;};'use strict';var _=require(_0x6f95('0x0'));var BPromise=require(_0x6f95('0x1'));var rp=require('request-promise');var util=require(_0x6f95('0x2'));var intUtil=require('./util');var md5=require(_0x6f95('0x3'));var Redis=require(_0x6f95('0x4'));var logger=require(_0x6f95('0x5'))(_0x6f95('0x6'));var config=require(_0x6f95('0x7'));config['redis']=_['defaults'](config[_0x6f95('0x8')],{'host':_0x6f95('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6f95('0x8')]));function getAuthToken(_0x17b0ae,_0x1c6091,_0x84f3e1){var _0x2bcbc3={'method':_0x6f95('0xa'),'uri':_0x1c6091,'form':{'client_id':_0x17b0ae[_0x6f95('0xb')],'resource':_0x17b0ae[_0x6f95('0xc')],'username':_0x17b0ae[_0x6f95('0xd')],'password':_0x17b0ae[_0x6f95('0xe')],'grant_type':_0x6f95('0xe'),'client_secret':_0x17b0ae[_0x6f95('0xf')]},'json':!![]};return rp(_0x2bcbc3)[_0x6f95('0x10')](function(_0x4c4089){return _0x4c4089[_0x6f95('0x11')];})[_0x6f95('0x12')](function(_0x3c1af9){logger[_0x6f95('0x13')]('['+[_0x84f3e1[_0x6f95('0x14')]()]+']\x20Wrong\x20credentials!');return _0x3c1af9[_0x6f95('0x15')];});}function getUser(_0x342bae,_0x13d956,_0x310084,_0xd7019f,_0x4216e4,_0x2627be){return new BPromise(function(_0x4a5fb0,_0x2b5876){return getAuthToken(_0x13d956,_0xd7019f,_0x2627be)['then'](function(_0x3c3eab){var _0x4eddbe={'method':_0x6f95('0x16'),'uri':_0x4216e4+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':'Bearer\x20'+_0x3c3eab,'OData-Version':_0x6f95('0x17')},'json':!![]};return rp(_0x4eddbe);})['then'](function(_0x7b6d9f){var _0x51b222=_0x7b6d9f[_0x6f95('0x18')];var _0x3b5e3b=![];var _0x2981a6=null;if(!_['isNil'](_0x310084)){if(intUtil[_0x6f95('0x19')](_0x310084[_0x6f95('0x1a')])){_0x342bae['userEmail']=_0x310084[_0x6f95('0x1a')];for(_0x2981a6=0x0;_0x2981a6<_0x51b222[_0x6f95('0x1b')];_0x2981a6++){if(_0x51b222[_0x2981a6][_0x6f95('0x1c')]===_0x310084['email']&&!_0x51b222[_0x2981a6][_0x6f95('0x1d')]){_0x3b5e3b=!![];logger[_0x6f95('0x1e')]('['+[_0x2627be[_0x6f95('0x14')]()]+_0x6f95('0x1f')+_0x51b222[_0x2981a6][_0x6f95('0x20')]+'!');_0x342bae[_0x6f95('0x21')]=_0x51b222[_0x2981a6][_0x6f95('0x20')];}}}}if(!_0x3b5e3b){logger[_0x6f95('0x1e')]('['+[_0x2627be[_0x6f95('0x14')]()]+_0x6f95('0x22'));_0x342bae['userEmail']=_0x13d956['username'];for(_0x2981a6=0x0;_0x2981a6<_0x51b222[_0x6f95('0x1b')];_0x2981a6++){if(_0x51b222[_0x2981a6]['internalemailaddress']===_0x13d956[_0x6f95('0xd')]){_0x342bae[_0x6f95('0x21')]=_0x51b222[_0x2981a6]['systemuserid'];}}}_0x4a5fb0(_0x342bae);})[_0x6f95('0x12')](function(_0x2ef40e){_0x2b5876(_0x2ef40e[_0x6f95('0x15')]);});});}function createEndUser(_0x20b884,_0x59d688,_0x5b1c7d,_0x3c16e1,_0x56a58e,_0x1a4a2f){return new BPromise(function(_0xcf296e,_0x2ff870){return getAuthToken(_0x59d688,_0x5b1c7d,_0x1a4a2f)[_0x6f95('0x10')](function(_0x1d53cd){var _0x5db461=_0x1a4a2f[_0x6f95('0x23')]()===_0x6f95('0x24')?_0x56a58e[_0x6f95('0x25')]:_0x56a58e[_0x6f95('0x26')];var _0x5e2eee={'method':'POST','uri':_0x3c16e1+'contacts','body':{'telephone1':_0x5db461,'fullname':_0x5db461,'firstname':_0x5db461,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x20b884['userId']+')'},'headers':{'Authorization':_0x6f95('0x27')+_0x1d53cd,'OData-Version':_0x6f95('0x17')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x5e2eee);})[_0x6f95('0x10')](function(_0x254886){var _0x771c3=_0x254886['headers'][_0x6f95('0x28')];var _0x3665df=_0x771c3['substring'](_0x771c3[_0x6f95('0x29')]('(')+0x1,_0x771c3[_0x6f95('0x29')](')'));_0x20b884[_0x6f95('0x2a')]=_0x3665df;_0xcf296e(_0x20b884);})['catch'](function(_0x2247bf){_0x2ff870(_0x2247bf[_0x6f95('0x15')]);});});}function getEndUser(_0x6f851c,_0x32064a,_0x2659a9,_0x1d04ad,_0x75079e,_0x23a618,_0xfc1008){var _0x203465=_0x23a618[_0x6f95('0x23')]()===_0x6f95('0x24')?_0x75079e['destcalleridnum']:_0x75079e[_0x6f95('0x26')];return getAuthToken(_0x32064a,_0x2659a9,_0x23a618)[_0x6f95('0x10')](function(_0x397772){var _0x3355df={'method':_0x6f95('0x16'),'uri':_0x1d04ad+_0x6f95('0x2b')+_0x203465[_0x6f95('0x2c')]('+',_0x6f95('0x2d'))+'\x27','headers':{'Authorization':'Bearer\x20'+_0x397772,'If-None-Match':null,'OData-Version':_0x6f95('0x17')},'json':!![]};return rp(_0x3355df);})['then'](function(_0x269742){var _0x2df08a=![];if(!_0x269742)return _0x2df08a;var _0x1d3af0=_0x269742[_0x6f95('0x18')];for(var _0x10851f=0x0;_0x10851f<_0x1d3af0[_0x6f95('0x1b')];_0x10851f++){if(_0x1d3af0[_0x10851f][_0x6f95('0x2e')]===_0x203465){_0x2df08a=!![];_0x6f851c['enduserId']=_0x1d3af0[_0x10851f][_0x6f95('0x2f')];}}return _0x2df08a;})['then'](function(_0x391f72){if(_0x391f72)return _0x6f851c;if(_0xfc1008==='nothing'){logger[_0x6f95('0x1e')]('['+[_0x23a618[_0x6f95('0x14')]()]+']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing');return _0x6f851c;}return createEndUser(_0x6f851c,_0x32064a,_0x2659a9,_0x1d04ad,_0x75079e,_0x23a618)['then'](function(_0x571c2d){logger['info']('['+[_0x23a618[_0x6f95('0x14')]()]+_0x6f95('0x30'),_0x571c2d['enduserId']);return _0x571c2d;});});}function getCustomFields(_0x92258c,_0x33f256,_0x41610f){var _0x59baa6={};if(_0x92258c[_0x6f95('0x1b')]>0x0){_[_0x6f95('0x31')](_0x92258c,function(_0xe3a9e8){if(_[_0x6f95('0x32')]([_0x6f95('0x33'),_0x6f95('0x34')],_0xe3a9e8[_0x6f95('0x35')])&&_0xe3a9e8[_0x6f95('0x36')]&&!_0xe3a9e8['customField']){var _0x1a9ec4=_0xe3a9e8['idField'][_0x6f95('0x23')]();var _0x257b46=_0x1a9ec4['substring'](0x0,_0x1a9ec4['indexOf']('_'));var _0x201137=_0x1a9ec4['substring'](_0x1a9ec4[_0x6f95('0x37')]('_')+0x1);if(_0x257b46===_0x41610f){_0x59baa6[_0x201137]=_0xe3a9e8['content'];}}});}return _0x59baa6;}function getTicket(_0x24c0e3,_0x3017d4,_0xb07622,_0x3a2fe1,_0x59fb9a,_0x1d284a,_0x3c65b1){return new BPromise(function(_0x22a965,_0x4d7c0a){var _0x947273;return getAuthToken(_0x3017d4,_0xb07622,_0x3c65b1)['then'](function(_0x531db5){if(_0x1d284a[_0x6f95('0x38')]==='incident'){_0x947273={'method':'POST','uri':_0x3a2fe1+_0x6f95('0x39'),'body':Object[_0x6f95('0x3a')]({},{'title':intUtil[_0x6f95('0x3b')](_0x1d284a[_0x6f95('0x3c')],_0x59fb9a,'\x20'),'description':intUtil[_0x6f95('0x3b')](_0x1d284a[_0x6f95('0x3d')],_0x59fb9a,'\x0a'),'customerid_contact@odata.bind':_0x24c0e3['enduserId']?_0x6f95('0x3e')+_0x24c0e3[_0x6f95('0x2a')]+')':undefined,'ownerid@odata.bind':_0x6f95('0x3f')+_0x24c0e3[_0x6f95('0x21')]+')','caseorigincode':'1'},getCustomFields(_0x1d284a[_0x6f95('0x40')],_0x59fb9a,_0x1d284a[_0x6f95('0x38')])),'headers':{'Authorization':_0x6f95('0x27')+_0x531db5,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0x1d284a[_0x6f95('0x38')]===_0x6f95('0x41')){var _0x427a70=_0x24c0e3[_0x6f95('0x2a')]?[{'partyid_systemuser@odata.bind':_0x6f95('0x3f')+_0x24c0e3['userId']+')','participationtypemask':_0x24c0e3[_0x6f95('0x42')]==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0x6f95('0x3e')+_0x24c0e3[_0x6f95('0x2a')]+')','participationtypemask':_0x24c0e3['callDirection']===_0x6f95('0x43')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x6f95('0x3f')+_0x24c0e3['userId']+')','participationtypemask':_0x24c0e3[_0x6f95('0x42')]===_0x6f95('0x43')?0x2:0x1}];_0x947273={'method':_0x6f95('0xa'),'uri':_0x3a2fe1+'phonecalls','body':Object[_0x6f95('0x3a')]({},{'subject':intUtil[_0x6f95('0x3b')](_0x1d284a[_0x6f95('0x3c')],_0x59fb9a,'\x20'),'phonenumber':String(_0x59fb9a[_0x6f95('0x26')]),'description':intUtil['getString'](_0x1d284a[_0x6f95('0x3d')],_0x59fb9a,'\x0a'),'regardingobjectid_contact@odata.bind':_0x24c0e3['enduserId']?'/contacts('+_0x24c0e3['enduserId']+')':undefined,'ownerid@odata.bind':_0x6f95('0x3f')+_0x24c0e3['userId']+')','directioncode':_0x24c0e3[_0x6f95('0x42')]===_0x6f95('0x43')?![]:!![],'phonecall_activity_parties':_0x427a70},getCustomFields(_0x1d284a['Fields'],_0x59fb9a,_0x1d284a[_0x6f95('0x38')])),'headers':{'Authorization':_0x6f95('0x27')+_0x531db5,'OData-Version':_0x6f95('0x17')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x947273);})[_0x6f95('0x10')](function(_0x4a977b){var _0x23e125=_0x4a977b[_0x6f95('0x44')][_0x6f95('0x28')];var _0x248461=_0x23e125[_0x6f95('0x45')](_0x23e125[_0x6f95('0x29')]('(')+0x1,_0x23e125[_0x6f95('0x29')](')'));_0x24c0e3[_0x6f95('0x46')]=_0x248461;_0x22a965(_0x24c0e3);})[_0x6f95('0x12')](function(_0x22ac4c){_0x4d7c0a(_0x22ac4c[_0x6f95('0x15')]);});});}function emit(_0x178f56,_0x5433f5,_0x130cd9,_0xeb0390){var _0x33b0f7={'uri':util[_0x6f95('0x47')](_0x6f95('0x48'),_0x178f56,_0x130cd9,_0xeb0390)};io['to'](util[_0x6f95('0x47')](_0x6f95('0x49'),_0x5433f5))[_0x6f95('0x4a')](_0x6f95('0x4b'),_0x33b0f7);}exports['cs']=function(_0x5e1341,_0x35401a,_0x28a87e,_0xcdcea2,_0x36218e,_0x3ea01a,_0x351943,_0x56cdc2){var _0x3714a7={};_0x3ea01a['remoteUri']=intUtil['stripTrailingSlash'](_0x3ea01a['remoteUri']);_0x3ea01a[_0x6f95('0x4c')]=intUtil[_0x6f95('0x4d')](_0x3ea01a[_0x6f95('0x4c')]);_0x3714a7[_0x6f95('0x42')]=_0x56cdc2===_0x6f95('0x43')||_0x56cdc2===_0x6f95('0x4e')?_0x6f95('0x43'):_0x6f95('0x24');var _0x2f9b09=util[_0x6f95('0x47')](_0x6f95('0x4f'),_0x3ea01a[_0x6f95('0xc')]);var _0x3e8d65=util[_0x6f95('0x47')](_0x6f95('0x50'),_0x3ea01a[_0x6f95('0x51')]);var _0x215e7c=util['format'](_0x6f95('0x52'),_0x3ea01a['serverUrl'],_0x35401a[_0x6f95('0x53')],md5(_0x35401a['uniqueid']));if(_0x36218e&&_0x36218e[_0x6f95('0x54')]){logger[_0x6f95('0x1e')](_0x6f95('0x55'),_0x6f95('0x56'));_0x35401a[_0x6f95('0x57')]=_0x215e7c;}else if(_0x351943&&_0x351943[_0x6f95('0x58')]&&_0x351943[_0x6f95('0x58')]!==_0x6f95('0x59')){logger['info'](_0x6f95('0x5a'),_0x6f95('0x56'));_0x35401a['recordingURL']=_0x215e7c;}else{_0x35401a[_0x6f95('0x57')]='';}return getUser(_0x3714a7,_0x3ea01a,_0xcdcea2,_0x3e8d65,_0x2f9b09,_0x56cdc2)['then'](function(_0x4ada48){logger[_0x6f95('0x1e')]('['+_0x56cdc2['toUpperCase']()+_0x6f95('0x5b'),_0x4ada48[_0x6f95('0x21')]);logger['info']('['+_0x56cdc2[_0x6f95('0x14')]()+_0x6f95('0x5c'),_0x4ada48[_0x6f95('0x5d')]);return getEndUser(_0x4ada48,_0x3ea01a,_0x3e8d65,_0x2f9b09,_0x35401a,_0x56cdc2,_0x28a87e[_0x6f95('0x5e')]);})[_0x6f95('0x10')](function(_0xbfef20){logger['info']('['+_0x56cdc2[_0x6f95('0x14')]()+_0x6f95('0x5f'),_0xbfef20[_0x6f95('0x2a')]);logger[_0x6f95('0x1e')]('['+_0x56cdc2[_0x6f95('0x14')]()+_0x6f95('0x60'),_0x35401a[_0x6f95('0x26')]);return getTicket(_0xbfef20,_0x3ea01a,_0x3e8d65,_0x2f9b09,_0x35401a,_0x28a87e,_0x56cdc2);})[_0x6f95('0x10')](function(_0x2a2f8b){logger[_0x6f95('0x1e')](util[_0x6f95('0x47')]('['+_0x56cdc2[_0x6f95('0x14')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x28a87e[_0x6f95('0x38')],_0x2a2f8b[_0x6f95('0x46')]));logger[_0x6f95('0x1e')](util[_0x6f95('0x47')]('['+_0x56cdc2['toUpperCase']()+_0x6f95('0x61'),_0x56cdc2));if(_0x56cdc2!==_0x6f95('0x4e')){logger['info']('['+_0x56cdc2[_0x6f95('0x14')]()+']',_0x6f95('0x62'));emit(_0x3ea01a[_0x6f95('0xc')],_0xcdcea2['name'],_0x28a87e[_0x6f95('0x38')],_0x2a2f8b[_0x6f95('0x46')]);}})['catch'](function(_0x38f5db){logger[_0x6f95('0x13')]('['+_0x56cdc2[_0x6f95('0x14')]()+_0x6f95('0x63'),util[_0x6f95('0x64')](_0x38f5db,{'showHidden':!![],'depth':null}));});}; \ 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 42db053..c8b186d 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 _0x6ab9=['trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','[QUEUE]','recordingFormat','none','Recording\x20is\x20enabled!','Authorization','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','[OUTBOUND]','unmanaged','lastevent','toUpperCase','The\x20User\x20ID\x20is:','calleridname','calleridnum','lodash','request-promise','md5','util','ioredis','./util','../../../../config/logger','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','getString','Subjects','Descriptions','
','name','custom_fields','keyBy','%s/api/v2/tickets','POST','then','validateEmail','%s/api/v2/agents','length','Agent\x20found!','find','contact','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','remoteUri','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20created.','Basic\x20%s','toString','base64','debug','stringify','GET','map','forEach','includes','string','picklist','type','customField','nameField','toLowerCase','content','idField','variable','variableName','push','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s'];(function(_0x287aba,_0x2b05a3){var _0x25d2ea=function(_0x1652c2){while(--_0x1652c2){_0x287aba['push'](_0x287aba['shift']());}};_0x25d2ea(++_0x2b05a3);}(_0x6ab9,0x1e3));var _0x96ab=function(_0x26f702,_0x3919bf){_0x26f702=_0x26f702-0x0;var _0x11417d=_0x6ab9[_0x26f702];return _0x11417d;};'use strict';var _=require(_0x96ab('0x0'));var rp=require(_0x96ab('0x1'));var md5=require(_0x96ab('0x2'));var util=require(_0x96ab('0x3'));var Redis=require(_0x96ab('0x4'));var intUtil=require(_0x96ab('0x5'));var config=require('../../../../config/environment');var logger=require(_0x96ab('0x6'))(_0x96ab('0x7'));config[_0x96ab('0x8')]=_[_0x96ab('0x9')](config[_0x96ab('0x8')],{'host':_0x96ab('0xa'),'port':0x18eb});var io=require(_0x96ab('0xb'))(new Redis(config[_0x96ab('0x8')]));var headers={'Content-Type':_0x96ab('0xc'),'Accept':_0x96ab('0xc')};function emit(_0x1ebd94,_0x50bf17,_0x5f2345){io['to'](_0x1ebd94)[_0x96ab('0xd')](_0x50bf17,_0x5f2345);}function getTicket(_0x2ed3d4,_0x53005f,_0x32bdbe,_0x3ff01f,_0x6fbc58){logger[_0x96ab('0xe')](_0x96ab('0xf'));var _0x593b17=_[_0x96ab('0x10')]({'responder_id':_0x53005f['id'],'requester_id':_0x32bdbe['id'],'name':util[_0x96ab('0x11')](_0x96ab('0x12'),_0x6fbc58['calleridname']),'phone':_0x6fbc58['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x96ab('0x13')](_0x3ff01f[_0x96ab('0x14')],_0x6fbc58,'\x20'),'description':intUtil[_0x96ab('0x13')](_0x3ff01f[_0x96ab('0x15')],_0x6fbc58,_0x96ab('0x16')),'tags':getTags(_0x3ff01f['Tags'],_0x96ab('0x17'))},getCustomFields(_0x3ff01f['Fields'],_0x6fbc58));_0x593b17[_0x96ab('0x18')]=_['mapValues'](_[_0x96ab('0x19')](_0x593b17[_0x96ab('0x18')],'id'),'value');return request({'uri':util[_0x96ab('0x11')](_0x96ab('0x1a'),_0x2ed3d4['remoteUri']),'method':_0x96ab('0x1b'),'body':_0x593b17})[_0x96ab('0x1c')](function(_0xa3317a){logger['info']('Ticket\x20created!');return _0xa3317a;});}function getUser(_0x48c965,_0x3cdb5a){if(intUtil[_0x96ab('0x1d')](_0x3cdb5a)){return request({'uri':util['format'](_0x96ab('0x1e'),_0x48c965['remoteUri']),'qs':{'email':_0x3cdb5a}})[_0x96ab('0x1c')](function(_0x110342){if(_0x110342[_0x96ab('0x1f')]){logger[_0x96ab('0xe')](_0x96ab('0x20'));return _[_0x96ab('0x21')](_0x110342,function(_0x5612d7){return _0x5612d7[_0x96ab('0x22')]['email']===_0x3cdb5a;});}else{logger[_0x96ab('0xe')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x96ab('0x11')](_0x96ab('0x23'),_0x48c965['remoteUri'])})[_0x96ab('0x1c')](function(_0x263c38){logger[_0x96ab('0xe')](_0x96ab('0x24'));return _0x263c38;});}});}else{logger[_0x96ab('0xe')](_0x96ab('0x25'));return request({'uri':util[_0x96ab('0x11')]('%s/api/v2/agents/me',_0x48c965[_0x96ab('0x26')])})[_0x96ab('0x1c')](function(_0x5ec8da){logger['info'](_0x96ab('0x24'));return _0x5ec8da;});}}function getEndUser(_0x3d8149,_0x22d2bc,_0x377295){logger[_0x96ab('0xe')](_0x96ab('0x27'),_0x377295);return request({'uri':util[_0x96ab('0x11')](_0x96ab('0x28'),_0x3d8149[_0x96ab('0x26')]),'qs':{'phone':_0x377295}})[_0x96ab('0x1c')](function(_0x11afe6){if(_0x11afe6['length']){logger[_0x96ab('0xe')]('Enduser\x20found!');return _[_0x96ab('0x21')](_0x11afe6,{'phone':_0x377295});}else{logger[_0x96ab('0xe')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x96ab('0x11')](_0x96ab('0x28'),_0x3d8149[_0x96ab('0x26')]),'method':_0x96ab('0x1b'),'body':{'name':_0x22d2bc,'phone':_0x377295}})[_0x96ab('0x1c')](function(_0xcfe0e6){logger[_0x96ab('0xe')](_0x96ab('0x29'));return _0xcfe0e6;});}});}function getAuth(_0x96065a){return util[_0x96ab('0x11')](_0x96ab('0x2a'),new Buffer(_0x96065a['apiKey']+':X')[_0x96ab('0x2b')](_0x96ab('0x2c')));}function request(_0x5dfedb){logger[_0x96ab('0x2d')]('[HTTP]',JSON[_0x96ab('0x2e')](_0x5dfedb));return rp(_[_0x96ab('0x9')](_0x5dfedb,{'method':_0x96ab('0x2f'),'headers':headers,'json':!![]}));}function getTags(_0x515a9c,_0x5e341d){var _0x49741b=[];if(_0x515a9c&&_0x515a9c['length']>0x0){_0x49741b=_[_0x96ab('0x30')](_0x515a9c,_0x5e341d);}return _0x49741b;}function getCustomFields(_0x1f955a,_0x27c40f){var _0x3a472a=[];var _0x21eda0={'custom_fields':[]};if(_0x1f955a[_0x96ab('0x1f')]>0x0){_[_0x96ab('0x31')](_0x1f955a,function(_0x4340bd){if(_[_0x96ab('0x32')]([_0x96ab('0x33'),_0x96ab('0x34')],_0x4340bd[_0x96ab('0x35')])&&_0x4340bd['nameField']&&!_0x4340bd[_0x96ab('0x36')]){_0x21eda0[_0x4340bd[_0x96ab('0x37')][_0x96ab('0x38')]()]=_0x4340bd[_0x96ab('0x39')][_0x96ab('0x2b')]();}else if(_[_0x96ab('0x32')]([_0x96ab('0x33'),_0x96ab('0x34')],_0x4340bd['type'])&&_0x4340bd[_0x96ab('0x3a')]&&_0x4340bd[_0x96ab('0x36')]){_0x21eda0[_0x96ab('0x18')]['push']({'id':_0x4340bd['idField'],'value':_0x4340bd[_0x96ab('0x39')]['toString']()});}else if(_0x4340bd[_0x96ab('0x35')]===_0x96ab('0x3b')&&_0x4340bd[_0x96ab('0x3c')]&&_0x4340bd[_0x96ab('0x3a')]&&_0x4340bd[_0x96ab('0x36')]){_0x27c40f[_0x4340bd[_0x96ab('0x3c')]]&&_0x21eda0[_0x96ab('0x18')][_0x96ab('0x3d')]({'id':_0x4340bd[_0x96ab('0x3a')],'value':_0x27c40f[_0x4340bd['variableName']][_0x96ab('0x2b')]()});}else if(_0x4340bd[_0x96ab('0x35')]===_0x96ab('0x3e')&&_0x4340bd['Variable']&&_0x4340bd['Variable']['name']&&_0x4340bd[_0x96ab('0x3a')]&&_0x4340bd[_0x96ab('0x36')]){_0x27c40f[_0x4340bd[_0x96ab('0x3f')][_0x96ab('0x17')][_0x96ab('0x38')]()]&&_0x21eda0[_0x96ab('0x18')]['push']({'id':_0x4340bd['idField'],'value':_0x27c40f[_0x4340bd['Variable'][_0x96ab('0x17')]['toLowerCase']()][_0x96ab('0x2b')]()});}});}return _0x21eda0;}exports[_0x96ab('0x40')]=function(_0x4b646b,_0x16433b,_0x5a9138,_0x15af08,_0xc5f4ce,_0x4ece7d){var _0x1d79c5,_0x32c505;_0x4ece7d[_0x96ab('0x26')]=intUtil[_0x96ab('0x41')](_0x4ece7d[_0x96ab('0x26')]);_0x4ece7d[_0x96ab('0x42')]=intUtil[_0x96ab('0x41')](_0x4ece7d['serverUrl']);if(_0xc5f4ce&&_0xc5f4ce[_0x96ab('0x43')]){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x16433b[_0x96ab('0x44')]=util[_0x96ab('0x11')](_0x96ab('0x45'),_0x4ece7d[_0x96ab('0x42')],_0x16433b[_0x96ab('0x46')],md5(_0x16433b[_0x96ab('0x46')]));}else{_0x16433b[_0x96ab('0x44')]='';}headers['Authorization']=getAuth(_0x4ece7d);return getUser(_0x4ece7d,_0x15af08[_0x96ab('0x47')])[_0x96ab('0x1c')](function(_0x3a7dd3){_0x1d79c5=_0x3a7dd3;logger[_0x96ab('0xe')]('The\x20User\x20ID\x20is:',_0x1d79c5['id']);return getEndUser(_0x4ece7d,_0x16433b['calleridname'],_0x16433b['calleridnum']);})['then'](function(_0x279e5b){_0x32c505=_0x279e5b;logger['info'](_0x96ab('0x48'),_0x32c505['id']);return getTicket(_0x4ece7d,_0x1d79c5,_0x32c505,_0x5a9138,_0x16433b);})['then'](function(_0x508416){if(_0x508416&&_0x508416['id']){logger[_0x96ab('0xe')]('Ticket\x20created!');logger[_0x96ab('0xe')]('The\x20Ticket\x20ID\x20is:',_0x508416['id']);logger[_0x96ab('0xe')]('[QUEUE]',_0x96ab('0x49'));emit(util[_0x96ab('0x11')](_0x96ab('0x4a'),_0x15af08[_0x96ab('0x17')]),_0x96ab('0x4b'),{'uri':util[_0x96ab('0x11')](_0x96ab('0x4c'),_0x4ece7d[_0x96ab('0x26')],_0x508416['id'])});}})[_0x96ab('0x4d')](function(_0x2886c8){logger[_0x96ab('0x4e')](_0x96ab('0x4f'),JSON[_0x96ab('0x2e')](_0x2886c8));});};exports['outbound']=function(_0x3aee55,_0x46b541,_0x1eeece,_0x43e85b,_0x1f41ba,_0x6f772f,_0x17ace1){var _0x16aab2,_0x87090f;_0x6f772f[_0x96ab('0x26')]=intUtil['stripTrailingSlash'](_0x6f772f[_0x96ab('0x26')]);_0x6f772f[_0x96ab('0x42')]=intUtil[_0x96ab('0x41')](_0x6f772f['serverUrl']);if(_0x17ace1&&_0x17ace1[_0x96ab('0x50')]&&_0x17ace1['recordingFormat']!==_0x96ab('0x51')){logger[_0x96ab('0xe')]('[OUTBOUND]',_0x96ab('0x52'));_0x46b541[_0x96ab('0x44')]=util[_0x96ab('0x11')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x6f772f[_0x96ab('0x42')],_0x46b541[_0x96ab('0x46')],md5(_0x46b541['uniqueid']));}headers[_0x96ab('0x53')]=getAuth(_0x6f772f);return getUser(_0x6f772f,_0x43e85b[_0x96ab('0x47')])[_0x96ab('0x1c')](function(_0x124b1f){_0x16aab2=_0x124b1f;logger['info']('The\x20User\x20ID\x20is:',_0x16aab2['id']);return getEndUser(_0x6f772f,_0x46b541['destcalleridname'],_0x46b541['destcalleridnum']);})[_0x96ab('0x1c')](function(_0x4802ac){_0x87090f=_0x4802ac;logger[_0x96ab('0xe')](_0x96ab('0x48'),_0x87090f['id']);return getTicket(_0x6f772f,_0x16aab2,_0x87090f,_0x1eeece,_0x46b541);})[_0x96ab('0x1c')](function(_0x55757b){if(_0x55757b&&_0x55757b['id']){logger[_0x96ab('0xe')](_0x96ab('0x54'));logger[_0x96ab('0xe')](_0x96ab('0x55'),_0x55757b['id']);logger[_0x96ab('0xe')]('[OUTBOUND]',_0x96ab('0x49'));emit(util['format']('user:%s',_0x43e85b[_0x96ab('0x17')]),_0x96ab('0x4b'),{'uri':util[_0x96ab('0x11')]('%s/helpdesk/tickets/%d',_0x6f772f[_0x96ab('0x26')],_0x55757b['id'])});}})[_0x96ab('0x4d')](function(_0x2dd5a6){logger[_0x96ab('0x4e')](_0x96ab('0x56'),JSON[_0x96ab('0x2e')](_0x2dd5a6));});};exports[_0x96ab('0x57')]=function(_0x48e21d,_0x22a732,_0x169df7,_0x402a9f,_0x53d49a,_0x12e18a){var _0x472bac,_0x183371;_0x12e18a[_0x96ab('0x26')]=intUtil[_0x96ab('0x41')](_0x12e18a[_0x96ab('0x26')]);_0x12e18a['serverUrl']=intUtil['stripTrailingSlash'](_0x12e18a['serverUrl']);if(_0x53d49a&&_0x53d49a[_0x96ab('0x43')]){logger['info']('['+_0x22a732[_0x96ab('0x58')][_0x96ab('0x59')]()+']',_0x96ab('0x52'));_0x22a732['recordingURL']=util['format'](_0x96ab('0x45'),_0x12e18a['serverUrl'],_0x22a732[_0x96ab('0x46')],md5(_0x22a732[_0x96ab('0x46')]));}else{_0x22a732[_0x96ab('0x44')]='';}headers[_0x96ab('0x53')]=getAuth(_0x12e18a);return getUser(_0x12e18a,'')['then'](function(_0x3de99b){_0x472bac=_0x3de99b;logger[_0x96ab('0xe')](_0x96ab('0x5a'),_0x472bac['id']);return getEndUser(_0x12e18a,_0x22a732[_0x96ab('0x5b')],_0x22a732[_0x96ab('0x5c')]);})[_0x96ab('0x1c')](function(_0x2c0baa){_0x183371=_0x2c0baa;logger[_0x96ab('0xe')](_0x96ab('0x48'),_0x183371['id']);return getTicket(_0x12e18a,_0x472bac,_0x183371,_0x169df7,_0x22a732);})['then'](function(_0xe57e4d){if(_0xe57e4d){logger[_0x96ab('0xe')]('Ticket\x20created!');logger[_0x96ab('0xe')](_0x96ab('0x55'),_0xe57e4d['id']);}})[_0x96ab('0x4d')](function(_0x4485e1){logger[_0x96ab('0x4e')]('['+_0x22a732['lastevent']['toUpperCase']()+']',JSON[_0x96ab('0x2e')](_0x4485e1));});}; \ No newline at end of file +var _0x6ab6=['merge','format','Caller\x20-\x20%s','calleridname','Subjects','Descriptions','Tags','name','Fields','custom_fields','mapValues','%s/api/v2/tickets','remoteUri','POST','then','validateEmail','%s/api/v2/agents','length','Agent\x20found!','find','contact','email','%s/api/v2/agents/me','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','debug','[HTTP]','stringify','GET','forEach','string','picklist','type','nameField','customField','toLowerCase','content','push','idField','variable','variableName','customVariable','Variable','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','outbound','recordingFormat','none','[OUTBOUND]','Authorization','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','%s/helpdesk/tickets/%d','toUpperCase','calleridnum','lodash','request-promise','util','ioredis','./util','../../../../config/environment','../../../../config/logger','defaults','redis','application/json','emit','info'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x6ab6,0xa8));var _0x66ab=function(_0x38c77e,_0xc2d593){_0x38c77e=_0x38c77e-0x0;var _0x430fa5=_0x6ab6[_0x38c77e];return _0x430fa5;};'use strict';var _=require(_0x66ab('0x0'));var rp=require(_0x66ab('0x1'));var md5=require('md5');var util=require(_0x66ab('0x2'));var Redis=require(_0x66ab('0x3'));var intUtil=require(_0x66ab('0x4'));var config=require(_0x66ab('0x5'));var logger=require(_0x66ab('0x6'))('freshdesk');config['redis']=_[_0x66ab('0x7')](config[_0x66ab('0x8')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var headers={'Content-Type':_0x66ab('0x9'),'Accept':_0x66ab('0x9')};function emit(_0x176102,_0x486a3b,_0x1031d0){io['to'](_0x176102)[_0x66ab('0xa')](_0x486a3b,_0x1031d0);}function getTicket(_0x287dce,_0x1b35f9,_0xbd10f3,_0x444f77,_0x35b100){logger[_0x66ab('0xb')]('Creating\x20new\x20ticket...');var _0x1b7a8f=_[_0x66ab('0xc')]({'responder_id':_0x1b35f9['id'],'requester_id':_0xbd10f3['id'],'name':util[_0x66ab('0xd')](_0x66ab('0xe'),_0x35b100[_0x66ab('0xf')]),'phone':_0x35b100['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x444f77[_0x66ab('0x10')],_0x35b100,'\x20'),'description':intUtil['getString'](_0x444f77[_0x66ab('0x11')],_0x35b100,'
'),'tags':getTags(_0x444f77[_0x66ab('0x12')],_0x66ab('0x13'))},getCustomFields(_0x444f77[_0x66ab('0x14')],_0x35b100));_0x1b7a8f[_0x66ab('0x15')]=_[_0x66ab('0x16')](_['keyBy'](_0x1b7a8f['custom_fields'],'id'),'value');return request({'uri':util[_0x66ab('0xd')](_0x66ab('0x17'),_0x287dce[_0x66ab('0x18')]),'method':_0x66ab('0x19'),'body':_0x1b7a8f})[_0x66ab('0x1a')](function(_0x53b31d){logger[_0x66ab('0xb')]('Ticket\x20created!');return _0x53b31d;});}function getUser(_0x2fbe00,_0x3b58e2){if(intUtil[_0x66ab('0x1b')](_0x3b58e2)){return request({'uri':util[_0x66ab('0xd')](_0x66ab('0x1c'),_0x2fbe00[_0x66ab('0x18')]),'qs':{'email':_0x3b58e2}})['then'](function(_0x2dedbb){if(_0x2dedbb[_0x66ab('0x1d')]){logger[_0x66ab('0xb')](_0x66ab('0x1e'));return _[_0x66ab('0x1f')](_0x2dedbb,function(_0x1a9b40){return _0x1a9b40[_0x66ab('0x20')][_0x66ab('0x21')]===_0x3b58e2;});}else{logger[_0x66ab('0xb')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0x66ab('0x22'),_0x2fbe00['remoteUri'])})[_0x66ab('0x1a')](function(_0x45e0a2){logger['info'](_0x66ab('0x23'));return _0x45e0a2;});}});}else{logger[_0x66ab('0xb')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format']('%s/api/v2/agents/me',_0x2fbe00[_0x66ab('0x18')])})[_0x66ab('0x1a')](function(_0x142c97){logger[_0x66ab('0xb')](_0x66ab('0x23'));return _0x142c97;});}}function getEndUser(_0x493951,_0x44144e,_0x3907c5){logger['info'](_0x66ab('0x24'),_0x3907c5);return request({'uri':util[_0x66ab('0xd')](_0x66ab('0x25'),_0x493951[_0x66ab('0x18')]),'qs':{'phone':_0x3907c5}})[_0x66ab('0x1a')](function(_0x541b63){if(_0x541b63['length']){logger[_0x66ab('0xb')](_0x66ab('0x26'));return _['find'](_0x541b63,{'phone':_0x3907c5});}else{logger['info'](_0x66ab('0x27'));return request({'uri':util[_0x66ab('0xd')](_0x66ab('0x25'),_0x493951[_0x66ab('0x18')]),'method':_0x66ab('0x19'),'body':{'name':_0x44144e,'phone':_0x3907c5}})[_0x66ab('0x1a')](function(_0xa22c8b){logger[_0x66ab('0xb')](_0x66ab('0x28'));return _0xa22c8b;});}});}function getAuth(_0xd1eaaf){return util['format'](_0x66ab('0x29'),new Buffer(_0xd1eaaf[_0x66ab('0x2a')]+':X')[_0x66ab('0x2b')](_0x66ab('0x2c')));}function request(_0x1c95b2){logger[_0x66ab('0x2d')](_0x66ab('0x2e'),JSON[_0x66ab('0x2f')](_0x1c95b2));return rp(_[_0x66ab('0x7')](_0x1c95b2,{'method':_0x66ab('0x30'),'headers':headers,'json':!![]}));}function getTags(_0x2ff43e,_0x3e2930){var _0x1d8653=[];if(_0x2ff43e&&_0x2ff43e['length']>0x0){_0x1d8653=_['map'](_0x2ff43e,_0x3e2930);}return _0x1d8653;}function getCustomFields(_0x41a0b8,_0x4cb96d){var _0x2a66ab=[];var _0x30e2f8={'custom_fields':[]};if(_0x41a0b8[_0x66ab('0x1d')]>0x0){_[_0x66ab('0x31')](_0x41a0b8,function(_0x5c65db){if(_['includes']([_0x66ab('0x32'),_0x66ab('0x33')],_0x5c65db[_0x66ab('0x34')])&&_0x5c65db[_0x66ab('0x35')]&&!_0x5c65db[_0x66ab('0x36')]){_0x30e2f8[_0x5c65db['nameField'][_0x66ab('0x37')]()]=_0x5c65db[_0x66ab('0x38')][_0x66ab('0x2b')]();}else if(_['includes']([_0x66ab('0x32'),_0x66ab('0x33')],_0x5c65db[_0x66ab('0x34')])&&_0x5c65db['idField']&&_0x5c65db[_0x66ab('0x36')]){_0x30e2f8['custom_fields'][_0x66ab('0x39')]({'id':_0x5c65db[_0x66ab('0x3a')],'value':_0x5c65db[_0x66ab('0x38')][_0x66ab('0x2b')]()});}else if(_0x5c65db[_0x66ab('0x34')]===_0x66ab('0x3b')&&_0x5c65db[_0x66ab('0x3c')]&&_0x5c65db[_0x66ab('0x3a')]&&_0x5c65db['customField']){_0x4cb96d[_0x5c65db[_0x66ab('0x3c')]]&&_0x30e2f8[_0x66ab('0x15')][_0x66ab('0x39')]({'id':_0x5c65db['idField'],'value':_0x4cb96d[_0x5c65db[_0x66ab('0x3c')]][_0x66ab('0x2b')]()});}else if(_0x5c65db[_0x66ab('0x34')]===_0x66ab('0x3d')&&_0x5c65db[_0x66ab('0x3e')]&&_0x5c65db['Variable'][_0x66ab('0x13')]&&_0x5c65db[_0x66ab('0x3a')]&&_0x5c65db[_0x66ab('0x36')]){_0x4cb96d[_0x5c65db[_0x66ab('0x3e')][_0x66ab('0x13')][_0x66ab('0x37')]()]&&_0x30e2f8[_0x66ab('0x15')]['push']({'id':_0x5c65db[_0x66ab('0x3a')],'value':_0x4cb96d[_0x5c65db[_0x66ab('0x3e')][_0x66ab('0x13')][_0x66ab('0x37')]()][_0x66ab('0x2b')]()});}});}return _0x30e2f8;}exports['queue']=function(_0x5935df,_0x1351fb,_0x558141,_0x289e23,_0x195b0a,_0x7223cc){var _0x93781c,_0x3c5ce4;_0x7223cc['remoteUri']=intUtil['stripTrailingSlash'](_0x7223cc[_0x66ab('0x18')]);_0x7223cc[_0x66ab('0x3f')]=intUtil[_0x66ab('0x40')](_0x7223cc['serverUrl']);if(_0x195b0a&&_0x195b0a[_0x66ab('0x41')]){logger[_0x66ab('0xb')](_0x66ab('0x42'),_0x66ab('0x43'));_0x1351fb[_0x66ab('0x44')]=util[_0x66ab('0xd')](_0x66ab('0x45'),_0x7223cc[_0x66ab('0x3f')],_0x1351fb['uniqueid'],md5(_0x1351fb[_0x66ab('0x46')]));}else{_0x1351fb[_0x66ab('0x44')]='';}headers['Authorization']=getAuth(_0x7223cc);return getUser(_0x7223cc,_0x289e23[_0x66ab('0x21')])['then'](function(_0x588c17){_0x93781c=_0x588c17;logger[_0x66ab('0xb')]('The\x20User\x20ID\x20is:',_0x93781c['id']);return getEndUser(_0x7223cc,_0x1351fb['calleridname'],_0x1351fb['calleridnum']);})[_0x66ab('0x1a')](function(_0x6dc39){_0x3c5ce4=_0x6dc39;logger['info']('The\x20Enduser\x20ID\x20is:',_0x3c5ce4['id']);return getTicket(_0x7223cc,_0x93781c,_0x3c5ce4,_0x558141,_0x1351fb);})[_0x66ab('0x1a')](function(_0x3b0027){if(_0x3b0027&&_0x3b0027['id']){logger[_0x66ab('0xb')](_0x66ab('0x47'));logger[_0x66ab('0xb')](_0x66ab('0x48'),_0x3b0027['id']);logger['info']('[QUEUE]',_0x66ab('0x49'));emit(util['format'](_0x66ab('0x4a'),_0x289e23[_0x66ab('0x13')]),_0x66ab('0x4b'),{'uri':util[_0x66ab('0xd')]('%s/helpdesk/tickets/%d',_0x7223cc[_0x66ab('0x18')],_0x3b0027['id'])});}})[_0x66ab('0x4c')](function(_0x4a4b1a){logger[_0x66ab('0x4d')]('[QUEUE]',JSON[_0x66ab('0x2f')](_0x4a4b1a));});};exports[_0x66ab('0x4e')]=function(_0x118980,_0x375111,_0x40a11c,_0x451dda,_0x12d8f1,_0x558e55,_0x1b5762){var _0xb435d9,_0x59994a;_0x558e55['remoteUri']=intUtil[_0x66ab('0x40')](_0x558e55['remoteUri']);_0x558e55['serverUrl']=intUtil['stripTrailingSlash'](_0x558e55[_0x66ab('0x3f')]);if(_0x1b5762&&_0x1b5762[_0x66ab('0x4f')]&&_0x1b5762['recordingFormat']!==_0x66ab('0x50')){logger['info'](_0x66ab('0x51'),_0x66ab('0x43'));_0x375111[_0x66ab('0x44')]=util[_0x66ab('0xd')](_0x66ab('0x45'),_0x558e55['serverUrl'],_0x375111[_0x66ab('0x46')],md5(_0x375111[_0x66ab('0x46')]));}headers[_0x66ab('0x52')]=getAuth(_0x558e55);return getUser(_0x558e55,_0x451dda[_0x66ab('0x21')])[_0x66ab('0x1a')](function(_0x2142bc){_0xb435d9=_0x2142bc;logger[_0x66ab('0xb')](_0x66ab('0x53'),_0xb435d9['id']);return getEndUser(_0x558e55,_0x375111[_0x66ab('0x54')],_0x375111[_0x66ab('0x55')]);})[_0x66ab('0x1a')](function(_0x387eaa){_0x59994a=_0x387eaa;logger['info'](_0x66ab('0x56'),_0x59994a['id']);return getTicket(_0x558e55,_0xb435d9,_0x59994a,_0x40a11c,_0x375111);})['then'](function(_0x403a7e){if(_0x403a7e&&_0x403a7e['id']){logger['info'](_0x66ab('0x47'));logger[_0x66ab('0xb')](_0x66ab('0x48'),_0x403a7e['id']);logger['info'](_0x66ab('0x51'),_0x66ab('0x49'));emit(util[_0x66ab('0xd')](_0x66ab('0x4a'),_0x451dda['name']),'trigger:browser:url',{'uri':util[_0x66ab('0xd')](_0x66ab('0x57'),_0x558e55['remoteUri'],_0x403a7e['id'])});}})[_0x66ab('0x4c')](function(_0x3273f6){logger[_0x66ab('0x4d')](_0x66ab('0x51'),JSON['stringify'](_0x3273f6));});};exports['unmanaged']=function(_0x4301b9,_0x1154bd,_0x402bee,_0x276fcd,_0x2fb082,_0x1f3314){var _0x13e941,_0x227be3;_0x1f3314[_0x66ab('0x18')]=intUtil['stripTrailingSlash'](_0x1f3314[_0x66ab('0x18')]);_0x1f3314[_0x66ab('0x3f')]=intUtil[_0x66ab('0x40')](_0x1f3314[_0x66ab('0x3f')]);if(_0x2fb082&&_0x2fb082[_0x66ab('0x41')]){logger[_0x66ab('0xb')]('['+_0x1154bd['lastevent'][_0x66ab('0x58')]()+']',_0x66ab('0x43'));_0x1154bd[_0x66ab('0x44')]=util[_0x66ab('0xd')](_0x66ab('0x45'),_0x1f3314[_0x66ab('0x3f')],_0x1154bd[_0x66ab('0x46')],md5(_0x1154bd[_0x66ab('0x46')]));}else{_0x1154bd[_0x66ab('0x44')]='';}headers[_0x66ab('0x52')]=getAuth(_0x1f3314);return getUser(_0x1f3314,'')[_0x66ab('0x1a')](function(_0x10823b){_0x13e941=_0x10823b;logger['info']('The\x20User\x20ID\x20is:',_0x13e941['id']);return getEndUser(_0x1f3314,_0x1154bd['calleridname'],_0x1154bd[_0x66ab('0x59')]);})['then'](function(_0x4a8510){_0x227be3=_0x4a8510;logger[_0x66ab('0xb')](_0x66ab('0x56'),_0x227be3['id']);return getTicket(_0x1f3314,_0x13e941,_0x227be3,_0x402bee,_0x1154bd);})[_0x66ab('0x1a')](function(_0x4be09f){if(_0x4be09f){logger[_0x66ab('0xb')]('Ticket\x20created!');logger[_0x66ab('0xb')](_0x66ab('0x48'),_0x4be09f['id']);}})[_0x66ab('0x4c')](function(_0x17335e){logger[_0x66ab('0x4d')]('['+_0x1154bd['lastevent'][_0x66ab('0x58')]()+']',JSON[_0x66ab('0x2f')](_0x17335e));});}; \ 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 eba3ee4..5bed3b3 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 _0x26cc=['calleridnum','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','recordingFormat','none','[OUTBOUND]','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','unmanaged','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','util','moment','bluebird','ioredis','freshsales','redis','defaults','socket.io-emitter','GET','headers','info','Getting\x20admin\x20information','then','length','email','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','toUpperCase','message','/api/selector/owners','Getting\x20user\x20list','users','agentEmail','Getting\x20user\x20with\x20email','userId','User\x20found:','Admin\x20selected','userEmail','adminEmail','error','/api/lookup?q=','&f=','&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','Creating\x20new\x20task','/api/tasks','getString','Descriptions','Contact','add','ticketId','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','serverUrl','stripTrailingSlash','username','toLowerCase','outbound'];(function(_0x2d3711,_0x43d60d){var _0x477858=function(_0x4ffb1c){while(--_0x4ffb1c){_0x2d3711['push'](_0x2d3711['shift']());}};_0x477858(++_0x43d60d);}(_0x26cc,0x170));var _0xc26c=function(_0x44bcb0,_0x235aa9){_0x44bcb0=_0x44bcb0-0x0;var _0xfaf881=_0x26cc[_0x44bcb0];return _0xfaf881;};'use strict';var _=require(_0xc26c('0x0'));var rp=require(_0xc26c('0x1'));var md5=require(_0xc26c('0x2'));var util=require(_0xc26c('0x3'));var moment=require(_0xc26c('0x4'));var Promise=require(_0xc26c('0x5'));var Redis=require(_0xc26c('0x6'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0xc26c('0x7'));config[_0xc26c('0x8')]=_[_0xc26c('0x9')](config[_0xc26c('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0xc26c('0xa'))(new Redis(config[_0xc26c('0x8')]));function getAdminId(_0x41ae5e,_0x311c16,_0x4ad4d3,_0x3f41a6){return new Promise(function(_0x1ed9dd,_0x33a872){var _0x40a6d6=![];var _0xfc238e={'method':_0xc26c('0xb'),'uri':_0x3f41a6+'/api/selector/owners','json':!![]};_0xfc238e[_0xc26c('0xc')]=_0x4ad4d3;logger[_0xc26c('0xd')](_0xc26c('0xe'));return rp(_0xfc238e)[_0xc26c('0xf')](function(_0x4154a5){if(_0x4154a5){var _0x19299a=_0x4154a5['users'];var _0x318b10=null;for(_0x318b10=0x0;_0x318b10<_0x19299a[_0xc26c('0x10')];_0x318b10++){if(_0x19299a[_0x318b10][_0xc26c('0x11')]===_0x41ae5e['adminEmail']){_0x41ae5e[_0xc26c('0x12')]=_0x19299a[_0x318b10]['id'];_0x40a6d6=!![];}}if(_0x40a6d6){logger['info'](_0xc26c('0x13'),_0x41ae5e[_0xc26c('0x12')]);_0x1ed9dd(_0x41ae5e);}else{_0x33a872({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x33a872({'statusCode':0x194,'message':_0xc26c('0x14')});}})[_0xc26c('0x15')](function(_0x55f488){logger['error']('['+[_0x311c16[_0xc26c('0x16')]()]+']',_0x55f488[_0xc26c('0x17')]);_0x33a872(_0x55f488);});});}function getUser(_0x2e6f7f,_0x281548,_0x396484){return function(_0x22e247){return new Promise(function(_0x53a89a,_0x324e61){var _0x399c04={'method':_0xc26c('0xb'),'uri':_0x396484+_0xc26c('0x18'),'json':!![]};_0x399c04[_0xc26c('0xc')]=_0x281548;logger[_0xc26c('0xd')](_0xc26c('0x19'));return rp(_0x399c04)['then'](function(_0x3dace7){if(_0x3dace7){var _0x4d0bff=_0x3dace7[_0xc26c('0x1a')];var _0x42cf1d=![];var _0x2e3d70=null;if(_0x22e247[_0xc26c('0x1b')]!==null){logger['info'](_0xc26c('0x1c'),_0x22e247[_0xc26c('0x1b')]);_0x22e247['userEmail']=_0x22e247['agentEmail'];for(_0x2e3d70=0x0;_0x2e3d70<_0x4d0bff['length'];_0x2e3d70++){if(_0x4d0bff[_0x2e3d70]['email']===_0x22e247['agentEmail']){_0x42cf1d=!![];_0x22e247[_0xc26c('0x1d')]=_0x4d0bff[_0x2e3d70]['id'];logger[_0xc26c('0xd')](_0xc26c('0x1e'),_0x22e247[_0xc26c('0x1d')]);}}}if(!_0x42cf1d){logger[_0xc26c('0xd')](_0xc26c('0x1f'));_0x22e247[_0xc26c('0x20')]=_0x22e247[_0xc26c('0x21')];_0x22e247[_0xc26c('0x1d')]=_0x22e247['adminId'];_0x42cf1d=!![];}if(_0x42cf1d){_0x53a89a(_0x22e247);}else{_0x324e61({'statusCode':0x194,'message':_0xc26c('0x14')});}}else{_0x324e61({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0xc26c('0x15')](function(_0x4ec3e9){logger[_0xc26c('0x22')]('['+[_0x2e6f7f['toUpperCase']()]+']',_0x4ec3e9['message']);_0x324e61(_0x4ec3e9);});});};}function searchContact(_0x1516d7,_0x2fd2d9,_0x514197,_0x192a7d){return new Promise(function(_0xa80bdc,_0x3e65de){var _0x4dc7dd={'method':_0xc26c('0xb'),'headers':_0x2fd2d9,'uri':_0x1516d7+_0xc26c('0x23')+_0x192a7d+_0xc26c('0x24')+_0x514197+_0xc26c('0x25'),'json':!![]};rp(_0x4dc7dd)['then'](function(_0x860ec9){var _0x453edd=_[_0xc26c('0x26')](_0x860ec9[_0xc26c('0x27')][_0xc26c('0x27')],[_0x514197,_0x192a7d]);_0xa80bdc(_0x453edd);})['catch'](function(_0x3aa2de){_0x3e65de(_0x3aa2de);});});}function getEndUser(_0x3e7442,_0x27c4ae,_0x31a1ad){return function(_0x32c713){return new Promise(function(_0x630d3b,_0x1ef3d8){logger[_0xc26c('0xd')](util[_0xc26c('0x28')](_0xc26c('0x29'),_0x32c713[_0xc26c('0x2a')]));searchContact(_0x31a1ad,_0x27c4ae,_0xc26c('0x2b'),_0x32c713['contactNumber'])[_0xc26c('0xf')](function(_0x5dccd1){if(_0x5dccd1){_0x32c713[_0xc26c('0x2c')]=_0x5dccd1['id'];logger['info'](_0xc26c('0x2d'),_0x32c713[_0xc26c('0x2c')]);return _0x630d3b(_0x32c713);}searchContact(_0x31a1ad,_0x27c4ae,_0xc26c('0x2e'),_0x32c713['contactNumber'])['then'](function(_0x54a136){if(_0x54a136){_0x32c713[_0xc26c('0x2c')]=_0x54a136['id'];logger[_0xc26c('0xd')](_0xc26c('0x2f'),_0x32c713[_0xc26c('0x2c')]);return _0x630d3b(_0x32c713);}createEndUser(_0x32c713,_0x3e7442,_0x27c4ae,_0x31a1ad)[_0xc26c('0xf')](function(_0x5435ab){logger['info'](_0xc26c('0x30'),_0x5435ab[_0xc26c('0x2c')]);return _0x630d3b(_0x5435ab);});});})['catch'](function(_0x3d0ecb){_0x1ef3d8(_0x3d0ecb);});});};}function createEndUser(_0xdad585,_0x51a6bf,_0x118018,_0x21cce4){return new Promise(function(_0x1b0b2d,_0x502255){var _0x190b0=moment();var _0x350e6a={'method':_0xc26c('0x31'),'uri':_0x21cce4+_0xc26c('0x32'),'body':{'contact':{'last_name':_0xdad585['contactNumber'],'work_number':_0xdad585[_0xc26c('0x2a')],'mobile_number':_0xdad585[_0xc26c('0x2a')],'owner_id':_0xdad585[_0xc26c('0x1d')],'created_at':_0x190b0[_0xc26c('0x28')](_0xc26c('0x33'))}},'json':!![]};_0x350e6a[_0xc26c('0xc')]=_0x118018;logger[_0xc26c('0xd')](_0xc26c('0x34'));return rp(_0x350e6a)[_0xc26c('0xf')](function(_0x509cec){_0xdad585[_0xc26c('0x2c')]=_0x509cec['contact']['id'];_0x1b0b2d(_0xdad585);})[_0xc26c('0x15')](function(_0x50da26){logger[_0xc26c('0x22')]('['+[_0x51a6bf[_0xc26c('0x16')]()]+']',_0x50da26[_0xc26c('0x17')]);_0x502255(_0x50da26['message']);});});}function getTicket(_0x5caf29,_0x2248ef,_0x100faf,_0x3b2741,_0x1f4176){return function(_0x26ac19){logger[_0xc26c('0xd')](_0xc26c('0x35'));return new Promise(function(_0x2c7d33,_0x3ac65d){var _0x12f46e=moment();var _0x2a2661={'method':_0xc26c('0x31'),'uri':_0x100faf+_0xc26c('0x36'),'body':{'title':intUtil[_0xc26c('0x37')](_0x3b2741['Subjects'],_0x1f4176,'\x20'),'description':intUtil[_0xc26c('0x37')](_0x3b2741[_0xc26c('0x38')],_0x1f4176,'\x0a'),'owner_id':_0x26ac19['userId'],'creater_id':_0x26ac19[_0xc26c('0x12')],'targetable_id':_0x26ac19[_0xc26c('0x2c')],'targetable_type':_0xc26c('0x39'),'created_at':_0x12f46e[_0xc26c('0x28')](_0xc26c('0x33')),'due_date':_0x12f46e[_0xc26c('0x3a')](0x1e,'m')[_0xc26c('0x28')](_0xc26c('0x33'))},'json':!![]};_0x2a2661['headers']=_0x2248ef;return rp(_0x2a2661)[_0xc26c('0xf')](function(_0x3254e4){_0x26ac19[_0xc26c('0x3b')]=_0x3254e4['task']['id'];logger[_0xc26c('0xd')]('Task\x20created:',_0x26ac19[_0xc26c('0x3b')]);_0x2c7d33(_0x26ac19);})['catch'](function(_0x321a2b){logger['error']('['+[_0x5caf29[_0xc26c('0x16')]()]+']',_0x321a2b['message']);_0x3ac65d(_0x321a2b[_0xc26c('0x17')]);});});};}function emit(_0x54a5b3,_0x3d02f9,_0x56d73a){var _0x1db30e={'uri':_0x54a5b3+_0xc26c('0x3c')+_0x56d73a};io['to'](util[_0xc26c('0x28')](_0xc26c('0x3d'),_0x3d02f9))[_0xc26c('0x3e')](_0xc26c('0x3f'),_0x1db30e);}exports['cs']=function(_0x1f14ab,_0x363e2d,_0x5a9046,_0x23aa33,_0x3b27e5,_0x1d9caf,_0x525fb9,_0x5a1fb2){var _0x4bcc92={};var _0x1211ad={'Authorization':_0xc26c('0x40')+_0x1d9caf[_0xc26c('0x41')]};_0x1d9caf['remoteUri']=intUtil['stripTrailingSlash'](_0x1d9caf[_0xc26c('0x42')]);_0x1d9caf[_0xc26c('0x43')]=intUtil[_0xc26c('0x44')](_0x1d9caf[_0xc26c('0x43')]);var _0x29289e=_0x1d9caf[_0xc26c('0x42')];_0x4bcc92[_0xc26c('0x21')]=_0x1d9caf[_0xc26c('0x45')];_0x4bcc92[_0xc26c('0x2a')]=_0x5a1fb2[_0xc26c('0x46')]()===_0xc26c('0x47')?_0x363e2d['destcalleridnum']:_0x363e2d[_0xc26c('0x48')];_0x4bcc92['callDirection']=_0x5a1fb2===_0xc26c('0x49')||_0x5a1fb2==='unmanaged'?'queue':_0xc26c('0x47');if(_0x23aa33){_0x4bcc92[_0xc26c('0x1b')]=_0x23aa33[_0xc26c('0x11')];}var _0x241516=util['format'](_0xc26c('0x4a'),_0x1d9caf[_0xc26c('0x43')],_0x363e2d[_0xc26c('0x4b')],md5(_0x363e2d[_0xc26c('0x4b')]));if(_0x3b27e5&&_0x3b27e5[_0xc26c('0x4c')]){logger[_0xc26c('0xd')](_0xc26c('0x4d'),'Recording\x20is\x20enabled!');_0x363e2d['recordingURL']=_0x241516;}else if(_0x525fb9&&_0x525fb9[_0xc26c('0x4e')]&&_0x525fb9[_0xc26c('0x4e')]!==_0xc26c('0x4f')){logger['info'](_0xc26c('0x50'),'Recording\x20is\x20enabled!');_0x363e2d[_0xc26c('0x51')]=_0x241516;}else{_0x363e2d[_0xc26c('0x51')]='';}return getAdminId(_0x4bcc92,_0x5a1fb2,_0x1211ad,_0x29289e)['then'](getUser(_0x5a1fb2,_0x1211ad,_0x29289e))[_0xc26c('0xf')](getEndUser(_0x5a1fb2,_0x1211ad,_0x29289e))['then'](getTicket(_0x5a1fb2,_0x1211ad,_0x29289e,_0x5a9046,_0x363e2d))[_0xc26c('0xf')](function(_0x5a33aa){logger[_0xc26c('0xd')](util[_0xc26c('0x28')](_0xc26c('0x52'),_0x5a33aa[_0xc26c('0x3b')]));if(_0x5a1fb2!==_0xc26c('0x53')){logger[_0xc26c('0xd')]('['+[_0x5a1fb2[_0xc26c('0x16')]()]+']',_0xc26c('0x54'));emit(_0x29289e,_0x23aa33[_0xc26c('0x55')],_0x5a33aa['endUserId']);}})['catch'](function(_0x2383fe){logger[_0xc26c('0x22')]('['+[_0x5a1fb2[_0xc26c('0x16')]()]+_0xc26c('0x56'),util[_0xc26c('0x57')](_0x2383fe,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x5233=['Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','outbound','destcalleridnum','calleridnum','callDirection','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','recordingFormat','Recording\x20is\x20enabled!','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','inspect','request-promise','util','moment','bluebird','ioredis','../../../../config/environment','../../../../config/logger','freshsales','defaults','redis','localhost','socket.io-emitter','GET','info','Getting\x20admin\x20information','users','length','email','adminId','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','/api/selector/owners','headers','Getting\x20user\x20list','then','agentEmail','Getting\x20user\x20with\x20email','userEmail','userId','User\x20found:','Admin\x20selected','adminEmail','&f=','&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','Contact\x20created:','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','getString','Descriptions','Contact','add','ticketId','task','Task\x20created:','/contacts/','emit','trigger:browser:url'];(function(_0x40efef,_0x2bf058){var _0x24a6b6=function(_0x4334c1){while(--_0x4334c1){_0x40efef['push'](_0x40efef['shift']());}};_0x24a6b6(++_0x2bf058);}(_0x5233,0x1b9));var _0x3523=function(_0xddb97e,_0x43cdef){_0xddb97e=_0xddb97e-0x0;var _0x389dda=_0x5233[_0xddb97e];return _0x389dda;};'use strict';var _=require('lodash');var rp=require(_0x3523('0x0'));var md5=require('md5');var util=require(_0x3523('0x1'));var moment=require(_0x3523('0x2'));var Promise=require(_0x3523('0x3'));var Redis=require(_0x3523('0x4'));var intUtil=require('./util');var config=require(_0x3523('0x5'));var logger=require(_0x3523('0x6'))(_0x3523('0x7'));config['redis']=_[_0x3523('0x8')](config[_0x3523('0x9')],{'host':_0x3523('0xa'),'port':0x18eb});var io=require(_0x3523('0xb'))(new Redis(config[_0x3523('0x9')]));function getAdminId(_0x5a946d,_0x537333,_0x5e0769,_0x532929){return new Promise(function(_0x2acb6d,_0x509ecd){var _0x3aa7e2=![];var _0x176f09={'method':_0x3523('0xc'),'uri':_0x532929+'/api/selector/owners','json':!![]};_0x176f09['headers']=_0x5e0769;logger[_0x3523('0xd')](_0x3523('0xe'));return rp(_0x176f09)['then'](function(_0x168e84){if(_0x168e84){var _0xf86a54=_0x168e84[_0x3523('0xf')];var _0x2a673d=null;for(_0x2a673d=0x0;_0x2a673d<_0xf86a54[_0x3523('0x10')];_0x2a673d++){if(_0xf86a54[_0x2a673d][_0x3523('0x11')]===_0x5a946d['adminEmail']){_0x5a946d['adminId']=_0xf86a54[_0x2a673d]['id'];_0x3aa7e2=!![];}}if(_0x3aa7e2){logger['info']('Admin\x20found:',_0x5a946d[_0x3523('0x12')]);_0x2acb6d(_0x5a946d);}else{_0x509ecd({'statusCode':0x194,'message':_0x3523('0x13')});}}else{_0x509ecd({'statusCode':0x194,'message':_0x3523('0x13')});}})[_0x3523('0x14')](function(_0x174b34){logger[_0x3523('0x15')]('['+[_0x537333[_0x3523('0x16')]()]+']',_0x174b34[_0x3523('0x17')]);_0x509ecd(_0x174b34);});});}function getUser(_0x100a03,_0x44e73e,_0x3f8737){return function(_0x2ae632){return new Promise(function(_0xf74e08,_0x1459ab){var _0x2fe6b8={'method':_0x3523('0xc'),'uri':_0x3f8737+_0x3523('0x18'),'json':!![]};_0x2fe6b8[_0x3523('0x19')]=_0x44e73e;logger[_0x3523('0xd')](_0x3523('0x1a'));return rp(_0x2fe6b8)[_0x3523('0x1b')](function(_0x4d4ed3){if(_0x4d4ed3){var _0x8ccbad=_0x4d4ed3['users'];var _0x3c7fd4=![];var _0x3d14c1=null;if(_0x2ae632[_0x3523('0x1c')]!==null){logger['info'](_0x3523('0x1d'),_0x2ae632[_0x3523('0x1c')]);_0x2ae632[_0x3523('0x1e')]=_0x2ae632[_0x3523('0x1c')];for(_0x3d14c1=0x0;_0x3d14c1<_0x8ccbad[_0x3523('0x10')];_0x3d14c1++){if(_0x8ccbad[_0x3d14c1][_0x3523('0x11')]===_0x2ae632[_0x3523('0x1c')]){_0x3c7fd4=!![];_0x2ae632[_0x3523('0x1f')]=_0x8ccbad[_0x3d14c1]['id'];logger[_0x3523('0xd')](_0x3523('0x20'),_0x2ae632[_0x3523('0x1f')]);}}}if(!_0x3c7fd4){logger[_0x3523('0xd')](_0x3523('0x21'));_0x2ae632['userEmail']=_0x2ae632[_0x3523('0x22')];_0x2ae632[_0x3523('0x1f')]=_0x2ae632[_0x3523('0x12')];_0x3c7fd4=!![];}if(_0x3c7fd4){_0xf74e08(_0x2ae632);}else{_0x1459ab({'statusCode':0x194,'message':_0x3523('0x13')});}}else{_0x1459ab({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x3523('0x14')](function(_0x494ff1){logger[_0x3523('0x15')]('['+[_0x100a03[_0x3523('0x16')]()]+']',_0x494ff1[_0x3523('0x17')]);_0x1459ab(_0x494ff1);});});};}function searchContact(_0x947444,_0x1c6263,_0x481258,_0x29287d){return new Promise(function(_0x51675c,_0x33407c){var _0x5b99bf={'method':_0x3523('0xc'),'headers':_0x1c6263,'uri':_0x947444+'/api/lookup?q='+_0x29287d+_0x3523('0x23')+_0x481258+_0x3523('0x24'),'json':!![]};rp(_0x5b99bf)['then'](function(_0x5c7f0f){var _0x338a8c=_[_0x3523('0x25')](_0x5c7f0f[_0x3523('0x26')][_0x3523('0x26')],[_0x481258,_0x29287d]);_0x51675c(_0x338a8c);})['catch'](function(_0x49d734){_0x33407c(_0x49d734);});});}function getEndUser(_0x2cbefe,_0x2fdb61,_0x585a64){return function(_0x8b4cef){return new Promise(function(_0x2438cd,_0x4a567a){logger[_0x3523('0xd')](util[_0x3523('0x27')](_0x3523('0x28'),_0x8b4cef[_0x3523('0x29')]));searchContact(_0x585a64,_0x2fdb61,_0x3523('0x2a'),_0x8b4cef['contactNumber'])['then'](function(_0x36c252){if(_0x36c252){_0x8b4cef[_0x3523('0x2b')]=_0x36c252['id'];logger[_0x3523('0xd')](_0x3523('0x2c'),_0x8b4cef[_0x3523('0x2b')]);return _0x2438cd(_0x8b4cef);}searchContact(_0x585a64,_0x2fdb61,_0x3523('0x2d'),_0x8b4cef[_0x3523('0x29')])[_0x3523('0x1b')](function(_0x330b3e){if(_0x330b3e){_0x8b4cef[_0x3523('0x2b')]=_0x330b3e['id'];logger[_0x3523('0xd')](_0x3523('0x2e'),_0x8b4cef[_0x3523('0x2b')]);return _0x2438cd(_0x8b4cef);}createEndUser(_0x8b4cef,_0x2cbefe,_0x2fdb61,_0x585a64)[_0x3523('0x1b')](function(_0x3fc758){logger[_0x3523('0xd')](_0x3523('0x2f'),_0x3fc758['endUserId']);return _0x2438cd(_0x3fc758);});});})['catch'](function(_0x10999f){_0x4a567a(_0x10999f);});});};}function createEndUser(_0x498380,_0x3735e1,_0x564385,_0x41e38c){return new Promise(function(_0x2982a5,_0x43c75a){var _0x21b139=moment();var _0x17b95b={'method':'POST','uri':_0x41e38c+_0x3523('0x30'),'body':{'contact':{'last_name':_0x498380[_0x3523('0x29')],'work_number':_0x498380[_0x3523('0x29')],'mobile_number':_0x498380[_0x3523('0x29')],'owner_id':_0x498380[_0x3523('0x1f')],'created_at':_0x21b139[_0x3523('0x27')](_0x3523('0x31'))}},'json':!![]};_0x17b95b[_0x3523('0x19')]=_0x564385;logger['info'](_0x3523('0x32'));return rp(_0x17b95b)['then'](function(_0x5dac3f){_0x498380[_0x3523('0x2b')]=_0x5dac3f[_0x3523('0x33')]['id'];_0x2982a5(_0x498380);})[_0x3523('0x14')](function(_0x239802){logger['error']('['+[_0x3735e1[_0x3523('0x16')]()]+']',_0x239802[_0x3523('0x17')]);_0x43c75a(_0x239802[_0x3523('0x17')]);});});}function getTicket(_0xfb7f4d,_0xad6549,_0x554545,_0x56ee34,_0x1e6ffd){return function(_0xead5ff){logger[_0x3523('0xd')](_0x3523('0x34'));return new Promise(function(_0x3fd3f0,_0x5c1675){var _0x1df217=moment();var _0xc76773={'method':'POST','uri':_0x554545+'/api/tasks','body':{'title':intUtil[_0x3523('0x35')](_0x56ee34['Subjects'],_0x1e6ffd,'\x20'),'description':intUtil[_0x3523('0x35')](_0x56ee34[_0x3523('0x36')],_0x1e6ffd,'\x0a'),'owner_id':_0xead5ff[_0x3523('0x1f')],'creater_id':_0xead5ff[_0x3523('0x12')],'targetable_id':_0xead5ff[_0x3523('0x2b')],'targetable_type':_0x3523('0x37'),'created_at':_0x1df217[_0x3523('0x27')](_0x3523('0x31')),'due_date':_0x1df217[_0x3523('0x38')](0x1e,'m')[_0x3523('0x27')](_0x3523('0x31'))},'json':!![]};_0xc76773[_0x3523('0x19')]=_0xad6549;return rp(_0xc76773)[_0x3523('0x1b')](function(_0x448963){_0xead5ff[_0x3523('0x39')]=_0x448963[_0x3523('0x3a')]['id'];logger[_0x3523('0xd')](_0x3523('0x3b'),_0xead5ff[_0x3523('0x39')]);_0x3fd3f0(_0xead5ff);})['catch'](function(_0x504e1c){logger[_0x3523('0x15')]('['+[_0xfb7f4d[_0x3523('0x16')]()]+']',_0x504e1c[_0x3523('0x17')]);_0x5c1675(_0x504e1c[_0x3523('0x17')]);});});};}function emit(_0x2a2853,_0x53e94e,_0x48d266){var _0x4c412a={'uri':_0x2a2853+_0x3523('0x3c')+_0x48d266};io['to'](util['format']('user:%s',_0x53e94e))[_0x3523('0x3d')](_0x3523('0x3e'),_0x4c412a);}exports['cs']=function(_0x7fe8c3,_0x467ed3,_0x29f61e,_0x2771db,_0x1aacd2,_0x95e7d4,_0x67796e,_0x402003){var _0x29033a={};var _0x470ae5={'Authorization':_0x3523('0x3f')+_0x95e7d4[_0x3523('0x40')]};_0x95e7d4[_0x3523('0x41')]=intUtil[_0x3523('0x42')](_0x95e7d4[_0x3523('0x41')]);_0x95e7d4[_0x3523('0x43')]=intUtil[_0x3523('0x42')](_0x95e7d4[_0x3523('0x43')]);var _0x357cee=_0x95e7d4['remoteUri'];_0x29033a[_0x3523('0x22')]=_0x95e7d4[_0x3523('0x44')];_0x29033a[_0x3523('0x29')]=_0x402003[_0x3523('0x45')]()===_0x3523('0x46')?_0x467ed3[_0x3523('0x47')]:_0x467ed3[_0x3523('0x48')];_0x29033a[_0x3523('0x49')]=_0x402003==='queue'||_0x402003===_0x3523('0x4a')?'queue':_0x3523('0x46');if(_0x2771db){_0x29033a[_0x3523('0x1c')]=_0x2771db[_0x3523('0x11')];}var _0x28578a=util['format'](_0x3523('0x4b'),_0x95e7d4['serverUrl'],_0x467ed3[_0x3523('0x4c')],md5(_0x467ed3[_0x3523('0x4c')]));if(_0x1aacd2&&_0x1aacd2[_0x3523('0x4d')]){logger[_0x3523('0xd')](_0x3523('0x4e'),'Recording\x20is\x20enabled!');_0x467ed3['recordingURL']=_0x28578a;}else if(_0x67796e&&_0x67796e[_0x3523('0x4f')]&&_0x67796e[_0x3523('0x4f')]!=='none'){logger[_0x3523('0xd')]('[OUTBOUND]',_0x3523('0x50'));_0x467ed3[_0x3523('0x51')]=_0x28578a;}else{_0x467ed3['recordingURL']='';}return getAdminId(_0x29033a,_0x402003,_0x470ae5,_0x357cee)[_0x3523('0x1b')](getUser(_0x402003,_0x470ae5,_0x357cee))[_0x3523('0x1b')](getEndUser(_0x402003,_0x470ae5,_0x357cee))[_0x3523('0x1b')](getTicket(_0x402003,_0x470ae5,_0x357cee,_0x29f61e,_0x467ed3))[_0x3523('0x1b')](function(_0x5894ab){logger[_0x3523('0xd')](util[_0x3523('0x27')](_0x3523('0x52'),_0x5894ab['ticketId']));if(_0x402003!==_0x3523('0x4a')){logger[_0x3523('0xd')]('['+[_0x402003[_0x3523('0x16')]()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x357cee,_0x2771db['name'],_0x5894ab['endUserId']);}})[_0x3523('0x14')](function(_0x48f769){logger[_0x3523('0x15')]('['+[_0x402003['toUpperCase']()]+']\x20Error\x20running\x20Freshsales\x20integration',util[_0x3523('0x53')](_0x48f769,{'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 a1a3a69..5725e99 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 _0x24b0=['vtiger','dynamics365','servicenow','exec','data1','toLowerCase','data2','find','Configurations','data3','queue','outbound','EVENT\x20UNKNOWN','unmanaged','zoho','log','unknown\x20integration','../../../../config/logger','error','format','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./sugarcrm','./freshdesk','./desk','./servicenow','./dynamics365','./freshsales','zendesk','sugarcrm','freshdesk','desk'];(function(_0x211bc3,_0x5860c8){var _0x34c9a2=function(_0x4bfa37){while(--_0x4bfa37){_0x211bc3['push'](_0x211bc3['shift']());}};_0x34c9a2(++_0x5860c8);}(_0x24b0,0xc5));var _0x024b=function(_0x2805cd,_0x1ad286){_0x2805cd=_0x2805cd-0x0;var _0x59c059=_0x24b0[_0x2805cd];return _0x59c059;};'use strict';var _=require(_0x024b('0x0'));var util=require(_0x024b('0x1'));var zendesk=require(_0x024b('0x2'));var salesforce=require('./salesforce');var sugarcrm=require(_0x024b('0x3'));var freshdesk=require(_0x024b('0x4'));var zoho=require('./zoho');var desk=require(_0x024b('0x5'));var vtiger=require('./vtiger');var servicenow=require(_0x024b('0x6'));var dynamics365=require(_0x024b('0x7'));var freshsales=require(_0x024b('0x8'));var integrations=[_0x024b('0x9'),'salesforce',_0x024b('0xa'),_0x024b('0xb'),'zoho',_0x024b('0xc'),_0x024b('0xd'),_0x024b('0xe'),'freshsales',_0x024b('0xf')];exports[_0x024b('0x10')]=function(_0x1d4157,_0x2697b2,_0x582587,_0x74f837,_0x17d2bd,_0x22cac1){if(_0x582587){if(_['includes'](integrations,_0x1d4157[_0x024b('0x11')]['toLowerCase']())){try{var _0x4aad71=null;var _0x434bdc='';var _0x341dd4=_0x582587[_0x1d4157[_0x024b('0x11')][_0x024b('0x12')]()];if(_0x341dd4){var _0x10e82e=_0x341dd4[_0x1d4157[_0x024b('0x13')]];if(_0x10e82e){var _0x331133=_[_0x024b('0x14')](_0x10e82e[_0x024b('0x15')],{'id':parseInt(_0x1d4157[_0x024b('0x16')],0xa)});if(_0x331133){if(_0x74f837){if(_0x17d2bd&&_0x2697b2[_0x024b('0x17')]){_0x434bdc='queue';}else if(_0x2697b2['routeId']){_0x434bdc=_0x024b('0x18');}else{console['log'](_0x024b('0x19'),_0x2697b2);}}else{_0x434bdc=_0x024b('0x1a');}switch(_0x1d4157[_0x024b('0x11')][_0x024b('0x12')]()){case _0x024b('0x9'):zendesk[_0x434bdc](_0x1d4157,_0x2697b2,_0x331133,_0x74f837,_0x17d2bd,_0x10e82e,_0x22cac1);break;case'salesforce':salesforce[_0x434bdc](_0x1d4157,_0x2697b2,_0x331133,_0x74f837,_0x17d2bd,_0x10e82e,_0x22cac1);break;case _0x024b('0xa'):sugarcrm[_0x434bdc](_0x1d4157,_0x2697b2,_0x331133,_0x74f837,_0x17d2bd,_0x10e82e,_0x22cac1);break;case _0x024b('0xb'):freshdesk[_0x434bdc](_0x1d4157,_0x2697b2,_0x331133,_0x74f837,_0x17d2bd,_0x10e82e,_0x22cac1);break;case _0x024b('0x1b'):zoho[_0x434bdc](_0x1d4157,_0x2697b2,_0x331133,_0x74f837,_0x17d2bd,_0x10e82e,_0x22cac1);break;case _0x024b('0xc'):desk[_0x434bdc](_0x1d4157,_0x2697b2,_0x331133,_0x74f837,_0x17d2bd,_0x10e82e,_0x22cac1);break;case'vtiger':vtiger[_0x434bdc](_0x1d4157,_0x2697b2,_0x331133,_0x74f837,_0x17d2bd,_0x10e82e,_0x22cac1);break;case'freshsales':freshsales['cs'](_0x1d4157,_0x2697b2,_0x331133,_0x74f837,_0x17d2bd,_0x10e82e,_0x22cac1,_0x434bdc);break;case'servicenow':servicenow['cs'](_0x1d4157,_0x2697b2,_0x331133,_0x74f837,_0x17d2bd,_0x10e82e,_0x22cac1,_0x434bdc);break;case _0x024b('0xe'):dynamics365['cs'](_0x1d4157,_0x2697b2,_0x331133,_0x74f837,_0x17d2bd,_0x10e82e,_0x22cac1,_0x434bdc);break;default:console[_0x024b('0x1c')](_0x024b('0x1d'));}}else{_0x4aad71=require(_0x024b('0x1e'))(_0x1d4157[_0x024b('0x11')][_0x024b('0x12')]());_0x4aad71[_0x024b('0x1f')]('[EXEC]',util[_0x024b('0x20')](_0x024b('0x21'),_0x1d4157[_0x024b('0x11')]['toLowerCase'](),_0x1d4157[_0x024b('0x16')]));}}else{_0x4aad71=require('../../../../config/logger')(_0x1d4157[_0x024b('0x11')]['toLowerCase']());_0x4aad71[_0x024b('0x1f')]('[EXEC]',util['format'](_0x024b('0x22'),_0x1d4157[_0x024b('0x11')]['toLowerCase'](),_0x1d4157['data2']));}}else{}}catch(_0x5dbfb4){console[_0x024b('0x1f')](_0x5dbfb4);}}}}; \ No newline at end of file +var _0x75f3=['Configurations','data3','queue','outbound','log','zendesk','freshsales','../../../../config/logger','error','[EXEC]','format','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./servicenow','./dynamics365','./freshsales','salesforce','sugarcrm','freshdesk','zoho','desk','vtiger','dynamics365','servicenow','data1','toLowerCase','data2'];(function(_0x5037ab,_0x43209e){var _0x512adb=function(_0x261783){while(--_0x261783){_0x5037ab['push'](_0x5037ab['shift']());}};_0x512adb(++_0x43209e);}(_0x75f3,0x124));var _0x375f=function(_0x3dfc6a,_0x3f5c71){_0x3dfc6a=_0x3dfc6a-0x0;var _0x1872ba=_0x75f3[_0x3dfc6a];return _0x1872ba;};'use strict';var _=require(_0x375f('0x0'));var util=require(_0x375f('0x1'));var zendesk=require(_0x375f('0x2'));var salesforce=require(_0x375f('0x3'));var sugarcrm=require(_0x375f('0x4'));var freshdesk=require(_0x375f('0x5'));var zoho=require(_0x375f('0x6'));var desk=require(_0x375f('0x7'));var vtiger=require(_0x375f('0x8'));var servicenow=require(_0x375f('0x9'));var dynamics365=require(_0x375f('0xa'));var freshsales=require(_0x375f('0xb'));var integrations=['zendesk',_0x375f('0xc'),_0x375f('0xd'),_0x375f('0xe'),_0x375f('0xf'),_0x375f('0x10'),_0x375f('0x11'),_0x375f('0x12'),'freshsales',_0x375f('0x13')];exports['exec']=function(_0x2a74aa,_0x24d5b4,_0x44c30e,_0x375a3e,_0x3de2dd,_0x266251){if(_0x44c30e){if(_['includes'](integrations,_0x2a74aa[_0x375f('0x14')]['toLowerCase']())){try{var _0x1d5aa3=null;var _0x270a94='';var _0x30a1f7=_0x44c30e[_0x2a74aa['data1'][_0x375f('0x15')]()];if(_0x30a1f7){var _0x38dc46=_0x30a1f7[_0x2a74aa[_0x375f('0x16')]];if(_0x38dc46){var _0x11e8f8=_['find'](_0x38dc46[_0x375f('0x17')],{'id':parseInt(_0x2a74aa[_0x375f('0x18')],0xa)});if(_0x11e8f8){if(_0x375a3e){if(_0x3de2dd&&_0x24d5b4[_0x375f('0x19')]){_0x270a94=_0x375f('0x19');}else if(_0x24d5b4['routeId']){_0x270a94=_0x375f('0x1a');}else{console[_0x375f('0x1b')]('EVENT\x20UNKNOWN',_0x24d5b4);}}else{_0x270a94='unmanaged';}switch(_0x2a74aa[_0x375f('0x14')][_0x375f('0x15')]()){case _0x375f('0x1c'):zendesk[_0x270a94](_0x2a74aa,_0x24d5b4,_0x11e8f8,_0x375a3e,_0x3de2dd,_0x38dc46,_0x266251);break;case _0x375f('0xc'):salesforce[_0x270a94](_0x2a74aa,_0x24d5b4,_0x11e8f8,_0x375a3e,_0x3de2dd,_0x38dc46,_0x266251);break;case _0x375f('0xd'):sugarcrm[_0x270a94](_0x2a74aa,_0x24d5b4,_0x11e8f8,_0x375a3e,_0x3de2dd,_0x38dc46,_0x266251);break;case _0x375f('0xe'):freshdesk[_0x270a94](_0x2a74aa,_0x24d5b4,_0x11e8f8,_0x375a3e,_0x3de2dd,_0x38dc46,_0x266251);break;case _0x375f('0xf'):zoho[_0x270a94](_0x2a74aa,_0x24d5b4,_0x11e8f8,_0x375a3e,_0x3de2dd,_0x38dc46,_0x266251);break;case'desk':desk[_0x270a94](_0x2a74aa,_0x24d5b4,_0x11e8f8,_0x375a3e,_0x3de2dd,_0x38dc46,_0x266251);break;case _0x375f('0x11'):vtiger[_0x270a94](_0x2a74aa,_0x24d5b4,_0x11e8f8,_0x375a3e,_0x3de2dd,_0x38dc46,_0x266251);break;case _0x375f('0x1d'):freshsales['cs'](_0x2a74aa,_0x24d5b4,_0x11e8f8,_0x375a3e,_0x3de2dd,_0x38dc46,_0x266251,_0x270a94);break;case'servicenow':servicenow['cs'](_0x2a74aa,_0x24d5b4,_0x11e8f8,_0x375a3e,_0x3de2dd,_0x38dc46,_0x266251,_0x270a94);break;case _0x375f('0x12'):dynamics365['cs'](_0x2a74aa,_0x24d5b4,_0x11e8f8,_0x375a3e,_0x3de2dd,_0x38dc46,_0x266251,_0x270a94);break;default:console[_0x375f('0x1b')]('unknown\x20integration');}}else{_0x1d5aa3=require(_0x375f('0x1e'))(_0x2a74aa['data1'][_0x375f('0x15')]());_0x1d5aa3[_0x375f('0x1f')](_0x375f('0x20'),util[_0x375f('0x21')]('%s\x20configuration\x20#%s\x20not\x20found',_0x2a74aa[_0x375f('0x14')][_0x375f('0x15')](),_0x2a74aa[_0x375f('0x18')]));}}else{_0x1d5aa3=require(_0x375f('0x1e'))(_0x2a74aa[_0x375f('0x14')]['toLowerCase']());_0x1d5aa3[_0x375f('0x1f')](_0x375f('0x20'),util[_0x375f('0x21')](_0x375f('0x22'),_0x2a74aa[_0x375f('0x14')]['toLowerCase'](),_0x2a74aa['data2']));}}else{}}catch(_0x2315bc){console[_0x375f('0x1f')](_0x2315bc);}}}}; \ 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 79707e6..7542818 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 _0x699e=['attributes','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','format','Caller\x20-\x20%s','LastName','Company','','forEach','includes','picklist','type','idField','toString','variable','variableName','customVariable','Variable','name','password','concat','securityToken','remoteUri','clientId','clientSecret','login','username','Connection\x20established.','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','queue','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','newTab','trigger:browser:url','%s/%s/e','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','outbound','recordingFormat','none','destcalleridname','destcalleridnum','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','instanceUrl','[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase','calleridname','calleridnum','Fields',']\x20Integration\x20account\x20type\x20%s.','catch','lodash','bluebird','md5','jsforce','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','localhost','emit','assign','getString','Subjects','Descriptions','utc','IsReminderSet','IsRecurrence','endUserType','contact','lead','WhoId','account','ticketType','Case','ContactId','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','validateEmail','find','execute','length','Agent\x20%s\x20found.','resolve','Name','identity','then','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','additionalSearchContact','merge','Contact','cloneDeep','additionalSearchLead','$or','Lead','account_contact_lead','additionalSearchAccount','Account','first','Phone'];(function(_0x2b3c44,_0x2eddf3){var _0x389ed9=function(_0x2d3695){while(--_0x2d3695){_0x2b3c44['push'](_0x2b3c44['shift']());}};_0x389ed9(++_0x2eddf3);}(_0x699e,0xc0));var _0xe699=function(_0x2f1f7a,_0x5c3558){_0x2f1f7a=_0x2f1f7a-0x0;var _0x45b40a=_0x699e[_0x2f1f7a];return _0x45b40a;};'use strict';var _=require(_0xe699('0x0'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe699('0x1'));var md5=require(_0xe699('0x2'));var jsforce=require(_0xe699('0x3'));var util=require(_0xe699('0x4'));var Redis=require(_0xe699('0x5'));var intUtil=require(_0xe699('0x6'));var config=require(_0xe699('0x7'));var logger=require(_0xe699('0x8'))('salesforce');config[_0xe699('0x9')]=_['defaults'](config[_0xe699('0x9')],{'host':_0xe699('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe699('0x9')]));function emit(_0xaedeab,_0x1fc506,_0x452fc4){io['to'](_0xaedeab)[_0xe699('0xb')](_0x1fc506,_0x452fc4);}function getTicket(_0x12ce73,_0x1dfd8f,_0x300652,_0x2f6fdf,_0xf83543,_0x1d8c56,_0x237378,_0x1f7c21){var _0x3f677c=Object[_0xe699('0xc')]({},{'OwnerId':_0x1dfd8f['id'],'Subject':intUtil[_0xe699('0xd')](_0x2f6fdf[_0xe699('0xe')],_0xf83543,'\x20'),'Description':intUtil['getString'](_0x2f6fdf[_0xe699('0xf')],_0xf83543,'\x0a')},getCustomFields(_0x1d8c56,_0xf83543));if(_0x300652){if(_0x2f6fdf['ticketType']==='Task'){_0x3f677c['ActivityDate']=moment[_0xe699('0x10')]();_0x3f677c[_0xe699('0x11')]=![];_0x3f677c[_0xe699('0x12')]=![];if(_0x300652[_0xe699('0x13')]===_0xe699('0x14')||_0x300652[_0xe699('0x13')]===_0xe699('0x15')){_0x3f677c[_0xe699('0x16')]=_0x300652['id'];}else if(_0x300652[_0xe699('0x13')]===_0xe699('0x17')){_0x3f677c['WhatId']=_0x300652['id'];}}else if(_0x2f6fdf[_0xe699('0x18')]===_0xe699('0x19')){if(_0x300652['endUserType']===_0xe699('0x14')){_0x3f677c[_0xe699('0x1a')]=_0x300652['id'];}else if(_0x300652[_0xe699('0x13')]===_0xe699('0x17')){_0x3f677c[_0xe699('0x1b')]=_0x300652['id'];}else if(_0x300652[_0xe699('0x13')]===_0xe699('0x15')&&_0x2f6fdf[_0xe699('0x1c')]){_0x3f677c[_0x2f6fdf[_0xe699('0x1c')]]=_0x300652['id'];}else{logger[_0xe699('0x1d')](_0xe699('0x1e'));}}}return _0x237378[_0xe699('0x1f')](_0x2f6fdf[_0xe699('0x18')])[_0xe699('0x20')](_0x3f677c);}function getUser(_0x1c7d0a,_0x5f4e35,_0x5166d4){if(!_[_0xe699('0x21')](_0x5f4e35)&&intUtil[_0xe699('0x22')](_0x5f4e35)){var _0x2319a6={'Email':_0x5f4e35};var _0x32c4aa={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x5166d4['sobject']('User')[_0xe699('0x23')](_0x2319a6,_0x32c4aa)[_0xe699('0x24')]()['then'](function(_0xa6585b){if(_0xa6585b[_0xe699('0x25')]){var _0x52da07=_[_0xe699('0x23')](_0xa6585b,function(_0x103d56){return _0x103d56['Email']===_0x5f4e35;});if(_0x52da07){logger[_0xe699('0x1d')](_0xe699('0x26'),_0x5f4e35);return BPromise[_0xe699('0x27')]({'id':_0x52da07['Id'],'name':_0x52da07[_0xe699('0x28')]});}}else{logger[_0xe699('0x1d')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x5f4e35);return _0x5166d4[_0xe699('0x29')]()[_0xe699('0x2a')](function(_0x5b2b25){return BPromise['resolve']({'id':_0x5b2b25[_0xe699('0x2b')],'name':_0x5b2b25[_0xe699('0x2c')]});});}});}else{logger[_0xe699('0x1d')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x5f4e35);return _0x5166d4[_0xe699('0x29')]()[_0xe699('0x2a')](function(_0xc2596b){return BPromise[_0xe699('0x27')]({'id':_0xc2596b[_0xe699('0x2b')],'name':_0xc2596b[_0xe699('0x2c')]});});}}function getEndUser(_0x2cd2b5,_0x1d75f1,_0x3d40eb,_0x303d76,_0x2dfc2d){var _0x23e809={'$or':{'Phone':_0x303d76}};var _0x3e4750={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()['then'](function(){logger['info'](_0xe699('0x2d'),_0x303d76,_0x1d75f1[_0xe699('0x2e')]);switch(_0x1d75f1[_0xe699('0x2e')]){case _0xe699('0x2f'):var _0x4d8ca1=_['cloneDeep'](_0x23e809);if(_0x1d75f1[_0xe699('0x30')]){var _0x245869={};_0x245869[_0x1d75f1[_0xe699('0x30')]]=_0x303d76;_[_0xe699('0x31')](_0x4d8ca1['$or'],_0x245869);}return _0x2dfc2d['sobject'](_0xe699('0x32'))[_0xe699('0x23')](_0x4d8ca1,_0x3e4750)[_0xe699('0x24')]()['then'](function(_0x16b7aa){if(_0x16b7aa&&_0x16b7aa[_0xe699('0x25')]){return _0x16b7aa;}else{var _0x53f3c3=_[_0xe699('0x33')](_0x23e809);if(_0x1d75f1[_0xe699('0x34')]){var _0x4a63fb={};_0x4a63fb[_0x1d75f1[_0xe699('0x34')]]=_0x303d76;_[_0xe699('0x31')](_0x53f3c3[_0xe699('0x35')],_0x4a63fb);}return _0x2dfc2d['sobject'](_0xe699('0x36'))['find'](_0x53f3c3,_0x3e4750);}});case _0xe699('0x37'):var _0x380541=_['cloneDeep'](_0x23e809);if(_0x1d75f1['additionalSearchAccount']){var _0x245869={};_0x245869[_0x1d75f1[_0xe699('0x38')]]=_0x303d76;_['merge'](_0x380541[_0xe699('0x35')],_0x245869);}return _0x2dfc2d[_0xe699('0x1f')](_0xe699('0x39'))[_0xe699('0x23')](_0x380541,_0x3e4750)[_0xe699('0x24')]()[_0xe699('0x2a')](function(_0x3aa14d){if(_0x3aa14d&&_0x3aa14d[_0xe699('0x25')]){return _0x3aa14d;}else{var _0x463f95=_[_0xe699('0x33')](_0x23e809);if(_0x1d75f1[_0xe699('0x30')]){var _0x2195c3={};_0x2195c3[_0x1d75f1[_0xe699('0x30')]]=_0x303d76;_[_0xe699('0x31')](_0x463f95['$or'],_0x2195c3);}return _0x2dfc2d[_0xe699('0x1f')](_0xe699('0x32'))[_0xe699('0x23')](_0x463f95,_0x3e4750)[_0xe699('0x2a')](function(_0x49984d){if(_0x49984d&&_0x49984d[_0xe699('0x25')]){return _0x49984d;}else{var _0x19f09a=_[_0xe699('0x33')](_0x23e809);if(_0x1d75f1[_0xe699('0x34')]){var _0x5e44f6={};_0x5e44f6[_0x1d75f1[_0xe699('0x34')]]=_0x303d76;_[_0xe699('0x31')](_0x19f09a[_0xe699('0x35')],_0x5e44f6);}return _0x2dfc2d[_0xe699('0x1f')](_0xe699('0x36'))['find'](_0x19f09a,_0x3e4750);}});}});case _0xe699('0x14'):var _0x4d8ca1=_[_0xe699('0x33')](_0x23e809);if(_0x1d75f1[_0xe699('0x30')]){var _0x245869={};_0x245869[_0x1d75f1[_0xe699('0x30')]]=_0x303d76;_['merge'](_0x4d8ca1[_0xe699('0x35')],_0x245869);}return _0x2dfc2d[_0xe699('0x1f')]('Contact')[_0xe699('0x23')](_0x4d8ca1,_0x3e4750)['execute']();case'lead':var _0x4586d3=_['cloneDeep'](_0x23e809);if(_0x1d75f1[_0xe699('0x34')]){var _0x245869={};_0x245869[_0x1d75f1[_0xe699('0x34')]]=_0x303d76;_[_0xe699('0x31')](_0x4586d3[_0xe699('0x35')],_0x245869);}return _0x2dfc2d[_0xe699('0x1f')](_0xe699('0x36'))[_0xe699('0x23')](_0x4586d3,_0x3e4750);case'account':var _0x380541=_[_0xe699('0x33')](_0x23e809);if(_0x1d75f1[_0xe699('0x38')]){var _0x245869={};_0x245869[_0x1d75f1[_0xe699('0x38')]]=_0x303d76;_['merge'](_0x380541[_0xe699('0x35')],_0x245869);}return _0x2dfc2d[_0xe699('0x1f')](_0xe699('0x39'))[_0xe699('0x23')](_0x380541,_0x3e4750);default:return null;}})[_0xe699('0x2a')](function(_0x5787ce){if(_0x5787ce&&_0x5787ce[_0xe699('0x25')]){var _0x45c1ff=_[_0xe699('0x3a')](_0x5787ce);if(_0x45c1ff){return BPromise['resolve']({'id':_0x45c1ff['Id'],'name':_0x45c1ff['Name'],'phone':_0x45c1ff[_0xe699('0x3b')],'endUserType':_0x45c1ff[_0xe699('0x3c')]['type'][_0xe699('0x3d')]()});}}})['then'](function(_0xeddc0){if(_0xeddc0){logger['info'](_0xe699('0x3e'),_0xeddc0[_0xe699('0x13')],_0x303d76);return BPromise[_0xe699('0x27')](_0xeddc0);}else{logger[_0xe699('0x1d')]('Enduser\x20with\x20phone\x20%s\x20not\x20found',_0x303d76);var _0xe676cb={'Phone':_0x303d76};if(_0x1d75f1[_0xe699('0x3f')]){if(_0x1d75f1[_0xe699('0x3f')]===_0xe699('0x14')){logger[_0xe699('0x1d')](_0xe699('0x40'),_0x303d76,_0x1d75f1['moduleCreate']);_0xe676cb['LastName']=_0x3d40eb!==''?_0x3d40eb:util[_0xe699('0x41')](_0xe699('0x42'),_0x303d76);}else if(_0x1d75f1[_0xe699('0x3f')]===_0xe699('0x15')){logger[_0xe699('0x1d')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x303d76,_0x1d75f1['moduleCreate']);_0xe676cb[_0xe699('0x43')]=_0x3d40eb!==''?_0x3d40eb:util['format']('Caller\x20-\x20%s',_0x303d76);_0xe676cb[_0xe699('0x44')]='No\x20Company';}else if(_0x1d75f1[_0xe699('0x3f')]===_0xe699('0x17')){logger[_0xe699('0x1d')](_0xe699('0x40'),_0x303d76,_0x1d75f1['moduleCreate']);_0xe676cb['Name']=_0x3d40eb!==_0xe699('0x45')?_0x3d40eb:util[_0xe699('0x41')](_0xe699('0x42'),_0x303d76);}else{return null;}}return _0x2dfc2d[_0xe699('0x1f')](_['upperFirst'](_0x1d75f1[_0xe699('0x3f')]))[_0xe699('0x20')](_0xe676cb)[_0xe699('0x2a')](function(_0x3e9ae0){return BPromise[_0xe699('0x27')]({'id':_0x3e9ae0['id'],'endUserType':_0x1d75f1[_0xe699('0x3f')]});});}});}function getCustomFields(_0x278129,_0x15723a){var _0x2f29eb={};if(_0x278129[_0xe699('0x25')]>0x0){_[_0xe699('0x46')](_0x278129,function(_0x5eaa5b){if(_[_0xe699('0x47')](['string',_0xe699('0x48')],_0x5eaa5b[_0xe699('0x49')])&&_0x5eaa5b[_0xe699('0x4a')]){_0x2f29eb[_0x5eaa5b[_0xe699('0x4a')]]=_0x5eaa5b['content'][_0xe699('0x4b')]();}else if(_0x5eaa5b[_0xe699('0x49')]===_0xe699('0x4c')&&_0x5eaa5b[_0xe699('0x4d')]&&_0x5eaa5b[_0xe699('0x4a')]){_0x15723a[_0x5eaa5b[_0xe699('0x4d')]]&&(_0x2f29eb[_0x5eaa5b['idField']]=_0x15723a[_0x5eaa5b['variableName']][_0xe699('0x4b')]());}else if(_0x5eaa5b[_0xe699('0x49')]===_0xe699('0x4e')&&_0x5eaa5b[_0xe699('0x4f')]&&_0x5eaa5b[_0xe699('0x4f')][_0xe699('0x50')]&&_0x5eaa5b['idField']){_0x15723a[_0x5eaa5b[_0xe699('0x4f')][_0xe699('0x50')]['toLowerCase']()]&&(_0x2f29eb[_0x5eaa5b['idField']]=_0x15723a[_0x5eaa5b[_0xe699('0x4f')][_0xe699('0x50')]['toLowerCase']()][_0xe699('0x4b')]());}});}return _0x2f29eb;}function getConnection(_0x310169){var _0x3132fc=_0x310169[_0xe699('0x51')][_0xe699('0x52')](_0x310169[_0xe699('0x53')]);var _0x44ce7f=new jsforce['Connection']({'oauth2':{'loginUrl':_0x310169[_0xe699('0x54')]||'https://login.salesforce.com','clientId':_0x310169[_0xe699('0x55')],'clientSecret':_0x310169[_0xe699('0x56')]}});return _0x44ce7f[_0xe699('0x57')](_0x310169[_0xe699('0x58')],_0x3132fc)[_0xe699('0x2a')](function(){logger[_0xe699('0x1d')](_0xe699('0x59'));return _0x44ce7f;});}exports['queue']=function(_0x720d31,_0x5bf6e5,_0x4c875a,_0x26e718,_0x361da8,_0x48222f){var _0x40189f,_0x41a253,_0x2a358a,_0x57d1dc;_0x48222f[_0xe699('0x5a')]=intUtil[_0xe699('0x5b')](_0x48222f[_0xe699('0x5a')]);_0x48222f[_0xe699('0x54')]=intUtil[_0xe699('0x5b')](_0x48222f[_0xe699('0x54')]);if(_0x361da8&&_0x361da8[_0xe699('0x5c')]){logger['info'](_0xe699('0x5d'),_0xe699('0x5e'));_0x5bf6e5[_0xe699('0x5f')]=util[_0xe699('0x41')](_0xe699('0x60'),_0x48222f[_0xe699('0x5a')],_0x5bf6e5[_0xe699('0x61')],md5(_0x5bf6e5['uniqueid']));}else{_0x5bf6e5['recordingURL']='';}return getConnection(_0x48222f)[_0xe699('0x2a')](function(_0x1710b8){_0x57d1dc=_0x1710b8;return getUser(_0x48222f,_0x26e718[_0xe699('0x62')],_0x57d1dc);})[_0xe699('0x2a')](function(_0x382c0c){_0x40189f=_0x382c0c;return getEndUser(_0x48222f,_0x4c875a,_0x5bf6e5['calleridname'],_0x5bf6e5['calleridnum'],_0x57d1dc);})[_0xe699('0x2a')](function(_0x280ca3){_0x41a253=_0x280ca3;return getTicket(_0x48222f,_0x40189f,_0x41a253,_0x4c875a,_0x5bf6e5,_0x4c875a['Fields'],_0x57d1dc,_0xe699('0x63'));})[_0xe699('0x2a')](function(_0x577058){_0x2a358a=_0x577058;logger[_0xe699('0x1d')](_0xe699('0x64'),_0x2a358a['id']);logger[_0xe699('0x1d')](_0xe699('0x65'),_0x2a358a['id'],_0x26e718[_0xe699('0x50')],_0x48222f[_0xe699('0x49')]);switch(_0x48222f[_0xe699('0x49')]){case _0xe699('0x66'):emit(util[_0xe699('0x41')](_0xe699('0x67'),_0x26e718['name']),'trigger:salesforce:display',{'recordId':_0x2a358a['id']});break;case _0xe699('0x68'):emit(util[_0xe699('0x41')](_0xe699('0x67'),_0x26e718[_0xe699('0x50')]),_0xe699('0x69'),{'uri':util['format'](_0xe699('0x6a'),_0x57d1dc['instanceUrl'],_0x2a358a['id'])});break;default:logger[_0xe699('0x6b')](_0xe699('0x6c'));}})['catch'](function(_0x84ba0f){logger[_0xe699('0x6b')](_0xe699('0x5d'),_0x84ba0f);});};exports[_0xe699('0x6d')]=function(_0x1fe980,_0x5c1597,_0x479894,_0x18e1d0,_0x1cdf0b,_0x5791ba,_0x45ad1c){var _0x22f872,_0x10e4d7,_0x4d89a7,_0x12cc74;_0x5791ba[_0xe699('0x5a')]=intUtil['stripTrailingSlash'](_0x5791ba['serverUrl']);_0x5791ba['remoteUri']=intUtil[_0xe699('0x5b')](_0x5791ba[_0xe699('0x54')]);if(_0x45ad1c&&_0x45ad1c[_0xe699('0x6e')]&&_0x45ad1c[_0xe699('0x6e')]!==_0xe699('0x6f')){logger[_0xe699('0x1d')]('[OUTBOUND]',_0xe699('0x5e'));_0x5c1597[_0xe699('0x5f')]=util[_0xe699('0x41')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5791ba[_0xe699('0x5a')],_0x5c1597['uniqueid'],md5(_0x5c1597[_0xe699('0x61')]));}return getConnection(_0x5791ba)[_0xe699('0x2a')](function(_0x4684e9){_0x12cc74=_0x4684e9;return getUser(_0x5791ba,_0x18e1d0['email'],_0x12cc74);})[_0xe699('0x2a')](function(_0x3a3bba){_0x22f872=_0x3a3bba;return getEndUser(_0x5791ba,_0x479894,_0x5c1597[_0xe699('0x70')],_0x5c1597[_0xe699('0x71')],_0x12cc74);})[_0xe699('0x2a')](function(_0x47bca5){_0x10e4d7=_0x47bca5;return getTicket(_0x5791ba,_0x22f872,_0x10e4d7,_0x479894,_0x5c1597,_0x479894['Fields'],_0x12cc74,_0xe699('0x6d'));})[_0xe699('0x2a')](function(_0xaea547){_0x4d89a7=_0xaea547;logger[_0xe699('0x1d')]('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x4d89a7['id']);logger[_0xe699('0x1d')](_0xe699('0x72'),_0x4d89a7['id'],_0x18e1d0[_0xe699('0x50')],_0x5791ba['type']);switch(_0x5791ba[_0xe699('0x49')]){case _0xe699('0x66'):emit(util[_0xe699('0x41')](_0xe699('0x67'),_0x18e1d0[_0xe699('0x50')]),'trigger:salesforce:display',{'recordId':_0x4d89a7['id']});break;case'newTab':emit(util['format'](_0xe699('0x67'),_0x18e1d0[_0xe699('0x50')]),_0xe699('0x69'),{'uri':util[_0xe699('0x41')]('%s/%s/e',_0x12cc74[_0xe699('0x73')],_0x4d89a7['id'])});break;default:logger[_0xe699('0x6b')](_0xe699('0x74'),_0xe699('0x75'));}})['catch'](function(_0x420fe9){logger[_0xe699('0x6b')](_0xe699('0x74'),_0x420fe9);});};exports[_0xe699('0x76')]=function(_0x2615a5,_0x65d773,_0x552050,_0x744c8a,_0x4704e9,_0xa1b5c0){var _0xa41bcb,_0x22b6f2,_0x1833d2,_0x468127;_0xa1b5c0[_0xe699('0x5a')]=intUtil['stripTrailingSlash'](_0xa1b5c0[_0xe699('0x5a')]);_0xa1b5c0[_0xe699('0x54')]=intUtil[_0xe699('0x5b')](_0xa1b5c0[_0xe699('0x54')]);if(_0x4704e9&&_0x4704e9[_0xe699('0x5c')]){logger['info']('['+_0x65d773[_0xe699('0x77')][_0xe699('0x78')]()+']',_0xe699('0x5e'));_0x65d773[_0xe699('0x5f')]=util[_0xe699('0x41')](_0xe699('0x60'),_0xa1b5c0[_0xe699('0x5a')],_0x65d773[_0xe699('0x61')],md5(_0x65d773[_0xe699('0x61')]));}else{_0x65d773['recordingURL']='';}return getConnection(_0xa1b5c0)[_0xe699('0x2a')](function(_0x1a412c){_0x468127=_0x1a412c;if(!_['isNil'](_0x744c8a)){return getUser(_0xa1b5c0,_0x744c8a['name'],_0x468127);}else{return getUser(_0xa1b5c0,null,_0x468127);}})[_0xe699('0x2a')](function(_0x4a2d77){_0xa41bcb=_0x4a2d77;return getEndUser(_0xa1b5c0,_0x552050,_0x65d773[_0xe699('0x79')],_0x65d773[_0xe699('0x7a')],_0x468127);})['then'](function(_0x2f13b6){_0x22b6f2=_0x2f13b6;return getTicket(_0xa1b5c0,_0xa41bcb,_0x22b6f2,_0x552050,_0x65d773,_0x552050[_0xe699('0x7b')],_0x468127);})[_0xe699('0x2a')](function(_0x5404f1){_0x1833d2=_0x5404f1;logger[_0xe699('0x1d')]('['+_0x65d773['lastevent'][_0xe699('0x78')]()+']\x20Ticket\x20%s\x20created.',_0x1833d2['id']);logger['info']('['+_0x65d773[_0xe699('0x77')][_0xe699('0x78')]()+_0xe699('0x7c'),_0xa1b5c0[_0xe699('0x49')]);})[_0xe699('0x7d')](function(_0x247b41){logger['error']('['+_0x65d773[_0xe699('0x77')][_0xe699('0x78')]()+']',_0x247b41);});}; \ No newline at end of file +var _0xde30=['[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','newTab','user:%s','%s/%s/e','error','outbound','recordingFormat','destcalleridname','[OUTBOUND]\x20Ticket\x20%s\x20created.','trigger:salesforce:display','trigger:browser:url','instanceUrl','[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized','catch','unmanaged','lastevent','toUpperCase','isNil','calleridname','calleridnum',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','jsforce','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','assign','getString','Subjects','Descriptions','ticketType','Task','ActivityDate','IsReminderSet','IsRecurrence','endUserType','contact','lead','WhoId','account','WhatId','Case','ContactId','leadId','info','sobject','create','validateEmail','User','find','execute','then','length','Email','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','cloneDeep','additionalSearchContact','merge','$or','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','Account','Contact','Phone','type','toLowerCase','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','Company','upperFirst','forEach','includes','string','picklist','idField','content','variable','variableName','toString','Variable','name','password','securityToken','https://login.salesforce.com','clientId','clientSecret','login','username','queue','serverUrl','stripTrailingSlash','remoteUri','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','Fields'];(function(_0x8eead0,_0x56e383){var _0x5adc61=function(_0x27bd26){while(--_0x27bd26){_0x8eead0['push'](_0x8eead0['shift']());}};_0x5adc61(++_0x56e383);}(_0xde30,0x93));var _0x0de3=function(_0x19d0eb,_0x50ff6f){_0x19d0eb=_0x19d0eb-0x0;var _0x197552=_0xde30[_0x19d0eb];return _0x197552;};'use strict';var _=require(_0x0de3('0x0'));var rp=require(_0x0de3('0x1'));var moment=require('moment');var BPromise=require('bluebird');var md5=require('md5');var jsforce=require(_0x0de3('0x2'));var util=require(_0x0de3('0x3'));var Redis=require(_0x0de3('0x4'));var intUtil=require(_0x0de3('0x5'));var config=require(_0x0de3('0x6'));var logger=require(_0x0de3('0x7'))('salesforce');config[_0x0de3('0x8')]=_[_0x0de3('0x9')](config[_0x0de3('0x8')],{'host':_0x0de3('0xa'),'port':0x18eb});var io=require(_0x0de3('0xb'))(new Redis(config[_0x0de3('0x8')]));function emit(_0x37bcaf,_0xdde8c6,_0x464b7f){io['to'](_0x37bcaf)[_0x0de3('0xc')](_0xdde8c6,_0x464b7f);}function getTicket(_0x205745,_0x3f72cf,_0x19ccc9,_0x512fb0,_0x477543,_0x268a42,_0xcee381,_0x3a3a25){var _0xc33ea8=Object[_0x0de3('0xd')]({},{'OwnerId':_0x3f72cf['id'],'Subject':intUtil[_0x0de3('0xe')](_0x512fb0[_0x0de3('0xf')],_0x477543,'\x20'),'Description':intUtil[_0x0de3('0xe')](_0x512fb0[_0x0de3('0x10')],_0x477543,'\x0a')},getCustomFields(_0x268a42,_0x477543));if(_0x19ccc9){if(_0x512fb0[_0x0de3('0x11')]===_0x0de3('0x12')){_0xc33ea8[_0x0de3('0x13')]=moment['utc']();_0xc33ea8[_0x0de3('0x14')]=![];_0xc33ea8[_0x0de3('0x15')]=![];if(_0x19ccc9[_0x0de3('0x16')]===_0x0de3('0x17')||_0x19ccc9[_0x0de3('0x16')]===_0x0de3('0x18')){_0xc33ea8[_0x0de3('0x19')]=_0x19ccc9['id'];}else if(_0x19ccc9[_0x0de3('0x16')]===_0x0de3('0x1a')){_0xc33ea8[_0x0de3('0x1b')]=_0x19ccc9['id'];}}else if(_0x512fb0[_0x0de3('0x11')]===_0x0de3('0x1c')){if(_0x19ccc9['endUserType']==='contact'){_0xc33ea8[_0x0de3('0x1d')]=_0x19ccc9['id'];}else if(_0x19ccc9[_0x0de3('0x16')]===_0x0de3('0x1a')){_0xc33ea8['AccountId']=_0x19ccc9['id'];}else if(_0x19ccc9[_0x0de3('0x16')]==='lead'&&_0x512fb0[_0x0de3('0x1e')]){_0xc33ea8[_0x512fb0['leadId']]=_0x19ccc9['id'];}else{logger[_0x0de3('0x1f')]('Association\x20between\x20Case\x20and\x20Lead\x20skipped');}}}return _0xcee381[_0x0de3('0x20')](_0x512fb0[_0x0de3('0x11')])[_0x0de3('0x21')](_0xc33ea8);}function getUser(_0x12cf3f,_0x2f96c9,_0x48be0c){if(!_['isNil'](_0x2f96c9)&&intUtil[_0x0de3('0x22')](_0x2f96c9)){var _0x2f6d92={'Email':_0x2f96c9};var _0x22e654={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x48be0c[_0x0de3('0x20')](_0x0de3('0x23'))[_0x0de3('0x24')](_0x2f6d92,_0x22e654)[_0x0de3('0x25')]()[_0x0de3('0x26')](function(_0x9fb41c){if(_0x9fb41c[_0x0de3('0x27')]){var _0x11b5f9=_[_0x0de3('0x24')](_0x9fb41c,function(_0x2c8d42){return _0x2c8d42[_0x0de3('0x28')]===_0x2f96c9;});if(_0x11b5f9){logger['info']('Agent\x20%s\x20found.',_0x2f96c9);return BPromise[_0x0de3('0x29')]({'id':_0x11b5f9['Id'],'name':_0x11b5f9[_0x0de3('0x2a')]});}}else{logger[_0x0de3('0x1f')](_0x0de3('0x2b'),_0x2f96c9);return _0x48be0c[_0x0de3('0x2c')]()['then'](function(_0xe21114){return BPromise[_0x0de3('0x29')]({'id':_0xe21114[_0x0de3('0x2d')],'name':_0xe21114[_0x0de3('0x2e')]});});}});}else{logger[_0x0de3('0x1f')](_0x0de3('0x2b'),_0x2f96c9);return _0x48be0c['identity']()[_0x0de3('0x26')](function(_0x50e777){return BPromise['resolve']({'id':_0x50e777[_0x0de3('0x2d')],'name':_0x50e777[_0x0de3('0x2e')]});});}}function getEndUser(_0x303b70,_0xbfcba2,_0x483b84,_0x24aedf,_0x4392f1){var _0x32756a={'$or':{'Phone':_0x24aedf}};var _0x120412={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0x0de3('0x26')](function(){logger[_0x0de3('0x1f')](_0x0de3('0x2f'),_0x24aedf,_0xbfcba2[_0x0de3('0x30')]);switch(_0xbfcba2[_0x0de3('0x30')]){case'contact_lead':var _0x4029b3=_[_0x0de3('0x31')](_0x32756a);if(_0xbfcba2[_0x0de3('0x32')]){var _0x422c44={};_0x422c44[_0xbfcba2[_0x0de3('0x32')]]=_0x24aedf;_[_0x0de3('0x33')](_0x4029b3[_0x0de3('0x34')],_0x422c44);}return _0x4392f1[_0x0de3('0x20')]('Contact')['find'](_0x4029b3,_0x120412)[_0x0de3('0x25')]()[_0x0de3('0x26')](function(_0x5a3c1e){if(_0x5a3c1e&&_0x5a3c1e[_0x0de3('0x27')]){return _0x5a3c1e;}else{var _0x56d779=_['cloneDeep'](_0x32756a);if(_0xbfcba2[_0x0de3('0x35')]){var _0x1dbf4d={};_0x1dbf4d[_0xbfcba2[_0x0de3('0x35')]]=_0x24aedf;_['merge'](_0x56d779[_0x0de3('0x34')],_0x1dbf4d);}return _0x4392f1[_0x0de3('0x20')](_0x0de3('0x36'))['find'](_0x56d779,_0x120412);}});case _0x0de3('0x37'):var _0x1a6e37=_[_0x0de3('0x31')](_0x32756a);if(_0xbfcba2[_0x0de3('0x38')]){var _0x422c44={};_0x422c44[_0xbfcba2[_0x0de3('0x38')]]=_0x24aedf;_['merge'](_0x1a6e37[_0x0de3('0x34')],_0x422c44);}return _0x4392f1[_0x0de3('0x20')](_0x0de3('0x39'))[_0x0de3('0x24')](_0x1a6e37,_0x120412)[_0x0de3('0x25')]()[_0x0de3('0x26')](function(_0x324cd8){if(_0x324cd8&&_0x324cd8[_0x0de3('0x27')]){return _0x324cd8;}else{var _0x484f9e=_[_0x0de3('0x31')](_0x32756a);if(_0xbfcba2['additionalSearchContact']){var _0x5d2344={};_0x5d2344[_0xbfcba2['additionalSearchContact']]=_0x24aedf;_[_0x0de3('0x33')](_0x484f9e[_0x0de3('0x34')],_0x5d2344);}return _0x4392f1[_0x0de3('0x20')](_0x0de3('0x3a'))[_0x0de3('0x24')](_0x484f9e,_0x120412)['then'](function(_0x3b8e57){if(_0x3b8e57&&_0x3b8e57[_0x0de3('0x27')]){return _0x3b8e57;}else{var _0x2dce28=_[_0x0de3('0x31')](_0x32756a);if(_0xbfcba2[_0x0de3('0x35')]){var _0x107ed4={};_0x107ed4[_0xbfcba2[_0x0de3('0x35')]]=_0x24aedf;_['merge'](_0x2dce28[_0x0de3('0x34')],_0x107ed4);}return _0x4392f1[_0x0de3('0x20')](_0x0de3('0x36'))['find'](_0x2dce28,_0x120412);}});}});case _0x0de3('0x17'):var _0x4029b3=_[_0x0de3('0x31')](_0x32756a);if(_0xbfcba2[_0x0de3('0x32')]){var _0x422c44={};_0x422c44[_0xbfcba2[_0x0de3('0x32')]]=_0x24aedf;_[_0x0de3('0x33')](_0x4029b3[_0x0de3('0x34')],_0x422c44);}return _0x4392f1[_0x0de3('0x20')](_0x0de3('0x3a'))[_0x0de3('0x24')](_0x4029b3,_0x120412)[_0x0de3('0x25')]();case _0x0de3('0x18'):var _0x458838=_[_0x0de3('0x31')](_0x32756a);if(_0xbfcba2[_0x0de3('0x35')]){var _0x422c44={};_0x422c44[_0xbfcba2[_0x0de3('0x35')]]=_0x24aedf;_['merge'](_0x458838[_0x0de3('0x34')],_0x422c44);}return _0x4392f1[_0x0de3('0x20')](_0x0de3('0x36'))['find'](_0x458838,_0x120412);case'account':var _0x1a6e37=_[_0x0de3('0x31')](_0x32756a);if(_0xbfcba2[_0x0de3('0x38')]){var _0x422c44={};_0x422c44[_0xbfcba2[_0x0de3('0x38')]]=_0x24aedf;_['merge'](_0x1a6e37[_0x0de3('0x34')],_0x422c44);}return _0x4392f1[_0x0de3('0x20')]('Account')[_0x0de3('0x24')](_0x1a6e37,_0x120412);default:return null;}})[_0x0de3('0x26')](function(_0x18f79a){if(_0x18f79a&&_0x18f79a[_0x0de3('0x27')]){var _0xce9299=_['first'](_0x18f79a);if(_0xce9299){return BPromise['resolve']({'id':_0xce9299['Id'],'name':_0xce9299[_0x0de3('0x2a')],'phone':_0xce9299[_0x0de3('0x3b')],'endUserType':_0xce9299['attributes'][_0x0de3('0x3c')][_0x0de3('0x3d')]()});}}})[_0x0de3('0x26')](function(_0x4b0406){if(_0x4b0406){logger[_0x0de3('0x1f')]('Enduser\x20(%s)\x20with\x20phone\x20%s\x20found',_0x4b0406['endUserType'],_0x24aedf);return BPromise[_0x0de3('0x29')](_0x4b0406);}else{logger[_0x0de3('0x1f')](_0x0de3('0x3e'),_0x24aedf);var _0x1a8bab={'Phone':_0x24aedf};if(_0xbfcba2['moduleCreate']){if(_0xbfcba2[_0x0de3('0x3f')]===_0x0de3('0x17')){logger['info'](_0x0de3('0x40'),_0x24aedf,_0xbfcba2['moduleCreate']);_0x1a8bab[_0x0de3('0x41')]=_0x483b84!==_0x0de3('0x42')?_0x483b84:util[_0x0de3('0x43')]('Caller\x20-\x20%s',_0x24aedf);}else if(_0xbfcba2[_0x0de3('0x3f')]===_0x0de3('0x18')){logger[_0x0de3('0x1f')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x24aedf,_0xbfcba2[_0x0de3('0x3f')]);_0x1a8bab[_0x0de3('0x41')]=_0x483b84!==_0x0de3('0x42')?_0x483b84:util[_0x0de3('0x43')](_0x0de3('0x44'),_0x24aedf);_0x1a8bab[_0x0de3('0x45')]='No\x20Company';}else if(_0xbfcba2[_0x0de3('0x3f')]==='account'){logger['info'](_0x0de3('0x40'),_0x24aedf,_0xbfcba2[_0x0de3('0x3f')]);_0x1a8bab[_0x0de3('0x2a')]=_0x483b84!==_0x0de3('0x42')?_0x483b84:util[_0x0de3('0x43')]('Caller\x20-\x20%s',_0x24aedf);}else{return null;}}return _0x4392f1['sobject'](_[_0x0de3('0x46')](_0xbfcba2[_0x0de3('0x3f')]))[_0x0de3('0x21')](_0x1a8bab)[_0x0de3('0x26')](function(_0x449765){return BPromise[_0x0de3('0x29')]({'id':_0x449765['id'],'endUserType':_0xbfcba2['moduleCreate']});});}});}function getCustomFields(_0x16650d,_0x3973f4){var _0x4313fa={};if(_0x16650d[_0x0de3('0x27')]>0x0){_[_0x0de3('0x47')](_0x16650d,function(_0x213a84){if(_[_0x0de3('0x48')]([_0x0de3('0x49'),_0x0de3('0x4a')],_0x213a84[_0x0de3('0x3c')])&&_0x213a84[_0x0de3('0x4b')]){_0x4313fa[_0x213a84['idField']]=_0x213a84[_0x0de3('0x4c')]['toString']();}else if(_0x213a84[_0x0de3('0x3c')]===_0x0de3('0x4d')&&_0x213a84[_0x0de3('0x4e')]&&_0x213a84['idField']){_0x3973f4[_0x213a84['variableName']]&&(_0x4313fa[_0x213a84[_0x0de3('0x4b')]]=_0x3973f4[_0x213a84[_0x0de3('0x4e')]][_0x0de3('0x4f')]());}else if(_0x213a84['type']==='customVariable'&&_0x213a84[_0x0de3('0x50')]&&_0x213a84[_0x0de3('0x50')][_0x0de3('0x51')]&&_0x213a84['idField']){_0x3973f4[_0x213a84['Variable'][_0x0de3('0x51')][_0x0de3('0x3d')]()]&&(_0x4313fa[_0x213a84[_0x0de3('0x4b')]]=_0x3973f4[_0x213a84[_0x0de3('0x50')][_0x0de3('0x51')][_0x0de3('0x3d')]()]['toString']());}});}return _0x4313fa;}function getConnection(_0x5bac46){var _0x10fda3=_0x5bac46[_0x0de3('0x52')]['concat'](_0x5bac46[_0x0de3('0x53')]);var _0xcd0809=new jsforce['Connection']({'oauth2':{'loginUrl':_0x5bac46['remoteUri']||_0x0de3('0x54'),'clientId':_0x5bac46[_0x0de3('0x55')],'clientSecret':_0x5bac46[_0x0de3('0x56')]}});return _0xcd0809[_0x0de3('0x57')](_0x5bac46[_0x0de3('0x58')],_0x10fda3)[_0x0de3('0x26')](function(){logger[_0x0de3('0x1f')]('Connection\x20established.');return _0xcd0809;});}exports[_0x0de3('0x59')]=function(_0x4320a8,_0x45f346,_0xfad08e,_0xdd529c,_0x3fa2e9,_0x5685d1){var _0x4359de,_0x5311bb,_0x1bbc15,_0x226bdd;_0x5685d1[_0x0de3('0x5a')]=intUtil['stripTrailingSlash'](_0x5685d1[_0x0de3('0x5a')]);_0x5685d1['remoteUri']=intUtil[_0x0de3('0x5b')](_0x5685d1[_0x0de3('0x5c')]);if(_0x3fa2e9&&_0x3fa2e9[_0x0de3('0x5d')]){logger['info'](_0x0de3('0x5e'),_0x0de3('0x5f'));_0x45f346[_0x0de3('0x60')]=util[_0x0de3('0x43')](_0x0de3('0x61'),_0x5685d1['serverUrl'],_0x45f346[_0x0de3('0x62')],md5(_0x45f346[_0x0de3('0x62')]));}else{_0x45f346['recordingURL']='';}return getConnection(_0x5685d1)[_0x0de3('0x26')](function(_0x2bde8c){_0x226bdd=_0x2bde8c;return getUser(_0x5685d1,_0xdd529c[_0x0de3('0x63')],_0x226bdd);})[_0x0de3('0x26')](function(_0x493cae){_0x4359de=_0x493cae;return getEndUser(_0x5685d1,_0xfad08e,_0x45f346['calleridname'],_0x45f346['calleridnum'],_0x226bdd);})[_0x0de3('0x26')](function(_0x5aa7d4){_0x5311bb=_0x5aa7d4;return getTicket(_0x5685d1,_0x4359de,_0x5311bb,_0xfad08e,_0x45f346,_0xfad08e[_0x0de3('0x64')],_0x226bdd,_0x0de3('0x59'));})[_0x0de3('0x26')](function(_0x13208d){_0x1bbc15=_0x13208d;logger[_0x0de3('0x1f')]('[QUEUE]\x20Ticket\x20%s\x20created',_0x1bbc15['id']);logger[_0x0de3('0x1f')](_0x0de3('0x65'),_0x1bbc15['id'],_0xdd529c[_0x0de3('0x51')],_0x5685d1[_0x0de3('0x3c')]);switch(_0x5685d1[_0x0de3('0x3c')]){case'integrationTab':emit(util['format']('user:%s',_0xdd529c[_0x0de3('0x51')]),'trigger:salesforce:display',{'recordId':_0x1bbc15['id']});break;case _0x0de3('0x66'):emit(util[_0x0de3('0x43')](_0x0de3('0x67'),_0xdd529c[_0x0de3('0x51')]),'trigger:browser:url',{'uri':util['format'](_0x0de3('0x68'),_0x226bdd['instanceUrl'],_0x1bbc15['id'])});break;default:logger[_0x0de3('0x69')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})['catch'](function(_0x183520){logger[_0x0de3('0x69')]('[QUEUE]',_0x183520);});};exports[_0x0de3('0x6a')]=function(_0x192733,_0x4c00dc,_0x597765,_0x3fc467,_0x67e5a3,_0x5e56e2,_0x4addc1){var _0x1586ad,_0x5f0708,_0x1561a6,_0x59606e;_0x5e56e2[_0x0de3('0x5a')]=intUtil[_0x0de3('0x5b')](_0x5e56e2[_0x0de3('0x5a')]);_0x5e56e2['remoteUri']=intUtil[_0x0de3('0x5b')](_0x5e56e2['remoteUri']);if(_0x4addc1&&_0x4addc1[_0x0de3('0x6b')]&&_0x4addc1[_0x0de3('0x6b')]!=='none'){logger['info']('[OUTBOUND]',_0x0de3('0x5f'));_0x4c00dc['recordingURL']=util['format'](_0x0de3('0x61'),_0x5e56e2[_0x0de3('0x5a')],_0x4c00dc['uniqueid'],md5(_0x4c00dc['uniqueid']));}return getConnection(_0x5e56e2)['then'](function(_0x1fc24d){_0x59606e=_0x1fc24d;return getUser(_0x5e56e2,_0x3fc467[_0x0de3('0x63')],_0x59606e);})[_0x0de3('0x26')](function(_0x2ce423){_0x1586ad=_0x2ce423;return getEndUser(_0x5e56e2,_0x597765,_0x4c00dc[_0x0de3('0x6c')],_0x4c00dc['destcalleridnum'],_0x59606e);})[_0x0de3('0x26')](function(_0x312e09){_0x5f0708=_0x312e09;return getTicket(_0x5e56e2,_0x1586ad,_0x5f0708,_0x597765,_0x4c00dc,_0x597765[_0x0de3('0x64')],_0x59606e,_0x0de3('0x6a'));})[_0x0de3('0x26')](function(_0x5bc4b4){_0x1561a6=_0x5bc4b4;logger[_0x0de3('0x1f')](_0x0de3('0x6d'),_0x1561a6['id']);logger[_0x0de3('0x1f')]('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x1561a6['id'],_0x3fc467[_0x0de3('0x51')],_0x5e56e2[_0x0de3('0x3c')]);switch(_0x5e56e2[_0x0de3('0x3c')]){case'integrationTab':emit(util['format'](_0x0de3('0x67'),_0x3fc467[_0x0de3('0x51')]),_0x0de3('0x6e'),{'recordId':_0x1561a6['id']});break;case'newTab':emit(util[_0x0de3('0x43')](_0x0de3('0x67'),_0x3fc467[_0x0de3('0x51')]),_0x0de3('0x6f'),{'uri':util['format'](_0x0de3('0x68'),_0x59606e[_0x0de3('0x70')],_0x1561a6['id'])});break;default:logger[_0x0de3('0x69')](_0x0de3('0x71'),_0x0de3('0x72'));}})[_0x0de3('0x73')](function(_0x3bf952){logger[_0x0de3('0x69')](_0x0de3('0x71'),_0x3bf952);});};exports[_0x0de3('0x74')]=function(_0x318269,_0x48763e,_0x5f84a4,_0x4bfc4d,_0x4ed500,_0x34788e){var _0x44c898,_0x17ccc3,_0x5228a7,_0x28bba6;_0x34788e[_0x0de3('0x5a')]=intUtil[_0x0de3('0x5b')](_0x34788e[_0x0de3('0x5a')]);_0x34788e[_0x0de3('0x5c')]=intUtil[_0x0de3('0x5b')](_0x34788e[_0x0de3('0x5c')]);if(_0x4ed500&&_0x4ed500[_0x0de3('0x5d')]){logger['info']('['+_0x48763e[_0x0de3('0x75')][_0x0de3('0x76')]()+']',_0x0de3('0x5f'));_0x48763e[_0x0de3('0x60')]=util[_0x0de3('0x43')](_0x0de3('0x61'),_0x34788e[_0x0de3('0x5a')],_0x48763e[_0x0de3('0x62')],md5(_0x48763e[_0x0de3('0x62')]));}else{_0x48763e[_0x0de3('0x60')]='';}return getConnection(_0x34788e)[_0x0de3('0x26')](function(_0x5f2282){_0x28bba6=_0x5f2282;if(!_[_0x0de3('0x77')](_0x4bfc4d)){return getUser(_0x34788e,_0x4bfc4d[_0x0de3('0x51')],_0x28bba6);}else{return getUser(_0x34788e,null,_0x28bba6);}})[_0x0de3('0x26')](function(_0x1e3e11){_0x44c898=_0x1e3e11;return getEndUser(_0x34788e,_0x5f84a4,_0x48763e[_0x0de3('0x78')],_0x48763e[_0x0de3('0x79')],_0x28bba6);})[_0x0de3('0x26')](function(_0x21aeab){_0x17ccc3=_0x21aeab;return getTicket(_0x34788e,_0x44c898,_0x17ccc3,_0x5f84a4,_0x48763e,_0x5f84a4[_0x0de3('0x64')],_0x28bba6);})[_0x0de3('0x26')](function(_0x9fc5e7){_0x5228a7=_0x9fc5e7;logger[_0x0de3('0x1f')]('['+_0x48763e[_0x0de3('0x75')][_0x0de3('0x76')]()+_0x0de3('0x7a'),_0x5228a7['id']);logger['info']('['+_0x48763e[_0x0de3('0x75')][_0x0de3('0x76')]()+_0x0de3('0x7b'),_0x34788e[_0x0de3('0x3c')]);})[_0x0de3('0x73')](function(_0xc7646d){logger[_0x0de3('0x69')]('['+_0x48763e[_0x0de3('0x75')][_0x0de3('0x76')]()+']',_0xc7646d);});}; \ 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 8a8b48e..f106ca9 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 _0x951d=['string','picklist','type','nameField','customField','toString','includes','idField','toLowerCase','content','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','POST','incident','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','label','?sysparm_query=name%3D','Incident','Incident\x20-\x20','ticketNumber','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','forEach','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','email','calleridnum','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','recordingFormat','none','[OUTBOUND]','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','request-promise','util','ioredis','../../../../config/environment','servicenow','redis','defaults','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','result','length','adminId','sys_id','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','info','],\x20getUser\x20input\x20crm','userEmail','],\x20getUser\x20rp\x20obj','then','],\x20getUser\x20entity','active','true','userId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','sys_user?','endUserNumber','user','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm'];(function(_0x54d49e,_0x5d9911){var _0x4af0f1=function(_0xf117b3){while(--_0xf117b3){_0x54d49e['push'](_0x54d49e['shift']());}};_0x4af0f1(++_0x5d9911);}(_0x951d,0x1ee));var _0xd951=function(_0x4bf83e,_0x429223){_0x4bf83e=_0x4bf83e-0x0;var _0x5647c9=_0x951d[_0x4bf83e];return _0x5647c9;};'use strict';var _=require('lodash');var Promise=require('bluebird');var rp=require(_0xd951('0x0'));var util=require(_0xd951('0x1'));var md5=require('md5');var Redis=require(_0xd951('0x2'));var intUtil=require('./util');var config=require(_0xd951('0x3'));var logger=require('../../../../config/logger')(_0xd951('0x4'));config[_0xd951('0x5')]=_[_0xd951('0x6')](config[_0xd951('0x5')],{'host':_0xd951('0x7'),'port':0x18eb});var io=require(_0xd951('0x8'))(new Redis(config[_0xd951('0x5')]));function getAdminUser(_0x3853d3,_0x4f6a6c,_0x295745,_0x5b6f5c,_0x14f54b,_0x1437e9){return new Promise(function(_0xf07e2,_0x11c75c){var _0x200060={'method':_0xd951('0x9'),'uri':_0x5b6f5c+_0xd951('0xa')+'&'+_0x14f54b+'&'+_0x1437e9,'auth':_0x4f6a6c,'json':!![]};return rp(_0x200060)['then'](function(_0x12fe96){if(_0x12fe96[_0xd951('0xb')][_0xd951('0xc')]>0x0){_0x295745[_0xd951('0xd')]=_0x12fe96[_0xd951('0xb')][0x0][_0xd951('0xe')];}logger['info']('['+[_0x3853d3[_0xd951('0xf')]()]+_0xd951('0x10'),_0x295745);_0xf07e2(_0x295745);})[_0xd951('0x11')](function(_0x16eae7){logger[_0xd951('0x12')]('['+[_0x3853d3[_0xd951('0xf')]()]+']',_0x16eae7['message']);_0x11c75c(_0x16eae7[_0xd951('0x13')]);});});}function getUser(_0x1ff620,_0x2f63fc,_0x395b12,_0x52b4d0,_0x595301){return function(_0x249764){logger[_0xd951('0x14')]('['+[_0x1ff620[_0xd951('0xf')]()]+_0xd951('0x15'),_0x249764);return new Promise(function(_0x2e2fde,_0x31d1c4){if(intUtil['validateEmail'](_0x249764['userEmail'])){var _0x3fc219={'method':_0xd951('0x9'),'uri':_0x395b12+'sys_user?sysparm_query=email%3D'+_0x249764[_0xd951('0x16')]+'&'+_0x52b4d0+'&'+_0x595301,'auth':_0x2f63fc,'json':!![]};logger[_0xd951('0x14')]('['+[_0x1ff620[_0xd951('0xf')]()]+_0xd951('0x17'),_0x3fc219);return rp(_0x3fc219)[_0xd951('0x18')](function(_0x1706d4){logger[_0xd951('0x14')]('['+[_0x1ff620[_0xd951('0xf')]()]+_0xd951('0x19'),_0x1706d4);if(_0x1706d4[_0xd951('0xb')][_0xd951('0xc')]>0x0&&String(_0x1706d4['result'][0x0][_0xd951('0x1a')])===_0xd951('0x1b')){_0x249764['userId']=_0x1706d4[_0xd951('0xb')][0x0][_0xd951('0xe')];}else{_0x249764[_0xd951('0x1c')]=_0x249764[_0xd951('0xd')];_0x249764[_0xd951('0x16')]=_0x249764[_0xd951('0x1d')];}logger[_0xd951('0x14')]('['+[_0x1ff620['toUpperCase']()]+_0xd951('0x1e'),_0x249764);_0x2e2fde(_0x249764);})[_0xd951('0x11')](function(_0x3d7e63){logger[_0xd951('0x12')]('['+[_0x1ff620[_0xd951('0xf')]()]+']',_0x3d7e63[_0xd951('0x13')]);_0x31d1c4(_0x3d7e63[_0xd951('0x13')]);});}else{logger[_0xd951('0x14')]('['+[_0x1ff620[_0xd951('0xf')]()]+_0xd951('0x1f'));_0x249764[_0xd951('0x1c')]=_0x249764[_0xd951('0xd')];_0x249764[_0xd951('0x16')]=_0x249764[_0xd951('0x1d')];_0x2e2fde(_0x249764);}});};}function createEndUser(_0x28b816,_0x40e504,_0x188099,_0x2b595d,_0x170d48){logger[_0xd951('0x14')]('['+[_0x28b816['toUpperCase']()]+_0xd951('0x20'),_0x188099);return new Promise(function(_0x5d8625,_0x5c25c5){var _0x4f6e0c={'method':'POST','uri':_0x2b595d+_0xd951('0x21')+_0x170d48,'body':{'user_name':_0x188099[_0xd951('0x22')],'roles':_0xd951('0x23'),'first_name':_0x188099[_0xd951('0x22')],'active':'true','date_format':_0xd951('0x24'),'phone':_0x188099[_0xd951('0x22')]},'auth':_0x40e504,'json':!![]};return rp(_0x4f6e0c)['then'](function(_0x2ac401){logger[_0xd951('0x14')]('['+[_0x28b816[_0xd951('0xf')]()]+_0xd951('0x25'),_0x2ac401[_0xd951('0xb')]);_0x188099['endUserId']=_0x2ac401['result'][_0xd951('0xe')];_0x5d8625(_0x188099);})['catch'](function(_0x532518){logger[_0xd951('0x12')]('['+[_0x28b816['toUpperCase']()]+']',_0x532518[_0xd951('0x13')]);_0x5c25c5(_0x532518[_0xd951('0x13')]);});});}function getEndUser(_0x4af32e,_0x30297c,_0x24fee9,_0x10b65b,_0x373172){return function(_0x567a52){logger[_0xd951('0x14')]('['+[_0x4af32e[_0xd951('0xf')]()]+'],\x20getEndUser\x20input\x20crm',_0x567a52);return new Promise(function(_0x9c3e00,_0x2a4bc5){var _0x4a0087={'method':_0xd951('0x9'),'uri':_0x24fee9+'sys_user?sysparm_query=phone%3D'+_0x567a52[_0xd951('0x22')]+'&'+_0x10b65b+'&'+_0x373172,'auth':_0x30297c,'json':!![]};return rp(_0x4a0087)[_0xd951('0x18')](function(_0x50589f){if(_0x50589f[_0xd951('0xb')]['length']>0x0){_0x567a52[_0xd951('0x26')]=_0x50589f[_0xd951('0xb')][0x0][_0xd951('0xe')];logger[_0xd951('0x14')]('['+[_0x4af32e['toUpperCase']()]+_0xd951('0x27'),_0x567a52);_0x9c3e00(_0x567a52);}else{return createEndUser(_0x4af32e,_0x30297c,_0x567a52,_0x24fee9,_0x10b65b)[_0xd951('0x18')](function(_0x39ffda){logger['info']('['+[_0x4af32e['toUpperCase']()]+_0xd951('0x28'),_0x39ffda);_0x9c3e00(_0x39ffda);});}})[_0xd951('0x11')](function(_0x5e793e){logger[_0xd951('0x12')]('['+[_0x4af32e['toUpperCase']()]+']',_0x5e793e['message']);_0x2a4bc5(_0x5e793e[_0xd951('0x13')]);});});};}function getCustomFields(_0x13f865,_0x370be6){var _0x2ea321={};if(_0x13f865[_0xd951('0xc')]>0x0){_['forEach'](_0x13f865,function(_0x5d63b7){if(_['includes']([_0xd951('0x29'),_0xd951('0x2a')],_0x5d63b7[_0xd951('0x2b')])&&_0x5d63b7[_0xd951('0x2c')]&&!_0x5d63b7[_0xd951('0x2d')]){_0x2ea321[_0x5d63b7['nameField']['toLowerCase']()]=_0x5d63b7['content'][_0xd951('0x2e')]();}else if(_[_0xd951('0x2f')](['string','picklist'],_0x5d63b7['type'])&&_0x5d63b7[_0xd951('0x30')]&&_0x5d63b7[_0xd951('0x2d')]){_0x2ea321[_0x5d63b7[_0xd951('0x30')][_0xd951('0x31')]()]=_0x5d63b7[_0xd951('0x32')]['toString']();}else if(_0x5d63b7[_0xd951('0x2b')]===_0xd951('0x33')&&_0x5d63b7[_0xd951('0x34')]&&_0x5d63b7[_0xd951('0x30')]&&_0x5d63b7['customField']){_0x2ea321[_0x5d63b7[_0xd951('0x30')][_0xd951('0x31')]()]=_0x370be6[_0x5d63b7[_0xd951('0x34')]][_0xd951('0x2e')]();}else if(_0x5d63b7[_0xd951('0x2b')]===_0xd951('0x35')&&_0x5d63b7['Variable']&&_0x5d63b7[_0xd951('0x36')][_0xd951('0x37')]&&_0x5d63b7[_0xd951('0x30')]&&_0x5d63b7[_0xd951('0x2d')]){_0x2ea321[_0x5d63b7[_0xd951('0x30')][_0xd951('0x31')]()]=_0x370be6[_0x5d63b7[_0xd951('0x36')][_0xd951('0x37')][_0xd951('0x31')]()][_0xd951('0x2e')]();}});}return _0x2ea321;}function getTicket(_0x198ca2,_0x552413,_0x32ce41,_0x28c9cc,_0x2e125b,_0x304b4a){return function(_0x21af51){logger[_0xd951('0x14')]('['+[_0x198ca2[_0xd951('0xf')]()]+_0xd951('0x38'),_0x21af51);return new Promise(function(_0x888c66,_0x14e80b){var _0x300795=_0x198ca2[_0xd951('0x31')]()===_0xd951('0x39')?_0x21af51['userId']:_0x21af51[_0xd951('0x26')];var _0x28dd03={'method':_0xd951('0x3a'),'uri':_0x32ce41+_0xd951('0x3b')+'?'+_0x304b4a,'body':Object['assign']({},{'active':_0xd951('0x1b'),'caller_id':_0x300795,'assigned_to':_0x21af51[_0xd951('0x1c')],'short_description':intUtil[_0xd951('0x3c')](_0x28c9cc[_0xd951('0x3d')],_0x2e125b,'\x20'),'description':intUtil['getString'](_0x28c9cc[_0xd951('0x3e')],_0x2e125b,'\x0a')},getCustomFields(_0x28c9cc[_0xd951('0x3f')],_0x2e125b)),'auth':_0x552413,'json':!![]};return rp(_0x28dd03)[_0xd951('0x18')](function(_0x5f05df){logger[_0xd951('0x14')]('['+[_0x198ca2['toUpperCase']()]+_0xd951('0x40'),_0x5f05df['result']);_0x21af51[_0xd951('0x41')]=_0x5f05df[_0xd951('0xb')][_0xd951('0xe')];_0x21af51['ticketNumber']=_0x5f05df[_0xd951('0xb')]['number'];logger[_0xd951('0x14')]('['+[_0x198ca2[_0xd951('0xf')]()]+']\x20getTicket\x20crm',_0x21af51);_0x888c66(_0x21af51);})['catch'](function(_0x5c22ed){logger[_0xd951('0x12')]('['+[_0x198ca2[_0xd951('0xf')]()]+']',_0x5c22ed[_0xd951('0x13')]);_0x14e80b(_0x5c22ed['message']);});});};}function createRemoteTag(_0x1234f3,_0x3fdf7,_0x1cad05,_0x589be3){return new Promise(function(_0x1dc1c8,_0x2c3906){var _0x331b24={'method':_0xd951('0x3a'),'uri':_0x1cad05+_0xd951('0x42')+'?'+_0x589be3,'body':{'short_description':_0x1234f3,'global':!![],'active':!![],'name':_0x1234f3},'auth':_0x3fdf7,'json':!![]};return rp(_0x331b24)['then'](function(_0x92c0b9){var _0x4c6761=_0x92c0b9[_0xd951('0xb')]['sys_id'];_0x1dc1c8(_0x4c6761);});});}function getRemoteTag(_0x127275,_0x1028db,_0x4fa929,_0x145168,_0x2128ab){return new Promise(function(_0xd3416,_0x234080){var _0xa89bc3={'method':'GET','uri':_0x4fa929+'label'+_0xd951('0x43')+_0x127275+'&'+_0x145168,'auth':_0x1028db,'json':!![]};return rp(_0xa89bc3)[_0xd951('0x18')](function(_0x3dacfb){if(_0x3dacfb['result'][_0xd951('0xc')]>0x0){var _0x3cfd2e=_0x3dacfb[_0xd951('0xb')][0x0][_0xd951('0xe')];_0xd3416(_0x3cfd2e);}else{return createRemoteTag(_0x127275,_0x1028db,_0x4fa929,_0x145168)[_0xd951('0x18')](function(_0x5a38b1){_0xd3416(_0x5a38b1);});}});});}function assignTagToIncident(_0xbde99c,_0x3ee4bb,_0x1e3b69,_0x318a88,_0x383283){return new Promise(function(_0x2edf8c,_0x1c45cd){var _0x547759={'method':'POST','uri':_0x1e3b69+'label_entry'+'?'+_0x383283,'body':{'label':_0xbde99c,'table':'incident','id_type':_0xd951('0x44'),'table_key':_0x318a88['ticketId'],'title':_0xd951('0x45')+_0x318a88[_0xd951('0x46')],'id_display':_0x318a88[_0xd951('0x46')]},'auth':_0x3ee4bb,'json':!![]};return rp(_0x547759)[_0xd951('0x18')](function(_0x5f0258){_0x2edf8c();})[_0xd951('0x11')](function(){_0x2edf8c();});});}function manageTags(_0x11ecd3,_0x5ef49a,_0x7dec28,_0x30a479,_0x3ceaeb,_0x29e408,_0x35e301){return new Promise(function(_0x34833e,_0x4d3602){var _0x564894=[];_0x5ef49a['forEach'](function(_0x320cfb){_0x564894[_0xd951('0x47')](getRemoteTag(_0x320cfb,_0x7dec28,_0x30a479,_0x29e408,_0x35e301));});return Promise[_0xd951('0x48')](_0x564894)[_0xd951('0x18')](function(_0x5329d3){if(_0x5329d3[_0xd951('0xc')]){logger[_0xd951('0x14')]('['+[_0x11ecd3[_0xd951('0xf')]()]+_0xd951('0x49'),_0x5329d3);var _0x2397e5=[];_0x5329d3[_0xd951('0x4a')](function(_0x274623){_0x2397e5[_0xd951('0x47')](assignTagToIncident(_0x274623,_0x7dec28,_0x30a479,_0x3ceaeb,_0x29e408));});return Promise['all'](_0x2397e5)[_0xd951('0x18')](function(){_0x34833e();})[_0xd951('0x11')](function(){_0x34833e();});}else{_0x34833e();}});});}function getTags(_0x22de2d,_0x144dfd,_0x3714b9,_0x1f6a48,_0x4ae30e,_0x5812fa){return function(_0x4488d0){return new Promise(function(_0x36e38b,_0x52fbc9){var _0xc7739b=[];var _0xac4444=_0x1f6a48[_0xd951('0x4b')];if(_0xac4444&&_0xac4444[_0xd951('0xc')]>0x0){_0xc7739b=_[_0xd951('0x4c')](_0xac4444,_0xd951('0x37'));}if(_0xc7739b[_0xd951('0xc')]>0x0){return manageTags(_0x22de2d,_0xc7739b,_0x144dfd,_0x3714b9,_0x4488d0,_0x4ae30e,_0x5812fa)[_0xd951('0x18')](function(){_0x36e38b(_0x4488d0);});}else{_0x36e38b(_0x4488d0);}});};}function emit(_0x16841d,_0x2e28aa,_0x58b604){var _0x4e8be3=_0xd951('0x4d')+_0xd951('0x4e')+'%26sysparm_record_list%3Dactive%253Dtrue'+'%255EORDERBYDESCnumber';var _0x29953c={'uri':_0x16841d+_0xd951('0x4f')+_0x58b604+_0x4e8be3};io['to'](util[_0xd951('0x50')](_0xd951('0x51'),_0x2e28aa))[_0xd951('0x52')](_0xd951('0x53'),_0x29953c);}exports['cs']=function(_0x31adc6,_0x353deb,_0x1a740d,_0x4343e5,_0x2c5d7e,_0x57554b,_0x12dd13,_0x48bbe4){var _0x5497c1={};var _0x45c3ec={'user':_0x57554b['username'],'pass':_0x57554b[_0xd951('0x54')]};var _0x2c8cd4=_0xd951('0x55');var _0x1c369f=_0xd951('0x56');_0x57554b[_0xd951('0x57')]=intUtil[_0xd951('0x58')](_0x57554b[_0xd951('0x57')]);_0x57554b[_0xd951('0x59')]=intUtil[_0xd951('0x58')](_0x57554b[_0xd951('0x59')]);var _0x413f0c=util[_0xd951('0x50')](_0xd951('0x5a'),_0x57554b[_0xd951('0x57')]);_0x5497c1[_0xd951('0x16')]=!_['isNil'](_0x4343e5)?_0x4343e5[_0xd951('0x5b')]:null;_0x5497c1['adminEmail']=_0x57554b[_0xd951('0x5b')];_0x5497c1[_0xd951('0x22')]=_0x48bbe4[_0xd951('0x31')]()===_0xd951('0x39')?_0x353deb['destcalleridnum']:_0x353deb[_0xd951('0x5c')];_0x5497c1['callDirection']=_0x48bbe4===_0xd951('0x5d')||_0x48bbe4===_0xd951('0x5e')?_0xd951('0x5d'):_0xd951('0x39');var _0x1b58d7=util['format'](_0xd951('0x5f'),_0x57554b[_0xd951('0x59')],_0x353deb[_0xd951('0x60')],md5(_0x353deb[_0xd951('0x60')]));if(_0x2c5d7e&&_0x2c5d7e[_0xd951('0x61')]){logger[_0xd951('0x14')](_0xd951('0x62'),'Recording\x20is\x20enabled!');_0x353deb['recordingURL']=_0x1b58d7;}else if(_0x12dd13&&_0x12dd13[_0xd951('0x63')]&&_0x12dd13[_0xd951('0x63')]!==_0xd951('0x64')){logger[_0xd951('0x14')](_0xd951('0x65'),'Recording\x20is\x20enabled!');_0x353deb[_0xd951('0x66')]=_0x1b58d7;}else{_0x353deb['recordingURL']='';}return getAdminUser(_0x48bbe4,_0x45c3ec,_0x5497c1,_0x413f0c,_0x1c369f,_0x2c8cd4)[_0xd951('0x18')](getUser(_0x48bbe4,_0x45c3ec,_0x413f0c,_0x1c369f,_0x2c8cd4))[_0xd951('0x18')](getEndUser(_0x48bbe4,_0x45c3ec,_0x413f0c,_0x1c369f,_0x2c8cd4))[_0xd951('0x18')](getTicket(_0x48bbe4,_0x45c3ec,_0x413f0c,_0x1a740d,_0x353deb,_0x1c369f))['then'](function(_0x2cc879){logger[_0xd951('0x14')](util[_0xd951('0x50')](_0xd951('0x67'),_0x2cc879[_0xd951('0x41')]));logger['info'](util[_0xd951('0x50')]('call\x20direction:\x20%s',_0x48bbe4));if(_0x48bbe4!=='unmanaged'){logger['info']('['+[_0x48bbe4[_0xd951('0xf')]()]+']',_0xd951('0x68'));emit(_0x57554b[_0xd951('0x57')],_0x4343e5[_0xd951('0x37')],_0x2cc879[_0xd951('0x41')]);}})[_0xd951('0x11')](function(_0x56d102){logger[_0xd951('0x12')]('['+[_0x48bbe4[_0xd951('0xf')]()]+_0xd951('0x69'),util[_0xd951('0x6a')](_0x56d102,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xa2c7=[']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','true','],\x20EndUser\x20schema','error','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','endUserId','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','string','picklist','type','customField','toLowerCase','content','toString','idField','variable','variableName','Variable','name',']\x20getTicket\x20input\x20crm','userId','incident','getString','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketNumber',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','Incident','ticketId','Incident\x20-\x20','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','map','%26sysparm_record_target%3Dincident','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','trigger:browser:url','username','password','sysparm_limit=1','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email','outbound','destcalleridnum','calleridnum','unmanaged','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','lodash','bluebird','request-promise','util','md5','ioredis','./util','../../../../config/logger','defaults','redis','localhost','GET','sys_user?sysparm_query=user_name%3Dadmin','result','length','adminId','sys_id','info','toUpperCase','catch','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','then','active','adminEmail','],\x20getUser\x20crm'];(function(_0x235024,_0x3b39e5){var _0x3e5cf9=function(_0x4891a1){while(--_0x4891a1){_0x235024['push'](_0x235024['shift']());}};_0x3e5cf9(++_0x3b39e5);}(_0xa2c7,0xba));var _0x7a2c=function(_0x1ae125,_0x20820a){_0x1ae125=_0x1ae125-0x0;var _0x1f3b2b=_0xa2c7[_0x1ae125];return _0x1f3b2b;};'use strict';var _=require(_0x7a2c('0x0'));var Promise=require(_0x7a2c('0x1'));var rp=require(_0x7a2c('0x2'));var util=require(_0x7a2c('0x3'));var md5=require(_0x7a2c('0x4'));var Redis=require(_0x7a2c('0x5'));var intUtil=require(_0x7a2c('0x6'));var config=require('../../../../config/environment');var logger=require(_0x7a2c('0x7'))('servicenow');config['redis']=_[_0x7a2c('0x8')](config[_0x7a2c('0x9')],{'host':_0x7a2c('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x7a2c('0x9')]));function getAdminUser(_0x532abf,_0x463dbb,_0x657faa,_0x39a951,_0x4f9b7b,_0x4ce88c){return new Promise(function(_0x1fd41e,_0x5d38d2){var _0x216db0={'method':_0x7a2c('0xb'),'uri':_0x39a951+_0x7a2c('0xc')+'&'+_0x4f9b7b+'&'+_0x4ce88c,'auth':_0x463dbb,'json':!![]};return rp(_0x216db0)['then'](function(_0x11caa0){if(_0x11caa0[_0x7a2c('0xd')][_0x7a2c('0xe')]>0x0){_0x657faa[_0x7a2c('0xf')]=_0x11caa0['result'][0x0][_0x7a2c('0x10')];}logger[_0x7a2c('0x11')]('['+[_0x532abf[_0x7a2c('0x12')]()]+'],\x20getAdminUser\x20crm',_0x657faa);_0x1fd41e(_0x657faa);})[_0x7a2c('0x13')](function(_0x3199fa){logger['error']('['+[_0x532abf[_0x7a2c('0x12')]()]+']',_0x3199fa[_0x7a2c('0x14')]);_0x5d38d2(_0x3199fa[_0x7a2c('0x14')]);});});}function getUser(_0x27bedd,_0x147e33,_0x55dee3,_0x388e66,_0x172ec8){return function(_0x340e19){logger[_0x7a2c('0x11')]('['+[_0x27bedd[_0x7a2c('0x12')]()]+_0x7a2c('0x15'),_0x340e19);return new Promise(function(_0x31ffae,_0x44d5b5){if(intUtil[_0x7a2c('0x16')](_0x340e19[_0x7a2c('0x17')])){var _0x4d4b83={'method':_0x7a2c('0xb'),'uri':_0x55dee3+_0x7a2c('0x18')+_0x340e19[_0x7a2c('0x17')]+'&'+_0x388e66+'&'+_0x172ec8,'auth':_0x147e33,'json':!![]};logger[_0x7a2c('0x11')]('['+[_0x27bedd['toUpperCase']()]+_0x7a2c('0x19'),_0x4d4b83);return rp(_0x4d4b83)[_0x7a2c('0x1a')](function(_0x4b50a8){logger[_0x7a2c('0x11')]('['+[_0x27bedd[_0x7a2c('0x12')]()]+'],\x20getUser\x20entity',_0x4b50a8);if(_0x4b50a8[_0x7a2c('0xd')][_0x7a2c('0xe')]>0x0&&String(_0x4b50a8[_0x7a2c('0xd')][0x0][_0x7a2c('0x1b')])==='true'){_0x340e19['userId']=_0x4b50a8[_0x7a2c('0xd')][0x0][_0x7a2c('0x10')];}else{_0x340e19['userId']=_0x340e19['adminId'];_0x340e19[_0x7a2c('0x17')]=_0x340e19[_0x7a2c('0x1c')];}logger['info']('['+[_0x27bedd[_0x7a2c('0x12')]()]+_0x7a2c('0x1d'),_0x340e19);_0x31ffae(_0x340e19);})[_0x7a2c('0x13')](function(_0x1adfeb){logger['error']('['+[_0x27bedd[_0x7a2c('0x12')]()]+']',_0x1adfeb[_0x7a2c('0x14')]);_0x44d5b5(_0x1adfeb[_0x7a2c('0x14')]);});}else{logger[_0x7a2c('0x11')]('['+[_0x27bedd[_0x7a2c('0x12')]()]+_0x7a2c('0x1e'));_0x340e19['userId']=_0x340e19[_0x7a2c('0xf')];_0x340e19[_0x7a2c('0x17')]=_0x340e19['adminEmail'];_0x31ffae(_0x340e19);}});};}function createEndUser(_0x1019b4,_0x2750f7,_0x875983,_0x187bfb,_0x2c79b0){logger[_0x7a2c('0x11')]('['+[_0x1019b4['toUpperCase']()]+_0x7a2c('0x1f'),_0x875983);return new Promise(function(_0x25d45a,_0x5ed875){var _0x222cb3={'method':_0x7a2c('0x20'),'uri':_0x187bfb+_0x7a2c('0x21')+_0x2c79b0,'body':{'user_name':_0x875983[_0x7a2c('0x22')],'roles':_0x7a2c('0x23'),'first_name':_0x875983[_0x7a2c('0x22')],'active':_0x7a2c('0x24'),'date_format':'System','phone':_0x875983['endUserNumber']},'auth':_0x2750f7,'json':!![]};return rp(_0x222cb3)['then'](function(_0x5841fb){logger['info']('['+[_0x1019b4[_0x7a2c('0x12')]()]+_0x7a2c('0x25'),_0x5841fb['result']);_0x875983['endUserId']=_0x5841fb[_0x7a2c('0xd')][_0x7a2c('0x10')];_0x25d45a(_0x875983);})[_0x7a2c('0x13')](function(_0x354b88){logger[_0x7a2c('0x26')]('['+[_0x1019b4[_0x7a2c('0x12')]()]+']',_0x354b88['message']);_0x5ed875(_0x354b88[_0x7a2c('0x14')]);});});}function getEndUser(_0x1c4c19,_0x466985,_0x51c35e,_0x41dfff,_0x3e1ddc){return function(_0x54867a){logger[_0x7a2c('0x11')]('['+[_0x1c4c19[_0x7a2c('0x12')]()]+_0x7a2c('0x27'),_0x54867a);return new Promise(function(_0x53d638,_0x10bc84){var _0x5587e9={'method':_0x7a2c('0xb'),'uri':_0x51c35e+_0x7a2c('0x28')+_0x54867a['endUserNumber']+'&'+_0x41dfff+'&'+_0x3e1ddc,'auth':_0x466985,'json':!![]};return rp(_0x5587e9)[_0x7a2c('0x1a')](function(_0x34e04d){if(_0x34e04d['result'][_0x7a2c('0xe')]>0x0){_0x54867a[_0x7a2c('0x29')]=_0x34e04d[_0x7a2c('0xd')][0x0][_0x7a2c('0x10')];logger[_0x7a2c('0x11')]('['+[_0x1c4c19['toUpperCase']()]+_0x7a2c('0x2a'),_0x54867a);_0x53d638(_0x54867a);}else{return createEndUser(_0x1c4c19,_0x466985,_0x54867a,_0x51c35e,_0x41dfff)[_0x7a2c('0x1a')](function(_0xbc69e9){logger[_0x7a2c('0x11')]('['+[_0x1c4c19[_0x7a2c('0x12')]()]+_0x7a2c('0x2b'),_0xbc69e9);_0x53d638(_0xbc69e9);});}})[_0x7a2c('0x13')](function(_0x1ef2b0){logger['error']('['+[_0x1c4c19[_0x7a2c('0x12')]()]+']',_0x1ef2b0['message']);_0x10bc84(_0x1ef2b0[_0x7a2c('0x14')]);});});};}function getCustomFields(_0x3fb705,_0x3f2316){var _0x2378f5={};if(_0x3fb705[_0x7a2c('0xe')]>0x0){_[_0x7a2c('0x2c')](_0x3fb705,function(_0x30b853){if(_[_0x7a2c('0x2d')]([_0x7a2c('0x2e'),_0x7a2c('0x2f')],_0x30b853[_0x7a2c('0x30')])&&_0x30b853['nameField']&&!_0x30b853[_0x7a2c('0x31')]){_0x2378f5[_0x30b853['nameField'][_0x7a2c('0x32')]()]=_0x30b853[_0x7a2c('0x33')][_0x7a2c('0x34')]();}else if(_[_0x7a2c('0x2d')]([_0x7a2c('0x2e'),_0x7a2c('0x2f')],_0x30b853['type'])&&_0x30b853[_0x7a2c('0x35')]&&_0x30b853[_0x7a2c('0x31')]){_0x2378f5[_0x30b853[_0x7a2c('0x35')][_0x7a2c('0x32')]()]=_0x30b853[_0x7a2c('0x33')][_0x7a2c('0x34')]();}else if(_0x30b853['type']===_0x7a2c('0x36')&&_0x30b853[_0x7a2c('0x37')]&&_0x30b853[_0x7a2c('0x35')]&&_0x30b853[_0x7a2c('0x31')]){_0x2378f5[_0x30b853[_0x7a2c('0x35')][_0x7a2c('0x32')]()]=_0x3f2316[_0x30b853['variableName']][_0x7a2c('0x34')]();}else if(_0x30b853[_0x7a2c('0x30')]==='customVariable'&&_0x30b853[_0x7a2c('0x38')]&&_0x30b853[_0x7a2c('0x38')][_0x7a2c('0x39')]&&_0x30b853[_0x7a2c('0x35')]&&_0x30b853[_0x7a2c('0x31')]){_0x2378f5[_0x30b853[_0x7a2c('0x35')]['toLowerCase']()]=_0x3f2316[_0x30b853['Variable'][_0x7a2c('0x39')]['toLowerCase']()][_0x7a2c('0x34')]();}});}return _0x2378f5;}function getTicket(_0x24be9c,_0x2fd7ba,_0x25135e,_0x35b082,_0x5e85a2,_0x17acc8){return function(_0x5d12af){logger[_0x7a2c('0x11')]('['+[_0x24be9c[_0x7a2c('0x12')]()]+_0x7a2c('0x3a'),_0x5d12af);return new Promise(function(_0x1506c5,_0x59081d){var _0x3d8ef0=_0x24be9c[_0x7a2c('0x32')]()==='outbound'?_0x5d12af[_0x7a2c('0x3b')]:_0x5d12af['endUserId'];var _0x26e16f={'method':_0x7a2c('0x20'),'uri':_0x25135e+_0x7a2c('0x3c')+'?'+_0x17acc8,'body':Object['assign']({},{'active':_0x7a2c('0x24'),'caller_id':_0x3d8ef0,'assigned_to':_0x5d12af[_0x7a2c('0x3b')],'short_description':intUtil[_0x7a2c('0x3d')](_0x35b082['Subjects'],_0x5e85a2,'\x20'),'description':intUtil[_0x7a2c('0x3d')](_0x35b082['Descriptions'],_0x5e85a2,'\x0a')},getCustomFields(_0x35b082[_0x7a2c('0x3e')],_0x5e85a2)),'auth':_0x2fd7ba,'json':!![]};return rp(_0x26e16f)['then'](function(_0x236983){logger[_0x7a2c('0x11')]('['+[_0x24be9c[_0x7a2c('0x12')]()]+_0x7a2c('0x3f'),_0x236983['result']);_0x5d12af['ticketId']=_0x236983['result']['sys_id'];_0x5d12af[_0x7a2c('0x40')]=_0x236983[_0x7a2c('0xd')]['number'];logger[_0x7a2c('0x11')]('['+[_0x24be9c[_0x7a2c('0x12')]()]+_0x7a2c('0x41'),_0x5d12af);_0x1506c5(_0x5d12af);})[_0x7a2c('0x13')](function(_0x338159){logger[_0x7a2c('0x26')]('['+[_0x24be9c[_0x7a2c('0x12')]()]+']',_0x338159['message']);_0x59081d(_0x338159[_0x7a2c('0x14')]);});});};}function createRemoteTag(_0x1c7f2c,_0x273b57,_0x58c444,_0x27a4b1){return new Promise(function(_0x55180a,_0x745653){var _0xd9e31d={'method':_0x7a2c('0x20'),'uri':_0x58c444+_0x7a2c('0x42')+'?'+_0x27a4b1,'body':{'short_description':_0x1c7f2c,'global':!![],'active':!![],'name':_0x1c7f2c},'auth':_0x273b57,'json':!![]};return rp(_0xd9e31d)[_0x7a2c('0x1a')](function(_0x57e8f9){var _0x5c65b4=_0x57e8f9[_0x7a2c('0xd')][_0x7a2c('0x10')];_0x55180a(_0x5c65b4);});});}function getRemoteTag(_0x184efd,_0x170f97,_0x53758d,_0x3c4696,_0x527e6a){return new Promise(function(_0xcc1f3c,_0x5d9bf7){var _0x10ac2e={'method':_0x7a2c('0xb'),'uri':_0x53758d+'label'+_0x7a2c('0x43')+_0x184efd+'&'+_0x3c4696,'auth':_0x170f97,'json':!![]};return rp(_0x10ac2e)[_0x7a2c('0x1a')](function(_0x563b1a){if(_0x563b1a[_0x7a2c('0xd')]['length']>0x0){var _0x4c462b=_0x563b1a['result'][0x0][_0x7a2c('0x10')];_0xcc1f3c(_0x4c462b);}else{return createRemoteTag(_0x184efd,_0x170f97,_0x53758d,_0x3c4696)[_0x7a2c('0x1a')](function(_0x225f93){_0xcc1f3c(_0x225f93);});}});});}function assignTagToIncident(_0x7f0613,_0x1575fa,_0x1b64b4,_0x46ba5e,_0x58238a){return new Promise(function(_0x5575ac,_0x58d9d1){var _0x5b6bc9={'method':_0x7a2c('0x20'),'uri':_0x1b64b4+_0x7a2c('0x44')+'?'+_0x58238a,'body':{'label':_0x7f0613,'table':_0x7a2c('0x3c'),'id_type':_0x7a2c('0x45'),'table_key':_0x46ba5e[_0x7a2c('0x46')],'title':_0x7a2c('0x47')+_0x46ba5e[_0x7a2c('0x40')],'id_display':_0x46ba5e[_0x7a2c('0x40')]},'auth':_0x1575fa,'json':!![]};return rp(_0x5b6bc9)['then'](function(_0x4d57b9){_0x5575ac();})[_0x7a2c('0x13')](function(){_0x5575ac();});});}function manageTags(_0x43cd56,_0x52b945,_0x260628,_0x22b9ea,_0x594685,_0x4cd70,_0x8bc336){return new Promise(function(_0x7ef0c,_0x13c05f){var _0x389b8c=[];_0x52b945[_0x7a2c('0x2c')](function(_0x3edb22){_0x389b8c[_0x7a2c('0x48')](getRemoteTag(_0x3edb22,_0x260628,_0x22b9ea,_0x4cd70,_0x8bc336));});return Promise[_0x7a2c('0x49')](_0x389b8c)[_0x7a2c('0x1a')](function(_0x2997ad){if(_0x2997ad[_0x7a2c('0xe')]){logger[_0x7a2c('0x11')]('['+[_0x43cd56[_0x7a2c('0x12')]()]+_0x7a2c('0x4a'),_0x2997ad);var _0x3622b3=[];_0x2997ad[_0x7a2c('0x2c')](function(_0x20c440){_0x3622b3[_0x7a2c('0x48')](assignTagToIncident(_0x20c440,_0x260628,_0x22b9ea,_0x594685,_0x4cd70));});return Promise[_0x7a2c('0x49')](_0x3622b3)[_0x7a2c('0x1a')](function(){_0x7ef0c();})[_0x7a2c('0x13')](function(){_0x7ef0c();});}else{_0x7ef0c();}});});}function getTags(_0x18cfcf,_0x1c161d,_0x17fd8c,_0x305e72,_0x2c3a2b,_0xae43bc){return function(_0x1b045c){return new Promise(function(_0x48c3fd,_0x3a8cca){var _0x468595=[];var _0x2e4a07=_0x305e72['Tags'];if(_0x2e4a07&&_0x2e4a07['length']>0x0){_0x468595=_[_0x7a2c('0x4b')](_0x2e4a07,_0x7a2c('0x39'));}if(_0x468595['length']>0x0){return manageTags(_0x18cfcf,_0x468595,_0x1c161d,_0x17fd8c,_0x1b045c,_0x2c3a2b,_0xae43bc)['then'](function(){_0x48c3fd(_0x1b045c);});}else{_0x48c3fd(_0x1b045c);}});};}function emit(_0x3ea54,_0x49b35a,_0x239489){var _0x172996=_0x7a2c('0x4c')+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+_0x7a2c('0x4d')+_0x7a2c('0x4e');var _0x3b2349={'uri':_0x3ea54+_0x7a2c('0x4f')+_0x239489+_0x172996};io['to'](util[_0x7a2c('0x50')]('user:%s',_0x49b35a))['emit'](_0x7a2c('0x51'),_0x3b2349);}exports['cs']=function(_0x478181,_0x5222e7,_0x3371f0,_0x4b965a,_0x24e98a,_0x239af7,_0x60870f,_0x4fc97f){var _0x5a3858={};var _0xe3f9c7={'user':_0x239af7[_0x7a2c('0x52')],'pass':_0x239af7[_0x7a2c('0x53')]};var _0x12125a=_0x7a2c('0x54');var _0x4f4fea='sysparm_display_value=true';_0x239af7[_0x7a2c('0x55')]=intUtil[_0x7a2c('0x56')](_0x239af7['remoteUri']);_0x239af7[_0x7a2c('0x57')]=intUtil['stripTrailingSlash'](_0x239af7[_0x7a2c('0x57')]);var _0x2877b3=util['format'](_0x7a2c('0x58'),_0x239af7['remoteUri']);_0x5a3858[_0x7a2c('0x17')]=!_[_0x7a2c('0x59')](_0x4b965a)?_0x4b965a[_0x7a2c('0x5a')]:null;_0x5a3858['adminEmail']=_0x239af7[_0x7a2c('0x5a')];_0x5a3858[_0x7a2c('0x22')]=_0x4fc97f[_0x7a2c('0x32')]()===_0x7a2c('0x5b')?_0x5222e7[_0x7a2c('0x5c')]:_0x5222e7[_0x7a2c('0x5d')];_0x5a3858['callDirection']=_0x4fc97f==='queue'||_0x4fc97f===_0x7a2c('0x5e')?_0x7a2c('0x5f'):_0x7a2c('0x5b');var _0x4f8c21=util[_0x7a2c('0x50')](_0x7a2c('0x60'),_0x239af7[_0x7a2c('0x57')],_0x5222e7['uniqueid'],md5(_0x5222e7[_0x7a2c('0x61')]));if(_0x24e98a&&_0x24e98a[_0x7a2c('0x62')]){logger[_0x7a2c('0x11')](_0x7a2c('0x63'),_0x7a2c('0x64'));_0x5222e7[_0x7a2c('0x65')]=_0x4f8c21;}else if(_0x60870f&&_0x60870f['recordingFormat']&&_0x60870f[_0x7a2c('0x66')]!==_0x7a2c('0x67')){logger[_0x7a2c('0x11')](_0x7a2c('0x68'),_0x7a2c('0x64'));_0x5222e7[_0x7a2c('0x65')]=_0x4f8c21;}else{_0x5222e7[_0x7a2c('0x65')]='';}return getAdminUser(_0x4fc97f,_0xe3f9c7,_0x5a3858,_0x2877b3,_0x4f4fea,_0x12125a)[_0x7a2c('0x1a')](getUser(_0x4fc97f,_0xe3f9c7,_0x2877b3,_0x4f4fea,_0x12125a))[_0x7a2c('0x1a')](getEndUser(_0x4fc97f,_0xe3f9c7,_0x2877b3,_0x4f4fea,_0x12125a))[_0x7a2c('0x1a')](getTicket(_0x4fc97f,_0xe3f9c7,_0x2877b3,_0x3371f0,_0x5222e7,_0x4f4fea))['then'](function(_0x459e07){logger[_0x7a2c('0x11')](util[_0x7a2c('0x50')](_0x7a2c('0x69'),_0x459e07['ticketId']));logger[_0x7a2c('0x11')](util['format']('call\x20direction:\x20%s',_0x4fc97f));if(_0x4fc97f!=='unmanaged'){logger[_0x7a2c('0x11')]('['+[_0x4fc97f[_0x7a2c('0x12')]()]+']',_0x7a2c('0x6a'));emit(_0x239af7[_0x7a2c('0x55')],_0x4b965a[_0x7a2c('0x39')],_0x459e07[_0x7a2c('0x46')]);}})[_0x7a2c('0x13')](function(_0x1de290){logger[_0x7a2c('0x26')]('['+[_0x4fc97f[_0x7a2c('0x12')]()]+_0x7a2c('0x6b'),util['inspect'](_0x1de290,{'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 b13c89a..17d3f75 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 _0x4269=['trigger:browser:url','unmanaged','toUpperCase','lastevent','bluebird','md5','util','ioredis','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','localhost','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','created_by','description','duration_hours','duration_minutes','parent_id','parent_type','Contacts','direction','length','variableName','push','idField','JSON','stringify','Calls','format','Basic\x20%s','base64','isNil','Getting\x20agent\x20with\x20name','get_entry_list','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','find','name_value_list','value','Agent\x20found!','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','user_id','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','set_entry','first_name','Caller\x20-\x20%s','[HTTP]','map','forEach','type','string','nameField','customField','content','toString','custom_fields','customVariable','Variable','toLowerCase','login','username','password','PLAIN','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl','uri','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Inbound','Ticket\x20created!','users','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','catch','error','outbound','%s/service/v4_1/rest.php','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','Fields','The\x20Ticket\x20ID\x20is:'];(function(_0x13fdb3,_0x493557){var _0x212e46=function(_0x47b3e0){while(--_0x47b3e0){_0x13fdb3['push'](_0x13fdb3['shift']());}};_0x212e46(++_0x493557);}(_0x4269,0x7a));var _0x9426=function(_0x2a67fe,_0x295c09){_0x2a67fe=_0x2a67fe-0x0;var _0x57e726=_0x4269[_0x2a67fe];return _0x57e726;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require(_0x9426('0x0'));var md5=require(_0x9426('0x1'));var util=require(_0x9426('0x2'));var Redis=require(_0x9426('0x3'));var intUtil=require('./util');var config=require(_0x9426('0x4'));var logger=require(_0x9426('0x5'))(_0x9426('0x6'));config[_0x9426('0x7')]=_[_0x9426('0x8')](config[_0x9426('0x7')],{'host':_0x9426('0x9'),'port':0x18eb});var io=require(_0x9426('0xa'))(new Redis(config[_0x9426('0x7')]));var def={'method':_0x9426('0xb'),'json':!![]};function emit(_0x4b3785,_0x36a5d7,_0x2e6b48){io['to'](_0x4b3785)[_0x9426('0xc')](_0x36a5d7,_0x2e6b48);}function getTicket(_0x590b8b,_0x45a6e4,_0x122446,_0x5929f6,_0x31d1c9,_0x599e7d,_0x33e262,_0x4f2d29){logger[_0x9426('0xd')](_0x9426('0xe'));var _0x321bb1=new Date();var _0x2e867d=[{'name':_0x9426('0xf'),'value':intUtil[_0x9426('0x10')](_0x5929f6[_0x9426('0x11')],_0x31d1c9,'\x20')},{'name':_0x9426('0x12'),'value':_0x45a6e4['id']},{'name':_0x9426('0x13'),'value':_0x45a6e4['id']},{'name':_0x9426('0x14'),'value':intUtil[_0x9426('0x10')](_0x5929f6['Descriptions'],_0x31d1c9,'\x0a')},{'name':'date_start','value':_0x321bb1['toISOString']()['slice'](0x0,0x13)['replace']('T','\x20')},{'name':_0x9426('0x15'),'value':'0'},{'name':_0x9426('0x16'),'value':'15'},{'name':_0x9426('0x17'),'value':_0x122446['id']},{'name':_0x9426('0x18'),'value':_0x9426('0x19')},{'name':'parent_name','value':_0x122446[_0x9426('0xf')]},{'name':_0x9426('0x1a'),'value':_0x4f2d29}];if(_0x599e7d[_0x9426('0x1b')]){_['forEach'](_0x599e7d,function(_0x590778){if(_0x31d1c9[_0x590778[_0x9426('0x1c')]]){_0x2e867d[_0x9426('0x1d')]({'name':_0x590778[_0x9426('0x1e')],'value':_0x31d1c9[_0x590778[_0x9426('0x1c')]]});}});}return request({'form':{'method':'set_entry','input_type':_0x9426('0x1f'),'response_type':_0x9426('0x1f'),'rest_data':JSON[_0x9426('0x20')]({'session':_0x33e262['id'],'module_name':_0x9426('0x21'),'name_value_list':_0x2e867d})}});}function getAuth(_0x3e6b4b){return util[_0x9426('0x22')](_0x9426('0x23'),new Buffer(_0x3e6b4b['apiKey']+':X')['toString'](_0x9426('0x24')));}function getServerInfo(_0x472ebf){return request({'form':{'method':'get_server_info','input_type':_0x9426('0x1f'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x472ebf['id']})}});}function getUser(_0x2c94a0,_0x5072c2,_0x90abc5){if(!_[_0x9426('0x25')](_0x5072c2)){logger['info'](_0x9426('0x26'),_0x5072c2);return request({'form':{'method':_0x9426('0x27'),'input_type':'JSON','response_type':_0x9426('0x1f'),'rest_data':JSON['stringify']({'session':_0x90abc5['id'],'module_name':'Employees','query':util[_0x9426('0x22')](_0x9426('0x28'),_0x5072c2),'order_by':'','offset':'0','select_fields':['id',_0x9426('0xf'),_0x9426('0x29')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x9426('0x2a')](function(_0x238456){if(_0x238456[_0x9426('0x2b')][_0x9426('0x1b')]){var _0x56c73a=_[_0x9426('0x2c')](_0x238456[_0x9426('0x2b')],function(_0x525eda){return _0x525eda[_0x9426('0x2d')][_0x9426('0x29')][_0x9426('0x2e')]===_0x5072c2;});if(_0x56c73a){logger[_0x9426('0xd')](_0x9426('0x2f'));return BPromise[_0x9426('0x30')]({'id':_0x56c73a['name_value_list']['id'][_0x9426('0x2e')],'name':_0x56c73a[_0x9426('0x2d')][_0x9426('0xf')][_0x9426('0x2e')]});}}logger[_0x9426('0xd')](_0x9426('0x31'));return BPromise[_0x9426('0x30')]({'id':_0x90abc5[_0x9426('0x2d')]['user_id'][_0x9426('0x2e')],'name':_0x90abc5[_0x9426('0x2d')][_0x9426('0x29')]['value']});});}else{logger[_0x9426('0xd')](_0x9426('0x32'));return BPromise[_0x9426('0x30')]({'id':_0x90abc5[_0x9426('0x2d')][_0x9426('0x33')]['value'],'name':_0x90abc5[_0x9426('0x2d')][_0x9426('0x29')][_0x9426('0x2e')]});}}function getEndUser(_0x34e93a,_0x228b44,_0x618f7f,_0x249a4a){logger[_0x9426('0xd')]('Searching\x20enduser\x20with\x20phone',_0x618f7f);return request({'form':{'method':_0x9426('0x27'),'input_type':_0x9426('0x1f'),'response_type':'JSON','rest_data':JSON[_0x9426('0x20')]({'session':_0x249a4a['id'],'module_name':_0x9426('0x19'),'query':util[_0x9426('0x22')](_0x9426('0x34'),_0x618f7f),'order_by':'','offset':'0','select_fields':['id',_0x9426('0xf'),_0x9426('0x35')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x9426('0x2a')](function(_0x102a44){if(_0x102a44[_0x9426('0x2b')]['length']){var _0x4fe04f=_[_0x9426('0x2c')](_0x102a44[_0x9426('0x2b')],function(_0x430dc5){return _0x430dc5[_0x9426('0x2d')][_0x9426('0x35')]['value']===_0x618f7f;});if(_0x4fe04f){logger[_0x9426('0xd')](_0x9426('0x36'));return BPromise[_0x9426('0x30')]({'id':_0x4fe04f[_0x9426('0x2d')]['id'][_0x9426('0x2e')],'name':_0x4fe04f[_0x9426('0x2d')][_0x9426('0xf')]['value'],'phone':_0x4fe04f[_0x9426('0x2d')]['phone_home'][_0x9426('0x2e')]});}}else{logger[_0x9426('0xd')](_0x9426('0x37'));return request({'form':{'method':_0x9426('0x38'),'input_type':_0x9426('0x1f'),'response_type':'JSON','rest_data':JSON[_0x9426('0x20')]({'session':_0x249a4a['id'],'module_name':'Contacts','name_value_list':[{'name':_0x9426('0x39'),'value':_0x228b44!==''?_0x228b44:util[_0x9426('0x22')](_0x9426('0x3a'),_0x618f7f)},{'name':_0x9426('0x35'),'value':_0x618f7f}]})}})[_0x9426('0x2a')](function(_0x535d0e){logger['info']('Enduser\x20created.');return BPromise[_0x9426('0x30')]({'id':_0x535d0e['id'],'name':_0x535d0e[_0x9426('0x2b')][_0x9426('0x39')][_0x9426('0x2e')],'phone':_0x535d0e['entry_list'][_0x9426('0x35')][_0x9426('0x2e')]});});}});}function request(_0x517f54){logger['debug'](_0x9426('0x3b'),JSON['stringify'](_0x517f54));return rp(_['merge'](def,_0x517f54));}function getTags(_0x55f8ca,_0xcc076b){var _0x573637=[];if(_0x55f8ca&&_0x55f8ca[_0x9426('0x1b')]>0x0){_0x573637=_[_0x9426('0x3c')](_0x55f8ca,_0xcc076b);}return _0x573637;}function getCustomFields(_0x4d068d,_0x166d50){var _0x5ceb73=[];var _0x17bd46={'custom_fields':[]};if(_0x4d068d[_0x9426('0x1b')]>0x0){_[_0x9426('0x3d')](_0x4d068d,function(_0x473952){if(_0x473952[_0x9426('0x3e')]===_0x9426('0x3f')&&_0x473952[_0x9426('0x40')]&&!_0x473952[_0x9426('0x41')]){_0x17bd46[_0x473952['nameField']['toLowerCase']()]=_0x473952[_0x9426('0x42')][_0x9426('0x43')]();}else if(_0x473952[_0x9426('0x3e')]==='string'&&_0x473952[_0x9426('0x1e')]&&_0x473952[_0x9426('0x41')]){_0x17bd46[_0x9426('0x44')][_0x9426('0x1d')]({'id':_0x473952[_0x9426('0x1e')],'value':_0x473952[_0x9426('0x42')][_0x9426('0x43')]()});}else if(_0x473952[_0x9426('0x3e')]==='variable'&&_0x473952['variableName']&&_0x473952['idField']&&_0x473952[_0x9426('0x41')]){_0x166d50[_0x473952[_0x9426('0x1c')]]&&_0x17bd46[_0x9426('0x44')]['push']({'id':_0x473952[_0x9426('0x1e')],'value':_0x166d50[_0x473952[_0x9426('0x1c')]][_0x9426('0x43')]()});}else if(_0x473952[_0x9426('0x3e')]===_0x9426('0x45')&&_0x473952[_0x9426('0x46')]&&_0x473952['Variable'][_0x9426('0xf')]&&_0x473952[_0x9426('0x1e')]&&_0x473952['customField']){_0x166d50[_0x473952['Variable'][_0x9426('0xf')][_0x9426('0x47')]()]&&_0x17bd46[_0x9426('0x44')][_0x9426('0x1d')]({'id':_0x473952['idField'],'value':_0x166d50[_0x473952['Variable'][_0x9426('0xf')][_0x9426('0x47')]()][_0x9426('0x43')]()});}});}return _0x17bd46;}function getConnection(_0x517036){return request({'method':'POST','form':{'method':_0x9426('0x48'),'input_type':'JSON','response_type':'JSON','rest_data':JSON['stringify']({'user_auth':{'user_name':_0x517036[_0x9426('0x49')],'password':_0x517036[_0x9426('0x4a')],'encryption':_0x9426('0x4b')},'application':'xCALLY\x20Motion\x20integration'})}})['then'](function(_0x3105fc){var _0x3b3cc6=_0x3105fc;if(_0x3b3cc6['id']){def[_0x9426('0x4c')]=_0x3b3cc6['id'];return BPromise['resolve'](_0x3b3cc6);}else{throw new Error(util['format'](_0x9426('0x4d'),_0x517036['id']));}});}function setRelationship(_0x205c01,_0x15c6c4,_0x4472be,_0x8c868){return request({'form':{'method':_0x9426('0x4e'),'input_type':'JSON','response_type':_0x9426('0x1f'),'rest_data':JSON[_0x9426('0x20')]({'session':_0x205c01['id'],'module_name':_0x9426('0x21'),'module_id':_0x4472be['id'],'link_field_name':_0x8c868,'related_ids':[_0x15c6c4['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x9426('0x4f')]=function(_0x3b7206,_0x90a8a9,_0x1915b6,_0x4f66fb,_0x26bab7,_0x28976f){var _0x3fd453,_0x32cc06,_0x323ee1,_0x34ffda;_0x28976f[_0x9426('0x50')]=intUtil[_0x9426('0x51')](_0x28976f[_0x9426('0x50')]);_0x28976f[_0x9426('0x52')]=intUtil[_0x9426('0x51')](_0x28976f[_0x9426('0x52')]);def[_0x9426('0x53')]=util[_0x9426('0x22')]('%s/service/v4_1/rest.php',_0x28976f[_0x9426('0x50')]);if(_0x26bab7&&_0x26bab7[_0x9426('0x54')]){logger[_0x9426('0xd')](_0x9426('0x55'),_0x9426('0x56'));_0x90a8a9[_0x9426('0x57')]=util[_0x9426('0x22')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x28976f['serverUrl'],_0x90a8a9['uniqueid'],md5(_0x90a8a9[_0x9426('0x58')]));}else{_0x90a8a9[_0x9426('0x57')]='';}return getConnection(_0x28976f)[_0x9426('0x2a')](function(_0x3f0cd4){_0x34ffda=_0x3f0cd4;return getUser(_0x28976f,_0x4f66fb[_0x9426('0xf')],_0x34ffda);})[_0x9426('0x2a')](function(_0x345d35){_0x3fd453=_0x345d35;logger[_0x9426('0xd')](_0x9426('0x59'),_0x3fd453['id']);return getEndUser(_0x28976f,_0x90a8a9[_0x9426('0x5a')],_0x90a8a9[_0x9426('0x5b')],_0x34ffda);})[_0x9426('0x2a')](function(_0x2069a5){_0x32cc06=_0x2069a5;logger[_0x9426('0xd')](_0x9426('0x5c'),_0x32cc06['id']);return getTicket(_0x28976f,_0x3fd453,_0x32cc06,_0x1915b6,_0x90a8a9,_0x1915b6['Fields'],_0x34ffda,_0x9426('0x5d'));})[_0x9426('0x2a')](function(_0x348081){_0x323ee1=_0x348081;logger[_0x9426('0xd')](_0x9426('0x5e'));logger[_0x9426('0xd')]('The\x20Ticket\x20ID\x20is:',_0x323ee1['id']);return setRelationship(_0x34ffda,_0x3fd453,_0x323ee1,_0x9426('0x5f'));})[_0x9426('0x2a')](function(){return setRelationship(_0x34ffda,_0x32cc06,_0x323ee1,_0x9426('0x60'));})[_0x9426('0x2a')](function(){return getServerInfo(_0x34ffda);})[_0x9426('0x2a')](function(_0x147719){var _0x7feb02=parseInt(_0x147719[_0x9426('0x61')][_0x9426('0x62')](0x0));var _0x5034b5=util[_0x9426('0x22')](_0x9426('0x63'),_0x28976f['remoteUri'],_0x323ee1['id']);if(_0x7feb02>0x6){_0x5034b5=util[_0x9426('0x22')](_0x9426('0x64'),_0x28976f[_0x9426('0x50')],_0x323ee1['id']);}logger[_0x9426('0xd')](_0x9426('0x55'),_0x9426('0x65'));emit(util['format']('user:%s',_0x4f66fb[_0x9426('0xf')]),'trigger:browser:url',{'uri':_0x5034b5});})[_0x9426('0x66')](function(_0x19950b){logger[_0x9426('0x67')](_0x9426('0x55'),JSON[_0x9426('0x20')](_0x19950b));});};exports[_0x9426('0x68')]=function(_0x14f0ed,_0x4431eb,_0x35f49e,_0x45b9aa,_0x374ce7,_0x2ad51f,_0x51c2a4){var _0x255b0d,_0x2ef8cf,_0x1646c2,_0x5e6983;_0x2ad51f['remoteUri']=intUtil[_0x9426('0x51')](_0x2ad51f[_0x9426('0x50')]);_0x2ad51f['serverUrl']=intUtil[_0x9426('0x51')](_0x2ad51f[_0x9426('0x52')]);def['uri']=util[_0x9426('0x22')](_0x9426('0x69'),_0x2ad51f[_0x9426('0x50')]);if(_0x51c2a4&&_0x51c2a4[_0x9426('0x6a')]&&_0x51c2a4['recordingFormat']!==_0x9426('0x6b')){logger[_0x9426('0xd')](_0x9426('0x6c'),'Recording\x20is\x20enabled!');_0x4431eb[_0x9426('0x57')]=util[_0x9426('0x22')](_0x9426('0x6d'),_0x2ad51f['serverUrl'],_0x4431eb[_0x9426('0x58')],md5(_0x4431eb[_0x9426('0x58')]));}return getConnection(_0x2ad51f)[_0x9426('0x2a')](function(_0xc7c0cf){_0x5e6983=_0xc7c0cf;return getUser(_0x2ad51f,_0x45b9aa[_0x9426('0xf')],_0x5e6983);})[_0x9426('0x2a')](function(_0x5944ac){_0x255b0d=_0x5944ac;logger['info']('The\x20User\x20ID\x20is:',_0x255b0d['id']);return getEndUser(_0x2ad51f,_0x4431eb[_0x9426('0x6e')],_0x4431eb[_0x9426('0x6f')],_0x5e6983);})[_0x9426('0x2a')](function(_0x1c527e){_0x2ef8cf=_0x1c527e;logger[_0x9426('0xd')](_0x9426('0x5c'),_0x2ef8cf['id']);return getTicket(_0x2ad51f,_0x255b0d,_0x2ef8cf,_0x35f49e,_0x4431eb,_0x35f49e[_0x9426('0x70')],_0x5e6983,'Outbound');})[_0x9426('0x2a')](function(_0x328015){_0x1646c2=_0x328015;logger[_0x9426('0xd')](_0x9426('0x5e'));logger[_0x9426('0xd')](_0x9426('0x71'),_0x1646c2['id']);return setRelationship(_0x5e6983,_0x255b0d,_0x1646c2,_0x9426('0x5f'));})[_0x9426('0x2a')](function(){return setRelationship(_0x5e6983,_0x2ef8cf,_0x1646c2,_0x9426('0x60'));})['then'](function(){return getServerInfo(_0x5e6983);})[_0x9426('0x2a')](function(_0x16169a){var _0x53277b=parseInt(_0x16169a[_0x9426('0x61')][_0x9426('0x62')](0x0));var _0x135b87=util[_0x9426('0x22')](_0x9426('0x63'),_0x2ad51f[_0x9426('0x50')],_0x1646c2['id']);if(_0x53277b>0x6){_0x135b87=util[_0x9426('0x22')](_0x9426('0x64'),_0x2ad51f[_0x9426('0x50')],_0x1646c2['id']);}logger[_0x9426('0xd')](_0x9426('0x6c'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x45b9aa[_0x9426('0xf')]),_0x9426('0x72'),{'uri':_0x135b87});})[_0x9426('0x66')](function(_0x50d3f0){logger[_0x9426('0x67')](_0x9426('0x6c'),JSON[_0x9426('0x20')](_0x50d3f0));});};exports[_0x9426('0x73')]=function(_0x16b86f,_0x18fe52,_0x30a3b0,_0x5e6a88,_0xa373e4,_0x3cd874){var _0x43505a,_0x1f37fc,_0x145b67,_0x135033;_0x3cd874[_0x9426('0x50')]=intUtil[_0x9426('0x51')](_0x3cd874[_0x9426('0x50')]);_0x3cd874[_0x9426('0x52')]=intUtil[_0x9426('0x51')](_0x3cd874['serverUrl']);def[_0x9426('0x53')]=util[_0x9426('0x22')]('%s/service/v4_1/rest.php',_0x3cd874[_0x9426('0x50')]);if(_0xa373e4&&_0xa373e4[_0x9426('0x54')]){logger[_0x9426('0xd')]('['+_0x18fe52['lastevent'][_0x9426('0x74')]()+']',_0x9426('0x56'));_0x18fe52['recordingURL']=util[_0x9426('0x22')](_0x9426('0x6d'),_0x3cd874[_0x9426('0x52')],_0x18fe52['uniqueid'],md5(_0x18fe52[_0x9426('0x58')]));}else{_0x18fe52[_0x9426('0x57')]='';}return getConnection(_0x3cd874)[_0x9426('0x2a')](function(_0xe40d97){_0x135033=_0xe40d97;if(!_[_0x9426('0x25')](_0x5e6a88)){return getUser(_0x3cd874,_0x5e6a88[_0x9426('0xf')],_0x135033);}else{return getUser(_0x3cd874,null,_0x135033);}})[_0x9426('0x2a')](function(_0x5780f0){_0x43505a=_0x5780f0;logger[_0x9426('0xd')](_0x9426('0x59'),_0x43505a['id']);return getEndUser(_0x3cd874,_0x18fe52[_0x9426('0x5a')],_0x18fe52[_0x9426('0x5b')],_0x135033);})[_0x9426('0x2a')](function(_0x418f2c){_0x1f37fc=_0x418f2c;logger[_0x9426('0xd')](_0x9426('0x5c'),_0x1f37fc['id']);return getTicket(_0x3cd874,_0x43505a,_0x1f37fc,_0x30a3b0,_0x18fe52,_0x30a3b0[_0x9426('0x70')],_0x135033,_0x9426('0x5d'));})[_0x9426('0x2a')](function(_0x41056e){_0x145b67=_0x41056e;logger[_0x9426('0xd')](_0x9426('0x5e'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x145b67['id']);return setRelationship(_0x135033,_0x43505a,_0x145b67,_0x9426('0x5f'));})[_0x9426('0x2a')](function(){return setRelationship(_0x135033,_0x1f37fc,_0x145b67,_0x9426('0x60'));})['then'](function(){return getServerInfo(_0x135033);})[_0x9426('0x66')](function(_0x458a3c){logger[_0x9426('0x67')]('['+_0x18fe52[_0x9426('0x75')][_0x9426('0x74')]()+']',JSON[_0x9426('0x20')](_0x458a3c));});}; \ No newline at end of file +var _0xd9fd=['POST','login','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','remoteUri','stripTrailingSlash','serverUrl','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','The\x20Ticket\x20ID\x20is:','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','outbound','recordingFormat','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridnum','Outbound','Ticket\x20created!','users','contacts','unmanaged','uri','lastevent','toUpperCase','calleridname','Inbound','request-promise','bluebird','md5','util','./util','sugarcrm','redis','socket.io-emitter','emit','info','Creating\x20new\x20ticket...','getString','assigned_user_id','created_by','description','date_start','toISOString','slice','replace','parent_id','parent_type','Contacts','length','forEach','push','idField','variableName','JSON','stringify','Calls','format','apiKey','base64','get_server_info','isNil','Getting\x20agent\x20with\x20name','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','name','user_name','then','entry_list','find','name_value_list','value','Agent\x20found!','resolve','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','user_id','Searching\x20enduser\x20with\x20phone','get_entry_list','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','set_entry','first_name','','Enduser\x20created.','debug','[HTTP]','merge','map','type','nameField','toLowerCase','content','toString','string','variable','customField','custom_fields','customVariable','Variable'];(function(_0x3799f1,_0x5635f7){var _0x559ecb=function(_0xb032e9){while(--_0xb032e9){_0x3799f1['push'](_0x3799f1['shift']());}};_0x559ecb(++_0x5635f7);}(_0xd9fd,0xa1));var _0xdd9f=function(_0x2acf09,_0x194976){_0x2acf09=_0x2acf09-0x0;var _0x5647be=_0xd9fd[_0x2acf09];return _0x5647be;};'use strict';var _=require('lodash');var rp=require(_0xdd9f('0x0'));var BPromise=require(_0xdd9f('0x1'));var md5=require(_0xdd9f('0x2'));var util=require(_0xdd9f('0x3'));var Redis=require('ioredis');var intUtil=require(_0xdd9f('0x4'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0xdd9f('0x5'));config[_0xdd9f('0x6')]=_['defaults'](config[_0xdd9f('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0xdd9f('0x7'))(new Redis(config[_0xdd9f('0x6')]));var def={'method':'POST','json':!![]};function emit(_0x527c50,_0x4887f2,_0x45544c){io['to'](_0x527c50)[_0xdd9f('0x8')](_0x4887f2,_0x45544c);}function getTicket(_0x37a070,_0x38ecf0,_0x2b03b9,_0x42a295,_0x6901fd,_0x531dcb,_0x26709b,_0x1faf8d){logger[_0xdd9f('0x9')](_0xdd9f('0xa'));var _0x2f3a40=new Date();var _0x40cb9a=[{'name':'name','value':intUtil[_0xdd9f('0xb')](_0x42a295['Subjects'],_0x6901fd,'\x20')},{'name':_0xdd9f('0xc'),'value':_0x38ecf0['id']},{'name':_0xdd9f('0xd'),'value':_0x38ecf0['id']},{'name':_0xdd9f('0xe'),'value':intUtil['getString'](_0x42a295['Descriptions'],_0x6901fd,'\x0a')},{'name':_0xdd9f('0xf'),'value':_0x2f3a40[_0xdd9f('0x10')]()[_0xdd9f('0x11')](0x0,0x13)[_0xdd9f('0x12')]('T','\x20')},{'name':'duration_hours','value':'0'},{'name':'duration_minutes','value':'15'},{'name':_0xdd9f('0x13'),'value':_0x2b03b9['id']},{'name':_0xdd9f('0x14'),'value':_0xdd9f('0x15')},{'name':'parent_name','value':_0x2b03b9['name']},{'name':'direction','value':_0x1faf8d}];if(_0x531dcb[_0xdd9f('0x16')]){_[_0xdd9f('0x17')](_0x531dcb,function(_0x1b27bb){if(_0x6901fd[_0x1b27bb['variableName']]){_0x40cb9a[_0xdd9f('0x18')]({'name':_0x1b27bb[_0xdd9f('0x19')],'value':_0x6901fd[_0x1b27bb[_0xdd9f('0x1a')]]});}});}return request({'form':{'method':'set_entry','input_type':_0xdd9f('0x1b'),'response_type':'JSON','rest_data':JSON[_0xdd9f('0x1c')]({'session':_0x26709b['id'],'module_name':_0xdd9f('0x1d'),'name_value_list':_0x40cb9a})}});}function getAuth(_0x3ae18a){return util[_0xdd9f('0x1e')]('Basic\x20%s',new Buffer(_0x3ae18a[_0xdd9f('0x1f')]+':X')['toString'](_0xdd9f('0x20')));}function getServerInfo(_0x10f44e){return request({'form':{'method':_0xdd9f('0x21'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0xdd9f('0x1c')]({'session':_0x10f44e['id']})}});}function getUser(_0x35316f,_0x1d715c,_0x41b0b7){if(!_[_0xdd9f('0x22')](_0x1d715c)){logger[_0xdd9f('0x9')](_0xdd9f('0x23'),_0x1d715c);return request({'form':{'method':'get_entry_list','input_type':_0xdd9f('0x1b'),'response_type':_0xdd9f('0x1b'),'rest_data':JSON['stringify']({'session':_0x41b0b7['id'],'module_name':_0xdd9f('0x24'),'query':util[_0xdd9f('0x1e')](_0xdd9f('0x25'),_0x1d715c),'order_by':'','offset':'0','select_fields':['id',_0xdd9f('0x26'),_0xdd9f('0x27')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xdd9f('0x28')](function(_0x5cb3c2){if(_0x5cb3c2[_0xdd9f('0x29')][_0xdd9f('0x16')]){var _0x755374=_[_0xdd9f('0x2a')](_0x5cb3c2[_0xdd9f('0x29')],function(_0x556c9b){return _0x556c9b[_0xdd9f('0x2b')]['user_name'][_0xdd9f('0x2c')]===_0x1d715c;});if(_0x755374){logger[_0xdd9f('0x9')](_0xdd9f('0x2d'));return BPromise[_0xdd9f('0x2e')]({'id':_0x755374[_0xdd9f('0x2b')]['id']['value'],'name':_0x755374[_0xdd9f('0x2b')][_0xdd9f('0x26')][_0xdd9f('0x2c')]});}}logger[_0xdd9f('0x9')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0xdd9f('0x2e')]({'id':_0x41b0b7['name_value_list']['user_id']['value'],'name':_0x41b0b7[_0xdd9f('0x2b')][_0xdd9f('0x27')][_0xdd9f('0x2c')]});});}else{logger[_0xdd9f('0x9')](_0xdd9f('0x2f'));return BPromise['resolve']({'id':_0x41b0b7[_0xdd9f('0x2b')][_0xdd9f('0x30')][_0xdd9f('0x2c')],'name':_0x41b0b7[_0xdd9f('0x2b')][_0xdd9f('0x27')][_0xdd9f('0x2c')]});}}function getEndUser(_0x1f60d7,_0x13bb2e,_0x5829f1,_0x28579d){logger[_0xdd9f('0x9')](_0xdd9f('0x31'),_0x5829f1);return request({'form':{'method':_0xdd9f('0x32'),'input_type':'JSON','response_type':'JSON','rest_data':JSON['stringify']({'session':_0x28579d['id'],'module_name':_0xdd9f('0x15'),'query':util[_0xdd9f('0x1e')](_0xdd9f('0x33'),_0x5829f1),'order_by':'','offset':'0','select_fields':['id','name',_0xdd9f('0x34')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xdd9f('0x28')](function(_0x1d3266){if(_0x1d3266['entry_list'][_0xdd9f('0x16')]){var _0x5e9171=_[_0xdd9f('0x2a')](_0x1d3266[_0xdd9f('0x29')],function(_0xd2dc8b){return _0xd2dc8b[_0xdd9f('0x2b')]['phone_home']['value']===_0x5829f1;});if(_0x5e9171){logger['info'](_0xdd9f('0x35'));return BPromise[_0xdd9f('0x2e')]({'id':_0x5e9171[_0xdd9f('0x2b')]['id'][_0xdd9f('0x2c')],'name':_0x5e9171['name_value_list'][_0xdd9f('0x26')][_0xdd9f('0x2c')],'phone':_0x5e9171[_0xdd9f('0x2b')]['phone_home'][_0xdd9f('0x2c')]});}}else{logger[_0xdd9f('0x9')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0xdd9f('0x36'),'input_type':_0xdd9f('0x1b'),'response_type':_0xdd9f('0x1b'),'rest_data':JSON['stringify']({'session':_0x28579d['id'],'module_name':_0xdd9f('0x15'),'name_value_list':[{'name':_0xdd9f('0x37'),'value':_0x13bb2e!==_0xdd9f('0x38')?_0x13bb2e:util[_0xdd9f('0x1e')]('Caller\x20-\x20%s',_0x5829f1)},{'name':_0xdd9f('0x34'),'value':_0x5829f1}]})}})[_0xdd9f('0x28')](function(_0x3b4044){logger[_0xdd9f('0x9')](_0xdd9f('0x39'));return BPromise[_0xdd9f('0x2e')]({'id':_0x3b4044['id'],'name':_0x3b4044[_0xdd9f('0x29')][_0xdd9f('0x37')][_0xdd9f('0x2c')],'phone':_0x3b4044['entry_list'][_0xdd9f('0x34')][_0xdd9f('0x2c')]});});}});}function request(_0x51bc62){logger[_0xdd9f('0x3a')](_0xdd9f('0x3b'),JSON[_0xdd9f('0x1c')](_0x51bc62));return rp(_[_0xdd9f('0x3c')](def,_0x51bc62));}function getTags(_0x1e1cd9,_0x576054){var _0x5a0b7f=[];if(_0x1e1cd9&&_0x1e1cd9[_0xdd9f('0x16')]>0x0){_0x5a0b7f=_[_0xdd9f('0x3d')](_0x1e1cd9,_0x576054);}return _0x5a0b7f;}function getCustomFields(_0x9e429e,_0xac95a3){var _0x5638fc=[];var _0x1712b6={'custom_fields':[]};if(_0x9e429e['length']>0x0){_[_0xdd9f('0x17')](_0x9e429e,function(_0x2eb477){if(_0x2eb477[_0xdd9f('0x3e')]==='string'&&_0x2eb477[_0xdd9f('0x3f')]&&!_0x2eb477['customField']){_0x1712b6[_0x2eb477[_0xdd9f('0x3f')][_0xdd9f('0x40')]()]=_0x2eb477[_0xdd9f('0x41')][_0xdd9f('0x42')]();}else if(_0x2eb477[_0xdd9f('0x3e')]===_0xdd9f('0x43')&&_0x2eb477['idField']&&_0x2eb477['customField']){_0x1712b6['custom_fields']['push']({'id':_0x2eb477['idField'],'value':_0x2eb477['content'][_0xdd9f('0x42')]()});}else if(_0x2eb477[_0xdd9f('0x3e')]===_0xdd9f('0x44')&&_0x2eb477[_0xdd9f('0x1a')]&&_0x2eb477[_0xdd9f('0x19')]&&_0x2eb477[_0xdd9f('0x45')]){_0xac95a3[_0x2eb477['variableName']]&&_0x1712b6[_0xdd9f('0x46')][_0xdd9f('0x18')]({'id':_0x2eb477['idField'],'value':_0xac95a3[_0x2eb477[_0xdd9f('0x1a')]]['toString']()});}else if(_0x2eb477['type']===_0xdd9f('0x47')&&_0x2eb477['Variable']&&_0x2eb477['Variable'][_0xdd9f('0x26')]&&_0x2eb477[_0xdd9f('0x19')]&&_0x2eb477[_0xdd9f('0x45')]){_0xac95a3[_0x2eb477[_0xdd9f('0x48')][_0xdd9f('0x26')][_0xdd9f('0x40')]()]&&_0x1712b6[_0xdd9f('0x46')]['push']({'id':_0x2eb477[_0xdd9f('0x19')],'value':_0xac95a3[_0x2eb477[_0xdd9f('0x48')][_0xdd9f('0x26')][_0xdd9f('0x40')]()]['toString']()});}});}return _0x1712b6;}function getConnection(_0x56f8d6){return request({'method':_0xdd9f('0x49'),'form':{'method':_0xdd9f('0x4a'),'input_type':_0xdd9f('0x1b'),'response_type':_0xdd9f('0x1b'),'rest_data':JSON[_0xdd9f('0x1c')]({'user_auth':{'user_name':_0x56f8d6['username'],'password':_0x56f8d6[_0xdd9f('0x4b')],'encryption':_0xdd9f('0x4c')},'application':_0xdd9f('0x4d')})}})['then'](function(_0x3aaa98){var _0xb77912=_0x3aaa98;if(_0xb77912['id']){def[_0xdd9f('0x4e')]=_0xb77912['id'];return BPromise[_0xdd9f('0x2e')](_0xb77912);}else{throw new Error(util['format']('Account\x20%d\x20is\x20not\x20valid',_0x56f8d6['id']));}});}function setRelationship(_0xbd8ec3,_0x3d2236,_0xe532eb,_0x39bae0){return request({'form':{'method':'set_relationship','input_type':'JSON','response_type':_0xdd9f('0x1b'),'rest_data':JSON['stringify']({'session':_0xbd8ec3['id'],'module_name':_0xdd9f('0x1d'),'module_id':_0xe532eb['id'],'link_field_name':_0x39bae0,'related_ids':[_0x3d2236['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x4f1869,_0x22cb23,_0x465837,_0xd393d5,_0x5a9c75,_0xcbabe7){var _0x5b9a04,_0x2b3ff4,_0x4afcc3,_0x34afd2;_0xcbabe7[_0xdd9f('0x4f')]=intUtil[_0xdd9f('0x50')](_0xcbabe7[_0xdd9f('0x4f')]);_0xcbabe7[_0xdd9f('0x51')]=intUtil['stripTrailingSlash'](_0xcbabe7[_0xdd9f('0x51')]);def['uri']=util['format'](_0xdd9f('0x52'),_0xcbabe7[_0xdd9f('0x4f')]);if(_0x5a9c75&&_0x5a9c75[_0xdd9f('0x53')]){logger['info'](_0xdd9f('0x54'),_0xdd9f('0x55'));_0x22cb23[_0xdd9f('0x56')]=util[_0xdd9f('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xcbabe7['serverUrl'],_0x22cb23[_0xdd9f('0x57')],md5(_0x22cb23[_0xdd9f('0x57')]));}else{_0x22cb23['recordingURL']='';}return getConnection(_0xcbabe7)[_0xdd9f('0x28')](function(_0x5d59a9){_0x34afd2=_0x5d59a9;return getUser(_0xcbabe7,_0xd393d5[_0xdd9f('0x26')],_0x34afd2);})['then'](function(_0xb5fafb){_0x5b9a04=_0xb5fafb;logger[_0xdd9f('0x9')](_0xdd9f('0x58'),_0x5b9a04['id']);return getEndUser(_0xcbabe7,_0x22cb23['calleridname'],_0x22cb23[_0xdd9f('0x59')],_0x34afd2);})[_0xdd9f('0x28')](function(_0x42f58b){_0x2b3ff4=_0x42f58b;logger[_0xdd9f('0x9')](_0xdd9f('0x5a'),_0x2b3ff4['id']);return getTicket(_0xcbabe7,_0x5b9a04,_0x2b3ff4,_0x465837,_0x22cb23,_0x465837[_0xdd9f('0x5b')],_0x34afd2,'Inbound');})['then'](function(_0x552f21){_0x4afcc3=_0x552f21;logger['info']('Ticket\x20created!');logger[_0xdd9f('0x9')](_0xdd9f('0x5c'),_0x4afcc3['id']);return setRelationship(_0x34afd2,_0x5b9a04,_0x4afcc3,'users');})[_0xdd9f('0x28')](function(){return setRelationship(_0x34afd2,_0x2b3ff4,_0x4afcc3,'contacts');})[_0xdd9f('0x28')](function(){return getServerInfo(_0x34afd2);})[_0xdd9f('0x28')](function(_0x5d19c4){var _0x421d2a=parseInt(_0x5d19c4[_0xdd9f('0x5d')][_0xdd9f('0x5e')](0x0));var _0x487885=util[_0xdd9f('0x1e')](_0xdd9f('0x5f'),_0xcbabe7[_0xdd9f('0x4f')],_0x4afcc3['id']);if(_0x421d2a>0x6){_0x487885=util[_0xdd9f('0x1e')](_0xdd9f('0x60'),_0xcbabe7[_0xdd9f('0x4f')],_0x4afcc3['id']);}logger[_0xdd9f('0x9')](_0xdd9f('0x54'),_0xdd9f('0x61'));emit(util[_0xdd9f('0x1e')](_0xdd9f('0x62'),_0xd393d5[_0xdd9f('0x26')]),_0xdd9f('0x63'),{'uri':_0x487885});})[_0xdd9f('0x64')](function(_0x4b0560){logger[_0xdd9f('0x65')](_0xdd9f('0x54'),JSON[_0xdd9f('0x1c')](_0x4b0560));});};exports[_0xdd9f('0x66')]=function(_0x196217,_0x4db3ea,_0xac906f,_0x3a406e,_0x5a1b37,_0x169a08,_0x509334){var _0x29a1c1,_0x2b2497,_0x13c142,_0x793321;_0x169a08[_0xdd9f('0x4f')]=intUtil[_0xdd9f('0x50')](_0x169a08[_0xdd9f('0x4f')]);_0x169a08[_0xdd9f('0x51')]=intUtil['stripTrailingSlash'](_0x169a08[_0xdd9f('0x51')]);def['uri']=util['format'](_0xdd9f('0x52'),_0x169a08[_0xdd9f('0x4f')]);if(_0x509334&&_0x509334[_0xdd9f('0x67')]&&_0x509334[_0xdd9f('0x67')]!=='none'){logger[_0xdd9f('0x9')](_0xdd9f('0x68'),_0xdd9f('0x55'));_0x4db3ea[_0xdd9f('0x56')]=util[_0xdd9f('0x1e')](_0xdd9f('0x69'),_0x169a08[_0xdd9f('0x51')],_0x4db3ea[_0xdd9f('0x57')],md5(_0x4db3ea['uniqueid']));}return getConnection(_0x169a08)['then'](function(_0x2af193){_0x793321=_0x2af193;return getUser(_0x169a08,_0x3a406e[_0xdd9f('0x26')],_0x793321);})[_0xdd9f('0x28')](function(_0x4936d8){_0x29a1c1=_0x4936d8;logger['info'](_0xdd9f('0x58'),_0x29a1c1['id']);return getEndUser(_0x169a08,_0x4db3ea['destcalleridname'],_0x4db3ea[_0xdd9f('0x6a')],_0x793321);})['then'](function(_0xc12422){_0x2b2497=_0xc12422;logger[_0xdd9f('0x9')](_0xdd9f('0x5a'),_0x2b2497['id']);return getTicket(_0x169a08,_0x29a1c1,_0x2b2497,_0xac906f,_0x4db3ea,_0xac906f[_0xdd9f('0x5b')],_0x793321,_0xdd9f('0x6b'));})[_0xdd9f('0x28')](function(_0x4d16c2){_0x13c142=_0x4d16c2;logger[_0xdd9f('0x9')](_0xdd9f('0x6c'));logger[_0xdd9f('0x9')](_0xdd9f('0x5c'),_0x13c142['id']);return setRelationship(_0x793321,_0x29a1c1,_0x13c142,_0xdd9f('0x6d'));})[_0xdd9f('0x28')](function(){return setRelationship(_0x793321,_0x2b2497,_0x13c142,_0xdd9f('0x6e'));})[_0xdd9f('0x28')](function(){return getServerInfo(_0x793321);})[_0xdd9f('0x28')](function(_0x1b7faf){var _0x556e70=parseInt(_0x1b7faf['version']['charAt'](0x0));var _0x2e0739=util['format']('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x169a08['remoteUri'],_0x13c142['id']);if(_0x556e70>0x6){_0x2e0739=util['format']('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x169a08[_0xdd9f('0x4f')],_0x13c142['id']);}logger['info']('[OUTBOUND]',_0xdd9f('0x61'));emit(util[_0xdd9f('0x1e')]('user:%s',_0x3a406e[_0xdd9f('0x26')]),'trigger:browser:url',{'uri':_0x2e0739});})['catch'](function(_0xa094d6){logger[_0xdd9f('0x65')](_0xdd9f('0x68'),JSON[_0xdd9f('0x1c')](_0xa094d6));});};exports[_0xdd9f('0x6f')]=function(_0x224552,_0x4a1ce5,_0xd7465e,_0x3155e4,_0x4bf68b,_0x1e90d6){var _0x526491,_0x1bc436,_0x1c3b6e,_0xddc7e8;_0x1e90d6[_0xdd9f('0x4f')]=intUtil[_0xdd9f('0x50')](_0x1e90d6[_0xdd9f('0x4f')]);_0x1e90d6[_0xdd9f('0x51')]=intUtil[_0xdd9f('0x50')](_0x1e90d6[_0xdd9f('0x51')]);def[_0xdd9f('0x70')]=util[_0xdd9f('0x1e')](_0xdd9f('0x52'),_0x1e90d6[_0xdd9f('0x4f')]);if(_0x4bf68b&&_0x4bf68b[_0xdd9f('0x53')]){logger[_0xdd9f('0x9')]('['+_0x4a1ce5[_0xdd9f('0x71')][_0xdd9f('0x72')]()+']','Recording\x20is\x20enabled!');_0x4a1ce5['recordingURL']=util[_0xdd9f('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1e90d6[_0xdd9f('0x51')],_0x4a1ce5['uniqueid'],md5(_0x4a1ce5[_0xdd9f('0x57')]));}else{_0x4a1ce5[_0xdd9f('0x56')]='';}return getConnection(_0x1e90d6)[_0xdd9f('0x28')](function(_0x1dd560){_0xddc7e8=_0x1dd560;if(!_['isNil'](_0x3155e4)){return getUser(_0x1e90d6,_0x3155e4[_0xdd9f('0x26')],_0xddc7e8);}else{return getUser(_0x1e90d6,null,_0xddc7e8);}})['then'](function(_0x541654){_0x526491=_0x541654;logger[_0xdd9f('0x9')](_0xdd9f('0x58'),_0x526491['id']);return getEndUser(_0x1e90d6,_0x4a1ce5[_0xdd9f('0x73')],_0x4a1ce5['calleridnum'],_0xddc7e8);})[_0xdd9f('0x28')](function(_0x5619f7){_0x1bc436=_0x5619f7;logger[_0xdd9f('0x9')](_0xdd9f('0x5a'),_0x1bc436['id']);return getTicket(_0x1e90d6,_0x526491,_0x1bc436,_0xd7465e,_0x4a1ce5,_0xd7465e[_0xdd9f('0x5b')],_0xddc7e8,_0xdd9f('0x74'));})['then'](function(_0x2edf1c){_0x1c3b6e=_0x2edf1c;logger[_0xdd9f('0x9')]('Ticket\x20created!');logger['info'](_0xdd9f('0x5c'),_0x1c3b6e['id']);return setRelationship(_0xddc7e8,_0x526491,_0x1c3b6e,'users');})[_0xdd9f('0x28')](function(){return setRelationship(_0xddc7e8,_0x1bc436,_0x1c3b6e,_0xdd9f('0x6e'));})['then'](function(){return getServerInfo(_0xddc7e8);})[_0xdd9f('0x64')](function(_0x5f4f71){logger[_0xdd9f('0x65')]('['+_0x4a1ce5[_0xdd9f('0x71')][_0xdd9f('0x72')]()+']',JSON['stringify'](_0x5f4f71));});}; \ 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 c247607..95c099a 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 _0x2ff0=['keyValue','key','format','keyType','variable','%s:\x20%s','join','stripTrailingSlash','slice','substring','validateEmail','isNil','test','lodash','util','length','sortBy','type','content','variableName','push','toString','customVariable','Variable','name','toLowerCase'];(function(_0x23851f,_0x3b7734){var _0x1216a4=function(_0x506ce9){while(--_0x506ce9){_0x23851f['push'](_0x23851f['shift']());}};_0x1216a4(++_0x3b7734);}(_0x2ff0,0x1c7));var _0x02ff=function(_0x55fe92,_0x139e60){_0x55fe92=_0x55fe92-0x0;var _0x3e31f8=_0x2ff0[_0x55fe92];return _0x3e31f8;};'use strict';var _=require(_0x02ff('0x0'));var util=require(_0x02ff('0x1'));exports['getString']=function(_0x2b27f8,_0x1b6993,_0x8947bf){var _0x396771=[];if(_0x2b27f8[_0x02ff('0x2')]>0x0){var _0x500b03=_[_0x02ff('0x3')](_0x2b27f8,['id']);for(var _0x1b203d=0x0;_0x1b203d<_0x500b03['length'];_0x1b203d++){var _0x350548=_0x500b03[_0x1b203d];if(_0x350548[_0x02ff('0x4')]==='string'){_0x396771['push'](_0x350548[_0x02ff('0x5')]);}else if(_0x350548['type']==='variable'&&_0x350548[_0x02ff('0x6')]){_0x1b6993[_0x350548['variableName']]&&_0x396771[_0x02ff('0x7')](_0x1b6993[_0x350548[_0x02ff('0x6')]][_0x02ff('0x8')]());}else if(_0x350548[_0x02ff('0x4')]===_0x02ff('0x9')&&_0x350548[_0x02ff('0xa')]&&_0x350548[_0x02ff('0xa')][_0x02ff('0xb')]){_0x1b6993[_0x350548[_0x02ff('0xa')]['name'][_0x02ff('0xc')]()]&&_0x396771['push'](_0x1b6993[_0x350548[_0x02ff('0xa')][_0x02ff('0xb')][_0x02ff('0xc')]()]['toString']());}else if(_0x350548[_0x02ff('0x4')]===_0x02ff('0xd')){if(_0x350548['keyType']==='string'&&_0x350548[_0x02ff('0xe')]){_0x396771[_0x02ff('0x7')](util[_0x02ff('0xf')]('%s:\x20%s',_0x350548[_0x02ff('0xe')],_0x350548['keyContent']));}else if(_0x350548[_0x02ff('0x10')]===_0x02ff('0x11')&&_0x350548[_0x02ff('0x6')]&&_0x350548['key']){_0x1b6993[_0x350548[_0x02ff('0x6')]]&&_0x396771[_0x02ff('0x7')](util[_0x02ff('0xf')](_0x02ff('0x12'),_0x350548[_0x02ff('0xe')],_0x1b6993[_0x350548[_0x02ff('0x6')]]));}else if(_0x350548[_0x02ff('0x10')]===_0x02ff('0x9')&&_0x350548['Variable']&&_0x350548[_0x02ff('0xa')]['name']&&_0x350548[_0x02ff('0xe')]){_0x1b6993[_0x350548[_0x02ff('0xa')][_0x02ff('0xb')][_0x02ff('0xc')]()]&&_0x396771[_0x02ff('0x7')](util[_0x02ff('0xf')]('%s:\x20%s',_0x350548[_0x02ff('0xe')],_0x1b6993[_0x350548[_0x02ff('0xa')][_0x02ff('0xb')][_0x02ff('0xc')]()]));}}}}return _0x396771[_0x02ff('0x13')](_0x8947bf);};exports[_0x02ff('0x14')]=function(_0x41398c){var _0x109075=_0x41398c[_0x02ff('0x15')](-0x1);if(_0x109075==='/'){_0x41398c=_0x41398c[_0x02ff('0x16')](0x0,_0x41398c['lastIndexOf'](_0x109075));}return _0x41398c;};exports[_0x02ff('0x17')]=function(_0x2f0a99){if(!_[_0x02ff('0x18')](_0x2f0a99)&&_0x2f0a99!==''){var _0x532ecd=/^(([^<>()\[\]\\.,;:\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 _0x532ecd[_0x02ff('0x19')](String(_0x2f0a99)[_0x02ff('0xc')]());}else{return![];}}; \ No newline at end of file +var _0x722e=['sortBy','length','type','string','push','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyValue','keyType','key','format','%s:\x20%s','join','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','test','lodash','util','getString'];(function(_0x5bb437,_0x8ba96c){var _0x3e24a3=function(_0x23e4db){while(--_0x23e4db){_0x5bb437['push'](_0x5bb437['shift']());}};_0x3e24a3(++_0x8ba96c);}(_0x722e,0x115));var _0xe722=function(_0x4ffa3d,_0x1d6b2c){_0x4ffa3d=_0x4ffa3d-0x0;var _0x9f5847=_0x722e[_0x4ffa3d];return _0x9f5847;};'use strict';var _=require(_0xe722('0x0'));var util=require(_0xe722('0x1'));exports[_0xe722('0x2')]=function(_0x587424,_0x1a2a9d,_0x331004){var _0x4af057=[];if(_0x587424['length']>0x0){var _0x474dac=_[_0xe722('0x3')](_0x587424,['id']);for(var _0x2c3218=0x0;_0x2c3218<_0x474dac[_0xe722('0x4')];_0x2c3218++){var _0x15eff1=_0x474dac[_0x2c3218];if(_0x15eff1[_0xe722('0x5')]===_0xe722('0x6')){_0x4af057[_0xe722('0x7')](_0x15eff1[_0xe722('0x8')]);}else if(_0x15eff1[_0xe722('0x5')]===_0xe722('0x9')&&_0x15eff1[_0xe722('0xa')]){_0x1a2a9d[_0x15eff1['variableName']]&&_0x4af057[_0xe722('0x7')](_0x1a2a9d[_0x15eff1[_0xe722('0xa')]][_0xe722('0xb')]());}else if(_0x15eff1['type']===_0xe722('0xc')&&_0x15eff1[_0xe722('0xd')]&&_0x15eff1[_0xe722('0xd')]['name']){_0x1a2a9d[_0x15eff1['Variable'][_0xe722('0xe')][_0xe722('0xf')]()]&&_0x4af057[_0xe722('0x7')](_0x1a2a9d[_0x15eff1[_0xe722('0xd')][_0xe722('0xe')]['toLowerCase']()]['toString']());}else if(_0x15eff1[_0xe722('0x5')]===_0xe722('0x10')){if(_0x15eff1[_0xe722('0x11')]==='string'&&_0x15eff1[_0xe722('0x12')]){_0x4af057[_0xe722('0x7')](util[_0xe722('0x13')]('%s:\x20%s',_0x15eff1[_0xe722('0x12')],_0x15eff1['keyContent']));}else if(_0x15eff1['keyType']===_0xe722('0x9')&&_0x15eff1[_0xe722('0xa')]&&_0x15eff1[_0xe722('0x12')]){_0x1a2a9d[_0x15eff1[_0xe722('0xa')]]&&_0x4af057[_0xe722('0x7')](util[_0xe722('0x13')](_0xe722('0x14'),_0x15eff1[_0xe722('0x12')],_0x1a2a9d[_0x15eff1[_0xe722('0xa')]]));}else if(_0x15eff1['keyType']==='customVariable'&&_0x15eff1['Variable']&&_0x15eff1['Variable'][_0xe722('0xe')]&&_0x15eff1['key']){_0x1a2a9d[_0x15eff1['Variable']['name'][_0xe722('0xf')]()]&&_0x4af057[_0xe722('0x7')](util[_0xe722('0x13')](_0xe722('0x14'),_0x15eff1[_0xe722('0x12')],_0x1a2a9d[_0x15eff1[_0xe722('0xd')][_0xe722('0xe')][_0xe722('0xf')]()]));}}}}return _0x4af057[_0xe722('0x15')](_0x331004);};exports[_0xe722('0x16')]=function(_0x5065cb){var _0x3bcccb=_0x5065cb[_0xe722('0x17')](-0x1);if(_0x3bcccb==='/'){_0x5065cb=_0x5065cb[_0xe722('0x18')](0x0,_0x5065cb[_0xe722('0x19')](_0x3bcccb));}return _0x5065cb;};exports[_0xe722('0x1a')]=function(_0x279bdd){if(!_['isNil'](_0x279bdd)&&_0x279bdd!==''){var _0x2f22f7=/^(([^<>()\[\]\\.,;:\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 _0x2f22f7[_0xe722('0x1b')](String(_0x279bdd)[_0xe722('0xf')]());}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 f5eaa80..a93a88b 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 _0xd8b0=['info','Creating\x20new\x20ticket...','merge','Normal','Subjects','POST','format','%s/webservice.php','remoteUri','create','username','sessionName','HelpDesk','stringify','success','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','error','statusCode','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','Getting\x20agent\x20with\x20email','then','Agent\x20found!','resolve','email1','first_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','admin','catch','userId','getUser','Searching\x20end\x20user\x20with\x20phone','GET','query','Enduser\x20found!','firstname','Enduser\x20created.','lastname','phone','accessKey','getchallenge','login','token','getConnection','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','recordingURL','email','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','uniqueid','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','user:%s','lastevent','toUpperCase','lodash','request-promise','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','localhost','socket.io-emitter','emit','length','forEach','includes','picklist','idField','content','toString','type','variable','variableName','customVariable','Variable','name','toLowerCase'];(function(_0x217ff6,_0x36f75d){var _0x417c93=function(_0x4787d2){while(--_0x4787d2){_0x217ff6['push'](_0x217ff6['shift']());}};_0x417c93(++_0x36f75d);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var rp=require(_0x0d8b('0x1'));var BPromise=require('bluebird');var md5=require('md5');var util=require('util');var Redis=require(_0x0d8b('0x2'));var intUtil=require(_0x0d8b('0x3'));var config=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));config['redis']=_['defaults'](config[_0x0d8b('0x7')],{'host':_0x0d8b('0x8'),'port':0x18eb});var io=require(_0x0d8b('0x9'))(new Redis(config['redis']));function emit(_0x413284,_0x284169,_0x58e4e2){io['to'](_0x413284)[_0x0d8b('0xa')](_0x284169,_0x58e4e2);}function getCustomFields(_0x348e65,_0x3b027f){var _0x1f4800={};if(_0x348e65[_0x0d8b('0xb')]>0x0){_[_0x0d8b('0xc')](_0x348e65,function(_0x2c5e9e){if(_[_0x0d8b('0xd')](['string',_0x0d8b('0xe')],_0x2c5e9e['type'])&&_0x2c5e9e[_0x0d8b('0xf')]){_0x1f4800[_0x2c5e9e[_0x0d8b('0xf')]]=_0x2c5e9e[_0x0d8b('0x10')][_0x0d8b('0x11')]();}else if(_0x2c5e9e[_0x0d8b('0x12')]===_0x0d8b('0x13')&&_0x2c5e9e[_0x0d8b('0x14')]&&_0x2c5e9e[_0x0d8b('0xf')]&&_0x3b027f[_0x2c5e9e[_0x0d8b('0x14')]]){_0x1f4800[_0x2c5e9e[_0x0d8b('0xf')]]=_0x3b027f[_0x2c5e9e[_0x0d8b('0x14')]][_0x0d8b('0x11')]();}else if(_0x2c5e9e[_0x0d8b('0x12')]===_0x0d8b('0x15')&&_0x2c5e9e['Variable']&&_0x2c5e9e[_0x0d8b('0x16')][_0x0d8b('0x17')]&&_0x2c5e9e[_0x0d8b('0xf')]&&_0x3b027f[_0x2c5e9e[_0x0d8b('0x16')][_0x0d8b('0x17')]['toLowerCase']()]){_0x1f4800[_0x2c5e9e[_0x0d8b('0xf')]]=_0x3b027f[_0x2c5e9e[_0x0d8b('0x16')][_0x0d8b('0x17')][_0x0d8b('0x18')]()][_0x0d8b('0x11')]();}});}return _0x1f4800;}function createTicket(_0x18dd2d,_0x264b39,_0xa3612a,_0x4a15bf,_0x27512e,_0x23d58f,_0x196c0a){logger[_0x0d8b('0x19')](_0x0d8b('0x1a'));var _0x5b709c=_[_0x0d8b('0x1b')]({'parent_id':'','assigned_user_id':_0x264b39['id'],'ticketpriorities':_0x0d8b('0x1c'),'ticketstatus':'Open','ticket_title':intUtil['getString'](_0x4a15bf[_0x0d8b('0x1d')],_0x27512e,'\x20'),'description':intUtil['getString'](_0x4a15bf['Descriptions'],_0x27512e,'\x0a'),'contact_id':_0xa3612a['id']},getCustomFields(_0x23d58f,_0x27512e));var _0x5527d8={'method':_0x0d8b('0x1e'),'uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x18dd2d[_0x0d8b('0x21')]),'form':{'operation':_0x0d8b('0x22'),'username':_0x18dd2d[_0x0d8b('0x23')],'sessionName':_0x196c0a[_0x0d8b('0x24')],'elementType':_0x0d8b('0x25'),'element':JSON[_0x0d8b('0x26')](_0x5b709c)},'json':!![]};return request(_0x5527d8)['then'](function(_0xe8bbee){if(_0xe8bbee[_0x0d8b('0x27')]){return BPromise['resolve']({'id':_0xe8bbee[_0x0d8b('0x28')]['id']});}else{throw new Error(util['format'](_0x0d8b('0x29'),JSON[_0x0d8b('0x26')](_0xe8bbee[_0x0d8b('0x2a')])));}})['catch'](function(_0x59a905){var _0x28f639=_0x59a905[_0x0d8b('0x2b')]||0x1f4;logger['error'](_0x0d8b('0x2c'),'createTicket',_0x28f639,JSON[_0x0d8b('0x26')](_0x59a905));});}function getUser(_0x4b59e5,_0x97050a,_0x48f24f){if(intUtil[_0x0d8b('0x2d')](_0x97050a)){logger['info'](_0x0d8b('0x2e'),_0x97050a);return request({'method':'GET','uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x4b59e5[_0x0d8b('0x21')]),'qs':{'operation':'query','username':_0x4b59e5['username'],'sessionName':_0x48f24f['sessionName'],'query':util[_0x0d8b('0x1f')]('SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;',_0x97050a)},'json':!![]})[_0x0d8b('0x2f')](function(_0x54f6f3){if(_0x54f6f3['success']&&_0x54f6f3[_0x0d8b('0x28')][_0x0d8b('0xb')]){logger[_0x0d8b('0x19')](_0x0d8b('0x30'));return BPromise[_0x0d8b('0x31')]({'id':_0x54f6f3[_0x0d8b('0x28')][0x0]['id'],'email':_0x54f6f3[_0x0d8b('0x28')][0x0][_0x0d8b('0x32')],'name':_0x54f6f3['result'][0x0][_0x0d8b('0x33')]+'\x20'+_0x54f6f3[_0x0d8b('0x28')]['last_name']});}else{logger[_0x0d8b('0x19')](_0x0d8b('0x34'));return BPromise[_0x0d8b('0x31')]({'id':_0x48f24f['userId'],'email':_0x4b59e5[_0x0d8b('0x23')],'name':_0x0d8b('0x35')});}})[_0x0d8b('0x36')](function(_0x31ceba){var _0x933e01=_0x31ceba['statusCode']||0x1f4;logger[_0x0d8b('0x2a')](_0x0d8b('0x2c'),'getUser',_0x933e01,JSON[_0x0d8b('0x26')](_0x31ceba));});}else{logger[_0x0d8b('0x19')](_0x0d8b('0x34'));return BPromise[_0x0d8b('0x31')]({'id':_0x48f24f[_0x0d8b('0x37')],'email':_0x4b59e5['username'],'name':'admin'})[_0x0d8b('0x36')](function(_0x5c2c04){var _0x531c55=_0x5c2c04[_0x0d8b('0x2b')]||0x1f4;logger[_0x0d8b('0x2a')](_0x0d8b('0x2c'),_0x0d8b('0x38'),_0x531c55,JSON[_0x0d8b('0x26')](_0x5c2c04));});}}function getEndUser(_0x24c789,_0x579324,_0x6e5bab,_0x6a02ad){logger[_0x0d8b('0x19')](_0x0d8b('0x39'),_0x6e5bab);return request({'method':_0x0d8b('0x3a'),'uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x24c789['remoteUri']),'qs':{'operation':_0x0d8b('0x3b'),'username':_0x24c789[_0x0d8b('0x23')],'sessionName':_0x6a02ad[_0x0d8b('0x24')],'query':util[_0x0d8b('0x1f')]('SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;',_0x6e5bab,_0x6e5bab,_0x6e5bab,_0x6e5bab,_0x6e5bab)},'json':!![]})[_0x0d8b('0x2f')](function(_0x4b4bde){if(_0x4b4bde[_0x0d8b('0x27')]&&_0x4b4bde[_0x0d8b('0x28')][_0x0d8b('0xb')]){logger[_0x0d8b('0x19')](_0x0d8b('0x3c'));return BPromise[_0x0d8b('0x31')]({'id':_0x4b4bde[_0x0d8b('0x28')][0x0]['id'],'name':_0x4b4bde[_0x0d8b('0x28')][0x0][_0x0d8b('0x3d')]+'\x20'+_0x4b4bde[_0x0d8b('0x28')][0x0]['lastname'],'phone':_0x6e5bab});}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'method':'POST','uri':util['format'](_0x0d8b('0x20'),_0x24c789[_0x0d8b('0x21')]),'form':{'operation':_0x0d8b('0x22'),'sessionName':_0x6a02ad['sessionName'],'elementType':'Contacts','element':JSON[_0x0d8b('0x26')]({'lastname':_0x579324,'phone':_0x6e5bab,'assigned_user_id':'\x20'})},'json':!![]})[_0x0d8b('0x2f')](function(_0x344278){logger['info'](_0x0d8b('0x3e'));return BPromise[_0x0d8b('0x31')]({'id':_0x344278['result']['id'],'name':_0x344278['result'][_0x0d8b('0x3f')],'phone':_0x344278['result'][_0x0d8b('0x40')]});})['catch'](function(_0x53f643){var _0x30ccee=_0x53f643[_0x0d8b('0x2b')]||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s','getEndUser',_0x30ccee,JSON['stringify'](_0x53f643));});}});}function getConnection(_0x374d40){var _0x1e0498=_0x374d40[_0x0d8b('0x23')];var _0x490eda=_0x374d40[_0x0d8b('0x41')];return request({'method':_0x0d8b('0x3a'),'uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x374d40[_0x0d8b('0x21')]),'qs':{'operation':_0x0d8b('0x42'),'username':_0x1e0498},'json':!![]})[_0x0d8b('0x2f')](function(_0x1d5067){if(_0x1d5067[_0x0d8b('0x27')]){return request({'method':_0x0d8b('0x1e'),'uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x374d40[_0x0d8b('0x21')]),'form':{'operation':_0x0d8b('0x43'),'username':_0x1e0498,'accessKey':md5(_0x1d5067[_0x0d8b('0x28')][_0x0d8b('0x44')]+_0x490eda)},'json':!![]});}})[_0x0d8b('0x2f')](function(_0x1e162c){if(_0x1e162c[_0x0d8b('0x27')]){return BPromise['resolve'](_0x1e162c[_0x0d8b('0x28')]);}else{throw new Error(util['format']('Account\x20%d\x20is\x20not\x20valid',_0x374d40['id']));}})[_0x0d8b('0x36')](function(_0x113fb7){var _0x3f943a=_0x113fb7[_0x0d8b('0x2b')]||0x1f4;logger['error'](_0x0d8b('0x2c'),_0x0d8b('0x45'),_0x3f943a,JSON[_0x0d8b('0x26')](_0x113fb7));});}function request(_0x241587){logger[_0x0d8b('0x19')]('[HTTP]',JSON['stringify'](_0x241587));return rp(_0x241587);}exports['queue']=function(_0x573f4f,_0x368ede,_0xf22c3c,_0x5e3bb4,_0x4950a8,_0x44c5c1){var _0x3d3cb6,_0x5c5bd7,_0x5ef6c3,_0x900906;_0x44c5c1[_0x0d8b('0x21')]=intUtil[_0x0d8b('0x46')](_0x44c5c1[_0x0d8b('0x21')]);if(_0x4950a8&&_0x4950a8[_0x0d8b('0x47')]){logger['info'](_0x0d8b('0x48'),_0x0d8b('0x49'));_0x368ede['recordingURL']=util['format'](_0x0d8b('0x4a'),_0x44c5c1[_0x0d8b('0x4b')],_0x368ede['uniqueid'],md5(_0x368ede['uniqueid']));}else{_0x368ede[_0x0d8b('0x4c')]='';}return getConnection(_0x44c5c1)[_0x0d8b('0x2f')](function(_0x377027){_0x900906=_0x377027;return getUser(_0x44c5c1,_0x5e3bb4[_0x0d8b('0x4d')],_0x900906);})['then'](function(_0x356b3d){_0x3d3cb6=_0x356b3d;logger['info']('The\x20User\x20ID\x20is:',_0x3d3cb6['id']);return getEndUser(_0x44c5c1,_0x368ede[_0x0d8b('0x4e')],_0x368ede[_0x0d8b('0x4f')],_0x900906);})['then'](function(_0x4a8f33){_0x5c5bd7=_0x4a8f33;logger[_0x0d8b('0x19')](_0x0d8b('0x50'),_0x5c5bd7['id']);return createTicket(_0x44c5c1,_0x3d3cb6,_0x5c5bd7,_0xf22c3c,_0x368ede,_0xf22c3c[_0x0d8b('0x51')],_0x900906);})[_0x0d8b('0x2f')](function(_0x3afc3a){_0x5ef6c3=_0x3afc3a;logger[_0x0d8b('0x19')](_0x0d8b('0x52'));logger[_0x0d8b('0x19')]('The\x20Ticket\x20ID\x20is:',_0x5ef6c3['id']);var _0x24a859=util[_0x0d8b('0x1f')](_0x0d8b('0x53'),_0x44c5c1[_0x0d8b('0x21')],_[_0x0d8b('0x54')](_0x5ef6c3['id'],'x')[0x1]);logger[_0x0d8b('0x19')](_0x0d8b('0x48'),_0x0d8b('0x55'));emit(util[_0x0d8b('0x1f')]('user:%s',_0x5e3bb4[_0x0d8b('0x17')]),_0x0d8b('0x56'),{'uri':_0x24a859});})[_0x0d8b('0x36')](function(_0x23de9e){logger[_0x0d8b('0x2a')]('[QUEUE]',JSON[_0x0d8b('0x26')](_0x23de9e));});};exports[_0x0d8b('0x57')]=function(_0x181d49,_0x17a87f,_0x1d6cd4,_0x59ada2,_0x4d0e7c,_0x3b1166,_0x291b83){var _0x3e4a41,_0xbbb520,_0x5a70bd,_0x199122;_0x3b1166[_0x0d8b('0x21')]=intUtil[_0x0d8b('0x46')](_0x3b1166['remoteUri']);_0x3b1166[_0x0d8b('0x4b')]=intUtil['stripTrailingSlash'](_0x3b1166[_0x0d8b('0x4b')]);if(_0x291b83&&_0x291b83[_0x0d8b('0x58')]&&_0x291b83[_0x0d8b('0x58')]!==_0x0d8b('0x59')){logger[_0x0d8b('0x19')](_0x0d8b('0x5a'),'Recording\x20is\x20enabled!');_0x17a87f[_0x0d8b('0x4c')]=util['format'](_0x0d8b('0x4a'),_0x3b1166[_0x0d8b('0x4b')],_0x17a87f[_0x0d8b('0x5b')],md5(_0x17a87f[_0x0d8b('0x5b')]));}return getConnection(_0x3b1166)['then'](function(_0x19e097){_0x199122=_0x19e097;return getUser(_0x3b1166,_0x59ada2[_0x0d8b('0x4d')],_0x199122);})[_0x0d8b('0x2f')](function(_0x2332fc){_0x3e4a41=_0x2332fc;logger[_0x0d8b('0x19')](_0x0d8b('0x5c'),_0x3e4a41['id']);return getEndUser(_0x3b1166,_0x17a87f[_0x0d8b('0x5d')],_0x17a87f[_0x0d8b('0x5e')],_0x199122);})[_0x0d8b('0x2f')](function(_0x34affb){_0xbbb520=_0x34affb;logger['info']('The\x20Enduser\x20ID\x20is:',_0xbbb520['id']);return createTicket(_0x3b1166,_0x3e4a41,_0xbbb520,_0x1d6cd4,_0x17a87f,_0x1d6cd4[_0x0d8b('0x51')],_0x199122);})[_0x0d8b('0x2f')](function(_0x53e399){_0x5a70bd=_0x53e399;logger[_0x0d8b('0x19')]('Ticket\x20created!');logger['info'](_0x0d8b('0x5f'),_0x5a70bd['id']);var _0x1c4e96=util['format']('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x3b1166[_0x0d8b('0x21')],_[_0x0d8b('0x54')](_0x5a70bd['id'],'x')[0x1]);logger[_0x0d8b('0x19')](_0x0d8b('0x5a'),_0x0d8b('0x55'));emit(util[_0x0d8b('0x1f')](_0x0d8b('0x60'),_0x59ada2['name']),_0x0d8b('0x56'),{'uri':_0x1c4e96});})['catch'](function(_0x1a203e){logger[_0x0d8b('0x2a')](_0x0d8b('0x5a'),JSON[_0x0d8b('0x26')](_0x1a203e));});};exports['unmanaged']=function(_0x3fe47d,_0x4a1c4a,_0x3a356b,_0x2c6c5f,_0x1c5fe2,_0x2ebea3){var _0xc5c35f,_0x2b44e5,_0x3e927c,_0x91aa89;_0x2ebea3[_0x0d8b('0x21')]=intUtil[_0x0d8b('0x46')](_0x2ebea3['remoteUri']);_0x2ebea3[_0x0d8b('0x4b')]=intUtil['stripTrailingSlash'](_0x2ebea3[_0x0d8b('0x4b')]);if(_0x1c5fe2&&_0x1c5fe2[_0x0d8b('0x47')]){logger['info']('['+_0x4a1c4a[_0x0d8b('0x61')]['toUpperCase']()+']',_0x0d8b('0x49'));_0x4a1c4a[_0x0d8b('0x4c')]=util[_0x0d8b('0x1f')](_0x0d8b('0x4a'),_0x2ebea3[_0x0d8b('0x4b')],_0x4a1c4a[_0x0d8b('0x5b')],md5(_0x4a1c4a[_0x0d8b('0x5b')]));}else{_0x4a1c4a[_0x0d8b('0x4c')]='';}return getConnection(_0x2ebea3)['then'](function(_0x10eca6){_0x91aa89=_0x10eca6;return getUser(_0x2ebea3,'',_0x91aa89);})[_0x0d8b('0x2f')](function(_0x5b2916){_0xc5c35f=_0x5b2916;logger[_0x0d8b('0x19')](_0x0d8b('0x5c'),_0xc5c35f['id']);return getEndUser(_0x2ebea3,_0x4a1c4a[_0x0d8b('0x4e')],_0x4a1c4a[_0x0d8b('0x4f')],_0x91aa89);})[_0x0d8b('0x2f')](function(_0x9e44b4){_0x2b44e5=_0x9e44b4;logger[_0x0d8b('0x19')](_0x0d8b('0x50'),_0x2b44e5['id']);return createTicket(_0x2ebea3,_0xc5c35f,_0x2b44e5,_0x3a356b,_0x4a1c4a,_0x3a356b[_0x0d8b('0x51')],_0x91aa89);})[_0x0d8b('0x2f')](function(_0xe35028){_0x3e927c=_0xe35028;logger[_0x0d8b('0x19')]('Ticket\x20created!');logger[_0x0d8b('0x19')](_0x0d8b('0x5f'),_0x3e927c['id']);})[_0x0d8b('0x36')](function(_0x58525c){logger['error']('['+_0x4a1c4a[_0x0d8b('0x61')][_0x0d8b('0x62')]()+']',JSON[_0x0d8b('0x26')](_0x58525c));});}; \ No newline at end of file +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(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'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 4d26ed1..30ef627 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 _0x8183=['username','token','%s/token:%s','Basic\x20%s','toString','debug','[HTTP]','stringify','map','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','content','idField','custom_fields','push','variableName','Variable','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Ticket\x20ID\x20is:','integrationTab','%s/channels/voice/agents/%d/tickets/%d/display.json','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','newTab','catch','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','ioredis','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','merge','Tags','name','getString','Subjects','Descriptions','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','user','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/search.json','length','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x8183,0x188));var _0x3818=function(_0x874cf1,_0x2a4954){_0x874cf1=_0x874cf1-0x0;var _0x233579=_0x8183[_0x874cf1];return _0x233579;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require('md5');var util=require('util');var Redis=require(_0x3818('0x0'));var intUtil=require('./util');var config=require(_0x3818('0x1'));var logger=require(_0x3818('0x2'))(_0x3818('0x3'));config[_0x3818('0x4')]=_[_0x3818('0x5')](config[_0x3818('0x4')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3818('0x4')]));function emit(_0x559068,_0x47cf4a,_0x204498){io['to'](_0x559068)['emit'](_0x47cf4a,_0x204498);}var headers={'Content-Type':_0x3818('0x6'),'Accept':_0x3818('0x6')};function getTicket(_0x354828,_0xae1727,_0x1d5748,_0x115d3c,_0x446629){logger[_0x3818('0x7')](_0x3818('0x8'));return request({'uri':util[_0x3818('0x9')](_0x3818('0xa'),_0x354828[_0x3818('0xb')]),'method':_0x3818('0xc'),'body':{'ticket':_[_0x3818('0xd')]({'requester_id':_0x1d5748['id'],'submitter_id':_0xae1727?_0xae1727['id']:undefined,'assignee_id':_0xae1727?_0xae1727['id']:undefined,'tags':getTags(_0x115d3c[_0x3818('0xe')],_0x3818('0xf')),'subject':intUtil[_0x3818('0x10')](_0x115d3c[_0x3818('0x11')],_0x446629,'\x20'),'description':intUtil['getString'](_0x115d3c[_0x3818('0x12')],_0x446629,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x115d3c[_0x3818('0x12')],_0x446629,'\x0a')}},getCustomFields(_0x115d3c['Fields'],_0x446629))}})[_0x3818('0x13')](function(_0x4d0b52){logger[_0x3818('0x7')](_0x3818('0x14'));return _0x4d0b52[_0x3818('0x15')];});}function getUser(_0x34370e,_0x3a659c){if(intUtil[_0x3818('0x16')](_0x3a659c)){logger[_0x3818('0x7')](_0x3818('0x17'),_0x3a659c);return request({'uri':util[_0x3818('0x9')]('%s/search.json',_0x34370e['remoteUri']),'qs':{'query':util['format']('type:user\x20role:agent\x20email:%s',_0x3a659c)}})[_0x3818('0x13')](function(_0xdece1){if(_0xdece1['count']){logger[_0x3818('0x7')](_0x3818('0x18'));return _[_0x3818('0x19')](_0xdece1[_0x3818('0x1a')],{'email':_0x3a659c,'role':_0x3818('0x1b')});}else{logger['info'](_0x3818('0x1c'));return request({'uri':util[_0x3818('0x9')](_0x3818('0x1d'),_0x34370e[_0x3818('0xb')])})[_0x3818('0x13')](function(_0x46c6e2){logger[_0x3818('0x7')]('Admin\x20account\x20selected.');return _0x46c6e2[_0x3818('0x1e')];});}});}else{logger[_0x3818('0x7')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x3818('0x9')](_0x3818('0x1d'),_0x34370e['remoteUri'])})[_0x3818('0x13')](function(_0x1dffa9){logger[_0x3818('0x7')](_0x3818('0x1f'));return _0x1dffa9[_0x3818('0x1e')];});}}function getEndUser(_0x26a857,_0x358fe6,_0x471a3c){logger[_0x3818('0x7')](_0x3818('0x20'),_0x471a3c);return request({'uri':util[_0x3818('0x9')](_0x3818('0x21'),_0x26a857[_0x3818('0xb')]),'qs':{'query':util[_0x3818('0x9')]('type:user\x20role:end-user\x20phone:%s',_0x471a3c)}})[_0x3818('0x13')](function(_0x34d371){var _0x27c326;if(_0x34d371[_0x3818('0x1a')][_0x3818('0x22')]){_0x34d371[_0x3818('0x1a')]=_['filter'](_0x34d371['results'],{'suspended':![],'role':_0x3818('0x23')});if(_0x34d371[_0x3818('0x1a')]['length']){_0x27c326=_[_0x3818('0x24')](_0x34d371[_0x3818('0x1a')]);}}if(_0x27c326){logger[_0x3818('0x7')](_0x3818('0x25'));return _0x27c326;}else{logger[_0x3818('0x7')](_0x3818('0x26'));return request({'uri':util[_0x3818('0x9')]('%s/users.json',_0x26a857[_0x3818('0xb')]),'method':_0x3818('0xc'),'body':{'user':{'role':'end-user','name':util['format'](_0x3818('0x27'),_0x358fe6||_0x471a3c),'phone':_0x471a3c}}})[_0x3818('0x13')](function(_0x39a5d3){logger[_0x3818('0x7')](_0x3818('0x28'));return _0x39a5d3[_0x3818('0x1e')];});}});}function getAuth(_0x2df607){var _0x1194a6;if(_0x2df607[_0x3818('0x29')]===_0x3818('0x2a')){_0x1194a6=util['format'](_0x3818('0x2b'),_0x2df607[_0x3818('0x2c')],_0x2df607['password']);}else if(_0x2df607[_0x3818('0x29')]===_0x3818('0x2d')){_0x1194a6=util[_0x3818('0x9')](_0x3818('0x2e'),_0x2df607['username'],_0x2df607[_0x3818('0x2d')]);}return util['format'](_0x3818('0x2f'),new Buffer(_0x1194a6)[_0x3818('0x30')]('base64'));}function request(_0x3967b0){logger[_0x3818('0x31')](_0x3818('0x32'),JSON[_0x3818('0x33')](_0x3967b0));return rp(_[_0x3818('0x5')](_0x3967b0,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x564659,_0x17b42f){var _0xb26762=[];if(_0x564659&&_0x564659[_0x3818('0x22')]>0x0){_0xb26762=_[_0x3818('0x34')](_0x564659,_0x17b42f);}return _0xb26762;}function getCustomFields(_0x29cc62,_0xf638e1){var _0x4671ee=[];var _0x5ac68d={'custom_fields':[]};if(_0x29cc62[_0x3818('0x22')]>0x0){_[_0x3818('0x35')](_0x29cc62,function(_0x32bc71){if(_[_0x3818('0x36')]([_0x3818('0x37'),_0x3818('0x38')],_0x32bc71[_0x3818('0x39')])&&_0x32bc71[_0x3818('0x3a')]&&!_0x32bc71[_0x3818('0x3b')]){_0x5ac68d[_0x32bc71['nameField'][_0x3818('0x3c')]()]=_0x32bc71[_0x3818('0x3d')][_0x3818('0x30')]();}else if(_[_0x3818('0x36')]([_0x3818('0x37'),_0x3818('0x38')],_0x32bc71[_0x3818('0x39')])&&_0x32bc71[_0x3818('0x3e')]&&_0x32bc71['customField']){_0x5ac68d[_0x3818('0x3f')][_0x3818('0x40')]({'id':_0x32bc71['idField'],'value':_0x32bc71[_0x3818('0x3d')][_0x3818('0x30')]()});}else if(_0x32bc71['type']==='variable'&&_0x32bc71[_0x3818('0x41')]&&_0x32bc71[_0x3818('0x3e')]&&_0x32bc71[_0x3818('0x3b')]){_0xf638e1[_0x32bc71[_0x3818('0x41')]]&&_0x5ac68d[_0x3818('0x3f')][_0x3818('0x40')]({'id':_0x32bc71['idField'],'value':_0xf638e1[_0x32bc71['variableName']][_0x3818('0x30')]()});}else if(_0x32bc71['type']==='customVariable'&&_0x32bc71[_0x3818('0x42')]&&_0x32bc71[_0x3818('0x42')][_0x3818('0xf')]&&_0x32bc71[_0x3818('0x3e')]&&_0x32bc71[_0x3818('0x3b')]){_0xf638e1[_0x32bc71['Variable'][_0x3818('0xf')][_0x3818('0x3c')]()]&&_0x5ac68d[_0x3818('0x3f')][_0x3818('0x40')]({'id':_0x32bc71['idField'],'value':_0xf638e1[_0x32bc71[_0x3818('0x42')]['name'][_0x3818('0x3c')]()][_0x3818('0x30')]()});}});}return _0x5ac68d;}exports[_0x3818('0x43')]=function(_0x404d6a,_0x107b7b,_0x2ba7f8,_0x327f3e,_0x12d788,_0x8b1edf){var _0x16cfb0,_0x5e9e63;_0x8b1edf[_0x3818('0xb')]=intUtil['stripTrailingSlash'](_0x8b1edf['remoteUri']);_0x8b1edf[_0x3818('0x44')]=intUtil[_0x3818('0x45')](_0x8b1edf[_0x3818('0x44')]);if(_0x12d788&&_0x12d788[_0x3818('0x46')]){logger[_0x3818('0x7')](_0x3818('0x47'),_0x3818('0x48'));_0x107b7b['recordingURL']=util[_0x3818('0x9')](_0x3818('0x49'),_0x8b1edf[_0x3818('0x44')],_0x107b7b[_0x3818('0x4a')],md5(_0x107b7b['uniqueid']));}else{_0x107b7b[_0x3818('0x4b')]='';}headers[_0x3818('0x4c')]=getAuth(_0x8b1edf);return getUser(_0x8b1edf,_0x327f3e[_0x3818('0x4d')])[_0x3818('0x13')](function(_0x1a2595){_0x16cfb0=_0x1a2595;logger['info'](_0x3818('0x4e'),_0x16cfb0['id']);return getEndUser(_0x8b1edf,_0x107b7b[_0x3818('0x4f')],_0x107b7b[_0x3818('0x50')]);})[_0x3818('0x13')](function(_0x3a64d5){_0x5e9e63=_0x3a64d5;logger['info']('The\x20Enduser\x20ID\x20is:',_0x5e9e63['id']);return getTicket(_0x8b1edf,_0x16cfb0,_0x5e9e63,_0x2ba7f8,_0x107b7b);})[_0x3818('0x13')](function(_0x97473c){if(_0x97473c){logger[_0x3818('0x7')](_0x3818('0x51'),_0x97473c['id']);switch(_0x8b1edf[_0x3818('0x39')]){case _0x3818('0x52'):logger[_0x3818('0x7')](_0x3818('0x47'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x3818('0x9')](_0x3818('0x53'),_0x8b1edf[_0x3818('0xb')],_0x16cfb0['id'],_0x97473c['id']),'method':'POST'});case'newTab':logger[_0x3818('0x7')](_0x3818('0x47'),_0x3818('0x54'));emit(util['format'](_0x3818('0x55'),_0x327f3e[_0x3818('0xf')]),_0x3818('0x56'),{'uri':util[_0x3818('0x9')](_0x3818('0x57'),_0x8b1edf[_0x3818('0xb')][_0x3818('0x58')](_0x3818('0x59'),''),_0x97473c['id'])});break;default:logger[_0x3818('0x5a')](_0x3818('0x47'),_0x3818('0x5b'));}}})['catch'](function(_0x5a7050){logger[_0x3818('0x5a')](_0x3818('0x5c'),util[_0x3818('0x5d')](_0x5a7050,{'showHidden':!![],'depth':null}));});};exports[_0x3818('0x5e')]=function(_0x2e4f1f,_0x8636a1,_0x4429a9,_0x430661,_0x4168ca,_0x1ac78e,_0x1e1ee8){var _0x3227d7,_0x20e85a;_0x1ac78e[_0x3818('0xb')]=intUtil[_0x3818('0x45')](_0x1ac78e[_0x3818('0xb')]);_0x1ac78e[_0x3818('0x44')]=intUtil[_0x3818('0x45')](_0x1ac78e[_0x3818('0x44')]);if(_0x1e1ee8&&_0x1e1ee8[_0x3818('0x5f')]&&_0x1e1ee8['recordingFormat']!==_0x3818('0x60')){logger[_0x3818('0x7')](_0x3818('0x61'),_0x3818('0x48'));_0x8636a1['recordingURL']=util[_0x3818('0x9')](_0x3818('0x49'),_0x1ac78e['serverUrl'],_0x8636a1[_0x3818('0x4a')],md5(_0x8636a1[_0x3818('0x4a')]));}headers['Authorization']=getAuth(_0x1ac78e);return getUser(_0x1ac78e,_0x430661[_0x3818('0x4d')])['then'](function(_0x7f534c){_0x3227d7=_0x7f534c;logger[_0x3818('0x7')](_0x3818('0x4e'),_0x3227d7['id']);return getEndUser(_0x1ac78e,_0x8636a1[_0x3818('0x62')],_0x8636a1[_0x3818('0x63')]);})['then'](function(_0x4eff76){_0x20e85a=_0x4eff76;logger['info'](_0x3818('0x64'),_0x20e85a['id']);return getTicket(_0x1ac78e,_0x3227d7,_0x20e85a,_0x4429a9,_0x8636a1);})['then'](function(_0x17ff46){if(_0x17ff46){logger[_0x3818('0x7')]('The\x20Ticket\x20ID\x20is:',_0x17ff46['id']);switch(_0x1ac78e[_0x3818('0x39')]){case _0x3818('0x52'):logger[_0x3818('0x7')]('[OUTBOUND]',_0x3818('0x65'));return request({'uri':util[_0x3818('0x9')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x1ac78e['remoteUri'],_0x3227d7['id'],_0x17ff46['id']),'method':_0x3818('0xc')});case _0x3818('0x66'):logger[_0x3818('0x7')](_0x3818('0x61'),_0x3818('0x54'));emit(util[_0x3818('0x9')]('user:%s',_0x430661[_0x3818('0xf')]),_0x3818('0x56'),{'uri':util[_0x3818('0x9')](_0x3818('0x57'),_0x1ac78e[_0x3818('0xb')][_0x3818('0x58')](_0x3818('0x59'),''),_0x17ff46['id'])});break;default:logger['error'](_0x3818('0x61'),_0x3818('0x5b'));}}})[_0x3818('0x67')](function(_0x3bdc41){logger[_0x3818('0x5a')](_0x3818('0x68'),util[_0x3818('0x5d')](_0x3bdc41,{'showHidden':!![],'depth':null}));});};exports[_0x3818('0x69')]=function(_0xa17c23,_0x2f7dec,_0x583a09,_0x41e7e8,_0x122edd,_0x290af2){var _0x1f6dc1,_0x4b3cff;_0x290af2[_0x3818('0xb')]=intUtil[_0x3818('0x45')](_0x290af2['remoteUri']);_0x290af2[_0x3818('0x44')]=intUtil[_0x3818('0x45')](_0x290af2['serverUrl']);if(_0x122edd&&_0x122edd[_0x3818('0x46')]){logger[_0x3818('0x7')]('['+_0x2f7dec[_0x3818('0x6a')][_0x3818('0x6b')]()+']',_0x3818('0x48'));_0x2f7dec[_0x3818('0x4b')]=util[_0x3818('0x9')](_0x3818('0x49'),_0x290af2[_0x3818('0x44')],_0x2f7dec[_0x3818('0x4a')],md5(_0x2f7dec[_0x3818('0x4a')]));}else{_0x2f7dec[_0x3818('0x4b')]='';}headers[_0x3818('0x4c')]=getAuth(_0x290af2);return getUser(_0x290af2)['then'](function(_0x470dc8){_0x1f6dc1=_0x470dc8;logger[_0x3818('0x7')]('The\x20User\x20ID\x20is:',_0x1f6dc1['id']);return getEndUser(_0x290af2,_0x2f7dec['calleridname'],_0x2f7dec[_0x3818('0x50')]);})[_0x3818('0x13')](function(_0x852e4d){_0x4b3cff=_0x852e4d;logger['info'](_0x3818('0x64'),_0x4b3cff['id']);return getTicket(_0x290af2,_0x1f6dc1,_0x4b3cff,_0x583a09,_0x2f7dec);})[_0x3818('0x13')](function(_0x51c2af){if(_0x51c2af){logger[_0x3818('0x7')](_0x3818('0x51'),_0x51c2af['id']);}})['catch'](function(_0x34c44f){logger[_0x3818('0x5a')]('['+_0x2f7dec[_0x3818('0x6a')]['toUpperCase']()+']'+_0x3818('0x6c'),util[_0x3818('0x5d')](_0x34c44f,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xc556=['uniqueid','Authorization','email','calleridname','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','catch','error','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','/api/v2','Zendesk\x20account\x20type\x20not\x20recognized','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','The\x20User\x20ID\x20is:','calleridnum','lodash','request-promise','md5','util','ioredis','../../../../config/logger','zendesk','redis','defaults','localhost','socket.io-emitter','application/json','info','Creating\x20new\x20ticket...','%s/tickets.json','POST','merge','Tags','name','getString','Subjects','Fields','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','format','remoteUri','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','user','%s/users/me.json','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','username','token','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','GET','forEach','includes','picklist','nameField','customField','toLowerCase','string','type','idField','custom_fields','push','variable','variableName','Variable','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s'];(function(_0x44bcb0,_0x235aa9){var _0xfaf881=function(_0x25d81d){while(--_0x25d81d){_0x44bcb0['push'](_0x44bcb0['shift']());}};_0xfaf881(++_0x235aa9);}(_0xc556,0x16a));var _0x6c55=function(_0x3183ea,_0xe80544){_0x3183ea=_0x3183ea-0x0;var _0x54ad25=_0xc556[_0x3183ea];return _0x54ad25;};'use strict';var _=require(_0x6c55('0x0'));var rp=require(_0x6c55('0x1'));var md5=require(_0x6c55('0x2'));var util=require(_0x6c55('0x3'));var Redis=require(_0x6c55('0x4'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x6c55('0x5'))(_0x6c55('0x6'));config[_0x6c55('0x7')]=_[_0x6c55('0x8')](config[_0x6c55('0x7')],{'host':_0x6c55('0x9'),'port':0x18eb});var io=require(_0x6c55('0xa'))(new Redis(config[_0x6c55('0x7')]));function emit(_0x1fcf0c,_0x588270,_0x31beab){io['to'](_0x1fcf0c)['emit'](_0x588270,_0x31beab);}var headers={'Content-Type':_0x6c55('0xb'),'Accept':_0x6c55('0xb')};function getTicket(_0x5a103e,_0xfba1ea,_0x538b3e,_0x152a58,_0x176c8a){logger[_0x6c55('0xc')](_0x6c55('0xd'));return request({'uri':util['format'](_0x6c55('0xe'),_0x5a103e['remoteUri']),'method':_0x6c55('0xf'),'body':{'ticket':_[_0x6c55('0x10')]({'requester_id':_0x538b3e['id'],'submitter_id':_0xfba1ea?_0xfba1ea['id']:undefined,'assignee_id':_0xfba1ea?_0xfba1ea['id']:undefined,'tags':getTags(_0x152a58[_0x6c55('0x11')],_0x6c55('0x12')),'subject':intUtil[_0x6c55('0x13')](_0x152a58[_0x6c55('0x14')],_0x176c8a,'\x20'),'description':intUtil[_0x6c55('0x13')](_0x152a58['Descriptions'],_0x176c8a,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x152a58['Descriptions'],_0x176c8a,'\x0a')}},getCustomFields(_0x152a58[_0x6c55('0x15')],_0x176c8a))}})[_0x6c55('0x16')](function(_0x24eaf6){logger['info'](_0x6c55('0x17'));return _0x24eaf6[_0x6c55('0x18')];});}function getUser(_0x5a95ca,_0x4f1046){if(intUtil[_0x6c55('0x19')](_0x4f1046)){logger[_0x6c55('0xc')](_0x6c55('0x1a'),_0x4f1046);return request({'uri':util[_0x6c55('0x1b')]('%s/search.json',_0x5a95ca[_0x6c55('0x1c')]),'qs':{'query':util[_0x6c55('0x1b')](_0x6c55('0x1d'),_0x4f1046)}})[_0x6c55('0x16')](function(_0x5b2c8d){if(_0x5b2c8d[_0x6c55('0x1e')]){logger[_0x6c55('0xc')](_0x6c55('0x1f'));return _[_0x6c55('0x20')](_0x5b2c8d[_0x6c55('0x21')],{'email':_0x4f1046,'role':_0x6c55('0x22')});}else{logger[_0x6c55('0xc')](_0x6c55('0x23'));return request({'uri':util['format']('%s/users/me.json',_0x5a95ca[_0x6c55('0x1c')])})[_0x6c55('0x16')](function(_0x2f91b4){logger['info'](_0x6c55('0x24'));return _0x2f91b4[_0x6c55('0x25')];});}});}else{logger['info'](_0x6c55('0x23'));return request({'uri':util[_0x6c55('0x1b')](_0x6c55('0x26'),_0x5a95ca['remoteUri'])})[_0x6c55('0x16')](function(_0x3386f7){logger[_0x6c55('0xc')](_0x6c55('0x24'));return _0x3386f7['user'];});}}function getEndUser(_0x2ea273,_0x58215e,_0x3c03bc){logger[_0x6c55('0xc')]('Searching\x20enduser\x20with\x20phone',_0x3c03bc);return request({'uri':util['format']('%s/search.json',_0x2ea273[_0x6c55('0x1c')]),'qs':{'query':util[_0x6c55('0x1b')](_0x6c55('0x27'),_0x3c03bc)}})[_0x6c55('0x16')](function(_0x3521a3){var _0x507ce6;if(_0x3521a3['results'][_0x6c55('0x28')]){_0x3521a3[_0x6c55('0x21')]=_[_0x6c55('0x29')](_0x3521a3['results'],{'suspended':![],'role':_0x6c55('0x2a')});if(_0x3521a3['results']['length']){_0x507ce6=_['first'](_0x3521a3[_0x6c55('0x21')]);}}if(_0x507ce6){logger[_0x6c55('0xc')]('Enduser\x20found!');return _0x507ce6;}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x6c55('0x1b')](_0x6c55('0x2b'),_0x2ea273[_0x6c55('0x1c')]),'method':_0x6c55('0xf'),'body':{'user':{'role':'end-user','name':util['format'](_0x6c55('0x2c'),_0x58215e||_0x3c03bc),'phone':_0x3c03bc}}})[_0x6c55('0x16')](function(_0x193dec){logger[_0x6c55('0xc')](_0x6c55('0x2d'));return _0x193dec[_0x6c55('0x25')];});}});}function getAuth(_0x17f6ac){var _0x5a883c;if(_0x17f6ac[_0x6c55('0x2e')]===_0x6c55('0x2f')){_0x5a883c=util[_0x6c55('0x1b')](_0x6c55('0x30'),_0x17f6ac[_0x6c55('0x31')],_0x17f6ac[_0x6c55('0x2f')]);}else if(_0x17f6ac[_0x6c55('0x2e')]===_0x6c55('0x32')){_0x5a883c=util['format']('%s/token:%s',_0x17f6ac['username'],_0x17f6ac[_0x6c55('0x32')]);}return util[_0x6c55('0x1b')](_0x6c55('0x33'),new Buffer(_0x5a883c)[_0x6c55('0x34')](_0x6c55('0x35')));}function request(_0x3d6627){logger[_0x6c55('0x36')](_0x6c55('0x37'),JSON[_0x6c55('0x38')](_0x3d6627));return rp(_['defaults'](_0x3d6627,{'method':_0x6c55('0x39'),'headers':headers,'json':!![]}));}function getTags(_0xf65d41,_0xef5a75){var _0x3ebdba=[];if(_0xf65d41&&_0xf65d41[_0x6c55('0x28')]>0x0){_0x3ebdba=_['map'](_0xf65d41,_0xef5a75);}return _0x3ebdba;}function getCustomFields(_0x5eb548,_0x1020f1){var _0x2c916e=[];var _0x23021c={'custom_fields':[]};if(_0x5eb548['length']>0x0){_[_0x6c55('0x3a')](_0x5eb548,function(_0x49a692){if(_[_0x6c55('0x3b')](['string',_0x6c55('0x3c')],_0x49a692['type'])&&_0x49a692[_0x6c55('0x3d')]&&!_0x49a692[_0x6c55('0x3e')]){_0x23021c[_0x49a692[_0x6c55('0x3d')][_0x6c55('0x3f')]()]=_0x49a692['content'][_0x6c55('0x34')]();}else if(_[_0x6c55('0x3b')]([_0x6c55('0x40'),_0x6c55('0x3c')],_0x49a692[_0x6c55('0x41')])&&_0x49a692[_0x6c55('0x42')]&&_0x49a692['customField']){_0x23021c[_0x6c55('0x43')][_0x6c55('0x44')]({'id':_0x49a692['idField'],'value':_0x49a692['content'][_0x6c55('0x34')]()});}else if(_0x49a692[_0x6c55('0x41')]===_0x6c55('0x45')&&_0x49a692[_0x6c55('0x46')]&&_0x49a692[_0x6c55('0x42')]&&_0x49a692[_0x6c55('0x3e')]){_0x1020f1[_0x49a692[_0x6c55('0x46')]]&&_0x23021c[_0x6c55('0x43')]['push']({'id':_0x49a692[_0x6c55('0x42')],'value':_0x1020f1[_0x49a692[_0x6c55('0x46')]][_0x6c55('0x34')]()});}else if(_0x49a692[_0x6c55('0x41')]==='customVariable'&&_0x49a692[_0x6c55('0x47')]&&_0x49a692[_0x6c55('0x47')]['name']&&_0x49a692[_0x6c55('0x42')]&&_0x49a692[_0x6c55('0x3e')]){_0x1020f1[_0x49a692[_0x6c55('0x47')][_0x6c55('0x12')]['toLowerCase']()]&&_0x23021c[_0x6c55('0x43')]['push']({'id':_0x49a692[_0x6c55('0x42')],'value':_0x1020f1[_0x49a692[_0x6c55('0x47')][_0x6c55('0x12')][_0x6c55('0x3f')]()]['toString']()});}});}return _0x23021c;}exports['queue']=function(_0x29f119,_0x1c8e17,_0x5b4a8c,_0x4a3414,_0x2f8309,_0x27a1a8){var _0xe0ac6e,_0x3bb58c;_0x27a1a8['remoteUri']=intUtil['stripTrailingSlash'](_0x27a1a8[_0x6c55('0x1c')]);_0x27a1a8[_0x6c55('0x48')]=intUtil[_0x6c55('0x49')](_0x27a1a8[_0x6c55('0x48')]);if(_0x2f8309&&_0x2f8309[_0x6c55('0x4a')]){logger[_0x6c55('0xc')](_0x6c55('0x4b'),'Recording\x20is\x20enabled!');_0x1c8e17[_0x6c55('0x4c')]=util[_0x6c55('0x1b')](_0x6c55('0x4d'),_0x27a1a8[_0x6c55('0x48')],_0x1c8e17[_0x6c55('0x4e')],md5(_0x1c8e17[_0x6c55('0x4e')]));}else{_0x1c8e17[_0x6c55('0x4c')]='';}headers[_0x6c55('0x4f')]=getAuth(_0x27a1a8);return getUser(_0x27a1a8,_0x4a3414[_0x6c55('0x50')])[_0x6c55('0x16')](function(_0x4f98e8){_0xe0ac6e=_0x4f98e8;logger[_0x6c55('0xc')]('The\x20User\x20ID\x20is:',_0xe0ac6e['id']);return getEndUser(_0x27a1a8,_0x1c8e17[_0x6c55('0x51')],_0x1c8e17['calleridnum']);})[_0x6c55('0x16')](function(_0x123695){_0x3bb58c=_0x123695;logger[_0x6c55('0xc')]('The\x20Enduser\x20ID\x20is:',_0x3bb58c['id']);return getTicket(_0x27a1a8,_0xe0ac6e,_0x3bb58c,_0x5b4a8c,_0x1c8e17);})[_0x6c55('0x16')](function(_0x325351){if(_0x325351){logger['info'](_0x6c55('0x52'),_0x325351['id']);switch(_0x27a1a8[_0x6c55('0x41')]){case _0x6c55('0x53'):logger[_0x6c55('0xc')](_0x6c55('0x4b'),_0x6c55('0x54'));return request({'uri':util[_0x6c55('0x1b')](_0x6c55('0x55'),_0x27a1a8[_0x6c55('0x1c')],_0xe0ac6e['id'],_0x325351['id']),'method':'POST'});case _0x6c55('0x56'):logger[_0x6c55('0xc')](_0x6c55('0x4b'),_0x6c55('0x57'));emit(util['format'](_0x6c55('0x58'),_0x4a3414[_0x6c55('0x12')]),_0x6c55('0x59'),{'uri':util[_0x6c55('0x1b')](_0x6c55('0x5a'),_0x27a1a8['remoteUri'][_0x6c55('0x5b')]('/api/v2',''),_0x325351['id'])});break;default:logger['error'](_0x6c55('0x4b'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x6c55('0x5c')](function(_0x5bc4f9){logger[_0x6c55('0x5d')](_0x6c55('0x5e'),util[_0x6c55('0x5f')](_0x5bc4f9,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0xd2d6b1,_0x2ccb82,_0x552a7c,_0x382655,_0x2d76bf,_0x2d4164,_0x826e27){var _0x57aacd,_0x23a061;_0x2d4164[_0x6c55('0x1c')]=intUtil[_0x6c55('0x49')](_0x2d4164[_0x6c55('0x1c')]);_0x2d4164[_0x6c55('0x48')]=intUtil['stripTrailingSlash'](_0x2d4164[_0x6c55('0x48')]);if(_0x826e27&&_0x826e27[_0x6c55('0x60')]&&_0x826e27[_0x6c55('0x60')]!==_0x6c55('0x61')){logger[_0x6c55('0xc')](_0x6c55('0x62'),_0x6c55('0x63'));_0x2ccb82[_0x6c55('0x4c')]=util[_0x6c55('0x1b')](_0x6c55('0x4d'),_0x2d4164[_0x6c55('0x48')],_0x2ccb82['uniqueid'],md5(_0x2ccb82[_0x6c55('0x4e')]));}headers['Authorization']=getAuth(_0x2d4164);return getUser(_0x2d4164,_0x382655[_0x6c55('0x50')])[_0x6c55('0x16')](function(_0x41b13b){_0x57aacd=_0x41b13b;logger[_0x6c55('0xc')]('The\x20User\x20ID\x20is:',_0x57aacd['id']);return getEndUser(_0x2d4164,_0x2ccb82[_0x6c55('0x64')],_0x2ccb82[_0x6c55('0x65')]);})[_0x6c55('0x16')](function(_0x32f3d2){_0x23a061=_0x32f3d2;logger[_0x6c55('0xc')](_0x6c55('0x66'),_0x23a061['id']);return getTicket(_0x2d4164,_0x57aacd,_0x23a061,_0x552a7c,_0x2ccb82);})[_0x6c55('0x16')](function(_0x131f4e){if(_0x131f4e){logger[_0x6c55('0xc')](_0x6c55('0x52'),_0x131f4e['id']);switch(_0x2d4164[_0x6c55('0x41')]){case'integrationTab':logger[_0x6c55('0xc')](_0x6c55('0x62'),_0x6c55('0x54'));return request({'uri':util['format'](_0x6c55('0x55'),_0x2d4164[_0x6c55('0x1c')],_0x57aacd['id'],_0x131f4e['id']),'method':_0x6c55('0xf')});case _0x6c55('0x56'):logger['info'](_0x6c55('0x62'),_0x6c55('0x57'));emit(util[_0x6c55('0x1b')](_0x6c55('0x58'),_0x382655[_0x6c55('0x12')]),_0x6c55('0x59'),{'uri':util['format'](_0x6c55('0x5a'),_0x2d4164['remoteUri'][_0x6c55('0x5b')](_0x6c55('0x67'),''),_0x131f4e['id'])});break;default:logger[_0x6c55('0x5d')](_0x6c55('0x62'),_0x6c55('0x68'));}}})[_0x6c55('0x5c')](function(_0x438055){logger[_0x6c55('0x5d')](_0x6c55('0x69'),util[_0x6c55('0x5f')](_0x438055,{'showHidden':!![],'depth':null}));});};exports[_0x6c55('0x6a')]=function(_0x2035bd,_0x4ba714,_0x34e740,_0x5f1593,_0x1b056e,_0x2d912f){var _0xd5364e,_0x14dedb;_0x2d912f[_0x6c55('0x1c')]=intUtil[_0x6c55('0x49')](_0x2d912f[_0x6c55('0x1c')]);_0x2d912f[_0x6c55('0x48')]=intUtil[_0x6c55('0x49')](_0x2d912f[_0x6c55('0x48')]);if(_0x1b056e&&_0x1b056e[_0x6c55('0x4a')]){logger[_0x6c55('0xc')]('['+_0x4ba714[_0x6c55('0x6b')]['toUpperCase']()+']',_0x6c55('0x63'));_0x4ba714['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2d912f[_0x6c55('0x48')],_0x4ba714[_0x6c55('0x4e')],md5(_0x4ba714[_0x6c55('0x4e')]));}else{_0x4ba714['recordingURL']='';}headers['Authorization']=getAuth(_0x2d912f);return getUser(_0x2d912f)[_0x6c55('0x16')](function(_0x102531){_0xd5364e=_0x102531;logger[_0x6c55('0xc')](_0x6c55('0x6c'),_0xd5364e['id']);return getEndUser(_0x2d912f,_0x4ba714['calleridname'],_0x4ba714[_0x6c55('0x6d')]);})['then'](function(_0x5a0d88){_0x14dedb=_0x5a0d88;logger[_0x6c55('0xc')]('The\x20Enduser\x20ID\x20is:',_0x14dedb['id']);return getTicket(_0x2d912f,_0xd5364e,_0x14dedb,_0x34e740,_0x4ba714);})['then'](function(_0x3e37e8){if(_0x3e37e8){logger[_0x6c55('0xc')](_0x6c55('0x52'),_0x3e37e8['id']);}})[_0x6c55('0x5c')](function(_0x41fff7){logger[_0x6c55('0x5d')]('['+_0x4ba714['lastevent']['toUpperCase']()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util[_0x6c55('0x5f')](_0x41fff7,{'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 c99df71..5982790 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 _0x2f45=['moduleCreate','role','first_name','last_name','Zoho-oauthtoken\x20','data','SUCCESS','details','Error:\x20','log','CREATE\x20ERROR','moduleSearch','contact_lead','uri','Contacts','https://www.zohoapis.','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','contact','lead','nothing','Owner','administrator','getString','Description','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','startCase','talktime','Call_Duration','endtime','utc','YYYY-MM-DDTHH:mm:ss','diff','starttime','mm:ss','called','Call_Result','Called','complete','Answered','rejected','Abandoned','timeout','Timeout','Call_Start_Time','outbound','Call_Type','Inbound','Fields','/crm/v2/Calls','code','Call\x20created!','err','queue','stripTrailingSlash','host','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','/downloads?type=uniqueid&token=','uniqueid','zoho.eu','com','email','The\x20User\x20ID\x20is:','calleridname','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','/crm/EntityInfo.do?module=Calls&id=','[OUTBOUND]','Outbound','trigger:browser:url','https://crm.','lastevent','calleridnum','toUpperCase','lodash','request-promise','md5','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','localhost','socket.io-emitter','emit','debug','[HTTP]','stringify','length','forEach','includes','string','type','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','access_token','expires_in','zone','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','refreshToken','clientId','clientSecret','refresh_token','add','seconds','error','Failing\x20creating\x20the\x20access_token','stack','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','then','users','isArrayLikeObject','findIndex','Agent\x20found!','info','Using\x20the\x20admin\x20account!','Administrator','user','profile','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','catch','enduserType'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2f45,0x18a));var _0x52f4=function(_0xe39f5,_0x594bb3){_0xe39f5=_0xe39f5-0x0;var _0x3d722f=_0x2f45[_0xe39f5];return _0x3d722f;};'use strict';var _=require(_0x52f4('0x0'));var rp=require(_0x52f4('0x1'));var md5=require(_0x52f4('0x2'));var util=require('util');var intUtil=require('./util');var moment=require('moment');var Redis=require(_0x52f4('0x3'));var BPromise=require(_0x52f4('0x4'));var config=require(_0x52f4('0x5'));var logger=require(_0x52f4('0x6'))(_0x52f4('0x7'));config[_0x52f4('0x8')]=_[_0x52f4('0x9')](config[_0x52f4('0x8')],{'host':_0x52f4('0xa'),'port':0x18eb});var io=require(_0x52f4('0xb'))(new Redis(config['redis']));function emit(_0x411dd9,_0x10a21f,_0x3df1ec){io['to'](_0x411dd9)[_0x52f4('0xc')](_0x10a21f,_0x3df1ec);}function request(_0xd40cf8){logger[_0x52f4('0xd')](_0x52f4('0xe'),JSON[_0x52f4('0xf')](_0xd40cf8));return rp(_0xd40cf8);}function getCustomFields(_0x2e5de8,_0xe16c9e){var _0x1480ec={};if(_0x2e5de8[_0x52f4('0x10')]>0x0){_[_0x52f4('0x11')](_0x2e5de8,function(_0x2ae28f){if(_[_0x52f4('0x12')]([_0x52f4('0x13'),'picklist'],_0x2ae28f[_0x52f4('0x14')])&&_0x2ae28f[_0x52f4('0x15')]){_0x1480ec[_0x2ae28f['idField']]=_0x2ae28f[_0x52f4('0x16')][_0x52f4('0x17')]();}else if(_0x2ae28f[_0x52f4('0x14')]===_0x52f4('0x18')&&_0x2ae28f[_0x52f4('0x19')]&&_0x2ae28f['idField']&&_0xe16c9e[_0x2ae28f[_0x52f4('0x19')]]){_0x1480ec[_0x2ae28f[_0x52f4('0x15')]]=_0xe16c9e[_0x2ae28f['variableName']][_0x52f4('0x17')]();}else if(_0x2ae28f[_0x52f4('0x14')]===_0x52f4('0x1a')&&_0x2ae28f[_0x52f4('0x1b')]&&_0x2ae28f[_0x52f4('0x1b')][_0x52f4('0x1c')]&&_0x2ae28f[_0x52f4('0x15')]&&_0xe16c9e[_0x2ae28f[_0x52f4('0x1b')][_0x52f4('0x1c')]['toLowerCase']()]){_0x1480ec[_0x2ae28f[_0x52f4('0x15')]]=_0xe16c9e[_0x2ae28f[_0x52f4('0x1b')][_0x52f4('0x1c')][_0x52f4('0x1d')]()]['toString']();}});}return _0x1480ec;}function getName(_0x2b32e6){if(_0x2b32e6[_0x52f4('0x1e')]('\x20')>0x0){var _0x5e1d0c=_0x2b32e6[_0x52f4('0x1f')](/ (.+)/);if(_0x5e1d0c[0x1]){return _0x5e1d0c;}}return[_0x2b32e6,_0x2b32e6];}var accountsTokens={};function getAccessToken(_0x1e759a){return new Promise(function(_0xf901cc,_0x3ace9b){if(!_[_0x52f4('0x20')](accountsTokens[_0x1e759a['id']])&&!_[_0x52f4('0x20')](accountsTokens[_0x1e759a['id']][_0x52f4('0x21')])){if(moment()['isBefore'](accountsTokens[_0x1e759a['id']][_0x52f4('0x22')])){_0xf901cc(accountsTokens[_0x1e759a['id']][_0x52f4('0x21')]);}}var _0x46023a;switch(_0x1e759a[_0x52f4('0x23')]){case'US':_0x46023a=_0x52f4('0x24');break;case'AU':_0x46023a=_0x52f4('0x25');break;case'EU':_0x46023a='https://accounts.zoho.eu';break;case'IN':_0x46023a=_0x52f4('0x26');break;case'CN':_0x46023a=_0x52f4('0x27');break;default:_0x46023a=_0x52f4('0x28');break;}var _0x1dc060={'method':_0x52f4('0x29'),'uri':_0x46023a+_0x52f4('0x2a'),'qs':{'refresh_token':_0x1e759a[_0x52f4('0x2b')],'client_id':_0x1e759a[_0x52f4('0x2c')],'client_secret':_0x1e759a[_0x52f4('0x2d')],'grant_type':_0x52f4('0x2e')},'json':!![]};return rp(_0x1dc060)['then'](function(_0x3271fe){accountsTokens[_0x1e759a['id']]={'access_token':_0x3271fe[_0x52f4('0x21')],'expires_in':moment()[_0x52f4('0x2f')](_0x3271fe['expires_in'],_0x52f4('0x30'))};_0xf901cc(_0x3271fe[_0x52f4('0x21')]);})['catch'](function(_0x2c0e65){logger[_0x52f4('0x31')](_0x52f4('0x32'),_0x2c0e65[_0x52f4('0x33')]);_0x3ace9b(_0x2c0e65);});});}function getUser(_0x9a808e,_0x1af5e8,_0x28bc10,_0x53472c){logger['info'](_0x52f4('0x34'));return request({'method':_0x52f4('0x35'),'uri':util[_0x52f4('0x36')](_0x52f4('0x37'),_0x1af5e8),'qs':{'type':_0x52f4('0x38')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x9a808e},'json':!![]})[_0x52f4('0x39')](function(_0x3b37d5){if(_0x3b37d5[_0x52f4('0x3a')]){var _0x1c567f=-0x1;if(_[_0x52f4('0x3b')](_0x3b37d5[_0x52f4('0x3a')])){if(!_[_0x52f4('0x20')](_0x53472c)){_0x1c567f=_[_0x52f4('0x3c')](_0x3b37d5[_0x52f4('0x3a')],function(_0x447fc4){return _0x447fc4['email']===_0x53472c;});}if(_0x1c567f>=0x0){logger['info'](_0x52f4('0x3d'));}else{logger[_0x52f4('0x3e')](_0x52f4('0x3f'));_0x1c567f=_[_0x52f4('0x3c')](_0x3b37d5[_0x52f4('0x3a')],function(_0x327eaf){return _0x327eaf['profile'][_0x52f4('0x1c')]===_0x52f4('0x40');});}return _0x3b37d5[_0x52f4('0x3a')][_0x1c567f];}else{if(_0x3b37d5[_0x52f4('0x41')][_0x52f4('0x42')][_0x52f4('0x1c')]===_0x52f4('0x40')){logger[_0x52f4('0x3e')](_0x52f4('0x3f'));user=_0x3b37d5[_0x52f4('0x41')];return user;}else{logger[_0x52f4('0x31')](_0x52f4('0x43'),JSON[_0x52f4('0xf')](_0x3b37d5));throw new Error(_0x52f4('0x44')+JSON[_0x52f4('0xf')](_0x3b37d5));}}}else{logger[_0x52f4('0x31')](_0x52f4('0x43'),JSON['stringify'](_0x3b37d5));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x52f4('0xf')](_0x3b37d5));}})[_0x52f4('0x45')](function(_0x395015){console['error'](_0x395015);});}function getZohoUser(_0x403d29,_0xe4eb51){return new BPromise(function(_0x42f71e,_0x526fff){request(_0x403d29)['then'](function(_0x426b76){var _0x2809c7=null;if(_0x426b76){_0x2809c7=_0x426b76['data'][0x0];_0x2809c7[_0x52f4('0x46')]=_0xe4eb51;}_0x42f71e(_0x2809c7);})[_0x52f4('0x45')](function(_0x58d598){_0x526fff(_0x58d598);});});}function createEndUser(_0x3493ad,_0x1f1a69,_0x3bef26,_0x1e0f5f,_0x5eb6e7,_0x30fd05){var _0x3bef26=getName(_0x3bef26);return request({'method':_0x52f4('0x29'),'uri':'https://www.zohoapis.'+_0x1f1a69+'/crm/v2/'+_['startCase'](_0x30fd05[_0x52f4('0x47')])+'s','body':{'data':[{'Last_Name':_0x3bef26[0x1],'First_Name':_0x3bef26[0x0],'Phone':_0x1e0f5f,'Owner':{'name':!_[_0x52f4('0x20')](_0x5eb6e7['role'][_0x52f4('0x1c')])?_0x5eb6e7[_0x52f4('0x48')][_0x52f4('0x1c')]:!_[_0x52f4('0x20')](_0x5eb6e7[_0x52f4('0x49')])?_0x5eb6e7[_0x52f4('0x49')]+'\x20'+_0x5eb6e7[_0x52f4('0x4a')]:_0x5eb6e7['last_name'],'id':_0x5eb6e7['id']}}]},'headers':{'Authorization':_0x52f4('0x4b')+_0x3493ad},'json':!![]})[_0x52f4('0x39')](function(_0x5408c6){if(_0x5408c6&&_0x5408c6[_0x52f4('0x4c')][0x0]['code']===_0x52f4('0x4d')){var _0x474347=_0x5408c6[_0x52f4('0x4c')][0x0][_0x52f4('0x4e')];_0x474347['enduserType']=_['startCase'](_0x30fd05[_0x52f4('0x47')])+'s';return _0x474347;}logger[_0x52f4('0x31')](_0x52f4('0x43'),JSON[_0x52f4('0xf')](data));throw new Error(_0x52f4('0x4f')+JSON['stringify'](data));})[_0x52f4('0x45')](function(_0x15a02f){console[_0x52f4('0x50')](_0x52f4('0x51'),_0x15a02f);});}function getEndUser(_0x461e5a,_0x2ec45f,_0x3c0585,_0x2a4c6f,_0x56bad2,_0x394808,_0x12d587){var _0x5d200c={'method':_0x52f4('0x35'),'uri':'','headers':{'Authorization':_0x52f4('0x4b')+_0x461e5a},'json':!![]};switch(_0x12d587[_0x52f4('0x52')]){case _0x52f4('0x53'):_0x5d200c[_0x52f4('0x54')]='https://www.zohoapis.'+_0x2ec45f+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x56bad2+'))';return getZohoUser(_0x5d200c,_0x52f4('0x55'))['then'](function(_0xf15433){if(_0xf15433)return _0xf15433;_0x5d200c[_0x52f4('0x54')]=_0x52f4('0x56')+_0x2ec45f+_0x52f4('0x57')+_0x56bad2+'))';return getZohoUser(_0x5d200c,_0x52f4('0x58'))[_0x52f4('0x39')](function(_0x487a06){if(_0x487a06)return _0x487a06;if(_0x12d587[_0x52f4('0x47')]!='nothing'){return createEndUser(_0x461e5a,_0x2ec45f,_0x2a4c6f,_0x56bad2,_0x394808,_0x12d587);}else{return{};}});});break;case _0x52f4('0x59'):_0x5d200c[_0x52f4('0x54')]=_0x52f4('0x56')+_0x2ec45f+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x56bad2+'))';return getZohoUser(_0x5d200c,_0x52f4('0x55'))[_0x52f4('0x39')](function(_0x4862f7){if(_0x4862f7)return _0x4862f7;if(_0x12d587[_0x52f4('0x47')]!='nothing'){return createEndUser(_0x461e5a,_0x2ec45f,_0x2a4c6f,_0x56bad2,_0x394808,_0x12d587);}else{return{};}});break;case _0x52f4('0x5a'):_0x5d200c[_0x52f4('0x54')]=_0x52f4('0x56')+_0x2ec45f+_0x52f4('0x57')+_0x56bad2+'))';return getZohoUser(_0x5d200c,_0x52f4('0x58'))[_0x52f4('0x39')](function(_0x44436b){if(_0x44436b)return _0x44436b;if(_0x12d587[_0x52f4('0x47')]!=_0x52f4('0x5b')){return createEndUser(_0x461e5a,_0x2ec45f,_0x2a4c6f,_0x56bad2,_0x394808,_0x12d587);}else{return{};}});break;}}function getCall(_0x536b7a,_0x3d7733,_0x564b57,_0x583d39,_0x94271,_0x4af0ed,_0x45adf2,_0x2be702){logger[_0x52f4('0x3e')]('Creating\x20new\x20call...');var _0x1cedf7={};_0x1cedf7[_0x52f4('0x5c')]={'name':!_[_0x52f4('0x20')](_0x583d39['role'][_0x52f4('0x1c')])&&!_[_0x52f4('0x20')](_0x583d39['profile']['name'])&&_0x583d39[_0x52f4('0x42')][_0x52f4('0x1c')]===_0x52f4('0x5d')?_0x583d39['role'][_0x52f4('0x1c')]:!_[_0x52f4('0x20')](_0x583d39[_0x52f4('0x49')])?_0x583d39[_0x52f4('0x49')]+'\x20'+_0x583d39[_0x52f4('0x4a')]:_0x583d39[_0x52f4('0x4a')],'id':_0x583d39['id']};_0x1cedf7['Subject']=intUtil[_0x52f4('0x5e')](_0x4af0ed['Subjects'],_0x45adf2,'\x20');_0x1cedf7[_0x52f4('0x5f')]=intUtil['getString'](_0x4af0ed['Descriptions'],_0x45adf2,'\x0a');if(_0x94271['enduserType']===_0x52f4('0x55')){_0x1cedf7[_0x52f4('0x60')]={'name':!_['isNil'](_0x94271[_0x52f4('0x61')])?_0x94271[_0x52f4('0x61')]:!_['isNil'](_0x94271[_0x52f4('0x62')])?_0x94271[_0x52f4('0x62')]+'\x20'+_0x94271[_0x52f4('0x63')]:_0x94271[_0x52f4('0x63')],'id':_0x94271['id']};}if(_0x94271[_0x52f4('0x46')]==='Leads'){_0x1cedf7[_0x52f4('0x64')]={'name':!_[_0x52f4('0x20')](_0x94271[_0x52f4('0x61')])?_0x94271[_0x52f4('0x61')]:!_[_0x52f4('0x20')](_0x94271[_0x52f4('0x62')])?_0x94271[_0x52f4('0x62')]+'\x20'+_0x94271[_0x52f4('0x63')]:_0x94271[_0x52f4('0x63')],'id':_0x94271['id']};_0x1cedf7[_0x52f4('0x65')]=_[_0x52f4('0x66')](_0x94271[_0x52f4('0x46')]);}if(_0x45adf2[_0x52f4('0x67')]){_0x1cedf7[_0x52f4('0x68')]=moment['utc'](parseInt(_0x45adf2[_0x52f4('0x67')])*0x3e8)[_0x52f4('0x36')]('mm:ss');}else if(_0x45adf2['answertime']&&_0x45adf2[_0x52f4('0x69')]){_0x1cedf7[_0x52f4('0x68')]=moment[_0x52f4('0x6a')](moment(_0x45adf2[_0x52f4('0x69')],_0x52f4('0x6b'))[_0x52f4('0x6c')](moment(_0x45adf2[_0x52f4('0x6d')],_0x52f4('0x6b'))))['format'](_0x52f4('0x6e'));}switch(_0x45adf2['lastevent']){case _0x52f4('0x6f'):_0x1cedf7[_0x52f4('0x70')]=_0x52f4('0x71');break;case _0x52f4('0x72'):case'connect':_0x1cedf7[_0x52f4('0x70')]=_0x52f4('0x73');break;case _0x52f4('0x74'):_0x1cedf7[_0x52f4('0x70')]='Rejected';break;case'abandoned':_0x1cedf7['Call_Result']=_0x52f4('0x75');break;case _0x52f4('0x76'):_0x1cedf7[_0x52f4('0x70')]=_0x52f4('0x77');default:}_0x1cedf7[_0x52f4('0x78')]=(_0x2be702===_0x52f4('0x79')?moment(_0x45adf2[_0x52f4('0x6d')])[_0x52f4('0x36')](_0x52f4('0x6b')):moment(_0x45adf2['agentcalledAt'])[_0x52f4('0x36')](_0x52f4('0x6b')))||moment()['format'](_0x52f4('0x6b'));_0x1cedf7[_0x52f4('0x7a')]=_0x2be702||_0x52f4('0x7b');_0x1cedf7=_['merge'](_0x1cedf7,getCustomFields(_0x4af0ed[_0x52f4('0x7c')],_0x45adf2));return request({'method':_0x52f4('0x29'),'uri':_0x52f4('0x56')+_0x3d7733+_0x52f4('0x7d'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x536b7a},'body':{'data':[_0x1cedf7]},'json':!![]})[_0x52f4('0x39')](function(_0x46f11d){if(_0x46f11d&&_0x46f11d[_0x52f4('0x4c')][0x0][_0x52f4('0x7e')]==='SUCCESS'){logger[_0x52f4('0x3e')](_0x52f4('0x7f'));return{'id':_0x46f11d[_0x52f4('0x4c')][0x0]['details']['id']};}})['catch'](function(_0x44a19b){logger[_0x52f4('0x3e')](_0x52f4('0x80'),_0x44a19b[_0x52f4('0x33')]);console[_0x52f4('0x50')](_0x52f4('0x80'),_0x44a19b);});}exports[_0x52f4('0x81')]=function(_0x4dc71c,_0x15b6bd,_0x13600e,_0x36bff4,_0x232971,_0x372ae1){var _0x5e36ae,_0x48b4d3,_0x176ef4;_0x372ae1['host']=intUtil[_0x52f4('0x82')](_0x372ae1[_0x52f4('0x83')]);_0x372ae1[_0x52f4('0x84')]=intUtil[_0x52f4('0x82')](_0x372ae1['serverUrl']);if(_0x232971&&_0x232971[_0x52f4('0x85')]){logger['info'](_0x52f4('0x86'),_0x52f4('0x87'));_0x15b6bd[_0x52f4('0x88')]=_0x372ae1[_0x52f4('0x84')]+_0x52f4('0x89')+_0x15b6bd['uniqueid']+_0x52f4('0x8a')+md5(_0x15b6bd[_0x52f4('0x8b')]);}else{_0x15b6bd['recordingURL']='';}var _0x5d03d5=_0x372ae1[_0x52f4('0x83')]===_0x52f4('0x8c')?'eu':_0x52f4('0x8d');return getAccessToken(_0x372ae1)['then'](function(_0xbbe1af){_0x176ef4=_0xbbe1af;return getUser(_0x176ef4,_0x5d03d5,_0x372ae1,_0x36bff4[_0x52f4('0x8e')]);})[_0x52f4('0x39')](function(_0x4a63ed){_0x5e36ae=_0x4a63ed;logger[_0x52f4('0x3e')](_0x52f4('0x8f'),_0x5e36ae['id']);return getEndUser(_0x176ef4,_0x5d03d5,_0x372ae1,_0x15b6bd[_0x52f4('0x90')],_0x15b6bd['calleridnum'],_0x5e36ae,_0x13600e);})[_0x52f4('0x39')](function(_0x54aa88){_0x48b4d3=_0x54aa88;return getCall(_0x176ef4,_0x5d03d5,_0x372ae1,_0x5e36ae,_0x48b4d3,_0x13600e,_0x15b6bd,_0x52f4('0x7b'));})['then'](function(_0xd9439c){if(_0xd9439c){logger['info'](_0x52f4('0x91'),_0xd9439c['id']);logger[_0x52f4('0x3e')](_0x52f4('0x86'),_0x52f4('0x92'));emit(util[_0x52f4('0x36')]('user:%s',_0x36bff4[_0x52f4('0x1c')]),'trigger:browser:url',{'uri':'https://crm.'+_0x372ae1[_0x52f4('0x83')]+_0x52f4('0x93')+_0xd9439c['id']});}})['catch'](function(_0x160ec9){logger[_0x52f4('0x31')](_0x52f4('0x86'),JSON[_0x52f4('0xf')](_0x160ec9));});};exports[_0x52f4('0x79')]=function(_0x3df3bf,_0x3c51bf,_0x2ff4b,_0x3ac060,_0x3fa665,_0x35a220,_0x10ded2){var _0x4af063,_0x39f132,_0xbc9ad4;_0x35a220[_0x52f4('0x83')]=intUtil[_0x52f4('0x82')](_0x35a220[_0x52f4('0x83')]);_0x35a220[_0x52f4('0x84')]=intUtil[_0x52f4('0x82')](_0x35a220[_0x52f4('0x84')]);if(_0x10ded2&&_0x10ded2['recordingFormat']&&_0x10ded2['recordingFormat']!=='none'){logger['info'](_0x52f4('0x94'),_0x52f4('0x87'));_0x3c51bf['recordingURL']=_0x35a220['serverUrl']+_0x52f4('0x89')+_0x3c51bf['uniqueid']+_0x52f4('0x8a')+md5(_0x3c51bf[_0x52f4('0x8b')]);}var _0x2f9643=_0x35a220[_0x52f4('0x83')]==='zoho.eu'?'eu':_0x52f4('0x8d');return getAccessToken(_0x35a220)['then'](function(_0x2260b7){_0xbc9ad4=_0x2260b7;return getUser(_0xbc9ad4,_0x2f9643,_0x35a220,_0x3ac060[_0x52f4('0x8e')]);})[_0x52f4('0x39')](function(_0x317379){_0x4af063=_0x317379;logger[_0x52f4('0x3e')](_0x52f4('0x8f'),_0x4af063['id']);return getEndUser(_0xbc9ad4,_0x2f9643,_0x35a220,_0x3c51bf['destcalleridname'],_0x3c51bf['destcalleridnum'],_0x4af063,_0x2ff4b);})[_0x52f4('0x39')](function(_0x1fc6bd){_0x39f132=_0x1fc6bd;return getCall(_0xbc9ad4,_0x2f9643,_0x35a220,_0x4af063,_0x39f132,_0x2ff4b,_0x3c51bf,_0x52f4('0x95'));})[_0x52f4('0x39')](function(_0x43ef97){if(_0x43ef97){logger[_0x52f4('0x3e')]('The\x20Call\x20ID\x20is:',_0x43ef97['id']);logger['info'](_0x52f4('0x94'),_0x52f4('0x92'));emit(util[_0x52f4('0x36')]('user:%s',_0x3ac060[_0x52f4('0x1c')]),_0x52f4('0x96'),{'uri':_0x52f4('0x97')+_0x35a220[_0x52f4('0x83')]+_0x52f4('0x93')+_0x43ef97['id']});}})[_0x52f4('0x45')](function(_0x1c520f){logger[_0x52f4('0x31')](_0x52f4('0x94'),JSON['stringify'](_0x1c520f));});};exports['unmanaged']=function(_0x5a3a49,_0x5d06c5,_0x2e3782,_0x3265ee,_0x11fb37,_0x426d7b){var _0x2e084a,_0x24fdb7,_0x30d358;_0x426d7b[_0x52f4('0x83')]=intUtil[_0x52f4('0x82')](_0x426d7b['host']);_0x426d7b[_0x52f4('0x84')]=intUtil[_0x52f4('0x82')](_0x426d7b[_0x52f4('0x84')]);if(_0x11fb37&&_0x11fb37[_0x52f4('0x85')]){logger['info']('['+_0x5d06c5[_0x52f4('0x98')]['toUpperCase']()+']',_0x52f4('0x87'));_0x5d06c5[_0x52f4('0x88')]=_0x426d7b[_0x52f4('0x84')]+_0x52f4('0x89')+_0x5d06c5['uniqueid']+_0x52f4('0x8a')+md5(_0x5d06c5['uniqueid']);}else{_0x5d06c5['recordingURL']='';}var _0x2a6714=_0x426d7b[_0x52f4('0x83')]===_0x52f4('0x8c')?'eu':_0x52f4('0x8d');return getAccessToken(_0x426d7b)['then'](function(_0x59ed55){_0x30d358=_0x59ed55;return getUser(_0x30d358,_0x2a6714,_0x426d7b);})[_0x52f4('0x39')](function(_0x348705){_0x2e084a=_0x348705;logger[_0x52f4('0x3e')](_0x52f4('0x8f'),_0x2e084a['id']);return getEndUser(_0x30d358,_0x2a6714,_0x426d7b,_0x5d06c5[_0x52f4('0x90')],_0x5d06c5[_0x52f4('0x99')],_0x2e084a,_0x2e3782);})[_0x52f4('0x39')](function(_0x18eda4){_0x24fdb7=_0x18eda4;return getCall(_0x30d358,_0x2a6714,_0x426d7b,_0x2e084a,_0x24fdb7,_0x2e3782,_0x5d06c5,_0x52f4('0x7b'));})['then'](function(_0x3d66f6){if(_0x3d66f6){logger[_0x52f4('0x3e')](_0x52f4('0x91'),_0x3d66f6['id']);}})[_0x52f4('0x45')](function(_0x4a8caf){logger[_0x52f4('0x31')]('['+_0x5d06c5[_0x52f4('0x98')][_0x52f4('0x9a')]()+']',JSON['stringify'](_0x4a8caf));});}; \ No newline at end of file +var _0xa388=['Full_Name','First_Name','Last_Name','Leads','What_Id','$se_module','utc','talktime','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','called','Call_Result','Called','complete','connect','Answered','rejected','Rejected','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','agentcalledAt','Call_Type','Inbound','Fields','/crm/v2/Calls','data','Call\x20created!','err','stack','queue','host','stripTrailingSlash','serverUrl','[QUEUE]','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','com','email','calleridname','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','https://crm.','/crm/EntityInfo.do?module=Calls&id=','outbound','recordingFormat','[OUTBOUND]','zoho.eu','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Outbound','trigger:browser:url','unmanaged','toUpperCase','calleridnum','lodash','request-promise','./util','moment','ioredis','bluebird','../../../../config/logger','zoho','redis','defaults','socket.io-emitter','emit','debug','stringify','length','includes','string','picklist','type','idField','content','toString','variable','variableName','Variable','name','toLowerCase','indexOf','split','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','refreshToken','clientId','refresh_token','then','add','seconds','catch','error','Search\x20user','GET','format','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','info','Agent\x20found!','user','profile','Administrator','Using\x20the\x20admin\x20account!','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','The\x20failing\x20result\x20is','enduserType','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','code','SUCCESS','details','Error:\x20','log','contact_lead','Contacts','uri','nothing','contact','/crm/v2/Contacts/search?criteria=((Phone:equals:','lead','/crm/v2/Leads/search?criteria=((Phone:equals:','Creating\x20new\x20call...','Owner','administrator','Subject','getString','Subjects','Descriptions','Who_Id'];(function(_0x324c74,_0x16cf74){var _0x1e97c5=function(_0x597da2){while(--_0x597da2){_0x324c74['push'](_0x324c74['shift']());}};_0x1e97c5(++_0x16cf74);}(_0xa388,0xde));var _0x8a38=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa388[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8a38('0x0'));var rp=require(_0x8a38('0x1'));var md5=require('md5');var util=require('util');var intUtil=require(_0x8a38('0x2'));var moment=require(_0x8a38('0x3'));var Redis=require(_0x8a38('0x4'));var BPromise=require(_0x8a38('0x5'));var config=require('../../../../config/environment');var logger=require(_0x8a38('0x6'))(_0x8a38('0x7'));config[_0x8a38('0x8')]=_[_0x8a38('0x9')](config[_0x8a38('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x8a38('0xa'))(new Redis(config[_0x8a38('0x8')]));function emit(_0x2f08fd,_0x4f9f29,_0x29ccab){io['to'](_0x2f08fd)[_0x8a38('0xb')](_0x4f9f29,_0x29ccab);}function request(_0x1e1c5d){logger[_0x8a38('0xc')]('[HTTP]',JSON[_0x8a38('0xd')](_0x1e1c5d));return rp(_0x1e1c5d);}function getCustomFields(_0x1ae428,_0x47e731){var _0x539872={};if(_0x1ae428[_0x8a38('0xe')]>0x0){_['forEach'](_0x1ae428,function(_0x507ee1){if(_[_0x8a38('0xf')]([_0x8a38('0x10'),_0x8a38('0x11')],_0x507ee1[_0x8a38('0x12')])&&_0x507ee1[_0x8a38('0x13')]){_0x539872[_0x507ee1['idField']]=_0x507ee1[_0x8a38('0x14')][_0x8a38('0x15')]();}else if(_0x507ee1['type']===_0x8a38('0x16')&&_0x507ee1[_0x8a38('0x17')]&&_0x507ee1[_0x8a38('0x13')]&&_0x47e731[_0x507ee1[_0x8a38('0x17')]]){_0x539872[_0x507ee1[_0x8a38('0x13')]]=_0x47e731[_0x507ee1[_0x8a38('0x17')]][_0x8a38('0x15')]();}else if(_0x507ee1[_0x8a38('0x12')]==='customVariable'&&_0x507ee1[_0x8a38('0x18')]&&_0x507ee1['Variable'][_0x8a38('0x19')]&&_0x507ee1[_0x8a38('0x13')]&&_0x47e731[_0x507ee1['Variable'][_0x8a38('0x19')]['toLowerCase']()]){_0x539872[_0x507ee1[_0x8a38('0x13')]]=_0x47e731[_0x507ee1['Variable'][_0x8a38('0x19')][_0x8a38('0x1a')]()][_0x8a38('0x15')]();}});}return _0x539872;}function getName(_0x534d39){if(_0x534d39[_0x8a38('0x1b')]('\x20')>0x0){var _0x35b685=_0x534d39[_0x8a38('0x1c')](/ (.+)/);if(_0x35b685[0x1]){return _0x35b685;}}return[_0x534d39,_0x534d39];}var accountsTokens={};function getAccessToken(_0xcc7168){return new Promise(function(_0x30e0e6,_0x34b2c4){if(!_[_0x8a38('0x1d')](accountsTokens[_0xcc7168['id']])&&!_[_0x8a38('0x1d')](accountsTokens[_0xcc7168['id']][_0x8a38('0x1e')])){if(moment()[_0x8a38('0x1f')](accountsTokens[_0xcc7168['id']][_0x8a38('0x20')])){_0x30e0e6(accountsTokens[_0xcc7168['id']][_0x8a38('0x1e')]);}}var _0x2a9304;switch(_0xcc7168[_0x8a38('0x21')]){case'US':_0x2a9304=_0x8a38('0x22');break;case'AU':_0x2a9304=_0x8a38('0x23');break;case'EU':_0x2a9304='https://accounts.zoho.eu';break;case'IN':_0x2a9304=_0x8a38('0x24');break;case'CN':_0x2a9304='https://accounts.zoho.com.cn';break;default:_0x2a9304='https://accounts.zoho.eu';break;}var _0x4a14db={'method':'POST','uri':_0x2a9304+'/oauth/v2/token','qs':{'refresh_token':_0xcc7168[_0x8a38('0x25')],'client_id':_0xcc7168[_0x8a38('0x26')],'client_secret':_0xcc7168['clientSecret'],'grant_type':_0x8a38('0x27')},'json':!![]};return rp(_0x4a14db)[_0x8a38('0x28')](function(_0x57b9b5){accountsTokens[_0xcc7168['id']]={'access_token':_0x57b9b5[_0x8a38('0x1e')],'expires_in':moment()[_0x8a38('0x29')](_0x57b9b5[_0x8a38('0x20')],_0x8a38('0x2a'))};_0x30e0e6(_0x57b9b5['access_token']);})[_0x8a38('0x2b')](function(_0x284ec7){logger[_0x8a38('0x2c')]('Failing\x20creating\x20the\x20access_token',_0x284ec7['stack']);_0x34b2c4(_0x284ec7);});});}function getUser(_0x1ef33b,_0x102efa,_0x1b1b78,_0x464c8e){logger['info'](_0x8a38('0x2d'));return request({'method':_0x8a38('0x2e'),'uri':util[_0x8a38('0x2f')]('https://www.zohoapis.%s/crm/v2/users',_0x102efa),'qs':{'type':_0x8a38('0x30')},'headers':{'Authorization':_0x8a38('0x31')+_0x1ef33b},'json':!![]})[_0x8a38('0x28')](function(_0x3eda24){if(_0x3eda24[_0x8a38('0x32')]){var _0x2ca762=-0x1;if(_[_0x8a38('0x33')](_0x3eda24[_0x8a38('0x32')])){if(!_[_0x8a38('0x1d')](_0x464c8e)){_0x2ca762=_[_0x8a38('0x34')](_0x3eda24[_0x8a38('0x32')],function(_0x56e283){return _0x56e283['email']===_0x464c8e;});}if(_0x2ca762>=0x0){logger[_0x8a38('0x35')](_0x8a38('0x36'));}else{logger[_0x8a38('0x35')]('Using\x20the\x20admin\x20account!');_0x2ca762=_[_0x8a38('0x34')](_0x3eda24[_0x8a38('0x32')],function(_0x26234d){return _0x26234d['profile'][_0x8a38('0x19')]==='Administrator';});}return _0x3eda24[_0x8a38('0x32')][_0x2ca762];}else{if(_0x3eda24[_0x8a38('0x37')][_0x8a38('0x38')][_0x8a38('0x19')]===_0x8a38('0x39')){logger[_0x8a38('0x35')](_0x8a38('0x3a'));user=_0x3eda24[_0x8a38('0x37')];return user;}else{logger[_0x8a38('0x2c')]('The\x20failing\x20result\x20is',JSON['stringify'](_0x3eda24));throw new Error(_0x8a38('0x3b')+JSON[_0x8a38('0xd')](_0x3eda24));}}}else{logger[_0x8a38('0x2c')](_0x8a38('0x3c'),JSON['stringify'](_0x3eda24));throw new Error(_0x8a38('0x3b')+JSON['stringify'](_0x3eda24));}})['catch'](function(_0x2b6596){console[_0x8a38('0x2c')](_0x2b6596);});}function getZohoUser(_0x5c3b5c,_0x296aee){return new BPromise(function(_0xf5ebf2,_0x487662){request(_0x5c3b5c)['then'](function(_0x356d9f){var _0x2e75ba=null;if(_0x356d9f){_0x2e75ba=_0x356d9f['data'][0x0];_0x2e75ba[_0x8a38('0x3d')]=_0x296aee;}_0xf5ebf2(_0x2e75ba);})[_0x8a38('0x2b')](function(_0x110082){_0x487662(_0x110082);});});}function createEndUser(_0x4055c0,_0x292486,_0x50a792,_0x16f471,_0x474928,_0x246060){var _0x50a792=getName(_0x50a792);return request({'method':'POST','uri':_0x8a38('0x3e')+_0x292486+_0x8a38('0x3f')+_[_0x8a38('0x40')](_0x246060[_0x8a38('0x41')])+'s','body':{'data':[{'Last_Name':_0x50a792[0x1],'First_Name':_0x50a792[0x0],'Phone':_0x16f471,'Owner':{'name':!_[_0x8a38('0x1d')](_0x474928[_0x8a38('0x42')]['name'])?_0x474928[_0x8a38('0x42')][_0x8a38('0x19')]:!_['isNil'](_0x474928[_0x8a38('0x43')])?_0x474928[_0x8a38('0x43')]+'\x20'+_0x474928[_0x8a38('0x44')]:_0x474928[_0x8a38('0x44')],'id':_0x474928['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x4055c0},'json':!![]})[_0x8a38('0x28')](function(_0x2ae6bc){if(_0x2ae6bc&&_0x2ae6bc['data'][0x0][_0x8a38('0x45')]===_0x8a38('0x46')){var _0x244681=_0x2ae6bc['data'][0x0][_0x8a38('0x47')];_0x244681[_0x8a38('0x3d')]=_['startCase'](_0x246060['moduleCreate'])+'s';return _0x244681;}logger[_0x8a38('0x2c')]('The\x20failing\x20result\x20is',JSON[_0x8a38('0xd')](data));throw new Error(_0x8a38('0x48')+JSON[_0x8a38('0xd')](data));})[_0x8a38('0x2b')](function(_0x551a00){console[_0x8a38('0x49')]('CREATE\x20ERROR',_0x551a00);});}function getEndUser(_0xefdd3e,_0x3d3b07,_0x4d572f,_0x42521f,_0x16e9cc,_0x23b488,_0x97f5f8){var _0x799452={'method':_0x8a38('0x2e'),'uri':'','headers':{'Authorization':_0x8a38('0x31')+_0xefdd3e},'json':!![]};switch(_0x97f5f8['moduleSearch']){case _0x8a38('0x4a'):_0x799452['uri']=_0x8a38('0x3e')+_0x3d3b07+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x16e9cc+'))';return getZohoUser(_0x799452,_0x8a38('0x4b'))[_0x8a38('0x28')](function(_0x20ebba){if(_0x20ebba)return _0x20ebba;_0x799452[_0x8a38('0x4c')]='https://www.zohoapis.'+_0x3d3b07+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x16e9cc+'))';return getZohoUser(_0x799452,'Leads')[_0x8a38('0x28')](function(_0x35ab70){if(_0x35ab70)return _0x35ab70;if(_0x97f5f8[_0x8a38('0x41')]!=_0x8a38('0x4d')){return createEndUser(_0xefdd3e,_0x3d3b07,_0x42521f,_0x16e9cc,_0x23b488,_0x97f5f8);}else{return{};}});});break;case _0x8a38('0x4e'):_0x799452[_0x8a38('0x4c')]=_0x8a38('0x3e')+_0x3d3b07+_0x8a38('0x4f')+_0x16e9cc+'))';return getZohoUser(_0x799452,_0x8a38('0x4b'))[_0x8a38('0x28')](function(_0x53ae91){if(_0x53ae91)return _0x53ae91;if(_0x97f5f8[_0x8a38('0x41')]!='nothing'){return createEndUser(_0xefdd3e,_0x3d3b07,_0x42521f,_0x16e9cc,_0x23b488,_0x97f5f8);}else{return{};}});break;case _0x8a38('0x50'):_0x799452['uri']=_0x8a38('0x3e')+_0x3d3b07+_0x8a38('0x51')+_0x16e9cc+'))';return getZohoUser(_0x799452,'Leads')[_0x8a38('0x28')](function(_0x5b84da){if(_0x5b84da)return _0x5b84da;if(_0x97f5f8[_0x8a38('0x41')]!=_0x8a38('0x4d')){return createEndUser(_0xefdd3e,_0x3d3b07,_0x42521f,_0x16e9cc,_0x23b488,_0x97f5f8);}else{return{};}});break;}}function getCall(_0x190328,_0x39a83b,_0x12ed07,_0x13c499,_0xdc27e,_0xa2f195,_0x573d39,_0x247d61){logger[_0x8a38('0x35')](_0x8a38('0x52'));var _0x4eb56e={};_0x4eb56e[_0x8a38('0x53')]={'name':!_[_0x8a38('0x1d')](_0x13c499['role'][_0x8a38('0x19')])&&!_['isNil'](_0x13c499[_0x8a38('0x38')][_0x8a38('0x19')])&&_0x13c499[_0x8a38('0x38')][_0x8a38('0x19')]===_0x8a38('0x54')?_0x13c499['role'][_0x8a38('0x19')]:!_['isNil'](_0x13c499['first_name'])?_0x13c499[_0x8a38('0x43')]+'\x20'+_0x13c499[_0x8a38('0x44')]:_0x13c499[_0x8a38('0x44')],'id':_0x13c499['id']};_0x4eb56e[_0x8a38('0x55')]=intUtil[_0x8a38('0x56')](_0xa2f195[_0x8a38('0x57')],_0x573d39,'\x20');_0x4eb56e['Description']=intUtil[_0x8a38('0x56')](_0xa2f195[_0x8a38('0x58')],_0x573d39,'\x0a');if(_0xdc27e[_0x8a38('0x3d')]===_0x8a38('0x4b')){_0x4eb56e[_0x8a38('0x59')]={'name':!_['isNil'](_0xdc27e[_0x8a38('0x5a')])?_0xdc27e['Full_Name']:!_[_0x8a38('0x1d')](_0xdc27e[_0x8a38('0x5b')])?_0xdc27e[_0x8a38('0x5b')]+'\x20'+_0xdc27e[_0x8a38('0x5c')]:_0xdc27e[_0x8a38('0x5c')],'id':_0xdc27e['id']};}if(_0xdc27e['enduserType']===_0x8a38('0x5d')){_0x4eb56e[_0x8a38('0x5e')]={'name':!_[_0x8a38('0x1d')](_0xdc27e[_0x8a38('0x5a')])?_0xdc27e[_0x8a38('0x5a')]:!_[_0x8a38('0x1d')](_0xdc27e[_0x8a38('0x5b')])?_0xdc27e['First_Name']+'\x20'+_0xdc27e[_0x8a38('0x5c')]:_0xdc27e[_0x8a38('0x5c')],'id':_0xdc27e['id']};_0x4eb56e[_0x8a38('0x5f')]=_['startCase'](_0xdc27e['enduserType']);}if(_0x573d39['talktime']){_0x4eb56e['Call_Duration']=moment[_0x8a38('0x60')](parseInt(_0x573d39[_0x8a38('0x61')])*0x3e8)[_0x8a38('0x2f')](_0x8a38('0x62'));}else if(_0x573d39[_0x8a38('0x63')]&&_0x573d39[_0x8a38('0x64')]){_0x4eb56e['Call_Duration']=moment['utc'](moment(_0x573d39[_0x8a38('0x64')],_0x8a38('0x65'))[_0x8a38('0x66')](moment(_0x573d39[_0x8a38('0x67')],_0x8a38('0x65'))))[_0x8a38('0x2f')](_0x8a38('0x62'));}switch(_0x573d39[_0x8a38('0x68')]){case _0x8a38('0x69'):_0x4eb56e[_0x8a38('0x6a')]=_0x8a38('0x6b');break;case _0x8a38('0x6c'):case _0x8a38('0x6d'):_0x4eb56e[_0x8a38('0x6a')]=_0x8a38('0x6e');break;case _0x8a38('0x6f'):_0x4eb56e[_0x8a38('0x6a')]=_0x8a38('0x70');break;case _0x8a38('0x71'):_0x4eb56e['Call_Result']=_0x8a38('0x72');break;case _0x8a38('0x73'):_0x4eb56e[_0x8a38('0x6a')]=_0x8a38('0x74');default:}_0x4eb56e[_0x8a38('0x75')]=(_0x247d61==='outbound'?moment(_0x573d39[_0x8a38('0x67')])[_0x8a38('0x2f')](_0x8a38('0x65')):moment(_0x573d39[_0x8a38('0x76')])[_0x8a38('0x2f')]('YYYY-MM-DDTHH:mm:ss'))||moment()['format'](_0x8a38('0x65'));_0x4eb56e[_0x8a38('0x77')]=_0x247d61||_0x8a38('0x78');_0x4eb56e=_['merge'](_0x4eb56e,getCustomFields(_0xa2f195[_0x8a38('0x79')],_0x573d39));return request({'method':'POST','uri':_0x8a38('0x3e')+_0x39a83b+_0x8a38('0x7a'),'headers':{'Authorization':_0x8a38('0x31')+_0x190328},'body':{'data':[_0x4eb56e]},'json':!![]})[_0x8a38('0x28')](function(_0x321d5a){if(_0x321d5a&&_0x321d5a[_0x8a38('0x7b')][0x0][_0x8a38('0x45')]===_0x8a38('0x46')){logger[_0x8a38('0x35')](_0x8a38('0x7c'));return{'id':_0x321d5a[_0x8a38('0x7b')][0x0][_0x8a38('0x47')]['id']};}})[_0x8a38('0x2b')](function(_0x3b36c3){logger['info'](_0x8a38('0x7d'),_0x3b36c3[_0x8a38('0x7e')]);console['log'](_0x8a38('0x7d'),_0x3b36c3);});}exports[_0x8a38('0x7f')]=function(_0x2b1efd,_0x5ef931,_0x2fe2ad,_0x3c5933,_0x303c4b,_0x1e63ac){var _0x38d960,_0x26bc23,_0x2e386f;_0x1e63ac[_0x8a38('0x80')]=intUtil[_0x8a38('0x81')](_0x1e63ac[_0x8a38('0x80')]);_0x1e63ac[_0x8a38('0x82')]=intUtil['stripTrailingSlash'](_0x1e63ac['serverUrl']);if(_0x303c4b&&_0x303c4b['monitor_format']){logger[_0x8a38('0x35')](_0x8a38('0x83'),'Recording\x20is\x20enabled!');_0x5ef931[_0x8a38('0x84')]=_0x1e63ac[_0x8a38('0x82')]+_0x8a38('0x85')+_0x5ef931[_0x8a38('0x86')]+_0x8a38('0x87')+md5(_0x5ef931[_0x8a38('0x86')]);}else{_0x5ef931[_0x8a38('0x84')]='';}var _0x295532=_0x1e63ac[_0x8a38('0x80')]==='zoho.eu'?'eu':_0x8a38('0x88');return getAccessToken(_0x1e63ac)[_0x8a38('0x28')](function(_0x1045b7){_0x2e386f=_0x1045b7;return getUser(_0x2e386f,_0x295532,_0x1e63ac,_0x3c5933[_0x8a38('0x89')]);})[_0x8a38('0x28')](function(_0x17cc15){_0x38d960=_0x17cc15;logger['info']('The\x20User\x20ID\x20is:',_0x38d960['id']);return getEndUser(_0x2e386f,_0x295532,_0x1e63ac,_0x5ef931[_0x8a38('0x8a')],_0x5ef931['calleridnum'],_0x38d960,_0x2fe2ad);})['then'](function(_0x4647b4){_0x26bc23=_0x4647b4;return getCall(_0x2e386f,_0x295532,_0x1e63ac,_0x38d960,_0x26bc23,_0x2fe2ad,_0x5ef931,_0x8a38('0x78'));})[_0x8a38('0x28')](function(_0x3ca822){if(_0x3ca822){logger[_0x8a38('0x35')](_0x8a38('0x8b'),_0x3ca822['id']);logger['info']('[QUEUE]',_0x8a38('0x8c'));emit(util['format'](_0x8a38('0x8d'),_0x3c5933[_0x8a38('0x19')]),'trigger:browser:url',{'uri':_0x8a38('0x8e')+_0x1e63ac['host']+_0x8a38('0x8f')+_0x3ca822['id']});}})[_0x8a38('0x2b')](function(_0x31bd71){logger[_0x8a38('0x2c')]('[QUEUE]',JSON['stringify'](_0x31bd71));});};exports[_0x8a38('0x90')]=function(_0x4223f1,_0x2e48f0,_0xdf95be,_0x57edf1,_0x661491,_0x179c07,_0x561fd0){var _0x12f1c8,_0x4bdfc5,_0xe20c87;_0x179c07[_0x8a38('0x80')]=intUtil[_0x8a38('0x81')](_0x179c07[_0x8a38('0x80')]);_0x179c07[_0x8a38('0x82')]=intUtil[_0x8a38('0x81')](_0x179c07[_0x8a38('0x82')]);if(_0x561fd0&&_0x561fd0[_0x8a38('0x91')]&&_0x561fd0[_0x8a38('0x91')]!=='none'){logger[_0x8a38('0x35')](_0x8a38('0x92'),'Recording\x20is\x20enabled!');_0x2e48f0[_0x8a38('0x84')]=_0x179c07[_0x8a38('0x82')]+_0x8a38('0x85')+_0x2e48f0[_0x8a38('0x86')]+_0x8a38('0x87')+md5(_0x2e48f0[_0x8a38('0x86')]);}var _0x197dce=_0x179c07[_0x8a38('0x80')]===_0x8a38('0x93')?'eu':_0x8a38('0x88');return getAccessToken(_0x179c07)[_0x8a38('0x28')](function(_0x298ac6){_0xe20c87=_0x298ac6;return getUser(_0xe20c87,_0x197dce,_0x179c07,_0x57edf1[_0x8a38('0x89')]);})[_0x8a38('0x28')](function(_0x267ed6){_0x12f1c8=_0x267ed6;logger[_0x8a38('0x35')](_0x8a38('0x94'),_0x12f1c8['id']);return getEndUser(_0xe20c87,_0x197dce,_0x179c07,_0x2e48f0[_0x8a38('0x95')],_0x2e48f0[_0x8a38('0x96')],_0x12f1c8,_0xdf95be);})[_0x8a38('0x28')](function(_0x49fa5e){_0x4bdfc5=_0x49fa5e;return getCall(_0xe20c87,_0x197dce,_0x179c07,_0x12f1c8,_0x4bdfc5,_0xdf95be,_0x2e48f0,_0x8a38('0x97'));})[_0x8a38('0x28')](function(_0x4ab612){if(_0x4ab612){logger[_0x8a38('0x35')](_0x8a38('0x8b'),_0x4ab612['id']);logger[_0x8a38('0x35')](_0x8a38('0x92'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x8a38('0x2f')](_0x8a38('0x8d'),_0x57edf1['name']),_0x8a38('0x98'),{'uri':'https://crm.'+_0x179c07[_0x8a38('0x80')]+_0x8a38('0x8f')+_0x4ab612['id']});}})['catch'](function(_0x3deaf0){logger[_0x8a38('0x2c')](_0x8a38('0x92'),JSON[_0x8a38('0xd')](_0x3deaf0));});};exports[_0x8a38('0x99')]=function(_0x53aff4,_0x6d9c9b,_0x4ab576,_0x1f34c3,_0x42ac8f,_0x188b5a){var _0x17dd49,_0x2cdc34,_0x5ca051;_0x188b5a[_0x8a38('0x80')]=intUtil[_0x8a38('0x81')](_0x188b5a['host']);_0x188b5a[_0x8a38('0x82')]=intUtil[_0x8a38('0x81')](_0x188b5a[_0x8a38('0x82')]);if(_0x42ac8f&&_0x42ac8f['monitor_format']){logger[_0x8a38('0x35')]('['+_0x6d9c9b[_0x8a38('0x68')][_0x8a38('0x9a')]()+']','Recording\x20is\x20enabled!');_0x6d9c9b[_0x8a38('0x84')]=_0x188b5a[_0x8a38('0x82')]+'/api/voice/recordings/'+_0x6d9c9b['uniqueid']+_0x8a38('0x87')+md5(_0x6d9c9b[_0x8a38('0x86')]);}else{_0x6d9c9b[_0x8a38('0x84')]='';}var _0x27c55a=_0x188b5a[_0x8a38('0x80')]===_0x8a38('0x93')?'eu':_0x8a38('0x88');return getAccessToken(_0x188b5a)[_0x8a38('0x28')](function(_0xb6a9d6){_0x5ca051=_0xb6a9d6;return getUser(_0x5ca051,_0x27c55a,_0x188b5a);})['then'](function(_0x4978d6){_0x17dd49=_0x4978d6;logger[_0x8a38('0x35')](_0x8a38('0x94'),_0x17dd49['id']);return getEndUser(_0x5ca051,_0x27c55a,_0x188b5a,_0x6d9c9b[_0x8a38('0x8a')],_0x6d9c9b[_0x8a38('0x9b')],_0x17dd49,_0x4ab576);})[_0x8a38('0x28')](function(_0x54ad9b){_0x2cdc34=_0x54ad9b;return getCall(_0x5ca051,_0x27c55a,_0x188b5a,_0x17dd49,_0x2cdc34,_0x4ab576,_0x6d9c9b,_0x8a38('0x78'));})[_0x8a38('0x28')](function(_0x2b6c12){if(_0x2b6c12){logger[_0x8a38('0x35')](_0x8a38('0x8b'),_0x2b6c12['id']);}})[_0x8a38('0x2b')](function(_0xf53bc8){logger['error']('['+_0x6d9c9b[_0x8a38('0x68')][_0x8a38('0x9a')]()+']',JSON[_0x8a38('0xd')](_0xf53bc8));});}; \ 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 193dbe7..82bf69c 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 _0xc902=['error','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','trigger','data2','data3','render'];(function(_0x23895f,_0x43e4a9){var _0x39cfc9=function(_0x72a423){while(--_0x72a423){_0x23895f['push'](_0x23895f['shift']());}};_0x39cfc9(++_0x43e4a9);}(_0xc902,0x1d0));var _0x2c90=function(_0x330701,_0x2736b4){_0x330701=_0x330701-0x0;var _0x1cbd6f=_0xc902[_0x330701];return _0x1cbd6f;};'use strict';var util=require(_0x2c90('0x0'));var sh=require(_0x2c90('0x1'));var Mustache=require('mustache');var logger=require('../../../../config/logger')(_0x2c90('0x2'));exports['exec']=function(_0x304ac1,_0x266aec){var _0x44394c=_0x304ac1[_0x2c90('0x3')]?_0x304ac1['data2']:'Script';var _0x354964=_0x304ac1[_0x2c90('0x4')]?Mustache[_0x2c90('0x5')](_0x304ac1[_0x2c90('0x4')],_0x266aec):_0x266aec;sh['exec'](_0x354964,function(_0x4f2ee9,_0x2db13d,_0x21fe96){if(_0x4f2ee9!==0x0){logger[_0x2c90('0x6')](util['format'](_0x2c90('0x7'),_0x44394c,_0x354964,_0x4f2ee9,_0x21fe96));}else{logger[_0x2c90('0x8')](util['format'](_0x2c90('0x9'),_0x44394c,_0x354964,_0x2db13d));}});}; \ No newline at end of file +var _0x319a=['exec','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','mustache','trigger','data2','Script','data3','render'];(function(_0x5e1902,_0x1e03ea){var _0x1fd394=function(_0x1df6ab){while(--_0x1df6ab){_0x5e1902['push'](_0x5e1902['shift']());}};_0x1fd394(++_0x1e03ea);}(_0x319a,0x186));var _0xa319=function(_0x34e60b,_0x224451){_0x34e60b=_0x34e60b-0x0;var _0x17b648=_0x319a[_0x34e60b];return _0x17b648;};'use strict';var util=require('util');var sh=require('shelljs');var Mustache=require(_0xa319('0x0'));var logger=require('../../../../config/logger')(_0xa319('0x1'));exports['exec']=function(_0x3efda6,_0x1af789){var _0x334521=_0x3efda6['data2']?_0x3efda6[_0xa319('0x2')]:_0xa319('0x3');var _0x2de5a7=_0x3efda6[_0xa319('0x4')]?Mustache[_0xa319('0x5')](_0x3efda6[_0xa319('0x4')],_0x1af789):_0x1af789;sh[_0xa319('0x6')](_0x2de5a7,function(_0x1159a7,_0x2fa8ad,_0x6b73ea){if(_0x1159a7!==0x0){logger['error'](util[_0xa319('0x7')](_0xa319('0x8'),_0x334521,_0x2de5a7,_0x1159a7,_0x6b73ea));}else{logger[_0xa319('0x9')](util[_0xa319('0x7')](_0xa319('0xa'),_0x334521,_0x2de5a7,_0x2fa8ad));}});}; \ 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 196ac6c..353f81c 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 _0x42ef=['statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util','lodash','mustache','../../../../config/logger','exec','data1','render','data2','data5','number','headers','data6','parse','error','toUpperCase','GET','DELETE','PUT','data7','stack','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','body','format','stringify','then','isNil',',\x20request\x20body:\x20','info','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s'];(function(_0x465f17,_0x49fb97){var _0x2a2573=function(_0x3eb0a5){while(--_0x3eb0a5){_0x465f17['push'](_0x465f17['shift']());}};_0x2a2573(++_0x49fb97);}(_0x42ef,0x140));var _0xf42e=function(_0x3eff05,_0x3f517e){_0x3eff05=_0x3eff05-0x0;var _0x56fc9e=_0x42ef[_0x3eff05];return _0x56fc9e;};'use strict';var rp=require(_0xf42e('0x0'));var util=require(_0xf42e('0x1'));var _=require(_0xf42e('0x2'));var Mustache=require(_0xf42e('0x3'));var logger=require(_0xf42e('0x4'))('trigger');exports[_0xf42e('0x5')]=function(_0x465042,_0x322c8f){var _0x2b63fe,_0x2ae11c;var _0x514643={'method':_0x465042[_0xf42e('0x6')]['toUpperCase'](),'uri':Mustache[_0xf42e('0x7')](_0x465042[_0xf42e('0x8')],_0x322c8f),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x465042[_0xf42e('0x9')])===_0xf42e('0xa')&&parseInt(_0x465042['data5'])>=0x1&&parseInt(_0x465042[_0xf42e('0x9')])<=0xa?parseInt(_0x465042['data5'])*0x3e8:0x5*0x3e8};try{_0x514643[_0xf42e('0xb')]=_0x465042[_0xf42e('0xc')]?JSON[_0xf42e('0xd')](Mustache[_0xf42e('0x7')](_0x465042[_0xf42e('0xc')],_0x322c8f)):{};}catch(_0x26ec0e){logger[_0xf42e('0xe')](_0x26ec0e['stack']);}switch(_0x465042['data1'][_0xf42e('0xf')]()){case _0xf42e('0x10'):case _0xf42e('0x11'):_0x2b63fe=null;_0x514643['qs']=_0x322c8f;break;case'POST':case _0xf42e('0x12'):if(_0x465042[_0xf42e('0x13')]){try{_0x2b63fe=JSON['parse'](Mustache[_0xf42e('0x7')](_0x465042[_0xf42e('0x13')],_0x322c8f));_0x514643['body']=_0x2b63fe;}catch(_0x43f148){logger['error'](_0x43f148[_0xf42e('0x14')]);logger[_0xf42e('0xe')](_0xf42e('0x15'));}}else{_0x2b63fe=_0x322c8f;_0x514643[_0xf42e('0x16')]=_0x2b63fe;}break;}logger['info'](util[_0xf42e('0x17')]('%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s',_0x465042['data1'],_0x465042[_0xf42e('0x8')],JSON[_0xf42e('0x18')](_0x514643)));rp(_0x514643)[_0xf42e('0x19')](function(_0x78c981){_0x2b63fe=!_[_0xf42e('0x1a')](_0x2b63fe)?_0xf42e('0x1b')+_0x2b63fe:'';_0x2ae11c=typeof _0x78c981[_0xf42e('0x16')]==='object'?JSON[_0xf42e('0x18')](_0x78c981[_0xf42e('0x16')]):_0x78c981[_0xf42e('0x16')];logger[_0xf42e('0x1c')](util[_0xf42e('0x17')](_0xf42e('0x1d'),_0x465042[_0xf42e('0x6')],_0x465042[_0xf42e('0x8')],_0x78c981[_0xf42e('0x1e')],_0x2ae11c));})[_0xf42e('0x1f')](function(_0x15bf29){logger['error'](util[_0xf42e('0x17')](_0xf42e('0x20'),_0x465042[_0xf42e('0x6')],_0x465042[_0xf42e('0x8')],_0x15bf29[_0xf42e('0x1e')],_0x15bf29[_0xf42e('0x21')],_0x15bf29[_0xf42e('0x22')]));});}; \ No newline at end of file +var _0x911b=['data1','stringify','then','isNil',',\x20request\x20body:\x20','object','statusCode','catch','name','message','util','lodash','mustache','../../../../config/logger','trigger','exec','toUpperCase','data2','data5','number','headers','data6','parse','error','stack','GET','POST','data7','render','body','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s'];(function(_0x29b489,_0x665c40){var _0x3a0d34=function(_0x3cfade){while(--_0x3cfade){_0x29b489['push'](_0x29b489['shift']());}};_0x3a0d34(++_0x665c40);}(_0x911b,0x10a));var _0xb911=function(_0x4787cf,_0x1bc77f){_0x4787cf=_0x4787cf-0x0;var _0x492716=_0x911b[_0x4787cf];return _0x492716;};'use strict';var rp=require('request-promise');var util=require(_0xb911('0x0'));var _=require(_0xb911('0x1'));var Mustache=require(_0xb911('0x2'));var logger=require(_0xb911('0x3'))(_0xb911('0x4'));exports[_0xb911('0x5')]=function(_0x39c90b,_0x13555e){var _0x4bce0e,_0x4a8e56;var _0x28c9bd={'method':_0x39c90b['data1'][_0xb911('0x6')](),'uri':Mustache['render'](_0x39c90b[_0xb911('0x7')],_0x13555e),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x39c90b[_0xb911('0x8')])===_0xb911('0x9')&&parseInt(_0x39c90b[_0xb911('0x8')])>=0x1&&parseInt(_0x39c90b[_0xb911('0x8')])<=0xa?parseInt(_0x39c90b[_0xb911('0x8')])*0x3e8:0x5*0x3e8};try{_0x28c9bd[_0xb911('0xa')]=_0x39c90b[_0xb911('0xb')]?JSON[_0xb911('0xc')](Mustache['render'](_0x39c90b[_0xb911('0xb')],_0x13555e)):{};}catch(_0x59b35b){logger[_0xb911('0xd')](_0x59b35b[_0xb911('0xe')]);}switch(_0x39c90b['data1'][_0xb911('0x6')]()){case _0xb911('0xf'):case'DELETE':_0x4bce0e=null;_0x28c9bd['qs']=_0x13555e;break;case _0xb911('0x10'):case'PUT':if(_0x39c90b[_0xb911('0x11')]){try{_0x4bce0e=JSON[_0xb911('0xc')](Mustache[_0xb911('0x12')](_0x39c90b[_0xb911('0x11')],_0x13555e));_0x28c9bd[_0xb911('0x13')]=_0x4bce0e;}catch(_0x423a2f){logger[_0xb911('0xd')](_0x423a2f['stack']);logger[_0xb911('0xd')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x4bce0e=_0x13555e;_0x28c9bd[_0xb911('0x13')]=_0x4bce0e;}break;}logger['info'](util[_0xb911('0x14')](_0xb911('0x15'),_0x39c90b[_0xb911('0x16')],_0x39c90b[_0xb911('0x7')],JSON[_0xb911('0x17')](_0x28c9bd)));rp(_0x28c9bd)[_0xb911('0x18')](function(_0x585fbb){_0x4bce0e=!_[_0xb911('0x19')](_0x4bce0e)?_0xb911('0x1a')+_0x4bce0e:'';_0x4a8e56=typeof _0x585fbb['body']===_0xb911('0x1b')?JSON[_0xb911('0x17')](_0x585fbb[_0xb911('0x13')]):_0x585fbb['body'];logger['info'](util[_0xb911('0x14')]('%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s',_0x39c90b[_0xb911('0x16')],_0x39c90b[_0xb911('0x7')],_0x585fbb[_0xb911('0x1c')],_0x4a8e56));})[_0xb911('0x1d')](function(_0x59a0d5){logger[_0xb911('0xd')](util[_0xb911('0x14')]('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x39c90b[_0xb911('0x16')],_0x39c90b[_0xb911('0x7')],_0x59a0d5['statusCode'],_0x59a0d5[_0xb911('0x1e')],_0x59a0d5[_0xb911('0x1f')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 420714e..c4c1787 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 _0xa376=['routing','error','message','result','../../config/logger','client','http','request','then','debug','rpc'];(function(_0x5495fc,_0x268c40){var _0x1c549e=function(_0x11ccb8){while(--_0x11ccb8){_0x5495fc['push'](_0x5495fc['shift']());}};_0x1c549e(++_0x268c40);}(_0xa376,0x88));var _0x6a37=function(_0x4002d9,_0x5811b3){_0x4002d9=_0x4002d9-0x0;var _0xb531e0=_0xa376[_0x4002d9];return _0xb531e0;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0x6a37('0x0'))('routing');var client=jayson[_0x6a37('0x1')][_0x6a37('0x2')]({'port':0x2329});client['Request']=function(_0x57e051,_0x1d8dd8){return new BPromise(function(_0x3d0e2d,_0x3dd153){return client[_0x6a37('0x3')](_0x57e051,_0x1d8dd8)[_0x6a37('0x4')](function(_0x58a562){logger[_0x6a37('0x5')](_0x6a37('0x6'),_0x6a37('0x7'),_0x57e051,_0x1d8dd8,_0x58a562);if(_0x58a562[_0x6a37('0x8')]){logger[_0x6a37('0x8')](_0x6a37('0x6'),_0x6a37('0x7'),_0x57e051,_0x58a562['error'][_0x6a37('0x9')],_0x1d8dd8);return _0x3dd153(_0x58a562['error']['message']);}else{return _0x3d0e2d(_0x58a562[_0x6a37('0xa')]);}})['catch'](function(_0x57b211){logger['error']('rpc',_0x6a37('0x7'),_0x57e051,_0x57b211,_0x1d8dd8);return _0x3dd153(_0x57b211);});});};module['exports']=client; \ No newline at end of file +var _0xbbf9=['then','debug','rpc','error','message','result','catch','exports','jayson/promise','bluebird','../../config/logger','routing','http','Request','request'];(function(_0x3664d2,_0x415f26){var _0xf67f7d=function(_0xc9974c){while(--_0xc9974c){_0x3664d2['push'](_0x3664d2['shift']());}};_0xf67f7d(++_0x415f26);}(_0xbbf9,0xda));var _0x9bbf=function(_0x134bd1,_0x1b0e11){_0x134bd1=_0x134bd1-0x0;var _0x37c45a=_0xbbf9[_0x134bd1];return _0x37c45a;};'use strict';var jayson=require(_0x9bbf('0x0'));var BPromise=require(_0x9bbf('0x1'));var logger=require(_0x9bbf('0x2'))(_0x9bbf('0x3'));var client=jayson['client'][_0x9bbf('0x4')]({'port':0x2329});client[_0x9bbf('0x5')]=function(_0x952493,_0xd7d2a2){return new BPromise(function(_0x1e77d5,_0x184a75){return client[_0x9bbf('0x6')](_0x952493,_0xd7d2a2)[_0x9bbf('0x7')](function(_0x34c22a){logger[_0x9bbf('0x8')](_0x9bbf('0x9'),'routing',_0x952493,_0xd7d2a2,_0x34c22a);if(_0x34c22a[_0x9bbf('0xa')]){logger[_0x9bbf('0xa')](_0x9bbf('0x9'),_0x9bbf('0x3'),_0x952493,_0x34c22a[_0x9bbf('0xa')]['message'],_0xd7d2a2);return _0x184a75(_0x34c22a[_0x9bbf('0xa')][_0x9bbf('0xb')]);}else{return _0x1e77d5(_0x34c22a[_0x9bbf('0xc')]);}})[_0x9bbf('0xd')](function(_0x225c36){logger['error'](_0x9bbf('0x9'),_0x9bbf('0x3'),_0x952493,_0x225c36,_0xd7d2a2);return _0x184a75(_0x225c36);});});};module[_0x9bbf('0xe')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 55b9a64..78d4b03 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 _0x238b=['./lib/email','./rpc/setting','../../config/logger','email','resolve','then','initMailAccounts','mailAccounts','listen','getSettings','loginMailFrequency','catch','error','Email\x20service\x20initialization','./server','./realtime'];(function(_0x114ea7,_0x231dd2){var _0x352c7a=function(_0x20775a){while(--_0x20775a){_0x114ea7['push'](_0x114ea7['shift']());}};_0x352c7a(++_0x231dd2);}(_0x238b,0x13e));var _0xb238=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x238b[_0x20a584];return _0x4b41a8;};'use strict';var server=require(_0xb238('0x0'));var Realtime=require(_0xb238('0x1'));var EmailChannel=require(_0xb238('0x2'));var mailAccount=require('./rpc/mailAccount');var setting=require(_0xb238('0x3'));var logger=require(_0xb238('0x4'))(_0xb238('0x5'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0xb238('0x6')]()['then'](mailAccount['getMailAccounts']())[_0xb238('0x7')](realtime[_0xb238('0x8')]())[_0xb238('0x7')](function(){email['refresh'](realtime[_0xb238('0x9')]);return realtime;});}function main(){return server[_0xb238('0xa')](realtime,email)[_0xb238('0x7')](function(){return initRealtime();})[_0xb238('0x7')](function(){return setting[_0xb238('0xb')]();})[_0xb238('0x7')](function(_0x46dfdc){return setInterval(initRealtime,_0x46dfdc[_0xb238('0xc')]*0x3e8);})[_0xb238('0xd')](function(_0x3657db){logger[_0xb238('0xe')](_0xb238('0xf'),_0x3657db);});}main(); \ No newline at end of file +var _0xe353=['getMailAccounts','initMailAccounts','mailAccounts','listen','getSettings','loginMailFrequency','catch','Email\x20service\x20initialization','./server','./lib/email','./rpc/mailAccount','./rpc/setting','email','then'];(function(_0x2dc1cf,_0x32443f){var _0x473fbb=function(_0xfed4d6){while(--_0xfed4d6){_0x2dc1cf['push'](_0x2dc1cf['shift']());}};_0x473fbb(++_0x32443f);}(_0xe353,0x86));var _0x3e35=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0xe353[_0xbd08b4];return _0x314f1e;};'use strict';var server=require(_0x3e35('0x0'));var Realtime=require('./realtime');var EmailChannel=require(_0x3e35('0x1'));var mailAccount=require(_0x3e35('0x2'));var setting=require(_0x3e35('0x3'));var logger=require('../../config/logger')(_0x3e35('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise['resolve']()[_0x3e35('0x5')](mailAccount[_0x3e35('0x6')]())[_0x3e35('0x5')](realtime[_0x3e35('0x7')]())[_0x3e35('0x5')](function(){email['refresh'](realtime[_0x3e35('0x8')]);return realtime;});}function main(){return server[_0x3e35('0x9')](realtime,email)[_0x3e35('0x5')](function(){return initRealtime();})['then'](function(){return setting[_0x3e35('0xa')]();})[_0x3e35('0x5')](function(_0x44f23c){return setInterval(initRealtime,_0x44f23c[_0x3e35('0xb')]*0x3e8);})[_0x3e35('0xc')](function(_0x4e1bf0){logger['error'](_0x3e35('0xd'),_0x4e1bf0);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 7905689..425f1d2 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 _0x15fd=['handleImapEnd','error','handleImapError','disabled','connected','messages','handleImapEmail','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','from','notify','then','Mail\x20accepted\x20from\x20routing','Mail\x20not\x20accepted\x20from\x20routing\x20%s','sendMail','verifySmtp','Smtp','lastSync','verify','verified','lodash','moment','bluebird','md5','ioredis','../../../config/environment','../../../config/logger','email','redis','defaults','localhost','./imap','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','name','Imap','status','messageStatus','total','isNil','stringify','mailAccount:update','refresh','hasOwnProperty','service','provider','box','handleImapBox','bind'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x15fd,0x1d4));var _0xd15f=function(_0x2c9237,_0x233838){_0x2c9237=_0x2c9237-0x0;var _0x113879=_0x15fd[_0x2c9237];return _0x113879;};'use strict';var _=require(_0xd15f('0x0'));var moment=require(_0xd15f('0x1'));var BPromise=require(_0xd15f('0x2'));var md5=require(_0xd15f('0x3'));var Redis=require(_0xd15f('0x4'));var config=require(_0xd15f('0x5'));var logger=require(_0xd15f('0x6'))(_0xd15f('0x7'));config[_0xd15f('0x8')]=_[_0xd15f('0x9')](config['redis'],{'host':_0xd15f('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var EmailImap=require(_0xd15f('0xb'));var EmailSmtp=require(_0xd15f('0xc'));var mailAccount=require(_0xd15f('0xd'));var md5Accounts={};function EmailChannel(_0x33ba78){logger[_0xd15f('0xe')](_0xd15f('0xf'));this[_0xd15f('0x10')]=_0x33ba78[_0xd15f('0x10')];this[_0xd15f('0x11')]={};this[_0xd15f('0x12')]=new EmailSmtp();}EmailChannel[_0xd15f('0x13')][_0xd15f('0x14')]=function(_0x559f60){var _0x4c5071=this[_0xd15f('0x10')][_0x559f60];var _0x4ca80a={'id':_0x4c5071['id'],'name':_0x4c5071[_0xd15f('0x15')],'key':_0x4c5071['key'],'active':_0x4c5071['active'],'Imap':{'status':_0x4c5071[_0xd15f('0x16')][_0xd15f('0x17')],'messageStatus':_0x4c5071[_0xd15f('0x16')][_0xd15f('0x18')],'total':_0x4c5071[_0xd15f('0x16')][_0xd15f('0x19')]}};if(_[_0xd15f('0x1a')](md5Accounts[_0x559f60])){md5Accounts[_0x559f60]={};}var _0x4e4ca9=md5(JSON[_0xd15f('0x1b')](_0x4ca80a));if(md5Accounts[_0x559f60][_0xd15f('0x3')]!==_0x4e4ca9){md5Accounts[_0x559f60][_0xd15f('0x3')]=_0x4e4ca9;io[_0xd15f('0x14')](_0xd15f('0x1c'),_0x4ca80a);}};EmailChannel['prototype'][_0xd15f('0x1d')]=function(_0x4cd4d9){for(var _0x36fc54 in _0x4cd4d9){if(_0x4cd4d9[_0xd15f('0x1e')](_0x36fc54)){if(_0x4cd4d9[_0x36fc54][_0xd15f('0x16')]&&_0x4cd4d9[_0x36fc54]['active']){var _0x13cce3=_0x4cd4d9[_0x36fc54]['Imap'];if(!_0x13cce3[_0xd15f('0x1f')])_0x13cce3[_0xd15f('0x1f')]=_0x4cd4d9[_0x36fc54][_0xd15f('0x20')];if(!this[_0xd15f('0x11')]['hasOwnProperty'](_0x13cce3['id'])){this[_0xd15f('0x11')][_0x13cce3['id']]=new EmailImap(_0x13cce3,_0x4cd4d9[_0x36fc54][_0xd15f('0x7')]);this[_0xd15f('0x11')][_0x13cce3['id']]['on'](_0xd15f('0x21'),this[_0xd15f('0x22')][_0xd15f('0x23')](this,_0x36fc54));this['imapAccounts'][_0x13cce3['id']]['on'](_0xd15f('0x7'),this['handleImapEmail']['bind'](this,_0x36fc54));this['imapAccounts'][_0x13cce3['id']]['on']('end',this[_0xd15f('0x24')][_0xd15f('0x23')](this,_0x36fc54));this[_0xd15f('0x11')][_0x13cce3['id']]['on'](_0xd15f('0x25'),this[_0xd15f('0x26')]['bind'](this,_0x36fc54));}}else{if(_['isNil'](this[_0xd15f('0x10')][_0x36fc54][_0xd15f('0x16')])){this[_0xd15f('0x10')][_0x36fc54][_0xd15f('0x16')]={};}this[_0xd15f('0x10')][_0x36fc54][_0xd15f('0x16')][_0xd15f('0x17')]=_0xd15f('0x27');this[_0xd15f('0x10')][_0x36fc54][_0xd15f('0x16')]['messageStatus']='';this[_0xd15f('0x14')](_0x36fc54);}}}};EmailChannel[_0xd15f('0x13')][_0xd15f('0x22')]=function(_0x5101c2,_0x5eae05){if(this[_0xd15f('0x10')][_0x5101c2]){this[_0xd15f('0x10')][_0x5101c2][_0xd15f('0x16')][_0xd15f('0x17')]=_0xd15f('0x28');this[_0xd15f('0x10')][_0x5101c2]['Imap']['messageStatus']=_0x5eae05[_0xd15f('0x15')];if(_0x5eae05[_0xd15f('0x29')]){this[_0xd15f('0x10')][_0x5101c2][_0xd15f('0x16')][_0xd15f('0x19')]=_0x5eae05[_0xd15f('0x29')][_0xd15f('0x19')];}return this[_0xd15f('0x14')](_0x5101c2);}};EmailChannel['prototype'][_0xd15f('0x2a')]=function(_0x417667,_0x3d0855){logger['info'](_0xd15f('0x2b'),_0x3d0855[_0xd15f('0x2c')],_0x3d0855['lastName'],_0x3d0855[_0xd15f('0x2d')],_0x417667);if(this['mailAccounts'][_0x417667]){return mailAccount[_0xd15f('0x2e')](_0x417667,_0x3d0855)[_0xd15f('0x2f')](function(_0x1f2907){if(_0x1f2907){logger[_0xd15f('0xe')](_0xd15f('0x30'));}})['catch'](function(_0x47b7ac){logger[_0xd15f('0x25')](_0xd15f('0x31'),JSON[_0xd15f('0x1b')](_0x47b7ac));});}};EmailChannel[_0xd15f('0x13')][_0xd15f('0x24')]=function(_0x578e1b){if(this['mailAccounts'][_0x578e1b]&&this['mailAccounts'][_0x578e1b][_0xd15f('0x16')]){if(this[_0xd15f('0x11')][this[_0xd15f('0x10')][_0x578e1b][_0xd15f('0x16')]['id']]){delete this[_0xd15f('0x11')][this['mailAccounts'][_0x578e1b][_0xd15f('0x16')]['id']];}this[_0xd15f('0x10')][_0x578e1b][_0xd15f('0x16')]['lastSync']=moment();this[_0xd15f('0x14')](_0x578e1b);}};EmailChannel[_0xd15f('0x13')][_0xd15f('0x26')]=function(_0xa36879,_0x24a98f){if(this[_0xd15f('0x10')][_0xa36879]){this[_0xd15f('0x10')][_0xa36879]['Imap'][_0xd15f('0x17')]=_0xd15f('0x25');this[_0xd15f('0x10')][_0xa36879][_0xd15f('0x16')][_0xd15f('0x18')]=_0x24a98f;return this[_0xd15f('0x14')](_0xa36879);}};EmailChannel[_0xd15f('0x13')][_0xd15f('0x32')]=function(_0x3b701d,_0x4ab0af){return this['smtp']['send'](_0x3b701d,_0x4ab0af);};EmailChannel['prototype'][_0xd15f('0x33')]=function(_0x129a6b){var _0x5f454b=this;if(this[_0xd15f('0x10')][_0x129a6b['id']]){if(_['isNil'](this['mailAccounts'][_0x129a6b['id']]['Smtp'])){this[_0xd15f('0x10')][_0x129a6b['id']][_0xd15f('0x34')]={};}this[_0xd15f('0x10')][_0x129a6b['id']]['Smtp'][_0xd15f('0x35')]=moment();return new BPromise(function(_0x1e8eca,_0x4828c3){return _0x5f454b[_0xd15f('0x12')][_0xd15f('0x36')](_0x129a6b)[_0xd15f('0x2f')](function(_0x3c74cc){_0x5f454b[_0xd15f('0x10')][_0x129a6b['id']][_0xd15f('0x34')][_0xd15f('0x17')]=_0xd15f('0x37');_0x5f454b[_0xd15f('0x10')][_0x129a6b['id']][_0xd15f('0x34')][_0xd15f('0x18')]='';_0x5f454b[_0xd15f('0x14')](_0x129a6b['id']);_0x1e8eca(_0x3c74cc);})['catch'](function(_0x255f63){_0x5f454b[_0xd15f('0x10')][_0x129a6b['id']][_0xd15f('0x34')][_0xd15f('0x17')]=_0xd15f('0x25');_0x5f454b[_0xd15f('0x10')][_0x129a6b['id']][_0xd15f('0x34')][_0xd15f('0x18')]=_0x255f63;_0x5f454b['emit'](_0x129a6b['id']);_0x4828c3(_0x255f63);});});}return this[_0xd15f('0x12')]['verify'](_0x129a6b);};module['exports']=EmailChannel; \ No newline at end of file +var _0x68b7=['stringify','mailAccount:update','refresh','hasOwnProperty','service','provider','handleImapBox','bind','handleImapEmail','end','error','handleImapError','disabled','connected','name','messages','firstName','lastName','notify','then','Mail\x20accepted\x20from\x20routing','Mail\x20not\x20accepted\x20from\x20routing\x20%s','handleImapEnd','lastSync','send','verifySmtp','Smtp','verify','catch','exports','lodash','bluebird','md5','ioredis','../../../config/logger','email','redis','localhost','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','info','mailAccounts','imapAccounts','smtp','prototype','emit','key','active','Imap','status','messageStatus','total','isNil'];(function(_0x5ee487,_0x4042b4){var _0x160308=function(_0x36b1f3){while(--_0x36b1f3){_0x5ee487['push'](_0x5ee487['shift']());}};_0x160308(++_0x4042b4);}(_0x68b7,0x8c));var _0x768b=function(_0x7c7e9f,_0x5d4a01){_0x7c7e9f=_0x7c7e9f-0x0;var _0x34a645=_0x68b7[_0x7c7e9f];return _0x34a645;};'use strict';var _=require(_0x768b('0x0'));var moment=require('moment');var BPromise=require(_0x768b('0x1'));var md5=require(_0x768b('0x2'));var Redis=require(_0x768b('0x3'));var config=require('../../../config/environment');var logger=require(_0x768b('0x4'))(_0x768b('0x5'));config[_0x768b('0x6')]=_['defaults'](config[_0x768b('0x6')],{'host':_0x768b('0x7'),'port':0x18eb});var io=require(_0x768b('0x8'))(new Redis(config[_0x768b('0x6')]));var EmailImap=require(_0x768b('0x9'));var EmailSmtp=require(_0x768b('0xa'));var mailAccount=require(_0x768b('0xb'));var md5Accounts={};function EmailChannel(_0x48405c){logger[_0x768b('0xc')]('start\x20email\x20channel');this[_0x768b('0xd')]=_0x48405c[_0x768b('0xd')];this[_0x768b('0xe')]={};this[_0x768b('0xf')]=new EmailSmtp();}EmailChannel[_0x768b('0x10')][_0x768b('0x11')]=function(_0x494750){var _0x3ab8a9=this[_0x768b('0xd')][_0x494750];var _0x4c1e26={'id':_0x3ab8a9['id'],'name':_0x3ab8a9['name'],'key':_0x3ab8a9[_0x768b('0x12')],'active':_0x3ab8a9[_0x768b('0x13')],'Imap':{'status':_0x3ab8a9[_0x768b('0x14')][_0x768b('0x15')],'messageStatus':_0x3ab8a9[_0x768b('0x14')][_0x768b('0x16')],'total':_0x3ab8a9[_0x768b('0x14')][_0x768b('0x17')]}};if(_[_0x768b('0x18')](md5Accounts[_0x494750])){md5Accounts[_0x494750]={};}var _0x4cff45=md5(JSON[_0x768b('0x19')](_0x4c1e26));if(md5Accounts[_0x494750][_0x768b('0x2')]!==_0x4cff45){md5Accounts[_0x494750][_0x768b('0x2')]=_0x4cff45;io[_0x768b('0x11')](_0x768b('0x1a'),_0x4c1e26);}};EmailChannel['prototype'][_0x768b('0x1b')]=function(_0xbdef19){for(var _0x25819e in _0xbdef19){if(_0xbdef19[_0x768b('0x1c')](_0x25819e)){if(_0xbdef19[_0x25819e][_0x768b('0x14')]&&_0xbdef19[_0x25819e][_0x768b('0x13')]){var _0x18c06d=_0xbdef19[_0x25819e][_0x768b('0x14')];if(!_0x18c06d[_0x768b('0x1d')])_0x18c06d[_0x768b('0x1d')]=_0xbdef19[_0x25819e][_0x768b('0x1e')];if(!this[_0x768b('0xe')]['hasOwnProperty'](_0x18c06d['id'])){this['imapAccounts'][_0x18c06d['id']]=new EmailImap(_0x18c06d,_0xbdef19[_0x25819e][_0x768b('0x5')]);this[_0x768b('0xe')][_0x18c06d['id']]['on']('box',this[_0x768b('0x1f')][_0x768b('0x20')](this,_0x25819e));this['imapAccounts'][_0x18c06d['id']]['on'](_0x768b('0x5'),this[_0x768b('0x21')][_0x768b('0x20')](this,_0x25819e));this[_0x768b('0xe')][_0x18c06d['id']]['on'](_0x768b('0x22'),this['handleImapEnd']['bind'](this,_0x25819e));this[_0x768b('0xe')][_0x18c06d['id']]['on'](_0x768b('0x23'),this[_0x768b('0x24')][_0x768b('0x20')](this,_0x25819e));}}else{if(_[_0x768b('0x18')](this[_0x768b('0xd')][_0x25819e][_0x768b('0x14')])){this[_0x768b('0xd')][_0x25819e][_0x768b('0x14')]={};}this[_0x768b('0xd')][_0x25819e][_0x768b('0x14')][_0x768b('0x15')]=_0x768b('0x25');this[_0x768b('0xd')][_0x25819e]['Imap'][_0x768b('0x16')]='';this['emit'](_0x25819e);}}}};EmailChannel['prototype']['handleImapBox']=function(_0x4ce2d4,_0x3d8705){if(this[_0x768b('0xd')][_0x4ce2d4]){this['mailAccounts'][_0x4ce2d4][_0x768b('0x14')]['status']=_0x768b('0x26');this['mailAccounts'][_0x4ce2d4][_0x768b('0x14')][_0x768b('0x16')]=_0x3d8705[_0x768b('0x27')];if(_0x3d8705[_0x768b('0x28')]){this['mailAccounts'][_0x4ce2d4]['Imap']['total']=_0x3d8705[_0x768b('0x28')][_0x768b('0x17')];}return this[_0x768b('0x11')](_0x4ce2d4);}};EmailChannel[_0x768b('0x10')]['handleImapEmail']=function(_0x42aeb2,_0x293ffd){logger['info']('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x293ffd[_0x768b('0x29')],_0x293ffd[_0x768b('0x2a')],_0x293ffd['from'],_0x42aeb2);if(this[_0x768b('0xd')][_0x42aeb2]){return mailAccount[_0x768b('0x2b')](_0x42aeb2,_0x293ffd)[_0x768b('0x2c')](function(_0x2fe13b){if(_0x2fe13b){logger[_0x768b('0xc')](_0x768b('0x2d'));}})['catch'](function(_0x61f53f){logger[_0x768b('0x23')](_0x768b('0x2e'),JSON['stringify'](_0x61f53f));});}};EmailChannel[_0x768b('0x10')][_0x768b('0x2f')]=function(_0x28cd27){if(this['mailAccounts'][_0x28cd27]&&this['mailAccounts'][_0x28cd27][_0x768b('0x14')]){if(this[_0x768b('0xe')][this[_0x768b('0xd')][_0x28cd27][_0x768b('0x14')]['id']]){delete this[_0x768b('0xe')][this['mailAccounts'][_0x28cd27][_0x768b('0x14')]['id']];}this[_0x768b('0xd')][_0x28cd27][_0x768b('0x14')][_0x768b('0x30')]=moment();this[_0x768b('0x11')](_0x28cd27);}};EmailChannel[_0x768b('0x10')][_0x768b('0x24')]=function(_0x6974ab,_0x1edba0){if(this['mailAccounts'][_0x6974ab]){this[_0x768b('0xd')][_0x6974ab][_0x768b('0x14')][_0x768b('0x15')]=_0x768b('0x23');this[_0x768b('0xd')][_0x6974ab]['Imap'][_0x768b('0x16')]=_0x1edba0;return this[_0x768b('0x11')](_0x6974ab);}};EmailChannel['prototype']['sendMail']=function(_0x49be74,_0x5145c8){return this[_0x768b('0xf')][_0x768b('0x31')](_0x49be74,_0x5145c8);};EmailChannel[_0x768b('0x10')][_0x768b('0x32')]=function(_0x307906){var _0x5c4ae9=this;if(this[_0x768b('0xd')][_0x307906['id']]){if(_['isNil'](this['mailAccounts'][_0x307906['id']][_0x768b('0x33')])){this[_0x768b('0xd')][_0x307906['id']][_0x768b('0x33')]={};}this[_0x768b('0xd')][_0x307906['id']][_0x768b('0x33')][_0x768b('0x30')]=moment();return new BPromise(function(_0x1f5735,_0x213919){return _0x5c4ae9['smtp'][_0x768b('0x34')](_0x307906)[_0x768b('0x2c')](function(_0x65c80d){_0x5c4ae9[_0x768b('0xd')][_0x307906['id']][_0x768b('0x33')]['status']='verified';_0x5c4ae9['mailAccounts'][_0x307906['id']][_0x768b('0x33')][_0x768b('0x16')]='';_0x5c4ae9[_0x768b('0x11')](_0x307906['id']);_0x1f5735(_0x65c80d);})[_0x768b('0x35')](function(_0xc08652){_0x5c4ae9[_0x768b('0xd')][_0x307906['id']][_0x768b('0x33')]['status']='error';_0x5c4ae9[_0x768b('0xd')][_0x307906['id']][_0x768b('0x33')][_0x768b('0x16')]=_0xc08652;_0x5c4ae9[_0x768b('0x11')](_0x307906['id']);_0x213919(_0xc08652);});});}return this[_0x768b('0xf')][_0x768b('0x34')](_0x307906);};module[_0x768b('0x36')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 77aeda3..abc986f 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 _0x53ec=['modernAuthentication','xoauth2','generateXOAuth2Token','CloudProvider','data5','getHost','service','email','openBox','handleOpenBox','emit','readUnseen','handleCloseBox','end','search','UNSEEN','handleReadUnseen','handleFetchMessage','handleFetchError','closeBox','body','handleMessageAttributes','handleMessageEnd','handleMessageBody','handleSimpleParser','parser','textCode','hasOwnProperty','upperFirst','exports','lodash','util','imap','mailparser','simpleParser','iconv','events','./utils','../../../config/logger','mailbox','INBOX','getAccount','account','once','ready','handleReady','bind','handleEnd','error','handleError','prototype','connTimeout','authTimeout','isNil','authentication','user','password','host','port','tls','autotls','required'];(function(_0x275d5f,_0x232fb5){var _0x1e66fc=function(_0x395d29){while(--_0x395d29){_0x275d5f['push'](_0x275d5f['shift']());}};_0x1e66fc(++_0x232fb5);}(_0x53ec,0x192));var _0xc53e=function(_0x2d9f30,_0x258111){_0x2d9f30=_0x2d9f30-0x0;var _0x243932=_0x53ec[_0x2d9f30];return _0x243932;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var Imap=require(_0xc53e('0x2'));var simpleParser=require(_0xc53e('0x3'))[_0xc53e('0x4')];var Iconv=require(_0xc53e('0x5'))['Iconv'];var EventEmitter=require(_0xc53e('0x6'))['EventEmitter'];var utils=require(_0xc53e('0x7'));var logger=require(_0xc53e('0x8'))('email');function EmailImap(_0x2f1414,_0x4f989b){this[_0xc53e('0x9')]=_0xc53e('0xa');this['account']=this[_0xc53e('0xb')](_0x2f1414,_0x4f989b);this[_0xc53e('0x2')]=new Imap(this[_0xc53e('0xc')]);this[_0xc53e('0x2')][_0xc53e('0xd')](_0xc53e('0xe'),this[_0xc53e('0xf')][_0xc53e('0x10')](this));this[_0xc53e('0x2')]['once']('end',this[_0xc53e('0x11')]['bind'](this));this['imap']['on'](_0xc53e('0x12'),this[_0xc53e('0x13')][_0xc53e('0x10')](this));this[_0xc53e('0x2')]['connect']();}util['inherits'](EmailImap,EventEmitter);EmailImap[_0xc53e('0x14')][_0xc53e('0xb')]=function(_0x7cd798,_0x3d2e17){var _0x358ef3={'connTimeout':_0x7cd798[_0xc53e('0x15')]?_0x7cd798[_0xc53e('0x15')]*0x3e8:0x2710,'authTimeout':_0x7cd798[_0xc53e('0x16')]?_0x7cd798[_0xc53e('0x16')]*0x3e8:0x1388};if(_[_0xc53e('0x17')](_0x7cd798['service'])){if(_0x7cd798[_0xc53e('0x18')]){_0x358ef3[_0xc53e('0x19')]=_0x7cd798[_0xc53e('0x19')];_0x358ef3[_0xc53e('0x1a')]=_0x7cd798[_0xc53e('0x1a')];}_0x358ef3[_0xc53e('0x1b')]=_0x7cd798[_0xc53e('0x1b')];_0x358ef3[_0xc53e('0x1c')]=_0x7cd798[_0xc53e('0x1c')]||0x3e1;if(_0x7cd798['tls']){_0x358ef3['tls']=!![];}else{_0x358ef3[_0xc53e('0x1d')]=![];_0x358ef3[_0xc53e('0x1e')]=_0xc53e('0x1f');}}else{if(_0x7cd798[_0xc53e('0x20')]){_0x358ef3[_0xc53e('0x21')]=utils[_0xc53e('0x22')](_0x7cd798[_0xc53e('0x23')][_0xc53e('0x24')],_0x7cd798[_0xc53e('0x19')]);_0x358ef3[_0xc53e('0x19')]=_0x7cd798[_0xc53e('0x19')];}else{_0x358ef3[_0xc53e('0x19')]=_0x7cd798[_0xc53e('0x19')];_0x358ef3['password']=_0x7cd798['password'];}_0x358ef3['host']=utils[_0xc53e('0x25')](_0x7cd798[_0xc53e('0x26')]);_0x358ef3[_0xc53e('0x1c')]=0x3e1;_0x358ef3[_0xc53e('0x1d')]=!![];}_0x358ef3[_0xc53e('0x27')]=_0x3d2e17||_0x7cd798['user']||'anonymous@xcally.com';return _0x358ef3;};EmailImap[_0xc53e('0x14')]['handleReady']=function(){this[_0xc53e('0x2')][_0xc53e('0x28')](this[_0xc53e('0x9')],![],this[_0xc53e('0x29')][_0xc53e('0x10')](this));};EmailImap['prototype'][_0xc53e('0x29')]=function(_0x4b9f6a,_0x4d9a68){if(_0x4b9f6a){this['handleError'](_0x4b9f6a,!![]);}else{this[_0xc53e('0x2a')]('box',_0x4d9a68);this[_0xc53e('0x2b')]();}};EmailImap['prototype'][_0xc53e('0x2c')]=function(_0x5112d2){if(_0x5112d2){this['handleError'](_0x5112d2,!![]);}else{this[_0xc53e('0x2')][_0xc53e('0x2d')]();}};EmailImap[_0xc53e('0x14')][_0xc53e('0x2b')]=function(){this[_0xc53e('0x2')][_0xc53e('0x2e')]([_0xc53e('0x2f')],this[_0xc53e('0x30')]['bind'](this));};EmailImap[_0xc53e('0x14')][_0xc53e('0x30')]=function(_0x2d36c0,_0x56206b){if(_0x2d36c0){this[_0xc53e('0x13')](_0x2d36c0,!![]);}else{if(_0x56206b['length']){try{var _0x4572e=this[_0xc53e('0x2')]['fetch'](_0x56206b,{'bodies':'','markSeen':!![]});_0x4572e['on']('message',this[_0xc53e('0x31')][_0xc53e('0x10')](this));_0x4572e[_0xc53e('0xd')](_0xc53e('0x12'),this[_0xc53e('0x32')][_0xc53e('0x10')](this));_0x4572e[_0xc53e('0xd')](_0xc53e('0x2d'),this['handleFetchEnd'][_0xc53e('0x10')](this));}catch(_0x3bae8a){logger[_0xc53e('0x12')](_0x3bae8a);}}else{this[_0xc53e('0x2')][_0xc53e('0x33')](!![],this[_0xc53e('0x2c')][_0xc53e('0x10')](this));}}};EmailImap[_0xc53e('0x14')][_0xc53e('0x31')]=function(_0x595efb){_0x595efb['on'](_0xc53e('0x34'),this['handleMessageBody'][_0xc53e('0x10')](this));_0x595efb[_0xc53e('0xd')]('attributes',this[_0xc53e('0x35')][_0xc53e('0x10')](this));_0x595efb[_0xc53e('0xd')]('end',this[_0xc53e('0x36')][_0xc53e('0x10')](this));};EmailImap[_0xc53e('0x14')][_0xc53e('0x37')]=function(_0xeaec72){simpleParser(_0xeaec72,{'Iconv':Iconv},this[_0xc53e('0x38')][_0xc53e('0x10')](this));};EmailImap['prototype'][_0xc53e('0x35')]=function(){};EmailImap[_0xc53e('0x14')][_0xc53e('0x36')]=function(){};EmailImap['prototype'][_0xc53e('0x38')]=function(_0x5e8ab7,_0xaa00cd){if(_0x5e8ab7){logger[_0xc53e('0x12')](_0x5e8ab7);}else{var _0x40c4f5=this;utils[_0xc53e('0x39')](this[_0xc53e('0xc')],_0xaa00cd,function(_0x5507d0){_0x40c4f5[_0xc53e('0x2a')](_0xc53e('0x27'),_0x5507d0);});}};EmailImap['prototype']['handleFetchEnd']=function(){this['imap']['closeBox'](!![],this[_0xc53e('0x2c')][_0xc53e('0x10')](this));};EmailImap['prototype'][_0xc53e('0x32')]=function(_0x574983){this['handleError'](_0x574983);this['imap'][_0xc53e('0x33')](!![],this['handleCloseBox']['bind'](this));};EmailImap[_0xc53e('0x14')]['handleEnd']=function(){this[_0xc53e('0x2a')](_0xc53e('0x2d'));};EmailImap['prototype'][_0xc53e('0x13')]=function(_0x3a4ebc,_0x509a04){logger[_0xc53e('0x12')]('handleError',this['account']['email'],JSON['stringify'](_0x3a4ebc));var _0x887d78='';if(_0x3a4ebc){if(_0x3a4ebc[_0xc53e('0x3a')]){_0x887d78=_0x3a4ebc[_0xc53e('0x3a')];}else{for(var _0x5f1884 in _0x3a4ebc){if(_0x3a4ebc[_0xc53e('0x3b')](_0x5f1884)){_0x887d78+=_[_0xc53e('0x3c')](_0x5f1884)+':\x20'+_0x3a4ebc[_0x5f1884]+'\x0a';}}}}if(_0x509a04){this['imap']['end']();}else{this[_0xc53e('0x2a')](_0xc53e('0x12'),_0x887d78);this[_0xc53e('0x2a')]('end');}};module[_0xc53e('0x3d')]=EmailImap; \ No newline at end of file +var _0x90b1=['hasOwnProperty','exports','lodash','util','imap','iconv','Iconv','events','EventEmitter','mailbox','INBOX','account','getAccount','once','ready','handleReady','bind','end','handleEnd','error','connect','inherits','prototype','connTimeout','authTimeout','isNil','service','authentication','user','password','host','port','tls','autotls','required','modernAuthentication','xoauth2','CloudProvider','data5','getHost','email','anonymous@xcally.com','openBox','handleOpenBox','handleError','emit','readUnseen','handleCloseBox','search','handleReadUnseen','length','fetch','message','handleFetchMessage','handleFetchEnd','closeBox','body','attributes','handleMessageEnd','handleMessageBody','handleSimpleParser','handleMessageAttributes','textCode'];(function(_0x4347ec,_0x41c4b8){var _0x4c8314=function(_0x583acd){while(--_0x583acd){_0x4347ec['push'](_0x4347ec['shift']());}};_0x4c8314(++_0x41c4b8);}(_0x90b1,0x1bb));var _0x190b=function(_0x4e15e8,_0x3544f4){_0x4e15e8=_0x4e15e8-0x0;var _0x1b9825=_0x90b1[_0x4e15e8];return _0x1b9825;};'use strict';var _=require(_0x190b('0x0'));var util=require(_0x190b('0x1'));var Imap=require(_0x190b('0x2'));var simpleParser=require('mailparser')['simpleParser'];var Iconv=require(_0x190b('0x3'))[_0x190b('0x4')];var EventEmitter=require(_0x190b('0x5'))[_0x190b('0x6')];var utils=require('./utils');var logger=require('../../../config/logger')('email');function EmailImap(_0x5da9c1,_0x27ff8c){this[_0x190b('0x7')]=_0x190b('0x8');this[_0x190b('0x9')]=this[_0x190b('0xa')](_0x5da9c1,_0x27ff8c);this[_0x190b('0x2')]=new Imap(this[_0x190b('0x9')]);this['imap'][_0x190b('0xb')](_0x190b('0xc'),this[_0x190b('0xd')][_0x190b('0xe')](this));this[_0x190b('0x2')][_0x190b('0xb')](_0x190b('0xf'),this[_0x190b('0x10')]['bind'](this));this[_0x190b('0x2')]['on'](_0x190b('0x11'),this['handleError'][_0x190b('0xe')](this));this[_0x190b('0x2')][_0x190b('0x12')]();}util[_0x190b('0x13')](EmailImap,EventEmitter);EmailImap[_0x190b('0x14')][_0x190b('0xa')]=function(_0x2e12d4,_0x13544c){var _0x1ff180={'connTimeout':_0x2e12d4[_0x190b('0x15')]?_0x2e12d4[_0x190b('0x15')]*0x3e8:0x2710,'authTimeout':_0x2e12d4[_0x190b('0x16')]?_0x2e12d4[_0x190b('0x16')]*0x3e8:0x1388};if(_[_0x190b('0x17')](_0x2e12d4[_0x190b('0x18')])){if(_0x2e12d4[_0x190b('0x19')]){_0x1ff180[_0x190b('0x1a')]=_0x2e12d4['user'];_0x1ff180[_0x190b('0x1b')]=_0x2e12d4['password'];}_0x1ff180[_0x190b('0x1c')]=_0x2e12d4[_0x190b('0x1c')];_0x1ff180[_0x190b('0x1d')]=_0x2e12d4[_0x190b('0x1d')]||0x3e1;if(_0x2e12d4['tls']){_0x1ff180[_0x190b('0x1e')]=!![];}else{_0x1ff180[_0x190b('0x1e')]=![];_0x1ff180[_0x190b('0x1f')]=_0x190b('0x20');}}else{if(_0x2e12d4[_0x190b('0x21')]){_0x1ff180[_0x190b('0x22')]=utils['generateXOAuth2Token'](_0x2e12d4[_0x190b('0x23')][_0x190b('0x24')],_0x2e12d4['user']);_0x1ff180[_0x190b('0x1a')]=_0x2e12d4['user'];}else{_0x1ff180['user']=_0x2e12d4[_0x190b('0x1a')];_0x1ff180[_0x190b('0x1b')]=_0x2e12d4[_0x190b('0x1b')];}_0x1ff180['host']=utils[_0x190b('0x25')](_0x2e12d4[_0x190b('0x18')]);_0x1ff180[_0x190b('0x1d')]=0x3e1;_0x1ff180[_0x190b('0x1e')]=!![];}_0x1ff180[_0x190b('0x26')]=_0x13544c||_0x2e12d4[_0x190b('0x1a')]||_0x190b('0x27');return _0x1ff180;};EmailImap['prototype']['handleReady']=function(){this[_0x190b('0x2')][_0x190b('0x28')](this['mailbox'],![],this['handleOpenBox'][_0x190b('0xe')](this));};EmailImap['prototype'][_0x190b('0x29')]=function(_0x3b6aaf,_0x51f8b4){if(_0x3b6aaf){this[_0x190b('0x2a')](_0x3b6aaf,!![]);}else{this[_0x190b('0x2b')]('box',_0x51f8b4);this[_0x190b('0x2c')]();}};EmailImap[_0x190b('0x14')][_0x190b('0x2d')]=function(_0x494f3f){if(_0x494f3f){this['handleError'](_0x494f3f,!![]);}else{this[_0x190b('0x2')]['end']();}};EmailImap[_0x190b('0x14')][_0x190b('0x2c')]=function(){this['imap'][_0x190b('0x2e')](['UNSEEN'],this[_0x190b('0x2f')]['bind'](this));};EmailImap[_0x190b('0x14')]['handleReadUnseen']=function(_0xc789e5,_0x5c6ff3){if(_0xc789e5){this['handleError'](_0xc789e5,!![]);}else{if(_0x5c6ff3[_0x190b('0x30')]){try{var _0x15fed4=this[_0x190b('0x2')][_0x190b('0x31')](_0x5c6ff3,{'bodies':'','markSeen':!![]});_0x15fed4['on'](_0x190b('0x32'),this[_0x190b('0x33')][_0x190b('0xe')](this));_0x15fed4[_0x190b('0xb')]('error',this['handleFetchError'][_0x190b('0xe')](this));_0x15fed4[_0x190b('0xb')]('end',this[_0x190b('0x34')][_0x190b('0xe')](this));}catch(_0x3e4dd8){logger[_0x190b('0x11')](_0x3e4dd8);}}else{this[_0x190b('0x2')][_0x190b('0x35')](!![],this[_0x190b('0x2d')]['bind'](this));}}};EmailImap['prototype'][_0x190b('0x33')]=function(_0x2f7111){_0x2f7111['on'](_0x190b('0x36'),this['handleMessageBody'][_0x190b('0xe')](this));_0x2f7111[_0x190b('0xb')](_0x190b('0x37'),this['handleMessageAttributes'][_0x190b('0xe')](this));_0x2f7111['once']('end',this[_0x190b('0x38')][_0x190b('0xe')](this));};EmailImap['prototype'][_0x190b('0x39')]=function(_0xfd0d62){simpleParser(_0xfd0d62,{'Iconv':Iconv},this[_0x190b('0x3a')]['bind'](this));};EmailImap[_0x190b('0x14')][_0x190b('0x3b')]=function(){};EmailImap['prototype']['handleMessageEnd']=function(){};EmailImap[_0x190b('0x14')]['handleSimpleParser']=function(_0x46bdba,_0x741e94){if(_0x46bdba){logger[_0x190b('0x11')](_0x46bdba);}else{var _0xad955a=this;utils['parser'](this[_0x190b('0x9')],_0x741e94,function(_0x5f118c){_0xad955a[_0x190b('0x2b')](_0x190b('0x26'),_0x5f118c);});}};EmailImap['prototype'][_0x190b('0x34')]=function(){this[_0x190b('0x2')][_0x190b('0x35')](!![],this['handleCloseBox'][_0x190b('0xe')](this));};EmailImap['prototype']['handleFetchError']=function(_0x554486){this[_0x190b('0x2a')](_0x554486);this[_0x190b('0x2')][_0x190b('0x35')](!![],this[_0x190b('0x2d')]['bind'](this));};EmailImap['prototype'][_0x190b('0x10')]=function(){this['emit'](_0x190b('0xf'));};EmailImap[_0x190b('0x14')]['handleError']=function(_0x2e25e3,_0x36db47){logger[_0x190b('0x11')]('handleError',this[_0x190b('0x9')][_0x190b('0x26')],JSON['stringify'](_0x2e25e3));var _0x3c734b='';if(_0x2e25e3){if(_0x2e25e3['textCode']){_0x3c734b=_0x2e25e3[_0x190b('0x3c')];}else{for(var _0x12c276 in _0x2e25e3){if(_0x2e25e3[_0x190b('0x3d')](_0x12c276)){_0x3c734b+=_['upperFirst'](_0x12c276)+':\x20'+_0x2e25e3[_0x12c276]+'\x0a';}}}}if(_0x36db47){this[_0x190b('0x2')]['end']();}else{this[_0x190b('0x2b')](_0x190b('0x11'),_0x3c734b);this[_0x190b('0x2b')](_0x190b('0xf'));}};module[_0x190b('0x3e')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 908c183..5c33626 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 _0x01d9=['prototype','send','createTransport','use','compile','toString','verify','Not\x20verified','nodemailer','nodemailer-plugin-inline-base64'];(function(_0xc9cd47,_0x35a546){var _0x26827e=function(_0x32d967){while(--_0x32d967){_0xc9cd47['push'](_0xc9cd47['shift']());}};_0x26827e(++_0x35a546);}(_0x01d9,0x6c));var _0x901d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x01d9[_0x321bb2];return _0x9c12ed;};'use strict';var nodemailer=require(_0x901d('0x0'));var inlineBase64=require(_0x901d('0x1'));function EmailSmtp(){}EmailSmtp[_0x901d('0x2')][_0x901d('0x3')]=function(_0x521cc9,_0x2ce1fd){return new Promise(function(_0x28bf48,_0x247cfc){var _0x8f7b4=nodemailer[_0x901d('0x4')](_0x521cc9);_0x8f7b4[_0x901d('0x5')](_0x901d('0x6'),inlineBase64());_0x8f7b4['sendMail'](_0x2ce1fd,function(_0x1e5d7d,_0x6c9ac8){if(_0x1e5d7d)return _0x247cfc(_0x1e5d7d[_0x901d('0x7')]());return _0x28bf48(_0x6c9ac8);});});};EmailSmtp[_0x901d('0x2')][_0x901d('0x8')]=function(_0x39fc94){return new Promise(function(_0x202568,_0x2555e0){var _0x15076e=nodemailer[_0x901d('0x4')](_0x39fc94);_0x15076e[_0x901d('0x8')](function(_0xd819f0,_0x1d3137){if(_0xd819f0)return _0x2555e0(_0xd819f0['toString']());if(!_0x1d3137)return _0x2555e0(_0x901d('0x9'));return _0x202568(_0x1d3137);});});};module['exports']=EmailSmtp; \ No newline at end of file +var _0x2ef3=['nodemailer-plugin-inline-base64','prototype','send','use','compile','toString','verify','createTransport','Not\x20verified','exports','nodemailer'];(function(_0xd1067d,_0x2a3f0c){var _0x47a962=function(_0x401c9f){while(--_0x401c9f){_0xd1067d['push'](_0xd1067d['shift']());}};_0x47a962(++_0x2a3f0c);}(_0x2ef3,0xba));var _0x32ef=function(_0x31abfc,_0x399154){_0x31abfc=_0x31abfc-0x0;var _0x27e6fb=_0x2ef3[_0x31abfc];return _0x27e6fb;};'use strict';var nodemailer=require(_0x32ef('0x0'));var inlineBase64=require(_0x32ef('0x1'));function EmailSmtp(){}EmailSmtp[_0x32ef('0x2')][_0x32ef('0x3')]=function(_0x3944df,_0x38047b){return new Promise(function(_0x48106c,_0x38f865){var _0x38b7f3=nodemailer['createTransport'](_0x3944df);_0x38b7f3[_0x32ef('0x4')](_0x32ef('0x5'),inlineBase64());_0x38b7f3['sendMail'](_0x38047b,function(_0x5dfa09,_0x2c0089){if(_0x5dfa09)return _0x38f865(_0x5dfa09[_0x32ef('0x6')]());return _0x48106c(_0x2c0089);});});};EmailSmtp[_0x32ef('0x2')][_0x32ef('0x7')]=function(_0x234863){return new Promise(function(_0x298066,_0x2484a0){var _0x2bbb50=nodemailer[_0x32ef('0x8')](_0x234863);_0x2bbb50[_0x32ef('0x7')](function(_0x56eb42,_0x5780e9){if(_0x56eb42)return _0x2484a0(_0x56eb42[_0x32ef('0x6')]());if(!_0x5780e9)return _0x2484a0(_0x32ef('0x9'));return _0x298066(_0x5780e9);});});};module[_0x32ef('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 c579572..c58fe26 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 _0x5cfa=['X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply','headerLines','line','parser','from','subject','messageId','date','YYYY-MM-DD\x20HH:mm:ss','filter','application/ms-tnef','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','parseBuffer','first','BodyHTML','

Empty\x20message

','Attachments','Title','Data','getHost','gmail','imap.mail.yahoo.com','outlook365','outlook.office365.com','auth=Bearer\x20','utf-8','moment','path','util','email','../../../config/environment','head','value','address','anonymous','generate','@xcally.com','name','substring','indexOf','split','length','slice','join','Anonymous','pop','isEmpty','html','test','attachments','forEach','push','filename','replace','_IMG','\x20]','body','textAsHtml','0x1?_0x53049d[_0xa5cf('0x10')](0x0,-0x1)[_0xa5cf('0x11')]('\x20'):_0x59ad25[_0xa5cf('0xb')];}return _0xa5cf('0x12');}function getLastName(_0x1a043d){var _0x13a863=_[_0xa5cf('0x5')](_0x1a043d['value']);if(_0x13a863&&_0x13a863[_0xa5cf('0xb')]){var _0x324a8f=_0x13a863[_0xa5cf('0xb')][_0xa5cf('0xe')](/\s+/);return _0x324a8f['length']>0x1?_0x324a8f[_0xa5cf('0x13')]():'';}return'';}function getMails(_0x37cb13,_0xf06a35){var _0x3b0294='';for(var _0x3e3c98=0x0;_0x3e3c98<_0xf06a35[_0xa5cf('0x6')][_0xa5cf('0xf')];_0x3e3c98+=0x1){if(_0xf06a35[_0xa5cf('0x6')][_0x3e3c98]['address']!==_0x37cb13){if(!_[_0xa5cf('0x14')](_0x3b0294)){_0x3b0294+=',';}_0x3b0294+=_0xf06a35[_0xa5cf('0x6')][_0x3e3c98][_0xa5cf('0xb')]||_0xf06a35[_0xa5cf('0x6')][_0x3e3c98]['address']||'';_0x3b0294+='\x20<';_0x3b0294+=_0xf06a35[_0xa5cf('0x6')][_0x3e3c98][_0xa5cf('0x7')]?_0xf06a35[_0xa5cf('0x6')][_0x3e3c98][_0xa5cf('0x7')]:'anonymous'+random['generate'](0x6)+_0xa5cf('0xa');_0x3b0294+='>';}}return _0x3b0294;}function parseEmail(_0x17aa27,_0x5b5c72,_0x5701bb){if(_0x5b5c72[_0xa5cf('0x15')]){var _0x70b11a=/)<[^<]*)*<\/script>/gi;while(_0x70b11a[_0xa5cf('0x16')](_0x5b5c72[_0xa5cf('0x15')])){_0x5b5c72[_0xa5cf('0x15')]=_0x5b5c72[_0xa5cf('0x15')]['replace'](_0x70b11a,'');}if(_0x5b5c72['html']['includes']('{_0x3dd70a[_0xa5cf('0x19')](_0x203784[_0xa5cf('0x1a')]);});var _0xee7274=/]+>/g;var _0x15dd09=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x1ef3d5=_0x5b5c72[_0xa5cf('0x15')]['replace'](_0x15dd09,'_SRC');var _0x50b3c7=_0x1ef3d5[_0xa5cf('0x1b')](_0xee7274,_0xa5cf('0x1c'));for(let _0x1b3eb9=0x0;_0x1b3eb9<_0x3dd70a[_0xa5cf('0xf')];_0x1b3eb9++){var _0x37855f=_0x50b3c7['replace'](_0xa5cf('0x1c'),'\x20[Attachment:\x20'+_0x3dd70a[_0x1b3eb9]+_0xa5cf('0x1d'));_0x50b3c7=_0x37855f;}_0x5b5c72[_0xa5cf('0x15')]=_0x50b3c7;}_0x5701bb[_0xa5cf('0x1e')]=_0x5b5c72[_0xa5cf('0x15')];}else{_0x5701bb['body']=_0x5b5c72[_0xa5cf('0x1f')];}if(_0x5701bb[_0xa5cf('0x1e')]){_0x5701bb[_0xa5cf('0x1e')]=_0x5701bb['body']['replace'](/0x0){var _0x4b2747=[_0xa5cf('0x2e'),_0xa5cf('0x2f'),_0xa5cf('0x30')];for(var _0x4a3361=0x0;_0x4a3361<_0x5b5c72[_0xa5cf('0x31')][_0xa5cf('0xf')];_0x4a3361++){var _0xb15189=_['indexOf'](_0x4b2747,_0x5b5c72[_0xa5cf('0x31')][_0x4a3361][_0xa5cf('0x32')]);if(_0xb15189>=0x0){_0x5701bb['isAutoreply']=!![];}}}return _0x5701bb;}exports[_0xa5cf('0x33')]=function(_0x5222b2,_0x4502db,_0x179a5f){var _0x5b1893={'from':getAddress(_0x4502db['from']),'firstName':getFirstName(_0x4502db[_0xa5cf('0x34')]),'lastName':getLastName(_0x4502db[_0xa5cf('0x34')]),'mapKey':_0xa5cf('0x3'),'message':{'from':getMails(_0x5222b2[_0xa5cf('0x3')],_0x4502db[_0xa5cf('0x34')]),'to':_0x5222b2['email'],'cc':'','subject':_0x4502db[_0xa5cf('0x35')]||'','messageId':_0x4502db[_0xa5cf('0x36')],'inReplyTo':_0x4502db['inReplyTo'],'sentAt':moment(_0x4502db[_0xa5cf('0x37')])[_0xa5cf('0x28')](_0xa5cf('0x38')),'attach':![],'attachments':[]}};if(!_0x4502db[_0xa5cf('0x15')]&&!_0x4502db[_0xa5cf('0x1f')]){var _0x592a73=_[_0xa5cf('0x39')](_0x4502db['attachments'],{'contentType':_0xa5cf('0x3a')});if(_0x592a73[_0xa5cf('0xf')]){logger[_0xa5cf('0x3b')](util['format'](_0xa5cf('0x3c'),_0x4502db['messageId']));tnef[_0xa5cf('0x3d')](_[_0xa5cf('0x3e')](_0x592a73)[_0xa5cf('0x2c')],function(_0x2b7278,_0xdc850c){if(_0xdc850c){_0x4502db[_0xa5cf('0x15')]=_0xdc850c[_0xa5cf('0x3f')]||_0xa5cf('0x40');if(_0xdc850c[_0xa5cf('0x41')]){for(var _0x5e529f=0x0;_0x5e529f<_0xdc850c[_0xa5cf('0x41')][_0xa5cf('0xf')];_0x5e529f++){var _0x1ae9a9=_0xdc850c[_0xa5cf('0x41')][_0x5e529f];_0x5b1893[_0xa5cf('0x21')][_0xa5cf('0x17')][_0xa5cf('0x19')]({'filename':_0x1ae9a9[_0xa5cf('0x42')],'content':Buffer[_0xa5cf('0x34')](_0x1ae9a9[_0xa5cf('0x43')])});}}}_0x179a5f(parseEmail(_0x5222b2,_0x4502db,_0x5b1893));});}else{_0x4502db[_0xa5cf('0x15')]=_0xa5cf('0x40');_0x179a5f(parseEmail(_0x5222b2,_0x4502db,_0x5b1893));}}else{_0x179a5f(parseEmail(_0x5222b2,_0x4502db,_0x5b1893));}};exports[_0xa5cf('0x44')]=function(_0xbd4eed){switch(_0xbd4eed){case _0xa5cf('0x45'):return'imap.gmail.com';case'yahoo':return _0xa5cf('0x46');case'hotmail':return'imap-mail.outlook.com';case _0xa5cf('0x47'):return _0xa5cf('0x48');}return'127.0.0.1';};exports['generateXOAuth2Token']=function(_0x3a09b3,_0x310a5d){var _0x43aa03=['user='+(_0x310a5d||''),_0xa5cf('0x49')+_0x3a09b3,'',''];return Buffer[_0xa5cf('0x34')](_0x43aa03['join'](''),_0xa5cf('0x4a'))['toString']('base64');}; \ No newline at end of file +var _0xc56d=['gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','127.0.0.1','generateXOAuth2Token','user=','utf-8','toString','lodash','moment','randomstring','path','util','node-tnef','../../../config/logger','email','head','value','address','anonymous','generate','@xcally.com','name','substring','indexOf','split','length','slice','join','Anonymous','pop','isEmpty','html','replace','includes','attachments','forEach','push','_SRC','_IMG','\x20]','body','textAsHtml','Empty\x20message

','Attachments','Title','Data','getHost'];(function(_0x7eda0f,_0xb7ced1){var _0x5f1e3f=function(_0x38a3f4){while(--_0x38a3f4){_0x7eda0f['push'](_0x7eda0f['shift']());}};_0x5f1e3f(++_0xb7ced1);}(_0xc56d,0x1b1));var _0xdc56=function(_0x3372eb,_0x57520b){_0x3372eb=_0x3372eb-0x0;var _0x4b252e=_0xc56d[_0x3372eb];return _0x4b252e;};'use strict';var _=require(_0xdc56('0x0'));var moment=require(_0xdc56('0x1'));var random=require(_0xdc56('0x2'));var fs=require('fs');var path=require(_0xdc56('0x3'));var util=require(_0xdc56('0x4'));var tnef=require(_0xdc56('0x5'));var logger=require(_0xdc56('0x6'))(_0xdc56('0x7'));var config=require('../../../config/environment');function getAddress(_0x45df2d){var _0x293076=_[_0xdc56('0x8')](_0x45df2d[_0xdc56('0x9')]);return _0x293076&&_0x293076[_0xdc56('0xa')]?_0x293076['address']:_0xdc56('0xb')+random[_0xdc56('0xc')](0x6)+_0xdc56('0xd');}function getFirstName(_0x127029){var _0x4480f1=_[_0xdc56('0x8')](_0x127029[_0xdc56('0x9')]);if(_0x4480f1&&_0x4480f1[_0xdc56('0xe')]){if(_0x4480f1[_0xdc56('0xe')]==_0x4480f1[_0xdc56('0xa')]){return _0x4480f1['name'][_0xdc56('0xf')](0x0,_0x4480f1[_0xdc56('0xe')][_0xdc56('0x10')]('@'));}var _0xa90eb6=_0x4480f1[_0xdc56('0xe')][_0xdc56('0x11')](/\s+/);return _0xa90eb6[_0xdc56('0x12')]>0x1?_0xa90eb6[_0xdc56('0x13')](0x0,-0x1)[_0xdc56('0x14')]('\x20'):_0x4480f1['name'];}return _0xdc56('0x15');}function getLastName(_0x5a5167){var _0x1ef0dc=_[_0xdc56('0x8')](_0x5a5167[_0xdc56('0x9')]);if(_0x1ef0dc&&_0x1ef0dc[_0xdc56('0xe')]){var _0x2fbbcd=_0x1ef0dc[_0xdc56('0xe')]['split'](/\s+/);return _0x2fbbcd[_0xdc56('0x12')]>0x1?_0x2fbbcd[_0xdc56('0x16')]():'';}return'';}function getMails(_0x368126,_0x4de156){var _0x57c1d3='';for(var _0x568314=0x0;_0x568314<_0x4de156[_0xdc56('0x9')][_0xdc56('0x12')];_0x568314+=0x1){if(_0x4de156[_0xdc56('0x9')][_0x568314]['address']!==_0x368126){if(!_[_0xdc56('0x17')](_0x57c1d3)){_0x57c1d3+=',';}_0x57c1d3+=_0x4de156[_0xdc56('0x9')][_0x568314][_0xdc56('0xe')]||_0x4de156[_0xdc56('0x9')][_0x568314]['address']||'';_0x57c1d3+='\x20<';_0x57c1d3+=_0x4de156[_0xdc56('0x9')][_0x568314][_0xdc56('0xa')]?_0x4de156[_0xdc56('0x9')][_0x568314][_0xdc56('0xa')]:_0xdc56('0xb')+random[_0xdc56('0xc')](0x6)+_0xdc56('0xd');_0x57c1d3+='>';}}return _0x57c1d3;}function parseEmail(_0x1fa97e,_0x14a38b,_0x4c9b61){if(_0x14a38b[_0xdc56('0x18')]){var _0x4b953d=/)<[^<]*)*<\/script>/gi;while(_0x4b953d['test'](_0x14a38b[_0xdc56('0x18')])){_0x14a38b[_0xdc56('0x18')]=_0x14a38b[_0xdc56('0x18')][_0xdc56('0x19')](_0x4b953d,'');}if(_0x14a38b[_0xdc56('0x18')][_0xdc56('0x1a')]('{_0x58c1bb[_0xdc56('0x1d')](_0x4d9d16['filename']);});var _0x585b4a=/]+>/g;var _0x2fd577=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0xcd4c55=_0x14a38b[_0xdc56('0x18')][_0xdc56('0x19')](_0x2fd577,_0xdc56('0x1e'));var _0x4a49df=_0xcd4c55[_0xdc56('0x19')](_0x585b4a,_0xdc56('0x1f'));for(let _0x174324=0x0;_0x174324<_0x58c1bb['length'];_0x174324++){var _0xc4fd27=_0x4a49df[_0xdc56('0x19')](_0xdc56('0x1f'),'\x20[Attachment:\x20'+_0x58c1bb[_0x174324]+_0xdc56('0x20'));_0x4a49df=_0xc4fd27;}_0x14a38b[_0xdc56('0x18')]=_0x4a49df;}_0x4c9b61[_0xdc56('0x21')]=_0x14a38b[_0xdc56('0x18')];}else{_0x4c9b61[_0xdc56('0x21')]=_0x14a38b[_0xdc56('0x22')];}if(_0x4c9b61[_0xdc56('0x21')]){_0x4c9b61[_0xdc56('0x21')]=_0x4c9b61[_0xdc56('0x21')][_0xdc56('0x19')](/0x0){var _0x3c5bba=[_0xdc56('0x33'),_0xdc56('0x34'),'Precedence:\x20auto_reply'];for(var _0x3db193=0x0;_0x3db193<_0x14a38b[_0xdc56('0x32')][_0xdc56('0x12')];_0x3db193++){var _0x3afa64=_[_0xdc56('0x10')](_0x3c5bba,_0x14a38b[_0xdc56('0x32')][_0x3db193]['line']);if(_0x3afa64>=0x0){_0x4c9b61[_0xdc56('0x35')]=!![];}}}return _0x4c9b61;}exports[_0xdc56('0x36')]=function(_0x400fe1,_0x518b66,_0x5af21e){var _0x5c74c0={'from':getAddress(_0x518b66[_0xdc56('0x37')]),'firstName':getFirstName(_0x518b66[_0xdc56('0x37')]),'lastName':getLastName(_0x518b66[_0xdc56('0x37')]),'mapKey':'email','message':{'from':getMails(_0x400fe1[_0xdc56('0x7')],_0x518b66[_0xdc56('0x37')]),'to':_0x400fe1['email'],'cc':'','subject':_0x518b66['subject']||'','messageId':_0x518b66[_0xdc56('0x38')],'inReplyTo':_0x518b66[_0xdc56('0x39')],'sentAt':moment(_0x518b66[_0xdc56('0x3a')])['format'](_0xdc56('0x3b')),'attach':![],'attachments':[]}};if(!_0x518b66[_0xdc56('0x18')]&&!_0x518b66[_0xdc56('0x22')]){var _0x5914e8=_[_0xdc56('0x3c')](_0x518b66[_0xdc56('0x1b')],{'contentType':_0xdc56('0x3d')});if(_0x5914e8[_0xdc56('0x12')]){logger['info'](util[_0xdc56('0x2b')](_0xdc56('0x3e'),_0x518b66[_0xdc56('0x38')]));tnef[_0xdc56('0x3f')](_[_0xdc56('0x40')](_0x5914e8)[_0xdc56('0x30')],function(_0x204e97,_0x41f835){if(_0x41f835){_0x518b66[_0xdc56('0x18')]=_0x41f835[_0xdc56('0x41')]||_0xdc56('0x42');if(_0x41f835[_0xdc56('0x43')]){for(var _0x2ec2f0=0x0;_0x2ec2f0<_0x41f835[_0xdc56('0x43')][_0xdc56('0x12')];_0x2ec2f0++){var _0x259a15=_0x41f835[_0xdc56('0x43')][_0x2ec2f0];_0x5c74c0[_0xdc56('0x24')][_0xdc56('0x1b')]['push']({'filename':_0x259a15[_0xdc56('0x44')],'content':Buffer[_0xdc56('0x37')](_0x259a15[_0xdc56('0x45')])});}}}_0x5af21e(parseEmail(_0x400fe1,_0x518b66,_0x5c74c0));});}else{_0x518b66[_0xdc56('0x18')]=_0xdc56('0x42');_0x5af21e(parseEmail(_0x400fe1,_0x518b66,_0x5c74c0));}}else{_0x5af21e(parseEmail(_0x400fe1,_0x518b66,_0x5c74c0));}};exports[_0xdc56('0x46')]=function(_0x91b4f1){switch(_0x91b4f1){case _0xdc56('0x47'):return _0xdc56('0x48');case _0xdc56('0x49'):return _0xdc56('0x4a');case _0xdc56('0x4b'):return _0xdc56('0x4c');case _0xdc56('0x4d'):return _0xdc56('0x4e');}return _0xdc56('0x4f');};exports[_0xdc56('0x50')]=function(_0x1f3bca,_0x320348){var _0x262e93=[_0xdc56('0x51')+(_0x320348||''),'auth=Bearer\x20'+_0x1f3bca,'',''];return Buffer['from'](_0x262e93['join'](''),_0xdc56('0x52'))[_0xdc56('0x53')]('base64');}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 4df3272..0f8d3df 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 _0xcda7=['Smtp','name','Service','key','SERV','active','Imap'];(function(_0x1125d2,_0x4a49cb){var _0x3b1372=function(_0x16a156){while(--_0x16a156){_0x1125d2['push'](_0x1125d2['shift']());}};_0x3b1372(++_0x4a49cb);}(_0xcda7,0x1c8));var _0x7cda=function(_0x2c7aa2,_0x5ef162){_0x2c7aa2=_0x2c7aa2-0x0;var _0x1e4a12=_0xcda7[_0x2c7aa2];return _0x1e4a12;};'use strict';var _=require('lodash');function MailAccount(_0x4abad4){this['id']=_0x4abad4['id']||0x0;this[_0x7cda('0x0')]=_0x4abad4[_0x7cda('0x0')]||_0x7cda('0x1');this[_0x7cda('0x2')]=_0x4abad4[_0x7cda('0x2')]||_0x7cda('0x3');this[_0x7cda('0x4')]=_0x4abad4[_0x7cda('0x4')]||![];this[_0x7cda('0x5')]=_0x4abad4[_0x7cda('0x5')]||[];this['Smtp']=_0x4abad4[_0x7cda('0x6')]||[];}module['exports']=MailAccount; \ No newline at end of file +var _0xbae8=['name','Service','key','SERV','active','Imap','Smtp','lodash'];(function(_0x1eb262,_0xdf4ab0){var _0x476306=function(_0x20494c){while(--_0x20494c){_0x1eb262['push'](_0x1eb262['shift']());}};_0x476306(++_0xdf4ab0);}(_0xbae8,0x19f));var _0x8bae=function(_0x1196b0,_0x36c47a){_0x1196b0=_0x1196b0-0x0;var _0x111c52=_0xbae8[_0x1196b0];return _0x111c52;};'use strict';var _=require(_0x8bae('0x0'));function MailAccount(_0x433530){this['id']=_0x433530['id']||0x0;this[_0x8bae('0x1')]=_0x433530[_0x8bae('0x1')]||_0x8bae('0x2');this['key']=_0x433530[_0x8bae('0x3')]||_0x8bae('0x4');this[_0x8bae('0x5')]=_0x433530[_0x8bae('0x5')]||![];this[_0x8bae('0x6')]=_0x433530[_0x8bae('0x6')]||[];this[_0x8bae('0x7')]=_0x433530[_0x8bae('0x7')]||[];}module['exports']=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 94d7358..32c1324 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 _0xb0eb=['isUndefined','merge','exports','lodash','mailAccounts','mapKeys','prototype','hasOwnProperty','initMailAccounts','length'];(function(_0x53a7a8,_0xed2bff){var _0x555f71=function(_0x48e696){while(--_0x48e696){_0x53a7a8['push'](_0x53a7a8['shift']());}};_0x555f71(++_0xed2bff);}(_0xb0eb,0x143));var _0xbb0e=function(_0x59054f,_0x5dfd47){_0x59054f=_0x59054f-0x0;var _0x415fce=_0xb0eb[_0x59054f];return _0x415fce;};'use strict';var _=require(_0xbb0e('0x0'));var MailAccount=require('../model/mailAccount');var Realtime=function(){this[_0xbb0e('0x1')]={};};function freeIsNotKey(_0x34f608,_0x26ae15,_0x205ceb){var _0x5acbcb=_[_0xbb0e('0x2')](_0x34f608,function(_0x865c8e,_0x4a5b22){return _0x865c8e[_0x205ceb];});for(var _0x5309b8 in _0x26ae15){if(_0x26ae15['hasOwnProperty'](_0x5309b8)){if(!_0x5acbcb[_0x5309b8]){delete _0x26ae15[_0x5309b8];}}}}Realtime[_0xbb0e('0x3')]['mergeFromDatabase']=function(_0x486f06,_0x2b099d){for(var _0x3fecc3 in _0x2b099d){if(_0x486f06[_0xbb0e('0x4')](_0x3fecc3)){_0x486f06[_0x3fecc3]=_0x2b099d[_0x3fecc3];}}};Realtime[_0xbb0e('0x3')][_0xbb0e('0x5')]=function(){var _0x49ff58=this;return function(_0x24823c){if(_0x24823c){freeIsNotKey(_0x24823c,_0x49ff58['mailAccounts'],'id');for(var _0x28301c=0x0,_0x3d1a93={},_0x458595={};_0x28301c<_0x24823c[_0xbb0e('0x6')];_0x28301c+=0x1){_0x3d1a93=_0x24823c[_0x28301c];if(_[_0xbb0e('0x7')](_0x49ff58[_0xbb0e('0x1')][_0x3d1a93['id']])){_0x49ff58[_0xbb0e('0x1')][_0x3d1a93['id']]=new MailAccount(_0x3d1a93);}else{_[_0xbb0e('0x8')](_0x49ff58[_0xbb0e('0x1')][_0x3d1a93['id']],_0x3d1a93);}}}return _0x49ff58['mailAccounts'];};};module[_0xbb0e('0x9')]=Realtime; \ No newline at end of file +var _0xe9ec=['exports','lodash','mailAccounts','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initMailAccounts','length','isUndefined','merge'];(function(_0x200664,_0x71e3da){var _0x5d9e6d=function(_0x3492ac){while(--_0x3492ac){_0x200664['push'](_0x200664['shift']());}};_0x5d9e6d(++_0x71e3da);}(_0xe9ec,0xf3));var _0xce9e=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xe9ec[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0xce9e('0x0'));var MailAccount=require('../model/mailAccount');var Realtime=function(){this[_0xce9e('0x1')]={};};function freeIsNotKey(_0x19291c,_0x3c1757,_0x5b0650){var _0x47d253=_[_0xce9e('0x2')](_0x19291c,function(_0x3b30f3,_0x587fd7){return _0x3b30f3[_0x5b0650];});for(var _0x38f7ad in _0x3c1757){if(_0x3c1757[_0xce9e('0x3')](_0x38f7ad)){if(!_0x47d253[_0x38f7ad]){delete _0x3c1757[_0x38f7ad];}}}}Realtime[_0xce9e('0x4')][_0xce9e('0x5')]=function(_0x2ea32a,_0x56fff2){for(var _0x5c7957 in _0x56fff2){if(_0x2ea32a['hasOwnProperty'](_0x5c7957)){_0x2ea32a[_0x5c7957]=_0x56fff2[_0x5c7957];}}};Realtime[_0xce9e('0x4')][_0xce9e('0x6')]=function(){var _0x5374e9=this;return function(_0x39cdd7){if(_0x39cdd7){freeIsNotKey(_0x39cdd7,_0x5374e9['mailAccounts'],'id');for(var _0x1f75d6=0x0,_0x407efe={},_0x1ad24d={};_0x1f75d6<_0x39cdd7[_0xce9e('0x7')];_0x1f75d6+=0x1){_0x407efe=_0x39cdd7[_0x1f75d6];if(_[_0xce9e('0x8')](_0x5374e9[_0xce9e('0x1')][_0x407efe['id']])){_0x5374e9[_0xce9e('0x1')][_0x407efe['id']]=new MailAccount(_0x407efe);}else{_[_0xce9e('0x9')](_0x5374e9[_0xce9e('0x1')][_0x407efe['id']],_0x407efe);}}}return _0x5374e9[_0xce9e('0x1')];};};module[_0xce9e('0xa')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index daceaa7..0b507e6 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 _0xb2b4=['NotifyMailAccount','../client','getMailAccounts','Request','GetMailAccount','name','service','email','active','key','ListId','TemplateId','MailServerIn','Imap','CloudProvider','type','data5','Smtp','getMailAccount','notify'];(function(_0x2cc842,_0xd6800d){var _0x24adab=function(_0x41ab67){while(--_0x41ab67){_0x2cc842['push'](_0x2cc842['shift']());}};_0x24adab(++_0xd6800d);}(_0xb2b4,0x141));var _0x4b2b=function(_0x272d90,_0x5e70ff){_0x272d90=_0x272d90-0x0;var _0x2bf4a2=_0xb2b4[_0x272d90];return _0x2bf4a2;};'use strict';var client=require(_0x4b2b('0x0'));exports[_0x4b2b('0x1')]=function(){return function(){return client[_0x4b2b('0x2')](_0x4b2b('0x3'),{'options':{'attributes':['id',_0x4b2b('0x4'),'provider',_0x4b2b('0x5'),_0x4b2b('0x6'),_0x4b2b('0x7'),_0x4b2b('0x8'),_0x4b2b('0x9'),_0x4b2b('0xa')],'raw':![],'include':[{'model':_0x4b2b('0xb'),'as':_0x4b2b('0xc'),'include':[{'model':_0x4b2b('0xd'),'attributes':['id',_0x4b2b('0x4'),'service',_0x4b2b('0xe'),_0x4b2b('0xf')],'as':_0x4b2b('0xd')}]},{'model':'MailServerOut','as':_0x4b2b('0x10'),'include':[{'model':_0x4b2b('0xd'),'attributes':['id',_0x4b2b('0x4'),_0x4b2b('0x5'),_0x4b2b('0xe'),_0x4b2b('0xf')],'as':'CloudProvider'}]}]},'log':_0x4b2b('0x11')});};};exports[_0x4b2b('0x12')]=function(_0x1cea35,_0xa517f2){return client['Request'](_0x4b2b('0x13'),{'account':{'id':_0x1cea35},'body':_0xa517f2,'log':_0x4b2b('0x13')});}; \ No newline at end of file +var _0xd959=['service','email','active','ListId','TemplateId','MailServerIn','Imap','type','CloudProvider','Smtp','getMailAccount','NotifyMailAccount','../client','getMailAccounts','Request','name','provider'];(function(_0xb3300f,_0x121fbd){var _0x1a6d21=function(_0x15f852){while(--_0x15f852){_0xb3300f['push'](_0xb3300f['shift']());}};_0x1a6d21(++_0x121fbd);}(_0xd959,0x94));var _0x9d95=function(_0x599cc9,_0x3b78c4){_0x599cc9=_0x599cc9-0x0;var _0x374d4f=_0xd959[_0x599cc9];return _0x374d4f;};'use strict';var client=require(_0x9d95('0x0'));exports[_0x9d95('0x1')]=function(){return function(){return client[_0x9d95('0x2')]('GetMailAccount',{'options':{'attributes':['id',_0x9d95('0x3'),_0x9d95('0x4'),_0x9d95('0x5'),_0x9d95('0x6'),_0x9d95('0x7'),'key',_0x9d95('0x8'),_0x9d95('0x9')],'raw':![],'include':[{'model':_0x9d95('0xa'),'as':_0x9d95('0xb'),'include':[{'model':'CloudProvider','attributes':['id',_0x9d95('0x3'),_0x9d95('0x5'),_0x9d95('0xc'),'data5'],'as':_0x9d95('0xd')}]},{'model':'MailServerOut','as':_0x9d95('0xe'),'include':[{'model':_0x9d95('0xd'),'attributes':['id',_0x9d95('0x3'),_0x9d95('0x5'),_0x9d95('0xc'),'data5'],'as':_0x9d95('0xd')}]}]},'log':_0x9d95('0xf')});};};exports['notify']=function(_0x3aa60a,_0x182a73){return client['Request'](_0x9d95('0x10'),{'account':{'id':_0x3aa60a},'body':_0x182a73,'log':_0x9d95('0x10')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 3956ba2..573951e 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 _0xdb6d=['getSettings','ShowSetting','loginMailFrequency','../client'];(function(_0xc9783b,_0x7d3db2){var _0x57b576=function(_0x482abd){while(--_0x482abd){_0xc9783b['push'](_0xc9783b['shift']());}};_0x57b576(++_0x7d3db2);}(_0xdb6d,0x7f));var _0xddb6=function(_0x1d11d7,_0x5e4c2c){_0x1d11d7=_0x1d11d7-0x0;var _0x1c057b=_0xdb6d[_0x1d11d7];return _0x1c057b;};'use strict';var client=require(_0xddb6('0x0'));exports[_0xddb6('0x1')]=function(){return client['Request'](_0xddb6('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xddb6('0x3')]},'log':'GetSettings'});}; \ No newline at end of file +var _0x31e0=['loginMailFrequency','GetSettings','../client','getSettings','Request','ShowSetting'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x31e0,0x92));var _0x031e=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0x31e0[_0x2e4aa2];return _0x5e6092;};'use strict';var client=require(_0x031e('0x0'));exports[_0x031e('0x1')]=function(){return client[_0x031e('0x2')](_0x031e('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x031e('0x4')]},'log':_0x031e('0x5')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index b056aeb..4b401a9 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(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'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(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'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 e143c61..204126d 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 _0x49e3=['websocket','defaults','redis','localhost','adapter','socket.io-redis','../../config/triggers','default','../../config/socketio','../../config/express','../../routes','once','listening','Express\x20server\x20listening\x20on\x20port\x20%d!','port','lodash','http','express','ioredis','createServer','timeout','socket.io'];(function(_0x4d53d0,_0x2ab50e){var _0x84c24=function(_0x5efbb4){while(--_0x5efbb4){_0x4d53d0['push'](_0x4d53d0['shift']());}};_0x84c24(++_0x2ab50e);}(_0x49e3,0x1dd));var _0x349e=function(_0x717e65,_0x5c7caa){_0x717e65=_0x717e65-0x0;var _0x3b7f95=_0x49e3[_0x717e65];return _0x3b7f95;};'use strict';var _=require(_0x349e('0x0'));var http=require(_0x349e('0x1'));var express=require(_0x349e('0x2'));var sticky=require('sticky-session');var Redis=require(_0x349e('0x3'));var config=require('../../config/environment');var app=express();var server=http[_0x349e('0x4')](app);server[_0x349e('0x5')]=0xdbba0;if(sticky['listen'](server,config['port'])){var socketio=require(_0x349e('0x6'))(server,{'transports':[_0x349e('0x7'),'polling']});config['redis']=_[_0x349e('0x8')](config[_0x349e('0x9')],{'host':_0x349e('0xa'),'port':0x18eb});socketio[_0x349e('0xb')](require(_0x349e('0xc'))({'pubClient':new Redis(config[_0x349e('0x9')]),'subClient':new Redis(config[_0x349e('0x9')])}));require(_0x349e('0xd'))[_0x349e('0xe')]();require(_0x349e('0xf'))[_0x349e('0xe')](socketio);require(_0x349e('0x10'))['default'](app);require(_0x349e('0x11'))['default'](app);}else{server[_0x349e('0x12')](_0x349e('0x13'),function(){console['log'](_0x349e('0x14'),config[_0x349e('0x15')]);});}exports=module['exports']=app; \ No newline at end of file +var _0x64da=['../../config/socketio','../../config/express','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','http','express','ioredis','../../config/environment','createServer','timeout','listen','port','socket.io','websocket','polling','redis','defaults','localhost','socket.io-redis','../../config/triggers','default'];(function(_0x7b544a,_0x33c45a){var _0x33dcb4=function(_0x5ebc7f){while(--_0x5ebc7f){_0x7b544a['push'](_0x7b544a['shift']());}};_0x33dcb4(++_0x33c45a);}(_0x64da,0x165));var _0xa64d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x64da[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xa64d('0x0'));var http=require(_0xa64d('0x1'));var express=require(_0xa64d('0x2'));var sticky=require('sticky-session');var Redis=require(_0xa64d('0x3'));var config=require(_0xa64d('0x4'));var app=express();var server=http[_0xa64d('0x5')](app);server[_0xa64d('0x6')]=0xdbba0;if(sticky[_0xa64d('0x7')](server,config[_0xa64d('0x8')])){var socketio=require(_0xa64d('0x9'))(server,{'transports':[_0xa64d('0xa'),_0xa64d('0xb')]});config[_0xa64d('0xc')]=_[_0xa64d('0xd')](config[_0xa64d('0xc')],{'host':_0xa64d('0xe'),'port':0x18eb});socketio['adapter'](require(_0xa64d('0xf'))({'pubClient':new Redis(config['redis']),'subClient':new Redis(config[_0xa64d('0xc')])}));require(_0xa64d('0x10'))[_0xa64d('0x11')]();require(_0xa64d('0x12'))[_0xa64d('0x11')](socketio);require(_0xa64d('0x13'))[_0xa64d('0x11')](app);require('../../routes')['default'](app);}else{server[_0xa64d('0x14')](_0xa64d('0x15'),function(){console[_0xa64d('0x16')](_0xa64d('0x17'),config[_0xa64d('0x8')]);});}exports=module[_0xa64d('0x18')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index c7643a1..05907c9 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 _0xfd0e=['../../config/logger','routing','http','Request','request','then','debug','error','rpc','message','result','exports','jayson/promise','bluebird'];(function(_0x21b36c,_0x543483){var _0x236627=function(_0x174f99){while(--_0x174f99){_0x21b36c['push'](_0x21b36c['shift']());}};_0x236627(++_0x543483);}(_0xfd0e,0x1b0));var _0xefd0=function(_0xb6e2ea,_0x3b26e9){_0xb6e2ea=_0xb6e2ea-0x0;var _0x2a57bb=_0xfd0e[_0xb6e2ea];return _0x2a57bb;};'use strict';var jayson=require(_0xefd0('0x0'));var BPromise=require(_0xefd0('0x1'));var logger=require(_0xefd0('0x2'))(_0xefd0('0x3'));var client=jayson['client'][_0xefd0('0x4')]({'port':0x2329});client[_0xefd0('0x5')]=function(_0x50102a,_0x2f7edc){return new BPromise(function(_0x965e81,_0x25448a){return client[_0xefd0('0x6')](_0x50102a,_0x2f7edc)[_0xefd0('0x7')](function(_0x3e3306){logger[_0xefd0('0x8')]('rpc',_0xefd0('0x3'),_0x50102a,_0x2f7edc,_0x3e3306);if(_0x3e3306[_0xefd0('0x9')]){logger[_0xefd0('0x9')](_0xefd0('0xa'),'routing',_0x50102a,_0x3e3306['error'][_0xefd0('0xb')],_0x2f7edc);return _0x25448a(_0x3e3306[_0xefd0('0x9')][_0xefd0('0xb')]);}else{return _0x965e81(_0x3e3306[_0xefd0('0xc')]);}})['catch'](function(_0x4e3dfa){logger[_0xefd0('0x9')](_0xefd0('0xa'),'routing',_0x50102a,_0x4e3dfa,_0x2f7edc);return _0x25448a(_0x4e3dfa);});});};module[_0xefd0('0xd')]=client; \ No newline at end of file +var _0x16dc=['bluebird','../../config/logger','routing','client','http','Request','request','then','debug','rpc','error','message','result','exports','jayson/promise'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x16dc,0x194));var _0xc16d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x16dc[_0x3dd15e];return _0x231fd0;};'use strict';var jayson=require(_0xc16d('0x0'));var BPromise=require(_0xc16d('0x1'));var logger=require(_0xc16d('0x2'))(_0xc16d('0x3'));var client=jayson[_0xc16d('0x4')][_0xc16d('0x5')]({'port':0x2329});client[_0xc16d('0x6')]=function(_0x3845e5,_0x1ad472){return new BPromise(function(_0x44ddb6,_0x25d303){return client[_0xc16d('0x7')](_0x3845e5,_0x1ad472)[_0xc16d('0x8')](function(_0x2fcf92){logger[_0xc16d('0x9')](_0xc16d('0xa'),'routing',_0x3845e5,_0x1ad472,_0x2fcf92);if(_0x2fcf92[_0xc16d('0xb')]){logger[_0xc16d('0xb')](_0xc16d('0xa'),'routing',_0x3845e5,_0x2fcf92[_0xc16d('0xb')][_0xc16d('0xc')],_0x1ad472);return _0x25d303(_0x2fcf92['error'][_0xc16d('0xc')]);}else{return _0x44ddb6(_0x2fcf92[_0xc16d('0xd')]);}})['catch'](function(_0x2848d9){logger[_0xc16d('0xb')](_0xc16d('0xa'),_0xc16d('0x3'),_0x3845e5,_0x2848d9,_0x1ad472);return _0x25d303(_0x2848d9);});});};module[_0xc16d('0xe')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index bf6eb57..4cab8e0 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 _0x527b=['./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','getAgents','then','initAgents','getIntervals','initIntervals','getChatQueues','initSmsQueues','initMailQueues','getFaxQueues','listen','catch','log','bluebird','./realtime','./rpc/user','./rpc/chatQueue','./rpc/smsQueue'];(function(_0x48af9e,_0x3b30d8){var _0x36eeb9=function(_0x3a3821){while(--_0x3a3821){_0x48af9e['push'](_0x48af9e['shift']());}};_0x36eeb9(++_0x3b30d8);}(_0x527b,0x10c));var _0xb527=function(_0x5de214,_0x107e9d){_0x5de214=_0x5de214-0x0;var _0x4df627=_0x527b[_0x5de214];return _0x4df627;};'use strict';var BPromise=require(_0xb527('0x0'));var server=require('./server');var Realtime=require(_0xb527('0x1'));var user=require(_0xb527('0x2'));var interval=require('./rpc/interval');var openchannelQueue=require('./rpc/openchannelQueue');var chatQueue=require(_0xb527('0x3'));var smsQueue=require(_0xb527('0x4'));var mailQueue=require(_0xb527('0x5'));var faxQueue=require(_0xb527('0x6'));var whatsappQueue=require(_0xb527('0x7'));var realtime=new Realtime();function initRealtime(){return BPromise[_0xb527('0x8')]()['then'](user[_0xb527('0x9')]())[_0xb527('0xa')](realtime[_0xb527('0xb')]())[_0xb527('0xa')](interval[_0xb527('0xc')]())[_0xb527('0xa')](realtime[_0xb527('0xd')]())['then'](openchannelQueue['getOpenchannelQueues']())[_0xb527('0xa')](realtime['initOpenchannelQueues']())[_0xb527('0xa')](chatQueue[_0xb527('0xe')]())[_0xb527('0xa')](realtime['initChatQueues']())['then'](smsQueue['getSmsQueues']())[_0xb527('0xa')](realtime[_0xb527('0xf')]())['then'](mailQueue['getMailQueues']())[_0xb527('0xa')](realtime[_0xb527('0x10')]())[_0xb527('0xa')](faxQueue[_0xb527('0x11')]())[_0xb527('0xa')](realtime['initFaxQueues']())[_0xb527('0xa')](whatsappQueue['getWhatsappQueues']())[_0xb527('0xa')](realtime['initWhatsappQueues']())[_0xb527('0xa')](function(){return realtime;});}function main(){return server[_0xb527('0x12')](realtime)[_0xb527('0xa')](function(_0x232e30){return initRealtime();})[_0xb527('0xa')](function(_0x61502c){return setInterval(initRealtime,0x1388);})[_0xb527('0x13')](function(_0xc2250e){console[_0xb527('0x14')](_0xc2250e);});}main(); \ No newline at end of file +var _0x8d68=['initSmsQueues','initMailQueues','getFaxQueues','getWhatsappQueues','catch','log','./server','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','resolve','getAgents','then','initAgents','getOpenchannelQueues','initOpenchannelQueues','initChatQueues','getSmsQueues'];(function(_0x23e488,_0x3fd169){var _0x9cc2c4=function(_0x250874){while(--_0x250874){_0x23e488['push'](_0x23e488['shift']());}};_0x9cc2c4(++_0x3fd169);}(_0x8d68,0xcc));var _0x88d6=function(_0x3c0bfa,_0x1904cb){_0x3c0bfa=_0x3c0bfa-0x0;var _0x25242a=_0x8d68[_0x3c0bfa];return _0x25242a;};'use strict';var BPromise=require('bluebird');var server=require(_0x88d6('0x0'));var Realtime=require(_0x88d6('0x1'));var user=require(_0x88d6('0x2'));var interval=require(_0x88d6('0x3'));var openchannelQueue=require(_0x88d6('0x4'));var chatQueue=require('./rpc/chatQueue');var smsQueue=require(_0x88d6('0x5'));var mailQueue=require(_0x88d6('0x6'));var faxQueue=require(_0x88d6('0x7'));var whatsappQueue=require('./rpc/whatsappQueue');var realtime=new Realtime();function initRealtime(){return BPromise[_0x88d6('0x8')]()['then'](user[_0x88d6('0x9')]())[_0x88d6('0xa')](realtime[_0x88d6('0xb')]())['then'](interval['getIntervals']())[_0x88d6('0xa')](realtime['initIntervals']())['then'](openchannelQueue[_0x88d6('0xc')]())[_0x88d6('0xa')](realtime[_0x88d6('0xd')]())[_0x88d6('0xa')](chatQueue['getChatQueues']())['then'](realtime[_0x88d6('0xe')]())[_0x88d6('0xa')](smsQueue[_0x88d6('0xf')]())[_0x88d6('0xa')](realtime[_0x88d6('0x10')]())[_0x88d6('0xa')](mailQueue['getMailQueues']())['then'](realtime[_0x88d6('0x11')]())['then'](faxQueue[_0x88d6('0x12')]())[_0x88d6('0xa')](realtime['initFaxQueues']())['then'](whatsappQueue[_0x88d6('0x13')]())[_0x88d6('0xa')](realtime['initWhatsappQueues']())[_0x88d6('0xa')](function(){return realtime;});}function main(){return server['listen'](realtime)[_0x88d6('0xa')](function(_0x27e91c){return initRealtime();})[_0x88d6('0xa')](function(_0x5de5d8){return setInterval(initRealtime,0x1388);})[_0x88d6('0x14')](function(_0x592680){console[_0x88d6('0x15')](_0x592680);});}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 dbd7a06..9c7ac59 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(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x1261,0x144));var _0x1126=function(_0x5c365f,_0x3b40ed){_0x5c365f=_0x5c365f-0x0;var _0x295e1b=_0x1261[_0x5c365f];return _0x295e1b;};'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 _0x326f=['orderBy','asc','result','clone','consequence','nextTick','push','isEqual','condition','call','matchPath','noop','matches','filter','turn','length','prioritize','findRules','priority','toJSON','map','toString','fromJSON','isString','lodash','EventEmitter','init','isNil','register','ignoreFactChanges','inherits','prototype','rules','activeRules','concat','isObject','sync'];(function(_0x558e45,_0x4f5e4f){var _0x3e9075=function(_0x289725){while(--_0x289725){_0x558e45['push'](_0x558e45['shift']());}};_0x3e9075(++_0x4f5e4f);}(_0x326f,0xd1));var _0xf326=function(_0x38f0f9,_0x4b1091){_0x38f0f9=_0x38f0f9-0x0;var _0x340464=_0x326f[_0x38f0f9];return _0x340464;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var EventEmitter=require('events')[_0xf326('0x1')];function RuleEngine(_0x330ddb,_0x22aabf){this[_0xf326('0x2')]();if(!_[_0xf326('0x3')](_0x330ddb)){this[_0xf326('0x4')](_0x330ddb);}if(_0x22aabf){this[_0xf326('0x5')]=_0x22aabf[_0xf326('0x5')];}return this;}util[_0xf326('0x6')](RuleEngine,EventEmitter);RuleEngine[_0xf326('0x7')]['init']=function(_0x3c254d){this[_0xf326('0x8')]=[];this[_0xf326('0x9')]=[];};RuleEngine[_0xf326('0x7')]['register']=function(_0x4c206c){if(Array['isArray'](_0x4c206c)){this[_0xf326('0x8')]=this[_0xf326('0x8')][_0xf326('0xa')](_0x4c206c);}else if(_0x4c206c!==null&&_[_0xf326('0xb')](_0x4c206c)){this[_0xf326('0x8')]['push'](_0x4c206c);}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0xc')]=function(){this['activeRules']=this[_0xf326('0x8')]['filter'](function(_0x3162f9){if(_[_0xf326('0x3')](_0x3162f9['on'])){_0x3162f9['on']=!![];}if(_0x3162f9['on']===!![]){return _0x3162f9;}});this['activeRules']=_[_0xf326('0xd')](this[_0xf326('0x9')],['p'],[_0xf326('0xe')]);};RuleEngine[_0xf326('0x7')]['execute']=function(_0x45c1b6,_0x5204ee){var _0x54bd1a=![];_0x45c1b6[_0xf326('0xf')]=!![];var _0x11f6d2=_[_0xf326('0x10')](_0x45c1b6);var _0xa63d1a=_[_0xf326('0x10')](_0x45c1b6);var _0x287a2a=this[_0xf326('0x9')];var _0x2cf2ca=[];var _0x5a682a=this[_0xf326('0x5')];(function FnRuleLoop(_0x453100){var _0x18bee3={'rules':function(){return _0x287a2a;},'rule':function(){return _0x287a2a[_0x453100];},'when':function(_0x31ffb9){if(_0x31ffb9){var _0xcef2b5=_0x287a2a[_0x453100][_0xf326('0x11')];_0xcef2b5['ruleRef']=_0x287a2a[_0x453100]['id']||_0x287a2a[_0x453100]['name']||'index_'+_0x453100;process[_0xf326('0x12')](function(){_0x2cf2ca[_0xf326('0x13')](_0xcef2b5['ruleRef']);_0xcef2b5['call'](_0x11f6d2,_0x18bee3);});}else{process[_0xf326('0x12')](function(){_0x18bee3['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x54bd1a=!![];return FnRuleLoop(0x0);},'next':function(_0x5b6d3c){if(!_0x5a682a&&!_[_0xf326('0x14')](_0xa63d1a,_0x11f6d2)){_0xa63d1a=_[_0xf326('0x10')](_0x11f6d2);process['nextTick'](function(){_0x18bee3['restart']();});}else{process[_0xf326('0x12')](function(){if(_[_0xf326('0x3')](_0x5b6d3c)){return FnRuleLoop(_0x453100+0x1);}else{return FnRuleLoop(_0x5b6d3c);}});}}};if(_0x453100<_0x287a2a['length']&&_0x54bd1a===![]){var _0x337ed5=_0x287a2a[_0x453100][_0xf326('0x15')];_0x337ed5[_0xf326('0x16')](_0x11f6d2,_0x18bee3);}else{process[_0xf326('0x12')](function(){_0x11f6d2[_0xf326('0x17')]=_0x2cf2ca;return _0x5204ee?_0x5204ee(_0x11f6d2):_[_0xf326('0x18')]();});}}(0x0));};RuleEngine['prototype']['findRules']=function(_0x4f31f6){if(_[_0xf326('0x3')](_0x4f31f6)){return this[_0xf326('0x8')];}else{var _0x2cd45a=_[_0xf326('0x19')](_0x4f31f6);return _[_0xf326('0x1a')](this[_0xf326('0x8')],_0x2cd45a);}};RuleEngine['prototype'][_0xf326('0x1b')]=function(_0xa3c0b,_0x212d5d){var _0x581531=_0xa3c0b==='on'||_0xa3c0b==='ON'?!![]:![];var _0x1617d2=this['findRules'](_0x212d5d);for(var _0x4a9abf=0x0,_0x6a8e89=_0x1617d2[_0xf326('0x1c')];_0x4a9abf<_0x6a8e89;_0x4a9abf+=0x1){_0x1617d2[_0x4a9abf]['on']=_0x581531;}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0x1d')]=function(_0x292500,_0x55790d){_0x292500=parseInt(_0x292500,0xa);var _0x225776=this[_0xf326('0x1e')](_0x55790d);for(var _0xd77aba=0x0,_0x18d110=_0x225776[_0xf326('0x1c')];_0xd77aba<_0x18d110;_0xd77aba+=0x1){_0x225776[_0xd77aba][_0xf326('0x1f')]=_0x292500;}this[_0xf326('0xc')]();};RuleEngine[_0xf326('0x7')][_0xf326('0x20')]=function(){var _0x349a03=this['rules'];if(_0x349a03 instanceof Array){_0x349a03=_0x349a03[_0xf326('0x21')](function(_0x424104){_0x424104[_0xf326('0x15')]=_0x424104['condition'][_0xf326('0x22')]();_0x424104[_0xf326('0x11')]=_0x424104[_0xf326('0x11')]['toString']();return _0x424104;});}else if(!_['isNil'](_0x349a03)){_0x349a03[_0xf326('0x15')]=_0x349a03[_0xf326('0x15')][_0xf326('0x22')]();_0x349a03[_0xf326('0x11')]=_0x349a03[_0xf326('0x11')][_0xf326('0x22')]();}return _0x349a03;};RuleEngine[_0xf326('0x7')][_0xf326('0x23')]=function(_0x580374){this[_0xf326('0x2')]();if(_[_0xf326('0x24')](_0x580374)){_0x580374=JSON['parse'](_0x580374);}if(_0x580374 instanceof Array){_0x580374=_0x580374[_0xf326('0x21')](function(_0x4e5d7c){_0x4e5d7c[_0xf326('0x15')]=eval('('+_0x4e5d7c['condition']+')');_0x4e5d7c['consequence']=eval('('+_0x4e5d7c[_0xf326('0x11')]+')');return _0x4e5d7c;});}else if(_0x580374!==null&&typeof _0x580374=='object'){_0x580374[_0xf326('0x15')]=eval('('+_0x580374['condition']+')');_0x580374[_0xf326('0x11')]=eval('('+_0x580374[_0xf326('0x11')]+')');}this[_0xf326('0x4')](_0x580374);};module['exports']=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 91c4986..86d4526 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 _0x93d5=['then','error','catch','sendMailMessage','SendMail','client','http'];(function(_0x5d80de,_0x2cf15d){var _0x1c7556=function(_0x5bd806){while(--_0x5bd806){_0x5d80de['push'](_0x5d80de['shift']());}};_0x1c7556(++_0x2cf15d);}(_0x93d5,0x83));var _0x593d=function(_0x2f3ee8,_0x104b39){_0x2f3ee8=_0x2f3ee8-0x0;var _0x1e9ce0=_0x93d5[_0x2f3ee8];return _0x1e9ce0;};'use strict';var BPromise=require('bluebird');var jayson=require('jayson/promise');var client=jayson[_0x593d('0x0')][_0x593d('0x1')]({'port':0x232b});function request(_0x336eeb,_0x4951c8){return new BPromise(function(_0x567649,_0x4c09e8){return client['request'](_0x336eeb,_0x4951c8)[_0x593d('0x2')](function(_0x3edfca){if(_0x3edfca[_0x593d('0x3')]){return _0x4c09e8(_0x3edfca[_0x593d('0x3')]['message']);}else{return _0x567649(_0x3edfca['result']);}})[_0x593d('0x4')](function(_0x2045ba){return _0x4c09e8(_0x2045ba);});});}exports[_0x593d('0x5')]=function(_0x55502e,_0x264e29){return request(_0x593d('0x6'),{'account':_0x55502e,'message':_0x264e29});}; \ No newline at end of file +var _0xe34b=['error','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request'];(function(_0x342700,_0x569f75){var _0x53406f=function(_0x3b3c32){while(--_0x3b3c32){_0x342700['push'](_0x342700['shift']());}};_0x53406f(++_0x569f75);}(_0xe34b,0xc1));var _0xbe34=function(_0x2b31a8,_0x28b862){_0x2b31a8=_0x2b31a8-0x0;var _0x1175a5=_0xe34b[_0x2b31a8];return _0x1175a5;};'use strict';var BPromise=require(_0xbe34('0x0'));var jayson=require(_0xbe34('0x1'));var client=jayson[_0xbe34('0x2')][_0xbe34('0x3')]({'port':0x232b});function request(_0x44a407,_0x10165e){return new BPromise(function(_0x3a1c3b,_0x453b38){return client[_0xbe34('0x4')](_0x44a407,_0x10165e)['then'](function(_0x2a4e2b){if(_0x2a4e2b[_0xbe34('0x5')]){return _0x453b38(_0x2a4e2b['error']['message']);}else{return _0x3a1c3b(_0x2a4e2b['result']);}})[_0xbe34('0x6')](function(_0x2ba058){return _0x453b38(_0x2ba058);});});}exports[_0xbe34('0x7')]=function(_0x140d54,_0x2b7a93){return request(_0xbe34('0x8'),{'account':_0x140d54,'message':_0x2b7a93});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index b05d29f..7dfe032 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 _0x43b7=['mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','updateRealtime','getChannelStatus','Capacity','CurrentCapacity','maxcapacity','prototype','chat','openchannel','fax','sms','whatsapp','length','StatusTime','toNumber','format','voicePause','smsStatusTime','smsCurrentCapacity','openchannelStatusTime','stringify','md5','emit','exports','lodash','ioredis','redis','defaults','socket.io-emitter','name','online','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity'];(function(_0xeecc25,_0x3814a3){var _0x2df18b=function(_0x1192b4){while(--_0x1192b4){_0xeecc25['push'](_0xeecc25['shift']());}};_0x2df18b(++_0x3814a3);}(_0x43b7,0x183));var _0x743b=function(_0x143ef4,_0x483593){_0x143ef4=_0x143ef4-0x0;var _0x32e266=_0x43b7[_0x143ef4];return _0x32e266;};'use strict';var _=require(_0x743b('0x0'));var moment=require('moment');var md5=require('md5');var Redis=require(_0x743b('0x1'));var config=require('../../../config/environment');config[_0x743b('0x2')]=_[_0x743b('0x3')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x743b('0x4'))(new Redis(config[_0x743b('0x2')]));function Agent(_0xf029){this['id']=_0xf029['id']||0x0;this[_0x743b('0x5')]=_0xf029[_0x743b('0x5')]||'';this[_0x743b('0x6')]=_0xf029[_0x743b('0x6')]||!![];this['voicePause']=_0xf029['voicePause']||![];this['chatPause']=_0xf029['chatPause']||![];this['mailPause']=_0xf029[_0x743b('0x7')]||![];this[_0x743b('0x8')]=_0xf029['faxPause']||![];this[_0x743b('0x9')]=_0xf029['smsPause']||![];this[_0x743b('0xa')]=_0xf029[_0x743b('0xa')]||![];this[_0x743b('0xb')]=_0x743b('0xc');this[_0x743b('0xd')]=0x0;this[_0x743b('0xe')]=_0xf029[_0x743b('0xe')]||0x0;this[_0x743b('0xf')]=0x0;this[_0x743b('0x10')]=_0x743b('0xc');this[_0x743b('0x11')]=0x0;this['mailCapacity']=_0xf029[_0x743b('0x12')]||0x0;this[_0x743b('0x13')]=0x0;this[_0x743b('0x14')]=_0x743b('0xc');this[_0x743b('0x15')]=0x0;this['faxCapacity']=_0xf029[_0x743b('0x16')]||0x0;this[_0x743b('0x17')]=0x0;this[_0x743b('0x18')]=_0x743b('0xc');this['smsStatusTime']=0x0;this['smsCapacity']=_0xf029[_0x743b('0x19')]||0x0;this['smsCurrentCapacity']=0x0;this[_0x743b('0x1a')]=_0x743b('0xc');this[_0x743b('0x1b')]=0x0;this[_0x743b('0x1c')]=_0xf029[_0x743b('0x1c')]||0x0;this[_0x743b('0x1d')]=0x0;this[_0x743b('0x1e')]=_0x743b('0xc');this['openchannelStatusTime']=0x0;this[_0x743b('0x1f')]=_0xf029['openchannelCapacity']||0x0;this[_0x743b('0x20')]=0x0;this[_0x743b('0x21')]=![];this[_0x743b('0x22')]=undefined;this['md5']='';this[_0x743b('0x23')]();}Agent['prototype'][_0x743b('0x24')]=function(_0x375fd1){if(this[_0x375fd1+'CurrentCapacity']>0x0){if(this[_0x375fd1+_0x743b('0x25')]>0x0&&this[_0x375fd1+_0x743b('0x26')]>=this[_0x375fd1+_0x743b('0x25')]){return _0x743b('0x27');}else{return'working';}}else{return'idle';}};Agent[_0x743b('0x28')][_0x743b('0x23')]=function(){var _0xfacf67=['mail',_0x743b('0x29'),_0x743b('0x2a'),_0x743b('0x2b'),_0x743b('0x2c'),_0x743b('0x2d')];for(var _0x1b8290=0x0;_0x1b8290<_0xfacf67[_0x743b('0x2e')];_0x1b8290+=0x1){var _0x3ef25e=this[_0x743b('0x24')](_0xfacf67[_0x1b8290]);if(this[_0xfacf67[_0x1b8290]+'Status']!==_0x3ef25e){this[_0xfacf67[_0x1b8290]+_0x743b('0x2f')]=_[_0x743b('0x30')](moment()[_0x743b('0x31')]('x'));}this[_0xfacf67[_0x1b8290]+'Status']=_0x3ef25e;}var _0x2f8c31={'id':this['id'],'name':this[_0x743b('0x5')],'online':this[_0x743b('0x6')],'voicePause':this[_0x743b('0x32')],'chatPause':this['chatPause'],'mailPause':this['mailPause'],'smsPause':this[_0x743b('0x9')],'faxPause':this['faxPause'],'openchannelPause':this[_0x743b('0xa')],'chatStatus':this[_0x743b('0xb')],'chatStatusTime':this[_0x743b('0xd')],'chatCapacity':this[_0x743b('0xe')],'chatCurrentCapacity':this[_0x743b('0xf')],'mailStatus':this[_0x743b('0x10')],'mailStatusTime':this[_0x743b('0x11')],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this[_0x743b('0x14')],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this[_0x743b('0x17')],'smsStatus':this['smsStatus'],'smsStatusTime':this[_0x743b('0x33')],'smsCapacity':this[_0x743b('0x19')],'smsCurrentCapacity':this[_0x743b('0x34')],'whatsappStatus':this[_0x743b('0x1a')],'whatsappStatusTime':this[_0x743b('0x1b')],'whatsappCapacity':this[_0x743b('0x1c')],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this[_0x743b('0x35')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this['busy'],'busyQueue':this[_0x743b('0x22')]};var _0x3310fb=md5(JSON[_0x743b('0x36')](_0x2f8c31));if(this[_0x743b('0x37')]!==_0x3310fb){this[_0x743b('0x37')]=_0x3310fb;io[_0x743b('0x38')]('user:save',_0x2f8c31);}};module[_0x743b('0x39')]=Agent; \ No newline at end of file +var _0x81b8=['md5','ioredis','../../../config/environment','redis','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','unknown','chatStatusTime','chatCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busyQueue','updateRealtime','prototype','CurrentCapacity','maxcapacity','working','idle','mail','chat','openchannel','fax','whatsapp','length','Status','StatusTime','format','chatCurrentCapacity','smsStatusTime','smsCurrentCapacity','busy','emit','exports','lodash','moment'];(function(_0x285ab6,_0x1185c3){var _0xc751ed=function(_0x5adfc0){while(--_0x5adfc0){_0x285ab6['push'](_0x285ab6['shift']());}};_0xc751ed(++_0x1185c3);}(_0x81b8,0x1ce));var _0x881b=function(_0x41d79e,_0x57b1c6){_0x41d79e=_0x41d79e-0x0;var _0x3de53d=_0x81b8[_0x41d79e];return _0x3de53d;};'use strict';var _=require(_0x881b('0x0'));var moment=require(_0x881b('0x1'));var md5=require(_0x881b('0x2'));var Redis=require(_0x881b('0x3'));var config=require(_0x881b('0x4'));config[_0x881b('0x5')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x881b('0x6'))(new Redis(config['redis']));function Agent(_0x3d325c){this['id']=_0x3d325c['id']||0x0;this[_0x881b('0x7')]=_0x3d325c[_0x881b('0x7')]||'';this[_0x881b('0x8')]=_0x3d325c[_0x881b('0x8')]||!![];this['voicePause']=_0x3d325c[_0x881b('0x9')]||![];this[_0x881b('0xa')]=_0x3d325c['chatPause']||![];this[_0x881b('0xb')]=_0x3d325c[_0x881b('0xb')]||![];this[_0x881b('0xc')]=_0x3d325c['faxPause']||![];this[_0x881b('0xd')]=_0x3d325c[_0x881b('0xd')]||![];this[_0x881b('0xe')]=_0x3d325c[_0x881b('0xe')]||![];this['chatStatus']=_0x881b('0xf');this[_0x881b('0x10')]=0x0;this['chatCapacity']=_0x3d325c[_0x881b('0x11')]||0x0;this['chatCurrentCapacity']=0x0;this[_0x881b('0x12')]=_0x881b('0xf');this[_0x881b('0x13')]=0x0;this[_0x881b('0x14')]=_0x3d325c[_0x881b('0x14')]||0x0;this[_0x881b('0x15')]=0x0;this[_0x881b('0x16')]=_0x881b('0xf');this[_0x881b('0x17')]=0x0;this[_0x881b('0x18')]=_0x3d325c[_0x881b('0x18')]||0x0;this[_0x881b('0x19')]=0x0;this[_0x881b('0x1a')]='unknown';this['smsStatusTime']=0x0;this[_0x881b('0x1b')]=_0x3d325c['smsCapacity']||0x0;this['smsCurrentCapacity']=0x0;this[_0x881b('0x1c')]=_0x881b('0xf');this[_0x881b('0x1d')]=0x0;this[_0x881b('0x1e')]=_0x3d325c[_0x881b('0x1e')]||0x0;this[_0x881b('0x1f')]=0x0;this[_0x881b('0x20')]='unknown';this[_0x881b('0x21')]=0x0;this['openchannelCapacity']=_0x3d325c[_0x881b('0x22')]||0x0;this[_0x881b('0x23')]=0x0;this['busy']=![];this[_0x881b('0x24')]=undefined;this[_0x881b('0x2')]='';this[_0x881b('0x25')]();}Agent[_0x881b('0x26')]['getChannelStatus']=function(_0x2f70ac){if(this[_0x2f70ac+_0x881b('0x27')]>0x0){if(this[_0x2f70ac+'Capacity']>0x0&&this[_0x2f70ac+'CurrentCapacity']>=this[_0x2f70ac+'Capacity']){return _0x881b('0x28');}else{return _0x881b('0x29');}}else{return _0x881b('0x2a');}};Agent[_0x881b('0x26')][_0x881b('0x25')]=function(){var _0x5042eb=[_0x881b('0x2b'),_0x881b('0x2c'),_0x881b('0x2d'),_0x881b('0x2e'),'sms',_0x881b('0x2f')];for(var _0x24e3ce=0x0;_0x24e3ce<_0x5042eb[_0x881b('0x30')];_0x24e3ce+=0x1){var _0x49b4af=this['getChannelStatus'](_0x5042eb[_0x24e3ce]);if(this[_0x5042eb[_0x24e3ce]+_0x881b('0x31')]!==_0x49b4af){this[_0x5042eb[_0x24e3ce]+_0x881b('0x32')]=_['toNumber'](moment()[_0x881b('0x33')]('x'));}this[_0x5042eb[_0x24e3ce]+_0x881b('0x31')]=_0x49b4af;}var _0xb53a17={'id':this['id'],'name':this['name'],'online':this[_0x881b('0x8')],'voicePause':this[_0x881b('0x9')],'chatPause':this[_0x881b('0xa')],'mailPause':this[_0x881b('0xb')],'smsPause':this[_0x881b('0xd')],'faxPause':this[_0x881b('0xc')],'openchannelPause':this['openchannelPause'],'chatStatus':this['chatStatus'],'chatStatusTime':this[_0x881b('0x10')],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this[_0x881b('0x34')],'mailStatus':this[_0x881b('0x12')],'mailStatusTime':this[_0x881b('0x13')],'mailCapacity':this[_0x881b('0x14')],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this[_0x881b('0x16')],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this[_0x881b('0x18')],'faxCurrentCapacity':this[_0x881b('0x19')],'smsStatus':this['smsStatus'],'smsStatusTime':this[_0x881b('0x35')],'smsCapacity':this[_0x881b('0x1b')],'smsCurrentCapacity':this[_0x881b('0x36')],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this[_0x881b('0x1e')],'whatsappCurrentCapacity':this[_0x881b('0x1f')],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this[_0x881b('0x22')],'openchannelCurrentCapacity':this[_0x881b('0x23')],'busy':this[_0x881b('0x37')],'busyQueue':this[_0x881b('0x24')]};var _0x4ffbf7=md5(JSON['stringify'](_0xb53a17));if(this['md5']!==_0x4ffbf7){this[_0x881b('0x2')]=_0x4ffbf7;io[_0x881b('0x38')]('user:save',_0xb53a17);}};module[_0x881b('0x39')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index a6a6c39..cd4fe21 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 _0x3be0=['chat:queue:%s','emit','chat_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','_rr','loggedIn','length','online','paused','available','format'];(function(_0x5b306a,_0x74687d){var _0x49b59a=function(_0x1e1072){while(--_0x1e1072){_0x5b306a['push'](_0x5b306a['shift']());}};_0x49b59a(++_0x74687d);}(_0x3be0,0x70));var _0x03be=function(_0x5de532,_0x2941c4){_0x5de532=_0x5de532-0x0;var _0x4e9192=_0x3be0[_0x5de532];return _0x4e9192;};'use strict';var _=require(_0x03be('0x0'));var md5=require(_0x03be('0x1'));var util=require('util');var Redis=require(_0x03be('0x2'));var config=require(_0x03be('0x3'));config[_0x03be('0x4')]=_[_0x03be('0x5')](config[_0x03be('0x4')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x03be('0x4')]));function ChatQueue(_0x517a23){this['id']=_0x517a23['id']||0x0;this['name']=_0x517a23[_0x03be('0x6')]||'';this[_0x03be('0x7')]=_0x517a23[_0x03be('0x7')]||0xa;this[_0x03be('0x8')]=_0x517a23[_0x03be('0x8')]||'beepall';this[_0x03be('0x9')]=_0x517a23[_0x03be('0x9')];this[_0x03be('0xa')]={};this[_0x03be('0xb')]=0x0;this['md5']='';this[_0x03be('0xc')]();this[_0x03be('0xd')]();}ChatQueue[_0x03be('0xe')][_0x03be('0xc')]=function(){var _0x396568=this[_0x03be('0xa')]['_rr'];this[_0x03be('0xa')]=_[_0x03be('0xf')](this[_0x03be('0x9')],'id');this[_0x03be('0xa')][_0x03be('0x10')]=_0x396568;};ChatQueue[_0x03be('0xe')][_0x03be('0xd')]=function(){this[_0x03be('0x11')]=0x0;this['paused']=0x0;for(var _0x2d6aa8=0x0;_0x2d6aa8=0x0?this[_0x03be('0x15')]:0x0;var _0x37b470={'id':this['id'],'available':this[_0x03be('0x15')],'loggedIn':this[_0x03be('0x11')],'name':this[_0x03be('0x6')],'paused':this[_0x03be('0x14')],'waiting':this[_0x03be('0xb')]};var _0x187209=md5(JSON['stringify'](_0x37b470));if(this[_0x03be('0x1')]!==_0x187209){this[_0x03be('0x1')]=_0x187209;io['to'](util[_0x03be('0x16')](_0x03be('0x17'),_0x37b470[_0x03be('0x6')]))[_0x03be('0x18')](_0x03be('0x19'),_0x37b470);}};module[_0x03be('0x1a')]=ChatQueue; \ No newline at end of file +var _0x252a=['stringify','format','chat:queue:%s','emit','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','chatPause','available','waiting'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x252a,0x85));var _0xa252=function(_0x3b7388,_0x32a3e1){_0x3b7388=_0x3b7388-0x0;var _0x1f50f8=_0x252a[_0x3b7388];return _0x1f50f8;};'use strict';var _=require(_0xa252('0x0'));var md5=require(_0xa252('0x1'));var util=require(_0xa252('0x2'));var Redis=require(_0xa252('0x3'));var config=require(_0xa252('0x4'));config[_0xa252('0x5')]=_[_0xa252('0x6')](config[_0xa252('0x5')],{'host':_0xa252('0x7'),'port':0x18eb});var io=require(_0xa252('0x8'))(new Redis(config['redis']));function ChatQueue(_0x43e6a0){this['id']=_0x43e6a0['id']||0x0;this[_0xa252('0x9')]=_0x43e6a0['name']||'';this['timeout']=_0x43e6a0[_0xa252('0xa')]||0xa;this[_0xa252('0xb')]=_0x43e6a0[_0xa252('0xb')]||_0xa252('0xc');this[_0xa252('0xd')]=_0x43e6a0['Agents'];this[_0xa252('0xe')]={};this['waiting']=0x0;this[_0xa252('0x1')]='';this[_0xa252('0xf')]();this[_0xa252('0x10')]();}ChatQueue[_0xa252('0x11')]['updateRouting']=function(){var _0x2cc50d=this[_0xa252('0xe')][_0xa252('0x12')];this['mapAgentsId']=_[_0xa252('0x13')](this['Agents'],'id');this['mapAgentsId']['_rr']=_0x2cc50d;};ChatQueue[_0xa252('0x11')][_0xa252('0x10')]=function(){this[_0xa252('0x14')]=0x0;this[_0xa252('0x15')]=0x0;for(var _0x249636=0x0;_0x249636=0x0?this[_0xa252('0x19')]:0x0;var _0x2a95f9={'id':this['id'],'available':this[_0xa252('0x19')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0xa252('0x15')],'waiting':this[_0xa252('0x1a')]};var _0x394a60=md5(JSON[_0xa252('0x1b')](_0x2a95f9));if(this[_0xa252('0x1')]!==_0x394a60){this[_0xa252('0x1')]=_0x394a60;io['to'](util[_0xa252('0x1c')](_0xa252('0x1d'),_0x2a95f9[_0xa252('0x9')]))[_0xa252('0x1e')]('chat_queue:save',_0x2a95f9);}};module[_0xa252('0x1f')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 31f49f7..62802da 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 _0xa25a=['fax:queue:%s','emit','fax_queue:save','exports','lodash','md5','util','ioredis','defaults','redis','localhost','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','_rr','map','mapAgentsId','loggedIn','paused','length','available','stringify'];(function(_0x55350e,_0x9c8c57){var _0x41e775=function(_0xd4fbff){while(--_0xd4fbff){_0x55350e['push'](_0x55350e['shift']());}};_0x41e775(++_0x9c8c57);}(_0xa25a,0x138));var _0xaa25=function(_0x1d735d,_0x4251c3){_0x1d735d=_0x1d735d-0x0;var _0x252798=_0xa25a[_0x1d735d];return _0x252798;};'use strict';var _=require(_0xaa25('0x0'));var md5=require(_0xaa25('0x1'));var util=require(_0xaa25('0x2'));var Redis=require(_0xaa25('0x3'));var config=require('../../../config/environment');config['redis']=_[_0xaa25('0x4')](config[_0xaa25('0x5')],{'host':_0xaa25('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xaa25('0x5')]));function FaxQueue(_0x5aef1e){this['id']=_0x5aef1e['id']||0x0;this[_0xaa25('0x7')]=_0x5aef1e[_0xaa25('0x7')]||'';this['timeout']=_0x5aef1e[_0xaa25('0x8')]||0xa;this[_0xaa25('0x9')]=_0x5aef1e[_0xaa25('0x9')]||_0xaa25('0xa');this['Agents']=_0x5aef1e[_0xaa25('0xb')];this['mapAgentsId']={};this[_0xaa25('0xc')]=0x0;this[_0xaa25('0x1')]='';this[_0xaa25('0xd')]();this[_0xaa25('0xe')]();}FaxQueue[_0xaa25('0xf')][_0xaa25('0xd')]=function(){var _0x94fe28=this['mapAgentsId'][_0xaa25('0x10')];this['mapAgentsId']=_[_0xaa25('0x11')](this[_0xaa25('0xb')],'id');this[_0xaa25('0x12')][_0xaa25('0x10')]=_0x94fe28;};FaxQueue['prototype'][_0xaa25('0xe')]=function(){this[_0xaa25('0x13')]=0x0;this[_0xaa25('0x14')]=0x0;for(var _0x4fe015=0x0;_0x4fe015=0x0?this[_0xaa25('0x16')]:0x0;var _0x48553b={'id':this['id'],'available':this[_0xaa25('0x16')],'loggedIn':this[_0xaa25('0x13')],'name':this[_0xaa25('0x7')],'paused':this[_0xaa25('0x14')],'waiting':this[_0xaa25('0xc')]};var _0x3969fa=md5(JSON[_0xaa25('0x17')](_0x48553b));if(this[_0xaa25('0x1')]!==_0x3969fa){this['md5']=_0x3969fa;io['to'](util['format'](_0xaa25('0x18'),_0x48553b[_0xaa25('0x7')]))[_0xaa25('0x19')](_0xaa25('0x1a'),_0x48553b);}};module[_0xaa25('0x1b')]=FaxQueue; \ No newline at end of file +var _0xbf55=['timeout','beepall','Agents','mapAgentsId','waiting','updateRouting','prototype','_rr','map','updateRealtime','loggedIn','online','faxPause','available','format','emit','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xbf55,0x1a6));var _0x5bf5=function(_0x56172a,_0x4e9617){_0x56172a=_0x56172a-0x0;var _0x259380=_0xbf55[_0x56172a];return _0x259380;};'use strict';var _=require(_0x5bf5('0x0'));var md5=require(_0x5bf5('0x1'));var util=require(_0x5bf5('0x2'));var Redis=require(_0x5bf5('0x3'));var config=require(_0x5bf5('0x4'));config[_0x5bf5('0x5')]=_[_0x5bf5('0x6')](config[_0x5bf5('0x5')],{'host':_0x5bf5('0x7'),'port':0x18eb});var io=require(_0x5bf5('0x8'))(new Redis(config['redis']));function FaxQueue(_0x175056){this['id']=_0x175056['id']||0x0;this[_0x5bf5('0x9')]=_0x175056[_0x5bf5('0x9')]||'';this[_0x5bf5('0xa')]=_0x175056['timeout']||0xa;this['strategy']=_0x175056['strategy']||_0x5bf5('0xb');this[_0x5bf5('0xc')]=_0x175056['Agents'];this[_0x5bf5('0xd')]={};this[_0x5bf5('0xe')]=0x0;this['md5']='';this[_0x5bf5('0xf')]();this['updateRealtime']();}FaxQueue[_0x5bf5('0x10')][_0x5bf5('0xf')]=function(){var _0x4a9188=this[_0x5bf5('0xd')][_0x5bf5('0x11')];this[_0x5bf5('0xd')]=_[_0x5bf5('0x12')](this[_0x5bf5('0xc')],'id');this[_0x5bf5('0xd')][_0x5bf5('0x11')]=_0x4a9188;};FaxQueue[_0x5bf5('0x10')][_0x5bf5('0x13')]=function(){this[_0x5bf5('0x14')]=0x0;this['paused']=0x0;for(var _0x11ac6b=0x0;_0x11ac6b=0x0?this[_0x5bf5('0x17')]:0x0;var _0x67abd9={'id':this['id'],'available':this[_0x5bf5('0x17')],'loggedIn':this[_0x5bf5('0x14')],'name':this[_0x5bf5('0x9')],'paused':this['paused'],'waiting':this[_0x5bf5('0xe')]};var _0x19a44c=md5(JSON['stringify'](_0x67abd9));if(this[_0x5bf5('0x1')]!==_0x19a44c){this['md5']=_0x19a44c;io['to'](util[_0x5bf5('0x18')]('fax:queue:%s',_0x67abd9[_0x5bf5('0x9')]))[_0x5bf5('0x19')]('fax_queue:save',_0x67abd9);}};module[_0x5bf5('0x1a')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index a453a41..5ccad36 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 _0x94ae=['name','Intervals','exports'];(function(_0x38396e,_0x39b8ad){var _0x1b2fff=function(_0x5e4152){while(--_0x5e4152){_0x38396e['push'](_0x38396e['shift']());}};_0x1b2fff(++_0x39b8ad);}(_0x94ae,0xff));var _0xe94a=function(_0x1bd75a,_0x5ad951){_0x1bd75a=_0x1bd75a-0x0;var _0x4230e5=_0x94ae[_0x1bd75a];return _0x4230e5;};'use strict';function Interval(_0x590f7b){this['id']=_0x590f7b['id']||0x0;this[_0xe94a('0x0')]=_0x590f7b[_0xe94a('0x0')]||'';this[_0xe94a('0x1')]=_0x590f7b['Intervals']||{};}module[_0xe94a('0x2')]=Interval; \ No newline at end of file +var _0x44aa=['name','exports'];(function(_0x3fd02d,_0x513618){var _0x489f83=function(_0x1ebd62){while(--_0x1ebd62){_0x3fd02d['push'](_0x3fd02d['shift']());}};_0x489f83(++_0x513618);}(_0x44aa,0x82));var _0xa44a=function(_0xc595e4,_0x3bbd8f){_0xc595e4=_0xc595e4-0x0;var _0x4d1cc3=_0x44aa[_0xc595e4];return _0x4d1cc3;};'use strict';function Interval(_0x2b657c){this['id']=_0x2b657c['id']||0x0;this[_0xa44a('0x0')]=_0x2b657c['name']||'';this['Intervals']=_0x2b657c['Intervals']||{};}module[_0xa44a('0x1')]=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index b9a3040..7f8a72b 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 _0x8e9e=['md5','util','ioredis','../../../config/environment','defaults','redis','socket.io-emitter','name','timeout','strategy','Agents','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','loggedIn','paused','online','mailPause','available','format','exports','lodash'];(function(_0x9bb8fd,_0x1a4f7c){var _0x295bb0=function(_0x688b1f){while(--_0x688b1f){_0x9bb8fd['push'](_0x9bb8fd['shift']());}};_0x295bb0(++_0x1a4f7c);}(_0x8e9e,0x176));var _0xe8e9=function(_0x11ba46,_0x1d6752){_0x11ba46=_0x11ba46-0x0;var _0x1c8c6f=_0x8e9e[_0x11ba46];return _0x1c8c6f;};'use strict';var _=require(_0xe8e9('0x0'));var md5=require(_0xe8e9('0x1'));var util=require(_0xe8e9('0x2'));var Redis=require(_0xe8e9('0x3'));var config=require(_0xe8e9('0x4'));config['redis']=_[_0xe8e9('0x5')](config[_0xe8e9('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0xe8e9('0x7'))(new Redis(config[_0xe8e9('0x6')]));function MailQueue(_0x26274a){this['id']=_0x26274a['id']||0x0;this[_0xe8e9('0x8')]=_0x26274a[_0xe8e9('0x8')]||'';this['timeout']=_0x26274a[_0xe8e9('0x9')]||0xa;this[_0xe8e9('0xa')]=_0x26274a[_0xe8e9('0xa')]||'beepall';this[_0xe8e9('0xb')]=_0x26274a['Agents'];this['mapAgentsId']={};this[_0xe8e9('0xc')]=0x0;this[_0xe8e9('0x1')]='';this[_0xe8e9('0xd')]();this[_0xe8e9('0xe')]();}MailQueue[_0xe8e9('0xf')][_0xe8e9('0xd')]=function(){var _0x1bbc5d=this[_0xe8e9('0x10')]['_rr'];this[_0xe8e9('0x10')]=_['map'](this[_0xe8e9('0xb')],'id');this[_0xe8e9('0x10')][_0xe8e9('0x11')]=_0x1bbc5d;};MailQueue[_0xe8e9('0xf')][_0xe8e9('0xe')]=function(){this[_0xe8e9('0x12')]=0x0;this[_0xe8e9('0x13')]=0x0;for(var _0x3a310f=0x0;_0x3a310f=0x0?this[_0xe8e9('0x16')]:0x0;var _0x16c1e7={'id':this['id'],'available':this[_0xe8e9('0x16')],'loggedIn':this[_0xe8e9('0x12')],'name':this[_0xe8e9('0x8')],'paused':this[_0xe8e9('0x13')],'waiting':this[_0xe8e9('0xc')]};var _0x3c69ab=md5(JSON['stringify'](_0x16c1e7));if(this[_0xe8e9('0x1')]!==_0x3c69ab){this[_0xe8e9('0x1')]=_0x3c69ab;io['to'](util[_0xe8e9('0x17')]('mail:queue:%s',_0x16c1e7[_0xe8e9('0x8')]))['emit']('mail_queue:save',_0x16c1e7);}};module[_0xe8e9('0x18')]=MailQueue; \ No newline at end of file +var _0x5ba0=['socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','loggedIn','paused','length','online','mailPause','available','stringify','format','mail:queue:%s','emit','mail_queue:save','md5','util','../../../config/environment','redis'];(function(_0x412a34,_0x381b83){var _0x307856=function(_0x1cc20d){while(--_0x1cc20d){_0x412a34['push'](_0x412a34['shift']());}};_0x307856(++_0x381b83);}(_0x5ba0,0x1be));var _0x05ba=function(_0x50239a,_0x57d759){_0x50239a=_0x50239a-0x0;var _0x3418c7=_0x5ba0[_0x50239a];return _0x3418c7;};'use strict';var _=require('lodash');var md5=require(_0x05ba('0x0'));var util=require(_0x05ba('0x1'));var Redis=require('ioredis');var config=require(_0x05ba('0x2'));config[_0x05ba('0x3')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x05ba('0x4'))(new Redis(config['redis']));function MailQueue(_0x4f2dff){this['id']=_0x4f2dff['id']||0x0;this[_0x05ba('0x5')]=_0x4f2dff['name']||'';this['timeout']=_0x4f2dff[_0x05ba('0x6')]||0xa;this['strategy']=_0x4f2dff[_0x05ba('0x7')]||_0x05ba('0x8');this[_0x05ba('0x9')]=_0x4f2dff['Agents'];this[_0x05ba('0xa')]={};this[_0x05ba('0xb')]=0x0;this[_0x05ba('0x0')]='';this[_0x05ba('0xc')]();this[_0x05ba('0xd')]();}MailQueue['prototype']['updateRouting']=function(){var _0x31cf6f=this[_0x05ba('0xa')]['_rr'];this['mapAgentsId']=_['map'](this['Agents'],'id');this['mapAgentsId']['_rr']=_0x31cf6f;};MailQueue['prototype']['updateRealtime']=function(){this[_0x05ba('0xe')]=0x0;this[_0x05ba('0xf')]=0x0;for(var _0x1cd8ca=0x0;_0x1cd8ca=0x0?this[_0x05ba('0x13')]:0x0;var _0x368efe={'id':this['id'],'available':this[_0x05ba('0x13')],'loggedIn':this['loggedIn'],'name':this[_0x05ba('0x5')],'paused':this['paused'],'waiting':this[_0x05ba('0xb')]};var _0x536204=md5(JSON[_0x05ba('0x14')](_0x368efe));if(this[_0x05ba('0x0')]!==_0x536204){this[_0x05ba('0x0')]=_0x536204;io['to'](util[_0x05ba('0x15')](_0x05ba('0x16'),_0x368efe['name']))[_0x05ba('0x17')](_0x05ba('0x18'),_0x368efe);}};module['exports']=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index ab1e99b..55cd040 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 _0x2ef3=['stringify','format','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','timeout','strategy','beepall','Agents','mapAgentsId','waiting','prototype','updateRouting','_rr','paused','length','online','available','loggedIn','name'];(function(_0x3a99f4,_0x2a81c1){var _0xea0b42=function(_0x41f533){while(--_0x41f533){_0x3a99f4['push'](_0x3a99f4['shift']());}};_0xea0b42(++_0x2a81c1);}(_0x2ef3,0xba));var _0x32ef=function(_0xf45974,_0x2a5952){_0xf45974=_0xf45974-0x0;var _0x2db9a2=_0x2ef3[_0xf45974];return _0x2db9a2;};'use strict';var _=require(_0x32ef('0x0'));var md5=require(_0x32ef('0x1'));var util=require(_0x32ef('0x2'));var Redis=require(_0x32ef('0x3'));var config=require(_0x32ef('0x4'));config[_0x32ef('0x5')]=_['defaults'](config[_0x32ef('0x5')],{'host':_0x32ef('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x32ef('0x5')]));function OpenchannelQueue(_0x37dd1d){this['id']=_0x37dd1d['id']||0x0;this['name']=_0x37dd1d['name']||'';this[_0x32ef('0x7')]=_0x37dd1d[_0x32ef('0x7')]||0xa;this[_0x32ef('0x8')]=_0x37dd1d[_0x32ef('0x8')]||_0x32ef('0x9');this[_0x32ef('0xa')]=_0x37dd1d[_0x32ef('0xa')];this[_0x32ef('0xb')]={};this[_0x32ef('0xc')]=0x0;this[_0x32ef('0x1')]='';this['updateRouting']();this['updateRealtime']();}OpenchannelQueue[_0x32ef('0xd')][_0x32ef('0xe')]=function(){var _0x45bfd5=this[_0x32ef('0xb')]['_rr'];this[_0x32ef('0xb')]=_['map'](this[_0x32ef('0xa')],'id');this['mapAgentsId'][_0x32ef('0xf')]=_0x45bfd5;};OpenchannelQueue[_0x32ef('0xd')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x32ef('0x10')]=0x0;for(var _0x4d8009=0x0;_0x4d8009=0x0?this[_0x32ef('0x13')]:0x0;var _0x286bfb={'id':this['id'],'available':this['available'],'loggedIn':this[_0x32ef('0x14')],'name':this[_0x32ef('0x15')],'paused':this['paused'],'waiting':this[_0x32ef('0xc')]};var _0x314ef1=md5(JSON[_0x32ef('0x16')](_0x286bfb));if(this[_0x32ef('0x1')]!==_0x314ef1){this[_0x32ef('0x1')]=_0x314ef1;io['to'](util[_0x32ef('0x17')]('openchannel:queue:%s',_0x286bfb[_0x32ef('0x15')]))['emit'](_0x32ef('0x18'),_0x286bfb);}};module[_0x32ef('0x19')]=OpenchannelQueue; \ No newline at end of file +var _0x5fc3=['format','openchannel:queue:%s','name','emit','openchannel_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','prototype','loggedIn','paused','openchannelPause','available'];(function(_0x4bc221,_0x51adfe){var _0x188462=function(_0x147bee){while(--_0x147bee){_0x4bc221['push'](_0x4bc221['shift']());}};_0x188462(++_0x51adfe);}(_0x5fc3,0xa8));var _0x35fc=function(_0x3b3210,_0x25e8ed){_0x3b3210=_0x3b3210-0x0;var _0x5b5484=_0x5fc3[_0x3b3210];return _0x5b5484;};'use strict';var _=require(_0x35fc('0x0'));var md5=require(_0x35fc('0x1'));var util=require('util');var Redis=require(_0x35fc('0x2'));var config=require(_0x35fc('0x3'));config[_0x35fc('0x4')]=_[_0x35fc('0x5')](config[_0x35fc('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x35fc('0x6'))(new Redis(config[_0x35fc('0x4')]));function OpenchannelQueue(_0x186a06){this['id']=_0x186a06['id']||0x0;this['name']=_0x186a06['name']||'';this[_0x35fc('0x7')]=_0x186a06['timeout']||0xa;this[_0x35fc('0x8')]=_0x186a06[_0x35fc('0x8')]||_0x35fc('0x9');this[_0x35fc('0xa')]=_0x186a06[_0x35fc('0xa')];this[_0x35fc('0xb')]={};this[_0x35fc('0xc')]=0x0;this['md5']='';this[_0x35fc('0xd')]();this[_0x35fc('0xe')]();}OpenchannelQueue['prototype'][_0x35fc('0xd')]=function(){var _0x33f491=this['mapAgentsId'][_0x35fc('0xf')];this[_0x35fc('0xb')]=_['map'](this['Agents'],'id');this[_0x35fc('0xb')]['_rr']=_0x33f491;};OpenchannelQueue[_0x35fc('0x10')][_0x35fc('0xe')]=function(){this[_0x35fc('0x11')]=0x0;this[_0x35fc('0x12')]=0x0;for(var _0x38d9f2=0x0;_0x38d9f2=0x0?this['available']:0x0;var _0x41e165={'id':this['id'],'available':this[_0x35fc('0x14')],'loggedIn':this[_0x35fc('0x11')],'name':this['name'],'paused':this[_0x35fc('0x12')],'waiting':this[_0x35fc('0xc')]};var _0x465eb3=md5(JSON['stringify'](_0x41e165));if(this[_0x35fc('0x1')]!==_0x465eb3){this[_0x35fc('0x1')]=_0x465eb3;io['to'](util[_0x35fc('0x15')](_0x35fc('0x16'),_0x41e165[_0x35fc('0x17')]))[_0x35fc('0x18')](_0x35fc('0x19'),_0x41e165);}};module[_0x35fc('0x1a')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 6a4953d..9f8ab19 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 _0x4876=['Agents','mapAgentsId','waiting','md5','updateRealtime','prototype','updateRouting','_rr','map','paused','length','loggedIn','smsPause','available','stringify','format','sms:queue:%s','emit','sms_queue:save','exports','util','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall'];(function(_0x371860,_0xed56ad){var _0x508130=function(_0x5e1d93){while(--_0x5e1d93){_0x371860['push'](_0x371860['shift']());}};_0x508130(++_0xed56ad);}(_0x4876,0x84));var _0x6487=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4876[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0x6487('0x0'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x6487('0x1')]=_['defaults'](config[_0x6487('0x1')],{'host':_0x6487('0x2'),'port':0x18eb});var io=require(_0x6487('0x3'))(new Redis(config[_0x6487('0x1')]));function SmsQueue(_0x57d99d){this['id']=_0x57d99d['id']||0x0;this[_0x6487('0x4')]=_0x57d99d[_0x6487('0x4')]||'';this['timeout']=_0x57d99d[_0x6487('0x5')]||0xa;this[_0x6487('0x6')]=_0x57d99d[_0x6487('0x6')]||_0x6487('0x7');this[_0x6487('0x8')]=_0x57d99d[_0x6487('0x8')];this[_0x6487('0x9')]={};this[_0x6487('0xa')]=0x0;this[_0x6487('0xb')]='';this['updateRouting']();this[_0x6487('0xc')]();}SmsQueue[_0x6487('0xd')][_0x6487('0xe')]=function(){var _0x2ba8ce=this[_0x6487('0x9')][_0x6487('0xf')];this[_0x6487('0x9')]=_[_0x6487('0x10')](this['Agents'],'id');this[_0x6487('0x9')][_0x6487('0xf')]=_0x2ba8ce;};SmsQueue[_0x6487('0xd')][_0x6487('0xc')]=function(){this['loggedIn']=0x0;this[_0x6487('0x11')]=0x0;for(var _0x10f2e1=0x0;_0x10f2e1=0x0?this['available']:0x0;var _0x4cedf9={'id':this['id'],'available':this['available'],'loggedIn':this[_0x6487('0x13')],'name':this[_0x6487('0x4')],'paused':this[_0x6487('0x11')],'waiting':this[_0x6487('0xa')]};var _0x30abdc=md5(JSON[_0x6487('0x16')](_0x4cedf9));if(this[_0x6487('0xb')]!==_0x30abdc){this[_0x6487('0xb')]=_0x30abdc;io['to'](util[_0x6487('0x17')](_0x6487('0x18'),_0x4cedf9[_0x6487('0x4')]))[_0x6487('0x19')](_0x6487('0x1a'),_0x4cedf9);}};module[_0x6487('0x1b')]=SmsQueue; \ No newline at end of file +var _0x7d86=['Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','available','stringify','format','emit','exports','lodash','util','ioredis','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','beepall'];(function(_0xb02bc8,_0x5716b9){var _0x4d0fa7=function(_0x9bb011){while(--_0x9bb011){_0xb02bc8['push'](_0xb02bc8['shift']());}};_0x4d0fa7(++_0x5716b9);}(_0x7d86,0x86));var _0x67d8=function(_0x3a428d,_0x47ea61){_0x3a428d=_0x3a428d-0x0;var _0x15219c=_0x7d86[_0x3a428d];return _0x15219c;};'use strict';var _=require(_0x67d8('0x0'));var md5=require('md5');var util=require(_0x67d8('0x1'));var Redis=require(_0x67d8('0x2'));var config=require(_0x67d8('0x3'));config[_0x67d8('0x4')]=_[_0x67d8('0x5')](config[_0x67d8('0x4')],{'host':_0x67d8('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x67d8('0x4')]));function SmsQueue(_0x33de53){this['id']=_0x33de53['id']||0x0;this[_0x67d8('0x7')]=_0x33de53[_0x67d8('0x7')]||'';this[_0x67d8('0x8')]=_0x33de53[_0x67d8('0x8')]||0xa;this[_0x67d8('0x9')]=_0x33de53[_0x67d8('0x9')]||_0x67d8('0xa');this[_0x67d8('0xb')]=_0x33de53[_0x67d8('0xb')];this[_0x67d8('0xc')]={};this[_0x67d8('0xd')]=0x0;this[_0x67d8('0xe')]='';this[_0x67d8('0xf')]();this[_0x67d8('0x10')]();}SmsQueue[_0x67d8('0x11')][_0x67d8('0xf')]=function(){var _0x38107b=this[_0x67d8('0xc')][_0x67d8('0x12')];this['mapAgentsId']=_[_0x67d8('0x13')](this[_0x67d8('0xb')],'id');this[_0x67d8('0xc')]['_rr']=_0x38107b;};SmsQueue[_0x67d8('0x11')][_0x67d8('0x10')]=function(){this[_0x67d8('0x14')]=0x0;this[_0x67d8('0x15')]=0x0;for(var _0x2d54e6=0x0;_0x2d54e6=0x0?this[_0x67d8('0x18')]:0x0;var _0x23328d={'id':this['id'],'available':this[_0x67d8('0x18')],'loggedIn':this['loggedIn'],'name':this[_0x67d8('0x7')],'paused':this[_0x67d8('0x15')],'waiting':this[_0x67d8('0xd')]};var _0x14a81f=md5(JSON[_0x67d8('0x19')](_0x23328d));if(this['md5']!==_0x14a81f){this[_0x67d8('0xe')]=_0x14a81f;io['to'](util[_0x67d8('0x1a')]('sms:queue:%s',_0x23328d['name']))[_0x67d8('0x1b')]('sms_queue:save',_0x23328d);}};module[_0x67d8('0x1c')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 10ee1fc..3d1fb7c 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 _0x6b85=['beepall','Agents','updateRouting','updateRealtime','prototype','_rr','mapAgentsId','loggedIn','online','whatsappPause','paused','available','waiting','stringify','emit','whatsapp_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy'];(function(_0x55ce3d,_0x1ad63f){var _0x2e485f=function(_0x4f6a49){while(--_0x4f6a49){_0x55ce3d['push'](_0x55ce3d['shift']());}};_0x2e485f(++_0x1ad63f);}(_0x6b85,0x65));var _0x56b8=function(_0x22aeb5,_0x5b0296){_0x22aeb5=_0x22aeb5-0x0;var _0x12338b=_0x6b85[_0x22aeb5];return _0x12338b;};'use strict';var _=require(_0x56b8('0x0'));var md5=require(_0x56b8('0x1'));var util=require(_0x56b8('0x2'));var Redis=require(_0x56b8('0x3'));var config=require(_0x56b8('0x4'));config[_0x56b8('0x5')]=_['defaults'](config['redis'],{'host':_0x56b8('0x6'),'port':0x18eb});var io=require(_0x56b8('0x7'))(new Redis(config[_0x56b8('0x5')]));function WhatsappQueue(_0x2fd82c){this['id']=_0x2fd82c['id']||0x0;this[_0x56b8('0x8')]=_0x2fd82c[_0x56b8('0x8')]||'';this[_0x56b8('0x9')]=_0x2fd82c['timeout']||0xa;this[_0x56b8('0xa')]=_0x2fd82c[_0x56b8('0xa')]||_0x56b8('0xb');this['Agents']=_0x2fd82c[_0x56b8('0xc')];this['mapAgentsId']={};this['waiting']=0x0;this['md5']='';this[_0x56b8('0xd')]();this[_0x56b8('0xe')]();}WhatsappQueue[_0x56b8('0xf')][_0x56b8('0xd')]=function(){var _0x31b24f=this['mapAgentsId'][_0x56b8('0x10')];this['mapAgentsId']=_['map'](this[_0x56b8('0xc')],'id');this[_0x56b8('0x11')][_0x56b8('0x10')]=_0x31b24f;};WhatsappQueue[_0x56b8('0xf')][_0x56b8('0xe')]=function(){this[_0x56b8('0x12')]=0x0;this['paused']=0x0;for(var _0x55d987=0x0;_0x55d987=0x0?this[_0x56b8('0x16')]:0x0;var _0x4f84fb={'id':this['id'],'available':this['available'],'loggedIn':this[_0x56b8('0x12')],'name':this[_0x56b8('0x8')],'paused':this[_0x56b8('0x15')],'waiting':this[_0x56b8('0x17')]};var _0x2f210c=md5(JSON[_0x56b8('0x18')](_0x4f84fb));if(this[_0x56b8('0x1')]!==_0x2f210c){this[_0x56b8('0x1')]=_0x2f210c;io['to'](util['format']('whatsapp:queue:%s',_0x4f84fb[_0x56b8('0x8')]))[_0x56b8('0x19')](_0x56b8('0x1a'),_0x4f84fb);}};module[_0x56b8('0x1b')]=WhatsappQueue; \ No newline at end of file +var _0x90d5=['prototype','_rr','map','loggedIn','length','whatsappPause','paused','available','stringify','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','util','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime'];(function(_0x5a148f,_0x114dfa){var _0x5af2d4=function(_0x6a9ba4){while(--_0x6a9ba4){_0x5a148f['push'](_0x5a148f['shift']());}};_0x5af2d4(++_0x114dfa);}(_0x90d5,0xee));var _0x590d=function(_0x25a336,_0x323745){_0x25a336=_0x25a336-0x0;var _0x22e925=_0x90d5[_0x25a336];return _0x22e925;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0x590d('0x0'));var Redis=require('ioredis');var config=require(_0x590d('0x1'));config['redis']=_['defaults'](config[_0x590d('0x2')],{'host':_0x590d('0x3'),'port':0x18eb});var io=require(_0x590d('0x4'))(new Redis(config[_0x590d('0x2')]));function WhatsappQueue(_0x4ae67f){this['id']=_0x4ae67f['id']||0x0;this[_0x590d('0x5')]=_0x4ae67f[_0x590d('0x5')]||'';this[_0x590d('0x6')]=_0x4ae67f[_0x590d('0x6')]||0xa;this[_0x590d('0x7')]=_0x4ae67f['strategy']||'beepall';this['Agents']=_0x4ae67f[_0x590d('0x8')];this[_0x590d('0x9')]={};this[_0x590d('0xa')]=0x0;this[_0x590d('0xb')]='';this[_0x590d('0xc')]();this[_0x590d('0xd')]();}WhatsappQueue[_0x590d('0xe')]['updateRouting']=function(){var _0x45b9fb=this[_0x590d('0x9')][_0x590d('0xf')];this[_0x590d('0x9')]=_[_0x590d('0x10')](this[_0x590d('0x8')],'id');this[_0x590d('0x9')][_0x590d('0xf')]=_0x45b9fb;};WhatsappQueue[_0x590d('0xe')][_0x590d('0xd')]=function(){this[_0x590d('0x11')]=0x0;this['paused']=0x0;for(var _0x52c86c=0x0;_0x52c86c=0x0?this[_0x590d('0x15')]:0x0;var _0x2502ea={'id':this['id'],'available':this[_0x590d('0x15')],'loggedIn':this['loggedIn'],'name':this[_0x590d('0x5')],'paused':this['paused'],'waiting':this[_0x590d('0xa')]};var _0x416faa=md5(JSON[_0x590d('0x16')](_0x2502ea));if(this[_0x590d('0xb')]!==_0x416faa){this[_0x590d('0xb')]=_0x416faa;io['to'](util[_0x590d('0x17')](_0x590d('0x18'),_0x2502ea[_0x590d('0x5')]))[_0x590d('0x19')](_0x590d('0x1a'),_0x2502ea);}};module[_0x590d('0x1b')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 84e51a4..84feb51 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','isUndefined','initIntervals','length','initOpenchannelQueues','updateRealtime','initChatQueues','chatQueues','initSmsQueues','updateRouting','initMailQueues','initFaxQueues','initWhatsappQueues','exports','bluebird','lodash','moment','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','smsQueues','mailQueues'];(function(_0x2adc30,_0x1c0c4f){var _0x12eba2=function(_0x1a5266){while(--_0x1a5266){_0x2adc30['push'](_0x2adc30['shift']());}};_0x12eba2(++_0x1c0c4f);}(_0xb10b,0x12a));var _0xbb10=function(_0x5c70d0,_0xfeac42){_0x5c70d0=_0x5c70d0-0x0;var _0x484491=_0xb10b[_0x5c70d0];return _0x484491;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime; \ No newline at end of file +var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'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 836df68..e15fbfb 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 _0x0844=['../client','Request','UpdateChatInteraction','updateChatInteraction','AddTagsToChatInteraction','addTagsToChatInteraction'];(function(_0x44946b,_0xf874ec){var _0x249bc4=function(_0x40a23e){while(--_0x40a23e){_0x44946b['push'](_0x44946b['shift']());}};_0x249bc4(++_0xf874ec);}(_0x0844,0x66));var _0x4084=function(_0x24b137,_0x30191b){_0x24b137=_0x24b137-0x0;var _0x341c34=_0x0844[_0x24b137];return _0x341c34;};'use strict';var client=require(_0x4084('0x0'));exports['update']=function(_0x42ca39,_0x57e584){return client[_0x4084('0x1')](_0x4084('0x2'),{'body':_0x57e584,'options':{'where':{'id':_0x42ca39}},'log':_0x4084('0x3')});};exports['addTags']=function(_0x42112d,_0x343cfd){return client['Request'](_0x4084('0x4'),{'body':_0x343cfd,'options':{'where':{'id':_0x42112d}},'log':_0x4084('0x5')});}; \ No newline at end of file +var _0x0ee4=['Request','UpdateChatInteraction','updateChatInteraction','addTags','AddTagsToChatInteraction','addTagsToChatInteraction','../client','update'];(function(_0x11403a,_0x2c555e){var _0x52b223=function(_0x376de6){while(--_0x376de6){_0x11403a['push'](_0x11403a['shift']());}};_0x52b223(++_0x2c555e);}(_0x0ee4,0xa6));var _0x40ee=function(_0x4cc17e,_0xbff357){_0x4cc17e=_0x4cc17e-0x0;var _0x4ee2e9=_0x0ee4[_0x4cc17e];return _0x4ee2e9;};'use strict';var client=require(_0x40ee('0x0'));exports[_0x40ee('0x1')]=function(_0x598e38,_0x38feeb){return client[_0x40ee('0x2')](_0x40ee('0x3'),{'body':_0x38feeb,'options':{'where':{'id':_0x598e38}},'log':_0x40ee('0x4')});};exports[_0x40ee('0x5')]=function(_0x174d05,_0x3585b8){return client['Request'](_0x40ee('0x6'),{'body':_0x3585b8,'options':{'where':{'id':_0x174d05}},'log':_0x40ee('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 7e15127..48429bb 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 _0x23de=['create','Request','CreateChatMessage','createChatMessage','../client'];(function(_0x198e84,_0x407557){var _0x269d12=function(_0x11dd85){while(--_0x11dd85){_0x198e84['push'](_0x198e84['shift']());}};_0x269d12(++_0x407557);}(_0x23de,0x11c));var _0xe23d=function(_0x3ba924,_0x3b99f0){_0x3ba924=_0x3ba924-0x0;var _0x4cc1df=_0x23de[_0x3ba924];return _0x4cc1df;};'use strict';var client=require(_0xe23d('0x0'));exports[_0xe23d('0x1')]=function(_0x17f1d3){return client[_0xe23d('0x2')](_0xe23d('0x3'),{'body':_0x17f1d3,'log':_0xe23d('0x4')});}; \ No newline at end of file +var _0x303f=['create','Request','CreateChatMessage','createChatMessage','../client'];(function(_0x374ccf,_0xa945c4){var _0x443cde=function(_0x27ff10){while(--_0x27ff10){_0x374ccf['push'](_0x374ccf['shift']());}};_0x443cde(++_0xa945c4);}(_0x303f,0x1b7));var _0xf303=function(_0x387539,_0x503387){_0x387539=_0x387539-0x0;var _0x2676a6=_0x303f[_0x387539];return _0x2676a6;};'use strict';var client=require(_0xf303('0x0'));exports[_0xf303('0x1')]=function(_0x2fc430){return client[_0xf303('0x2')](_0xf303('0x3'),{'body':_0x2fc430,'log':_0xf303('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index b9aa127..b3bae11 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 _0xae1c=['timeout','strategy','User','Agents','online','chatPause','getChatQueues','name'];(function(_0xe1770a,_0x4fc5d6){var _0x3e6274=function(_0x1a016f){while(--_0x1a016f){_0xe1770a['push'](_0xe1770a['shift']());}};_0x3e6274(++_0x4fc5d6);}(_0xae1c,0xff));var _0xcae1=function(_0x354007,_0x4fb097){_0x354007=_0x354007-0x0;var _0x385f9a=_0xae1c[_0x354007];return _0x385f9a;};'use strict';var client=require('../client');exports['getChatQueues']=function(){return function(){return client['Request']('GetChatQueue',{'options':{'raw':![],'attributes':['id',_0xcae1('0x0'),_0xcae1('0x1'),_0xcae1('0x2')],'include':[{'model':_0xcae1('0x3'),'as':_0xcae1('0x4'),'attributes':['id',_0xcae1('0x0'),_0xcae1('0x5'),_0xcae1('0x6')]}]},'log':_0xcae1('0x7')});};}; \ No newline at end of file +var _0xf1c6=['strategy','chatPause','getChatQueues','Request','GetChatQueue','name','timeout'];(function(_0x136c1a,_0x520451){var _0x34affe=function(_0x170d42){while(--_0x170d42){_0x136c1a['push'](_0x136c1a['shift']());}};_0x34affe(++_0x520451);}(_0xf1c6,0x145));var _0x6f1c=function(_0x2cd1b1,_0x3c6195){_0x2cd1b1=_0x2cd1b1-0x0;var _0x380787=_0xf1c6[_0x2cd1b1];return _0x380787;};'use strict';var client=require('../client');exports['getChatQueues']=function(){return function(){return client[_0x6f1c('0x0')](_0x6f1c('0x1'),{'options':{'raw':![],'attributes':['id',_0x6f1c('0x2'),_0x6f1c('0x3'),_0x6f1c('0x4')],'include':[{'model':'User','as':'Agents','attributes':['id',_0x6f1c('0x2'),'online',_0x6f1c('0x5')]}]},'log':_0x6f1c('0x6')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 04d33cd..f575ee3 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 _0x76a3=['update','UpdateChatQueueReport','../client','create','Request','CreateChatQueueReport'];(function(_0x4ec791,_0x561b09){var _0x46e14e=function(_0x3fe7c9){while(--_0x3fe7c9){_0x4ec791['push'](_0x4ec791['shift']());}};_0x46e14e(++_0x561b09);}(_0x76a3,0xf8));var _0x376a=function(_0x3e2fcf,_0x579110){_0x3e2fcf=_0x3e2fcf-0x0;var _0x497db7=_0x76a3[_0x3e2fcf];return _0x497db7;};'use strict';var client=require(_0x376a('0x0'));exports[_0x376a('0x1')]=function(_0x376352){return client[_0x376a('0x2')](_0x376a('0x3'),{'body':_0x376352,'log':_0x376a('0x3')});};exports[_0x376a('0x4')]=function(_0x433678,_0x8bdd7f){return client[_0x376a('0x2')]('UpdateChatQueueReport',{'body':_0x8bdd7f,'options':{'where':{'uniqueid':_0x433678},'order':[['id','DESC']],'limit':0x1},'log':_0x376a('0x5')});}; \ No newline at end of file +var _0x4ef1=['CreateChatQueueReport','update','UpdateChatQueueReport','DESC','../client','create','Request'];(function(_0x34f529,_0xa2e9cb){var _0xaefa23=function(_0x70231){while(--_0x70231){_0x34f529['push'](_0x34f529['shift']());}};_0xaefa23(++_0xa2e9cb);}(_0x4ef1,0xeb));var _0x14ef=function(_0x193c83,_0x25e9f6){_0x193c83=_0x193c83-0x0;var _0x392193=_0x4ef1[_0x193c83];return _0x392193;};'use strict';var client=require(_0x14ef('0x0'));exports[_0x14ef('0x1')]=function(_0x52e89c){return client[_0x14ef('0x2')](_0x14ef('0x3'),{'body':_0x52e89c,'log':_0x14ef('0x3')});};exports[_0x14ef('0x4')]=function(_0x168fd8,_0x43a716){return client[_0x14ef('0x2')](_0x14ef('0x5'),{'body':_0x43a716,'options':{'where':{'uniqueid':_0x168fd8},'order':[['id',_0x14ef('0x6')]],'limit':0x1},'log':_0x14ef('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 6026a6d..485dcf6 100644 --- a/server/services/routing/rpc/faxInteraction.js +++ b/server/services/routing/rpc/faxInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x55d58f,_0x2bea83){var _0x1ad6e6=function(_0x31447e){while(--_0x31447e){_0x55d58f['push'](_0x55d58f['shift']());}};_0x1ad6e6(++_0x2bea83);}(_0x7a54,0x106));var _0x47a5=function(_0x548fdd,_0x2434f7){_0x548fdd=_0x548fdd-0x0;var _0x28f6f2=_0x7a54[_0x548fdd];return _0x28f6f2;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file +var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0xa522f,_0x5debbc){var _0x2083b0=function(_0x288f01){while(--_0x288f01){_0xa522f['push'](_0xa522f['shift']());}};_0x2083b0(++_0x5debbc);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index b3b5ff5..6fa2ed9 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 _0xcbc2=['../client','create','Request','CreateFaxMessage','createFaxMessage'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xcbc2,0x113));var _0x2cbc=function(_0x38e5ee,_0x3cd0cb){_0x38e5ee=_0x38e5ee-0x0;var _0x85812d=_0xcbc2[_0x38e5ee];return _0x85812d;};'use strict';var client=require(_0x2cbc('0x0'));exports[_0x2cbc('0x1')]=function(_0x28a9af){return client[_0x2cbc('0x2')](_0x2cbc('0x3'),{'body':_0x28a9af,'log':_0x2cbc('0x4')});}; \ No newline at end of file +var _0x2ae3=['create','Request','CreateFaxMessage','createFaxMessage','../client'];(function(_0x34e760,_0x2a4967){var _0x4e8fd3=function(_0x260faa){while(--_0x260faa){_0x34e760['push'](_0x34e760['shift']());}};_0x4e8fd3(++_0x2a4967);}(_0x2ae3,0x11c));var _0x32ae=function(_0x1b0239,_0x3f899b){_0x1b0239=_0x1b0239-0x0;var _0x4d57e4=_0x2ae3[_0x1b0239];return _0x4d57e4;};'use strict';var client=require(_0x32ae('0x0'));exports[_0x32ae('0x1')]=function(_0x5b1c19){return client[_0x32ae('0x2')](_0x32ae('0x3'),{'body':_0x5b1c19,'log':_0x32ae('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index b92a4bf..ab9e8b1 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 _0x1458=['../client','getFaxQueues','Request','GetFaxQueue','timeout','strategy','User','Agents','online','faxPause'];(function(_0x4566ac,_0x7a4151){var _0x5450dd=function(_0x464d54){while(--_0x464d54){_0x4566ac['push'](_0x4566ac['shift']());}};_0x5450dd(++_0x7a4151);}(_0x1458,0x8c));var _0x8145=function(_0x3f228e,_0x51e3b5){_0x3f228e=_0x3f228e-0x0;var _0x56d89d=_0x1458[_0x3f228e];return _0x56d89d;};'use strict';var client=require(_0x8145('0x0'));exports[_0x8145('0x1')]=function(){return function(){return client[_0x8145('0x2')](_0x8145('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x8145('0x4'),_0x8145('0x5')],'include':[{'model':_0x8145('0x6'),'as':_0x8145('0x7'),'attributes':['id','name',_0x8145('0x8'),_0x8145('0x9')]}]},'log':_0x8145('0x1')});};}; \ No newline at end of file +var _0x3581=['GetFaxQueue','name','timeout','strategy','User','Agents','faxPause','../client','getFaxQueues','Request'];(function(_0x3ac6a3,_0x3dc212){var _0x16951c=function(_0x3e3498){while(--_0x3e3498){_0x3ac6a3['push'](_0x3ac6a3['shift']());}};_0x16951c(++_0x3dc212);}(_0x3581,0x1bf));var _0x1358=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3581[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x1358('0x0'));exports[_0x1358('0x1')]=function(){return function(){return client[_0x1358('0x2')](_0x1358('0x3'),{'options':{'raw':![],'attributes':['id',_0x1358('0x4'),_0x1358('0x5'),_0x1358('0x6')],'include':[{'model':_0x1358('0x7'),'as':_0x1358('0x8'),'attributes':['id',_0x1358('0x4'),'online',_0x1358('0x9')]}]},'log':_0x1358('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index bc4d1c8..edc997f 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 _0xa8be=['UpdateFaxQueueReport','DESC','../client','create','Request','CreateFaxQueueReport'];(function(_0x1aa72d,_0x4c63a6){var _0x2602f9=function(_0x561600){while(--_0x561600){_0x1aa72d['push'](_0x1aa72d['shift']());}};_0x2602f9(++_0x4c63a6);}(_0xa8be,0x8c));var _0xea8b=function(_0x4d31d0,_0x32966d){_0x4d31d0=_0x4d31d0-0x0;var _0x3567ae=_0xa8be[_0x4d31d0];return _0x3567ae;};'use strict';var client=require(_0xea8b('0x0'));exports[_0xea8b('0x1')]=function(_0x1ee24e){return client[_0xea8b('0x2')](_0xea8b('0x3'),{'body':_0x1ee24e,'log':'CreateFaxQueueReport'});};exports['update']=function(_0x43d59c,_0x45ea16){return client[_0xea8b('0x2')](_0xea8b('0x4'),{'body':_0x45ea16,'options':{'where':{'uniqueid':_0x43d59c},'order':[['id',_0xea8b('0x5')]],'limit':0x1},'log':_0xea8b('0x4')});}; \ No newline at end of file +var _0x29d4=['update','UpdateFaxQueueReport','DESC','../client','Request','CreateFaxQueueReport'];(function(_0x1db321,_0x2a3ca7){var _0x53670f=function(_0x701160){while(--_0x701160){_0x1db321['push'](_0x1db321['shift']());}};_0x53670f(++_0x2a3ca7);}(_0x29d4,0x1a1));var _0x429d=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x29d4[_0x5b561d];return _0x431060;};'use strict';var client=require(_0x429d('0x0'));exports['create']=function(_0x17f867){return client[_0x429d('0x1')](_0x429d('0x2'),{'body':_0x17f867,'log':_0x429d('0x2')});};exports[_0x429d('0x3')]=function(_0x4e287b,_0xc3989d){return client[_0x429d('0x1')](_0x429d('0x4'),{'body':_0xc3989d,'options':{'where':{'uniqueid':_0x4e287b},'order':[['id',_0x429d('0x5')]],'limit':0x1},'log':_0x429d('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 88b4aa6..69f8cb3 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 _0xb936=['getIntervals','../client','Request','GetInterval','name','Interval','Intervals','interval'];(function(_0x58e6a1,_0x419922){var _0x59431c=function(_0x3f2b58){while(--_0x3f2b58){_0x58e6a1['push'](_0x58e6a1['shift']());}};_0x59431c(++_0x419922);}(_0xb936,0x1b9));var _0x6b93=function(_0x25509d,_0x1ee9d0){_0x25509d=_0x25509d-0x0;var _0x72d366=_0xb936[_0x25509d];return _0x72d366;};'use strict';var client=require(_0x6b93('0x0'));exports['getIntervals']=function(){return function(){return client[_0x6b93('0x1')](_0x6b93('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x6b93('0x3')],'include':[{'model':_0x6b93('0x4'),'as':_0x6b93('0x5'),'attributes':['id','name',_0x6b93('0x6')]}]},'log':_0x6b93('0x7')});};}; \ No newline at end of file +var _0x90bc=['../client','getIntervals','Request','Interval','Intervals','name','interval'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x90bc,0x12d));var _0xc90b=function(_0xfccd6a,_0x10df28){_0xfccd6a=_0xfccd6a-0x0;var _0x1a4aec=_0x90bc[_0xfccd6a];return _0x1a4aec;};'use strict';var client=require(_0xc90b('0x0'));exports[_0xc90b('0x1')]=function(){return function(){return client[_0xc90b('0x2')]('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0xc90b('0x3'),'as':_0xc90b('0x4'),'attributes':['id',_0xc90b('0x5'),_0xc90b('0x6')]}]},'log':_0xc90b('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index c7e12a4..ac7cd87 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 _0xfff0=['addTagsToChatInteraction','update','UpdateMailInteraction','updateMailInteraction','addTags','Request'];(function(_0x501fe6,_0xb74e75){var _0x2262da=function(_0x5e8584){while(--_0x5e8584){_0x501fe6['push'](_0x501fe6['shift']());}};_0x2262da(++_0xb74e75);}(_0xfff0,0x139));var _0x0fff=function(_0x436e5f,_0x1bc211){_0x436e5f=_0x436e5f-0x0;var _0x26314b=_0xfff0[_0x436e5f];return _0x26314b;};'use strict';var client=require('../client');exports[_0x0fff('0x0')]=function(_0x2b95e0,_0x148db8){return client['Request'](_0x0fff('0x1'),{'body':_0x148db8,'options':{'where':{'id':_0x2b95e0}},'log':_0x0fff('0x2')});};exports[_0x0fff('0x3')]=function(_0x4bec60,_0x2cd3d5){return client[_0x0fff('0x4')]('AddTagsToMailInteraction',{'body':_0x2cd3d5,'options':{'where':{'id':_0x4bec60}},'log':_0x0fff('0x5')});}; \ No newline at end of file +var _0x33af=['addTags','AddTagsToMailInteraction','update','Request','UpdateMailInteraction','updateMailInteraction'];(function(_0x101e7b,_0x4ef05b){var _0x4995c0=function(_0x1a6488){while(--_0x1a6488){_0x101e7b['push'](_0x101e7b['shift']());}};_0x4995c0(++_0x4ef05b);}(_0x33af,0xec));var _0xf33a=function(_0x2d9c6a,_0x59393d){_0x2d9c6a=_0x2d9c6a-0x0;var _0xf3c918=_0x33af[_0x2d9c6a];return _0xf3c918;};'use strict';var client=require('../client');exports[_0xf33a('0x0')]=function(_0x54b114,_0x2137be){return client[_0xf33a('0x1')](_0xf33a('0x2'),{'body':_0x2137be,'options':{'where':{'id':_0x54b114}},'log':_0xf33a('0x3')});};exports[_0xf33a('0x4')]=function(_0x25f156,_0x4c734e){return client[_0xf33a('0x1')](_0xf33a('0x5'),{'body':_0x4c734e,'options':{'where':{'id':_0x25f156}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 7bce3dd..52fe677 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 _0x6c62=['Request','CreateMailMessage'];(function(_0x201002,_0x3a7f6b){var _0x1b088d=function(_0x547688){while(--_0x547688){_0x201002['push'](_0x201002['shift']());}};_0x1b088d(++_0x3a7f6b);}(_0x6c62,0xa8));var _0x26c6=function(_0xd1b4d7,_0x28b2c1){_0xd1b4d7=_0xd1b4d7-0x0;var _0x3002ec=_0x6c62[_0xd1b4d7];return _0x3002ec;};'use strict';var client=require('../client');exports['create']=function(_0x5a3d36){return client[_0x26c6('0x0')](_0x26c6('0x1'),{'body':_0x5a3d36,'log':'createMailMessage'});}; \ No newline at end of file +var _0x11e9=['Request','CreateMailMessage','createMailMessage','../client','create'];(function(_0x4d180c,_0x45c68e){var _0x49b57e=function(_0x264741){while(--_0x264741){_0x4d180c['push'](_0x4d180c['shift']());}};_0x49b57e(++_0x45c68e);}(_0x11e9,0xc1));var _0x911e=function(_0x46ff85,_0x419403){_0x46ff85=_0x46ff85-0x0;var _0x238e7a=_0x11e9[_0x46ff85];return _0x238e7a;};'use strict';var client=require(_0x911e('0x0'));exports[_0x911e('0x1')]=function(_0x5ad629){return client[_0x911e('0x2')](_0x911e('0x3'),{'body':_0x5ad629,'log':_0x911e('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index eb5c127..a3de9e5 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 _0xc6d1=['GetMailQueue','name','timeout','strategy','User','online','mailPause','../client','getMailQueues'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0xc6d1,0x97));var _0x1c6d=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xc6d1[_0x376b45];return _0x2341b3;};'use strict';var client=require(_0x1c6d('0x0'));exports[_0x1c6d('0x1')]=function(){return function(){return client['Request'](_0x1c6d('0x2'),{'options':{'raw':![],'attributes':['id',_0x1c6d('0x3'),_0x1c6d('0x4'),_0x1c6d('0x5')],'include':[{'model':_0x1c6d('0x6'),'as':'Agents','attributes':['id',_0x1c6d('0x3'),_0x1c6d('0x7'),_0x1c6d('0x8')]}]},'log':_0x1c6d('0x1')});};}; \ No newline at end of file +var _0xafb9=['strategy','User','Agents','mailPause','../client','getMailQueues','Request','GetMailQueue','name','timeout'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0xafb9,0x68));var _0x9afb=function(_0x189987,_0x458130){_0x189987=_0x189987-0x0;var _0x44876b=_0xafb9[_0x189987];return _0x44876b;};'use strict';var client=require(_0x9afb('0x0'));exports[_0x9afb('0x1')]=function(){return function(){return client[_0x9afb('0x2')](_0x9afb('0x3'),{'options':{'raw':![],'attributes':['id',_0x9afb('0x4'),_0x9afb('0x5'),_0x9afb('0x6')],'include':[{'model':_0x9afb('0x7'),'as':_0x9afb('0x8'),'attributes':['id','name','online',_0x9afb('0x9')]}]},'log':'getMailQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 8b47f85..d7a4baf 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 _0xac74=['DESC','../client','create','CreateMailQueueReport','Request','UpdateMailQueueReport'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xac74,0x133));var _0x4ac7=function(_0x2b8077,_0x453634){_0x2b8077=_0x2b8077-0x0;var _0x308091=_0xac74[_0x2b8077];return _0x308091;};'use strict';var client=require(_0x4ac7('0x0'));exports[_0x4ac7('0x1')]=function(_0x1f211a){return client['Request'](_0x4ac7('0x2'),{'body':_0x1f211a,'log':_0x4ac7('0x2')});};exports['update']=function(_0x4e496e,_0x64a716){return client[_0x4ac7('0x3')](_0x4ac7('0x4'),{'body':_0x64a716,'options':{'where':{'uniqueid':_0x4e496e},'order':[['id',_0x4ac7('0x5')]],'limit':0x1},'log':_0x4ac7('0x4')});}; \ No newline at end of file +var _0x266d=['CreateMailQueueReport','UpdateMailQueueReport','DESC','create','Request'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x266d,0x67));var _0xd266=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x266d[_0x42cae2];return _0x5f256f;};'use strict';var client=require('../client');exports[_0xd266('0x0')]=function(_0x264220){return client[_0xd266('0x1')]('CreateMailQueueReport',{'body':_0x264220,'log':_0xd266('0x2')});};exports['update']=function(_0x370dd1,_0x519b00){return client[_0xd266('0x1')](_0xd266('0x3'),{'body':_0x519b00,'options':{'where':{'uniqueid':_0x370dd1},'order':[['id',_0xd266('0x4')]],'limit':0x1},'log':_0xd266('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 9e6babc..063334b 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 _0x53e8=['updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','../client','update','Request','UpdateOpenchannelInteraction'];(function(_0x20b5ec,_0x535026){var _0x1a4d2f=function(_0x116eb2){while(--_0x116eb2){_0x20b5ec['push'](_0x20b5ec['shift']());}};_0x1a4d2f(++_0x535026);}(_0x53e8,0x17d));var _0x853e=function(_0x1ccdf7,_0x215d5a){_0x1ccdf7=_0x1ccdf7-0x0;var _0x52a0ae=_0x53e8[_0x1ccdf7];return _0x52a0ae;};'use strict';var client=require(_0x853e('0x0'));exports[_0x853e('0x1')]=function(_0x3f1989,_0x506f42){return client[_0x853e('0x2')](_0x853e('0x3'),{'body':_0x506f42,'options':{'where':{'id':_0x3f1989}},'log':_0x853e('0x4')});};exports[_0x853e('0x5')]=function(_0x4db684,_0x403e8d){return client[_0x853e('0x2')](_0x853e('0x6'),{'body':_0x403e8d,'options':{'where':{'id':_0x4db684}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x1960=['AddTagsToOpenchannelInteraction','addTagsToChatInteraction','update','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags'];(function(_0x4e6eb2,_0x16a451){var _0x4e0c1c=function(_0x59f144){while(--_0x59f144){_0x4e6eb2['push'](_0x4e6eb2['shift']());}};_0x4e0c1c(++_0x16a451);}(_0x1960,0xf7));var _0x0196=function(_0x38f7b7,_0x1c841a){_0x38f7b7=_0x38f7b7-0x0;var _0x1947ad=_0x1960[_0x38f7b7];return _0x1947ad;};'use strict';var client=require('../client');exports[_0x0196('0x0')]=function(_0x22d5b0,_0x24188a){return client[_0x0196('0x1')](_0x0196('0x2'),{'body':_0x24188a,'options':{'where':{'id':_0x22d5b0}},'log':_0x0196('0x3')});};exports[_0x0196('0x4')]=function(_0x53eb61,_0x23f921){return client[_0x0196('0x1')](_0x0196('0x5'),{'body':_0x23f921,'options':{'where':{'id':_0x53eb61}},'log':_0x0196('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index b513151..5745499 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 _0xa842=['createOpenchannelMessage','../client','create','CreateOpenchannelMessage'];(function(_0x34a6e9,_0x25cabe){var _0x11015c=function(_0x5c2ced){while(--_0x5c2ced){_0x34a6e9['push'](_0x34a6e9['shift']());}};_0x11015c(++_0x25cabe);}(_0xa842,0x1a1));var _0x2a84=function(_0x31be2d,_0x2f918a){_0x31be2d=_0x31be2d-0x0;var _0x5080eb=_0xa842[_0x31be2d];return _0x5080eb;};'use strict';var client=require(_0x2a84('0x0'));exports[_0x2a84('0x1')]=function(_0x1d4136){return client['Request'](_0x2a84('0x2'),{'body':_0x1d4136,'log':_0x2a84('0x3')});}; \ No newline at end of file +var _0xf910=['create','Request','createOpenchannelMessage'];(function(_0x23839a,_0x19ce2e){var _0x22e867=function(_0x23e976){while(--_0x23e976){_0x23839a['push'](_0x23839a['shift']());}};_0x22e867(++_0x19ce2e);}(_0xf910,0xba));var _0x0f91=function(_0x288fb2,_0x365d54){_0x288fb2=_0x288fb2-0x0;var _0x4aa5a8=_0xf910[_0x288fb2];return _0x4aa5a8;};'use strict';var client=require('../client');exports[_0x0f91('0x0')]=function(_0x1ce5fe){return client[_0x0f91('0x1')]('CreateOpenchannelMessage',{'body':_0x1ce5fe,'log':_0x0f91('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 1b24c3b..4f5a2cf 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 _0x05e6=['getOpenchannelQueues','Request','GetOpenchannelQueue','name','timeout','strategy','User','openchannelPause','../client'];(function(_0x212e9b,_0x2f64fa){var _0x49fccc=function(_0x2429e4){while(--_0x2429e4){_0x212e9b['push'](_0x212e9b['shift']());}};_0x49fccc(++_0x2f64fa);}(_0x05e6,0x1af));var _0x605e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x05e6[_0x5b561d];return _0x431060;};'use strict';var client=require(_0x605e('0x0'));exports[_0x605e('0x1')]=function(){return function(){return client[_0x605e('0x2')](_0x605e('0x3'),{'options':{'raw':![],'attributes':['id',_0x605e('0x4'),_0x605e('0x5'),_0x605e('0x6')],'include':[{'model':_0x605e('0x7'),'as':'Agents','attributes':['id',_0x605e('0x4'),'online',_0x605e('0x8')]}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file +var _0xf806=['name','timeout','strategy','User','Agents','../client','getOpenchannelQueues','Request'];(function(_0x15e73a,_0x311d86){var _0x5dccf6=function(_0x220e78){while(--_0x220e78){_0x15e73a['push'](_0x15e73a['shift']());}};_0x5dccf6(++_0x311d86);}(_0xf806,0x85));var _0x6f80=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf806[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x6f80('0x0'));exports[_0x6f80('0x1')]=function(){return function(){return client[_0x6f80('0x2')]('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id',_0x6f80('0x3'),_0x6f80('0x4'),_0x6f80('0x5')],'include':[{'model':_0x6f80('0x6'),'as':_0x6f80('0x7'),'attributes':['id',_0x6f80('0x3'),'online','openchannelPause']}]},'log':_0x6f80('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 0818f6d..1c0e105 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 _0x1806=['update','UpdateOpenchannelQueueReport','DESC','create','CreateOpenchannelQueueReport'];(function(_0x4e0ab8,_0x401afb){var _0x4c1f40=function(_0x7f95ef){while(--_0x7f95ef){_0x4e0ab8['push'](_0x4e0ab8['shift']());}};_0x4c1f40(++_0x401afb);}(_0x1806,0x8f));var _0x6180=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x1806[_0x3b380d];return _0x54502b;};'use strict';var client=require('../client');exports[_0x6180('0x0')]=function(_0x4d83db){return client['Request'](_0x6180('0x1'),{'body':_0x4d83db,'log':_0x6180('0x1')});};exports[_0x6180('0x2')]=function(_0x485d41,_0x5af5ab){return client['Request'](_0x6180('0x3'),{'body':_0x5af5ab,'options':{'where':{'uniqueid':_0x485d41},'order':[['id',_0x6180('0x4')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file +var _0x827a=['Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','DESC','../client'];(function(_0x954b3a,_0x10a7c1){var _0x3a313e=function(_0x1070ad){while(--_0x1070ad){_0x954b3a['push'](_0x954b3a['shift']());}};_0x3a313e(++_0x10a7c1);}(_0x827a,0x167));var _0xa827=function(_0x3288a6,_0x4b2af6){_0x3288a6=_0x3288a6-0x0;var _0x15a0a0=_0x827a[_0x3288a6];return _0x15a0a0;};'use strict';var client=require(_0xa827('0x0'));exports['create']=function(_0x538465){return client[_0xa827('0x1')](_0xa827('0x2'),{'body':_0x538465,'log':_0xa827('0x2')});};exports[_0xa827('0x3')]=function(_0x73d262,_0x57484c){return client[_0xa827('0x1')](_0xa827('0x4'),{'body':_0x57484c,'options':{'where':{'uniqueid':_0x73d262},'order':[['id',_0xa827('0x5')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index ac80946..b1cf6b0 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 _0xd0bb=['addTagsToSmsInteraction','../client','update','Request','updateSmsInteraction','addTags','AddTagsToSmsInteraction'];(function(_0x5b147a,_0x4cacdb){var _0x50cfca=function(_0x1a9e25){while(--_0x1a9e25){_0x5b147a['push'](_0x5b147a['shift']());}};_0x50cfca(++_0x4cacdb);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0xe4ee1e,_0xea8b9b){_0xe4ee1e=_0xe4ee1e-0x0;var _0x22f903=_0xd0bb[_0xe4ee1e];return _0x22f903;};'use strict';var client=require(_0xbd0b('0x0'));exports[_0xbd0b('0x1')]=function(_0x43bfb8,_0x5793c9){return client[_0xbd0b('0x2')]('UpdateSmsInteraction',{'body':_0x5793c9,'options':{'where':{'id':_0x43bfb8}},'log':_0xbd0b('0x3')});};exports[_0xbd0b('0x4')]=function(_0x53e6ce,_0x432acf){return client['Request'](_0xbd0b('0x5'),{'body':_0x432acf,'options':{'where':{'id':_0x53e6ce}},'log':_0xbd0b('0x6')});}; \ No newline at end of file +var _0x44e8=['../client','Request','UpdateSmsInteraction','updateSmsInteraction','AddTagsToSmsInteraction'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x44e8,0xd7));var _0x844e=function(_0x3836b6,_0x260317){_0x3836b6=_0x3836b6-0x0;var _0x6cd7fd=_0x44e8[_0x3836b6];return _0x6cd7fd;};'use strict';var client=require(_0x844e('0x0'));exports['update']=function(_0x4f0e7f,_0x1b5be7){return client[_0x844e('0x1')](_0x844e('0x2'),{'body':_0x1b5be7,'options':{'where':{'id':_0x4f0e7f}},'log':_0x844e('0x3')});};exports['addTags']=function(_0x3a8b3c,_0x167368){return client[_0x844e('0x1')](_0x844e('0x4'),{'body':_0x167368,'options':{'where':{'id':_0x3a8b3c}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index b732de1..9831d45 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 _0x0fdb=['../client','Request','createSmsMessage'];(function(_0x449864,_0x49b5a2){var _0x406fff=function(_0x2dcdb3){while(--_0x2dcdb3){_0x449864['push'](_0x449864['shift']());}};_0x406fff(++_0x49b5a2);}(_0x0fdb,0x1e3));var _0xb0fd=function(_0x1ebeea,_0x2f54f4){_0x1ebeea=_0x1ebeea-0x0;var _0x576465=_0x0fdb[_0x1ebeea];return _0x576465;};'use strict';var client=require(_0xb0fd('0x0'));exports['create']=function(_0x507d5e){return client[_0xb0fd('0x1')]('CreateSmsMessage',{'body':_0x507d5e,'log':_0xb0fd('0x2')});}; \ No newline at end of file +var _0x51b6=['CreateSmsMessage','createSmsMessage','../client','create'];(function(_0x3b7b4a,_0x2ad13a){var _0x44ae60=function(_0x17c56d){while(--_0x17c56d){_0x3b7b4a['push'](_0x3b7b4a['shift']());}};_0x44ae60(++_0x2ad13a);}(_0x51b6,0x66));var _0x651b=function(_0x2be33c,_0x4ba8c4){_0x2be33c=_0x2be33c-0x0;var _0x118ab6=_0x51b6[_0x2be33c];return _0x118ab6;};'use strict';var client=require(_0x651b('0x0'));exports[_0x651b('0x1')]=function(_0x327861){return client['Request'](_0x651b('0x2'),{'body':_0x327861,'log':_0x651b('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index e521eba..fa71205 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 _0x70e0=['User','Agents','online','../client','getSmsQueues','Request','timeout','strategy'];(function(_0x335ff7,_0x3853e4){var _0x38637c=function(_0x1628f9){while(--_0x1628f9){_0x335ff7['push'](_0x335ff7['shift']());}};_0x38637c(++_0x3853e4);}(_0x70e0,0x17b));var _0x070e=function(_0x28c4d4,_0x572299){_0x28c4d4=_0x28c4d4-0x0;var _0x1f4b52=_0x70e0[_0x28c4d4];return _0x1f4b52;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(){return function(){return client[_0x070e('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x070e('0x3'),_0x070e('0x4')],'include':[{'model':_0x070e('0x5'),'as':_0x070e('0x6'),'attributes':['id','name',_0x070e('0x7'),'smsPause']}]},'log':_0x070e('0x1')});};}; \ No newline at end of file +var _0x0713=['getSmsQueues','Request','GetSmsQueue','name','timeout','strategy','Agents','online','smsPause'];(function(_0x2b9e8a,_0x7b21d4){var _0x520e67=function(_0x22bce8){while(--_0x22bce8){_0x2b9e8a['push'](_0x2b9e8a['shift']());}};_0x520e67(++_0x7b21d4);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0x3071('0x0')](_0x3071('0x1'),{'options':{'raw':![],'attributes':['id',_0x3071('0x2'),_0x3071('0x3'),_0x3071('0x4')],'include':[{'model':'User','as':_0x3071('0x5'),'attributes':['id',_0x3071('0x2'),_0x3071('0x6'),_0x3071('0x7')]}]},'log':_0x3071('0x8')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 0216a21..577d6a0 100644 --- a/server/services/routing/rpc/smsQueueReport.js +++ b/server/services/routing/rpc/smsQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['CreateSmsQueueReport','UpdateSmsQueueReport','DESC','../client','Request'];(function(_0x45048e,_0xa62eea){var _0x575af4=function(_0x42c257){while(--_0x42c257){_0x45048e['push'](_0x45048e['shift']());}};_0x575af4(++_0xa62eea);}(_0x3e74,0x175));var _0x43e7=function(_0x37cfd2,_0x4cbc61){_0x37cfd2=_0x37cfd2-0x0;var _0x46027e=_0x3e74[_0x37cfd2];return _0x46027e;};'use strict';var client=require(_0x43e7('0x0'));exports['create']=function(_0x349480){return client[_0x43e7('0x1')](_0x43e7('0x2'),{'body':_0x349480,'log':'CreateSmsQueueReport'});};exports['update']=function(_0xc58479,_0x4f9bbe){return client[_0x43e7('0x1')](_0x43e7('0x3'),{'body':_0x4f9bbe,'options':{'where':{'uniqueid':_0xc58479},'order':[['id',_0x43e7('0x4')]],'limit':0x1},'log':_0x43e7('0x3')});}; \ No newline at end of file +var _0x3e74=['CreateSmsQueueReport','UpdateSmsQueueReport','DESC','../client','Request'];(function(_0x1a868d,_0x138cf0){var _0x307b59=function(_0x4e33c6){while(--_0x4e33c6){_0x1a868d['push'](_0x1a868d['shift']());}};_0x307b59(++_0x138cf0);}(_0x3e74,0x175));var _0x43e7=function(_0xae54b5,_0x4cf063){_0xae54b5=_0xae54b5-0x0;var _0xe5a645=_0x3e74[_0xae54b5];return _0xe5a645;};'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 c4b9dc6..2034415 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(_0x1912fd,_0x2ec304){var _0x573fc4=function(_0x2950a7){while(--_0x2950a7){_0x1912fd['push'](_0x1912fd['shift']());}};_0x573fc4(++_0x2ec304);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xa9e0[_0xbe200f];return _0x192597;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetUser',{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id',_0x0a9e('0x3'),'online',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'faxPause',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'chatCapacity','mailCapacity',_0x0a9e('0xc'),'smsCapacity','whatsappCapacity',_0x0a9e('0xd')]},'log':_0x0a9e('0x1')});};}; \ No newline at end of file +var _0xa9e0=['name','pauseType','lastPauseAt','voicePause','chatPause','mailPause','smsPause','whatsappPause','openchannelPause','faxCapacity','openchannelCapacity','../client','getAgents','Request'];(function(_0x12add8,_0x4a87bc){var _0x2ad466=function(_0x1f3739){while(--_0x1f3739){_0x12add8['push'](_0x12add8['shift']());}};_0x2ad466(++_0x4a87bc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'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 4e41958..0e10cc7 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 _0xb4b6=['update','Request','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction'];(function(_0x2e121c,_0x29b897){var _0x4055ef=function(_0x55ac72){while(--_0x55ac72){_0x2e121c['push'](_0x2e121c['shift']());}};_0x4055ef(++_0x29b897);}(_0xb4b6,0x7e));var _0x6b4b=function(_0x54c55c,_0x138b2b){_0x54c55c=_0x54c55c-0x0;var _0x28c537=_0xb4b6[_0x54c55c];return _0x28c537;};'use strict';var client=require('../client');exports[_0x6b4b('0x0')]=function(_0x475f60,_0x1ee7bf){return client[_0x6b4b('0x1')](_0x6b4b('0x2'),{'body':_0x1ee7bf,'options':{'where':{'id':_0x475f60}},'log':_0x6b4b('0x3')});};exports[_0x6b4b('0x4')]=function(_0xff2737,_0x422b21){return client['Request'](_0x6b4b('0x5'),{'body':_0x422b21,'options':{'where':{'id':_0xff2737}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file +var _0x39e6=['AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','UpdateWhatsappInteraction','updateWhatsappInteraction','Request'];(function(_0x8faf36,_0xde499){var _0x24f739=function(_0x11f6f0){while(--_0x11f6f0){_0x8faf36['push'](_0x8faf36['shift']());}};_0x24f739(++_0xde499);}(_0x39e6,0x9e));var _0x639e=function(_0x14e6df,_0x309264){_0x14e6df=_0x14e6df-0x0;var _0x358804=_0x39e6[_0x14e6df];return _0x358804;};'use strict';var client=require(_0x639e('0x0'));exports['update']=function(_0x2b265a,_0x5719fc){return client['Request'](_0x639e('0x1'),{'body':_0x5719fc,'options':{'where':{'id':_0x2b265a}},'log':_0x639e('0x2')});};exports['addTags']=function(_0x467229,_0x207d6a){return client[_0x639e('0x3')](_0x639e('0x4'),{'body':_0x207d6a,'options':{'where':{'id':_0x467229}},'log':_0x639e('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 7e718d0..8460099 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 _0xb18b=['../client','create','Request','CreateWhatsappMessage'];(function(_0x14ffe8,_0x4c2f13){var _0x4a4d2a=function(_0x254f85){while(--_0x254f85){_0x14ffe8['push'](_0x14ffe8['shift']());}};_0x4a4d2a(++_0x4c2f13);}(_0xb18b,0x1b4));var _0xbb18=function(_0x5585c3,_0x21920c){_0x5585c3=_0x5585c3-0x0;var _0x435d7d=_0xb18b[_0x5585c3];return _0x435d7d;};'use strict';var client=require(_0xbb18('0x0'));exports[_0xbb18('0x1')]=function(_0x598e82){return client[_0xbb18('0x2')](_0xbb18('0x3'),{'body':_0x598e82,'log':'createWhatsappMessage'});}; \ No newline at end of file +var _0xa669=['create','Request','createWhatsappMessage','../client'];(function(_0xbdd090,_0xbde27d){var _0x51b5d5=function(_0x3009b0){while(--_0x3009b0){_0xbdd090['push'](_0xbdd090['shift']());}};_0x51b5d5(++_0xbde27d);}(_0xa669,0x1ef));var _0x9a66=function(_0x3b16d1,_0x542134){_0x3b16d1=_0x3b16d1-0x0;var _0x382404=_0xa669[_0x3b16d1];return _0x382404;};'use strict';var client=require(_0x9a66('0x0'));exports[_0x9a66('0x1')]=function(_0x44e940){return client[_0x9a66('0x2')]('CreateWhatsappMessage',{'body':_0x44e940,'log':_0x9a66('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 3b77966..26e9cb3 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 _0xd61a=['online','whatsappPause','../client','getWhatsappQueues','Request','GetWhatsappQueue','timeout','strategy','User','name'];(function(_0xd10b43,_0x440ec1){var _0x369090=function(_0x5ae495){while(--_0x5ae495){_0xd10b43['push'](_0xd10b43['shift']());}};_0x369090(++_0x440ec1);}(_0xd61a,0x12e));var _0xad61=function(_0x36433c,_0x4fcfe5){_0x36433c=_0x36433c-0x0;var _0x1aa57d=_0xd61a[_0x36433c];return _0x1aa57d;};'use strict';var client=require(_0xad61('0x0'));exports[_0xad61('0x1')]=function(){return function(){return client[_0xad61('0x2')](_0xad61('0x3'),{'options':{'raw':![],'attributes':['id','name',_0xad61('0x4'),_0xad61('0x5')],'include':[{'model':_0xad61('0x6'),'as':'Agents','attributes':['id',_0xad61('0x7'),_0xad61('0x8'),_0xad61('0x9')]}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file +var _0xd07b=['../client','getWhatsappQueues','Request','timeout','strategy','User','Agents','whatsappPause'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xd07b,0xd8));var _0xbd07=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xd07b[_0x2dafbe];return _0x58a45a;};'use strict';var client=require(_0xbd07('0x0'));exports[_0xbd07('0x1')]=function(){return function(){return client[_0xbd07('0x2')]('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id','name',_0xbd07('0x3'),_0xbd07('0x4')],'include':[{'model':_0xbd07('0x5'),'as':_0xbd07('0x6'),'attributes':['id','name','online',_0xbd07('0x7')]}]},'log':_0xbd07('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 0435f6e..a536c7b 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 _0xb316=['UpdateWhatsappQueueReport','../client','create','Request','CreateWhatsappQueueReport','update'];(function(_0x2c6b0e,_0x1d2623){var _0x56cab6=function(_0x2225f8){while(--_0x2225f8){_0x2c6b0e['push'](_0x2c6b0e['shift']());}};_0x56cab6(++_0x1d2623);}(_0xb316,0x1cf));var _0x6b31=function(_0x1ca1bc,_0x346d4e){_0x1ca1bc=_0x1ca1bc-0x0;var _0x3dbf90=_0xb316[_0x1ca1bc];return _0x3dbf90;};'use strict';var client=require(_0x6b31('0x0'));exports[_0x6b31('0x1')]=function(_0x44cc26){return client[_0x6b31('0x2')](_0x6b31('0x3'),{'body':_0x44cc26,'log':_0x6b31('0x3')});};exports[_0x6b31('0x4')]=function(_0x394494,_0x4b8d07){return client['Request'](_0x6b31('0x5'),{'body':_0x4b8d07,'options':{'where':{'uniqueid':_0x394494},'order':[['id','DESC']],'limit':0x1},'log':_0x6b31('0x5')});}; \ No newline at end of file +var _0x003e=['UpdateWhatsappQueueReport','../client','Request','CreateWhatsappQueueReport','update','DESC'];(function(_0x24879e,_0x149278){var _0x47563d=function(_0x305d96){while(--_0x305d96){_0x24879e['push'](_0x24879e['shift']());}};_0x47563d(++_0x149278);}(_0x003e,0xc7));var _0xe003=function(_0x50a004,_0x193d84){_0x50a004=_0x50a004-0x0;var _0x5e9992=_0x003e[_0x50a004];return _0x5e9992;};'use strict';var client=require(_0xe003('0x0'));exports['create']=function(_0x349818){return client[_0xe003('0x1')](_0xe003('0x2'),{'body':_0x349818,'log':_0xe003('0x2')});};exports[_0xe003('0x3')]=function(_0x154a1a,_0x99a0dc){return client[_0xe003('0x1')]('UpdateWhatsappQueueReport',{'body':_0x99a0dc,'options':{'where':{'uniqueid':_0x154a1a},'order':[['id',_0xe003('0x4')]],'limit':0x1},'log':_0xe003('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index f0d52b8..5dc768c 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 _0x8be8=['next','agent','[%s][QUEUE]\x20%s','stack','util','seq-queue','../../../../config/logger','./strategy','string','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','validate','length','error','[%s][AGENT]\x20%s','stop','find','agents','createQueue','atimeout','channel','end','[%s][AGENT]\x20ROUTING\x20STOPPED','rules','complete','[%s][AGENT]\x20ROUTING\x20END','close'];(function(_0x2909a8,_0x1a5ac2){var _0x4e2568=function(_0xe98f7e){while(--_0xe98f7e){_0x2909a8['push'](_0x2909a8['shift']());}};_0x4e2568(++_0x1a5ac2);}(_0x8be8,0x1c4));var _0x88be=function(_0x23e614,_0x29311b){_0x23e614=_0x23e614-0x0;var _0x49ca7a=_0x8be8[_0x23e614];return _0x49ca7a;};'use strict';var schema=require('validate');var _=require('lodash');var util=require(_0x88be('0x0'));var seqqueue=require(_0x88be('0x1'));var logger=require(_0x88be('0x2'))('routing');var strategy=require(_0x88be('0x3'));var queue=schema({'name':{'type':_0x88be('0x4'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':'number','message':_0x88be('0x5')}});function writeLog(_0x59a221,_0x3de4c2,_0x320ead){return logger[_0x88be('0x6')](util[_0x88be('0x7')](_0x88be('0x8'),_0x59a221,_0x3de4c2['name'],_0x320ead));}function handleFindAgent(_0x134c25){return function(_0x52644a){return _0x52644a[_0x88be('0x9')][_0x88be('0xa')]()===_0x134c25[_0x88be('0xa')]();};}exports[_0x88be('0xb')]=function(_0x1cbfe3,_0x751cef,_0xfd6605,_0x200dc6){return function(_0x99e835){try{var _0x368ad6={'name':_0x751cef[0x0],'timeout':_0x751cef[0x1]};var _0x3cda2c=queue[_0x88be('0xc')](_0x368ad6,{'typecast':!![]});if(_0x3cda2c[_0x88be('0xd')]){logger[_0x88be('0xe')](_0x88be('0xf'),_0x1cbfe3,_['map'](_0x3cda2c,'message')['join'](',\x20'));_0x99e835[_0x88be('0x10')]();}else{var _0x20e4f3=_[_0x88be('0x11')](_0xfd6605[_0x88be('0x12')],handleFindAgent(_0x368ad6[_0x88be('0x9')]));if(_0x20e4f3){var _0x3d004a=(_0x368ad6['timeout']||0xa)*0x3e8;var _0x10922e,_0x1922d0;var _0x4a9448=seqqueue[_0x88be('0x13')](_0x3d004a);_0x4a9448['id']=_0x1cbfe3;_0x4a9448[_0x88be('0x14')]=_0x3d004a;_0x4a9448[_0x88be('0x15')]=_0x200dc6[_0x88be('0x15')];writeLog(_0x1cbfe3,_0x20e4f3,util['format']('START:%s',_0x3d004a));_0xfd6605['rules'][_0x1cbfe3]['on'](_0x88be('0x16'),function(){logger[_0x88be('0x6')](_0x88be('0x17'),_0x1cbfe3);clearTimeout(_0x1922d0);_0x1922d0=undefined;_0x4a9448['close']();if(_0xfd6605['rules'][_0x1cbfe3]){delete _0xfd6605[_0x88be('0x18')][_0x1cbfe3];}_0x99e835[_0x88be('0x10')]();});_0xfd6605[_0x88be('0x18')][_0x1cbfe3]['on'](_0x88be('0x19'),function(){if(_0xfd6605[_0x88be('0x18')][_0x1cbfe3]){delete _0xfd6605[_0x88be('0x18')][_0x1cbfe3];}});_0x1922d0=setTimeout(function(){logger[_0x88be('0x6')](_0x88be('0x1a'),_0x1cbfe3);clearTimeout(_0x1922d0);_0x4a9448[_0x88be('0x1b')]();_0x99e835[_0x88be('0x1c')]();},_0x3d004a);strategy[_0x88be('0x1d')](_0x4a9448,_0x20e4f3,_0xfd6605,_0x200dc6);}else{logger[_0x88be('0xe')]('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x1cbfe3,_0x368ad6[_0x88be('0x9')]);_0x99e835['stop']();}}}catch(_0x1d643c){console['log'](_0x1d643c);logger[_0x88be('0xe')](_0x88be('0x1e'),_0x1cbfe3,_0x1d643c[_0x88be('0x1f')]);_0x99e835[_0x88be('0x10')]();}};}; \ No newline at end of file +var _0xb891=['complete','[%s][AGENT]\x20ROUTING\x20END','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','validate','../../../../config/logger','routing','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','error','message','stop','createQueue','atimeout','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close'];(function(_0x49215f,_0x2ac66b){var _0xf81c5d=function(_0x509326){while(--_0x509326){_0x49215f['push'](_0x49215f['shift']());}};_0xf81c5d(++_0x2ac66b);}(_0xb891,0x18d));var _0x1b89=function(_0x57f98e,_0x3ae1e0){_0x57f98e=_0x57f98e-0x0;var _0xcc94c2=_0xb891[_0x57f98e];return _0xcc94c2;};'use strict';var schema=require(_0x1b89('0x0'));var _=require('lodash');var util=require('util');var seqqueue=require('seq-queue');var logger=require(_0x1b89('0x1'))(_0x1b89('0x2'));var strategy=require('./strategy');var queue=schema({'name':{'type':_0x1b89('0x3'),'required':!![],'message':_0x1b89('0x4')},'timeout':{'type':_0x1b89('0x5'),'message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x546c62,_0x58e819,_0x547f84){return logger[_0x1b89('0x6')](util[_0x1b89('0x7')](_0x1b89('0x8'),_0x546c62,_0x58e819[_0x1b89('0x9')],_0x547f84));}function handleFindAgent(_0x6aa766){return function(_0x56a4f8){return _0x56a4f8[_0x1b89('0x9')][_0x1b89('0xa')]()===_0x6aa766[_0x1b89('0xa')]();};}exports[_0x1b89('0xb')]=function(_0x5e9188,_0x11382d,_0x1e8901,_0x3e0298){return function(_0x5634be){try{var _0x54f4c5={'name':_0x11382d[0x0],'timeout':_0x11382d[0x1]};var _0x2c5751=queue[_0x1b89('0x0')](_0x54f4c5,{'typecast':!![]});if(_0x2c5751['length']){logger[_0x1b89('0xc')]('[%s][AGENT]\x20%s',_0x5e9188,_['map'](_0x2c5751,_0x1b89('0xd'))['join'](',\x20'));_0x5634be[_0x1b89('0xe')]();}else{var _0x1e6d09=_['find'](_0x1e8901['agents'],handleFindAgent(_0x54f4c5[_0x1b89('0x9')]));if(_0x1e6d09){var _0x47ec04=(_0x54f4c5['timeout']||0xa)*0x3e8;var _0xba2ea0,_0x13e75d;var _0x2257d5=seqqueue[_0x1b89('0xf')](_0x47ec04);_0x2257d5['id']=_0x5e9188;_0x2257d5[_0x1b89('0x10')]=_0x47ec04;_0x2257d5[_0x1b89('0x11')]=_0x3e0298[_0x1b89('0x11')];writeLog(_0x5e9188,_0x1e6d09,util['format'](_0x1b89('0x12'),_0x47ec04));_0x1e8901[_0x1b89('0x13')][_0x5e9188]['on'](_0x1b89('0x14'),function(){logger[_0x1b89('0x6')](_0x1b89('0x15'),_0x5e9188);clearTimeout(_0x13e75d);_0x13e75d=undefined;_0x2257d5[_0x1b89('0x16')]();if(_0x1e8901[_0x1b89('0x13')][_0x5e9188]){delete _0x1e8901[_0x1b89('0x13')][_0x5e9188];}_0x5634be[_0x1b89('0xe')]();});_0x1e8901[_0x1b89('0x13')][_0x5e9188]['on'](_0x1b89('0x17'),function(){if(_0x1e8901[_0x1b89('0x13')][_0x5e9188]){delete _0x1e8901[_0x1b89('0x13')][_0x5e9188];}});_0x13e75d=setTimeout(function(){logger[_0x1b89('0x6')](_0x1b89('0x18'),_0x5e9188);clearTimeout(_0x13e75d);_0x2257d5['close']();_0x5634be[_0x1b89('0x19')]();},_0x47ec04);strategy[_0x1b89('0x1a')](_0x2257d5,_0x1e6d09,_0x1e8901,_0x3e0298);}else{logger[_0x1b89('0xc')](_0x1b89('0x1b'),_0x5e9188,_0x54f4c5[_0x1b89('0x9')]);_0x5634be[_0x1b89('0xe')]();}}}catch(_0x37c5ed){console[_0x1b89('0x1c')](_0x37c5ed);logger[_0x1b89('0xc')](_0x1b89('0x1d'),_0x5e9188,_0x37c5ed['stack']);_0x5634be[_0x1b89('0xe')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/amazonlex.js b/server/services/routing/server/applications/amazonlex.js index f185a98..a0bce1d 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 _0xd755=['body','Message','create','then','catch','error','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','$LATEST','message','toString','postText','amazonlex','providerName','providerResponse','stringify','dialogState','Failed','lodash','moment','aws-sdk','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','interaction','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','chat','ChatWebsiteId','account','upperFirst','AccountId','created','isEmpty'];(function(_0xc7d149,_0x30b514){var _0x5442f4=function(_0x3d2841){while(--_0x3d2841){_0xc7d149['push'](_0xc7d149['shift']());}};_0x5442f4(++_0x30b514);}(_0xd755,0x109));var _0x5d75=function(_0x3fa37f,_0x397f16){_0x3fa37f=_0x3fa37f-0x0;var _0x5a01d5=_0xd755[_0x3fa37f];return _0x5a01d5;};'use strict';var _=require(_0x5d75('0x0'));var moment=require(_0x5d75('0x1'));var AWS=require(_0x5d75('0x2'));var utils=require(_0x5d75('0x3'));var logger=require('../../../../config/logger')(_0x5d75('0x4'));var rpc={'chatMessage':require(_0x5d75('0x5')),'openchannelMessage':require(_0x5d75('0x6')),'mailMessage':require(_0x5d75('0x7')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x5d75('0x8')),'whatsappMessage':require(_0x5d75('0x9'))};exports[_0x5d75('0xa')]=function(_0x28bcfc,_0x734a59){return function(_0x3ab586){try{if(!_['isNil'](this[_0x5d75('0xb')]['UserId'])){logger[_0x5d75('0xc')](_0x5d75('0xd'),_0x28bcfc,_0x5d75('0xe'));return _0x3ab586[_0x5d75('0xf')]();}var _0x576c78={'ContactId':this[_0x5d75('0x10')]['id'],'sentAt':moment()[_0x5d75('0x11')](_0x5d75('0x12')),'direction':_0x5d75('0x13')};if(this[_0x5d75('0x14')]===_0x5d75('0x15')||this[_0x5d75('0x14')]==='whatsapp'){_0x576c78['phone']=this[_0x5d75('0xb')]['phone'];}var _0x393b2d=this[_0x5d75('0x14')];if(_0x393b2d===_0x5d75('0x16')){_0x576c78[_0x5d75('0x17')]=this[_0x5d75('0x18')]['id'];}else{_0x576c78[_[_0x5d75('0x19')](_0x393b2d)+_0x5d75('0x1a')]=this[_0x5d75('0x18')]['id'];}_0x576c78[_['upperFirst'](_0x393b2d)+'InteractionId']=this[_0x5d75('0xb')]['id'];if(this[_0x5d75('0xb')][_0x5d75('0x1b')]){var _0x184ea0=_0x734a59[0x4];if(!_[_0x5d75('0x1c')](_0x184ea0)){_0x576c78[_0x5d75('0x1d')]=utils['getMustacheRender'](_0x184ea0,this);return rpc[_0x393b2d+_0x5d75('0x1e')][_0x5d75('0x1f')](_0x576c78)[_0x5d75('0x20')](function(_0x5f3678){logger[_0x5d75('0xc')](_0x5d75('0xd'),_0x28bcfc,_0x576c78[_0x5d75('0x1d')]);})[_0x5d75('0x21')](function(_0x3a9d31){logger[_0x5d75('0x22')](_0x5d75('0xd'),_0x28bcfc,JSON['stringify'](_0x3a9d31));})[_0x5d75('0x23')](function(){logger[_0x5d75('0xc')](_0x5d75('0x24'),_0x28bcfc);_0x3ab586[_0x5d75('0x25')]();});}else{logger[_0x5d75('0xc')](_0x5d75('0x26'),_0x28bcfc);_0x3ab586['stop']();}}else{var _0x35a8a4=this;var _0x58d962=new AWS['LexRuntime']({'accessKeyId':_0x734a59[0x0],'secretAccessKey':_0x734a59[0x1],'region':_0x734a59[0x2]});var _0x1dd1ed={'botAlias':_0x5d75('0x27'),'botName':_0x734a59[0x3],'inputText':this[_0x5d75('0x28')][_0x5d75('0x1d')],'userId':this[_0x5d75('0x14')]+':'+this[_0x5d75('0xb')]['id'][_0x5d75('0x29')]()};_0x58d962[_0x5d75('0x2a')](_0x1dd1ed,function(_0x3199a1,_0x4ab953){if(_0x3199a1){logger[_0x5d75('0x22')](_0x5d75('0xd'),_0x28bcfc,_0x3199a1[_0x5d75('0x28')]);_0x3ab586['next']();}else if(_0x4ab953&&_0x4ab953[_0x5d75('0x28')]){_0x35a8a4['body'][_0x5d75('0x2b')]=_0x4ab953;_0x576c78[_0x5d75('0x1d')]=_0x4ab953[_0x5d75('0x28')];_0x576c78[_0x5d75('0x2c')]=_0x5d75('0x2b');_0x576c78[_0x5d75('0x2d')]=JSON[_0x5d75('0x2e')](_0x4ab953);return rpc[_0x393b2d+'Message']['create'](_0x576c78)[_0x5d75('0x20')](function(_0x455925){logger['info']('[%s][AMAZONLEX]\x20%s',_0x28bcfc,_0x576c78[_0x5d75('0x1d')]);if(_0x4ab953[_0x5d75('0x2f')]==_0x5d75('0x30')){_0x3ab586[_0x5d75('0xf')]();}else{_0x3ab586[_0x5d75('0x25')]();}})['catch'](function(_0x254075){logger[_0x5d75('0x22')](_0x5d75('0xd'),_0x28bcfc,JSON[_0x5d75('0x2e')](_0x254075));_0x3ab586[_0x5d75('0xf')]();});}else{_0x3ab586[_0x5d75('0xf')]();}});}}catch(_0x436a43){logger['error'](_0x5d75('0xd'),_0x28bcfc,JSON[_0x5d75('0x2e')](_0x436a43));_0x3ab586[_0x5d75('0x25')]();}};}; \ No newline at end of file +var _0x4e3c=['UserId','info','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','InteractionId','created','getMustacheRender','then','[%s][AMAZONLEX]\x20%s','catch','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','message','body','toString','amazonlex','providerName','providerResponse','Message','create','dialogState','Failed','./utils','../../../../config/logger','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction'];(function(_0x5e1e0d,_0x16dd40){var _0x478529=function(_0xb8eacf){while(--_0xb8eacf){_0x5e1e0d['push'](_0x5e1e0d['shift']());}};_0x478529(++_0x16dd40);}(_0x4e3c,0x112));var _0xc4e3=function(_0x5d225a,_0x2debe9){_0x5d225a=_0x5d225a-0x0;var _0x1e7761=_0x4e3c[_0x5d225a];return _0x1e7761;};'use strict';var _=require('lodash');var moment=require('moment');var AWS=require('aws-sdk');var utils=require(_0xc4e3('0x0'));var logger=require(_0xc4e3('0x1'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xc4e3('0x2')),'faxMessage':require(_0xc4e3('0x3')),'whatsappMessage':require(_0xc4e3('0x4'))};exports[_0xc4e3('0x5')]=function(_0x20e7f7,_0x3c3637){return function(_0x4252c6){try{if(!_[_0xc4e3('0x6')](this[_0xc4e3('0x7')][_0xc4e3('0x8')])){logger[_0xc4e3('0x9')]('[%s][AMAZONLEX]\x20%s',_0x20e7f7,_0xc4e3('0xa'));return _0x4252c6[_0xc4e3('0xb')]();}var _0x280a37={'ContactId':this[_0xc4e3('0xc')]['id'],'sentAt':moment()[_0xc4e3('0xd')](_0xc4e3('0xe')),'direction':'out'};if(this[_0xc4e3('0xf')]===_0xc4e3('0x10')||this['channel']===_0xc4e3('0x11')){_0x280a37[_0xc4e3('0x12')]=this[_0xc4e3('0x7')]['phone'];}var _0x383e43=this[_0xc4e3('0xf')];if(_0x383e43===_0xc4e3('0x13')){_0x280a37[_0xc4e3('0x14')]=this[_0xc4e3('0x15')]['id'];}else{_0x280a37[_[_0xc4e3('0x16')](_0x383e43)+_0xc4e3('0x17')]=this['account']['id'];}_0x280a37[_[_0xc4e3('0x16')](_0x383e43)+_0xc4e3('0x18')]=this[_0xc4e3('0x7')]['id'];if(this[_0xc4e3('0x7')][_0xc4e3('0x19')]){var _0x3eba9c=_0x3c3637[0x4];if(!_['isEmpty'](_0x3eba9c)){_0x280a37['body']=utils[_0xc4e3('0x1a')](_0x3eba9c,this);return rpc[_0x383e43+'Message']['create'](_0x280a37)[_0xc4e3('0x1b')](function(_0x40de6c){logger[_0xc4e3('0x9')](_0xc4e3('0x1c'),_0x20e7f7,_0x280a37['body']);})[_0xc4e3('0x1d')](function(_0x45a1de){logger[_0xc4e3('0x1e')](_0xc4e3('0x1c'),_0x20e7f7,JSON[_0xc4e3('0x1f')](_0x45a1de));})[_0xc4e3('0x20')](function(){logger[_0xc4e3('0x9')](_0xc4e3('0x21'),_0x20e7f7);_0x4252c6[_0xc4e3('0x22')]();});}else{logger['info'](_0xc4e3('0x23'),_0x20e7f7);_0x4252c6[_0xc4e3('0x22')]();}}else{var _0x396cac=this;var _0x52d958=new AWS[(_0xc4e3('0x24'))]({'accessKeyId':_0x3c3637[0x0],'secretAccessKey':_0x3c3637[0x1],'region':_0x3c3637[0x2]});var _0x5cc003={'botAlias':'$LATEST','botName':_0x3c3637[0x3],'inputText':this[_0xc4e3('0x25')][_0xc4e3('0x26')],'userId':this[_0xc4e3('0xf')]+':'+this[_0xc4e3('0x7')]['id'][_0xc4e3('0x27')]()};_0x52d958['postText'](_0x5cc003,function(_0x498ac1,_0xfb7fc7){if(_0x498ac1){logger[_0xc4e3('0x1e')]('[%s][AMAZONLEX]\x20%s',_0x20e7f7,_0x498ac1['message']);_0x4252c6[_0xc4e3('0xb')]();}else if(_0xfb7fc7&&_0xfb7fc7[_0xc4e3('0x25')]){_0x396cac[_0xc4e3('0x26')][_0xc4e3('0x28')]=_0xfb7fc7;_0x280a37[_0xc4e3('0x26')]=_0xfb7fc7[_0xc4e3('0x25')];_0x280a37[_0xc4e3('0x29')]=_0xc4e3('0x28');_0x280a37[_0xc4e3('0x2a')]=JSON[_0xc4e3('0x1f')](_0xfb7fc7);return rpc[_0x383e43+_0xc4e3('0x2b')][_0xc4e3('0x2c')](_0x280a37)[_0xc4e3('0x1b')](function(_0x9d3347){logger[_0xc4e3('0x9')]('[%s][AMAZONLEX]\x20%s',_0x20e7f7,_0x280a37[_0xc4e3('0x26')]);if(_0xfb7fc7[_0xc4e3('0x2d')]==_0xc4e3('0x2e')){_0x4252c6[_0xc4e3('0xb')]();}else{_0x4252c6[_0xc4e3('0x22')]();}})[_0xc4e3('0x1d')](function(_0x57bed0){logger['error'](_0xc4e3('0x1c'),_0x20e7f7,JSON[_0xc4e3('0x1f')](_0x57bed0));_0x4252c6[_0xc4e3('0xb')]();});}else{_0x4252c6[_0xc4e3('0xb')]();}});}}catch(_0x195333){logger[_0xc4e3('0x1e')](_0xc4e3('0x1c'),_0x20e7f7,JSON[_0xc4e3('0x1f')](_0x195333));_0x4252c6[_0xc4e3('0x22')]();}};}; \ 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 307aaa2..62bd05c 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 _0xcfcd=['from','phone','read','subject','startsWith','ChatWebsiteId','account','upperFirst','AccountId','service','Smtp','host','port','secure','authentication','auth','inReplyTo','messageId','html','','replace','headers','auto-replied','All','auto_reply','sendMailMessage','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','stringify','catch','finally','resolve','Interaction','update','error','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','Message','stop','moment','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','consequence','channel','body','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','isNil','created','interaction','Autoreply\x20already\x20sent','next','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','out','getMustacheRender','message','mail'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0xcfcd,0x132));var _0xdcfc=function(_0x419423,_0x2acd18){_0x419423=_0x419423-0x0;var _0x4ba5b1=_0xcfcd[_0x419423];return _0x4ba5b1;};'use strict';var _=require('lodash');var moment=require(_0xdcfc('0x0'));var utils=require(_0xdcfc('0x1'));var logger=require(_0xdcfc('0x2'))('routing');var rpc={'chatMessage':require(_0xdcfc('0x3')),'openchannelMessage':require(_0xdcfc('0x4')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xdcfc('0x5')),'whatsappMessage':require(_0xdcfc('0x6')),'chatInteraction':require(_0xdcfc('0x7')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'mailInteraction':require(_0xdcfc('0x8')),'smsInteraction':require(_0xdcfc('0x9')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var mailRpc=require('../../mailRpc');exports[_0xdcfc('0xa')]=function(_0x5ddce8,_0x2c9651,_0xe358d9,_0x356fbb){return function(_0x397e07){try{var _0x12a602=this[_0xdcfc('0xb')];if(_0x12a602==='mail'&&_0x356fbb[_0xdcfc('0xc')]['isAutoreply']){logger[_0xdcfc('0xd')](_0xdcfc('0xe'),_0x5ddce8,_0xdcfc('0xf'));return _0x397e07['next']();}if(_0x2c9651[0x0]==='1'&&(_[_0xdcfc('0x10')](this['interaction'][_0xdcfc('0x11')])||!this[_0xdcfc('0x12')][_0xdcfc('0x11')])){logger[_0xdcfc('0xd')](_0xdcfc('0xe'),_0x5ddce8,_0xdcfc('0x13'));return _0x397e07[_0xdcfc('0x14')]();}if(_0x2c9651[0x0]==='2'&&this['interaction'][_0xdcfc('0x15')]){logger[_0xdcfc('0xd')](_0xdcfc('0x16'),_0x5ddce8,'One\x20Time\x20already\x20sent');return _0x397e07['next']();}var _0x5209e0={'ContactId':this['contact']['id'],'sentAt':moment()[_0xdcfc('0x17')](_0xdcfc('0x18')),'direction':_0xdcfc('0x19')};if(this['channel']==='mail'){_0x5209e0[_0xdcfc('0xc')]=utils['getMustacheRender'](_0x2c9651[0x2],this);}else{_0x5209e0[_0xdcfc('0xc')]=utils[_0xdcfc('0x1a')](_0x2c9651[0x1],this);}if(this[_0xdcfc('0x1b')]){_0x5209e0['to']=this[_0xdcfc('0x1b')]['from']||'';if(this[_0xdcfc('0xb')]===_0xdcfc('0x1c')&&_0x2c9651[0x1]==='1'){_0x5209e0['cc']=this['message']['cc']||'';}_0x5209e0[_0xdcfc('0x1d')]=this['message']['to']||'';_0x5209e0[_0xdcfc('0x1e')]=this[_0xdcfc('0x1b')][_0xdcfc('0x1e')]||'';_0x5209e0[_0xdcfc('0x1f')]=!![];if(this[_0xdcfc('0x1b')][_0xdcfc('0x20')]){_0x5209e0[_0xdcfc('0x20')]='';_0x5209e0['subject']+=_[_0xdcfc('0x21')](this[_0xdcfc('0x1b')][_0xdcfc('0x20')],'Re:')?'':'Re:\x20';_0x5209e0[_0xdcfc('0x20')]+=this[_0xdcfc('0x1b')][_0xdcfc('0x20')];}}if(this[_0xdcfc('0xb')]==='chat'){_0x5209e0[_0xdcfc('0x22')]=this[_0xdcfc('0x23')]['id'];}else{_0x5209e0[_[_0xdcfc('0x24')](this[_0xdcfc('0xb')])+_0xdcfc('0x25')]=this[_0xdcfc('0x23')]['id'];}_0x5209e0[_[_0xdcfc('0x24')](this[_0xdcfc('0xb')])+'InteractionId']=this[_0xdcfc('0x12')]['id'];var _0x5c9817=this['interaction'];if(rpc[this[_0xdcfc('0xb')]+'Message']){if(this[_0xdcfc('0xb')]===_0xdcfc('0x1c')){var _0x5abe98={'tls':{'rejectUnauthorized':![]}};if(this['account']['Smtp'][_0xdcfc('0x26')]){_0x5abe98[_0xdcfc('0x26')]=this[_0xdcfc('0x23')][_0xdcfc('0x27')][_0xdcfc('0x26')];}else{_0x5abe98[_0xdcfc('0x28')]=this[_0xdcfc('0x23')]['Smtp'][_0xdcfc('0x28')];_0x5abe98['port']=this[_0xdcfc('0x23')][_0xdcfc('0x27')][_0xdcfc('0x29')];_0x5abe98[_0xdcfc('0x2a')]=this['account'][_0xdcfc('0x27')][_0xdcfc('0x2a')];}if(this[_0xdcfc('0x23')][_0xdcfc('0x27')][_0xdcfc('0x2b')]){_0x5abe98[_0xdcfc('0x2c')]={'user':this[_0xdcfc('0x23')][_0xdcfc('0x27')]['user'],'pass':this[_0xdcfc('0x23')][_0xdcfc('0x27')]['pass']};}_0x5209e0[_0xdcfc('0x2d')]=this['message'][_0xdcfc('0x2e')];_0x5209e0[_0xdcfc('0x2f')]=_0xdcfc('0x30')+_[_0xdcfc('0x31')](_0x5209e0['body'],'';_0x5209e0[_0xdcfc('0x32')]={'Auto-Submitted':_0xdcfc('0x33'),'X-Auto-Response-Suppress':_0xdcfc('0x34'),'Precedence':_0xdcfc('0x35')};return mailRpc[_0xdcfc('0x36')](_0x5abe98,_0x5209e0)[_0xdcfc('0x37')](function(_0x3c4eb6){logger[_0xdcfc('0xd')](_0xdcfc('0x38'),_0x5ddce8);_0x5209e0[_0xdcfc('0x2e')]=_0x3c4eb6[_0xdcfc('0x1b')][_0xdcfc('0x2e')];return rpc[_0x12a602+'Message']['create'](_0x5209e0);})['then'](function(_0xb8ec04){logger[_0xdcfc('0xd')](_0xdcfc('0xe'),_0x5ddce8,JSON[_0xdcfc('0x39')](_0xb8ec04));})[_0xdcfc('0x3a')](function(_0x308335){logger['error']('[RPC][%s][AUTOREPLY]\x20%s',_0x5ddce8,JSON[_0xdcfc('0x39')](_0x308335));})[_0xdcfc('0x3b')](function(){Promise[_0xdcfc('0x3c')]()[_0xdcfc('0x37')](function(){if(_0x2c9651[0x0]!=='2'||_0x5c9817[_0xdcfc('0x15')])return;return rpc[_0x12a602+_0xdcfc('0x3d')][_0xdcfc('0x3e')](_0x5c9817['id'],{'autoreplyExecuted':!![]})['then'](function(_0x24ccae){logger[_0xdcfc('0xd')](_0xdcfc('0x16'),_0x5ddce8,JSON[_0xdcfc('0x39')](_0x24ccae));})[_0xdcfc('0x3a')](function(_0x5abee9){logger[_0xdcfc('0x3f')](_0xdcfc('0x40'),_0x5ddce8,JSON['stringify'](_0x5abee9));});})['then'](function(){_0x397e07['next']();});});}else{return rpc[this[_0xdcfc('0xb')]+_0xdcfc('0x41')]['create'](_0x5209e0)[_0xdcfc('0x37')](function(_0x336b66){logger[_0xdcfc('0xd')](_0xdcfc('0xe'),_0x5ddce8,_0x5209e0[_0xdcfc('0xc')]);})[_0xdcfc('0x3a')](function(_0x3bda7c){logger['error'](_0xdcfc('0xe'),_0x5ddce8,JSON['stringify'](_0x3bda7c));})[_0xdcfc('0x3b')](function(){Promise['resolve']()['then'](function(){if(_0x2c9651[0x0]!=='2'||_0x5c9817['autoreplyExecuted'])return;return rpc[_0x12a602+_0xdcfc('0x3d')]['update'](_0x5c9817['id'],{'autoreplyExecuted':!![]})[_0xdcfc('0x37')](function(_0x4f8578){logger[_0xdcfc('0xd')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x5ddce8,JSON[_0xdcfc('0x39')](_0x4f8578));})[_0xdcfc('0x3a')](function(_0x357d72){logger['error'](_0xdcfc('0x40'),_0x5ddce8,JSON[_0xdcfc('0x39')](_0x357d72));});})['then'](function(){_0x397e07[_0xdcfc('0x14')]();});});}}}catch(_0x117c35){logger[_0xdcfc('0x3f')](_0xdcfc('0xe'),_0x5ddce8,JSON[_0xdcfc('0x39')](_0x117c35));_0x397e07[_0xdcfc('0x42')]();}};}; \ No newline at end of file +var _0xd6ab=['then','update','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','Interaction','stop','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../mailRpc','consequence','channel','mail','body','isAutoreply','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','created','interaction','Autoreply\x20already\x20sent','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','format','out','getMustacheRender','message','from','phone','read','subject','startsWith','Re:','Re:\x20','chat','ChatWebsiteId','account','upperFirst','AccountId','Smtp','service','host','port','secure','authentication','auth','user','pass','inReplyTo','html','','','auto-replied','All','[%s][AUTOREPLY]\x20SMTP\x20SENT','messageId','Message','create','stringify','catch','error','finally','resolve'];(function(_0x5c0ff6,_0x22cdd2){var _0x1135cd=function(_0x55d5b0){while(--_0x55d5b0){_0x5c0ff6['push'](_0x5c0ff6['shift']());}};_0x1135cd(++_0x22cdd2);}(_0xd6ab,0x1c7));var _0xbd6a=function(_0x4a96ef,_0x5c1383){_0x4a96ef=_0x4a96ef-0x0;var _0x330714=_0xd6ab[_0x4a96ef];return _0x330714;};'use strict';var _=require('lodash');var moment=require('moment');var utils=require(_0xbd6a('0x0'));var logger=require(_0xbd6a('0x1'))('routing');var rpc={'chatMessage':require(_0xbd6a('0x2')),'openchannelMessage':require(_0xbd6a('0x3')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xbd6a('0x4')),'faxMessage':require(_0xbd6a('0x5')),'whatsappMessage':require(_0xbd6a('0x6')),'chatInteraction':require(_0xbd6a('0x7')),'openchannelInteraction':require(_0xbd6a('0x8')),'mailInteraction':require(_0xbd6a('0x9')),'smsInteraction':require(_0xbd6a('0xa')),'faxInteraction':require(_0xbd6a('0xb')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var mailRpc=require(_0xbd6a('0xc'));exports[_0xbd6a('0xd')]=function(_0x2456cf,_0x254f5c,_0x41d766,_0x52333a){return function(_0x865257){try{var _0x4e08c0=this[_0xbd6a('0xe')];if(_0x4e08c0===_0xbd6a('0xf')&&_0x52333a[_0xbd6a('0x10')][_0xbd6a('0x11')]){logger[_0xbd6a('0x12')](_0xbd6a('0x13'),_0x2456cf,_0xbd6a('0x14'));return _0x865257[_0xbd6a('0x15')]();}if(_0x254f5c[0x0]==='1'&&(_['isNil'](this['interaction'][_0xbd6a('0x16')])||!this[_0xbd6a('0x17')][_0xbd6a('0x16')])){logger[_0xbd6a('0x12')]('[%s][AUTOREPLY]\x20%s',_0x2456cf,_0xbd6a('0x18'));return _0x865257[_0xbd6a('0x15')]();}if(_0x254f5c[0x0]==='2'&&this['interaction'][_0xbd6a('0x19')]){logger[_0xbd6a('0x12')](_0xbd6a('0x1a'),_0x2456cf,_0xbd6a('0x1b'));return _0x865257[_0xbd6a('0x15')]();}var _0x459c9d={'ContactId':this[_0xbd6a('0x1c')]['id'],'sentAt':moment()[_0xbd6a('0x1d')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xbd6a('0x1e')};if(this['channel']===_0xbd6a('0xf')){_0x459c9d[_0xbd6a('0x10')]=utils[_0xbd6a('0x1f')](_0x254f5c[0x2],this);}else{_0x459c9d[_0xbd6a('0x10')]=utils['getMustacheRender'](_0x254f5c[0x1],this);}if(this[_0xbd6a('0x20')]){_0x459c9d['to']=this[_0xbd6a('0x20')][_0xbd6a('0x21')]||'';if(this['channel']===_0xbd6a('0xf')&&_0x254f5c[0x1]==='1'){_0x459c9d['cc']=this[_0xbd6a('0x20')]['cc']||'';}_0x459c9d['from']=this['message']['to']||'';_0x459c9d[_0xbd6a('0x22')]=this['message']['phone']||'';_0x459c9d[_0xbd6a('0x23')]=!![];if(this[_0xbd6a('0x20')][_0xbd6a('0x24')]){_0x459c9d[_0xbd6a('0x24')]='';_0x459c9d[_0xbd6a('0x24')]+=_[_0xbd6a('0x25')](this['message'][_0xbd6a('0x24')],_0xbd6a('0x26'))?'':_0xbd6a('0x27');_0x459c9d[_0xbd6a('0x24')]+=this[_0xbd6a('0x20')][_0xbd6a('0x24')];}}if(this['channel']===_0xbd6a('0x28')){_0x459c9d[_0xbd6a('0x29')]=this[_0xbd6a('0x2a')]['id'];}else{_0x459c9d[_[_0xbd6a('0x2b')](this['channel'])+_0xbd6a('0x2c')]=this['account']['id'];}_0x459c9d[_['upperFirst'](this[_0xbd6a('0xe')])+'InteractionId']=this[_0xbd6a('0x17')]['id'];var _0x4f8595=this[_0xbd6a('0x17')];if(rpc[this['channel']+'Message']){if(this[_0xbd6a('0xe')]===_0xbd6a('0xf')){var _0x1b2801={'tls':{'rejectUnauthorized':![]}};if(this['account'][_0xbd6a('0x2d')][_0xbd6a('0x2e')]){_0x1b2801[_0xbd6a('0x2e')]=this[_0xbd6a('0x2a')]['Smtp']['service'];}else{_0x1b2801[_0xbd6a('0x2f')]=this[_0xbd6a('0x2a')][_0xbd6a('0x2d')][_0xbd6a('0x2f')];_0x1b2801[_0xbd6a('0x30')]=this['account'][_0xbd6a('0x2d')][_0xbd6a('0x30')];_0x1b2801[_0xbd6a('0x31')]=this[_0xbd6a('0x2a')][_0xbd6a('0x2d')]['secure'];}if(this[_0xbd6a('0x2a')][_0xbd6a('0x2d')][_0xbd6a('0x32')]){_0x1b2801[_0xbd6a('0x33')]={'user':this[_0xbd6a('0x2a')]['Smtp'][_0xbd6a('0x34')],'pass':this['account'][_0xbd6a('0x2d')][_0xbd6a('0x35')]};}_0x459c9d[_0xbd6a('0x36')]=this['message']['messageId'];_0x459c9d[_0xbd6a('0x37')]=_0xbd6a('0x38')+_['replace'](_0x459c9d[_0xbd6a('0x10')],_0xbd6a('0x39'),']+(>|$)/g,''),'priorityTrue':_0x32ed5a[0x1],'priorityFalse':_0x32ed5a[0x2]};var _0x2ae2d8=gotoif[_0xb90e('0x0')](_0x436652,{'typecast':!![]});if(_0x2ae2d8[_0xb90e('0xb')]){logger[_0xb90e('0xc')]('[%s][GOTOIF]\x20%s',_0x4ac770,_['map'](_0x2ae2d8,_0xb90e('0xd'))[_0xb90e('0xe')](',\x20'));_0x2c9edd[_0xb90e('0xf')]();}else{try{var _0x466bac=eval('('+_0x436652[_0xb90e('0x10')]+')');var _0x35ea19=_0x466bac?_0x436652[_0xb90e('0x11')]:_0x436652[_0xb90e('0x12')];logger[_0xb90e('0x13')](_0xb90e('0x14'),_0x4ac770,_0x436652[_0xb90e('0x10')],_0x466bac,_0x35ea19||_0xb90e('0x15'));if(_0x35ea19){var _0x3545c2=_[_0xb90e('0x16')](_0x2c9edd['rules'](),{'p':_0x35ea19});if(_0x3545c2>=0x0){logger[_0xb90e('0x13')](_0xb90e('0x17'),_0x4ac770,_0x35ea19||_0xb90e('0x15'),_0x3545c2);_0x2c9edd[_0xb90e('0x15')](_0x3545c2);}else{logger[_0xb90e('0x13')]('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x4ac770,_0x35ea19||'next');_0x2c9edd[_0xb90e('0xf')]();}}else{_0x2c9edd['next']();}}catch(_0x18366a){logger[_0xb90e('0xc')]('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x4ac770,_0x18366a['message']);_0x2c9edd[_0xb90e('0xf')]();}}}catch(_0x17160f){logger[_0xb90e('0xc')](_0xb90e('0x18'),_0x4ac770,JSON[_0xb90e('0x19')](_0x17160f));_0x2c9edd['stop']();}};}; \ No newline at end of file +var _0xabf1=['priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','condition','rules','[%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','validate','lodash','html-to-text','./utils','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','length','error','[%s][GOTOIF]\x20%s','map','message','stop','priorityTrue'];(function(_0xcdf907,_0xa278cc){var _0x1ef90b=function(_0x1f90d8){while(--_0x1f90d8){_0xcdf907['push'](_0xcdf907['shift']());}};_0x1ef90b(++_0xa278cc);}(_0xabf1,0x13e));var _0x1abf=function(_0x409c8a,_0x56474e){_0x409c8a=_0x409c8a-0x0;var _0x3d1411=_0xabf1[_0x409c8a];return _0x3d1411;};'use strict';var schema=require(_0x1abf('0x0'));var _=require(_0x1abf('0x1'));var htmlToText=require(_0x1abf('0x2'));var utils=require(_0x1abf('0x3'));var logger=require('../../../../config/logger')(_0x1abf('0x4'));var gotoif=schema({'condition':{'type':_0x1abf('0x5'),'required':!![],'message':_0x1abf('0x6')},'priorityTrue':{'type':'number','message':'priority\x20true\x20is\x20a\x20number'},'priorityFalse':{'type':'number','message':_0x1abf('0x7')}});exports[_0x1abf('0x8')]=function(_0x1bf16a,_0x3791ae){return function(_0x283872){try{var _0x41461b={'condition':htmlToText[_0x1abf('0x9')](utils[_0x1abf('0xa')](_0x3791ae[0x0],this),{'wordwrap':![]})['replace'](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x3791ae[0x1],'priorityFalse':_0x3791ae[0x2]};var _0x2f1f42=gotoif[_0x1abf('0x0')](_0x41461b,{'typecast':!![]});if(_0x2f1f42[_0x1abf('0xb')]){logger[_0x1abf('0xc')](_0x1abf('0xd'),_0x1bf16a,_[_0x1abf('0xe')](_0x2f1f42,_0x1abf('0xf'))['join'](',\x20'));_0x283872[_0x1abf('0x10')]();}else{try{var _0x454505=eval('('+_0x41461b['condition']+')');var _0x285630=_0x454505?_0x41461b[_0x1abf('0x11')]:_0x41461b[_0x1abf('0x12')];logger[_0x1abf('0x13')](_0x1abf('0x14'),_0x1bf16a,_0x41461b[_0x1abf('0x15')],_0x454505,_0x285630||'next');if(_0x285630){var _0x4334be=_['findIndex'](_0x283872[_0x1abf('0x16')](),{'p':_0x285630});if(_0x4334be>=0x0){logger[_0x1abf('0x13')](_0x1abf('0x17'),_0x1bf16a,_0x285630||_0x1abf('0x18'),_0x4334be);_0x283872[_0x1abf('0x18')](_0x4334be);}else{logger[_0x1abf('0x13')](_0x1abf('0x19'),_0x1bf16a,_0x285630||_0x1abf('0x18'));_0x283872[_0x1abf('0x10')]();}}else{_0x283872[_0x1abf('0x18')]();}}catch(_0x3fdd25){logger[_0x1abf('0xc')](_0x1abf('0x1a'),_0x1bf16a,_0x3fdd25['message']);_0x283872[_0x1abf('0x10')]();}}}catch(_0x3a54f9){logger[_0x1abf('0xc')](_0x1abf('0xd'),_0x1bf16a,JSON[_0x1abf('0x1b')](_0x3a54f9));_0x283872[_0x1abf('0x10')]();}};}; \ 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 292b13f..3e54a9a 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 _0x4cb4=['number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','error','[%s][GOTOP]\x20%s','map','message','join','stop','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','info','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate','../../../../config/logger','routing'];(function(_0x389391,_0x27d994){var _0x34ac0e=function(_0x18261d){while(--_0x18261d){_0x389391['push'](_0x389391['shift']());}};_0x34ac0e(++_0x27d994);}(_0x4cb4,0xa5));var _0x44cb=function(_0x1a5687,_0xc2188f){_0x1a5687=_0x1a5687-0x0;var _0x257d5c=_0x4cb4[_0x1a5687];return _0x257d5c;};'use strict';var schema=require(_0x44cb('0x0'));var _=require('lodash');var logger=require(_0x44cb('0x1'))(_0x44cb('0x2'));var gotop=schema({'priority':{'type':_0x44cb('0x3'),'required':!![],'message':_0x44cb('0x4')}});exports[_0x44cb('0x5')]=function(_0x5d68c5,_0x468ffb){return function(_0x186e9d){try{var _0x473b43={'priority':_0x468ffb[0x0]};var _0x15eb13=gotop[_0x44cb('0x0')](_0x473b43,{'typecast':!![]});if(_0x15eb13['length']){logger[_0x44cb('0x6')](_0x44cb('0x7'),_0x5d68c5,_[_0x44cb('0x8')](_0x15eb13,_0x44cb('0x9'))[_0x44cb('0xa')](',\x20'));_0x186e9d[_0x44cb('0xb')]();}else{logger['info'](_0x44cb('0xc'),_0x5d68c5,_0x473b43['priority']);if(_0x473b43[_0x44cb('0xd')]){var _0x407141=_[_0x44cb('0xe')](_0x186e9d[_0x44cb('0xf')](),{'p':_0x473b43['priority']});if(_0x407141>=0x0){logger['info'](_0x44cb('0x10'),_0x5d68c5,_0x473b43['priority']||'next',_0x407141);_0x186e9d[_0x44cb('0x11')](_0x407141);}else{logger[_0x44cb('0x12')](_0x44cb('0x13'),_0x5d68c5,_0x473b43[_0x44cb('0xd')]||'next');_0x186e9d[_0x44cb('0xb')]();}}else{_0x186e9d['next']();}}}catch(_0x594448){logger[_0x44cb('0x6')](_0x44cb('0x7'),_0x5d68c5,JSON[_0x44cb('0x14')](_0x594448));_0x186e9d[_0x44cb('0xb')]();}};}; \ No newline at end of file +var _0x0b6f=['error','[%s][GOTOP]\x20%s','map','message','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','stringify','validate','lodash','../../../../config/logger','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length'];(function(_0x58e469,_0x95ee3e){var _0x4c01c5=function(_0x1ef7ae){while(--_0x1ef7ae){_0x58e469['push'](_0x58e469['shift']());}};_0x4c01c5(++_0x95ee3e);}(_0x0b6f,0x1f1));var _0xf0b6=function(_0x1c7137,_0x4c7c26){_0x1c7137=_0x1c7137-0x0;var _0xeb4432=_0x0b6f[_0x1c7137];return _0xeb4432;};'use strict';var schema=require(_0xf0b6('0x0'));var _=require(_0xf0b6('0x1'));var logger=require(_0xf0b6('0x2'))('routing');var gotop=schema({'priority':{'type':_0xf0b6('0x3'),'required':!![],'message':_0xf0b6('0x4')}});exports[_0xf0b6('0x5')]=function(_0x2ee45e,_0x1cd857){return function(_0x68b451){try{var _0x2ef4cd={'priority':_0x1cd857[0x0]};var _0x45481d=gotop['validate'](_0x2ef4cd,{'typecast':!![]});if(_0x45481d[_0xf0b6('0x6')]){logger[_0xf0b6('0x7')](_0xf0b6('0x8'),_0x2ee45e,_[_0xf0b6('0x9')](_0x45481d,_0xf0b6('0xa'))[_0xf0b6('0xb')](',\x20'));_0x68b451[_0xf0b6('0xc')]();}else{logger[_0xf0b6('0xd')](_0xf0b6('0xe'),_0x2ee45e,_0x2ef4cd[_0xf0b6('0xf')]);if(_0x2ef4cd[_0xf0b6('0xf')]){var _0x3dce2f=_[_0xf0b6('0x10')](_0x68b451[_0xf0b6('0x11')](),{'p':_0x2ef4cd[_0xf0b6('0xf')]});if(_0x3dce2f>=0x0){logger[_0xf0b6('0xd')](_0xf0b6('0x12'),_0x2ee45e,_0x2ef4cd[_0xf0b6('0xf')]||_0xf0b6('0x13'),_0x3dce2f);_0x68b451[_0xf0b6('0x13')](_0x3dce2f);}else{logger[_0xf0b6('0xd')]('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x2ee45e,_0x2ef4cd[_0xf0b6('0xf')]||_0xf0b6('0x13'));_0x68b451[_0xf0b6('0xc')]();}}else{_0x68b451['next']();}}}catch(_0x2350fd){logger[_0xf0b6('0x7')](_0xf0b6('0x8'),_0x2ee45e,JSON[_0xf0b6('0x14')](_0x2350fd));_0x68b451['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/message.js b/server/services/routing/server/applications/message.js index 188cda2..8bfe44b 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 _0x2b29=['../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','contact','channel','chat','ChatWebsiteId','account','upperFirst','InteractionId','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','error','stringify','stop','lodash','../../../../config/logger','routing'];(function(_0x117f4c,_0x36a9b1){var _0x2b24e9=function(_0x31761b){while(--_0x31761b){_0x117f4c['push'](_0x117f4c['shift']());}};_0x2b24e9(++_0x36a9b1);}(_0x2b29,0x135));var _0x92b2=function(_0x2ede77,_0x15e029){_0x2ede77=_0x2ede77-0x0;var _0x56a5f9=_0x2b29[_0x2ede77];return _0x56a5f9;};'use strict';var _=require(_0x92b2('0x0'));var utils=require('./utils');var logger=require(_0x92b2('0x1'))(_0x92b2('0x2'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x92b2('0x3')),'mailMessage':require(_0x92b2('0x4')),'smsMessage':require(_0x92b2('0x5')),'faxMessage':require(_0x92b2('0x6')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x92b2('0x7')]=function(_0x6754a0,_0x591321){return function(_0x1419c1){try{var _0x542994={'body':utils['getMustacheRender'](_0x591321[0x0],this),'ContactId':this[_0x92b2('0x8')]['id']};if(this[_0x92b2('0x9')]===_0x92b2('0xa')){_0x542994[_0x92b2('0xb')]=this[_0x92b2('0xc')]['id'];}else{_0x542994[_[_0x92b2('0xd')](this[_0x92b2('0x9')])+'AccountId']=this[_0x92b2('0xc')]['id'];}_0x542994[_[_0x92b2('0xd')](this['channel'])+_0x92b2('0xe')]=this[_0x92b2('0xf')]['id'];if(rpc[this[_0x92b2('0x9')]+'Message']){return rpc[this[_0x92b2('0x9')]+_0x92b2('0x10')][_0x92b2('0x11')](_0x542994)[_0x92b2('0x12')](function(_0x3944b5){logger[_0x92b2('0x13')](_0x92b2('0x14'),_0x6754a0,_0x542994['body']);_0x1419c1['next']();})['catch'](function(_0x5bcebf){logger[_0x92b2('0x15')](_0x92b2('0x14'),_0x6754a0,JSON[_0x92b2('0x16')](_0x5bcebf));_0x1419c1[_0x92b2('0x17')]();});}}catch(_0x114aca){logger[_0x92b2('0x15')](_0x92b2('0x14'),_0x6754a0,JSON['stringify'](_0x114aca));_0x1419c1['stop']();}};}; \ No newline at end of file +var _0xba91=['account','upperFirst','AccountId','InteractionId','interaction','Message','create','then','body','next','error','[%s][MESSAGE]\x20%s','stringify','stop','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','channel'];(function(_0x5b2aff,_0x19400c){var _0x1ebdb9=function(_0x355351){while(--_0x355351){_0x5b2aff['push'](_0x5b2aff['shift']());}};_0x1ebdb9(++_0x19400c);}(_0xba91,0xaa));var _0x1ba9=function(_0x32ce9d,_0x11968f){_0x32ce9d=_0x32ce9d-0x0;var _0x7d6620=_0xba91[_0x32ce9d];return _0x7d6620;};'use strict';var _=require('lodash');var utils=require(_0x1ba9('0x0'));var logger=require(_0x1ba9('0x1'))(_0x1ba9('0x2'));var rpc={'chatMessage':require(_0x1ba9('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x1ba9('0x4')),'smsMessage':require(_0x1ba9('0x5')),'faxMessage':require(_0x1ba9('0x6')),'whatsappMessage':require(_0x1ba9('0x7'))};exports[_0x1ba9('0x8')]=function(_0x310d88,_0x3c95fd){return function(_0x228ca7){try{var _0x11437c={'body':utils[_0x1ba9('0x9')](_0x3c95fd[0x0],this),'ContactId':this[_0x1ba9('0xa')]['id']};if(this[_0x1ba9('0xb')]==='chat'){_0x11437c['ChatWebsiteId']=this[_0x1ba9('0xc')]['id'];}else{_0x11437c[_[_0x1ba9('0xd')](this[_0x1ba9('0xb')])+_0x1ba9('0xe')]=this['account']['id'];}_0x11437c[_[_0x1ba9('0xd')](this['channel'])+_0x1ba9('0xf')]=this[_0x1ba9('0x10')]['id'];if(rpc[this[_0x1ba9('0xb')]+_0x1ba9('0x11')]){return rpc[this[_0x1ba9('0xb')]+_0x1ba9('0x11')][_0x1ba9('0x12')](_0x11437c)[_0x1ba9('0x13')](function(_0x151723){logger['info']('[%s][MESSAGE]\x20%s',_0x310d88,_0x11437c[_0x1ba9('0x14')]);_0x228ca7[_0x1ba9('0x15')]();})['catch'](function(_0x136a00){logger[_0x1ba9('0x16')](_0x1ba9('0x17'),_0x310d88,JSON[_0x1ba9('0x18')](_0x136a00));_0x228ca7[_0x1ba9('0x19')]();});}}catch(_0x575fe9){logger[_0x1ba9('0x16')](_0x1ba9('0x17'),_0x310d88,JSON[_0x1ba9('0x18')](_0x575fe9));_0x228ca7[_0x1ba9('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 4ebc712..ea813e9 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 _0xeada=['stop','./utils','../../../../config/logger','routing','consequence','info','[%s][NOOP]\x20%s','getMustacheRender','next','error','stringify'];(function(_0x285680,_0x18ce0e){var _0x4140ae=function(_0x388bd2){while(--_0x388bd2){_0x285680['push'](_0x285680['shift']());}};_0x4140ae(++_0x18ce0e);}(_0xeada,0x7a));var _0xaead=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xeada[_0x321bb2];return _0x9c12ed;};'use strict';var utils=require(_0xaead('0x0'));var logger=require(_0xaead('0x1'))(_0xaead('0x2'));exports[_0xaead('0x3')]=function(_0x222b3c,_0x160247){return function(_0x864a28){try{logger[_0xaead('0x4')](_0xaead('0x5'),_0x222b3c,utils[_0xaead('0x6')](_0x160247[0x0],this));_0x864a28[_0xaead('0x7')]();}catch(_0x28e0d5){logger[_0xaead('0x8')]('[%s][NOOP]\x20%s',_0x222b3c,JSON[_0xaead('0x9')](_0x28e0d5));_0x864a28[_0xaead('0xa')]();}};}; \ No newline at end of file +var _0xe6b4=['[%s][NOOP]\x20%s','next','error','stringify','stop','./utils','../../../../config/logger','routing','consequence'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xe6b4,0x188));var _0x4e6b=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xe6b4[_0x42cae2];return _0x5f256f;};'use strict';var utils=require(_0x4e6b('0x0'));var logger=require(_0x4e6b('0x1'))(_0x4e6b('0x2'));exports[_0x4e6b('0x3')]=function(_0x2f63c7,_0x3b4d4d){return function(_0x266601){try{logger['info'](_0x4e6b('0x4'),_0x2f63c7,utils['getMustacheRender'](_0x3b4d4d[0x0],this));_0x266601[_0x4e6b('0x5')]();}catch(_0x3fe09f){logger[_0x4e6b('0x6')]('[%s][NOOP]\x20%s',_0x2f63c7,JSON[_0x4e6b('0x7')](_0x3fe09f));_0x266601[_0x4e6b('0x8')]();}};}; \ 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 d2d1a2c..696c860 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 _0x51eb=['upperFirst','channel','InteractionId','interaction','MessageId','message','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','create\x20queue\x20report','accepted','update','error','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','length','map','stop','find','createQueue','atimeout','qtimeout','rules','end','close','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','validate','lodash','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','defaults','redis','localhost','socket.io-emitter','queue_id','queue','from','joinAt','clone','account','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','QueueId'];(function(_0x371a18,_0x50ae4c){var _0x59dfb4=function(_0x117c5c){while(--_0x117c5c){_0x371a18['push'](_0x371a18['shift']());}};_0x59dfb4(++_0x50ae4c);}(_0x51eb,0x169));var _0xb51e=function(_0x560b55,_0x338050){_0x560b55=_0x560b55-0x0;var _0x1e5ae4=_0x51eb[_0x560b55];return _0x1e5ae4;};'use strict';var schema=require(_0xb51e('0x0'));var _=require(_0xb51e('0x1'));var util=require('util');var seqqueue=require('seq-queue');var moment=require(_0xb51e('0x2'));var Redis=require(_0xb51e('0x3'));var config=require(_0xb51e('0x4'));var logger=require(_0xb51e('0x5'))(_0xb51e('0x6'));var strategy=require(_0xb51e('0x7'));config['redis']=_[_0xb51e('0x8')](config[_0xb51e('0x9')],{'host':_0xb51e('0xa'),'port':0x18eb});var io=require(_0xb51e('0xb'))(new Redis(config['redis']));var attributes=['id',_0xb51e('0xc'),'account',_0xb51e('0xd'),_0xb51e('0xe'),_0xb51e('0xf')];function emit(_0x13c074,_0x2ffa7e,_0x3540bf){io['to'](_0x13c074)['emit'](_0x2ffa7e,_0x3540bf);}function emitChannelQueueInteraction(_0x22c9b7,_0x5d8d3e,_0x2ba975,_0x37594f,_0xd02986,_0x3de574,_0x917310,_0x4d3672){var _0x174f48=_[_0xb51e('0x10')](_0x2ba975);_0x174f48[_0xb51e('0xc')]=_0x4d3672;_0x174f48[_0xb51e('0xd')]=_0x5d8d3e;_0x174f48[_0xb51e('0x11')]=_0x37594f;_0x174f48['id']=_0xd02986;if(_0x3de574){_0x917310[util[_0xb51e('0x12')](_0xb51e('0x13'),_0x22c9b7)][_0xd02986]=_[_0xb51e('0x14')](_0x174f48,attributes);}else{delete _0x917310[util[_0xb51e('0x12')](_0xb51e('0x13'),_0x22c9b7)][_0xd02986];}emit(util[_0xb51e('0x12')](_0xb51e('0x15'),_0x22c9b7,_0x5d8d3e),util[_0xb51e('0x12')](_0xb51e('0x16'),_0x22c9b7,_0x3de574?_0xb51e('0x17'):_0xb51e('0x18')),_['pick'](_0x174f48,attributes));}var rpc={'openchannelQueueReport':require(_0xb51e('0x19')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require(_0xb51e('0x1a')),'smsQueueReport':require(_0xb51e('0x1b')),'faxQueueReport':require(_0xb51e('0x1c')),'whatsappQueueReport':require(_0xb51e('0x1d'))};var queue=schema({'name':{'type':_0xb51e('0x1e'),'required':!![],'message':_0xb51e('0x1f')},'timeout':{'type':_0xb51e('0x20'),'message':'timeout\x20is\x20a\x20number'}});function startRouting(_0x17359c,_0x2c684c,_0x886bf9,_0x5a3410){if(_0x17359c&&_0x2c684c&&_0x886bf9){_0x2c684c[_0xb51e('0x21')]+=0x1;var _0x40dc32={'uniqueid':_0x17359c,'from':_0x886bf9[_0xb51e('0x22')]?_0x886bf9[_0xb51e('0x22')][_0xb51e('0xe')]:'','joinAt':moment()[_0xb51e('0x12')](_0xb51e('0x23')),'ContactId':_0x886bf9[_0xb51e('0x24')]?_0x886bf9[_0xb51e('0x24')]['id']:null,'ListId':_0x886bf9[_0xb51e('0x25')]?_0x886bf9[_0xb51e('0x25')]['id']:null};_0x40dc32[_['upperFirst'](_0x886bf9['channel'])+_0xb51e('0x26')]=_0x2c684c['id']||null;_0x40dc32[_[_0xb51e('0x27')](_0x886bf9[_0xb51e('0x28')])+_0xb51e('0x29')]=_0x886bf9[_0xb51e('0x2a')]?_0x886bf9['interaction']['id']:null;_0x40dc32[_[_0xb51e('0x27')](_0x886bf9['channel'])+_0xb51e('0x2b')]=_0x886bf9[_0xb51e('0x2c')]?_0x886bf9[_0xb51e('0x2c')]['id']:null;_0x40dc32[_['upperFirst'](_0x886bf9[_0xb51e('0x28')])+(_0x886bf9[_0xb51e('0x28')]!==_0xb51e('0x2d')?_0xb51e('0x2e'):_0xb51e('0x2f'))]=_0x886bf9[_0xb51e('0x11')]?_0x886bf9[_0xb51e('0x11')]['id']:null;logger[_0xb51e('0x30')](util[_0xb51e('0x12')](_0xb51e('0x31'),_0x17359c,_0x2c684c[_0xb51e('0x32')]));emitChannelQueueInteraction(_0x886bf9[_0xb51e('0x28')],_0x2c684c[_0xb51e('0x32')],_0x40dc32,_0x886bf9[_0xb51e('0x11')][_0xb51e('0x32')],_0x886bf9['message']['id'],!![],_0x5a3410,_0x2c684c['id']);if(rpc[_0x886bf9[_0xb51e('0x28')]+'QueueReport']){return rpc[_0x886bf9[_0xb51e('0x28')]+_0xb51e('0x33')][_0xb51e('0x34')](_0x40dc32)[_0xb51e('0x35')](function(_0x25b0ce){logger['error'](_0xb51e('0x36'));});}}}function stopRouting(_0x4cdd27,_0x55e26a,_0x5555a3,_0x57b660){if(_0x4cdd27&&_0x55e26a){_0x55e26a[_0xb51e('0x21')]-=0x1;var _0x5d3a78={'leaveAt':moment()['format'](_0xb51e('0x23')),'acceptAt':moment()['format'](_0xb51e('0x23')),'reason':_0xb51e('0x37')};logger['info'](util['format']('[%s][STOP:QUEUE][NAME:%s]',_0x4cdd27,_0x55e26a['name']));emitChannelQueueInteraction(_0x5555a3[_0xb51e('0x28')],_0x55e26a[_0xb51e('0x32')],_0x5555a3['body'],_0x5555a3[_0xb51e('0x11')][_0xb51e('0x32')],_0x5555a3[_0xb51e('0x2c')]['id'],![],_0x57b660,_0x55e26a['id']);if(rpc[_0x5555a3[_0xb51e('0x28')]+_0xb51e('0x33')]){return rpc[_0x5555a3['channel']+_0xb51e('0x33')][_0xb51e('0x38')](_0x4cdd27,_0x5d3a78)[_0xb51e('0x35')](function(_0x100f88){logger[_0xb51e('0x39')](_0xb51e('0x3a'));});}}}function endRouting(_0x14bd73,_0x4b4f21,_0x7b97bd,_0x173d0a){if(_0x14bd73&&_0x4b4f21){_0x4b4f21[_0xb51e('0x21')]-=0x1;var _0x3b7349={'leaveAt':moment()[_0xb51e('0x12')](_0xb51e('0x23')),'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0xb51e('0x3b')};logger[_0xb51e('0x30')](util[_0xb51e('0x12')](_0xb51e('0x3c'),_0x14bd73,_0x4b4f21[_0xb51e('0x32')]));emitChannelQueueInteraction(_0x7b97bd[_0xb51e('0x28')],_0x4b4f21['name'],_0x7b97bd[_0xb51e('0x22')],_0x7b97bd[_0xb51e('0x11')][_0xb51e('0x32')],_0x7b97bd[_0xb51e('0x2c')]['id'],![],_0x173d0a);if(rpc[_0x7b97bd[_0xb51e('0x28')]+_0xb51e('0x33')]){return rpc[_0x7b97bd[_0xb51e('0x28')]+_0xb51e('0x33')][_0xb51e('0x38')](_0x14bd73,_0x3b7349)[_0xb51e('0x35')](function(_0x266371){logger[_0xb51e('0x39')](_0xb51e('0x3a'));});}}}function handleFindQueue(_0x569478){return function(_0x4c6bfb){return _0x4c6bfb['name']['toLowerCase']()===_0x569478[_0xb51e('0x3d')]();};}exports['consequence']=function(_0x17c3f5,_0x1dcfed,_0x5a5762,_0x164e20){return function(_0x107298){try{var _0x51cc9d={'name':_0x1dcfed[0x0],'timeout':_0x1dcfed[0x1]};var _0x411a16=queue[_0xb51e('0x0')](_0x51cc9d,{'typecast':!![]});if(_0x411a16[_0xb51e('0x3e')]){logger[_0xb51e('0x39')]('[%s][QUEUE]\x20%s',_0x17c3f5,_[_0xb51e('0x3f')](_0x411a16,_0xb51e('0x2c'))['join'](',\x20'));_0x107298[_0xb51e('0x40')]();}else{var _0x120c5c=_[_0xb51e('0x41')](_0x5a5762[_0x164e20[_0xb51e('0x28')]+'Queues'],handleFindQueue(_0x51cc9d[_0xb51e('0x32')]));if(_0x120c5c){startRouting(_0x17c3f5,_0x120c5c,_0x164e20,_0x5a5762);var _0x3c8222=(_0x120c5c[_0xb51e('0x3b')]||0xa)*0x3e8;var _0x378352=(_0x51cc9d[_0xb51e('0x3b')]||0x14)*0x3e8;var _0x267ad6,_0x580c7f;if(_0x3c8222>_0x378352){_0x378352=_0x3c8222;}var _0x2bac39=seqqueue[_0xb51e('0x42')](_0x3c8222);_0x2bac39['id']=_0x17c3f5;_0x2bac39[_0xb51e('0x43')]=_0x3c8222;_0x2bac39[_0xb51e('0x44')]=_0x378352;_0x2bac39[_0xb51e('0x28')]=_0x164e20[_0xb51e('0x28')];_0x5a5762[_0xb51e('0x45')][_0x17c3f5]['on'](_0xb51e('0x46'),function(){logger[_0xb51e('0x30')]('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x17c3f5);stopRouting(_0x17c3f5,_0x120c5c,_0x164e20,_0x5a5762);clearTimeout(_0x267ad6);_0x267ad6=undefined;_0x2bac39[_0xb51e('0x47')](!![]);if(_0x5a5762[_0xb51e('0x45')][_0x17c3f5]){delete _0x5a5762[_0xb51e('0x45')][_0x17c3f5];}_0x107298[_0xb51e('0x40')]();});_0x5a5762[_0xb51e('0x45')][_0x17c3f5]['on']('complete',function(){if(_0x5a5762['rules'][_0x17c3f5]){delete _0x5a5762[_0xb51e('0x45')][_0x17c3f5];}});_0x267ad6=setTimeout(function(){logger['info'](_0xb51e('0x48'),_0x17c3f5);endRouting(_0x17c3f5,_0x120c5c,_0x164e20,_0x5a5762);clearTimeout(_0x267ad6);_0x2bac39['close'](!![]);_0x107298[_0xb51e('0x49')]();},_0x378352);switch(_0x120c5c[_0xb51e('0x4a')]){case'rrmemory':strategy[_0xb51e('0x4b')](_0x2bac39,_0x120c5c,_0x5a5762,_0x164e20);break;default:strategy[_0xb51e('0x4c')](_0x2bac39,_0x120c5c,_0x5a5762,_0x164e20);}}else{logger[_0xb51e('0x39')](_0xb51e('0x4d'),_0x17c3f5,_0x51cc9d[_0xb51e('0x32')]);_0x107298['stop']();}}}catch(_0xd392f2){console[_0xb51e('0x4e')](_0xd392f2);logger['error']('[%s][QUEUE]\x20%s',_0x17c3f5,_0xd392f2[_0xb51e('0x4f')]);_0x107298[_0xb51e('0x40')]();}};}; \ No newline at end of file +var _0xc087=['log','[%s][QUEUE]\x20%s','stack','validate','lodash','util','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','defaults','localhost','socket.io-emitter','queue_id','account','emit','queue','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','from','contact','list','upperFirst','channel','QueueId','InteractionId','interaction','MessageId','message','chat','WebsiteId','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','create\x20queue\x20report','YYYY-MM-DD\x20HH:mm:ss','accepted','[%s][STOP:QUEUE][NAME:%s]','update','error','update\x20queue\x20report','timeout','info','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','map','join','stop','Queues','qtimeout','rules','[%s][QUEUE]\x20ROUTING\x20STOPPED','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','[%s][QUEUE]\x20queue\x20not\x20found\x20%s'];(function(_0xf1c1d8,_0x51e295){var _0x9fe658=function(_0x203399){while(--_0x203399){_0xf1c1d8['push'](_0xf1c1d8['shift']());}};_0x9fe658(++_0x51e295);}(_0xc087,0x1dd));var _0x7c08=function(_0x5b6d2a,_0x2a4e3b){_0x5b6d2a=_0x5b6d2a-0x0;var _0x536640=_0xc087[_0x5b6d2a];return _0x536640;};'use strict';var schema=require(_0x7c08('0x0'));var _=require(_0x7c08('0x1'));var util=require(_0x7c08('0x2'));var seqqueue=require(_0x7c08('0x3'));var moment=require(_0x7c08('0x4'));var Redis=require(_0x7c08('0x5'));var config=require(_0x7c08('0x6'));var logger=require(_0x7c08('0x7'))(_0x7c08('0x8'));var strategy=require(_0x7c08('0x9'));config[_0x7c08('0xa')]=_[_0x7c08('0xb')](config[_0x7c08('0xa')],{'host':_0x7c08('0xc'),'port':0x18eb});var io=require(_0x7c08('0xd'))(new Redis(config['redis']));var attributes=['id',_0x7c08('0xe'),_0x7c08('0xf'),'queue','from','joinAt'];function emit(_0x3ffb80,_0x3e56e5,_0x32679d){io['to'](_0x3ffb80)[_0x7c08('0x10')](_0x3e56e5,_0x32679d);}function emitChannelQueueInteraction(_0x541b99,_0x44bdfa,_0x564479,_0x1011de,_0x367cd8,_0x3c4203,_0x3a417b,_0x4891b3){var _0x19b5e4=_['clone'](_0x564479);_0x19b5e4[_0x7c08('0xe')]=_0x4891b3;_0x19b5e4[_0x7c08('0x11')]=_0x44bdfa;_0x19b5e4[_0x7c08('0xf')]=_0x1011de;_0x19b5e4['id']=_0x367cd8;if(_0x3c4203){_0x3a417b[util[_0x7c08('0x12')](_0x7c08('0x13'),_0x541b99)][_0x367cd8]=_[_0x7c08('0x14')](_0x19b5e4,attributes);}else{delete _0x3a417b[util[_0x7c08('0x12')](_0x7c08('0x13'),_0x541b99)][_0x367cd8];}emit(util['format'](_0x7c08('0x15'),_0x541b99,_0x44bdfa),util[_0x7c08('0x12')](_0x7c08('0x16'),_0x541b99,_0x3c4203?_0x7c08('0x17'):_0x7c08('0x18')),_[_0x7c08('0x14')](_0x19b5e4,attributes));}var rpc={'openchannelQueueReport':require(_0x7c08('0x19')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require(_0x7c08('0x1a')),'whatsappQueueReport':require(_0x7c08('0x1b'))};var queue=schema({'name':{'type':_0x7c08('0x1c'),'required':!![],'message':_0x7c08('0x1d')},'timeout':{'type':_0x7c08('0x1e'),'message':_0x7c08('0x1f')}});function startRouting(_0x3868d5,_0x5a9ab8,_0xeb345e,_0x5e8fc5){if(_0x3868d5&&_0x5a9ab8&&_0xeb345e){_0x5a9ab8[_0x7c08('0x20')]+=0x1;var _0x5460f0={'uniqueid':_0x3868d5,'from':_0xeb345e[_0x7c08('0x21')]?_0xeb345e[_0x7c08('0x21')][_0x7c08('0x22')]:'','joinAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0xeb345e[_0x7c08('0x23')]?_0xeb345e[_0x7c08('0x23')]['id']:null,'ListId':_0xeb345e[_0x7c08('0x24')]?_0xeb345e[_0x7c08('0x24')]['id']:null};_0x5460f0[_[_0x7c08('0x25')](_0xeb345e[_0x7c08('0x26')])+_0x7c08('0x27')]=_0x5a9ab8['id']||null;_0x5460f0[_['upperFirst'](_0xeb345e['channel'])+_0x7c08('0x28')]=_0xeb345e[_0x7c08('0x29')]?_0xeb345e[_0x7c08('0x29')]['id']:null;_0x5460f0[_[_0x7c08('0x25')](_0xeb345e[_0x7c08('0x26')])+_0x7c08('0x2a')]=_0xeb345e[_0x7c08('0x2b')]?_0xeb345e[_0x7c08('0x2b')]['id']:null;_0x5460f0[_['upperFirst'](_0xeb345e['channel'])+(_0xeb345e[_0x7c08('0x26')]!==_0x7c08('0x2c')?'AccountId':_0x7c08('0x2d'))]=_0xeb345e['account']?_0xeb345e[_0x7c08('0xf')]['id']:null;logger['info'](util[_0x7c08('0x12')](_0x7c08('0x2e'),_0x3868d5,_0x5a9ab8['name']));emitChannelQueueInteraction(_0xeb345e[_0x7c08('0x26')],_0x5a9ab8['name'],_0x5460f0,_0xeb345e[_0x7c08('0xf')][_0x7c08('0x2f')],_0xeb345e[_0x7c08('0x2b')]['id'],!![],_0x5e8fc5,_0x5a9ab8['id']);if(rpc[_0xeb345e[_0x7c08('0x26')]+_0x7c08('0x30')]){return rpc[_0xeb345e[_0x7c08('0x26')]+_0x7c08('0x30')][_0x7c08('0x31')](_0x5460f0)[_0x7c08('0x32')](function(_0xfdb9f5){logger['error'](_0x7c08('0x33'));});}}}function stopRouting(_0x189a1e,_0x419db7,_0x464acb,_0x164cf5){if(_0x189a1e&&_0x419db7){_0x419db7[_0x7c08('0x20')]-=0x1;var _0x197d1e={'leaveAt':moment()[_0x7c08('0x12')](_0x7c08('0x34')),'acceptAt':moment()[_0x7c08('0x12')](_0x7c08('0x34')),'reason':_0x7c08('0x35')};logger['info'](util[_0x7c08('0x12')](_0x7c08('0x36'),_0x189a1e,_0x419db7[_0x7c08('0x2f')]));emitChannelQueueInteraction(_0x464acb[_0x7c08('0x26')],_0x419db7[_0x7c08('0x2f')],_0x464acb[_0x7c08('0x21')],_0x464acb[_0x7c08('0xf')][_0x7c08('0x2f')],_0x464acb[_0x7c08('0x2b')]['id'],![],_0x164cf5,_0x419db7['id']);if(rpc[_0x464acb['channel']+'QueueReport']){return rpc[_0x464acb[_0x7c08('0x26')]+_0x7c08('0x30')][_0x7c08('0x37')](_0x189a1e,_0x197d1e)[_0x7c08('0x32')](function(_0x83d272){logger[_0x7c08('0x38')](_0x7c08('0x39'));});}}}function endRouting(_0x53cde8,_0x1d2b30,_0x39900b,_0x1122c0){if(_0x53cde8&&_0x1d2b30){_0x1d2b30[_0x7c08('0x20')]-=0x1;var _0x3dc60c={'leaveAt':moment()[_0x7c08('0x12')](_0x7c08('0x34')),'exitAt':moment()['format'](_0x7c08('0x34')),'reason':_0x7c08('0x3a')};logger[_0x7c08('0x3b')](util[_0x7c08('0x12')](_0x7c08('0x3c'),_0x53cde8,_0x1d2b30[_0x7c08('0x2f')]));emitChannelQueueInteraction(_0x39900b[_0x7c08('0x26')],_0x1d2b30[_0x7c08('0x2f')],_0x39900b[_0x7c08('0x21')],_0x39900b['account'][_0x7c08('0x2f')],_0x39900b[_0x7c08('0x2b')]['id'],![],_0x1122c0);if(rpc[_0x39900b[_0x7c08('0x26')]+_0x7c08('0x30')]){return rpc[_0x39900b['channel']+_0x7c08('0x30')][_0x7c08('0x37')](_0x53cde8,_0x3dc60c)[_0x7c08('0x32')](function(_0x4cc494){logger[_0x7c08('0x38')](_0x7c08('0x39'));});}}}function handleFindQueue(_0x169a1f){return function(_0x2e26c1){return _0x2e26c1['name'][_0x7c08('0x3d')]()===_0x169a1f[_0x7c08('0x3d')]();};}exports[_0x7c08('0x3e')]=function(_0x42a59d,_0x452627,_0x333a8c,_0x272c9a){return function(_0x1d0bfc){try{var _0x4f9a06={'name':_0x452627[0x0],'timeout':_0x452627[0x1]};var _0x117345=queue['validate'](_0x4f9a06,{'typecast':!![]});if(_0x117345['length']){logger[_0x7c08('0x38')]('[%s][QUEUE]\x20%s',_0x42a59d,_[_0x7c08('0x3f')](_0x117345,'message')[_0x7c08('0x40')](',\x20'));_0x1d0bfc[_0x7c08('0x41')]();}else{var _0x3e7594=_['find'](_0x333a8c[_0x272c9a[_0x7c08('0x26')]+_0x7c08('0x42')],handleFindQueue(_0x4f9a06['name']));if(_0x3e7594){startRouting(_0x42a59d,_0x3e7594,_0x272c9a,_0x333a8c);var _0x5769fc=(_0x3e7594[_0x7c08('0x3a')]||0xa)*0x3e8;var _0x5ee033=(_0x4f9a06[_0x7c08('0x3a')]||0x14)*0x3e8;var _0x35d252,_0x15c445;if(_0x5769fc>_0x5ee033){_0x5ee033=_0x5769fc;}var _0x650d64=seqqueue['createQueue'](_0x5769fc);_0x650d64['id']=_0x42a59d;_0x650d64['atimeout']=_0x5769fc;_0x650d64[_0x7c08('0x43')]=_0x5ee033;_0x650d64[_0x7c08('0x26')]=_0x272c9a[_0x7c08('0x26')];_0x333a8c[_0x7c08('0x44')][_0x42a59d]['on']('end',function(){logger[_0x7c08('0x3b')](_0x7c08('0x45'),_0x42a59d);stopRouting(_0x42a59d,_0x3e7594,_0x272c9a,_0x333a8c);clearTimeout(_0x35d252);_0x35d252=undefined;_0x650d64['close'](!![]);if(_0x333a8c[_0x7c08('0x44')][_0x42a59d]){delete _0x333a8c[_0x7c08('0x44')][_0x42a59d];}_0x1d0bfc['stop']();});_0x333a8c['rules'][_0x42a59d]['on'](_0x7c08('0x46'),function(){if(_0x333a8c[_0x7c08('0x44')][_0x42a59d]){delete _0x333a8c[_0x7c08('0x44')][_0x42a59d];}});_0x35d252=setTimeout(function(){logger[_0x7c08('0x3b')](_0x7c08('0x47'),_0x42a59d);endRouting(_0x42a59d,_0x3e7594,_0x272c9a,_0x333a8c);clearTimeout(_0x35d252);_0x650d64['close'](!![]);_0x1d0bfc[_0x7c08('0x48')]();},_0x5ee033);switch(_0x3e7594[_0x7c08('0x49')]){case _0x7c08('0x4a'):strategy[_0x7c08('0x4a')](_0x650d64,_0x3e7594,_0x333a8c,_0x272c9a);break;default:strategy['beepall'](_0x650d64,_0x3e7594,_0x333a8c,_0x272c9a);}}else{logger[_0x7c08('0x38')](_0x7c08('0x4b'),_0x42a59d,_0x4f9a06[_0x7c08('0x2f')]);_0x1d0bfc['stop']();}}}catch(_0x50937f){console[_0x7c08('0x4c')](_0x50937f);logger['error'](_0x7c08('0x4d'),_0x42a59d,_0x50937f[_0x7c08('0x4e')]);_0x1d0bfc[_0x7c08('0x41')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/agent.js b/server/services/routing/server/applications/strategy/agent.js index 336a708..b5efc5e 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 _0x0379=['busy','busyQueue','writeLog','RINGING','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','TIMEOUT','exports','./util','../../../../../config/logger','routing','notificationId','squeue','agent','push','bind','handleTimeout','timeout','drained','handleDrained','handleRun','prototype','info','[%s][AGENT]\x20try\x20with\x20%s','isNil','realtime','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','agents'];(function(_0x204789,_0x2e6e57){var _0x2dded7=function(_0x2aa3af){while(--_0x2aa3af){_0x204789['push'](_0x204789['shift']());}};_0x2dded7(++_0x2e6e57);}(_0x0379,0xe2));var _0x9037=function(_0x57877f,_0x4e8af0){_0x57877f=_0x57877f-0x0;var _0x2a7640=_0x0379[_0x57877f];return _0x2a7640;};'use strict';var _=require('lodash');var uuid=require('uuid');var util=require(_0x9037('0x0'));var logger=require(_0x9037('0x1'))(_0x9037('0x2'));var Agent=function(_0x1fd741,_0x127fde,_0x3803c1,_0x58a3bf){this[_0x9037('0x3')]=uuid['v4']();this[_0x9037('0x4')]=_0x1fd741;this[_0x9037('0x5')]=_0x127fde;this['realtime']=_0x3803c1;this[_0x9037('0x2')]=_0x58a3bf;this[_0x9037('0x4')][_0x9037('0x6')](this['handleRun'][_0x9037('0x7')](this),this[_0x9037('0x8')][_0x9037('0x7')](this));this[_0x9037('0x4')]['on'](_0x9037('0x9'),this['handleTimeout'][_0x9037('0x7')](this));this['squeue']['on'](_0x9037('0xa'),this[_0x9037('0xb')][_0x9037('0x7')](this));};Agent['prototype']['push']=function(){this['squeue']['push'](this[_0x9037('0xc')][_0x9037('0x7')](this),this[_0x9037('0x8')][_0x9037('0x7')](this));};Agent[_0x9037('0xd')][_0x9037('0xb')]=function(){this[_0x9037('0x8')](!![]);};Agent[_0x9037('0xd')]['handleRun']=function(_0x172cf9){logger[_0x9037('0xe')](_0x9037('0xf'),this[_0x9037('0x4')]['id'],this[_0x9037('0x5')]['id']);if(_[_0x9037('0x10')](this[_0x9037('0x11')]['agents'][this[_0x9037('0x5')]['id']])){logger[_0x9037('0xe')](_0x9037('0x12'),this[_0x9037('0x4')]['id'],this[_0x9037('0x5')]['id']);setTimeout(this[_0x9037('0x6')][_0x9037('0x7')](this),0x3e8);}else{if(this['routing'][_0x9037('0x13')]||util[_0x9037('0x14')](this[_0x9037('0x4')]['id'],this['realtime'][_0x9037('0x15')][this[_0x9037('0x5')]['id']],this[_0x9037('0x4')]['channel'],![])){this[_0x9037('0x11')]['agents'][this['agent']['id']][_0x9037('0x16')]=!![];this[_0x9037('0x11')][_0x9037('0x15')][this[_0x9037('0x5')]['id']][_0x9037('0x17')]=undefined;util['showNotification'](this['notificationId'],this['squeue']['id'],this[_0x9037('0x11')][_0x9037('0x15')][this[_0x9037('0x5')]['id']],null,this['routing']);util[_0x9037('0x18')](this['squeue']['id'],this['realtime'][_0x9037('0x15')][this[_0x9037('0x5')]['id']],_0x9037('0x19')+(this[_0x9037('0x2')][_0x9037('0x13')]?':FORCED':''));}else{logger[_0x9037('0xe')](_0x9037('0x1a'),this[_0x9037('0x4')]['id'],this[_0x9037('0x5')]['id']);setTimeout(this['push'][_0x9037('0x7')](this),0x3e8);}}};Agent['prototype'][_0x9037('0x8')]=function(_0x30a4c3){if(_['isNil'](this[_0x9037('0x11')][_0x9037('0x15')][this[_0x9037('0x5')]['id']])){return logger[_0x9037('0xe')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x9037('0x4')]['id'],this[_0x9037('0x5')]['id']);}else{logger['info'](_0x9037('0x1b'),this[_0x9037('0x4')]['id'],this[_0x9037('0x5')]['id']);util[_0x9037('0x1c')](this['notificationId'],this['squeue']['id'],this[_0x9037('0x11')]['agents'][this[_0x9037('0x5')]['id']],null,this[_0x9037('0x2')]);this['realtime'][_0x9037('0x15')][this[_0x9037('0x5')]['id']][_0x9037('0x16')]=![];this[_0x9037('0x11')][_0x9037('0x15')][this['agent']['id']][_0x9037('0x17')]=undefined;util[_0x9037('0x18')](this[_0x9037('0x4')]['id'],this[_0x9037('0x11')][_0x9037('0x15')][this['agent']['id']],_0x30a4c3?'STOP':_0x9037('0x1d'));}if(!_0x30a4c3){setTimeout(this[_0x9037('0x6')][_0x9037('0x7')](this),0x3e8);}};function agent(_0x25d9cb,_0x5f1b0f,_0x218128,_0x5d2f75){return new Agent(_0x25d9cb,_0x5f1b0f,_0x218128,_0x5d2f75);}module[_0x9037('0x1e')]=agent; \ No newline at end of file +var _0xa6cf=['hideNotification','busy','STOP','TIMEOUT','lodash','uuid','../../../../../config/logger','routing','notificationId','agent','realtime','squeue','push','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','info','isNil','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','channel','agents','busyQueue','showNotification','writeLog','RINGING',':FORCED'];(function(_0x507f9e,_0x308d20){var _0x250f7e=function(_0x144202){while(--_0x144202){_0x507f9e['push'](_0x507f9e['shift']());}};_0x250f7e(++_0x308d20);}(_0xa6cf,0x124));var _0xfa6c=function(_0x51c0eb,_0xbc9f93){_0x51c0eb=_0x51c0eb-0x0;var _0x276713=_0xa6cf[_0x51c0eb];return _0x276713;};'use strict';var _=require(_0xfa6c('0x0'));var uuid=require(_0xfa6c('0x1'));var util=require('./util');var logger=require(_0xfa6c('0x2'))(_0xfa6c('0x3'));var Agent=function(_0x3e5581,_0x47411b,_0x17bea6,_0x7b37c4){this[_0xfa6c('0x4')]=uuid['v4']();this['squeue']=_0x3e5581;this[_0xfa6c('0x5')]=_0x47411b;this[_0xfa6c('0x6')]=_0x17bea6;this[_0xfa6c('0x3')]=_0x7b37c4;this[_0xfa6c('0x7')][_0xfa6c('0x8')](this[_0xfa6c('0x9')][_0xfa6c('0xa')](this),this[_0xfa6c('0xb')][_0xfa6c('0xa')](this));this[_0xfa6c('0x7')]['on'](_0xfa6c('0xc'),this['handleTimeout']['bind'](this));this['squeue']['on'](_0xfa6c('0xd'),this[_0xfa6c('0xe')][_0xfa6c('0xa')](this));};Agent['prototype']['push']=function(){this[_0xfa6c('0x7')][_0xfa6c('0x8')](this[_0xfa6c('0x9')][_0xfa6c('0xa')](this),this[_0xfa6c('0xb')][_0xfa6c('0xa')](this));};Agent[_0xfa6c('0xf')][_0xfa6c('0xe')]=function(){this['handleTimeout'](!![]);};Agent[_0xfa6c('0xf')][_0xfa6c('0x9')]=function(_0x412528){logger[_0xfa6c('0x10')]('[%s][AGENT]\x20try\x20with\x20%s',this['squeue']['id'],this[_0xfa6c('0x5')]['id']);if(_[_0xfa6c('0x11')](this[_0xfa6c('0x6')]['agents'][this[_0xfa6c('0x5')]['id']])){logger[_0xfa6c('0x10')](_0xfa6c('0x12'),this['squeue']['id'],this[_0xfa6c('0x5')]['id']);setTimeout(this[_0xfa6c('0x8')]['bind'](this),0x3e8);}else{if(this[_0xfa6c('0x3')][_0xfa6c('0x13')]||util[_0xfa6c('0x14')](this['squeue']['id'],this['realtime']['agents'][this['agent']['id']],this['squeue'][_0xfa6c('0x15')],![])){this[_0xfa6c('0x6')][_0xfa6c('0x16')][this[_0xfa6c('0x5')]['id']]['busy']=!![];this[_0xfa6c('0x6')][_0xfa6c('0x16')][this[_0xfa6c('0x5')]['id']][_0xfa6c('0x17')]=undefined;util[_0xfa6c('0x18')](this[_0xfa6c('0x4')],this[_0xfa6c('0x7')]['id'],this[_0xfa6c('0x6')][_0xfa6c('0x16')][this[_0xfa6c('0x5')]['id']],null,this[_0xfa6c('0x3')]);util[_0xfa6c('0x19')](this[_0xfa6c('0x7')]['id'],this[_0xfa6c('0x6')]['agents'][this['agent']['id']],_0xfa6c('0x1a')+(this[_0xfa6c('0x3')]['forcedOwnership']?_0xfa6c('0x1b'):''));}else{logger['info']('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this[_0xfa6c('0x7')]['id'],this[_0xfa6c('0x5')]['id']);setTimeout(this[_0xfa6c('0x8')][_0xfa6c('0xa')](this),0x3e8);}}};Agent[_0xfa6c('0xf')][_0xfa6c('0xb')]=function(_0x26c30e){if(_[_0xfa6c('0x11')](this[_0xfa6c('0x6')][_0xfa6c('0x16')][this[_0xfa6c('0x5')]['id']])){return logger[_0xfa6c('0x10')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xfa6c('0x7')]['id'],this['agent']['id']);}else{logger[_0xfa6c('0x10')]('[%s][AGENT]\x20timeout\x20with\x20%s',this[_0xfa6c('0x7')]['id'],this[_0xfa6c('0x5')]['id']);util[_0xfa6c('0x1c')](this[_0xfa6c('0x4')],this['squeue']['id'],this[_0xfa6c('0x6')][_0xfa6c('0x16')][this[_0xfa6c('0x5')]['id']],null,this[_0xfa6c('0x3')]);this[_0xfa6c('0x6')][_0xfa6c('0x16')][this[_0xfa6c('0x5')]['id']][_0xfa6c('0x1d')]=![];this[_0xfa6c('0x6')]['agents'][this[_0xfa6c('0x5')]['id']][_0xfa6c('0x17')]=undefined;util[_0xfa6c('0x19')](this[_0xfa6c('0x7')]['id'],this[_0xfa6c('0x6')][_0xfa6c('0x16')][this[_0xfa6c('0x5')]['id']],_0x26c30e?_0xfa6c('0x1e'):_0xfa6c('0x1f'));}if(!_0x26c30e){setTimeout(this[_0xfa6c('0x8')]['bind'](this),0x3e8);}};function agent(_0x3b8bb3,_0x31e2e2,_0x5770c0,_0x6e4c9e){return new Agent(_0x3b8bb3,_0x31e2e2,_0x5770c0,_0x6e4c9e);}module['exports']=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 087c110..3385d0e 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 _0x5075=['busy','busyQueue','name','showNotification','info','[%s][QUEUE]\x20EMPTY','hideNotification','STOP','TIMEOUT','exports','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','handleRun','bind','handleTimeout','timeout','handleDrained','push','prototype','isNil','queue','Agents','length','realtime','agents','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel','writeLog','RINGING'];(function(_0x17fbdb,_0x5ac3e3){var _0xd560c8=function(_0x2dffd8){while(--_0x2dffd8){_0x17fbdb['push'](_0x17fbdb['shift']());}};_0xd560c8(++_0x5ac3e3);}(_0x5075,0x73));var _0x5507=function(_0x20a68a,_0x54502e){_0x20a68a=_0x20a68a-0x0;var _0x56c5d4=_0x5075[_0x20a68a];return _0x56c5d4;};'use strict';var _=require(_0x5507('0x0'));var uuid=require(_0x5507('0x1'));var util=require(_0x5507('0x2'));var logger=require(_0x5507('0x3'))(_0x5507('0x4'));var Beepall=function(_0x2b444e,_0x1facf6,_0x518ca7,_0x3e96ee){this[_0x5507('0x5')]=uuid['v4']();this[_0x5507('0x6')]=_0x2b444e;this['queue']=_0x1facf6;this['realtime']=_0x518ca7;this[_0x5507('0x4')]=_0x3e96ee;this[_0x5507('0x6')]['push'](this[_0x5507('0x7')][_0x5507('0x8')](this),this[_0x5507('0x9')]['bind'](this));this['squeue']['on'](_0x5507('0xa'),this[_0x5507('0x9')][_0x5507('0x8')](this));this[_0x5507('0x6')]['on']('drained',this[_0x5507('0xb')][_0x5507('0x8')](this));};Beepall['prototype'][_0x5507('0xc')]=function(){this[_0x5507('0x6')]['push'](this[_0x5507('0x7')][_0x5507('0x8')](this),this[_0x5507('0x9')][_0x5507('0x8')](this));};Beepall[_0x5507('0xd')][_0x5507('0xb')]=function(_0x59889b){this[_0x5507('0x9')](!![]);};Beepall[_0x5507('0xd')][_0x5507('0x7')]=function(_0x46545d){var _0x4df473=!![];if(!_[_0x5507('0xe')](this[_0x5507('0xf')])&&!_[_0x5507('0xe')](this[_0x5507('0xf')][_0x5507('0x10')])&&this[_0x5507('0xf')][_0x5507('0x10')][_0x5507('0x11')]>0x0){for(var _0x3d1619=0x0,_0x2f0c7d;_0x3d16190x0){for(var _0x531908=0x0,_0x51c8d9;_0x5319080x0&&_0x57f37c[_0x37debf+_0x4afc('0x28')]>=_0x57f37c[_0x37debf+_0x4afc('0x27')]){writeLog(_0x3ecf2d,_0x57f37c,_0x37debf['toUpperCase']()+_0x4afc('0x29'));return![];}}return!![];};exports[_0x4afc('0x2a')]=function(_0x2d6112,_0x4e254d,_0x52212d,_0x54433f,_0x426e9d){return sendNotification(!![],_0x2d6112,_0x4e254d,_0x52212d,_0x54433f,_0x426e9d);};exports[_0x4afc('0x2b')]=function(_0x5e4747,_0xd26d2f,_0x628e42,_0x494fe7,_0x514278){return sendNotification(![],_0x5e4747,_0xd26d2f,_0x628e42,_0x494fe7,_0x514278);};exports['writeLog']=writeLog; \ No newline at end of file +var _0xfcf0=['body','queue','msg','getMustacheRender','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','error','[%s][QUEUE]\x20%s','message','name','format','save','remove','info','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','busy','BUSY','online','OFFLINE','Pause','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase','\x20MAXCAPACITY','showNotification','hideNotification','writeLog','lodash','util','mustache','ioredis','../../../../../config/environment','../../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','user:%s','user:save','\x20interaction','account','notificationSound','notificationShake'];(function(_0x50b293,_0x2186e3){var _0x36c290=function(_0x334280){while(--_0x334280){_0x50b293['push'](_0x50b293['shift']());}};_0x36c290(++_0x2186e3);}(_0xfcf0,0x138));var _0x0fcf=function(_0x32e649,_0x228649){_0x32e649=_0x32e649-0x0;var _0x14d386=_0xfcf0[_0x32e649];return _0x14d386;};'use strict';var _=require(_0x0fcf('0x0'));var util=require(_0x0fcf('0x1'));var utils=require('../utils');var Mustache=require(_0x0fcf('0x2'));var Redis=require(_0x0fcf('0x3'));var config=require(_0x0fcf('0x4'));var logger=require(_0x0fcf('0x5'))('routing');config[_0x0fcf('0x6')]=_[_0x0fcf('0x7')](config[_0x0fcf('0x6')],{'host':_0x0fcf('0x8'),'port':0x18eb});var io=require(_0x0fcf('0x9'))(new Redis(config[_0x0fcf('0x6')]));function emit(_0x61bbb9,_0x2dfdf8,_0x50c575){io['to'](_0x61bbb9)[_0x0fcf('0xa')](_0x2dfdf8,_0x50c575);}function sendNotification(_0x6ced94,_0xa9e007,_0x4de593,_0x69a840,_0x7ac7bd,_0x239e5d){io['to'](util['format'](_0x0fcf('0xb'),_0x69a840['name']))[_0x0fcf('0xa')](_0x0fcf('0xc'),_0x69a840);var _0x201a58=_0x239e5d||{};var _0x48619c=_0x4de593['split']('.');var _0x29336a={'uniqueid':_0xa9e007,'channel':_0x48619c[0x0],'id':_0x48619c[0x1],'title':_0x48619c[0x0]+_0x0fcf('0xd'),'interactionId':_0x48619c[0x2],'queue':_0x7ac7bd?_0x7ac7bd['name']:null,'sound':_0x201a58[_0x0fcf('0xe')][_0x0fcf('0xf')],'shake':_0x201a58[_0x0fcf('0xe')][_0x0fcf('0x10')]};try{if(!_0x201a58[_0x0fcf('0x11')]){_0x201a58['body']={};}if(_0x7ac7bd){_0x201a58[_0x0fcf('0x11')][_0x0fcf('0x12')]=_0x7ac7bd;}else if(_0x201a58[_0x0fcf('0x11')]['queue']){delete _0x201a58[_0x0fcf('0x11')][_0x0fcf('0x12')];}_0x29336a[_0x0fcf('0x13')]=utils[_0x0fcf('0x14')](_0x201a58['account'][_0x0fcf('0x15')],_0x201a58);}catch(_0x2f8289){_0x29336a[_0x0fcf('0x13')]=_0x0fcf('0x16');logger[_0x0fcf('0x17')](util['format'](_0x0fcf('0x18'),_0xa9e007,_0x2f8289[_0x0fcf('0x19')]));}io['to'](util['format'](_0x0fcf('0xb'),_0x69a840[_0x0fcf('0x1a')]))['emit'](util[_0x0fcf('0x1b')]('notification:%s',_0x6ced94?_0x0fcf('0x1c'):_0x0fcf('0x1d')),_0x29336a);}function writeLog(_0x5c8279,_0x457880,_0x3f28d0){return logger[_0x0fcf('0x1e')](util['format'](_0x0fcf('0x1f'),_0x5c8279,_0x457880[_0x0fcf('0x1a')],_0x3f28d0));}exports[_0x0fcf('0x20')]=function(_0x41b20b,_0x18af5c,_0x30e1b0,_0x5841a9){if(_0x18af5c[_0x0fcf('0x21')]){writeLog(_0x41b20b,_0x18af5c,_0x0fcf('0x22'));return![];}if(!_0x18af5c[_0x0fcf('0x23')]){writeLog(_0x41b20b,_0x18af5c,_0x0fcf('0x24'));return![];}if(_0x18af5c[_0x30e1b0+_0x0fcf('0x25')]){writeLog(_0x41b20b,_0x18af5c,_0x0fcf('0x26'));return![];}if(_0x5841a9&&_0x18af5c[_0x0fcf('0x27')](_0x30e1b0+_0x0fcf('0x28'))&&_0x18af5c[_0x0fcf('0x27')](_0x30e1b0+'CurrentCapacity')){if(_0x18af5c[_0x30e1b0+_0x0fcf('0x28')]>0x0&&_0x18af5c[_0x30e1b0+_0x0fcf('0x29')]>=_0x18af5c[_0x30e1b0+_0x0fcf('0x28')]){writeLog(_0x41b20b,_0x18af5c,_0x30e1b0[_0x0fcf('0x2a')]()+_0x0fcf('0x2b'));return![];}}return!![];};exports[_0x0fcf('0x2c')]=function(_0x2730b0,_0x527d43,_0x137e10,_0xbaa4d8,_0x200517){return sendNotification(!![],_0x2730b0,_0x527d43,_0x137e10,_0xbaa4d8,_0x200517);};exports[_0x0fcf('0x2d')]=function(_0x49fd0e,_0x5d9bcd,_0x4af80d,_0x428194,_0x50b7df){return sendNotification(![],_0x49fd0e,_0x5d9bcd,_0x4af80d,_0x428194,_0x50b7df);};exports[_0x0fcf('0x2e')]=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 1382a1c..a2ccc33 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 _0x7079=['info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','exec','[%s][SYSTEM]\x20result\x20code:\x20%s','isNil','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','stringify','validate','shelljs','./utils','../../../../config/logger','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][SYSTEM]\x20%s','map'];(function(_0x4196fc,_0x178761){var _0x4b67f5=function(_0x4e1ede){while(--_0x4e1ede){_0x4196fc['push'](_0x4196fc['shift']());}};_0x4b67f5(++_0x178761);}(_0x7079,0x68));var _0x9707=function(_0x17b869,_0x120b3a){_0x17b869=_0x17b869-0x0;var _0x5d437e=_0x7079[_0x17b869];return _0x5d437e;};'use strict';var schema=require(_0x9707('0x0'));var sh=require(_0x9707('0x1'));var _=require('lodash');var utils=require(_0x9707('0x2'));var logger=require(_0x9707('0x3'))('routing');var system=schema({'command':{'type':_0x9707('0x4'),'required':!![],'message':_0x9707('0x5')}});exports[_0x9707('0x6')]=function(_0x49896c,_0x1f11c8){return function(_0x223a40){try{var _0x4dcb1b={'command':_0x1f11c8[0x0]};var _0x2c7b04=system[_0x9707('0x0')](_0x4dcb1b,{'typecast':!![]});if(_0x2c7b04[_0x9707('0x7')]){logger[_0x9707('0x8')](_0x9707('0x9'),_0x49896c,_[_0x9707('0xa')](_0x2c7b04,'message')['join'](',\x20'));logger[_0x9707('0xb')](_0x9707('0xc'),_0x49896c);_0x223a40[_0x9707('0xd')]();}else{var _0x1d276f=this;var _0x460e9f=utils[_0x9707('0xe')](_0x1f11c8[0x0],this);logger[_0x9707('0xb')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x49896c,_0x460e9f);sh[_0x9707('0xf')](_['trim'](_0x460e9f),function(_0x5cab5f,_0x306591){logger[_0x9707('0xb')](_0x9707('0x10'),_0x49896c,_0x5cab5f);if(_0x5cab5f==0x0){var _0x3a845a=_0x306591['replace'](/(\r\n|\n|\r)/gm,'');if(_[_0x9707('0x11')](_0x1f11c8[0x1])||_['isEmpty'](_0x1f11c8[0x1])){logger[_0x9707('0xb')](_0x9707('0x12'),_0x49896c);_0x1d276f[_0x9707('0x13')][_0x1f11c8[0x1]]=_0x3a845a;}else{logger['info'](_0x9707('0x14'),_0x49896c,_0x1f11c8[0x1],_0x3a845a);_0x1d276f['body'][_0x1f11c8[0x1]]=_0x3a845a;}}_0x223a40[_0x9707('0xd')]();});}}catch(_0x44c3e7){logger[_0x9707('0x8')]('[%s][SYSTEM]\x20%s',_0x49896c,_[_0x9707('0x15')](_0x44c3e7)?JSON[_0x9707('0x16')](_0x44c3e7):_0x44c3e7);logger['info']('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x49896c);_0x223a40[_0x9707('0xd')]();}};}; \ No newline at end of file +var _0x83b2=['command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','error','[%s][SYSTEM]\x20%s','message','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','[%s][SYSTEM]\x20no\x20variable','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','body','isObject','stringify','validate','shelljs','lodash','./utils'];(function(_0x362b88,_0x19c0d1){var _0x286fc8=function(_0x54f21e){while(--_0x54f21e){_0x362b88['push'](_0x362b88['shift']());}};_0x286fc8(++_0x19c0d1);}(_0x83b2,0x110));var _0x283b=function(_0xc4719f,_0x1ae399){_0xc4719f=_0xc4719f-0x0;var _0x362b20=_0x83b2[_0xc4719f];return _0x362b20;};'use strict';var schema=require(_0x283b('0x0'));var sh=require(_0x283b('0x1'));var _=require(_0x283b('0x2'));var utils=require(_0x283b('0x3'));var logger=require('../../../../config/logger')('routing');var system=schema({'command':{'type':'string','required':!![],'message':_0x283b('0x4')}});exports[_0x283b('0x5')]=function(_0x24e1b9,_0x5e4c24){return function(_0x3358a4){try{var _0x5ae354={'command':_0x5e4c24[0x0]};var _0x14944c=system[_0x283b('0x0')](_0x5ae354,{'typecast':!![]});if(_0x14944c['length']){logger[_0x283b('0x6')](_0x283b('0x7'),_0x24e1b9,_['map'](_0x14944c,_0x283b('0x8'))['join'](',\x20'));logger[_0x283b('0x9')](_0x283b('0xa'),_0x24e1b9);_0x3358a4[_0x283b('0xb')]();}else{var _0xce891b=this;var _0x58142b=utils['getMustacheRender'](_0x5e4c24[0x0],this);logger[_0x283b('0x9')](_0x283b('0xc'),_0x24e1b9,_0x58142b);sh[_0x283b('0xd')](_[_0x283b('0xe')](_0x58142b),function(_0x3e8ff0,_0x159da3){logger[_0x283b('0x9')](_0x283b('0xf'),_0x24e1b9,_0x3e8ff0);if(_0x3e8ff0==0x0){var _0x577c2e=_0x159da3[_0x283b('0x10')](/(\r\n|\n|\r)/gm,'');if(_[_0x283b('0x11')](_0x5e4c24[0x1])||_['isEmpty'](_0x5e4c24[0x1])){logger['info'](_0x283b('0x12'),_0x24e1b9);_0xce891b['body'][_0x5e4c24[0x1]]=_0x577c2e;}else{logger[_0x283b('0x9')](_0x283b('0x13'),_0x24e1b9,_0x5e4c24[0x1],_0x577c2e);_0xce891b[_0x283b('0x14')][_0x5e4c24[0x1]]=_0x577c2e;}}_0x3358a4[_0x283b('0xb')]();});}}catch(_0x37badc){logger[_0x283b('0x6')](_0x283b('0x7'),_0x24e1b9,_[_0x283b('0x15')](_0x37badc)?JSON[_0x283b('0x16')](_0x37badc):_0x37badc);logger['info'](_0x283b('0xa'),_0x24e1b9);_0x3358a4[_0x283b('0xb')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tag.js b/server/services/routing/server/applications/tag.js index fca1579..f14af84 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 _0x8836=['isObject','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate','length','error','[%s][TAG]\x20%s','map','message','info','next','channel','Interaction','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','stringify','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','finally'];(function(_0x3740fe,_0x6c543c){var _0x55492b=function(_0x1f851f){while(--_0x1f851f){_0x3740fe['push'](_0x3740fe['shift']());}};_0x55492b(++_0x6c543c);}(_0x8836,0x1e7));var _0x6883=function(_0x3da480,_0x3327e0){_0x3da480=_0x3da480-0x0;var _0xda3942=_0x8836[_0x3da480];return _0xda3942;};'use strict';var schema=require('validate');var _=require('lodash');var rpc={'chatInteraction':require(_0x6883('0x0')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x6883('0x1')),'mailInteraction':require(_0x6883('0x2')),'faxInteraction':require(_0x6883('0x3')),'whatsappInteraction':require(_0x6883('0x4'))};var logger=require(_0x6883('0x5'))(_0x6883('0x6'));var tag=schema({'tag':{'type':'number','required':!![],'message':_0x6883('0x7')}});exports[_0x6883('0x8')]=function(_0x44f520,_0x1e942f,_0x3b2d75,_0x39e1be){return function(_0x286bfa){try{var _0x2b9acf={'tag':_0x1e942f[0x0]};var _0x3ebfda=tag[_0x6883('0x9')](_0x2b9acf,{'typecast':!![]});if(_0x3ebfda[_0x6883('0xa')]){logger[_0x6883('0xb')](_0x6883('0xc'),_0x44f520,_[_0x6883('0xd')](_0x3ebfda,_0x6883('0xe'))['join'](',\x20'));logger[_0x6883('0xf')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x44f520);_0x286bfa[_0x6883('0x10')]();}else{var _0x4496be={'ids':[_0x1e942f[0x0]]};if(rpc[_0x39e1be[_0x6883('0x11')]+_0x6883('0x12')]){rpc[_0x39e1be[_0x6883('0x11')]+_0x6883('0x12')][_0x6883('0x13')](_0x39e1be[_0x6883('0x14')]['id'],_0x4496be)[_0x6883('0x15')](function(_0x5c8442){logger[_0x6883('0xf')](_0x6883('0x16'),_0x44f520,_0x1e942f[0x1],_0x39e1be['channel'],_0x39e1be[_0x6883('0x14')]['id']);})['catch'](function(_0x6bea10){logger[_0x6883('0xb')](_0x6883('0xc'),_0x44f520,JSON[_0x6883('0x17')](_0x6bea10));logger[_0x6883('0xf')](_0x6883('0x18'),_0x44f520);})[_0x6883('0x19')](function(){_0x286bfa[_0x6883('0x10')]();});}}}catch(_0x536c84){logger[_0x6883('0xb')](_0x6883('0xc'),_0x44f520,_[_0x6883('0x1a')](_0x536c84)?JSON[_0x6883('0x17')](_0x536c84):_0x536c84);logger[_0x6883('0xf')](_0x6883('0x18'),_0x44f520);_0x286bfa[_0x6883('0x10')]();}};}; \ No newline at end of file +var _0x4bb6=['TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','error','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','channel','Interaction','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','[%s][TAG]\x20%s','stringify','finally','next','isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number'];(function(_0x3d5040,_0x56c3ba){var _0x2b7002=function(_0xf6c0af){while(--_0xf6c0af){_0x3d5040['push'](_0x3d5040['shift']());}};_0x2b7002(++_0x56c3ba);}(_0x4bb6,0x103));var _0x64bb=function(_0x2b6972,_0x3533de){_0x2b6972=_0x2b6972-0x0;var _0x265427=_0x4bb6[_0x2b6972];return _0x265427;};'use strict';var schema=require(_0x64bb('0x0'));var _=require(_0x64bb('0x1'));var rpc={'chatInteraction':require(_0x64bb('0x2')),'openchannelInteraction':require(_0x64bb('0x3')),'smsInteraction':require(_0x64bb('0x4')),'mailInteraction':require(_0x64bb('0x5')),'faxInteraction':require(_0x64bb('0x6')),'whatsappInteraction':require(_0x64bb('0x7'))};var logger=require(_0x64bb('0x8'))(_0x64bb('0x9'));var tag=schema({'tag':{'type':_0x64bb('0xa'),'required':!![],'message':_0x64bb('0xb')}});exports[_0x64bb('0xc')]=function(_0x1fdfcb,_0x27943e,_0x239af2,_0x46f9a2){return function(_0x235af6){try{var _0x5d5cbe={'tag':_0x27943e[0x0]};var _0x1669ca=tag[_0x64bb('0x0')](_0x5d5cbe,{'typecast':!![]});if(_0x1669ca['length']){logger[_0x64bb('0xd')]('[%s][TAG]\x20%s',_0x1fdfcb,_['map'](_0x1669ca,_0x64bb('0xe'))[_0x64bb('0xf')](',\x20'));logger[_0x64bb('0x10')](_0x64bb('0x11'),_0x1fdfcb);_0x235af6['next']();}else{var _0x5546a6={'ids':[_0x27943e[0x0]]};if(rpc[_0x46f9a2[_0x64bb('0x12')]+_0x64bb('0x13')]){rpc[_0x46f9a2[_0x64bb('0x12')]+_0x64bb('0x13')][_0x64bb('0x14')](_0x46f9a2[_0x64bb('0x15')]['id'],_0x5546a6)[_0x64bb('0x16')](function(_0x56f7ce){logger[_0x64bb('0x10')](_0x64bb('0x17'),_0x1fdfcb,_0x27943e[0x1],_0x46f9a2['channel'],_0x46f9a2[_0x64bb('0x15')]['id']);})[_0x64bb('0x18')](function(_0x12436c){logger['error'](_0x64bb('0x19'),_0x1fdfcb,JSON[_0x64bb('0x1a')](_0x12436c));logger[_0x64bb('0x10')](_0x64bb('0x11'),_0x1fdfcb);})[_0x64bb('0x1b')](function(){_0x235af6[_0x64bb('0x1c')]();});}}}catch(_0x338892){logger['error'](_0x64bb('0x19'),_0x1fdfcb,_[_0x64bb('0x1d')](_0x338892)?JSON[_0x64bb('0x1a')](_0x338892):_0x338892);logger[_0x64bb('0x10')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x1fdfcb);_0x235af6[_0x64bb('0x1c')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tvox.js b/server/services/routing/server/applications/tvox.js index f2ea7a6..09433c6 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 _0x4ed1=['jsonrpc','2.0','method','params','utf8','POST','application/json-rpc','parse','logged','channelId=','&serviceId=','&sessionId=','&data=','stringify','then','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','error','isObject','info','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','../../../../config/logger','routing','lodash','consequence','replace','includes','push','?params=','urlOnRing','title'];(function(_0x252ef4,_0x5094f5){var _0x35bd84=function(_0x1ecab9){while(--_0x1ecab9){_0x252ef4['push'](_0x252ef4['shift']());}};_0x35bd84(++_0x5094f5);}(_0x4ed1,0x9f));var _0x14ed=function(_0x1382e6,_0x102059){_0x1382e6=_0x1382e6-0x0;var _0x8c49b0=_0x4ed1[_0x1382e6];return _0x8c49b0;};'use strict';var rp=require(_0x14ed('0x0'));var logger=require(_0x14ed('0x1'))(_0x14ed('0x2'));var _=require(_0x14ed('0x3'));var arr=[];exports[_0x14ed('0x4')]=function(_0x55b43b,_0x3732db){return function(_0x3f445c){var _0x38377c=_0x3732db[0xa];var _0x50bb18=_0x3732db[0xb];var _0x49fbfe=_0x3732db[0xc];var _0x1be614=_0x3732db[0xd];var _0x4e03d0=_0x3732db[0xe];var _0x4aa674=_0x3732db[0xf][_0x14ed('0x5')](/\n/g,'\x20-\x20');var _0x468dda=_0x3732db[0x10]['replace'](/\n/g,'\x20');if(!arr[_0x14ed('0x6')](_0x50bb18)){arr[_0x14ed('0x7')](_0x50bb18);var _0xec3421=_0x3732db[0x3];var _0x532a47=_0x3732db[0x4];var _0x5543dc=_0x3732db[0x1];var _0x47cdd8=_0x3732db[0x0];var _0x520046={};_0x520046['urlOnAnswer']=_0x3732db[0x8]+_0x14ed('0x8')+_0x49fbfe+'|'+_0x38377c+'|'+_0x1be614+'|'+_0x50bb18+'|'+_0x4e03d0;_0x520046[_0x14ed('0x9')]=_0x3732db[0x7]+_0x14ed('0x8')+_0x49fbfe+'|'+_0x38377c+'|'+_0x1be614+'|'+_0x50bb18+'|'+_0x4e03d0+'|'+_0x4aa674+'|'+_0x468dda;_0x520046[_0x14ed('0xa')]=_0x3732db[0x9];var _0x515399={};_0x515399[_0x14ed('0xb')]=_0x14ed('0xc');_0x515399[_0x14ed('0xd')]='login';var _0x775a0e=[];_0x775a0e[_0x14ed('0x7')](_0x3732db[0x2]);_0x775a0e[_0x14ed('0x7')](_0x3732db[0x5]);_0x775a0e[_0x14ed('0x7')](_0x3732db[0x6]);_0x515399[_0x14ed('0xe')]=_0x775a0e;_0x515399['id']=0x1;var _0x36de99=JSON['stringify'](_0x515399);var _0x1a4e03={'encoding':_0x14ed('0xf'),'method':_0x14ed('0x10'),'timeout':0x2710,'url':_0xec3421,'headers':{'Content-Type':_0x14ed('0x11')},'body':_0x36de99};return rp(_0x1a4e03)['then'](function(_0x10d3a4){const _0x1d430d=JSON[_0x14ed('0x12')](_0x10d3a4);if(!_0x1d430d['result'][_0x14ed('0x13')]){throw new Error('Unable\x20to\x20login\x20with\x20TVox\x20application');}var _0x1c2c8f=_0x50bb18;var _0x44f6f5=_0x14ed('0x14')+_0x5543dc+_0x14ed('0x15')+_0x47cdd8+_0x14ed('0x16')+_0x1c2c8f+_0x14ed('0x17')+JSON[_0x14ed('0x18')](_0x520046);var _0x4802d8=_0x532a47+'?'+_0x44f6f5;return rp(_0x4802d8);})[_0x14ed('0x19')](function(_0x65ab74){logger['info'](_0x14ed('0x1a'),_0x55b43b,_0x65ab74);_0x3f445c[_0x14ed('0x1b')]();})[_0x14ed('0x1c')](function(_0x21cd14){logger[_0x14ed('0x1d')]('[%s][TVOX]\x20%s',_0x55b43b,_[_0x14ed('0x1e')](_0x21cd14)?JSON['stringify'](_0x21cd14):_0x21cd14);_0x3f445c[_0x14ed('0x1b')]();});}else{logger[_0x14ed('0x1f')](_0x14ed('0x20'),_0x55b43b);_0x3f445c[_0x14ed('0x21')]();}};}; \ No newline at end of file +var _0x4dd0=['\x20-\x20','includes','push','urlOnAnswer','?params=','urlOnRing','title','jsonrpc','2.0','method','params','stringify','utf8','POST','application/json-rpc','then','parse','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&data=','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','catch','isObject','stop','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','../../../../config/logger','routing','consequence','replace'];(function(_0xea0e09,_0x324857){var _0x22eb68=function(_0x515673){while(--_0x515673){_0xea0e09['push'](_0xea0e09['shift']());}};_0x22eb68(++_0x324857);}(_0x4dd0,0x146));var _0x04dd=function(_0x37198c,_0x2883ca){_0x37198c=_0x37198c-0x0;var _0x19197e=_0x4dd0[_0x37198c];return _0x19197e;};'use strict';var rp=require('request-promise');var logger=require(_0x04dd('0x0'))(_0x04dd('0x1'));var _=require('lodash');var arr=[];exports[_0x04dd('0x2')]=function(_0x256e5f,_0x526494){return function(_0x115a2b){var _0x16d4ec=_0x526494[0xa];var _0x4d1bd5=_0x526494[0xb];var _0x9bfc28=_0x526494[0xc];var _0x33ffa8=_0x526494[0xd];var _0x5cba29=_0x526494[0xe];var _0x455f57=_0x526494[0xf][_0x04dd('0x3')](/\n/g,_0x04dd('0x4'));var _0x599bfa=_0x526494[0x10]['replace'](/\n/g,'\x20');if(!arr[_0x04dd('0x5')](_0x4d1bd5)){arr[_0x04dd('0x6')](_0x4d1bd5);var _0x18eef3=_0x526494[0x3];var _0x45c682=_0x526494[0x4];var _0x135086=_0x526494[0x1];var _0x3f66fe=_0x526494[0x0];var _0x3b657e={};_0x3b657e[_0x04dd('0x7')]=_0x526494[0x8]+_0x04dd('0x8')+_0x9bfc28+'|'+_0x16d4ec+'|'+_0x33ffa8+'|'+_0x4d1bd5+'|'+_0x5cba29;_0x3b657e[_0x04dd('0x9')]=_0x526494[0x7]+_0x04dd('0x8')+_0x9bfc28+'|'+_0x16d4ec+'|'+_0x33ffa8+'|'+_0x4d1bd5+'|'+_0x5cba29+'|'+_0x455f57+'|'+_0x599bfa;_0x3b657e[_0x04dd('0xa')]=_0x526494[0x9];var _0x13a09f={};_0x13a09f[_0x04dd('0xb')]=_0x04dd('0xc');_0x13a09f[_0x04dd('0xd')]='login';var _0x4b1d60=[];_0x4b1d60[_0x04dd('0x6')](_0x526494[0x2]);_0x4b1d60['push'](_0x526494[0x5]);_0x4b1d60['push'](_0x526494[0x6]);_0x13a09f[_0x04dd('0xe')]=_0x4b1d60;_0x13a09f['id']=0x1;var _0x4a1214=JSON[_0x04dd('0xf')](_0x13a09f);var _0x719d52={'encoding':_0x04dd('0x10'),'method':_0x04dd('0x11'),'timeout':0x2710,'url':_0x18eef3,'headers':{'Content-Type':_0x04dd('0x12')},'body':_0x4a1214};return rp(_0x719d52)[_0x04dd('0x13')](function(_0x59be74){const _0x5beedf=JSON[_0x04dd('0x14')](_0x59be74);if(!_0x5beedf[_0x04dd('0x15')][_0x04dd('0x16')]){throw new Error(_0x04dd('0x17'));}var _0x359fa2=_0x4d1bd5;var _0x371b60=_0x04dd('0x18')+_0x135086+'&serviceId='+_0x3f66fe+'&sessionId='+_0x359fa2+_0x04dd('0x19')+JSON[_0x04dd('0xf')](_0x3b657e);var _0x23ec26=_0x45c682+'?'+_0x371b60;return rp(_0x23ec26);})[_0x04dd('0x13')](function(_0x3a3296){logger[_0x04dd('0x1a')](_0x04dd('0x1b'),_0x256e5f,_0x3a3296);_0x115a2b['stop']();})[_0x04dd('0x1c')](function(_0x515633){logger['error']('[%s][TVOX]\x20%s',_0x256e5f,_[_0x04dd('0x1d')](_0x515633)?JSON[_0x04dd('0xf')](_0x515633):_0x515633);_0x115a2b[_0x04dd('0x1e')]();});}else{logger[_0x04dd('0x1a')](_0x04dd('0x1f'),_0x256e5f);_0x115a2b[_0x04dd('0x20')]();}};}; \ 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 68feb7f..fe5dc10 100644 --- a/server/services/routing/server/applications/utils.js +++ b/server/services/routing/server/applications/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['message','account','interaction','mustache','lodash','exports','render','body','contact'];(function(_0x4ca6b1,_0x2ebdbf){var _0x4ab9c0=function(_0x21b17b){while(--_0x21b17b){_0x4ca6b1['push'](_0x4ca6b1['shift']());}};_0x4ab9c0(++_0x2ebdbf);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'use strict';var Mustache=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'getMustacheRender':function(_0x5dd881,_0x550fbc){return Mustache[_0x0a9e('0x3')](_0x5dd881,_['merge'](_0x550fbc[_0x0a9e('0x4')],{'contact':_0x550fbc[_0x0a9e('0x5')],'message':_0x550fbc[_0x0a9e('0x6')],'account':_0x550fbc[_0x0a9e('0x7')],'interaction':_0x550fbc[_0x0a9e('0x8')],'list':_0x550fbc['list']}))||'';}}; \ No newline at end of file +var _0xa9e0=['message','account','interaction','mustache','lodash','exports','render','body','contact'];(function(_0xf6f642,_0x420f81){var _0x1a1978=function(_0x40c87d){while(--_0x40c87d){_0xf6f642['push'](_0xf6f642['shift']());}};_0x1a1978(++_0x420f81);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'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 f2bf2ce..d35fb45 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 _0x823c=['body','%s:%s:%s','intervals','./applications/','priority','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','execute','info','Applications\x20executed','matchPath','emit','complete','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','busy','busyQueue','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','agents','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','available','loggedIn','name','paused','waiting','openchannelQueues','smsQueues','faxQueues','whatsappQueues','values','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','server','http','log','RPC\x20listening\x20on\x20port:','lodash','path','jayson/promise','bluebird','uuid','./applications/utils','../../../config/environment','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','IntervalId','isNil','map','Intervals','interval','listen','rules','channel','message','interaction','isArray','applications','length','join','app','.js','autoreply','split','push','slice','dialogflow','dialogflowv2','appdata','amazonlex','tag','TagId','tvox','getMustacheRender','notificationTemplate','ChatWebsiteId'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0x823c,0x143));var _0xc823=function(_0x483b24,_0x193698){_0x483b24=_0x483b24-0x0;var _0x67ce30=_0x823c[_0x483b24];return _0x67ce30;};'use strict';var _=require(_0xc823('0x0'));var util=require('util');var path=require(_0xc823('0x1'));var fs=require('fs');var jayson=require(_0xc823('0x2'));var BPromise=require(_0xc823('0x3'));var uuid=require(_0xc823('0x4'));var utils=require(_0xc823('0x5'));var config=require(_0xc823('0x6'));var logger=require('../../../config/logger')(_0xc823('0x7'));var rpc={'openchannelQueueReport':require(_0xc823('0x8')),'mailQueueReport':require(_0xc823('0x9')),'chatQueueReport':require(_0xc823('0xa')),'smsQueueReport':require(_0xc823('0xb')),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require(_0xc823('0xc'))};var RuleEngine=require(_0xc823('0xd'));function getId(_0x5daab9,_0x52bb76,_0x4478fc){return util[_0xc823('0xe')]('%s.%s.%s',_0x5daab9,_0x52bb76||0x0,_0x4478fc||0x0);}function getIntervals(_0x43bbd8,_0x2716a0){var _0x5c214c=[];if(!_['isNil'](_0x2716a0[_0xc823('0xf')])&&!_[_0xc823('0x10')](_0x43bbd8[_0x2716a0[_0xc823('0xf')]])&&!_[_0xc823('0x10')](_0x43bbd8[_0x2716a0[_0xc823('0xf')]]['Intervals'])){_0x5c214c=_[_0xc823('0x11')](_0x43bbd8[_0x2716a0[_0xc823('0xf')]][_0xc823('0x12')],_0xc823('0x13'));}else if(!_[_0xc823('0x10')](_0x2716a0[_0xc823('0x13')])){_0x5c214c=[_0x2716a0['interval']];}return _0x5c214c;}exports[_0xc823('0x14')]=function(_0xff0ec2){_0xff0ec2[_0xc823('0x15')]={};return new BPromise(function(_0x4571cd,_0x55b31d){var _0x4bc9c9={'Start':function(_0x59749d){var _0x5bdfc9=this;return new Promise(function(_0x565aeb,_0x5d3521){if(_0x59749d){try{var _0x366c31=[];var _0x122510=getId(_0x59749d[_0xc823('0x16')],_0x59749d[_0xc823('0x17')]?_0x59749d[_0xc823('0x17')]['id']:0x0,_0x59749d[_0xc823('0x18')]?_0x59749d[_0xc823('0x18')]['id']:0x0);if(_0x59749d['applications']&&_[_0xc823('0x19')](_0x59749d['applications'])&&_0x59749d[_0xc823('0x1a')][_0xc823('0x1b')]){for(var _0x3d3ddb=0x0;_0x3d3ddb<_0x59749d['applications'][_0xc823('0x1b')];_0x3d3ddb+=0x1){var _0x2cacfd=_0x59749d[_0xc823('0x1a')][_0x3d3ddb];if(fs['existsSync'](path[_0xc823('0x1c')](__dirname,_0xc823('0x1a'),_0x2cacfd[_0xc823('0x1d')]+_0xc823('0x1e')))){var _0x574c76=[];switch(_0x2cacfd[_0xc823('0x1d')]['toLowerCase']()){case _0xc823('0x1f'):var _0x517231=_0x2cacfd['appdata'][_0xc823('0x20')](',');if(_0x59749d[_0xc823('0x16')]==='mail'){_0x574c76[_0xc823('0x21')](_0x517231[0x0]);_0x574c76[_0xc823('0x21')](_0x517231[0x1]);_0x574c76[_0xc823('0x21')](_0x517231[_0xc823('0x22')](0x2,_0x517231[_0xc823('0x1b')])[_0xc823('0x1c')](','));}else{_0x574c76[_0xc823('0x21')](_0x517231[0x0]);_0x574c76[_0xc823('0x21')](_0x517231[_0xc823('0x22')](0x1,_0x517231[_0xc823('0x1b')])['join'](','));}break;case _0xc823('0x23'):var _0x533560=_0x2cacfd['appdata'][_0xc823('0x20')](',');_0x574c76[_0xc823('0x21')](_0x533560[0x0]);_0x574c76[_0xc823('0x21')](_0x533560[0x1]);_0x574c76[_0xc823('0x21')](_0x533560[_0xc823('0x22')](0x2,_0x533560[_0xc823('0x1b')])[_0xc823('0x1c')](','));break;case _0xc823('0x24'):var _0x12f061=_0x2cacfd[_0xc823('0x25')][_0xc823('0x20')](',');_0x574c76[_0xc823('0x21')](_0x12f061[0x0]);_0x574c76[_0xc823('0x21')](_0x12f061[0x1]);_0x574c76[_0xc823('0x21')](_0x12f061[0x2]);_0x574c76[_0xc823('0x21')](_0x12f061[0x3]);_0x574c76['push'](_0x12f061[_0xc823('0x22')](0x4,_0x12f061[_0xc823('0x1b')])[_0xc823('0x1c')](','));break;case _0xc823('0x26'):var _0x14db83=_0x2cacfd['appdata']['split'](',');_0x574c76['push'](_0x14db83[0x0]);_0x574c76[_0xc823('0x21')](_0x14db83[0x1]);_0x574c76[_0xc823('0x21')](_0x14db83[0x2]);_0x574c76[_0xc823('0x21')](_0x14db83[0x3]);_0x574c76[_0xc823('0x21')](_0x14db83['slice'](0x4,_0x14db83[_0xc823('0x1b')])[_0xc823('0x1c')](','));break;case _0xc823('0x17'):_0x574c76[_0xc823('0x21')](_0x2cacfd[_0xc823('0x25')]);break;case _0xc823('0x27'):_0x574c76[_0xc823('0x21')](_0x2cacfd[_0xc823('0x28')]);_0x574c76[_0xc823('0x21')](_0x2cacfd[_0xc823('0x25')]);break;case _0xc823('0x29'):var _0x9fd3a2=utils[_0xc823('0x2a')](_0x59749d['account'][_0xc823('0x2b')],_0x59749d);var _0x3bb497=_0x2cacfd[_0xc823('0x25')][_0xc823('0x20')](',');_0x574c76[_0xc823('0x21')](_0x3bb497[0x0]);_0x574c76[_0xc823('0x21')](_0x3bb497[0x1]);_0x574c76['push'](_0x3bb497[0x2]);_0x574c76[_0xc823('0x21')](_0x3bb497[0x3]);_0x574c76[_0xc823('0x21')](_0x3bb497[0x4]);_0x574c76['push'](_0x3bb497[0x5]);_0x574c76[_0xc823('0x21')](_0x3bb497[0x6]);_0x574c76['push'](_0x3bb497[0x7]);_0x574c76[_0xc823('0x21')](_0x3bb497[0x8]);_0x574c76[_0xc823('0x21')](_0x3bb497[0x9]);_0x574c76['push'](_0x3bb497[0xa]);_0x574c76[_0xc823('0x21')](_0x59749d[_0xc823('0x18')]['id']);_0x574c76[_0xc823('0x21')](_0x59749d[_0xc823('0x17')]['id']);_0x574c76[_0xc823('0x21')](_0x2cacfd[_0xc823('0x2c')]);_0x574c76[_0xc823('0x21')](_0x59749d['interaction']['ContactId']);_0x574c76['push'](_0x59749d[_0xc823('0x2d')][_0xc823('0x2d')]);_0x574c76[_0xc823('0x21')](_0x9fd3a2);break;default:_0x574c76=_[_0xc823('0x10')](_0x2cacfd[_0xc823('0x25')])?[]:_0x2cacfd['appdata'][_0xc823('0x20')](',');}var _0x28e575={'id':util[_0xc823('0xe')](_0xc823('0x2e'),_0x122510,_0x2cacfd['id'],_0x2cacfd['app']),'condition':require('./interval')['condition'](_0x122510,getIntervals(_0xff0ec2[_0xc823('0x2f')],_0x2cacfd),_0xff0ec2),'consequence':require(_0xc823('0x30')+_0x2cacfd[_0xc823('0x1d')])['consequence'](_0x122510,_0x574c76,_0xff0ec2,_0x59749d),'p':_0x2cacfd[_0xc823('0x31')]||0x0};logger['info'](_0xc823('0x32'),_0x28e575['id'],_0xc823('0x33'),getIntervals(_0xff0ec2[_0xc823('0x2f')],_0x2cacfd)[_0xc823('0x1c')](_0xc823('0x34')));_0x366c31[_0xc823('0x21')](_0x28e575);}else{logger[_0xc823('0x35')]('Please\x20create\x20a\x20new\x20file\x20under',path[_0xc823('0x1c')](__dirname,'applications',_0x2cacfd[_0xc823('0x1d')]+_0xc823('0x1e')));}}_0xff0ec2[_0xc823('0x15')][_0x122510]=new RuleEngine(_0x366c31);_0xff0ec2[_0xc823('0x15')][_0x122510][_0xc823('0x36')](_0x59749d,function(_0x2978a9){logger[_0xc823('0x37')](_0xc823('0x38'),JSON['stringify'](_0x2978a9[_0xc823('0x39')]));if(_0xff0ec2[_0xc823('0x15')][_0x122510]){_0xff0ec2['rules'][_0x122510][_0xc823('0x3a')](_0xc823('0x3b'));}});return _0x565aeb({'code':0xc8,'message':_0x59749d});}else{logger[_0xc823('0x37')](_0xc823('0x3c'));return _0x565aeb({'code':0xc8,'message':_0x59749d});}}catch(_0x2d6206){logger[_0xc823('0x35')](_0x2d6206[_0xc823('0x3d')]);return _0x5d3521(_0x5bdfc9[_0xc823('0x35')](0x1f4,_0x2d6206));}}return _0x5d3521(_0xc823('0x3e'));});},'AcceptMessage':function(_0x51a0d3){var _0x153ca1=this;return new Promise(function(_0xfb1078,_0x50515d){if(_0x51a0d3[_0xc823('0x3f')]&&_0x51a0d3[_0xc823('0x3f')]['id']){if(_0xff0ec2['agents'][_0x51a0d3[_0xc823('0x3f')]['id']]){_0xff0ec2['agents'][_0x51a0d3[_0xc823('0x3f')]['id']][_0xc823('0x40')]=![];_0xff0ec2['agents'][_0x51a0d3['agent']['id']][_0xc823('0x41')]=undefined;}}if(_0x51a0d3[_0xc823('0x17')]&&_0x51a0d3[_0xc823('0x17')]['id']){try{var _0x34706b=getId(_0x51a0d3[_0xc823('0x16')],_0x51a0d3[_0xc823('0x17')]?_0x51a0d3[_0xc823('0x17')]['id']:0x0,_0x51a0d3[_0xc823('0x18')]?_0x51a0d3['interaction']['id']:0x0);if(_0xff0ec2[_0xc823('0x15')][_0x34706b]){_0xff0ec2[_0xc823('0x15')][_0x34706b]['emit']('end');if(rpc[_0x51a0d3[_0xc823('0x16')]+'QueueReport']){rpc[_0x51a0d3['channel']+'QueueReport']['update'](_0x34706b,{'UserId':_0x51a0d3['message']['UserId']})[_0xc823('0x42')](function(_0x4b5cdb){logger['error'](_0xc823('0x43'));});}}return _0xfb1078({'code':0xc8,'message':_0x51a0d3});}catch(_0x4f25ae){logger[_0xc823('0x35')](_0x4f25ae[_0xc823('0x3d')]);return _0x50515d(_0x153ca1['error'](0x1f4,_0x4f25ae));}}logger[_0xc823('0x35')](_0xc823('0x44'));return _0x50515d(_0x153ca1[_0xc823('0x35')](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x564ef5){var _0x304e71=this;return new Promise(function(_0x11dfe8,_0x5bbf90){if(_0x564ef5[_0xc823('0x3f')]&&_0x564ef5[_0xc823('0x3f')]['id']){try{if(_0xff0ec2[_0xc823('0x45')][_0x564ef5['agent']['id']]){_0xff0ec2[_0xc823('0x45')][_0x564ef5[_0xc823('0x3f')]['id']][_0xc823('0x40')]=![];_0xff0ec2[_0xc823('0x45')][_0x564ef5[_0xc823('0x3f')]['id']][_0xc823('0x41')]=undefined;}return _0x11dfe8({'code':0xc8,'message':_0x564ef5});}catch(_0xe53fb5){logger['error'](_0xe53fb5[_0xc823('0x3d')]);return _0x5bbf90(_0x304e71[_0xc823('0x35')](0x1f4,_0xe53fb5));}}logger[_0xc823('0x35')](_0xc823('0x44'));return _0x5bbf90(_0x304e71[_0xc823('0x35')](0x1f4,_0xc823('0x44')));});},'AbandonInteraction':function(_0x37d7b4){var _0x5e7527=this;return new Promise(function(_0x219c6d,_0x2fd2df){if(_0x37d7b4[_0xc823('0x16')]&&_0x37d7b4[_0xc823('0x18')]&&_0x37d7b4[_0xc823('0x18')]['id']){try{var _0x2d20fc=getId(_0x37d7b4['channel'],_0x37d7b4[_0xc823('0x17')]?_0x37d7b4['message']['id']:0x0,_0x37d7b4['interaction']?_0x37d7b4['interaction']['id']:0x0);if(_0xff0ec2[_0xc823('0x15')][_0x2d20fc]){_0xff0ec2['rules'][_0x2d20fc][_0xc823('0x3a')]('end');}return _0x219c6d({'code':0xc8,'message':_0x37d7b4});}catch(_0x2244bd){logger[_0xc823('0x35')](_0x2244bd['stack']);return _0x2fd2df(_0x5e7527[_0xc823('0x35')](0x1f4,_0x2244bd));}}logger['error']('message\x20is\x20empty');return _0x2fd2df(_0x5e7527[_0xc823('0x35')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x262a98){var _0x5a122b=this;return new Promise(function(_0x403c0e,_0x3698a2){if(_0xff0ec2['agents'][_0xc823('0x46')](_0x262a98['id'])){for(var _0x1d9689 in _0x262a98[_0xc823('0x47')]){if(_0x262a98[_0xc823('0x47')]['hasOwnProperty'](_0x1d9689)){if(_0xff0ec2['agents'][_0x262a98['id']][_0xc823('0x46')](_0x1d9689+'CurrentCapacity')){_0xff0ec2[_0xc823('0x45')][_0x262a98['id']][_0x1d9689+_0xc823('0x48')]=parseInt(_0x262a98[_0xc823('0x47')][_0x1d9689],0xa);}}}_0xff0ec2[_0xc823('0x45')][_0x262a98['id']][_0xc823('0x49')]();return _0x403c0e({'code':0xc8,'message':_0xff0ec2['agents'][_0x262a98['id']]});}else{return _0x3698a2(_0x5a122b[_0xc823('0x35')](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x164e2a){return new Promise(function(_0x1b552c,_0x5efb1b){var _0x13a218=_['values'](_0xff0ec2[_0xc823('0x45')]);_0x1b552c({'count':_0x13a218[_0xc823('0x1b')],'rows':_0x13a218});});},'ChatQueues':function(_0x110374){return new Promise(function(_0x42f203,_0x51a528){var _0x542a87=[];for(var _0x4b3f69 in _0xff0ec2['chatQueues']){if(_0xff0ec2['chatQueues'][_0xc823('0x46')](_0x4b3f69)){var _0x302720=_0xff0ec2['chatQueues'][_0x4b3f69];var _0x4d632d={'id':_0x302720['id'],'available':_0x302720[_0xc823('0x4a')],'loggedIn':_0x302720[_0xc823('0x4b')],'name':_0x302720[_0xc823('0x4c')],'paused':_0x302720[_0xc823('0x4d')],'waiting':_0x302720[_0xc823('0x4e')]};_0x542a87[_0xc823('0x21')](_0x4d632d);}}_0x42f203({'count':_0x542a87[_0xc823('0x1b')],'rows':_0x542a87});});},'MailQueues':function(_0x5106d6){return new Promise(function(_0x32b4b9,_0x371707){var _0x3589f6=[];for(var _0x4ac00f in _0xff0ec2['mailQueues']){if(_0xff0ec2['mailQueues'][_0xc823('0x46')](_0x4ac00f)){var _0x3f4ffe=_0xff0ec2['mailQueues'][_0x4ac00f];var _0x18d4ed={'id':_0x3f4ffe['id'],'available':_0x3f4ffe[_0xc823('0x4a')],'loggedIn':_0x3f4ffe[_0xc823('0x4b')],'name':_0x3f4ffe[_0xc823('0x4c')],'paused':_0x3f4ffe['paused'],'waiting':_0x3f4ffe[_0xc823('0x4e')]};_0x3589f6[_0xc823('0x21')](_0x18d4ed);}}_0x32b4b9({'count':_0x3589f6[_0xc823('0x1b')],'rows':_0x3589f6});});},'OpenchannelQueues':function(_0x54bbac){return new Promise(function(_0x46551d,_0x147481){var _0x47d3d2=[];for(var _0x144a49 in _0xff0ec2[_0xc823('0x4f')]){if(_0xff0ec2['openchannelQueues']['hasOwnProperty'](_0x144a49)){var _0x4cd52c=_0xff0ec2[_0xc823('0x4f')][_0x144a49];var _0x3b68ce={'id':_0x4cd52c['id'],'available':_0x4cd52c['available'],'loggedIn':_0x4cd52c[_0xc823('0x4b')],'name':_0x4cd52c[_0xc823('0x4c')],'paused':_0x4cd52c[_0xc823('0x4d')],'waiting':_0x4cd52c[_0xc823('0x4e')]};_0x47d3d2[_0xc823('0x21')](_0x3b68ce);}}_0x46551d({'count':_0x47d3d2[_0xc823('0x1b')],'rows':_0x47d3d2});});},'SmsQueues':function(_0x5e1e27){return new Promise(function(_0xe838f0,_0x483908){var _0x53bf28=[];for(var _0x2d9efb in _0xff0ec2['smsQueues']){if(_0xff0ec2[_0xc823('0x50')][_0xc823('0x46')](_0x2d9efb)){var _0x2e0774=_0xff0ec2[_0xc823('0x50')][_0x2d9efb];var _0x1c198e={'id':_0x2e0774['id'],'available':_0x2e0774[_0xc823('0x4a')],'loggedIn':_0x2e0774[_0xc823('0x4b')],'name':_0x2e0774['name'],'paused':_0x2e0774[_0xc823('0x4d')],'waiting':_0x2e0774[_0xc823('0x4e')]};_0x53bf28[_0xc823('0x21')](_0x1c198e);}}_0xe838f0({'count':_0x53bf28[_0xc823('0x1b')],'rows':_0x53bf28});});},'FaxQueues':function(_0x1f0ce3){return new Promise(function(_0x514138,_0x239a2d){var _0x1e9439=[];for(var _0xfcfe28 in _0xff0ec2[_0xc823('0x51')]){if(_0xff0ec2[_0xc823('0x51')]['hasOwnProperty'](_0xfcfe28)){var _0x310f3e=_0xff0ec2[_0xc823('0x51')][_0xfcfe28];var _0x416618={'id':_0x310f3e['id'],'available':_0x310f3e[_0xc823('0x4a')],'loggedIn':_0x310f3e['loggedIn'],'name':_0x310f3e[_0xc823('0x4c')],'paused':_0x310f3e[_0xc823('0x4d')],'waiting':_0x310f3e[_0xc823('0x4e')]};_0x1e9439[_0xc823('0x21')](_0x416618);}}_0x514138({'count':_0x1e9439[_0xc823('0x1b')],'rows':_0x1e9439});});},'WhatsappQueues':function(_0x28068c){return new Promise(function(_0x58f745,_0x2d2dc2){var _0x4a4d1d=[];for(var _0x165845 in _0xff0ec2[_0xc823('0x52')]){if(_0xff0ec2[_0xc823('0x52')]['hasOwnProperty'](_0x165845)){var _0x36efc9=_0xff0ec2[_0xc823('0x52')][_0x165845];var _0x27d4b9={'id':_0x36efc9['id'],'available':_0x36efc9[_0xc823('0x4a')],'loggedIn':_0x36efc9[_0xc823('0x4b')],'name':_0x36efc9[_0xc823('0x4c')],'paused':_0x36efc9[_0xc823('0x4d')],'waiting':_0x36efc9['waiting']};_0x4a4d1d[_0xc823('0x21')](_0x27d4b9);}}_0x58f745({'count':_0x4a4d1d[_0xc823('0x1b')],'rows':_0x4a4d1d});});},'ChatQueuesWaitingInteractions':function(_0x2bc119){return new Promise(function(_0x339aa1,_0x1ca2e1){var _0x39282f=_[_0xc823('0x53')](_0xff0ec2[_0xc823('0x54')]);_0x339aa1({'count':_0x39282f[_0xc823('0x1b')],'rows':_0x39282f});});},'MailQueuesWaitingInteractions':function(_0x3cf745){return new Promise(function(_0x10effc,_0x167d47){var _0x2091ab=_[_0xc823('0x53')](_0xff0ec2[_0xc823('0x55')]);_0x10effc({'count':_0x2091ab[_0xc823('0x1b')],'rows':_0x2091ab});});},'OpenchannelQueuesWaitingInteractions':function(_0xd9f9b8){return new Promise(function(_0x2178c9,_0x329f55){var _0x473aa1=_['values'](_0xff0ec2[_0xc823('0x56')]);_0x2178c9({'count':_0x473aa1[_0xc823('0x1b')],'rows':_0x473aa1});});},'SmsQueuesWaitingInteractions':function(_0x28278c){return new Promise(function(_0x1927ff,_0x1b6b22){var _0x112a0d=_['values'](_0xff0ec2[_0xc823('0x57')]);_0x1927ff({'count':_0x112a0d[_0xc823('0x1b')],'rows':_0x112a0d});});},'FaxQueuesWaitingInteractions':function(_0x366d8e){return new Promise(function(_0x3fa853,_0x2d250d){var _0x397a29=_[_0xc823('0x53')](_0xff0ec2['faxQueuesWaitingInteractions']);_0x3fa853({'count':_0x397a29[_0xc823('0x1b')],'rows':_0x397a29});});},'WhatsappQueuesWaitingInteractions':function(_0x21438d){return new Promise(function(_0xfa2b6e,_0x26da3d){var _0x764a8f=_[_0xc823('0x53')](_0xff0ec2['whatsappQueuesWaitingInteractions']);_0xfa2b6e({'count':_0x764a8f[_0xc823('0x1b')],'rows':_0x764a8f});});}};var _0x2db7e2=jayson[_0xc823('0x58')](_0x4bc9c9)[_0xc823('0x59')]();_0x2db7e2['on'](_0xc823('0x35'),function(_0x18146b){logger[_0xc823('0x35')](JSON['stringify'](_0x18146b));return _0x55b31d(_0x18146b);});_0x2db7e2['listen'](0x232c,'127.0.0.1',function(){console[_0xc823('0x5a')]('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x4571cd(_0xc823('0x5b')+0x232c);});});}; \ No newline at end of file +var _0x153f=['emit','info','stack','routing\x20is\x20empty','agent','agents','busy','busyQueue','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','end','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','values','mailQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','util','path','jayson/promise','bluebird','uuid','./applications/utils','../../../config/logger','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','rules','message','interaction','isArray','applications','length','existsSync','join','.js','app','toLowerCase','autoreply','appdata','split','channel','mail','push','slice','dialogflow','dialogflowv2','amazonlex','tag','TagId','tvox','getMustacheRender','account','notificationTemplate','ChatWebsiteId','ContactId','body','condition','intervals','./applications/','consequence','priority','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','stringify','matchPath'];(function(_0x5418ad,_0x40742f){var _0x2cae56=function(_0x36d317){while(--_0x36d317){_0x5418ad['push'](_0x5418ad['shift']());}};_0x2cae56(++_0x40742f);}(_0x153f,0x15b));var _0xf153=function(_0x4c65fb,_0x42133a){_0x4c65fb=_0x4c65fb-0x0;var _0xa846b0=_0x153f[_0x4c65fb];return _0xa846b0;};'use strict';var _=require(_0xf153('0x0'));var util=require(_0xf153('0x1'));var path=require(_0xf153('0x2'));var fs=require('fs');var jayson=require(_0xf153('0x3'));var BPromise=require(_0xf153('0x4'));var uuid=require(_0xf153('0x5'));var utils=require(_0xf153('0x6'));var config=require('../../../config/environment');var logger=require(_0xf153('0x7'))('routing');var rpc={'openchannelQueueReport':require(_0xf153('0x8')),'mailQueueReport':require(_0xf153('0x9')),'chatQueueReport':require(_0xf153('0xa')),'smsQueueReport':require(_0xf153('0xb')),'faxQueueReport':require(_0xf153('0xc')),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require(_0xf153('0xd'));function getId(_0x143497,_0x224f88,_0x5f6cb5){return util[_0xf153('0xe')](_0xf153('0xf'),_0x143497,_0x224f88||0x0,_0x5f6cb5||0x0);}function getIntervals(_0x44845c,_0x15a18b){var _0x4f84b=[];if(!_[_0xf153('0x10')](_0x15a18b['IntervalId'])&&!_[_0xf153('0x10')](_0x44845c[_0x15a18b[_0xf153('0x11')]])&&!_[_0xf153('0x10')](_0x44845c[_0x15a18b['IntervalId']][_0xf153('0x12')])){_0x4f84b=_[_0xf153('0x13')](_0x44845c[_0x15a18b[_0xf153('0x11')]][_0xf153('0x12')],_0xf153('0x14'));}else if(!_[_0xf153('0x10')](_0x15a18b[_0xf153('0x14')])){_0x4f84b=[_0x15a18b[_0xf153('0x14')]];}return _0x4f84b;}exports[_0xf153('0x15')]=function(_0x4c5283){_0x4c5283[_0xf153('0x16')]={};return new BPromise(function(_0x2340f5,_0x2b666e){var _0x406e6f={'Start':function(_0x3afea2){var _0x68f436=this;return new Promise(function(_0x273a90,_0x287bc6){if(_0x3afea2){try{var _0x47fbfe=[];var _0x35f4e8=getId(_0x3afea2['channel'],_0x3afea2[_0xf153('0x17')]?_0x3afea2[_0xf153('0x17')]['id']:0x0,_0x3afea2[_0xf153('0x18')]?_0x3afea2[_0xf153('0x18')]['id']:0x0);if(_0x3afea2['applications']&&_[_0xf153('0x19')](_0x3afea2[_0xf153('0x1a')])&&_0x3afea2[_0xf153('0x1a')][_0xf153('0x1b')]){for(var _0x15230c=0x0;_0x15230c<_0x3afea2[_0xf153('0x1a')][_0xf153('0x1b')];_0x15230c+=0x1){var _0x2db2c7=_0x3afea2[_0xf153('0x1a')][_0x15230c];if(fs[_0xf153('0x1c')](path[_0xf153('0x1d')](__dirname,_0xf153('0x1a'),_0x2db2c7['app']+_0xf153('0x1e')))){var _0x395f28=[];switch(_0x2db2c7[_0xf153('0x1f')][_0xf153('0x20')]()){case _0xf153('0x21'):var _0x3e94b5=_0x2db2c7[_0xf153('0x22')][_0xf153('0x23')](',');if(_0x3afea2[_0xf153('0x24')]===_0xf153('0x25')){_0x395f28[_0xf153('0x26')](_0x3e94b5[0x0]);_0x395f28[_0xf153('0x26')](_0x3e94b5[0x1]);_0x395f28[_0xf153('0x26')](_0x3e94b5[_0xf153('0x27')](0x2,_0x3e94b5[_0xf153('0x1b')])[_0xf153('0x1d')](','));}else{_0x395f28[_0xf153('0x26')](_0x3e94b5[0x0]);_0x395f28[_0xf153('0x26')](_0x3e94b5[_0xf153('0x27')](0x1,_0x3e94b5[_0xf153('0x1b')])['join'](','));}break;case _0xf153('0x28'):var _0x3f1c6f=_0x2db2c7['appdata'][_0xf153('0x23')](',');_0x395f28[_0xf153('0x26')](_0x3f1c6f[0x0]);_0x395f28['push'](_0x3f1c6f[0x1]);_0x395f28[_0xf153('0x26')](_0x3f1c6f[_0xf153('0x27')](0x2,_0x3f1c6f[_0xf153('0x1b')])[_0xf153('0x1d')](','));break;case _0xf153('0x29'):var _0x258976=_0x2db2c7[_0xf153('0x22')][_0xf153('0x23')](',');_0x395f28[_0xf153('0x26')](_0x258976[0x0]);_0x395f28[_0xf153('0x26')](_0x258976[0x1]);_0x395f28[_0xf153('0x26')](_0x258976[0x2]);_0x395f28[_0xf153('0x26')](_0x258976[0x3]);_0x395f28['push'](_0x258976[_0xf153('0x27')](0x4,_0x258976[_0xf153('0x1b')])[_0xf153('0x1d')](','));break;case _0xf153('0x2a'):var _0x4d6b50=_0x2db2c7['appdata'][_0xf153('0x23')](',');_0x395f28['push'](_0x4d6b50[0x0]);_0x395f28['push'](_0x4d6b50[0x1]);_0x395f28[_0xf153('0x26')](_0x4d6b50[0x2]);_0x395f28['push'](_0x4d6b50[0x3]);_0x395f28[_0xf153('0x26')](_0x4d6b50['slice'](0x4,_0x4d6b50[_0xf153('0x1b')])[_0xf153('0x1d')](','));break;case'message':_0x395f28[_0xf153('0x26')](_0x2db2c7[_0xf153('0x22')]);break;case _0xf153('0x2b'):_0x395f28[_0xf153('0x26')](_0x2db2c7[_0xf153('0x2c')]);_0x395f28[_0xf153('0x26')](_0x2db2c7['appdata']);break;case _0xf153('0x2d'):var _0x5c333b=utils[_0xf153('0x2e')](_0x3afea2[_0xf153('0x2f')][_0xf153('0x30')],_0x3afea2);var _0x1820c3=_0x2db2c7[_0xf153('0x22')][_0xf153('0x23')](',');_0x395f28['push'](_0x1820c3[0x0]);_0x395f28[_0xf153('0x26')](_0x1820c3[0x1]);_0x395f28[_0xf153('0x26')](_0x1820c3[0x2]);_0x395f28[_0xf153('0x26')](_0x1820c3[0x3]);_0x395f28['push'](_0x1820c3[0x4]);_0x395f28[_0xf153('0x26')](_0x1820c3[0x5]);_0x395f28[_0xf153('0x26')](_0x1820c3[0x6]);_0x395f28[_0xf153('0x26')](_0x1820c3[0x7]);_0x395f28[_0xf153('0x26')](_0x1820c3[0x8]);_0x395f28[_0xf153('0x26')](_0x1820c3[0x9]);_0x395f28[_0xf153('0x26')](_0x1820c3[0xa]);_0x395f28['push'](_0x3afea2[_0xf153('0x18')]['id']);_0x395f28[_0xf153('0x26')](_0x3afea2['message']['id']);_0x395f28[_0xf153('0x26')](_0x2db2c7[_0xf153('0x31')]);_0x395f28[_0xf153('0x26')](_0x3afea2[_0xf153('0x18')][_0xf153('0x32')]);_0x395f28[_0xf153('0x26')](_0x3afea2[_0xf153('0x33')]['body']);_0x395f28[_0xf153('0x26')](_0x5c333b);break;default:_0x395f28=_[_0xf153('0x10')](_0x2db2c7[_0xf153('0x22')])?[]:_0x2db2c7[_0xf153('0x22')][_0xf153('0x23')](',');}var _0x1ee606={'id':util['format']('%s:%s:%s',_0x35f4e8,_0x2db2c7['id'],_0x2db2c7[_0xf153('0x1f')]),'condition':require('./interval')[_0xf153('0x34')](_0x35f4e8,getIntervals(_0x4c5283[_0xf153('0x35')],_0x2db2c7),_0x4c5283),'consequence':require(_0xf153('0x36')+_0x2db2c7[_0xf153('0x1f')])[_0xf153('0x37')](_0x35f4e8,_0x395f28,_0x4c5283,_0x3afea2),'p':_0x2db2c7[_0xf153('0x38')]||0x0};logger['info']('Push\x20new\x20rule',_0x1ee606['id'],_0xf153('0x39'),getIntervals(_0x4c5283[_0xf153('0x35')],_0x2db2c7)['join'](_0xf153('0x3a')));_0x47fbfe[_0xf153('0x26')](_0x1ee606);}else{logger[_0xf153('0x3b')](_0xf153('0x3c'),path[_0xf153('0x1d')](__dirname,_0xf153('0x1a'),_0x2db2c7[_0xf153('0x1f')]+_0xf153('0x1e')));}}_0x4c5283[_0xf153('0x16')][_0x35f4e8]=new RuleEngine(_0x47fbfe);_0x4c5283[_0xf153('0x16')][_0x35f4e8][_0xf153('0x3d')](_0x3afea2,function(_0x46e279){logger['info'](_0xf153('0x3e'),JSON[_0xf153('0x3f')](_0x46e279[_0xf153('0x40')]));if(_0x4c5283['rules'][_0x35f4e8]){_0x4c5283[_0xf153('0x16')][_0x35f4e8][_0xf153('0x41')]('complete');}});return _0x273a90({'code':0xc8,'message':_0x3afea2});}else{logger[_0xf153('0x42')]('No\x20applications\x20to\x20execute');return _0x273a90({'code':0xc8,'message':_0x3afea2});}}catch(_0x3db101){logger[_0xf153('0x3b')](_0x3db101[_0xf153('0x43')]);return _0x287bc6(_0x68f436['error'](0x1f4,_0x3db101));}}return _0x287bc6(_0xf153('0x44'));});},'AcceptMessage':function(_0x209048){var _0x1426eb=this;return new Promise(function(_0x1bece2,_0x472280){if(_0x209048['agent']&&_0x209048[_0xf153('0x45')]['id']){if(_0x4c5283[_0xf153('0x46')][_0x209048['agent']['id']]){_0x4c5283[_0xf153('0x46')][_0x209048[_0xf153('0x45')]['id']][_0xf153('0x47')]=![];_0x4c5283['agents'][_0x209048[_0xf153('0x45')]['id']][_0xf153('0x48')]=undefined;}}if(_0x209048[_0xf153('0x17')]&&_0x209048[_0xf153('0x17')]['id']){try{var _0x2393f1=getId(_0x209048[_0xf153('0x24')],_0x209048[_0xf153('0x17')]?_0x209048[_0xf153('0x17')]['id']:0x0,_0x209048[_0xf153('0x18')]?_0x209048['interaction']['id']:0x0);if(_0x4c5283[_0xf153('0x16')][_0x2393f1]){_0x4c5283['rules'][_0x2393f1]['emit']('end');if(rpc[_0x209048[_0xf153('0x24')]+_0xf153('0x49')]){rpc[_0x209048['channel']+_0xf153('0x49')][_0xf153('0x4a')](_0x2393f1,{'UserId':_0x209048['message'][_0xf153('0x4b')]})[_0xf153('0x4c')](function(_0x40b097){logger[_0xf153('0x3b')](_0xf153('0x4d'));});}}return _0x1bece2({'code':0xc8,'message':_0x209048});}catch(_0x3ab27a){logger['error'](_0x3ab27a[_0xf153('0x43')]);return _0x472280(_0x1426eb[_0xf153('0x3b')](0x1f4,_0x3ab27a));}}logger['error']('message\x20is\x20empty');return _0x472280(_0x1426eb[_0xf153('0x3b')](0x1f4,_0xf153('0x4e')));});},'RejectMessage':function(_0x325651){var _0x297e9d=this;return new Promise(function(_0x419e7e,_0x1e1c33){if(_0x325651['agent']&&_0x325651[_0xf153('0x45')]['id']){try{if(_0x4c5283['agents'][_0x325651[_0xf153('0x45')]['id']]){_0x4c5283[_0xf153('0x46')][_0x325651[_0xf153('0x45')]['id']]['busy']=![];_0x4c5283[_0xf153('0x46')][_0x325651[_0xf153('0x45')]['id']][_0xf153('0x48')]=undefined;}return _0x419e7e({'code':0xc8,'message':_0x325651});}catch(_0x425e4c){logger[_0xf153('0x3b')](_0x425e4c[_0xf153('0x43')]);return _0x1e1c33(_0x297e9d[_0xf153('0x3b')](0x1f4,_0x425e4c));}}logger['error'](_0xf153('0x4e'));return _0x1e1c33(_0x297e9d[_0xf153('0x3b')](0x1f4,_0xf153('0x4e')));});},'AbandonInteraction':function(_0x5673f5){var _0x1bf770=this;return new Promise(function(_0x87af73,_0x35ab2c){if(_0x5673f5[_0xf153('0x24')]&&_0x5673f5[_0xf153('0x18')]&&_0x5673f5[_0xf153('0x18')]['id']){try{var _0x245124=getId(_0x5673f5[_0xf153('0x24')],_0x5673f5['message']?_0x5673f5[_0xf153('0x17')]['id']:0x0,_0x5673f5[_0xf153('0x18')]?_0x5673f5['interaction']['id']:0x0);if(_0x4c5283[_0xf153('0x16')][_0x245124]){_0x4c5283[_0xf153('0x16')][_0x245124][_0xf153('0x41')](_0xf153('0x4f'));}return _0x87af73({'code':0xc8,'message':_0x5673f5});}catch(_0x1f2830){logger[_0xf153('0x3b')](_0x1f2830[_0xf153('0x43')]);return _0x35ab2c(_0x1bf770[_0xf153('0x3b')](0x1f4,_0x1f2830));}}logger[_0xf153('0x3b')](_0xf153('0x4e'));return _0x35ab2c(_0x1bf770[_0xf153('0x3b')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x441982){var _0x127777=this;return new Promise(function(_0x58f75d,_0x2645ff){if(_0x4c5283[_0xf153('0x46')][_0xf153('0x50')](_0x441982['id'])){for(var _0x147d3a in _0x441982[_0xf153('0x51')]){if(_0x441982[_0xf153('0x51')][_0xf153('0x50')](_0x147d3a)){if(_0x4c5283['agents'][_0x441982['id']][_0xf153('0x50')](_0x147d3a+_0xf153('0x52'))){_0x4c5283[_0xf153('0x46')][_0x441982['id']][_0x147d3a+_0xf153('0x52')]=parseInt(_0x441982[_0xf153('0x51')][_0x147d3a],0xa);}}}_0x4c5283[_0xf153('0x46')][_0x441982['id']][_0xf153('0x53')]();return _0x58f75d({'code':0xc8,'message':_0x4c5283[_0xf153('0x46')][_0x441982['id']]});}else{return _0x2645ff(_0x127777[_0xf153('0x3b')](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x1354a2){return new Promise(function(_0x433566,_0x4afdc4){var _0x140c41=_['values'](_0x4c5283[_0xf153('0x46')]);_0x433566({'count':_0x140c41[_0xf153('0x1b')],'rows':_0x140c41});});},'ChatQueues':function(_0x4ec6ad){return new Promise(function(_0x1af890,_0x55ea2b){var _0x375d73=[];for(var _0x2338e2 in _0x4c5283[_0xf153('0x54')]){if(_0x4c5283[_0xf153('0x54')]['hasOwnProperty'](_0x2338e2)){var _0x42cd70=_0x4c5283[_0xf153('0x54')][_0x2338e2];var _0x4be37e={'id':_0x42cd70['id'],'available':_0x42cd70[_0xf153('0x55')],'loggedIn':_0x42cd70[_0xf153('0x56')],'name':_0x42cd70[_0xf153('0x57')],'paused':_0x42cd70[_0xf153('0x58')],'waiting':_0x42cd70[_0xf153('0x59')]};_0x375d73['push'](_0x4be37e);}}_0x1af890({'count':_0x375d73[_0xf153('0x1b')],'rows':_0x375d73});});},'MailQueues':function(_0x56b31c){return new Promise(function(_0x408837,_0x38a7c4){var _0x5907f8=[];for(var _0x4d87ec in _0x4c5283[_0xf153('0x5a')]){if(_0x4c5283[_0xf153('0x5a')]['hasOwnProperty'](_0x4d87ec)){var _0x4775b1=_0x4c5283[_0xf153('0x5a')][_0x4d87ec];var _0x4605ea={'id':_0x4775b1['id'],'available':_0x4775b1['available'],'loggedIn':_0x4775b1[_0xf153('0x56')],'name':_0x4775b1[_0xf153('0x57')],'paused':_0x4775b1[_0xf153('0x58')],'waiting':_0x4775b1[_0xf153('0x59')]};_0x5907f8[_0xf153('0x26')](_0x4605ea);}}_0x408837({'count':_0x5907f8[_0xf153('0x1b')],'rows':_0x5907f8});});},'OpenchannelQueues':function(_0x37443f){return new Promise(function(_0x364957,_0x3cde66){var _0x858289=[];for(var _0x25091c in _0x4c5283[_0xf153('0x5b')]){if(_0x4c5283[_0xf153('0x5b')][_0xf153('0x50')](_0x25091c)){var _0x36ba4d=_0x4c5283[_0xf153('0x5b')][_0x25091c];var _0x51398a={'id':_0x36ba4d['id'],'available':_0x36ba4d[_0xf153('0x55')],'loggedIn':_0x36ba4d['loggedIn'],'name':_0x36ba4d['name'],'paused':_0x36ba4d[_0xf153('0x58')],'waiting':_0x36ba4d['waiting']};_0x858289[_0xf153('0x26')](_0x51398a);}}_0x364957({'count':_0x858289[_0xf153('0x1b')],'rows':_0x858289});});},'SmsQueues':function(_0x286de4){return new Promise(function(_0x2ca840,_0x30ce9d){var _0x451ab0=[];for(var _0x4fecb1 in _0x4c5283[_0xf153('0x5c')]){if(_0x4c5283[_0xf153('0x5c')][_0xf153('0x50')](_0x4fecb1)){var _0x5ed13c=_0x4c5283['smsQueues'][_0x4fecb1];var _0x2aedb7={'id':_0x5ed13c['id'],'available':_0x5ed13c[_0xf153('0x55')],'loggedIn':_0x5ed13c[_0xf153('0x56')],'name':_0x5ed13c['name'],'paused':_0x5ed13c[_0xf153('0x58')],'waiting':_0x5ed13c['waiting']};_0x451ab0['push'](_0x2aedb7);}}_0x2ca840({'count':_0x451ab0[_0xf153('0x1b')],'rows':_0x451ab0});});},'FaxQueues':function(_0x2f1b93){return new Promise(function(_0x29e7c0,_0x583dbf){var _0x175975=[];for(var _0x281c3b in _0x4c5283['faxQueues']){if(_0x4c5283[_0xf153('0x5d')][_0xf153('0x50')](_0x281c3b)){var _0x205a23=_0x4c5283[_0xf153('0x5d')][_0x281c3b];var _0x103eff={'id':_0x205a23['id'],'available':_0x205a23['available'],'loggedIn':_0x205a23[_0xf153('0x56')],'name':_0x205a23[_0xf153('0x57')],'paused':_0x205a23[_0xf153('0x58')],'waiting':_0x205a23[_0xf153('0x59')]};_0x175975[_0xf153('0x26')](_0x103eff);}}_0x29e7c0({'count':_0x175975[_0xf153('0x1b')],'rows':_0x175975});});},'WhatsappQueues':function(_0x2e5f2c){return new Promise(function(_0x546653,_0x756f52){var _0x394130=[];for(var _0xede225 in _0x4c5283[_0xf153('0x5e')]){if(_0x4c5283[_0xf153('0x5e')][_0xf153('0x50')](_0xede225)){var _0x53a4a4=_0x4c5283[_0xf153('0x5e')][_0xede225];var _0x14cdce={'id':_0x53a4a4['id'],'available':_0x53a4a4[_0xf153('0x55')],'loggedIn':_0x53a4a4[_0xf153('0x56')],'name':_0x53a4a4[_0xf153('0x57')],'paused':_0x53a4a4[_0xf153('0x58')],'waiting':_0x53a4a4[_0xf153('0x59')]};_0x394130[_0xf153('0x26')](_0x14cdce);}}_0x546653({'count':_0x394130[_0xf153('0x1b')],'rows':_0x394130});});},'ChatQueuesWaitingInteractions':function(_0x37bfa1){return new Promise(function(_0x5a1ffb,_0x5f3d56){var _0x56827a=_['values'](_0x4c5283[_0xf153('0x5f')]);_0x5a1ffb({'count':_0x56827a[_0xf153('0x1b')],'rows':_0x56827a});});},'MailQueuesWaitingInteractions':function(_0x18a48c){return new Promise(function(_0xbd089,_0x1df869){var _0x574051=_[_0xf153('0x60')](_0x4c5283[_0xf153('0x61')]);_0xbd089({'count':_0x574051[_0xf153('0x1b')],'rows':_0x574051});});},'OpenchannelQueuesWaitingInteractions':function(_0x974b36){return new Promise(function(_0x4bf4b5,_0x1d56bf){var _0x44d057=_[_0xf153('0x60')](_0x4c5283['openchannelQueuesWaitingInteractions']);_0x4bf4b5({'count':_0x44d057[_0xf153('0x1b')],'rows':_0x44d057});});},'SmsQueuesWaitingInteractions':function(_0x4dbf1b){return new Promise(function(_0x221a22,_0x25ab76){var _0x2651ff=_['values'](_0x4c5283['smsQueuesWaitingInteractions']);_0x221a22({'count':_0x2651ff['length'],'rows':_0x2651ff});});},'FaxQueuesWaitingInteractions':function(_0x437808){return new Promise(function(_0x45f965,_0x5584b3){var _0x58db94=_[_0xf153('0x60')](_0x4c5283['faxQueuesWaitingInteractions']);_0x45f965({'count':_0x58db94[_0xf153('0x1b')],'rows':_0x58db94});});},'WhatsappQueuesWaitingInteractions':function(_0x57ece2){return new Promise(function(_0xb3632c,_0x2d007a){var _0x3fa0fd=_[_0xf153('0x60')](_0x4c5283[_0xf153('0x62')]);_0xb3632c({'count':_0x3fa0fd[_0xf153('0x1b')],'rows':_0x3fa0fd});});}};var _0x583d8d=jayson[_0xf153('0x63')](_0x406e6f)[_0xf153('0x64')]();_0x583d8d['on']('error',function(_0x1fa05f){logger[_0xf153('0x3b')](JSON[_0xf153('0x3f')](_0x1fa05f));return _0x2b666e(_0x1fa05f);});_0x583d8d[_0xf153('0x15')](0x232c,'127.0.0.1',function(){console[_0xf153('0x65')](_0xf153('0x66'),0x232c);return _0x2340f5('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 576411f..c8cb7c7 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 _0x6831=['util','jayson/promise','lodash','../../../config/logger','routing','client','http','request','then','message','result','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','iftime\x20%s','indexOf','true','catch','error','[%s][INTERVAL]\x20%s','[%s][INTERVAL]\x20%s\x20%s','when','join','\x20|\x20','stack'];(function(_0x46538e,_0x1a2620){var _0x4da081=function(_0x5f2f8d){while(--_0x5f2f8d){_0x46538e['push'](_0x46538e['shift']());}};_0x4da081(++_0x1a2620);}(_0x6831,0x15c));var _0x1683=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x6831[_0x4565bf];return _0x5610ba;};'use strict';var util=require(_0x1683('0x0'));var BPromise=require('bluebird');var jayson=require(_0x1683('0x1'));var _=require(_0x1683('0x2'));var logger=require(_0x1683('0x3'))(_0x1683('0x4'));var client=jayson[_0x1683('0x5')][_0x1683('0x6')]({'port':0x232a});function request(_0x897584,_0x544aea){return new BPromise(function(_0x26b650,_0x50ea39){return client[_0x1683('0x7')](_0x897584,_0x544aea)[_0x1683('0x8')](function(_0x1a2387){if(_0x1a2387['error']){return _0x50ea39(_0x1a2387['error'][_0x1683('0x9')]);}else{return _0x26b650(_0x1a2387[_0x1683('0xa')]);}})['catch'](function(_0x2b1230){return _0x50ea39(_0x2b1230);});});}exports[_0x1683('0xb')]=function(_0x3275be,_0x385408,_0x578fbc){return function(_0x4d4fa3){if(_0x578fbc[_0x1683('0xc')]&&!_0x578fbc[_0x1683('0xc')][_0x3275be]){logger[_0x1683('0xd')](_0x1683('0xe'),_0x3275be);return _0x4d4fa3[_0x1683('0xf')]();}var _0x395259=[];for(var _0x236020=0x0;_0x236020<_0x385408[_0x1683('0x10')];_0x236020+=0x1){_0x395259[_0x1683('0x11')](request('Command',{'command':util['format'](_0x1683('0x12'),_0x385408[_0x236020])})[_0x1683('0x8')](function(_0x6830e0){return _0x6830e0&&_0x6830e0[_0x1683('0x9')]&&_0x6830e0['message'][_0x1683('0x13')](_0x1683('0x14'))>=0x0?!![]:![];})[_0x1683('0x15')](function(_0x4c740f){logger[_0x1683('0x16')](_0x1683('0x17'),_0x3275be,_0x385408[_0x236020]);}));}BPromise['all'](_0x395259)[_0x1683('0x8')](function(_0x2824bf){var _0x3ec37f=_['some'](_0x2824bf);logger[_0x1683('0xd')](_0x1683('0x18'),_0x3275be,_0x385408['join']('\x20|\x20'),_0x3ec37f);_0x4d4fa3[_0x1683('0x19')](_0x3ec37f);})[_0x1683('0x15')](function(_0x1034c7){console['log'](_0x1034c7);logger[_0x1683('0x16')]('[%s][INTERVAL]\x20%s\x20%s',_0x3275be,_0x385408[_0x1683('0x1a')](_0x1683('0x1b')),_0x1034c7[_0x1683('0x1c')]);_0x4d4fa3[_0x1683('0xf')]();});};}; \ No newline at end of file +var _0x801b=['iftime\x20%s','indexOf','true','all','some','info','[%s][INTERVAL]\x20%s\x20%s','\x20|\x20','log','stack','util','bluebird','jayson/promise','lodash','../../../config/logger','client','http','then','error','message','result','catch','rules','stop','length','push','Command'];(function(_0x159689,_0x3df213){var _0x56ac50=function(_0x165b36){while(--_0x165b36){_0x159689['push'](_0x159689['shift']());}};_0x56ac50(++_0x3df213);}(_0x801b,0x19f));var _0xb801=function(_0x295c96,_0x5b4132){_0x295c96=_0x295c96-0x0;var _0x297104=_0x801b[_0x295c96];return _0x297104;};'use strict';var util=require(_0xb801('0x0'));var BPromise=require(_0xb801('0x1'));var jayson=require(_0xb801('0x2'));var _=require(_0xb801('0x3'));var logger=require(_0xb801('0x4'))('routing');var client=jayson[_0xb801('0x5')][_0xb801('0x6')]({'port':0x232a});function request(_0x767aa,_0xdf4356){return new BPromise(function(_0x4fa21e,_0x1790e6){return client['request'](_0x767aa,_0xdf4356)[_0xb801('0x7')](function(_0xd8b2ea){if(_0xd8b2ea['error']){return _0x1790e6(_0xd8b2ea[_0xb801('0x8')][_0xb801('0x9')]);}else{return _0x4fa21e(_0xd8b2ea[_0xb801('0xa')]);}})[_0xb801('0xb')](function(_0x3519c4){return _0x1790e6(_0x3519c4);});});}exports['condition']=function(_0x12d620,_0x3eed0a,_0x3a41f5){return function(_0x5de29b){if(_0x3a41f5[_0xb801('0xc')]&&!_0x3a41f5[_0xb801('0xc')][_0x12d620]){logger['info']('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x12d620);return _0x5de29b[_0xb801('0xd')]();}var _0x4476a4=[];for(var _0x3d8a90=0x0;_0x3d8a90<_0x3eed0a[_0xb801('0xe')];_0x3d8a90+=0x1){_0x4476a4[_0xb801('0xf')](request(_0xb801('0x10'),{'command':util['format'](_0xb801('0x11'),_0x3eed0a[_0x3d8a90])})[_0xb801('0x7')](function(_0x2a6195){return _0x2a6195&&_0x2a6195[_0xb801('0x9')]&&_0x2a6195[_0xb801('0x9')][_0xb801('0x12')](_0xb801('0x13'))>=0x0?!![]:![];})[_0xb801('0xb')](function(_0x125ec0){logger[_0xb801('0x8')]('[%s][INTERVAL]\x20%s',_0x12d620,_0x3eed0a[_0x3d8a90]);}));}BPromise[_0xb801('0x14')](_0x4476a4)[_0xb801('0x7')](function(_0x5f13f4){var _0x14b54e=_[_0xb801('0x15')](_0x5f13f4);logger[_0xb801('0x16')](_0xb801('0x17'),_0x12d620,_0x3eed0a['join'](_0xb801('0x18')),_0x14b54e);_0x5de29b['when'](_0x14b54e);})[_0xb801('0xb')](function(_0xff85c1){console[_0xb801('0x19')](_0xff85c1);logger['error'](_0xb801('0x17'),_0x12d620,_0x3eed0a['join']('\x20|\x20'),_0xff85c1[_0xb801('0x1a')]);_0x5de29b[_0xb801('0xd')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 9f7a9ea..b29ee27 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 _0x84a0=['transferexten','secondtransfererexten','transfertargetuniqueid','[%s][agents][attendedtransfer]','hangup','[%s][agents][hangup]','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','diffTime','complete','lodash','util','./utils','info','format','channel','queue','interface','calleridnum','connectedlinenum','lastevent','then','type','acw','acwtime','agentacw','acwTimeout','request','CreateVoiceAgentReport','uniqueid','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','now','called','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','membername','error','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','reason','timeout','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','holdtime','talktime','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','ringtime','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','agentcomplete','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','blindtransfer','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfereruniqueid','transfer','transfertype','blind','extension','transferuniqueid','attendedtransfer','origtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfereruniqueid','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0x84a0,0x66));var _0x084a=function(_0x379f70,_0x52942f){_0x379f70=_0x379f70-0x0;var _0x372cab=_0x84a0[_0x379f70];return _0x372cab;};'use strict';var _=require(_0x084a('0x0'));var util=require(_0x084a('0x1'));var utils=require(_0x084a('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x1fff7f,_0x483bfa){utils[_0x084a('0x3')](util[_0x084a('0x4')]('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x1fff7f['uniqueid'],_0x1fff7f[_0x084a('0x5')],_0x1fff7f[_0x084a('0x6')],_0x1fff7f['membername'],_0x1fff7f[_0x084a('0x7')],_0x1fff7f[_0x084a('0x8')],_0x1fff7f[_0x084a('0x9')],_0x1fff7f[_0x084a('0xa')]));if(_0x1fff7f[_0x084a('0x6')]){utils['getVoiceQueueByName'](_0x1fff7f[_0x084a('0x6')])[_0x084a('0xb')](function(_0x8198ad){if(_0x8198ad){_0x1fff7f[_0x084a('0xc')]=_0x8198ad[_0x084a('0xc')];_0x1fff7f['agentacw']=_0x1fff7f['agentcomplete']?_0x8198ad[_0x084a('0xd')]:![];_0x1fff7f[_0x084a('0xe')]=_0x1fff7f[_0x084a('0xf')]?_0x8198ad[_0x084a('0x10')]:0x0;}utils[_0x084a('0x11')]('CreateVoiceAgentReport',_0x1fff7f);});}else{utils['request'](_0x084a('0x12'),_0x1fff7f);}if(_0x483bfa){delete transfers[_0x1fff7f[_0x084a('0x13')]];}else{delete agents[_0x1fff7f[_0x084a('0x14')]];}}exports[_0x084a('0x15')]=function(_0x1bdfb8){try{utils[_0x084a('0x16')](util[_0x084a('0x4')](_0x084a('0x17'),_0x1bdfb8['uniqueid']),_0x1bdfb8);agents[_0x1bdfb8[_0x084a('0x14')]]=_0x1bdfb8;agents[_0x1bdfb8['destuniqueid']][_0x084a('0x18')]=utils[_0x084a('0x19')]();agents[_0x1bdfb8[_0x084a('0x14')]][_0x084a('0xa')]=_0x084a('0x1a');agents[_0x1bdfb8['destuniqueid']][_0x084a('0x9')]=null;agents[_0x1bdfb8['destuniqueid']][_0x084a('0x1b')]=null;utils[_0x084a('0x3')](util['format'](_0x084a('0x1c'),_0x1bdfb8[_0x084a('0x13')],agents[_0x1bdfb8[_0x084a('0x14')]][_0x084a('0x1d')],_0x1bdfb8[_0x084a('0x14')]));}catch(_0x145636){utils[_0x084a('0x1e')](util[_0x084a('0x4')](_0x084a('0x17'),_0x1bdfb8[_0x084a('0x13')]),_0x145636);}};exports[_0x084a('0x1f')]=function(_0x279e25){try{if(!_[_0x084a('0x20')](agents[_0x279e25[_0x084a('0x14')]])){utils[_0x084a('0x16')](util['format'](_0x084a('0x21'),_0x279e25[_0x084a('0x13')]),_0x279e25);utils[_0x084a('0x3')](util[_0x084a('0x4')](_0x084a('0x22'),_0x279e25['uniqueid'],agents[_0x279e25[_0x084a('0x14')]][_0x084a('0x1d')],_0x279e25[_0x084a('0x14')]));agents[_0x279e25[_0x084a('0x14')]][_0x084a('0x1f')]=!![];agents[_0x279e25[_0x084a('0x14')]]['agentringnoanswerAt']=utils[_0x084a('0x19')]();agents[_0x279e25[_0x084a('0x14')]][_0x084a('0xa')]='timeout';agents[_0x279e25[_0x084a('0x14')]][_0x084a('0x23')]=_0x084a('0x24');agents[_0x279e25['destuniqueid']]['holdtime']=_0x279e25['ringtime']?parseInt(_0x279e25['ringtime'])/0x3e8:0x0;agents[_0x279e25[_0x084a('0x14')]]['talktime']=0x0;unanswered['push'](_0x279e25['destuniqueid']);}}catch(_0x3b8176){utils[_0x084a('0x1e')](util[_0x084a('0x4')](_0x084a('0x21'),_0x279e25[_0x084a('0x13')]),_0x3b8176);}};exports[_0x084a('0x25')]=function(_0x378de6){try{_[_0x084a('0x26')](agents,function(_0x5e6ea8,_0x2ed3cd){if(_0x5e6ea8[_0x084a('0x13')]==_0x378de6['uniqueid']&&!_[_0x084a('0x27')](unanswered,_0x5e6ea8[_0x084a('0x14')])){utils[_0x084a('0x16')](util[_0x084a('0x4')](_0x084a('0x28'),_0x378de6[_0x084a('0x13')]),_0x378de6);utils[_0x084a('0x3')](util[_0x084a('0x4')](_0x084a('0x29'),_0x378de6[_0x084a('0x13')],_0x5e6ea8[_0x084a('0x1d')],_0x5e6ea8[_0x084a('0x14')]));_0x5e6ea8[_0x084a('0x1f')]=!![];_0x5e6ea8['agentringnoanswerAt']=utils['now']();_0x5e6ea8[_0x084a('0xa')]=_0x084a('0x2a');_0x5e6ea8[_0x084a('0x23')]=_0x084a('0x2a');_0x5e6ea8[_0x084a('0x2b')]=_0x378de6['holdtime'];_0x5e6ea8[_0x084a('0x2c')]=0x0;writeDB(_0x5e6ea8);}});}catch(_0x1b56ad){utils[_0x084a('0x1e')](util['format'](_0x084a('0x28'),_0x378de6[_0x084a('0x13')]),_0x1b56ad);}};exports[_0x084a('0x2d')]=function(_0x4c4c90){try{if(agents[_0x4c4c90['destuniqueid']]){utils['debug'](util[_0x084a('0x4')](_0x084a('0x2e'),_0x4c4c90[_0x084a('0x13')]),_0x4c4c90);utils['info'](util[_0x084a('0x4')](_0x084a('0x2f'),_0x4c4c90[_0x084a('0x13')],agents[_0x4c4c90[_0x084a('0x14')]][_0x084a('0x1d')],_0x4c4c90[_0x084a('0x14')]));agents[_0x4c4c90[_0x084a('0x14')]][_0x084a('0x30')]=utils[_0x084a('0x19')]();agents[_0x4c4c90[_0x084a('0x14')]][_0x084a('0x9')]=_0x4c4c90[_0x084a('0x9')];agents[_0x4c4c90[_0x084a('0x14')]][_0x084a('0x1b')]=_0x4c4c90[_0x084a('0x1b')];agents[_0x4c4c90['destuniqueid']][_0x084a('0x2b')]=_0x4c4c90[_0x084a('0x31')];agents[_0x4c4c90[_0x084a('0x14')]][_0x084a('0xa')]=_0x084a('0x32');_[_0x084a('0x26')](agents,function(_0xa7b652,_0x183e10){if(_0xa7b652[_0x084a('0x14')]!=_0x4c4c90['destuniqueid']&&_0xa7b652[_0x084a('0x13')]==_0x4c4c90[_0x084a('0x13')]){_0xa7b652[_0x084a('0x2c')]=0x0;_0xa7b652[_0x084a('0x2b')]=_0x4c4c90[_0x084a('0x31')];_0xa7b652[_0x084a('0x1f')]=!![];_0xa7b652['agentringnoanswerAt']=utils[_0x084a('0x19')]();_0xa7b652[_0x084a('0xa')]='answered_elsewhere';_0xa7b652[_0x084a('0x23')]=_0x084a('0x33');_0xa7b652[_0x084a('0x34')]=_0x4c4c90['destuniqueid'];_0xa7b652[_0x084a('0x35')]=_0x4c4c90[_0x084a('0x1d')];writeDB(_0xa7b652);}});}}catch(_0x4fe9c2){utils[_0x084a('0x1e')](util[_0x084a('0x4')]('[%s][agents][agentconnect]',_0x4c4c90['uniqueid']),_0x4fe9c2);}};exports[_0x084a('0x36')]=function(_0x17a8d4){try{if(!_[_0x084a('0x20')](agents[_0x17a8d4[_0x084a('0x14')]])){utils[_0x084a('0x16')](util[_0x084a('0x4')](_0x084a('0x37'),_0x17a8d4[_0x084a('0x13')]),_0x17a8d4);utils[_0x084a('0x3')](util[_0x084a('0x4')](_0x084a('0x38'),_0x17a8d4['uniqueid'],agents[_0x17a8d4['destuniqueid']][_0x084a('0x1d')],_0x17a8d4[_0x084a('0x14')]));agents[_0x17a8d4[_0x084a('0x14')]]['agentcomplete']=!![];agents[_0x17a8d4[_0x084a('0x14')]][_0x084a('0x39')]=utils[_0x084a('0x19')]();agents[_0x17a8d4[_0x084a('0x14')]][_0x084a('0x2c')]=utils['diffTime'](agents[_0x17a8d4[_0x084a('0x14')]]['agentcompleteAt'],agents[_0x17a8d4[_0x084a('0x14')]][_0x084a('0x30')]);agents[_0x17a8d4[_0x084a('0x14')]]['reason']=_0x17a8d4['reason'];agents[_0x17a8d4[_0x084a('0x14')]][_0x084a('0xa')]='complete';writeDB(agents[_0x17a8d4[_0x084a('0x14')]]);}}catch(_0x2c2c2e){utils[_0x084a('0x1e')](util[_0x084a('0x4')]('[%s][agents][agentcomplete]',_0x17a8d4[_0x084a('0x13')]),_0x2c2c2e);}};exports[_0x084a('0x3a')]=function(_0x31677b){try{if(!_[_0x084a('0x20')](agents[_0x31677b['transfereruniqueid']])){utils[_0x084a('0x16')](util[_0x084a('0x4')](_0x084a('0x3b'),_0x31677b[_0x084a('0x13')]),_0x31677b);utils['info'](util['format'](_0x084a('0x3c'),_0x31677b[_0x084a('0x13')],agents[_0x31677b[_0x084a('0x3d')]][_0x084a('0x1d')],agents[_0x31677b[_0x084a('0x3d')]][_0x084a('0x13')]));agents[_0x31677b[_0x084a('0x3d')]][_0x084a('0x3e')]=!![];agents[_0x31677b[_0x084a('0x3d')]][_0x084a('0x3f')]=_0x084a('0x40');agents[_0x31677b[_0x084a('0x3d')]]['transferexten']=_0x31677b[_0x084a('0x41')];agents[_0x31677b[_0x084a('0x3d')]][_0x084a('0x42')]=agents[_0x31677b[_0x084a('0x3d')]][_0x084a('0x13')];}}catch(_0x1c972c){utils[_0x084a('0x1e')](util['format'](_0x084a('0x3b'),_0x31677b[_0x084a('0x13')]),_0x1c972c);}};exports[_0x084a('0x43')]=function(_0x54aa6c){try{utils['debug'](util[_0x084a('0x4')]('[%s][agents][attendedtransfer]',_0x54aa6c[_0x084a('0x44')]),_0x54aa6c);if(_0x54aa6c[_0x084a('0x44')]==_0x54aa6c['origtransfererlinkedid']){if(!_[_0x084a('0x20')](agents[_0x54aa6c['secondtransfereruniqueid']])){utils['info'](util[_0x084a('0x4')](_0x084a('0x45'),_0x54aa6c[_0x084a('0x44')],agents[_0x54aa6c[_0x084a('0x46')]][_0x084a('0x1d')]));agents[_0x54aa6c[_0x084a('0x46')]][_0x084a('0x3e')]=!![];agents[_0x54aa6c['secondtransfereruniqueid']][_0x084a('0x3f')]=_0x084a('0x47');agents[_0x54aa6c[_0x084a('0x46')]]['transferexten']=_0x54aa6c[_0x084a('0x48')];agents[_0x54aa6c[_0x084a('0x46')]][_0x084a('0x42')]=_0x54aa6c[_0x084a('0x44')];}if(_0x54aa6c['transfereeuniqueid']&&agents[_0x54aa6c[_0x084a('0x49')]]){agents[_0x54aa6c['transfereeuniqueid']][_0x084a('0x4a')]=0x1;transfers[_0x54aa6c[_0x084a('0x49')]]=_[_0x084a('0x4b')](agents[_0x54aa6c['transfereeuniqueid']]);transfers[_0x54aa6c['transfereeuniqueid']][_0x084a('0x8')]=agents[_0x54aa6c[_0x084a('0x46')]]['calleridnum'];transfers[_0x54aa6c[_0x084a('0x49')]]['calleridname']=agents[_0x54aa6c['secondtransfereruniqueid']][_0x084a('0x4c')];transfers[_0x54aa6c[_0x084a('0x49')]][_0x084a('0x18')]=utils[_0x084a('0x19')]();transfers[_0x54aa6c[_0x084a('0x49')]][_0x084a('0x30')]=utils[_0x084a('0x19')]();transfers[_0x54aa6c[_0x084a('0x49')]][_0x084a('0x2b')]=0x0;transfers[_0x54aa6c['transfereeuniqueid']][_0x084a('0x4a')]=0x2;}}else if(_0x54aa6c[_0x084a('0x46')]==_0x54aa6c[_0x084a('0x4d')]){if(!_['isNil'](agents[_0x54aa6c[_0x084a('0x44')]])){utils[_0x084a('0x3')](util['format'](_0x084a('0x45'),_0x54aa6c['origtransfereruniqueid'],agents[_0x54aa6c['origtransfereruniqueid']][_0x084a('0x1d')]));agents[_0x54aa6c['origtransfereruniqueid']]['transfer']=!![];agents[_0x54aa6c[_0x084a('0x44')]][_0x084a('0x3f')]=_0x084a('0x47');agents[_0x54aa6c['origtransfereruniqueid']][_0x084a('0x4e')]=_0x54aa6c[_0x084a('0x4f')];agents[_0x54aa6c[_0x084a('0x44')]][_0x084a('0x42')]=_0x54aa6c[_0x084a('0x46')];}if(_0x54aa6c[_0x084a('0x50')]&&agents[_0x54aa6c[_0x084a('0x50')]]){agents[_0x54aa6c['transfertargetuniqueid']]['agententerreason']=0x1;transfers[_0x54aa6c[_0x084a('0x50')]]=_[_0x084a('0x4b')](agents[_0x54aa6c['transfertargetuniqueid']]);transfers[_0x54aa6c[_0x084a('0x50')]][_0x084a('0x8')]=agents[_0x54aa6c[_0x084a('0x44')]][_0x084a('0x8')];transfers[_0x54aa6c['transfertargetuniqueid']][_0x084a('0x4c')]=agents[_0x54aa6c[_0x084a('0x44')]][_0x084a('0x4c')];transfers[_0x54aa6c['transfertargetuniqueid']]['agentcalledAt']=utils[_0x084a('0x19')]();transfers[_0x54aa6c[_0x084a('0x50')]][_0x084a('0x30')]=utils[_0x084a('0x19')]();transfers[_0x54aa6c[_0x084a('0x50')]][_0x084a('0x2b')]=0x0;transfers[_0x54aa6c[_0x084a('0x50')]]['agententerreason']=0x2;}}}catch(_0x22efb6){utils['error'](util['format'](_0x084a('0x51'),_0x54aa6c[_0x084a('0x44')]),_0x22efb6);}};exports[_0x084a('0x52')]=function(_0x4a2745){try{utils[_0x084a('0x16')](util['format'](_0x084a('0x53'),_0x4a2745[_0x084a('0x13')]),_0x4a2745);if(agents[_0x4a2745[_0x084a('0x13')]]&&agents[_0x4a2745[_0x084a('0x13')]][_0x084a('0x23')]===_0x084a('0x24')){if(_0x4a2745['cause']==='21'){agents[_0x4a2745['uniqueid']][_0x084a('0x23')]=_0x084a('0x54');agents[_0x4a2745[_0x084a('0x13')]][_0x084a('0xa')]=_0x084a('0x54');}utils[_0x084a('0x3')](util['format'](_0x084a('0x55'),_0x4a2745[_0x084a('0x13')],agents[_0x4a2745[_0x084a('0x13')]][_0x084a('0x1d')],agents[_0x4a2745[_0x084a('0x13')]][_0x084a('0x23')],agents[_0x4a2745[_0x084a('0x13')]]['lastevent']));writeDB(agents[_0x4a2745[_0x084a('0x13')]]);var _0x38b5b6=unanswered[_0x084a('0x56')](_0x4a2745[_0x084a('0x13')]);if(_0x38b5b6>-0x1){unanswered[_0x084a('0x57')](_0x38b5b6,0x1);}}if(transfers[_0x4a2745[_0x084a('0x13')]]){transfers[_0x4a2745[_0x084a('0x13')]][_0x084a('0x36')]=!![];transfers[_0x4a2745[_0x084a('0x13')]][_0x084a('0x39')]=utils['now']();transfers[_0x4a2745['uniqueid']]['talktime']=utils[_0x084a('0x58')](transfers[_0x4a2745[_0x084a('0x13')]]['agentcompleteAt'],transfers[_0x4a2745[_0x084a('0x13')]][_0x084a('0x30')]);transfers[_0x4a2745[_0x084a('0x13')]][_0x084a('0x23')]='agent';transfers[_0x4a2745['uniqueid']][_0x084a('0xa')]=_0x084a('0x59');utils[_0x084a('0x3')](util[_0x084a('0x4')](_0x084a('0x55'),_0x4a2745[_0x084a('0x13')],transfers[_0x4a2745[_0x084a('0x13')]]['membername'],transfers[_0x4a2745[_0x084a('0x13')]][_0x084a('0x23')],transfers[_0x4a2745[_0x084a('0x13')]][_0x084a('0xa')]));writeDB(transfers[_0x4a2745[_0x084a('0x13')]],!![]);}if(agents[_0x4a2745[_0x084a('0x13')]]&&agents[_0x4a2745[_0x084a('0x13')]]['agentconnectAt']){agents[_0x4a2745[_0x084a('0x13')]][_0x084a('0x36')]=!![];agents[_0x4a2745[_0x084a('0x13')]][_0x084a('0x39')]=utils[_0x084a('0x19')]();agents[_0x4a2745[_0x084a('0x13')]][_0x084a('0x2c')]=utils[_0x084a('0x58')](agents[_0x4a2745[_0x084a('0x13')]][_0x084a('0x39')],agents[_0x4a2745[_0x084a('0x13')]]['agentconnectAt']);agents[_0x4a2745[_0x084a('0x13')]][_0x084a('0x23')]=agents[_0x4a2745['uniqueid']][_0x084a('0x3e')]?'transfer':'agent';agents[_0x4a2745[_0x084a('0x13')]][_0x084a('0xa')]='complete';utils[_0x084a('0x3')](util[_0x084a('0x4')](_0x084a('0x55'),_0x4a2745[_0x084a('0x13')],agents[_0x4a2745[_0x084a('0x13')]][_0x084a('0x1d')],agents[_0x4a2745[_0x084a('0x13')]][_0x084a('0x23')],agents[_0x4a2745[_0x084a('0x13')]][_0x084a('0xa')]));writeDB(agents[_0x4a2745[_0x084a('0x13')]]);}}catch(_0x7c85e3){utils[_0x084a('0x1e')](util[_0x084a('0x4')](_0x084a('0x53'),_0x4a2745['uniqueid']),_0x7c85e3);}}; \ No newline at end of file +var _0x2750=['calleridnum','connectedlinenum','lastevent','then','agentacw','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','debug','[%s][agents][agentcalled]','destuniqueid','agentcalledAt','now','called','error','agentringnoanswer','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','timeout','reason','holdtime','ringtime','push','queuecallerabandon','includes','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][agents][queuecallerabandon]','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connect','forIn','talktime','agentringnoanswerAt','answered_elsewhere','answeredelsewheredestinationuniqueid','isNil','[%s][agents][agentcomplete]','agentcomplete','agentcompleteAt','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','blind','transferexten','attendedtransfer','origtransfereruniqueid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','origtransfererexten','transferuniqueid','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','agent','[%s][agents][hangup]','lodash','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername'];(function(_0x15c6ca,_0x2412ad){var _0x450e1a=function(_0x2dca54){while(--_0x2dca54){_0x15c6ca['push'](_0x15c6ca['shift']());}};_0x450e1a(++_0x2412ad);}(_0x2750,0x13b));var _0x0275=function(_0x1929a3,_0x444423){_0x1929a3=_0x1929a3-0x0;var _0x126898=_0x2750[_0x1929a3];return _0x126898;};'use strict';var _=require(_0x0275('0x0'));var util=require('util');var utils=require(_0x0275('0x1'));var agents={};var transfers={};var unanswered=[];function writeDB(_0xf2ae71,_0x372744){utils[_0x0275('0x2')](util[_0x0275('0x3')](_0x0275('0x4'),_0xf2ae71[_0x0275('0x5')],_0xf2ae71[_0x0275('0x6')],_0xf2ae71[_0x0275('0x7')],_0xf2ae71[_0x0275('0x8')],_0xf2ae71['interface'],_0xf2ae71[_0x0275('0x9')],_0xf2ae71[_0x0275('0xa')],_0xf2ae71[_0x0275('0xb')]));if(_0xf2ae71[_0x0275('0x7')]){utils['getVoiceQueueByName'](_0xf2ae71[_0x0275('0x7')])[_0x0275('0xc')](function(_0x42ae73){if(_0x42ae73){_0xf2ae71['type']=_0x42ae73['type'];_0xf2ae71[_0x0275('0xd')]=_0xf2ae71['agentcomplete']?_0x42ae73[_0x0275('0xe')]:![];_0xf2ae71[_0x0275('0xf')]=_0xf2ae71[_0x0275('0xd')]?_0x42ae73[_0x0275('0x10')]:0x0;}utils[_0x0275('0x11')]('CreateVoiceAgentReport',_0xf2ae71);});}else{utils[_0x0275('0x11')](_0x0275('0x12'),_0xf2ae71);}if(_0x372744){delete transfers[_0xf2ae71[_0x0275('0x5')]];}else{delete agents[_0xf2ae71['destuniqueid']];}}exports['agentcalled']=function(_0x292f93){try{utils[_0x0275('0x13')](util[_0x0275('0x3')](_0x0275('0x14'),_0x292f93[_0x0275('0x5')]),_0x292f93);agents[_0x292f93[_0x0275('0x15')]]=_0x292f93;agents[_0x292f93['destuniqueid']][_0x0275('0x16')]=utils[_0x0275('0x17')]();agents[_0x292f93['destuniqueid']][_0x0275('0xb')]=_0x0275('0x18');agents[_0x292f93['destuniqueid']][_0x0275('0xa')]=null;agents[_0x292f93[_0x0275('0x15')]]['connectedlinename']=null;utils['info'](util['format']('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x292f93['uniqueid'],agents[_0x292f93[_0x0275('0x15')]][_0x0275('0x8')],_0x292f93[_0x0275('0x15')]));}catch(_0x5b2a4c){utils[_0x0275('0x19')](util[_0x0275('0x3')](_0x0275('0x14'),_0x292f93['uniqueid']),_0x5b2a4c);}};exports[_0x0275('0x1a')]=function(_0x402f0d){try{if(!_['isNil'](agents[_0x402f0d['destuniqueid']])){utils[_0x0275('0x13')](util[_0x0275('0x3')](_0x0275('0x1b'),_0x402f0d['uniqueid']),_0x402f0d);utils[_0x0275('0x2')](util['format'](_0x0275('0x1c'),_0x402f0d['uniqueid'],agents[_0x402f0d[_0x0275('0x15')]][_0x0275('0x8')],_0x402f0d['destuniqueid']));agents[_0x402f0d[_0x0275('0x15')]][_0x0275('0x1a')]=!![];agents[_0x402f0d[_0x0275('0x15')]]['agentringnoanswerAt']=utils[_0x0275('0x17')]();agents[_0x402f0d[_0x0275('0x15')]][_0x0275('0xb')]=_0x0275('0x1d');agents[_0x402f0d[_0x0275('0x15')]][_0x0275('0x1e')]='timeout';agents[_0x402f0d[_0x0275('0x15')]][_0x0275('0x1f')]=_0x402f0d[_0x0275('0x20')]?parseInt(_0x402f0d[_0x0275('0x20')])/0x3e8:0x0;agents[_0x402f0d[_0x0275('0x15')]]['talktime']=0x0;unanswered[_0x0275('0x21')](_0x402f0d[_0x0275('0x15')]);}}catch(_0x3246ea){utils[_0x0275('0x19')](util[_0x0275('0x3')]('[%s][agents][agentringnoanswer]',_0x402f0d[_0x0275('0x5')]),_0x3246ea);}};exports[_0x0275('0x22')]=function(_0x127bbd){try{_['forIn'](agents,function(_0x5e2e22,_0x3cb2d7){if(_0x5e2e22[_0x0275('0x5')]==_0x127bbd['uniqueid']&&!_[_0x0275('0x23')](unanswered,_0x5e2e22[_0x0275('0x15')])){utils[_0x0275('0x13')](util[_0x0275('0x3')]('[%s][agents][queuecallerabandon]',_0x127bbd[_0x0275('0x5')]),_0x127bbd);utils[_0x0275('0x2')](util[_0x0275('0x3')](_0x0275('0x24'),_0x127bbd['uniqueid'],_0x5e2e22[_0x0275('0x8')],_0x5e2e22['destuniqueid']));_0x5e2e22[_0x0275('0x1a')]=!![];_0x5e2e22['agentringnoanswerAt']=utils[_0x0275('0x17')]();_0x5e2e22[_0x0275('0xb')]='abandoned';_0x5e2e22[_0x0275('0x1e')]=_0x0275('0x25');_0x5e2e22[_0x0275('0x1f')]=_0x127bbd[_0x0275('0x1f')];_0x5e2e22['talktime']=0x0;writeDB(_0x5e2e22);}});}catch(_0x5040de){utils[_0x0275('0x19')](util[_0x0275('0x3')](_0x0275('0x26'),_0x127bbd[_0x0275('0x5')]),_0x5040de);}};exports['agentconnect']=function(_0x2a18c3){try{if(agents[_0x2a18c3[_0x0275('0x15')]]){utils[_0x0275('0x13')](util[_0x0275('0x3')](_0x0275('0x27'),_0x2a18c3[_0x0275('0x5')]),_0x2a18c3);utils[_0x0275('0x2')](util[_0x0275('0x3')](_0x0275('0x28'),_0x2a18c3[_0x0275('0x5')],agents[_0x2a18c3[_0x0275('0x15')]]['membername'],_0x2a18c3[_0x0275('0x15')]));agents[_0x2a18c3[_0x0275('0x15')]][_0x0275('0x29')]=utils[_0x0275('0x17')]();agents[_0x2a18c3[_0x0275('0x15')]][_0x0275('0xa')]=_0x2a18c3[_0x0275('0xa')];agents[_0x2a18c3[_0x0275('0x15')]][_0x0275('0x2a')]=_0x2a18c3[_0x0275('0x2a')];agents[_0x2a18c3[_0x0275('0x15')]][_0x0275('0x1f')]=_0x2a18c3[_0x0275('0x20')];agents[_0x2a18c3[_0x0275('0x15')]]['lastevent']=_0x0275('0x2b');_[_0x0275('0x2c')](agents,function(_0x4d2d59,_0x31d0ab){if(_0x4d2d59[_0x0275('0x15')]!=_0x2a18c3[_0x0275('0x15')]&&_0x4d2d59[_0x0275('0x5')]==_0x2a18c3[_0x0275('0x5')]){_0x4d2d59[_0x0275('0x2d')]=0x0;_0x4d2d59[_0x0275('0x1f')]=_0x2a18c3['ringtime'];_0x4d2d59[_0x0275('0x1a')]=!![];_0x4d2d59[_0x0275('0x2e')]=utils[_0x0275('0x17')]();_0x4d2d59[_0x0275('0xb')]='answered_elsewhere';_0x4d2d59[_0x0275('0x1e')]=_0x0275('0x2f');_0x4d2d59[_0x0275('0x30')]=_0x2a18c3[_0x0275('0x15')];_0x4d2d59['answeredelsewheremembername']=_0x2a18c3[_0x0275('0x8')];writeDB(_0x4d2d59);}});}}catch(_0x52f69c){utils[_0x0275('0x19')](util[_0x0275('0x3')](_0x0275('0x27'),_0x2a18c3[_0x0275('0x5')]),_0x52f69c);}};exports['agentcomplete']=function(_0x13c651){try{if(!_[_0x0275('0x31')](agents[_0x13c651['destuniqueid']])){utils[_0x0275('0x13')](util[_0x0275('0x3')](_0x0275('0x32'),_0x13c651['uniqueid']),_0x13c651);utils[_0x0275('0x2')](util[_0x0275('0x3')]('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x13c651[_0x0275('0x5')],agents[_0x13c651[_0x0275('0x15')]][_0x0275('0x8')],_0x13c651[_0x0275('0x15')]));agents[_0x13c651[_0x0275('0x15')]][_0x0275('0x33')]=!![];agents[_0x13c651[_0x0275('0x15')]][_0x0275('0x34')]=utils[_0x0275('0x17')]();agents[_0x13c651[_0x0275('0x15')]][_0x0275('0x2d')]=utils['diffTime'](agents[_0x13c651[_0x0275('0x15')]][_0x0275('0x34')],agents[_0x13c651[_0x0275('0x15')]][_0x0275('0x29')]);agents[_0x13c651[_0x0275('0x15')]][_0x0275('0x1e')]=_0x13c651[_0x0275('0x1e')];agents[_0x13c651[_0x0275('0x15')]][_0x0275('0xb')]=_0x0275('0x35');writeDB(agents[_0x13c651[_0x0275('0x15')]]);}}catch(_0x598d15){utils['error'](util[_0x0275('0x3')](_0x0275('0x32'),_0x13c651[_0x0275('0x5')]),_0x598d15);}};exports[_0x0275('0x36')]=function(_0x310c6b){try{if(!_['isNil'](agents[_0x310c6b[_0x0275('0x37')]])){utils['debug'](util[_0x0275('0x3')](_0x0275('0x38'),_0x310c6b[_0x0275('0x5')]),_0x310c6b);utils[_0x0275('0x2')](util['format'](_0x0275('0x39'),_0x310c6b['uniqueid'],agents[_0x310c6b['transfereruniqueid']]['membername'],agents[_0x310c6b[_0x0275('0x37')]]['uniqueid']));agents[_0x310c6b[_0x0275('0x37')]][_0x0275('0x3a')]=!![];agents[_0x310c6b[_0x0275('0x37')]][_0x0275('0x3b')]=_0x0275('0x3c');agents[_0x310c6b[_0x0275('0x37')]][_0x0275('0x3d')]=_0x310c6b['extension'];agents[_0x310c6b[_0x0275('0x37')]]['transferuniqueid']=agents[_0x310c6b[_0x0275('0x37')]][_0x0275('0x5')];}}catch(_0x119301){utils[_0x0275('0x19')](util[_0x0275('0x3')](_0x0275('0x38'),_0x310c6b[_0x0275('0x5')]),_0x119301);}};exports[_0x0275('0x3e')]=function(_0x41429d){try{utils[_0x0275('0x13')](util['format']('[%s][agents][attendedtransfer]',_0x41429d[_0x0275('0x3f')]),_0x41429d);if(_0x41429d['origtransfereruniqueid']==_0x41429d['origtransfererlinkedid']){if(!_[_0x0275('0x31')](agents[_0x41429d[_0x0275('0x40')]])){utils[_0x0275('0x2')](util[_0x0275('0x3')](_0x0275('0x41'),_0x41429d[_0x0275('0x3f')],agents[_0x41429d['secondtransfereruniqueid']][_0x0275('0x8')]));agents[_0x41429d[_0x0275('0x40')]][_0x0275('0x3a')]=!![];agents[_0x41429d[_0x0275('0x40')]][_0x0275('0x3b')]=_0x0275('0x42');agents[_0x41429d['secondtransfereruniqueid']][_0x0275('0x3d')]=_0x41429d[_0x0275('0x43')];agents[_0x41429d['secondtransfereruniqueid']][_0x0275('0x44')]=_0x41429d['origtransfereruniqueid'];}if(_0x41429d[_0x0275('0x45')]&&agents[_0x41429d[_0x0275('0x45')]]){agents[_0x41429d[_0x0275('0x45')]][_0x0275('0x46')]=0x1;transfers[_0x41429d[_0x0275('0x45')]]=_[_0x0275('0x47')](agents[_0x41429d[_0x0275('0x45')]]);transfers[_0x41429d[_0x0275('0x45')]][_0x0275('0x9')]=agents[_0x41429d[_0x0275('0x40')]][_0x0275('0x9')];transfers[_0x41429d['transfereeuniqueid']][_0x0275('0x48')]=agents[_0x41429d[_0x0275('0x40')]][_0x0275('0x48')];transfers[_0x41429d['transfereeuniqueid']][_0x0275('0x16')]=utils[_0x0275('0x17')]();transfers[_0x41429d['transfereeuniqueid']][_0x0275('0x29')]=utils['now']();transfers[_0x41429d[_0x0275('0x45')]][_0x0275('0x1f')]=0x0;transfers[_0x41429d[_0x0275('0x45')]][_0x0275('0x46')]=0x2;}}else if(_0x41429d['secondtransfereruniqueid']==_0x41429d[_0x0275('0x49')]){if(!_[_0x0275('0x31')](agents[_0x41429d[_0x0275('0x3f')]])){utils[_0x0275('0x2')](util['format'](_0x0275('0x41'),_0x41429d[_0x0275('0x3f')],agents[_0x41429d['origtransfereruniqueid']][_0x0275('0x8')]));agents[_0x41429d[_0x0275('0x3f')]]['transfer']=!![];agents[_0x41429d['origtransfereruniqueid']][_0x0275('0x3b')]=_0x0275('0x42');agents[_0x41429d['origtransfereruniqueid']]['transferexten']=_0x41429d[_0x0275('0x4a')];agents[_0x41429d[_0x0275('0x3f')]][_0x0275('0x44')]=_0x41429d[_0x0275('0x40')];}if(_0x41429d[_0x0275('0x4b')]&&agents[_0x41429d[_0x0275('0x4b')]]){agents[_0x41429d[_0x0275('0x4b')]][_0x0275('0x46')]=0x1;transfers[_0x41429d['transfertargetuniqueid']]=_[_0x0275('0x47')](agents[_0x41429d[_0x0275('0x4b')]]);transfers[_0x41429d[_0x0275('0x4b')]][_0x0275('0x9')]=agents[_0x41429d[_0x0275('0x3f')]][_0x0275('0x9')];transfers[_0x41429d['transfertargetuniqueid']][_0x0275('0x48')]=agents[_0x41429d['origtransfereruniqueid']][_0x0275('0x48')];transfers[_0x41429d[_0x0275('0x4b')]][_0x0275('0x16')]=utils[_0x0275('0x17')]();transfers[_0x41429d['transfertargetuniqueid']][_0x0275('0x29')]=utils[_0x0275('0x17')]();transfers[_0x41429d[_0x0275('0x4b')]][_0x0275('0x1f')]=0x0;transfers[_0x41429d[_0x0275('0x4b')]][_0x0275('0x46')]=0x2;}}}catch(_0x3c7845){utils[_0x0275('0x19')](util[_0x0275('0x3')]('[%s][agents][attendedtransfer]',_0x41429d['origtransfereruniqueid']),_0x3c7845);}};exports['hangup']=function(_0x1dcaa6){try{utils[_0x0275('0x13')](util[_0x0275('0x3')]('[%s][agents][hangup]',_0x1dcaa6[_0x0275('0x5')]),_0x1dcaa6);if(agents[_0x1dcaa6[_0x0275('0x5')]]&&agents[_0x1dcaa6[_0x0275('0x5')]][_0x0275('0x1e')]===_0x0275('0x1d')){if(_0x1dcaa6['cause']==='21'){agents[_0x1dcaa6[_0x0275('0x5')]]['reason']=_0x0275('0x4c');agents[_0x1dcaa6[_0x0275('0x5')]][_0x0275('0xb')]=_0x0275('0x4c');}utils['info'](util[_0x0275('0x3')](_0x0275('0x4d'),_0x1dcaa6[_0x0275('0x5')],agents[_0x1dcaa6['uniqueid']][_0x0275('0x8')],agents[_0x1dcaa6[_0x0275('0x5')]][_0x0275('0x1e')],agents[_0x1dcaa6[_0x0275('0x5')]][_0x0275('0xb')]));writeDB(agents[_0x1dcaa6[_0x0275('0x5')]]);var _0x3a9898=unanswered[_0x0275('0x4e')](_0x1dcaa6['uniqueid']);if(_0x3a9898>-0x1){unanswered['splice'](_0x3a9898,0x1);}}if(transfers[_0x1dcaa6['uniqueid']]){transfers[_0x1dcaa6[_0x0275('0x5')]][_0x0275('0x33')]=!![];transfers[_0x1dcaa6[_0x0275('0x5')]][_0x0275('0x34')]=utils[_0x0275('0x17')]();transfers[_0x1dcaa6['uniqueid']][_0x0275('0x2d')]=utils['diffTime'](transfers[_0x1dcaa6['uniqueid']][_0x0275('0x34')],transfers[_0x1dcaa6['uniqueid']][_0x0275('0x29')]);transfers[_0x1dcaa6[_0x0275('0x5')]][_0x0275('0x1e')]=_0x0275('0x4f');transfers[_0x1dcaa6[_0x0275('0x5')]][_0x0275('0xb')]=_0x0275('0x35');utils[_0x0275('0x2')](util[_0x0275('0x3')](_0x0275('0x4d'),_0x1dcaa6[_0x0275('0x5')],transfers[_0x1dcaa6[_0x0275('0x5')]][_0x0275('0x8')],transfers[_0x1dcaa6[_0x0275('0x5')]][_0x0275('0x1e')],transfers[_0x1dcaa6[_0x0275('0x5')]][_0x0275('0xb')]));writeDB(transfers[_0x1dcaa6[_0x0275('0x5')]],!![]);}if(agents[_0x1dcaa6[_0x0275('0x5')]]&&agents[_0x1dcaa6[_0x0275('0x5')]][_0x0275('0x29')]){agents[_0x1dcaa6['uniqueid']][_0x0275('0x33')]=!![];agents[_0x1dcaa6[_0x0275('0x5')]][_0x0275('0x34')]=utils[_0x0275('0x17')]();agents[_0x1dcaa6[_0x0275('0x5')]][_0x0275('0x2d')]=utils['diffTime'](agents[_0x1dcaa6[_0x0275('0x5')]][_0x0275('0x34')],agents[_0x1dcaa6['uniqueid']][_0x0275('0x29')]);agents[_0x1dcaa6[_0x0275('0x5')]][_0x0275('0x1e')]=agents[_0x1dcaa6[_0x0275('0x5')]]['transfer']?_0x0275('0x3a'):_0x0275('0x4f');agents[_0x1dcaa6['uniqueid']][_0x0275('0xb')]='complete';utils[_0x0275('0x2')](util[_0x0275('0x3')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x1dcaa6[_0x0275('0x5')],agents[_0x1dcaa6[_0x0275('0x5')]][_0x0275('0x8')],agents[_0x1dcaa6[_0x0275('0x5')]][_0x0275('0x1e')],agents[_0x1dcaa6[_0x0275('0x5')]][_0x0275('0xb')]));writeDB(agents[_0x1dcaa6['uniqueid']]);}}catch(_0x12476c){utils[_0x0275('0x19')](util['format'](_0x0275('0x50'),_0x1dcaa6['uniqueid']),_0x12476c);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index b879236..c08551d 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 _0x02d4=['answertime','disposition','toNumber','error','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','diffTime','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','secondtransfererchannel','_attended','channel','origtransfererchannel','userfield','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','xmd-phone','destination','\x22\x20<','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid-preview','xmd-queue','xmcs-queue','Queue','lastdata','xmd-contactid','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','sipcallid','newexten','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','startsWith','substring','lastIndexOf','noop','execif','gotoif','lastapplication','[%s][calls][newexten]','lodash','./utils','NO\x20ANSWER','FAILED','ANSWERED','BUSY','blinds','uniqueid','info','queue','interface','calleridnum','lastevent','getUserByInternal','accountcode','then','request','CreateVoiceCallReport','newchannel','debug','format','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','exten','context','DOCUMENTATION','[%s][calls][newstate]','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','isNil','systemanswertime','now','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel'];(function(_0x4c02d0,_0x49e7c3){var _0x41d71b=function(_0x442d6f){while(--_0x442d6f){_0x4c02d0['push'](_0x4c02d0['shift']());}};_0x41d71b(++_0x49e7c3);}(_0x02d4,0x111));var _0x402d=function(_0x249135,_0x2afed6){_0x249135=_0x249135-0x0;var _0x958f26=_0x02d4[_0x249135];return _0x958f26;};'use strict';var _=require(_0x402d('0x0'));var util=require('util');var utils=require(_0x402d('0x1'));var transfers=require('./transfers.controller');var dispositions=[_0x402d('0x2'),_0x402d('0x3'),_0x402d('0x3'),_0x402d('0x2'),_0x402d('0x2'),_0x402d('0x2'),_0x402d('0x4'),_0x402d('0x5'),'FAILED',_0x402d('0x3'),_0x402d('0x3')];var channels={};function writeDB(_0x4257d1){var _0x13f1f4;if(transfers[_0x402d('0x6')][_0x4257d1[_0x402d('0x7')]]){_0x13f1f4=_0x4257d1[_0x402d('0x7')];_0x4257d1[_0x402d('0x7')]=transfers[_0x402d('0x6')][_0x4257d1[_0x402d('0x7')]]['transfereeuniqueid'];}utils[_0x402d('0x8')](util['format']('[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x4257d1[_0x402d('0x7')],_0x4257d1['channel'],_0x4257d1[_0x402d('0x9')],_0x4257d1['membername'],_0x4257d1[_0x402d('0xa')],_0x4257d1[_0x402d('0xb')],_0x4257d1['connectedlinenum'],_0x4257d1[_0x402d('0xc')]));if(_0x4257d1['accountcode']){utils[_0x402d('0xd')](_0x4257d1[_0x402d('0xe')])[_0x402d('0xf')](function(_0x3e450f){if(_0x3e450f){_0x4257d1['UserId']=_0x3e450f['id'];}utils[_0x402d('0x10')](_0x402d('0x11'),_0x4257d1);});}else{utils[_0x402d('0x10')](_0x402d('0x11'),_0x4257d1);}if(channels[_0x4257d1[_0x402d('0x7')]]){delete channels[_0x4257d1[_0x402d('0x7')]];}else if(_0x13f1f4&&channels[_0x13f1f4]){if(!transfers[_0x402d('0x6')][_0x13f1f4]['recording'])delete transfers[_0x402d('0x6')][_0x13f1f4];delete channels[_0x13f1f4];}}exports[_0x402d('0x12')]=function(_0x11e517){try{utils[_0x402d('0x13')](util[_0x402d('0x14')](_0x402d('0x15'),_0x11e517[_0x402d('0x7')]),_0x11e517);if(_0x11e517[_0x402d('0x7')]==_0x11e517[_0x402d('0x16')]&&_0x11e517['channel']!=_0x402d('0x17')){utils[_0x402d('0x8')](util[_0x402d('0x14')](_0x402d('0x18'),_0x11e517[_0x402d('0x7')],_0x11e517['context'],_0x11e517[_0x402d('0x19')]));channels[_0x11e517[_0x402d('0x7')]]={'uniqueid':_0x11e517['uniqueid'],'accountcode':_0x11e517['accountcode'],'source':_0x11e517[_0x402d('0xb')],'destination':_0x11e517[_0x402d('0x19')],'destinationcontext':_0x11e517[_0x402d('0x1a')],'channel':_0x11e517['channel'],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x402d('0x2'),'amaflags':_0x402d('0x1b')};}}catch(_0x27585e){utils['error'](util[_0x402d('0x14')](_0x402d('0x15'),_0x11e517[_0x402d('0x7')]),_0x27585e);}};exports['newstate']=function(_0xaa7f5a){try{utils[_0x402d('0x13')](util['format'](_0x402d('0x1c'),_0xaa7f5a[_0x402d('0x7')]),_0xaa7f5a);if(!_['isNil'](channels[_0xaa7f5a['uniqueid']])&&_0xaa7f5a[_0x402d('0x1d')]==0x6){utils[_0x402d('0x8')](util['format'](_0x402d('0x1e'),_0xaa7f5a[_0x402d('0x7')],_0xaa7f5a['context'],_0xaa7f5a['channel']));if(_[_0x402d('0x1f')](channels[_0xaa7f5a[_0x402d('0x7')]][_0x402d('0x20')])){channels[_0xaa7f5a['uniqueid']][_0x402d('0x20')]=utils[_0x402d('0x21')]();}}else if(!_[_0x402d('0x1f')](channels[_0xaa7f5a[_0x402d('0x16')]])&&_0xaa7f5a['channelstate']==0x6&&_0xaa7f5a[_0x402d('0x1a')]!='transfer'){utils['info'](util['format'](_0x402d('0x22'),_0xaa7f5a[_0x402d('0x7')],_0xaa7f5a[_0x402d('0x16')],_0xaa7f5a[_0x402d('0x1a')],_0xaa7f5a['channel']));channels[_0xaa7f5a['linkedid']][_0x402d('0xe')]=_0xaa7f5a[_0x402d('0xe')];channels[_0xaa7f5a[_0x402d('0x16')]][_0x402d('0x23')]=_0xaa7f5a['channel'];if(_['isNil'](channels[_0xaa7f5a[_0x402d('0x16')]][_0x402d('0x24')])){channels[_0xaa7f5a['linkedid']][_0x402d('0x24')]=utils[_0x402d('0x21')]();}channels[_0xaa7f5a[_0x402d('0x16')]][_0x402d('0x25')]=dispositions[_[_0x402d('0x26')](_0xaa7f5a['channelstate'])]||_0x402d('0x4');}}catch(_0x27c18e){utils[_0x402d('0x27')](util[_0x402d('0x14')](_0x402d('0x1c'),_0xaa7f5a[_0x402d('0x7')]),_0x27c18e);}};exports[_0x402d('0x28')]=function(_0x309b78){try{if(!_[_0x402d('0x1f')](channels[_0x309b78[_0x402d('0x7')]])){utils[_0x402d('0x13')](util['format'](_0x402d('0x29'),_0x309b78[_0x402d('0x7')]),_0x309b78);if(_[_0x402d('0x1f')](channels[_0x309b78['uniqueid']]['callerid'])){channels[_0x309b78[_0x402d('0x7')]][_0x402d('0x2a')]=_0x309b78[_0x402d('0x2b')]+'\x20<'+_0x309b78[_0x402d('0xb')]+'>';}utils[_0x402d('0x8')](util['format'](_0x402d('0x2c'),_0x309b78[_0x402d('0x7')],channels[_0x309b78[_0x402d('0x7')]][_0x402d('0x2a')],_0x309b78[_0x402d('0x2d')]));channels[_0x309b78[_0x402d('0x7')]][_0x402d('0x2e')]=utils[_0x402d('0x21')]();channels[_0x309b78[_0x402d('0x7')]][_0x402d('0x2f')]=utils['diffTime'](channels[_0x309b78[_0x402d('0x7')]][_0x402d('0x2e')],channels[_0x309b78[_0x402d('0x7')]]['starttime']);channels[_0x309b78[_0x402d('0x7')]]['billableseconds']=channels[_0x309b78[_0x402d('0x7')]][_0x402d('0x24')]?utils[_0x402d('0x30')](channels[_0x309b78[_0x402d('0x7')]][_0x402d('0x2e')],channels[_0x309b78[_0x402d('0x7')]][_0x402d('0x24')]):0x0;writeDB(channels[_0x309b78[_0x402d('0x7')]]);}}catch(_0x43efb4){utils[_0x402d('0x27')](util['format'](_0x402d('0x29'),_0x309b78[_0x402d('0x7')]),_0x43efb4);}};exports[_0x402d('0x31')]=function(_0x5101e8){try{if(!_['isNil'](channels[_0x5101e8[_0x402d('0x32')]])){utils[_0x402d('0x13')](util[_0x402d('0x14')](_0x402d('0x33'),_0x5101e8[_0x402d('0x34')]),_0x5101e8);if(channels[_0x5101e8['localtwolinkedid']]['channel']==_0x5101e8[_0x402d('0x35')]){utils[_0x402d('0x8')](util['format']('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x5101e8[_0x402d('0x34')],_0x5101e8[_0x402d('0x32')],_0x5101e8['secondtransfererchannel']));channels[_0x5101e8[_0x402d('0x32')]]['destinationchannel']=_0x5101e8[_0x402d('0x36')];channels[_0x5101e8[_0x402d('0x32')]]['userfield']=_0x402d('0x37');}else if(channels[_0x5101e8['localtwolinkedid']][_0x402d('0x38')]=_0x5101e8['transfertargetchannel']){utils['info'](util[_0x402d('0x14')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x5101e8[_0x402d('0x34')],_0x5101e8[_0x402d('0x32')],_0x5101e8[_0x402d('0x39')]));channels[_0x5101e8[_0x402d('0x32')]][_0x402d('0x23')]=_0x5101e8[_0x402d('0x39')];channels[_0x5101e8['localtwolinkedid']][_0x402d('0x3a')]=_0x402d('0x37');}}}catch(_0x1c3f16){utils[_0x402d('0x27')](util[_0x402d('0x14')]('[%s][calls][attendedtransfer]',_0x5101e8[_0x402d('0x34')]),_0x1c3f16);}};exports[_0x402d('0x3b')]=function(_0x2d934f){try{if(!_['isNil'](channels[_0x2d934f[_0x402d('0x7')]])){utils['debug'](util[_0x402d('0x14')](_0x402d('0x3c'),_0x2d934f[_0x402d('0x7')]),_0x2d934f);channels[_0x2d934f['uniqueid']][_0x402d('0x3d')]=utils[_0x402d('0x21')]();utils[_0x402d('0x8')](util[_0x402d('0x14')](_0x402d('0x3e'),_0x2d934f[_0x402d('0x7')],channels[_0x2d934f['uniqueid']][_0x402d('0x3d')]));}}catch(_0x17d71b){utils[_0x402d('0x27')](util['format'](_0x402d('0x3c'),_0x2d934f[_0x402d('0x7')]),_0x17d71b);}};exports[_0x402d('0x3f')]=function(_0x14b846){try{if(!_['isNil'](channels[_0x14b846[_0x402d('0x7')]])){utils[_0x402d('0x13')](util[_0x402d('0x14')](_0x402d('0x40'),_0x14b846[_0x402d('0x7')]),_0x14b846);if(!_['isNil'](channels[_0x14b846['uniqueid']]['musiconholdstartAt'])){channels[_0x14b846['uniqueid']][_0x402d('0x41')]+=utils[_0x402d('0x30')](utils[_0x402d('0x21')](),channels[_0x14b846['uniqueid']][_0x402d('0x3d')]);utils[_0x402d('0x8')](util[_0x402d('0x14')]('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x14b846['uniqueid'],channels[_0x14b846['uniqueid']][_0x402d('0x41')]));delete channels[_0x14b846[_0x402d('0x7')]]['musiconholdstartAt'];}}}catch(_0x4a9454){utils[_0x402d('0x27')](util[_0x402d('0x14')](_0x402d('0x40'),_0x14b846['uniqueid']),_0x4a9454);}};exports[_0x402d('0x42')]=function(_0x1255f8){try{if(!_[_0x402d('0x1f')](channels[_0x1255f8[_0x402d('0x7')]])){utils[_0x402d('0x13')](util['format'](_0x402d('0x43'),_0x1255f8['uniqueid']),_0x1255f8);if(!_[_0x402d('0x1f')](_0x1255f8[_0x402d('0x44')][_0x402d('0x45')])){utils['info'](util['format'](_0x402d('0x46'),_0x1255f8['uniqueid'],_0x1255f8['value']));channels[_0x1255f8[_0x402d('0x7')]]['source']=_0x1255f8[_0x402d('0x47')];}if(!_['isNil'](_0x1255f8[_0x402d('0x44')][_0x402d('0x48')])){utils[_0x402d('0x8')](util['format']('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x1255f8[_0x402d('0x7')],_0x1255f8['value']));channels[_0x1255f8['uniqueid']][_0x402d('0x49')]=_0x1255f8[_0x402d('0x47')];channels[_0x1255f8[_0x402d('0x7')]][_0x402d('0x2a')]='\x22'+_0x1255f8['value']+_0x402d('0x4a')+_0x1255f8[_0x402d('0x47')]+'>';}if(!_[_0x402d('0x1f')](_0x1255f8[_0x402d('0x44')]['xmd-callerid-preview'])||!_[_0x402d('0x1f')](_0x1255f8['variable'][_0x402d('0x4b')])){utils['info'](util[_0x402d('0x14')](_0x402d('0x4c'),_0x1255f8[_0x402d('0x7')],!_[_0x402d('0x1f')](_0x1255f8['variable'][_0x402d('0x4d')])?_0x402d('0x4d'):_0x402d('0x4b'),_0x1255f8['value']));channels[_0x1255f8[_0x402d('0x7')]][_0x402d('0x2a')]=_0x1255f8[_0x402d('0x47')];}if(!_[_0x402d('0x1f')](_0x1255f8[_0x402d('0x44')][_0x402d('0x4e')])||!_[_0x402d('0x1f')](_0x1255f8[_0x402d('0x44')][_0x402d('0x4f')])){utils['info'](util[_0x402d('0x14')](_0x402d('0x4c'),_0x1255f8[_0x402d('0x7')],!_[_0x402d('0x1f')](_0x1255f8['variable']['xmd-queue'])?_0x402d('0x4e'):_0x402d('0x4f'),_0x1255f8[_0x402d('0x47')]));channels[_0x1255f8[_0x402d('0x7')]]['lastapplication']=_0x402d('0x50');channels[_0x1255f8[_0x402d('0x7')]][_0x402d('0x51')]=_0x1255f8[_0x402d('0x47')];channels[_0x1255f8[_0x402d('0x7')]][_0x402d('0x9')]=!![];}if(!_['isNil'](_0x1255f8[_0x402d('0x44')][_0x402d('0x52')])){utils[_0x402d('0x8')](util[_0x402d('0x14')]('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0x1255f8['uniqueid'],_0x1255f8[_0x402d('0x47')]));channels[_0x1255f8[_0x402d('0x7')]]['ContactId']=_0x1255f8[_0x402d('0x47')];}if(!_['isNil'](_0x1255f8[_0x402d('0x44')][_0x402d('0x53')])){utils[_0x402d('0x8')](util[_0x402d('0x14')](_0x402d('0x54'),_0x1255f8['uniqueid'],_0x1255f8[_0x402d('0x47')]));channels[_0x1255f8[_0x402d('0x7')]][_0x402d('0x55')]=_0x1255f8[_0x402d('0x47')];}if(!_['isNil'](_0x1255f8[_0x402d('0x44')]['outboundrouteid'])){utils[_0x402d('0x8')](util['format'](_0x402d('0x56'),_0x1255f8[_0x402d('0x7')],_0x1255f8['value']));channels[_0x1255f8[_0x402d('0x7')]][_0x402d('0x57')]=_0x1255f8[_0x402d('0x47')];}if(!_[_0x402d('0x1f')](_0x1255f8[_0x402d('0x44')]['sipcallid'])){utils['info'](util[_0x402d('0x14')](_0x402d('0x58'),_0x1255f8[_0x402d('0x7')],_0x1255f8[_0x402d('0x47')]));channels[_0x1255f8['uniqueid']][_0x402d('0x59')]=_0x1255f8[_0x402d('0x47')];}}}catch(_0x5a55c1){utils['error'](util[_0x402d('0x14')](_0x402d('0x43'),_0x1255f8['uniqueid']),_0x5a55c1);}};exports[_0x402d('0x5a')]=function(_0x587249){try{if(!_[_0x402d('0x1f')](channels[_0x587249[_0x402d('0x7')]])){utils[_0x402d('0x13')](util[_0x402d('0x14')]('[%s][calls][newexten]',_0x587249[_0x402d('0x7')]),_0x587249);utils[_0x402d('0x8')](util[_0x402d('0x14')](_0x402d('0x5b'),_0x587249['uniqueid'],_0x587249[_0x402d('0x5c')],_0x587249[_0x402d('0x5d')]));if(_0x587249[_0x402d('0x5c')][_0x402d('0x5e')]()=='set'&&_[_0x402d('0x5f')](_0x587249[_0x402d('0x5d')][_0x402d('0x5e')](),'cdr')){var _0x2aff84=_0x587249[_0x402d('0x5d')]['split']('=');var _0x53b187=_0x2aff84[0x0][_0x402d('0x60')](_0x2aff84[0x0][_0x402d('0x61')]('(')+0x1,_0x2aff84[0x0][_0x402d('0x61')](')'));var _0x3a4f60=_0x2aff84[0x1];channels[_0x587249['uniqueid']][_0x53b187]=_0x3a4f60;}if(!_['includes']([_0x402d('0x28'),_0x402d('0x62'),_0x402d('0x63'),'set',_0x402d('0x64')],_0x587249[_0x402d('0x5c')][_0x402d('0x5e')]())){channels[_0x587249['uniqueid']][_0x402d('0x65')]=_0x587249['application'];channels[_0x587249[_0x402d('0x7')]][_0x402d('0x51')]=_0x587249['appdata'];}}}catch(_0x42cd68){utils['error'](util['format'](_0x402d('0x66'),_0x587249[_0x402d('0x7')]),_0x42cd68);}}; \ No newline at end of file +var _0x5d95=['set','gotoif','application','lastapplication','[%s][calls][newexten]','lodash','util','./transfers.controller','NO\x20ANSWER','FAILED','uniqueid','transfereeuniqueid','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','membername','interface','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','blinds','recording','newchannel','debug','[%s][calls][newchannel]\x20context:%s\x20exten:%s','exten','context','channel','DOCUMENTATION','error','[%s][calls][newchannel]','newstate','[%s][calls][newstate]','[%s][calls][newstate]\x20context:%s\x20channel:%s','isNil','systemanswertime','now','linkedid','channelstate','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','ANSWERED','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','starttime','billableseconds','diffTime','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','varset','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','variable','xmd-phone','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','Queue','queue','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','[%s][calls][varset]','newexten','[%s][calls][newexten]\x20application:%s\x20appdata:%s','appdata','toLowerCase','split','substring','lastIndexOf','includes','noop','execif'];(function(_0x15a861,_0xd94102){var _0x132bec=function(_0x55ac77){while(--_0x55ac77){_0x15a861['push'](_0x15a861['shift']());}};_0x132bec(++_0xd94102);}(_0x5d95,0x77));var _0x55d9=function(_0x3d2543,_0x417fd7){_0x3d2543=_0x3d2543-0x0;var _0x24877d=_0x5d95[_0x3d2543];return _0x24877d;};'use strict';var _=require(_0x55d9('0x0'));var util=require(_0x55d9('0x1'));var utils=require('./utils');var transfers=require(_0x55d9('0x2'));var dispositions=[_0x55d9('0x3'),_0x55d9('0x4'),_0x55d9('0x4'),_0x55d9('0x3'),'NO\x20ANSWER',_0x55d9('0x3'),'ANSWERED','BUSY',_0x55d9('0x4'),_0x55d9('0x4'),'FAILED'];var channels={};function writeDB(_0x5768e7){var _0x5d0b9d;if(transfers['blinds'][_0x5768e7['uniqueid']]){_0x5d0b9d=_0x5768e7[_0x55d9('0x5')];_0x5768e7['uniqueid']=transfers['blinds'][_0x5768e7[_0x55d9('0x5')]][_0x55d9('0x6')];}utils[_0x55d9('0x7')](util[_0x55d9('0x8')](_0x55d9('0x9'),_0x5768e7[_0x55d9('0x5')],_0x5768e7['channel'],_0x5768e7['queue'],_0x5768e7[_0x55d9('0xa')],_0x5768e7[_0x55d9('0xb')],_0x5768e7[_0x55d9('0xc')],_0x5768e7[_0x55d9('0xd')],_0x5768e7[_0x55d9('0xe')]));if(_0x5768e7[_0x55d9('0xf')]){utils[_0x55d9('0x10')](_0x5768e7[_0x55d9('0xf')])[_0x55d9('0x11')](function(_0x581e43){if(_0x581e43){_0x5768e7[_0x55d9('0x12')]=_0x581e43['id'];}utils[_0x55d9('0x13')](_0x55d9('0x14'),_0x5768e7);});}else{utils[_0x55d9('0x13')](_0x55d9('0x14'),_0x5768e7);}if(channels[_0x5768e7[_0x55d9('0x5')]]){delete channels[_0x5768e7[_0x55d9('0x5')]];}else if(_0x5d0b9d&&channels[_0x5d0b9d]){if(!transfers[_0x55d9('0x15')][_0x5d0b9d][_0x55d9('0x16')])delete transfers[_0x55d9('0x15')][_0x5d0b9d];delete channels[_0x5d0b9d];}}exports[_0x55d9('0x17')]=function(_0x34a1da){try{utils[_0x55d9('0x18')](util[_0x55d9('0x8')]('[%s][calls][newchannel]',_0x34a1da[_0x55d9('0x5')]),_0x34a1da);if(_0x34a1da[_0x55d9('0x5')]==_0x34a1da['linkedid']&&_0x34a1da['channel']!='OutgoingSpoolFailed'){utils[_0x55d9('0x7')](util[_0x55d9('0x8')](_0x55d9('0x19'),_0x34a1da[_0x55d9('0x5')],_0x34a1da['context'],_0x34a1da[_0x55d9('0x1a')]));channels[_0x34a1da[_0x55d9('0x5')]]={'uniqueid':_0x34a1da[_0x55d9('0x5')],'accountcode':_0x34a1da['accountcode'],'source':_0x34a1da[_0x55d9('0xc')],'destination':_0x34a1da[_0x55d9('0x1a')],'destinationcontext':_0x34a1da[_0x55d9('0x1b')],'channel':_0x34a1da[_0x55d9('0x1c')],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0x55d9('0x1d')};}}catch(_0x416cc6){utils[_0x55d9('0x1e')](util[_0x55d9('0x8')](_0x55d9('0x1f'),_0x34a1da[_0x55d9('0x5')]),_0x416cc6);}};exports[_0x55d9('0x20')]=function(_0x3773e6){try{utils[_0x55d9('0x18')](util['format'](_0x55d9('0x21'),_0x3773e6[_0x55d9('0x5')]),_0x3773e6);if(!_['isNil'](channels[_0x3773e6[_0x55d9('0x5')]])&&_0x3773e6['channelstate']==0x6){utils[_0x55d9('0x7')](util[_0x55d9('0x8')](_0x55d9('0x22'),_0x3773e6[_0x55d9('0x5')],_0x3773e6[_0x55d9('0x1b')],_0x3773e6['channel']));if(_[_0x55d9('0x23')](channels[_0x3773e6['uniqueid']]['systemanswertime'])){channels[_0x3773e6[_0x55d9('0x5')]][_0x55d9('0x24')]=utils[_0x55d9('0x25')]();}}else if(!_['isNil'](channels[_0x3773e6[_0x55d9('0x26')]])&&_0x3773e6[_0x55d9('0x27')]==0x6&&_0x3773e6[_0x55d9('0x1b')]!=_0x55d9('0x28')){utils[_0x55d9('0x7')](util[_0x55d9('0x8')](_0x55d9('0x29'),_0x3773e6[_0x55d9('0x5')],_0x3773e6[_0x55d9('0x26')],_0x3773e6[_0x55d9('0x1b')],_0x3773e6[_0x55d9('0x1c')]));channels[_0x3773e6[_0x55d9('0x26')]][_0x55d9('0xf')]=_0x3773e6[_0x55d9('0xf')];channels[_0x3773e6[_0x55d9('0x26')]][_0x55d9('0x2a')]=_0x3773e6[_0x55d9('0x1c')];if(_[_0x55d9('0x23')](channels[_0x3773e6[_0x55d9('0x26')]][_0x55d9('0x2b')])){channels[_0x3773e6[_0x55d9('0x26')]][_0x55d9('0x2b')]=utils[_0x55d9('0x25')]();}channels[_0x3773e6[_0x55d9('0x26')]]['disposition']=dispositions[_['toNumber'](_0x3773e6[_0x55d9('0x27')])]||_0x55d9('0x2c');}}catch(_0x2ad2e5){utils[_0x55d9('0x1e')](util[_0x55d9('0x8')](_0x55d9('0x21'),_0x3773e6[_0x55d9('0x5')]),_0x2ad2e5);}};exports[_0x55d9('0x2d')]=function(_0x49f7a0){try{if(!_[_0x55d9('0x23')](channels[_0x49f7a0[_0x55d9('0x5')]])){utils[_0x55d9('0x18')](util[_0x55d9('0x8')](_0x55d9('0x2e'),_0x49f7a0['uniqueid']),_0x49f7a0);if(_[_0x55d9('0x23')](channels[_0x49f7a0[_0x55d9('0x5')]][_0x55d9('0x2f')])){channels[_0x49f7a0[_0x55d9('0x5')]][_0x55d9('0x2f')]=_0x49f7a0[_0x55d9('0x30')]+'\x20<'+_0x49f7a0[_0x55d9('0xc')]+'>';}utils[_0x55d9('0x7')](util[_0x55d9('0x8')](_0x55d9('0x31'),_0x49f7a0[_0x55d9('0x5')],channels[_0x49f7a0[_0x55d9('0x5')]][_0x55d9('0x2f')],_0x49f7a0[_0x55d9('0x32')]));channels[_0x49f7a0[_0x55d9('0x5')]][_0x55d9('0x33')]=utils[_0x55d9('0x25')]();channels[_0x49f7a0['uniqueid']][_0x55d9('0x34')]=utils['diffTime'](channels[_0x49f7a0[_0x55d9('0x5')]][_0x55d9('0x33')],channels[_0x49f7a0[_0x55d9('0x5')]][_0x55d9('0x35')]);channels[_0x49f7a0['uniqueid']][_0x55d9('0x36')]=channels[_0x49f7a0[_0x55d9('0x5')]][_0x55d9('0x2b')]?utils[_0x55d9('0x37')](channels[_0x49f7a0['uniqueid']]['endtime'],channels[_0x49f7a0[_0x55d9('0x5')]][_0x55d9('0x2b')]):0x0;writeDB(channels[_0x49f7a0['uniqueid']]);}}catch(_0x4efc70){utils[_0x55d9('0x1e')](util[_0x55d9('0x8')](_0x55d9('0x2e'),_0x49f7a0[_0x55d9('0x5')]),_0x4efc70);}};exports[_0x55d9('0x38')]=function(_0x411c2e){try{if(!_['isNil'](channels[_0x411c2e[_0x55d9('0x39')]])){utils[_0x55d9('0x18')](util[_0x55d9('0x8')](_0x55d9('0x3a'),_0x411c2e[_0x55d9('0x3b')]),_0x411c2e);if(channels[_0x411c2e['localtwolinkedid']]['channel']==_0x411c2e[_0x55d9('0x3c')]){utils[_0x55d9('0x7')](util[_0x55d9('0x8')](_0x55d9('0x3d'),_0x411c2e[_0x55d9('0x3b')],_0x411c2e[_0x55d9('0x39')],_0x411c2e[_0x55d9('0x3e')]));channels[_0x411c2e['localtwolinkedid']][_0x55d9('0x2a')]=_0x411c2e[_0x55d9('0x3e')];channels[_0x411c2e[_0x55d9('0x39')]][_0x55d9('0x3f')]=_0x55d9('0x40');}else if(channels[_0x411c2e['localtwolinkedid']]['channel']=_0x411c2e[_0x55d9('0x41')]){utils['info'](util[_0x55d9('0x8')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x411c2e[_0x55d9('0x3b')],_0x411c2e[_0x55d9('0x39')],_0x411c2e[_0x55d9('0x42')]));channels[_0x411c2e[_0x55d9('0x39')]]['destinationchannel']=_0x411c2e[_0x55d9('0x42')];channels[_0x411c2e['localtwolinkedid']]['userfield']='_attended';}}}catch(_0x2ff09a){utils[_0x55d9('0x1e')](util['format'](_0x55d9('0x3a'),_0x411c2e['origtransfereruniqueid']),_0x2ff09a);}};exports[_0x55d9('0x43')]=function(_0x1b0cd4){try{if(!_[_0x55d9('0x23')](channels[_0x1b0cd4[_0x55d9('0x5')]])){utils[_0x55d9('0x18')](util['format']('[%s][calls][musiconholdstart]',_0x1b0cd4[_0x55d9('0x5')]),_0x1b0cd4);channels[_0x1b0cd4[_0x55d9('0x5')]][_0x55d9('0x44')]=utils[_0x55d9('0x25')]();utils[_0x55d9('0x7')](util['format'](_0x55d9('0x45'),_0x1b0cd4[_0x55d9('0x5')],channels[_0x1b0cd4[_0x55d9('0x5')]][_0x55d9('0x44')]));}}catch(_0x423510){utils[_0x55d9('0x1e')](util[_0x55d9('0x8')]('[%s][calls][musiconholdstart]',_0x1b0cd4[_0x55d9('0x5')]),_0x423510);}};exports[_0x55d9('0x46')]=function(_0x1326d2){try{if(!_[_0x55d9('0x23')](channels[_0x1326d2[_0x55d9('0x5')]])){utils['debug'](util[_0x55d9('0x8')](_0x55d9('0x47'),_0x1326d2[_0x55d9('0x5')]),_0x1326d2);if(!_[_0x55d9('0x23')](channels[_0x1326d2[_0x55d9('0x5')]][_0x55d9('0x44')])){channels[_0x1326d2[_0x55d9('0x5')]][_0x55d9('0x48')]+=utils[_0x55d9('0x37')](utils[_0x55d9('0x25')](),channels[_0x1326d2[_0x55d9('0x5')]][_0x55d9('0x44')]);utils[_0x55d9('0x7')](util[_0x55d9('0x8')]('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x1326d2[_0x55d9('0x5')],channels[_0x1326d2[_0x55d9('0x5')]][_0x55d9('0x48')]));delete channels[_0x1326d2[_0x55d9('0x5')]][_0x55d9('0x44')];}}}catch(_0x123ba6){utils['error'](util['format'](_0x55d9('0x47'),_0x1326d2['uniqueid']),_0x123ba6);}};exports[_0x55d9('0x49')]=function(_0x3d6c10){try{if(!_[_0x55d9('0x23')](channels[_0x3d6c10[_0x55d9('0x5')]])){utils['debug'](util[_0x55d9('0x8')]('[%s][calls][varset]',_0x3d6c10[_0x55d9('0x5')]),_0x3d6c10);if(!_['isNil'](_0x3d6c10['variable'][_0x55d9('0x4a')])){utils[_0x55d9('0x7')](util[_0x55d9('0x8')](_0x55d9('0x4b'),_0x3d6c10[_0x55d9('0x5')],_0x3d6c10['value']));channels[_0x3d6c10[_0x55d9('0x5')]]['source']=_0x3d6c10[_0x55d9('0x4c')];}if(!_[_0x55d9('0x23')](_0x3d6c10[_0x55d9('0x4d')][_0x55d9('0x4e')])){utils[_0x55d9('0x7')](util[_0x55d9('0x8')]('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x3d6c10[_0x55d9('0x5')],_0x3d6c10['value']));channels[_0x3d6c10['uniqueid']][_0x55d9('0x4f')]=_0x3d6c10[_0x55d9('0x4c')];channels[_0x3d6c10[_0x55d9('0x5')]][_0x55d9('0x2f')]='\x22'+_0x3d6c10['value']+_0x55d9('0x50')+_0x3d6c10[_0x55d9('0x4c')]+'>';}if(!_['isNil'](_0x3d6c10[_0x55d9('0x4d')][_0x55d9('0x51')])||!_[_0x55d9('0x23')](_0x3d6c10[_0x55d9('0x4d')][_0x55d9('0x52')])){utils['info'](util[_0x55d9('0x8')](_0x55d9('0x53'),_0x3d6c10[_0x55d9('0x5')],!_[_0x55d9('0x23')](_0x3d6c10[_0x55d9('0x4d')][_0x55d9('0x51')])?'xmd-callerid-preview':_0x55d9('0x52'),_0x3d6c10['value']));channels[_0x3d6c10[_0x55d9('0x5')]][_0x55d9('0x2f')]=_0x3d6c10['value'];}if(!_['isNil'](_0x3d6c10['variable'][_0x55d9('0x54')])||!_[_0x55d9('0x23')](_0x3d6c10[_0x55d9('0x4d')][_0x55d9('0x55')])){utils[_0x55d9('0x7')](util['format'](_0x55d9('0x53'),_0x3d6c10[_0x55d9('0x5')],!_[_0x55d9('0x23')](_0x3d6c10[_0x55d9('0x4d')][_0x55d9('0x54')])?_0x55d9('0x54'):_0x55d9('0x55'),_0x3d6c10[_0x55d9('0x4c')]));channels[_0x3d6c10[_0x55d9('0x5')]]['lastapplication']=_0x55d9('0x56');channels[_0x3d6c10[_0x55d9('0x5')]]['lastdata']=_0x3d6c10['value'];channels[_0x3d6c10[_0x55d9('0x5')]][_0x55d9('0x57')]=!![];}if(!_[_0x55d9('0x23')](_0x3d6c10[_0x55d9('0x4d')][_0x55d9('0x58')])){utils[_0x55d9('0x7')](util[_0x55d9('0x8')](_0x55d9('0x59'),_0x3d6c10[_0x55d9('0x5')],_0x3d6c10['value']));channels[_0x3d6c10['uniqueid']][_0x55d9('0x5a')]=_0x3d6c10[_0x55d9('0x4c')];}if(!_[_0x55d9('0x23')](_0x3d6c10[_0x55d9('0x4d')][_0x55d9('0x5b')])){utils['info'](util[_0x55d9('0x8')](_0x55d9('0x5c'),_0x3d6c10[_0x55d9('0x5')],_0x3d6c10[_0x55d9('0x4c')]));channels[_0x3d6c10[_0x55d9('0x5')]]['type']=_0x3d6c10[_0x55d9('0x4c')];}if(!_[_0x55d9('0x23')](_0x3d6c10[_0x55d9('0x4d')][_0x55d9('0x5d')])){utils['info'](util[_0x55d9('0x8')](_0x55d9('0x5e'),_0x3d6c10['uniqueid'],_0x3d6c10[_0x55d9('0x4c')]));channels[_0x3d6c10['uniqueid']][_0x55d9('0x5f')]=_0x3d6c10['value'];}if(!_[_0x55d9('0x23')](_0x3d6c10['variable'][_0x55d9('0x60')])){utils[_0x55d9('0x7')](util[_0x55d9('0x8')](_0x55d9('0x61'),_0x3d6c10[_0x55d9('0x5')],_0x3d6c10['value']));channels[_0x3d6c10[_0x55d9('0x5')]][_0x55d9('0x60')]=_0x3d6c10['value'];}}}catch(_0x1dacb3){utils[_0x55d9('0x1e')](util[_0x55d9('0x8')](_0x55d9('0x62'),_0x3d6c10[_0x55d9('0x5')]),_0x1dacb3);}};exports[_0x55d9('0x63')]=function(_0x263a33){try{if(!_[_0x55d9('0x23')](channels[_0x263a33[_0x55d9('0x5')]])){utils[_0x55d9('0x18')](util[_0x55d9('0x8')]('[%s][calls][newexten]',_0x263a33['uniqueid']),_0x263a33);utils['info'](util['format'](_0x55d9('0x64'),_0x263a33[_0x55d9('0x5')],_0x263a33['application'],_0x263a33[_0x55d9('0x65')]));if(_0x263a33['application'][_0x55d9('0x66')]()=='set'&&_['startsWith'](_0x263a33[_0x55d9('0x65')][_0x55d9('0x66')](),'cdr')){var _0x1d05fd=_0x263a33['appdata'][_0x55d9('0x67')]('=');var _0x1e0d9b=_0x1d05fd[0x0][_0x55d9('0x68')](_0x1d05fd[0x0][_0x55d9('0x69')]('(')+0x1,_0x1d05fd[0x0][_0x55d9('0x69')](')'));var _0x8a96bc=_0x1d05fd[0x1];channels[_0x263a33[_0x55d9('0x5')]][_0x1e0d9b]=_0x8a96bc;}if(!_[_0x55d9('0x6a')]([_0x55d9('0x2d'),_0x55d9('0x6b'),_0x55d9('0x6c'),_0x55d9('0x6d'),_0x55d9('0x6e')],_0x263a33[_0x55d9('0x6f')][_0x55d9('0x66')]())){channels[_0x263a33[_0x55d9('0x5')]][_0x55d9('0x70')]=_0x263a33['application'];channels[_0x263a33[_0x55d9('0x5')]]['lastdata']=_0x263a33[_0x55d9('0x65')];}}}catch(_0x5ec10a){utils[_0x55d9('0x1e')](util[_0x55d9('0x8')](_0x55d9('0x71'),_0x263a33[_0x55d9('0x5')]),_0x5ec10a);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 4657231..8ae0d02 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 _0x9986=['[core]\x20connected','shutdown','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','[core]\x20error','close','connect','info'];(function(_0x38b2d9,_0x19fd42){var _0x23a3e1=function(_0xd8192f){while(--_0xd8192f){_0x38b2d9['push'](_0x38b2d9['shift']());}};_0x23a3e1(++_0x19fd42);}(_0x9986,0x1f2));var _0x6998=function(_0x128443,_0x2fe025){_0x128443=_0x128443-0x0;var _0x1a4ce1=_0x9986[_0x128443];return _0x1a4ce1;};'use strict';var utils=require('./utils');exports[_0x6998('0x0')]=function(){utils[_0x6998('0x1')](_0x6998('0x2'));};exports[_0x6998('0x3')]=function(){utils['info'](_0x6998('0x4'));};exports[_0x6998('0x5')]=function(){utils['info'](_0x6998('0x6'));};exports[_0x6998('0x7')]=function(_0xec4dd2){utils[_0x6998('0x7')](_0x6998('0x8'),_0xec4dd2);};exports[_0x6998('0x9')]=function(){utils[_0x6998('0x1')]('[core]\x20close');};exports['managerevent']=function(_0x38b8f5){}; \ No newline at end of file +var _0x687e=['close','[core]\x20close','managerevent','./utils','connect','info','[core]\x20connected','shutdown','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','[core]\x20error'];(function(_0x2c2be3,_0x5bea29){var _0x3a2f70=function(_0x17cce8){while(--_0x17cce8){_0x2c2be3['push'](_0x2c2be3['shift']());}};_0x3a2f70(++_0x5bea29);}(_0x687e,0x1f1));var _0xe687=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x687e[_0xfae23b];return _0x200640;};'use strict';var utils=require(_0xe687('0x0'));exports[_0xe687('0x1')]=function(){utils[_0xe687('0x2')](_0xe687('0x3'));};exports[_0xe687('0x4')]=function(){utils[_0xe687('0x2')](_0xe687('0x5'));};exports[_0xe687('0x6')]=function(){utils[_0xe687('0x2')](_0xe687('0x7'));};exports[_0xe687('0x8')]=function(_0x506492){utils[_0xe687('0x8')](_0xe687('0x9'),_0x506492);};exports[_0xe687('0xa')]=function(){utils[_0xe687('0x2')](_0xe687('0xb'));};exports[_0xe687('0xc')]=function(_0x1acc61){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 4d901f4..b908933 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 _0xf283=['now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','[%s][dials][dialend]','ANSWER','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','calleridname','complete','diffTime','endtime','holdtime','billableseconds','lodash','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','cdr(routeid)','split','error','varset','[%s][dials][varset]','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','[%s][dials][dialbegin]','assign','starttime'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xf283,0xe2));var _0x3f28=function(_0x27eb9d,_0x1210d4){_0x27eb9d=_0x27eb9d-0x0;var _0x35b67d=_0xf283[_0x27eb9d];return _0x35b67d;};'use strict';var _=require(_0x3f28('0x0'));var util=require('util');var utils=require(_0x3f28('0x1'));var dials={};function writeDB(_0x5ec431){utils[_0x3f28('0x2')](util[_0x3f28('0x3')](_0x3f28('0x4'),_0x5ec431[_0x3f28('0x5')],_0x5ec431[_0x3f28('0x6')],_0x5ec431['dialstring'],_0x5ec431[_0x3f28('0x7')],_0x5ec431[_0x3f28('0x8')],_0x5ec431[_0x3f28('0x9')]));utils[_0x3f28('0xa')](_0x3f28('0xb'),_0x5ec431);delete dials[_0x5ec431[_0x3f28('0x5')]];}exports[_0x3f28('0xc')]=function(_0x5c9442){try{utils[_0x3f28('0xd')](util['format'](_0x3f28('0xe'),_0x5c9442[_0x3f28('0x5')]),_0x5c9442);utils[_0x3f28('0x2')](util[_0x3f28('0x3')](_0x3f28('0xf'),_0x5c9442['uniqueid'],_0x5c9442[_0x3f28('0x10')],_0x5c9442[_0x3f28('0x11')]));if(_0x5c9442[_0x3f28('0x10')][_0x3f28('0x12')]()==_0x3f28('0x13')&&_['startsWith'](_0x5c9442[_0x3f28('0x11')][_0x3f28('0x12')](),_0x3f28('0x14'))){var _0x118e62=_0x5c9442[_0x3f28('0x11')][_0x3f28('0x15')]('=');dials[_0x5c9442[_0x3f28('0x5')]]={'routeId':_0x118e62[0x1]};}}catch(_0x1f54f5){utils[_0x3f28('0x16')](util[_0x3f28('0x3')](_0x3f28('0xe'),_0x5c9442[_0x3f28('0x5')]),_0x1f54f5);}};exports[_0x3f28('0x17')]=function(_0x40c8c1){try{utils[_0x3f28('0xd')](util[_0x3f28('0x3')](_0x3f28('0x18'),_0x40c8c1[_0x3f28('0x5')]),_0x40c8c1);if(!_[_0x3f28('0x19')](_0x40c8c1[_0x3f28('0x1a')][_0x3f28('0x1b')])){utils[_0x3f28('0x2')](util[_0x3f28('0x3')](_0x3f28('0x1c'),_0x40c8c1[_0x3f28('0x5')],_0x40c8c1[_0x3f28('0x1d')]));dials[_0x40c8c1[_0x3f28('0x5')]]={'routeId':_0x40c8c1['value']};}}catch(_0x3a2ef7){utils[_0x3f28('0x16')](util['format'](_0x3f28('0x18'),_0x40c8c1[_0x3f28('0x5')]),_0x3a2ef7);}};exports[_0x3f28('0x1e')]=function(_0x30de69){try{if(!_[_0x3f28('0x19')](dials[_0x30de69[_0x3f28('0x5')]])){utils[_0x3f28('0xd')](util[_0x3f28('0x3')](_0x3f28('0x1f'),_0x30de69[_0x3f28('0x5')]),_0x30de69);dials[_0x30de69[_0x3f28('0x5')]]=_[_0x3f28('0x20')](dials[_0x30de69[_0x3f28('0x5')]],_0x30de69);dials[_0x30de69[_0x3f28('0x5')]][_0x3f28('0x21')]=utils[_0x3f28('0x22')]();dials[_0x30de69[_0x3f28('0x5')]][_0x3f28('0x23')]=_0x3f28('0x24');utils['info'](util[_0x3f28('0x3')](_0x3f28('0x25'),_0x30de69[_0x3f28('0x5')],dials[_0x30de69[_0x3f28('0x5')]][_0x3f28('0x21')]));}}catch(_0x1b56c5){utils['error'](util[_0x3f28('0x3')](_0x3f28('0x1f'),_0x30de69[_0x3f28('0x5')]),_0x1b56c5);}};exports['dialend']=function(_0x35c558){try{if(!_['isNil'](dials[_0x35c558[_0x3f28('0x5')]])){utils['debug'](util[_0x3f28('0x3')](_0x3f28('0x26'),_0x35c558['uniqueid']),_0x35c558);dials[_0x35c558[_0x3f28('0x5')]][_0x3f28('0x9')]=_0x35c558['dialstatus'];if(_0x35c558['dialstatus']==_0x3f28('0x27')){dials[_0x35c558[_0x3f28('0x5')]]=_[_0x3f28('0x20')](dials[_0x35c558[_0x3f28('0x5')]],_0x35c558);dials[_0x35c558[_0x3f28('0x5')]][_0x3f28('0x28')]=utils[_0x3f28('0x22')]();dials[_0x35c558[_0x3f28('0x5')]][_0x3f28('0x23')]=_0x3f28('0x29');utils['info'](util[_0x3f28('0x3')](_0x3f28('0x2a'),_0x35c558[_0x3f28('0x5')],_0x35c558[_0x3f28('0x9')],dials[_0x35c558[_0x3f28('0x5')]][_0x3f28('0x28')]));}else{utils[_0x3f28('0x2')](util['format'](_0x3f28('0x2b'),_0x35c558[_0x3f28('0x5')],_0x35c558[_0x3f28('0x9')]));}}}catch(_0x4b95ed){utils['error'](util[_0x3f28('0x3')](_0x3f28('0x26'),_0x35c558['uniqueid']),_0x4b95ed);}};exports[_0x3f28('0x2c')]=function(_0x4f6a0a){try{if(!_[_0x3f28('0x19')](dials[_0x4f6a0a[_0x3f28('0x5')]])){utils['debug'](util[_0x3f28('0x3')](_0x3f28('0x2d'),_0x4f6a0a[_0x3f28('0x5')]),_0x4f6a0a);utils[_0x3f28('0x2')](util['format']('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x4f6a0a[_0x3f28('0x5')],_0x4f6a0a[_0x3f28('0x7')],_0x4f6a0a[_0x3f28('0x2e')],_0x4f6a0a['cause-txt']));dials[_0x4f6a0a['uniqueid']]=_['assign'](dials[_0x4f6a0a[_0x3f28('0x5')]],{'endtime':utils[_0x3f28('0x22')](),'lastevent':_0x3f28('0x2f')});dials[_0x4f6a0a['uniqueid']]['duration']=utils[_0x3f28('0x30')](dials[_0x4f6a0a[_0x3f28('0x5')]][_0x3f28('0x31')],dials[_0x4f6a0a[_0x3f28('0x5')]]['starttime']);dials[_0x4f6a0a[_0x3f28('0x5')]][_0x3f28('0x32')]=utils[_0x3f28('0x30')](dials[_0x4f6a0a[_0x3f28('0x5')]][_0x3f28('0x28')]||dials[_0x4f6a0a['uniqueid']][_0x3f28('0x31')],dials[_0x4f6a0a[_0x3f28('0x5')]][_0x3f28('0x21')]);dials[_0x4f6a0a[_0x3f28('0x5')]][_0x3f28('0x33')]=dials[_0x4f6a0a[_0x3f28('0x5')]]['answertime']?utils[_0x3f28('0x30')](dials[_0x4f6a0a['uniqueid']][_0x3f28('0x31')],dials[_0x4f6a0a[_0x3f28('0x5')]]['answertime']):0x0;writeDB(dials[_0x4f6a0a[_0x3f28('0x5')]]);}}catch(_0x37e753){utils[_0x3f28('0x16')](util['format'](_0x3f28('0x2d'),_0x4f6a0a[_0x3f28('0x5')]),_0x37e753);}}; \ No newline at end of file +var _0x7e18=['holdtime','billableseconds','./utils','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','dialstring','calleridnum','connectedlinenum','dialstatus','CreateVoiceDialReport','debug','info','application','toLowerCase','set','startsWith','split','error','[%s][dials][newexten]','varset','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','[%s][dials][varset]','[%s][dials][dialbegin]','assign','starttime','lastevent','[%s][dials][dialend]','answertime','now','connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','complete','duration','diffTime','endtime'];(function(_0x3e2559,_0x353b6d){var _0x57510c=function(_0xfc46b){while(--_0xfc46b){_0x3e2559['push'](_0x3e2559['shift']());}};_0x57510c(++_0x353b6d);}(_0x7e18,0x1c4));var _0x87e1=function(_0x5b3427,_0x369a7d){_0x5b3427=_0x5b3427-0x0;var _0x405b1b=_0x7e18[_0x5b3427];return _0x405b1b;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x87e1('0x0'));var dials={};function writeDB(_0x1a0eb7){utils['info'](util[_0x87e1('0x1')](_0x87e1('0x2'),_0x1a0eb7[_0x87e1('0x3')],_0x1a0eb7['channel'],_0x1a0eb7[_0x87e1('0x4')],_0x1a0eb7[_0x87e1('0x5')],_0x1a0eb7[_0x87e1('0x6')],_0x1a0eb7[_0x87e1('0x7')]));utils['request'](_0x87e1('0x8'),_0x1a0eb7);delete dials[_0x1a0eb7[_0x87e1('0x3')]];}exports['newexten']=function(_0x34621a){try{utils[_0x87e1('0x9')](util[_0x87e1('0x1')]('[%s][dials][newexten]',_0x34621a[_0x87e1('0x3')]),_0x34621a);utils[_0x87e1('0xa')](util['format']('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0x34621a['uniqueid'],_0x34621a[_0x87e1('0xb')],_0x34621a['appdata']));if(_0x34621a[_0x87e1('0xb')][_0x87e1('0xc')]()==_0x87e1('0xd')&&_[_0x87e1('0xe')](_0x34621a['appdata']['toLowerCase'](),'cdr(routeid)')){var _0x31f4e8=_0x34621a['appdata'][_0x87e1('0xf')]('=');dials[_0x34621a[_0x87e1('0x3')]]={'routeId':_0x31f4e8[0x1]};}}catch(_0x3a84c0){utils[_0x87e1('0x10')](util[_0x87e1('0x1')](_0x87e1('0x11'),_0x34621a[_0x87e1('0x3')]),_0x3a84c0);}};exports[_0x87e1('0x12')]=function(_0x5de390){try{utils[_0x87e1('0x9')](util[_0x87e1('0x1')]('[%s][dials][varset]',_0x5de390[_0x87e1('0x3')]),_0x5de390);if(!_[_0x87e1('0x13')](_0x5de390[_0x87e1('0x14')][_0x87e1('0x15')])){utils[_0x87e1('0xa')](util[_0x87e1('0x1')](_0x87e1('0x16'),_0x5de390[_0x87e1('0x3')],_0x5de390[_0x87e1('0x17')]));dials[_0x5de390[_0x87e1('0x3')]]={'routeId':_0x5de390[_0x87e1('0x17')]};}}catch(_0x86c22e){utils[_0x87e1('0x10')](util['format'](_0x87e1('0x18'),_0x5de390['uniqueid']),_0x86c22e);}};exports['dialbegin']=function(_0x4d7a0f){try{if(!_[_0x87e1('0x13')](dials[_0x4d7a0f[_0x87e1('0x3')]])){utils[_0x87e1('0x9')](util[_0x87e1('0x1')](_0x87e1('0x19'),_0x4d7a0f[_0x87e1('0x3')]),_0x4d7a0f);dials[_0x4d7a0f['uniqueid']]=_[_0x87e1('0x1a')](dials[_0x4d7a0f[_0x87e1('0x3')]],_0x4d7a0f);dials[_0x4d7a0f['uniqueid']][_0x87e1('0x1b')]=utils['now']();dials[_0x4d7a0f[_0x87e1('0x3')]][_0x87e1('0x1c')]='called';utils['info'](util['format']('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x4d7a0f[_0x87e1('0x3')],dials[_0x4d7a0f[_0x87e1('0x3')]]['starttime']));}}catch(_0x35e5a9){utils[_0x87e1('0x10')](util['format']('[%s][dials][dialbegin]',_0x4d7a0f['uniqueid']),_0x35e5a9);}};exports['dialend']=function(_0x106eb5){try{if(!_['isNil'](dials[_0x106eb5[_0x87e1('0x3')]])){utils['debug'](util[_0x87e1('0x1')](_0x87e1('0x1d'),_0x106eb5[_0x87e1('0x3')]),_0x106eb5);dials[_0x106eb5[_0x87e1('0x3')]][_0x87e1('0x7')]=_0x106eb5[_0x87e1('0x7')];if(_0x106eb5[_0x87e1('0x7')]=='ANSWER'){dials[_0x106eb5['uniqueid']]=_[_0x87e1('0x1a')](dials[_0x106eb5['uniqueid']],_0x106eb5);dials[_0x106eb5[_0x87e1('0x3')]][_0x87e1('0x1e')]=utils[_0x87e1('0x1f')]();dials[_0x106eb5[_0x87e1('0x3')]]['lastevent']=_0x87e1('0x20');utils['info'](util[_0x87e1('0x1')]('[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect',_0x106eb5['uniqueid'],_0x106eb5[_0x87e1('0x7')],dials[_0x106eb5[_0x87e1('0x3')]][_0x87e1('0x1e')]));}else{utils[_0x87e1('0xa')](util[_0x87e1('0x1')](_0x87e1('0x21'),_0x106eb5[_0x87e1('0x3')],_0x106eb5[_0x87e1('0x7')]));}}}catch(_0xcee9a1){utils['error'](util[_0x87e1('0x1')]('[%s][dials][dialend]',_0x106eb5[_0x87e1('0x3')]),_0xcee9a1);}};exports[_0x87e1('0x22')]=function(_0xd6586d){try{if(!_[_0x87e1('0x13')](dials[_0xd6586d[_0x87e1('0x3')]])){utils['debug'](util[_0x87e1('0x1')](_0x87e1('0x23'),_0xd6586d[_0x87e1('0x3')]),_0xd6586d);utils['info'](util['format'](_0x87e1('0x24'),_0xd6586d[_0x87e1('0x3')],_0xd6586d['calleridnum'],_0xd6586d[_0x87e1('0x25')],_0xd6586d[_0x87e1('0x26')]));dials[_0xd6586d[_0x87e1('0x3')]]=_['assign'](dials[_0xd6586d[_0x87e1('0x3')]],{'endtime':utils[_0x87e1('0x1f')](),'lastevent':_0x87e1('0x27')});dials[_0xd6586d[_0x87e1('0x3')]][_0x87e1('0x28')]=utils[_0x87e1('0x29')](dials[_0xd6586d[_0x87e1('0x3')]][_0x87e1('0x2a')],dials[_0xd6586d[_0x87e1('0x3')]]['starttime']);dials[_0xd6586d['uniqueid']][_0x87e1('0x2b')]=utils['diffTime'](dials[_0xd6586d[_0x87e1('0x3')]][_0x87e1('0x1e')]||dials[_0xd6586d[_0x87e1('0x3')]][_0x87e1('0x2a')],dials[_0xd6586d[_0x87e1('0x3')]][_0x87e1('0x1b')]);dials[_0xd6586d['uniqueid']][_0x87e1('0x2c')]=dials[_0xd6586d['uniqueid']][_0x87e1('0x1e')]?utils[_0x87e1('0x29')](dials[_0xd6586d['uniqueid']]['endtime'],dials[_0xd6586d['uniqueid']][_0x87e1('0x1e')]):0x0;writeDB(dials[_0xd6586d['uniqueid']]);}}catch(_0xd1141c){utils[_0x87e1('0x10')](util[_0x87e1('0x1')](_0x87e1('0x23'),_0xd6586d[_0x87e1('0x3')]),_0xd1141c);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 76e0861..e2d54b1 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 _0x8844=['[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s][index][dialend]','../../config/environment','./utils','util','asterisk','port','username','password','keepConnected','xdr','disabled','info','XDR\x20DISABLED','./agents.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','format','[%s][index][devicestatechange]','device','devicestatechange','agentcalled','debug','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','[%s][index][agentcomplete]','agentcomplete','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','[%s][index][newstate]','newstate','hangup','[%s][index][hangup]','[%s][index][cdr]','cdr','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel'];(function(_0x4717a5,_0x133cad){var _0xd3c128=function(_0x1150e3){while(--_0x1150e3){_0x4717a5['push'](_0x4717a5['shift']());}};_0xd3c128(++_0x133cad);}(_0x8844,0xcd));var _0x4884=function(_0x55af0d,_0x5db5c9){_0x55af0d=_0x55af0d-0x0;var _0x245085=_0x8844[_0x55af0d];return _0x245085;};var AsteriskManager=require('asterisk-manager');var config=require(_0x4884('0x0'));var utils=require(_0x4884('0x1'));var util=require(_0x4884('0x2'));var ami=new AsteriskManager(config[_0x4884('0x3')][_0x4884('0x4')],config[_0x4884('0x3')]['ip'],config[_0x4884('0x3')][_0x4884('0x5')],config['asterisk'][_0x4884('0x6')],!![]);ami[_0x4884('0x7')]();if(config[_0x4884('0x8')]&&config[_0x4884('0x8')][_0x4884('0x9')]){utils[_0x4884('0xa')](_0x4884('0xb'));}else{var agents=require(_0x4884('0xc'));var calls=require('./calls.controller');var queues=require('./queues.controller');var recordings=require(_0x4884('0xd'));var members=require(_0x4884('0xe'));var dials=require(_0x4884('0xf'));var transfers=require(_0x4884('0x10'));var core=require(_0x4884('0x11'));ami['on'](_0x4884('0x12'),core[_0x4884('0x12')]);ami['on']('shutdown',core[_0x4884('0x13')]);ami['on'](_0x4884('0x14'),core[_0x4884('0x14')]);ami['on'](_0x4884('0x15'),core[_0x4884('0x15')]);ami['on'](_0x4884('0x16'),core['close']);ami['on']('managerevent',core[_0x4884('0x17')]);ami['on']('devicestatechange',function(_0x1981ce){try{utils['debug'](util[_0x4884('0x18')](_0x4884('0x19'),_0x1981ce[_0x4884('0x1a')]),_0x1981ce);members[_0x4884('0x1b')](_0x1981ce);}catch(_0x22e221){utils[_0x4884('0x15')](util[_0x4884('0x18')](_0x4884('0x19'),_0x1981ce[_0x4884('0x1a')]),_0x22e221);}});ami['on'](_0x4884('0x1c'),function(_0xbf4f27){try{utils[_0x4884('0x1d')](util[_0x4884('0x18')](_0x4884('0x1e'),_0xbf4f27[_0x4884('0x1f')]),_0xbf4f27);agents[_0x4884('0x1c')](_0xbf4f27);}catch(_0x1ca2cc){utils[_0x4884('0x15')](util[_0x4884('0x18')](_0x4884('0x1e'),_0xbf4f27[_0x4884('0x1f')]),_0x1ca2cc);}});ami['on'](_0x4884('0x20'),function(_0x217c64){try{utils[_0x4884('0x1d')](util['format']('[%s][index][agentringnoanswer]',_0x217c64[_0x4884('0x1f')]),_0x217c64);agents[_0x4884('0x20')](_0x217c64);}catch(_0x418260){utils[_0x4884('0x15')](util[_0x4884('0x18')](_0x4884('0x21'),_0x217c64['uniqueid']),_0x418260);}});ami['on'](_0x4884('0x22'),function(_0x2a28aa){try{utils[_0x4884('0x1d')](util['format'](_0x4884('0x23'),_0x2a28aa[_0x4884('0x1f')]),_0x2a28aa);agents[_0x4884('0x22')](_0x2a28aa);queues[_0x4884('0x22')](_0x2a28aa);}catch(_0x5ef788){utils[_0x4884('0x15')](util[_0x4884('0x18')](_0x4884('0x23'),_0x2a28aa[_0x4884('0x1f')]),_0x5ef788);}});ami['on']('agentcomplete',function(_0x35bb7f){try{utils[_0x4884('0x1d')](util[_0x4884('0x18')](_0x4884('0x24'),_0x35bb7f['uniqueid']),_0x35bb7f);agents['agentcomplete'](_0x35bb7f);queues['agentcomplete'](_0x35bb7f);members[_0x4884('0x25')](_0x35bb7f);}catch(_0x40b58c){utils[_0x4884('0x15')](util['format'](_0x4884('0x24'),_0x35bb7f[_0x4884('0x1f')]),_0x40b58c);}});ami['on']('queuecallerabandon',function(_0x131f27){try{utils[_0x4884('0x1d')](util[_0x4884('0x18')](_0x4884('0x26'),_0x131f27['uniqueid']),_0x131f27);agents['queuecallerabandon'](_0x131f27);queues['queuecallerabandon'](_0x131f27);}catch(_0x159222){utils[_0x4884('0x15')](util[_0x4884('0x18')](_0x4884('0x26'),_0x131f27[_0x4884('0x1f')]),_0x159222);}});ami['on'](_0x4884('0x27'),function(_0x245322){try{utils[_0x4884('0x1d')](util[_0x4884('0x18')](_0x4884('0x28'),_0x245322[_0x4884('0x1f')]),_0x245322);queues[_0x4884('0x27')](_0x245322);recordings[_0x4884('0x27')](_0x245322);}catch(_0x272c5b){utils[_0x4884('0x15')](util['format'](_0x4884('0x28'),_0x245322[_0x4884('0x1f')]),_0x272c5b);}});ami['on'](_0x4884('0x29'),function(_0xaf8a){try{utils[_0x4884('0x1d')](util[_0x4884('0x18')](_0x4884('0x2a'),_0xaf8a[_0x4884('0x1f')]),_0xaf8a);queues[_0x4884('0x29')](_0xaf8a);}catch(_0x1014f8){utils[_0x4884('0x15')](util[_0x4884('0x18')](_0x4884('0x2a'),_0xaf8a['uniqueid']),_0x1014f8);}});ami['on'](_0x4884('0x2b'),function(_0x38f488){try{utils[_0x4884('0x1d')](util[_0x4884('0x18')]('[%s][index][musiconholdstart]',_0x38f488[_0x4884('0x1f')]),_0x38f488);queues[_0x4884('0x2b')](_0x38f488);calls[_0x4884('0x2b')](_0x38f488);}catch(_0x2ce6b3){utils[_0x4884('0x15')](util[_0x4884('0x18')](_0x4884('0x2c'),_0x38f488['uniqueid']),_0x2ce6b3);}});ami['on'](_0x4884('0x2d'),function(_0x2bf6f9){try{utils[_0x4884('0x1d')](util[_0x4884('0x18')](_0x4884('0x2e'),_0x2bf6f9[_0x4884('0x1f')]),_0x2bf6f9);queues[_0x4884('0x2d')](_0x2bf6f9);calls[_0x4884('0x2d')](_0x2bf6f9);}catch(_0x18ed02){utils[_0x4884('0x15')](util['format'](_0x4884('0x2e'),_0x2bf6f9[_0x4884('0x1f')]),_0x18ed02);}});ami['on']('newstate',function(_0x592014){try{utils['debug'](util['format'](_0x4884('0x2f'),_0x592014[_0x4884('0x1f')]),_0x592014);calls[_0x4884('0x30')](_0x592014);recordings[_0x4884('0x30')](_0x592014);}catch(_0x51c179){utils['error'](util[_0x4884('0x18')]('[%s][index][newstate]',_0x592014[_0x4884('0x1f')]),_0x51c179);}});ami['on'](_0x4884('0x31'),function(_0x2459c5){try{utils[_0x4884('0x1d')](util[_0x4884('0x18')](_0x4884('0x32'),_0x2459c5[_0x4884('0x1f')]),_0x2459c5);calls[_0x4884('0x31')](_0x2459c5);recordings[_0x4884('0x31')](_0x2459c5);dials['hangup'](_0x2459c5);agents[_0x4884('0x31')](_0x2459c5);queues[_0x4884('0x31')](_0x2459c5);}catch(_0x2104a9){utils[_0x4884('0x15')](util[_0x4884('0x18')]('[%s][index][hangup]',_0x2459c5[_0x4884('0x1f')]),_0x2104a9);}});ami['on']('cdr',function(_0x538ca9){try{utils[_0x4884('0x1d')](util[_0x4884('0x18')](_0x4884('0x33'),_0x538ca9[_0x4884('0x1f')]),_0x538ca9);members[_0x4884('0x34')](_0x538ca9);}catch(_0x2e8bc1){utils['error'](util[_0x4884('0x18')](_0x4884('0x33'),_0x538ca9[_0x4884('0x1f')]),_0x2e8bc1);}});ami['on'](_0x4884('0x35'),function(_0x312f90){try{utils[_0x4884('0x1d')](util[_0x4884('0x18')]('[%s][index][blindtransfer]',_0x312f90[_0x4884('0x1f')]),_0x312f90);queues[_0x4884('0x35')](_0x312f90);agents[_0x4884('0x35')](_0x312f90);transfers['blindtransfer'](_0x312f90);recordings['blindtransfer'](_0x312f90);}catch(_0x193fc0){utils['error'](util['format'](_0x4884('0x36'),_0x312f90[_0x4884('0x1f')]),_0x193fc0);}});ami['on'](_0x4884('0x37'),function(_0x4c3b99){try{utils[_0x4884('0x1d')](util[_0x4884('0x18')](_0x4884('0x38'),_0x4c3b99['origtransfereruniqueid']),_0x4c3b99);queues[_0x4884('0x37')](_0x4c3b99);transfers['attendedtransfer'](_0x4c3b99);agents[_0x4884('0x37')](_0x4c3b99);calls[_0x4884('0x37')](_0x4c3b99);}catch(_0x313820){utils[_0x4884('0x15')](util[_0x4884('0x18')](_0x4884('0x38'),_0x4c3b99[_0x4884('0x39')]),_0x313820);}});ami['on'](_0x4884('0x3a'),function(_0x33b35b){try{utils[_0x4884('0x1d')](util[_0x4884('0x18')](_0x4884('0x3b'),_0x33b35b[_0x4884('0x1f')]),_0x33b35b);queues[_0x4884('0x3a')](_0x33b35b);recordings[_0x4884('0x3a')](_0x33b35b);calls[_0x4884('0x3a')](_0x33b35b);dials[_0x4884('0x3a')](_0x33b35b);}catch(_0x329150){utils['error'](util[_0x4884('0x18')](_0x4884('0x3b'),_0x33b35b[_0x4884('0x1f')]),_0x329150);}});ami['on'](_0x4884('0x3c'),function(_0x4f1eab){try{utils[_0x4884('0x1d')](util['format'](_0x4884('0x3d'),_0x4f1eab['uniqueid']),_0x4f1eab);calls['newexten'](_0x4f1eab);recordings[_0x4884('0x3c')](_0x4f1eab);dials[_0x4884('0x3c')](_0x4f1eab);}catch(_0x211553){utils[_0x4884('0x15')](util['format'](_0x4884('0x3d'),_0x4f1eab[_0x4884('0x1f')]),_0x211553);}});ami['on'](_0x4884('0x3e'),function(_0x5119c5){try{utils[_0x4884('0x1d')](util[_0x4884('0x18')](_0x4884('0x3f'),_0x5119c5[_0x4884('0x1f')]),_0x5119c5);calls[_0x4884('0x3e')](_0x5119c5);recordings[_0x4884('0x3e')](_0x5119c5);}catch(_0x504c76){utils[_0x4884('0x15')](util[_0x4884('0x18')](_0x4884('0x3f'),_0x5119c5[_0x4884('0x1f')]),_0x504c76);}});ami['on'](_0x4884('0x40'),function(_0x18cbe6){try{utils[_0x4884('0x1d')](util[_0x4884('0x18')](_0x4884('0x41'),_0x18cbe6[_0x4884('0x1f')]),_0x18cbe6);dials['dialbegin'](_0x18cbe6);}catch(_0x3c8398){utils['error'](util[_0x4884('0x18')]('[%s]dialbegin',_0x18cbe6[_0x4884('0x1f')]),_0x3c8398);}});ami['on']('dialend',function(_0xeda8aa){try{utils[_0x4884('0x1d')](util[_0x4884('0x18')](_0x4884('0x42'),_0xeda8aa['uniqueid']),_0xeda8aa);dials['dialend'](_0xeda8aa);}catch(_0x3c2128){utils[_0x4884('0x15')](util[_0x4884('0x18')]('[%s][index][dialend]',_0xeda8aa[_0x4884('0x1f')]),_0x3c2128);}});} \ No newline at end of file +var _0x3bc8=['util','asterisk','port','keepConnected','xdr','./agents.controller','./queues.controller','./recordings.controller','./members.controller','./transfers.controller','connect','shutdown','fullybooted','error','managerevent','devicestatechange','format','[%s][index][devicestatechange]','device','agentcalled','debug','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','[%s][index][agentcomplete]','agentcomplete','queuecallerabandon','[%s][index][queuecallerabandon]','[%s][index][queuecallerjoin]','queuecallerjoin','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','[%s][index][newstate]','newstate','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','dialend','[%s][index][dialend]','./utils'];(function(_0x34803d,_0x33076d){var _0x263c48=function(_0x3d4d5c){while(--_0x3d4d5c){_0x34803d['push'](_0x34803d['shift']());}};_0x263c48(++_0x33076d);}(_0x3bc8,0x12b));var _0x83bc=function(_0x31cb77,_0x348021){_0x31cb77=_0x31cb77-0x0;var _0x710374=_0x3bc8[_0x31cb77];return _0x710374;};var AsteriskManager=require('asterisk-manager');var config=require('../../config/environment');var utils=require(_0x83bc('0x0'));var util=require(_0x83bc('0x1'));var ami=new AsteriskManager(config[_0x83bc('0x2')][_0x83bc('0x3')],config[_0x83bc('0x2')]['ip'],config[_0x83bc('0x2')]['username'],config[_0x83bc('0x2')]['password'],!![]);ami[_0x83bc('0x4')]();if(config[_0x83bc('0x5')]&&config[_0x83bc('0x5')]['disabled']){utils['info']('XDR\x20DISABLED');}else{var agents=require(_0x83bc('0x6'));var calls=require('./calls.controller');var queues=require(_0x83bc('0x7'));var recordings=require(_0x83bc('0x8'));var members=require(_0x83bc('0x9'));var dials=require('./dials.controller');var transfers=require(_0x83bc('0xa'));var core=require('./core.controller');ami['on'](_0x83bc('0xb'),core[_0x83bc('0xb')]);ami['on'](_0x83bc('0xc'),core[_0x83bc('0xc')]);ami['on'](_0x83bc('0xd'),core[_0x83bc('0xd')]);ami['on'](_0x83bc('0xe'),core[_0x83bc('0xe')]);ami['on']('close',core['close']);ami['on'](_0x83bc('0xf'),core[_0x83bc('0xf')]);ami['on'](_0x83bc('0x10'),function(_0x5746d4){try{utils['debug'](util[_0x83bc('0x11')](_0x83bc('0x12'),_0x5746d4[_0x83bc('0x13')]),_0x5746d4);members[_0x83bc('0x10')](_0x5746d4);}catch(_0x5d21ab){utils[_0x83bc('0xe')](util[_0x83bc('0x11')](_0x83bc('0x12'),_0x5746d4['device']),_0x5d21ab);}});ami['on'](_0x83bc('0x14'),function(_0x3352a8){try{utils[_0x83bc('0x15')](util[_0x83bc('0x11')](_0x83bc('0x16'),_0x3352a8['uniqueid']),_0x3352a8);agents[_0x83bc('0x14')](_0x3352a8);}catch(_0x58c8de){utils[_0x83bc('0xe')](util[_0x83bc('0x11')](_0x83bc('0x16'),_0x3352a8[_0x83bc('0x17')]),_0x58c8de);}});ami['on'](_0x83bc('0x18'),function(_0x37d38d){try{utils[_0x83bc('0x15')](util[_0x83bc('0x11')](_0x83bc('0x19'),_0x37d38d[_0x83bc('0x17')]),_0x37d38d);agents['agentringnoanswer'](_0x37d38d);}catch(_0x26c89b){utils[_0x83bc('0xe')](util['format'](_0x83bc('0x19'),_0x37d38d[_0x83bc('0x17')]),_0x26c89b);}});ami['on'](_0x83bc('0x1a'),function(_0xd86a29){try{utils[_0x83bc('0x15')](util['format'](_0x83bc('0x1b'),_0xd86a29[_0x83bc('0x17')]),_0xd86a29);agents[_0x83bc('0x1a')](_0xd86a29);queues['agentconnect'](_0xd86a29);}catch(_0x3f0d2f){utils[_0x83bc('0xe')](util[_0x83bc('0x11')](_0x83bc('0x1b'),_0xd86a29[_0x83bc('0x17')]),_0x3f0d2f);}});ami['on']('agentcomplete',function(_0x1033d9){try{utils['debug'](util[_0x83bc('0x11')](_0x83bc('0x1c'),_0x1033d9[_0x83bc('0x17')]),_0x1033d9);agents[_0x83bc('0x1d')](_0x1033d9);queues[_0x83bc('0x1d')](_0x1033d9);members[_0x83bc('0x1d')](_0x1033d9);}catch(_0x273099){utils[_0x83bc('0xe')](util[_0x83bc('0x11')]('[%s][index][agentcomplete]',_0x1033d9[_0x83bc('0x17')]),_0x273099);}});ami['on'](_0x83bc('0x1e'),function(_0x47d198){try{utils['debug'](util['format']('[%s][index][queuecallerabandon]',_0x47d198['uniqueid']),_0x47d198);agents[_0x83bc('0x1e')](_0x47d198);queues[_0x83bc('0x1e')](_0x47d198);}catch(_0x3f6e3f){utils[_0x83bc('0xe')](util[_0x83bc('0x11')](_0x83bc('0x1f'),_0x47d198[_0x83bc('0x17')]),_0x3f6e3f);}});ami['on']('queuecallerjoin',function(_0x432b5a){try{utils[_0x83bc('0x15')](util[_0x83bc('0x11')](_0x83bc('0x20'),_0x432b5a[_0x83bc('0x17')]),_0x432b5a);queues[_0x83bc('0x21')](_0x432b5a);recordings[_0x83bc('0x21')](_0x432b5a);}catch(_0x3cd389){utils[_0x83bc('0xe')](util[_0x83bc('0x11')]('[%s][index][queuecallerjoin]',_0x432b5a[_0x83bc('0x17')]),_0x3cd389);}});ami['on'](_0x83bc('0x22'),function(_0x1a51e0){try{utils[_0x83bc('0x15')](util[_0x83bc('0x11')](_0x83bc('0x23'),_0x1a51e0['uniqueid']),_0x1a51e0);queues[_0x83bc('0x22')](_0x1a51e0);}catch(_0xa0f008){utils[_0x83bc('0xe')](util['format'](_0x83bc('0x23'),_0x1a51e0[_0x83bc('0x17')]),_0xa0f008);}});ami['on'](_0x83bc('0x24'),function(_0x36bdc0){try{utils['debug'](util[_0x83bc('0x11')](_0x83bc('0x25'),_0x36bdc0['uniqueid']),_0x36bdc0);queues[_0x83bc('0x24')](_0x36bdc0);calls['musiconholdstart'](_0x36bdc0);}catch(_0x4f90c5){utils[_0x83bc('0xe')](util[_0x83bc('0x11')]('[%s][index][musiconholdstart]',_0x36bdc0[_0x83bc('0x17')]),_0x4f90c5);}});ami['on'](_0x83bc('0x26'),function(_0x212df1){try{utils[_0x83bc('0x15')](util[_0x83bc('0x11')](_0x83bc('0x27'),_0x212df1[_0x83bc('0x17')]),_0x212df1);queues[_0x83bc('0x26')](_0x212df1);calls['musiconholdstop'](_0x212df1);}catch(_0x64f638){utils[_0x83bc('0xe')](util['format']('[%s][index][musiconholdstop]',_0x212df1[_0x83bc('0x17')]),_0x64f638);}});ami['on']('newstate',function(_0x1d7592){try{utils[_0x83bc('0x15')](util[_0x83bc('0x11')](_0x83bc('0x28'),_0x1d7592[_0x83bc('0x17')]),_0x1d7592);calls[_0x83bc('0x29')](_0x1d7592);recordings[_0x83bc('0x29')](_0x1d7592);}catch(_0x326ddc){utils['error'](util[_0x83bc('0x11')](_0x83bc('0x28'),_0x1d7592[_0x83bc('0x17')]),_0x326ddc);}});ami['on'](_0x83bc('0x2a'),function(_0x3d1313){try{utils[_0x83bc('0x15')](util['format']('[%s][index][hangup]',_0x3d1313[_0x83bc('0x17')]),_0x3d1313);calls[_0x83bc('0x2a')](_0x3d1313);recordings[_0x83bc('0x2a')](_0x3d1313);dials[_0x83bc('0x2a')](_0x3d1313);agents[_0x83bc('0x2a')](_0x3d1313);queues[_0x83bc('0x2a')](_0x3d1313);}catch(_0x5f130f){utils[_0x83bc('0xe')](util[_0x83bc('0x11')](_0x83bc('0x2b'),_0x3d1313['uniqueid']),_0x5f130f);}});ami['on'](_0x83bc('0x2c'),function(_0x49f285){try{utils[_0x83bc('0x15')](util[_0x83bc('0x11')]('[%s][index][cdr]',_0x49f285[_0x83bc('0x17')]),_0x49f285);members[_0x83bc('0x2c')](_0x49f285);}catch(_0xfc7913){utils['error'](util[_0x83bc('0x11')](_0x83bc('0x2d'),_0x49f285[_0x83bc('0x17')]),_0xfc7913);}});ami['on'](_0x83bc('0x2e'),function(_0x50721f){try{utils['debug'](util[_0x83bc('0x11')]('[%s][index][blindtransfer]',_0x50721f['uniqueid']),_0x50721f);queues[_0x83bc('0x2e')](_0x50721f);agents[_0x83bc('0x2e')](_0x50721f);transfers[_0x83bc('0x2e')](_0x50721f);recordings[_0x83bc('0x2e')](_0x50721f);}catch(_0x5064b6){utils[_0x83bc('0xe')](util[_0x83bc('0x11')](_0x83bc('0x2f'),_0x50721f[_0x83bc('0x17')]),_0x5064b6);}});ami['on'](_0x83bc('0x30'),function(_0x32a593){try{utils[_0x83bc('0x15')](util[_0x83bc('0x11')](_0x83bc('0x31'),_0x32a593[_0x83bc('0x32')]),_0x32a593);queues[_0x83bc('0x30')](_0x32a593);transfers[_0x83bc('0x30')](_0x32a593);agents[_0x83bc('0x30')](_0x32a593);calls[_0x83bc('0x30')](_0x32a593);}catch(_0x2960c8){utils[_0x83bc('0xe')](util[_0x83bc('0x11')](_0x83bc('0x31'),_0x32a593[_0x83bc('0x32')]),_0x2960c8);}});ami['on'](_0x83bc('0x33'),function(_0x1c70ec){try{utils[_0x83bc('0x15')](util[_0x83bc('0x11')](_0x83bc('0x34'),_0x1c70ec[_0x83bc('0x17')]),_0x1c70ec);queues[_0x83bc('0x33')](_0x1c70ec);recordings['varset'](_0x1c70ec);calls[_0x83bc('0x33')](_0x1c70ec);dials['varset'](_0x1c70ec);}catch(_0x500d4c){utils[_0x83bc('0xe')](util[_0x83bc('0x11')](_0x83bc('0x34'),_0x1c70ec['uniqueid']),_0x500d4c);}});ami['on'](_0x83bc('0x35'),function(_0xef05b6){try{utils[_0x83bc('0x15')](util[_0x83bc('0x11')](_0x83bc('0x36'),_0xef05b6[_0x83bc('0x17')]),_0xef05b6);calls[_0x83bc('0x35')](_0xef05b6);recordings[_0x83bc('0x35')](_0xef05b6);dials['newexten'](_0xef05b6);}catch(_0x394753){utils[_0x83bc('0xe')](util['format'](_0x83bc('0x36'),_0xef05b6['uniqueid']),_0x394753);}});ami['on'](_0x83bc('0x37'),function(_0x47553a){try{utils[_0x83bc('0x15')](util[_0x83bc('0x11')]('[%s][index][newchannel]',_0x47553a[_0x83bc('0x17')]),_0x47553a);calls['newchannel'](_0x47553a);recordings[_0x83bc('0x37')](_0x47553a);}catch(_0x88e1fc){utils['error'](util[_0x83bc('0x11')](_0x83bc('0x38'),_0x47553a[_0x83bc('0x17')]),_0x88e1fc);}});ami['on'](_0x83bc('0x39'),function(_0x5bbfd0){try{utils['debug'](util['format']('[%s][index][dialbegin]',_0x5bbfd0[_0x83bc('0x17')]),_0x5bbfd0);dials[_0x83bc('0x39')](_0x5bbfd0);}catch(_0x3a7895){utils['error'](util['format']('[%s]dialbegin',_0x5bbfd0['uniqueid']),_0x3a7895);}});ami['on'](_0x83bc('0x3a'),function(_0x36e87c){try{utils[_0x83bc('0x15')](util['format'](_0x83bc('0x3b'),_0x36e87c[_0x83bc('0x17')]),_0x36e87c);dials[_0x83bc('0x3a')](_0x36e87c);}catch(_0x151a82){utils[_0x83bc('0xe')](util['format'](_0x83bc('0x3b'),_0x36e87c[_0x83bc('0x17')]),_0x151a82);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index abd2a80..3ed85ea 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 _0x155d=['membername','type','interface','getUserByInterface','then','internal','request','CreateMemberReport','getUserByName','split','name','catch','[%s][members][writeDB]','some','startsWith','devicestatechange','debug','format','device','uniqueid','state','INUSE','voice','TALKING','now','NOT_INUSE','exitAt','diffTime','error','agentcomplete','isNil','[%s][members][agentcomplete]','queue','[%s][members][cdr]','assign','data1','source','data3','destination','destinationchannel','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','lodash','util','./utils','Local/_attended@transfer','info','channel','data2'];(function(_0x5ddaac,_0x2697a8){var _0x2a9c58=function(_0x851032){while(--_0x851032){_0x5ddaac['push'](_0x5ddaac['shift']());}};_0x2a9c58(++_0x2697a8);}(_0x155d,0x89));var _0xd155=function(_0x3bab09,_0x217c29){_0x3bab09=_0x3bab09-0x0;var _0x164376=_0x155d[_0x3bab09];return _0x164376;};'use strict';var _=require(_0xd155('0x0'));var util=require(_0xd155('0x1'));var utils=require(_0xd155('0x2'));var members={};var exclude=[_0xd155('0x3'),'Queue:'];function writeDB(_0x2526f7){utils[_0xd155('0x4')](util['format']('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x2526f7['uniqueid'],_0x2526f7['interface'],_0x2526f7[_0xd155('0x5')],_0x2526f7[_0xd155('0x6')],_0x2526f7[_0xd155('0x7')],_0x2526f7[_0xd155('0x8')]));if(_0x2526f7[_0xd155('0x9')]){utils[_0xd155('0xa')](_0x2526f7[_0xd155('0x9')])[_0xd155('0xb')](function(_0x288f54){if(_0x288f54){_0x2526f7[_0xd155('0x7')]=_0x288f54['name'];_0x2526f7[_0xd155('0xc')]=_0x288f54['internal'];utils[_0xd155('0xd')](_0xd155('0xe'),_0x2526f7);}else{utils[_0xd155('0xf')](_0x2526f7[_0xd155('0x9')][_0xd155('0x10')]('/')[0x1])[_0xd155('0xb')](function(_0x1e56be){if(_0x1e56be){_0x2526f7[_0xd155('0x7')]=_0x1e56be[_0xd155('0x11')];_0x2526f7[_0xd155('0xc')]=_0x1e56be[_0xd155('0xc')];utils[_0xd155('0xd')]('CreateMemberReport',_0x2526f7);}});}})[_0xd155('0x12')](function(_0x101285){utils['error'](util['format'](_0xd155('0x13'),_0x2526f7['uniqueid']),_0x101285);});}delete members[_0x2526f7['interface']];}function startsWith(_0xb37166,_0x3195e8){return _[_0xd155('0x14')](_0xb37166,function(_0x39d2e6){return _[_0xd155('0x15')](_0x3195e8,_0x39d2e6);});}exports[_0xd155('0x16')]=function(_0x111445){try{utils[_0xd155('0x17')](util[_0xd155('0x18')]('[%s][members][devicestatechange]',members[_0x111445[_0xd155('0x19')]]?members[_0x111445['device']]['uniqueid']:_0x111445[_0xd155('0x19')]),_0x111445);utils[_0xd155('0x4')](util[_0xd155('0x18')]('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x111445[_0xd155('0x19')]]?members[_0x111445[_0xd155('0x19')]][_0xd155('0x1a')]:_0x111445[_0xd155('0x19')],_0x111445[_0xd155('0x1b')],_0x111445[_0xd155('0x19')]));switch(_0x111445[_0xd155('0x1b')]){case _0xd155('0x1c'):case'BUSY':if(!startsWith(exclude,_0x111445[_0xd155('0x19')])){members[_0x111445[_0xd155('0x19')]]={'channel':_0xd155('0x1d'),'interface':_0x111445[_0xd155('0x19')],'type':_0xd155('0x1e'),'enterAt':utils[_0xd155('0x1f')](),'role':'agent'};}break;case _0xd155('0x20'):if(!_['isNil'](members[_0x111445[_0xd155('0x19')]])){members[_0x111445[_0xd155('0x19')]][_0xd155('0x21')]=utils[_0xd155('0x1f')]();members[_0x111445['device']]['duration']=utils[_0xd155('0x22')](members[_0x111445[_0xd155('0x19')]][_0xd155('0x21')],members[_0x111445[_0xd155('0x19')]]['enterAt']);if(members[_0x111445[_0xd155('0x19')]][_0xd155('0x1a')]){writeDB(members[_0x111445[_0xd155('0x19')]]);}}break;default:break;}}catch(_0x1f243c){utils[_0xd155('0x23')](util[_0xd155('0x18')]('[%s][members][devicestatechange]',members[_0x111445['device']]?members[_0x111445[_0xd155('0x19')]][_0xd155('0x1a')]:_0x111445[_0xd155('0x19')]),_0x1f243c);}};exports[_0xd155('0x24')]=function(_0x49f513){try{if(!_[_0xd155('0x25')](members[_0x49f513['interface']])){utils[_0xd155('0x17')](util['format'](_0xd155('0x26'),_0x49f513[_0xd155('0x1a')]),_0x49f513);utils['info'](util[_0xd155('0x18')]('[%s][members][agentcomplete]\x20interface:%s\x20queue:%s',_0x49f513[_0xd155('0x1a')],_0x49f513[_0xd155('0x9')],_0x49f513[_0xd155('0x27')]));members[_0x49f513[_0xd155('0x9')]]=_['assign'](members[_0x49f513[_0xd155('0x9')]],{'data4':_0x49f513['queue'],'uniqueid':_0x49f513[_0xd155('0x1a')]});}}catch(_0x49d400){utils['error'](util[_0xd155('0x18')]('[%s][members][agentcomplete]',_0x49f513[_0xd155('0x1a')]),_0x49d400);}};exports['cdr']=function(_0x358af8){try{utils[_0xd155('0x17')](util[_0xd155('0x18')](_0xd155('0x28'),_0x358af8['uniqueid']),_0x358af8);if(_0x358af8[_0xd155('0x5')]){var _0x24f45e=_0x358af8[_0xd155('0x5')][_0xd155('0x10')]('-')[0x0];if(!_[_0xd155('0x25')](members[_0x24f45e])){members[_0x24f45e]=_[_0xd155('0x29')](members[_0x24f45e],{'data1':members[_0x24f45e][_0xd155('0x2a')]||_0x358af8[_0xd155('0x8')],'data2':members[_0x24f45e][_0xd155('0x6')]||_0x358af8[_0xd155('0x2b')],'data3':members[_0x24f45e][_0xd155('0x2c')]||_0x358af8[_0xd155('0x2d')],'uniqueid':members[_0x24f45e]['uniqueid']||_0x358af8[_0xd155('0x1a')]});utils[_0xd155('0x4')](util[_0xd155('0x18')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x358af8[_0xd155('0x1a')],members[_0x24f45e][_0xd155('0x2a')],members[_0x24f45e][_0xd155('0x6')],members[_0x24f45e]['data3']));if(members[_0x24f45e][_0xd155('0x21')]){writeDB(members[_0x24f45e]);}}}if(_0x358af8[_0xd155('0x2e')]){var _0x361c8a=_0x358af8['destinationchannel'][_0xd155('0x10')]('-')[0x0];if(!_[_0xd155('0x25')](members[_0x361c8a])){members[_0x361c8a]=_[_0xd155('0x29')](members[_0x361c8a],{'data1':members[_0x361c8a][_0xd155('0x2a')]||_0x358af8[_0xd155('0x8')],'data2':members[_0x361c8a][_0xd155('0x6')]||_0x358af8[_0xd155('0x2b')],'data3':members[_0x361c8a]['data3']||_0x358af8[_0xd155('0x2d')],'uniqueid':members[_0x361c8a][_0xd155('0x1a')]||_0x358af8[_0xd155('0x1a')]});utils[_0xd155('0x4')](util['format'](_0xd155('0x2f'),_0x358af8[_0xd155('0x1a')],members[_0x361c8a][_0xd155('0x2a')],members[_0x361c8a]['data2'],members[_0x361c8a]['data3']));if(members[_0x361c8a][_0xd155('0x21')]){writeDB(members[_0x361c8a]);}}}}catch(_0x581648){utils[_0xd155('0x23')](util[_0xd155('0x18')](_0xd155('0x28'),_0x358af8[_0xd155('0x1a')]),_0x581648);}}; \ No newline at end of file +var _0x0c02=['info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','data2','membername','then','name','internal','catch','error','[%s][members][writeDB]','startsWith','devicestatechange','debug','device','state','INUSE','BUSY','voice','TALKING','now','NOT_INUSE','isNil','exitAt','diffTime','enterAt','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','cdr','[%s][members][cdr]','split','data1','type','destination','destinationchannel','source','data3','util','./utils','Queue:'];(function(_0xd12308,_0x1b58df){var _0x5739ca=function(_0x30db88){while(--_0x30db88){_0xd12308['push'](_0xd12308['shift']());}};_0x5739ca(++_0x1b58df);}(_0x0c02,0x84));var _0x20c0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0c02[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x20c0('0x0'));var utils=require(_0x20c0('0x1'));var members={};var exclude=['Local/_attended@transfer',_0x20c0('0x2')];function writeDB(_0x5c8750){utils[_0x20c0('0x3')](util[_0x20c0('0x4')](_0x20c0('0x5'),_0x5c8750[_0x20c0('0x6')],_0x5c8750[_0x20c0('0x7')],_0x5c8750[_0x20c0('0x8')],_0x5c8750[_0x20c0('0x9')],_0x5c8750[_0x20c0('0xa')],_0x5c8750['type']));if(_0x5c8750['interface']){utils['getUserByInterface'](_0x5c8750['interface'])[_0x20c0('0xb')](function(_0x276e9b){if(_0x276e9b){_0x5c8750[_0x20c0('0xa')]=_0x276e9b[_0x20c0('0xc')];_0x5c8750[_0x20c0('0xd')]=_0x276e9b[_0x20c0('0xd')];utils['request']('CreateMemberReport',_0x5c8750);}else{utils['getUserByName'](_0x5c8750['interface']['split']('/')[0x1])[_0x20c0('0xb')](function(_0x1ee433){if(_0x1ee433){_0x5c8750[_0x20c0('0xa')]=_0x1ee433[_0x20c0('0xc')];_0x5c8750['internal']=_0x1ee433[_0x20c0('0xd')];utils['request']('CreateMemberReport',_0x5c8750);}});}})[_0x20c0('0xe')](function(_0xfc2d9c){utils[_0x20c0('0xf')](util[_0x20c0('0x4')](_0x20c0('0x10'),_0x5c8750[_0x20c0('0x6')]),_0xfc2d9c);});}delete members[_0x5c8750[_0x20c0('0x7')]];}function startsWith(_0x105839,_0x280aff){return _['some'](_0x105839,function(_0xd80b64){return _[_0x20c0('0x11')](_0x280aff,_0xd80b64);});}exports[_0x20c0('0x12')]=function(_0x46b9e5){try{utils[_0x20c0('0x13')](util[_0x20c0('0x4')]('[%s][members][devicestatechange]',members[_0x46b9e5['device']]?members[_0x46b9e5['device']][_0x20c0('0x6')]:_0x46b9e5[_0x20c0('0x14')]),_0x46b9e5);utils[_0x20c0('0x3')](util[_0x20c0('0x4')]('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x46b9e5[_0x20c0('0x14')]]?members[_0x46b9e5[_0x20c0('0x14')]][_0x20c0('0x6')]:_0x46b9e5['device'],_0x46b9e5['state'],_0x46b9e5[_0x20c0('0x14')]));switch(_0x46b9e5[_0x20c0('0x15')]){case _0x20c0('0x16'):case _0x20c0('0x17'):if(!startsWith(exclude,_0x46b9e5[_0x20c0('0x14')])){members[_0x46b9e5['device']]={'channel':_0x20c0('0x18'),'interface':_0x46b9e5[_0x20c0('0x14')],'type':_0x20c0('0x19'),'enterAt':utils[_0x20c0('0x1a')](),'role':'agent'};}break;case _0x20c0('0x1b'):if(!_[_0x20c0('0x1c')](members[_0x46b9e5[_0x20c0('0x14')]])){members[_0x46b9e5[_0x20c0('0x14')]][_0x20c0('0x1d')]=utils[_0x20c0('0x1a')]();members[_0x46b9e5[_0x20c0('0x14')]]['duration']=utils[_0x20c0('0x1e')](members[_0x46b9e5[_0x20c0('0x14')]][_0x20c0('0x1d')],members[_0x46b9e5[_0x20c0('0x14')]][_0x20c0('0x1f')]);if(members[_0x46b9e5[_0x20c0('0x14')]]['uniqueid']){writeDB(members[_0x46b9e5['device']]);}}break;default:break;}}catch(_0x3012d5){utils[_0x20c0('0xf')](util[_0x20c0('0x4')]('[%s][members][devicestatechange]',members[_0x46b9e5[_0x20c0('0x14')]]?members[_0x46b9e5[_0x20c0('0x14')]][_0x20c0('0x6')]:_0x46b9e5[_0x20c0('0x14')]),_0x3012d5);}};exports['agentcomplete']=function(_0x49b738){try{if(!_[_0x20c0('0x1c')](members[_0x49b738[_0x20c0('0x7')]])){utils[_0x20c0('0x13')](util[_0x20c0('0x4')](_0x20c0('0x20'),_0x49b738[_0x20c0('0x6')]),_0x49b738);utils[_0x20c0('0x3')](util[_0x20c0('0x4')](_0x20c0('0x21'),_0x49b738[_0x20c0('0x6')],_0x49b738[_0x20c0('0x7')],_0x49b738[_0x20c0('0x22')]));members[_0x49b738[_0x20c0('0x7')]]=_[_0x20c0('0x23')](members[_0x49b738['interface']],{'data4':_0x49b738[_0x20c0('0x22')],'uniqueid':_0x49b738[_0x20c0('0x6')]});}}catch(_0x341076){utils[_0x20c0('0xf')](util['format'](_0x20c0('0x20'),_0x49b738[_0x20c0('0x6')]),_0x341076);}};exports[_0x20c0('0x24')]=function(_0x1ba29e){try{utils[_0x20c0('0x13')](util['format'](_0x20c0('0x25'),_0x1ba29e['uniqueid']),_0x1ba29e);if(_0x1ba29e['channel']){var _0x394e6f=_0x1ba29e[_0x20c0('0x8')][_0x20c0('0x26')]('-')[0x0];if(!_[_0x20c0('0x1c')](members[_0x394e6f])){members[_0x394e6f]=_[_0x20c0('0x23')](members[_0x394e6f],{'data1':members[_0x394e6f][_0x20c0('0x27')]||_0x1ba29e[_0x20c0('0x28')],'data2':members[_0x394e6f]['data2']||_0x1ba29e['source'],'data3':members[_0x394e6f]['data3']||_0x1ba29e[_0x20c0('0x29')],'uniqueid':members[_0x394e6f][_0x20c0('0x6')]||_0x1ba29e['uniqueid']});utils[_0x20c0('0x3')](util[_0x20c0('0x4')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x1ba29e['uniqueid'],members[_0x394e6f][_0x20c0('0x27')],members[_0x394e6f][_0x20c0('0x9')],members[_0x394e6f]['data3']));if(members[_0x394e6f][_0x20c0('0x1d')]){writeDB(members[_0x394e6f]);}}}if(_0x1ba29e['destinationchannel']){var _0x43eae1=_0x1ba29e[_0x20c0('0x2a')][_0x20c0('0x26')]('-')[0x0];if(!_[_0x20c0('0x1c')](members[_0x43eae1])){members[_0x43eae1]=_['assign'](members[_0x43eae1],{'data1':members[_0x43eae1][_0x20c0('0x27')]||_0x1ba29e[_0x20c0('0x28')],'data2':members[_0x43eae1][_0x20c0('0x9')]||_0x1ba29e[_0x20c0('0x2b')],'data3':members[_0x43eae1][_0x20c0('0x2c')]||_0x1ba29e[_0x20c0('0x29')],'uniqueid':members[_0x43eae1][_0x20c0('0x6')]||_0x1ba29e[_0x20c0('0x6')]});utils['info'](util['format']('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x1ba29e[_0x20c0('0x6')],members[_0x43eae1]['data1'],members[_0x43eae1][_0x20c0('0x9')],members[_0x43eae1][_0x20c0('0x2c')]));if(members[_0x43eae1][_0x20c0('0x1d')]){writeDB(members[_0x43eae1]);}}}}catch(_0x32c4ef){utils['error'](util[_0x20c0('0x4')]('[%s][members][cdr]',_0x1ba29e['uniqueid']),_0x32c4ef);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index dc5be69..221f0c4 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 _0x46ed=['CreateVoiceQueueReport','transfereduniqueid','uniqueid','debug','[%s][queues][queuecallerjoin]','position','now','error','format','hangup','isNil','[%s][queues][hangup]','queuecallercomplete','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','varset','[%s][queues][varset]','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandon','queuecallerabandonAt','queuecallerexitAt','queuecallerexit','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','queuecallerleaveAt','holdtime','diffTime','count','agentconnect','membername','assigned','[%s][queues][agentconnect]','agentcomplete','queuecallercompleteAt','reason','transfer','TRANSFER','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','transferuniqueid','BLINDTRANSFER','extension','attendedtransfer','[%s][queues][attendedtransfer]','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfereruniqueid','origtransfererexten','ATTENDED','transferexten','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridname','queuecallerjoinAt','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','./utils','info','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','channel','queue','lastAssignedTo','calleridnum','queuecallerexitreason','getVoiceQueueByName','type','request'];(function(_0x4dd4ca,_0x4acbf8){var _0x43bdf1=function(_0x5e2e92){while(--_0x5e2e92){_0x4dd4ca['push'](_0x4dd4ca['shift']());}};_0x43bdf1(++_0x4acbf8);}(_0x46ed,0x184));var _0xd46e=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x46ed[_0x4e676e];return _0x336a3c;};'use strict';var _=require(_0xd46e('0x0'));var util=require('util');var utils=require(_0xd46e('0x1'));var queues={};function writeDB(_0x346452){utils[_0xd46e('0x2')](util['format'](_0xd46e('0x3'),_0x346452['uniqueid'],_0x346452[_0xd46e('0x4')],_0x346452[_0xd46e('0x5')],_0x346452[_0xd46e('0x6')],_0x346452[_0xd46e('0x7')],_0x346452['accountcode'],_0x346452[_0xd46e('0x8')]));if(_0x346452['queue']){utils[_0xd46e('0x9')](_0x346452[_0xd46e('0x5')])['then'](function(_0x4a7a99){if(_0x4a7a99){_0x346452['type']=_0x4a7a99[_0xd46e('0xa')];}utils[_0xd46e('0xb')](_0xd46e('0xc'),_0x346452);});}else{utils[_0xd46e('0xb')](_0xd46e('0xc'),_0x346452);}if(_0x346452[_0xd46e('0xd')]){delete queues[_0x346452[_0xd46e('0xd')]];}else{delete queues[_0x346452[_0xd46e('0xe')]];}}exports['queuecallerjoin']=function(_0x36991d){try{utils[_0xd46e('0xf')](util['format'](_0xd46e('0x10'),_0x36991d['uniqueid']),_0x36991d);utils[_0xd46e('0x2')](util['format']('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0x36991d[_0xd46e('0xe')],_0x36991d[_0xd46e('0x5')],_0x36991d[_0xd46e('0x11')]));queues[_0x36991d['uniqueid']]=_['assign'](_0x36991d,{'originalposition':_0x36991d['position'],'queuecallerjoinAt':utils[_0xd46e('0x12')](),'mohtime':0x0});}catch(_0x3d4640){utils[_0xd46e('0x13')](util[_0xd46e('0x14')](_0xd46e('0x10'),_0x36991d[_0xd46e('0xe')]),_0x3d4640);}};exports[_0xd46e('0x15')]=function(_0x3f4a7b){try{if(!_[_0xd46e('0x16')](queues[_0x3f4a7b[_0xd46e('0xe')]])){utils[_0xd46e('0xf')](util[_0xd46e('0x14')](_0xd46e('0x17'),_0x3f4a7b['uniqueid']),_0x3f4a7b);if(queues[_0x3f4a7b[_0xd46e('0xe')]]['queuecallerleaveAt']){if(!queues[_0x3f4a7b[_0xd46e('0xe')]]['queuecallerabandon']&&!queues[_0x3f4a7b['uniqueid']]['queuecallerexit']){queues[_0x3f4a7b['uniqueid']][_0xd46e('0x18')]=!![];queues[_0x3f4a7b[_0xd46e('0xe')]]['queuecallercompleteAt']=utils[_0xd46e('0x12')]();queues[_0x3f4a7b[_0xd46e('0xe')]][_0xd46e('0x8')]=_0xd46e('0x19');}utils[_0xd46e('0x2')](util[_0xd46e('0x14')](_0xd46e('0x1a'),_0x3f4a7b[_0xd46e('0xe')],queues[_0x3f4a7b[_0xd46e('0xe')]][_0xd46e('0x1b')],queues[_0x3f4a7b[_0xd46e('0xe')]]['queuecallerexitreason']));writeDB(queues[_0x3f4a7b[_0xd46e('0xe')]]);}else if(queues[_0x3f4a7b['uniqueid']][_0xd46e('0xd')]){utils[_0xd46e('0x2')](util['format'](_0xd46e('0x1c'),_0x3f4a7b[_0xd46e('0xe')],queues[_0x3f4a7b[_0xd46e('0xe')]][_0xd46e('0x1b')],queues[_0x3f4a7b[_0xd46e('0xe')]][_0xd46e('0xd')]));queues[queues[_0x3f4a7b[_0xd46e('0xe')]][_0xd46e('0xd')]]=queues[_0x3f4a7b[_0xd46e('0xe')]];queues[queues[_0x3f4a7b[_0xd46e('0xe')]][_0xd46e('0xd')]][_0xd46e('0x1d')]=0x2;delete queues[_0x3f4a7b[_0xd46e('0xe')]];}}}catch(_0x399a41){utils[_0xd46e('0x13')](util[_0xd46e('0x14')](_0xd46e('0x17'),_0x3f4a7b[_0xd46e('0xe')]),_0x399a41);}};exports[_0xd46e('0x1e')]=function(_0x1e2c52){try{utils['debug'](util[_0xd46e('0x14')](_0xd46e('0x1f'),_0x1e2c52['uniqueid']),_0x1e2c52);if(!_[_0xd46e('0x16')](_0x1e2c52[_0xd46e('0x20')][_0xd46e('0x21')])&&_0x1e2c52[_0xd46e('0x22')][_0xd46e('0x23')]()!==_0xd46e('0x24')){if(!_[_0xd46e('0x16')](queues[_0x1e2c52['uniqueid']])){queues[_0x1e2c52[_0xd46e('0xe')]][_0xd46e('0x25')]=![];queues[_0x1e2c52['uniqueid']][_0xd46e('0x26')]=null;queues[_0x1e2c52[_0xd46e('0xe')]]['queuecallerexit']=!![];queues[_0x1e2c52['uniqueid']][_0xd46e('0x27')]=utils['now']();queues[_0x1e2c52['uniqueid']]['queuecallerexitreason']=_0x1e2c52[_0xd46e('0x22')][_0xd46e('0x23')]();utils[_0xd46e('0x2')](util[_0xd46e('0x14')]('[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s',_0x1e2c52['uniqueid'],queues[_0x1e2c52[_0xd46e('0xe')]][_0xd46e('0x1b')],_0x1e2c52[_0xd46e('0x22')],queues[_0x1e2c52[_0xd46e('0xe')]]['queuecallerexitreason']));writeDB(queues[_0x1e2c52[_0xd46e('0xe')]]);}}else if(!_[_0xd46e('0x16')](_0x1e2c52[_0xd46e('0x20')]['queueposition'])){if(!_['isNil'](queues[_0x1e2c52[_0xd46e('0xe')]])&&!queues[_0x1e2c52[_0xd46e('0xe')]][_0xd46e('0x25')]){queues[_0x1e2c52[_0xd46e('0xe')]][_0xd46e('0x25')]=![];queues[_0x1e2c52[_0xd46e('0xe')]][_0xd46e('0x26')]=null;queues[_0x1e2c52[_0xd46e('0xe')]][_0xd46e('0x28')]=!![];queues[_0x1e2c52[_0xd46e('0xe')]][_0xd46e('0x27')]=utils['now']();queues[_0x1e2c52[_0xd46e('0xe')]][_0xd46e('0x8')]=_0xd46e('0x29');utils[_0xd46e('0x2')](util[_0xd46e('0x14')](_0xd46e('0x2a'),_0x1e2c52['uniqueid'],queues[_0x1e2c52[_0xd46e('0xe')]][_0xd46e('0x1b')],_0x1e2c52[_0xd46e('0x22')],queues[_0x1e2c52[_0xd46e('0xe')]][_0xd46e('0x8')]));}}}catch(_0x524adb){utils[_0xd46e('0x13')](util[_0xd46e('0x14')](_0xd46e('0x1f'),_0x1e2c52[_0xd46e('0xe')]),_0x524adb);}};exports['queuecallerabandon']=function(_0x5c62ef){try{if(!_[_0xd46e('0x16')](queues[_0x5c62ef[_0xd46e('0xe')]])){utils[_0xd46e('0xf')](util['format'](_0xd46e('0x2b'),_0x5c62ef[_0xd46e('0xe')]),_0x5c62ef);queues[_0x5c62ef[_0xd46e('0xe')]][_0xd46e('0x28')]=![];queues[_0x5c62ef[_0xd46e('0xe')]][_0xd46e('0x27')]=null;queues[_0x5c62ef['uniqueid']][_0xd46e('0x25')]=!![];queues[_0x5c62ef[_0xd46e('0xe')]][_0xd46e('0x26')]=utils['now']();queues[_0x5c62ef[_0xd46e('0xe')]][_0xd46e('0x8')]=_0xd46e('0x2c');utils['info'](util[_0xd46e('0x14')](_0xd46e('0x2d'),_0x5c62ef[_0xd46e('0xe')],queues[_0x5c62ef[_0xd46e('0xe')]]['name'],queues[_0x5c62ef[_0xd46e('0xe')]]['queuecallerexitreason']));}}catch(_0x1c8525){utils[_0xd46e('0x13')](util[_0xd46e('0x14')](_0xd46e('0x2b'),_0x5c62ef[_0xd46e('0xe')]),_0x1c8525);}};exports[_0xd46e('0x2e')]=function(_0x4dbd41){try{if(!_[_0xd46e('0x16')](queues[_0x4dbd41[_0xd46e('0xe')]])){utils[_0xd46e('0xf')](util['format'](_0xd46e('0x2f'),_0x4dbd41['uniqueid']),_0x4dbd41);utils[_0xd46e('0x2')](util['format'](_0xd46e('0x30'),_0x4dbd41[_0xd46e('0xe')],queues[_0x4dbd41[_0xd46e('0xe')]][_0xd46e('0x1b')],_0x4dbd41[_0xd46e('0x31')],_0x4dbd41[_0xd46e('0x32')]));queues[_0x4dbd41[_0xd46e('0xe')]][_0xd46e('0x2e')]=!![];queues[_0x4dbd41[_0xd46e('0xe')]][_0xd46e('0x33')]=utils[_0xd46e('0x12')]();queues[_0x4dbd41['uniqueid']][_0xd46e('0x34')]=utils[_0xd46e('0x35')](queues[_0x4dbd41['uniqueid']][_0xd46e('0x33')],queues[_0x4dbd41[_0xd46e('0xe')]]['queuecallerjoinAt']);queues[_0x4dbd41[_0xd46e('0xe')]]['position']=_0x4dbd41[_0xd46e('0x11')];queues[_0x4dbd41['uniqueid']][_0xd46e('0x36')]=_0x4dbd41[_0xd46e('0x36')];queues[_0x4dbd41[_0xd46e('0xe')]]['connectedlinenum']=_0x4dbd41[_0xd46e('0x31')];queues[_0x4dbd41[_0xd46e('0xe')]][_0xd46e('0x32')]=_0x4dbd41[_0xd46e('0x32')];}}catch(_0xad6ac4){utils[_0xd46e('0x13')](util[_0xd46e('0x14')]('[%s][queues][queuecallerleave]',_0x4dbd41[_0xd46e('0xe')]),_0xad6ac4);}};exports[_0xd46e('0x37')]=function(_0x3c8ff3){try{if(!_['isNil'](queues[_0x3c8ff3[_0xd46e('0xe')]])){utils['debug'](util[_0xd46e('0x14')]('[%s][queues][agentconnect]',_0x3c8ff3[_0xd46e('0xe')]),_0x3c8ff3);utils[_0xd46e('0x2')](util['format']('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x3c8ff3['uniqueid'],queues[_0x3c8ff3['uniqueid']]['name'],_0x3c8ff3[_0xd46e('0x38')],_0x3c8ff3['destaccountcode']));queues[_0x3c8ff3[_0xd46e('0xe')]][_0xd46e('0x25')]=![];queues[_0x3c8ff3[_0xd46e('0xe')]][_0xd46e('0x25')]=![];queues[_0x3c8ff3['uniqueid']][_0xd46e('0x26')]=null;queues[_0x3c8ff3[_0xd46e('0xe')]][_0xd46e('0x28')]=![];queues[_0x3c8ff3['uniqueid']]['queuecallerexitreason']=null;queues[_0x3c8ff3[_0xd46e('0xe')]][_0xd46e('0x27')]=null;queues[_0x3c8ff3['uniqueid']][_0xd46e('0x39')]=!![];queues[_0x3c8ff3[_0xd46e('0xe')]]['accountcode']=_0x3c8ff3['destaccountcode'];queues[_0x3c8ff3[_0xd46e('0xe')]][_0xd46e('0x6')]=_0x3c8ff3[_0xd46e('0x38')];}}catch(_0x415a0f){utils[_0xd46e('0x13')](util[_0xd46e('0x14')](_0xd46e('0x3a'),_0x3c8ff3[_0xd46e('0xe')]),_0x415a0f);}};exports[_0xd46e('0x3b')]=function(_0x1aab43){try{if(!_[_0xd46e('0x16')](queues[_0x1aab43[_0xd46e('0xe')]])){if(queues[_0x1aab43['uniqueid']][_0xd46e('0x33')]){utils[_0xd46e('0xf')](util['format']('[%s][queues][agentcomplete]',_0x1aab43[_0xd46e('0xe')]),_0x1aab43);queues[_0x1aab43[_0xd46e('0xe')]][_0xd46e('0x25')]=![];queues[_0x1aab43[_0xd46e('0xe')]][_0xd46e('0x25')]=![];queues[_0x1aab43[_0xd46e('0xe')]][_0xd46e('0x26')]=null;queues[_0x1aab43[_0xd46e('0xe')]][_0xd46e('0x28')]=![];queues[_0x1aab43[_0xd46e('0xe')]][_0xd46e('0x27')]=null;queues[_0x1aab43['uniqueid']][_0xd46e('0x39')]=!![];queues[_0x1aab43[_0xd46e('0xe')]][_0xd46e('0x6')]=_0x1aab43[_0xd46e('0x38')];queues[_0x1aab43['uniqueid']]['queuecallercomplete']=!![];queues[_0x1aab43[_0xd46e('0xe')]][_0xd46e('0x3c')]=utils[_0xd46e('0x12')]();if(_0x1aab43[_0xd46e('0x3d')]==_0xd46e('0x3e')){if(!queues[_0x1aab43['uniqueid']][_0xd46e('0x3e')]){queues[_0x1aab43[_0xd46e('0xe')]]['queuecallerexitreason']=_0xd46e('0x3f');}}else{queues[_0x1aab43[_0xd46e('0xe')]]['queuecallerexitreason']='COMPLETEDBY'+_0x1aab43[_0xd46e('0x3d')][_0xd46e('0x23')]();}utils[_0xd46e('0x2')](util[_0xd46e('0x14')](_0xd46e('0x40'),_0x1aab43[_0xd46e('0xe')],queues[_0x1aab43[_0xd46e('0xe')]][_0xd46e('0x1b')],_0x1aab43['membername'],queues[_0x1aab43[_0xd46e('0xe')]][_0xd46e('0x8')]));writeDB(queues[_0x1aab43[_0xd46e('0xe')]]);}}}catch(_0x35990c){utils[_0xd46e('0x13')](util[_0xd46e('0x14')]('[%s][queues][agentcomplete]',_0x1aab43[_0xd46e('0xe')]),_0x35990c);}};exports['blindtransfer']=function(_0x3d7864){try{if(!_[_0xd46e('0x16')](queues[_0x3d7864[_0xd46e('0x41')]])){utils[_0xd46e('0xf')](util[_0xd46e('0x14')](_0xd46e('0x42'),_0x3d7864[_0xd46e('0xe')]),_0x3d7864);queues[_0x3d7864['transfereeuniqueid']]['transfer']=!![];queues[_0x3d7864[_0xd46e('0x41')]][_0xd46e('0x43')]=_0xd46e('0x44');queues[_0x3d7864['transfereeuniqueid']]['transferexten']=_0x3d7864['extension'];queues[_0x3d7864[_0xd46e('0x41')]][_0xd46e('0x45')]=_0x3d7864['transfereeuniqueid'];queues[_0x3d7864[_0xd46e('0x41')]][_0xd46e('0x8')]=_0xd46e('0x46');utils['info'](util[_0xd46e('0x14')]('[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER',_0x3d7864['uniqueid'],queues[_0x3d7864[_0xd46e('0x41')]][_0xd46e('0x1b')],_0x3d7864[_0xd46e('0x41')],_0x3d7864[_0xd46e('0x47')]));}}catch(_0x49ad16){utils[_0xd46e('0x13')](util[_0xd46e('0x14')]('[%s][queues][blindtransfer]',_0x3d7864[_0xd46e('0xe')]),_0x49ad16);}};exports[_0xd46e('0x48')]=function(_0x3fd102){try{utils[_0xd46e('0xf')](util['format'](_0xd46e('0x49'),_0x3fd102['origtransfereruniqueid']),_0x3fd102);if(_0x3fd102['origtransfereruniqueid']==_0x3fd102[_0xd46e('0x4a')]){if(!_['isNil'](queues[_0x3fd102[_0xd46e('0x4b')]])){utils[_0xd46e('0x2')](util['format'](_0xd46e('0x4c'),_0x3fd102[_0xd46e('0x4d')],queues[_0x3fd102[_0xd46e('0x4b')]][_0xd46e('0x1b')],_0x3fd102[_0xd46e('0x4e')]));queues[_0x3fd102[_0xd46e('0x4b')]][_0xd46e('0x3e')]=!![];queues[_0x3fd102[_0xd46e('0x4b')]][_0xd46e('0x43')]=_0xd46e('0x4f');queues[_0x3fd102[_0xd46e('0x4b')]][_0xd46e('0x50')]=_0x3fd102['origtransfererexten'];queues[_0x3fd102[_0xd46e('0x4b')]][_0xd46e('0x45')]=_0x3fd102['origtransfereruniqueid'];queues[_0x3fd102[_0xd46e('0x4b')]][_0xd46e('0x8')]=_0xd46e('0x51');}if(!_[_0xd46e('0x16')](queues[_0x3fd102[_0xd46e('0x4a')]])){if(_0x3fd102[_0xd46e('0x52')]&&queues[_0x3fd102['transfereelinkedid']]){queues[_0x3fd102[_0xd46e('0x52')]][_0xd46e('0x1d')]=0x1;queues[_0x3fd102[_0xd46e('0x41')]]=_[_0xd46e('0x53')](queues[_0x3fd102['transfereelinkedid']]);queues[_0x3fd102[_0xd46e('0x41')]][_0xd46e('0xd')]=_0x3fd102[_0xd46e('0x54')];queues[_0x3fd102[_0xd46e('0x41')]]['queuecallerenterreason']=0x2;queues[_0x3fd102[_0xd46e('0x41')]][_0xd46e('0x7')]=queues[_0x3fd102[_0xd46e('0x4b')]][_0xd46e('0x7')];queues[_0x3fd102[_0xd46e('0x41')]][_0xd46e('0x55')]=queues[_0x3fd102[_0xd46e('0x4b')]][_0xd46e('0x55')];queues[_0x3fd102[_0xd46e('0x41')]][_0xd46e('0x56')]=utils['now']();queues[_0x3fd102[_0xd46e('0x41')]][_0xd46e('0x33')]=utils[_0xd46e('0x12')]();queues[_0x3fd102[_0xd46e('0x41')]][_0xd46e('0x34')]=0x0;queues[_0x3fd102['transfereeuniqueid']][_0xd46e('0x57')]=0x0;utils[_0xd46e('0x2')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0x3fd102[_0xd46e('0x4d')],queues[_0x3fd102[_0xd46e('0x41')]][_0xd46e('0x1b')],queues[_0x3fd102[_0xd46e('0x41')]][_0xd46e('0x7')],queues[_0x3fd102[_0xd46e('0x41')]][_0xd46e('0x55')]));}else{utils[_0xd46e('0x2')](util[_0xd46e('0x14')](_0xd46e('0x58'),_0x3fd102['origtransfereruniqueid'],queues[_0x3fd102['origtransfererlinkedid']][_0xd46e('0x1b')],_0x3fd102['secondtransfererlinkedid']));queues[_0x3fd102[_0xd46e('0x4a')]][_0xd46e('0xd')]=_0x3fd102[_0xd46e('0x4b')];}}}else if(_0x3fd102[_0xd46e('0x59')]==_0x3fd102[_0xd46e('0x4b')]){if(!_[_0xd46e('0x16')](queues[_0x3fd102['origtransfererlinkedid']])){utils[_0xd46e('0x2')](util[_0xd46e('0x14')](_0xd46e('0x5a'),_0x3fd102[_0xd46e('0x4d')],queues[_0x3fd102[_0xd46e('0x4a')]][_0xd46e('0x1b')],_0x3fd102['secondtransfereruniqueid'],_0x3fd102[_0xd46e('0x5b')]));queues[_0x3fd102[_0xd46e('0x4a')]][_0xd46e('0x3e')]=!![];queues[_0x3fd102['origtransfererlinkedid']]['transfertype']=_0xd46e('0x4f');queues[_0x3fd102[_0xd46e('0x4a')]][_0xd46e('0x50')]=_0x3fd102[_0xd46e('0x5b')];queues[_0x3fd102[_0xd46e('0x4a')]][_0xd46e('0x45')]=_0x3fd102[_0xd46e('0x59')];queues[_0x3fd102[_0xd46e('0x4a')]][_0xd46e('0x8')]='ATTENDEDTRANSFER';}if(!_[_0xd46e('0x16')](queues[_0x3fd102[_0xd46e('0x4b')]])){if(_0x3fd102[_0xd46e('0x5c')]&&queues[_0x3fd102[_0xd46e('0x5c')]]){queues[_0x3fd102[_0xd46e('0x5c')]][_0xd46e('0x1d')]=0x1;queues[_0x3fd102['transfertargetuniqueid']]=_[_0xd46e('0x53')](queues[_0x3fd102[_0xd46e('0x5c')]]);queues[_0x3fd102[_0xd46e('0x54')]]['transfereduniqueid']=_0x3fd102['transfertargetuniqueid'];queues[_0x3fd102['transfertargetuniqueid']]['queuecallerenterreason']=0x2;queues[_0x3fd102[_0xd46e('0x54')]]['calleridnum']=queues[_0x3fd102[_0xd46e('0x4a')]][_0xd46e('0x7')];queues[_0x3fd102[_0xd46e('0x54')]]['calleridname']=queues[_0x3fd102[_0xd46e('0x4a')]][_0xd46e('0x55')];queues[_0x3fd102[_0xd46e('0x54')]][_0xd46e('0x56')]=utils[_0xd46e('0x12')]();queues[_0x3fd102['transfertargetuniqueid']][_0xd46e('0x33')]=utils[_0xd46e('0x12')]();queues[_0x3fd102['transfertargetuniqueid']]['holdtime']=0x0;queues[_0x3fd102[_0xd46e('0x54')]][_0xd46e('0x57')]=0x0;utils['info'](util['format'](_0xd46e('0x5d'),_0x3fd102['origtransfereruniqueid'],queues[_0x3fd102[_0xd46e('0x54')]][_0xd46e('0x1b')],queues[_0x3fd102[_0xd46e('0x54')]][_0xd46e('0xd')],queues[_0x3fd102[_0xd46e('0x54')]][_0xd46e('0x7')],queues[_0x3fd102[_0xd46e('0x54')]]['calleridname']));}else{utils[_0xd46e('0x2')](util[_0xd46e('0x14')](_0xd46e('0x58'),_0x3fd102[_0xd46e('0x4d')],queues[_0x3fd102[_0xd46e('0x4b')]][_0xd46e('0x1b')],_0x3fd102[_0xd46e('0x4a')]));queues[_0x3fd102['secondtransfererlinkedid']][_0xd46e('0xd')]=_0x3fd102[_0xd46e('0x4a')];}}}}catch(_0x4d7915){utils[_0xd46e('0x13')](util['format'](_0xd46e('0x49'),_0x3fd102[_0xd46e('0x4d')]),_0x4d7915);}};exports[_0xd46e('0x5e')]=function(_0x290e75){try{if(!_['isNil'](queues[_0x290e75['uniqueid']])){utils[_0xd46e('0xf')](util['format'](_0xd46e('0x5f'),_0x290e75[_0xd46e('0xe')]),_0x290e75);queues[_0x290e75[_0xd46e('0xe')]][_0xd46e('0x60')]=utils[_0xd46e('0x12')]();utils['info'](util[_0xd46e('0x14')]('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x290e75[_0xd46e('0xe')],queues[_0x290e75[_0xd46e('0xe')]]['name'],queues[_0x290e75[_0xd46e('0xe')]][_0xd46e('0x60')]));}}catch(_0x3819e8){utils[_0xd46e('0x13')](util[_0xd46e('0x14')](_0xd46e('0x5f'),_0x290e75[_0xd46e('0xe')]),_0x3819e8);}};exports[_0xd46e('0x61')]=function(_0x37bfc8){try{if(!_['isNil'](queues[_0x37bfc8[_0xd46e('0xe')]])){if(!_[_0xd46e('0x16')](queues[_0x37bfc8[_0xd46e('0xe')]]['musiconholdstartAt'])){utils[_0xd46e('0xf')](util['format'](_0xd46e('0x62'),_0x37bfc8[_0xd46e('0xe')]),_0x37bfc8);queues[_0x37bfc8[_0xd46e('0xe')]]['mohtime']+=utils[_0xd46e('0x35')](utils[_0xd46e('0x12')](),queues[_0x37bfc8[_0xd46e('0xe')]][_0xd46e('0x60')]);utils[_0xd46e('0x2')](util[_0xd46e('0x14')](_0xd46e('0x63'),_0x37bfc8[_0xd46e('0xe')],queues[_0x37bfc8[_0xd46e('0xe')]]['name'],queues[_0x37bfc8['uniqueid']]['mohtime']));delete queues[_0x37bfc8[_0xd46e('0xe')]][_0xd46e('0x60')];}}}catch(_0x321666){utils[_0xd46e('0x13')](util['format'](_0xd46e('0x62'),_0x37bfc8[_0xd46e('0xe')]),_0x321666);}}; \ No newline at end of file +var _0x01b4=['[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','name','queuecallerenterreason','varset','[%s][queues][varset]','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','EXITWITHKEY','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinename','holdtime','diffTime','queuecallerjoinAt','count','connectedlinenum','agentconnect','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','[%s][queues][agentconnect]','agentcomplete','reason','transfer','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','[%s][queues][agentcomplete]','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridnum','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfereruniqueid','ATTENDED','secondtransfererexten','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','util','./utils','info','uniqueid','channel','queue','lastAssignedTo','accountcode','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','format','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','now','error','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT'];(function(_0x277ab9,_0x462f8c){var _0x309a76=function(_0x4dfc83){while(--_0x4dfc83){_0x277ab9['push'](_0x277ab9['shift']());}};_0x309a76(++_0x462f8c);}(_0x01b4,0x122));var _0x401b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x01b4[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x401b('0x0'));var utils=require(_0x401b('0x1'));var queues={};function writeDB(_0x4a1b54){utils[_0x401b('0x2')](util['format']('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x4a1b54[_0x401b('0x3')],_0x4a1b54[_0x401b('0x4')],_0x4a1b54[_0x401b('0x5')],_0x4a1b54[_0x401b('0x6')],_0x4a1b54['calleridnum'],_0x4a1b54[_0x401b('0x7')],_0x4a1b54[_0x401b('0x8')]));if(_0x4a1b54['queue']){utils[_0x401b('0x9')](_0x4a1b54[_0x401b('0x5')])[_0x401b('0xa')](function(_0x1d9d02){if(_0x1d9d02){_0x4a1b54[_0x401b('0xb')]=_0x1d9d02['type'];}utils[_0x401b('0xc')](_0x401b('0xd'),_0x4a1b54);});}else{utils['request']('CreateVoiceQueueReport',_0x4a1b54);}if(_0x4a1b54[_0x401b('0xe')]){delete queues[_0x4a1b54[_0x401b('0xe')]];}else{delete queues[_0x4a1b54[_0x401b('0x3')]];}}exports[_0x401b('0xf')]=function(_0x3065a5){try{utils[_0x401b('0x10')](util['format'](_0x401b('0x11'),_0x3065a5[_0x401b('0x3')]),_0x3065a5);utils[_0x401b('0x2')](util[_0x401b('0x12')](_0x401b('0x13'),_0x3065a5[_0x401b('0x3')],_0x3065a5[_0x401b('0x5')],_0x3065a5[_0x401b('0x14')]));queues[_0x3065a5['uniqueid']]=_['assign'](_0x3065a5,{'originalposition':_0x3065a5[_0x401b('0x14')],'queuecallerjoinAt':utils[_0x401b('0x15')](),'mohtime':0x0});}catch(_0x3c24cf){utils[_0x401b('0x16')](util[_0x401b('0x12')](_0x401b('0x11'),_0x3065a5['uniqueid']),_0x3c24cf);}};exports['hangup']=function(_0x27aae9){try{if(!_[_0x401b('0x17')](queues[_0x27aae9['uniqueid']])){utils[_0x401b('0x10')](util[_0x401b('0x12')](_0x401b('0x18'),_0x27aae9[_0x401b('0x3')]),_0x27aae9);if(queues[_0x27aae9[_0x401b('0x3')]][_0x401b('0x19')]){if(!queues[_0x27aae9[_0x401b('0x3')]][_0x401b('0x1a')]&&!queues[_0x27aae9[_0x401b('0x3')]][_0x401b('0x1b')]){queues[_0x27aae9[_0x401b('0x3')]][_0x401b('0x1c')]=!![];queues[_0x27aae9[_0x401b('0x3')]][_0x401b('0x1d')]=utils['now']();queues[_0x27aae9[_0x401b('0x3')]]['queuecallerexitreason']=_0x401b('0x1e');}utils[_0x401b('0x2')](util['format'](_0x401b('0x1f'),_0x27aae9[_0x401b('0x3')],queues[_0x27aae9[_0x401b('0x3')]]['name'],queues[_0x27aae9[_0x401b('0x3')]][_0x401b('0x8')]));writeDB(queues[_0x27aae9[_0x401b('0x3')]]);}else if(queues[_0x27aae9['uniqueid']][_0x401b('0xe')]){utils[_0x401b('0x2')](util[_0x401b('0x12')](_0x401b('0x20'),_0x27aae9[_0x401b('0x3')],queues[_0x27aae9[_0x401b('0x3')]][_0x401b('0x21')],queues[_0x27aae9[_0x401b('0x3')]][_0x401b('0xe')]));queues[queues[_0x27aae9[_0x401b('0x3')]][_0x401b('0xe')]]=queues[_0x27aae9[_0x401b('0x3')]];queues[queues[_0x27aae9['uniqueid']][_0x401b('0xe')]][_0x401b('0x22')]=0x2;delete queues[_0x27aae9[_0x401b('0x3')]];}}}catch(_0x340058){utils[_0x401b('0x16')](util[_0x401b('0x12')]('[%s][queues][hangup]',_0x27aae9['uniqueid']),_0x340058);}};exports[_0x401b('0x23')]=function(_0x540582){try{utils[_0x401b('0x10')](util[_0x401b('0x12')](_0x401b('0x24'),_0x540582[_0x401b('0x3')]),_0x540582);if(!_[_0x401b('0x17')](_0x540582[_0x401b('0x25')][_0x401b('0x26')])&&_0x540582[_0x401b('0x27')][_0x401b('0x28')]()!==_0x401b('0x29')){if(!_[_0x401b('0x17')](queues[_0x540582['uniqueid']])){queues[_0x540582[_0x401b('0x3')]]['queuecallerabandon']=![];queues[_0x540582[_0x401b('0x3')]][_0x401b('0x2a')]=null;queues[_0x540582[_0x401b('0x3')]][_0x401b('0x1b')]=!![];queues[_0x540582[_0x401b('0x3')]][_0x401b('0x2b')]=utils[_0x401b('0x15')]();queues[_0x540582[_0x401b('0x3')]]['queuecallerexitreason']=_0x540582['value'][_0x401b('0x28')]();utils[_0x401b('0x2')](util[_0x401b('0x12')](_0x401b('0x2c'),_0x540582[_0x401b('0x3')],queues[_0x540582[_0x401b('0x3')]][_0x401b('0x21')],_0x540582['value'],queues[_0x540582[_0x401b('0x3')]]['queuecallerexitreason']));writeDB(queues[_0x540582[_0x401b('0x3')]]);}}else if(!_[_0x401b('0x17')](_0x540582[_0x401b('0x25')]['queueposition'])){if(!_[_0x401b('0x17')](queues[_0x540582[_0x401b('0x3')]])&&!queues[_0x540582[_0x401b('0x3')]][_0x401b('0x1a')]){queues[_0x540582[_0x401b('0x3')]][_0x401b('0x1a')]=![];queues[_0x540582['uniqueid']]['queuecallerabandonAt']=null;queues[_0x540582['uniqueid']][_0x401b('0x1b')]=!![];queues[_0x540582[_0x401b('0x3')]][_0x401b('0x2b')]=utils[_0x401b('0x15')]();queues[_0x540582['uniqueid']][_0x401b('0x8')]=_0x401b('0x2d');utils['info'](util[_0x401b('0x12')]('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x540582['uniqueid'],queues[_0x540582[_0x401b('0x3')]][_0x401b('0x21')],_0x540582[_0x401b('0x27')],queues[_0x540582[_0x401b('0x3')]][_0x401b('0x8')]));}}}catch(_0x30e677){utils['error'](util['format']('[%s][queues][varset]',_0x540582[_0x401b('0x3')]),_0x30e677);}};exports['queuecallerabandon']=function(_0x1d0746){try{if(!_['isNil'](queues[_0x1d0746[_0x401b('0x3')]])){utils[_0x401b('0x10')](util[_0x401b('0x12')](_0x401b('0x2e'),_0x1d0746[_0x401b('0x3')]),_0x1d0746);queues[_0x1d0746[_0x401b('0x3')]][_0x401b('0x1b')]=![];queues[_0x1d0746[_0x401b('0x3')]][_0x401b('0x2b')]=null;queues[_0x1d0746[_0x401b('0x3')]][_0x401b('0x1a')]=!![];queues[_0x1d0746[_0x401b('0x3')]][_0x401b('0x2a')]=utils[_0x401b('0x15')]();queues[_0x1d0746['uniqueid']][_0x401b('0x8')]=_0x401b('0x2f');utils['info'](util[_0x401b('0x12')](_0x401b('0x30'),_0x1d0746[_0x401b('0x3')],queues[_0x1d0746[_0x401b('0x3')]][_0x401b('0x21')],queues[_0x1d0746['uniqueid']]['queuecallerexitreason']));}}catch(_0x295007){utils[_0x401b('0x16')](util[_0x401b('0x12')](_0x401b('0x2e'),_0x1d0746[_0x401b('0x3')]),_0x295007);}};exports[_0x401b('0x31')]=function(_0x1d4f13){try{if(!_[_0x401b('0x17')](queues[_0x1d4f13['uniqueid']])){utils[_0x401b('0x10')](util['format'](_0x401b('0x32'),_0x1d4f13[_0x401b('0x3')]),_0x1d4f13);utils[_0x401b('0x2')](util[_0x401b('0x12')](_0x401b('0x33'),_0x1d4f13['uniqueid'],queues[_0x1d4f13[_0x401b('0x3')]][_0x401b('0x21')],_0x1d4f13['connectedlinenum'],_0x1d4f13[_0x401b('0x34')]));queues[_0x1d4f13[_0x401b('0x3')]][_0x401b('0x31')]=!![];queues[_0x1d4f13['uniqueid']]['queuecallerleaveAt']=utils[_0x401b('0x15')]();queues[_0x1d4f13[_0x401b('0x3')]][_0x401b('0x35')]=utils[_0x401b('0x36')](queues[_0x1d4f13['uniqueid']]['queuecallerleaveAt'],queues[_0x1d4f13[_0x401b('0x3')]][_0x401b('0x37')]);queues[_0x1d4f13[_0x401b('0x3')]][_0x401b('0x14')]=_0x1d4f13['position'];queues[_0x1d4f13['uniqueid']]['count']=_0x1d4f13[_0x401b('0x38')];queues[_0x1d4f13[_0x401b('0x3')]][_0x401b('0x39')]=_0x1d4f13['connectedlinenum'];queues[_0x1d4f13[_0x401b('0x3')]][_0x401b('0x34')]=_0x1d4f13[_0x401b('0x34')];}}catch(_0x165ab8){utils['error'](util[_0x401b('0x12')](_0x401b('0x32'),_0x1d4f13[_0x401b('0x3')]),_0x165ab8);}};exports[_0x401b('0x3a')]=function(_0x5c9b4e){try{if(!_[_0x401b('0x17')](queues[_0x5c9b4e['uniqueid']])){utils[_0x401b('0x10')](util[_0x401b('0x12')]('[%s][queues][agentconnect]',_0x5c9b4e['uniqueid']),_0x5c9b4e);utils[_0x401b('0x2')](util['format'](_0x401b('0x3b'),_0x5c9b4e[_0x401b('0x3')],queues[_0x5c9b4e[_0x401b('0x3')]][_0x401b('0x21')],_0x5c9b4e[_0x401b('0x3c')],_0x5c9b4e[_0x401b('0x3d')]));queues[_0x5c9b4e[_0x401b('0x3')]]['queuecallerabandon']=![];queues[_0x5c9b4e[_0x401b('0x3')]][_0x401b('0x1a')]=![];queues[_0x5c9b4e['uniqueid']][_0x401b('0x2a')]=null;queues[_0x5c9b4e[_0x401b('0x3')]][_0x401b('0x1b')]=![];queues[_0x5c9b4e[_0x401b('0x3')]][_0x401b('0x8')]=null;queues[_0x5c9b4e[_0x401b('0x3')]][_0x401b('0x2b')]=null;queues[_0x5c9b4e[_0x401b('0x3')]][_0x401b('0x3e')]=!![];queues[_0x5c9b4e[_0x401b('0x3')]][_0x401b('0x7')]=_0x5c9b4e[_0x401b('0x3d')];queues[_0x5c9b4e[_0x401b('0x3')]][_0x401b('0x6')]=_0x5c9b4e[_0x401b('0x3c')];}}catch(_0x33f979){utils[_0x401b('0x16')](util[_0x401b('0x12')](_0x401b('0x3f'),_0x5c9b4e[_0x401b('0x3')]),_0x33f979);}};exports[_0x401b('0x40')]=function(_0x114995){try{if(!_['isNil'](queues[_0x114995[_0x401b('0x3')]])){if(queues[_0x114995[_0x401b('0x3')]][_0x401b('0x19')]){utils['debug'](util[_0x401b('0x12')]('[%s][queues][agentcomplete]',_0x114995[_0x401b('0x3')]),_0x114995);queues[_0x114995['uniqueid']][_0x401b('0x1a')]=![];queues[_0x114995[_0x401b('0x3')]][_0x401b('0x1a')]=![];queues[_0x114995[_0x401b('0x3')]][_0x401b('0x2a')]=null;queues[_0x114995[_0x401b('0x3')]][_0x401b('0x1b')]=![];queues[_0x114995[_0x401b('0x3')]][_0x401b('0x2b')]=null;queues[_0x114995['uniqueid']][_0x401b('0x3e')]=!![];queues[_0x114995[_0x401b('0x3')]][_0x401b('0x6')]=_0x114995['membername'];queues[_0x114995[_0x401b('0x3')]]['queuecallercomplete']=!![];queues[_0x114995[_0x401b('0x3')]][_0x401b('0x1d')]=utils[_0x401b('0x15')]();if(_0x114995[_0x401b('0x41')]==_0x401b('0x42')){if(!queues[_0x114995[_0x401b('0x3')]][_0x401b('0x42')]){queues[_0x114995[_0x401b('0x3')]]['queuecallerexitreason']='TRANSFER';}}else{queues[_0x114995[_0x401b('0x3')]][_0x401b('0x8')]=_0x401b('0x43')+_0x114995[_0x401b('0x41')]['toUpperCase']();}utils[_0x401b('0x2')](util['format'](_0x401b('0x44'),_0x114995[_0x401b('0x3')],queues[_0x114995[_0x401b('0x3')]][_0x401b('0x21')],_0x114995[_0x401b('0x3c')],queues[_0x114995[_0x401b('0x3')]][_0x401b('0x8')]));writeDB(queues[_0x114995[_0x401b('0x3')]]);}}}catch(_0x5b25c6){utils[_0x401b('0x16')](util['format'](_0x401b('0x45'),_0x114995['uniqueid']),_0x5b25c6);}};exports[_0x401b('0x46')]=function(_0x36906f){try{if(!_[_0x401b('0x17')](queues[_0x36906f[_0x401b('0x47')]])){utils[_0x401b('0x10')](util[_0x401b('0x12')](_0x401b('0x48'),_0x36906f[_0x401b('0x3')]),_0x36906f);queues[_0x36906f['transfereeuniqueid']]['transfer']=!![];queues[_0x36906f[_0x401b('0x47')]][_0x401b('0x49')]='BLIND';queues[_0x36906f[_0x401b('0x47')]][_0x401b('0x4a')]=_0x36906f[_0x401b('0x4b')];queues[_0x36906f[_0x401b('0x47')]][_0x401b('0x4c')]=_0x36906f['transfereeuniqueid'];queues[_0x36906f[_0x401b('0x47')]]['queuecallerexitreason']=_0x401b('0x4d');utils['info'](util['format'](_0x401b('0x4e'),_0x36906f[_0x401b('0x3')],queues[_0x36906f[_0x401b('0x47')]][_0x401b('0x21')],_0x36906f[_0x401b('0x47')],_0x36906f['extension']));}}catch(_0x245f8f){utils['error'](util[_0x401b('0x12')](_0x401b('0x48'),_0x36906f[_0x401b('0x3')]),_0x245f8f);}};exports[_0x401b('0x4f')]=function(_0x1a9797){try{utils[_0x401b('0x10')](util[_0x401b('0x12')](_0x401b('0x50'),_0x1a9797['origtransfereruniqueid']),_0x1a9797);if(_0x1a9797[_0x401b('0x51')]==_0x1a9797[_0x401b('0x52')]){if(!_[_0x401b('0x17')](queues[_0x1a9797[_0x401b('0x53')]])){utils['info'](util[_0x401b('0x12')](_0x401b('0x54'),_0x1a9797['origtransfereruniqueid'],queues[_0x1a9797['secondtransfererlinkedid']][_0x401b('0x21')],_0x1a9797[_0x401b('0x55')]));queues[_0x1a9797[_0x401b('0x53')]][_0x401b('0x42')]=!![];queues[_0x1a9797[_0x401b('0x53')]]['transfertype']='ATTENDED';queues[_0x1a9797['secondtransfererlinkedid']][_0x401b('0x4a')]=_0x1a9797['origtransfererexten'];queues[_0x1a9797[_0x401b('0x53')]][_0x401b('0x4c')]=_0x1a9797['origtransfereruniqueid'];queues[_0x1a9797[_0x401b('0x53')]][_0x401b('0x8')]=_0x401b('0x56');}if(!_[_0x401b('0x17')](queues[_0x1a9797[_0x401b('0x52')]])){if(_0x1a9797[_0x401b('0x57')]&&queues[_0x1a9797['transfereelinkedid']]){queues[_0x1a9797[_0x401b('0x57')]][_0x401b('0x22')]=0x1;queues[_0x1a9797['transfereeuniqueid']]=_[_0x401b('0x58')](queues[_0x1a9797[_0x401b('0x57')]]);queues[_0x1a9797[_0x401b('0x47')]]['transfereduniqueid']=_0x1a9797[_0x401b('0x59')];queues[_0x1a9797[_0x401b('0x47')]][_0x401b('0x22')]=0x2;queues[_0x1a9797[_0x401b('0x47')]][_0x401b('0x5a')]=queues[_0x1a9797['secondtransfererlinkedid']][_0x401b('0x5a')];queues[_0x1a9797[_0x401b('0x47')]]['calleridname']=queues[_0x1a9797['secondtransfererlinkedid']][_0x401b('0x5b')];queues[_0x1a9797[_0x401b('0x47')]][_0x401b('0x37')]=utils[_0x401b('0x15')]();queues[_0x1a9797[_0x401b('0x47')]][_0x401b('0x19')]=utils['now']();queues[_0x1a9797[_0x401b('0x47')]]['holdtime']=0x0;queues[_0x1a9797['transfereeuniqueid']][_0x401b('0x5c')]=0x0;utils[_0x401b('0x2')](util[_0x401b('0x12')](_0x401b('0x5d'),_0x1a9797[_0x401b('0x51')],queues[_0x1a9797[_0x401b('0x47')]][_0x401b('0x21')],queues[_0x1a9797[_0x401b('0x47')]]['calleridnum'],queues[_0x1a9797[_0x401b('0x47')]]['calleridname']));}else{utils['info'](util[_0x401b('0x12')](_0x401b('0x5e'),_0x1a9797[_0x401b('0x51')],queues[_0x1a9797[_0x401b('0x52')]][_0x401b('0x21')],_0x1a9797[_0x401b('0x53')]));queues[_0x1a9797[_0x401b('0x52')]]['transfereduniqueid']=_0x1a9797['secondtransfererlinkedid'];}}}else if(_0x1a9797['secondtransfereruniqueid']==_0x1a9797[_0x401b('0x53')]){if(!_['isNil'](queues[_0x1a9797[_0x401b('0x52')]])){utils[_0x401b('0x2')](util[_0x401b('0x12')](_0x401b('0x5f'),_0x1a9797[_0x401b('0x51')],queues[_0x1a9797[_0x401b('0x52')]][_0x401b('0x21')],_0x1a9797[_0x401b('0x60')],_0x1a9797['secondtransfererexten']));queues[_0x1a9797[_0x401b('0x52')]]['transfer']=!![];queues[_0x1a9797['origtransfererlinkedid']][_0x401b('0x49')]=_0x401b('0x61');queues[_0x1a9797['origtransfererlinkedid']][_0x401b('0x4a')]=_0x1a9797[_0x401b('0x62')];queues[_0x1a9797[_0x401b('0x52')]][_0x401b('0x4c')]=_0x1a9797['secondtransfereruniqueid'];queues[_0x1a9797['origtransfererlinkedid']][_0x401b('0x8')]='ATTENDEDTRANSFER';}if(!_[_0x401b('0x17')](queues[_0x1a9797['secondtransfererlinkedid']])){if(_0x1a9797[_0x401b('0x63')]&&queues[_0x1a9797[_0x401b('0x63')]]){queues[_0x1a9797[_0x401b('0x63')]][_0x401b('0x22')]=0x1;queues[_0x1a9797[_0x401b('0x59')]]=_[_0x401b('0x58')](queues[_0x1a9797['transfertargetlinkedid']]);queues[_0x1a9797[_0x401b('0x59')]][_0x401b('0xe')]=_0x1a9797['transfertargetuniqueid'];queues[_0x1a9797[_0x401b('0x59')]]['queuecallerenterreason']=0x2;queues[_0x1a9797[_0x401b('0x59')]][_0x401b('0x5a')]=queues[_0x1a9797[_0x401b('0x52')]]['calleridnum'];queues[_0x1a9797[_0x401b('0x59')]][_0x401b('0x5b')]=queues[_0x1a9797[_0x401b('0x52')]][_0x401b('0x5b')];queues[_0x1a9797[_0x401b('0x59')]][_0x401b('0x37')]=utils[_0x401b('0x15')]();queues[_0x1a9797['transfertargetuniqueid']][_0x401b('0x19')]=utils[_0x401b('0x15')]();queues[_0x1a9797[_0x401b('0x59')]][_0x401b('0x35')]=0x0;queues[_0x1a9797[_0x401b('0x59')]][_0x401b('0x5c')]=0x0;utils[_0x401b('0x2')](util[_0x401b('0x12')](_0x401b('0x64'),_0x1a9797[_0x401b('0x51')],queues[_0x1a9797[_0x401b('0x59')]]['name'],queues[_0x1a9797[_0x401b('0x59')]][_0x401b('0xe')],queues[_0x1a9797[_0x401b('0x59')]]['calleridnum'],queues[_0x1a9797[_0x401b('0x59')]][_0x401b('0x5b')]));}else{utils['info'](util[_0x401b('0x12')](_0x401b('0x5e'),_0x1a9797[_0x401b('0x51')],queues[_0x1a9797[_0x401b('0x53')]][_0x401b('0x21')],_0x1a9797[_0x401b('0x52')]));queues[_0x1a9797[_0x401b('0x53')]][_0x401b('0xe')]=_0x1a9797['origtransfererlinkedid'];}}}}catch(_0xb1a74c){utils[_0x401b('0x16')](util[_0x401b('0x12')](_0x401b('0x50'),_0x1a9797[_0x401b('0x51')]),_0xb1a74c);}};exports['musiconholdstart']=function(_0x19fbad){try{if(!_[_0x401b('0x17')](queues[_0x19fbad[_0x401b('0x3')]])){utils[_0x401b('0x10')](util[_0x401b('0x12')](_0x401b('0x65'),_0x19fbad[_0x401b('0x3')]),_0x19fbad);queues[_0x19fbad[_0x401b('0x3')]][_0x401b('0x66')]=utils[_0x401b('0x15')]();utils[_0x401b('0x2')](util['format'](_0x401b('0x67'),_0x19fbad[_0x401b('0x3')],queues[_0x19fbad[_0x401b('0x3')]][_0x401b('0x21')],queues[_0x19fbad[_0x401b('0x3')]][_0x401b('0x66')]));}}catch(_0x222748){utils[_0x401b('0x16')](util[_0x401b('0x12')]('[%s][queues][musiconholdstart]',_0x19fbad[_0x401b('0x3')]),_0x222748);}};exports[_0x401b('0x68')]=function(_0x90a947){try{if(!_[_0x401b('0x17')](queues[_0x90a947[_0x401b('0x3')]])){if(!_[_0x401b('0x17')](queues[_0x90a947[_0x401b('0x3')]][_0x401b('0x66')])){utils[_0x401b('0x10')](util['format'](_0x401b('0x69'),_0x90a947[_0x401b('0x3')]),_0x90a947);queues[_0x90a947[_0x401b('0x3')]]['mohtime']+=utils[_0x401b('0x36')](utils[_0x401b('0x15')](),queues[_0x90a947[_0x401b('0x3')]]['musiconholdstartAt']);utils[_0x401b('0x2')](util[_0x401b('0x12')](_0x401b('0x6a'),_0x90a947['uniqueid'],queues[_0x90a947[_0x401b('0x3')]][_0x401b('0x21')],queues[_0x90a947[_0x401b('0x3')]][_0x401b('0x5c')]));delete queues[_0x90a947[_0x401b('0x3')]][_0x401b('0x66')];}}}catch(_0x331401){utils[_0x401b('0x16')](util[_0x401b('0x12')](_0x401b('0x69'),_0x90a947[_0x401b('0x3')]),_0x331401);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 5329995..39574ec 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 _0x7ca5=['membername','name','CreateVoiceRecording','newchannel','linkedid','info','context','exten','channel','error','[%s][recordings][newchannel]','newstate','debug','[%s][recordings][newstate]','isNil','[%s][recordings][newstate]\x20context:%s\x20channel:%s','channelstate','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','replace','.WAV','find','monitors','push','hangup','[%s][recordings][hangup]','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound','forEach','clone','newexten','[%s][recordings][newexten]','application','appdata','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','blindtransfer','[%s][recordings][blindtransfer]','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','transfereruniqueid','lodash','util','./utils','./transfers.controller','format','[%s][recordings][writeDB]','uniqueid','blinds','accountcode','getUserByInternal'];(function(_0x2fbd50,_0xf31c66){var _0xef391d=function(_0x3d5611){while(--_0x3d5611){_0x2fbd50['push'](_0x2fbd50['shift']());}};_0xef391d(++_0xf31c66);}(_0x7ca5,0x1ac));var _0x57ca=function(_0xb57e45,_0x5c2f43){_0xb57e45=_0xb57e45-0x0;var _0x3cce62=_0x7ca5[_0xb57e45];return _0x3cce62;};'use strict';var _=require(_0x57ca('0x0'));var util=require(_0x57ca('0x1'));var utils=require(_0x57ca('0x2'));var transfers=require(_0x57ca('0x3'));var recordings={};function writeDB(_0x359a0f){var _0x13293e;utils['info'](util[_0x57ca('0x4')](_0x57ca('0x5'),_0x359a0f[_0x57ca('0x6')]));if(transfers[_0x57ca('0x7')][_0x359a0f[_0x57ca('0x6')]]){_0x13293e=_0x359a0f[_0x57ca('0x6')];_0x359a0f['uniqueid']=transfers[_0x57ca('0x7')][_0x359a0f[_0x57ca('0x6')]]['transfereeuniqueid'];}if(_0x359a0f[_0x57ca('0x8')]){utils[_0x57ca('0x9')](_0x359a0f[_0x57ca('0x8')])['then'](function(_0x111259){if(_0x111259){_0x359a0f[_0x57ca('0xa')]=_0x111259[_0x57ca('0xb')];_0x359a0f['UserId']=_0x111259['id'];}utils['request'](_0x57ca('0xc'),_0x359a0f);});}else{utils['request'](_0x57ca('0xc'),_0x359a0f);}if(_0x13293e)delete transfers['blinds'][_0x13293e];}exports[_0x57ca('0xd')]=function(_0x208a99){try{utils['debug'](util[_0x57ca('0x4')]('[%s][recordings][newchannel]',_0x208a99[_0x57ca('0x6')]),_0x208a99);if(_0x208a99[_0x57ca('0x6')]==_0x208a99[_0x57ca('0xe')]){utils[_0x57ca('0xf')](util[_0x57ca('0x4')]('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x208a99['uniqueid'],_0x208a99[_0x57ca('0x10')],_0x208a99['exten']));recordings[_0x208a99[_0x57ca('0x6')]]={'uniqueid':_0x208a99[_0x57ca('0x6')],'accountcode':_0x208a99['accountcode'],'exten':_0x208a99[_0x57ca('0x11')],'context':_0x208a99[_0x57ca('0x10')],'channel':_0x208a99[_0x57ca('0x12')],'monitors':[]};}}catch(_0x3298ac){utils[_0x57ca('0x13')](util[_0x57ca('0x4')](_0x57ca('0x14'),_0x208a99[_0x57ca('0x6')]),_0x3298ac);}};exports[_0x57ca('0x15')]=function(_0x3dd33c){try{utils[_0x57ca('0x16')](util[_0x57ca('0x4')](_0x57ca('0x17'),_0x3dd33c[_0x57ca('0x6')]),_0x3dd33c);if(!_[_0x57ca('0x18')](recordings[_0x3dd33c[_0x57ca('0x6')]])&&_0x3dd33c['channelstate']==0x6){utils[_0x57ca('0xf')](util[_0x57ca('0x4')](_0x57ca('0x19'),_0x3dd33c[_0x57ca('0x6')],_0x3dd33c[_0x57ca('0x10')],_0x3dd33c[_0x57ca('0x12')]));}else if(!_['isNil'](recordings[_0x3dd33c[_0x57ca('0xe')]])&&_0x3dd33c[_0x57ca('0x1a')]==0x6&&_0x3dd33c[_0x57ca('0x10')]!=_0x57ca('0x1b')){utils['info'](util['format'](_0x57ca('0x1c'),_0x3dd33c[_0x57ca('0x6')],_0x3dd33c['linkedid'],_0x3dd33c[_0x57ca('0x10')],_0x3dd33c[_0x57ca('0x12')]));recordings[_0x3dd33c[_0x57ca('0xe')]][_0x57ca('0x8')]=_0x3dd33c[_0x57ca('0x8')];}}catch(_0x198cce){utils['error'](util[_0x57ca('0x4')](_0x57ca('0x17'),_0x3dd33c[_0x57ca('0x6')]),_0x198cce);}};exports['varset']=function(_0x4d41cd){try{if(!_[_0x57ca('0x18')](_0x4d41cd[_0x57ca('0x1d')])&&!_[_0x57ca('0x18')](_0x4d41cd['variable'][_0x57ca('0x1e')])){utils[_0x57ca('0x16')](util[_0x57ca('0x4')](_0x57ca('0x1f'),_0x4d41cd['uniqueid']),_0x4d41cd);utils[_0x57ca('0xf')](util[_0x57ca('0x4')](_0x57ca('0x20'),_0x4d41cd[_0x57ca('0x6')],_0x4d41cd[_0x57ca('0x1d')],_0x4d41cd[_0x57ca('0x21')]));if(_[_0x57ca('0x22')](_0x4d41cd[_0x57ca('0x21')],_0x57ca('0x23'))){_0x4d41cd['value']=_0x4d41cd['value'][_0x57ca('0x24')](_0x57ca('0x23'),_0x57ca('0x25'));}if(recordings[_0x4d41cd['linkedid']]){var _0x4efbf4=_[_0x57ca('0x26')](recordings[_0x4d41cd[_0x57ca('0xe')]][_0x57ca('0x27')],{'value':_0x4d41cd[_0x57ca('0x21')]});if(_[_0x57ca('0x18')](_0x4efbf4)){recordings[_0x4d41cd[_0x57ca('0xe')]][_0x57ca('0x27')][_0x57ca('0x28')]({'value':_0x4d41cd[_0x57ca('0x21')]});}}}}catch(_0x554618){utils[_0x57ca('0x13')](util[_0x57ca('0x4')]('[%s][recordings][varset]',_0x4d41cd[_0x57ca('0x6')]),_0x554618);}};exports[_0x57ca('0x29')]=function(_0x5c9d92){try{if(!_[_0x57ca('0x18')](recordings[_0x5c9d92[_0x57ca('0x6')]])){utils[_0x57ca('0x16')](util[_0x57ca('0x4')](_0x57ca('0x2a'),_0x5c9d92[_0x57ca('0x6')]),_0x5c9d92);utils[_0x57ca('0xf')](util['format']('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x5c9d92['uniqueid'],_0x5c9d92[_0x57ca('0x2b')],_0x5c9d92[_0x57ca('0x2c')],_0x5c9d92[_0x57ca('0x2d')]));recordings[_0x5c9d92['uniqueid']][_0x57ca('0x2b')]=_0x5c9d92['calleridnum'];recordings[_0x5c9d92[_0x57ca('0x6')]][_0x57ca('0x2c')]=_0x5c9d92['calleridname'];recordings[_0x5c9d92[_0x57ca('0x6')]][_0x57ca('0x2e')]=_0x5c9d92['connectedlinenum'];recordings[_0x5c9d92[_0x57ca('0x6')]][_0x57ca('0x2f')]=_0x5c9d92['connectedlinename'];if(recordings[_0x5c9d92[_0x57ca('0x6')]][_0x57ca('0x30')]==_0x57ca('0x31')&&recordings[_0x5c9d92[_0x57ca('0x6')]]['accountcode']){recordings[_0x5c9d92[_0x57ca('0x6')]][_0x57ca('0x2e')]=recordings[_0x5c9d92[_0x57ca('0x6')]]['accountcode'];recordings[_0x5c9d92['uniqueid']][_0x57ca('0x2f')]='';}recordings[_0x5c9d92['uniqueid']][_0x57ca('0x27')][_0x57ca('0x32')](function(_0x45d7f0){var _0x51f29=_[_0x57ca('0x33')](recordings[_0x5c9d92[_0x57ca('0x6')]]);_0x51f29[_0x57ca('0x21')]=_0x45d7f0[_0x57ca('0x21')];writeDB(_0x51f29);});delete recordings[_0x5c9d92[_0x57ca('0x6')]];}}catch(_0x20560e){utils[_0x57ca('0x13')](util[_0x57ca('0x4')](_0x57ca('0x2a'),_0x5c9d92[_0x57ca('0x6')]),_0x20560e);}};exports[_0x57ca('0x34')]=function(_0x1ba017){try{if(!_['isNil'](recordings[_0x1ba017[_0x57ca('0x6')]])){utils[_0x57ca('0x16')](util[_0x57ca('0x4')](_0x57ca('0x35'),_0x1ba017[_0x57ca('0x6')]),_0x1ba017);utils[_0x57ca('0xf')](util[_0x57ca('0x4')]('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x1ba017[_0x57ca('0x6')],_0x1ba017[_0x57ca('0x36')],_0x1ba017[_0x57ca('0x37')]));if(_0x1ba017['application'][_0x57ca('0x38')]()==_0x57ca('0x39')&&_[_0x57ca('0x3a')](_0x1ba017['appdata'][_0x57ca('0x38')](),_0x57ca('0x3b'))){var _0x24e32d=_0x1ba017[_0x57ca('0x37')][_0x57ca('0x3c')]('=');var _0x1ce993=_0x24e32d[0x0][_0x57ca('0x3d')](_0x24e32d[0x0][_0x57ca('0x3e')]('(')+0x1,_0x24e32d[0x0][_0x57ca('0x3e')](')'));var _0x12e5e7=_0x24e32d[0x1];recordings[_0x1ba017[_0x57ca('0x6')]][_0x1ce993]=_0x12e5e7;}}}catch(_0x36c15d){utils[_0x57ca('0x13')](util[_0x57ca('0x4')](_0x57ca('0x35'),_0x1ba017[_0x57ca('0x6')]),_0x36c15d);}};exports[_0x57ca('0x3f')]=function(_0x3c7bc7){try{if(!_[_0x57ca('0x18')](recordings[_0x3c7bc7[_0x57ca('0x6')]])){utils[_0x57ca('0x16')](util[_0x57ca('0x4')]('[%s][recordings][queuecallerjoin]',_0x3c7bc7['uniqueid']),_0x3c7bc7);utils['info'](util[_0x57ca('0x4')](_0x57ca('0x40'),_0x3c7bc7[_0x57ca('0x6')],_0x3c7bc7['queue']));recordings[_0x3c7bc7['uniqueid']][_0x57ca('0x41')]=_0x3c7bc7[_0x57ca('0x41')];}}catch(_0x58e4bf){utils[_0x57ca('0x13')](util[_0x57ca('0x4')]('[%s][recordings][queuecallerjoin]',_0x3c7bc7[_0x57ca('0x6')]),_0x58e4bf);}};exports[_0x57ca('0x42')]=function(_0x2c9158){try{utils['debug'](util[_0x57ca('0x4')](_0x57ca('0x43'),_0x2c9158['uniqueid']),_0x2c9158);utils['info'](util[_0x57ca('0x4')]('[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x2c9158[_0x57ca('0x6')],_0x2c9158[_0x57ca('0x44')],_0x2c9158[_0x57ca('0x45')],_0x2c9158[_0x57ca('0x46')],_0x2c9158[_0x57ca('0x47')]));if(recordings[_0x2c9158[_0x57ca('0x48')]]&&transfers[_0x57ca('0x7')][_0x2c9158[_0x57ca('0x48')]]){transfers[_0x57ca('0x7')][_0x2c9158[_0x57ca('0x48')]]['recording']=!![];}}catch(_0x26946f){utils[_0x57ca('0x13')](util[_0x57ca('0x4')](_0x57ca('0x43'),_0x2c9158[_0x57ca('0x6')]),_0x26946f);}}; \ No newline at end of file +var _0x1dc8=['forEach','clone','[%s][recordings][hangup]','newexten','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','split','substring','lastIndexOf','[%s][recordings][newexten]','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','blindtransfer','[%s][recordings][blindtransfer]','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','transfereruniqueid','recording','lodash','util','./utils','info','[%s][recordings][writeDB]','uniqueid','blinds','transfereeuniqueid','accountcode','getUserByInternal','then','name','UserId','request','CreateVoiceRecording','newchannel','debug','format','[%s][recordings][newchannel]','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','exten','channel','error','newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','context','linkedid','transfer','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','.wav49','replace','find','monitors','push','hangup','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','cause-txt','calleridname','connectedlinenum','connectedlinename','type','outbound'];(function(_0x2a86c1,_0x3578a8){var _0x83be1a=function(_0x213019){while(--_0x213019){_0x2a86c1['push'](_0x2a86c1['shift']());}};_0x83be1a(++_0x3578a8);}(_0x1dc8,0x196));var _0x81dc=function(_0xdc9eed,_0x3839d3){_0xdc9eed=_0xdc9eed-0x0;var _0x447fb0=_0x1dc8[_0xdc9eed];return _0x447fb0;};'use strict';var _=require(_0x81dc('0x0'));var util=require(_0x81dc('0x1'));var utils=require(_0x81dc('0x2'));var transfers=require('./transfers.controller');var recordings={};function writeDB(_0x5696aa){var _0x170b3c;utils[_0x81dc('0x3')](util['format'](_0x81dc('0x4'),_0x5696aa[_0x81dc('0x5')]));if(transfers[_0x81dc('0x6')][_0x5696aa['uniqueid']]){_0x170b3c=_0x5696aa[_0x81dc('0x5')];_0x5696aa[_0x81dc('0x5')]=transfers[_0x81dc('0x6')][_0x5696aa['uniqueid']][_0x81dc('0x7')];}if(_0x5696aa[_0x81dc('0x8')]){utils[_0x81dc('0x9')](_0x5696aa[_0x81dc('0x8')])[_0x81dc('0xa')](function(_0x423609){if(_0x423609){_0x5696aa['membername']=_0x423609[_0x81dc('0xb')];_0x5696aa[_0x81dc('0xc')]=_0x423609['id'];}utils[_0x81dc('0xd')](_0x81dc('0xe'),_0x5696aa);});}else{utils['request'](_0x81dc('0xe'),_0x5696aa);}if(_0x170b3c)delete transfers['blinds'][_0x170b3c];}exports[_0x81dc('0xf')]=function(_0x45286c){try{utils[_0x81dc('0x10')](util[_0x81dc('0x11')](_0x81dc('0x12'),_0x45286c[_0x81dc('0x5')]),_0x45286c);if(_0x45286c['uniqueid']==_0x45286c['linkedid']){utils[_0x81dc('0x3')](util[_0x81dc('0x11')](_0x81dc('0x13'),_0x45286c[_0x81dc('0x5')],_0x45286c['context'],_0x45286c['exten']));recordings[_0x45286c[_0x81dc('0x5')]]={'uniqueid':_0x45286c['uniqueid'],'accountcode':_0x45286c['accountcode'],'exten':_0x45286c[_0x81dc('0x14')],'context':_0x45286c['context'],'channel':_0x45286c[_0x81dc('0x15')],'monitors':[]};}}catch(_0x4877ad){utils[_0x81dc('0x16')](util[_0x81dc('0x11')](_0x81dc('0x12'),_0x45286c['uniqueid']),_0x4877ad);}};exports[_0x81dc('0x17')]=function(_0x2a4075){try{utils['debug'](util[_0x81dc('0x11')](_0x81dc('0x18'),_0x2a4075[_0x81dc('0x5')]),_0x2a4075);if(!_[_0x81dc('0x19')](recordings[_0x2a4075['uniqueid']])&&_0x2a4075[_0x81dc('0x1a')]==0x6){utils['info'](util[_0x81dc('0x11')](_0x81dc('0x1b'),_0x2a4075[_0x81dc('0x5')],_0x2a4075[_0x81dc('0x1c')],_0x2a4075[_0x81dc('0x15')]));}else if(!_[_0x81dc('0x19')](recordings[_0x2a4075[_0x81dc('0x1d')]])&&_0x2a4075[_0x81dc('0x1a')]==0x6&&_0x2a4075[_0x81dc('0x1c')]!=_0x81dc('0x1e')){utils['info'](util[_0x81dc('0x11')]('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x2a4075[_0x81dc('0x5')],_0x2a4075[_0x81dc('0x1d')],_0x2a4075['context'],_0x2a4075['channel']));recordings[_0x2a4075['linkedid']][_0x81dc('0x8')]=_0x2a4075['accountcode'];}}catch(_0x2f72db){utils[_0x81dc('0x16')](util[_0x81dc('0x11')]('[%s][recordings][newstate]',_0x2a4075[_0x81dc('0x5')]),_0x2f72db);}};exports['varset']=function(_0x835e10){try{if(!_[_0x81dc('0x19')](_0x835e10[_0x81dc('0x1f')])&&!_[_0x81dc('0x19')](_0x835e10['variable'][_0x81dc('0x20')])){utils[_0x81dc('0x10')](util[_0x81dc('0x11')](_0x81dc('0x21'),_0x835e10[_0x81dc('0x5')]),_0x835e10);utils[_0x81dc('0x3')](util['format'](_0x81dc('0x22'),_0x835e10[_0x81dc('0x5')],_0x835e10[_0x81dc('0x1f')],_0x835e10[_0x81dc('0x23')]));if(_['endsWith'](_0x835e10['value'],_0x81dc('0x24'))){_0x835e10[_0x81dc('0x23')]=_0x835e10[_0x81dc('0x23')][_0x81dc('0x25')](_0x81dc('0x24'),'.WAV');}if(recordings[_0x835e10[_0x81dc('0x1d')]]){var _0x2ed085=_[_0x81dc('0x26')](recordings[_0x835e10[_0x81dc('0x1d')]][_0x81dc('0x27')],{'value':_0x835e10[_0x81dc('0x23')]});if(_[_0x81dc('0x19')](_0x2ed085)){recordings[_0x835e10[_0x81dc('0x1d')]]['monitors'][_0x81dc('0x28')]({'value':_0x835e10['value']});}}}}catch(_0x24cca7){utils[_0x81dc('0x16')](util[_0x81dc('0x11')](_0x81dc('0x21'),_0x835e10['uniqueid']),_0x24cca7);}};exports[_0x81dc('0x29')]=function(_0x251906){try{if(!_['isNil'](recordings[_0x251906[_0x81dc('0x5')]])){utils['debug'](util[_0x81dc('0x11')]('[%s][recordings][hangup]',_0x251906[_0x81dc('0x5')]),_0x251906);utils['info'](util['format'](_0x81dc('0x2a'),_0x251906[_0x81dc('0x5')],_0x251906[_0x81dc('0x2b')],_0x251906['calleridname'],_0x251906[_0x81dc('0x2c')]));recordings[_0x251906[_0x81dc('0x5')]]['calleridnum']=_0x251906[_0x81dc('0x2b')];recordings[_0x251906[_0x81dc('0x5')]][_0x81dc('0x2d')]=_0x251906[_0x81dc('0x2d')];recordings[_0x251906[_0x81dc('0x5')]][_0x81dc('0x2e')]=_0x251906[_0x81dc('0x2e')];recordings[_0x251906[_0x81dc('0x5')]][_0x81dc('0x2f')]=_0x251906[_0x81dc('0x2f')];if(recordings[_0x251906['uniqueid']][_0x81dc('0x30')]==_0x81dc('0x31')&&recordings[_0x251906[_0x81dc('0x5')]][_0x81dc('0x8')]){recordings[_0x251906['uniqueid']][_0x81dc('0x2e')]=recordings[_0x251906[_0x81dc('0x5')]][_0x81dc('0x8')];recordings[_0x251906[_0x81dc('0x5')]][_0x81dc('0x2f')]='';}recordings[_0x251906['uniqueid']][_0x81dc('0x27')][_0x81dc('0x32')](function(_0x18bdeb){var _0x5c190a=_[_0x81dc('0x33')](recordings[_0x251906[_0x81dc('0x5')]]);_0x5c190a[_0x81dc('0x23')]=_0x18bdeb['value'];writeDB(_0x5c190a);});delete recordings[_0x251906[_0x81dc('0x5')]];}}catch(_0x3c4aa8){utils[_0x81dc('0x16')](util[_0x81dc('0x11')](_0x81dc('0x34'),_0x251906[_0x81dc('0x5')]),_0x3c4aa8);}};exports[_0x81dc('0x35')]=function(_0x58e8f2){try{if(!_[_0x81dc('0x19')](recordings[_0x58e8f2[_0x81dc('0x5')]])){utils['debug'](util['format']('[%s][recordings][newexten]',_0x58e8f2['uniqueid']),_0x58e8f2);utils['info'](util[_0x81dc('0x11')](_0x81dc('0x36'),_0x58e8f2['uniqueid'],_0x58e8f2[_0x81dc('0x37')],_0x58e8f2[_0x81dc('0x38')]));if(_0x58e8f2[_0x81dc('0x37')][_0x81dc('0x39')]()==_0x81dc('0x3a')&&_[_0x81dc('0x3b')](_0x58e8f2[_0x81dc('0x38')][_0x81dc('0x39')](),'cdr')){var _0x510eeb=_0x58e8f2[_0x81dc('0x38')][_0x81dc('0x3c')]('=');var _0x18fbed=_0x510eeb[0x0][_0x81dc('0x3d')](_0x510eeb[0x0][_0x81dc('0x3e')]('(')+0x1,_0x510eeb[0x0][_0x81dc('0x3e')](')'));var _0x179159=_0x510eeb[0x1];recordings[_0x58e8f2['uniqueid']][_0x18fbed]=_0x179159;}}}catch(_0x1927c0){utils[_0x81dc('0x16')](util[_0x81dc('0x11')](_0x81dc('0x3f'),_0x58e8f2['uniqueid']),_0x1927c0);}};exports['queuecallerjoin']=function(_0x22cbd5){try{if(!_[_0x81dc('0x19')](recordings[_0x22cbd5['uniqueid']])){utils[_0x81dc('0x10')](util[_0x81dc('0x11')](_0x81dc('0x40'),_0x22cbd5['uniqueid']),_0x22cbd5);utils[_0x81dc('0x3')](util[_0x81dc('0x11')](_0x81dc('0x41'),_0x22cbd5[_0x81dc('0x5')],_0x22cbd5['queue']));recordings[_0x22cbd5[_0x81dc('0x5')]][_0x81dc('0x42')]=_0x22cbd5[_0x81dc('0x42')];}}catch(_0x5752ed){utils[_0x81dc('0x16')](util['format'](_0x81dc('0x40'),_0x22cbd5['uniqueid']),_0x5752ed);}};exports[_0x81dc('0x43')]=function(_0x75addc){try{utils[_0x81dc('0x10')](util[_0x81dc('0x11')](_0x81dc('0x44'),_0x75addc['uniqueid']),_0x75addc);utils[_0x81dc('0x3')](util[_0x81dc('0x11')](_0x81dc('0x45'),_0x75addc[_0x81dc('0x5')],_0x75addc[_0x81dc('0x46')],_0x75addc[_0x81dc('0x47')],_0x75addc[_0x81dc('0x48')],_0x75addc[_0x81dc('0x49')]));if(recordings[_0x75addc['transfereruniqueid']]&&transfers[_0x81dc('0x6')][_0x75addc[_0x81dc('0x4a')]]){transfers['blinds'][_0x75addc['transfereruniqueid']][_0x81dc('0x4b')]=!![];}}catch(_0x265162){utils['error'](util[_0x81dc('0x11')](_0x81dc('0x44'),_0x75addc[_0x81dc('0x5')]),_0x265162);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 02c5ea5..2a96571 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 _0x972d=['info','format','[%s][transfers][writeDB]\x20type:%s','type','origtransfereruniqueid','uniqueid','request','blinds','blindtransfer','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','blind','transfereruniqueid','error','[%s][transfers][blindtransfer]','attendedtransfer','debug','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','origtransfererlinkedid','origtransfererexten','attended','isNil','transfereechannel','assign','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetlinkedid','lodash','util','./utils'];(function(_0x5b34c0,_0x3ad403){var _0x242bd3=function(_0x51d0ce){while(--_0x51d0ce){_0x5b34c0['push'](_0x5b34c0['shift']());}};_0x242bd3(++_0x3ad403);}(_0x972d,0x12a));var _0xd972=function(_0x15a164,_0x4046ab){_0x15a164=_0x15a164-0x0;var _0x35b8ef=_0x972d[_0x15a164];return _0x35b8ef;};'use strict';var _=require(_0xd972('0x0'));var util=require(_0xd972('0x1'));var utils=require(_0xd972('0x2'));function writeDB(_0x241a79){utils[_0xd972('0x3')](util[_0xd972('0x4')](_0xd972('0x5'),_0x241a79[_0xd972('0x6')]==='attended'?_0x241a79[_0xd972('0x7')]:_0x241a79[_0xd972('0x8')],_0x241a79[_0xd972('0x6')]));utils[_0xd972('0x9')]('CreateVoiceTransferReport',_0x241a79);}exports[_0xd972('0xa')]={};exports[_0xd972('0xb')]=function(_0x791559){try{utils['debug'](util[_0xd972('0x4')]('[%s][transfers][blindtransfer]',_0x791559[_0xd972('0x8')]),_0x791559);utils[_0xd972('0x3')](util[_0xd972('0x4')](_0xd972('0xc'),_0x791559[_0xd972('0x8')],_0x791559[_0xd972('0xd')],_0x791559[_0xd972('0xe')],_0x791559[_0xd972('0xf')],_0x791559['transfereecalleridname']));_0x791559['type']=_0xd972('0x10');exports[_0xd972('0xa')][_0x791559[_0xd972('0x11')]]=_0x791559;writeDB(_0x791559);}catch(_0x4cf2e8){utils[_0xd972('0x12')](util['format'](_0xd972('0x13'),_0x791559[_0xd972('0x8')]),_0x4cf2e8);}};exports[_0xd972('0x14')]=function(_0x2bff3e){try{utils[_0xd972('0x15')](util['format'](_0xd972('0x16'),_0x2bff3e['origtransfereruniqueid']),_0x2bff3e);utils[_0xd972('0x3')](util[_0xd972('0x4')](_0xd972('0x17'),_0x2bff3e[_0xd972('0x7')],_0x2bff3e[_0xd972('0x18')],_0x2bff3e[_0xd972('0x19')],_0x2bff3e[_0xd972('0x1a')],_0x2bff3e[_0xd972('0x1b')]));_0x2bff3e=_['assign'](_0x2bff3e,{'transfererchannel':_0x2bff3e[_0xd972('0x1c')],'transferercalleridnum':_0x2bff3e[_0xd972('0x18')],'transferercalleridname':_0x2bff3e[_0xd972('0x19')],'transfererconnectedlinenum':_0x2bff3e[_0xd972('0x1d')],'transfererconnectedlinename':_0x2bff3e[_0xd972('0x1e')],'transfereraccountcode':_0x2bff3e[_0xd972('0x1f')],'transferercontext':_0x2bff3e[_0xd972('0x20')],'transfererexten':_0x2bff3e['secondtransfererexten'],'transfererlinkedid':_0x2bff3e[_0xd972('0x21')],'context':_0x2bff3e['origtransferercontext'],'extension':_0x2bff3e[_0xd972('0x22')],'type':_0xd972('0x23')});if(_[_0xd972('0x24')](_0x2bff3e[_0xd972('0x25')])){_0x2bff3e=_[_0xd972('0x26')](_0x2bff3e,{'transfereechannel':_0x2bff3e[_0xd972('0x27')],'transfereecalleridnum':_0x2bff3e[_0xd972('0x1a')],'transfereecalleridname':_0x2bff3e[_0xd972('0x1b')],'transfereeconnectedlinenum':_0x2bff3e[_0xd972('0x28')],'transfereeconnectedlinename':_0x2bff3e[_0xd972('0x29')],'transfereeaccountcode':_0x2bff3e['transfertargetaccountcode'],'transfereecontext':_0x2bff3e['transfertargetcontext'],'transfereeexten':_0x2bff3e['transfertargetexten'],'transfereelinkedid':_0x2bff3e[_0xd972('0x2a')]});}writeDB(_0x2bff3e);}catch(_0x33aa4b){utils['error'](util[_0xd972('0x4')](_0xd972('0x16'),_0x2bff3e[_0xd972('0x7')]),_0x33aa4b);}}; \ No newline at end of file +var _0x51c1=['error','lodash','util','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','attended','origtransfereruniqueid','uniqueid','type','request','CreateVoiceTransferReport','blinds','blindtransfer','debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridname','transfereecalleridnum','transfereecalleridname','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransfererexten','origtransfererlinkedid','origtransfererexten','assign','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetlinkedid'];(function(_0x1ec9e9,_0x3383b1){var _0x139705=function(_0x5843f9){while(--_0x5843f9){_0x1ec9e9['push'](_0x1ec9e9['shift']());}};_0x139705(++_0x3383b1);}(_0x51c1,0x99));var _0x151c=function(_0x22377a,_0x3397cb){_0x22377a=_0x22377a-0x0;var _0x36f105=_0x51c1[_0x22377a];return _0x36f105;};'use strict';var _=require(_0x151c('0x0'));var util=require(_0x151c('0x1'));var utils=require(_0x151c('0x2'));function writeDB(_0x38420f){utils[_0x151c('0x3')](util[_0x151c('0x4')](_0x151c('0x5'),_0x38420f['type']===_0x151c('0x6')?_0x38420f[_0x151c('0x7')]:_0x38420f[_0x151c('0x8')],_0x38420f[_0x151c('0x9')]));utils[_0x151c('0xa')](_0x151c('0xb'),_0x38420f);}exports[_0x151c('0xc')]={};exports[_0x151c('0xd')]=function(_0x336edd){try{utils[_0x151c('0xe')](util[_0x151c('0x4')](_0x151c('0xf'),_0x336edd['uniqueid']),_0x336edd);utils[_0x151c('0x3')](util['format'](_0x151c('0x10'),_0x336edd[_0x151c('0x8')],_0x336edd['transferercalleridnum'],_0x336edd[_0x151c('0x11')],_0x336edd[_0x151c('0x12')],_0x336edd[_0x151c('0x13')]));_0x336edd[_0x151c('0x9')]='blind';exports['blinds'][_0x336edd['transfereruniqueid']]=_0x336edd;writeDB(_0x336edd);}catch(_0x20fb6a){utils['error'](util[_0x151c('0x4')](_0x151c('0xf'),_0x336edd['uniqueid']),_0x20fb6a);}};exports['attendedtransfer']=function(_0x3d3ed5){try{utils[_0x151c('0xe')](util[_0x151c('0x4')](_0x151c('0x14'),_0x3d3ed5[_0x151c('0x7')]),_0x3d3ed5);utils['info'](util[_0x151c('0x4')](_0x151c('0x15'),_0x3d3ed5['origtransfereruniqueid'],_0x3d3ed5[_0x151c('0x16')],_0x3d3ed5[_0x151c('0x17')],_0x3d3ed5[_0x151c('0x18')],_0x3d3ed5['transfertargetcalleridname']));_0x3d3ed5=_['assign'](_0x3d3ed5,{'transfererchannel':_0x3d3ed5['origtransfererchannel'],'transferercalleridnum':_0x3d3ed5[_0x151c('0x16')],'transferercalleridname':_0x3d3ed5[_0x151c('0x17')],'transfererconnectedlinenum':_0x3d3ed5[_0x151c('0x19')],'transfererconnectedlinename':_0x3d3ed5[_0x151c('0x1a')],'transfereraccountcode':_0x3d3ed5['origtransfereraccountcode'],'transferercontext':_0x3d3ed5['secondtransferercontext'],'transfererexten':_0x3d3ed5[_0x151c('0x1b')],'transfererlinkedid':_0x3d3ed5[_0x151c('0x1c')],'context':_0x3d3ed5['origtransferercontext'],'extension':_0x3d3ed5[_0x151c('0x1d')],'type':_0x151c('0x6')});if(_['isNil'](_0x3d3ed5['transfereechannel'])){_0x3d3ed5=_[_0x151c('0x1e')](_0x3d3ed5,{'transfereechannel':_0x3d3ed5[_0x151c('0x1f')],'transfereecalleridnum':_0x3d3ed5[_0x151c('0x18')],'transfereecalleridname':_0x3d3ed5['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x3d3ed5[_0x151c('0x20')],'transfereeconnectedlinename':_0x3d3ed5[_0x151c('0x21')],'transfereeaccountcode':_0x3d3ed5[_0x151c('0x22')],'transfereecontext':_0x3d3ed5[_0x151c('0x23')],'transfereeexten':_0x3d3ed5['transfertargetexten'],'transfereelinkedid':_0x3d3ed5[_0x151c('0x24')]});}writeDB(_0x3d3ed5);}catch(_0x5166b2){utils[_0x151c('0x25')](util[_0x151c('0x4')]('[%s][transfers][attendedtransfer]',_0x3d3ed5[_0x151c('0x7')]),_0x5166b2);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index a71d1d9..e331c47 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 _0x9c32=['request','then','[utils][request]\x20name:%s','catch','GetUser','name','interface','[utils][getUser]\x20where:%s','stringify','result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','[utils][getUserByInternal]','notfound','[utils][getUserByInterface]','GetVoiceQueue','type','acw','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','length','[utils][getVoiceQueueByName]','addTime','add','seconds','YYYY-MM-DD\x20HH:mm:ss','format','diffTime','diff','isBefore','jayson/promise','client','http','../../config/logger','info','inspect','debug','error'];(function(_0x3b8f84,_0x4c2a7a){var _0x548540=function(_0x4137d9){while(--_0x4137d9){_0x3b8f84['push'](_0x3b8f84['shift']());}};_0x548540(++_0x4c2a7a);}(_0x9c32,0xbb));var _0x29c3=function(_0x237178,_0x413fe0){_0x237178=_0x237178-0x0;var _0x3e2fd0=_0x9c32[_0x237178];return _0x3e2fd0;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x29c3('0x0'));var moment=require('moment');var util=require('util');var client=jayson[_0x29c3('0x1')][_0x29c3('0x2')]({'port':0x2329});var logger=require(_0x29c3('0x3'))('xdr');exports[_0x29c3('0x4')]=function(_0x402499,_0x40b2bf){logger[_0x29c3('0x4')](_0x402499,_0x40b2bf?util[_0x29c3('0x5')](_0x40b2bf,{'showHidden':![],'depth':null}):'');};exports[_0x29c3('0x6')]=function(_0x373ed0,_0x424874){logger[_0x29c3('0x6')](_0x373ed0,_0x424874?util[_0x29c3('0x5')](_0x424874,{'showHidden':![],'depth':null}):'');};exports[_0x29c3('0x7')]=function(_0xa5dfeb,_0x553e70){logger[_0x29c3('0x7')](_0xa5dfeb,_0x553e70?util[_0x29c3('0x5')](_0x553e70,{'showHidden':![],'depth':null}):'');};exports[_0x29c3('0x8')]=function(_0x590452,_0x22c128){return client[_0x29c3('0x8')](_0x590452,{'body':_0x22c128})[_0x29c3('0x9')](function(_0x53aec3){logger['debug'](_0x29c3('0xa'),_0x590452,_0x53aec3?util['inspect'](_0x53aec3,{'showHidden':![],'depth':null}):'');})[_0x29c3('0xb')](function(_0x5f157f){logger[_0x29c3('0x7')](_0x29c3('0xa'),_0x590452,_0x5f157f?util[_0x29c3('0x5')](_0x5f157f,{'showHidden':![],'depth':null}):'');});};function getUser(_0x486a10){return client[_0x29c3('0x8')](_0x29c3('0xc'),{'options':{'raw':!![],'attributes':['id','internal',_0x29c3('0xd'),_0x29c3('0xe')],'where':_0x486a10,'limit':0x1}})[_0x29c3('0x9')](function(_0x9ee76f){logger[_0x29c3('0x6')](_0x29c3('0xf'),JSON[_0x29c3('0x10')](_0x486a10),_0x9ee76f?util['inspect'](_0x9ee76f,{'showHidden':![],'depth':null}):'');return _0x9ee76f[_0x29c3('0x11')]['length']?_0x9ee76f[_0x29c3('0x11')][0x0]:null;});}exports[_0x29c3('0x12')]=function(_0x531088){return new BPromise(function(_0x143f3c,_0x284b80){if(_0x531088){return getUser({'internal':_0x531088})[_0x29c3('0x9')](function(_0x3f8a9e){logger[_0x29c3('0x4')](_0x29c3('0x13'),_0x531088,_0x3f8a9e?_0x29c3('0x14'):'notfound');return _0x143f3c(_0x3f8a9e);})[_0x29c3('0xb')](function(_0x37a6e8){logger[_0x29c3('0x7')](_0x29c3('0x15'),_0x37a6e8?util[_0x29c3('0x5')](_0x37a6e8,{'showHidden':![],'depth':null}):'');return _0x143f3c(null);});}return _0x143f3c(null);});};exports['getUserByInterface']=function(_0x9c29c4){return new BPromise(function(_0x4183bb,_0x308f88){if(_0x9c29c4){return getUser({'interface':_0x9c29c4})[_0x29c3('0x9')](function(_0x507778){logger[_0x29c3('0x4')]('[utils][getUserByInterface]\x20interface:%s\x20%s',_0x9c29c4,_0x507778?_0x29c3('0x14'):_0x29c3('0x16'));return _0x4183bb(_0x507778);})['catch'](function(_0x369c8f){logger['error'](_0x29c3('0x17'),_0x369c8f?util['inspect'](_0x369c8f,{'showHidden':![],'depth':null}):'');return _0x4183bb(null);});}return _0x4183bb(null);});};exports['getUserByName']=function(_0x3d10f1){return new BPromise(function(_0x5684c8,_0x4d45e6){if(_0x3d10f1){return getUser({'name':_0x3d10f1})[_0x29c3('0x9')](function(_0xa9a7bd){logger['info']('[utils][getUserByName]\x20name:%s\x20%s',_0x3d10f1,_0xa9a7bd?_0x29c3('0x14'):_0x29c3('0x16'));return _0x5684c8(_0xa9a7bd);})[_0x29c3('0xb')](function(_0x511341){logger['error']('[utils][getUserByName]',_0x511341?util[_0x29c3('0x5')](_0x511341,{'showHidden':![],'depth':null}):'');return _0x5684c8(null);});}return _0x5684c8(null);});};exports['getVoiceQueueByName']=function(_0x5b6044){return new BPromise(function(_0x69ae6f,_0x3aedf3){if(_0x5b6044){return client['request'](_0x29c3('0x18'),{'options':{'raw':!![],'attributes':['id',_0x29c3('0xd'),_0x29c3('0x19'),_0x29c3('0x1a'),'acwTimeout'],'where':{'name':_0x5b6044},'limit':0x1}})['then'](function(_0x490200){logger[_0x29c3('0x6')](_0x29c3('0x1b'),_0x5b6044,_0x490200?util[_0x29c3('0x5')](_0x490200,{'showHidden':![],'depth':null}):'');logger[_0x29c3('0x4')](_0x29c3('0x1c'),_0x5b6044,_0x490200?'found':_0x29c3('0x16'));return _0x69ae6f(_0x490200[_0x29c3('0x11')][_0x29c3('0x1d')]?_0x490200[_0x29c3('0x11')][0x0]:null);})[_0x29c3('0xb')](function(_0x54e50f){logger[_0x29c3('0x7')](_0x29c3('0x1e'),_0x54e50f?util[_0x29c3('0x5')](_0x54e50f,{'showHidden':![],'depth':null}):'');return _0x69ae6f(null);});}return _0x69ae6f(null);});};exports[_0x29c3('0x1f')]=function(_0x166400,_0x218626){return moment(_0x166400)[_0x29c3('0x20')](_0x218626,_0x29c3('0x21'))['format'](_0x29c3('0x22'));};exports['subtractTime']=function(_0x1890dd,_0x5c3266){return moment(_0x1890dd)['subtract'](_0x5c3266,'seconds')[_0x29c3('0x23')](_0x29c3('0x22'));};exports[_0x29c3('0x24')]=function(_0x1f7ba2,_0x443b42){return moment(_0x1f7ba2)[_0x29c3('0x25')](moment(_0x443b42),_0x29c3('0x21'));};exports['sumTime']=function(_0x18965c,_0x3b45d0){return parseInt(_0x18965c,0xa)+parseInt(_0x3b45d0,0xa);};exports['now']=function(){return moment()['format'](_0x29c3('0x22'));};exports['isAfter']=function(_0x10fa5a,_0x28e2de){if(_0x28e2de){return moment(_0x10fa5a)['isAfter'](_0x28e2de);}return!![];};exports[_0x29c3('0x26')]=function(_0x1d0b7c,_0x4b2183){if(_0x4b2183){return moment(_0x1d0b7c)[_0x29c3('0x26')](_0x4b2183);}else if(_0x1d0b7c){return!![];}return![];}; \ No newline at end of file +var _0xf34b=['diffTime','diff','seconds','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','moment','util','client','http','../../config/logger','xdr','info','debug','inspect','error','request','then','GetUser','internal','interface','[utils][getUser]\x20where:%s','result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','notfound','catch','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','found','[utils][getUserByInterface]','[utils][getUserByName]\x20name:%s\x20%s','getVoiceQueueByName','GetVoiceQueue','name','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','length','[utils][getVoiceQueueByName]','addTime','add','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract'];(function(_0x4489f2,_0x1f9128){var _0x5cc527=function(_0x44201f){while(--_0x44201f){_0x4489f2['push'](_0x4489f2['shift']());}};_0x5cc527(++_0x1f9128);}(_0xf34b,0xa3));var _0xbf34=function(_0x27511c,_0x5ed948){_0x27511c=_0x27511c-0x0;var _0x48ea8b=_0xf34b[_0x27511c];return _0x48ea8b;};'use strict';var BPromise=require(_0xbf34('0x0'));var jayson=require(_0xbf34('0x1'));var moment=require(_0xbf34('0x2'));var util=require(_0xbf34('0x3'));var client=jayson[_0xbf34('0x4')][_0xbf34('0x5')]({'port':0x2329});var logger=require(_0xbf34('0x6'))(_0xbf34('0x7'));exports[_0xbf34('0x8')]=function(_0x1216b1,_0x3d6e79){logger['info'](_0x1216b1,_0x3d6e79?util['inspect'](_0x3d6e79,{'showHidden':![],'depth':null}):'');};exports[_0xbf34('0x9')]=function(_0x409521,_0x4e45d1){logger[_0xbf34('0x9')](_0x409521,_0x4e45d1?util[_0xbf34('0xa')](_0x4e45d1,{'showHidden':![],'depth':null}):'');};exports[_0xbf34('0xb')]=function(_0x1c4aba,_0x18af75){logger[_0xbf34('0xb')](_0x1c4aba,_0x18af75?util[_0xbf34('0xa')](_0x18af75,{'showHidden':![],'depth':null}):'');};exports[_0xbf34('0xc')]=function(_0x16683f,_0x1ef9f){return client[_0xbf34('0xc')](_0x16683f,{'body':_0x1ef9f})[_0xbf34('0xd')](function(_0x25ce3a){logger[_0xbf34('0x9')]('[utils][request]\x20name:%s',_0x16683f,_0x25ce3a?util[_0xbf34('0xa')](_0x25ce3a,{'showHidden':![],'depth':null}):'');})['catch'](function(_0x32519d){logger[_0xbf34('0xb')]('[utils][request]\x20name:%s',_0x16683f,_0x32519d?util[_0xbf34('0xa')](_0x32519d,{'showHidden':![],'depth':null}):'');});};function getUser(_0x39b8f8){return client[_0xbf34('0xc')](_0xbf34('0xe'),{'options':{'raw':!![],'attributes':['id',_0xbf34('0xf'),'name',_0xbf34('0x10')],'where':_0x39b8f8,'limit':0x1}})[_0xbf34('0xd')](function(_0x5c6645){logger[_0xbf34('0x9')](_0xbf34('0x11'),JSON['stringify'](_0x39b8f8),_0x5c6645?util[_0xbf34('0xa')](_0x5c6645,{'showHidden':![],'depth':null}):'');return _0x5c6645[_0xbf34('0x12')]['length']?_0x5c6645['result'][0x0]:null;});}exports[_0xbf34('0x13')]=function(_0x40b4f9){return new BPromise(function(_0x126a79,_0x21cbb8){if(_0x40b4f9){return getUser({'internal':_0x40b4f9})[_0xbf34('0xd')](function(_0x2983dc){logger[_0xbf34('0x8')](_0xbf34('0x14'),_0x40b4f9,_0x2983dc?'found':_0xbf34('0x15'));return _0x126a79(_0x2983dc);})[_0xbf34('0x16')](function(_0x2a3185){logger[_0xbf34('0xb')](_0xbf34('0x17'),_0x2a3185?util[_0xbf34('0xa')](_0x2a3185,{'showHidden':![],'depth':null}):'');return _0x126a79(null);});}return _0x126a79(null);});};exports[_0xbf34('0x18')]=function(_0x1affec){return new BPromise(function(_0x45b3f0,_0x39fcaf){if(_0x1affec){return getUser({'interface':_0x1affec})[_0xbf34('0xd')](function(_0x3893cf){logger[_0xbf34('0x8')](_0xbf34('0x19'),_0x1affec,_0x3893cf?_0xbf34('0x1a'):_0xbf34('0x15'));return _0x45b3f0(_0x3893cf);})[_0xbf34('0x16')](function(_0x27c0e0){logger[_0xbf34('0xb')](_0xbf34('0x1b'),_0x27c0e0?util['inspect'](_0x27c0e0,{'showHidden':![],'depth':null}):'');return _0x45b3f0(null);});}return _0x45b3f0(null);});};exports['getUserByName']=function(_0x5d9d8f){return new BPromise(function(_0x3120e8,_0x27340f){if(_0x5d9d8f){return getUser({'name':_0x5d9d8f})[_0xbf34('0xd')](function(_0x1f7ae7){logger['info'](_0xbf34('0x1c'),_0x5d9d8f,_0x1f7ae7?'found':_0xbf34('0x15'));return _0x3120e8(_0x1f7ae7);})[_0xbf34('0x16')](function(_0x5d9139){logger['error']('[utils][getUserByName]',_0x5d9139?util[_0xbf34('0xa')](_0x5d9139,{'showHidden':![],'depth':null}):'');return _0x3120e8(null);});}return _0x3120e8(null);});};exports[_0xbf34('0x1d')]=function(_0x2ba66c){return new BPromise(function(_0x1659cf,_0x33bf49){if(_0x2ba66c){return client[_0xbf34('0xc')](_0xbf34('0x1e'),{'options':{'raw':!![],'attributes':['id',_0xbf34('0x1f'),_0xbf34('0x20'),_0xbf34('0x21'),_0xbf34('0x22')],'where':{'name':_0x2ba66c},'limit':0x1}})['then'](function(_0x43b7d7){logger[_0xbf34('0x9')](_0xbf34('0x23'),_0x2ba66c,_0x43b7d7?util[_0xbf34('0xa')](_0x43b7d7,{'showHidden':![],'depth':null}):'');logger[_0xbf34('0x8')](_0xbf34('0x24'),_0x2ba66c,_0x43b7d7?'found':'notfound');return _0x1659cf(_0x43b7d7[_0xbf34('0x12')][_0xbf34('0x25')]?_0x43b7d7['result'][0x0]:null);})[_0xbf34('0x16')](function(_0x96bc5d){logger['error'](_0xbf34('0x26'),_0x96bc5d?util[_0xbf34('0xa')](_0x96bc5d,{'showHidden':![],'depth':null}):'');return _0x1659cf(null);});}return _0x1659cf(null);});};exports[_0xbf34('0x27')]=function(_0x18c8d1,_0x30dd89){return moment(_0x18c8d1)[_0xbf34('0x28')](_0x30dd89,'seconds')[_0xbf34('0x29')](_0xbf34('0x2a'));};exports[_0xbf34('0x2b')]=function(_0x3901d8,_0x145703){return moment(_0x3901d8)[_0xbf34('0x2c')](_0x145703,'seconds')['format'](_0xbf34('0x2a'));};exports[_0xbf34('0x2d')]=function(_0x48e08c,_0x192ca4){return moment(_0x48e08c)[_0xbf34('0x2e')](moment(_0x192ca4),_0xbf34('0x2f'));};exports[_0xbf34('0x30')]=function(_0x36ad7b,_0x29add7){return parseInt(_0x36ad7b,0xa)+parseInt(_0x29add7,0xa);};exports[_0xbf34('0x31')]=function(){return moment()[_0xbf34('0x29')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0xbf34('0x32')]=function(_0x549c61,_0x3073fd){if(_0x3073fd){return moment(_0x549c61)[_0xbf34('0x32')](_0x3073fd);}return!![];};exports['isBefore']=function(_0x10fab4,_0x34d807){if(_0x34d807){return moment(_0x10fab4)[_0xbf34('0x33')](_0x34d807);}else if(_0x10fab4){return!![];}return![];}; \ No newline at end of file